@browserless.io/browserless 2.13.1-beta.1 → 2.15.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 (65) hide show
  1. package/CHANGELOG.md +12 -3
  2. package/bin/browserless.js +0 -0
  3. package/build/browserless.d.ts +0 -2
  4. package/build/browsers/browsers.cdp.d.ts +0 -5
  5. package/build/browsers/browsers.playwright.d.ts +33 -37
  6. package/build/browsers/index.d.ts +1 -2
  7. package/build/config.d.ts +0 -2
  8. package/build/file-system.d.ts +0 -2
  9. package/build/hooks.d.ts +0 -1
  10. package/build/http.d.ts +0 -1
  11. package/build/limiter.d.ts +5 -0
  12. package/build/limiter.js +3 -0
  13. package/build/limiter.spec.js +1 -1
  14. package/build/metrics.d.ts +0 -1
  15. package/build/monitoring.d.ts +0 -1
  16. package/build/router.d.ts +0 -3
  17. package/build/routes/chrome/http/content.post.body.json +16 -9
  18. package/build/routes/chrome/http/pdf.post.body.json +16 -9
  19. package/build/routes/chrome/http/scrape.post.body.json +16 -9
  20. package/build/routes/chrome/http/screenshot.post.body.json +16 -9
  21. package/build/routes/chromium/http/content.post.body.json +16 -9
  22. package/build/routes/chromium/http/pdf.post.body.json +16 -9
  23. package/build/routes/chromium/http/scrape.post.body.json +16 -9
  24. package/build/routes/chromium/http/screenshot.post.body.json +16 -9
  25. package/build/routes/firefox/ws/playwright.d.ts +0 -2
  26. package/build/routes/management/http/active.get.d.ts +0 -1
  27. package/build/routes/management/http/config.get.d.ts +0 -1
  28. package/build/routes/management/http/metrics-total.get.d.ts +0 -1
  29. package/build/routes/management/http/metrics.get.d.ts +0 -1
  30. package/build/routes/management/http/pressure.get.d.ts +0 -1
  31. package/build/routes/management/http/sessions.get.d.ts +0 -1
  32. package/build/routes/management/http/static.get.d.ts +0 -1
  33. package/build/routes/webkit/ws/playwright.d.ts +0 -2
  34. package/build/server.d.ts +0 -4
  35. package/build/shared/browser.ws.d.ts +0 -2
  36. package/build/shared/chromium.playwright.ws.d.ts +0 -2
  37. package/build/shared/chromium.ws.d.ts +0 -2
  38. package/build/shared/content.http.d.ts +0 -1
  39. package/build/shared/download.http.d.ts +0 -1
  40. package/build/shared/function.http.d.ts +0 -1
  41. package/build/shared/page.ws.d.ts +0 -2
  42. package/build/shared/pdf.http.d.ts +0 -1
  43. package/build/shared/performance.http.d.ts +0 -1
  44. package/build/shared/scrape.http.d.ts +0 -1
  45. package/build/shared/screenshot.http.d.ts +0 -1
  46. package/build/token.d.ts +0 -1
  47. package/build/types.d.ts +0 -3
  48. package/build/utils.d.ts +0 -3
  49. package/build/webhooks.d.ts +0 -1
  50. package/fonts/Calibri Bold Italic.ttf +0 -0
  51. package/fonts/Calibri Bold.TTF +0 -0
  52. package/fonts/Calibri Italic.ttf +0 -0
  53. package/fonts/Calibri Light Italic.ttf +0 -0
  54. package/fonts/Calibri Light.ttf +0 -0
  55. package/fonts/Calibri Regular.ttf +0 -0
  56. package/package.json +17 -17
  57. package/scripts/start.sh +0 -0
  58. package/scripts/test.sh +0 -0
  59. package/src/limiter.spec.ts +1 -1
  60. package/src/limiter.ts +8 -0
  61. package/static/docs/swagger.json +4798 -48
  62. package/static/docs/swagger.min.json +4797 -47
  63. package/static/function/client.js +1364 -792
  64. package/static/function/index.html +1364 -792
  65. package/static/assets +0 -1
@@ -4103,9 +4103,9 @@
4103
4103
  }
4104
4104
  });
4105
4105
 
