spana-test 0.20.0 → 0.21.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 (238) hide show
  1. package/CHANGELOG.md +251 -0
  2. package/README.md +1 -0
  3. package/dist/{accessibility-audit-IWTD2HPR.js → accessibility-audit-ARQ3V334.js} +3 -3
  4. package/dist/agent/index.js +35 -35
  5. package/dist/{agent-fixture-WQVCNL73.js → agent-fixture-35U4HLYU.js} +3 -3
  6. package/dist/{allure-LF4CALKP.js → allure-6OPM2KHH.js} +2 -2
  7. package/dist/{android-TPO53H5Q.js → android-ETXQCLEW.js} +3 -3
  8. package/dist/api/app.d.ts +5 -1
  9. package/dist/api/app.d.ts.map +1 -1
  10. package/dist/app-L4OHLMRW.js +17 -0
  11. package/dist/{appium-LOAWWZXA.js → appium-RW2NDIGK.js} +13 -13
  12. package/dist/{appium-server-CCTQQGTV.js → appium-server-J6FCQE64.js} +2 -2
  13. package/dist/{baseline-manager-XJ3LADKC.js → baseline-manager-4BD5EKUB.js} +2 -2
  14. package/dist/{bridge-server-X5W4PCAR.js → bridge-server-6MX6MERV.js} +3 -3
  15. package/dist/{build-info-KFFGVWDQ.js → build-info-M7NV4FQA.js} +3 -3
  16. package/dist/build-info.json +2 -2
  17. package/dist/{cache-command-OMV6DPC7.js → cache-command-INBRSYY6.js} +3 -3
  18. package/dist/channels/cdp-client.d.ts +26 -2
  19. package/dist/channels/cdp-client.d.ts.map +1 -1
  20. package/dist/channels/dom-channel.d.ts +12 -2
  21. package/dist/channels/dom-channel.d.ts.map +1 -1
  22. package/dist/{chunk-QNCTEV2P.js → chunk-27MCWFJD.js} +18 -18
  23. package/dist/{chunk-BPUBV7OF.js → chunk-452GD5VB.js} +3 -3
  24. package/dist/{chunk-4TTYSFBG.js → chunk-47TSBPQE.js} +2 -2
  25. package/dist/{chunk-OYME74M3.js → chunk-5RU6BYNC.js} +2 -2
  26. package/dist/{chunk-B6NTHBPF.js → chunk-67WPE74U.js} +2 -2
  27. package/dist/{chunk-5DSPPJ76.js → chunk-6LY55IUQ.js} +3 -3
  28. package/dist/{chunk-2TK77LXY.js → chunk-6UIW7OO5.js} +28 -27
  29. package/dist/chunk-6UIW7OO5.js.map +1 -0
  30. package/dist/{chunk-AGG2RJGU.js → chunk-7SPHOYTS.js} +3 -3
  31. package/dist/{chunk-NQYTD3JG.js → chunk-A7Z3HT3W.js} +2 -2
  32. package/dist/{chunk-KIDTBRIV.js → chunk-BTODPLHM.js} +2 -2
  33. package/dist/{chunk-CZAFFUMN.js → chunk-CAT7OHNT.js} +4 -4
  34. package/dist/{chunk-SPGD4QGA.js → chunk-CIRIYDH6.js} +2 -2
  35. package/dist/{chunk-RL3ICBAB.js → chunk-CQP4IR2F.js} +2 -2
  36. package/dist/{chunk-VBAPZMPX.js → chunk-CSBLKSHT.js} +15 -6
  37. package/dist/{chunk-VBAPZMPX.js.map → chunk-CSBLKSHT.js.map} +1 -1
  38. package/dist/{chunk-R52P4KQC.js → chunk-DCF2VBSC.js} +2 -2
  39. package/dist/{chunk-IC46FAEW.js → chunk-DXKM5TZO.js} +5 -5
  40. package/dist/{chunk-YKNHKVE6.js → chunk-EECGHFPB.js} +3 -3
  41. package/dist/{chunk-7QJY2HJO.js → chunk-EFF43IC7.js} +3 -3
  42. package/dist/{chunk-FBJPNZUN.js → chunk-EGWMLZBB.js} +2 -2
  43. package/dist/{chunk-ODRB22QA.js → chunk-ERL4M6IW.js} +2 -2
  44. package/dist/{chunk-Z5BMFLZ5.js → chunk-FD2HE5AT.js} +5 -5
  45. package/dist/{chunk-MQRGWQI5.js → chunk-GKCOUOSB.js} +2 -2
  46. package/dist/{chunk-RQRJ2I2Z.js → chunk-GNZBJ5BE.js} +2 -2
  47. package/dist/{chunk-3HQKY24K.js → chunk-H43BRCLF.js} +3 -3
  48. package/dist/{chunk-HX2PKESI.js → chunk-HNXEOKZM.js} +5 -5
  49. package/dist/{chunk-VILLVGBP.js → chunk-HUTUC7WM.js} +2 -2
  50. package/dist/{chunk-XORHAB3R.js → chunk-IY5STNOF.js} +74 -36
  51. package/dist/chunk-IY5STNOF.js.map +1 -0
  52. package/dist/{chunk-GBV3XDWM.js → chunk-J2WL7VUK.js} +11 -11
  53. package/dist/{chunk-V6PEMZCL.js → chunk-JQPPHP7M.js} +2 -2
  54. package/dist/{chunk-6GLL6SMP.js → chunk-KGSD5UZ7.js} +4 -4
  55. package/dist/{chunk-LX6GMZIN.js → chunk-KIPG2ENR.js} +4 -4
  56. package/dist/{chunk-XPEWAHAK.js → chunk-KSXVQH42.js} +3 -3
  57. package/dist/{chunk-ZVUIG6A4.js → chunk-L6LGJ5MF.js} +10 -10
  58. package/dist/{chunk-B4FOISOF.js → chunk-LIYQTSDQ.js} +2 -2
  59. package/dist/{chunk-T46S4VA3.js → chunk-LO7NYXB2.js} +2 -2
  60. package/dist/{chunk-67PLJEY2.js → chunk-MOICHR7U.js} +2 -2
  61. package/dist/{chunk-42D5LOGH.js → chunk-NFN434RT.js} +10 -10
  62. package/dist/{chunk-IKMNHITS.js → chunk-OSHWXMKF.js} +2 -2
  63. package/dist/{chunk-VWOTHDSE.js → chunk-OVZCYED2.js} +4 -3
  64. package/dist/chunk-OVZCYED2.js.map +1 -0
  65. package/dist/{chunk-GACJRITH.js → chunk-Q4FER5AG.js} +3 -3
  66. package/dist/{chunk-5TAHLRZD.js → chunk-QP7BKHYP.js} +2 -2
  67. package/dist/{chunk-QU365GZA.js → chunk-SRSE3V3K.js} +2 -2
  68. package/dist/{chunk-7GDO4XAI.js → chunk-SZV5KJOM.js} +212 -47
  69. package/dist/chunk-SZV5KJOM.js.map +1 -0
  70. package/dist/{chunk-KRTQZPYL.js → chunk-T46BZOD3.js} +2 -2
  71. package/dist/{chunk-XUKBM64A.js → chunk-UWFIFPKJ.js} +6 -6
  72. package/dist/{chunk-26XIUSVS.js → chunk-VAQ4KWN7.js} +108 -12
  73. package/dist/chunk-VAQ4KWN7.js.map +1 -0
  74. package/dist/{chunk-XGXOE3DF.js → chunk-VAQVIEGT.js} +2 -2
  75. package/dist/{chunk-XLHJCJ4O.js → chunk-VVWVNLB2.js} +3 -3
  76. package/dist/{chunk-PS3DALTI.js → chunk-WPE4YAGR.js} +2 -2
  77. package/dist/{chunk-2SDRH7ST.js → chunk-XKAAFHHX.js} +52 -40
  78. package/dist/chunk-XKAAFHHX.js.map +1 -0
  79. package/dist/{chunk-5NZPLX2Y.js → chunk-XTBG5IDL.js} +4 -4
  80. package/dist/{chunk-XZQGSUV7.js → chunk-YT65EX3P.js} +11 -11
  81. package/dist/cli.js +26 -26
  82. package/dist/{compiler-UOVKUQHE.js → compiler-ZFER5HX7.js} +3 -3
  83. package/dist/{config-loader-IDIKOQ4T.js → config-loader-J44BOSPX.js} +5 -5
  84. package/dist/{console-Z7F7X3WY.js → console-3W35Y2YV.js} +2 -2
  85. package/dist/{daemon-manager-6CFUXGTR.js → daemon-manager-WT2S6GS7.js} +3 -3
  86. package/dist/{discover-AHMM7QLN.js → discover-XZJ5D2J4.js} +6 -6
  87. package/dist/{doctor-command-2PSDOREK.js → doctor-command-YN25BI3T.js} +17 -17
  88. package/dist/driver-3IZLNSXB.js +21 -0
  89. package/dist/driver-XJETTHHG.js +20 -0
  90. package/dist/drivers/cdp-browser.d.ts +6 -0
  91. package/dist/drivers/cdp-browser.d.ts.map +1 -1
  92. package/dist/electrobun-OW5V2OSW.js +17 -0
  93. package/dist/{electron-XL7H25IQ.js → electron-5UKSJ3QR.js} +4 -4
  94. package/dist/{filters-6W73R3IV.js → filters-RTJTEZIO.js} +3 -3
  95. package/dist/gherkin/steps.js +2 -2
  96. package/dist/{github-pr-XZZZ3YE6.js → github-pr-CT6ZKKJ5.js} +3 -3
  97. package/dist/{html-GDWXFYFL.js → html-G6VGX6D4.js} +3 -3
  98. package/dist/index.js +38 -38
  99. package/dist/{init-command-PYZ5X6M5.js → init-command-NRHHVETM.js} +2 -2
  100. package/dist/{init-flow-command-SLLEGSRZ.js → init-flow-command-7DSC7ME2.js} +3 -3
  101. package/dist/{installer-3X5SKWVX.js → installer-VOPKS37W.js} +6 -6
  102. package/dist/{installer-Q37BOG5G.js → installer-XNV4M6KA.js} +5 -5
  103. package/dist/{ios-YFRAK2CL.js → ios-JJ32OL2S.js} +4 -4
  104. package/dist/{json-RNYQ54R7.js → json-TNP5EMYW.js} +2 -2
  105. package/dist/{junit-G5LNOYUL.js → junit-Q3GEPR4E.js} +2 -2
  106. package/dist/{local-E6FJI3QK.js → local-4B4EHRWA.js} +12 -12
  107. package/dist/{machine-VEVBT2GU.js → machine-2R4PSS4W.js} +3 -3
  108. package/dist/{pagesource-HKLE3FZN.js → pagesource-4BXN3KE7.js} +4 -4
  109. package/dist/{pagesource-GQLIXL5R.js → pagesource-REQ5FA4H.js} +4 -4
  110. package/dist/{playwright-LS35WXQ6.js → playwright-ESFHDJFF.js} +14 -14
  111. package/dist/{provider-HWM3GF54.js → provider-FCRARR2Z.js} +4 -4
  112. package/dist/{redact-YWR6GHBX.js → redact-42Q7ZOVN.js} +2 -2
  113. package/dist/{runner-P2BFG4VZ.js → runner-U767QTWF.js} +3 -3
  114. package/dist/runtime/local.d.ts.map +1 -1
  115. package/dist/schemas/config.d.ts +7 -0
  116. package/dist/schemas/config.d.ts.map +1 -1
  117. package/dist/{screenshot-compare-DNIP2EK4.js → screenshot-compare-4EN753KV.js} +3 -3
  118. package/dist/{server-D3HOIPQE.js → server-3P4XMQJB.js} +92 -82
  119. package/dist/server-3P4XMQJB.js.map +1 -0
  120. package/dist/{server-A6Y6ZMET.js → server-4BVOD5CM.js} +3 -3
  121. package/dist/session-4DF7CMFT.js +42 -0
  122. package/dist/smart/auto-wait.d.ts +2 -0
  123. package/dist/smart/auto-wait.d.ts.map +1 -1
  124. package/dist/smart/coordinator.d.ts.map +1 -1
  125. package/dist/{studio-command-SPHIXFIW.js → studio-command-ODE7LBES.js} +3 -3
  126. package/dist/{test-command-OYMJNT23.js → test-command-ZXNZSMTX.js} +41 -41
  127. package/dist/{validator-6XP3PGCP.js → validator-FQOV6NQH.js} +4 -4
  128. package/dist/{watch-mode-HWZ4XCKH.js → watch-mode-XR2Q3RWF.js} +3 -3
  129. package/native/win32-x64/spana_native.dll +0 -0
  130. package/package.json +6 -5
  131. package/studio-dist/assets/index-CFPQmh6V.css +2 -0
  132. package/studio-dist/assets/index-DEC0OwHv.js +23 -0
  133. package/studio-dist/index.html +2 -2
  134. package/dist/app-ZSRJ3VFR.js +0 -17
  135. package/dist/chunk-26XIUSVS.js.map +0 -1
  136. package/dist/chunk-2SDRH7ST.js.map +0 -1
  137. package/dist/chunk-2TK77LXY.js.map +0 -1
  138. package/dist/chunk-7GDO4XAI.js.map +0 -1
  139. package/dist/chunk-VWOTHDSE.js.map +0 -1
  140. package/dist/chunk-XORHAB3R.js.map +0 -1
  141. package/dist/driver-TNQ6HSID.js +0 -20
  142. package/dist/driver-TTJVCWCD.js +0 -21
  143. package/dist/electrobun-6ZJ6QFVQ.js +0 -17
  144. package/dist/server-D3HOIPQE.js.map +0 -1
  145. package/dist/session-2VIEKA6A.js +0 -42
  146. package/studio-dist/assets/index-CHLA4F7b.css +0 -2
  147. package/studio-dist/assets/index-DAE7R_Zp.js +0 -23
  148. /package/dist/{accessibility-audit-IWTD2HPR.js.map → accessibility-audit-ARQ3V334.js.map} +0 -0
  149. /package/dist/{agent-fixture-WQVCNL73.js.map → agent-fixture-35U4HLYU.js.map} +0 -0
  150. /package/dist/{allure-LF4CALKP.js.map → allure-6OPM2KHH.js.map} +0 -0
  151. /package/dist/{android-TPO53H5Q.js.map → android-ETXQCLEW.js.map} +0 -0
  152. /package/dist/{app-ZSRJ3VFR.js.map → app-L4OHLMRW.js.map} +0 -0
  153. /package/dist/{appium-LOAWWZXA.js.map → appium-RW2NDIGK.js.map} +0 -0
  154. /package/dist/{appium-server-CCTQQGTV.js.map → appium-server-J6FCQE64.js.map} +0 -0
  155. /package/dist/{baseline-manager-XJ3LADKC.js.map → baseline-manager-4BD5EKUB.js.map} +0 -0
  156. /package/dist/{bridge-server-X5W4PCAR.js.map → bridge-server-6MX6MERV.js.map} +0 -0
  157. /package/dist/{build-info-KFFGVWDQ.js.map → build-info-M7NV4FQA.js.map} +0 -0
  158. /package/dist/{cache-command-OMV6DPC7.js.map → cache-command-INBRSYY6.js.map} +0 -0
  159. /package/dist/{chunk-QNCTEV2P.js.map → chunk-27MCWFJD.js.map} +0 -0
  160. /package/dist/{chunk-BPUBV7OF.js.map → chunk-452GD5VB.js.map} +0 -0
  161. /package/dist/{chunk-4TTYSFBG.js.map → chunk-47TSBPQE.js.map} +0 -0
  162. /package/dist/{chunk-OYME74M3.js.map → chunk-5RU6BYNC.js.map} +0 -0
  163. /package/dist/{chunk-B6NTHBPF.js.map → chunk-67WPE74U.js.map} +0 -0
  164. /package/dist/{chunk-5DSPPJ76.js.map → chunk-6LY55IUQ.js.map} +0 -0
  165. /package/dist/{chunk-AGG2RJGU.js.map → chunk-7SPHOYTS.js.map} +0 -0
  166. /package/dist/{chunk-NQYTD3JG.js.map → chunk-A7Z3HT3W.js.map} +0 -0
  167. /package/dist/{chunk-KIDTBRIV.js.map → chunk-BTODPLHM.js.map} +0 -0
  168. /package/dist/{chunk-CZAFFUMN.js.map → chunk-CAT7OHNT.js.map} +0 -0
  169. /package/dist/{chunk-SPGD4QGA.js.map → chunk-CIRIYDH6.js.map} +0 -0
  170. /package/dist/{chunk-RL3ICBAB.js.map → chunk-CQP4IR2F.js.map} +0 -0
  171. /package/dist/{chunk-R52P4KQC.js.map → chunk-DCF2VBSC.js.map} +0 -0
  172. /package/dist/{chunk-IC46FAEW.js.map → chunk-DXKM5TZO.js.map} +0 -0
  173. /package/dist/{chunk-YKNHKVE6.js.map → chunk-EECGHFPB.js.map} +0 -0
  174. /package/dist/{chunk-7QJY2HJO.js.map → chunk-EFF43IC7.js.map} +0 -0
  175. /package/dist/{chunk-FBJPNZUN.js.map → chunk-EGWMLZBB.js.map} +0 -0
  176. /package/dist/{chunk-ODRB22QA.js.map → chunk-ERL4M6IW.js.map} +0 -0
  177. /package/dist/{chunk-Z5BMFLZ5.js.map → chunk-FD2HE5AT.js.map} +0 -0
  178. /package/dist/{chunk-MQRGWQI5.js.map → chunk-GKCOUOSB.js.map} +0 -0
  179. /package/dist/{chunk-RQRJ2I2Z.js.map → chunk-GNZBJ5BE.js.map} +0 -0
  180. /package/dist/{chunk-3HQKY24K.js.map → chunk-H43BRCLF.js.map} +0 -0
  181. /package/dist/{chunk-HX2PKESI.js.map → chunk-HNXEOKZM.js.map} +0 -0
  182. /package/dist/{chunk-VILLVGBP.js.map → chunk-HUTUC7WM.js.map} +0 -0
  183. /package/dist/{chunk-GBV3XDWM.js.map → chunk-J2WL7VUK.js.map} +0 -0
  184. /package/dist/{chunk-V6PEMZCL.js.map → chunk-JQPPHP7M.js.map} +0 -0
  185. /package/dist/{chunk-6GLL6SMP.js.map → chunk-KGSD5UZ7.js.map} +0 -0
  186. /package/dist/{chunk-LX6GMZIN.js.map → chunk-KIPG2ENR.js.map} +0 -0
  187. /package/dist/{chunk-XPEWAHAK.js.map → chunk-KSXVQH42.js.map} +0 -0
  188. /package/dist/{chunk-ZVUIG6A4.js.map → chunk-L6LGJ5MF.js.map} +0 -0
  189. /package/dist/{chunk-B4FOISOF.js.map → chunk-LIYQTSDQ.js.map} +0 -0
  190. /package/dist/{chunk-T46S4VA3.js.map → chunk-LO7NYXB2.js.map} +0 -0
  191. /package/dist/{chunk-67PLJEY2.js.map → chunk-MOICHR7U.js.map} +0 -0
  192. /package/dist/{chunk-42D5LOGH.js.map → chunk-NFN434RT.js.map} +0 -0
  193. /package/dist/{chunk-IKMNHITS.js.map → chunk-OSHWXMKF.js.map} +0 -0
  194. /package/dist/{chunk-GACJRITH.js.map → chunk-Q4FER5AG.js.map} +0 -0
  195. /package/dist/{chunk-5TAHLRZD.js.map → chunk-QP7BKHYP.js.map} +0 -0
  196. /package/dist/{chunk-QU365GZA.js.map → chunk-SRSE3V3K.js.map} +0 -0
  197. /package/dist/{chunk-KRTQZPYL.js.map → chunk-T46BZOD3.js.map} +0 -0
  198. /package/dist/{chunk-XUKBM64A.js.map → chunk-UWFIFPKJ.js.map} +0 -0
  199. /package/dist/{chunk-XGXOE3DF.js.map → chunk-VAQVIEGT.js.map} +0 -0
  200. /package/dist/{chunk-XLHJCJ4O.js.map → chunk-VVWVNLB2.js.map} +0 -0
  201. /package/dist/{chunk-PS3DALTI.js.map → chunk-WPE4YAGR.js.map} +0 -0
  202. /package/dist/{chunk-5NZPLX2Y.js.map → chunk-XTBG5IDL.js.map} +0 -0
  203. /package/dist/{chunk-XZQGSUV7.js.map → chunk-YT65EX3P.js.map} +0 -0
  204. /package/dist/{compiler-UOVKUQHE.js.map → compiler-ZFER5HX7.js.map} +0 -0
  205. /package/dist/{config-loader-IDIKOQ4T.js.map → config-loader-J44BOSPX.js.map} +0 -0
  206. /package/dist/{console-Z7F7X3WY.js.map → console-3W35Y2YV.js.map} +0 -0
  207. /package/dist/{daemon-manager-6CFUXGTR.js.map → daemon-manager-WT2S6GS7.js.map} +0 -0
  208. /package/dist/{discover-AHMM7QLN.js.map → discover-XZJ5D2J4.js.map} +0 -0
  209. /package/dist/{doctor-command-2PSDOREK.js.map → doctor-command-YN25BI3T.js.map} +0 -0
  210. /package/dist/{driver-TNQ6HSID.js.map → driver-3IZLNSXB.js.map} +0 -0
  211. /package/dist/{driver-TTJVCWCD.js.map → driver-XJETTHHG.js.map} +0 -0
  212. /package/dist/{electrobun-6ZJ6QFVQ.js.map → electrobun-OW5V2OSW.js.map} +0 -0
  213. /package/dist/{electron-XL7H25IQ.js.map → electron-5UKSJ3QR.js.map} +0 -0
  214. /package/dist/{filters-6W73R3IV.js.map → filters-RTJTEZIO.js.map} +0 -0
  215. /package/dist/{github-pr-XZZZ3YE6.js.map → github-pr-CT6ZKKJ5.js.map} +0 -0
  216. /package/dist/{html-GDWXFYFL.js.map → html-G6VGX6D4.js.map} +0 -0
  217. /package/dist/{init-command-PYZ5X6M5.js.map → init-command-NRHHVETM.js.map} +0 -0
  218. /package/dist/{init-flow-command-SLLEGSRZ.js.map → init-flow-command-7DSC7ME2.js.map} +0 -0
  219. /package/dist/{installer-3X5SKWVX.js.map → installer-VOPKS37W.js.map} +0 -0
  220. /package/dist/{installer-Q37BOG5G.js.map → installer-XNV4M6KA.js.map} +0 -0
  221. /package/dist/{ios-YFRAK2CL.js.map → ios-JJ32OL2S.js.map} +0 -0
  222. /package/dist/{json-RNYQ54R7.js.map → json-TNP5EMYW.js.map} +0 -0
  223. /package/dist/{junit-G5LNOYUL.js.map → junit-Q3GEPR4E.js.map} +0 -0
  224. /package/dist/{local-E6FJI3QK.js.map → local-4B4EHRWA.js.map} +0 -0
  225. /package/dist/{machine-VEVBT2GU.js.map → machine-2R4PSS4W.js.map} +0 -0
  226. /package/dist/{pagesource-GQLIXL5R.js.map → pagesource-4BXN3KE7.js.map} +0 -0
  227. /package/dist/{pagesource-HKLE3FZN.js.map → pagesource-REQ5FA4H.js.map} +0 -0
  228. /package/dist/{playwright-LS35WXQ6.js.map → playwright-ESFHDJFF.js.map} +0 -0
  229. /package/dist/{provider-HWM3GF54.js.map → provider-FCRARR2Z.js.map} +0 -0
  230. /package/dist/{redact-YWR6GHBX.js.map → redact-42Q7ZOVN.js.map} +0 -0
  231. /package/dist/{runner-P2BFG4VZ.js.map → runner-U767QTWF.js.map} +0 -0
  232. /package/dist/{screenshot-compare-DNIP2EK4.js.map → screenshot-compare-4EN753KV.js.map} +0 -0
  233. /package/dist/{server-A6Y6ZMET.js.map → server-4BVOD5CM.js.map} +0 -0
  234. /package/dist/{session-2VIEKA6A.js.map → session-4DF7CMFT.js.map} +0 -0
  235. /package/dist/{studio-command-SPHIXFIW.js.map → studio-command-ODE7LBES.js.map} +0 -0
  236. /package/dist/{test-command-OYMJNT23.js.map → test-command-ZXNZSMTX.js.map} +0 -0
  237. /package/dist/{validator-6XP3PGCP.js.map → validator-FQOV6NQH.js.map} +0 -0
  238. /package/dist/{watch-mode-HWZ4XCKH.js.map → watch-mode-XR2Q3RWF.js.map} +0 -0
