// ==UserScript== // @name X Translator // @name:ru X Translator // @name:zh-CN X Translator // @name:es X Translator // @name:pt-BR X Translator // @name:de X Translator // @name:fr X Translator // @name:ja X Translator // @namespace https://github.com/NemoKing1210/x-translator // @version 1.3.1 // @author NemoKing1210 // @description Translate X posts in place on x.com // @description:ru Переводит посты X прямо на x.com // @description:zh-CN 在 x.com 上就地翻译 X 帖子 // @description:es Traduce publicaciones de X en x.com // @description:pt-BR Traduz posts do X diretamente no x.com // @description:de Übersetzt X-Posts direkt auf x.com // @description:fr Traduit les posts X directement sur x.com // @description:ja x.com 上で X の投稿をその場で翻訳 // @license MIT // @icon https://abs.twimg.com/favicons/twitter.3.ico // @homepage https://github.com/NemoKing1210/x-translator // @homepageURL https://github.com/NemoKing1210/x-translator // @source https://github.com/NemoKing1210/x-translator.git // @supportURL https://github.com/NemoKing1210/x-translator/issues // @match https://x.com/* // @match https://www.x.com/* // @match https://twitter.com/* // @match https://www.twitter.com/* // @tag x // @tag twitter // @tag translate // @connect translate.googleapis.com // @connect api-free.deepl.com // @connect api.deepl.com // @connect api.cognitive.microsofttranslator.com // @connect api.openai.com // @connect translate.api.cloud.yandex.net // @connect libretranslate.com // @connect * // @grant GM_addStyle // @grant GM_getValue // @grant GM_registerMenuCommand // @grant GM_setValue // @grant GM_xmlhttpRequest // @run-at document-idle // @noframes // ==/UserScript== (t=>{if(typeof GM_addStyle=="function"){GM_addStyle(t);return}const e=document.createElement("style");e.textContent=t,document.head.append(e)})(' html[data-xt-theme=light]{--xt-accent: #1d9bf0;--xt-accent-hover: #1a8cd8;--xt-danger: #f4212e;--xt-danger-bg: rgba(244, 33, 46, .1);--xt-danger-border: rgba(244, 33, 46, .4);--xt-success: #00ba7c;--xt-warn: #ffd400;--xt-fg: #0f1419;--xt-fg-muted: #536471;--xt-surface: #ffffff;--xt-elevated: #f7f9f9;--xt-border: #eff3f4;--xt-hover: rgba(15, 20, 25, .1);--xt-inset: rgba(15, 20, 25, .03);--xt-shadow: 0 0 15px rgba(101, 119, 134, .2), 0 0 3px 1px rgba(101, 119, 134, .15);--xt-backdrop: rgba(0, 0, 0, .4);--xt-input-bg: #ffffff;--xt-input-border: #cfd9de;--xt-option-bg: #ffffff;--xt-toggle-off: #cfd9de;--xt-chrome-fg: #0f1419;--xt-nav-hover: rgba(15, 20, 25, .1);--xt-link: #1d9bf0}html[data-xt-theme=dim]{--xt-accent: #1d9bf0;--xt-accent-hover: #1a8cd8;--xt-danger: #f4212e;--xt-danger-bg: rgba(244, 33, 46, .12);--xt-danger-border: rgba(244, 33, 46, .45);--xt-success: #00ba7c;--xt-warn: #ffd400;--xt-fg: #f7f9f9;--xt-fg-muted: #8b98a5;--xt-surface: #15202b;--xt-elevated: #1e2732;--xt-border: #38444d;--xt-hover: rgba(247, 249, 249, .1);--xt-inset: rgba(255, 255, 255, .03);--xt-shadow: 0 0 15px rgba(0, 0, 0, .4), 0 0 3px 1px rgba(0, 0, 0, .25);--xt-backdrop: rgba(91, 112, 131, .4);--xt-input-bg: #15202b;--xt-input-border: #38444d;--xt-option-bg: #1e2732;--xt-toggle-off: #38444d;--xt-chrome-fg: #f7f9f9;--xt-nav-hover: rgba(247, 249, 249, .1);--xt-link: #1d9bf0}html[data-xt-theme=dark],html:not([data-xt-theme]){--xt-accent: #1d9bf0;--xt-accent-hover: #1a8cd8;--xt-danger: #f4212e;--xt-danger-bg: rgba(244, 33, 46, .12);--xt-danger-border: rgba(244, 33, 46, .45);--xt-success: #00ba7c;--xt-warn: #ffd400;--xt-fg: #e7e9ea;--xt-fg-muted: #71767b;--xt-surface: #000000;--xt-elevated: #16181c;--xt-border: #2f3336;--xt-hover: rgba(231, 233, 234, .1);--xt-inset: rgba(255, 255, 255, .03);--xt-shadow: 0 0 15px rgba(255, 255, 255, .08), 0 0 3px 1px rgba(255, 255, 255, .05);--xt-backdrop: rgba(91, 112, 131, .4);--xt-input-bg: #000000;--xt-input-border: #333639;--xt-option-bg: #16181c;--xt-toggle-off: #333639;--xt-chrome-fg: #e7e9ea;--xt-nav-hover: rgba(231, 233, 234, .1);--xt-link: #1d9bf0}.xt-menu-item,.xt-menu-item__label,.xt-menu-item__icon{color:var(--xt-chrome-fg)!important}.xt-menu-item svg,.xt-menu-item svg [fill]:not([fill=none]){color:var(--xt-chrome-fg)!important;fill:var(--xt-chrome-fg)!important}.xt-menu-item:hover{background-color:var(--xt-hover)}.xt-toolbar{display:block;width:100%;flex:0 0 auto;align-self:stretch;margin-top:.25rem;box-sizing:border-box}.xt-toolbar--quiet{display:none}.xt-btn[hidden]{display:none!important}.xt-btn{appearance:none;display:inline-flex;align-items:center;gap:.3rem;margin:0;padding:.15rem 0;border:0;border-radius:4px;background:transparent;color:var(--xt-accent);font:inherit;font-size:13px;font-weight:400;line-height:16px;cursor:pointer;transition:color .15s ease}.xt-btn:hover:not(:disabled){color:var(--xt-accent-hover);text-decoration:underline;text-underline-offset:2px}.xt-btn:focus-visible{outline:2px solid var(--xt-accent);outline-offset:2px}.xt-btn:disabled{opacity:.7;cursor:wait}.xt-btn.is-loading{pointer-events:none;text-decoration:none}.xt-btn__spinner{display:inline-block;width:.85em;height:.85em;border:1.5px solid currentColor;border-right-color:transparent;border-radius:50%;flex:0 0 auto;animation:xt-spin .65s linear infinite}.xt-btn__icon{display:block;flex:0 0 auto;width:1em;height:1em;opacity:.72;color:inherit}.xt-btn:hover:not(:disabled) .xt-btn__icon{opacity:1}.xt-btn__label{min-width:0}.xt-btn--retry{margin-top:.35rem}.xt-header-action{display:flex;flex-direction:row;align-items:center;justify-content:center;flex:0 0 auto}.xt-header-action--quote{margin-left:auto;align-self:center}.xt-btn--header{position:relative;z-index:0;color:var(--xt-fg-muted);font-size:15px;font-weight:400;line-height:1;width:20px;height:20px;min-width:20px;min-height:20px;padding:0;justify-content:center;border-radius:999px;background:transparent;text-decoration:none!important;overflow:visible}.xt-btn--header:before{content:"";position:absolute;top:50%;left:50%;width:34px;height:34px;transform:translate(-50%,-50%);border-radius:999px;background-color:transparent;transition:background-color .15s ease;z-index:-1}.xt-btn--header .xt-btn__icon{width:1.25em;height:1.25em;opacity:1}.xt-btn--header .xt-btn__label{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.xt-btn--header:hover:not(:disabled){color:var(--xt-accent);background-color:transparent;text-decoration:none}.xt-btn--header:hover:not(:disabled):before{background-color:#1d9bf01a}.xt-btn--header:focus-visible{outline:none}.xt-btn--header:focus-visible:before{outline:2px solid var(--xt-accent);outline-offset:0}.xt-btn--header.is-loading,.xt-btn--header:disabled{color:var(--xt-fg-muted)}@keyframes xt-spin{to{transform:rotate(360deg)}}.xt-text--hover-peek{cursor:help;position:relative}.xt-text--blur-ready{position:relative;filter:blur(0);opacity:1;transition:filter .55s cubic-bezier(.33,1,.68,1),opacity .55s cubic-bezier(.33,1,.68,1)}.xt-text--translating{filter:blur(2.25px);opacity:.72;user-select:none;pointer-events:none}.xt-text--peeking{position:relative;outline:1px solid var(--xt-border);outline-offset:2px;display:block!important;-webkit-line-clamp:unset!important;line-clamp:unset!important;max-height:none!important;overflow:visible!important;-webkit-box-orient:initial!important}.xt-peek-badge{position:fixed;z-index:2147483000;display:inline-flex;align-items:center;gap:.2rem;margin:0;padding:.1rem .45rem;border-radius:999px;border:1px solid var(--xt-border);background:var(--xt-elevated);color:var(--xt-fg-muted);font-size:11px;font-weight:700;letter-spacing:.02em;line-height:1.2;white-space:nowrap;pointer-events:none;box-shadow:var(--xt-shadow)}.xt-split{display:flex;flex-direction:column;gap:.55rem}.xt-split__pane{min-width:0}.xt-split__pane--translated{padding-top:.45rem;border-top:1px solid var(--xt-border)}.xt-split__label{font-size:13px;font-weight:400;letter-spacing:0;text-transform:none;color:var(--xt-fg-muted);margin-bottom:.15rem}.xt-split__body{white-space:pre-wrap;word-break:break-word;line-height:1.45;color:var(--xt-fg)}.xt-result{display:grid;grid-template-rows:0fr;width:100%;box-sizing:border-box;margin-top:0;opacity:0;transform:translateY(-2px);transition:grid-template-rows .28s cubic-bezier(.22,1,.36,1),opacity .22s ease,transform .22s ease,margin-top .22s ease}.xt-result.is-open{grid-template-rows:1fr;margin-top:.5rem;opacity:1;transform:translateY(0)}.xt-result.is-closing{grid-template-rows:0fr;margin-top:0;opacity:0;transform:translateY(-2px)}.xt-result__clip{overflow:hidden;min-height:0}.xt-result__inner{padding:.65rem .75rem;border-radius:12px;border:1px solid var(--xt-border);background:var(--xt-elevated);color:var(--xt-fg)}.xt-result__label{font-size:13px;font-weight:400;letter-spacing:0;text-transform:none;color:var(--xt-fg-muted);margin-bottom:.2rem}.xt-result__meta{font-size:13px;color:var(--xt-fg-muted);margin-bottom:.3rem}.xt-result__text{white-space:pre-wrap;word-break:break-word;line-height:1.45;color:var(--xt-fg);font-size:inherit}.xt-result__text a,.xt-text--translated a{color:var(--xt-link);text-decoration:none}.xt-result__text a:hover,.xt-text--translated a:hover{text-decoration:underline;text-underline-offset:2px}.xt-result__error{color:var(--xt-danger);font-size:13px;line-height:1.4}.xt-toast-host{position:fixed;inset:16px 16px auto auto;transform:none;z-index:2147483000;display:flex;flex-direction:column-reverse;align-items:flex-end;gap:12px;width:min(356px,calc(100vw - 32px));pointer-events:none}.xt-toast{pointer-events:auto;position:relative;display:grid;grid-template-columns:auto 1fr auto;gap:12px;align-items:center;width:100%;padding:12px 8px 12px 12px;border-radius:16px;border:1px solid var(--xt-border);background:var(--xt-surface);color:var(--xt-fg);box-shadow:var(--xt-shadow);font:inherit;letter-spacing:normal;opacity:0;transform:translate(12px);transition:opacity .18s ease,transform .18s ease;overflow:hidden}.xt-toast.is-visible{opacity:1;transform:translate(0)}.xt-toast.is-leaving{opacity:0;transform:translate(12px)}.xt-toast__icon{display:grid;place-items:center;flex:0 0 auto;width:36px;height:36px;margin:0;border-radius:999px;background:#1d9bf01f;color:var(--xt-accent)}.xt-toast__icon svg{width:18px;height:18px;display:block}.xt-toast--success .xt-toast__icon{background:#00ba7c1f;color:var(--xt-success)}.xt-toast--warning .xt-toast__icon{background:#ffd40024;color:#ca8a04}html[data-xt-theme=dim] .xt-toast--warning .xt-toast__icon,html[data-xt-theme=dark] .xt-toast--warning .xt-toast__icon,html:not([data-xt-theme]) .xt-toast--warning .xt-toast__icon{color:var(--xt-warn)}.xt-toast--error .xt-toast__icon{background:var(--xt-danger-bg);color:var(--xt-danger)}.xt-toast__body{display:flex;flex-direction:column;gap:2px;min-width:0;padding:2px 0}.xt-toast__title{font-weight:700;font-size:15px;line-height:20px;color:var(--xt-fg)}.xt-toast__text{font-size:13px;font-weight:400;line-height:16px;color:var(--xt-fg-muted)}.xt-toast__close{appearance:none;display:grid;place-items:center;flex:0 0 auto;align-self:start;width:34px;height:34px;margin:0;padding:0;border:0;border-radius:999px;background:transparent;color:var(--xt-fg);cursor:pointer;transition:background .15s ease}.xt-toast__close:hover{background:var(--xt-hover)}.xt-toast__close:focus-visible{outline:2px solid var(--xt-accent);outline-offset:2px}.xt-toast__close svg{width:18px;height:18px;display:block}.xt-toast__bar{position:absolute;left:0;right:0;bottom:0;height:3px;width:100%;transform-origin:left center;background:var(--xt-accent);opacity:.85;animation:xt-toast-bar linear forwards}.xt-toast--success .xt-toast__bar{background:var(--xt-success)}.xt-toast--warning .xt-toast__bar{background:var(--xt-warn)}.xt-toast--error .xt-toast__bar{background:var(--xt-danger)}@keyframes xt-toast-bar{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.xt-settings-backdrop{position:fixed;inset:0;z-index:2147483100;display:grid;place-items:center;padding:16px;background:var(--xt-backdrop);overscroll-behavior:none;touch-action:none}html.xt-scroll-lock,html.xt-scroll-lock body.xt-scroll-lock{overflow:hidden!important;overscroll-behavior:none}body.xt-scroll-lock{position:fixed;left:0;right:0;width:100%}.xt-settings{display:flex;flex-direction:column;width:min(920px,100%);max-height:min(90vh,800px);overflow:hidden;touch-action:auto;overscroll-behavior:contain;border-radius:16px;border:1px solid var(--xt-border);background:var(--xt-surface);color:var(--xt-fg);box-shadow:var(--xt-shadow);font:inherit}.xt-settings__header{display:grid;grid-template-columns:40px 1fr 40px;align-items:center;gap:.5rem;min-height:53px;padding:0 8px;border-bottom:1px solid var(--xt-border)}.xt-settings__heading{display:flex;flex-direction:column;align-items:center;justify-content:center;min-width:0;text-align:center}.xt-settings__heading h2{margin:0;font-size:20px;font-weight:700;line-height:24px;letter-spacing:0}.xt-settings__ver{margin:.1rem 0 0;font-size:13px;font-weight:400;letter-spacing:0;text-transform:none;color:var(--xt-fg-muted)}.xt-settings__x{appearance:none;display:grid;place-items:center;width:34px;height:34px;margin:0;border:0;border-radius:999px;background:transparent;color:var(--xt-fg);cursor:pointer;transition:background .15s ease}.xt-settings__x:hover{background:var(--xt-hover)}.xt-settings__x svg{width:20px;height:20px;display:block}.xt-settings__header-spacer{width:34px;height:34px}.xt-settings__tabs{position:relative;display:flex;flex:0 0 auto;gap:0;padding:0;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;scroll-behavior:smooth;border-bottom:1px solid var(--xt-border);background:transparent;scrollbar-width:thin}.xt-settings__tab-ink{position:absolute;left:0;bottom:0;height:4px;width:0;border-radius:999px;background:var(--xt-accent);pointer-events:none;transition:transform .2s ease,width .2s ease}.xt-settings__tab{flex:1 0 auto;appearance:none;position:relative;z-index:1;display:inline-flex;align-items:center;justify-content:center;gap:.35rem;margin:0;min-height:53px;padding:12px 16px;border:0;background:transparent;color:var(--xt-fg-muted);cursor:pointer;font:inherit;font-size:15px;font-weight:700;letter-spacing:0;white-space:nowrap;line-height:20px;border-radius:0;transition:background-color .15s ease,color .15s ease}.xt-settings__tab-label{flex:0 0 auto}.xt-settings__badge{display:inline-flex;align-items:center;max-width:6.5rem;overflow:hidden;text-overflow:ellipsis;padding:.1rem .4rem;border-radius:999px;border:1px solid var(--xt-border);background:var(--xt-inset);color:var(--xt-fg-muted);font-size:11px;font-weight:500;letter-spacing:0;font-variant-numeric:tabular-nums;line-height:1.2}.xt-settings__tab.is-active .xt-settings__badge,.xt-settings__badge--cache[data-level=ok],.xt-settings__badge--cache[data-level=warn],.xt-settings__badge--cache[data-level=high],.xt-settings__badge--cache[data-level=off]{border-color:var(--xt-border);background:var(--xt-inset);color:var(--xt-fg-muted)}.xt-settings__tab:hover{color:var(--xt-fg);background:var(--xt-hover)}.xt-settings__tab.is-active{color:var(--xt-fg);background:transparent}.xt-settings__tab:focus-visible{outline:2px solid var(--xt-accent);outline-offset:-2px}.xt-settings__form{display:flex;flex-direction:column;flex:1 1 auto;min-height:0}.xt-settings__body{flex:1 1 auto;min-height:0;overflow:auto;padding:0}.xt-settings__panel{display:flex;flex-direction:column;gap:0;animation:xt-settings-panel-in .18s ease}.xt-settings__panel[hidden]{display:none}@keyframes xt-settings-panel-in{0%{opacity:0}to{opacity:1}}.xt-section{display:flex;flex-direction:column;gap:0;padding:0;border-radius:0;border:0;border-bottom:1px solid var(--xt-border);background:transparent}.xt-section:last-child{border-bottom:0}.xt-section__head{display:flex;flex-direction:column;gap:.15rem;padding:12px 16px 4px}.xt-section__title{margin:0;font-size:13px;font-weight:700;letter-spacing:0;text-transform:none;color:var(--xt-fg-muted)}.xt-section__desc{margin:0;font-size:13px;line-height:16px;color:var(--xt-fg-muted)}.xt-section__body{display:flex;flex-direction:column;gap:0;padding:4px 16px 16px}.xt-section__actions{display:flex;align-items:flex-end}.xt-grid{display:grid;gap:12px}.xt-field{display:flex;flex-direction:column;gap:.35rem;font-size:15px;min-width:0;padding:8px 0}.xt-field__label{font-size:13px;font-weight:700;color:var(--xt-fg)}.xt-field__hint{font-size:13px;line-height:16px;color:var(--xt-fg-muted)}.xt-field select,.xt-field input[type=number],.xt-field input[type=text],.xt-field input[type=password],.xt-field input[type=url],.xt-allowlist-add input,.xt-allowlist-add select{appearance:none;width:100%;box-sizing:border-box;border-radius:4px;border:1px solid var(--xt-input-border);background:var(--xt-input-bg);color:var(--xt-fg);font:inherit;font-size:15px;line-height:20px;padding:8px 12px;outline:none;transition:border-color .15s ease,box-shadow .15s ease}.xt-field input::placeholder,.xt-allowlist-add input::placeholder{color:var(--xt-fg-muted)}.xt-field select:hover,.xt-field input:hover,.xt-allowlist-add input:hover,.xt-allowlist-add select:hover{border-color:var(--xt-fg-muted)}.xt-field select:focus,.xt-field input:focus,.xt-allowlist-add input:focus,.xt-allowlist-add select:focus{border-color:var(--xt-accent);box-shadow:0 0 0 1px var(--xt-accent)}.xt-replace-options[hidden],.xt-auto-options[hidden],.xt-allowlist-panel[hidden]{display:none!important}.xt-auto-options,.xt-replace-options{display:flex;flex-direction:column;gap:0;min-width:0}.xt-auto-options{padding:4px 0 0;border-radius:0;border:0;border-top:1px solid var(--xt-border);background:transparent;margin-top:4px}.xt-list-editor{display:flex;flex-direction:column;gap:8px;min-width:0;padding:12px 0 4px;border-radius:0;border:0;border-top:1px solid var(--xt-border);background:transparent}.xt-list-editor__title{font-size:15px;font-weight:700;color:var(--xt-fg)}.xt-list-editor__hint{margin:.1rem 0 0;font-size:13px;line-height:16px;color:var(--xt-fg-muted)}.xt-list-editor__host{min-height:1.5rem}.xt-allowlist-panel{display:flex;flex-direction:column;gap:.55rem}.xt-allowlist-add{display:flex;gap:8px;align-items:stretch}.xt-allowlist-add input,.xt-allowlist-add select{flex:1 1 auto;min-width:0}.xt-allowlist{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:6px}.xt-allowlist__item{display:inline-flex;align-items:center;gap:.25rem;max-width:100%;padding:4px 4px 4px 10px;border-radius:999px;border:1px solid var(--xt-border);background:var(--xt-inset)}.xt-allowlist__handle{font-size:13px;font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--xt-fg)}.xt-allowlist__remove{appearance:none;flex:0 0 auto;width:22px;height:22px;border:0;border-radius:999px;background:transparent;color:var(--xt-fg-muted);cursor:pointer;font:inherit;font-size:15px;line-height:1}.xt-allowlist__remove:hover{background:var(--xt-danger-bg);color:var(--xt-danger)}.xt-empty{margin:0;font-size:13px;color:var(--xt-fg-muted)}.xt-field select option{background-color:var(--xt-option-bg);color:var(--xt-fg)}.xt-check{position:relative;display:flex;align-items:flex-start;justify-content:space-between;gap:12px;font-size:15px;cursor:pointer;padding:12px 0}.xt-check--card{margin:0;padding:12px 0;border-radius:0;border:0;border-top:1px solid var(--xt-border);background:transparent}.xt-check__text{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1 1 auto}.xt-check input{position:absolute;opacity:0;width:1px;height:1px;margin:0;pointer-events:none}.xt-check__track{position:relative;flex:0 0 auto;width:40px;height:24px;margin-top:0;border-radius:999px;background:var(--xt-toggle-off);transition:background .15s ease}.xt-check__track:after{content:"";position:absolute;top:2px;left:2px;width:20px;height:20px;border-radius:50%;background:#fff;box-shadow:0 0 2px #0003;transition:transform .15s ease}.xt-check input:checked+.xt-check__track{background:var(--xt-accent)}.xt-check input:checked+.xt-check__track:after{transform:translate(16px)}.xt-check input:focus-visible+.xt-check__track{outline:2px solid var(--xt-accent);outline-offset:2px}.xt-check__title{display:block;font-weight:700;color:var(--xt-fg)}.xt-check__hint{display:block;margin-top:.15rem;font-size:13px;line-height:16px;font-weight:400;color:var(--xt-fg-muted)}.xt-hint{margin:0;padding:4px 0 8px;font-size:13px;line-height:16px;color:var(--xt-fg-muted)}.xt-settings__actions{display:flex;flex-wrap:wrap;align-items:center;gap:12px;padding:12px 16px;border-top:1px solid var(--xt-border);background:var(--xt-surface)}.xt-settings__primary,.xt-settings__ghost{appearance:none;border-radius:9999px;font:inherit;font-size:15px;font-weight:700;line-height:20px;padding:8px 16px;cursor:pointer;transition:background .15s ease,border-color .15s ease,opacity .15s ease}.xt-settings__primary{border:0;background:var(--xt-accent);color:#fff;min-height:36px}.xt-settings__primary:hover{background:var(--xt-accent-hover)}.xt-settings__ghost{border:1px solid var(--xt-border);background:transparent;color:var(--xt-fg);align-self:flex-start}.xt-settings__ghost--compact{flex:0 0 auto;padding:8px 16px;align-self:stretch}.xt-settings__ghost:hover{background:var(--xt-hover)}.xt-settings__ghost--danger{border-color:var(--xt-danger-border);color:var(--xt-danger)}.xt-settings__ghost--danger:hover{background:var(--xt-danger-bg);border-color:var(--xt-danger-border)}.xt-about{display:flex;flex-direction:column;gap:12px;padding:16px;border-radius:0;border:0;background:transparent}.xt-about__foot{margin:0;font-size:13px;color:var(--xt-fg-muted)}@media(max-width:720px){.xt-settings-backdrop{padding:0;align-items:end}.xt-settings{width:100%;max-height:92vh;border-radius:16px 16px 0 0;border-left:0;border-right:0;border-bottom:0}.xt-toast-host{top:12px;right:12px;width:min(356px,calc(100vw - 24px))}}.xt-provider-panels{display:flex;flex-direction:column;gap:0}.xt-provider-fields{display:none;flex-direction:column;gap:0;padding:4px 0 0;border-radius:0;border:0;border-top:1px solid var(--xt-border);background:transparent}.xt-provider-fields.is-active{display:flex}.xt-cache-meter{display:flex;flex-direction:column;gap:8px;padding:12px 0;border-radius:0;border:0;background:transparent}.xt-cache-meter__top{display:flex;align-items:baseline;justify-content:space-between;gap:.75rem}.xt-cache-meter__title{font-size:13px;font-weight:700;letter-spacing:0;text-transform:none;color:var(--xt-fg-muted)}.xt-cache-meter__pct{font-size:20px;font-weight:700;font-variant-numeric:tabular-nums;color:var(--xt-accent);line-height:1}.xt-cache-meter[data-level=warn] .xt-cache-meter__pct{color:var(--xt-warn)}.xt-cache-meter[data-level=high] .xt-cache-meter__pct{color:var(--xt-danger)}.xt-cache-meter[data-level=off] .xt-cache-meter__pct{color:var(--xt-fg-muted)}.xt-cache-meter__used{font-size:15px;font-weight:700;font-variant-numeric:tabular-nums;color:var(--xt-fg)}.xt-cache-meter__bar{position:relative;height:4px;border-radius:999px;overflow:hidden;background:var(--xt-border);border:0}.xt-cache-meter__fill{display:block;height:100%;border-radius:inherit;background:var(--xt-accent);transition:width .28s cubic-bezier(.22,1,.36,1)}.xt-cache-meter[data-level=warn] .xt-cache-meter__fill{background:var(--xt-warn)}.xt-cache-meter[data-level=high] .xt-cache-meter__fill{background:var(--xt-danger)}.xt-cache-meter[data-level=off] .xt-cache-meter__fill{background:var(--xt-fg-muted)}.xt-cache-meter__meta{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem .35rem;font-size:13px;color:var(--xt-fg-muted);font-variant-numeric:tabular-nums}.xt-cache-meter__dot{opacity:.5}.xt-cache-meter__hint{margin:.1rem 0 0;font-size:13px;line-height:16px;color:var(--xt-fg-muted)}.xt-about__desc{margin:0;font-size:15px;line-height:20px;color:var(--xt-fg)}.xt-about__repo{display:inline-flex;align-items:center;align-self:flex-start;gap:.35rem;color:var(--xt-link);font-size:15px;font-weight:400;text-decoration:none}.xt-about__repo:hover{text-decoration:underline}.xt-about__author{display:flex;align-items:center;gap:12px;margin-top:4px;padding:12px 0;border-radius:0;border:0;border-top:1px solid var(--xt-border);border-bottom:1px solid var(--xt-border);background:transparent}.xt-about__avatar{flex:0 0 auto;width:48px;height:48px;border-radius:50%;object-fit:cover;background:var(--xt-elevated)}.xt-about__meta{display:flex;flex-direction:column;gap:.1rem;min-width:0}.xt-about__name{color:var(--xt-fg);font-weight:700;font-size:15px;text-decoration:none}.xt-about__name:hover{color:var(--xt-link);text-decoration:underline}.xt-about__handle{font-size:15px;color:var(--xt-fg-muted)}.xt-about__email{color:var(--xt-link);font-size:13px;text-decoration:none;word-break:break-all}.xt-about__email:hover{text-decoration:underline} '); (function () { 'use strict'; var e=(()=>"undefined"!=typeof GM_getValue?GM_getValue:void 0)(),t=(()=>"undefined"!=typeof GM_registerMenuCommand?GM_registerMenuCommand:void 0)(),n=(()=>"undefined"!=typeof GM_setValue?GM_setValue:void 0)(),a=(()=>"undefined"!=typeof GM_xmlhttpRequest?GM_xmlhttpRequest:void 0)();const o=Object.freeze(["google","deepl","microsoft","openai","yandex","libretranslate"]),i=Object.freeze([{id:"google",name:"Google Translate",badge:"Google",hintKey:"providerHintGoogle",fields:[]},{id:"deepl",name:"DeepL",badge:"DeepL",hintKey:"providerHintDeepl",fields:[{key:"apiKey",type:"password",labelKey:"providerFieldApiKey",hintKey:"providerHintDeeplKey",placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:fx",required:true},{key:"plan",type:"select",labelKey:"providerFieldDeeplPlan",options:[{value:"free",labelKey:"providerDeeplPlanFree"},{value:"pro",labelKey:"providerDeeplPlanPro"}]}]},{id:"microsoft",name:"Microsoft Translator",badge:"Azure",hintKey:"providerHintMicrosoft",fields:[{key:"apiKey",type:"password",labelKey:"providerFieldApiKey",required:true},{key:"region",type:"text",labelKey:"providerFieldRegion",hintKey:"providerHintMicrosoftRegion",placeholder:"global",required:true}]},{id:"openai",name:"OpenAI",badge:"OpenAI",hintKey:"providerHintOpenai",fields:[{key:"apiKey",type:"password",labelKey:"providerFieldApiKey",required:true},{key:"model",type:"text",labelKey:"providerFieldModel",placeholder:"gpt-4o-mini"},{key:"baseUrl",type:"url",labelKey:"providerFieldBaseUrl",hintKey:"providerHintOpenaiBase",placeholder:"https://api.openai.com/v1"}]},{id:"yandex",name:"Yandex Translate",badge:"Yandex",hintKey:"providerHintYandex",fields:[{key:"apiKey",type:"password",labelKey:"providerFieldApiKey",required:true},{key:"folderId",type:"text",labelKey:"providerFieldFolderId",hintKey:"providerHintYandexFolder",required:true}]},{id:"libretranslate",name:"LibreTranslate",badge:"Libre",hintKey:"providerHintLibre",fields:[{key:"apiUrl",type:"url",labelKey:"providerFieldApiUrl",placeholder:"https://libretranslate.com",required:true},{key:"apiKey",type:"password",labelKey:"providerFieldApiKeyOptional"}]}]),r=Object.freeze({google:{},deepl:{apiKey:"",plan:"free"},microsoft:{apiKey:"",region:"global"},openai:{apiKey:"",model:"gpt-4o-mini",baseUrl:"https://api.openai.com/v1"},yandex:{apiKey:"",folderId:""},libretranslate:{apiUrl:"https://libretranslate.com",apiKey:""}});function l(e){return i.find(t=>t.id===e)||i[0]}function s(e){return o.includes(e)}function c(e){const t={};for(const n of o)t[n]={...r[n],...e&&"object"==typeof e[n]&&e[n]?e[n]:{}};return t}const d="nemoking1210@gmail.com",u="1.3.1",p="xt_settings",g="xt_cache_v1",v="data-xt-root",m="data-xt-post",h="data-xt-btn",f="data-xt-result",b="data-xt-toolbar",A="data-xt-nav",y="data-xt-menu",x=2097152,S=['[data-testid="tweetText"]'],L=Object.freeze([{code:"en",name:"English",flag:"🇺🇸"},{code:"ru",name:"Русский",flag:"🇷🇺"},{code:"uk",name:"Українська",flag:"🇺🇦"},{code:"be",name:"Беларуская",flag:"🇧🇾"},{code:"zh-CN",name:"中文(简体)",flag:"🇨🇳"},{code:"zh-TW",name:"中文(繁體)",flag:"🇹🇼"},{code:"ja",name:"日本語",flag:"🇯🇵"},{code:"ko",name:"한국어",flag:"🇰🇷"},{code:"es",name:"Español",flag:"🇪🇸"},{code:"pt",name:"Português",flag:"🇧🇷"},{code:"de",name:"Deutsch",flag:"🇩🇪"},{code:"fr",name:"Français",flag:"🇫🇷"},{code:"it",name:"Italiano",flag:"🇮🇹"},{code:"pl",name:"Polski",flag:"🇵🇱"},{code:"nl",name:"Nederlands",flag:"🇳🇱"},{code:"tr",name:"Türkçe",flag:"🇹🇷"},{code:"ar",name:"العربية",flag:"🇸🇦"},{code:"he",name:"עברית",flag:"🇮🇱"},{code:"hi",name:"हिन्दी",flag:"🇮🇳"},{code:"bn",name:"বাংলা",flag:"🇧🇩"},{code:"th",name:"ไทย",flag:"🇹🇭"},{code:"vi",name:"Tiếng Việt",flag:"🇻🇳"},{code:"id",name:"Bahasa Indonesia",flag:"🇮🇩"},{code:"ms",name:"Bahasa Melayu",flag:"🇲🇾"},{code:"sv",name:"Svenska",flag:"🇸🇪"},{code:"no",name:"Norsk",flag:"🇳🇴"},{code:"da",name:"Dansk",flag:"🇩🇰"},{code:"fi",name:"Suomi",flag:"🇫🇮"},{code:"cs",name:"Čeština",flag:"🇨🇿"},{code:"sk",name:"Slovenčina",flag:"🇸🇰"},{code:"ro",name:"Română",flag:"🇷🇴"},{code:"hu",name:"Magyar",flag:"🇭🇺"},{code:"el",name:"Ελληνικά",flag:"🇬🇷"},{code:"bg",name:"Български",flag:"🇧🇬"},{code:"sr",name:"Српски",flag:"🇷🇸"},{code:"hr",name:"Hrvatski",flag:"🇭🇷"},{code:"lt",name:"Lietuvių",flag:"🇱🇹"},{code:"lv",name:"Latviešu",flag:"🇱🇻"},{code:"et",name:"Eesti",flag:"🇪🇪"},{code:"fa",name:"فارسی",flag:"🇮🇷"}]),w={cacheHours:24,uiLocale:"auto",targetLang:"auto",translateMode:"button",displayMode:"panel",replaceReveal:"button",autoScope:"all",autoAllowlist:[],accountBlocklist:[],langAllowlist:[],langBlocklist:[],skipNativeAutoTranslate:true,provider:"google",providerConfig:c(null)},T={en:{menuSettings:"X Translator — Settings",navSettings:"Translator",btnTranslate:"Translate",btnHide:"Hide translation",btnRetry:"Retry",translating:"Translating…",translationLabel:"Translation",detectedLang:"Detected: {lang}",errEmpty:"Nothing to translate",errNetwork:"Translation failed. Try again.",settingsTitle:"X Translator",sectionGeneral:"General",sectionTranslation:"Translation",sectionCache:"Cache",sectionProviders:"Providers",settingsProvider:"Translation provider",settingsProviderHint:"Credentials are stored in userscript storage on this device only.",providerFieldApiKey:"API key",providerFieldApiKeyOptional:"API key (optional)",providerFieldDeeplPlan:"DeepL plan",providerDeeplPlanFree:"Free (api-free.deepl.com)",providerDeeplPlanPro:"Pro (api.deepl.com)",providerFieldRegion:"Region",providerFieldModel:"Model",providerFieldBaseUrl:"API base URL",providerFieldFolderId:"Folder ID",providerFieldApiUrl:"API URL",providerHintGoogle:"Uses Google’s public Translate endpoint. No API key required.",providerHintDeepl:"DeepL API Free or Pro. Create a key at deepl.com/pro-api.",providerHintDeeplKey:"Free keys usually end with :fx",providerHintMicrosoft:"Azure Translator resource key from the Azure portal.",providerHintMicrosoftRegion:"Use the resource region, or global for multi-service keys.",providerHintOpenai:"Chat Completions API. Compatible endpoints work if they speak OpenAI’s format.",providerHintOpenaiBase:"Default https://api.openai.com/v1 — change for proxies / compatible hosts.",providerHintYandex:"Yandex Cloud Translate API key + folder ID.",providerHintYandexFolder:"From the Yandex Cloud console (folder / catalog id).",providerHintLibre:"Self-hosted or public LibreTranslate instance.",errProviderConfig:"Provider is not configured. Open Translator settings → Providers.",sectionAbout:"About",aboutDescription:"Userscript that adds in-place post translation on X (x.com). Compatible with Tampermonkey, Violentmonkey, and similar managers.",aboutRepo:"Open repository on GitHub",aboutLicense:"MIT License",settingsGeneral:"General",settingsTargetLang:"Translate into",settingsUiLocale:"Interface language",settingsCacheHours:"Cache translations (hours)",settingsCacheHint:"0 disables the cache. Entries expire by TTL or when you clear the cache.",cacheMeterTitle:"Storage",cacheMeterUsed:"{used} / {limit}",cacheMeterEntries:"{count} entries",cacheMeterTtl:"TTL {hours}h",cacheMeterDisabled:"Cache off",cacheMeterFree:"{free} free",cacheMeterAria:"Cache {used} of {limit} ({pct}), {count} entries",cacheMeterHint:"Soft budget for GM storage. Oldest entries are evicted when full.",settingsDisplayMode:"Translation display",settingsDisplayModeHint:"Panel: show translation under the post. Replace: swap the post text and offer Show original.",displayModePanel:"Separate panel",displayModeReplace:"Replace original text",btnShowOriginal:"Show original",settingsTranslateMode:"Translation mode",settingsTranslateModeHint:"Automatic: translate as soon as a post is even slightly visible on screen. Button: only when you tap Translate.",translateModeButton:"On button click",translateModeAuto:"Automatic (on screen)",badgeModeAuto:"Auto",settingsAutoScope:"Auto-translate scope",settingsAutoScopeHint:"Choose whether every visible post is translated, or only accounts you pick.",autoScopeAll:"All accounts",autoScopeAllowlist:"Selected accounts only",settingsAllowlistHint:"You can also add or remove accounts from a post’s ⋮ menu.",allowlistPlaceholder:"@username",allowlistAdd:"Add",allowlistRemove:"Remove",allowlistEmpty:"No accounts yet. Add a nickname above.",allowlistInvalid:"Enter a valid X handle.",allowlistExists:"{handle} is already in the list",allowlistAdded:"Added {handle} to auto-translate",allowlistRemoved:"Removed {handle} from auto-translate",menuAddAutoAccount:"Auto-translate this account",menuRemoveAutoAccount:"Remove from auto-translate",settingsSave:"Save",settingsClose:"Close",settingsClearCache:"Clear cache",settingsSaved:"Settings saved",settingsCacheCleared:"Translation cache cleared",toastCacheClearedOnUpdate:"Cache cleared after update to {version}",toastCacheClearedOnUpdateTitle:"Updated",toastTitleSuccess:"Success",toastTitleInfo:"Info",toastTitleWarning:"Notice",toastTitleError:"Error",toastDismiss:"Dismiss",langAuto:"Auto (match UI / browser)",localeAuto:"Auto (browser)",badgeLangAuto:"Auto",originalLabel:"Original",settingsReplaceReveal:"Replace mode details",settingsReplaceRevealHint:"Button only, peek original on hover (hides the button after translate), or show original and translation together.",replaceRevealButton:"Button only",replaceRevealHover:"Show original on hover",replaceRevealSplit:"Split view (original + translation)",settingsAccountBlocklist:"Account blocklist",settingsAccountBlocklistHint:"Never show Translate and never auto-translate these accounts. Also available from a post's menu.",blocklistEmpty:"No blocked accounts.",blocklistAdded:"Blocked {handle} from translation",blocklistRemoved:"Unblocked {handle}",menuBlockAccount:"Never translate this account",menuUnblockAccount:"Allow translating this account",settingsLangAllowlist:"Source language allowlist",settingsLangAllowlistHint:"If not empty, only posts detected as these languages are translated. Leave empty for all.",settingsLangBlocklist:"Source language blocklist",settingsLangBlocklistHint:"Skip posts detected as these languages.",settingsSkipNative:"Skip posts X already auto-translated",settingsSkipNativeHint:"When X shows its translation bar (Show original), don’t add Translate or auto-translate.",langListEmpty:"No languages selected.",langListAdd:"Add",langListExists:"{lang} is already in the list",langSkippedBlocked:"Skipped: source language is blocked",langSkippedNotAllowed:"Skipped: source language is not in the allowlist",settingsSectionInterface:"Interface",settingsSectionTranslate:"Translation",settingsSectionAccounts:"Accounts",settingsSectionLanguages:"Languages",settingsSectionProvider:"Provider",settingsSectionCache:"Cache",badgeCacheOff:"Off"},ru:{menuSettings:"X Translator — Настройки",navSettings:"Переводчик",btnTranslate:"Перевести",btnHide:"Скрыть перевод",btnRetry:"Повторить",translating:"Перевод…",translationLabel:"Перевод",detectedLang:"Определён язык: {lang}",errEmpty:"Нечего переводить",errNetwork:"Не удалось перевести. Попробуйте ещё раз.",settingsTitle:"X Translator",sectionGeneral:"Общие",sectionTranslation:"Перевод",sectionCache:"Кэш",sectionProviders:"Провайдеры",settingsProvider:"Провайдер перевода",settingsProviderHint:"Ключи хранятся только в хранилище userscript на этом устройстве.",providerFieldApiKey:"API-ключ",providerFieldApiKeyOptional:"API-ключ (необязательно)",providerFieldDeeplPlan:"Тариф DeepL",providerDeeplPlanFree:"Free (api-free.deepl.com)",providerDeeplPlanPro:"Pro (api.deepl.com)",providerFieldRegion:"Регион",providerFieldModel:"Модель",providerFieldBaseUrl:"Базовый URL API",providerFieldFolderId:"Folder ID",providerFieldApiUrl:"URL API",providerHintGoogle:"Публичный endpoint Google Translate. API-ключ не нужен.",providerHintDeepl:"DeepL API Free или Pro. Ключ: deepl.com/pro-api.",providerHintDeeplKey:"У бесплатных ключей обычно суффикс :fx",providerHintMicrosoft:"Ключ ресурса Azure Translator из портала Azure.",providerHintMicrosoftRegion:"Регион ресурса или global для multi-service ключей.",providerHintOpenai:"Chat Completions API. Подойдут совместимые endpoint’ы.",providerHintOpenaiBase:"По умолчанию https://api.openai.com/v1 — смените для прокси.",providerHintYandex:"API-ключ Yandex Cloud Translate и folder ID.",providerHintYandexFolder:"Из консоли Yandex Cloud (id каталога).",providerHintLibre:"Свой или публичный экземпляр LibreTranslate.",errProviderConfig:"Провайдер не настроен. Откройте Translator → Провайдеры.",sectionAbout:"О скрипте",aboutDescription:"Userscript для перевода постов прямо на X (x.com). Совместим с Tampermonkey, Violentmonkey и похожими менеджерами.",aboutRepo:"Открыть репозиторий на GitHub",aboutLicense:"Лицензия MIT",settingsGeneral:"Общие",settingsTargetLang:"Переводить на",settingsUiLocale:"Язык интерфейса",settingsCacheHours:"Кэш переводов (часы)",settingsCacheHint:"0 отключает кэш. Записи истекают по TTL или при ручной очистке.",cacheMeterTitle:"Занято",cacheMeterUsed:"{used} / {limit}",cacheMeterEntries:"{count} записей",cacheMeterTtl:"TTL {hours} ч",cacheMeterDisabled:"Кэш выкл.",cacheMeterFree:"свободно {free}",cacheMeterAria:"Кэш {used} из {limit} ({pct}), записей: {count}",cacheMeterHint:"Мягкий лимит GM-хранилища. При переполнении удаляются самые старые записи.",settingsDisplayMode:"Отображение перевода",settingsDisplayModeHint:"Панель: перевод под постом. Замена: текст поста меняется на перевод, кнопка «Показать оригинал».",displayModePanel:"Отдельная панель",displayModeReplace:"Вместо оригинала",btnShowOriginal:"Показать оригинал",settingsTranslateMode:"Режим перевода",settingsTranslateModeHint:"Автоматический: перевод, как только пост хоть чуть-чуть виден на экране. По кнопке: только после нажатия «Перевести».",translateModeButton:"По кнопке",translateModeAuto:"Автоматический (на экране)",badgeModeAuto:"Авто",settingsAutoScope:"Область автоперевода",settingsAutoScopeHint:"Переводить все видимые посты или только выбранные аккаунты.",autoScopeAll:"Все аккаунты",autoScopeAllowlist:"Только избранные аккаунты",settingsAllowlistHint:"Аккаунт можно добавить или убрать и из меню ⋮ у поста.",allowlistPlaceholder:"@username",allowlistAdd:"Добавить",allowlistRemove:"Удалить",allowlistEmpty:"Список пуст. Введите nickname выше.",allowlistInvalid:"Введите корректный X handle.",allowlistExists:"{handle} уже в списке",allowlistAdded:"{handle} добавлен в автоперевод",allowlistRemoved:"{handle} убран из автоперевода",menuAddAutoAccount:"Автоперевод этого аккаунта",menuRemoveAutoAccount:"Убрать из автоперевода",settingsSave:"Сохранить",settingsClose:"Закрыть",settingsClearCache:"Очистить кэш",settingsSaved:"Настройки сохранены",settingsCacheCleared:"Кэш переводов очищен",toastCacheClearedOnUpdate:"Кэш очищен после обновления до {version}",toastCacheClearedOnUpdateTitle:"Обновлено",toastTitleSuccess:"Готово",toastTitleInfo:"Инфо",toastTitleWarning:"Внимание",toastTitleError:"Ошибка",toastDismiss:"Закрыть",langAuto:"Авто (как UI / браузер)",localeAuto:"Авто (браузер)",badgeLangAuto:"Авто",originalLabel:"Оригинал",settingsReplaceReveal:"Детали режима замены",settingsReplaceRevealHint:"Только кнопка, оригинал по наведению (кнопка скрывается после перевода) или оригинал и перевод рядом.",replaceRevealButton:"Только кнопка",replaceRevealHover:"Оригинал по наведению",replaceRevealSplit:"Разделённый вид (оригинал + перевод)",settingsAccountBlocklist:"Блоклист аккаунтов",settingsAccountBlocklistHint:"Не показывать «Перевести» и не автопереводить эти аккаунты. Также из меню поста.",blocklistEmpty:"Заблокированных аккаунтов нет.",blocklistAdded:"{handle} исключён из перевода",blocklistRemoved:"{handle} снова можно переводить",menuBlockAccount:"Не переводить этот аккаунт",menuUnblockAccount:"Разрешить перевод этого аккаунта",settingsLangAllowlist:"Разрешённые языки оригинала",settingsLangAllowlistHint:"Если список не пуст — переводятся только посты на этих языках. Пустой список = все языки.",settingsLangBlocklist:"Запрещённые языки оригинала",settingsLangBlocklistHint:"Пропускать посты на этих языках.",settingsSkipNative:"Пропускать посты с автопереводом X",settingsSkipNativeHint:"Если X уже показывает панель перевода («Показать оригинал»), не добавлять нашу кнопку и не автопереводить.",langListEmpty:"Языки не выбраны.",langListAdd:"Добавить",langListExists:"{lang} уже в списке",langSkippedBlocked:"Пропущено: язык в блоклисте",langSkippedNotAllowed:"Пропущено: языка нет в списке разрешённых",settingsSectionInterface:"Интерфейс",settingsSectionTranslate:"Перевод",settingsSectionAccounts:"Аккаунты",settingsSectionLanguages:"Языки",settingsSectionProvider:"Провайдер",settingsSectionCache:"Кэш",badgeCacheOff:"Выкл"},zh:{menuSettings:"X Translator — 设置",navSettings:"翻译",btnTranslate:"翻译",btnHide:"隐藏翻译",btnRetry:"重试",translating:"翻译中…",translationLabel:"译文",detectedLang:"检测到:{lang}",errEmpty:"没有可翻译的内容",errNetwork:"翻译失败,请重试。",settingsTitle:"X Translator",sectionGeneral:"常规",sectionTranslation:"翻译",sectionCache:"缓存",sectionProviders:"服务商",settingsProvider:"翻译服务商",settingsProviderHint:"密钥仅保存在本机的 userscript 存储中。",providerFieldApiKey:"API 密钥",providerFieldApiKeyOptional:"API 密钥(可选)",providerFieldDeeplPlan:"DeepL 套餐",providerDeeplPlanFree:"Free (api-free.deepl.com)",providerDeeplPlanPro:"Pro (api.deepl.com)",providerFieldRegion:"区域",providerFieldModel:"模型",providerFieldBaseUrl:"API 基址",providerFieldFolderId:"Folder ID",providerFieldApiUrl:"API URL",providerHintGoogle:"使用 Google 公开翻译接口,无需 API 密钥。",providerHintDeepl:"DeepL API Free 或 Pro。在 deepl.com/pro-api 创建密钥。",providerHintDeeplKey:"免费密钥通常以 :fx 结尾",providerHintMicrosoft:"Azure 门户中的 Translator 资源密钥。",providerHintMicrosoftRegion:"填写资源区域,或多服务密钥可用 global。",providerHintOpenai:"Chat Completions API。兼容 OpenAI 格式的接口也可。",providerHintOpenaiBase:"默认 https://api.openai.com/v1,代理可改。",providerHintYandex:"Yandex Cloud Translate 的 API 密钥与 folder ID。",providerHintYandexFolder:"来自 Yandex Cloud 控制台。",providerHintLibre:"自建或公共 LibreTranslate 实例。",errProviderConfig:"服务商未配置。请打开 Translator 设置 → 服务商。",sectionAbout:"关于",aboutDescription:"在 X(x.com)上就地翻译帖子的用户脚本。兼容 Tampermonkey、Violentmonkey 等管理器。",aboutRepo:"在 GitHub 打开仓库",aboutLicense:"MIT 许可证",settingsGeneral:"常规",settingsTargetLang:"翻译为",settingsUiLocale:"界面语言",settingsCacheHours:"翻译缓存(小时)",settingsCacheHint:"设为 0 可禁用缓存。条目按 TTL 过期,或可手动清空。",cacheMeterTitle:"占用",cacheMeterUsed:"{used} / {limit}",cacheMeterEntries:"{count} 条",cacheMeterTtl:"TTL {hours} 小时",cacheMeterDisabled:"缓存已关闭",cacheMeterFree:"剩余 {free}",cacheMeterAria:"缓存 {used} / {limit}({pct}),共 {count} 条",cacheMeterHint:"GM 存储的软性上限。满时会淘汰最旧条目。",settingsDisplayMode:"译文显示方式",settingsDisplayModeHint:"面板:在帖子下方显示译文。替换:用译文替换原文,并提供“显示原文”。",displayModePanel:"单独面板",displayModeReplace:"替换原文",btnShowOriginal:"显示原文",settingsTranslateMode:"翻译模式",settingsTranslateModeHint:"自动:帖子只要在屏幕上露出一点就开始翻译。按钮:仅在点击「翻译」时。",translateModeButton:"点击按钮",translateModeAuto:"自动(出现在屏幕上)",badgeModeAuto:"自动",settingsAutoScope:"自动翻译范围",settingsAutoScopeHint:"翻译所有可见帖子,或仅翻译你选择的账号。",autoScopeAll:"所有账号",autoScopeAllowlist:"仅选定账号",settingsAllowlistHint:"也可在帖子 ⋮ 菜单中添加或移除账号。",allowlistPlaceholder:"@username",allowlistAdd:"添加",allowlistRemove:"移除",allowlistEmpty:"暂无账号。请在上方输入昵称。",allowlistInvalid:"请输入有效的 X 用户名。",allowlistExists:"{handle} 已在列表中",allowlistAdded:"已将 {handle} 加入自动翻译",allowlistRemoved:"已将 {handle} 移出自动翻译",menuAddAutoAccount:"自动翻译此账号",menuRemoveAutoAccount:"移出自动翻译",settingsSave:"保存",settingsClose:"关闭",settingsClearCache:"清除缓存",settingsSaved:"设置已保存",settingsCacheCleared:"翻译缓存已清除",toastCacheClearedOnUpdate:"已更新至 {version},缓存已清除",toastCacheClearedOnUpdateTitle:"已更新",toastTitleSuccess:"成功",toastTitleInfo:"提示",toastTitleWarning:"注意",toastTitleError:"错误",toastDismiss:"关闭",langAuto:"自动(跟随界面 / 浏览器)",localeAuto:"自动(浏览器)",badgeLangAuto:"自动",originalLabel:"原文",settingsReplaceReveal:"替换模式详情",settingsReplaceRevealHint:"仅按钮、悬停显示原文,或原文与译文并排。",replaceRevealButton:"仅按钮",replaceRevealHover:"悬停显示原文",replaceRevealSplit:"分栏(原文 + 译文)",settingsAccountBlocklist:"账号黑名单",settingsAccountBlocklistHint:"不显示翻译按钮且不自动翻译这些账号。也可在帖子菜单中管理。",blocklistEmpty:"暂无屏蔽账号。",blocklistAdded:"已屏蔽 {handle}",blocklistRemoved:"已取消屏蔽 {handle}",menuBlockAccount:"永不翻译此账号",menuUnblockAccount:"允许翻译此账号",settingsLangAllowlist:"源语言白名单",settingsLangAllowlistHint:"非空时仅翻译检测到的这些语言。留空表示全部。",settingsLangBlocklist:"源语言黑名单",settingsLangBlocklistHint:"跳过这些源语言的帖子。",settingsSkipNative:"跳过已被 X 自动翻译的帖子",settingsSkipNativeHint:"当 X 已显示翻译栏(显示原文)时,不添加翻译按钮,也不自动翻译。",langListEmpty:"尚未选择语言。",langListAdd:"添加",langListExists:"{lang} 已在列表中",langSkippedBlocked:"已跳过:源语言在黑名单中",langSkippedNotAllowed:"已跳过:源语言不在白名单中",settingsSectionInterface:"界面",settingsSectionTranslate:"翻译",settingsSectionAccounts:"账号",settingsSectionLanguages:"语言",settingsSectionProvider:"服务商",settingsSectionCache:"缓存",badgeCacheOff:"关"},es:{menuSettings:"X Translator — Ajustes",navSettings:"Traductor",btnTranslate:"Traducir",btnHide:"Ocultar traducción",btnRetry:"Reintentar",translating:"Traduciendo…",translationLabel:"Traducción",detectedLang:"Detectado: {lang}",errEmpty:"No hay nada que traducir",errNetwork:"Error al traducir. Inténtalo de nuevo.",settingsTitle:"X Translator",sectionGeneral:"General",sectionTranslation:"Traducción",sectionCache:"Caché",sectionProviders:"Proveedores",settingsProvider:"Proveedor de traducción",settingsProviderHint:"Las credenciales se guardan solo en el almacenamiento del userscript de este dispositivo.",providerFieldApiKey:"Clave API",providerFieldApiKeyOptional:"Clave API (opcional)",providerFieldDeeplPlan:"Plan DeepL",providerDeeplPlanFree:"Free (api-free.deepl.com)",providerDeeplPlanPro:"Pro (api.deepl.com)",providerFieldRegion:"Región",providerFieldModel:"Modelo",providerFieldBaseUrl:"URL base de la API",providerFieldFolderId:"Folder ID",providerFieldApiUrl:"URL de la API",providerHintGoogle:"Endpoint público de Google Translate. No requiere clave.",providerHintDeepl:"DeepL API Free o Pro. Crea una clave en deepl.com/pro-api.",providerHintDeeplKey:"Las claves Free suelen terminar en :fx",providerHintMicrosoft:"Clave del recurso Azure Translator en el portal de Azure.",providerHintMicrosoftRegion:"Región del recurso, o global para claves multi-servicio.",providerHintOpenai:"API Chat Completions. Endpoints compatibles también sirven.",providerHintOpenaiBase:"Por defecto https://api.openai.com/v1 — cámbiala para proxies.",providerHintYandex:"Clave API de Yandex Cloud Translate + folder ID.",providerHintYandexFolder:"Desde la consola de Yandex Cloud.",providerHintLibre:"Instancia LibreTranslate propia o pública.",errProviderConfig:"Proveedor sin configurar. Abre Translator → Proveedores.",sectionAbout:"Acerca de",aboutDescription:"Userscript que traduce publicaciones de X in situ en x.com. Compatible con Tampermonkey, Violentmonkey y similares.",aboutRepo:"Abrir repositorio en GitHub",aboutLicense:"Licencia MIT",settingsGeneral:"General",settingsTargetLang:"Traducir a",settingsUiLocale:"Idioma de la interfaz",settingsCacheHours:"Caché de traducciones (horas)",settingsCacheHint:"0 desactiva la caché. Las entradas caducan por TTL o al vaciarla.",cacheMeterTitle:"Uso",cacheMeterUsed:"{used} / {limit}",cacheMeterEntries:"{count} entradas",cacheMeterTtl:"TTL {hours} h",cacheMeterDisabled:"Caché off",cacheMeterFree:"{free} libres",cacheMeterAria:"Caché {used} de {limit} ({pct}), {count} entradas",cacheMeterHint:"Límite blando del almacenamiento GM. Si se llena, se eliminan las entradas más antiguas.",settingsDisplayMode:"Visualización de la traducción",settingsDisplayModeHint:"Panel: mostrar la traducción bajo el post. Reemplazar: cambiar el texto y ofrecer Mostrar original.",displayModePanel:"Panel separado",displayModeReplace:"Reemplazar el original",btnShowOriginal:"Mostrar original",settingsTranslateMode:"Modo de traducción",settingsTranslateModeHint:"Automático: traduce en cuanto la publicación es visible aunque sea un poco. Botón: solo al pulsar Traducir.",translateModeButton:"Al pulsar el botón",translateModeAuto:"Automático (en pantalla)",badgeModeAuto:"Auto",settingsAutoScope:"Alcance del autotraducido",settingsAutoScopeHint:"Traducir todos los posts visibles o solo las cuentas que elijas.",autoScopeAll:"Todas las cuentas",autoScopeAllowlist:"Solo cuentas seleccionadas",settingsAllowlistHint:"También puedes añadir o quitar cuentas desde el menú ⋮ del post.",allowlistPlaceholder:"@username",allowlistAdd:"Añadir",allowlistRemove:"Quitar",allowlistEmpty:"Sin cuentas. Escribe un nickname arriba.",allowlistInvalid:"Introduce un handle de X válido.",allowlistExists:"{handle} ya está en la lista",allowlistAdded:"Se añadió {handle} al autotraducido",allowlistRemoved:"Se quitó {handle} del autotraducido",menuAddAutoAccount:"Autotraducir esta cuenta",menuRemoveAutoAccount:"Quitar del autotraducido",settingsSave:"Guardar",settingsClose:"Cerrar",settingsClearCache:"Vaciar caché",settingsSaved:"Ajustes guardados",settingsCacheCleared:"Caché de traducciones vaciada",toastCacheClearedOnUpdate:"Caché vaciada tras actualizar a {version}",toastCacheClearedOnUpdateTitle:"Actualizado",toastTitleSuccess:"Listo",toastTitleInfo:"Info",toastTitleWarning:"Aviso",toastTitleError:"Error",toastDismiss:"Cerrar",langAuto:"Auto (igual que UI / navegador)",localeAuto:"Auto (navegador)",badgeLangAuto:"Auto",originalLabel:"Original",settingsReplaceReveal:"Detalles del modo reemplazo",settingsReplaceRevealHint:"Solo botón, original al pasar el cursor, o ambos juntos.",replaceRevealButton:"Solo botón",replaceRevealHover:"Original al pasar el cursor",replaceRevealSplit:"Vista dividida (original + traducción)",settingsAccountBlocklist:"Lista de bloqueo de cuentas",settingsAccountBlocklistHint:"No mostrar Traducir ni autotraducir estas cuentas. También desde el menú del post.",blocklistEmpty:"No hay cuentas bloqueadas.",blocklistAdded:"Se bloqueó {handle}",blocklistRemoved:"Se desbloqueó {handle}",menuBlockAccount:"Nunca traducir esta cuenta",menuUnblockAccount:"Permitir traducir esta cuenta",settingsLangAllowlist:"Idiomas de origen permitidos",settingsLangAllowlistHint:"Si no está vacía, solo se traducen estos idiomas. Vacía = todos.",settingsLangBlocklist:"Idiomas de origen bloqueados",settingsLangBlocklistHint:"Omitir publicaciones en estos idiomas.",settingsSkipNative:"Omitir posts que X ya autotradujo",settingsSkipNativeHint:"Si X ya muestra su barra de traducción (Mostrar original), no añadir Traducir ni autotraducir.",langListEmpty:"Ningún idioma seleccionado.",langListAdd:"Añadir",langListExists:"{lang} ya está en la lista",langSkippedBlocked:"Omitido: idioma bloqueado",langSkippedNotAllowed:"Omitido: idioma no permitido",settingsSectionInterface:"Interfaz",settingsSectionTranslate:"Traducción",settingsSectionAccounts:"Cuentas",settingsSectionLanguages:"Idiomas",settingsSectionProvider:"Proveedor",settingsSectionCache:"Caché",badgeCacheOff:"Off"},pt:{menuSettings:"X Translator — Configurações",navSettings:"Tradutor",btnTranslate:"Traduzir",btnHide:"Ocultar tradução",btnRetry:"Tentar de novo",translating:"Traduzindo…",translationLabel:"Tradução",detectedLang:"Detectado: {lang}",errEmpty:"Nada para traduzir",errNetwork:"Falha na tradução. Tente novamente.",settingsTitle:"X Translator",sectionGeneral:"Geral",sectionTranslation:"Tradução",sectionCache:"Cache",sectionProviders:"Provedores",settingsProvider:"Provedor de tradução",settingsProviderHint:"As credenciais ficam só no armazenamento do userscript neste dispositivo.",providerFieldApiKey:"Chave de API",providerFieldApiKeyOptional:"Chave de API (opcional)",providerFieldDeeplPlan:"Plano DeepL",providerDeeplPlanFree:"Free (api-free.deepl.com)",providerDeeplPlanPro:"Pro (api.deepl.com)",providerFieldRegion:"Região",providerFieldModel:"Modelo",providerFieldBaseUrl:"URL base da API",providerFieldFolderId:"Folder ID",providerFieldApiUrl:"URL da API",providerHintGoogle:"Endpoint público do Google Translate. Sem chave de API.",providerHintDeepl:"DeepL API Free ou Pro. Crie uma chave em deepl.com/pro-api.",providerHintDeeplKey:"Chaves Free costumam terminar com :fx",providerHintMicrosoft:"Chave do recurso Azure Translator no portal Azure.",providerHintMicrosoftRegion:"Região do recurso, ou global para chaves multi-serviço.",providerHintOpenai:"API Chat Completions. Endpoints compatíveis também funcionam.",providerHintOpenaiBase:"Padrão https://api.openai.com/v1 — altere para proxies.",providerHintYandex:"Chave API do Yandex Cloud Translate + folder ID.",providerHintYandexFolder:"No console do Yandex Cloud.",providerHintLibre:"Instância LibreTranslate própria ou pública.",errProviderConfig:"Provedor não configurado. Abra Translator → Provedores.",sectionAbout:"Sobre",aboutDescription:"Userscript que traduz posts do X no próprio x.com. Compatível com Tampermonkey, Violentmonkey e similares.",aboutRepo:"Abrir repositório no GitHub",aboutLicense:"Licença MIT",settingsGeneral:"Geral",settingsTargetLang:"Traduzir para",settingsUiLocale:"Idioma da interface",settingsCacheHours:"Cache de traduções (horas)",settingsCacheHint:"0 desativa o cache. As entradas expiram pelo TTL ou ao limpar.",cacheMeterTitle:"Uso",cacheMeterUsed:"{used} / {limit}",cacheMeterEntries:"{count} itens",cacheMeterTtl:"TTL {hours} h",cacheMeterDisabled:"Cache off",cacheMeterFree:"{free} livres",cacheMeterAria:"Cache {used} de {limit} ({pct}), {count} itens",cacheMeterHint:"Limite suave do armazenamento GM. Quando cheio, remove as entradas mais antigas.",settingsDisplayMode:"Exibição da tradução",settingsDisplayModeHint:"Painel: mostrar a tradução abaixo do post. Substituir: trocar o texto e oferecer Mostrar original.",displayModePanel:"Painel separado",displayModeReplace:"Substituir o original",btnShowOriginal:"Mostrar original",settingsTranslateMode:"Modo de tradução",settingsTranslateModeHint:"Automático: traduz assim que o post fica um pouco visível. Botão: só ao tocar em Traduzir.",translateModeButton:"Ao clicar no botão",translateModeAuto:"Automático (na tela)",badgeModeAuto:"Auto",settingsAutoScope:"Escopo da tradução automática",settingsAutoScopeHint:"Traduzir todos os posts visíveis ou só as contas escolhidas.",autoScopeAll:"Todas as contas",autoScopeAllowlist:"Apenas contas selecionadas",settingsAllowlistHint:"Também pode adicionar ou remover contas no menu ⋮ do post.",allowlistPlaceholder:"@username",allowlistAdd:"Adicionar",allowlistRemove:"Remover",allowlistEmpty:"Nenhuma conta. Digite um nickname acima.",allowlistInvalid:"Digite um handle válido do X.",allowlistExists:"{handle} já está na lista",allowlistAdded:"{handle} adicionado à tradução automática",allowlistRemoved:"{handle} removido da tradução automática",menuAddAutoAccount:"Traduzir automaticamente esta conta",menuRemoveAutoAccount:"Remover da tradução automática",settingsSave:"Salvar",settingsClose:"Fechar",settingsClearCache:"Limpar cache",settingsSaved:"Configurações salvas",settingsCacheCleared:"Cache de traduções limpo",toastCacheClearedOnUpdate:"Cache limpo após atualizar para {version}",toastCacheClearedOnUpdateTitle:"Atualizado",toastTitleSuccess:"Sucesso",toastTitleInfo:"Info",toastTitleWarning:"Aviso",toastTitleError:"Erro",toastDismiss:"Fechar",langAuto:"Auto (igual à UI / navegador)",localeAuto:"Auto (navegador)",badgeLangAuto:"Auto",originalLabel:"Original",settingsReplaceReveal:"Detalhes do modo substituir",settingsReplaceRevealHint:"Só botão, original ao passar o mouse, ou ambos juntos.",replaceRevealButton:"Só botão",replaceRevealHover:"Original ao passar o mouse",replaceRevealSplit:"Visão dividida (original + tradução)",settingsAccountBlocklist:"Lista de bloqueio de contas",settingsAccountBlocklistHint:"Não mostrar Traduzir nem traduzir automaticamente essas contas. Também no menu do post.",blocklistEmpty:"Nenhuma conta bloqueada.",blocklistAdded:"{handle} bloqueado",blocklistRemoved:"{handle} desbloqueado",menuBlockAccount:"Nunca traduzir esta conta",menuUnblockAccount:"Permitir traduzir esta conta",settingsLangAllowlist:"Idiomas de origem permitidos",settingsLangAllowlistHint:"Se não estiver vazia, só traduz esses idiomas. Vazia = todos.",settingsLangBlocklist:"Idiomas de origem bloqueados",settingsLangBlocklistHint:"Ignorar posts nesses idiomas.",settingsSkipNative:"Ignorar posts que o X já traduziu automaticamente",settingsSkipNativeHint:"Quando o X já mostra a barra de tradução (Mostrar original), não adicionar Traduzir nem traduzir automaticamente.",langListEmpty:"Nenhum idioma selecionado.",langListAdd:"Adicionar",langListExists:"{lang} já está na lista",langSkippedBlocked:"Ignorado: idioma bloqueado",langSkippedNotAllowed:"Ignorado: idioma não permitido",settingsSectionInterface:"Interface",settingsSectionTranslate:"Tradução",settingsSectionAccounts:"Contas",settingsSectionLanguages:"Idiomas",settingsSectionProvider:"Provedor",settingsSectionCache:"Cache",badgeCacheOff:"Off"},de:{menuSettings:"X Translator — Einstellungen",navSettings:"Übersetzer",btnTranslate:"Übersetzen",btnHide:"Übersetzung ausblenden",btnRetry:"Erneut versuchen",translating:"Übersetze…",translationLabel:"Übersetzung",detectedLang:"Erkannt: {lang}",errEmpty:"Nichts zu übersetzen",errNetwork:"Übersetzung fehlgeschlagen. Bitte erneut versuchen.",settingsTitle:"X Translator",sectionGeneral:"Allgemein",sectionTranslation:"Übersetzung",sectionCache:"Cache",sectionProviders:"Anbieter",settingsProvider:"Übersetzungsanbieter",settingsProviderHint:"Zugangsdaten werden nur im Userscript-Speicher dieses Geräts gespeichert.",providerFieldApiKey:"API-Schlüssel",providerFieldApiKeyOptional:"API-Schlüssel (optional)",providerFieldDeeplPlan:"DeepL-Tarif",providerDeeplPlanFree:"Free (api-free.deepl.com)",providerDeeplPlanPro:"Pro (api.deepl.com)",providerFieldRegion:"Region",providerFieldModel:"Modell",providerFieldBaseUrl:"API-Basis-URL",providerFieldFolderId:"Folder ID",providerFieldApiUrl:"API-URL",providerHintGoogle:"Öffentlicher Google-Translate-Endpunkt. Kein API-Schlüssel nötig.",providerHintDeepl:"DeepL API Free oder Pro. Schlüssel unter deepl.com/pro-api.",providerHintDeeplKey:"Free-Schlüssel enden meist mit :fx",providerHintMicrosoft:"Azure-Translator-Ressourcenschlüssel im Azure-Portal.",providerHintMicrosoftRegion:"Ressourcenregion oder global für Multi-Service-Schlüssel.",providerHintOpenai:"Chat-Completions-API. Kompatible Endpunkte funktionieren ebenfalls.",providerHintOpenaiBase:"Standard https://api.openai.com/v1 — für Proxys ändern.",providerHintYandex:"Yandex Cloud Translate API-Schlüssel + Folder ID.",providerHintYandexFolder:"Aus der Yandex-Cloud-Konsole.",providerHintLibre:"Eigene oder öffentliche LibreTranslate-Instanz.",errProviderConfig:"Anbieter nicht konfiguriert. Öffne Translator → Anbieter.",sectionAbout:"Über",aboutDescription:"Userscript, das X-Posts direkt auf x.com übersetzt. Kompatibel mit Tampermonkey, Violentmonkey und ähnlichen Managern.",aboutRepo:"Repository auf GitHub öffnen",aboutLicense:"MIT-Lizenz",settingsGeneral:"Allgemein",settingsTargetLang:"Übersetzen nach",settingsUiLocale:"Oberflächensprache",settingsCacheHours:"Übersetzungscache (Stunden)",settingsCacheHint:"0 deaktiviert den Cache. Einträge laufen per TTL ab oder bei manueller Löschung.",cacheMeterTitle:"Belegt",cacheMeterUsed:"{used} / {limit}",cacheMeterEntries:"{count} Einträge",cacheMeterTtl:"TTL {hours} Std.",cacheMeterDisabled:"Cache aus",cacheMeterFree:"{free} frei",cacheMeterAria:"Cache {used} von {limit} ({pct}), {count} Einträge",cacheMeterHint:"Weiches Limit für GM-Speicher. Bei Überlauf werden die ältesten Einträge entfernt.",settingsDisplayMode:"Anzeige der Übersetzung",settingsDisplayModeHint:"Panel: Übersetzung unter dem Post. Ersetzen: Posttext tauschen und Original anzeigen anbieten.",displayModePanel:"Separates Panel",displayModeReplace:"Original ersetzen",btnShowOriginal:"Original anzeigen",settingsTranslateMode:"Übersetzungsmodus",settingsTranslateModeHint:"Automatisch: übersetzen, sobald ein Post auch nur leicht sichtbar ist. Taste: nur nach Tippen auf Übersetzen.",translateModeButton:"Per Schaltfläche",translateModeAuto:"Automatisch (am Bildschirm)",badgeModeAuto:"Auto",settingsAutoScope:"Bereich der Auto-Übersetzung",settingsAutoScopeHint:"Alle sichtbaren Posts übersetzen oder nur ausgewählte Konten.",autoScopeAll:"Alle Konten",autoScopeAllowlist:"Nur ausgewählte Konten",settingsAllowlistHint:"Konten kannst du auch im ⋮-Menü eines Posts hinzufügen oder entfernen.",allowlistPlaceholder:"@username",allowlistAdd:"Hinzufügen",allowlistRemove:"Entfernen",allowlistEmpty:"Noch keine Konten. Nickname oben eingeben.",allowlistInvalid:"Gib einen gültigen X-Handle ein.",allowlistExists:"{handle} ist bereits in der Liste",allowlistAdded:"{handle} zur Auto-Übersetzung hinzugefügt",allowlistRemoved:"{handle} aus der Auto-Übersetzung entfernt",menuAddAutoAccount:"Dieses Konto automatisch übersetzen",menuRemoveAutoAccount:"Aus Auto-Übersetzung entfernen",settingsSave:"Speichern",settingsClose:"Schließen",settingsClearCache:"Cache leeren",settingsSaved:"Einstellungen gespeichert",settingsCacheCleared:"Übersetzungscache geleert",toastCacheClearedOnUpdate:"Cache nach Update auf {version} geleert",toastCacheClearedOnUpdateTitle:"Aktualisiert",toastTitleSuccess:"Erfolg",toastTitleInfo:"Info",toastTitleWarning:"Hinweis",toastTitleError:"Fehler",toastDismiss:"Schließen",langAuto:"Auto (wie UI / Browser)",localeAuto:"Auto (Browser)",badgeLangAuto:"Auto",originalLabel:"Original",settingsReplaceReveal:"Details zum Ersetzen-Modus",settingsReplaceRevealHint:"Nur Schaltfläche, Original beim Hover oder beides zusammen.",replaceRevealButton:"Nur Schaltfläche",replaceRevealHover:"Original beim Hover",replaceRevealSplit:"Geteilte Ansicht (Original + Übersetzung)",settingsAccountBlocklist:"Konto-Sperrliste",settingsAccountBlocklistHint:"Keine Übersetzen-Schaltfläche und kein Auto-Übersetzen für diese Konten. Auch im Post-Menü.",blocklistEmpty:"Keine gesperrten Konten.",blocklistAdded:"{handle} gesperrt",blocklistRemoved:"{handle} entsperrt",menuBlockAccount:"Dieses Konto nie übersetzen",menuUnblockAccount:"Übersetzung für dieses Konto erlauben",settingsLangAllowlist:"Erlaubte Ausgangssprachen",settingsLangAllowlistHint:"Wenn nicht leer, nur diese Sprachen übersetzen. Leer = alle.",settingsLangBlocklist:"Gesperrte Ausgangssprachen",settingsLangBlocklistHint:"Beiträge in diesen Sprachen überspringen.",settingsSkipNative:"Von X bereits automatisch übersetzte Beiträge überspringen",settingsSkipNativeHint:"Wenn X bereits seine Übersetzungsleiste zeigt (Original anzeigen), keine Übersetzen-Schaltfläche und keine Auto-Übersetzung.",langListEmpty:"Keine Sprachen ausgewählt.",langListAdd:"Hinzufügen",langListExists:"{lang} ist bereits in der Liste",langSkippedBlocked:"Übersprungen: Sprache gesperrt",langSkippedNotAllowed:"Übersprungen: Sprache nicht erlaubt",settingsSectionInterface:"Oberfläche",settingsSectionTranslate:"Übersetzung",settingsSectionAccounts:"Konten",settingsSectionLanguages:"Sprachen",settingsSectionProvider:"Anbieter",settingsSectionCache:"Cache",badgeCacheOff:"Aus"},fr:{menuSettings:"X Translator — Paramètres",navSettings:"Traducteur",btnTranslate:"Traduire",btnHide:"Masquer la traduction",btnRetry:"Réessayer",translating:"Traduction…",translationLabel:"Traduction",detectedLang:"Détecté : {lang}",errEmpty:"Rien à traduire",errNetwork:"Échec de la traduction. Réessayez.",settingsTitle:"X Translator",sectionGeneral:"Général",sectionTranslation:"Traduction",sectionCache:"Cache",sectionProviders:"Fournisseurs",settingsProvider:"Fournisseur de traduction",settingsProviderHint:"Les identifiants sont stockés uniquement dans le stockage userscript de cet appareil.",providerFieldApiKey:"Clé API",providerFieldApiKeyOptional:"Clé API (facultatif)",providerFieldDeeplPlan:"Offre DeepL",providerDeeplPlanFree:"Free (api-free.deepl.com)",providerDeeplPlanPro:"Pro (api.deepl.com)",providerFieldRegion:"Région",providerFieldModel:"Modèle",providerFieldBaseUrl:"URL de base de l’API",providerFieldFolderId:"Folder ID",providerFieldApiUrl:"URL de l’API",providerHintGoogle:"Endpoint public Google Translate. Aucune clé requise.",providerHintDeepl:"DeepL API Free ou Pro. Créez une clé sur deepl.com/pro-api.",providerHintDeeplKey:"Les clés Free se terminent souvent par :fx",providerHintMicrosoft:"Clé de ressource Azure Translator dans le portail Azure.",providerHintMicrosoftRegion:"Région de la ressource, ou global pour les clés multi-service.",providerHintOpenai:"API Chat Completions. Les endpoints compatibles fonctionnent aussi.",providerHintOpenaiBase:"Par défaut https://api.openai.com/v1 — changez pour un proxy.",providerHintYandex:"Clé API Yandex Cloud Translate + folder ID.",providerHintYandexFolder:"Depuis la console Yandex Cloud.",providerHintLibre:"Instance LibreTranslate auto-hébergée ou publique.",errProviderConfig:"Fournisseur non configuré. Ouvrez Translator → Fournisseurs.",sectionAbout:"À propos",aboutDescription:"Userscript qui traduit les posts X directement sur x.com. Compatible avec Tampermonkey, Violentmonkey et similaires.",aboutRepo:"Ouvrir le dépôt sur GitHub",aboutLicense:"Licence MIT",settingsGeneral:"Général",settingsTargetLang:"Traduire en",settingsUiLocale:"Langue de l’interface",settingsCacheHours:"Cache des traductions (heures)",settingsCacheHint:"0 désactive le cache. Les entrées expirent selon le TTL ou lors d’un vidage manuel.",cacheMeterTitle:"Occupation",cacheMeterUsed:"{used} / {limit}",cacheMeterEntries:"{count} entrées",cacheMeterTtl:"TTL {hours} h",cacheMeterDisabled:"Cache off",cacheMeterFree:"{free} libres",cacheMeterAria:"Cache {used} sur {limit} ({pct}), {count} entrées",cacheMeterHint:"Limite souple du stockage GM. En cas de dépassement, les entrées les plus anciennes sont évincées.",settingsDisplayMode:"Affichage de la traduction",settingsDisplayModeHint:"Panneau : traduction sous le post. Remplacer : échanger le texte et proposer Afficher l’original.",displayModePanel:"Panneau séparé",displayModeReplace:"Remplacer l’original",btnShowOriginal:"Afficher l’original",settingsTranslateMode:"Mode de traduction",settingsTranslateModeHint:"Automatique : traduit dès qu’un post est un peu visible à l’écran. Bouton : seulement après Traduire.",translateModeButton:"Au clic sur le bouton",translateModeAuto:"Automatique (à l’écran)",badgeModeAuto:"Auto",settingsAutoScope:"Portée de la traduction auto",settingsAutoScopeHint:"Traduire tous les posts visibles, ou seulement les comptes choisis.",autoScopeAll:"Tous les comptes",autoScopeAllowlist:"Comptes sélectionnés uniquement",settingsAllowlistHint:"Vous pouvez aussi ajouter ou retirer un compte via le menu ⋮ du post.",allowlistPlaceholder:"@username",allowlistAdd:"Ajouter",allowlistRemove:"Retirer",allowlistEmpty:"Aucun compte. Saisissez un nickname ci-dessus.",allowlistInvalid:"Saisissez un handle X valide.",allowlistExists:"{handle} est déjà dans la liste",allowlistAdded:"{handle} ajouté à la traduction auto",allowlistRemoved:"{handle} retiré de la traduction auto",menuAddAutoAccount:"Traduire auto ce compte",menuRemoveAutoAccount:"Retirer de la traduction auto",settingsSave:"Enregistrer",settingsClose:"Fermer",settingsClearCache:"Vider le cache",settingsSaved:"Paramètres enregistrés",settingsCacheCleared:"Cache des traductions vidé",toastCacheClearedOnUpdate:"Cache vidé après mise à jour vers {version}",toastCacheClearedOnUpdateTitle:"Mis à jour",toastTitleSuccess:"Succès",toastTitleInfo:"Info",toastTitleWarning:"Attention",toastTitleError:"Erreur",toastDismiss:"Fermer",langAuto:"Auto (comme l’UI / le navigateur)",localeAuto:"Auto (navigateur)",badgeLangAuto:"Auto",originalLabel:"Original",settingsReplaceReveal:"Détails du mode remplacement",settingsReplaceRevealHint:"Bouton seul, original au survol, ou les deux ensemble.",replaceRevealButton:"Bouton seul",replaceRevealHover:"Original au survol",replaceRevealSplit:"Vue partagée (original + traduction)",settingsAccountBlocklist:"Liste de blocage des comptes",settingsAccountBlocklistHint:"Ne pas afficher Traduire ni auto-traduire ces comptes. Aussi via le menu du post.",blocklistEmpty:"Aucun compte bloqué.",blocklistAdded:"{handle} bloqué",blocklistRemoved:"{handle} débloqué",menuBlockAccount:"Ne jamais traduire ce compte",menuUnblockAccount:"Autoriser la traduction de ce compte",settingsLangAllowlist:"Langues source autorisées",settingsLangAllowlistHint:"Si non vide, seules ces langues sont traduites. Vide = toutes.",settingsLangBlocklist:"Langues source bloquées",settingsLangBlocklistHint:"Ignorer les posts dans ces langues.",settingsSkipNative:"Ignorer les posts déjà auto-traduits par X",settingsSkipNativeHint:"Si X affiche déjà sa barre de traduction (Afficher l’original), ne pas ajouter Traduire ni auto-traduire.",langListEmpty:"Aucune langue sélectionnée.",langListAdd:"Ajouter",langListExists:"{lang} est déjà dans la liste",langSkippedBlocked:"Ignoré : langue bloquée",langSkippedNotAllowed:"Ignoré : langue non autorisée",settingsSectionInterface:"Interface",settingsSectionTranslate:"Traduction",settingsSectionAccounts:"Comptes",settingsSectionLanguages:"Langues",settingsSectionProvider:"Fournisseur",settingsSectionCache:"Cache",badgeCacheOff:"Off"},ja:{menuSettings:"X Translator — 設定",navSettings:"翻訳",btnTranslate:"翻訳",btnHide:"翻訳を隠す",btnRetry:"再試行",translating:"翻訳中…",translationLabel:"翻訳",detectedLang:"検出: {lang}",errEmpty:"翻訳するテキストがありません",errNetwork:"翻訳に失敗しました。もう一度お試しください。",settingsTitle:"X Translator",sectionGeneral:"一般",sectionTranslation:"翻訳",sectionCache:"キャッシュ",sectionProviders:"プロバイダー",settingsProvider:"翻訳プロバイダー",settingsProviderHint:"認証情報はこの端末の userscript ストレージにのみ保存されます。",providerFieldApiKey:"API キー",providerFieldApiKeyOptional:"API キー(任意)",providerFieldDeeplPlan:"DeepL プラン",providerDeeplPlanFree:"Free (api-free.deepl.com)",providerDeeplPlanPro:"Pro (api.deepl.com)",providerFieldRegion:"リージョン",providerFieldModel:"モデル",providerFieldBaseUrl:"API ベース URL",providerFieldFolderId:"Folder ID",providerFieldApiUrl:"API URL",providerHintGoogle:"Google の公開 Translate エンドポイント。API キー不要。",providerHintDeepl:"DeepL API Free / Pro。deepl.com/pro-api でキーを作成。",providerHintDeeplKey:"Free キーは通常 :fx で終わります",providerHintMicrosoft:"Azure ポータルの Translator リソースキー。",providerHintMicrosoftRegion:"リソースのリージョン。マルチサービスキーは global。",providerHintOpenai:"Chat Completions API。互換エンドポイントも利用可。",providerHintOpenaiBase:"既定は https://api.openai.com/v1。プロキシ用に変更可。",providerHintYandex:"Yandex Cloud Translate の API キーと folder ID。",providerHintYandexFolder:"Yandex Cloud コンソールから。",providerHintLibre:"自前または公開の LibreTranslate。",errProviderConfig:"プロバイダーが未設定です。Translator → プロバイダーを開いてください。",sectionAbout:"情報",aboutDescription:"X(x.com)上で投稿をその場で翻訳するユーザースクリプト。Tampermonkey、Violentmonkey などに対応。",aboutRepo:"GitHub でリポジトリを開く",aboutLicense:"MIT ライセンス",settingsGeneral:"一般",settingsTargetLang:"翻訳先",settingsUiLocale:"インターフェース言語",settingsCacheHours:"翻訳キャッシュ(時間)",settingsCacheHint:"0 でキャッシュ無効。TTL で期限切れ、または手動でクリア。",cacheMeterTitle:"使用量",cacheMeterUsed:"{used} / {limit}",cacheMeterEntries:"{count} 件",cacheMeterTtl:"TTL {hours} 時間",cacheMeterDisabled:"キャッシュオフ",cacheMeterFree:"空き {free}",cacheMeterAria:"キャッシュ {used} / {limit}({pct})、{count} 件",cacheMeterHint:"GM ストレージのソフト上限です。満杯になると古いエントリから削除されます。",settingsDisplayMode:"翻訳の表示",settingsDisplayModeHint:"パネル:投稿の下に表示。置換:本文を翻訳に差し替え、「原文を表示」を出す。",displayModePanel:"別パネル",displayModeReplace:"原文を置き換え",btnShowOriginal:"原文を表示",settingsTranslateMode:"翻訳モード",settingsTranslateModeHint:"自動:投稿が画面に少しでも見えたら翻訳。ボタン:「翻訳」を押したときだけ。",translateModeButton:"ボタンで翻訳",translateModeAuto:"自動(画面に表示時)",badgeModeAuto:"自動",settingsAutoScope:"自動翻訳の対象",settingsAutoScopeHint:"表示中のすべての投稿か、選んだアカウントのみを翻訳します。",autoScopeAll:"すべてのアカウント",autoScopeAllowlist:"選択したアカウントのみ",settingsAllowlistHint:"投稿の ⋮ メニューからもアカウントを追加・削除できます。",allowlistPlaceholder:"@username",allowlistAdd:"追加",allowlistRemove:"削除",allowlistEmpty:"まだありません。上にニックネームを入力してください。",allowlistInvalid:"有効な X ハンドルを入力してください。",allowlistExists:"{handle} はすでにリストにあります",allowlistAdded:"{handle} を自動翻訳に追加しました",allowlistRemoved:"{handle} を自動翻訳から削除しました",menuAddAutoAccount:"このアカウントを自動翻訳",menuRemoveAutoAccount:"自動翻訳から外す",settingsSave:"保存",settingsClose:"閉じる",settingsClearCache:"キャッシュをクリア",settingsSaved:"設定を保存しました",settingsCacheCleared:"翻訳キャッシュをクリアしました",toastCacheClearedOnUpdate:"{version} への更新後、キャッシュをクリアしました",toastCacheClearedOnUpdateTitle:"更新済み",toastTitleSuccess:"成功",toastTitleInfo:"情報",toastTitleWarning:"注意",toastTitleError:"エラー",toastDismiss:"閉じる",langAuto:"自動(UI / ブラウザに合わせる)",localeAuto:"自動(ブラウザ)",badgeLangAuto:"自動",originalLabel:"原文",settingsReplaceReveal:"置換モードの詳細",settingsReplaceRevealHint:"ボタンのみ、ホバーで原文、または原文と訳文を並べて表示。",replaceRevealButton:"ボタンのみ",replaceRevealHover:"ホバーで原文",replaceRevealSplit:"分割表示(原文 + 訳文)",settingsAccountBlocklist:"アカウントブロックリスト",settingsAccountBlocklistHint:"これらのアカウントには翻訳ボタンを出さず自動翻訳もしません。投稿メニューからも変更できます。",blocklistEmpty:"ブロック中のアカウントはありません。",blocklistAdded:"{handle} をブロックしました",blocklistRemoved:"{handle} のブロックを解除しました",menuBlockAccount:"このアカウントを翻訳しない",menuUnblockAccount:"このアカウントの翻訳を許可",settingsLangAllowlist:"原文言語の許可リスト",settingsLangAllowlistHint:"空でなければ、検出されたこれらの言語だけ翻訳します。空 = すべて。",settingsLangBlocklist:"原文言語のブロックリスト",settingsLangBlocklistHint:"これらの言語の投稿をスキップします。",settingsSkipNative:"X が既に自動翻訳した投稿をスキップ",settingsSkipNativeHint:"X の翻訳バー(オリジナルを表示)が出ている投稿には、翻訳ボタンを付けず自動翻訳もしません。",langListEmpty:"言語が未選択です。",langListAdd:"追加",langListExists:"{lang} はすでにリストにあります",langSkippedBlocked:"スキップ:言語がブロックされています",langSkippedNotAllowed:"スキップ:許可リストにない言語です",settingsSectionInterface:"インターフェース",settingsSectionTranslate:"翻訳",settingsSectionAccounts:"アカウント",settingsSectionLanguages:"言語",settingsSectionProvider:"プロバイダー",settingsSectionCache:"キャッシュ",badgeCacheOff:"オフ"}},k=["en","ru","zh","es","pt","de","fr","ja"],M={en:"English",ru:"Русский",zh:"中文",es:"Español",pt:"Português",de:"Deutsch",fr:"Français",ja:"日本語"},C={en:"🇺🇸",ru:"🇷🇺",zh:"🇨🇳",es:"🇪🇸",pt:"🇧🇷",de:"🇩🇪",fr:"🇫🇷",ja:"🇯🇵"},H="🌐";function E(){const e=String(navigator.language||"en").toLowerCase().slice(0,2);return k.includes(e)?e:"en"}function $(e){const t=e||"auto";return "auto"!==t&&k.includes(t)?t:E()}function P(e,t){return String(e).replace(/\{(\w+)\}/g,(e,n)=>null==t[n]?"":String(t[n]))}const _=new Set(["home","explore","search","notifications","messages","settings","i","compose","login","logout","signup","tos","privacy","hashtag","intent","share","following","followers","lists","bookmarks","communities","premium","jobs","articles","topics","about","download","help","display","account"]);function R(e){let t=String(e||"").replace(/\u00a0/g," ").trim();return t?(t=t.replace(/^@+/,""),t=t.replace(/^https?:\/\/(www\.)?(x|twitter)\.com\//i,""),t=t.replace(/^\//,""),t=t.split(/[/?#\s]/)[0]||"",t=t.replace(/^@+/,"").replace(/\/+$/,""),t=t.toLowerCase(),!t||_.has(t)?"":/^[a-z0-9_]{1,15}$/i.test(t)?t:""):""}function I(e){if(!e)return "";let t=String(e).trim();try{/^https?:\/\//i.test(t)&&(t=new URL(t).pathname);}catch(n){}return t=t.replace(/^\//,""),R(t.split(/[/?#]/)[0]||"")}function q(e){const t=R(e);return t?`@${t}`:""}function B(e){return String(e||"").trim().toLowerCase().replace(/_/g,"-")}function z(e){return Array.isArray(e)?[...new Set(e.map(B).filter(Boolean))].sort():[]}function F(e){return Array.isArray(e)?[...new Set(e.map(R).filter(Boolean))].sort():[]}const D=new Set(["button","hover","split"]);function N(e){const t=e&&"object"==typeof e?e:{},n={...w,...t};return n.provider=s(n.provider)?n.provider:"google",n.providerConfig=c(t.providerConfig),n.translateMode="auto"===n.translateMode?"auto":"button",n.displayMode="replace"===n.displayMode?"replace":"panel",n.replaceReveal=D.has(n.replaceReveal)?n.replaceReveal:"button",n.autoScope="allowlist"===n.autoScope?"allowlist":"all",n.autoAllowlist=F(n.autoAllowlist),n.accountBlocklist=F(n.accountBlocklist),n.langAllowlist=z(n.langAllowlist),n.langBlocklist=z(n.langBlocklist),n.skipNativeAutoTranslate=false!==n.skipNativeAutoTranslate,delete n.debugMode,delete n.autoDetectSkipSameLang,n}function O(){try{return N(e(p,null))}catch(t){return N(null)}}function U(e){const t=N(e);n(p,t);}let K=O(),j=$(K.uiLocale),G=T[j]||T.en,X=null,Y=0;const V=new Map;function W(){K=O(),j=$(K.uiLocale),G=T[j]||T.en;}function Z(e){X=e;}function J(e){return String(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Q(e){return J(e)}function ee(){if(X)return X;try{const t=e(g,null);Z(t&&"object"==typeof t?t:{});}catch(t){Z({});}return X}function te(){var e;clearTimeout(Y),e=setTimeout(()=>{try{!function(){const e=ee(),t=ne();if(t<=0){for(const t of Object.keys(e))delete e[t];return}const n=Date.now();for(const[a,o]of Object.entries(e))o&&"object"==typeof o?n-(o.at||0)>t&&delete e[a]:delete e[a];}(),function(){const e=ee();let t=ae(e);if(t<=x)return;const n=Object.entries(e).sort((e,t)=>{var n,a;return ((null==(n=e[1])?void 0:n.at)||0)-((null==(a=t[1])?void 0:a.at)||0)});for(const[a]of n)if(delete e[a],t=ae(e),t<=1782579.2)break}(),n(g,ee());}catch(e){}},400),Y=e;}function ne(){const e=Number(K.cacheHours);return !Number.isFinite(e)||e<=0?0:3600*Math.min(e,168)*1e3}function ae(e){try{return 2*JSON.stringify(e).length}catch(t){return 0}}function oe(e,t){try{return 2*(JSON.stringify(e).length+JSON.stringify(t).length)}catch(n){return 0}}function ie(e){const t=Math.max(0,Number(e)||0);return t<1024?`${Math.round(t)} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1048576).toFixed(2)} MB`}function re(){const e=ee();let t=0,n=0;for(const s of Object.keys(e))t+=oe(s,e[s]),n+=1;const a=x,o=Math.max(0,a-t),i=Math.min(100,t/a*100),r=Number(K.cacheHours),l=Number.isFinite(r)&&r>0;return {usedBytes:t,freeBytes:o,limitBytes:a,entryCount:n,pct:i,ttlHours:l?Math.min(r,168):0,enabled:l}}function le(e){const t=e||re();return t.enabled?t.pct>=85?"high":t.pct>=60?"warn":"ok":"off"}function se(e){const t=e||re(),n=le(t),a=`${t.pct<10&&t.pct>0?t.pct.toFixed(1):Math.round(t.pct)}%`,o=P(G.cacheMeterUsed,{used:ie(t.usedBytes),limit:ie(t.limitBytes)}),i=P(G.cacheMeterEntries,{count:t.entryCount}),r=t.enabled?P(G.cacheMeterTtl,{hours:t.ttlHours}):G.cacheMeterDisabled,l=P(G.cacheMeterFree,{free:ie(t.freeBytes)}),s=P(G.cacheMeterAria,{used:ie(t.usedBytes),limit:ie(t.limitBytes),pct:a,count:t.entryCount});return `\n
\n
\n
${J(G.cacheMeterTitle)}
\n
${J(a)}
\n
\n
${J(o)}
\n \n \n
\n
\n ${J(i)}\n \n ${J(r)}\n \n ${J(l)}\n
\n

