Better Greasy Fork

Enhances Greasy Fork with useful features: shows the script icon next to the title, adds a Markdown editor (for comments/descriptions), and a button to download the script as a ".user.js" file from the code page. It also enriches script pages with author customizations via metadata, such as accent colors, copyright info, and social icons.

// ==UserScript==
// @name                Better Greasy Fork
// @name:pt-BR          Greasy Fork Aprimorado
// @name:zh-CN          更好的 Greasy Fork
// @name:zh-TW          更好的 Greasy Fork
// @name:en             Better Greasy Fork
// @name:es             Greasy Fork Mejorado
// @name:ja             改良版 Greasy Fork
// @name:ko             향상된 Greasy Fork
// @name:de             Verbesserter Greasy Fork
// @name:fr             Greasy Fork Amélioré
// @namespace           https://github.com/0H4S
// @version             1.1
// @description         Enhances Greasy Fork with useful features: shows the script icon next to the title, adds a Markdown editor (for comments/descriptions), and a button to download the script as a ".user.js" file from the code page. It also enriches script pages with author customizations via metadata, such as accent colors, copyright info, and social icons.
// @description:pt-BR   Aprimora o Greasy Fork: exibe o ícone do script ao lado do título, adiciona um editor Markdown (para comentários/descrições) e um botão para baixar o script como ".user.js" na página de código. Também enriquece as páginas com personalizações de autor via metadados, como cores de destaque, copyright e ícones sociais.
// @description:zh-CN   为 Greasy Fork 增强多项实用功能:在标题旁显示脚本图标,在文本编辑器(用于评论和描述)中加入 Markdown 格式化工具,并在“代码”页面新增下载按钮,可将脚本直接下载为“.user.js”文件。此外,通过元数据为作者提供新的自定义选项,丰富脚本页面,显示高亮颜色、版权信息和社交图标。
// @description:zh-TW   為 Greasy Fork 增強多項實用功能:在標題旁顯示腳本圖示,在文字編輯器(用於留言與說明)中加入 Markdown 格式化工具,並在「程式碼」頁面新增下載按鈕,可將腳本直接下載為「.user.js」檔案。此外,透過元資料為作者提供新的自訂選項,豐富腳本頁面,顯示重點色、版權資訊與社群圖示。
// @description:en      Enhances Greasy Fork with useful features: shows the script icon next to the title, adds a Markdown editor (for comments/descriptions), and a button to download the script as a ".user.js" file from the code page. It also enriches script pages with author customizations via metadata, such as accent colors, copyright info, and social icons.
// @description:es      Mejora Greasy Fork: muestra el icono del script junto al título, añade un editor Markdown (para comentarios/descripciones) y un botón para descargar el script como ".user.js" en la página de código. También enriquece las páginas con personalizaciones para autores vía metadatos, mostrando colores de realce, copyright e iconos sociales.
// @description:ja      Greasy Fork を便利な機能で強化します:タイトル横にスクリプトのアイコンを表示し、テキストエディタ(コメントや説明用)に Markdown 整形ツールを追加し、「コード」ページにスクリプトを直接「.user.js」としてダウンロードできる新しいダウンロードボタンを作成します。さらに、メタデータを通じて作者向けのカスタマイズオプションを追加し、ハイライトカラー、著作権情報、SNS アイコンを表示してスクリプトページを充実させます。
// @description:ko      Greasy Fork에 여러 유용한 기능을 추가합니다: 제목 옆에 스크립트 아이콘을 표시하고, 텍스트 편집기(댓글 및 설명용)에 Markdown 서식 도구를 추가하며, '코드' 페이지에 스크립트를 '.user.js' 파일로 직접 다운로드할 수 있는 새 다운로드 버튼을 만듭니다. 또한 메타데이터를 통해 저자를 위한 맞춤 설정 옵션을 제공해 강조 색상, 저작권 정보, 소셜 아이콘을 표시합니다.
// @description:de      Verbessert Greasy Fork: zeigt das Skript-Symbol neben dem Titel, fügt einen Markdown-Editor (für Kommentare/Beschreibungen) und einen Button zum direkten Download als ".user.js"-Datei auf der Code-Seite hinzu. Erweitert Skriptseiten zudem um Autoren-Anpassungen via Metadaten wie Akzentfarben, Copyright-Infos & Social-Icons.
// @description:fr      Améliore Greasy Fork : affiche l'icône du script à côté du titre, ajoute un éditeur Markdown (pour commentaires/descriptions) et un bouton pour télécharger le script en ".user.js" sur la page « Code ». Enrichit aussi les pages de script avec des personnalisations d'auteur via métadonnées, comme les couleurs d'accent, le copyright et les icônes sociales.
// @author              OHAS
// @license             CC-BY-NC-ND-4.0
// @icon                https://gist.githubusercontent.com/0H4S/0f1517e84b8f0aaa2d1f26e853096f62/raw/BGF_icon.svg
// @match               https://greasyfork.org/*
// @require             https://update.greasyfork.org/scripts/549920/Script%20Notifier.js
// @connect             update.greasyfork.org
// @connect             gist.githubusercontent.com
// @grant               GM_xmlhttpRequest
// @grant               GM_addStyle
// @grant               GM_getValue
// @grant               GM_setValue
// @grant               GM_deleteValue
// @grant               GM_registerMenuCommand
// @compatible          chrome
// @compatible          firefox
// @compatible          edge
// @run-at              document-idle
// @bgf-colorLT			#ff6600ff
// @bgf-colorDT         #ffd900ff
// @bgf-copyright       [2025 OHAS. All Rights Reserved.](https://gist.github.com/0H4S/ae2fa82957a089576367e364cbf02438)
// @bgf-compatible		brave, mobile
// @bgf-social          https://github.com/0H4S, https://www.instagram.com/o_h_a_s
// ==/UserScript==

