Full source listing of 10 Mirrors: the completely free and open-source Tampermonkey userscript that supports Path of Exile 2 live search snipe workflows in the browser.

The script targets trade-site DOM workflows and hideout navigation helpers described elsewhere on this site. Redistribution of the exact script as a competing product is discouraged; personal edits for your own account are the intended use of publishing the source.

Relevant searches: 10 Mirrors open source, completely free PoE2 live search userscript source, live search snipe tool Tampermonkey code, Path of Exile 2 live search userscript text, inspect 10 Mirrors script, copy 10 Mirrors for personal use.

10 Mirrors userscript

Full source for Tampermonkey. Use the copy button, then paste into a new script in the Tampermonkey dashboard.

ten-mirrors-userscript.txt
// ==UserScript==
// @name         10 Mirrors
// @namespace    http://tampermonkey.net/
// @version      3.6
// @description  PoE Automation Software
// @author       40 Mirrors
// @match        *.pathofexile.com/trade2/*
// @match        *.pathofexile.com/trade/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const STORAGE_KEY = 'poe10mirror_trade_suite_v1';
    /** Keep in sync with @version above. */
    const SCRIPT_VERSION = '3.6';

    let isAutoClickEnabled = true;
    let speedMode = 'FAST';
    let isAutoRearm = false;
    let isMinimized = false;
    let uiContainer = null;
    let viewportClampAttached = false;
    let clampPanelRaf = 0;

    const loadPersistedState = () => {
        try {
            const raw = localStorage.getItem(STORAGE_KEY);
            if (!raw) return;
            const s = JSON.parse(raw);
            if (typeof s.isAutoClickEnabled === 'boolean') isAutoClickEnabled = s.isAutoClickEnabled;
            if (s.speedMode === 'FAST' || s.speedMode === 'SLOW') speedMode = s.speedMode;
            if (typeof s.isAutoRearm === 'boolean') isAutoRearm = s.isAutoRearm;
            if (typeof s.isMinimized === 'boolean') isMinimized = s.isMinimized;
        } catch (_) { /* ignore */ }
    };

    const savePersistedState = () => {
        try {
            const payload = {
                isAutoClickEnabled,
                speedMode,
                isAutoRearm,
                isMinimized
            };
            if (uiContainer) {
                const L = uiContainer.style.left;
                const T = uiContainer.style.top;
                const R = uiContainer.style.right;
                if (L && L !== 'auto') payload.left = L;
                if (T && T !== 'auto') payload.top = T;
                if (R && R !== 'auto') payload.right = R;
            }
            localStorage.setItem(STORAGE_KEY, JSON.stringify(payload));
        } catch (_) { /* ignore */ }
    };

    const applyPanelPosition = () => {
        if (!uiContainer) return;
        try {
            const raw = localStorage.getItem(STORAGE_KEY);
            if (!raw) return;
            const s = JSON.parse(raw);
            if (s.left) {
                uiContainer.style.left = s.left;
                uiContainer.style.right = 'auto';
            }
            if (s.top) uiContainer.style.top = s.top;
            if (s.right && !s.left) uiContainer.style.right = s.right;
        } catch (_) { /* ignore */ }
    };

    /** Keep fixed panel inside the visual viewport (scroll + resize safe). */
    const clampPanelToViewport = () => {
        if (!uiContainer || !document.body.contains(uiContainer)) return;
        const vv = window.visualViewport;
        const pad = 8;
        const vw = vv ? vv.width : window.innerWidth;
        const vh = vv ? vv.height : window.innerHeight;
        const vx = vv ? vv.offsetLeft : 0;
        const vy = vv ? vv.offsetTop : 0;

        const rect = uiContainer.getBoundingClientRect();
        const w = rect.width;
        const h = rect.height;

        const minX = vx + pad;
        const minY = vy + pad;
        const maxX = vx + vw - pad - w;
        const maxY = vy + vh - pad - h;

        let left = rect.left;
        let top = rect.top;
        if (left < minX) left = minX;
        if (top < minY) top = minY;
        if (left > maxX) left = Math.max(minX, maxX);
        if (top > maxY) top = Math.max(minY, maxY);

        const eps = 0.5;
        if (Math.abs(left - rect.left) < eps && Math.abs(top - rect.top) < eps) return;

        uiContainer.style.left = `${Math.round(left)}px`;
        uiContainer.style.top = `${Math.round(top)}px`;
        uiContainer.style.right = 'auto';
        savePersistedState();
    };

    const scheduleClampPanel = () => {
        if (!uiContainer) return;
        if (clampPanelRaf) cancelAnimationFrame(clampPanelRaf);
        clampPanelRaf = requestAnimationFrame(() => {
            clampPanelRaf = 0;
            clampPanelToViewport();
        });
    };

    const attachViewportClampListeners = () => {
        if (viewportClampAttached) return;
        viewportClampAttached = true;
        window.addEventListener('resize', scheduleClampPanel);
        const vv = window.visualViewport;
        if (vv) {
            vv.addEventListener('resize', scheduleClampPanel);
            vv.addEventListener('scroll', scheduleClampPanel);
        }
    };

    const log = (msg, color = '#8b9bb4') => {
        const consoleEl = document.getElementById('poe-debug-log');
        if (!consoleEl) return;
        const entry = document.createElement('div');
        entry.style.color = color;
        entry.style.borderBottom = '1px solid #1e2836';
        entry.style.padding = '4px 0';
        entry.innerText = `[${new Date().toLocaleTimeString([], { hour12: false })}] ${msg}`;
        consoleEl.prepend(entry);
    };

    const PANEL_SELECTOR = '#poe-trade-panel';

    const robustClick = (element, name) => {
        log(`Clicking: ${name}`, '#2dd4bf');
        const events = ['mousedown', 'mouseup', 'click'];
        events.forEach(eventType => {
            element.dispatchEvent(new MouseEvent(eventType, {
                view: window,
                bubbles: true,
                cancelable: true,
                buttons: 1
            }));
        });
    };

    /** Single-line label for matching (not used for logging whole page chrome). */
    const getDemandLabel = (el) => (el.innerText || el.textContent || '')
        .replace(/\s+/g, ' ')
        .trim()
        .toLowerCase();

    /**
     * PoE live-search demand dialog: avoid matching ancestors whose innerText starts with
     * "Logged in as …" but also contains "Teleport Anyway" from a child (substring + wrong click target).
     */
    const matchesDemandBypassLabel = (label, el) => {
        const s = label.replace(/\s+/g, ' ').trim().toLowerCase();
        if (!s) return false;
        if (s.length > 120) return false;
        if (el.tagName === 'SPAN' && s.length > 56) return false;
        if (/\b(teleport|travel)\s+anyway\b/.test(s)) return true;
        if (/^anyway[?.!…\s]*$/i.test(label.trim())) return true;
        if (/^(proceed|continue)$/i.test(s)) return true;
        return false;
    };

    const scoreDemandCandidate = (el, label) => {
        let s = 0;
        if (el.closest('[role="dialog"]')) s += 55;
        if (el.closest('.ReactModalPortal, [class*="Modal"], [class*="Dialog"]')) s += 40;
        if (el.tagName === 'BUTTON') s += 100;
        else if ((el.getAttribute('role') || '').toLowerCase() === 'button') s += 85;
        else if (el.tagName === 'A') s += 45;
        else if (el.tagName === 'SPAN') s += 15;
        if (/\b(teleport|travel)\s+anyway\b/i.test(label)) s += 25;
        const rawLen = (el.innerText || '').trim().length;
        s -= Math.min(40, Math.floor(rawLen / 15));
        return s;
    };

    const findDemandConfirmationTarget = () => {
        const nodes = document.querySelectorAll('button, [role="button"], a, span');
        let best = null;
        let bestScore = -Infinity;
        for (const el of nodes) {
            if (!document.body.contains(el) || el.closest(PANEL_SELECTOR)) continue;
            const tag = el.tagName;
            const role = (el.getAttribute('role') || '').toLowerCase();
            if (tag !== 'BUTTON' && tag !== 'A' && tag !== 'SPAN' && role !== 'button') continue;

            const label = getDemandLabel(el);
            if (!matchesDemandBypassLabel(label, el)) continue;

            const rect = el.getBoundingClientRect();
            if (rect.width < 2 || rect.height < 2) continue;

            const sc = scoreDemandCandidate(el, label);
            if (sc > bestScore) {
                bestScore = sc;
                best = el;
            }
        }
        if (best) {
            const nearestBtn = best.closest('button');
            if (nearestBtn && matchesDemandBypassLabel(getDemandLabel(nearestBtn), nearestBtn)) return nearestBtn;
            const nearestRole = best.closest('[role="button"]');
            if (nearestRole && nearestRole !== best && matchesDemandBypassLabel(getDemandLabel(nearestRole), nearestRole)) {
                return nearestRole;
            }
        }
        return best;
    };

    const aggressiveDemandClick = (element, name) => {
        log(`Bypass click: ${name}`, '#2dd4bf');
        const rect = element.getBoundingClientRect();
        const cx = Math.round(rect.left + rect.width / 2);
        const cy = Math.round(rect.top + rect.height / 2);
        const base = {
            view: window,
            bubbles: true,
            cancelable: true,
            buttons: 1,
            clientX: cx,
            clientY: cy
        };

        try {
            if (typeof element.focus === 'function') element.focus();
        } catch (_) { /* ignore */ }

        try {
            element.dispatchEvent(new PointerEvent('pointerdown', {
                ...base,
                pointerId: 1,
                pointerType: 'mouse',
                isPrimary: true,
                pressure: 0.5
            }));
            element.dispatchEvent(new PointerEvent('pointerup', {
                ...base,
                pointerId: 1,
                pointerType: 'mouse',
                isPrimary: true,
                pressure: 0
            }));
        } catch (_) { /* PointerEvent missing in very old engines */ }

        ['mousedown', 'mouseup', 'click'].forEach((type) => {
            element.dispatchEvent(new MouseEvent(type, base));
        });

        try {
            if (typeof element.click === 'function') element.click();
        } catch (_) { /* ignore */ }
    };

    const setMinimized = (next) => {
        isMinimized = next;
        const body = document.getElementById('poe10-body');
        const btn = document.getElementById('poe-minimize-btn');
        if (body) body.style.display = isMinimized ? 'none' : '';
        if (uiContainer) {
            uiContainer.style.width = isMinimized ? 'auto' : '280px';
            uiContainer.style.minWidth = isMinimized ? '200px' : '';
        }
        if (btn) {
            btn.setAttribute('aria-label', isMinimized ? 'Expand panel' : 'Minimize panel');
            btn.innerHTML = isMinimized ? minimizeIconSvg(true) : minimizeIconSvg(false);
        }
        savePersistedState();
        scheduleClampPanel();
    };

    function minimizeIconSvg(expanded) {
        if (expanded) {
            return '<svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true"><circle cx="12" cy="12" r="10" fill="#1e2836" stroke="#2a3441" stroke-width="1"/><path d="M12 7v10M7 12h10" stroke="#c8d4e6" stroke-width="1.8" stroke-linecap="round"/></svg>';
        }
        return '<svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true"><circle cx="12" cy="12" r="10" fill="#1e2836" stroke="#2a3441" stroke-width="1"/><rect x="7" y="11" width="10" height="2" rx="0.5" fill="#8b9bb4"/></svg>';
    }

    const injectStyles = () => {
        if (document.getElementById('poe10mirror-styles')) return;
        const st = document.createElement('style');
        st.id = 'poe10mirror-styles';
        st.textContent = `
            #poe-trade-panel {
                --poe10-bg: #0e1318;
                --poe10-surface: #151b24;
                --poe10-border: #2a3441;
                --poe10-teal: #2dd4bf;
                --poe10-teal-dim: #1fa896;
                --poe10-text: #e8eef5;
                --poe10-muted: #8b9bb4;
                --poe10-radius: 10px;
                position: fixed;
                top: 120px;
                right: 20px;
                z-index: 2147483647;
                background: linear-gradient(165deg, #121922 0%, var(--poe10-bg) 100%);
                border: 1px solid var(--poe10-border);
                border-radius: var(--poe10-radius);
                padding: 16px;
                padding-bottom: 22px;
                width: 280px;
                box-shadow: 0 12px 40px rgba(0,0,0,0.55), 0 0 0 1px rgba(45,212,191,0.06);
                font-family: "Segoe UI", system-ui, Verdana, sans-serif;
                font-size: 12px;
                color: var(--poe10-text);
                user-select: none;
            }
            #poe-trade-panel .poe10-header {
                display: flex;
                align-items: flex-start;
                justify-content: space-between;
                gap: 10px;
                margin-bottom: 14px;
                cursor: grab;
            }
            #poe-trade-panel .poe10-header:active { cursor: grabbing; }
            #poe-trade-panel .poe10-brand-line1 {
                font-size: 10px;
                letter-spacing: 0.14em;
                color: var(--poe10-teal);
                font-weight: 600;
                margin-bottom: 2px;
            }
            #poe-trade-panel .poe10-brand-line2 {
                font-size: 17px;
                font-weight: 700;
                color: var(--poe10-text);
                line-height: 1.15;
            }
            #poe-trade-panel .poe10-brand-line3 {
                font-size: 11px;
                color: var(--poe10-muted);
                margin-top: 3px;
            }
            #poe-trade-panel #poe-minimize-btn {
                flex-shrink: 0;
                width: 28px;
                height: 28px;
                border-radius: 50%;
                border: 1px solid var(--poe10-border);
                background: #151b24;
                display: flex;
                align-items: center;
                justify-content: center;
                cursor: pointer;
                padding: 0;
                margin-top: 2px;
            }
            #poe-trade-panel #poe-minimize-btn:hover {
                border-color: var(--poe10-teal-dim);
                background: #1a222d;
            }
            #poe-trade-panel #poe-master-arm {
                width: 100%;
                padding: 12px 14px;
                font-weight: 700;
                font-size: 12px;
                letter-spacing: 0.08em;
                cursor: pointer;
                border-radius: 8px;
                margin-bottom: 12px;
                transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
            }
            #poe-trade-panel #poe-master-arm.poe10-armed {
                color: var(--poe10-teal);
                background: rgba(45, 212, 191, 0.08);
                border: 1px solid var(--poe10-teal);
                box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.12), 0 4px 20px rgba(45, 212, 191, 0.08);
            }
            #poe-trade-panel #poe-master-arm.poe10-disarmed {
                color: var(--poe10-muted);
                background: var(--poe10-surface);
                border: 1px solid var(--poe10-border);
            }
            #poe-trade-panel .poe10-settings {
                background: var(--poe10-surface);
                border: 1px solid var(--poe10-border);
                border-radius: 8px;
                padding: 0;
                overflow: hidden;
                margin-bottom: 12px;
            }
            #poe-trade-panel .poe10-setting-row {
                display: flex;
                align-items: center;
                justify-content: space-between;
                gap: 12px;
                padding: 10px 12px;
            }
            #poe-trade-panel .poe10-setting-row + .poe10-setting-row {
                border-top: 1px solid #1e2836;
            }
            #poe-trade-panel .poe10-setting-label {
                font-weight: 600;
                font-size: 12px;
                color: var(--poe10-text);
            }
            #poe-trade-panel .poe10-setting-hint {
                font-size: 10px;
                color: var(--poe10-muted);
                margin-top: 2px;
                line-height: 1.35;
            }
            #poe-trade-panel .poe10-setting-row input[type="checkbox"] {
                width: 16px;
                height: 16px;
                accent-color: var(--poe10-teal);
                cursor: pointer;
                flex-shrink: 0;
            }
            #poe-trade-panel .poe10-log-label {
                font-size: 9px;
                letter-spacing: 0.12em;
                color: var(--poe10-muted);
                margin-bottom: 6px;
                font-weight: 600;
            }
            #poe-trade-panel #poe-debug-log {
                height: 88px;
                background: #0a0e12;
                border: 1px solid var(--poe10-teal);
                border-radius: 8px;
                overflow-y: auto;
                padding: 8px 10px;
                font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
                font-size: 10px;
                color: var(--poe10-muted);
            }
            #poe-trade-panel .poe10-version {
                position: absolute;
                bottom: 5px;
                right: 10px;
                font-size: 8px;
                line-height: 1;
                color: var(--poe10-muted);
                opacity: 0.65;
                letter-spacing: 0.04em;
                pointer-events: none;
                font-variant-numeric: tabular-nums;
            }
        `;
        document.head.appendChild(st);
    };

    const injectUI = () => {
        if (document.getElementById('poe-trade-panel')) return;
        injectStyles();
        loadPersistedState();

        uiContainer = document.createElement('div');
        uiContainer.id = 'poe-trade-panel';
        document.body.appendChild(uiContainer);

        uiContainer.innerHTML = `
            <div class="poe10-header" id="poe10-drag-handle">
                <div>
                    <div class="poe10-brand-line1">10 MIRROR</div>
                    <div class="poe10-brand-line2">Trade Suite</div>
                    <div class="poe10-brand-line3">Live search automation</div>
                </div>
                <button type="button" id="poe-minimize-btn" aria-label="Minimize panel">${minimizeIconSvg(false)}</button>
            </div>
            <div id="poe10-body">
                <button type="button" id="poe-master-arm"></button>
                <div class="poe10-settings">
                    <label class="poe10-setting-row" for="poe-speed-toggle">
                        <div>
                            <div class="poe10-setting-label">Fast mode</div>
                            <div class="poe10-setting-hint">Zero delay before travel click</div>
                        </div>
                        <input type="checkbox" id="poe-speed-toggle">
                    </label>
                    <label class="poe10-setting-row" for="poe-rearm-toggle">
                        <div>
                            <div class="poe10-setting-label">Auto rearm</div>
                            <div class="poe10-setting-hint">Re-enable after confirmation flow</div>
                        </div>
                        <input type="checkbox" id="poe-rearm-toggle">
                    </label>
                </div>
                <div class="poe10-log-label">EVENT LOG</div>
                <div id="poe-debug-log"></div>
            </div>
            <div class="poe10-version" id="poe10-version" aria-hidden="true">v${SCRIPT_VERSION}</div>
        `;

        applyPanelPosition();
        clampPanelToViewport();
        attachViewportClampListeners();

        const speedEl = document.getElementById('poe-speed-toggle');
        const rearmEl = document.getElementById('poe-rearm-toggle');
        speedEl.checked = speedMode === 'FAST';
        rearmEl.checked = isAutoRearm;

        document.getElementById('poe-master-arm').onclick = () => {
            isAutoClickEnabled = !isAutoClickEnabled;
            updateUI();
            savePersistedState();
            log(isAutoClickEnabled ? 'Armed' : 'Disarmed', isAutoClickEnabled ? '#2dd4bf' : '#8b9bb4');
        };
        speedEl.onchange = (e) => {
            speedMode = e.target.checked ? 'FAST' : 'SLOW';
            log(`Speed ${speedMode}`, '#8b9bb4');
            savePersistedState();
        };
        rearmEl.onchange = (e) => {
            isAutoRearm = e.target.checked;
            log(`Rearm ${isAutoRearm}`, '#8b9bb4');
            savePersistedState();
        };

        document.getElementById('poe-minimize-btn').onclick = (e) => {
            e.stopPropagation();
            setMinimized(!isMinimized);
        };

        const dragHandle = document.getElementById('poe10-drag-handle');
        dragHandle.onmousedown = (e) => {
            if (e.target.closest('#poe-minimize-btn')) return;
            const rect = uiContainer.getBoundingClientRect();
            const sX = e.clientX - rect.left;
            const sY = e.clientY - rect.top;
            const onMove = (ev) => {
                uiContainer.style.left = `${ev.clientX - sX}px`;
                uiContainer.style.top = `${ev.clientY - sY}px`;
                uiContainer.style.right = 'auto';
            };
            const onUp = () => {
                document.removeEventListener('mousemove', onMove);
                document.removeEventListener('mouseup', onUp);
                clampPanelToViewport();
                savePersistedState();
            };
            document.addEventListener('mousemove', onMove);
            document.addEventListener('mouseup', onUp);
        };

        updateUI();
        setMinimized(isMinimized);
        log('Observer starting…', '#8b9bb4');
    };

    const updateUI = () => {
        const btn = document.getElementById('poe-master-arm');
        if (!btn) return;
        btn.innerText = isAutoClickEnabled ? 'ARMED' : 'DISARMED';
        btn.classList.toggle('poe10-armed', isAutoClickEnabled);
        btn.classList.toggle('poe10-disarmed', !isAutoClickEnabled);
    };

    const handleDemandPopup = () => {
        const target = findDemandConfirmationTarget();
        if (!target) return false;
        const label = getDemandLabel(target);
        log(`Bypass: "${label.slice(0, 64)}${label.length > 64 ? '…' : ''}"`, '#e8b84a');
        aggressiveDemandClick(target, label || 'demand confirmation');
        return true;
    };

    const shouldRunSelfTests = () =>
        /(?:[?&])poe10mirror_test=1(?:&|$)/.test(location.search) ||
        localStorage.getItem('poe10mirror_selftest') === '1';

    const runSelfTests = () => {
        const fail = (msg) => {
            throw new Error(`[10 Mirror self-test] ${msg}`);
        };

        const btnStub = { tagName: 'BUTTON' };
        const spanStub = { tagName: 'SPAN' };

        if (!matchesDemandBypassLabel('teleport anyway', btnStub)) fail('label: teleport anyway');
        if (!matchesDemandBypassLabel('Travel Anyway?', btnStub)) fail('label: travel anyway?');
        if (matchesDemandBypassLabel('logged in as myuser', btnStub)) fail('reject: logged in as');
        if (matchesDemandBypassLabel('If you proceed anyway with extra', spanStub)) fail('reject: long span');
        if (!matchesDemandBypassLabel('proceed', btnStub)) fail('label: proceed exact');

        const mkFixture = (html) => {
            const wrap = document.createElement('div');
            wrap.id = 'poe10mirror-test-fixture';
            wrap.style.cssText = 'position:fixed;left:-9999px;top:0;width:10px;height:10px;overflow:hidden;opacity:0;pointer-events:none;';
            wrap.innerHTML = html;
            document.body.appendChild(wrap);
            return wrap;
        };

        let w = mkFixture(
            '<div class="mix"><div>Logged in as fakeuser</div><button type="button" id="poe10-tb">Teleport Anyway</button></div>'
        );
        try {
            const t = findDemandConfirmationTarget();
            if (!t || t.id !== 'poe10-tb') fail('fixture1: must select Teleport Anyway button');
        } finally {
            w.remove();
        }

        w = mkFixture('<span id="poe10-ts">Teleport Anyway</span>');
        try {
            const t2 = findDemandConfirmationTarget();
            if (!t2 || t2.id !== 'poe10-ts') fail('fixture2: span label only');
        } finally {
            w.remove();
        }

        w = mkFixture('<span>Logged in as x</span><span>noise</span>');
        try {
            if (findDemandConfirmationTarget() !== null) fail('fixture3: no match without bypass phrase');
        } finally {
            w.remove();
        }

        return { ok: true, message: 'all self-tests passed' };
    };

    const clickTravelButton = (node) => {
        if (!isAutoClickEnabled) return;

        const buttons = node.querySelectorAll('button, [role="button"], span');
        for (const btn of buttons) {
            if (btn.innerText.includes('Travel to Hideout')) {
                log('Item found — executing…', '#2dd4bf');

                isAutoClickEnabled = false;
                updateUI();
                savePersistedState();

                const action = () => {
                    robustClick(btn, 'Initial Travel Button');

                    let iterations = 0;
                    const maxIterations = 60;

                    const checkInterval = setInterval(() => {
                        iterations++;
                        const found = handleDemandPopup();

                        if (found || iterations >= maxIterations) {
                            clearInterval(checkInterval);

                            if (isAutoRearm) {
                                setTimeout(() => {
                                    isAutoClickEnabled = true;
                                    updateUI();
                                    savePersistedState();
                                    log('System ready', '#2dd4bf');
                                }, 500);
                            }
                            if (!found && iterations >= maxIterations) {
                                log('No bypass needed.', '#5c6a7d');
                            }
                        }
                    }, 20);
                };

                if (speedMode === 'FAST') {
                    action();
                } else {
                    setTimeout(action, 150);
                }
                break;
            }
        }
    };

    const setupObserver = () => {
        const results = document.querySelector('.results');
        if (!results) {
            setTimeout(setupObserver, 500);
            return;
        }

        const observer = new MutationObserver(mutations => {
            mutations.forEach(record => {
                record.addedNodes.forEach(node => {
                    if (node.nodeType === 1) clickTravelButton(node);
                });
            });
        });

        observer.observe(results, { childList: true, subtree: true });
        log('Observer active — monitoring results', '#2dd4bf');
    };

    injectUI();
    setInterval(injectUI, 2000);
    setupObserver();

    if (shouldRunSelfTests()) {
        window.__POE10MIRROR_RUN_SELF_TESTS__ = runSelfTests;
        queueMicrotask(() => {
            try {
                const r = runSelfTests();
                console.info('[10 Mirror self-test]', r);
            } catch (e) {
                console.error('[10 Mirror self-test] FAILED', e);
            }
        });
    }
})();