ai-helper-agent 2.4.4 → 2.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (()=>{var ue={DEBUG:0,INFO:1,WARN:2,ERROR:3},re=ue.DEBUG;function Xt(e){re=e}function Zt(){return re}function Jt(...e){re<=ue.DEBUG&&console.debug("[AIH]",...e)}function eo(...e){re<=ue.INFO&&console.info("[AIH]",...e)}function to(...e){re<=ue.WARN&&console.warn("[AIH]",...e)}function oo(...e){re<=ue.ERROR&&console.error("[AIH]",...e)}var E={debug:Jt,info:eo,warn:to,error:oo,setLogLevel:Xt,getLogLevel:Zt},no={common:{confirm:"\u786E\u8BA4",cancel:"\u53D6\u6D88",close:"\u5173\u95ED",ok:"\u786E\u5B9A",save:"\u4FDD\u5B58",delete:"\u5220\u9664",edit:"\u7F16\u8F91",retry:"\u91CD\u8BD5",loading:"\u52A0\u8F7D\u4E2D...",none:"\u65E0",add:"\u6DFB\u52A0",clear:"\u6E05\u7A7A",selectAll:"\u5168\u9009",deselectAll:"\u53D6\u6D88\u5168\u9009",refresh:"\u5237\u65B0",enabled:"\u5DF2\u542F\u7528",disabled:"\u5DF2\u505C\u7528",bytes:"\u5B57\u8282",copy:"\u590D\u5236",copySuccess:"\u5DF2\u590D\u5236",copyFailed:"\u590D\u5236\u5931\u8D25"},dialog:{operationConfirm:"\u64CD\u4F5C\u786E\u8BA4",confirmDefaultMessage:"\u6A21\u578B\u8BF7\u6C42\u6267\u884C\u654F\u611F\u64CD\u4F5C\uFF0C\u662F\u5426\u5141\u8BB8\uFF1F",confirmAction:"\u6A21\u578B\u8BF7\u6C42\u6267\u884C\u64CD\u4F5C: {name}",remainingTime:"\u5269\u4F59\u65F6\u95F4: {time}",deny:"\u62D2\u7EDD",approveOnce:"\u672C\u6B21\u653E\u884C",approveLoop:"\u5F53\u524D\u4EFB\u52A1\u653E\u884C",pendingQueue:"\uFF08\u53E6\u6709 {count} \u6761\u5F85\u786E\u8BA4\uFF09",pendingQueueClarify:"\uFF08\u53E6\u6709 {count} \u6761\u5F85\u6F84\u6E05\uFF09",otherPending:"\uFF08\u53E6\u6709 {count} \u6761\u5176\u4ED6\u8BF7\u6C42\u5728\u6392\u961F\uFF09"},sensitiveTool:{manage_cookies:"\u7BA1\u7406 Cookie",manage_storage:"\u9875\u9762\u5B58\u50A8\u64CD\u4F5C",download_file:"\u4E0B\u8F7D\u6587\u4EF6",manage_tab:"\u6807\u7B7E\u9875\u7BA1\u7406",agent_file:"\u6587\u4EF6\u64CD\u4F5C",agent_exec:"\u672C\u5730\u547D\u4EE4\u6267\u884C",debug_page:"\u9875\u9762\u8C03\u8BD5\uFF08Debugger\uFF09",debuggerAttachHint:`
1
+ (()=>{var he={DEBUG:0,INFO:1,WARN:2,ERROR:3},se=he.DEBUG;function io(e){se=e}function ro(){return se}function lo(...e){se<=he.DEBUG&&console.debug("[AIH]",...e)}function so(...e){se<=he.INFO&&console.info("[AIH]",...e)}function co(...e){se<=he.WARN&&console.warn("[AIH]",...e)}function uo(...e){se<=he.ERROR&&console.error("[AIH]",...e)}var E={debug:lo,info:so,warn:co,error:uo,setLogLevel:io,getLogLevel:ro},po={common:{confirm:"\u786E\u8BA4",cancel:"\u53D6\u6D88",close:"\u5173\u95ED",ok:"\u786E\u5B9A",save:"\u4FDD\u5B58",delete:"\u5220\u9664",edit:"\u7F16\u8F91",retry:"\u91CD\u8BD5",loading:"\u52A0\u8F7D\u4E2D...",none:"\u65E0",add:"\u6DFB\u52A0",clear:"\u6E05\u7A7A",selectAll:"\u5168\u9009",deselectAll:"\u53D6\u6D88\u5168\u9009",refresh:"\u5237\u65B0",enabled:"\u5DF2\u542F\u7528",disabled:"\u5DF2\u505C\u7528",bytes:"\u5B57\u8282",copy:"\u590D\u5236",copySuccess:"\u5DF2\u590D\u5236",copyFailed:"\u590D\u5236\u5931\u8D25"},dialog:{operationConfirm:"\u64CD\u4F5C\u786E\u8BA4",confirmDefaultMessage:"\u6A21\u578B\u8BF7\u6C42\u6267\u884C\u654F\u611F\u64CD\u4F5C\uFF0C\u662F\u5426\u5141\u8BB8\uFF1F",confirmAction:"\u6A21\u578B\u8BF7\u6C42\u6267\u884C\u64CD\u4F5C: {name}",remainingTime:"\u5269\u4F59\u65F6\u95F4: {time}",deny:"\u62D2\u7EDD",approveOnce:"\u672C\u6B21\u653E\u884C",approveLoop:"\u5F53\u524D\u4EFB\u52A1\u653E\u884C",pendingQueue:"\uFF08\u53E6\u6709 {count} \u6761\u5F85\u786E\u8BA4\uFF09",pendingQueueClarify:"\uFF08\u53E6\u6709 {count} \u6761\u5F85\u6F84\u6E05\uFF09",otherPending:"\uFF08\u53E6\u6709 {count} \u6761\u5176\u4ED6\u8BF7\u6C42\u5728\u6392\u961F\uFF09"},sensitiveTool:{manage_cookies:"\u7BA1\u7406 Cookie",manage_storage:"\u9875\u9762\u5B58\u50A8\u64CD\u4F5C",download_file:"\u4E0B\u8F7D\u6587\u4EF6",manage_tab:"\u6807\u7B7E\u9875\u7BA1\u7406",agent_file:"\u6587\u4EF6\u64CD\u4F5C",agent_exec:"\u672C\u5730\u547D\u4EE4\u6267\u884C",debug_page:"\u9875\u9762\u8C03\u8BD5\uFF08Debugger\uFF09",debuggerAttachHint:`
2
2
 
3
3
  \u5F00\u542F\u540E\u8BE5\u6807\u7B7E\u9875\u9876\u90E8\u4F1A\u663E\u793A"\u6269\u5C55\u7A0B\u5E8F\u6B63\u5728\u8C03\u8BD5\u6B64\u6D4F\u89C8\u5668"\u63D0\u793A\u6761\uFF0C\u7ED3\u675F\u540E\u81EA\u52A8\u6D88\u5931\u3002`,unknown:"\u672A\u77E5\u64CD\u4F5C",tabInfo:`
4
4
 
@@ -22,7 +22,7 @@
22
22
 
23
23
  ## \u6267\u884C\u6B65\u9AA4
24
24
  1. \u6B65\u9AA41
25
- 2. \u6B65\u9AA42`,existingResources:"\u5DF2\u6709\u8D44\u6E90\u6587\u4EF6",skillNameRequired:"\u8BF7\u8F93\u5165\u6280\u80FD\u540D\u79F0",skillMarkdownRequired:"\u8BF7\u8F93\u5165 SKILL.md \u5185\u5BB9",agentSkillSaved:'Agent \u6280\u80FD "{name}" \u4FDD\u5B58\u6210\u529F',saveFailedShort:"\u4FDD\u5B58\u5931\u8D25",saveFailed:"\u4FDD\u5B58\u5931\u8D25: {error}",viewSkillTitle:"\u67E5\u770B\u6280\u80FD: {name}",importSkillTitle:"\u5BFC\u5165\u6280\u80FD",importBtn:"\u5BFC\u5165",jsonImport:"JSON \u5BFC\u5165",newAuthoring:"\u65B0\u5EFA\u7F16\u5199",zipPackage:"Zip \u5305",urlImport:"URL \u5BFC\u5165",jsonImportDesc:"\u5BFC\u5165 JSON \u683C\u5F0F\u7684 Workflow \u6280\u80FD\uFF08\u786E\u5B9A\u6027\u81EA\u52A8\u5316\u6D41\u7A0B\uFF09",clickOrDragJson:"\u70B9\u51FB\u9009\u62E9 JSON \u6587\u4EF6\u6216\u62D6\u62FD\u5230\u6B64\u5904",jsonFileHint:"\u652F\u6301 .json \u683C\u5F0F\u7684 Workflow \u6280\u80FD\u5B9A\u4E49\u6587\u4EF6",markdownImportDesc:"\u76F4\u63A5\u7F16\u5199 SKILL.md \u5185\u5BB9\uFF0C\u521B\u5EFA Agent \u6280\u80FD\uFF08AI \u80FD\u529B\u6269\u5C55\uFF09",zipImportDesc:"\u5BFC\u5165\u5305\u542B SKILL.md \u7684 Zip \u538B\u7F29\u5305\uFF0C\u53EF\u9644\u5E26 scripts/templates/assets \u7B49\u8F85\u52A9\u8D44\u6E90",clickOrDragZip:"\u70B9\u51FB\u9009\u62E9 Zip \u6587\u4EF6\u6216\u62D6\u62FD\u5230\u6B64\u5904",zipFileHint:"Zip \u5305\u5185\u9700\u5305\u542B SKILL.md \u6587\u4EF6\uFF0C\u53EF\u9009\u7684 scripts/ templates/ assets/ \u5B50\u76EE\u5F55",urlImportDesc:"\u4ECE\u8FDC\u7A0B URL \u4E0B\u8F7D\u6280\u80FD\u7684 Zip \u5305\u5E76\u81EA\u52A8\u5BFC\u5165",downloadUrl:"\u4E0B\u8F7D\u5730\u5740",selectJsonFile:"\u8BF7\u9009\u62E9 JSON \u6587\u4EF6",workflowSkillImported:'Workflow \u6280\u80FD "{name}" \u5BFC\u5165\u6210\u529F',agentSkillCreated:'Agent \u6280\u80FD "{name}" \u521B\u5EFA\u6210\u529F',createFailedShort:"\u521B\u5EFA\u5931\u8D25",selectZipFile:"\u8BF7\u9009\u62E9 Zip \u6587\u4EF6",fileTooLarge:"\u6587\u4EF6\u8FC7\u5927\uFF0C\u6700\u5927\u652F\u6301 50MB",fileReadFailed:"\u6587\u4EF6\u8BFB\u53D6\u5931\u8D25",agentSkillImported:'Agent \u6280\u80FD "{name}" \u5BFC\u5165\u6210\u529F',urlRequired:"\u8BF7\u8F93\u5165 URL",importFailed:"\u5BFC\u5165\u5931\u8D25: {error}",searchMcpPlaceholder:"\u641C\u7D22 MCP \u670D\u52A1\u5668...",searchSkillPlaceholder:"\u641C\u7D22\u6280\u80FD...",filterAll:"\u5168\u90E8",filterEnabled:"\u5DF2\u542F\u7528",filterDisabled:"\u5DF2\u505C\u7528",noMatchResult:"\u65E0\u5339\u914D\u7ED3\u679C"},memoryPanel:{tabTitle:"\u8BB0\u5FC6",title:"\u8BB0\u5FC6\u5411\u91CF",enabled:"\u5DF2\u542F\u7528",disabled:"\u5DF2\u505C\u7528",statusTitle:"\u5411\u91CF\u7D22\u5F15\u72B6\u6001",statusLoading:"\u8BFB\u53D6\u4E2D\u2026",statusOffline:"\u4EE3\u7406\u672A\u8FDE\u63A5\uFF0C\u6682\u65F6\u8BFB\u4E0D\u5230\u5411\u91CF\u72B6\u6001",statusFail:"\u5411\u91CF\u72B6\u6001\u8BFB\u53D6\u5931\u8D25",statusOldAgent:"\u5F53\u524D\u4EE3\u7406\u7248\u672C\u6CA1\u6709\u8FD9\u4E2A\u72B6\u6001\u63A5\u53E3\uFF0C\u8BF7\u91CD\u542F\u4EE3\u7406\u540E\u518D\u770B",statusDetail:"\u8FD4\u56DE\u4FE1\u606F",statusIndexed:"\u5DF2\u7D22\u5F15 {indexed} / \u5171 {total} \u6761",statusStored:"\u5411\u91CF\u6307\u7EB9",statusCurrent:"\u5F53\u524D\u914D\u7F6E\u6307\u7EB9",statusTier:"\u751F\u6548\u6863\u4F4D",statusStale:"\u5DF2\u9648\u65E7\uFF1A\u6A21\u578B\u53D8\u66F4\u540E\u672A\u91CD\u5EFA",statusFresh:"\u4E0E\u5F53\u524D\u914D\u7F6E\u4E00\u81F4",staleHint:"\u65E7\u5411\u91CF\u4E0E\u65B0\u914D\u7F6E\u4E0D\u53EF\u6BD4\uFF0C\u8BED\u4E49\u53EC\u56DE\u4F1A\u9759\u9ED8\u9000\u5316\u3002\u8BF7\u70B9\u300C\u91CD\u5EFA\u5411\u91CF\u7D22\u5F15\u300D\uFF08\u6709\u672A\u4FDD\u5B58\u7684\u4FEE\u6539\u5148\u4FDD\u5B58\uFF09\u3002",modeLabel:"\u5D4C\u5165\u6765\u6E90",modeRemote:"\u8FDC\u7AEF\u670D\u52A1\uFF08OpenAI \u517C\u5BB9\u63A5\u53E3\uFF09",modeLocal:"\u672C\u5730\u6A21\u578B",baseUrlLabel:"\u670D\u52A1\u5730\u5740",baseUrlPlaceholder:"https://api.openai.com/v1",modelLabel:"\u6A21\u578B\u540D\u79F0",modelPlaceholder:"BAAI/bge-m3",apiKeyLabel:"API Key",apiKeyPlaceholder:"\u7559\u7A7A\u8868\u793A\u4E0D\u4FEE\u6539",apiKeyClearBtn:"\u6E05\u9664\u5DF2\u5B58 Key",apiKeyClearConfirm:"\u6E05\u9664\u540E\u8FDC\u7AEF\u8BED\u4E49\u53EC\u56DE\u968F\u5373\u505C\u7528\uFF08\u964D\u56DE\u5173\u952E\u8BCD\u6863\uFF09\uFF0C\u76F4\u5230\u91CD\u65B0\u586B\u5165\u5E76\u4FDD\u5B58\u65B0 Key\u3002\u786E\u5B9A\u6E05\u9664\uFF1F",apiKeyCleared:"\u5DF2\u6E05\u9664\u5DF2\u5B58\u7684 API Key",apiKeyClearFail:"\u6E05\u9664 Key \u5931\u8D25\uFF1A{error}",configNotLoaded:"\u914D\u7F6E\u672A\u6210\u529F\u52A0\u8F7D\uFF0C\u4E3A\u907F\u514D\u628A\u4EE3\u7406\u91CC\u7684\u8BBE\u7F6E\u8986\u76D6\u6210\u7A7A\uFF0C\u8BF7\u5237\u65B0\u9762\u677F\u540E\u91CD\u8BD5",dimsLabel:"\u5411\u91CF\u7EF4\u5EA6\uFF08\u53EF\u7559\u7A7A\uFF0C\u6D4B\u8BD5\u65F6\u81EA\u52A8\u63A2\u6D4B\uFF09",prefixLabel:"\u67E5\u8BE2\u524D\u7F00\uFF08queryPrefix\uFF0C\u53EF\u7559\u7A7A\uFF09",localNotice:"\u672C\u5730\u6863\u65E0\u9700\u6D4B\u8BD5\u8FDE\u901A\u6027\uFF1A\u4FDD\u5B58\u540E\u76F4\u63A5\u91CD\u5EFA\u5411\u91CF\u7D22\u5F15\uFF08\u9996\u6B21\u4F7F\u7528\u9700\u4E0B\u8F7D\u6A21\u578B\uFF0C\u53EF\u80FD\u6570\u5341\u5206\u949F\uFF09\u3002\u5D4C\u5165\u5728 512 token \u5904\u9759\u9ED8\u622A\u65AD\uFF0C\u8D85\u957F\u6761\u76EE\u53EA\u6709\u524D\u90E8\u8FDB\u5165\u5411\u91CF\u3002",testBtn:"\u6D4B\u8BD5\u8FDE\u901A\u6027",testRunning:"\u6D4B\u8BD5\u4E2D\u2026",testOk:"\u8FDE\u901A\u6B63\u5E38\uFF1A{model} \u8F93\u51FA {dims} \u7EF4",testFail:"\u6D4B\u8BD5\u5931\u8D25\uFF1A{error}",scopeHint:"\u672C Tab \u7684\u914D\u7F6E\u4F1A\u5728\u70B9\u51FB\u5E95\u90E8\u300C\u4FDD\u5B58\u914D\u7F6E\u300D\u65F6\u4E00\u5E76\u5199\u5165\u4EE3\u7406\uFF08\u672C\u5730 agent \u670D\u52A1\uFF09\u7684 config.json\uFF1B\u4EE3\u7406\u672A\u8FDE\u63A5\u65F6\u8DF3\u8FC7\u8BE5\u9879\uFF0C\u4EC5\u4FDD\u5B58\u6269\u5C55\u81EA\u8EAB\u8BBE\u7F6E",saveSkippedOffline:"\u4EE3\u7406\u672A\u8FDE\u63A5\uFF0C\u8BB0\u5FC6\u5411\u91CF\u914D\u7F6E\u672A\u4FDD\u5B58\uFF08\u4EC5\u4FDD\u5B58\u4E86\u6269\u5C55\u8BBE\u7F6E\uFF09",saveSuccess:"\u8BB0\u5FC6\u5411\u91CF\u914D\u7F6E\u5DF2\u4FDD\u5B58",saveFail:"\u4FDD\u5B58\u5931\u8D25\uFF1A{error}",toggleOnSaved:"\u5DF2\u542F\u7528\u8BED\u4E49\u5411\u91CF\u53EC\u56DE",toggleOffSaved:"\u5DF2\u505C\u7528\uFF0C\u53EC\u56DE\u56DE\u843D\u5173\u952E\u8BCD\u901A\u9053",toggleFail:"\u5F00\u5173\u5207\u6362\u5931\u8D25\uFF1A{error}",reindexBtn:"\u91CD\u5EFA\u5411\u91CF\u7D22\u5F15",reindexConfirm:"\u91CD\u5EFA\u4F1A\u7528\u5F53\u524D\u914D\u7F6E\u91CD\u65B0\u8BA1\u7B97\u5168\u90E8\u8BB0\u5FC6\u7684\u5411\u91CF\u3002\u672C\u5730\u6863 41 \u6761\u5B9E\u6D4B\u7EA6 23 \u5206\u949F\uFF08\u8FDC\u7AEF\u7EA6 2 \u5206\u949F\uFF09\uFF0C\u671F\u95F4\u8BF7\u52FF\u5173\u95ED\u672C\u9875\u9762\u3002\u786E\u5B9A\u7EE7\u7EED\uFF1F",reindexRunning:"\u91CD\u5EFA\u8FDB\u884C\u4E2D\uFF0C\u8BF7\u52FF\u5173\u95ED\u9875\u9762\u2026",reindexDone:"\u91CD\u5EFA\u5B8C\u6210\uFF1A\u5DF2\u7D22\u5F15 {indexed} / {total}",reindexBatchFail:"\uFF08{count} \u6279\u5931\u8D25\uFF0C\u8BE6\u89C1 agent \u65E5\u5FD7\uFF09",reindexOverWindow:"\uFF08{count} \u6761\u8D85\u51FA {window} token \u7A97\u53E3\uFF0C\u5C3E\u90E8\u672A\u8FDB\u5411\u91CF\uFF09",reindexSkipped:"\u672A\u91CD\u5EFA\uFF1A\u5411\u91CF\u6863\u672A\u542F\u7528",reindexFail:"\u91CD\u5EFA\u5931\u8D25\uFF1A{error}",gateAgentOffTitle:"\u4EE3\u7406\u672A\u8FDE\u63A5",gateAgentOffBody:"\u8BB0\u5FC6\u5411\u91CF\u914D\u7F6E\u7531\u672C\u5730\u4EE3\u7406\u63D0\u4F9B\u3002\u8BF7\u5148\u5728\u300C\u4EE3\u7406\u300D\u6807\u7B7E\u9875\u5B8C\u6210\u4EE3\u7406\u8FDE\u63A5\uFF0C\u518D\u56DE\u5230\u8FD9\u91CC\u914D\u7F6E\u3002",gateRagTitle:"\u672C\u5730\u6A21\u578B\u4F9D\u8D56\u672A\u5C31\u7EEA",gateRagMissing:"\u672C\u5730\u6A21\u578B\u9700\u8981 RAG \u4F9D\u8D56\u3002\u8BF7\u5148\u5728\u300C\u6269\u5C55\u300D\u9762\u677F\u5B8C\u6210\u5B89\u88C5\uFF0C\u518D\u56DE\u5230\u8FD9\u91CC\u914D\u7F6E\u3002",goToAgentTab:"\u524D\u5F80\u300C\u4EE3\u7406\u300D\u6807\u7B7E\u9875",goToToolboxTab:"\u524D\u5F80\u300C\u6269\u5C55\u300D\u6807\u7B7E\u9875"},memoryEntries:{title:"\u8BB0\u5FC6\u6761\u76EE",refreshBtn:"\u5237\u65B0",searchPlaceholder:"\u641C\u7D22\u5185\u5BB9\u6216\u6807\u7B7E\u2026",filterAll:"\u5168\u90E8\u7C7B\u578B",filterFact:"\u4E8B\u5B9E",filterSummary:"\u6458\u8981",sortCreatedDesc:"\u521B\u5EFA\u65F6\u95F4\uFF08\u65B0\u2192\u65E7\uFF09",sortImportanceDesc:"\u91CD\u8981\u5EA6\uFF08\u9AD8\u2192\u4F4E\uFF09",sortValueDesc:"\u4EF7\u503C\u5206\uFF08\u9AD8\u2192\u4F4E\uFF09",sortValueAsc:"\u4EF7\u503C\u5206\uFF08\u4F4E\u2192\u9AD8\uFF09",count:"{shown} / {total} \u6761",loading:"\u8BFB\u53D6\u4E2D\u2026",empty:"\u8FD8\u6CA1\u6709\u4EFB\u4F55\u8BB0\u5FC6\u6761\u76EE",noMatch:"\u6CA1\u6709\u7B26\u5408\u7B5B\u9009\u6761\u4EF6\u7684\u6761\u76EE",offline:"\u4EE3\u7406\u672A\u8FDE\u63A5\uFF0C\u6682\u65F6\u8BFB\u4E0D\u5230\u8BB0\u5FC6\u6761\u76EE",unsupported:"\u5F53\u524D\u4EE3\u7406\u7248\u672C\u4E0D\u652F\u6301\u8BB0\u5FC6\u6761\u76EE\u7BA1\u7406\uFF0C\u8BF7\u5347\u7EA7\u5E76\u91CD\u542F\u4EE3\u7406",loadFail:"\u8BB0\u5FC6\u6761\u76EE\u8BFB\u53D6\u5931\u8D25\uFF1A{error}",importanceShort:"\u91CD\u8981\u5EA6",valueShort:"\u4EF7\u503C",createdLabel:"\u521B\u5EFA",lastAccessLabel:"\u6700\u8FD1\u8BBF\u95EE",neverAccessed:"\u4ECE\u672A",accessCount:"\u8BBF\u95EE {count} \u6B21",tagsLabel:"\u6807\u7B7E",editBtn:"\u7F16\u8F91",deleteBtn:"\u5220\u9664",editTitle:"\u7F16\u8F91\u8BB0\u5FC6\u6761\u76EE",typeLabel:"\u7C7B\u578B",contentLabel:"\u5185\u5BB9",importanceLabel:"\u91CD\u8981\u5EA6\uFF081-10\uFF09",tagsPlaceholder:"\u9017\u53F7\u5206\u9694\uFF0C\u5982\uFF1A\u73AF\u5883\u3001\u504F\u597D",saveBtn:"\u4FDD\u5B58\u4FEE\u6539",cancelBtn:"\u53D6\u6D88",contentEmpty:"\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A",saved:"\u8BB0\u5FC6\u5DF2\u66F4\u65B0",saveFail:"\u66F4\u65B0\u5931\u8D25\uFF1A{error}",deleteConfirm:"\u5220\u9664\u8FD9\u6761\u8BB0\u5FC6\uFF1F\u5220\u9664\u540E\u4E0D\u53EF\u6062\u590D\uFF0C\u5176\u5411\u91CF\u7F13\u5B58\u4F1A\u540C\u6B65\u6458\u9664\u3002",deleted:"\u8BB0\u5FC6\u5DF2\u5220\u9664",deleteFail:"\u5220\u9664\u5931\u8D25\uFF1A{error}",candidatesHint:"{count} \u6761\u4F4E\u4EF7\u503C\u8BB0\u5FC6\u5EFA\u8BAE\u6DD8\u6C70\uFF08\u4EF7\u503C\u5206\u4F4E\u4E8E 10\uFF09",compactBtn:"\u4E00\u952E\u538B\u7F29",compactConfirm:"\u5C06\u5220\u9664 {count} \u6761\u4EF7\u503C\u5206\u4F4E\u4E8E {threshold} \u7684\u8BB0\u5FC6\uFF0C\u5220\u9664\u540E\u4E0D\u53EF\u6062\u590D\u3002\u786E\u5B9A\u538B\u7F29\uFF1F",compactDone:"\u538B\u7F29\u5B8C\u6210\uFF1A\u5220\u9664\u4E8B\u5B9E {facts} \u6761\u3001\u6458\u8981 {summaries} \u6761",compactFail:"\u538B\u7F29\u5931\u8D25\uFF1A{error}"},knowledge:{tabTitle:"\u77E5\u8BC6\u5E93",gateAgentOffTitle:"\u4EE3\u7406\u672A\u8FDE\u63A5",gateAgentOffDesc:"\u77E5\u8BC6\u5E93\u529F\u80FD\u7531\u672C\u5730\u4EE3\u7406\u63D0\u4F9B\u3002\u8BF7\u5148\u5728\u300C\u4EE3\u7406\u300D\u6807\u7B7E\u9875\u5B8C\u6210\u4EE3\u7406\u8FDE\u63A5\uFF0C\u518D\u56DE\u5230\u8FD9\u91CC\u7BA1\u7406\u77E5\u8BC6\u5E93\u3002",gateRagOffTitle:"\u77E5\u8BC6\u5E93\u529F\u80FD\u672A\u542F\u7528",gateRagOffDesc:"\u5F00\u542F\u4E0A\u65B9\u300C\u77E5\u8BC6\u5E93\u68C0\u7D22\u300D\u603B\u5F00\u5173\u540E\uFF0C\u5373\u53EF\u521B\u5EFA\u548C\u7BA1\u7406\u77E5\u8BC6\u5E93\u3002",gateRagUnavailableTitle:"\u4EE3\u7406\u7AEF\u80FD\u529B\u672A\u5C31\u7EEA",gateRagUnavailableDesc:"RAG \u4F9D\u8D56\u5C1A\u672A\u5B89\u88C5\uFF0C\u6216 Node \u7248\u672C\u4E0D\u6EE1\u8DB3\u8981\u6C42\uFF08\u9700 Node 22+\uFF09\u3002\u8BF7\u67E5\u770B\u4E0B\u65B9\u5B89\u88C5\u5F15\u5BFC\u3002",goToAgentTab:"\u524D\u5F80\u300C\u4EE3\u7406\u300D\u6807\u7B7E\u9875",goToToolboxTab:"\u524D\u5F80\u300C\u6269\u5C55\u300D\u6807\u7B7E\u9875",enableNow:"\u7ACB\u5373\u542F\u7528",title:"\u77E5\u8BC6\u5E93",createBtn:"+ \u65B0\u5EFA\u77E5\u8BC6\u5E93",searchPlaceholder:"\u641C\u7D22\u77E5\u8BC6\u5E93...",emptyTitle:"\u8FD8\u6CA1\u6709\u77E5\u8BC6\u5E93",emptyDesc:"\u70B9\u51FB\u300C\u65B0\u5EFA\u77E5\u8BC6\u5E93\u300D\u521B\u5EFA\u7B2C\u4E00\u4E2A\u77E5\u8BC6\u5E93\uFF0C\u7136\u540E\u5BFC\u5165\u6587\u6863\u5F00\u59CB\u4F7F\u7528\u3002",loadFailed:"\u52A0\u8F7D\u5931\u8D25: {error}",retry:"\u91CD\u8BD5",statsSummary:"{docs} \u6587\u6863 \xB7 {chunks} \u5206\u5757",modeLocal:"\u672C\u5730\u6A21\u578B",modeRemote:"\u8FDC\u7AEF\u670D\u52A1",actionEdit:"\u7F16\u8F91",actionIngest:"\u5BFC\u5165",actionSearch:"\u68C0\u7D22\u6D4B\u8BD5",actionDocs:"\u6587\u6863",actionDelete:"\u5220\u9664",actionEnable:"\u542F\u7528",actionDisable:"\u505C\u7528",badgeDisabled:"\u5DF2\u505C\u7528",enableSuccess:"\u77E5\u8BC6\u5E93\u300C{name}\u300D\u5DF2\u542F\u7528",disableSuccess:"\u77E5\u8BC6\u5E93\u300C{name}\u300D\u5DF2\u505C\u7528",createTitle:"\u65B0\u5EFA\u77E5\u8BC6\u5E93",nameLabel:"\u540D\u79F0",namePlaceholder:"\u4F8B\u5982\uFF1A\u4EA7\u54C1\u6587\u6863\u96C6",descLabel:"\u63CF\u8FF0\uFF08\u53EF\u9009\uFF09",descPlaceholder:"\u7B80\u8981\u8BF4\u660E\u8FD9\u4E2A\u77E5\u8BC6\u5E93\u5B58\u653E\u4EC0\u4E48\u5185\u5BB9",createConfirm:"\u521B\u5EFA",creating:"\u521B\u5EFA\u4E2D...",createSuccess:"\u77E5\u8BC6\u5E93\u300C{name}\u300D\u5DF2\u521B\u5EFA",nameRequired:"\u8BF7\u8F93\u5165\u77E5\u8BC6\u5E93\u540D\u79F0",editTitle:"\u7F16\u8F91\u77E5\u8BC6\u5E93",editConfirm:"\u4FDD\u5B58",saving:"\u4FDD\u5B58\u4E2D...",editSuccess:"\u77E5\u8BC6\u5E93\u4FE1\u606F\u5DF2\u66F4\u65B0",vectorSectionTitle:"\u5411\u91CF\u6A21\u578B",vectorModeLocal:"\u672C\u5730\u6A21\u578B\uFF08\u5185\u7F6E BGE \u4E2D\u6587\u6A21\u578B\uFF09",vectorModeRemote:"\u8FDC\u7AEF\u670D\u52A1\uFF08OpenAI \u517C\u5BB9\u63A5\u53E3\uFF09",vectorModeLocalHint:"\u4F7F\u7528\u4EE3\u7406\u7AEF\u5185\u7F6E BGE \u4E2D\u6587\u6A21\u578B\u751F\u6210\u5411\u91CF\uFF0C\u65E0\u9700\u989D\u5916\u914D\u7F6E\uFF1B\u9996\u6B21\u5BFC\u5165\u9700\u4E0B\u8F7D\u6A21\u578B\u6587\u4EF6\u3002",vectorModeRemoteHint:"\u8C03\u7528\u8FDC\u7AEF OpenAI \u517C\u5BB9\u7684\u5411\u91CF\u670D\u52A1\uFF08\u5982\u7845\u57FA\u6D41\u52A8\u3001\u667A\u8C31\u3001OpenAI \u7B49\uFF09\u3002",vectorEndpointLabel:"\u63A5\u53E3\u5730\u5740\uFF08Base URL\uFF0C\u542B\u7248\u672C\u6BB5\uFF09",vectorEndpointPlaceholder:"\u4F8B\u5982 https://api.siliconflow.cn/v1",vectorApiKeyLabel:"API Key",vectorApiKeyPlaceholder:"\u7C98\u8D34 API Key",vectorApiKeyKeep:"\u7559\u7A7A\u5219\u6CBF\u7528\u5DF2\u4FDD\u5B58\u7684 Key",vectorModelLabel:"\u6A21\u578B\u540D\u79F0",vectorModelPlaceholder:"\u4F8B\u5982 BAAI/bge-m3",vectorDimsLabel:"\u5411\u91CF\u7EF4\u5EA6\uFF08\u53EF\u7559\u7A7A\uFF0C\u6D4B\u8BD5\u65F6\u81EA\u52A8\u63A2\u6D4B\uFF09",vectorDimsPlaceholder:"\u81EA\u52A8",vectorTestBtn:"\u6D4B\u8BD5\u8FDE\u901A\u6027",vectorTesting:"\u6D4B\u8BD5\u4E2D...",vectorTestOk:"\u8FDE\u63A5\u6210\u529F\uFF1A{model}\uFF08{dims} \u7EF4\uFF09",vectorDimsFilled:"\u5DF2\u81EA\u52A8\u586B\u5145\u7EF4\u5EA6\uFF1A{dims}",vectorTestFailed:"\u6D4B\u8BD5\u5931\u8D25: {error}",vectorEndpointRequired:"\u8BF7\u586B\u5199\u8FDC\u7AEF\u63A5\u53E3\u5730\u5740",vectorModelRequired:"\u8BF7\u586B\u5199\u6A21\u578B\u540D\u79F0",rebuildConfirmTitle:"\u53D8\u66F4\u5411\u91CF\u914D\u7F6E",rebuildConfirm:"\u5411\u91CF\u6A21\u578B\u6216\u5206\u5757\u53C2\u6570\u53D8\u66F4\u540E\u9700\u8981\u91CD\u5EFA\u7D22\u5F15\uFF08\u91CD\u65B0\u5411\u91CF\u5316\u5168\u90E8\u6587\u6863\uFF09\u3002\u91CD\u5EFA\u671F\u95F4\u4ECD\u53EF\u68C0\u7D22\u65E7\u7D22\u5F15\uFF0C\u5B8C\u6210\u540E\u81EA\u52A8\u5207\u6362\u3002\u786E\u5B9A\u7EE7\u7EED\u5417\uFF1F",rebuildStarted:"\u5DF2\u5F00\u59CB\u91CD\u5EFA\u7D22\u5F15\uFF0C\u5B8C\u6210\u540E\u5C06\u81EA\u52A8\u5237\u65B0...",progressRebuilding:"\u6B63\u5728\u91CD\u5EFA\u7D22\u5F15 {current}/{total} \u7BC7\u6587\u6863\u2026",rebuildDone:"\u7D22\u5F15\u91CD\u5EFA\u5B8C\u6210",rebuildFailed:"\u7D22\u5F15\u91CD\u5EFA\u5931\u8D25: {error}",deleteConfirmTitle:"\u5220\u9664\u77E5\u8BC6\u5E93",deleteConfirm:"\u786E\u5B9A\u5220\u9664\u300C{name}\u300D\u5417\uFF1F\u5176\u4E2D\u7684 {docs} \u4E2A\u6587\u6863\u3001{chunks} \u4E2A\u5206\u5757\u5C06\u4E00\u5E76\u5220\u9664\uFF0C\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002",deleteSuccess:"\u77E5\u8BC6\u5E93\u5DF2\u5220\u9664",ingestTitle:"\u5BFC\u5165\u6587\u6863\u5230\u300C{name}\u300D",tabFile:"\u6587\u4EF6",tabText:"\u6587\u672C",tabUrl:"URL",dropHint:"\u62D6\u62FD\u6587\u4EF6\u5230\u6B64\u5904\uFF0C\u6216\u70B9\u51FB\u9009\u62E9\uFF08\u53EF\u591A\u9009\uFF09",dropSupported:"\u652F\u6301 txt / md / pdf / docx / xlsx / html \u7B49\u683C\u5F0F\uFF0C\u5355\u6587\u4EF6 \u2264 50MB\uFF0C\u5355\u6B21\u2264 20 \u4E2A",selectedFile:"\u5DF2\u9009\u62E9\uFF1A{name}",selectedCount:"\u5DF2\u9009\u62E9 {count} \u4E2A\u6587\u4EF6\uFF08\u5355\u6B21\u6700\u591A {max} \u4E2A\uFF09",removeFile:"\u79FB\u9664",textContentLabel:"\u6587\u672C\u5185\u5BB9",textContentPlaceholder:"\u5728\u6B64\u7C98\u8D34\u8981\u5BFC\u5165\u7684\u6587\u672C\u5185\u5BB9...",textNameLabel:"\u6587\u6863\u540D\u79F0\uFF08\u53EF\u9009\uFF09",textNamePlaceholder:"\u7559\u7A7A\u5219\u81EA\u52A8\u547D\u540D",urlLabel:"\u7F51\u9875\u5730\u5740",urlPlaceholder:"https://example.com/page",chunkSettingsTitle:"\u5206\u5757\u8BBE\u7F6E",chunkSizeLabel:"\u5757\u5927\u5C0F\uFF08\u5B57\u7B26\uFF09",chunkOverlapLabel:"\u91CD\u53E0\uFF08\u5B57\u7B26\uFF09",ingestConfirm:"\u5F00\u59CB\u5BFC\u5165",ingesting:"\u6B63\u5728\u89E3\u6790\u5E76\u5411\u91CF\u5316\uFF0C\u9996\u6B21\u5BFC\u5165\u53EF\u80FD\u9700\u8981\u4E0B\u8F7D\u6A21\u578B\uFF0C\u8BF7\u7A0D\u5019...",progressParsing:"\u6B63\u5728\u89E3\u6790\u6587\u6863\u2026",progressChunking:"\u6B63\u5728\u5206\u5757\u2026",progressEmbedding:"\u6B63\u5728\u5411\u91CF\u5316 {current}/{total} \u5757\u2026",progressStoring:"\u6B63\u5728\u5199\u5165\u7D22\u5F15\u2026",ingestSuccess:"\u5BFC\u5165\u5B8C\u6210\uFF1A{name}\uFF08{chunks} \u4E2A\u5206\u5757\uFF09",ingestFailed:"\u5BFC\u5165\u5931\u8D25: {error}",fileRequired:"\u8BF7\u5148\u9009\u62E9\u6587\u4EF6",contentRequired:"\u8BF7\u8F93\u5165\u8981\u5BFC\u5165\u7684\u6587\u672C\u5185\u5BB9",urlRequired:"\u8BF7\u8F93\u5165\u7F51\u9875\u5730\u5740",fileTooLarge:"\u6587\u4EF6\u8FC7\u5927\uFF0C\u6700\u5927\u652F\u6301 50MB",fileTypeUnsupported:"\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B\uFF1A{name}",maxBatchFiles:"\u5355\u6B21\u6700\u591A\u5BFC\u5165 {max} \u4E2A\u6587\u4EF6\uFF0C\u8BF7\u5206\u6279\u5BFC\u5165",importingBatch:"\u6B63\u5728\u5BFC\u5165 {current}/{total}\uFF1A{name}",batchAllSuccess:"\u6279\u91CF\u5BFC\u5165\u5B8C\u6210\uFF1A{count} \u4E2A\u6587\u6863\uFF08\u5171 {chunks} \u4E2A\u5206\u5757\uFF09",batchPartial:"\u5BFC\u5165\u5B8C\u6210\uFF1A\u6210\u529F {success} \u4E2A\uFF0C\u5931\u8D25 {fail} \u4E2A\uFF08\u9996\u4E2A\u9519\u8BEF\uFF1A{error}\uFF09",batchAllFailed:"\u5168\u90E8\u5BFC\u5165\u5931\u8D25\uFF1A{error}",docsTitle:"\u300C{name}\u300D\u7684\u6587\u6863",docsEmpty:"\u8FD8\u6CA1\u6709\u5BFC\u5165\u4EFB\u4F55\u6587\u6863",docChunkCount:"{count} \u5206\u5757",docDeleteConfirmTitle:"\u5220\u9664\u6587\u6863",docDeleteConfirm:"\u786E\u5B9A\u5220\u9664\u6587\u6863\u300C{name}\u300D\u5417\uFF1F\u8BE5\u6587\u6863\u7684\u6240\u6709\u5206\u5757\u5C06\u4ECE\u77E5\u8BC6\u5E93\u4E2D\u79FB\u9664\u3002",docDeleteSuccess:"\u6587\u6863\u5DF2\u5220\u9664",searchTitle:"\u68C0\u7D22\u6D4B\u8BD5",searchScope:"\u68C0\u7D22\u8303\u56F4\uFF1A\u300C{name}\u300D",searchQueryPlaceholder:"\u8F93\u5165\u67E5\u8BE2\u8BED\u53E5\uFF0C\u4F8B\u5982\uFF1A\u5982\u4F55\u5BFC\u51FA\u6570\u636E\uFF1F",searchBtn:"\u68C0\u7D22",searching:"\u68C0\u7D22\u4E2D...",searchTopKLabel:"\u8FD4\u56DE\u6761\u6570",searchThresholdLabel:"\u76F8\u4F3C\u5EA6\u9608\u503C",searchHitCount:"\u547D\u4E2D {count} \u6761",searchNoHits:"\u6CA1\u6709\u547D\u4E2D\u4EFB\u4F55\u5185\u5BB9\uFF0C\u53EF\u5C1D\u8BD5\u964D\u4F4E\u76F8\u4F3C\u5EA6\u9608\u503C\u3002",searchFallbackHint:"\u76F8\u4F3C\u5EA6\u5747\u4F4E\u4E8E\u9608\u503C\uFF0C\u4EE5\u4E0B\u4E3A\u6700\u4F73\u5339\u914D\uFF08\u4EC5\u4F9B\u53C2\u8003\uFF09\uFF1A",searchFailed:"\u68C0\u7D22\u5931\u8D25: {error}",expandFull:"\u5C55\u5F00\u5168\u6587",collapse:"\u6536\u8D77",scoreLabel:"\u76F8\u4F3C\u5EA6",opFailed:"\u64CD\u4F5C\u5931\u8D25: {error}"},contextBubble:{labelSelection:"\u9009\u4E2D\u5185\u5BB9",labelQuoted:"\u5F15\u7528",labelSkill:"\u6280\u80FD",labelMcp:"MCP",labelPage:"\u7F51\u9875",labelFile:"\u6587\u4EF6",labelKnowledge:"\u77E5\u8BC6\u5E93",clickToExpand:"\u70B9\u51FB\u5C55\u5F00",bubbleSkill:"{name} \u{1F9E9}",bubbleMcp:"{name} \u{1F50C}",bubblePage:"{title} \u{1F310}",bubbleKnowledge:"{name} \u{1F4DA} \xB7 \u547D\u4E2D {count} \u6761",bubbleKnowledgeMiss:"{name} \u{1F4DA} \xB7 \u672A\u547D\u4E2D",bubbleKnowledgeFailed:"{name} \u{1F4DA} \xB7 \u68C0\u7D22\u5931\u8D25",bubbleKnowledgeSearching:"\u6B63\u5728\u68C0\u7D22\u77E5\u8BC6\u5E93\u2026",kbHitToggle:"\u70B9\u51FB\u5C55\u5F00/\u6536\u8D77\u5168\u6587",kbHitTruncated:"\u2702 \u5DF2\u622A\u65AD \xB7 \u539F\u6587 {total} \u5B57\uFF0C\u524D {kept} \u5B57\u5DF2\u53D1\u9001",kbHitTruncatedTitle:"\u4E3A\u63A7\u5236\u4E0A\u4E0B\u6587\u4F53\u79EF\uFF0C\u5185\u5BB9\u622A\u65AD\u540E\u518D\u53D1\u9001\u7ED9\u6A21\u578B\uFF1B\u6B64\u5904\u663E\u793A\u7684\u5373\u6A21\u578B\u5B9E\u9645\u6536\u5230\u7684\u7248\u672C",kbHitTruncatedBadge:"\u2702 {count} \u6761\u5DF2\u622A\u65AD"},configDialog:{exportTitle:"\u5BFC\u51FA\u914D\u7F6E",includeSecrets:"\u5305\u542B API \u5BC6\u94A5",secretWarn:"\u26A0 \u654F\u611F\u4FE1\u606F\uFF0C\u8BF7\u786E\u4FDD\u6587\u4EF6\u5B89\u5168",exportDesc:"\u5BFC\u51FA\u6587\u4EF6\u5C06\u5305\u542B\u9664 Agent \u8FDE\u63A5\u4FE1\u606F\u5916\u7684\u6240\u6709\u914D\u7F6E\uFF0C\u53EF\u9009\u62E9\u662F\u5426\u5305\u542B API \u5BC6\u94A5\u3002",export:"\u5BFC\u51FA",importTitle:"\u5BFC\u5165\u914D\u7F6E",mergeImport:"\u5408\u5E76\u5BFC\u5165 \u2014 \u4EC5\u8986\u76D6\u6587\u4EF6\u4E2D\u5B58\u5728\u7684\u914D\u7F6E\u9879\uFF0C\u4FDD\u7559\u5176\u4ED6",replaceImport:"\u5B8C\u5168\u66FF\u6362 \u2014 \u6E05\u7A7A\u5F53\u524D\u914D\u7F6E\uFF0C\u4F7F\u7528\u6587\u4EF6\u4E2D\u7684\u914D\u7F6E",confirmImport:"\u786E\u8BA4\u5BFC\u5165",exportSuccess:"\u914D\u7F6E\u5DF2\u5BFC\u51FA",exportFailed:"\u5BFC\u51FA\u5931\u8D25: {error}",unknownTime:"\u672A\u77E5",importSummary:"\u5BFC\u51FA\u65F6\u95F4: {time}\uFF0C\u5305\u542B {count} \u9879\u914D\u7F6E",invalidFileFormat:"\u65E0\u6548\u7684\u6587\u4EF6\u683C\u5F0F",unrecognizedFormat:"\u65E0\u6CD5\u8BC6\u522B\u7684\u914D\u7F6E\u683C\u5F0F",unknownConfigKey:"\u672A\u77E5\u7684\u914D\u7F6E\u9879: {key}",importFailed:"\u5BFC\u5165\u5931\u8D25: {error}",importParseFailed:"\u5BFC\u5165\u5931\u8D25: \u65E0\u6CD5\u89E3\u6790\u6587\u4EF6\u683C\u5F0F",importedCount:"\u5DF2\u5BFC\u5165 {count} \u9879\u914D\u7F6E"}},ao={common:{confirm:"Confirm",cancel:"Cancel",close:"Close",ok:"OK",save:"Save",delete:"Delete",edit:"Edit",retry:"Retry",loading:"Loading...",none:"None",add:"Add",clear:"Clear",selectAll:"Select All",deselectAll:"Deselect All",refresh:"Refresh",enabled:"Enabled",disabled:"Disabled",bytes:"bytes",copy:"Copy",copySuccess:"Copied",copyFailed:"Copy failed"},dialog:{operationConfirm:"Operation Confirmation",confirmDefaultMessage:"The model requests to execute a sensitive operation. Allow?",confirmAction:"The model requests to execute: {name}",remainingTime:"Time remaining: {time}",deny:"Deny",approveOnce:"Allow Once",approveLoop:"Allow for This Task",pendingQueue:"(+{count} queued)",pendingQueueClarify:"(+{count} awaiting clarification)",otherPending:"(+{count} other waiting)"},sensitiveTool:{manage_cookies:"Manage Cookies",manage_storage:"Page Storage Operation",download_file:"Download File",manage_tab:"Tab Management",agent_file:"File Operations",agent_exec:"Local Command Execution",debug_page:"Page Debugger",debuggerAttachHint:`
25
+ 2. \u6B65\u9AA42`,existingResources:"\u5DF2\u6709\u8D44\u6E90\u6587\u4EF6",skillNameRequired:"\u8BF7\u8F93\u5165\u6280\u80FD\u540D\u79F0",skillMarkdownRequired:"\u8BF7\u8F93\u5165 SKILL.md \u5185\u5BB9",agentSkillSaved:'Agent \u6280\u80FD "{name}" \u4FDD\u5B58\u6210\u529F',saveFailedShort:"\u4FDD\u5B58\u5931\u8D25",saveFailed:"\u4FDD\u5B58\u5931\u8D25: {error}",viewSkillTitle:"\u67E5\u770B\u6280\u80FD: {name}",importSkillTitle:"\u5BFC\u5165\u6280\u80FD",importBtn:"\u5BFC\u5165",jsonImport:"JSON \u5BFC\u5165",newAuthoring:"\u65B0\u5EFA\u7F16\u5199",zipPackage:"Zip \u5305",urlImport:"URL \u5BFC\u5165",jsonImportDesc:"\u5BFC\u5165 JSON \u683C\u5F0F\u7684 Workflow \u6280\u80FD\uFF08\u786E\u5B9A\u6027\u81EA\u52A8\u5316\u6D41\u7A0B\uFF09",clickOrDragJson:"\u70B9\u51FB\u9009\u62E9 JSON \u6587\u4EF6\u6216\u62D6\u62FD\u5230\u6B64\u5904",jsonFileHint:"\u652F\u6301 .json \u683C\u5F0F\u7684 Workflow \u6280\u80FD\u5B9A\u4E49\u6587\u4EF6",markdownImportDesc:"\u76F4\u63A5\u7F16\u5199 SKILL.md \u5185\u5BB9\uFF0C\u521B\u5EFA Agent \u6280\u80FD\uFF08AI \u80FD\u529B\u6269\u5C55\uFF09",zipImportDesc:"\u5BFC\u5165\u5305\u542B SKILL.md \u7684 Zip \u538B\u7F29\u5305\uFF0C\u53EF\u9644\u5E26 scripts/templates/assets \u7B49\u8F85\u52A9\u8D44\u6E90",clickOrDragZip:"\u70B9\u51FB\u9009\u62E9 Zip \u6587\u4EF6\u6216\u62D6\u62FD\u5230\u6B64\u5904",zipFileHint:"Zip \u5305\u5185\u9700\u5305\u542B SKILL.md \u6587\u4EF6\uFF0C\u53EF\u9009\u7684 scripts/ templates/ assets/ \u5B50\u76EE\u5F55",urlImportDesc:"\u4ECE\u8FDC\u7A0B URL \u4E0B\u8F7D\u6280\u80FD\u7684 Zip \u5305\u5E76\u81EA\u52A8\u5BFC\u5165",downloadUrl:"\u4E0B\u8F7D\u5730\u5740",selectJsonFile:"\u8BF7\u9009\u62E9 JSON \u6587\u4EF6",workflowSkillImported:'Workflow \u6280\u80FD "{name}" \u5BFC\u5165\u6210\u529F',agentSkillCreated:'Agent \u6280\u80FD "{name}" \u521B\u5EFA\u6210\u529F',createFailedShort:"\u521B\u5EFA\u5931\u8D25",selectZipFile:"\u8BF7\u9009\u62E9 Zip \u6587\u4EF6",fileTooLarge:"\u6587\u4EF6\u8FC7\u5927\uFF0C\u6700\u5927\u652F\u6301 50MB",fileReadFailed:"\u6587\u4EF6\u8BFB\u53D6\u5931\u8D25",agentSkillImported:'Agent \u6280\u80FD "{name}" \u5BFC\u5165\u6210\u529F',urlRequired:"\u8BF7\u8F93\u5165 URL",importFailed:"\u5BFC\u5165\u5931\u8D25: {error}",searchMcpPlaceholder:"\u641C\u7D22 MCP \u670D\u52A1\u5668...",searchSkillPlaceholder:"\u641C\u7D22\u6280\u80FD...",filterAll:"\u5168\u90E8",filterEnabled:"\u5DF2\u542F\u7528",filterDisabled:"\u5DF2\u505C\u7528",noMatchResult:"\u65E0\u5339\u914D\u7ED3\u679C"},memoryPanel:{tabTitle:"\u8BB0\u5FC6",title:"\u8BB0\u5FC6\u5411\u91CF",enabled:"\u5DF2\u542F\u7528",disabled:"\u5DF2\u505C\u7528",statusTitle:"\u5411\u91CF\u7D22\u5F15\u72B6\u6001",statusLoading:"\u8BFB\u53D6\u4E2D\u2026",statusOffline:"\u4EE3\u7406\u672A\u8FDE\u63A5\uFF0C\u6682\u65F6\u8BFB\u4E0D\u5230\u5411\u91CF\u72B6\u6001",statusFail:"\u5411\u91CF\u72B6\u6001\u8BFB\u53D6\u5931\u8D25",statusOldAgent:"\u5F53\u524D\u4EE3\u7406\u7248\u672C\u6CA1\u6709\u8FD9\u4E2A\u72B6\u6001\u63A5\u53E3\uFF0C\u8BF7\u91CD\u542F\u4EE3\u7406\u540E\u518D\u770B",statusDetail:"\u8FD4\u56DE\u4FE1\u606F",statusIndexed:"\u5DF2\u7D22\u5F15 {indexed} / \u5171 {total} \u6761",statusStored:"\u5411\u91CF\u6307\u7EB9",statusCurrent:"\u5F53\u524D\u914D\u7F6E\u6307\u7EB9",statusTier:"\u751F\u6548\u6863\u4F4D",statusStale:"\u5DF2\u9648\u65E7\uFF1A\u6A21\u578B\u53D8\u66F4\u540E\u672A\u91CD\u5EFA",statusFresh:"\u4E0E\u5F53\u524D\u914D\u7F6E\u4E00\u81F4",staleHint:"\u65E7\u5411\u91CF\u4E0E\u65B0\u914D\u7F6E\u4E0D\u53EF\u6BD4\uFF0C\u8BED\u4E49\u53EC\u56DE\u4F1A\u9759\u9ED8\u9000\u5316\u3002\u8BF7\u70B9\u300C\u91CD\u5EFA\u5411\u91CF\u7D22\u5F15\u300D\uFF08\u6709\u672A\u4FDD\u5B58\u7684\u4FEE\u6539\u5148\u4FDD\u5B58\uFF09\u3002",modeLabel:"\u5D4C\u5165\u6765\u6E90",modeRemote:"\u8FDC\u7AEF\u670D\u52A1\uFF08OpenAI \u517C\u5BB9\u63A5\u53E3\uFF09",modeLocal:"\u672C\u5730\u6A21\u578B",baseUrlLabel:"\u670D\u52A1\u5730\u5740",baseUrlPlaceholder:"https://api.openai.com/v1",modelLabel:"\u6A21\u578B\u540D\u79F0",modelPlaceholder:"BAAI/bge-m3",apiKeyLabel:"API Key",apiKeyPlaceholder:"\u7559\u7A7A\u8868\u793A\u4E0D\u4FEE\u6539",apiKeyClearBtn:"\u6E05\u9664\u5DF2\u5B58 Key",apiKeyClearConfirm:"\u6E05\u9664\u540E\u8FDC\u7AEF\u8BED\u4E49\u53EC\u56DE\u968F\u5373\u505C\u7528\uFF08\u964D\u56DE\u5173\u952E\u8BCD\u6863\uFF09\uFF0C\u76F4\u5230\u91CD\u65B0\u586B\u5165\u5E76\u4FDD\u5B58\u65B0 Key\u3002\u786E\u5B9A\u6E05\u9664\uFF1F",apiKeyCleared:"\u5DF2\u6E05\u9664\u5DF2\u5B58\u7684 API Key",apiKeyClearFail:"\u6E05\u9664 Key \u5931\u8D25\uFF1A{error}",configNotLoaded:"\u914D\u7F6E\u672A\u6210\u529F\u52A0\u8F7D\uFF0C\u4E3A\u907F\u514D\u628A\u4EE3\u7406\u91CC\u7684\u8BBE\u7F6E\u8986\u76D6\u6210\u7A7A\uFF0C\u8BF7\u5237\u65B0\u9762\u677F\u540E\u91CD\u8BD5",dimsLabel:"\u5411\u91CF\u7EF4\u5EA6\uFF08\u53EF\u7559\u7A7A\uFF0C\u6D4B\u8BD5\u65F6\u81EA\u52A8\u63A2\u6D4B\uFF09",prefixLabel:"\u67E5\u8BE2\u524D\u7F00\uFF08queryPrefix\uFF0C\u53EF\u7559\u7A7A\uFF09",localNotice:"\u672C\u5730\u6863\u65E0\u9700\u6D4B\u8BD5\u8FDE\u901A\u6027\uFF1A\u4FDD\u5B58\u540E\u76F4\u63A5\u91CD\u5EFA\u5411\u91CF\u7D22\u5F15\uFF08\u9996\u6B21\u4F7F\u7528\u9700\u4E0B\u8F7D\u6A21\u578B\uFF0C\u53EF\u80FD\u6570\u5341\u5206\u949F\uFF09\u3002\u5D4C\u5165\u5728 512 token \u5904\u9759\u9ED8\u622A\u65AD\uFF0C\u8D85\u957F\u6761\u76EE\u53EA\u6709\u524D\u90E8\u8FDB\u5165\u5411\u91CF\u3002",testBtn:"\u6D4B\u8BD5\u8FDE\u901A\u6027",testRunning:"\u6D4B\u8BD5\u4E2D\u2026",testOk:"\u8FDE\u901A\u6B63\u5E38\uFF1A{model} \u8F93\u51FA {dims} \u7EF4",testFail:"\u6D4B\u8BD5\u5931\u8D25\uFF1A{error}",scopeHint:"\u672C Tab \u7684\u914D\u7F6E\u4F1A\u5728\u70B9\u51FB\u5E95\u90E8\u300C\u4FDD\u5B58\u914D\u7F6E\u300D\u65F6\u4E00\u5E76\u5199\u5165\u4EE3\u7406\uFF08\u672C\u5730 agent \u670D\u52A1\uFF09\u7684 config.json\uFF1B\u4EE3\u7406\u672A\u8FDE\u63A5\u65F6\u8DF3\u8FC7\u8BE5\u9879\uFF0C\u4EC5\u4FDD\u5B58\u6269\u5C55\u81EA\u8EAB\u8BBE\u7F6E",saveSkippedOffline:"\u4EE3\u7406\u672A\u8FDE\u63A5\uFF0C\u8BB0\u5FC6\u5411\u91CF\u914D\u7F6E\u672A\u4FDD\u5B58\uFF08\u4EC5\u4FDD\u5B58\u4E86\u6269\u5C55\u8BBE\u7F6E\uFF09",saveSuccess:"\u8BB0\u5FC6\u5411\u91CF\u914D\u7F6E\u5DF2\u4FDD\u5B58",saveFail:"\u4FDD\u5B58\u5931\u8D25\uFF1A{error}",toggleOnSaved:"\u5DF2\u542F\u7528\u8BED\u4E49\u5411\u91CF\u53EC\u56DE",toggleOffSaved:"\u5DF2\u505C\u7528\uFF0C\u53EC\u56DE\u56DE\u843D\u5173\u952E\u8BCD\u901A\u9053",toggleFail:"\u5F00\u5173\u5207\u6362\u5931\u8D25\uFF1A{error}",reindexBtn:"\u91CD\u5EFA\u5411\u91CF\u7D22\u5F15",reindexConfirm:"\u91CD\u5EFA\u4F1A\u7528\u5F53\u524D\u914D\u7F6E\u91CD\u65B0\u8BA1\u7B97\u5168\u90E8\u8BB0\u5FC6\u7684\u5411\u91CF\u3002\u672C\u5730\u6863 41 \u6761\u5B9E\u6D4B\u7EA6 23 \u5206\u949F\uFF08\u8FDC\u7AEF\u7EA6 2 \u5206\u949F\uFF09\uFF0C\u671F\u95F4\u8BF7\u52FF\u5173\u95ED\u672C\u9875\u9762\u3002\u786E\u5B9A\u7EE7\u7EED\uFF1F",reindexRunning:"\u91CD\u5EFA\u8FDB\u884C\u4E2D\uFF0C\u8BF7\u52FF\u5173\u95ED\u9875\u9762\u2026",reindexDone:"\u91CD\u5EFA\u5B8C\u6210\uFF1A\u5DF2\u7D22\u5F15 {indexed} / {total}",reindexBatchFail:"\uFF08{count} \u6279\u5931\u8D25\uFF0C\u8BE6\u89C1 agent \u65E5\u5FD7\uFF09",reindexOverWindow:"\uFF08{count} \u6761\u8D85\u51FA {window} token \u7A97\u53E3\uFF0C\u5C3E\u90E8\u672A\u8FDB\u5411\u91CF\uFF09",reindexSkipped:"\u672A\u91CD\u5EFA\uFF1A\u5411\u91CF\u6863\u672A\u542F\u7528",reindexFail:"\u91CD\u5EFA\u5931\u8D25\uFF1A{error}",gateAgentOffTitle:"\u4EE3\u7406\u672A\u8FDE\u63A5",gateAgentOffBody:"\u8BB0\u5FC6\u5411\u91CF\u914D\u7F6E\u7531\u672C\u5730\u4EE3\u7406\u63D0\u4F9B\u3002\u8BF7\u5148\u5728\u300C\u4EE3\u7406\u300D\u6807\u7B7E\u9875\u5B8C\u6210\u4EE3\u7406\u8FDE\u63A5\uFF0C\u518D\u56DE\u5230\u8FD9\u91CC\u914D\u7F6E\u3002",gateRagTitle:"\u672C\u5730\u6A21\u578B\u4F9D\u8D56\u672A\u5C31\u7EEA",gateRagMissing:"\u672C\u5730\u6A21\u578B\u9700\u8981 RAG \u4F9D\u8D56\u3002\u8BF7\u5148\u5728\u300C\u6269\u5C55\u300D\u9762\u677F\u5B8C\u6210\u5B89\u88C5\uFF0C\u518D\u56DE\u5230\u8FD9\u91CC\u914D\u7F6E\u3002",goToAgentTab:"\u524D\u5F80\u300C\u4EE3\u7406\u300D\u6807\u7B7E\u9875",goToToolboxTab:"\u524D\u5F80\u300C\u6269\u5C55\u300D\u6807\u7B7E\u9875"},memoryEntries:{title:"\u8BB0\u5FC6\u6761\u76EE",refreshBtn:"\u5237\u65B0",searchPlaceholder:"\u641C\u7D22\u5185\u5BB9\u6216\u6807\u7B7E\u2026",filterAll:"\u5168\u90E8\u7C7B\u578B",filterFact:"\u4E8B\u5B9E",filterSummary:"\u6458\u8981",sortCreatedDesc:"\u521B\u5EFA\u65F6\u95F4\uFF08\u65B0\u2192\u65E7\uFF09",sortImportanceDesc:"\u91CD\u8981\u5EA6\uFF08\u9AD8\u2192\u4F4E\uFF09",sortValueDesc:"\u4EF7\u503C\u5206\uFF08\u9AD8\u2192\u4F4E\uFF09",sortValueAsc:"\u4EF7\u503C\u5206\uFF08\u4F4E\u2192\u9AD8\uFF09",count:"{shown} / {total} \u6761",loading:"\u8BFB\u53D6\u4E2D\u2026",empty:"\u8FD8\u6CA1\u6709\u4EFB\u4F55\u8BB0\u5FC6\u6761\u76EE",noMatch:"\u6CA1\u6709\u7B26\u5408\u7B5B\u9009\u6761\u4EF6\u7684\u6761\u76EE",offline:"\u4EE3\u7406\u672A\u8FDE\u63A5\uFF0C\u6682\u65F6\u8BFB\u4E0D\u5230\u8BB0\u5FC6\u6761\u76EE",unsupported:"\u5F53\u524D\u4EE3\u7406\u7248\u672C\u4E0D\u652F\u6301\u8BB0\u5FC6\u6761\u76EE\u7BA1\u7406\uFF0C\u8BF7\u5347\u7EA7\u5E76\u91CD\u542F\u4EE3\u7406",loadFail:"\u8BB0\u5FC6\u6761\u76EE\u8BFB\u53D6\u5931\u8D25\uFF1A{error}",importanceShort:"\u91CD\u8981\u5EA6",valueShort:"\u4EF7\u503C",createdLabel:"\u521B\u5EFA",lastAccessLabel:"\u6700\u8FD1\u8BBF\u95EE",neverAccessed:"\u4ECE\u672A",accessCount:"\u8BBF\u95EE {count} \u6B21",tagsLabel:"\u6807\u7B7E",editBtn:"\u7F16\u8F91",deleteBtn:"\u5220\u9664",editTitle:"\u7F16\u8F91\u8BB0\u5FC6\u6761\u76EE",typeLabel:"\u7C7B\u578B",contentLabel:"\u5185\u5BB9",importanceLabel:"\u91CD\u8981\u5EA6\uFF081-10\uFF09",tagsPlaceholder:"\u9017\u53F7\u5206\u9694\uFF0C\u5982\uFF1A\u73AF\u5883\u3001\u504F\u597D",saveBtn:"\u4FDD\u5B58\u4FEE\u6539",cancelBtn:"\u53D6\u6D88",contentEmpty:"\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A",saved:"\u8BB0\u5FC6\u5DF2\u66F4\u65B0",saveFail:"\u66F4\u65B0\u5931\u8D25\uFF1A{error}",deleteConfirm:"\u5220\u9664\u8FD9\u6761\u8BB0\u5FC6\uFF1F\u5220\u9664\u540E\u4E0D\u53EF\u6062\u590D\uFF0C\u5176\u5411\u91CF\u7F13\u5B58\u4F1A\u540C\u6B65\u6458\u9664\u3002",deleted:"\u8BB0\u5FC6\u5DF2\u5220\u9664",deleteFail:"\u5220\u9664\u5931\u8D25\uFF1A{error}",candidatesHint:"{count} \u6761\u4F4E\u4EF7\u503C\u8BB0\u5FC6\u5EFA\u8BAE\u6DD8\u6C70\uFF08\u4EF7\u503C\u5206\u4F4E\u4E8E 10\uFF09",compactBtn:"\u4E00\u952E\u538B\u7F29",compactConfirm:"\u5C06\u5220\u9664 {count} \u6761\u4EF7\u503C\u5206\u4F4E\u4E8E {threshold} \u7684\u8BB0\u5FC6\uFF0C\u5220\u9664\u540E\u4E0D\u53EF\u6062\u590D\u3002\u786E\u5B9A\u538B\u7F29\uFF1F",compactDone:"\u538B\u7F29\u5B8C\u6210\uFF1A\u5220\u9664\u4E8B\u5B9E {facts} \u6761\u3001\u6458\u8981 {summaries} \u6761",compactFail:"\u538B\u7F29\u5931\u8D25\uFF1A{error}"},knowledge:{tabTitle:"\u77E5\u8BC6\u5E93",gateAgentOffTitle:"\u4EE3\u7406\u672A\u8FDE\u63A5",gateAgentOffDesc:"\u77E5\u8BC6\u5E93\u529F\u80FD\u7531\u672C\u5730\u4EE3\u7406\u63D0\u4F9B\u3002\u8BF7\u5148\u5728\u300C\u4EE3\u7406\u300D\u6807\u7B7E\u9875\u5B8C\u6210\u4EE3\u7406\u8FDE\u63A5\uFF0C\u518D\u56DE\u5230\u8FD9\u91CC\u7BA1\u7406\u77E5\u8BC6\u5E93\u3002",gateRagOffTitle:"\u77E5\u8BC6\u5E93\u529F\u80FD\u672A\u542F\u7528",gateRagOffDesc:"\u5F00\u542F\u4E0A\u65B9\u300C\u77E5\u8BC6\u5E93\u68C0\u7D22\u300D\u603B\u5F00\u5173\u540E\uFF0C\u5373\u53EF\u521B\u5EFA\u548C\u7BA1\u7406\u77E5\u8BC6\u5E93\u3002",gateRagUnavailableTitle:"\u4EE3\u7406\u7AEF\u80FD\u529B\u672A\u5C31\u7EEA",gateRagUnavailableDesc:"RAG \u4F9D\u8D56\u5C1A\u672A\u5B89\u88C5\uFF0C\u6216 Node \u7248\u672C\u4E0D\u6EE1\u8DB3\u8981\u6C42\uFF08\u9700 Node 22+\uFF09\u3002\u8BF7\u67E5\u770B\u4E0B\u65B9\u5B89\u88C5\u5F15\u5BFC\u3002",goToAgentTab:"\u524D\u5F80\u300C\u4EE3\u7406\u300D\u6807\u7B7E\u9875",goToToolboxTab:"\u524D\u5F80\u300C\u6269\u5C55\u300D\u6807\u7B7E\u9875",enableNow:"\u7ACB\u5373\u542F\u7528",title:"\u77E5\u8BC6\u5E93",createBtn:"+ \u65B0\u5EFA\u77E5\u8BC6\u5E93",searchPlaceholder:"\u641C\u7D22\u77E5\u8BC6\u5E93...",emptyTitle:"\u8FD8\u6CA1\u6709\u77E5\u8BC6\u5E93",emptyDesc:"\u70B9\u51FB\u300C\u65B0\u5EFA\u77E5\u8BC6\u5E93\u300D\u521B\u5EFA\u7B2C\u4E00\u4E2A\u77E5\u8BC6\u5E93\uFF0C\u7136\u540E\u5BFC\u5165\u6587\u6863\u5F00\u59CB\u4F7F\u7528\u3002",loadFailed:"\u52A0\u8F7D\u5931\u8D25: {error}",retry:"\u91CD\u8BD5",statsSummary:"{docs} \u6587\u6863 \xB7 {chunks} \u5206\u5757",modeLocal:"\u672C\u5730\u6A21\u578B",modeRemote:"\u8FDC\u7AEF\u670D\u52A1",actionEdit:"\u7F16\u8F91",actionIngest:"\u5BFC\u5165",actionSearch:"\u68C0\u7D22\u6D4B\u8BD5",actionDocs:"\u6587\u6863",actionDelete:"\u5220\u9664",actionEnable:"\u542F\u7528",actionDisable:"\u505C\u7528",badgeDisabled:"\u5DF2\u505C\u7528",enableSuccess:"\u77E5\u8BC6\u5E93\u300C{name}\u300D\u5DF2\u542F\u7528",disableSuccess:"\u77E5\u8BC6\u5E93\u300C{name}\u300D\u5DF2\u505C\u7528",createTitle:"\u65B0\u5EFA\u77E5\u8BC6\u5E93",nameLabel:"\u540D\u79F0",namePlaceholder:"\u4F8B\u5982\uFF1A\u4EA7\u54C1\u6587\u6863\u96C6",descLabel:"\u63CF\u8FF0\uFF08\u53EF\u9009\uFF09",descPlaceholder:"\u7B80\u8981\u8BF4\u660E\u8FD9\u4E2A\u77E5\u8BC6\u5E93\u5B58\u653E\u4EC0\u4E48\u5185\u5BB9",createConfirm:"\u521B\u5EFA",creating:"\u521B\u5EFA\u4E2D...",createSuccess:"\u77E5\u8BC6\u5E93\u300C{name}\u300D\u5DF2\u521B\u5EFA",nameRequired:"\u8BF7\u8F93\u5165\u77E5\u8BC6\u5E93\u540D\u79F0",editTitle:"\u7F16\u8F91\u77E5\u8BC6\u5E93",editConfirm:"\u4FDD\u5B58",saving:"\u4FDD\u5B58\u4E2D...",editSuccess:"\u77E5\u8BC6\u5E93\u4FE1\u606F\u5DF2\u66F4\u65B0",vectorSectionTitle:"\u5411\u91CF\u6A21\u578B",vectorModeLocal:"\u672C\u5730\u6A21\u578B\uFF08\u5185\u7F6E BGE \u4E2D\u6587\u6A21\u578B\uFF09",vectorModeRemote:"\u8FDC\u7AEF\u670D\u52A1\uFF08OpenAI \u517C\u5BB9\u63A5\u53E3\uFF09",vectorModeLocalHint:"\u4F7F\u7528\u4EE3\u7406\u7AEF\u5185\u7F6E BGE \u4E2D\u6587\u6A21\u578B\u751F\u6210\u5411\u91CF\uFF0C\u65E0\u9700\u989D\u5916\u914D\u7F6E\uFF1B\u9996\u6B21\u5BFC\u5165\u9700\u4E0B\u8F7D\u6A21\u578B\u6587\u4EF6\u3002",vectorModeRemoteHint:"\u8C03\u7528\u8FDC\u7AEF OpenAI \u517C\u5BB9\u7684\u5411\u91CF\u670D\u52A1\uFF08\u5982\u7845\u57FA\u6D41\u52A8\u3001\u667A\u8C31\u3001OpenAI \u7B49\uFF09\u3002",vectorEndpointLabel:"\u63A5\u53E3\u5730\u5740\uFF08Base URL\uFF0C\u542B\u7248\u672C\u6BB5\uFF09",vectorEndpointPlaceholder:"\u4F8B\u5982 https://api.siliconflow.cn/v1",vectorApiKeyLabel:"API Key",vectorApiKeyPlaceholder:"\u7C98\u8D34 API Key",vectorApiKeyKeep:"\u7559\u7A7A\u5219\u6CBF\u7528\u5DF2\u4FDD\u5B58\u7684 Key",vectorModelLabel:"\u6A21\u578B\u540D\u79F0",vectorModelPlaceholder:"\u4F8B\u5982 BAAI/bge-m3",vectorDimsLabel:"\u5411\u91CF\u7EF4\u5EA6\uFF08\u53EF\u7559\u7A7A\uFF0C\u6D4B\u8BD5\u65F6\u81EA\u52A8\u63A2\u6D4B\uFF09",vectorDimsPlaceholder:"\u81EA\u52A8",vectorTestBtn:"\u6D4B\u8BD5\u8FDE\u901A\u6027",vectorTesting:"\u6D4B\u8BD5\u4E2D...",vectorTestOk:"\u8FDE\u63A5\u6210\u529F\uFF1A{model}\uFF08{dims} \u7EF4\uFF09",vectorDimsFilled:"\u5DF2\u81EA\u52A8\u586B\u5145\u7EF4\u5EA6\uFF1A{dims}",vectorTestFailed:"\u6D4B\u8BD5\u5931\u8D25: {error}",vectorEndpointRequired:"\u8BF7\u586B\u5199\u8FDC\u7AEF\u63A5\u53E3\u5730\u5740",vectorModelRequired:"\u8BF7\u586B\u5199\u6A21\u578B\u540D\u79F0",rebuildConfirmTitle:"\u53D8\u66F4\u5411\u91CF\u914D\u7F6E",rebuildConfirm:"\u5411\u91CF\u6A21\u578B\u6216\u5206\u5757\u53C2\u6570\u53D8\u66F4\u540E\u9700\u8981\u91CD\u5EFA\u7D22\u5F15\uFF08\u91CD\u65B0\u5411\u91CF\u5316\u5168\u90E8\u6587\u6863\uFF09\u3002\u91CD\u5EFA\u671F\u95F4\u4ECD\u53EF\u68C0\u7D22\u65E7\u7D22\u5F15\uFF0C\u5B8C\u6210\u540E\u81EA\u52A8\u5207\u6362\u3002\u786E\u5B9A\u7EE7\u7EED\u5417\uFF1F",rebuildStarted:"\u5DF2\u5F00\u59CB\u91CD\u5EFA\u7D22\u5F15\uFF0C\u5B8C\u6210\u540E\u5C06\u81EA\u52A8\u5237\u65B0...",progressRebuilding:"\u6B63\u5728\u91CD\u5EFA\u7D22\u5F15 {current}/{total} \u7BC7\u6587\u6863\u2026",rebuildDone:"\u7D22\u5F15\u91CD\u5EFA\u5B8C\u6210",rebuildFailed:"\u7D22\u5F15\u91CD\u5EFA\u5931\u8D25: {error}",deleteConfirmTitle:"\u5220\u9664\u77E5\u8BC6\u5E93",deleteConfirm:"\u786E\u5B9A\u5220\u9664\u300C{name}\u300D\u5417\uFF1F\u5176\u4E2D\u7684 {docs} \u4E2A\u6587\u6863\u3001{chunks} \u4E2A\u5206\u5757\u5C06\u4E00\u5E76\u5220\u9664\uFF0C\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002",deleteSuccess:"\u77E5\u8BC6\u5E93\u5DF2\u5220\u9664",ingestTitle:"\u5BFC\u5165\u6587\u6863\u5230\u300C{name}\u300D",tabFile:"\u6587\u4EF6",tabText:"\u6587\u672C",tabUrl:"URL",dropHint:"\u62D6\u62FD\u6587\u4EF6\u5230\u6B64\u5904\uFF0C\u6216\u70B9\u51FB\u9009\u62E9\uFF08\u53EF\u591A\u9009\uFF09",dropSupported:"\u652F\u6301 txt / md / pdf / docx / xlsx / html \u7B49\u683C\u5F0F\uFF0C\u5355\u6587\u4EF6 \u2264 50MB\uFF0C\u5355\u6B21\u2264 20 \u4E2A",selectedFile:"\u5DF2\u9009\u62E9\uFF1A{name}",selectedCount:"\u5DF2\u9009\u62E9 {count} \u4E2A\u6587\u4EF6\uFF08\u5355\u6B21\u6700\u591A {max} \u4E2A\uFF09",removeFile:"\u79FB\u9664",textContentLabel:"\u6587\u672C\u5185\u5BB9",textContentPlaceholder:"\u5728\u6B64\u7C98\u8D34\u8981\u5BFC\u5165\u7684\u6587\u672C\u5185\u5BB9...",textNameLabel:"\u6587\u6863\u540D\u79F0\uFF08\u53EF\u9009\uFF09",textNamePlaceholder:"\u7559\u7A7A\u5219\u81EA\u52A8\u547D\u540D",urlLabel:"\u7F51\u9875\u5730\u5740",urlPlaceholder:"https://example.com/page",chunkSettingsTitle:"\u5206\u5757\u8BBE\u7F6E",chunkSizeLabel:"\u5757\u5927\u5C0F\uFF08\u5B57\u7B26\uFF09",chunkOverlapLabel:"\u91CD\u53E0\uFF08\u5B57\u7B26\uFF09",ingestConfirm:"\u5F00\u59CB\u5BFC\u5165",ingesting:"\u6B63\u5728\u89E3\u6790\u5E76\u5411\u91CF\u5316\uFF0C\u9996\u6B21\u5BFC\u5165\u53EF\u80FD\u9700\u8981\u4E0B\u8F7D\u6A21\u578B\uFF0C\u8BF7\u7A0D\u5019...",progressParsing:"\u6B63\u5728\u89E3\u6790\u6587\u6863\u2026",progressChunking:"\u6B63\u5728\u5206\u5757\u2026",progressEmbedding:"\u6B63\u5728\u5411\u91CF\u5316 {current}/{total} \u5757\u2026",progressStoring:"\u6B63\u5728\u5199\u5165\u7D22\u5F15\u2026",ingestSuccess:"\u5BFC\u5165\u5B8C\u6210\uFF1A{name}\uFF08{chunks} \u4E2A\u5206\u5757\uFF09",ingestFailed:"\u5BFC\u5165\u5931\u8D25: {error}",fileRequired:"\u8BF7\u5148\u9009\u62E9\u6587\u4EF6",contentRequired:"\u8BF7\u8F93\u5165\u8981\u5BFC\u5165\u7684\u6587\u672C\u5185\u5BB9",urlRequired:"\u8BF7\u8F93\u5165\u7F51\u9875\u5730\u5740",fileTooLarge:"\u6587\u4EF6\u8FC7\u5927\uFF0C\u6700\u5927\u652F\u6301 50MB",fileTypeUnsupported:"\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B\uFF1A{name}",maxBatchFiles:"\u5355\u6B21\u6700\u591A\u5BFC\u5165 {max} \u4E2A\u6587\u4EF6\uFF0C\u8BF7\u5206\u6279\u5BFC\u5165",importingBatch:"\u6B63\u5728\u5BFC\u5165 {current}/{total}\uFF1A{name}",batchAllSuccess:"\u6279\u91CF\u5BFC\u5165\u5B8C\u6210\uFF1A{count} \u4E2A\u6587\u6863\uFF08\u5171 {chunks} \u4E2A\u5206\u5757\uFF09",batchPartial:"\u5BFC\u5165\u5B8C\u6210\uFF1A\u6210\u529F {success} \u4E2A\uFF0C\u5931\u8D25 {fail} \u4E2A\uFF08\u9996\u4E2A\u9519\u8BEF\uFF1A{error}\uFF09",batchAllFailed:"\u5168\u90E8\u5BFC\u5165\u5931\u8D25\uFF1A{error}",docsTitle:"\u300C{name}\u300D\u7684\u6587\u6863",docsEmpty:"\u8FD8\u6CA1\u6709\u5BFC\u5165\u4EFB\u4F55\u6587\u6863",docChunkCount:"{count} \u5206\u5757",docDeleteConfirmTitle:"\u5220\u9664\u6587\u6863",docDeleteConfirm:"\u786E\u5B9A\u5220\u9664\u6587\u6863\u300C{name}\u300D\u5417\uFF1F\u8BE5\u6587\u6863\u7684\u6240\u6709\u5206\u5757\u5C06\u4ECE\u77E5\u8BC6\u5E93\u4E2D\u79FB\u9664\u3002",docDeleteSuccess:"\u6587\u6863\u5DF2\u5220\u9664",searchTitle:"\u68C0\u7D22\u6D4B\u8BD5",searchScope:"\u68C0\u7D22\u8303\u56F4\uFF1A\u300C{name}\u300D",searchQueryPlaceholder:"\u8F93\u5165\u67E5\u8BE2\u8BED\u53E5\uFF0C\u4F8B\u5982\uFF1A\u5982\u4F55\u5BFC\u51FA\u6570\u636E\uFF1F",searchBtn:"\u68C0\u7D22",searching:"\u68C0\u7D22\u4E2D...",searchTopKLabel:"\u8FD4\u56DE\u6761\u6570",searchThresholdLabel:"\u76F8\u4F3C\u5EA6\u9608\u503C",searchHitCount:"\u547D\u4E2D {count} \u6761",searchNoHits:"\u6CA1\u6709\u547D\u4E2D\u4EFB\u4F55\u5185\u5BB9\uFF0C\u53EF\u5C1D\u8BD5\u964D\u4F4E\u76F8\u4F3C\u5EA6\u9608\u503C\u3002",searchFallbackHint:"\u76F8\u4F3C\u5EA6\u5747\u4F4E\u4E8E\u9608\u503C\uFF0C\u4EE5\u4E0B\u4E3A\u6700\u4F73\u5339\u914D\uFF08\u4EC5\u4F9B\u53C2\u8003\uFF09\uFF1A",searchFailed:"\u68C0\u7D22\u5931\u8D25: {error}",expandFull:"\u5C55\u5F00\u5168\u6587",collapse:"\u6536\u8D77",scoreLabel:"\u76F8\u4F3C\u5EA6",opFailed:"\u64CD\u4F5C\u5931\u8D25: {error}"},contextBubble:{labelSelection:"\u9009\u4E2D\u5185\u5BB9",labelQuoted:"\u5F15\u7528",labelSkill:"\u6280\u80FD",labelMcp:"MCP",labelPage:"\u7F51\u9875",labelFile:"\u6587\u4EF6",labelKnowledge:"\u77E5\u8BC6\u5E93",clickToExpand:"\u70B9\u51FB\u5C55\u5F00",bubbleSkill:"{name} \u{1F9E9}",bubbleMcp:"{name} \u{1F50C}",bubblePage:"{title} \u{1F310}",bubbleKnowledge:"{name} \u{1F4DA} \xB7 \u547D\u4E2D {count} \u6761",bubbleKnowledgeMiss:"{name} \u{1F4DA} \xB7 \u672A\u547D\u4E2D",bubbleKnowledgeFailed:"{name} \u{1F4DA} \xB7 \u68C0\u7D22\u5931\u8D25",bubbleKnowledgeSearching:"\u6B63\u5728\u68C0\u7D22\u77E5\u8BC6\u5E93\u2026",kbHitToggle:"\u70B9\u51FB\u5C55\u5F00/\u6536\u8D77\u5168\u6587",kbHitTruncated:"\u2702 \u5DF2\u622A\u65AD \xB7 \u539F\u6587 {total} \u5B57\uFF0C\u524D {kept} \u5B57\u5DF2\u53D1\u9001",kbHitTruncatedTitle:"\u4E3A\u63A7\u5236\u4E0A\u4E0B\u6587\u4F53\u79EF\uFF0C\u5185\u5BB9\u622A\u65AD\u540E\u518D\u53D1\u9001\u7ED9\u6A21\u578B\uFF1B\u6B64\u5904\u663E\u793A\u7684\u5373\u6A21\u578B\u5B9E\u9645\u6536\u5230\u7684\u7248\u672C",kbHitTruncatedBadge:"\u2702 {count} \u6761\u5DF2\u622A\u65AD"},configDialog:{exportTitle:"\u5BFC\u51FA\u914D\u7F6E",includeSecrets:"\u5305\u542B API \u5BC6\u94A5",secretWarn:"\u26A0 \u654F\u611F\u4FE1\u606F\uFF0C\u8BF7\u786E\u4FDD\u6587\u4EF6\u5B89\u5168",exportDesc:"\u5BFC\u51FA\u6587\u4EF6\u5C06\u5305\u542B\u9664 Agent \u8FDE\u63A5\u4FE1\u606F\u5916\u7684\u6240\u6709\u914D\u7F6E\uFF0C\u53EF\u9009\u62E9\u662F\u5426\u5305\u542B API \u5BC6\u94A5\u3002",export:"\u5BFC\u51FA",importTitle:"\u5BFC\u5165\u914D\u7F6E",mergeImport:"\u5408\u5E76\u5BFC\u5165 \u2014 \u4EC5\u8986\u76D6\u6587\u4EF6\u4E2D\u5B58\u5728\u7684\u914D\u7F6E\u9879\uFF0C\u4FDD\u7559\u5176\u4ED6",replaceImport:"\u5B8C\u5168\u66FF\u6362 \u2014 \u6E05\u7A7A\u5F53\u524D\u914D\u7F6E\uFF0C\u4F7F\u7528\u6587\u4EF6\u4E2D\u7684\u914D\u7F6E",confirmImport:"\u786E\u8BA4\u5BFC\u5165",exportSuccess:"\u914D\u7F6E\u5DF2\u5BFC\u51FA",exportFailed:"\u5BFC\u51FA\u5931\u8D25: {error}",unknownTime:"\u672A\u77E5",importSummary:"\u5BFC\u51FA\u65F6\u95F4: {time}\uFF0C\u5305\u542B {count} \u9879\u914D\u7F6E",invalidFileFormat:"\u65E0\u6548\u7684\u6587\u4EF6\u683C\u5F0F",unrecognizedFormat:"\u65E0\u6CD5\u8BC6\u522B\u7684\u914D\u7F6E\u683C\u5F0F",unknownConfigKey:"\u672A\u77E5\u7684\u914D\u7F6E\u9879: {key}",importFailed:"\u5BFC\u5165\u5931\u8D25: {error}",importParseFailed:"\u5BFC\u5165\u5931\u8D25: \u65E0\u6CD5\u89E3\u6790\u6587\u4EF6\u683C\u5F0F",importedCount:"\u5DF2\u5BFC\u5165 {count} \u9879\u914D\u7F6E"}},mo={common:{confirm:"Confirm",cancel:"Cancel",close:"Close",ok:"OK",save:"Save",delete:"Delete",edit:"Edit",retry:"Retry",loading:"Loading...",none:"None",add:"Add",clear:"Clear",selectAll:"Select All",deselectAll:"Deselect All",refresh:"Refresh",enabled:"Enabled",disabled:"Disabled",bytes:"bytes",copy:"Copy",copySuccess:"Copied",copyFailed:"Copy failed"},dialog:{operationConfirm:"Operation Confirmation",confirmDefaultMessage:"The model requests to execute a sensitive operation. Allow?",confirmAction:"The model requests to execute: {name}",remainingTime:"Time remaining: {time}",deny:"Deny",approveOnce:"Allow Once",approveLoop:"Allow for This Task",pendingQueue:"(+{count} queued)",pendingQueueClarify:"(+{count} awaiting clarification)",otherPending:"(+{count} other waiting)"},sensitiveTool:{manage_cookies:"Manage Cookies",manage_storage:"Page Storage Operation",download_file:"Download File",manage_tab:"Tab Management",agent_file:"File Operations",agent_exec:"Local Command Execution",debug_page:"Page Debugger",debuggerAttachHint:`
26
26
 
27
27
  After enabling, a yellow "extension is debugging this browser" infobar appears on the tab until the session ends.`,unknown:"Unknown Operation",tabInfo:`
28
28
 
@@ -46,48 +46,48 @@ You will need to pair again after deletion.`,deleteAgentTitle:"Delete Agent",age
46
46
 
47
47
  ## Execution steps
48
48
  1. Step 1
49
- 2. Step 2`,existingResources:"Existing resource files",skillNameRequired:"Please enter the Skill name",skillMarkdownRequired:"Please enter the SKILL.md content",agentSkillSaved:'Agent Skill "{name}" saved successfully',saveFailedShort:"Save failed",saveFailed:"Save failed: {error}",viewSkillTitle:"View Skill: {name}",importSkillTitle:"Import Skill",importBtn:"Import",jsonImport:"JSON Import",newAuthoring:"New Authoring",zipPackage:"Zip",urlImport:"URL Import",jsonImportDesc:"Import a Workflow Skill in JSON format (deterministic automated flow)",clickOrDragJson:"Click to select a JSON file or drag it here",jsonFileHint:"Supports .json Workflow Skill definition files",markdownImportDesc:"Write SKILL.md content directly to create an Agent Skill (AI capability extension)",zipImportDesc:"Import a Zip archive containing SKILL.md, with optional scripts/templates/assets resources",clickOrDragZip:"Click to select a Zip file or drag it here",zipFileHint:"The Zip must contain a SKILL.md file; optional scripts/ templates/ assets/ subdirectories",urlImportDesc:"Download a Skill Zip from a remote URL and import automatically",downloadUrl:"Download URL",selectJsonFile:"Please select a JSON file",workflowSkillImported:'Workflow Skill "{name}" imported successfully',agentSkillCreated:'Agent Skill "{name}" created successfully',createFailedShort:"Create failed",selectZipFile:"Please select a Zip file",fileTooLarge:"File too large; max 50MB supported",fileReadFailed:"File read failed",agentSkillImported:'Agent Skill "{name}" imported successfully',urlRequired:"Please enter a URL",importFailed:"Import failed: {error}",searchMcpPlaceholder:"Search MCP servers...",searchSkillPlaceholder:"Search skills...",filterAll:"All",filterEnabled:"Enabled",filterDisabled:"Disabled",noMatchResult:"No matching results"},memoryPanel:{tabTitle:"Memory",title:"Memory Vectors",enabled:"Enabled",disabled:"Disabled",statusTitle:"Vector index status",statusLoading:"Loading\u2026",statusOffline:"Agent is not connected, vector status unavailable",statusFail:"Failed to read vector status",statusOldAgent:"This agent version has no such status endpoint \u2014 restart the agent",statusDetail:"Response",statusIndexed:"Indexed {indexed} of {total}",statusStored:"Stored vector fingerprint",statusCurrent:"Current config fingerprint",statusTier:"Active tier",statusStale:"Stale: model changed without rebuild",statusFresh:"Matches current config",staleHint:"Old vectors are incomparable with the new config, so semantic recall degrades silently. Click \u201CRebuild vector index\u201D (save unsaved edits first).",modeLabel:"Embedding source",modeRemote:"Remote service (OpenAI-compatible API)",modeLocal:"Local model",baseUrlLabel:"Endpoint",baseUrlPlaceholder:"https://api.openai.com/v1",modelLabel:"Model name",modelPlaceholder:"BAAI/bge-m3",apiKeyLabel:"API Key",apiKeyPlaceholder:"Leave blank to keep the stored key",apiKeyClearBtn:"Clear stored key",apiKeyClearConfirm:"Remote semantic recall stops (falls back to keywords) until a new key is saved. Clear the stored key?",apiKeyCleared:"Stored API key cleared",apiKeyClearFail:"Failed to clear key: {error}",configNotLoaded:"Config failed to load. Refresh the panel before saving so the agent\u2019s stored settings are not overwritten with blanks",dimsLabel:"Vector dimensions (blank is fine, detected on test)",prefixLabel:"Query prefix (optional)",localNotice:"Local mode needs no connectivity test: save, then rebuild the vector index (the first run downloads the model and may take tens of minutes). Embeddings are silently truncated at 512 tokens, so only the head of an over-long entry is indexed.",testBtn:"Test connectivity",testRunning:"Testing\u2026",testOk:"OK: {model} returns {dims} dimensions",testFail:"Test failed: {error}",scopeHint:"Clicking the bottom \u201CSave\u201D also writes this tab\u2019s config into the agent service config.json; when the agent is offline this item is skipped and only extension settings are saved",saveSkippedOffline:"Agent not connected \u2014 memory vector config was not saved (only extension settings saved)",saveSuccess:"Memory vector config saved",saveFail:"Save failed: {error}",toggleOnSaved:"Semantic vector recall enabled",toggleOffSaved:"Semantic vector recall disabled - recall falls back to keywords",toggleFail:"Failed to toggle: {error}",reindexBtn:"Rebuild vector index",reindexConfirm:"Rebuilding recomputes vectors for every memory with the current config. On local mode 41 entries measured about 23 minutes (remote about 2). Keep this page open. Continue?",reindexRunning:"Rebuilding, please keep this page open\u2026",reindexDone:"Rebuild done: indexed {indexed} of {total}",reindexBatchFail:" ({count} batches failed, see agent logs)",reindexOverWindow:" ({count} entries exceed the {window}-token window, their tails are not indexed)",reindexSkipped:"Rebuild skipped: vector tier is disabled",reindexFail:"Rebuild failed: {error}",gateAgentOffTitle:"Agent not connected",gateAgentOffBody:'Memory vector config is provided by the local agent. Connect an agent in the "Agent" tab first, then come back here.',gateRagTitle:"Local model dependency missing",gateRagMissing:'Local models require the RAG dependency. Install it in the "Extensions" panel first, then come back here.',goToAgentTab:'Go to "Agent" tab',goToToolboxTab:'Go to "Extensions" tab'},memoryEntries:{title:"Memory Entries",refreshBtn:"Refresh",searchPlaceholder:"Search content or tags\u2026",filterAll:"All types",filterFact:"Facts",filterSummary:"Summaries",sortCreatedDesc:"Created (newest first)",sortImportanceDesc:"Importance (high \u2192 low)",sortValueDesc:"Value (high \u2192 low)",sortValueAsc:"Value (low \u2192 high)",count:"{shown} of {total}",loading:"Loading\u2026",empty:"No memories yet",noMatch:"No entries match the filter",offline:"Agent not connected - memory entries unavailable",unsupported:"This agent version does not support memory entry management - upgrade and restart the agent",loadFail:"Failed to load memory entries: {error}",importanceShort:"Imp",valueShort:"Value",createdLabel:"Created",lastAccessLabel:"Last accessed",neverAccessed:"never",accessCount:"{count} accesses",tagsLabel:"Tags",editBtn:"Edit",deleteBtn:"Delete",editTitle:"Edit memory entry",typeLabel:"Type",contentLabel:"Content",importanceLabel:"Importance (1-10)",tagsPlaceholder:"comma-separated, e.g. environment, preference",saveBtn:"Save",cancelBtn:"Cancel",contentEmpty:"Content cannot be empty",saved:"Memory updated",saveFail:"Update failed: {error}",deleteConfirm:"Delete this memory? It cannot be undone, and its vector cache entry is dropped as well.",deleted:"Memory deleted",deleteFail:"Delete failed: {error}",candidatesHint:"{count} low-value memories are suggested for removal (value below 10)",compactBtn:"Compact now",compactConfirm:"Compacting deletes {count} memories with value below {threshold}. This cannot be undone. Continue?",compactDone:"Compact done: removed {facts} facts and {summaries} summaries",compactFail:"Compact failed: {error}"},knowledge:{tabTitle:"Knowledge",gateAgentOffTitle:"Agent not connected",gateAgentOffDesc:'Knowledge base is provided by the local agent. Connect an agent in the "Agent" tab first, then come back here.',gateRagOffTitle:"Knowledge base feature is disabled",gateRagOffDesc:'Turn on the "Knowledge Retrieval" master switch above to create and manage knowledge bases.',gateRagUnavailableTitle:"Agent capability not ready",gateRagUnavailableDesc:"RAG dependencies are not installed or the Node version is unsupported (Node 22+ required). See the install guide below.",goToAgentTab:'Go to "Agent" tab',goToToolboxTab:'Go to "Extensions" tab',enableNow:"Enable Now",title:"Knowledge Bases",createBtn:"+ New Knowledge Base",searchPlaceholder:"Search knowledge bases...",emptyTitle:"No knowledge base yet",emptyDesc:'Click "New Knowledge Base" to create one, then import documents to get started.',loadFailed:"Failed to load: {error}",retry:"Retry",statsSummary:"{docs} docs \xB7 {chunks} chunks",modeLocal:"Local model",modeRemote:"Remote service",actionEdit:"Edit",actionIngest:"Import",actionSearch:"Test Search",actionDocs:"Docs",actionDelete:"Delete",actionEnable:"Enable",actionDisable:"Disable",badgeDisabled:"Disabled",enableSuccess:'Knowledge base "{name}" enabled',disableSuccess:'Knowledge base "{name}" disabled',createTitle:"New Knowledge Base",nameLabel:"Name",namePlaceholder:"e.g. Product Docs",descLabel:"Description (optional)",descPlaceholder:"Briefly describe what this knowledge base contains",createConfirm:"Create",creating:"Creating...",createSuccess:'Knowledge base "{name}" created',nameRequired:"Please enter a name",editTitle:"Edit Knowledge Base",editConfirm:"Save",saving:"Saving...",editSuccess:"Knowledge base updated",vectorSectionTitle:"Embedding model",vectorModeLocal:"Local model (bundled BGE Chinese model)",vectorModeRemote:"Remote service (OpenAI-compatible API)",vectorModeLocalHint:"Use the agent-bundled BGE Chinese model. No extra config needed; the model file downloads on first import.",vectorModeRemoteHint:"Call a remote OpenAI-compatible embedding service (SiliconFlow, Zhipu, OpenAI, etc.).",vectorEndpointLabel:"Endpoint (Base URL with version segment)",vectorEndpointPlaceholder:"e.g. https://api.siliconflow.cn/v1",vectorApiKeyLabel:"API Key",vectorApiKeyPlaceholder:"Paste API key",vectorApiKeyKeep:"Leave empty to keep the saved key",vectorModelLabel:"Model name",vectorModelPlaceholder:"e.g. BAAI/bge-m3",vectorDimsLabel:"Dimensions (optional, auto-detected on test)",vectorDimsPlaceholder:"Auto",vectorTestBtn:"Test Connection",vectorTesting:"Testing...",vectorTestOk:"Connected: {model} ({dims} dims)",vectorDimsFilled:"Dimensions auto-filled: {dims}",vectorTestFailed:"Test failed: {error}",vectorEndpointRequired:"Remote endpoint is required",vectorModelRequired:"Model name is required",rebuildConfirmTitle:"Change Embedding Config",rebuildConfirm:"Changing the embedding model or chunk settings requires rebuilding the index (all documents will be re-embedded). The old index stays searchable during the rebuild and switches automatically when done. Continue?",rebuildStarted:"Index rebuild started, refreshing when complete...",progressRebuilding:"Rebuilding index {current}/{total} documents\u2026",rebuildDone:"Index rebuild complete",rebuildFailed:"Index rebuild failed: {error}",deleteConfirmTitle:"Delete Knowledge Base",deleteConfirm:'Delete "{name}"? Its {docs} documents and {chunks} chunks will be removed permanently.',deleteSuccess:"Knowledge base deleted",ingestTitle:'Import documents into "{name}"',tabFile:"File",tabText:"Text",tabUrl:"URL",dropHint:"Drag & drop files here, or click to choose (multiple allowed)",dropSupported:"Supports txt / md / pdf / docx / xlsx / html, up to 50MB per file, 20 files per batch",selectedFile:"Selected: {name}",selectedCount:"Selected {count} file(s) (max {max} per batch)",removeFile:"Remove",textContentLabel:"Text content",textContentPlaceholder:"Paste the text to import here...",textNameLabel:"Document name (optional)",textNamePlaceholder:"Leave empty to auto-name",urlLabel:"Web page URL",urlPlaceholder:"https://example.com/page",chunkSettingsTitle:"Chunk settings",chunkSizeLabel:"Chunk size (chars)",chunkOverlapLabel:"Overlap (chars)",ingestConfirm:"Start Import",ingesting:"Parsing and embedding. The first import may download the model, please wait...",progressParsing:"Parsing document\u2026",progressChunking:"Splitting into chunks\u2026",progressEmbedding:"Embedding chunks {current}/{total}\u2026",progressStoring:"Writing to index\u2026",ingestSuccess:"Imported: {name} ({chunks} chunks)",ingestFailed:"Import failed: {error}",fileRequired:"Please choose a file first",contentRequired:"Please enter the text content",urlRequired:"Please enter the URL",fileTooLarge:"File too large, 50MB max",fileTypeUnsupported:"Unsupported file type: {name}",maxBatchFiles:"Up to {max} files per batch; please import in smaller batches",importingBatch:"Importing {current}/{total}: {name}",batchAllSuccess:"Batch import done: {count} documents ({chunks} chunks)",batchPartial:"Import done: {success} succeeded, {fail} failed (first error: {error})",batchAllFailed:"All imports failed: {error}",docsTitle:'Documents in "{name}"',docsEmpty:"No documents imported yet",docChunkCount:"{count} chunks",docDeleteConfirmTitle:"Delete Document",docDeleteConfirm:'Delete document "{name}"? All its chunks will be removed from the knowledge base.',docDeleteSuccess:"Document deleted",searchTitle:"Test Search",searchScope:'Scope: "{name}"',searchQueryPlaceholder:"Enter a query, e.g. How to export data?",searchBtn:"Search",searching:"Searching...",searchTopKLabel:"Top K",searchThresholdLabel:"Threshold",searchHitCount:"{count} hits",searchNoHits:"No hits. Try lowering the similarity threshold.",searchFallbackHint:"All scores are below the threshold. Best matches for reference:",searchFailed:"Search failed: {error}",expandFull:"Expand",collapse:"Collapse",scoreLabel:"Score",opFailed:"Operation failed: {error}"},contextBubble:{labelSelection:"Selection",labelQuoted:"Quote",labelSkill:"Skill",labelMcp:"MCP",labelPage:"Page",labelFile:"File",labelKnowledge:"Knowledge",clickToExpand:"Click to expand",bubbleSkill:"{name} \u{1F9E9}",bubbleMcp:"{name} \u{1F50C}",bubblePage:"{title} \u{1F310}",bubbleKnowledge:"{name} \u{1F4DA} \xB7 {count} hits",bubbleKnowledgeMiss:"{name} \u{1F4DA} \xB7 no match",bubbleKnowledgeFailed:"{name} \u{1F4DA} \xB7 retrieval failed",bubbleKnowledgeSearching:"Searching knowledge base\u2026",kbHitToggle:"Click to expand/collapse",kbHitTruncated:"\u2702 Truncated \xB7 {total} chars total, first {kept} sent",kbHitTruncatedTitle:"Truncated to fit the context window; what is shown here is exactly what the model received",kbHitTruncatedBadge:"\u2702 {count} truncated"},configDialog:{exportTitle:"Export Settings",includeSecrets:"Include API keys",secretWarn:"\u26A0 Sensitive information; keep the file safe",exportDesc:"The exported file will contain all settings except Agent connection info. You can choose whether to include API keys.",export:"Export",importTitle:"Import Settings",mergeImport:"Merge import \u2014 only overwrite settings present in the file; keep the rest",replaceImport:"Full replace \u2014 clear current settings and use the file content",confirmImport:"Confirm Import",exportSuccess:"Settings exported",exportFailed:"Export failed: {error}",unknownTime:"Unknown",importSummary:"Exported at: {time}, containing {count} settings",invalidFileFormat:"Invalid file format",unrecognizedFormat:"Unrecognized settings format",unknownConfigKey:"Unknown setting key: {key}",importFailed:"Import failed: {error}",importParseFailed:"Import failed: cannot parse file format",importedCount:"Imported {count} settings"}};function rt(){if(typeof chrome>"u"||!chrome.i18n)return"zh";try{let e=chrome.i18n.getUILanguage();if(e&&e.startsWith("zh"))return"zh"}catch{}return"en"}var z="zh",V={zh:no,en:ao},Be=new Set;function lt(e,t){if(!e||!t)return;let o=t.split("."),n=e;for(let a of o){if(typeof n!="object"||!n)return;n=n[a]}return typeof n=="string"?n:void 0}function st(e,t){return!t||typeof e!="string"?e:e.replace(/\{(\w+)\}/g,(o,n)=>t[n]!==void 0&&t[n]!==null?String(t[n]):o)}function d(e,t){let o=lt(V[z],e);if(o!==void 0)return st(o,t);if(z!=="en"){let n=lt(V.en,e);if(n!==void 0)return st(n,t)}return e}function dt(e){return typeof e=="function"&&Be.add(e),()=>Be.delete(e)}function A(e,t){V[e]||(V[e]={}),V[e]=ut(V[e],t)}function ut(e,t){for(let o of Object.keys(t||{}))t[o]&&typeof t[o]=="object"&&!Array.isArray(t[o])?((!e[o]||typeof e[o]!="object")&&(e[o]={}),ut(e[o],t[o])):e[o]=t[o];return e}var ct=!1;async function pt(){if(typeof chrome>"u"||!chrome.storage||!chrome.storage.local)return z;try{let e=await chrome.storage.local.get("language");if(e.language&&V[e.language])z=e.language;else{let t=rt();z=t,chrome.storage.local.set({language:t}).catch(()=>{})}}catch{z=rt()}if(!ct){ct=!0;try{chrome.storage.onChanged.addListener((e,t)=>{if(t!=="local"||!e.language)return;let o=e.language.newValue;if(o&&V[o]&&o!==z){z=o;for(let n of Be)try{n(o)}catch{}}})}catch{}}return z}A("zh",{pageInteraction:{refHint:"ref \u7F16\u53F7\u4EC5\u672C\u6B21\u67E5\u8BE2\u6709\u6548\uFF0C\u9875\u9762\u5BFC\u822A/\u5237\u65B0\u6216\u5207\u6362 tab \u540E\u9700\u91CD\u65B0 query_elements",snapshotHeader:"\u53EF\u4EA4\u4E92\u5143\u7D20\u5FEB\u7167\uFF1A{count} \u4E2A\u5143\u7D20",snapshotTruncated:"\uFF08\u5171 {total} \u4E2A\uFF0C\u5DF2\u622A\u65AD\uFF0C\u8BF7\u7528 filterByText \u7F29\u5C0F\u8303\u56F4\uFF09",snapshotPageInfo:"\uFF08\u7B2C {page}/{totalPages} \u9875\uFF0C\u672C\u6B21\u8F93\u51FA {count} \u4E2A\uFF09",snapshotHasMore:"\u8FD8\u6709\u66F4\u591A\u5143\u7D20\uFF1A\u8C03\u7528 query_elements \u65F6\u5E26 page={next} \u67E5\u770B",snapshotPageOutOfRange:"page={page} \u8D85\u51FA\u8303\u56F4\uFF08\u5171 {totalPages} \u9875\uFF09",snapshotOverlayBlock:"[\u6253\u5F00\u5C42]",snapshotBodyBlock:"[\u9875\u9762\u4E3B\u4F53]",snapshotFooter:"\uFF08ref \u7F16\u53F7\u4EC5\u5F53\u524D\u5FEB\u7167\u6709\u6548\uFF1B\u9875\u9762\u53D8\u5316\u540E\u8BF7\u91CD\u65B0\u8C03\u7528 query_elements\uFF09",snapshotHeaderFrames:"\uFF08\u542B {n} \u4E2A iframe\uFF09",snapshotFramesLimited:"\uFF08\u90E8\u5206 iframe \u8D85\u51FA\u6570\u91CF/\u6DF1\u5EA6\u4E0A\u9650\uFF0C\u672A\u5C55\u5F00\uFF09",snapshotFrameBlock:"[frame #{index}{title}{hostSeg}]",snapshotFramePlaceholder:"iframe #{index}{title}",snapshotFrameUnreachable:"\uFF08\u5185\u5BB9\u4E0D\u53EF\u8BBF\u95EE\uFF09"}}),A("en",{pageInteraction:{refHint:"ref numbers are only valid for the current query; re-run query_elements after page navigation/refresh or tab switch",snapshotHeader:"Interactive elements snapshot: {count} element(s)",snapshotTruncated:" (of {total} total; truncated \u2014 narrow down with filterByText)",snapshotPageInfo:" (page {page}/{totalPages}, {count} shown)",snapshotHasMore:"More elements available: call query_elements with page={next}",snapshotPageOutOfRange:"page={page} is out of range (only {totalPages} page(s))",snapshotOverlayBlock:"[Open overlays]",snapshotBodyBlock:"[Page body]",snapshotFooter:"(ref numbers are valid only for this snapshot; re-run query_elements after the page changes)",snapshotHeaderFrames:" ({n} iframe(s))",snapshotFramesLimited:" (some iframes exceed count/depth limits; not expanded)",snapshotFrameBlock:"[frame #{index}{title}{hostSeg}]",snapshotFramePlaceholder:"iframe #{index}{title}",snapshotFrameUnreachable:" (content inaccessible)"}});function io(e){if(!e)return"";if(e==="about:srcdoc")return"srcdoc";if(e==="about:blank")return"blank";try{return new URL(e).hostname||""}catch{return""}}function _e(e,t){for(let o of e)o.t==="el"&&o.localRef!=null&&t.push(o),o.children&&o.children.length&&_e(o.children,t)}function ro(e,t,o){if(e.status==="hidden"||e.status==="off")return!1;let n=e.title?` "${e.title}"`:"",a;return a=e.status==="ok"&&e.frameIndex!=null?d("pageInteraction.snapshotFramePlaceholder",{index:e.frameIndex,title:n}):e.status==="unreachable"&&e.frameIndex!=null?d("pageInteraction.snapshotFramePlaceholder",{index:e.frameIndex,title:n})+d("pageInteraction.snapshotFrameUnreachable"):`iframe${n}`,a=" ".repeat(e.depth||0)+a,o.budget-=a.length+1,t.push(a),!0}function qe(e,t,o){if(!e)return!1;if(e.t==="frame")return ro(e,t,o);let n=[],a=!1;for(let i of e.children||[])qe(i,n,o)&&(a=!0);if(e.t==="el"){if(e.localRef!=null&&o.selected.has(e)){if(o.budget<=0)return o.truncated=!0,a;let i=e.role||"",r=e.name||"",l=e.attrs||"",s=e.depth+i.length+(r?r.length+2:0)+(l?l.length+1:0)+12;if(o.budget-s<0)return o.truncated=!0,a;let c=`${" ".repeat(e.depth)}${i}${r?` "${r}"`:""} [ref ${e.localRef}]${l?" "+l:""}`;return o.budget-=c.length+1,o.count+=1,t.push(c,...n),!0}return a?(t.push(...n),!0):!1}if(e.t==="container"){if(a){let i=`${" ".repeat(e.depth)}${e.role}${e.name?` "${e.name}"`:""}`;return o.budget-=i.length+1,t.push(i,...n),!0}return!1}return a?(t.push(...n),!0):!1}function mt(e,t,o){let n=[];if((e.overlayTrees||[]).length){for(let a of e.overlayTrees)qe(a,n,o);n.length&&t.push(d("pageInteraction.snapshotOverlayBlock"),...n,d("pageInteraction.snapshotBodyBlock"))}for(let a of e.bodyTree||[])qe(a,t,o)}function ht(e={}){let{frames:t=[],page:o=1,maxResults:n=100,maxChars:a=6e3,countOnly:i=!1,frameCount:r=0,framesLimited:l=0}=e||{},s=Number.isInteger(o)&&o>=1?o:1,c=Math.max(1,n),u=[];for(let C of t)_e(C.overlayTrees||[],u),_e(C.bodyTree||[],u);let p=u.length;if(i)return{success:!0,content:"",count:p,total:p,truncated:!1,hint:""};let m=Math.ceil(p/c),h=r>0?d("pageInteraction.snapshotHeaderFrames",{n:r}):"",g=l>0?d("pageInteraction.snapshotFramesLimited"):"";if(p>0&&s>m)return{success:!0,content:[d("pageInteraction.snapshotHeader",{count:p})+h+g,d("pageInteraction.snapshotPageOutOfRange",{page:s,totalPages:m}),d("pageInteraction.snapshotFooter")].join(`
50
- `),count:0,total:p,page:s,totalPages:m,hasMore:!1,truncated:!1,hint:""};let b=(s-1)*c,x=new Set(u.slice(b,b+c)),v=s<m,S={selected:x,budget:a,truncated:!1,count:0},I=[],O=t.find(C=>C.isTop)||t[0];O&&mt(O,I,S);for(let C of t.filter(W=>W!==O)){let W=[];if(mt(C,W,S),!W.length)continue;let de=" ".repeat(Math.max(0,(C.depth||1)-1)*2),ie=C.frameInfo&&C.frameInfo.title?` "${C.frameInfo.title}"`:"",j=io(C.frameInfo&&C.frameInfo.url);I.push(de+d("pageInteraction.snapshotFrameBlock",{index:C.frameIndex,title:ie,hostSeg:j?" \xB7 "+j:""}),...W.map(Oe=>de+" "+Oe))}let ae=m>1,G=d("pageInteraction.snapshotHeader",{count:ae?p:S.count})+h+g+(ae?d("pageInteraction.snapshotPageInfo",{page:s,totalPages:m,count:S.count}):"")+(S.truncated?d("pageInteraction.snapshotTruncated",{total:p}):"");return I.unshift(G),v&&I.push(d("pageInteraction.snapshotHasMore",{next:s+1})),I.push(d("pageInteraction.snapshotFooter")),{success:!0,content:I.join(`
51
- `),count:S.count,total:p,page:s,totalPages:m,hasMore:v,truncated:S.truncated,hint:v?d("pageInteraction.snapshotHasMore",{next:s+1}):d("pageInteraction.refHint")}}function P(e,t=document,o=5,n=0){if(n>o)return null;try{if(t.querySelectorAll)for(let i of t.querySelectorAll("*")){if(i.shadowRoot){let r=P(e,i.shadowRoot,o,n+1);if(r)return r}if(i.tagName==="IFRAME"||i.tagName==="FRAME")try{let r=i.contentDocument||i.contentWindow?.document;if(r){let l=P(e,r,o,n+1);if(l)return l}}catch{}}let a=t.querySelector?.(e);if(a)return a}catch{}return null}function te(e,t=document,o=5,n=0,a=new Set){if(n>o)return[];try{t.querySelectorAll&&(t.querySelectorAll(e).forEach(i=>{a.add(i)}),t.querySelectorAll("*").forEach(i=>{if(i.shadowRoot&&te(e,i.shadowRoot,o,n+1,a),i.tagName==="IFRAME"||i.tagName==="FRAME")try{let r=i.contentDocument||i.contentWindow?.document;r&&te(e,r,o,n+1,a)}catch{}}))}catch{}return Array.from(a)}function J(e=document,t=5,o=0){if(o>t)return{text:"",range:null};try{let n=e.getSelection?.();if(n&&!n.isCollapsed&&n.rangeCount>0){let a=n.toString().trim();if(a)return{text:a,range:n.getRangeAt(0),depth:o,source:"shadow"}}if(e.querySelectorAll){for(let a of e.querySelectorAll("*"))if(a.shadowRoot){let i=J(a.shadowRoot,t,o+1);if(i.text)return i}}}catch{}return{text:"",range:null}}function ye(e=document,t=5,o=0,n=new Set){if(o>t||n.has(e))return"";n.add(e);let a="";try{e.body?a+=e.body.innerText||"":e instanceof ShadowRoot&&(a+=e.textContent||""),e.querySelectorAll&&e.querySelectorAll("*").forEach(i=>{if(i.shadowRoot&&(a+=`
52
- `+ye(i.shadowRoot,t,o+1,n)),i.tagName==="IFRAME"||i.tagName==="FRAME")try{let r=i.contentDocument||i.contentWindow?.document;r&&r.body&&(a+=`
53
- `+ye(r,t,o+1,n))}catch{}})}catch{}return a.trim().replace(/\n{3,}/g,`
49
+ 2. Step 2`,existingResources:"Existing resource files",skillNameRequired:"Please enter the Skill name",skillMarkdownRequired:"Please enter the SKILL.md content",agentSkillSaved:'Agent Skill "{name}" saved successfully',saveFailedShort:"Save failed",saveFailed:"Save failed: {error}",viewSkillTitle:"View Skill: {name}",importSkillTitle:"Import Skill",importBtn:"Import",jsonImport:"JSON Import",newAuthoring:"New Authoring",zipPackage:"Zip",urlImport:"URL Import",jsonImportDesc:"Import a Workflow Skill in JSON format (deterministic automated flow)",clickOrDragJson:"Click to select a JSON file or drag it here",jsonFileHint:"Supports .json Workflow Skill definition files",markdownImportDesc:"Write SKILL.md content directly to create an Agent Skill (AI capability extension)",zipImportDesc:"Import a Zip archive containing SKILL.md, with optional scripts/templates/assets resources",clickOrDragZip:"Click to select a Zip file or drag it here",zipFileHint:"The Zip must contain a SKILL.md file; optional scripts/ templates/ assets/ subdirectories",urlImportDesc:"Download a Skill Zip from a remote URL and import automatically",downloadUrl:"Download URL",selectJsonFile:"Please select a JSON file",workflowSkillImported:'Workflow Skill "{name}" imported successfully',agentSkillCreated:'Agent Skill "{name}" created successfully',createFailedShort:"Create failed",selectZipFile:"Please select a Zip file",fileTooLarge:"File too large; max 50MB supported",fileReadFailed:"File read failed",agentSkillImported:'Agent Skill "{name}" imported successfully',urlRequired:"Please enter a URL",importFailed:"Import failed: {error}",searchMcpPlaceholder:"Search MCP servers...",searchSkillPlaceholder:"Search skills...",filterAll:"All",filterEnabled:"Enabled",filterDisabled:"Disabled",noMatchResult:"No matching results"},memoryPanel:{tabTitle:"Memory",title:"Memory Vectors",enabled:"Enabled",disabled:"Disabled",statusTitle:"Vector index status",statusLoading:"Loading\u2026",statusOffline:"Agent is not connected, vector status unavailable",statusFail:"Failed to read vector status",statusOldAgent:"This agent version has no such status endpoint \u2014 restart the agent",statusDetail:"Response",statusIndexed:"Indexed {indexed} of {total}",statusStored:"Stored vector fingerprint",statusCurrent:"Current config fingerprint",statusTier:"Active tier",statusStale:"Stale: model changed without rebuild",statusFresh:"Matches current config",staleHint:"Old vectors are incomparable with the new config, so semantic recall degrades silently. Click \u201CRebuild vector index\u201D (save unsaved edits first).",modeLabel:"Embedding source",modeRemote:"Remote service (OpenAI-compatible API)",modeLocal:"Local model",baseUrlLabel:"Endpoint",baseUrlPlaceholder:"https://api.openai.com/v1",modelLabel:"Model name",modelPlaceholder:"BAAI/bge-m3",apiKeyLabel:"API Key",apiKeyPlaceholder:"Leave blank to keep the stored key",apiKeyClearBtn:"Clear stored key",apiKeyClearConfirm:"Remote semantic recall stops (falls back to keywords) until a new key is saved. Clear the stored key?",apiKeyCleared:"Stored API key cleared",apiKeyClearFail:"Failed to clear key: {error}",configNotLoaded:"Config failed to load. Refresh the panel before saving so the agent\u2019s stored settings are not overwritten with blanks",dimsLabel:"Vector dimensions (blank is fine, detected on test)",prefixLabel:"Query prefix (optional)",localNotice:"Local mode needs no connectivity test: save, then rebuild the vector index (the first run downloads the model and may take tens of minutes). Embeddings are silently truncated at 512 tokens, so only the head of an over-long entry is indexed.",testBtn:"Test connectivity",testRunning:"Testing\u2026",testOk:"OK: {model} returns {dims} dimensions",testFail:"Test failed: {error}",scopeHint:"Clicking the bottom \u201CSave\u201D also writes this tab\u2019s config into the agent service config.json; when the agent is offline this item is skipped and only extension settings are saved",saveSkippedOffline:"Agent not connected \u2014 memory vector config was not saved (only extension settings saved)",saveSuccess:"Memory vector config saved",saveFail:"Save failed: {error}",toggleOnSaved:"Semantic vector recall enabled",toggleOffSaved:"Semantic vector recall disabled - recall falls back to keywords",toggleFail:"Failed to toggle: {error}",reindexBtn:"Rebuild vector index",reindexConfirm:"Rebuilding recomputes vectors for every memory with the current config. On local mode 41 entries measured about 23 minutes (remote about 2). Keep this page open. Continue?",reindexRunning:"Rebuilding, please keep this page open\u2026",reindexDone:"Rebuild done: indexed {indexed} of {total}",reindexBatchFail:" ({count} batches failed, see agent logs)",reindexOverWindow:" ({count} entries exceed the {window}-token window, their tails are not indexed)",reindexSkipped:"Rebuild skipped: vector tier is disabled",reindexFail:"Rebuild failed: {error}",gateAgentOffTitle:"Agent not connected",gateAgentOffBody:'Memory vector config is provided by the local agent. Connect an agent in the "Agent" tab first, then come back here.',gateRagTitle:"Local model dependency missing",gateRagMissing:'Local models require the RAG dependency. Install it in the "Extensions" panel first, then come back here.',goToAgentTab:'Go to "Agent" tab',goToToolboxTab:'Go to "Extensions" tab'},memoryEntries:{title:"Memory Entries",refreshBtn:"Refresh",searchPlaceholder:"Search content or tags\u2026",filterAll:"All types",filterFact:"Facts",filterSummary:"Summaries",sortCreatedDesc:"Created (newest first)",sortImportanceDesc:"Importance (high \u2192 low)",sortValueDesc:"Value (high \u2192 low)",sortValueAsc:"Value (low \u2192 high)",count:"{shown} of {total}",loading:"Loading\u2026",empty:"No memories yet",noMatch:"No entries match the filter",offline:"Agent not connected - memory entries unavailable",unsupported:"This agent version does not support memory entry management - upgrade and restart the agent",loadFail:"Failed to load memory entries: {error}",importanceShort:"Imp",valueShort:"Value",createdLabel:"Created",lastAccessLabel:"Last accessed",neverAccessed:"never",accessCount:"{count} accesses",tagsLabel:"Tags",editBtn:"Edit",deleteBtn:"Delete",editTitle:"Edit memory entry",typeLabel:"Type",contentLabel:"Content",importanceLabel:"Importance (1-10)",tagsPlaceholder:"comma-separated, e.g. environment, preference",saveBtn:"Save",cancelBtn:"Cancel",contentEmpty:"Content cannot be empty",saved:"Memory updated",saveFail:"Update failed: {error}",deleteConfirm:"Delete this memory? It cannot be undone, and its vector cache entry is dropped as well.",deleted:"Memory deleted",deleteFail:"Delete failed: {error}",candidatesHint:"{count} low-value memories are suggested for removal (value below 10)",compactBtn:"Compact now",compactConfirm:"Compacting deletes {count} memories with value below {threshold}. This cannot be undone. Continue?",compactDone:"Compact done: removed {facts} facts and {summaries} summaries",compactFail:"Compact failed: {error}"},knowledge:{tabTitle:"Knowledge",gateAgentOffTitle:"Agent not connected",gateAgentOffDesc:'Knowledge base is provided by the local agent. Connect an agent in the "Agent" tab first, then come back here.',gateRagOffTitle:"Knowledge base feature is disabled",gateRagOffDesc:'Turn on the "Knowledge Retrieval" master switch above to create and manage knowledge bases.',gateRagUnavailableTitle:"Agent capability not ready",gateRagUnavailableDesc:"RAG dependencies are not installed or the Node version is unsupported (Node 22+ required). See the install guide below.",goToAgentTab:'Go to "Agent" tab',goToToolboxTab:'Go to "Extensions" tab',enableNow:"Enable Now",title:"Knowledge Bases",createBtn:"+ New Knowledge Base",searchPlaceholder:"Search knowledge bases...",emptyTitle:"No knowledge base yet",emptyDesc:'Click "New Knowledge Base" to create one, then import documents to get started.',loadFailed:"Failed to load: {error}",retry:"Retry",statsSummary:"{docs} docs \xB7 {chunks} chunks",modeLocal:"Local model",modeRemote:"Remote service",actionEdit:"Edit",actionIngest:"Import",actionSearch:"Test Search",actionDocs:"Docs",actionDelete:"Delete",actionEnable:"Enable",actionDisable:"Disable",badgeDisabled:"Disabled",enableSuccess:'Knowledge base "{name}" enabled',disableSuccess:'Knowledge base "{name}" disabled',createTitle:"New Knowledge Base",nameLabel:"Name",namePlaceholder:"e.g. Product Docs",descLabel:"Description (optional)",descPlaceholder:"Briefly describe what this knowledge base contains",createConfirm:"Create",creating:"Creating...",createSuccess:'Knowledge base "{name}" created',nameRequired:"Please enter a name",editTitle:"Edit Knowledge Base",editConfirm:"Save",saving:"Saving...",editSuccess:"Knowledge base updated",vectorSectionTitle:"Embedding model",vectorModeLocal:"Local model (bundled BGE Chinese model)",vectorModeRemote:"Remote service (OpenAI-compatible API)",vectorModeLocalHint:"Use the agent-bundled BGE Chinese model. No extra config needed; the model file downloads on first import.",vectorModeRemoteHint:"Call a remote OpenAI-compatible embedding service (SiliconFlow, Zhipu, OpenAI, etc.).",vectorEndpointLabel:"Endpoint (Base URL with version segment)",vectorEndpointPlaceholder:"e.g. https://api.siliconflow.cn/v1",vectorApiKeyLabel:"API Key",vectorApiKeyPlaceholder:"Paste API key",vectorApiKeyKeep:"Leave empty to keep the saved key",vectorModelLabel:"Model name",vectorModelPlaceholder:"e.g. BAAI/bge-m3",vectorDimsLabel:"Dimensions (optional, auto-detected on test)",vectorDimsPlaceholder:"Auto",vectorTestBtn:"Test Connection",vectorTesting:"Testing...",vectorTestOk:"Connected: {model} ({dims} dims)",vectorDimsFilled:"Dimensions auto-filled: {dims}",vectorTestFailed:"Test failed: {error}",vectorEndpointRequired:"Remote endpoint is required",vectorModelRequired:"Model name is required",rebuildConfirmTitle:"Change Embedding Config",rebuildConfirm:"Changing the embedding model or chunk settings requires rebuilding the index (all documents will be re-embedded). The old index stays searchable during the rebuild and switches automatically when done. Continue?",rebuildStarted:"Index rebuild started, refreshing when complete...",progressRebuilding:"Rebuilding index {current}/{total} documents\u2026",rebuildDone:"Index rebuild complete",rebuildFailed:"Index rebuild failed: {error}",deleteConfirmTitle:"Delete Knowledge Base",deleteConfirm:'Delete "{name}"? Its {docs} documents and {chunks} chunks will be removed permanently.',deleteSuccess:"Knowledge base deleted",ingestTitle:'Import documents into "{name}"',tabFile:"File",tabText:"Text",tabUrl:"URL",dropHint:"Drag & drop files here, or click to choose (multiple allowed)",dropSupported:"Supports txt / md / pdf / docx / xlsx / html, up to 50MB per file, 20 files per batch",selectedFile:"Selected: {name}",selectedCount:"Selected {count} file(s) (max {max} per batch)",removeFile:"Remove",textContentLabel:"Text content",textContentPlaceholder:"Paste the text to import here...",textNameLabel:"Document name (optional)",textNamePlaceholder:"Leave empty to auto-name",urlLabel:"Web page URL",urlPlaceholder:"https://example.com/page",chunkSettingsTitle:"Chunk settings",chunkSizeLabel:"Chunk size (chars)",chunkOverlapLabel:"Overlap (chars)",ingestConfirm:"Start Import",ingesting:"Parsing and embedding. The first import may download the model, please wait...",progressParsing:"Parsing document\u2026",progressChunking:"Splitting into chunks\u2026",progressEmbedding:"Embedding chunks {current}/{total}\u2026",progressStoring:"Writing to index\u2026",ingestSuccess:"Imported: {name} ({chunks} chunks)",ingestFailed:"Import failed: {error}",fileRequired:"Please choose a file first",contentRequired:"Please enter the text content",urlRequired:"Please enter the URL",fileTooLarge:"File too large, 50MB max",fileTypeUnsupported:"Unsupported file type: {name}",maxBatchFiles:"Up to {max} files per batch; please import in smaller batches",importingBatch:"Importing {current}/{total}: {name}",batchAllSuccess:"Batch import done: {count} documents ({chunks} chunks)",batchPartial:"Import done: {success} succeeded, {fail} failed (first error: {error})",batchAllFailed:"All imports failed: {error}",docsTitle:'Documents in "{name}"',docsEmpty:"No documents imported yet",docChunkCount:"{count} chunks",docDeleteConfirmTitle:"Delete Document",docDeleteConfirm:'Delete document "{name}"? All its chunks will be removed from the knowledge base.',docDeleteSuccess:"Document deleted",searchTitle:"Test Search",searchScope:'Scope: "{name}"',searchQueryPlaceholder:"Enter a query, e.g. How to export data?",searchBtn:"Search",searching:"Searching...",searchTopKLabel:"Top K",searchThresholdLabel:"Threshold",searchHitCount:"{count} hits",searchNoHits:"No hits. Try lowering the similarity threshold.",searchFallbackHint:"All scores are below the threshold. Best matches for reference:",searchFailed:"Search failed: {error}",expandFull:"Expand",collapse:"Collapse",scoreLabel:"Score",opFailed:"Operation failed: {error}"},contextBubble:{labelSelection:"Selection",labelQuoted:"Quote",labelSkill:"Skill",labelMcp:"MCP",labelPage:"Page",labelFile:"File",labelKnowledge:"Knowledge",clickToExpand:"Click to expand",bubbleSkill:"{name} \u{1F9E9}",bubbleMcp:"{name} \u{1F50C}",bubblePage:"{title} \u{1F310}",bubbleKnowledge:"{name} \u{1F4DA} \xB7 {count} hits",bubbleKnowledgeMiss:"{name} \u{1F4DA} \xB7 no match",bubbleKnowledgeFailed:"{name} \u{1F4DA} \xB7 retrieval failed",bubbleKnowledgeSearching:"Searching knowledge base\u2026",kbHitToggle:"Click to expand/collapse",kbHitTruncated:"\u2702 Truncated \xB7 {total} chars total, first {kept} sent",kbHitTruncatedTitle:"Truncated to fit the context window; what is shown here is exactly what the model received",kbHitTruncatedBadge:"\u2702 {count} truncated"},configDialog:{exportTitle:"Export Settings",includeSecrets:"Include API keys",secretWarn:"\u26A0 Sensitive information; keep the file safe",exportDesc:"The exported file will contain all settings except Agent connection info. You can choose whether to include API keys.",export:"Export",importTitle:"Import Settings",mergeImport:"Merge import \u2014 only overwrite settings present in the file; keep the rest",replaceImport:"Full replace \u2014 clear current settings and use the file content",confirmImport:"Confirm Import",exportSuccess:"Settings exported",exportFailed:"Export failed: {error}",unknownTime:"Unknown",importSummary:"Exported at: {time}, containing {count} settings",invalidFileFormat:"Invalid file format",unrecognizedFormat:"Unrecognized settings format",unknownConfigKey:"Unknown setting key: {key}",importFailed:"Import failed: {error}",importParseFailed:"Import failed: cannot parse file format",importedCount:"Imported {count} settings"}};function mt(){if(typeof chrome>"u"||!chrome.i18n)return"zh";try{let e=chrome.i18n.getUILanguage();if(e&&e.startsWith("zh"))return"zh"}catch{}return"en"}var z="zh",Y={zh:po,en:mo},We=new Set;function ht(e,t){if(!e||!t)return;let o=t.split("."),n=e;for(let a of o){if(typeof n!="object"||!n)return;n=n[a]}return typeof n=="string"?n:void 0}function gt(e,t){return!t||typeof e!="string"?e:e.replace(/\{(\w+)\}/g,(o,n)=>t[n]!==void 0&&t[n]!==null?String(t[n]):o)}function d(e,t){let o=ht(Y[z],e);if(o!==void 0)return gt(o,t);if(z!=="en"){let n=ht(Y.en,e);if(n!==void 0)return gt(n,t)}return e}function bt(e){return typeof e=="function"&&We.add(e),()=>We.delete(e)}function A(e,t){Y[e]||(Y[e]={}),Y[e]=yt(Y[e],t)}function yt(e,t){for(let o of Object.keys(t||{}))t[o]&&typeof t[o]=="object"&&!Array.isArray(t[o])?((!e[o]||typeof e[o]!="object")&&(e[o]={}),yt(e[o],t[o])):e[o]=t[o];return e}var ft=!1;async function wt(){if(typeof chrome>"u"||!chrome.storage||!chrome.storage.local)return z;try{let e=await chrome.storage.local.get("language");if(e.language&&Y[e.language])z=e.language;else{let t=mt();z=t,chrome.storage.local.set({language:t}).catch(()=>{})}}catch{z=mt()}if(!ft){ft=!0;try{chrome.storage.onChanged.addListener((e,t)=>{if(t!=="local"||!e.language)return;let o=e.language.newValue;if(o&&Y[o]&&o!==z){z=o;for(let n of We)try{n(o)}catch{}}})}catch{}}return z}A("zh",{pageInteraction:{refHint:"ref \u7F16\u53F7\u4EC5\u672C\u6B21\u67E5\u8BE2\u6709\u6548\uFF0C\u9875\u9762\u5BFC\u822A/\u5237\u65B0\u6216\u5207\u6362 tab \u540E\u9700\u91CD\u65B0 query_elements",snapshotHeader:"\u53EF\u4EA4\u4E92\u5143\u7D20\u5FEB\u7167\uFF1A{count} \u4E2A\u5143\u7D20",snapshotTruncated:"\uFF08\u5171 {total} \u4E2A\uFF0C\u5DF2\u622A\u65AD\uFF0C\u8BF7\u7528 filterByText \u7F29\u5C0F\u8303\u56F4\uFF09",snapshotPageInfo:"\uFF08\u7B2C {page}/{totalPages} \u9875\uFF0C\u672C\u6B21\u8F93\u51FA {count} \u4E2A\uFF09",snapshotHasMore:"\u8FD8\u6709\u66F4\u591A\u5143\u7D20\uFF1A\u8C03\u7528 query_elements \u65F6\u5E26 page={next} \u67E5\u770B",snapshotPageOutOfRange:"page={page} \u8D85\u51FA\u8303\u56F4\uFF08\u5171 {totalPages} \u9875\uFF09",snapshotOverlayBlock:"[\u6253\u5F00\u5C42]",snapshotBodyBlock:"[\u9875\u9762\u4E3B\u4F53]",snapshotFooter:"\uFF08ref \u7F16\u53F7\u4EC5\u5F53\u524D\u5FEB\u7167\u6709\u6548\uFF1B\u9875\u9762\u53D8\u5316\u540E\u8BF7\u91CD\u65B0\u8C03\u7528 query_elements\uFF09",snapshotHeaderFrames:"\uFF08\u542B {n} \u4E2A iframe\uFF09",snapshotFramesLimited:"\uFF08\u90E8\u5206 iframe \u8D85\u51FA\u6570\u91CF/\u6DF1\u5EA6\u4E0A\u9650\uFF0C\u672A\u5C55\u5F00\uFF09",snapshotFrameBlock:"[frame #{index}{title}{hostSeg}]",snapshotFramePlaceholder:"iframe #{index}{title}",snapshotFrameUnreachable:"\uFF08\u5185\u5BB9\u4E0D\u53EF\u8BBF\u95EE\uFF09"}}),A("en",{pageInteraction:{refHint:"ref numbers are only valid for the current query; re-run query_elements after page navigation/refresh or tab switch",snapshotHeader:"Interactive elements snapshot: {count} element(s)",snapshotTruncated:" (of {total} total; truncated \u2014 narrow down with filterByText)",snapshotPageInfo:" (page {page}/{totalPages}, {count} shown)",snapshotHasMore:"More elements available: call query_elements with page={next}",snapshotPageOutOfRange:"page={page} is out of range (only {totalPages} page(s))",snapshotOverlayBlock:"[Open overlays]",snapshotBodyBlock:"[Page body]",snapshotFooter:"(ref numbers are valid only for this snapshot; re-run query_elements after the page changes)",snapshotHeaderFrames:" ({n} iframe(s))",snapshotFramesLimited:" (some iframes exceed count/depth limits; not expanded)",snapshotFrameBlock:"[frame #{index}{title}{hostSeg}]",snapshotFramePlaceholder:"iframe #{index}{title}",snapshotFrameUnreachable:" (content inaccessible)"}});function ho(e){if(!e)return"";if(e==="about:srcdoc")return"srcdoc";if(e==="about:blank")return"blank";try{return new URL(e).hostname||""}catch{return""}}function Ve(e,t){for(let o of e)o.t==="el"&&o.localRef!=null&&t.push(o),o.children&&o.children.length&&Ve(o.children,t)}function go(e,t,o){if(e.status==="hidden"||e.status==="off")return!1;let n=e.title?` "${e.title}"`:"",a;return a=e.status==="ok"&&e.frameIndex!=null?d("pageInteraction.snapshotFramePlaceholder",{index:e.frameIndex,title:n}):e.status==="unreachable"&&e.frameIndex!=null?d("pageInteraction.snapshotFramePlaceholder",{index:e.frameIndex,title:n})+d("pageInteraction.snapshotFrameUnreachable"):`iframe${n}`,a=" ".repeat(e.depth||0)+a,o.budget-=a.length+1,t.push(a),!0}function je(e,t,o){if(!e)return!1;if(e.t==="frame")return go(e,t,o);let n=[],a=!1;for(let i of e.children||[])je(i,n,o)&&(a=!0);if(e.t==="el"){if(e.localRef!=null&&o.selected.has(e)){if(o.budget<=0)return o.truncated=!0,a;let i=e.role||"",r=e.name||"",l=e.attrs||"",s=e.depth+i.length+(r?r.length+2:0)+(l?l.length+1:0)+12;if(o.budget-s<0)return o.truncated=!0,a;let c=`${" ".repeat(e.depth)}${i}${r?` "${r}"`:""} [ref ${e.localRef}]${l?" "+l:""}`;return o.budget-=c.length+1,o.count+=1,t.push(c,...n),!0}return a?(t.push(...n),!0):!1}if(e.t==="container"){if(a){let i=`${" ".repeat(e.depth)}${e.role}${e.name?` "${e.name}"`:""}`;return o.budget-=i.length+1,t.push(i,...n),!0}return!1}return a?(t.push(...n),!0):!1}function xt(e,t,o){let n=[];if((e.overlayTrees||[]).length){for(let a of e.overlayTrees)je(a,n,o);n.length&&t.push(d("pageInteraction.snapshotOverlayBlock"),...n,d("pageInteraction.snapshotBodyBlock"))}for(let a of e.bodyTree||[])je(a,t,o)}function vt(e={}){let{frames:t=[],page:o=1,maxResults:n=100,maxChars:a=6e3,countOnly:i=!1,frameCount:r=0,framesLimited:l=0}=e||{},s=Number.isInteger(o)&&o>=1?o:1,c=Math.max(1,n),u=[];for(let C of t)Ve(C.overlayTrees||[],u),Ve(C.bodyTree||[],u);let p=u.length;if(i)return{success:!0,content:"",count:p,total:p,truncated:!1,hint:""};let m=Math.ceil(p/c),h=r>0?d("pageInteraction.snapshotHeaderFrames",{n:r}):"",g=l>0?d("pageInteraction.snapshotFramesLimited"):"";if(p>0&&s>m)return{success:!0,content:[d("pageInteraction.snapshotHeader",{count:p})+h+g,d("pageInteraction.snapshotPageOutOfRange",{page:s,totalPages:m}),d("pageInteraction.snapshotFooter")].join(`
50
+ `),count:0,total:p,page:s,totalPages:m,hasMore:!1,truncated:!1,hint:""};let y=(s-1)*c,v=new Set(u.slice(y,y+c)),k=s<m,S={selected:v,budget:a,truncated:!1,count:0},I=[],B=t.find(C=>C.isTop)||t[0];B&&xt(B,I,S);for(let C of t.filter(j=>j!==B)){let j=[];if(xt(C,j,S),!j.length)continue;let me=" ".repeat(Math.max(0,(C.depth||1)-1)*2),le=C.frameInfo&&C.frameInfo.title?` "${C.frameInfo.title}"`:"",Q=ho(C.frameInfo&&C.frameInfo.url);I.push(me+d("pageInteraction.snapshotFrameBlock",{index:C.frameIndex,title:le,hostSeg:Q?" \xB7 "+Q:""}),...j.map(Ge=>me+" "+Ge))}let re=m>1,V=d("pageInteraction.snapshotHeader",{count:re?p:S.count})+h+g+(re?d("pageInteraction.snapshotPageInfo",{page:s,totalPages:m,count:S.count}):"")+(S.truncated?d("pageInteraction.snapshotTruncated",{total:p}):"");return I.unshift(V),k&&I.push(d("pageInteraction.snapshotHasMore",{next:s+1})),I.push(d("pageInteraction.snapshotFooter")),{success:!0,content:I.join(`
51
+ `),count:S.count,total:p,page:s,totalPages:m,hasMore:k,truncated:S.truncated,hint:k?d("pageInteraction.snapshotHasMore",{next:s+1}):d("pageInteraction.refHint")}}function P(e,t=document,o=5,n=0){if(n>o)return null;try{if(t.querySelectorAll)for(let i of t.querySelectorAll("*")){if(i.shadowRoot){let r=P(e,i.shadowRoot,o,n+1);if(r)return r}if(i.tagName==="IFRAME"||i.tagName==="FRAME")try{let r=i.contentDocument||i.contentWindow?.document;if(r){let l=P(e,r,o,n+1);if(l)return l}}catch{}}let a=t.querySelector?.(e);if(a)return a}catch{}return null}function ne(e,t=document,o=5,n=0,a=new Set){if(n>o)return[];try{t.querySelectorAll&&(t.querySelectorAll(e).forEach(i=>{a.add(i)}),t.querySelectorAll("*").forEach(i=>{if(i.shadowRoot&&ne(e,i.shadowRoot,o,n+1,a),i.tagName==="IFRAME"||i.tagName==="FRAME")try{let r=i.contentDocument||i.contentWindow?.document;r&&ne(e,r,o,n+1,a)}catch{}}))}catch{}return Array.from(a)}function te(e=document,t=5,o=0){if(o>t)return{text:"",range:null};try{let n=e.getSelection?.();if(n&&!n.isCollapsed&&n.rangeCount>0){let a=n.toString().trim();if(a)return{text:a,range:n.getRangeAt(0),depth:o,source:"shadow"}}if(e.querySelectorAll){for(let a of e.querySelectorAll("*"))if(a.shadowRoot){let i=te(a.shadowRoot,t,o+1);if(i.text)return i}}}catch{}return{text:"",range:null}}function ke(e=document,t=5,o=0,n=new Set){if(o>t||n.has(e))return"";n.add(e);let a="";try{e.body?a+=e.body.innerText||"":e instanceof ShadowRoot&&(a+=e.textContent||""),e.querySelectorAll&&e.querySelectorAll("*").forEach(i=>{if(i.shadowRoot&&(a+=`
52
+ `+ke(i.shadowRoot,t,o+1,n)),i.tagName==="IFRAME"||i.tagName==="FRAME")try{let r=i.contentDocument||i.contentWindow?.document;r&&r.body&&(a+=`
53
+ `+ke(r,t,o+1,n))}catch{}})}catch{}return a.trim().replace(/\n{3,}/g,`
54
54
 
55
- `)}function Pe(e=document,t=5,o=0,n=new Set){if(o>t||n.has(e))return"";n.add(e);let a="";try{e.documentElement?a=e.documentElement.outerHTML:e instanceof ShadowRoot&&(a=e.innerHTML||"");let i=[];e.querySelectorAll&&e.querySelectorAll("*").forEach(r=>{if(r.shadowRoot){let l=Pe(r.shadowRoot,t,o+1,n);l&&i.push(`<!-- shadow-root of ${r.tagName} -->
56
- ${l}`)}if(r.tagName==="IFRAME"||r.tagName==="FRAME")try{let l=r.contentDocument||r.contentWindow?.document;if(l&&l.documentElement){let s=Pe(l,t,o+1,n);s&&i.push(`<!-- iframe content -->
55
+ `)}function De(e=document,t=5,o=0,n=new Set){if(o>t||n.has(e))return"";n.add(e);let a="";try{e.documentElement?a=e.documentElement.outerHTML:e instanceof ShadowRoot&&(a=e.innerHTML||"");let i=[];e.querySelectorAll&&e.querySelectorAll("*").forEach(r=>{if(r.shadowRoot){let l=De(r.shadowRoot,t,o+1,n);l&&i.push(`<!-- shadow-root of ${r.tagName} -->
56
+ ${l}`)}if(r.tagName==="IFRAME"||r.tagName==="FRAME")try{let l=r.contentDocument||r.contentWindow?.document;if(l&&l.documentElement){let s=De(l,t,o+1,n);s&&i.push(`<!-- iframe content -->
57
57
  ${s}`)}}catch{}}),i.length>0&&(a+=`
58
58
  <!-- Shadow DOM and iframe content -->
59
59
  `+i.join(`
60
- `))}catch{}return a}function we(e){if(!e)return{x:window.innerWidth/2,y:window.innerHeight/2};let t;try{t=e.getBoundingClientRect()}catch{t={left:0,top:0,width:0,height:0}}if(!t||t.width===0&&t.height===0){let a=e.commonAncestorContainer;if(a){let i=a.nodeType===Node.TEXT_NODE?a.parentElement:a;i&&i.getBoundingClientRect&&(t=i.getBoundingClientRect())}}let o=t.left+t.width/2,n=t.top;if(window.top!==window){let a=e.startContainer.ownerDocument;for(;a&&a!==window.top.document;){let i=a.defaultView?.frameElement;if(!i)break;let r=i.getBoundingClientRect();o+=r.left,n+=r.top,a=i.ownerDocument}}return{x:o,y:n}}function We(e,t=document,o=5,n=0,a=new Set){if(n>o||a.has(t))return a;try{let i=()=>e();t.addEventListener?.("selectionchange",i),a.add({root:t,listener:i}),t.querySelectorAll&&t.querySelectorAll("*").forEach(r=>{r.shadowRoot&&We(e,r.shadowRoot,o,n+1,a)})}catch{}return a}function lo(e){for(let{root:t,listener:o}of e)try{t.removeEventListener?.("selectionchange",o)}catch{}e.clear()}function xe(e){if(e.id)return`#${e.id}`;let t=[],o=e;for(;o&&o!==document.body&&o!==document.documentElement;){let n=o.tagName.toLowerCase();if(o.id){n=`#${o.id}`,t.unshift(n);break}if(o.className&&typeof o.className=="string"){let i=o.className.trim().split(/\s+/).filter(r=>r);i.length>0&&(n+="."+i[0])}let a=o.parentElement;if(a){let i=Array.from(a.children).filter(r=>r.tagName===o.tagName);if(i.length>1){let r=i.indexOf(o)+1;n+=`:nth-child(${r})`}}t.unshift(n),o=a}return t.join(" > ")}function me(e){if(e.id)return`#${e.id}`;let t=e.tagName.toLowerCase();if(e.className){let o=e.className.split(" ").filter(n=>n).slice(0,2);o.length&&(t+="."+o.join("."))}return t}function gt(e,t,o=20){if(!e||!t)return 0;let n=t.global?t:new RegExp(t.source,t.flags+"g"),a=[],i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1),r=0,l;for(;(l=i.nextNode())&&r<o;){let c=l.parentNode;if(!c||c.nodeType!==1)continue;let u=c.tagName;if(u==="SCRIPT"||u==="STYLE"||u==="TITLE"||u==="TEXTAREA")continue;let p=l.nodeValue;if(!p)continue;let m=[],h;for(n.lastIndex=0;(h=n.exec(p))!==null&&r+m.length<o;){if(h[0].length===0){n.lastIndex++;continue}m.push({start:h.index,end:h.index+h[0].length}),h.index===n.lastIndex&&n.lastIndex++}m.length>0&&(a.push({node:l,spans:m}),r+=m.length)}let s=0;for(let{node:c,spans:u}of a)for(let p=u.length-1;p>=0;p--){let{start:m,end:h}=u[p];try{let g=document.createRange();g.setStart(c,m),g.setEnd(c,h);let b=document.createElement("span");b.className="ai-helper-search-highlight",g.surroundContents(b),s++}catch{}}return s}function je(){document.querySelectorAll(".ai-helper-highlight, .ai-helper-search-highlight").forEach(t=>{let o=t.parentNode;if(o&&o.insertBefore&&o.removeChild){for(;t.firstChild;)o.insertBefore(t.firstChild,t);o.removeChild(t),typeof o.normalize=="function"&&o.normalize()}});let e=document.getElementById("ai-helper-highlight-style");e&&e.remove()}function Y(){let e=document.body,t=document.querySelectorAll('button, input, a[href], dialog, [role="dialog"], [role="alert"]').length;return`${location.href}|${e?e.childElementCount:0}|${t}`}async function X(e,t=300,o=2e3){let n=Date.now();await new Promise(u=>setTimeout(u,Math.min(t,o)));let a=e.split("|")[0],i=location.href!==a,r=!1,l=e,s=0;for(;Date.now()-n<o;){let u=Y();if(u===l?s++:(r=!0,s=0,l=u),s>=2)break;await new Promise(p=>setTimeout(p,100))}i=location.href!==a;let c={changed:i||r,urlChanged:i,domChanged:r,waitedMs:Date.now()-n};return i&&(c.newUrl=location.href),c}function Pt(e){return e.isContentEditable||e.getAttribute("contenteditable")==="true"}function Re(e,t){let o=e.tagName==="TEXTAREA"?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(o,"value");n&&n.set?n.set.call(e,t):e.value=t}function Me(e,t){try{return e.focus(),document.execCommand("insertText",!1,t)||(e.textContent=t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})),!0}catch{try{return e.textContent=t,e.dispatchEvent(new Event("input",{bubbles:!0})),!0}catch{return!1}}}A("zh",{pageExtract:{startedDownloadingImages:"\u5DF2\u5F00\u59CB\u4E0B\u8F7D {count} \u5F20\u56FE\u7247",targetElementNotFound:"\u672A\u627E\u5230\u76EE\u6807\u5143\u7D20",elementNotFound:"\u672A\u627E\u5230\u5339\u914D\u9009\u62E9\u5668\u7684\u5143\u7D20: {selector}",searchKeywordRequired:"\u9700\u8981\u63D0\u4F9B\u641C\u7D22\u5173\u952E\u8BCD",contentTruncated:"\u5185\u5BB9\u5DF2\u622A\u65AD"}}),A("en",{pageExtract:{startedDownloadingImages:"Started downloading {count} images",targetElementNotFound:"Target element not found",elementNotFound:"No element found matching selector: {selector}",searchKeywordRequired:"Search keyword is required",contentTruncated:"Content truncated"}});function so(){try{let e=a=>{let i=document.querySelector(`meta[name="${a}"]`)||document.querySelector(`meta[property="${a}"]`)||document.querySelector(`meta[property="og:${a}"]`);return i?i.content:null},t=a=>{let i=document.querySelectorAll(`meta[name="${a}"], meta[property="${a}"], meta[property="og:${a}"]`);return Array.from(i).map(r=>r.content).filter(Boolean)},o=[];document.querySelectorAll('script[type="application/ld+json"]').forEach(a=>{try{let i=JSON.parse(a.textContent);Array.isArray(i)?o.push(...i):i&&i["@graph"]&&Array.isArray(i["@graph"])?o.push(...i["@graph"]):i&&o.push(i)}catch{}});let n=[];return document.querySelectorAll("[itemscope]").forEach(a=>{let i=a.getAttribute("itemtype")||"";if(!i)return;let r={};a.querySelectorAll("[itemprop]").forEach(l=>{if(l.closest("[itemscope]")!==a)return;let s=l.getAttribute("itemprop")||"";if(!s)return;let c=l.getAttribute("content")||l.getAttribute("href")||l.getAttribute("src")||l.textContent?.trim();c&&(r[s]?r[s]=Array.isArray(r[s])?[...r[s],c]:[r[s],c]:r[s]=c)}),n.push({itemType:i,properties:r})}),{success:!0,data:{title:document.title,description:e("description"),keywords:e("keywords"),author:e("author"),ogTitle:e("og:title"),ogDescription:e("og:description"),ogImage:e("og:image"),ogUrl:e("og:url"),ogType:e("og:type"),ogSiteName:e("og:site_name"),ogLocale:e("og:locale"),articlePublishedTime:e("article:published_time"),articleModifiedTime:e("article:modified_time"),articleAuthor:e("article:author"),twitterCard:e("twitter:card"),twitterTitle:e("twitter:title"),twitterDescription:e("twitter:description"),twitterImage:e("twitter:image"),twitterSite:e("twitter:site"),twitterCreator:e("twitter:creator"),canonicalUrl:document.querySelector('link[rel="canonical"]')?.href,links:t("citation_author"),jsonLd:o.length>0?o:void 0,microdata:n.length>0?n:void 0}}}catch(e){return{success:!1,error:e.message}}}function co(e="all",t=!1){try{let o=window.location.hostname,n=[];return document.querySelectorAll("a[href]").forEach(a=>{try{let i=a.href;if(!i||i.startsWith("javascript:")||i.startsWith("#"))return;let r=new URL(i),l=r.hostname!==o;if(e==="internal"&&l||e==="external"&&!l)return;n.push({href:i,text:a.textContent.trim(),title:a.title,domain:r.hostname,isExternal:l,target:a.target})}catch{}}),t&&document.querySelectorAll("img[src]").forEach(a=>{try{let i=a.src;if(!i)return;let r=new URL(i),l=r.hostname!==o;if(e==="internal"&&l||e==="external"&&!l)return;n.push({href:i,text:a.alt||"",title:a.title,domain:r.hostname,isExternal:l,type:"image"})}catch{}}),{success:!0,total:n.length,links:n}}catch(o){return{success:!1,error:o.message}}}function uo(e=null){try{let t=(e?[document.querySelector(e)].filter(Boolean):Array.from(document.querySelectorAll("form"))).map((o,n)=>{let a=[],i=o.id||`form-${n}`;return o.querySelectorAll("input").forEach(r=>{a.push({tag:"input",name:r.name,id:r.id,type:r.type,placeholder:r.placeholder,required:r.required,selector:me(r)})}),o.querySelectorAll("textarea").forEach(r=>{a.push({tag:"textarea",name:r.name,id:r.id,placeholder:r.placeholder,required:r.required,selector:me(r)})}),o.querySelectorAll("select").forEach(r=>{let l=Array.from(r.options).map(s=>({value:s.value,text:s.textContent.trim()}));a.push({tag:"select",name:r.name,id:r.id,required:r.required,options:l,selector:me(r)})}),{formId:i,action:o.action,method:o.method,fields:a}});return{success:!0,total:t.length,forms:t}}catch(t){return{success:!1,error:t.message}}}function po(e={}){try{let{minWidth:t=0,minHeight:o=0,includeBackgroundImages:n=!1,download:a=!1,maxResults:i=100}=e,r=[],l=new Set;return document.querySelectorAll("img[src]").forEach(s=>{try{let c=s.src;if(!c||l.has(c))return;let u=s.naturalWidth||s.width||0,p=s.naturalHeight||s.height||0;u>=t&&p>=o&&(l.add(c),r.push({src:c,alt:s.alt||"",title:s.title||"",width:u,height:p,selector:me(s)}))}catch{}}),n&&document.querySelectorAll("*").forEach(s=>{try{let c=window.getComputedStyle(s).backgroundImage;if(!c||c==="none"||c.startsWith("gradient"))return;let u=c.match(/url\(['"]?([^'")]+)['"]?\)/);if(u&&u[1]){let p=u[1];l.has(p)||(l.add(p),r.push({src:p,alt:"",title:"",width:0,height:0,type:"background",selector:me(s)}))}}catch{}}),a&&r.length>0&&r.slice(0,Math.min(i,10)).forEach((s,c)=>{setTimeout(()=>{let u=document.createElement("a");u.href=s.src,u.download=`image_${c+1}.png`,document.body.appendChild(u),u.click(),document.body.removeChild(u)},c*500)}),{success:!0,total:r.length,images:r.slice(0,i),message:a?d("pageExtract.startedDownloadingImages",{count:Math.min(r.length,10)}):""}}catch(t){return{success:!1,error:t.message}}}function mo(e="iframe",t=!1,o=1e4){try{let n=document.querySelectorAll(e),a=[],i=(r,l=1,s="")=>{try{let c=xe(r),u=s?`${s} > iframe`:c,p=r.src||"about:blank",m=!1,h="",g="",b=0;try{let x=r.contentDocument||r.contentWindow?.document;x&&(m=!0,h=x.title||"",g=ye(x).substring(0,o),b=Pe(x).length,t&&l<2&&x.querySelectorAll("iframe").forEach(v=>{i(v,l+1,u)}))}catch{m=!1}a.push({selector:u,url:p,accessible:m,title:h,textContent:g,htmlLength:b})}catch{}};return n.forEach(r=>i(r)),{success:!0,iframes:a,total:a.length,accessible:a.filter(r=>r.accessible).length}}catch(n){return{success:!1,error:n.message}}}function ho(e={}){try{let{query:t,pattern:o,mode:n="plain",caseSensitive:a=!1,contextLength:i=50,maxResults:r=20,highlight:l=!1}=e,s=t||o;if(!s)return{success:!1,error:d("pageExtract.searchKeywordRequired")};if(n==="plain"){let g=window.find(s,a,!1,!0,!1,!0,!1),b=0,x=[];try{let v=window.getSelection(),S=v&&v.rangeCount>0?v.getRangeAt(0):null,I=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,!1),O=a?"g":"gi",ae=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),G=new RegExp(ae,O),C=document.body.innerText,W=0;for(;I.nextNode();){let de=I.currentNode.textContent.match(G);if(de)for(let ie of de){if(x.length>=r)break;let j=C.indexOf(ie,W),Oe=Math.max(0,j-i),Yt=Math.min(C.length,j+ie.length+i);x.push({match:ie,position:j,context:C.substring(Oe,Yt),lineNumber:C.substring(0,j).split(`
61
- `).length}),b++,W=j+ie.length}if(x.length>=r)break}S&&(v.removeAllRanges(),v.addRange(S))}catch{b=+!!g}if(l&&b>0){je();let v=document.createElement("style");v.id="ai-helper-highlight-style",v.textContent=`
60
+ `))}catch{}return a}function Te(e){if(!e)return{x:window.innerWidth/2,y:window.innerHeight/2};let t;try{t=e.getBoundingClientRect()}catch{t={left:0,top:0,width:0,height:0}}if(!t||t.width===0&&t.height===0){let a=e.commonAncestorContainer;if(a){let i=a.nodeType===Node.TEXT_NODE?a.parentElement:a;i&&i.getBoundingClientRect&&(t=i.getBoundingClientRect())}}let o=t.left+t.width/2,n=t.top;if(window.top!==window){let a=e.startContainer.ownerDocument;for(;a&&a!==window.top.document;){let i=a.defaultView?.frameElement;if(!i)break;let r=i.getBoundingClientRect();o+=r.left,n+=r.top,a=i.ownerDocument}}return{x:o,y:n}}function et(e,t=document,o=5,n=0,a=new Set){if(n>o||a.has(t))return a;try{let i=()=>e();t.addEventListener?.("selectionchange",i),a.add({root:t,listener:i}),t.querySelectorAll&&t.querySelectorAll("*").forEach(r=>{r.shadowRoot&&et(e,r.shadowRoot,o,n+1,a)})}catch{}return a}function fo(e){for(let{root:t,listener:o}of e)try{t.removeEventListener?.("selectionchange",o)}catch{}e.clear()}function Se(e){if(e.id)return`#${e.id}`;let t=[],o=e;for(;o&&o!==document.body&&o!==document.documentElement;){let n=o.tagName.toLowerCase();if(o.id){n=`#${o.id}`,t.unshift(n);break}if(o.className&&typeof o.className=="string"){let i=o.className.trim().split(/\s+/).filter(r=>r);i.length>0&&(n+="."+i[0])}let a=o.parentElement;if(a){let i=Array.from(a.children).filter(r=>r.tagName===o.tagName);if(i.length>1){let r=i.indexOf(o)+1;n+=`:nth-child(${r})`}}t.unshift(n),o=a}return t.join(" > ")}function fe(e){if(e.id)return`#${e.id}`;let t=e.tagName.toLowerCase();if(e.className){let o=e.className.split(" ").filter(n=>n).slice(0,2);o.length&&(t+="."+o.join("."))}return t}function kt(e,t,o=20){if(!e||!t)return 0;let n=t.global?t:new RegExp(t.source,t.flags+"g"),a=[],i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1),r=0,l;for(;(l=i.nextNode())&&r<o;){let c=l.parentNode;if(!c||c.nodeType!==1)continue;let u=c.tagName;if(u==="SCRIPT"||u==="STYLE"||u==="TITLE"||u==="TEXTAREA")continue;let p=l.nodeValue;if(!p)continue;let m=[],h;for(n.lastIndex=0;(h=n.exec(p))!==null&&r+m.length<o;){if(h[0].length===0){n.lastIndex++;continue}m.push({start:h.index,end:h.index+h[0].length}),h.index===n.lastIndex&&n.lastIndex++}m.length>0&&(a.push({node:l,spans:m}),r+=m.length)}let s=0;for(let{node:c,spans:u}of a)for(let p=u.length-1;p>=0;p--){let{start:m,end:h}=u[p];try{let g=document.createRange();g.setStart(c,m),g.setEnd(c,h);let y=document.createElement("span");y.className="ai-helper-search-highlight",g.surroundContents(y),s++}catch{}}return s}function tt(){document.querySelectorAll(".ai-helper-highlight, .ai-helper-search-highlight").forEach(t=>{let o=t.parentNode;if(o&&o.insertBefore&&o.removeChild){for(;t.firstChild;)o.insertBefore(t.firstChild,t);o.removeChild(t),typeof o.normalize=="function"&&o.normalize()}});let e=document.getElementById("ai-helper-highlight-style");e&&e.remove()}function Z(){let e=document.body,t=document.querySelectorAll('button, input, a[href], dialog, [role="dialog"], [role="alert"]').length;return`${location.href}|${e?e.childElementCount:0}|${t}`}async function J(e,t=300,o=2e3){let n=Date.now();await new Promise(u=>setTimeout(u,Math.min(t,o)));let a=e.split("|")[0],i=location.href!==a,r=!1,l=e,s=0;for(;Date.now()-n<o;){let u=Z();if(u===l?s++:(r=!0,s=0,l=u),s>=2)break;await new Promise(p=>setTimeout(p,100))}i=location.href!==a;let c={changed:i||r,urlChanged:i,domChanged:r,waitedMs:Date.now()-n};return i&&(c.newUrl=location.href),c}function Bt(e){return e.isContentEditable||e.getAttribute("contenteditable")==="true"}function Fe(e,t){let o=e.tagName==="TEXTAREA"?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(o,"value");n&&n.set?n.set.call(e,t):e.value=t}function He(e,t){try{return e.focus(),document.execCommand("insertText",!1,t)||(e.textContent=t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})),!0}catch{try{return e.textContent=t,e.dispatchEvent(new Event("input",{bubbles:!0})),!0}catch{return!1}}}A("zh",{pageExtract:{startedDownloadingImages:"\u5DF2\u5F00\u59CB\u4E0B\u8F7D {count} \u5F20\u56FE\u7247",targetElementNotFound:"\u672A\u627E\u5230\u76EE\u6807\u5143\u7D20",elementNotFound:"\u672A\u627E\u5230\u5339\u914D\u9009\u62E9\u5668\u7684\u5143\u7D20: {selector}",searchKeywordRequired:"\u9700\u8981\u63D0\u4F9B\u641C\u7D22\u5173\u952E\u8BCD",contentTruncated:"\u5185\u5BB9\u5DF2\u622A\u65AD"}}),A("en",{pageExtract:{startedDownloadingImages:"Started downloading {count} images",targetElementNotFound:"Target element not found",elementNotFound:"No element found matching selector: {selector}",searchKeywordRequired:"Search keyword is required",contentTruncated:"Content truncated"}});function bo(){try{let e=a=>{let i=document.querySelector(`meta[name="${a}"]`)||document.querySelector(`meta[property="${a}"]`)||document.querySelector(`meta[property="og:${a}"]`);return i?i.content:null},t=a=>{let i=document.querySelectorAll(`meta[name="${a}"], meta[property="${a}"], meta[property="og:${a}"]`);return Array.from(i).map(r=>r.content).filter(Boolean)},o=[];document.querySelectorAll('script[type="application/ld+json"]').forEach(a=>{try{let i=JSON.parse(a.textContent);Array.isArray(i)?o.push(...i):i&&i["@graph"]&&Array.isArray(i["@graph"])?o.push(...i["@graph"]):i&&o.push(i)}catch{}});let n=[];return document.querySelectorAll("[itemscope]").forEach(a=>{let i=a.getAttribute("itemtype")||"";if(!i)return;let r={};a.querySelectorAll("[itemprop]").forEach(l=>{if(l.closest("[itemscope]")!==a)return;let s=l.getAttribute("itemprop")||"";if(!s)return;let c=l.getAttribute("content")||l.getAttribute("href")||l.getAttribute("src")||l.textContent?.trim();c&&(r[s]?r[s]=Array.isArray(r[s])?[...r[s],c]:[r[s],c]:r[s]=c)}),n.push({itemType:i,properties:r})}),{success:!0,data:{title:document.title,description:e("description"),keywords:e("keywords"),author:e("author"),ogTitle:e("og:title"),ogDescription:e("og:description"),ogImage:e("og:image"),ogUrl:e("og:url"),ogType:e("og:type"),ogSiteName:e("og:site_name"),ogLocale:e("og:locale"),articlePublishedTime:e("article:published_time"),articleModifiedTime:e("article:modified_time"),articleAuthor:e("article:author"),twitterCard:e("twitter:card"),twitterTitle:e("twitter:title"),twitterDescription:e("twitter:description"),twitterImage:e("twitter:image"),twitterSite:e("twitter:site"),twitterCreator:e("twitter:creator"),canonicalUrl:document.querySelector('link[rel="canonical"]')?.href,links:t("citation_author"),jsonLd:o.length>0?o:void 0,microdata:n.length>0?n:void 0}}}catch(e){return{success:!1,error:e.message}}}function yo(e="all",t=!1){try{let o=window.location.hostname,n=[];return document.querySelectorAll("a[href]").forEach(a=>{try{let i=a.href;if(!i||i.startsWith("javascript:")||i.startsWith("#"))return;let r=new URL(i),l=r.hostname!==o;if(e==="internal"&&l||e==="external"&&!l)return;n.push({href:i,text:a.textContent.trim(),title:a.title,domain:r.hostname,isExternal:l,target:a.target})}catch{}}),t&&document.querySelectorAll("img[src]").forEach(a=>{try{let i=a.src;if(!i)return;let r=new URL(i),l=r.hostname!==o;if(e==="internal"&&l||e==="external"&&!l)return;n.push({href:i,text:a.alt||"",title:a.title,domain:r.hostname,isExternal:l,type:"image"})}catch{}}),{success:!0,total:n.length,links:n}}catch(o){return{success:!1,error:o.message}}}function wo(e=null){try{let t=(e?[document.querySelector(e)].filter(Boolean):Array.from(document.querySelectorAll("form"))).map((o,n)=>{let a=[],i=o.id||`form-${n}`;return o.querySelectorAll("input").forEach(r=>{a.push({tag:"input",name:r.name,id:r.id,type:r.type,placeholder:r.placeholder,required:r.required,selector:fe(r)})}),o.querySelectorAll("textarea").forEach(r=>{a.push({tag:"textarea",name:r.name,id:r.id,placeholder:r.placeholder,required:r.required,selector:fe(r)})}),o.querySelectorAll("select").forEach(r=>{let l=Array.from(r.options).map(s=>({value:s.value,text:s.textContent.trim()}));a.push({tag:"select",name:r.name,id:r.id,required:r.required,options:l,selector:fe(r)})}),{formId:i,action:o.action,method:o.method,fields:a}});return{success:!0,total:t.length,forms:t}}catch(t){return{success:!1,error:t.message}}}function xo(e={}){try{let{minWidth:t=0,minHeight:o=0,includeBackgroundImages:n=!1,download:a=!1,maxResults:i=100}=e,r=[],l=new Set;return document.querySelectorAll("img[src]").forEach(s=>{try{let c=s.src;if(!c||l.has(c))return;let u=s.naturalWidth||s.width||0,p=s.naturalHeight||s.height||0;u>=t&&p>=o&&(l.add(c),r.push({src:c,alt:s.alt||"",title:s.title||"",width:u,height:p,selector:fe(s)}))}catch{}}),n&&document.querySelectorAll("*").forEach(s=>{try{let c=window.getComputedStyle(s).backgroundImage;if(!c||c==="none"||c.startsWith("gradient"))return;let u=c.match(/url\(['"]?([^'")]+)['"]?\)/);if(u&&u[1]){let p=u[1];l.has(p)||(l.add(p),r.push({src:p,alt:"",title:"",width:0,height:0,type:"background",selector:fe(s)}))}}catch{}}),a&&r.length>0&&r.slice(0,Math.min(i,10)).forEach((s,c)=>{setTimeout(()=>{let u=document.createElement("a");u.href=s.src,u.download=`image_${c+1}.png`,document.body.appendChild(u),u.click(),document.body.removeChild(u)},c*500)}),{success:!0,total:r.length,images:r.slice(0,i),message:a?d("pageExtract.startedDownloadingImages",{count:Math.min(r.length,10)}):""}}catch(t){return{success:!1,error:t.message}}}function vo(e="iframe",t=!1,o=1e4){try{let n=document.querySelectorAll(e),a=[],i=(r,l=1,s="")=>{try{let c=Se(r),u=s?`${s} > iframe`:c,p=r.src||"about:blank",m=!1,h="",g="",y=0;try{let v=r.contentDocument||r.contentWindow?.document;v&&(m=!0,h=v.title||"",g=ke(v).substring(0,o),y=De(v).length,t&&l<2&&v.querySelectorAll("iframe").forEach(k=>{i(k,l+1,u)}))}catch{m=!1}a.push({selector:u,url:p,accessible:m,title:h,textContent:g,htmlLength:y})}catch{}};return n.forEach(r=>i(r)),{success:!0,iframes:a,total:a.length,accessible:a.filter(r=>r.accessible).length}}catch(n){return{success:!1,error:n.message}}}function ko(e={}){try{let{query:t,pattern:o,mode:n="plain",caseSensitive:a=!1,contextLength:i=50,maxResults:r=20,highlight:l=!1}=e,s=t||o;if(!s)return{success:!1,error:d("pageExtract.searchKeywordRequired")};if(n==="plain"){let g=window.find(s,a,!1,!0,!1,!0,!1),y=0,v=[];try{let k=window.getSelection(),S=k&&k.rangeCount>0?k.getRangeAt(0):null,I=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,!1),B=a?"g":"gi",re=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),V=new RegExp(re,B),C=document.body.innerText,j=0;for(;I.nextNode();){let me=I.currentNode.textContent.match(V);if(me)for(let le of me){if(v.length>=r)break;let Q=C.indexOf(le,j),Ge=Math.max(0,Q-i),ao=Math.min(C.length,Q+le.length+i);v.push({match:le,position:Q,context:C.substring(Ge,ao),lineNumber:C.substring(0,Q).split(`
61
+ `).length}),y++,j=Q+le.length}if(v.length>=r)break}S&&(k.removeAllRanges(),k.addRange(S))}catch{y=+!!g}if(l&&y>0){tt();let k=document.createElement("style");k.id="ai-helper-highlight-style",k.textContent=`
62
62
  .ai-helper-search-highlight {
63
63
  background-color: #ffff00;
64
64
  color: #000;
65
65
  padding: 1px 2px;
66
66
  border-radius: 2px;
67
67
  }
68
- `,document.head.appendChild(v);let S=a?"g":"gi",I=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");gt(document.body,new RegExp(I,S),r)}return{success:!0,query:s,mode:"plain",found:g,total:b,matches:x,highlighted:l}}let c=a?"g":"gi",u=new RegExp(s,c),p=document.body.innerText,m=[],h;for(;(h=u.exec(p))!==null&&m.length<r;){let g=Math.max(0,h.index-i),b=Math.min(p.length,h.index+h[0].length+i);m.push({match:h[0],position:h.index,context:p.substring(g,b),lineNumber:p.substring(0,h.index).split(`
69
- `).length}),h[0].length===0&&u.lastIndex++}if(l&&m.length>0){je();let g=document.createElement("style");g.id="ai-helper-highlight-style",g.textContent=`
68
+ `,document.head.appendChild(k);let S=a?"g":"gi",I=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");kt(document.body,new RegExp(I,S),r)}return{success:!0,query:s,mode:"plain",found:g,total:y,matches:v,highlighted:l}}let c=a?"g":"gi",u=new RegExp(s,c),p=document.body.innerText,m=[],h;for(;(h=u.exec(p))!==null&&m.length<r;){let g=Math.max(0,h.index-i),y=Math.min(p.length,h.index+h[0].length+i);m.push({match:h[0],position:h.index,context:p.substring(g,y),lineNumber:p.substring(0,h.index).split(`
69
+ `).length}),h[0].length===0&&u.lastIndex++}if(l&&m.length>0){tt();let g=document.createElement("style");g.id="ai-helper-highlight-style",g.textContent=`
70
70
  .ai-helper-search-highlight {
71
71
  background-color: #ffff00;
72
72
  color: #000;
73
73
  padding: 1px 2px;
74
74
  border-radius: 2px;
75
75
  }
76
- `,document.head.appendChild(g),gt(document.body,new RegExp(s,c),r)}return{success:!0,pattern:s,mode:"regex",total:m.length,matches:m,highlighted:l}}catch(t){return{success:!1,error:t.message}}}A("zh",{pageInteraction:{invalidRefSuggest:"\u65E0\u6548\u6216\u5DF2\u8FC7\u671F\u7684\u5143\u7D20\u5F15\u7528 ref={ref}\u3002",invalidRefSuggestions:"\u6700\u8FD1\u5FEB\u7167\u4E2D\u7684\u6709\u6548\u5F15\u7528\uFF1A{list}\u3002",invalidRefTail:"\u5982\u9875\u9762\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u8C03\u7528 query_elements \u83B7\u53D6\u6700\u65B0\u5FEB\u7167",elementNotVisibleError:"\u5143\u7D20 ref={ref}\uFF08{tag}\uFF09\u5F53\u524D\u4E0D\u53EF\u89C1\uFF0C\u53EF\u80FD\u88AB\u9690\u85CF\u6216\u6298\u53E0",navChangeHint:"\uFF08\u68C0\u6D4B\u5230\u5BFC\u822A\u53D8\u5316\uFF0C\u5DF2\u7B49\u5F85 {ms}ms\uFF09",domChangeHint:"\uFF08\u68C0\u6D4B\u5230DOM\u53D8\u5316\uFF0C\u5DF2\u7B49\u5F85 {ms}ms\uFF09",hoveredByRef:"\u5DF2\u60AC\u505C\u5143\u7D20 ref={ref}\uFF08{tag}\uFF09{hint}",clickedByRef:"\u5DF2\u70B9\u51FB\u5143\u7D20 ref={ref}\uFF08{tag}\uFF09{hint}",typedByRef:"\u5DF2\u5411\u5143\u7D20 ref={ref}\uFF08{tag}\uFF09\u8F93\u5165\u6587\u672C{hint}",typeNotSupported:"\u5143\u7D20 {tag} \u4E0D\u652F\u6301\u6587\u672C\u8F93\u5165\uFF08checkbox/radio \u8BF7\u7528 fill_form \u6216 click\uFF09",valueRequired:"action=type \u65F6 value \u4E0D\u80FD\u4E3A\u7A7A",typeFailed:"\u6587\u672C\u8F93\u5165\u5931\u8D25",textRequired:"text \u4E0D\u80FD\u4E3A\u7A7A",scrolledToText:'\u5DF2\u6EDA\u52A8\u5230\u5305\u542B"{text}"\u7684\u5143\u7D20',scrollTextNotFound:'\u6EDA\u52A8 {count} \u6B21\u672A\u627E\u5230\u5305\u542B"{text}"\u7684\u6587\u672C'}}),A("en",{pageInteraction:{invalidRefSuggest:"Invalid or stale element ref={ref}. ",invalidRefSuggestions:"Nearest valid refs from the latest snapshot: {list}. ",invalidRefTail:"If the page has changed, re-run query_elements",elementNotVisibleError:"Element ref={ref} ({tag}) is not visible; it may be hidden or collapsed",navChangeHint:" (navigation change detected, waited {ms}ms)",domChangeHint:" (DOM change detected, waited {ms}ms)",hoveredByRef:"Hovered element ref={ref} ({tag}){hint}",clickedByRef:"Clicked element ref={ref} ({tag}){hint}",typedByRef:"Typed text into element ref={ref} ({tag}){hint}",typeNotSupported:"Element {tag} does not support text input (use fill_form or click for checkbox/radio)",valueRequired:"value is required when action=type",typeFailed:"Text input failed",textRequired:"text cannot be empty",scrolledToText:'Scrolled to element containing "{text}"',scrollTextNotFound:'Scrolled {count} times but did not find text containing "{text}"'}});var ft=0,Ve=new WeakMap,ve=new Map;function Rt(e,t,o){let n=Ve.get(e);return n??(ft+=1,n=ft,Ve.set(e,n)),ve.set(n,{element:e,selector:null,tag:e.tagName,role:t,name:o}),n}function bt(e){if(e.selector==null)try{e.selector=xe(e.element)}catch{e.selector=""}return e.selector}function nt(e){let t=parseInt(e,10);if(!t||!ve.has(t))return{error:yt(t),suggestions:Qe(t)};let o=ve.get(t);if(o.element&&o.element.isConnected)return bt(o),{entry:o,element:o.element};let n=bt(o),a=n?P(n):null;return a?(o.element=a,{entry:o,element:a}):{error:yt(t),suggestions:Qe(t)}}function Qe(e){return[...ve.entries()].sort((t,o)=>Math.abs(t[0]-e)-Math.abs(o[0]-e)).slice(0,3).map(([t,o])=>({ref:t,role:o.role||o.tag&&o.tag.toLowerCase()||"?",name:o.name||""}))}function yt(e){let t=d("pageInteraction.invalidRefSuggest",{ref:e}),o=Qe(e);if(o.length){let n=o.map(a=>`ref ${a.ref} (${a.role}${a.name?` "${a.name}"`:""})`).join(", ");t+=d("pageInteraction.invalidRefSuggestions",{list:n})}return t+=d("pageInteraction.invalidRefTail"),t}function go(e){return nt(e).element||null}var fo=new Set(["button","link","checkbox","radio","switch","tab","menuitem","menuitemcheckbox","menuitemradio","option","combobox","listbox","searchbox","slider","spinbutton","textbox","treeitem"]),bo=new Set(["dialog","form","navigation","main","banner","contentinfo","table","row","heading"]);function Mt(e){let t=e.getAttribute("role"),o=t?t.trim().split(/\s+/)[0]:"";if(o)return o;let n=e.tagName;if(n==="BUTTON")return"button";if(n==="A")return e.hasAttribute("href")?"link":"";if(n==="SELECT")return e.multiple||e.size>1?"listbox":"combobox";if(n==="TEXTAREA")return"textbox";if(n==="SUMMARY")return"button";if(/^H[1-6]$/.test(n))return"heading";if(n==="NAV")return"navigation";if(n==="MAIN")return"main";if(n==="DIALOG")return"dialog";if(n==="FORM")return"form";if(n==="TABLE")return"table";if(n==="TR")return"row";if(n==="INPUT"){let a=(e.type||"text").toLowerCase();return a==="hidden"?"":a==="checkbox"?"checkbox":a==="radio"?"radio":a==="submit"||a==="button"||a==="reset"?"button":a==="search"?"searchbox":a==="range"?"slider":a==="number"?"spinbutton":"textbox"}return""}function Lt(e){if(e.hasAttribute("hidden")||e.hasAttribute("inert")||e.getAttribute("aria-hidden")==="true"||e.style&&e.style.display==="none")return!0;let t=typeof getComputedStyle=="function"?getComputedStyle(e):null;return!!t&&t.display==="none"}function wt(e){if(typeof e.checkVisibility=="function")return!e.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0});let t=typeof getComputedStyle=="function"?getComputedStyle(e):null;return t?t.display==="none"||t.visibility==="hidden":!1}function yo(){let e=new Set;try{for(let t of document.querySelectorAll('[aria-expanded="true"][aria-controls]'))e.add(t.getAttribute("aria-controls"))}catch{}return e}function wo(e,t,o){if(e.tagName==="DIALOG"&&e.hasAttribute("open"))return!0;if(e.hasAttribute("popover"))try{if(e.matches(":popover-open"))return!0}catch{}if(e.tagName==="SELECT"||e.tagName==="INPUT"||e.tagName==="TEXTAREA")return!1;let n=document.activeElement;return!!((t==="dialog"||t==="alertdialog")&&(e.getAttribute("aria-modal")==="true"||n&&e.contains(n))||(t==="menu"||t==="listbox")&&n&&e.contains(n)||e.id&&o.has(e.id))}function Nt(e,t){if(fo.has(t)||e.tagName==="A"&&e.hasAttribute("href"))return!0;if(e.hasAttribute("contenteditable")){let n=e.getAttribute("contenteditable");if(n===""||n==="true"||n==="plaintext-only")return!0}let o=e.getAttribute("tabindex");return!!(o!==null&&parseInt(o,10)>=0||e.hasAttribute("onclick"))}function Dt(e){let t=[];return e.shadowRoot&&t.push(...e.shadowRoot.children),t.push(...e.children),t}function Ye(e,t){let o=(u,p=80)=>{if(!u)return"";let m=String(u).replace(/\s+/g," ").trim();return m.length>p?m.slice(0,p-1)+"\u2026":m},n=u=>o(u?u.textContent:"");if(e.tagName==="SELECT"){let u=e.options&&e.options[e.selectedIndex];if(u&&u.text)return o(u.text)}let a=e.getAttribute("aria-labelledby");if(a){let u=a.split(/\s+/).map(p=>document.getElementById(p)).filter(Boolean).map(p=>n(p)).filter(Boolean).join(" ");if(u)return u}let i=e.getAttribute("aria-label");if(i)return o(i);if(e.id)try{let u=document.querySelector(`label[for="${CSS.escape(e.id)}"]`);if(u){let p=n(u);if(p)return p}}catch{}let r=e.closest&&e.closest("label");if(r){let u=n(r);if(u)return u}if(e.getAttribute("placeholder"))return o(e.getAttribute("placeholder"));if(e.getAttribute("title"))return o(e.getAttribute("title"));if(e.getAttribute("alt"))return o(e.getAttribute("alt"));if(e.tagName==="INPUT"){let u=(e.type||"").toLowerCase();if((u==="submit"||u==="button"||u==="reset")&&e.value)return o(e.value)}let l="";for(let u of e.childNodes)u.nodeType===3&&(l+=u.textContent);l.trim()||(l=e.textContent||"");let s=o(l);if(s)return s;let c=e.previousElementSibling;for(;c&&!(c.textContent||"").trim();)c=c.previousElementSibling;if(c&&!c.querySelector("button, a[href], input, select, textarea")){let u=n(c);if(u)return u}return""}function xo(e,t){let o=[],n=(i,r)=>i&&i.length>r?i.slice(0,r-1)+"\u2026":i;if(t==="link"&&e.getAttribute("href")&&o.push(`href="${n(e.getAttribute("href"),150)}"`),e.tagName==="INPUT"){let i=(e.type||"text").toLowerCase();i!=="text"&&i!=="checkbox"&&i!=="radio"&&o.push(`type="${i}"`)}let a=e.getAttribute("placeholder");return a&&o.push(`placeholder="${n(a,60)}"`),(e.tagName==="INPUT"||e.tagName==="TEXTAREA")&&e.value&&o.push(`value="${n(e.value,60)}"`),e.tagName==="INPUT"&&(e.type==="checkbox"||e.type==="radio")&&e.checked&&o.push('checked="true"'),e.tagName==="OPTION"&&e.selected&&o.push('selected="true"'),o.join(" ")}var vo=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`;function ko(){return window.innerWidth>0&&window.innerHeight>0}function To(e,t,o){if(!o||!o.length)return!0;let n=e.tagName.toLowerCase(),a=e.tagName==="INPUT"?(e.type||"").toLowerCase():"";return o.some(i=>i===n||i===a||i===t)}function So(e,t,o){return o?`${t} ${e.textContent||""} ${e.value||""}`.toLowerCase().includes(String(o).toLowerCase()):!0}function Co(e={}){let{filterByText:t="",elementTypes:o=null,page:n=1,maxResults:a=100,maxChars:i=6e3,countOnly:r=!1}=e;try{let l=Ft({filterByText:t,elementTypes:o,frames:"none"});return l.success?ht({frames:[{frameIndex:0,depth:0,isTop:!0,frameInfo:l.frameInfo,overlayTrees:l.overlayTrees,bodyTree:l.bodyTree}],page:n,maxResults:a,maxChars:i,countOnly:r}):l}catch(l){return console.error("[PageInteraction] queryInteractiveElements failed:",l),{success:!1,error:l.message}}}function Ao(e,t,o){let n=e.getAttribute("title")||"",a="";try{a=e.src||""}catch{}a||=e.getAttribute("src")||"";let i=null;try{let l=e.contentWindow&&e.contentWindow.location.href;typeof l=="string"&&(i=l)}catch{}let r=o.iframeOrder.has(e)?o.iframeOrder.get(e):-1;return{t:"frame",title:n,srcUrl:a,sameOriginHref:i,orderInParent:r,depth:t}}function Xe(e,t,o,n){if(Lt(e)||n.skipRoots&&n.skipRoots.has(e))return!1;let a=Mt(e),i=Nt(e,a),r=!i&&bo.has(a)?a:null,l=t+(i||r?1:0);if(n.frames==="auto"&&e.tagName==="IFRAME")return o.push(Ao(e,t,n)),!0;let s=[],c=!1;for(let u of Dt(e))Xe(u,l,s,n)&&(c=!0);if(i&&n.matchedSet.has(e)){let u=a||e.tagName.toLowerCase(),p=Ye(e,u);return o.push({t:"el",localRef:Ve.get(e)??Rt(e,u,p),role:u,name:p,attrs:xo(e,u),depth:t,children:s}),!0}if(r&&c){let u=r==="dialog"||r==="heading"?Ye(e,a):"";return o.push({t:"container",role:r,name:u,depth:t,children:s}),!0}return c?(o.push(...s),!0):!1}function Ft(e={}){let{filterByText:t="",elementTypes:o=null,frames:n="none"}=e;try{ve.clear();let a=yo(),i=[],r=[];Ht(document.body,{matched:r,filterByText:t,elementTypes:o,overlayRoots:i,expandedTargets:a});for(let p of r)Rt(p.el,p.role,p.name);let l=new Map;try{document.querySelectorAll("iframe").forEach((p,m)=>l.set(p,m))}catch{}let s={matchedSet:new Set(r.map(p=>p.el)),frames:n,iframeOrder:l,skipRoots:null},c=[];for(let p of i){let m=[];Xe(p,0,m,s),c.push(...m)}s.skipRoots=new Set(i);let u=[];return Xe(document.body,0,u,s),{success:!0,frameInfo:{url:location.href,title:document.title||"",width:window.innerWidth,height:window.innerHeight,loadId:vo},overlayTrees:c,bodyTree:u}}catch(a){return console.error("[PageInteraction] collectSnapshotOps failed:",a),{success:!1,error:a.message}}}function Ht(e,{matched:t,filterByText:o,elementTypes:n,overlayRoots:a,expandedTargets:i,inOverlay:r=!1}){if(Lt(e))return;let l=Mt(e),s=r;if(!s&&!wt(e)&&wo(e,l,i)&&(a.push(e),s=!0),Nt(e,l)&&!wt(e)&&To(e,l,n)){let c=l||e.tagName.toLowerCase(),u=Ye(e,c);So(e,u,o)&&t.push({el:e,role:c,name:u,inOverlay:s})}for(let c of Dt(e))Ht(c,{matched:t,filterByText:o,elementTypes:n,overlayRoots:a,expandedTargets:i,inOverlay:s})}function Eo(e={}){let{scrollPixels:t=800,maxScrolls:o=20,pauseMs:n=500,selector:a}=e;return new Promise(async i=>{try{let r=a?document.querySelector(a):null,l=()=>{let g=r||document.body,b=document.createTreeWalker(g,NodeFilter.SHOW_TEXT),x="",v;for(;v=b.nextNode();){let S=v.parentElement;if(!S)continue;let I=S.getBoundingClientRect();if(I.bottom>-100&&I.top<window.innerHeight+100){let O=v.textContent.trim();O&&(x+=O+`
77
- `)}}return x},s=r||document.scrollingElement||document.documentElement,c="",u=window.scrollY,p=0;for(let g=0;g<o;g++){let b=l();c+=b+`
78
- `;let x=window.scrollY;if(s.scrollBy({top:t,behavior:"auto"}),p++,await new Promise(v=>setTimeout(v,n)),Math.abs(window.scrollY-x)<5&&(await new Promise(v=>setTimeout(v,n)),Math.abs(window.scrollY-x)<5))break}r&&s.scrollTo({top:u,behavior:"auto"});let m=c.split(`
79
- `),h=[];for(let g of m){let b=g.trim();b&&b!==h[h.length-1]&&h.push(b)}i({success:!0,content:h.join(`
76
+ `,document.head.appendChild(g),kt(document.body,new RegExp(s,c),r)}return{success:!0,pattern:s,mode:"regex",total:m.length,matches:m,highlighted:l}}catch(t){return{success:!1,error:t.message}}}A("zh",{pageInteraction:{invalidRefSuggest:"\u65E0\u6548\u6216\u5DF2\u8FC7\u671F\u7684\u5143\u7D20\u5F15\u7528 ref={ref}\u3002",invalidRefSuggestions:"\u6700\u8FD1\u5FEB\u7167\u4E2D\u7684\u6709\u6548\u5F15\u7528\uFF1A{list}\u3002",invalidRefTail:"\u5982\u9875\u9762\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u8C03\u7528 query_elements \u83B7\u53D6\u6700\u65B0\u5FEB\u7167",elementNotVisibleError:"\u5143\u7D20 ref={ref}\uFF08{tag}\uFF09\u5F53\u524D\u4E0D\u53EF\u89C1\uFF0C\u53EF\u80FD\u88AB\u9690\u85CF\u6216\u6298\u53E0",navChangeHint:"\uFF08\u68C0\u6D4B\u5230\u5BFC\u822A\u53D8\u5316\uFF0C\u5DF2\u7B49\u5F85 {ms}ms\uFF09",domChangeHint:"\uFF08\u68C0\u6D4B\u5230DOM\u53D8\u5316\uFF0C\u5DF2\u7B49\u5F85 {ms}ms\uFF09",hoveredByRef:"\u5DF2\u60AC\u505C\u5143\u7D20 ref={ref}\uFF08{tag}\uFF09{hint}",clickedByRef:"\u5DF2\u70B9\u51FB\u5143\u7D20 ref={ref}\uFF08{tag}\uFF09{hint}",typedByRef:"\u5DF2\u5411\u5143\u7D20 ref={ref}\uFF08{tag}\uFF09\u8F93\u5165\u6587\u672C{hint}",typeNotSupported:"\u5143\u7D20 {tag} \u4E0D\u652F\u6301\u6587\u672C\u8F93\u5165\uFF08checkbox/radio \u8BF7\u7528 fill_form \u6216 click\uFF09",valueRequired:"action=type \u65F6 value \u4E0D\u80FD\u4E3A\u7A7A",typeFailed:"\u6587\u672C\u8F93\u5165\u5931\u8D25",textRequired:"text \u4E0D\u80FD\u4E3A\u7A7A",scrolledToText:'\u5DF2\u6EDA\u52A8\u5230\u5305\u542B"{text}"\u7684\u5143\u7D20',scrollTextNotFound:'\u6EDA\u52A8 {count} \u6B21\u672A\u627E\u5230\u5305\u542B"{text}"\u7684\u6587\u672C'}}),A("en",{pageInteraction:{invalidRefSuggest:"Invalid or stale element ref={ref}. ",invalidRefSuggestions:"Nearest valid refs from the latest snapshot: {list}. ",invalidRefTail:"If the page has changed, re-run query_elements",elementNotVisibleError:"Element ref={ref} ({tag}) is not visible; it may be hidden or collapsed",navChangeHint:" (navigation change detected, waited {ms}ms)",domChangeHint:" (DOM change detected, waited {ms}ms)",hoveredByRef:"Hovered element ref={ref} ({tag}){hint}",clickedByRef:"Clicked element ref={ref} ({tag}){hint}",typedByRef:"Typed text into element ref={ref} ({tag}){hint}",typeNotSupported:"Element {tag} does not support text input (use fill_form or click for checkbox/radio)",valueRequired:"value is required when action=type",typeFailed:"Text input failed",textRequired:"text cannot be empty",scrolledToText:'Scrolled to element containing "{text}"',scrollTextNotFound:'Scrolled {count} times but did not find text containing "{text}"'}});var Tt=0,ot=new WeakMap,Ce=new Map;function Ot(e,t,o){let n=ot.get(e);return n??(Tt+=1,n=Tt,ot.set(e,n)),Ce.set(n,{element:e,selector:null,tag:e.tagName,role:t,name:o}),n}function St(e){if(e.selector==null)try{e.selector=Se(e.element)}catch{e.selector=""}return e.selector}function dt(e){let t=parseInt(e,10);if(!t||!Ce.has(t))return{error:Ct(t),suggestions:nt(t)};let o=Ce.get(t);if(o.element&&o.element.isConnected)return St(o),{entry:o,element:o.element};let n=St(o),a=n?P(n):null;return a?(o.element=a,{entry:o,element:a}):{error:Ct(t),suggestions:nt(t)}}function nt(e){return[...Ce.entries()].sort((t,o)=>Math.abs(t[0]-e)-Math.abs(o[0]-e)).slice(0,3).map(([t,o])=>({ref:t,role:o.role||o.tag&&o.tag.toLowerCase()||"?",name:o.name||""}))}function Ct(e){let t=d("pageInteraction.invalidRefSuggest",{ref:e}),o=nt(e);if(o.length){let n=o.map(a=>`ref ${a.ref} (${a.role}${a.name?` "${a.name}"`:""})`).join(", ");t+=d("pageInteraction.invalidRefSuggestions",{list:n})}return t+=d("pageInteraction.invalidRefTail"),t}function To(e){return dt(e).element||null}var So=new Set(["button","link","checkbox","radio","switch","tab","menuitem","menuitemcheckbox","menuitemradio","option","combobox","listbox","searchbox","slider","spinbutton","textbox","treeitem"]),Co=new Set(["dialog","form","navigation","main","banner","contentinfo","table","row","heading"]);function _t(e){let t=e.getAttribute("role"),o=t?t.trim().split(/\s+/)[0]:"";if(o)return o;let n=e.tagName;if(n==="BUTTON")return"button";if(n==="A")return e.hasAttribute("href")?"link":"";if(n==="SELECT")return e.multiple||e.size>1?"listbox":"combobox";if(n==="TEXTAREA")return"textbox";if(n==="SUMMARY")return"button";if(/^H[1-6]$/.test(n))return"heading";if(n==="NAV")return"navigation";if(n==="MAIN")return"main";if(n==="DIALOG")return"dialog";if(n==="FORM")return"form";if(n==="TABLE")return"table";if(n==="TR")return"row";if(n==="INPUT"){let a=(e.type||"text").toLowerCase();return a==="hidden"?"":a==="checkbox"?"checkbox":a==="radio"?"radio":a==="submit"||a==="button"||a==="reset"?"button":a==="search"?"searchbox":a==="range"?"slider":a==="number"?"spinbutton":"textbox"}return""}function qt(e){if(e.hasAttribute("hidden")||e.hasAttribute("inert")||e.getAttribute("aria-hidden")==="true"||e.style&&e.style.display==="none")return!0;let t=typeof getComputedStyle=="function"?getComputedStyle(e):null;return!!t&&t.display==="none"}function At(e){if(typeof e.checkVisibility=="function")return!e.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0});let t=typeof getComputedStyle=="function"?getComputedStyle(e):null;return t?t.display==="none"||t.visibility==="hidden":!1}function Ao(){let e=new Set;try{for(let t of document.querySelectorAll('[aria-expanded="true"][aria-controls]'))e.add(t.getAttribute("aria-controls"))}catch{}return e}function Eo(e,t,o){if(e.tagName==="DIALOG"&&e.hasAttribute("open"))return!0;if(e.hasAttribute("popover"))try{if(e.matches(":popover-open"))return!0}catch{}if(e.tagName==="SELECT"||e.tagName==="INPUT"||e.tagName==="TEXTAREA")return!1;let n=document.activeElement;return!!((t==="dialog"||t==="alertdialog")&&(e.getAttribute("aria-modal")==="true"||n&&e.contains(n))||(t==="menu"||t==="listbox")&&n&&e.contains(n)||e.id&&o.has(e.id))}function Ut(e,t){if(So.has(t)||e.tagName==="A"&&e.hasAttribute("href"))return!0;if(e.hasAttribute("contenteditable")){let n=e.getAttribute("contenteditable");if(n===""||n==="true"||n==="plaintext-only")return!0}let o=e.getAttribute("tabindex");return!!(o!==null&&parseInt(o,10)>=0||e.hasAttribute("onclick"))}function Kt(e){let t=[];return e.shadowRoot&&t.push(...e.shadowRoot.children),t.push(...e.children),t}function at(e,t){let o=(u,p=80)=>{if(!u)return"";let m=String(u).replace(/\s+/g," ").trim();return m.length>p?m.slice(0,p-1)+"\u2026":m},n=u=>o(u?u.textContent:"");if(e.tagName==="SELECT"){let u=e.options&&e.options[e.selectedIndex];if(u&&u.text)return o(u.text)}let a=e.getAttribute("aria-labelledby");if(a){let u=a.split(/\s+/).map(p=>document.getElementById(p)).filter(Boolean).map(p=>n(p)).filter(Boolean).join(" ");if(u)return u}let i=e.getAttribute("aria-label");if(i)return o(i);if(e.id)try{let u=document.querySelector(`label[for="${CSS.escape(e.id)}"]`);if(u){let p=n(u);if(p)return p}}catch{}let r=e.closest&&e.closest("label");if(r){let u=n(r);if(u)return u}if(e.getAttribute("placeholder"))return o(e.getAttribute("placeholder"));if(e.getAttribute("title"))return o(e.getAttribute("title"));if(e.getAttribute("alt"))return o(e.getAttribute("alt"));if(e.tagName==="INPUT"){let u=(e.type||"").toLowerCase();if((u==="submit"||u==="button"||u==="reset")&&e.value)return o(e.value)}let l="";for(let u of e.childNodes)u.nodeType===3&&(l+=u.textContent);l.trim()||(l=e.textContent||"");let s=o(l);if(s)return s;let c=e.previousElementSibling;for(;c&&!(c.textContent||"").trim();)c=c.previousElementSibling;if(c&&!c.querySelector("button, a[href], input, select, textarea")){let u=n(c);if(u)return u}return""}function Io(e,t){let o=[],n=(i,r)=>i&&i.length>r?i.slice(0,r-1)+"\u2026":i;if(t==="link"&&e.getAttribute("href")&&o.push(`href="${n(e.getAttribute("href"),150)}"`),e.tagName==="INPUT"){let i=(e.type||"text").toLowerCase();i!=="text"&&i!=="checkbox"&&i!=="radio"&&o.push(`type="${i}"`)}let a=e.getAttribute("placeholder");return a&&o.push(`placeholder="${n(a,60)}"`),(e.tagName==="INPUT"||e.tagName==="TEXTAREA")&&e.value&&o.push(`value="${n(e.value,60)}"`),e.tagName==="INPUT"&&(e.type==="checkbox"||e.type==="radio")&&e.checked&&o.push('checked="true"'),e.tagName==="OPTION"&&e.selected&&o.push('selected="true"'),o.join(" ")}var Po=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`;function Ro(){return window.innerWidth>0&&window.innerHeight>0}function Mo(e,t,o){if(!o||!o.length)return!0;let n=e.tagName.toLowerCase(),a=e.tagName==="INPUT"?(e.type||"").toLowerCase():"";return o.some(i=>i===n||i===a||i===t)}function Lo(e,t,o){return o?`${t} ${e.textContent||""} ${e.value||""}`.toLowerCase().includes(String(o).toLowerCase()):!0}function No(e={}){let{filterByText:t="",elementTypes:o=null,page:n=1,maxResults:a=100,maxChars:i=6e3,countOnly:r=!1}=e;try{let l=$t({filterByText:t,elementTypes:o,frames:"none"});return l.success?vt({frames:[{frameIndex:0,depth:0,isTop:!0,frameInfo:l.frameInfo,overlayTrees:l.overlayTrees,bodyTree:l.bodyTree}],page:n,maxResults:a,maxChars:i,countOnly:r}):l}catch(l){return console.error("[PageInteraction] queryInteractiveElements failed:",l),{success:!1,error:l.message}}}function Do(e,t,o){let n=e.getAttribute("title")||"",a="";try{a=e.src||""}catch{}a||=e.getAttribute("src")||"";let i=null;try{let l=e.contentWindow&&e.contentWindow.location.href;typeof l=="string"&&(i=l)}catch{}let r=o.iframeOrder.has(e)?o.iframeOrder.get(e):-1;return{t:"frame",title:n,srcUrl:a,sameOriginHref:i,orderInParent:r,depth:t}}function it(e,t,o,n){if(qt(e)||n.skipRoots&&n.skipRoots.has(e))return!1;let a=_t(e),i=Ut(e,a),r=!i&&Co.has(a)?a:null,l=t+(i||r?1:0);if(n.frames==="auto"&&e.tagName==="IFRAME")return o.push(Do(e,t,n)),!0;let s=[],c=!1;for(let u of Kt(e))it(u,l,s,n)&&(c=!0);if(i&&n.matchedSet.has(e)){let u=a||e.tagName.toLowerCase(),p=at(e,u);return o.push({t:"el",localRef:ot.get(e)??Ot(e,u,p),role:u,name:p,attrs:Io(e,u),depth:t,children:s}),!0}if(r&&c){let u=r==="dialog"||r==="heading"?at(e,a):"";return o.push({t:"container",role:r,name:u,depth:t,children:s}),!0}return c?(o.push(...s),!0):!1}function $t(e={}){let{filterByText:t="",elementTypes:o=null,frames:n="none"}=e;try{Ce.clear();let a=Ao(),i=[],r=[];zt(document.body,{matched:r,filterByText:t,elementTypes:o,overlayRoots:i,expandedTargets:a});for(let p of r)Ot(p.el,p.role,p.name);let l=new Map;try{document.querySelectorAll("iframe").forEach((p,m)=>l.set(p,m))}catch{}let s={matchedSet:new Set(r.map(p=>p.el)),frames:n,iframeOrder:l,skipRoots:null},c=[];for(let p of i){let m=[];it(p,0,m,s),c.push(...m)}s.skipRoots=new Set(i);let u=[];return it(document.body,0,u,s),{success:!0,frameInfo:{url:location.href,title:document.title||"",width:window.innerWidth,height:window.innerHeight,loadId:Po},overlayTrees:c,bodyTree:u}}catch(a){return console.error("[PageInteraction] collectSnapshotOps failed:",a),{success:!1,error:a.message}}}function zt(e,{matched:t,filterByText:o,elementTypes:n,overlayRoots:a,expandedTargets:i,inOverlay:r=!1}){if(qt(e))return;let l=_t(e),s=r;if(!s&&!At(e)&&Eo(e,l,i)&&(a.push(e),s=!0),Ut(e,l)&&!At(e)&&Mo(e,l,n)){let c=l||e.tagName.toLowerCase(),u=at(e,c);Lo(e,u,o)&&t.push({el:e,role:c,name:u,inOverlay:s})}for(let c of Kt(e))zt(c,{matched:t,filterByText:o,elementTypes:n,overlayRoots:a,expandedTargets:i,inOverlay:s})}function Fo(e={}){let{scrollPixels:t=800,maxScrolls:o=20,pauseMs:n=500,selector:a}=e;return new Promise(async i=>{try{let r=a?document.querySelector(a):null,l=()=>{let g=r||document.body,y=document.createTreeWalker(g,NodeFilter.SHOW_TEXT),v="",k;for(;k=y.nextNode();){let S=k.parentElement;if(!S)continue;let I=S.getBoundingClientRect();if(I.bottom>-100&&I.top<window.innerHeight+100){let B=k.textContent.trim();B&&(v+=B+`
77
+ `)}}return v},s=r||document.scrollingElement||document.documentElement,c="",u=window.scrollY,p=0;for(let g=0;g<o;g++){let y=l();c+=y+`
78
+ `;let v=window.scrollY;if(s.scrollBy({top:t,behavior:"auto"}),p++,await new Promise(k=>setTimeout(k,n)),Math.abs(window.scrollY-v)<5&&(await new Promise(k=>setTimeout(k,n)),Math.abs(window.scrollY-v)<5))break}r&&s.scrollTo({top:u,behavior:"auto"});let m=c.split(`
79
+ `),h=[];for(let g of m){let y=g.trim();y&&y!==h[h.length-1]&&h.push(y)}i({success:!0,content:h.join(`
80
80
  `),contentLength:h.join(`
81
- `).length,scrolls:p,startScrollY:u,endScrollY:window.scrollY})}catch(r){i({success:!1,error:r.message})}})}async function Io(e,t="click",o={}){let{waitTime:n=300,timeout:a=2e3}=o,i=parseInt(e,10),r=nt(i);if(r.error)return{success:!1,error:r.error,...r.suggestions&&r.suggestions.length?{suggestions:r.suggestions}:{}};let{entry:l,element:s}=r,c=window.getComputedStyle(s);if(c.display==="none"||c.visibility==="hidden")return{success:!1,error:d("pageInteraction.elementNotVisibleError",{ref:e,tag:l.tag})};if(t==="type"){let h=Y(),g=Po(s,o.value,o);if(!g.success)return{success:!1,error:g.error};let b=await X(h,n,a),x=b.changed?d(b.urlChanged?"pageInteraction.navChangeHint":"pageInteraction.domChangeHint",{ms:b.waitedMs}):"";return{success:!0,message:d("pageInteraction.typedByRef",{ref:i,tag:l.tag,hint:x}),...b}}if(t==="hover"){let h=Y();s.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0,cancelable:!0,view:window})),s.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0,cancelable:!0,view:window}));let g=await X(h,n,a),b=g.changed?d(g.urlChanged?"pageInteraction.navChangeHint":"pageInteraction.domChangeHint",{ms:g.waitedMs}):"";return{success:!0,message:d("pageInteraction.hoveredByRef",{ref:e,tag:l.tag,hint:b}),...g}}let u=Y();s.click();let p=await X(u,n,a),m=p.changed?d(p.urlChanged?"pageInteraction.navChangeHint":"pageInteraction.domChangeHint",{ms:p.waitedMs}):"";return{success:!0,message:d("pageInteraction.clickedByRef",{ref:e,tag:l.tag,hint:m}),...p}}function Po(e,t,{clear:o=!1,submit:n=!1}={}){if(t==null||t==="")return{success:!1,error:d("pageInteraction.valueRequired")};let a=e.tagName,i=Pt(e);if(a==="INPUT"){let r=(e.type||"text").toLowerCase();if(["checkbox","radio","file","submit","button","reset","image"].includes(r))return{success:!1,error:d("pageInteraction.typeNotSupported",{tag:`<input type="${r}">`})}}else if(a!=="TEXTAREA"&&!i)return{success:!1,error:d("pageInteraction.typeNotSupported",{tag:`<${a.toLowerCase()}>`})};try{e.focus()}catch{}if(i&&a!=="INPUT"&&a!=="TEXTAREA"){if(o&&Me(e,""),!Me(e,t))return{success:!1,error:d("pageInteraction.typeFailed")}}else o&&(Re(e,""),e.dispatchEvent(new Event("input",{bubbles:!0}))),Re(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}));if(n){let r={key:"Enter",code:"Enter",keyCode:13,which:13,bubbles:!0,cancelable:!0};e.dispatchEvent(new KeyboardEvent("keydown",r)),e.dispatchEvent(new KeyboardEvent("keypress",r)),e.dispatchEvent(new KeyboardEvent("keyup",r))}return{success:!0}}async function Ro(e,t={}){let{maxScrolls:o=20,pauseMs:n=500}=t;if(!e)return{success:!1,error:d("pageInteraction.textRequired")};let a=e.toLowerCase(),i=()=>{let l=te("h1, h2, h3, h4, h5, h6, p, span, a, button, li, td, th, label, div");for(let s of l){let c=Array.from(s.childNodes).filter(u=>u.nodeType===Node.TEXT_NODE).map(u=>u.textContent).join("").trim();if(c&&c.toLowerCase().includes(a))return s}return null},r=i();if(r)return r.scrollIntoView({behavior:"smooth",block:"center"}),await new Promise(l=>setTimeout(l,300)),{success:!0,message:d("pageInteraction.scrolledToText",{text:e}),selector:xe(r),scrolls:0};for(let l=0;l<o;l++){let s=window.scrollY;if(window.scrollBy({top:Math.floor(window.innerHeight*.8),behavior:"auto"}),await new Promise(c=>setTimeout(c,n)),r=i(),r)return r.scrollIntoView({behavior:"smooth",block:"center"}),await new Promise(c=>setTimeout(c,300)),{success:!0,message:d("pageInteraction.scrolledToText",{text:e}),selector:xe(r),scrolls:l+1};if(Math.abs(window.scrollY-s)<5&&(await new Promise(c=>setTimeout(c,n)),Math.abs(window.scrollY-s)<5))break}return{success:!1,error:d("pageInteraction.scrollTextNotFound",{count:o,text:e}),scrolls:o}}A("zh",{pageTools:{noSelection:"\u5F53\u524D\u6CA1\u6709\u9009\u4E2D\u7684\u5185\u5BB9",tableNotFound:"\u672A\u627E\u5230\u5339\u914D\u9009\u62E9\u5668\u7684\u8868\u683C: {selector}",emptyTable:"\u8868\u683C\u4E3A\u7A7A",copiedToClipboard:"\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F",copiedToClipboardFallback:"\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F\uFF08\u964D\u7EA7\u65B9\u6848\uFF09",elementNotFound:"\u672A\u627E\u5230\u5143\u7D20: {selector}",navChangeHint:"\uFF08\u68C0\u6D4B\u5230\u5BFC\u822A\u53D8\u5316\uFF0C\u5DF2\u7B49\u5F85 {ms}ms\uFF09",domChangeHint:"\uFF08\u68C0\u6D4B\u5230DOM\u53D8\u5316\uFF0C\u5DF2\u7B49\u5F85 {ms}ms\uFF09",hoverTriggered:"\u5DF2\u5728\u5143\u7D20\u4E0A\u89E6\u53D1\u60AC\u505C\u6548\u679C: {selector}{hint}",noHighlightText:"\u672A\u63D0\u4F9B\u8981\u9AD8\u4EAE\u7684\u6587\u672C",highlightedCount:"\u5DF2\u9AD8\u4EAE {count} \u5904\u6587\u672C"}}),A("en",{pageTools:{noSelection:"No content selected",tableNotFound:"No table found matching selector: {selector}",emptyTable:"Table is empty",copiedToClipboard:"Copied to clipboard",copiedToClipboardFallback:"Copied to clipboard (fallback method)",elementNotFound:"Element not found: {selector}",navChangeHint:" (navigation change detected, waited {ms}ms)",domChangeHint:" (DOM change detected, waited {ms}ms)",hoverTriggered:"Hover triggered on element: {selector}{hint}",noHighlightText:"No text provided to highlight",highlightedCount:"Highlighted {count} occurrences"}});function Mo(e={}){let{maxLength:t=5e4,includeHeadings:o=!0,includeLinks:n=!0}=e,a=ye(),i={title:document.title||"",url:window.location.href,content:a.substring(0,t),wordCount:a.split(/\s+/).length};return o&&(i.headings=Array.from(te("h1, h2, h3, h4, h5, h6")).map(r=>({level:r.tagName,text:r.textContent.trim()})).filter(r=>r.text.length>0).slice(0,30)),n&&(i.links=Array.from(te("a")).map(r=>({text:r.textContent.trim(),href:r.href})).filter(r=>r.text.length>0).slice(0,50)),{success:!0,data:i}}function Lo(e={}){let{includeStyles:t=!1,maxLength:o=5e4}=e,n=Pe();return t||(n=n.replace(/\s*style="[^"]*"/gi,"")),{success:!0,content:JSON.stringify({title:document.title,url:window.location.href,html:n.substring(0,o),fullLength:n.length})}}function No(e="text"){try{let t=window.getSelection();if(!t||t.isCollapsed||t.rangeCount===0)return{success:!1,error:d("pageTools.noSelection")};let o={success:!0,data:{selectedCount:t.rangeCount,text:""}};if(e==="html"){let n=[];for(let a=0;a<t.rangeCount;a++){let i=t.getRangeAt(a).cloneContents(),r=document.createElement("div");r.appendChild(i),n.push(r.innerHTML)}o.data.html=n.join(`
82
- `),o.data.text=t.toString()}else o.data.text=t.toString();return o}catch(t){return{success:!1,error:t.message}}}function Do(e="table",t=!0,o="json"){try{let n=P(e);if(!n)return{success:!1,error:d("pageTools.tableNotFound",{selector:e})};let a=Array.from(n.querySelectorAll("tr")),i=[];return a.forEach((r,l)=>{let s=Array.from(r.querySelectorAll("td, th")).map(c=>c.textContent.trim());(t||l>0)&&i.push(s)}),o==="markdown"?i.length===0?{success:!0,content:d("pageTools.emptyTable")}:{success:!0,content:`${`| ${i[0].join(" | ")} |`}
81
+ `).length,scrolls:p,startScrollY:u,endScrollY:window.scrollY})}catch(r){i({success:!1,error:r.message})}})}async function Ho(e,t="click",o={}){let{waitTime:n=300,timeout:a=2e3}=o,i=parseInt(e,10),r=dt(i);if(r.error)return{success:!1,error:r.error,...r.suggestions&&r.suggestions.length?{suggestions:r.suggestions}:{}};let{entry:l,element:s}=r,c=window.getComputedStyle(s);if(c.display==="none"||c.visibility==="hidden")return{success:!1,error:d("pageInteraction.elementNotVisibleError",{ref:e,tag:l.tag})};if(t==="type"){let h=Z(),g=Bo(s,o.value,o);if(!g.success)return{success:!1,error:g.error};let y=await J(h,n,a),v=y.changed?d(y.urlChanged?"pageInteraction.navChangeHint":"pageInteraction.domChangeHint",{ms:y.waitedMs}):"";return{success:!0,message:d("pageInteraction.typedByRef",{ref:i,tag:l.tag,hint:v}),...y}}if(t==="hover"){let h=Z();s.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0,cancelable:!0,view:window})),s.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0,cancelable:!0,view:window}));let g=await J(h,n,a),y=g.changed?d(g.urlChanged?"pageInteraction.navChangeHint":"pageInteraction.domChangeHint",{ms:g.waitedMs}):"";return{success:!0,message:d("pageInteraction.hoveredByRef",{ref:e,tag:l.tag,hint:y}),...g}}let u=Z();s.click();let p=await J(u,n,a),m=p.changed?d(p.urlChanged?"pageInteraction.navChangeHint":"pageInteraction.domChangeHint",{ms:p.waitedMs}):"";return{success:!0,message:d("pageInteraction.clickedByRef",{ref:e,tag:l.tag,hint:m}),...p}}function Bo(e,t,{clear:o=!1,submit:n=!1}={}){if(t==null||t==="")return{success:!1,error:d("pageInteraction.valueRequired")};let a=e.tagName,i=Bt(e);if(a==="INPUT"){let r=(e.type||"text").toLowerCase();if(["checkbox","radio","file","submit","button","reset","image"].includes(r))return{success:!1,error:d("pageInteraction.typeNotSupported",{tag:`<input type="${r}">`})}}else if(a!=="TEXTAREA"&&!i)return{success:!1,error:d("pageInteraction.typeNotSupported",{tag:`<${a.toLowerCase()}>`})};try{e.focus()}catch{}if(i&&a!=="INPUT"&&a!=="TEXTAREA"){if(o&&He(e,""),!He(e,t))return{success:!1,error:d("pageInteraction.typeFailed")}}else o&&(Fe(e,""),e.dispatchEvent(new Event("input",{bubbles:!0}))),Fe(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}));if(n){let r={key:"Enter",code:"Enter",keyCode:13,which:13,bubbles:!0,cancelable:!0};e.dispatchEvent(new KeyboardEvent("keydown",r)),e.dispatchEvent(new KeyboardEvent("keypress",r)),e.dispatchEvent(new KeyboardEvent("keyup",r))}return{success:!0}}async function Oo(e,t={}){let{maxScrolls:o=20,pauseMs:n=500}=t;if(!e)return{success:!1,error:d("pageInteraction.textRequired")};let a=e.toLowerCase(),i=()=>{let l=ne("h1, h2, h3, h4, h5, h6, p, span, a, button, li, td, th, label, div");for(let s of l){let c=Array.from(s.childNodes).filter(u=>u.nodeType===Node.TEXT_NODE).map(u=>u.textContent).join("").trim();if(c&&c.toLowerCase().includes(a))return s}return null},r=i();if(r)return r.scrollIntoView({behavior:"smooth",block:"center"}),await new Promise(l=>setTimeout(l,300)),{success:!0,message:d("pageInteraction.scrolledToText",{text:e}),selector:Se(r),scrolls:0};for(let l=0;l<o;l++){let s=window.scrollY;if(window.scrollBy({top:Math.floor(window.innerHeight*.8),behavior:"auto"}),await new Promise(c=>setTimeout(c,n)),r=i(),r)return r.scrollIntoView({behavior:"smooth",block:"center"}),await new Promise(c=>setTimeout(c,300)),{success:!0,message:d("pageInteraction.scrolledToText",{text:e}),selector:Se(r),scrolls:l+1};if(Math.abs(window.scrollY-s)<5&&(await new Promise(c=>setTimeout(c,n)),Math.abs(window.scrollY-s)<5))break}return{success:!1,error:d("pageInteraction.scrollTextNotFound",{count:o,text:e}),scrolls:o}}A("zh",{pageTools:{noSelection:"\u5F53\u524D\u6CA1\u6709\u9009\u4E2D\u7684\u5185\u5BB9",tableNotFound:"\u672A\u627E\u5230\u5339\u914D\u9009\u62E9\u5668\u7684\u8868\u683C: {selector}",emptyTable:"\u8868\u683C\u4E3A\u7A7A",copiedToClipboard:"\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F",copiedToClipboardFallback:"\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F\uFF08\u964D\u7EA7\u65B9\u6848\uFF09",elementNotFound:"\u672A\u627E\u5230\u5143\u7D20: {selector}",navChangeHint:"\uFF08\u68C0\u6D4B\u5230\u5BFC\u822A\u53D8\u5316\uFF0C\u5DF2\u7B49\u5F85 {ms}ms\uFF09",domChangeHint:"\uFF08\u68C0\u6D4B\u5230DOM\u53D8\u5316\uFF0C\u5DF2\u7B49\u5F85 {ms}ms\uFF09",hoverTriggered:"\u5DF2\u5728\u5143\u7D20\u4E0A\u89E6\u53D1\u60AC\u505C\u6548\u679C: {selector}{hint}",noHighlightText:"\u672A\u63D0\u4F9B\u8981\u9AD8\u4EAE\u7684\u6587\u672C",highlightedCount:"\u5DF2\u9AD8\u4EAE {count} \u5904\u6587\u672C"}}),A("en",{pageTools:{noSelection:"No content selected",tableNotFound:"No table found matching selector: {selector}",emptyTable:"Table is empty",copiedToClipboard:"Copied to clipboard",copiedToClipboardFallback:"Copied to clipboard (fallback method)",elementNotFound:"Element not found: {selector}",navChangeHint:" (navigation change detected, waited {ms}ms)",domChangeHint:" (DOM change detected, waited {ms}ms)",hoverTriggered:"Hover triggered on element: {selector}{hint}",noHighlightText:"No text provided to highlight",highlightedCount:"Highlighted {count} occurrences"}});function _o(e={}){let{maxLength:t=5e4,includeHeadings:o=!0,includeLinks:n=!0}=e,a=ke(),i={title:document.title||"",url:window.location.href,content:a.substring(0,t),wordCount:a.split(/\s+/).length};return o&&(i.headings=Array.from(ne("h1, h2, h3, h4, h5, h6")).map(r=>({level:r.tagName,text:r.textContent.trim()})).filter(r=>r.text.length>0).slice(0,30)),n&&(i.links=Array.from(ne("a")).map(r=>({text:r.textContent.trim(),href:r.href})).filter(r=>r.text.length>0).slice(0,50)),{success:!0,data:i}}function qo(e={}){let{includeStyles:t=!1,maxLength:o=5e4}=e,n=De();return t||(n=n.replace(/\s*style="[^"]*"/gi,"")),{success:!0,content:JSON.stringify({title:document.title,url:window.location.href,html:n.substring(0,o),fullLength:n.length})}}function Uo(e="text"){try{let t=window.getSelection();if(!t||t.isCollapsed||t.rangeCount===0)return{success:!1,error:d("pageTools.noSelection")};let o={success:!0,data:{selectedCount:t.rangeCount,text:""}};if(e==="html"){let n=[];for(let a=0;a<t.rangeCount;a++){let i=t.getRangeAt(a).cloneContents(),r=document.createElement("div");r.appendChild(i),n.push(r.innerHTML)}o.data.html=n.join(`
82
+ `),o.data.text=t.toString()}else o.data.text=t.toString();return o}catch(t){return{success:!1,error:t.message}}}function Ko(e="table",t=!0,o="json"){try{let n=P(e);if(!n)return{success:!1,error:d("pageTools.tableNotFound",{selector:e})};let a=Array.from(n.querySelectorAll("tr")),i=[];return a.forEach((r,l)=>{let s=Array.from(r.querySelectorAll("td, th")).map(c=>c.textContent.trim());(t||l>0)&&i.push(s)}),o==="markdown"?i.length===0?{success:!0,content:d("pageTools.emptyTable")}:{success:!0,content:`${`| ${i[0].join(" | ")} |`}
83
83
  ${`| ${i[0].map(()=>"---").join(" | ")} |`}
84
84
  ${i.slice(1).map(r=>`| ${r.join(" | ")} |`).join(`
85
- `)}`}:{success:!0,content:JSON.stringify({data:i,rowCount:i.length,columnCount:i[0]?.length||0}),data:i}}catch(n){return{success:!1,error:n.message}}}async function Fo(e){try{return await navigator.clipboard.writeText(e),{success:!0,message:d("pageTools.copiedToClipboard")}}catch{try{let t=document.createElement("textarea");return t.value=e,t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t),{success:!0,message:d("pageTools.copiedToClipboardFallback")}}catch(t){return{success:!1,error:t.message}}}}async function Ho(){try{return{success:!0,content:await navigator.clipboard.readText()}}catch(e){return{success:!1,error:e.message}}}async function Oo(e){try{let t=P(e);if(!t)return{success:!1,error:d("pageTools.elementNotFound",{selector:e})};let o=Y();t.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0,cancelable:!0,view:window})),t.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0,cancelable:!0,view:window}));let n=await X(o,300,2e3);return{success:!0,message:d("pageTools.hoverTriggered",{selector:e,hint:n.changed?n.urlChanged?d("pageTools.navChangeHint",{ms:n.waitedMs}):d("pageTools.domChangeHint",{ms:n.waitedMs}):""}),...n}}catch(t){return{success:!1,error:t.message}}}function Bo(e,t="yellow"){try{if(!e)return{success:!1,error:d("pageTools.noHighlightText")};je();let o=document.createElement("style");o.id="ai-helper-highlight-style",o.textContent=`
85
+ `)}`}:{success:!0,content:JSON.stringify({data:i,rowCount:i.length,columnCount:i[0]?.length||0}),data:i}}catch(n){return{success:!1,error:n.message}}}async function $o(e){try{return await navigator.clipboard.writeText(e),{success:!0,message:d("pageTools.copiedToClipboard")}}catch{try{let t=document.createElement("textarea");return t.value=e,t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t),{success:!0,message:d("pageTools.copiedToClipboardFallback")}}catch(t){return{success:!1,error:t.message}}}}async function zo(){try{return{success:!0,content:await navigator.clipboard.readText()}}catch(e){return{success:!1,error:e.message}}}async function Go(e){try{let t=P(e);if(!t)return{success:!1,error:d("pageTools.elementNotFound",{selector:e})};let o=Z();t.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0,cancelable:!0,view:window})),t.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0,cancelable:!0,view:window}));let n=await J(o,300,2e3);return{success:!0,message:d("pageTools.hoverTriggered",{selector:e,hint:n.changed?n.urlChanged?d("pageTools.navChangeHint",{ms:n.waitedMs}):d("pageTools.domChangeHint",{ms:n.waitedMs}):""}),...n}}catch(t){return{success:!1,error:t.message}}}function Wo(e,t="yellow"){try{if(!e)return{success:!1,error:d("pageTools.noHighlightText")};tt();let o=document.createElement("style");o.id="ai-helper-highlight-style",o.textContent=`
86
86
  .ai-helper-highlight {
87
87
  background-color: ${t} !important;
88
88
  padding: 2px 0;
89
89
  }
90
- `,document.head.appendChild(o);let n=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,!1),a=[],i;for(;i=n.nextNode();)i.nodeValue.toLowerCase().includes(e.toLowerCase())&&a.push(i);let r=[];return a.forEach(l=>{let s=l.parentNode;if(!s||!s.replaceChild||!s.insertBefore)return;let c=l.nodeValue,u=c.toLowerCase(),p=c.toLowerCase(),m=u.indexOf(p);if(m!==-1){let h=document.createElement("span");h.className="ai-helper-highlight",h.textContent=c.substring(m,m+c.length);let g=document.createTextNode(c.substring(0,m)),b=document.createTextNode(c.substring(m+c.length));s.replaceChild(b,l),s.insertBefore(h,b),s.insertBefore(g,h),r.push(h)}}),r.length>0&&r[0].scrollIntoView({behavior:"smooth",block:"center"}),{success:!0,message:d("pageTools.highlightedCount",{count:r.length}),count:r.length}}catch(o){return{success:!1,error:o.message}}}A("zh",{interactionTools:{selectorRequired:"\u9009\u62E9\u5668\u4E0D\u80FD\u4E3A\u7A7A",elementNotFoundBySelector:"\u672A\u627E\u5230\u5339\u914D\u9009\u62E9\u5668\u7684\u5143\u7D20: {selector}",navChangeHint:"\uFF08\u68C0\u6D4B\u5230\u5BFC\u822A\u53D8\u5316\uFF0C\u5DF2\u7B49\u5F85 {ms}ms\uFF09",domChangeHint:"\uFF08\u68C0\u6D4B\u5230DOM\u53D8\u5316\uFF0C\u5DF2\u7B49\u5F85 {ms}ms\uFF09",clickedElement:"\u5DF2\u70B9\u51FB\u5143\u7D20: {selector}{hint}",elementNotFound:"\u672A\u627E\u5230\u5143\u7D20",optionNotFound:"\u672A\u627E\u5230\u5339\u914D\u7684\u9009\u9879",radioButtonNotFound:"\u672A\u627E\u5230\u5339\u914D\u7684\u5355\u9009\u6309\u94AE",formFillComplete:"\u8868\u5355\u586B\u5145\u5B8C\u6210\uFF0C\u6210\u529F {success}/{total} \u4E2A\u5B57\u6BB5",elementNotFoundShort:"\u672A\u627E\u5230\u5143\u7D20: {selector}",invalidScrollTarget:"\u65E0\u6548\u7684\u6EDA\u52A8\u76EE\u6807\u6216\u7F3A\u5C11\u9009\u62E9\u5668",scrollComplete:"\u6EDA\u52A8\u5B8C\u6210",elementAppeared:"\u5143\u7D20 {selector} \u5DF2\u51FA\u73B0",elementDisappeared:"\u5143\u7D20 {selector} \u5DF2\u6D88\u5931",elementVisible:"\u5143\u7D20 {selector} \u5DF2\u53EF\u89C1",elementHidden:"\u5143\u7D20 {selector} \u5DF2\u9690\u85CF",waitTimeout:"\u7B49\u5F85\u8D85\u65F6\uFF08{timeout}ms\uFF09\uFF0C\u5143\u7D20 {selector} \u672A\u8FBE\u5230 {state} \u72B6\u6001",noFocusedElement:"\u6CA1\u6709\u805A\u7126\u7684\u5143\u7D20",keyboardInputSuccess:"\u952E\u76D8\u8F93\u5165\u6210\u529F{hint}",fileUploadNotFound:"\u672A\u627E\u5230\u6587\u4EF6\u4E0A\u4F20\u63A7\u4EF6: {selector}",notFileUploadControl:"\u9009\u62E9\u7684\u5143\u7D20\u4E0D\u662F\u6587\u4EF6\u4E0A\u4F20\u63A7\u4EF6",fileUploaded:"\u5DF2\u4E0A\u4F20\u6587\u4EF6: {fileName}",textRequired:"text \u4E0D\u80FD\u4E3A\u7A7A",hoveredByText:'\u5DF2\u60AC\u505C\u6587\u672C"{text}"\u5BF9\u5E94\u7684{tag}\u5143\u7D20{hint}',clickedByText:'\u5DF2\u70B9\u51FB\u6587\u672C"{text}"\u5BF9\u5E94\u7684{tag}\u5143\u7D20{hint}',textNotFound:'\u9875\u9762\u4E2D\u4E0D\u5B58\u5728\u6587\u672C"{text}"\uFF0C\u53EF\u80FD\u9700\u8981\u5148\u64CD\u4F5C\uFF08\u5982\u6253\u5F00\u4E0B\u62C9\u9762\u677F\uFF09\u6216\u6587\u672C\u6709\u8BEF',textFoundButHidden:'\u627E\u5230\u6587\u672C"{text}"\u4F46\u5143\u7D20\u4E0D\u53EF\u89C1\uFF0C\u53EF\u80FD\u9700\u8981\u5148\u6253\u5F00\u4E0B\u62C9\u9762\u677F/\u6EDA\u52A8\u5230\u53EF\u89C1\u533A\u57DF',textNotClickable:'\u627E\u5230\u6587\u672C"{text}"\u4F46\u4E0D\u5728\u53EF\u70B9\u51FB\u5143\u7D20\u4E2D\uFF0C\u8BF7\u7528 query_elements \u67E5\u770B\u5B9E\u9645\u7ED3\u6784\u6216\u7528 selector \u5B9A\u4F4D',textFoundButNotMatched:'\u627E\u5230\u6587\u672C"{text}"\u5728\u53EF\u70B9\u51FB\u5143\u7D20\u4E2D\u4F46\u672A\u5339\u914D\uFF0C\u53EF\u80FD\u6587\u672C\u88AB\u5206\u5272\u6216\u5927\u5C0F\u5199\u4E0D\u4E00\u81F4',tagConstraint:"\uFF08\u9650\u5B9A\u6807\u7B7E: {tag}\uFF09",triggerNotFound:"\u672A\u627E\u5230\u89E6\u53D1\u5668: {selector}",selectedOption:"\u5DF2\u9009\u62E9: {label}",selectOptionNotFound:'\u5728 <select> \u4E2D\u672A\u627E\u5230\u5339\u914D\u7684\u9009\u9879: "{option}"',optionContainerNotFound:"\u672A\u627E\u5230\u9009\u9879\u5BB9\u5668: {selector}",optionMatchTimeout:'\u5728 {timeout}ms \u5185\u672A\u627E\u5230\u5339\u914D\u9009\u9879: "{option}"',setRequiresKeyValue:"set\u64CD\u4F5C\u9700\u8981\u63D0\u4F9Bkey\u548Cvalue",keySet:"\u5DF2\u8BBE\u7F6E {key}",removeRequiresKey:"remove\u64CD\u4F5C\u9700\u8981\u63D0\u4F9Bkey",keyRemoved:"\u5DF2\u5220\u9664 {key}",storageCleared:"\u5DF2\u6E05\u7A7A\u5B58\u50A8",unknownAction:"\u672A\u77E5\u64CD\u4F5C: {action}"}}),A("en",{interactionTools:{selectorRequired:"Selector cannot be empty",elementNotFoundBySelector:"No element found matching selector: {selector}",navChangeHint:" (navigation change detected, waited {ms}ms)",domChangeHint:" (DOM change detected, waited {ms}ms)",clickedElement:"Clicked element: {selector}{hint}",elementNotFound:"Element not found",optionNotFound:"No matching option found",radioButtonNotFound:"No matching radio button found",formFillComplete:"Form fill complete: {success}/{total} fields succeeded",elementNotFoundShort:"Element not found: {selector}",invalidScrollTarget:"Invalid scroll target or missing selector",scrollComplete:"Scroll complete",elementAppeared:"Element {selector} appeared",elementDisappeared:"Element {selector} disappeared",elementVisible:"Element {selector} is visible",elementHidden:"Element {selector} is hidden",waitTimeout:"Timed out ({timeout}ms); element {selector} did not reach {state} state",noFocusedElement:"No focused element",keyboardInputSuccess:"Keyboard input successful{hint}",fileUploadNotFound:"File upload control not found: {selector}",notFileUploadControl:"The selected element is not a file upload control",fileUploaded:"File uploaded: {fileName}",textRequired:"text cannot be empty",hoveredByText:'Hovered over the {tag} element matching "{text}"{hint}',clickedByText:'Clicked the {tag} element matching "{text}"{hint}',textNotFound:'Text "{text}" does not exist on the page; you may need to perform an action first (e.g. open a dropdown) or the text may be incorrect',textFoundButHidden:'Found text "{text}" but the element is not visible; you may need to open a dropdown panel or scroll to make it visible',textNotClickable:'Found text "{text}" but it is not in a clickable element; use query_elements to inspect the structure or use a selector to locate it',textFoundButNotMatched:'Found text "{text}" in a clickable element but it did not match; the text may be split or have different casing',tagConstraint:" (tag constraint: {tag})",triggerNotFound:"Trigger not found: {selector}",selectedOption:"Selected: {label}",selectOptionNotFound:'No matching option found in <select>: "{option}"',optionContainerNotFound:"Option container not found: {selector}",optionMatchTimeout:'No matching option found within {timeout}ms: "{option}"',setRequiresKeyValue:"Set operation requires both key and value",keySet:"Set {key}",removeRequiresKey:"Remove operation requires a key",keyRemoved:"Removed {key}",storageCleared:"Storage cleared",unknownAction:"Unknown action: {action}"}});async function _o(e,t=300,o=2e3){try{if(!e)return{success:!1,error:d("interactionTools.selectorRequired")};let n=e.trim();for(let[l,s]of[[/^"([\s\S]*)"$/,"$1"],[/^'([\s\S]*)'$/,"$1"],[/^`([\s\S]*)`$/,"$1"],[/^"([\s\S]*)"$/,"$1"],[/^'([\s\S]*)'$/,"$1"],[/^「([\s\S]*)」$/,"$1"]])n=n.replace(l,s);let a=P(n);if(!a)return{success:!1,error:d("interactionTools.elementNotFoundBySelector",{selector:e})};let i=Y();a.click();let r=await X(i,t,o);return{success:!0,message:d("interactionTools.clickedElement",{selector:e,hint:r.changed?d(r.urlChanged?"interactionTools.navChangeHint":"interactionTools.domChangeHint",{ms:r.waitedMs}):""}),...r}}catch(n){return{success:!1,error:n.message}}}function qo(e,t=500){try{let o=[];e.forEach(a=>{let{selector:i,ref:r,value:l,fieldType:s="text"}=a,c=i||`ref=${r}`,u=null;if(r==null?i&&(u=P(i)):u=go(r),!u){o.push({selector:c,success:!1,error:d("interactionTools.elementNotFound")});return}try{if(s==="text"){if(Pt(u)){let p=Me(u,l);o.push({selector:c,success:p,value:l});return}Re(u,l),u.dispatchEvent(new Event("input",{bubbles:!0})),u.dispatchEvent(new Event("change",{bubbles:!0}))}else if(s==="contenteditable"){let p=Me(u,l);o.push({selector:c,success:p,value:l});return}else if(s==="select"){let p=u.querySelector(`option[value="${l}"]`)||Array.from(u.options).find(m=>m.textContent===l);if(p)u.value=p.value,u.dispatchEvent(new Event("change",{bubbles:!0}));else{o.push({selector:c,success:!1,error:d("interactionTools.optionNotFound")});return}}else if(s==="checkbox")u.checked=l==="true"||l===!0,u.dispatchEvent(new Event("change",{bubbles:!0}));else if(s==="radio"){let p=i?P(`${i}[value="${l}"]`):null;if(!p&&!i&&u.tagName==="INPUT"&&u.type==="radio")if(u.value===String(l))p=u;else{let m=u.getAttribute("name");if(m){let h=u.getRootNode();p=Array.from(h.querySelectorAll('input[type="radio"]')).find(g=>g.name===m&&g.value===String(l))||null}}if(p)p.checked=!0,p.dispatchEvent(new Event("change",{bubbles:!0}));else{o.push({selector:c,success:!1,error:d("interactionTools.radioButtonNotFound")});return}}o.push({selector:c,success:!0,value:l})}catch(p){o.push({selector:c,success:!1,error:p.message})}});let n=o.filter(a=>a.success).length;return{success:!0,message:d("interactionTools.formFillComplete",{success:n,total:e.length}),details:o}}catch(o){return{success:!1,error:o.message}}}function Uo(e){try{let{target:t="selector",selector:o,x:n=0,y:a=0,behavior:i="smooth",align:r="center"}=e,l=!1;if(t==="top")l=(window.scrollY||0)<=0&&(document.documentElement.scrollTop||0)<=0,window.scrollTo({top:0,left:0,behavior:i});else if(t==="bottom"){let c=document.scrollingElement||document.documentElement;l=(window.scrollY||0)+(window.innerHeight||0)>=c.scrollHeight-1,window.scrollTo({top:document.body.scrollHeight,left:0,behavior:i})}else if(t==="coordinates")l=Math.abs((window.scrollY||0)-a)<1&&Math.abs((window.scrollX||0)-n)<1,window.scrollTo({top:a,left:n,behavior:i});else if(t==="selector"&&o){let c=P(o);if(!c)return{success:!1,error:d("interactionTools.elementNotFoundShort",{selector:o})};c.scrollIntoView({behavior:i,block:r})}else return{success:!1,error:d("interactionTools.invalidScrollTarget")};let s={success:!0,message:d("interactionTools.scrollComplete")};return l&&(s.moved=!1),s}catch(t){return{success:!1,error:t.message}}}function xt(e){if(!e)return!1;if(e.offsetParent===null&&e.tagName!=="BODY"){let i=window.getComputedStyle(e);if(i.display==="none"||i.visibility==="hidden"||i.position!=="fixed")return!1}let t=window.getComputedStyle(e);if(t.display==="none"||t.visibility==="hidden"||parseFloat(t.opacity)<=0)return!1;let o=e.getBoundingClientRect();if(o.width<=0||o.height<=0)return!1;let n=window.innerHeight||document.documentElement.clientHeight,a=window.innerWidth||document.documentElement.clientWidth;return o.top<n&&o.bottom>0&&o.left<a&&o.right>0}function Ko(e,t="appeared",o=1e4){return new Promise((n,a)=>{let i=Date.now(),r=()=>{let l=P(e);if(t==="appeared"&&l){n({success:!0,message:d("interactionTools.elementAppeared",{selector:e}),element:e});return}if(t==="disappeared"&&!l){n({success:!0,message:d("interactionTools.elementDisappeared",{selector:e})});return}if(t==="visible"&&l&&xt(l)){n({success:!0,message:d("interactionTools.elementVisible",{selector:e}),element:e});return}if(t==="hidden"&&(!l||!xt(l))){n({success:!0,message:d("interactionTools.elementHidden",{selector:e})});return}if(Date.now()-i>o){n({success:!1,error:d("interactionTools.waitTimeout",{timeout:o,selector:e,state:t})});return}setTimeout(r,100)};r()})}var vt={enter:{code:"Enter",keyCode:13},escape:{code:"Escape",keyCode:27},esc:{code:"Escape",keyCode:27},tab:{code:"Tab",keyCode:9},backspace:{code:"Backspace",keyCode:8},delete:{code:"Delete",keyCode:46},arrowup:{code:"ArrowUp",keyCode:38},arrowdown:{code:"ArrowDown",keyCode:40},arrowleft:{code:"ArrowLeft",keyCode:37},arrowright:{code:"ArrowRight",keyCode:39},home:{code:"Home",keyCode:36},end:{code:"End",keyCode:35},pageup:{code:"PageUp",keyCode:33},pagedown:{code:"PageDown",keyCode:34},space:{code:"Space",keyCode:32}};function $o(e){let t=e.toLowerCase();if(vt[t])return vt[t];if(e.length===1&&/[a-zA-Z]/.test(e))return{code:`Key${e.toUpperCase()}`,keyCode:e.toUpperCase().charCodeAt(0)};if(e.length===1&&/[0-9]/.test(e))return{code:`Digit${e}`,keyCode:e.charCodeAt(0)};let o=e.match(/^F([1-9]|1[0-2])$/i);if(o){let n=parseInt(o[1],10);return{code:`F${n}`,keyCode:111+n}}return{code:e,keyCode:e.toUpperCase().charCodeAt(0)}}async function zo({key:e,text:t,ctrlKey:o=!1,shiftKey:n=!1,altKey:a=!1}){try{let i=document.activeElement;if(!i)return{success:!1,error:d("interactionTools.noFocusedElement")};let r=Y();if(t){let s=i.tagName==="INPUT"||i.tagName==="TEXTAREA",c=i.isContentEditable;if(s||c){if(i.focus(),c)try{document.execCommand("selectAll",!1,null),document.execCommand("insertText",!1,t)}catch{i.textContent+=t}else Re(i,i.value+t);try{i.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!0,inputType:"insertText",data:t}))}catch{i.dispatchEvent(new Event("input",{bubbles:!0}))}i.dispatchEvent(new Event("change",{bubbles:!0}))}}if(e){let s=$o(e),c={key:e,code:s.code,keyCode:s.keyCode,which:s.keyCode,bubbles:!0,cancelable:!0,ctrlKey:o,shiftKey:n,altKey:a};document.activeElement.dispatchEvent(new KeyboardEvent("keydown",c)),document.activeElement.dispatchEvent(new KeyboardEvent("keypress",c)),document.activeElement.dispatchEvent(new KeyboardEvent("keyup",c))}let l=await X(r,300,2e3);return{success:!0,message:d("interactionTools.keyboardInputSuccess",{hint:l.changed?d(l.urlChanged?"interactionTools.navChangeHint":"interactionTools.domChangeHint",{ms:l.waitedMs}):""}),...l}}catch(i){return{success:!1,error:i.message}}}function Go(e,t,o,n="application/octet-stream"){try{let a=P(e);if(!a)return{success:!1,error:d("interactionTools.fileUploadNotFound",{selector:e})};if(a.type!=="file")return{success:!1,error:d("interactionTools.notFileUploadControl")};let i;try{let s=atob(o),c=new Uint8Array(s.length);for(let u=0;u<s.length;u++)c[u]=s.charCodeAt(u);i=new Blob([c],{type:n})}catch{i=new Blob([o],{type:n})}let r=new File([i],t,{type:n}),l=new DataTransfer;return l.items.add(r),a.files=l.files,a.dispatchEvent(new Event("change",{bubbles:!0})),{success:!0,message:d("interactionTools.fileUploaded",{fileName:t})}}catch(a){return{success:!1,error:a.message}}}async function Wo(e,t={}){let{tag:o,action:n="click",waitTime:a=300,timeout:i=2e3}=t;if(!e)return{success:!1,error:d("interactionTools.textRequired")};let r=o?[o]:["button",'[role="button"]','input[type="submit"]','input[type="button"]',"a[href]",'[role="menuitem"]','[role="menuitemradio"]','[role="menuitemcheckbox"]','[role="option"]','[role="tab"]',"[onclick]","summary","li"],l=e.toLowerCase();for(let m of r){let h=[];try{h=te(m)}catch{continue}for(let g of h){let b=(g.textContent||g.value||"").trim();if(!b)continue;let x=b.toLowerCase();if(b===e||x===l||x.includes(l)){let v=window.getComputedStyle(g);if(v.display==="none"||v.visibility==="hidden"||parseFloat(v.opacity)<=0)continue;let S=xe(g),I=Y();if(n==="hover"){g.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0,cancelable:!0,view:window})),g.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0,cancelable:!0,view:window}));let G=await X(I,a,i),C=G.changed?d(G.urlChanged?"interactionTools.navChangeHint":"interactionTools.domChangeHint",{ms:G.waitedMs}):"";return{success:!0,message:d("interactionTools.hoveredByText",{text:e,tag:g.tagName.toLowerCase(),hint:C}),selector:S,matchedText:b.substring(0,100),...G}}g.click();let O=await X(I,a,i),ae=O.changed?d(O.urlChanged?"interactionTools.navChangeHint":"interactionTools.domChangeHint",{ms:O.waitedMs}):"";return{success:!0,message:d("interactionTools.clickedByText",{text:e,tag:g.tagName.toLowerCase(),hint:ae}),selector:S,matchedText:b.substring(0,100),...O}}}}let s=!1,c=!1,u=!1;try{let m=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null);for(;m.nextNode();)if((m.currentNode.textContent||"").toLowerCase().includes(l)){s=!0;let h=m.currentNode.parentElement;if(h){let g=window.getComputedStyle(h);(g.display==="none"||g.visibility==="hidden"||parseFloat(g.opacity)<=0)&&(c=!0),h.closest('button, [role="button"], [role="option"], [role="tab"], li, a[href], [onclick], summary, [tabindex]')||(u=!0)}break}}catch{}let p;return p=d(s?c?"interactionTools.textFoundButHidden":u?"interactionTools.textNotClickable":"interactionTools.textFoundButNotMatched":"interactionTools.textNotFound",{text:e}),{success:!1,error:p+(o?d("interactionTools.tagConstraint",{tag:o}):"")}}function jo(e,t,o=null,n=5e3){return new Promise(async a=>{try{let i=P(e);if(!i){a({success:!1,error:d("interactionTools.triggerNotFound",{selector:e})});return}if(i.tagName==="SELECT"){let c=i.options;for(let u=0;u<c.length;u++){let p=c[u],m=(p.textContent||p.label||"").trim();if(m===t||m.includes(t)){i.value=p.value,i.dispatchEvent(new Event("change",{bubbles:!0})),i.dispatchEvent(new Event("input",{bubbles:!0})),a({success:!0,message:d("interactionTools.selectedOption",{label:m}),triggerTag:"SELECT"});return}}a({success:!1,error:d("interactionTools.selectOptionNotFound",{option:t}),availableOptions:Array.from(c).map(u=>u.textContent?.trim()).filter(Boolean)});return}i.click(),await new Promise(c=>setTimeout(c,300));let r=Date.now(),l=o?P(o):document;if(!l){a({success:!1,error:d("interactionTools.optionContainerNotFound",{selector:o})});return}let s=null;for(;Date.now()-r<n;){let c=te('li, [role="option"], [role="menuitem"], .option, .dropdown-item, .select-item, [data-value], div',l);for(let u of c){let p=(u.textContent||"").trim();if(!(p.length<2)&&(p===t||p.includes(t)||p.replace(/\s+/g,"")===t.replace(/\s+/g,""))){s=u;break}}if(s)break;await new Promise(u=>setTimeout(u,100))}if(!s){a({success:!1,error:d("interactionTools.optionMatchTimeout",{timeout:n,option:t})});return}s.click(),a({success:!0,message:d("interactionTools.selectedOption",{label:s.textContent?.trim()}),triggerTag:i.tagName})}catch(i){a({success:!1,error:i.message})}})}function Vo({action:e,storage:t,key:o,value:n}){try{let a=t==="session"?sessionStorage:localStorage;switch(e){case"get":if(!o){let r={};for(let l=0;l<a.length;l++){let s=a.key(l);r[s]=a.getItem(s)}return{success:!0,content:JSON.stringify(r),data:r}}let i=a.getItem(o);return{success:!0,content:JSON.stringify({key:o,value:i}),value:i};case"set":return!o||n===void 0?{success:!1,error:d("interactionTools.setRequiresKeyValue")}:(a.setItem(o,n),{success:!0,message:d("interactionTools.keySet",{key:o})});case"remove":return o?(a.removeItem(o),{success:!0,message:d("interactionTools.keyRemoved",{key:o})}):{success:!1,error:d("interactionTools.removeRequiresKey")};case"clear":return a.clear(),{success:!0,message:d("interactionTools.storageCleared")};default:return{success:!1,error:d("interactionTools.unknownAction",{action:e})}}}catch(a){return{success:!1,error:a.message}}}A("zh",{advancedTools:{close:"\u5173\u95ED",qrcodeLibNotLoaded:"QRCode \u5E93\u672A\u52A0\u8F7D\uFF0C\u5DF2\u4F7F\u7528 SVG \u964D\u7EA7\u65B9\u6848\u751F\u6210",qrcodeLibAndFallbackUnavailable:"\u4E8C\u7EF4\u7801\u5E93\u672A\u52A0\u8F7D\u4E14\u964D\u7EA7\u65B9\u6848\u4E0D\u53EF\u7528",targetElementNotFound:"\u672A\u627E\u5230\u76EE\u6807\u5143\u7D20",screenshotFailed:"\u622A\u56FE\u5931\u8D25",cssParamRequired:"css \u53C2\u6570\u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32",unsupportedInjectMode:"\u4E0D\u652F\u6301\u7684 injectMode: {mode}\uFF0C\u652F\u6301 'style' \u6216 'inline'"}}),A("en",{advancedTools:{close:"Close",qrcodeLibNotLoaded:"QRCode library not loaded, used SVG fallback",qrcodeLibAndFallbackUnavailable:"QRCode library not loaded and fallback unavailable",targetElementNotFound:"Target element not found",screenshotFailed:"Screenshot failed",cssParamRequired:"css parameter must be a non-empty string",unsupportedInjectMode:"Unsupported injectMode: {mode}; supported: 'style' or 'inline'"}});function Qo(e,t){try{let o=document.createElement("canvas");o.width=t,o.height=t;let n=o.getContext("2d");n.fillStyle="#FFFFFF",n.fillRect(0,0,t,t);let a=[];for(let p=0;p<e.length;p++)a.push(e.charCodeAt(p));let i=Math.max(2,Math.floor(t/41)),r=Math.floor(t/i),l=Math.floor((t-r*i)/2);n.fillStyle="#000000";let s=(p,m)=>{let h=7*i;n.fillRect(p,m,h,h),n.fillStyle="#FFFFFF",n.fillRect(p+i,m+i,h-2*i,h-2*i),n.fillStyle="#000000",n.fillRect(p+2*i,m+2*i,h-4*i,h-4*i),n.fillStyle="#000000"};s(l,l),s(l+(r-7)*i,l),s(l,l+(r-7)*i);let c=0;for(let p=0;p<e.length;p++)c=(c<<5)-c+e.charCodeAt(p),c|=0;let u=p=>{let m=p+1831565813;return m=Math.imul(m^m>>>15,m|1),m^=m+Math.imul(m^m>>>7,m|61),((m^m>>>14)>>>0)/4294967296};for(let p=0;p<r;p++)for(let m=0;m<r;m++){let h=p<8&&m<8,g=p<8&&m>=r-8,b=p>=r-8&&m<8;h||g||b||u(c+p*r+m)>.5&&n.fillRect(l+m*i,l+p*i,i,i)}return o.toDataURL("image/png")}catch{return null}}function Yo(e="",t=200,o="M",n=!0){return new Promise(a=>{try{let i=e||window.location.href,r=document.createElement("div");r.id="ai-helper-qrcode",r.style.cssText=`
90
+ `,document.head.appendChild(o);let n=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,!1),a=[],i;for(;i=n.nextNode();)i.nodeValue.toLowerCase().includes(e.toLowerCase())&&a.push(i);let r=[];return a.forEach(l=>{let s=l.parentNode;if(!s||!s.replaceChild||!s.insertBefore)return;let c=l.nodeValue,u=c.toLowerCase(),p=c.toLowerCase(),m=u.indexOf(p);if(m!==-1){let h=document.createElement("span");h.className="ai-helper-highlight",h.textContent=c.substring(m,m+c.length);let g=document.createTextNode(c.substring(0,m)),y=document.createTextNode(c.substring(m+c.length));s.replaceChild(y,l),s.insertBefore(h,y),s.insertBefore(g,h),r.push(h)}}),r.length>0&&r[0].scrollIntoView({behavior:"smooth",block:"center"}),{success:!0,message:d("pageTools.highlightedCount",{count:r.length}),count:r.length}}catch(o){return{success:!1,error:o.message}}}A("zh",{interactionTools:{selectorRequired:"\u9009\u62E9\u5668\u4E0D\u80FD\u4E3A\u7A7A",elementNotFoundBySelector:"\u672A\u627E\u5230\u5339\u914D\u9009\u62E9\u5668\u7684\u5143\u7D20: {selector}",navChangeHint:"\uFF08\u68C0\u6D4B\u5230\u5BFC\u822A\u53D8\u5316\uFF0C\u5DF2\u7B49\u5F85 {ms}ms\uFF09",domChangeHint:"\uFF08\u68C0\u6D4B\u5230DOM\u53D8\u5316\uFF0C\u5DF2\u7B49\u5F85 {ms}ms\uFF09",clickedElement:"\u5DF2\u70B9\u51FB\u5143\u7D20: {selector}{hint}",elementNotFound:"\u672A\u627E\u5230\u5143\u7D20",optionNotFound:"\u672A\u627E\u5230\u5339\u914D\u7684\u9009\u9879",radioButtonNotFound:"\u672A\u627E\u5230\u5339\u914D\u7684\u5355\u9009\u6309\u94AE",formFillComplete:"\u8868\u5355\u586B\u5145\u5B8C\u6210\uFF0C\u6210\u529F {success}/{total} \u4E2A\u5B57\u6BB5",elementNotFoundShort:"\u672A\u627E\u5230\u5143\u7D20: {selector}",invalidScrollTarget:"\u65E0\u6548\u7684\u6EDA\u52A8\u76EE\u6807\u6216\u7F3A\u5C11\u9009\u62E9\u5668",scrollComplete:"\u6EDA\u52A8\u5B8C\u6210",elementAppeared:"\u5143\u7D20 {selector} \u5DF2\u51FA\u73B0",elementDisappeared:"\u5143\u7D20 {selector} \u5DF2\u6D88\u5931",elementVisible:"\u5143\u7D20 {selector} \u5DF2\u53EF\u89C1",elementHidden:"\u5143\u7D20 {selector} \u5DF2\u9690\u85CF",waitTimeout:"\u7B49\u5F85\u8D85\u65F6\uFF08{timeout}ms\uFF09\uFF0C\u5143\u7D20 {selector} \u672A\u8FBE\u5230 {state} \u72B6\u6001",noFocusedElement:"\u6CA1\u6709\u805A\u7126\u7684\u5143\u7D20",keyboardInputSuccess:"\u952E\u76D8\u8F93\u5165\u6210\u529F{hint}",fileUploadNotFound:"\u672A\u627E\u5230\u6587\u4EF6\u4E0A\u4F20\u63A7\u4EF6: {selector}",notFileUploadControl:"\u9009\u62E9\u7684\u5143\u7D20\u4E0D\u662F\u6587\u4EF6\u4E0A\u4F20\u63A7\u4EF6",fileUploaded:"\u5DF2\u4E0A\u4F20\u6587\u4EF6: {fileName}",textRequired:"text \u4E0D\u80FD\u4E3A\u7A7A",hoveredByText:'\u5DF2\u60AC\u505C\u6587\u672C"{text}"\u5BF9\u5E94\u7684{tag}\u5143\u7D20{hint}',clickedByText:'\u5DF2\u70B9\u51FB\u6587\u672C"{text}"\u5BF9\u5E94\u7684{tag}\u5143\u7D20{hint}',textNotFound:'\u9875\u9762\u4E2D\u4E0D\u5B58\u5728\u6587\u672C"{text}"\uFF0C\u53EF\u80FD\u9700\u8981\u5148\u64CD\u4F5C\uFF08\u5982\u6253\u5F00\u4E0B\u62C9\u9762\u677F\uFF09\u6216\u6587\u672C\u6709\u8BEF',textFoundButHidden:'\u627E\u5230\u6587\u672C"{text}"\u4F46\u5143\u7D20\u4E0D\u53EF\u89C1\uFF0C\u53EF\u80FD\u9700\u8981\u5148\u6253\u5F00\u4E0B\u62C9\u9762\u677F/\u6EDA\u52A8\u5230\u53EF\u89C1\u533A\u57DF',textNotClickable:'\u627E\u5230\u6587\u672C"{text}"\u4F46\u4E0D\u5728\u53EF\u70B9\u51FB\u5143\u7D20\u4E2D\uFF0C\u8BF7\u7528 query_elements \u67E5\u770B\u5B9E\u9645\u7ED3\u6784\u6216\u7528 selector \u5B9A\u4F4D',textFoundButNotMatched:'\u627E\u5230\u6587\u672C"{text}"\u5728\u53EF\u70B9\u51FB\u5143\u7D20\u4E2D\u4F46\u672A\u5339\u914D\uFF0C\u53EF\u80FD\u6587\u672C\u88AB\u5206\u5272\u6216\u5927\u5C0F\u5199\u4E0D\u4E00\u81F4',tagConstraint:"\uFF08\u9650\u5B9A\u6807\u7B7E: {tag}\uFF09",triggerNotFound:"\u672A\u627E\u5230\u89E6\u53D1\u5668: {selector}",selectedOption:"\u5DF2\u9009\u62E9: {label}",selectOptionNotFound:'\u5728 <select> \u4E2D\u672A\u627E\u5230\u5339\u914D\u7684\u9009\u9879: "{option}"',optionContainerNotFound:"\u672A\u627E\u5230\u9009\u9879\u5BB9\u5668: {selector}",optionMatchTimeout:'\u5728 {timeout}ms \u5185\u672A\u627E\u5230\u5339\u914D\u9009\u9879: "{option}"',setRequiresKeyValue:"set\u64CD\u4F5C\u9700\u8981\u63D0\u4F9Bkey\u548Cvalue",keySet:"\u5DF2\u8BBE\u7F6E {key}",removeRequiresKey:"remove\u64CD\u4F5C\u9700\u8981\u63D0\u4F9Bkey",keyRemoved:"\u5DF2\u5220\u9664 {key}",storageCleared:"\u5DF2\u6E05\u7A7A\u5B58\u50A8",unknownAction:"\u672A\u77E5\u64CD\u4F5C: {action}"}}),A("en",{interactionTools:{selectorRequired:"Selector cannot be empty",elementNotFoundBySelector:"No element found matching selector: {selector}",navChangeHint:" (navigation change detected, waited {ms}ms)",domChangeHint:" (DOM change detected, waited {ms}ms)",clickedElement:"Clicked element: {selector}{hint}",elementNotFound:"Element not found",optionNotFound:"No matching option found",radioButtonNotFound:"No matching radio button found",formFillComplete:"Form fill complete: {success}/{total} fields succeeded",elementNotFoundShort:"Element not found: {selector}",invalidScrollTarget:"Invalid scroll target or missing selector",scrollComplete:"Scroll complete",elementAppeared:"Element {selector} appeared",elementDisappeared:"Element {selector} disappeared",elementVisible:"Element {selector} is visible",elementHidden:"Element {selector} is hidden",waitTimeout:"Timed out ({timeout}ms); element {selector} did not reach {state} state",noFocusedElement:"No focused element",keyboardInputSuccess:"Keyboard input successful{hint}",fileUploadNotFound:"File upload control not found: {selector}",notFileUploadControl:"The selected element is not a file upload control",fileUploaded:"File uploaded: {fileName}",textRequired:"text cannot be empty",hoveredByText:'Hovered over the {tag} element matching "{text}"{hint}',clickedByText:'Clicked the {tag} element matching "{text}"{hint}',textNotFound:'Text "{text}" does not exist on the page; you may need to perform an action first (e.g. open a dropdown) or the text may be incorrect',textFoundButHidden:'Found text "{text}" but the element is not visible; you may need to open a dropdown panel or scroll to make it visible',textNotClickable:'Found text "{text}" but it is not in a clickable element; use query_elements to inspect the structure or use a selector to locate it',textFoundButNotMatched:'Found text "{text}" in a clickable element but it did not match; the text may be split or have different casing',tagConstraint:" (tag constraint: {tag})",triggerNotFound:"Trigger not found: {selector}",selectedOption:"Selected: {label}",selectOptionNotFound:'No matching option found in <select>: "{option}"',optionContainerNotFound:"Option container not found: {selector}",optionMatchTimeout:'No matching option found within {timeout}ms: "{option}"',setRequiresKeyValue:"Set operation requires both key and value",keySet:"Set {key}",removeRequiresKey:"Remove operation requires a key",keyRemoved:"Removed {key}",storageCleared:"Storage cleared",unknownAction:"Unknown action: {action}"}});async function Vo(e,t=300,o=2e3){try{if(!e)return{success:!1,error:d("interactionTools.selectorRequired")};let n=e.trim();for(let[l,s]of[[/^"([\s\S]*)"$/,"$1"],[/^'([\s\S]*)'$/,"$1"],[/^`([\s\S]*)`$/,"$1"],[/^"([\s\S]*)"$/,"$1"],[/^'([\s\S]*)'$/,"$1"],[/^「([\s\S]*)」$/,"$1"]])n=n.replace(l,s);let a=P(n);if(!a)return{success:!1,error:d("interactionTools.elementNotFoundBySelector",{selector:e})};let i=Z();a.click();let r=await J(i,t,o);return{success:!0,message:d("interactionTools.clickedElement",{selector:e,hint:r.changed?d(r.urlChanged?"interactionTools.navChangeHint":"interactionTools.domChangeHint",{ms:r.waitedMs}):""}),...r}}catch(n){return{success:!1,error:n.message}}}function jo(e,t=500){try{let o=[];e.forEach(a=>{let{selector:i,ref:r,value:l,fieldType:s="text"}=a,c=i||`ref=${r}`,u=null;if(r==null?i&&(u=P(i)):u=To(r),!u){o.push({selector:c,success:!1,error:d("interactionTools.elementNotFound")});return}try{if(s==="text"){if(Bt(u)){let p=He(u,l);o.push({selector:c,success:p,value:l});return}Fe(u,l),u.dispatchEvent(new Event("input",{bubbles:!0})),u.dispatchEvent(new Event("change",{bubbles:!0}))}else if(s==="contenteditable"){let p=He(u,l);o.push({selector:c,success:p,value:l});return}else if(s==="select"){let p=u.querySelector(`option[value="${l}"]`)||Array.from(u.options).find(m=>m.textContent===l);if(p)u.value=p.value,u.dispatchEvent(new Event("change",{bubbles:!0}));else{o.push({selector:c,success:!1,error:d("interactionTools.optionNotFound")});return}}else if(s==="checkbox")u.checked=l==="true"||l===!0,u.dispatchEvent(new Event("change",{bubbles:!0}));else if(s==="radio"){let p=i?P(`${i}[value="${l}"]`):null;if(!p&&!i&&u.tagName==="INPUT"&&u.type==="radio")if(u.value===String(l))p=u;else{let m=u.getAttribute("name");if(m){let h=u.getRootNode();p=Array.from(h.querySelectorAll('input[type="radio"]')).find(g=>g.name===m&&g.value===String(l))||null}}if(p)p.checked=!0,p.dispatchEvent(new Event("change",{bubbles:!0}));else{o.push({selector:c,success:!1,error:d("interactionTools.radioButtonNotFound")});return}}o.push({selector:c,success:!0,value:l})}catch(p){o.push({selector:c,success:!1,error:p.message})}});let n=o.filter(a=>a.success).length;return{success:!0,message:d("interactionTools.formFillComplete",{success:n,total:e.length}),details:o}}catch(o){return{success:!1,error:o.message}}}function Qo(e){try{let{target:t="selector",selector:o,x:n=0,y:a=0,behavior:i="smooth",align:r="center"}=e,l=!1;if(t==="top")l=(window.scrollY||0)<=0&&(document.documentElement.scrollTop||0)<=0,window.scrollTo({top:0,left:0,behavior:i});else if(t==="bottom"){let c=document.scrollingElement||document.documentElement;l=(window.scrollY||0)+(window.innerHeight||0)>=c.scrollHeight-1,window.scrollTo({top:document.body.scrollHeight,left:0,behavior:i})}else if(t==="coordinates")l=Math.abs((window.scrollY||0)-a)<1&&Math.abs((window.scrollX||0)-n)<1,window.scrollTo({top:a,left:n,behavior:i});else if(t==="selector"&&o){let c=P(o);if(!c)return{success:!1,error:d("interactionTools.elementNotFoundShort",{selector:o})};c.scrollIntoView({behavior:i,block:r})}else return{success:!1,error:d("interactionTools.invalidScrollTarget")};let s={success:!0,message:d("interactionTools.scrollComplete")};return l&&(s.moved=!1),s}catch(t){return{success:!1,error:t.message}}}function Et(e){if(!e)return!1;if(e.offsetParent===null&&e.tagName!=="BODY"){let i=window.getComputedStyle(e);if(i.display==="none"||i.visibility==="hidden"||i.position!=="fixed")return!1}let t=window.getComputedStyle(e);if(t.display==="none"||t.visibility==="hidden"||parseFloat(t.opacity)<=0)return!1;let o=e.getBoundingClientRect();if(o.width<=0||o.height<=0)return!1;let n=window.innerHeight||document.documentElement.clientHeight,a=window.innerWidth||document.documentElement.clientWidth;return o.top<n&&o.bottom>0&&o.left<a&&o.right>0}function Yo(e,t="appeared",o=1e4){return new Promise((n,a)=>{let i=Date.now(),r=()=>{let l=P(e);if(t==="appeared"&&l){n({success:!0,message:d("interactionTools.elementAppeared",{selector:e}),element:e});return}if(t==="disappeared"&&!l){n({success:!0,message:d("interactionTools.elementDisappeared",{selector:e})});return}if(t==="visible"&&l&&Et(l)){n({success:!0,message:d("interactionTools.elementVisible",{selector:e}),element:e});return}if(t==="hidden"&&(!l||!Et(l))){n({success:!0,message:d("interactionTools.elementHidden",{selector:e})});return}if(Date.now()-i>o){n({success:!1,error:d("interactionTools.waitTimeout",{timeout:o,selector:e,state:t})});return}setTimeout(r,100)};r()})}var It={enter:{code:"Enter",keyCode:13},escape:{code:"Escape",keyCode:27},esc:{code:"Escape",keyCode:27},tab:{code:"Tab",keyCode:9},backspace:{code:"Backspace",keyCode:8},delete:{code:"Delete",keyCode:46},arrowup:{code:"ArrowUp",keyCode:38},arrowdown:{code:"ArrowDown",keyCode:40},arrowleft:{code:"ArrowLeft",keyCode:37},arrowright:{code:"ArrowRight",keyCode:39},home:{code:"Home",keyCode:36},end:{code:"End",keyCode:35},pageup:{code:"PageUp",keyCode:33},pagedown:{code:"PageDown",keyCode:34},space:{code:"Space",keyCode:32}};function Xo(e){let t=e.toLowerCase();if(It[t])return It[t];if(e.length===1&&/[a-zA-Z]/.test(e))return{code:`Key${e.toUpperCase()}`,keyCode:e.toUpperCase().charCodeAt(0)};if(e.length===1&&/[0-9]/.test(e))return{code:`Digit${e}`,keyCode:e.charCodeAt(0)};let o=e.match(/^F([1-9]|1[0-2])$/i);if(o){let n=parseInt(o[1],10);return{code:`F${n}`,keyCode:111+n}}return{code:e,keyCode:e.toUpperCase().charCodeAt(0)}}async function Zo({key:e,text:t,ctrlKey:o=!1,shiftKey:n=!1,altKey:a=!1}){try{let i=document.activeElement;if(!i)return{success:!1,error:d("interactionTools.noFocusedElement")};let r=Z();if(t){let s=i.tagName==="INPUT"||i.tagName==="TEXTAREA",c=i.isContentEditable;if(s||c){if(i.focus(),c)try{document.execCommand("selectAll",!1,null),document.execCommand("insertText",!1,t)}catch{i.textContent+=t}else Fe(i,i.value+t);try{i.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!0,inputType:"insertText",data:t}))}catch{i.dispatchEvent(new Event("input",{bubbles:!0}))}i.dispatchEvent(new Event("change",{bubbles:!0}))}}if(e){let s=Xo(e),c={key:e,code:s.code,keyCode:s.keyCode,which:s.keyCode,bubbles:!0,cancelable:!0,ctrlKey:o,shiftKey:n,altKey:a};document.activeElement.dispatchEvent(new KeyboardEvent("keydown",c)),document.activeElement.dispatchEvent(new KeyboardEvent("keypress",c)),document.activeElement.dispatchEvent(new KeyboardEvent("keyup",c))}let l=await J(r,300,2e3);return{success:!0,message:d("interactionTools.keyboardInputSuccess",{hint:l.changed?d(l.urlChanged?"interactionTools.navChangeHint":"interactionTools.domChangeHint",{ms:l.waitedMs}):""}),...l}}catch(i){return{success:!1,error:i.message}}}function Jo(e,t,o,n="application/octet-stream"){try{let a=P(e);if(!a)return{success:!1,error:d("interactionTools.fileUploadNotFound",{selector:e})};if(a.type!=="file")return{success:!1,error:d("interactionTools.notFileUploadControl")};let i;try{let s=atob(o),c=new Uint8Array(s.length);for(let u=0;u<s.length;u++)c[u]=s.charCodeAt(u);i=new Blob([c],{type:n})}catch{i=new Blob([o],{type:n})}let r=new File([i],t,{type:n}),l=new DataTransfer;return l.items.add(r),a.files=l.files,a.dispatchEvent(new Event("change",{bubbles:!0})),{success:!0,message:d("interactionTools.fileUploaded",{fileName:t})}}catch(a){return{success:!1,error:a.message}}}async function en(e,t={}){let{tag:o,action:n="click",waitTime:a=300,timeout:i=2e3}=t;if(!e)return{success:!1,error:d("interactionTools.textRequired")};let r=o?[o]:["button",'[role="button"]','input[type="submit"]','input[type="button"]',"a[href]",'[role="menuitem"]','[role="menuitemradio"]','[role="menuitemcheckbox"]','[role="option"]','[role="tab"]',"[onclick]","summary","li"],l=e.toLowerCase();for(let m of r){let h=[];try{h=ne(m)}catch{continue}for(let g of h){let y=(g.textContent||g.value||"").trim();if(!y)continue;let v=y.toLowerCase();if(y===e||v===l||v.includes(l)){let k=window.getComputedStyle(g);if(k.display==="none"||k.visibility==="hidden"||parseFloat(k.opacity)<=0)continue;let S=Se(g),I=Z();if(n==="hover"){g.dispatchEvent(new MouseEvent("mouseover",{bubbles:!0,cancelable:!0,view:window})),g.dispatchEvent(new MouseEvent("mouseenter",{bubbles:!0,cancelable:!0,view:window}));let V=await J(I,a,i),C=V.changed?d(V.urlChanged?"interactionTools.navChangeHint":"interactionTools.domChangeHint",{ms:V.waitedMs}):"";return{success:!0,message:d("interactionTools.hoveredByText",{text:e,tag:g.tagName.toLowerCase(),hint:C}),selector:S,matchedText:y.substring(0,100),...V}}g.click();let B=await J(I,a,i),re=B.changed?d(B.urlChanged?"interactionTools.navChangeHint":"interactionTools.domChangeHint",{ms:B.waitedMs}):"";return{success:!0,message:d("interactionTools.clickedByText",{text:e,tag:g.tagName.toLowerCase(),hint:re}),selector:S,matchedText:y.substring(0,100),...B}}}}let s=!1,c=!1,u=!1;try{let m=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null);for(;m.nextNode();)if((m.currentNode.textContent||"").toLowerCase().includes(l)){s=!0;let h=m.currentNode.parentElement;if(h){let g=window.getComputedStyle(h);(g.display==="none"||g.visibility==="hidden"||parseFloat(g.opacity)<=0)&&(c=!0),h.closest('button, [role="button"], [role="option"], [role="tab"], li, a[href], [onclick], summary, [tabindex]')||(u=!0)}break}}catch{}let p;return p=d(s?c?"interactionTools.textFoundButHidden":u?"interactionTools.textNotClickable":"interactionTools.textFoundButNotMatched":"interactionTools.textNotFound",{text:e}),{success:!1,error:p+(o?d("interactionTools.tagConstraint",{tag:o}):"")}}function tn(e,t,o=null,n=5e3){return new Promise(async a=>{try{let i=P(e);if(!i){a({success:!1,error:d("interactionTools.triggerNotFound",{selector:e})});return}if(i.tagName==="SELECT"){let c=i.options;for(let u=0;u<c.length;u++){let p=c[u],m=(p.textContent||p.label||"").trim();if(m===t||m.includes(t)){i.value=p.value,i.dispatchEvent(new Event("change",{bubbles:!0})),i.dispatchEvent(new Event("input",{bubbles:!0})),a({success:!0,message:d("interactionTools.selectedOption",{label:m}),triggerTag:"SELECT"});return}}a({success:!1,error:d("interactionTools.selectOptionNotFound",{option:t}),availableOptions:Array.from(c).map(u=>u.textContent?.trim()).filter(Boolean)});return}i.click(),await new Promise(c=>setTimeout(c,300));let r=Date.now(),l=o?P(o):document;if(!l){a({success:!1,error:d("interactionTools.optionContainerNotFound",{selector:o})});return}let s=null;for(;Date.now()-r<n;){let c=ne('li, [role="option"], [role="menuitem"], .option, .dropdown-item, .select-item, [data-value], div',l);for(let u of c){let p=(u.textContent||"").trim();if(!(p.length<2)&&(p===t||p.includes(t)||p.replace(/\s+/g,"")===t.replace(/\s+/g,""))){s=u;break}}if(s)break;await new Promise(u=>setTimeout(u,100))}if(!s){a({success:!1,error:d("interactionTools.optionMatchTimeout",{timeout:n,option:t})});return}s.click(),a({success:!0,message:d("interactionTools.selectedOption",{label:s.textContent?.trim()}),triggerTag:i.tagName})}catch(i){a({success:!1,error:i.message})}})}function on({action:e,storage:t,key:o,value:n}){try{let a=t==="session"?sessionStorage:localStorage;switch(e){case"get":if(!o){let r={};for(let l=0;l<a.length;l++){let s=a.key(l);r[s]=a.getItem(s)}return{success:!0,content:JSON.stringify(r),data:r}}let i=a.getItem(o);return{success:!0,content:JSON.stringify({key:o,value:i}),value:i};case"set":return!o||n===void 0?{success:!1,error:d("interactionTools.setRequiresKeyValue")}:(a.setItem(o,n),{success:!0,message:d("interactionTools.keySet",{key:o})});case"remove":return o?(a.removeItem(o),{success:!0,message:d("interactionTools.keyRemoved",{key:o})}):{success:!1,error:d("interactionTools.removeRequiresKey")};case"clear":return a.clear(),{success:!0,message:d("interactionTools.storageCleared")};default:return{success:!1,error:d("interactionTools.unknownAction",{action:e})}}}catch(a){return{success:!1,error:a.message}}}A("zh",{advancedTools:{close:"\u5173\u95ED",qrcodeLibNotLoaded:"QRCode \u5E93\u672A\u52A0\u8F7D\uFF0C\u5DF2\u4F7F\u7528 SVG \u964D\u7EA7\u65B9\u6848\u751F\u6210",qrcodeLibAndFallbackUnavailable:"\u4E8C\u7EF4\u7801\u5E93\u672A\u52A0\u8F7D\u4E14\u964D\u7EA7\u65B9\u6848\u4E0D\u53EF\u7528",targetElementNotFound:"\u672A\u627E\u5230\u76EE\u6807\u5143\u7D20",screenshotFailed:"\u622A\u56FE\u5931\u8D25",cssParamRequired:"css \u53C2\u6570\u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32",unsupportedInjectMode:"\u4E0D\u652F\u6301\u7684 injectMode: {mode}\uFF0C\u652F\u6301 'style' \u6216 'inline'"}}),A("en",{advancedTools:{close:"Close",qrcodeLibNotLoaded:"QRCode library not loaded, used SVG fallback",qrcodeLibAndFallbackUnavailable:"QRCode library not loaded and fallback unavailable",targetElementNotFound:"Target element not found",screenshotFailed:"Screenshot failed",cssParamRequired:"css parameter must be a non-empty string",unsupportedInjectMode:"Unsupported injectMode: {mode}; supported: 'style' or 'inline'"}});function nn(e,t){try{let o=document.createElement("canvas");o.width=t,o.height=t;let n=o.getContext("2d");n.fillStyle="#FFFFFF",n.fillRect(0,0,t,t);let a=[];for(let p=0;p<e.length;p++)a.push(e.charCodeAt(p));let i=Math.max(2,Math.floor(t/41)),r=Math.floor(t/i),l=Math.floor((t-r*i)/2);n.fillStyle="#000000";let s=(p,m)=>{let h=7*i;n.fillRect(p,m,h,h),n.fillStyle="#FFFFFF",n.fillRect(p+i,m+i,h-2*i,h-2*i),n.fillStyle="#000000",n.fillRect(p+2*i,m+2*i,h-4*i,h-4*i),n.fillStyle="#000000"};s(l,l),s(l+(r-7)*i,l),s(l,l+(r-7)*i);let c=0;for(let p=0;p<e.length;p++)c=(c<<5)-c+e.charCodeAt(p),c|=0;let u=p=>{let m=p+1831565813;return m=Math.imul(m^m>>>15,m|1),m^=m+Math.imul(m^m>>>7,m|61),((m^m>>>14)>>>0)/4294967296};for(let p=0;p<r;p++)for(let m=0;m<r;m++){let h=p<8&&m<8,g=p<8&&m>=r-8,y=p>=r-8&&m<8;h||g||y||u(c+p*r+m)>.5&&n.fillRect(l+m*i,l+p*i,i,i)}return o.toDataURL("image/png")}catch{return null}}function an(e="",t=200,o="M",n=!0){return new Promise(a=>{try{let i=e||window.location.href,r=document.createElement("div");r.id="ai-helper-qrcode",r.style.cssText=`
91
91
  position: fixed;
92
92
  top: 50%;
93
93
  left: 50%;
@@ -106,11 +106,12 @@ ${i.slice(1).map(r=>`| ${r.join(" | ")} |`).join(`
106
106
  border: none;
107
107
  border-radius: 20px;
108
108
  cursor: pointer;
109
- `,c.onclick=()=>{document.body.removeChild(r)},r.appendChild(c),typeof QRCode>"u"){let u=Qo(i,t);if(u){let p=document.createElement("img");p.src=u,p.width=t,p.height=t,l.replaceWith(p),n&&document.body.appendChild(r),a({success:!0,content:i,size:t,dataUrl:u,shown:n,fallback:!0,warning:d("advancedTools.qrcodeLibNotLoaded")})}else a({success:!1,error:d("advancedTools.qrcodeLibAndFallbackUnavailable")});return}QRCode.toCanvas(l,i,{width:t,margin:2,color:{dark:"#000000",light:"#ffffff"},errorCorrectionLevel:o.toLowerCase()},u=>{u?a({success:!1,error:u.message}):(n&&document.body.appendChild(r),a({success:!0,content:i,size:t,dataUrl:l.toDataURL("image/png"),shown:n}))})}catch(i){a({success:!1,error:i.message})}})}function Xo(e){return typeof e=="string"?e.replace(/@import\b[^;{}]*;?/gi,"").replace(/url\s*\([^;{}]*\)/gi,"").replace(/expression\s*\([^;{}]*\)/gi,"").replace(/-moz-element\s*\([^;{}]*\)/gi,"").replace(/element\s*\([^;{}]*\)/gi,"").replace(/-moz-binding\b[^;}]*;?/gi,"").replace(/\bbehavior\b[^;}]*;?/gi,""):""}function Zo(e,t=null,o="style"){try{if(!e||typeof e!="string")return{success:!1,error:d("advancedTools.cssParamRequired")};if(e=Xo(e),o!=="style"&&o!=="inline")return{success:!1,error:d("advancedTools.unsupportedInjectMode",{mode:o})};if(o==="style")if(t){let n=document.querySelectorAll(t),a=`ai-helper-scoped-style-${Date.now()}`,i="",r=e.split("}");for(let s of r){let c=s.trim();if(!c)continue;let u=c.indexOf("{");if(u===-1)continue;let p=c.substring(0,u).trim(),m=c.substring(u+1).trim();i+=`#${a} ${p} { ${m} } `}n.forEach(s=>{s.setAttribute("id",a)});let l=document.createElement("style");return l.setAttribute("data-ai-helper","scoped"),l.textContent=i,document.head.appendChild(l),{success:!0,injectMode:"style",scoped:!0,selector:t,hitCount:n.length}}else{let n=document.createElement("style");return n.setAttribute("data-ai-helper","global"),n.textContent=e,document.head.appendChild(n),{success:!0,injectMode:"style",scoped:!1,hitCount:0}}if(o==="inline"){let n=t?document.querySelectorAll(t):document.querySelectorAll("*"),a=0,i={};return e.split(";").forEach(r=>{let l=r.indexOf(":");if(l===-1)return;let s=r.substring(0,l).trim(),c=r.substring(l+1).trim();s&&c&&(i[s]=c)}),n.forEach(r=>{if(r.nodeType===1){for(let[l,s]of Object.entries(i))try{r.style.setProperty(l,s)}catch{}a++}}),{success:!0,injectMode:"inline",selector:t||"*",hitCount:a}}}catch(n){return{success:!1,error:n.message}}}function Ue(e,t){try{return e.querySelector(t),!0}catch{return!1}}function Jo(e,t,o){let n=e.target==null?"":String(e.target);switch(e.check){case"element_exists":return n?Ue(t,n)?{available:!0,pass:!!P(n,t)}:{available:!1,reason:"invalid_selector"}:{available:!1,reason:"empty_target"};case"element_absent":return n?Ue(t,n)?{available:!0,pass:!P(n,t)}:{available:!1,reason:"invalid_selector"}:{available:!1,reason:"empty_target"};case"text_contains":{let a=e.expected==null?e.target==null?"":String(e.target):String(e.expected);return a?{available:!0,pass:(ye(t)||t.body&&t.body.textContent||"").includes(a)}:{available:!1,reason:"missing_expected"}}case"url_matches":{let a=n||(e.expected==null?"":String(e.expected)),i=o&&o.href?String(o.href):"";return a?i?{available:!0,pass:i.includes(a)}:{available:!1,reason:"no_href"}:{available:!1,reason:"empty_target"}}case"attribute_equals":{let a=e.expected==null?"":String(e.expected),i=a.indexOf("=");if(!n)return{available:!1,reason:"empty_target"};if(i<=0)return{available:!1,reason:"missing_expected"};if(!Ue(t,n))return{available:!1,reason:"invalid_selector"};let r=P(n,t);return{available:!0,pass:!!r&&r.getAttribute(a.slice(0,i))===a.slice(i+1)}}default:return{available:!1,reason:"unknown_check"}}}function en(e,t,o){let n=Array.isArray(e)?e:[],a=t||(typeof document<"u"?document:null),i=o||(typeof window<"u"?window.location:null);return a?n.map(r=>{let l;try{l=Jo(r,a,i)}catch{l={available:!1,reason:"eval_error"}}return{id:r.id,check:r.check,pass:l.available?!!l.pass:!1,available:!!l.available,...l.available||!l.reason?{}:{reason:l.reason}}}):n.map(r=>({id:r.id,check:r.check,pass:!1,available:!1,reason:"no_dom"}))}var tn="#aih-selection-toolbar, .aih-overflow-dropdown, #aih-selection-result, .aih-token-popup",on={light:{"bg-elevated":"#ffffff","tb-panel":"rgba(255,255,255,0.96)","tb-fill":"#f5f6f7","tb-hover":"#f0f0f0","tb-active":"#e4e4e4","tb-border":"#e8e8e8","tb-table-border":"#e0e0e0","tb-divider":"#f0f0f0","tb-text":"#2b3038","tb-text-2":"#5a6675","tb-text-3":"#98a1ad","tb-text-muted":"#bbbbbb","tb-accent":"#3b82f6","tb-accent-hover":"#2563eb","tb-accent-soft":"#eff6ff","tb-on-accent":"#ffffff","tb-brand":"#667eea","tb-warning":"#f59e0b","tb-warning-ink":"#b45309","tb-danger":"#e53e3e"},dark:{"bg-elevated":"#262a33","tb-panel":"rgba(28,31,38,0.94)","tb-fill":"#2a2f3a","tb-hover":"#343b48","tb-active":"#414a5a","tb-border":"#363d4a","tb-table-border":"#3f4756","tb-divider":"#2f3542","tb-text":"#e7eaf0","tb-text-2":"#b7becb","tb-text-3":"#79808e","tb-text-muted":"#565d6b","tb-accent":"#6aa1fb","tb-accent-hover":"#4a8bf0","tb-accent-soft":"#1f2c46","tb-on-accent":"#ffffff","tb-brand":"#8da2f2","tb-warning":"#fbbf24","tb-warning-ink":"#d9a441","tb-danger":"#fc8181"}};function nn(e){let t=on[e==="dark"?"dark":"light"];return`${tn}{${Object.keys(t).map(o=>`--${o}:${t[o]};`).join("")}}`}var an=`
109
+ `,c.onclick=()=>{document.body.removeChild(r)},r.appendChild(c),typeof QRCode>"u"){let u=nn(i,t);if(u){let p=document.createElement("img");p.src=u,p.width=t,p.height=t,l.replaceWith(p),n&&document.body.appendChild(r),a({success:!0,content:i,size:t,dataUrl:u,shown:n,fallback:!0,warning:d("advancedTools.qrcodeLibNotLoaded")})}else a({success:!1,error:d("advancedTools.qrcodeLibAndFallbackUnavailable")});return}QRCode.toCanvas(l,i,{width:t,margin:2,color:{dark:"#000000",light:"#ffffff"},errorCorrectionLevel:o.toLowerCase()},u=>{u?a({success:!1,error:u.message}):(n&&document.body.appendChild(r),a({success:!0,content:i,size:t,dataUrl:l.toDataURL("image/png"),shown:n}))})}catch(i){a({success:!1,error:i.message})}})}function rn(e){return typeof e=="string"?e.replace(/@import\b[^;{}]*;?/gi,"").replace(/url\s*\([^;{}]*\)/gi,"").replace(/expression\s*\([^;{}]*\)/gi,"").replace(/-moz-element\s*\([^;{}]*\)/gi,"").replace(/element\s*\([^;{}]*\)/gi,"").replace(/-moz-binding\b[^;}]*;?/gi,"").replace(/\bbehavior\b[^;}]*;?/gi,""):""}function ln(e,t=null,o="style"){try{if(!e||typeof e!="string")return{success:!1,error:d("advancedTools.cssParamRequired")};if(e=rn(e),o!=="style"&&o!=="inline")return{success:!1,error:d("advancedTools.unsupportedInjectMode",{mode:o})};if(o==="style")if(t){let n=document.querySelectorAll(t),a=`ai-helper-scoped-style-${Date.now()}`,i="",r=e.split("}");for(let s of r){let c=s.trim();if(!c)continue;let u=c.indexOf("{");if(u===-1)continue;let p=c.substring(0,u).trim(),m=c.substring(u+1).trim();i+=`#${a} ${p} { ${m} } `}n.forEach(s=>{s.setAttribute("id",a)});let l=document.createElement("style");return l.setAttribute("data-ai-helper","scoped"),l.textContent=i,document.head.appendChild(l),{success:!0,injectMode:"style",scoped:!0,selector:t,hitCount:n.length}}else{let n=document.createElement("style");return n.setAttribute("data-ai-helper","global"),n.textContent=e,document.head.appendChild(n),{success:!0,injectMode:"style",scoped:!1,hitCount:0}}if(o==="inline"){let n=t?document.querySelectorAll(t):document.querySelectorAll("*"),a=0,i={};return e.split(";").forEach(r=>{let l=r.indexOf(":");if(l===-1)return;let s=r.substring(0,l).trim(),c=r.substring(l+1).trim();s&&c&&(i[s]=c)}),n.forEach(r=>{if(r.nodeType===1){for(let[l,s]of Object.entries(i))try{r.style.setProperty(l,s)}catch{}a++}}),{success:!0,injectMode:"inline",selector:t||"*",hitCount:a}}}catch(n){return{success:!1,error:n.message}}}function Qe(e,t){try{return e.querySelector(t),!0}catch{return!1}}function sn(e,t,o){let n=e.target==null?"":String(e.target);switch(e.check){case"element_exists":return n?Qe(t,n)?{available:!0,pass:!!P(n,t)}:{available:!1,reason:"invalid_selector"}:{available:!1,reason:"empty_target"};case"element_absent":return n?Qe(t,n)?{available:!0,pass:!P(n,t)}:{available:!1,reason:"invalid_selector"}:{available:!1,reason:"empty_target"};case"text_contains":{let a=e.expected==null?e.target==null?"":String(e.target):String(e.expected);return a?{available:!0,pass:(ke(t)||t.body&&t.body.textContent||"").includes(a)}:{available:!1,reason:"missing_expected"}}case"url_matches":{let a=n||(e.expected==null?"":String(e.expected)),i=o&&o.href?String(o.href):"";return a?i?{available:!0,pass:i.includes(a)}:{available:!1,reason:"no_href"}:{available:!1,reason:"empty_target"}}case"attribute_equals":{let a=e.expected==null?"":String(e.expected),i=a.indexOf("=");if(!n)return{available:!1,reason:"empty_target"};if(i<=0)return{available:!1,reason:"missing_expected"};if(!Qe(t,n))return{available:!1,reason:"invalid_selector"};let r=P(n,t);return{available:!0,pass:!!r&&r.getAttribute(a.slice(0,i))===a.slice(i+1)}}default:return{available:!1,reason:"unknown_check"}}}function cn(e,t,o){let n=Array.isArray(e)?e:[],a=t||(typeof document<"u"?document:null),i=o||(typeof window<"u"?window.location:null);return a?n.map(r=>{let l;try{l=sn(r,a,i)}catch{l={available:!1,reason:"eval_error"}}return{id:r.id,check:r.check,pass:l.available?!!l.pass:!1,available:!!l.available,...l.available||!l.reason?{}:{reason:l.reason}}}):n.map(r=>({id:r.id,check:r.check,pass:!1,available:!1,reason:"no_dom"}))}var dn="#aih-selection-toolbar, .aih-overflow-dropdown, #aih-selection-result, .aih-token-popup",un={light:{"bg-elevated":"#ffffff","tb-panel":"rgba(255,255,255,0.96)","tb-fill":"#f5f6f7","tb-hover":"#f0f0f0","tb-active":"#e4e4e4","tb-border":"#e8e8e8","tb-table-border":"#e0e0e0","tb-divider":"#f0f0f0","tb-text":"#2b3038","tb-text-2":"#5a6675","tb-text-3":"#98a1ad","tb-text-muted":"#bbbbbb","tb-accent":"#3b82f6","tb-accent-hover":"#2563eb","tb-accent-soft":"#eff6ff","tb-on-accent":"#ffffff","tb-brand":"#667eea","tb-warning":"#f59e0b","tb-warning-ink":"#b45309","tb-danger":"#e53e3e"},dark:{"bg-elevated":"#262a33","tb-panel":"rgba(28,31,38,0.94)","tb-fill":"#2a2f3a","tb-hover":"#343b48","tb-active":"#414a5a","tb-border":"#363d4a","tb-table-border":"#3f4756","tb-divider":"#2f3542","tb-text":"#e7eaf0","tb-text-2":"#b7becb","tb-text-3":"#79808e","tb-text-muted":"#565d6b","tb-accent":"#6aa1fb","tb-accent-hover":"#4a8bf0","tb-accent-soft":"#1f2c46","tb-on-accent":"#ffffff","tb-brand":"#8da2f2","tb-warning":"#fbbf24","tb-warning-ink":"#d9a441","tb-danger":"#fc8181"}};function pn(e){let t=un[e==="dark"?"dark":"light"];return`${dn}{${Object.keys(t).map(o=>`--${o}:${t[o]};`).join("")}}`}var mn=`
110
110
 
111
111
  #aih-selection-toolbar {
112
112
  position: fixed;
113
113
  z-index: 2147483647;
114
+ overflow: visible;
114
115
  display: none;
115
116
  align-items: center;
116
117
  gap: 1px;
@@ -207,6 +208,7 @@ ${i.slice(1).map(r=>`| ${r.join(" | ")} |`).join(`
207
208
  .aih-overflow-dropdown {
208
209
  position: fixed;
209
210
  z-index: 2147483646;
211
+ overflow: visible;
210
212
  background: var(--tb-panel);
211
213
  backdrop-filter: blur(16px);
212
214
  -webkit-backdrop-filter: blur(16px);
@@ -574,6 +576,7 @@ ${i.slice(1).map(r=>`| ${r.join(" | ")} |`).join(`
574
576
  .aih-token-popup {
575
577
  position: fixed;
576
578
  z-index: 2147483647;
579
+ overflow: visible;
577
580
  background: var(--bg-elevated);
578
581
  border-radius: 12px;
579
582
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
@@ -756,8 +759,8 @@ ${i.slice(1).map(r=>`| ${r.join(" | ")} |`).join(`
756
759
  color: var(--tb-accent-hover);
757
760
  }
758
761
 
759
- `;function Ze(e){return nn(e)+`
760
- `+an}function Ot(){if(document.getElementById("aih-selection-toolbar-styles"))return;let e=document.createElement("style");e.id="aih-selection-toolbar-styles",e.textContent=Ze("light"),document.head.appendChild(e)}function rn(e){let t=document.getElementById("aih-selection-toolbar-styles"),o=e==="dark"?"dark":"light";if(t){if(t.dataset.themeApplied===o)return;t.dataset.themeApplied=o,t.textContent=Ze(o);return}Ot();let n=document.getElementById("aih-selection-toolbar-styles");n&&(n.dataset.themeApplied=o,n.textContent=Ze(o))}A("zh",{optionsConst:{aiSearch:"AI\u641C\u7D22",explain:"\u89E3\u91CA",translate:"\u7FFB\u8BD1",summary:"\u603B\u7ED3",copy:"\u590D\u5236"}}),A("en",{optionsConst:{aiSearch:"AI Search",explain:"Explain",translate:"Translate",summary:"Summarize",copy:"Copy"}});var ln={"ai-search":"optionsConst.aiSearch",explain:"optionsConst.explain",translate:"optionsConst.translate",summary:"optionsConst.summary",copy:"optionsConst.copy"};function Se(e){let t=ln[e];return t?d(t):void 0}A("zh",{selToolbar:{settings:"\u8BBE\u7F6E",settingsTitle:"\u6253\u5F00\u914D\u7F6E\u9875\u9762",disableTemporarily:"\u672C\u6B21\u4E34\u65F6\u7981\u7528",disableTemporarilyTitle:"\u6682\u65F6\u9690\u85CF\u76F4\u5230\u9875\u9762\u5237\u65B0",disableOnSite:"\u5728\u6B64\u7F51\u7AD9\u7981\u7528",disableOnSiteTitle:"\u5728\u6B64\u7F51\u7AD9\u7981\u7528\u5DE5\u5177\u680F",dragToMove:"\u62D6\u62FD\u79FB\u52A8",moreTools:"\u66F4\u591A\u5DE5\u5177",copySelectedTitle:"\u590D\u5236\u9009\u4E2D\u5185\u5BB9",askPlaceholder:"\u95EE\u95EE...",sendTitle:"\u53D1\u9001",aiAnswer:"AI \u56DE\u7B54",lockWindow:"\u9501\u5B9A\u7A97\u53E3",unlockWindow:"\u89E3\u9664\u9501\u5B9A",close:"\u5173\u95ED",copyAll:"\u590D\u5236",copyRichTitle:"\u590D\u5236 Markdown \u6587\u672C\uFF08Ctrl/\u2318 + \u5355\u51FB\u590D\u5236\u5BCC\u6587\u672C\uFF09",regenerate:"\u91CD\u65B0\u751F\u6210",suggestedFollowups:"\u{1F4A1} \u63A8\u8350\u8FFD\u95EE",followupPlaceholder:"\u7EE7\u7EED\u63D0\u95EE...",sendToSidebar:"\u53D1\u9001\u5230\u4FA7\u8FB9\u680F",aiThinking:"AI \u6B63\u5728\u601D\u8003...",requestFailed:"\u8BF7\u6C42\u5931\u8D25: {msg}",copyFailed:"\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u590D\u5236",copied:"\u5DF2\u590D\u5236",copiedMarkdown:"\u5DF2\u590D\u5236 Markdown",copiedRich:"\u5DF2\u590D\u5236\u5BCC\u6587\u672C",tokenUsageTitle:"Token \u6D88\u8017\uFF1A\u8F93\u5165 {input} / \u8F93\u51FA {output}\uFF0C\u70B9\u51FB\u67E5\u770B\u660E\u7EC6",tokenPopupTitle:"Token \u6D88\u8017\u660E\u7EC6",tokenPopupTotal:"\u603B\u8BA1",tokenPopupInput:"\u8F93\u5165",tokenPopupOutput:"\u8F93\u51FA",noResponse:"\u65E0\u54CD\u5E94",sysPromptAisearch:"\u4F60\u6B63\u5728\u5904\u7406\u7528\u6237\u5728\u7F51\u9875\u4E0A\u9009\u4E2D\u7684\u5185\u5BB9\u3002\u4F7F\u7528ReAct Agent\u6A21\u5F0F\uFF0C\u901A\u8FC7\u591A\u8F6E\u601D\u8003\u3001\u641C\u7D22\u548C\u63A8\u7406\u6765\u56DE\u7B54\u9009\u4E2D\u7684\u95EE\u9898\u3002",sysPromptExplain:"\u4F60\u6B63\u5728\u5904\u7406\u7528\u6237\u5728\u7F51\u9875\u4E0A\u9009\u4E2D\u7684\u5185\u5BB9\u3002\u75281-3\u53E5\u7B80\u6D01\u89E3\u91CA\u9009\u4E2D\u5185\u5BB9\uFF0C\u5FC5\u8981\u65F6\u8865\u5145\u4E00\u4E2A\u7B80\u77ED\u793A\u4F8B\u3002\u4E0D\u8981\u5C55\u5F00\u957F\u7BC7\u8BBA\u8FF0\u3002",sysPromptTranslate:"\u4F60\u6B63\u5728\u5904\u7406\u7528\u6237\u5728\u7F51\u9875\u4E0A\u9009\u4E2D\u7684\u5185\u5BB9\u3002\u81EA\u52A8\u68C0\u6D4B\u8BED\u8A00\uFF1A\u4E2D\u6587\u2192\u82F1\u6587\uFF0C\u82F1\u6587\u2192\u4E2D\u6587\uFF0C\u5176\u4ED6\u8BED\u8A00\u2192\u540C\u65F6\u7ED9\u51FA\u4E2D\u82F1\u6587\u3002\u53EA\u8F93\u51FA\u7FFB\u8BD1\u7ED3\u679C\uFF0C\u4E0D\u6DFB\u52A0\u989D\u5916\u8BF4\u660E\u3002",sysPromptSummary:"\u4F60\u6B63\u5728\u5904\u7406\u7528\u6237\u5728\u7F51\u9875\u4E0A\u9009\u4E2D\u7684\u5185\u5BB9\u3002\u75283-5\u4E2A\u8981\u70B9\u603B\u7ED3\u9009\u4E2D\u5185\u5BB9\uFF0C\u6BCF\u6761\u8981\u70B9\u4E00\u53E5\u8BDD\uFF0C\u63D0\u70BC\u6838\u5FC3\u4FE1\u606F\u5373\u53EF\u3002",sysPromptCopy:"\u5C06\u9009\u4E2D\u5185\u5BB9\u590D\u5236\u5230\u526A\u8D34\u677F\u3002",userMsgAisearch:`\u641C\u7D22\u5E76\u5206\u6790\u4EE5\u4E0B\u5185\u5BB9\uFF1A
762
+ `;function rt(e){return pn(e)+`
763
+ `+mn}function Gt(){if(document.getElementById("aih-selection-toolbar-styles"))return;let e=document.createElement("style");e.id="aih-selection-toolbar-styles",e.textContent=rt("light"),document.head.appendChild(e)}function hn(e){let t=document.getElementById("aih-selection-toolbar-styles"),o=e==="dark"?"dark":"light";if(t){if(t.dataset.themeApplied===o)return;t.dataset.themeApplied=o,t.textContent=rt(o);return}Gt();let n=document.getElementById("aih-selection-toolbar-styles");n&&(n.dataset.themeApplied=o,n.textContent=rt(o))}A("zh",{optionsConst:{aiSearch:"AI\u641C\u7D22",explain:"\u89E3\u91CA",translate:"\u7FFB\u8BD1",summary:"\u603B\u7ED3",copy:"\u590D\u5236"}}),A("en",{optionsConst:{aiSearch:"AI Search",explain:"Explain",translate:"Translate",summary:"Summarize",copy:"Copy"}});var gn={"ai-search":"optionsConst.aiSearch",explain:"optionsConst.explain",translate:"optionsConst.translate",summary:"optionsConst.summary",copy:"optionsConst.copy"};function Pe(e){let t=gn[e];return t?d(t):void 0}A("zh",{selToolbar:{settings:"\u8BBE\u7F6E",settingsTitle:"\u6253\u5F00\u914D\u7F6E\u9875\u9762",disableTemporarily:"\u672C\u6B21\u4E34\u65F6\u7981\u7528",disableTemporarilyTitle:"\u6682\u65F6\u9690\u85CF\u76F4\u5230\u9875\u9762\u5237\u65B0",disableOnSite:"\u5728\u6B64\u7F51\u7AD9\u7981\u7528",disableOnSiteTitle:"\u5728\u6B64\u7F51\u7AD9\u7981\u7528\u5DE5\u5177\u680F",dragToMove:"\u62D6\u62FD\u79FB\u52A8",moreTools:"\u66F4\u591A\u5DE5\u5177",copySelectedTitle:"\u590D\u5236\u9009\u4E2D\u5185\u5BB9",askPlaceholder:"\u95EE\u95EE...",sendTitle:"\u53D1\u9001",aiAnswer:"AI \u56DE\u7B54",lockWindow:"\u9501\u5B9A\u7A97\u53E3",unlockWindow:"\u89E3\u9664\u9501\u5B9A",close:"\u5173\u95ED",copyAll:"\u590D\u5236",copyRichTitle:"\u590D\u5236 Markdown \u6587\u672C\uFF08Ctrl/\u2318 + \u5355\u51FB\u590D\u5236\u5BCC\u6587\u672C\uFF09",regenerate:"\u91CD\u65B0\u751F\u6210",suggestedFollowups:"\u{1F4A1} \u63A8\u8350\u8FFD\u95EE",followupPlaceholder:"\u7EE7\u7EED\u63D0\u95EE...",sendToSidebar:"\u53D1\u9001\u5230\u4FA7\u8FB9\u680F",aiThinking:"AI \u6B63\u5728\u601D\u8003...",requestFailed:"\u8BF7\u6C42\u5931\u8D25: {msg}",copyFailed:"\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u590D\u5236",copied:"\u5DF2\u590D\u5236",copiedMarkdown:"\u5DF2\u590D\u5236 Markdown",copiedRich:"\u5DF2\u590D\u5236\u5BCC\u6587\u672C",tokenUsageTitle:"Token \u6D88\u8017\uFF1A\u8F93\u5165 {input} / \u8F93\u51FA {output}\uFF0C\u70B9\u51FB\u67E5\u770B\u660E\u7EC6",tokenPopupTitle:"Token \u6D88\u8017\u660E\u7EC6",tokenPopupTotal:"\u603B\u8BA1",tokenPopupInput:"\u8F93\u5165",tokenPopupOutput:"\u8F93\u51FA",noResponse:"\u65E0\u54CD\u5E94",sysPromptAisearch:"\u4F60\u6B63\u5728\u5904\u7406\u7528\u6237\u5728\u7F51\u9875\u4E0A\u9009\u4E2D\u7684\u5185\u5BB9\u3002\u4F7F\u7528ReAct Agent\u6A21\u5F0F\uFF0C\u901A\u8FC7\u591A\u8F6E\u601D\u8003\u3001\u641C\u7D22\u548C\u63A8\u7406\u6765\u56DE\u7B54\u9009\u4E2D\u7684\u95EE\u9898\u3002",sysPromptExplain:"\u4F60\u6B63\u5728\u5904\u7406\u7528\u6237\u5728\u7F51\u9875\u4E0A\u9009\u4E2D\u7684\u5185\u5BB9\u3002\u75281-3\u53E5\u7B80\u6D01\u89E3\u91CA\u9009\u4E2D\u5185\u5BB9\uFF0C\u5FC5\u8981\u65F6\u8865\u5145\u4E00\u4E2A\u7B80\u77ED\u793A\u4F8B\u3002\u4E0D\u8981\u5C55\u5F00\u957F\u7BC7\u8BBA\u8FF0\u3002",sysPromptTranslate:"\u4F60\u6B63\u5728\u5904\u7406\u7528\u6237\u5728\u7F51\u9875\u4E0A\u9009\u4E2D\u7684\u5185\u5BB9\u3002\u81EA\u52A8\u68C0\u6D4B\u8BED\u8A00\uFF1A\u4E2D\u6587\u2192\u82F1\u6587\uFF0C\u82F1\u6587\u2192\u4E2D\u6587\uFF0C\u5176\u4ED6\u8BED\u8A00\u2192\u540C\u65F6\u7ED9\u51FA\u4E2D\u82F1\u6587\u3002\u53EA\u8F93\u51FA\u7FFB\u8BD1\u7ED3\u679C\uFF0C\u4E0D\u6DFB\u52A0\u989D\u5916\u8BF4\u660E\u3002",sysPromptSummary:"\u4F60\u6B63\u5728\u5904\u7406\u7528\u6237\u5728\u7F51\u9875\u4E0A\u9009\u4E2D\u7684\u5185\u5BB9\u3002\u75283-5\u4E2A\u8981\u70B9\u603B\u7ED3\u9009\u4E2D\u5185\u5BB9\uFF0C\u6BCF\u6761\u8981\u70B9\u4E00\u53E5\u8BDD\uFF0C\u63D0\u70BC\u6838\u5FC3\u4FE1\u606F\u5373\u53EF\u3002",sysPromptCopy:"\u5C06\u9009\u4E2D\u5185\u5BB9\u590D\u5236\u5230\u526A\u8D34\u677F\u3002",userMsgAisearch:`\u641C\u7D22\u5E76\u5206\u6790\u4EE5\u4E0B\u5185\u5BB9\uFF1A
761
764
 
762
765
  {text}`,userMsgExplain:`\u75281-3\u53E5\u8BDD\u7B80\u6D01\u89E3\u91CA\u4EE5\u4E0B\u5185\u5BB9\uFF0C\u4E0D\u9700\u8981\u5C55\u5F00\u8BF4\u660E\u3002
763
766
 
@@ -801,7 +804,7 @@ After answering, please provide 3 follow-up questions on a new line in the follo
801
804
  ---SUGGESTIONS---
802
805
  Question 1
803
806
  Question 2
804
- Question 3`}});var T={search:'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>',explain:'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 18h6"/><path d="M10 22h4"/><path d="M12 2a7 7 0 0 0-7 7c0 2.4 1.2 4.5 3 5.7V17h8v-2.3c1.8-1.2 3-3.3 3-5.7a7 7 0 0 0-7-7Z"/></svg>',translate:'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M2 12h20"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>',summary:'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"/><path d="M14 2v6h6"/><path d="M8 13h2"/><path d="M8 17h2"/><path d="M14 13h2"/><path d="M14 17h2"/></svg>',copy:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>',close:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>',sparkle:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/></svg>',lock:'<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>',unlock:'<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/></svg>',copyLarge:'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>',grip:'<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" stroke="none"><circle cx="8" cy="6" r="1.5"/><circle cx="16" cy="6" r="1.5"/><circle cx="8" cy="12" r="1.5"/><circle cx="16" cy="12" r="1.5"/><circle cx="8" cy="18" r="1.5"/><circle cx="16" cy="18" r="1.5"/></svg>',send:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg>',more:'<svg width="15" height="15" viewBox="0 0 24 24" fill="currentColor" stroke="none"><circle cx="12" cy="5" r="2"/><circle cx="12" cy="12" r="2"/><circle cx="12" cy="19" r="2"/></svg>',gear:'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>',refresh:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="23 4 23 10 17 10"/><polyline points="1 20 1 14 7 14"/><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/></svg>',block:'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="4.93" y1="4.93" x2="19.07" y2="19.07"/></svg>',eyeOff:'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19M14.12 14.12a3 3 0 1 1-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>'},y=null,f=null,F=!1,R=!1,Ae="",pe=null,he="",M=!1,$=!1,K="",Le="",Je="",et="",w="",ke=!0,se=[],Bt=!1,ge=!1,_t=0,Z=!1,ee={x:0,y:0},U=null,B=null,kt=5,at=!1,k=null,Q="",Ee=!1,Ne=0,qt=null,tt=!1,Ke=new Set,H=window.top===window;if(!H)try{window.parent===window.top&&window.top.document.querySelector("frameset")&&(H=!0)}catch{}E.debug("[SelectionToolbar] moduleload isTopFrame:",H,"top===window:",window.top===window,"hasBody:",!!document.body,"parent===top:",window.parent===window.top);var D=null;function _(e){(document.body||document.documentElement).appendChild(e)}var N=null;function Ut(e,t){let o=t?e.querySelector(t):e;o&&(o.style.cursor="grab",o.addEventListener("mousedown",n=>{if(n.target.closest('[role="button"]')||n.button!==0)return;n.preventDefault(),n.stopPropagation();let a=e.getBoundingClientRect();N={el:e,startX:n.clientX,startY:n.clientY,startLeft:a.left,startTop:a.top,pointerId:n.pointerId||0},o.style.cursor="grabbing",e.style.transition="none"}))}document.addEventListener("mousemove",e=>{if(!N)return;let t=e.clientX-N.startX,o=e.clientY-N.startY,n=N.startLeft+t,a=N.startTop+o,i=window.innerWidth,r=window.innerHeight,l=N.el.getBoundingClientRect();n=Math.max(0,Math.min(n,i-l.width)),a=Math.max(0,Math.min(a,r-l.height)),N.el.style.left=n+"px",N.el.style.top=a+"px"}),document.addEventListener("mouseup",()=>{if(!N)return;N.el.style.transition="";let e=N.el.querySelector(".aih-result-header")||N.el;e.style.cursor="grab",N=null});function q(){try{return typeof chrome!="object"||!chrome||typeof chrome.runtime!="object"||!chrome.runtime?!1:!!chrome.runtime.id}catch{return!1}}var Ce=[{id:"ai-search",name:d("optionsConst.aiSearch"),systemPrompt:d("selToolbar.sysPromptAisearch"),builtin:!0,order:0},{id:"explain",name:d("optionsConst.explain"),systemPrompt:d("selToolbar.sysPromptExplain"),builtin:!0,order:1},{id:"translate",name:d("optionsConst.translate"),systemPrompt:d("selToolbar.sysPromptTranslate"),builtin:!0,order:2},{id:"summary",name:d("optionsConst.summary"),systemPrompt:d("selToolbar.sysPromptSummary"),builtin:!0,order:3},{id:"copy",name:d("optionsConst.copy"),systemPrompt:d("selToolbar.sysPromptCopy"),builtin:!0,order:99}];function Tt(e){return e.map(t=>{let o=Se(t.id);return o?{...t,name:o}:t})}function Kt(){return new Promise(e=>{if(!q()){B=Tt([...Ce]),e(B);return}if(B){e(B);return}try{chrome.storage.local.get(["toolbarTools","toolbarIconOnly"],t=>{let o=t.toolbarTools&&t.toolbarTools.length>0?t.toolbarTools:Ce,n=new Map(Ce.map(a=>[a.id,a]));B=o.map(a=>{if(a.builtin&&n.has(a.id)){let i=Se(a.id);return{...a,systemPrompt:n.get(a.id).systemPrompt,name:i||a.name}}return a}),at=t.toolbarIconOnly||!1,e(B)})}catch{B=Tt([...Ce]),e(B)}})}function St(){B=null,at=!1,Kt()}function $t(e){return{"ai-search":T.search,explain:T.explain,translate:T.translate,summary:T.summary,copy:T.copy}[e]||T.sparkle}function sn(){k||(k=document.createElement("div"),k.id="aih-overflow-dropdown",k.className="aih-overflow-dropdown",k.style.display="none",_(k),document.addEventListener("click",e=>{k&&k.style.display==="block"&&!k.contains(e.target)&&!e.target.closest(".aih-tb-btn-overflow")&&(k.style.display="none")}))}function cn(e){k||sn();let t=e.map(o=>{let n=$t(o.id),a=o.builtin&&Se(o.id)||o.name;return`<div class="aih-dropdown-item" role="button" tabindex="0" data-action="${o.id}">
807
+ Question 3`}});var T={search:'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>',explain:'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 18h6"/><path d="M10 22h4"/><path d="M12 2a7 7 0 0 0-7 7c0 2.4 1.2 4.5 3 5.7V17h8v-2.3c1.8-1.2 3-3.3 3-5.7a7 7 0 0 0-7-7Z"/></svg>',translate:'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M2 12h20"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>',summary:'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"/><path d="M14 2v6h6"/><path d="M8 13h2"/><path d="M8 17h2"/><path d="M14 13h2"/><path d="M14 17h2"/></svg>',copy:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>',close:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>',sparkle:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/></svg>',lock:'<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>',unlock:'<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/></svg>',copyLarge:'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>',grip:'<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" stroke="none"><circle cx="8" cy="6" r="1.5"/><circle cx="16" cy="6" r="1.5"/><circle cx="8" cy="12" r="1.5"/><circle cx="16" cy="12" r="1.5"/><circle cx="8" cy="18" r="1.5"/><circle cx="16" cy="18" r="1.5"/></svg>',send:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg>',more:'<svg width="15" height="15" viewBox="0 0 24 24" fill="currentColor" stroke="none"><circle cx="12" cy="5" r="2"/><circle cx="12" cy="12" r="2"/><circle cx="12" cy="19" r="2"/></svg>',gear:'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>',refresh:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="23 4 23 10 17 10"/><polyline points="1 20 1 14 7 14"/><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/></svg>',block:'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="4.93" y1="4.93" x2="19.07" y2="19.07"/></svg>',eyeOff:'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19M14.12 14.12a3 3 0 1 1-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>'},b=null,f=null,F=!1,R=!1,Me="",ge=null,be="",M=!1,$=!1,K="",Be="",lt="",st="",w="",Ae=!0,de=[],Wt=!1,ye=!1,Vt=0,ee=!1;function Pt(){ee=!1}var fn=!1;function bn(){fn||=(document.addEventListener("mouseup",Pt,!0),window.addEventListener("blur",Pt),!0)}var oe={x:0,y:0},U=null,O=null,Rt=5,ut=!1,x=null,X="",Le=!1,Oe=0,jt=null,_e=!1,Ye=new Set,H=window.top===window;if(!H)try{window.parent===window.top&&window.top.document.querySelector("frameset")&&(H=!0)}catch{}E.debug("[SelectionToolbar] moduleload isTopFrame:",H,"top===window:",window.top===window,"hasBody:",!!document.body,"parent===top:",window.parent===window.top);var D=null;function _(e){(document.body||document.documentElement).appendChild(e)}function qe(e){e.setAttribute("data-aih","")}function pe(e,t){if(e){try{e.showPopover()}catch{}e.style.display=t}}function G(e){if(e){try{e.hidePopover()}catch{}e.style.display="none"}}function we(e){return!!e&&e.style.display!==""&&e.style.display!=="none"}var Ee=new Map;function yn(){return we(b)||we(x)||we(f)||_e}function wn(){Ee.forEach((e,t)=>{e===null?t.style.removeProperty("display"):t.style.display=e}),Ee.clear()}function Ue(e){if(!e||typeof e.getBoundingClientRect!="function"||!document.elementFromPoint)return;let t=e.getBoundingClientRect();if(!(t.width>0)||!(t.height>0))return;let o=[t.left+t.width*.25,t.left+t.width/2,t.left+t.width*.75],n=[t.top+t.height/2,t.bottom-2];for(let a of o)for(let i of n){let r=document.elementFromPoint(a,i);!r||r.closest("[data-aih]")||Ee.has(r)||(Ee.set(r,r.style.display),r.style.display="none")}}function W(){Ee.size&&!yn()&&wn()}var N=null;function Qt(e,t){let o=t?e.querySelector(t):e;o&&(o.style.cursor="grab",o.addEventListener("mousedown",n=>{if(n.target.closest('[role="button"]')||n.button!==0)return;n.preventDefault(),n.stopPropagation();let a=e.getBoundingClientRect();N={el:e,startX:n.clientX,startY:n.clientY,startLeft:a.left,startTop:a.top,pointerId:n.pointerId||0},o.style.cursor="grabbing",e.style.transition="none"}))}document.addEventListener("mousemove",e=>{if(!N)return;let t=e.clientX-N.startX,o=e.clientY-N.startY,n=N.startLeft+t,a=N.startTop+o,i=window.innerWidth,r=window.innerHeight,l=N.el.getBoundingClientRect();n=Math.max(0,Math.min(n,i-l.width)),a=Math.max(0,Math.min(a,r-l.height)),N.el.style.left=n+"px",N.el.style.top=a+"px"}),document.addEventListener("mouseup",()=>{if(!N)return;N.el.style.transition="";let e=N.el.querySelector(".aih-result-header")||N.el;e.style.cursor="grab",N=null});function q(){try{return typeof chrome!="object"||!chrome||typeof chrome.runtime!="object"||!chrome.runtime?!1:!!chrome.runtime.id}catch{return!1}}var Re=[{id:"ai-search",name:d("optionsConst.aiSearch"),systemPrompt:d("selToolbar.sysPromptAisearch"),builtin:!0,order:0},{id:"explain",name:d("optionsConst.explain"),systemPrompt:d("selToolbar.sysPromptExplain"),builtin:!0,order:1},{id:"translate",name:d("optionsConst.translate"),systemPrompt:d("selToolbar.sysPromptTranslate"),builtin:!0,order:2},{id:"summary",name:d("optionsConst.summary"),systemPrompt:d("selToolbar.sysPromptSummary"),builtin:!0,order:3},{id:"copy",name:d("optionsConst.copy"),systemPrompt:d("selToolbar.sysPromptCopy"),builtin:!0,order:99}];function Mt(e){return e.map(t=>{let o=Pe(t.id);return o?{...t,name:o}:t})}function Yt(){return new Promise(e=>{if(!q()){O=Mt([...Re]),e(O);return}if(O){e(O);return}try{chrome.storage.local.get(["toolbarTools","toolbarIconOnly"],t=>{let o=t.toolbarTools&&t.toolbarTools.length>0?t.toolbarTools:Re,n=new Map(Re.map(a=>[a.id,a]));O=o.map(a=>{if(a.builtin&&n.has(a.id)){let i=Pe(a.id);return{...a,systemPrompt:n.get(a.id).systemPrompt,name:i||a.name}}return a}),ut=t.toolbarIconOnly||!1,e(O)})}catch{O=Mt([...Re]),e(O)}})}function Lt(){O=null,ut=!1,Yt()}function Xt(e){return{"ai-search":T.search,explain:T.explain,translate:T.translate,summary:T.summary,copy:T.copy}[e]||T.sparkle}function xn(){x||(x=document.createElement("div"),x.id="aih-overflow-dropdown",x.className="aih-overflow-dropdown",x.setAttribute("popover","manual"),qe(x),x.style.display="none",_(x),document.addEventListener("click",e=>{x&&we(x)&&!x.contains(e.target)&&!e.target.closest(".aih-tb-btn-overflow")&&(G(x),W())}))}function vn(e){x||xn();let t=e.map(o=>{let n=Xt(o.id),a=o.builtin&&Pe(o.id)||o.name;return`<div class="aih-dropdown-item" role="button" tabindex="0" data-action="${o.id}">
805
808
  <span class="aih-tb-icon">${n}</span>${a}
806
809
  </div>`}).join("");t+='<div class="aih-dropdown-divider"></div>',t+=`<div class="aih-dropdown-item aih-dropdown-settings" role="button" tabindex="0" title="${d("selToolbar.settingsTitle")}">
807
810
  <span class="aih-tb-icon">${T.gear}</span>${d("selToolbar.settings")}
@@ -809,20 +812,20 @@ Question 3`}});var T={search:'<svg width="15" height="15" viewBox="0 0 24 24" fi
809
812
  <span class="aih-tb-icon">${T.eyeOff}</span>${d("selToolbar.disableTemporarily")}
810
813
  </div>`,t+=`<div class="aih-dropdown-item aih-dropdown-block" role="button" tabindex="0" title="${d("selToolbar.disableOnSiteTitle")}">
811
814
  <span class="aih-tb-icon">${T.block}</span>${d("selToolbar.disableOnSite")}
812
- </div>`,k.innerHTML=t,k._clickHandler=o=>{if(o.target.closest(".aih-dropdown-settings")){o.stopPropagation(),k.style.display="none";try{chrome.runtime.sendMessage({type:"OPEN_OPTIONS_PAGE",hash:"toolbar"}).catch(()=>{})}catch{}return}if(o.target.closest(".aih-dropdown-block")){o.stopPropagation(),o.preventDefault(),k.style.display="none",En();return}if(o.target.closest(".aih-dropdown-hide")){o.stopPropagation(),o.preventDefault(),k.style.display="none",Bt=!0,L(),ne(),w="";return}let n=o.target.closest("[data-action]");n&&(o.stopPropagation(),k.style.display="none",Vt(n.dataset.action,w))},k.addEventListener("click",k._clickHandler),k.addEventListener("keydown",o=>{if(o.key==="Enter"||o.key===" "){let n=o.target.closest('[role="button"]');n&&(o.preventDefault(),n.click())}}),k.addEventListener("mousedown",()=>{Z=!0}),document.addEventListener("mouseup",()=>{Z=!1},!0)}async function zt(){if(y)return;await Kt();let e=[...B].sort((m,h)=>m.order-h.order),t=e.find(m=>m.id==="ai-search"),o=e.filter(m=>m.id!=="ai-search"&&m.id!=="copy"),n=o.slice(0,kt-1),a=o.slice(kt-1);y=document.createElement("div"),y.id="aih-selection-toolbar";let i='<span class="aih-tb-buttons">';i+=`<span class="aih-tb-grip" title="${d("selToolbar.dragToMove")}">${T.grip}</span>`;let r=at;t&&(i+=`<div class="aih-tb-btn primary" role="button" tabindex="0" data-action="ai-search" title="${d("optionsConst.aiSearch")}">
815
+ </div>`,x.innerHTML=t,x._clickHandler=o=>{if(o.target.closest(".aih-dropdown-settings")){o.stopPropagation(),G(x),W();try{chrome.runtime.sendMessage({type:"OPEN_OPTIONS_PAGE",hash:"toolbar"}).catch(()=>{})}catch{}return}if(o.target.closest(".aih-dropdown-block")){o.stopPropagation(),o.preventDefault(),G(x),W(),_n();return}if(o.target.closest(".aih-dropdown-hide")){o.stopPropagation(),o.preventDefault(),G(x),W(),Wt=!0,L(),ie(),w="";return}let n=o.target.closest("[data-action]");n&&(o.stopPropagation(),G(x),W(),oo(n.dataset.action,w))},x.addEventListener("click",x._clickHandler),x.addEventListener("keydown",o=>{if(o.key==="Enter"||o.key===" "){let n=o.target.closest('[role="button"]');n&&(o.preventDefault(),n.click())}}),x.addEventListener("mousedown",()=>{ee=!0})}async function Zt(){if(b)return;await Yt();let e=[...O].sort((m,h)=>m.order-h.order),t=e.find(m=>m.id==="ai-search"),o=e.filter(m=>m.id!=="ai-search"&&m.id!=="copy"),n=o.slice(0,Rt-1),a=o.slice(Rt-1);b=document.createElement("div"),b.id="aih-selection-toolbar",b.setAttribute("popover","manual"),qe(b);let i='<span class="aih-tb-buttons">';i+=`<span class="aih-tb-grip" title="${d("selToolbar.dragToMove")}">${T.grip}</span>`;let r=ut;t&&(i+=`<div class="aih-tb-btn primary" role="button" tabindex="0" data-action="ai-search" title="${d("optionsConst.aiSearch")}">
813
816
  <span class="aih-tb-icon">${T.search}</span>${r?"":d("optionsConst.aiSearch")}
814
- </div>`),n.forEach(m=>{let h=$t(m.id),g=m.builtin&&Se(m.id)||m.name;i+=`<div class="aih-tb-btn" role="button" tabindex="0" data-action="${m.id}" title="${g}">
817
+ </div>`),n.forEach(m=>{let h=Xt(m.id),g=m.builtin&&Pe(m.id)||m.name;i+=`<div class="aih-tb-btn" role="button" tabindex="0" data-action="${m.id}" title="${g}">
815
818
  <span class="aih-tb-icon">${h}</span>${r?"":g}
816
819
  </div>`}),i+=`<div class="aih-tb-btn aih-tb-btn-overflow" role="button" tabindex="0" title="${d("selToolbar.moreTools")}">
817
820
  <span class="aih-tb-icon">${T.more}</span>
818
- </div>`,cn(a),i+=`<div class="aih-tb-btn" role="button" tabindex="0" data-action="copy" title="${d("selToolbar.copySelectedTitle")}">
821
+ </div>`,vn(a),i+=`<div class="aih-tb-btn" role="button" tabindex="0" data-action="copy" title="${d("selToolbar.copySelectedTitle")}">
819
822
  <span class="aih-tb-icon">${T.copy}</span>${r?"":d("optionsConst.copy")}
820
823
  </div>`,i+="</span>",i+=`<span class="aih-tb-ask-wrap">
821
824
  <input type="text" class="aih-tb-ask-input" placeholder="${d("selToolbar.askPlaceholder")}" />
822
825
  <div class="aih-tb-btn aih-tb-ask-send" role="button" tabindex="0" title="${d("selToolbar.sendTitle")}">
823
826
  <span class="aih-tb-icon">${T.send}</span>
824
827
  </div>
825
- </span>`,y.innerHTML=i,y.addEventListener("click",m=>{if(m.target.closest(".aih-tb-btn-overflow")){m.stopPropagation();let b=m.target.closest(".aih-tb-btn-overflow").getBoundingClientRect();k&&(k.style.display=k.style.display==="block"?"none":"block",k.style.top=b.bottom+4+"px",k.style.left=b.right-160+"px");return}let h=m.target.closest("[data-action]");if(!h)return;m.stopPropagation();let g=h.dataset.action;Vt(g,w)}),y.addEventListener("keydown",m=>{if(m.key==="Enter"||m.key===" "){let h=m.target.closest('[role="button"]');h&&!h.classList.contains("aih-tb-ask-send")&&(m.preventDefault(),h.click())}}),y.addEventListener("mousedown",()=>{Z=!0}),document.addEventListener("mouseup",()=>{Z=!1},!0),_(y);let l=y.querySelector(".aih-tb-ask-input"),s=y.querySelector(".aih-tb-ask-send");y.querySelector(".aih-tb-buttons");let c=()=>{let m=l.value.trim();if(m){let h=Ae;p(),l.value="",pn(m,h),L()}},u=()=>{if(R)return;R=!0,Ae=w||"";let m=window.getSelection();m.rangeCount>0&&(pe=m.getRangeAt(0).cloneRange());let h=y.getBoundingClientRect().right;he=y.style.left,y.classList.add("aih-ask-mode"),y.style.width="360px";let g=Math.max(8,h-360);y.style.left=g+"px",requestAnimationFrame(()=>{if(pe){let b=window.getSelection();b.removeAllRanges(),b.addRange(pe)}requestAnimationFrame(()=>{l.focus()})})},p=()=>{R&&(R=!1,Ae="",pe=null,y.classList.remove("aih-ask-mode"),y.style.width="",he&&=(y.style.left=he,""))};l.addEventListener("focus",()=>{R||u()}),l.addEventListener("mousedown",m=>{R||(m.preventDefault(),u())}),l.addEventListener("blur",()=>{setTimeout(()=>{R&&!y.contains(document.activeElement)&&(p(),L())},150)}),l.addEventListener("keydown",m=>{m.key==="Escape"?(m.preventDefault(),m.stopPropagation(),p(),l.blur()):m.key==="Enter"&&(m.preventDefault(),m.stopPropagation(),c())}),s.addEventListener("mousedown",m=>{m.preventDefault(),m.stopPropagation(),c()}),Ut(y,".aih-tb-grip")}function Gt(){if(f)return;f=document.createElement("div"),f.id="aih-selection-result",f.innerHTML=`
828
+ </span>`,b.innerHTML=i,b.addEventListener("click",m=>{if(m.target.closest(".aih-tb-btn-overflow")){m.stopPropagation();let y=m.target.closest(".aih-tb-btn-overflow").getBoundingClientRect();x&&(we(x)?(G(x),W()):(pe(x,"block"),x.style.top=y.bottom+4+"px",x.style.left=y.right-160+"px",requestAnimationFrame(()=>Ue(x))));return}let h=m.target.closest("[data-action]");if(!h)return;m.stopPropagation();let g=h.dataset.action;oo(g,w)}),b.addEventListener("keydown",m=>{if(m.key==="Enter"||m.key===" "){let h=m.target.closest('[role="button"]');h&&!h.classList.contains("aih-tb-ask-send")&&(m.preventDefault(),h.click())}}),b.addEventListener("mousedown",()=>{ee=!0}),bn(),_(b);let l=b.querySelector(".aih-tb-ask-input"),s=b.querySelector(".aih-tb-ask-send");b.querySelector(".aih-tb-buttons");let c=()=>{let m=l.value.trim();if(m){let h=Me;p(),l.value="",Sn(m,h),L()}},u=()=>{if(R)return;R=!0,Me=w||"";let m=window.getSelection();m.rangeCount>0&&(ge=m.getRangeAt(0).cloneRange());let h=b.getBoundingClientRect().right;be=b.style.left,b.classList.add("aih-ask-mode"),b.style.width="360px";let g=Math.max(8,h-360);b.style.left=g+"px",requestAnimationFrame(()=>{if(ge){let y=window.getSelection();y.removeAllRanges(),y.addRange(ge)}requestAnimationFrame(()=>{l.focus()})})},p=()=>{R&&(R=!1,Me="",ge=null,b.classList.remove("aih-ask-mode"),b.style.width="",be&&=(b.style.left=be,""))};l.addEventListener("focus",()=>{R||u()}),l.addEventListener("mousedown",m=>{R||(m.preventDefault(),u())}),l.addEventListener("blur",()=>{setTimeout(()=>{R&&!b.contains(document.activeElement)&&(p(),L())},150)}),l.addEventListener("keydown",m=>{m.key==="Escape"?(m.preventDefault(),m.stopPropagation(),p(),l.blur()):m.key==="Enter"&&(m.preventDefault(),m.stopPropagation(),c())}),s.addEventListener("mousedown",m=>{m.preventDefault(),m.stopPropagation(),c()}),Qt(b,".aih-tb-grip")}function Jt(){if(f)return;f=document.createElement("div"),f.id="aih-selection-result",f.setAttribute("popover","manual"),qe(f),f.innerHTML=`
826
829
  <div class="aih-result-header">
827
830
  <span>${T.sparkle} ${d("selToolbar.aiAnswer")}</span>
828
831
  <div class="aih-result-header-actions">
@@ -852,7 +855,7 @@ Question 3`}});var T={search:'<svg width="15" height="15" viewBox="0 0 24 24" fi
852
855
  <div class="aih-followup-send" role="button" tabindex="0" title="${d("selToolbar.sendToSidebar")}">${T.send}</div>
853
856
  </span>
854
857
  </div>
855
- `,f.querySelector(".aih-result-close").addEventListener("click",t=>{t.stopPropagation(),ne()}),f.querySelector(".aih-result-lock").addEventListener("click",t=>{t.stopPropagation(),un()}),f.querySelector(".aih-result-footer").addEventListener("click",t=>{t.stopPropagation();let o=t.target.closest(".aih-result-token");if(o){fn(o);return}let n=t.target.closest("[data-action]")?.dataset?.action;if(n==="regenerate-result"){if(!Je||!Le)return;ot(Je,Le,et)}else n==="copy-result"&&(t.ctrlKey||t.metaKey?Cn():Sn())});let e=f.querySelector(".aih-followup-input");f.querySelector(".aih-followup-send").addEventListener("click",t=>{t.stopPropagation();let o=e.value.trim();o&&($e(o),e.value="")}),e.addEventListener("keydown",t=>{if(t.key==="Enter"){t.preventDefault();let o=e.value.trim();o&&($e(o),e.value="")}}),f.querySelector(".aih-suggestions-list").addEventListener("click",t=>{let o=t.target.closest(".aih-suggestion-chip");if(!o)return;t.stopPropagation();let n=o.dataset.question;n&&$e(n)}),f.addEventListener("keydown",t=>{if(t.key==="Enter"||t.key===" "){let o=t.target.closest('[role="button"]');o&&(t.preventDefault(),o.click())}}),_(f),Ut(f,".aih-result-header")}function Ct(e,t,o,n=[]){if(!f)return;let a=M&&f.style.display!=="none",i=f.querySelector(".aih-result-body"),r=f.querySelector(".aih-result-scroll"),l=!r||r.scrollTop+r.clientHeight>=r.scrollHeight-24;i.innerHTML=o,l&&r&&(r.scrollTop=r.scrollHeight);let s=f.querySelector(".aih-result-suggestions"),c=f.querySelector(".aih-suggestions-list");if(n.length>0&&s&&c?(c.innerHTML=n.map(m=>`<div class="aih-suggestion-chip" role="button" tabindex="0" data-question="${oe(m)}">${oe(m)}</div>`).join(""),s.style.display="block"):s&&(s.style.display="none"),a)return;_(f);let u=window.innerWidth,p=window.innerHeight;f.style.display="flex",f.style.left="-9999px",f.style.top="-9999px",requestAnimationFrame(()=>{let m=f.getBoundingClientRect(),h=m.width||420,g=Math.min(m.height||200,520),b=e-h/2;b<8&&(b=8),b+h>u-8&&(b=u-h-8);let x=t-g-8;x<8&&(x=t+8),f.style.left=b+"px",f.style.top=x+"px",f.style.maxHeight=Math.min(520,p-x-16)+"px",M=!0,_(f)})}function dn(e,t){if(!f)return;ee={x:e,y:t},$=!1,De();let o=f.querySelector(".aih-result-suggestions");o&&(o.style.display="none");let n=f.querySelector(".aih-followup-input");n&&(n.value=""),fe(null),le(),_(f),f.style.display="flex";let a=f.querySelector(".aih-result-body");a.innerHTML=`<div class="aih-result-loading"><div class="aih-spinner"></div>${d("selToolbar.aiThinking")}</div>`,jt(f,e,t),M=!0,L()}function Wt(e,t,o){if(!f)return;$=!1,K="",fe(null),De(),_(f),f.style.display="flex";let n=f.querySelector(".aih-result-body");n.innerHTML=`<div class="aih-result-error">${d("selToolbar.requestFailed",{msg:oe(o)})}</div>`,jt(f,e,t),M=!0}function jt(e,t,o){let n=window.innerWidth,a=window.innerHeight;e.style.left="-9999px",e.style.top="-9999px",requestAnimationFrame(()=>{let i=e.getBoundingClientRect(),r=i.width||420,l=Math.min(i.height||200,520),s=t-r/2;s<8&&(s=8),s+r>n-8&&(s=n-r-8);let c=o-l-8;c<8&&(c=o+8),e.style.left=s+"px",e.style.top=c+"px",e.style.maxHeight=Math.min(520,a-c-16)+"px",_(e)})}function ne(){f&&(f.style.display="none",M=!1,$=!1,K="",le(),De())}function un(){$=!$,De()}function De(){if(!f)return;let e=f.querySelector(".aih-result-lock");e&&($?(e.innerHTML=T.lock,e.classList.add("locked"),e.title=d("selToolbar.unlockWindow")):(e.innerHTML=T.unlock,e.classList.remove("locked"),e.title=d("selToolbar.lockWindow")))}function $e(e){if(!e||!q())return;let t=w||Le||"";try{chrome.runtime.sendMessage({type:"DIRECT_SEND",text:e,selectedText:t}).catch(o=>{E.error("[SelectionToolbar] sendfollow-up tosidebar failed:",o)})}catch{}}function pn(e,t){if(!(!e||!q()))try{chrome.runtime.sendMessage({type:"DIRECT_SEND",text:e,selectedText:t||""}).catch(o=>{E.error("[SelectionToolbar] send to sidesidebar failed:",o)})}catch{}}function oe(e){let t=document.createElement("div");return t.textContent=e,t.innerHTML}function mn(){if(Ee)return;Ee=!0;let e=Ne;requestAnimationFrame(()=>{Ee=!1,e===Ne&&hn()})}function hn(){if(!f||!M||!Q)return;let e=f.querySelector(".aih-result-body");if(!e)return;let t=Q,o=t.indexOf("---SUGGESTIONS---");o!==-1&&(t=t.substring(0,o));let n=f.querySelector(".aih-result-scroll"),a=!n||n.scrollTop+n.clientHeight>=n.scrollHeight-24;e.innerHTML='<div class="aih-result-content-stream">'+gn(t)+"</div>",a&&n&&(n.scrollTop=n.scrollHeight)}function gn(e){if(typeof marked>"u")return oe(e).replace(/\n/g,"<br>");let t=(e.match(/```/g)||[]).length%2==1?e+"\n```":e;return marked.parse(t)}function ze(e){return!e||e<=0?"0":e<1e3?String(e):e<1e4?Math.round(e/100)/10+"K":e<1e6?Math.round(e/1e3)+"K":Math.round(e/1e5)/10+"M"}function fe(e){if(!f)return;qt=e||null;let t=f.querySelector(".aih-result-token");if(!t)return;let o=e&&(e.total_tokens||(e.prompt_tokens||0)+(e.completion_tokens||0));if(!o){t.style.display="none",t.textContent="",t.removeAttribute("title");return}t.innerHTML=`<span class="aih-token-dot">\u2B24</span>${ze(o)} tokens`,t.title=d("selToolbar.tokenUsageTitle",{input:ze(e.prompt_tokens||0),output:ze(e.completion_tokens||0)}),t.style.display="inline-flex"}function Ge(e){return!e&&e!==0?"0":Number(e).toLocaleString("en-US")}function le(){let e=document.querySelector(".aih-token-popup");e&&e.remove(),tt=!1}function fn(e){let t=qt;if(!t)return;let o=t.total_tokens||(t.prompt_tokens||0)+(t.completion_tokens||0);if(!o)return;if(tt){le();return}le();let n=t.prompt_tokens||0,a=t.completion_tokens||0,i=Math.round(n/o*100),r=Math.round(a/o*100),l=document.createElement("div");l.className="aih-token-popup",l.innerHTML=`
858
+ `,f.querySelector(".aih-result-close").addEventListener("click",t=>{t.stopPropagation(),ie()}),f.querySelector(".aih-result-lock").addEventListener("click",t=>{t.stopPropagation(),Tn()}),f.querySelector(".aih-result-footer").addEventListener("click",t=>{t.stopPropagation();let o=t.target.closest(".aih-result-token");if(o){In(o);return}let n=t.target.closest("[data-action]")?.dataset?.action;if(n==="regenerate-result"){if(!lt||!Be)return;ct(lt,Be,st)}else n==="copy-result"&&(t.ctrlKey||t.metaKey?Bn():Hn())});let e=f.querySelector(".aih-followup-input");f.querySelector(".aih-followup-send").addEventListener("click",t=>{t.stopPropagation();let o=e.value.trim();o&&(Xe(o),e.value="")}),e.addEventListener("keydown",t=>{if(t.key==="Enter"){t.preventDefault();let o=e.value.trim();o&&(Xe(o),e.value="")}}),f.querySelector(".aih-suggestions-list").addEventListener("click",t=>{let o=t.target.closest(".aih-suggestion-chip");if(!o)return;t.stopPropagation();let n=o.dataset.question;n&&Xe(n)}),f.addEventListener("keydown",t=>{if(t.key==="Enter"||t.key===" "){let o=t.target.closest('[role="button"]');o&&(t.preventDefault(),o.click())}}),_(f),Qt(f,".aih-result-header")}function Nt(e,t,o,n=[]){if(!f)return;let a=M&&f.style.display!=="none",i=f.querySelector(".aih-result-body"),r=f.querySelector(".aih-result-scroll"),l=!r||r.scrollTop+r.clientHeight>=r.scrollHeight-24;i.innerHTML=o,l&&r&&(r.scrollTop=r.scrollHeight);let s=f.querySelector(".aih-result-suggestions"),c=f.querySelector(".aih-suggestions-list");if(n.length>0&&s&&c?(c.innerHTML=n.map(m=>`<div class="aih-suggestion-chip" role="button" tabindex="0" data-question="${ae(m)}">${ae(m)}</div>`).join(""),s.style.display="block"):s&&(s.style.display="none"),a)return;_(f);let u=window.innerWidth,p=window.innerHeight;pe(f,"flex"),f.style.left="-9999px",f.style.top="-9999px",requestAnimationFrame(()=>{let m=f.getBoundingClientRect(),h=m.width||420,g=Math.min(m.height||200,520),y=e-h/2;y<8&&(y=8),y+h>u-8&&(y=u-h-8);let v=t-g-8;v<8&&(v=t+8),f.style.left=y+"px",f.style.top=v+"px",f.style.maxHeight=Math.min(520,p-v-16)+"px",M=!0,_(f)})}function kn(e,t){if(!f)return;oe={x:e,y:t},$=!1,Ke();let o=f.querySelector(".aih-result-suggestions");o&&(o.style.display="none");let n=f.querySelector(".aih-followup-input");n&&(n.value=""),xe(null),ce(),_(f),pe(f,"flex");let a=f.querySelector(".aih-result-body");a.innerHTML=`<div class="aih-result-loading"><div class="aih-spinner"></div>${d("selToolbar.aiThinking")}</div>`,to(f,e,t),M=!0,L()}function eo(e,t,o){if(!f)return;$=!1,K="",xe(null),Ke(),_(f),pe(f,"flex");let n=f.querySelector(".aih-result-body");n.innerHTML=`<div class="aih-result-error">${d("selToolbar.requestFailed",{msg:ae(o)})}</div>`,to(f,e,t),M=!0}function to(e,t,o){let n=window.innerWidth,a=window.innerHeight;e.style.left="-9999px",e.style.top="-9999px",requestAnimationFrame(()=>{let i=e.getBoundingClientRect(),r=i.width||420,l=Math.min(i.height||200,520),s=t-r/2;s<8&&(s=8),s+r>n-8&&(s=n-r-8);let c=o-l-8;c<8&&(c=o+8),e.style.left=s+"px",e.style.top=c+"px",e.style.maxHeight=Math.min(520,a-c-16)+"px",_(e),Ue(e)})}function ie(){f&&(G(f),W(),M=!1,$=!1,K="",ce(),Ke())}function Tn(){$=!$,Ke()}function Ke(){if(!f)return;let e=f.querySelector(".aih-result-lock");e&&($?(e.innerHTML=T.lock,e.classList.add("locked"),e.title=d("selToolbar.unlockWindow")):(e.innerHTML=T.unlock,e.classList.remove("locked"),e.title=d("selToolbar.lockWindow")))}function Xe(e){if(!e||!q())return;let t=w||Be||"";try{chrome.runtime.sendMessage({type:"DIRECT_SEND",text:e,selectedText:t}).catch(o=>{E.error("[SelectionToolbar] sendfollow-up tosidebar failed:",o)})}catch{}}function Sn(e,t){if(!(!e||!q()))try{chrome.runtime.sendMessage({type:"DIRECT_SEND",text:e,selectedText:t||""}).catch(o=>{E.error("[SelectionToolbar] send to sidesidebar failed:",o)})}catch{}}function ae(e){let t=document.createElement("div");return t.textContent=e,t.innerHTML}function Cn(){if(Le)return;Le=!0;let e=Oe;requestAnimationFrame(()=>{Le=!1,e===Oe&&An()})}function An(){if(!f||!M||!X)return;let e=f.querySelector(".aih-result-body");if(!e)return;let t=X,o=t.indexOf("---SUGGESTIONS---");o!==-1&&(t=t.substring(0,o));let n=f.querySelector(".aih-result-scroll"),a=!n||n.scrollTop+n.clientHeight>=n.scrollHeight-24;e.innerHTML='<div class="aih-result-content-stream">'+En(t)+"</div>",a&&n&&(n.scrollTop=n.scrollHeight)}function En(e){if(typeof marked>"u")return ae(e).replace(/\n/g,"<br>");let t=(e.match(/```/g)||[]).length%2==1?e+"\n```":e;return marked.parse(t)}function Ze(e){return!e||e<=0?"0":e<1e3?String(e):e<1e4?Math.round(e/100)/10+"K":e<1e6?Math.round(e/1e3)+"K":Math.round(e/1e5)/10+"M"}function xe(e){if(!f)return;jt=e||null;let t=f.querySelector(".aih-result-token");if(!t)return;let o=e&&(e.total_tokens||(e.prompt_tokens||0)+(e.completion_tokens||0));if(!o){t.style.display="none",t.textContent="",t.removeAttribute("title");return}t.innerHTML=`<span class="aih-token-dot">\u2B24</span>${Ze(o)} tokens`,t.title=d("selToolbar.tokenUsageTitle",{input:Ze(e.prompt_tokens||0),output:Ze(e.completion_tokens||0)}),t.style.display="inline-flex"}function Je(e){return!e&&e!==0?"0":Number(e).toLocaleString("en-US")}function ce(){let e=document.querySelector(".aih-token-popup");e&&(G(e),e.remove()),_e=!1,W()}function In(e){let t=jt;if(!t)return;let o=t.total_tokens||(t.prompt_tokens||0)+(t.completion_tokens||0);if(!o)return;if(_e){ce();return}ce();let n=t.prompt_tokens||0,a=t.completion_tokens||0,i=Math.round(n/o*100),r=Math.round(a/o*100),l=document.createElement("div");l.className="aih-token-popup",l.setAttribute("popover","manual"),qe(l),l.innerHTML=`
856
859
  <div class="aih-token-popup-header">
857
860
  <span class="aih-token-popup-title">${d("selToolbar.tokenPopupTitle")}</span>
858
861
  <button class="aih-token-popup-close" type="button" aria-label="close">\xD7</button>
@@ -860,25 +863,25 @@ Question 3`}});var T={search:'<svg width="15" height="15" viewBox="0 0 24 24" fi
860
863
  <div class="aih-token-popup-body">
861
864
  <div class="aih-token-popup-row aih-token-popup-total">
862
865
  <span class="aih-token-popup-label">${d("selToolbar.tokenPopupTotal")}</span>
863
- <span class="aih-token-popup-value">${Ge(o)}</span>
866
+ <span class="aih-token-popup-value">${Je(o)}</span>
864
867
  </div>
865
868
  <div class="aih-token-popup-divider"></div>
866
869
  <div class="aih-token-popup-row">
867
870
  <span class="aih-token-popup-label">${d("selToolbar.tokenPopupInput")}</span>
868
871
  <div class="aih-token-popup-right">
869
- <span class="aih-token-popup-value">${Ge(n)}</span>
872
+ <span class="aih-token-popup-value">${Je(n)}</span>
870
873
  <span class="aih-token-popup-percent">${i}%</span>
871
874
  </div>
872
875
  </div>
873
876
  <div class="aih-token-popup-row">
874
877
  <span class="aih-token-popup-label">${d("selToolbar.tokenPopupOutput")}</span>
875
878
  <div class="aih-token-popup-right">
876
- <span class="aih-token-popup-value">${Ge(a)}</span>
879
+ <span class="aih-token-popup-value">${Je(a)}</span>
877
880
  <span class="aih-token-popup-percent">${r}%</span>
878
881
  </div>
879
882
  </div>
880
883
  </div>
881
- `,_(l),l.style.zIndex="2147483647",tt=!0;let s=e.getBoundingClientRect(),c=l.getBoundingClientRect(),u=s.top-c.height-8>0?s.top-c.height-8:s.bottom+8,p=s.left+s.width/2-c.width/2;p=Math.max(8,Math.min(p,window.innerWidth-c.width-8)),u+c.height>window.innerHeight-8&&(u=window.innerHeight-c.height-8),l.style.top=u+"px",l.style.left=p+"px",l.querySelector(".aih-token-popup-close").addEventListener("click",h=>{h.stopPropagation(),le()});let m=h=>{!l.contains(h.target)&&!e.contains(h.target)&&(le(),document.removeEventListener("click",m,!0))};setTimeout(()=>{document.addEventListener("click",m,!0)},0)}function Te(e,t){if(!y||!w||M)return;_(y);let o=window.innerWidth,n=window.innerHeight;y.style.display="flex",_t=Date.now(),requestAnimationFrame(()=>{let a=y.getBoundingClientRect(),i=a.width||300,r=a.height||40,l=e-i/2;l<8&&(l=8),l+i>o-8&&(l=o-i-8);let s=t-r-10;s<8&&(s=t+10),s<8&&(s=8),s+r>n-8&&(s=n-r-8),y.style.left=l+"px",y.style.top=s+"px",F||=(y.classList.add("aih-show"),!0)})}function L(){!y||!F||(R&&(R=!1,Ae="",pe=null,y.classList.remove("aih-ask-mode"),y.style.width="",he&&=(y.style.left=he,"")),y.classList.remove("aih-show"),y.style.display="none",F=!1)}function bn(){if(!y)return{x:0,y:0};let e=y.getBoundingClientRect();return{x:e.left+e.width/2,y:e.top}}function yn(e){let t=e.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top}}function Ie(){if(!q()||!ke)return;if(!H){let i=J();if(E.debug("[SelectionToolbar] iframe onSelectionChange text:",i.text?.substring(0,30),"currentSelectedText:",!!w,"pendingIframeSelection:",!!D),i.text&&i.text.length>=2){let r=we(i.range);D={text:i.text,x:r.x,y:r.y},E.debug("[SelectionToolbar] iframe pendingIframeSelection set")}else if(w&&!Z){w="",D=null;try{chrome.runtime.sendMessage({type:"IFRAME_SELECTION_CLEAR"}).catch(()=>{})}catch{}}return}if(se.length>0&&se.includes(window.location.hostname)||Bt)return;let e=window.getSelection(),t=e?e.toString().trim():"",o=null;if(t&&t.length>=2&&e.rangeCount>0)o=e.getRangeAt(0);else{let i=J();i.text&&i.text.length>=2&&(t=i.text,o=i.range)}if(!t||t.length<2){!R&&!Z&&L(),Z||(w="",U=null);return}let n=5e3,a=t.length>n?t.substring(0,n)+"...":t;if(o){let i=o.commonAncestorContainer,r=i.nodeType===Node.TEXT_NODE?i.parentElement.closest("[contenteditable], input, textarea"):i.closest&&i.closest("[contenteditable], input, textarea");if(r instanceof HTMLElement&&(r.tagName==="INPUT"||r.tagName==="TEXTAREA")){L(),w="",U=null;return}}w=a,U=!0}function wn(e){if(!(y&&y.contains(e.target))&&!(f&&f.contains(e.target))&&!(e.target.closest&&e.target.closest(".aih-token-popup"))){if(ge){ge=!1;return}M&&!$&&ne(),F&&!R&&L();try{chrome.runtime.sendMessage({type:"IFRAME_CLICK_DISMISS"}).catch(()=>{})}catch{}}}function xn(e){if(E.debug("[SelectionToolbar] onMouseUp isTopFrame:",H,"pendingSelection:",U,"pendingIframeSelection:",!!D,"currentSelectedText:",!!w,"isToolbarVisible:",F,"toolbarEl:",!!y),(e.detail||1)>=3&&(ge=!0),!H){if(D){ge=!0,D.text,w=D.text;try{window.parent.postMessage({type:"IFRAME_SELECTION",text:D.text,x:D.x,y:D.y},"*")}catch{}try{chrome.runtime.sendMessage({type:"IFRAME_SELECTION",text:D.text,x:D.x,y:D.y}).catch(()=>{})}catch{}D=null}else(e.detail||1)>=3&&setTimeout(()=>{let t=J();if(!t.text||t.text.length<2)return;let o=we(t.range);t.text,w=t.text;try{window.parent.postMessage({type:"IFRAME_SELECTION",text:t.text,x:o.x,y:o.y},"*")}catch{}try{chrome.runtime.sendMessage({type:"IFRAME_SELECTION",text:t.text,x:o.x,y:o.y}).catch(()=>{})}catch{}},60);return}F||M||(U&&w?(ge=!0,At()):(e.detail||1)>=3&&setTimeout(()=>{R||(Ie(),U&&w&&At())},60))}function At(){if(!U||!w||F)return;let e=window.innerWidth/2,t=window.innerHeight/2,o=window.getSelection();if(o&&o.rangeCount>0){let n=o.getRangeAt(0).getBoundingClientRect();(n.width>0||n.height>0)&&(e=n.left+n.width/2,t=n.top)}if(e===window.innerWidth/2&&t===window.innerHeight/2){let n=J();if(n.text&&n.text.length>=2){let a=we(n.range);e=a.x,t=a.y}}try{chrome.runtime.sendMessage({type:"IFRAME_CLICK_DISMISS"}).catch(()=>{})}catch{}Te(e,t),U=null}function vn(){if(R)return;if(!H&&w){let o=J();if(o.text){let n=we(o.range);try{window.parent.postMessage({type:"IFRAME_SELECTION",text:o.text,x:n.x,y:n.y},"*")}catch{}try{chrome.runtime.sendMessage({type:"IFRAME_SELECTION",text:o.text,x:n.x,y:n.y}).catch(()=>{})}catch{}}return}if(!F)return;let e=window.getSelection();if(e&&e.rangeCount>0&&w){let o=e.getRangeAt(0).getBoundingClientRect();if(o.width>0||o.height>0){Te(o.left+o.width/2,o.top);return}}let t=J();if(t.text&&t.text.length>=2&&w){let o=we(t.range);Te(o.x,o.y);return}L()}function kn(){R||F&&L()}function Vt(e,t){if(!t)return;if(Le=t,e==="copy"){Tn(t),L();return}if(Je=e,et="",["ai-search","explain","translate","summary"].includes(e)){ot(e,t);return}let o=B.find(n=>n.id===e);o&&(et=o.systemPrompt||"",ot(e,t,o.systemPrompt))}function Tn(e){Qt(e).then(()=>{Fe()}).catch(t=>{E.error("[SelectionToolbar] copy failed:",t),be()})}function Sn(){let e=K;e&&Qt(e).then(()=>{Fe(d("selToolbar.copiedMarkdown"))}).catch(t=>{E.error("[SelectionToolbar] copyresult failed:",t),be()})}function Cn(){let e=K;if(!e)return;let t=An(typeof marked<"u"?marked.parse(e):oe(e).replace(/\n/g,"<br>"));if(navigator.clipboard&&typeof ClipboardItem<"u")try{let o=new ClipboardItem({"text/html":new Blob([t],{type:"text/html"}),"text/plain":new Blob([e],{type:"text/plain"})});navigator.clipboard.write([o]).then(()=>{Fe(d("selToolbar.copiedRich"))}).catch(n=>{E.error("[SelectionToolbar] richcopy failed:",n),Et()});return}catch(o){E.error("[SelectionToolbar] richcopy failed:",o)}Et()}function An(e){return`<!DOCTYPE html><html><head>
884
+ `,_(l),pe(l,"flex"),_e=!0;let s=e.getBoundingClientRect(),c=l.getBoundingClientRect(),u=s.top-c.height-8>0?s.top-c.height-8:s.bottom+8,p=s.left+s.width/2-c.width/2;p=Math.max(8,Math.min(p,window.innerWidth-c.width-8)),u+c.height>window.innerHeight-8&&(u=window.innerHeight-c.height-8),l.style.top=u+"px",l.style.left=p+"px",Ue(l),l.querySelector(".aih-token-popup-close").addEventListener("click",h=>{h.stopPropagation(),ce()});let m=h=>{!l.contains(h.target)&&!e.contains(h.target)&&(ce(),document.removeEventListener("click",m,!0))};setTimeout(()=>{document.addEventListener("click",m,!0)},0)}function Ie(e,t){if(!b||!w||M)return;_(b);let o=window.innerWidth,n=window.innerHeight;pe(b,"flex"),Vt=Date.now(),requestAnimationFrame(()=>{let a=b.getBoundingClientRect(),i=a.width||300,r=a.height||40,l=e-i/2;l<8&&(l=8),l+i>o-8&&(l=o-i-8);let s=t-r-10;s<8&&(s=t+10),s<8&&(s=8),s+r>n-8&&(s=n-r-8),b.style.left=l+"px",b.style.top=s+"px",Ue(b),F||=(b.classList.add("aih-show"),!0)})}function L(){!b||!F||(ee=!1,R&&(R=!1,Me="",ge=null,b.classList.remove("aih-ask-mode"),b.style.width="",be&&=(b.style.left=be,"")),b.classList.remove("aih-show"),G(b),W(),F=!1)}function Pn(){if(!b)return{x:0,y:0};let e=b.getBoundingClientRect();return{x:e.left+e.width/2,y:e.top}}function Rn(e){let t=e.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top}}function Ne(){if(!q()||!Ae)return;if(!H){let i=te();if(E.debug("[SelectionToolbar] iframe onSelectionChange text:",i.text?.substring(0,30),"currentSelectedText:",!!w,"pendingIframeSelection:",!!D),i.text&&i.text.length>=2){let r=Te(i.range);D={text:i.text,x:r.x,y:r.y},E.debug("[SelectionToolbar] iframe pendingIframeSelection set")}else if(w&&!ee){w="",D=null;try{chrome.runtime.sendMessage({type:"IFRAME_SELECTION_CLEAR"}).catch(()=>{})}catch{}}return}if(de.length>0&&de.includes(window.location.hostname)||Wt)return;let e=window.getSelection(),t=e?e.toString().trim():"",o=null;if(t&&t.length>=2&&e.rangeCount>0)o=e.getRangeAt(0);else{let i=te();i.text&&i.text.length>=2&&(t=i.text,o=i.range)}if(!t||t.length<2){!R&&!ee&&L(),ee||(w="",U=null);return}let n=5e3,a=t.length>n?t.substring(0,n)+"...":t;if(o){let i=o.commonAncestorContainer,r=i.nodeType===Node.TEXT_NODE?i.parentElement.closest("[contenteditable], input, textarea"):i.closest&&i.closest("[contenteditable], input, textarea");if(r instanceof HTMLElement&&(r.tagName==="INPUT"||r.tagName==="TEXTAREA")){L(),w="",U=null;return}}w=a,U=!0}function Mn(e){if(!(b&&b.contains(e.target))&&!(f&&f.contains(e.target))&&!(e.target.closest&&e.target.closest(".aih-token-popup"))){if(ye){ye=!1;return}M&&!$&&ie(),F&&!R&&L();try{chrome.runtime.sendMessage({type:"IFRAME_CLICK_DISMISS"}).catch(()=>{})}catch{}}}function Ln(e){if(E.debug("[SelectionToolbar] onMouseUp isTopFrame:",H,"pendingSelection:",U,"pendingIframeSelection:",!!D,"currentSelectedText:",!!w,"isToolbarVisible:",F,"toolbarEl:",!!b),(e.detail||1)>=3&&(ye=!0),!H){if(D){ye=!0,D.text,w=D.text;try{window.parent.postMessage({type:"IFRAME_SELECTION",text:D.text,x:D.x,y:D.y},"*")}catch{}try{chrome.runtime.sendMessage({type:"IFRAME_SELECTION",text:D.text,x:D.x,y:D.y}).catch(()=>{})}catch{}D=null}else(e.detail||1)>=3&&setTimeout(()=>{let t=te();if(!t.text||t.text.length<2)return;let o=Te(t.range);t.text,w=t.text;try{window.parent.postMessage({type:"IFRAME_SELECTION",text:t.text,x:o.x,y:o.y},"*")}catch{}try{chrome.runtime.sendMessage({type:"IFRAME_SELECTION",text:t.text,x:o.x,y:o.y}).catch(()=>{})}catch{}},60);return}F||M||(U&&w?(ye=!0,Dt()):(e.detail||1)>=3&&setTimeout(()=>{R||(Ne(),U&&w&&Dt())},60))}function Dt(){if(!U||!w||F)return;let e=window.innerWidth/2,t=window.innerHeight/2,o=window.getSelection();if(o&&o.rangeCount>0){let n=o.getRangeAt(0).getBoundingClientRect();(n.width>0||n.height>0)&&(e=n.left+n.width/2,t=n.top)}if(e===window.innerWidth/2&&t===window.innerHeight/2){let n=te();if(n.text&&n.text.length>=2){let a=Te(n.range);e=a.x,t=a.y}}try{chrome.runtime.sendMessage({type:"IFRAME_CLICK_DISMISS"}).catch(()=>{})}catch{}Ie(e,t),U=null}function Nn(){if(R)return;if(!H&&w){let o=te();if(o.text){let n=Te(o.range);try{window.parent.postMessage({type:"IFRAME_SELECTION",text:o.text,x:n.x,y:n.y},"*")}catch{}try{chrome.runtime.sendMessage({type:"IFRAME_SELECTION",text:o.text,x:n.x,y:n.y}).catch(()=>{})}catch{}}return}if(!F)return;let e=window.getSelection();if(e&&e.rangeCount>0&&w){let o=e.getRangeAt(0).getBoundingClientRect();if(o.width>0||o.height>0){Ie(o.left+o.width/2,o.top);return}}let t=te();if(t.text&&t.text.length>=2&&w){let o=Te(t.range);Ie(o.x,o.y);return}L()}function Dn(){R||F&&L()}function oo(e,t){if(!t)return;if(Be=t,e==="copy"){Fn(t),L();return}if(lt=e,st="",["ai-search","explain","translate","summary"].includes(e)){ct(e,t);return}let o=O.find(n=>n.id===e);o&&(st=o.systemPrompt||"",ct(e,t,o.systemPrompt))}function Fn(e){no(e).then(()=>{$e()}).catch(t=>{E.error("[SelectionToolbar] copy failed:",t),ve()})}function Hn(){let e=K;e&&no(e).then(()=>{$e(d("selToolbar.copiedMarkdown"))}).catch(t=>{E.error("[SelectionToolbar] copyresult failed:",t),ve()})}function Bn(){let e=K;if(!e)return;let t=On(typeof marked<"u"?marked.parse(e):ae(e).replace(/\n/g,"<br>"));if(navigator.clipboard&&typeof ClipboardItem<"u")try{let o=new ClipboardItem({"text/html":new Blob([t],{type:"text/html"}),"text/plain":new Blob([e],{type:"text/plain"})});navigator.clipboard.write([o]).then(()=>{$e(d("selToolbar.copiedRich"))}).catch(n=>{E.error("[SelectionToolbar] richcopy failed:",n),Ft()});return}catch(o){E.error("[SelectionToolbar] richcopy failed:",o)}Ft()}function On(e){return`<!DOCTYPE html><html><head>
882
885
  <style>
883
886
  body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 14px; line-height: 1.6; color: #24292f; }
884
887
  h1 { font-size: 24px; font-weight: bold; margin: 16px 0 8px; }
@@ -918,7 +921,7 @@ Question 3`}});var T={search:'<svg width="15" height="15" viewBox="0 0 24 24" fi
918
921
  a { color: #007bff; text-decoration: underline; }
919
922
  img { max-width: 100%; }
920
923
  </style>
921
- </head><body>${e}</body></html>`}function Et(){let e=f&&f.querySelector(".aih-result-body");if(!e){be();return}let t=window.getSelection(),o=[];for(let a=0;a<t.rangeCount;a++)o.push(t.getRangeAt(a).cloneRange());let n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n);try{document.execCommand("copy")?Fe(d("selToolbar.copiedRich")):be()}catch(a){E.error("[SelectionToolbar] fallback richcopy failed:",a),be()}finally{t.removeAllRanges(),o.forEach(a=>t.addRange(a))}}async function Qt(e){if(!navigator.clipboard)return It(e);try{await navigator.clipboard.writeText(e)}catch(t){if(t.name==="NotAllowedError"||t.name==="SecurityError")return It(e);throw t}}function It(e){return new Promise((t,o)=>{let n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.left="-9999px",n.style.opacity="0",_(n);try{n.select(),n.setSelectionRange(0,e.length),document.execCommand("copy")?t():o(Error("execCommand copy failed"))}catch(a){o(a)}finally{n.remove()}})}function be(){let e=document.getElementById("aih-copy-toast");e&&e.remove();let t=document.createElement("div");t.id="aih-copy-toast",t.textContent=d("selToolbar.copyFailed"),t.style.cssText=`
924
+ </head><body>${e}</body></html>`}function Ft(){let e=f&&f.querySelector(".aih-result-body");if(!e){ve();return}let t=window.getSelection(),o=[];for(let a=0;a<t.rangeCount;a++)o.push(t.getRangeAt(a).cloneRange());let n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n);try{document.execCommand("copy")?$e(d("selToolbar.copiedRich")):ve()}catch(a){E.error("[SelectionToolbar] fallback richcopy failed:",a),ve()}finally{t.removeAllRanges(),o.forEach(a=>t.addRange(a))}}async function no(e){if(!navigator.clipboard)return Ht(e);try{await navigator.clipboard.writeText(e)}catch(t){if(t.name==="NotAllowedError"||t.name==="SecurityError")return Ht(e);throw t}}function Ht(e){return new Promise((t,o)=>{let n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.left="-9999px",n.style.opacity="0",_(n);try{n.select(),n.setSelectionRange(0,e.length),document.execCommand("copy")?t():o(Error("execCommand copy failed"))}catch(a){o(a)}finally{n.remove()}})}function ve(){let e=document.getElementById("aih-copy-toast");e&&e.remove();let t=document.createElement("div");t.id="aih-copy-toast",t.setAttribute("data-aih",""),t.textContent=d("selToolbar.copyFailed"),t.style.cssText=`
922
925
  position: fixed;
923
926
  top: 50%;
924
927
  left: 50%;
@@ -932,7 +935,7 @@ Question 3`}});var T={search:'<svg width="15" height="15" viewBox="0 0 24 24" fi
932
935
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
933
936
  pointer-events: none;
934
937
  animation: aih-toast-in 0.2s ease-out, aih-toast-out 0.2s 1.5s ease-in forwards;
935
- `,_(t),t.style.zIndex="2147483647",setTimeout(()=>t.remove(),1800)}function Fe(e){let t=document.getElementById("aih-copy-toast");t&&t.remove();let o=document.createElement("div");if(o.id="aih-copy-toast",o.textContent=e||d("selToolbar.copied"),o.style.cssText=`
938
+ `,_(t),t.style.zIndex="2147483647",setTimeout(()=>t.remove(),1800)}function $e(e){let t=document.getElementById("aih-copy-toast");t&&t.remove();let o=document.createElement("div");if(o.id="aih-copy-toast",o.setAttribute("data-aih",""),o.textContent=e||d("selToolbar.copied"),o.style.cssText=`
936
939
  position: fixed;
937
940
  top: 50%;
938
941
  left: 50%;
@@ -949,11 +952,11 @@ Question 3`}});var T={search:'<svg width="15" height="15" viewBox="0 0 24 24" fi
949
952
  `,!document.getElementById("aih-toast-anim")){let n=document.createElement("style");n.id="aih-toast-anim",n.textContent=`
950
953
  @keyframes aih-toast-in { from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
951
954
  @keyframes aih-toast-out { from { opacity: 1; } to { opacity: 0; } }
952
- `,document.head.appendChild(n)}_(o),o.style.zIndex="2147483647",setTimeout(()=>o.remove(),1300)}function ot(e,t,o){if(!q()){E.warn("[SelectionToolbar] extensiontextexpired,pleaserefreshpage");return}let n={"ai-search":d("selToolbar.userMsgAisearch",{text:t}),explain:d("selToolbar.userMsgExplain",{text:t}),translate:d("selToolbar.userMsgTranslate",{text:t}),summary:d("selToolbar.userMsgSummary",{text:t})},a=o?`\u8BF7\u5904\u7406\u4EE5\u4E0B\u5185\u5BB9\uFF1A
955
+ `,document.head.appendChild(n)}_(o),o.style.zIndex="2147483647",setTimeout(()=>o.remove(),1300)}function ct(e,t,o){if(!q()){E.warn("[SelectionToolbar] extensiontextexpired,pleaserefreshpage");return}let n={"ai-search":d("selToolbar.userMsgAisearch",{text:t}),explain:d("selToolbar.userMsgExplain",{text:t}),translate:d("selToolbar.userMsgTranslate",{text:t}),summary:d("selToolbar.userMsgSummary",{text:t})},a=o?`\u8BF7\u5904\u7406\u4EE5\u4E0B\u5185\u5BB9\uFF1A
953
956
 
954
- ${t}`:n[e]||t;if(e==="ai-search"){L(),window.getSelection().removeAllRanges();try{chrome.runtime.sendMessage({type:"SELECTION_TOOLBAR_ACTION",action:e,text:t,prompt:a}).catch(s=>{E.error("[SelectionToolbar] sendmessage failed:",s)})}catch{}return}Gt();let i={"ai-search":d("optionsConst.aiSearch"),explain:d("optionsConst.explain"),translate:d("optionsConst.translate"),summary:d("optionsConst.summary")}[e];if(!i&&B){let s=B.find(c=>c.id===e);i=s?s.builtin&&Se(s.id)||s.name:d("selToolbar.aiAnswer")}let r=f.querySelector(".aih-result-header span");r&&(r.innerHTML=`${T.sparkle} ${i||d("selToolbar.aiAnswer")}`);let l=M&&f?yn(f):bn();dn(l.x,l.y);try{chrome.runtime.sendMessage({type:"SELECTION_TOOLBAR_ACTION",action:e,text:t,prompt:a,systemPrompt:o||""}).catch(s=>{E.error("[SelectionToolbar] sendmessage failed:",s),Wt(l.x,l.y,s.message)})}catch{}}q()&&chrome.runtime.onMessage.addListener((e,t,o)=>{if(q()){if(e.type==="IFRAME_SELECTION"){if(!H)return;E.debug("[SelectionToolbar] recei to IFRAME_SELECTION text:",e.text?.substring(0,30),"isToolbarVisible:",F,"isResultVisible:",M),w=e.text;let n=e.x,a=e.y;if(window.top!==window&&window.frameElement)try{let i=window.frameElement.getBoundingClientRect();n=e.x-i.left,a=e.y-i.top}catch{}if(F&&y&&w){requestAnimationFrame(()=>{let i=window.innerWidth,r=y.offsetWidth||300,l=y.offsetHeight||40,s=n-r/2;s<8&&(s=8),s+r>i-8&&(s=i-r-8);let c=a-l-8;c<8&&(c=a+8),y.style.left=s+"px",y.style.top=c+"px"});return}U={x:n,y:a},w&&w.length>=2&&Te(n,a);return}if(e.type==="IFRAME_SELECTION_CLEAR"){if(!H||Z)return;F&&!R&&(L(),w="");return}if(e.type==="IFRAME_CLICK_DISMISS"){F&&y&&Date.now()-_t>300&&(L(),w=""),M&&!$&&ne();return}if(H){if(e.type==="SELECTION_TOOLBAR_STREAM_START"){Q="",Ee=!1,Ne++;return}if(e.type==="SELECTION_TOOLBAR_STREAM_CHUNK"){Q+=e.delta||"",mn();return}if(e.type==="SELECTION_TOOLBAR_STREAM_DONE"){Ne++,e.finalContent&&(Q=e.finalContent);let n=Q||d("selToolbar.noResponse");K=Q;let a=n,i=[],r=n.indexOf("---SUGGESTIONS---");r!==-1&&(a=n.substring(0,r).trim(),K=a,i=n.substring(r+17).split(`
955
- `).map(s=>s.replace(/^[\d]+[\.\、\s]+/,"").trim()).filter(s=>s.length>0).slice(0,3));let l=typeof marked<"u"?marked.parse(a):oe(a).replace(/\n/g,"<br>");Ct(ee.x,ee.y,l,i),fe(e.usage),Q="";return}if(e.type==="SELECTION_TOOLBAR_RESULT")if(e.error)K="",fe(null),Wt(ee.x,ee.y,e.error);else{let n=e.content||d("selToolbar.noResponse"),a=n;K=n;let i=[],r=n.indexOf("---SUGGESTIONS---");r!==-1&&(a=n.substring(0,r).trim(),K=a,i=n.substring(r+17).split(`
956
- `).map(s=>s.replace(/^[\d]+[\.\、\s]+/,"").trim()).filter(s=>s.length>0).slice(0,3));let l=typeof marked<"u"?marked.parse(a):oe(a).replace(/\n/g,"<br>");Ct(ee.x,ee.y,l,i),fe(e.usage)}}}});function En(){if(!q())return;let e=window.location.hostname;try{chrome.storage.local.get(["blockedDomains"],t=>{try{let o=t.blockedDomains||[];o.includes(e)||(o.push(e),chrome.storage.local.set({blockedDomains:o},()=>{se=o,L(),ne(),w=""}))}catch{}})}catch{}}function In(){q()&&chrome.storage.local.get(["enableSelectionToolbar","blockedDomains"],e=>{ke=e.enableSelectionToolbar===void 0?!0:!!e.enableSelectionToolbar,se=e.blockedDomains||[],E.debug("[SelectionToolbar] toggle state:",ke?"enabled":"disabled","blocked domains:",se.length)})}var He=!0,ce="light";function Pn(){return He?ce==="system"?typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":ce==="dark"?"dark":"light":"light"}function it(){rn(Pn())}function Rn(){q()&&chrome.storage.local.get(["appTheme","selectionToolbarFollowTheme"],e=>{ce=["light","dark","system"].includes(e.appTheme)?e.appTheme:"light",He=e.selectionToolbarFollowTheme===void 0?!0:!!e.selectionToolbarFollowTheme,it()})}q()&&chrome.storage.onChanged.addListener((e,t)=>{q()&&(t==="local"&&e.enableSelectionToolbar&&(ke=!!e.enableSelectionToolbar.newValue,ke||(L(),ne(),w="")),t==="local"&&e.blockedDomains&&(se=e.blockedDomains.newValue||[]),t==="local"&&e.toolbarTools&&St(),t==="local"&&(e.appTheme||e.selectionToolbarFollowTheme)&&(e.appTheme&&(ce=["light","dark","system"].includes(e.appTheme.newValue)?e.appTheme.newValue:ce),e.selectionToolbarFollowTheme&&(He=!!e.selectionToolbarFollowTheme.newValue),it()))}),dt(()=>{St(),y&&=(y.remove(),null),zt(),f&&(f.remove(),f=null,M=!1,$=!1,K="")});function Mn(){if(Ot(),zt(),Gt(),In(),Rn(),typeof matchMedia<"u"){let e=matchMedia("(prefers-color-scheme: dark)"),t=()=>{He&&ce==="system"&&it()};e.addEventListener?e.addEventListener("change",t):e.addListener&&e.addListener(t)}document.addEventListener("selectionchange",Ie),document.addEventListener("click",wn,!0),document.addEventListener("mouseup",xn,!0),window.addEventListener("scroll",vn,!0),window.addEventListener("resize",kn),window.addEventListener("message",e=>{if(e.data?.type==="IFRAME_SELECTION"&&H){if(M){w="",U=null;return}w=e.data.text;let t=e.data.x,o=e.data.y;if(window.top!==window&&window.frameElement)try{let n=window.frameElement.getBoundingClientRect();t=e.data.x-n.left,o=e.data.y-n.top}catch{}if(F&&y&&w){requestAnimationFrame(()=>{let n=window.innerWidth,a=y.offsetWidth||300,i=y.offsetHeight||40,r=t-a/2;r<8&&(r=8),r+a>n-8&&(r=n-a-8);let l=o-i-8;l<8&&(l=o+8),y.style.left=r+"px",y.style.top=l+"px"});return}U={x:t,y:o},w&&w.length>=2&&Te(t,o);return}e.data?.type==="IFRAME_CLICK_DISMISS"&&H&&M&&!$&&ne()}),H&&(Ke=We(Ie),new MutationObserver(()=>{lo(Ke),Ke=We(Ie)}).observe(document.body,{childList:!0,subtree:!0})),E.debug("[SelectionToolbar] initialization complete",H?"(toplayerframe)":"(subframe)")}A("zh",{contentIndex:{invalidRef:"\u65E0\u6548\u7684\u5143\u7D20\u7F16\u53F7 ref={ref}\uFF0C\u8BF7\u5148\u8C03\u7528 query_elements",regionSelectHint:"\u62D6\u62FD\u9009\u62E9\u622A\u56FE\u533A\u57DF\uFF0C\u6309 Esc \u53D6\u6D88"}}),A("en",{contentIndex:{invalidRef:"Invalid element ref={ref}; please call query_elements first",regionSelectHint:"Drag to select the screenshot area; press Esc to cancel"}});var Ln=pt();console.log("[ContentScript] content script loaded URL:",window.location.href,"isTopFrame:",window.top===window,"hasBody:",!!document.body),document.addEventListener("keydown",e=>{if((e.ctrlKey||e.metaKey)&&e.shiftKey&&e.key==="A"){e.preventDefault();try{chrome.action.click()}catch{}}if(e.altKey&&!e.shiftKey&&e.code==="KeyS"&&!e.ctrlKey&&!e.metaKey){e.preventDefault();try{chrome.runtime.sendMessage({type:"CAPTURE_TAB_FROM_PAGE"})}catch{}}if(e.altKey&&e.shiftKey&&e.code==="KeyS"&&!e.ctrlKey&&!e.metaKey){e.preventDefault();try{chrome.runtime.sendMessage({type:"CAPTURE_REGION_FROM_PAGE"})}catch{}}});var Nn={GET_PAGE_TEXT:e=>Mo(e),GET_FULL_HTML:e=>Lo(e),QUERY_ELEMENTS:e=>Co(e),SNAPSHOT_COLLECT:e=>window.top!==window&&!ko()?{success:!0,visible:!1}:Ft({filterByText:e.filterByText,elementTypes:e.elementTypes,frames:e.frames==="none"?"none":"auto"}),GET_SELECTED_CONTENT:e=>No(e.format),INTERACT_ELEMENT:e=>e.ref==null?e.text?Wo(e.text,{tag:e.tag,action:e.action,waitTime:e.waitTime,timeout:e.timeout}):e.action==="hover"?Oo(e.selector):_o(e.selector,e.waitTime,e.timeout):Io(e.ref,e.action,{waitTime:e.waitTime,timeout:e.timeout,value:e.value,clear:e.clear,submit:e.submit}),FILL_FORM:e=>qo(e.fields,e.waitTime),SCROLL_TO:e=>e.target==="text"&&e.text?Ro(e.text,{maxScrolls:e.maxScrolls,pauseMs:e.pauseMs}):Uo(e),KEYBOARD_INPUT:e=>zo(e),FILE_UPLOAD:e=>Go(e.selector,e.fileName,e.fileContent,e.fileType),EXTRACT_TABLE:e=>Do(e.selector,e.includeHeaders,e.format),EXTRACT_METADATA:()=>so(),EXTRACT_LINKS:e=>co(e.filterType,e.includeImages),EXTRACT_FORMS:e=>uo(e.formSelector),EXTRACT_IMAGES:e=>po(e),SEARCH_IN_PAGE:e=>ho(e),IFRAME_CONTENT:e=>mo(e.selector,e.includeNested,e.maxLength),SCROLL_COLLECT:e=>Eo(e),MANAGE_STORAGE:e=>Vo(e),INJECT_CSS:e=>e.injectMode==="highlight"?Bo(e.text,e.color):Zo(e.css,e.targetSelector,e.injectMode),EVALUATE_DONE_CRITERIA:e=>en(e.criteria),COPY_TO_CLIPBOARD:e=>Fo(e.text),PASTE_FROM_CLIPBOARD:()=>Ho(),WAIT_ELEMENT:e=>Ko(e.selector,e.state,e.timeout),SELECT_DROPDOWN:e=>{let t=e.triggerSelector;if(e.ref!=null&&!t){let o=nt(e.ref);if(!o.element)return{success:!1,error:d("contentIndex.invalidRef",{ref:e.ref}),...o.suggestions&&o.suggestions.length?{suggestions:o.suggestions}:{}};t=o.entry.selector}return jo(t,e.optionText,e.optionSelector,e.timeout)},QRCODE:e=>Yo(e.content,e.size,e.errorCorrection,e.showImage),START_REGION_SELECTION:()=>Hn(),GET_PAGE_METRICS:()=>({width:Math.max(document.documentElement.scrollWidth,document.body.scrollWidth||0,window.innerWidth),height:Math.max(document.documentElement.scrollHeight,document.body.scrollHeight||0,window.innerHeight)})},Dn=new Set(["COPY_TO_CLIPBOARD","PASTE_FROM_CLIPBOARD","WAIT_ELEMENT","SELECT_DROPDOWN","QRCODE","START_REGION_SELECTION","INTERACT_ELEMENT","SCROLL_TO","KEYBOARD_INPUT"]),Fn=new Set(["GET_PAGE_TEXT","GET_FULL_HTML","EXTRACT_METADATA","EXTRACT_TABLE","IFRAME_CONTENT","QUERY_ELEMENTS","EVALUATE_DONE_CRITERIA","INTERACT_ELEMENT","SCROLL_TO"]);q()&&chrome.runtime.onMessage.addListener((e,t,o)=>{if(Fn.has(e.type)&&window.top!==window&&!e._frameRouted)return;if(e.action==="getSelectedText"){let i=window.getSelection()?.toString()?.trim()||"";if(i&&document.hasFocus())return o({text:i}),!0;let r=J();return r.text&&r.text.trim()&&document.hasFocus()&&o({text:r.text.trim()}),!0}let n=Nn[e.type];if(!n)return;let a=n(e);if(Dn.has(e.type)||a instanceof Promise)return Promise.resolve(a).then(o),!0;o(a)}),window.addEventListener("error",e=>{e.message&&e.message.includes("Extension context invalidated")&&e.preventDefault()}),window.addEventListener("unhandledrejection",e=>{(e.reason?.message||String(e.reason)).includes("Extension context invalidated")&&e.preventDefault()}),Ln.then(()=>{Mn()});function Hn(){return new Promise(e=>{let t=document.createElement("div");t.id="__region_select_overlay__",t.style.cssText=`
957
+ ${t}`:n[e]||t;if(e==="ai-search"){L(),window.getSelection().removeAllRanges();try{chrome.runtime.sendMessage({type:"SELECTION_TOOLBAR_ACTION",action:e,text:t,prompt:a}).catch(s=>{E.error("[SelectionToolbar] sendmessage failed:",s)})}catch{}return}Jt();let i={"ai-search":d("optionsConst.aiSearch"),explain:d("optionsConst.explain"),translate:d("optionsConst.translate"),summary:d("optionsConst.summary")}[e];if(!i&&O){let s=O.find(c=>c.id===e);i=s?s.builtin&&Pe(s.id)||s.name:d("selToolbar.aiAnswer")}let r=f.querySelector(".aih-result-header span");r&&(r.innerHTML=`${T.sparkle} ${i||d("selToolbar.aiAnswer")}`);let l=M&&f?Rn(f):Pn();kn(l.x,l.y);try{chrome.runtime.sendMessage({type:"SELECTION_TOOLBAR_ACTION",action:e,text:t,prompt:a,systemPrompt:o||""}).catch(s=>{E.error("[SelectionToolbar] sendmessage failed:",s),eo(l.x,l.y,s.message)})}catch{}}q()&&chrome.runtime.onMessage.addListener((e,t,o)=>{if(q()){if(e.type==="IFRAME_SELECTION"){if(!H)return;E.debug("[SelectionToolbar] recei to IFRAME_SELECTION text:",e.text?.substring(0,30),"isToolbarVisible:",F,"isResultVisible:",M),w=e.text;let n=e.x,a=e.y;if(window.top!==window&&window.frameElement)try{let i=window.frameElement.getBoundingClientRect();n=e.x-i.left,a=e.y-i.top}catch{}if(F&&b&&w){requestAnimationFrame(()=>{let i=window.innerWidth,r=b.offsetWidth||300,l=b.offsetHeight||40,s=n-r/2;s<8&&(s=8),s+r>i-8&&(s=i-r-8);let c=a-l-8;c<8&&(c=a+8),b.style.left=s+"px",b.style.top=c+"px"});return}U={x:n,y:a},w&&w.length>=2&&Ie(n,a);return}if(e.type==="IFRAME_SELECTION_CLEAR"){if(!H||ee)return;F&&!R&&(L(),w="");return}if(e.type==="IFRAME_CLICK_DISMISS"){F&&b&&Date.now()-Vt>300&&(L(),w=""),M&&!$&&ie();return}if(H){if(e.type==="SELECTION_TOOLBAR_STREAM_START"){X="",Le=!1,Oe++;return}if(e.type==="SELECTION_TOOLBAR_STREAM_CHUNK"){X+=e.delta||"",Cn();return}if(e.type==="SELECTION_TOOLBAR_STREAM_DONE"){Oe++,e.finalContent&&(X=e.finalContent);let n=X||d("selToolbar.noResponse");K=X;let a=n,i=[],r=n.indexOf("---SUGGESTIONS---");r!==-1&&(a=n.substring(0,r).trim(),K=a,i=n.substring(r+17).split(`
958
+ `).map(s=>s.replace(/^[\d]+[\.\、\s]+/,"").trim()).filter(s=>s.length>0).slice(0,3));let l=typeof marked<"u"?marked.parse(a):ae(a).replace(/\n/g,"<br>");Nt(oe.x,oe.y,l,i),xe(e.usage),X="";return}if(e.type==="SELECTION_TOOLBAR_RESULT")if(e.error)K="",xe(null),eo(oe.x,oe.y,e.error);else{let n=e.content||d("selToolbar.noResponse"),a=n;K=n;let i=[],r=n.indexOf("---SUGGESTIONS---");r!==-1&&(a=n.substring(0,r).trim(),K=a,i=n.substring(r+17).split(`
959
+ `).map(s=>s.replace(/^[\d]+[\.\、\s]+/,"").trim()).filter(s=>s.length>0).slice(0,3));let l=typeof marked<"u"?marked.parse(a):ae(a).replace(/\n/g,"<br>");Nt(oe.x,oe.y,l,i),xe(e.usage)}}}});function _n(){if(!q())return;let e=window.location.hostname;try{chrome.storage.local.get(["blockedDomains"],t=>{try{let o=t.blockedDomains||[];o.includes(e)||(o.push(e),chrome.storage.local.set({blockedDomains:o},()=>{de=o,L(),ie(),w=""}))}catch{}})}catch{}}function qn(){q()&&chrome.storage.local.get(["enableSelectionToolbar","blockedDomains"],e=>{Ae=e.enableSelectionToolbar===void 0?!0:!!e.enableSelectionToolbar,de=e.blockedDomains||[],E.debug("[SelectionToolbar] toggle state:",Ae?"enabled":"disabled","blocked domains:",de.length)})}var ze=!0,ue="light";function Un(){return ze?ue==="system"?typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":ue==="dark"?"dark":"light":"light"}function pt(){hn(Un())}function Kn(){q()&&chrome.storage.local.get(["appTheme","selectionToolbarFollowTheme"],e=>{ue=["light","dark","system"].includes(e.appTheme)?e.appTheme:"light",ze=e.selectionToolbarFollowTheme===void 0?!0:!!e.selectionToolbarFollowTheme,pt()})}q()&&chrome.storage.onChanged.addListener((e,t)=>{q()&&(t==="local"&&e.enableSelectionToolbar&&(Ae=!!e.enableSelectionToolbar.newValue,Ae||(L(),ie(),w="")),t==="local"&&e.blockedDomains&&(de=e.blockedDomains.newValue||[]),t==="local"&&e.toolbarTools&&Lt(),t==="local"&&(e.appTheme||e.selectionToolbarFollowTheme)&&(e.appTheme&&(ue=["light","dark","system"].includes(e.appTheme.newValue)?e.appTheme.newValue:ue),e.selectionToolbarFollowTheme&&(ze=!!e.selectionToolbarFollowTheme.newValue),pt()))}),bt(()=>{Lt(),b&&=(b.remove(),null),Zt(),f&&(f.remove(),f=null,M=!1,$=!1,K="")});function $n(){if(Gt(),Zt(),Jt(),qn(),Kn(),typeof matchMedia<"u"){let e=matchMedia("(prefers-color-scheme: dark)"),t=()=>{ze&&ue==="system"&&pt()};e.addEventListener?e.addEventListener("change",t):e.addListener&&e.addListener(t)}document.addEventListener("selectionchange",Ne),document.addEventListener("click",Mn,!0),document.addEventListener("mouseup",Ln,!0),window.addEventListener("scroll",Nn,!0),window.addEventListener("resize",Dn),window.addEventListener("message",e=>{if(e.data?.type==="IFRAME_SELECTION"&&H){if(M){w="",U=null;return}w=e.data.text;let t=e.data.x,o=e.data.y;if(window.top!==window&&window.frameElement)try{let n=window.frameElement.getBoundingClientRect();t=e.data.x-n.left,o=e.data.y-n.top}catch{}if(F&&b&&w){requestAnimationFrame(()=>{let n=window.innerWidth,a=b.offsetWidth||300,i=b.offsetHeight||40,r=t-a/2;r<8&&(r=8),r+a>n-8&&(r=n-a-8);let l=o-i-8;l<8&&(l=o+8),b.style.left=r+"px",b.style.top=l+"px"});return}U={x:t,y:o},w&&w.length>=2&&Ie(t,o);return}e.data?.type==="IFRAME_CLICK_DISMISS"&&H&&M&&!$&&ie()}),H&&(Ye=et(Ne),new MutationObserver(()=>{fo(Ye),Ye=et(Ne)}).observe(document.body,{childList:!0,subtree:!0})),E.debug("[SelectionToolbar] initialization complete",H?"(toplayerframe)":"(subframe)")}A("zh",{contentIndex:{invalidRef:"\u65E0\u6548\u7684\u5143\u7D20\u7F16\u53F7 ref={ref}\uFF0C\u8BF7\u5148\u8C03\u7528 query_elements",regionSelectHint:"\u62D6\u62FD\u9009\u62E9\u622A\u56FE\u533A\u57DF\uFF0C\u6309 Esc \u53D6\u6D88"}}),A("en",{contentIndex:{invalidRef:"Invalid element ref={ref}; please call query_elements first",regionSelectHint:"Drag to select the screenshot area; press Esc to cancel"}});var zn=wt();console.log("[ContentScript] content script loaded URL:",window.location.href,"isTopFrame:",window.top===window,"hasBody:",!!document.body),document.addEventListener("keydown",e=>{if((e.ctrlKey||e.metaKey)&&e.shiftKey&&e.key==="A"){e.preventDefault();try{chrome.action.click()}catch{}}if(e.altKey&&!e.shiftKey&&e.code==="KeyS"&&!e.ctrlKey&&!e.metaKey){e.preventDefault();try{chrome.runtime.sendMessage({type:"CAPTURE_TAB_FROM_PAGE"})}catch{}}if(e.altKey&&e.shiftKey&&e.code==="KeyS"&&!e.ctrlKey&&!e.metaKey){e.preventDefault();try{chrome.runtime.sendMessage({type:"CAPTURE_REGION_FROM_PAGE"})}catch{}}});var Gn={GET_PAGE_TEXT:e=>_o(e),GET_FULL_HTML:e=>qo(e),QUERY_ELEMENTS:e=>No(e),SNAPSHOT_COLLECT:e=>window.top!==window&&!Ro()?{success:!0,visible:!1}:$t({filterByText:e.filterByText,elementTypes:e.elementTypes,frames:e.frames==="none"?"none":"auto"}),GET_SELECTED_CONTENT:e=>Uo(e.format),INTERACT_ELEMENT:e=>e.ref==null?e.text?en(e.text,{tag:e.tag,action:e.action,waitTime:e.waitTime,timeout:e.timeout}):e.action==="hover"?Go(e.selector):Vo(e.selector,e.waitTime,e.timeout):Ho(e.ref,e.action,{waitTime:e.waitTime,timeout:e.timeout,value:e.value,clear:e.clear,submit:e.submit}),FILL_FORM:e=>jo(e.fields,e.waitTime),SCROLL_TO:e=>e.target==="text"&&e.text?Oo(e.text,{maxScrolls:e.maxScrolls,pauseMs:e.pauseMs}):Qo(e),KEYBOARD_INPUT:e=>Zo(e),FILE_UPLOAD:e=>Jo(e.selector,e.fileName,e.fileContent,e.fileType),EXTRACT_TABLE:e=>Ko(e.selector,e.includeHeaders,e.format),EXTRACT_METADATA:()=>bo(),EXTRACT_LINKS:e=>yo(e.filterType,e.includeImages),EXTRACT_FORMS:e=>wo(e.formSelector),EXTRACT_IMAGES:e=>xo(e),SEARCH_IN_PAGE:e=>ko(e),IFRAME_CONTENT:e=>vo(e.selector,e.includeNested,e.maxLength),SCROLL_COLLECT:e=>Fo(e),MANAGE_STORAGE:e=>on(e),INJECT_CSS:e=>e.injectMode==="highlight"?Wo(e.text,e.color):ln(e.css,e.targetSelector,e.injectMode),EVALUATE_DONE_CRITERIA:e=>cn(e.criteria),COPY_TO_CLIPBOARD:e=>$o(e.text),PASTE_FROM_CLIPBOARD:()=>zo(),WAIT_ELEMENT:e=>Yo(e.selector,e.state,e.timeout),SELECT_DROPDOWN:e=>{let t=e.triggerSelector;if(e.ref!=null&&!t){let o=dt(e.ref);if(!o.element)return{success:!1,error:d("contentIndex.invalidRef",{ref:e.ref}),...o.suggestions&&o.suggestions.length?{suggestions:o.suggestions}:{}};t=o.entry.selector}return tn(t,e.optionText,e.optionSelector,e.timeout)},QRCODE:e=>an(e.content,e.size,e.errorCorrection,e.showImage),START_REGION_SELECTION:()=>jn(),GET_PAGE_METRICS:()=>({width:Math.max(document.documentElement.scrollWidth,document.body.scrollWidth||0,window.innerWidth),height:Math.max(document.documentElement.scrollHeight,document.body.scrollHeight||0,window.innerHeight)})},Wn=new Set(["COPY_TO_CLIPBOARD","PASTE_FROM_CLIPBOARD","WAIT_ELEMENT","SELECT_DROPDOWN","QRCODE","START_REGION_SELECTION","INTERACT_ELEMENT","SCROLL_TO","KEYBOARD_INPUT"]),Vn=new Set(["GET_PAGE_TEXT","GET_FULL_HTML","EXTRACT_METADATA","EXTRACT_TABLE","IFRAME_CONTENT","QUERY_ELEMENTS","EVALUATE_DONE_CRITERIA","INTERACT_ELEMENT","SCROLL_TO"]);q()&&chrome.runtime.onMessage.addListener((e,t,o)=>{if(Vn.has(e.type)&&window.top!==window&&!e._frameRouted)return;if(e.action==="getSelectedText"){let i=window.getSelection()?.toString()?.trim()||"";if(i&&document.hasFocus())return o({text:i}),!0;let r=te();return r.text&&r.text.trim()&&document.hasFocus()&&o({text:r.text.trim()}),!0}let n=Gn[e.type];if(!n)return;let a=n(e);if(Wn.has(e.type)||a instanceof Promise)return Promise.resolve(a).then(o),!0;o(a)}),window.addEventListener("error",e=>{e.message&&e.message.includes("Extension context invalidated")&&e.preventDefault()}),window.addEventListener("unhandledrejection",e=>{(e.reason?.message||String(e.reason)).includes("Extension context invalidated")&&e.preventDefault()}),zn.then(()=>{$n()});function jn(){return new Promise(e=>{let t=document.createElement("div");t.id="__region_select_overlay__",t.style.cssText=`
957
960
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
958
961
  z-index: 2147483647; cursor: crosshair;
959
962
  background: rgba(0, 0, 0, 0.15);
@@ -968,4 +971,4 @@ ${t}`:n[e]||t;if(e==="ai-search"){L(),window.getSelection().removeAllRanges();tr
968
971
  padding: 8px 20px; border-radius: 20px;
969
972
  background: rgba(0, 0, 0, 0.75); color: #fff;
970
973
  font-size: 14px; font-family: sans-serif;
971
- `,n.textContent=d("contentIndex.regionSelectHint");let a=0,i=0,r=!1;function l(p){return{x:p.clientX,y:p.clientY}}function s(p,m,h,g){let b=Math.min(p,h),x=Math.min(m,g),v=Math.abs(h-p),S=Math.abs(g-m);o.style.left=b+"px",o.style.top=x+"px",o.style.width=v+"px",o.style.height=S+"px",o.style.display="block"}function c(){t.remove(),o.remove(),n.remove(),document.removeEventListener("keydown",u,!0)}function u(p){p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),c(),e(null))}t.addEventListener("mousedown",p=>{if(p.button!==0)return;p.preventDefault(),p.stopPropagation();let{x:m,y:h}=l(p);a=m,i=h,r=!0,document.body.appendChild(o),document.body.appendChild(n)}),t.addEventListener("mousemove",p=>{if(!r)return;p.preventDefault();let{x:m,y:h}=l(p);s(a,i,m,h)}),t.addEventListener("mouseup",p=>{if(!r)return;p.preventDefault(),p.stopPropagation(),r=!1;let{x:m,y:h}=l(p),g={x:Math.min(a,m),y:Math.min(i,h),width:Math.abs(m-a),height:Math.abs(h-i)};if(c(),g.width<10||g.height<10){e(null);return}requestAnimationFrame(()=>e(g))}),document.addEventListener("keydown",u,!0),document.body.appendChild(t)})}})();
974
+ `,n.textContent=d("contentIndex.regionSelectHint");let a=0,i=0,r=!1;function l(p){return{x:p.clientX,y:p.clientY}}function s(p,m,h,g){let y=Math.min(p,h),v=Math.min(m,g),k=Math.abs(h-p),S=Math.abs(g-m);o.style.left=y+"px",o.style.top=v+"px",o.style.width=k+"px",o.style.height=S+"px",o.style.display="block"}function c(){t.remove(),o.remove(),n.remove(),document.removeEventListener("keydown",u,!0)}function u(p){p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),c(),e(null))}t.addEventListener("mousedown",p=>{if(p.button!==0)return;p.preventDefault(),p.stopPropagation();let{x:m,y:h}=l(p);a=m,i=h,r=!0,document.body.appendChild(o),document.body.appendChild(n)}),t.addEventListener("mousemove",p=>{if(!r)return;p.preventDefault();let{x:m,y:h}=l(p);s(a,i,m,h)}),t.addEventListener("mouseup",p=>{if(!r)return;p.preventDefault(),p.stopPropagation(),r=!1;let{x:m,y:h}=l(p),g={x:Math.min(a,m),y:Math.min(i,h),width:Math.abs(m-a),height:Math.abs(h-i)};if(c(),g.width<10||g.height<10){e(null);return}requestAnimationFrame(()=>e(g))}),document.addEventListener("keydown",u,!0),document.body.appendChild(t)})}})();