@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.
Files changed (300) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +139 -131
  3. package/dist/core/eko.d.ts +3 -2
  4. package/dist/extension/script/bing.js +0 -0
  5. package/dist/extension/script/build_dom_tree.js +661 -661
  6. package/dist/extension/script/common.js +0 -0
  7. package/dist/extension/script/duckduckgo.js +0 -0
  8. package/dist/extension/script/google.js +0 -0
  9. package/dist/extension/tools/cancel_workflow.d.ts +9 -0
  10. package/dist/extension/tools/get_all_tabs.d.ts +9 -0
  11. package/dist/extension/tools/index.d.ts +3 -1
  12. package/dist/extension/tools/tab_management.d.ts +1 -1
  13. package/dist/extension/utils.d.ts +1 -1
  14. package/dist/extension.cjs.js +749 -278
  15. package/dist/extension.esm.js +749 -278
  16. package/dist/extension_content_script.js +55 -55
  17. package/dist/fellou.cjs.js +18 -18
  18. package/dist/fellou.esm.js +18 -18
  19. package/dist/index.cjs.js +2034 -1609
  20. package/dist/index.d.ts +3 -1
  21. package/dist/index.esm.js +2033 -1610
  22. package/dist/jest.config.js +10 -0
  23. package/dist/jest.config.js.map +1 -0
  24. package/dist/models/action.d.ts +8 -4
  25. package/dist/models/workflow.d.ts +8 -3
  26. package/dist/nodejs/tools/index.d.ts +1 -0
  27. package/dist/nodejs.cjs.js +1832 -1623
  28. package/dist/nodejs.esm.js +1832 -1623
  29. package/dist/rollup.config.js +171 -0
  30. package/dist/rollup.config.js.map +1 -0
  31. package/dist/schemas/workflow.schema.d.ts +2 -13
  32. package/dist/script.js +10 -0
  33. package/dist/script.js.map +1 -0
  34. package/dist/services/llm/claude-provider.d.ts +2 -1
  35. package/dist/services/llm/deepseek-provider.d.ts +13 -0
  36. package/dist/services/llm/openai-provider.d.ts +2 -1
  37. package/dist/services/llm/provider-factory.d.ts +4 -0
  38. package/dist/services/llm/siliconflow-provider.d.ts +13 -0
  39. package/dist/services/parser/workflow-parser.d.ts +0 -7
  40. package/dist/services/workflow/generator.d.ts +1 -0
  41. package/dist/src/core/eko.js +99 -0
  42. package/dist/src/core/eko.js.map +1 -0
  43. package/dist/src/core/tool-registry.js +51 -0
  44. package/dist/src/core/tool-registry.js.map +1 -0
  45. package/dist/src/extension/content/index.js +409 -0
  46. package/dist/src/extension/content/index.js.map +1 -0
  47. package/dist/src/extension/core.js +29 -0
  48. package/dist/src/extension/core.js.map +1 -0
  49. package/dist/src/extension/index.js +12 -0
  50. package/dist/src/extension/index.js.map +1 -0
  51. package/dist/src/extension/script/bing.js +25 -0
  52. package/dist/src/extension/script/bing.js.map +1 -0
  53. package/dist/src/extension/script/build_dom_tree.js +585 -0
  54. package/dist/src/extension/script/build_dom_tree.js.map +1 -0
  55. package/dist/src/extension/script/common.js +203 -0
  56. package/dist/src/extension/script/common.js.map +1 -0
  57. package/dist/src/extension/script/duckduckgo.js +25 -0
  58. package/dist/src/extension/script/duckduckgo.js.map +1 -0
  59. package/dist/src/extension/script/google.js +26 -0
  60. package/dist/src/extension/script/google.js.map +1 -0
  61. package/dist/src/extension/tools/browser.js +174 -0
  62. package/dist/src/extension/tools/browser.js.map +1 -0
  63. package/dist/src/extension/tools/browser_use.js +186 -0
  64. package/dist/src/extension/tools/browser_use.js.map +1 -0
  65. package/dist/src/extension/tools/element_click.js +123 -0
  66. package/dist/src/extension/tools/element_click.js.map +1 -0
  67. package/dist/src/extension/tools/export_file.js +93 -0
  68. package/dist/src/extension/tools/export_file.js.map +1 -0
  69. package/dist/src/extension/tools/extract_content.js +38 -0
  70. package/dist/src/extension/tools/extract_content.js.map +1 -0
  71. package/dist/src/extension/tools/find_element_position.js +125 -0
  72. package/dist/src/extension/tools/find_element_position.js.map +1 -0
  73. package/dist/src/extension/tools/html_script.js +219 -0
  74. package/dist/src/extension/tools/html_script.js.map +1 -0
  75. package/dist/src/extension/tools/index.js +12 -0
  76. package/dist/src/extension/tools/index.js.map +1 -0
  77. package/dist/src/extension/tools/open_url.js +68 -0
  78. package/dist/src/extension/tools/open_url.js.map +1 -0
  79. package/dist/src/extension/tools/request_login.js +87 -0
  80. package/dist/src/extension/tools/request_login.js.map +1 -0
  81. package/dist/src/extension/tools/screenshot.js +26 -0
  82. package/dist/src/extension/tools/screenshot.js.map +1 -0
  83. package/dist/src/extension/tools/tab_management.js +160 -0
  84. package/dist/src/extension/tools/tab_management.js.map +1 -0
  85. package/dist/src/extension/tools/web_search.js +281 -0
  86. package/dist/src/extension/tools/web_search.js.map +1 -0
  87. package/dist/src/extension/utils.js +244 -0
  88. package/dist/src/extension/utils.js.map +1 -0
  89. package/dist/src/fellou/computer.js +104 -0
  90. package/dist/src/fellou/computer.js.map +1 -0
  91. package/dist/src/fellou/index.js +7 -0
  92. package/dist/src/fellou/index.js.map +1 -0
  93. package/dist/src/fellou/tools/computer_use.js +111 -0
  94. package/dist/src/fellou/tools/computer_use.js.map +1 -0
  95. package/dist/src/index.js +9 -0
  96. package/dist/src/index.js.map +1 -0
  97. package/dist/src/models/action.js +364 -0
  98. package/dist/src/models/action.js.map +1 -0
  99. package/dist/src/models/workflow.js +120 -0
  100. package/dist/src/models/workflow.js.map +1 -0
  101. package/dist/src/nodejs/core.js +18 -0
  102. package/dist/src/nodejs/core.js.map +1 -0
  103. package/dist/src/nodejs/index.js +6 -0
  104. package/dist/src/nodejs/index.js.map +1 -0
  105. package/dist/src/nodejs/script/build_dom_tree.js +586 -0
  106. package/dist/src/nodejs/script/build_dom_tree.js.map +1 -0
  107. package/dist/src/nodejs/tools/browser_use.js +458 -0
  108. package/dist/src/nodejs/tools/browser_use.js.map +1 -0
  109. package/dist/src/nodejs/tools/command_execute.js +65 -0
  110. package/dist/src/nodejs/tools/command_execute.js.map +1 -0
  111. package/dist/src/nodejs/tools/file_read.js +45 -0
  112. package/dist/src/nodejs/tools/file_read.js.map +1 -0
  113. package/dist/src/nodejs/tools/file_write.js +95 -0
  114. package/dist/src/nodejs/tools/file_write.js.map +1 -0
  115. package/dist/src/nodejs/tools/index.js +5 -0
  116. package/dist/src/nodejs/tools/index.js.map +1 -0
  117. package/dist/src/schemas/workflow.schema.js +64 -0
  118. package/dist/src/schemas/workflow.schema.js.map +1 -0
  119. package/dist/src/services/llm/claude-provider.js +140 -0
  120. package/dist/src/services/llm/claude-provider.js.map +1 -0
  121. package/dist/src/services/llm/deepseek-provider.js +432 -0
  122. package/dist/src/services/llm/deepseek-provider.js.map +1 -0
  123. package/dist/src/services/llm/glm-provider.js +317 -0
  124. package/dist/src/services/llm/glm-provider.js.map +1 -0
  125. package/dist/src/services/llm/openai-provider copy.js +317 -0
  126. package/dist/src/services/llm/openai-provider copy.js.map +1 -0
  127. package/dist/src/services/llm/openai-provider.js +317 -0
  128. package/dist/src/services/llm/openai-provider.js.map +1 -0
  129. package/dist/src/services/parser/workflow-parser.js +208 -0
  130. package/dist/src/services/parser/workflow-parser.js.map +1 -0
  131. package/dist/src/services/workflow/generator.js +105 -0
  132. package/dist/src/services/workflow/generator.js.map +1 -0
  133. package/dist/src/services/workflow/templates.js +42 -0
  134. package/dist/src/services/workflow/templates.js.map +1 -0
  135. package/dist/src/types/action.types.js +2 -0
  136. package/dist/src/types/action.types.js.map +1 -0
  137. package/dist/src/types/eko.types.js +2 -0
  138. package/dist/src/types/eko.types.js.map +1 -0
  139. package/dist/src/types/index.js +6 -0
  140. package/dist/src/types/index.js.map +1 -0
  141. package/dist/src/types/llm.types.js +2 -0
  142. package/dist/src/types/llm.types.js.map +1 -0
  143. package/dist/src/types/parser.types.js +2 -0
  144. package/dist/src/types/parser.types.js.map +1 -0
  145. package/dist/src/types/tools.types.js +2 -0
  146. package/dist/src/types/tools.types.js.map +1 -0
  147. package/dist/src/types/workflow.types.js +3 -0
  148. package/dist/src/types/workflow.types.js.map +1 -0
  149. package/dist/src/web/core.js +18 -0
  150. package/dist/src/web/core.js.map +1 -0
  151. package/dist/src/web/index.js +9 -0
  152. package/dist/src/web/index.js.map +1 -0
  153. package/dist/src/web/script/build_dom_tree.js +584 -0
  154. package/dist/src/web/script/build_dom_tree.js.map +1 -0
  155. package/dist/src/web/tools/browser.js +249 -0
  156. package/dist/src/web/tools/browser.js.map +1 -0
  157. package/dist/src/web/tools/browser_use.js +176 -0
  158. package/dist/src/web/tools/browser_use.js.map +1 -0
  159. package/dist/src/web/tools/element_click.js +121 -0
  160. package/dist/src/web/tools/element_click.js.map +1 -0
  161. package/dist/src/web/tools/export_file.js +74 -0
  162. package/dist/src/web/tools/export_file.js.map +1 -0
  163. package/dist/src/web/tools/extract_content.js +24 -0
  164. package/dist/src/web/tools/extract_content.js.map +1 -0
  165. package/dist/src/web/tools/find_element_position.js +121 -0
  166. package/dist/src/web/tools/find_element_position.js.map +1 -0
  167. package/dist/src/web/tools/html_script.js +219 -0
  168. package/dist/src/web/tools/html_script.js.map +1 -0
  169. package/dist/src/web/tools/index.js +8 -0
  170. package/dist/src/web/tools/index.js.map +1 -0
  171. package/dist/src/web/tools/screenshot.js +24 -0
  172. package/dist/src/web/tools/screenshot.js.map +1 -0
  173. package/dist/test/integration/claude-provider.test.js +170 -0
  174. package/dist/test/integration/claude-provider.test.js.map +1 -0
  175. package/dist/test/integration/deepseek-provider.test.js +171 -0
  176. package/dist/test/integration/deepseek-provider.test.js.map +1 -0
  177. package/dist/test/integration/glm-provider.test.js +173 -0
  178. package/dist/test/integration/glm-provider.test.js.map +1 -0
  179. package/dist/test/integration/openai-provider.test copy.js +170 -0
  180. package/dist/test/integration/openai-provider.test copy.js.map +1 -0
  181. package/dist/test/integration/openai-provider.test.js +170 -0
  182. package/dist/test/integration/openai-provider.test.js.map +1 -0
  183. package/dist/test/integration/qwen-provider.js +170 -0
  184. package/dist/test/integration/qwen-provider.js.map +1 -0
  185. package/dist/test/integration/qwen-provider.test copy.js +170 -0
  186. package/dist/test/integration/qwen-provider.test copy.js.map +1 -0
  187. package/dist/test/integration/qwen-provider.test.js +170 -0
  188. package/dist/test/integration/qwen-provider.test.js.map +1 -0
  189. package/dist/test/integration/workflow.execution.test.js +152 -0
  190. package/dist/test/integration/workflow.execution.test.js.map +1 -0
  191. package/dist/test/integration/workflow.generation-and-execution.test.js +131 -0
  192. package/dist/test/integration/workflow.generation-and-execution.test.js.map +1 -0
  193. package/dist/test/integration/workflow.generator.test.js +207 -0
  194. package/dist/test/integration/workflow.generator.test.js.map +1 -0
  195. package/dist/test/unit/action.test.js +186 -0
  196. package/dist/test/unit/action.test.js.map +1 -0
  197. package/dist/test/unit/tool-registry.test.js +99 -0
  198. package/dist/test/unit/tool-registry.test.js.map +1 -0
  199. package/dist/test/unit/workflow-parser.test.js +189 -0
  200. package/dist/test/unit/workflow-parser.test.js.map +1 -0
  201. package/dist/test/unit/workflow.test.js +102 -0
  202. package/dist/test/unit/workflow.test.js.map +1 -0
  203. package/dist/types/action.types.d.ts +8 -3
  204. package/dist/types/jest.config.d.ts +10 -0
  205. package/dist/types/rollup.config.d.ts +16 -0
  206. package/dist/types/script.d.ts +1 -0
  207. package/dist/types/src/core/eko.d.ts +20 -0
  208. package/dist/types/src/core/tool-registry.d.ts +13 -0
  209. package/dist/types/src/extension/content/index.d.ts +16 -0
  210. package/dist/types/src/extension/core.d.ts +11 -0
  211. package/dist/types/src/extension/index.d.ts +7 -0
  212. package/dist/types/src/extension/script/bing.d.ts +0 -0
  213. package/dist/types/src/extension/script/build_dom_tree.d.ts +38 -0
  214. package/dist/types/src/extension/script/common.d.ts +0 -0
  215. package/dist/types/src/extension/script/duckduckgo.d.ts +0 -0
  216. package/dist/types/src/extension/script/google.d.ts +0 -0
  217. package/dist/types/src/extension/tools/browser.d.ts +22 -0
  218. package/dist/types/src/extension/tools/browser_use.d.ts +19 -0
  219. package/dist/types/src/extension/tools/element_click.d.ts +12 -0
  220. package/dist/types/src/extension/tools/export_file.d.ts +18 -0
  221. package/dist/types/src/extension/tools/extract_content.d.ts +18 -0
  222. package/dist/types/src/extension/tools/find_element_position.d.ts +12 -0
  223. package/dist/types/src/extension/tools/html_script.d.ts +10 -0
  224. package/dist/types/src/extension/tools/index.d.ts +11 -0
  225. package/dist/types/src/extension/tools/open_url.d.ts +18 -0
  226. package/dist/{extension/tools/form_autofill.d.ts → types/src/extension/tools/request_login.d.ts} +3 -4
  227. package/dist/types/src/extension/tools/screenshot.d.ts +18 -0
  228. package/dist/types/src/extension/tools/tab_management.d.ts +19 -0
  229. package/dist/types/src/extension/tools/web_search.d.ts +18 -0
  230. package/dist/types/src/extension/utils.d.ts +31 -0
  231. package/dist/types/src/fellou/computer.d.ts +20 -0
  232. package/dist/types/src/fellou/index.d.ts +6 -0
  233. package/dist/types/src/fellou/tools/computer_use.d.ts +18 -0
  234. package/dist/types/src/index.d.ts +8 -0
  235. package/dist/types/src/models/action.d.ts +22 -0
  236. package/dist/types/src/models/workflow.d.ts +16 -0
  237. package/dist/types/src/nodejs/core.d.ts +2 -0
  238. package/dist/types/src/nodejs/index.d.ts +3 -0
  239. package/dist/types/src/nodejs/script/build_dom_tree.d.ts +1 -0
  240. package/dist/types/src/nodejs/tools/browser_use.d.ts +28 -0
  241. package/dist/types/src/nodejs/tools/command_execute.d.ts +12 -0
  242. package/dist/types/src/nodejs/tools/file_read.d.ts +11 -0
  243. package/dist/types/src/nodejs/tools/file_write.d.ts +15 -0
  244. package/dist/types/src/nodejs/tools/index.d.ts +4 -0
  245. package/dist/types/src/schemas/workflow.schema.d.ts +88 -0
  246. package/dist/types/src/services/llm/claude-provider.d.ts +11 -0
  247. package/dist/types/src/services/llm/deepseek-provider.d.ts +15 -0
  248. package/dist/types/src/services/llm/glm-provider.d.ts +11 -0
  249. package/dist/types/src/services/llm/openai-provider copy.d.ts +11 -0
  250. package/dist/types/src/services/llm/openai-provider.d.ts +11 -0
  251. package/dist/types/src/services/parser/workflow-parser.d.ts +29 -0
  252. package/dist/types/src/services/workflow/generator.d.ts +13 -0
  253. package/dist/types/src/services/workflow/templates.d.ts +8 -0
  254. package/dist/types/src/types/action.types.d.ts +38 -0
  255. package/dist/types/src/types/eko.types.d.ts +21 -0
  256. package/dist/types/src/types/index.d.ts +5 -0
  257. package/dist/types/src/types/llm.types.d.ts +54 -0
  258. package/dist/types/src/types/parser.types.d.ts +9 -0
  259. package/dist/types/src/types/tools.types.d.ts +88 -0
  260. package/dist/types/src/types/workflow.types.d.ts +39 -0
  261. package/dist/types/src/web/core.d.ts +2 -0
  262. package/dist/types/src/web/index.d.ts +5 -0
  263. package/dist/types/src/web/script/build_dom_tree.d.ts +10 -0
  264. package/dist/types/src/web/tools/browser.d.ts +21 -0
  265. package/dist/types/src/web/tools/browser_use.d.ts +19 -0
  266. package/dist/types/src/web/tools/element_click.d.ts +12 -0
  267. package/dist/types/src/web/tools/export_file.d.ts +18 -0
  268. package/dist/types/src/web/tools/extract_content.d.ts +17 -0
  269. package/dist/types/src/web/tools/find_element_position.d.ts +12 -0
  270. package/dist/types/src/web/tools/html_script.d.ts +10 -0
  271. package/dist/types/src/web/tools/index.d.ts +7 -0
  272. package/dist/types/src/web/tools/screenshot.d.ts +18 -0
  273. package/dist/types/test/integration/claude-provider.test.d.ts +1 -0
  274. package/dist/types/test/integration/deepseek-provider.test.d.ts +1 -0
  275. package/dist/types/test/integration/glm-provider.test.d.ts +1 -0
  276. package/dist/types/test/integration/openai-provider.test copy.d.ts +1 -0
  277. package/dist/types/test/integration/openai-provider.test.d.ts +1 -0
  278. package/dist/types/test/integration/qwen-provider.d.ts +1 -0
  279. package/dist/types/test/integration/qwen-provider.test copy.d.ts +1 -0
  280. package/dist/types/test/integration/qwen-provider.test.d.ts +1 -0
  281. package/dist/types/test/integration/workflow.execution.test.d.ts +1 -0
  282. package/dist/types/test/integration/workflow.generation-and-execution.test.d.ts +1 -0
  283. package/dist/types/test/integration/workflow.generator.test.d.ts +1 -0
  284. package/dist/types/test/unit/action.test.d.ts +1 -0
  285. package/dist/types/test/unit/tool-registry.test.d.ts +1 -0
  286. package/dist/types/test/unit/workflow-parser.test.d.ts +1 -0
  287. package/dist/types/test/unit/workflow.test.d.ts +1 -0
  288. package/dist/types/tools.types.d.ts +44 -1
  289. package/dist/types/workflow.types.d.ts +22 -9
  290. package/dist/universal_tools/cancel_workflow.d.ts +9 -0
  291. package/dist/universal_tools/human/text.d.ts +9 -0
  292. package/dist/universal_tools/human.d.ts +30 -0
  293. package/dist/universal_tools/index.d.ts +4 -0
  294. package/dist/universal_tools/summary_workflow.d.ts +9 -0
  295. package/dist/utils/execution-logger.d.ts +69 -0
  296. package/dist/web.cjs.js +117 -117
  297. package/dist/web.esm.js +117 -117
  298. package/package.json +106 -107
  299. package/dist/fellou/tools/index.d.ts +0 -2
  300. 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 === void 0 ? void 0 : _a.length) > 0 ||