4106
- // node_modules/puppeteer-core/node_modules/debug/src/common.js
4106
+ // node_modules/debug/src/common.js
4107
4107
  var require_common = __commonJS({
4108
- "node_modules/puppeteer-core/node_modules/debug/src/common.js"(exports8, module) {
4108
+ "node_modules/debug/src/common.js"(exports8, module) {
4109
4109
  init_dirname();
4110
4110
  init_buffer2();
4111
4111
  function setup(env) {
@@ -4268,9 +4268,9 @@
4268
4268
  }
4269
4269
  });
4270
4270
 
4271
- // node_modules/puppeteer-core/node_modules/debug/src/browser.js
4271
+ // node_modules/debug/src/browser.js
4272
4272
  var require_browser = __commonJS({
4273
- "node_modules/puppeteer-core/node_modules/debug/src/browser.js"(exports8, module) {
4273
+ "node_modules/debug/src/browser.js"(exports8, module) {
4274
4274
  init_dirname();
4275
4275
  init_buffer2();
4276
4276
  exports8.formatArgs = formatArgs;
@@ -14685,20 +14685,20 @@
14685
14685
  }
14686
14686
  function flattenJSON(nestedJSON) {
14687
14687
  var flatJSON = {};
14688
- function flatten(pathPrefix, node) {
14688
+ function flatten2(pathPrefix, node) {
14689
14689
  for (var path2 in node) {
14690
14690
  var contentOrNode = node[path2];
14691
14691
  var joinedPath = join2(pathPrefix, path2);
14692
14692
  if (typeof contentOrNode === "string") {
14693
14693
  flatJSON[joinedPath] = contentOrNode;
14694
14694
  } else if (typeof contentOrNode === "object" && contentOrNode !== null && Object.keys(contentOrNode).length > 0) {
14695
- flatten(joinedPath, contentOrNode);
14695
+ flatten2(joinedPath, contentOrNode);
14696
14696
  } else {
14697
14697
  flatJSON[joinedPath] = null;
14698
14698
  }
14699
14699
  }
14700
14700
  }
14701
- flatten("", nestedJSON);
14701
+ flatten2("", nestedJSON);
14702
14702
  return flatJSON;
14703
14703
  }
14704
14704
  var Volume = function() {
@@ -16907,6 +16907,15 @@
16907
16907
  };
16908
16908
  });
16909
16909
  }
16910
+ function fromAbortSignal(signal, cause) {
16911
+ return signal ? fromEvent(signal, "abort").pipe(map(() => {
16912
+ if (signal.reason instanceof Error) {
16913
+ signal.reason.cause = cause;
16914
+ throw signal.reason;
16915
+ }
16916
+ throw new Error(signal.reason, { cause });
16917
+ })) : NEVER;
16918
+ }
16910
16919
  function filterAsync(predicate) {
16911
16920
  return mergeMap((value) => {
16912
16921
  return from(Promise.resolve(predicate(value))).pipe(filter((isMatch) => {
@@ -17799,7 +17808,7 @@
17799
17808
  __esDecorate(this, null, _stop_decorators, { kind: "method", name: "stop", static: false, private: false, access: { has: (obj) => "stop" in obj, get: (obj) => obj.stop }, metadata: _metadata }, null, _instanceExtraInitializers);
17800
17809
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
17801
17810
  }
17802
- #page = (__runInitializers(this, _instanceExtraInitializers), void 0);
17811
+ #page = __runInitializers(this, _instanceExtraInitializers);
17803
17812
  #process;
17804
17813
  #controller = new AbortController();
17805
17814
  #lastFrame;
@@ -18647,8 +18656,8 @@
18647
18656
  })(LocatorEvent || (LocatorEvent = {}));
18648
18657
  var Locator = class extends EventEmitter2 {
18649
18658
  /**
18650
- * Creates a race between multiple locators but ensures that only a single one
18651
- * acts.
18659
+ * Creates a race between multiple locators trying to locate elements in
18660
+ * parallel but ensures that only a single element receives the action.
18652
18661
  *
18653
18662
  * @public
18654
18663
  */
@@ -18680,12 +18689,7 @@
18680
18689
  retryAndRaceWithSignalAndTimer: (signal, cause) => {
18681
18690
  const candidates = [];
18682
18691
  if (signal) {
18683
- candidates.push(fromEvent(signal, "abort").pipe(map(() => {
18684
- if (signal.reason instanceof Error) {
18685
- signal.reason.cause = cause;
18686
- }
18687
- throw signal.reason;
18688
- })));
18692
+ candidates.push(fromAbortSignal(signal, cause));
18689
18693
  }
18690
18694
  candidates.push(timeout(this._timeout, cause));
18691
18695
  return pipe(retry({ delay: RETRY_DELAY }), raceWith(...candidates));
@@ -18695,26 +18699,59 @@
18695
18699
  get timeout() {
18696
18700
  return this._timeout;
18697
18701
  }
18702
+ /**
18703
+ * Creates a new locator instance by cloning the current locator and setting
18704
+ * the total timeout for the locator actions.
18705
+ *
18706
+ * Pass `0` to disable timeout.
18707
+ *
18708
+ * @defaultValue `Page.getDefaultTimeout()`
18709
+ */
18698
18710
  setTimeout(timeout2) {
18699
18711
  const locator = this._clone();
18700
18712
  locator._timeout = timeout2;
18701
18713
  return locator;
18702
18714
  }
18715
+ /**
18716
+ * Creates a new locator instance by cloning the current locator with the
18717
+ * visibility property changed to the specified value.
18718
+ */
18703
18719
  setVisibility(visibility) {
18704
18720
  const locator = this._clone();
18705
18721
  locator.visibility = visibility;
18706
18722
  return locator;
18707
18723
  }
18724
+ /**
18725
+ * Creates a new locator instance by cloning the current locator and
18726
+ * specifying whether to wait for input elements to become enabled before the
18727
+ * action. Applicable to `click` and `fill` actions.
18728
+ *
18729
+ * @defaultValue `true`
18730
+ */
18708
18731
  setWaitForEnabled(value) {
18709
18732
  const locator = this._clone();
18710
18733
  locator.#waitForEnabled = value;
18711
18734
  return locator;
18712
18735
  }
18736
+ /**
18737
+ * Creates a new locator instance by cloning the current locator and
18738
+ * specifying whether the locator should scroll the element into viewport if
18739
+ * it is not in the viewport already.
18740
+ *
18741
+ * @defaultValue `true`
18742
+ */
18713
18743
  setEnsureElementIsInTheViewport(value) {
18714
18744
  const locator = this._clone();
18715
18745
  locator.#ensureElementIsInTheViewport = value;
18716
18746
  return locator;
18717
18747
  }
18748
+ /**
18749
+ * Creates a new locator instance by cloning the current locator and
18750
+ * specifying whether the locator has to wait for the element's bounding box
18751
+ * to be same between two consecutive animation frames.
18752
+ *
18753
+ * @defaultValue `true`
18754
+ */
18718
18755
  setWaitForStableBoundingBox(value) {
18719
18756
  const locator = this._clone();
18720
18757
  locator.#waitForStableBoundingBox = value;
@@ -19021,21 +19058,30 @@
19021
19058
  mapHandle(mapper) {
19022
19059
  return new MappedLocator(this._clone(), mapper);
19023
19060
  }
19061
+ /**
19062
+ * Clicks the located element.
19063
+ */
19024
19064
  click(options) {
19025
19065
  return firstValueFrom(this.#click(options));
19026
19066
  }
19027
19067
  /**
19028
19068
  * Fills out the input identified by the locator using the provided value. The
19029
19069
  * type of the input is determined at runtime and the appropriate fill-out
19030
- * method is chosen based on the type. contenteditable, selector, inputs are
19031
- * supported.
19070
+ * method is chosen based on the type. `contenteditable`, select, textarea and
19071
+ * input elements are supported.
19032
19072
  */
19033
19073
  fill(value, options) {
19034
19074
  return firstValueFrom(this.#fill(value, options));
19035
19075
  }
19076
+ /**
19077
+ * Hovers over the located element.
19078
+ */
19036
19079
  hover(options) {
19037
19080
  return firstValueFrom(this.#hover(options));
19038
19081
  }
19082
+ /**
19083
+ * Scrolls the located element.
19084
+ */
19039
19085
  scroll(options) {
19040
19086
  return firstValueFrom(this.#scroll(options));
19041
19087
  }
@@ -19401,6 +19447,12 @@
19401
19447
  }
19402
19448
  return super.off(type, handler);
19403
19449
  }
19450
+ /**
19451
+ * {@inheritDoc Accessibility}
19452
+ */
19453
+ get accessibility() {
19454
+ return this.mainFrame().accessibility;
19455
+ }
19404
19456
  locator(selectorOrFunc) {
19405
19457
  if (typeof selectorOrFunc === "string") {
19406
19458
  return NodeLocator.create(this, selectorOrFunc);
@@ -19417,28 +19469,58 @@
19417
19469
  return Locator.race(locators);
19418
19470
  }
19419
19471
  /**
19420
- * Runs `document.querySelector` within the page. If no element matches the
19421
- * selector, the return value resolves to `null`.
19472
+ * Finds the first element that matches the selector. If no element matches
19473
+ * the selector, the return value resolves to `null`.
19422
19474
  *
19423
- * @param selector - A `selector` to query page for
19424
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
19475
+ * @param selector -
19476
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
19425
19477
  * to query page for.
19478
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
19479
+ * can be passed as-is and a
19480
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
19481
+ * allows quering by
19482
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
19483
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
19484
+ * and
19485
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
19486
+ * and
19487
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
19488
+ * Alternatively, you can specify the selector type using a
19489
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
19490
+ *
19491
+ * @remarks
19492
+ *
19493
+ * Shortcut for {@link Frame.$ | Page.mainFrame().$(selector) }.
19426
19494
  */
19427
19495
  async $(selector) {
19428
19496
  return await this.mainFrame().$(selector);
19429
19497
  }
19430
19498
  /**
19431
- * The method runs `document.querySelectorAll` within the page. If no elements
19499
+ * Finds elements on the page that match the selector. If no elements
19432
19500
  * match the selector, the return value resolves to `[]`.
19433
19501
  *
19434
- * @param selector - A `selector` to query page for
19502
+ * @param selector -
19503
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
19504
+ * to query page for.
19505
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
19506
+ * can be passed as-is and a
19507
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
19508
+ * allows quering by
19509
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
19510
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
19511
+ * and
19512
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
19513
+ * and
19514
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
19515
+ * Alternatively, you can specify the selector type using a
19516
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
19435
19517
  *
19436
19518
  * @remarks
19437
19519
  *
19438
19520
  * Shortcut for {@link Frame.$$ | Page.mainFrame().$$(selector) }.
19439
19521
  */
19440
- async $$(selector) {
19441
- return await this.mainFrame().$$(selector);
19522
+ async $$(selector, options) {
19523
+ return await this.mainFrame().$$(selector, options);
19442
19524
  }
19443
19525
  /**
19444
19526
  * @remarks
@@ -19502,8 +19584,8 @@
19502
19584
  return await this.mainFrame().evaluateHandle(pageFunction, ...args);
19503
19585
  }
19504
19586
  /**
19505
- * This method runs `document.querySelector` within the page and passes the
19506
- * result as the first argument to the `pageFunction`.
19587
+ * This method finds the first element within the page that matches the selector
19588
+ * and passes the result as the first argument to the `pageFunction`.
19507
19589
  *
19508
19590
  * @remarks
19509
19591
  *
@@ -19551,11 +19633,23 @@
19551
19633
  * );
19552
19634
  * ```
19553
19635
  *
19554
- * @param selector - the
19555
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
19556
- * to query for
19636
+ * @param selector -
19637
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
19638
+ * to query page for.
19639
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
19640
+ * can be passed as-is and a
19641
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
19642
+ * allows quering by
19643
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
19644
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
19645
+ * and
19646
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
19647
+ * and
19648
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
19649
+ * Alternatively, you can specify the selector type using a
19650
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
19557
19651
  * @param pageFunction - the function to be evaluated in the page context.
19558
- * Will be passed the result of `document.querySelector(selector)` as its
19652
+ * Will be passed the result of the element matching the selector as its
19559
19653
  * first argument.
19560
19654
  * @param args - any additional arguments to pass through to `pageFunction`.
19561
19655
  *
@@ -19568,8 +19662,8 @@
19568
19662
  return await this.mainFrame().$eval(selector, pageFunction, ...args);
19569
19663
  }
19570
19664
  /**
19571
- * This method runs `Array.from(document.querySelectorAll(selector))` within
19572
- * the page and passes the result as the first argument to the `pageFunction`.
19665
+ * This method returns all elements matching the selector and passes the
19666
+ * resulting array as the first argument to the `pageFunction`.
19573
19667
  *
19574
19668
  * @remarks
19575
19669
  * If `pageFunction` returns a promise `$$eval` will wait for the promise to
@@ -19612,12 +19706,23 @@
19612
19706
  * );
19613
19707
  * ```
19614
19708
  *
19615
- * @param selector - the
19616
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
19617
- * to query for
19709
+ * @param selector -
19710
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
19711
+ * to query page for.
19712
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
19713
+ * can be passed as-is and a
19714
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
19715
+ * allows quering by
19716
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
19717
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
19718
+ * and
19719
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
19720
+ * and
19721
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
19722
+ * Alternatively, you can specify the selector type using a
19723
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
19618
19724
  * @param pageFunction - the function to be evaluated in the page context.
19619
- * Will be passed the result of
19620
- * `Array.from(document.querySelectorAll(selector))` as its first argument.
19725
+ * Will be passed an array of matching elements as its first argument.
19621
19726
  * @param args - any additional arguments to pass through to `pageFunction`.
19622
19727
  *
19623
19728
  * @returns The result of calling `pageFunction`. If it returns an element it
@@ -19666,68 +19771,12 @@
19666
19771
  *
19667
19772
  * @param html - HTML markup to assign to the page.
19668
19773
  * @param options - Parameters that has some properties.
19669
- *
19670
- * @remarks
19671
- *
19672
- * The parameter `options` might have the following options.
19673
- *
19674
- * - `timeout` : Maximum time in milliseconds for resources to load, defaults
19675
- * to 30 seconds, pass `0` to disable timeout. The default value can be
19676
- * changed by using the {@link Page.setDefaultNavigationTimeout} or
19677
- * {@link Page.setDefaultTimeout} methods.
19678
- *
19679
- * - `waitUntil`: When to consider setting markup succeeded, defaults to
19680
- * `load`. Given an array of event strings, setting content is considered
19681
- * to be successful after all events have been fired. Events can be
19682
- * either:<br/>
19683
- * - `load` : consider setting content to be finished when the `load` event
19684
- * is fired.<br/>
19685
- * - `domcontentloaded` : consider setting content to be finished when the
19686
- * `DOMContentLoaded` event is fired.<br/>
19687
- * - `networkidle0` : consider setting content to be finished when there are
19688
- * no more than 0 network connections for at least `500` ms.<br/>
19689
- * - `networkidle2` : consider setting content to be finished when there are
19690
- * no more than 2 network connections for at least `500` ms.
19691
19774
  */
19692
19775
  async setContent(html, options) {
19693
19776
  await this.mainFrame().setContent(html, options);
19694
19777
  }
19695
19778
  /**
19696
- * Navigates the page to the given `url`.
19697
- *
19698
- * @remarks
19699
- *
19700
- * Navigation to `about:blank` or navigation to the same URL with a different
19701
- * hash will succeed and return `null`.
19702
- *
19703
- * :::warning
19704
- *
19705
- * Headless mode doesn't support navigation to a PDF document. See the {@link
19706
- * https://bugs.chromium.org/p/chromium/issues/detail?id=761295 | upstream
19707
- * issue}.
19708
- *
19709
- * :::
19710
- *
19711
- * Shortcut for {@link Frame.goto | page.mainFrame().goto(url, options)}.
19712
- *
19713
- * @param url - URL to navigate page to. The URL should include scheme, e.g.
19714
- * `https://`
19715
- * @param options - Options to configure waiting behavior.
19716
- * @returns A promise which resolves to the main resource response. In case of
19717
- * multiple redirects, the navigation will resolve with the response of the
19718
- * last redirect.
19719
- * @throws If:
19720
- *
19721
- * - there's an SSL error (e.g. in case of self-signed certificates).
19722
- * - target URL is invalid.
19723
- * - the timeout is exceeded during navigation.
19724
- * - the remote server does not respond or is unreachable.
19725
- * - the main resource failed to load.
19726
- *
19727
- * This method will not throw an error when any valid HTTP status code is
19728
- * returned by the remote server, including 404 "Not Found" and 500 "Internal
19729
- * Server Error". The status code for such responses can be retrieved by
19730
- * calling {@link HTTPResponse.status}.
19779
+ * {@inheritDoc Frame.goto}
19731
19780
  */
19732
19781
  async goto(url, options) {
19733
19782
  return await this.mainFrame().goto(url, options);
@@ -19787,7 +19836,7 @@
19787
19836
  * {@link Page.setDefaultTimeout} method.
19788
19837
  */
19789
19838
  waitForRequest(urlOrPredicate, options = {}) {
19790
- const { timeout: ms = this._timeoutSettings.timeout() } = options;
19839
+ const { timeout: ms = this._timeoutSettings.timeout(), signal } = options;
19791
19840
  if (typeof urlOrPredicate === "string") {
19792
19841
  const url = urlOrPredicate;
19793
19842
  urlOrPredicate = (request) => {
@@ -19798,7 +19847,7 @@
19798
19847
  this,
19799
19848
  "request"
19800
19849
  /* PageEvent.Request */
19801
- ).pipe(filterAsync(urlOrPredicate), raceWith(timeout(ms), fromEmitterEvent(
19850
+ ).pipe(filterAsync(urlOrPredicate), raceWith(timeout(ms), fromAbortSignal(signal), fromEmitterEvent(
19802
19851
  this,
19803
19852
  "close"
19804
19853
  /* PageEvent.Close */
@@ -19835,7 +19884,7 @@
19835
19884
  * the {@link Page.setDefaultTimeout} method.
19836
19885
  */
19837
19886
  waitForResponse(urlOrPredicate, options = {}) {
19838
- const { timeout: ms = this._timeoutSettings.timeout() } = options;
19887
+ const { timeout: ms = this._timeoutSettings.timeout(), signal } = options;
19839
19888
  if (typeof urlOrPredicate === "string") {
19840
19889
  const url = urlOrPredicate;
19841
19890
  urlOrPredicate = (response) => {
@@ -19846,7 +19895,7 @@
19846
19895
  this,
19847
19896
  "response"
19848
19897
  /* PageEvent.Response */
19849
- ).pipe(filterAsync(urlOrPredicate), raceWith(timeout(ms), fromEmitterEvent(
19898
+ ).pipe(filterAsync(urlOrPredicate), raceWith(timeout(ms), fromAbortSignal(signal), fromEmitterEvent(
19850
19899
  this,
19851
19900
  "close"
19852
19901
  /* PageEvent.Close */
@@ -19868,14 +19917,14 @@
19868
19917
  * @internal
19869
19918
  */
19870
19919
  waitForNetworkIdle$(options = {}) {
19871
- const { timeout: ms = this._timeoutSettings.timeout(), idleTime = NETWORK_IDLE_TIME, concurrency = 0 } = options;
19920
+ const { timeout: ms = this._timeoutSettings.timeout(), idleTime = NETWORK_IDLE_TIME, concurrency = 0, signal } = options;
19872
19921
  return this.#inflight$.pipe(switchMap((inflight) => {
19873
19922
  if (inflight > concurrency) {
19874
19923
  return EMPTY;
19875
19924
  }
19876
19925
  return timer(idleTime);
19877
19926
  }), map(() => {
19878
- }), raceWith(timeout(ms), fromEmitterEvent(
19927
+ }), raceWith(timeout(ms), fromAbortSignal(signal), fromEmitterEvent(
19879
19928
  this,
19880
19929
  "close"
19881
19930
  /* PageEvent.Close */
@@ -19895,7 +19944,7 @@
19895
19944
  * ```
19896
19945
  */
19897
19946
  async waitForFrame(urlOrPredicate, options = {}) {
19898
- const { timeout: ms = this.getDefaultTimeout() } = options;
19947
+ const { timeout: ms = this.getDefaultTimeout(), signal } = options;
19899
19948
  if (isString3(urlOrPredicate)) {
19900
19949
  urlOrPredicate = (frame) => {
19901
19950
  return urlOrPredicate === frame.url();
@@ -19909,7 +19958,7 @@
19909
19958
  this,
19910
19959
  "framenavigated"
19911
19960
  /* PageEvent.FrameNavigated */
19912
- ), from(this.frames())).pipe(filterAsync(urlOrPredicate), first(), raceWith(timeout(ms), fromEmitterEvent(
19961
+ ), from(this.frames())).pipe(filterAsync(urlOrPredicate), first(), raceWith(timeout(ms), fromAbortSignal(signal), fromEmitterEvent(
19913
19962
  this,
19914
19963
  "close"
19915
19964
  /* PageEvent.Close */
@@ -20230,14 +20279,7 @@
20230
20279
  ...scrollDimensions
20231
20280
  });
20232
20281
  stack.defer(async () => {
20233
- if (viewport) {
20234
- await this.setViewport(viewport).catch(debugError);
20235
- } else {
20236
- await this.setViewport({
20237
- width: 0,
20238
- height: 0
20239
- }).catch(debugError);
20240
- }
20282
+ await this.setViewport(viewport).catch(debugError);
20241
20283
  });
20242
20284
  }
20243
20285
  } else {
@@ -20573,7 +20615,7 @@
20573
20615
  #args;
20574
20616
  #stackTraceLocations;
20575
20617
  /**
20576
- * @public
20618
+ * @internal
20577
20619
  */
20578
20620
  constructor(type, text, args, stackTraceLocations) {
20579
20621
  this.#type = type;
@@ -20683,482 +20725,112 @@
20683
20725
  init_Deferred();
20684
20726
  init_disposable();
20685
20727
 
20686
- // node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Accessibility.js
20728
+ // node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Binding.js
20687
20729
  init_dirname();
20688
20730
  init_buffer2();
20689
- var Accessibility = class {
20690
- #client;
20691
- /**
20692
- * @internal
20693
- */
20694
- constructor(client) {
20695
- this.#client = client;
20731
+
20732
+ // node_modules/puppeteer-core/lib/esm/puppeteer/api/JSHandle.js
20733
+ init_dirname();
20734
+ init_buffer2();
20735
+ init_util2();
20736
+ init_decorators();
20737
+ init_disposable();
20738
+ var __runInitializers3 = function(thisArg, initializers, value) {
20739
+ var useValue = arguments.length > 2;
20740
+ for (var i7 = 0; i7 < initializers.length; i7++) {
20741
+ value = useValue ? initializers[i7].call(thisArg, value) : initializers[i7].call(thisArg);
20696
20742
  }
20697
- /**
20698
- * @internal
20699
- */
20700
- updateClient(client) {
20701
- this.#client = client;
20743
+ return useValue ? value : void 0;
20744
+ };
20745
+ var __esDecorate3 = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
20746
+ function accept(f7) {
20747
+ if (f7 !== void 0 && typeof f7 !== "function") throw new TypeError("Function expected");
20748
+ return f7;
20702
20749
  }
20703
- /**
20704
- * Captures the current state of the accessibility tree.
20705
- * The returned object represents the root accessible node of the page.
20706
- *
20707
- * @remarks
20708
- *
20709
- * **NOTE** The Chrome accessibility tree contains nodes that go unused on
20710
- * most platforms and by most screen readers. Puppeteer will discard them as
20711
- * well for an easier to process tree, unless `interestingOnly` is set to
20712
- * `false`.
20713
- *
20714
- * @example
20715
- * An example of dumping the entire accessibility tree:
20716
- *
20717
- * ```ts
20718
- * const snapshot = await page.accessibility.snapshot();
20719
- * console.log(snapshot);
20720
- * ```
20721
- *
20722
- * @example
20723
- * An example of logging the focused node's name:
20724
- *
20725
- * ```ts
20726
- * const snapshot = await page.accessibility.snapshot();
20727
- * const node = findFocusedNode(snapshot);
20728
- * console.log(node && node.name);
20729
- *
20730
- * function findFocusedNode(node) {
20731
- * if (node.focused) return node;
20732
- * for (const child of node.children || []) {
20733
- * const foundNode = findFocusedNode(child);
20734
- * return foundNode;
20735
- * }
20736
- * return null;
20737
- * }
20738
- * ```
20739
- *
20740
- * @returns An AXNode object representing the snapshot.
20741
- */
20742
- async snapshot(options = {}) {
20743
- const { interestingOnly = true, root = null } = options;
20744
- const { nodes } = await this.#client.send("Accessibility.getFullAXTree");
20745
- let backendNodeId;
20746
- if (root) {
20747
- const { node } = await this.#client.send("DOM.describeNode", {
20748
- objectId: root.id
20749
- });
20750
- backendNodeId = node.backendNodeId;
20751
- }
20752
- const defaultRoot = AXNode.createTree(nodes);
20753
- let needle = defaultRoot;
20754
- if (backendNodeId) {
20755
- needle = defaultRoot.find((node) => {
20756
- return node.payload.backendDOMNodeId === backendNodeId;
20757
- });
20758
- if (!needle) {
20759
- return null;
20760
- }
20761
- }
20762
- if (!interestingOnly) {
20763
- return this.serializeTree(needle)[0] ?? null;
20764
- }
20765
- const interestingNodes = /* @__PURE__ */ new Set();
20766
- this.collectInterestingNodes(interestingNodes, defaultRoot, false);
20767
- if (!interestingNodes.has(needle)) {
20768
- return null;
20750
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
20751
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
20752
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
20753
+ var _4, done = false;
20754
+ for (var i7 = decorators.length - 1; i7 >= 0; i7--) {
20755
+ var context2 = {};
20756
+ for (var p7 in contextIn) context2[p7] = p7 === "access" ? {} : contextIn[p7];
20757
+ for (var p7 in contextIn.access) context2.access[p7] = contextIn.access[p7];
20758
+ context2.addInitializer = function(f7) {
20759
+ if (done) throw new TypeError("Cannot add initializers after decoration has completed");
20760
+ extraInitializers.push(accept(f7 || null));
20761
+ };
20762
+ var result = (0, decorators[i7])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context2);
20763
+ if (kind === "accessor") {
20764
+ if (result === void 0) continue;
20765
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
20766
+ if (_4 = accept(result.get)) descriptor.get = _4;
20767
+ if (_4 = accept(result.set)) descriptor.set = _4;
20768
+ if (_4 = accept(result.init)) initializers.unshift(_4);
20769
+ } else if (_4 = accept(result)) {
20770
+ if (kind === "field") initializers.unshift(_4);
20771
+ else descriptor[key] = _4;
20769
20772
  }
20770
- return this.serializeTree(needle, interestingNodes)[0] ?? null;
20771
20773
  }
20772
- serializeTree(node, interestingNodes) {
20773
- const children = [];
20774
- for (const child of node.children) {
20775
- children.push(...this.serializeTree(child, interestingNodes));
20776
- }
20777
- if (interestingNodes && !interestingNodes.has(node)) {
20778
- return children;
20774
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
20775
+ done = true;
20776
+ };
20777
+ var __addDisposableResource4 = function(env, value, async2) {
20778
+ if (value !== null && value !== void 0) {
20779
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
20780
+ var dispose;
20781
+ if (async2) {
20782
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
20783
+ dispose = value[Symbol.asyncDispose];
20779
20784
  }
20780
- const serializedNode = node.serialize();
20781
- if (children.length) {
20782
- serializedNode.children = children;
20785
+ if (dispose === void 0) {
20786
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
20787
+ dispose = value[Symbol.dispose];
20783
20788
  }
20784
- return [serializedNode];
20789
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
20790
+ env.stack.push({ value, dispose, async: async2 });
20791
+ } else if (async2) {
20792
+ env.stack.push({ async: true });
20785
20793
  }
20786
- collectInterestingNodes(collection, node, insideControl) {
20787
- if (node.isInteresting(insideControl)) {
20788
- collection.add(node);
20794
+ return value;
20795
+ };
20796
+ var __disposeResources4 = /* @__PURE__ */ function(SuppressedError2) {
20797
+ return function(env) {
20798
+ function fail2(e9) {
20799
+ env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
20800
+ env.hasError = true;
20789
20801
  }
20790
- if (node.isLeafNode()) {
20791
- return;
20802
+ function next() {
20803
+ while (env.stack.length) {
20804
+ var rec = env.stack.pop();
20805
+ try {
20806
+ var result = rec.dispose && rec.dispose.call(rec.value);
20807
+ if (rec.async) return Promise.resolve(result).then(next, function(e9) {
20808
+ fail2(e9);
20809
+ return next();
20810
+ });
20811
+ } catch (e9) {
20812
+ fail2(e9);
20813
+ }
20814
+ }
20815
+ if (env.hasError) throw env.error;
20792
20816
  }
20793
- insideControl = insideControl || node.isControl();
20794
- for (const child of node.children) {
20795
- this.collectInterestingNodes(collection, child, insideControl);
20796
- }
20797
- }
20798
- };
20799
- var AXNode = class _AXNode {
20800
- payload;
20801
- children = [];
20802
- #richlyEditable = false;
20803
- #editable = false;
20804
- #focusable = false;
20805
- #hidden = false;
20806
- #name;
20807
- #role;
20808
- #ignored;
20809
- #cachedHasFocusableChild;
20810
- constructor(payload) {
20811
- this.payload = payload;
20812
- this.#name = this.payload.name ? this.payload.name.value : "";
20813
- this.#role = this.payload.role ? this.payload.role.value : "Unknown";
20814
- this.#ignored = this.payload.ignored;
20815
- for (const property of this.payload.properties || []) {
20816
- if (property.name === "editable") {
20817
- this.#richlyEditable = property.value.value === "richtext";
20818
- this.#editable = true;
20819
- }
20820
- if (property.name === "focusable") {
20821
- this.#focusable = property.value.value;
20822
- }
20823
- if (property.name === "hidden") {
20824
- this.#hidden = property.value.value;
20825
- }
20826
- }
20827
- }
20828
- #isPlainTextField() {
20829
- if (this.#richlyEditable) {
20830
- return false;
20831
- }
20832
- if (this.#editable) {
20833
- return true;
20834
- }
20835
- return this.#role === "textbox" || this.#role === "searchbox";
20836
- }
20837
- #isTextOnlyObject() {
20838
- const role = this.#role;
20839
- return role === "LineBreak" || role === "text" || role === "InlineTextBox" || role === "StaticText";
20840
- }
20841
- #hasFocusableChild() {
20842
- if (this.#cachedHasFocusableChild === void 0) {
20843
- this.#cachedHasFocusableChild = false;
20844
- for (const child of this.children) {
20845
- if (child.#focusable || child.#hasFocusableChild()) {
20846
- this.#cachedHasFocusableChild = true;
20847
- break;
20848
- }
20849
- }
20850
- }
20851
- return this.#cachedHasFocusableChild;
20852
- }
20853
- find(predicate) {
20854
- if (predicate(this)) {
20855
- return this;
20856
- }
20857
- for (const child of this.children) {
20858
- const result = child.find(predicate);
20859
- if (result) {
20860
- return result;
20861
- }
20862
- }
20863
- return null;
20864
- }
20865
- isLeafNode() {
20866
- if (!this.children.length) {
20867
- return true;
20868
- }
20869
- if (this.#isPlainTextField() || this.#isTextOnlyObject()) {
20870
- return true;
20871
- }
20872
- switch (this.#role) {
20873
- case "doc-cover":
20874
- case "graphics-symbol":
20875
- case "img":
20876
- case "image":
20877
- case "Meter":
20878
- case "scrollbar":
20879
- case "slider":
20880
- case "separator":
20881
- case "progressbar":
20882
- return true;
20883
- default:
20884
- break;
20885
- }
20886
- if (this.#hasFocusableChild()) {
20887
- return false;
20888
- }
20889
- if (this.#focusable && this.#name) {
20890
- return true;
20891
- }
20892
- if (this.#role === "heading" && this.#name) {
20893
- return true;
20894
- }
20895
- return false;
20896
- }
20897
- isControl() {
20898
- switch (this.#role) {
20899
- case "button":
20900
- case "checkbox":
20901
- case "ColorWell":
20902
- case "combobox":
20903
- case "DisclosureTriangle":
20904
- case "listbox":
20905
- case "menu":
20906
- case "menubar":
20907
- case "menuitem":
20908
- case "menuitemcheckbox":
20909
- case "menuitemradio":
20910
- case "radio":
20911
- case "scrollbar":
20912
- case "searchbox":
20913
- case "slider":
20914
- case "spinbutton":
20915
- case "switch":
20916
- case "tab":
20917
- case "textbox":
20918
- case "tree":
20919
- case "treeitem":
20920
- return true;
20921
- default:
20922
- return false;
20923
- }
20924
- }
20925
- isInteresting(insideControl) {
20926
- const role = this.#role;
20927
- if (role === "Ignored" || this.#hidden || this.#ignored) {
20928
- return false;
20929
- }
20930
- if (this.#focusable || this.#richlyEditable) {
20931
- return true;
20932
- }
20933
- if (this.isControl()) {
20934
- return true;
20935
- }
20936
- if (insideControl) {
20937
- return false;
20938
- }
20939
- return this.isLeafNode() && !!this.#name;
20940
- }
20941
- serialize() {
20942
- const properties = /* @__PURE__ */ new Map();
20943
- for (const property of this.payload.properties || []) {
20944
- properties.set(property.name.toLowerCase(), property.value.value);
20945
- }
20946
- if (this.payload.name) {
20947
- properties.set("name", this.payload.name.value);
20948
- }
20949
- if (this.payload.value) {
20950
- properties.set("value", this.payload.value.value);
20951
- }
20952
- if (this.payload.description) {
20953
- properties.set("description", this.payload.description.value);
20954
- }
20955
- const node = {
20956
- role: this.#role
20957
- };
20958
- const userStringProperties = [
20959
- "name",
20960
- "value",
20961
- "description",
20962
- "keyshortcuts",
20963
- "roledescription",
20964
- "valuetext"
20965
- ];
20966
- const getUserStringPropertyValue = (key) => {
20967
- return properties.get(key);
20968
- };
20969
- for (const userStringProperty of userStringProperties) {
20970
- if (!properties.has(userStringProperty)) {
20971
- continue;
20972
- }
20973
- node[userStringProperty] = getUserStringPropertyValue(userStringProperty);
20974
- }
20975
- const booleanProperties = [
20976
- "disabled",
20977
- "expanded",
20978
- "focused",
20979
- "modal",
20980
- "multiline",
20981
- "multiselectable",
20982
- "readonly",
20983
- "required",
20984
- "selected"
20985
- ];
20986
- const getBooleanPropertyValue = (key) => {
20987
- return properties.get(key);
20988
- };
20989
- for (const booleanProperty of booleanProperties) {
20990
- if (booleanProperty === "focused" && this.#role === "RootWebArea") {
20991
- continue;
20992
- }
20993
- const value = getBooleanPropertyValue(booleanProperty);
20994
- if (!value) {
20995
- continue;
20996
- }
20997
- node[booleanProperty] = getBooleanPropertyValue(booleanProperty);
20998
- }
20999
- const tristateProperties = ["checked", "pressed"];
21000
- for (const tristateProperty of tristateProperties) {
21001
- if (!properties.has(tristateProperty)) {
21002
- continue;
21003
- }
21004
- const value = properties.get(tristateProperty);
21005
- node[tristateProperty] = value === "mixed" ? "mixed" : value === "true" ? true : false;
21006
- }
21007
- const numericalProperties = [
21008
- "level",
21009
- "valuemax",
21010
- "valuemin"
21011
- ];
21012
- const getNumericalPropertyValue = (key) => {
21013
- return properties.get(key);
21014
- };
21015
- for (const numericalProperty of numericalProperties) {
21016
- if (!properties.has(numericalProperty)) {
21017
- continue;
21018
- }
21019
- node[numericalProperty] = getNumericalPropertyValue(numericalProperty);
21020
- }
21021
- const tokenProperties = [
21022
- "autocomplete",
21023
- "haspopup",
21024
- "invalid",
21025
- "orientation"
21026
- ];
21027
- const getTokenPropertyValue = (key) => {
21028
- return properties.get(key);
21029
- };
21030
- for (const tokenProperty of tokenProperties) {
21031
- const value = getTokenPropertyValue(tokenProperty);
21032
- if (!value || value === "false") {
21033
- continue;
21034
- }
21035
- node[tokenProperty] = getTokenPropertyValue(tokenProperty);
21036
- }
21037
- return node;
21038
- }
21039
- static createTree(payloads) {
21040
- const nodeById = /* @__PURE__ */ new Map();
21041
- for (const payload of payloads) {
21042
- nodeById.set(payload.nodeId, new _AXNode(payload));
21043
- }
21044
- for (const node of nodeById.values()) {
21045
- for (const childId of node.payload.childIds || []) {
21046
- const child = nodeById.get(childId);
21047
- if (child) {
21048
- node.children.push(child);
21049
- }
21050
- }
21051
- }
21052
- return nodeById.values().next().value;
21053
- }
21054
- };
21055
-
21056
- // node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Binding.js
21057
- init_dirname();
21058
- init_buffer2();
21059
-
21060
- // node_modules/puppeteer-core/lib/esm/puppeteer/api/JSHandle.js
21061
- init_dirname();
21062
- init_buffer2();
21063
- init_util2();
21064
- init_decorators();
21065
- init_disposable();
21066
- var __runInitializers3 = function(thisArg, initializers, value) {
21067
- var useValue = arguments.length > 2;
21068
- for (var i7 = 0; i7 < initializers.length; i7++) {
21069
- value = useValue ? initializers[i7].call(thisArg, value) : initializers[i7].call(thisArg);
21070
- }
21071
- return useValue ? value : void 0;
21072
- };
21073
- var __esDecorate3 = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
21074
- function accept(f7) {
21075
- if (f7 !== void 0 && typeof f7 !== "function") throw new TypeError("Function expected");
21076
- return f7;
21077
- }
21078
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
21079
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
21080
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
21081
- var _4, done = false;
21082
- for (var i7 = decorators.length - 1; i7 >= 0; i7--) {
21083
- var context2 = {};
21084
- for (var p7 in contextIn) context2[p7] = p7 === "access" ? {} : contextIn[p7];
21085
- for (var p7 in contextIn.access) context2.access[p7] = contextIn.access[p7];
21086
- context2.addInitializer = function(f7) {
21087
- if (done) throw new TypeError("Cannot add initializers after decoration has completed");
21088
- extraInitializers.push(accept(f7 || null));
21089
- };
21090
- var result = (0, decorators[i7])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context2);
21091
- if (kind === "accessor") {
21092
- if (result === void 0) continue;
21093
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
21094
- if (_4 = accept(result.get)) descriptor.get = _4;
21095
- if (_4 = accept(result.set)) descriptor.set = _4;
21096
- if (_4 = accept(result.init)) initializers.unshift(_4);
21097
- } else if (_4 = accept(result)) {
21098
- if (kind === "field") initializers.unshift(_4);
21099
- else descriptor[key] = _4;
21100
- }
21101
- }
21102
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
21103
- done = true;
21104
- };
21105
- var __addDisposableResource4 = function(env, value, async2) {
21106
- if (value !== null && value !== void 0) {
21107
- if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
21108
- var dispose;
21109
- if (async2) {
21110
- if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
21111
- dispose = value[Symbol.asyncDispose];
21112
- }
21113
- if (dispose === void 0) {
21114
- if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
21115
- dispose = value[Symbol.dispose];
21116
- }
21117
- if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
21118
- env.stack.push({ value, dispose, async: async2 });
21119
- } else if (async2) {
21120
- env.stack.push({ async: true });
21121
- }
21122
- return value;
21123
- };
21124
- var __disposeResources4 = /* @__PURE__ */ function(SuppressedError2) {
21125
- return function(env) {
21126
- function fail2(e9) {
21127
- env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
21128
- env.hasError = true;
21129
- }
21130
- function next() {
21131
- while (env.stack.length) {
21132
- var rec = env.stack.pop();
21133
- try {
21134
- var result = rec.dispose && rec.dispose.call(rec.value);
21135
- if (rec.async) return Promise.resolve(result).then(next, function(e9) {
21136
- fail2(e9);
21137
- return next();
21138
- });
21139
- } catch (e9) {
21140
- fail2(e9);
21141
- }
21142
- }
21143
- if (env.hasError) throw env.error;
21144
- }
21145
- return next();
21146
- };
21147
- }(typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
21148
- var e9 = new Error(message);
21149
- return e9.name = "SuppressedError", e9.error = error, e9.suppressed = suppressed, e9;
21150
- });
21151
- var JSHandle = (() => {
21152
- let _classDecorators = [moveable];
21153
- let _classDescriptor;
21154
- let _classExtraInitializers = [];
21155
- let _classThis;
21156
- let _instanceExtraInitializers = [];
21157
- let _getProperty_decorators;
21158
- let _getProperties_decorators;
21159
- var JSHandle2 = class {
21160
- static {
21161
- _classThis = this;
20817
+ return next();
20818
+ };
20819
+ }(typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
20820
+ var e9 = new Error(message);
20821
+ return e9.name = "SuppressedError", e9.error = error, e9.suppressed = suppressed, e9;
20822
+ });
20823
+ var JSHandle = (() => {
20824
+ let _classDecorators = [moveable];
20825
+ let _classDescriptor;
20826
+ let _classExtraInitializers = [];
20827
+ let _classThis;
20828
+ let _instanceExtraInitializers = [];
20829
+ let _getProperty_decorators;
20830
+ let _getProperties_decorators;
20831
+ var JSHandle2 = class {
20832
+ static {
20833
+ _classThis = this;
21162
20834
  }
21163
20835
  static {
21164
20836
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? /* @__PURE__ */ Object.create(null) : void 0;
@@ -21392,7 +21064,6 @@
21392
21064
  init_Debug();
21393
21065
  init_Errors();
21394
21066
  init_EventEmitter();
21395
- init_assert();
21396
21067
  var debugProtocolSend = debug("puppeteer:protocol:SEND \u25BA");
21397
21068
  var debugProtocolReceive = debug("puppeteer:protocol:RECV \u25C0");
21398
21069
  var Connection = class extends EventEmitter2 {
@@ -21454,7 +21125,9 @@
21454
21125
  * @internal
21455
21126
  */
21456
21127
  _rawSend(callbacks, method, params, sessionId, options) {
21457
- assert(!this.#closed, "Protocol error: Connection closed.");
21128
+ if (this.#closed) {
21129
+ return Promise.reject(new Error("Protocol error: Connection closed."));
21130
+ }
21458
21131
  return callbacks.create(method, options?.timeout ?? this.#timeout, (id) => {
21459
21132
  const stringifiedMessage = JSON.stringify({
21460
21133
  method,
@@ -21594,6 +21267,9 @@
21594
21267
  var Coverage = class {
21595
21268
  #jsCoverage;
21596
21269
  #cssCoverage;
21270
+ /**
21271
+ * @internal
21272
+ */
21597
21273
  constructor(client) {
21598
21274
  this.#jsCoverage = new JSCoverage(client);
21599
21275
  this.#cssCoverage = new CSSCoverage(client);
@@ -21661,6 +21337,9 @@
21661
21337
  #resetOnNavigation = false;
21662
21338
  #reportAnonymousScripts = false;
21663
21339
  #includeRawScriptCoverage = false;
21340
+ /**
21341
+ * @internal
21342
+ */
21664
21343
  constructor(client) {
21665
21344
  this.#client = client;
21666
21345
  }
@@ -22077,6 +21756,12 @@
22077
21756
  _private_setJavaScriptEnabled_decorators = [invokeAtMostOnceForArguments];
22078
21757
  __esDecorate4(this, _private_applyViewport_descriptor = { value: __setFunctionName2(async function(client, viewportState) {
22079
21758
  if (!viewportState.viewport) {
21759
+ await Promise.all([
21760
+ client.send("Emulation.clearDeviceMetricsOverride"),
21761
+ client.send("Emulation.setTouchEmulationEnabled", {
21762
+ enabled: false
21763
+ })
21764
+ ]).catch(debugError);
22080
21765
  return;
22081
21766
  }
22082
21767
  const { viewport } = viewportState;
@@ -22193,7 +21878,7 @@
22193
21878
  }, "#setJavaScriptEnabled") }, _private_setJavaScriptEnabled_decorators, { kind: "method", name: "#setJavaScriptEnabled", static: false, private: true, access: { has: (obj) => #setJavaScriptEnabled in obj, get: (obj) => obj.#setJavaScriptEnabled }, metadata: _metadata }, null, _instanceExtraInitializers);
22194
21879
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
22195
21880
  }
22196
- #client = (__runInitializers4(this, _instanceExtraInitializers), void 0);
21881
+ #client = __runInitializers4(this, _instanceExtraInitializers);
22197
21882
  #emulatingMobile = false;
22198
21883
  #hasTouch = false;
22199
21884
  #states = [];
@@ -22255,12 +21940,18 @@
22255
21940
  return this.#javascriptEnabledState.state.javaScriptEnabled;
22256
21941
  }
22257
21942
  async emulateViewport(viewport) {
22258
- await this.#viewportState.setState({
21943
+ const currentState = this.#viewportState.state;
21944
+ if (!viewport && !currentState.active) {
21945
+ return false;
21946
+ }
21947
+ await this.#viewportState.setState(viewport ? {
22259
21948
  viewport,
22260
21949
  active: true
21950
+ } : {
21951
+ active: false
22261
21952
  });
22262
- const mobile = viewport.isMobile || false;
22263
- const hasTouch = viewport.hasTouch || false;
21953
+ const mobile = viewport?.isMobile || false;
21954
+ const hasTouch = viewport?.hasTouch || false;
22264
21955
  const reloadNeeded = this.#emulatingMobile !== mobile || this.#hasTouch !== hasTouch;
22265
21956
  this.#emulatingMobile = mobile;
22266
21957
  this.#hasTouch = hasTouch;
@@ -22880,6 +22571,7 @@
22880
22571
  return await frame.isolatedRealm().adoptHandle(elementOrFrame);
22881
22572
  })(), false);
22882
22573
  const { visible = false, hidden = false, timeout: timeout2, signal } = options;
22574
+ const polling = options.polling ?? (visible || hidden ? "raf" : "mutation");
22883
22575
  try {
22884
22576
  const env_4 = { stack: [], error: void 0, hasError: false };
22885
22577
  try {
@@ -22889,7 +22581,7 @@
22889
22581
  const node = await querySelector(root ?? document, selector2, PuppeteerUtil);
22890
22582
  return PuppeteerUtil.checkVisibility(node, visible2);
22891
22583
  }, {
22892
- polling: visible || hidden ? "raf" : "mutation",
22584
+ polling,
22893
22585
  root: element,
22894
22586
  timeout: timeout2,
22895
22587
  signal
@@ -22994,6 +22686,18 @@
22994
22686
  };
22995
22687
  };
22996
22688
 
22689
+ // node_modules/puppeteer-core/lib/esm/puppeteer/common/CSSQueryHandler.js
22690
+ init_dirname();
22691
+ init_buffer2();
22692
+ var CSSQueryHandler = class extends QueryHandler {
22693
+ static querySelector = (element, selector, { cssQuerySelector }) => {
22694
+ return cssQuerySelector(element, selector);
22695
+ };
22696
+ static querySelectorAll = (element, selector, { cssQuerySelectorAll }) => {
22697
+ return cssQuerySelectorAll(element, selector);
22698
+ };
22699
+ };
22700
+
22997
22701
  // node_modules/puppeteer-core/lib/esm/puppeteer/common/CustomQueryHandler.js
22998
22702
  init_dirname();
22999
22703
  init_buffer2();
@@ -23006,7 +22710,7 @@
23006
22710
  // node_modules/puppeteer-core/lib/esm/puppeteer/generated/injected.js
23007
22711
  init_dirname();
23008
22712
  init_buffer2();
23009
- var source = '"use strict";var A=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var oe=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var n in e)A(t,n,{get:e[n],enumerable:!0})},se=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ne(e))!oe.call(t,o)&&o!==n&&A(t,o,{get:()=>e[o],enumerable:!(r=re(e,o))||r.enumerable});return t};var ie=t=>se(A({},"__esModule",{value:!0}),t);var Re={};u(Re,{default:()=>ke});module.exports=ie(Re);var C=class extends Error{constructor(e,n){super(e,n),this.name=this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}},b=class extends C{};var f=class t{static create(e){return new t(e)}static async race(e){let n=new Set;try{let r=e.map(o=>o instanceof t?(o.#s&&n.add(o),o.valueOrThrow()):o);return await Promise.race(r)}finally{for(let r of n)r.reject(new Error("Timeout cleared"))}}#e=!1;#r=!1;#n;#t;#o=new Promise(e=>{this.#t=e});#s;#l;constructor(e){e&&e.timeout>0&&(this.#l=new b(e.message),this.#s=setTimeout(()=>{this.reject(this.#l)},e.timeout))}#a(e){clearTimeout(this.#s),this.#n=e,this.#t()}resolve(e){this.#r||this.#e||(this.#e=!0,this.#a(e))}reject(e){this.#r||this.#e||(this.#r=!0,this.#a(e))}resolved(){return this.#e}finished(){return this.#e||this.#r}value(){return this.#n}#i;valueOrThrow(){return this.#i||(this.#i=(async()=>{if(await this.#o,this.#r)throw this.#n;return this.#n})()),this.#i}};var X=new Map,z=t=>{let e=X.get(t);return e||(e=new Function(`return ${t}`)(),X.set(t,e),e)};var k={};u(k,{ariaQuerySelector:()=>le,ariaQuerySelectorAll:()=>I});var le=(t,e)=>globalThis.__ariaQuerySelector(t,e),I=async function*(t,e){yield*await globalThis.__ariaQuerySelectorAll(t,e)};var M={};u(M,{customQuerySelectors:()=>O});var R=class{#e=new Map;register(e,n){if(!n.queryOne&&n.queryAll){let r=n.queryAll;n.queryOne=(o,i)=>{for(let s of r(o,i))return s;return null}}else if(n.queryOne&&!n.queryAll){let r=n.queryOne;n.queryAll=(o,i)=>{let s=r(o,i);return s?[s]:[]}}else if(!n.queryOne||!n.queryAll)throw new Error("At least one query method must be defined.");this.#e.set(e,{querySelector:n.queryOne,querySelectorAll:n.queryAll})}unregister(e){this.#e.delete(e)}get(e){return this.#e.get(e)}clear(){this.#e.clear()}},O=new R;var q={};u(q,{pierceQuerySelector:()=>ae,pierceQuerySelectorAll:()=>ce});var ae=(t,e)=>{let n=null,r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&!n&&s.matches(e)&&(n=s)}while(!n&&i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n},ce=(t,e)=>{let n=[],r=o=>{let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&r(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==o&&s.matches(e)&&n.push(s)}while(i.nextNode())};return t instanceof Document&&(t=t.documentElement),r(t),n};var m=(t,e)=>{if(!t)throw new Error(e)};var T=class{#e;#r;#n;#t;constructor(e,n){this.#e=e,this.#r=n}async start(){let e=this.#t=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=new MutationObserver(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())}),this.#n.observe(this.#r,{childList:!0,subtree:!0,attributes:!0})}async stop(){m(this.#t,"Polling never started."),this.#t.finished()||this.#t.reject(new Error("Polling stopped")),this.#n&&(this.#n.disconnect(),this.#n=void 0)}result(){return m(this.#t,"Polling never started."),this.#t.valueOrThrow()}},E=class{#e;#r;constructor(e){this.#e=e}async start(){let e=this.#r=f.create(),n=await this.#e();if(n){e.resolve(n);return}let r=async()=>{if(e.finished())return;let o=await this.#e();if(!o){window.requestAnimationFrame(r);return}e.resolve(o),await this.stop()};window.requestAnimationFrame(r)}async stop(){m(this.#r,"Polling never started."),this.#r.finished()||this.#r.reject(new Error("Polling stopped"))}result(){return m(this.#r,"Polling never started."),this.#r.valueOrThrow()}},P=class{#e;#r;#n;#t;constructor(e,n){this.#e=e,this.#r=n}async start(){let e=this.#t=f.create(),n=await this.#e();if(n){e.resolve(n);return}this.#n=setInterval(async()=>{let r=await this.#e();r&&(e.resolve(r),await this.stop())},this.#r)}async stop(){m(this.#t,"Polling never started."),this.#t.finished()||this.#t.reject(new Error("Polling stopped")),this.#n&&(clearInterval(this.#n),this.#n=void 0)}result(){return m(this.#t,"Polling never started."),this.#t.valueOrThrow()}};var F={};u(F,{pQuerySelector:()=>Ce,pQuerySelectorAll:()=>te});var c=class{static async*map(e,n){for await(let r of e)yield await n(r)}static async*flatMap(e,n){for await(let r of e)yield*n(r)}static async collect(e){let n=[];for await(let r of e)n.push(r);return n}static async first(e){for await(let n of e)return n}};var p={attribute:/\\[\\s*(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)\\s*(?:(?<operator>\\W?=)\\s*(?<value>.+?)\\s*(\\s(?<caseSensitive>[iIsS]))?\\s*)?\\]/gu,id:/#(?<name>[-\\w\\P{ASCII}]+)/gu,class:/\\.(?<name>[-\\w\\P{ASCII}]+)/gu,comma:/\\s*,\\s*/g,combinator:/\\s*[\\s>+~]\\s*/g,"pseudo-element":/::(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>\xB6*)\\))?/gu,"pseudo-class":/:(?<name>[-\\w\\P{ASCII}]+)(?:\\((?<argument>\xB6*)\\))?/gu,universal:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?\\*/gu,type:/(?:(?<namespace>\\*|[-\\w\\P{ASCII}]*)\\|)?(?<name>[-\\w\\P{ASCII}]+)/gu},ue=new Set(["combinator","comma"]);var fe=t=>{switch(t){case"pseudo-element":case"pseudo-class":return new RegExp(p[t].source.replace("(?<argument>\\xB6*)","(?<argument>.*)"),"gu");default:return p[t]}};function de(t,e){let n=0,r="";for(;e<t.length;e++){let o=t[e];switch(o){case"(":++n;break;case")":--n;break}if(r+=o,n===0)return r}return r}function me(t,e=p){if(!t)return[];let n=[t];for(let[o,i]of Object.entries(e))for(let s=0;s<n.length;s++){let l=n[s];if(typeof l!="string")continue;i.lastIndex=0;let a=i.exec(l);if(!a)continue;let h=a.index-1,d=[],V=a[0],H=l.slice(0,h+1);H&&d.push(H),d.push({...a.groups,type:o,content:V});let B=l.slice(h+V.length+1);B&&d.push(B),n.splice(s,1,...d)}let r=0;for(let o of n)switch(typeof o){case"string":throw new Error(`Unexpected sequence ${o} found at index ${r}`);case"object":r+=o.content.length,o.pos=[r-o.content.length,r],ue.has(o.type)&&(o.content=o.content.trim()||" ");break}return n}var he=/([\'"])([^\\\\\\n]+?)\\1/g,pe=/\\\\./g;function G(t,e=p){if(t=t.trim(),t==="")return[];let n=[];t=t.replace(pe,(i,s)=>(n.push({value:i,offset:s}),"\\uE000".repeat(i.length))),t=t.replace(he,(i,s,l,a)=>(n.push({value:i,offset:a}),`${s}${"\\uE001".repeat(l.length)}${s}`));{let i=0,s;for(;(s=t.indexOf("(",i))>-1;){let l=de(t,s);n.push({value:l,offset:s}),t=`${t.substring(0,s)}(${"\\xB6".repeat(l.length-2)})${t.substring(s+l.length)}`,i=s+l.length}}let r=me(t,e),o=new Set;for(let i of n.reverse())for(let s of r){let{offset:l,value:a}=i;if(!(s.pos[0]<=l&&l+a.length<=s.pos[1]))continue;let{content:h}=s,d=l-s.pos[0];s.content=h.slice(0,d)+a+h.slice(d+a.length),s.content!==h&&o.add(s)}for(let i of o){let s=fe(i.type);if(!s)throw new Error(`Unknown token type: ${i.type}`);s.lastIndex=0;let l=s.exec(i.content);if(!l)throw new Error(`Unable to parse content for ${i.type}: ${i.content}`);Object.assign(i,l.groups)}return r}function*x(t,e){switch(t.type){case"list":for(let n of t.list)yield*x(n,t);break;case"complex":yield*x(t.left,t),yield*x(t.right,t);break;case"compound":yield*t.list.map(n=>[n,t]);break;default:yield[t,e]}}function y(t){let e;return Array.isArray(t)?e=t:e=[...x(t)].map(([n])=>n),e.map(n=>n.content).join("")}p.combinator=/\\s*(>>>>?|[\\s>+~])\\s*/g;var ye=/\\\\[\\s\\S]/g,ge=t=>t.length<=1?t:((t[0]===\'"\'||t[0]==="\'")&&t.endsWith(t[0])&&(t=t.slice(1,-1)),t.replace(ye,e=>e[1]));function K(t){let e=!0,n=G(t);if(n.length===0)return[[],e];let r=[],o=[r],i=[o],s=[];for(let l of n){switch(l.type){case"combinator":switch(l.content){case">>>":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(">>>"),o.push(r);continue;case">>>>":e=!1,s.length&&(r.push(y(s)),s.splice(0)),r=[],o.push(">>>>"),o.push(r);continue}break;case"pseudo-element":if(!l.name.startsWith("-p-"))break;e=!1,s.length&&(r.push(y(s)),s.splice(0)),r.push({name:l.name.slice(3),value:ge(l.argument??"")});continue;case"comma":s.length&&(r.push(y(s)),s.splice(0)),r=[],o=[r],i.push(o);continue}s.push(l)}return s.length&&r.push(y(s)),[i,e]}var _={};u(_,{textQuerySelectorAll:()=>S});var we=new Set(["checkbox","image","radio"]),Se=t=>t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&!we.has(t.type),be=new Set(["SCRIPT","STYLE"]),w=t=>!be.has(t.nodeName)&&!document.head?.contains(t),D=new WeakMap,J=t=>{for(;t;)D.delete(t),t instanceof ShadowRoot?t=t.host:t=t.parentNode},Y=new WeakSet,Te=new MutationObserver(t=>{for(let e of t)J(e.target)}),g=t=>{let e=D.get(t);if(e||(e={full:"",immediate:[]},!w(t)))return e;let n="";if(Se(t))e.full=t.value,e.immediate.push(t.value),t.addEventListener("input",r=>{J(r.target)},{once:!0,capture:!0});else{for(let r=t.firstChild;r;r=r.nextSibling){if(r.nodeType===Node.TEXT_NODE){e.full+=r.nodeValue??"",n+=r.nodeValue??"";continue}n&&e.immediate.push(n),n="",r.nodeType===Node.ELEMENT_NODE&&(e.full+=g(r).full)}n&&e.immediate.push(n),t instanceof Element&&t.shadowRoot&&(e.full+=g(t.shadowRoot).full),Y.has(t)||(Te.observe(t,{childList:!0,characterData:!0,subtree:!0}),Y.add(t))}return D.set(t,e),e};var S=function*(t,e){let n=!1;for(let r of t.childNodes)if(r instanceof Element&&w(r)){let o;r.shadowRoot?o=S(r.shadowRoot,e):o=S(r,e);for(let i of o)yield i,n=!0}n||t instanceof Element&&w(t)&&g(t).full.includes(e)&&(yield t)};var L={};u(L,{checkVisibility:()=>Pe,pierce:()=>N,pierceAll:()=>Q});var Ee=["hidden","collapse"],Pe=(t,e)=>{if(!t)return e===!1;if(e===void 0)return t;let n=t.nodeType===Node.TEXT_NODE?t.parentElement:t,r=window.getComputedStyle(n),o=r&&!Ee.includes(r.visibility)&&!xe(n);return e===o?t:!1};function xe(t){let e=t.getBoundingClientRect();return e.width===0||e.height===0}var Ne=t=>"shadowRoot"in t&&t.shadowRoot instanceof ShadowRoot;function*N(t){Ne(t)?yield t.shadowRoot:yield t}function*Q(t){t=N(t).next().value,yield t;let e=[document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT)];for(let n of e){let r;for(;r=n.nextNode();)r.shadowRoot&&(yield r.shadowRoot,e.push(document.createTreeWalker(r.shadowRoot,NodeFilter.SHOW_ELEMENT)))}}var j={};u(j,{xpathQuerySelectorAll:()=>$});var $=function*(t,e,n=-1){let o=(t.ownerDocument||document).evaluate(e,t,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE),i=[],s;for(;(s=o.iterateNext())&&(i.push(s),!(n&&i.length===n)););for(let l=0;l<i.length;l++)s=i[l],yield s,delete i[l]};var ve=/[-\\w\\P{ASCII}*]/,Z=t=>"querySelectorAll"in t,v=class extends Error{constructor(e,n){super(`${e} is not a valid selector: ${n}`)}},U=class{#e;#r;#n=[];#t=void 0;elements;constructor(e,n,r){this.elements=[e],this.#e=n,this.#r=r,this.#o()}async run(){if(typeof this.#t=="string")switch(this.#t.trimStart()){case":scope":this.#o();break}for(;this.#t!==void 0;this.#o()){let e=this.#t,n=this.#e;typeof e=="string"?e[0]&&ve.test(e[0])?this.elements=c.flatMap(this.elements,async function*(r){Z(r)&&(yield*r.querySelectorAll(e))}):this.elements=c.flatMap(this.elements,async function*(r){if(!r.parentElement){if(!Z(r))return;yield*r.querySelectorAll(e);return}let o=0;for(let i of r.parentElement.children)if(++o,i===r)break;yield*r.parentElement.querySelectorAll(`:scope>:nth-child(${o})${e}`)}):this.elements=c.flatMap(this.elements,async function*(r){switch(e.name){case"text":yield*S(r,e.value);break;case"xpath":yield*$(r,e.value);break;case"aria":yield*I(r,e.value);break;default:let o=O.get(e.name);if(!o)throw new v(n,`Unknown selector type: ${e.name}`);yield*o.querySelectorAll(r,e.value)}})}}#o(){if(this.#n.length!==0){this.#t=this.#n.shift();return}if(this.#r.length===0){this.#t=void 0;return}let e=this.#r.shift();switch(e){case">>>>":{this.elements=c.flatMap(this.elements,N),this.#o();break}case">>>":{this.elements=c.flatMap(this.elements,Q),this.#o();break}default:this.#n=e,this.#o();break}}},W=class{#e=new WeakMap;calculate(e,n=[]){if(e===null)return n;e instanceof ShadowRoot&&(e=e.host);let r=this.#e.get(e);if(r)return[...r,...n];let o=0;for(let s=e.previousSibling;s;s=s.previousSibling)++o;let i=this.calculate(e.parentNode,[o]);return this.#e.set(e,i),[...i,...n]}},ee=(t,e)=>{if(t.length+e.length===0)return 0;let[n=-1,...r]=t,[o=-1,...i]=e;return n===o?ee(r,i):n<o?-1:1},Ae=async function*(t){let e=new Set;for await(let r of t)e.add(r);let n=new W;yield*[...e.values()].map(r=>[r,n.calculate(r)]).sort(([,r],[,o])=>ee(r,o)).map(([r])=>r)},te=function(t,e){let n,r;try{[n,r]=K(e)}catch{return t.querySelectorAll(e)}if(r)return t.querySelectorAll(e);if(n.some(o=>{let i=0;return o.some(s=>(typeof s=="string"?++i:i=0,i>1))}))throw new v(e,"Multiple deep combinators found in sequence.");return Ae(c.flatMap(n,o=>{let i=new U(t,e,o);return i.run(),i.elements}))},Ce=async function(t,e){for await(let n of te(t,e))return n;return null};var Ie=Object.freeze({...k,...M,...q,...F,..._,...L,...j,Deferred:f,createFunction:z,createTextContent:g,IntervalPoller:P,isSuitableNodeForTextMatching:w,MutationPoller:T,RAFPoller:E}),ke=Ie;\n/**\n * @license\n * Copyright 2018 Google Inc.\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @license\n * Copyright 2024 Google Inc.\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @license\n * Copyright 2023 Google Inc.\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @license\n * Copyright 2022 Google Inc.\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @license\n * Copyright 2020 Google Inc.\n * SPDX-License-Identifier: Apache-2.0\n */\n';
22713
+ var source = '"use strict";var g=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var Y=Object.prototype.hasOwnProperty;var l=(t,e)=>{for(var r in e)g(t,r,{get:e[r],enumerable:!0})},J=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of B(e))!Y.call(t,n)&&n!==r&&g(t,n,{get:()=>e[n],enumerable:!(o=X(e,n))||o.enumerable});return t};var z=t=>J(g({},"__esModule",{value:!0}),t);var pe={};l(pe,{default:()=>he});module.exports=z(pe);var N=class extends Error{constructor(e,r){super(e,r),this.name=this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}},p=class extends N{};var c=class t{static create(e){return new t(e)}static async race(e){let r=new Set;try{let o=e.map(n=>n instanceof t?(n.#n&&r.add(n),n.valueOrThrow()):n);return await Promise.race(o)}finally{for(let o of r)o.reject(new Error("Timeout cleared"))}}#e=!1;#r=!1;#o;#t;#a=new Promise(e=>{this.#t=e});#n;#i;constructor(e){e&&e.timeout>0&&(this.#i=new p(e.message),this.#n=setTimeout(()=>{this.reject(this.#i)},e.timeout))}#l(e){clearTimeout(this.#n),this.#o=e,this.#t()}resolve(e){this.#r||this.#e||(this.#e=!0,this.#l(e))}reject(e){this.#r||this.#e||(this.#r=!0,this.#l(e))}resolved(){return this.#e}finished(){return this.#e||this.#r}value(){return this.#o}#s;valueOrThrow(){return this.#s||(this.#s=(async()=>{if(await this.#a,this.#r)throw this.#o;return this.#o})()),this.#s}};var L=new Map,F=t=>{let e=L.get(t);return e||(e=new Function(`return ${t}`)(),L.set(t,e),e)};var x={};l(x,{ariaQuerySelector:()=>G,ariaQuerySelectorAll:()=>b});var G=(t,e)=>globalThis.__ariaQuerySelector(t,e),b=async function*(t,e){yield*await globalThis.__ariaQuerySelectorAll(t,e)};var E={};l(E,{cssQuerySelector:()=>K,cssQuerySelectorAll:()=>Z});var K=(t,e)=>t.querySelector(e),Z=function(t,e){return t.querySelectorAll(e)};var A={};l(A,{customQuerySelectors:()=>P});var v=class{#e=new Map;register(e,r){if(!r.queryOne&&r.queryAll){let o=r.queryAll;r.queryOne=(n,i)=>{for(let s of o(n,i))return s;return null}}else if(r.queryOne&&!r.queryAll){let o=r.queryOne;r.queryAll=(n,i)=>{let s=o(n,i);return s?[s]:[]}}else if(!r.queryOne||!r.queryAll)throw new Error("At least one query method must be defined.");this.#e.set(e,{querySelector:r.queryOne,querySelectorAll:r.queryAll})}unregister(e){this.#e.delete(e)}get(e){return this.#e.get(e)}clear(){this.#e.clear()}},P=new v;var R={};l(R,{pierceQuerySelector:()=>ee,pierceQuerySelectorAll:()=>te});var ee=(t,e)=>{let r=null,o=n=>{let i=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&o(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==n&&!r&&s.matches(e)&&(r=s)}while(!r&&i.nextNode())};return t instanceof Document&&(t=t.documentElement),o(t),r},te=(t,e)=>{let r=[],o=n=>{let i=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&o(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==n&&s.matches(e)&&r.push(s)}while(i.nextNode())};return t instanceof Document&&(t=t.documentElement),o(t),r};var u=(t,e)=>{if(!t)throw new Error(e)};var y=class{#e;#r;#o;#t;constructor(e,r){this.#e=e,this.#r=r}async start(){let e=this.#t=c.create(),r=await this.#e();if(r){e.resolve(r);return}this.#o=new MutationObserver(async()=>{let o=await this.#e();o&&(e.resolve(o),await this.stop())}),this.#o.observe(this.#r,{childList:!0,subtree:!0,attributes:!0})}async stop(){u(this.#t,"Polling never started."),this.#t.finished()||this.#t.reject(new Error("Polling stopped")),this.#o&&(this.#o.disconnect(),this.#o=void 0)}result(){return u(this.#t,"Polling never started."),this.#t.valueOrThrow()}},w=class{#e;#r;constructor(e){this.#e=e}async start(){let e=this.#r=c.create(),r=await this.#e();if(r){e.resolve(r);return}let o=async()=>{if(e.finished())return;let n=await this.#e();if(!n){window.requestAnimationFrame(o);return}e.resolve(n),await this.stop()};window.requestAnimationFrame(o)}async stop(){u(this.#r,"Polling never started."),this.#r.finished()||this.#r.reject(new Error("Polling stopped"))}result(){return u(this.#r,"Polling never started."),this.#r.valueOrThrow()}},T=class{#e;#r;#o;#t;constructor(e,r){this.#e=e,this.#r=r}async start(){let e=this.#t=c.create(),r=await this.#e();if(r){e.resolve(r);return}this.#o=setInterval(async()=>{let o=await this.#e();o&&(e.resolve(o),await this.stop())},this.#r)}async stop(){u(this.#t,"Polling never started."),this.#t.finished()||this.#t.reject(new Error("Polling stopped")),this.#o&&(clearInterval(this.#o),this.#o=void 0)}result(){return u(this.#t,"Polling never started."),this.#t.valueOrThrow()}};var _={};l(_,{PCombinator:()=>H,pQuerySelector:()=>fe,pQuerySelectorAll:()=>$});var a=class{static async*map(e,r){for await(let o of e)yield await r(o)}static async*flatMap(e,r){for await(let o of e)yield*r(o)}static async collect(e){let r=[];for await(let o of e)r.push(o);return r}static async first(e){for await(let r of e)return r}};var C={};l(C,{textQuerySelectorAll:()=>m});var re=new Set(["checkbox","image","radio"]),oe=t=>t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&!re.has(t.type),ne=new Set(["SCRIPT","STYLE"]),f=t=>!ne.has(t.nodeName)&&!document.head?.contains(t),I=new WeakMap,j=t=>{for(;t;)I.delete(t),t instanceof ShadowRoot?t=t.host:t=t.parentNode},W=new WeakSet,se=new MutationObserver(t=>{for(let e of t)j(e.target)}),d=t=>{let e=I.get(t);if(e||(e={full:"",immediate:[]},!f(t)))return e;let r="";if(oe(t))e.full=t.value,e.immediate.push(t.value),t.addEventListener("input",o=>{j(o.target)},{once:!0,capture:!0});else{for(let o=t.firstChild;o;o=o.nextSibling){if(o.nodeType===Node.TEXT_NODE){e.full+=o.nodeValue??"",r+=o.nodeValue??"";continue}r&&e.immediate.push(r),r="",o.nodeType===Node.ELEMENT_NODE&&(e.full+=d(o).full)}r&&e.immediate.push(r),t instanceof Element&&t.shadowRoot&&(e.full+=d(t.shadowRoot).full),W.has(t)||(se.observe(t,{childList:!0,characterData:!0,subtree:!0}),W.add(t))}return I.set(t,e),e};var m=function*(t,e){let r=!1;for(let o of t.childNodes)if(o instanceof Element&&f(o)){let n;o.shadowRoot?n=m(o.shadowRoot,e):n=m(o,e);for(let i of n)yield i,r=!0}r||t instanceof Element&&f(t)&&d(t).full.includes(e)&&(yield t)};var k={};l(k,{checkVisibility:()=>le,pierce:()=>S,pierceAll:()=>O});var ie=["hidden","collapse"],le=(t,e)=>{if(!t)return e===!1;if(e===void 0)return t;let r=t.nodeType===Node.TEXT_NODE?t.parentElement:t,o=window.getComputedStyle(r),n=o&&!ie.includes(o.visibility)&&!ae(r);return e===n?t:!1};function ae(t){let e=t.getBoundingClientRect();return e.width===0||e.height===0}var ce=t=>"shadowRoot"in t&&t.shadowRoot instanceof ShadowRoot;function*S(t){ce(t)?yield t.shadowRoot:yield t}function*O(t){t=S(t).next().value,yield t;let e=[document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT)];for(let r of e){let o;for(;o=r.nextNode();)o.shadowRoot&&(yield o.shadowRoot,e.push(document.createTreeWalker(o.shadowRoot,NodeFilter.SHOW_ELEMENT)))}}var Q={};l(Q,{xpathQuerySelectorAll:()=>q});var q=function*(t,e,r=-1){let n=(t.ownerDocument||document).evaluate(e,t,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE),i=[],s;for(;(s=n.iterateNext())&&(i.push(s),!(r&&i.length===r)););for(let h=0;h<i.length;h++)s=i[h],yield s,delete i[h]};var ue=/[-\\w\\P{ASCII}*]/,H=(r=>(r.Descendent=">>>",r.Child=">>>>",r))(H||{}),V=t=>"querySelectorAll"in t,M=class{#e;#r=[];#o=void 0;elements;constructor(e,r){this.elements=[e],this.#e=r,this.#t()}async run(){if(typeof this.#o=="string")switch(this.#o.trimStart()){case":scope":this.#t();break}for(;this.#o!==void 0;this.#t()){let e=this.#o;typeof e=="string"?e[0]&&ue.test(e[0])?this.elements=a.flatMap(this.elements,async function*(r){V(r)&&(yield*r.querySelectorAll(e))}):this.elements=a.flatMap(this.elements,async function*(r){if(!r.parentElement){if(!V(r))return;yield*r.querySelectorAll(e);return}let o=0;for(let n of r.parentElement.children)if(++o,n===r)break;yield*r.parentElement.querySelectorAll(`:scope>:nth-child(${o})${e}`)}):this.elements=a.flatMap(this.elements,async function*(r){switch(e.name){case"text":yield*m(r,e.value);break;case"xpath":yield*q(r,e.value);break;case"aria":yield*b(r,e.value);break;default:let o=P.get(e.name);if(!o)throw new Error(`Unknown selector type: ${e.name}`);yield*o.querySelectorAll(r,e.value)}})}}#t(){if(this.#r.length!==0){this.#o=this.#r.shift();return}if(this.#e.length===0){this.#o=void 0;return}let e=this.#e.shift();switch(e){case">>>>":{this.elements=a.flatMap(this.elements,S),this.#t();break}case">>>":{this.elements=a.flatMap(this.elements,O),this.#t();break}default:this.#r=e,this.#t();break}}},D=class{#e=new WeakMap;calculate(e,r=[]){if(e===null)return r;e instanceof ShadowRoot&&(e=e.host);let o=this.#e.get(e);if(o)return[...o,...r];let n=0;for(let s=e.previousSibling;s;s=s.previousSibling)++n;let i=this.calculate(e.parentNode,[n]);return this.#e.set(e,i),[...i,...r]}},U=(t,e)=>{if(t.length+e.length===0)return 0;let[r=-1,...o]=t,[n=-1,...i]=e;return r===n?U(o,i):r<n?-1:1},de=async function*(t){let e=new Set;for await(let o of t)e.add(o);let r=new D;yield*[...e.values()].map(o=>[o,r.calculate(o)]).sort(([,o],[,n])=>U(o,n)).map(([o])=>o)},$=function(t,e){let r=JSON.parse(e);if(r.some(o=>{let n=0;return o.some(i=>(typeof i=="string"?++n:n=0,n>1))}))throw new Error("Multiple deep combinators found in sequence.");return de(a.flatMap(r,o=>{let n=new M(t,o);return n.run(),n.elements}))},fe=async function(t,e){for await(let r of $(t,e))return r;return null};var me=Object.freeze({...x,...A,...R,..._,...C,...k,...Q,...E,Deferred:c,createFunction:F,createTextContent:d,IntervalPoller:T,isSuitableNodeForTextMatching:f,MutationPoller:y,RAFPoller:w}),he=me;\n';
23010
22714
 
23011
22715
  // node_modules/puppeteer-core/lib/esm/puppeteer/common/ScriptInjector.js
23012
22716
  var ScriptInjector = class {
@@ -23124,34 +22828,316 @@
23124
22828
  for (const [registerScript] of this.#handlers) {
23125
22829
  scriptInjector.pop(registerScript);
23126
22830
  }
23127
- this.#handlers.clear();
22831
+ this.#handlers.clear();
22832
+ }
22833
+ };
22834
+ var customQueryHandlers = new CustomQueryHandlerRegistry();
22835
+
22836
+ // node_modules/puppeteer-core/lib/esm/puppeteer/common/PierceQueryHandler.js
22837
+ init_dirname();
22838
+ init_buffer2();
22839
+ var PierceQueryHandler = class extends QueryHandler {
22840
+ static querySelector = (element, selector, { pierceQuerySelector }) => {
22841
+ return pierceQuerySelector(element, selector);
22842
+ };
22843
+ static querySelectorAll = (element, selector, { pierceQuerySelectorAll }) => {
22844
+ return pierceQuerySelectorAll(element, selector);
22845
+ };
22846
+ };
22847
+
22848
+ // node_modules/puppeteer-core/lib/esm/puppeteer/common/PQueryHandler.js
22849
+ init_dirname();
22850
+ init_buffer2();
22851
+ var PQueryHandler = class extends QueryHandler {
22852
+ static querySelectorAll = (element, selector, { pQuerySelectorAll }) => {
22853
+ return pQuerySelectorAll(element, selector);
22854
+ };
22855
+ static querySelector = (element, selector, { pQuerySelector }) => {
22856
+ return pQuerySelector(element, selector);
22857
+ };
22858
+ };
22859
+
22860
+ // node_modules/puppeteer-core/lib/esm/puppeteer/common/PSelectorParser.js
22861
+ init_dirname();
22862
+ init_buffer2();
22863
+
22864
+ // node_modules/puppeteer-core/lib/esm/third_party/parsel-js/parsel-js.js
22865
+ init_dirname();
22866
+ init_buffer2();
22867
+ var TOKENS = {
22868
+ attribute: /\[\s*(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?(?<name>[-\w\P{ASCII}]+)\s*(?:(?<operator>\W?=)\s*(?<value>.+?)\s*(\s(?<caseSensitive>[iIsS]))?\s*)?\]/gu,
22869
+ id: /#(?<name>[-\w\P{ASCII}]+)/gu,
22870
+ class: /\.(?<name>[-\w\P{ASCII}]+)/gu,
22871
+ comma: /\s*,\s*/g,
22872
+ combinator: /\s*[\s>+~]\s*/g,
22873
+ "pseudo-element": /::(?<name>[-\w\P{ASCII}]+)(?:\((?<argument>¶*)\))?/gu,
22874
+ "pseudo-class": /:(?<name>[-\w\P{ASCII}]+)(?:\((?<argument>¶*)\))?/gu,
22875
+ universal: /(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?\*/gu,
22876
+ type: /(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?(?<name>[-\w\P{ASCII}]+)/gu
22877
+ // this must be last
22878
+ };
22879
+ var TRIM_TOKENS = /* @__PURE__ */ new Set(["combinator", "comma"]);
22880
+ var getArgumentPatternByType = (type) => {
22881
+ switch (type) {
22882
+ case "pseudo-element":
22883
+ case "pseudo-class":
22884
+ return new RegExp(TOKENS[type].source.replace("(?<argument>\xB6*)", "(?<argument>.*)"), "gu");
22885
+ default:
22886
+ return TOKENS[type];
22887
+ }
22888
+ };
22889
+ function gobbleParens(text, offset) {
22890
+ let nesting = 0;
22891
+ let result = "";
22892
+ for (; offset < text.length; offset++) {
22893
+ const char = text[offset];
22894
+ switch (char) {
22895
+ case "(":
22896
+ ++nesting;
22897
+ break;
22898
+ case ")":
22899
+ --nesting;
22900
+ break;
22901
+ }
22902
+ result += char;
22903
+ if (nesting === 0) {
22904
+ return result;
22905
+ }
22906
+ }
22907
+ return result;
22908
+ }
22909
+ function tokenizeBy(text, grammar = TOKENS) {
22910
+ if (!text) {
22911
+ return [];
22912
+ }
22913
+ const tokens = [text];
22914
+ for (const [type, pattern] of Object.entries(grammar)) {
22915
+ for (let i7 = 0; i7 < tokens.length; i7++) {
22916
+ const token = tokens[i7];
22917
+ if (typeof token !== "string") {
22918
+ continue;
22919
+ }
22920
+ pattern.lastIndex = 0;
22921
+ const match = pattern.exec(token);
22922
+ if (!match) {
22923
+ continue;
22924
+ }
22925
+ const from2 = match.index - 1;
22926
+ const args = [];
22927
+ const content = match[0];
22928
+ const before = token.slice(0, from2 + 1);
22929
+ if (before) {
22930
+ args.push(before);
22931
+ }
22932
+ args.push({
22933
+ ...match.groups,
22934
+ type,
22935
+ content
22936
+ });
22937
+ const after = token.slice(from2 + content.length + 1);
22938
+ if (after) {
22939
+ args.push(after);
22940
+ }
22941
+ tokens.splice(i7, 1, ...args);
22942
+ }
22943
+ }
22944
+ let offset = 0;
22945
+ for (const token of tokens) {
22946
+ switch (typeof token) {
22947
+ case "string":
22948
+ throw new Error(`Unexpected sequence ${token} found at index ${offset}`);
22949
+ case "object":
22950
+ offset += token.content.length;
22951
+ token.pos = [offset - token.content.length, offset];
22952
+ if (TRIM_TOKENS.has(token.type)) {
22953
+ token.content = token.content.trim() || " ";
22954
+ }
22955
+ break;
22956
+ }
22957
+ }
22958
+ return tokens;
22959
+ }
22960
+ var STRING_PATTERN = /(['"])([^\\\n]+?)\1/g;
22961
+ var ESCAPE_PATTERN = /\\./g;
22962
+ function tokenize(selector, grammar = TOKENS) {
22963
+ selector = selector.trim();
22964
+ if (selector === "") {
22965
+ return [];
22966
+ }
22967
+ const replacements = [];
22968
+ selector = selector.replace(ESCAPE_PATTERN, (value, offset) => {
22969
+ replacements.push({ value, offset });
22970
+ return "\uE000".repeat(value.length);
22971
+ });
22972
+ selector = selector.replace(STRING_PATTERN, (value, quote, content, offset) => {
22973
+ replacements.push({ value, offset });
22974
+ return `${quote}${"\uE001".repeat(content.length)}${quote}`;
22975
+ });
22976
+ {
22977
+ let pos = 0;
22978
+ let offset;
22979
+ while ((offset = selector.indexOf("(", pos)) > -1) {
22980
+ const value = gobbleParens(selector, offset);
22981
+ replacements.push({ value, offset });
22982
+ selector = `${selector.substring(0, offset)}(${"\xB6".repeat(value.length - 2)})${selector.substring(offset + value.length)}`;
22983
+ pos = offset + value.length;
22984
+ }
22985
+ }
22986
+ const tokens = tokenizeBy(selector, grammar);
22987
+ const changedTokens = /* @__PURE__ */ new Set();
22988
+ for (const replacement of replacements.reverse()) {
22989
+ for (const token of tokens) {
22990
+ const { offset, value } = replacement;
22991
+ if (!(token.pos[0] <= offset && offset + value.length <= token.pos[1])) {
22992
+ continue;
22993
+ }
22994
+ const { content } = token;
22995
+ const tokenOffset = offset - token.pos[0];
22996
+ token.content = content.slice(0, tokenOffset) + value + content.slice(tokenOffset + value.length);
22997
+ if (token.content !== content) {
22998
+ changedTokens.add(token);
22999
+ }
23000
+ }
23001
+ }
23002
+ for (const token of changedTokens) {
23003
+ const pattern = getArgumentPatternByType(token.type);
23004
+ if (!pattern) {
23005
+ throw new Error(`Unknown token type: ${token.type}`);
23006
+ }
23007
+ pattern.lastIndex = 0;
23008
+ const match = pattern.exec(token.content);
23009
+ if (!match) {
23010
+ throw new Error(`Unable to parse content for ${token.type}: ${token.content}`);
23011
+ }
23012
+ Object.assign(token, match.groups);
23128
23013
  }
23129
- };
23130
- var customQueryHandlers = new CustomQueryHandlerRegistry();
23131
-
23132
- // node_modules/puppeteer-core/lib/esm/puppeteer/common/PierceQueryHandler.js
23133
- init_dirname();
23134
- init_buffer2();
23135
- var PierceQueryHandler = class extends QueryHandler {
23136
- static querySelector = (element, selector, { pierceQuerySelector }) => {
23137
- return pierceQuerySelector(element, selector);
23138
- };
23139
- static querySelectorAll = (element, selector, { pierceQuerySelectorAll }) => {
23140
- return pierceQuerySelectorAll(element, selector);
23141
- };
23142
- };
23014
+ return tokens;
23015
+ }
23016
+ function* flatten(node, parent) {
23017
+ switch (node.type) {
23018
+ case "list":
23019
+ for (let child of node.list) {
23020
+ yield* flatten(child, node);
23021
+ }
23022
+ break;
23023
+ case "complex":
23024
+ yield* flatten(node.left, node);
23025
+ yield* flatten(node.right, node);
23026
+ break;
23027
+ case "compound":
23028
+ yield* node.list.map((token) => [token, node]);
23029
+ break;
23030
+ default:
23031
+ yield [node, parent];
23032
+ }
23033
+ }
23034
+ function stringify(listOrNode) {
23035
+ let tokens;
23036
+ if (Array.isArray(listOrNode)) {
23037
+ tokens = listOrNode;
23038
+ } else {
23039
+ tokens = [...flatten(listOrNode)].map(([token]) => token);
23040
+ }
23041
+ return tokens.map((token) => token.content).join("");
23042
+ }
23143
23043
 
23144
- // node_modules/puppeteer-core/lib/esm/puppeteer/common/PQueryHandler.js
23145
- init_dirname();
23146
- init_buffer2();
23147
- var PQueryHandler = class extends QueryHandler {
23148
- static querySelectorAll = (element, selector, { pQuerySelectorAll }) => {
23149
- return pQuerySelectorAll(element, selector);
23150
- };
23151
- static querySelector = (element, selector, { pQuerySelector }) => {
23152
- return pQuerySelector(element, selector);
23153
- };
23044
+ // node_modules/puppeteer-core/lib/esm/puppeteer/common/PSelectorParser.js
23045
+ TOKENS["nesting"] = /&/g;
23046
+ TOKENS["combinator"] = /\s*(>>>>?|[\s>+~])\s*/g;
23047
+ var ESCAPE_REGEXP = /\\[\s\S]/g;
23048
+ var unquote = (text) => {
23049
+ if (text.length <= 1) {
23050
+ return text;
23051
+ }
23052
+ if ((text[0] === '"' || text[0] === "'") && text.endsWith(text[0])) {
23053
+ text = text.slice(1, -1);
23054
+ }
23055
+ return text.replace(ESCAPE_REGEXP, (match) => {
23056
+ return match[1];
23057
+ });
23154
23058
  };
23059
+ function parsePSelectors(selector) {
23060
+ let isPureCSS = true;
23061
+ let hasAria = false;
23062
+ let hasPseudoClasses = false;
23063
+ const tokens = tokenize(selector);
23064
+ if (tokens.length === 0) {
23065
+ return [[], isPureCSS, hasPseudoClasses, false];
23066
+ }
23067
+ let compoundSelector = [];
23068
+ let complexSelector = [compoundSelector];
23069
+ const selectors = [complexSelector];
23070
+ const storage = [];
23071
+ for (const token of tokens) {
23072
+ switch (token.type) {
23073
+ case "combinator":
23074
+ switch (token.content) {
23075
+ case ">>>":
23076
+ isPureCSS = false;
23077
+ if (storage.length) {
23078
+ compoundSelector.push(stringify(storage));
23079
+ storage.splice(0);
23080
+ }
23081
+ compoundSelector = [];
23082
+ complexSelector.push(
23083
+ ">>>"
23084
+ /* PCombinator.Descendent */
23085
+ );
23086
+ complexSelector.push(compoundSelector);
23087
+ continue;
23088
+ case ">>>>":
23089
+ isPureCSS = false;
23090
+ if (storage.length) {
23091
+ compoundSelector.push(stringify(storage));
23092
+ storage.splice(0);
23093
+ }
23094
+ compoundSelector = [];
23095
+ complexSelector.push(
23096
+ ">>>>"
23097
+ /* PCombinator.Child */
23098
+ );
23099
+ complexSelector.push(compoundSelector);
23100
+ continue;
23101
+ }
23102
+ break;
23103
+ case "pseudo-element":
23104
+ if (!token.name.startsWith("-p-")) {
23105
+ break;
23106
+ }
23107
+ isPureCSS = false;
23108
+ if (storage.length) {
23109
+ compoundSelector.push(stringify(storage));
23110
+ storage.splice(0);
23111
+ }
23112
+ const name2 = token.name.slice(3);
23113
+ if (name2 === "aria") {
23114
+ hasAria = true;
23115
+ }
23116
+ compoundSelector.push({
23117
+ name: name2,
23118
+ value: unquote(token.argument ?? "")
23119
+ });
23120
+ continue;
23121
+ case "pseudo-class":
23122
+ hasPseudoClasses = true;
23123
+ break;
23124
+ case "comma":
23125
+ if (storage.length) {
23126
+ compoundSelector.push(stringify(storage));
23127
+ storage.splice(0);
23128
+ }
23129
+ compoundSelector = [];
23130
+ complexSelector = [compoundSelector];
23131
+ selectors.push(complexSelector);
23132
+ continue;
23133
+ }
23134
+ storage.push(token);
23135
+ }
23136
+ if (storage.length) {
23137
+ compoundSelector.push(stringify(storage));
23138
+ }
23139
+ return [selectors, isPureCSS, hasPseudoClasses, hasAria];
23140
+ }
23155
23141
 
23156
23142
  // node_modules/puppeteer-core/lib/esm/puppeteer/common/TextQueryHandler.js
23157
23143
  init_dirname();
@@ -23197,12 +23183,36 @@
23197
23183
  const prefix = `${name2}${separator}`;
23198
23184
  if (selector.startsWith(prefix)) {
23199
23185
  selector = selector.slice(prefix.length);
23200
- return { updatedSelector: selector, QueryHandler: QueryHandler2 };
23186
+ return {
23187
+ updatedSelector: selector,
23188
+ polling: name2 === "aria" ? "raf" : "mutation",
23189
+ QueryHandler: QueryHandler2
23190
+ };
23201
23191
  }
23202
23192
  }
23203
23193
  }
23204
23194
  }
23205
- return { updatedSelector: selector, QueryHandler: PQueryHandler };
23195
+ try {
23196
+ const [pSelector, isPureCSS, hasPseudoClasses, hasAria] = parsePSelectors(selector);
23197
+ if (isPureCSS) {
23198
+ return {
23199
+ updatedSelector: selector,
23200
+ polling: hasPseudoClasses ? "raf" : "mutation",
23201
+ QueryHandler: CSSQueryHandler
23202
+ };
23203
+ }
23204
+ return {
23205
+ updatedSelector: JSON.stringify(pSelector),
23206
+ polling: hasAria ? "raf" : "mutation",
23207
+ QueryHandler: PQueryHandler
23208
+ };
23209
+ } catch {
23210
+ return {
23211
+ updatedSelector: selector,
23212
+ polling: "mutation",
23213
+ QueryHandler: CSSQueryHandler
23214
+ };
23215
+ }
23206
23216
  }
23207
23217
 
23208
23218
  // node_modules/puppeteer-core/lib/esm/puppeteer/api/Frame.js
@@ -23377,7 +23387,7 @@
23377
23387
  /**
23378
23388
  * @internal
23379
23389
  */
23380
- _id = (__runInitializers5(this, _instanceExtraInitializers), void 0);
23390
+ _id = __runInitializers5(this, _instanceExtraInitializers);
23381
23391
  /**
23382
23392
  * @internal
23383
23393
  */
@@ -23402,10 +23412,8 @@
23402
23412
  */
23403
23413
  #document() {
23404
23414
  if (!this.#_document) {
23405
- this.#_document = this.isolatedRealm().evaluateHandle(() => {
23415
+ this.#_document = this.mainRealm().evaluateHandle(() => {
23406
23416
  return document;
23407
- }).then((handle) => {
23408
- return this.mainRealm().transferHandle(handle);
23409
23417
  });
23410
23418
  }
23411
23419
  return this.#_document;
@@ -23458,7 +23466,7 @@
23458
23466
  * Behaves identically to {@link Page.evaluateHandle} except it's run within
23459
23467
  * the context of this frame.
23460
23468
  *
23461
- * @see {@link Page.evaluateHandle} for details.
23469
+ * See {@link Page.evaluateHandle} for details.
23462
23470
  */
23463
23471
  async evaluateHandle(pageFunction, ...args) {
23464
23472
  pageFunction = withSourcePuppeteerURLIfNone(this.evaluateHandle.name, pageFunction);
@@ -23468,7 +23476,7 @@
23468
23476
  * Behaves identically to {@link Page.evaluate} except it's run within
23469
23477
  * the context of this frame.
23470
23478
  *
23471
- * @see {@link Page.evaluate} for details.
23479
+ * See {@link Page.evaluate} for details.
23472
23480
  */
23473
23481
  async evaluate(pageFunction, ...args) {
23474
23482
  pageFunction = withSourcePuppeteerURLIfNone(this.evaluate.name, pageFunction);
@@ -23487,7 +23495,22 @@
23487
23495
  /**
23488
23496
  * Queries the frame for an element matching the given selector.
23489
23497
  *
23490
- * @param selector - The selector to query for.
23498
+ * @param selector -
23499
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
23500
+ * to query page for.
23501
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
23502
+ * can be passed as-is and a
23503
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
23504
+ * allows quering by
23505
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
23506
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
23507
+ * and
23508
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
23509
+ * and
23510
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
23511
+ * Alternatively, you can specify the selector type using a
23512
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
23513
+ *
23491
23514
  * @returns A {@link ElementHandle | element handle} to the first element
23492
23515
  * matching the given selector. Otherwise, `null`.
23493
23516
  */
@@ -23498,13 +23521,28 @@
23498
23521
  /**
23499
23522
  * Queries the frame for all elements matching the given selector.
23500
23523
  *
23501
- * @param selector - The selector to query for.
23524
+ * @param selector -
23525
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
23526
+ * to query page for.
23527
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
23528
+ * can be passed as-is and a
23529
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
23530
+ * allows quering by
23531
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
23532
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
23533
+ * and
23534
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
23535
+ * and
23536
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
23537
+ * Alternatively, you can specify the selector type using a
23538
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
23539
+ *
23502
23540
  * @returns An array of {@link ElementHandle | element handles} that point to
23503
23541
  * elements matching the given selector.
23504
23542
  */
23505
- async $$(selector) {
23543
+ async $$(selector, options) {
23506
23544
  const document2 = await this.#document();
23507
- return await document2.$$(selector);
23545
+ return await document2.$$(selector, options);
23508
23546
  }
23509
23547
  /**
23510
23548
  * Runs the given function on the first element matching the given selector in
@@ -23519,7 +23557,21 @@
23519
23557
  * const searchValue = await frame.$eval('#search', el => el.value);
23520
23558
  * ```
23521
23559
  *
23522
- * @param selector - The selector to query for.
23560
+ * @param selector -
23561
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
23562
+ * to query page for.
23563
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
23564
+ * can be passed as-is and a
23565
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
23566
+ * allows quering by
23567
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
23568
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
23569
+ * and
23570
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
23571
+ * and
23572
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
23573
+ * Alternatively, you can specify the selector type using a
23574
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
23523
23575
  * @param pageFunction - The function to be evaluated in the frame's context.
23524
23576
  * The first element matching the selector will be passed to the function as
23525
23577
  * its first argument.
@@ -23544,7 +23596,21 @@
23544
23596
  * const divsCounts = await frame.$$eval('div', divs => divs.length);
23545
23597
  * ```
23546
23598
  *
23547
- * @param selector - The selector to query for.
23599
+ * @param selector -
23600
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
23601
+ * to query page for.
23602
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
23603
+ * can be passed as-is and a
23604
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
23605
+ * allows quering by
23606
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
23607
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
23608
+ * and
23609
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
23610
+ * and
23611
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
23612
+ * Alternatively, you can specify the selector type using a
23613
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
23548
23614
  * @param pageFunction - The function to be evaluated in the frame's context.
23549
23615
  * An array of elements matching the given selector will be passed to the
23550
23616
  * function as its first argument.
@@ -23592,8 +23658,11 @@
23592
23658
  * @throws Throws if an element matching the given selector doesn't appear.
23593
23659
  */
23594
23660
  async waitForSelector(selector, options = {}) {
23595
- const { updatedSelector, QueryHandler: QueryHandler2 } = getQueryHandlerAndSelector(selector);
23596
- return await QueryHandler2.waitFor(this, updatedSelector, options);
23661
+ const { updatedSelector, QueryHandler: QueryHandler2, polling } = getQueryHandlerAndSelector(selector);
23662
+ return await QueryHandler2.waitFor(this, updatedSelector, {
23663
+ polling,
23664
+ ...options
23665
+ });
23597
23666
  }
23598
23667
  /**
23599
23668
  * @example
@@ -24224,6 +24293,10 @@
24224
24293
  var e9 = new Error(message);
24225
24294
  return e9.name = "SuppressedError", e9.error = error, e9.suppressed = suppressed, e9;
24226
24295
  });
24296
+ var __setFunctionName3 = function(f7, name2, prefix) {
24297
+ if (typeof name2 === "symbol") name2 = name2.description ? "[".concat(name2.description, "]") : "";
24298
+ return Object.defineProperty(f7, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name2) : name2 });
24299
+ };
24227
24300
  var ElementHandle = (() => {
24228
24301
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _22, _32, _4, _5;
24229
24302
  let _classSuper = JSHandle;
@@ -24233,6 +24306,8 @@
24233
24306
  let _jsonValue_decorators;
24234
24307
  let _$_decorators;
24235
24308
  let _$$_decorators;
24309
+ let _private_$$_decorators;
24310
+ let _private_$$_descriptor;
24236
24311
  let _waitForSelector_decorators;
24237
24312
  let _isVisible_decorators;
24238
24313
  let _isHidden_decorators;
@@ -24265,7 +24340,8 @@
24265
24340
  _getProperties_decorators = [throwIfDisposed(), (_b = ElementHandle2).bindIsolatedHandle.bind(_b)];
24266
24341
  _jsonValue_decorators = [throwIfDisposed(), (_c = ElementHandle2).bindIsolatedHandle.bind(_c)];
24267
24342
  _$_decorators = [throwIfDisposed(), (_d = ElementHandle2).bindIsolatedHandle.bind(_d)];
24268
- _$$_decorators = [throwIfDisposed(), (_e = ElementHandle2).bindIsolatedHandle.bind(_e)];
24343
+ _$$_decorators = [throwIfDisposed()];
24344
+ _private_$$_decorators = [(_e = ElementHandle2).bindIsolatedHandle.bind(_e)];
24269
24345
  _waitForSelector_decorators = [throwIfDisposed(), (_f = ElementHandle2).bindIsolatedHandle.bind(_f)];
24270
24346
  _isVisible_decorators = [throwIfDisposed(), (_g = ElementHandle2).bindIsolatedHandle.bind(_g)];
24271
24347
  _isHidden_decorators = [throwIfDisposed(), (_h = ElementHandle2).bindIsolatedHandle.bind(_h)];
@@ -24296,6 +24372,9 @@
24296
24372
  __esDecorate6(this, null, _jsonValue_decorators, { kind: "method", name: "jsonValue", static: false, private: false, access: { has: (obj) => "jsonValue" in obj, get: (obj) => obj.jsonValue }, metadata: _metadata }, null, _instanceExtraInitializers);
24297
24373
  __esDecorate6(this, null, _$_decorators, { kind: "method", name: "$", static: false, private: false, access: { has: (obj) => "$" in obj, get: (obj) => obj.$ }, metadata: _metadata }, null, _instanceExtraInitializers);
24298
24374
  __esDecorate6(this, null, _$$_decorators, { kind: "method", name: "$$", static: false, private: false, access: { has: (obj) => "$$" in obj, get: (obj) => obj.$$ }, metadata: _metadata }, null, _instanceExtraInitializers);
24375
+ __esDecorate6(this, _private_$$_descriptor = { value: __setFunctionName3(async function(selector) {
24376
+ return await this.#$$impl(selector);
24377
+ }, "#$$") }, _private_$$_decorators, { kind: "method", name: "#$$", static: false, private: true, access: { has: (obj) => #$$ in obj, get: (obj) => obj.#$$ }, metadata: _metadata }, null, _instanceExtraInitializers);
24299
24378
  __esDecorate6(this, null, _waitForSelector_decorators, { kind: "method", name: "waitForSelector", static: false, private: false, access: { has: (obj) => "waitForSelector" in obj, get: (obj) => obj.waitForSelector }, metadata: _metadata }, null, _instanceExtraInitializers);
24300
24379
  __esDecorate6(this, null, _isVisible_decorators, { kind: "method", name: "isVisible", static: false, private: false, access: { has: (obj) => "isVisible" in obj, get: (obj) => obj.isVisible }, metadata: _metadata }, null, _instanceExtraInitializers);
24301
24380
  __esDecorate6(this, null, _isHidden_decorators, { kind: "method", name: "isHidden", static: false, private: false, access: { has: (obj) => "isHidden" in obj, get: (obj) => obj.isHidden }, metadata: _metadata }, null, _instanceExtraInitializers);
@@ -24328,7 +24407,7 @@
24328
24407
  * Cached isolatedHandle to prevent
24329
24408
  * trying to adopt it multiple times
24330
24409
  */
24331
- isolatedHandle = (__runInitializers6(this, _instanceExtraInitializers), void 0);
24410
+ isolatedHandle = __runInitializers6(this, _instanceExtraInitializers);
24332
24411
  /**
24333
24412
  * A given method will have it's `this` replaced with an isolated version of
24334
24413
  * `this` when decorated with this decorator.
@@ -24455,7 +24534,21 @@
24455
24534
  /**
24456
24535
  * Queries the current element for an element matching the given selector.
24457
24536
  *
24458
- * @param selector - The selector to query for.
24537
+ * @param selector -
24538
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
24539
+ * to query page for.
24540
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
24541
+ * can be passed as-is and a
24542
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
24543
+ * allows quering by
24544
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
24545
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
24546
+ * and
24547
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
24548
+ * and
24549
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
24550
+ * Alternatively, you can specify the selector type using a
24551
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
24459
24552
  * @returns A {@link ElementHandle | element handle} to the first element
24460
24553
  * matching the given selector. Otherwise, `null`.
24461
24554
  */
@@ -24466,11 +24559,44 @@
24466
24559
  /**
24467
24560
  * Queries the current element for all elements matching the given selector.
24468
24561
  *
24469
- * @param selector - The selector to query for.
24562
+ * @param selector -
24563
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
24564
+ * to query page for.
24565
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
24566
+ * can be passed as-is and a
24567
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
24568
+ * allows quering by
24569
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
24570
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
24571
+ * and
24572
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
24573
+ * and
24574
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
24575
+ * Alternatively, you can specify the selector type using a
24576
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
24470
24577
  * @returns An array of {@link ElementHandle | element handles} that point to
24471
24578
  * elements matching the given selector.
24472
24579
  */
24473
- async $$(selector) {
24580
+ async $$(selector, options) {
24581
+ if (options?.isolate === false) {
24582
+ return await this.#$$impl(selector);
24583
+ }
24584
+ return await this.#$$(selector);
24585
+ }
24586
+ /**
24587
+ * Isolates {@link ElementHandle.$$} if needed.
24588
+ *
24589
+ * @internal
24590
+ */
24591
+ get #$$() {
24592
+ return _private_$$_descriptor.value;
24593
+ }
24594
+ /**
24595
+ * Implementation for {@link ElementHandle.$$}.
24596
+ *
24597
+ * @internal
24598
+ */
24599
+ async #$$impl(selector) {
24474
24600
  const { updatedSelector, QueryHandler: QueryHandler2 } = getQueryHandlerAndSelector(selector);
24475
24601
  return await AsyncIterableUtil.collect(QueryHandler2.queryAll(this, updatedSelector));
24476
24602
  }
@@ -24493,7 +24619,21 @@
24493
24619
  * );
24494
24620
  * ```
24495
24621
  *
24496
- * @param selector - The selector to query for.
24622
+ * @param selector -
24623
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
24624
+ * to query page for.
24625
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
24626
+ * can be passed as-is and a
24627
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
24628
+ * allows quering by
24629
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
24630
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
24631
+ * and
24632
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
24633
+ * and
24634
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
24635
+ * Alternatively, you can specify the selector type using a
24636
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
24497
24637
  * @param pageFunction - The function to be evaluated in this element's page's
24498
24638
  * context. The first element matching the selector will be passed in as the
24499
24639
  * first argument.
@@ -24542,7 +24682,21 @@
24542
24682
  * ).toEqual(['Hello!', 'Hi!']);
24543
24683
  * ```
24544
24684
  *
24545
- * @param selector - The selector to query for.
24685
+ * @param selector -
24686
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
24687
+ * to query page for.
24688
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
24689
+ * can be passed as-is and a
24690
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
24691
+ * allows quering by
24692
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
24693
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
24694
+ * and
24695
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
24696
+ * and
24697
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
24698
+ * Alternatively, you can specify the selector type using a
24699
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
24546
24700
  * @param pageFunction - The function to be evaluated in the element's page's
24547
24701
  * context. An array of elements matching the given selector will be passed to
24548
24702
  * the function as its first argument.
@@ -24609,8 +24763,11 @@
24609
24763
  * @throws Throws if an element matching the given selector doesn't appear.
24610
24764
  */
24611
24765
  async waitForSelector(selector, options = {}) {
24612
- const { updatedSelector, QueryHandler: QueryHandler2 } = getQueryHandlerAndSelector(selector);
24613
- return await QueryHandler2.waitFor(this, updatedSelector, options);
24766
+ const { updatedSelector, QueryHandler: QueryHandler2, polling } = getQueryHandlerAndSelector(selector);
24767
+ return await QueryHandler2.waitFor(this, updatedSelector, {
24768
+ polling,
24769
+ ...options
24770
+ });
24614
24771
  }
24615
24772
  async #checkVisibility(visibility) {
24616
24773
  return await this.evaluate(async (element, PuppeteerUtil, visibility2) => {
@@ -24620,15 +24777,32 @@
24620
24777
  }), visibility);
24621
24778
  }
24622
24779
  /**
24623
- * Checks if an element is visible using the same mechanism as
24624
- * {@link ElementHandle.waitForSelector}.
24780
+ * An element is considered to be visible if all of the following is
24781
+ * true:
24782
+ *
24783
+ * - the element has
24784
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle | computed styles}.
24785
+ *
24786
+ * - the element has a non-empty
24787
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect | bounding client rect}.
24788
+ *
24789
+ * - the element's {@link https://developer.mozilla.org/en-US/docs/Web/CSS/visibility | visibility}
24790
+ * is not `hidden` or `collapse`.
24625
24791
  */
24626
24792
  async isVisible() {
24627
24793
  return await this.#checkVisibility(true);
24628
24794
  }
24629
24795
  /**
24630
- * Checks if an element is hidden using the same mechanism as
24631
- * {@link ElementHandle.waitForSelector}.
24796
+ * An element is considered to be hidden if at least one of the following is true:
24797
+ *
24798
+ * - the element has no
24799
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle | computed styles}.
24800
+ *
24801
+ * - the element has an empty
24802
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect | bounding client rect}.
24803
+ *
24804
+ * - the element's {@link https://developer.mozilla.org/en-US/docs/Web/CSS/visibility | visibility}
24805
+ * is `hidden` or `collapse`.
24632
24806
  */
24633
24807
  async isHidden() {
24634
24808
  return await this.#checkVisibility(false);
@@ -25497,6 +25671,20 @@
25497
25671
  remoteObject() {
25498
25672
  return this.#remoteObject;
25499
25673
  }
25674
+ async getProperties() {
25675
+ const response = await this.client.send("Runtime.getProperties", {
25676
+ objectId: this.#remoteObject.objectId,
25677
+ ownProperties: true
25678
+ });
25679
+ const result = /* @__PURE__ */ new Map();
25680
+ for (const property of response.result) {
25681
+ if (!property.enumerable || !property.value) {
25682
+ continue;
25683
+ }
25684
+ result.set(property.name, this.#world.createCdpHandle(property.value));
25685
+ }
25686
+ return result;
25687
+ }
25500
25688
  };
25501
25689
  async function releaseObject(client, remoteObject) {
25502
25690
  if (!remoteObject.objectId) {
@@ -25807,6 +25995,9 @@
25807
25995
  }
25808
25996
  }
25809
25997
  async #onBindingCalled(event) {
25998
+ if (event.executionContextId !== this.#id) {
25999
+ return;
26000
+ }
25810
26001
  let payload;
25811
26002
  try {
25812
26003
  payload = JSON.parse(event.payload);
@@ -25823,9 +26014,6 @@
25823
26014
  return;
25824
26015
  }
25825
26016
  try {
25826
- if (event.executionContextId !== this.#id) {
25827
- return;
25828
- }
25829
26017
  const binding = this.#bindings.get(name2);
25830
26018
  await binding?.run(this, seq, args, isTrivial);
25831
26019
  } catch (err) {
@@ -25911,171 +26099,543 @@
25911
26099
  * a vanilla object containing the serializable properties of the result is
25912
26100
  * returned.
25913
26101
  */
25914
- async evaluate(pageFunction, ...args) {
25915
- return await this.#evaluate(true, pageFunction, ...args);
26102
+ async evaluate(pageFunction, ...args) {
26103
+ return await this.#evaluate(true, pageFunction, ...args);
26104
+ }
26105
+ /**
26106
+ * Evaluates the given function.
26107
+ *
26108
+ * Unlike {@link ExecutionContext.evaluate | evaluate}, this method returns a
26109
+ * handle to the result of the function.
26110
+ *
26111
+ * This method may be better suited if the object cannot be serialized (e.g.
26112
+ * `Map`) and requires further manipulation.
26113
+ *
26114
+ * @example
26115
+ *
26116
+ * ```ts
26117
+ * const context = await page.mainFrame().executionContext();
26118
+ * const handle: JSHandle<typeof globalThis> = await context.evaluateHandle(
26119
+ * () => Promise.resolve(self)
26120
+ * );
26121
+ * ```
26122
+ *
26123
+ * @example
26124
+ * A string can also be passed in instead of a function.
26125
+ *
26126
+ * ```ts
26127
+ * const handle: JSHandle<number> = await context.evaluateHandle('1 + 2');
26128
+ * ```
26129
+ *
26130
+ * @example
26131
+ * Handles can also be passed as `args`. They resolve to their referenced object:
26132
+ *
26133
+ * ```ts
26134
+ * const bodyHandle: ElementHandle<HTMLBodyElement> =
26135
+ * await context.evaluateHandle(() => {
26136
+ * return document.body;
26137
+ * });
26138
+ * const stringHandle: JSHandle<string> = await context.evaluateHandle(
26139
+ * body => body.innerHTML,
26140
+ * body
26141
+ * );
26142
+ * console.log(await stringHandle.jsonValue()); // prints body's innerHTML
26143
+ * // Always dispose your garbage! :)
26144
+ * await bodyHandle.dispose();
26145
+ * await stringHandle.dispose();
26146
+ * ```
26147
+ *
26148
+ * @param pageFunction - The function to evaluate.
26149
+ * @param args - Additional arguments to pass into the function.
26150
+ * @returns A {@link JSHandle | handle} to the result of evaluating the
26151
+ * function. If the result is a `Node`, then this will return an
26152
+ * {@link ElementHandle | element handle}.
26153
+ */
26154
+ async evaluateHandle(pageFunction, ...args) {
26155
+ return await this.#evaluate(false, pageFunction, ...args);
26156
+ }
26157
+ async #evaluate(returnByValue, pageFunction, ...args) {
26158
+ const sourceUrlComment = getSourceUrlComment(getSourcePuppeteerURLIfAvailable(pageFunction)?.toString() ?? PuppeteerURL.INTERNAL_URL);
26159
+ if (isString3(pageFunction)) {
26160
+ const contextId = this.#id;
26161
+ const expression = pageFunction;
26162
+ const expressionWithSourceUrl = SOURCE_URL_REGEX.test(expression) ? expression : `${expression}
26163
+ ${sourceUrlComment}
26164
+ `;
26165
+ const { exceptionDetails: exceptionDetails2, result: remoteObject2 } = await this.#client.send("Runtime.evaluate", {
26166
+ expression: expressionWithSourceUrl,
26167
+ contextId,
26168
+ returnByValue,
26169
+ awaitPromise: true,
26170
+ userGesture: true
26171
+ }).catch(rewriteError2);
26172
+ if (exceptionDetails2) {
26173
+ throw createEvaluationError(exceptionDetails2);
26174
+ }
26175
+ return returnByValue ? valueFromRemoteObject(remoteObject2) : this.#world.createCdpHandle(remoteObject2);
26176
+ }
26177
+ const functionDeclaration = stringifyFunction(pageFunction);
26178
+ const functionDeclarationWithSourceUrl = SOURCE_URL_REGEX.test(functionDeclaration) ? functionDeclaration : `${functionDeclaration}
26179
+ ${sourceUrlComment}
26180
+ `;
26181
+ let callFunctionOnPromise;
26182
+ try {
26183
+ callFunctionOnPromise = this.#client.send("Runtime.callFunctionOn", {
26184
+ functionDeclaration: functionDeclarationWithSourceUrl,
26185
+ executionContextId: this.#id,
26186
+ arguments: args.length ? await Promise.all(args.map(convertArgument.bind(this))) : [],
26187
+ returnByValue,
26188
+ awaitPromise: true,
26189
+ userGesture: true
26190
+ });
26191
+ } catch (error) {
26192
+ if (error instanceof TypeError && error.message.startsWith("Converting circular structure to JSON")) {
26193
+ error.message += " Recursive objects are not allowed.";
26194
+ }
26195
+ throw error;
26196
+ }
26197
+ const { exceptionDetails, result: remoteObject } = await callFunctionOnPromise.catch(rewriteError2);
26198
+ if (exceptionDetails) {
26199
+ throw createEvaluationError(exceptionDetails);
26200
+ }
26201
+ return returnByValue ? valueFromRemoteObject(remoteObject) : this.#world.createCdpHandle(remoteObject);
26202
+ async function convertArgument(arg) {
26203
+ if (arg instanceof LazyArg) {
26204
+ arg = await arg.get(this);
26205
+ }
26206
+ if (typeof arg === "bigint") {
26207
+ return { unserializableValue: `${arg.toString()}n` };
26208
+ }
26209
+ if (Object.is(arg, -0)) {
26210
+ return { unserializableValue: "-0" };
26211
+ }
26212
+ if (Object.is(arg, Infinity)) {
26213
+ return { unserializableValue: "Infinity" };
26214
+ }
26215
+ if (Object.is(arg, -Infinity)) {
26216
+ return { unserializableValue: "-Infinity" };
26217
+ }
26218
+ if (Object.is(arg, NaN)) {
26219
+ return { unserializableValue: "NaN" };
26220
+ }
26221
+ const objectHandle = arg && (arg instanceof CdpJSHandle || arg instanceof CdpElementHandle) ? arg : null;
26222
+ if (objectHandle) {
26223
+ if (objectHandle.realm !== this.#world) {
26224
+ throw new Error("JSHandles can be evaluated only in the context they were created!");
26225
+ }
26226
+ if (objectHandle.disposed) {
26227
+ throw new Error("JSHandle is disposed!");
26228
+ }
26229
+ if (objectHandle.remoteObject().unserializableValue) {
26230
+ return {
26231
+ unserializableValue: objectHandle.remoteObject().unserializableValue
26232
+ };
26233
+ }
26234
+ if (!objectHandle.remoteObject().objectId) {
26235
+ return { value: objectHandle.remoteObject().value };
26236
+ }
26237
+ return { objectId: objectHandle.remoteObject().objectId };
26238
+ }
26239
+ return { value: arg };
26240
+ }
26241
+ }
26242
+ [disposeSymbol]() {
26243
+ this.#disposables.dispose();
26244
+ this.emit("disposed", void 0);
26245
+ }
26246
+ };
26247
+ var rewriteError2 = (error) => {
26248
+ if (error.message.includes("Object reference chain is too long")) {
26249
+ return { result: { type: "undefined" } };
26250
+ }
26251
+ if (error.message.includes("Object couldn't be returned by value")) {
26252
+ return { result: { type: "undefined" } };
26253
+ }
26254
+ if (error.message.endsWith("Cannot find context with specified id") || error.message.endsWith("Inspected target navigated or closed")) {
26255
+ throw new Error("Execution context was destroyed, most likely because of a navigation.");
26256
+ }
26257
+ throw error;
26258
+ };
26259
+
26260
+ // node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Frame.js
26261
+ init_dirname();
26262
+ init_buffer2();
26263
+ init_Errors();
26264
+ init_Deferred();
26265
+ init_disposable();
26266
+
26267
+ // node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Accessibility.js
26268
+ init_dirname();
26269
+ init_buffer2();
26270
+ var Accessibility = class {
26271
+ #realm;
26272
+ /**
26273
+ * @internal
26274
+ */
26275
+ constructor(realm) {
26276
+ this.#realm = realm;
25916
26277
  }
25917
26278
  /**
25918
- * Evaluates the given function.
26279
+ * Captures the current state of the accessibility tree.
26280
+ * The returned object represents the root accessible node of the page.
25919
26281
  *
25920
- * Unlike {@link ExecutionContext.evaluate | evaluate}, this method returns a
25921
- * handle to the result of the function.
26282
+ * @remarks
25922
26283
  *
25923
- * This method may be better suited if the object cannot be serialized (e.g.
25924
- * `Map`) and requires further manipulation.
26284
+ * **NOTE** The Chrome accessibility tree contains nodes that go unused on
26285
+ * most platforms and by most screen readers. Puppeteer will discard them as
26286
+ * well for an easier to process tree, unless `interestingOnly` is set to
26287
+ * `false`.
25925
26288
  *
25926
26289
  * @example
26290
+ * An example of dumping the entire accessibility tree:
25927
26291
  *
25928
26292
  * ```ts
25929
- * const context = await page.mainFrame().executionContext();
25930
- * const handle: JSHandle<typeof globalThis> = await context.evaluateHandle(
25931
- * () => Promise.resolve(self)
25932
- * );
26293
+ * const snapshot = await page.accessibility.snapshot();
26294
+ * console.log(snapshot);
25933
26295
  * ```
25934
26296
  *
25935
26297
  * @example
25936
- * A string can also be passed in instead of a function.
26298
+ * An example of logging the focused node's name:
25937
26299
  *
25938
26300
  * ```ts
25939
- * const handle: JSHandle<number> = await context.evaluateHandle('1 + 2');
25940
- * ```
25941
- *
25942
- * @example
25943
- * Handles can also be passed as `args`. They resolve to their referenced object:
26301
+ * const snapshot = await page.accessibility.snapshot();
26302
+ * const node = findFocusedNode(snapshot);
26303
+ * console.log(node && node.name);
25944
26304
  *
25945
- * ```ts
25946
- * const bodyHandle: ElementHandle<HTMLBodyElement> =
25947
- * await context.evaluateHandle(() => {
25948
- * return document.body;
25949
- * });
25950
- * const stringHandle: JSHandle<string> = await context.evaluateHandle(
25951
- * body => body.innerHTML,
25952
- * body
25953
- * );
25954
- * console.log(await stringHandle.jsonValue()); // prints body's innerHTML
25955
- * // Always dispose your garbage! :)
25956
- * await bodyHandle.dispose();
25957
- * await stringHandle.dispose();
26305
+ * function findFocusedNode(node) {
26306
+ * if (node.focused) return node;
26307
+ * for (const child of node.children || []) {
26308
+ * const foundNode = findFocusedNode(child);
26309
+ * return foundNode;
26310
+ * }
26311
+ * return null;
26312
+ * }
25958
26313
  * ```
25959
26314
  *
25960
- * @param pageFunction - The function to evaluate.
25961
- * @param args - Additional arguments to pass into the function.
25962
- * @returns A {@link JSHandle | handle} to the result of evaluating the
25963
- * function. If the result is a `Node`, then this will return an
25964
- * {@link ElementHandle | element handle}.
26315
+ * @returns An AXNode object representing the snapshot.
25965
26316
  */
25966
- async evaluateHandle(pageFunction, ...args) {
25967
- return await this.#evaluate(false, pageFunction, ...args);
26317
+ async snapshot(options = {}) {
26318
+ const { interestingOnly = true, root = null } = options;
26319
+ const { nodes } = await this.#realm.environment.client.send("Accessibility.getFullAXTree");
26320
+ let backendNodeId;
26321
+ if (root) {
26322
+ const { node } = await this.#realm.environment.client.send("DOM.describeNode", {
26323
+ objectId: root.id
26324
+ });
26325
+ backendNodeId = node.backendNodeId;
26326
+ }
26327
+ const defaultRoot = AXNode.createTree(this.#realm, nodes);
26328
+ let needle = defaultRoot;
26329
+ if (backendNodeId) {
26330
+ needle = defaultRoot.find((node) => {
26331
+ return node.payload.backendDOMNodeId === backendNodeId;
26332
+ });
26333
+ if (!needle) {
26334
+ return null;
26335
+ }
26336
+ }
26337
+ if (!interestingOnly) {
26338
+ return this.serializeTree(needle)[0] ?? null;
26339
+ }
26340
+ const interestingNodes = /* @__PURE__ */ new Set();
26341
+ this.collectInterestingNodes(interestingNodes, defaultRoot, false);
26342
+ if (!interestingNodes.has(needle)) {
26343
+ return null;
26344
+ }
26345
+ return this.serializeTree(needle, interestingNodes)[0] ?? null;
26346
+ }
26347
+ serializeTree(node, interestingNodes) {
26348
+ const children = [];
26349
+ for (const child of node.children) {
26350
+ children.push(...this.serializeTree(child, interestingNodes));
26351
+ }
26352
+ if (interestingNodes && !interestingNodes.has(node)) {
26353
+ return children;
26354
+ }
26355
+ const serializedNode = node.serialize();
26356
+ if (children.length) {
26357
+ serializedNode.children = children;
26358
+ }
26359
+ return [serializedNode];
26360
+ }
26361
+ collectInterestingNodes(collection, node, insideControl) {
26362
+ if (node.isInteresting(insideControl)) {
26363
+ collection.add(node);
26364
+ }
26365
+ if (node.isLeafNode()) {
26366
+ return;
26367
+ }
26368
+ insideControl = insideControl || node.isControl();
26369
+ for (const child of node.children) {
26370
+ this.collectInterestingNodes(collection, child, insideControl);
26371
+ }
26372
+ }
26373
+ };
26374
+ var AXNode = class _AXNode {
26375
+ payload;
26376
+ children = [];
26377
+ #richlyEditable = false;
26378
+ #editable = false;
26379
+ #focusable = false;
26380
+ #hidden = false;
26381
+ #name;
26382
+ #role;
26383
+ #ignored;
26384
+ #cachedHasFocusableChild;
26385
+ #realm;
26386
+ constructor(realm, payload) {
26387
+ this.payload = payload;
26388
+ this.#name = this.payload.name ? this.payload.name.value : "";
26389
+ this.#role = this.payload.role ? this.payload.role.value : "Unknown";
26390
+ this.#ignored = this.payload.ignored;
26391
+ this.#realm = realm;
26392
+ for (const property of this.payload.properties || []) {
26393
+ if (property.name === "editable") {
26394
+ this.#richlyEditable = property.value.value === "richtext";
26395
+ this.#editable = true;
26396
+ }
26397
+ if (property.name === "focusable") {
26398
+ this.#focusable = property.value.value;
26399
+ }
26400
+ if (property.name === "hidden") {
26401
+ this.#hidden = property.value.value;
26402
+ }
26403
+ }
26404
+ }
26405
+ #isPlainTextField() {
26406
+ if (this.#richlyEditable) {
26407
+ return false;
26408
+ }
26409
+ if (this.#editable) {
26410
+ return true;
26411
+ }
26412
+ return this.#role === "textbox" || this.#role === "searchbox";
26413
+ }
26414
+ #isTextOnlyObject() {
26415
+ const role = this.#role;
26416
+ return role === "LineBreak" || role === "text" || role === "InlineTextBox" || role === "StaticText";
26417
+ }
26418
+ #hasFocusableChild() {
26419
+ if (this.#cachedHasFocusableChild === void 0) {
26420
+ this.#cachedHasFocusableChild = false;
26421
+ for (const child of this.children) {
26422
+ if (child.#focusable || child.#hasFocusableChild()) {
26423
+ this.#cachedHasFocusableChild = true;
26424
+ break;
26425
+ }
26426
+ }
26427
+ }
26428
+ return this.#cachedHasFocusableChild;
26429
+ }
26430
+ find(predicate) {
26431
+ if (predicate(this)) {
26432
+ return this;
26433
+ }
26434
+ for (const child of this.children) {
26435
+ const result = child.find(predicate);
26436
+ if (result) {
26437
+ return result;
26438
+ }
26439
+ }
26440
+ return null;
26441
+ }
26442
+ isLeafNode() {
26443
+ if (!this.children.length) {
26444
+ return true;
26445
+ }
26446
+ if (this.#isPlainTextField() || this.#isTextOnlyObject()) {
26447
+ return true;
26448
+ }
26449
+ switch (this.#role) {
26450
+ case "doc-cover":
26451
+ case "graphics-symbol":
26452
+ case "img":
26453
+ case "image":
26454
+ case "Meter":
26455
+ case "scrollbar":
26456
+ case "slider":
26457
+ case "separator":
26458
+ case "progressbar":
26459
+ return true;
26460
+ default:
26461
+ break;
26462
+ }
26463
+ if (this.#hasFocusableChild()) {
26464
+ return false;
26465
+ }
26466
+ if (this.#focusable && this.#name) {
26467
+ return true;
26468
+ }
26469
+ if (this.#role === "heading" && this.#name) {
26470
+ return true;
26471
+ }
26472
+ return false;
26473
+ }
26474
+ isControl() {
26475
+ switch (this.#role) {
26476
+ case "button":
26477
+ case "checkbox":
26478
+ case "ColorWell":
26479
+ case "combobox":
26480
+ case "DisclosureTriangle":
26481
+ case "listbox":
26482
+ case "menu":
26483
+ case "menubar":
26484
+ case "menuitem":
26485
+ case "menuitemcheckbox":
26486
+ case "menuitemradio":
26487
+ case "radio":
26488
+ case "scrollbar":
26489
+ case "searchbox":
26490
+ case "slider":
26491
+ case "spinbutton":
26492
+ case "switch":
26493
+ case "tab":
26494
+ case "textbox":
26495
+ case "tree":
26496
+ case "treeitem":
26497
+ return true;
26498
+ default:
26499
+ return false;
26500
+ }
25968
26501
  }
25969
- async #evaluate(returnByValue, pageFunction, ...args) {
25970
- const sourceUrlComment = getSourceUrlComment(getSourcePuppeteerURLIfAvailable(pageFunction)?.toString() ?? PuppeteerURL.INTERNAL_URL);
25971
- if (isString3(pageFunction)) {
25972
- const contextId = this.#id;
25973
- const expression = pageFunction;
25974
- const expressionWithSourceUrl = SOURCE_URL_REGEX.test(expression) ? expression : `${expression}
25975
- ${sourceUrlComment}
25976
- `;
25977
- const { exceptionDetails: exceptionDetails2, result: remoteObject2 } = await this.#client.send("Runtime.evaluate", {
25978
- expression: expressionWithSourceUrl,
25979
- contextId,
25980
- returnByValue,
25981
- awaitPromise: true,
25982
- userGesture: true
25983
- }).catch(rewriteError2);
25984
- if (exceptionDetails2) {
25985
- throw createEvaluationError(exceptionDetails2);
25986
- }
25987
- return returnByValue ? valueFromRemoteObject(remoteObject2) : this.#world.createCdpHandle(remoteObject2);
26502
+ isInteresting(insideControl) {
26503
+ const role = this.#role;
26504
+ if (role === "Ignored" || this.#hidden || this.#ignored) {
26505
+ return false;
25988
26506
  }
25989
- const functionDeclaration = stringifyFunction(pageFunction);
25990
- const functionDeclarationWithSourceUrl = SOURCE_URL_REGEX.test(functionDeclaration) ? functionDeclaration : `${functionDeclaration}
25991
- ${sourceUrlComment}
25992
- `;
25993
- let callFunctionOnPromise;
25994
- try {
25995
- callFunctionOnPromise = this.#client.send("Runtime.callFunctionOn", {
25996
- functionDeclaration: functionDeclarationWithSourceUrl,
25997
- executionContextId: this.#id,
25998
- arguments: args.length ? await Promise.all(args.map(convertArgument.bind(this))) : [],
25999
- returnByValue,
26000
- awaitPromise: true,
26001
- userGesture: true
26002
- });
26003
- } catch (error) {
26004
- if (error instanceof TypeError && error.message.startsWith("Converting circular structure to JSON")) {
26005
- error.message += " Recursive objects are not allowed.";
26006
- }
26007
- throw error;
26507
+ if (this.#focusable || this.#richlyEditable) {
26508
+ return true;
26008
26509
  }
26009
- const { exceptionDetails, result: remoteObject } = await callFunctionOnPromise.catch(rewriteError2);
26010
- if (exceptionDetails) {
26011
- throw createEvaluationError(exceptionDetails);
26510
+ if (this.isControl()) {
26511
+ return true;
26012
26512
  }
26013
- return returnByValue ? valueFromRemoteObject(remoteObject) : this.#world.createCdpHandle(remoteObject);
26014
- async function convertArgument(arg) {
26015
- if (arg instanceof LazyArg) {
26016
- arg = await arg.get(this);
26513
+ if (insideControl) {
26514
+ return false;
26515
+ }
26516
+ return this.isLeafNode() && !!this.#name;
26517
+ }
26518
+ serialize() {
26519
+ const properties = /* @__PURE__ */ new Map();
26520
+ for (const property of this.payload.properties || []) {
26521
+ properties.set(property.name.toLowerCase(), property.value.value);
26522
+ }
26523
+ if (this.payload.name) {
26524
+ properties.set("name", this.payload.name.value);
26525
+ }
26526
+ if (this.payload.value) {
26527
+ properties.set("value", this.payload.value.value);
26528
+ }
26529
+ if (this.payload.description) {
26530
+ properties.set("description", this.payload.description.value);
26531
+ }
26532
+ const node = {
26533
+ role: this.#role,
26534
+ elementHandle: async () => {
26535
+ if (!this.payload.backendDOMNodeId) {
26536
+ return null;
26537
+ }
26538
+ return await this.#realm.adoptBackendNode(this.payload.backendDOMNodeId);
26017
26539
  }
26018
- if (typeof arg === "bigint") {
26019
- return { unserializableValue: `${arg.toString()}n` };
26540
+ };
26541
+ const userStringProperties = [
26542
+ "name",
26543
+ "value",
26544
+ "description",
26545
+ "keyshortcuts",
26546
+ "roledescription",
26547
+ "valuetext"
26548
+ ];
26549
+ const getUserStringPropertyValue = (key) => {
26550
+ return properties.get(key);
26551
+ };
26552
+ for (const userStringProperty of userStringProperties) {
26553
+ if (!properties.has(userStringProperty)) {
26554
+ continue;
26020
26555
  }
26021
- if (Object.is(arg, -0)) {
26022
- return { unserializableValue: "-0" };
26556
+ node[userStringProperty] = getUserStringPropertyValue(userStringProperty);
26557
+ }
26558
+ const booleanProperties = [
26559
+ "disabled",
26560
+ "expanded",
26561
+ "focused",
26562
+ "modal",
26563
+ "multiline",
26564
+ "multiselectable",
26565
+ "readonly",
26566
+ "required",
26567
+ "selected"
26568
+ ];
26569
+ const getBooleanPropertyValue = (key) => {
26570
+ return properties.get(key);
26571
+ };
26572
+ for (const booleanProperty of booleanProperties) {
26573
+ if (booleanProperty === "focused" && this.#role === "RootWebArea") {
26574
+ continue;
26023
26575
  }
26024
- if (Object.is(arg, Infinity)) {
26025
- return { unserializableValue: "Infinity" };
26576
+ const value = getBooleanPropertyValue(booleanProperty);
26577
+ if (!value) {
26578
+ continue;
26026
26579
  }
26027
- if (Object.is(arg, -Infinity)) {
26028
- return { unserializableValue: "-Infinity" };
26580
+ node[booleanProperty] = getBooleanPropertyValue(booleanProperty);
26581
+ }
26582
+ const tristateProperties = ["checked", "pressed"];
26583
+ for (const tristateProperty of tristateProperties) {
26584
+ if (!properties.has(tristateProperty)) {
26585
+ continue;
26029
26586
  }
26030
- if (Object.is(arg, NaN)) {
26031
- return { unserializableValue: "NaN" };
26587
+ const value = properties.get(tristateProperty);
26588
+ node[tristateProperty] = value === "mixed" ? "mixed" : value === "true" ? true : false;
26589
+ }
26590
+ const numericalProperties = [
26591
+ "level",
26592
+ "valuemax",
26593
+ "valuemin"
26594
+ ];
26595
+ const getNumericalPropertyValue = (key) => {
26596
+ return properties.get(key);
26597
+ };
26598
+ for (const numericalProperty of numericalProperties) {
26599
+ if (!properties.has(numericalProperty)) {
26600
+ continue;
26032
26601
  }
26033
- const objectHandle = arg && (arg instanceof CdpJSHandle || arg instanceof CdpElementHandle) ? arg : null;
26034
- if (objectHandle) {
26035
- if (objectHandle.realm !== this.#world) {
26036
- throw new Error("JSHandles can be evaluated only in the context they were created!");
26037
- }
26038
- if (objectHandle.disposed) {
26039
- throw new Error("JSHandle is disposed!");
26040
- }
26041
- if (objectHandle.remoteObject().unserializableValue) {
26042
- return {
26043
- unserializableValue: objectHandle.remoteObject().unserializableValue
26044
- };
26045
- }
26046
- if (!objectHandle.remoteObject().objectId) {
26047
- return { value: objectHandle.remoteObject().value };
26048
- }
26049
- return { objectId: objectHandle.remoteObject().objectId };
26602
+ node[numericalProperty] = getNumericalPropertyValue(numericalProperty);
26603
+ }
26604
+ const tokenProperties = [
26605
+ "autocomplete",
26606
+ "haspopup",
26607
+ "invalid",
26608
+ "orientation"
26609
+ ];
26610
+ const getTokenPropertyValue = (key) => {
26611
+ return properties.get(key);
26612
+ };
26613
+ for (const tokenProperty of tokenProperties) {
26614
+ const value = getTokenPropertyValue(tokenProperty);
26615
+ if (!value || value === "false") {
26616
+ continue;
26050
26617
  }
26051
- return { value: arg };
26618
+ node[tokenProperty] = getTokenPropertyValue(tokenProperty);
26052
26619
  }
26620
+ return node;
26053
26621
  }
26054
- [disposeSymbol]() {
26055
- this.#disposables.dispose();
26056
- this.emit("disposed", void 0);
26057
- }
26058
- };
26059
- var rewriteError2 = (error) => {
26060
- if (error.message.includes("Object reference chain is too long")) {
26061
- return { result: { type: "undefined" } };
26062
- }
26063
- if (error.message.includes("Object couldn't be returned by value")) {
26064
- return { result: { type: "undefined" } };
26065
- }
26066
- if (error.message.endsWith("Cannot find context with specified id") || error.message.endsWith("Inspected target navigated or closed")) {
26067
- throw new Error("Execution context was destroyed, most likely because of a navigation.");
26622
+ static createTree(realm, payloads) {
26623
+ const nodeById = /* @__PURE__ */ new Map();
26624
+ for (const payload of payloads) {
26625
+ nodeById.set(payload.nodeId, new _AXNode(realm, payload));
26626
+ }
26627
+ for (const node of nodeById.values()) {
26628
+ for (const childId of node.payload.childIds || []) {
26629
+ const child = nodeById.get(childId);
26630
+ if (child) {
26631
+ node.children.push(child);
26632
+ }
26633
+ }
26634
+ }
26635
+ return nodeById.values().next().value;
26068
26636
  }
26069
- throw error;
26070
26637
  };
26071
26638
 
26072
- // node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Frame.js
26073
- init_dirname();
26074
- init_buffer2();
26075
- init_Errors();
26076
- init_Deferred();
26077
- init_disposable();
26078
-
26079
26639
  // node_modules/puppeteer-core/lib/esm/puppeteer/cdp/FrameManagerEvents.js
26080
26640
  init_dirname();
26081
26641
  init_buffer2();
@@ -26366,7 +26926,7 @@ ${sourceUrlComment}
26366
26926
  async #waitForExecutionContext() {
26367
26927
  const result = await firstValueFrom(fromEmitterEvent(this.#emitter, "context").pipe(raceWith(fromEmitterEvent(this.#emitter, "disposed").pipe(map(() => {
26368
26928
  throw new Error("Execution context was destroyed");
26369
- })))));
26929
+ })), timeout(this.timeoutSettings.timeout()))));
26370
26930
  return result;
26371
26931
  }
26372
26932
  async evaluateHandle(pageFunction, ...args) {
@@ -26658,6 +27218,7 @@ ${sourceUrlComment}
26658
27218
  _lifecycleEvents = /* @__PURE__ */ new Set();
26659
27219
  _id;
26660
27220
  _parentId;
27221
+ accessibility;
26661
27222
  worlds;
26662
27223
  constructor(frameManager, frameId, parentFrameId, client) {
26663
27224
  super();
@@ -26672,6 +27233,7 @@ ${sourceUrlComment}
26672
27233
  [MAIN_WORLD]: new IsolatedWorld(this, this._frameManager.timeoutSettings),
26673
27234
  [PUPPETEER_WORLD]: new IsolatedWorld(this, this._frameManager.timeoutSettings)
26674
27235
  };
27236
+ this.accessibility = new Accessibility(this.worlds[MAIN_WORLD]);
26675
27237
  this.on(FrameEvent.FrameSwappedByActivation, () => {
26676
27238
  this._onLoadingStarted();
26677
27239
  this._onLoadingStopped();
@@ -27325,7 +27887,8 @@ ${sourceUrlComment}
27325
27887
  failed: "Failed"
27326
27888
  };
27327
27889
  function handleError(error) {
27328
- if (error.originalMessage.includes("Invalid header")) {
27890
+ if (error.originalMessage.includes("Invalid header") || error.originalMessage.includes('Expected "header"') || // WebDriver BiDi error for invalid values, for example, headers.
27891
+ error.originalMessage.includes("invalid argument")) {
27329
27892
  throw error;
27330
27893
  }
27331
27894
  debugError(error);
@@ -28547,7 +29110,7 @@ ${sourceUrlComment}
28547
29110
  }
28548
29111
  if (contextPayload.auxData && contextPayload.auxData["isDefault"]) {
28549
29112
  world = frame.worlds[MAIN_WORLD];
28550
- } else if (contextPayload.name === UTILITY_WORLD_NAME && !frame.worlds[PUPPETEER_WORLD].hasContext()) {
29113
+ } else if (contextPayload.name === UTILITY_WORLD_NAME) {
28551
29114
  world = frame.worlds[PUPPETEER_WORLD];
28552
29115
  }
28553
29116
  }
@@ -29758,7 +30321,6 @@ ${sourceUrlComment}
29758
30321
  #keyboard;
29759
30322
  #mouse;
29760
30323
  #touchscreen;
29761
- #accessibility;
29762
30324
  #frameManager;
29763
30325
  #emulationManager;
29764
30326
  #tracing;
@@ -29861,7 +30423,6 @@ ${sourceUrlComment}
29861
30423
  this.#keyboard = new CdpKeyboard(client);
29862
30424
  this.#mouse = new CdpMouse(client, this.#keyboard);
29863
30425
  this.#touchscreen = new CdpTouchscreen(client, this.#keyboard);
29864
- this.#accessibility = new Accessibility(client);
29865
30426
  this.#frameManager = new FrameManager(client, this, this._timeoutSettings);
29866
30427
  this.#emulationManager = new EmulationManager(client);
29867
30428
  this.#tracing = new Tracing(client);
@@ -29897,7 +30458,6 @@ ${sourceUrlComment}
29897
30458
  this.#keyboard.updateClient(newSession);
29898
30459
  this.#mouse.updateClient(newSession);
29899
30460
  this.#touchscreen.updateClient(newSession);
29900
- this.#accessibility.updateClient(newSession);
29901
30461
  this.#emulationManager.updateClient(newSession);
29902
30462
  this.#tracing.updateClient(newSession);
29903
30463
  this.#coverage.updateClient(newSession);
@@ -30055,9 +30615,6 @@ ${sourceUrlComment}
30055
30615
  get tracing() {
30056
30616
  return this.#tracing;
30057
30617
  }
30058
- get accessibility() {
30059
- return this.#accessibility;
30060
- }
30061
30618
  frames() {
30062
30619
  return this.#frameManager.frames();
30063
30620
  }
@@ -30788,7 +31345,8 @@ ${sourceUrlComment}
30788
31345
  }
30789
31346
  for (const [targetId, targetInfo] of this.#discoveredTargetsByTargetId.entries()) {
30790
31347
  const targetForFilter = new CdpTarget(targetInfo, void 0, void 0, this, void 0);
30791
- if ((!this.#targetFilterCallback || this.#targetFilterCallback(targetForFilter)) && targetInfo.type !== "browser") {
31348
+ const skipTarget = targetInfo.type === "browser" || targetInfo.url.startsWith("chrome-extension://");
31349
+ if ((!this.#targetFilterCallback || this.#targetFilterCallback(targetForFilter)) && !skipTarget) {
30792
31350
  this.#targetsIdsForInit.add(targetId);
30793
31351
  }
30794
31352
  }
@@ -31466,13 +32024,6 @@ puppeteer-core/lib/esm/puppeteer/common/NetworkManagerEvents.js:
31466
32024
  * SPDX-License-Identifier: Apache-2.0
31467
32025
  *)
31468
32026
 
31469
- puppeteer-core/lib/esm/puppeteer/cdp/Accessibility.js:
31470
- (**
31471
- * @license
31472
- * Copyright 2018 Google Inc.
31473
- * SPDX-License-Identifier: Apache-2.0
31474
- *)
31475
-
31476
32027
  puppeteer-core/lib/esm/puppeteer/api/JSHandle.js:
31477
32028
  (**
31478
32029
  * @license
@@ -31564,6 +32115,13 @@ puppeteer-core/lib/esm/puppeteer/cdp/AriaQueryHandler.js:
31564
32115
  * SPDX-License-Identifier: Apache-2.0
31565
32116
  *)
31566
32117
 
32118
+ puppeteer-core/lib/esm/puppeteer/common/CSSQueryHandler.js:
32119
+ (**
32120
+ * @license
32121
+ * Copyright 2023 Google Inc.
32122
+ * SPDX-License-Identifier: Apache-2.0
32123
+ *)
32124
+
31567
32125
  puppeteer-core/lib/esm/puppeteer/common/ScriptInjector.js:
31568
32126
  (**
31569
32127
  * @license
@@ -31592,6 +32150,13 @@ puppeteer-core/lib/esm/puppeteer/common/PQueryHandler.js:
31592
32150
  * SPDX-License-Identifier: Apache-2.0
31593
32151
  *)
31594
32152
 
32153
+ puppeteer-core/lib/esm/puppeteer/common/PSelectorParser.js:
32154
+ (**
32155
+ * @license
32156
+ * Copyright 2023 Google Inc.
32157
+ * SPDX-License-Identifier: Apache-2.0
32158
+ *)
32159
+
31595
32160
  puppeteer-core/lib/esm/puppeteer/common/TextQueryHandler.js:
31596
32161
  (**
31597
32162
  * @license
@@ -31662,6 +32227,13 @@ puppeteer-core/lib/esm/puppeteer/cdp/ExecutionContext.js:
31662
32227
  * SPDX-License-Identifier: Apache-2.0
31663
32228
  *)
31664
32229
 
32230
+ puppeteer-core/lib/esm/puppeteer/cdp/Accessibility.js:
32231
+ (**
32232
+ * @license
32233
+ * Copyright 2018 Google Inc.
32234
+ * SPDX-License-Identifier: Apache-2.0
32235
+ *)
32236
+
31665
32237
  puppeteer-core/lib/esm/puppeteer/cdp/FrameManagerEvents.js:
31666
32238
  (**
31667
32239
  * @license