'use strict'; // Selectors for DeepSeek chat: assistant replies, input, send/stop buttons. const MESSAGE_SELECTORS = [ '.ds-markdown', '[class*="markdown"]', '[data-testid="message"]', '[class*="message"]' ]; function collectText(root) { if (!root) return ''; const parts = []; const walk = function (n) { if (!n) return; if (n.nodeType === 3) { const t = (n.nodeValue || '').trim(); if (t.length > 0) parts.push(t); return; } const kids = n.childNodes; if (!kids) return; for (let i = 0; i < kids.length; i++) walk(kids[i]); }; walk(root); return parts.join(String.fromCharCode(10)); } const DSH_SELECTORS = { MESSAGE_SELECTORS: MESSAGE_SELECTORS, collectText: collectText, assistantMarkdown: [ 'div.ds-markdown', 'div[class*="markdown"]', 'div[class*="message-content"] div[class*="content"]' ], input: [ 'textarea#chat-input', 'textarea[id*="chat"]', 'div[contenteditable="true"]', 'textarea[placeholder]' ], sendButton: [ 'div[class*="send"] button', 'button[class*="send"]', 'button[aria-label*="发送"]', 'button[aria-label*="Send"]', 'button[type="submit"]' ], stopButton: [ 'button[aria-label*="停止"]', 'button[aria-label*="Stop"]', 'div[class*="stop"] button' ] }; globalThis.DSH_SELECTORS = DSH_SELECTORS; if (typeof module !== 'undefined' && module.exports) { module.exports = DSH_SELECTORS; }