@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
@@ -4111,9 +4111,9 @@
4111
4111
  }
4112
4112
  });
4113
4113
 
4114
- // node_modules/puppeteer-core/node_modules/debug/src/common.js
4114
+ // node_modules/debug/src/common.js
4115
4115
  var require_common = __commonJS({
4116
- "node_modules/puppeteer-core/node_modules/debug/src/common.js"(exports8, module) {
4116
+ "node_modules/debug/src/common.js"(exports8, module) {
4117
4117
  init_dirname();
4118
4118
  init_buffer2();
4119
4119
  function setup(env) {
@@ -4276,9 +4276,9 @@
4276
4276
  }
4277
4277
  });
4278
4278
 
4279
- // node_modules/puppeteer-core/node_modules/debug/src/browser.js
4279
+ // node_modules/debug/src/browser.js
4280
4280
  var require_browser = __commonJS({
4281
- "node_modules/puppeteer-core/node_modules/debug/src/browser.js"(exports8, module) {
4281
+ "node_modules/debug/src/browser.js"(exports8, module) {
4282
4282
  init_dirname();
4283
4283
  init_buffer2();
4284
4284
  exports8.formatArgs = formatArgs;
@@ -14693,20 +14693,20 @@
14693
14693
  }
14694
14694
  function flattenJSON(nestedJSON) {
14695
14695
  var flatJSON = {};
14696
- function flatten(pathPrefix, node) {
14696
+ function flatten2(pathPrefix, node) {
14697
14697
  for (var path2 in node) {
14698
14698
  var contentOrNode = node[path2];
14699
14699
  var joinedPath = join2(pathPrefix, path2);
14700
14700
  if (typeof contentOrNode === "string") {
14701
14701
  flatJSON[joinedPath] = contentOrNode;
14702
14702
  } else if (typeof contentOrNode === "object" && contentOrNode !== null && Object.keys(contentOrNode).length > 0) {
14703
- flatten(joinedPath, contentOrNode);
14703
+ flatten2(joinedPath, contentOrNode);
14704
14704
  } else {
14705
14705
  flatJSON[joinedPath] = null;
14706
14706
  }
14707
14707
  }
14708
14708
  }
14709
- flatten("", nestedJSON);
14709
+ flatten2("", nestedJSON);
14710
14710
  return flatJSON;
14711
14711
  }
14712
14712
  var Volume = function() {
@@ -16915,6 +16915,15 @@
16915
16915
  };
16916
16916
  });
16917
16917
  }
16918
+ function fromAbortSignal(signal, cause) {
16919
+ return signal ? fromEvent(signal, "abort").pipe(map(() => {
16920
+ if (signal.reason instanceof Error) {
16921
+ signal.reason.cause = cause;
16922
+ throw signal.reason;
16923
+ }
16924
+ throw new Error(signal.reason, { cause });
16925
+ })) : NEVER;
16926
+ }
16918
16927
  function filterAsync(predicate) {
16919
16928
  return mergeMap((value) => {
16920
16929
  return from(Promise.resolve(predicate(value))).pipe(filter((isMatch) => {
@@ -17807,7 +17816,7 @@
17807
17816
  __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);
17808
17817
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
17809
17818
  }
17810
- #page = (__runInitializers(this, _instanceExtraInitializers), void 0);
17819
+ #page = __runInitializers(this, _instanceExtraInitializers);
17811
17820
  #process;
17812
17821
  #controller = new AbortController();
17813
17822
  #lastFrame;
@@ -18655,8 +18664,8 @@
18655
18664
  })(LocatorEvent || (LocatorEvent = {}));
18656
18665
  var Locator = class extends EventEmitter2 {
18657
18666
  /**
18658
- * Creates a race between multiple locators but ensures that only a single one
18659
- * acts.
18667
+ * Creates a race between multiple locators trying to locate elements in
18668
+ * parallel but ensures that only a single element receives the action.
18660
18669
  *
18661
18670
  * @public
18662
18671
  */
@@ -18688,12 +18697,7 @@
18688
18697
  retryAndRaceWithSignalAndTimer: (signal, cause) => {
18689
18698
  const candidates = [];
18690
18699
  if (signal) {
18691
- candidates.push(fromEvent(signal, "abort").pipe(map(() => {
18692
- if (signal.reason instanceof Error) {
18693
- signal.reason.cause = cause;
18694
- }
18695
- throw signal.reason;
18696
- })));
18700
+ candidates.push(fromAbortSignal(signal, cause));
18697
18701
  }
18698
18702
  candidates.push(timeout(this._timeout, cause));
18699
18703
  return pipe(retry({ delay: RETRY_DELAY }), raceWith(...candidates));
@@ -18703,26 +18707,59 @@
18703
18707
  get timeout() {
18704
18708
  return this._timeout;
18705
18709
  }
18710
+ /**
18711
+ * Creates a new locator instance by cloning the current locator and setting
18712
+ * the total timeout for the locator actions.
18713
+ *
18714
+ * Pass `0` to disable timeout.
18715
+ *
18716
+ * @defaultValue `Page.getDefaultTimeout()`
18717
+ */
18706
18718
  setTimeout(timeout2) {
18707
18719
  const locator = this._clone();
18708
18720
  locator._timeout = timeout2;
18709
18721
  return locator;
18710
18722
  }
18723
+ /**
18724
+ * Creates a new locator instance by cloning the current locator with the
18725
+ * visibility property changed to the specified value.
18726
+ */
18711
18727
  setVisibility(visibility) {
18712
18728
  const locator = this._clone();
18713
18729
  locator.visibility = visibility;
18714
18730
  return locator;
18715
18731
  }
18732
+ /**
18733
+ * Creates a new locator instance by cloning the current locator and
18734
+ * specifying whether to wait for input elements to become enabled before the
18735
+ * action. Applicable to `click` and `fill` actions.
18736
+ *
18737
+ * @defaultValue `true`
18738
+ */
18716
18739
  setWaitForEnabled(value) {
18717
18740
  const locator = this._clone();
18718
18741
  locator.#waitForEnabled = value;
18719
18742
  return locator;
18720
18743
  }
18744
+ /**
18745
+ * Creates a new locator instance by cloning the current locator and
18746
+ * specifying whether the locator should scroll the element into viewport if
18747
+ * it is not in the viewport already.
18748
+ *
18749
+ * @defaultValue `true`
18750
+ */
18721
18751
  setEnsureElementIsInTheViewport(value) {
18722
18752
  const locator = this._clone();
18723
18753
  locator.#ensureElementIsInTheViewport = value;
18724
18754
  return locator;
18725
18755
  }
18756
+ /**
18757
+ * Creates a new locator instance by cloning the current locator and
18758
+ * specifying whether the locator has to wait for the element's bounding box
18759
+ * to be same between two consecutive animation frames.
18760
+ *
18761
+ * @defaultValue `true`
18762
+ */
18726
18763
  setWaitForStableBoundingBox(value) {
18727
18764
  const locator = this._clone();
18728
18765
  locator.#waitForStableBoundingBox = value;
@@ -19029,21 +19066,30 @@
19029
19066
  mapHandle(mapper) {
19030
19067
  return new MappedLocator(this._clone(), mapper);
19031
19068
  }
19069
+ /**
19070
+ * Clicks the located element.
19071
+ */
19032
19072
  click(options) {
19033
19073
  return firstValueFrom(this.#click(options));
19034
19074
  }
19035
19075
  /**
19036
19076
  * Fills out the input identified by the locator using the provided value. The
19037
19077
  * type of the input is determined at runtime and the appropriate fill-out
19038
- * method is chosen based on the type. contenteditable, selector, inputs are
19039
- * supported.
19078
+ * method is chosen based on the type. `contenteditable`, select, textarea and
19079
+ * input elements are supported.
19040
19080
  */
19041
19081
  fill(value, options) {
19042
19082
  return firstValueFrom(this.#fill(value, options));
19043
19083
  }
19084
+ /**
19085
+ * Hovers over the located element.
19086
+ */
19044
19087
  hover(options) {
19045
19088
  return firstValueFrom(this.#hover(options));
19046
19089
  }
19090
+ /**
19091
+ * Scrolls the located element.
19092
+ */
19047
19093
  scroll(options) {
19048
19094
  return firstValueFrom(this.#scroll(options));
19049
19095
  }
@@ -19409,6 +19455,12 @@
19409
19455
  }
19410
19456
  return super.off(type, handler);
19411
19457
  }
19458
+ /**
19459
+ * {@inheritDoc Accessibility}
19460
+ */
19461
+ get accessibility() {
19462
+ return this.mainFrame().accessibility;
19463
+ }
19412
19464
  locator(selectorOrFunc) {
19413
19465
  if (typeof selectorOrFunc === "string") {
19414
19466
  return NodeLocator.create(this, selectorOrFunc);
@@ -19425,28 +19477,58 @@
19425
19477
  return Locator.race(locators);
19426
19478
  }
19427
19479
  /**
19428
- * Runs `document.querySelector` within the page. If no element matches the
19429
- * selector, the return value resolves to `null`.
19480
+ * Finds the first element that matches the selector. If no element matches
19481
+ * the selector, the return value resolves to `null`.
19430
19482
  *
19431
- * @param selector - A `selector` to query page for
19432
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
19483
+ * @param selector -
19484
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
19433
19485
  * to query page for.
19486
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
19487
+ * can be passed as-is and a
19488
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
19489
+ * allows quering by
19490
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
19491
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
19492
+ * and
19493
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
19494
+ * and
19495
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
19496
+ * Alternatively, you can specify the selector type using a
19497
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
19498
+ *
19499
+ * @remarks
19500
+ *
19501
+ * Shortcut for {@link Frame.$ | Page.mainFrame().$(selector) }.
19434
19502
  */
19435
19503
  async $(selector) {
19436
19504
  return await this.mainFrame().$(selector);
19437
19505
  }
19438
19506
  /**
19439
- * The method runs `document.querySelectorAll` within the page. If no elements
19507
+ * Finds elements on the page that match the selector. If no elements
19440
19508
  * match the selector, the return value resolves to `[]`.
19441
19509
  *
19442
- * @param selector - A `selector` to query page for
19510
+ * @param selector -
19511
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
19512
+ * to query page for.
19513
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
19514
+ * can be passed as-is and a
19515
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
19516
+ * allows quering by
19517
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
19518
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
19519
+ * and
19520
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
19521
+ * and
19522
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
19523
+ * Alternatively, you can specify the selector type using a
19524
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
19443
19525
  *
19444
19526
  * @remarks
19445
19527
  *
19446
19528
  * Shortcut for {@link Frame.$$ | Page.mainFrame().$$(selector) }.
19447
19529
  */
19448
- async $$(selector) {
19449
- return await this.mainFrame().$$(selector);
19530
+ async $$(selector, options) {
19531
+ return await this.mainFrame().$$(selector, options);
19450
19532
  }
19451
19533
  /**
19452
19534
  * @remarks
@@ -19510,8 +19592,8 @@
19510
19592
  return await this.mainFrame().evaluateHandle(pageFunction, ...args);
19511
19593
  }
19512
19594
  /**
19513
- * This method runs `document.querySelector` within the page and passes the
19514
- * result as the first argument to the `pageFunction`.
19595
+ * This method finds the first element within the page that matches the selector
19596
+ * and passes the result as the first argument to the `pageFunction`.
19515
19597
  *
19516
19598
  * @remarks
19517
19599
  *
@@ -19559,11 +19641,23 @@
19559
19641
  * );
19560
19642
  * ```
19561
19643
  *
19562
- * @param selector - the
19563
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
19564
- * to query for
19644
+ * @param selector -
19645
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
19646
+ * to query page for.
19647
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
19648
+ * can be passed as-is and a
19649
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
19650
+ * allows quering by
19651
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
19652
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
19653
+ * and
19654
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
19655
+ * and
19656
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
19657
+ * Alternatively, you can specify the selector type using a
19658
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
19565
19659
  * @param pageFunction - the function to be evaluated in the page context.
19566
- * Will be passed the result of `document.querySelector(selector)` as its
19660
+ * Will be passed the result of the element matching the selector as its
19567
19661
  * first argument.
19568
19662
  * @param args - any additional arguments to pass through to `pageFunction`.
19569
19663
  *
@@ -19576,8 +19670,8 @@
19576
19670
  return await this.mainFrame().$eval(selector, pageFunction, ...args);
19577
19671
  }
19578
19672
  /**
19579
- * This method runs `Array.from(document.querySelectorAll(selector))` within
19580
- * the page and passes the result as the first argument to the `pageFunction`.
19673
+ * This method returns all elements matching the selector and passes the
19674
+ * resulting array as the first argument to the `pageFunction`.
19581
19675
  *
19582
19676
  * @remarks
19583
19677
  * If `pageFunction` returns a promise `$$eval` will wait for the promise to
@@ -19620,12 +19714,23 @@
19620
19714
  * );
19621
19715
  * ```
19622
19716
  *
19623
- * @param selector - the
19624
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
19625
- * to query for
19717
+ * @param selector -
19718
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
19719
+ * to query page for.
19720
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
19721
+ * can be passed as-is and a
19722
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
19723
+ * allows quering by
19724
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
19725
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
19726
+ * and
19727
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
19728
+ * and
19729
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
19730
+ * Alternatively, you can specify the selector type using a
19731
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
19626
19732
  * @param pageFunction - the function to be evaluated in the page context.
19627
- * Will be passed the result of
19628
- * `Array.from(document.querySelectorAll(selector))` as its first argument.
19733
+ * Will be passed an array of matching elements as its first argument.
19629
19734
  * @param args - any additional arguments to pass through to `pageFunction`.
19630
19735
  *
19631
19736
  * @returns The result of calling `pageFunction`. If it returns an element it
@@ -19674,68 +19779,12 @@
19674
19779
  *
19675
19780
  * @param html - HTML markup to assign to the page.
19676
19781
  * @param options - Parameters that has some properties.
19677
- *
19678
- * @remarks
19679
- *
19680
- * The parameter `options` might have the following options.
19681
- *
19682
- * - `timeout` : Maximum time in milliseconds for resources to load, defaults
19683
- * to 30 seconds, pass `0` to disable timeout. The default value can be
19684
- * changed by using the {@link Page.setDefaultNavigationTimeout} or
19685
- * {@link Page.setDefaultTimeout} methods.
19686
- *
19687
- * - `waitUntil`: When to consider setting markup succeeded, defaults to
19688
- * `load`. Given an array of event strings, setting content is considered
19689
- * to be successful after all events have been fired. Events can be
19690
- * either:<br/>
19691
- * - `load` : consider setting content to be finished when the `load` event
19692
- * is fired.<br/>
19693
- * - `domcontentloaded` : consider setting content to be finished when the
19694
- * `DOMContentLoaded` event is fired.<br/>
19695
- * - `networkidle0` : consider setting content to be finished when there are
19696
- * no more than 0 network connections for at least `500` ms.<br/>
19697
- * - `networkidle2` : consider setting content to be finished when there are
19698
- * no more than 2 network connections for at least `500` ms.
19699
19782
  */
19700
19783
  async setContent(html, options) {
19701
19784
  await this.mainFrame().setContent(html, options);
19702
19785
  }
19703
19786
  /**
19704
- * Navigates the page to the given `url`.
19705
- *
19706
- * @remarks
19707
- *
19708
- * Navigation to `about:blank` or navigation to the same URL with a different
19709
- * hash will succeed and return `null`.
19710
- *
19711
- * :::warning
19712
- *
19713
- * Headless mode doesn't support navigation to a PDF document. See the {@link
19714
- * https://bugs.chromium.org/p/chromium/issues/detail?id=761295 | upstream
19715
- * issue}.
19716
- *
19717
- * :::
19718
- *
19719
- * Shortcut for {@link Frame.goto | page.mainFrame().goto(url, options)}.
19720
- *
19721
- * @param url - URL to navigate page to. The URL should include scheme, e.g.
19722
- * `https://`
19723
- * @param options - Options to configure waiting behavior.
19724
- * @returns A promise which resolves to the main resource response. In case of
19725
- * multiple redirects, the navigation will resolve with the response of the
19726
- * last redirect.
19727
- * @throws If:
19728
- *
19729
- * - there's an SSL error (e.g. in case of self-signed certificates).
19730
- * - target URL is invalid.
19731
- * - the timeout is exceeded during navigation.
19732
- * - the remote server does not respond or is unreachable.
19733
- * - the main resource failed to load.
19734
- *
19735
- * This method will not throw an error when any valid HTTP status code is
19736
- * returned by the remote server, including 404 "Not Found" and 500 "Internal
19737
- * Server Error". The status code for such responses can be retrieved by
19738
- * calling {@link HTTPResponse.status}.
19787
+ * {@inheritDoc Frame.goto}
19739
19788
  */
19740
19789
  async goto(url, options) {
19741
19790
  return await this.mainFrame().goto(url, options);
@@ -19795,7 +19844,7 @@
19795
19844
  * {@link Page.setDefaultTimeout} method.
19796
19845
  */
19797
19846
  waitForRequest(urlOrPredicate, options = {}) {
19798
- const { timeout: ms = this._timeoutSettings.timeout() } = options;
19847
+ const { timeout: ms = this._timeoutSettings.timeout(), signal } = options;
19799
19848
  if (typeof urlOrPredicate === "string") {
19800
19849
  const url = urlOrPredicate;
19801
19850
  urlOrPredicate = (request) => {
@@ -19806,7 +19855,7 @@
19806
19855
  this,
19807
19856
  "request"
19808
19857
  /* PageEvent.Request */
19809
- ).pipe(filterAsync(urlOrPredicate), raceWith(timeout(ms), fromEmitterEvent(
19858
+ ).pipe(filterAsync(urlOrPredicate), raceWith(timeout(ms), fromAbortSignal(signal), fromEmitterEvent(
19810
19859
  this,
19811
19860
  "close"
19812
19861
  /* PageEvent.Close */
@@ -19843,7 +19892,7 @@
19843
19892
  * the {@link Page.setDefaultTimeout} method.
19844
19893
  */
19845
19894
  waitForResponse(urlOrPredicate, options = {}) {
19846
- const { timeout: ms = this._timeoutSettings.timeout() } = options;
19895
+ const { timeout: ms = this._timeoutSettings.timeout(), signal } = options;
19847
19896
  if (typeof urlOrPredicate === "string") {
19848
19897
  const url = urlOrPredicate;
19849
19898
  urlOrPredicate = (response) => {
@@ -19854,7 +19903,7 @@
19854
19903
  this,
19855
19904
  "response"
19856
19905
  /* PageEvent.Response */
19857
- ).pipe(filterAsync(urlOrPredicate), raceWith(timeout(ms), fromEmitterEvent(
19906
+ ).pipe(filterAsync(urlOrPredicate), raceWith(timeout(ms), fromAbortSignal(signal), fromEmitterEvent(
19858
19907
  this,
19859
19908
  "close"
19860
19909
  /* PageEvent.Close */
@@ -19876,14 +19925,14 @@
19876
19925
  * @internal
19877
19926
  */
19878
19927
  waitForNetworkIdle$(options = {}) {
19879
- const { timeout: ms = this._timeoutSettings.timeout(), idleTime = NETWORK_IDLE_TIME, concurrency = 0 } = options;
19928
+ const { timeout: ms = this._timeoutSettings.timeout(), idleTime = NETWORK_IDLE_TIME, concurrency = 0, signal } = options;
19880
19929
  return this.#inflight$.pipe(switchMap((inflight) => {
19881
19930
  if (inflight > concurrency) {
19882
19931
  return EMPTY;
19883
19932
  }
19884
19933
  return timer(idleTime);
19885
19934
  }), map(() => {
19886
- }), raceWith(timeout(ms), fromEmitterEvent(
19935
+ }), raceWith(timeout(ms), fromAbortSignal(signal), fromEmitterEvent(
19887
19936
  this,
19888
19937
  "close"
19889
19938
  /* PageEvent.Close */
@@ -19903,7 +19952,7 @@
19903
19952
  * ```
19904
19953
  */
19905
19954
  async waitForFrame(urlOrPredicate, options = {}) {
19906
- const { timeout: ms = this.getDefaultTimeout() } = options;
19955
+ const { timeout: ms = this.getDefaultTimeout(), signal } = options;
19907
19956
  if (isString3(urlOrPredicate)) {
19908
19957
  urlOrPredicate = (frame) => {
19909
19958
  return urlOrPredicate === frame.url();
@@ -19917,7 +19966,7 @@
19917
19966
  this,
19918
19967
  "framenavigated"
19919
19968
  /* PageEvent.FrameNavigated */
19920
- ), from(this.frames())).pipe(filterAsync(urlOrPredicate), first(), raceWith(timeout(ms), fromEmitterEvent(
19969
+ ), from(this.frames())).pipe(filterAsync(urlOrPredicate), first(), raceWith(timeout(ms), fromAbortSignal(signal), fromEmitterEvent(
19921
19970
  this,
19922
19971
  "close"
19923
19972
  /* PageEvent.Close */
@@ -20238,14 +20287,7 @@
20238
20287
  ...scrollDimensions
20239
20288
  });
20240
20289
  stack.defer(async () => {
20241
- if (viewport) {
20242
- await this.setViewport(viewport).catch(debugError);
20243
- } else {
20244
- await this.setViewport({
20245
- width: 0,
20246
- height: 0
20247
- }).catch(debugError);
20248
- }
20290
+ await this.setViewport(viewport).catch(debugError);
20249
20291
  });
20250
20292
  }
20251
20293
  } else {
@@ -20581,7 +20623,7 @@
20581
20623
  #args;
20582
20624
  #stackTraceLocations;
20583
20625
  /**
20584
- * @public
20626
+ * @internal
20585
20627
  */
20586
20628
  constructor(type, text, args, stackTraceLocations) {
20587
20629
  this.#type = type;
@@ -20691,482 +20733,112 @@
20691
20733
  init_Deferred();
20692
20734
  init_disposable();
20693
20735
 
20694
- // node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Accessibility.js
20736
+ // node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Binding.js
20695
20737
  init_dirname();
20696
20738
  init_buffer2();
20697
- var Accessibility = class {
20698
- #client;
20699
- /**
20700
- * @internal
20701
- */
20702
- constructor(client) {
20703
- this.#client = client;
20739
+
20740
+ // node_modules/puppeteer-core/lib/esm/puppeteer/api/JSHandle.js
20741
+ init_dirname();
20742
+ init_buffer2();
20743
+ init_util2();
20744
+ init_decorators();
20745
+ init_disposable();
20746
+ var __runInitializers3 = function(thisArg, initializers, value) {
20747
+ var useValue = arguments.length > 2;
20748
+ for (var i7 = 0; i7 < initializers.length; i7++) {
20749
+ value = useValue ? initializers[i7].call(thisArg, value) : initializers[i7].call(thisArg);
20704
20750
  }
20705
- /**
20706
- * @internal
20707
- */
20708
- updateClient(client) {
20709
- this.#client = client;
20751
+ return useValue ? value : void 0;
20752
+ };
20753
+ var __esDecorate3 = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
20754
+ function accept(f7) {
20755
+ if (f7 !== void 0 && typeof f7 !== "function") throw new TypeError("Function expected");
20756
+ return f7;
20710
20757
  }
20711
- /**
20712
- * Captures the current state of the accessibility tree.
20713
- * The returned object represents the root accessible node of the page.
20714
- *
20715
- * @remarks
20716
- *
20717
- * **NOTE** The Chrome accessibility tree contains nodes that go unused on
20718
- * most platforms and by most screen readers. Puppeteer will discard them as
20719
- * well for an easier to process tree, unless `interestingOnly` is set to
20720
- * `false`.
20721
- *
20722
- * @example
20723
- * An example of dumping the entire accessibility tree:
20724
- *
20725
- * ```ts
20726
- * const snapshot = await page.accessibility.snapshot();
20727
- * console.log(snapshot);
20728
- * ```
20729
- *
20730
- * @example
20731
- * An example of logging the focused node's name:
20732
- *
20733
- * ```ts
20734
- * const snapshot = await page.accessibility.snapshot();
20735
- * const node = findFocusedNode(snapshot);
20736
- * console.log(node && node.name);
20737
- *
20738
- * function findFocusedNode(node) {
20739
- * if (node.focused) return node;
20740
- * for (const child of node.children || []) {
20741
- * const foundNode = findFocusedNode(child);
20742
- * return foundNode;
20743
- * }
20744
- * return null;
20745
- * }
20746
- * ```
20747
- *
20748
- * @returns An AXNode object representing the snapshot.
20749
- */
20750
- async snapshot(options = {}) {
20751
- const { interestingOnly = true, root = null } = options;
20752
- const { nodes } = await this.#client.send("Accessibility.getFullAXTree");
20753
- let backendNodeId;
20754
- if (root) {
20755
- const { node } = await this.#client.send("DOM.describeNode", {
20756
- objectId: root.id
20757
- });
20758
- backendNodeId = node.backendNodeId;
20759
- }
20760
- const defaultRoot = AXNode.createTree(nodes);
20761
- let needle = defaultRoot;
20762
- if (backendNodeId) {
20763
- needle = defaultRoot.find((node) => {
20764
- return node.payload.backendDOMNodeId === backendNodeId;
20765
- });
20766
- if (!needle) {
20767
- return null;
20768
- }
20769
- }
20770
- if (!interestingOnly) {
20771
- return this.serializeTree(needle)[0] ?? null;
20772
- }
20773
- const interestingNodes = /* @__PURE__ */ new Set();
20774
- this.collectInterestingNodes(interestingNodes, defaultRoot, false);
20775
- if (!interestingNodes.has(needle)) {
20776
- return null;
20758
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
20759
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
20760
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
20761
+ var _4, done = false;
20762
+ for (var i7 = decorators.length - 1; i7 >= 0; i7--) {
20763
+ var context2 = {};
20764
+ for (var p7 in contextIn) context2[p7] = p7 === "access" ? {} : contextIn[p7];
20765
+ for (var p7 in contextIn.access) context2.access[p7] = contextIn.access[p7];
20766
+ context2.addInitializer = function(f7) {
20767
+ if (done) throw new TypeError("Cannot add initializers after decoration has completed");
20768
+ extraInitializers.push(accept(f7 || null));
20769
+ };
20770
+ var result = (0, decorators[i7])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context2);
20771
+ if (kind === "accessor") {
20772
+ if (result === void 0) continue;
20773
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
20774
+ if (_4 = accept(result.get)) descriptor.get = _4;
20775
+ if (_4 = accept(result.set)) descriptor.set = _4;
20776
+ if (_4 = accept(result.init)) initializers.unshift(_4);
20777
+ } else if (_4 = accept(result)) {
20778
+ if (kind === "field") initializers.unshift(_4);
20779
+ else descriptor[key] = _4;
20777
20780
  }
20778
- return this.serializeTree(needle, interestingNodes)[0] ?? null;
20779
20781
  }
20780
- serializeTree(node, interestingNodes) {
20781
- const children = [];
20782
- for (const child of node.children) {
20783
- children.push(...this.serializeTree(child, interestingNodes));
20784
- }
20785
- if (interestingNodes && !interestingNodes.has(node)) {
20786
- return children;
20782
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
20783
+ done = true;
20784
+ };
20785
+ var __addDisposableResource4 = function(env, value, async2) {
20786
+ if (value !== null && value !== void 0) {
20787
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
20788
+ var dispose;
20789
+ if (async2) {
20790
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
20791
+ dispose = value[Symbol.asyncDispose];
20787
20792
  }
20788
- const serializedNode = node.serialize();
20789
- if (children.length) {
20790
- serializedNode.children = children;
20793
+ if (dispose === void 0) {
20794
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
20795
+ dispose = value[Symbol.dispose];
20791
20796
  }
20792
- return [serializedNode];
20797
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
20798
+ env.stack.push({ value, dispose, async: async2 });
20799
+ } else if (async2) {
20800
+ env.stack.push({ async: true });
20793
20801
  }
20794
- collectInterestingNodes(collection, node, insideControl) {
20795
- if (node.isInteresting(insideControl)) {
20796
- collection.add(node);
20802
+ return value;
20803
+ };
20804
+ var __disposeResources4 = /* @__PURE__ */ function(SuppressedError2) {
20805
+ return function(env) {
20806
+ function fail2(e9) {
20807
+ env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
20808
+ env.hasError = true;
20797
20809
  }
20798
- if (node.isLeafNode()) {
20799
- return;
20810
+ function next() {
20811
+ while (env.stack.length) {
20812
+ var rec = env.stack.pop();
20813
+ try {
20814
+ var result = rec.dispose && rec.dispose.call(rec.value);
20815
+ if (rec.async) return Promise.resolve(result).then(next, function(e9) {
20816
+ fail2(e9);
20817
+ return next();
20818
+ });
20819
+ } catch (e9) {
20820
+ fail2(e9);
20821
+ }
20822
+ }
20823
+ if (env.hasError) throw env.error;
20800
20824
  }
20801
- insideControl = insideControl || node.isControl();
20802
- for (const child of node.children) {
20803
- this.collectInterestingNodes(collection, child, insideControl);
20804
- }
20805
- }
20806
- };
20807
- var AXNode = class _AXNode {
20808
- payload;
20809
- children = [];
20810
- #richlyEditable = false;
20811
- #editable = false;
20812
- #focusable = false;
20813
- #hidden = false;
20814
- #name;
20815
- #role;
20816
- #ignored;
20817
- #cachedHasFocusableChild;
20818
- constructor(payload) {
20819
- this.payload = payload;
20820
- this.#name = this.payload.name ? this.payload.name.value : "";
20821
- this.#role = this.payload.role ? this.payload.role.value : "Unknown";
20822
- this.#ignored = this.payload.ignored;
20823
- for (const property of this.payload.properties || []) {
20824
- if (property.name === "editable") {
20825
- this.#richlyEditable = property.value.value === "richtext";
20826
- this.#editable = true;
20827
- }
20828
- if (property.name === "focusable") {
20829
- this.#focusable = property.value.value;
20830
- }
20831
- if (property.name === "hidden") {
20832
- this.#hidden = property.value.value;
20833
- }
20834
- }
20835
- }
20836
- #isPlainTextField() {
20837
- if (this.#richlyEditable) {
20838
- return false;
20839
- }
20840
- if (this.#editable) {
20841
- return true;
20842
- }
20843
- return this.#role === "textbox" || this.#role === "searchbox";
20844
- }
20845
- #isTextOnlyObject() {
20846
- const role = this.#role;
20847
- return role === "LineBreak" || role === "text" || role === "InlineTextBox" || role === "StaticText";
20848
- }
20849
- #hasFocusableChild() {
20850
- if (this.#cachedHasFocusableChild === void 0) {
20851
- this.#cachedHasFocusableChild = false;
20852
- for (const child of this.children) {
20853
- if (child.#focusable || child.#hasFocusableChild()) {
20854
- this.#cachedHasFocusableChild = true;
20855
- break;
20856
- }
20857
- }
20858
- }
20859
- return this.#cachedHasFocusableChild;
20860
- }
20861
- find(predicate) {
20862
- if (predicate(this)) {
20863
- return this;
20864
- }
20865
- for (const child of this.children) {
20866
- const result = child.find(predicate);
20867
- if (result) {
20868
- return result;
20869
- }
20870
- }
20871
- return null;
20872
- }
20873
- isLeafNode() {
20874
- if (!this.children.length) {
20875
- return true;
20876
- }
20877
- if (this.#isPlainTextField() || this.#isTextOnlyObject()) {
20878
- return true;
20879
- }
20880
- switch (this.#role) {
20881
- case "doc-cover":
20882
- case "graphics-symbol":
20883
- case "img":
20884
- case "image":
20885
- case "Meter":
20886
- case "scrollbar":
20887
- case "slider":
20888
- case "separator":
20889
- case "progressbar":
20890
- return true;
20891
- default:
20892
- break;
20893
- }
20894
- if (this.#hasFocusableChild()) {
20895
- return false;
20896
- }
20897
- if (this.#focusable && this.#name) {
20898
- return true;
20899
- }
20900
- if (this.#role === "heading" && this.#name) {
20901
- return true;
20902
- }
20903
- return false;
20904
- }
20905
- isControl() {
20906
- switch (this.#role) {
20907
- case "button":
20908
- case "checkbox":
20909
- case "ColorWell":
20910
- case "combobox":
20911
- case "DisclosureTriangle":
20912
- case "listbox":
20913
- case "menu":
20914
- case "menubar":
20915
- case "menuitem":
20916
- case "menuitemcheckbox":
20917
- case "menuitemradio":
20918
- case "radio":
20919
- case "scrollbar":
20920
- case "searchbox":
20921
- case "slider":
20922
- case "spinbutton":
20923
- case "switch":
20924
- case "tab":
20925
- case "textbox":
20926
- case "tree":
20927
- case "treeitem":
20928
- return true;
20929
- default:
20930
- return false;
20931
- }
20932
- }
20933
- isInteresting(insideControl) {
20934
- const role = this.#role;
20935
- if (role === "Ignored" || this.#hidden || this.#ignored) {
20936
- return false;
20937
- }
20938
- if (this.#focusable || this.#richlyEditable) {
20939
- return true;
20940
- }
20941
- if (this.isControl()) {
20942
- return true;
20943
- }
20944
- if (insideControl) {
20945
- return false;
20946
- }
20947
- return this.isLeafNode() && !!this.#name;
20948
- }
20949
- serialize() {
20950
- const properties = /* @__PURE__ */ new Map();
20951
- for (const property of this.payload.properties || []) {
20952
- properties.set(property.name.toLowerCase(), property.value.value);
20953
- }
20954
- if (this.payload.name) {
20955
- properties.set("name", this.payload.name.value);
20956
- }
20957
- if (this.payload.value) {
20958
- properties.set("value", this.payload.value.value);
20959
- }
20960
- if (this.payload.description) {
20961
- properties.set("description", this.payload.description.value);
20962
- }
20963
- const node = {
20964
- role: this.#role
20965
- };
20966
- const userStringProperties = [
20967
- "name",
20968
- "value",
20969
- "description",
20970
- "keyshortcuts",
20971
- "roledescription",
20972
- "valuetext"
20973
- ];
20974
- const getUserStringPropertyValue = (key) => {
20975
- return properties.get(key);
20976
- };
20977
- for (const userStringProperty of userStringProperties) {
20978
- if (!properties.has(userStringProperty)) {
20979
- continue;
20980
- }
20981
- node[userStringProperty] = getUserStringPropertyValue(userStringProperty);
20982
- }
20983
- const booleanProperties = [
20984
- "disabled",
20985
- "expanded",
20986
- "focused",
20987
- "modal",
20988
- "multiline",
20989
- "multiselectable",
20990
- "readonly",
20991
- "required",
20992
- "selected"
20993
- ];
20994
- const getBooleanPropertyValue = (key) => {
20995
- return properties.get(key);
20996
- };
20997
- for (const booleanProperty of booleanProperties) {
20998
- if (booleanProperty === "focused" && this.#role === "RootWebArea") {
20999
- continue;
21000
- }
21001
- const value = getBooleanPropertyValue(booleanProperty);
21002
- if (!value) {
21003
- continue;
21004
- }
21005
- node[booleanProperty] = getBooleanPropertyValue(booleanProperty);
21006
- }
21007
- const tristateProperties = ["checked", "pressed"];
21008
- for (const tristateProperty of tristateProperties) {
21009
- if (!properties.has(tristateProperty)) {
21010
- continue;
21011
- }
21012
- const value = properties.get(tristateProperty);
21013
- node[tristateProperty] = value === "mixed" ? "mixed" : value === "true" ? true : false;
21014
- }
21015
- const numericalProperties = [
21016
- "level",
21017
- "valuemax",
21018
- "valuemin"
21019
- ];
21020
- const getNumericalPropertyValue = (key) => {
21021
- return properties.get(key);
21022
- };
21023
- for (const numericalProperty of numericalProperties) {
21024
- if (!properties.has(numericalProperty)) {
21025
- continue;
21026
- }
21027
- node[numericalProperty] = getNumericalPropertyValue(numericalProperty);
21028
- }
21029
- const tokenProperties = [
21030
- "autocomplete",
21031
- "haspopup",
21032
- "invalid",
21033
- "orientation"
21034
- ];
21035
- const getTokenPropertyValue = (key) => {
21036
- return properties.get(key);
21037
- };
21038
- for (const tokenProperty of tokenProperties) {
21039
- const value = getTokenPropertyValue(tokenProperty);
21040
- if (!value || value === "false") {
21041
- continue;
21042
- }
21043
- node[tokenProperty] = getTokenPropertyValue(tokenProperty);
21044
- }
21045
- return node;
21046
- }
21047
- static createTree(payloads) {
21048
- const nodeById = /* @__PURE__ */ new Map();
21049
- for (const payload of payloads) {
21050
- nodeById.set(payload.nodeId, new _AXNode(payload));
21051
- }
21052
- for (const node of nodeById.values()) {
21053
- for (const childId of node.payload.childIds || []) {
21054
- const child = nodeById.get(childId);
21055
- if (child) {
21056
- node.children.push(child);
21057
- }
21058
- }
21059
- }
21060
- return nodeById.values().next().value;
21061
- }
21062
- };
21063
-
21064
- // node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Binding.js
21065
- init_dirname();
21066
- init_buffer2();
21067
-
21068
- // node_modules/puppeteer-core/lib/esm/puppeteer/api/JSHandle.js
21069
- init_dirname();
21070
- init_buffer2();
21071
- init_util2();
21072
- init_decorators();
21073
- init_disposable();
21074
- var __runInitializers3 = function(thisArg, initializers, value) {
21075
- var useValue = arguments.length > 2;
21076
- for (var i7 = 0; i7 < initializers.length; i7++) {
21077
- value = useValue ? initializers[i7].call(thisArg, value) : initializers[i7].call(thisArg);
21078
- }
21079
- return useValue ? value : void 0;
21080
- };
21081
- var __esDecorate3 = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
21082
- function accept(f7) {
21083
- if (f7 !== void 0 && typeof f7 !== "function") throw new TypeError("Function expected");
21084
- return f7;
21085
- }
21086
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
21087
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
21088
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
21089
- var _4, done = false;
21090
- for (var i7 = decorators.length - 1; i7 >= 0; i7--) {
21091
- var context2 = {};
21092
- for (var p7 in contextIn) context2[p7] = p7 === "access" ? {} : contextIn[p7];
21093
- for (var p7 in contextIn.access) context2.access[p7] = contextIn.access[p7];
21094
- context2.addInitializer = function(f7) {
21095
- if (done) throw new TypeError("Cannot add initializers after decoration has completed");
21096
- extraInitializers.push(accept(f7 || null));
21097
- };
21098
- var result = (0, decorators[i7])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context2);
21099
- if (kind === "accessor") {
21100
- if (result === void 0) continue;
21101
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
21102
- if (_4 = accept(result.get)) descriptor.get = _4;
21103
- if (_4 = accept(result.set)) descriptor.set = _4;
21104
- if (_4 = accept(result.init)) initializers.unshift(_4);
21105
- } else if (_4 = accept(result)) {
21106
- if (kind === "field") initializers.unshift(_4);
21107
- else descriptor[key] = _4;
21108
- }
21109
- }
21110
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
21111
- done = true;
21112
- };
21113
- var __addDisposableResource4 = function(env, value, async2) {
21114
- if (value !== null && value !== void 0) {
21115
- if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
21116
- var dispose;
21117
- if (async2) {
21118
- if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
21119
- dispose = value[Symbol.asyncDispose];
21120
- }
21121
- if (dispose === void 0) {
21122
- if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
21123
- dispose = value[Symbol.dispose];
21124
- }
21125
- if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
21126
- env.stack.push({ value, dispose, async: async2 });
21127
- } else if (async2) {
21128
- env.stack.push({ async: true });
21129
- }
21130
- return value;
21131
- };
21132
- var __disposeResources4 = /* @__PURE__ */ function(SuppressedError2) {
21133
- return function(env) {
21134
- function fail2(e9) {
21135
- env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
21136
- env.hasError = true;
21137
- }
21138
- function next() {
21139
- while (env.stack.length) {
21140
- var rec = env.stack.pop();
21141
- try {
21142
- var result = rec.dispose && rec.dispose.call(rec.value);
21143
- if (rec.async) return Promise.resolve(result).then(next, function(e9) {
21144
- fail2(e9);
21145
- return next();
21146
- });
21147
- } catch (e9) {
21148
- fail2(e9);
21149
- }
21150
- }
21151
- if (env.hasError) throw env.error;
21152
- }
21153
- return next();
21154
- };
21155
- }(typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
21156
- var e9 = new Error(message);
21157
- return e9.name = "SuppressedError", e9.error = error, e9.suppressed = suppressed, e9;
21158
- });
21159
- var JSHandle = (() => {
21160
- let _classDecorators = [moveable];
21161
- let _classDescriptor;
21162
- let _classExtraInitializers = [];
21163
- let _classThis;
21164
- let _instanceExtraInitializers = [];
21165
- let _getProperty_decorators;
21166
- let _getProperties_decorators;
21167
- var JSHandle2 = class {
21168
- static {
21169
- _classThis = this;
20825
+ return next();
20826
+ };
20827
+ }(typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
20828
+ var e9 = new Error(message);
20829
+ return e9.name = "SuppressedError", e9.error = error, e9.suppressed = suppressed, e9;
20830
+ });
20831
+ var JSHandle = (() => {
20832
+ let _classDecorators = [moveable];
20833
+ let _classDescriptor;
20834
+ let _classExtraInitializers = [];
20835
+ let _classThis;
20836
+ let _instanceExtraInitializers = [];
20837
+ let _getProperty_decorators;
20838
+ let _getProperties_decorators;
20839
+ var JSHandle2 = class {
20840
+ static {
20841
+ _classThis = this;
21170
20842
  }
21171
20843
  static {
21172
20844
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? /* @__PURE__ */ Object.create(null) : void 0;
@@ -21400,7 +21072,6 @@
21400
21072
  init_Debug();
21401
21073
  init_Errors();
21402
21074
  init_EventEmitter();
21403
- init_assert();
21404
21075
  var debugProtocolSend = debug("puppeteer:protocol:SEND \u25BA");
21405
21076
  var debugProtocolReceive = debug("puppeteer:protocol:RECV \u25C0");
21406
21077
  var Connection = class extends EventEmitter2 {
@@ -21462,7 +21133,9 @@
21462
21133
  * @internal
21463
21134
  */
21464
21135
  _rawSend(callbacks, method, params, sessionId, options) {
21465
- assert(!this.#closed, "Protocol error: Connection closed.");
21136
+ if (this.#closed) {
21137
+ return Promise.reject(new Error("Protocol error: Connection closed."));
21138
+ }
21466
21139
  return callbacks.create(method, options?.timeout ?? this.#timeout, (id) => {
21467
21140
  const stringifiedMessage = JSON.stringify({
21468
21141
  method,
@@ -21602,6 +21275,9 @@
21602
21275
  var Coverage = class {
21603
21276
  #jsCoverage;
21604
21277
  #cssCoverage;
21278
+ /**
21279
+ * @internal
21280
+ */
21605
21281
  constructor(client) {
21606
21282
  this.#jsCoverage = new JSCoverage(client);
21607
21283
  this.#cssCoverage = new CSSCoverage(client);
@@ -21669,6 +21345,9 @@
21669
21345
  #resetOnNavigation = false;
21670
21346
  #reportAnonymousScripts = false;
21671
21347
  #includeRawScriptCoverage = false;
21348
+ /**
21349
+ * @internal
21350
+ */
21672
21351
  constructor(client) {
21673
21352
  this.#client = client;
21674
21353
  }
@@ -22085,6 +21764,12 @@
22085
21764
  _private_setJavaScriptEnabled_decorators = [invokeAtMostOnceForArguments];
22086
21765
  __esDecorate4(this, _private_applyViewport_descriptor = { value: __setFunctionName2(async function(client, viewportState) {
22087
21766
  if (!viewportState.viewport) {
21767
+ await Promise.all([
21768
+ client.send("Emulation.clearDeviceMetricsOverride"),
21769
+ client.send("Emulation.setTouchEmulationEnabled", {
21770
+ enabled: false
21771
+ })
21772
+ ]).catch(debugError);
22088
21773
  return;
22089
21774
  }
22090
21775
  const { viewport } = viewportState;
@@ -22201,7 +21886,7 @@
22201
21886
  }, "#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);
22202
21887
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
22203
21888
  }
22204
- #client = (__runInitializers4(this, _instanceExtraInitializers), void 0);
21889
+ #client = __runInitializers4(this, _instanceExtraInitializers);
22205
21890
  #emulatingMobile = false;
22206
21891
  #hasTouch = false;
22207
21892
  #states = [];
@@ -22263,12 +21948,18 @@
22263
21948
  return this.#javascriptEnabledState.state.javaScriptEnabled;
22264
21949
  }
22265
21950
  async emulateViewport(viewport) {
22266
- await this.#viewportState.setState({
21951
+ const currentState = this.#viewportState.state;
21952
+ if (!viewport && !currentState.active) {
21953
+ return false;
21954
+ }
21955
+ await this.#viewportState.setState(viewport ? {
22267
21956
  viewport,
22268
21957
  active: true
21958
+ } : {
21959
+ active: false
22269
21960
  });
22270
- const mobile = viewport.isMobile || false;
22271
- const hasTouch = viewport.hasTouch || false;
21961
+ const mobile = viewport?.isMobile || false;
21962
+ const hasTouch = viewport?.hasTouch || false;
22272
21963
  const reloadNeeded = this.#emulatingMobile !== mobile || this.#hasTouch !== hasTouch;
22273
21964
  this.#emulatingMobile = mobile;
22274
21965
  this.#hasTouch = hasTouch;
@@ -22888,6 +22579,7 @@
22888
22579
  return await frame.isolatedRealm().adoptHandle(elementOrFrame);
22889
22580
  })(), false);
22890
22581
  const { visible = false, hidden = false, timeout: timeout2, signal } = options;
22582
+ const polling = options.polling ?? (visible || hidden ? "raf" : "mutation");
22891
22583
  try {
22892
22584
  const env_4 = { stack: [], error: void 0, hasError: false };
22893
22585
  try {
@@ -22897,7 +22589,7 @@
22897
22589
  const node = await querySelector(root ?? document, selector2, PuppeteerUtil);
22898
22590
  return PuppeteerUtil.checkVisibility(node, visible2);
22899
22591
  }, {
22900
- polling: visible || hidden ? "raf" : "mutation",
22592
+ polling,
22901
22593
  root: element,
22902
22594
  timeout: timeout2,
22903
22595
  signal
@@ -23002,6 +22694,18 @@
23002
22694
  };
23003
22695
  };
23004
22696
 
22697
+ // node_modules/puppeteer-core/lib/esm/puppeteer/common/CSSQueryHandler.js
22698
+ init_dirname();
22699
+ init_buffer2();
22700
+ var CSSQueryHandler = class extends QueryHandler {
22701
+ static querySelector = (element, selector, { cssQuerySelector }) => {
22702
+ return cssQuerySelector(element, selector);
22703
+ };
22704
+ static querySelectorAll = (element, selector, { cssQuerySelectorAll }) => {
22705
+ return cssQuerySelectorAll(element, selector);
22706
+ };
22707
+ };
22708
+
23005
22709
  // node_modules/puppeteer-core/lib/esm/puppeteer/common/CustomQueryHandler.js
23006
22710
  init_dirname();
23007
22711
  init_buffer2();
@@ -23014,7 +22718,7 @@
23014
22718
  // node_modules/puppeteer-core/lib/esm/puppeteer/generated/injected.js
23015
22719
  init_dirname();
23016
22720
  init_buffer2();
23017
- 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';
22721
+ 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';
23018
22722
 
23019
22723
  // node_modules/puppeteer-core/lib/esm/puppeteer/common/ScriptInjector.js
23020
22724
  var ScriptInjector = class {
@@ -23132,34 +22836,316 @@
23132
22836
  for (const [registerScript] of this.#handlers) {
23133
22837
  scriptInjector.pop(registerScript);
23134
22838
  }
23135
- this.#handlers.clear();
22839
+ this.#handlers.clear();
22840
+ }
22841
+ };
22842
+ var customQueryHandlers = new CustomQueryHandlerRegistry();
22843
+
22844
+ // node_modules/puppeteer-core/lib/esm/puppeteer/common/PierceQueryHandler.js
22845
+ init_dirname();
22846
+ init_buffer2();
22847
+ var PierceQueryHandler = class extends QueryHandler {
22848
+ static querySelector = (element, selector, { pierceQuerySelector }) => {
22849
+ return pierceQuerySelector(element, selector);
22850
+ };
22851
+ static querySelectorAll = (element, selector, { pierceQuerySelectorAll }) => {
22852
+ return pierceQuerySelectorAll(element, selector);
22853
+ };
22854
+ };
22855
+
22856
+ // node_modules/puppeteer-core/lib/esm/puppeteer/common/PQueryHandler.js
22857
+ init_dirname();
22858
+ init_buffer2();
22859
+ var PQueryHandler = class extends QueryHandler {
22860
+ static querySelectorAll = (element, selector, { pQuerySelectorAll }) => {
22861
+ return pQuerySelectorAll(element, selector);
22862
+ };
22863
+ static querySelector = (element, selector, { pQuerySelector }) => {
22864
+ return pQuerySelector(element, selector);
22865
+ };
22866
+ };
22867
+
22868
+ // node_modules/puppeteer-core/lib/esm/puppeteer/common/PSelectorParser.js
22869
+ init_dirname();
22870
+ init_buffer2();
22871
+
22872
+ // node_modules/puppeteer-core/lib/esm/third_party/parsel-js/parsel-js.js
22873
+ init_dirname();
22874
+ init_buffer2();
22875
+ var TOKENS = {
22876
+ attribute: /\[\s*(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?(?<name>[-\w\P{ASCII}]+)\s*(?:(?<operator>\W?=)\s*(?<value>.+?)\s*(\s(?<caseSensitive>[iIsS]))?\s*)?\]/gu,
22877
+ id: /#(?<name>[-\w\P{ASCII}]+)/gu,
22878
+ class: /\.(?<name>[-\w\P{ASCII}]+)/gu,
22879
+ comma: /\s*,\s*/g,
22880
+ combinator: /\s*[\s>+~]\s*/g,
22881
+ "pseudo-element": /::(?<name>[-\w\P{ASCII}]+)(?:\((?<argument>¶*)\))?/gu,
22882
+ "pseudo-class": /:(?<name>[-\w\P{ASCII}]+)(?:\((?<argument>¶*)\))?/gu,
22883
+ universal: /(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?\*/gu,
22884
+ type: /(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?(?<name>[-\w\P{ASCII}]+)/gu
22885
+ // this must be last
22886
+ };
22887
+ var TRIM_TOKENS = /* @__PURE__ */ new Set(["combinator", "comma"]);
22888
+ var getArgumentPatternByType = (type) => {
22889
+ switch (type) {
22890
+ case "pseudo-element":
22891
+ case "pseudo-class":
22892
+ return new RegExp(TOKENS[type].source.replace("(?<argument>\xB6*)", "(?<argument>.*)"), "gu");
22893
+ default:
22894
+ return TOKENS[type];
22895
+ }
22896
+ };
22897
+ function gobbleParens(text, offset) {
22898
+ let nesting = 0;
22899
+ let result = "";
22900
+ for (; offset < text.length; offset++) {
22901
+ const char = text[offset];
22902
+ switch (char) {
22903
+ case "(":
22904
+ ++nesting;
22905
+ break;
22906
+ case ")":
22907
+ --nesting;
22908
+ break;
22909
+ }
22910
+ result += char;
22911
+ if (nesting === 0) {
22912
+ return result;
22913
+ }
22914
+ }
22915
+ return result;
22916
+ }
22917
+ function tokenizeBy(text, grammar = TOKENS) {
22918
+ if (!text) {
22919
+ return [];
22920
+ }
22921
+ const tokens = [text];
22922
+ for (const [type, pattern] of Object.entries(grammar)) {
22923
+ for (let i7 = 0; i7 < tokens.length; i7++) {
22924
+ const token = tokens[i7];
22925
+ if (typeof token !== "string") {
22926
+ continue;
22927
+ }
22928
+ pattern.lastIndex = 0;
22929
+ const match = pattern.exec(token);
22930
+ if (!match) {
22931
+ continue;
22932
+ }
22933
+ const from2 = match.index - 1;
22934
+ const args = [];
22935
+ const content = match[0];
22936
+ const before = token.slice(0, from2 + 1);
22937
+ if (before) {
22938
+ args.push(before);
22939
+ }
22940
+ args.push({
22941
+ ...match.groups,
22942
+ type,
22943
+ content
22944
+ });
22945
+ const after = token.slice(from2 + content.length + 1);
22946
+ if (after) {
22947
+ args.push(after);
22948
+ }
22949
+ tokens.splice(i7, 1, ...args);
22950
+ }
22951
+ }
22952
+ let offset = 0;
22953
+ for (const token of tokens) {
22954
+ switch (typeof token) {
22955
+ case "string":
22956
+ throw new Error(`Unexpected sequence ${token} found at index ${offset}`);
22957
+ case "object":
22958
+ offset += token.content.length;
22959
+ token.pos = [offset - token.content.length, offset];
22960
+ if (TRIM_TOKENS.has(token.type)) {
22961
+ token.content = token.content.trim() || " ";
22962
+ }
22963
+ break;
22964
+ }
22965
+ }
22966
+ return tokens;
22967
+ }
22968
+ var STRING_PATTERN = /(['"])([^\\\n]+?)\1/g;
22969
+ var ESCAPE_PATTERN = /\\./g;
22970
+ function tokenize(selector, grammar = TOKENS) {
22971
+ selector = selector.trim();
22972
+ if (selector === "") {
22973
+ return [];
22974
+ }
22975
+ const replacements = [];
22976
+ selector = selector.replace(ESCAPE_PATTERN, (value, offset) => {
22977
+ replacements.push({ value, offset });
22978
+ return "\uE000".repeat(value.length);
22979
+ });
22980
+ selector = selector.replace(STRING_PATTERN, (value, quote, content, offset) => {
22981
+ replacements.push({ value, offset });
22982
+ return `${quote}${"\uE001".repeat(content.length)}${quote}`;
22983
+ });
22984
+ {
22985
+ let pos = 0;
22986
+ let offset;
22987
+ while ((offset = selector.indexOf("(", pos)) > -1) {
22988
+ const value = gobbleParens(selector, offset);
22989
+ replacements.push({ value, offset });
22990
+ selector = `${selector.substring(0, offset)}(${"\xB6".repeat(value.length - 2)})${selector.substring(offset + value.length)}`;
22991
+ pos = offset + value.length;
22992
+ }
22993
+ }
22994
+ const tokens = tokenizeBy(selector, grammar);
22995
+ const changedTokens = /* @__PURE__ */ new Set();
22996
+ for (const replacement of replacements.reverse()) {
22997
+ for (const token of tokens) {
22998
+ const { offset, value } = replacement;
22999
+ if (!(token.pos[0] <= offset && offset + value.length <= token.pos[1])) {
23000
+ continue;
23001
+ }
23002
+ const { content } = token;
23003
+ const tokenOffset = offset - token.pos[0];
23004
+ token.content = content.slice(0, tokenOffset) + value + content.slice(tokenOffset + value.length);
23005
+ if (token.content !== content) {
23006
+ changedTokens.add(token);
23007
+ }
23008
+ }
23009
+ }
23010
+ for (const token of changedTokens) {
23011
+ const pattern = getArgumentPatternByType(token.type);
23012
+ if (!pattern) {
23013
+ throw new Error(`Unknown token type: ${token.type}`);
23014
+ }
23015
+ pattern.lastIndex = 0;
23016
+ const match = pattern.exec(token.content);
23017
+ if (!match) {
23018
+ throw new Error(`Unable to parse content for ${token.type}: ${token.content}`);
23019
+ }
23020
+ Object.assign(token, match.groups);
23136
23021
  }
23137
- };
23138
- var customQueryHandlers = new CustomQueryHandlerRegistry();
23139
-
23140
- // node_modules/puppeteer-core/lib/esm/puppeteer/common/PierceQueryHandler.js
23141
- init_dirname();
23142
- init_buffer2();
23143
- var PierceQueryHandler = class extends QueryHandler {
23144
- static querySelector = (element, selector, { pierceQuerySelector }) => {
23145
- return pierceQuerySelector(element, selector);
23146
- };
23147
- static querySelectorAll = (element, selector, { pierceQuerySelectorAll }) => {
23148
- return pierceQuerySelectorAll(element, selector);
23149
- };
23150
- };
23022
+ return tokens;
23023
+ }
23024
+ function* flatten(node, parent) {
23025
+ switch (node.type) {
23026
+ case "list":
23027
+ for (let child of node.list) {
23028
+ yield* flatten(child, node);
23029
+ }
23030
+ break;
23031
+ case "complex":
23032
+ yield* flatten(node.left, node);
23033
+ yield* flatten(node.right, node);
23034
+ break;
23035
+ case "compound":
23036
+ yield* node.list.map((token) => [token, node]);
23037
+ break;
23038
+ default:
23039
+ yield [node, parent];
23040
+ }
23041
+ }
23042
+ function stringify(listOrNode) {
23043
+ let tokens;
23044
+ if (Array.isArray(listOrNode)) {
23045
+ tokens = listOrNode;
23046
+ } else {
23047
+ tokens = [...flatten(listOrNode)].map(([token]) => token);
23048
+ }
23049
+ return tokens.map((token) => token.content).join("");
23050
+ }
23151
23051
 
23152
- // node_modules/puppeteer-core/lib/esm/puppeteer/common/PQueryHandler.js
23153
- init_dirname();
23154
- init_buffer2();
23155
- var PQueryHandler = class extends QueryHandler {
23156
- static querySelectorAll = (element, selector, { pQuerySelectorAll }) => {
23157
- return pQuerySelectorAll(element, selector);
23158
- };
23159
- static querySelector = (element, selector, { pQuerySelector }) => {
23160
- return pQuerySelector(element, selector);
23161
- };
23052
+ // node_modules/puppeteer-core/lib/esm/puppeteer/common/PSelectorParser.js
23053
+ TOKENS["nesting"] = /&/g;
23054
+ TOKENS["combinator"] = /\s*(>>>>?|[\s>+~])\s*/g;
23055
+ var ESCAPE_REGEXP = /\\[\s\S]/g;
23056
+ var unquote = (text) => {
23057
+ if (text.length <= 1) {
23058
+ return text;
23059
+ }
23060
+ if ((text[0] === '"' || text[0] === "'") && text.endsWith(text[0])) {
23061
+ text = text.slice(1, -1);
23062
+ }
23063
+ return text.replace(ESCAPE_REGEXP, (match) => {
23064
+ return match[1];
23065
+ });
23162
23066
  };
23067
+ function parsePSelectors(selector) {
23068
+ let isPureCSS = true;
23069
+ let hasAria = false;
23070
+ let hasPseudoClasses = false;
23071
+ const tokens = tokenize(selector);
23072
+ if (tokens.length === 0) {
23073
+ return [[], isPureCSS, hasPseudoClasses, false];
23074
+ }
23075
+ let compoundSelector = [];
23076
+ let complexSelector = [compoundSelector];
23077
+ const selectors = [complexSelector];
23078
+ const storage = [];
23079
+ for (const token of tokens) {
23080
+ switch (token.type) {
23081
+ case "combinator":
23082
+ switch (token.content) {
23083
+ case ">>>":
23084
+ isPureCSS = false;
23085
+ if (storage.length) {
23086
+ compoundSelector.push(stringify(storage));
23087
+ storage.splice(0);
23088
+ }
23089
+ compoundSelector = [];
23090
+ complexSelector.push(
23091
+ ">>>"
23092
+ /* PCombinator.Descendent */
23093
+ );
23094
+ complexSelector.push(compoundSelector);
23095
+ continue;
23096
+ case ">>>>":
23097
+ isPureCSS = false;
23098
+ if (storage.length) {
23099
+ compoundSelector.push(stringify(storage));
23100
+ storage.splice(0);
23101
+ }
23102
+ compoundSelector = [];
23103
+ complexSelector.push(
23104
+ ">>>>"
23105
+ /* PCombinator.Child */
23106
+ );
23107
+ complexSelector.push(compoundSelector);
23108
+ continue;
23109
+ }
23110
+ break;
23111
+ case "pseudo-element":
23112
+ if (!token.name.startsWith("-p-")) {
23113
+ break;
23114
+ }
23115
+ isPureCSS = false;
23116
+ if (storage.length) {
23117
+ compoundSelector.push(stringify(storage));
23118
+ storage.splice(0);
23119
+ }
23120
+ const name2 = token.name.slice(3);
23121
+ if (name2 === "aria") {
23122
+ hasAria = true;
23123
+ }
23124
+ compoundSelector.push({
23125
+ name: name2,
23126
+ value: unquote(token.argument ?? "")
23127
+ });
23128
+ continue;
23129
+ case "pseudo-class":
23130
+ hasPseudoClasses = true;
23131
+ break;
23132
+ case "comma":
23133
+ if (storage.length) {
23134
+ compoundSelector.push(stringify(storage));
23135
+ storage.splice(0);
23136
+ }
23137
+ compoundSelector = [];
23138
+ complexSelector = [compoundSelector];
23139
+ selectors.push(complexSelector);
23140
+ continue;
23141
+ }
23142
+ storage.push(token);
23143
+ }
23144
+ if (storage.length) {
23145
+ compoundSelector.push(stringify(storage));
23146
+ }
23147
+ return [selectors, isPureCSS, hasPseudoClasses, hasAria];
23148
+ }
23163
23149
 
23164
23150
  // node_modules/puppeteer-core/lib/esm/puppeteer/common/TextQueryHandler.js
23165
23151
  init_dirname();
@@ -23205,12 +23191,36 @@
23205
23191
  const prefix = `${name2}${separator}`;
23206
23192
  if (selector.startsWith(prefix)) {
23207
23193
  selector = selector.slice(prefix.length);
23208
- return { updatedSelector: selector, QueryHandler: QueryHandler2 };
23194
+ return {
23195
+ updatedSelector: selector,
23196
+ polling: name2 === "aria" ? "raf" : "mutation",
23197
+ QueryHandler: QueryHandler2
23198
+ };
23209
23199
  }
23210
23200
  }
23211
23201
  }
23212
23202
  }
23213
- return { updatedSelector: selector, QueryHandler: PQueryHandler };
23203
+ try {
23204
+ const [pSelector, isPureCSS, hasPseudoClasses, hasAria] = parsePSelectors(selector);
23205
+ if (isPureCSS) {
23206
+ return {
23207
+ updatedSelector: selector,
23208
+ polling: hasPseudoClasses ? "raf" : "mutation",
23209
+ QueryHandler: CSSQueryHandler
23210
+ };
23211
+ }
23212
+ return {
23213
+ updatedSelector: JSON.stringify(pSelector),
23214
+ polling: hasAria ? "raf" : "mutation",
23215
+ QueryHandler: PQueryHandler
23216
+ };
23217
+ } catch {
23218
+ return {
23219
+ updatedSelector: selector,
23220
+ polling: "mutation",
23221
+ QueryHandler: CSSQueryHandler
23222
+ };
23223
+ }
23214
23224
  }
23215
23225
 
23216
23226
  // node_modules/puppeteer-core/lib/esm/puppeteer/api/Frame.js
@@ -23385,7 +23395,7 @@
23385
23395
  /**
23386
23396
  * @internal
23387
23397
  */
23388
- _id = (__runInitializers5(this, _instanceExtraInitializers), void 0);
23398
+ _id = __runInitializers5(this, _instanceExtraInitializers);
23389
23399
  /**
23390
23400
  * @internal
23391
23401
  */
@@ -23410,10 +23420,8 @@
23410
23420
  */
23411
23421
  #document() {
23412
23422
  if (!this.#_document) {
23413
- this.#_document = this.isolatedRealm().evaluateHandle(() => {
23423
+ this.#_document = this.mainRealm().evaluateHandle(() => {
23414
23424
  return document;
23415
- }).then((handle) => {
23416
- return this.mainRealm().transferHandle(handle);
23417
23425
  });
23418
23426
  }
23419
23427
  return this.#_document;
@@ -23466,7 +23474,7 @@
23466
23474
  * Behaves identically to {@link Page.evaluateHandle} except it's run within
23467
23475
  * the context of this frame.
23468
23476
  *
23469
- * @see {@link Page.evaluateHandle} for details.
23477
+ * See {@link Page.evaluateHandle} for details.
23470
23478
  */
23471
23479
  async evaluateHandle(pageFunction, ...args) {
23472
23480
  pageFunction = withSourcePuppeteerURLIfNone(this.evaluateHandle.name, pageFunction);
@@ -23476,7 +23484,7 @@
23476
23484
  * Behaves identically to {@link Page.evaluate} except it's run within
23477
23485
  * the context of this frame.
23478
23486
  *
23479
- * @see {@link Page.evaluate} for details.
23487
+ * See {@link Page.evaluate} for details.
23480
23488
  */
23481
23489
  async evaluate(pageFunction, ...args) {
23482
23490
  pageFunction = withSourcePuppeteerURLIfNone(this.evaluate.name, pageFunction);
@@ -23495,7 +23503,22 @@
23495
23503
  /**
23496
23504
  * Queries the frame for an element matching the given selector.
23497
23505
  *
23498
- * @param selector - The selector to query for.
23506
+ * @param selector -
23507
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
23508
+ * to query page for.
23509
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
23510
+ * can be passed as-is and a
23511
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
23512
+ * allows quering by
23513
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
23514
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
23515
+ * and
23516
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
23517
+ * and
23518
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
23519
+ * Alternatively, you can specify the selector type using a
23520
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
23521
+ *
23499
23522
  * @returns A {@link ElementHandle | element handle} to the first element
23500
23523
  * matching the given selector. Otherwise, `null`.
23501
23524
  */
@@ -23506,13 +23529,28 @@
23506
23529
  /**
23507
23530
  * Queries the frame for all elements matching the given selector.
23508
23531
  *
23509
- * @param selector - The selector to query for.
23532
+ * @param selector -
23533
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
23534
+ * to query page for.
23535
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
23536
+ * can be passed as-is and a
23537
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
23538
+ * allows quering by
23539
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
23540
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
23541
+ * and
23542
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
23543
+ * and
23544
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
23545
+ * Alternatively, you can specify the selector type using a
23546
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
23547
+ *
23510
23548
  * @returns An array of {@link ElementHandle | element handles} that point to
23511
23549
  * elements matching the given selector.
23512
23550
  */
23513
- async $$(selector) {
23551
+ async $$(selector, options) {
23514
23552
  const document2 = await this.#document();
23515
- return await document2.$$(selector);
23553
+ return await document2.$$(selector, options);
23516
23554
  }
23517
23555
  /**
23518
23556
  * Runs the given function on the first element matching the given selector in
@@ -23527,7 +23565,21 @@
23527
23565
  * const searchValue = await frame.$eval('#search', el => el.value);
23528
23566
  * ```
23529
23567
  *
23530
- * @param selector - The selector to query for.
23568
+ * @param selector -
23569
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
23570
+ * to query page for.
23571
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
23572
+ * can be passed as-is and a
23573
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
23574
+ * allows quering by
23575
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
23576
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
23577
+ * and
23578
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
23579
+ * and
23580
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
23581
+ * Alternatively, you can specify the selector type using a
23582
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
23531
23583
  * @param pageFunction - The function to be evaluated in the frame's context.
23532
23584
  * The first element matching the selector will be passed to the function as
23533
23585
  * its first argument.
@@ -23552,7 +23604,21 @@
23552
23604
  * const divsCounts = await frame.$$eval('div', divs => divs.length);
23553
23605
  * ```
23554
23606
  *
23555
- * @param selector - The selector to query for.
23607
+ * @param selector -
23608
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
23609
+ * to query page for.
23610
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
23611
+ * can be passed as-is and a
23612
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
23613
+ * allows quering by
23614
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
23615
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
23616
+ * and
23617
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
23618
+ * and
23619
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
23620
+ * Alternatively, you can specify the selector type using a
23621
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
23556
23622
  * @param pageFunction - The function to be evaluated in the frame's context.
23557
23623
  * An array of elements matching the given selector will be passed to the
23558
23624
  * function as its first argument.
@@ -23600,8 +23666,11 @@
23600
23666
  * @throws Throws if an element matching the given selector doesn't appear.
23601
23667
  */
23602
23668
  async waitForSelector(selector, options = {}) {
23603
- const { updatedSelector, QueryHandler: QueryHandler2 } = getQueryHandlerAndSelector(selector);
23604
- return await QueryHandler2.waitFor(this, updatedSelector, options);
23669
+ const { updatedSelector, QueryHandler: QueryHandler2, polling } = getQueryHandlerAndSelector(selector);
23670
+ return await QueryHandler2.waitFor(this, updatedSelector, {
23671
+ polling,
23672
+ ...options
23673
+ });
23605
23674
  }
23606
23675
  /**
23607
23676
  * @example
@@ -24232,6 +24301,10 @@
24232
24301
  var e9 = new Error(message);
24233
24302
  return e9.name = "SuppressedError", e9.error = error, e9.suppressed = suppressed, e9;
24234
24303
  });
24304
+ var __setFunctionName3 = function(f7, name2, prefix) {
24305
+ if (typeof name2 === "symbol") name2 = name2.description ? "[".concat(name2.description, "]") : "";
24306
+ return Object.defineProperty(f7, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name2) : name2 });
24307
+ };
24235
24308
  var ElementHandle = (() => {
24236
24309
  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;
24237
24310
  let _classSuper = JSHandle;
@@ -24241,6 +24314,8 @@
24241
24314
  let _jsonValue_decorators;
24242
24315
  let _$_decorators;
24243
24316
  let _$$_decorators;
24317
+ let _private_$$_decorators;
24318
+ let _private_$$_descriptor;
24244
24319
  let _waitForSelector_decorators;
24245
24320
  let _isVisible_decorators;
24246
24321
  let _isHidden_decorators;
@@ -24273,7 +24348,8 @@
24273
24348
  _getProperties_decorators = [throwIfDisposed(), (_b = ElementHandle2).bindIsolatedHandle.bind(_b)];
24274
24349
  _jsonValue_decorators = [throwIfDisposed(), (_c = ElementHandle2).bindIsolatedHandle.bind(_c)];
24275
24350
  _$_decorators = [throwIfDisposed(), (_d = ElementHandle2).bindIsolatedHandle.bind(_d)];
24276
- _$$_decorators = [throwIfDisposed(), (_e = ElementHandle2).bindIsolatedHandle.bind(_e)];
24351
+ _$$_decorators = [throwIfDisposed()];
24352
+ _private_$$_decorators = [(_e = ElementHandle2).bindIsolatedHandle.bind(_e)];
24277
24353
  _waitForSelector_decorators = [throwIfDisposed(), (_f = ElementHandle2).bindIsolatedHandle.bind(_f)];
24278
24354
  _isVisible_decorators = [throwIfDisposed(), (_g = ElementHandle2).bindIsolatedHandle.bind(_g)];
24279
24355
  _isHidden_decorators = [throwIfDisposed(), (_h = ElementHandle2).bindIsolatedHandle.bind(_h)];
@@ -24304,6 +24380,9 @@
24304
24380
  __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);
24305
24381
  __esDecorate6(this, null, _$_decorators, { kind: "method", name: "$", static: false, private: false, access: { has: (obj) => "$" in obj, get: (obj) => obj.$ }, metadata: _metadata }, null, _instanceExtraInitializers);
24306
24382
  __esDecorate6(this, null, _$$_decorators, { kind: "method", name: "$$", static: false, private: false, access: { has: (obj) => "$$" in obj, get: (obj) => obj.$$ }, metadata: _metadata }, null, _instanceExtraInitializers);
24383
+ __esDecorate6(this, _private_$$_descriptor = { value: __setFunctionName3(async function(selector) {
24384
+ return await this.#$$impl(selector);
24385
+ }, "#$$") }, _private_$$_decorators, { kind: "method", name: "#$$", static: false, private: true, access: { has: (obj) => #$$ in obj, get: (obj) => obj.#$$ }, metadata: _metadata }, null, _instanceExtraInitializers);
24307
24386
  __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);
24308
24387
  __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);
24309
24388
  __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);
@@ -24336,7 +24415,7 @@
24336
24415
  * Cached isolatedHandle to prevent
24337
24416
  * trying to adopt it multiple times
24338
24417
  */
24339
- isolatedHandle = (__runInitializers6(this, _instanceExtraInitializers), void 0);
24418
+ isolatedHandle = __runInitializers6(this, _instanceExtraInitializers);
24340
24419
  /**
24341
24420
  * A given method will have it's `this` replaced with an isolated version of
24342
24421
  * `this` when decorated with this decorator.
@@ -24463,7 +24542,21 @@
24463
24542
  /**
24464
24543
  * Queries the current element for an element matching the given selector.
24465
24544
  *
24466
- * @param selector - The selector to query for.
24545
+ * @param selector -
24546
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
24547
+ * to query page for.
24548
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
24549
+ * can be passed as-is and a
24550
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
24551
+ * allows quering by
24552
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
24553
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
24554
+ * and
24555
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
24556
+ * and
24557
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
24558
+ * Alternatively, you can specify the selector type using a
24559
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
24467
24560
  * @returns A {@link ElementHandle | element handle} to the first element
24468
24561
  * matching the given selector. Otherwise, `null`.
24469
24562
  */
@@ -24474,11 +24567,44 @@
24474
24567
  /**
24475
24568
  * Queries the current element for all elements matching the given selector.
24476
24569
  *
24477
- * @param selector - The selector to query for.
24570
+ * @param selector -
24571
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
24572
+ * to query page for.
24573
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
24574
+ * can be passed as-is and a
24575
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
24576
+ * allows quering by
24577
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
24578
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
24579
+ * and
24580
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
24581
+ * and
24582
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
24583
+ * Alternatively, you can specify the selector type using a
24584
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
24478
24585
  * @returns An array of {@link ElementHandle | element handles} that point to
24479
24586
  * elements matching the given selector.
24480
24587
  */
24481
- async $$(selector) {
24588
+ async $$(selector, options) {
24589
+ if (options?.isolate === false) {
24590
+ return await this.#$$impl(selector);
24591
+ }
24592
+ return await this.#$$(selector);
24593
+ }
24594
+ /**
24595
+ * Isolates {@link ElementHandle.$$} if needed.
24596
+ *
24597
+ * @internal
24598
+ */
24599
+ get #$$() {
24600
+ return _private_$$_descriptor.value;
24601
+ }
24602
+ /**
24603
+ * Implementation for {@link ElementHandle.$$}.
24604
+ *
24605
+ * @internal
24606
+ */
24607
+ async #$$impl(selector) {
24482
24608
  const { updatedSelector, QueryHandler: QueryHandler2 } = getQueryHandlerAndSelector(selector);
24483
24609
  return await AsyncIterableUtil.collect(QueryHandler2.queryAll(this, updatedSelector));
24484
24610
  }
@@ -24501,7 +24627,21 @@
24501
24627
  * );
24502
24628
  * ```
24503
24629
  *
24504
- * @param selector - The selector to query for.
24630
+ * @param selector -
24631
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
24632
+ * to query page for.
24633
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
24634
+ * can be passed as-is and a
24635
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
24636
+ * allows quering by
24637
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
24638
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
24639
+ * and
24640
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
24641
+ * and
24642
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
24643
+ * Alternatively, you can specify the selector type using a
24644
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
24505
24645
  * @param pageFunction - The function to be evaluated in this element's page's
24506
24646
  * context. The first element matching the selector will be passed in as the
24507
24647
  * first argument.
@@ -24550,7 +24690,21 @@
24550
24690
  * ).toEqual(['Hello!', 'Hi!']);
24551
24691
  * ```
24552
24692
  *
24553
- * @param selector - The selector to query for.
24693
+ * @param selector -
24694
+ * {@link https://pptr.dev/guides/page-interactions#selectors | selector}
24695
+ * to query page for.
24696
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
24697
+ * can be passed as-is and a
24698
+ * {@link https://pptr.dev/guides/page-interactions#non-css-selectors | Puppeteer-specific selector syntax}
24699
+ * allows quering by
24700
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
24701
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
24702
+ * and
24703
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
24704
+ * and
24705
+ * {@link https://pptr.dev/guides/page-interactions#querying-elements-in-shadow-dom | combining these queries across shadow roots}.
24706
+ * Alternatively, you can specify the selector type using a
24707
+ * {@link https://pptr.dev/guides/page-interactions#prefixed-selector-syntax | prefix}.
24554
24708
  * @param pageFunction - The function to be evaluated in the element's page's
24555
24709
  * context. An array of elements matching the given selector will be passed to
24556
24710
  * the function as its first argument.
@@ -24617,8 +24771,11 @@
24617
24771
  * @throws Throws if an element matching the given selector doesn't appear.
24618
24772
  */
24619
24773
  async waitForSelector(selector, options = {}) {
24620
- const { updatedSelector, QueryHandler: QueryHandler2 } = getQueryHandlerAndSelector(selector);
24621
- return await QueryHandler2.waitFor(this, updatedSelector, options);
24774
+ const { updatedSelector, QueryHandler: QueryHandler2, polling } = getQueryHandlerAndSelector(selector);
24775
+ return await QueryHandler2.waitFor(this, updatedSelector, {
24776
+ polling,
24777
+ ...options
24778
+ });
24622
24779
  }
24623
24780
  async #checkVisibility(visibility) {
24624
24781
  return await this.evaluate(async (element, PuppeteerUtil, visibility2) => {
@@ -24628,15 +24785,32 @@
24628
24785
  }), visibility);
24629
24786
  }
24630
24787
  /**
24631
- * Checks if an element is visible using the same mechanism as
24632
- * {@link ElementHandle.waitForSelector}.
24788
+ * An element is considered to be visible if all of the following is
24789
+ * true:
24790
+ *
24791
+ * - the element has
24792
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle | computed styles}.
24793
+ *
24794
+ * - the element has a non-empty
24795
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect | bounding client rect}.
24796
+ *
24797
+ * - the element's {@link https://developer.mozilla.org/en-US/docs/Web/CSS/visibility | visibility}
24798
+ * is not `hidden` or `collapse`.
24633
24799
  */
24634
24800
  async isVisible() {
24635
24801
  return await this.#checkVisibility(true);
24636
24802
  }
24637
24803
  /**
24638
- * Checks if an element is hidden using the same mechanism as
24639
- * {@link ElementHandle.waitForSelector}.
24804
+ * An element is considered to be hidden if at least one of the following is true:
24805
+ *
24806
+ * - the element has no
24807
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle | computed styles}.
24808
+ *
24809
+ * - the element has an empty
24810
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect | bounding client rect}.
24811
+ *
24812
+ * - the element's {@link https://developer.mozilla.org/en-US/docs/Web/CSS/visibility | visibility}
24813
+ * is `hidden` or `collapse`.
24640
24814
  */
24641
24815
  async isHidden() {
24642
24816
  return await this.#checkVisibility(false);
@@ -25505,6 +25679,20 @@
25505
25679
  remoteObject() {
25506
25680
  return this.#remoteObject;
25507
25681
  }
25682
+ async getProperties() {
25683
+ const response = await this.client.send("Runtime.getProperties", {
25684
+ objectId: this.#remoteObject.objectId,
25685
+ ownProperties: true
25686
+ });
25687
+ const result = /* @__PURE__ */ new Map();
25688
+ for (const property of response.result) {
25689
+ if (!property.enumerable || !property.value) {
25690
+ continue;
25691
+ }
25692
+ result.set(property.name, this.#world.createCdpHandle(property.value));
25693
+ }
25694
+ return result;
25695
+ }
25508
25696
  };
25509
25697
  async function releaseObject(client, remoteObject) {
25510
25698
  if (!remoteObject.objectId) {
@@ -25815,6 +26003,9 @@
25815
26003
  }
25816
26004
  }
25817
26005
  async #onBindingCalled(event) {
26006
+ if (event.executionContextId !== this.#id) {
26007
+ return;
26008
+ }
25818
26009
  let payload;
25819
26010
  try {
25820
26011
  payload = JSON.parse(event.payload);
@@ -25831,9 +26022,6 @@
25831
26022
  return;
25832
26023
  }
25833
26024
  try {
25834
- if (event.executionContextId !== this.#id) {
25835
- return;
25836
- }
25837
26025
  const binding = this.#bindings.get(name2);
25838
26026
  await binding?.run(this, seq, args, isTrivial);
25839
26027
  } catch (err) {
@@ -25919,171 +26107,543 @@
25919
26107
  * a vanilla object containing the serializable properties of the result is
25920
26108
  * returned.
25921
26109
  */
25922
- async evaluate(pageFunction, ...args) {
25923
- return await this.#evaluate(true, pageFunction, ...args);
26110
+ async evaluate(pageFunction, ...args) {
26111
+ return await this.#evaluate(true, pageFunction, ...args);
26112
+ }
26113
+ /**
26114
+ * Evaluates the given function.
26115
+ *
26116
+ * Unlike {@link ExecutionContext.evaluate | evaluate}, this method returns a
26117
+ * handle to the result of the function.
26118
+ *
26119
+ * This method may be better suited if the object cannot be serialized (e.g.
26120
+ * `Map`) and requires further manipulation.
26121
+ *
26122
+ * @example
26123
+ *
26124
+ * ```ts
26125
+ * const context = await page.mainFrame().executionContext();
26126
+ * const handle: JSHandle<typeof globalThis> = await context.evaluateHandle(
26127
+ * () => Promise.resolve(self)
26128
+ * );
26129
+ * ```
26130
+ *
26131
+ * @example
26132
+ * A string can also be passed in instead of a function.
26133
+ *
26134
+ * ```ts
26135
+ * const handle: JSHandle<number> = await context.evaluateHandle('1 + 2');
26136
+ * ```
26137
+ *
26138
+ * @example
26139
+ * Handles can also be passed as `args`. They resolve to their referenced object:
26140
+ *
26141
+ * ```ts
26142
+ * const bodyHandle: ElementHandle<HTMLBodyElement> =
26143
+ * await context.evaluateHandle(() => {
26144
+ * return document.body;
26145
+ * });
26146
+ * const stringHandle: JSHandle<string> = await context.evaluateHandle(
26147
+ * body => body.innerHTML,
26148
+ * body
26149
+ * );
26150
+ * console.log(await stringHandle.jsonValue()); // prints body's innerHTML
26151
+ * // Always dispose your garbage! :)
26152
+ * await bodyHandle.dispose();
26153
+ * await stringHandle.dispose();
26154
+ * ```
26155
+ *
26156
+ * @param pageFunction - The function to evaluate.
26157
+ * @param args - Additional arguments to pass into the function.
26158
+ * @returns A {@link JSHandle | handle} to the result of evaluating the
26159
+ * function. If the result is a `Node`, then this will return an
26160
+ * {@link ElementHandle | element handle}.
26161
+ */
26162
+ async evaluateHandle(pageFunction, ...args) {
26163
+ return await this.#evaluate(false, pageFunction, ...args);
26164
+ }
26165
+ async #evaluate(returnByValue, pageFunction, ...args) {
26166
+ const sourceUrlComment = getSourceUrlComment(getSourcePuppeteerURLIfAvailable(pageFunction)?.toString() ?? PuppeteerURL.INTERNAL_URL);
26167
+ if (isString3(pageFunction)) {
26168
+ const contextId = this.#id;
26169
+ const expression = pageFunction;
26170
+ const expressionWithSourceUrl = SOURCE_URL_REGEX.test(expression) ? expression : `${expression}
26171
+ ${sourceUrlComment}
26172
+ `;
26173
+ const { exceptionDetails: exceptionDetails2, result: remoteObject2 } = await this.#client.send("Runtime.evaluate", {
26174
+ expression: expressionWithSourceUrl,
26175
+ contextId,
26176
+ returnByValue,
26177
+ awaitPromise: true,
26178
+ userGesture: true
26179
+ }).catch(rewriteError2);
26180
+ if (exceptionDetails2) {
26181
+ throw createEvaluationError(exceptionDetails2);
26182
+ }
26183
+ return returnByValue ? valueFromRemoteObject(remoteObject2) : this.#world.createCdpHandle(remoteObject2);
26184
+ }
26185
+ const functionDeclaration = stringifyFunction(pageFunction);
26186
+ const functionDeclarationWithSourceUrl = SOURCE_URL_REGEX.test(functionDeclaration) ? functionDeclaration : `${functionDeclaration}
26187
+ ${sourceUrlComment}
26188
+ `;
26189
+ let callFunctionOnPromise;
26190
+ try {
26191
+ callFunctionOnPromise = this.#client.send("Runtime.callFunctionOn", {
26192
+ functionDeclaration: functionDeclarationWithSourceUrl,
26193
+ executionContextId: this.#id,
26194
+ arguments: args.length ? await Promise.all(args.map(convertArgument.bind(this))) : [],
26195
+ returnByValue,
26196
+ awaitPromise: true,
26197
+ userGesture: true
26198
+ });
26199
+ } catch (error) {
26200
+ if (error instanceof TypeError && error.message.startsWith("Converting circular structure to JSON")) {
26201
+ error.message += " Recursive objects are not allowed.";
26202
+ }
26203
+ throw error;
26204
+ }
26205
+ const { exceptionDetails, result: remoteObject } = await callFunctionOnPromise.catch(rewriteError2);
26206
+ if (exceptionDetails) {
26207
+ throw createEvaluationError(exceptionDetails);
26208
+ }
26209
+ return returnByValue ? valueFromRemoteObject(remoteObject) : this.#world.createCdpHandle(remoteObject);
26210
+ async function convertArgument(arg) {
26211
+ if (arg instanceof LazyArg) {
26212
+ arg = await arg.get(this);
26213
+ }
26214
+ if (typeof arg === "bigint") {
26215
+ return { unserializableValue: `${arg.toString()}n` };
26216
+ }
26217
+ if (Object.is(arg, -0)) {
26218
+ return { unserializableValue: "-0" };
26219
+ }
26220
+ if (Object.is(arg, Infinity)) {
26221
+ return { unserializableValue: "Infinity" };
26222
+ }
26223
+ if (Object.is(arg, -Infinity)) {
26224
+ return { unserializableValue: "-Infinity" };
26225
+ }
26226
+ if (Object.is(arg, NaN)) {
26227
+ return { unserializableValue: "NaN" };
26228
+ }
26229
+ const objectHandle = arg && (arg instanceof CdpJSHandle || arg instanceof CdpElementHandle) ? arg : null;
26230
+ if (objectHandle) {
26231
+ if (objectHandle.realm !== this.#world) {
26232
+ throw new Error("JSHandles can be evaluated only in the context they were created!");
26233
+ }
26234
+ if (objectHandle.disposed) {
26235
+ throw new Error("JSHandle is disposed!");
26236
+ }
26237
+ if (objectHandle.remoteObject().unserializableValue) {
26238
+ return {
26239
+ unserializableValue: objectHandle.remoteObject().unserializableValue
26240
+ };
26241
+ }
26242
+ if (!objectHandle.remoteObject().objectId) {
26243
+ return { value: objectHandle.remoteObject().value };
26244
+ }
26245
+ return { objectId: objectHandle.remoteObject().objectId };
26246
+ }
26247
+ return { value: arg };
26248
+ }
26249
+ }
26250
+ [disposeSymbol]() {
26251
+ this.#disposables.dispose();
26252
+ this.emit("disposed", void 0);
26253
+ }
26254
+ };
26255
+ var rewriteError2 = (error) => {
26256
+ if (error.message.includes("Object reference chain is too long")) {
26257
+ return { result: { type: "undefined" } };
26258
+ }
26259
+ if (error.message.includes("Object couldn't be returned by value")) {
26260
+ return { result: { type: "undefined" } };
26261
+ }
26262
+ if (error.message.endsWith("Cannot find context with specified id") || error.message.endsWith("Inspected target navigated or closed")) {
26263
+ throw new Error("Execution context was destroyed, most likely because of a navigation.");
26264
+ }
26265
+ throw error;
26266
+ };
26267
+
26268
+ // node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Frame.js
26269
+ init_dirname();
26270
+ init_buffer2();
26271
+ init_Errors();
26272
+ init_Deferred();
26273
+ init_disposable();
26274
+
26275
+ // node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Accessibility.js
26276
+ init_dirname();
26277
+ init_buffer2();
26278
+ var Accessibility = class {
26279
+ #realm;
26280
+ /**
26281
+ * @internal
26282
+ */
26283
+ constructor(realm) {
26284
+ this.#realm = realm;
25924
26285
  }
25925
26286
  /**
25926
- * Evaluates the given function.
26287
+ * Captures the current state of the accessibility tree.
26288
+ * The returned object represents the root accessible node of the page.
25927
26289
  *
25928
- * Unlike {@link ExecutionContext.evaluate | evaluate}, this method returns a
25929
- * handle to the result of the function.
26290
+ * @remarks
25930
26291
  *
25931
- * This method may be better suited if the object cannot be serialized (e.g.
25932
- * `Map`) and requires further manipulation.
26292
+ * **NOTE** The Chrome accessibility tree contains nodes that go unused on
26293
+ * most platforms and by most screen readers. Puppeteer will discard them as
26294
+ * well for an easier to process tree, unless `interestingOnly` is set to
26295
+ * `false`.
25933
26296
  *
25934
26297
  * @example
26298
+ * An example of dumping the entire accessibility tree:
25935
26299
  *
25936
26300
  * ```ts
25937
- * const context = await page.mainFrame().executionContext();
25938
- * const handle: JSHandle<typeof globalThis> = await context.evaluateHandle(
25939
- * () => Promise.resolve(self)
25940
- * );
26301
+ * const snapshot = await page.accessibility.snapshot();
26302
+ * console.log(snapshot);
25941
26303
  * ```
25942
26304
  *
25943
26305
  * @example
25944
- * A string can also be passed in instead of a function.
26306
+ * An example of logging the focused node's name:
25945
26307
  *
25946
26308
  * ```ts
25947
- * const handle: JSHandle<number> = await context.evaluateHandle('1 + 2');
25948
- * ```
25949
- *
25950
- * @example
25951
- * Handles can also be passed as `args`. They resolve to their referenced object:
26309
+ * const snapshot = await page.accessibility.snapshot();
26310
+ * const node = findFocusedNode(snapshot);
26311
+ * console.log(node && node.name);
25952
26312
  *
25953
- * ```ts
25954
- * const bodyHandle: ElementHandle<HTMLBodyElement> =
25955
- * await context.evaluateHandle(() => {
25956
- * return document.body;
25957
- * });
25958
- * const stringHandle: JSHandle<string> = await context.evaluateHandle(
25959
- * body => body.innerHTML,
25960
- * body
25961
- * );
25962
- * console.log(await stringHandle.jsonValue()); // prints body's innerHTML
25963
- * // Always dispose your garbage! :)
25964
- * await bodyHandle.dispose();
25965
- * await stringHandle.dispose();
26313
+ * function findFocusedNode(node) {
26314
+ * if (node.focused) return node;
26315
+ * for (const child of node.children || []) {
26316
+ * const foundNode = findFocusedNode(child);
26317
+ * return foundNode;
26318
+ * }
26319
+ * return null;
26320
+ * }
25966
26321
  * ```
25967
26322
  *
25968
- * @param pageFunction - The function to evaluate.
25969
- * @param args - Additional arguments to pass into the function.
25970
- * @returns A {@link JSHandle | handle} to the result of evaluating the
25971
- * function. If the result is a `Node`, then this will return an
25972
- * {@link ElementHandle | element handle}.
26323
+ * @returns An AXNode object representing the snapshot.
25973
26324
  */
25974
- async evaluateHandle(pageFunction, ...args) {
25975
- return await this.#evaluate(false, pageFunction, ...args);
26325
+ async snapshot(options = {}) {
26326
+ const { interestingOnly = true, root = null } = options;
26327
+ const { nodes } = await this.#realm.environment.client.send("Accessibility.getFullAXTree");
26328
+ let backendNodeId;
26329
+ if (root) {
26330
+ const { node } = await this.#realm.environment.client.send("DOM.describeNode", {
26331
+ objectId: root.id
26332
+ });
26333
+ backendNodeId = node.backendNodeId;
26334
+ }
26335
+ const defaultRoot = AXNode.createTree(this.#realm, nodes);
26336
+ let needle = defaultRoot;
26337
+ if (backendNodeId) {
26338
+ needle = defaultRoot.find((node) => {
26339
+ return node.payload.backendDOMNodeId === backendNodeId;
26340
+ });
26341
+ if (!needle) {
26342
+ return null;
26343
+ }
26344
+ }
26345
+ if (!interestingOnly) {
26346
+ return this.serializeTree(needle)[0] ?? null;
26347
+ }
26348
+ const interestingNodes = /* @__PURE__ */ new Set();
26349
+ this.collectInterestingNodes(interestingNodes, defaultRoot, false);
26350
+ if (!interestingNodes.has(needle)) {
26351
+ return null;
26352
+ }
26353
+ return this.serializeTree(needle, interestingNodes)[0] ?? null;
26354
+ }
26355
+ serializeTree(node, interestingNodes) {
26356
+ const children = [];
26357
+ for (const child of node.children) {
26358
+ children.push(...this.serializeTree(child, interestingNodes));
26359
+ }
26360
+ if (interestingNodes && !interestingNodes.has(node)) {
26361
+ return children;
26362
+ }
26363
+ const serializedNode = node.serialize();
26364
+ if (children.length) {
26365
+ serializedNode.children = children;
26366
+ }
26367
+ return [serializedNode];
26368
+ }
26369
+ collectInterestingNodes(collection, node, insideControl) {
26370
+ if (node.isInteresting(insideControl)) {
26371
+ collection.add(node);
26372
+ }
26373
+ if (node.isLeafNode()) {
26374
+ return;
26375
+ }
26376
+ insideControl = insideControl || node.isControl();
26377
+ for (const child of node.children) {
26378
+ this.collectInterestingNodes(collection, child, insideControl);
26379
+ }
26380
+ }
26381
+ };
26382
+ var AXNode = class _AXNode {
26383
+ payload;
26384
+ children = [];
26385
+ #richlyEditable = false;
26386
+ #editable = false;
26387
+ #focusable = false;
26388
+ #hidden = false;
26389
+ #name;
26390
+ #role;
26391
+ #ignored;
26392
+ #cachedHasFocusableChild;
26393
+ #realm;
26394
+ constructor(realm, payload) {
26395
+ this.payload = payload;
26396
+ this.#name = this.payload.name ? this.payload.name.value : "";
26397
+ this.#role = this.payload.role ? this.payload.role.value : "Unknown";
26398
+ this.#ignored = this.payload.ignored;
26399
+ this.#realm = realm;
26400
+ for (const property of this.payload.properties || []) {
26401
+ if (property.name === "editable") {
26402
+ this.#richlyEditable = property.value.value === "richtext";
26403
+ this.#editable = true;
26404
+ }
26405
+ if (property.name === "focusable") {
26406
+ this.#focusable = property.value.value;
26407
+ }
26408
+ if (property.name === "hidden") {
26409
+ this.#hidden = property.value.value;
26410
+ }
26411
+ }
26412
+ }
26413
+ #isPlainTextField() {
26414
+ if (this.#richlyEditable) {
26415
+ return false;
26416
+ }
26417
+ if (this.#editable) {
26418
+ return true;
26419
+ }
26420
+ return this.#role === "textbox" || this.#role === "searchbox";
26421
+ }
26422
+ #isTextOnlyObject() {
26423
+ const role = this.#role;
26424
+ return role === "LineBreak" || role === "text" || role === "InlineTextBox" || role === "StaticText";
26425
+ }
26426
+ #hasFocusableChild() {
26427
+ if (this.#cachedHasFocusableChild === void 0) {
26428
+ this.#cachedHasFocusableChild = false;
26429
+ for (const child of this.children) {
26430
+ if (child.#focusable || child.#hasFocusableChild()) {
26431
+ this.#cachedHasFocusableChild = true;
26432
+ break;
26433
+ }
26434
+ }
26435
+ }
26436
+ return this.#cachedHasFocusableChild;
26437
+ }
26438
+ find(predicate) {
26439
+ if (predicate(this)) {
26440
+ return this;
26441
+ }
26442
+ for (const child of this.children) {
26443
+ const result = child.find(predicate);
26444
+ if (result) {
26445
+ return result;
26446
+ }
26447
+ }
26448
+ return null;
26449
+ }
26450
+ isLeafNode() {
26451
+ if (!this.children.length) {
26452
+ return true;
26453
+ }
26454
+ if (this.#isPlainTextField() || this.#isTextOnlyObject()) {
26455
+ return true;
26456
+ }
26457
+ switch (this.#role) {
26458
+ case "doc-cover":
26459
+ case "graphics-symbol":
26460
+ case "img":
26461
+ case "image":
26462
+ case "Meter":
26463
+ case "scrollbar":
26464
+ case "slider":
26465
+ case "separator":
26466
+ case "progressbar":
26467
+ return true;
26468
+ default:
26469
+ break;
26470
+ }
26471
+ if (this.#hasFocusableChild()) {
26472
+ return false;
26473
+ }
26474
+ if (this.#focusable && this.#name) {
26475
+ return true;
26476
+ }
26477
+ if (this.#role === "heading" && this.#name) {
26478
+ return true;
26479
+ }
26480
+ return false;
26481
+ }
26482
+ isControl() {
26483
+ switch (this.#role) {
26484
+ case "button":
26485
+ case "checkbox":
26486
+ case "ColorWell":
26487
+ case "combobox":
26488
+ case "DisclosureTriangle":
26489
+ case "listbox":
26490
+ case "menu":
26491
+ case "menubar":
26492
+ case "menuitem":
26493
+ case "menuitemcheckbox":
26494
+ case "menuitemradio":
26495
+ case "radio":
26496
+ case "scrollbar":
26497
+ case "searchbox":
26498
+ case "slider":
26499
+ case "spinbutton":
26500
+ case "switch":
26501
+ case "tab":
26502
+ case "textbox":
26503
+ case "tree":
26504
+ case "treeitem":
26505
+ return true;
26506
+ default:
26507
+ return false;
26508
+ }
25976
26509
  }
25977
- async #evaluate(returnByValue, pageFunction, ...args) {
25978
- const sourceUrlComment = getSourceUrlComment(getSourcePuppeteerURLIfAvailable(pageFunction)?.toString() ?? PuppeteerURL.INTERNAL_URL);
25979
- if (isString3(pageFunction)) {
25980
- const contextId = this.#id;
25981
- const expression = pageFunction;
25982
- const expressionWithSourceUrl = SOURCE_URL_REGEX.test(expression) ? expression : `${expression}
25983
- ${sourceUrlComment}
25984
- `;
25985
- const { exceptionDetails: exceptionDetails2, result: remoteObject2 } = await this.#client.send("Runtime.evaluate", {
25986
- expression: expressionWithSourceUrl,
25987
- contextId,
25988
- returnByValue,
25989
- awaitPromise: true,
25990
- userGesture: true
25991
- }).catch(rewriteError2);
25992
- if (exceptionDetails2) {
25993
- throw createEvaluationError(exceptionDetails2);
25994
- }
25995
- return returnByValue ? valueFromRemoteObject(remoteObject2) : this.#world.createCdpHandle(remoteObject2);
26510
+ isInteresting(insideControl) {
26511
+ const role = this.#role;
26512
+ if (role === "Ignored" || this.#hidden || this.#ignored) {
26513
+ return false;
25996
26514
  }
25997
- const functionDeclaration = stringifyFunction(pageFunction);
25998
- const functionDeclarationWithSourceUrl = SOURCE_URL_REGEX.test(functionDeclaration) ? functionDeclaration : `${functionDeclaration}
25999
- ${sourceUrlComment}
26000
- `;
26001
- let callFunctionOnPromise;
26002
- try {
26003
- callFunctionOnPromise = this.#client.send("Runtime.callFunctionOn", {
26004
- functionDeclaration: functionDeclarationWithSourceUrl,
26005
- executionContextId: this.#id,
26006
- arguments: args.length ? await Promise.all(args.map(convertArgument.bind(this))) : [],
26007
- returnByValue,
26008
- awaitPromise: true,
26009
- userGesture: true
26010
- });
26011
- } catch (error) {
26012
- if (error instanceof TypeError && error.message.startsWith("Converting circular structure to JSON")) {
26013
- error.message += " Recursive objects are not allowed.";
26014
- }
26015
- throw error;
26515
+ if (this.#focusable || this.#richlyEditable) {
26516
+ return true;
26016
26517
  }
26017
- const { exceptionDetails, result: remoteObject } = await callFunctionOnPromise.catch(rewriteError2);
26018
- if (exceptionDetails) {
26019
- throw createEvaluationError(exceptionDetails);
26518
+ if (this.isControl()) {
26519
+ return true;
26020
26520
  }
26021
- return returnByValue ? valueFromRemoteObject(remoteObject) : this.#world.createCdpHandle(remoteObject);
26022
- async function convertArgument(arg) {
26023
- if (arg instanceof LazyArg) {
26024
- arg = await arg.get(this);
26521
+ if (insideControl) {
26522
+ return false;
26523
+ }
26524
+ return this.isLeafNode() && !!this.#name;
26525
+ }
26526
+ serialize() {
26527
+ const properties = /* @__PURE__ */ new Map();
26528
+ for (const property of this.payload.properties || []) {
26529
+ properties.set(property.name.toLowerCase(), property.value.value);
26530
+ }
26531
+ if (this.payload.name) {
26532
+ properties.set("name", this.payload.name.value);
26533
+ }
26534
+ if (this.payload.value) {
26535
+ properties.set("value", this.payload.value.value);
26536
+ }
26537
+ if (this.payload.description) {
26538
+ properties.set("description", this.payload.description.value);
26539
+ }
26540
+ const node = {
26541
+ role: this.#role,
26542
+ elementHandle: async () => {
26543
+ if (!this.payload.backendDOMNodeId) {
26544
+ return null;
26545
+ }
26546
+ return await this.#realm.adoptBackendNode(this.payload.backendDOMNodeId);
26025
26547
  }
26026
- if (typeof arg === "bigint") {
26027
- return { unserializableValue: `${arg.toString()}n` };
26548
+ };
26549
+ const userStringProperties = [
26550
+ "name",
26551
+ "value",
26552
+ "description",
26553
+ "keyshortcuts",
26554
+ "roledescription",
26555
+ "valuetext"
26556
+ ];
26557
+ const getUserStringPropertyValue = (key) => {
26558
+ return properties.get(key);
26559
+ };
26560
+ for (const userStringProperty of userStringProperties) {
26561
+ if (!properties.has(userStringProperty)) {
26562
+ continue;
26028
26563
  }
26029
- if (Object.is(arg, -0)) {
26030
- return { unserializableValue: "-0" };
26564
+ node[userStringProperty] = getUserStringPropertyValue(userStringProperty);
26565
+ }
26566
+ const booleanProperties = [
26567
+ "disabled",
26568
+ "expanded",
26569
+ "focused",
26570
+ "modal",
26571
+ "multiline",
26572
+ "multiselectable",
26573
+ "readonly",
26574
+ "required",
26575
+ "selected"
26576
+ ];
26577
+ const getBooleanPropertyValue = (key) => {
26578
+ return properties.get(key);
26579
+ };
26580
+ for (const booleanProperty of booleanProperties) {
26581
+ if (booleanProperty === "focused" && this.#role === "RootWebArea") {
26582
+ continue;
26031
26583
  }
26032
- if (Object.is(arg, Infinity)) {
26033
- return { unserializableValue: "Infinity" };
26584
+ const value = getBooleanPropertyValue(booleanProperty);
26585
+ if (!value) {
26586
+ continue;
26034
26587
  }
26035
- if (Object.is(arg, -Infinity)) {
26036
- return { unserializableValue: "-Infinity" };
26588
+ node[booleanProperty] = getBooleanPropertyValue(booleanProperty);
26589
+ }
26590
+ const tristateProperties = ["checked", "pressed"];
26591
+ for (const tristateProperty of tristateProperties) {
26592
+ if (!properties.has(tristateProperty)) {
26593
+ continue;
26037
26594
  }
26038
- if (Object.is(arg, NaN)) {
26039
- return { unserializableValue: "NaN" };
26595
+ const value = properties.get(tristateProperty);
26596
+ node[tristateProperty] = value === "mixed" ? "mixed" : value === "true" ? true : false;
26597
+ }
26598
+ const numericalProperties = [
26599
+ "level",
26600
+ "valuemax",
26601
+ "valuemin"
26602
+ ];
26603
+ const getNumericalPropertyValue = (key) => {
26604
+ return properties.get(key);
26605
+ };
26606
+ for (const numericalProperty of numericalProperties) {
26607
+ if (!properties.has(numericalProperty)) {
26608
+ continue;
26040
26609
  }
26041
- const objectHandle = arg && (arg instanceof CdpJSHandle || arg instanceof CdpElementHandle) ? arg : null;
26042
- if (objectHandle) {
26043
- if (objectHandle.realm !== this.#world) {
26044
- throw new Error("JSHandles can be evaluated only in the context they were created!");
26045
- }
26046
- if (objectHandle.disposed) {
26047
- throw new Error("JSHandle is disposed!");
26048
- }
26049
- if (objectHandle.remoteObject().unserializableValue) {
26050
- return {
26051
- unserializableValue: objectHandle.remoteObject().unserializableValue
26052
- };
26053
- }
26054
- if (!objectHandle.remoteObject().objectId) {
26055
- return { value: objectHandle.remoteObject().value };
26056
- }
26057
- return { objectId: objectHandle.remoteObject().objectId };
26610
+ node[numericalProperty] = getNumericalPropertyValue(numericalProperty);
26611
+ }
26612
+ const tokenProperties = [
26613
+ "autocomplete",
26614
+ "haspopup",
26615
+ "invalid",
26616
+ "orientation"
26617
+ ];
26618
+ const getTokenPropertyValue = (key) => {
26619
+ return properties.get(key);
26620
+ };
26621
+ for (const tokenProperty of tokenProperties) {
26622
+ const value = getTokenPropertyValue(tokenProperty);
26623
+ if (!value || value === "false") {
26624
+ continue;
26058
26625
  }
26059
- return { value: arg };
26626
+ node[tokenProperty] = getTokenPropertyValue(tokenProperty);
26060
26627
  }
26628
+ return node;
26061
26629
  }
26062
- [disposeSymbol]() {
26063
- this.#disposables.dispose();
26064
- this.emit("disposed", void 0);
26065
- }
26066
- };
26067
- var rewriteError2 = (error) => {
26068
- if (error.message.includes("Object reference chain is too long")) {
26069
- return { result: { type: "undefined" } };
26070
- }
26071
- if (error.message.includes("Object couldn't be returned by value")) {
26072
- return { result: { type: "undefined" } };
26073
- }
26074
- if (error.message.endsWith("Cannot find context with specified id") || error.message.endsWith("Inspected target navigated or closed")) {
26075
- throw new Error("Execution context was destroyed, most likely because of a navigation.");
26630
+ static createTree(realm, payloads) {
26631
+ const nodeById = /* @__PURE__ */ new Map();
26632
+ for (const payload of payloads) {
26633
+ nodeById.set(payload.nodeId, new _AXNode(realm, payload));
26634
+ }
26635
+ for (const node of nodeById.values()) {
26636
+ for (const childId of node.payload.childIds || []) {
26637
+ const child = nodeById.get(childId);
26638
+ if (child) {
26639
+ node.children.push(child);
26640
+ }
26641
+ }
26642
+ }
26643
+ return nodeById.values().next().value;
26076
26644
  }
26077
- throw error;
26078
26645
  };
26079
26646
 
26080
- // node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Frame.js
26081
- init_dirname();
26082
- init_buffer2();
26083
- init_Errors();
26084
- init_Deferred();
26085
- init_disposable();
26086
-
26087
26647
  // node_modules/puppeteer-core/lib/esm/puppeteer/cdp/FrameManagerEvents.js
26088
26648
  init_dirname();
26089
26649
  init_buffer2();
@@ -26374,7 +26934,7 @@ ${sourceUrlComment}
26374
26934
  async #waitForExecutionContext() {
26375
26935
  const result = await firstValueFrom(fromEmitterEvent(this.#emitter, "context").pipe(raceWith(fromEmitterEvent(this.#emitter, "disposed").pipe(map(() => {
26376
26936
  throw new Error("Execution context was destroyed");
26377
- })))));
26937
+ })), timeout(this.timeoutSettings.timeout()))));
26378
26938
  return result;
26379
26939
  }
26380
26940
  async evaluateHandle(pageFunction, ...args) {
@@ -26666,6 +27226,7 @@ ${sourceUrlComment}
26666
27226
  _lifecycleEvents = /* @__PURE__ */ new Set();
26667
27227
  _id;
26668
27228
  _parentId;
27229
+ accessibility;
26669
27230
  worlds;
26670
27231
  constructor(frameManager, frameId, parentFrameId, client) {
26671
27232
  super();
@@ -26680,6 +27241,7 @@ ${sourceUrlComment}
26680
27241
  [MAIN_WORLD]: new IsolatedWorld(this, this._frameManager.timeoutSettings),
26681
27242
  [PUPPETEER_WORLD]: new IsolatedWorld(this, this._frameManager.timeoutSettings)
26682
27243
  };
27244
+ this.accessibility = new Accessibility(this.worlds[MAIN_WORLD]);
26683
27245
  this.on(FrameEvent.FrameSwappedByActivation, () => {
26684
27246
  this._onLoadingStarted();
26685
27247
  this._onLoadingStopped();
@@ -27333,7 +27895,8 @@ ${sourceUrlComment}
27333
27895
  failed: "Failed"
27334
27896
  };
27335
27897
  function handleError(error) {
27336
- if (error.originalMessage.includes("Invalid header")) {
27898
+ if (error.originalMessage.includes("Invalid header") || error.originalMessage.includes('Expected "header"') || // WebDriver BiDi error for invalid values, for example, headers.
27899
+ error.originalMessage.includes("invalid argument")) {
27337
27900
  throw error;
27338
27901
  }
27339
27902
  debugError(error);
@@ -28555,7 +29118,7 @@ ${sourceUrlComment}
28555
29118
  }
28556
29119
  if (contextPayload.auxData && contextPayload.auxData["isDefault"]) {
28557
29120
  world = frame.worlds[MAIN_WORLD];
28558
- } else if (contextPayload.name === UTILITY_WORLD_NAME && !frame.worlds[PUPPETEER_WORLD].hasContext()) {
29121
+ } else if (contextPayload.name === UTILITY_WORLD_NAME) {
28559
29122
  world = frame.worlds[PUPPETEER_WORLD];
28560
29123
  }
28561
29124
  }
@@ -29766,7 +30329,6 @@ ${sourceUrlComment}
29766
30329
  #keyboard;
29767
30330
  #mouse;
29768
30331
  #touchscreen;
29769
- #accessibility;
29770
30332
  #frameManager;
29771
30333
  #emulationManager;
29772
30334
  #tracing;
@@ -29869,7 +30431,6 @@ ${sourceUrlComment}
29869
30431
  this.#keyboard = new CdpKeyboard(client);
29870
30432
  this.#mouse = new CdpMouse(client, this.#keyboard);
29871
30433
  this.#touchscreen = new CdpTouchscreen(client, this.#keyboard);
29872
- this.#accessibility = new Accessibility(client);
29873
30434
  this.#frameManager = new FrameManager(client, this, this._timeoutSettings);
29874
30435
  this.#emulationManager = new EmulationManager(client);
29875
30436
  this.#tracing = new Tracing(client);
@@ -29905,7 +30466,6 @@ ${sourceUrlComment}
29905
30466
  this.#keyboard.updateClient(newSession);
29906
30467
  this.#mouse.updateClient(newSession);
29907
30468
  this.#touchscreen.updateClient(newSession);
29908
- this.#accessibility.updateClient(newSession);
29909
30469
  this.#emulationManager.updateClient(newSession);
29910
30470
  this.#tracing.updateClient(newSession);
29911
30471
  this.#coverage.updateClient(newSession);
@@ -30063,9 +30623,6 @@ ${sourceUrlComment}
30063
30623
  get tracing() {
30064
30624
  return this.#tracing;
30065
30625
  }
30066
- get accessibility() {
30067
- return this.#accessibility;
30068
- }
30069
30626
  frames() {
30070
30627
  return this.#frameManager.frames();
30071
30628
  }
@@ -30796,7 +31353,8 @@ ${sourceUrlComment}
30796
31353
  }
30797
31354
  for (const [targetId, targetInfo] of this.#discoveredTargetsByTargetId.entries()) {
30798
31355
  const targetForFilter = new CdpTarget(targetInfo, void 0, void 0, this, void 0);
30799
- if ((!this.#targetFilterCallback || this.#targetFilterCallback(targetForFilter)) && targetInfo.type !== "browser") {
31356
+ const skipTarget = targetInfo.type === "browser" || targetInfo.url.startsWith("chrome-extension://");
31357
+ if ((!this.#targetFilterCallback || this.#targetFilterCallback(targetForFilter)) && !skipTarget) {
30800
31358
  this.#targetsIdsForInit.add(targetId);
30801
31359
  }
30802
31360
  }
@@ -31474,13 +32032,6 @@ puppeteer-core/lib/esm/puppeteer/common/NetworkManagerEvents.js:
31474
32032
  * SPDX-License-Identifier: Apache-2.0
31475
32033
  *)
31476
32034
 
31477
- puppeteer-core/lib/esm/puppeteer/cdp/Accessibility.js:
31478
- (**
31479
- * @license
31480
- * Copyright 2018 Google Inc.
31481
- * SPDX-License-Identifier: Apache-2.0
31482
- *)
31483
-
31484
32035
  puppeteer-core/lib/esm/puppeteer/api/JSHandle.js:
31485
32036
  (**
31486
32037
  * @license
@@ -31572,6 +32123,13 @@ puppeteer-core/lib/esm/puppeteer/cdp/AriaQueryHandler.js:
31572
32123
  * SPDX-License-Identifier: Apache-2.0
31573
32124
  *)
31574
32125
 
32126
+ puppeteer-core/lib/esm/puppeteer/common/CSSQueryHandler.js:
32127
+ (**
32128
+ * @license
32129
+ * Copyright 2023 Google Inc.
32130
+ * SPDX-License-Identifier: Apache-2.0
32131
+ *)
32132
+
31575
32133
  puppeteer-core/lib/esm/puppeteer/common/ScriptInjector.js:
31576
32134
  (**
31577
32135
  * @license
@@ -31600,6 +32158,13 @@ puppeteer-core/lib/esm/puppeteer/common/PQueryHandler.js:
31600
32158
  * SPDX-License-Identifier: Apache-2.0
31601
32159
  *)
31602
32160
 
32161
+ puppeteer-core/lib/esm/puppeteer/common/PSelectorParser.js:
32162
+ (**
32163
+ * @license
32164
+ * Copyright 2023 Google Inc.
32165
+ * SPDX-License-Identifier: Apache-2.0
32166
+ *)
32167
+
31603
32168
  puppeteer-core/lib/esm/puppeteer/common/TextQueryHandler.js:
31604
32169
  (**
31605
32170
  * @license
@@ -31670,6 +32235,13 @@ puppeteer-core/lib/esm/puppeteer/cdp/ExecutionContext.js:
31670
32235
  * SPDX-License-Identifier: Apache-2.0
31671
32236
  *)
31672
32237
 
32238
+ puppeteer-core/lib/esm/puppeteer/cdp/Accessibility.js:
32239
+ (**
32240
+ * @license
32241
+ * Copyright 2018 Google Inc.
32242
+ * SPDX-License-Identifier: Apache-2.0
32243
+ *)
32244
+
31673
32245
  puppeteer-core/lib/esm/puppeteer/cdp/FrameManagerEvents.js:
31674
32246
  (**
31675
32247
  * @license