${J(G.cacheMeterHint)}

\n \n `}function ce(e){var t;const n=null==(t=null==e?void 0:e.querySelector)?void 0:t.call(e,"[data-xt-cache-meter]");if(!n)return;const a=document.createElement("div");a.innerHTML=se(re()).trim();const o=a.firstElementChild;o&&n.replaceWith(o);}function de(e){const t=String(e||"").toLowerCase();return "zh-cn"===t||"zh"===t?"ZH-HANS":"zh-tw"===t?"ZH-HANT":"pt"===t?"PT-BR":"en"===t?"EN":t.toUpperCase()}function ue(e){const t=String(e||"").toLowerCase();return "zh-cn"===t||"zh"===t||"zh-tw"===t?"zh":t.split("-")[0]}function pe(e){const t=String(e||"").toLowerCase();return "zh-cn"===t||"zh"===t?"zh":"zh-tw"===t?"zt":t.split("-")[0]}function ge(e,t="en"){try{return new Intl.DisplayNames([t,"en"],{type:"language"}).of(String(e||"en").replace(/_/g,"-").split("-")[0])}catch(n){return e}}function ve(e){return new Promise((t,n)=>{const o={method:e.method||"GET",url:e.url,headers:e.headers||{},responseType:e.responseType||"json",timeout:e.timeout||2e4,onload(a){if(e.allow404&&404===a.status)t(null);else if(a.status>=200&&a.status<300){const n=e.responseType||"json";if("text"===n)t(null!=a.responseText&&""!==a.responseText?a.responseText:a.response);else if("json"===n){if(null!=a.response&&"object"==typeof a.response)return void t(a.response);const e=a.responseText;if("string"==typeof e&&e.trim())try{return void t(JSON.parse(e))}catch(o){}t(a.response);}else t(a.response);}else n(new Error(`HTTP ${a.status}`));},onerror:()=>n(new Error("Network error")),ontimeout:()=>n(new Error("Timeout"))};"boolean"==typeof e.anonymous&&(o.anonymous=e.anonymous),null!=e.data&&(o.data="string"==typeof e.data?e.data:JSON.stringify(e.data)),a(o);})}async function me(e,t,n){const a=function(e){var t;const n=null==(t=K.providerConfig)?void 0:t[e];return n&&"object"==typeof n?n:{}}(e);switch(e){case "deepl":return async function(e,t,n){var a,o;const i=String(n.apiKey||"").trim();if(!i)throw new Error("missing-config");const r="pro"==("pro"===n.plan?"pro":"free")?"api.deepl.com":"api-free.deepl.com",l=new URLSearchParams({text:e,target_lang:de(t)}),s=await ve({method:"POST",url:`https://${r}/v2/translate`,headers:{Authorization:`DeepL-Auth-Key ${i}`,"Content-Type":"application/x-www-form-urlencoded"},data:l.toString(),responseType:"json"}),c=null==(o=null==(a=null==s?void 0:s.translations)?void 0:a[0])?void 0:o.text;if(!c)throw new Error("empty-result");return {text:c,detectedSourceLang:s.translations[0].detected_source_language||null}}(t,n,a);case "microsoft":return async function(e,t,n){var a,o,i;const r=String(n.apiKey||"").trim(),l=String(n.region||"global").trim()||"global";if(!r)throw new Error("missing-config");const s=encodeURIComponent(function(e){const t=String(e||"").toLowerCase();return "zh-cn"===t||"zh"===t?"zh-Hans":"zh-tw"===t?"zh-Hant":t}(t)),c=await ve({method:"POST",url:`https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=${s}`,headers:{"Ocp-Apim-Subscription-Key":r,"Ocp-Apim-Subscription-Region":l,"Content-Type":"application/json"},data:[{Text:e}],responseType:"json"}),d=Array.isArray(c)?c[0]:null,u=null==(o=null==(a=null==d?void 0:d.translations)?void 0:a[0])?void 0:o.text;if(!u)throw new Error("empty-result");return {text:u,detectedSourceLang:(null==(i=null==d?void 0:d.detectedLanguage)?void 0:i.language)||null}}(t,n,a);case "openai":return async function(e,t,n){var a,o,i;const r=String(n.apiKey||"").trim();if(!r)throw new Error("missing-config");const l=String(n.model||"gpt-4o-mini").trim()||"gpt-4o-mini",s=String(n.baseUrl||"https://api.openai.com/v1").trim().replace(/\/+$/,"")||"https://api.openai.com/v1",c=ge(t)||t,d=await ve({method:"POST",url:`${s}/chat/completions`,headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"},data:{model:l,temperature:.2,messages:[{role:"system",content:`You are a translator. Translate the user message into ${c} (${t}). Reply with only the translation, no quotes or commentary.`},{role:"user",content:e}]},responseType:"json"}),u=String((null==(i=null==(o=null==(a=null==d?void 0:d.choices)?void 0:a[0])?void 0:o.message)?void 0:i.content)||"").trim();if(!u)throw new Error("empty-result");return {text:u,detectedSourceLang:null}}(t,n,a);case "yandex":return async function(e,t,n){var a,o;const i=String(n.apiKey||"").trim(),r=String(n.folderId||"").trim();if(!i||!r)throw new Error("missing-config");const l=await ve({method:"POST",url:"https://translate.api.cloud.yandex.net/translate/v2/translate",headers:{Authorization:`Api-Key ${i}`,"Content-Type":"application/json"},data:{folderId:r,texts:[e],targetLanguageCode:ue(t)},responseType:"json"}),s=null==(o=null==(a=null==l?void 0:l.translations)?void 0:a[0])?void 0:o.text;if(!s)throw new Error("empty-result");return {text:s,detectedSourceLang:l.translations[0].detectedLanguageCode||null}}(t,n,a);case "libretranslate":return async function(e,t,n){var a;const o=function(e){const t=String(e||"").trim().replace(/\/+$/,"");if(!t)throw new Error("missing-config");return t}(n.apiUrl),i=String(n.apiKey||"").trim(),r={q:e,source:"auto",target:pe(t),format:"text"};i&&(r.api_key=i);const l=await ve({method:"POST",url:`${o}/translate`,headers:{"Content-Type":"application/json"},data:r,responseType:"json"}),s=String((null==l?void 0:l.translatedText)||"").trim();if(!s)throw new Error("empty-result");return {text:s,detectedSourceLang:(null==(a=l.detectedLanguage)?void 0:a.language)||null}}(t,n,a);default:return async function(e,t){var n,a;const o=new URLSearchParams({client:"gtx",sl:"auto",tl:t,dt:"t",q:e}),i=await ve({method:"GET",url:`https://translate.googleapis.com/translate_a/single?${o.toString()}`,responseType:"json",anonymous:true}),r=(Array.isArray(null==i?void 0:i[0])?i[0]:[]).map(e=>Array.isArray(e)?e[0]:"").filter(Boolean).join("");if(!r)throw new Error("empty-result");return {text:r,detectedSourceLang:"string"==typeof(null==i?void 0:i[2])?i[2]:"string"==typeof(null==(a=null==(n=null==i?void 0:i[8])?void 0:n[0])?void 0:a[0])?i[8][0][0]:null}}(t,n)}}const he=/\uE000\s*(\d+)\s*\uE001/g;function fe(e){const t=function(e){const t=String(e||"").trim();if(!t)return null;if(t.startsWith("/")&&!t.startsWith("//"))return t;if(t.startsWith("#"))return t;try{const e=new URL(t,location.origin);if("http:"===e.protocol||"https:"===e.protocol)return e.href}catch(n){return null}return null}(e.href),n=J(e.text||e.href||"");if(!t)return n;const a=[`href="${Q(t)}"`],o=String(e.target||"").trim(),i=String(e.rel||"").trim();return o&&a.push(`target="${Q(o)}"`),i?a.push(`rel="${Q(i)}"`):t.startsWith("http")&&a.push('target="_blank"','rel="noopener noreferrer"'),`${n}`}function be(e){return Boolean(function(e){return String(e||"").replace(he,"").replace(/\u00a0/g," ").replace(/\s+/g," ").trim()}(e))}function Ae(e,t,{multiline:n=true}={}){const a=String(e||"");if(!(null==t?void 0:t.length)){const e=J(a);return n?e.replace(/\n/g,"
"):e}let o,i="",r=0;he.lastIndex=0;const l=new Set;for(;o=he.exec(a);){i+=ye(a.slice(r,o.index),n);const e=Number(o[1]),s=t[e];s?(i+=fe(s),l.add(e)):i+=ye(o[0],n),r=o.index+o[0].length;}i+=ye(a.slice(r),n);for(let s=0;s"):n}function xe(e){return '"}const Se={translate:xe(''),hide:xe(''),original:xe(''),retry:xe('')};function Le(){return F(K.accountBlocklist)}function we(e){const t=R(e);return !!t&&Le().includes(t)}function Te(e){return U({...K,accountBlocklist:F(e)}),W(),Le()}function ke(e){const t=R(e);return t?(Te(Le().filter(e=>e!==t)),{ok:true,handle:t,removed:true}):{ok:false,reason:"invalid"}}function Me(e,t){const n=B(e);return !!(n&&Array.isArray(t)&&t.length)&&t.some(e=>{const t=B(e);return !!t&&(n===t||n.startsWith(`${t}-`))})}function Ce(){return Array.isArray(K.autoAllowlist)?[...K.autoAllowlist]:[]}function He(e){const t=R(e);return !!t&&Ce().includes(t)}function Ee(e,t={}){return U({...K,...t,autoAllowlist:[...new Set(e.map(R).filter(Boolean))].sort()}),W(),Ce()}function $e(e){const t=R(e);return t?(Ee(Ce().filter(e=>e!==t)),{ok:true,handle:t,removed:true}):{ok:false,reason:"invalid"}}function Pe(e){return e&&e instanceof Element?e.closest('article[data-testid="tweet"]'):null}function _e(e){if(!(e&&e instanceof Element))return null;const t=Pe(e);if(!t)return null;const n=[...t.querySelectorAll('[data-testid="tweetText"]')];if(n.length<2)return null;if(n[0]===e)return null;const a=e.closest('[data-testid="quoteTweet"]')||e.closest('div[role="link"]')||null;return a&&t.contains(a)&&a.contains(e)?a:null}function Re(e){if(!e)return null;const t=e.querySelector('[data-testid="User-Name"]');if(t)for(const n of t.querySelectorAll("a[href]")){const e=I(n.getAttribute("href"));if(e)return e}for(const n of e.querySelectorAll('a[href^="/"]')){const e=n.getAttribute("href")||"";if(/\/status\//i.test(e))continue;const t=I(e);if(t)return t}return null}function Ie(e){if(!(e&&e instanceof Element))return null;const t=_e(e);if(t){const e=Re(t);if(e)return e}const n=Pe(e);if(n){for(const e of n.querySelectorAll('[data-testid="User-Name"]')){if(t&&t.contains(e))continue;const n=Re(e);if(n)return n}return Re(n)}return Re(e.parentElement)}const qe=["auxclick","mousedown","mouseup","pointerdown","pointerup","touchstart","touchend"],Be="data-xt-observed",ze="data-xt-auto-done",Fe="data-xt-auto-queued",De="data-xt-original-html",Ne="data-xt-translated-html",Oe="data-xt-source-lang",Ue="data-xt-peek-bound";let Ke=null,je=0;const Ge=[];function Xe(){return "auto"===K.translateMode}function Ye(){return "replace"===K.displayMode}function Ve(){const e=K.replaceReveal;return "hover"===e||"split"===e?e:"button"}function We(){return Ye()&&"hover"===Ve()}function Ze(e){const t=lt(e);if(!t)return;const n=t.querySelector(`[${h}]`),a=Boolean(t.querySelector(`[${f}]`)),o=Boolean(!n||n.hidden)&&!a;t.classList.toggle("xt-toolbar--quiet",o);}function Je(e,t){if(e.dataset.xtState="shown",We())return function(e){e.classList.remove("is-loading"),e.disabled=false,e.removeAttribute("aria-busy");}(e),e.hidden=true,void Ze(t);e.hidden=false,kt(e,Ye()?G.btnShowOriginal:G.btnHide),Ze(t);}function Qe(e,t){e.dataset.xtState="",e.hidden=false,kt(e,G.btnTranslate),Ze(t);}function et(e){if(!Xe())return false;if(it(e))return false;const t=Ie(e);return !we(t)&&function(e){return "auto"===K.translateMode&&!we(e)&&("allowlist"!==K.autoScope||He(e))}(t)}const tt=/^(show original|показать оригинал|mostrar (el )?original|afficher l['’]original|original anzeigen|mostra (l['’])?originale|オリジナルを表示|显示原文|顯示原文|mostrar original|about automatic translation|об автоматическом переводе|acerca de la traducci[oó]n autom[aá]tica|à propos de la traduction automatique|informationen zur automatischen [üu]bersetzung|informazioni sulla traduzione automatica|自動翻訳について|关于自动翻译|關於自動翻譯|sobre a tradu[cç][aã]o autom[aá]tica)$/i;function nt(e){var t;return Boolean(null==(t=null==e?void 0:e.closest)?void 0:t.call(e,`[${b}], [${h}], [${f}], .xt-header-action, .xt-btn`))}function at(e){var t,n,a;if(!e||!(e instanceof Element)||nt(e))return false;if("tweetText"===(null==(t=e.getAttribute)?void 0:t.call(e,"data-testid")))return false;if(null==(n=e.querySelector)?void 0:n.call(e,':scope > [data-testid="tweetText"]'))return false;if(null==(a=e.matches)?void 0:a.call(e,'[data-testid="quoteTweet"]'))return false;for(const o of e.querySelectorAll("svg path[d]"))if(!nt(o)&&(o.getAttribute("d")||"").includes("M12.745 20.54"))return true;for(const o of e.querySelectorAll("button[aria-label]")){if(nt(o))continue;const e=(o.getAttribute("aria-label")||"").trim();if(tt.test(e))return true}return false}function ot(e,t){for(const n of ["previousElementSibling","nextElementSibling"]){let a=e[n];for(;a;){if(true===t(a))return true;a=a[n];}}return false}function it(e){return false!==K.skipNativeAutoTranslate&&function(e){const t=_e(e),n=Pe(e),a=t||n;if(!a)return false;let o=e;for(let i=0;i<6&&o&&a.contains(o);i+=1){if(ot(o,n=>{var a,o,i,r;return n!==e&&!(null==(a=n.contains)?void 0:a.call(n,e))&&"tweetText"!==(null==(o=n.getAttribute)?void 0:o.call(n,"data-testid"))&&!(!t&&(null==(i=n.matches)?void 0:i.call(n,'[data-testid="quoteTweet"]')))&&!(null==(r=n.querySelector)?void 0:r.call(n,'[data-testid="User-Name"], [data-testid="caret"]'))&&at(n)}))return true;if(o===a)break;o=o.parentElement;}return false}(e)}function rt(e,t){if(!e||!t)return false;const n=e.closest('[data-testid="quoteTweet"]');return Boolean(n&&t.contains(n))}function lt(e){var t;const n=e.querySelector(`[${b}]`);if(n)return n;const a=e.nextElementSibling;if(null==(t=null==a?void 0:a.hasAttribute)?void 0:t.call(a,b))return a;const o=_e(e);if(o){const e=o.querySelector(`[${b}]`);if(e)return e}return null}function st(e){const t=lt(e),n=null==t?void 0:t.querySelector(`[${h}]`);if(n)return n;const a=_e(e);if(a)return a.querySelector(`.xt-header-action [${h}]`)||a.querySelector(`[${h}][data-xt-header="1"]`);const o=Pe(e);return o?o.querySelector(`.xt-header-action [${h}]`)||o.querySelector(`[${h}][data-xt-header="1"]`):null}function ct(e,t){const n=_e(e);n?t.parentElement===n&&n.lastElementChild===t||n.appendChild(t):e.nextElementSibling!==t&&e.insertAdjacentElement("afterend",t);}function dt(e,t){const n=function(e){var t;const n=function(e){const t=_e(e);if(!t)return null;const n=e=>{var t,n,a;return Boolean((null==(t=null==e?void 0:e.querySelector)?void 0:t.call(e,'[data-testid="Tweet-User-Avatar"]'))&&(null==(n=null==e?void 0:e.querySelector)?void 0:n.call(e,'[data-testid="User-Name"]'))&&!(null==(a=e.querySelector)?void 0:a.call(e,'[data-testid="tweetText"]')))},a=[...t.querySelectorAll(".r-1awozwy.r-18u37iz.r-1wbh5a2, .r-1habvwh.r-18u37iz.r-1wbh5a2")].find(n);if(a)return {row:a,before:null};const o=t.querySelector('[data-testid="User-Name"]');if(!o)return null;let i=o.parentElement;for(;i&&i!==t;){if(n(i)){const e=getComputedStyle(i);if(("flex"===e.display||"inline-flex"===e.display)&&String(e.flexDirection||"row").startsWith("row"))return {row:i,before:null}}i=i.parentElement;}return null}(e);if(n)return n;if(_e(e))return null;const a=Pe(e);if(!a)return null;let o=null;for(const l of a.querySelectorAll("button[aria-label]"))if(!rt(l,a)&&/grok/i.test(l.getAttribute("aria-label")||"")){o=l;break}if(null==(t=null==o?void 0:o.parentElement)?void 0:t.parentElement){const e=o.parentElement,t=e.parentElement;if(t&&a.contains(t))return {row:t,before:e}}const i=[...a.querySelectorAll('[data-testid="caret"]')].find(e=>!rt(e,a));if(!i)return null;let r=i;for(;r.parentElement&&r.parentElement!==a;){const e=r.parentElement,t=getComputedStyle(e);if(("flex"===t.display||"inline-flex"===t.display)&&String(t.flexDirection||"").startsWith("row")&&e.children.length>=1&&e.children.length<=4){const t=[...e.children].find(e=>e.contains(i));if(t)return {row:e,before:t}}r=e;}return null}(e);if(n){t.classList.add("xt-btn--header"),t.setAttribute("data-xt-header","1");let a=t.closest(".xt-header-action");a?t.parentElement!==a&&a.appendChild(t):(a=document.createElement("div"),a.className="xt-header-action",a.appendChild(t));const o=Boolean(_e(e));a.classList.toggle("xt-header-action--quote",o),o||!n.before?a.parentElement===n.row&&n.row.lastElementChild===a||n.row.appendChild(a):a.parentElement===n.row&&a.nextElementSibling===n.before||n.row.insertBefore(a,n.before);const i=t.getAttribute("aria-label");return void(i&&(t.title=i))}t.classList.remove("xt-btn--header"),t.removeAttribute("data-xt-header");const a=t.closest(".xt-header-action"),o=xt(e);a&&a.replaceWith(t),t.parentElement!==o&&o.insertBefore(t,o.firstChild);}function ut(e){return function(e){!function(e){for(const t of [...e.querySelectorAll("img[alt]")]){const e=String(t.getAttribute("alt")||"").replace(/\u00a0/g," ").trim();e&&t.replaceWith(document.createTextNode(e));}for(const t of [...e.querySelectorAll('[role="img"][aria-label]')]){if("IMG"===t.tagName)continue;const e=String(t.getAttribute("aria-label")||"").replace(/\u00a0/g," ").trim();e&&t.replaceWith(document.createTextNode(e));}}(e);const t=[],n=[...e.querySelectorAll("a[href]")];for(const a of n){const e=t.length;t.push({href:a.getAttribute("href")||"",text:String(a.innerText||a.textContent||"").replace(/\u00a0/g," ").trim(),target:a.getAttribute("target")||"",rel:a.getAttribute("rel")||""}),a.replaceWith(document.createTextNode(`${e}`));}return {text:String(e.innerText||e.textContent||"").replace(/\u00a0/g," ").trim(),links:t}}(function(e){const t=e.getAttribute(De);if(null!=t){const e=document.createElement("div");return e.innerHTML=t,e}const n=e.cloneNode(true);return n.querySelectorAll(`[${b}], [${h}], [${f}]`).forEach(e=>e.remove()),n}(e))}function pt(e){var t,n,a;At(e);const o=st(e),i=null==(t=null==o?void 0:o.closest)?void 0:t.call(o,".xt-header-action");null==(n=lt(e))||n.remove(),i?i.remove():"1"===(null==(a=null==o?void 0:o.getAttribute)?void 0:a.call(o,"data-xt-header"))&&o.remove(),e.removeAttribute(m),e.removeAttribute(Be),e.removeAttribute(ze),e.removeAttribute(Fe);try{null==Ke||Ke.unobserve(e);}catch(r){}}function gt(e){ht(e);const t=e.getAttribute(De);null!=t&&(e.innerHTML=t,e.removeAttribute(De),e.removeAttribute(Ne),e.removeAttribute(Oe),e.classList.remove("xt-text--translated","xt-text--split","xt-text--peeking","xt-text--hover-peek","xt-text--translating","xt-text--blur-ready"));}const vt=new WeakMap;function mt(e){const t=vt.get(e);if(!t)return;const n=e.getBoundingClientRect();n.width<=0&&n.height<=0?t.badge.hidden=true:(t.badge.hidden=false,t.badge.style.top=`${Math.max(4,n.top-6)}px`,t.badge.style.left=`${n.right}px`,t.badge.style.transform="translate(-100%, -100%)");}function ht(e){const t=vt.get(e);t&&(window.removeEventListener("scroll",t.onMove,true),window.removeEventListener("resize",t.onMove),t.badge.remove(),vt.delete(e));}function ft(e,t){if(t)return e.setAttribute("aria-busy","true"),e.classList.add("xt-text--blur-ready"),void requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.isConnected&&"true"===e.getAttribute("aria-busy")&&e.classList.add("xt-text--translating");});});e.classList.remove("xt-text--translating","xt-text--blur-ready"),e.removeAttribute("aria-busy");}function bt(e,t){const n=Ve(),a=e.getAttribute(De)||"";if(e.setAttribute(Ne,t),e.classList.remove("xt-text--peeking","xt-text--split","xt-text--hover-peek","xt-text--translating","xt-text--blur-ready"),e.removeAttribute("aria-busy"),"split"===n)return e.innerHTML=`
${J(G.originalLabel)}
${a}
${J(G.translationLabel)}
${t}
`,void e.classList.add("xt-text--translated","xt-text--split");e.innerHTML=t,e.classList.add("xt-text--translated"),"hover"===n&&(e.classList.add("xt-text--hover-peek"),function(e){"1"!==e.getAttribute(Ue)&&(e.setAttribute(Ue,"1"),e.addEventListener("mouseenter",()=>{if(!Ye()||"hover"!==Ve())return;if(!e.classList.contains("xt-text--translated"))return;if(e.classList.contains("xt-text--split"))return;if(e.classList.contains("xt-text--translating"))return;const t=e.getAttribute(De);if(null==t)return;e.innerHTML=t,e.classList.add("xt-text--peeking");const n=e.getAttribute(Oe);n&&function(e,t){ht(e);const n=function(e){const t=function(e){const t=B(e);return t&&(L.find(e=>B(e.code)===t)||L.find(e=>t.startsWith(`${B(e.code)}-`))||(t.startsWith("zh")?L.find(e=>"zh-CN"===e.code):null))||null}(e);if(t)return `${t.flag} ${t.code}`;const n=ge(e,j);if(n)return n;const a=B(e);return a?a.toUpperCase():""}(t);if(!n)return;const a=document.createElement("div");a.className="xt-peek-badge",a.textContent=n,a.title=P(G.detectedLang,{lang:n}),a.setAttribute("aria-hidden","true"),document.body.appendChild(a);const o=()=>mt(e);vt.set(e,{badge:a,onMove:o}),mt(e),window.addEventListener("scroll",o,true),window.addEventListener("resize",o);}(e,n);}),e.addEventListener("mouseleave",()=>{if(!e.classList.contains("xt-text--peeking"))return;ht(e);const t=e.getAttribute(Ne);null!=t?(e.innerHTML=t,e.classList.remove("xt-text--peeking"),e.classList.add("xt-text--translated","xt-text--hover-peek")):e.classList.remove("xt-text--peeking");}));}(e));}function At(e){gt(e),Tt(e,{remove:true});}function yt(e,t){if("1"===e.dataset.xtBound)return;e.dataset.xtBound="1";const n=e=>{e.stopPropagation();};for(const a of qe)e.addEventListener(a,n,true);e.addEventListener("click",n=>{var a,o,i,r;n.stopPropagation();const l=null==(o=(a=n.target).closest)?void 0:o.call(a,"a[href]");if(l&&e.contains(l))return;n.preventDefault();const s=null==(r=(i=n.target).closest)?void 0:r.call(i,"[data-xt-retry]");if(s&&e.contains(s)){const e=st(t);return void(e&&(t.removeAttribute(ze),Mt(t,e)))}},true);}function xt(e){let t=lt(e);return t||(t=document.createElement("div"),t.className="xt-toolbar",t.setAttribute(b,"1")),ct(e,t),yt(t,e),t}function St(e,t){if("1"===e.dataset.xtBound)return;e.dataset.xtBound="1";const n=e=>{e.stopPropagation();};for(const a of qe)e.addEventListener(a,n,true);e.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation(),function(e,t){if(!t.classList.contains("is-loading"))"shown"===t.dataset.xtState?(At(e),Qe(t,e),e.setAttribute(ze,"1")):(e.removeAttribute(ze),Mt(e,t));}(t,e);},true);}function Lt(e){let t=st(e);return t||(t=document.createElement("button"),t.type="button",t.className="xt-btn",t.setAttribute(h,"1"),kt(t,G.btnTranslate)),dt(e,t),St(t,e),Ze(e),t}function wt(e,t){if(Ye()&&!t.error&&!t.panelOnly&&null!=t.translated)return Tt(e,{remove:true}),function(e,t,n=[],a=null){e.hasAttribute(De)||e.setAttribute(De,e.innerHTML);const o=B(a);o?e.setAttribute(Oe,o):e.removeAttribute(Oe),bt(e,Ae(t,n));}(e,t.translated,t.links||[],t.detected),null;gt(e);const n=function(e){const t=xt(e);let n=t.querySelector(`[${f}]`);return n||(n=document.createElement("div"),n.className="xt-result",n.setAttribute(f,"1"),n.innerHTML='
',t.appendChild(n),n)}(e),a=n.querySelector(".xt-result__inner");return a?(a.innerHTML=function({translated:e,detected:t,error:n,links:a}){if(n)return `
${J(n)}
`;const o=[];t&&o.push(P(G.detectedLang,{lang:t}));const i=Ae(e,a||[]);return `
${J(G.translationLabel)}
`+(o.length?`
${J(o.join(" · "))}
`:"")+`
${i}
`}(t),n.classList.remove("is-open","is-closing"),requestAnimationFrame(()=>{n.classList.add("is-open");}),n):n}function Tt(e,{remove:t=false}={}){var n;const a=null==(n=lt(e))?void 0:n.querySelector(`[${f}]`);if(!a)return;const o=()=>{if(a.classList.remove("is-closing"),t)a.remove();else {const e=a.querySelector(".xt-result__inner");e&&(e.innerHTML="");}};if(!a.classList.contains("is-open"))return void o();a.classList.remove("is-open"),a.classList.add("is-closing");const i=e=>{e.target===a.querySelector(".xt-result__clip")&&(a.removeEventListener("transitionend",i),o());};a.addEventListener("transitionend",i),setTimeout(()=>{a.removeEventListener("transitionend",i),o();},360);}function kt(e,t,{loading:n=false}={}){const a=e.classList.contains("xt-btn--header");if(e.classList.toggle("is-loading",n),e.disabled=n,e.setAttribute("aria-label",t),n)return e.setAttribute("aria-busy","true"),void(e.innerHTML=`${J(t)}`);e.removeAttribute("aria-busy"),e.innerHTML=`${function(e){return e===G.btnShowOriginal?Se.original:e===G.btnHide?Se.hide:e===G.btnRetry?Se.retry:Se.translate}(t)}${J(t)}`,a?e.title=t:e.removeAttribute("title");}async function Mt(e,t){const{text:n,links:a}=ut(e);if(!be(n))return ft(e,false),void pt(e);const o=function(e){if(e&&"auto"!==e)return "zh"===e?"zh-CN":e;const t=j&&"auto"!==j?j:E();return "zh"===t?"zh-CN":t||"en"}(K.targetLang);At(e),function(e,t){if(We())return ft(e,true),t.hidden=true,t.classList.add("is-loading"),t.disabled=true,t.setAttribute("aria-busy","true"),void Ze(e);t.hidden=false,Ze(e),kt(t,G.translating,{loading:true});}(e,t);try{const i=await async function(e,t){const n=String(e||"").trim();if(!n)throw new Error("empty");const a=s(K.provider)?K.provider:l("google").id,o=function(e,t,n){return `tr:${e}:${n}:${t}`}(a,n,t),i=function(e){const t=ee(),n=t[e];if(!n||"object"!=typeof n)return null;const a=ne();return a<=0?null:Date.now()-(n.at||0)>a?(delete t[e],te(),null):(n.at=Date.now(),te(),n.value)}(o);if(i&&"object"==typeof i&&i.text)return {text:i.text,detectedSourceLang:i.detectedSourceLang||null,fromCache:!0,provider:a};if(V.has(o))return V.get(o);const r=(async()=>{const e=await me(a,n,t),i={text:e.text,detectedSourceLang:e.detectedSourceLang||null,fromCache:!1,provider:a};return function(e,t){ne()<=0||(ee()[e]={value:t,at:Date.now()},te());}(o,{text:i.text,detectedSourceLang:i.detectedSourceLang}),i})();V.set(o,r);try{return await r}finally{V.delete(o);}}(n,o);ft(e,!1);const r=function(e){if(!e)return null;if(Me(e,z(K.langBlocklist)))return "blocked";const t=z(K.langAllowlist);return t.length&&!Me(e,t)?"not-allowed":null}(i.detectedSourceLang);r?(wt(e,{translated:"blocked"===r?G.langSkippedBlocked:G.langSkippedNotAllowed,detected:i.detectedSourceLang,fromCache:i.fromCache,panelOnly:!0}),t.hidden=!1,kt(t,G.btnHide),t.dataset.xtState="shown",Ze(e)):i.detectedSourceLang&&i.detectedSourceLang.toLowerCase()===o.toLowerCase()&&i.text.trim()===n.trim()?(Tt(e,{remove:!0}),Qe(t,e)):(wt(e,{translated:i.text,detected:i.detectedSourceLang,fromCache:i.fromCache,links:a}),Je(t,e)),e.setAttribute(ze,"1");}catch(i){ft(e,false),wt(e,{error:"missing-config"===(null==i?void 0:i.message)?G.errProviderConfig:G.errNetwork}),Qe(t,e),e.setAttribute(ze,"1");}}function Ct(){for(;je<2&&Ge.length;){const e=Ge.shift();if(!e||!document.contains(e))continue;if(e.removeAttribute(Fe),!et(e))continue;if("1"===e.getAttribute(ze))continue;const t=st(e);t&&!t.classList.contains("is-loading")&&"shown"!==t.dataset.xtState?(je+=1,Promise.resolve(Mt(e,t)).catch(()=>{}).finally(()=>{je=Math.max(0,je-1),Ct();})):"shown"===(null==t?void 0:t.dataset.xtState)&&e.setAttribute(ze,"1");}}function Ht(e){if(!et(e))return;if("1"===e.getAttribute(ze))return;if("1"===e.getAttribute(Fe))return;const t=st(e);t&&!t.classList.contains("is-loading")&&"shown"!==t.dataset.xtState?(e.setAttribute(Fe,"1"),Ge.push(e),Ct()):"shown"===(null==t?void 0:t.dataset.xtState)&&e.setAttribute(ze,"1");}function Et(e){if(!et(e))return;const t=Ke||(Ke=new IntersectionObserver(e=>{if(Xe())for(const t of e)t.isIntersecting&&t.target instanceof HTMLElement&&Ht(t.target);},{root:null,rootMargin:"0px",threshold:0}),Ke);"1"!==e.getAttribute(Be)&&(e.setAttribute(Be,"1"),t.observe(e));}function $t(e){if(we(Ie(e)))pt(e);else if(it(e))pt(e);else if(function(e){const{text:t}=ut(e);return be(t)}(e)){if(e.hasAttribute(m)){const t=lt(e);t&&(ct(e,t),yt(t,e));const n=st(e);return n?(dt(e,n),St(n,e)):Lt(e),void Et(e)}e.setAttribute(m,"1"),Lt(e),Et(e);}else pt(e);}function Pt(){Xe()||(Ge.length=0,je=0,Ke&&(Ke.disconnect(),Ke=null),document.querySelectorAll(`[${Be}]`).forEach(e=>{e.removeAttribute(Be);})),function(e=document){const t=new Set,n=[],a=S[0];for(const o of S)e.querySelectorAll(o).forEach(e=>{var o,i,r;if(t.has(e))return;if(!(null==(o=e.closest)?void 0:o.call(e,'article[data-testid="tweet"]')))return;const l=null==(r=null==(i=e.parentElement)?void 0:i.closest)?void 0:r.call(i,a);l&&l!==e||(t.add(e),n.push(e));});return n}().forEach($t),Xe()&&document.querySelectorAll(`[${m}]`).forEach(e=>{et(e)&&Ht(e);}),document.querySelectorAll(`[${m}]`).forEach(e=>{const t=st(e);t&&!t.classList.contains("is-loading")&&("shown"===t.dataset.xtState?Je(t,e):Qe(t,e));});}const _t="xt-toast-host",Rt={success:'',info:'',warning:'',error:''};function It(e){if(!e||"1"===e.dataset.xtLeaving)return;e.dataset.xtLeaving="1",e.classList.add("is-leaving");const t=()=>e.remove();e.addEventListener("transitionend",t,{once:true}),setTimeout(t,280);}function qt(e,t={}){var n;let a="",o="",i=t;e&&"object"==typeof e&&!Array.isArray(e)?(i={...e,...t},a=i.title||"",o=i.message||i.description||""):(o=String(e||""),a=t.title||"");const r=function(e){return ["info","success","warning","error"].includes(e)?e:"info"}(i.type);if(a=String(a||"").trim()||function(e){return "success"===e?G.toastTitleSuccess||"Success":"warning"===e?G.toastTitleWarning||"Notice":"error"===e?G.toastTitleError||"Error":G.toastTitleInfo||"Info"}(r),o=String(o||"").trim(),!a&&!o)return null;const l=Number.isFinite(i.duration)&&i.duration>0?i.duration:4200,s=function(){let e=document.getElementById(_t);return (null==e?void 0:e.isConnected)||(e=document.createElement("div"),e.id=_t,e.className="xt-toast-host",e.setAttribute("aria-live","polite"),e.setAttribute("aria-relevant","additions"),(document.body||document.documentElement).appendChild(e)),e}();for(;s.children.length>=4;)It(s.firstElementChild);const c=G.toastDismiss||"Dismiss",d=document.createElement("div");return d.className=`xt-toast xt-toast--${r}`,d.setAttribute("role","status"),d.innerHTML=``+(a?`${J(a)}`:"")+(o?`${J(o)}`:"")+``,null==(n=d.querySelector(".xt-toast__close"))||n.addEventListener("click",()=>It(d)),s.appendChild(d),requestAnimationFrame(()=>d.classList.add("is-visible")),setTimeout(()=>It(d),l),d}const Bt="xt-settings-root",zt=[{id:"general",labelKey:"sectionGeneral"},{id:"providers",labelKey:"sectionProviders"},{id:"cache",labelKey:"sectionCache"},{id:"about",labelKey:"sectionAbout"}];let Ft="r-1hdo0pc";function Dt(e){var t;const n=null==(t=null==e?void 0:e.querySelector)?void 0:t.call(e,"div[dir]");if(!n)return null;const a=getComputedStyle(n).fontWeight,o=Number.parseInt(a,10);return Number.isFinite(o)?o:"bold"===a?700:"normal"===a?400:null}function Nt(e){"1"!==e.dataset.xtHoverObs&&(e.dataset.xtHoverObs="1",new MutationObserver(t=>{for(const n of t){if("attributes"!==n.type||"class"!==n.attributeName)continue;const t=n.target;if(!(t instanceof Element))continue;if(t.closest(`[${A}]`))continue;if(!e.contains(t))continue;const a=t.parentElement;if(!a||a.parentElement!==e)continue;if("link"!==a.getAttribute("role")&&"button"!==a.getAttribute("role"))continue;const o=new Set(String(n.oldValue||"").split(/\s+/).filter(Boolean)),i=[...t.classList].filter(e=>!o.has(e)&&/^r-[a-z0-9]+$/i.test(e));1===i.length&&(Ft=i[0]);}}).observe(e,{subtree:true,attributes:true,attributeFilter:["class"],attributeOldValue:true}));}function Ot(e){if(!(e instanceof HTMLElement)||"1"===e.dataset.xtNavHover)return;e.dataset.xtNavHover="1";const t=t=>{const n=function(e){return (null==e?void 0:e.firstElementChild)instanceof HTMLElement?e.firstElementChild:null}(e);n&&Ft&&n.classList.toggle(Ft,t);};e.addEventListener("pointerenter",()=>t(true)),e.addEventListener("pointerleave",()=>t(false)),e.addEventListener("focusin",()=>t(true)),e.addEventListener("focusout",n=>{n.relatedTarget instanceof Node&&e.contains(n.relatedTarget)||t(false);});}function Ut(e){const t=e.querySelector('[data-testid="AppTabBar_More_Menu"]');if((null==t?void 0:t.querySelector("svg"))&&t.querySelector("div[dir]"))return t;const n=[...e.querySelectorAll('a[role="link"], a[href]')].filter(e=>!e.hasAttribute(A)&&e.querySelector("svg")&&e.querySelector("div[dir]"));return n.find(e=>{if("page"===e.getAttribute("aria-current"))return false;const t=Dt(e);return null==t||t<600})||e.querySelector('a[data-testid="AppTabBar_Explore_Link"]')||e.querySelector('a[data-testid="AppTabBar_Profile_Link"]')||n[0]||null}function Kt(e){return e.querySelector('[data-testid="AppTabBar_More_Menu"]')||e.querySelector('a[href="/settings"]')||e.querySelector('a[href*="/settings"]')||null}function jt(e){e.setAttribute("aria-label",G.navSettings);const t=e.querySelector("[data-xt-nav-label]")||e.querySelector("div[dir] > span")||null;t&&(t.textContent=G.navSettings);}function Gt(e){let t;var n;return e instanceof HTMLAnchorElement?t=e.cloneNode(true):(t=document.createElement("a"),t.className=e.className,t.innerHTML=e.innerHTML),t.href="#",t.setAttribute(A,"1"),t.setAttribute("role","link"),t.removeAttribute("data-testid"),t.removeAttribute("type"),t.removeAttribute("aria-expanded"),t.removeAttribute("aria-haspopup"),t.removeAttribute("aria-describedby"),t.removeAttribute("aria-current"),t.setAttribute("aria-label",G.navSettings),t.tabIndex=0,t.querySelectorAll('[aria-live], [aria-label*="непрочит" i], [aria-label*="unread" i], [aria-label*="Количество" i]').forEach(e=>e.remove()),(n=t.querySelector("svg"))instanceof SVGElement&&(n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("aria-hidden","true"),n.removeAttribute("width"),n.removeAttribute("height"),n.innerHTML=''),function(e,t){const n=[...e.querySelectorAll("div[dir]")].find(e=>e.querySelector(":scope > span")&&!e.querySelector("svg"));if(n){const e=[...n.querySelectorAll(":scope > span")];return void(e[0]&&(e[0].textContent=t,e[0].setAttribute("data-xt-nav-label","1")))}const a=e.querySelector("span");a&&(a.textContent=t,a.setAttribute("data-xt-nav-label","1"));}(t,G.navSettings),Ot(t),t.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),hn();}),t}function Xt(e){const t=e.innerHTML||"";if(/gap:\s*20px/i.test(t)||/width:\s*26\.25px/i.test(t))return true;if(!e.querySelector("svg")||!e.querySelector("div[dir]"))return true;const n=Dt(e);return null!=n&&n>=600||!!e.classList.contains("xt-nav-item")||"1"!==e.dataset.xtNavHover}function Yt(){for(const e of function(){const e=[...document.querySelectorAll('[data-testid="AppTabBar"]'),...document.querySelectorAll('nav[role="navigation"]')],t=new Set;return e.filter(e=>!t.has(e)&&(t.add(e),Boolean(e.querySelector('[data-testid="AppTabBar_More_Menu"]')||e.querySelector('a[href="/settings"]')||e.querySelector('a[href*="/settings"]')||e.querySelector('a[data-testid="AppTabBar_Home_Link"]'))))}()){Nt(e);const t=e.querySelector(`[${A}]`),n=Ut(e);if(!n)continue;if(t){Xt(t)?t.replaceWith(Gt(n)):(jt(t),Ot(t));continue}const a=Kt(e),o=Gt(n);a?a.insertAdjacentElement("beforebegin",o):n.parentElement===e?n.insertAdjacentElement("beforebegin",o):e.appendChild(o);}}function Vt(e){if(!e||"auto"===e)return `${H} ${G.badgeLangAuto}`;const t=(n=e)&&"auto"!==n&&(L.find(e=>e.code===n)||("zh"===n?L.find(e=>"zh-CN"===e.code):null))||null;var n;return t?`${t.flag} ${t.code}`:e}function Wt(e){const t=e||re();return t.enabled?`${t.pct<10&&t.pct>0?t.pct.toFixed(1):String(Math.round(t.pct))}%`:G.badgeCacheOff}function Zt(e){return l(e||K.provider).badge}function Jt(e,t={}){var n,a;const o=e.querySelector('[data-xt-tab-badge="providers"]');o&&(o.textContent=Zt(null!=(n=t.provider)?n:K.provider));const i=null!=(a=t.targetLang)?a:K.targetLang,r=e.querySelector('[data-xt-tab-badge="general"]');r&&(r.textContent=Vt(i));const l=K.cacheHours;null!=t.cacheHours&&Number.isFinite(t.cacheHours)&&(K.cacheHours=t.cacheHours);const s=re();K.cacheHours=l;const c=e.querySelector('[data-xt-tab-badge="cache"]');c&&(c.textContent=Wt(s),c.dataset.level=le(s)),en(e);}function Qt(e,t){const n=e===t;return `class="xt-settings__panel${n?" is-active":""}" id="xt-panel-${Q(e)}" role="tabpanel" aria-labelledby="xt-tab-${Q(e)}"${n?"":" hidden"}`}function en(e){const t=e.querySelector(".xt-settings__tabs"),n=e.querySelector(".xt-settings__tab-ink"),a=e.querySelector(".xt-settings__tab.is-active");t&&n&&a&&(n.style.width=`${a.offsetWidth}px`,n.style.transform=`translateX(${a.offsetLeft}px)`);}function tn(e,t){var n;zt.some(e=>e.id===t)&&(e.querySelectorAll("[data-xt-tab]").forEach(e=>{const n=e.getAttribute("data-xt-tab")===t;e.classList.toggle("is-active",n),e.setAttribute("aria-selected",n?"true":"false"),e.tabIndex=n?0:-1;}),e.querySelectorAll('[role="tabpanel"]').forEach(e=>{const n=e.id===`xt-panel-${t}`;e.classList.toggle("is-active",n),e.hidden=!n;}),en(e),null==(n=e.querySelector(".xt-settings__tab.is-active"))||n.scrollIntoView({inline:"nearest",block:"nearest",behavior:"smooth"}));}function nn(e,t,{desc:n="",className:a=""}={}){const o=n?`

${J(n)}

`:"";return `\n
\n
\n

${J(e)}

\n ${o}\n
\n
${t}
\n
\n `}function an(e,t,n=""){return `\n \n `}function on({title:e,hint:t,inputHtml:n,addAttr:a,hostAttr:o,hostHtml:i,addLabel:r}){return `\n
\n
\n
${J(e)}
\n ${t?`

${J(t)}

`:""}\n
\n
\n ${n}\n \n
\n
${i}
\n
\n `}function rn(e){const t=B(e),n=L.find(e=>B(e.code)===t);return n?`${n.flag} ${n.name}`:e}function ln(e,t){const n=Array.isArray(e)?e:[];return n.length?`\n
    \n ${n.map(e=>`\n
  • \n ${J(q(e))}\n \n
  • `).join("")}\n
\n `:`

${J(G[t]||G.allowlistEmpty)}

`}function sn(e,t){const n=Array.isArray(e)?e:[];return n.length?`\n
    \n ${n.map(e=>`\n
  • \n ${J(rn(e))}\n \n
  • `).join("")}\n
\n `:`

${J(G[t]||G.langListEmpty)}

`}function cn(e,t){return [...e.querySelectorAll(`${t} [data-xt-handle-item]`)].map(e=>R(e.getAttribute("data-handle"))).filter(Boolean)}function dn(e,t){return [...e.querySelectorAll(`${t} [data-xt-lang-item]`)].map(e=>B(e.getAttribute("data-code"))).filter(Boolean)}function un(e,t,n,a){const o=e.querySelector(t);o&&(o.innerHTML=ln(n,a));}function pn(e,t,n,a){const o=e.querySelector(t);o&&(o.innerHTML=sn(n,a));}function gn(e=[]){const t=new Set(e.map(B));return L.map(e=>{const n=B(e.code);return t.has(n)?"":``}).join("")}function vn(e){var t,n,a;const o=null==e?void 0:e.querySelector("form");if(!o)return;const i="auto"===(null==(t=o.translateMode)?void 0:t.value)?"auto":"button",r="allowlist"===(null==(n=o.autoScope)?void 0:n.value)?"allowlist":"all",l="replace"===(null==(a=o.displayMode)?void 0:a.value)?"replace":"panel",s=o.querySelector("[data-xt-auto-options]"),c=o.querySelector("[data-xt-allowlist-panel]"),d=o.querySelector("[data-xt-replace-options]");s&&(s.hidden="auto"!==i),c&&(c.hidden=!("auto"===i&&"allowlist"===r)),d&&(d.hidden="replace"!==l);}function mn(){var e;null==(e=document.getElementById(Bt))||e.remove(),function(){const e=document.documentElement,t=document.body;if(!t||!e.classList.contains("xt-scroll-lock"))return;const n=Number(t.dataset.xtScrollY||0);e.classList.remove("xt-scroll-lock"),t.classList.remove("xt-scroll-lock"),t.style.top="",delete t.dataset.xtScrollY,window.scrollTo(0,n);}();}function hn(){var e,t,a,o,r,l,s,c,p,v,m,h,f,b;mn(),W();const A="general",y=document.createElement("div");var x,S;y.id=Bt,y.className="xt-settings-backdrop",y.innerHTML=`\n \n
\n \n
\n \n \n `;const T=y.querySelector(".xt-settings");y.addEventListener("click",e=>{var t,n;(e.target===y||(null==(n=(t=e.target).closest)?void 0:n.call(t,"[data-xt-close]")))&&mn();}),null==(e=null==T?void 0:T.querySelector(".xt-settings__tabs"))||e.addEventListener("click",e=>{var t,n;const a=null==(n=null==(t=e.target)?void 0:t.closest)?void 0:n.call(t,"[data-xt-tab]");a&&T.contains(a)&&tn(T,a.getAttribute("data-xt-tab"));}),null==(t=null==T?void 0:T.querySelector(".xt-settings__tabs"))||t.addEventListener("keydown",e=>{var t,n;const a=[...T.querySelectorAll("[data-xt-tab]")],o=null==(n=null==(t=e.target)?void 0:t.closest)?void 0:n.call(t,"[data-xt-tab]");if(!o||!a.length)return;const i=a.indexOf(o);let r=i;if("ArrowRight"===e.key||"ArrowDown"===e.key)r=(i+1)%a.length;else if("ArrowLeft"===e.key||"ArrowUp"===e.key)r=(i-1+a.length)%a.length;else if("Home"===e.key)r=0;else {if("End"!==e.key)return;r=a.length-1;}e.preventDefault();const l=a[r].getAttribute("data-xt-tab");tn(T,l),a[r].focus();});const E=y.querySelector("form");E.addEventListener("submit",e=>{e.preventDefault();const t=function(e){var t,n,a,o,r,l,s,c;const d=Number(e.cacheHours.value),u=(null==(t=e.provider)?void 0:t.value)||"google",p={...K.providerConfig};for(const g of i){const t={...p[g.id]||{}};for(const a of g.fields){const o=e.querySelector(`[name="provider.${g.id}.${a.key}"]`);o&&(t[a.key]=String(null!=(n=o.value)?n:"").trim());}p[g.id]=t;}return {...K,provider:u,providerConfig:p,targetLang:e.targetLang.value||"auto",uiLocale:e.uiLocale.value||"auto",cacheHours:Number.isFinite(d)&&d>=0?Math.min(d,168):w.cacheHours,translateMode:"auto"===(null==(a=e.translateMode)?void 0:a.value)?"auto":"button",displayMode:"replace"===(null==(o=e.displayMode)?void 0:o.value)?"replace":"panel",replaceReveal:"hover"===(null==(r=e.replaceReveal)?void 0:r.value)||"split"===(null==(l=e.replaceReveal)?void 0:l.value)?e.replaceReveal.value:"button",autoScope:"allowlist"===(null==(s=e.autoScope)?void 0:s.value)?"allowlist":"all",skipNativeAutoTranslate:Boolean(null==(c=e.skipNativeAutoTranslate)?void 0:c.checked),autoAllowlist:cn(e,"[data-xt-allowlist-host]"),accountBlocklist:cn(e,"[data-xt-blocklist-host]"),langAllowlist:dn(e,"[data-xt-lang-allow-host]"),langBlocklist:dn(e,"[data-xt-lang-block-host]")}}(E);U(t),W(),Yt(),Pt(),qt(G.settingsSaved,{type:"success"}),mn();}),null==(a=y.querySelector("[data-xt-clear]"))||a.addEventListener("click",()=>{var e,t,a;!function(){Z({});try{n(g,{});}catch(e){}}(),ce(T),Jt(T,{cacheHours:Number(null==(e=E.cacheHours)?void 0:e.value),targetLang:null==(t=E.targetLang)?void 0:t.value,provider:null==(a=E.provider)?void 0:a.value}),qt(G.settingsCacheCleared,{type:"info"});});const $=E.querySelector('input[name="cacheHours"]');function _(e,t,n,a){const o=E.querySelector(`input[name="${e}"]`),i=R(null==o?void 0:o.value);if(!i)return void qt(G.allowlistInvalid,{type:"warning"});const r=cn(E,t);r.includes(i)?qt(P(G.allowlistExists,{handle:q(i)}),{type:"info"}):(r.push(i),r.sort(),un(E,t,r,a),o&&(o.value=""),null==o||o.focus());}function I(e,t,n){const a=E.querySelector(`select[name="${e}"]`),o=B(null==a?void 0:a.value);if(!o)return;const i=dn(E,t);i.includes(o)?qt(P(G.langListExists,{lang:rn(o)}),{type:"info"}):(i.push(o),i.sort(),pn(E,t,i,n),a&&(a.innerHTML=gn(i)));}null==$||$.addEventListener("input",()=>{var e,t;const n=Number($.value),a=K.cacheHours;Number.isFinite(n)&&n>=0&&(K.cacheHours=n),ce(T),K.cacheHours=a,Jt(T,{cacheHours:Number.isFinite(n)?n:K.cacheHours,targetLang:null==(e=E.targetLang)?void 0:e.value,provider:null==(t=E.provider)?void 0:t.value});}),null==(o=E.querySelector('select[name="targetLang"]'))||o.addEventListener("change",()=>{var e,t;Jt(T,{targetLang:E.targetLang.value,cacheHours:Number(null==(e=E.cacheHours)?void 0:e.value),provider:null==(t=E.provider)?void 0:t.value});}),null==(r=E.querySelector('select[name="translateMode"]'))||r.addEventListener("change",()=>{vn(T);}),null==(l=E.querySelector('select[name="autoScope"]'))||l.addEventListener("change",()=>{vn(T);}),null==(s=E.querySelector('select[name="displayMode"]'))||s.addEventListener("change",()=>{vn(T);}),null==(c=E.querySelector("[data-xt-allowlist-add]"))||c.addEventListener("click",()=>{_("allowlistInput","[data-xt-allowlist-host]",0,"allowlistEmpty");}),null==(p=E.querySelector('input[name="allowlistInput"]'))||p.addEventListener("keydown",e=>{var t;"Enter"===e.key&&(e.preventDefault(),null==(t=E.querySelector("[data-xt-allowlist-add]"))||t.click());}),null==(v=E.querySelector("[data-xt-blocklist-add]"))||v.addEventListener("click",()=>{_("blocklistInput","[data-xt-blocklist-host]",0,"blocklistEmpty");}),null==(m=E.querySelector('input[name="blocklistInput"]'))||m.addEventListener("keydown",e=>{var t;"Enter"===e.key&&(e.preventDefault(),null==(t=E.querySelector("[data-xt-blocklist-add]"))||t.click());}),null==(h=E.querySelector("[data-xt-lang-allow-add]"))||h.addEventListener("click",()=>{I("langAllowInput","[data-xt-lang-allow-host]","langListEmpty");}),null==(f=E.querySelector("[data-xt-lang-block-add]"))||f.addEventListener("click",()=>{I("langBlockInput","[data-xt-lang-block-host]","langListEmpty");}),E.addEventListener("click",e=>{var t,n,a,o;const i=null==(n=null==(t=e.target)?void 0:t.closest)?void 0:n.call(t,"[data-xt-handle-remove]");if(i&&E.contains(i)){const e=R(i.getAttribute("data-xt-handle-remove")),t=i.closest("[data-xt-allowlist-host], [data-xt-blocklist-host]");if(!t)return;const n=t.hasAttribute("data-xt-allowlist-host")?"[data-xt-allowlist-host]":"[data-xt-blocklist-host]",a="[data-xt-allowlist-host]"===n?"allowlistEmpty":"blocklistEmpty",o=cn(E,n).filter(t=>t!==e);return void un(E,n,o,a)}const r=null==(o=null==(a=e.target)?void 0:a.closest)?void 0:o.call(a,"[data-xt-lang-remove]");if(r&&E.contains(r)){const e=B(r.getAttribute("data-xt-lang-remove")),t=r.closest("[data-xt-lang-allow-host], [data-xt-lang-block-host]");if(!t)return;const n=t.hasAttribute("data-xt-lang-allow-host"),a=n?"[data-xt-lang-allow-host]":"[data-xt-lang-block-host]",o=n?"langAllowInput":"langBlockInput",i=dn(E,a).filter(t=>t!==e);pn(E,a,i,"langListEmpty");const l=E.querySelector(`select[name="${o}"]`);return void(l&&(l.innerHTML=gn(i)))}}),null==(b=E.querySelector('select[name="provider"]'))||b.addEventListener("change",()=>{var e,t;const n=E.provider.value;!function(e,t){const n=t||"google";e.querySelectorAll("[data-xt-provider-fields]").forEach(e=>{const t=e.getAttribute("data-xt-provider-fields")===n;e.classList.toggle("is-active",t),e.hidden=!t;});}(T,n),Jt(T,{provider:n,targetLang:null==(e=E.targetLang)?void 0:e.value,cacheHours:Number(null==(t=E.cacheHours)?void 0:t.value)});}),document.addEventListener("keydown",function e(t){"Escape"===t.key&&(mn(),document.removeEventListener("keydown",e,true));},true),(document.body||document.documentElement).appendChild(y),function(){const e=document.documentElement,t=document.body;if(!t||e.classList.contains("xt-scroll-lock"))return;const n=window.scrollY||e.scrollTop||0;t.dataset.xtScrollY=String(n),e.classList.add("xt-scroll-lock"),t.classList.add("xt-scroll-lock"),t.style.top=`-${n}px`;}(),requestAnimationFrame(()=>{Jt(T),en(T),vn(T);});}function fn(e,t){let n=0;return function(...a){clearTimeout(n),n=setTimeout(()=>e.apply(this,a),t);}}function bn(e){if(!(e instanceof Element))return false;if(e.querySelector(`[${y}]`))return true;if(!e.querySelectorAll('[role="menuitem"], [data-testid]').length)return false;const t=(e.textContent||"").toLowerCase();return !!["delete","embed","mute","block","report","not interested","follow","unfollow","bookmark","add/remove","view post","copy link","удалить","встроить","игнорировать","пожаловаться","читать"].some(e=>t.includes(e))||Boolean(document.querySelector('article[data-testid="tweet"] [data-testid="caret"][aria-expanded="true"]'))}function An(e,t,n,a){const o=document.createElement("div");return o.setAttribute(y,e),o.setAttribute("role","menuitem"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label",t),o.className="xt-menu-item",o.style.cssText="display: flex; flex-direction: row; align-items: center; gap: 12px; padding: 12px 16px; outline: 0; cursor: pointer; color: inherit;",o.innerHTML=`
${n}
${J(t)}
`,o.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),a();},true),o}function yn(){document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:true,cancelable:true}));}function xn(e,t,n){const a=(null==n?void 0:n.parentElement)||function(e){const t=e.querySelector('[role="menuitem"]')||e.querySelector("[data-testid]");return (null==t?void 0:t.parentElement)||e}(e);n&&n.parentElement===a?n.insertAdjacentElement("afterend",t):a.appendChild(t);}function Sn(e,t){const n=e.querySelector(`[${y}="auto"]`),a=e.querySelector(`[${y}="block"]`);if("auto"===K.translateMode){if(!n){const n=e.querySelector('[role="menuitem"]')||e.querySelector("[data-testid]");xn(e,function(e){return An("auto",He(e)?G.menuRemoveAutoAccount:G.menuAddAutoAccount,'',()=>{const t=function(e){return He(e)?{...$e(e),added:false}:function(e){const t=R(e);if(!t)return {ok:false,reason:"invalid"};const n=Ce();return n.includes(t)?{ok:false,reason:"exists",handle:t}:(Ee([...n,t]),{ok:true,handle:t,added:true})}(e)}(e);if(!t.ok&&"invalid"===t.reason)return void qt(G.allowlistInvalid,{type:"warning"});const n=q(t.handle||e);t.added?qt(P(G.allowlistAdded,{handle:n}),{type:"success"}):qt(P(G.allowlistRemoved,{handle:n}),{type:"info"}),Pt(),yn();})}(t),null),(null==n?void 0:n.parentElement)&&n.parentElement.insertBefore(e.querySelector(`[${y}="auto"]`),n);}}else null==n||n.remove();if(!a){const n=e.querySelector(`[${y}="auto"]`);xn(e,function(e){return An("block",we(e)?G.menuUnblockAccount:G.menuBlockAccount,'',()=>{const t=function(e){return we(e)?{...ke(e),added:false}:function(e){const t=R(e);if(!t)return {ok:false,reason:"invalid"};const n=Le();return n.includes(t)?{ok:false,reason:"exists",handle:t}:(Te([...n,t]),{ok:true,handle:t,added:true})}(e)}(e);if(!t.ok&&"invalid"===t.reason)return void qt(G.allowlistInvalid,{type:"warning"});const n=q(t.handle||e);t.added?qt(P(G.blocklistAdded,{handle:n}),{type:"success"}):qt(P(G.blocklistRemoved,{handle:n}),{type:"info"}),Pt(),yn();})}(t),n);}}function Ln(){const e=function(e){if(!(e&&e instanceof Element))return null;const t=e.closest('article[data-testid="tweet"]');if(t){const e=t.querySelector('[data-testid="tweetText"]');return e?Ie(e):Re(t)}return null}(document.querySelector('article[data-testid="tweet"] [data-testid="caret"][aria-expanded="true"]')||document.querySelector('article[data-testid="tweet"] [data-testid="caret"][aria-pressed="true"]')||document.querySelector('article[data-testid="tweet"] [data-testid="caret"]'));if(e)for(const t of [...document.querySelectorAll('[role="menu"]')].filter(bn))Sn(t,e);}function wn(e){var t,n,a,o,i,r,l,s,c,d,u,p,g,v,x;return !(!e||1!==e.nodeType)&&(!!((null==(t=e.hasAttribute)?void 0:t.call(e,m))||(null==(n=e.hasAttribute)?void 0:n.call(e,h))||(null==(a=e.hasAttribute)?void 0:a.call(e,f))||(null==(o=e.hasAttribute)?void 0:o.call(e,b))||(null==(i=e.hasAttribute)?void 0:i.call(e,A))||(null==(r=e.hasAttribute)?void 0:r.call(e,y))||"xt-toast-host"===e.id||"xt-settings-root"===e.id)||Boolean((null==(l=e.classList)?void 0:l.contains("xt-btn"))||(null==(s=e.classList)?void 0:s.contains("xt-toolbar"))||(null==(c=e.classList)?void 0:c.contains("xt-result"))||(null==(d=e.classList)?void 0:d.contains("xt-nav-item"))||(null==(u=e.classList)?void 0:u.contains("xt-menu-item"))||(null==(p=e.classList)?void 0:p.contains("xt-toast-host"))||(null==(g=e.classList)?void 0:g.contains("xt-toast"))||(null==(v=e.classList)?void 0:v.contains("xt-settings-backdrop"))||(null==(x=e.closest)?void 0:x.call(e,`[${m}], [${h}], [${f}], [${b}], [${A}], [${y}], .xt-settings-backdrop, #xt-toast-host`))))}function Tn(){Yt(),Pt(),Ln();}const kn="data-xt-theme";function Mn(e){const t=function(e){if(!e||"transparent"===e||"rgba(0, 0, 0, 0)"===e)return null;const t=e.match(/rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i);return t?{r:Number(t[1]),g:Number(t[2]),b:Number(t[3])}:null}(e);if(!t)return null;const n=(.2126*t.r+.7152*t.g+.0722*t.b)/255;return n>.55?"light":n<.04?"dark":n>=.04&&n<=.28&&t.b>=t.r-5?"dim":"dark"}function Cn(e){if(!e)return null;const t=String(e).toLowerCase().trim();return "light"===t||"dim"===t||"dark"===t?t:"lights-out"===t||"lightsout"===t||"black"===t?"dark":null}function Hn(e=function(){var e,t,n,a;const o=document.documentElement,i=document.body,r=Cn(o.getAttribute("data-color-mode"))||Cn(o.getAttribute("data-theme"))||Cn(null==(e=null==i?void 0:i.getAttribute)?void 0:e.call(i,"data-color-mode"))||Cn(null==(t=null==i?void 0:i.getAttribute)?void 0:t.call(i,"data-theme"));if(r)return r;const l=`${o.className||""} ${(null==i?void 0:i.className)||""}`.toLowerCase();if(/\bdim\b/.test(l))return "dim";if(/\blights?-?out\b/.test(l))return "dark";for(const c of [i,o]){if(!c)continue;const e=Mn(getComputedStyle(c).backgroundColor);if(e)return e}const s=getComputedStyle(o).colorScheme||"";return /\blight\b/i.test(s)&&!/\bdark\b/i.test(s)?"light":/\bdark\b/i.test(s)&&!/\blight\b/i.test(s)?"dark":(null==(a=null==(n=window.matchMedia)?void 0:n.call(window,"(prefers-color-scheme: light)"))?void 0:a.matches)?"light":"dark"}()){const t="light"===e||"dim"===e?e:"dark";return document.documentElement.getAttribute(kn)!==t&&document.documentElement.setAttribute(kn,t),t}function En(){document.documentElement.hasAttribute(v)||(document.documentElement.setAttribute(v,"1"),W(),function(e){var t,n;let a=Hn();null==e||e();const o=()=>{const t=Hn();t!==a&&(a=t,null==e||e());},i=new MutationObserver(o);i.observe(document.documentElement,{attributes:true,attributeFilter:["class","style","data-color-mode","data-theme"]}),document.body&&i.observe(document.body,{attributes:true,attributeFilter:["class","style","data-color-mode","data-theme"]});const r=null==(t=window.matchMedia)?void 0:t.call(window,"(prefers-color-scheme: dark)");null==(n=null==r?void 0:r.addEventListener)||n.call(r,"change",o);}(()=>{Yt();}),"function"==typeof t&&t(G.menuSettings,hn),/^(www\.)?(x|twitter)\.com$/i.test(location.hostname)&&(Tn(),function(e){const t=fn(e,350),n=new MutationObserver(e=>{(function(e){for(const t of e)for(const e of t.addedNodes)if(1===e.nodeType&&!wn(e))return false;return true})(e)||t();});n.observe(document.documentElement,{childList:true,subtree:true});}(Tn),function(){const e=fn(Ln,40);new MutationObserver(e).observe(document.documentElement,{childList:true,subtree:true}),Ln();}(),function(){const e=fn(Tn,80);["popstate","pushstate","replacestate"].forEach(t=>{window.addEventListener(t,e,true);});const t=e=>{const t=history[e];"function"==typeof t&&(history[e]=function(...n){const a=t.apply(this,n);return window.dispatchEvent(new Event(e.toLowerCase())),a});};t("pushState"),t("replaceState");let n=location.href;setInterval(()=>{location.href!==n&&(n=location.href,e());},500);}()));}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",En,{once:true}):En(); })();