openchrome-mcp 1.2.2 → 1.2.4
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/README.md +11 -4
- package/dist/cdp/client.d.ts +2 -2
- package/dist/cdp/client.d.ts.map +1 -1
- package/dist/cdp/client.js +4 -2
- package/dist/cdp/client.js.map +1 -1
- package/dist/cdp/connection-pool.d.ts +2 -2
- package/dist/cdp/connection-pool.d.ts.map +1 -1
- package/dist/cdp/connection-pool.js +2 -1
- package/dist/cdp/connection-pool.js.map +1 -1
- package/dist/cdp/screenshot-scheduler.d.ts.map +1 -1
- package/dist/cdp/screenshot-scheduler.js +2 -1
- package/dist/cdp/screenshot-scheduler.js.map +1 -1
- package/dist/chrome/launcher.d.ts.map +1 -1
- package/dist/chrome/launcher.js +2 -1
- package/dist/chrome/launcher.js.map +1 -1
- package/dist/config/defaults.d.ts +24 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +24 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/dom/dom-serializer.d.ts.map +1 -1
- package/dist/dom/dom-serializer.js +10 -5
- package/dist/dom/dom-serializer.js.map +1 -1
- package/dist/hints/hint-engine.d.ts +1 -0
- package/dist/hints/hint-engine.d.ts.map +1 -1
- package/dist/hints/hint-engine.js +30 -6
- package/dist/hints/hint-engine.js.map +1 -1
- package/dist/hints/rules/composite-suggestions.d.ts.map +1 -1
- package/dist/hints/rules/composite-suggestions.js +37 -0
- package/dist/hints/rules/composite-suggestions.js.map +1 -1
- package/dist/hints/rules/error-recovery.d.ts.map +1 -1
- package/dist/hints/rules/error-recovery.js +7 -3
- package/dist/hints/rules/error-recovery.js.map +1 -1
- package/dist/hints/rules/pagination-detection.d.ts +7 -0
- package/dist/hints/rules/pagination-detection.d.ts.map +1 -0
- package/dist/hints/rules/pagination-detection.js +220 -0
- package/dist/hints/rules/pagination-detection.js.map +1 -0
- package/dist/hints/rules/repetition-detection.d.ts.map +1 -1
- package/dist/hints/rules/repetition-detection.js +152 -0
- package/dist/hints/rules/repetition-detection.js.map +1 -1
- package/dist/hints/rules/sequence-detection.d.ts.map +1 -1
- package/dist/hints/rules/sequence-detection.js +23 -2
- package/dist/hints/rules/sequence-detection.js.map +1 -1
- package/dist/hints/rules/success-hints.d.ts.map +1 -1
- package/dist/hints/rules/success-hints.js +5 -1
- package/dist/hints/rules/success-hints.js.map +1 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +15 -16
- package/dist/mcp-server.js.map +1 -1
- package/dist/session-manager.d.ts.map +1 -1
- package/dist/session-manager.js +2 -1
- package/dist/session-manager.js.map +1 -1
- package/dist/tools/batch-execute.d.ts.map +1 -1
- package/dist/tools/batch-execute.js +0 -2
- package/dist/tools/batch-execute.js.map +1 -1
- package/dist/tools/batch-paginate.d.ts +10 -0
- package/dist/tools/batch-paginate.d.ts.map +1 -0
- package/dist/tools/batch-paginate.js +419 -0
- package/dist/tools/batch-paginate.js.map +1 -0
- package/dist/tools/click-element.d.ts.map +1 -1
- package/dist/tools/click-element.js +16 -21
- package/dist/tools/click-element.js.map +1 -1
- package/dist/tools/computer.d.ts.map +1 -1
- package/dist/tools/computer.js +232 -61
- package/dist/tools/computer.js.map +1 -1
- package/dist/tools/console-capture.d.ts.map +1 -1
- package/dist/tools/console-capture.js +1 -6
- package/dist/tools/console-capture.js.map +1 -1
- package/dist/tools/cookies.d.ts.map +1 -1
- package/dist/tools/cookies.js +1 -6
- package/dist/tools/cookies.js.map +1 -1
- package/dist/tools/emulate-device.d.ts.map +1 -1
- package/dist/tools/emulate-device.js +1 -3
- package/dist/tools/emulate-device.js.map +1 -1
- package/dist/tools/fill-form.d.ts.map +1 -1
- package/dist/tools/fill-form.js +129 -134
- package/dist/tools/fill-form.js.map +1 -1
- package/dist/tools/form-input.d.ts.map +1 -1
- package/dist/tools/form-input.js +47 -46
- package/dist/tools/form-input.js.map +1 -1
- package/dist/tools/geolocation.d.ts.map +1 -1
- package/dist/tools/geolocation.js +1 -3
- package/dist/tools/geolocation.js.map +1 -1
- package/dist/tools/http-auth.d.ts.map +1 -1
- package/dist/tools/http-auth.js +1 -5
- package/dist/tools/http-auth.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +2 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/javascript.d.ts.map +1 -1
- package/dist/tools/javascript.js +3 -8
- package/dist/tools/javascript.js.map +1 -1
- package/dist/tools/lightweight-scroll.d.ts.map +1 -1
- package/dist/tools/lightweight-scroll.js +1 -5
- package/dist/tools/lightweight-scroll.js.map +1 -1
- package/dist/tools/navigate.d.ts.map +1 -1
- package/dist/tools/navigate.js +5 -7
- package/dist/tools/navigate.js.map +1 -1
- package/dist/tools/network.d.ts.map +1 -1
- package/dist/tools/network.js +1 -4
- package/dist/tools/network.js.map +1 -1
- package/dist/tools/page-reload.d.ts.map +1 -1
- package/dist/tools/page-reload.js +3 -2
- package/dist/tools/page-reload.js.map +1 -1
- package/dist/tools/read-page.d.ts.map +1 -1
- package/dist/tools/read-page.js +41 -6
- package/dist/tools/read-page.js.map +1 -1
- package/dist/tools/request-intercept.d.ts.map +1 -1
- package/dist/tools/request-intercept.js +1 -11
- package/dist/tools/request-intercept.js.map +1 -1
- package/dist/tools/storage.d.ts.map +1 -1
- package/dist/tools/storage.js +1 -7
- package/dist/tools/storage.js.map +1 -1
- package/dist/tools/tabs-close.js +1 -1
- package/dist/tools/tabs-close.js.map +1 -1
- package/dist/tools/tabs-create.js +1 -1
- package/dist/tools/tabs-create.js.map +1 -1
- package/dist/tools/user-agent.d.ts.map +1 -1
- package/dist/tools/user-agent.js +1 -3
- package/dist/tools/user-agent.js.map +1 -1
- package/dist/tools/wait-and-click.d.ts.map +1 -1
- package/dist/tools/wait-and-click.js +5 -10
- package/dist/tools/wait-and-click.js.map +1 -1
- package/dist/tools/wait-for.d.ts.map +1 -1
- package/dist/tools/wait-for.js +1 -7
- package/dist/tools/wait-for.js.map +1 -1
- package/dist/tools/xpath-query.d.ts.map +1 -1
- package/dist/tools/xpath-query.js +1 -6
- package/dist/tools/xpath-query.js.map +1 -1
- package/dist/utils/dom-delta.d.ts +29 -0
- package/dist/utils/dom-delta.d.ts.map +1 -0
- package/dist/utils/dom-delta.js +262 -0
- package/dist/utils/dom-delta.js.map +1 -0
- package/dist/utils/pagination-detector.d.ts +22 -0
- package/dist/utils/pagination-detector.d.ts.map +1 -0
- package/dist/utils/pagination-detector.js +292 -0
- package/dist/utils/pagination-detector.js.map +1 -0
- package/dist/utils/smart-goto.d.ts.map +1 -1
- package/dist/utils/smart-goto.js +2 -1
- package/dist/utils/smart-goto.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM Delta Feedback - Captures what changed in the DOM after an action
|
|
3
|
+
*
|
|
4
|
+
* Injects a MutationObserver before an action, collects mutations after,
|
|
5
|
+
* and formats a compact delta string that tells the LLM what happened
|
|
6
|
+
* without needing a screenshot.
|
|
7
|
+
*/
|
|
8
|
+
import type { Page } from 'puppeteer-core';
|
|
9
|
+
export interface DomDeltaOptions {
|
|
10
|
+
/** Time to wait for DOM to settle after action (ms). Default: 150 */
|
|
11
|
+
settleMs?: number;
|
|
12
|
+
/** Maximum characters for the delta string. Default: 500 */
|
|
13
|
+
maxChars?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface DomDeltaResult<T> {
|
|
16
|
+
result: T;
|
|
17
|
+
delta: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Execute an action while capturing DOM mutations.
|
|
21
|
+
*
|
|
22
|
+
* Injects a MutationObserver before the action, waits for the DOM to settle
|
|
23
|
+
* after the action, then collects and formats the changes.
|
|
24
|
+
*
|
|
25
|
+
* If the action causes a page navigation, the observer is destroyed —
|
|
26
|
+
* we detect this via URL change and report the navigation instead.
|
|
27
|
+
*/
|
|
28
|
+
export declare function withDomDelta<T>(page: Page, action: () => Promise<T>, options?: DomDeltaOptions): Promise<DomDeltaResult<T>>;
|
|
29
|
+
//# sourceMappingURL=dom-delta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom-delta.d.ts","sourceRoot":"","sources":["../../src/utils/dom-delta.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,WAAW,eAAe;IAC9B,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,MAAM,EAAE,CAAC,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACf;AAoMD;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAClC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACxB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CA4E5B"}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* DOM Delta Feedback - Captures what changed in the DOM after an action
|
|
4
|
+
*
|
|
5
|
+
* Injects a MutationObserver before an action, collects mutations after,
|
|
6
|
+
* and formats a compact delta string that tells the LLM what happened
|
|
7
|
+
* without needing a screenshot.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.withDomDelta = withDomDelta;
|
|
11
|
+
// Script injected into the page to set up the MutationObserver
|
|
12
|
+
const INJECT_OBSERVER_SCRIPT = `(() => {
|
|
13
|
+
const delta = {
|
|
14
|
+
preUrl: location.href,
|
|
15
|
+
preTitle: document.title,
|
|
16
|
+
preScroll: { x: window.scrollX, y: window.scrollY },
|
|
17
|
+
mutations: []
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const IGNORE_TAGS = new Set(['SCRIPT', 'STYLE', 'LINK', 'META', 'NOSCRIPT']);
|
|
21
|
+
const MAX_MUTATIONS = 15;
|
|
22
|
+
|
|
23
|
+
const observer = new MutationObserver((records) => {
|
|
24
|
+
if (delta.mutations.length >= MAX_MUTATIONS) return;
|
|
25
|
+
|
|
26
|
+
for (const r of records) {
|
|
27
|
+
if (delta.mutations.length >= MAX_MUTATIONS) break;
|
|
28
|
+
|
|
29
|
+
if (r.type === 'childList') {
|
|
30
|
+
for (const n of r.addedNodes) {
|
|
31
|
+
if (delta.mutations.length >= MAX_MUTATIONS) break;
|
|
32
|
+
if (n.nodeType !== 1) continue;
|
|
33
|
+
const el = n;
|
|
34
|
+
if (IGNORE_TAGS.has(el.tagName)) continue;
|
|
35
|
+
const role = el.getAttribute && el.getAttribute('role');
|
|
36
|
+
const tag = el.tagName.toLowerCase();
|
|
37
|
+
const text = (el.textContent || '').trim().slice(0, 40);
|
|
38
|
+
const label = role ? tag + '[role="' + role + '"]' : tag;
|
|
39
|
+
delta.mutations.push({ type: 'added', label, text });
|
|
40
|
+
}
|
|
41
|
+
for (const n of r.removedNodes) {
|
|
42
|
+
if (delta.mutations.length >= MAX_MUTATIONS) break;
|
|
43
|
+
if (n.nodeType !== 1) continue;
|
|
44
|
+
const el = n;
|
|
45
|
+
if (IGNORE_TAGS.has(el.tagName)) continue;
|
|
46
|
+
const role = el.getAttribute && el.getAttribute('role');
|
|
47
|
+
const tag = el.tagName.toLowerCase();
|
|
48
|
+
const text = (el.textContent || '').trim().slice(0, 40);
|
|
49
|
+
const label = role ? tag + '[role="' + role + '"]' : tag;
|
|
50
|
+
delta.mutations.push({ type: 'removed', label, text });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (r.type === 'attributes') {
|
|
55
|
+
if (delta.mutations.length >= MAX_MUTATIONS) break;
|
|
56
|
+
const el = r.target;
|
|
57
|
+
if (el.nodeType !== 1) continue;
|
|
58
|
+
if (IGNORE_TAGS.has(el.tagName)) continue;
|
|
59
|
+
const attr = r.attributeName;
|
|
60
|
+
const oldVal = r.oldValue;
|
|
61
|
+
const newVal = el.getAttribute(attr);
|
|
62
|
+
if (oldVal === newVal) continue;
|
|
63
|
+
// Skip pure CSS animation class changes
|
|
64
|
+
if (attr === 'class') {
|
|
65
|
+
const oldClasses = new Set((oldVal || '').split(/\\s+/));
|
|
66
|
+
const newClasses = new Set((newVal || '').split(/\\s+/));
|
|
67
|
+
const added = [...newClasses].filter(c => !oldClasses.has(c));
|
|
68
|
+
const removed = [...oldClasses].filter(c => !newClasses.has(c));
|
|
69
|
+
const allChanges = [...added, ...removed];
|
|
70
|
+
const isAnimOnly = allChanges.every(c =>
|
|
71
|
+
/^(animate|fade|slide|transition|entering|leaving|active|ng-|v-)/i.test(c)
|
|
72
|
+
);
|
|
73
|
+
if (isAnimOnly && allChanges.length > 0) continue;
|
|
74
|
+
}
|
|
75
|
+
const tag = el.tagName.toLowerCase();
|
|
76
|
+
const id = el.id ? '#' + el.id : '';
|
|
77
|
+
const label = tag + id;
|
|
78
|
+
const oldStr = oldVal != null ? String(oldVal).slice(0, 30) : 'null';
|
|
79
|
+
const newStr = newVal != null ? String(newVal).slice(0, 30) : 'null';
|
|
80
|
+
delta.mutations.push({ type: 'attribute', label, attr, oldVal: oldStr, newVal: newStr });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Disconnect any previous observer to avoid global collision on concurrent calls
|
|
86
|
+
if (window.__ocObserver) {
|
|
87
|
+
try { window.__ocObserver.disconnect(); } catch(e) {}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
observer.observe(document.body || document.documentElement, {
|
|
91
|
+
childList: true,
|
|
92
|
+
subtree: true,
|
|
93
|
+
attributes: true,
|
|
94
|
+
attributeOldValue: true,
|
|
95
|
+
attributeFilter: ['class', 'style', 'hidden', 'disabled', 'aria-expanded',
|
|
96
|
+
'aria-hidden', 'open', 'checked', 'value', 'src', 'href']
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
window.__ocDelta = delta;
|
|
100
|
+
window.__ocObserver = observer;
|
|
101
|
+
})()`;
|
|
102
|
+
// Script to collect mutations after action
|
|
103
|
+
const COLLECT_DELTA_SCRIPT = `(() => {
|
|
104
|
+
try {
|
|
105
|
+
if (!window.__ocObserver) return null;
|
|
106
|
+
window.__ocObserver.disconnect();
|
|
107
|
+
const d = window.__ocDelta;
|
|
108
|
+
if (!d) return null;
|
|
109
|
+
|
|
110
|
+
const result = {
|
|
111
|
+
urlChanged: location.href !== d.preUrl,
|
|
112
|
+
newUrl: location.href !== d.preUrl ? location.href : null,
|
|
113
|
+
titleChanged: document.title !== d.preTitle,
|
|
114
|
+
newTitle: document.title !== d.preTitle ? document.title : null,
|
|
115
|
+
scrollChanged: window.scrollX !== d.preScroll.x || window.scrollY !== d.preScroll.y,
|
|
116
|
+
scroll: { x: Math.round(window.scrollX), y: Math.round(window.scrollY) },
|
|
117
|
+
preScroll: d.preScroll,
|
|
118
|
+
mutations: d.mutations
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// Cleanup
|
|
122
|
+
delete window.__ocDelta;
|
|
123
|
+
delete window.__ocObserver;
|
|
124
|
+
|
|
125
|
+
return result;
|
|
126
|
+
} catch (e) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
})()`;
|
|
130
|
+
/**
|
|
131
|
+
* Format collected delta into a compact readable string
|
|
132
|
+
*/
|
|
133
|
+
function formatDelta(delta, maxChars) {
|
|
134
|
+
const lines = [];
|
|
135
|
+
// Deduplicate mutations: collapse identical entries
|
|
136
|
+
const seen = new Set();
|
|
137
|
+
const uniqueMutations = delta.mutations.filter(m => {
|
|
138
|
+
const key = `${m.type}|${m.label}|${m.text || ''}|${m.attr || ''}`;
|
|
139
|
+
if (seen.has(key))
|
|
140
|
+
return false;
|
|
141
|
+
seen.add(key);
|
|
142
|
+
return true;
|
|
143
|
+
});
|
|
144
|
+
// Cap at 10 per type
|
|
145
|
+
const added = uniqueMutations.filter(m => m.type === 'added').slice(0, 10);
|
|
146
|
+
const removed = uniqueMutations.filter(m => m.type === 'removed').slice(0, 10);
|
|
147
|
+
const changed = uniqueMutations.filter(m => m.type === 'attribute').slice(0, 10);
|
|
148
|
+
for (const m of added) {
|
|
149
|
+
const text = m.text ? `: "${m.text}"` : '';
|
|
150
|
+
lines.push(`+ ${m.label}${text}`);
|
|
151
|
+
}
|
|
152
|
+
for (const m of removed) {
|
|
153
|
+
const text = m.text ? `: "${m.text}"` : '';
|
|
154
|
+
lines.push(`- ${m.label}${text}`);
|
|
155
|
+
}
|
|
156
|
+
for (const m of changed) {
|
|
157
|
+
lines.push(`~ ${m.label}: ${m.attr} ${m.oldVal}\u2192${m.newVal}`);
|
|
158
|
+
}
|
|
159
|
+
if (delta.urlChanged && delta.newUrl) {
|
|
160
|
+
lines.push(`URL: ${delta.newUrl}`);
|
|
161
|
+
}
|
|
162
|
+
if (delta.titleChanged && delta.newTitle) {
|
|
163
|
+
lines.push(`Title: "${delta.newTitle}"`);
|
|
164
|
+
}
|
|
165
|
+
if (delta.scrollChanged) {
|
|
166
|
+
lines.push(`Scroll: ${delta.preScroll.x},${delta.preScroll.y} \u2192 ${delta.scroll.x},${delta.scroll.y}`);
|
|
167
|
+
}
|
|
168
|
+
if (lines.length === 0)
|
|
169
|
+
return '';
|
|
170
|
+
let result = '\n[DOM Delta]\n' + lines.join('\n');
|
|
171
|
+
if (result.length > maxChars) {
|
|
172
|
+
result = result.slice(0, maxChars - 3) + '...';
|
|
173
|
+
}
|
|
174
|
+
return result;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Execute an action while capturing DOM mutations.
|
|
178
|
+
*
|
|
179
|
+
* Injects a MutationObserver before the action, waits for the DOM to settle
|
|
180
|
+
* after the action, then collects and formats the changes.
|
|
181
|
+
*
|
|
182
|
+
* If the action causes a page navigation, the observer is destroyed —
|
|
183
|
+
* we detect this via URL change and report the navigation instead.
|
|
184
|
+
*/
|
|
185
|
+
async function withDomDelta(page, action, options) {
|
|
186
|
+
const settleMs = options?.settleMs ?? 150;
|
|
187
|
+
const maxChars = options?.maxChars ?? 500;
|
|
188
|
+
let preUrl;
|
|
189
|
+
try {
|
|
190
|
+
preUrl = page.url();
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
preUrl = '';
|
|
194
|
+
}
|
|
195
|
+
// Inject the MutationObserver
|
|
196
|
+
try {
|
|
197
|
+
await page.evaluate(INJECT_OBSERVER_SCRIPT);
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
// If injection fails (e.g., page not ready), just run the action without delta
|
|
201
|
+
const result = await action();
|
|
202
|
+
return { result, delta: '' };
|
|
203
|
+
}
|
|
204
|
+
// Listen for navigation that would destroy the observer
|
|
205
|
+
let navigated = false;
|
|
206
|
+
const onNav = () => { navigated = true; };
|
|
207
|
+
page.on('framenavigated', onNav);
|
|
208
|
+
// Execute the action (try/finally ensures observer cleanup on failure)
|
|
209
|
+
let result;
|
|
210
|
+
try {
|
|
211
|
+
result = await action();
|
|
212
|
+
}
|
|
213
|
+
catch (e) {
|
|
214
|
+
page.off('framenavigated', onNav);
|
|
215
|
+
// Try to disconnect observer on failure
|
|
216
|
+
try {
|
|
217
|
+
await page.evaluate('window.__ocObserver && window.__ocObserver.disconnect()');
|
|
218
|
+
}
|
|
219
|
+
catch { }
|
|
220
|
+
throw e;
|
|
221
|
+
}
|
|
222
|
+
// Wait for DOM to settle
|
|
223
|
+
await new Promise(resolve => setTimeout(resolve, settleMs));
|
|
224
|
+
// Check if navigation occurred (observer would be destroyed)
|
|
225
|
+
let postUrl;
|
|
226
|
+
try {
|
|
227
|
+
postUrl = page.url();
|
|
228
|
+
}
|
|
229
|
+
catch {
|
|
230
|
+
postUrl = '';
|
|
231
|
+
}
|
|
232
|
+
page.off('framenavigated', onNav);
|
|
233
|
+
if (navigated || (postUrl && preUrl && postUrl !== preUrl)) {
|
|
234
|
+
// Page navigated — observer is gone
|
|
235
|
+
let title = '';
|
|
236
|
+
try {
|
|
237
|
+
title = await page.title();
|
|
238
|
+
}
|
|
239
|
+
catch {
|
|
240
|
+
// ignore
|
|
241
|
+
}
|
|
242
|
+
let delta = `\n[Page navigated: ${postUrl}]`;
|
|
243
|
+
if (title) {
|
|
244
|
+
delta += `\n[Title: "${title}"]`;
|
|
245
|
+
}
|
|
246
|
+
return { result, delta };
|
|
247
|
+
}
|
|
248
|
+
// Collect mutations
|
|
249
|
+
try {
|
|
250
|
+
const collected = await page.evaluate(COLLECT_DELTA_SCRIPT);
|
|
251
|
+
if (!collected) {
|
|
252
|
+
return { result, delta: '' };
|
|
253
|
+
}
|
|
254
|
+
const delta = formatDelta(collected, maxChars);
|
|
255
|
+
return { result, delta };
|
|
256
|
+
}
|
|
257
|
+
catch {
|
|
258
|
+
// Collection failed (page might have navigated or crashed)
|
|
259
|
+
return { result, delta: '' };
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
//# sourceMappingURL=dom-delta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom-delta.js","sourceRoot":"","sources":["../../src/utils/dom-delta.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AA2NH,oCAgFC;AA3RD,+DAA+D;AAC/D,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyF1B,CAAC;AAEN,2CAA2C;AAC3C,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;KA0BxB,CAAC;AAoBN;;GAEG;AACH,SAAS,WAAW,CAAC,KAAqB,EAAE,QAAgB;IAC1D,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,oDAAoD;IACpD,MAAM,IAAI,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QAC3D,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAC/B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pagination Detector - Detects pagination patterns in browser pages.
|
|
3
|
+
*
|
|
4
|
+
* Runs DOM inspection via page.evaluate() and returns a structured
|
|
5
|
+
* PaginationInfo describing the type of pagination and suggested strategy.
|
|
6
|
+
*/
|
|
7
|
+
import type { Page } from 'puppeteer-core';
|
|
8
|
+
export interface PaginationInfo {
|
|
9
|
+
type: 'numbered' | 'next_button' | 'load_more' | 'infinite_scroll' | 'cursor' | 'viewer' | 'none';
|
|
10
|
+
hasNext: boolean;
|
|
11
|
+
hasPrev: boolean;
|
|
12
|
+
currentPage?: number;
|
|
13
|
+
totalPages?: number;
|
|
14
|
+
nextAction?: {
|
|
15
|
+
tool: string;
|
|
16
|
+
args: Record<string, unknown>;
|
|
17
|
+
};
|
|
18
|
+
urlPattern?: string;
|
|
19
|
+
suggestedStrategy: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function detectPagination(page: Page, tabId: string): Promise<PaginationInfo>;
|
|
22
|
+
//# sourceMappingURL=pagination-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination-detector.d.ts","sourceRoot":"","sources":["../../src/utils/pagination-detector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,UAAU,GAAG,aAAa,GAAG,WAAW,GAAG,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IAClG,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC/B,CAAC;IACF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CA0UzF"}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Pagination Detector - Detects pagination patterns in browser pages.
|
|
4
|
+
*
|
|
5
|
+
* Runs DOM inspection via page.evaluate() and returns a structured
|
|
6
|
+
* PaginationInfo describing the type of pagination and suggested strategy.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.detectPagination = detectPagination;
|
|
10
|
+
async function detectPagination(page, tabId) {
|
|
11
|
+
try {
|
|
12
|
+
const result = await page.evaluate(() => {
|
|
13
|
+
// ---------------------------------------------------------------
|
|
14
|
+
// 1. PDF/Slide Viewer detection
|
|
15
|
+
// ---------------------------------------------------------------
|
|
16
|
+
const hasViewerContainer = !!document.querySelector('#viewerContainer') ||
|
|
17
|
+
!!document.querySelector('.pdfViewer') ||
|
|
18
|
+
!!document.querySelector('[data-page-number]');
|
|
19
|
+
const canvasInPage = !!document.querySelector('.page canvas') ||
|
|
20
|
+
!!document.querySelector('[id^="page"] canvas') ||
|
|
21
|
+
!!document.querySelector('canvas[aria-label]');
|
|
22
|
+
// Page count text patterns: "Page X of Y", "X / Y", "X/Y"
|
|
23
|
+
const bodyText = document.body.innerText || '';
|
|
24
|
+
const pageCountMatch = bodyText.match(/[Pp]age\s+(\d+)\s+of\s+(\d+)/) ||
|
|
25
|
+
bodyText.match(/(\d+)\s*\/\s*(\d+)/) ||
|
|
26
|
+
null;
|
|
27
|
+
// Slide presentation viewers
|
|
28
|
+
const hasRevealJs = !!window.Reveal;
|
|
29
|
+
const hasGoogleSlides = !!document.querySelector('.punch-present-iframe, [data-slide-id]');
|
|
30
|
+
const hasFeatpaper = !!document.querySelector('[class*="featpaper"], [class*="slideshare"]');
|
|
31
|
+
if (hasViewerContainer || canvasInPage || hasRevealJs || hasGoogleSlides || hasFeatpaper) {
|
|
32
|
+
let currentPage;
|
|
33
|
+
let totalPages;
|
|
34
|
+
if (pageCountMatch) {
|
|
35
|
+
currentPage = parseInt(pageCountMatch[1], 10);
|
|
36
|
+
totalPages = parseInt(pageCountMatch[2], 10);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
// Try numeric inputs used in PDF viewers
|
|
40
|
+
const pageInput = document.querySelector('input[id*="page"], input[aria-label*="page" i], input[aria-label*="Page" i]');
|
|
41
|
+
if (pageInput) {
|
|
42
|
+
const val = parseInt(pageInput.value, 10);
|
|
43
|
+
if (!isNaN(val))
|
|
44
|
+
currentPage = val;
|
|
45
|
+
}
|
|
46
|
+
// Total pages from span patterns
|
|
47
|
+
const totalEl = document.querySelector('#numPages, [id*="numPages"], [class*="numPages"], [class*="total-pages"]');
|
|
48
|
+
if (totalEl && totalEl.textContent) {
|
|
49
|
+
const n = parseInt(totalEl.textContent.replace(/\D/g, ''), 10);
|
|
50
|
+
if (!isNaN(n) && n > 0)
|
|
51
|
+
totalPages = n;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const hasNext = totalPages === undefined || (currentPage !== undefined && currentPage < totalPages);
|
|
55
|
+
const hasPrev = currentPage !== undefined && currentPage > 1;
|
|
56
|
+
return {
|
|
57
|
+
type: 'viewer',
|
|
58
|
+
hasNext,
|
|
59
|
+
hasPrev,
|
|
60
|
+
currentPage,
|
|
61
|
+
totalPages,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
// ---------------------------------------------------------------
|
|
65
|
+
// 2. Numbered pagination
|
|
66
|
+
// ---------------------------------------------------------------
|
|
67
|
+
const paginationContainer = document.querySelector('.pagination') ||
|
|
68
|
+
document.querySelector('[role="navigation"][aria-label*="page" i]') ||
|
|
69
|
+
document.querySelector('[role="navigation"][aria-label*="pagination" i]') ||
|
|
70
|
+
document.querySelector('nav.pagination') ||
|
|
71
|
+
document.querySelector('[class*="pagination"]');
|
|
72
|
+
if (paginationContainer) {
|
|
73
|
+
const links = Array.from(paginationContainer.querySelectorAll('a, button'));
|
|
74
|
+
const pageNumbers = links
|
|
75
|
+
.map((el) => parseInt((el.textContent || '').trim(), 10))
|
|
76
|
+
.filter((n) => !isNaN(n) && n > 0);
|
|
77
|
+
const isSequential = pageNumbers.length >= 2 &&
|
|
78
|
+
pageNumbers.every((n, i) => i === 0 || n === pageNumbers[i - 1] + 1);
|
|
79
|
+
if (isSequential || pageNumbers.length >= 3) {
|
|
80
|
+
// Try to find current page
|
|
81
|
+
const activeEl = paginationContainer.querySelector('[aria-current="page"]') ||
|
|
82
|
+
paginationContainer.querySelector('.active') ||
|
|
83
|
+
paginationContainer.querySelector('[class*="current"]') ||
|
|
84
|
+
paginationContainer.querySelector('[class*="active"]');
|
|
85
|
+
let currentPage;
|
|
86
|
+
if (activeEl) {
|
|
87
|
+
const n = parseInt((activeEl.textContent || '').trim(), 10);
|
|
88
|
+
if (!isNaN(n))
|
|
89
|
+
currentPage = n;
|
|
90
|
+
}
|
|
91
|
+
const totalPages = pageNumbers.length > 0 ? Math.max(...pageNumbers) : undefined;
|
|
92
|
+
const hasNext = currentPage !== undefined && totalPages !== undefined
|
|
93
|
+
? currentPage < totalPages
|
|
94
|
+
: true;
|
|
95
|
+
const hasPrev = currentPage !== undefined ? currentPage > 1 : false;
|
|
96
|
+
// URL pattern detection
|
|
97
|
+
const url = window.location.href;
|
|
98
|
+
let urlPattern;
|
|
99
|
+
let urlTemplate;
|
|
100
|
+
const pageParamMatch = url.match(/[?&]page=(\d+)/);
|
|
101
|
+
const offsetParamMatch = url.match(/[?&]offset=(\d+)/);
|
|
102
|
+
const pathPageMatch = url.match(/\/page\/(\d+)/);
|
|
103
|
+
if (pageParamMatch) {
|
|
104
|
+
urlPattern = '?page=N';
|
|
105
|
+
urlTemplate = url.replace(/([?&]page=)\d+/, '$1{page}');
|
|
106
|
+
}
|
|
107
|
+
else if (offsetParamMatch) {
|
|
108
|
+
urlPattern = '?offset=N';
|
|
109
|
+
urlTemplate = url.replace(/([?&]offset=)\d+/, '$1{offset}');
|
|
110
|
+
}
|
|
111
|
+
else if (pathPageMatch) {
|
|
112
|
+
urlPattern = '/page/N';
|
|
113
|
+
urlTemplate = url.replace(/\/page\/\d+/, '/page/{page}');
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
type: 'numbered',
|
|
117
|
+
hasNext,
|
|
118
|
+
hasPrev,
|
|
119
|
+
currentPage,
|
|
120
|
+
totalPages,
|
|
121
|
+
urlPattern,
|
|
122
|
+
urlTemplate,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// ---------------------------------------------------------------
|
|
127
|
+
// 3. Next/Prev button detection
|
|
128
|
+
// ---------------------------------------------------------------
|
|
129
|
+
const nextButtonSelectors = [
|
|
130
|
+
'[aria-label*="next" i]',
|
|
131
|
+
'[rel="next"]',
|
|
132
|
+
'.next-page',
|
|
133
|
+
'.next',
|
|
134
|
+
'[class*="next-page"]',
|
|
135
|
+
'[class*="nextPage"]',
|
|
136
|
+
'[class*="btn-next"]',
|
|
137
|
+
];
|
|
138
|
+
let nextSelector;
|
|
139
|
+
for (const sel of nextButtonSelectors) {
|
|
140
|
+
const el = document.querySelector(sel);
|
|
141
|
+
if (el && el.offsetParent !== null) {
|
|
142
|
+
// Visible element
|
|
143
|
+
const tag = el.tagName.toLowerCase();
|
|
144
|
+
const classes = Array.from(el.classList).slice(0, 2).join('.');
|
|
145
|
+
nextSelector = classes ? `${tag}.${classes}` : sel;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// Also check buttons with "next" text
|
|
150
|
+
if (!nextSelector) {
|
|
151
|
+
const buttons = Array.from(document.querySelectorAll('button, a'));
|
|
152
|
+
for (const btn of buttons) {
|
|
153
|
+
const text = (btn.textContent || '').trim().toLowerCase();
|
|
154
|
+
if (text === 'next' || text === 'next page' || text === '›' || text === '»' || text === '>') {
|
|
155
|
+
const tag = btn.tagName.toLowerCase();
|
|
156
|
+
const classes = Array.from(btn.classList).slice(0, 2).join('.');
|
|
157
|
+
nextSelector = classes ? `${tag}.${classes}` : tag;
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (nextSelector) {
|
|
163
|
+
// Check for prev
|
|
164
|
+
const prevExists = !!document.querySelector('[aria-label*="prev" i]') ||
|
|
165
|
+
!!document.querySelector('[rel="prev"]') ||
|
|
166
|
+
!!document.querySelector('.prev-page') ||
|
|
167
|
+
!!document.querySelector('.prev') ||
|
|
168
|
+
!!document.querySelector('[class*="prev-page"]');
|
|
169
|
+
return {
|
|
170
|
+
type: 'next_button',
|
|
171
|
+
hasNext: true,
|
|
172
|
+
hasPrev: prevExists,
|
|
173
|
+
nextSelector,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
// ---------------------------------------------------------------
|
|
177
|
+
// 4. Load More button detection
|
|
178
|
+
// ---------------------------------------------------------------
|
|
179
|
+
const loadMorePhrases = ['load more', 'show more', 'see more', '더 보기', 'load more results', 'view more'];
|
|
180
|
+
const allButtons = Array.from(document.querySelectorAll('button, a, [role="button"]'));
|
|
181
|
+
let loadMoreSelector;
|
|
182
|
+
for (const btn of allButtons) {
|
|
183
|
+
const text = (btn.textContent || '').trim().toLowerCase();
|
|
184
|
+
if (loadMorePhrases.some((phrase) => text === phrase || text.startsWith(phrase))) {
|
|
185
|
+
const tag = btn.tagName.toLowerCase();
|
|
186
|
+
const classes = Array.from(btn.classList).slice(0, 2).join('.');
|
|
187
|
+
loadMoreSelector = classes ? `${tag}.${classes}` : tag;
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (loadMoreSelector) {
|
|
192
|
+
return {
|
|
193
|
+
type: 'load_more',
|
|
194
|
+
hasNext: true,
|
|
195
|
+
hasPrev: false,
|
|
196
|
+
nextSelector: loadMoreSelector,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
// ---------------------------------------------------------------
|
|
200
|
+
// 5. Infinite scroll detection
|
|
201
|
+
// ---------------------------------------------------------------
|
|
202
|
+
const isScrollable = document.body.scrollHeight > 1.5 * window.innerHeight;
|
|
203
|
+
const hasSentinel = !!document.querySelector('[class*="sentinel"]') ||
|
|
204
|
+
!!document.querySelector('[class*="infinite"]') ||
|
|
205
|
+
!!document.querySelector('[data-infinite]') ||
|
|
206
|
+
!!document.querySelector('[class*="load-trigger"]');
|
|
207
|
+
if (isScrollable && (hasSentinel || document.body.scrollHeight > 2 * window.innerHeight)) {
|
|
208
|
+
return {
|
|
209
|
+
type: 'infinite_scroll',
|
|
210
|
+
hasNext: true,
|
|
211
|
+
hasPrev: false,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
// ---------------------------------------------------------------
|
|
215
|
+
// 6. None / fallback
|
|
216
|
+
// ---------------------------------------------------------------
|
|
217
|
+
return {
|
|
218
|
+
type: 'none',
|
|
219
|
+
hasNext: false,
|
|
220
|
+
hasPrev: false,
|
|
221
|
+
};
|
|
222
|
+
});
|
|
223
|
+
// Build the final PaginationInfo with nextAction and suggestedStrategy
|
|
224
|
+
const info = {
|
|
225
|
+
type: result.type,
|
|
226
|
+
hasNext: result.hasNext,
|
|
227
|
+
hasPrev: result.hasPrev,
|
|
228
|
+
currentPage: result.currentPage,
|
|
229
|
+
totalPages: result.totalPages,
|
|
230
|
+
urlPattern: result.urlPattern,
|
|
231
|
+
suggestedStrategy: '',
|
|
232
|
+
};
|
|
233
|
+
switch (result.type) {
|
|
234
|
+
case 'viewer': {
|
|
235
|
+
const n = result.totalPages;
|
|
236
|
+
if (n !== undefined) {
|
|
237
|
+
info.suggestedStrategy = `This is a paginated viewer with ${n} pages. Use batch_paginate(strategy='keyboard', totalPages=${n}) to extract all pages in a single call.`;
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
info.suggestedStrategy = "This is a paginated viewer. Use batch_paginate(strategy='keyboard') to extract all pages via keyboard navigation.";
|
|
241
|
+
}
|
|
242
|
+
info.nextAction = { tool: 'computer', args: { action: 'key', text: 'ArrowRight' } };
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
case 'numbered': {
|
|
246
|
+
if (result.urlPattern && result.urlTemplate && result.totalPages) {
|
|
247
|
+
info.suggestedStrategy = `URL pagination detected (${result.urlPattern}). Use batch_paginate(strategy='url', urlTemplate='${result.urlTemplate}', totalPages=${result.totalPages}) for parallel extraction.`;
|
|
248
|
+
}
|
|
249
|
+
else if (result.totalPages) {
|
|
250
|
+
info.suggestedStrategy = `Numbered pagination detected with ${result.totalPages} pages. Use batch_paginate(strategy='click') to iterate through all pages.`;
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
info.suggestedStrategy = "Numbered pagination detected. Use batch_paginate(strategy='click') to iterate through pages.";
|
|
254
|
+
}
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
case 'next_button': {
|
|
258
|
+
const sel = result.nextSelector ?? '[aria-label*="next" i]';
|
|
259
|
+
info.suggestedStrategy = `Next button detected. Use batch_paginate(strategy='click', nextSelector='${sel}') for server-side bulk extraction.`;
|
|
260
|
+
info.nextAction = { tool: 'click', args: { selector: sel } };
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
case 'load_more': {
|
|
264
|
+
const sel = result.nextSelector ?? 'button';
|
|
265
|
+
info.suggestedStrategy = `'Load more' button found. Use batch_paginate(strategy='click', nextSelector='${sel}') for bulk extraction.`;
|
|
266
|
+
info.nextAction = { tool: 'click', args: { selector: sel } };
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
case 'infinite_scroll': {
|
|
270
|
+
info.suggestedStrategy = "Infinite scroll detected. Use batch_paginate(strategy='scroll') to auto-scroll and extract all content.";
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
case 'cursor':
|
|
274
|
+
case 'none':
|
|
275
|
+
default: {
|
|
276
|
+
info.suggestedStrategy = 'No pagination detected. All content is available on the current page.';
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return info;
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
// Detection failures are non-fatal — return none
|
|
284
|
+
return {
|
|
285
|
+
type: 'none',
|
|
286
|
+
hasNext: false,
|
|
287
|
+
hasPrev: false,
|
|
288
|
+
suggestedStrategy: 'Pagination detection failed.',
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
//# sourceMappingURL=pagination-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination-detector.js","sourceRoot":"","sources":["../../src/utils/pagination-detector.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAkBH,4CA0UC;AA1UM,KAAK,UAAU,gBAAgB,CAAC,IAAU,EAAE,KAAa;IAC9D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;YAYtC,kEAAkE;YAClE,gCAAgC;YAChC,kEAAkE;YAClE,MAAM,kBAAkB,GACtB,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,kBAAkB,CAAC;gBAC5C,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,YAAY,CAAC;gBACtC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAC;YAEjD,MAAM,YAAY,GAChB,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,cAAc,CAAC;gBACxC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,qBAAqB,CAAC;gBAC/C,CAAC,CAAC,QAAQ,CAAC,a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@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smart-goto.d.ts","sourceRoot":"","sources":["../../src/utils/smart-goto.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAS,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"smart-goto.d.ts","sourceRoot":"","sources":["../../src/utils/smart-goto.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAS,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAa3D,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9B,YAAY,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3D;AAED,wBAAsB,SAAS,CAC7B,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7B,OAAO,CAAC,eAAe,CAAC,CAwC1B"}
|