@@ -66,6 +66,8 @@ export interface DomWaitForSelectorOptions {
66
66
  * activity for this long. Default: 250.
67
67
  */
68
68
  idleQuietMs?: number;
69
+ /** How the host counts an open EventSource/WebSocket for failFastWhenIdle. Default: "busy". */
70
+ idleStreams?: "busy" | "quiet-after-message";
69
71
  /**
70
72
  * The host watches network activity itself (Direct CDP `Network.*` events), so the page needs
71
73
  * no fetch/XHR wrapper. Without it, failFastWhenIdle installs one on first use.
@@ -183,6 +185,8 @@ export interface DomChannel {
183
185
  /** Atomic 1-round-trip actionability wait + focus + React/Vue-safe value fill + input/change dispatch. */
184
186
  fillDom?(selector: Selector, value: string, opts?: DomFillOptions): Promise<boolean>;
185
187
  tapDom(selector: Selector): Promise<boolean>;
188
+ /** Focus the element, also inside a cross-origin frame. False when it is not there (yet). */
189
+ focusDom?(selector: Selector): Promise<boolean>;
186
190
  /** Scroll a DOM element into the viewport center and return its updated bounding rect. */
187
191
  scrollIntoView?(selector: Selector): Promise<DomElementMatch | null>;
188
192
  dispatch?(selector: Selector, eventType: string, eventInit?: Record<string, unknown>): Promise<boolean>;
@@ -236,6 +240,12 @@ export declare function buildDomQueryScript(selector: Selector): string;
236
240
  * Self-contained DOM scroll-into-view script that centers the matched element
237
241
  * in the viewport and returns its fresh post-scroll `DomElementMatch`.
238
242
  */
243
+ /**
244
+ * Scroll the element matching `selector` (an iframe) into view when no part of it is inside the
245
+ * viewport. Chrome throttles animation frames in an off-screen cross-origin frame, so the in-frame
246
+ * stability wait would stall until its timeout (1.32). Returns true when it scrolled.
247
+ */
248
+ export declare function buildDomRevealScript(selector: Selector): string;
239
249
  export declare function buildDomScrollIntoViewScript(selector: Selector): string;
240
250
  /**
241
251
  * Self-contained DOM synthetic tap script for `tapMode: "dom"`.
@@ -272,8 +282,8 @@ export declare const SPANA_RUNTIME_MISSING_SENTINEL = "__SPANA_RT_MISSING__";
272
282
  * Cuts per-action CDP `Runtime.evaluate` payload by ~100× (~8 KB → ~70 bytes)
273
283
  * and lets V8 TurboFan JIT-compile the selector & actionability helpers once.
274
284
  */
275
- export declare const SPANA_INJECTED_RUNTIME_SCRIPT = "(function() {\n if (typeof window === \"undefined\") return true;\n (function() {\n if (typeof globalThis === \"undefined\" || globalThis.__spanaWasm) return;\n var state = {\n moduleCount: 0,\n pendingCount: 0,\n peakWasmMemoryBytes: 0,\n modules: [],\n memories: [],\n traps: []\n };\n var nextId = 1;\n var WASM_RE = /(WebAssembly\\.(RuntimeError|CompileError|LinkError)|wasm-function\\[|memory access out of bounds|table index is out of bounds|integer divide by zero|unreachable|indirect call type mismatch|out of bounds memory access)/i;\n\n function trackMemory(mem) {\n if (!mem || typeof mem !== \"object\" || !(mem.buffer instanceof ArrayBuffer || (typeof SharedArrayBuffer !== \"undefined\" && mem.buffer instanceof SharedArrayBuffer))) {\n return;\n }\n var already = false;\n var alive = [];\n for (var i = 0; i < state.memories.length; i++) {\n var ref = state.memories[i];\n var cur = typeof ref.deref === \"function\" ? ref.deref() : ref;\n if (!cur) continue;\n if (cur === mem) already = true;\n alive.push(ref);\n }\n if (!already) {\n alive.push(typeof WeakRef !== \"undefined\" ? new WeakRef(mem) : mem);\n }\n state.memories = alive;\n computeMemoryBytes();\n }\n\n function computeMemoryBytes() {\n var total = 0;\n var alive = [];\n for (var i = 0; i < state.memories.length; i++) {\n var ref = state.memories[i];\n var cur = typeof ref.deref === \"function\" ? ref.deref() : ref;\n if (!cur) continue;\n alive.push(ref);\n try {\n total += cur.buffer ? cur.buffer.byteLength : 0;\n } catch (e) {}\n }\n state.memories = alive;\n if (total > state.peakWasmMemoryBytes) state.peakWasmMemoryBytes = total;\n return total;\n }\n\n function trackExports(instance) {\n if (!instance || !instance.exports) return { bytes: 0, pages: 0 };\n var bytes = 0;\n try {\n var keys = Object.keys(instance.exports);\n for (var i = 0; i < keys.length; i++) {\n var val = instance.exports[keys[i]];\n if (typeof WebAssembly !== \"undefined\" && typeof WebAssembly.Memory === \"function\" && val instanceof WebAssembly.Memory) {\n trackMemory(val);\n try { bytes += val.buffer.byteLength; } catch (e) {}\n }\n }\n } catch (e) {}\n return { bytes: bytes, pages: Math.round(bytes / 65536) };\n }\n\n function recordTrap(name, message, stack) {\n var combined = String(name || \"\") + \" \" + String(message || \"\") + \" \" + String(stack || \"\");\n if (!WASM_RE.test(combined)) return;\n state.traps.push({\n name: String(name || \"WebAssembly.RuntimeError\"),\n message: String(message || \"WebAssembly trap\"),\n source: typeof window === \"undefined\" ? \"worker\" : \"main\",\n stack: stack ? String(stack) : undefined,\n timestamp: Date.now()\n });\n if (state.traps.length > 100) state.traps.shift();\n }\n\n function getSizeBytes(src) {\n if (!src) return undefined;\n if (typeof src.byteLength === \"number\") return src.byteLength;\n return undefined;\n }\n\n if (typeof WebAssembly !== \"undefined\") {\n var origInstantiate = WebAssembly.instantiate;\n if (typeof origInstantiate === \"function\") {\n WebAssembly.instantiate = function(source, importObject) {\n state.pendingCount += 1;\n var t0 = typeof performance !== \"undefined\" ? performance.now() : Date.now();\n var sizeBytes = getSizeBytes(source);\n return Promise.resolve(origInstantiate.apply(WebAssembly, arguments)).then(\n function(res) {\n state.pendingCount = Math.max(0, state.pendingCount - 1);\n state.moduleCount += 1;\n var inst = res && res.instance ? res.instance : res;\n var memInfo = trackExports(inst);\n var elapsed = Math.round((typeof performance !== \"undefined\" ? performance.now() : Date.now()) - t0);\n state.modules.push({\n id: nextId++,\n sizeBytes: sizeBytes,\n instantiateMs: elapsed,\n memoryBytes: memInfo.bytes || undefined,\n memoryPages: memInfo.pages || undefined,\n instantiatedAt: Date.now()\n });\n return res;\n },\n function(err) {\n state.pendingCount = Math.max(0, state.pendingCount - 1);\n recordTrap(err && err.name, err && err.message ? err.message : String(err), err && err.stack);\n throw err;\n }\n );\n };\n }\n\n var origInstantiateStreaming = WebAssembly.instantiateStreaming;\n if (typeof origInstantiateStreaming === \"function\") {\n WebAssembly.instantiateStreaming = function(source, importObject) {\n state.pendingCount += 1;\n var t0 = typeof performance !== \"undefined\" ? performance.now() : Date.now();\n return Promise.resolve(origInstantiateStreaming.apply(WebAssembly, arguments)).then(\n function(res) {\n state.pendingCount = Math.max(0, state.pendingCount - 1);\n state.moduleCount += 1;\n var inst = res && res.instance ? res.instance : res;\n var memInfo = trackExports(inst);\n var elapsed = Math.round((typeof performance !== \"undefined\" ? performance.now() : Date.now()) - t0);\n state.modules.push({\n id: nextId++,\n instantiateMs: elapsed,\n memoryBytes: memInfo.bytes || undefined,\n memoryPages: memInfo.pages || undefined,\n instantiatedAt: Date.now()\n });\n return res;\n },\n function(err) {\n state.pendingCount = Math.max(0, state.pendingCount - 1);\n recordTrap(err && err.name, err && err.message ? err.message : String(err), err && err.stack);\n throw err;\n }\n );\n };\n }\n\n var OrigMemory = WebAssembly.Memory;\n if (typeof OrigMemory === \"function\") {\n try {\n var WrappedMemory = new Proxy(OrigMemory, {\n construct: function(target, args, newTarget) {\n var mem = Reflect.construct(target, args, newTarget);\n trackMemory(mem);\n return mem;\n }\n });\n WebAssembly.Memory = WrappedMemory;\n } catch (e) {}\n }\n\n var OrigInstance = WebAssembly.Instance;\n if (typeof OrigInstance === \"function\") {\n try {\n var WrappedInstance = new Proxy(OrigInstance, {\n construct: function(target, args, newTarget) {\n var t0 = typeof performance !== \"undefined\" ? performance.now() : Date.now();\n var inst = Reflect.construct(target, args, newTarget);\n state.moduleCount += 1;\n var memInfo = trackExports(inst);\n state.modules.push({\n id: nextId++,\n instantiateMs: Math.round((typeof performance !== \"undefined\" ? performance.now() : Date.now()) - t0),\n memoryBytes: memInfo.bytes || undefined,\n memoryPages: memInfo.pages || undefined,\n instantiatedAt: Date.now()\n });\n return inst;\n }\n });\n WebAssembly.Instance = WrappedInstance;\n } catch (e) {}\n }\n }\n\n if (typeof globalThis.addEventListener === \"function\") {\n globalThis.addEventListener(\"error\", function(ev) {\n var err = ev && ev.error;\n recordTrap(err && err.name, (err && err.message) || (ev && ev.message), err && err.stack);\n });\n globalThis.addEventListener(\"unhandledrejection\", function(ev) {\n var reason = ev && ev.reason;\n recordTrap(reason && reason.name, reason && reason.message ? reason.message : String(reason), reason && reason.stack);\n });\n }\n\n globalThis.__spanaWasm = {\n trackMemory: trackMemory,\n recordTrap: recordTrap,\n getMetrics: function() {\n var bytes = computeMemoryBytes();\n var perfMem = typeof performance !== \"undefined\" && performance.memory ? performance.memory : null;\n return {\n moduleCount: state.moduleCount,\n pendingCount: state.pendingCount,\n wasmMemoryBytes: bytes,\n wasmMemoryPages: Math.round(bytes / 65536),\n peakWasmMemoryBytes: state.peakWasmMemoryBytes,\n jsHeapUsedBytes: perfMem ? perfMem.usedJSHeapSize : undefined,\n jsHeapTotalBytes: perfMem ? perfMem.totalJSHeapSize : undefined,\n crossOriginIsolated: Boolean(globalThis.crossOriginIsolated),\n sharedArrayBufferAvailable: typeof SharedArrayBuffer !== \"undefined\",\n traps: state.traps.slice(),\n modules: state.modules.slice()\n };\n },\n isReady: function(minModules) {\n var req = typeof minModules === \"number\" ? minModules : 1;\n var explicit = globalThis.__SPANA_WASM_READY__;\n if (typeof explicit === \"function\") {\n try { if (!explicit()) return false; } catch (e) { return false; }\n } else if (explicit === false) {\n return false;\n }\n return state.pendingCount === 0 && (state.moduleCount >= req || explicit === true);\n }\n };\n})();\n if (window.__spanaRt) return true;\n \n function normWs(val) {\n return String(val == null ? \"\" : val).replace(/[\\s\\u00a0\\u202f]+/g, \" \").trim();\n }\n function matchSpec(actual, spec, exact) {\n var raw = String(actual || \"\");\n var str = normWs(raw);\n if (spec && typeof spec === \"object\" && typeof spec.__spanaRegex === \"string\") {\n try {\n var re = new RegExp(spec.__spanaRegex, spec.flags || \"\");\n return re.test(raw) || re.test(str);\n } catch (e) { return false; }\n }\n var needle = normWs(spec);\n if (exact) return str === needle;\n return str.toLowerCase().indexOf(needle.toLowerCase()) !== -1;\n }\n function isInsideSectioningContent(el) {\n var cur = el && el.parentElement;\n var guard = 0;\n while (cur && guard++ < 32) {\n var ptag = cur.tagName ? cur.tagName.toUpperCase() : \"\";\n if (ptag === \"ARTICLE\" || ptag === \"ASIDE\" || ptag === \"MAIN\" || ptag === \"NAV\" || ptag === \"SECTION\") {\n return true;\n }\n var prole = (cur.getAttribute && cur.getAttribute(\"role\") || \"\").trim().toLowerCase().split(/\\s+/)[0] || \"\";\n if (prole === \"article\" || prole === \"complementary\" || prole === \"main\" || prole === \"navigation\" || prole === \"region\") {\n return true;\n }\n var root = typeof cur.getRootNode === \"function\" ? cur.getRootNode() : null;\n cur = cur.parentElement || (root && root.host) || null;\n }\n return false;\n }\n function getImplicitRole(el) {\n if (!el || !el.getAttribute) return \"generic\";\n var explicit = (el.getAttribute(\"role\") || \"\").trim().toLowerCase();\n if (explicit) return explicit.split(/\\s+/)[0] || \"generic\";\n var tag = el.tagName ? el.tagName.toUpperCase() : \"\";\n if (tag === \"BUTTON\") return \"button\";\n if (tag === \"A\") return el.hasAttribute(\"href\") ? \"link\" : \"generic\";\n if (tag === \"TEXTAREA\") return \"textbox\";\n if (tag === \"SELECT\") return (el.hasAttribute(\"multiple\") || Number(el.getAttribute(\"size\") || 0) > 1) ? \"listbox\" : \"combobox\";\n if (tag === \"OPTION\") return \"option\";\n if (tag === \"IMG\") return el.getAttribute(\"alt\") === \"\" ? \"presentation\" : \"img\";\n if (tag === \"DIALOG\") return \"dialog\";\n if (tag === \"NAV\") return \"navigation\";\n if (tag === \"MAIN\") return \"main\";\n if (tag === \"HEADER\") return isInsideSectioningContent(el) ? \"generic\" : \"banner\";\n if (tag === \"FOOTER\") return isInsideSectioningContent(el) ? \"generic\" : \"contentinfo\";\n if (tag === \"ASIDE\") return \"complementary\";\n if (tag === \"UL\" || tag === \"OL\") return \"list\";\n if (tag === \"LI\") return \"listitem\";\n if (tag === \"TABLE\") return \"table\";\n if (tag === \"TR\") return \"row\";\n if (tag === \"TD\") return \"cell\";\n if (tag === \"TH\") {\n var scope = (el.getAttribute(\"scope\") || \"\").trim().toLowerCase();\n if (scope === \"row\" || scope === \"rowgroup\") return \"rowheader\";\n if (scope === \"col\" || scope === \"colgroup\") return \"columnheader\";\n var tr = el.parentElement;\n if (tr && tr.tagName && tr.tagName.toUpperCase() === \"TR\" && !(el.closest && el.closest(\"thead\"))) {\n if (tr.querySelector && tr.querySelector(\"td\")) return \"rowheader\";\n }\n return \"columnheader\";\n }\n if (tag === \"ARTICLE\") return \"article\";\n if (tag === \"FORM\") return \"form\";\n if (tag === \"FIELDSET\") return \"group\";\n if (tag === \"FIGURE\") return \"figure\";\n if (tag === \"METER\") return \"meter\";\n if (tag === \"OUTPUT\") return \"status\";\n if (tag === \"P\") return \"paragraph\";\n if (tag === \"STRONG\") return \"strong\";\n if (tag === \"PROGRESS\") return \"progressbar\";\n if (tag === \"HR\") return \"separator\";\n if (tag === \"SECTION\") {\n return (el.hasAttribute(\"aria-label\") || el.hasAttribute(\"aria-labelledby\") || Boolean((el.getAttribute(\"title\") || \"\").trim())) ? \"region\" : \"generic\";\n }\n if (/^H[1-6]$/.test(tag)) return \"heading\";\n if (tag === \"INPUT\") {\n var t = (el.getAttribute(\"type\") || \"text\").toLowerCase();\n if (t === \"button\" || t === \"submit\" || t === \"reset\" || t === \"image\") return \"button\";\n if (t === \"checkbox\") return \"checkbox\";\n if (t === \"radio\") return \"radio\";\n if (t === \"search\") return el.hasAttribute(\"list\") ? \"combobox\" : \"searchbox\";\n if (t === \"number\") return \"spinbutton\";\n if (t === \"range\") return \"slider\";\n if (t === \"hidden\") return \"generic\";\n return el.hasAttribute(\"list\") ? \"combobox\" : \"textbox\";\n }\n return \"generic\";\n }\n var BLOCK_TAGS = {\n ADDRESS: 1, ARTICLE: 1, ASIDE: 1, BLOCKQUOTE: 1, BR: 1, DD: 1, DETAILS: 1,\n DIALOG: 1, DIV: 1, DL: 1, DT: 1, FIELDSET: 1, FIGCAPTION: 1, FIGURE: 1,\n FOOTER: 1, FORM: 1, H1: 1, H2: 1, H3: 1, H4: 1, H5: 1, H6: 1, HEADER: 1,\n HGROUP: 1, HR: 1, LI: 1, MAIN: 1, NAV: 1, OL: 1, P: 1, PRE: 1, SECTION: 1,\n SUMMARY: 1, TABLE: 1, TD: 1, TH: 1, TR: 1, UL: 1,\n };\n // Name-from-content separates any child that is not laid out as plain inline\n // (Chrome/Playwright parity): flex/grid items are blockified, so sibling\n // <span>s in a flex button still read as separate words.\n function isSpacedNameChild(child, cTag) {\n var cwin = (child.ownerDocument && child.ownerDocument.defaultView) || window;\n var cst = cwin && cwin.getComputedStyle ? cwin.getComputedStyle(child) : null;\n if (cst && cst.display) return cst.display !== \"inline\";\n return Boolean(BLOCK_TAGS[cTag]);\n }\n function visibleTextOf(node, allowHiddenRoot, skipControl) {\n if (!node) return \"\";\n if (node.nodeType === 3) return node.nodeValue || \"\";\n if (node.nodeType !== 1 && node.nodeType !== 11) return \"\";\n if (node.nodeType === 1) {\n if (skipControl && node === skipControl) return \"\";\n var t = node.tagName ? node.tagName.toUpperCase() : \"\";\n if (t === \"BR\") return \" \";\n if (t === \"SCRIPT\" || t === \"STYLE\" || t === \"NOSCRIPT\" || t === \"TEMPLATE\") return \"\";\n if (skipControl && (t === \"SELECT\" || t === \"TEXTAREA\" || t === \"INPUT\")) return \"\";\n if (t === \"IMG\") {\n var imgAlt = node.getAttribute && node.getAttribute(\"alt\");\n return imgAlt ? normWs(imgAlt) : \"\";\n }\n if (t === \"SVG\") {\n var svgRole = (node.getAttribute && node.getAttribute(\"role\") || \"\").trim().toLowerCase();\n var svgLabel = node.getAttribute && node.getAttribute(\"aria-label\");\n if (svgLabel && svgLabel.trim()) return normWs(svgLabel);\n if (svgRole === \"img\") {\n var svgTitle = node.querySelector && node.querySelector(\"title\");\n if (svgTitle && svgTitle.textContent) return normWs(svgTitle.textContent);\n }\n }\n if (!allowHiddenRoot) {\n if (node.getAttribute && node.getAttribute(\"aria-hidden\") === \"true\") return \"\";\n var win = (node.ownerDocument && node.ownerDocument.defaultView) || window;\n if (win && win.getComputedStyle) {\n var st = win.getComputedStyle(node);\n if (st && (st.display === \"none\" || st.visibility === \"hidden\" || st.visibility === \"collapse\")) {\n return \"\";\n }\n }\n }\n }\n var out = [];\n if (node.shadowRoot) {\n var stxt = visibleTextOf(node.shadowRoot, false, skipControl);\n if (stxt) out.push(stxt);\n }\n var kids = node.childNodes || [];\n for (var i = 0; i < kids.length; i++) {\n var child = kids[i];\n var k = visibleTextOf(child, false, skipControl);\n if (!k) continue;\n var cTag = child && child.nodeType === 1 && child.tagName ? child.tagName.toUpperCase() : \"\";\n if (cTag && isSpacedNameChild(child, cTag)) {\n out.push(\" \", k, \" \");\n } else {\n out.push(k);\n }\n }\n return normWs(out.join(\"\"));\n }\n function ensureNetworkTracker() {\n if (typeof window === \"undefined\" || window.__spanaNetHooked) return;\n try {\n window.__spanaNetHooked = true;\n window.__spanaInflightNet = window.__spanaInflightNet || 0;\n window.__spanaLastNetEnd = window.__spanaLastNetEnd || 0;\n if (typeof window.fetch === \"function\") {\n var origFetch = window.fetch;\n window.fetch = function() {\n window.__spanaInflightNet = (window.__spanaInflightNet || 0) + 1;\n var done = false;\n var finish = function() {\n if (done) return;\n done = true;\n window.__spanaInflightNet = Math.max(0, (window.__spanaInflightNet || 1) - 1);\n window.__spanaLastNetEnd = Date.now();\n };\n try {\n var p = origFetch.apply(this, arguments);\n if (p && typeof p.then === \"function\") {\n p.then(finish, finish);\n } else {\n finish();\n }\n return p;\n } catch (e) {\n finish();\n throw e;\n }\n };\n }\n if (typeof XMLHttpRequest !== \"undefined\" && XMLHttpRequest.prototype && typeof XMLHttpRequest.prototype.send === \"function\") {\n var origSend = XMLHttpRequest.prototype.send;\n XMLHttpRequest.prototype.send = function() {\n window.__spanaInflightNet = (window.__spanaInflightNet || 0) + 1;\n var done = false;\n var finish = function() {\n if (done) return;\n done = true;\n window.__spanaInflightNet = Math.max(0, (window.__spanaInflightNet || 1) - 1);\n window.__spanaLastNetEnd = Date.now();\n };\n try {\n this.addEventListener(\"loadend\", finish, { once: true });\n return origSend.apply(this, arguments);\n } catch (e) {\n finish();\n throw e;\n }\n };\n }\n } catch (e) {}\n }\n function hasInflightNetwork(quietMs) {\n if (typeof window === \"undefined\" || !window.__spanaNetHooked) return false;\n if ((window.__spanaInflightNet || 0) > 0) return true;\n var lastEnd = window.__spanaLastNetEnd || 0;\n if (lastEnd > 0 && Date.now() - lastEnd < (quietMs || 250)) return true;\n return false;\n }\n function isVisiblyHiddenInAncestorChain(el) {\n if (!el) return true;\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var cur = el;\n var guard = 0;\n while (cur && guard++ < 48) {\n if (cur.nodeType === 1 && win && win.getComputedStyle) {\n var cs = win.getComputedStyle(cur);\n if (cs) {\n if (cs.display === \"none\") return true;\n if (cs.contentVisibility === \"hidden\") return true;\n }\n }\n var root = typeof cur.getRootNode === \"function\" ? cur.getRootNode() : null;\n cur = cur.parentElement || (root && root.host) || null;\n }\n if (el.nodeType === 1 && win && win.getComputedStyle) {\n var selfCs = win.getComputedStyle(el);\n if (selfCs && (selfCs.visibility === \"hidden\" || selfCs.visibility === \"collapse\")) return true;\n }\n return false;\n }\n // opacity: 0 on the element or an ancestor. Such an element still counts as visible\n // (Playwright's toBeVisible), but an action prefers an opaque match: a closed menu kept at\n // opacity 0 must not take the click meant for the button the user sees.\n function isTransparent(el) {\n var win = (el && el.ownerDocument && el.ownerDocument.defaultView) || window;\n var cur = el;\n var guard = 0;\n while (cur && guard++ < 48) {\n if (cur.nodeType === 1 && win && win.getComputedStyle) {\n var cs = win.getComputedStyle(cur);\n if (cs && cs.opacity === \"0\") return true;\n }\n var root = typeof cur.getRootNode === \"function\" ? cur.getRootNode() : null;\n cur = cur.parentElement || (root && root.host) || null;\n }\n return false;\n }\n function pickActionIndex(items, elOf) {\n var last = items.length - 1;\n for (var i = last; i >= 0; i--) {\n if (!isTransparent(elOf(items[i]))) return i;\n }\n return last;\n }\n function isHiddenInAncestorChain(el) {\n if (!el) return true;\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var cur = el;\n var guard = 0;\n while (cur && guard++ < 48) {\n if (cur.getAttribute) {\n if (cur.getAttribute(\"aria-hidden\") === \"true\") return true;\n }\n if (cur.hasAttribute && cur.hasAttribute(\"inert\")) return true;\n if (cur.nodeType === 1 && win && win.getComputedStyle) {\n var cs = win.getComputedStyle(cur);\n if (cs) {\n if (cs.display === \"none\") return true;\n if (cs.contentVisibility === \"hidden\") return true;\n }\n }\n var root = typeof cur.getRootNode === \"function\" ? cur.getRootNode() : null;\n cur = cur.parentElement || (root && root.host) || null;\n }\n if (el.nodeType === 1 && win && win.getComputedStyle) {\n var selfCs = win.getComputedStyle(el);\n if (selfCs && (selfCs.visibility === \"hidden\" || selfCs.visibility === \"collapse\")) return true;\n }\n return false;\n }\n function isAriaHidden(el) {\n if (el && el.tagName && el.tagName.toUpperCase() === \"OPTION\") {\n var parentSel = el.closest ? el.closest(\"select\") : el.parentElement;\n if (parentSel) {\n return isHiddenInAncestorChain(parentSel);\n }\n }\n if (isHiddenInAncestorChain(el)) return true;\n if (el && el.nodeType === 1) {\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var st = win && win.getComputedStyle ? win.getComputedStyle(el) : null;\n if (st && st.display === \"contents\") {\n return !hasVisibleDescendant(el, 0);\n }\n }\n return false;\n }\n function hasVisibleDescendant(el, depth) {\n if (!el || depth > 8) return false;\n var kids = el.children || [];\n for (var i = 0; i < kids.length; i++) {\n var child = kids[i];\n if (!child || child.nodeType !== 1) continue;\n var cr = child.getBoundingClientRect ? child.getBoundingClientRect() : { width: 0, height: 0 };\n if (isVisible(child, cr, depth + 1)) return true;\n }\n if (el.shadowRoot && el.shadowRoot.children) {\n var skids = el.shadowRoot.children;\n for (var j = 0; j < skids.length; j++) {\n var sc = skids[j];\n if (!sc || sc.nodeType !== 1) continue;\n var sr = sc.getBoundingClientRect ? sc.getBoundingClientRect() : { width: 0, height: 0 };\n if (isVisible(sc, sr, depth + 1)) return true;\n }\n }\n return false;\n }\n function getContentsUnionRect(el, depth) {\n if (!el || depth > 8) return null;\n var minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n var found = false;\n var visit = function(list) {\n for (var i = 0; i < list.length; i++) {\n var child = list[i];\n if (!child || child.nodeType !== 1) continue;\n var win = (child.ownerDocument && child.ownerDocument.defaultView) || window;\n var cst = win && win.getComputedStyle ? win.getComputedStyle(child) : null;\n if (cst && (cst.display === \"none\" || cst.visibility === \"hidden\" || cst.visibility === \"collapse\")) continue;\n var r = cst && cst.display === \"contents\"\n ? getContentsUnionRect(child, depth + 1)\n : (child.getBoundingClientRect ? child.getBoundingClientRect() : null);\n if (r && r.width > 0 && r.height > 0) {\n found = true;\n if (r.x < minX) minX = r.x;\n if (r.y < minY) minY = r.y;\n if (r.x + r.width > maxX) maxX = r.x + r.width;\n if (r.y + r.height > maxY) maxY = r.y + r.height;\n }\n }\n };\n if (el.children) visit(el.children);\n if (el.shadowRoot && el.shadowRoot.children) visit(el.shadowRoot.children);\n if (!found) return null;\n return { x: minX, y: minY, left: minX, top: minY, width: maxX - minX, height: maxY - minY, right: maxX, bottom: maxY };\n }\n function headingLevelOf(el) {\n if (!el) return null;\n var explicit = el.getAttribute && el.getAttribute(\"aria-level\");\n if (explicit) {\n var parsed = parseInt(explicit, 10);\n if (!isNaN(parsed)) return parsed;\n }\n var tag = el.tagName ? el.tagName.toUpperCase() : \"\";\n var m = /^H([1-6])$/.exec(tag);\n return m ? parseInt(m[1], 10) : null;\n }\n function getAccessibleName(el) {\n if (!el) return \"\";\n var doc = el.ownerDocument || document;\n var labelledBy = el.getAttribute && el.getAttribute(\"aria-labelledby\");\n if (labelledBy) {\n var parts = [];\n var ids = labelledBy.trim().split(/\\s+/);\n for (var i = 0; i < ids.length; i++) {\n var ref = doc.getElementById ? doc.getElementById(ids[i]) : null;\n if (ref) {\n var rt = visibleTextOf(ref, true, null);\n if (rt) parts.push(rt);\n }\n }\n if (parts.length > 0) return parts.join(\" \").replace(/\\s+/g, \" \").trim();\n }\n var ariaLabel = el.getAttribute && el.getAttribute(\"aria-label\");\n if (ariaLabel && ariaLabel.trim()) return ariaLabel.trim();\n var tag = el.tagName ? el.tagName.toUpperCase() : \"\";\n if (tag === \"INPUT\" || tag === \"TEXTAREA\" || tag === \"SELECT\") {\n if (el.id && doc.querySelector) {\n try {\n var escId = typeof CSS !== \"undefined\" && CSS.escape ? CSS.escape(el.id) : el.id;\n var forLbl = doc.querySelector('label[for=\"' + escId + '\"]');\n if (forLbl) {\n var ft = visibleTextOf(forLbl, false, el);\n if (ft) return ft;\n }\n } catch (e) {}\n }\n if (el.closest) {\n var wrapLbl = el.closest(\"label\");\n if (wrapLbl) {\n var wt = visibleTextOf(wrapLbl, false, el);\n if (wt) return wt;\n }\n }\n var itype = tag === \"INPUT\" ? (el.getAttribute(\"type\") || \"text\").toLowerCase() : \"\";\n if ((itype === \"button\" || itype === \"submit\" || itype === \"reset\") && el.value) {\n return String(el.value).trim();\n }\n var ph = el.getAttribute && el.getAttribute(\"placeholder\");\n if (ph && ph.trim()) return ph.trim();\n }\n if (tag === \"IMG\") {\n var alt = el.getAttribute && el.getAttribute(\"alt\");\n if (alt && alt.trim()) return alt.trim();\n }\n if (tag === \"FIELDSET\") {\n var fkids = el.children || [];\n for (var fi = 0; fi < fkids.length; fi++) {\n var fk = fkids[fi];\n if (fk && fk.tagName && fk.tagName.toUpperCase() === \"LEGEND\") {\n var ltxt = visibleTextOf(fk, false, null);\n if (ltxt) return ltxt;\n break;\n }\n }\n }\n if (tag === \"TABLE\") {\n var tkids = el.children || [];\n for (var ti = 0; ti < tkids.length; ti++) {\n var tk = tkids[ti];\n if (tk && tk.tagName && tk.tagName.toUpperCase() === \"CAPTION\") {\n var ctxt = visibleTextOf(tk, false, null);\n if (ctxt) return ctxt;\n break;\n }\n }\n }\n if (tag === \"FIGURE\") {\n var fgkids = el.children || [];\n for (var fgi = 0; fgi < fgkids.length; fgi++) {\n var fgk = fgkids[fgi];\n if (fgk && fgk.tagName && fgk.tagName.toUpperCase() === \"FIGCAPTION\") {\n var fgtxt = visibleTextOf(fgk, false, null);\n if (fgtxt) return fgtxt;\n break;\n }\n }\n }\n var role = getImplicitRole(el);\n var nameFromAuthorOnly = {\n list: 1, navigation: 1, main: 1, region: 1, form: 1, dialog: 1, alertdialog: 1,\n table: 1, grid: 1, tablist: 1, tabpanel: 1, menu: 1, menubar: 1, toolbar: 1,\n tree: 1, group: 1, radiogroup: 1, feed: 1, article: 1, banner: 1, complementary: 1,\n contentinfo: 1, search: 1, combobox: 1, listbox: 1, log: 1, marquee: 1, status: 1,\n timer: 1, alert: 1, application: 1, document: 1, directory: 1, figure: 1, img: 1,\n math: 1, meter: 1, progressbar: 1, scrollbar: 1, separator: 1, slider: 1,\n spinbutton: 1, textbox: 1, searchbox: 1,\n };\n if (role && nameFromAuthorOnly[role]) {\n var authorTitle = el.getAttribute && el.getAttribute(\"title\");\n return authorTitle ? authorTitle.trim() : \"\";\n }\n var txt = visibleTextOf(el, false, null);\n if (txt) return txt;\n var title = el.getAttribute && el.getAttribute(\"title\");\n return title ? title.trim() : \"\";\n }\n function getAccessibleDescription(el) {\n if (!el) return \"\";\n var doc = el.ownerDocument || document;\n var describedBy = el.getAttribute && el.getAttribute(\"aria-describedby\");\n if (describedBy) {\n var parts = [];\n var ids = describedBy.trim().split(/\\s+/);\n for (var i = 0; i < ids.length; i++) {\n var ref = doc.getElementById ? doc.getElementById(ids[i]) : null;\n if (ref) {\n var rt = visibleTextOf(ref, true, null);\n if (rt) parts.push(rt);\n }\n }\n if (parts.length > 0) return parts.join(\" \").replace(/\\s+/g, \" \").trim();\n }\n var ariaDesc = el.getAttribute && el.getAttribute(\"aria-description\");\n if (ariaDesc && ariaDesc.trim()) return ariaDesc.trim();\n var title = el.getAttribute && el.getAttribute(\"title\");\n if (title && title.trim()) {\n var accName = getAccessibleName(el);\n if (accName && accName !== title.trim()) return title.trim();\n }\n return \"\";\n }\n function getIframeTransform(frameEl) {\n var fr = frameEl.getBoundingClientRect();\n var fwin = (frameEl.ownerDocument && frameEl.ownerDocument.defaultView) || window;\n var fcs = fwin && fwin.getComputedStyle ? fwin.getComputedStyle(frameEl) : null;\n var bLeft = fcs ? (parseFloat(fcs.borderLeftWidth) || 0) : 0;\n var bTop = fcs ? (parseFloat(fcs.borderTopWidth) || 0) : 0;\n var bRight = fcs ? (parseFloat(fcs.borderRightWidth) || 0) : 0;\n var bBottom = fcs ? (parseFloat(fcs.borderBottomWidth) || 0) : 0;\n var layoutW = frameEl.offsetWidth || (frameEl.clientWidth + bLeft + bRight);\n var layoutH = frameEl.offsetHeight || (frameEl.clientHeight + bTop + bBottom);\n var sx = layoutW > 0 ? (fr.width / layoutW) : 1;\n var sy = layoutH > 0 ? (fr.height / layoutH) : 1;\n if (!isFinite(sx) || sx <= 0) sx = 1;\n if (!isFinite(sy) || sy <= 0) sy = 1;\n return { left: fr.left + bLeft * sx, top: fr.top + bTop * sy, scaleX: sx, scaleY: sy };\n }\n function collectRoots(root, offsetX, offsetY, scaleX, scaleY, inShadow, inIframe, out) {\n if (!root) return;\n out.push({ root: root, offsetX: offsetX, offsetY: offsetY, scaleX: scaleX, scaleY: scaleY, inShadow: inShadow, inIframe: inIframe });\n if (root.shadowRoot) {\n collectRoots(root.shadowRoot, offsetX, offsetY, scaleX, scaleY, true, inIframe, out);\n }\n var nodes = root.querySelectorAll ? root.querySelectorAll(\"*\") : [];\n for (var i = 0; i < nodes.length; i++) {\n var el = nodes[i];\n if (el.shadowRoot) {\n collectRoots(el.shadowRoot, offsetX, offsetY, scaleX, scaleY, true, inIframe, out);\n }\n if (el.tagName === \"IFRAME\") {\n try {\n var frameDoc = el.contentDocument;\n if (frameDoc) {\n var ft = getIframeTransform(el);\n collectRoots(\n frameDoc,\n offsetX + ft.left * scaleX,\n offsetY + ft.top * scaleY,\n scaleX * ft.scaleX,\n scaleY * ft.scaleY,\n inShadow,\n true,\n out\n );\n }\n } catch (e) {}\n }\n }\n }\n function findTextInRoot(root, needle, exact, ctx, pushHit) {\n if (!root) return;\n var isRegex = Boolean(needle && typeof needle === \"object\" && typeof needle.__spanaRegex === \"string\");\n var rawNeedleStr = isRegex ? \"\" : String(needle == null ? \"\" : needle);\n var trimmedNeedle = normWs(rawNeedleStr);\n var lowerNeedle = trimmedNeedle.toLowerCase();\n if (!isRegex && !trimmedNeedle) return;\n\n var skipTags = { SCRIPT: 1, STYLE: 1, NOSCRIPT: 1, TEMPLATE: 1, HEAD: 1, META: 1, LINK: 1, TITLE: 1 };\n\n // Button-like <input> elements store their label in .value (not ancestor .textContent),\n // so check them directly before textContent-based subtree pruning.\n if (root.querySelectorAll) {\n var btnInputs = root.querySelectorAll('input[type=\"button\"], input[type=\"submit\"], input[type=\"reset\"]');\n for (var bi = 0; bi < btnInputs.length; bi++) {\n var bNode = btnInputs[bi];\n var bVal = normWs(bNode.value || \"\");\n if (bVal && matchSpec(bVal, needle, exact)) {\n pushHit(bNode, ctx);\n }\n }\n }\n\n function visitNode(node) {\n if (!node || node.nodeType !== 1) return false;\n var tag = node.tagName ? node.tagName.toUpperCase() : \"\";\n if (skipTags[tag] || tag === \"INPUT\") return false;\n\n var normText = normWs(node.textContent || \"\");\n if (!isRegex) {\n if (!normText) return false;\n if (exact) {\n if (normText.indexOf(trimmedNeedle) === -1) return false;\n } else {\n if (normText.toLowerCase().indexOf(lowerNeedle) === -1) return false;\n }\n }\n\n var childMatched = false;\n var kids = node.children || [];\n for (var i = 0; i < kids.length; i++) {\n if (visitNode(kids[i])) childMatched = true;\n }\n if (childMatched) return true;\n\n if (normText && matchSpec(normText, needle, exact)) {\n pushHit(node, ctx);\n return true;\n }\n return false;\n }\n\n if (root.nodeType === 9) {\n var startEl = root.body || root.documentElement;\n if (startEl) visitNode(startEl);\n return;\n }\n if (root.nodeType === 11) {\n var fragKids = root.children || [];\n for (var fi = 0; fi < fragKids.length; fi++) visitNode(fragKids[fi]);\n return;\n }\n visitNode(root);\n }\n function findRoleInRoot(root, roleLower, nameSpec, exact, ctx, pushHit, includeHidden, level, pressed) {\n if (!root || !root.querySelectorAll) return;\n var candidates = root.querySelectorAll(\"*\");\n for (var i = 0; i < candidates.length; i++) {\n var el = candidates[i];\n if (getImplicitRole(el) !== roleLower) continue;\n if (!includeHidden && isAriaHidden(el)) continue;\n if (level !== undefined && level !== null && headingLevelOf(el) !== Number(level)) continue;\n if (pressed !== undefined && pressed !== null) {\n var ap = (el.getAttribute && el.getAttribute(\"aria-pressed\") || \"\").trim().toLowerCase();\n if (pressed ? ap !== \"true\" : ap !== \"false\") continue;\n }\n if (nameSpec !== undefined && nameSpec !== null) {\n var accName = getAccessibleName(el);\n if (!matchSpec(accName, nameSpec, Boolean(exact))) continue;\n }\n pushHit(el, ctx);\n }\n }\n function isHitVisible(h) {\n if (!h) return false;\n if (h.wasmNode) {\n return h.wasmNode.visible !== false && h.wasmRect && h.wasmRect.width > 0 && h.wasmRect.height > 0;\n }\n if (!h.el || !h.el.getBoundingClientRect) return false;\n return isVisible(h.el, h.el.getBoundingClientRect());\n }\n // Only a button-like <input> shows its value as its text; an <option>'s or a field's value is data.\n function buttonInputValue(el) {\n if (!el || !el.tagName || el.tagName.toUpperCase() !== \"INPUT\") return \"\";\n var bt = (el.getAttribute(\"type\") || \"\").toLowerCase();\n return bt === \"button\" || bt === \"submit\" || bt === \"reset\" ? el.value || \"\" : \"\";\n }\n function applyModifiersAndSlice(hits, sel, preferVisible) {\n if (!sel || typeof sel !== \"object\" || \"point\" in sel) return hits;\n var filtered = hits;\n if (sel.hasText !== undefined) {\n filtered = filtered.filter(function(h) {\n var normTc = normWs(h.el.textContent || \"\");\n var innerT = normWs(h.el.innerText || \"\");\n var fallbackTxt = normWs(buttonInputValue(h.el) || getAccessibleName(h.el) || \"\");\n return matchSpec(normTc, sel.hasText, false) || matchSpec(innerT, sel.hasText, false) || matchSpec(fallbackTxt, sel.hasText, false);\n });\n }\n if (sel.hasNotText !== undefined) {\n filtered = filtered.filter(function(h) {\n var normTc = normWs(h.el.textContent || \"\");\n var innerT = normWs(h.el.innerText || \"\");\n var fallbackTxt = normWs(buttonInputValue(h.el) || getAccessibleName(h.el) || \"\");\n return !matchSpec(normTc, sel.hasNotText, false) && !matchSpec(innerT, sel.hasNotText, false) && !matchSpec(fallbackTxt, sel.hasNotText, false);\n });\n }\n if (sel.has !== undefined) {\n filtered = filtered.filter(function(h) {\n return findInScope(sel.has, h.el, h.offsetX, h.offsetY, h.scaleX, h.scaleY, h.inShadow, h.inIframe, preferVisible).length > 0;\n });\n }\n if (sel.hasNot !== undefined) {\n filtered = filtered.filter(function(h) {\n return findInScope(sel.hasNot, h.el, h.offsetX, h.offsetY, h.scaleX, h.scaleY, h.inShadow, h.inIframe, preferVisible).length === 0;\n });\n }\n var wantsSlice = Boolean(sel.first || sel.last || typeof sel.nth === \"number\");\n if (wantsSlice && !sel.includeHidden && preferVisible) {\n var visibleFiltered = filtered.filter(isHitVisible);\n if (preferVisible === \"strict\" || visibleFiltered.length > 0) {\n filtered = visibleFiltered;\n }\n }\n if (sel.first) return filtered.length > 0 ? [filtered[0]] : [];\n if (sel.last) return filtered.length > 0 ? [filtered[filtered.length - 1]] : [];\n if (typeof sel.nth === \"number\") {\n var idx = sel.nth < 0 ? filtered.length + sel.nth : sel.nth;\n return idx >= 0 && idx < filtered.length ? [filtered[idx]] : [];\n }\n return filtered;\n }\n function findInScope(sel, scopeRoot, baseOffsetX, baseOffsetY, baseScaleX, baseScaleY, baseInShadow, baseInIframe, preferVisible) {\n var hits = [];\n var seen = typeof Set !== \"undefined\" ? new Set() : null;\n function pushHit(el, ctx) {\n if (seen) {\n if (seen.has(el)) return;\n seen.add(el);\n }\n hits.push({\n el: el,\n offsetX: ctx.offsetX,\n offsetY: ctx.offsetY,\n scaleX: ctx.scaleX != null ? ctx.scaleX : 1,\n scaleY: ctx.scaleY != null ? ctx.scaleY : 1,\n inShadow: ctx.inShadow,\n inIframe: ctx.inIframe\n });\n }\n if (typeof sel === \"object\" && sel !== null && \"point\" in sel) {\n var atPt = document.elementFromPoint(sel.point.x, sel.point.y);\n if (atPt) pushHit(atPt, { offsetX: 0, offsetY: 0, scaleX: 1, scaleY: 1, inShadow: false, inIframe: false });\n return hits;\n }\n // Frame scoping: find matching <iframe> first, then search inside its contentDocument\n if (typeof sel === \"object\" && sel !== null && sel.frame) {\n var frameHits = findInScope(sel.frame, scopeRoot, baseOffsetX, baseOffsetY, baseScaleX, baseScaleY, baseInShadow, baseInIframe, preferVisible);\n var innerSel = Object.assign({}, sel);\n delete innerSel.frame;\n for (var fi = 0; fi < frameHits.length; fi++) {\n var fEl = frameHits[fi].el;\n if (fEl && fEl.tagName === \"IFRAME\") {\n try {\n var fDoc = fEl.contentDocument;\n if (fDoc) {\n var fTr = getIframeTransform(fEl);\n var pSx = frameHits[fi].scaleX != null ? frameHits[fi].scaleX : 1;\n var pSy = frameHits[fi].scaleY != null ? frameHits[fi].scaleY : 1;\n var sub = findInScope(\n innerSel,\n fDoc,\n frameHits[fi].offsetX + fTr.left * pSx,\n frameHits[fi].offsetY + fTr.top * pSy,\n pSx * fTr.scaleX,\n pSy * fTr.scaleY,\n frameHits[fi].inShadow,\n true,\n preferVisible\n );\n for (var si = 0; si < sub.length; si++) pushHit(sub[si].el, sub[si]);\n }\n } catch (e) {}\n }\n }\n return hits;\n }\n // Parent scoping: resolve 'within' first, then search inside each matched container\n if (typeof sel === \"object\" && sel !== null && sel.within) {\n var parentHits = findInScope(sel.within, scopeRoot, baseOffsetX, baseOffsetY, baseScaleX, baseScaleY, baseInShadow, baseInIframe, preferVisible);\n var childSel = Object.assign({}, sel);\n delete childSel.within;\n delete childSel.hasText;\n delete childSel.hasNotText;\n delete childSel.has;\n delete childSel.hasNot;\n delete childSel.first;\n delete childSel.last;\n delete childSel.nth;\n var combined = [];\n var cSeen = typeof Set !== \"undefined\" ? new Set() : null;\n for (var pi = 0; pi < parentHits.length; pi++) {\n var ph = parentHits[pi];\n var subHits = findInScope(childSel, ph.el, ph.offsetX, ph.offsetY, ph.scaleX, ph.scaleY, ph.inShadow, ph.inIframe, preferVisible);\n for (var ci = 0; ci < subHits.length; ci++) {\n if (cSeen && cSeen.has(subHits[ci].el)) continue;\n if (cSeen) cSeen.add(subHits[ci].el);\n combined.push(subHits[ci]);\n }\n }\n return applyModifiersAndSlice(combined, sel, preferVisible);\n }\n // Logical OR composition (anyOf): union deduplicated hits across branches\n if (typeof sel === \"object\" && sel !== null && Array.isArray(sel.anyOf)) {\n for (var bi = 0; bi < sel.anyOf.length; bi++) {\n var branchHits = findInScope(sel.anyOf[bi], scopeRoot, baseOffsetX, baseOffsetY, baseScaleX, baseScaleY, baseInShadow, baseInIframe, preferVisible);\n for (var bh = 0; bh < branchHits.length; bh++) {\n pushHit(branchHits[bh].el, branchHits[bh]);\n }\n }\n return applyModifiersAndSlice(hits, sel, preferVisible);\n }\n // Logical AND composition (allOf): intersection of matched elements across branches\n if (typeof sel === \"object\" && sel !== null && Array.isArray(sel.allOf) && sel.allOf.length > 0) {\n var firstBranch = findInScope(sel.allOf[0], scopeRoot, baseOffsetX, baseOffsetY, baseScaleX, baseScaleY, baseInShadow, baseInIframe, preferVisible);\n var currentHits = firstBranch;\n for (var ai = 1; ai < sel.allOf.length && currentHits.length > 0; ai++) {\n var nextBranch = findInScope(sel.allOf[ai], scopeRoot, baseOffsetX, baseOffsetY, baseScaleX, baseScaleY, baseInShadow, baseInIframe, preferVisible);\n var nextEls = typeof Set !== \"undefined\" ? new Set(nextBranch.map(function(h) { return h.el; })) : null;\n currentHits = currentHits.filter(function(h) {\n if (nextEls) return nextEls.has(h.el);\n return nextBranch.some(function(nh) { return nh.el === h.el; });\n });\n }\n for (var ahi = 0; ahi < currentHits.length; ahi++) pushHit(currentHits[ahi].el, currentHits[ahi]);\n return applyModifiersAndSlice(hits, sel, preferVisible);\n }\n\n function queryCssSafe(root, cssStr) {\n try {\n return root.querySelectorAll(cssStr);\n } catch (e) {\n var hint = \"\";\n if (/:has-text\\(/.test(cssStr)) hint = \" (Playwright :has-text() is not valid CSS; use { ..., hasText: ... } instead)\";\n else if (cssStr.indexOf(\">>\") !== -1) hint = \" (Playwright >> chaining is not valid CSS; use within(parent, child) instead)\";\n else if (/\\bnth=/.test(cssStr)) hint = \" (Playwright nth= is not valid CSS; use { ..., nth: index } instead)\";\n throw new Error('Invalid CSS selector \"' + cssStr + '\": ' + (e && e.message ? e.message : String(e)) + hint);\n }\n }\n function findByLabelInRoot(root, spec, exact, ctx, push) {\n if (!root || !root.querySelectorAll) return;\n var seen = new Set();\n var addCtrl = function(c) {\n if (!c || seen.has(c)) return;\n if (c.tagName === \"INPUT\" && (c.getAttribute(\"type\") || \"\").toLowerCase() === \"hidden\") return;\n seen.add(c);\n push(c, ctx);\n };\n // 1. Explicit <label> elements (associated via .control, [for], or nested labelable control)\n var labels = root.querySelectorAll(\"label\");\n for (var lb = 0; lb < labels.length; lb++) {\n var lblEl = labels[lb];\n var ctrlFromLbl = lblEl.control || null;\n if (!ctrlFromLbl && lblEl.getAttribute) {\n var forAttr = lblEl.getAttribute(\"for\");\n if (forAttr) {\n var lblRoot = typeof lblEl.getRootNode === \"function\" ? lblEl.getRootNode() : null;\n if (lblRoot && typeof lblRoot.getElementById === \"function\") {\n ctrlFromLbl = lblRoot.getElementById(forAttr);\n }\n if (!ctrlFromLbl) {\n var lblDoc = lblEl.ownerDocument || document;\n ctrlFromLbl = lblDoc.getElementById ? lblDoc.getElementById(forAttr) : null;\n }\n if (!ctrlFromLbl && root.querySelector) {\n try {\n var escFor = typeof CSS !== \"undefined\" && CSS.escape ? CSS.escape(forAttr) : forAttr;\n ctrlFromLbl = root.querySelector('[id=\"' + escFor + '\"]');\n } catch (e) {}\n }\n }\n }\n if (!ctrlFromLbl && lblEl.querySelector) {\n ctrlFromLbl = lblEl.querySelector(\"input:not([type=hidden]), textarea, select, meter, output, progress\");\n }\n if (!ctrlFromLbl) continue;\n var rawLblText = visibleTextOf(lblEl, false, ctrlFromLbl) || normWs(lblEl.textContent || \"\");\n var fullLblText = !lblEl.contains(ctrlFromLbl) ? normWs(lblEl.textContent || \"\") : \"\";\n if (\n (rawLblText && matchSpec(rawLblText, spec, exact)) ||\n (fullLblText && matchSpec(fullLblText, spec, exact))\n ) {\n addCtrl(ctrlFromLbl);\n }\n }\n // 2. Labelable form controls & ARIA form widgets (never match <button> by its inner text)\n var labelableRoles = {\n textbox: 1, searchbox: 1, combobox: 1, listbox: 1, spinbutton: 1,\n slider: 1, checkbox: 1, radio: 1, switch: 1,\n };\n var controls = root.querySelectorAll(\"input, textarea, select, meter, output, progress, audio, video, [contenteditable], [aria-label], [aria-labelledby]\");\n for (var li = 0; li < controls.length; li++) {\n var ctrl = controls[li];\n if (seen.has(ctrl)) continue;\n if (ctrl.tagName === \"INPUT\" && (ctrl.getAttribute(\"type\") || \"\").toLowerCase() === \"hidden\") continue;\n var tag = ctrl.tagName ? ctrl.tagName.toUpperCase() : \"\";\n var isFormControl =\n tag === \"INPUT\" || tag === \"TEXTAREA\" || tag === \"SELECT\" ||\n tag === \"METER\" || tag === \"OUTPUT\" || tag === \"PROGRESS\" ||\n tag === \"AUDIO\" || tag === \"VIDEO\" ||\n (ctrl.hasAttribute && ctrl.hasAttribute(\"contenteditable\"));\n var role = getImplicitRole(ctrl);\n if (!isFormControl && !labelableRoles[role]) continue;\n var labelText = getAccessibleName(ctrl);\n if (!labelText && ctrl.labels && ctrl.labels.length > 0) {\n var parts = [];\n for (var lj = 0; lj < ctrl.labels.length; lj++) {\n parts.push((ctrl.labels[lj].textContent || \"\").trim());\n }\n labelText = parts.join(\" \").trim();\n }\n if (labelText && matchSpec(labelText, spec, exact)) {\n addCtrl(ctrl);\n }\n }\n }\n function findByAttrSpecInRoot(root, attrName, spec, exact, ctx, push) {\n if (!root || !root.querySelectorAll) return;\n var nodes = root.querySelectorAll(\"[\" + attrName + \"]\");\n for (var ni = 0; ni < nodes.length; ni++) {\n var val = nodes[ni].getAttribute(attrName);\n if (val !== null && matchSpec(val, spec, exact)) {\n push(nodes[ni], ctx);\n }\n }\n }\n\n var esc = function(v) {\n return typeof CSS !== \"undefined\" && CSS.escape ? CSS.escape(v) : String(v).replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"');\n };\n var mainCtx = { root: scopeRoot, offsetX: baseOffsetX, offsetY: baseOffsetY, scaleX: baseScaleX, scaleY: baseScaleY, inShadow: baseInShadow, inIframe: baseInIframe };\n var hasModifiers = typeof sel === \"object\" && sel !== null && (sel.hasText !== undefined || sel.hasNotText !== undefined || sel.has !== undefined || sel.hasNot !== undefined || sel.first || sel.last || typeof sel.nth === \"number\");\n\n // O(1)-ish Light-DOM fast path: avoids scanning thousands of nodes with querySelectorAll(\"*\")\n // unless Shadow DOM / iframe piercing is needed or no Light-DOM match exists.\n if (scopeRoot && scopeRoot.querySelectorAll && !hasModifiers) {\n if (typeof sel === \"object\" && sel !== null && \"testID\" in sel) {\n var fastTid = esc(sel.testID);\n var fastFound = scopeRoot.querySelectorAll('[data-testid=\"' + fastTid + '\"], [testID=\"' + fastTid + '\"]');\n if (fastFound.length > 0) {\n for (var fi2 = 0; fi2 < fastFound.length; fi2++) pushHit(fastFound[fi2], mainCtx);\n return hits;\n }\n } else if (typeof sel === \"object\" && sel !== null && \"css\" in sel) {\n var fastCss = queryCssSafe(scopeRoot, sel.css);\n if (fastCss.length > 0) {\n for (var fc = 0; fc < fastCss.length; fc++) pushHit(fastCss[fc], mainCtx);\n return hits;\n }\n } else if (typeof sel === \"object\" && sel !== null && \"accessibilityLabel\" in sel) {\n var fastLbl = esc(sel.accessibilityLabel);\n var fastFoundLbl = scopeRoot.querySelectorAll('[aria-label=\"' + fastLbl + '\"]');\n if (fastFoundLbl.length > 0) {\n for (var fj = 0; fj < fastFoundLbl.length; fj++) pushHit(fastFoundLbl[fj], mainCtx);\n return hits;\n }\n } else if (typeof sel === \"object\" && sel !== null && \"label\" in sel) {\n findByLabelInRoot(scopeRoot, sel.label, Boolean(sel.exact), mainCtx, pushHit);\n if (hits.length > 0) return hits;\n } else if (typeof sel === \"object\" && sel !== null && \"placeholder\" in sel) {\n findByAttrSpecInRoot(scopeRoot, \"placeholder\", sel.placeholder, Boolean(sel.exact), mainCtx, pushHit);\n if (hits.length > 0) return hits;\n } else if (typeof sel === \"object\" && sel !== null && \"altText\" in sel) {\n findByAttrSpecInRoot(scopeRoot, \"alt\", sel.altText, Boolean(sel.exact), mainCtx, pushHit);\n if (hits.length > 0) return hits;\n } else if (typeof sel === \"object\" && sel !== null && \"title\" in sel) {\n findByAttrSpecInRoot(scopeRoot, \"title\", sel.title, Boolean(sel.exact), mainCtx, pushHit);\n if (hits.length > 0) return hits;\n } else if (typeof sel === \"object\" && sel !== null && \"role\" in sel) {\n findRoleInRoot(scopeRoot, String(sel.role).toLowerCase(), sel.name, sel.exact, mainCtx, pushHit, sel.includeHidden, sel.level, sel.pressed);\n if (hits.length > 0) return hits;\n } else if (typeof sel === \"string\" || (typeof sel === \"object\" && sel !== null && \"text\" in sel)) {\n var fastNeedle = typeof sel === \"string\" ? sel : sel.text;\n var fastExact = typeof sel === \"object\" && sel !== null && Boolean(sel.exact);\n findTextInRoot(scopeRoot, fastNeedle, fastExact, mainCtx, pushHit);\n if (hits.length > 0) return hits;\n }\n }\n\n var roots = [];\n collectRoots(scopeRoot, baseOffsetX, baseOffsetY, baseScaleX, baseScaleY, baseInShadow, baseInIframe, roots);\n for (var r = 0; r < roots.length; r++) {\n var ctx = roots[r];\n var root = ctx.root;\n if (!root || !root.querySelectorAll) continue;\n if (typeof sel === \"object\" && sel !== null && \"testID\" in sel) {\n var tid = esc(sel.testID);\n var found = root.querySelectorAll('[data-testid=\"' + tid + '\"], [testID=\"' + tid + '\"]');\n for (var i = 0; i < found.length; i++) pushHit(found[i], ctx);\n } else if (typeof sel === \"object\" && sel !== null && \"css\" in sel) {\n var foundCss = queryCssSafe(root, sel.css);\n for (var ci2 = 0; ci2 < foundCss.length; ci2++) pushHit(foundCss[ci2], ctx);\n } else if (typeof sel === \"object\" && sel !== null && \"accessibilityLabel\" in sel) {\n var lbl = esc(sel.accessibilityLabel);\n var foundLbl = root.querySelectorAll('[aria-label=\"' + lbl + '\"]');\n for (var j = 0; j < foundLbl.length; j++) pushHit(foundLbl[j], ctx);\n } else if (typeof sel === \"object\" && sel !== null && \"label\" in sel) {\n findByLabelInRoot(root, sel.label, Boolean(sel.exact), ctx, pushHit);\n } else if (typeof sel === \"object\" && sel !== null && \"placeholder\" in sel) {\n findByAttrSpecInRoot(root, \"placeholder\", sel.placeholder, Boolean(sel.exact), ctx, pushHit);\n } else if (typeof sel === \"object\" && sel !== null && \"altText\" in sel) {\n findByAttrSpecInRoot(root, \"alt\", sel.altText, Boolean(sel.exact), ctx, pushHit);\n } else if (typeof sel === \"object\" && sel !== null && \"title\" in sel) {\n findByAttrSpecInRoot(root, \"title\", sel.title, Boolean(sel.exact), ctx, pushHit);\n } else if (typeof sel === \"object\" && sel !== null && \"role\" in sel) {\n findRoleInRoot(root, String(sel.role).toLowerCase(), sel.name, sel.exact, ctx, pushHit, sel.includeHidden, sel.level, sel.pressed);\n } else if (typeof sel === \"string\" || (typeof sel === \"object\" && sel !== null && \"text\" in sel)) {\n var needle = typeof sel === \"string\" ? sel : sel.text;\n var isExact = typeof sel === \"object\" && sel !== null && Boolean(sel.exact);\n findTextInRoot(root, needle, isExact, ctx, pushHit);\n }\n }\n return applyModifiersAndSlice(hits, sel, preferVisible);\n }\n function findWasmSemanticHits(sel) {\n if (typeof window === \"undefined\" || !window.__SPANA_WASM_TREE__) return [];\n var provider = window.__SPANA_WASM_TREE__;\n var nodes;\n try { nodes = typeof provider === \"function\" ? provider() : provider; } catch (e) { return []; }\n if (!Array.isArray(nodes) || nodes.length === 0) return [];\n var matched = [];\n for (var i = 0; i < nodes.length; i++) {\n var n = nodes[i];\n if (!n || typeof n !== \"object\" || !n.bounds) continue;\n var nid = n.testID || n.id || \"\";\n var ntext = String(n.text != null ? n.text : (n.label != null ? n.label : \"\"));\n var nlabel = String(n.label != null ? n.label : \"\");\n var nrole = String(n.role || \"\");\n var ok = false;\n if (typeof sel === \"string\") {\n ok = nid === sel || ntext === sel;\n } else if (sel && typeof sel === \"object\") {\n if (sel.testID !== undefined) {\n ok = nid === sel.testID;\n } else if (sel.text !== undefined) {\n ok = sel.exact ? ntext.trim() === String(sel.text).trim() : ntext.indexOf(String(sel.text)) !== -1;\n } else if (sel.accessibilityLabel !== undefined) {\n ok = nlabel === sel.accessibilityLabel || ntext === sel.accessibilityLabel;\n } else if (sel.role !== undefined) {\n var rOk = nrole.toLowerCase() === String(sel.role).toLowerCase();\n var nameOk = true;\n if (sel.name !== undefined) {\n if (typeof sel.name === \"object\" && sel.name && sel.name.__regex) {\n var re = new RegExp(sel.name.source, sel.name.flags || \"\");\n nameOk = re.test(ntext) || re.test(nlabel);\n } else {\n var exp = String(sel.name);\n nameOk = sel.exact\n ? (ntext.trim() === exp.trim() || nlabel.trim() === exp.trim())\n : (ntext.toLowerCase().indexOf(exp.toLowerCase()) !== -1 || nlabel.toLowerCase().indexOf(exp.toLowerCase()) !== -1);\n }\n }\n ok = rOk && nameOk;\n }\n }\n if (!ok) continue;\n var ox = 0;\n var oy = 0;\n var hostEl = null;\n if (n.canvasSelector && typeof document !== \"undefined\" && document.querySelector) {\n try {\n hostEl = document.querySelector(n.canvasSelector);\n if (hostEl && typeof hostEl.getBoundingClientRect === \"function\") {\n var cr = hostEl.getBoundingClientRect();\n ox = cr.left || 0;\n oy = cr.top || 0;\n }\n } catch (e) {}\n }\n var bx = (n.bounds.x || 0) + ox;\n var by = (n.bounds.y || 0) + oy;\n var bw = n.bounds.width || 0;\n var bh = n.bounds.height || 0;\n var vRect = { left: bx, top: by, x: bx, y: by, width: bw, height: bh, right: bx + bw, bottom: by + bh };\n var virtualEl = {\n isConnected: true,\n tagName: \"WASM-NODE\",\n innerText: ntext,\n textContent: ntext,\n value: n.value,\n __spanaHostCanvas: hostEl,\n getBoundingClientRect: function() { return vRect; },\n getAttribute: function(k) {\n if (k === \"data-testid\" || k === \"testID\") return nid || null;\n if (k === \"role\") return nrole || null;\n if (k === \"aria-label\") return nlabel || null;\n return (n.attributes && n.attributes[k]) || null;\n },\n hasAttribute: function(k) { return this.getAttribute(k) !== null; }\n };\n matched.push({ el: virtualEl, offsetX: 0, offsetY: 0, inShadow: false, inIframe: false, wasmNode: n, wasmRect: vRect });\n }\n return matched;\n }\n function findAcrossRoots(sel, preferVisible) {\n var pv = preferVisible === undefined ? \"prefer\" : preferVisible;\n var domHits = findInScope(sel, document, 0, 0, 1, 1, false, false, pv);\n var wasmHits = findWasmSemanticHits(sel);\n if (wasmHits.length === 0) return domHits;\n return domHits.length === 0 ? wasmHits : domHits.concat(wasmHits);\n }\n function isClickable(el) {\n var tag = el.tagName;\n if (tag === \"BUTTON\" || tag === \"A\" || tag === \"INPUT\" || tag === \"SELECT\" || tag === \"TEXTAREA\") return true;\n var role = el.getAttribute && el.getAttribute(\"role\");\n if (role === \"button\" || role === \"link\" || role === \"tab\" || role === \"checkbox\" || role === \"switch\") return true;\n if (typeof el.onclick === \"function\") return true;\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var cursor = win.getComputedStyle(el).cursor;\n return cursor === \"pointer\";\n }\n function isAppReady() {\n var sig = typeof window !== \"undefined\" ? window.__SPANA_APP_READY__ : undefined;\n if (typeof sig === \"function\") {\n try { return Boolean(sig()); } catch (e) { return false; }\n }\n if (typeof sig === \"boolean\") return sig;\n return true;\n }\n function deepElementFromPoint(rootDoc, x, y) {\n if (!rootDoc || typeof rootDoc.elementFromPoint !== \"function\") return null;\n var el = rootDoc.elementFromPoint(x, y);\n var guard = 0;\n while (el && guard++ < 16) {\n if (el.shadowRoot && typeof el.shadowRoot.elementFromPoint === \"function\") {\n var inner = el.shadowRoot.elementFromPoint(x, y);\n if (inner && inner !== el) { el = inner; continue; }\n }\n if (el.tagName === \"IFRAME\") {\n try {\n var fdoc = el.contentDocument;\n if (fdoc && typeof fdoc.elementFromPoint === \"function\") {\n var ft = getIframeTransform(el);\n var fx = (x - ft.left) / ft.scaleX;\n var fy = (y - ft.top) / ft.scaleY;\n var fEl = fdoc.elementFromPoint(fx, fy);\n if (fEl && fEl !== el) { el = fEl; x = fx; y = fy; continue; }\n }\n } catch (e) {}\n }\n break;\n }\n return el;\n }\n function labelControlOf(node) {\n var cur = node;\n var guard = 0;\n while (cur && guard++ < 8) {\n if (cur.tagName === \"LABEL\") return cur.control || null;\n cur = cur.parentElement;\n }\n return null;\n }\n function isSameOrDescendant(target, candidate) {\n if (!target || !candidate) return false;\n if (target === candidate) return true;\n try {\n if (typeof target.contains === \"function\" && target.contains(candidate)) return true;\n } catch (e) {}\n if (labelControlOf(candidate) === target) return true;\n var cur = candidate;\n var guard = 0;\n while (cur && guard++ < 24) {\n if (cur === target) return true;\n var root = typeof cur.getRootNode === \"function\" ? cur.getRootNode() : null;\n if (root && root.host) {\n cur = root.host;\n } else {\n cur = cur.parentElement;\n }\n }\n return false;\n }\n function describeEl(el) {\n if (!el) return \"(unknown)\";\n var tag = el.tagName ? el.tagName.toLowerCase() : \"element\";\n var idPart = el.id ? \"#\" + el.id : \"\";\n var cls = typeof el.className === \"string\" ? el.className.trim().split(/\\s+/).filter(Boolean).slice(0, 3).join(\".\") : \"\";\n var clsPart = cls ? \".\" + cls : \"\";\n var txt = (el.innerText || el.textContent || \"\").replace(/\\s+/g, \" \").trim();\n if (txt.length > 40) txt = txt.slice(0, 37) + \"...\";\n return \"<\" + tag + idPart + clsPart + (txt ? \">\" + txt + \"</\" + tag + \">\" : \">\");\n }\n function getHitTestBlocker(hit) {\n if (hit.wasmNode) {\n var wr = hit.wasmRect;\n var wvw = (window.visualViewport && window.visualViewport.width) || window.innerWidth || 0;\n var wvh = (window.visualViewport && window.visualViewport.height) || window.innerHeight || 0;\n var wcx = wr.left + wr.width / 2;\n var wcy = wr.top + wr.height / 2;\n if (wvw > 0 && wvh > 0 && (wcx < 0 || wcy < 0 || wcx > wvw || wcy > wvh)) return \"outside viewport\";\n if (hit.el && hit.el.__spanaHostCanvas) {\n var topW = deepElementFromPoint(document, wcx, wcy);\n if (topW && !isSameOrDescendant(hit.el.__spanaHostCanvas, topW)) return describeEl(topW);\n }\n return null;\n }\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var winForRect = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var styleForRect = winForRect && winForRect.getComputedStyle ? winForRect.getComputedStyle(el) : null;\n if (styleForRect && styleForRect.display === \"contents\") {\n var contentsRect = getContentsUnionRect(el, 0);\n if (contentsRect) rect = contentsRect;\n }\n var sx = hit.scaleX != null ? hit.scaleX : 1;\n var sy = hit.scaleY != null ? hit.scaleY : 1;\n var vw = (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0;\n var vh = (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0;\n var cx = hit.offsetX + (rect.left + rect.width / 2) * sx;\n var cy = hit.offsetY + (rect.top + rect.height / 2) * sy;\n if (vw > 0 && vh > 0 && (cx < 0 || cy < 0 || cx > vw || cy > vh)) {\n return \"outside viewport\";\n }\n var topEl = deepElementFromPoint(document, cx, cy);\n if (!topEl) return null;\n if (isSameOrDescendant(el, topEl)) return null;\n return describeEl(topEl);\n }\n function getClippedViewportBox(hit) {\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var winForRect = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var styleForRect = winForRect && winForRect.getComputedStyle ? winForRect.getComputedStyle(el) : null;\n if (styleForRect && styleForRect.display === \"contents\") {\n var contentsRect = getContentsUnionRect(el, 0);\n if (contentsRect) rect = contentsRect;\n }\n var sx = hit.scaleX != null ? hit.scaleX : 1;\n var sy = hit.scaleY != null ? hit.scaleY : 1;\n var left = hit.offsetX + rect.left * sx;\n var top = hit.offsetY + rect.top * sy;\n var right = hit.offsetX + (rect.left + rect.width) * sx;\n var bottom = hit.offsetY + (rect.top + rect.height) * sy;\n // Intersect with clipping ancestors (overflow: hidden/clip/scroll/auto) so half-clipped buttons\n // target their visible region rather than clicking a clipped-out center onto the parent container.\n // Only ancestors on the containing-block chain clip: a position: fixed box escapes all but a\n // transformed/contained ancestor (and a top-layer <dialog>/popover escapes all of them); a\n // position: absolute box escapes the static ancestors between it and its positioned one.\n var cur = el.parentElement;\n var guard = 0;\n var cbMode = clipEscapeMode(el, styleForRect);\n while (cur && cbMode !== \"top\" && guard++ < 32) {\n var cs = winForRect && winForRect.getComputedStyle ? winForRect.getComputedStyle(cur) : null;\n if (cs && !(cbMode === \"fixed\" ? formsFixedContainingBlock(cs)\n : cbMode === \"absolute\" ? (cs.position !== \"static\" || formsFixedContainingBlock(cs)) : true)) {\n cs = null;\n }\n if (cs) {\n cbMode = clipEscapeMode(cur, cs);\n var ox = cs.overflowX || cs.overflow || \"\";\n var oy = cs.overflowY || cs.overflow || \"\";\n if (ox === \"hidden\" || ox === \"clip\" || ox === \"scroll\" || ox === \"auto\" ||\n oy === \"hidden\" || oy === \"clip\" || oy === \"scroll\" || oy === \"auto\") {\n var cr = cur.getBoundingClientRect();\n if (cr.width > 0 && cr.height > 0) {\n var cLeft = hit.offsetX + cr.left * sx;\n var cTop = hit.offsetY + cr.top * sy;\n var cRight = hit.offsetX + cr.right * sx;\n var cBottom = hit.offsetY + cr.bottom * sy;\n if (ox === \"hidden\" || ox === \"clip\" || ox === \"scroll\" || ox === \"auto\") {\n if (cLeft > left) left = cLeft;\n if (cRight < right) right = cRight;\n }\n if (oy === \"hidden\" || oy === \"clip\" || oy === \"scroll\" || oy === \"auto\") {\n if (cTop > top) top = cTop;\n if (cBottom < bottom) bottom = cBottom;\n }\n }\n }\n }\n cur = cur.parentElement;\n }\n var vw = (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0;\n var vh = (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0;\n if (vw > 0 && vh > 0) {\n if (left < 0) left = 0;\n if (top < 0) top = 0;\n if (right > vw) right = vw;\n if (bottom > vh) bottom = vh;\n }\n return { left: left, top: top, right: right, bottom: bottom, vw: vw, vh: vh, rawRect: rect, sx: sx, sy: sy };\n }\n // How a box escapes the overflow clip of its ancestors: \"top\" (top layer: none clip it),\n // \"fixed\", \"absolute\", or \"flow\" (every ancestor clips).\n function clipEscapeMode(node, cs) {\n try {\n if (node.matches && node.matches(\":modal, :popover-open\")) return \"top\";\n } catch (e) {}\n var pos = cs ? cs.position : \"static\";\n return pos === \"fixed\" || pos === \"absolute\" ? pos : \"flow\";\n }\n function formsFixedContainingBlock(cs) {\n if (cs.transform && cs.transform !== \"none\") return true;\n if (cs.perspective && cs.perspective !== \"none\") return true;\n if (cs.filter && cs.filter !== \"none\") return true;\n if (cs.backdropFilter && cs.backdropFilter !== \"none\") return true;\n if (/paint|layout|strict|content/.test(cs.contain || \"\")) return true;\n if (cs.containerType && cs.containerType !== \"normal\") return true;\n if (/transform|perspective|filter/.test(cs.willChange || \"\")) return true;\n return false;\n }\n function findClickablePoint(hit) {\n if (hit.wasmNode) {\n var wr = hit.wasmRect;\n return { x: wr.left + wr.width / 2, y: wr.top + wr.height / 2 };\n }\n var el = hit.el;\n var box = getClippedViewportBox(hit);\n var rawCx = hit.offsetX + (box.rawRect.left + box.rawRect.width / 2) * box.sx;\n var rawCy = hit.offsetY + (box.rawRect.top + box.rawRect.height / 2) * box.sy;\n var clipW = box.right - box.left;\n var clipH = box.bottom - box.top;\n if (box.vw > 0 && box.vh > 0 && (clipW <= 0 || clipH <= 0)) {\n return null;\n }\n var tryPt = function(px, py) {\n if (box.vw > 0 && box.vh > 0 && (px < 0 || py < 0 || px >= box.vw || py >= box.vh)) return null;\n var topEl = deepElementFromPoint(document, px, py);\n if (!topEl || isSameOrDescendant(el, topEl)) return { x: px, y: py };\n return null;\n };\n // 1. Fast path: the exact center, as Playwright clicks it (rounding moves the point up to\n // 0.5px, e.g. across a line boundary in a textarea, which moves the caret), then rounded.\n var rExact = tryPt(rawCx, rawCy);\n if (rExact) return rExact;\n var rRaw = tryPt(Math.round(rawCx), Math.round(rawCy));\n if (rRaw) return rRaw;\n // 2. Clipped visible center (rounded, then fractional)\n var cx = box.left + clipW / 2;\n var cy = box.top + clipH / 2;\n var rClip = tryPt(Math.round(cx), Math.round(cy));\n if (rClip) return rClip;\n var fClip = tryPt(cx, cy);\n if (fClip) return fClip;\n // 3. Interior points inside the visible clipped rect (handles 0.5px edge rounding onto clipping parent)\n var padX = Math.min(2, clipW / 4);\n var padY = Math.min(2, clipH / 4);\n var candidates = [\n [Math.floor(cx), Math.floor(cy)],\n [Math.ceil(cx), Math.floor(cy)],\n [Math.floor(cx), Math.ceil(cy)],\n [Math.floor(box.left + padX), Math.floor(box.top + padY)],\n [Math.ceil(box.left + padX), Math.ceil(box.top + padY)],\n [Math.floor(box.right - padX), Math.floor(box.bottom - padY)],\n [box.left + padX, box.top + padY],\n [box.right - padX, box.bottom - padY],\n ];\n for (var i = 0; i < candidates.length; i++) {\n var hitPt = tryPt(candidates[i][0], candidates[i][1]);\n if (hitPt) return hitPt;\n }\n // 4. A 5x5 grid over the visible box: a target whose centre and corners are covered (a toast,\n // a sticky bar) is still clicked where it shows, instead of scrolling it \u2014 which would\n // close a popover that closes on scroll (1.18).\n for (var gy = 0; gy < 5; gy++) {\n for (var gx = 0; gx < 5; gx++) {\n var gridPt = tryPt(box.left + clipW * (0.1 + 0.2 * gx), box.top + clipH * (0.1 + 0.2 * gy));\n if (gridPt) return gridPt;\n }\n }\n return null;\n }\n function isHitTestClear(hit) {\n if (hit.wasmNode) {\n return getHitTestBlocker(hit) === null;\n }\n var pt = findClickablePoint(hit);\n if (pt) {\n hit._clickPoint = pt;\n return true;\n }\n hit._clickPoint = null;\n return false;\n }\n function isScrollableOverflow(val) {\n return val === \"auto\" || val === \"scroll\" || val === \"overlay\";\n }\n function isClippedByScrollableAncestor(hit, rect) {\n var el = hit.el;\n var doc = el.ownerDocument || document;\n var win = doc.defaultView || window;\n var cur = el.parentElement;\n var guard = 0;\n while (cur && cur.nodeType === 1 && guard++ < 32) {\n if (cur === doc.documentElement || cur === doc.body) break;\n var cs = win && win.getComputedStyle ? win.getComputedStyle(cur) : null;\n if (cs) {\n var ox = cs.overflowX || cs.overflow || \"\";\n var oy = cs.overflowY || cs.overflow || \"\";\n var canScrollX = isScrollableOverflow(ox) && cur.scrollWidth > cur.clientWidth + 1;\n var canScrollY = isScrollableOverflow(oy) && cur.scrollHeight > cur.clientHeight + 1;\n if (canScrollX || canScrollY) {\n var cr = cur.getBoundingClientRect();\n if (cr.width > 0 && cr.height > 0) {\n if (canScrollX && (rect.left < cr.left - 0.5 || rect.right > cr.right + 0.5)) {\n return true;\n }\n if (canScrollY && (rect.top < cr.top - 0.5 || rect.bottom > cr.bottom + 0.5)) {\n return true;\n }\n }\n }\n // Inspect a position: fixed ancestor itself FIRST (it may be scrollable),\n // then stop walking above its fixed containing boundary.\n if (cs.position === \"fixed\") break;\n }\n cur = cur.parentElement;\n }\n return false;\n }\n function isFullyInViewport(hit) {\n if (hit.wasmNode) return true;\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var winForRect = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var styleForRect = winForRect && winForRect.getComputedStyle ? winForRect.getComputedStyle(el) : null;\n if (styleForRect && styleForRect.display === \"contents\") {\n var contentsRect = getContentsUnionRect(el, 0);\n if (contentsRect) rect = contentsRect;\n }\n var sx = hit.scaleX != null ? hit.scaleX : 1;\n var sy = hit.scaleY != null ? hit.scaleY : 1;\n var vw = (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0;\n var vh = (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0;\n if (vw <= 0 || vh <= 0 || rect.width <= 0 || rect.height <= 0) return false;\n var left = hit.offsetX + rect.left * sx;\n var top = hit.offsetY + rect.top * sy;\n if (!(left >= 0 && top >= 0 && (left + rect.width * sx) <= vw && (top + rect.height * sy) <= vh)) {\n return false;\n }\n if (isClippedByScrollableAncestor(hit, rect)) return false;\n return true;\n }\n function ensureInViewport(hit) {\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var winForRect = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var styleForRect = winForRect && winForRect.getComputedStyle ? winForRect.getComputedStyle(el) : null;\n if (styleForRect && styleForRect.display === \"contents\") {\n var contentsRect = getContentsUnionRect(el, 0);\n if (contentsRect) rect = contentsRect;\n }\n var sx = hit.scaleX != null ? hit.scaleX : 1;\n var sy = hit.scaleY != null ? hit.scaleY : 1;\n var vw = (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0;\n var vh = (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0;\n var cx = hit.offsetX + (rect.left + rect.width / 2) * sx;\n var cy = hit.offsetY + (rect.top + rect.height / 2) * sy;\n var outsideWindow = vw > 0 && vh > 0 && (cx < 1 || cy < 1 || cx > vw - 1 || cy > vh - 1);\n if (outsideWindow || isClippedByScrollableAncestor(hit, rect)) {\n if (typeof el.scrollIntoView === \"function\") {\n try { el.scrollIntoView({ block: \"center\", inline: \"center\", behavior: \"instant\" }); }\n catch (e) { try { el.scrollIntoView(true); } catch (e2) {} }\n }\n return true;\n }\n return false;\n }\n function canScrollToUnobscure(hit) {\n if (!hit || !hit.el || hit.wasmNode) return false;\n var el = hit.el;\n var doc = el.ownerDocument || document;\n var win = doc.defaultView || window;\n var hasScrollableAncestor = false;\n var hitFixedBoundary = false;\n var cur = el;\n var guard = 0;\n while (cur && cur.nodeType === 1 && guard++ < 32) {\n var cs = win && win.getComputedStyle ? win.getComputedStyle(cur) : null;\n if (cs) {\n if (cur !== el && cur !== doc.documentElement && cur !== doc.body) {\n var ox = cs.overflowX || cs.overflow || \"\";\n var oy = cs.overflowY || cs.overflow || \"\";\n if ((isScrollableOverflow(ox) && cur.scrollWidth > cur.clientWidth + 1) ||\n (isScrollableOverflow(oy) && cur.scrollHeight > cur.clientHeight + 1)) {\n hasScrollableAncestor = true;\n }\n }\n if (cs.position === \"fixed\") {\n hitFixedBoundary = true;\n break;\n }\n }\n cur = cur.parentElement;\n }\n var rect = el.getBoundingClientRect();\n // If clipped outside a scrollable ancestor (including inside/on a position: fixed dialog),\n // scrolling that ancestor brings the target into view even if the clipped point hits a backdrop.\n if (hasScrollableAncestor && isClippedByScrollableAncestor(hit, rect)) {\n return true;\n }\n if (hitFixedBoundary && !hasScrollableAncestor) return false;\n var cx = rect.left + rect.width / 2;\n var cy = rect.top + rect.height / 2;\n var topEl = deepElementFromPoint(doc, cx, cy);\n if (!topEl) return false;\n var vpW = win.innerWidth || doc.documentElement.clientWidth || 1280;\n var vpH = win.innerHeight || doc.documentElement.clientHeight || 720;\n var b = topEl;\n while (b && b.nodeType === 1) {\n var bs = win && win.getComputedStyle ? win.getComputedStyle(b) : null;\n if (bs && (bs.position === \"fixed\" || bs.position === \"sticky\")) {\n var br = b.getBoundingClientRect();\n if (br.width >= vpW * 0.8 && br.height >= vpH * 0.8) return false;\n return true;\n }\n b = b.parentElement;\n }\n return false;\n }\n function scrollToUnobscure(hit) {\n var el = hit.el;\n if (typeof el.scrollIntoView !== \"function\") return false;\n var blocks = [\"center\", \"end\", \"start\", \"nearest\"];\n for (var i = 0; i < blocks.length; i++) {\n try {\n el.scrollIntoView({ block: blocks[i], inline: \"center\", behavior: \"instant\" });\n } catch (e) {\n try { el.scrollIntoView(true); } catch (e2) {}\n }\n if (!el.isConnected) {\n try { window.__spanaLastScrollDetached = true; } catch (e3) {}\n return false;\n }\n if (isHitTestClear(hit)) return true;\n }\n return false;\n }\n function hasActiveViewTransition() {\n if (typeof document === \"undefined\" || typeof document.getAnimations !== \"function\") return false;\n try {\n var allAnims = document.getAnimations();\n for (var i = 0; i < allAnims.length; i++) {\n var a = allAnims[i];\n var pseudo = a && a.effect && a.effect.pseudoElement;\n if (a && a.playState === \"running\" && typeof pseudo === \"string\" && pseudo.indexOf(\"::view-transition\") === 0) {\n return true;\n }\n }\n } catch (e) {}\n return false;\n }\n function hasActiveAnimation(el) {\n if (hasActiveViewTransition()) return true;\n var cur = el;\n var depth = 0;\n while (cur && depth++ < 8) {\n if (typeof cur.getAnimations === \"function\") {\n try {\n var anims = cur.getAnimations();\n for (var i = 0; i < anims.length; i++) {\n if (anims[i] && anims[i].playState === \"running\") return true;\n }\n } catch (e) {}\n }\n cur = cur.parentElement;\n }\n return false;\n }\n function isElementEnabled(el) {\n if (!el) return true;\n if (el.hasAttribute && el.hasAttribute(\"disabled\")) return false;\n if (el.getAttribute && el.getAttribute(\"aria-disabled\") === \"true\") return false;\n try {\n if (typeof el.matches === \"function\" && el.matches(\":disabled\")) return false;\n } catch (e) {}\n var cur = el.parentElement;\n var guard = 0;\n while (cur && guard++ < 16) {\n if (cur.getAttribute && cur.getAttribute(\"aria-disabled\") === \"true\") return false;\n cur = cur.parentElement;\n }\n return true;\n }\n function isVisible(el, rect, depth) {\n if (!el) return false;\n if (isVisiblyHiddenInAncestorChain(el)) return false;\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var style = win && win.getComputedStyle ? win.getComputedStyle(el) : null;\n if (style && style.display === \"contents\") {\n return hasVisibleDescendant(el, depth || 0);\n }\n if (!rect || rect.width <= 0 || rect.height <= 0) return false;\n return true;\n }\n function getVisibilityFailureReason(el, rect) {\n if (!el) return \"element is null\";\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var cur = el;\n var guard = 0;\n while (cur && guard++ < 48) {\n if (cur.nodeType === 1 && win && win.getComputedStyle) {\n var cs = win.getComputedStyle(cur);\n if (cs) {\n if (cs.display === \"none\") return cur === el ? \"display: none\" : \"ancestor has display: none\";\n if (cs.contentVisibility === \"hidden\") return cur === el ? \"content-visibility: hidden\" : \"ancestor has content-visibility: hidden\";\n }\n }\n var root = typeof cur.getRootNode === \"function\" ? cur.getRootNode() : null;\n cur = cur.parentElement || (root && root.host) || null;\n }\n if (el.nodeType === 1 && win && win.getComputedStyle) {\n var selfCs = win.getComputedStyle(el);\n if (selfCs && (selfCs.visibility === \"hidden\" || selfCs.visibility === \"collapse\")) return \"visibility: \" + selfCs.visibility;\n if (selfCs && selfCs.display === \"contents\" && !hasVisibleDescendant(el, 0)) return \"display: contents with no visible children\";\n }\n if (!rect || rect.width <= 0 || rect.height <= 0) return \"bounding box has zero size (\" + (rect ? Math.round(rect.width) + \"x\" + Math.round(rect.height) : \"none\") + \")\";\n return null;\n }\n function toMatch(hit) {\n if (hit.wasmNode) {\n var wn = hit.wasmNode;\n var wr = hit.wasmRect;\n var wtext = (wn.text != null ? String(wn.text) : (wn.label != null ? String(wn.label) : \"\")).trim() || undefined;\n return {\n id: wn.testID || wn.id || undefined,\n tag: \"wasm-node\",\n role: wn.role || undefined,\n text: wtext,\n textContent: wtext,\n value: wn.value != null ? String(wn.value) : undefined,\n accessibilityLabel: wn.label || undefined,\n accessibleName: wn.label || wtext,\n rect: { x: wr.left, y: wr.top, width: wr.width, height: wr.height },\n scrollX: window.scrollX || 0,\n scrollY: window.scrollY || 0,\n devicePixelRatio: window.devicePixelRatio || 1,\n viewportWidth: window.innerWidth || 0,\n viewportHeight: window.innerHeight || 0,\n visible: wn.visible !== false && wr.width > 0 && wr.height > 0,\n enabled: wn.enabled !== false,\n clickable: wn.clickable !== undefined ? Boolean(wn.clickable) : (wn.role === \"button\" || wn.role === \"link\"),\n focused: wn.focused,\n checked: wn.checked,\n editable: wn.editable,\n empty: wn.value !== undefined ? String(wn.value).length === 0 : !wtext,\n attributes: wn.attributes || {},\n inShadowDom: false,\n inIframe: false\n };\n }\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var winForRect = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var styleForRect = winForRect && winForRect.getComputedStyle ? winForRect.getComputedStyle(el) : null;\n if (styleForRect && styleForRect.display === \"contents\") {\n var contentsRect = getContentsUnionRect(el, 0);\n if (contentsRect) rect = contentsRect;\n }\n var attrs = {};\n if (el.attributes) {\n for (var i = 0; i < el.attributes.length; i++) {\n attrs[el.attributes[i].name] = el.attributes[i].value;\n }\n }\n var tag = el.tagName ? el.tagName.toLowerCase() : undefined;\n var val = (el.tagName === \"INPUT\" || el.tagName === \"TEXTAREA\" || el.tagName === \"SELECT\")\n ? String(el.value ?? \"\")\n : undefined;\n var text = normWs(el.innerText || el.textContent || \"\") || undefined;\n var normTextContent = normWs(el.textContent || \"\") || undefined;\n var accName = getAccessibleName(el) || undefined;\n var accDesc = getAccessibleDescription(el) || undefined;\n var role = getImplicitRole(el) || undefined;\n var isEnabled = isElementEnabled(el);\n // An element inside a <label> (or the label itself) reports the checked state of the\n // label's control, Playwright's \"follow-label\" retargeting: check()/toBeChecked() on a\n // label verify the checkbox/radio it toggles.\n var checkSource = el;\n if (!el.isContentEditable && !(el.matches && el.matches(\"a, input, textarea, button, select, [role=link], [role=button], [role=checkbox], [role=switch], [role=radio]\"))) {\n var enclosingLabel = el.closest ? el.closest(\"label\") : null;\n if (enclosingLabel && enclosingLabel.control) checkSource = enclosingLabel.control;\n }\n var isChecked =\n checkSource.tagName === \"INPUT\" && (checkSource.type === \"checkbox\" || checkSource.type === \"radio\")\n ? Boolean(checkSource.checked)\n : el.getAttribute(\"aria-checked\") === \"true\"\n ? true\n : el.getAttribute(\"aria-checked\") === \"false\"\n ? false\n : undefined;\n var isEditable = Boolean(\n isEnabled &&\n !el.hasAttribute(\"readonly\") &&\n el.getAttribute(\"aria-readonly\") !== \"true\" &&\n (el.isContentEditable ||\n el.tagName === \"TEXTAREA\" ||\n el.tagName === \"SELECT\" ||\n (el.tagName === \"INPUT\" &&\n [\"button\", \"submit\", \"reset\", \"image\", \"hidden\", \"checkbox\", \"radio\"].indexOf(\n String(el.type || \"text\").toLowerCase(),\n ) === -1)),\n );\n var isEmpty =\n el.tagName === \"INPUT\" || el.tagName === \"TEXTAREA\"\n ? String(el.value || \"\").length === 0\n : (el.textContent || \"\").trim().length === 0;\n var clsName = typeof el.className === \"string\" ? el.className : (el.getAttribute(\"class\") || \"\");\n var sx = hit.scaleX != null ? hit.scaleX : 1;\n var sy = hit.scaleY != null ? hit.scaleY : 1;\n return {\n id: el.getAttribute(\"data-testid\") || el.getAttribute(\"testID\") || undefined,\n tag: tag,\n role: role,\n text: text,\n textContent: normTextContent,\n value: val,\n accessibilityLabel: el.getAttribute(\"aria-label\") || undefined,\n accessibleName: accName,\n accessibleDescription: accDesc,\n rect: { x: hit.offsetX + rect.x * sx, y: hit.offsetY + rect.y * sy, width: rect.width * sx, height: rect.height * sy },\n clickPoint: hit._clickPoint || undefined,\n scrollX: window.scrollX || window.pageXOffset || 0,\n scrollY: window.scrollY || window.pageYOffset || 0,\n devicePixelRatio: window.devicePixelRatio || 1,\n viewportWidth: (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0,\n viewportHeight: (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0,\n visible: isVisible(el, rect),\n transparent: isTransparent(el) || undefined,\n enabled: isEnabled,\n clickable: isClickable(el),\n focused: document.activeElement === el,\n checked: isChecked,\n editable: isEditable,\n empty: isEmpty,\n className: clsName || undefined,\n attributes: attrs,\n inShadowDom: hit.inShadow || undefined,\n inIframe: hit.inIframe || undefined\n };\n }\n\n\n function query(sel) {\n return findAcrossRoots(sel).map(toMatch);\n }\n\n function scrollIntoView(sel) {\n var hits = findAcrossRoots(sel);\n if (hits.length === 0) return null;\n var hit = hits[hits.length - 1];\n if (typeof hit.el.scrollIntoView === \"function\") {\n try { hit.el.scrollIntoView({ block: \"center\", inline: \"center\", behavior: \"instant\" }); }\n catch (e) { try { hit.el.scrollIntoView(true); } catch (e2) {} }\n }\n return toMatch(hit);\n }\n\n function tap(sel) {\n var hits = findAcrossRoots(sel, \"strict\");\n var usable = [];\n for (var i = 0; i < hits.length; i++) {\n var m = toMatch(hits[i]);\n if (m.visible && m.enabled) usable.push(hits[i]);\n }\n if (usable.length === 0) return false;\n var hit = usable[pickActionIndex(usable, function(h) { return h.el; })];\n var el = hit.el;\n if (typeof el.scrollIntoView === \"function\") {\n try { el.scrollIntoView({ block: \"center\", inline: \"center\", behavior: \"instant\" }); } catch (e) {}\n }\n if (!el.isConnected) return false;\n var postMatch = toMatch(hit);\n if (!postMatch.visible || !postMatch.enabled) return false;\n var rect = el.getBoundingClientRect();\n var cx = rect.left + rect.width / 2;\n var cy = rect.top + rect.height / 2;\n var init = { bubbles: true, cancelable: true, composed: true, clientX: cx, clientY: cy };\n try { el.dispatchEvent(new PointerEvent(\"pointerdown\", init)); } catch (e) {}\n try { el.dispatchEvent(new MouseEvent(\"mousedown\", init)); } catch (e) {}\n if (typeof el.focus === \"function\") { try { el.focus(); } catch (e) {} }\n try { el.dispatchEvent(new PointerEvent(\"pointerup\", init)); } catch (e) {}\n try { el.dispatchEvent(new MouseEvent(\"mouseup\", init)); } catch (e) {}\n if (typeof el.click === \"function\") { el.click(); }\n else { el.dispatchEvent(new MouseEvent(\"click\", init)); }\n return true;\n }\n\n function waitForSelector(sel, opts) {\n opts = opts || {};\n var timeoutMs = Math.max(10, Math.round(opts.timeoutMs != null ? opts.timeoutMs : 5000));\n var forAction = Boolean(opts.forAction);\n var force = Boolean(opts.force);\n var failFastWhenIdle = Boolean(opts.failFastWhenIdle);\n var idleQuietMs = Math.max(50, Math.round(opts.idleQuietMs != null ? opts.idleQuietMs : 250));\n var reqStableFrames = force ? 0 : (opts.stableFrames !== undefined ? Math.max(0, Math.round(opts.stableFrames)) : (forAction ? 2 : 0));\n var checkHitTest = force ? false : (opts.checkHitTest !== undefined ? Boolean(opts.checkHitTest) : forAction);\n var waitForAppReady = opts.waitForAppReady !== undefined ? Boolean(opts.waitForAppReady) : true;\n var armTapGuard = Boolean(opts.armTapGuard && forAction && !force);\n if (failFastWhenIdle && !opts.hostTracksNetwork) ensureNetworkTracker();\n var instantAnim = Boolean(typeof document !== \"undefined\" && document.getElementById && document.getElementById(\"__spana_instant_anim\"));\n var explicitStableFrames = (instantAnim || force) ? 0 : reqStableFrames;\n\n function armTapGuardOnEl(el) {\n if (!armTapGuard || !el || el.nodeType !== 1) return;\n try {\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var doc = el.ownerDocument || document;\n if (window.__spanaTapGuardCleanup) window.__spanaTapGuardCleanup();\n window.__spanaTapMissed = false;\n var matchTarget = function(t) {\n return isSameOrDescendant(el, t);\n };\n var cleanup = function() {\n win.removeEventListener(\"pointerdown\", onEvt, true);\n win.removeEventListener(\"mousedown\", onEvt, true);\n win.removeEventListener(\"mouseup\", onMouseUp, true);\n win.removeEventListener(\"click\", onEvt, true);\n if (window.__spanaTapGuardCleanup === cleanup) delete window.__spanaTapGuardCleanup;\n };\n var onMouseUp = function(e) {\n if (!e.isTrusted) return;\n Promise.resolve().then(cleanup);\n };\n var onEvt = function(e) {\n if (!e.isTrusted) return;\n var hit = deepElementFromPoint(doc, e.clientX, e.clientY) || e.target;\n if (!matchTarget(hit) && !matchTarget(e.target)) {\n e.stopImmediatePropagation();\n e.preventDefault();\n window.__spanaTapMissed = true;\n if (e.type === \"click\") cleanup();\n } else if (e.type === \"click\") {\n cleanup();\n }\n };\n win.addEventListener(\"pointerdown\", onEvt, true);\n win.addEventListener(\"mousedown\", onEvt, true);\n win.addEventListener(\"mouseup\", onMouseUp, true);\n win.addEventListener(\"click\", onEvt, true);\n window.__spanaTapGuardCleanup = cleanup;\n } catch (e) {}\n }\n\n function recordActionFailure(reason) {\n if (!forAction) return;\n try { window.__spanaLastActionDiag = reason; } catch (e) {}\n }\n\n function findCandidates() {\n if (waitForAppReady && !isAppReady()) { recordActionFailure(\"waiting for app ready (__SPANA_APP_READY__)\"); return null; }\n if (forAction && !force && hasActiveViewTransition()) { recordActionFailure(\"active CSS view transition in progress\"); return null; }\n var rawHits = findAcrossRoots(sel, \"strict\");\n if (rawHits.length === 0) { recordActionFailure(null); return null; }\n var ready = [];\n var lastFail = null;\n for (var i = 0; i < rawHits.length; i++) {\n var h = rawHits[i];\n var m = toMatch(h);\n if (!m.visible) { lastFail = getVisibilityFailureReason(h.el, h.el && h.el.getBoundingClientRect ? h.el.getBoundingClientRect() : null) || \"not visible\"; continue; }\n if (forAction && !force && !m.enabled) { lastFail = \"element is disabled\"; continue; }\n ready.push({ hit: h, match: m });\n }\n if (ready.length === 0) recordActionFailure(lastFail);\n return ready.length > 0 ? ready : null;\n }\n\n function checkActionableNow() {\n var ready = findCandidates();\n if (!ready) return null;\n if (!forAction) return ready.map(function(r) { return r.match; });\n var target = ready.length > 1 ? ready[pickActionIndex(ready, function(r) { return r.hit.el; })] : ready[0];\n var alreadyInViewport = isFullyInViewport(target.hit);\n var didScroll = alreadyInViewport ? false : ensureInViewport(target.hit);\n if (!force && checkHitTest && !isHitTestClear(target.hit)) {\n if (!alreadyInViewport || canScrollToUnobscure(target.hit)) {\n if (scrollToUnobscure(target.hit)) {\n didScroll = true;\n }\n if (!target.hit.el.isConnected) { recordActionFailure(\"element detached from DOM after scrolling\"); return null; }\n }\n if (!isHitTestClear(target.hit)) {\n var blocker = getHitTestBlocker(target.hit);\n recordActionFailure(blocker ? (\"hit-test blocked by \" + blocker) : \"hit-test failed (element not receiving pointer events at click point)\");\n return null;\n }\n }\n var updated = toMatch(target.hit);\n if (!updated.visible) { recordActionFailure(\"element became hidden after scroll\"); return null; }\n if (!force && !updated.enabled) { recordActionFailure(\"element became disabled\"); return null; }\n recordActionFailure(null);\n return { hits: ready, target: target, match: updated, didScroll: didScroll };\n }\n\n function neededStableFrames(candidate) {\n if (force || !forAction || typeof requestAnimationFrame !== \"function\") return 0;\n if (explicitStableFrames >= 0) return explicitStableFrames;\n if (hasActiveAnimation(candidate.target.hit.el)) return 2;\n if (candidate.didScroll) return 1;\n return 0;\n }\n\n var imm = checkActionableNow();\n if (imm) {\n if (!forAction) return imm;\n if (neededStableFrames(imm) <= 0) {\n armTapGuardOnEl(imm.target.hit.el);\n return [imm.match];\n }\n }\n\n return new Promise(function(resolve) {\n var done = false;\n var observer = null;\n var timeoutTimer = null;\n var fallbackInterval = null;\n var idleTimer = null;\n var rafId = null;\n var checkingStability = false;\n\n function finish(result) {\n if (done) return;\n done = true;\n if (observer) { try { observer.disconnect(); } catch (e) {} }\n if (timeoutTimer) clearTimeout(timeoutTimer);\n if (fallbackInterval) clearInterval(fallbackInterval);\n if (idleTimer) clearTimeout(idleTimer);\n if (rafId !== null && typeof cancelAnimationFrame === \"function\") {\n try { cancelAnimationFrame(rafId); } catch (e) {}\n }\n resolve(result);\n }\n\n function armIdleTimer() {\n if (!failFastWhenIdle) return;\n if (idleTimer) clearTimeout(idleTimer);\n idleTimer = setTimeout(function() {\n var rootEl = document.body || document.documentElement;\n if (\n document.readyState === \"complete\" &&\n (!waitForAppReady || isAppReady()) &&\n !hasActiveAnimation(rootEl) &&\n !hasInflightNetwork(idleQuietMs)\n ) {\n var hit = checkActionableNow();\n if (hit && forAction) armTapGuardOnEl(hit.target.hit.el);\n finish(hit ? (forAction ? [hit.match] : hit) : []);\n } else {\n armIdleTimer();\n }\n }, idleQuietMs);\n }\n\n function verifyStability(candidate) {\n if (done || checkingStability) return;\n var framesToWait = neededStableFrames(candidate);\n if (!forAction || framesToWait <= 0 || typeof requestAnimationFrame !== \"function\") {\n if (forAction) armTapGuardOnEl(candidate.target.hit.el);\n finish(forAction ? [candidate.match] : candidate);\n return;\n }\n checkingStability = true;\n var el = candidate.target.hit.el;\n var lastRect = candidate.match.rect;\n var remainingFrames = framesToWait;\n\n function step() {\n if (done) return;\n if (!el.isConnected) { checkingStability = false; scheduleAttempt(); return; }\n if (checkHitTest && !isHitTestClear(candidate.target.hit)) { checkingStability = false; scheduleAttempt(); return; }\n var cur = toMatch(candidate.target.hit);\n if (!cur.visible || !cur.enabled) { checkingStability = false; scheduleAttempt(); return; }\n var dx = Math.abs(cur.rect.x - lastRect.x);\n var dy = Math.abs(cur.rect.y - lastRect.y);\n var dw = Math.abs(cur.rect.width - lastRect.width);\n var dh = Math.abs(cur.rect.height - lastRect.height);\n if (dx <= 1 && dy <= 1 && dw <= 1 && dh <= 1) {\n remainingFrames -= 1;\n if (remainingFrames <= 0) { armTapGuardOnEl(el); finish([cur]); return; }\n } else {\n recordActionFailure(\"element bounding box unstable (still moving)\");\n remainingFrames = framesToWait;\n lastRect = cur.rect;\n }\n rafId = requestAnimationFrame(step);\n }\n rafId = requestAnimationFrame(step);\n }\n\n function attempt() {\n if (done || checkingStability) return;\n var hit = checkActionableNow();\n if (hit) {\n if (forAction) verifyStability(hit);\n else finish(hit);\n return;\n }\n }\n\n var scheduled = false;\n function scheduleAttempt() {\n if (done || checkingStability) return;\n armIdleTimer();\n if (scheduled) return;\n scheduled = true;\n Promise.resolve().then(function() { scheduled = false; attempt(); });\n }\n\n timeoutTimer = setTimeout(function() {\n var finalHit = checkActionableNow();\n if (finalHit && forAction) armTapGuardOnEl(finalHit.target.hit.el);\n finish(finalHit ? (forAction ? [finalHit.match] : finalHit) : []);\n }, timeoutMs);\n fallbackInterval = setInterval(attempt, forAction ? 40 : 120);\n if (typeof MutationObserver !== \"undefined\") {\n var root = document.documentElement || document.body || document;\n if (root) {\n observer = new MutationObserver(scheduleAttempt);\n observer.observe(root, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n }\n armIdleTimer();\n attempt();\n });\n }\n\n function waitForHidden(sel, opts) {\n opts = opts || {};\n var timeoutMs = Math.max(10, Math.round(opts.timeoutMs != null ? opts.timeoutMs : 5000));\n function isHiddenNow() {\n var hits = findAcrossRoots(sel, false);\n for (var i = 0; i < hits.length; i++) {\n if (toMatch(hits[i]).visible) return false;\n }\n return true;\n }\n if (isHiddenNow()) return true;\n return new Promise(function(resolve) {\n var done = false;\n var observer = null;\n var timeoutTimer = null;\n var fallbackInterval = null;\n function finish(val) {\n if (done) return;\n done = true;\n if (observer) { try { observer.disconnect(); } catch (e) {} }\n if (timeoutTimer) clearTimeout(timeoutTimer);\n if (fallbackInterval) clearInterval(fallbackInterval);\n resolve(val);\n }\n function onChange() { if (isHiddenNow()) finish(true); }\n timeoutTimer = setTimeout(function() { finish(isHiddenNow()); }, timeoutMs);\n fallbackInterval = setInterval(onChange, 120);\n if (typeof MutationObserver !== \"undefined\") {\n var root = document.documentElement || document.body || document;\n if (root) {\n observer = new MutationObserver(onChange);\n observer.observe(root, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n }\n });\n }\n\n function waitForMatch(sel, opts) {\n opts = opts || {};\n var timeoutMs = Math.max(10, Math.round(opts.timeoutMs != null ? opts.timeoutMs : 5000));\n var kind = opts.kind;\n var expected = opts.expected !== undefined ? opts.expected : null;\n var expectedCount = opts.expectedCount !== undefined ? opts.expectedCount : null;\n var viewportRatio = opts.viewportRatio || 0;\n var attributeName = opts.attributeName !== undefined ? opts.attributeName : null;\n var cssProperty = opts.cssProperty !== undefined ? opts.cssProperty : null;\n var patternSource = opts.patternSource !== undefined ? opts.patternSource : null;\n var patternFlags = opts.patternFlags || \"\";\n var negate = Boolean(opts.negate);\n var visibleOnly = Boolean(opts.visibleOnly);\n var ignoreCase = Boolean(opts.ignoreCase);\n var propertyName = opts.propertyName !== undefined ? opts.propertyName : null;\n var expectedValue = opts.expectedValue !== undefined ? opts.expectedValue : null;\n var lastActual = undefined;\n var regex = patternSource !== null ? new RegExp(patternSource, patternFlags) : null;\n var allowHidden = kind === \"text\" || kind === \"containsText\" || kind === \"matchesText\" || kind === \"value\" || kind === \"attribute\" || kind === \"attached\" || kind === \"jsProperty\";\n\n function evaluateMatch() {\n if (kind === \"url\") {\n var href = typeof window !== \"undefined\" && window.location ? String(window.location.href || \"\") : \"\";\n lastActual = href;\n var urlOk = regex\n ? regex.test(href)\n : (expected !== null && (href === expected || href.indexOf(String(expected)) !== -1));\n if (negate ? !urlOk : urlOk) return { matched: true, actual: href };\n return null;\n }\n if (kind === \"title\") {\n var docTitle = String(typeof document !== \"undefined\" ? (document.title || \"\") : \"\");\n lastActual = docTitle;\n var titleOk = regex ? regex.test(docTitle) : (expected !== null && docTitle === String(expected));\n if (negate ? !titleOk : titleOk) return { matched: true, actual: docTitle };\n return null;\n }\n\n var pvMode = (kind === \"attached\" || (kind === \"count\" && !visibleOnly)) ? false : (visibleOnly ? \"strict\" : \"prefer\");\n var hits = findAcrossRoots(sel, pvMode);\n\n if (kind === \"count\") {\n var matchedCount = 0;\n if (visibleOnly) {\n for (var ci = 0; ci < hits.length; ci++) {\n if (toMatch(hits[ci]).visible) matchedCount++;\n }\n } else {\n matchedCount = hits.length;\n }\n lastActual = String(matchedCount);\n var countOk = expectedCount !== null && matchedCount === expectedCount;\n if (negate ? !countOk : countOk) {\n return { matched: true, actual: String(matchedCount) };\n }\n return null;\n }\n if (kind === \"attached\") {\n var isAttached = hits.length > 0;\n lastActual = isAttached ? \"attached\" : \"detached\";\n if (negate ? !isAttached : isAttached) return { matched: true, actual: lastActual };\n return null;\n }\n\n var anyVisible2 = false;\n var hiddenFallback2 = [];\n var checkMatch2 = function(h, m) {\n var matched = false;\n var actualVal = undefined;\n if (kind === \"text\") {\n var normTxt = normWs(m.textContent !== undefined ? m.textContent : (m.text || \"\"));\n actualVal = normTxt;\n matched = normTxt === (expected !== null ? normWs(expected) : expected);\n } else if (kind === \"containsText\") {\n var actual = normWs(m.textContent !== undefined ? m.textContent : (m.text || \"\"));\n actualVal = actual;\n var needle = expected !== null ? normWs(expected) : \"\";\n matched = expected !== null && (ignoreCase\n ? actual.toLowerCase().indexOf(needle.toLowerCase()) !== -1\n : actual.indexOf(needle) !== -1);\n } else if (kind === \"matchesText\") {\n var rawRe2 = m.textContent !== undefined ? m.textContent : (m.text || \"\");\n var actualRe = normWs(rawRe2);\n actualVal = actualRe;\n matched = Boolean(regex && (regex.test(rawRe2) || regex.test(actualRe)));\n } else if (kind === \"value\") {\n var val = m.value !== undefined ? m.value : \"\";\n actualVal = val;\n matched = regex ? regex.test(val) : (val === expected);\n } else if (kind === \"attribute\" && attributeName !== null) {\n var attrVal = m.attributes ? m.attributes[attributeName] : undefined;\n actualVal = attrVal;\n matched = regex\n ? (attrVal !== undefined && regex.test(attrVal))\n : (expected === null ? attrVal !== undefined : attrVal === expected);\n } else if (kind === \"accessibilityLabel\") {\n var lbl = m.accessibilityLabel;\n actualVal = lbl;\n matched = expected === null ? (lbl !== undefined && lbl.length > 0) : lbl === expected;\n } else if (kind === \"accessibleName\") {\n var accName = normWs(m.accessibleName || m.accessibilityLabel || m.text || \"\");\n actualVal = accName;\n matched = regex ? (regex.test(m.accessibleName || m.accessibilityLabel || m.text || \"\") || regex.test(accName)) : (expected === null ? accName.length > 0 : accName === normWs(expected));\n } else if (kind === \"accessibleDescription\") {\n var accDesc = normWs(m.accessibleDescription || \"\");\n actualVal = accDesc;\n matched = regex ? (regex.test(m.accessibleDescription || \"\") || regex.test(accDesc)) : (expected === null ? accDesc.length > 0 : accDesc === normWs(expected));\n } else if (kind === \"focused\") {\n actualVal = m.focused ? \"focused\" : \"not focused\";\n matched = Boolean(m.focused);\n } else if (kind === \"checked\") {\n actualVal = m.checked ? \"checked\" : \"unchecked\";\n matched = Boolean(m.checked);\n } else if (kind === \"enabled\") {\n var isEn2 = m.enabled !== false;\n actualVal = isEn2 ? \"enabled\" : \"disabled\";\n matched = isEn2;\n } else if (kind === \"role\") {\n var elRole2 = m.role || getImplicitRole(h.el) || \"generic\";\n actualVal = elRole2;\n matched = expected !== null && elRole2.toLowerCase() === String(expected).toLowerCase();\n } else if (kind === \"editable\") {\n actualVal = m.editable ? \"editable\" : \"not editable\";\n matched = Boolean(m.editable);\n } else if (kind === \"empty\") {\n actualVal = m.empty ? \"empty\" : (m.value || m.textContent || \"non-empty\");\n matched = Boolean(m.empty);\n } else if (kind === \"inViewport\") {\n var vpW = window.innerWidth || document.documentElement.clientWidth || 0;\n var vpH = window.innerHeight || document.documentElement.clientHeight || 0;\n var r = m.rect;\n var visW = Math.min(r.x + r.width, vpW) - Math.max(r.x, 0);\n var visH = Math.min(r.y + r.height, vpH) - Math.max(r.y, 0);\n var vpShare = r.width > 0 && r.height > 0 && visW > 0 && visH > 0 ? (visW * visH) / (r.width * r.height) : 0;\n var inVp = viewportRatio > 0 ? vpShare > viewportRatio - 1e-9 : vpShare > 0;\n actualVal = vpShare > 0 ? (Math.round(vpShare * 100) + \"% in viewport\") : \"outside viewport\";\n matched = inVp;\n } else if (kind === \"jsProperty\" && propertyName !== null) {\n var propNode = h.el;\n var rawProp = propNode ? propNode[propertyName] : undefined;\n actualVal = typeof rawProp === \"string\" ? rawProp : JSON.stringify(rawProp);\n matched = JSON.stringify(rawProp) === JSON.stringify(expectedValue);\n } else if (kind === \"class\") {\n var cls = m.className || \"\";\n actualVal = cls;\n if (regex) {\n matched = regex.test(cls);\n } else if (expected !== null) {\n var tokens = cls.trim().split(/\\s+/).filter(Boolean);\n var expectedTokens = String(expected).trim().split(/\\s+/).filter(Boolean);\n matched = expectedTokens.length > 0 && expectedTokens.every(function(tok) { return tokens.indexOf(tok) !== -1; });\n }\n } else if (kind === \"css\" && cssProperty !== null) {\n var elNode = h.el;\n var winObj = (elNode.ownerDocument && elNode.ownerDocument.defaultView) || window;\n var cssVal = winObj && winObj.getComputedStyle ? winObj.getComputedStyle(elNode).getPropertyValue(cssProperty).trim() : \"\";\n actualVal = cssVal;\n matched = regex ? regex.test(cssVal) : (expected !== null && cssVal === String(expected).trim());\n }\n lastActual = actualVal;\n if (negate ? !matched : matched) return { matched: true, actual: actualVal };\n return null;\n };\n for (var i = hits.length - 1; i >= 0; i--) {\n var m = toMatch(hits[i]);\n if (!allowHidden && !m.visible) {\n if (kind === \"enabled\" || kind === \"checked\") hiddenFallback2.push({ h: hits[i], m: m });\n continue;\n }\n if (m.visible) anyVisible2 = true;\n var resHit2 = checkMatch2(hits[i], m);\n if (resHit2) return resHit2;\n }\n if (!anyVisible2 && hiddenFallback2.length > 0) {\n for (var hi2 = 0; hi2 < hiddenFallback2.length; hi2++) {\n var hRes2 = checkMatch2(hiddenFallback2[hi2].h, hiddenFallback2[hi2].m);\n if (hRes2) return hRes2;\n }\n }\n return null;\n }\n\n var immediate = evaluateMatch();\n if (immediate) return immediate;\n\n return new Promise(function(resolve) {\n var done = false;\n var observer = null;\n var timeoutTimer = null;\n var fallbackInterval = null;\n var scheduled = false;\n function finish(res) {\n if (done) return;\n done = true;\n if (observer) { try { observer.disconnect(); } catch (e) {} }\n if (timeoutTimer) clearTimeout(timeoutTimer);\n if (fallbackInterval) clearInterval(fallbackInterval);\n if (typeof document !== \"undefined\") {\n document.removeEventListener(\"input\", onChange, true);\n document.removeEventListener(\"change\", onChange, true);\n document.removeEventListener(\"focusin\", onChange, true);\n document.removeEventListener(\"focusout\", onChange, true);\n }\n if (typeof window !== \"undefined\") {\n window.removeEventListener(\"popstate\", onChange);\n window.removeEventListener(\"hashchange\", onChange);\n }\n resolve(res);\n }\n function onChange() {\n if (done || scheduled) return;\n scheduled = true;\n Promise.resolve().then(function() {\n scheduled = false;\n if (done) return;\n var res = evaluateMatch();\n if (res) finish(res);\n });\n }\n timeoutTimer = setTimeout(function() {\n var finalRes = evaluateMatch();\n finish(finalRes || { matched: false, actual: lastActual });\n }, timeoutMs);\n fallbackInterval = setInterval(onChange, kind === \"url\" ? 50 : 120);\n if (typeof document !== \"undefined\") {\n document.addEventListener(\"input\", onChange, true);\n document.addEventListener(\"change\", onChange, true);\n document.addEventListener(\"focusin\", onChange, true);\n document.addEventListener(\"focusout\", onChange, true);\n }\n if (typeof window !== \"undefined\") {\n window.addEventListener(\"popstate\", onChange);\n window.addEventListener(\"hashchange\", onChange);\n }\n if (typeof MutationObserver !== \"undefined\") {\n var root = document.documentElement || document.body || document;\n if (root) {\n observer = new MutationObserver(onChange);\n observer.observe(root, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n }\n });\n }\n\n function fill(sel, val, opts) {\n opts = opts || {};\n var timeoutMs = Math.max(10, Math.round(opts.timeoutMs != null ? opts.timeoutMs : 5000));\n var checkHitTest = opts.checkHitTest !== undefined ? Boolean(opts.checkHitTest) : true;\n var verifyDelayMs = opts.verifyDelayMs !== undefined ? Math.max(0, Math.round(opts.verifyDelayMs)) : 12;\n function writeValue(el) {\n if (el.isContentEditable) return false;\n if (typeof el.focus === \"function\") { try { el.focus(); } catch (e) {} }\n var tag = el.tagName;\n if (tag === \"INPUT\" || tag === \"TEXTAREA\") {\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var proto = tag === \"TEXTAREA\"\n ? (win.HTMLTextAreaElement && win.HTMLTextAreaElement.prototype)\n : (win.HTMLInputElement && win.HTMLInputElement.prototype);\n var desc = proto ? Object.getOwnPropertyDescriptor(proto, \"value\") : null;\n if (desc && typeof desc.set === \"function\") {\n try { desc.set.call(el, val); } catch (e) { el.value = val; }\n }\n else el.value = val;\n if (el._valueTracker && typeof el._valueTracker.setValue === \"function\") {\n try { el._valueTracker.setValue(val === \"\" ? \" \" : \"\"); } catch (e) {}\n }\n } else if (tag === \"SELECT\") {\n el.value = val;\n } else {\n el.value = val;\n }\n try { el.dispatchEvent(new InputEvent(\"input\", { bubbles: true, cancelable: true, data: val, inputType: \"insertText\" })); }\n catch (e) { el.dispatchEvent(new Event(\"input\", { bubbles: true, cancelable: true })); }\n el.dispatchEvent(new Event(\"change\", { bubbles: true, cancelable: true }));\n return true;\n }\n function findEditableNow() {\n if (!isAppReady()) return null;\n var hits = findAcrossRoots(sel, \"strict\");\n for (var i = hits.length - 1; i >= 0; i--) {\n var h = hits[i];\n var m = toMatch(h);\n if (!m.visible || !m.enabled) continue;\n var alreadyInVp = isFullyInViewport(h);\n if (!alreadyInVp) ensureInViewport(h);\n if (checkHitTest && !isHitTestClear(h)) {\n if (!alreadyInVp || canScrollToUnobscure(h)) scrollToUnobscure(h);\n if (!h.el.isConnected || !isHitTestClear(h)) continue;\n }\n return h.el;\n }\n return null;\n }\n function verifyAndRetryFill(attemptsLeft) {\n var el = findEditableNow();\n if (!el || el.isContentEditable) return Promise.resolve(false);\n if (!writeValue(el)) return Promise.resolve(false);\n if (verifyDelayMs <= 0) {\n var syncLatest = findEditableNow() || el;\n if (syncLatest && syncLatest.isConnected && String(syncLatest.value == null ? \"\" : syncLatest.value) === val) {\n return Promise.resolve(true);\n }\n return attemptsLeft > 1 ? verifyAndRetryFill(attemptsLeft - 1) : Promise.resolve(false);\n }\n return new Promise(function(resolve) {\n setTimeout(function() {\n var latest = findEditableNow() || el;\n if (latest && latest.isConnected && String(latest.value == null ? \"\" : latest.value) === val) {\n resolve(true);\n return;\n }\n if (attemptsLeft > 1) {\n verifyAndRetryFill(attemptsLeft - 1).then(resolve);\n } else {\n resolve(false);\n }\n }, verifyDelayMs);\n });\n }\n var immEl = findEditableNow();\n if (immEl) {\n if (immEl.isContentEditable) return false;\n return verifyAndRetryFill(3);\n }\n return new Promise(function(resolve) {\n var done = false;\n var observer = null;\n var timeoutTimer = null;\n var fallbackInterval = null;\n var scheduled = false;\n var filling = false;\n function finish(ok) {\n if (done) return;\n done = true;\n if (observer) { try { observer.disconnect(); } catch (e) {} }\n if (timeoutTimer) clearTimeout(timeoutTimer);\n if (fallbackInterval) clearInterval(fallbackInterval);\n resolve(ok);\n }\n function onChange() {\n if (done || scheduled || filling) return;\n scheduled = true;\n Promise.resolve().then(function() {\n scheduled = false;\n if (done || filling) return;\n var target = findEditableNow();\n if (!target) return;\n if (target.isContentEditable) { finish(false); return; }\n filling = true;\n verifyAndRetryFill(3).then(function(ok) { finish(ok); });\n });\n }\n timeoutTimer = setTimeout(function() {\n if (filling) return;\n var target = findEditableNow();\n if (!target || target.isContentEditable) { finish(false); return; }\n filling = true;\n verifyAndRetryFill(2).then(function(ok) { finish(ok); });\n }, timeoutMs);\n fallbackInterval = setInterval(onChange, 40);\n if (typeof MutationObserver !== \"undefined\") {\n var root = document.documentElement || document.body || document;\n if (root) {\n observer = new MutationObserver(onChange);\n observer.observe(root, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n }\n });\n }\n\n function checkTapGuard() {\n var m = Boolean(window.__spanaTapMissed);\n if (window.__spanaTapGuardCleanup) window.__spanaTapGuardCleanup();\n delete window.__spanaTapMissed;\n return m;\n }\n\n window.__spanaRt = {\n query: query,\n scrollIntoView: scrollIntoView,\n tap: tap,\n waitForSelector: waitForSelector,\n waitForHidden: waitForHidden,\n waitForMatch: waitForMatch,\n fill: fill,\n checkTapGuard: checkTapGuard\n };\n return true;\n})();";
276
- export type InjectedRuntimeMethod = "query" | "scrollIntoView" | "tap" | "waitForSelector" | "waitForHidden" | "waitForMatch" | "fill";
285
+ export declare const SPANA_INJECTED_RUNTIME_SCRIPT = "(function() {\n if (typeof window === \"undefined\") return true;\n (function() {\n if (typeof globalThis === \"undefined\" || globalThis.__spanaWasm) return;\n var state = {\n moduleCount: 0,\n pendingCount: 0,\n peakWasmMemoryBytes: 0,\n modules: [],\n memories: [],\n traps: []\n };\n var nextId = 1;\n var WASM_RE = /(WebAssembly\\.(RuntimeError|CompileError|LinkError)|wasm-function\\[|memory access out of bounds|table index is out of bounds|integer divide by zero|unreachable|indirect call type mismatch|out of bounds memory access)/i;\n\n function trackMemory(mem) {\n if (!mem || typeof mem !== \"object\" || !(mem.buffer instanceof ArrayBuffer || (typeof SharedArrayBuffer !== \"undefined\" && mem.buffer instanceof SharedArrayBuffer))) {\n return;\n }\n var already = false;\n var alive = [];\n for (var i = 0; i < state.memories.length; i++) {\n var ref = state.memories[i];\n var cur = typeof ref.deref === \"function\" ? ref.deref() : ref;\n if (!cur) continue;\n if (cur === mem) already = true;\n alive.push(ref);\n }\n if (!already) {\n alive.push(typeof WeakRef !== \"undefined\" ? new WeakRef(mem) : mem);\n }\n state.memories = alive;\n computeMemoryBytes();\n }\n\n function computeMemoryBytes() {\n var total = 0;\n var alive = [];\n for (var i = 0; i < state.memories.length; i++) {\n var ref = state.memories[i];\n var cur = typeof ref.deref === \"function\" ? ref.deref() : ref;\n if (!cur) continue;\n alive.push(ref);\n try {\n total += cur.buffer ? cur.buffer.byteLength : 0;\n } catch (e) {}\n }\n state.memories = alive;\n if (total > state.peakWasmMemoryBytes) state.peakWasmMemoryBytes = total;\n return total;\n }\n\n function trackExports(instance) {\n if (!instance || !instance.exports) return { bytes: 0, pages: 0 };\n var bytes = 0;\n try {\n var keys = Object.keys(instance.exports);\n for (var i = 0; i < keys.length; i++) {\n var val = instance.exports[keys[i]];\n if (typeof WebAssembly !== \"undefined\" && typeof WebAssembly.Memory === \"function\" && val instanceof WebAssembly.Memory) {\n trackMemory(val);\n try { bytes += val.buffer.byteLength; } catch (e) {}\n }\n }\n } catch (e) {}\n return { bytes: bytes, pages: Math.round(bytes / 65536) };\n }\n\n function recordTrap(name, message, stack) {\n var combined = String(name || \"\") + \" \" + String(message || \"\") + \" \" + String(stack || \"\");\n if (!WASM_RE.test(combined)) return;\n state.traps.push({\n name: String(name || \"WebAssembly.RuntimeError\"),\n message: String(message || \"WebAssembly trap\"),\n source: typeof window === \"undefined\" ? \"worker\" : \"main\",\n stack: stack ? String(stack) : undefined,\n timestamp: Date.now()\n });\n if (state.traps.length > 100) state.traps.shift();\n }\n\n function getSizeBytes(src) {\n if (!src) return undefined;\n if (typeof src.byteLength === \"number\") return src.byteLength;\n return undefined;\n }\n\n if (typeof WebAssembly !== \"undefined\") {\n var origInstantiate = WebAssembly.instantiate;\n if (typeof origInstantiate === \"function\") {\n WebAssembly.instantiate = function(source, importObject) {\n state.pendingCount += 1;\n var t0 = typeof performance !== \"undefined\" ? performance.now() : Date.now();\n var sizeBytes = getSizeBytes(source);\n return Promise.resolve(origInstantiate.apply(WebAssembly, arguments)).then(\n function(res) {\n state.pendingCount = Math.max(0, state.pendingCount - 1);\n state.moduleCount += 1;\n var inst = res && res.instance ? res.instance : res;\n var memInfo = trackExports(inst);\n var elapsed = Math.round((typeof performance !== \"undefined\" ? performance.now() : Date.now()) - t0);\n state.modules.push({\n id: nextId++,\n sizeBytes: sizeBytes,\n instantiateMs: elapsed,\n memoryBytes: memInfo.bytes || undefined,\n memoryPages: memInfo.pages || undefined,\n instantiatedAt: Date.now()\n });\n return res;\n },\n function(err) {\n state.pendingCount = Math.max(0, state.pendingCount - 1);\n recordTrap(err && err.name, err && err.message ? err.message : String(err), err && err.stack);\n throw err;\n }\n );\n };\n }\n\n var origInstantiateStreaming = WebAssembly.instantiateStreaming;\n if (typeof origInstantiateStreaming === \"function\") {\n WebAssembly.instantiateStreaming = function(source, importObject) {\n state.pendingCount += 1;\n var t0 = typeof performance !== \"undefined\" ? performance.now() : Date.now();\n return Promise.resolve(origInstantiateStreaming.apply(WebAssembly, arguments)).then(\n function(res) {\n state.pendingCount = Math.max(0, state.pendingCount - 1);\n state.moduleCount += 1;\n var inst = res && res.instance ? res.instance : res;\n var memInfo = trackExports(inst);\n var elapsed = Math.round((typeof performance !== \"undefined\" ? performance.now() : Date.now()) - t0);\n state.modules.push({\n id: nextId++,\n instantiateMs: elapsed,\n memoryBytes: memInfo.bytes || undefined,\n memoryPages: memInfo.pages || undefined,\n instantiatedAt: Date.now()\n });\n return res;\n },\n function(err) {\n state.pendingCount = Math.max(0, state.pendingCount - 1);\n recordTrap(err && err.name, err && err.message ? err.message : String(err), err && err.stack);\n throw err;\n }\n );\n };\n }\n\n var OrigMemory = WebAssembly.Memory;\n if (typeof OrigMemory === \"function\") {\n try {\n var WrappedMemory = new Proxy(OrigMemory, {\n construct: function(target, args, newTarget) {\n var mem = Reflect.construct(target, args, newTarget);\n trackMemory(mem);\n return mem;\n }\n });\n WebAssembly.Memory = WrappedMemory;\n } catch (e) {}\n }\n\n var OrigInstance = WebAssembly.Instance;\n if (typeof OrigInstance === \"function\") {\n try {\n var WrappedInstance = new Proxy(OrigInstance, {\n construct: function(target, args, newTarget) {\n var t0 = typeof performance !== \"undefined\" ? performance.now() : Date.now();\n var inst = Reflect.construct(target, args, newTarget);\n state.moduleCount += 1;\n var memInfo = trackExports(inst);\n state.modules.push({\n id: nextId++,\n instantiateMs: Math.round((typeof performance !== \"undefined\" ? performance.now() : Date.now()) - t0),\n memoryBytes: memInfo.bytes || undefined,\n memoryPages: memInfo.pages || undefined,\n instantiatedAt: Date.now()\n });\n return inst;\n }\n });\n WebAssembly.Instance = WrappedInstance;\n } catch (e) {}\n }\n }\n\n if (typeof globalThis.addEventListener === \"function\") {\n globalThis.addEventListener(\"error\", function(ev) {\n var err = ev && ev.error;\n recordTrap(err && err.name, (err && err.message) || (ev && ev.message), err && err.stack);\n });\n globalThis.addEventListener(\"unhandledrejection\", function(ev) {\n var reason = ev && ev.reason;\n recordTrap(reason && reason.name, reason && reason.message ? reason.message : String(reason), reason && reason.stack);\n });\n }\n\n globalThis.__spanaWasm = {\n trackMemory: trackMemory,\n recordTrap: recordTrap,\n getMetrics: function() {\n var bytes = computeMemoryBytes();\n var perfMem = typeof performance !== \"undefined\" && performance.memory ? performance.memory : null;\n return {\n moduleCount: state.moduleCount,\n pendingCount: state.pendingCount,\n wasmMemoryBytes: bytes,\n wasmMemoryPages: Math.round(bytes / 65536),\n peakWasmMemoryBytes: state.peakWasmMemoryBytes,\n jsHeapUsedBytes: perfMem ? perfMem.usedJSHeapSize : undefined,\n jsHeapTotalBytes: perfMem ? perfMem.totalJSHeapSize : undefined,\n crossOriginIsolated: Boolean(globalThis.crossOriginIsolated),\n sharedArrayBufferAvailable: typeof SharedArrayBuffer !== \"undefined\",\n traps: state.traps.slice(),\n modules: state.modules.slice()\n };\n },\n isReady: function(minModules) {\n var req = typeof minModules === \"number\" ? minModules : 1;\n var explicit = globalThis.__SPANA_WASM_READY__;\n if (typeof explicit === \"function\") {\n try { if (!explicit()) return false; } catch (e) { return false; }\n } else if (explicit === false) {\n return false;\n }\n return state.pendingCount === 0 && (state.moduleCount >= req || explicit === true);\n }\n };\n})();\n if (window.__spanaRt) return true;\n \n function normWs(val) {\n return String(val == null ? \"\" : val).replace(/[\\s\\u00a0\\u202f]+/g, \" \").trim();\n }\n function matchSpec(actual, spec, exact) {\n var raw = String(actual || \"\");\n var str = normWs(raw);\n if (spec && typeof spec === \"object\" && typeof spec.__spanaRegex === \"string\") {\n try {\n var re = new RegExp(spec.__spanaRegex, spec.flags || \"\");\n return re.test(raw) || re.test(str);\n } catch (e) { return false; }\n }\n var needle = normWs(spec);\n if (exact) return str === needle;\n return str.toLowerCase().indexOf(needle.toLowerCase()) !== -1;\n }\n function isInsideSectioningContent(el) {\n var cur = el && el.parentElement;\n var guard = 0;\n while (cur && guard++ < 32) {\n var ptag = cur.tagName ? cur.tagName.toUpperCase() : \"\";\n if (ptag === \"ARTICLE\" || ptag === \"ASIDE\" || ptag === \"MAIN\" || ptag === \"NAV\" || ptag === \"SECTION\") {\n return true;\n }\n var prole = (cur.getAttribute && cur.getAttribute(\"role\") || \"\").trim().toLowerCase().split(/\\s+/)[0] || \"\";\n if (prole === \"article\" || prole === \"complementary\" || prole === \"main\" || prole === \"navigation\" || prole === \"region\") {\n return true;\n }\n var root = typeof cur.getRootNode === \"function\" ? cur.getRootNode() : null;\n cur = cur.parentElement || (root && root.host) || null;\n }\n return false;\n }\n function getImplicitRole(el) {\n if (!el || !el.getAttribute) return \"generic\";\n var explicit = (el.getAttribute(\"role\") || \"\").trim().toLowerCase();\n if (explicit) return explicit.split(/\\s+/)[0] || \"generic\";\n var tag = el.tagName ? el.tagName.toUpperCase() : \"\";\n if (tag === \"BUTTON\") return \"button\";\n if (tag === \"A\") return el.hasAttribute(\"href\") ? \"link\" : \"generic\";\n if (tag === \"TEXTAREA\") return \"textbox\";\n if (tag === \"SELECT\") return (el.hasAttribute(\"multiple\") || Number(el.getAttribute(\"size\") || 0) > 1) ? \"listbox\" : \"combobox\";\n if (tag === \"OPTION\") return \"option\";\n if (tag === \"IMG\") return el.getAttribute(\"alt\") === \"\" ? \"presentation\" : \"img\";\n if (tag === \"DIALOG\") return \"dialog\";\n if (tag === \"NAV\") return \"navigation\";\n if (tag === \"MAIN\") return \"main\";\n if (tag === \"HEADER\") return isInsideSectioningContent(el) ? \"generic\" : \"banner\";\n if (tag === \"FOOTER\") return isInsideSectioningContent(el) ? \"generic\" : \"contentinfo\";\n if (tag === \"ASIDE\") return \"complementary\";\n if (tag === \"UL\" || tag === \"OL\") return \"list\";\n if (tag === \"LI\") return \"listitem\";\n if (tag === \"TABLE\") return \"table\";\n if (tag === \"TR\") return \"row\";\n if (tag === \"TD\") return \"cell\";\n if (tag === \"TH\") {\n var scope = (el.getAttribute(\"scope\") || \"\").trim().toLowerCase();\n if (scope === \"row\" || scope === \"rowgroup\") return \"rowheader\";\n if (scope === \"col\" || scope === \"colgroup\") return \"columnheader\";\n var tr = el.parentElement;\n if (tr && tr.tagName && tr.tagName.toUpperCase() === \"TR\" && !(el.closest && el.closest(\"thead\"))) {\n if (tr.querySelector && tr.querySelector(\"td\")) return \"rowheader\";\n }\n return \"columnheader\";\n }\n if (tag === \"ARTICLE\") return \"article\";\n if (tag === \"FORM\") return \"form\";\n if (tag === \"FIELDSET\") return \"group\";\n if (tag === \"FIGURE\") return \"figure\";\n if (tag === \"METER\") return \"meter\";\n if (tag === \"OUTPUT\") return \"status\";\n if (tag === \"P\") return \"paragraph\";\n if (tag === \"STRONG\") return \"strong\";\n if (tag === \"PROGRESS\") return \"progressbar\";\n if (tag === \"HR\") return \"separator\";\n if (tag === \"SECTION\") {\n return (el.hasAttribute(\"aria-label\") || el.hasAttribute(\"aria-labelledby\") || Boolean((el.getAttribute(\"title\") || \"\").trim())) ? \"region\" : \"generic\";\n }\n if (/^H[1-6]$/.test(tag)) return \"heading\";\n if (tag === \"INPUT\") {\n var t = (el.getAttribute(\"type\") || \"text\").toLowerCase();\n if (t === \"button\" || t === \"submit\" || t === \"reset\" || t === \"image\") return \"button\";\n if (t === \"checkbox\") return \"checkbox\";\n if (t === \"radio\") return \"radio\";\n if (t === \"search\") return el.hasAttribute(\"list\") ? \"combobox\" : \"searchbox\";\n if (t === \"number\") return \"spinbutton\";\n if (t === \"range\") return \"slider\";\n if (t === \"hidden\") return \"generic\";\n return el.hasAttribute(\"list\") ? \"combobox\" : \"textbox\";\n }\n return \"generic\";\n }\n var BLOCK_TAGS = {\n ADDRESS: 1, ARTICLE: 1, ASIDE: 1, BLOCKQUOTE: 1, BR: 1, DD: 1, DETAILS: 1,\n DIALOG: 1, DIV: 1, DL: 1, DT: 1, FIELDSET: 1, FIGCAPTION: 1, FIGURE: 1,\n FOOTER: 1, FORM: 1, H1: 1, H2: 1, H3: 1, H4: 1, H5: 1, H6: 1, HEADER: 1,\n HGROUP: 1, HR: 1, LI: 1, MAIN: 1, NAV: 1, OL: 1, P: 1, PRE: 1, SECTION: 1,\n SUMMARY: 1, TABLE: 1, TD: 1, TH: 1, TR: 1, UL: 1,\n };\n // Name-from-content separates any child that is not laid out as plain inline\n // (Chrome/Playwright parity): flex/grid items are blockified, so sibling\n // <span>s in a flex button still read as separate words.\n function isSpacedNameChild(child, cTag) {\n var cwin = (child.ownerDocument && child.ownerDocument.defaultView) || window;\n var cst = cwin && cwin.getComputedStyle ? cwin.getComputedStyle(child) : null;\n if (cst && cst.display) return cst.display !== \"inline\";\n return Boolean(BLOCK_TAGS[cTag]);\n }\n // The element's own document (an iframe's, not the top one), through open shadow roots.\n function isFocusedEl(el) {\n var ae = (el.ownerDocument || document).activeElement;\n while (ae && ae !== el && ae.shadowRoot && ae.shadowRoot.activeElement) ae = ae.shadowRoot.activeElement;\n return ae === el;\n }\n // Whitespace is collapsed once over the joined name (the spec's flat string), so an inline\n // child's own leading/trailing space survives: Filters<span> (1)</span> -> \"Filters (1)\" (2.37).\n function visibleTextOf(node, allowHiddenRoot, skipControl) {\n return normWs(rawVisibleTextOf(node, allowHiddenRoot, skipControl));\n }\n function rawVisibleTextOf(node, allowHiddenRoot, skipControl) {\n if (!node) return \"\";\n if (node.nodeType === 3) return node.nodeValue || \"\";\n if (node.nodeType !== 1 && node.nodeType !== 11) return \"\";\n if (node.nodeType === 1) {\n if (skipControl && node === skipControl) return \"\";\n var t = node.tagName ? node.tagName.toUpperCase() : \"\";\n if (t === \"BR\") return \" \";\n if (t === \"SCRIPT\" || t === \"STYLE\" || t === \"NOSCRIPT\" || t === \"TEMPLATE\") return \"\";\n if (skipControl && (t === \"SELECT\" || t === \"TEXTAREA\" || t === \"INPUT\")) return \"\";\n if (t === \"IMG\") {\n var imgAlt = node.getAttribute && node.getAttribute(\"alt\");\n return imgAlt ? normWs(imgAlt) : \"\";\n }\n if (t === \"SVG\") {\n var svgRole = (node.getAttribute && node.getAttribute(\"role\") || \"\").trim().toLowerCase();\n var svgLabel = node.getAttribute && node.getAttribute(\"aria-label\");\n if (svgLabel && svgLabel.trim()) return normWs(svgLabel);\n if (svgRole === \"img\") {\n var svgTitle = node.querySelector && node.querySelector(\"title\");\n if (svgTitle && svgTitle.textContent) return normWs(svgTitle.textContent);\n }\n }\n if (!allowHiddenRoot) {\n if (node.getAttribute && node.getAttribute(\"aria-hidden\") === \"true\") return \"\";\n var win = (node.ownerDocument && node.ownerDocument.defaultView) || window;\n if (win && win.getComputedStyle) {\n var st = win.getComputedStyle(node);\n if (st && (st.display === \"none\" || st.visibility === \"hidden\" || st.visibility === \"collapse\")) {\n return \"\";\n }\n }\n }\n }\n var out = [];\n if (node.shadowRoot) {\n var stxt = rawVisibleTextOf(node.shadowRoot, false, skipControl);\n if (stxt) out.push(stxt);\n }\n var kids = node.childNodes || [];\n for (var i = 0; i < kids.length; i++) {\n var child = kids[i];\n var k = rawVisibleTextOf(child, false, skipControl);\n if (!k) continue;\n var cTag = child && child.nodeType === 1 && child.tagName ? child.tagName.toUpperCase() : \"\";\n if (cTag && isSpacedNameChild(child, cTag)) {\n out.push(\" \", k, \" \");\n } else {\n out.push(k);\n }\n }\n return out.join(\"\");\n }\n function ensureNetworkTracker() {\n if (typeof window === \"undefined\" || window.__spanaNetHooked) return;\n try {\n window.__spanaNetHooked = true;\n window.__spanaInflightNet = window.__spanaInflightNet || 0;\n window.__spanaLastNetEnd = window.__spanaLastNetEnd || 0;\n if (typeof window.fetch === \"function\") {\n var origFetch = window.fetch;\n window.fetch = function() {\n window.__spanaInflightNet = (window.__spanaInflightNet || 0) + 1;\n var done = false;\n var finish = function() {\n if (done) return;\n done = true;\n window.__spanaInflightNet = Math.max(0, (window.__spanaInflightNet || 1) - 1);\n window.__spanaLastNetEnd = Date.now();\n };\n try {\n var p = origFetch.apply(this, arguments);\n if (p && typeof p.then === \"function\") {\n p.then(finish, finish);\n } else {\n finish();\n }\n return p;\n } catch (e) {\n finish();\n throw e;\n }\n };\n }\n if (typeof XMLHttpRequest !== \"undefined\" && XMLHttpRequest.prototype && typeof XMLHttpRequest.prototype.send === \"function\") {\n var origSend = XMLHttpRequest.prototype.send;\n XMLHttpRequest.prototype.send = function() {\n window.__spanaInflightNet = (window.__spanaInflightNet || 0) + 1;\n var done = false;\n var finish = function() {\n if (done) return;\n done = true;\n window.__spanaInflightNet = Math.max(0, (window.__spanaInflightNet || 1) - 1);\n window.__spanaLastNetEnd = Date.now();\n };\n try {\n this.addEventListener(\"loadend\", finish, { once: true });\n return origSend.apply(this, arguments);\n } catch (e) {\n finish();\n throw e;\n }\n };\n }\n } catch (e) {}\n }\n function hasInflightNetwork(quietMs) {\n if (typeof window === \"undefined\" || !window.__spanaNetHooked) return false;\n if ((window.__spanaInflightNet || 0) > 0) return true;\n var lastEnd = window.__spanaLastNetEnd || 0;\n if (lastEnd > 0 && Date.now() - lastEnd < (quietMs || 250)) return true;\n return false;\n }\n function isVisiblyHiddenInAncestorChain(el) {\n if (!el) return true;\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var cur = el;\n var guard = 0;\n while (cur && guard++ < 48) {\n if (cur.nodeType === 1 && win && win.getComputedStyle) {\n var cs = win.getComputedStyle(cur);\n if (cs) {\n if (cs.display === \"none\") return true;\n if (cs.contentVisibility === \"hidden\") return true;\n }\n }\n var root = typeof cur.getRootNode === \"function\" ? cur.getRootNode() : null;\n cur = cur.parentElement || (root && root.host) || null;\n }\n if (el.nodeType === 1 && win && win.getComputedStyle) {\n var selfCs = win.getComputedStyle(el);\n if (selfCs && (selfCs.visibility === \"hidden\" || selfCs.visibility === \"collapse\")) return true;\n }\n return false;\n }\n // opacity: 0 on the element or an ancestor. Such an element still counts as visible\n // (Playwright's toBeVisible), but an action prefers an opaque match: a closed menu kept at\n // opacity 0 must not take the click meant for the button the user sees.\n function isTransparent(el) {\n var win = (el && el.ownerDocument && el.ownerDocument.defaultView) || window;\n var cur = el;\n var guard = 0;\n while (cur && guard++ < 48) {\n if (cur.nodeType === 1 && win && win.getComputedStyle) {\n var cs = win.getComputedStyle(cur);\n if (cs && cs.opacity === \"0\") return true;\n }\n var root = typeof cur.getRootNode === \"function\" ? cur.getRootNode() : null;\n cur = cur.parentElement || (root && root.host) || null;\n }\n return false;\n }\n function pickActionIndex(items, elOf) {\n var last = items.length - 1;\n for (var i = last; i >= 0; i--) {\n if (!isTransparent(elOf(items[i]))) return i;\n }\n return last;\n }\n function isHiddenInAncestorChain(el) {\n if (!el) return true;\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var cur = el;\n var guard = 0;\n while (cur && guard++ < 48) {\n if (cur.getAttribute) {\n if (cur.getAttribute(\"aria-hidden\") === \"true\") return true;\n }\n if (cur.hasAttribute && cur.hasAttribute(\"inert\")) return true;\n if (cur.nodeType === 1 && win && win.getComputedStyle) {\n var cs = win.getComputedStyle(cur);\n if (cs) {\n if (cs.display === \"none\") return true;\n if (cs.contentVisibility === \"hidden\") return true;\n }\n }\n var root = typeof cur.getRootNode === \"function\" ? cur.getRootNode() : null;\n cur = cur.parentElement || (root && root.host) || null;\n }\n if (el.nodeType === 1 && win && win.getComputedStyle) {\n var selfCs = win.getComputedStyle(el);\n if (selfCs && (selfCs.visibility === \"hidden\" || selfCs.visibility === \"collapse\")) return true;\n }\n return false;\n }\n function isAriaHidden(el) {\n if (el && el.tagName && el.tagName.toUpperCase() === \"OPTION\") {\n var parentSel = el.closest ? el.closest(\"select\") : el.parentElement;\n if (parentSel) {\n return isHiddenInAncestorChain(parentSel);\n }\n }\n if (isHiddenInAncestorChain(el)) return true;\n if (el && el.nodeType === 1) {\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var st = win && win.getComputedStyle ? win.getComputedStyle(el) : null;\n if (st && st.display === \"contents\") {\n return !hasVisibleDescendant(el, 0);\n }\n }\n return false;\n }\n function hasVisibleDescendant(el, depth) {\n if (!el || depth > 8) return false;\n var kids = el.children || [];\n for (var i = 0; i < kids.length; i++) {\n var child = kids[i];\n if (!child || child.nodeType !== 1) continue;\n var cr = child.getBoundingClientRect ? child.getBoundingClientRect() : { width: 0, height: 0 };\n if (isVisible(child, cr, depth + 1)) return true;\n }\n if (el.shadowRoot && el.shadowRoot.children) {\n var skids = el.shadowRoot.children;\n for (var j = 0; j < skids.length; j++) {\n var sc = skids[j];\n if (!sc || sc.nodeType !== 1) continue;\n var sr = sc.getBoundingClientRect ? sc.getBoundingClientRect() : { width: 0, height: 0 };\n if (isVisible(sc, sr, depth + 1)) return true;\n }\n }\n return false;\n }\n function getContentsUnionRect(el, depth) {\n if (!el || depth > 8) return null;\n var minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n var found = false;\n var visit = function(list) {\n for (var i = 0; i < list.length; i++) {\n var child = list[i];\n if (!child || child.nodeType !== 1) continue;\n var win = (child.ownerDocument && child.ownerDocument.defaultView) || window;\n var cst = win && win.getComputedStyle ? win.getComputedStyle(child) : null;\n if (cst && (cst.display === \"none\" || cst.visibility === \"hidden\" || cst.visibility === \"collapse\")) continue;\n var r = cst && cst.display === \"contents\"\n ? getContentsUnionRect(child, depth + 1)\n : (child.getBoundingClientRect ? child.getBoundingClientRect() : null);\n if (r && r.width > 0 && r.height > 0) {\n found = true;\n if (r.x < minX) minX = r.x;\n if (r.y < minY) minY = r.y;\n if (r.x + r.width > maxX) maxX = r.x + r.width;\n if (r.y + r.height > maxY) maxY = r.y + r.height;\n }\n }\n };\n if (el.children) visit(el.children);\n if (el.shadowRoot && el.shadowRoot.children) visit(el.shadowRoot.children);\n if (!found) return null;\n return { x: minX, y: minY, left: minX, top: minY, width: maxX - minX, height: maxY - minY, right: maxX, bottom: maxY };\n }\n function headingLevelOf(el) {\n if (!el) return null;\n var explicit = el.getAttribute && el.getAttribute(\"aria-level\");\n if (explicit) {\n var parsed = parseInt(explicit, 10);\n if (!isNaN(parsed)) return parsed;\n }\n var tag = el.tagName ? el.tagName.toUpperCase() : \"\";\n var m = /^H([1-6])$/.exec(tag);\n return m ? parseInt(m[1], 10) : null;\n }\n function getAccessibleName(el) {\n if (!el) return \"\";\n var doc = el.ownerDocument || document;\n var labelledBy = el.getAttribute && el.getAttribute(\"aria-labelledby\");\n if (labelledBy) {\n var parts = [];\n var ids = labelledBy.trim().split(/\\s+/);\n for (var i = 0; i < ids.length; i++) {\n var ref = doc.getElementById ? doc.getElementById(ids[i]) : null;\n if (ref) {\n var rt = visibleTextOf(ref, true, null);\n if (rt) parts.push(rt);\n }\n }\n if (parts.length > 0) return parts.join(\" \").replace(/\\s+/g, \" \").trim();\n }\n var ariaLabel = el.getAttribute && el.getAttribute(\"aria-label\");\n if (ariaLabel && ariaLabel.trim()) return ariaLabel.trim();\n var tag = el.tagName ? el.tagName.toUpperCase() : \"\";\n if (tag === \"INPUT\" || tag === \"TEXTAREA\" || tag === \"SELECT\") {\n if (el.id && doc.querySelector) {\n try {\n var escId = typeof CSS !== \"undefined\" && CSS.escape ? CSS.escape(el.id) : el.id;\n var forLbl = doc.querySelector('label[for=\"' + escId + '\"]');\n if (forLbl) {\n var ft = visibleTextOf(forLbl, false, el);\n if (ft) return ft;\n }\n } catch (e) {}\n }\n if (el.closest) {\n var wrapLbl = el.closest(\"label\");\n if (wrapLbl) {\n var wt = visibleTextOf(wrapLbl, false, el);\n if (wt) return wt;\n }\n }\n var itype = tag === \"INPUT\" ? (el.getAttribute(\"type\") || \"text\").toLowerCase() : \"\";\n if ((itype === \"button\" || itype === \"submit\" || itype === \"reset\") && el.value) {\n return String(el.value).trim();\n }\n var ph = el.getAttribute && el.getAttribute(\"placeholder\");\n if (ph && ph.trim()) return ph.trim();\n }\n if (tag === \"IMG\") {\n var alt = el.getAttribute && el.getAttribute(\"alt\");\n if (alt && alt.trim()) return alt.trim();\n }\n if (tag === \"FIELDSET\") {\n var fkids = el.children || [];\n for (var fi = 0; fi < fkids.length; fi++) {\n var fk = fkids[fi];\n if (fk && fk.tagName && fk.tagName.toUpperCase() === \"LEGEND\") {\n var ltxt = visibleTextOf(fk, false, null);\n if (ltxt) return ltxt;\n break;\n }\n }\n }\n if (tag === \"TABLE\") {\n var tkids = el.children || [];\n for (var ti = 0; ti < tkids.length; ti++) {\n var tk = tkids[ti];\n if (tk && tk.tagName && tk.tagName.toUpperCase() === \"CAPTION\") {\n var ctxt = visibleTextOf(tk, false, null);\n if (ctxt) return ctxt;\n break;\n }\n }\n }\n if (tag === \"FIGURE\") {\n var fgkids = el.children || [];\n for (var fgi = 0; fgi < fgkids.length; fgi++) {\n var fgk = fgkids[fgi];\n if (fgk && fgk.tagName && fgk.tagName.toUpperCase() === \"FIGCAPTION\") {\n var fgtxt = visibleTextOf(fgk, false, null);\n if (fgtxt) return fgtxt;\n break;\n }\n }\n }\n var role = getImplicitRole(el);\n var nameFromAuthorOnly = {\n list: 1, navigation: 1, main: 1, region: 1, form: 1, dialog: 1, alertdialog: 1,\n table: 1, grid: 1, tablist: 1, tabpanel: 1, menu: 1, menubar: 1, toolbar: 1,\n tree: 1, group: 1, radiogroup: 1, feed: 1, article: 1, banner: 1, complementary: 1,\n contentinfo: 1, search: 1, combobox: 1, listbox: 1, log: 1, marquee: 1, status: 1,\n timer: 1, alert: 1, application: 1, document: 1, directory: 1, figure: 1, img: 1,\n math: 1, meter: 1, progressbar: 1, scrollbar: 1, separator: 1, slider: 1,\n spinbutton: 1, textbox: 1, searchbox: 1,\n };\n if (role && nameFromAuthorOnly[role]) {\n var authorTitle = el.getAttribute && el.getAttribute(\"title\");\n return authorTitle ? authorTitle.trim() : \"\";\n }\n var txt = visibleTextOf(el, false, null);\n if (txt) return txt;\n var title = el.getAttribute && el.getAttribute(\"title\");\n return title ? title.trim() : \"\";\n }\n function getAccessibleDescription(el) {\n if (!el) return \"\";\n var doc = el.ownerDocument || document;\n var describedBy = el.getAttribute && el.getAttribute(\"aria-describedby\");\n if (describedBy) {\n var parts = [];\n var ids = describedBy.trim().split(/\\s+/);\n for (var i = 0; i < ids.length; i++) {\n var ref = doc.getElementById ? doc.getElementById(ids[i]) : null;\n if (ref) {\n var rt = visibleTextOf(ref, true, null);\n if (rt) parts.push(rt);\n }\n }\n if (parts.length > 0) return parts.join(\" \").replace(/\\s+/g, \" \").trim();\n }\n var ariaDesc = el.getAttribute && el.getAttribute(\"aria-description\");\n if (ariaDesc && ariaDesc.trim()) return ariaDesc.trim();\n var title = el.getAttribute && el.getAttribute(\"title\");\n if (title && title.trim()) {\n var accName = getAccessibleName(el);\n if (accName && accName !== title.trim()) return title.trim();\n }\n return \"\";\n }\n function getIframeTransform(frameEl) {\n var fr = frameEl.getBoundingClientRect();\n var fwin = (frameEl.ownerDocument && frameEl.ownerDocument.defaultView) || window;\n var fcs = fwin && fwin.getComputedStyle ? fwin.getComputedStyle(frameEl) : null;\n var bLeft = fcs ? (parseFloat(fcs.borderLeftWidth) || 0) : 0;\n var bTop = fcs ? (parseFloat(fcs.borderTopWidth) || 0) : 0;\n var bRight = fcs ? (parseFloat(fcs.borderRightWidth) || 0) : 0;\n var bBottom = fcs ? (parseFloat(fcs.borderBottomWidth) || 0) : 0;\n var layoutW = frameEl.offsetWidth || (frameEl.clientWidth + bLeft + bRight);\n var layoutH = frameEl.offsetHeight || (frameEl.clientHeight + bTop + bBottom);\n var sx = layoutW > 0 ? (fr.width / layoutW) : 1;\n var sy = layoutH > 0 ? (fr.height / layoutH) : 1;\n if (!isFinite(sx) || sx <= 0) sx = 1;\n if (!isFinite(sy) || sy <= 0) sy = 1;\n return { left: fr.left + bLeft * sx, top: fr.top + bTop * sy, scaleX: sx, scaleY: sy };\n }\n function collectRoots(root, offsetX, offsetY, scaleX, scaleY, inShadow, inIframe, out) {\n if (!root) return;\n out.push({ root: root, offsetX: offsetX, offsetY: offsetY, scaleX: scaleX, scaleY: scaleY, inShadow: inShadow, inIframe: inIframe });\n if (root.shadowRoot) {\n collectRoots(root.shadowRoot, offsetX, offsetY, scaleX, scaleY, true, inIframe, out);\n }\n var nodes = root.querySelectorAll ? root.querySelectorAll(\"*\") : [];\n for (var i = 0; i < nodes.length; i++) {\n var el = nodes[i];\n if (el.shadowRoot) {\n collectRoots(el.shadowRoot, offsetX, offsetY, scaleX, scaleY, true, inIframe, out);\n }\n if (el.tagName === \"IFRAME\") {\n try {\n var frameDoc = el.contentDocument;\n if (frameDoc) {\n var ft = getIframeTransform(el);\n collectRoots(\n frameDoc,\n offsetX + ft.left * scaleX,\n offsetY + ft.top * scaleY,\n scaleX * ft.scaleX,\n scaleY * ft.scaleY,\n inShadow,\n true,\n out\n );\n }\n } catch (e) {}\n }\n }\n }\n function findTextInRoot(root, needle, exact, ctx, pushHit) {\n if (!root) return;\n var isRegex = Boolean(needle && typeof needle === \"object\" && typeof needle.__spanaRegex === \"string\");\n var rawNeedleStr = isRegex ? \"\" : String(needle == null ? \"\" : needle);\n var trimmedNeedle = normWs(rawNeedleStr);\n var lowerNeedle = trimmedNeedle.toLowerCase();\n if (!isRegex && !trimmedNeedle) return;\n\n var skipTags = { SCRIPT: 1, STYLE: 1, NOSCRIPT: 1, TEMPLATE: 1, HEAD: 1, META: 1, LINK: 1, TITLE: 1 };\n\n // Button-like <input> elements store their label in .value (not ancestor .textContent),\n // so check them directly before textContent-based subtree pruning.\n if (root.querySelectorAll) {\n var btnInputs = root.querySelectorAll('input[type=\"button\"], input[type=\"submit\"], input[type=\"reset\"]');\n for (var bi = 0; bi < btnInputs.length; bi++) {\n var bNode = btnInputs[bi];\n var bVal = normWs(bNode.value || \"\");\n if (bVal && matchSpec(bVal, needle, exact)) {\n pushHit(bNode, ctx);\n }\n }\n }\n\n function visitNode(node) {\n if (!node || node.nodeType !== 1) return false;\n var tag = node.tagName ? node.tagName.toUpperCase() : \"\";\n if (skipTags[tag] || tag === \"INPUT\") return false;\n\n var normText = normWs(node.textContent || \"\");\n if (!isRegex) {\n if (!normText) return false;\n if (exact) {\n if (normText.indexOf(trimmedNeedle) === -1) return false;\n } else {\n if (normText.toLowerCase().indexOf(lowerNeedle) === -1) return false;\n }\n }\n\n var childMatched = false;\n var kids = node.children || [];\n for (var i = 0; i < kids.length; i++) {\n if (visitNode(kids[i])) childMatched = true;\n }\n if (childMatched) return true;\n\n if (normText && matchSpec(normText, needle, exact)) {\n pushHit(node, ctx);\n return true;\n }\n return false;\n }\n\n if (root.nodeType === 9) {\n var startEl = root.body || root.documentElement;\n if (startEl) visitNode(startEl);\n return;\n }\n if (root.nodeType === 11) {\n var fragKids = root.children || [];\n for (var fi = 0; fi < fragKids.length; fi++) visitNode(fragKids[fi]);\n return;\n }\n visitNode(root);\n }\n function findRoleInRoot(root, roleLower, nameSpec, exact, ctx, pushHit, includeHidden, level, pressed) {\n if (!root || !root.querySelectorAll) return;\n var candidates = root.querySelectorAll(\"*\");\n for (var i = 0; i < candidates.length; i++) {\n var el = candidates[i];\n if (getImplicitRole(el) !== roleLower) continue;\n if (!includeHidden && isAriaHidden(el)) continue;\n if (level !== undefined && level !== null && headingLevelOf(el) !== Number(level)) continue;\n if (pressed !== undefined && pressed !== null) {\n var ap = (el.getAttribute && el.getAttribute(\"aria-pressed\") || \"\").trim().toLowerCase();\n if (pressed ? ap !== \"true\" : ap !== \"false\") continue;\n }\n if (nameSpec !== undefined && nameSpec !== null) {\n var accName = getAccessibleName(el);\n if (!matchSpec(accName, nameSpec, Boolean(exact))) continue;\n }\n pushHit(el, ctx);\n }\n }\n function isHitVisible(h) {\n if (!h) return false;\n if (h.wasmNode) {\n return h.wasmNode.visible !== false && h.wasmRect && h.wasmRect.width > 0 && h.wasmRect.height > 0;\n }\n if (!h.el || !h.el.getBoundingClientRect) return false;\n return isVisible(h.el, h.el.getBoundingClientRect());\n }\n // Only a button-like <input> shows its value as its text; an <option>'s or a field's value is data.\n function buttonInputValue(el) {\n if (!el || !el.tagName || el.tagName.toUpperCase() !== \"INPUT\") return \"\";\n var bt = (el.getAttribute(\"type\") || \"\").toLowerCase();\n return bt === \"button\" || bt === \"submit\" || bt === \"reset\" ? el.value || \"\" : \"\";\n }\n function applyModifiersAndSlice(hits, sel, preferVisible) {\n if (!sel || typeof sel !== \"object\" || \"point\" in sel) return hits;\n var filtered = hits;\n if (sel.hasText !== undefined) {\n filtered = filtered.filter(function(h) {\n var normTc = normWs(h.el.textContent || \"\");\n var innerT = normWs(h.el.innerText || \"\");\n var fallbackTxt = normWs(buttonInputValue(h.el) || getAccessibleName(h.el) || \"\");\n return matchSpec(normTc, sel.hasText, false) || matchSpec(innerT, sel.hasText, false) || matchSpec(fallbackTxt, sel.hasText, false);\n });\n }\n if (sel.hasNotText !== undefined) {\n filtered = filtered.filter(function(h) {\n var normTc = normWs(h.el.textContent || \"\");\n var innerT = normWs(h.el.innerText || \"\");\n var fallbackTxt = normWs(buttonInputValue(h.el) || getAccessibleName(h.el) || \"\");\n return !matchSpec(normTc, sel.hasNotText, false) && !matchSpec(innerT, sel.hasNotText, false) && !matchSpec(fallbackTxt, sel.hasNotText, false);\n });\n }\n if (sel.has !== undefined) {\n filtered = filtered.filter(function(h) {\n return findInScope(sel.has, h.el, h.offsetX, h.offsetY, h.scaleX, h.scaleY, h.inShadow, h.inIframe, preferVisible).length > 0;\n });\n }\n if (sel.hasNot !== undefined) {\n filtered = filtered.filter(function(h) {\n return findInScope(sel.hasNot, h.el, h.offsetX, h.offsetY, h.scaleX, h.scaleY, h.inShadow, h.inIframe, preferVisible).length === 0;\n });\n }\n var wantsSlice = Boolean(sel.first || sel.last || typeof sel.nth === \"number\");\n if (wantsSlice && !sel.includeHidden && preferVisible) {\n var visibleFiltered = filtered.filter(isHitVisible);\n if (preferVisible === \"strict\" || visibleFiltered.length > 0) {\n filtered = visibleFiltered;\n }\n }\n if (sel.first) return filtered.length > 0 ? [filtered[0]] : [];\n if (sel.last) return filtered.length > 0 ? [filtered[filtered.length - 1]] : [];\n if (typeof sel.nth === \"number\") {\n var idx = sel.nth < 0 ? filtered.length + sel.nth : sel.nth;\n return idx >= 0 && idx < filtered.length ? [filtered[idx]] : [];\n }\n return filtered;\n }\n function findInScope(sel, scopeRoot, baseOffsetX, baseOffsetY, baseScaleX, baseScaleY, baseInShadow, baseInIframe, preferVisible) {\n var hits = [];\n var seen = typeof Set !== \"undefined\" ? new Set() : null;\n function pushHit(el, ctx) {\n if (seen) {\n if (seen.has(el)) return;\n seen.add(el);\n }\n hits.push({\n el: el,\n offsetX: ctx.offsetX,\n offsetY: ctx.offsetY,\n scaleX: ctx.scaleX != null ? ctx.scaleX : 1,\n scaleY: ctx.scaleY != null ? ctx.scaleY : 1,\n inShadow: ctx.inShadow,\n inIframe: ctx.inIframe\n });\n }\n if (typeof sel === \"object\" && sel !== null && \"point\" in sel) {\n var atPt = document.elementFromPoint(sel.point.x, sel.point.y);\n if (atPt) pushHit(atPt, { offsetX: 0, offsetY: 0, scaleX: 1, scaleY: 1, inShadow: false, inIframe: false });\n return hits;\n }\n // Frame scoping: find matching <iframe> first, then search inside its contentDocument\n if (typeof sel === \"object\" && sel !== null && sel.frame) {\n var frameHits = findInScope(sel.frame, scopeRoot, baseOffsetX, baseOffsetY, baseScaleX, baseScaleY, baseInShadow, baseInIframe, preferVisible);\n var innerSel = Object.assign({}, sel);\n delete innerSel.frame;\n for (var fi = 0; fi < frameHits.length; fi++) {\n var fEl = frameHits[fi].el;\n if (fEl && fEl.tagName === \"IFRAME\") {\n try {\n var fDoc = fEl.contentDocument;\n if (fDoc) {\n var fTr = getIframeTransform(fEl);\n var pSx = frameHits[fi].scaleX != null ? frameHits[fi].scaleX : 1;\n var pSy = frameHits[fi].scaleY != null ? frameHits[fi].scaleY : 1;\n var sub = findInScope(\n innerSel,\n fDoc,\n frameHits[fi].offsetX + fTr.left * pSx,\n frameHits[fi].offsetY + fTr.top * pSy,\n pSx * fTr.scaleX,\n pSy * fTr.scaleY,\n frameHits[fi].inShadow,\n true,\n preferVisible\n );\n for (var si = 0; si < sub.length; si++) pushHit(sub[si].el, sub[si]);\n }\n } catch (e) {}\n }\n }\n return hits;\n }\n // Parent scoping: resolve 'within' first, then search inside each matched container\n if (typeof sel === \"object\" && sel !== null && sel.within) {\n var parentHits = findInScope(sel.within, scopeRoot, baseOffsetX, baseOffsetY, baseScaleX, baseScaleY, baseInShadow, baseInIframe, preferVisible);\n var childSel = Object.assign({}, sel);\n delete childSel.within;\n delete childSel.hasText;\n delete childSel.hasNotText;\n delete childSel.has;\n delete childSel.hasNot;\n delete childSel.first;\n delete childSel.last;\n delete childSel.nth;\n var combined = [];\n var cSeen = typeof Set !== \"undefined\" ? new Set() : null;\n for (var pi = 0; pi < parentHits.length; pi++) {\n var ph = parentHits[pi];\n var subHits = findInScope(childSel, ph.el, ph.offsetX, ph.offsetY, ph.scaleX, ph.scaleY, ph.inShadow, ph.inIframe, preferVisible);\n for (var ci = 0; ci < subHits.length; ci++) {\n if (cSeen && cSeen.has(subHits[ci].el)) continue;\n if (cSeen) cSeen.add(subHits[ci].el);\n combined.push(subHits[ci]);\n }\n }\n return applyModifiersAndSlice(combined, sel, preferVisible);\n }\n // Logical OR composition (anyOf): union deduplicated hits across branches\n if (typeof sel === \"object\" && sel !== null && Array.isArray(sel.anyOf)) {\n for (var bi = 0; bi < sel.anyOf.length; bi++) {\n var branchHits = findInScope(sel.anyOf[bi], scopeRoot, baseOffsetX, baseOffsetY, baseScaleX, baseScaleY, baseInShadow, baseInIframe, preferVisible);\n for (var bh = 0; bh < branchHits.length; bh++) {\n pushHit(branchHits[bh].el, branchHits[bh]);\n }\n }\n return applyModifiersAndSlice(hits, sel, preferVisible);\n }\n // Logical AND composition (allOf): intersection of matched elements across branches\n if (typeof sel === \"object\" && sel !== null && Array.isArray(sel.allOf) && sel.allOf.length > 0) {\n var firstBranch = findInScope(sel.allOf[0], scopeRoot, baseOffsetX, baseOffsetY, baseScaleX, baseScaleY, baseInShadow, baseInIframe, preferVisible);\n var currentHits = firstBranch;\n for (var ai = 1; ai < sel.allOf.length && currentHits.length > 0; ai++) {\n var nextBranch = findInScope(sel.allOf[ai], scopeRoot, baseOffsetX, baseOffsetY, baseScaleX, baseScaleY, baseInShadow, baseInIframe, preferVisible);\n var nextEls = typeof Set !== \"undefined\" ? new Set(nextBranch.map(function(h) { return h.el; })) : null;\n currentHits = currentHits.filter(function(h) {\n if (nextEls) return nextEls.has(h.el);\n return nextBranch.some(function(nh) { return nh.el === h.el; });\n });\n }\n for (var ahi = 0; ahi < currentHits.length; ahi++) pushHit(currentHits[ahi].el, currentHits[ahi]);\n return applyModifiersAndSlice(hits, sel, preferVisible);\n }\n\n function queryCssSafe(root, cssStr) {\n try {\n return root.querySelectorAll(cssStr);\n } catch (e) {\n var hint = \"\";\n if (/:has-text\\(/.test(cssStr)) hint = \" (Playwright :has-text() is not valid CSS; use { ..., hasText: ... } instead)\";\n else if (cssStr.indexOf(\">>\") !== -1) hint = \" (Playwright >> chaining is not valid CSS; use within(parent, child) instead)\";\n else if (/\\bnth=/.test(cssStr)) hint = \" (Playwright nth= is not valid CSS; use { ..., nth: index } instead)\";\n throw new Error('Invalid CSS selector \"' + cssStr + '\": ' + (e && e.message ? e.message : String(e)) + hint);\n }\n }\n function findByLabelInRoot(root, spec, exact, ctx, push) {\n if (!root || !root.querySelectorAll) return;\n var seen = new Set();\n var addCtrl = function(c) {\n if (!c || seen.has(c)) return;\n if (c.tagName === \"INPUT\" && (c.getAttribute(\"type\") || \"\").toLowerCase() === \"hidden\") return;\n seen.add(c);\n push(c, ctx);\n };\n // 1. Explicit <label> elements (associated via .control, [for], or nested labelable control)\n var labels = root.querySelectorAll(\"label\");\n for (var lb = 0; lb < labels.length; lb++) {\n var lblEl = labels[lb];\n var ctrlFromLbl = lblEl.control || null;\n if (!ctrlFromLbl && lblEl.getAttribute) {\n var forAttr = lblEl.getAttribute(\"for\");\n if (forAttr) {\n var lblRoot = typeof lblEl.getRootNode === \"function\" ? lblEl.getRootNode() : null;\n if (lblRoot && typeof lblRoot.getElementById === \"function\") {\n ctrlFromLbl = lblRoot.getElementById(forAttr);\n }\n if (!ctrlFromLbl) {\n var lblDoc = lblEl.ownerDocument || document;\n ctrlFromLbl = lblDoc.getElementById ? lblDoc.getElementById(forAttr) : null;\n }\n if (!ctrlFromLbl && root.querySelector) {\n try {\n var escFor = typeof CSS !== \"undefined\" && CSS.escape ? CSS.escape(forAttr) : forAttr;\n ctrlFromLbl = root.querySelector('[id=\"' + escFor + '\"]');\n } catch (e) {}\n }\n }\n }\n if (!ctrlFromLbl && lblEl.querySelector) {\n ctrlFromLbl = lblEl.querySelector(\"input:not([type=hidden]), textarea, select, meter, output, progress\");\n }\n if (!ctrlFromLbl) continue;\n var rawLblText = visibleTextOf(lblEl, false, ctrlFromLbl) || normWs(lblEl.textContent || \"\");\n var fullLblText = !lblEl.contains(ctrlFromLbl) ? normWs(lblEl.textContent || \"\") : \"\";\n if (\n (rawLblText && matchSpec(rawLblText, spec, exact)) ||\n (fullLblText && matchSpec(fullLblText, spec, exact))\n ) {\n addCtrl(ctrlFromLbl);\n }\n }\n // 2. Labelable form controls & ARIA form widgets (never match <button> by its inner text)\n var labelableRoles = {\n textbox: 1, searchbox: 1, combobox: 1, listbox: 1, spinbutton: 1,\n slider: 1, checkbox: 1, radio: 1, switch: 1,\n };\n var controls = root.querySelectorAll(\"input, textarea, select, meter, output, progress, audio, video, [contenteditable], [aria-label], [aria-labelledby]\");\n for (var li = 0; li < controls.length; li++) {\n var ctrl = controls[li];\n if (seen.has(ctrl)) continue;\n if (ctrl.tagName === \"INPUT\" && (ctrl.getAttribute(\"type\") || \"\").toLowerCase() === \"hidden\") continue;\n var tag = ctrl.tagName ? ctrl.tagName.toUpperCase() : \"\";\n var isFormControl =\n tag === \"INPUT\" || tag === \"TEXTAREA\" || tag === \"SELECT\" ||\n tag === \"METER\" || tag === \"OUTPUT\" || tag === \"PROGRESS\" ||\n tag === \"AUDIO\" || tag === \"VIDEO\" ||\n (ctrl.hasAttribute && ctrl.hasAttribute(\"contenteditable\"));\n var role = getImplicitRole(ctrl);\n if (!isFormControl && !labelableRoles[role]) continue;\n var labelText = getAccessibleName(ctrl);\n if (!labelText && ctrl.labels && ctrl.labels.length > 0) {\n var parts = [];\n for (var lj = 0; lj < ctrl.labels.length; lj++) {\n parts.push((ctrl.labels[lj].textContent || \"\").trim());\n }\n labelText = parts.join(\" \").trim();\n }\n if (labelText && matchSpec(labelText, spec, exact)) {\n addCtrl(ctrl);\n }\n }\n }\n function findByAttrSpecInRoot(root, attrName, spec, exact, ctx, push) {\n if (!root || !root.querySelectorAll) return;\n var nodes = root.querySelectorAll(\"[\" + attrName + \"]\");\n for (var ni = 0; ni < nodes.length; ni++) {\n var val = nodes[ni].getAttribute(attrName);\n if (val !== null && matchSpec(val, spec, exact)) {\n push(nodes[ni], ctx);\n }\n }\n }\n\n var esc = function(v) {\n return typeof CSS !== \"undefined\" && CSS.escape ? CSS.escape(v) : String(v).replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"');\n };\n var mainCtx = { root: scopeRoot, offsetX: baseOffsetX, offsetY: baseOffsetY, scaleX: baseScaleX, scaleY: baseScaleY, inShadow: baseInShadow, inIframe: baseInIframe };\n var hasModifiers = typeof sel === \"object\" && sel !== null && (sel.hasText !== undefined || sel.hasNotText !== undefined || sel.has !== undefined || sel.hasNot !== undefined || sel.first || sel.last || typeof sel.nth === \"number\");\n\n // O(1)-ish Light-DOM fast path: avoids scanning thousands of nodes with querySelectorAll(\"*\")\n // unless Shadow DOM / iframe piercing is needed or no Light-DOM match exists.\n if (scopeRoot && scopeRoot.querySelectorAll && !hasModifiers) {\n if (typeof sel === \"object\" && sel !== null && \"testID\" in sel) {\n var fastTid = esc(sel.testID);\n var fastFound = scopeRoot.querySelectorAll('[data-testid=\"' + fastTid + '\"], [testID=\"' + fastTid + '\"]');\n if (fastFound.length > 0) {\n for (var fi2 = 0; fi2 < fastFound.length; fi2++) pushHit(fastFound[fi2], mainCtx);\n return hits;\n }\n } else if (typeof sel === \"object\" && sel !== null && \"css\" in sel) {\n var fastCss = queryCssSafe(scopeRoot, sel.css);\n if (fastCss.length > 0) {\n for (var fc = 0; fc < fastCss.length; fc++) pushHit(fastCss[fc], mainCtx);\n return hits;\n }\n } else if (typeof sel === \"object\" && sel !== null && \"accessibilityLabel\" in sel) {\n var fastLbl = esc(sel.accessibilityLabel);\n var fastFoundLbl = scopeRoot.querySelectorAll('[aria-label=\"' + fastLbl + '\"]');\n if (fastFoundLbl.length > 0) {\n for (var fj = 0; fj < fastFoundLbl.length; fj++) pushHit(fastFoundLbl[fj], mainCtx);\n return hits;\n }\n } else if (typeof sel === \"object\" && sel !== null && \"label\" in sel) {\n findByLabelInRoot(scopeRoot, sel.label, Boolean(sel.exact), mainCtx, pushHit);\n if (hits.length > 0) return hits;\n } else if (typeof sel === \"object\" && sel !== null && \"placeholder\" in sel) {\n findByAttrSpecInRoot(scopeRoot, \"placeholder\", sel.placeholder, Boolean(sel.exact), mainCtx, pushHit);\n if (hits.length > 0) return hits;\n } else if (typeof sel === \"object\" && sel !== null && \"altText\" in sel) {\n findByAttrSpecInRoot(scopeRoot, \"alt\", sel.altText, Boolean(sel.exact), mainCtx, pushHit);\n if (hits.length > 0) return hits;\n } else if (typeof sel === \"object\" && sel !== null && \"title\" in sel) {\n findByAttrSpecInRoot(scopeRoot, \"title\", sel.title, Boolean(sel.exact), mainCtx, pushHit);\n if (hits.length > 0) return hits;\n } else if (typeof sel === \"object\" && sel !== null && \"role\" in sel) {\n findRoleInRoot(scopeRoot, String(sel.role).toLowerCase(), sel.name, sel.exact, mainCtx, pushHit, sel.includeHidden, sel.level, sel.pressed);\n if (hits.length > 0) return hits;\n } else if (typeof sel === \"string\" || (typeof sel === \"object\" && sel !== null && \"text\" in sel)) {\n var fastNeedle = typeof sel === \"string\" ? sel : sel.text;\n var fastExact = typeof sel === \"object\" && sel !== null && Boolean(sel.exact);\n findTextInRoot(scopeRoot, fastNeedle, fastExact, mainCtx, pushHit);\n if (hits.length > 0) return hits;\n }\n }\n\n var roots = [];\n collectRoots(scopeRoot, baseOffsetX, baseOffsetY, baseScaleX, baseScaleY, baseInShadow, baseInIframe, roots);\n for (var r = 0; r < roots.length; r++) {\n var ctx = roots[r];\n var root = ctx.root;\n if (!root || !root.querySelectorAll) continue;\n if (typeof sel === \"object\" && sel !== null && \"testID\" in sel) {\n var tid = esc(sel.testID);\n var found = root.querySelectorAll('[data-testid=\"' + tid + '\"], [testID=\"' + tid + '\"]');\n for (var i = 0; i < found.length; i++) pushHit(found[i], ctx);\n } else if (typeof sel === \"object\" && sel !== null && \"css\" in sel) {\n var foundCss = queryCssSafe(root, sel.css);\n for (var ci2 = 0; ci2 < foundCss.length; ci2++) pushHit(foundCss[ci2], ctx);\n } else if (typeof sel === \"object\" && sel !== null && \"accessibilityLabel\" in sel) {\n var lbl = esc(sel.accessibilityLabel);\n var foundLbl = root.querySelectorAll('[aria-label=\"' + lbl + '\"]');\n for (var j = 0; j < foundLbl.length; j++) pushHit(foundLbl[j], ctx);\n } else if (typeof sel === \"object\" && sel !== null && \"label\" in sel) {\n findByLabelInRoot(root, sel.label, Boolean(sel.exact), ctx, pushHit);\n } else if (typeof sel === \"object\" && sel !== null && \"placeholder\" in sel) {\n findByAttrSpecInRoot(root, \"placeholder\", sel.placeholder, Boolean(sel.exact), ctx, pushHit);\n } else if (typeof sel === \"object\" && sel !== null && \"altText\" in sel) {\n findByAttrSpecInRoot(root, \"alt\", sel.altText, Boolean(sel.exact), ctx, pushHit);\n } else if (typeof sel === \"object\" && sel !== null && \"title\" in sel) {\n findByAttrSpecInRoot(root, \"title\", sel.title, Boolean(sel.exact), ctx, pushHit);\n } else if (typeof sel === \"object\" && sel !== null && \"role\" in sel) {\n findRoleInRoot(root, String(sel.role).toLowerCase(), sel.name, sel.exact, ctx, pushHit, sel.includeHidden, sel.level, sel.pressed);\n } else if (typeof sel === \"string\" || (typeof sel === \"object\" && sel !== null && \"text\" in sel)) {\n var needle = typeof sel === \"string\" ? sel : sel.text;\n var isExact = typeof sel === \"object\" && sel !== null && Boolean(sel.exact);\n findTextInRoot(root, needle, isExact, ctx, pushHit);\n }\n }\n return applyModifiersAndSlice(hits, sel, preferVisible);\n }\n function findWasmSemanticHits(sel) {\n if (typeof window === \"undefined\" || !window.__SPANA_WASM_TREE__) return [];\n var provider = window.__SPANA_WASM_TREE__;\n var nodes;\n try { nodes = typeof provider === \"function\" ? provider() : provider; } catch (e) { return []; }\n if (!Array.isArray(nodes) || nodes.length === 0) return [];\n var matched = [];\n for (var i = 0; i < nodes.length; i++) {\n var n = nodes[i];\n if (!n || typeof n !== \"object\" || !n.bounds) continue;\n var nid = n.testID || n.id || \"\";\n var ntext = String(n.text != null ? n.text : (n.label != null ? n.label : \"\"));\n var nlabel = String(n.label != null ? n.label : \"\");\n var nrole = String(n.role || \"\");\n var ok = false;\n if (typeof sel === \"string\") {\n ok = nid === sel || ntext === sel;\n } else if (sel && typeof sel === \"object\") {\n if (sel.testID !== undefined) {\n ok = nid === sel.testID;\n } else if (sel.text !== undefined) {\n ok = sel.exact ? ntext.trim() === String(sel.text).trim() : ntext.indexOf(String(sel.text)) !== -1;\n } else if (sel.accessibilityLabel !== undefined) {\n ok = nlabel === sel.accessibilityLabel || ntext === sel.accessibilityLabel;\n } else if (sel.role !== undefined) {\n var rOk = nrole.toLowerCase() === String(sel.role).toLowerCase();\n var nameOk = true;\n if (sel.name !== undefined) {\n if (typeof sel.name === \"object\" && sel.name && sel.name.__regex) {\n var re = new RegExp(sel.name.source, sel.name.flags || \"\");\n nameOk = re.test(ntext) || re.test(nlabel);\n } else {\n var exp = String(sel.name);\n nameOk = sel.exact\n ? (ntext.trim() === exp.trim() || nlabel.trim() === exp.trim())\n : (ntext.toLowerCase().indexOf(exp.toLowerCase()) !== -1 || nlabel.toLowerCase().indexOf(exp.toLowerCase()) !== -1);\n }\n }\n ok = rOk && nameOk;\n }\n }\n if (!ok) continue;\n var ox = 0;\n var oy = 0;\n var hostEl = null;\n if (n.canvasSelector && typeof document !== \"undefined\" && document.querySelector) {\n try {\n hostEl = document.querySelector(n.canvasSelector);\n if (hostEl && typeof hostEl.getBoundingClientRect === \"function\") {\n var cr = hostEl.getBoundingClientRect();\n ox = cr.left || 0;\n oy = cr.top || 0;\n }\n } catch (e) {}\n }\n var bx = (n.bounds.x || 0) + ox;\n var by = (n.bounds.y || 0) + oy;\n var bw = n.bounds.width || 0;\n var bh = n.bounds.height || 0;\n var vRect = { left: bx, top: by, x: bx, y: by, width: bw, height: bh, right: bx + bw, bottom: by + bh };\n var virtualEl = {\n isConnected: true,\n tagName: \"WASM-NODE\",\n innerText: ntext,\n textContent: ntext,\n value: n.value,\n __spanaHostCanvas: hostEl,\n getBoundingClientRect: function() { return vRect; },\n getAttribute: function(k) {\n if (k === \"data-testid\" || k === \"testID\") return nid || null;\n if (k === \"role\") return nrole || null;\n if (k === \"aria-label\") return nlabel || null;\n return (n.attributes && n.attributes[k]) || null;\n },\n hasAttribute: function(k) { return this.getAttribute(k) !== null; }\n };\n matched.push({ el: virtualEl, offsetX: 0, offsetY: 0, inShadow: false, inIframe: false, wasmNode: n, wasmRect: vRect });\n }\n return matched;\n }\n function findAcrossRoots(sel, preferVisible) {\n var pv = preferVisible === undefined ? \"prefer\" : preferVisible;\n var domHits = findInScope(sel, document, 0, 0, 1, 1, false, false, pv);\n var wasmHits = findWasmSemanticHits(sel);\n if (wasmHits.length === 0) return domHits;\n return domHits.length === 0 ? wasmHits : domHits.concat(wasmHits);\n }\n function isClickable(el) {\n var tag = el.tagName;\n if (tag === \"BUTTON\" || tag === \"A\" || tag === \"INPUT\" || tag === \"SELECT\" || tag === \"TEXTAREA\") return true;\n var role = el.getAttribute && el.getAttribute(\"role\");\n if (role === \"button\" || role === \"link\" || role === \"tab\" || role === \"checkbox\" || role === \"switch\") return true;\n if (typeof el.onclick === \"function\") return true;\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var cursor = win.getComputedStyle(el).cursor;\n return cursor === \"pointer\";\n }\n function isAppReady() {\n var sig = typeof window !== \"undefined\" ? window.__SPANA_APP_READY__ : undefined;\n if (typeof sig === \"function\") {\n try { return Boolean(sig()); } catch (e) { return false; }\n }\n if (typeof sig === \"boolean\") return sig;\n return true;\n }\n function deepElementFromPoint(rootDoc, x, y) {\n if (!rootDoc || typeof rootDoc.elementFromPoint !== \"function\") return null;\n var el = rootDoc.elementFromPoint(x, y);\n var guard = 0;\n while (el && guard++ < 16) {\n if (el.shadowRoot && typeof el.shadowRoot.elementFromPoint === \"function\") {\n var inner = el.shadowRoot.elementFromPoint(x, y);\n if (inner && inner !== el) { el = inner; continue; }\n }\n if (el.tagName === \"IFRAME\") {\n try {\n var fdoc = el.contentDocument;\n if (fdoc && typeof fdoc.elementFromPoint === \"function\") {\n var ft = getIframeTransform(el);\n var fx = (x - ft.left) / ft.scaleX;\n var fy = (y - ft.top) / ft.scaleY;\n var fEl = fdoc.elementFromPoint(fx, fy);\n if (fEl && fEl !== el) { el = fEl; x = fx; y = fy; continue; }\n }\n } catch (e) {}\n }\n break;\n }\n return el;\n }\n function labelControlOf(node) {\n var cur = node;\n var guard = 0;\n while (cur && guard++ < 8) {\n if (cur.tagName === \"LABEL\") return cur.control || null;\n cur = cur.parentElement;\n }\n return null;\n }\n function isSameOrDescendant(target, candidate) {\n if (!target || !candidate) return false;\n if (target === candidate) return true;\n try {\n if (typeof target.contains === \"function\" && target.contains(candidate)) return true;\n } catch (e) {}\n if (labelControlOf(candidate) === target) return true;\n var cur = candidate;\n var guard = 0;\n while (cur && guard++ < 24) {\n if (cur === target) return true;\n var root = typeof cur.getRootNode === \"function\" ? cur.getRootNode() : null;\n if (root && root.host) {\n cur = root.host;\n } else {\n cur = cur.parentElement;\n }\n }\n return false;\n }\n function describeEl(el) {\n if (!el) return \"(unknown)\";\n var tag = el.tagName ? el.tagName.toLowerCase() : \"element\";\n var idPart = el.id ? \"#\" + el.id : \"\";\n var cls = typeof el.className === \"string\" ? el.className.trim().split(/\\s+/).filter(Boolean).slice(0, 3).join(\".\") : \"\";\n var clsPart = cls ? \".\" + cls : \"\";\n var txt = (el.innerText || el.textContent || \"\").replace(/\\s+/g, \" \").trim();\n if (txt.length > 40) txt = txt.slice(0, 37) + \"...\";\n return \"<\" + tag + idPart + clsPart + (txt ? \">\" + txt + \"</\" + tag + \">\" : \">\");\n }\n function getHitTestBlocker(hit) {\n if (hit.wasmNode) {\n var wr = hit.wasmRect;\n var wvw = (window.visualViewport && window.visualViewport.width) || window.innerWidth || 0;\n var wvh = (window.visualViewport && window.visualViewport.height) || window.innerHeight || 0;\n var wcx = wr.left + wr.width / 2;\n var wcy = wr.top + wr.height / 2;\n if (wvw > 0 && wvh > 0 && (wcx < 0 || wcy < 0 || wcx > wvw || wcy > wvh)) return \"outside viewport\";\n if (hit.el && hit.el.__spanaHostCanvas) {\n var topW = deepElementFromPoint(document, wcx, wcy);\n if (topW && !isSameOrDescendant(hit.el.__spanaHostCanvas, topW)) return describeEl(topW);\n }\n return null;\n }\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var winForRect = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var styleForRect = winForRect && winForRect.getComputedStyle ? winForRect.getComputedStyle(el) : null;\n if (styleForRect && styleForRect.display === \"contents\") {\n var contentsRect = getContentsUnionRect(el, 0);\n if (contentsRect) rect = contentsRect;\n }\n var sx = hit.scaleX != null ? hit.scaleX : 1;\n var sy = hit.scaleY != null ? hit.scaleY : 1;\n var vw = (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0;\n var vh = (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0;\n var cx = hit.offsetX + (rect.left + rect.width / 2) * sx;\n var cy = hit.offsetY + (rect.top + rect.height / 2) * sy;\n if (vw > 0 && vh > 0 && (cx < 0 || cy < 0 || cx > vw || cy > vh)) {\n return \"outside viewport\";\n }\n var topEl = deepElementFromPoint(document, cx, cy);\n if (!topEl) return null;\n if (isSameOrDescendant(el, topEl)) return null;\n return describeEl(topEl);\n }\n function getClippedViewportBox(hit) {\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var winForRect = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var styleForRect = winForRect && winForRect.getComputedStyle ? winForRect.getComputedStyle(el) : null;\n if (styleForRect && styleForRect.display === \"contents\") {\n var contentsRect = getContentsUnionRect(el, 0);\n if (contentsRect) rect = contentsRect;\n }\n var sx = hit.scaleX != null ? hit.scaleX : 1;\n var sy = hit.scaleY != null ? hit.scaleY : 1;\n var left = hit.offsetX + rect.left * sx;\n var top = hit.offsetY + rect.top * sy;\n var right = hit.offsetX + (rect.left + rect.width) * sx;\n var bottom = hit.offsetY + (rect.top + rect.height) * sy;\n // Intersect with clipping ancestors (overflow: hidden/clip/scroll/auto) so half-clipped buttons\n // target their visible region rather than clicking a clipped-out center onto the parent container.\n // Only ancestors on the containing-block chain clip: a position: fixed box escapes all but a\n // transformed/contained ancestor (and a top-layer <dialog>/popover escapes all of them); a\n // position: absolute box escapes the static ancestors between it and its positioned one.\n var cur = el.parentElement;\n var guard = 0;\n var cbMode = clipEscapeMode(el, styleForRect);\n while (cur && cbMode !== \"top\" && guard++ < 32) {\n var cs = winForRect && winForRect.getComputedStyle ? winForRect.getComputedStyle(cur) : null;\n if (cs && !(cbMode === \"fixed\" ? formsFixedContainingBlock(cs)\n : cbMode === \"absolute\" ? (cs.position !== \"static\" || formsFixedContainingBlock(cs)) : true)) {\n cs = null;\n }\n if (cs) {\n cbMode = clipEscapeMode(cur, cs);\n var ox = cs.overflowX || cs.overflow || \"\";\n var oy = cs.overflowY || cs.overflow || \"\";\n if (ox === \"hidden\" || ox === \"clip\" || ox === \"scroll\" || ox === \"auto\" ||\n oy === \"hidden\" || oy === \"clip\" || oy === \"scroll\" || oy === \"auto\") {\n var cr = cur.getBoundingClientRect();\n if (cr.width > 0 && cr.height > 0) {\n var cLeft = hit.offsetX + cr.left * sx;\n var cTop = hit.offsetY + cr.top * sy;\n var cRight = hit.offsetX + cr.right * sx;\n var cBottom = hit.offsetY + cr.bottom * sy;\n if (ox === \"hidden\" || ox === \"clip\" || ox === \"scroll\" || ox === \"auto\") {\n if (cLeft > left) left = cLeft;\n if (cRight < right) right = cRight;\n }\n if (oy === \"hidden\" || oy === \"clip\" || oy === \"scroll\" || oy === \"auto\") {\n if (cTop > top) top = cTop;\n if (cBottom < bottom) bottom = cBottom;\n }\n }\n }\n }\n cur = cur.parentElement;\n }\n var vw = (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0;\n var vh = (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0;\n if (vw > 0 && vh > 0) {\n if (left < 0) left = 0;\n if (top < 0) top = 0;\n if (right > vw) right = vw;\n if (bottom > vh) bottom = vh;\n }\n return { left: left, top: top, right: right, bottom: bottom, vw: vw, vh: vh, rawRect: rect, sx: sx, sy: sy };\n }\n // How a box escapes the overflow clip of its ancestors: \"top\" (top layer: none clip it),\n // \"fixed\", \"absolute\", or \"flow\" (every ancestor clips).\n function clipEscapeMode(node, cs) {\n try {\n if (node.matches && node.matches(\":modal, :popover-open\")) return \"top\";\n } catch (e) {}\n var pos = cs ? cs.position : \"static\";\n return pos === \"fixed\" || pos === \"absolute\" ? pos : \"flow\";\n }\n function formsFixedContainingBlock(cs) {\n if (cs.transform && cs.transform !== \"none\") return true;\n if (cs.perspective && cs.perspective !== \"none\") return true;\n if (cs.filter && cs.filter !== \"none\") return true;\n if (cs.backdropFilter && cs.backdropFilter !== \"none\") return true;\n if (/paint|layout|strict|content/.test(cs.contain || \"\")) return true;\n if (cs.containerType && cs.containerType !== \"normal\") return true;\n if (/transform|perspective|filter/.test(cs.willChange || \"\")) return true;\n return false;\n }\n function findClickablePoint(hit) {\n if (hit.wasmNode) {\n var wr = hit.wasmRect;\n return { x: wr.left + wr.width / 2, y: wr.top + wr.height / 2 };\n }\n var el = hit.el;\n var box = getClippedViewportBox(hit);\n var rawCx = hit.offsetX + (box.rawRect.left + box.rawRect.width / 2) * box.sx;\n var rawCy = hit.offsetY + (box.rawRect.top + box.rawRect.height / 2) * box.sy;\n var clipW = box.right - box.left;\n var clipH = box.bottom - box.top;\n if (box.vw > 0 && box.vh > 0 && (clipW <= 0 || clipH <= 0)) {\n return null;\n }\n var tryPt = function(px, py) {\n if (box.vw > 0 && box.vh > 0 && (px < 0 || py < 0 || px >= box.vw || py >= box.vh)) return null;\n var topEl = deepElementFromPoint(document, px, py);\n if (!topEl || isSameOrDescendant(el, topEl)) return { x: px, y: py };\n return null;\n };\n // 1. Fast path: the exact center, as Playwright clicks it (rounding moves the point up to\n // 0.5px, e.g. across a line boundary in a textarea, which moves the caret), then rounded.\n var rExact = tryPt(rawCx, rawCy);\n if (rExact) return rExact;\n var rRaw = tryPt(Math.round(rawCx), Math.round(rawCy));\n if (rRaw) return rRaw;\n // 2. Clipped visible center (rounded, then fractional)\n var cx = box.left + clipW / 2;\n var cy = box.top + clipH / 2;\n var rClip = tryPt(Math.round(cx), Math.round(cy));\n if (rClip) return rClip;\n var fClip = tryPt(cx, cy);\n if (fClip) return fClip;\n // 3. Interior points inside the visible clipped rect (handles 0.5px edge rounding onto clipping parent)\n var padX = Math.min(2, clipW / 4);\n var padY = Math.min(2, clipH / 4);\n var candidates = [\n [Math.floor(cx), Math.floor(cy)],\n [Math.ceil(cx), Math.floor(cy)],\n [Math.floor(cx), Math.ceil(cy)],\n [Math.floor(box.left + padX), Math.floor(box.top + padY)],\n [Math.ceil(box.left + padX), Math.ceil(box.top + padY)],\n [Math.floor(box.right - padX), Math.floor(box.bottom - padY)],\n [box.left + padX, box.top + padY],\n [box.right - padX, box.bottom - padY],\n ];\n for (var i = 0; i < candidates.length; i++) {\n var hitPt = tryPt(candidates[i][0], candidates[i][1]);\n if (hitPt) return hitPt;\n }\n // 4. A 5x5 grid over the visible box: a target whose centre and corners are covered (a toast,\n // a sticky bar) is still clicked where it shows, instead of scrolling it \u2014 which would\n // close a popover that closes on scroll (1.18).\n for (var gy = 0; gy < 5; gy++) {\n for (var gx = 0; gx < 5; gx++) {\n var gridPt = tryPt(box.left + clipW * (0.1 + 0.2 * gx), box.top + clipH * (0.1 + 0.2 * gy));\n if (gridPt) return gridPt;\n }\n }\n return null;\n }\n function isHitTestClear(hit) {\n if (hit.wasmNode) {\n return getHitTestBlocker(hit) === null;\n }\n var pt = findClickablePoint(hit);\n if (pt) {\n hit._clickPoint = pt;\n return true;\n }\n hit._clickPoint = null;\n return false;\n }\n function isScrollableOverflow(val) {\n return val === \"auto\" || val === \"scroll\" || val === \"overlay\";\n }\n function isClippedByScrollableAncestor(hit, rect) {\n var el = hit.el;\n var doc = el.ownerDocument || document;\n var win = doc.defaultView || window;\n var cur = el.parentElement;\n var guard = 0;\n while (cur && cur.nodeType === 1 && guard++ < 32) {\n if (cur === doc.documentElement || cur === doc.body) break;\n var cs = win && win.getComputedStyle ? win.getComputedStyle(cur) : null;\n if (cs) {\n var ox = cs.overflowX || cs.overflow || \"\";\n var oy = cs.overflowY || cs.overflow || \"\";\n var canScrollX = isScrollableOverflow(ox) && cur.scrollWidth > cur.clientWidth + 1;\n var canScrollY = isScrollableOverflow(oy) && cur.scrollHeight > cur.clientHeight + 1;\n if (canScrollX || canScrollY) {\n var cr = cur.getBoundingClientRect();\n if (cr.width > 0 && cr.height > 0) {\n if (canScrollX && (rect.left < cr.left - 0.5 || rect.right > cr.right + 0.5)) {\n return true;\n }\n if (canScrollY && (rect.top < cr.top - 0.5 || rect.bottom > cr.bottom + 0.5)) {\n return true;\n }\n }\n }\n // Inspect a position: fixed ancestor itself FIRST (it may be scrollable),\n // then stop walking above its fixed containing boundary.\n if (cs.position === \"fixed\") break;\n }\n cur = cur.parentElement;\n }\n return false;\n }\n function isFullyInViewport(hit) {\n if (hit.wasmNode) return true;\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var winForRect = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var styleForRect = winForRect && winForRect.getComputedStyle ? winForRect.getComputedStyle(el) : null;\n if (styleForRect && styleForRect.display === \"contents\") {\n var contentsRect = getContentsUnionRect(el, 0);\n if (contentsRect) rect = contentsRect;\n }\n var sx = hit.scaleX != null ? hit.scaleX : 1;\n var sy = hit.scaleY != null ? hit.scaleY : 1;\n var vw = (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0;\n var vh = (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0;\n if (vw <= 0 || vh <= 0 || rect.width <= 0 || rect.height <= 0) return false;\n var left = hit.offsetX + rect.left * sx;\n var top = hit.offsetY + rect.top * sy;\n if (!(left >= 0 && top >= 0 && (left + rect.width * sx) <= vw && (top + rect.height * sy) <= vh)) {\n return false;\n }\n if (isClippedByScrollableAncestor(hit, rect)) return false;\n return true;\n }\n function ensureInViewport(hit) {\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var winForRect = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var styleForRect = winForRect && winForRect.getComputedStyle ? winForRect.getComputedStyle(el) : null;\n if (styleForRect && styleForRect.display === \"contents\") {\n var contentsRect = getContentsUnionRect(el, 0);\n if (contentsRect) rect = contentsRect;\n }\n var sx = hit.scaleX != null ? hit.scaleX : 1;\n var sy = hit.scaleY != null ? hit.scaleY : 1;\n var vw = (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0;\n var vh = (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0;\n var cx = hit.offsetX + (rect.left + rect.width / 2) * sx;\n var cy = hit.offsetY + (rect.top + rect.height / 2) * sy;\n var outsideWindow = vw > 0 && vh > 0 && (cx < 1 || cy < 1 || cx > vw - 1 || cy > vh - 1);\n if (outsideWindow || isClippedByScrollableAncestor(hit, rect)) {\n if (typeof el.scrollIntoView === \"function\") {\n try { el.scrollIntoView({ block: \"center\", inline: \"center\", behavior: \"instant\" }); }\n catch (e) { try { el.scrollIntoView(true); } catch (e2) {} }\n }\n return true;\n }\n return false;\n }\n function canScrollToUnobscure(hit) {\n if (!hit || !hit.el || hit.wasmNode) return false;\n var el = hit.el;\n var doc = el.ownerDocument || document;\n var win = doc.defaultView || window;\n var hasScrollableAncestor = false;\n var hitFixedBoundary = false;\n var cur = el;\n var guard = 0;\n while (cur && cur.nodeType === 1 && guard++ < 32) {\n var cs = win && win.getComputedStyle ? win.getComputedStyle(cur) : null;\n if (cs) {\n if (cur !== el && cur !== doc.documentElement && cur !== doc.body) {\n var ox = cs.overflowX || cs.overflow || \"\";\n var oy = cs.overflowY || cs.overflow || \"\";\n if ((isScrollableOverflow(ox) && cur.scrollWidth > cur.clientWidth + 1) ||\n (isScrollableOverflow(oy) && cur.scrollHeight > cur.clientHeight + 1)) {\n hasScrollableAncestor = true;\n }\n }\n if (cs.position === \"fixed\") {\n hitFixedBoundary = true;\n break;\n }\n }\n cur = cur.parentElement;\n }\n var rect = el.getBoundingClientRect();\n // If clipped outside a scrollable ancestor (including inside/on a position: fixed dialog),\n // scrolling that ancestor brings the target into view even if the clipped point hits a backdrop.\n if (hasScrollableAncestor && isClippedByScrollableAncestor(hit, rect)) {\n return true;\n }\n if (hitFixedBoundary && !hasScrollableAncestor) return false;\n var cx = rect.left + rect.width / 2;\n var cy = rect.top + rect.height / 2;\n var topEl = deepElementFromPoint(doc, cx, cy);\n if (!topEl) return false;\n var vpW = win.innerWidth || doc.documentElement.clientWidth || 1280;\n var vpH = win.innerHeight || doc.documentElement.clientHeight || 720;\n var b = topEl;\n while (b && b.nodeType === 1) {\n var bs = win && win.getComputedStyle ? win.getComputedStyle(b) : null;\n if (bs && (bs.position === \"fixed\" || bs.position === \"sticky\")) {\n var br = b.getBoundingClientRect();\n if (br.width >= vpW * 0.8 && br.height >= vpH * 0.8) return false;\n return true;\n }\n b = b.parentElement;\n }\n return false;\n }\n function scrollToUnobscure(hit) {\n var el = hit.el;\n if (typeof el.scrollIntoView !== \"function\") return false;\n var blocks = [\"center\", \"end\", \"start\", \"nearest\"];\n for (var i = 0; i < blocks.length; i++) {\n try {\n el.scrollIntoView({ block: blocks[i], inline: \"center\", behavior: \"instant\" });\n } catch (e) {\n try { el.scrollIntoView(true); } catch (e2) {}\n }\n if (!el.isConnected) {\n try { window.__spanaLastScrollDetached = true; } catch (e3) {}\n return false;\n }\n if (isHitTestClear(hit)) return true;\n }\n return false;\n }\n function hasActiveViewTransition() {\n if (typeof document === \"undefined\" || typeof document.getAnimations !== \"function\") return false;\n try {\n var allAnims = document.getAnimations();\n for (var i = 0; i < allAnims.length; i++) {\n var a = allAnims[i];\n var pseudo = a && a.effect && a.effect.pseudoElement;\n if (a && a.playState === \"running\" && typeof pseudo === \"string\" && pseudo.indexOf(\"::view-transition\") === 0) {\n return true;\n }\n }\n } catch (e) {}\n return false;\n }\n function hasActiveAnimation(el) {\n if (hasActiveViewTransition()) return true;\n var cur = el;\n var depth = 0;\n while (cur && depth++ < 8) {\n if (typeof cur.getAnimations === \"function\") {\n try {\n var anims = cur.getAnimations();\n for (var i = 0; i < anims.length; i++) {\n if (anims[i] && anims[i].playState === \"running\") return true;\n }\n } catch (e) {}\n }\n cur = cur.parentElement;\n }\n return false;\n }\n function isElementEnabled(el) {\n if (!el) return true;\n if (el.hasAttribute && el.hasAttribute(\"disabled\")) return false;\n if (el.getAttribute && el.getAttribute(\"aria-disabled\") === \"true\") return false;\n try {\n if (typeof el.matches === \"function\" && el.matches(\":disabled\")) return false;\n } catch (e) {}\n var cur = el.parentElement;\n var guard = 0;\n while (cur && guard++ < 16) {\n if (cur.getAttribute && cur.getAttribute(\"aria-disabled\") === \"true\") return false;\n cur = cur.parentElement;\n }\n return true;\n }\n function isVisible(el, rect, depth) {\n if (!el) return false;\n if (isVisiblyHiddenInAncestorChain(el)) return false;\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var style = win && win.getComputedStyle ? win.getComputedStyle(el) : null;\n if (style && style.display === \"contents\") {\n return hasVisibleDescendant(el, depth || 0);\n }\n if (!rect || rect.width <= 0 || rect.height <= 0) return false;\n return true;\n }\n function getVisibilityFailureReason(el, rect) {\n if (!el) return \"element is null\";\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var cur = el;\n var guard = 0;\n while (cur && guard++ < 48) {\n if (cur.nodeType === 1 && win && win.getComputedStyle) {\n var cs = win.getComputedStyle(cur);\n if (cs) {\n if (cs.display === \"none\") return cur === el ? \"display: none\" : \"ancestor has display: none\";\n if (cs.contentVisibility === \"hidden\") return cur === el ? \"content-visibility: hidden\" : \"ancestor has content-visibility: hidden\";\n }\n }\n var root = typeof cur.getRootNode === \"function\" ? cur.getRootNode() : null;\n cur = cur.parentElement || (root && root.host) || null;\n }\n if (el.nodeType === 1 && win && win.getComputedStyle) {\n var selfCs = win.getComputedStyle(el);\n if (selfCs && (selfCs.visibility === \"hidden\" || selfCs.visibility === \"collapse\")) return \"visibility: \" + selfCs.visibility;\n if (selfCs && selfCs.display === \"contents\" && !hasVisibleDescendant(el, 0)) return \"display: contents with no visible children\";\n }\n if (!rect || rect.width <= 0 || rect.height <= 0) return \"bounding box has zero size (\" + (rect ? Math.round(rect.width) + \"x\" + Math.round(rect.height) : \"none\") + \")\";\n return null;\n }\n function toMatch(hit) {\n if (hit.wasmNode) {\n var wn = hit.wasmNode;\n var wr = hit.wasmRect;\n var wtext = (wn.text != null ? String(wn.text) : (wn.label != null ? String(wn.label) : \"\")).trim() || undefined;\n return {\n id: wn.testID || wn.id || undefined,\n tag: \"wasm-node\",\n role: wn.role || undefined,\n text: wtext,\n textContent: wtext,\n value: wn.value != null ? String(wn.value) : undefined,\n accessibilityLabel: wn.label || undefined,\n accessibleName: wn.label || wtext,\n rect: { x: wr.left, y: wr.top, width: wr.width, height: wr.height },\n scrollX: window.scrollX || 0,\n scrollY: window.scrollY || 0,\n devicePixelRatio: window.devicePixelRatio || 1,\n viewportWidth: window.innerWidth || 0,\n viewportHeight: window.innerHeight || 0,\n visible: wn.visible !== false && wr.width > 0 && wr.height > 0,\n enabled: wn.enabled !== false,\n clickable: wn.clickable !== undefined ? Boolean(wn.clickable) : (wn.role === \"button\" || wn.role === \"link\"),\n focused: wn.focused,\n checked: wn.checked,\n editable: wn.editable,\n empty: wn.value !== undefined ? String(wn.value).length === 0 : !wtext,\n attributes: wn.attributes || {},\n inShadowDom: false,\n inIframe: false\n };\n }\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var winForRect = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var styleForRect = winForRect && winForRect.getComputedStyle ? winForRect.getComputedStyle(el) : null;\n if (styleForRect && styleForRect.display === \"contents\") {\n var contentsRect = getContentsUnionRect(el, 0);\n if (contentsRect) rect = contentsRect;\n }\n var attrs = {};\n if (el.attributes) {\n for (var i = 0; i < el.attributes.length; i++) {\n attrs[el.attributes[i].name] = el.attributes[i].value;\n }\n }\n var tag = el.tagName ? el.tagName.toLowerCase() : undefined;\n var val = (el.tagName === \"INPUT\" || el.tagName === \"TEXTAREA\" || el.tagName === \"SELECT\")\n ? String(el.value ?? \"\")\n : undefined;\n var text = normWs(el.innerText || el.textContent || \"\") || undefined;\n var normTextContent = normWs(el.textContent || \"\") || undefined;\n var accName = getAccessibleName(el) || undefined;\n var accDesc = getAccessibleDescription(el) || undefined;\n var role = getImplicitRole(el) || undefined;\n var isEnabled = isElementEnabled(el);\n // An element inside a <label> (or the label itself) reports the checked state of the\n // label's control, Playwright's \"follow-label\" retargeting: check()/toBeChecked() on a\n // label verify the checkbox/radio it toggles.\n var checkSource = el;\n if (!el.isContentEditable && !(el.matches && el.matches(\"a, input, textarea, button, select, [role=link], [role=button], [role=checkbox], [role=switch], [role=radio]\"))) {\n var enclosingLabel = el.closest ? el.closest(\"label\") : null;\n if (enclosingLabel && enclosingLabel.control) checkSource = enclosingLabel.control;\n }\n var isChecked =\n checkSource.tagName === \"INPUT\" && (checkSource.type === \"checkbox\" || checkSource.type === \"radio\")\n ? Boolean(checkSource.checked)\n : el.getAttribute(\"aria-checked\") === \"true\"\n ? true\n : el.getAttribute(\"aria-checked\") === \"false\"\n ? false\n : undefined;\n var isEditable = Boolean(\n isEnabled &&\n !el.hasAttribute(\"readonly\") &&\n el.getAttribute(\"aria-readonly\") !== \"true\" &&\n (el.isContentEditable ||\n el.tagName === \"TEXTAREA\" ||\n el.tagName === \"SELECT\" ||\n (el.tagName === \"INPUT\" &&\n [\"button\", \"submit\", \"reset\", \"image\", \"hidden\", \"checkbox\", \"radio\"].indexOf(\n String(el.type || \"text\").toLowerCase(),\n ) === -1)),\n );\n var isEmpty =\n el.tagName === \"INPUT\" || el.tagName === \"TEXTAREA\"\n ? String(el.value || \"\").length === 0\n : (el.textContent || \"\").trim().length === 0;\n var clsName = typeof el.className === \"string\" ? el.className : (el.getAttribute(\"class\") || \"\");\n var sx = hit.scaleX != null ? hit.scaleX : 1;\n var sy = hit.scaleY != null ? hit.scaleY : 1;\n return {\n id: el.getAttribute(\"data-testid\") || el.getAttribute(\"testID\") || undefined,\n tag: tag,\n role: role,\n text: text,\n textContent: normTextContent,\n value: val,\n accessibilityLabel: el.getAttribute(\"aria-label\") || undefined,\n accessibleName: accName,\n accessibleDescription: accDesc,\n rect: { x: hit.offsetX + rect.x * sx, y: hit.offsetY + rect.y * sy, width: rect.width * sx, height: rect.height * sy },\n clickPoint: hit._clickPoint || undefined,\n scrollX: window.scrollX || window.pageXOffset || 0,\n scrollY: window.scrollY || window.pageYOffset || 0,\n devicePixelRatio: window.devicePixelRatio || 1,\n viewportWidth: (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0,\n viewportHeight: (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0,\n visible: isVisible(el, rect),\n transparent: isTransparent(el) || undefined,\n enabled: isEnabled,\n clickable: isClickable(el),\n focused: isFocusedEl(el),\n checked: isChecked,\n editable: isEditable,\n empty: isEmpty,\n className: clsName || undefined,\n attributes: attrs,\n inShadowDom: hit.inShadow || undefined,\n inIframe: hit.inIframe || undefined\n };\n }\n\n\n function query(sel) {\n return findAcrossRoots(sel).map(toMatch);\n }\n\n function scrollIntoView(sel) {\n var hits = findAcrossRoots(sel);\n if (hits.length === 0) return null;\n var hit = hits[hits.length - 1];\n if (typeof hit.el.scrollIntoView === \"function\") {\n try { hit.el.scrollIntoView({ block: \"center\", inline: \"center\", behavior: \"instant\" }); }\n catch (e) { try { hit.el.scrollIntoView(true); } catch (e2) {} }\n }\n return toMatch(hit);\n }\n\n function tap(sel) {\n var hits = findAcrossRoots(sel, \"strict\");\n var usable = [];\n for (var i = 0; i < hits.length; i++) {\n var m = toMatch(hits[i]);\n if (m.visible && m.enabled) usable.push(hits[i]);\n }\n if (usable.length === 0) return false;\n var hit = usable[pickActionIndex(usable, function(h) { return h.el; })];\n var el = hit.el;\n if (typeof el.scrollIntoView === \"function\") {\n try { el.scrollIntoView({ block: \"center\", inline: \"center\", behavior: \"instant\" }); } catch (e) {}\n }\n if (!el.isConnected) return false;\n var postMatch = toMatch(hit);\n if (!postMatch.visible || !postMatch.enabled) return false;\n var rect = el.getBoundingClientRect();\n var cx = rect.left + rect.width / 2;\n var cy = rect.top + rect.height / 2;\n var init = { bubbles: true, cancelable: true, composed: true, clientX: cx, clientY: cy };\n try { el.dispatchEvent(new PointerEvent(\"pointerdown\", init)); } catch (e) {}\n try { el.dispatchEvent(new MouseEvent(\"mousedown\", init)); } catch (e) {}\n if (typeof el.focus === \"function\") { try { el.focus(); } catch (e) {} }\n try { el.dispatchEvent(new PointerEvent(\"pointerup\", init)); } catch (e) {}\n try { el.dispatchEvent(new MouseEvent(\"mouseup\", init)); } catch (e) {}\n if (typeof el.click === \"function\") { el.click(); }\n else { el.dispatchEvent(new MouseEvent(\"click\", init)); }\n return true;\n }\n\n function waitForSelector(sel, opts) {\n opts = opts || {};\n var timeoutMs = Math.max(10, Math.round(opts.timeoutMs != null ? opts.timeoutMs : 5000));\n var forAction = Boolean(opts.forAction);\n var force = Boolean(opts.force);\n var failFastWhenIdle = Boolean(opts.failFastWhenIdle);\n var idleQuietMs = Math.max(50, Math.round(opts.idleQuietMs != null ? opts.idleQuietMs : 250));\n var reqStableFrames = force ? 0 : (opts.stableFrames !== undefined ? Math.max(0, Math.round(opts.stableFrames)) : (forAction ? 2 : 0));\n var checkHitTest = force ? false : (opts.checkHitTest !== undefined ? Boolean(opts.checkHitTest) : forAction);\n var waitForAppReady = opts.waitForAppReady !== undefined ? Boolean(opts.waitForAppReady) : true;\n var armTapGuard = Boolean(opts.armTapGuard && forAction && !force);\n if (failFastWhenIdle && !opts.hostTracksNetwork) ensureNetworkTracker();\n var instantAnim = Boolean(typeof document !== \"undefined\" && document.getElementById && document.getElementById(\"__spana_instant_anim\"));\n var explicitStableFrames = (instantAnim || force) ? 0 : reqStableFrames;\n\n function armTapGuardOnEl(el) {\n if (!armTapGuard || !el || el.nodeType !== 1) return;\n try {\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var doc = el.ownerDocument || document;\n if (window.__spanaTapGuardCleanup) window.__spanaTapGuardCleanup();\n window.__spanaTapMissed = false;\n var matchTarget = function(t) {\n return isSameOrDescendant(el, t);\n };\n var cleanup = function() {\n win.removeEventListener(\"pointerdown\", onEvt, true);\n win.removeEventListener(\"mousedown\", onEvt, true);\n win.removeEventListener(\"mouseup\", onMouseUp, true);\n win.removeEventListener(\"click\", onEvt, true);\n if (window.__spanaTapGuardCleanup === cleanup) delete window.__spanaTapGuardCleanup;\n };\n var onMouseUp = function(e) {\n if (!e.isTrusted) return;\n // Content inserted between press and release moves the target away from the point: the\n // click then goes to a common ancestor. Flag it and keep listening to stop that click\n // (2.38). A target that went away, or is covered by what the press opened, is not a miss.\n if (el.isConnected && !window.__spanaTapMissed) {\n var ur = el.getBoundingClientRect();\n if ((e.clientX < ur.left || e.clientX > ur.right || e.clientY < ur.top || e.clientY > ur.bottom) && !matchTarget(e.target)) {\n e.stopImmediatePropagation();\n e.preventDefault();\n window.__spanaTapMissed = true;\n }\n }\n if (window.__spanaTapMissed) return;\n Promise.resolve().then(cleanup);\n };\n var onEvt = function(e) {\n if (!e.isTrusted) return;\n var hit = deepElementFromPoint(doc, e.clientX, e.clientY) || e.target;\n if (!matchTarget(hit) && !matchTarget(e.target)) {\n e.stopImmediatePropagation();\n e.preventDefault();\n window.__spanaTapMissed = true;\n if (e.type === \"click\") cleanup();\n } else if (e.type === \"click\") {\n cleanup();\n }\n };\n win.addEventListener(\"pointerdown\", onEvt, true);\n win.addEventListener(\"mousedown\", onEvt, true);\n win.addEventListener(\"mouseup\", onMouseUp, true);\n win.addEventListener(\"click\", onEvt, true);\n window.__spanaTapGuardCleanup = cleanup;\n } catch (e) {}\n }\n\n function recordActionFailure(reason) {\n if (!forAction) return;\n try { window.__spanaLastActionDiag = reason; } catch (e) {}\n }\n\n function findCandidates() {\n if (waitForAppReady && !isAppReady()) { recordActionFailure(\"waiting for app ready (__SPANA_APP_READY__)\"); return null; }\n if (forAction && !force && hasActiveViewTransition()) { recordActionFailure(\"active CSS view transition in progress\"); return null; }\n var rawHits = findAcrossRoots(sel, \"strict\");\n if (rawHits.length === 0) {\n recordActionFailure(scrolledToUnobscure ? \"element went away after spana scrolled to unobscure it (a popover or menu that closes on scroll?)\" : null);\n return null;\n }\n var ready = [];\n var lastFail = null;\n for (var i = 0; i < rawHits.length; i++) {\n var h = rawHits[i];\n var m = toMatch(h);\n if (!m.visible) { lastFail = getVisibilityFailureReason(h.el, h.el && h.el.getBoundingClientRect ? h.el.getBoundingClientRect() : null) || \"not visible\"; continue; }\n if (forAction && !force && !m.enabled) { lastFail = \"element is disabled\"; continue; }\n ready.push({ hit: h, match: m });\n }\n if (ready.length === 0) recordActionFailure(lastFail);\n return ready.length > 0 ? ready : null;\n }\n\n // An in-viewport target whose hit test is blocked is scrolled only once it stayed blocked for\n // a few frames: a scroll can close a popover that closes on scroll (1.18).\n var blockedInViewportSince = 0;\n var scrolledToUnobscure = false;\n function checkActionableNow() {\n var ready = findCandidates();\n if (!ready) return null;\n if (!forAction) return ready.map(function(r) { return r.match; });\n var target = ready.length > 1 ? ready[pickActionIndex(ready, function(r) { return r.hit.el; })] : ready[0];\n var alreadyInViewport = isFullyInViewport(target.hit);\n var didScroll = alreadyInViewport ? false : ensureInViewport(target.hit);\n if (!force && checkHitTest && !isHitTestClear(target.hit)) {\n var nowMs = Date.now();\n if (alreadyInViewport && !blockedInViewportSince) blockedInViewportSince = nowMs;\n if (!alreadyInViewport || (nowMs - blockedInViewportSince >= 150 && canScrollToUnobscure(target.hit))) {\n scrolledToUnobscure = true;\n if (scrollToUnobscure(target.hit)) {\n didScroll = true;\n }\n if (!target.hit.el.isConnected) { recordActionFailure(\"element detached from DOM after spana scrolled to unobscure it\"); return null; }\n }\n if (!isHitTestClear(target.hit)) {\n var blocker = getHitTestBlocker(target.hit);\n recordActionFailure(blocker ? (\"hit-test blocked by \" + blocker) : \"hit-test failed (element not receiving pointer events at click point)\");\n return null;\n }\n }\n var updated = toMatch(target.hit);\n if (!updated.visible) { recordActionFailure(\"element became hidden after scroll\"); return null; }\n if (!force && !updated.enabled) { recordActionFailure(\"element became disabled\"); return null; }\n recordActionFailure(null);\n return { hits: ready, target: target, match: updated, didScroll: didScroll };\n }\n\n function neededStableFrames(candidate) {\n if (force || !forAction || typeof requestAnimationFrame !== \"function\") return 0;\n if (explicitStableFrames >= 0) return explicitStableFrames;\n if (hasActiveAnimation(candidate.target.hit.el)) return 2;\n if (candidate.didScroll) return 1;\n return 0;\n }\n\n var imm = checkActionableNow();\n if (imm) {\n if (!forAction) return imm;\n if (neededStableFrames(imm) <= 0) {\n armTapGuardOnEl(imm.target.hit.el);\n return [imm.match];\n }\n }\n\n return new Promise(function(resolve) {\n var done = false;\n var observer = null;\n var timeoutTimer = null;\n var fallbackInterval = null;\n var idleTimer = null;\n var rafId = null;\n var checkingStability = false;\n\n function finish(result) {\n if (done) return;\n done = true;\n if (observer) { try { observer.disconnect(); } catch (e) {} }\n if (timeoutTimer) clearTimeout(timeoutTimer);\n if (fallbackInterval) clearInterval(fallbackInterval);\n if (idleTimer) clearTimeout(idleTimer);\n if (rafId !== null && typeof cancelAnimationFrame === \"function\") {\n try { cancelAnimationFrame(rafId); } catch (e) {}\n }\n resolve(result);\n }\n\n function armIdleTimer() {\n if (!failFastWhenIdle) return;\n if (idleTimer) clearTimeout(idleTimer);\n idleTimer = setTimeout(function() {\n var rootEl = document.body || document.documentElement;\n if (\n document.readyState === \"complete\" &&\n (!waitForAppReady || isAppReady()) &&\n !hasActiveAnimation(rootEl) &&\n !hasInflightNetwork(idleQuietMs)\n ) {\n var hit = checkActionableNow();\n if (hit && forAction) armTapGuardOnEl(hit.target.hit.el);\n finish(hit ? (forAction ? [hit.match] : hit) : []);\n } else {\n armIdleTimer();\n }\n }, idleQuietMs);\n }\n\n function verifyStability(candidate) {\n if (done || checkingStability) return;\n var framesToWait = neededStableFrames(candidate);\n if (!forAction || framesToWait <= 0 || typeof requestAnimationFrame !== \"function\") {\n if (forAction) armTapGuardOnEl(candidate.target.hit.el);\n finish(forAction ? [candidate.match] : candidate);\n return;\n }\n checkingStability = true;\n var el = candidate.target.hit.el;\n var lastRect = candidate.match.rect;\n var remainingFrames = framesToWait;\n\n function step() {\n if (done) return;\n if (!el.isConnected) { checkingStability = false; scheduleAttempt(); return; }\n if (checkHitTest && !isHitTestClear(candidate.target.hit)) { checkingStability = false; scheduleAttempt(); return; }\n var cur = toMatch(candidate.target.hit);\n if (!cur.visible || !cur.enabled) { checkingStability = false; scheduleAttempt(); return; }\n var dx = Math.abs(cur.rect.x - lastRect.x);\n var dy = Math.abs(cur.rect.y - lastRect.y);\n var dw = Math.abs(cur.rect.width - lastRect.width);\n var dh = Math.abs(cur.rect.height - lastRect.height);\n if (dx <= 1 && dy <= 1 && dw <= 1 && dh <= 1) {\n remainingFrames -= 1;\n if (remainingFrames <= 0) { armTapGuardOnEl(el); finish([cur]); return; }\n } else {\n recordActionFailure(\"element bounding box unstable (still moving)\");\n remainingFrames = framesToWait;\n lastRect = cur.rect;\n }\n rafId = requestAnimationFrame(step);\n }\n rafId = requestAnimationFrame(step);\n }\n\n function attempt() {\n if (done || checkingStability) return;\n var hit = checkActionableNow();\n if (hit) {\n if (forAction) verifyStability(hit);\n else finish(hit);\n return;\n }\n }\n\n var scheduled = false;\n function scheduleAttempt() {\n if (done || checkingStability) return;\n armIdleTimer();\n if (scheduled) return;\n scheduled = true;\n Promise.resolve().then(function() { scheduled = false; attempt(); });\n }\n\n timeoutTimer = setTimeout(function() {\n var finalHit = checkActionableNow();\n if (finalHit && forAction) armTapGuardOnEl(finalHit.target.hit.el);\n finish(finalHit ? (forAction ? [finalHit.match] : finalHit) : []);\n }, timeoutMs);\n fallbackInterval = setInterval(attempt, forAction ? 40 : 120);\n if (typeof MutationObserver !== \"undefined\") {\n var root = document.documentElement || document.body || document;\n if (root) {\n observer = new MutationObserver(scheduleAttempt);\n observer.observe(root, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n }\n armIdleTimer();\n attempt();\n });\n }\n\n function waitForHidden(sel, opts) {\n opts = opts || {};\n var timeoutMs = Math.max(10, Math.round(opts.timeoutMs != null ? opts.timeoutMs : 5000));\n function isHiddenNow() {\n var hits = findAcrossRoots(sel, false);\n for (var i = 0; i < hits.length; i++) {\n if (toMatch(hits[i]).visible) return false;\n }\n return true;\n }\n if (isHiddenNow()) return true;\n return new Promise(function(resolve) {\n var done = false;\n var observer = null;\n var timeoutTimer = null;\n var fallbackInterval = null;\n function finish(val) {\n if (done) return;\n done = true;\n if (observer) { try { observer.disconnect(); } catch (e) {} }\n if (timeoutTimer) clearTimeout(timeoutTimer);\n if (fallbackInterval) clearInterval(fallbackInterval);\n resolve(val);\n }\n function onChange() { if (isHiddenNow()) finish(true); }\n timeoutTimer = setTimeout(function() { finish(isHiddenNow()); }, timeoutMs);\n fallbackInterval = setInterval(onChange, 120);\n if (typeof MutationObserver !== \"undefined\") {\n var root = document.documentElement || document.body || document;\n if (root) {\n observer = new MutationObserver(onChange);\n observer.observe(root, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n }\n });\n }\n\n function waitForMatch(sel, opts) {\n opts = opts || {};\n var timeoutMs = Math.max(10, Math.round(opts.timeoutMs != null ? opts.timeoutMs : 5000));\n var kind = opts.kind;\n var expected = opts.expected !== undefined ? opts.expected : null;\n var expectedCount = opts.expectedCount !== undefined ? opts.expectedCount : null;\n var viewportRatio = opts.viewportRatio || 0;\n var attributeName = opts.attributeName !== undefined ? opts.attributeName : null;\n var cssProperty = opts.cssProperty !== undefined ? opts.cssProperty : null;\n var patternSource = opts.patternSource !== undefined ? opts.patternSource : null;\n var patternFlags = opts.patternFlags || \"\";\n var negate = Boolean(opts.negate);\n var visibleOnly = Boolean(opts.visibleOnly);\n var ignoreCase = Boolean(opts.ignoreCase);\n var propertyName = opts.propertyName !== undefined ? opts.propertyName : null;\n var expectedValue = opts.expectedValue !== undefined ? opts.expectedValue : null;\n var lastActual = undefined;\n var regex = patternSource !== null ? new RegExp(patternSource, patternFlags) : null;\n var allowHidden = kind === \"text\" || kind === \"containsText\" || kind === \"matchesText\" || kind === \"value\" || kind === \"attribute\" || kind === \"attached\" || kind === \"jsProperty\";\n\n function evaluateMatch() {\n if (kind === \"url\") {\n var href = typeof window !== \"undefined\" && window.location ? String(window.location.href || \"\") : \"\";\n lastActual = href;\n var urlOk = regex\n ? regex.test(href)\n : (expected !== null && (href === expected || href.indexOf(String(expected)) !== -1));\n if (negate ? !urlOk : urlOk) return { matched: true, actual: href };\n return null;\n }\n if (kind === \"title\") {\n var docTitle = String(typeof document !== \"undefined\" ? (document.title || \"\") : \"\");\n lastActual = docTitle;\n var titleOk = regex ? regex.test(docTitle) : (expected !== null && docTitle === String(expected));\n if (negate ? !titleOk : titleOk) return { matched: true, actual: docTitle };\n return null;\n }\n\n var pvMode = (kind === \"attached\" || (kind === \"count\" && !visibleOnly)) ? false : (visibleOnly ? \"strict\" : \"prefer\");\n var hits = findAcrossRoots(sel, pvMode);\n\n if (kind === \"count\") {\n var matchedCount = 0;\n if (visibleOnly) {\n for (var ci = 0; ci < hits.length; ci++) {\n if (toMatch(hits[ci]).visible) matchedCount++;\n }\n } else {\n matchedCount = hits.length;\n }\n lastActual = String(matchedCount);\n var countOk = expectedCount !== null && matchedCount === expectedCount;\n if (negate ? !countOk : countOk) {\n return { matched: true, actual: String(matchedCount) };\n }\n return null;\n }\n if (kind === \"attached\") {\n var isAttached = hits.length > 0;\n lastActual = isAttached ? \"attached\" : \"detached\";\n if (negate ? !isAttached : isAttached) return { matched: true, actual: lastActual };\n return null;\n }\n\n var anyVisible2 = false;\n var hiddenFallback2 = [];\n var checkMatch2 = function(h, m) {\n var matched = false;\n var actualVal = undefined;\n if (kind === \"text\") {\n var normTxt = normWs(m.textContent !== undefined ? m.textContent : (m.text || \"\"));\n actualVal = normTxt;\n matched = normTxt === (expected !== null ? normWs(expected) : expected);\n } else if (kind === \"containsText\") {\n var actual = normWs(m.textContent !== undefined ? m.textContent : (m.text || \"\"));\n actualVal = actual;\n var needle = expected !== null ? normWs(expected) : \"\";\n matched = expected !== null && (ignoreCase\n ? actual.toLowerCase().indexOf(needle.toLowerCase()) !== -1\n : actual.indexOf(needle) !== -1);\n } else if (kind === \"matchesText\") {\n var rawRe2 = m.textContent !== undefined ? m.textContent : (m.text || \"\");\n var actualRe = normWs(rawRe2);\n actualVal = actualRe;\n matched = Boolean(regex && (regex.test(rawRe2) || regex.test(actualRe)));\n } else if (kind === \"value\") {\n var val = m.value !== undefined ? m.value : \"\";\n actualVal = val;\n matched = regex ? regex.test(val) : (val === expected);\n } else if (kind === \"attribute\" && attributeName !== null) {\n var attrVal = m.attributes ? m.attributes[attributeName] : undefined;\n actualVal = attrVal;\n matched = regex\n ? (attrVal !== undefined && regex.test(attrVal))\n : (expected === null ? attrVal !== undefined : attrVal === expected);\n } else if (kind === \"accessibilityLabel\") {\n var lbl = m.accessibilityLabel;\n actualVal = lbl;\n matched = expected === null ? (lbl !== undefined && lbl.length > 0) : lbl === expected;\n } else if (kind === \"accessibleName\") {\n var accName = normWs(m.accessibleName || m.accessibilityLabel || m.text || \"\");\n actualVal = accName;\n matched = regex ? (regex.test(m.accessibleName || m.accessibilityLabel || m.text || \"\") || regex.test(accName)) : (expected === null ? accName.length > 0 : accName === normWs(expected));\n } else if (kind === \"accessibleDescription\") {\n var accDesc = normWs(m.accessibleDescription || \"\");\n actualVal = accDesc;\n matched = regex ? (regex.test(m.accessibleDescription || \"\") || regex.test(accDesc)) : (expected === null ? accDesc.length > 0 : accDesc === normWs(expected));\n } else if (kind === \"focused\") {\n actualVal = m.focused ? \"focused\" : \"not focused\";\n matched = Boolean(m.focused);\n } else if (kind === \"checked\") {\n actualVal = m.checked ? \"checked\" : \"unchecked\";\n matched = Boolean(m.checked);\n } else if (kind === \"enabled\") {\n var isEn2 = m.enabled !== false;\n actualVal = isEn2 ? \"enabled\" : \"disabled\";\n matched = isEn2;\n } else if (kind === \"role\") {\n var elRole2 = m.role || getImplicitRole(h.el) || \"generic\";\n actualVal = elRole2;\n matched = expected !== null && elRole2.toLowerCase() === String(expected).toLowerCase();\n } else if (kind === \"editable\") {\n actualVal = m.editable ? \"editable\" : \"not editable\";\n matched = Boolean(m.editable);\n } else if (kind === \"empty\") {\n actualVal = m.empty ? \"empty\" : (m.value || m.textContent || \"non-empty\");\n matched = Boolean(m.empty);\n } else if (kind === \"inViewport\") {\n var vpW = window.innerWidth || document.documentElement.clientWidth || 0;\n var vpH = window.innerHeight || document.documentElement.clientHeight || 0;\n var r = m.rect;\n var visW = Math.min(r.x + r.width, vpW) - Math.max(r.x, 0);\n var visH = Math.min(r.y + r.height, vpH) - Math.max(r.y, 0);\n var vpShare = r.width > 0 && r.height > 0 && visW > 0 && visH > 0 ? (visW * visH) / (r.width * r.height) : 0;\n var inVp = viewportRatio > 0 ? vpShare > viewportRatio - 1e-9 : vpShare > 0;\n actualVal = vpShare > 0 ? (Math.round(vpShare * 100) + \"% in viewport\") : \"outside viewport\";\n matched = inVp;\n } else if (kind === \"jsProperty\" && propertyName !== null) {\n var propNode = h.el;\n var rawProp = propNode ? propNode[propertyName] : undefined;\n actualVal = typeof rawProp === \"string\" ? rawProp : JSON.stringify(rawProp);\n matched = JSON.stringify(rawProp) === JSON.stringify(expectedValue);\n } else if (kind === \"class\") {\n var cls = m.className || \"\";\n actualVal = cls;\n if (regex) {\n matched = regex.test(cls);\n } else if (expected !== null) {\n var tokens = cls.trim().split(/\\s+/).filter(Boolean);\n var expectedTokens = String(expected).trim().split(/\\s+/).filter(Boolean);\n matched = expectedTokens.length > 0 && expectedTokens.every(function(tok) { return tokens.indexOf(tok) !== -1; });\n }\n } else if (kind === \"css\" && cssProperty !== null) {\n var elNode = h.el;\n var winObj = (elNode.ownerDocument && elNode.ownerDocument.defaultView) || window;\n var cssVal = winObj && winObj.getComputedStyle ? winObj.getComputedStyle(elNode).getPropertyValue(cssProperty).trim() : \"\";\n actualVal = cssVal;\n matched = regex ? regex.test(cssVal) : (expected !== null && cssVal === String(expected).trim());\n }\n lastActual = actualVal;\n if (negate ? !matched : matched) return { matched: true, actual: actualVal };\n return null;\n };\n for (var i = hits.length - 1; i >= 0; i--) {\n var m = toMatch(hits[i]);\n if (!allowHidden && !m.visible) {\n if (kind === \"enabled\" || kind === \"checked\") hiddenFallback2.push({ h: hits[i], m: m });\n continue;\n }\n if (m.visible) anyVisible2 = true;\n var resHit2 = checkMatch2(hits[i], m);\n if (resHit2) return resHit2;\n }\n if (!anyVisible2 && hiddenFallback2.length > 0) {\n for (var hi2 = 0; hi2 < hiddenFallback2.length; hi2++) {\n var hRes2 = checkMatch2(hiddenFallback2[hi2].h, hiddenFallback2[hi2].m);\n if (hRes2) return hRes2;\n }\n }\n return null;\n }\n\n var immediate = evaluateMatch();\n if (immediate) return immediate;\n\n return new Promise(function(resolve) {\n var done = false;\n var observer = null;\n var timeoutTimer = null;\n var fallbackInterval = null;\n var scheduled = false;\n function finish(res) {\n if (done) return;\n done = true;\n if (observer) { try { observer.disconnect(); } catch (e) {} }\n if (timeoutTimer) clearTimeout(timeoutTimer);\n if (fallbackInterval) clearInterval(fallbackInterval);\n if (typeof document !== \"undefined\") {\n document.removeEventListener(\"input\", onChange, true);\n document.removeEventListener(\"change\", onChange, true);\n document.removeEventListener(\"focusin\", onChange, true);\n document.removeEventListener(\"focusout\", onChange, true);\n }\n if (typeof window !== \"undefined\") {\n window.removeEventListener(\"popstate\", onChange);\n window.removeEventListener(\"hashchange\", onChange);\n }\n resolve(res);\n }\n function onChange() {\n if (done || scheduled) return;\n scheduled = true;\n Promise.resolve().then(function() {\n scheduled = false;\n if (done) return;\n var res = evaluateMatch();\n if (res) finish(res);\n });\n }\n timeoutTimer = setTimeout(function() {\n var finalRes = evaluateMatch();\n finish(finalRes || { matched: false, actual: lastActual });\n }, timeoutMs);\n fallbackInterval = setInterval(onChange, kind === \"url\" ? 50 : 120);\n if (typeof document !== \"undefined\") {\n document.addEventListener(\"input\", onChange, true);\n document.addEventListener(\"change\", onChange, true);\n document.addEventListener(\"focusin\", onChange, true);\n document.addEventListener(\"focusout\", onChange, true);\n }\n if (typeof window !== \"undefined\") {\n window.addEventListener(\"popstate\", onChange);\n window.addEventListener(\"hashchange\", onChange);\n }\n if (typeof MutationObserver !== \"undefined\") {\n var root = document.documentElement || document.body || document;\n if (root) {\n observer = new MutationObserver(onChange);\n observer.observe(root, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n }\n });\n }\n\n function fill(sel, val, opts) {\n opts = opts || {};\n var timeoutMs = Math.max(10, Math.round(opts.timeoutMs != null ? opts.timeoutMs : 5000));\n var checkHitTest = opts.checkHitTest !== undefined ? Boolean(opts.checkHitTest) : true;\n var verifyDelayMs = opts.verifyDelayMs !== undefined ? Math.max(0, Math.round(opts.verifyDelayMs)) : 12;\n function writeValue(el) {\n if (el.isContentEditable) return false;\n if (typeof el.focus === \"function\") { try { el.focus(); } catch (e) {} }\n var tag = el.tagName;\n if (tag === \"INPUT\" || tag === \"TEXTAREA\") {\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var proto = tag === \"TEXTAREA\"\n ? (win.HTMLTextAreaElement && win.HTMLTextAreaElement.prototype)\n : (win.HTMLInputElement && win.HTMLInputElement.prototype);\n var desc = proto ? Object.getOwnPropertyDescriptor(proto, \"value\") : null;\n if (desc && typeof desc.set === \"function\") {\n try { desc.set.call(el, val); } catch (e) { el.value = val; }\n }\n else el.value = val;\n if (el._valueTracker && typeof el._valueTracker.setValue === \"function\") {\n try { el._valueTracker.setValue(val === \"\" ? \" \" : \"\"); } catch (e) {}\n }\n } else if (tag === \"SELECT\") {\n el.value = val;\n } else {\n el.value = val;\n }\n try { el.dispatchEvent(new InputEvent(\"input\", { bubbles: true, cancelable: true, data: val, inputType: \"insertText\" })); }\n catch (e) { el.dispatchEvent(new Event(\"input\", { bubbles: true, cancelable: true })); }\n el.dispatchEvent(new Event(\"change\", { bubbles: true, cancelable: true }));\n return true;\n }\n function findEditableNow() {\n if (!isAppReady()) return null;\n var hits = findAcrossRoots(sel, \"strict\");\n for (var i = hits.length - 1; i >= 0; i--) {\n var h = hits[i];\n var m = toMatch(h);\n if (!m.visible || !m.enabled) continue;\n var alreadyInVp = isFullyInViewport(h);\n if (!alreadyInVp) ensureInViewport(h);\n if (checkHitTest && !isHitTestClear(h)) {\n if (!alreadyInVp || canScrollToUnobscure(h)) scrollToUnobscure(h);\n if (!h.el.isConnected || !isHitTestClear(h)) continue;\n }\n return h.el;\n }\n return null;\n }\n function verifyAndRetryFill(attemptsLeft) {\n var el = findEditableNow();\n if (!el || el.isContentEditable) return Promise.resolve(false);\n if (!writeValue(el)) return Promise.resolve(false);\n if (verifyDelayMs <= 0) {\n var syncLatest = findEditableNow() || el;\n if (syncLatest && syncLatest.isConnected && String(syncLatest.value == null ? \"\" : syncLatest.value) === val) {\n return Promise.resolve(true);\n }\n return attemptsLeft > 1 ? verifyAndRetryFill(attemptsLeft - 1) : Promise.resolve(false);\n }\n return new Promise(function(resolve) {\n setTimeout(function() {\n var latest = findEditableNow() || el;\n if (latest && latest.isConnected && String(latest.value == null ? \"\" : latest.value) === val) {\n resolve(true);\n return;\n }\n if (attemptsLeft > 1) {\n verifyAndRetryFill(attemptsLeft - 1).then(resolve);\n } else {\n resolve(false);\n }\n }, verifyDelayMs);\n });\n }\n var immEl = findEditableNow();\n if (immEl) {\n if (immEl.isContentEditable) return false;\n return verifyAndRetryFill(3);\n }\n return new Promise(function(resolve) {\n var done = false;\n var observer = null;\n var timeoutTimer = null;\n var fallbackInterval = null;\n var scheduled = false;\n var filling = false;\n function finish(ok) {\n if (done) return;\n done = true;\n if (observer) { try { observer.disconnect(); } catch (e) {} }\n if (timeoutTimer) clearTimeout(timeoutTimer);\n if (fallbackInterval) clearInterval(fallbackInterval);\n resolve(ok);\n }\n function onChange() {\n if (done || scheduled || filling) return;\n scheduled = true;\n Promise.resolve().then(function() {\n scheduled = false;\n if (done || filling) return;\n var target = findEditableNow();\n if (!target) return;\n if (target.isContentEditable) { finish(false); return; }\n filling = true;\n verifyAndRetryFill(3).then(function(ok) { finish(ok); });\n });\n }\n timeoutTimer = setTimeout(function() {\n if (filling) return;\n var target = findEditableNow();\n if (!target || target.isContentEditable) { finish(false); return; }\n filling = true;\n verifyAndRetryFill(2).then(function(ok) { finish(ok); });\n }, timeoutMs);\n fallbackInterval = setInterval(onChange, 40);\n if (typeof MutationObserver !== \"undefined\") {\n var root = document.documentElement || document.body || document;\n if (root) {\n observer = new MutationObserver(onChange);\n observer.observe(root, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n }\n });\n }\n\n function checkTapGuard() {\n var m = Boolean(window.__spanaTapMissed);\n if (window.__spanaTapGuardCleanup) window.__spanaTapGuardCleanup();\n delete window.__spanaTapMissed;\n return m;\n }\n\n function focus(sel) {\n var hits = findAcrossRoots(sel);\n if (hits.length === 0) return false;\n var el = hits[hits.length - 1].el;\n if (typeof el.focus !== \"function\") return false;\n el.focus();\n return true;\n }\n\n window.__spanaRt = {\n query: query,\n focus: focus,\n scrollIntoView: scrollIntoView,\n tap: tap,\n waitForSelector: waitForSelector,\n waitForHidden: waitForHidden,\n waitForMatch: waitForMatch,\n fill: fill,\n checkTapGuard: checkTapGuard\n };\n return true;\n})();";
286
+ export type InjectedRuntimeMethod = "query" | "focus" | "scrollIntoView" | "tap" | "waitForSelector" | "waitForHidden" | "waitForMatch" | "fill";
277
287
  export type SelectOptionInput = string | string[] | {
278
288
  value?: string;
279
289
  label?: string;