pokeedex 0.1.0

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 (591) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/main.yml +30 -0
  3. data/.gitignore +13 -0
  4. data/.standard.yml +9 -0
  5. data/CHANGELOG.md +5 -0
  6. data/CODE_OF_CONDUCT.md +132 -0
  7. data/Gemfile +14 -0
  8. data/Gemfile.lock +125 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +154 -0
  11. data/Rakefile +20 -0
  12. data/bin/pokeedex +85 -0
  13. data/lib/pokeedex/configuration.rb +47 -0
  14. data/lib/pokeedex/database.rb +42 -0
  15. data/lib/pokeedex/db/migrations/001_create_pokemons.rb +26 -0
  16. data/lib/pokeedex/exceptions.rb +15 -0
  17. data/lib/pokeedex/pokemon/base.rb +16 -0
  18. data/lib/pokeedex/pokemon/decorators/base.rb +112 -0
  19. data/lib/pokeedex/pokemon/model/base.rb +43 -0
  20. data/lib/pokeedex/pokemon/scrapper/base.rb +34 -0
  21. data/lib/pokeedex/pokemon/scrapper/fetchers/base.rb +123 -0
  22. data/lib/pokeedex/pokemon/scrapper/parsers/base.rb +205 -0
  23. data/lib/pokeedex/pokemon/scrapper/pokedex.rb +50 -0
  24. data/lib/pokeedex/pokemon/searcher/base.rb +59 -0
  25. data/lib/pokeedex/version.rb +5 -0
  26. data/lib/pokeedex.rb +55 -0
  27. data/node_modules/.bin/playwright +1 -0
  28. data/node_modules/.bin/playwright-core +1 -0
  29. data/node_modules/.yarn-integrity +22 -0
  30. data/node_modules/@playwright/test/LICENSE +202 -0
  31. data/node_modules/@playwright/test/NOTICE +5 -0
  32. data/node_modules/@playwright/test/README.md +169 -0
  33. data/node_modules/@playwright/test/cli.js +19 -0
  34. data/node_modules/@playwright/test/index.d.ts +18 -0
  35. data/node_modules/@playwright/test/index.js +17 -0
  36. data/node_modules/@playwright/test/index.mjs +18 -0
  37. data/node_modules/@playwright/test/node_modules/.bin/playwright +1 -0
  38. data/node_modules/@playwright/test/package.json +35 -0
  39. data/node_modules/@playwright/test/reporter.d.ts +17 -0
  40. data/node_modules/@playwright/test/reporter.js +17 -0
  41. data/node_modules/@playwright/test/reporter.mjs +17 -0
  42. data/node_modules/@types/node/LICENSE +21 -0
  43. data/node_modules/@types/node/README.md +15 -0
  44. data/node_modules/@types/node/assert/strict.d.ts +8 -0
  45. data/node_modules/@types/node/assert.d.ts +1040 -0
  46. data/node_modules/@types/node/async_hooks.d.ts +541 -0
  47. data/node_modules/@types/node/buffer.d.ts +2300 -0
  48. data/node_modules/@types/node/child_process.d.ts +1544 -0
  49. data/node_modules/@types/node/cluster.d.ts +578 -0
  50. data/node_modules/@types/node/console.d.ts +452 -0
  51. data/node_modules/@types/node/constants.d.ts +19 -0
  52. data/node_modules/@types/node/crypto.d.ts +4451 -0
  53. data/node_modules/@types/node/dgram.d.ts +596 -0
  54. data/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
  55. data/node_modules/@types/node/dns/promises.d.ts +476 -0
  56. data/node_modules/@types/node/dns.d.ts +865 -0
  57. data/node_modules/@types/node/dom-events.d.ts +124 -0
  58. data/node_modules/@types/node/domain.d.ts +170 -0
  59. data/node_modules/@types/node/events.d.ts +931 -0
  60. data/node_modules/@types/node/fs/promises.d.ts +1264 -0
  61. data/node_modules/@types/node/fs.d.ts +4390 -0
  62. data/node_modules/@types/node/globals.d.ts +611 -0
  63. data/node_modules/@types/node/globals.global.d.ts +1 -0
  64. data/node_modules/@types/node/http.d.ts +1921 -0
  65. data/node_modules/@types/node/http2.d.ts +2555 -0
  66. data/node_modules/@types/node/https.d.ts +544 -0
  67. data/node_modules/@types/node/index.d.ts +90 -0
  68. data/node_modules/@types/node/inspector.d.ts +3966 -0
  69. data/node_modules/@types/node/module.d.ts +301 -0
  70. data/node_modules/@types/node/net.d.ts +995 -0
  71. data/node_modules/@types/node/os.d.ts +495 -0
  72. data/node_modules/@types/node/package.json +217 -0
  73. data/node_modules/@types/node/path.d.ts +200 -0
  74. data/node_modules/@types/node/perf_hooks.d.ts +941 -0
  75. data/node_modules/@types/node/process.d.ts +1912 -0
  76. data/node_modules/@types/node/punycode.d.ts +117 -0
  77. data/node_modules/@types/node/querystring.d.ts +153 -0
  78. data/node_modules/@types/node/readline/promises.d.ts +150 -0
  79. data/node_modules/@types/node/readline.d.ts +540 -0
  80. data/node_modules/@types/node/repl.d.ts +430 -0
  81. data/node_modules/@types/node/sea.d.ts +153 -0
  82. data/node_modules/@types/node/sqlite.d.ts +213 -0
  83. data/node_modules/@types/node/stream/consumers.d.ts +12 -0
  84. data/node_modules/@types/node/stream/promises.d.ts +83 -0
  85. data/node_modules/@types/node/stream/web.d.ts +606 -0
  86. data/node_modules/@types/node/stream.d.ts +1726 -0
  87. data/node_modules/@types/node/string_decoder.d.ts +67 -0
  88. data/node_modules/@types/node/test.d.ts +2098 -0
  89. data/node_modules/@types/node/timers/promises.d.ts +97 -0
  90. data/node_modules/@types/node/timers.d.ts +240 -0
  91. data/node_modules/@types/node/tls.d.ts +1220 -0
  92. data/node_modules/@types/node/trace_events.d.ts +197 -0
  93. data/node_modules/@types/node/tty.d.ts +208 -0
  94. data/node_modules/@types/node/url.d.ts +969 -0
  95. data/node_modules/@types/node/util.d.ts +2301 -0
  96. data/node_modules/@types/node/v8.d.ts +808 -0
  97. data/node_modules/@types/node/vm.d.ts +922 -0
  98. data/node_modules/@types/node/wasi.d.ts +181 -0
  99. data/node_modules/@types/node/worker_threads.d.ts +712 -0
  100. data/node_modules/@types/node/zlib.d.ts +539 -0
  101. data/node_modules/fsevents/LICENSE +22 -0
  102. data/node_modules/fsevents/README.md +83 -0
  103. data/node_modules/fsevents/fsevents.d.ts +46 -0
  104. data/node_modules/fsevents/fsevents.js +82 -0
  105. data/node_modules/fsevents/fsevents.node +0 -0
  106. data/node_modules/fsevents/package.json +62 -0
  107. data/node_modules/playwright/.eslintrc.js +6 -0
  108. data/node_modules/playwright/LICENSE +202 -0
  109. data/node_modules/playwright/NOTICE +5 -0
  110. data/node_modules/playwright/README.md +169 -0
  111. data/node_modules/playwright/ThirdPartyNotices.txt +4356 -0
  112. data/node_modules/playwright/cli.js +19 -0
  113. data/node_modules/playwright/index.d.ts +17 -0
  114. data/node_modules/playwright/index.js +17 -0
  115. data/node_modules/playwright/index.mjs +18 -0
  116. data/node_modules/playwright/jsx-runtime.js +41 -0
  117. data/node_modules/playwright/jsx-runtime.mjs +21 -0
  118. data/node_modules/playwright/lib/common/config.js +256 -0
  119. data/node_modules/playwright/lib/common/configLoader.js +321 -0
  120. data/node_modules/playwright/lib/common/esmLoaderHost.js +93 -0
  121. data/node_modules/playwright/lib/common/expectBundle.js +27 -0
  122. data/node_modules/playwright/lib/common/expectBundleImpl.js +389 -0
  123. data/node_modules/playwright/lib/common/fixtures.js +323 -0
  124. data/node_modules/playwright/lib/common/globals.js +48 -0
  125. data/node_modules/playwright/lib/common/ipc.js +48 -0
  126. data/node_modules/playwright/lib/common/poolBuilder.js +79 -0
  127. data/node_modules/playwright/lib/common/process.js +140 -0
  128. data/node_modules/playwright/lib/common/suiteUtils.js +133 -0
  129. data/node_modules/playwright/lib/common/test.js +311 -0
  130. data/node_modules/playwright/lib/common/testLoader.js +102 -0
  131. data/node_modules/playwright/lib/common/testType.js +284 -0
  132. data/node_modules/playwright/lib/fsWatcher.js +69 -0
  133. data/node_modules/playwright/lib/index.js +888 -0
  134. data/node_modules/playwright/lib/internalsForTest.js +28 -0
  135. data/node_modules/playwright/lib/isomorphic/events.js +72 -0
  136. data/node_modules/playwright/lib/isomorphic/folders.js +25 -0
  137. data/node_modules/playwright/lib/isomorphic/stringInternPool.js +58 -0
  138. data/node_modules/playwright/lib/isomorphic/teleReceiver.js +504 -0
  139. data/node_modules/playwright/lib/isomorphic/teleSuiteUpdater.js +149 -0
  140. data/node_modules/playwright/lib/isomorphic/testServerConnection.js +210 -0
  141. data/node_modules/playwright/lib/isomorphic/testServerInterface.js +5 -0
  142. data/node_modules/playwright/lib/isomorphic/testTree.js +272 -0
  143. data/node_modules/playwright/lib/loader/loaderMain.js +58 -0
  144. data/node_modules/playwright/lib/matchers/expect.js +297 -0
  145. data/node_modules/playwright/lib/matchers/matcherHint.js +50 -0
  146. data/node_modules/playwright/lib/matchers/matchers.js +449 -0
  147. data/node_modules/playwright/lib/matchers/toBeTruthy.js +55 -0
  148. data/node_modules/playwright/lib/matchers/toEqual.js +57 -0
  149. data/node_modules/playwright/lib/matchers/toMatchSnapshot.js +383 -0
  150. data/node_modules/playwright/lib/matchers/toMatchText.js +76 -0
  151. data/node_modules/playwright/lib/plugins/gitCommitInfoPlugin.js +78 -0
  152. data/node_modules/playwright/lib/plugins/index.js +19 -0
  153. data/node_modules/playwright/lib/plugins/webServerPlugin.js +187 -0
  154. data/node_modules/playwright/lib/program.js +346 -0
  155. data/node_modules/playwright/lib/reporters/base.js +553 -0
  156. data/node_modules/playwright/lib/reporters/blob.js +133 -0
  157. data/node_modules/playwright/lib/reporters/dot.js +82 -0
  158. data/node_modules/playwright/lib/reporters/empty.js +42 -0
  159. data/node_modules/playwright/lib/reporters/github.js +115 -0
  160. data/node_modules/playwright/lib/reporters/html.js +623 -0
  161. data/node_modules/playwright/lib/reporters/internalReporter.js +123 -0
  162. data/node_modules/playwright/lib/reporters/json.js +243 -0
  163. data/node_modules/playwright/lib/reporters/junit.js +233 -0
  164. data/node_modules/playwright/lib/reporters/line.js +108 -0
  165. data/node_modules/playwright/lib/reporters/list.js +222 -0
  166. data/node_modules/playwright/lib/reporters/markdown.js +76 -0
  167. data/node_modules/playwright/lib/reporters/merge.js +477 -0
  168. data/node_modules/playwright/lib/reporters/multiplexer.js +90 -0
  169. data/node_modules/playwright/lib/reporters/reporterV2.js +118 -0
  170. data/node_modules/playwright/lib/reporters/teleEmitter.js +268 -0
  171. data/node_modules/playwright/lib/reporters/versions/blobV1.js +5 -0
  172. data/node_modules/playwright/lib/runner/dispatcher.js +532 -0
  173. data/node_modules/playwright/lib/runner/failureTracker.js +60 -0
  174. data/node_modules/playwright/lib/runner/loadUtils.js +308 -0
  175. data/node_modules/playwright/lib/runner/loaderHost.js +85 -0
  176. data/node_modules/playwright/lib/runner/processHost.js +175 -0
  177. data/node_modules/playwright/lib/runner/projectUtils.js +203 -0
  178. data/node_modules/playwright/lib/runner/reporters.js +151 -0
  179. data/node_modules/playwright/lib/runner/runner.js +179 -0
  180. data/node_modules/playwright/lib/runner/sigIntWatcher.js +100 -0
  181. data/node_modules/playwright/lib/runner/taskRunner.js +147 -0
  182. data/node_modules/playwright/lib/runner/tasks.js +407 -0
  183. data/node_modules/playwright/lib/runner/testGroups.js +136 -0
  184. data/node_modules/playwright/lib/runner/testServer.js +605 -0
  185. data/node_modules/playwright/lib/runner/uiModeReporter.js +31 -0
  186. data/node_modules/playwright/lib/runner/vcs.js +55 -0
  187. data/node_modules/playwright/lib/runner/watchMode.js +398 -0
  188. data/node_modules/playwright/lib/runner/workerHost.js +85 -0
  189. data/node_modules/playwright/lib/third_party/tsconfig-loader.js +134 -0
  190. data/node_modules/playwright/lib/transform/babelBundle.js +28 -0
  191. data/node_modules/playwright/lib/transform/babelBundleImpl.js +2032 -0
  192. data/node_modules/playwright/lib/transform/compilationCache.js +254 -0
  193. data/node_modules/playwright/lib/transform/esmLoader.js +117 -0
  194. data/node_modules/playwright/lib/transform/esmUtils.js +32 -0
  195. data/node_modules/playwright/lib/transform/portTransport.js +81 -0
  196. data/node_modules/playwright/lib/transform/transform.js +267 -0
  197. data/node_modules/playwright/lib/util.js +356 -0
  198. data/node_modules/playwright/lib/utilsBundle.js +28 -0
  199. data/node_modules/playwright/lib/utilsBundleImpl.js +102 -0
  200. data/node_modules/playwright/lib/worker/fixtureRunner.js +279 -0
  201. data/node_modules/playwright/lib/worker/testInfo.js +397 -0
  202. data/node_modules/playwright/lib/worker/testTracing.js +314 -0
  203. data/node_modules/playwright/lib/worker/timeoutManager.js +153 -0
  204. data/node_modules/playwright/lib/worker/workerMain.js +637 -0
  205. data/node_modules/playwright/node_modules/.bin/playwright-core +1 -0
  206. data/node_modules/playwright/package.json +66 -0
  207. data/node_modules/playwright/test.d.ts +18 -0
  208. data/node_modules/playwright/test.js +24 -0
  209. data/node_modules/playwright/test.mjs +33 -0
  210. data/node_modules/playwright/types/test.d.ts +8444 -0
  211. data/node_modules/playwright/types/testReporter.d.ts +749 -0
  212. data/node_modules/playwright-core/LICENSE +202 -0
  213. data/node_modules/playwright-core/NOTICE +5 -0
  214. data/node_modules/playwright-core/README.md +3 -0
  215. data/node_modules/playwright-core/ThirdPartyNotices.txt +1548 -0
  216. data/node_modules/playwright-core/bin/PrintDeps.exe +0 -0
  217. data/node_modules/playwright-core/bin/README.md +2 -0
  218. data/node_modules/playwright-core/bin/install_media_pack.ps1 +5 -0
  219. data/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh +40 -0
  220. data/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh +13 -0
  221. data/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 +24 -0
  222. data/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh +40 -0
  223. data/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh +12 -0
  224. data/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 +24 -0
  225. data/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh +40 -0
  226. data/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh +11 -0
  227. data/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 +23 -0
  228. data/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh +40 -0
  229. data/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh +11 -0
  230. data/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 +23 -0
  231. data/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh +40 -0
  232. data/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh +11 -0
  233. data/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 +24 -0
  234. data/node_modules/playwright-core/browsers.json +53 -0
  235. data/node_modules/playwright-core/cli.js +18 -0
  236. data/node_modules/playwright-core/index.d.ts +17 -0
  237. data/node_modules/playwright-core/index.js +33 -0
  238. data/node_modules/playwright-core/index.mjs +28 -0
  239. data/node_modules/playwright-core/lib/androidServerImpl.js +69 -0
  240. data/node_modules/playwright-core/lib/browserServerImpl.js +92 -0
  241. data/node_modules/playwright-core/lib/cli/driver.js +95 -0
  242. data/node_modules/playwright-core/lib/cli/program.js +577 -0
  243. data/node_modules/playwright-core/lib/cli/programWithTestStub.js +67 -0
  244. data/node_modules/playwright-core/lib/client/accessibility.js +50 -0
  245. data/node_modules/playwright-core/lib/client/android.js +473 -0
  246. data/node_modules/playwright-core/lib/client/api.js +279 -0
  247. data/node_modules/playwright-core/lib/client/artifact.js +79 -0
  248. data/node_modules/playwright-core/lib/client/browser.js +145 -0
  249. data/node_modules/playwright-core/lib/client/browserContext.js +541 -0
  250. data/node_modules/playwright-core/lib/client/browserType.js +241 -0
  251. data/node_modules/playwright-core/lib/client/cdpSession.js +53 -0
  252. data/node_modules/playwright-core/lib/client/channelOwner.js +231 -0
  253. data/node_modules/playwright-core/lib/client/clientHelper.js +57 -0
  254. data/node_modules/playwright-core/lib/client/clientInstrumentation.js +50 -0
  255. data/node_modules/playwright-core/lib/client/clock.js +68 -0
  256. data/node_modules/playwright-core/lib/client/connection.js +330 -0
  257. data/node_modules/playwright-core/lib/client/consoleMessage.js +55 -0
  258. data/node_modules/playwright-core/lib/client/coverage.js +41 -0
  259. data/node_modules/playwright-core/lib/client/dialog.js +57 -0
  260. data/node_modules/playwright-core/lib/client/download.js +62 -0
  261. data/node_modules/playwright-core/lib/client/electron.js +135 -0
  262. data/node_modules/playwright-core/lib/client/elementHandle.js +321 -0
  263. data/node_modules/playwright-core/lib/client/errors.js +77 -0
  264. data/node_modules/playwright-core/lib/client/eventEmitter.js +314 -0
  265. data/node_modules/playwright-core/lib/client/events.js +94 -0
  266. data/node_modules/playwright-core/lib/client/fetch.js +396 -0
  267. data/node_modules/playwright-core/lib/client/fileChooser.js +45 -0
  268. data/node_modules/playwright-core/lib/client/frame.js +504 -0
  269. data/node_modules/playwright-core/lib/client/harRouter.js +99 -0
  270. data/node_modules/playwright-core/lib/client/input.js +111 -0
  271. data/node_modules/playwright-core/lib/client/jsHandle.js +129 -0
  272. data/node_modules/playwright-core/lib/client/jsonPipe.js +35 -0
  273. data/node_modules/playwright-core/lib/client/localUtils.js +35 -0
  274. data/node_modules/playwright-core/lib/client/locator.js +441 -0
  275. data/node_modules/playwright-core/lib/client/network.js +604 -0
  276. data/node_modules/playwright-core/lib/client/page.js +725 -0
  277. data/node_modules/playwright-core/lib/client/playwright.js +77 -0
  278. data/node_modules/playwright-core/lib/client/selectors.js +67 -0
  279. data/node_modules/playwright-core/lib/client/stream.js +54 -0
  280. data/node_modules/playwright-core/lib/client/tracing.js +138 -0
  281. data/node_modules/playwright-core/lib/client/types.js +24 -0
  282. data/node_modules/playwright-core/lib/client/video.js +51 -0
  283. data/node_modules/playwright-core/lib/client/waiter.js +158 -0
  284. data/node_modules/playwright-core/lib/client/webError.js +37 -0
  285. data/node_modules/playwright-core/lib/client/worker.js +71 -0
  286. data/node_modules/playwright-core/lib/client/writableStream.js +54 -0
  287. data/node_modules/playwright-core/lib/common/socksProxy.js +569 -0
  288. data/node_modules/playwright-core/lib/common/timeoutSettings.js +73 -0
  289. data/node_modules/playwright-core/lib/common/types.js +5 -0
  290. data/node_modules/playwright-core/lib/generated/clockSource.js +7 -0
  291. data/node_modules/playwright-core/lib/generated/consoleApiSource.js +7 -0
  292. data/node_modules/playwright-core/lib/generated/injectedScriptSource.js +7 -0
  293. data/node_modules/playwright-core/lib/generated/recorderSource.js +7 -0
  294. data/node_modules/playwright-core/lib/generated/utilityScriptSource.js +7 -0
  295. data/node_modules/playwright-core/lib/image_tools/colorUtils.js +98 -0
  296. data/node_modules/playwright-core/lib/image_tools/compare.js +108 -0
  297. data/node_modules/playwright-core/lib/image_tools/imageChannel.js +70 -0
  298. data/node_modules/playwright-core/lib/image_tools/stats.js +102 -0
  299. data/node_modules/playwright-core/lib/inProcessFactory.js +54 -0
  300. data/node_modules/playwright-core/lib/inprocess.js +20 -0
  301. data/node_modules/playwright-core/lib/outofprocess.js +67 -0
  302. data/node_modules/playwright-core/lib/protocol/debug.js +27 -0
  303. data/node_modules/playwright-core/lib/protocol/serializers.js +173 -0
  304. data/node_modules/playwright-core/lib/protocol/transport.js +82 -0
  305. data/node_modules/playwright-core/lib/protocol/validator.js +2694 -0
  306. data/node_modules/playwright-core/lib/protocol/validatorPrimitives.js +139 -0
  307. data/node_modules/playwright-core/lib/remote/playwrightConnection.js +274 -0
  308. data/node_modules/playwright-core/lib/remote/playwrightServer.js +110 -0
  309. data/node_modules/playwright-core/lib/server/accessibility.js +62 -0
  310. data/node_modules/playwright-core/lib/server/android/android.js +441 -0
  311. data/node_modules/playwright-core/lib/server/android/backendAdb.js +172 -0
  312. data/node_modules/playwright-core/lib/server/artifact.js +104 -0
  313. data/node_modules/playwright-core/lib/server/bidi/bidiBrowser.js +296 -0
  314. data/node_modules/playwright-core/lib/server/bidi/bidiConnection.js +206 -0
  315. data/node_modules/playwright-core/lib/server/bidi/bidiExecutionContext.js +162 -0
  316. data/node_modules/playwright-core/lib/server/bidi/bidiFirefox.js +110 -0
  317. data/node_modules/playwright-core/lib/server/bidi/bidiInput.js +174 -0
  318. data/node_modules/playwright-core/lib/server/bidi/bidiNetworkManager.js +304 -0
  319. data/node_modules/playwright-core/lib/server/bidi/bidiPage.js +456 -0
  320. data/node_modules/playwright-core/lib/server/bidi/third_party/bidiDeserializer.js +93 -0
  321. data/node_modules/playwright-core/lib/server/bidi/third_party/bidiKeyboard.js +238 -0
  322. data/node_modules/playwright-core/lib/server/bidi/third_party/bidiProtocol.js +139 -0
  323. data/node_modules/playwright-core/lib/server/bidi/third_party/bidiSerializer.js +144 -0
  324. data/node_modules/playwright-core/lib/server/browser.js +137 -0
  325. data/node_modules/playwright-core/lib/server/browserContext.js +684 -0
  326. data/node_modules/playwright-core/lib/server/browserType.js +307 -0
  327. data/node_modules/playwright-core/lib/server/chromium/appIcon.png +0 -0
  328. data/node_modules/playwright-core/lib/server/chromium/chromium.js +362 -0
  329. data/node_modules/playwright-core/lib/server/chromium/chromiumSwitches.js +44 -0
  330. data/node_modules/playwright-core/lib/server/chromium/crAccessibility.js +237 -0
  331. data/node_modules/playwright-core/lib/server/chromium/crBrowser.js +515 -0
  332. data/node_modules/playwright-core/lib/server/chromium/crConnection.js +228 -0
  333. data/node_modules/playwright-core/lib/server/chromium/crCoverage.js +246 -0
  334. data/node_modules/playwright-core/lib/server/chromium/crDevTools.js +104 -0
  335. data/node_modules/playwright-core/lib/server/chromium/crDragDrop.js +143 -0
  336. data/node_modules/playwright-core/lib/server/chromium/crExecutionContext.js +156 -0
  337. data/node_modules/playwright-core/lib/server/chromium/crInput.js +171 -0
  338. data/node_modules/playwright-core/lib/server/chromium/crNetworkManager.js +767 -0
  339. data/node_modules/playwright-core/lib/server/chromium/crPage.js +1128 -0
  340. data/node_modules/playwright-core/lib/server/chromium/crPdf.js +153 -0
  341. data/node_modules/playwright-core/lib/server/chromium/crProtocolHelper.js +133 -0
  342. data/node_modules/playwright-core/lib/server/chromium/crServiceWorker.js +112 -0
  343. data/node_modules/playwright-core/lib/server/chromium/defaultFontFamilies.js +145 -0
  344. data/node_modules/playwright-core/lib/server/chromium/videoRecorder.js +155 -0
  345. data/node_modules/playwright-core/lib/server/clock.js +125 -0
  346. data/node_modules/playwright-core/lib/server/codegen/csharp.js +299 -0
  347. data/node_modules/playwright-core/lib/server/codegen/java.js +235 -0
  348. data/node_modules/playwright-core/lib/server/codegen/javascript.js +223 -0
  349. data/node_modules/playwright-core/lib/server/codegen/jsonl.js +47 -0
  350. data/node_modules/playwright-core/lib/server/codegen/language.js +76 -0
  351. data/node_modules/playwright-core/lib/server/codegen/languages.js +30 -0
  352. data/node_modules/playwright-core/lib/server/codegen/python.js +265 -0
  353. data/node_modules/playwright-core/lib/server/codegen/types.js +5 -0
  354. data/node_modules/playwright-core/lib/server/console.js +57 -0
  355. data/node_modules/playwright-core/lib/server/cookieStore.js +112 -0
  356. data/node_modules/playwright-core/lib/server/debugController.js +234 -0
  357. data/node_modules/playwright-core/lib/server/debugger.js +132 -0
  358. data/node_modules/playwright-core/lib/server/deviceDescriptors.js +26 -0
  359. data/node_modules/playwright-core/lib/server/deviceDescriptorsSource.json +1669 -0
  360. data/node_modules/playwright-core/lib/server/dialog.js +70 -0
  361. data/node_modules/playwright-core/lib/server/dispatchers/androidDispatcher.js +193 -0
  362. data/node_modules/playwright-core/lib/server/dispatchers/artifactDispatcher.js +118 -0
  363. data/node_modules/playwright-core/lib/server/dispatchers/browserContextDispatcher.js +351 -0
  364. data/node_modules/playwright-core/lib/server/dispatchers/browserDispatcher.js +170 -0
  365. data/node_modules/playwright-core/lib/server/dispatchers/browserTypeDispatcher.js +55 -0
  366. data/node_modules/playwright-core/lib/server/dispatchers/cdpSessionDispatcher.js +48 -0
  367. data/node_modules/playwright-core/lib/server/dispatchers/debugControllerDispatcher.js +103 -0
  368. data/node_modules/playwright-core/lib/server/dispatchers/dialogDispatcher.js +44 -0
  369. data/node_modules/playwright-core/lib/server/dispatchers/dispatcher.js +395 -0
  370. data/node_modules/playwright-core/lib/server/dispatchers/electronDispatcher.js +93 -0
  371. data/node_modules/playwright-core/lib/server/dispatchers/elementHandlerDispatcher.js +228 -0
  372. data/node_modules/playwright-core/lib/server/dispatchers/frameDispatcher.js +286 -0
  373. data/node_modules/playwright-core/lib/server/dispatchers/jsHandleDispatcher.js +102 -0
  374. data/node_modules/playwright-core/lib/server/dispatchers/jsonPipeDispatcher.js +59 -0
  375. data/node_modules/playwright-core/lib/server/dispatchers/localUtilsDispatcher.js +413 -0
  376. data/node_modules/playwright-core/lib/server/dispatchers/networkDispatchers.js +221 -0
  377. data/node_modules/playwright-core/lib/server/dispatchers/pageDispatcher.js +358 -0
  378. data/node_modules/playwright-core/lib/server/dispatchers/playwrightDispatcher.js +106 -0
  379. data/node_modules/playwright-core/lib/server/dispatchers/selectorsDispatcher.js +36 -0
  380. data/node_modules/playwright-core/lib/server/dispatchers/streamDispatcher.js +62 -0
  381. data/node_modules/playwright-core/lib/server/dispatchers/tracingDispatcher.js +54 -0
  382. data/node_modules/playwright-core/lib/server/dispatchers/writableStreamDispatcher.js +58 -0
  383. data/node_modules/playwright-core/lib/server/dom.js +845 -0
  384. data/node_modules/playwright-core/lib/server/download.js +53 -0
  385. data/node_modules/playwright-core/lib/server/electron/electron.js +296 -0
  386. data/node_modules/playwright-core/lib/server/electron/loader.js +57 -0
  387. data/node_modules/playwright-core/lib/server/errors.js +68 -0
  388. data/node_modules/playwright-core/lib/server/fetch.js +660 -0
  389. data/node_modules/playwright-core/lib/server/fileChooser.js +42 -0
  390. data/node_modules/playwright-core/lib/server/fileUploadUtils.js +75 -0
  391. data/node_modules/playwright-core/lib/server/firefox/ffAccessibility.js +216 -0
  392. data/node_modules/playwright-core/lib/server/firefox/ffBrowser.js +458 -0
  393. data/node_modules/playwright-core/lib/server/firefox/ffConnection.js +168 -0
  394. data/node_modules/playwright-core/lib/server/firefox/ffExecutionContext.js +138 -0
  395. data/node_modules/playwright-core/lib/server/firefox/ffInput.js +150 -0
  396. data/node_modules/playwright-core/lib/server/firefox/ffNetworkManager.js +233 -0
  397. data/node_modules/playwright-core/lib/server/firefox/ffPage.js +556 -0
  398. data/node_modules/playwright-core/lib/server/firefox/firefox.js +110 -0
  399. data/node_modules/playwright-core/lib/server/formData.js +75 -0
  400. data/node_modules/playwright-core/lib/server/frameSelectors.js +171 -0
  401. data/node_modules/playwright-core/lib/server/frames.js +1654 -0
  402. data/node_modules/playwright-core/lib/server/har/harRecorder.js +139 -0
  403. data/node_modules/playwright-core/lib/server/har/harTracer.js +531 -0
  404. data/node_modules/playwright-core/lib/server/helper.js +103 -0
  405. data/node_modules/playwright-core/lib/server/index.js +114 -0
  406. data/node_modules/playwright-core/lib/server/input.js +311 -0
  407. data/node_modules/playwright-core/lib/server/instrumentation.js +70 -0
  408. data/node_modules/playwright-core/lib/server/isomorphic/utilityScriptSerializers.js +226 -0
  409. data/node_modules/playwright-core/lib/server/javascript.js +306 -0
  410. data/node_modules/playwright-core/lib/server/launchApp.js +91 -0
  411. data/node_modules/playwright-core/lib/server/macEditingCommands.js +139 -0
  412. data/node_modules/playwright-core/lib/server/network.js +617 -0
  413. data/node_modules/playwright-core/lib/server/page.js +825 -0
  414. data/node_modules/playwright-core/lib/server/pipeTransport.js +85 -0
  415. data/node_modules/playwright-core/lib/server/playwright.js +85 -0
  416. data/node_modules/playwright-core/lib/server/progress.js +102 -0
  417. data/node_modules/playwright-core/lib/server/protocolError.js +49 -0
  418. data/node_modules/playwright-core/lib/server/recorder/contextRecorder.js +316 -0
  419. data/node_modules/playwright-core/lib/server/recorder/recorderActions.js +5 -0
  420. data/node_modules/playwright-core/lib/server/recorder/recorderApp.js +190 -0
  421. data/node_modules/playwright-core/lib/server/recorder/recorderCollection.js +127 -0
  422. data/node_modules/playwright-core/lib/server/recorder/recorderRunner.js +177 -0
  423. data/node_modules/playwright-core/lib/server/recorder/recorderUtils.js +71 -0
  424. data/node_modules/playwright-core/lib/server/recorder/throttledFile.js +46 -0
  425. data/node_modules/playwright-core/lib/server/recorder.js +324 -0
  426. data/node_modules/playwright-core/lib/server/registry/browserFetcher.js +168 -0
  427. data/node_modules/playwright-core/lib/server/registry/dependencies.js +322 -0
  428. data/node_modules/playwright-core/lib/server/registry/index.js +924 -0
  429. data/node_modules/playwright-core/lib/server/registry/nativeDeps.js +490 -0
  430. data/node_modules/playwright-core/lib/server/registry/oopDownloadBrowserMain.js +138 -0
  431. data/node_modules/playwright-core/lib/server/screenshotter.js +348 -0
  432. data/node_modules/playwright-core/lib/server/selectors.js +73 -0
  433. data/node_modules/playwright-core/lib/server/socksClientCertificatesInterceptor.js +328 -0
  434. data/node_modules/playwright-core/lib/server/socksInterceptor.js +100 -0
  435. data/node_modules/playwright-core/lib/server/trace/recorder/snapshotter.js +171 -0
  436. data/node_modules/playwright-core/lib/server/trace/recorder/snapshotterInjected.js +493 -0
  437. data/node_modules/playwright-core/lib/server/trace/recorder/tracing.js +486 -0
  438. data/node_modules/playwright-core/lib/server/trace/test/inMemorySnapshotter.js +93 -0
  439. data/node_modules/playwright-core/lib/server/trace/viewer/traceViewer.js +216 -0
  440. data/node_modules/playwright-core/lib/server/transport.js +191 -0
  441. data/node_modules/playwright-core/lib/server/types.js +24 -0
  442. data/node_modules/playwright-core/lib/server/usKeyboardLayout.js +555 -0
  443. data/node_modules/playwright-core/lib/server/webkit/webkit.js +87 -0
  444. data/node_modules/playwright-core/lib/server/webkit/wkAccessibility.js +194 -0
  445. data/node_modules/playwright-core/lib/server/webkit/wkBrowser.js +328 -0
  446. data/node_modules/playwright-core/lib/server/webkit/wkConnection.js +173 -0
  447. data/node_modules/playwright-core/lib/server/webkit/wkExecutionContext.js +146 -0
  448. data/node_modules/playwright-core/lib/server/webkit/wkInput.js +169 -0
  449. data/node_modules/playwright-core/lib/server/webkit/wkInterceptableRequest.js +162 -0
  450. data/node_modules/playwright-core/lib/server/webkit/wkPage.js +1216 -0
  451. data/node_modules/playwright-core/lib/server/webkit/wkProvisionalPage.js +94 -0
  452. data/node_modules/playwright-core/lib/server/webkit/wkWorkers.js +104 -0
  453. data/node_modules/playwright-core/lib/third_party/diff_match_patch.js +2222 -0
  454. data/node_modules/playwright-core/lib/third_party/pixelmatch.js +255 -0
  455. data/node_modules/playwright-core/lib/utils/ascii.js +31 -0
  456. data/node_modules/playwright-core/lib/utils/comparators.js +171 -0
  457. data/node_modules/playwright-core/lib/utils/crypto.js +174 -0
  458. data/node_modules/playwright-core/lib/utils/debug.js +46 -0
  459. data/node_modules/playwright-core/lib/utils/debugLogger.js +91 -0
  460. data/node_modules/playwright-core/lib/utils/env.js +49 -0
  461. data/node_modules/playwright-core/lib/utils/eventsHelper.js +38 -0
  462. data/node_modules/playwright-core/lib/utils/expectUtils.js +33 -0
  463. data/node_modules/playwright-core/lib/utils/fileUtils.js +205 -0
  464. data/node_modules/playwright-core/lib/utils/happy-eyeballs.js +181 -0
  465. data/node_modules/playwright-core/lib/utils/headers.js +52 -0
  466. data/node_modules/playwright-core/lib/utils/hostPlatform.js +133 -0
  467. data/node_modules/playwright-core/lib/utils/httpServer.js +236 -0
  468. data/node_modules/playwright-core/lib/utils/index.js +368 -0
  469. data/node_modules/playwright-core/lib/utils/isomorphic/cssParser.js +250 -0
  470. data/node_modules/playwright-core/lib/utils/isomorphic/cssTokenizer.js +979 -0
  471. data/node_modules/playwright-core/lib/utils/isomorphic/locatorGenerators.js +651 -0
  472. data/node_modules/playwright-core/lib/utils/isomorphic/locatorParser.js +179 -0
  473. data/node_modules/playwright-core/lib/utils/isomorphic/locatorUtils.js +62 -0
  474. data/node_modules/playwright-core/lib/utils/isomorphic/mimeType.js +29 -0
  475. data/node_modules/playwright-core/lib/utils/isomorphic/selectorParser.js +397 -0
  476. data/node_modules/playwright-core/lib/utils/isomorphic/stringUtils.js +139 -0
  477. data/node_modules/playwright-core/lib/utils/isomorphic/traceUtils.js +39 -0
  478. data/node_modules/playwright-core/lib/utils/isomorphic/urlMatch.js +120 -0
  479. data/node_modules/playwright-core/lib/utils/linuxUtils.js +78 -0
  480. data/node_modules/playwright-core/lib/utils/manualPromise.js +109 -0
  481. data/node_modules/playwright-core/lib/utils/multimap.js +75 -0
  482. data/node_modules/playwright-core/lib/utils/network.js +160 -0
  483. data/node_modules/playwright-core/lib/utils/processLauncher.js +248 -0
  484. data/node_modules/playwright-core/lib/utils/profiler.js +53 -0
  485. data/node_modules/playwright-core/lib/utils/rtti.js +44 -0
  486. data/node_modules/playwright-core/lib/utils/semaphore.js +51 -0
  487. data/node_modules/playwright-core/lib/utils/spawnAsync.js +45 -0
  488. data/node_modules/playwright-core/lib/utils/stackTrace.js +121 -0
  489. data/node_modules/playwright-core/lib/utils/task.js +58 -0
  490. data/node_modules/playwright-core/lib/utils/time.js +37 -0
  491. data/node_modules/playwright-core/lib/utils/timeoutRunner.js +66 -0
  492. data/node_modules/playwright-core/lib/utils/traceUtils.js +44 -0
  493. data/node_modules/playwright-core/lib/utils/userAgent.js +105 -0
  494. data/node_modules/playwright-core/lib/utils/wsServer.js +127 -0
  495. data/node_modules/playwright-core/lib/utils/zipFile.js +75 -0
  496. data/node_modules/playwright-core/lib/utils/zones.js +62 -0
  497. data/node_modules/playwright-core/lib/utilsBundle.js +82 -0
  498. data/node_modules/playwright-core/lib/utilsBundleImpl/index.js +53 -0
  499. data/node_modules/playwright-core/lib/utilsBundleImpl/xdg-open +1066 -0
  500. data/node_modules/playwright-core/lib/vite/htmlReport/index.html +66 -0
  501. data/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-aW6Vz3gf.js +24 -0
  502. data/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-ez37Vkbh.css +1 -0
  503. data/node_modules/playwright-core/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
  504. data/node_modules/playwright-core/lib/vite/recorder/assets/index-B-MT5gKo.css +1 -0
  505. data/node_modules/playwright-core/lib/vite/recorder/assets/index-DCpXOVIh.js +47 -0
  506. data/node_modules/playwright-core/lib/vite/recorder/index.html +29 -0
  507. data/node_modules/playwright-core/lib/vite/recorder/playwright-logo.svg +9 -0
  508. data/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-eFKCUIu2.js +24 -0
  509. data/node_modules/playwright-core/lib/vite/traceViewer/assets/testServerConnection-DeE2kSzz.js +1 -0
  510. data/node_modules/playwright-core/lib/vite/traceViewer/assets/workbench-D0cirtfA.js +72 -0
  511. data/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-BeNbaIVa.js +9 -0
  512. data/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.ez37Vkbh.css +1 -0
  513. data/node_modules/playwright-core/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
  514. data/node_modules/playwright-core/lib/vite/traceViewer/embedded.BkuvsLJp.js +2 -0
  515. data/node_modules/playwright-core/lib/vite/traceViewer/embedded.html +16 -0
  516. data/node_modules/playwright-core/lib/vite/traceViewer/embedded.w7WN2u1R.css +1 -0
  517. data/node_modules/playwright-core/lib/vite/traceViewer/index.C968kAiC.js +2 -0
  518. data/node_modules/playwright-core/lib/vite/traceViewer/index.CrbWWHbf.css +1 -0
  519. data/node_modules/playwright-core/lib/vite/traceViewer/index.html +27 -0
  520. data/node_modules/playwright-core/lib/vite/traceViewer/playwright-logo.svg +9 -0
  521. data/node_modules/playwright-core/lib/vite/traceViewer/snapshot.html +21 -0
  522. data/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +3 -0
  523. data/node_modules/playwright-core/lib/vite/traceViewer/uiMode.BkFnr4V0.js +10 -0
  524. data/node_modules/playwright-core/lib/vite/traceViewer/uiMode.D3cNFP6u.css +1 -0
  525. data/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +18 -0
  526. data/node_modules/playwright-core/lib/vite/traceViewer/workbench.DjbIuxix.css +1 -0
  527. data/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.DSXBckUd.css +32 -0
  528. data/node_modules/playwright-core/lib/zipBundle.js +25 -0
  529. data/node_modules/playwright-core/lib/zipBundleImpl.js +5 -0
  530. data/node_modules/playwright-core/package.json +44 -0
  531. data/node_modules/playwright-core/types/protocol.d.ts +21500 -0
  532. data/node_modules/playwright-core/types/structs.d.ts +45 -0
  533. data/node_modules/playwright-core/types/types.d.ts +21431 -0
  534. data/node_modules/undici-types/LICENSE +21 -0
  535. data/node_modules/undici-types/README.md +6 -0
  536. data/node_modules/undici-types/agent.d.ts +31 -0
  537. data/node_modules/undici-types/api.d.ts +43 -0
  538. data/node_modules/undici-types/balanced-pool.d.ts +29 -0
  539. data/node_modules/undici-types/cache.d.ts +36 -0
  540. data/node_modules/undici-types/client.d.ts +108 -0
  541. data/node_modules/undici-types/connector.d.ts +34 -0
  542. data/node_modules/undici-types/content-type.d.ts +21 -0
  543. data/node_modules/undici-types/cookies.d.ts +28 -0
  544. data/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
  545. data/node_modules/undici-types/dispatcher.d.ts +255 -0
  546. data/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
  547. data/node_modules/undici-types/errors.d.ts +149 -0
  548. data/node_modules/undici-types/eventsource.d.ts +63 -0
  549. data/node_modules/undici-types/fetch.d.ts +209 -0
  550. data/node_modules/undici-types/file.d.ts +39 -0
  551. data/node_modules/undici-types/filereader.d.ts +54 -0
  552. data/node_modules/undici-types/formdata.d.ts +108 -0
  553. data/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  554. data/node_modules/undici-types/global-origin.d.ts +7 -0
  555. data/node_modules/undici-types/handlers.d.ts +15 -0
  556. data/node_modules/undici-types/header.d.ts +4 -0
  557. data/node_modules/undici-types/index.d.ts +71 -0
  558. data/node_modules/undici-types/interceptors.d.ts +15 -0
  559. data/node_modules/undici-types/mock-agent.d.ts +50 -0
  560. data/node_modules/undici-types/mock-client.d.ts +25 -0
  561. data/node_modules/undici-types/mock-errors.d.ts +12 -0
  562. data/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  563. data/node_modules/undici-types/mock-pool.d.ts +25 -0
  564. data/node_modules/undici-types/package.json +55 -0
  565. data/node_modules/undici-types/patch.d.ts +71 -0
  566. data/node_modules/undici-types/pool-stats.d.ts +19 -0
  567. data/node_modules/undici-types/pool.d.ts +39 -0
  568. data/node_modules/undici-types/proxy-agent.d.ts +28 -0
  569. data/node_modules/undici-types/readable.d.ts +60 -0
  570. data/node_modules/undici-types/retry-agent.d.ts +8 -0
  571. data/node_modules/undici-types/retry-handler.d.ts +116 -0
  572. data/node_modules/undici-types/util.d.ts +18 -0
  573. data/node_modules/undici-types/webidl.d.ts +222 -0
  574. data/node_modules/undici-types/websocket.d.ts +152 -0
  575. data/pokeedex.gemspec +32 -0
  576. data/spec/fixtures/pokemon_com/responses/GET-200-bulbasaur.html +2262 -0
  577. data/spec/fixtures/pokemon_com/responses/GET-404-not-found.html +808 -0
  578. data/spec/pokeedex/configuration_spec.rb +37 -0
  579. data/spec/pokeedex/database_spec.rb +21 -0
  580. data/spec/pokeedex/exceptions_spec.rb +11 -0
  581. data/spec/pokeedex/pokemon/base_spec.rb +15 -0
  582. data/spec/pokeedex/pokemon/decorators/base_spec.rb +63 -0
  583. data/spec/pokeedex/pokemon/model/base_spec.rb +36 -0
  584. data/spec/pokeedex/pokemon/scrapper/fetchers/base_spec.rb +36 -0
  585. data/spec/pokeedex/pokemon/scrapper/parsers/base_spec.rb +49 -0
  586. data/spec/pokeedex/pokemon/scrapper/pokedex_spec.rb +71 -0
  587. data/spec/pokeedex/pokemon/searcher/base.rb +81 -0
  588. data/spec/pokeedex_spec.rb +7 -0
  589. data/spec/spec_helper.rb +42 -0
  590. data/yarn.lock +41 -0
  591. metadata +731 -0
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.source = void 0;
7
+ const source = exports.source = "\nvar __commonJS = obj => {\n let required = false;\n let result;\n return function __require() {\n if (!required) {\n required = true;\n let fn;\n for (const name in obj) { fn = obj[name]; break; }\n const module = { exports: {} };\n fn(module.exports, module);\n result = module.exports;\n }\n return result;\n }\n};\nvar __export = (target, all) => {for (var name in all) target[name] = all[name];};\nvar __toESM = mod => ({ ...mod, 'default': mod });\nvar __toCommonJS = mod => ({ ...mod, __esModule: true });\n\n\n// packages/playwright-core/src/server/injected/recorder/recorder.ts\nvar recorder_exports = {};\n__export(recorder_exports, {\n PollingRecorder: () => PollingRecorder,\n Recorder: () => Recorder,\n default: () => recorder_default\n});\nmodule.exports = __toCommonJS(recorder_exports);\n\n// packages/playwright-core/src/server/injected/recorder/clipPaths.ts\nvar svgJson = { \"tagName\": \"svg\", \"children\": [{ \"tagName\": \"defs\", \"children\": [{ \"tagName\": \"clipPath\", \"attrs\": { \"width\": \"16\", \"height\": \"16\", \"viewBox\": \"0 0 16 16\", \"fill\": \"currentColor\", \"id\": \"icon-gripper\" }, \"children\": [{ \"tagName\": \"path\", \"attrs\": { \"d\": \"M5 3h2v2H5zm0 4h2v2H5zm0 4h2v2H5zm4-8h2v2H9zm0 4h2v2H9zm0 4h2v2H9z\" } }] }, { \"tagName\": \"clipPath\", \"attrs\": { \"width\": \"16\", \"height\": \"16\", \"viewBox\": \"0 0 16 16\", \"fill\": \"currentColor\", \"id\": \"icon-circle-large-filled\" }, \"children\": [{ \"tagName\": \"path\", \"attrs\": { \"d\": \"M8 1a6.8 6.8 0 0 1 1.86.253 6.899 6.899 0 0 1 3.083 1.805 6.903 6.903 0 0 1 1.804 3.083C14.916 6.738 15 7.357 15 8s-.084 1.262-.253 1.86a6.9 6.9 0 0 1-.704 1.674 7.157 7.157 0 0 1-2.516 2.509 6.966 6.966 0 0 1-1.668.71A6.984 6.984 0 0 1 8 15a6.984 6.984 0 0 1-1.86-.246 7.098 7.098 0 0 1-1.674-.711 7.3 7.3 0 0 1-1.415-1.094 7.295 7.295 0 0 1-1.094-1.415 7.098 7.098 0 0 1-.71-1.675A6.985 6.985 0 0 1 1 8c0-.643.082-1.262.246-1.86a6.968 6.968 0 0 1 .711-1.667 7.156 7.156 0 0 1 2.509-2.516 6.895 6.895 0 0 1 1.675-.704A6.808 6.808 0 0 1 8 1z\" } }] }, { \"tagName\": \"clipPath\", \"attrs\": { \"width\": \"16\", \"height\": \"16\", \"viewBox\": \"0 0 16 16\", \"fill\": \"currentColor\", \"id\": \"icon-inspect\" }, \"children\": [{ \"tagName\": \"path\", \"attrs\": { \"fill-rule\": \"evenodd\", \"clip-rule\": \"evenodd\", \"d\": \"M1 3l1-1h12l1 1v6h-1V3H2v8h5v1H2l-1-1V3zm14.707 9.707L9 6v9.414l2.707-2.707h4zM10 13V8.414l3.293 3.293h-2L10 13z\" } }] }, { \"tagName\": \"clipPath\", \"attrs\": { \"width\": \"16\", \"height\": \"16\", \"viewBox\": \"0 0 16 16\", \"fill\": \"currentColor\", \"id\": \"icon-whole-word\" }, \"children\": [{ \"tagName\": \"path\", \"attrs\": { \"fill-rule\": \"evenodd\", \"clip-rule\": \"evenodd\", \"d\": \"M0 11H1V13H15V11H16V14H15H1H0V11Z\" } }, { \"tagName\": \"path\", \"attrs\": { \"d\": \"M6.84048 11H5.95963V10.1406H5.93814C5.555 10.7995 4.99104 11.1289 4.24625 11.1289C3.69839 11.1289 3.26871 10.9839 2.95718 10.6938C2.64924 10.4038 2.49527 10.0189 2.49527 9.53906C2.49527 8.51139 3.10041 7.91341 4.3107 7.74512L5.95963 7.51416C5.95963 6.57959 5.58186 6.1123 4.82632 6.1123C4.16389 6.1123 3.56591 6.33789 3.03238 6.78906V5.88672C3.57307 5.54297 4.19612 5.37109 4.90152 5.37109C6.19416 5.37109 6.84048 6.05501 6.84048 7.42285V11ZM5.95963 8.21777L4.63297 8.40039C4.22476 8.45768 3.91682 8.55973 3.70914 8.70654C3.50145 8.84977 3.39761 9.10579 3.39761 9.47461C3.39761 9.74316 3.4925 9.96338 3.68228 10.1353C3.87564 10.3035 4.13166 10.3877 4.45035 10.3877C4.8872 10.3877 5.24706 10.2355 5.52994 9.93115C5.8164 9.62321 5.95963 9.2347 5.95963 8.76562V8.21777Z\" } }, { \"tagName\": \"path\", \"attrs\": { \"d\": \"M9.3475 10.2051H9.32601V11H8.44515V2.85742H9.32601V6.4668H9.3475C9.78076 5.73633 10.4146 5.37109 11.2489 5.37109C11.9543 5.37109 12.5057 5.61816 12.9032 6.1123C13.3042 6.60286 13.5047 7.26172 13.5047 8.08887C13.5047 9.00911 13.2809 9.74674 12.8333 10.3018C12.3857 10.8532 11.7734 11.1289 10.9964 11.1289C10.2695 11.1289 9.71989 10.821 9.3475 10.2051ZM9.32601 7.98682V8.75488C9.32601 9.20964 9.47282 9.59635 9.76644 9.91504C10.0636 10.2301 10.4396 10.3877 10.8944 10.3877C11.4279 10.3877 11.8451 10.1836 12.1458 9.77539C12.4502 9.36719 12.6024 8.79964 12.6024 8.07275C12.6024 7.46045 12.4609 6.98063 12.1781 6.6333C11.8952 6.28597 11.512 6.1123 11.0286 6.1123C10.5166 6.1123 10.1048 6.29134 9.7933 6.64941C9.48177 7.00391 9.32601 7.44971 9.32601 7.98682Z\" } }] }, { \"tagName\": \"clipPath\", \"attrs\": { \"width\": \"16\", \"height\": \"16\", \"viewBox\": \"0 0 16 16\", \"fill\": \"currentColor\", \"id\": \"icon-eye\" }, \"children\": [{ \"tagName\": \"path\", \"attrs\": { \"d\": \"M7.99993 6.00316C9.47266 6.00316 10.6666 7.19708 10.6666 8.66981C10.6666 10.1426 9.47266 11.3365 7.99993 11.3365C6.52715 11.3365 5.33324 10.1426 5.33324 8.66981C5.33324 7.19708 6.52715 6.00316 7.99993 6.00316ZM7.99993 7.00315C7.07946 7.00315 6.33324 7.74935 6.33324 8.66981C6.33324 9.59028 7.07946 10.3365 7.99993 10.3365C8.9204 10.3365 9.6666 9.59028 9.6666 8.66981C9.6666 7.74935 8.9204 7.00315 7.99993 7.00315ZM7.99993 3.66675C11.0756 3.66675 13.7307 5.76675 14.4673 8.70968C14.5344 8.97755 14.3716 9.24908 14.1037 9.31615C13.8358 9.38315 13.5643 9.22041 13.4973 8.95248C12.8713 6.45205 10.6141 4.66675 7.99993 4.66675C5.38454 4.66675 3.12664 6.45359 2.50182 8.95555C2.43491 9.22341 2.16348 9.38635 1.89557 9.31948C1.62766 9.25255 1.46471 8.98115 1.53162 8.71321C2.26701 5.76856 4.9229 3.66675 7.99993 3.66675Z\" } }] }, { \"tagName\": \"clipPath\", \"attrs\": { \"width\": \"16\", \"height\": \"16\", \"viewBox\": \"0 0 16 16\", \"fill\": \"currentColor\", \"id\": \"icon-symbol-constant\" }, \"children\": [{ \"tagName\": \"path\", \"attrs\": { \"fill-rule\": \"evenodd\", \"clip-rule\": \"evenodd\", \"d\": \"M4 6h8v1H4V6zm8 3H4v1h8V9z\" } }, { \"tagName\": \"path\", \"attrs\": { \"fill-rule\": \"evenodd\", \"clip-rule\": \"evenodd\", \"d\": \"M1 4l1-1h12l1 1v8l-1 1H2l-1-1V4zm1 0v8h12V4H2z\" } }] }, { \"tagName\": \"clipPath\", \"attrs\": { \"width\": \"16\", \"height\": \"16\", \"viewBox\": \"0 0 16 16\", \"fill\": \"currentColor\", \"id\": \"icon-check\" }, \"children\": [{ \"tagName\": \"path\", \"attrs\": { \"fill-rule\": \"evenodd\", \"clip-rule\": \"evenodd\", \"d\": \"M14.431 3.323l-8.47 10-.79-.036-3.35-4.77.818-.574 2.978 4.24 8.051-9.506.764.646z\" } }] }, { \"tagName\": \"clipPath\", \"attrs\": { \"width\": \"16\", \"height\": \"16\", \"viewBox\": \"0 0 16 16\", \"fill\": \"currentColor\", \"id\": \"icon-close\" }, \"children\": [{ \"tagName\": \"path\", \"attrs\": { \"fill-rule\": \"evenodd\", \"clip-rule\": \"evenodd\", \"d\": \"M8 8.707l3.646 3.647.708-.707L8.707 8l3.647-3.646-.707-.708L8 7.293 4.354 3.646l-.707.708L7.293 8l-3.646 3.646.707.708L8 8.707z\" } }] }, { \"tagName\": \"clipPath\", \"attrs\": { \"width\": \"16\", \"height\": \"16\", \"viewBox\": \"0 0 16 16\", \"fill\": \"currentColor\", \"id\": \"icon-pass\" }, \"children\": [{ \"tagName\": \"path\", \"attrs\": { \"d\": \"M6.27 10.87h.71l4.56-4.56-.71-.71-4.2 4.21-1.92-1.92L4 8.6l2.27 2.27z\" } }, { \"tagName\": \"path\", \"attrs\": { \"fill-rule\": \"evenodd\", \"clip-rule\": \"evenodd\", \"d\": \"M8.6 1c1.6.1 3.1.9 4.2 2 1.3 1.4 2 3.1 2 5.1 0 1.6-.6 3.1-1.6 4.4-1 1.2-2.4 2.1-4 2.4-1.6.3-3.2.1-4.6-.7-1.4-.8-2.5-2-3.1-3.5C.9 9.2.8 7.5 1.3 6c.5-1.6 1.4-2.9 2.8-3.8C5.4 1.3 7 .9 8.6 1zm.5 12.9c1.3-.3 2.5-1 3.4-2.1.8-1.1 1.3-2.4 1.2-3.8 0-1.6-.6-3.2-1.7-4.3-1-1-2.2-1.6-3.6-1.7-1.3-.1-2.7.2-3.8 1-1.1.8-1.9 1.9-2.3 3.3-.4 1.3-.4 2.7.2 4 .6 1.3 1.5 2.3 2.7 3 1.2.7 2.6.9 3.9.6z\" } }] }] }] };\nvar clipPaths_default = svgJson;\n\n// packages/playwright-core/src/server/injected/recorder/recorder.ts\nvar NoneTool = class {\n cursor() {\n return \"default\";\n }\n};\nvar InspectTool = class {\n constructor(recorder, assertVisibility) {\n this._hoveredModel = null;\n this._hoveredElement = null;\n this._hoveredSelectors = null;\n this._recorder = recorder;\n this._assertVisibility = assertVisibility;\n }\n cursor() {\n return \"pointer\";\n }\n cleanup() {\n this._hoveredModel = null;\n this._hoveredElement = null;\n this._hoveredSelectors = null;\n }\n onClick(event) {\n var _a;\n consumeEvent(event);\n if (event.button !== 0)\n return;\n if ((_a = this._hoveredModel) == null ? void 0 : _a.selector)\n this._commit(this._hoveredModel.selector);\n }\n onContextMenu(event) {\n if (this._hoveredModel && !this._hoveredModel.tooltipListItemSelected && this._hoveredSelectors && this._hoveredSelectors.length > 1) {\n consumeEvent(event);\n const selectors = this._hoveredSelectors;\n this._hoveredModel.tooltipFooter = void 0;\n this._hoveredModel.tooltipList = selectors.map((selector) => this._recorder.injectedScript.utils.asLocator(this._recorder.state.language, selector));\n this._hoveredModel.tooltipListItemSelected = (index) => {\n if (index === void 0)\n this._reset(true);\n else\n this._commit(selectors[index]);\n };\n this._recorder.updateHighlight(this._hoveredModel, true);\n }\n }\n onPointerDown(event) {\n consumeEvent(event);\n }\n onPointerUp(event) {\n consumeEvent(event);\n }\n onMouseDown(event) {\n consumeEvent(event);\n }\n onMouseUp(event) {\n consumeEvent(event);\n }\n onMouseMove(event) {\n var _a;\n consumeEvent(event);\n let target = this._recorder.deepEventTarget(event);\n if (!target.isConnected)\n target = null;\n if (this._hoveredElement === target)\n return;\n this._hoveredElement = target;\n let model = null;\n let selectors = [];\n if (this._hoveredElement) {\n const generated = this._recorder.injectedScript.generateSelector(this._hoveredElement, { testIdAttributeName: this._recorder.state.testIdAttributeName, multiple: false });\n selectors = generated.selectors;\n model = {\n selector: generated.selector,\n elements: generated.elements,\n tooltipText: this._recorder.injectedScript.utils.asLocator(this._recorder.state.language, generated.selector),\n tooltipFooter: selectors.length > 1 ? `Click to select, right-click for more options` : void 0,\n color: this._assertVisibility ? \"#8acae480\" : void 0\n };\n }\n if (((_a = this._hoveredModel) == null ? void 0 : _a.selector) === (model == null ? void 0 : model.selector))\n return;\n this._hoveredModel = model;\n this._hoveredSelectors = selectors;\n this._recorder.updateHighlight(model, true);\n }\n onMouseEnter(event) {\n consumeEvent(event);\n }\n onMouseLeave(event) {\n consumeEvent(event);\n const window = this._recorder.injectedScript.window;\n if (window.top !== window && this._recorder.deepEventTarget(event).nodeType === Node.DOCUMENT_NODE)\n this._reset(true);\n }\n onKeyDown(event) {\n var _a;\n consumeEvent(event);\n if (event.key === \"Escape\") {\n if ((_a = this._hoveredModel) == null ? void 0 : _a.tooltipListItemSelected)\n this._reset(true);\n else if (this._assertVisibility)\n this._recorder.setMode(\"recording\");\n }\n }\n onKeyUp(event) {\n consumeEvent(event);\n }\n onScroll(event) {\n this._reset(false);\n }\n _commit(selector) {\n var _a;\n if (this._assertVisibility) {\n this._recorder.recordAction({\n name: \"assertVisible\",\n selector,\n signals: []\n });\n this._recorder.setMode(\"recording\");\n (_a = this._recorder.overlay) == null ? void 0 : _a.flashToolSucceeded(\"assertingVisibility\");\n } else {\n this._recorder.setSelector(selector);\n }\n }\n _reset(userGesture) {\n this._hoveredElement = null;\n this._hoveredModel = null;\n this._hoveredSelectors = null;\n this._recorder.updateHighlight(null, userGesture);\n }\n};\nvar RecordActionTool = class {\n constructor(recorder) {\n this._performingAction = false;\n this._hoveredModel = null;\n this._hoveredElement = null;\n this._activeModel = null;\n this._expectProgrammaticKeyUp = false;\n this._recorder = recorder;\n }\n cursor() {\n return \"pointer\";\n }\n cleanup() {\n this._hoveredModel = null;\n this._hoveredElement = null;\n this._activeModel = null;\n this._expectProgrammaticKeyUp = false;\n }\n onClick(event) {\n if (isRangeInput(this._hoveredElement))\n return;\n if (event.button === 2 && event.type === \"auxclick\")\n return;\n if (this._shouldIgnoreMouseEvent(event))\n return;\n if (this._actionInProgress(event))\n return;\n if (this._consumedDueToNoModel(event, this._hoveredModel))\n return;\n const checkbox = asCheckbox(this._recorder.deepEventTarget(event));\n if (checkbox) {\n this._performAction({\n name: checkbox.checked ? \"check\" : \"uncheck\",\n selector: this._hoveredModel.selector,\n signals: []\n });\n return;\n }\n this._performAction({\n name: \"click\",\n selector: this._hoveredModel.selector,\n position: positionForEvent(event),\n signals: [],\n button: buttonForEvent(event),\n modifiers: modifiersForEvent(event),\n clickCount: event.detail\n });\n }\n onContextMenu(event) {\n if (this._shouldIgnoreMouseEvent(event))\n return;\n if (this._actionInProgress(event))\n return;\n if (this._consumedDueToNoModel(event, this._hoveredModel))\n return;\n this._performAction({\n name: \"click\",\n selector: this._hoveredModel.selector,\n position: positionForEvent(event),\n signals: [],\n button: \"right\",\n modifiers: 0,\n clickCount: 0\n });\n }\n onPointerDown(event) {\n if (this._shouldIgnoreMouseEvent(event))\n return;\n if (!this._performingAction)\n consumeEvent(event);\n }\n onPointerUp(event) {\n if (this._shouldIgnoreMouseEvent(event))\n return;\n if (!this._performingAction)\n consumeEvent(event);\n }\n onMouseDown(event) {\n if (this._shouldIgnoreMouseEvent(event))\n return;\n if (!this._performingAction)\n consumeEvent(event);\n this._activeModel = this._hoveredModel;\n }\n onMouseUp(event) {\n if (this._shouldIgnoreMouseEvent(event))\n return;\n if (!this._performingAction)\n consumeEvent(event);\n }\n onMouseMove(event) {\n const target = this._recorder.deepEventTarget(event);\n if (this._hoveredElement === target)\n return;\n this._hoveredElement = target;\n this._updateModelForHoveredElement();\n }\n onMouseLeave(event) {\n const window = this._recorder.injectedScript.window;\n if (window.top !== window && this._recorder.deepEventTarget(event).nodeType === Node.DOCUMENT_NODE) {\n this._hoveredElement = null;\n this._updateModelForHoveredElement();\n }\n }\n onFocus(event) {\n this._onFocus(true);\n }\n onInput(event) {\n const target = this._recorder.deepEventTarget(event);\n if (target.nodeName === \"INPUT\" && target.type.toLowerCase() === \"file\") {\n this._recorder.recordAction({\n name: \"setInputFiles\",\n selector: this._activeModel.selector,\n signals: [],\n files: [...target.files || []].map((file) => file.name)\n });\n return;\n }\n if (isRangeInput(target)) {\n this._recorder.recordAction({\n name: \"fill\",\n // must use hoveredModel instead of activeModel for it to work in webkit\n selector: this._hoveredModel.selector,\n signals: [],\n text: target.value\n });\n return;\n }\n if ([\"INPUT\", \"TEXTAREA\"].includes(target.nodeName) || target.isContentEditable) {\n if (target.nodeName === \"INPUT\" && [\"checkbox\", \"radio\"].includes(target.type.toLowerCase())) {\n return;\n }\n if (this._consumedDueWrongTarget(event))\n return;\n this._recorder.recordAction({\n name: \"fill\",\n selector: this._activeModel.selector,\n signals: [],\n text: target.isContentEditable ? target.innerText : target.value\n });\n }\n if (target.nodeName === \"SELECT\") {\n const selectElement = target;\n if (this._actionInProgress(event))\n return;\n this._performAction({\n name: \"select\",\n selector: this._activeModel.selector,\n options: [...selectElement.selectedOptions].map((option) => option.value),\n signals: []\n });\n }\n }\n onKeyDown(event) {\n if (!this._shouldGenerateKeyPressFor(event))\n return;\n if (this._actionInProgress(event)) {\n this._expectProgrammaticKeyUp = true;\n return;\n }\n if (this._consumedDueWrongTarget(event))\n return;\n if (event.key === \" \") {\n const checkbox = asCheckbox(this._recorder.deepEventTarget(event));\n if (checkbox) {\n this._performAction({\n name: checkbox.checked ? \"uncheck\" : \"check\",\n selector: this._activeModel.selector,\n signals: []\n });\n return;\n }\n }\n this._performAction({\n name: \"press\",\n selector: this._activeModel.selector,\n signals: [],\n key: event.key,\n modifiers: modifiersForEvent(event)\n });\n }\n onKeyUp(event) {\n if (!this._shouldGenerateKeyPressFor(event))\n return;\n if (!this._expectProgrammaticKeyUp) {\n consumeEvent(event);\n return;\n }\n this._expectProgrammaticKeyUp = false;\n }\n onScroll(event) {\n this._hoveredModel = null;\n this._hoveredElement = null;\n this._recorder.updateHighlight(null, false);\n }\n _onFocus(userGesture) {\n const activeElement = deepActiveElement(this._recorder.document);\n if (userGesture && activeElement === this._recorder.document.body)\n return;\n const result = activeElement ? this._recorder.injectedScript.generateSelector(activeElement, { testIdAttributeName: this._recorder.state.testIdAttributeName }) : null;\n this._activeModel = result && result.selector ? result : null;\n if (userGesture)\n this._hoveredElement = activeElement;\n this._updateModelForHoveredElement();\n }\n _shouldIgnoreMouseEvent(event) {\n const target = this._recorder.deepEventTarget(event);\n const nodeName = target.nodeName;\n if (nodeName === \"SELECT\" || nodeName === \"OPTION\")\n return true;\n if (nodeName === \"INPUT\" && [\"date\", \"range\"].includes(target.type))\n return true;\n return false;\n }\n _actionInProgress(event) {\n if (this._performingAction)\n return true;\n consumeEvent(event);\n return false;\n }\n _consumedDueToNoModel(event, model) {\n if (model)\n return false;\n consumeEvent(event);\n return true;\n }\n _consumedDueWrongTarget(event) {\n if (this._activeModel && this._activeModel.elements[0] === this._recorder.deepEventTarget(event))\n return false;\n consumeEvent(event);\n return true;\n }\n _performAction(action) {\n this._hoveredElement = null;\n this._hoveredModel = null;\n this._activeModel = null;\n this._recorder.updateHighlight(null, false);\n this._performingAction = true;\n void this._recorder.performAction(action).then(() => {\n this._performingAction = false;\n this._onFocus(false);\n if (this._recorder.injectedScript.isUnderTest) {\n console.error(\"Action performed for test: \" + JSON.stringify({\n // eslint-disable-line no-console\n hovered: this._hoveredModel ? this._hoveredModel.selector : null,\n active: this._activeModel ? this._activeModel.selector : null\n }));\n }\n });\n }\n _shouldGenerateKeyPressFor(event) {\n if (event.key === \"Enter\" && (this._recorder.deepEventTarget(event).nodeName === \"TEXTAREA\" || this._recorder.deepEventTarget(event).isContentEditable))\n return false;\n if ([\"Backspace\", \"Delete\", \"AltGraph\"].includes(event.key))\n return false;\n if (event.key === \"@\" && event.code === \"KeyL\")\n return false;\n if (navigator.platform.includes(\"Mac\")) {\n if (event.key === \"v\" && event.metaKey)\n return false;\n } else {\n if (event.key === \"v\" && event.ctrlKey)\n return false;\n if (event.key === \"Insert\" && event.shiftKey)\n return false;\n }\n if ([\"Shift\", \"Control\", \"Meta\", \"Alt\", \"Process\"].includes(event.key))\n return false;\n const hasModifier = event.ctrlKey || event.altKey || event.metaKey;\n if (event.key.length === 1 && !hasModifier)\n return !!asCheckbox(this._recorder.deepEventTarget(event));\n return true;\n }\n _updateModelForHoveredElement() {\n if (!this._hoveredElement || !this._hoveredElement.isConnected) {\n this._hoveredModel = null;\n this._hoveredElement = null;\n this._recorder.updateHighlight(null, true);\n return;\n }\n const { selector, elements } = this._recorder.injectedScript.generateSelector(this._hoveredElement, { testIdAttributeName: this._recorder.state.testIdAttributeName });\n if (this._hoveredModel && this._hoveredModel.selector === selector)\n return;\n this._hoveredModel = selector ? { selector, elements, color: \"#dc6f6f7f\" } : null;\n this._recorder.updateHighlight(this._hoveredModel, true);\n }\n};\nvar TextAssertionTool = class {\n constructor(recorder, kind) {\n this._hoverHighlight = null;\n this._action = null;\n this._textCache = /* @__PURE__ */ new Map();\n this._recorder = recorder;\n this._kind = kind;\n this._dialog = new Dialog(recorder);\n }\n cursor() {\n return \"pointer\";\n }\n cleanup() {\n this._dialog.close();\n this._hoverHighlight = null;\n }\n onClick(event) {\n consumeEvent(event);\n if (this._kind === \"value\") {\n this._commitAssertValue();\n } else {\n if (!this._dialog.isShowing())\n this._showDialog();\n }\n }\n onMouseDown(event) {\n const target = this._recorder.deepEventTarget(event);\n if (this._elementHasValue(target))\n event.preventDefault();\n }\n onPointerUp(event) {\n var _a;\n const target = (_a = this._hoverHighlight) == null ? void 0 : _a.elements[0];\n if (this._kind === \"value\" && target && (target.nodeName === \"INPUT\" || target.nodeName === \"SELECT\") && target.disabled) {\n this._commitAssertValue();\n }\n }\n onMouseMove(event) {\n var _a;\n if (this._dialog.isShowing())\n return;\n const target = this._recorder.deepEventTarget(event);\n if (((_a = this._hoverHighlight) == null ? void 0 : _a.elements[0]) === target)\n return;\n if (this._kind === \"text\")\n this._hoverHighlight = this._recorder.injectedScript.utils.elementText(this._textCache, target).full ? { elements: [target], selector: \"\" } : null;\n else\n this._hoverHighlight = this._elementHasValue(target) ? this._recorder.injectedScript.generateSelector(target, { testIdAttributeName: this._recorder.state.testIdAttributeName }) : null;\n if (this._hoverHighlight)\n this._hoverHighlight.color = \"#8acae480\";\n this._recorder.updateHighlight(this._hoverHighlight, true);\n }\n onKeyDown(event) {\n if (event.key === \"Escape\")\n this._recorder.setMode(\"recording\");\n consumeEvent(event);\n }\n onScroll(event) {\n this._recorder.updateHighlight(this._hoverHighlight, false);\n }\n _elementHasValue(element) {\n return element.nodeName === \"TEXTAREA\" || element.nodeName === \"SELECT\" || element.nodeName === \"INPUT\" && ![\"button\", \"image\", \"reset\", \"submit\"].includes(element.type);\n }\n _generateAction() {\n var _a;\n this._textCache.clear();\n const target = (_a = this._hoverHighlight) == null ? void 0 : _a.elements[0];\n if (!target)\n return null;\n if (this._kind === \"value\") {\n if (!this._elementHasValue(target))\n return null;\n const { selector } = this._recorder.injectedScript.generateSelector(target, { testIdAttributeName: this._recorder.state.testIdAttributeName });\n if (target.nodeName === \"INPUT\" && [\"checkbox\", \"radio\"].includes(target.type.toLowerCase())) {\n return {\n name: \"assertChecked\",\n selector,\n signals: [],\n // Interestingly, inputElement.checked is reversed inside this event handler.\n checked: !target.checked\n };\n } else {\n return {\n name: \"assertValue\",\n selector,\n signals: [],\n value: target.value\n };\n }\n } else {\n this._hoverHighlight = this._recorder.injectedScript.generateSelector(target, { testIdAttributeName: this._recorder.state.testIdAttributeName, forTextExpect: true });\n this._hoverHighlight.color = \"#8acae480\";\n this._recorder.updateHighlight(this._hoverHighlight, true);\n return {\n name: \"assertText\",\n selector: this._hoverHighlight.selector,\n signals: [],\n text: this._recorder.injectedScript.utils.elementText(this._textCache, target).normalized,\n substring: true\n };\n }\n }\n _renderValue(action) {\n if ((action == null ? void 0 : action.name) === \"assertText\")\n return this._recorder.injectedScript.utils.normalizeWhiteSpace(action.text);\n if ((action == null ? void 0 : action.name) === \"assertChecked\")\n return String(action.checked);\n if ((action == null ? void 0 : action.name) === \"assertValue\")\n return action.value;\n return \"\";\n }\n _commit() {\n if (!this._action || !this._dialog.isShowing())\n return;\n this._dialog.close();\n this._recorder.recordAction(this._action);\n this._recorder.setMode(\"recording\");\n }\n _showDialog() {\n var _a;\n if (!((_a = this._hoverHighlight) == null ? void 0 : _a.elements[0]))\n return;\n this._action = this._generateAction();\n if (!this._action || this._action.name !== \"assertText\")\n return;\n const action = this._action;\n const textElement = this._recorder.document.createElement(\"textarea\");\n textElement.setAttribute(\"spellcheck\", \"false\");\n textElement.value = this._renderValue(this._action);\n textElement.classList.add(\"text-editor\");\n const updateAndValidate = () => {\n var _a2;\n const newValue = this._recorder.injectedScript.utils.normalizeWhiteSpace(textElement.value);\n const target = (_a2 = this._hoverHighlight) == null ? void 0 : _a2.elements[0];\n if (!target)\n return;\n action.text = newValue;\n const targetText = this._recorder.injectedScript.utils.elementText(this._textCache, target).normalized;\n const matches = newValue && targetText.includes(newValue);\n textElement.classList.toggle(\"does-not-match\", !matches);\n };\n textElement.addEventListener(\"input\", updateAndValidate);\n const label = \"Assert that element contains text\";\n const dialogElement = this._dialog.show({\n label,\n body: textElement,\n onCommit: () => this._commit()\n });\n const position = this._recorder.highlight.tooltipPosition(this._recorder.highlight.firstBox(), dialogElement);\n this._dialog.moveTo(position.anchorTop, position.anchorLeft);\n textElement.focus();\n }\n _commitAssertValue() {\n var _a;\n if (this._kind !== \"value\")\n return;\n const action = this._generateAction();\n if (!action)\n return;\n this._recorder.recordAction(action);\n this._recorder.setMode(\"recording\");\n (_a = this._recorder.overlay) == null ? void 0 : _a.flashToolSucceeded(\"assertingValue\");\n }\n};\nvar Overlay = class {\n constructor(recorder) {\n this._listeners = [];\n this._offsetX = 0;\n this._measure = { width: 0, height: 0 };\n this._recorder = recorder;\n const document = this._recorder.document;\n this._overlayElement = document.createElement(\"x-pw-overlay\");\n this._overlayElement.appendChild(createSvgElement(this._recorder.document, clipPaths_default));\n const toolsListElement = document.createElement(\"x-pw-tools-list\");\n this._overlayElement.appendChild(toolsListElement);\n this._dragHandle = document.createElement(\"x-pw-tool-gripper\");\n this._dragHandle.appendChild(document.createElement(\"x-div\"));\n toolsListElement.appendChild(this._dragHandle);\n this._recordToggle = this._recorder.document.createElement(\"x-pw-tool-item\");\n this._recordToggle.title = \"Record\";\n this._recordToggle.classList.add(\"record\");\n this._recordToggle.appendChild(this._recorder.document.createElement(\"x-div\"));\n toolsListElement.appendChild(this._recordToggle);\n this._pickLocatorToggle = this._recorder.document.createElement(\"x-pw-tool-item\");\n this._pickLocatorToggle.title = \"Pick locator\";\n this._pickLocatorToggle.classList.add(\"pick-locator\");\n this._pickLocatorToggle.appendChild(this._recorder.document.createElement(\"x-div\"));\n toolsListElement.appendChild(this._pickLocatorToggle);\n this._assertVisibilityToggle = this._recorder.document.createElement(\"x-pw-tool-item\");\n this._assertVisibilityToggle.title = \"Assert visibility\";\n this._assertVisibilityToggle.classList.add(\"visibility\");\n this._assertVisibilityToggle.appendChild(this._recorder.document.createElement(\"x-div\"));\n toolsListElement.appendChild(this._assertVisibilityToggle);\n this._assertTextToggle = this._recorder.document.createElement(\"x-pw-tool-item\");\n this._assertTextToggle.title = \"Assert text\";\n this._assertTextToggle.classList.add(\"text\");\n this._assertTextToggle.appendChild(this._recorder.document.createElement(\"x-div\"));\n toolsListElement.appendChild(this._assertTextToggle);\n this._assertValuesToggle = this._recorder.document.createElement(\"x-pw-tool-item\");\n this._assertValuesToggle.title = \"Assert value\";\n this._assertValuesToggle.classList.add(\"value\");\n this._assertValuesToggle.appendChild(this._recorder.document.createElement(\"x-div\"));\n toolsListElement.appendChild(this._assertValuesToggle);\n this._updateVisualPosition();\n this._refreshListeners();\n }\n _refreshListeners() {\n removeEventListeners(this._listeners);\n this._listeners = [\n addEventListener(this._dragHandle, \"mousedown\", (event) => {\n this._dragState = { offsetX: this._offsetX, dragStart: { x: event.clientX, y: 0 } };\n }),\n addEventListener(this._recordToggle, \"click\", () => {\n this._recorder.setMode(this._recorder.state.mode === \"none\" || this._recorder.state.mode === \"standby\" || this._recorder.state.mode === \"inspecting\" ? \"recording\" : \"standby\");\n }),\n addEventListener(this._pickLocatorToggle, \"click\", () => {\n const newMode = {\n \"inspecting\": \"standby\",\n \"none\": \"inspecting\",\n \"standby\": \"inspecting\",\n \"recording\": \"recording-inspecting\",\n \"recording-inspecting\": \"recording\",\n \"assertingText\": \"recording-inspecting\",\n \"assertingVisibility\": \"recording-inspecting\",\n \"assertingValue\": \"recording-inspecting\"\n };\n this._recorder.setMode(newMode[this._recorder.state.mode]);\n }),\n addEventListener(this._assertVisibilityToggle, \"click\", () => {\n if (!this._assertVisibilityToggle.classList.contains(\"disabled\"))\n this._recorder.setMode(this._recorder.state.mode === \"assertingVisibility\" ? \"recording\" : \"assertingVisibility\");\n }),\n addEventListener(this._assertTextToggle, \"click\", () => {\n if (!this._assertTextToggle.classList.contains(\"disabled\"))\n this._recorder.setMode(this._recorder.state.mode === \"assertingText\" ? \"recording\" : \"assertingText\");\n }),\n addEventListener(this._assertValuesToggle, \"click\", () => {\n if (!this._assertValuesToggle.classList.contains(\"disabled\"))\n this._recorder.setMode(this._recorder.state.mode === \"assertingValue\" ? \"recording\" : \"assertingValue\");\n })\n ];\n }\n install() {\n this._recorder.highlight.appendChild(this._overlayElement);\n this._refreshListeners();\n this._updateVisualPosition();\n }\n contains(element) {\n return this._recorder.injectedScript.utils.isInsideScope(this._overlayElement, element);\n }\n setUIState(state) {\n this._recordToggle.classList.toggle(\"active\", state.mode === \"recording\" || state.mode === \"assertingText\" || state.mode === \"assertingVisibility\" || state.mode === \"assertingValue\" || state.mode === \"recording-inspecting\");\n this._pickLocatorToggle.classList.toggle(\"active\", state.mode === \"inspecting\" || state.mode === \"recording-inspecting\");\n this._assertVisibilityToggle.classList.toggle(\"active\", state.mode === \"assertingVisibility\");\n this._assertVisibilityToggle.classList.toggle(\"disabled\", state.mode === \"none\" || state.mode === \"standby\" || state.mode === \"inspecting\");\n this._assertTextToggle.classList.toggle(\"active\", state.mode === \"assertingText\");\n this._assertTextToggle.classList.toggle(\"disabled\", state.mode === \"none\" || state.mode === \"standby\" || state.mode === \"inspecting\");\n this._assertValuesToggle.classList.toggle(\"active\", state.mode === \"assertingValue\");\n this._assertValuesToggle.classList.toggle(\"disabled\", state.mode === \"none\" || state.mode === \"standby\" || state.mode === \"inspecting\");\n if (this._offsetX !== state.overlay.offsetX) {\n this._offsetX = state.overlay.offsetX;\n this._updateVisualPosition();\n }\n if (state.mode === \"none\")\n this._hideOverlay();\n else\n this._showOverlay();\n }\n flashToolSucceeded(tool) {\n const element = tool === \"assertingVisibility\" ? this._assertVisibilityToggle : this._assertValuesToggle;\n element.classList.add(\"succeeded\");\n this._recorder.injectedScript.builtinSetTimeout(() => element.classList.remove(\"succeeded\"), 2e3);\n }\n _hideOverlay() {\n this._overlayElement.setAttribute(\"hidden\", \"true\");\n }\n _showOverlay() {\n if (!this._overlayElement.hasAttribute(\"hidden\"))\n return;\n this._overlayElement.removeAttribute(\"hidden\");\n this._updateVisualPosition();\n }\n _updateVisualPosition() {\n this._measure = this._overlayElement.getBoundingClientRect();\n this._overlayElement.style.left = (this._recorder.injectedScript.window.innerWidth - this._measure.width) / 2 + this._offsetX + \"px\";\n }\n onMouseMove(event) {\n if (!event.buttons) {\n this._dragState = void 0;\n return false;\n }\n if (this._dragState) {\n this._offsetX = this._dragState.offsetX + event.clientX - this._dragState.dragStart.x;\n const halfGapSize = (this._recorder.injectedScript.window.innerWidth - this._measure.width) / 2 - 10;\n this._offsetX = Math.max(-halfGapSize, Math.min(halfGapSize, this._offsetX));\n this._updateVisualPosition();\n this._recorder.setOverlayState({ offsetX: this._offsetX });\n consumeEvent(event);\n return true;\n }\n return false;\n }\n onMouseUp(event) {\n if (this._dragState) {\n consumeEvent(event);\n return true;\n }\n return false;\n }\n onClick(event) {\n if (this._dragState) {\n this._dragState = void 0;\n consumeEvent(event);\n return true;\n }\n return false;\n }\n};\nvar Recorder = class {\n constructor(injectedScript) {\n this._listeners = [];\n this._actionSelectorModel = null;\n this.state = {\n mode: \"none\",\n testIdAttributeName: \"data-testid\",\n language: \"javascript\",\n overlay: { offsetX: 0 }\n };\n this._delegate = {};\n this.document = injectedScript.document;\n this.injectedScript = injectedScript;\n this.highlight = injectedScript.createHighlight();\n this._tools = {\n \"none\": new NoneTool(),\n \"standby\": new NoneTool(),\n \"inspecting\": new InspectTool(this, false),\n \"recording\": new RecordActionTool(this),\n \"recording-inspecting\": new InspectTool(this, false),\n \"assertingText\": new TextAssertionTool(this, \"text\"),\n \"assertingVisibility\": new InspectTool(this, true),\n \"assertingValue\": new TextAssertionTool(this, \"value\")\n };\n this._currentTool = this._tools.none;\n if (injectedScript.window.top === injectedScript.window) {\n this.overlay = new Overlay(this);\n this.overlay.setUIState(this.state);\n }\n this._stylesheet = new injectedScript.window.CSSStyleSheet();\n this._stylesheet.replaceSync(`\n body[data-pw-cursor=pointer] *, body[data-pw-cursor=pointer] *::after { cursor: pointer !important; }\n body[data-pw-cursor=text] *, body[data-pw-cursor=text] *::after { cursor: text !important; }\n `);\n this.installListeners();\n injectedScript.utils.cacheNormalizedWhitespaces();\n if (injectedScript.isUnderTest)\n console.error(\"Recorder script ready for test\");\n }\n installListeners() {\n var _a;\n removeEventListeners(this._listeners);\n this._listeners = [\n addEventListener(this.document, \"click\", (event) => this._onClick(event), true),\n addEventListener(this.document, \"auxclick\", (event) => this._onClick(event), true),\n addEventListener(this.document, \"contextmenu\", (event) => this._onContextMenu(event), true),\n addEventListener(this.document, \"dragstart\", (event) => this._onDragStart(event), true),\n addEventListener(this.document, \"input\", (event) => this._onInput(event), true),\n addEventListener(this.document, \"keydown\", (event) => this._onKeyDown(event), true),\n addEventListener(this.document, \"keyup\", (event) => this._onKeyUp(event), true),\n addEventListener(this.document, \"pointerdown\", (event) => this._onPointerDown(event), true),\n addEventListener(this.document, \"pointerup\", (event) => this._onPointerUp(event), true),\n addEventListener(this.document, \"mousedown\", (event) => this._onMouseDown(event), true),\n addEventListener(this.document, \"mouseup\", (event) => this._onMouseUp(event), true),\n addEventListener(this.document, \"mousemove\", (event) => this._onMouseMove(event), true),\n addEventListener(this.document, \"mouseleave\", (event) => this._onMouseLeave(event), true),\n addEventListener(this.document, \"mouseenter\", (event) => this._onMouseEnter(event), true),\n addEventListener(this.document, \"focus\", (event) => this._onFocus(event), true),\n addEventListener(this.document, \"scroll\", (event) => this._onScroll(event), true)\n ];\n this.highlight.install();\n (_a = this.overlay) == null ? void 0 : _a.install();\n this.document.adoptedStyleSheets.push(this._stylesheet);\n }\n _switchCurrentTool() {\n var _a, _b, _c;\n const newTool = this._tools[this.state.mode];\n if (newTool === this._currentTool)\n return;\n (_b = (_a = this._currentTool).cleanup) == null ? void 0 : _b.call(_a);\n this.clearHighlight();\n this._currentTool = newTool;\n (_c = this.injectedScript.document.body) == null ? void 0 : _c.setAttribute(\"data-pw-cursor\", newTool.cursor());\n }\n setUIState(state, delegate) {\n var _a, _b, _c, _d;\n this._delegate = delegate;\n if (state.actionPoint && this.state.actionPoint && state.actionPoint.x === this.state.actionPoint.x && state.actionPoint.y === this.state.actionPoint.y) {\n } else if (!state.actionPoint && !this.state.actionPoint) {\n } else {\n if (state.actionPoint)\n this.highlight.showActionPoint(state.actionPoint.x, state.actionPoint.y);\n else\n this.highlight.hideActionPoint();\n }\n this.state = state;\n this.highlight.setLanguage(state.language);\n this._switchCurrentTool();\n (_a = this.overlay) == null ? void 0 : _a.setUIState(state);\n if (((_b = this._actionSelectorModel) == null ? void 0 : _b.selector) && !((_c = this._actionSelectorModel) == null ? void 0 : _c.elements.length))\n this._actionSelectorModel = null;\n if (state.actionSelector !== ((_d = this._actionSelectorModel) == null ? void 0 : _d.selector))\n this._actionSelectorModel = state.actionSelector ? querySelector(this.injectedScript, state.actionSelector, this.document) : null;\n if (this.state.mode === \"none\" || this.state.mode === \"standby\")\n this.updateHighlight(this._actionSelectorModel, false);\n }\n clearHighlight() {\n var _a, _b;\n (_b = (_a = this._currentTool).cleanup) == null ? void 0 : _b.call(_a);\n this.updateHighlight(null, false);\n }\n _onClick(event) {\n var _a, _b, _c;\n if (!event.isTrusted)\n return;\n if ((_a = this.overlay) == null ? void 0 : _a.onClick(event))\n return;\n if (this._ignoreOverlayEvent(event))\n return;\n (_c = (_b = this._currentTool).onClick) == null ? void 0 : _c.call(_b, event);\n }\n _onContextMenu(event) {\n var _a, _b;\n if (!event.isTrusted)\n return;\n if (this._ignoreOverlayEvent(event))\n return;\n (_b = (_a = this._currentTool).onContextMenu) == null ? void 0 : _b.call(_a, event);\n }\n _onDragStart(event) {\n var _a, _b;\n if (!event.isTrusted)\n return;\n if (this._ignoreOverlayEvent(event))\n return;\n (_b = (_a = this._currentTool).onDragStart) == null ? void 0 : _b.call(_a, event);\n }\n _onPointerDown(event) {\n var _a, _b;\n if (!event.isTrusted)\n return;\n if (this._ignoreOverlayEvent(event))\n return;\n (_b = (_a = this._currentTool).onPointerDown) == null ? void 0 : _b.call(_a, event);\n }\n _onPointerUp(event) {\n var _a, _b;\n if (!event.isTrusted)\n return;\n if (this._ignoreOverlayEvent(event))\n return;\n (_b = (_a = this._currentTool).onPointerUp) == null ? void 0 : _b.call(_a, event);\n }\n _onMouseDown(event) {\n var _a, _b;\n if (!event.isTrusted)\n return;\n if (this._ignoreOverlayEvent(event))\n return;\n (_b = (_a = this._currentTool).onMouseDown) == null ? void 0 : _b.call(_a, event);\n }\n _onMouseUp(event) {\n var _a, _b, _c;\n if (!event.isTrusted)\n return;\n if ((_a = this.overlay) == null ? void 0 : _a.onMouseUp(event))\n return;\n if (this._ignoreOverlayEvent(event))\n return;\n (_c = (_b = this._currentTool).onMouseUp) == null ? void 0 : _c.call(_b, event);\n }\n _onMouseMove(event) {\n var _a, _b, _c;\n if (!event.isTrusted)\n return;\n if ((_a = this.overlay) == null ? void 0 : _a.onMouseMove(event))\n return;\n if (this._ignoreOverlayEvent(event))\n return;\n (_c = (_b = this._currentTool).onMouseMove) == null ? void 0 : _c.call(_b, event);\n }\n _onMouseEnter(event) {\n var _a, _b;\n if (!event.isTrusted)\n return;\n if (this._ignoreOverlayEvent(event))\n return;\n (_b = (_a = this._currentTool).onMouseEnter) == null ? void 0 : _b.call(_a, event);\n }\n _onMouseLeave(event) {\n var _a, _b;\n if (!event.isTrusted)\n return;\n if (this._ignoreOverlayEvent(event))\n return;\n (_b = (_a = this._currentTool).onMouseLeave) == null ? void 0 : _b.call(_a, event);\n }\n _onFocus(event) {\n var _a, _b;\n if (!event.isTrusted)\n return;\n if (this._ignoreOverlayEvent(event))\n return;\n (_b = (_a = this._currentTool).onFocus) == null ? void 0 : _b.call(_a, event);\n }\n _onScroll(event) {\n var _a, _b;\n if (!event.isTrusted)\n return;\n this.highlight.hideActionPoint();\n (_b = (_a = this._currentTool).onScroll) == null ? void 0 : _b.call(_a, event);\n }\n _onInput(event) {\n var _a, _b;\n if (this._ignoreOverlayEvent(event))\n return;\n (_b = (_a = this._currentTool).onInput) == null ? void 0 : _b.call(_a, event);\n }\n _onKeyDown(event) {\n var _a, _b;\n if (!event.isTrusted)\n return;\n if (this._ignoreOverlayEvent(event))\n return;\n (_b = (_a = this._currentTool).onKeyDown) == null ? void 0 : _b.call(_a, event);\n }\n _onKeyUp(event) {\n var _a, _b;\n if (!event.isTrusted)\n return;\n if (this._ignoreOverlayEvent(event))\n return;\n (_b = (_a = this._currentTool).onKeyUp) == null ? void 0 : _b.call(_a, event);\n }\n updateHighlight(model, userGesture) {\n var _a, _b;\n let tooltipText = model == null ? void 0 : model.tooltipText;\n if (tooltipText === void 0 && !(model == null ? void 0 : model.tooltipList) && (model == null ? void 0 : model.selector))\n tooltipText = this.injectedScript.utils.asLocator(this.state.language, model.selector);\n this.highlight.updateHighlight((model == null ? void 0 : model.elements) || [], { ...model, tooltipText });\n if (userGesture)\n (_b = (_a = this._delegate).highlightUpdated) == null ? void 0 : _b.call(_a);\n }\n _ignoreOverlayEvent(event) {\n return event.composedPath().some((e) => {\n const nodeName = e.nodeName || \"\";\n return nodeName.toLowerCase() === \"x-pw-glass\";\n });\n }\n deepEventTarget(event) {\n var _a;\n for (const element of event.composedPath()) {\n if (!((_a = this.overlay) == null ? void 0 : _a.contains(element)))\n return element;\n }\n return event.composedPath()[0];\n }\n setMode(mode) {\n var _a, _b;\n void ((_b = (_a = this._delegate).setMode) == null ? void 0 : _b.call(_a, mode));\n }\n async performAction(action) {\n var _a, _b;\n await ((_b = (_a = this._delegate).performAction) == null ? void 0 : _b.call(_a, action).catch(() => {\n }));\n }\n recordAction(action) {\n var _a, _b;\n void ((_b = (_a = this._delegate).recordAction) == null ? void 0 : _b.call(_a, action));\n }\n setOverlayState(state) {\n var _a, _b;\n void ((_b = (_a = this._delegate).setOverlayState) == null ? void 0 : _b.call(_a, state));\n }\n setSelector(selector) {\n var _a, _b;\n void ((_b = (_a = this._delegate).setSelector) == null ? void 0 : _b.call(_a, selector));\n }\n};\nvar Dialog = class {\n constructor(recorder) {\n this._dialogElement = null;\n this._recorder = recorder;\n }\n isShowing() {\n return !!this._dialogElement;\n }\n show(options) {\n const acceptButton = this._recorder.document.createElement(\"x-pw-tool-item\");\n acceptButton.title = \"Accept\";\n acceptButton.classList.add(\"accept\");\n acceptButton.appendChild(this._recorder.document.createElement(\"x-div\"));\n acceptButton.addEventListener(\"click\", () => options.onCommit());\n const cancelButton = this._recorder.document.createElement(\"x-pw-tool-item\");\n cancelButton.title = \"Close\";\n cancelButton.classList.add(\"cancel\");\n cancelButton.appendChild(this._recorder.document.createElement(\"x-div\"));\n cancelButton.addEventListener(\"click\", () => {\n var _a;\n this.close();\n (_a = options.onCancel) == null ? void 0 : _a.call(options);\n });\n this._dialogElement = this._recorder.document.createElement(\"x-pw-dialog\");\n this._keyboardListener = (event) => {\n var _a;\n if (event.key === \"Escape\") {\n this.close();\n (_a = options.onCancel) == null ? void 0 : _a.call(options);\n return;\n }\n if (event.key === \"Enter\" && (event.ctrlKey || event.metaKey)) {\n if (this._dialogElement)\n options.onCommit();\n return;\n }\n };\n this._recorder.document.addEventListener(\"keydown\", this._keyboardListener, true);\n const toolbarElement = this._recorder.document.createElement(\"x-pw-tools-list\");\n const labelElement = this._recorder.document.createElement(\"label\");\n labelElement.textContent = options.label;\n toolbarElement.appendChild(labelElement);\n toolbarElement.appendChild(this._recorder.document.createElement(\"x-spacer\"));\n toolbarElement.appendChild(acceptButton);\n toolbarElement.appendChild(cancelButton);\n this._dialogElement.appendChild(toolbarElement);\n const bodyElement = this._recorder.document.createElement(\"x-pw-dialog-body\");\n bodyElement.appendChild(options.body);\n this._dialogElement.appendChild(bodyElement);\n this._recorder.highlight.appendChild(this._dialogElement);\n return this._dialogElement;\n }\n moveTo(top, left) {\n if (!this._dialogElement)\n return;\n this._dialogElement.style.top = top + \"px\";\n this._dialogElement.style.left = left + \"px\";\n }\n close() {\n if (!this._dialogElement)\n return;\n this._dialogElement.remove();\n this._recorder.document.removeEventListener(\"keydown\", this._keyboardListener);\n this._dialogElement = null;\n }\n};\nfunction deepActiveElement(document) {\n let activeElement = document.activeElement;\n while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)\n activeElement = activeElement.shadowRoot.activeElement;\n return activeElement;\n}\nfunction modifiersForEvent(event) {\n return (event.altKey ? 1 : 0) | (event.ctrlKey ? 2 : 0) | (event.metaKey ? 4 : 0) | (event.shiftKey ? 8 : 0);\n}\nfunction buttonForEvent(event) {\n switch (event.which) {\n case 1:\n return \"left\";\n case 2:\n return \"middle\";\n case 3:\n return \"right\";\n }\n return \"left\";\n}\nfunction positionForEvent(event) {\n const targetElement = event.target;\n if (targetElement.nodeName !== \"CANVAS\")\n return;\n return {\n x: event.offsetX,\n y: event.offsetY\n };\n}\nfunction consumeEvent(e) {\n e.preventDefault();\n e.stopPropagation();\n e.stopImmediatePropagation();\n}\nfunction asCheckbox(node) {\n if (!node || node.nodeName !== \"INPUT\")\n return null;\n const inputElement = node;\n return [\"checkbox\", \"radio\"].includes(inputElement.type) ? inputElement : null;\n}\nfunction isRangeInput(node) {\n if (!node || node.nodeName !== \"INPUT\")\n return false;\n const inputElement = node;\n return inputElement.type.toLowerCase() === \"range\";\n}\nfunction addEventListener(target, eventName, listener, useCapture) {\n target.addEventListener(eventName, listener, useCapture);\n const remove = () => {\n target.removeEventListener(eventName, listener, useCapture);\n };\n return remove;\n}\nfunction removeEventListeners(listeners) {\n for (const listener of listeners)\n listener();\n listeners.splice(0, listeners.length);\n}\nfunction querySelector(injectedScript, selector, ownerDocument) {\n try {\n const parsedSelector = injectedScript.parseSelector(selector);\n return {\n selector,\n elements: injectedScript.querySelectorAll(parsedSelector, ownerDocument)\n };\n } catch (e) {\n return {\n selector,\n elements: []\n };\n }\n}\nfunction createSvgElement(doc, { tagName, attrs, children }) {\n const elem = doc.createElementNS(\"http://www.w3.org/2000/svg\", tagName);\n if (attrs) {\n for (const [k, v] of Object.entries(attrs))\n elem.setAttribute(k, v);\n }\n if (children) {\n for (const c of children)\n elem.appendChild(createSvgElement(doc, c));\n }\n return elem;\n}\nvar PollingRecorder = class {\n constructor(injectedScript) {\n this._recorder = new Recorder(injectedScript);\n this._embedder = injectedScript.window;\n injectedScript.onGlobalListenersRemoved.add(() => this._recorder.installListeners());\n const refreshOverlay = () => {\n this._pollRecorderMode().catch((e) => console.log(e));\n };\n this._embedder.__pw_refreshOverlay = refreshOverlay;\n refreshOverlay();\n }\n async _pollRecorderMode() {\n const pollPeriod = 1e3;\n if (this._pollRecorderModeTimer)\n clearTimeout(this._pollRecorderModeTimer);\n const state = await this._embedder.__pw_recorderState().catch(() => {\n });\n if (!state) {\n this._pollRecorderModeTimer = this._recorder.injectedScript.builtinSetTimeout(() => this._pollRecorderMode(), pollPeriod);\n return;\n }\n const win = this._recorder.document.defaultView;\n if (win.top !== win) {\n state.actionPoint = void 0;\n }\n this._recorder.setUIState(state, this);\n this._pollRecorderModeTimer = this._recorder.injectedScript.builtinSetTimeout(() => this._pollRecorderMode(), pollPeriod);\n }\n async performAction(action, simpleDomNode) {\n await this._embedder.__pw_recorderPerformAction(action, simpleDomNode);\n }\n async recordAction(action, simpleDomNode) {\n await this._embedder.__pw_recorderRecordAction(action, simpleDomNode);\n }\n async setSelector(selector) {\n await this._embedder.__pw_recorderSetSelector(selector);\n }\n async setMode(mode) {\n await this._embedder.__pw_recorderSetMode(mode);\n }\n async setOverlayState(state) {\n await this._embedder.__pw_recorderSetOverlayState(state);\n }\n};\nvar recorder_default = PollingRecorder;\n";
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.source = void 0;
7
+ const source = exports.source = "\nvar __commonJS = obj => {\n let required = false;\n let result;\n return function __require() {\n if (!required) {\n required = true;\n let fn;\n for (const name in obj) { fn = obj[name]; break; }\n const module = { exports: {} };\n fn(module.exports, module);\n result = module.exports;\n }\n return result;\n }\n};\nvar __export = (target, all) => {for (var name in all) target[name] = all[name];};\nvar __toESM = mod => ({ ...mod, 'default': mod });\nvar __toCommonJS = mod => ({ ...mod, __esModule: true });\n\n\n// packages/playwright-core/src/server/injected/utilityScript.ts\nvar utilityScript_exports = {};\n__export(utilityScript_exports, {\n UtilityScript: () => UtilityScript\n});\nmodule.exports = __toCommonJS(utilityScript_exports);\n\n// packages/playwright-core/src/server/isomorphic/utilityScriptSerializers.ts\nfunction source() {\n function isRegExp(obj) {\n try {\n return obj instanceof RegExp || Object.prototype.toString.call(obj) === \"[object RegExp]\";\n } catch (error) {\n return false;\n }\n }\n function isDate(obj) {\n try {\n return obj instanceof Date || Object.prototype.toString.call(obj) === \"[object Date]\";\n } catch (error) {\n return false;\n }\n }\n function isURL(obj) {\n try {\n return obj instanceof URL || Object.prototype.toString.call(obj) === \"[object URL]\";\n } catch (error) {\n return false;\n }\n }\n function isError(obj) {\n var _a;\n try {\n return obj instanceof Error || obj && ((_a = Object.getPrototypeOf(obj)) == null ? void 0 : _a.name) === \"Error\";\n } catch (error) {\n return false;\n }\n }\n function parseEvaluationResultValue2(value, handles = [], refs = /* @__PURE__ */ new Map()) {\n if (Object.is(value, void 0))\n return void 0;\n if (typeof value === \"object\" && value) {\n if (\"ref\" in value)\n return refs.get(value.ref);\n if (\"v\" in value) {\n if (value.v === \"undefined\")\n return void 0;\n if (value.v === \"null\")\n return null;\n if (value.v === \"NaN\")\n return NaN;\n if (value.v === \"Infinity\")\n return Infinity;\n if (value.v === \"-Infinity\")\n return -Infinity;\n if (value.v === \"-0\")\n return -0;\n return void 0;\n }\n if (\"d\" in value)\n return new Date(value.d);\n if (\"u\" in value)\n return new URL(value.u);\n if (\"bi\" in value)\n return BigInt(value.bi);\n if (\"e\" in value) {\n const error = new Error(value.e.m);\n error.name = value.e.n;\n error.stack = value.e.s;\n return error;\n }\n if (\"r\" in value)\n return new RegExp(value.r.p, value.r.f);\n if (\"a\" in value) {\n const result2 = [];\n refs.set(value.id, result2);\n for (const a of value.a)\n result2.push(parseEvaluationResultValue2(a, handles, refs));\n return result2;\n }\n if (\"o\" in value) {\n const result2 = {};\n refs.set(value.id, result2);\n for (const { k, v } of value.o)\n result2[k] = parseEvaluationResultValue2(v, handles, refs);\n return result2;\n }\n if (\"h\" in value)\n return handles[value.h];\n }\n return value;\n }\n function serializeAsCallArgument2(value, handleSerializer) {\n return serialize(value, handleSerializer, { visited: /* @__PURE__ */ new Map(), lastId: 0 });\n }\n function serialize(value, handleSerializer, visitorInfo) {\n if (value && typeof value === \"object\") {\n if (typeof globalThis.Window === \"function\" && value instanceof globalThis.Window)\n return \"ref: <Window>\";\n if (typeof globalThis.Document === \"function\" && value instanceof globalThis.Document)\n return \"ref: <Document>\";\n if (typeof globalThis.Node === \"function\" && value instanceof globalThis.Node)\n return \"ref: <Node>\";\n }\n return innerSerialize(value, handleSerializer, visitorInfo);\n }\n function innerSerialize(value, handleSerializer, visitorInfo) {\n var _a;\n const result2 = handleSerializer(value);\n if (\"fallThrough\" in result2)\n value = result2.fallThrough;\n else\n return result2;\n if (typeof value === \"symbol\")\n return { v: \"undefined\" };\n if (Object.is(value, void 0))\n return { v: \"undefined\" };\n if (Object.is(value, null))\n return { v: \"null\" };\n if (Object.is(value, NaN))\n return { v: \"NaN\" };\n if (Object.is(value, Infinity))\n return { v: \"Infinity\" };\n if (Object.is(value, -Infinity))\n return { v: \"-Infinity\" };\n if (Object.is(value, -0))\n return { v: \"-0\" };\n if (typeof value === \"boolean\")\n return value;\n if (typeof value === \"number\")\n return value;\n if (typeof value === \"string\")\n return value;\n if (typeof value === \"bigint\")\n return { bi: value.toString() };\n if (isError(value)) {\n let stack;\n if ((_a = value.stack) == null ? void 0 : _a.startsWith(value.name + \": \" + value.message)) {\n stack = value.stack;\n } else {\n stack = `${value.name}: ${value.message}\n${value.stack}`;\n }\n return { e: { n: value.name, m: value.message, s: stack } };\n }\n if (isDate(value))\n return { d: value.toJSON() };\n if (isURL(value))\n return { u: value.toJSON() };\n if (isRegExp(value))\n return { r: { p: value.source, f: value.flags } };\n const id = visitorInfo.visited.get(value);\n if (id)\n return { ref: id };\n if (Array.isArray(value)) {\n const a = [];\n const id2 = ++visitorInfo.lastId;\n visitorInfo.visited.set(value, id2);\n for (let i = 0; i < value.length; ++i)\n a.push(serialize(value[i], handleSerializer, visitorInfo));\n return { a, id: id2 };\n }\n if (typeof value === \"object\") {\n const o = [];\n const id2 = ++visitorInfo.lastId;\n visitorInfo.visited.set(value, id2);\n for (const name of Object.keys(value)) {\n let item;\n try {\n item = value[name];\n } catch (e) {\n continue;\n }\n if (name === \"toJSON\" && typeof item === \"function\")\n o.push({ k: name, v: { o: [], id: 0 } });\n else\n o.push({ k: name, v: serialize(item, handleSerializer, visitorInfo) });\n }\n let jsonWrapper;\n try {\n if (o.length === 0 && value.toJSON && typeof value.toJSON === \"function\")\n jsonWrapper = { value: value.toJSON() };\n } catch (e) {\n }\n if (jsonWrapper)\n return innerSerialize(jsonWrapper.value, handleSerializer, visitorInfo);\n return { o, id: id2 };\n }\n }\n return { parseEvaluationResultValue: parseEvaluationResultValue2, serializeAsCallArgument: serializeAsCallArgument2 };\n}\nvar result = source();\nvar parseEvaluationResultValue = result.parseEvaluationResultValue;\nvar serializeAsCallArgument = result.serializeAsCallArgument;\n\n// packages/playwright-core/src/server/injected/utilityScript.ts\nvar UtilityScript = class {\n constructor(isUnderTest) {\n this.serializeAsCallArgument = serializeAsCallArgument;\n this.parseEvaluationResultValue = parseEvaluationResultValue;\n if (isUnderTest)\n this._setBuiltins();\n }\n evaluate(isFunction, returnByValue, expression, argCount, ...argsAndHandles) {\n const args = argsAndHandles.slice(0, argCount);\n const handles = argsAndHandles.slice(argCount);\n const parameters = [];\n for (let i = 0; i < args.length; i++)\n parameters[i] = this.parseEvaluationResultValue(args[i], handles);\n let result2 = globalThis.eval(expression);\n if (isFunction === true) {\n result2 = result2(...parameters);\n } else if (isFunction === false) {\n result2 = result2;\n } else {\n if (typeof result2 === \"function\")\n result2 = result2(...parameters);\n }\n return returnByValue ? this._promiseAwareJsonValueNoThrow(result2) : result2;\n }\n jsonValue(returnByValue, value) {\n if (Object.is(value, void 0))\n return void 0;\n return serializeAsCallArgument(value, (value2) => ({ fallThrough: value2 }));\n }\n _promiseAwareJsonValueNoThrow(value) {\n const safeJson = (value2) => {\n try {\n return this.jsonValue(true, value2);\n } catch (e) {\n return void 0;\n }\n };\n if (value && typeof value === \"object\" && typeof value.then === \"function\") {\n return (async () => {\n const promiseValue = await value;\n return safeJson(promiseValue);\n })();\n }\n return safeJson(value);\n }\n _setBuiltins() {\n var _a, _b;\n const window = globalThis;\n window.builtinSetTimeout = (callback, timeout) => {\n var _a2;\n if ((_a2 = window.__pwClock) == null ? void 0 : _a2.builtin)\n return window.__pwClock.builtin.setTimeout(callback, timeout);\n return setTimeout(callback, timeout);\n };\n window.builtinClearTimeout = (id) => {\n var _a2;\n if ((_a2 = window.__pwClock) == null ? void 0 : _a2.builtin)\n return window.__pwClock.builtin.clearTimeout(id);\n return clearTimeout(id);\n };\n window.builtinSetInterval = (callback, timeout) => {\n var _a2;\n if ((_a2 = window.__pwClock) == null ? void 0 : _a2.builtin)\n return window.__pwClock.builtin.setInterval(callback, timeout);\n return setInterval(callback, timeout);\n };\n window.builtinClearInterval = (id) => {\n var _a2;\n if ((_a2 = window.__pwClock) == null ? void 0 : _a2.builtin)\n return window.__pwClock.builtin.clearInterval(id);\n return clearInterval(id);\n };\n window.builtinRequestAnimationFrame = (callback) => {\n var _a2;\n if ((_a2 = window.__pwClock) == null ? void 0 : _a2.builtin)\n return window.__pwClock.builtin.requestAnimationFrame(callback);\n return requestAnimationFrame(callback);\n };\n window.builtinCancelAnimationFrame = (id) => {\n var _a2;\n if ((_a2 = window.__pwClock) == null ? void 0 : _a2.builtin)\n return window.__pwClock.builtin.cancelAnimationFrame(id);\n return cancelAnimationFrame(id);\n };\n window.builtinDate = ((_a = window.__pwClock) == null ? void 0 : _a.builtin.Date) || Date;\n window.builtinPerformance = ((_b = window.__pwClock) == null ? void 0 : _b.builtin.performance) || performance;\n }\n};\n";
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.blendWithWhite = blendWithWhite;
7
+ exports.colorDeltaE94 = colorDeltaE94;
8
+ exports.rgb2gray = rgb2gray;
9
+ exports.srgb2xyz = srgb2xyz;
10
+ exports.xyz2lab = xyz2lab;
11
+ /**
12
+ * Copyright (c) Microsoft Corporation.
13
+ *
14
+ * Licensed under the Apache License, Version 2.0 (the 'License");
15
+ * you may not use this file except in compliance with the License.
16
+ * You may obtain a copy of the License at
17
+ *
18
+ * http://www.apache.org/licenses/LICENSE-2.0
19
+ *
20
+ * Unless required by applicable law or agreed to in writing, software
21
+ * distributed under the License is distributed on an "AS IS" BASIS,
22
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
+ * See the License for the specific language governing permissions and
24
+ * limitations under the License.
25
+ */
26
+
27
+ function blendWithWhite(c, a) {
28
+ return 255 + (c - 255) * a;
29
+ }
30
+ function rgb2gray(r, g, b) {
31
+ // NOTE: this is the exact integer formula from SSIM.js.
32
+ // See https://github.com/obartra/ssim/blob/ca8e3c6a6ff5f4f2e232239e0c3d91806f3c97d5/src/matlab/rgb2gray.ts#L56
33
+ return 77 * r + 150 * g + 29 * b + 128 >> 8;
34
+ }
35
+
36
+ // Perceived color difference defined by CIE94.
37
+ // See https://en.wikipedia.org/wiki/Color_difference#CIE94
38
+ //
39
+ // The result of 1.0 is a "just-noticeable difference".
40
+ //
41
+ // Other results interpretation (taken from http://zschuessler.github.io/DeltaE/learn/):
42
+ // < 1.0 Not perceptible by human eyes.
43
+ // 1-2 Perceptible through close observation.
44
+ // 2-10 Perceptible at a glance.
45
+ // 11-49 Colors are more similar than opposite
46
+ // 100 Colors are exact opposite
47
+ function colorDeltaE94(rgb1, rgb2) {
48
+ const [l1, a1, b1] = xyz2lab(srgb2xyz(rgb1));
49
+ const [l2, a2, b2] = xyz2lab(srgb2xyz(rgb2));
50
+ const deltaL = l1 - l2;
51
+ const deltaA = a1 - a2;
52
+ const deltaB = b1 - b2;
53
+ const c1 = Math.sqrt(a1 ** 2 + b1 ** 2);
54
+ const c2 = Math.sqrt(a2 ** 2 + b2 ** 2);
55
+ const deltaC = c1 - c2;
56
+ let deltaH = deltaA ** 2 + deltaB ** 2 - deltaC ** 2;
57
+ deltaH = deltaH < 0 ? 0 : Math.sqrt(deltaH);
58
+ // The k1, k2, kL, kC, kH values for "graphic arts" applications.
59
+ // See https://en.wikipedia.org/wiki/Color_difference#CIE94
60
+ const k1 = 0.045;
61
+ const k2 = 0.015;
62
+ const kL = 1;
63
+ const kC = 1;
64
+ const kH = 1;
65
+ const sC = 1.0 + k1 * c1;
66
+ const sH = 1.0 + k2 * c1;
67
+ const sL = 1;
68
+ return Math.sqrt((deltaL / sL / kL) ** 2 + (deltaC / sC / kC) ** 2 + (deltaH / sH / kH) ** 2);
69
+ }
70
+
71
+ // sRGB -> 1-normalized XYZ (i.e. Y ∈ [0, 1]) with D65 illuminant
72
+ // See https://en.wikipedia.org/wiki/SRGB#From_sRGB_to_CIE_XYZ
73
+ function srgb2xyz(rgb) {
74
+ let r = rgb[0] / 255;
75
+ let g = rgb[1] / 255;
76
+ let b = rgb[2] / 255;
77
+ r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
78
+ g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
79
+ b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
80
+ return [r * 0.4124 + g * 0.3576 + b * 0.1805, r * 0.2126 + g * 0.7152 + b * 0.0722, r * 0.0193 + g * 0.1192 + b * 0.9505];
81
+ }
82
+ const sigma_pow2 = 6 * 6 / 29 / 29;
83
+ const sigma_pow3 = 6 * 6 * 6 / 29 / 29 / 29;
84
+
85
+ // 1-normalized CIE XYZ with D65 to L*a*b*
86
+ // See https://en.wikipedia.org/wiki/CIELAB_color_space#From_CIEXYZ_to_CIELAB
87
+ function xyz2lab(xyz) {
88
+ const x = xyz[0] / 0.950489;
89
+ const y = xyz[1];
90
+ const z = xyz[2] / 1.088840;
91
+ const fx = x > sigma_pow3 ? x ** (1 / 3) : x / 3 / sigma_pow2 + 4 / 29;
92
+ const fy = y > sigma_pow3 ? y ** (1 / 3) : y / 3 / sigma_pow2 + 4 / 29;
93
+ const fz = z > sigma_pow3 ? z ** (1 / 3) : z / 3 / sigma_pow2 + 4 / 29;
94
+ const l = 116 * fy - 16;
95
+ const a = 500 * (fx - fy);
96
+ const b = 200 * (fy - fz);
97
+ return [l, a, b];
98
+ }
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.compare = compare;
7
+ var _colorUtils = require("./colorUtils");
8
+ var _imageChannel = require("./imageChannel");
9
+ var _stats = require("./stats");
10
+ /**
11
+ * Copyright (c) Microsoft Corporation.
12
+ *
13
+ * Licensed under the Apache License, Version 2.0 (the 'License");
14
+ * you may not use this file except in compliance with the License.
15
+ * You may obtain a copy of the License at
16
+ *
17
+ * http://www.apache.org/licenses/LICENSE-2.0
18
+ *
19
+ * Unless required by applicable law or agreed to in writing, software
20
+ * distributed under the License is distributed on an "AS IS" BASIS,
21
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
+ * See the License for the specific language governing permissions and
23
+ * limitations under the License.
24
+ */
25
+
26
+ const SSIM_WINDOW_RADIUS = 15;
27
+ const VARIANCE_WINDOW_RADIUS = 1;
28
+ function drawPixel(width, data, x, y, r, g, b) {
29
+ const idx = (y * width + x) * 4;
30
+ data[idx + 0] = r;
31
+ data[idx + 1] = g;
32
+ data[idx + 2] = b;
33
+ data[idx + 3] = 255;
34
+ }
35
+ function compare(actual, expected, diff, width, height, options = {}) {
36
+ const {
37
+ maxColorDeltaE94 = 1.0
38
+ } = options;
39
+ const paddingSize = Math.max(VARIANCE_WINDOW_RADIUS, SSIM_WINDOW_RADIUS);
40
+ const paddingColorEven = [255, 0, 255];
41
+ const paddingColorOdd = [0, 255, 0];
42
+ const [r1, g1, b1] = _imageChannel.ImageChannel.intoRGB(width, height, expected, {
43
+ paddingSize,
44
+ paddingColorEven,
45
+ paddingColorOdd
46
+ });
47
+ const [r2, g2, b2] = _imageChannel.ImageChannel.intoRGB(width, height, actual, {
48
+ paddingSize,
49
+ paddingColorEven,
50
+ paddingColorOdd
51
+ });
52
+ const noop = (x, y) => {};
53
+ const drawRedPixel = diff ? (x, y) => drawPixel(width, diff, x - paddingSize, y - paddingSize, 255, 0, 0) : noop;
54
+ const drawYellowPixel = diff ? (x, y) => drawPixel(width, diff, x - paddingSize, y - paddingSize, 255, 255, 0) : noop;
55
+ const drawGrayPixel = diff ? (x, y) => {
56
+ const gray = (0, _colorUtils.rgb2gray)(r1.get(x, y), g1.get(x, y), b1.get(x, y));
57
+ const value = (0, _colorUtils.blendWithWhite)(gray, 0.1);
58
+ drawPixel(width, diff, x - paddingSize, y - paddingSize, value, value, value);
59
+ } : noop;
60
+ let fastR, fastG, fastB;
61
+ let diffCount = 0;
62
+ for (let y = paddingSize; y < r1.height - paddingSize; ++y) {
63
+ for (let x = paddingSize; x < r1.width - paddingSize; ++x) {
64
+ // Fast-path: equal pixels.
65
+ if (r1.get(x, y) === r2.get(x, y) && g1.get(x, y) === g2.get(x, y) && b1.get(x, y) === b2.get(x, y)) {
66
+ drawGrayPixel(x, y);
67
+ continue;
68
+ }
69
+
70
+ // Compare pixel colors using the dE94 color difference formulae.
71
+ // The dE94 is normalized so that the value of 1.0 is the "just-noticeable-difference".
72
+ // Color difference below 1.0 is not noticeable to a human eye, so we can disregard it.
73
+ // See https://en.wikipedia.org/wiki/Color_difference
74
+ const delta = (0, _colorUtils.colorDeltaE94)([r1.get(x, y), g1.get(x, y), b1.get(x, y)], [r2.get(x, y), g2.get(x, y), b2.get(x, y)]);
75
+ if (delta <= maxColorDeltaE94) {
76
+ drawGrayPixel(x, y);
77
+ continue;
78
+ }
79
+ if (!fastR || !fastG || !fastB) {
80
+ fastR = new _stats.FastStats(r1, r2);
81
+ fastG = new _stats.FastStats(g1, g2);
82
+ fastB = new _stats.FastStats(b1, b2);
83
+ }
84
+ const [varX1, varY1] = r1.boundXY(x - VARIANCE_WINDOW_RADIUS, y - VARIANCE_WINDOW_RADIUS);
85
+ const [varX2, varY2] = r1.boundXY(x + VARIANCE_WINDOW_RADIUS, y + VARIANCE_WINDOW_RADIUS);
86
+ const var1 = fastR.varianceC1(varX1, varY1, varX2, varY2) + fastG.varianceC1(varX1, varY1, varX2, varY2) + fastB.varianceC1(varX1, varY1, varX2, varY2);
87
+ const var2 = fastR.varianceC2(varX1, varY1, varX2, varY2) + fastG.varianceC2(varX1, varY1, varX2, varY2) + fastB.varianceC2(varX1, varY1, varX2, varY2);
88
+ // if this pixel is a part of a flood fill of a 3x3 square of either of the images, then it cannot be
89
+ // anti-aliasing pixel so it must be a pixel difference.
90
+ if (var1 === 0 || var2 === 0) {
91
+ drawRedPixel(x, y);
92
+ ++diffCount;
93
+ continue;
94
+ }
95
+ const [ssimX1, ssimY1] = r1.boundXY(x - SSIM_WINDOW_RADIUS, y - SSIM_WINDOW_RADIUS);
96
+ const [ssimX2, ssimY2] = r1.boundXY(x + SSIM_WINDOW_RADIUS, y + SSIM_WINDOW_RADIUS);
97
+ const ssimRGB = ((0, _stats.ssim)(fastR, ssimX1, ssimY1, ssimX2, ssimY2) + (0, _stats.ssim)(fastG, ssimX1, ssimY1, ssimX2, ssimY2) + (0, _stats.ssim)(fastB, ssimX1, ssimY1, ssimX2, ssimY2)) / 3.0;
98
+ const isAntialiased = ssimRGB >= 0.99;
99
+ if (isAntialiased) {
100
+ drawYellowPixel(x, y);
101
+ } else {
102
+ drawRedPixel(x, y);
103
+ ++diffCount;
104
+ }
105
+ }
106
+ }
107
+ return diffCount;
108
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ImageChannel = void 0;
7
+ var _colorUtils = require("./colorUtils");
8
+ /**
9
+ * Copyright (c) Microsoft Corporation.
10
+ *
11
+ * Licensed under the Apache License, Version 2.0 (the 'License");
12
+ * you may not use this file except in compliance with the License.
13
+ * You may obtain a copy of the License at
14
+ *
15
+ * http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ * See the License for the specific language governing permissions and
21
+ * limitations under the License.
22
+ */
23
+
24
+ class ImageChannel {
25
+ static intoRGB(width, height, data, options = {}) {
26
+ const {
27
+ paddingSize = 0,
28
+ paddingColorOdd = [255, 0, 255],
29
+ paddingColorEven = [0, 255, 0]
30
+ } = options;
31
+ const newWidth = width + 2 * paddingSize;
32
+ const newHeight = height + 2 * paddingSize;
33
+ const r = new Uint8Array(newWidth * newHeight);
34
+ const g = new Uint8Array(newWidth * newHeight);
35
+ const b = new Uint8Array(newWidth * newHeight);
36
+ for (let y = 0; y < newHeight; ++y) {
37
+ for (let x = 0; x < newWidth; ++x) {
38
+ const index = y * newWidth + x;
39
+ if (y >= paddingSize && y < newHeight - paddingSize && x >= paddingSize && x < newWidth - paddingSize) {
40
+ const offset = ((y - paddingSize) * width + (x - paddingSize)) * 4;
41
+ const alpha = data[offset + 3] === 255 ? 1 : data[offset + 3] / 255;
42
+ r[index] = (0, _colorUtils.blendWithWhite)(data[offset], alpha);
43
+ g[index] = (0, _colorUtils.blendWithWhite)(data[offset + 1], alpha);
44
+ b[index] = (0, _colorUtils.blendWithWhite)(data[offset + 2], alpha);
45
+ } else {
46
+ const color = (y + x) % 2 === 0 ? paddingColorEven : paddingColorOdd;
47
+ r[index] = color[0];
48
+ g[index] = color[1];
49
+ b[index] = color[2];
50
+ }
51
+ }
52
+ }
53
+ return [new ImageChannel(newWidth, newHeight, r), new ImageChannel(newWidth, newHeight, g), new ImageChannel(newWidth, newHeight, b)];
54
+ }
55
+ constructor(width, height, data) {
56
+ this.data = void 0;
57
+ this.width = void 0;
58
+ this.height = void 0;
59
+ this.data = data;
60
+ this.width = width;
61
+ this.height = height;
62
+ }
63
+ get(x, y) {
64
+ return this.data[y * this.width + x];
65
+ }
66
+ boundXY(x, y) {
67
+ return [Math.min(Math.max(x, 0), this.width - 1), Math.min(Math.max(y, 0), this.height - 1)];
68
+ }
69
+ }
70
+ exports.ImageChannel = ImageChannel;
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.FastStats = void 0;
7
+ exports.ssim = ssim;
8
+ /**
9
+ * Copyright (c) Microsoft Corporation.
10
+ *
11
+ * Licensed under the Apache License, Version 2.0 (the 'License");
12
+ * you may not use this file except in compliance with the License.
13
+ * You may obtain a copy of the License at
14
+ *
15
+ * http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ * See the License for the specific language governing permissions and
21
+ * limitations under the License.
22
+ */
23
+
24
+ // Image channel has a 8-bit depth.
25
+ const DYNAMIC_RANGE = 2 ** 8 - 1;
26
+ function ssim(stats, x1, y1, x2, y2) {
27
+ const mean1 = stats.meanC1(x1, y1, x2, y2);
28
+ const mean2 = stats.meanC2(x1, y1, x2, y2);
29
+ const var1 = stats.varianceC1(x1, y1, x2, y2);
30
+ const var2 = stats.varianceC2(x1, y1, x2, y2);
31
+ const cov = stats.covariance(x1, y1, x2, y2);
32
+ const c1 = (0.01 * DYNAMIC_RANGE) ** 2;
33
+ const c2 = (0.03 * DYNAMIC_RANGE) ** 2;
34
+ return (2 * mean1 * mean2 + c1) * (2 * cov + c2) / (mean1 ** 2 + mean2 ** 2 + c1) / (var1 + var2 + c2);
35
+ }
36
+ class FastStats {
37
+ constructor(c1, c2) {
38
+ this.c1 = void 0;
39
+ this.c2 = void 0;
40
+ this._partialSumC1 = void 0;
41
+ this._partialSumC2 = void 0;
42
+ this._partialSumMult = void 0;
43
+ this._partialSumSq1 = void 0;
44
+ this._partialSumSq2 = void 0;
45
+ this.c1 = c1;
46
+ this.c2 = c2;
47
+ const {
48
+ width,
49
+ height
50
+ } = c1;
51
+ this._partialSumC1 = new Array(width * height);
52
+ this._partialSumC2 = new Array(width * height);
53
+ this._partialSumSq1 = new Array(width * height);
54
+ this._partialSumSq2 = new Array(width * height);
55
+ this._partialSumMult = new Array(width * height);
56
+ const recalc = (mx, idx, initial, x, y) => {
57
+ mx[idx] = initial;
58
+ if (y > 0) mx[idx] += mx[(y - 1) * width + x];
59
+ if (x > 0) mx[idx] += mx[y * width + x - 1];
60
+ if (x > 0 && y > 0) mx[idx] -= mx[(y - 1) * width + x - 1];
61
+ };
62
+ for (let y = 0; y < height; ++y) {
63
+ for (let x = 0; x < width; ++x) {
64
+ const idx = y * width + x;
65
+ recalc(this._partialSumC1, idx, this.c1.data[idx], x, y);
66
+ recalc(this._partialSumC2, idx, this.c2.data[idx], x, y);
67
+ recalc(this._partialSumSq1, idx, this.c1.data[idx] * this.c1.data[idx], x, y);
68
+ recalc(this._partialSumSq2, idx, this.c2.data[idx] * this.c2.data[idx], x, y);
69
+ recalc(this._partialSumMult, idx, this.c1.data[idx] * this.c2.data[idx], x, y);
70
+ }
71
+ }
72
+ }
73
+ _sum(partialSum, x1, y1, x2, y2) {
74
+ const width = this.c1.width;
75
+ let result = partialSum[y2 * width + x2];
76
+ if (y1 > 0) result -= partialSum[(y1 - 1) * width + x2];
77
+ if (x1 > 0) result -= partialSum[y2 * width + x1 - 1];
78
+ if (x1 > 0 && y1 > 0) result += partialSum[(y1 - 1) * width + x1 - 1];
79
+ return result;
80
+ }
81
+ meanC1(x1, y1, x2, y2) {
82
+ const N = (y2 - y1 + 1) * (x2 - x1 + 1);
83
+ return this._sum(this._partialSumC1, x1, y1, x2, y2) / N;
84
+ }
85
+ meanC2(x1, y1, x2, y2) {
86
+ const N = (y2 - y1 + 1) * (x2 - x1 + 1);
87
+ return this._sum(this._partialSumC2, x1, y1, x2, y2) / N;
88
+ }
89
+ varianceC1(x1, y1, x2, y2) {
90
+ const N = (y2 - y1 + 1) * (x2 - x1 + 1);
91
+ return (this._sum(this._partialSumSq1, x1, y1, x2, y2) - this._sum(this._partialSumC1, x1, y1, x2, y2) ** 2 / N) / N;
92
+ }
93
+ varianceC2(x1, y1, x2, y2) {
94
+ const N = (y2 - y1 + 1) * (x2 - x1 + 1);
95
+ return (this._sum(this._partialSumSq2, x1, y1, x2, y2) - this._sum(this._partialSumC2, x1, y1, x2, y2) ** 2 / N) / N;
96
+ }
97
+ covariance(x1, y1, x2, y2) {
98
+ const N = (y2 - y1 + 1) * (x2 - x1 + 1);
99
+ return (this._sum(this._partialSumMult, x1, y1, x2, y2) - this._sum(this._partialSumC1, x1, y1, x2, y2) * this._sum(this._partialSumC2, x1, y1, x2, y2) / N) / N;
100
+ }
101
+ }
102
+ exports.FastStats = FastStats;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createInProcessPlaywright = createInProcessPlaywright;
7
+ var _server = require("./server");
8
+ var _connection = require("./client/connection");
9
+ var _browserServerImpl = require("./browserServerImpl");
10
+ var _androidServerImpl = require("./androidServerImpl");
11
+ /**
12
+ * Copyright (c) Microsoft Corporation.
13
+ *
14
+ * Licensed under the Apache License, Version 2.0 (the 'License");
15
+ * you may not use this file except in compliance with the License.
16
+ * You may obtain a copy of the License at
17
+ *
18
+ * http://www.apache.org/licenses/LICENSE-2.0
19
+ *
20
+ * Unless required by applicable law or agreed to in writing, software
21
+ * distributed under the License is distributed on an "AS IS" BASIS,
22
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
+ * See the License for the specific language governing permissions and
24
+ * limitations under the License.
25
+ */
26
+
27
+ function createInProcessPlaywright() {
28
+ const playwright = (0, _server.createPlaywright)({
29
+ sdkLanguage: process.env.PW_LANG_NAME || 'javascript'
30
+ });
31
+ const clientConnection = new _connection.Connection(undefined, undefined);
32
+ clientConnection.useRawBuffers();
33
+ const dispatcherConnection = new _server.DispatcherConnection(true /* local */);
34
+
35
+ // Dispatch synchronously at first.
36
+ dispatcherConnection.onmessage = message => clientConnection.dispatch(message);
37
+ clientConnection.onmessage = message => dispatcherConnection.dispatch(message);
38
+ const rootScope = new _server.RootDispatcher(dispatcherConnection);
39
+
40
+ // Initialize Playwright channel.
41
+ new _server.PlaywrightDispatcher(rootScope, playwright);
42
+ const playwrightAPI = clientConnection.getObjectWithKnownName('Playwright');
43
+ playwrightAPI.chromium._serverLauncher = new _browserServerImpl.BrowserServerLauncherImpl('chromium');
44
+ playwrightAPI.firefox._serverLauncher = new _browserServerImpl.BrowserServerLauncherImpl('firefox');
45
+ playwrightAPI.webkit._serverLauncher = new _browserServerImpl.BrowserServerLauncherImpl('webkit');
46
+ playwrightAPI._android._serverLauncher = new _androidServerImpl.AndroidServerLauncherImpl();
47
+
48
+ // Switch to async dispatch after we got Playwright object.
49
+ dispatcherConnection.onmessage = message => setImmediate(() => clientConnection.dispatch(message));
50
+ clientConnection.onmessage = message => setImmediate(() => dispatcherConnection.dispatch(message));
51
+ clientConnection.toImpl = x => x ? dispatcherConnection._dispatchers.get(x._guid)._object : dispatcherConnection._dispatchers.get('');
52
+ playwrightAPI._toImpl = clientConnection.toImpl;
53
+ return playwrightAPI;
54
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ var _inProcessFactory = require("./inProcessFactory");
4
+ /**
5
+ * Copyright (c) Microsoft Corporation.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the 'License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+
20
+ module.exports = (0, _inProcessFactory.createInProcessPlaywright)();