(function () {
    'use strict';
    if (window.top !== window.self) {
        return;
    }
    const SCRIPT_CONFIG = {
        notificationsUrl: 'https://gist.githubusercontent.com/0H4S/1eee8eb439b554860274686143eda3f9/raw/better_greasy_fork.notifications.json',
        scriptVersion: '1.1',
    };
    const notifier = new ScriptNotifier(SCRIPT_CONFIG);
    notifier.run();
    const OLD_CACHE_KEY = 'Icons';
    const CACHE_KEY = 'Values';

    // ================
    // #region ÍCONES
    // ================

    let iconCache;
    const processedKeys = new Set();

    async function saveCache() {
        await GM_setValue(CACHE_KEY, iconCache);
    }

    function normalizeScriptPath(pathname) {
        let withoutLocale = pathname.replace(/^\/[a-z]{2}(?:-[A-Z]{2})?\//, '/');
        const match = withoutLocale.match(/^\/scripts\/\d+-.+?(?=\/|$)/);
        return match ? match[0] : null;
    }

    function extractScriptIdFromNormalizedPath(normalized) {
        const match = normalized.match(/\/scripts\/(\d+)-/);
        return match ? match[1] : null;
    }

    function createIconElement(src, isHeader = false) {
        const img = document.createElement('img');
        img.src = src;
        img.alt = '';
        if (isHeader) {
            img.style.cssText = `
                width: 80px;
                height: 80px;
                margin-right: 10px;
                vertical-align: middle;
                border-radius: 4px;
                object-fit: contain;
                pointer-events: none;
            `;
        } else {
            img.style.cssText = `
                width: 40px;
                height: 40px;
                margin-right: 8px;
                vertical-align: middle;
                border-radius: 3px;
                object-fit: contain;
                pointer-events: none;
            `;
        }
        img.loading = 'lazy';
        return img;
    }

    function extractMetadataFromContent(content) {
        if (typeof content !== 'string') return {};
        const metadata = {};
        const lines = content.split('\n');
        const supportedTags = new Set([
            '@icon', '@bgf-colorLT', '@bgf-colorDT', '@bgf-compatible',
            '@bgf-copyright', '@bgf-social'
        ]);
        for (const line of lines) {
            const trimmedLine = line.trim();
            if (trimmedLine.startsWith('// ==/UserScript==')) break;
            if (!trimmedLine.startsWith('// @')) continue;
            const match = trimmedLine.match(/\/\/\s*(@[a-zA-Z0-9-]+)\s+(.+)/);
            if (!match) continue;
            const key = match[1];
            let value = match[2].trim();
            if (supportedTags.has(key) && !metadata.hasOwnProperty(key)) {
                if (key === '@bgf-colorLT' || key === '@bgf-colorDT') {
                    const colorRegex = /(#[0-9a-fA-F]{3,8}|(?:rgba?|hsla?)\s*\([^)]+\))/;
                    const colorMatch = value.match(colorRegex);
                    if (colorMatch) {
                        value = colorMatch[0];
                    } else {
                        value = value.split(',')[0].trim();
                    }
                }
                metadata[key] = value;
            }
        }
        return metadata;
    }

    function isValidIconUrl(url) {
        return url && (url.startsWith('http') || url.startsWith(''));
    }

    async function processScript(normalizedPath, targetElement, isHeader = false) {
        if (processedKeys.has(normalizedPath) && isHeader) {
            applyBfgFeatures(iconCache[normalizedPath]);
        }
        if (processedKeys.has(normalizedPath) && !isHeader) {
            const cached = iconCache[normalizedPath];
            if (cached && isValidIconUrl(cached.iconUrl)) {
                targetElement.prepend(createIconElement(cached.iconUrl, isHeader));
            }
            return;
        }
        processedKeys.add(normalizedPath);
        const cached = iconCache[normalizedPath];
        const now = Date.now();
        const applyColorToBlockquote = (metadata) => {
            const blockquotes = document.querySelectorAll(`blockquote.script-description-blockquote[data-bgf-path="${normalizedPath}"]`);
            if (blockquotes.length === 0) return;

            const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
            const colorToApply = isDarkMode ? metadata.bgfColorDT : metadata.bgfColorLT;

            blockquotes.forEach(bq => {
                if (colorToApply) {
                    bq.style.setProperty('border-left-color', colorToApply, 'important');
                } else {
                    bq.style.removeProperty('border-left-color');
                }
            });
        };
        if (cached && now - cached.ts < 30 * 24 * 60 * 60 * 1000) {
            if (isValidIconUrl(cached.iconUrl)) {
                targetElement.prepend(createIconElement(cached.iconUrl, isHeader));
            }
            applyColorToBlockquote(cached);
            if (isHeader) {
                applyBfgFeatures(cached);
            }
            return;
        }
        const scriptId = extractScriptIdFromNormalizedPath(normalizedPath);
        if (!scriptId) {
            iconCache[normalizedPath] = { ts: now };
            await saveCache();
            return;
        }
        const scriptUrl = `https://update.greasyfork.org/scripts/${scriptId}.js`;
        GM_xmlhttpRequest({
            method: 'GET',
            url: scriptUrl,
            timeout: 6000,
            onload: async function (res) {
                if (typeof res.responseText !== 'string') {
                    iconCache[normalizedPath] = { ts: now };
                    await saveCache();
                    return;
                }
                const rawMetadata = extractMetadataFromContent(res.responseText);
                const metadata = {
                    iconUrl: rawMetadata['@icon'] || null,
                    bgfColorLT: rawMetadata['@bgf-colorLT'] || null,
                    bgfColorDT: rawMetadata['@bgf-colorDT'] || null,
                    bgfCompatible: rawMetadata['@bgf-compatible'] || null,
                    bgfCopyright: rawMetadata['@bgf-copyright'] || null,
                    bgfSocial: rawMetadata['@bgf-social'] || null,
                    ts: now
                };
                iconCache[normalizedPath] = metadata;
                await saveCache();
                if (isValidIconUrl(metadata.iconUrl)) {
                    targetElement.prepend(createIconElement(metadata.iconUrl, isHeader));
                }
                applyColorToBlockquote(metadata);
                if (isHeader) {
                    applyBfgFeatures(metadata);
                }
            },
            onerror: async function () {
                iconCache[normalizedPath] = { ts: now };
                await saveCache();
            }
        });
    }

    function handleScriptLink(linkEl) {
        if (linkEl._handled) return;
        linkEl._handled = true;
        const href = linkEl.getAttribute('href');
        if (!href || !href.startsWith('/')) return;
        try {
            const url = new URL(href, window.location.origin);
            const normalized = normalizeScriptPath(url.pathname);
            if (!normalized) return;
            setTimeout(() => processScript(normalized, linkEl, false), 0);
        } catch (e) {}
    }

    function handleMainHeaderH2() {
        const headers = document.querySelectorAll('header');
        for (const header of headers) {
            const h2 = header.querySelector('h2');
            const desc = header.querySelector('p.script-description');
            if (h2 && desc && !h2._handled) {
                h2._handled = true;
                const normalized = normalizeScriptPath(window.location.pathname);
                if (!normalized) return;
                setTimeout(() => processScript(normalized, h2, true), 0);
                break;
            }
        }
    }

    function processIconElements() {
        document.querySelectorAll('a.script-link:not([data-icon-processed])')
            .forEach(el => {
                el.setAttribute('data-icon-processed', '1');
                handleScriptLink(el);
            });
        handleMainHeaderH2();
    }

    // ================
    // #region GLOBAL
    // ================

    const translations = {
        'en': { langName: 'English', languageSettings: '🌐 Language', close: 'Close', titles: 'Headings', title_placeholder: 'Heading', bold: 'Bold', bold_placeholder: 'bold text', italic: 'Italic', italic_placeholder: 'italic text', underline: 'Underline', underline_placeholder: 'underlined text', strikethrough: 'Strikethrough', strikethrough_placeholder: 'strikethrough text', unordered_list: 'Unordered List', list_item_placeholder: 'Item', ordered_list: 'Ordered List', quote: 'Quote', quote_placeholder: 'Quote', inline_code: 'Inline Code', inline_code_placeholder: 'code', code_block: 'Code Block', code_block_placeholder: 'code here', horizontal_line: 'Horizontal Line', link: 'Link', prompt_insert_url: 'Enter the URL:', link_text_placeholder: 'link text', image: 'Image', prompt_insert_image_url: 'Enter the image URL (https):', table: 'Table', prompt_columns: 'Number of columns:', prompt_rows: 'Number of rows:', table_header_placeholder: 'Header', table_cell_placeholder: 'Cell', video: 'Video (YouTube/Bilibili)', prompt_insert_video_url: 'Enter the video URL (YouTube or Bilibili):', alert_invalid_video_url: 'Invalid or unsupported video URL.', subscript: 'Subscript', subscript_placeholder: 'sub', superscript: 'Superscript', superscript_placeholder: 'sup', highlight: 'Highlight', highlight_placeholder: 'highlighted', keyboard: 'Keyboard', keyboard_placeholder: 'Ctrl+C', abbreviation: 'Abbreviation', prompt_abbreviation_meaning: 'What does the abbreviation stand for?', abbreviation_placeholder: 'HTML', text_color: 'Text Color', colored_text_placeholder: 'colored text', background_color: 'Background Color', colored_background_placeholder: 'colored background', download: 'Download', notFound: 'Code not found!', scriptIdNotFound: 'Could not identify the script ID.', downloading: 'Downloading...', downloadError: 'An error occurred while downloading the script.', downloadTimeout: 'The script download timed out.', compatible_with: 'Compatible with', force_update: '🔄️ Force Update', force_update_alert: 'Cache cleared. The page will reload to fetch the updated data.' },

        'pt-BR': { langName: 'Português (BR)', languageSettings: '🌐 Idioma', close: 'Fechar', titles: 'Títulos', title_placeholder: 'Título', bold: 'Negrito', bold_placeholder: 'negrito', italic: 'Itálico', italic_placeholder: 'itálico', underline: 'Sublinhado', underline_placeholder: 'sublinhado', strikethrough: 'Riscado', strikethrough_placeholder: 'riscado', unordered_list: 'Lista não ordenada', list_item_placeholder: 'Item', ordered_list: 'Lista ordenada', quote: 'Citação', quote_placeholder: 'Citação', inline_code: 'Código Inline', inline_code_placeholder: 'código', code_block: 'Bloco de Código', code_block_placeholder: 'código aqui', horizontal_line: 'Linha Horizontal', link: 'Link', prompt_insert_url: 'Insira a URL:', link_text_placeholder: 'texto do link', image: 'Imagem', prompt_insert_image_url: 'Insira a URL da imagem (https):', table: 'Tabela', prompt_columns: 'Número de colunas:', prompt_rows: 'Número de linhas:', table_header_placeholder: 'Cabeçalho', table_cell_placeholder: 'Célula', video: 'Vídeo (YouTube/Bilibili)', prompt_insert_video_url: 'Insira a URL do vídeo (YouTube ou Bilibili):', alert_invalid_video_url: 'URL de vídeo inválida ou não suportada.', subscript: 'Subscrito', subscript_placeholder: 'sub', superscript: 'Sobrescrito', superscript_placeholder: 'sup', highlight: 'Marcação', highlight_placeholder: 'marcado', keyboard: 'Teclado', keyboard_placeholder: 'Ctrl+C', abbreviation: 'Abreviação', prompt_abbreviation_meaning: 'Qual o significado da abreviação?', abbreviation_placeholder: 'HTML', text_color: 'Cor do Texto', colored_text_placeholder: 'texto colorido', background_color: 'Cor de Fundo', colored_background_placeholder: 'fundo colorido', download: 'Baixar', notFound: 'Código não encontrado!', scriptIdNotFound: 'Não foi possível identificar o ID do script.', downloading: 'Baixando...', downloadError: 'Ocorreu um erro ao baixar o script.', downloadTimeout: 'O tempo para baixar o script esgotou.', compatible_with: 'Compatível com', force_update: '🔄️ Forçar Atualização', force_update_alert: 'O cache foi limpo. A página será recarregada para buscar os dados atualizados.' },

        'es': { langName: 'Español', languageSettings: '🌐 Idioma', close: 'Cerrar', titles: 'Títulos', title_placeholder: 'Título', bold: 'Negrita', bold_placeholder: 'texto en negrita', italic: 'Cursiva', italic_placeholder: 'texto en cursiva', underline: 'Subrayado', underline_placeholder: 'texto subrayado', strikethrough: 'Tachado', strikethrough_placeholder: 'texto tachado', unordered_list: 'Lista sin ordenar', list_item_placeholder: 'Elemento', ordered_list: 'Lista ordenada', quote: 'Cita', quote_placeholder: 'Cita', inline_code: 'Código en línea', inline_code_placeholder: 'código', code_block: 'Bloque de código', code_block_placeholder: 'código aquí', horizontal_line: 'Línea horizontal', link: 'Enlace', prompt_insert_url: 'Introduzca la URL:', link_text_placeholder: 'texto del enlace', image: 'Imagen', prompt_insert_image_url: 'Introduzca la URL de la imagen (https):', table: 'Tabla', prompt_columns: 'Número de columnas:', prompt_rows: 'Número de filas:', table_header_placeholder: 'Encabezado', table_cell_placeholder: 'Celda', video: 'Video (YouTube/Bilibili)', prompt_insert_video_url: 'Introduzca la URL del video (YouTube o Bilibili):', alert_invalid_video_url: 'URL de video no válida o no compatible.', subscript: 'Subíndice', subscript_placeholder: 'sub', superscript: 'Superíndice', superscript_placeholder: 'sup', highlight: 'Resaltado', highlight_placeholder: 'resaltado', keyboard: 'Teclado', keyboard_placeholder: 'Ctrl+C', abbreviation: 'Abreviatura', prompt_abbreviation_meaning: '¿Qué significa la abreviatura?', abbreviation_placeholder: 'HTML', text_color: 'Color del texto', colored_text_placeholder: 'texto coloreado', background_color: 'Color de fondo', colored_background_placeholder: 'fondo coloreado', download: 'Descargar', notFound: '¡Código no encontrado!', scriptIdNotFound: 'No se pudo identificar el ID del script.', downloading: 'Descargando...', downloadError: 'Ocurrió un error al descargar el script.', downloadTimeout: 'Se agotó el tiempo de espera para la descarga del script.', compatible_with: 'Compatible con', compatible_with: 'Compatible con', force_update: '🔄️ Forzar actualización', force_update_alert: 'La caché se limpió. La página se recargará para obtener los datos actualizados.' },

        'zh-CN': { langName: '简体中文', languageSettings: '🌐 语言', close: '关闭', titles: '标题', title_placeholder: '标题', bold: '粗体', bold_placeholder: '粗体文本', italic: '斜体', italic_placeholder: '斜体文本', underline: '下划线', underline_placeholder: '下划线文本', strikethrough: '删除线', strikethrough_placeholder: '删除线文本', unordered_list: '无序列表', list_item_placeholder: '项目', ordered_list: '有序列表', quote: '引用', quote_placeholder: '引用', inline_code: '行内代码', inline_code_placeholder: '代码', code_block: '代码块', code_block_placeholder: '在此处编写代码', horizontal_line: '水平线', link: '链接', prompt_insert_url: '请输入网址:', link_text_placeholder: '链接文本', image: '图片', prompt_insert_image_url: '请输入图片网址 (https):', table: '表格', prompt_columns: '列数:', prompt_rows: '行数:', table_header_placeholder: '标题', table_cell_placeholder: '单元格', video: '视频 (YouTube/Bilibili)', prompt_insert_video_url: '请输入视频网址 (YouTube or Bilibili):', alert_invalid_video_url: '无效或不支持的视频网址。', subscript: '下标', subscript_placeholder: '下标', superscript: '上标', superscript_placeholder: '上标', highlight: '标记', highlight_placeholder: '标记', keyboard: '键盘', keyboard_placeholder: 'Ctrl+C', abbreviation: '缩写', prompt_abbreviation_meaning: '缩写的含义是什么?', abbreviation_placeholder: 'HTML', text_color: '文字颜色', colored_text_placeholder: '彩色文本', background_color: '背景颜色', colored_background_placeholder: '彩色背景', download: '下载', notFound: '未找到代码!', scriptIdNotFound: '无法识别脚本 ID。', downloading: '下载中...', downloadError: '下载脚本时发生错误。', downloadTimeout: '脚本下载超时。', compatible_with: '兼容', force_update: '🔄️ 强制更新', force_update_alert: '缓存已清除。页面将重新加载以获取最新数据。' }
    };
    
    function capitalizeCompatItem(item) {
        return item.replace(/\b\w/g, char => char.toUpperCase());
    }

    let currentLang = 'en';
    let languageModal = null;
    const LANG_STORAGE_KEY = 'UserScriptLang';

    function getTranslation(key) {
        return translations[currentLang] ?.[key] || translations.en[key];
    }

    async function determineLanguage() {
        const savedLang = await GM_getValue(LANG_STORAGE_KEY);
        if (savedLang && translations[savedLang]) {
            currentLang = savedLang;
            return;
        }
        const browserLang = (navigator.language || navigator.userLanguage).toLowerCase();
        if (browserLang.startsWith('pt')) currentLang = 'pt-BR';
        else if (browserLang.startsWith('es')) currentLang = 'es';
        else if (browserLang.startsWith('zh')) currentLang = 'zh-CN';
        else currentLang = 'en';
    }

    function registerLanguageMenu() {
        GM_registerMenuCommand(getTranslation('languageSettings'), () => {
            showModal(languageModal);
        });
    }

    function registerForceUpdateMenu() {
        GM_registerMenuCommand(getTranslation('force_update'), forceUpdate);
    }

    const icons = {
        h: `<svg viewBox="0 0 16 16"><path d="M3.75 2a.75.75 0 0 1 .75.75V7h7V2.75a.75.75 0 0 1 1.5 0v10.5a.75.75 0 0 1-1.5 0V8.5h-7v4.75a.75.75 0 0 1-1.5 0V2.75A.75.75 0 0 1 3.75 2Z"></path></svg>`,
        bold: `<svg viewBox="0 0 16 16"><path d="M4 2h4.5a3.5 3.5 0 0 1 2.85 5.53A3.5 3.5 0 0 1 9.5 14H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1Zm1 7v3h4.5a1.5 1.5 0 0 0 0-3Zm3.5-2a1.5 1.5 0 0 0 0-3H5v3Z"></path></svg>`,
        italic: `<svg viewBox="0 0 16 16"><path d="M6 2.75A.75.75 0 0 1 6.75 2h6.5a.75.75 0 0 1 0 1.5h-2.505l-3.858 9H9.25a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1 0-1.5h2.505l3.858-9H6.75A.75.75 0 0 1 6 2.75Z"></path></svg>`,
        underline: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="currentColor" d="M11 1h2v6.5c0 2.485-2.239 4.5-5 4.5S3 9.985 3 7.5V1h2v6.5c0 .628.285 1.23.802 1.695C6.379 9.714 7.159 10 8 10s1.621-.286 2.198-.805C10.715 8.729 11 8.127 11 7.5V1zM3 13h10v2H3z"/></svg>`,
        strikethrough: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M952 474H569.9c-10-2-20.5-4-31.6-6c-15.9-2.9-22.2-4.1-30.8-5.8c-51.3-10-82.2-20-106.8-34.2c-35.1-20.5-52.2-48.3-52.2-85.1c0-37 15.2-67.7 44-89c28.4-21 68.8-32.1 116.8-32.1c54.8 0 97.1 14.4 125.8 42.8c14.6 14.4 25.3 32.1 31.8 52.6c1.3 4.1 2.8 10 4.3 17.8c.9 4.8 5.2 8.2 9.9 8.2h72.8c5.6 0 10.1-4.6 10.1-10.1v-1c-.7-6.8-1.3-12.1-2-16c-7.3-43.5-28-81.7-59.7-110.3c-44.4-40.5-109.7-61.8-188.7-61.8c-72.3 0-137.4 18.1-183.3 50.9c-25.6 18.4-45.4 41.2-58.6 67.7c-13.5 27.1-20.3 58.4-20.3 92.9c0 29.5 5.7 54.5 17.3 76.5c8.3 15.7 19.6 29.5 34.1 42H72c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h433.2c2.1.4 3.9.8 5.9 1.2c30.9 6.2 49.5 10.4 66.6 15.2c23 6.5 40.6 13.3 55.2 21.5c35.8 20.2 53.3 49.2 53.3 89c0 35.3-15.5 66.8-43.6 88.8c-30.5 23.9-75.6 36.4-130.5 36.4c-43.7 0-80.7-8.5-110.2-25c-29.1-16.3-49.1-39.8-59.7-69.5c-.8-2.2-1.7-5.2-2.7-9c-1.2-4.4-5.3-7.5-9.7-7.5h-79.7c-5.6 0-10.1 4.6-10.1 10.1v1c.2 2.3.4 4.2.6 5.7c6.5 48.8 30.3 88.8 70.7 118.8c47.1 34.8 113.4 53.2 191.8 53.2c84.2 0 154.8-19.8 204.2-57.3c25-18.9 44.2-42.2 57.1-69c13-27.1 19.7-57.9 19.7-91.5c0-31.8-5.8-58.4-17.8-81.4c-5.8-11.2-13.1-21.5-21.8-30.8H952c4.4 0 8-3.6 8-8v-60a8 8 0 0 0-8-7.9z"/></svg>`,
        link: `<svg viewBox="0 0 16 16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .75.75 0 0 1 1.06-1.06 2 2 0 0 0 2.83 0l2.5-2.5a2 2 0 0 0-2.83-2.83l-1.25 1.25a.75.75 0 0 1-1.06-1.06Zm-4.69 9.64a2 2 0 0 0 2.83 0l1.25-1.25a.75.75 0 0 1 1.06 1.06l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .75.75 0 0 1-1.06 1.06 2 2 0 0 0-2.83 0l-2.5 2.5a2 2 0 0 0 0 2.83Z"></path></svg>`,
        quote: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 304 384"><path fill="currentColor" d="m21 299l43-86H0V85h128v128l-43 86H21zm171 0l43-86h-64V85h128v128l-43 86h-64z"/></svg>`,
        code: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="m.586 12l4.95-4.95L6.95 8.464L3.414 12l3.536 3.536l-1.414 1.414L.586 12Zm8.201 8.728l4.486-17.94l1.94.485l-4.485 17.94l-1.94-.485Zm8.263-5.192L20.586 12L17.05 8.464l1.415-1.414l4.95 4.95l-4.95 4.95l-1.415-1.414Z"/></svg>`,
        code_block: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path id="oouiCode0" fill="currentColor" d="M1 10.08V8.92h1.15c1.15 0 1.15 0 1.15-1.15V5a7.42 7.42 0 0 1 .09-1.3a2 2 0 0 1 .3-.7a1.84 1.84 0 0 1 .93-.68A6.44 6.44 0 0 1 6.74 2h1.18v1.15h-.86A1.32 1.32 0 0 0 6 3.62a1.71 1.71 0 0 0-.36 1.23V7a3.22 3.22 0 0 1-.28 1.72a2 2 0 0 1-1.26.77a2.15 2.15 0 0 1 1.26.79A3.26 3.26 0 0 1 5.62 12v3.15A1.67 1.67 0 0 0 6 16.37a1.31 1.31 0 0 0 1.08.47h.87V18H6.74a6.3 6.3 0 0 1-2.12-.29a1.82 1.82 0 0 1-.93-.71a1.94 1.94 0 0 1-.3-.72A7.46 7.46 0 0 1 3.31 15v-3.77c0-1.15 0-1.15-1.15-1.15zm18 0V8.92h-1.15c-1.15 0-1.15 0-1.15-1.15V5a7.42 7.42 0 0 0-.08-1.32a2 2 0 0 0-.3-.73a1.84 1.84 0 0 0-.93-.68A6.44 6.44 0 0 0 13.26 2h-1.18v1.15h.87a1.32 1.32 0 0 1 1.05.47a1.71 1.71 0 0 1 .36 1.23V7a3.22 3.22 0 0 0 .28 1.72a2 2 0 0 0 1.26.77a2.15 2.15 0 0 0-1.26.79a3.26 3.26 0 0 0-.26 1.72v3.15a1.67 1.67 0 0 1-.38 1.22a1.31 1.31 0 0 1-1.08.47h-.87V18h1.19a6.3 6.3 0 0 0 2.12-.29a1.82 1.82 0 0 0 .93-.68a1.94 1.94 0 0 0 .3-.72a7.46 7.46 0 0 0 .1-1.31v-3.77c0-1.15 0-1.15 1.15-1.15z"/><use href="#oouiCode0" transform="matrix(-1 0 0 1 20 0)"/></svg>`,
        ul: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1025 1024"><path fill="currentColor" d="M960.356 1024h-512q-27 0-45.5-19t-18.5-45V832q0-26 18.5-45t45.5-19h512q26 0 45 19t19 45v128q0 27-19 45.5t-45 18.5zm0-384h-512q-27 0-45.5-18.5t-18.5-45.5V448q0-27 18.5-45.5t45.5-18.5h512q26 0 45 18.5t19 45.5v128q0 27-19 45.5t-45 18.5zm0-384h-512q-27 0-45.5-19t-18.5-45V64q0-27 18.5-45.5t45.5-18.5h512q26 0 45 18.5t19 45.5v128q0 26-19 45t-45 19zm-768 768h-128q-26 0-45-19t-19-45V832q0-26 19-45t45-19h128q26 0 45 19t19 45v128q0 27-18.5 45.5t-45.5 18.5zm0-384h-128q-26 0-45-18.5t-19-45.5V448q0-27 19-45.5t45-18.5h128q26 0 45 18.5t19 45.5v128q0 27-18.5 45.5t-45.5 18.5zm0-384h-128q-26 0-45-19t-19-45V64q0-27 19-45.5t45-18.5h128q26 0 45 18.5t19 45.5v128q0 26-18.5 45t-45.5 19z"/></svg>`,
        ol: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="currentColor" d="M3.684 1.01c.193.045.33.21.33.402v3.294a.42.42 0 0 1-.428.412a.42.42 0 0 1-.428-.412V2.58a3.11 3.11 0 0 1-.664.435a.436.436 0 0 1-.574-.184a.405.405 0 0 1 .192-.552c.353-.17.629-.432.82-.661a2.884 2.884 0 0 0 .27-.388a.44.44 0 0 1 .482-.22Zm-1.53 6.046a.401.401 0 0 1 0-.582l.002-.001V6.47l.004-.002l.008-.008a1.12 1.12 0 0 1 .103-.084a2.2 2.2 0 0 1 1.313-.435h.007c.32.004.668.084.947.283c.295.21.485.536.485.951c0 .452-.207.767-.488.992c-.214.173-.49.303-.714.409c-.036.016-.07.033-.103.049c-.267.128-.468.24-.61.39a.763.763 0 0 0-.147.22h1.635a.42.42 0 0 1 .427.411a.42.42 0 0 1-.428.412H2.457a.42.42 0 0 1-.428-.412c0-.51.17-.893.446-1.184c.259-.275.592-.445.86-.574c.043-.02.085-.04.124-.06c.231-.11.4-.19.529-.293c.12-.097.18-.193.18-.36c0-.148-.057-.23-.14-.289a.816.816 0 0 0-.448-.122a1.32 1.32 0 0 0-.818.289l-.005.005a.44.44 0 0 1-.602-.003Zm.94 5.885a.42.42 0 0 1 .427-.412c.294 0 .456-.08.537-.15a.303.303 0 0 0 .11-.246c-.006-.16-.158-.427-.647-.427c-.352 0-.535.084-.618.137a.349.349 0 0 0-.076.062l-.003.004a.435.435 0 0 0 .01-.018v.001l-.002.002l-.002.004l-.003.006l-.005.008l.002-.003a.436.436 0 0 1-.563.165a.405.405 0 0 1-.191-.552v-.002l.002-.003l.003-.006l.008-.013a.71.71 0 0 1 .087-.12c.058-.067.142-.146.259-.22c.238-.153.59-.276 1.092-.276c.88 0 1.477.556 1.502 1.22c.012.303-.1.606-.339.84c.238.232.351.535.34.838c-.026.664-.622 1.22-1.503 1.22c-.502 0-.854-.122-1.092-.275a1.19 1.19 0 0 1-.326-.308a.71.71 0 0 1-.02-.033l-.008-.013l-.003-.005l-.001-.003v-.001l-.001-.001a.405.405 0 0 1 .19-.553a.436.436 0 0 1 .564.165l.003.004c.01.01.033.035.076.063c.083.053.266.137.618.137c.489 0 .641-.268.648-.428a.303.303 0 0 0-.11-.245c-.082-.072-.244-.151-.538-.151a.42.42 0 0 1-.427-.412ZM7.75 3a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5h-5.5Zm0 4a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5h-5.5Zm0 4a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5h-5.5Z"/></svg>`,
        image: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 42 42"><path fill="currentColor" d="M.5 7.5v27c0 2.52.51 3 3 3h34c2.471 0 3-.46 3-3v-27c0-2.46-.471-3-3-3h-34c-2.48 0-3 .43-3 3zm35.29 23H5.23c3.34-4.87 9.279-12.99 10.789-12.99c1.461 0 6.42 6.561 8.661 8.87c0 0 2.881-3.851 4.391-3.851c1.538 0 6.669 7.931 6.719 7.971zm-8.979-17c0-2.04 1.649-3.689 3.689-3.689s3.689 1.649 3.689 3.689s-1.649 3.689-3.689 3.689s-3.689-1.649-3.689-3.689z"/></svg>`,
        video: `<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 1024 768"><path fill="currentColor" d="M928 736q-222 32-416 32q-86 0-190-8t-165-16l-61-8q-27-5-47.5-37.5t-30-78.5t-14-86T0 461V307Q0 52 96 32Q318 0 512 0q86 0 190 8t165 16l61 8q29 4 49.5 36.5T1007 148t13 86t4 73v154q0 36-3 73t-12 85t-30 80t-51 37zM693 359L431 199q-11-10-29-5.5T384 208v352q0 11 18 15t29-6l262-160q11-10 11-25t-11-25z"/></svg>`,
        subscript: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M32 64C14.3 64 0 78.3 0 96s14.3 32 32 32h15.3l89.6 128l-89.6 128H32c-17.7 0-32 14.3-32 32s14.3 32 32 32h32c10.4 0 20.2-5.1 26.2-13.6L176 311.8l85.8 122.6c6 8.6 15.8 13.6 26.2 13.6h32c17.7 0 32-14.3 32-32s-14.3-32-32-32h-15.3l-89.6-128l89.6-128H320c17.7 0 32-14.3 32-32s-14.3-32-32-32h-32c-10.4 0-20.2 5.1-26.2 13.6L176 200.2L90.2 77.6C84.2 69.1 74.4 64 64 64H32zm448 256c0-11.1-5.7-21.4-15.2-27.2s-21.2-6.4-31.1-1.4l-32 16c-15.8 7.9-22.2 27.1-14.3 42.9C393 361.5 404.3 368 416 368v80c-17.7 0-32 14.3-32 32s14.3 32 32 32h64c17.7 0 32-14.3 32-32s-14.3-32-32-32V320z"/></svg>`,
        superscript: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M480 32c0-11.1-5.7-21.4-15.2-27.2s-21.2-6.4-31.1-1.4l-32 16c-15.8 7.9-22.2 27.1-14.3 42.9C393 73.5 404.3 80 416 80v80c-17.7 0-32 14.3-32 32s14.3 32 32 32h64c17.7 0 32-14.3 32-32s-14.3-32-32-32V32zM32 64C14.3 64 0 78.3 0 96s14.3 32 32 32h15.3l89.6 128l-89.6 128H32c-17.7 0-32 14.3-32 32s14.3 32 32 32h32c10.4 0 20.2-5.1 26.2-13.6L176 311.8l85.8 122.6c6 8.6 15.8 13.6 26.2 13.6h32c17.7 0 32-14.3 32-32s-14.3-32-32-32h-15.3l-89.6-128l89.6-128H320c17.7 0 32-14.3 32-32s-14.3-32-32-32h-32c-10.4 0-20.2 5.1-26.2 13.6L176 200.2L90.2 77.6C84.2 69.1 74.4 64 64 64H32z"/></svg>`,
        highlight: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="currentColor" d="M16.5 3v4a.5.5 0 0 1-.5.5H4a.5.5 0 0 1-.5-.5V3h13Zm-10 7.5v7l6.447-3.106a1 1 0 0 0 .553-.894v-3h-7Z"/></svg>`,
        abbreviation: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192 512"><path fill="currentColor" d="M20 424.229h20V279.771H20c-11.046 0-20-8.954-20-20V212c0-11.046 8.954-20 20-20h112c11.046 0 20 8.954 20 20v212.229h20c11.046 0 20 8.954 20 20V492c0 11.046-8.954 20-20 20H20c-11.046 0-20-8.954-20-20v-47.771c0-11.046 8.954-20 20-20zM96 0C56.235 0 24 32.235 24 72s32.235 72 72 72s72-32.235 72-72S135.764 0 96 0z"/></svg>`,
        keyboard: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M3 4h10a1.5 1.5 0 0 1 1.5 1.5v5A1.5 1.5 0 0 1 13 12H3a1.5 1.5 0 0 1-1.5-1.5v-5A1.5 1.5 0 0 1 3 4M0 5.5a3 3 0 0 1 3-3h10a3 3 0 0 1 3 3v5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3zm6.25 3.25a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5zM4.5 6.5a1 1 0 1 1-2 0a1 1 0 0 1 2 0m2 1a1 1 0 1 0 0-2a1 1 0 0 0 0 2m4-1a1 1 0 1 1-2 0a1 1 0 0 1 2 0m2 1a1 1 0 1 0 0-2a1 1 0 0 0 0 2m-8 2a1 1 0 1 1-2 0a1 1 0 0 1 2 0m8 1a1 1 0 1 0 0-2a1 1 0 0 0 0 2" clip-rule="evenodd"/></svg>`,
        text_color: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12"><path fill="currentColor" d="M12 1v2a1 1 0 0 1-2 0V2H7v8h1a1 1 0 0 1 0 2H4a1 1 0 0 1 0-2h1V2H2v1a1 1 0 1 1-2 0V1a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1Z"/></svg>`,
        background_color: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M4 20q-.825 0-1.413-.588T2 18V6q0-.825.588-1.413T4 4h16q.825 0 1.413.588T22 6v12q0 .825-.588 1.413T20 20H4Zm2-3h12q.425 0 .713-.288T19 16q0-.425-.288-.713T18 15H6q-.425 0-.713.288T5 16q0 .425.288.713T6 17Zm0-4h12q.425 0 .713-.288T19 12q0-.425-.288-.713T18 11H6q-.425 0-.713.288T5 12q0 .425.288.713T6 13Zm0-4h8q.425 0 .713-.288T15 8q0-.425-.288-.713T14 7H6q-.425 0-.713.288T5 8q0 .425.288.713T6 9Z"/></svg>`,
        table: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="currentColor" d="M2 2a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2zm0 4h7v4H2zm0 10v-4h7v4zm16 0h-7v-4h7zm0-6h-7V6h7z"/></svg>`,
        hr: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="currentColor" d="M2 7.75A.75.75 0 0 1 2.75 7h10.5a.75.75 0 0 1 0 1.5H2.75A.75.75 0 0 1 2 7.75Z"/></svg>`,
        brave: `<svg viewBox="0 0 2770 2770" xmlns="http://www.w3.org/2000/svg" fill="#fff"><linearGradient id="a" y1="51%" y2="51%"><stop offset=".4" stop-color="#f50"/><stop offset=".6" stop-color="#ff2000"/></linearGradient><linearGradient id="b" x1="2%" y1="51%" y2="51%"><stop offset="0" stop-color="#ff452a"/><stop offset="1" stop-color="#ff2000"/></linearGradient><path fill="url(#a)" d="m2395 723 60-147-170-176c-92-92-288-38-288-38l-222-252H992L769 363s-196-53-288 37L311 575l60 147-75 218 250 953c52 204 87 283 234 387l457 310c44 27 98 74 147 74s103-47 147-74l457-310c147-104 182-183 234-387l250-953z"/><path d="M1935 524s287 347 287 420c0 75-36 94-72 133l-215 230c-20 20-63 54-38 113 25 60 60 134 20 210-40 77-110 128-155 120a820 820 0 0 1-190-90c-38-25-160-126-160-165s126-110 150-124c23-16 130-78 132-102s2-30-30-90-88-140-80-192c10-52 100-80 167-105l207-78c16-8 12-15-36-20-48-4-183-22-244-5s-163 43-173 57c-8 14-16 14-7 62l58 315c4 40 12 67-30 77-44 10-117 27-142 27s-99-17-142-27-35-37-30-77c4-40 48-268 57-315 10-48 1-48-7-62-10-14-113-40-174-57-60-17-196 1-244 6-48 4-52 10-36 20l207 77c66 25 158 53 167 105 10 53-47 132-80 192s-32 66-30 90 110 86 132 102c24 15 150 85 150 124s-119 140-159 165a820 820 0 0 1-190 90c-45 8-115-43-156-120-40-76-4-150 20-210 25-60-17-92-38-113l-215-230c-35-37-71-57-71-131s287-420 287-420l273 44c32 0 103-27 168-50 65-20 110-22 110-22s44 0 110 22 136 50 168 50c33 0 275-47 275-47zm-215 1328c18 10 7 32-10 44l-254 198c-20 20-52 50-73 50s-52-30-73-50a13200 13200 0 0 0-255-198c-16-12-27-33-10-44l150-80a870 870 0 0 1 188-73c15 0 110 34 187 73z"/><path fill="url(#b)" d="m1999 363-224-253H992L769 363s-196-53-288 37c0 0 260-23 350 123l276 47c32 0 103-27 168-50 65-20 110-22 110-22s44 0 110 22 136 50 168 50c33 0 275-47 275-47 90-146 350-123 350-123-92-92-288-38-288-38"/></svg>`,
        mobile: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 413.137 413.137" xml:space="preserve"><path d="M311.358 136.395H101.779a8.44 8.44 0 0 0-8.441 8.441v175.749a8.44 8.44 0 0 0 8.441 8.441h37.363v59.228c0 13.742 11.14 24.883 24.883 24.883s24.883-11.14 24.883-24.883v-59.228h34.803v59.228c0 13.742 11.14 24.883 24.883 24.883s24.883-11.14 24.883-24.883v-59.228h37.882a8.44 8.44 0 0 0 8.441-8.441V144.836a8.44 8.44 0 0 0-8.442-8.441m-253.502-.041c-13.742 0-24.883 11.14-24.883 24.883v101.065c0 13.742 11.14 24.883 24.883 24.883s24.883-11.14 24.883-24.883V161.237c-.001-13.742-11.141-24.883-24.883-24.883m297.425 0c-13.742 0-24.883 11.14-24.883 24.883v101.065c0 13.742 11.14 24.883 24.883 24.883s24.883-11.14 24.883-24.883V161.237c0-13.742-11.14-24.883-24.883-24.883m-251.806-12.285h205.692c5.366 0 9.368-4.943 8.266-10.195-6.804-32.428-27.45-59.756-55.465-75.543l17.584-31.727a4.447 4.447 0 0 0-7.78-4.311l-17.717 31.966c-14.511-6.734-30.683-10.495-47.734-10.495s-33.224 3.761-47.735 10.495L140.869 2.292a4.447 4.447 0 0 0-7.779 4.311l17.584 31.727c-28.015 15.788-48.661 43.115-55.465 75.544-1.103 5.252 2.899 10.195 8.266 10.195m164.222-47.283c0 5.282-4.282 9.565-9.565 9.565s-9.565-4.282-9.565-9.565 4.282-9.565 9.565-9.565 9.565 4.283 9.565 9.565m-113.189-9.565c5.282 0 9.565 4.282 9.565 9.565s-4.282 9.565-9.565 9.565-9.565-4.282-9.565-9.565 4.282-9.565 9.565-9.565" fill="#3ddc84"/></svg>`,
        instagram: `<svg viewBox="0 0 3364.7 3364.7" xmlns="http://www.w3.org/2000/svg"><defs><radialGradient id="a" cx="217.8" cy="3291" r="4271.9" gradientUnits="userSpaceOnUse"><stop offset=".1" stop-color="#fa8f21"/><stop offset=".8" stop-color="#d82d7e"/></radialGradient><radialGradient id="b" cx="2330.6" cy="3182.9" r="3759.3" gradientUnits="userSpaceOnUse"><stop offset=".6" stop-color="#8c3aaa" stop-opacity="0"/><stop offset="1" stop-color="#8c3aaa"/></radialGradient></defs><path d="M853.2 3352.8c-200.1-9.1-308.8-42.4-381.1-70.6-95.8-37.3-164.1-81.7-236-153.5s-116.4-140.1-153.5-235.9c-28.2-72.3-61.5-181-70.6-381.1-10-216.3-12-281.2-12-829.2s2.2-612.8 11.9-829.3C21 653.1 54.5 544.6 82.5 472.1A640 640 0 0 1 236 236 634 634 0 0 1 472 82.5C544.3 54.3 653 21 853.1 11.9 1069.5 2 1134.5 0 1682.3 0c548 0 612.8 2.2 829.3 11.9 200.1 9.1 308.6 42.6 381.1 70.6 95.8 37.1 164.1 81.7 236 153.5s116.2 140.2 153.5 236c28.2 72.3 61.5 181 70.6 381.1 9.9 216.5 11.9 281.3 11.9 829.3 0 547.8-2 612.8-11.9 829.3-9.1 200.1-42.6 308.8-70.6 381.1-37.3 95.8-81.7 164.1-153.5 235.9s-140.2 116.2-236 153.5c-72.3 28.2-181 61.5-381.1 70.6-216.3 9.9-281.3 11.9-829.3 11.9-547.8 0-612.8-1.9-829.1-11.9" fill="url(#a)"/><path d="M853.2 3352.8c-200.1-9.1-308.8-42.4-381.1-70.6-95.8-37.3-164.1-81.7-236-153.5s-116.4-140.1-153.5-235.9c-28.2-72.3-61.5-181-70.6-381.1-10-216.3-12-281.2-12-829.2s2.2-612.8 11.9-829.3C21 653.1 54.5 544.6 82.5 472.1A640 640 0 0 1 236 236 634 634 0 0 1 472 82.5C544.3 54.3 653 21 853.1 11.9 1069.5 2 1134.5 0 1682.3 0c548 0 612.8 2.2 829.3 11.9 200.1 9.1 308.6 42.6 381.1 70.6 95.8 37.1 164.1 81.7 236 153.5s116.2 140.2 153.5 236c28.2 72.3 61.5 181 70.6 381.1 9.9 216.5 11.9 281.3 11.9 829.3 0 547.8-2 612.8-11.9 829.3-9.1 200.1-42.6 308.8-70.6 381.1-37.3 95.8-81.7 164.1-153.5 235.9s-140.2 116.2-236 153.5c-72.3 28.2-181 61.5-381.1 70.6-216.3 9.9-281.3 11.9-829.3 11.9-547.8 0-612.8-1.9-829.1-11.9" fill="url(#b)"/><path d="M1269.3 1689.5a416.6 416.6 0 1 1 833.2 0 416.6 416.6 0 0 1-833.3 0m-225.2 0a641.8 641.8 0 1 0 1283.7 0 641.8 641.8 0 0 0-1283.7 0m1159.1-667.3a150 150 0 1 0 150-150 150 150 0 0 0-150 150M1181 2707c-122-5.5-188.2-25.8-232.2-43-58.3-22.7-100-49.8-143.8-93.5s-70.8-85.3-93.5-143.7c-17.1-44-37.4-110.2-43-232.1-6-131.8-7.2-171.3-7.2-505.2s1.3-373.2 7.2-505.1c5.6-121.9 26-188 43-232.1 22.8-58.4 49.8-100 93.5-143.8s85.4-70.9 143.8-93.5c44-17.2 110.3-37.5 232.1-43 131.8-6 171.4-7.3 505-7.3s373.3 1.3 505.2 7.3c121.9 5.6 188 26 232.1 43 58.4 22.6 100 49.8 143.8 93.5s70.8 85.4 93.5 143.8c17.2 44 37.5 110.2 43 232.1 6 131.9 7.3 171.3 7.3 505.2s-1.2 373.2-7.3 505.1c-5.5 121.9-26 188.1-43 232.1-22.7 58.4-49.8 100-93.5 143.7s-85.4 70.8-143.8 93.5c-44 17.2-110.2 37.5-232.1 43-131.8 6-171.3 7.3-505.1 7.3s-373.3-1.2-505-7.3m-10.4-2260c-133 6.2-224 27.3-303.4 58.2-82.2 31.9-151.9 74.7-221.4 144.1S533.4 788.5 501.5 870.8c-31 79.4-52 170.3-58 303.4-6.2 133.3-7.6 175.9-7.6 515.3s1.4 382 7.5 515.4c6 133 27.2 224 58 303.4 32 82.2 74.7 152 144.3 221.4S784.8 2842 867 2874c79.6 30.9 170.3 52 303.4 58 133.4 6.1 175.9 7.6 515.4 7.6s382-1.4 515.3-7.6c133-6 224-27.1 303.4-58 82.2-32 151.9-74.7 221.4-144.2s112.2-139.2 144.2-221.4c31-79.5 52.1-170.4 58-303.4 6.1-133.4 7.5-176 7.5-515.4s-1.4-382-7.4-515.3c-6-133.1-27.2-224-58-303.4-32-82.2-74.8-151.9-144.3-221.5s-139.2-112.2-221.3-144.1c-79.5-31-170.4-52.2-303.4-58.1-133.3-6.1-175.9-7.6-515.3-7.6s-382.1 1.4-515.4 7.6" fill="#fff"/></svg>`,
        facebook: `<svg xmlns="http://www.w3.org/2000/svg" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd" viewBox="0 0 512 512"><path fill="#1877f2" d="M232.5-.5h46q134.4 16.3 202.5 133a271 271 0 0 1 30.5 100v46q-16.3 134.4-133 202.5-39 21-83 27.5v-179h60l11-74h-71q-.3-28 .5-56a35 35 0 0 1 27.5-30.5q23-2.1 46-1.5 1-32.1-2-63.5a383 383 0 0 0-69-4q-62.1 6.6-79.5 66.5-2.1 9-3 18-.8 35.5-.5 71h-65v74h65v179q-138.3-25-196.5-153a284 284 0 0 1-19.5-77v-46Q15.8 98.1 132.5 30a271 271 0 0 1 100-30.5"/><path fill="#fefefe" d="m295.5 508.5-18 3h-44l-18-3v-179h-65v-74h65q-.3-35.5.5-71 .9-9 3-18 17.4-60 79.5-66.5 34.7-1 69 4 3 31.4 2 63.5-23-.6-46 1.5a35 35 0 0 0-27.5 30.5q-.8 28-.5 56h71l-11 74h-60z"/></svg>`,
        x: `<svg xmlns="http://www.w3.org/2000/svg" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd" viewBox="0 0 512 512"><path d="M44.5-.5h422q36 9 45 45v422q-9 36-45 45h-422q-36-9-45-45v-422q9-36 45-45"/><path fill="#747474" d="M387.5 77.5q15.3-2 31 0-.2 1-1 1-14.7-1.5-30-1"/><path fill="#fbfbfb" d="M387.5 77.5q15.3-.5 30 1-64.2 74.5-128 149.5 69.5 103 140 205-52 1-104 0-47.1-69-94.5-137.5-59.9 68.3-118.5 137.5-15.5 1-31 0 68.1-78.5 135-158-67.6-98.6-135-197.5 52-2 104 0 44.4 65.2 89.5 130 56.7-64.8 112.5-130"/><path fill="#020202" d="M123.5 101.5a370 370 0 0 1 47-.5q109 154.8 217 310-23.5 1-47 0z"/></svg>`,
        youtube: `<svg xmlns="http://www.w3.org/2000/svg" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd" viewBox="0 0 512 512"><path fill="#e60000" d="M200.5-.5h110q59 2.7 118 9.5A95 95 0 0 1 501 77.5q4 26.3 6 53a6068 6068 0 0 1 4.5 70v110q-2.7 59-9.5 118a95 95 0 0 1-73.5 73.5q-59 6.8-118 9.5h-110a1726 1726 0 0 1-118-9.5A95 95 0 0 1 10 433.5q-8-61-10.5-122v-112l4.5-69q2-26.7 6-53A95 95 0 0 1 82.5 9q59-6.8 118-9.5"/><path fill="#fffefe" d="M232.5 138.5q64.5 0 129 5.5a67 67 0 0 1 40.5 22.5q3.8 5.5 6 12 15 77 0 154a53 53 0 0 1-29.5 29.5 75 75 0 0 1-21 5q-99 10-198 1-30.3-1-50.5-23.5a51 51 0 0 1-6-12q-15-77 0-154 12.1-27.2 41.5-33.5 44-5.4 88-6.5"/><path fill="#e60301" d="M217.5 194.5q49.6 30 99 61-49.1 30.7-98.5 61-.8-61-.5-122"/></svg>`,
        bilibili: `<svg xmlns="http://www.w3.org/2000/svg" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd" viewBox="0 0 512 512"><path fill="#1d88e3" d="M511.5 190.5v208q-9.5 66.5-74 86a16750 16750 0 0 1-364 0Q9 465-.5 398.5v-209q10.2-67.4 76-85.5 24-1.8 48-2L92 70.5q-7.8-13-5-28a35 35 0 0 1 21.5-23 37 37 0 0 1 31 5.5q38.4 37.6 75 76.5 41 2 82 0a2625 2625 0 0 1 74-75.5Q402 6.2 422 37.5q6.3 18-4 34L387.5 102q54.6-8.2 95.5 27.5 24.8 25.6 28.5 61"/><path fill="#509de8" d="M420.5 167.5h-329q.1-.9 1-1.5 163-1 326 0 1.5.5 2 1.5"/><path fill="#fefefe" d="M91.5 167.5h329a35 35 0 0 1 25.5 24q1 103.5 0 207-4.5 15-18.5 21-2.8-.4-4 2h-2q-165 .3-330-.5-4.5-1-9-1.5a37 37 0 0 1-18-24q-.5-102.6 1-205a30 30 0 0 1 26-23"/><path fill="#77b7ed" d="M65.5 190.5q-1.5 102.4-1 205-1.7-101.3-.5-203 .4-1.4 1.5-2"/><path fill="#a5cff3" d="M151.5 231.5a31 31 0 0 1 8-1q6-.3 11 2-9.4-1.2-19-1"/><path fill="#2189e3" d="M151.5 231.5q9.6-.2 19 1a34 34 0 0 1 20.5 21q.8 23.5.5 47a7 7 0 0 0-2 6q-9 19-30 20-8.2.5-15-4-.7-2-3-2a34 34 0 0 1-13.5-23q-1-20.5 0-41 .6-2.6 1.5-5 2-.7 2-3 6.5-13 20-17m170 75q.4-3.6-2-6-.3-22 .5-44 9.6-32.2 42.5-23.5a32 32 0 0 1 20.5 24.5 400 400 0 0 1 0 40q-6.6 31.2-38.5 28.5a33 33 0 0 1-23-19.5"/><path fill="#84bcef" d="M131.5 248.5q0 2.3-2 3 0-2.2 2-3"/><path fill="#bfdcf6" d="M191.5 300.5q.3 3.6-2 6-.3-3.6 2-6"/><path fill="#bddbf6" d="M319.5 300.5a7 7 0 0 1 2 6 7 7 0 0 1-2-6"/><path fill="#88beef" d="M141.5 320.5q2.3 0 3 2-2.2 0-3-2"/><path fill="#86bcef" d="M427.5 419.5a6 6 0 0 1-4 2q1.2-2.4 4-2"/><path fill="#b3d6f5" d="M82.5 419.5q4.5.5 9 1.5 165 .8 330 .5-166.2 1.8-333 .5-3.3-.9-6-2.5"/></svg>`,
        tiktok: `<svg viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#fff" stroke-width=".48"><path d="M8.451 19.793c.156-1.294.687-2.019 1.687-2.761 1.43-1.006 3.218-.437 3.218-.437V13.22q.654-.017 1.3.077v4.343s-1.788-.569-3.219.438c-.999.742-1.53 1.467-1.686 2.76-.005.703.126 1.621.734 2.416a6 6 0 0 1-.46-.264c-1.337-.898-1.58-2.245-1.574-3.197ZM22.035 6.979c-.984-1.079-1.356-2.168-1.49-2.933h1.237s-.247 2.006 1.553 3.979l.025.026a7 7 0 0 1-1.325-1.072ZM28 10.037v4.256s-1.58-.062-2.75-.36c-1.632-.415-2.681-1.053-2.681-1.053s-.725-.456-.784-.487v8.789c0 .49-.134 1.711-.543 2.73-.533 1.334-1.356 2.21-1.508 2.388 0 0-1 1.183-2.767 1.98-1.592.719-2.99.7-3.407.719 0 0-2.417.095-4.59-1.318a9 9 0 0 1-1.312-1.053l.011.008c2.175 1.413 4.59 1.317 4.59 1.317.419-.018 1.817 0 3.408-.719 1.765-.797 2.767-1.98 2.767-1.98.15-.179.977-1.054 1.508-2.388.408-1.019.543-2.241.543-2.73v-8.788c.059.032.783.487.783.487s1.05.638 2.683 1.054c1.17.297 2.749.36 2.749.36V9.912c.54.121 1.001.154 1.3.124Z" fill="#EE1D52"/><path d="M26.7 9.913v3.334s-1.579-.062-2.748-.36c-1.633-.415-2.683-1.053-2.683-1.053s-.725-.455-.783-.488v8.79c0 .49-.134 1.712-.543 2.731-.533 1.334-1.356 2.21-1.508 2.388 0 0-1.001 1.183-2.767 1.98-1.591.719-2.99.7-3.408.719 0 0-2.415.096-4.59-1.317l-.01-.008a8 8 0 0 1-.648-.703c-.694-.846-1.12-1.847-1.227-2.133v-.003c-.172-.496-.533-1.688-.484-2.842.088-2.036.804-3.285.993-3.599a8.6 8.6 0 0 1 1.928-2.257 8.1 8.1 0 0 1 2.291-1.3 8 8 0 0 1 2.844-.572v3.375s-1.788-.567-3.218.437c-1 .742-1.53 1.467-1.687 2.76-.007.953.237 2.3 1.573 3.199q.235.148.46.263a3.5 3.5 0 0 0 .84.783c1.306.826 2.4.884 3.799.347.932-.359 1.635-1.167 1.96-2.063.205-.56.202-1.123.202-1.706V4.046h3.256c.134.765.506 1.854 1.49 2.933.396.407.84.767 1.325 1.072.144.149.876.881 1.816 1.331.487.233 1 .41 1.528.531Z" fill="#000"/><path d="M4.49 22.757v.002l.08.22a6 6 0 0 1-.08-.222Z" fill="#69C9D0"/><path d="M10.513 13.792a8.1 8.1 0 0 0-2.291 1.3 8.6 8.6 0 0 0-1.927 2.262c-.19.312-.906 1.563-.993 3.599-.05 1.154.312 2.345.484 2.841v.004c.108.283.532 1.284 1.226 2.132q.303.37.647.703a8.9 8.9 0 0 1-1.947-1.75c-.688-.838-1.112-1.828-1.223-2.12v-.01c-.172-.496-.535-1.688-.484-2.843.087-2.036.803-3.286.993-3.6a8.5 8.5 0 0 1 1.927-2.261 8.1 8.1 0 0 1 2.291-1.3 8 8 0 0 1 1.616-.456 8.4 8.4 0 0 1 2.527-.035v.962a8 8 0 0 0-2.846.572Z" fill="#69C9D0"/><path d="M20.544 4.046h-3.256v16.57c0 .582 0 1.144-.202 1.705-.328.896-1.028 1.704-1.96 2.063-1.4.539-2.493.48-3.798-.347a3.5 3.5 0 0 1-.844-.78c1.112.568 2.107.558 3.34.084.932-.359 1.632-1.168 1.96-2.064.205-.56.202-1.122.202-1.704V3h4.496s-.05.412.062 1.046ZM26.7 8.991v.922a7.3 7.3 0 0 1-1.524-.53c-.94-.45-1.673-1.183-1.817-1.332q.251.157.517.285c1.143.547 2.27.71 2.824.655Z" fill="#69C9D0"/></svg>`,
        github: `<svg viewBox="-4.8 -4.8 57.6 57.6" xmlns="http://www.w3.org/2000/svg" fill="#fff"><rect x="-4.8" y="-4.8" width="57.6" height="57.6" rx="28.8" transform="matrix(.82 0 0 .82 4.32 4.32)"/><path d="M24 0C10.75 0 0 10.79 0 24.1a24.1 24.1 0 0 0 16.41 22.86c1.2.22 1.64-.52 1.64-1.16l-.03-4.1c-6.68 1.46-8.09-3.23-8.09-3.23-1.09-2.78-2.66-3.52-2.66-3.52-2.18-1.5.17-1.47.17-1.47 2.4.17 3.67 2.48 3.67 2.48 2.14 3.69 5.62 2.62 6.99 2a5.2 5.2 0 0 1 1.52-3.22c-5.33-.6-10.93-2.67-10.93-11.9 0-2.63.93-4.79 2.47-6.47-.25-.61-1.07-3.06.23-6.38 0 0 2.02-.64 6.6 2.47a23 23 0 0 1 12.02 0c4.58-3.11 6.6-2.47 6.6-2.47 1.3 3.32.48 5.77.23 6.38a9.3 9.3 0 0 1 2.47 6.47c0 9.25-5.61 11.29-10.96 11.89.86.74 1.63 2.2 1.63 4.46 0 3.22-.03 5.82-.03 6.6 0 .65.43 1.4 1.65 1.17A24.1 24.1 0 0 0 48 24.1 24.05 24.05 0 0 0 24 0" fill="#3E75C3" fill-rule="evenodd"/></svg>`,
        linkedin: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="-38.2 -38.2 458.4 458.4" xml:space="preserve" fill="#fff" stroke="#fff" stroke-width="0"><rect x="-38.2" y="-38.2" width="458.4" height="458.4" rx="0" transform="matrix(.7 0 0 .7 57.3 57.3)" stroke="none"/><path d="M347.45 0H34.55A34.56 34.56 0 0 0 0 34.56v312.88A34.56 34.56 0 0 0 34.56 382h312.88A34.56 34.56 0 0 0 382 347.44V34.56A34.56 34.56 0 0 0 347.44 0zM118.2 329.84c0 5.56-4.5 10.06-10.06 10.06h-42.8c-5.56 0-10.06-4.5-10.06-10.06V150.4c0-5.55 4.5-10.05 10.06-10.05h42.8c5.55 0 10.06 4.5 10.06 10.05zm-31.46-206.4a40.67 40.67 0 1 1 0-81.34 40.67 40.67 0 0 1 0 81.33zm255.16 207.2a9.25 9.25 0 0 1-9.25 9.25h-45.93a9.25 9.25 0 0 1-9.25-9.25V246.5c0-12.56 3.69-55.03-32.8-55.03-28.32 0-34.06 29.07-35.21 42.11v97.08a9.25 9.25 0 0 1-9.25 9.25H155.8a9.25 9.25 0 0 1-9.25-9.25V149.6c0-5.1 4.14-9.24 9.24-9.24h44.43c5.1 0 9.25 4.14 9.25 9.24v15.66c10.5-15.76 26.1-27.91 59.3-27.91 73.56 0 73.14 68.71 73.14 106.47v86.84z" fill="#0077b7" stroke="none"/></svg>`,
    };

    GM_addStyle(`
        .txt-editor-container.dark-theme { background-color: #0d1117; border: 1px solid #3d444d; }
        .dark-theme .txt-editor-toolbar { background-color: #151b23f2; border-bottom: 1px solid #3d444d; }
        .dark-theme .txt-editor-toolbar-button, .dark-theme .txt-editor-toolbar-select { color: #9198a1; }
        .dark-theme .txt-editor-toolbar-button:hover, .dark-theme .txt-editor-toolbar-select:hover { background-color: #212830; color: #fcf0f0ff; }
        .dark-theme .txt-editor-toolbar-button[data-tooltip]:hover::after { background-color: #212830; color: #fcf0f7ff; }
        .dark-theme textarea { background-color: #0d1117; color: #f0f6fc; border-top: 1px solid #3d444d; }
        .dark-theme .txt-editor-toolbar-divider { border-left: 1px solid #3d444d; }
        .dark-theme .txt-editor-toolbar-select { background-color: #151b23; background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%239198a1" viewBox="0 0 16 16"><path d="M4.427 7.427a.25.25 0 0 0-.354.354l4 4a.25.25 0 0 0 .354 0l4-4a.25.25 0 0 0-.354-.354L8.25 11.22l-3.823-3.793Z"></path></svg>'); }
        .dark-theme .txt-editor-toolbar-select option { background: #0d1117; color: #f0f6fc; }
        .dark-theme .txt-color-picker-input { border: 1px solid #3d444d; background-color: #0d1117; }
        .txt-editor-container.light-theme { background-color: #ffffff; border: 1px solid #d0d7de; }
        .light-theme .txt-editor-toolbar { background-color: #f6f8fa; border-bottom: 1px solid #d0d7de; }
        .light-theme .txt-editor-toolbar-button, .light-theme .txt-editor-toolbar-select { color: #57606a; }
        .light-theme .txt-editor-toolbar-button:hover, .light-theme .txt-editor-toolbar-select:hover { background-color: #ebecf0; color: #24292f; }
        .light-theme .txt-editor-toolbar-button[data-tooltip]:hover::after { background-color: #24292f; color: #ffffff; }
        .light-theme textarea { background-color: #ffffff; color: #24292f; border-top: 1px solid #d0d7de; }
        .light-theme .txt-editor-toolbar-divider { border-left: 1px solid #d0d7de; }
        .light-theme .txt-editor-toolbar-select { background-color: #f6f8fa; background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%2357606a" viewBox="0 0 16 16"><path d="M4.427 7.427a.25.25 0 0 0-.354.354l4 4a.25.25 0 0 0 .354 0l4-4a.25.25 0 0 0-.354-.354L8.25 11.22l-3.823-3.793Z"></path></svg>'); }
        .light-theme .txt-editor-toolbar-select option { background: #ffffff; color: #24292f; }
        .light-theme .txt-color-picker-input { border: 1px solid #d0d7de; background-color: #ffffff; }
        .txt-editor-container { border-radius: 6px; margin: 10px 0; }
        .txt-editor-container textarea { border: 0; border-radius: 0 0 6px 6px; width: 100% !important; min-height: 180px; padding: 10px; box-sizing: border-box; font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace; resize: vertical; }
        .txt-editor-toolbar { display: flex; flex-wrap: wrap; align-items: center; padding: 8px 5px; }
        .txt-editor-toolbar-button, .txt-editor-toolbar-select { background: none; border: none; cursor: pointer; padding: 6px; margin: 0 2px; border-radius: 6px; position: relative; }
        .txt-editor-toolbar-button svg { width: 16px; height: 16px; fill: currentColor; vertical-align: middle; }
        .txt-editor-toolbar-button[data-tooltip]:hover::after { content: attr(data-tooltip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); padding: 4px 8px; border-radius: 4px; font-size: 12px; white-space: nowrap; z-index: 10; margin-bottom: 5px; }
        .txt-editor-toolbar-divider { margin: 4px 8px; height: 16px; }
        .txt-editor-toolbar-select { -webkit-appearance: none; appearance: none; padding-right: 20px; background-repeat: no-repeat; background-position: right 6px center; }
        .txt-color-picker-container { display: flex; align-items: center; }
        .txt-color-picker-input { border-radius: 4px; width: 24px; height: 24px; padding: 1px; cursor: pointer; }
		.lang-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); display: none; z-index: 2147483647; justify-content: center; align-items: center; backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
		.lang-modal-box { padding: 24px; border-radius: 16px; width: min(90vw, 320px); text-align: center; transform: scale(0.95); opacity: 0; transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease-out; }
		.lang-modal-box.dark-theme { background-color: rgba(30, 30, 32, 0.85); border: 1px solid #333; box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37); }
		.lang-modal-box.light-theme { background-color: rgba(255, 255, 255, 0.8); border: 1px solid rgba(0, 0, 0, 0.1); box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1); }
		.lang-modal-buttons { display: flex; flex-direction: column; gap: 12px; }
		.lang-modal-buttons button { padding: 14px; border-radius: 10px; font-weight: 500; cursor: pointer; transition: all 0.2s ease-in-out; text-align: center; font-size: 1rem; }
		.lang-modal-box.dark-theme .lang-modal-buttons button { background-color: #2a2d31; color: #e0e0e0; border: 1px solid #444; }
		.lang-modal-box.light-theme .lang-modal-buttons button { background-color: #f0f2f5; color: #333; border: 1px solid #ddd; }
		.lang-modal-box.dark-theme .lang-modal-buttons button:hover { border-color: #58a6ff; background-color: #313438; }
		.lang-modal-box.light-theme .lang-modal-buttons button:hover { border-color: #0969da; background-color: #e6e8eb; }
        .script-description-blockquote { margin: 15px 0 !important; padding: 12px 15px; border-radius: 6px; transition: background-color 0.2s, border-color 0.2s, color 0.2s; background-color: #e0e0e0ff; border-left: 4px solid #670000; color: #131313ff; }
        .script-description-blockquote * { font-weight: 600 !important; color: inherit !important; }
        @media (prefers-color-scheme: dark) { .script-description-blockquote { background-color: #1c2128; border-left: 4px solid #e95757; color: #ffffffff; } }
        .good-rating-count, .ok-rating-count, .bad-rating-count { font-weight: bold; display: inline-flex; align-items: center; font-size: 1.15em; padding: 2px 3px; border-radius: 5px; transition: background-color 0.2s ease; }
        .good-rating-count { color: #1f883d; }
        .ok-rating-count { color: #6e7781; }
        .bad-rating-count { color: #cf222e; }
        .good-rating-count:hover { background-color: rgba(31, 136, 61, 0.1); }
        .ok-rating-count:hover { background-color: rgba(110, 119, 129, 0.1); }
        .bad-rating-count:hover { background-color: rgba(207, 34, 46, 0.1); }
        .good-rating-count::before { content: '👍'; margin-right: 3px; }
        .ok-rating-count::before { content: '🤔'; margin-right: 3px; }
        .bad-rating-count::before { content: '👎'; margin-right: 3px; }
        @media (prefers-color-scheme: dark) { .ok-rating-count { color: #ccbf1c; }
        .good-rating-count:hover { background-color: rgba(46, 160, 67, 0.15); }
        .ok-rating-count:hover { background-color: rgba(139, 148, 158, 0.15); }
        .bad-rating-count:hover { background-color: rgba(248, 81, 73, 0.15); } }
        .script-list-ratings { align-self: center; }
        .script-list-ratings + dd { align-self: center; white-space: nowrap; }
        .bgs-info-separator { height: 3px; border: none; background-color: #b1b8c0; margin: 1.5em 0; }
        @media (prefers-color-scheme: dark) { .bgs-info-separator { background-color: #4e5761; } }
    `);

    function showModal(modal) {
        if (!modal) return;
        modal.style.display = 'flex';
        setTimeout(() => {
            const box = modal.querySelector('.lang-modal-box');
            box.style.opacity = '1';
            box.style.transform = 'scale(1)';
        }, 10);
    }

    function hideModal(modal) {
        if (!modal) return;
        const box = modal.querySelector('.lang-modal-box');
        box.style.opacity = '0';
        box.style.transform = 'scale(0.95)';
        setTimeout(() => {
            modal.style.display = 'none';
        }, 200);
    }

    function createLanguageModal() {
        const overlay = document.createElement('div');
        overlay.className = 'lang-modal-overlay';
        overlay.addEventListener('click', (e) => {
            if (e.target === overlay) {
                hideModal(overlay);
            }
        });
        const box = document.createElement('div');
        box.className = 'lang-modal-box';
        const buttonsContainer = document.createElement('div');
        buttonsContainer.className = 'lang-modal-buttons';
        Object.keys(translations).forEach(langKey => {
            const btn = document.createElement('button');
            btn.textContent = translations[langKey].langName;
            btn.onclick = async () => {
                await GM_setValue(LANG_STORAGE_KEY, langKey);
                window.location.reload();
            };
            buttonsContainer.appendChild(btn);
        });
        box.appendChild(buttonsContainer);
        overlay.appendChild(box);
        const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');

        function applyTheme(isDark) {
            box.classList.toggle('dark-theme', isDark);
            box.classList.toggle('light-theme', !isDark);
        }
        applyTheme(mediaQuery.matches);
        mediaQuery.addEventListener('change', e => applyTheme(e.matches));
        return overlay;
    }

    async function forceUpdate() {
        alert(getTranslation('force_update_alert'));
        await GM_deleteValue(CACHE_KEY);
        await GM_deleteValue(OLD_CACHE_KEY);
        window.location.reload();
    }

    // ================
    // #region ESTILIZAR
    // ================

    function isScriptPage() {
        const path = window.location.pathname;
        return /^\/([a-z]{2}(-[A-Z]{2})?\/)?scripts\/\d+-[^/]+$/.test(path);
    }

    function addAdditionalInfoSeparator() {
        const additionalInfo = document.getElementById('additional-info');
        if (additionalInfo && !additionalInfo.previousElementSibling?.matches('hr.bgs-info-separator')) {
            const hr = document.createElement('hr');
            hr.className = 'bgs-info-separator';
            additionalInfo.before(hr);
        }
    }

    function highlightScriptDescription() {
        const descriptionElements = document.querySelectorAll('#script-description, .script-description.description');
        descriptionElements.forEach(element => {
            const scriptLink = element.closest('article, li')?.querySelector('a.script-link');
            const path = scriptLink ? normalizeScriptPath(new URL(scriptLink.href).pathname) : normalizeScriptPath(window.location.pathname);
            if (element && element.parentElement.tagName !== 'BLOCKQUOTE') {
                const blockquoteWrapper = document.createElement('blockquote');
                blockquoteWrapper.className = 'script-description-blockquote';
                if (path) {
                    blockquoteWrapper.dataset.bgfPath = path;
                }
                element.parentNode.insertBefore(blockquoteWrapper, element);
                blockquoteWrapper.appendChild(element);
            }
        });
    }

    // ================
    // #region RECURSOS BFG
    // ================

    function applyBfgFeatures(metadata) {
        if (!metadata) return;
        applyBfgCompatibility(metadata.bgfCompatible);
        applyBfgCopyright(metadata.bgfCopyright);
        applyBfgSocial(metadata.bgfSocial);
    }

    function applyBfgCompatibility(compatValue) {
        if (!compatValue) return;
        const compatDd = document.querySelector('dd.script-show-compatibility');
        if (!compatDd) {
            return;
        }
        let compatContainer = compatDd.querySelector('span');
        if (!compatContainer) {
            compatContainer = document.createElement('span');
            compatDd.innerHTML = '';
            compatDd.appendChild(compatContainer);
        }
        const compatItems = compatValue.split(',').map(item => item.trim().toLowerCase());
        compatItems.forEach(item => {
            if (!icons[item] || compatContainer.querySelector(`.bgf-compat-${item}`)) {
                return;
            }
            const img = document.createElement('img');
            img.className = `browser-compatible bgf-compat-${item}`;
            const displayName = capitalizeCompatItem(item);
            img.alt = `${getTranslation('compatible_with')} ${displayName}`;
            img.title = `${getTranslation('compatible_with')} ${displayName}`;
            img.style.marginLeft = '1px';
            img.src = `data:image/svg+xml;utf8,${encodeURIComponent(icons[item])}`;
            compatContainer.appendChild(img);
        });
    }

    function reapplyAllBlockquoteColors() {
        const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
        const allBlockquotes = document.querySelectorAll('blockquote.script-description-blockquote[data-bgf-path]');
        allBlockquotes.forEach(bq => {
            const path = bq.dataset.bgfPath;
            if (!path || !iconCache[path]) return;
            const metadata = iconCache[path];
            const colorToApply = isDarkMode ? metadata.bgfColorDT : metadata.bgfColorLT;
            if (colorToApply) {
                bq.style.setProperty('border-left-color', colorToApply, 'important');
            } else {
                bq.style.removeProperty('border-left-color');
            }
        });
    }

    function setupThemeChangeListener() {
        const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
        mediaQuery.addEventListener('change', reapplyAllBlockquoteColors);
    }

    function applyBfgCopyright(copyrightValue) {
        if (!copyrightValue || document.querySelector('.script-show-copyright')) return;
        const copyrightRegex = /\[(.{1,50})\]\((https:\/\/gist\.github\.com\/[^)]+)\)/;
        const match = copyrightValue.match(copyrightRegex);
        if (!match) return;
        const licenseDd = document.querySelector('dd.script-show-license');
        if (!licenseDd) return;
        const text = match[1];
        const url = match[2];
        const copyrightDt = document.createElement('dt');
        copyrightDt.className = 'script-show-copyright';
        copyrightDt.innerHTML = '<span>Copyright</span>';
        const copyrightDd = document.createElement('dd');
        copyrightDd.className = 'script-show-copyright';
        copyrightDd.style.alignSelf = 'center'; 
        const link = document.createElement('a');
        link.href = url;
        link.textContent = text;
        link.target = '_blank';
        link.rel = 'noopener noreferrer';
        const span = document.createElement('span');
        span.appendChild(link);
        copyrightDd.appendChild(span);
        licenseDd.after(copyrightDt, copyrightDd);
    }

    function applyBfgSocial(socialValue) {
        if (!socialValue || document.querySelector('.script-show-social')) return;
        const authorDd = document.querySelector('dd.script-show-author');
        if (!authorDd) return;
        const socialDomainMap = {
            'instagram.com': { icon: icons.instagram, name: 'Instagram' },
            'facebook.com': { icon: icons.facebook, name: 'Facebook' },
            'x.com': { icon: icons.x, name: 'X / Twitter' },
            'youtube.com': { icon: icons.youtube, name: 'YouTube' },
            'bilibili.com': { icon: icons.bilibili, name: 'Bilibili' },
            'tiktok.com': { icon: icons.tiktok, name: 'TikTok' },
            'douyin.com': { icon: icons.tiktok, name: 'Douyin' },
            'github.com': { icon: icons.github, name: 'GitHub' },
            'linkedin.com': { icon: icons.linkedin, name: 'LinkedIn' },
        };
        const urls = socialValue.split(',').map(url => url.trim());
        const validLinks = [];
        let tiktokFamilyProcessed = false;
        urls.forEach(url => {
            try {
                const domain = new URL(url).hostname.replace('www.', '');
                if (socialDomainMap[domain]) {
                    if (domain === 'tiktok.com' || domain === 'douyin.com') {
                        if (tiktokFamilyProcessed) return;
                        tiktokFamilyProcessed = true;
                    }
                    validLinks.push({ url, ...socialDomainMap[domain] });
                }
            } catch (e) {}
        });
        if (validLinks.length === 0) return;
        const socialDt = document.createElement('dt');
        socialDt.className = 'script-show-social';
        socialDt.innerHTML = '<span>Social</span>';
        const socialDd = document.createElement('dd');
        socialDd.className = 'script-show-social';
        socialDd.style.cssText = 'display: flex; gap: 8px; align-items: center; align-self: center;';
        validLinks.forEach(linkInfo => {
            const link = document.createElement('a');
            link.href = linkInfo.url;
            link.title = linkInfo.name;
            link.target = '_blank';
            link.rel = 'noopener noreferrer';
            link.innerHTML = linkInfo.icon;
            const svg = link.querySelector('svg');
            if (svg) {
                svg.style.width = '20px';
                svg.style.height = '20px';
                svg.style.verticalAlign = 'middle';
            }
            socialDd.appendChild(link);
        });
        authorDd.after(socialDt, socialDd);
    }

    // ================
    // #region EDITOR MD
    // ================

    function insertText(textarea, prefix, suffix = '', placeholder = '') {
        const start = textarea.selectionStart;
        const end = textarea.selectionEnd;
        const selected = textarea.value.substring(start, end);
        const text = selected || placeholder;
        textarea.setRangeText(prefix + text + suffix, start, end, selected ? 'end' : 'select');
        textarea.focus();
    }

    function createToolbarButton(def) {
        const btn = document.createElement('button');
        btn.type = 'button';
        btn.className = 'txt-editor-toolbar-button';
        btn.dataset.tooltip = def.title;
        btn.innerHTML = def.icon || def.label;
        btn.addEventListener('click', e => {
            e.preventDefault();
            def.action();
        });
        return btn;
    }

    function createTextStyleEditor(textarea) {
        if (textarea.dataset.editorApplied) return;
        textarea.dataset.editorApplied = 'true';
        const container = document.createElement('div');
        container.className = 'txt-editor-container';
        const toolbar = document.createElement('div');
        toolbar.className = 'txt-editor-toolbar';
        const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');

        function applyTheme(isDark) {
            container.classList.toggle('dark-theme', isDark);
            container.classList.toggle('light-theme', !isDark);
        }
        applyTheme(mediaQuery.matches);
        mediaQuery.addEventListener('change', e => applyTheme(e.matches));
        const tools = [
            { type: 'select', title: getTranslation('titles'), options: { 'H1': '# ', 'H2': '## ', 'H3': '### ', 'H4': '#### ', 'H5': '##### ', 'H6': '###### ' }, action: (val) => insertText(textarea, val, '', getTranslation('title_placeholder')) },
            { type: 'divider' },
            { title: getTranslation('bold'), icon: icons.bold, action: () => insertText(textarea, '**', '**', getTranslation('bold_placeholder')) },
            { title: getTranslation('italic'), icon: icons.italic, action: () => insertText(textarea, '*', '*', getTranslation('italic_placeholder')) },
            { title: getTranslation('underline'), icon: icons.underline, action: () => insertText(textarea, '<u>', '</u>', getTranslation('underline_placeholder')) },
            { title: getTranslation('strikethrough'), icon: icons.strikethrough, action: () => insertText(textarea, '~~', '~~', getTranslation('strikethrough_placeholder')) },
            { type: 'divider' },
            { title: getTranslation('unordered_list'), icon: icons.ul, action: () => { const start = textarea.selectionStart, end = textarea.selectionEnd, selection = textarea.value.substring(start, end); textarea.setRangeText(selection ? selection.split('\n').map(line => line.trim() === '' ? '' : '- ' + line).join('\n') : '\n- ' + getTranslation('list_item_placeholder'), start, end, 'select'); textarea.focus(); } },
            { title: getTranslation('ordered_list'), icon: icons.ol, action: () => { const start = textarea.selectionStart, end = textarea.selectionEnd, selection = textarea.value.substring(start, end); if (selection) { let counter = 1; textarea.setRangeText(selection.split('\n').map(line => line.trim() === '' ? '' : (counter++) + '. ' + line).join('\n'), start, end, 'select'); } else insertText(textarea, '\n1. ', '', getTranslation('list_item_placeholder')); textarea.focus(); } },
            { type: 'divider' },
            { title: getTranslation('quote'), icon: icons.quote, action: () => insertText(textarea, '\n> ', '', getTranslation('quote_placeholder')) },
            { title: getTranslation('inline_code'), icon: icons.code, action: () => insertText(textarea, '`', '`', getTranslation('inline_code_placeholder')) },
            { title: getTranslation('code_block'), label: icons.code_block, action: () => insertText(textarea, '\n```\n', '\n```\n', getTranslation('code_block_placeholder')) },
            { title: getTranslation('horizontal_line'), icon: icons.hr, action: () => insertText(textarea, '\n---\n') },
            { type: 'divider' },
            { title: getTranslation('link'), icon: icons.link, action: () => { const url = prompt(getTranslation('prompt_insert_url'), "https://"); if (url) insertText(textarea, '[', `](${url})`, getTranslation('link_text_placeholder')); } },
            { title: getTranslation('image'), icon: icons.image, action: () => { const url = prompt(getTranslation('prompt_insert_image_url'), "https://"); if (url) insertText(textarea, `![alt text](${url})`); } },
            { title: getTranslation('table'), icon: icons.table, action: () => { const cols = parseInt(prompt(getTranslation('prompt_columns'), "3"), 10) || 3; const rows = parseInt(prompt(getTranslation('prompt_rows'), "2"), 10) || 2; let table = '\n| ' + Array(cols).fill(getTranslation('table_header_placeholder')).join(' | ') + ' |\n'; table += '| ' + Array(cols).fill('---').join(' | ') + ' |\n'; for (let i = 0; i < rows; i++) { table += '| ' + Array(cols).fill(getTranslation('table_cell_placeholder')).join(' | ') + ' |\n'; } insertText(textarea, table); } },
            { title: getTranslation('video'), icon: icons.video, action: () => { const url = prompt(getTranslation('prompt_insert_video_url')); if (!url) return; let src = ''; if (url.includes('youtube.com/watch?v=')) src = `https://www.youtube.com/embed/${new URL(url).searchParams.get('v')}`; else if (url.includes('youtu.be/')) src = `https://www.youtube.com/embed/${new URL(url).pathname.substring(1)}`; else if (url.includes('bilibili.com/video/')) src = `https://player.bilibili.com/player.html?bvid=${new URL(url).pathname.split('/')[2]}`; if (src) insertText(textarea, `<iframe src="${src}" allowfullscreen></iframe>`); else alert(getTranslation('alert_invalid_video_url')); } },
            { type: 'divider' },
            { title: getTranslation('subscript'), label: icons.subscript, action: () => insertText(textarea, '<sub>', '</sub>', getTranslation('subscript_placeholder')) },
            { title: getTranslation('superscript'), label: icons.superscript, action: () => insertText(textarea, '<sup>', '</sup>', getTranslation('superscript_placeholder')) },
            { title: getTranslation('highlight'), label: icons.highlight, action: () => insertText(textarea, '<mark>', '</mark>', getTranslation('highlight_placeholder')) },
            { title: getTranslation('keyboard'), label: icons.keyboard, action: () => insertText(textarea, '<kbd>', '</kbd>', getTranslation('keyboard_placeholder')) },
            { title: getTranslation('abbreviation'), label: icons.abbreviation, action: () => { const title = prompt(getTranslation('prompt_abbreviation_meaning')); if (title) insertText(textarea, `<abbr title="${title}">`, `</abbr>`, getTranslation('abbreviation_placeholder')); } },
            { type: 'color-picker' }
        ];

        tools.forEach(tool => {
            if (tool.type === 'divider') {
                const div = document.createElement('div');
                div.className = 'txt-editor-toolbar-divider';
                toolbar.appendChild(div);
            } else if (tool.type === 'select') {
            const container = document.createElement('span');
            container.className = 'txt-editor-toolbar-button';
            container.dataset.tooltip = tool.title;
            container.style.position = 'relative';
            container.style.display = 'flex';
            container.style.alignItems = 'center';
            container.style.justifyContent = 'center';
            container.innerHTML = icons.h;
            const select = document.createElement('select');
            select.className = 'txt-editor-toolbar-select';
            select.style.cssText = ` -webkit-appearance: none; appearance: none; background: transparent; border: none; color: transparent; position: absolute; top: 0; left: 0; width: 100%; height: 100%; cursor: pointer; `;
            const placeholderOpt = document.createElement('option');
            placeholderOpt.value = '';
            placeholderOpt.textContent = '';
            placeholderOpt.disabled = true;
            placeholderOpt.selected = true;
            placeholderOpt.style.display = 'none';
            select.appendChild(placeholderOpt);
            Object.keys(tool.options).forEach(key => {
                const opt = document.createElement('option');
                opt.value = tool.options[key];
                opt.textContent = key;
                select.appendChild(opt);
            });
            select.addEventListener('change', () => {
                if (select.value) tool.action(select.value);
                select.selectedIndex = 0;
            });
            container.appendChild(select);
            toolbar.appendChild(container);
        } else if (tool.type === 'color-picker') {
            const colorContainer = document.createElement('div');
            colorContainer.className = 'txt-color-picker-container';
            const input = document.createElement('input');
                input.type = 'color';
                input.className = 'txt-color-picker-input';
                input.value = "#58a6ff";
                const colorBtn = createToolbarButton({
                    title: getTranslation('text_color'),
                    label: icons.text_color,
                    action: () => insertText(textarea, `<span style="color: ${input.value};">`, '</span>', getTranslation('colored_text_placeholder'))
                });
                const bgBtn = createToolbarButton({
                    title: getTranslation('background_color'),
                    label: icons.background_color,
                    action: () => insertText(textarea, `<span style="background-color: ${input.value};">`, '</span>', getTranslation('colored_background_placeholder'))
                });
                colorContainer.append(input, colorBtn, bgBtn);
                toolbar.appendChild(colorContainer);
            } else {
                toolbar.appendChild(createToolbarButton(tool));
            }
        });
        textarea.parentNode.insertBefore(container, textarea);
        container.append(toolbar, textarea);
    }

    function applyToAllTextareas() {
        const textareas = document.querySelectorAll('textarea:not(#script_version_code):not([data-editor-applied])');
        textareas.forEach(createTextStyleEditor);
    }

    function enableSourceEditorCheckbox() {
        const enableCheckbox = () => {
            const checkbox = document.getElementById('enable-source-editor-code');
            if (checkbox && !checkbox.checked) {
                checkbox.checked = true;
                const event = new Event('change', {
                    bubbles: true
                });
                checkbox.dispatchEvent(event);
            }
        };
        enableCheckbox();
        const observer = new MutationObserver((mutationsList, observer) => {
            for (const mutation of mutationsList) {
                if (mutation.type === 'childList') {
                    const checkbox = document.getElementById('enable-source-editor-code');
                    if (checkbox) {
                        enableCheckbox();
                        observer.disconnect();
                        break;
                    }
                }
            }
        });
        observer.observe(document.body, {
            childList: true,
            subtree: true
        });
    }

    function isMarkdownPage() {
        const path = window.location.pathname;
        const markdownSegments = [
            '/new',
            '/edit',
            '/feedback',
            '/discussions'
        ];
        if (path.includes('/sets/')) {
            return false;
        }
        return markdownSegments.some(segment => path.includes(segment));
    }

    // ================
    // #region DOWNLOAD
    // ================

    function isCodePage() {
        return /^\/([a-z]{2}(-[A-Z]{2})?\/)?scripts\/\d+-.+\/code/.test(window.location.pathname);
    }

    function initializeDownloadButton() {
        const waitFor = (sel) =>
            new Promise((resolve) => {
                const el = document.querySelector(sel);
                if (el) return resolve(el);
                const obs = new MutationObserver(() => {
                    const el = document.querySelector(sel);
                    if (el) {
                        obs.disconnect();
                        resolve(el);
                    }
                });
                obs.observe(document, { childList: true, subtree: true });
            });

        waitFor('label[for="wrap-lines"]').then((label) => {
            const wrapLinesCheckbox = document.getElementById('wrap-lines');
            if (wrapLinesCheckbox) {
                wrapLinesCheckbox.checked = false;
            }
            const toolbar = label.parentElement;
            const btn = document.createElement('button');
            btn.className = 'btn';
            btn.textContent = getTranslation('download');
            btn.style.marginLeft = '12px';
            btn.style.backgroundColor = '#005200';
            btn.style.color = 'white';
            btn.style.border = 'none';
            btn.style.padding = '6px 16px';
            btn.style.borderRadius = '4px';
            btn.style.cursor = 'pointer';
            btn.addEventListener('mouseenter', () => btn.style.backgroundColor = '#1e971e');
            btn.addEventListener('mouseleave', () => btn.style.backgroundColor = '#005200');

            btn.addEventListener('click', () => {
                const normalizedPath = normalizeScriptPath(window.location.pathname);
                const scriptId = extractScriptIdFromNormalizedPath(normalizedPath);

                if (!scriptId) {
                    alert(getTranslation('scriptIdNotFound'));
                    return;
                }

                const scriptUrl = `https://update.greasyfork.org/scripts/${scriptId}.js`;

                btn.disabled = true;
                btn.textContent = getTranslation('downloading');

                GM_xmlhttpRequest({
                    method: 'GET',
                    url: scriptUrl,
                    onload: function (res) {
                        const code = res.responseText;
                        if (!code) {
                            alert(getTranslation('notFound'));
                            return;
                        }
                        const nameMatch = code.match(/\/\/\s*@name\s+(.+)/i);
                        const fileName = nameMatch ? `${nameMatch[1].trim()}.user.js` : 'script.user.js';
                        const blob = new Blob([code], { type: 'application/javascript;charset=utf-8' });
                        const url = URL.createObjectURL(blob);
                        const a = document.createElement('a');
                        a.href = url;
                        a.download = fileName;
                        document.body.appendChild(a);
                        a.click();
                        document.body.removeChild(a);
                        URL.revokeObjectURL(url);
                    },
                    onerror: function (res) {
                        alert(getTranslation('downloadError'));
                    },
                    ontimeout: function () {
                        alert(getTranslation('downloadTimeout'));
                    },
                    onloadend: function () {
                        btn.disabled = false;
                        btn.textContent = getTranslation('download');
                    }
                });
            });
            toolbar.appendChild(btn);
            const spacer = document.createElement('div');
            spacer.style.height = '12px';
            toolbar.appendChild(spacer);
        });
    }

    // ================
    // #region INICIALIZAR
    // ================

    async function start() {
        iconCache = await GM_getValue(CACHE_KEY, {});
        await determineLanguage();
        languageModal = createLanguageModal();
        document.body.appendChild(languageModal);
        registerLanguageMenu();
        registerForceUpdateMenu(); 
        setupThemeChangeListener();
        if (isMarkdownPage()) {
            applyToAllTextareas();
            enableSourceEditorCheckbox();
        }
        if (isCodePage()){
            initializeDownloadButton();
        }
        processIconElements();
        highlightScriptDescription();
        if (isScriptPage()) {
            addAdditionalInfoSeparator();
        }
        const observer = new MutationObserver(() => {
            processIconElements();
            highlightScriptDescription();
            if (isScriptPage()) {
                addAdditionalInfoSeparator();
            }

            if (isMarkdownPage()) {
                applyToAllTextareas();
            }
        });
        observer.observe(document.body, {
            childList: true,
            subtree: true
        });
    }
    start();
})();