@ryuu-64/dsh-find-all 0.1.11 → 0.1.13
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.
- package/CHANGELOG.md +19 -0
- package/README.md +40 -10
- package/docs/compatibility.md +62 -0
- package/lib/client.js +1215 -271
- package/lib/index.js +12 -10
- package/lib/search-host.js +223 -0
- package/package.json +2 -2
package/lib/client.js
CHANGED
|
@@ -32,9 +32,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
32
32
|
));
|
|
33
33
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
34
34
|
|
|
35
|
-
//
|
|
35
|
+
// node_modules/semver/internal/debug.js
|
|
36
36
|
var require_debug = __commonJS({
|
|
37
|
-
"
|
|
37
|
+
"node_modules/semver/internal/debug.js"(exports, module2) {
|
|
38
38
|
"use strict";
|
|
39
39
|
var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
|
|
40
40
|
};
|
|
@@ -42,9 +42,9 @@ var require_debug = __commonJS({
|
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
//
|
|
45
|
+
// node_modules/semver/internal/constants.js
|
|
46
46
|
var require_constants = __commonJS({
|
|
47
|
-
"
|
|
47
|
+
"node_modules/semver/internal/constants.js"(exports, module2) {
|
|
48
48
|
"use strict";
|
|
49
49
|
var SEMVER_SPEC_VERSION = "2.0.0";
|
|
50
50
|
var MAX_LENGTH = 256;
|
|
@@ -74,9 +74,9 @@ var require_constants = __commonJS({
|
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
-
//
|
|
77
|
+
// node_modules/semver/internal/re.js
|
|
78
78
|
var require_re = __commonJS({
|
|
79
|
-
"
|
|
79
|
+
"node_modules/semver/internal/re.js"(exports, module2) {
|
|
80
80
|
"use strict";
|
|
81
81
|
var {
|
|
82
82
|
MAX_SAFE_COMPONENT_LENGTH,
|
|
@@ -162,9 +162,9 @@ var require_re = __commonJS({
|
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
164
|
|
|
165
|
-
//
|
|
165
|
+
// node_modules/semver/internal/parse-options.js
|
|
166
166
|
var require_parse_options = __commonJS({
|
|
167
|
-
"
|
|
167
|
+
"node_modules/semver/internal/parse-options.js"(exports, module2) {
|
|
168
168
|
"use strict";
|
|
169
169
|
var looseOption = Object.freeze({ loose: true });
|
|
170
170
|
var emptyOpts = Object.freeze({});
|
|
@@ -181,9 +181,9 @@ var require_parse_options = __commonJS({
|
|
|
181
181
|
}
|
|
182
182
|
});
|
|
183
183
|
|
|
184
|
-
//
|
|
184
|
+
// node_modules/semver/internal/identifiers.js
|
|
185
185
|
var require_identifiers = __commonJS({
|
|
186
|
-
"
|
|
186
|
+
"node_modules/semver/internal/identifiers.js"(exports, module2) {
|
|
187
187
|
"use strict";
|
|
188
188
|
var numeric = /^[0-9]+$/;
|
|
189
189
|
var compareIdentifiers = (a, b) => {
|
|
@@ -206,9 +206,9 @@ var require_identifiers = __commonJS({
|
|
|
206
206
|
}
|
|
207
207
|
});
|
|
208
208
|
|
|
209
|
-
//
|
|
209
|
+
// node_modules/semver/classes/semver.js
|
|
210
210
|
var require_semver = __commonJS({
|
|
211
|
-
"
|
|
211
|
+
"node_modules/semver/classes/semver.js"(exports, module2) {
|
|
212
212
|
"use strict";
|
|
213
213
|
var debug = require_debug();
|
|
214
214
|
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
@@ -498,9 +498,9 @@ var require_semver = __commonJS({
|
|
|
498
498
|
}
|
|
499
499
|
});
|
|
500
500
|
|
|
501
|
-
//
|
|
501
|
+
// node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js
|
|
502
502
|
var require_react_dom_server_legacy_browser_production_min = __commonJS({
|
|
503
|
-
"
|
|
503
|
+
"node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js"(exports) {
|
|
504
504
|
"use strict";
|
|
505
505
|
/**
|
|
506
506
|
* @license React
|
|
@@ -1301,7 +1301,7 @@ var require_react_dom_server_legacy_browser_production_min = __commonJS({
|
|
|
1301
1301
|
var ob = null;
|
|
1302
1302
|
var J = null;
|
|
1303
1303
|
var K = null;
|
|
1304
|
-
var
|
|
1304
|
+
var L3 = false;
|
|
1305
1305
|
var M = false;
|
|
1306
1306
|
var N = 0;
|
|
1307
1307
|
var O = null;
|
|
@@ -1315,7 +1315,7 @@ var require_react_dom_server_legacy_browser_production_min = __commonJS({
|
|
|
1315
1315
|
return { memoizedState: null, queue: null, next: null };
|
|
1316
1316
|
}
|
|
1317
1317
|
function qb() {
|
|
1318
|
-
null === K ? null === J ? (
|
|
1318
|
+
null === K ? null === J ? (L3 = false, J = K = pb()) : (L3 = true, K = J) : null === K.next ? (L3 = false, K = K.next = pb()) : (L3 = true, K = K.next);
|
|
1319
1319
|
return K;
|
|
1320
1320
|
}
|
|
1321
1321
|
function rb() {
|
|
@@ -1331,7 +1331,7 @@ var require_react_dom_server_legacy_browser_production_min = __commonJS({
|
|
|
1331
1331
|
function tb(a, b, c) {
|
|
1332
1332
|
I = Q();
|
|
1333
1333
|
K = qb();
|
|
1334
|
-
if (
|
|
1334
|
+
if (L3) {
|
|
1335
1335
|
var d = K.queue;
|
|
1336
1336
|
b = d.dispatch;
|
|
1337
1337
|
if (null !== O && (c = O.get(d), void 0 !== c)) {
|
|
@@ -2036,9 +2036,9 @@ var require_react_dom_server_legacy_browser_production_min = __commonJS({
|
|
|
2036
2036
|
}
|
|
2037
2037
|
});
|
|
2038
2038
|
|
|
2039
|
-
//
|
|
2039
|
+
// node_modules/react-dom/cjs/react-dom-server.browser.production.min.js
|
|
2040
2040
|
var require_react_dom_server_browser_production_min = __commonJS({
|
|
2041
|
-
"
|
|
2041
|
+
"node_modules/react-dom/cjs/react-dom-server.browser.production.min.js"(exports) {
|
|
2042
2042
|
"use strict";
|
|
2043
2043
|
/**
|
|
2044
2044
|
* @license React
|
|
@@ -2382,7 +2382,7 @@ var require_react_dom_server_browser_production_min = __commonJS({
|
|
|
2382
2382
|
}
|
|
2383
2383
|
var K = w(">");
|
|
2384
2384
|
var Ka = w("/>");
|
|
2385
|
-
function
|
|
2385
|
+
function L3(a, b, c) {
|
|
2386
2386
|
if (null != b) {
|
|
2387
2387
|
if (null != c) throw Error(k(60));
|
|
2388
2388
|
if ("object" !== typeof b || !("__html" in b)) throw Error(k(61));
|
|
@@ -2415,7 +2415,7 @@ var require_react_dom_server_browser_production_min = __commonJS({
|
|
|
2415
2415
|
}
|
|
2416
2416
|
}
|
|
2417
2417
|
a.push(K);
|
|
2418
|
-
|
|
2418
|
+
L3(a, f, c);
|
|
2419
2419
|
return "string" === typeof c ? (a.push(u(C(c))), null) : c;
|
|
2420
2420
|
}
|
|
2421
2421
|
var Oa = w("\n");
|
|
@@ -2453,7 +2453,7 @@ var require_react_dom_server_browser_production_min = __commonJS({
|
|
|
2453
2453
|
}
|
|
2454
2454
|
}
|
|
2455
2455
|
a.push(K);
|
|
2456
|
-
|
|
2456
|
+
L3(a, g, e);
|
|
2457
2457
|
return e;
|
|
2458
2458
|
case "option":
|
|
2459
2459
|
g = f.selectedValue;
|
|
@@ -2487,7 +2487,7 @@ var require_react_dom_server_browser_production_min = __commonJS({
|
|
|
2487
2487
|
else "" + g === c && a.push(Ma);
|
|
2488
2488
|
else q && a.push(Ma);
|
|
2489
2489
|
a.push(K);
|
|
2490
|
-
|
|
2490
|
+
L3(a, r, h);
|
|
2491
2491
|
return h;
|
|
2492
2492
|
case "textarea":
|
|
2493
2493
|
a.push(M("textarea"));
|
|
@@ -2652,7 +2652,7 @@ var require_react_dom_server_browser_production_min = __commonJS({
|
|
|
2652
2652
|
ia(q) && "function" !== typeof h && "symbol" !== typeof h && a.push(H, u(q), I, u(C(h)), E);
|
|
2653
2653
|
}
|
|
2654
2654
|
a.push(K);
|
|
2655
|
-
|
|
2655
|
+
L3(a, g, e);
|
|
2656
2656
|
return e;
|
|
2657
2657
|
}
|
|
2658
2658
|
}
|
|
@@ -3671,9 +3671,9 @@ var require_react_dom_server_browser_production_min = __commonJS({
|
|
|
3671
3671
|
}
|
|
3672
3672
|
});
|
|
3673
3673
|
|
|
3674
|
-
//
|
|
3674
|
+
// node_modules/react-dom/server.browser.js
|
|
3675
3675
|
var require_server_browser = __commonJS({
|
|
3676
|
-
"
|
|
3676
|
+
"node_modules/react-dom/server.browser.js"(exports) {
|
|
3677
3677
|
"use strict";
|
|
3678
3678
|
var l;
|
|
3679
3679
|
var s;
|
|
@@ -3708,10 +3708,746 @@ __export(client_exports, {
|
|
|
3708
3708
|
});
|
|
3709
3709
|
module.exports = __toCommonJS(client_exports);
|
|
3710
3710
|
|
|
3711
|
+
// src/conversation-search.js
|
|
3712
|
+
var ENDPOINT = "api/dsh-find-all/search";
|
|
3713
|
+
var DEFAULT_SCOPE = "ordinary-unarchived";
|
|
3714
|
+
var ARCHIVED_SCOPE = "ordinary-including-archived";
|
|
3715
|
+
var PAGE_MATCH_TARGET = 20;
|
|
3716
|
+
var EMPTY = { items: [], cursor: null, scanned: 0, total: 0, failed: 0, skipped: 0, complete: false };
|
|
3717
|
+
var zh = typeof navigator !== "undefined" && /^zh/i.test(navigator.language || "");
|
|
3718
|
+
var L = zh ? {
|
|
3719
|
+
title: "\u5BF9\u8BDD\u5168\u6587\u641C\u7D22",
|
|
3720
|
+
close: "\u5173\u95ED\u5BF9\u8BDD\u5168\u6587\u641C\u7D22",
|
|
3721
|
+
placeholder: "\u641C\u7D22\u6807\u9898\u548C\u6B63\u6587\u2026",
|
|
3722
|
+
titlePlaceholder: "\u641C\u7D22\u6807\u9898\u2026",
|
|
3723
|
+
scope: "\u641C\u7D22\u8303\u56F4\uFF1A\u6240\u6709\u5DE5\u4F5C\u533A",
|
|
3724
|
+
scopeDetails: "\u641C\u7D22\u5F53\u524D\u8FDE\u63A5\u670D\u52A1\u4E2D\u3001\u6240\u6709\u5DE5\u4F5C\u533A\u7684\u666E\u901A\u975E\u7A7A\u5BF9\u8BDD\uFF1B\u9ED8\u8BA4\u4E0D\u542B\u5F52\u6863\uFF0C\u53EF\u52FE\u9009\u5305\u542B\u5F52\u6863\uFF1B\u4E0D\u5305\u542B\u5B50\u4EE3\u7406\u5BF9\u8BDD\u3002",
|
|
3725
|
+
includeArchived: "\u5305\u542B\u5F52\u6863",
|
|
3726
|
+
archived: "\u5DF2\u5F52\u6863",
|
|
3727
|
+
restore: "\u53D6\u6D88\u5F52\u6863\u5E76\u6253\u5F00",
|
|
3728
|
+
restoring: "\u6B63\u5728\u53D6\u6D88\u5F52\u6863\u2026",
|
|
3729
|
+
restoreUnavailable: "\u5F53\u524D\u5BBF\u4E3B\u4E0D\u652F\u6301\u53D6\u6D88\u5F52\u6863\u3002",
|
|
3730
|
+
restoreUnconfirmed: "\u672A\u80FD\u786E\u8BA4\u53D6\u6D88\u5F52\u6863\uFF0C\u5C1A\u672A\u6253\u5F00\uFF1B\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
|
|
3731
|
+
restoredOpenFailed: "\u5DF2\u53D6\u6D88\u5F52\u6863\uFF0C\u4F46\u672A\u80FD\u6253\u5F00\u5BF9\u8BDD\u3002\u53EF\u8FD4\u56DE\u7ED3\u679C\u91CD\u8BD5\u3002",
|
|
3732
|
+
restoredFindFailed: "\u5DF2\u53D6\u6D88\u5F52\u6863\uFF0C\u4F46\u672A\u80FD\u63A5\u5165\u804A\u5929\u6B63\u6587\u67E5\u627E\u3002\u53EF\u8FD4\u56DE\u7ED3\u679C\u91CD\u8BD5\u3002",
|
|
3733
|
+
archivedNow: "\u8BE5\u5BF9\u8BDD\u5DF2\u5F52\u6863\uFF1B\u8BF7\u4F7F\u7528\u201C\u53D6\u6D88\u5F52\u6863\u5E76\u6253\u5F00\u201D\u3002",
|
|
3734
|
+
help: "\u641C\u7D22\u8BF4\u660E",
|
|
3735
|
+
shown: (n) => `${n}\u4E2A\u5BF9\u8BDD`,
|
|
3736
|
+
page: (n) => `\u5DF2\u663E\u793A${n}\u4E2A\u5BF9\u8BDD \xB7 \u8FD8\u6709\u672A\u641C\u7D22\u7684\u5BF9\u8BDD`,
|
|
3737
|
+
unavailableShort: "\u641C\u7D22\u670D\u52A1\u6682\u4E0D\u53EF\u7528",
|
|
3738
|
+
stoppedShort: "\u641C\u7D22\u5DF2\u505C\u6B62",
|
|
3739
|
+
partialShort: "\u641C\u7D22\u7ED3\u679C\u4E0D\u5B8C\u6574",
|
|
3740
|
+
noMatchesYet: "\u6682\u672A\u627E\u5230\u5339\u914D\u7684\u5BF9\u8BDD",
|
|
3741
|
+
semantics: "\u5B57\u9762\u5B50\u4E32\u5339\u914D\uFF0C\u4E0D\u533A\u5206\u5927\u5C0F\u5199\uFF1B\u6B63\u6587\u542B\u539F\u59CB Markdown\uFF0C\u4E0D\u542B\u601D\u8003\u6216\u5DE5\u5177\u5185\u5BB9\u3002",
|
|
3742
|
+
handoff: "\u6253\u5F00\u5BF9\u8BDD\u540E\u7EE7\u7EED\u7528\u6B64\u5173\u952E\u8BCD\u67E5\u627E\uFF0C\u4E0D\u76F4\u63A5\u8DF3\u5230\u6458\u8981\u539F\u53E5\u3002\u539F\u59CB Markdown \u4F4D\u7F6E\u4E0D\u662F\u9875\u9762\u4F4D\u7F6E\uFF1B\u8DE8\u683C\u5F0F\u7684\u53EF\u89C1\u77ED\u8BED\u53EF\u80FD\u4E0D\u5339\u914D\uFF0C\u4F1A\u8BDD\u5185\u67E5\u627E\u7ED3\u679C\u4E5F\u53EF\u80FD\u4E0D\u540C\u3002",
|
|
3743
|
+
snapshot: "\u5019\u9009\u5217\u8868\u5728\u5F00\u59CB\u65F6\u56FA\u5B9A\uFF1B\u65B0\u589E\u6216\u4FEE\u6539\u5BF9\u8BDD\u540E\uFF0C\u5728\u641C\u7D22\u6846\u6309 Enter \u5237\u65B0\u3002",
|
|
3744
|
+
emptyQuery: "\u8F93\u5165\u5173\u952E\u8BCD\u5F00\u59CB\u641C\u7D22\u3002",
|
|
3745
|
+
invalidShort: "\u8BF7\u8C03\u6574\u641C\u7D22\u5173\u952E\u8BCD",
|
|
3746
|
+
invalid: "\u5173\u952E\u8BCD\u6700\u591A 500 \u4E2A\u5B57\u7B26\uFF0C\u4E0D\u80FD\u5305\u542B\u7A7A\u5B57\u7B26\u3002",
|
|
3747
|
+
pending: "\u6B63\u5728\u626B\u63CF\u5BF9\u8BDD\u2026",
|
|
3748
|
+
unavailable: "\u5B8C\u6574\u641C\u7D22\u670D\u52A1\u4E0D\u53EF\u7528\uFF1B\u8BF7\u68C0\u67E5\u670D\u52A1\u7AEF\u6269\u5C55\u548C\u8FDE\u63A5\u540E\u91CD\u8BD5\u3002\u5DF2\u786E\u8BA4\u7684\u7ED3\u679C\u4FDD\u7559\u3002",
|
|
3749
|
+
stopped: "\u641C\u7D22\u5DF2\u505C\u6B62\uFF1B\u4FDD\u7559\u5DF2\u786E\u8BA4\u7684\u7ED3\u679C\uFF0C\u626B\u63CF\u5C1A\u672A\u5B8C\u6210\u3002",
|
|
3750
|
+
failedList: "\u4F1A\u8BDD\u5217\u8868\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
3751
|
+
loading: "\u6B63\u5728\u8BFB\u53D6\u4F1A\u8BDD\u5217\u8868\u2026",
|
|
3752
|
+
unsupported: "\u5F53\u524D\u5BBF\u4E3B\u6682\u4E0D\u652F\u6301\u5BF9\u8BDD\u5168\u6587\u641C\u7D22\u3002",
|
|
3753
|
+
noMatches: "\u672A\u627E\u5230\u5339\u914D\u7684\u5BF9\u8BDD\u3002",
|
|
3754
|
+
more: "\u7EE7\u7EED\u52A0\u8F7D\u7ED3\u679C",
|
|
3755
|
+
titleOnly: "\u4EC5\u6807\u9898",
|
|
3756
|
+
progress: (n, total) => `\u5DF2\u626B\u63CF ${n} / ${total} \u4E2A\u5BF9\u8BDD`,
|
|
3757
|
+
partial: (failed, skipped) => `\u7ED3\u679C\u4E0D\u5B8C\u6574\uFF1A${failed} \u4E2A\u8BFB\u53D6\u5931\u8D25\uFF0C${skipped} \u4E2A\u8DF3\u8FC7\u3002`,
|
|
3758
|
+
incomplete: "\u5C1A\u6709\u5BF9\u8BDD\u672A\u626B\u63CF\u3002",
|
|
3759
|
+
retry: "\u91CD\u8BD5",
|
|
3760
|
+
cancel: "\u505C\u6B62\u641C\u7D22",
|
|
3761
|
+
untitled: "\u672A\u547D\u540D\u5BF9\u8BDD",
|
|
3762
|
+
order: "\u81EA\u52A8\u626B\u63CF\u5E76\u9010\u6B65\u663E\u793A\uFF0C\u76F4\u5230\u672C\u9875\u627E\u5230\u81F3\u5C11 20 \u4E2A\u5339\u914D\u5BF9\u8BDD\u6216\u626B\u63CF\u5B8C\u6BD5\uFF1B\u7EE7\u7EED\u52A0\u8F7D\u53EF\u67E5\u4E0B\u4E00\u9875\u3002\u7ED3\u679C\u6309\u626B\u63CF\u987A\u5E8F\u663E\u793A\u3002",
|
|
3763
|
+
missing: "\u8BE5\u5BF9\u8BDD\u5DF2\u4E0D\u5728\u53EF\u6253\u5F00\u7684\u5217\u8868\u4E2D\uFF0C\u53EF\u80FD\u5DF2\u5F52\u6863\u3001\u5220\u9664\u6216\u5931\u53BB\u8BBF\u95EE\u6743\u9650\u3002",
|
|
3764
|
+
opening: "\u6B63\u5728\u6253\u5F00\u5BF9\u8BDD\u2026",
|
|
3765
|
+
openFailed: "\u672A\u80FD\u6253\u5F00\u8BE5\u5BF9\u8BDD\u3002\u53EF\u4EE5\u8FD4\u56DE\u7ED3\u679C\u91CD\u8BD5\u3002",
|
|
3766
|
+
chatNeeded: "\u672A\u80FD\u63A5\u5165\u8BE5\u5BF9\u8BDD\u7684\u804A\u5929\u6B63\u6587\u3002\u8BF7\u5207\u6362\u5230 Chat\uFF0F\u804A\u5929\u89C6\u56FE\uFF0C\u518D\u4ECE\u641C\u7D22\u7ED3\u679C\u91CD\u8BD5\u3002",
|
|
3767
|
+
interrupted: "\u5DF2\u505C\u6B62\u7EE7\u7EED\u67E5\u627E\uFF1B\u53EF\u91CD\u65B0\u6253\u5F00\u641C\u7D22\u7ED3\u679C\u3002",
|
|
3768
|
+
back: "\u8FD4\u56DE\u641C\u7D22\u7ED3\u679C"
|
|
3769
|
+
} : {
|
|
3770
|
+
title: "Full-text conversation search",
|
|
3771
|
+
close: "Close full-text conversation search",
|
|
3772
|
+
placeholder: "Search titles and message text\u2026",
|
|
3773
|
+
titlePlaceholder: "Search titles\u2026",
|
|
3774
|
+
scope: "Search scope: All workspaces",
|
|
3775
|
+
scopeDetails: "Searches ordinary, nonempty conversations across all workspaces on the connected server. Archived conversations are excluded unless Include archived is checked. Subagent conversations are excluded.",
|
|
3776
|
+
includeArchived: "Include archived",
|
|
3777
|
+
archived: "Archived",
|
|
3778
|
+
restore: "Unarchive and open",
|
|
3779
|
+
restoring: "Unarchiving\u2026",
|
|
3780
|
+
restoreUnavailable: "This Host does not support unarchiving.",
|
|
3781
|
+
restoreUnconfirmed: "Unarchiving could not be confirmed, so the conversation was not opened. Try again shortly.",
|
|
3782
|
+
restoredOpenFailed: "Unarchived, but the conversation could not be opened. Return to the results to retry.",
|
|
3783
|
+
restoredFindFailed: "Unarchived, but chat text could not be reached for find. Return to the results to retry.",
|
|
3784
|
+
archivedNow: "This conversation is archived. Use Unarchive and open.",
|
|
3785
|
+
help: "Search help",
|
|
3786
|
+
shown: (n) => `${n} conversations`,
|
|
3787
|
+
page: (n) => `${n} conversations shown \xB7 More conversations remain unsearched`,
|
|
3788
|
+
unavailableShort: "Search service unavailable",
|
|
3789
|
+
stoppedShort: "Search stopped",
|
|
3790
|
+
partialShort: "Search results are incomplete",
|
|
3791
|
+
noMatchesYet: "No matching conversations yet",
|
|
3792
|
+
semantics: "Case-insensitive literal substring search. Body text includes raw Markdown, but excludes reasoning and tool content.",
|
|
3793
|
+
handoff: "Open a conversation to continue finding this query, without an exact-message jump. Raw Markdown offsets are not page positions; phrases crossing formatting may not match, and in-conversation find may differ.",
|
|
3794
|
+
snapshot: "Candidates are fixed when the scan starts. Press Enter in the search field to refresh after adding or changing conversations.",
|
|
3795
|
+
emptyQuery: "Enter a query to search.",
|
|
3796
|
+
invalidShort: "Adjust your search query",
|
|
3797
|
+
invalid: "Use at most 500 characters, without null characters.",
|
|
3798
|
+
pending: "Scanning conversations\u2026",
|
|
3799
|
+
unavailable: "Full search service unavailable. Check the server extension and connection, then retry. Confirmed results are kept.",
|
|
3800
|
+
stopped: "Search stopped. Confirmed results are kept; the scan is incomplete.",
|
|
3801
|
+
failedList: "Conversation list unavailable. Try again.",
|
|
3802
|
+
loading: "Loading conversation list\u2026",
|
|
3803
|
+
unsupported: "Full-text conversation search is unsupported on this Host.",
|
|
3804
|
+
noMatches: "No matching conversations found.",
|
|
3805
|
+
more: "Load more results",
|
|
3806
|
+
titleOnly: "Titles only",
|
|
3807
|
+
progress: (n, total) => `${n} / ${total} conversations scanned`,
|
|
3808
|
+
partial: (failed, skipped) => `Incomplete results: ${failed} failed, ${skipped} skipped.`,
|
|
3809
|
+
incomplete: "Some conversations remain unscanned.",
|
|
3810
|
+
retry: "Retry",
|
|
3811
|
+
cancel: "Stop search",
|
|
3812
|
+
untitled: "Untitled conversation",
|
|
3813
|
+
order: "Automatically scans and shows matches until at least 20 more conversations are found or the scan finishes. Load more results for the next page. Results follow scan order.",
|
|
3814
|
+
missing: "This conversation is no longer openable. It may be archived, deleted, or inaccessible.",
|
|
3815
|
+
opening: "Opening conversation\u2026",
|
|
3816
|
+
openFailed: "Could not open this conversation. Return to the results to retry.",
|
|
3817
|
+
chatNeeded: "The conversation\u2019s chat content is unavailable. Switch to Chat view, then retry from the search results.",
|
|
3818
|
+
interrupted: "Find handoff stopped. You can reopen the search results.",
|
|
3819
|
+
back: "Back to search results"
|
|
3820
|
+
};
|
|
3821
|
+
function catalog(sessions, workspaces, includeArchived = false) {
|
|
3822
|
+
const list = sessions?.list?.getSnapshot?.();
|
|
3823
|
+
const spaces = workspaces?.list?.getSnapshot?.();
|
|
3824
|
+
if (!list || !spaces || !Array.isArray(list.ids) || !list.byId || !Array.isArray(spaces.items) || !Array.isArray(spaces.archivedSessionIds)) return { status: "unsupported", rows: [] };
|
|
3825
|
+
if (spaces.state === "error") return { status: "failedList", rows: [] };
|
|
3826
|
+
if (list.phase !== "ready" || spaces.phase !== "ready" || spaces.state === "loading") return { status: "loading", rows: [] };
|
|
3827
|
+
const archived = new Set(spaces.archivedSessionIds);
|
|
3828
|
+
const names = /* @__PURE__ */ new Map();
|
|
3829
|
+
for (const space of spaces.items) for (const id of space.sessionIds || []) if (!names.has(id)) names.set(id, typeof space.title === "string" ? space.title : "");
|
|
3830
|
+
const rows = [];
|
|
3831
|
+
for (const id of list.ids) {
|
|
3832
|
+
const row = list.byId[id];
|
|
3833
|
+
if (!row || row.id !== id || row.origin === "subagent" || row.blank || !includeArchived && archived.has(id)) continue;
|
|
3834
|
+
rows.push({ id, archived: archived.has(id), title: typeof row.title === "string" ? row.title.trim() : "", updatedAt: Number.isFinite(row.updatedAt) ? row.updatedAt : 0, workspace: names.get(id) || "", selected: row.retainedBy?.mainView > 0 });
|
|
3835
|
+
}
|
|
3836
|
+
return { status: "ready", rows };
|
|
3837
|
+
}
|
|
3838
|
+
function merge(rows, content) {
|
|
3839
|
+
const valid = new Map(rows.map((row) => [row.id, row]));
|
|
3840
|
+
return { ...content, items: content.items.filter((item) => valid.has(item.sessionId)).map((item) => ({ ...valid.get(item.sessionId), ...item, archived: valid.get(item.sessionId).archived })) };
|
|
3841
|
+
}
|
|
3842
|
+
function literalMatcher(query) {
|
|
3843
|
+
return new RegExp(query.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "giu");
|
|
3844
|
+
}
|
|
3845
|
+
function literalRanges(text, query) {
|
|
3846
|
+
const needle = query.trim(), ranges = [];
|
|
3847
|
+
if (needle) for (const match of text.matchAll(literalMatcher(needle))) ranges.push({ start: match.index, end: match.index + match[0].length });
|
|
3848
|
+
return ranges;
|
|
3849
|
+
}
|
|
3850
|
+
function highlightedText(h, text, ranges) {
|
|
3851
|
+
const parts = [];
|
|
3852
|
+
let cursor = 0;
|
|
3853
|
+
for (const { start, end } of ranges) {
|
|
3854
|
+
parts.push(text.slice(cursor, start), h("mark", { key: start, className: "dsh-find-all-conversations-match" }, text.slice(start, end)));
|
|
3855
|
+
cursor = end;
|
|
3856
|
+
}
|
|
3857
|
+
parts.push(text.slice(cursor));
|
|
3858
|
+
return parts;
|
|
3859
|
+
}
|
|
3860
|
+
function searchValue(value, requestId, query, scope) {
|
|
3861
|
+
if (!value || value.version !== 1 || value.requestId !== requestId || value.scope !== scope || !Array.isArray(value.items) || !(value.cursor === null || typeof value.cursor === "string" && value.cursor.length > 0) || typeof value.complete !== "boolean" || value.complete !== (value.cursor === null) || ["scanned", "total", "failed", "skipped"].some((key) => !Number.isSafeInteger(value[key]) || value[key] < 0) || value.scanned > value.total || value.complete && value.scanned !== value.total) return null;
|
|
3862
|
+
const items = [];
|
|
3863
|
+
for (const row of value.items) {
|
|
3864
|
+
if (!row || typeof row.sessionId !== "string" || typeof row.archived !== "boolean" || typeof row.titleMatch !== "boolean" || typeof row.bodyMatch !== "boolean" || !(row.titleMatch || row.bodyMatch) || row.title !== void 0 && typeof row.title !== "string" || typeof row.snippet !== "string" || !Array.isArray(row.ranges)) return null;
|
|
3865
|
+
let last = 0;
|
|
3866
|
+
for (const range of row.ranges) {
|
|
3867
|
+
if (!range || !Number.isSafeInteger(range.start) || !Number.isSafeInteger(range.end) || range.start < last || range.end <= range.start || range.end > row.snippet.length || !literalRanges(row.snippet.slice(range.start, range.end), query).some((match) => match.start === 0 && match.end === range.end - range.start)) return null;
|
|
3868
|
+
last = range.end;
|
|
3869
|
+
}
|
|
3870
|
+
items.push({ sessionId: row.sessionId, archived: row.archived, ...row.title !== void 0 ? { title: row.title } : {}, titleMatch: row.titleMatch, bodyMatch: row.bodyMatch, snippet: row.snippet, ranges: row.ranges });
|
|
3871
|
+
}
|
|
3872
|
+
return { items, cursor: value.cursor, scanned: value.scanned, total: value.total, failed: value.failed, skipped: value.skipped, complete: value.complete };
|
|
3873
|
+
}
|
|
3874
|
+
function installConversationSearch(ctx, react, ui, bridge) {
|
|
3875
|
+
const h = react.createElement;
|
|
3876
|
+
let services = null, mounted = true, epoch = 0, request = null, timer = 0;
|
|
3877
|
+
let scanId = null, mode = "title-body", includeArchived = false;
|
|
3878
|
+
let restoreOperation = null, restoreFeedback = null;
|
|
3879
|
+
const scope = () => includeArchived ? ARCHIVED_SCOPE : DEFAULT_SCOPE;
|
|
3880
|
+
const invalidateRestoreNavigation = () => {
|
|
3881
|
+
if (restoreOperation) restoreOperation.navigate = false;
|
|
3882
|
+
restoreFeedback = null;
|
|
3883
|
+
};
|
|
3884
|
+
let open2 = false, query = "", body = "idle", content = EMPTY, scroll = 0, notice = "", focusOrigin = null;
|
|
3885
|
+
let handoff = null, handoffTimer = 0, handoffStops = [], listStops = [], lastCatalogStatus = "";
|
|
3886
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
3887
|
+
let revision = 0;
|
|
3888
|
+
const publish = () => {
|
|
3889
|
+
revision++;
|
|
3890
|
+
for (const listener of listeners) listener();
|
|
3891
|
+
};
|
|
3892
|
+
const currentCatalog = () => {
|
|
3893
|
+
try {
|
|
3894
|
+
return services ? catalog(ctx.sessions, services.workspaces, includeArchived) : { status: "unsupported", rows: [] };
|
|
3895
|
+
} catch (_) {
|
|
3896
|
+
return { status: "failedList", rows: [] };
|
|
3897
|
+
}
|
|
3898
|
+
};
|
|
3899
|
+
const cancelRequest = () => {
|
|
3900
|
+
epoch++;
|
|
3901
|
+
clearTimeout(timer);
|
|
3902
|
+
timer = 0;
|
|
3903
|
+
request?.abort();
|
|
3904
|
+
request = null;
|
|
3905
|
+
const id = scanId;
|
|
3906
|
+
scanId = null;
|
|
3907
|
+
if (id) {
|
|
3908
|
+
content = { ...content, cursor: null };
|
|
3909
|
+
try {
|
|
3910
|
+
Promise.resolve(fetch(ENDPOINT, { method: "POST", credentials: "same-origin", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ version: 1, action: "cancel", requestId: id }), keepalive: true })).catch(() => {
|
|
3911
|
+
});
|
|
3912
|
+
} catch (_) {
|
|
3913
|
+
}
|
|
3914
|
+
}
|
|
3915
|
+
};
|
|
3916
|
+
function cancelHandoff(message = "") {
|
|
3917
|
+
if (!handoff) return;
|
|
3918
|
+
handoff = null;
|
|
3919
|
+
clearTimeout(handoffTimer);
|
|
3920
|
+
handoffTimer = 0;
|
|
3921
|
+
for (const stop of handoffStops) stop();
|
|
3922
|
+
handoffStops = [];
|
|
3923
|
+
notice = message;
|
|
3924
|
+
publish();
|
|
3925
|
+
}
|
|
3926
|
+
function stopLists() {
|
|
3927
|
+
for (const stop of listStops) stop();
|
|
3928
|
+
listStops = [];
|
|
3929
|
+
}
|
|
3930
|
+
function watchLists() {
|
|
3931
|
+
stopLists();
|
|
3932
|
+
if (!services || !open2) return;
|
|
3933
|
+
const changed = () => {
|
|
3934
|
+
const status = currentCatalog().status;
|
|
3935
|
+
if (status !== "ready" && (scanId || body === "pending")) {
|
|
3936
|
+
const unfinished = body === "pending" || !content.complete;
|
|
3937
|
+
cancelRequest();
|
|
3938
|
+
if (unfinished) body = "stopped";
|
|
3939
|
+
}
|
|
3940
|
+
const wasReady = lastCatalogStatus === "ready";
|
|
3941
|
+
lastCatalogStatus = status;
|
|
3942
|
+
if (!wasReady && status === "ready" && body === "idle") schedule();
|
|
3943
|
+
publish();
|
|
3944
|
+
};
|
|
3945
|
+
listStops = [ctx.sessions.list.subscribe(changed), services.workspaces.list.subscribe(changed)];
|
|
3946
|
+
changed();
|
|
3947
|
+
}
|
|
3948
|
+
function schedule() {
|
|
3949
|
+
cancelRequest();
|
|
3950
|
+
content = EMPTY;
|
|
3951
|
+
const q = query.trim();
|
|
3952
|
+
body = !q ? "idle" : q.length > 500 || q.includes("\0") ? "invalid" : "pending";
|
|
3953
|
+
if (body !== "pending" || !open2) {
|
|
3954
|
+
publish();
|
|
3955
|
+
return;
|
|
3956
|
+
}
|
|
3957
|
+
if (currentCatalog().status !== "ready") {
|
|
3958
|
+
body = "idle";
|
|
3959
|
+
publish();
|
|
3960
|
+
return;
|
|
3961
|
+
}
|
|
3962
|
+
timer = setTimeout(() => {
|
|
3963
|
+
timer = 0;
|
|
3964
|
+
scanBatch(false);
|
|
3965
|
+
}, 250);
|
|
3966
|
+
publish();
|
|
3967
|
+
}
|
|
3968
|
+
async function scanBatch(next) {
|
|
3969
|
+
if (!mounted || !open2 || request || currentCatalog().status !== "ready") return;
|
|
3970
|
+
const q = query.trim(), searchMode = mode, searchScope = scope(), owner = services, generation = epoch;
|
|
3971
|
+
if (next && (!scanId || !content.cursor)) return;
|
|
3972
|
+
const controller = new AbortController();
|
|
3973
|
+
request = controller;
|
|
3974
|
+
const alive = () => mounted && open2 && services === owner && epoch === generation && request === controller && query.trim() === q && mode === searchMode && scope() === searchScope && !controller.signal.aborted;
|
|
3975
|
+
const target = content.items.length + PAGE_MATCH_TARGET;
|
|
3976
|
+
body = "pending";
|
|
3977
|
+
publish();
|
|
3978
|
+
if (!alive()) return;
|
|
3979
|
+
try {
|
|
3980
|
+
const id = next ? scanId : crypto.randomUUID();
|
|
3981
|
+
scanId = id;
|
|
3982
|
+
const rows = currentCatalog().rows, seenCursors = /* @__PURE__ */ new Set();
|
|
3983
|
+
if (content.cursor) seenCursors.add(content.cursor);
|
|
3984
|
+
let continuation = next;
|
|
3985
|
+
while (alive()) {
|
|
3986
|
+
const previousScanned = content.scanned, previousTotal = content.total;
|
|
3987
|
+
const payload = {
|
|
3988
|
+
version: 1,
|
|
3989
|
+
action: continuation ? "next" : "start",
|
|
3990
|
+
requestId: id,
|
|
3991
|
+
query: q,
|
|
3992
|
+
mode: searchMode,
|
|
3993
|
+
scope: searchScope,
|
|
3994
|
+
...continuation ? { cursor: content.cursor } : { sessionIds: rows.map((row) => row.id), catalog: rows.map((row) => ({ id: row.id, title: row.title })) }
|
|
3995
|
+
};
|
|
3996
|
+
const response = await fetch(ENDPOINT, { method: "POST", credentials: "same-origin", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), signal: controller.signal });
|
|
3997
|
+
if (!alive()) return;
|
|
3998
|
+
if (!response.ok) throw new Error("Search unavailable");
|
|
3999
|
+
const raw = await response.json();
|
|
4000
|
+
if (!alive()) return;
|
|
4001
|
+
const value = searchValue(raw, id, q, searchScope);
|
|
4002
|
+
if (!value || continuation && value.total !== previousTotal || value.scanned <= previousScanned && !(value.complete && value.total === 0 && !continuation) || value.cursor !== null && seenCursors.has(value.cursor)) throw new Error("Invalid or non-progressing search response");
|
|
4003
|
+
if (value.cursor) seenCursors.add(value.cursor);
|
|
4004
|
+
const accumulated = new Map(content.items.map((item) => [item.sessionId, item]));
|
|
4005
|
+
for (const item of value.items) accumulated.set(item.sessionId, item);
|
|
4006
|
+
content = { ...value, items: [...accumulated.values()] };
|
|
4007
|
+
const pageDone = value.complete || accumulated.size >= target;
|
|
4008
|
+
body = pageDone ? "ready" : "pending";
|
|
4009
|
+
publish();
|
|
4010
|
+
if (!alive() || pageDone) return;
|
|
4011
|
+
continuation = true;
|
|
4012
|
+
}
|
|
4013
|
+
} catch (_) {
|
|
4014
|
+
if (alive()) {
|
|
4015
|
+
cancelRequest();
|
|
4016
|
+
body = "unavailable";
|
|
4017
|
+
publish();
|
|
4018
|
+
}
|
|
4019
|
+
} finally {
|
|
4020
|
+
if (alive()) {
|
|
4021
|
+
request = null;
|
|
4022
|
+
publish();
|
|
4023
|
+
}
|
|
4024
|
+
}
|
|
4025
|
+
}
|
|
4026
|
+
function show(seed) {
|
|
4027
|
+
if (!mounted) return;
|
|
4028
|
+
invalidateRestoreNavigation();
|
|
4029
|
+
cancelHandoff();
|
|
4030
|
+
focusOrigin = document.activeElement;
|
|
4031
|
+
bridge.closeFind();
|
|
4032
|
+
if (typeof seed === "string" && seed !== query) {
|
|
4033
|
+
query = seed;
|
|
4034
|
+
scroll = 0;
|
|
4035
|
+
content = EMPTY;
|
|
4036
|
+
body = "idle";
|
|
4037
|
+
}
|
|
4038
|
+
open2 = true;
|
|
4039
|
+
notice = "";
|
|
4040
|
+
if (!ui.Modal || !ui.Input) {
|
|
4041
|
+
open2 = false;
|
|
4042
|
+
notice = L.unsupported;
|
|
4043
|
+
publish();
|
|
4044
|
+
return;
|
|
4045
|
+
}
|
|
4046
|
+
watchLists();
|
|
4047
|
+
if (body === "idle" || body === "pending") schedule();
|
|
4048
|
+
else publish();
|
|
4049
|
+
}
|
|
4050
|
+
function dismiss() {
|
|
4051
|
+
invalidateRestoreNavigation();
|
|
4052
|
+
const unfinished = body === "pending" || !content.complete && !!scanId;
|
|
4053
|
+
open2 = false;
|
|
4054
|
+
cancelRequest();
|
|
4055
|
+
stopLists();
|
|
4056
|
+
cancelHandoff();
|
|
4057
|
+
if (unfinished) body = "stopped";
|
|
4058
|
+
publish();
|
|
4059
|
+
}
|
|
4060
|
+
function change(value) {
|
|
4061
|
+
invalidateRestoreNavigation();
|
|
4062
|
+
query = value;
|
|
4063
|
+
scroll = 0;
|
|
4064
|
+
notice = "";
|
|
4065
|
+
cancelHandoff();
|
|
4066
|
+
schedule();
|
|
4067
|
+
}
|
|
4068
|
+
function launch(row, restored = false) {
|
|
4069
|
+
invalidateRestoreNavigation();
|
|
4070
|
+
const available = currentCatalog();
|
|
4071
|
+
if (!services || available.status !== "ready" || !available.rows.some((item) => item.id === row.id)) {
|
|
4072
|
+
notice = L.missing;
|
|
4073
|
+
publish();
|
|
4074
|
+
return;
|
|
4075
|
+
}
|
|
4076
|
+
if (available.rows.find((item) => item.id === row.id).archived) {
|
|
4077
|
+
notice = L.archivedNow;
|
|
4078
|
+
publish();
|
|
4079
|
+
return;
|
|
4080
|
+
}
|
|
4081
|
+
const owner = services, q = query.trim();
|
|
4082
|
+
dismiss();
|
|
4083
|
+
bridge.closeFind();
|
|
4084
|
+
notice = L.opening;
|
|
4085
|
+
const task = { id: row.id, query: q, owner, started: Date.now(), restored };
|
|
4086
|
+
handoff = task;
|
|
4087
|
+
try {
|
|
4088
|
+
owner.uiWorkspace.openSession(row.id);
|
|
4089
|
+
} catch (_) {
|
|
4090
|
+
cancelHandoff(restored ? L.restoredOpenFailed : L.openFailed);
|
|
4091
|
+
return;
|
|
4092
|
+
}
|
|
4093
|
+
function stillSelected() {
|
|
4094
|
+
try {
|
|
4095
|
+
const row2 = ctx.sessions.list.getSnapshot().byId[task.id];
|
|
4096
|
+
return row2?.retainedBy?.mainView > 0 && owner.layout.panelInfo.getSnapshot().activePanelId === null;
|
|
4097
|
+
} catch (_) {
|
|
4098
|
+
return false;
|
|
4099
|
+
}
|
|
4100
|
+
}
|
|
4101
|
+
const navigationChanged = () => {
|
|
4102
|
+
if (handoff === task && !stillSelected()) cancelHandoff(L.interrupted);
|
|
4103
|
+
};
|
|
4104
|
+
handoffStops = [ctx.sessions.list.subscribe(navigationChanged), owner.layout.panelInfo.subscribe(navigationChanged)];
|
|
4105
|
+
publish();
|
|
4106
|
+
const attempt = () => {
|
|
4107
|
+
handoffTimer = 0;
|
|
4108
|
+
if (!mounted || handoff !== task || services !== owner) return;
|
|
4109
|
+
if (!stillSelected()) {
|
|
4110
|
+
cancelHandoff(task.restored ? L.restoredOpenFailed : L.interrupted);
|
|
4111
|
+
return;
|
|
4112
|
+
}
|
|
4113
|
+
const current = currentCatalog();
|
|
4114
|
+
if (current.status !== "ready" || !current.rows.some((item) => item.id === task.id && !item.archived)) {
|
|
4115
|
+
cancelHandoff(task.restored ? L.restoredOpenFailed : L.missing);
|
|
4116
|
+
return;
|
|
4117
|
+
}
|
|
4118
|
+
if (bridge.openFind(task.id, task.query)) {
|
|
4119
|
+
cancelHandoff();
|
|
4120
|
+
return;
|
|
4121
|
+
}
|
|
4122
|
+
if (Date.now() - task.started > 1e4) {
|
|
4123
|
+
cancelHandoff(task.restored ? L.restoredFindFailed : L.chatNeeded);
|
|
4124
|
+
return;
|
|
4125
|
+
}
|
|
4126
|
+
handoffTimer = setTimeout(attempt, 100);
|
|
4127
|
+
};
|
|
4128
|
+
handoffTimer = setTimeout(attempt, 0);
|
|
4129
|
+
}
|
|
4130
|
+
async function restoreAndOpen(row) {
|
|
4131
|
+
if (restoreOperation) return;
|
|
4132
|
+
cancelHandoff();
|
|
4133
|
+
const owner = services, available = currentCatalog();
|
|
4134
|
+
const latest = available.rows.find((item) => item.id === row.id);
|
|
4135
|
+
if (!owner || available.status !== "ready" || !latest) {
|
|
4136
|
+
notice = L.missing;
|
|
4137
|
+
publish();
|
|
4138
|
+
return;
|
|
4139
|
+
}
|
|
4140
|
+
if (!latest.archived) {
|
|
4141
|
+
launch(latest);
|
|
4142
|
+
return;
|
|
4143
|
+
}
|
|
4144
|
+
if (typeof owner.uiWorkspace.unarchiveSession !== "function") {
|
|
4145
|
+
restoreFeedback = { id: row.id, text: L.restoreUnavailable };
|
|
4146
|
+
publish();
|
|
4147
|
+
return;
|
|
4148
|
+
}
|
|
4149
|
+
const operation = { id: row.id, owner, navigate: true };
|
|
4150
|
+
restoreOperation = operation;
|
|
4151
|
+
restoreFeedback = null;
|
|
4152
|
+
notice = "";
|
|
4153
|
+
publish();
|
|
4154
|
+
try {
|
|
4155
|
+
await owner.uiWorkspace.unarchiveSession(row.id);
|
|
4156
|
+
if (!mounted || services !== owner || !operation.navigate || !open2) return;
|
|
4157
|
+
const fresh = currentCatalog(), current = fresh.rows.find((item) => item.id === row.id);
|
|
4158
|
+
if (fresh.status !== "ready" || !current || current.archived) {
|
|
4159
|
+
restoreFeedback = { id: row.id, text: L.restoreUnconfirmed };
|
|
4160
|
+
publish();
|
|
4161
|
+
return;
|
|
4162
|
+
}
|
|
4163
|
+
launch(current, true);
|
|
4164
|
+
} catch (_) {
|
|
4165
|
+
if (mounted && services === owner && operation.navigate && open2) {
|
|
4166
|
+
restoreFeedback = { id: row.id, text: L.restoreUnconfirmed };
|
|
4167
|
+
publish();
|
|
4168
|
+
}
|
|
4169
|
+
} finally {
|
|
4170
|
+
if (restoreOperation === operation) {
|
|
4171
|
+
restoreOperation = null;
|
|
4172
|
+
if (mounted && services === owner) publish();
|
|
4173
|
+
}
|
|
4174
|
+
}
|
|
4175
|
+
}
|
|
4176
|
+
function Panel() {
|
|
4177
|
+
const details = react.useRef(null), list = react.useRef(null);
|
|
4178
|
+
const [helpOpen, setHelpOpen] = react.useState(false);
|
|
4179
|
+
const helpId = react.useId();
|
|
4180
|
+
react.useLayoutEffect(() => {
|
|
4181
|
+
if (list.current) list.current.scrollTop = scroll;
|
|
4182
|
+
const dialog = details.current?.closest('[role="dialog"]');
|
|
4183
|
+
const trigger = focusOrigin;
|
|
4184
|
+
const legacy = typeof ui.useModalLayer !== "function";
|
|
4185
|
+
const topmost = () => dialog && Array.from(document.querySelectorAll('[role="dialog"][aria-modal="true"],[role="menu"]')).pop() === dialog;
|
|
4186
|
+
const items = () => Array.from(dialog.querySelectorAll('button:not(:disabled),a[href],input:not(:disabled),[tabindex="0"]')).filter((item) => !item.closest("[hidden],[inert]"));
|
|
4187
|
+
const focusFirst = () => (items()[0] || dialog)?.focus({ preventScroll: true });
|
|
4188
|
+
function keydown(event) {
|
|
4189
|
+
if (!topmost() || event.defaultPrevented || event.ctrlKey || event.metaKey || event.altKey) return;
|
|
4190
|
+
if (event.key === "Escape") {
|
|
4191
|
+
event.stopPropagation();
|
|
4192
|
+
if (event.isComposing || event.keyCode === 229) return;
|
|
4193
|
+
event.preventDefault();
|
|
4194
|
+
if (!event.repeat) dismiss();
|
|
4195
|
+
} else if (event.key === "Tab") {
|
|
4196
|
+
const controls = items(), first = controls[0] || dialog, last = controls[controls.length - 1] || dialog;
|
|
4197
|
+
if (!dialog.contains(document.activeElement) || document.activeElement === dialog || document.activeElement === (event.shiftKey ? first : last)) {
|
|
4198
|
+
event.preventDefault();
|
|
4199
|
+
(event.shiftKey ? last : first)?.focus({ preventScroll: true });
|
|
4200
|
+
}
|
|
4201
|
+
}
|
|
4202
|
+
}
|
|
4203
|
+
const focusin = (event) => {
|
|
4204
|
+
if (topmost() && !dialog.contains(event.target)) focusFirst();
|
|
4205
|
+
};
|
|
4206
|
+
if (legacy && dialog) {
|
|
4207
|
+
focusFirst();
|
|
4208
|
+
window.addEventListener("keydown", keydown, true);
|
|
4209
|
+
window.addEventListener("focusin", focusin, true);
|
|
4210
|
+
}
|
|
4211
|
+
return () => {
|
|
4212
|
+
window.removeEventListener("keydown", keydown, true);
|
|
4213
|
+
window.removeEventListener("focusin", focusin, true);
|
|
4214
|
+
if (legacy && mounted && trigger?.isConnected) trigger.focus({ preventScroll: true });
|
|
4215
|
+
};
|
|
4216
|
+
}, []);
|
|
4217
|
+
const data = currentCatalog();
|
|
4218
|
+
const results = body === "invalid" ? EMPTY : merge(data.rows, content);
|
|
4219
|
+
const status = data.status !== "ready" ? L[data.status] : body === "invalid" ? L.invalid : !query.trim() ? L.emptyQuery : body === "pending" ? L.pending : body === "unavailable" ? L.unavailable : body === "stopped" ? L.stopped : "";
|
|
4220
|
+
const retryable = data.status === "failedList" || data.status === "ready" && (body === "unavailable" || body === "stopped" || body === "ready" && content.complete && (content.failed > 0 || content.skipped > 0));
|
|
4221
|
+
const pending = data.status === "ready" && body === "pending";
|
|
4222
|
+
const empty = data.status === "ready" && query.trim() && body === "ready" && content.complete && !content.failed && !content.skipped && results.items.length === 0;
|
|
4223
|
+
const progress = content.scanned > 0 || content.total > 0 ? L.progress(content.scanned, content.total) : "";
|
|
4224
|
+
const partial = content.failed || content.skipped ? L.partial(content.failed, content.skipped) : "";
|
|
4225
|
+
const count = L.shown(results.items.length);
|
|
4226
|
+
const ready = data.status === "ready" && body === "ready";
|
|
4227
|
+
let announcement = "";
|
|
4228
|
+
if (restoreOperation?.navigate) announcement = L.restoring;
|
|
4229
|
+
else if (restoreFeedback) announcement = restoreFeedback.text;
|
|
4230
|
+
else if (notice) announcement = notice;
|
|
4231
|
+
else if (data.status === "ready" && body === "invalid") announcement = L.invalid;
|
|
4232
|
+
else if (pending) announcement = [progress || L.pending, partial].filter(Boolean).join(" \xB7 ");
|
|
4233
|
+
else if (ready && content.complete && !partial) announcement = count;
|
|
4234
|
+
else if (ready && content.cursor) announcement = [L.page(results.items.length), partial].filter(Boolean).join(" \xB7 ");
|
|
4235
|
+
else if (ready || body === "stopped" || body === "unavailable") announcement = [status || count, progress, partial].filter(Boolean).join(" \xB7 ");
|
|
4236
|
+
else if (data.status !== "ready") announcement = status;
|
|
4237
|
+
const emptyStatus = body === "invalid" && data.status === "ready" ? L.invalidShort : empty ? L.noMatches : body === "unavailable" && data.status === "ready" ? L.unavailableShort : body === "stopped" && data.status === "ready" ? L.stoppedShort : status || (partial ? L.partialShort : ready && content.cursor ? L.noMatchesYet : "");
|
|
4238
|
+
const requestClose = () => {
|
|
4239
|
+
const dialog = details.current?.closest('[role="dialog"]');
|
|
4240
|
+
if (dialog && Array.from(document.querySelectorAll('[role="dialog"][aria-modal="true"],[role="menu"]')).pop() === dialog) dismiss();
|
|
4241
|
+
};
|
|
4242
|
+
const setTitleOnly = (checked) => {
|
|
4243
|
+
invalidateRestoreNavigation();
|
|
4244
|
+
mode = checked ? "title" : "title-body";
|
|
4245
|
+
scroll = 0;
|
|
4246
|
+
notice = "";
|
|
4247
|
+
cancelHandoff();
|
|
4248
|
+
schedule();
|
|
4249
|
+
};
|
|
4250
|
+
const setIncludeArchived = (checked) => {
|
|
4251
|
+
invalidateRestoreNavigation();
|
|
4252
|
+
includeArchived = checked;
|
|
4253
|
+
scroll = 0;
|
|
4254
|
+
notice = "";
|
|
4255
|
+
cancelHandoff();
|
|
4256
|
+
schedule();
|
|
4257
|
+
};
|
|
4258
|
+
const checkbox = (checked, onChange, label) => ui.Checkbox ? h(ui.Checkbox, { checked, onChange, label, className: "dsh-find-all-conversations-title-only" }) : h("label", { className: "dsh-find-all-conversations-title-only dsh-find-all-conversations-title-only-fallback" }, h("input", { type: "checkbox", checked, onChange: (event) => onChange(event.target.checked) }), " ", label);
|
|
4259
|
+
const actions = retryable || pending || content.cursor ? h(
|
|
4260
|
+
"div",
|
|
4261
|
+
{ className: "dsh-find-all-conversations-actions" },
|
|
4262
|
+
retryable ? h(ui.Button, { type: "button", size: "sm", variant: "ghost", onClick: () => {
|
|
4263
|
+
notice = "";
|
|
4264
|
+
schedule();
|
|
4265
|
+
const generation = epoch, owner = services;
|
|
4266
|
+
if (typeof ctx.sessions.refresh === "function") Promise.resolve().then(() => ctx.sessions.refresh()).catch(() => {
|
|
4267
|
+
if (mounted && open2 && epoch === generation && services === owner) {
|
|
4268
|
+
notice = L.failedList;
|
|
4269
|
+
publish();
|
|
4270
|
+
}
|
|
4271
|
+
});
|
|
4272
|
+
} }, L.retry) : null,
|
|
4273
|
+
pending || content.cursor ? h(ui.Button, { type: "button", size: "sm", variant: "ghost", onClick: () => {
|
|
4274
|
+
cancelRequest();
|
|
4275
|
+
body = "stopped";
|
|
4276
|
+
publish();
|
|
4277
|
+
} }, L.cancel) : null,
|
|
4278
|
+
!pending && content.cursor ? h(ui.Button, { type: "button", size: "sm", variant: "ghost", onClick: () => scanBatch(true) }, L.more) : null
|
|
4279
|
+
) : null;
|
|
4280
|
+
return h(
|
|
4281
|
+
ui.Modal,
|
|
4282
|
+
{ open: true, headless: true, title: L.title, onClose: requestClose, className: "dsh-find-all-conversations" },
|
|
4283
|
+
h(
|
|
4284
|
+
"div",
|
|
4285
|
+
{ ref: details, className: "dsh-find-all-conversations-layout" },
|
|
4286
|
+
h(
|
|
4287
|
+
"div",
|
|
4288
|
+
{ className: "dsh-find-all-conversations-header" },
|
|
4289
|
+
h(ui.Input, {
|
|
4290
|
+
type: "search",
|
|
4291
|
+
value: query,
|
|
4292
|
+
"data-modal-autofocus": true,
|
|
4293
|
+
"aria-label": L.title,
|
|
4294
|
+
placeholder: mode === "title" ? L.titlePlaceholder : L.placeholder,
|
|
4295
|
+
icon: ui.IconSearchOutlineRegular ? h(ui.IconSearchOutlineRegular, { size: 16 }) : void 0,
|
|
4296
|
+
onChange: (event) => change(event.target.value),
|
|
4297
|
+
onKeyDown: (event) => {
|
|
4298
|
+
if (event.key !== "Enter" || event.isComposing || event.nativeEvent?.isComposing || event.keyCode === 229 || event.repeat) return;
|
|
4299
|
+
event.preventDefault();
|
|
4300
|
+
invalidateRestoreNavigation();
|
|
4301
|
+
notice = "";
|
|
4302
|
+
cancelHandoff();
|
|
4303
|
+
schedule();
|
|
4304
|
+
},
|
|
4305
|
+
className: "dsh-find-all-conversations-input"
|
|
4306
|
+
}),
|
|
4307
|
+
h(
|
|
4308
|
+
ui.Button,
|
|
4309
|
+
{ type: "button", size: "sm", variant: "ghost", "aria-label": L.close, title: L.close, onClick: requestClose, className: "dsh-find-all-conversations-close" },
|
|
4310
|
+
ui.IconCloseOutlineRegular ? h(ui.IconCloseOutlineRegular, { size: 14 }) : "\xD7"
|
|
4311
|
+
)
|
|
4312
|
+
),
|
|
4313
|
+
h(
|
|
4314
|
+
"div",
|
|
4315
|
+
{ className: "dsh-find-all-conversations-toolbar" },
|
|
4316
|
+
h("span", { className: "dsh-find-all-conversations-scope" }, L.scope),
|
|
4317
|
+
h("div", { className: "dsh-find-all-conversations-options" }, checkbox(mode === "title", setTitleOnly, L.titleOnly), checkbox(includeArchived, setIncludeArchived, L.includeArchived))
|
|
4318
|
+
),
|
|
4319
|
+
h(
|
|
4320
|
+
"div",
|
|
4321
|
+
{ ref: list, onScroll: (event) => {
|
|
4322
|
+
scroll = event.currentTarget.scrollTop;
|
|
4323
|
+
}, className: "dsh-find-all-conversations-list" },
|
|
4324
|
+
!results.items.length && emptyStatus ? h("div", { className: "dsh-find-all-conversations-empty" }, emptyStatus) : null,
|
|
4325
|
+
...results.items.map((row) => {
|
|
4326
|
+
const title = row.titleMatch ? highlightedText(h, row.title, literalRanges(row.title, query)) : row.title || L.untitled;
|
|
4327
|
+
const titleNode = h("span", { className: "dsh-find-all-conversations-title", title: row.title || L.untitled }, title);
|
|
4328
|
+
const meta = h(
|
|
4329
|
+
"span",
|
|
4330
|
+
{ className: "dsh-find-all-conversations-meta" },
|
|
4331
|
+
row.workspace ? h("span", { className: "dsh-find-all-conversations-info", title: row.workspace }, row.workspace) : null,
|
|
4332
|
+
row.snippet ? h("span", { className: "dsh-find-all-conversations-snippet", title: row.snippet }, highlightedText(h, row.snippet, row.ranges)) : null
|
|
4333
|
+
);
|
|
4334
|
+
const error = restoreFeedback?.id === row.id ? h("span", { className: "dsh-find-all-conversations-row-error" }, restoreFeedback.text) : null;
|
|
4335
|
+
if (!row.archived) return h("button", { key: row.id, type: "button", onClick: () => launch(row), className: "dsh-find-all-conversations-row", "aria-current": row.selected ? "true" : void 0 }, titleNode, meta, error);
|
|
4336
|
+
return h(
|
|
4337
|
+
"div",
|
|
4338
|
+
{ key: row.id, className: "dsh-find-all-conversations-row dsh-find-all-conversations-archived-row" },
|
|
4339
|
+
h(
|
|
4340
|
+
"div",
|
|
4341
|
+
{ className: "dsh-find-all-conversations-row-heading" },
|
|
4342
|
+
titleNode,
|
|
4343
|
+
h("span", { className: "dsh-find-all-conversations-archive-label" }, L.archived),
|
|
4344
|
+
h(ui.Button, { type: "button", size: "sm", variant: "ghost", className: "dsh-find-all-conversations-restore", "aria-disabled": !!restoreOperation, "aria-label": `${L.restore}: ${row.title || L.untitled}`, onClick: () => restoreAndOpen(row) }, restoreOperation?.id === row.id ? L.restoring : L.restore)
|
|
4345
|
+
),
|
|
4346
|
+
meta,
|
|
4347
|
+
error
|
|
4348
|
+
);
|
|
4349
|
+
})
|
|
4350
|
+
),
|
|
4351
|
+
h(
|
|
4352
|
+
"div",
|
|
4353
|
+
{ className: "dsh-find-all-conversations-footer" },
|
|
4354
|
+
h(
|
|
4355
|
+
"div",
|
|
4356
|
+
{ className: "dsh-find-all-conversations-status-actions" },
|
|
4357
|
+
h("div", { role: "status", "aria-live": "polite", className: "dsh-find-all-conversations-status" }, announcement),
|
|
4358
|
+
actions
|
|
4359
|
+
),
|
|
4360
|
+
h(ui.Button, { type: "button", size: "sm", variant: "ghost", "aria-expanded": helpOpen, "aria-controls": helpId, onClick: () => setHelpOpen((value) => !value), className: "dsh-find-all-conversations-help" }, L.help)
|
|
4361
|
+
),
|
|
4362
|
+
h(
|
|
4363
|
+
"div",
|
|
4364
|
+
{ id: helpId, hidden: !helpOpen, className: "dsh-find-all-conversations-help-content" },
|
|
4365
|
+
h("p", null, L.scopeDetails),
|
|
4366
|
+
h("p", null, L.order),
|
|
4367
|
+
h("p", null, L.snapshot),
|
|
4368
|
+
h("p", null, L.semantics),
|
|
4369
|
+
h("p", null, L.handoff)
|
|
4370
|
+
)
|
|
4371
|
+
)
|
|
4372
|
+
);
|
|
4373
|
+
}
|
|
4374
|
+
function Entry(props) {
|
|
4375
|
+
react.useSyncExternalStore((listener) => {
|
|
4376
|
+
listeners.add(listener);
|
|
4377
|
+
return () => listeners.delete(listener);
|
|
4378
|
+
}, () => revision);
|
|
4379
|
+
const Icon = ui.IconSearchOutlineRegular || ui.IconSearchOutline16;
|
|
4380
|
+
return h(
|
|
4381
|
+
react.Fragment,
|
|
4382
|
+
null,
|
|
4383
|
+
h(ui.Button, { type: "button", size: "sm", variant: "ghost", title: notice || L.title, "aria-label": L.title, onClick: () => show(), style: { width: "100%", justifyContent: props.wide ? "flex-start" : "center", gap: 8 } }, Icon ? h(Icon, { size: 16 }) : null, props.wide ? L.title : null),
|
|
4384
|
+
notice && !open2 ? h("div", { role: "status", style: { fontSize: 12, padding: 8, overflowWrap: "anywhere" } }, notice) : null,
|
|
4385
|
+
open2 && ui.Modal ? h(Panel) : null
|
|
4386
|
+
);
|
|
4387
|
+
}
|
|
4388
|
+
ctx.slots.inject("sidebar.footer.action", () => ctx.slots.register({ name: "sidebar.footer.action", id: "dsh-find-all-search", order: 10 }, Entry));
|
|
4389
|
+
if (typeof ctx.inject === "function") ctx.inject(["uiWorkspace", "workspaces", "layout"], (child) => {
|
|
4390
|
+
child.effect(() => {
|
|
4391
|
+
if (typeof child.uiWorkspace?.openSession !== "function" || typeof child.layout?.panelInfo?.subscribe !== "function" || typeof child.layout?.panelInfo?.getSnapshot !== "function" || typeof child.workspaces?.list?.subscribe !== "function" || typeof ctx.sessions?.list?.subscribe !== "function") return;
|
|
4392
|
+
const owner = { uiWorkspace: child.uiWorkspace, workspaces: child.workspaces, layout: child.layout };
|
|
4393
|
+
cancelRequest();
|
|
4394
|
+
services = owner;
|
|
4395
|
+
content = EMPTY;
|
|
4396
|
+
body = "idle";
|
|
4397
|
+
watchLists();
|
|
4398
|
+
if (open2) schedule();
|
|
4399
|
+
publish();
|
|
4400
|
+
return () => {
|
|
4401
|
+
if (services !== owner) return;
|
|
4402
|
+
invalidateRestoreNavigation();
|
|
4403
|
+
services = null;
|
|
4404
|
+
cancelRequest();
|
|
4405
|
+
stopLists();
|
|
4406
|
+
cancelHandoff(L.interrupted);
|
|
4407
|
+
content = EMPTY;
|
|
4408
|
+
body = "idle";
|
|
4409
|
+
publish();
|
|
4410
|
+
};
|
|
4411
|
+
});
|
|
4412
|
+
});
|
|
4413
|
+
if (typeof ctx.on === "function") ctx.on("connection/reset", () => {
|
|
4414
|
+
invalidateRestoreNavigation();
|
|
4415
|
+
cancelRequest();
|
|
4416
|
+
cancelHandoff(L.interrupted);
|
|
4417
|
+
content = EMPTY;
|
|
4418
|
+
body = "idle";
|
|
4419
|
+
if (open2) {
|
|
4420
|
+
watchLists();
|
|
4421
|
+
schedule();
|
|
4422
|
+
} else publish();
|
|
4423
|
+
});
|
|
4424
|
+
ctx.effect(() => {
|
|
4425
|
+
function interrupt(event) {
|
|
4426
|
+
if (handoff && event.isTrusted) cancelHandoff(L.interrupted);
|
|
4427
|
+
}
|
|
4428
|
+
window.addEventListener("pointerdown", interrupt, true);
|
|
4429
|
+
window.addEventListener("keydown", interrupt, true);
|
|
4430
|
+
return () => {
|
|
4431
|
+
invalidateRestoreNavigation();
|
|
4432
|
+
mounted = false;
|
|
4433
|
+
open2 = false;
|
|
4434
|
+
cancelRequest();
|
|
4435
|
+
stopLists();
|
|
4436
|
+
cancelHandoff();
|
|
4437
|
+
content = EMPTY;
|
|
4438
|
+
query = "";
|
|
4439
|
+
listeners.clear();
|
|
4440
|
+
window.removeEventListener("pointerdown", interrupt, true);
|
|
4441
|
+
window.removeEventListener("keydown", interrupt, true);
|
|
4442
|
+
};
|
|
4443
|
+
});
|
|
4444
|
+
return { open: show, label: () => query ? L.back : L.title, isOpen: () => open2, cancelHandoff };
|
|
4445
|
+
}
|
|
4446
|
+
|
|
3711
4447
|
// src/updates.js
|
|
3712
4448
|
var import_semver = __toESM(require_semver(), 1);
|
|
3713
4449
|
var PACKAGE = "@ryuu-64/dsh-find-all";
|
|
3714
|
-
var
|
|
4450
|
+
var ENDPOINT2 = "https://registry.npmjs.org/@ryuu-64%2fdsh-find-all/latest";
|
|
3715
4451
|
function version(value) {
|
|
3716
4452
|
if (typeof value !== "string") throw new Error("Invalid version");
|
|
3717
4453
|
const parsed = new import_semver.default(value);
|
|
@@ -3729,7 +4465,7 @@ async function checkLatestVersion(currentVersion, signal) {
|
|
|
3729
4465
|
if (signal.aborted) cancel();
|
|
3730
4466
|
const timeout = setTimeout(cancel, 8e3);
|
|
3731
4467
|
try {
|
|
3732
|
-
const response = await fetch(
|
|
4468
|
+
const response = await fetch(ENDPOINT2, {
|
|
3733
4469
|
signal: controller.signal,
|
|
3734
4470
|
mode: "cors",
|
|
3735
4471
|
credentials: "omit",
|
|
@@ -4626,6 +5362,10 @@ function createHistoryReader({ remote, sessionId, generation = 0, onUpdate, proj
|
|
|
4626
5362
|
const projection = await pending(project(source));
|
|
4627
5363
|
assertCurrent();
|
|
4628
5364
|
if (!object(projection) || !Array.isArray(projection.blocks) || projection.blocks.some((block) => !object(block) || typeof block.text !== "string")) throw failure("invalid-projection", "Text projection returned invalid blocks", source.seq);
|
|
5365
|
+
const projectedSource = projection.source === void 0 ? source : projection.source;
|
|
5366
|
+
if (!object(projectedSource) || ["sessionId", "seq", "id", "kind", "contentIndex"].some((key) => projectedSource[key] !== source[key])) {
|
|
5367
|
+
throw failure("invalid-projection", "Text projection changed durable source identity", source.seq);
|
|
5368
|
+
}
|
|
4629
5369
|
const localErrors = [...source.contextErrors ?? [], ...Array.isArray(projection.errors) ? projection.errors : []];
|
|
4630
5370
|
const seenErrors = /* @__PURE__ */ new Set();
|
|
4631
5371
|
for (const error of localErrors) {
|
|
@@ -4635,7 +5375,7 @@ function createHistoryReader({ remote, sessionId, generation = 0, onUpdate, proj
|
|
|
4635
5375
|
seenErrors.add(key);
|
|
4636
5376
|
}
|
|
4637
5377
|
documents.push({
|
|
4638
|
-
...
|
|
5378
|
+
...projectedSource,
|
|
4639
5379
|
blocks: projection.blocks,
|
|
4640
5380
|
...typeof projection.mapping === "string" ? { mapping: projection.mapping } : {},
|
|
4641
5381
|
...typeof projection.rootClass === "string" ? { rootClass: projection.rootClass } : {},
|
|
@@ -5033,7 +5773,7 @@ function sameBlocks(expected, actual) {
|
|
|
5033
5773
|
function minimumCandidates(candidates) {
|
|
5034
5774
|
return candidates.filter((x) => !candidates.some((y) => x !== y && x.contains(y)));
|
|
5035
5775
|
}
|
|
5036
|
-
function mapProjectedDocument(source, node, rows) {
|
|
5776
|
+
function mapProjectedDocument(source, node, rows, targetBlockIndex) {
|
|
5037
5777
|
if (source.transcriptVisible === false) return { reason: source.unavailableReason || "not-rendered" };
|
|
5038
5778
|
if (source.mapping === "markdown") {
|
|
5039
5779
|
const reasoning = source.kind === "reasoning" || source.contentType === "reasoning";
|
|
@@ -5041,7 +5781,7 @@ function mapProjectedDocument(source, node, rows) {
|
|
|
5041
5781
|
const content = node.data?.blocks;
|
|
5042
5782
|
if (!Array.isArray(content)) return { reason: "node-content-unavailable" };
|
|
5043
5783
|
const index = source.contentIndex;
|
|
5044
|
-
if (content[index]?.kind !== kind || content[index]?.text !== source.raw) return { reason: "source-changed" };
|
|
5784
|
+
if (content[index]?.kind !== kind || content[index]?.text !== (source.storedRaw ?? source.raw)) return { reason: "source-changed" };
|
|
5045
5785
|
const part = reasoning ? "reasoning" : "response";
|
|
5046
5786
|
let scoped = rows.filter((row) => row.dataset.chatGroupPart === part);
|
|
5047
5787
|
if (!scoped.length) scoped = rows.filter((row) => !row.dataset.chatGroupPart);
|
|
@@ -5051,7 +5791,14 @@ function mapProjectedDocument(source, node, rows) {
|
|
|
5051
5791
|
if (roots.length !== expected.length) return { reason: "renderer-not-expanded" };
|
|
5052
5792
|
const root = roots[ordinal], blocks = collectProjectedBlocks(root);
|
|
5053
5793
|
const savedText = source.blocks.filter((b) => !b.imageDescription), actualText = blocks.filter((b) => !b.imageDescription);
|
|
5054
|
-
if (
|
|
5794
|
+
if (Number.isInteger(targetBlockIndex)) {
|
|
5795
|
+
const target = source.blocks[targetBlockIndex];
|
|
5796
|
+
if (!target) return { reason: "renderer-text-changed" };
|
|
5797
|
+
if (!target.imageDescription) {
|
|
5798
|
+
const ordinal2 = source.blocks.slice(0, targetBlockIndex + 1).filter((block) => !block.imageDescription).length - 1;
|
|
5799
|
+
if (savedText.length !== actualText.length || actualText[ordinal2]?.text !== target.text) return { reason: "renderer-text-changed" };
|
|
5800
|
+
}
|
|
5801
|
+
} else if (!sameBlocks(savedText, actualText)) return { reason: "renderer-text-changed" };
|
|
5055
5802
|
let position = 0;
|
|
5056
5803
|
return { blocks: source.blocks.map((b) => b.imageDescription ? { text: b.text, segments: [] } : actualText[position++]), root };
|
|
5057
5804
|
}
|
|
@@ -5175,6 +5922,58 @@ function mapProjectedDocument(source, node, rows) {
|
|
|
5175
5922
|
return { reason: "stored-field-not-rendered" };
|
|
5176
5923
|
}
|
|
5177
5924
|
|
|
5925
|
+
// src/search-content.js
|
|
5926
|
+
var SEARCH_CONTENT_SERVICE = "ryuu.findAllSearchContent";
|
|
5927
|
+
var object2 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
5928
|
+
function createSearchContentService(onChange) {
|
|
5929
|
+
const registrations = /* @__PURE__ */ new Map();
|
|
5930
|
+
const changed = () => {
|
|
5931
|
+
try {
|
|
5932
|
+
onChange?.();
|
|
5933
|
+
} catch {
|
|
5934
|
+
}
|
|
5935
|
+
};
|
|
5936
|
+
return {
|
|
5937
|
+
register(owner, createRule) {
|
|
5938
|
+
if (typeof owner !== "string" || !owner || typeof createRule !== "function") {
|
|
5939
|
+
throw new TypeError("Search content registration needs an owner and a rule factory");
|
|
5940
|
+
}
|
|
5941
|
+
if (registrations.has(owner)) throw new Error(`Search content rule already registered: ${owner}`);
|
|
5942
|
+
const record3 = { createRule };
|
|
5943
|
+
registrations.set(owner, record3);
|
|
5944
|
+
changed();
|
|
5945
|
+
let active = true;
|
|
5946
|
+
return () => {
|
|
5947
|
+
if (!active) return;
|
|
5948
|
+
active = false;
|
|
5949
|
+
if (registrations.get(owner) === record3) {
|
|
5950
|
+
registrations.delete(owner);
|
|
5951
|
+
changed();
|
|
5952
|
+
}
|
|
5953
|
+
};
|
|
5954
|
+
},
|
|
5955
|
+
createProjector(project) {
|
|
5956
|
+
if (typeof project !== "function") throw new TypeError("Search content needs a text projector");
|
|
5957
|
+
const rules = [...registrations.values()].map(({ createRule }) => createRule()).filter((rule) => typeof rule === "function");
|
|
5958
|
+
return async (source) => {
|
|
5959
|
+
let current = { ...source };
|
|
5960
|
+
try {
|
|
5961
|
+
for (const rule of rules) {
|
|
5962
|
+
const patch = await rule(current);
|
|
5963
|
+
if (patch === void 0 || patch === null) continue;
|
|
5964
|
+
if (!object2(patch)) throw new TypeError("Search content rule returned an invalid change");
|
|
5965
|
+
current = { ...current, ...patch };
|
|
5966
|
+
}
|
|
5967
|
+
} catch (error) {
|
|
5968
|
+
return { source: current, blocks: [], errors: [{ code: "search-content-rule-failed", message: error instanceof Error ? error.message : String(error) }] };
|
|
5969
|
+
}
|
|
5970
|
+
const projection = await project(current);
|
|
5971
|
+
return { ...projection, source: current };
|
|
5972
|
+
};
|
|
5973
|
+
}
|
|
5974
|
+
};
|
|
5975
|
+
}
|
|
5976
|
+
|
|
5178
5977
|
// src/client.js
|
|
5179
5978
|
/*! dsh-find-all. Copyright (c) 2026 secyborg; Copyright (c) 2026 Ryuu-64. MIT.
|
|
5180
5979
|
* Forked from secyborg/dsh-find-bar ce7eb75efe94d768127c5977c649ecd950a9356c. See LICENSE and NOTICE.md. */
|
|
@@ -5231,16 +6030,13 @@ var BLOCK_TAGS = {
|
|
|
5231
6030
|
UL: 1
|
|
5232
6031
|
};
|
|
5233
6032
|
var ZH = typeof navigator !== "undefined" && /^zh/i.test(navigator.language || "");
|
|
5234
|
-
var
|
|
6033
|
+
var L2 = ZH ? {
|
|
5235
6034
|
placeholder: "\u5728\u6B64\u4F1A\u8BDD\u4E2D\u67E5\u627E\u2026",
|
|
5236
6035
|
prev: "\u4E0A\u4E00\u4E2A\u5339\u914D",
|
|
5237
6036
|
next: "\u4E0B\u4E00\u4E2A\u5339\u914D",
|
|
5238
6037
|
close: "\u5173\u95ED\u67E5\u627E",
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
moveRight: "\u5411\u53F3\u79FB\u52A8",
|
|
5242
|
-
moveUp: "\u5411\u4E0A\u79FB\u52A8",
|
|
5243
|
-
moveDown: "\u5411\u4E0B\u79FB\u52A8",
|
|
6038
|
+
findTitle: "\u5F53\u524D\u5BF9\u8BDD\u67E5\u627E",
|
|
6039
|
+
move: "\u62D6\u52A8\u67E5\u627E\u680F\u7A7A\u767D\u5904\u79FB\u52A8\uFF1B\u65B9\u5411\u952E\u79FB\u52A8\uFF1BHome \u6062\u590D\u9ED8\u8BA4\u4F4D\u7F6E",
|
|
5244
6040
|
resetPosition: "\u6062\u590D\u9ED8\u8BA4\u4F4D\u7F6E",
|
|
5245
6041
|
cap: "\u4EC5\u663E\u793A\u524D {n} \u5904\u5339\u914D",
|
|
5246
6042
|
resultCount: "{n} \u4E2A\u7ED3\u679C",
|
|
@@ -5323,11 +6119,8 @@ var L = ZH ? {
|
|
|
5323
6119
|
prev: "Previous match",
|
|
5324
6120
|
next: "Next match",
|
|
5325
6121
|
close: "Close find",
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
moveRight: "Move right",
|
|
5329
|
-
moveUp: "Move up",
|
|
5330
|
-
moveDown: "Move down",
|
|
6122
|
+
findTitle: "Find in conversation",
|
|
6123
|
+
move: "Drag empty space in the find bar to move it; use arrow keys to move and Home to reset",
|
|
5331
6124
|
resetPosition: "Reset position",
|
|
5332
6125
|
cap: "Showing only the first {n} matches",
|
|
5333
6126
|
resultCount: "{n} results",
|
|
@@ -5495,7 +6288,7 @@ async function runPageIn(opts) {
|
|
|
5495
6288
|
}
|
|
5496
6289
|
}
|
|
5497
6290
|
function cssText() {
|
|
5498
|
-
return "#" + BAR_ID + "{--dsh-find-all-max-width:480px;container:dsh-find-all / inline-size;position:fixed;top:var(--dsh-find-all-bar-top);right:var(--dsh-find-all-bar-right);z-index:2147483000;visibility:hidden;isolation:isolate;box-sizing:border-box;align-items:stretch;gap:4px;padding:6px 8px;display:flex;flex-direction:column;width:min(var(--dsh-find-all-max-width),var(--dsh-find-all-panel-width));max-width:calc(100vw - 16px);max-height:var(--dsh-find-all-max-height);overflow:auto;background:transparent;--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);border:0;border-radius:var(--dsw-radius-md,8px);box-shadow:var(--dsw-elevation-panel,var(--dsw-shadow-lv2))}#" + BAR_ID + "[data-positioned]{visibility:visible}#" + BAR_ID + ":before,#" + BAR_ID + '-content-panel:before{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;border-radius:inherit;background:var(--dsw-menu-surface-fill,var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2)));-webkit-backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%));backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%))}#' + BAR_ID + " .controls{display:flex;flex-wrap:nowrap;align-items:center;gap:4px;min-width:0}#" + BAR_ID + " input.query{box-sizing:border-box;flex:1 1 0;min-width:64px;max-width:100%;width:auto;height:28px;color:var(--dsw-alias-label-primary);font:13px/1 var(--dsw-font-family);background:var(--dsw-alias-bg-base);border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm,6px);outline:none;padding:0 8px}#" + BAR_ID + " input.query:focus-visible{border-color:var(--dsw-alias-state-business-primary)}#" + BAR_ID + " .count{box-sizing:border-box;flex:0 1 80px;width:80px;min-width:64px;max-width:96px;height:28px;line-height:28px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font:12px/28px var(--dsw-font-family);font-variant-numeric:tabular-nums;text-align:center}#" + BAR_ID + " button.count{width:80px;min-width:64px;padding:0 4px;flex:0 1 80px}#" + BAR_ID + " .count[hidden],#" + BAR_ID + " .count-editor[hidden],#" + BAR_ID + " .count-hint[hidden]{display:none}#" + BAR_ID + " .count-editor{display:flex;align-items:center;gap:2px;flex:none;color:var(--dsw-alias-label-tertiary);font:12px/1 var(--dsw-font-family);font-variant-numeric:tabular-nums}#" + BAR_ID + " input.count-input{box-sizing:border-box;width:5.5ch;min-width:0;height:28px;padding:0 3px;text-align:right;font:inherit;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l4);border-radius:4px}#" + BAR_ID + " input.count-input:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}#" + BAR_ID + " input.count-input[aria-invalid=true]{border-color:var(--dsw-alias-state-error-primary,#c33)}#" + BAR_ID + " .count-hint{padding:2px 8px 0 32px;color:var(--dsw-alias-label-secondary);font:12px/1.5 var(--dsw-font-family);overflow-wrap:anywhere}#" + BAR_ID + " .count-hint[data-error]{color:var(--dsw-alias-state-error-primary,#c33)}#" + BAR_ID + " .status{box-sizing:border-box;width:100%;padding:2px 8px 4px 32px;color:var(--dsw-alias-label-tertiary);font:12px/1.5 var(--dsw-font-family);text-align:left;white-space:normal;overflow-wrap:anywhere}#" + BAR_ID + " .status:empty{display:none}#" + BAR_ID + " .position-controls{display:flex;flex-wrap:wrap;align-items:center;gap:4px}#" + BAR_ID + " .position-controls[hidden]{display:none}#" + BAR_ID + " button.drag-handle{touch-action:none;user-select:none;cursor:grab;flex:none}#" + BAR_ID + "[data-dragging] button.drag-handle{cursor:grabbing}#" + BAR_ID + " .status[data-busy]{cursor:pointer;color:var(--dsw-alias-state-business-primary)}#" + BAR_ID + " .navigation-controls{display:flex;align-items:center;gap:4px;flex:none}#" + BAR_ID + " .content-filter{position:relative;width:28px;padding:0}#" + BAR_ID + " .content-filter[aria-expanded=true]{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-button-ghost-active-fill,var(--dsw-alias-interactive-bg-hover))}#" + BAR_ID + " .content-filter[aria-expanded=true]:hover{background:var(--dsw-alias-button-ghost-active-hover,var(--dsw-alias-interactive-bg-active))}#" + BAR_ID + ' .content-filter[data-filtered]:after{content:"";position:absolute;top:3px;right:3px;width:5px;height:5px;border-radius:50%;background:var(--dsw-alias-state-business-primary)}#' + BAR_ID + "-content-panel{position:fixed;z-index:2147483001;isolation:isolate;box-sizing:border-box;display:flex;flex-direction:column;min-width:0;width:320px;max-width:calc(100vw - 16px);margin:0;padding:0;overflow:hidden;--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent,var(--dsw-elevation-panel,var(--dsw-shadow-lv2)));color:var(--dsw-alias-label-primary);font:13px/20px var(--dsw-font-family);border:0;border-radius:var(--dsw-radius-md,8px);background:transparent}#" + BAR_ID + "-content-panel[hidden]{display:none}#" + BAR_ID + "-content-panel .content-viewport{min-height:0;overflow:auto;padding:4px;--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2)}#" + BAR_ID + "-content-panel fieldset{min-width:0;margin:0;padding:0;border:0}#" + BAR_ID + "-content-panel legend{box-sizing:border-box;width:100%;padding:4px 8px;font:500 11px/16px var(--dsw-font-family);color:var(--dsw-alias-label-tertiary)}#" + BAR_ID + "-content-panel .content-options{display:grid;grid-template-columns:minmax(0,1fr)}#" + BAR_ID + "-content-panel .content-option{box-sizing:border-box;min-width:0;min-height:28px;padding:4px 8px;align-items:center;gap:6px;display:flex;border-radius:var(--dsw-radius-sm,6px);cursor:pointer}#" + BAR_ID + "-content-panel .content-option:hover{background:var(--dsw-alias-interactive-bg-hover)}#" + BAR_ID + "-content-panel .content-option span{min-width:0;overflow-wrap:anywhere}#" + BAR_ID + "-content-panel .content-option input{appearance:auto;accent-color:var(--dsw-alias-brand-primary,var(--dsw-alias-state-business-primary));flex:none;width:16px;height:16px;margin:0;cursor:inherit}#" + BAR_ID + "-content-panel .content-reset{margin-top:4px;padding:0 8px;font:12px/18px var(--dsw-font-family)}#" + BAR_ID + "-content-panel .scope-group{padding-bottom:4px;margin-bottom:4px;border-bottom:1px solid var(--dsw-alias-border-l1)}#" + BAR_ID + "-content-panel .history-command{margin-top:4px;padding-top:4px;border-top:1px solid var(--dsw-alias-border-l1)}#" + BAR_ID + "-content-panel .update-version,#" + BAR_ID + "-content-panel .update-status{margin:0;padding:4px 8px;font:12px/18px var(--dsw-font-family);color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}#" + BAR_ID + "-content-panel .update-status:empty{padding:0}#" + BAR_ID + "-content-panel .update-command [hidden]{display:none}#" + BAR_ID + "-content-panel .diagnostic-command{display:flex;flex-wrap:wrap;align-items:center;gap:4px}#" + BAR_ID + "-content-panel .diagnostic-command button{flex:1;width:auto}#" + BAR_ID + "-content-panel .diagnostic-feedback{padding:0 8px;font:12px/18px var(--dsw-font-family);color:var(--dsw-alias-label-secondary)}#" + BAR_ID + "-content-panel .feedback-issue{display:flex;align-items:center;gap:6px;box-sizing:border-box;min-height:28px;width:100%;padding:4px 8px;color:var(--dsw-alias-label-secondary);text-decoration:none;border-radius:var(--dsw-radius-sm,6px)}#" + BAR_ID + "-content-panel .feedback-issue:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}#" + BAR_ID + "-content-panel .feedback-privacy{margin:0;padding:0 8px 4px;font:12px/18px var(--dsw-font-family);color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}#" + BAR_ID + "-content-panel .history-command button{width:100%;height:auto;min-height:28px;justify-content:flex-start;gap:6px;padding:4px 8px;text-align:left;font:13px/20px var(--dsw-font-family)}#" + BAR_ID + " button,#" + BAR_ID + "-content-panel button{box-sizing:border-box;flex:none;height:28px;min-width:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:var(--dsw-radius-sm,6px);align-items:center;justify-content:center;display:inline-flex}#" + BAR_ID + " button[hidden]{display:none}#" + BAR_ID + " button:hover,#" + BAR_ID + "-content-panel button:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}#" + BAR_ID + " button:focus-visible,#" + BAR_ID + "-content-panel :focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}#" + BAR_ID + " button:disabled,#" + BAR_ID + "-content-panel button:disabled,#" + BAR_ID + "-content-panel button[aria-disabled=true]{opacity:.5;cursor:default}#" + BAR_ID + " [data-find-all-return][hidden]{display:none}#" + BAR_ID + " [data-find-all-return]{gap:4px;padding:0 8px;white-space:nowrap}@container dsh-find-all (max-width:550px){#" + BAR_ID + " .return-label{display:none}#" + BAR_ID + " [data-find-all-return]{padding:0 6px}}@container dsh-find-all (max-width:360px){#" + BAR_ID + " .controls,#" + BAR_ID + " .navigation-controls{gap:2px}#" + BAR_ID + " .count,#" + BAR_ID + " button.count{width:64px;min-width:64px;max-width:64px}#" + BAR_ID + " .status{padding-left:30px}}@container dsh-find-all (max-width:330px){#" + BAR_ID + " .controls{flex-wrap:wrap}#" + BAR_ID + " .navigation-controls{margin-left:auto}}#" + BAR_ID + " svg{pointer-events:none}#" + BAR_ID + "[data-about-open]{z-index:999;pointer-events:none}.dsh-find-all-about{max-height:100%;font-family:var(--dsw-font-family)}.dsh-find-all-about-content{min-height:0;overflow:auto}.dsh-find-all-about-details{display:flex;flex-direction:column;gap:16px;color:var(--dsw-alias-label-primary);font:13px/20px var(--dsw-font-family);overflow-wrap:anywhere}.dsh-find-all-about-details p{margin:0}.dsh-find-all-about-details h3{margin:0 0 6px;font:500 13px/20px var(--dsw-font-family)}.dsh-find-all-about-details a{color:var(--dsw-alias-state-business-primary);text-underline-offset:3px}.dsh-find-all-about-links{display:flex;flex-wrap:wrap;gap:6px 16px}.dsh-find-all-about-group{display:flex;align-items:center;flex-wrap:wrap;gap:6px 10px}.dsh-find-all-about-status{color:var(--dsw-alias-label-secondary)}.dsh-find-all-about-details :focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}::highlight(" + HL_ALL + "){background-color:rgba(245,197,24,.42)}::highlight(" + HL_CUR + "){background-color:#f5a623;color:#141414}";
|
|
6291
|
+
return "#" + BAR_ID + "{--dsh-find-all-max-width:480px;container:dsh-find-all / inline-size;position:fixed;top:var(--dsh-find-all-bar-top);right:var(--dsh-find-all-bar-right);z-index:2147483000;visibility:hidden;isolation:isolate;box-sizing:border-box;align-items:stretch;gap:4px;padding:6px 8px;display:flex;flex-direction:column;width:min(var(--dsh-find-all-max-width),var(--dsh-find-all-panel-width));max-width:calc(100vw - 16px);max-height:var(--dsh-find-all-max-height);overflow:auto;background:transparent;--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);border:0;border-radius:var(--dsw-radius-md,8px);box-shadow:var(--dsw-elevation-panel,var(--dsw-shadow-lv2))}#" + BAR_ID + "[data-positioned]{visibility:visible}#" + BAR_ID + ":before,#" + BAR_ID + '-content-panel:before{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;border-radius:inherit;background:var(--dsw-menu-surface-fill,var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2)));-webkit-backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%));backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%))}#' + BAR_ID + " .move-header{display:flex;align-items:center;gap:4px;min-width:0;min-height:28px;cursor:move}#" + BAR_ID + " .move-header:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px;border-radius:var(--dsw-radius-sm,6px)}#" + BAR_ID + " .move-grip{flex:none;width:8px;align-self:stretch;touch-action:none;user-select:none}#" + BAR_ID + " .move-actions{display:flex;align-items:center;gap:2px;flex:none}#" + BAR_ID + "[data-dragging] .move-header{cursor:grabbing}#" + BAR_ID + " .controls{display:flex;flex:1;flex-wrap:nowrap;align-items:center;gap:4px;min-width:0}#" + BAR_ID + " input.query{box-sizing:border-box;flex:1 1 0;min-width:64px;max-width:100%;width:auto;height:28px;color:var(--dsw-alias-label-primary);font:13px/1 var(--dsw-font-family);background:var(--dsw-alias-bg-base);border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm,6px);outline:none;padding:0 8px}#" + BAR_ID + " input.query:focus-visible{border-color:var(--dsw-alias-state-business-primary)}#" + BAR_ID + " .count{box-sizing:border-box;flex:0 1 80px;width:80px;min-width:64px;max-width:96px;height:28px;line-height:28px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font:12px/28px var(--dsw-font-family);font-variant-numeric:tabular-nums;text-align:center}#" + BAR_ID + " button.count{width:80px;min-width:64px;padding:0 4px;flex:0 1 80px}#" + BAR_ID + " .count[hidden],#" + BAR_ID + " .count-editor[hidden],#" + BAR_ID + " .count-hint[hidden]{display:none}#" + BAR_ID + " .count-editor{display:flex;align-items:center;gap:2px;flex:none;color:var(--dsw-alias-label-tertiary);font:12px/1 var(--dsw-font-family);font-variant-numeric:tabular-nums}#" + BAR_ID + " input.count-input{box-sizing:border-box;width:5.5ch;min-width:0;height:28px;padding:0 3px;text-align:right;font:inherit;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l4);border-radius:4px}#" + BAR_ID + " input.count-input:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}#" + BAR_ID + " input.count-input[aria-invalid=true]{border-color:var(--dsw-alias-state-error-primary,#c33)}#" + BAR_ID + " .count-hint{padding:2px 8px 0;color:var(--dsw-alias-label-secondary);font:12px/1.5 var(--dsw-font-family);overflow-wrap:anywhere}#" + BAR_ID + " .count-hint[data-error]{color:var(--dsw-alias-state-error-primary,#c33)}#" + BAR_ID + " .status{box-sizing:border-box;width:100%;padding:2px 8px 4px;color:var(--dsw-alias-label-tertiary);font:12px/1.5 var(--dsw-font-family);text-align:left;white-space:normal;overflow-wrap:anywhere}#" + BAR_ID + " .status:empty{display:none}#" + BAR_ID + " .status[data-busy]{cursor:pointer;color:var(--dsw-alias-state-business-primary)}#" + BAR_ID + " .navigation-controls{display:flex;align-items:center;gap:4px;flex:none}#" + BAR_ID + " .content-filter{position:relative;width:28px;padding:0}#" + BAR_ID + " .content-filter[aria-expanded=true]{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-button-ghost-active-fill,var(--dsw-alias-interactive-bg-hover))}#" + BAR_ID + " .content-filter[aria-expanded=true]:hover{background:var(--dsw-alias-button-ghost-active-hover,var(--dsw-alias-interactive-bg-active))}#" + BAR_ID + ' .content-filter[data-filtered]:after{content:"";position:absolute;top:3px;right:3px;width:5px;height:5px;border-radius:50%;background:var(--dsw-alias-state-business-primary)}#' + BAR_ID + "-content-panel{position:fixed;z-index:2147483001;isolation:isolate;box-sizing:border-box;display:flex;flex-direction:column;min-width:0;width:320px;max-width:calc(100vw - 16px);margin:0;padding:0;overflow:hidden;--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent,var(--dsw-elevation-panel,var(--dsw-shadow-lv2)));color:var(--dsw-alias-label-primary);font:13px/20px var(--dsw-font-family);border:0;border-radius:var(--dsw-radius-md,8px);background:transparent}#" + BAR_ID + "-content-panel[hidden]{display:none}#" + BAR_ID + "-content-panel .content-viewport{min-height:0;overflow:auto;padding:4px;--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2)}#" + BAR_ID + "-content-panel fieldset{min-width:0;margin:0;padding:0;border:0}#" + BAR_ID + "-content-panel legend{box-sizing:border-box;width:100%;padding:4px 8px;font:500 11px/16px var(--dsw-font-family);color:var(--dsw-alias-label-tertiary)}#" + BAR_ID + "-content-panel .content-options{display:grid;grid-template-columns:minmax(0,1fr)}#" + BAR_ID + "-content-panel .content-option{box-sizing:border-box;min-width:0;min-height:28px;padding:4px 8px;align-items:center;gap:6px;display:flex;border-radius:var(--dsw-radius-sm,6px);cursor:pointer}#" + BAR_ID + "-content-panel .content-option:hover{background:var(--dsw-alias-interactive-bg-hover)}#" + BAR_ID + "-content-panel .content-option span{min-width:0;overflow-wrap:anywhere}#" + BAR_ID + "-content-panel .content-option input{appearance:auto;accent-color:var(--dsw-alias-brand-primary,var(--dsw-alias-state-business-primary));flex:none;width:16px;height:16px;margin:0;cursor:inherit}#" + BAR_ID + "-content-panel .content-reset{margin-top:4px;padding:0 8px;font:12px/18px var(--dsw-font-family)}#" + BAR_ID + "-content-panel .scope-group{padding-bottom:4px;margin-bottom:4px;border-bottom:1px solid var(--dsw-alias-border-l1)}#" + BAR_ID + "-content-panel .history-command{margin-top:4px;padding-top:4px;border-top:1px solid var(--dsw-alias-border-l1)}#" + BAR_ID + "-content-panel .update-version,#" + BAR_ID + "-content-panel .update-status{margin:0;padding:4px 8px;font:12px/18px var(--dsw-font-family);color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}#" + BAR_ID + "-content-panel .update-status:empty{padding:0}#" + BAR_ID + "-content-panel .update-command [hidden]{display:none}#" + BAR_ID + "-content-panel .diagnostic-command{display:flex;flex-wrap:wrap;align-items:center;gap:4px}#" + BAR_ID + "-content-panel .diagnostic-command button{flex:1;width:auto}#" + BAR_ID + "-content-panel .diagnostic-feedback{padding:0 8px;font:12px/18px var(--dsw-font-family);color:var(--dsw-alias-label-secondary)}#" + BAR_ID + "-content-panel .feedback-issue{display:flex;align-items:center;gap:6px;box-sizing:border-box;min-height:28px;width:100%;padding:4px 8px;color:var(--dsw-alias-label-secondary);text-decoration:none;border-radius:var(--dsw-radius-sm,6px)}#" + BAR_ID + "-content-panel .feedback-issue:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}#" + BAR_ID + "-content-panel .feedback-privacy{margin:0;padding:0 8px 4px;font:12px/18px var(--dsw-font-family);color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}#" + BAR_ID + "-content-panel .history-command button{width:100%;height:auto;min-height:28px;justify-content:flex-start;gap:6px;padding:4px 8px;text-align:left;font:13px/20px var(--dsw-font-family)}#" + BAR_ID + " button,#" + BAR_ID + "-content-panel button{box-sizing:border-box;flex:none;height:28px;min-width:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:var(--dsw-radius-sm,6px);align-items:center;justify-content:center;display:inline-flex}#" + BAR_ID + " button[hidden]{display:none}#" + BAR_ID + " button:hover,#" + BAR_ID + "-content-panel button:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}#" + BAR_ID + " button:focus-visible,#" + BAR_ID + "-content-panel :focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}#" + BAR_ID + " button:disabled,#" + BAR_ID + "-content-panel button:disabled,#" + BAR_ID + "-content-panel button[aria-disabled=true]{opacity:.5;cursor:default}#" + BAR_ID + " [data-find-all-return][hidden]{display:none}#" + BAR_ID + " [data-find-all-return]{gap:4px;padding:0 8px;white-space:nowrap}@container dsh-find-all (max-width:550px){#" + BAR_ID + " .return-label{display:none}#" + BAR_ID + " [data-find-all-return]{padding:0 6px}}@container dsh-find-all (max-width:360px){#" + BAR_ID + " .controls,#" + BAR_ID + " .navigation-controls{gap:2px}#" + BAR_ID + " .count,#" + BAR_ID + " button.count{width:64px;min-width:64px;max-width:64px}}@container dsh-find-all (max-width:330px){#" + BAR_ID + " .controls{flex-wrap:wrap}#" + BAR_ID + " .navigation-controls{margin-left:auto}}#" + BAR_ID + " svg{pointer-events:none}#" + BAR_ID + "[data-about-open]{z-index:999;pointer-events:none}.dsh-find-all-conversations{width:min(680px,100%);align-self:flex-start;max-height:100%;min-width:0;padding:0;gap:0;font-family:var(--dsw-font-family)}.dsh-find-all-conversations-layout{display:flex;flex-direction:column;min-width:0;min-height:0;flex:1;width:100%;max-width:100%;overflow-y:auto;overflow-x:hidden}.dsh-find-all-conversations-header{display:flex;align-items:center;gap:8px;flex:none;min-width:0;padding:16px 16px 8px}.dsh-find-all-conversations-input{flex:1;min-width:0;box-sizing:border-box}.dsh-find-all-conversations-close{flex:none;width:28px;padding:0;color:var(--dsw-alias-label-secondary)}.dsh-find-all-conversations-toolbar{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:6px 12px;flex:none;min-width:0;padding:0 16px 10px;border-bottom:.5px solid var(--dsw-alias-border-l1)}.dsh-find-all-conversations-scope{min-width:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}.dsh-find-all-conversations-options{display:flex;align-items:center;flex-wrap:wrap;gap:6px 12px;margin-left:auto;min-width:0;max-width:100%}.dsh-find-all-conversations-title-only{flex:none;font-size:12px;line-height:18px;white-space:nowrap}.dsh-find-all-conversations-title-only-fallback{display:inline-flex;align-items:center;gap:6px}.dsh-find-all-conversations-title-only-fallback input{margin:0;accent-color:var(--dsw-alias-brand-primary)}.dsh-find-all-conversations-list{display:flex;flex-direction:column;flex:0 1 auto;min-height:0;min-width:0;max-width:100%;max-height:416px;box-sizing:border-box;padding:4px 8px;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain}.dsh-find-all-conversations-empty{padding:16px 8px;font-size:13px;line-height:20px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.dsh-find-all-conversations-footer{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:4px 8px;flex:none;min-height:0;max-height:35%;padding:8px 12px;border-top:.5px solid var(--dsw-alias-border-l1);overflow-y:auto;overflow-x:hidden}.dsh-find-all-conversations-status-actions{display:flex;align-items:center;flex-wrap:wrap;gap:4px 8px;flex:1;min-width:0}.dsh-find-all-conversations-status{margin:0;min-width:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.dsh-find-all-conversations-status:empty{display:none}.dsh-find-all-conversations-actions{display:flex;gap:4px;flex-wrap:wrap}.dsh-find-all-conversations-help{flex:none;margin-left:auto;color:var(--dsw-alias-label-tertiary)}.dsh-find-all-conversations-help-content{flex:0 1 auto;min-height:0;max-height:160px;padding:0 16px 12px;overflow-y:auto;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.dsh-find-all-conversations-help-content[hidden]{display:none}.dsh-find-all-conversations-help-content p{margin:6px 0 0}.dsh-find-all-conversations-match{color:inherit;background:var(--dsw-alias-state-business-tertiary);font-weight:600}.dsh-find-all-conversations-row{display:flex;flex-direction:column;align-items:stretch;flex:none;width:100%;min-width:0;max-width:100%;min-height:48px;box-sizing:border-box;border:none;border-radius:var(--dsw-radius-lg);padding:4px 8px;background:transparent;cursor:pointer;text-align:left;color:var(--dsw-alias-label-primary);font-family:inherit}.dsh-find-all-conversations-row:not(.dsh-find-all-conversations-archived-row):hover,.dsh-find-all-conversations-row:not(.dsh-find-all-conversations-archived-row)[aria-current=true]{background:var(--dsw-alias-interactive-bg-hover)}.dsh-find-all-conversations-row:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.dsh-find-all-conversations-archived-row{cursor:default}.dsh-find-all-conversations-row-heading{display:flex;align-items:center;flex-wrap:wrap;gap:6px;min-width:0;max-width:100%}.dsh-find-all-conversations-row-heading>.dsh-find-all-conversations-title{flex:1;min-width:0}.dsh-find-all-conversations-archive-label{flex:none;font-size:12px;line-height:17px;color:var(--dsw-alias-label-tertiary)}.dsh-find-all-conversations-restore{flex:none}.dsh-find-all-conversations-row-error{min-width:0;max-width:100%;font-size:12px;line-height:17px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.dsh-find-all-conversations-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;line-height:20px;font-weight:400}.dsh-find-all-conversations-meta{display:flex;align-items:center;gap:6px;min-width:0;min-height:17px}.dsh-find-all-conversations-info,.dsh-find-all-conversations-snippet{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:17px}.dsh-find-all-conversations-info{flex:none;max-width:40%;color:var(--dsw-alias-label-tertiary)}.dsh-find-all-conversations-info:only-child{max-width:100%}.dsh-find-all-conversations-snippet{flex:1;min-width:0;color:var(--dsw-alias-label-secondary)}.dsh-find-all-about{max-height:100%;font-family:var(--dsw-font-family)}.dsh-find-all-about-content{min-height:0;overflow:auto}.dsh-find-all-about-details{display:flex;flex-direction:column;gap:16px;color:var(--dsw-alias-label-primary);font:13px/20px var(--dsw-font-family);overflow-wrap:anywhere}.dsh-find-all-about-details p{margin:0}.dsh-find-all-about-details h3{margin:0 0 6px;font:500 13px/20px var(--dsw-font-family)}.dsh-find-all-about-details a{color:var(--dsw-alias-state-business-primary);text-underline-offset:3px}.dsh-find-all-about-links{display:flex;flex-wrap:wrap;gap:6px 16px}.dsh-find-all-about-group{display:flex;align-items:center;flex-wrap:wrap;gap:6px 10px}.dsh-find-all-about-status{color:var(--dsw-alias-label-secondary)}.dsh-find-all-about-details :focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}::highlight(" + HL_ALL + "){background-color:rgba(245,197,24,.42)}::highlight(" + HL_CUR + "){background-color:#f5a623;color:#141414}";
|
|
5499
6292
|
}
|
|
5500
6293
|
function injectCss() {
|
|
5501
6294
|
if (typeof document === "undefined") return;
|
|
@@ -5575,7 +6368,7 @@ function collectTextBlocks(root, classify) {
|
|
|
5575
6368
|
return;
|
|
5576
6369
|
}
|
|
5577
6370
|
if (node.nodeType !== 1 && node.nodeType !== 11) return;
|
|
5578
|
-
if (SKIP_TAGS[node.tagName] || node.id === BAR_ID || messageActionRow(node, legacyActions) || node.tagName === "BR") {
|
|
6371
|
+
if (SKIP_TAGS[node.tagName] || node.id === BAR_ID || node.hasAttribute?.("data-find-projection-chrome") || messageActionRow(node, legacyActions) || node.tagName === "BR") {
|
|
5579
6372
|
flush();
|
|
5580
6373
|
return;
|
|
5581
6374
|
}
|
|
@@ -5622,24 +6415,23 @@ function makeHighlight(ranges) {
|
|
|
5622
6415
|
function matchBarRect() {
|
|
5623
6416
|
return isOpen() && state.bar.hasAttribute("data-positioned") ? state.bar.getBoundingClientRect() : null;
|
|
5624
6417
|
}
|
|
5625
|
-
function
|
|
5626
|
-
if (!
|
|
5627
|
-
var
|
|
5628
|
-
|
|
5629
|
-
for (var i = 0; i < rects.length; i++) {
|
|
5630
|
-
var rect = rects[i], left = Math.max(rect.left, clip.left), right = Math.min(rect.right, clip.right);
|
|
5631
|
-
var top = Math.max(rect.top, clip.top), bottom = Math.min(rect.bottom, clip.bottom);
|
|
5632
|
-
if (right <= left || bottom <= top) continue;
|
|
5633
|
-
if (state.scope === "whole" && (rect.top < clip.top - 1 || rect.bottom > clip.bottom + 1)) continue;
|
|
5634
|
-
if (!bar || right <= bar.left || left >= bar.right || bottom <= bar.top || top >= bar.bottom) return rect;
|
|
6418
|
+
function matchAnchorRect(range) {
|
|
6419
|
+
if (!range || !range.startContainer.isConnected || !range.endContainer.isConnected || typeof range.getClientRects !== "function") return null;
|
|
6420
|
+
for (var rect of range.getClientRects()) {
|
|
6421
|
+
if (rect.width > 0 && rect.height > 0 && [rect.top, rect.bottom, rect.left, rect.right].every(Number.isFinite)) return rect;
|
|
5635
6422
|
}
|
|
5636
6423
|
return null;
|
|
5637
6424
|
}
|
|
5638
|
-
function
|
|
5639
|
-
var rect =
|
|
5640
|
-
if (!rect) return;
|
|
6425
|
+
function matchScrollPlan(range, scroll, viewport, bar, center) {
|
|
6426
|
+
var rect = matchAnchorRect(range);
|
|
6427
|
+
if (!rect) return null;
|
|
5641
6428
|
var current = scroll.scrollTop, maximum = Math.max(0, scroll.scrollHeight - scroll.clientHeight);
|
|
5642
|
-
var bands = [[viewport.top, viewport.bottom]];
|
|
6429
|
+
var bands = [[viewport.top, viewport.bottom]], margin = 0;
|
|
6430
|
+
if (center) {
|
|
6431
|
+
var lineHeight = window.getComputedStyle(range.startContainer.parentElement).lineHeight;
|
|
6432
|
+
margin = /^\d+(?:\.\d+)?px$/.test(lineHeight) ? parseFloat(lineHeight) : rect.height;
|
|
6433
|
+
if (!Number.isFinite(margin) || margin <= 0) margin = rect.height;
|
|
6434
|
+
}
|
|
5643
6435
|
if (bar && rect.right > bar.left && rect.left < bar.right && bar.bottom > viewport.top && bar.top < viewport.bottom) {
|
|
5644
6436
|
bands = [
|
|
5645
6437
|
[viewport.top, Math.min(viewport.bottom, bar.top - 8)],
|
|
@@ -5649,29 +6441,48 @@ function scrollRangeWithin(range, scroll, viewport, bar) {
|
|
|
5649
6441
|
var best = null;
|
|
5650
6442
|
bands.forEach(function(band) {
|
|
5651
6443
|
if (band[1] <= band[0]) return;
|
|
5652
|
-
var
|
|
6444
|
+
var comfortable = rect.top >= band[0] + margin && rect.bottom <= band[1] - margin;
|
|
6445
|
+
var delta = center ? comfortable ? 0 : (rect.top + rect.bottom - band[0] - band[1]) / 2 : rect.top < band[0] ? rect.top - band[0] : rect.bottom > band[1] ? Math.min(rect.top - band[0], rect.bottom - band[1]) : 0;
|
|
5653
6446
|
delta = Math.max(0, Math.min(maximum, current + delta)) - current;
|
|
5654
6447
|
var shown = Math.max(0, Math.min(rect.bottom - delta, band[1]) - Math.max(rect.top - delta, band[0]));
|
|
5655
|
-
|
|
6448
|
+
var candidate = { delta, shown, comfortable, top: band[0], bottom: band[1] };
|
|
6449
|
+
if (!best || comfortable && !best.comfortable || comfortable === best.comfortable && (shown > best.shown || shown === best.shown && Math.abs(delta) < Math.abs(best.delta))) best = candidate;
|
|
5656
6450
|
});
|
|
5657
|
-
|
|
5658
|
-
|
|
6451
|
+
if (best) best.x = rect.left < viewport.left ? rect.left - viewport.left : rect.right > viewport.right ? Math.min(rect.left - viewport.left, rect.right - viewport.right) : 0;
|
|
6452
|
+
return best;
|
|
6453
|
+
}
|
|
6454
|
+
function scrollRangeWithin(range, scroll, viewport, bar, center) {
|
|
6455
|
+
var plan = matchScrollPlan(range, scroll, viewport, bar, center);
|
|
6456
|
+
if (plan && (Math.abs(plan.delta) > 1 || Math.abs(plan.x) > 1)) {
|
|
5659
6457
|
try {
|
|
5660
|
-
scroll.scrollBy({ top:
|
|
6458
|
+
scroll.scrollBy({ top: plan.delta, left: plan.x, behavior: "instant" });
|
|
5661
6459
|
} catch (error) {
|
|
5662
6460
|
}
|
|
5663
6461
|
}
|
|
5664
6462
|
}
|
|
6463
|
+
function matchLanding(range, viewport) {
|
|
6464
|
+
var rect = matchAnchorRect(range);
|
|
6465
|
+
if (!viewport || !rect) return null;
|
|
6466
|
+
var clip = clippedViewport(range.startContainer.parentElement, viewport), bar = matchBarRect();
|
|
6467
|
+
var plan = matchScrollPlan(range, viewport.scroll, viewport, bar, true);
|
|
6468
|
+
var readable = rect.top >= clip.top - 1 && rect.bottom <= clip.bottom + 1 && clip.right > clip.left && Math.min(rect.right, clip.right) - Math.max(rect.left, clip.left) >= Math.min(rect.width, clip.right - clip.left) - 1 && (!bar || rect.right <= bar.left || rect.left >= bar.right || rect.bottom <= bar.top || rect.top >= bar.bottom);
|
|
6469
|
+
return {
|
|
6470
|
+
rect,
|
|
6471
|
+
plan,
|
|
6472
|
+
readable,
|
|
6473
|
+
settled: readable && plan && (plan.comfortable || Math.abs(plan.delta) <= 1)
|
|
6474
|
+
};
|
|
6475
|
+
}
|
|
5665
6476
|
function scrollToRange(range) {
|
|
5666
6477
|
var viewport = readingViewport(state.target);
|
|
5667
|
-
if (!viewport
|
|
6478
|
+
if (!viewport) return;
|
|
5668
6479
|
for (var node = range.startContainer.parentElement; node && node !== viewport.scroll; node = node.parentElement) {
|
|
5669
6480
|
var style = window.getComputedStyle(node);
|
|
5670
6481
|
var clipsY = /^(auto|scroll|hidden)$/.test(style.overflowY) && node.scrollHeight > node.clientHeight;
|
|
5671
6482
|
var clipsX = /^(auto|scroll|hidden)$/.test(style.overflowX) && node.scrollWidth > node.clientWidth;
|
|
5672
6483
|
if (!clipsX && !clipsY) continue;
|
|
5673
|
-
var box = node.getBoundingClientRect(),
|
|
5674
|
-
var rect =
|
|
6484
|
+
var box = node.getBoundingClientRect(), left = box.left + node.clientLeft;
|
|
6485
|
+
var rect = matchAnchorRect(range);
|
|
5675
6486
|
if (!rect) return;
|
|
5676
6487
|
var clip = clippedViewport(node, viewport), local = verticalTextClip(node, style, box);
|
|
5677
6488
|
var safeTop = Math.max(local.top, clip.top), safeBottom = Math.min(local.bottom, clip.bottom);
|
|
@@ -5685,11 +6496,12 @@ function scrollToRange(range) {
|
|
|
5685
6496
|
left: clipsX ? left : rect.left,
|
|
5686
6497
|
right: clipsX ? left + node.clientWidth : rect.right
|
|
5687
6498
|
},
|
|
5688
|
-
clipsY && shown ? matchBarRect() : null
|
|
6499
|
+
clipsY && shown ? matchBarRect() : null,
|
|
6500
|
+
false
|
|
5689
6501
|
);
|
|
5690
6502
|
}
|
|
5691
6503
|
viewport = readingViewport(state.target);
|
|
5692
|
-
if (viewport
|
|
6504
|
+
if (viewport) scrollRangeWithin(range, viewport.scroll, viewport, matchBarRect(), true);
|
|
5693
6505
|
}
|
|
5694
6506
|
function visible(element) {
|
|
5695
6507
|
if (!element || !element.isConnected || !element.getClientRects().length) return false;
|
|
@@ -5777,6 +6589,12 @@ function createHostAdapter(ctx, changed) {
|
|
|
5777
6589
|
nodes: function(entry) {
|
|
5778
6590
|
return entry && entry.registration.nodes;
|
|
5779
6591
|
},
|
|
6592
|
+
forSession: function(id) {
|
|
6593
|
+
var matches = Array.from(entries.values()).filter(function(entry) {
|
|
6594
|
+
return entry.id === id && shown(entry) && resolveScope(entry.anchor, id);
|
|
6595
|
+
});
|
|
6596
|
+
return matches.length === 1 ? choose(matches[0]) : null;
|
|
6597
|
+
},
|
|
5780
6598
|
refresh: current,
|
|
5781
6599
|
select: function(target, previous) {
|
|
5782
6600
|
var direct = Array.from(entries.values()).filter(function(entry) {
|
|
@@ -5814,7 +6632,7 @@ function hostNavigationReady(target, face) {
|
|
|
5814
6632
|
if (face && (!status || status.reason || pendingLoads.has(face))) return false;
|
|
5815
6633
|
return !target.root.querySelector(":scope > div:not([data-chat-anchor-key]):not([data-chat-group-key]) > button:disabled");
|
|
5816
6634
|
}
|
|
5817
|
-
function activateLoadedTurn(target, store, preferredTurn) {
|
|
6635
|
+
function activateLoadedTurn(target, store, preferredTurn, exactOnly) {
|
|
5818
6636
|
if (!store) return false;
|
|
5819
6637
|
var list = target.root.parentElement, chat = list && list.parentElement, frame = chat && chat.parentElement;
|
|
5820
6638
|
if (!frame || !target.panel.contains(frame)) return false;
|
|
@@ -5822,23 +6640,25 @@ function activateLoadedTurn(target, store, preferredTurn) {
|
|
|
5822
6640
|
var label = nav.getAttribute("aria-label");
|
|
5823
6641
|
return !target.root.contains(nav) && (label === "Turn navigation" || label === "\u8F6E\u6B21\u5BFC\u822A");
|
|
5824
6642
|
});
|
|
6643
|
+
if (!navs.length) return exactOnly ? null : false;
|
|
5825
6644
|
if (navs.length !== 1 || !visible(navs[0])) return false;
|
|
5826
6645
|
var loaded = /* @__PURE__ */ new Set();
|
|
5827
6646
|
Array.prototype.forEach.call(target.root.querySelectorAll("[data-chat-anchor-key][data-chat-turn]"), function(row) {
|
|
5828
6647
|
var key = row.getAttribute("data-chat-node-key") || row.getAttribute("data-chat-anchor-key");
|
|
5829
6648
|
if (store.get(key)) loaded.add(row.getAttribute("data-chat-turn"));
|
|
5830
6649
|
});
|
|
5831
|
-
var candidates = [];
|
|
6650
|
+
var candidates = [], exactMounted = false;
|
|
5832
6651
|
Array.prototype.forEach.call(navs[0].querySelectorAll("button[data-index]"), function(button2) {
|
|
5833
6652
|
var match = /^(?:Jump to turn (\d+)|跳转到第 (\d+) 轮)$/.exec(button2.getAttribute("aria-label") || "");
|
|
5834
6653
|
var turn = match && (match[1] || match[2]);
|
|
5835
|
-
if (
|
|
6654
|
+
if (turn === preferredTurn) exactMounted = true;
|
|
6655
|
+
if (!turn || exactOnly && turn !== preferredTurn || !loaded.has(turn) || button2.disabled || button2.getAttribute("aria-busy") === "true" || !visible(button2)) return;
|
|
5836
6656
|
candidates.push({ button: button2, rank: turn === preferredTurn ? 0 : button2.getAttribute("aria-current") === "true" ? 1 : 2 });
|
|
5837
6657
|
});
|
|
5838
6658
|
candidates.sort(function(a, b) {
|
|
5839
6659
|
return a.rank - b.rank;
|
|
5840
6660
|
});
|
|
5841
|
-
if (!candidates.length) return false;
|
|
6661
|
+
if (!candidates.length) return exactOnly && !exactMounted ? null : false;
|
|
5842
6662
|
candidates[0].button.click();
|
|
5843
6663
|
return true;
|
|
5844
6664
|
}
|
|
@@ -6080,7 +6900,7 @@ function updateReturnButton() {
|
|
|
6080
6900
|
var available = originValid(state.origin) && state.origin.navigated;
|
|
6081
6901
|
state.returnBtn.hidden = !state.restoring && !available;
|
|
6082
6902
|
state.returnBtn.disabled = !!state.restoring;
|
|
6083
|
-
var label = state.restoring ?
|
|
6903
|
+
var label = state.restoring ? L2.returning : L2.returnPosition;
|
|
6084
6904
|
state.returnBtn.querySelector(".return-label").textContent = label;
|
|
6085
6905
|
state.returnBtn.setAttribute("aria-label", label);
|
|
6086
6906
|
state.returnBtn.title = label;
|
|
@@ -6107,77 +6927,139 @@ function discardOrigin() {
|
|
|
6107
6927
|
updateReturnButton();
|
|
6108
6928
|
}
|
|
6109
6929
|
function navigateToRange(range) {
|
|
6110
|
-
cancelReturn(
|
|
6930
|
+
cancelReturn(L2.returnCancelled);
|
|
6111
6931
|
cancelNavigation();
|
|
6112
6932
|
var target = state.target, face = state.adapter && state.adapter.face(target);
|
|
6113
|
-
|
|
6114
|
-
var row = range.startContainer.parentElement.closest("[data-chat-turn]");
|
|
6115
|
-
activateLoadedTurn(target, state.adapter.nodes(target), row && row.getAttribute("data-chat-turn"));
|
|
6116
|
-
if (state.target !== target || !state.adapter.valid(target) || state.adapter.face(target) !== face) return;
|
|
6117
|
-
}
|
|
6118
|
-
var origin = state.origin, token = state.navigationToken, started = Date.now();
|
|
6933
|
+
var origin = state.origin, token = state.navigationToken, queryToken = state.queryToken, query = state.query, started = Date.now();
|
|
6119
6934
|
var dataHit = state.scope === "whole" ? state.hits[state.index] : null;
|
|
6120
|
-
var activated = /* @__PURE__ */ new Set(), announceReturn = false;
|
|
6935
|
+
var selection = state.selection, activated = /* @__PURE__ */ new Set(), announceReturn = false, statusApplied = false;
|
|
6936
|
+
var transferred = false, directAttempted = false, corrections = 0, previous = null, stable = 0;
|
|
6937
|
+
function retry() {
|
|
6938
|
+
state.navigationTimer = setTimeout(check, 100);
|
|
6939
|
+
}
|
|
6940
|
+
function fail() {
|
|
6941
|
+
recordFailure("jump", "render");
|
|
6942
|
+
setStatus(L2.matchRevealFailed, false);
|
|
6943
|
+
if (state.announcement) state.announcement.textContent = L2.matchRevealFailed;
|
|
6944
|
+
}
|
|
6121
6945
|
function check() {
|
|
6122
6946
|
state.navigationTimer = 0;
|
|
6123
|
-
if (token !== state.navigationToken || state.target !== target || !state.adapter.valid(target) || !isOpen()) return;
|
|
6947
|
+
if (token !== state.navigationToken || queryToken !== state.queryToken || query !== state.query || state.target !== target || !state.adapter.valid(target) || state.adapter.face(target) !== face || !isOpen() || dataHit && state.hits[state.index] !== dataHit) return;
|
|
6948
|
+
if (Date.now() - started >= 1500) {
|
|
6949
|
+
fail();
|
|
6950
|
+
return;
|
|
6951
|
+
}
|
|
6952
|
+
if (!face || !hostNavigationReady(target, face)) {
|
|
6953
|
+
previous = null;
|
|
6954
|
+
stable = 0;
|
|
6955
|
+
retry();
|
|
6956
|
+
return;
|
|
6957
|
+
}
|
|
6124
6958
|
positionBar();
|
|
6125
|
-
var
|
|
6126
|
-
var current = state.ranges[state.index];
|
|
6959
|
+
var current = state.ranges[state.index], store = state.adapter.nodes(target);
|
|
6127
6960
|
if (dataHit) {
|
|
6128
|
-
|
|
6961
|
+
current = null;
|
|
6962
|
+
var semanticNode = sourceNode(dataHit.source, store);
|
|
6129
6963
|
if (semanticNode) {
|
|
6130
|
-
var resolved = mapProjectedDocument(dataHit.source, semanticNode, sourceRows(target, semanticNode));
|
|
6131
|
-
if (resolved.blocks)
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
}
|
|
6143
|
-
var attached = current && target.root.contains(current.startContainer);
|
|
6964
|
+
var resolved = mapProjectedDocument(dataHit.source, semanticNode, sourceRows(target, semanticNode), dataHit.blockIndex);
|
|
6965
|
+
if (resolved.blocks) current = rangeForBlock(resolved.blocks[dataHit.blockIndex], dataHit.start, dataHit.end);
|
|
6966
|
+
else expandSource(target, semanticNode, dataHit.source, activated);
|
|
6967
|
+
if (current && current.toString() !== dataHit.text) current = null;
|
|
6968
|
+
}
|
|
6969
|
+
} else if (selection && selection.position && selection.block && selection.block.isConnected) {
|
|
6970
|
+
var blocks = collectTextBlocks(selection.block);
|
|
6971
|
+
current = blocks.length === selection.texts.length && blocks.every(function(block, i) {
|
|
6972
|
+
return block.text === selection.texts[i];
|
|
6973
|
+
}) ? rangeForBlock(blocks[selection.position.run], selection.position.start, selection.position.end) : null;
|
|
6974
|
+
}
|
|
6975
|
+
var attached = current && target.root.contains(current.startContainer) && target.root.contains(current.endContainer);
|
|
6144
6976
|
var concealed = attached && hiddenUntilFoundAncestor(current.startContainer, target.root);
|
|
6145
|
-
var geometry = attached && !concealed &&
|
|
6146
|
-
if (
|
|
6147
|
-
if (geometry
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6977
|
+
var geometry = attached && !concealed && matchAnchorRect(current);
|
|
6978
|
+
if (attached && (!geometry || concealed)) revealMatchRange(target, current, activated);
|
|
6979
|
+
if (!geometry) {
|
|
6980
|
+
previous = null;
|
|
6981
|
+
stable = 0;
|
|
6982
|
+
retry();
|
|
6983
|
+
return;
|
|
6984
|
+
}
|
|
6985
|
+
state.ranges[state.index] = current;
|
|
6986
|
+
paint();
|
|
6987
|
+
var viewport = readingViewport(target), landing = matchLanding(current, viewport);
|
|
6988
|
+
if (!landing) {
|
|
6989
|
+
retry();
|
|
6990
|
+
return;
|
|
6991
|
+
}
|
|
6992
|
+
if (!transferred && !landing.settled) {
|
|
6993
|
+
var row = current.startContainer.parentElement.closest("[data-chat-turn]");
|
|
6994
|
+
var turn = row && row.getAttribute("data-chat-turn");
|
|
6995
|
+
if (directAttempted) {
|
|
6996
|
+
fail();
|
|
6165
6997
|
return;
|
|
6166
6998
|
}
|
|
6167
|
-
|
|
6168
|
-
|
|
6999
|
+
var handoff = turn ? activateLoadedTurn(target, store, turn, true) : null;
|
|
7000
|
+
if (handoff === false) {
|
|
7001
|
+
retry();
|
|
6169
7002
|
return;
|
|
6170
7003
|
}
|
|
6171
|
-
if (
|
|
7004
|
+
if (handoff === true) {
|
|
7005
|
+
transferred = true;
|
|
7006
|
+
previous = null;
|
|
7007
|
+
stable = 0;
|
|
7008
|
+
retry();
|
|
7009
|
+
return;
|
|
7010
|
+
}
|
|
7011
|
+
directAttempted = true;
|
|
7012
|
+
}
|
|
7013
|
+
if (!landing.settled) {
|
|
7014
|
+
if (corrections >= 2) {
|
|
7015
|
+
fail();
|
|
7016
|
+
return;
|
|
7017
|
+
}
|
|
7018
|
+
corrections++;
|
|
7019
|
+
scrollToRange(current);
|
|
7020
|
+
viewport = readingViewport(target);
|
|
7021
|
+
landing = matchLanding(current, viewport);
|
|
7022
|
+
if (dataHit && landing && !landing.readable) {
|
|
7023
|
+
state.avoidMatchRange = current;
|
|
7024
|
+
positionBar();
|
|
7025
|
+
landing = matchLanding(current, readingViewport(target));
|
|
7026
|
+
}
|
|
7027
|
+
previous = null;
|
|
7028
|
+
stable = 0;
|
|
7029
|
+
retry();
|
|
6172
7030
|
return;
|
|
6173
7031
|
}
|
|
6174
|
-
if (
|
|
6175
|
-
|
|
7032
|
+
if (!statusApplied) {
|
|
7033
|
+
statusApplied = true;
|
|
7034
|
+
announceReturn = originValid(origin) && !origin.navigated;
|
|
7035
|
+
if (originValid(origin)) origin.navigated = true;
|
|
7036
|
+
updateReturnButton();
|
|
7037
|
+
if (state.jumpStatus !== null) setStatus(state.jumpStatus, false);
|
|
7038
|
+
else if (dataHit) historyStatus();
|
|
7039
|
+
else if (state.status.textContent === L2.matchRevealFailed || announceReturn) setStatus("", false);
|
|
7040
|
+
previous = null;
|
|
7041
|
+
stable = 0;
|
|
7042
|
+
retry();
|
|
6176
7043
|
return;
|
|
6177
7044
|
}
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
7045
|
+
var sample = [
|
|
7046
|
+
landing.rect.top,
|
|
7047
|
+
landing.rect.bottom,
|
|
7048
|
+
landing.rect.left,
|
|
7049
|
+
landing.rect.right,
|
|
7050
|
+
viewport.scroll.scrollTop,
|
|
7051
|
+
landing.plan.top,
|
|
7052
|
+
landing.plan.bottom
|
|
7053
|
+
];
|
|
7054
|
+
stable = previous && sample.every(function(value, i) {
|
|
7055
|
+
return Math.abs(value - previous[i]) <= 1;
|
|
7056
|
+
}) ? stable + 1 : 0;
|
|
7057
|
+
previous = sample;
|
|
7058
|
+
if (stable < 2) {
|
|
7059
|
+
retry();
|
|
7060
|
+
return;
|
|
7061
|
+
}
|
|
7062
|
+
if (announceReturn && state.announcement) state.announcement.textContent = L2.returnAvailable;
|
|
6181
7063
|
}
|
|
6182
7064
|
check();
|
|
6183
7065
|
}
|
|
@@ -6233,7 +7115,7 @@ function revealMatchRange(target, range, activated) {
|
|
|
6233
7115
|
return changed;
|
|
6234
7116
|
}
|
|
6235
7117
|
function returnFailure(reason) {
|
|
6236
|
-
return
|
|
7118
|
+
return L2.returnFailed + " " + (L2["return_" + reason] || L2.return_unavailable);
|
|
6237
7119
|
}
|
|
6238
7120
|
async function returnToOrigin() {
|
|
6239
7121
|
cancelCountEdit(false);
|
|
@@ -6244,7 +7126,7 @@ async function returnToOrigin() {
|
|
|
6244
7126
|
cancelNavigation();
|
|
6245
7127
|
var task = { origin };
|
|
6246
7128
|
state.restoring = task;
|
|
6247
|
-
setStatus(
|
|
7129
|
+
setStatus(L2.returning, false);
|
|
6248
7130
|
updateReturnButton();
|
|
6249
7131
|
function cancelled() {
|
|
6250
7132
|
return state.restoring !== task || !originValid(origin);
|
|
@@ -6398,7 +7280,7 @@ async function returnToOrigin() {
|
|
|
6398
7280
|
if (state.scope === "whole") historyStatus();
|
|
6399
7281
|
else setStatus("", false);
|
|
6400
7282
|
updateReturnButton();
|
|
6401
|
-
if (state.announcement) state.announcement.textContent =
|
|
7283
|
+
if (state.announcement) state.announcement.textContent = L2.returned;
|
|
6402
7284
|
} catch (error) {
|
|
6403
7285
|
finishFailure("error");
|
|
6404
7286
|
} finally {
|
|
@@ -6412,6 +7294,10 @@ async function returnToOrigin() {
|
|
|
6412
7294
|
}
|
|
6413
7295
|
var state = {
|
|
6414
7296
|
ctx: null,
|
|
7297
|
+
conversationSearch: null,
|
|
7298
|
+
crossSearch: null,
|
|
7299
|
+
crossSearchReturn: null,
|
|
7300
|
+
crossSearchHint: null,
|
|
6415
7301
|
updateTask: null,
|
|
6416
7302
|
updateResult: null,
|
|
6417
7303
|
updateBtn: null,
|
|
@@ -6432,6 +7318,7 @@ var state = {
|
|
|
6432
7318
|
history: null,
|
|
6433
7319
|
historySnapshot: null,
|
|
6434
7320
|
projector: null,
|
|
7321
|
+
searchContent: null,
|
|
6435
7322
|
hits: [],
|
|
6436
7323
|
total: 0,
|
|
6437
7324
|
queryToken: 0,
|
|
@@ -6492,10 +7379,7 @@ var state = {
|
|
|
6492
7379
|
positionFrame: null,
|
|
6493
7380
|
positionOwner: null,
|
|
6494
7381
|
manualPosition: null,
|
|
6495
|
-
drag: null
|
|
6496
|
-
dragHandle: null,
|
|
6497
|
-
positionControls: null,
|
|
6498
|
-
suppressMoveClick: false
|
|
7382
|
+
drag: null
|
|
6499
7383
|
};
|
|
6500
7384
|
function diagnosticCode(code) {
|
|
6501
7385
|
switch (code) {
|
|
@@ -6617,17 +7501,17 @@ async function copyDiagnostics() {
|
|
|
6617
7501
|
var epoch = ++state.copyEpoch, feedback = state.diagnosticFeedback;
|
|
6618
7502
|
state.copyPending = true;
|
|
6619
7503
|
state.diagnosticBtn.setAttribute("aria-busy", "true");
|
|
6620
|
-
feedback.textContent =
|
|
7504
|
+
feedback.textContent = L2.copyingDiagnostics;
|
|
6621
7505
|
var copied = false;
|
|
6622
7506
|
try {
|
|
6623
|
-
var summary = { schemaVersion: 1, pluginVersion: "0.1.
|
|
7507
|
+
var summary = { schemaVersion: 1, pluginVersion: "0.1.13", current: diagnosticState(), lastFailure: state.lastFailure };
|
|
6624
7508
|
copied = typeof state.writeClipboard === "function" && await state.writeClipboard(JSON.stringify(summary, null, 2)) === true;
|
|
6625
7509
|
} catch (error) {
|
|
6626
7510
|
}
|
|
6627
7511
|
if (!state.mounted || epoch !== state.copyEpoch || state.diagnosticFeedback !== feedback || !feedback.isConnected) return;
|
|
6628
7512
|
state.copyPending = false;
|
|
6629
7513
|
state.diagnosticBtn.removeAttribute("aria-busy");
|
|
6630
|
-
feedback.textContent = copied ?
|
|
7514
|
+
feedback.textContent = copied ? L2.copiedDiagnostics : L2.copyDiagnosticsFailed;
|
|
6631
7515
|
}
|
|
6632
7516
|
function barAnchor(target) {
|
|
6633
7517
|
if (!target || !target.anchor || !target.panel || !target.anchor.closest) return null;
|
|
@@ -6712,67 +7596,70 @@ function moveBarBy(x, y) {
|
|
|
6712
7596
|
state.manualPosition = { left: box.left + x, top: box.top + y };
|
|
6713
7597
|
scheduleBarPosition();
|
|
6714
7598
|
}
|
|
6715
|
-
function
|
|
6716
|
-
var
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
7599
|
+
function buildMoveHeader(bar, controls) {
|
|
7600
|
+
var header = document.createElement("div");
|
|
7601
|
+
header.className = "move-header";
|
|
7602
|
+
header.tabIndex = 0;
|
|
7603
|
+
header.setAttribute("role", "group");
|
|
7604
|
+
header.setAttribute("aria-label", L2.move);
|
|
7605
|
+
header.title = L2.move;
|
|
7606
|
+
var actions = document.createElement("div");
|
|
7607
|
+
actions.className = "move-actions";
|
|
7608
|
+
var reset = button(L2.resetPosition, "M3 10a9 9 0 1 1 2 8M3 4v6h6", resetBarPosition);
|
|
7609
|
+
var closeBtn = button(L2.close, "M18 6 6 18M6 6l12 12", close);
|
|
7610
|
+
[reset, closeBtn].forEach(function(action) {
|
|
7611
|
+
action.addEventListener("pointerdown", function(event) {
|
|
7612
|
+
event.stopPropagation();
|
|
7613
|
+
});
|
|
6728
7614
|
});
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
7615
|
+
actions.append(reset, closeBtn);
|
|
7616
|
+
var grip = document.createElement("span");
|
|
7617
|
+
grip.className = "move-grip";
|
|
7618
|
+
grip.setAttribute("aria-hidden", "true");
|
|
7619
|
+
header.append(grip, controls, actions);
|
|
7620
|
+
header.addEventListener("pointerdown", function(event) {
|
|
7621
|
+
if (event.target.closest("input, button, select, textarea, a, [contenteditable]")) return;
|
|
6733
7622
|
state.avoidMatchRange = null;
|
|
6734
7623
|
if (!event.isPrimary || event.button !== 0 || state.drag || !positionBar()) return;
|
|
6735
|
-
state.suppressMoveClick = false;
|
|
6736
7624
|
try {
|
|
6737
|
-
|
|
7625
|
+
header.setPointerCapture(event.pointerId);
|
|
6738
7626
|
} catch (error) {
|
|
6739
7627
|
return;
|
|
6740
7628
|
}
|
|
6741
7629
|
var box = state.bar.getBoundingClientRect();
|
|
6742
|
-
state.drag = { id: event.pointerId, handle, x: event.clientX, y: event.clientY, left: box.left, top: box.top };
|
|
7630
|
+
state.drag = { id: event.pointerId, handle: header, x: event.clientX, y: event.clientY, left: box.left, top: box.top, moved: false };
|
|
6743
7631
|
event.preventDefault();
|
|
6744
7632
|
});
|
|
6745
|
-
|
|
7633
|
+
header.addEventListener("pointermove", function(event) {
|
|
6746
7634
|
var drag = state.drag;
|
|
6747
7635
|
if (!drag || event.pointerId !== drag.id) return;
|
|
6748
7636
|
var x = event.clientX - drag.x, y = event.clientY - drag.y;
|
|
6749
|
-
if (!
|
|
6750
|
-
|
|
7637
|
+
if (!drag.moved && Math.abs(x) + Math.abs(y) < 4) return;
|
|
7638
|
+
drag.moved = true;
|
|
6751
7639
|
state.bar.setAttribute("data-dragging", "");
|
|
6752
7640
|
state.manualPosition = { left: drag.left + x, top: drag.top + y };
|
|
6753
7641
|
scheduleBarPosition();
|
|
6754
7642
|
});
|
|
6755
7643
|
["pointerup", "pointercancel", "lostpointercapture"].forEach(function(type) {
|
|
6756
|
-
|
|
7644
|
+
header.addEventListener(type, finishBarDrag);
|
|
6757
7645
|
});
|
|
6758
|
-
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
bar.appendChild(moves);
|
|
7646
|
+
header.addEventListener("keydown", function(event) {
|
|
7647
|
+
if (event.target !== event.currentTarget || event.altKey || event.ctrlKey || event.metaKey || event.isComposing) return;
|
|
7648
|
+
if (event.key === " ") {
|
|
7649
|
+
event.preventDefault();
|
|
7650
|
+
return;
|
|
7651
|
+
}
|
|
7652
|
+
var movement = { ArrowLeft: [-32, 0], ArrowRight: [32, 0], ArrowUp: [0, -32], ArrowDown: [0, 32] }[event.key];
|
|
7653
|
+
if (movement) {
|
|
7654
|
+
event.preventDefault();
|
|
7655
|
+
moveBarBy(movement[0], movement[1]);
|
|
7656
|
+
} else if (event.key === "Home") {
|
|
7657
|
+
event.preventDefault();
|
|
7658
|
+
resetBarPosition();
|
|
7659
|
+
}
|
|
7660
|
+
});
|
|
7661
|
+
bar.appendChild(header);
|
|
7662
|
+
return closeBtn;
|
|
6776
7663
|
}
|
|
6777
7664
|
function scheduleBarPosition() {
|
|
6778
7665
|
if (!isOpen() || state.positionFrame !== null) return;
|
|
@@ -6838,20 +7725,26 @@ function updateCount() {
|
|
|
6838
7725
|
var complete = whole ? state.scanComplete : valid;
|
|
6839
7726
|
var searching = whole && valid && wholeAvailable && !state.scanCancelled && (state.paging || state.scanBusy || !state.historySnapshot || state.historySnapshot.status === "reading" || state.historySnapshot.status === "projecting");
|
|
6840
7727
|
var label;
|
|
6841
|
-
if (!state.query) label =
|
|
6842
|
-
else if (!n) label = complete ?
|
|
6843
|
-
else if (state.index < 0) label =
|
|
7728
|
+
if (!state.query) label = L2.countReady;
|
|
7729
|
+
else if (!n) label = complete ? L2.countEmpty : searching ? L2.countSearching : !valid || whole && !wholeAvailable ? L2.countUnavailable : L2.countIncomplete;
|
|
7730
|
+
else if (state.index < 0) label = L2.resultCount.replace("{n}", String(total) + suffix);
|
|
6844
7731
|
else label = state.index + 1 + "/" + total + suffix;
|
|
6845
|
-
var cap = state.capped ?
|
|
7732
|
+
var cap = state.capped ? L2.cap.replace("{n}", String(MAX_MATCHES)) : "";
|
|
6846
7733
|
state.count.textContent = label;
|
|
6847
7734
|
state.count.title = label + (cap ? "; " + cap : "");
|
|
6848
|
-
state.count.setAttribute("aria-label", state.count.title + "; " +
|
|
7735
|
+
state.count.setAttribute("aria-label", state.count.title + "; " + L2.jumpNumber);
|
|
6849
7736
|
state.count.setAttribute("aria-disabled", String(!available));
|
|
6850
7737
|
if (state.countEdit && !available) cancelCountEdit(false);
|
|
6851
7738
|
state.count.hidden = !available || !!state.countEdit;
|
|
6852
7739
|
state.countState.hidden = available;
|
|
6853
7740
|
state.countState.textContent = label;
|
|
6854
7741
|
state.countState.title = label;
|
|
7742
|
+
if (state.crossSearchReturn) {
|
|
7743
|
+
var fromSearch = state.crossSearch && state.crossSearch.id === state.target?.id;
|
|
7744
|
+
state.crossSearchReturn.hidden = !fromSearch;
|
|
7745
|
+
state.crossSearchHint.hidden = !fromSearch;
|
|
7746
|
+
state.crossSearchHint.textContent = fromSearch && complete && !n ? ZH ? "\u6B64\u4F1A\u8BDD\u7684\u5F53\u524D\u641C\u7D22\u8303\u56F4\u5185\u672A\u627E\u5230\u8BE5\u5173\u952E\u8BCD\uFF1B\u8DE8\u5BF9\u8BDD\u5339\u914D\u89C4\u5219\u53EF\u80FD\u4E0D\u540C\u3002\u53EF\u8FD4\u56DE\u641C\u7D22\u7ED3\u679C\u3002" : "No match in this conversation\u2019s current search scope. Cross-conversation matching differs; you can return to the results." : ZH ? "\u6B63\u5728\u6B64\u5BF9\u8BDD\u5185\u67E5\u627E\u3002" : "Finding in this conversation.";
|
|
7747
|
+
}
|
|
6855
7748
|
var announcement = !state.query || available || complete ? label : "";
|
|
6856
7749
|
if (state.countLive && state.countLive.textContent !== announcement) state.countLive.textContent = announcement;
|
|
6857
7750
|
if (state.countEdit) {
|
|
@@ -6862,8 +7755,8 @@ function updateCount() {
|
|
|
6862
7755
|
function updateCountHint() {
|
|
6863
7756
|
if (!state.countEdit) return;
|
|
6864
7757
|
var invalid = state.countInput.getAttribute("aria-invalid") === "true";
|
|
6865
|
-
state.countHint.textContent = (invalid ?
|
|
6866
|
-
if (state.capped) state.countHint.textContent += " " +
|
|
7758
|
+
state.countHint.textContent = (invalid ? L2.jumpInvalid : L2.jumpRange).replace("{n}", String(resultLength()));
|
|
7759
|
+
if (state.capped) state.countHint.textContent += " " + L2.cap.replace("{n}", String(resultLength()));
|
|
6867
7760
|
}
|
|
6868
7761
|
function cancelCountEdit(restoreFocus) {
|
|
6869
7762
|
if (!state.countEdit) return;
|
|
@@ -6878,7 +7771,7 @@ function beginCountEdit() {
|
|
|
6878
7771
|
if (state.scope === "page" && state.observer?.takeRecords().length) scheduleRescan();
|
|
6879
7772
|
if (state.scope === "page" && state.pageDirty) runSearch(true);
|
|
6880
7773
|
if (!resultLength() || !state.adapter?.valid(state.target)) return;
|
|
6881
|
-
cancelReturn(
|
|
7774
|
+
cancelReturn(L2.returnCancelled);
|
|
6882
7775
|
cancelNavigation();
|
|
6883
7776
|
closeContentPanel();
|
|
6884
7777
|
state.countEdit = { target: state.target, query: state.query, scope: state.scope, revision: state.resultsRevision, composing: false };
|
|
@@ -6938,7 +7831,7 @@ function setStatus(text, busy) {
|
|
|
6938
7831
|
if (!state.status) return;
|
|
6939
7832
|
state.jumpStatus = null;
|
|
6940
7833
|
state.status.textContent = text || "";
|
|
6941
|
-
state.status.title = busy ?
|
|
7834
|
+
state.status.title = busy ? L2.stopTip : text || "";
|
|
6942
7835
|
if (busy) state.status.setAttribute("data-busy", "1");
|
|
6943
7836
|
else state.status.removeAttribute("data-busy");
|
|
6944
7837
|
updateCount();
|
|
@@ -6949,7 +7842,7 @@ function updateScopeButton() {
|
|
|
6949
7842
|
state.scopeInputs.page.checked = state.scope === "page";
|
|
6950
7843
|
if (state.refreshBtn) {
|
|
6951
7844
|
state.refreshBtn.disabled = state.scope !== "whole";
|
|
6952
|
-
state.refreshBtn.title = state.scope === "whole" ?
|
|
7845
|
+
state.refreshBtn.title = state.scope === "whole" ? L2.refreshHistory : L2.refreshUnavailable;
|
|
6953
7846
|
}
|
|
6954
7847
|
updateContentButton();
|
|
6955
7848
|
}
|
|
@@ -6967,7 +7860,7 @@ function updateContentButton() {
|
|
|
6967
7860
|
if (!state.contentBtn) return;
|
|
6968
7861
|
var count = selectedContentCount();
|
|
6969
7862
|
var changed = state.scope !== "whole" || !contentSelectionIsDefault();
|
|
6970
|
-
var label =
|
|
7863
|
+
var label = L2.contentButtonLabel.replace("{n}", String(count)).replace("{scope}", state.scope === "whole" ? L2.scopeWhole : L2.scopePage).replace("{changed}", changed ? L2.optionsChanged : "");
|
|
6971
7864
|
state.contentBtn.setAttribute("aria-label", label);
|
|
6972
7865
|
state.contentBtn.title = label;
|
|
6973
7866
|
if (!changed) state.contentBtn.removeAttribute("data-filtered");
|
|
@@ -7019,9 +7912,9 @@ function closeContentPanel(restoreFocus) {
|
|
|
7019
7912
|
function renderUpdateCheck() {
|
|
7020
7913
|
if (!state.updateBtn) return;
|
|
7021
7914
|
state.updateBtn.setAttribute("aria-disabled", state.updateTask ? "true" : "false");
|
|
7022
|
-
if (state.updateBtn.textContent !==
|
|
7915
|
+
if (state.updateBtn.textContent !== L2.checkUpdate) state.updateBtn.textContent = L2.checkUpdate;
|
|
7023
7916
|
var result = state.updateResult;
|
|
7024
|
-
var message = state.updateTask ?
|
|
7917
|
+
var message = state.updateTask ? L2.checkingUpdate : !result ? "" : result.status === "available" ? L2.updateAvailable.replace("{v}", result.version) : result.status === "current" ? L2.updateCurrent : result.status === "ahead" ? L2.updateAhead.replace("{v}", result.version) : L2.updateFailed;
|
|
7025
7918
|
if (state.updateStatus.textContent !== message) state.updateStatus.textContent = message;
|
|
7026
7919
|
state.updateGuide.hidden = !result || result.status !== "available" || !!state.updateTask;
|
|
7027
7920
|
}
|
|
@@ -7041,7 +7934,7 @@ async function checkForUpdates() {
|
|
|
7041
7934
|
state.updateResult = null;
|
|
7042
7935
|
renderUpdateCheck();
|
|
7043
7936
|
try {
|
|
7044
|
-
var result = await checkLatestVersion("0.1.
|
|
7937
|
+
var result = await checkLatestVersion("0.1.13", task.signal);
|
|
7045
7938
|
if (state.mounted && state.updateTask === task) state.updateResult = result;
|
|
7046
7939
|
} catch (error) {
|
|
7047
7940
|
if (state.mounted && state.updateTask === task) state.updateResult = { status: "failed" };
|
|
@@ -7066,7 +7959,7 @@ function openAbout() {
|
|
|
7066
7959
|
var owner = state.target && state.aboutViews.get(state.target.anchor);
|
|
7067
7960
|
if (!state.aboutAvailable || !owner || state.aboutOwner || !state.mounted) return;
|
|
7068
7961
|
cancelCountEdit(false);
|
|
7069
|
-
cancelReturn(
|
|
7962
|
+
cancelReturn(L2.returnCancelled);
|
|
7070
7963
|
cancelNavigation();
|
|
7071
7964
|
closeContentPanel(true);
|
|
7072
7965
|
state.aboutOwner = owner;
|
|
@@ -7137,7 +8030,7 @@ function loadedContentType(node, store) {
|
|
|
7137
8030
|
}
|
|
7138
8031
|
function contentSelectionChanged() {
|
|
7139
8032
|
cancelCountEdit(false);
|
|
7140
|
-
cancelReturn(
|
|
8033
|
+
cancelReturn(L2.returnCancelled);
|
|
7141
8034
|
cancelNavigation();
|
|
7142
8035
|
state.selection = null;
|
|
7143
8036
|
state.ranges = [];
|
|
@@ -7148,7 +8041,7 @@ function contentSelectionChanged() {
|
|
|
7148
8041
|
if (state.scope === "whole" && state.query) schedulePageIn();
|
|
7149
8042
|
}
|
|
7150
8043
|
function unavailableStatus() {
|
|
7151
|
-
return state.target || state.adapter && state.adapter.scopeUnavailable() ?
|
|
8044
|
+
return state.target || state.adapter && state.adapter.scopeUnavailable() ? L2.noRoot : L2.noTarget;
|
|
7152
8045
|
}
|
|
7153
8046
|
function selectionBlock(range, root) {
|
|
7154
8047
|
var nearest = null;
|
|
@@ -7271,7 +8164,7 @@ function goTo(delta) {
|
|
|
7271
8164
|
}
|
|
7272
8165
|
function activateMatch(index) {
|
|
7273
8166
|
if (!Number.isInteger(index) || index < 0 || index >= resultLength()) return;
|
|
7274
|
-
cancelReturn(
|
|
8167
|
+
cancelReturn(L2.returnCancelled);
|
|
7275
8168
|
cancelNavigation();
|
|
7276
8169
|
if (!state.adapter?.valid(state.target)) {
|
|
7277
8170
|
runSearch(false);
|
|
@@ -7300,6 +8193,10 @@ function scheduleRescan() {
|
|
|
7300
8193
|
if (state.paging) return;
|
|
7301
8194
|
clearTimeout(state.debounce);
|
|
7302
8195
|
state.debounce = setTimeout(function() {
|
|
8196
|
+
if (state.scope === "page" && state.navigationTimer) {
|
|
8197
|
+
scheduleRescan();
|
|
8198
|
+
return;
|
|
8199
|
+
}
|
|
7303
8200
|
if (isOpen()) runSearch(true);
|
|
7304
8201
|
}, 250);
|
|
7305
8202
|
}
|
|
@@ -7343,6 +8240,20 @@ function schedulePageIn() {
|
|
|
7343
8240
|
startPageIn();
|
|
7344
8241
|
}, 150);
|
|
7345
8242
|
}
|
|
8243
|
+
function searchContentChanged() {
|
|
8244
|
+
cancelPageIn();
|
|
8245
|
+
state.history = null;
|
|
8246
|
+
state.historySnapshot = null;
|
|
8247
|
+
state.scanQuery = null;
|
|
8248
|
+
state.hits = [];
|
|
8249
|
+
state.total = 0;
|
|
8250
|
+
state.ranges = [];
|
|
8251
|
+
state.index = -1;
|
|
8252
|
+
state.sourceNotice = "";
|
|
8253
|
+
paint();
|
|
8254
|
+
updateCount();
|
|
8255
|
+
if (isOpen() && state.scope === "whole" && state.query) schedulePageIn();
|
|
8256
|
+
}
|
|
7346
8257
|
function historyStatus() {
|
|
7347
8258
|
if (state.scope !== "whole" || !state.status) return;
|
|
7348
8259
|
var snapshot = state.historySnapshot;
|
|
@@ -7355,12 +8266,12 @@ function historyStatus() {
|
|
|
7355
8266
|
else if (snapshot.readComplete && snapshot.status === "partial" && !state.scanCancelled && state.scanCursor >= snapshot.documents.length && relevantErrors.length && relevantErrors.every(function(error) {
|
|
7356
8267
|
return error.code === "truncated-tool-output";
|
|
7357
8268
|
})) text = ZH ? "\u90E8\u5206\u5185\u5BB9\u6CA1\u6709\u5B8C\u6574\u4FDD\u5B58\uFF0C\u641C\u7D22\u7ED3\u679C\u53EF\u80FD\u4E0D\u5B8C\u6574\u3002" : "Some content was not saved in full, so results may be incomplete.";
|
|
7358
|
-
else if (!snapshot.readComplete || !projectionComplete || !state.scanComplete) text =
|
|
8269
|
+
else if (!snapshot.readComplete || !projectionComplete || !state.scanComplete) text = L2.incomplete;
|
|
7359
8270
|
else text = "";
|
|
7360
8271
|
function add(part) {
|
|
7361
8272
|
if (part) text += (text ? " \xB7 " : "") + part;
|
|
7362
8273
|
}
|
|
7363
|
-
if (state.capped) add(
|
|
8274
|
+
if (state.capped) add(L2.cap.replace("{n}", String(MAX_MATCHES)));
|
|
7364
8275
|
add(state.sourceNotice);
|
|
7365
8276
|
if (state.liveCount) add((ZH ? "\u5F53\u524D\u6B63\u5728\u751F\u6210\u7684\u56DE\u590D\u4E2D\u53E6\u6709 " : "The reply being generated contains ") + state.liveCount + (state.liveCapped ? "+" : "") + (ZH ? " \u4E2A\u5339\u914D\u3002" : " additional matches."));
|
|
7366
8277
|
setStatus(text, state.paging || state.scanBusy);
|
|
@@ -7387,7 +8298,8 @@ function startPageIn() {
|
|
|
7387
8298
|
state.sourceNotice = "";
|
|
7388
8299
|
state.historySnapshot = null;
|
|
7389
8300
|
searchHistory(true);
|
|
7390
|
-
|
|
8301
|
+
var project = state.searchContent ? state.searchContent.createProjector(state.projector) : state.projector;
|
|
8302
|
+
state.history = createHistoryReader({ remote: state.remote, sessionId: target.id, generation: token, project, onUpdate: function(snapshot) {
|
|
7391
8303
|
if (token !== state.pageToken || state.target !== target || !isOpen() || state.scope !== "whole" || !state.adapter.valid(target)) return;
|
|
7392
8304
|
state.historySnapshot = snapshot;
|
|
7393
8305
|
state.paging = ["reading", "projecting", "idle"].includes(snapshot.status);
|
|
@@ -7506,6 +8418,7 @@ function scanLiveCount() {
|
|
|
7506
8418
|
}
|
|
7507
8419
|
}
|
|
7508
8420
|
function sourceNode(source, store) {
|
|
8421
|
+
if (!store) return null;
|
|
7509
8422
|
var found = store.values().filter(function(node) {
|
|
7510
8423
|
if (source.kind === "user" || source.kind === "context") return node.data?.seq === source.seq;
|
|
7511
8424
|
if (source.callId) return node.kind === "tool-call" && node.data?.root?.callId === (source.rootCallId || source.callId);
|
|
@@ -7569,27 +8482,24 @@ async function navigateHistoryHit(hit) {
|
|
|
7569
8482
|
}
|
|
7570
8483
|
if (!face || typeof face.loadThrough !== "function" || !store) {
|
|
7571
8484
|
if (current()) recordFailure("jump", "unavailable");
|
|
7572
|
-
setStatus(
|
|
8485
|
+
setStatus(L2.matchRevealFailed, false);
|
|
7573
8486
|
return;
|
|
7574
8487
|
}
|
|
7575
8488
|
state.historyNavigating = true;
|
|
7576
8489
|
try {
|
|
7577
8490
|
if (!sourceNode(source, store)) await face.loadThrough(source.seq);
|
|
7578
8491
|
if (!current()) return;
|
|
7579
|
-
var started = Date.now(), mapped, node
|
|
8492
|
+
var started = Date.now(), mapped, node;
|
|
7580
8493
|
while (current() && Date.now() - started < 5e3) {
|
|
8494
|
+
store = state.adapter.nodes(target);
|
|
7581
8495
|
node = sourceNode(source, store);
|
|
7582
8496
|
if (node) {
|
|
7583
|
-
if (!
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
await pause();
|
|
7587
|
-
if (!current()) return;
|
|
7588
|
-
}
|
|
8497
|
+
if (!hostNavigationReady(target, face)) {
|
|
8498
|
+
await pause();
|
|
8499
|
+
continue;
|
|
7589
8500
|
}
|
|
7590
|
-
if (!current()) return;
|
|
7591
8501
|
var rows = sourceRows(target, node);
|
|
7592
|
-
mapped = mapProjectedDocument(source, node, rows);
|
|
8502
|
+
mapped = mapProjectedDocument(source, node, rows, hit.blockIndex);
|
|
7593
8503
|
if (mapped.blocks) {
|
|
7594
8504
|
var range = rangeForBlock(mapped.blocks[hit.blockIndex], hit.start, hit.end);
|
|
7595
8505
|
if (!range || range.toString() !== hit.text) break;
|
|
@@ -7607,14 +8517,14 @@ async function navigateHistoryHit(hit) {
|
|
|
7607
8517
|
if (current()) {
|
|
7608
8518
|
recordFailure("jump", "render");
|
|
7609
8519
|
state.historyNavigating = false;
|
|
7610
|
-
state.sourceNotice =
|
|
8520
|
+
state.sourceNotice = L2.matchRevealFailed;
|
|
7611
8521
|
historyStatus();
|
|
7612
8522
|
}
|
|
7613
8523
|
} catch (error) {
|
|
7614
8524
|
if (current()) {
|
|
7615
8525
|
recordFailure("jump", "error");
|
|
7616
8526
|
state.historyNavigating = false;
|
|
7617
|
-
state.sourceNotice =
|
|
8527
|
+
state.sourceNotice = L2.matchRevealFailed;
|
|
7618
8528
|
historyStatus();
|
|
7619
8529
|
}
|
|
7620
8530
|
}
|
|
@@ -7626,8 +8536,6 @@ function syncTarget(target, passive) {
|
|
|
7626
8536
|
var owner = state.positionOwner;
|
|
7627
8537
|
if (owner && (owner.id !== selected.id || owner.panel !== selected.panel)) {
|
|
7628
8538
|
resetBarPosition();
|
|
7629
|
-
if (state.positionControls) state.positionControls.hidden = true;
|
|
7630
|
-
if (state.dragHandle) state.dragHandle.setAttribute("aria-expanded", "false");
|
|
7631
8539
|
}
|
|
7632
8540
|
state.positionOwner = { id: selected.id, panel: selected.panel };
|
|
7633
8541
|
}
|
|
@@ -7714,7 +8622,7 @@ function button(label, d, onClick) {
|
|
|
7714
8622
|
}
|
|
7715
8623
|
function onQueryInput(input) {
|
|
7716
8624
|
cancelCountEdit(false);
|
|
7717
|
-
cancelReturn(
|
|
8625
|
+
cancelReturn(L2.returnCancelled);
|
|
7718
8626
|
cancelNavigation();
|
|
7719
8627
|
state.query = input.value;
|
|
7720
8628
|
if (state.scope === "whole") {
|
|
@@ -7729,7 +8637,7 @@ function onQueryInput(input) {
|
|
|
7729
8637
|
function setScope(scope) {
|
|
7730
8638
|
if (state.scope === scope) return;
|
|
7731
8639
|
cancelCountEdit(false);
|
|
7732
|
-
cancelReturn(
|
|
8640
|
+
cancelReturn(L2.returnCancelled);
|
|
7733
8641
|
cancelNavigation();
|
|
7734
8642
|
cancelPageIn();
|
|
7735
8643
|
state.scope = scope;
|
|
@@ -7745,15 +8653,17 @@ function buildBar() {
|
|
|
7745
8653
|
var bar = document.createElement("div");
|
|
7746
8654
|
bar.id = BAR_ID;
|
|
7747
8655
|
bar.setAttribute("role", "search");
|
|
8656
|
+
bar.setAttribute("aria-label", L2.findTitle);
|
|
7748
8657
|
var controls = document.createElement("div");
|
|
7749
8658
|
controls.className = "controls";
|
|
8659
|
+
var closeBtn = buildMoveHeader(bar, controls);
|
|
7750
8660
|
var navigation = document.createElement("div");
|
|
7751
8661
|
navigation.className = "navigation-controls";
|
|
7752
8662
|
var input = document.createElement("input");
|
|
7753
8663
|
input.type = "text";
|
|
7754
8664
|
input.className = "query";
|
|
7755
|
-
input.placeholder =
|
|
7756
|
-
input.setAttribute("aria-label",
|
|
8665
|
+
input.placeholder = L2.placeholder;
|
|
8666
|
+
input.setAttribute("aria-label", L2.placeholder);
|
|
7757
8667
|
input.addEventListener("input", function() {
|
|
7758
8668
|
onQueryInput(input);
|
|
7759
8669
|
});
|
|
@@ -7769,13 +8679,13 @@ function buildBar() {
|
|
|
7769
8679
|
contentPanel.className = "content-panel";
|
|
7770
8680
|
contentPanel.hidden = true;
|
|
7771
8681
|
contentPanel.setAttribute("role", "group");
|
|
7772
|
-
contentPanel.setAttribute("aria-label",
|
|
8682
|
+
contentPanel.setAttribute("aria-label", L2.contentButton);
|
|
7773
8683
|
var contentViewport = document.createElement("div");
|
|
7774
8684
|
contentViewport.className = "content-viewport";
|
|
7775
8685
|
var scopeGroup = document.createElement("fieldset");
|
|
7776
8686
|
scopeGroup.className = "scope-group";
|
|
7777
8687
|
var scopeLegend = document.createElement("legend");
|
|
7778
|
-
scopeLegend.textContent =
|
|
8688
|
+
scopeLegend.textContent = L2.scopeLegend;
|
|
7779
8689
|
scopeGroup.appendChild(scopeLegend);
|
|
7780
8690
|
var scopeInputs = {};
|
|
7781
8691
|
["whole", "page"].forEach(function(scope) {
|
|
@@ -7790,7 +8700,7 @@ function buildBar() {
|
|
|
7790
8700
|
if (radio.checked) setScope(scope);
|
|
7791
8701
|
});
|
|
7792
8702
|
var label = document.createElement("span");
|
|
7793
|
-
label.textContent = scope === "whole" ?
|
|
8703
|
+
label.textContent = scope === "whole" ? L2.scopeWhole : L2.scopePage;
|
|
7794
8704
|
option.appendChild(radio);
|
|
7795
8705
|
option.appendChild(label);
|
|
7796
8706
|
scopeGroup.appendChild(option);
|
|
@@ -7799,7 +8709,7 @@ function buildBar() {
|
|
|
7799
8709
|
contentViewport.appendChild(scopeGroup);
|
|
7800
8710
|
var contentGroup = document.createElement("fieldset");
|
|
7801
8711
|
var legend = document.createElement("legend");
|
|
7802
|
-
legend.textContent =
|
|
8712
|
+
legend.textContent = L2.contentLegend;
|
|
7803
8713
|
contentGroup.appendChild(legend);
|
|
7804
8714
|
var contentOptions = document.createElement("div");
|
|
7805
8715
|
contentOptions.className = "content-options";
|
|
@@ -7817,7 +8727,7 @@ function buildBar() {
|
|
|
7817
8727
|
contentSelectionChanged();
|
|
7818
8728
|
});
|
|
7819
8729
|
var label = document.createElement("span");
|
|
7820
|
-
label.textContent =
|
|
8730
|
+
label.textContent = L2.contentTypes[type];
|
|
7821
8731
|
option.appendChild(checkbox);
|
|
7822
8732
|
option.appendChild(label);
|
|
7823
8733
|
contentOptions.appendChild(option);
|
|
@@ -7828,7 +8738,7 @@ function buildBar() {
|
|
|
7828
8738
|
var resetContent = document.createElement("button");
|
|
7829
8739
|
resetContent.type = "button";
|
|
7830
8740
|
resetContent.className = "content-reset";
|
|
7831
|
-
resetContent.textContent =
|
|
8741
|
+
resetContent.textContent = L2.contentReset;
|
|
7832
8742
|
resetContent.addEventListener("click", function() {
|
|
7833
8743
|
CONTENT_TYPES.forEach(function(type) {
|
|
7834
8744
|
state.contentTypes[type] = DEFAULT_CONTENT_TYPES[type];
|
|
@@ -7855,7 +8765,7 @@ function buildBar() {
|
|
|
7855
8765
|
countInput.type = "text";
|
|
7856
8766
|
countInput.inputMode = "numeric";
|
|
7857
8767
|
countInput.autocomplete = "off";
|
|
7858
|
-
countInput.setAttribute("aria-label",
|
|
8768
|
+
countInput.setAttribute("aria-label", L2.jumpNumber);
|
|
7859
8769
|
countInput.setAttribute("aria-describedby", BAR_ID + "-count-hint");
|
|
7860
8770
|
countInput.addEventListener("input", function() {
|
|
7861
8771
|
countInput.removeAttribute("aria-invalid");
|
|
@@ -7895,18 +8805,17 @@ function buildBar() {
|
|
|
7895
8805
|
status.setAttribute("role", "status");
|
|
7896
8806
|
status.setAttribute("aria-live", "polite");
|
|
7897
8807
|
status.setAttribute("aria-atomic", "true");
|
|
7898
|
-
status.title =
|
|
8808
|
+
status.title = L2.stopTip;
|
|
7899
8809
|
status.addEventListener("click", function() {
|
|
7900
8810
|
if (!state.paging && !state.scanBusy) return;
|
|
7901
8811
|
cancelPageIn();
|
|
7902
|
-
setStatus(
|
|
8812
|
+
setStatus(L2.incomplete, false);
|
|
7903
8813
|
});
|
|
7904
|
-
buildPositionControls(controls, bar);
|
|
7905
8814
|
controls.appendChild(input);
|
|
7906
8815
|
controls.appendChild(countState);
|
|
7907
8816
|
controls.appendChild(count);
|
|
7908
8817
|
controls.appendChild(countEditor);
|
|
7909
|
-
var refreshBtn = button(
|
|
8818
|
+
var refreshBtn = button(L2.refreshHistory, "M20 7v5h-5M4 17v-5h5M6 8a7 7 0 0 1 12-2l2 3M4 15l2 3a7 7 0 0 0 12-2", function() {
|
|
7910
8819
|
if (state.scope !== "whole") return;
|
|
7911
8820
|
closeContentPanel(true);
|
|
7912
8821
|
cancelPageIn();
|
|
@@ -7917,25 +8826,35 @@ function buildBar() {
|
|
|
7917
8826
|
startPageIn();
|
|
7918
8827
|
});
|
|
7919
8828
|
var refreshLabel = document.createElement("span");
|
|
7920
|
-
refreshLabel.textContent =
|
|
8829
|
+
refreshLabel.textContent = L2.refreshHistory;
|
|
7921
8830
|
refreshBtn.appendChild(refreshLabel);
|
|
7922
8831
|
var historyCommand = document.createElement("div");
|
|
7923
8832
|
historyCommand.className = "history-command";
|
|
7924
8833
|
historyCommand.appendChild(refreshBtn);
|
|
7925
8834
|
contentViewport.appendChild(historyCommand);
|
|
8835
|
+
var searchCommand = document.createElement("div");
|
|
8836
|
+
searchCommand.className = "history-command";
|
|
8837
|
+
var searchConversations = document.createElement("button");
|
|
8838
|
+
searchConversations.type = "button";
|
|
8839
|
+
searchConversations.textContent = ZH ? "\u5BF9\u8BDD\u5168\u6587\u641C\u7D22" : "Full-text conversation search";
|
|
8840
|
+
searchConversations.addEventListener("click", function() {
|
|
8841
|
+
state.conversationSearch?.open(state.query);
|
|
8842
|
+
});
|
|
8843
|
+
searchCommand.appendChild(searchConversations);
|
|
8844
|
+
contentViewport.appendChild(searchCommand);
|
|
7926
8845
|
state.refreshBtn = refreshBtn;
|
|
7927
8846
|
var updateCommand = document.createElement("div");
|
|
7928
8847
|
updateCommand.className = "history-command update-command";
|
|
7929
8848
|
var currentVersion = document.createElement("p");
|
|
7930
8849
|
currentVersion.className = "update-version";
|
|
7931
|
-
currentVersion.textContent =
|
|
8850
|
+
currentVersion.textContent = L2.currentVersion + " 0.1.13";
|
|
7932
8851
|
var updateBtn = document.createElement("button");
|
|
7933
8852
|
updateBtn.type = "button";
|
|
7934
8853
|
updateBtn.className = "check-update";
|
|
7935
8854
|
updateBtn.addEventListener("click", checkForUpdates);
|
|
7936
8855
|
var updateSource = document.createElement("p");
|
|
7937
8856
|
updateSource.className = "feedback-privacy";
|
|
7938
|
-
updateSource.textContent =
|
|
8857
|
+
updateSource.textContent = L2.updateSource;
|
|
7939
8858
|
updateSource.id = BAR_ID + "-update-source";
|
|
7940
8859
|
updateBtn.setAttribute("aria-describedby", updateSource.id);
|
|
7941
8860
|
var updateStatus = document.createElement("p");
|
|
@@ -7944,7 +8863,7 @@ function buildBar() {
|
|
|
7944
8863
|
updateStatus.setAttribute("aria-atomic", "true");
|
|
7945
8864
|
var updateGuide = document.createElement("a");
|
|
7946
8865
|
updateGuide.className = "feedback-issue";
|
|
7947
|
-
updateGuide.textContent =
|
|
8866
|
+
updateGuide.textContent = L2.updateGuide;
|
|
7948
8867
|
updateGuide.href = "https://github.com/Ryuu-64/dsh-find-all#\u66F4\u65B0";
|
|
7949
8868
|
updateGuide.target = "_blank";
|
|
7950
8869
|
updateGuide.rel = "noopener noreferrer";
|
|
@@ -7957,23 +8876,23 @@ function buildBar() {
|
|
|
7957
8876
|
renderUpdateCheck();
|
|
7958
8877
|
var diagnosticCommand = document.createElement("div");
|
|
7959
8878
|
diagnosticCommand.className = "history-command diagnostic-command";
|
|
7960
|
-
var diagnosticBtn = button(
|
|
8879
|
+
var diagnosticBtn = button(L2.copyDiagnostics, "M9 5H5v16h12v-4M9 3h12v12H9z", copyDiagnostics);
|
|
7961
8880
|
var diagnosticLabel = document.createElement("span");
|
|
7962
|
-
diagnosticLabel.textContent =
|
|
8881
|
+
diagnosticLabel.textContent = L2.copyDiagnostics;
|
|
7963
8882
|
diagnosticBtn.appendChild(diagnosticLabel);
|
|
7964
8883
|
var diagnosticFeedback = document.createElement("span");
|
|
7965
8884
|
diagnosticFeedback.className = "diagnostic-feedback";
|
|
7966
8885
|
diagnosticFeedback.setAttribute("role", "status");
|
|
7967
8886
|
var feedbackIssue = document.createElement("a");
|
|
7968
8887
|
feedbackIssue.className = "feedback-issue";
|
|
7969
|
-
feedbackIssue.textContent =
|
|
8888
|
+
feedbackIssue.textContent = L2.feedbackIssue;
|
|
7970
8889
|
feedbackIssue.href = "https://github.com/Ryuu-64/dsh-find-all/issues/new";
|
|
7971
8890
|
feedbackIssue.target = "_blank";
|
|
7972
8891
|
feedbackIssue.rel = "noopener noreferrer";
|
|
7973
8892
|
feedbackIssue.appendChild(icon("M14 3h7v7M21 3l-9 9M10 5H5v14h14v-5", 14));
|
|
7974
8893
|
var feedbackPrivacy = document.createElement("p");
|
|
7975
8894
|
feedbackPrivacy.className = "feedback-privacy";
|
|
7976
|
-
feedbackPrivacy.textContent =
|
|
8895
|
+
feedbackPrivacy.textContent = L2.feedbackPrivacy;
|
|
7977
8896
|
feedbackPrivacy.id = BAR_ID + "-feedback-privacy";
|
|
7978
8897
|
feedbackIssue.setAttribute("aria-describedby", feedbackPrivacy.id);
|
|
7979
8898
|
diagnosticCommand.append(diagnosticBtn, diagnosticFeedback, feedbackIssue, feedbackPrivacy);
|
|
@@ -7982,19 +8901,19 @@ function buildBar() {
|
|
|
7982
8901
|
aboutCommand.className = "history-command";
|
|
7983
8902
|
var aboutBtn = document.createElement("button");
|
|
7984
8903
|
aboutBtn.type = "button";
|
|
7985
|
-
aboutBtn.textContent =
|
|
8904
|
+
aboutBtn.textContent = L2.about;
|
|
7986
8905
|
aboutBtn.disabled = !state.aboutAvailable;
|
|
7987
|
-
if (!state.aboutAvailable) aboutBtn.title =
|
|
8906
|
+
if (!state.aboutAvailable) aboutBtn.title = L2.aboutUnavailable;
|
|
7988
8907
|
aboutBtn.setAttribute("aria-haspopup", "dialog");
|
|
7989
8908
|
aboutBtn.addEventListener("click", openAbout);
|
|
7990
8909
|
aboutCommand.appendChild(aboutBtn);
|
|
7991
8910
|
contentViewport.appendChild(aboutCommand);
|
|
7992
8911
|
state.diagnosticBtn = diagnosticBtn;
|
|
7993
8912
|
state.diagnosticFeedback = diagnosticFeedback;
|
|
7994
|
-
navigation.appendChild(button(
|
|
8913
|
+
navigation.appendChild(button(L2.prev, "m18 15-6-6-6 6", function() {
|
|
7995
8914
|
goTo(-1);
|
|
7996
8915
|
}));
|
|
7997
|
-
navigation.appendChild(button(
|
|
8916
|
+
navigation.appendChild(button(L2.next, "m6 9 6 6 6-6", function() {
|
|
7998
8917
|
goTo(1);
|
|
7999
8918
|
}));
|
|
8000
8919
|
var returnBtn = document.createElement("button");
|
|
@@ -8009,8 +8928,6 @@ function buildBar() {
|
|
|
8009
8928
|
state.returnBtn = returnBtn;
|
|
8010
8929
|
navigation.appendChild(returnBtn);
|
|
8011
8930
|
navigation.appendChild(contentBtn);
|
|
8012
|
-
var closeBtn = button(L.close, "M18 6 6 18M6 6l12 12", close);
|
|
8013
|
-
navigation.appendChild(closeBtn);
|
|
8014
8931
|
contentPanel.addEventListener("keydown", function(event) {
|
|
8015
8932
|
if (event.key !== "Tab") return;
|
|
8016
8933
|
if (event.shiftKey && event.target === scopeInputs[state.scope]) {
|
|
@@ -8023,10 +8940,23 @@ function buildBar() {
|
|
|
8023
8940
|
}
|
|
8024
8941
|
});
|
|
8025
8942
|
controls.appendChild(navigation);
|
|
8026
|
-
bar.insertBefore(controls, bar.firstChild);
|
|
8027
8943
|
bar.appendChild(countHint);
|
|
8028
8944
|
bar.appendChild(status);
|
|
8029
8945
|
bar.appendChild(countLive);
|
|
8946
|
+
var searchReturn = document.createElement("button");
|
|
8947
|
+
searchReturn.type = "button";
|
|
8948
|
+
searchReturn.hidden = true;
|
|
8949
|
+
searchReturn.textContent = ZH ? "\u8FD4\u56DE\u641C\u7D22\u7ED3\u679C" : "Back to search results";
|
|
8950
|
+
searchReturn.style.cssText = "align-self:flex-start;background:transparent;color:inherit;border:0;text-decoration:underline;cursor:pointer;font-size:12px";
|
|
8951
|
+
searchReturn.addEventListener("click", function() {
|
|
8952
|
+
state.conversationSearch?.open();
|
|
8953
|
+
});
|
|
8954
|
+
var searchHint = document.createElement("span");
|
|
8955
|
+
searchHint.hidden = true;
|
|
8956
|
+
searchHint.style.cssText = "font-size:12px;white-space:normal;max-width:420px";
|
|
8957
|
+
state.crossSearchReturn = searchReturn;
|
|
8958
|
+
state.crossSearchHint = searchHint;
|
|
8959
|
+
bar.append(searchHint, searchReturn);
|
|
8030
8960
|
state.bar = bar;
|
|
8031
8961
|
state.input = input;
|
|
8032
8962
|
state.count = count;
|
|
@@ -8047,7 +8977,7 @@ function buildBar() {
|
|
|
8047
8977
|
state.announcement = announcement;
|
|
8048
8978
|
document.body.appendChild(announcement);
|
|
8049
8979
|
}
|
|
8050
|
-
function open(target) {
|
|
8980
|
+
function open(target, seed) {
|
|
8051
8981
|
if (typeof document === "undefined" || document.body === null) return;
|
|
8052
8982
|
var wasOpen = isOpen();
|
|
8053
8983
|
syncTarget(target || document.activeElement, false);
|
|
@@ -8062,7 +8992,8 @@ function open(target) {
|
|
|
8062
8992
|
selection = String(window.getSelection()).trim();
|
|
8063
8993
|
} catch (error) {
|
|
8064
8994
|
}
|
|
8065
|
-
if (
|
|
8995
|
+
if (typeof seed === "string") state.query = seed;
|
|
8996
|
+
if (typeof seed !== "string" && state.target && selection && selection.length <= 200 && selection !== state.query) {
|
|
8066
8997
|
state.query = selection;
|
|
8067
8998
|
}
|
|
8068
8999
|
state.input.value = state.query;
|
|
@@ -8070,13 +9001,15 @@ function open(target) {
|
|
|
8070
9001
|
state.input.select();
|
|
8071
9002
|
runSearch(false);
|
|
8072
9003
|
if (!state.query && state.target && state.adapter && state.adapter.valid(state.target) && !state.origin) {
|
|
8073
|
-
setStatus(
|
|
9004
|
+
setStatus(L2.originUnavailable, false);
|
|
8074
9005
|
}
|
|
8075
9006
|
startObserver();
|
|
8076
9007
|
watchSession();
|
|
8077
9008
|
if (state.scope === "whole" && state.query) schedulePageIn();
|
|
8078
9009
|
}
|
|
8079
9010
|
function close() {
|
|
9011
|
+
state.conversationSearch?.cancelHandoff();
|
|
9012
|
+
state.crossSearch = null;
|
|
8080
9013
|
cancelUpdateCheck();
|
|
8081
9014
|
closeAbout();
|
|
8082
9015
|
cancelCountEdit(false);
|
|
@@ -8087,9 +9020,6 @@ function close() {
|
|
|
8087
9020
|
stopWatchingSession();
|
|
8088
9021
|
stopBarPositioning();
|
|
8089
9022
|
state.manualPosition = state.positionOwner = null;
|
|
8090
|
-
state.suppressMoveClick = false;
|
|
8091
|
-
if (state.positionControls) state.positionControls.hidden = true;
|
|
8092
|
-
if (state.dragHandle) state.dragHandle.setAttribute("aria-expanded", "false");
|
|
8093
9023
|
if (state.bar) {
|
|
8094
9024
|
state.bar.style.display = "none";
|
|
8095
9025
|
state.bar.removeAttribute("data-positioned");
|
|
@@ -8114,6 +9044,8 @@ function apply(ctx) {
|
|
|
8114
9044
|
state.aboutAvailable = !!ui.Modal;
|
|
8115
9045
|
var SearchIcon = ui.IconSearchOutlineRegular || ui.IconSearchOutline16;
|
|
8116
9046
|
state.ctx = ctx;
|
|
9047
|
+
state.searchContent = createSearchContentService(searchContentChanged);
|
|
9048
|
+
if (typeof ctx.provide === "function") ctx.provide(SEARCH_CONTENT_SERVICE, state.searchContent);
|
|
8117
9049
|
state.writeClipboard = typeof ui.writeClipboard === "function" ? ui.writeClipboard : null;
|
|
8118
9050
|
if (typeof ctx.inject === "function") ctx.inject(["remote", "remote.session"], function(remoteCtx) {
|
|
8119
9051
|
remoteCtx.effect(function() {
|
|
@@ -8134,7 +9066,7 @@ function apply(ctx) {
|
|
|
8134
9066
|
state.ranges = [];
|
|
8135
9067
|
state.index = -1;
|
|
8136
9068
|
paint();
|
|
8137
|
-
if (isOpen()) setStatus(
|
|
9069
|
+
if (isOpen()) setStatus(L2.noService, false);
|
|
8138
9070
|
}
|
|
8139
9071
|
};
|
|
8140
9072
|
});
|
|
@@ -8147,6 +9079,17 @@ function apply(ctx) {
|
|
|
8147
9079
|
state.adapter = createHostAdapter(ctx, function() {
|
|
8148
9080
|
if (isOpen()) syncTarget(null, true);
|
|
8149
9081
|
});
|
|
9082
|
+
if (typeof ctx.inject === "function") state.conversationSearch = installConversationSearch(ctx, react, ui, {
|
|
9083
|
+
closeFind: close,
|
|
9084
|
+
openFind: function(sessionId, query) {
|
|
9085
|
+
if (!state.mounted || !state.adapter) return false;
|
|
9086
|
+
var target = state.adapter.forSession(sessionId);
|
|
9087
|
+
if (!target || !state.adapter.valid(target)) return false;
|
|
9088
|
+
state.crossSearch = { id: sessionId, query };
|
|
9089
|
+
open(target.anchor, query);
|
|
9090
|
+
return state.target?.id === sessionId;
|
|
9091
|
+
}
|
|
9092
|
+
});
|
|
8150
9093
|
function AboutPanel() {
|
|
8151
9094
|
var copy = react.useState(""), copyStatus = copy[0], setCopyStatus = copy[1];
|
|
8152
9095
|
var details = react.useRef(null);
|
|
@@ -8219,39 +9162,39 @@ function apply(ctx) {
|
|
|
8219
9162
|
open: true,
|
|
8220
9163
|
onClose: requestClose,
|
|
8221
9164
|
title: "dsh-find-all",
|
|
8222
|
-
closeLabel:
|
|
8223
|
-
description:
|
|
9165
|
+
closeLabel: L2.aboutClose,
|
|
9166
|
+
description: L2.aboutDescription,
|
|
8224
9167
|
className: "dsh-find-all-about",
|
|
8225
9168
|
contentClassName: "dsh-find-all-about-content"
|
|
8226
9169
|
}, react.createElement(
|
|
8227
9170
|
"div",
|
|
8228
9171
|
{ ref: details, className: "dsh-find-all-about-details" },
|
|
8229
|
-
react.createElement("p", null,
|
|
9172
|
+
react.createElement("p", null, L2.aboutAuthor + ": ", link("Ryuu-64", "https://github.com/Ryuu-64")),
|
|
8230
9173
|
react.createElement(
|
|
8231
9174
|
"section",
|
|
8232
9175
|
null,
|
|
8233
|
-
react.createElement("h3", null,
|
|
8234
|
-
react.createElement("div", { className: "dsh-find-all-about-links" }, link(
|
|
8235
|
-
react.createElement("p", { className: "dsh-find-all-about-status" },
|
|
9176
|
+
react.createElement("h3", null, L2.aboutSupport),
|
|
9177
|
+
react.createElement("div", { className: "dsh-find-all-about-links" }, link(L2.feedbackIssue, repository + "/issues/new"), link(L2.aboutRepository, repository)),
|
|
9178
|
+
react.createElement("p", { className: "dsh-find-all-about-status" }, L2.feedbackPrivacy),
|
|
8236
9179
|
react.createElement(
|
|
8237
9180
|
"div",
|
|
8238
9181
|
{ className: "dsh-find-all-about-group" },
|
|
8239
|
-
react.createElement("span", null,
|
|
8240
|
-
react.createElement(ui.Button, { type: "button", size: "sm", variant: "ghost", disabled: copyStatus === "pending", onClick: copyGroup },
|
|
9182
|
+
react.createElement("span", null, L2.aboutGroup + ": 1129212995"),
|
|
9183
|
+
react.createElement(ui.Button, { type: "button", size: "sm", variant: "ghost", disabled: copyStatus === "pending", onClick: copyGroup }, L2.aboutCopy)
|
|
8241
9184
|
),
|
|
8242
|
-
react.createElement("p", { role: "status", className: "dsh-find-all-about-status" }, copyStatus === "pending" ?
|
|
9185
|
+
react.createElement("p", { role: "status", className: "dsh-find-all-about-status" }, copyStatus === "pending" ? L2.aboutCopying : copyStatus === "copied" ? L2.aboutCopied : copyStatus === "failed" ? L2.aboutCopyFailed : "")
|
|
8243
9186
|
),
|
|
8244
9187
|
react.createElement(
|
|
8245
9188
|
"section",
|
|
8246
9189
|
null,
|
|
8247
|
-
react.createElement("h3", null,
|
|
8248
|
-
react.createElement("p", null,
|
|
9190
|
+
react.createElement("h3", null, L2.aboutCredits),
|
|
9191
|
+
react.createElement("p", null, L2.aboutUpstream),
|
|
8249
9192
|
react.createElement(
|
|
8250
9193
|
"div",
|
|
8251
9194
|
{ className: "dsh-find-all-about-links" },
|
|
8252
9195
|
link("secyborg/dsh-find-bar", "https://github.com/secyborg/dsh-find-bar"),
|
|
8253
9196
|
link("MIT", repository + "/blob/main/LICENSE"),
|
|
8254
|
-
link(
|
|
9197
|
+
link(L2.aboutNotices, repository + "/blob/main/NOTICE.md")
|
|
8255
9198
|
)
|
|
8256
9199
|
)
|
|
8257
9200
|
));
|
|
@@ -8284,8 +9227,8 @@ function apply(ctx) {
|
|
|
8284
9227
|
type: "button",
|
|
8285
9228
|
size: "sm",
|
|
8286
9229
|
variant: "ghost",
|
|
8287
|
-
title:
|
|
8288
|
-
"aria-label":
|
|
9230
|
+
title: L2.find,
|
|
9231
|
+
"aria-label": L2.find,
|
|
8289
9232
|
style: { flex: "none", width: 28, padding: 0, color: "var(--dsw-alias-label-secondary)" },
|
|
8290
9233
|
"data-find-all-session": props.sessionId,
|
|
8291
9234
|
onClick: function(event) {
|
|
@@ -8310,7 +9253,7 @@ function apply(ctx) {
|
|
|
8310
9253
|
goTo,
|
|
8311
9254
|
isOpen,
|
|
8312
9255
|
ownsKeys: function(event) {
|
|
8313
|
-
if (state.aboutOwner) return false;
|
|
9256
|
+
if (state.aboutOwner || state.conversationSearch?.isOpen()) return false;
|
|
8314
9257
|
var path = typeof event.composedPath === "function" ? event.composedPath() : [event.target];
|
|
8315
9258
|
return !path.some(function(node) {
|
|
8316
9259
|
return node && node.closest && node.closest('dialog[open], [aria-modal="true"], .monaco-editor, .cm-editor, .CodeMirror');
|
|
@@ -8321,7 +9264,7 @@ function apply(ctx) {
|
|
|
8321
9264
|
}
|
|
8322
9265
|
});
|
|
8323
9266
|
function focus(event) {
|
|
8324
|
-
if (state.aboutOwner) return;
|
|
9267
|
+
if (state.aboutOwner || state.conversationSearch?.isOpen()) return;
|
|
8325
9268
|
if (state.countEdit && !state.countEditor.contains(event.target)) cancelCountEdit(false);
|
|
8326
9269
|
var inContent = state.contentPanel && state.contentPanel.contains(event.target);
|
|
8327
9270
|
if (!inContent && !state.contentBtn?.contains(event.target)) closeContentPanel();
|
|
@@ -8336,7 +9279,7 @@ function apply(ctx) {
|
|
|
8336
9279
|
if (!viewport || !viewport.scroll.contains(event.target)) return;
|
|
8337
9280
|
if (event.type === "keydown" && !/^(ArrowUp|ArrowDown|PageUp|PageDown|Home|End| )$/.test(event.key)) return;
|
|
8338
9281
|
if (event.target.closest('input, textarea, [contenteditable="true"]')) return;
|
|
8339
|
-
cancelReturn(
|
|
9282
|
+
cancelReturn(L2.returnCancelled);
|
|
8340
9283
|
cancelNavigation();
|
|
8341
9284
|
}
|
|
8342
9285
|
["wheel", "touchstart", "pointerdown", "keydown"].forEach(function(type) {
|
|
@@ -8373,15 +9316,16 @@ function apply(ctx) {
|
|
|
8373
9316
|
if (state.bar) state.bar.remove();
|
|
8374
9317
|
if (state.contentPanel) state.contentPanel.remove();
|
|
8375
9318
|
if (state.announcement) state.announcement.remove();
|
|
8376
|
-
state.announcement = state.returnBtn =
|
|
9319
|
+
state.announcement = state.returnBtn = null;
|
|
8377
9320
|
state.diagnosticBtn = state.diagnosticFeedback = state.writeClipboard = null;
|
|
8378
9321
|
state.updateBtn = state.updateStatus = state.updateGuide = state.updateResult = null;
|
|
8379
9322
|
var style = document.querySelector('style[data-plugin-css="dsh-find-all/bar.css"]');
|
|
8380
9323
|
if (style) style.remove();
|
|
8381
9324
|
state.countState = state.countEditor = state.countInput = state.countTotal = state.countHint = state.countLive = null;
|
|
8382
9325
|
state.bar = state.input = state.count = state.status = state.scopeInputs = state.contentBtn = state.contentPanel = state.contentInputs = null;
|
|
9326
|
+
state.conversationSearch = state.crossSearch = state.crossSearchReturn = state.crossSearchHint = null;
|
|
8383
9327
|
state.adapter.clear();
|
|
8384
|
-
state.target = state.ctx = state.remote = state.history = state.historySnapshot = state.projector = null;
|
|
9328
|
+
state.target = state.ctx = state.remote = state.history = state.historySnapshot = state.projector = state.searchContent = null;
|
|
8385
9329
|
};
|
|
8386
9330
|
}, "find-all: browser lifecycle");
|
|
8387
9331
|
}
|