403
- ((_b = listeners.mousedown) === null || _b === void 0 ? void 0 : _b.length) > 0 ||
404
- ((_c = listeners.mouseup) === null || _c === void 0 ? void 0 : _c.length) > 0 ||
405
- ((_d = listeners.touchstart) === null || _d === void 0 ? void 0 : _d.length) > 0 ||
406
- ((_e = listeners.touchend) === null || _e === void 0 ? void 0 : _e.length) > 0);
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 === void 0 ? void 0 : _a.checkVisibility({
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 === void 0 ? void 0 : _a.call(node)) || [];
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] : void 0, done: true };
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 === void 0) { lineBreak = 'strict'; }
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(void 0, this.codePoints.slice(this.start, this.end));
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(void 0, integers), 10) : 0;
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(void 0, fraction), 10) : 0;
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(void 0, exponent), 10) : 0;
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(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? ZERO : digit); })), 16);
1818
- var end = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? F : digit); })), 16);
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(void 0, digits), 16);
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(void 0, endDigits), 16);
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(void 0, value) };
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(void 0, value) };
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(void 0, this._value.splice(0, amount));
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 !== void 0 ? _a : declaration.color);
4256
- this.textDecorationLine = parse(context, textDecorationLine, (_b = declaration.textDecorationLine) !== null && _b !== void 0 ? _b : declaration.textDecoration);
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(void 0, { granularity: 'grapheme' });
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(void 0, {
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 = void 0; childNode; childNode = 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 === void 0) { 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, void 0, void 0, function () {
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, void 0, void 0, function () {
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, void 0, void 0, function () {
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, void 0, void 0, function () {
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, void 0, void 0, function () {
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, void 0, void 0, function () {
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 = void 0;
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, void 0, void 0, function () {
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 !== void 0 ? _a : document;
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, void 0, void 0, function () {
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 = void 0;
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, void 0, void 0, function () {
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, void 0, void 0, function () {
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, void 0, void 0, function () {
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, void 0, void 0, function () {
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, void 0, void 0, function () {
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, void 0, void 0, function () {
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 !== void 0 ? _a : new Cache(this, options);
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 === void 0) { 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(void 0, void 0, void 0, function () {
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 !== void 0 ? _b : false,
8310
- imageTimeout: (_c = opts.imageTimeout) !== null && _c !== void 0 ? _c : 15000,
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 !== void 0 ? _d : false
8312
+ useCORS: (_d = opts.useCORS) !== null && _d !== undefined ? _d : false
8313
8313
  };
8314
- contextOptions = __assign({ logging: (_e = opts.logging) !== null && _e !== void 0 ? _e : true, cache: opts.cache }, resourceOptions);
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 !== void 0 ? _f : defaultView.innerWidth,
8317
- windowHeight: (_g = opts.windowHeight) !== null && _g !== void 0 ? _g : defaultView.innerHeight,
8318
- scrollX: (_h = opts.scrollX) !== null && _h !== void 0 ? _h : defaultView.pageXOffset,
8319
- scrollY: (_j = opts.scrollY) !== null && _j !== void 0 ? _j : defaultView.pageYOffset
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 !== void 0 ? _k : false;
8323
+ foreignObjectRendering = (_k = opts.foreignObjectRendering) !== null && _k !== undefined ? _k : false;
8324
8324
  cloneOptions = {
8325
- allowTaint: (_l = opts.allowTaint) !== null && _l !== void 0 ? _l : false,
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 !== void 0 ? _m : defaultView.devicePixelRatio) !== null && _o !== void 0 ? _o : 1,
8348
- x: ((_p = opts.x) !== null && _p !== void 0 ? _p : 0) + left,
8349
- y: ((_q = opts.y) !== null && _q !== void 0 ? _q : 0) + top,
8350
- width: (_r = opts.width) !== null && _r !== void 0 ? _r : Math.ceil(width),
8351
- height: (_s = opts.height) !== null && _s !== void 0 ? _s : Math.ceil(height)
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 !== void 0 ? _t : true) {
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 === void 0 ? void 0 : e.message };
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 === void 0 ? void 0 : _a.trim();
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
  ];