@eko-ai/eko 1.0.8 → 1.0.10
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/LICENSE +21 -21
- package/README.md +139 -131
- package/dist/core/eko.d.ts +3 -2
- package/dist/extension/script/bing.js +0 -0
- package/dist/extension/script/build_dom_tree.js +661 -661
- package/dist/extension/script/common.js +0 -0
- package/dist/extension/script/duckduckgo.js +0 -0
- package/dist/extension/script/google.js +0 -0
- package/dist/extension/tools/cancel_workflow.d.ts +9 -0
- package/dist/extension/tools/get_all_tabs.d.ts +9 -0
- package/dist/extension/tools/index.d.ts +3 -1
- package/dist/extension/tools/tab_management.d.ts +1 -1
- package/dist/extension/utils.d.ts +1 -1
- package/dist/extension.cjs.js +749 -278
- package/dist/extension.esm.js +749 -278
- package/dist/extension_content_script.js +55 -55
- package/dist/fellou.cjs.js +18 -18
- package/dist/fellou.esm.js +18 -18
- package/dist/index.cjs.js +2034 -1609
- package/dist/index.d.ts +3 -1
- package/dist/index.esm.js +2033 -1610
- package/dist/jest.config.js +10 -0
- package/dist/jest.config.js.map +1 -0
- package/dist/models/action.d.ts +8 -4
- package/dist/models/workflow.d.ts +8 -3
- package/dist/nodejs/tools/index.d.ts +1 -0
- package/dist/nodejs.cjs.js +1832 -1623
- package/dist/nodejs.esm.js +1832 -1623
- package/dist/rollup.config.js +171 -0
- package/dist/rollup.config.js.map +1 -0
- package/dist/schemas/workflow.schema.d.ts +2 -13
- package/dist/script.js +10 -0
- package/dist/script.js.map +1 -0
- package/dist/services/llm/claude-provider.d.ts +2 -1
- package/dist/services/llm/deepseek-provider.d.ts +13 -0
- package/dist/services/llm/openai-provider.d.ts +2 -1
- package/dist/services/llm/provider-factory.d.ts +4 -0
- package/dist/services/llm/siliconflow-provider.d.ts +13 -0
- package/dist/services/parser/workflow-parser.d.ts +0 -7
- package/dist/services/workflow/generator.d.ts +1 -0
- package/dist/src/core/eko.js +99 -0
- package/dist/src/core/eko.js.map +1 -0
- package/dist/src/core/tool-registry.js +51 -0
- package/dist/src/core/tool-registry.js.map +1 -0
- package/dist/src/extension/content/index.js +409 -0
- package/dist/src/extension/content/index.js.map +1 -0
- package/dist/src/extension/core.js +29 -0
- package/dist/src/extension/core.js.map +1 -0
- package/dist/src/extension/index.js +12 -0
- package/dist/src/extension/index.js.map +1 -0
- package/dist/src/extension/script/bing.js +25 -0
- package/dist/src/extension/script/bing.js.map +1 -0
- package/dist/src/extension/script/build_dom_tree.js +585 -0
- package/dist/src/extension/script/build_dom_tree.js.map +1 -0
- package/dist/src/extension/script/common.js +203 -0
- package/dist/src/extension/script/common.js.map +1 -0
- package/dist/src/extension/script/duckduckgo.js +25 -0
- package/dist/src/extension/script/duckduckgo.js.map +1 -0
- package/dist/src/extension/script/google.js +26 -0
- package/dist/src/extension/script/google.js.map +1 -0
- package/dist/src/extension/tools/browser.js +174 -0
- package/dist/src/extension/tools/browser.js.map +1 -0
- package/dist/src/extension/tools/browser_use.js +186 -0
- package/dist/src/extension/tools/browser_use.js.map +1 -0
- package/dist/src/extension/tools/element_click.js +123 -0
- package/dist/src/extension/tools/element_click.js.map +1 -0
- package/dist/src/extension/tools/export_file.js +93 -0
- package/dist/src/extension/tools/export_file.js.map +1 -0
- package/dist/src/extension/tools/extract_content.js +38 -0
- package/dist/src/extension/tools/extract_content.js.map +1 -0
- package/dist/src/extension/tools/find_element_position.js +125 -0
- package/dist/src/extension/tools/find_element_position.js.map +1 -0
- package/dist/src/extension/tools/html_script.js +219 -0
- package/dist/src/extension/tools/html_script.js.map +1 -0
- package/dist/src/extension/tools/index.js +12 -0
- package/dist/src/extension/tools/index.js.map +1 -0
- package/dist/src/extension/tools/open_url.js +68 -0
- package/dist/src/extension/tools/open_url.js.map +1 -0
- package/dist/src/extension/tools/request_login.js +87 -0
- package/dist/src/extension/tools/request_login.js.map +1 -0
- package/dist/src/extension/tools/screenshot.js +26 -0
- package/dist/src/extension/tools/screenshot.js.map +1 -0
- package/dist/src/extension/tools/tab_management.js +160 -0
- package/dist/src/extension/tools/tab_management.js.map +1 -0
- package/dist/src/extension/tools/web_search.js +281 -0
- package/dist/src/extension/tools/web_search.js.map +1 -0
- package/dist/src/extension/utils.js +244 -0
- package/dist/src/extension/utils.js.map +1 -0
- package/dist/src/fellou/computer.js +104 -0
- package/dist/src/fellou/computer.js.map +1 -0
- package/dist/src/fellou/index.js +7 -0
- package/dist/src/fellou/index.js.map +1 -0
- package/dist/src/fellou/tools/computer_use.js +111 -0
- package/dist/src/fellou/tools/computer_use.js.map +1 -0
- package/dist/src/index.js +9 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/models/action.js +364 -0
- package/dist/src/models/action.js.map +1 -0
- package/dist/src/models/workflow.js +120 -0
- package/dist/src/models/workflow.js.map +1 -0
- package/dist/src/nodejs/core.js +18 -0
- package/dist/src/nodejs/core.js.map +1 -0
- package/dist/src/nodejs/index.js +6 -0
- package/dist/src/nodejs/index.js.map +1 -0
- package/dist/src/nodejs/script/build_dom_tree.js +586 -0
- package/dist/src/nodejs/script/build_dom_tree.js.map +1 -0
- package/dist/src/nodejs/tools/browser_use.js +458 -0
- package/dist/src/nodejs/tools/browser_use.js.map +1 -0
- package/dist/src/nodejs/tools/command_execute.js +65 -0
- package/dist/src/nodejs/tools/command_execute.js.map +1 -0
- package/dist/src/nodejs/tools/file_read.js +45 -0
- package/dist/src/nodejs/tools/file_read.js.map +1 -0
- package/dist/src/nodejs/tools/file_write.js +95 -0
- package/dist/src/nodejs/tools/file_write.js.map +1 -0
- package/dist/src/nodejs/tools/index.js +5 -0
- package/dist/src/nodejs/tools/index.js.map +1 -0
- package/dist/src/schemas/workflow.schema.js +64 -0
- package/dist/src/schemas/workflow.schema.js.map +1 -0
- package/dist/src/services/llm/claude-provider.js +140 -0
- package/dist/src/services/llm/claude-provider.js.map +1 -0
- package/dist/src/services/llm/deepseek-provider.js +432 -0
- package/dist/src/services/llm/deepseek-provider.js.map +1 -0
- package/dist/src/services/llm/glm-provider.js +317 -0
- package/dist/src/services/llm/glm-provider.js.map +1 -0
- package/dist/src/services/llm/openai-provider copy.js +317 -0
- package/dist/src/services/llm/openai-provider copy.js.map +1 -0
- package/dist/src/services/llm/openai-provider.js +317 -0
- package/dist/src/services/llm/openai-provider.js.map +1 -0
- package/dist/src/services/parser/workflow-parser.js +208 -0
- package/dist/src/services/parser/workflow-parser.js.map +1 -0
- package/dist/src/services/workflow/generator.js +105 -0
- package/dist/src/services/workflow/generator.js.map +1 -0
- package/dist/src/services/workflow/templates.js +42 -0
- package/dist/src/services/workflow/templates.js.map +1 -0
- package/dist/src/types/action.types.js +2 -0
- package/dist/src/types/action.types.js.map +1 -0
- package/dist/src/types/eko.types.js +2 -0
- package/dist/src/types/eko.types.js.map +1 -0
- package/dist/src/types/index.js +6 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/types/llm.types.js +2 -0
- package/dist/src/types/llm.types.js.map +1 -0
- package/dist/src/types/parser.types.js +2 -0
- package/dist/src/types/parser.types.js.map +1 -0
- package/dist/src/types/tools.types.js +2 -0
- package/dist/src/types/tools.types.js.map +1 -0
- package/dist/src/types/workflow.types.js +3 -0
- package/dist/src/types/workflow.types.js.map +1 -0
- package/dist/src/web/core.js +18 -0
- package/dist/src/web/core.js.map +1 -0
- package/dist/src/web/index.js +9 -0
- package/dist/src/web/index.js.map +1 -0
- package/dist/src/web/script/build_dom_tree.js +584 -0
- package/dist/src/web/script/build_dom_tree.js.map +1 -0
- package/dist/src/web/tools/browser.js +249 -0
- package/dist/src/web/tools/browser.js.map +1 -0
- package/dist/src/web/tools/browser_use.js +176 -0
- package/dist/src/web/tools/browser_use.js.map +1 -0
- package/dist/src/web/tools/element_click.js +121 -0
- package/dist/src/web/tools/element_click.js.map +1 -0
- package/dist/src/web/tools/export_file.js +74 -0
- package/dist/src/web/tools/export_file.js.map +1 -0
- package/dist/src/web/tools/extract_content.js +24 -0
- package/dist/src/web/tools/extract_content.js.map +1 -0
- package/dist/src/web/tools/find_element_position.js +121 -0
- package/dist/src/web/tools/find_element_position.js.map +1 -0
- package/dist/src/web/tools/html_script.js +219 -0
- package/dist/src/web/tools/html_script.js.map +1 -0
- package/dist/src/web/tools/index.js +8 -0
- package/dist/src/web/tools/index.js.map +1 -0
- package/dist/src/web/tools/screenshot.js +24 -0
- package/dist/src/web/tools/screenshot.js.map +1 -0
- package/dist/test/integration/claude-provider.test.js +170 -0
- package/dist/test/integration/claude-provider.test.js.map +1 -0
- package/dist/test/integration/deepseek-provider.test.js +171 -0
- package/dist/test/integration/deepseek-provider.test.js.map +1 -0
- package/dist/test/integration/glm-provider.test.js +173 -0
- package/dist/test/integration/glm-provider.test.js.map +1 -0
- package/dist/test/integration/openai-provider.test copy.js +170 -0
- package/dist/test/integration/openai-provider.test copy.js.map +1 -0
- package/dist/test/integration/openai-provider.test.js +170 -0
- package/dist/test/integration/openai-provider.test.js.map +1 -0
- package/dist/test/integration/qwen-provider.js +170 -0
- package/dist/test/integration/qwen-provider.js.map +1 -0
- package/dist/test/integration/qwen-provider.test copy.js +170 -0
- package/dist/test/integration/qwen-provider.test copy.js.map +1 -0
- package/dist/test/integration/qwen-provider.test.js +170 -0
- package/dist/test/integration/qwen-provider.test.js.map +1 -0
- package/dist/test/integration/workflow.execution.test.js +152 -0
- package/dist/test/integration/workflow.execution.test.js.map +1 -0
- package/dist/test/integration/workflow.generation-and-execution.test.js +131 -0
- package/dist/test/integration/workflow.generation-and-execution.test.js.map +1 -0
- package/dist/test/integration/workflow.generator.test.js +207 -0
- package/dist/test/integration/workflow.generator.test.js.map +1 -0
- package/dist/test/unit/action.test.js +186 -0
- package/dist/test/unit/action.test.js.map +1 -0
- package/dist/test/unit/tool-registry.test.js +99 -0
- package/dist/test/unit/tool-registry.test.js.map +1 -0
- package/dist/test/unit/workflow-parser.test.js +189 -0
- package/dist/test/unit/workflow-parser.test.js.map +1 -0
- package/dist/test/unit/workflow.test.js +102 -0
- package/dist/test/unit/workflow.test.js.map +1 -0
- package/dist/types/action.types.d.ts +8 -3
- package/dist/types/jest.config.d.ts +10 -0
- package/dist/types/rollup.config.d.ts +16 -0
- package/dist/types/script.d.ts +1 -0
- package/dist/types/src/core/eko.d.ts +20 -0
- package/dist/types/src/core/tool-registry.d.ts +13 -0
- package/dist/types/src/extension/content/index.d.ts +16 -0
- package/dist/types/src/extension/core.d.ts +11 -0
- package/dist/types/src/extension/index.d.ts +7 -0
- package/dist/types/src/extension/script/bing.d.ts +0 -0
- package/dist/types/src/extension/script/build_dom_tree.d.ts +38 -0
- package/dist/types/src/extension/script/common.d.ts +0 -0
- package/dist/types/src/extension/script/duckduckgo.d.ts +0 -0
- package/dist/types/src/extension/script/google.d.ts +0 -0
- package/dist/types/src/extension/tools/browser.d.ts +22 -0
- package/dist/types/src/extension/tools/browser_use.d.ts +19 -0
- package/dist/types/src/extension/tools/element_click.d.ts +12 -0
- package/dist/types/src/extension/tools/export_file.d.ts +18 -0
- package/dist/types/src/extension/tools/extract_content.d.ts +18 -0
- package/dist/types/src/extension/tools/find_element_position.d.ts +12 -0
- package/dist/types/src/extension/tools/html_script.d.ts +10 -0
- package/dist/types/src/extension/tools/index.d.ts +11 -0
- package/dist/types/src/extension/tools/open_url.d.ts +18 -0
- package/dist/{extension/tools/form_autofill.d.ts → types/src/extension/tools/request_login.d.ts} +3 -4
- package/dist/types/src/extension/tools/screenshot.d.ts +18 -0
- package/dist/types/src/extension/tools/tab_management.d.ts +19 -0
- package/dist/types/src/extension/tools/web_search.d.ts +18 -0
- package/dist/types/src/extension/utils.d.ts +31 -0
- package/dist/types/src/fellou/computer.d.ts +20 -0
- package/dist/types/src/fellou/index.d.ts +6 -0
- package/dist/types/src/fellou/tools/computer_use.d.ts +18 -0
- package/dist/types/src/index.d.ts +8 -0
- package/dist/types/src/models/action.d.ts +22 -0
- package/dist/types/src/models/workflow.d.ts +16 -0
- package/dist/types/src/nodejs/core.d.ts +2 -0
- package/dist/types/src/nodejs/index.d.ts +3 -0
- package/dist/types/src/nodejs/script/build_dom_tree.d.ts +1 -0
- package/dist/types/src/nodejs/tools/browser_use.d.ts +28 -0
- package/dist/types/src/nodejs/tools/command_execute.d.ts +12 -0
- package/dist/types/src/nodejs/tools/file_read.d.ts +11 -0
- package/dist/types/src/nodejs/tools/file_write.d.ts +15 -0
- package/dist/types/src/nodejs/tools/index.d.ts +4 -0
- package/dist/types/src/schemas/workflow.schema.d.ts +88 -0
- package/dist/types/src/services/llm/claude-provider.d.ts +11 -0
- package/dist/types/src/services/llm/deepseek-provider.d.ts +15 -0
- package/dist/types/src/services/llm/glm-provider.d.ts +11 -0
- package/dist/types/src/services/llm/openai-provider copy.d.ts +11 -0
- package/dist/types/src/services/llm/openai-provider.d.ts +11 -0
- package/dist/types/src/services/parser/workflow-parser.d.ts +29 -0
- package/dist/types/src/services/workflow/generator.d.ts +13 -0
- package/dist/types/src/services/workflow/templates.d.ts +8 -0
- package/dist/types/src/types/action.types.d.ts +38 -0
- package/dist/types/src/types/eko.types.d.ts +21 -0
- package/dist/types/src/types/index.d.ts +5 -0
- package/dist/types/src/types/llm.types.d.ts +54 -0
- package/dist/types/src/types/parser.types.d.ts +9 -0
- package/dist/types/src/types/tools.types.d.ts +88 -0
- package/dist/types/src/types/workflow.types.d.ts +39 -0
- package/dist/types/src/web/core.d.ts +2 -0
- package/dist/types/src/web/index.d.ts +5 -0
- package/dist/types/src/web/script/build_dom_tree.d.ts +10 -0
- package/dist/types/src/web/tools/browser.d.ts +21 -0
- package/dist/types/src/web/tools/browser_use.d.ts +19 -0
- package/dist/types/src/web/tools/element_click.d.ts +12 -0
- package/dist/types/src/web/tools/export_file.d.ts +18 -0
- package/dist/types/src/web/tools/extract_content.d.ts +17 -0
- package/dist/types/src/web/tools/find_element_position.d.ts +12 -0
- package/dist/types/src/web/tools/html_script.d.ts +10 -0
- package/dist/types/src/web/tools/index.d.ts +7 -0
- package/dist/types/src/web/tools/screenshot.d.ts +18 -0
- package/dist/types/test/integration/claude-provider.test.d.ts +1 -0
- package/dist/types/test/integration/deepseek-provider.test.d.ts +1 -0
- package/dist/types/test/integration/glm-provider.test.d.ts +1 -0
- package/dist/types/test/integration/openai-provider.test copy.d.ts +1 -0
- package/dist/types/test/integration/openai-provider.test.d.ts +1 -0
- package/dist/types/test/integration/qwen-provider.d.ts +1 -0
- package/dist/types/test/integration/qwen-provider.test copy.d.ts +1 -0
- package/dist/types/test/integration/qwen-provider.test.d.ts +1 -0
- package/dist/types/test/integration/workflow.execution.test.d.ts +1 -0
- package/dist/types/test/integration/workflow.generation-and-execution.test.d.ts +1 -0
- package/dist/types/test/integration/workflow.generator.test.d.ts +1 -0
- package/dist/types/test/unit/action.test.d.ts +1 -0
- package/dist/types/test/unit/tool-registry.test.d.ts +1 -0
- package/dist/types/test/unit/workflow-parser.test.d.ts +1 -0
- package/dist/types/test/unit/workflow.test.d.ts +1 -0
- package/dist/types/tools.types.d.ts +44 -1
- package/dist/types/workflow.types.d.ts +22 -9
- package/dist/universal_tools/cancel_workflow.d.ts +9 -0
- package/dist/universal_tools/human/text.d.ts +9 -0
- package/dist/universal_tools/human.d.ts +30 -0
- package/dist/universal_tools/index.d.ts +4 -0
- package/dist/universal_tools/summary_workflow.d.ts +9 -0
- package/dist/utils/execution-logger.d.ts +69 -0
- package/dist/web.cjs.js +117 -117
- package/dist/web.esm.js +117 -117
- package/package.json +106 -107
- package/dist/fellou/tools/index.d.ts +0 -2
- package/dist/types/framework.types.d.ts +0 -11
package/dist/web.cjs.js
CHANGED
|
@@ -399,11 +399,11 @@ function build_dom_tree(doHighlightElements) {
|
|
|
399
399
|
// Check for click-related events on the element itself
|
|
400
400
|
const listeners = getEventListeners(element);
|
|
401
401
|
const hasClickListeners = listeners &&
|
|
402
|
-
(((_a = listeners.click) === null || _a ===
|
|
403
|
-
((_b = listeners.mousedown) === null || _b ===
|
|
404
|
-
((_c = listeners.mouseup) === null || _c ===
|
|
405
|
-
((_d = listeners.touchstart) === null || _d ===
|
|
406
|
-
((_e = listeners.touchend) === null || _e ===
|
|
402
|
+
(((_a = listeners.click) === null || _a === undefined ? undefined : _a.length) > 0 ||
|
|
403
|
+
((_b = listeners.mousedown) === null || _b === undefined ? undefined : _b.length) > 0 ||
|
|
404
|
+
((_c = listeners.mouseup) === null || _c === undefined ? undefined : _c.length) > 0 ||
|
|
405
|
+
((_d = listeners.touchstart) === null || _d === undefined ? undefined : _d.length) > 0 ||
|
|
406
|
+
((_e = listeners.touchend) === null || _e === undefined ? undefined : _e.length) > 0);
|
|
407
407
|
// Check for ARIA properties that suggest interactivity
|
|
408
408
|
const hasAriaProps = element.hasAttribute('aria-expanded') ||
|
|
409
409
|
element.hasAttribute('aria-pressed') ||
|
|
@@ -490,7 +490,7 @@ function build_dom_tree(doHighlightElements) {
|
|
|
490
490
|
rect.height !== 0 &&
|
|
491
491
|
rect.top >= 0 &&
|
|
492
492
|
rect.top <= window.innerHeight &&
|
|
493
|
-
((_a = textNode.parentElement) === null || _a ===
|
|
493
|
+
((_a = textNode.parentElement) === null || _a === undefined ? undefined : _a.checkVisibility({
|
|
494
494
|
checkOpacity: true,
|
|
495
495
|
checkVisibilityCSS: true,
|
|
496
496
|
})));
|
|
@@ -525,7 +525,7 @@ function build_dom_tree(doHighlightElements) {
|
|
|
525
525
|
// Copy all attributes if the node is an element
|
|
526
526
|
if (node.nodeType === Node.ELEMENT_NODE && node.attributes) {
|
|
527
527
|
// Use getAttributeNames() instead of directly iterating attributes
|
|
528
|
-
const attributeNames = ((_a = node.getAttributeNames) === null || _a ===
|
|
528
|
+
const attributeNames = ((_a = node.getAttributeNames) === null || _a === undefined ? undefined : _a.call(node)) || [];
|
|
529
529
|
for (const name of attributeNames) {
|
|
530
530
|
nodeData.attributes[name] = node.getAttribute(name);
|
|
531
531
|
}
|
|
@@ -665,7 +665,7 @@ function __generator(thisArg, body) {
|
|
|
665
665
|
}
|
|
666
666
|
op = body.call(thisArg, _);
|
|
667
667
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
668
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] :
|
|
668
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : undefined, done: true };
|
|
669
669
|
}
|
|
670
670
|
}
|
|
671
671
|
|
|
@@ -1045,7 +1045,7 @@ var LINE_BREAKS = HARD_LINE_BREAKS.concat(SPACE$1);
|
|
|
1045
1045
|
var KOREAN_SYLLABLE_BLOCK = [JL, JV, JT, H2, H3];
|
|
1046
1046
|
var HYPHEN = [HY, BA];
|
|
1047
1047
|
var codePointsToCharacterClasses = function (codePoints, lineBreak) {
|
|
1048
|
-
if (lineBreak ===
|
|
1048
|
+
if (lineBreak === undefined) { lineBreak = 'strict'; }
|
|
1049
1049
|
var types = [];
|
|
1050
1050
|
var indices = [];
|
|
1051
1051
|
var categories = [];
|
|
@@ -1390,7 +1390,7 @@ var Break = /** @class */ (function () {
|
|
|
1390
1390
|
this.end = end;
|
|
1391
1391
|
}
|
|
1392
1392
|
Break.prototype.slice = function () {
|
|
1393
|
-
return fromCodePoint$1.apply(
|
|
1393
|
+
return fromCodePoint$1.apply(undefined, this.codePoints.slice(this.start, this.end));
|
|
1394
1394
|
};
|
|
1395
1395
|
return Break;
|
|
1396
1396
|
}());
|
|
@@ -1544,7 +1544,7 @@ var stringToNumber = function (codePoints) {
|
|
|
1544
1544
|
while (isDigit(codePoints[c])) {
|
|
1545
1545
|
integers.push(codePoints[c++]);
|
|
1546
1546
|
}
|
|
1547
|
-
var int = integers.length ? parseInt(fromCodePoint$1.apply(
|
|
1547
|
+
var int = integers.length ? parseInt(fromCodePoint$1.apply(undefined, integers), 10) : 0;
|
|
1548
1548
|
if (codePoints[c] === FULL_STOP) {
|
|
1549
1549
|
c++;
|
|
1550
1550
|
}
|
|
@@ -1553,7 +1553,7 @@ var stringToNumber = function (codePoints) {
|
|
|
1553
1553
|
fraction.push(codePoints[c++]);
|
|
1554
1554
|
}
|
|
1555
1555
|
var fracd = fraction.length;
|
|
1556
|
-
var frac = fracd ? parseInt(fromCodePoint$1.apply(
|
|
1556
|
+
var frac = fracd ? parseInt(fromCodePoint$1.apply(undefined, fraction), 10) : 0;
|
|
1557
1557
|
if (codePoints[c] === E || codePoints[c] === e) {
|
|
1558
1558
|
c++;
|
|
1559
1559
|
}
|
|
@@ -1568,7 +1568,7 @@ var stringToNumber = function (codePoints) {
|
|
|
1568
1568
|
while (isDigit(codePoints[c])) {
|
|
1569
1569
|
exponent.push(codePoints[c++]);
|
|
1570
1570
|
}
|
|
1571
|
-
var exp = exponent.length ? parseInt(fromCodePoint$1.apply(
|
|
1571
|
+
var exp = exponent.length ? parseInt(fromCodePoint$1.apply(undefined, exponent), 10) : 0;
|
|
1572
1572
|
return sign * (int + frac * Math.pow(10, -fracd)) * Math.pow(10, expsign * exp);
|
|
1573
1573
|
};
|
|
1574
1574
|
var LEFT_PARENTHESIS_TOKEN = {
|
|
@@ -1814,11 +1814,11 @@ var Tokenizer = /** @class */ (function () {
|
|
|
1814
1814
|
questionMarks = true;
|
|
1815
1815
|
}
|
|
1816
1816
|
if (questionMarks) {
|
|
1817
|
-
var start_1 = parseInt(fromCodePoint$1.apply(
|
|
1818
|
-
var end = parseInt(fromCodePoint$1.apply(
|
|
1817
|
+
var start_1 = parseInt(fromCodePoint$1.apply(undefined, digits.map(function (digit) { return (digit === QUESTION_MARK ? ZERO : digit); })), 16);
|
|
1818
|
+
var end = parseInt(fromCodePoint$1.apply(undefined, digits.map(function (digit) { return (digit === QUESTION_MARK ? F : digit); })), 16);
|
|
1819
1819
|
return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start_1, end: end };
|
|
1820
1820
|
}
|
|
1821
|
-
var start = parseInt(fromCodePoint$1.apply(
|
|
1821
|
+
var start = parseInt(fromCodePoint$1.apply(undefined, digits), 16);
|
|
1822
1822
|
if (this.peekCodePoint(0) === HYPHEN_MINUS && isHex(this.peekCodePoint(1))) {
|
|
1823
1823
|
this.consumeCodePoint();
|
|
1824
1824
|
codePoint = this.consumeCodePoint();
|
|
@@ -1827,7 +1827,7 @@ var Tokenizer = /** @class */ (function () {
|
|
|
1827
1827
|
endDigits.push(codePoint);
|
|
1828
1828
|
codePoint = this.consumeCodePoint();
|
|
1829
1829
|
}
|
|
1830
|
-
var end = parseInt(fromCodePoint$1.apply(
|
|
1830
|
+
var end = parseInt(fromCodePoint$1.apply(undefined, endDigits), 16);
|
|
1831
1831
|
return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start, end: end };
|
|
1832
1832
|
}
|
|
1833
1833
|
else {
|
|
@@ -1868,13 +1868,13 @@ var Tokenizer = /** @class */ (function () {
|
|
|
1868
1868
|
while (true) {
|
|
1869
1869
|
var codePoint = this.consumeCodePoint();
|
|
1870
1870
|
if (codePoint === EOF || codePoint === RIGHT_PARENTHESIS) {
|
|
1871
|
-
return { type: 22 /* URL_TOKEN */, value: fromCodePoint$1.apply(
|
|
1871
|
+
return { type: 22 /* URL_TOKEN */, value: fromCodePoint$1.apply(undefined, value) };
|
|
1872
1872
|
}
|
|
1873
1873
|
else if (isWhiteSpace(codePoint)) {
|
|
1874
1874
|
this.consumeWhiteSpace();
|
|
1875
1875
|
if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
|
|
1876
1876
|
this.consumeCodePoint();
|
|
1877
|
-
return { type: 22 /* URL_TOKEN */, value: fromCodePoint$1.apply(
|
|
1877
|
+
return { type: 22 /* URL_TOKEN */, value: fromCodePoint$1.apply(undefined, value) };
|
|
1878
1878
|
}
|
|
1879
1879
|
this.consumeBadUrlRemnants();
|
|
1880
1880
|
return BAD_URL_TOKEN;
|
|
@@ -1921,7 +1921,7 @@ var Tokenizer = /** @class */ (function () {
|
|
|
1921
1921
|
var value = '';
|
|
1922
1922
|
while (count > 0) {
|
|
1923
1923
|
var amount = Math.min(SLICE_STACK_SIZE, count);
|
|
1924
|
-
value += fromCodePoint$1.apply(
|
|
1924
|
+
value += fromCodePoint$1.apply(undefined, this._value.splice(0, amount));
|
|
1925
1925
|
count -= amount;
|
|
1926
1926
|
}
|
|
1927
1927
|
this._value.shift();
|
|
@@ -4252,8 +4252,8 @@ var CSSParsedDeclaration = /** @class */ (function () {
|
|
|
4252
4252
|
this.paintOrder = parse(context, paintOrder, declaration.paintOrder);
|
|
4253
4253
|
this.position = parse(context, position, declaration.position);
|
|
4254
4254
|
this.textAlign = parse(context, textAlign, declaration.textAlign);
|
|
4255
|
-
this.textDecorationColor = parse(context, textDecorationColor, (_a = declaration.textDecorationColor) !== null && _a !==
|
|
4256
|
-
this.textDecorationLine = parse(context, textDecorationLine, (_b = declaration.textDecorationLine) !== null && _b !==
|
|
4255
|
+
this.textDecorationColor = parse(context, textDecorationColor, (_a = declaration.textDecorationColor) !== null && _a !== undefined ? _a : declaration.color);
|
|
4256
|
+
this.textDecorationLine = parse(context, textDecorationLine, (_b = declaration.textDecorationLine) !== null && _b !== undefined ? _b : declaration.textDecoration);
|
|
4257
4257
|
this.textShadow = parse(context, textShadow, declaration.textShadow);
|
|
4258
4258
|
this.textTransform = parse(context, textTransform, declaration.textTransform);
|
|
4259
4259
|
this.transform = parse(context, transform$1, declaration.transform);
|
|
@@ -5022,7 +5022,7 @@ var createRange = function (node, offset, length) {
|
|
|
5022
5022
|
var segmentGraphemes = function (value) {
|
|
5023
5023
|
if (FEATURES.SUPPORT_NATIVE_TEXT_SEGMENTATION) {
|
|
5024
5024
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5025
|
-
var segmenter = new Intl.Segmenter(
|
|
5025
|
+
var segmenter = new Intl.Segmenter(undefined, { granularity: 'grapheme' });
|
|
5026
5026
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5027
5027
|
return Array.from(segmenter.segment(value)).map(function (segment) { return segment.segment; });
|
|
5028
5028
|
}
|
|
@@ -5031,7 +5031,7 @@ var segmentGraphemes = function (value) {
|
|
|
5031
5031
|
var segmentWords = function (value, styles) {
|
|
5032
5032
|
if (FEATURES.SUPPORT_NATIVE_TEXT_SEGMENTATION) {
|
|
5033
5033
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5034
|
-
var segmenter = new Intl.Segmenter(
|
|
5034
|
+
var segmenter = new Intl.Segmenter(undefined, {
|
|
5035
5035
|
granularity: 'word'
|
|
5036
5036
|
});
|
|
5037
5037
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -5306,7 +5306,7 @@ var IFrameElementContainer = /** @class */ (function (_super) {
|
|
|
5306
5306
|
|
|
5307
5307
|
var LIST_OWNERS = ['OL', 'UL', 'MENU'];
|
|
5308
5308
|
var parseNodeTree = function (context, node, parent, root) {
|
|
5309
|
-
for (var childNode = node.firstChild, nextNode =
|
|
5309
|
+
for (var childNode = node.firstChild, nextNode = undefined; childNode; childNode = nextNode) {
|
|
5310
5310
|
nextNode = childNode.nextSibling;
|
|
5311
5311
|
if (isTextNode(childNode) && childNode.data.trim().length > 0) {
|
|
5312
5312
|
parent.textNodes.push(new TextContainer(context, childNode, parent.styles));
|
|
@@ -5632,7 +5632,7 @@ var createCounterStyleFromRange = function (value, codePointRangeStart, codePoin
|
|
|
5632
5632
|
suffix));
|
|
5633
5633
|
};
|
|
5634
5634
|
var createCounterStyleFromSymbols = function (value, symbols, suffix) {
|
|
5635
|
-
if (suffix ===
|
|
5635
|
+
if (suffix === undefined) { suffix = '. '; }
|
|
5636
5636
|
var codePointRangeLength = symbols.length;
|
|
5637
5637
|
return (createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, false, function (codePoint) { return symbols[Math.floor(codePoint % codePointRangeLength)]; }) + suffix);
|
|
5638
5638
|
};
|
|
@@ -5805,7 +5805,7 @@ var DocumentCloner = /** @class */ (function () {
|
|
|
5805
5805
|
/* Chrome doesn't detect relative background-images assigned in inline <style> sheets when fetched through getComputedStyle
|
|
5806
5806
|
if window url is about:blank, we can assign the url to current by writing onto the document
|
|
5807
5807
|
*/
|
|
5808
|
-
var iframeLoad = iframeLoader(iframe).then(function () { return __awaiter(_this,
|
|
5808
|
+
var iframeLoad = iframeLoader(iframe).then(function () { return __awaiter(_this, undefined, undefined, function () {
|
|
5809
5809
|
var onclone, referenceElement;
|
|
5810
5810
|
return __generator(this, function (_a) {
|
|
5811
5811
|
switch (_a.label) {
|
|
@@ -6305,7 +6305,7 @@ var Cache = /** @class */ (function () {
|
|
|
6305
6305
|
return this._cache[src];
|
|
6306
6306
|
};
|
|
6307
6307
|
Cache.prototype.loadImage = function (key) {
|
|
6308
|
-
return __awaiter(this,
|
|
6308
|
+
return __awaiter(this, undefined, undefined, function () {
|
|
6309
6309
|
var isSameOrigin, useCORS, useProxy, src;
|
|
6310
6310
|
var _this = this;
|
|
6311
6311
|
return __generator(this, function (_a) {
|
|
@@ -7243,7 +7243,7 @@ var CanvasRenderer = /** @class */ (function (_super) {
|
|
|
7243
7243
|
this.ctx.restore();
|
|
7244
7244
|
};
|
|
7245
7245
|
CanvasRenderer.prototype.renderStack = function (stack) {
|
|
7246
|
-
return __awaiter(this,
|
|
7246
|
+
return __awaiter(this, undefined, undefined, function () {
|
|
7247
7247
|
var styles;
|
|
7248
7248
|
return __generator(this, function (_a) {
|
|
7249
7249
|
switch (_a.label) {
|
|
@@ -7260,7 +7260,7 @@ var CanvasRenderer = /** @class */ (function (_super) {
|
|
|
7260
7260
|
});
|
|
7261
7261
|
};
|
|
7262
7262
|
CanvasRenderer.prototype.renderNode = function (paint) {
|
|
7263
|
-
return __awaiter(this,
|
|
7263
|
+
return __awaiter(this, undefined, undefined, function () {
|
|
7264
7264
|
return __generator(this, function (_a) {
|
|
7265
7265
|
switch (_a.label) {
|
|
7266
7266
|
case 0:
|
|
@@ -7308,7 +7308,7 @@ var CanvasRenderer = /** @class */ (function (_super) {
|
|
|
7308
7308
|
];
|
|
7309
7309
|
};
|
|
7310
7310
|
CanvasRenderer.prototype.renderTextNode = function (text, styles) {
|
|
7311
|
-
return __awaiter(this,
|
|
7311
|
+
return __awaiter(this, undefined, undefined, function () {
|
|
7312
7312
|
var _a, font, fontFamily, fontSize, _b, baseline, middle, paintOrder;
|
|
7313
7313
|
var _this = this;
|
|
7314
7314
|
return __generator(this, function (_c) {
|
|
@@ -7394,7 +7394,7 @@ var CanvasRenderer = /** @class */ (function (_super) {
|
|
|
7394
7394
|
}
|
|
7395
7395
|
};
|
|
7396
7396
|
CanvasRenderer.prototype.renderNodeContent = function (paint) {
|
|
7397
|
-
return __awaiter(this,
|
|
7397
|
+
return __awaiter(this, undefined, undefined, function () {
|
|
7398
7398
|
var container, curves, styles, _i, _a, child, image, image, iframeRenderer, canvas, size, _b, fontFamily, fontSize, baseline, bounds, x, textBounds, img, image, url, fontFamily, bounds;
|
|
7399
7399
|
return __generator(this, function (_c) {
|
|
7400
7400
|
switch (_c.label) {
|
|
@@ -7529,7 +7529,7 @@ var CanvasRenderer = /** @class */ (function (_super) {
|
|
|
7529
7529
|
if (!(container.styles.listStyleImage !== null)) return [3 /*break*/, 19];
|
|
7530
7530
|
img = container.styles.listStyleImage;
|
|
7531
7531
|
if (!(img.type === 0 /* URL */)) return [3 /*break*/, 18];
|
|
7532
|
-
image =
|
|
7532
|
+
image = undefined;
|
|
7533
7533
|
url = img.url;
|
|
7534
7534
|
_c.label = 15;
|
|
7535
7535
|
case 15:
|
|
@@ -7563,7 +7563,7 @@ var CanvasRenderer = /** @class */ (function (_super) {
|
|
|
7563
7563
|
});
|
|
7564
7564
|
};
|
|
7565
7565
|
CanvasRenderer.prototype.renderStackContent = function (stack) {
|
|
7566
|
-
return __awaiter(this,
|
|
7566
|
+
return __awaiter(this, undefined, undefined, function () {
|
|
7567
7567
|
var _i, _a, child, _b, _c, child, _d, _e, child, _f, _g, child, _h, _j, child, _k, _l, child, _m, _o, child;
|
|
7568
7568
|
return __generator(this, function (_p) {
|
|
7569
7569
|
switch (_p.label) {
|
|
@@ -7720,7 +7720,7 @@ var CanvasRenderer = /** @class */ (function (_super) {
|
|
|
7720
7720
|
if (image.width === width && image.height === height) {
|
|
7721
7721
|
return image;
|
|
7722
7722
|
}
|
|
7723
|
-
var ownerDocument = (_a = this.canvas.ownerDocument) !== null && _a !==
|
|
7723
|
+
var ownerDocument = (_a = this.canvas.ownerDocument) !== null && _a !== undefined ? _a : document;
|
|
7724
7724
|
var canvas = ownerDocument.createElement('canvas');
|
|
7725
7725
|
canvas.width = Math.max(1, width);
|
|
7726
7726
|
canvas.height = Math.max(1, height);
|
|
@@ -7729,7 +7729,7 @@ var CanvasRenderer = /** @class */ (function (_super) {
|
|
|
7729
7729
|
return canvas;
|
|
7730
7730
|
};
|
|
7731
7731
|
CanvasRenderer.prototype.renderBackgroundImage = function (container) {
|
|
7732
|
-
return __awaiter(this,
|
|
7732
|
+
return __awaiter(this, undefined, undefined, function () {
|
|
7733
7733
|
var index, _loop_1, this_1, _i, _a, backgroundImage;
|
|
7734
7734
|
return __generator(this, function (_b) {
|
|
7735
7735
|
switch (_b.label) {
|
|
@@ -7741,7 +7741,7 @@ var CanvasRenderer = /** @class */ (function (_super) {
|
|
|
7741
7741
|
switch (_h.label) {
|
|
7742
7742
|
case 0:
|
|
7743
7743
|
if (!(backgroundImage.type === 0 /* URL */)) return [3 /*break*/, 5];
|
|
7744
|
-
image =
|
|
7744
|
+
image = undefined;
|
|
7745
7745
|
url = backgroundImage.url;
|
|
7746
7746
|
_h.label = 1;
|
|
7747
7747
|
case 1:
|
|
@@ -7844,7 +7844,7 @@ var CanvasRenderer = /** @class */ (function (_super) {
|
|
|
7844
7844
|
});
|
|
7845
7845
|
};
|
|
7846
7846
|
CanvasRenderer.prototype.renderSolidBorder = function (color, side, curvePoints) {
|
|
7847
|
-
return __awaiter(this,
|
|
7847
|
+
return __awaiter(this, undefined, undefined, function () {
|
|
7848
7848
|
return __generator(this, function (_a) {
|
|
7849
7849
|
this.path(parsePathForBorder(curvePoints, side));
|
|
7850
7850
|
this.ctx.fillStyle = asString(color);
|
|
@@ -7854,7 +7854,7 @@ var CanvasRenderer = /** @class */ (function (_super) {
|
|
|
7854
7854
|
});
|
|
7855
7855
|
};
|
|
7856
7856
|
CanvasRenderer.prototype.renderDoubleBorder = function (color, width, side, curvePoints) {
|
|
7857
|
-
return __awaiter(this,
|
|
7857
|
+
return __awaiter(this, undefined, undefined, function () {
|
|
7858
7858
|
var outerPaths, innerPaths;
|
|
7859
7859
|
return __generator(this, function (_a) {
|
|
7860
7860
|
switch (_a.label) {
|
|
@@ -7878,7 +7878,7 @@ var CanvasRenderer = /** @class */ (function (_super) {
|
|
|
7878
7878
|
});
|
|
7879
7879
|
};
|
|
7880
7880
|
CanvasRenderer.prototype.renderNodeBackgroundAndBorders = function (paint) {
|
|
7881
|
-
return __awaiter(this,
|
|
7881
|
+
return __awaiter(this, undefined, undefined, function () {
|
|
7882
7882
|
var styles, hasBackground, borders, backgroundPaintingArea, side, _i, borders_1, border;
|
|
7883
7883
|
var _this = this;
|
|
7884
7884
|
return __generator(this, function (_a) {
|
|
@@ -7974,7 +7974,7 @@ var CanvasRenderer = /** @class */ (function (_super) {
|
|
|
7974
7974
|
});
|
|
7975
7975
|
};
|
|
7976
7976
|
CanvasRenderer.prototype.renderDashedDottedBorder = function (color, width, side, curvePoints, style) {
|
|
7977
|
-
return __awaiter(this,
|
|
7977
|
+
return __awaiter(this, undefined, undefined, function () {
|
|
7978
7978
|
var strokePaths, boxPaths, startX, startY, endX, endY, length, dashLength, spaceLength, useLineDash, multiplier, numberOfDashes, minSpace, maxSpace, path1, path2, path1, path2;
|
|
7979
7979
|
return __generator(this, function (_a) {
|
|
7980
7980
|
this.ctx.save();
|
|
@@ -8078,7 +8078,7 @@ var CanvasRenderer = /** @class */ (function (_super) {
|
|
|
8078
8078
|
});
|
|
8079
8079
|
};
|
|
8080
8080
|
CanvasRenderer.prototype.render = function (element) {
|
|
8081
|
-
return __awaiter(this,
|
|
8081
|
+
return __awaiter(this, undefined, undefined, function () {
|
|
8082
8082
|
var stack;
|
|
8083
8083
|
return __generator(this, function (_a) {
|
|
8084
8084
|
switch (_a.label) {
|
|
@@ -8158,7 +8158,7 @@ var ForeignObjectRenderer = /** @class */ (function (_super) {
|
|
|
8158
8158
|
return _this;
|
|
8159
8159
|
}
|
|
8160
8160
|
ForeignObjectRenderer.prototype.render = function (element) {
|
|
8161
|
-
return __awaiter(this,
|
|
8161
|
+
return __awaiter(this, undefined, undefined, function () {
|
|
8162
8162
|
var svg, img;
|
|
8163
8163
|
return __generator(this, function (_a) {
|
|
8164
8164
|
switch (_a.label) {
|
|
@@ -8275,20 +8275,20 @@ var Context = /** @class */ (function () {
|
|
|
8275
8275
|
this.windowBounds = windowBounds;
|
|
8276
8276
|
this.instanceName = "#" + Context.instanceCount++;
|
|
8277
8277
|
this.logger = new Logger({ id: this.instanceName, enabled: options.logging });
|
|
8278
|
-
this.cache = (_a = options.cache) !== null && _a !==
|
|
8278
|
+
this.cache = (_a = options.cache) !== null && _a !== undefined ? _a : new Cache(this, options);
|
|
8279
8279
|
}
|
|
8280
8280
|
Context.instanceCount = 1;
|
|
8281
8281
|
return Context;
|
|
8282
8282
|
}());
|
|
8283
8283
|
|
|
8284
8284
|
var html2canvas = function (element, options) {
|
|
8285
|
-
if (options ===
|
|
8285
|
+
if (options === undefined) { options = {}; }
|
|
8286
8286
|
return renderElement(element, options);
|
|
8287
8287
|
};
|
|
8288
8288
|
if (typeof window !== 'undefined') {
|
|
8289
8289
|
CacheStorage.setContext(window);
|
|
8290
8290
|
}
|
|
8291
|
-
var renderElement = function (element, opts) { return __awaiter(
|
|
8291
|
+
var renderElement = function (element, opts) { return __awaiter(undefined, undefined, undefined, function () {
|
|
8292
8292
|
var ownerDocument, defaultView, resourceOptions, contextOptions, windowOptions, windowBounds, context, foreignObjectRendering, cloneOptions, documentCloner, clonedElement, container, _a, width, height, left, top, backgroundColor, renderOptions, canvas, renderer, root, renderer;
|
|
8293
8293
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
8294
8294
|
return __generator(this, function (_u) {
|
|
@@ -8306,23 +8306,23 @@ var renderElement = function (element, opts) { return __awaiter(void 0, void 0,
|
|
|
8306
8306
|
throw new Error("Document is not attached to a Window");
|
|
8307
8307
|
}
|
|
8308
8308
|
resourceOptions = {
|
|
8309
|
-
allowTaint: (_b = opts.allowTaint) !== null && _b !==
|
|
8310
|
-
imageTimeout: (_c = opts.imageTimeout) !== null && _c !==
|
|
8309
|
+
allowTaint: (_b = opts.allowTaint) !== null && _b !== undefined ? _b : false,
|
|
8310
|
+
imageTimeout: (_c = opts.imageTimeout) !== null && _c !== undefined ? _c : 15000,
|
|
8311
8311
|
proxy: opts.proxy,
|
|
8312
|
-
useCORS: (_d = opts.useCORS) !== null && _d !==
|
|
8312
|
+
useCORS: (_d = opts.useCORS) !== null && _d !== undefined ? _d : false
|
|
8313
8313
|
};
|
|
8314
|
-
contextOptions = __assign({ logging: (_e = opts.logging) !== null && _e !==
|
|
8314
|
+
contextOptions = __assign({ logging: (_e = opts.logging) !== null && _e !== undefined ? _e : true, cache: opts.cache }, resourceOptions);
|
|
8315
8315
|
windowOptions = {
|
|
8316
|
-
windowWidth: (_f = opts.windowWidth) !== null && _f !==
|
|
8317
|
-
windowHeight: (_g = opts.windowHeight) !== null && _g !==
|
|
8318
|
-
scrollX: (_h = opts.scrollX) !== null && _h !==
|
|
8319
|
-
scrollY: (_j = opts.scrollY) !== null && _j !==
|
|
8316
|
+
windowWidth: (_f = opts.windowWidth) !== null && _f !== undefined ? _f : defaultView.innerWidth,
|
|
8317
|
+
windowHeight: (_g = opts.windowHeight) !== null && _g !== undefined ? _g : defaultView.innerHeight,
|
|
8318
|
+
scrollX: (_h = opts.scrollX) !== null && _h !== undefined ? _h : defaultView.pageXOffset,
|
|
8319
|
+
scrollY: (_j = opts.scrollY) !== null && _j !== undefined ? _j : defaultView.pageYOffset
|
|
8320
8320
|
};
|
|
8321
8321
|
windowBounds = new Bounds(windowOptions.scrollX, windowOptions.scrollY, windowOptions.windowWidth, windowOptions.windowHeight);
|
|
8322
8322
|
context = new Context(contextOptions, windowBounds);
|
|
8323
|
-
foreignObjectRendering = (_k = opts.foreignObjectRendering) !== null && _k !==
|
|
8323
|
+
foreignObjectRendering = (_k = opts.foreignObjectRendering) !== null && _k !== undefined ? _k : false;
|
|
8324
8324
|
cloneOptions = {
|
|
8325
|
-
allowTaint: (_l = opts.allowTaint) !== null && _l !==
|
|
8325
|
+
allowTaint: (_l = opts.allowTaint) !== null && _l !== undefined ? _l : false,
|
|
8326
8326
|
onclone: opts.onclone,
|
|
8327
8327
|
ignoreElements: opts.ignoreElements,
|
|
8328
8328
|
inlineImages: foreignObjectRendering,
|
|
@@ -8344,11 +8344,11 @@ var renderElement = function (element, opts) { return __awaiter(void 0, void 0,
|
|
|
8344
8344
|
renderOptions = {
|
|
8345
8345
|
canvas: opts.canvas,
|
|
8346
8346
|
backgroundColor: backgroundColor,
|
|
8347
|
-
scale: (_o = (_m = opts.scale) !== null && _m !==
|
|
8348
|
-
x: ((_p = opts.x) !== null && _p !==
|
|
8349
|
-
y: ((_q = opts.y) !== null && _q !==
|
|
8350
|
-
width: (_r = opts.width) !== null && _r !==
|
|
8351
|
-
height: (_s = opts.height) !== null && _s !==
|
|
8347
|
+
scale: (_o = (_m = opts.scale) !== null && _m !== undefined ? _m : defaultView.devicePixelRatio) !== null && _o !== undefined ? _o : 1,
|
|
8348
|
+
x: ((_p = opts.x) !== null && _p !== undefined ? _p : 0) + left,
|
|
8349
|
+
y: ((_q = opts.y) !== null && _q !== undefined ? _q : 0) + top,
|
|
8350
|
+
width: (_r = opts.width) !== null && _r !== undefined ? _r : Math.ceil(width),
|
|
8351
|
+
height: (_s = opts.height) !== null && _s !== undefined ? _s : Math.ceil(height)
|
|
8352
8352
|
};
|
|
8353
8353
|
if (!foreignObjectRendering) return [3 /*break*/, 3];
|
|
8354
8354
|
context.logger.debug("Document cloned, using foreign object rendering");
|
|
@@ -8371,7 +8371,7 @@ var renderElement = function (element, opts) { return __awaiter(void 0, void 0,
|
|
|
8371
8371
|
canvas = _u.sent();
|
|
8372
8372
|
_u.label = 5;
|
|
8373
8373
|
case 5:
|
|
8374
|
-
if ((_t = opts.removeContainer) !== null && _t !==
|
|
8374
|
+
if ((_t = opts.removeContainer) !== null && _t !== undefined ? _t : true) {
|
|
8375
8375
|
if (!DocumentCloner.destroy(container)) {
|
|
8376
8376
|
context.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore");
|
|
8377
8377
|
}
|
|
@@ -8674,35 +8674,35 @@ var browser = /*#__PURE__*/Object.freeze({
|
|
|
8674
8674
|
class BrowserUse {
|
|
8675
8675
|
constructor() {
|
|
8676
8676
|
this.name = 'browser_use';
|
|
8677
|
-
this.description = `Use structured commands to interact with the browser, manipulating page elements through screenshots and webpage element extraction.
|
|
8678
|
-
* This is a browser GUI interface where you need to analyze webpages by taking screenshots and extracting page element structures, and specify action sequences to complete designated tasks.
|
|
8679
|
-
* Before any operation, you must first call the \`screenshot_extract_element\` command, which will return the browser page screenshot and structured element information, both specially processed.
|
|
8680
|
-
* ELEMENT INTERACTION:
|
|
8681
|
-
- Only use indexes that exist in the provided element list
|
|
8682
|
-
- Each element has a unique index number (e.g., "[33]:<button>")
|
|
8683
|
-
- Elements marked with "[]:" are non-interactive (for context only)
|
|
8684
|
-
* NAVIGATION & ERROR HANDLING:
|
|
8685
|
-
- If no suitable elements exist, use other functions to complete the task
|
|
8686
|
-
- If stuck, try alternative approaches
|
|
8687
|
-
- Handle popups/cookies by accepting or closing them
|
|
8677
|
+
this.description = `Use structured commands to interact with the browser, manipulating page elements through screenshots and webpage element extraction.
|
|
8678
|
+
* This is a browser GUI interface where you need to analyze webpages by taking screenshots and extracting page element structures, and specify action sequences to complete designated tasks.
|
|
8679
|
+
* Before any operation, you must first call the \`screenshot_extract_element\` command, which will return the browser page screenshot and structured element information, both specially processed.
|
|
8680
|
+
* ELEMENT INTERACTION:
|
|
8681
|
+
- Only use indexes that exist in the provided element list
|
|
8682
|
+
- Each element has a unique index number (e.g., "[33]:<button>")
|
|
8683
|
+
- Elements marked with "[]:" are non-interactive (for context only)
|
|
8684
|
+
* NAVIGATION & ERROR HANDLING:
|
|
8685
|
+
- If no suitable elements exist, use other functions to complete the task
|
|
8686
|
+
- If stuck, try alternative approaches
|
|
8687
|
+
- Handle popups/cookies by accepting or closing them
|
|
8688
8688
|
- Use scroll to find elements you are looking for`;
|
|
8689
8689
|
this.input_schema = {
|
|
8690
8690
|
type: 'object',
|
|
8691
8691
|
properties: {
|
|
8692
8692
|
action: {
|
|
8693
8693
|
type: 'string',
|
|
8694
|
-
description: `The action to perform. The available actions are:
|
|
8695
|
-
* \`screenshot_extract_element\`: Take a screenshot of the web page and extract operable elements.
|
|
8696
|
-
- Screenshots are used to understand page layouts, with labeled bounding boxes corresponding to element indexes. Each bounding box and its label share the same color, with labels typically positioned in the top-right corner of the box.
|
|
8697
|
-
- Screenshots help verify element positions and relationships. Labels may sometimes overlap, so extracted elements are used to verify the correct elements.
|
|
8698
|
-
- In addition to screenshots, simplified information about interactive elements is returned, with element indexes corresponding to those in the screenshots.
|
|
8699
|
-
* \`input_text\`: Enter a string in the interactive element.
|
|
8700
|
-
* \`click\`: Click to element.
|
|
8701
|
-
* \`right_click\`: Right-click on the element.
|
|
8702
|
-
* \`double_click\`: Double-click on the element.
|
|
8703
|
-
* \`scroll_to\`: Scroll to the specified element.
|
|
8704
|
-
* \`extract_content\`: Extract the text content of the current webpage.
|
|
8705
|
-
* \`get_dropdown_options\`: Get all options from a native dropdown element.
|
|
8694
|
+
description: `The action to perform. The available actions are:
|
|
8695
|
+
* \`screenshot_extract_element\`: Take a screenshot of the web page and extract operable elements.
|
|
8696
|
+
- Screenshots are used to understand page layouts, with labeled bounding boxes corresponding to element indexes. Each bounding box and its label share the same color, with labels typically positioned in the top-right corner of the box.
|
|
8697
|
+
- Screenshots help verify element positions and relationships. Labels may sometimes overlap, so extracted elements are used to verify the correct elements.
|
|
8698
|
+
- In addition to screenshots, simplified information about interactive elements is returned, with element indexes corresponding to those in the screenshots.
|
|
8699
|
+
* \`input_text\`: Enter a string in the interactive element.
|
|
8700
|
+
* \`click\`: Click to element.
|
|
8701
|
+
* \`right_click\`: Right-click on the element.
|
|
8702
|
+
* \`double_click\`: Double-click on the element.
|
|
8703
|
+
* \`scroll_to\`: Scroll to the specified element.
|
|
8704
|
+
* \`extract_content\`: Extract the text content of the current webpage.
|
|
8705
|
+
* \`get_dropdown_options\`: Get all options from a native dropdown element.
|
|
8706
8706
|
* \`select_dropdown_option\`: Select dropdown option for interactive element index by the text of the option you want to select.`,
|
|
8707
8707
|
enum: [
|
|
8708
8708
|
'screenshot_extract_element',
|
|
@@ -8831,7 +8831,7 @@ class BrowserUse {
|
|
|
8831
8831
|
}
|
|
8832
8832
|
}
|
|
8833
8833
|
catch (e) {
|
|
8834
|
-
return { success: false, error: e === null || e ===
|
|
8834
|
+
return { success: false, error: e === null || e === undefined ? undefined : e.message };
|
|
8835
8835
|
}
|
|
8836
8836
|
}
|
|
8837
8837
|
destroy(context) {
|
|
@@ -8952,7 +8952,7 @@ function extractOperableElements() {
|
|
|
8952
8952
|
return NodeFilter.FILTER_SKIP;
|
|
8953
8953
|
}
|
|
8954
8954
|
// text <= 100
|
|
8955
|
-
const text = (_a = node.innerText) === null || _a ===
|
|
8955
|
+
const text = (_a = node.innerText) === null || _a === undefined ? undefined : _a.trim();
|
|
8956
8956
|
if (isElementVisible(node) &&
|
|
8957
8957
|
text &&
|
|
8958
8958
|
text.length <= 100 &&
|
|
@@ -9057,21 +9057,21 @@ async function executeWithHtmlElement$1(context, task_prompt) {
|
|
|
9057
9057
|
let messages = [
|
|
9058
9058
|
{
|
|
9059
9059
|
role: 'user',
|
|
9060
|
-
content: `# Task
|
|
9061
|
-
Determine the operation intent based on user input, find the element ID that the user needs to operate on in the webpage HTML, and if the element does not exist, do nothing.
|
|
9062
|
-
Output JSON format, no explanation required.
|
|
9063
|
-
|
|
9064
|
-
# User input
|
|
9065
|
-
${task_prompt}
|
|
9066
|
-
|
|
9067
|
-
# Output example (when the element exists)
|
|
9068
|
-
{"elementId": "1", "operationType": "click"}
|
|
9069
|
-
|
|
9070
|
-
# Output example (when the element does not exist)
|
|
9071
|
-
{"elementId": null, "operationType": "unknown"}
|
|
9072
|
-
|
|
9073
|
-
# HTML
|
|
9074
|
-
${pseudoHtml}
|
|
9060
|
+
content: `# Task
|
|
9061
|
+
Determine the operation intent based on user input, find the element ID that the user needs to operate on in the webpage HTML, and if the element does not exist, do nothing.
|
|
9062
|
+
Output JSON format, no explanation required.
|
|
9063
|
+
|
|
9064
|
+
# User input
|
|
9065
|
+
${task_prompt}
|
|
9066
|
+
|
|
9067
|
+
# Output example (when the element exists)
|
|
9068
|
+
{"elementId": "1", "operationType": "click"}
|
|
9069
|
+
|
|
9070
|
+
# Output example (when the element does not exist)
|
|
9071
|
+
{"elementId": null, "operationType": "unknown"}
|
|
9072
|
+
|
|
9073
|
+
# HTML
|
|
9074
|
+
${pseudoHtml}
|
|
9075
9075
|
`,
|
|
9076
9076
|
},
|
|
9077
9077
|
];
|
|
@@ -9272,21 +9272,21 @@ async function executeWithHtmlElement(context, task_prompt) {
|
|
|
9272
9272
|
let messages = [
|
|
9273
9273
|
{
|
|
9274
9274
|
role: 'user',
|
|
9275
|
-
content: `# Task
|
|
9276
|
-
Find the element ID that the user needs to operate on in the webpage HTML, and if the element does not exist, do nothing.
|
|
9277
|
-
Output JSON format, no explanation required.
|
|
9278
|
-
|
|
9279
|
-
# User input
|
|
9280
|
-
${task_prompt}
|
|
9281
|
-
|
|
9282
|
-
# Output example (when the element exists)
|
|
9283
|
-
{"elementId": "1"}
|
|
9284
|
-
|
|
9285
|
-
# Output example (when the element does not exist)
|
|
9286
|
-
{"elementId": null}
|
|
9287
|
-
|
|
9288
|
-
# HTML
|
|
9289
|
-
${pseudoHtml}
|
|
9275
|
+
content: `# Task
|
|
9276
|
+
Find the element ID that the user needs to operate on in the webpage HTML, and if the element does not exist, do nothing.
|
|
9277
|
+
Output JSON format, no explanation required.
|
|
9278
|
+
|
|
9279
|
+
# User input
|
|
9280
|
+
${task_prompt}
|
|
9281
|
+
|
|
9282
|
+
# Output example (when the element exists)
|
|
9283
|
+
{"elementId": "1"}
|
|
9284
|
+
|
|
9285
|
+
# Output example (when the element does not exist)
|
|
9286
|
+
{"elementId": null}
|
|
9287
|
+
|
|
9288
|
+
# HTML
|
|
9289
|
+
${pseudoHtml}
|
|
9290
9290
|
`,
|
|
9291
9291
|
},
|
|
9292
9292
|
];
|