diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..df078ac22 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +node_modules/ +*.log +.DS_Store +coverage/ +.nyc_output/ +.vscode/ +package-lock.json \ No newline at end of file diff --git a/_locales/ar/messages.json b/_locales/ar/messages.json index de8cc3e02..0dae4bcfa 100644 --- a/_locales/ar/messages.json +++ b/_locales/ar/messages.json @@ -512,6 +512,9 @@ "orange": { "message": "برتقالي" }, + "originalTitleToggle": { + "message": "التبديل بين العنوان الأصلي/المترجم" + }, "os": { "message": "نظام التشغيل" }, diff --git a/_locales/de/messages.json b/_locales/de/messages.json index 7fe8b349b..79d97943f 100644 --- a/_locales/de/messages.json +++ b/_locales/de/messages.json @@ -983,6 +983,9 @@ "orange": { "message": "Orange" }, + "originalTitleToggle": { + "message": "Originalen/übersetzten Titel umschalten" + }, "os": { "message": "Betriebsystem" }, diff --git a/_locales/en/messages.json b/_locales/en/messages.json index fc0f742cf..a7897b2f5 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -314,9 +314,6 @@ "characterEdgeStyle": { "message": "Character Edge Style" }, - "cinemaMode": { - "message": "Cinema Mode" - }, "clip": { "message": "Clip" }, @@ -692,6 +689,9 @@ "hideDetails": { "message": "Hide details" }, + "originalTitleToggle": { + "message": "Toggle original/translated title" + }, "hideEndscreen": { "message": "Hide endscreen" }, diff --git a/_locales/es/messages.json b/_locales/es/messages.json index 790db6885..44aefae17 100644 --- a/_locales/es/messages.json +++ b/_locales/es/messages.json @@ -734,6 +734,9 @@ "orange": { "message": "Naranja" }, + "originalTitleToggle": { + "message": "Alternar título original/traducido" + }, "os": { "message": "OS" }, diff --git a/_locales/fr/messages.json b/_locales/fr/messages.json index 95f392045..ecaa37cc9 100644 --- a/_locales/fr/messages.json +++ b/_locales/fr/messages.json @@ -455,6 +455,9 @@ "openPopupPlayer": { "message": "Ouvrir Video/playlist dans un nouvelle onglet" }, + "originalTitleToggle": { + "message": "Basculer entre titre original/traduit" + }, "other": { "message": "Autres" }, diff --git a/_locales/hi/messages.json b/_locales/hi/messages.json index 30e64076f..324c60a72 100644 --- a/_locales/hi/messages.json +++ b/_locales/hi/messages.json @@ -545,6 +545,9 @@ "orange": { "message": "नारंगी रंग" }, + "originalTitleToggle": { + "message": "मूल/अनुवादित शीर्षक टॉगल करें" + }, "os": { "message": "ओ एस" }, diff --git a/_locales/it/messages.json b/_locales/it/messages.json index c9bd45458..c2e8e1d7a 100644 --- a/_locales/it/messages.json +++ b/_locales/it/messages.json @@ -614,6 +614,9 @@ "orange": { "message": "Arancione" }, + "originalTitleToggle": { + "message": "Alterna titolo originale/tradotto" + }, "os": { "message": "Sistema Operativo" }, diff --git a/_locales/ja/messages.json b/_locales/ja/messages.json index 80b65b7aa..92f00decc 100644 --- a/_locales/ja/messages.json +++ b/_locales/ja/messages.json @@ -683,6 +683,9 @@ "orange": { "message": "オレンジ" }, + "originalTitleToggle": { + "message": "元のタイトル/翻訳されたタイトルを切り替え" + }, "other": { "message": "その他" }, diff --git a/_locales/ko/messages.json b/_locales/ko/messages.json index ae971f873..d1832371f 100644 --- a/_locales/ko/messages.json +++ b/_locales/ko/messages.json @@ -977,6 +977,9 @@ "orange": { "message": "주황" }, + "originalTitleToggle": { + "message": "원본/번역된 제목 전환" + }, "os": { "message": "운영체제" }, diff --git a/_locales/nl/messages.json b/_locales/nl/messages.json index 023ec5a13..e83e5c2fc 100644 --- a/_locales/nl/messages.json +++ b/_locales/nl/messages.json @@ -566,6 +566,9 @@ "orange": { "message": "Oranje" }, + "originalTitleToggle": { + "message": "Schakel tussen originele/vertaalde titel" + }, "os": { "message": "Besturingssysteem" }, diff --git a/_locales/pl/messages.json b/_locales/pl/messages.json index d3463615b..783a91079 100644 --- a/_locales/pl/messages.json +++ b/_locales/pl/messages.json @@ -632,6 +632,9 @@ "orange": { "message": "Pomarańczowy" }, + "originalTitleToggle": { + "message": "Przełącz tytuł oryginalny/przetłumaczony" + }, "other": { "message": "Inne" }, diff --git a/_locales/pt/messages.json b/_locales/pt/messages.json index 6e275f4ed..1ef0e66a4 100644 --- a/_locales/pt/messages.json +++ b/_locales/pt/messages.json @@ -869,6 +869,9 @@ "orange": { "message": "Laranja" }, + "originalTitleToggle": { + "message": "Alternar título original/traduzido" + }, "os": { "message": "Sistema Operacional" }, diff --git a/_locales/ru/messages.json b/_locales/ru/messages.json index cee7e2075..de70d81a6 100644 --- a/_locales/ru/messages.json +++ b/_locales/ru/messages.json @@ -677,6 +677,9 @@ "orange": { "message": "Оранжевый" }, + "originalTitleToggle": { + "message": "Переключить оригинальное/переведённое название" + }, "os": { "message": "ОС" }, diff --git a/_locales/sk/messages.json b/_locales/sk/messages.json index fd9e9aae9..0e1bace5a 100644 --- a/_locales/sk/messages.json +++ b/_locales/sk/messages.json @@ -455,6 +455,9 @@ "orange": { "message": "Oranžová" }, + "originalTitleToggle": { + "message": "Prepnúť pôvodný/preložený názov" + }, "other": { "message": "Ostatné" }, diff --git a/_locales/tr/messages.json b/_locales/tr/messages.json index e57be626b..d49b3c0af 100644 --- a/_locales/tr/messages.json +++ b/_locales/tr/messages.json @@ -725,6 +725,9 @@ "orange": { "message": "Turuncu" }, + "originalTitleToggle": { + "message": "Orijinal/çevrilmiş başlığı değiştir" + }, "other": { "message": "Diğer" }, diff --git a/_locales/zh/messages.json b/_locales/zh/messages.json index 6a7229cbc..a475adfe1 100644 --- a/_locales/zh/messages.json +++ b/_locales/zh/messages.json @@ -194,6 +194,9 @@ "ok": { "message": "確定" }, + "originalTitleToggle": { + "message": "切换原始/翻译标题" + }, "other": { "message": "其他" }, diff --git a/background.js b/background.js index 93473d422..1ad3f7151 100644 --- a/background.js +++ b/background.js @@ -320,6 +320,54 @@ chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) { } else { console.error('Permission is not granted.'); } }) break + case 'get-original-title': + case 'fetch-video-page': + // Fetch the original title without CORS restrictions + if (message.videoId) { + fetch(`https://www.youtube.com/watch?v=${message.videoId}`) + .then(response => response.text()) + .then(html => { + // Helper function to decode HTML entities (without DOM) + function decodeHtmlEntities(text) { + return text + .replace(/&/g, '&') + .replace(/</g, '<') + .replace(/>/g, '>') + .replace(/"/g, '"') + .replace(/'/g, "'") + .replace(/&#(\d+);/g, (match, dec) => String.fromCharCode(dec)) + .replace(/&#x([0-9a-f]+);/gi, (match, hex) => String.fromCharCode(parseInt(hex, 16))); + } + + // Extract title from HTML + const titleMatch = html.match(/ String.fromCharCode(parseInt(code, 16))); + const decodedTitle = decodeHtmlEntities(title); + console.log('Background: Found title from JSON:', decodedTitle); + sendResponse({ title: decodedTitle }); + } else { + console.log('Background: No title found in HTML'); + sendResponse({ title: null }); + } + } + }) + .catch(error => { + console.error('Background: Error fetching original title:', error); + sendResponse({ title: null }); + }); + return true; // Keep the message channel open for async response + } + break } }); /*-----# UNINSTALL URL-----------------------------------*/ diff --git a/build/manifest3Firefox.json b/build/manifest3Firefox.json index 0ecc1f22d..6783d693b 100644 --- a/build/manifest3Firefox.json +++ b/build/manifest3Firefox.json @@ -38,6 +38,7 @@ "js&css/extension/www.youtube.com/appearance/header/header.css", "js&css/extension/www.youtube.com/appearance/player/player.css", "js&css/extension/www.youtube.com/appearance/details/details.css", + "js&css/extension/www.youtube.com/appearance/details/original-title.css", "js&css/extension/www.youtube.com/appearance/sidebar/sidebar.css", "js&css/extension/www.youtube.com/appearance/comments/comments.css" ], @@ -82,6 +83,7 @@ "js&css/web-accessible/www.youtube.com/shortcuts.js", "js&css/web-accessible/www.youtube.com/blocklist.js", "js&css/web-accessible/www.youtube.com/settings.js", + "js&css/web-accessible/www.youtube.com/original-title.js", "js&css/web-accessible/init.js", "menu/icons/48.png" ], diff --git a/jest.config.js b/jest.config.js index 5e9923b5e..ae01a34dd 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,8 +1,17 @@ module.exports = { + testEnvironment: 'jsdom', testPathIgnorePatterns: [ "/node_modules/" ], testMatch: [ "**/tests/**/*.js" + ], + collectCoverage: true, + coverageDirectory: "coverage", + coverageReporters: ["text", "lcov", "html"], + collectCoverageFrom: [ + "js&css/**/*.js", + "!js&css/**/node_modules/**", + "!js&css/web-accessible/www.youtube.com/original-title.js" // We'll test this file ] }; diff --git a/js&css/extension/core.js b/js&css/extension/core.js index 42dadca7c..2f5b58a55 100644 --- a/js&css/extension/core.js +++ b/js&css/extension/core.js @@ -34,7 +34,280 @@ var extension = { ready: false, storage: { data: {} + }, + // Feature configuration and rollout control + featureConfig: { + // Debug mode - set to false to disable console logs in production + debug: false, + + // Feature metadata for gradual rollout and targeting + // Each feature can specify: defaultEnabled, targetCohorts, experimentalPercentage + metadata: { + // Example: Original title feature + original_title: { + defaultEnabled: false, // Don't enable by default (experimental) + experimental: true, // Mark as experimental + targetCohorts: [ // Which user groups benefit most? + 'multilingual', // Users with multiple languages + 'multilingual_countries', // Users from countries with multiple languages + 'subtitle_users' // Users who regularly use subtitles + ], + description: 'Show original video titles in their native language', + estimatedAppreciation: 40 // ~40% of users likely to appreciate + } + // Add more features here as needed + } + }, + // Feature registry for lazy loading + featureRegistry: { + // Define all features with their module paths and run conditions + // Format: 'feature_name': { path: '...', run_on_pages: '...', section: '...' } + + // General features + youtubeHomePage: { path: 'www.youtube.com/general/general.js', run_on_pages: '*', section: 'general' }, + collapseOfSubscriptionSections: { path: 'www.youtube.com/general/general.js', run_on_pages: 'feed', section: 'general' }, + onlyOnePlayerInstancePlaying: { path: 'www.youtube.com/general/general.js', run_on_pages: '*', section: 'general' }, + addScrollToTop: { path: 'www.youtube.com/general/general.js', run_on_pages: '*', section: 'general' }, + confirmationBeforeClosing: { path: 'www.youtube.com/general/general.js', run_on_pages: '*', section: 'general' }, + defaultContentCountry: { path: 'www.youtube.com/general/general.js', run_on_pages: '*', section: 'general' }, + popupWindowButtons: { path: 'www.youtube.com/general/general.js', run_on_pages: '*', section: 'general' }, + font: { path: 'www.youtube.com/general/general.js', run_on_pages: '*', section: 'general' }, + markWatchedVideos: { path: 'www.youtube.com/general/general.js', run_on_pages: 'home, results, feed', section: 'general' }, + trackWatchedVideos: { path: 'www.youtube.com/general/general.js', run_on_pages: 'watch', section: 'general' }, + thumbnailsQuality: { path: 'www.youtube.com/general/general.js', run_on_pages: '*', section: 'general' }, + disableThumbnailPlayback: { path: 'www.youtube.com/general/general.js', run_on_pages: '*', section: 'general' }, + openNewTab: { path: 'www.youtube.com/general/general.js', run_on_pages: '*', section: 'general' }, + removeListParamOnNewTab: { path: 'www.youtube.com/general/general.js', run_on_pages: '*', section: 'general' }, + clickableLinksInVideoDescriptions: { path: 'www.youtube.com/general/general.js', run_on_pages: 'watch', section: 'general' }, + changeThumbnailsPerRow: { path: 'www.youtube.com/general/general.js', run_on_pages: 'home, results, feed', section: 'general' }, + removeMemberOnly: { path: 'www.youtube.com/general/general.js', run_on_pages: '*', section: 'general' }, + + // Sidebar features + relatedVideos: { path: 'www.youtube.com/appearance/sidebar/sidebar.js', run_on_pages: 'watch', section: 'sidebar' }, + stickyNavigation: { path: 'www.youtube.com/appearance/sidebar/sidebar.js', run_on_pages: '*', section: 'sidebar' }, + + // Night mode features + bluelight: { path: 'www.youtube.com/night-mode/night-mode.js', run_on_pages: '*', section: 'night-mode' }, + dim: { path: 'www.youtube.com/night-mode/night-mode.js', run_on_pages: '*', section: 'night-mode' }, + + // Comments + comments: { path: 'www.youtube.com/appearance/comments/comments.js', run_on_pages: 'watch', section: 'comments' } + }, + // Track loaded modules to avoid duplicate loads + loadedModules: {} +}; + +/*-------------------------------------------------------------- +# DEBUG LOGGING +--------------------------------------------------------------*/ + +extension.log = function() { + if (extension.featureConfig.debug) { + console.log.apply(console, ['[ImprovedTube]'].concat(Array.prototype.slice.call(arguments))); + } +}; + +extension.logError = function() { + console.error.apply(console, ['[ImprovedTube Error]'].concat(Array.prototype.slice.call(arguments))); +}; + +extension.logFeature = function(featureName, action, details) { + if (extension.featureConfig.debug) { + console.log('[ImprovedTube Feature]', featureName, '→', action, details || ''); + } +}; + +/*-------------------------------------------------------------- +# USER COHORT DETECTION +--------------------------------------------------------------*/ + +extension.detectUserCohort = function() { + var cohorts = []; + + // Detect multilingual users (browser has multiple language preferences) + var languages = navigator.languages || [navigator.language]; + if (languages.length > 1) { + cohorts.push('multilingual'); + } + + // Detect users from multilingual countries + var multilingualCountries = ['CH', 'BE', 'CA', 'IN', 'SG', 'ZA', 'PH', 'MY']; // Switzerland, Belgium, Canada, India, Singapore, South Africa, Philippines, Malaysia + var userLanguage = navigator.language || ''; + var countryCode = userLanguage.split('-')[1]; + if (countryCode && multilingualCountries.includes(countryCode.toUpperCase())) { + cohorts.push('multilingual_countries'); + } + + // Check if user regularly uses subtitles (stored in extension data) + if (extension.storage.data.subtitle_language || extension.storage.data.subtitles) { + cohorts.push('subtitle_users'); + } + + // Check if logged in to YouTube + if (document.cookie.indexOf('LOGIN_INFO') !== -1) { + cohorts.push('logged_in'); + } + + extension.log('Detected user cohorts:', cohorts); + return cohorts; +}; + +/*-------------------------------------------------------------- +# FEATURE ELIGIBILITY CHECK +--------------------------------------------------------------*/ + +extension.isFeatureEligibleForUser = function(featureKey) { + var metadata = extension.featureConfig.metadata[featureKey]; + + // If no metadata, feature is eligible by default (legacy features) + if (!metadata) { + return true; + } + + // If feature is not experimental, it's available to everyone + if (!metadata.experimental) { + return true; + } + + // If user has explicitly enabled/disabled it, respect their choice + if (extension.storage.data.hasOwnProperty(featureKey)) { + return true; + } + + // For experimental features, check if user is in target cohort + if (metadata.targetCohorts && metadata.targetCohorts.length > 0) { + var userCohorts = extension.detectUserCohort(); + var isInTargetCohort = metadata.targetCohorts.some(function(cohort) { + return userCohorts.includes(cohort); + }); + + if (isInTargetCohort) { + extension.log('Feature', featureKey, 'enabled for user cohort'); + return true; + } } + + // If experimental percentage is set, do gradual rollout + if (metadata.experimentalPercentage) { + // Use a deterministic hash of user agent to assign users to groups + var userHash = extension.getUserHash(); + var isInExperiment = (userHash % 100) < metadata.experimentalPercentage; + + if (isInExperiment) { + extension.log('Feature', featureKey, 'enabled via experimental rollout'); + return true; + } + } + + // Feature not eligible for this user yet + extension.log('Feature', featureKey, 'not eligible for this user'); + return false; +}; + +/*-------------------------------------------------------------- +# USER HASH (for consistent A/B testing) +--------------------------------------------------------------*/ + +extension.getUserHash = function() { + // Create a simple hash from user agent for consistent feature assignment + var str = navigator.userAgent + (navigator.language || ''); + var hash = 0; + for (var i = 0; i < str.length; i++) { + var char = str.charCodeAt(i); + hash = ((hash << 5) - hash) + char; + hash = hash & hash; // Convert to 32bit integer + } + return Math.abs(hash); +}; + +/*-------------------------------------------------------------- +# PAGE DETECTION +--------------------------------------------------------------*/ + +extension.getCurrentPage = function() { + var pathname = location.pathname; + + if (pathname === '/' || pathname === '') return 'home'; + if (pathname.startsWith('/watch')) return 'watch'; + if (pathname.startsWith('/results')) return 'results'; + if (pathname.startsWith('/feed/subscriptions')) return 'feed'; + if (pathname.startsWith('/feed')) return 'feed'; + if (pathname.startsWith('/channel') || pathname.startsWith('/c/') || pathname.startsWith('/user/') || pathname.startsWith('/@')) return 'channel'; + if (pathname.startsWith('/playlist')) return 'playlist'; + + return 'other'; +}; + +/*-------------------------------------------------------------- +# LAZY LOAD FEATURE MODULE +--------------------------------------------------------------*/ + +extension.loadFeatureModule = function(modulePath) { + // Return existing promise if module is already loading/loaded + if (this.loadedModules[modulePath]) { + return this.loadedModules[modulePath]; + } + + this.log('Loading module:', modulePath); + + // Create promise for this module load + var loadPromise = new Promise(function(resolve, reject) { + var script = document.createElement('script'); + script.src = chrome.runtime.getURL('/js&css/extension/' + modulePath); + script.onload = function() { + extension.log('Module loaded:', modulePath); + script.remove(); + resolve(); + }; + script.onerror = function() { + extension.logError('Failed to load module:', modulePath); + reject(new Error('Failed to load: ' + modulePath)); + }; + (document.head || document.documentElement).appendChild(script); + }); + + // Cache the promise + this.loadedModules[modulePath] = loadPromise; + + return loadPromise; +}; + +/*-------------------------------------------------------------- +# LOAD AND ENABLE FEATURE +--------------------------------------------------------------*/ + +extension.loadAndEnableFeature = function(featureKey, value) { + var featureInfo = this.featureRegistry[featureKey]; + + if (!featureInfo) { + this.log('Feature not in registry:', featureKey); + return Promise.resolve(); + } + + // Check if feature should run on current page + var currentPage = this.getCurrentPage(); + var runOnPages = featureInfo.run_on_pages.split(',').map(function(p) { return p.trim(); }); + var shouldRun = runOnPages.includes('*') || runOnPages.includes(currentPage); + + if (!shouldRun) { + this.log('Feature', featureKey, 'not applicable on page:', currentPage); + return Promise.resolve(); + } + + // Load the module + return this.loadFeatureModule(featureInfo.path).then(function() { + // Module loaded, now call the feature function + var camelizedKey = extension.camelize(featureKey); + + if (typeof extension.features[camelizedKey] === 'function') { + extension.logFeature(camelizedKey, 'ENABLE', value); + extension.features[camelizedKey](value); + } else { + extension.log('Feature function not found after load:', camelizedKey); + } + }).catch(function(err) { + extension.logError('Failed to load feature', featureKey, err); + }); }; /*-------------------------------------------------------------- @@ -266,15 +539,30 @@ extension.storage.get = function (key) { extension.storage.listener = function () { chrome.storage.onChanged.addListener(function (changes) { for (var key in changes) { - var value = changes[key].newValue, - camelized_key = extension.camelize(key); + var value = changes[key].newValue; + var camelized_key = extension.camelize(key); extension.storage.data[key] = value; document.documentElement.setAttribute('it-' + key.replace(/_/g, '-'), value); - if (typeof extension.features[camelized_key] === 'function') { - extension.features[camelized_key](value); + // Check if feature is eligible for this user before enabling + if (!extension.isFeatureEligibleForUser(key)) { + extension.log('Feature', key, 'skipped - not eligible for this user'); + continue; + } + + // Handle enabling/disabling features with lazy loading + if (value === true || (typeof value === 'string' && value !== 'false' && value !== '')) { + // Enable the feature - load module if needed + extension.loadAndEnableFeature(key, value); + } else if (value === false || value === '' || value === null || value === undefined) { + // Disable the feature if already loaded and disable function exists + var disableFunction = extension.features[camelized_key + 'Disable']; + if (typeof disableFunction === 'function') { + extension.logFeature(camelized_key, 'DISABLE'); + disableFunction(); + } } extension.events.trigger('storage-changed', { diff --git a/js&css/extension/init.js b/js&css/extension/init.js index 0478a7747..be15ce482 100644 --- a/js&css/extension/init.js +++ b/js&css/extension/init.js @@ -1,17 +1,23 @@ /*-------------------------------------------------------------- >>> INITIALIZATION --------------------------------------------------------------*/ -extension.features.youtubeHomePage('init'); document.documentElement.setAttribute('it-pathname', location.pathname); window.addEventListener('yt-navigate-finish', function () { document.documentElement.setAttribute('it-pathname', location.pathname); - extension.features.trackWatchedVideos(); - extension.features.thumbnailsQuality(); - extension.features.stickyNavigation(); - extension.features.hideSponsoredVideosOnHome?.(); + // Features will be available if loaded via lazy loading + // These will execute only if user has them enabled + if (extension.features.trackWatchedVideos) { + extension.features.trackWatchedVideos(); + } + if (extension.features.thumbnailsQuality) { + extension.features.thumbnailsQuality(); + } + if (extension.features.stickyNavigation) { + extension.features.stickyNavigation(); + } }); extension.messages.create(); @@ -28,31 +34,65 @@ extension.events.on('init', function (resolve) { function bodyReady() { if (extension.ready && extension.domReady) { - extension.features.addScrollToTop(); - extension.features.font(); - extension.features.changeThumbnailsPerRow?.(); - extension.features.clickableLinksInVideoDescriptions(); + // Features will be available if loaded via lazy loading + // Only execute if user has them enabled + if (extension.features.addScrollToTop) { + extension.features.addScrollToTop(); + } + if (extension.features.font) { + extension.features.font(); + } + if (extension.features.changeThumbnailsPerRow) { + extension.features.changeThumbnailsPerRow(); + } + if (extension.features.clickableLinksInVideoDescriptions) { + extension.features.clickableLinksInVideoDescriptions(); + } } } extension.events.on('init', function () { - extension.features.bluelight(); - extension.features.dim(); - extension.features.youtubeHomePage(); - extension.features.collapseOfSubscriptionSections(); - extension.features.confirmationBeforeClosing(); - extension.features.defaultContentCountry(); - extension.features.popupWindowButtons(); - extension.features.disableThumbnailPlayback(); - extension.features.markWatchedVideos(); - extension.features.relatedVideos(); - extension.features.stickyNavigation(); - extension.features.comments(); - extension.features.openNewTab(); - extension.features.removeListParamOnNewTab(); - extension.features.removeMemberOnly(); - // extension.features.hideSponsoredVideosOnHome?.(); - bodyReady(); + // Auto-enable all features using lazy loading + var storage = extension.storage.data; + + extension.log('Initializing features with lazy loading...'); + + // Collect all features to load + var featuresToLoad = []; + + for (var key in storage) { + var value = storage[key]; + + // Skip if feature is not eligible for this user + if (!extension.isFeatureEligibleForUser(key)) { + extension.log('Feature', key, 'skipped - not eligible for this user'); + continue; + } + + // Only load features that are enabled + if (value === true || (typeof value === 'string' && value !== 'false' && value !== '')) { + // Check if feature is in registry + if (extension.featureRegistry[key]) { + featuresToLoad.push({ key: key, value: value }); + } + } + } + + // Load all enabled features + extension.log('Loading', featuresToLoad.length, 'enabled features'); + + var loadPromises = featuresToLoad.map(function(feature) { + return extension.loadAndEnableFeature(feature.key, feature.value); + }); + + // Wait for all features to load + Promise.all(loadPromises).then(function() { + extension.log('All features loaded and initialized'); + bodyReady(); + }).catch(function(err) { + extension.logError('Error loading features:', err); + bodyReady(); + }); }); chrome.runtime.sendMessage({ @@ -76,6 +116,7 @@ extension.inject([ '/js&css/web-accessible/www.youtube.com/blocklist.js', '/js&css/web-accessible/www.youtube.com/settings.js', '/js&css/web-accessible/www.youtube.com/last-watched-overlay.js', // Neue Zeile hinzufügen + '/js&css/web-accessible/www.youtube.com/original-title.js', '/js&css/web-accessible/init.js' ], function () { extension.ready = true; @@ -257,3 +298,27 @@ document.addEventListener('it-play', function () { chrome.runtime.sendMessage({ action: 'play' }) } catch (error) { console.log(error); setTimeout(function () { try { chrome.runtime.sendMessage({ action: 'play' }, function (response) { console.log(response) }); } catch { } }, 321) } }); + +// Listen for original title fetch requests from web-accessible scripts +window.addEventListener('message', function(event) { + if (event.data && event.data.type === 'IT_FETCH_ORIGINAL_TITLE' && event.data.videoId) { + const videoId = event.data.videoId; + const messageId = event.data.messageId; + + console.log('Content script received title fetch request for video:', videoId, 'messageId:', messageId); + + // Forward to background script + chrome.runtime.sendMessage({ + action: 'fetch-video-page', + videoId: videoId + }, function(response) { + console.log('Content script received response from background:', response); + // Send response back to web-accessible script + window.postMessage({ + type: 'IT_ORIGINAL_TITLE_RESPONSE', + messageId: messageId, + title: response ? response.title : null + }, '*'); + }); + } +}); diff --git a/js&css/extension/www.youtube.com/appearance/comments/comments.js b/js&css/extension/www.youtube.com/appearance/comments/comments.js index e2bd170e6..5fdb822c8 100644 --- a/js&css/extension/www.youtube.com/appearance/comments/comments.js +++ b/js&css/extension/www.youtube.com/appearance/comments/comments.js @@ -8,31 +8,31 @@ # COLLAPSED --------------------------------------------------------------*/ -extension.features.comments = function (anything) { - if (anything instanceof Event) { - var event = anything; +function handleCommentsClick(event) { + if (event.type === 'click') { + var target = event.target; - if (event.type === 'click') { - var target = event.target; + if (target.nodeName === 'YTD-COMMENTS-HEADER-RENDERER') { + var rect = target.getBoundingClientRect(); - if (target.nodeName === 'YTD-COMMENTS-HEADER-RENDERER') { - var rect = target.getBoundingClientRect(); - - if ( - event.clientX - rect.left >= 0 && - event.clientX - rect.left < rect.width && - event.clientY - rect.top + rect.height >= 0 && - rect.top + rect.height - event.clientY < 48 - ) { - target.parentNode.parentNode.parentNode.toggleAttribute('it-activated'); - } + if ( + event.clientX - rect.left >= 0 && + event.clientX - rect.left < rect.width && + event.clientY - rect.top + rect.height >= 0 && + rect.top + rect.height - event.clientY < 48 + ) { + target.parentNode.parentNode.parentNode.toggleAttribute('it-activated'); } } - } else { - if (extension.storage.get('comments') === 'collapsed') { - window.addEventListener('click', this.comments, true); - } else { - window.removeEventListener('click', this.comments, true); - } } +} + +extension.features.comments = function () { + if (extension.storage.get('comments') === 'collapsed') { + window.addEventListener('click', handleCommentsClick, true); + } +}; + +extension.features.commentsDisable = function () { + window.removeEventListener('click', handleCommentsClick, true); }; \ No newline at end of file diff --git a/js&css/extension/www.youtube.com/appearance/details/original-title.css b/js&css/extension/www.youtube.com/appearance/details/original-title.css new file mode 100644 index 000000000..72ac9e208 --- /dev/null +++ b/js&css/extension/www.youtube.com/appearance/details/original-title.css @@ -0,0 +1,45 @@ +/*------------------------------------------------------------------------------ +>>> ORIGINAL TITLE TOGGLE +------------------------------------------------------------------------------*/ + +/* Make clickable title have a subtle hover effect */ +h1.style-scope.ytd-watch-metadata yt-formatted-string[data-it-original-title] { + transition: opacity 0.2s ease, color 0.2s ease; +} + +h1.style-scope.ytd-watch-metadata yt-formatted-string[data-it-original-title]:hover { + opacity: 0.8; +} + +/* Style the toggle indicator */ +.it-title-toggle-indicator { + display: inline-block; + transition: opacity 0.2s ease, transform 0.2s ease; + user-select: none; + vertical-align: middle; +} + +.it-title-toggle-indicator:hover { + transform: scale(1.1); +} + +/* Add a subtle underline when hovering over clickable titles */ +h1.style-scope.ytd-watch-metadata yt-formatted-string[style*="cursor: pointer"]:hover { + text-decoration: underline; + text-decoration-style: dotted; + text-underline-offset: 4px; +} + +/* Smooth transition when title text changes */ +h1.style-scope.ytd-watch-metadata yt-formatted-string[data-it-original-title] { + animation: fadeIn 0.3s ease-in-out; +} + +@keyframes fadeIn { + 0% { + opacity: 0.7; + } + 100% { + opacity: 1; + } +} diff --git a/js&css/extension/www.youtube.com/appearance/player/player.css b/js&css/extension/www.youtube.com/appearance/player/player.css index e7891351f..6532fa25d 100644 --- a/js&css/extension/www.youtube.com/appearance/player/player.css +++ b/js&css/extension/www.youtube.com/appearance/player/player.css @@ -254,7 +254,6 @@ html[it-player-hide-annotations='true'] .annotation-shape, # HIDE ENDSCREEN --------------------------------------------------------------*/ html[it-player-hide-endscreen='true'] .html5-endscreen, -html[it-player-hide-endscreen='true'] .ytp-fullscreen-grid-stills-container, /*-------------------------------------------------------------- # HIDE CARDS --------------------------------------------------------------*/ @@ -760,4 +759,4 @@ html[it-revert-theater-button-size='true'] .html5-video-player.ytp-big-mode .ytp html[it-revert-theater-button-size='true'] .html5-video-player.ytp-big-mode .ytp-time-contents { display: flex; align-items: center; -} +} \ No newline at end of file diff --git a/js&css/extension/www.youtube.com/general/general.js b/js&css/extension/www.youtube.com/general/general.js index 56de9e660..2fee07d5e 100644 --- a/js&css/extension/www.youtube.com/general/general.js +++ b/js&css/extension/www.youtube.com/general/general.js @@ -18,72 +18,75 @@ # YOUTUBE HOME PAGE --------------------------------------------------------------*/ -extension.features.youtubeHomePage = function (anything) { - if (anything instanceof Event) { - var event = anything; +function handleYoutubeHomePageClick(event) { + if (event.target) { + var target = event.target; - if (event.target) { - var target = event.target; + while (target.parentNode) { + if (target.nodeName === 'A' && target.id === 'logo') { + var option = extension.storage.get('youtube_home_page'); - while (target.parentNode) { - if (target.nodeName === 'A' && target.id === 'logo') { - var option = extension.storage.get('youtube_home_page'); + if (option !== 'search') { + event.preventDefault(); + event.stopPropagation(); - if (option !== 'search') { - event.preventDefault(); - event.stopPropagation(); + window.open(option, '_self'); - window.open(option, '_self'); - - return false; - } - } else { - target = target.parentNode; + return false; } - } - } - } else if (anything === 'init') { - extension.events.on('init', function (resolve) { - if (/(www|m)\.youtube\.com\/?(\?|\#|$)/.test(location.href)) { - chrome.storage.local.get('youtube_home_page', function (items) { - var option = items.youtube_home_page; - - if ( - option === '/feed/trending' || - option === '/feed/subscriptions' || - option === '/feed/history' || - option === '/playlist?list=WL' || - option === '/playlist?list=LL' || - option === '/feed/library' - ) { - location.replace(option); - } else { - resolve(); - } - }); } else { - resolve(); + target = target.parentNode; } - }, { - async: true, - prepend: true - }); - } else { - var option = extension.storage.get('youtube_home_page'); - - window.removeEventListener('click', this.youtubeHomePage); - - if ( - option === '/feed/trending' || - option === '/feed/subscriptions' || - option === '/feed/history' || - option === '/playlist?list=WL' || - option === '/playlist?list=LL' || - option === '/feed/library' - ) { - window.addEventListener('click', this.youtubeHomePage, true); } } +} + +extension.features.youtubeHomePage = function () { + var option = extension.storage.get('youtube_home_page'); + + if ( + option === '/feed/trending' || + option === '/feed/subscriptions' || + option === '/feed/history' || + option === '/playlist?list=WL' || + option === '/playlist?list=LL' || + option === '/feed/library' + ) { + window.addEventListener('click', handleYoutubeHomePageClick, true); + } +}; + +extension.features.youtubeHomePageDisable = function () { + window.removeEventListener('click', handleYoutubeHomePageClick, true); +}; + +// Special init handler for youtube home page +extension.features.youtubeHomePageInit = function () { + extension.events.on('init', function (resolve) { + if (/(www|m)\.youtube\.com\/?(\?|\#|$)/.test(location.href)) { + chrome.storage.local.get('youtube_home_page', function (items) { + var option = items.youtube_home_page; + + if ( + option === '/feed/trending' || + option === '/feed/subscriptions' || + option === '/feed/history' || + option === '/playlist?list=WL' || + option === '/playlist?list=LL' || + option === '/feed/library' + ) { + location.replace(option); + } else { + resolve(); + } + }); + } else { + resolve(); + } + }, { + async: true, + prepend: true + }); }; /*-------------------------------------------------------------- @@ -107,61 +110,63 @@ function subscriptionEntries() { return new Error("Subscriptions section not found") } -extension.features.collapseOfSubscriptionSections = function (event) { - if (typeof event === "boolean") { - subs = subscriptionEntries() - if (subs instanceof Error) { - console.error(subs.message) - return - } - for (const sub of subs) { - sub.style.display = event ? "none" : "block"; - } - return - } +function handleCollapseOfSubscriptionSectionsClick(event) { + var section, + content; - if (event instanceof Event) { - var section, - content; + if (event.target) { + var target = event.target; - if (event.target) { - var target = event.target; + while (target.parentNode) { + if (target.nodeName === 'YTD-ITEM-SECTION-RENDERER') { + section = target; + } else if (target.className && target.className.indexOf && target.className.indexOf('grid-subheader') !== -1) { + content = target.nextElementSibling; + } - while (target.parentNode) { - if (target.nodeName === 'YTD-ITEM-SECTION-RENDERER') { - section = target; - } else if (target.className && target.className.indexOf && target.className.indexOf('grid-subheader') !== -1) { - content = target.nextElementSibling; - } + target = target.parentNode; + } + } - target = target.parentNode; - } + if (section && content) { + event.preventDefault(); + event.stopPropagation(); + + if (section.className.indexOf('it-section-collapsed') === -1) { + content.style.height = content.offsetHeight + 'px'; + content.style.transition = 'height 200ms'; } - if (section && content) { - event.preventDefault(); - event.stopPropagation(); + setTimeout(function () { + section.classList.toggle('it-section-collapsed'); + }); - if (section.className.indexOf('it-section-collapsed') === -1) { - content.style.height = content.offsetHeight + 'px'; - content.style.transition = 'height 200ms'; - } + return false; + } +} - setTimeout(function () { - section.classList.toggle('it-section-collapsed'); - }); +extension.features.collapseOfSubscriptionSections = function () { + if ( + extension.storage.get('collapse_of_subscription_sections') === true && + location.href.indexOf('feed/subscriptions') !== -1 + ) { + window.addEventListener('click', handleCollapseOfSubscriptionSectionsClick, true); + } +}; - return false; - } - } else { - window.removeEventListener('click', this.collapseOfSubscriptionSections); +extension.features.collapseOfSubscriptionSectionsDisable = function () { + window.removeEventListener('click', handleCollapseOfSubscriptionSectionsClick, true); +}; - if ( - extension.storage.get('collapse_of_subscription_sections') === true && - location.href.indexOf('feed/subscriptions') !== -1 - ) { - window.addEventListener('click', this.collapseOfSubscriptionSections, true); - } +// Helper function to toggle subscription visibility +extension.features.toggleSubscriptionSectionsVisibility = function (hide) { + var subs = subscriptionEntries(); + if (subs instanceof Error) { + console.error(subs.message); + return; + } + for (const sub of subs) { + sub.style.display = hide ? "none" : "block"; } }; @@ -181,80 +186,85 @@ extension.features.onlyOnePlayerInstancePlaying = function () { /*-------------------------------------------------------------- # ADD "SCROLL TO TOP" --------------------------------------------------------------*/ -extension.features.addScrollToTop = function (event) { - if (event instanceof Event) { - if (window.scrollY > window.innerHeight / 2) { - document.documentElement.setAttribute('it-scroll-to-top', 'true'); - } else { - document.documentElement.removeAttribute('it-scroll-to-top'); - } +function handleScrollToTopScroll(event) { + if (window.scrollY > window.innerHeight / 2) { + document.documentElement.setAttribute('it-scroll-to-top', 'true'); } else { - if (extension.storage.get('add_scroll_to_top') === true) { - this.addScrollToTop.button = document.createElement('div'); - this.addScrollToTop.button.id = 'it-scroll-to-top'; - this.addScrollToTop.button.className = 'satus-div'; - var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); - svg.setAttribute('viewBox', '0 0 24 24'); - var path = document.createElementNS('http://www.w3.org/2000/svg', 'path'); - path.setAttribute('d', 'M13 19V7.8l4.9 5c.4.3 1 .3 1.4 0 .4-.5.4-1.1 0-1.5l-6.6-6.6a1 1 0 0 0-1.4 0l-6.6 6.6a1 1 0 1 0 1.4 1.4L11 7.8V19c0 .6.5 1 1 1s1-.5 1-1z'); - svg.appendChild(path); - this.addScrollToTop.button.appendChild(svg); - window.addEventListener('scroll', function () { document.body.appendChild(extension.features.addScrollToTop.button); }); - this.addScrollToTop.button.addEventListener('click', function () { - window.scrollTo(0, 0); - document.getElementById('it-scroll-to-top')?.remove(); - }); - } - if (extension.storage.get('add_scroll_to_top') === true) { - window.addEventListener('scroll', extension.features.addScrollToTop); - } else if (this.addScrollToTop.button) { - window.removeEventListener('scroll', extension.features.addScrollToTop); - this.addScrollToTop.button.remove(); - } + document.documentElement.removeAttribute('it-scroll-to-top'); + } +} + +extension.features.addScrollToTop = function () { + if (extension.storage.get('add_scroll_to_top') === true) { + this.addScrollToTop.button = document.createElement('div'); + this.addScrollToTop.button.id = 'it-scroll-to-top'; + this.addScrollToTop.button.className = 'satus-div'; + var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); + svg.setAttribute('viewBox', '0 0 24 24'); + var path = document.createElementNS('http://www.w3.org/2000/svg', 'path'); + path.setAttribute('d', 'M13 19V7.8l4.9 5c.4.3 1 .3 1.4 0 .4-.5.4-1.1 0-1.5l-6.6-6.6a1 1 0 0 0-1.4 0l-6.6 6.6a1 1 0 1 0 1.4 1.4L11 7.8V19c0 .6.5 1 1 1s1-.5 1-1z'); + svg.appendChild(path); + this.addScrollToTop.button.appendChild(svg); + window.addEventListener('scroll', function () { document.body.appendChild(extension.features.addScrollToTop.button); }); + this.addScrollToTop.button.addEventListener('click', function () { + window.scrollTo(0, 0); + document.getElementById('it-scroll-to-top')?.remove(); + }); + window.addEventListener('scroll', handleScrollToTopScroll); + } +}; + +extension.features.addScrollToTopDisable = function () { + window.removeEventListener('scroll', handleScrollToTopScroll); + if (this.addScrollToTop.button) { + this.addScrollToTop.button.remove(); + delete this.addScrollToTop.button; } }; /*-------------------------------------------------------------- # CONFIRMATION BEFORE CLOSING --------------------------------------------------------------*/ +function handleConfirmationBeforeClosing() { + if (extension.storage.get('confirmation_before_closing') === true) { + return 'You have attempted to leave this page. Are you sure?'; + } +} + extension.features.confirmationBeforeClosing = function () { - window.onbeforeunload = function () { - if (extension.storage.get('confirmation_before_closing') === true) { - return 'You have attempted to leave this page. Are you sure?'; - } - }; + if (extension.storage.get('confirmation_before_closing') === true) { + window.onbeforeunload = handleConfirmationBeforeClosing; + } +}; + +extension.features.confirmationBeforeClosingDisable = function () { + window.onbeforeunload = null; }; /*-------------------------------------------------------------- # DEFAULT CONTENT COUNTRY --------------------------------------------------------------*/ -extension.features.defaultContentCountry = function (changed) { +extension.features.defaultContentCountry = function () { var value = extension.storage.get('default_content_country'); - if (value) { - if (value !== 'default') { - var date = new Date(); - - date.setTime(date.getTime() + 3.154e+10); - - document.cookie = 's_gl=' + value + '; path=/; domain=.youtube.com; expires=' + date.toGMTString(); - } else { - document.cookie = 's_gl=0; path=/; domain=.youtube.com; expires=Thu, 01 Jan 1970 00:00:01 GMT'; - } + if (value && value !== 'default') { + var date = new Date(); + date.setTime(date.getTime() + 3.154e+10); + document.cookie = 's_gl=' + value + '; path=/; domain=.youtube.com; expires=' + date.toGMTString(); } +}; - if (changed) { - location.reload(); - } +extension.features.defaultContentCountryDisable = function () { + document.cookie = 's_gl=0; path=/; domain=.youtube.com; expires=Thu, 01 Jan 1970 00:00:01 GMT'; + location.reload(); }; /*-------------------------------------------------------------- # ADD "POPUP WINDOW" BUTTONS --------------------------------------------------------------*/ -extension.features.popupWindowButtons = function (event) { - if (event instanceof Event) { - if (event.type === 'mouseover') { +function handlePopupWindowButtonsMouseover(event) { + if (event.type === 'mouseover') { if (event.target) { var target = event.target, detected = false; @@ -304,19 +314,22 @@ extension.features.popupWindowButtons = function (event) { } } } - } else { - if (extension.storage.get('popup_window_buttons') === true) { - window.addEventListener('mouseover', this.popupWindowButtons, true); - } else { - window.removeEventListener('mouseover', this.popupWindowButtons, true); - } +} + +extension.features.popupWindowButtons = function () { + if (extension.storage.get('popup_window_buttons') === true) { + window.addEventListener('mouseover', handlePopupWindowButtonsMouseover, true); } }; + +extension.features.popupWindowButtonsDisable = function () { + window.removeEventListener('mouseover', handlePopupWindowButtonsMouseover, true); +}; /*-------------------------------------------------------------- # FONT --------------------------------------------------------------*/ -extension.features.font = function (changed) { +extension.features.font = function () { var option = extension.storage.get('font'); if (option && option !== 'Default') { @@ -333,17 +346,21 @@ extension.features.font = function (changed) { this.font.link = link; this.font.style = style; - } else if (changed) { - var link = this.font.link, - style = this.font.style; + } +}; - if (link) { - link.remove(); - } +extension.features.fontDisable = function () { + var link = this.font.link, + style = this.font.style; - if (style) { - style.remove(); - } + if (link) { + link.remove(); + delete this.font.link; + } + + if (style) { + style.remove(); + delete this.font.style; } }; @@ -351,11 +368,8 @@ extension.features.font = function (changed) { # MARK WATCHED VIDEOS --------------------------------------------------------------*/ -extension.features.markWatchedVideos = function (anything) { - if (anything instanceof Event) { - var event = anything; - - if (event.type === 'mouseover') { +function handleMarkWatchedVideosMouseover(event) { + if (event.type === 'mouseover') { if (event.target) { var target = event.target, detected = false; @@ -428,21 +442,20 @@ extension.features.markWatchedVideos = function (anything) { target = target.parentNode; } } - } - } else if (anything === true) { - var buttons = document.querySelectorAll('.it-mark-watched-videos'); - - for (var i = 0, l = buttons.length; i < l; i++) { - var button = buttons[i]; + } +} - button.remove(); - } - } else { - window.removeEventListener('mouseover', this.markWatchedVideos, true); +extension.features.markWatchedVideos = function () { + if (extension.storage.get('mark_watched_videos') === true) { + window.addEventListener('mouseover', handleMarkWatchedVideosMouseover, true); + } +}; - if (extension.storage.get('mark_watched_videos') === true) { - window.addEventListener('mouseover', this.markWatchedVideos, true); - } +extension.features.markWatchedVideosDisable = function () { + window.removeEventListener('mouseover', handleMarkWatchedVideosMouseover, true); + var buttons = document.querySelectorAll('.it-mark-watched-videos'); + for (var i = 0, l = buttons.length; i < l; i++) { + buttons[i].remove(); } }; @@ -472,26 +485,26 @@ extension.features.trackWatchedVideos = function () { # THUMBNAILS QUALITY --------------------------------------------------------------*/ -extension.features.thumbnailsQuality = function (anything) { - var option = extension.storage.get('thumbnails_quality'); - - function handler(thumbnail) { - if (!thumbnail.dataset.defaultSrc && extension.features.thumbnailsQuality.regex.test(thumbnail.src)) { - thumbnail.dataset.defaultSrc = thumbnail.src; +function handleThumbnailQuality(thumbnail) { + if (!thumbnail.dataset.defaultSrc && extension.features.thumbnailsQuality.regex.test(thumbnail.src)) { + thumbnail.dataset.defaultSrc = thumbnail.src; - thumbnail.onload = function () { - if (this.naturalHeight <= 90) { - this.src = this.dataset.defaultSrc; - } - }; + thumbnail.onload = function () { + if (this.naturalHeight <= 90) { + this.src = this.dataset.defaultSrc; + } + }; - thumbnail.onerror = function () { - this.src = thumbnail.dataset.defaultSrc; - }; + thumbnail.onerror = function () { + this.src = thumbnail.dataset.defaultSrc; + }; - thumbnail.src = thumbnail.src.replace(extension.features.thumbnailsQuality.regex, extension.storage.get('thumbnails_quality') + '.jpg'); - } + thumbnail.src = thumbnail.src.replace(extension.features.thumbnailsQuality.regex, extension.storage.get('thumbnails_quality') + '.jpg'); } +} + +extension.features.thumbnailsQuality = function () { + var option = extension.storage.get('thumbnails_quality'); if (['default', 'mqdefault', 'hqdefault', 'sddefault', 'maxresdefault'].includes(option) === true) { var thumbnails = document.querySelectorAll('img'); @@ -499,7 +512,7 @@ extension.features.thumbnailsQuality = function (anything) { this.thumbnailsQuality.regex = /(default\.jpg|mqdefault\.jpg|hqdefault\.jpg|hq720\.jpg|sddefault\.jpg|maxresdefault\.jpg)+/; for (var i = 0, l = thumbnails.length; i < l; i++) { - handler(thumbnails[i]); + handleThumbnailQuality(thumbnails[i]); } if (!this.thumbnailsQuality.observer) { @@ -508,7 +521,7 @@ extension.features.thumbnailsQuality = function (anything) { var mutation = mutationList[i]; if (mutation.type === 'attributes') { - handler(mutation.target); + handleThumbnailQuality(mutation.target); } } }); @@ -520,39 +533,42 @@ extension.features.thumbnailsQuality = function (anything) { subtree: true }); } - } else if (anything === true) { - var thumbnails = document.querySelectorAll('img[data-default-src]'); - - for (var i = 0, l = thumbnails.length; i < l; i++) { - var thumbnail = thumbnails[i]; + } +}; - thumbnail.src = thumbnail.dataset.defaultSrc; +extension.features.thumbnailsQualityDisable = function () { + var thumbnails = document.querySelectorAll('img[data-default-src]'); - thumbnail.removeAttribute('data-default-src'); - } + for (var i = 0, l = thumbnails.length; i < l; i++) { + var thumbnail = thumbnails[i]; + thumbnail.src = thumbnail.dataset.defaultSrc; + thumbnail.removeAttribute('data-default-src'); + } - if (this.thumbnailsQuality.observer) { - this.thumbnailsQuality.observer.disconnect(); - } + if (this.thumbnailsQuality.observer) { + this.thumbnailsQuality.observer.disconnect(); + delete this.thumbnailsQuality.observer; } }; /*-------------------------------------------------------------- # DISABLE VIDEO PLAYBACK ON HOVER --------------------------------------------------------------*/ -extension.features.disableThumbnailPlayback = function (event) { - if (event instanceof Event) { - if (event.composedPath().some(elem => (elem.matches != null && elem.matches('#content.ytd-rich-item-renderer, #contents.ytd-item-section-renderer')) - )) { - event.stopImmediatePropagation(); - } - } else { - if (extension.storage.get('disable_thumbnail_playback') === true) { - window.addEventListener('mouseenter', this.disableThumbnailPlayback, true); - } else { - window.removeEventListener('mouseenter', this.disableThumbnailPlayback, true); - } +function handleDisableThumbnailPlayback(event) { + if (event.composedPath().some(elem => (elem.matches != null && elem.matches('#content.ytd-rich-item-renderer, #contents.ytd-item-section-renderer')) + )) { + event.stopImmediatePropagation(); } +} + +extension.features.disableThumbnailPlayback = function () { + if (extension.storage.get('disable_thumbnail_playback') === true) { + window.addEventListener('mouseenter', handleDisableThumbnailPlayback, true); + } +}; + +extension.features.disableThumbnailPlaybackDisable = function () { + window.removeEventListener('mouseenter', handleDisableThumbnailPlayback, true); }; /*-------------------------------------------------------------- diff --git a/js&css/extension/www.youtube.com/night-mode/night-mode.js b/js&css/extension/www.youtube.com/night-mode/night-mode.js index a844c77b9..48db90dd1 100644 --- a/js&css/extension/www.youtube.com/night-mode/night-mode.js +++ b/js&css/extension/www.youtube.com/night-mode/night-mode.js @@ -68,7 +68,11 @@ extension.features.bluelight = function () { } else { this.bluelight.feColorMatrix.values.baseVal[12].value = 1 - parseFloat(value) / 100; } - } else if (this.bluelight.bluelight) { + } +}; + +extension.features.bluelightDisable = function () { + if (this.bluelight.bluelight) { this.bluelight.bluelight.remove(); delete this.bluelight.bluelight; @@ -99,9 +103,12 @@ extension.features.dim = function () { } else { this.dim.element.style.opacity = parseInt(Number(value)) / 100 || 0; } - } else if (this.dim.element) { - this.dim.element.remove(); + } +}; +extension.features.dimDisable = function () { + if (this.dim.element) { + this.dim.element.remove(); delete this.dim.element; } }; diff --git a/js&css/web-accessible/functions.js b/js&css/web-accessible/functions.js index 91ef0e9da..da27b9670 100644 --- a/js&css/web-accessible/functions.js +++ b/js&css/web-accessible/functions.js @@ -344,6 +344,11 @@ ImprovedTube.videoPageUpdate = function () { ImprovedTube.playerCinemaModeButton(); ImprovedTube.playerHamburgerButton(); ImprovedTube.playerControls(); + + // Initialize original title toggle for each new video + if (typeof ImprovedTube.initOriginalTitleToggle === 'function') { + ImprovedTube.initOriginalTitleToggle(); + } } }; diff --git a/js&css/web-accessible/init.js b/js&css/web-accessible/init.js index d3c03ba80..e8cfb1abd 100644 --- a/js&css/web-accessible/init.js +++ b/js&css/web-accessible/init.js @@ -102,6 +102,12 @@ ImprovedTube.init = function () { ImprovedTube.videoPageUpdate(); ImprovedTube.initPlayer(); } + + // Initialize original title toggle on initial load if on video page + if (document.documentElement.dataset.pageType === 'video' && typeof ImprovedTube.initOriginalTitleToggle === 'function') { + ImprovedTube.initOriginalTitleToggle(); + } + if (ImprovedTube.elements.shorts_player) { if (ImprovedTube.storage.prevent_shorts_autoloop) { ImprovedTube.stop_shorts_autoloop(); @@ -111,18 +117,12 @@ ImprovedTube.init = function () { document.documentElement.dataset.systemColorScheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'; } - if (ImprovedTube.storage.full_screen_quality) { - if (!ImprovedTube._fsqBound) { - document.addEventListener('fullscreenchange', () => ImprovedTube.playerQualityFullScreen(), { passive: true }); - ImprovedTube._fsqBound = true; - } - ImprovedTube.playerQualityFullScreen(); -} - + // Initialize thumbnail title toggle (for home, search, sidebar) + if (typeof ImprovedTube.originalTitleThumbnails === 'function') { + ImprovedTube.originalTitleThumbnails(); + } }; - - document.addEventListener('yt-navigate-finish', function () { /* if (name === 'META') { // infos are not updated when clicking related videos... if(node.getAttribute('name')) { @@ -157,6 +157,12 @@ document.addEventListener('yt-navigate-finish', function () { ImprovedTube.videoPageUpdate(); ImprovedTube.initPlayer(); } + + // Initialize original title toggle on every navigation + if (document.documentElement.dataset.pageType === 'video' && typeof ImprovedTube.initOriginalTitleToggle === 'function') { + ImprovedTube.initOriginalTitleToggle(); + } + if (ImprovedTube.elements.shorts_player) { ImprovedTube.redirectShortsToWatch(); if (ImprovedTube.storage.prevent_shorts_autoloop) { diff --git a/js&css/web-accessible/www.youtube.com/appearance.js b/js&css/web-accessible/www.youtube.com/appearance.js index 08b7f5ce0..ad491926f 100644 --- a/js&css/web-accessible/www.youtube.com/appearance.js +++ b/js&css/web-accessible/www.youtube.com/appearance.js @@ -107,6 +107,7 @@ ImprovedTube.showProgressBar = function () { for (let i = 0, l = play_bars.length; i < l; i++) { width += play_bars[i].offsetWidth; } + const width_percent = width / 100; for (let i = 0, l = play_bars.length; i < l; i++) { @@ -868,7 +869,7 @@ ImprovedTube.playerRevertTheaterButtonSize(); document.addEventListener('yt-page-data-updated', run); document.addEventListener('yt-navigate-finish', run); window.addEventListener('load', run); - setTimeout(run, 2000); // fallback for late loads + etTimeout(run, 2000); // fallback for late loads })(); /*------------------------------------------------------------------------------ diff --git a/js&css/web-accessible/www.youtube.com/original-title.js b/js&css/web-accessible/www.youtube.com/original-title.js new file mode 100644 index 000000000..98e790c02 --- /dev/null +++ b/js&css/web-accessible/www.youtube.com/original-title.js @@ -0,0 +1,636 @@ +/*------------------------------------------------------------------------------ +>>> ORIGINAL TITLE TOGGLE +------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------ +This feature allows users to toggle between the translated video title +and the original title without refreshing the page. +------------------------------------------------------------------------------*/ + +ImprovedTube.originalTitleToggle = function() { + // Check if required functions exist + if (typeof ImprovedTube.videoId !== 'function') { + console.log('ImprovedTube.videoId function not available, skipping original title toggle'); + return; + } + + // Check if feature is enabled - default to TRUE unless explicitly disabled + const storageValue = this.storage?.original_title_toggle ?? + ImprovedTube.storage?.original_title_toggle; + + // If storage value is explicitly false, disable the feature + if (storageValue === false) { + // console.log('Original title toggle is disabled'); + // Remove any existing toggle functionality + const titleElement = document.querySelector('h1.style-scope.ytd-watch-metadata yt-formatted-string'); + if (titleElement) { + titleElement.style.cursor = 'default'; + titleElement.onclick = null; + titleElement.title = ''; + // Clean up data attributes + delete titleElement.dataset.itOriginalTitle; + delete titleElement.dataset.itTranslatedTitle; + delete titleElement.dataset.itShowingOriginal; + delete titleElement.dataset.itVideoId; + // Remove indicator + const indicator = titleElement.querySelector('.it-title-toggle-indicator'); + if (indicator) { + indicator.remove(); + } + } + return; + } + + console.log('Original title toggle is enabled (value:', storageValue, '), proceeding...'); + + const titleElement = document.querySelector('h1.style-scope.ytd-watch-metadata yt-formatted-string'); + if (!titleElement) { + return; + } + + const currentVideoId = ImprovedTube.videoId(); + if (!currentVideoId) { + return; + } + + // FORCE cleanup if this is a new video - even if dataset hasn't updated yet + const storedVideoId = titleElement.dataset.itVideoId; + if (storedVideoId && storedVideoId !== currentVideoId) { + console.log('New video detected! Cleaning up old data. Old:', storedVideoId, 'New:', currentVideoId); + + // New video detected, FORCE clean up old data + titleElement.style.cursor = 'default'; + titleElement.onclick = null; + titleElement.title = ''; + delete titleElement.dataset.itOriginalTitle; + delete titleElement.dataset.itTranslatedTitle; + delete titleElement.dataset.itShowingOriginal; + delete titleElement.dataset.itVideoId; + + // Remove old indicator + const oldIndicator = titleElement.querySelector('.it-title-toggle-indicator'); + if (oldIndicator) { + oldIndicator.remove(); + } + } + + // Check if already initialized for this video + if (titleElement.dataset.itVideoId === currentVideoId && titleElement.dataset.itOriginalTitle) { + console.log('Already initialized for this video, skipping'); + return; + } + + const currentTitle = titleElement.textContent?.trim(); + if (!currentTitle) { + return; + } + + // Store the video ID to track which video this title belongs to + titleElement.dataset.itVideoId = currentVideoId; + titleElement.dataset.itTranslatedTitle = currentTitle; + titleElement.dataset.itShowingOriginal = 'false'; + + console.log('Current displayed title:', currentTitle); + + // Fetch the original title from the video's metadata + ImprovedTube.fetchOriginalTitle(currentVideoId, function(originalTitle) { + // Double-check we're still on the same video + const currentVidId = ImprovedTube.videoId(); + if (currentVidId !== currentVideoId) { + console.log('Video changed, aborting title toggle setup'); + return; // Video changed, abort + } + + console.log('Original title fetched:', originalTitle); + console.log('Current title:', currentTitle); + + // Check if titles are different (accounting for whitespace differences) + const normalizedOriginal = originalTitle?.trim().replace(/\s+/g, ' '); + const normalizedCurrent = currentTitle?.trim().replace(/\s+/g, ' '); + + if (!originalTitle || normalizedOriginal === normalizedCurrent) { + // No translation detected, disable the toggle + console.log('No translation detected - titles are the same'); + return; + } + + console.log('Translation detected! Setting up toggle...'); + + // Store the original title + titleElement.dataset.itOriginalTitle = originalTitle; + + // Make the title clickable + titleElement.style.cursor = 'pointer'; + titleElement.title = 'Click to toggle between original and translated title'; + + // Remove any existing indicator first + const existingIndicator = titleElement.querySelector('.it-title-toggle-indicator'); + if (existingIndicator) { + existingIndicator.remove(); + } + + // Add visual indicator (small icon) + const indicator = document.createElement('span'); + indicator.className = 'it-title-toggle-indicator'; + indicator.textContent = ' 🌐'; + indicator.style.fontSize = '0.7em'; + indicator.style.opacity = '0.6'; + indicator.style.marginLeft = '4px'; + indicator.title = 'Click to see original title'; + + titleElement.appendChild(indicator); + + // Add click handler + titleElement.onclick = function(e) { + e.preventDefault(); + e.stopPropagation(); + + const isShowingOriginal = this.dataset.itShowingOriginal === 'true'; + const originalTitle = this.dataset.itOriginalTitle; + const translatedTitle = this.dataset.itTranslatedTitle; + const indicatorEl = this.querySelector('.it-title-toggle-indicator'); + + if (isShowingOriginal) { + // Switch to translated + this.childNodes[0].textContent = translatedTitle; + this.dataset.itShowingOriginal = 'false'; + if (indicatorEl) { + indicatorEl.title = 'Click to see original title'; + indicatorEl.style.opacity = '0.6'; + } + } else { + // Switch to original + this.childNodes[0].textContent = originalTitle; + this.dataset.itShowingOriginal = 'true'; + if (indicatorEl) { + indicatorEl.title = 'Click to see translated title'; + indicatorEl.style.opacity = '1'; + } + } + }; + }); +}; + +/*------------------------------------------------------------------------------ +Fetch the original title from the video metadata +Reuses existing DATA from fetchDOMData if available to avoid duplication +------------------------------------------------------------------------------*/ +ImprovedTube.fetchOriginalTitle = function(videoId, callback) { + if (!videoId) { + callback(null); + return; + } + + let originalTitle = null; + + // Method 1: Try existing DATA object first (if fetchDOMData was already called) + if (typeof DATA !== 'undefined' && DATA && DATA.title && DATA.videoID === videoId) { + console.log('Found title in existing DATA:', DATA.title); + callback(DATA.title); + return; + } + + // Method 2: Try from microformat (JSON-LD) - reuses existing pattern + try { + const microformatScript = document.querySelector('#microformat script, script[type="application/ld+json"]'); + if (microformatScript) { + const data = JSON.parse(microformatScript.textContent); + if (data && (data.name || data.title)) { + originalTitle = data.name || data.title; + console.log('Found title in microformat:', originalTitle); + callback(originalTitle); + return; + } + } + } catch (e) { + console.log('Could not parse microformat:', e); + } + + // Method 3: Try from meta tags - consolidated approach + try { + const metaTitle = document.querySelector('meta[property="og:title"], meta[name="title"]')?.content; + if (metaTitle) { + originalTitle = metaTitle; + console.log('Found title in meta tags:', originalTitle); + callback(originalTitle); + return; + } + } catch (e) { + console.log('Could not get title from meta tags:', e); + } + + // Method 4: Try from player API (if available) + try { + if (typeof movie_player !== 'undefined' && movie_player?.getVideoData) { + const videoData = movie_player.getVideoData(); + if (videoData?.title) { + originalTitle = videoData.title; + console.log('Found title in player API:', originalTitle); + callback(originalTitle); + return; + } + } + } catch (e) { + console.log('Could not get title from player API:', e); + } + + // Method 5: Try from ytplayer config (if available) + try { + if (typeof ytplayer !== 'undefined' && ytplayer?.config?.args?.title) { + originalTitle = ytplayer.config.args.title; + console.log('Found title in ytplayer.config:', originalTitle); + callback(originalTitle); + return; + } + } catch (e) { + console.log('Could not get title from ytplayer.config:', e); + } + + // If all methods fail + console.log('Could not fetch original title for video:', videoId); + callback(null); +}; + +/*------------------------------------------------------------------------------ +Initialize on page load and navigation +------------------------------------------------------------------------------*/ +ImprovedTube.initOriginalTitleToggle = function() { + // Check if required functions exist before proceeding + if (typeof ImprovedTube.videoId !== 'function') { + console.log('ImprovedTube.videoId function not available, skipping initialization'); + return; + } + + // Clear any existing intervals + if (this.originalTitleInterval) { + clearInterval(this.originalTitleInterval); + } + + const currentVideoId = ImprovedTube.videoId(); + if (!currentVideoId) { + return; + } + + console.log('Initializing original title toggle for video:', currentVideoId); + + let attempts = 0; + const maxAttempts = 50; // 5 seconds max + let lastTitleText = ''; + + // Wait for the title element to be available with the CURRENT video's title + this.originalTitleInterval = setInterval(() => { + attempts++; + + const titleElement = document.querySelector('h1.style-scope.ytd-watch-metadata yt-formatted-string'); + const latestVideoId = ImprovedTube.videoId(); + + // Make sure we're still on the same video we started with + if (latestVideoId !== currentVideoId) { + console.log('Video changed during initialization, aborting'); + clearInterval(ImprovedTube.originalTitleInterval); + return; + } + + if (titleElement && titleElement.textContent?.trim()) { + const currentText = titleElement.textContent.trim(); + + // If title changed from last check, wait a bit more to ensure it's stable + if (currentText !== lastTitleText) { + lastTitleText = currentText; + console.log('Title text changed, waiting for stability:', currentText.substring(0, 50) + '...'); + return; // Wait for next iteration to see if it changes again + } + + // Check if this title element is already processed for this video + if (titleElement.dataset.itVideoId === currentVideoId) { + console.log('Title already processed for this video, skipping'); + clearInterval(ImprovedTube.originalTitleInterval); + return; + } + + // Title is stable, proceed + console.log('Title is stable, proceeding with toggle setup'); + clearInterval(ImprovedTube.originalTitleInterval); + + // Longer delay for navigation to ensure ytInitialData is updated + setTimeout(() => { + // Double check we're still on the same video + if (ImprovedTube.videoId() === currentVideoId) { + ImprovedTube.originalTitleToggle(); + } + }, 500); + } + + if (attempts >= maxAttempts) { + console.log('Max attempts reached, stopping initialization'); + clearInterval(ImprovedTube.originalTitleInterval); + } + }, 100); +}; + +/*------------------------------------------------------------------------------ +>>> ORIGINAL TITLE TOGGLE FOR THUMBNAILS (Home, Search, Sidebar) +------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------ +This feature allows users to see original titles on video thumbnails +by Ctrl+Clicking on them throughout YouTube +------------------------------------------------------------------------------*/ + +ImprovedTube.originalTitleThumbnails = function() { + // Check if required functions exist + if (typeof ImprovedTube.videoId !== 'function') { + console.log('ImprovedTube.videoId function not available, skipping thumbnail toggle'); + return; + } + + // Check if feature is enabled + const storageValue = this.storage?.original_title_toggle ?? + ImprovedTube.storage?.original_title_toggle; + + if (storageValue === false) { + return; + } + + console.log('Original title thumbnails feature initialized'); + + // Add event listener for Ctrl+Click on video titles + document.addEventListener('click', function(event) { + // Check if Ctrl key is pressed + if (!event.ctrlKey) { + return; + } + + console.log('Ctrl+Click detected, target:', event.target); + + // IMPORTANT: Skip if we're on a video page and clicking the main title + // The main video title has its own toggle feature + if (document.documentElement.dataset.pageType === 'video') { + const mainTitle = event.target.closest('h1.style-scope.ytd-watch-metadata yt-formatted-string'); + if (mainTitle) { + console.log('Skipping - this is the main video page title'); + return; // Don't handle main video title here + } + } + + // Find the closest video title element + let target = event.target; + let titleElement = null; + let videoId = null; + let linkElement = null; + + // Method 1: Check if we clicked directly on a link with video ID + if (target.tagName === 'A' && target.href) { + const match = target.href.match(/[?&]v=([^&]+)/); + if (match) { + linkElement = target; + videoId = match[1]; + titleElement = target; // The link itself is the title element + } + } + + // Method 2: Check if we clicked on or inside a link + if (!titleElement) { + linkElement = target.closest('a[href*="/watch?v="]'); + if (linkElement) { + const match = linkElement.href.match(/[?&]v=([^&]+)/); + if (match) { + videoId = match[1]; + titleElement = target; // Use the clicked element as title + } + } + } + + // Method 3: Check if clicked element is a title with ID + if (!titleElement && (target.id === 'video-title' || target.closest('#video-title'))) { + titleElement = target.id === 'video-title' ? target : target.closest('#video-title'); + } + + // Method 4: Check if clicked on attributed string (live streams, some grid layouts) + if (!titleElement && (target.classList.contains('yt-core-attributed-string') || target.closest('.yt-core-attributed-string'))) { + const attributedString = target.classList.contains('yt-core-attributed-string') ? target : target.closest('.yt-core-attributed-string'); + titleElement = attributedString; + } + + // Method 5: Search upward for video renderer containers + if (!titleElement) { + const videoRenderer = target.closest( + 'ytd-video-renderer, ' + + 'ytd-grid-video-renderer, ' + + 'ytd-rich-grid-media, ' + + 'ytd-compact-video-renderer, ' + + 'ytd-playlist-video-renderer, ' + + 'ytd-rich-item-renderer, ' + + 'ytd-playlist-panel-video-renderer, ' + + 'ytd-reel-item-renderer' + ); + if (videoRenderer) { + titleElement = videoRenderer.querySelector('#video-title, .yt-core-attributed-string, #video-title-link, .title'); + } + } + + // Try to find video ID if we haven't already + if (titleElement && !videoId) { + // First, try to find link from the clicked element upward + if (!linkElement) { + linkElement = target.closest('a[href*="/watch?v="]'); + } + + // If not found, search in the parent container + if (!linkElement) { + const container = titleElement.closest( + 'ytd-video-renderer, ' + + 'ytd-grid-video-renderer, ' + + 'ytd-rich-grid-media, ' + + 'ytd-compact-video-renderer, ' + + 'ytd-playlist-video-renderer, ' + + 'ytd-rich-item-renderer, ' + + 'ytd-playlist-panel-video-renderer, ' + + 'ytd-lockup-view-model, ' + + 'ytd-compact-link-renderer' + ); + linkElement = container?.querySelector( + 'a[href*="/watch?v="], ' + + 'a#thumbnail, ' + + 'a#video-title, ' + + 'a#video-title-link, ' + + 'a.yt-simple-endpoint, ' + + 'a.yt-lockup-metadata-view-model__title' + ); + } + + const url = linkElement?.href; + if (url) { + const match = url.match(/[?&]v=([^&]+)/); + videoId = match ? match[1] : null; + } + } + + console.log('Found title element:', titleElement, 'Video ID:', videoId); + + if (!titleElement || !videoId) { + console.log('No title element or video ID found'); + return; + } + + // Prevent navigation - do this EARLY once we know it's a valid video link + event.preventDefault(); + event.stopPropagation(); + + console.log('Prevented navigation, processing title toggle'); + + const currentTitle = titleElement.textContent?.trim(); + if (!currentTitle) { + return; + } + + // Check if we already have the original title stored + if (titleElement.dataset.itOriginalThumbnailTitle) { + // Toggle between original and translated + const isShowingOriginal = titleElement.dataset.itShowingOriginalThumbnail === 'true'; + + console.log('Toggling title, currently showing original:', isShowingOriginal); + + if (isShowingOriginal) { + // Show translated + titleElement.textContent = titleElement.dataset.itTranslatedThumbnailTitle; + titleElement.dataset.itShowingOriginalThumbnail = 'false'; + titleElement.style.fontStyle = 'normal'; + titleElement.style.color = ''; + } else { + // Show original + titleElement.textContent = titleElement.dataset.itOriginalThumbnailTitle; + titleElement.dataset.itShowingOriginalThumbnail = 'true'; + titleElement.style.fontStyle = 'italic'; + titleElement.style.color = '#3ea6ff'; + } + return; + } + + // Store the translated title + titleElement.dataset.itTranslatedThumbnailTitle = currentTitle; + titleElement.dataset.itShowingOriginalThumbnail = 'false'; + + // Show loading indicator + const originalText = titleElement.textContent; + titleElement.textContent = '🌐 Loading...'; + titleElement.style.color = '#aaa'; + + console.log('Fetching original title for video:', videoId); + + // Fetch original title - use the same method as video page (NOT ytInitialData) + ImprovedTube.fetchOriginalTitleForThumbnail(videoId, function(originalTitle) { + console.log('Received original title:', originalTitle); + + // Restore text if fetch failed + if (!originalTitle) { + titleElement.textContent = originalText + ' ❌'; + titleElement.style.color = '#f00'; + setTimeout(() => { + titleElement.textContent = originalText; + titleElement.style.color = ''; + }, 2000); + return; + } + + const normalizedOriginal = originalTitle?.trim().replace(/\s+/g, ' '); + const normalizedCurrent = currentTitle?.trim().replace(/\s+/g, ' '); + + if (normalizedOriginal === normalizedCurrent) { + // No translation detected + titleElement.textContent = originalText + ' (✓ same)'; + titleElement.style.color = '#0a0'; + setTimeout(() => { + titleElement.textContent = originalText; + titleElement.style.color = ''; + }, 2000); + return; + } + + // Store and show original title + titleElement.dataset.itOriginalThumbnailTitle = originalTitle; + titleElement.textContent = originalTitle; + titleElement.dataset.itShowingOriginalThumbnail = 'true'; + titleElement.style.fontStyle = 'italic'; + titleElement.style.color = '#3ea6ff'; + titleElement.title = 'Ctrl+Click again to see translated title'; + + console.log('Successfully toggled to original title'); + }); + }, true); +}; + +/*------------------------------------------------------------------------------ +Fetch original title for thumbnails using YouTube oEmbed API (no CORS) +------------------------------------------------------------------------------*/ +ImprovedTube.fetchOriginalTitleForThumbnail = function(videoId, callback) { + if (!videoId) { + callback(null); + return; + } + + console.log('Fetching original title for thumbnail, video ID:', videoId); + + // Try method 1: YouTube's oEmbed API - it returns the original title and doesn't have CORS restrictions + fetch(`https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=${videoId}&format=json`) + .then(response => { + if (!response.ok) { + throw new Error('oEmbed API failed'); + } + return response.json(); + }) + .then(data => { + if (data && data.title) { + console.log('Found original title from oEmbed API:', data.title); + callback(data.title); + } else { + console.log('No title in oEmbed response, trying fallback...'); + tryFallbackMethod(); + } + }) + .catch(error => { + console.error('Error fetching from oEmbed API:', error); + console.log('Trying fallback method via content script...'); + tryFallbackMethod(); + }); + + // Fallback: Use postMessage to ask content script to fetch via background + function tryFallbackMethod() { + const messageId = 'fetch-title-' + videoId + '-' + Date.now(); + let responseReceived = false; + + // Listen for response + const listener = function(event) { + if (event.data && event.data.type === 'IT_ORIGINAL_TITLE_RESPONSE' && event.data.messageId === messageId) { + responseReceived = true; + window.removeEventListener('message', listener); + console.log('Received response from content script:', event.data); + if (event.data.title) { + console.log('Found original title from fallback method:', event.data.title); + callback(event.data.title); + } else { + console.log('Fallback method also failed - no title in response'); + callback(null); + } + } + }; + + window.addEventListener('message', listener); + + console.log('Sending message to content script with messageId:', messageId); + + // Request via content script + window.postMessage({ + type: 'IT_FETCH_ORIGINAL_TITLE', + videoId: videoId, + messageId: messageId + }, '*'); + + // Timeout after 5 seconds + setTimeout(function() { + if (!responseReceived) { + console.log('Fallback method timeout - no response received'); + window.removeEventListener('message', listener); + callback(null); + } + }, 5000); + } +}; diff --git a/js&css/web-accessible/www.youtube.com/player.js b/js&css/web-accessible/www.youtube.com/player.js index 30445137b..b252a9855 100644 --- a/js&css/web-accessible/www.youtube.com/player.js +++ b/js&css/web-accessible/www.youtube.com/player.js @@ -526,39 +526,6 @@ ImprovedTube.playerQualityWithoutFocus = function () { } }; /*------------------------------------------------------------------------------ -QUALITY FULL SCREEN -------------------------------------------------------------------------------*/ -ImprovedTube.playerQualityFullScreen = function () { - var isFs = !!( - document.fullscreenElement || - document.webkitFullscreenElement || - document.mozFullScreenElement || - document.msFullscreenElement || - document.webkitIsFullScreen || - document.mozFullScreen - ); - - var target = isFs ? fsq : ImprovedTube.storage.player_quality; - - var map = { - '144p':'tiny','240p':'small','360p':'medium','480p':'large', - '720p':'hd720','1080p':'hd1080','1440p':'hd1440','2160p':'hd2160','4320p':'highres', - 'tiny':'tiny','small':'small','medium':'medium','large':'large', - 'hd720':'hd720','hd1080':'hd1080','hd1440':'hd1440','hd2160':'hd2160','highres':'highres' - }; - var desired = map[target] || target; - - var player = ImprovedTube.elements && ImprovedTube.elements.player; - if (!player) return; - - if (typeof ImprovedTube.playerQuality === 'function') { - ImprovedTube.playerQuality(desired); - return; - } - try { if (typeof player.setPlaybackQualityRange === 'function') player.setPlaybackQualityRange(desired, desired); } catch(e) {} - try { if (typeof player.setPlaybackQuality === 'function') player.setPlaybackQuality(desired); } catch(e) {} - } -/*------------------------------------------------------------------------------ BATTERY FEATURES; PLAYER QUALITY BASED ON POWER STATUS ------------------------------------------------------------------------------*/ ImprovedTube.batteryFeatures = async function () { diff --git a/js&css/web-accessible/www.youtube.com/playlist-complete-playlist.js b/js&css/web-accessible/www.youtube.com/playlist-complete-playlist.js index 5ed13d348..0887e5c3e 100644 --- a/js&css/web-accessible/www.youtube.com/playlist-complete-playlist.js +++ b/js&css/web-accessible/www.youtube.com/playlist-complete-playlist.js @@ -354,8 +354,6 @@ ImprovedTube.playlistEnsureQuickButtons = function (renderer) { svg.style.display = 'inherit'; svg.style.width = '100%'; svg.style.height = '100%'; - svg.style.mixBlendMode = 'difference'; - svg.style.filter = 'invert(1)'; // Create path for trash icon const path = document.createElementNS('http://www.w3.org/2000/svg', 'path'); @@ -805,4 +803,4 @@ ImprovedTube.playlistBulkDeleteByProgress = function () { // Re-create with new settings this.playlistCreateBulkControls(); -}; +}; \ No newline at end of file diff --git a/js&css/web-accessible/www.youtube.com/shortcuts.js b/js&css/web-accessible/www.youtube.com/shortcuts.js index 0bd8ae43b..aab44782e 100644 --- a/js&css/web-accessible/www.youtube.com/shortcuts.js +++ b/js&css/web-accessible/www.youtube.com/shortcuts.js @@ -608,22 +608,3 @@ ImprovedTube.shortcutRotateVideo = function () { ImprovedTube.shortcutActivateFitToWindow = function() { ImprovedTube.toggleFitToWindow(); }; - -/*------------------------------------------------------------------------------ -4.7.31 CINEMA MODE -------------------------------------------------------------------------------*/ -ImprovedTube.shortcutCinemaMode = function () { - var player = xpath('//*[@id="movie_player"]/div[1]/video')[0].parentNode.parentNode - if (player.style.zIndex == 10000) { - player.style.zIndex = 1; - } else { - player.style.zIndex = 10000; - } - - var overlay = document.getElementById('overlay_cinema'); - if (!overlay) { - createOverlay(); - } else { - overlay.style.display = overlay.style.display === 'none' || overlay.style.display === '' ? 'block' : 'none'; - } -} \ No newline at end of file diff --git a/manifest.json b/manifest.json index 589992ce9..95a710e40 100644 --- a/manifest.json +++ b/manifest.json @@ -17,7 +17,8 @@ } }, "background": { - "service_worker": "background.js" + "service_worker": "background.js", + "scripts": ["background.js"] }, "action": { "default_popup": "menu/index.html", @@ -37,6 +38,7 @@ "js&css/extension/www.youtube.com/appearance/header/header.css", "js&css/extension/www.youtube.com/appearance/player/player.css", "js&css/extension/www.youtube.com/appearance/details/details.css", + "js&css/extension/www.youtube.com/appearance/details/original-title.css", "js&css/extension/www.youtube.com/appearance/sidebar/sidebar.css", "js&css/extension/www.youtube.com/appearance/comments/comments.css" ], @@ -47,10 +49,6 @@ "js": [ "js&css/extension/core.js", "js&css/extension/functions.js", - "js&css/extension/www.youtube.com/night-mode/night-mode.js", - "js&css/extension/www.youtube.com/general/general.js", - "js&css/extension/www.youtube.com/appearance/sidebar/sidebar.js", - "js&css/extension/www.youtube.com/appearance/comments/comments.js", "js&css/extension/init.js" ], "matches": ["https://www.youtube.com/*"], @@ -77,7 +75,12 @@ "js&css/web-accessible/www.youtube.com/blocklist.js", "js&css/web-accessible/www.youtube.com/settings.js", "js&css/web-accessible/www.youtube.com/last-watched-overlay.js", + "js&css/web-accessible/www.youtube.com/original-title.js", "js&css/web-accessible/init.js", + "js&css/extension/www.youtube.com/night-mode/night-mode.js", + "js&css/extension/www.youtube.com/general/general.js", + "js&css/extension/www.youtube.com/appearance/sidebar/sidebar.js", + "js&css/extension/www.youtube.com/appearance/comments/comments.js", "menu/icons/48.png" ], "matches": ["https://www.youtube.com/*"] diff --git a/menu/skeleton-parts/appearance.js b/menu/skeleton-parts/appearance.js index 24040758c..cd2f7dda5 100644 --- a/menu/skeleton-parts/appearance.js +++ b/menu/skeleton-parts/appearance.js @@ -457,6 +457,12 @@ extension.skeleton.main.layers.section.appearance.on.click.details = { text: "hideDetails", tags: "hide,remove" }, + original_title_toggle: { + component: "switch", + text: "originalTitleToggle", + tags: "title,translate,language", + value: true + }, day_of_week: { component: "switch", text: "displayDayOfTheWeak" diff --git a/menu/skeleton-parts/player.js b/menu/skeleton-parts/player.js index 284faf07d..64d4ce57f 100644 --- a/menu/skeleton-parts/player.js +++ b/menu/skeleton-parts/player.js @@ -812,19 +812,6 @@ extension.skeleton.main.layers.section.player.on.click = { } } }, - full_screen_quality: { - component: 'select', - text: 'fullScreenQuality', - id: 'full_screen_quality', - options: function () { - return extension.skeleton.main.layers.section.player.on.click.section_1.player_quality.options; - }, - on: { - render: function () { - extension.skeleton.main.layers.section.player.on.click.section_1.player_quality.on.render.call(this) - } - } - }, /* qualityWhenRunningOnBattery: { component: 'select', @@ -996,7 +983,6 @@ extension.skeleton.main.layers.section.player.on.click = { document.getElementById('player_codecs').dispatchEvent(new CustomEvent('render')); document.getElementById('optimize_codec_for_hardware_acceleration').dispatchEvent(new CustomEvent('render')); document.getElementById('player_quality_without_focus').dispatchEvent(new CustomEvent('render')); - document.getElementById('full_screen_quality')?.dispatchEvent(new CustomEvent('render')) //document.getElementById('quality_when_low_battery').dispatchEvent(new CustomEvent('render')); } if (this.dataset.value === 'false') { diff --git a/menu/skeleton-parts/shortcuts.js b/menu/skeleton-parts/shortcuts.js index 5c9c3571e..7000e01d7 100644 --- a/menu/skeleton-parts/shortcuts.js +++ b/menu/skeleton-parts/shortcuts.js @@ -365,10 +365,6 @@ extension.skeleton.main.layers.section.shortcuts = { shortcut_rotate_video: { component: 'shortcut', text: 'rotate' - }, - shortcut_cinema_mode: { - component: 'shortcut', - text: 'cinemaMode' } }, section: { diff --git a/package-lock.json b/package-lock.json index 779d733fd..a934e302a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,11 +14,12 @@ "eslint-plugin-compat": "^5.0.0" }, "devDependencies": { - "@eslint/eslintrc": "*", - "@eslint/js": "*", + "@eslint/eslintrc": "latest", + "@eslint/js": "latest", "eslint": "^9.6.0", "globals": "^15.8.0", "jest": "^29.7.0", + "jest-environment-jsdom": "^30.2.0", "jslint": "^0.12.1" } }, @@ -35,14 +36,37 @@ "node": ">=6.0.0" } }, + "node_modules/@asamuzakjp/css-color": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-3.2.0.tgz", + "integrity": "sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@csstools/css-calc": "^2.1.3", + "@csstools/css-color-parser": "^3.0.9", + "@csstools/css-parser-algorithms": "^3.0.4", + "@csstools/css-tokenizer": "^3.0.3", + "lru-cache": "^10.4.3" + } + }, + "node_modules/@asamuzakjp/css-color/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true, + "license": "ISC" + }, "node_modules/@babel/code-frame": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", - "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/highlight": "^7.24.7", - "picocolors": "^1.0.0" + "@babel/helper-validator-identifier": "^7.27.1", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" }, "engines": { "node": ">=6.9.0" @@ -231,10 +255,11 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", - "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } @@ -261,92 +286,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/highlight": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", - "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", - "dev": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.24.7", - "chalk": "^2.4.2", - "js-tokens": "^4.0.0", - "picocolors": "^1.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/highlight/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "node_modules/@babel/highlight/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/@babel/highlight/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/@babel/parser": { "version": "7.24.7", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.7.tgz", @@ -601,10 +540,126 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "node_modules/@csstools/color-helpers": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-5.1.0.tgz", + "integrity": "sha512-S11EXWJyy0Mz5SYvRmY8nJYTFFd1LCNV+7cXyAgQtOOuzb4EsgfqDufL+9esx72/eLhsRdGZwaldu/h+E4t4BA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "engines": { + "node": ">=18" + } + }, + "node_modules/@csstools/css-calc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-2.1.4.tgz", + "integrity": "sha512-3N8oaj+0juUw/1H3YwmDDJXCgTB1gKU6Hc/bB502u9zR0q2vd786XJH9QfrKIEgFlZmhZiq6epXl4rHqhzsIgQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^3.0.5", + "@csstools/css-tokenizer": "^3.0.4" + } + }, + "node_modules/@csstools/css-color-parser": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-3.1.0.tgz", + "integrity": "sha512-nbtKwh3a6xNVIp/VRuXV64yTKnb1IjTAEEh3irzS+HkKjAOYLTGNb9pmVNntZ8iVBHcWDA2Dof0QtPgFI1BaTA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "dependencies": { + "@csstools/color-helpers": "^5.1.0", + "@csstools/css-calc": "^2.1.4" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^3.0.5", + "@csstools/css-tokenizer": "^3.0.4" + } + }, + "node_modules/@csstools/css-parser-algorithms": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-3.0.5.tgz", + "integrity": "sha512-DaDeUkXZKjdGhgYaHNJTV9pV7Y9B3b644jCLs9Upc3VeNGg6LWARAT6O+Q+/COo+2gg/bM5rhpMAtf70WqfBdQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@csstools/css-tokenizer": "^3.0.4" + } + }, + "node_modules/@csstools/css-tokenizer": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-3.0.4.tgz", + "integrity": "sha512-Vd/9EVDiu6PPJt9yAh6roZP6El1xHrdvIVGjyBsHR0RYwNHgL7FJPyIIW4fANJNG6FtyZfvlRPpFI4ZM/lubvw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, "license": "MIT", "dependencies": { "eslint-visitor-keys": "^3.3.0" @@ -620,6 +675,7 @@ "version": "3.4.3", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, "license": "Apache-2.0", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -632,6 +688,7 @@ "version": "4.11.0", "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.0.tgz", "integrity": "sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==", + "dev": true, "license": "MIT", "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" @@ -650,6 +707,7 @@ "version": "0.17.0", "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.17.0.tgz", "integrity": "sha512-A68TBu6/1mHHuc5YJL0U0VVeGNiklLAL6rRmhTCP2B5XjWLMnrX+HkO+IAXyHvks5cyyY1jjK5ITPQ1HGS2EVA==", + "dev": true, "license": "Apache-2.0", "dependencies": { "@eslint/object-schema": "^2.1.4", @@ -717,6 +775,7 @@ "version": "9.6.0", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.6.0.tgz", "integrity": "sha512-D9B0/3vNg44ZeWbYMpBoXqNP4j6eQD5vNwIlGAuFRRzK/WtT/jvDQW3Bi9kkf3PMDMlM7Yi+73VLUsn5bJcl8A==", + "dev": true, "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -756,6 +815,7 @@ "version": "2.1.4", "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.4.tgz", "integrity": "sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==", + "dev": true, "license": "Apache-2.0", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -765,6 +825,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, "license": "Apache-2.0", "engines": { "node": ">=12.22" @@ -778,6 +839,7 @@ "version": "0.3.0", "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.0.tgz", "integrity": "sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==", + "dev": true, "license": "Apache-2.0", "engines": { "node": ">=18.18" @@ -891,6 +953,228 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/@jest/environment-jsdom-abstract": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/environment-jsdom-abstract/-/environment-jsdom-abstract-30.2.0.tgz", + "integrity": "sha512-kazxw2L9IPuZpQ0mEt9lu9Z98SqR74xcagANmMBU16X0lS23yPc0+S6hGLUz8kVRlomZEs/5S/Zlpqwf5yu6OQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "30.2.0", + "@jest/fake-timers": "30.2.0", + "@jest/types": "30.2.0", + "@types/jsdom": "^21.1.7", + "@types/node": "*", + "jest-mock": "30.2.0", + "jest-util": "30.2.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + }, + "peerDependencies": { + "canvas": "^3.0.0", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/@jest/environment-jsdom-abstract/node_modules/@jest/environment": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-30.2.0.tgz", + "integrity": "sha512-/QPTL7OBJQ5ac09UDRa3EQes4gt1FTEG/8jZ/4v5IVzx+Cv7dLxlVIvfvSVRiiX2drWyXeBjkMSR8hvOWSog5g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/fake-timers": "30.2.0", + "@jest/types": "30.2.0", + "@types/node": "*", + "jest-mock": "30.2.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@jest/environment-jsdom-abstract/node_modules/@jest/fake-timers": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-30.2.0.tgz", + "integrity": "sha512-HI3tRLjRxAbBy0VO8dqqm7Hb2mIa8d5bg/NJkyQcOk7V118ObQML8RC5luTF/Zsg4474a+gDvhce7eTnP4GhYw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "30.2.0", + "@sinonjs/fake-timers": "^13.0.0", + "@types/node": "*", + "jest-message-util": "30.2.0", + "jest-mock": "30.2.0", + "jest-util": "30.2.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@jest/environment-jsdom-abstract/node_modules/@jest/schemas": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-30.0.5.tgz", + "integrity": "sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sinclair/typebox": "^0.34.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@jest/environment-jsdom-abstract/node_modules/@jest/types": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-30.2.0.tgz", + "integrity": "sha512-H9xg1/sfVvyfU7o3zMfBEjQ1gcsdeTMgqHoYdN79tuLqfTtuu7WckRA1R5whDwOzxaZAeMKTYWqP+WCAi0CHsg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/pattern": "30.0.1", + "@jest/schemas": "30.0.5", + "@types/istanbul-lib-coverage": "^2.0.6", + "@types/istanbul-reports": "^3.0.4", + "@types/node": "*", + "@types/yargs": "^17.0.33", + "chalk": "^4.1.2" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@jest/environment-jsdom-abstract/node_modules/@sinclair/typebox": { + "version": "0.34.41", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.41.tgz", + "integrity": "sha512-6gS8pZzSXdyRHTIqoqSVknxolr1kzfy4/CeDnrzsVz8TTIWUbOBr6gnzOmTYJ3eXQNh4IYHIGi5aIL7sOZ2G/g==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jest/environment-jsdom-abstract/node_modules/@sinonjs/fake-timers": { + "version": "13.0.5", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-13.0.5.tgz", + "integrity": "sha512-36/hTbH2uaWuGVERyC6da9YwGWnzUZXuPro/F2LfsdOsLnCojz/iSH8MxUt/FD2S5XBSVPhmArFUXcpCQ2Hkiw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sinonjs/commons": "^3.0.1" + } + }, + "node_modules/@jest/environment-jsdom-abstract/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@jest/environment-jsdom-abstract/node_modules/ci-info": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.3.1.tgz", + "integrity": "sha512-Wdy2Igu8OcBpI2pZePZ5oWjPC38tmDVx5WKUXKwlLYkA0ozo85sLsLvkBbBn/sZaSCMFOGZJ14fvW9t5/d7kdA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/environment-jsdom-abstract/node_modules/jest-message-util": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-30.2.0.tgz", + "integrity": "sha512-y4DKFLZ2y6DxTWD4cDe07RglV88ZiNEdlRfGtqahfbIjfsw1nMCPx49Uev4IA/hWn3sDKyAnSPwoYSsAEdcimw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.27.1", + "@jest/types": "30.2.0", + "@types/stack-utils": "^2.0.3", + "chalk": "^4.1.2", + "graceful-fs": "^4.2.11", + "micromatch": "^4.0.8", + "pretty-format": "30.2.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.6" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@jest/environment-jsdom-abstract/node_modules/jest-mock": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-30.2.0.tgz", + "integrity": "sha512-JNNNl2rj4b5ICpmAcq+WbLH83XswjPbjH4T7yvGzfAGCPh1rw+xVNbtk+FnRslvt9lkCcdn9i1oAoKUuFsOxRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "30.2.0", + "@types/node": "*", + "jest-util": "30.2.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@jest/environment-jsdom-abstract/node_modules/jest-util": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-30.2.0.tgz", + "integrity": "sha512-QKNsM0o3Xe6ISQU869e+DhG+4CK/48aHYdJZGlFQVTjnbvgpcKyxpzk29fGiO7i/J8VENZ+d2iGnSsvmuHywlA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "30.2.0", + "@types/node": "*", + "chalk": "^4.1.2", + "ci-info": "^4.2.0", + "graceful-fs": "^4.2.11", + "picomatch": "^4.0.2" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@jest/environment-jsdom-abstract/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/@jest/environment-jsdom-abstract/node_modules/pretty-format": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-30.2.0.tgz", + "integrity": "sha512-9uBdv/B4EefsuAL+pWqueZyZS2Ba+LxfFeQ9DN14HU4bN8bhaxKdkpjpB6fs9+pSjIBu+FXQHImEg8j/Lw0+vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/schemas": "30.0.5", + "ansi-styles": "^5.2.0", + "react-is": "^18.3.1" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, "node_modules/@jest/expect": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", @@ -948,6 +1232,30 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/@jest/pattern": { + "version": "30.0.1", + "resolved": "https://registry.npmjs.org/@jest/pattern/-/pattern-30.0.1.tgz", + "integrity": "sha512-gWp7NfQW27LaBQz3TITS8L7ZCQ0TLvtmI//4OwlQRx4rnWxcPNIYjxZpDcN4+UlGxgm3jS5QPz8IPTCkb59wZA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "jest-regex-util": "30.0.1" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/@jest/pattern/node_modules/jest-regex-util": { + "version": "30.0.1", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-30.0.1.tgz", + "integrity": "sha512-jHEQgBXAgc+Gh4g0p3bCevgRCVRkB4VB70zhoAE48gxeSr1hfUOsM/C2WoJgVL7Eyg//hudYENbm3Ne+/dRVVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, "node_modules/@jest/reporters": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz", @@ -1148,6 +1456,7 @@ "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, "license": "MIT", "dependencies": { "@nodelib/fs.stat": "2.0.5", @@ -1161,6 +1470,7 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, "license": "MIT", "engines": { "node": ">= 8" @@ -1170,6 +1480,7 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, "license": "MIT", "dependencies": { "@nodelib/fs.scandir": "2.1.5", @@ -1277,6 +1588,18 @@ "@types/istanbul-lib-report": "*" } }, + "node_modules/@types/jsdom": { + "version": "21.1.7", + "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-21.1.7.tgz", + "integrity": "sha512-yOriVnggzrnQ3a9OKOCxaVuSug3w3/SbOj5i7VwXWZEyUNl3bLF9V3MfxGbZKuwqJOQyRfqXyROBB1CoZLFWzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/tough-cookie": "*", + "parse5": "^7.0.0" + } + }, "node_modules/@types/node": { "version": "20.14.2", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.2.tgz", @@ -1292,11 +1615,19 @@ "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", "dev": true }, + "node_modules/@types/tough-cookie": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz", + "integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/yargs": { - "version": "17.0.32", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz", - "integrity": "sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==", + "version": "17.0.34", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.34.tgz", + "integrity": "sha512-KExbHVa92aJpw9WDQvzBaGVE2/Pz+pLZQloT2hjL8IqsZnV62rlPOYvNnLmf/L2dyllfVUOVBj64M0z/46eR2A==", "dev": true, + "license": "MIT", "dependencies": { "@types/yargs-parser": "*" } @@ -1334,6 +1665,16 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -1369,6 +1710,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, "engines": { "node": ">=8" } @@ -1377,6 +1719,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "dependencies": { "color-convert": "^2.0.1" }, @@ -1656,6 +1999,7 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -1731,6 +2075,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, "dependencies": { "color-name": "~1.1.4" }, @@ -1741,7 +2086,8 @@ "node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true }, "node_modules/concat-map": { "version": "0.0.1", @@ -1785,6 +2131,7 @@ "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, "license": "MIT", "dependencies": { "path-key": "^3.1.0", @@ -1795,6 +2142,34 @@ "node": ">= 8" } }, + "node_modules/cssstyle": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-4.6.0.tgz", + "integrity": "sha512-2z+rWdzbbSZv6/rhtvzvqeZQHrBaqgogqt85sqFNbabZOuFbCVFb8kPeEtZjiKkbrm395irpNKiYeFeLiQnFPg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/css-color": "^3.2.0", + "rrweb-cssom": "^0.8.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/data-urls": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz", + "integrity": "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-mimetype": "^4.0.0", + "whatwg-url": "^14.0.0" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/debug": { "version": "4.3.5", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", @@ -1811,6 +2186,13 @@ } } }, + "node_modules/decimal.js": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", + "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", + "dev": true, + "license": "MIT" + }, "node_modules/dedent": { "version": "1.5.3", "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.3.tgz", @@ -1829,6 +2211,7 @@ "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, "license": "MIT" }, "node_modules/deepmerge": { @@ -1881,6 +2264,19 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, + "node_modules/entities": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", + "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -1911,6 +2307,7 @@ "version": "9.6.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.6.0.tgz", "integrity": "sha512-ElQkdLMEEqQNM9Njff+2Y4q2afHk7JpkPvrd7Xh7xefwgQynqPxwf55J7di9+MEibWUGdNjFF9ITG9Pck5M84w==", + "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", @@ -2069,6 +2466,7 @@ "version": "8.0.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.0.1.tgz", "integrity": "sha512-pL8XjgP4ZOmmwfFE8mEhSxA7ZY4C+LWyqjQ3o4yWkkmD0qcMT9kkW3zWHOczhWcjTSgqycYAgwSlXvZltv65og==", + "dev": true, "license": "BSD-2-Clause", "dependencies": { "esrecurse": "^4.3.0", @@ -2097,6 +2495,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, "license": "MIT", "engines": { "node": ">=10" @@ -2109,6 +2508,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, "license": "MIT", "dependencies": { "locate-path": "^6.0.0", @@ -2125,6 +2525,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, "license": "MIT", "dependencies": { "p-locate": "^5.0.0" @@ -2140,6 +2541,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, "license": "MIT", "dependencies": { "p-limit": "^3.0.2" @@ -2184,6 +2586,7 @@ "version": "1.5.0", "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "dev": true, "license": "BSD-3-Clause", "dependencies": { "estraverse": "^5.1.0" @@ -2196,6 +2599,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, "license": "BSD-2-Clause", "dependencies": { "estraverse": "^5.2.0" @@ -2208,6 +2612,7 @@ "version": "5.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=4.0" @@ -2217,6 +2622,7 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=0.10.0" @@ -2285,12 +2691,14 @@ "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, "license": "MIT" }, "node_modules/fastq": { "version": "1.17.1", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", + "dev": true, "license": "ISC", "dependencies": { "reusify": "^1.0.4" @@ -2309,6 +2717,7 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, "license": "MIT", "dependencies": { "flat-cache": "^4.0.0" @@ -2346,6 +2755,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, "license": "MIT", "dependencies": { "flatted": "^3.2.9", @@ -2359,6 +2769,7 @@ "version": "3.3.1", "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", + "dev": true, "license": "ISC" }, "node_modules/fs.realpath": { @@ -2454,6 +2865,7 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, "license": "ISC", "dependencies": { "is-glob": "^4.0.3" @@ -2485,6 +2897,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, "engines": { "node": ">=8" } @@ -2501,12 +2914,53 @@ "node": ">= 0.4" } }, + "node_modules/html-encoding-sniffer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz", + "integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-encoding": "^3.1.1" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -2516,6 +2970,19 @@ "node": ">=10.17.0" } }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/ignore": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", @@ -2573,6 +3040,7 @@ "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, "engines": { "node": ">=0.8.19" } @@ -2616,6 +3084,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -2643,6 +3112,7 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, "license": "MIT", "dependencies": { "is-extglob": "^2.1.1" @@ -2664,11 +3134,19 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" } }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true, + "license": "MIT" + }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -2690,7 +3168,8 @@ "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true }, "node_modules/istanbul-lib-coverage": { "version": "3.2.2", @@ -2874,92 +3353,311 @@ } } }, - "node_modules/jest-config": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", - "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", + "node_modules/jest-config": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", + "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", + "dev": true, + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-jest": "^29.7.0", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@types/node": "*", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, + "node_modules/jest-diff": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-docblock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz", + "integrity": "sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==", + "dev": true, + "dependencies": { + "detect-newline": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-each": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", + "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "jest-util": "^29.7.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-jsdom": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-30.2.0.tgz", + "integrity": "sha512-zbBTiqr2Vl78pKp/laGBREYzbZx9ZtqPjOK4++lL4BNDhxRnahg51HtoDrk9/VjIy9IthNEWdKVd7H5bqBhiWQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "30.2.0", + "@jest/environment-jsdom-abstract": "30.2.0", + "@types/jsdom": "^21.1.7", + "@types/node": "*", + "jsdom": "^26.1.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + }, + "peerDependencies": { + "canvas": "^3.0.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jest-environment-jsdom/node_modules/@jest/environment": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-30.2.0.tgz", + "integrity": "sha512-/QPTL7OBJQ5ac09UDRa3EQes4gt1FTEG/8jZ/4v5IVzx+Cv7dLxlVIvfvSVRiiX2drWyXeBjkMSR8hvOWSog5g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/fake-timers": "30.2.0", + "@jest/types": "30.2.0", + "@types/node": "*", + "jest-mock": "30.2.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/jest-environment-jsdom/node_modules/@jest/fake-timers": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-30.2.0.tgz", + "integrity": "sha512-HI3tRLjRxAbBy0VO8dqqm7Hb2mIa8d5bg/NJkyQcOk7V118ObQML8RC5luTF/Zsg4474a+gDvhce7eTnP4GhYw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "30.2.0", + "@sinonjs/fake-timers": "^13.0.0", + "@types/node": "*", + "jest-message-util": "30.2.0", + "jest-mock": "30.2.0", + "jest-util": "30.2.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/jest-environment-jsdom/node_modules/@jest/schemas": { + "version": "30.0.5", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-30.0.5.tgz", + "integrity": "sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sinclair/typebox": "^0.34.0" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/jest-environment-jsdom/node_modules/@jest/types": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-30.2.0.tgz", + "integrity": "sha512-H9xg1/sfVvyfU7o3zMfBEjQ1gcsdeTMgqHoYdN79tuLqfTtuu7WckRA1R5whDwOzxaZAeMKTYWqP+WCAi0CHsg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/pattern": "30.0.1", + "@jest/schemas": "30.0.5", + "@types/istanbul-lib-coverage": "^2.0.6", + "@types/istanbul-reports": "^3.0.4", + "@types/node": "*", + "@types/yargs": "^17.0.33", + "chalk": "^4.1.2" + }, + "engines": { + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" + } + }, + "node_modules/jest-environment-jsdom/node_modules/@sinclair/typebox": { + "version": "0.34.41", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.34.41.tgz", + "integrity": "sha512-6gS8pZzSXdyRHTIqoqSVknxolr1kzfy4/CeDnrzsVz8TTIWUbOBr6gnzOmTYJ3eXQNh4IYHIGi5aIL7sOZ2G/g==", + "dev": true, + "license": "MIT" + }, + "node_modules/jest-environment-jsdom/node_modules/@sinonjs/fake-timers": { + "version": "13.0.5", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-13.0.5.tgz", + "integrity": "sha512-36/hTbH2uaWuGVERyC6da9YwGWnzUZXuPro/F2LfsdOsLnCojz/iSH8MxUt/FD2S5XBSVPhmArFUXcpCQ2Hkiw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sinonjs/commons": "^3.0.1" + } + }, + "node_modules/jest-environment-jsdom/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-environment-jsdom/node_modules/ci-info": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.3.1.tgz", + "integrity": "sha512-Wdy2Igu8OcBpI2pZePZ5oWjPC38tmDVx5WKUXKwlLYkA0ozo85sLsLvkBbBn/sZaSCMFOGZJ14fvW9t5/d7kdA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-environment-jsdom/node_modules/jest-message-util": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-30.2.0.tgz", + "integrity": "sha512-y4DKFLZ2y6DxTWD4cDe07RglV88ZiNEdlRfGtqahfbIjfsw1nMCPx49Uev4IA/hWn3sDKyAnSPwoYSsAEdcimw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/core": "^7.11.6", - "@jest/test-sequencer": "^29.7.0", - "@jest/types": "^29.6.3", - "babel-jest": "^29.7.0", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "deepmerge": "^4.2.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "jest-circus": "^29.7.0", - "jest-environment-node": "^29.7.0", - "jest-get-type": "^29.6.3", - "jest-regex-util": "^29.6.3", - "jest-resolve": "^29.7.0", - "jest-runner": "^29.7.0", - "jest-util": "^29.7.0", - "jest-validate": "^29.7.0", - "micromatch": "^4.0.4", - "parse-json": "^5.2.0", - "pretty-format": "^29.7.0", + "@babel/code-frame": "^7.27.1", + "@jest/types": "30.2.0", + "@types/stack-utils": "^2.0.3", + "chalk": "^4.1.2", + "graceful-fs": "^4.2.11", + "micromatch": "^4.0.8", + "pretty-format": "30.2.0", "slash": "^3.0.0", - "strip-json-comments": "^3.1.1" + "stack-utils": "^2.0.6" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "@types/node": "*", - "ts-node": ">=9.0.0" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "ts-node": { - "optional": true - } + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, - "node_modules/jest-diff": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", - "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "node_modules/jest-environment-jsdom/node_modules/jest-mock": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-30.2.0.tgz", + "integrity": "sha512-JNNNl2rj4b5ICpmAcq+WbLH83XswjPbjH4T7yvGzfAGCPh1rw+xVNbtk+FnRslvt9lkCcdn9i1oAoKUuFsOxRw==", "dev": true, + "license": "MIT", "dependencies": { - "chalk": "^4.0.0", - "diff-sequences": "^29.6.3", - "jest-get-type": "^29.6.3", - "pretty-format": "^29.7.0" + "@jest/types": "30.2.0", + "@types/node": "*", + "jest-util": "30.2.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, - "node_modules/jest-docblock": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz", - "integrity": "sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==", + "node_modules/jest-environment-jsdom/node_modules/jest-util": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-30.2.0.tgz", + "integrity": "sha512-QKNsM0o3Xe6ISQU869e+DhG+4CK/48aHYdJZGlFQVTjnbvgpcKyxpzk29fGiO7i/J8VENZ+d2iGnSsvmuHywlA==", "dev": true, + "license": "MIT", "dependencies": { - "detect-newline": "^3.0.0" + "@jest/types": "30.2.0", + "@types/node": "*", + "chalk": "^4.1.2", + "ci-info": "^4.2.0", + "graceful-fs": "^4.2.11", + "picomatch": "^4.0.2" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, - "node_modules/jest-each": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", - "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", + "node_modules/jest-environment-jsdom/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/jest-environment-jsdom/node_modules/pretty-format": { + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-30.2.0.tgz", + "integrity": "sha512-9uBdv/B4EefsuAL+pWqueZyZS2Ba+LxfFeQ9DN14HU4bN8bhaxKdkpjpB6fs9+pSjIBu+FXQHImEg8j/Lw0+vA==", "dev": true, + "license": "MIT", "dependencies": { - "@jest/types": "^29.6.3", - "chalk": "^4.0.0", - "jest-get-type": "^29.6.3", - "jest-util": "^29.7.0", - "pretty-format": "^29.7.0" + "@jest/schemas": "30.0.5", + "ansi-styles": "^5.2.0", + "react-is": "^18.3.1" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-environment-node": { @@ -3341,7 +4039,8 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/js-yaml": { "version": "3.14.2", @@ -3357,6 +4056,46 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsdom": { + "version": "26.1.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-26.1.0.tgz", + "integrity": "sha512-Cvc9WUhxSMEo4McES3P7oK3QaXldCfNWp7pl2NNeiIFlCoLr3kfq9kb1fxftiwk1FLV7CvpvDfonxtzUDeSOPg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cssstyle": "^4.2.1", + "data-urls": "^5.0.0", + "decimal.js": "^10.5.0", + "html-encoding-sniffer": "^4.0.0", + "http-proxy-agent": "^7.0.2", + "https-proxy-agent": "^7.0.6", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.16", + "parse5": "^7.2.1", + "rrweb-cssom": "^0.8.0", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^5.1.1", + "w3c-xmlserializer": "^5.0.0", + "webidl-conversions": "^7.0.0", + "whatwg-encoding": "^3.1.1", + "whatwg-mimetype": "^4.0.0", + "whatwg-url": "^14.1.1", + "ws": "^8.18.0", + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "canvas": "^3.0.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -3412,6 +4151,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, "license": "MIT" }, "node_modules/json-parse-even-better-errors": { @@ -3430,6 +4170,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, "license": "MIT" }, "node_modules/json5": { @@ -3448,6 +4189,7 @@ "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, "license": "MIT", "dependencies": { "json-buffer": "3.0.1" @@ -3475,6 +4217,7 @@ "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, "license": "MIT", "dependencies": { "prelude-ls": "^1.2.1", @@ -3512,6 +4255,7 @@ "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, "license": "MIT" }, "node_modules/lru-cache": { @@ -3566,10 +4310,11 @@ "dev": true }, "node_modules/micromatch": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz", - "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, + "license": "MIT", "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" @@ -3606,7 +4351,8 @@ "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==" + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true }, "node_modules/node-int64": { "version": "0.4.0", @@ -3653,6 +4399,13 @@ "node": ">=8" } }, + "node_modules/nwsapi": { + "version": "2.2.22", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.22.tgz", + "integrity": "sha512-ujSMe1OWVn55euT1ihwCI1ZcAaAU3nxUiDwfDQldc51ZXaB9m2AyOn6/jh1BLe2t/G8xd6uKG1UBF2aZJeg2SQ==", + "dev": true, + "license": "MIT" + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -3681,6 +4434,7 @@ "version": "0.9.4", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, "license": "MIT", "dependencies": { "deep-is": "^0.1.3", @@ -3803,6 +4557,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/parse5": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz", + "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "entities": "^6.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -3824,6 +4591,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, "engines": { "node": ">=8" } @@ -3835,9 +4603,10 @@ "dev": true }, "node_modules/picocolors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", - "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==" + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" }, "node_modules/picomatch": { "version": "2.3.1", @@ -3876,6 +4645,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, "license": "MIT", "engines": { "node": ">= 0.8.0" @@ -3955,6 +4725,7 @@ "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, "funding": [ { "type": "github", @@ -4068,16 +4839,25 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, "license": "MIT", "engines": { "iojs": ">=1.0.0", "node": ">=0.10.0" } }, + "node_modules/rrweb-cssom": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.8.0.tgz", + "integrity": "sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw==", + "dev": true, + "license": "MIT" + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, "funding": [ { "type": "github", @@ -4097,6 +4877,26 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true, + "license": "MIT" + }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "license": "ISC", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, "node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -4110,6 +4910,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, "dependencies": { "shebang-regex": "^3.0.0" }, @@ -4121,6 +4922,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, "engines": { "node": ">=8" } @@ -4219,6 +5021,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -4259,6 +5062,7 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, "dependencies": { "has-flag": "^4.0.0" }, @@ -4278,6 +5082,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true, + "license": "MIT" + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -4296,6 +5107,7 @@ "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true, "license": "MIT" }, "node_modules/tiny-invariant": { @@ -4304,6 +5116,26 @@ "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==", "license": "MIT" }, + "node_modules/tldts": { + "version": "6.1.86", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.86.tgz", + "integrity": "sha512-WMi/OQ2axVTf/ykqCQgXiIct+mSQDFdH2fkwhPwgEwvJ1kSzZRiinb0zF2Xb8u4+OqPChmyI6MEu4EezNJz+FQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "tldts-core": "^6.1.86" + }, + "bin": { + "tldts": "bin/cli.js" + } + }, + "node_modules/tldts-core": { + "version": "6.1.86", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.86.tgz", + "integrity": "sha512-Je6p7pkk+KMzMv2XXKmAE3McmolOQFdxkKw0R8EYNr7sELW46JqnNeTX8ybPiQgvg1ymCoF8LXs5fzFaZvJPTA==", + "dev": true, + "license": "MIT" + }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -4331,6 +5163,32 @@ "node": ">=8.0" } }, + "node_modules/tough-cookie": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-5.1.2.tgz", + "integrity": "sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tldts": "^6.1.32" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/tr46": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz", + "integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/tslib": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", @@ -4341,6 +5199,7 @@ "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, "license": "MIT", "dependencies": { "prelude-ls": "^1.2.1" @@ -4434,6 +5293,19 @@ "node": ">=10.12.0" } }, + "node_modules/w3c-xmlserializer": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", + "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", @@ -4443,10 +5315,58 @@ "makeerror": "1.0.12" } }, + "node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-encoding": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", + "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/whatwg-mimetype": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", + "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/whatwg-url": { + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz", + "integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tr46": "^5.1.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, "dependencies": { "isexe": "^2.0.0" }, @@ -4461,6 +5381,7 @@ "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -4502,6 +5423,45 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/ws": { + "version": "8.18.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", + "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xml-name-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true, + "license": "MIT" + }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", diff --git a/package.json b/package.json index 202a25153..e74155ef9 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "eslint": "^9.6.0", "globals": "^15.8.0", "jest": "^29.7.0", + "jest-environment-jsdom": "^30.2.0", "jslint": "^0.12.1" }, "dependencies": { diff --git a/tests/unit/original-title.test.js b/tests/unit/original-title.test.js new file mode 100644 index 000000000..b1937d226 --- /dev/null +++ b/tests/unit/original-title.test.js @@ -0,0 +1,249 @@ +/** + * Unit tests for original-title.js + * Testing the original/translated title toggle feature + */ + +// Mock global objects +global.chrome = { + runtime: { + sendMessage: jest.fn() + }, + storage: { + local: { + get: jest.fn((keys, callback) => { + callback({ original_title_toggle: true }); + }) + } + } +}; + +global.ImprovedTube = { + storage: { data: {} }, + elements: {} +}; + +// Mock fetch API +global.fetch = jest.fn(); + +describe('Original Title Toggle Feature', () => { + + beforeEach(() => { + // Reset mocks before each test + jest.clearAllMocks(); + + // Reset DOM + document.body.innerHTML = ''; + + // Mock window.postMessage + global.window.postMessage = jest.fn(); + global.window.addEventListener = jest.fn(); + }); + + describe('HTML Entity Decoding', () => { + + test('should decode & to &', () => { + const input = 'Music & Relaxation'; + const expected = 'Music & Relaxation'; + + // Manual decode function (same as in background.js) + const decode = (text) => text.replace(/&/g, '&'); + + expect(decode(input)).toBe(expected); + }); + + test('should decode multiple HTML entities', () => { + const input = 'Focus & Study - <Relaxing Music>'; + const expected = 'Focus & Study - '; + + const decode = (text) => text + .replace(/&/g, '&') + .replace(/</g, '<') + .replace(/>/g, '>'); + + expect(decode(input)).toBe(expected); + }); + + test('should decode numeric HTML entities', () => { + const input = 'Music & Sounds'; + const expected = 'Music & Sounds'; + + const decode = (text) => text.replace(/&#(\d+);/g, + (match, dec) => String.fromCharCode(dec)); + + expect(decode(input)).toBe(expected); + }); + }); + + describe('Title Comparison and Normalization', () => { + + test('should normalize whitespace in titles', () => { + const title1 = 'Medieval Music for Focus'; + const title2 = 'Medieval Music for Focus'; + + const normalize = (text) => text?.trim().replace(/\s+/g, ' '); + + expect(normalize(title1)).toBe(normalize(title2)); + }); + + test('should detect identical titles (no translation)', () => { + const original = 'Relaxing Piano Music'; + const translated = 'Relaxing Piano Music'; + + const normalize = (text) => text?.trim().replace(/\s+/g, ' '); + const areEqual = normalize(original) === normalize(translated); + + expect(areEqual).toBe(true); + }); + + test('should detect different titles (translation exists)', () => { + const original = 'Beautiful Relaxing Music'; + const translated = 'Krásna relaxačná hudba'; // Slovak + + const normalize = (text) => text?.trim().replace(/\s+/g, ' '); + const areEqual = normalize(original) === normalize(translated); + + expect(areEqual).toBe(false); + }); + }); + + describe('Video ID Extraction', () => { + + test('should extract video ID from standard YouTube URL', () => { + const url = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'; + const match = url.match(/[?&]v=([^&]+)/); + const videoId = match ? match[1] : null; + + expect(videoId).toBe('dQw4w9WgXcQ'); + }); + + test('should extract video ID from URL with multiple parameters', () => { + const url = 'https://www.youtube.com/watch?v=abc123&list=PLxyz&index=5'; + const match = url.match(/[?&]v=([^&]+)/); + const videoId = match ? match[1] : null; + + expect(videoId).toBe('abc123'); + }); + + test('should return null for URL without video ID', () => { + const url = 'https://www.youtube.com/'; + const match = url.match(/[?&]v=([^&]+)/); + const videoId = match ? match[1] : null; + + expect(videoId).toBeNull(); + }); + }); + + describe('oEmbed API Integration', () => { + + test('should construct correct oEmbed URL', () => { + const videoId = 'dQw4w9WgXcQ'; + const oembedUrl = `https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=${videoId}&format=json`; + + expect(oembedUrl).toContain('oembed'); + expect(oembedUrl).toContain(videoId); + expect(oembedUrl).toContain('format=json'); + }); + + test('should handle successful oEmbed response', async () => { + const mockTitle = 'Original Video Title'; + const mockResponse = { + ok: true, + json: async () => ({ title: mockTitle }) + }; + + fetch.mockResolvedValueOnce(mockResponse); + + const response = await fetch('https://www.youtube.com/oembed?url=...'); + const data = await response.json(); + + expect(data.title).toBe(mockTitle); + }); + + test('should handle failed oEmbed response', async () => { + const mockResponse = { + ok: false, + status: 401 + }; + + fetch.mockResolvedValueOnce(mockResponse); + + const response = await fetch('https://www.youtube.com/oembed?url=...'); + + expect(response.ok).toBe(false); + expect(response.status).toBe(401); + }); + }); + + describe('PostMessage Communication', () => { + + test('should create correct message format for content script', () => { + const videoId = 'test123'; + const messageId = `fetch-title-${videoId}-${Date.now()}`; + + const message = { + type: 'IT_FETCH_ORIGINAL_TITLE', + videoId: videoId, + messageId: messageId + }; + + expect(message.type).toBe('IT_FETCH_ORIGINAL_TITLE'); + expect(message.videoId).toBe(videoId); + expect(message.messageId).toContain('fetch-title-test123'); + }); + + test('should create correct response message format', () => { + const messageId = 'fetch-title-test123-1234567890'; + const title = 'Test Title'; + + const response = { + type: 'IT_ORIGINAL_TITLE_RESPONSE', + messageId: messageId, + title: title + }; + + expect(response.type).toBe('IT_ORIGINAL_TITLE_RESPONSE'); + expect(response.messageId).toBe(messageId); + expect(response.title).toBe(title); + }); + }); + + describe('Title Toggle State Management', () => { + + test('should initialize with translated title showing', () => { + const titleElement = document.createElement('a'); + titleElement.textContent = 'Translated Title'; + + // Mock dataset (not set yet) + expect(titleElement.dataset.itShowingOriginalThumbnail).toBeUndefined(); + }); + + test('should store both original and translated titles', () => { + const titleElement = document.createElement('a'); + titleElement.dataset.itOriginalThumbnailTitle = 'Original Title'; + titleElement.dataset.itTranslatedThumbnailTitle = 'Translated Title'; + titleElement.dataset.itShowingOriginalThumbnail = 'false'; + + expect(titleElement.dataset.itOriginalThumbnailTitle).toBe('Original Title'); + expect(titleElement.dataset.itTranslatedThumbnailTitle).toBe('Translated Title'); + expect(titleElement.dataset.itShowingOriginalThumbnail).toBe('false'); + }); + + test('should toggle between original and translated', () => { + const titleElement = document.createElement('a'); + titleElement.dataset.itOriginalThumbnailTitle = 'Original'; + titleElement.dataset.itTranslatedThumbnailTitle = 'Translated'; + titleElement.dataset.itShowingOriginalThumbnail = 'false'; + + // Toggle to original + const isShowingOriginal = titleElement.dataset.itShowingOriginalThumbnail === 'true'; + if (!isShowingOriginal) { + titleElement.textContent = titleElement.dataset.itOriginalThumbnailTitle; + titleElement.dataset.itShowingOriginalThumbnail = 'true'; + } + + expect(titleElement.textContent).toBe('Original'); + expect(titleElement.dataset.itShowingOriginalThumbnail).toBe('true'); + }); + }); + +});