@browserless.io/browserless 2.13.1-beta.1 → 2.14.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.
@@ -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() {
@@ -17807,7 +17807,7 @@
17807
17807
  __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
17808
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
17809
17809
  }
17810
- #page = (__runInitializers(this, _instanceExtraInitializers), void 0);
17810
+ #page = __runInitializers(this, _instanceExtraInitializers);
17811
17811
  #process;
17812
17812
  #controller = new AbortController();
17813
17813
  #lastFrame;
@@ -19409,6 +19409,12 @@
19409
19409
  }
19410
19410
  return super.off(type, handler);
19411
19411
  }
19412
+ /**
19413
+ * {@inheritDoc Accessibility}
19414
+ */
19415
+ get accessibility() {
19416
+ return this.mainFrame().accessibility;
19417
+ }
19412
19418
  locator(selectorOrFunc) {
19413
19419
  if (typeof selectorOrFunc === "string") {
19414
19420
  return NodeLocator.create(this, selectorOrFunc);
@@ -19425,28 +19431,58 @@
19425
19431
  return Locator.race(locators);
19426
19432
  }
19427
19433
  /**
19428
- * Runs `document.querySelector` within the page. If no element matches the
19429
- * selector, the return value resolves to `null`.
19434
+ * Finds the first element that matches the selector. If no element matches
19435
+ * the selector, the return value resolves to `null`.
19430
19436
  *
19431
- * @param selector - A `selector` to query page for
19432
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
19437
+ * @param selector -
19438
+ * {@link https://pptr.dev/guides/page-interactions#query-selectors | selector}
19433
19439
  * to query page for.
19440
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
19441
+ * can be passed as-is and a
19442
+ * {@link https://pptr.dev/guides/page-interactions#p-selectors | Puppeteer-specific seletor syntax}
19443
+ * allows quering by
19444
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
19445
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
19446
+ * and
19447
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
19448
+ * and
19449
+ * {@link https://pptr.dev/guides/page-interactions#-and--combinators | combining these queries across shadow roots}.
19450
+ * Alternatively, you can specify a selector type using a prefix
19451
+ * {@link https://pptr.dev/guides/page-interactions#built-in-selectors | prefix}.
19452
+ *
19453
+ * @remarks
19454
+ *
19455
+ * Shortcut for {@link Frame.$ | Page.mainFrame().$(selector) }.
19434
19456
  */
19435
19457
  async $(selector) {
19436
19458
  return await this.mainFrame().$(selector);
19437
19459
  }
19438
19460
  /**
19439
- * The method runs `document.querySelectorAll` within the page. If no elements
19461
+ * Finds elements on the page that match the selector. If no elements
19440
19462
  * match the selector, the return value resolves to `[]`.
19441
19463
  *
19442
- * @param selector - A `selector` to query page for
19464
+ * @param selector -
19465
+ * {@link https://pptr.dev/guides/page-interactions#query-selectors | selector}
19466
+ * to query page for.
19467
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
19468
+ * can be passed as-is and a
19469
+ * {@link https://pptr.dev/guides/page-interactions#p-selectors | Puppeteer-specific seletor syntax}
19470
+ * allows quering by
19471
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
19472
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
19473
+ * and
19474
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
19475
+ * and
19476
+ * {@link https://pptr.dev/guides/page-interactions#-and--combinators | combining these queries across shadow roots}.
19477
+ * Alternatively, you can specify a selector type using a prefix
19478
+ * {@link https://pptr.dev/guides/page-interactions#built-in-selectors | prefix}.
19443
19479
  *
19444
19480
  * @remarks
19445
19481
  *
19446
19482
  * Shortcut for {@link Frame.$$ | Page.mainFrame().$$(selector) }.
19447
19483
  */
19448
- async $$(selector) {
19449
- return await this.mainFrame().$$(selector);
19484
+ async $$(selector, options) {
19485
+ return await this.mainFrame().$$(selector, options);
19450
19486
  }
19451
19487
  /**
19452
19488
  * @remarks
@@ -19510,8 +19546,8 @@
19510
19546
  return await this.mainFrame().evaluateHandle(pageFunction, ...args);
19511
19547
  }
19512
19548
  /**
19513
- * This method runs `document.querySelector` within the page and passes the
19514
- * result as the first argument to the `pageFunction`.
19549
+ * This method finds the first element within the page that matches the selector
19550
+ * and passes the result as the first argument to the `pageFunction`.
19515
19551
  *
19516
19552
  * @remarks
19517
19553
  *
@@ -19559,11 +19595,23 @@
19559
19595
  * );
19560
19596
  * ```
19561
19597
  *
19562
- * @param selector - the
19563
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
19564
- * to query for
19598
+ * @param selector -
19599
+ * {@link https://pptr.dev/guides/page-interactions#query-selectors | selector}
19600
+ * to query page for.
19601
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
19602
+ * can be passed as-is and a
19603
+ * {@link https://pptr.dev/guides/page-interactions#p-selectors | Puppeteer-specific seletor syntax}
19604
+ * allows quering by
19605
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
19606
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
19607
+ * and
19608
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
19609
+ * and
19610
+ * {@link https://pptr.dev/guides/page-interactions#-and--combinators | combining these queries across shadow roots}.
19611
+ * Alternatively, you can specify a selector type using a prefix
19612
+ * {@link https://pptr.dev/guides/page-interactions#built-in-selectors | prefix}.
19565
19613
  * @param pageFunction - the function to be evaluated in the page context.
19566
- * Will be passed the result of `document.querySelector(selector)` as its
19614
+ * Will be passed the result of the element matching the selector as its
19567
19615
  * first argument.
19568
19616
  * @param args - any additional arguments to pass through to `pageFunction`.
19569
19617
  *
@@ -19576,8 +19624,8 @@
19576
19624
  return await this.mainFrame().$eval(selector, pageFunction, ...args);
19577
19625
  }
19578
19626
  /**
19579
- * This method runs `Array.from(document.querySelectorAll(selector))` within
19580
- * the page and passes the result as the first argument to the `pageFunction`.
19627
+ * This method returns all elements matching the selector and passes the
19628
+ * resulting array as the first argument to the `pageFunction`.
19581
19629
  *
19582
19630
  * @remarks
19583
19631
  * If `pageFunction` returns a promise `$$eval` will wait for the promise to
@@ -19620,12 +19668,23 @@
19620
19668
  * );
19621
19669
  * ```
19622
19670
  *
19623
- * @param selector - the
19624
- * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
19625
- * to query for
19671
+ * @param selector -
19672
+ * {@link https://pptr.dev/guides/page-interactions#query-selectors | selector}
19673
+ * to query page for.
19674
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
19675
+ * can be passed as-is and a
19676
+ * {@link https://pptr.dev/guides/page-interactions#p-selectors | Puppeteer-specific seletor syntax}
19677
+ * allows quering by
19678
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
19679
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
19680
+ * and
19681
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
19682
+ * and
19683
+ * {@link https://pptr.dev/guides/page-interactions#-and--combinators | combining these queries across shadow roots}.
19684
+ * Alternatively, you can specify a selector type using a prefix
19685
+ * {@link https://pptr.dev/guides/page-interactions#built-in-selectors | prefix}.
19626
19686
  * @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.
19687
+ * Will be passed an array of matching elements as its first argument.
19629
19688
  * @param args - any additional arguments to pass through to `pageFunction`.
19630
19689
  *
19631
19690
  * @returns The result of calling `pageFunction`. If it returns an element it
@@ -19674,68 +19733,12 @@
19674
19733
  *
19675
19734
  * @param html - HTML markup to assign to the page.
19676
19735
  * @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
19736
  */
19700
19737
  async setContent(html, options) {
19701
19738
  await this.mainFrame().setContent(html, options);
19702
19739
  }
19703
19740
  /**
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}.
19741
+ * {@inheritDoc Frame.goto}
19739
19742
  */
19740
19743
  async goto(url, options) {
19741
19744
  return await this.mainFrame().goto(url, options);
@@ -20691,464 +20694,94 @@
20691
20694
  init_Deferred();
20692
20695
  init_disposable();
20693
20696
 
20694
- // node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Accessibility.js
20697
+ // node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Binding.js
20695
20698
  init_dirname();
20696
20699
  init_buffer2();
20697
- var Accessibility = class {
20698
- #client;
20699
- /**
20700
- * @internal
20701
- */
20702
- constructor(client) {
20703
- this.#client = client;
20704
- }
20705
- /**
20706
- * @internal
20707
- */
20708
- updateClient(client) {
20709
- this.#client = client;
20700
+
20701
+ // node_modules/puppeteer-core/lib/esm/puppeteer/api/JSHandle.js
20702
+ init_dirname();
20703
+ init_buffer2();
20704
+ init_util2();
20705
+ init_decorators();
20706
+ init_disposable();
20707
+ var __runInitializers3 = function(thisArg, initializers, value) {
20708
+ var useValue = arguments.length > 2;
20709
+ for (var i7 = 0; i7 < initializers.length; i7++) {
20710
+ value = useValue ? initializers[i7].call(thisArg, value) : initializers[i7].call(thisArg);
20710
20711
  }
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;
20777
- }
20778
- return this.serializeTree(needle, interestingNodes)[0] ?? null;
20712
+ return useValue ? value : void 0;
20713
+ };
20714
+ var __esDecorate3 = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
20715
+ function accept(f7) {
20716
+ if (f7 !== void 0 && typeof f7 !== "function") throw new TypeError("Function expected");
20717
+ return f7;
20779
20718
  }
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;
20787
- }
20788
- const serializedNode = node.serialize();
20789
- if (children.length) {
20790
- serializedNode.children = children;
20719
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
20720
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
20721
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
20722
+ var _4, done = false;
20723
+ for (var i7 = decorators.length - 1; i7 >= 0; i7--) {
20724
+ var context2 = {};
20725
+ for (var p7 in contextIn) context2[p7] = p7 === "access" ? {} : contextIn[p7];
20726
+ for (var p7 in contextIn.access) context2.access[p7] = contextIn.access[p7];
20727
+ context2.addInitializer = function(f7) {
20728
+ if (done) throw new TypeError("Cannot add initializers after decoration has completed");
20729
+ extraInitializers.push(accept(f7 || null));
20730
+ };
20731
+ var result = (0, decorators[i7])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context2);
20732
+ if (kind === "accessor") {
20733
+ if (result === void 0) continue;
20734
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
20735
+ if (_4 = accept(result.get)) descriptor.get = _4;
20736
+ if (_4 = accept(result.set)) descriptor.set = _4;
20737
+ if (_4 = accept(result.init)) initializers.unshift(_4);
20738
+ } else if (_4 = accept(result)) {
20739
+ if (kind === "field") initializers.unshift(_4);
20740
+ else descriptor[key] = _4;
20791
20741
  }
20792
- return [serializedNode];
20793
20742
  }
20794
- collectInterestingNodes(collection, node, insideControl) {
20795
- if (node.isInteresting(insideControl)) {
20796
- collection.add(node);
20797
- }
20798
- if (node.isLeafNode()) {
20799
- return;
20743
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
20744
+ done = true;
20745
+ };
20746
+ var __addDisposableResource4 = function(env, value, async2) {
20747
+ if (value !== null && value !== void 0) {
20748
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
20749
+ var dispose;
20750
+ if (async2) {
20751
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
20752
+ dispose = value[Symbol.asyncDispose];
20800
20753
  }
20801
- insideControl = insideControl || node.isControl();
20802
- for (const child of node.children) {
20803
- this.collectInterestingNodes(collection, child, insideControl);
20754
+ if (dispose === void 0) {
20755
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
20756
+ dispose = value[Symbol.dispose];
20804
20757
  }
20758
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
20759
+ env.stack.push({ value, dispose, async: async2 });
20760
+ } else if (async2) {
20761
+ env.stack.push({ async: true });
20805
20762
  }
20763
+ return value;
20806
20764
  };
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;
20765
+ var __disposeResources4 = /* @__PURE__ */ function(SuppressedError2) {
20766
+ return function(env) {
20767
+ function fail2(e9) {
20768
+ env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
20769
+ env.hasError = true;
20842
20770
  }
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;
20771
+ function next() {
20772
+ while (env.stack.length) {
20773
+ var rec = env.stack.pop();
20774
+ try {
20775
+ var result = rec.dispose && rec.dispose.call(rec.value);
20776
+ if (rec.async) return Promise.resolve(result).then(next, function(e9) {
20777
+ fail2(e9);
20778
+ return next();
20779
+ });
20780
+ } catch (e9) {
20781
+ fail2(e9);
20856
20782
  }
20857
20783
  }
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;
20784
+ if (env.hasError) throw env.error;
21152
20785
  }
21153
20786
  return next();
21154
20787
  };
@@ -21400,7 +21033,6 @@
21400
21033
  init_Debug();
21401
21034
  init_Errors();
21402
21035
  init_EventEmitter();
21403
- init_assert();
21404
21036
  var debugProtocolSend = debug("puppeteer:protocol:SEND \u25BA");
21405
21037
  var debugProtocolReceive = debug("puppeteer:protocol:RECV \u25C0");
21406
21038
  var Connection = class extends EventEmitter2 {
@@ -21462,7 +21094,9 @@
21462
21094
  * @internal
21463
21095
  */
21464
21096
  _rawSend(callbacks, method, params, sessionId, options) {
21465
- assert(!this.#closed, "Protocol error: Connection closed.");
21097
+ if (this.#closed) {
21098
+ return Promise.reject(new Error("Protocol error: Connection closed."));
21099
+ }
21466
21100
  return callbacks.create(method, options?.timeout ?? this.#timeout, (id) => {
21467
21101
  const stringifiedMessage = JSON.stringify({
21468
21102
  method,
@@ -22201,7 +21835,7 @@
22201
21835
  }, "#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
21836
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
22203
21837
  }
22204
- #client = (__runInitializers4(this, _instanceExtraInitializers), void 0);
21838
+ #client = __runInitializers4(this, _instanceExtraInitializers);
22205
21839
  #emulatingMobile = false;
22206
21840
  #hasTouch = false;
22207
21841
  #states = [];
@@ -22888,6 +22522,7 @@
22888
22522
  return await frame.isolatedRealm().adoptHandle(elementOrFrame);
22889
22523
  })(), false);
22890
22524
  const { visible = false, hidden = false, timeout: timeout2, signal } = options;
22525
+ const polling = options.polling ?? (visible || hidden ? "raf" : "mutation");
22891
22526
  try {
22892
22527
  const env_4 = { stack: [], error: void 0, hasError: false };
22893
22528
  try {
@@ -22897,7 +22532,7 @@
22897
22532
  const node = await querySelector(root ?? document, selector2, PuppeteerUtil);
22898
22533
  return PuppeteerUtil.checkVisibility(node, visible2);
22899
22534
  }, {
22900
- polling: visible || hidden ? "raf" : "mutation",
22535
+ polling,
22901
22536
  root: element,
22902
22537
  timeout: timeout2,
22903
22538
  signal
@@ -23002,6 +22637,18 @@
23002
22637
  };
23003
22638
  };
23004
22639
 
22640
+ // node_modules/puppeteer-core/lib/esm/puppeteer/common/CSSQueryHandler.js
22641
+ init_dirname();
22642
+ init_buffer2();
22643
+ var CSSQueryHandler = class extends QueryHandler {
22644
+ static querySelector = (element, selector, { cssQuerySelector }) => {
22645
+ return cssQuerySelector(element, selector);
22646
+ };
22647
+ static querySelectorAll = (element, selector, { cssQuerySelectorAll }) => {
22648
+ return cssQuerySelectorAll(element, selector);
22649
+ };
22650
+ };
22651
+
23005
22652
  // node_modules/puppeteer-core/lib/esm/puppeteer/common/CustomQueryHandler.js
23006
22653
  init_dirname();
23007
22654
  init_buffer2();
@@ -23014,7 +22661,7 @@
23014
22661
  // node_modules/puppeteer-core/lib/esm/puppeteer/generated/injected.js
23015
22662
  init_dirname();
23016
22663
  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';
22664
+ 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
22665
 
23019
22666
  // node_modules/puppeteer-core/lib/esm/puppeteer/common/ScriptInjector.js
23020
22667
  var ScriptInjector = class {
@@ -23116,50 +22763,327 @@
23116
22763
  if (!handler) {
23117
22764
  throw new Error(`Cannot unregister unknown handler: ${name2}`);
23118
22765
  }
23119
- scriptInjector.pop(handler[0]);
23120
- this.#handlers.delete(name2);
23121
- }
23122
- /**
23123
- * Gets the names of all {@link CustomQueryHandler | custom query handlers}.
23124
- */
23125
- names() {
23126
- return [...this.#handlers.keys()];
22766
+ scriptInjector.pop(handler[0]);
22767
+ this.#handlers.delete(name2);
22768
+ }
22769
+ /**
22770
+ * Gets the names of all {@link CustomQueryHandler | custom query handlers}.
22771
+ */
22772
+ names() {
22773
+ return [...this.#handlers.keys()];
22774
+ }
22775
+ /**
22776
+ * Unregisters all custom query handlers.
22777
+ */
22778
+ clear() {
22779
+ for (const [registerScript] of this.#handlers) {
22780
+ scriptInjector.pop(registerScript);
22781
+ }
22782
+ this.#handlers.clear();
22783
+ }
22784
+ };
22785
+ var customQueryHandlers = new CustomQueryHandlerRegistry();
22786
+
22787
+ // node_modules/puppeteer-core/lib/esm/puppeteer/common/PierceQueryHandler.js
22788
+ init_dirname();
22789
+ init_buffer2();
22790
+ var PierceQueryHandler = class extends QueryHandler {
22791
+ static querySelector = (element, selector, { pierceQuerySelector }) => {
22792
+ return pierceQuerySelector(element, selector);
22793
+ };
22794
+ static querySelectorAll = (element, selector, { pierceQuerySelectorAll }) => {
22795
+ return pierceQuerySelectorAll(element, selector);
22796
+ };
22797
+ };
22798
+
22799
+ // node_modules/puppeteer-core/lib/esm/puppeteer/common/PQueryHandler.js
22800
+ init_dirname();
22801
+ init_buffer2();
22802
+ var PQueryHandler = class extends QueryHandler {
22803
+ static querySelectorAll = (element, selector, { pQuerySelectorAll }) => {
22804
+ return pQuerySelectorAll(element, selector);
22805
+ };
22806
+ static querySelector = (element, selector, { pQuerySelector }) => {
22807
+ return pQuerySelector(element, selector);
22808
+ };
22809
+ };
22810
+
22811
+ // node_modules/puppeteer-core/lib/esm/puppeteer/common/PSelectorParser.js
22812
+ init_dirname();
22813
+ init_buffer2();
22814
+
22815
+ // node_modules/puppeteer-core/lib/esm/third_party/parsel-js/parsel-js.js
22816
+ init_dirname();
22817
+ init_buffer2();
22818
+ var TOKENS = {
22819
+ attribute: /\[\s*(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?(?<name>[-\w\P{ASCII}]+)\s*(?:(?<operator>\W?=)\s*(?<value>.+?)\s*(\s(?<caseSensitive>[iIsS]))?\s*)?\]/gu,
22820
+ id: /#(?<name>[-\w\P{ASCII}]+)/gu,
22821
+ class: /\.(?<name>[-\w\P{ASCII}]+)/gu,
22822
+ comma: /\s*,\s*/g,
22823
+ combinator: /\s*[\s>+~]\s*/g,
22824
+ "pseudo-element": /::(?<name>[-\w\P{ASCII}]+)(?:\((?<argument>¶*)\))?/gu,
22825
+ "pseudo-class": /:(?<name>[-\w\P{ASCII}]+)(?:\((?<argument>¶*)\))?/gu,
22826
+ universal: /(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?\*/gu,
22827
+ type: /(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?(?<name>[-\w\P{ASCII}]+)/gu
22828
+ // this must be last
22829
+ };
22830
+ var TRIM_TOKENS = /* @__PURE__ */ new Set(["combinator", "comma"]);
22831
+ var getArgumentPatternByType = (type) => {
22832
+ switch (type) {
22833
+ case "pseudo-element":
22834
+ case "pseudo-class":
22835
+ return new RegExp(TOKENS[type].source.replace("(?<argument>\xB6*)", "(?<argument>.*)"), "gu");
22836
+ default:
22837
+ return TOKENS[type];
22838
+ }
22839
+ };
22840
+ function gobbleParens(text, offset) {
22841
+ let nesting = 0;
22842
+ let result = "";
22843
+ for (; offset < text.length; offset++) {
22844
+ const char = text[offset];
22845
+ switch (char) {
22846
+ case "(":
22847
+ ++nesting;
22848
+ break;
22849
+ case ")":
22850
+ --nesting;
22851
+ break;
22852
+ }
22853
+ result += char;
22854
+ if (nesting === 0) {
22855
+ return result;
22856
+ }
22857
+ }
22858
+ return result;
22859
+ }
22860
+ function tokenizeBy(text, grammar = TOKENS) {
22861
+ if (!text) {
22862
+ return [];
22863
+ }
22864
+ const tokens = [text];
22865
+ for (const [type, pattern] of Object.entries(grammar)) {
22866
+ for (let i7 = 0; i7 < tokens.length; i7++) {
22867
+ const token = tokens[i7];
22868
+ if (typeof token !== "string") {
22869
+ continue;
22870
+ }
22871
+ pattern.lastIndex = 0;
22872
+ const match = pattern.exec(token);
22873
+ if (!match) {
22874
+ continue;
22875
+ }
22876
+ const from2 = match.index - 1;
22877
+ const args = [];
22878
+ const content = match[0];
22879
+ const before = token.slice(0, from2 + 1);
22880
+ if (before) {
22881
+ args.push(before);
22882
+ }
22883
+ args.push({
22884
+ ...match.groups,
22885
+ type,
22886
+ content
22887
+ });
22888
+ const after = token.slice(from2 + content.length + 1);
22889
+ if (after) {
22890
+ args.push(after);
22891
+ }
22892
+ tokens.splice(i7, 1, ...args);
22893
+ }
22894
+ }
22895
+ let offset = 0;
22896
+ for (const token of tokens) {
22897
+ switch (typeof token) {
22898
+ case "string":
22899
+ throw new Error(`Unexpected sequence ${token} found at index ${offset}`);
22900
+ case "object":
22901
+ offset += token.content.length;
22902
+ token.pos = [offset - token.content.length, offset];
22903
+ if (TRIM_TOKENS.has(token.type)) {
22904
+ token.content = token.content.trim() || " ";
22905
+ }
22906
+ break;
22907
+ }
22908
+ }
22909
+ return tokens;
22910
+ }
22911
+ var STRING_PATTERN = /(['"])([^\\\n]+?)\1/g;
22912
+ var ESCAPE_PATTERN = /\\./g;
22913
+ function tokenize(selector, grammar = TOKENS) {
22914
+ selector = selector.trim();
22915
+ if (selector === "") {
22916
+ return [];
22917
+ }
22918
+ const replacements = [];
22919
+ selector = selector.replace(ESCAPE_PATTERN, (value, offset) => {
22920
+ replacements.push({ value, offset });
22921
+ return "\uE000".repeat(value.length);
22922
+ });
22923
+ selector = selector.replace(STRING_PATTERN, (value, quote, content, offset) => {
22924
+ replacements.push({ value, offset });
22925
+ return `${quote}${"\uE001".repeat(content.length)}${quote}`;
22926
+ });
22927
+ {
22928
+ let pos = 0;
22929
+ let offset;
22930
+ while ((offset = selector.indexOf("(", pos)) > -1) {
22931
+ const value = gobbleParens(selector, offset);
22932
+ replacements.push({ value, offset });
22933
+ selector = `${selector.substring(0, offset)}(${"\xB6".repeat(value.length - 2)})${selector.substring(offset + value.length)}`;
22934
+ pos = offset + value.length;
22935
+ }
22936
+ }
22937
+ const tokens = tokenizeBy(selector, grammar);
22938
+ const changedTokens = /* @__PURE__ */ new Set();
22939
+ for (const replacement of replacements.reverse()) {
22940
+ for (const token of tokens) {
22941
+ const { offset, value } = replacement;
22942
+ if (!(token.pos[0] <= offset && offset + value.length <= token.pos[1])) {
22943
+ continue;
22944
+ }
22945
+ const { content } = token;
22946
+ const tokenOffset = offset - token.pos[0];
22947
+ token.content = content.slice(0, tokenOffset) + value + content.slice(tokenOffset + value.length);
22948
+ if (token.content !== content) {
22949
+ changedTokens.add(token);
22950
+ }
22951
+ }
23127
22952
  }
23128
- /**
23129
- * Unregisters all custom query handlers.
23130
- */
23131
- clear() {
23132
- for (const [registerScript] of this.#handlers) {
23133
- scriptInjector.pop(registerScript);
22953
+ for (const token of changedTokens) {
22954
+ const pattern = getArgumentPatternByType(token.type);
22955
+ if (!pattern) {
22956
+ throw new Error(`Unknown token type: ${token.type}`);
23134
22957
  }
23135
- this.#handlers.clear();
22958
+ pattern.lastIndex = 0;
22959
+ const match = pattern.exec(token.content);
22960
+ if (!match) {
22961
+ throw new Error(`Unable to parse content for ${token.type}: ${token.content}`);
22962
+ }
22963
+ Object.assign(token, match.groups);
23136
22964
  }
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
- };
22965
+ return tokens;
22966
+ }
22967
+ function* flatten(node, parent) {
22968
+ switch (node.type) {
22969
+ case "list":
22970
+ for (let child of node.list) {
22971
+ yield* flatten(child, node);
22972
+ }
22973
+ break;
22974
+ case "complex":
22975
+ yield* flatten(node.left, node);
22976
+ yield* flatten(node.right, node);
22977
+ break;
22978
+ case "compound":
22979
+ yield* node.list.map((token) => [token, node]);
22980
+ break;
22981
+ default:
22982
+ yield [node, parent];
22983
+ }
22984
+ }
22985
+ function stringify(listOrNode) {
22986
+ let tokens;
22987
+ if (Array.isArray(listOrNode)) {
22988
+ tokens = listOrNode;
22989
+ } else {
22990
+ tokens = [...flatten(listOrNode)].map(([token]) => token);
22991
+ }
22992
+ return tokens.map((token) => token.content).join("");
22993
+ }
23151
22994
 
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
- };
22995
+ // node_modules/puppeteer-core/lib/esm/puppeteer/common/PSelectorParser.js
22996
+ TOKENS["nesting"] = /&/g;
22997
+ TOKENS["combinator"] = /\s*(>>>>?|[\s>+~])\s*/g;
22998
+ var ESCAPE_REGEXP = /\\[\s\S]/g;
22999
+ var unquote = (text) => {
23000
+ if (text.length <= 1) {
23001
+ return text;
23002
+ }
23003
+ if ((text[0] === '"' || text[0] === "'") && text.endsWith(text[0])) {
23004
+ text = text.slice(1, -1);
23005
+ }
23006
+ return text.replace(ESCAPE_REGEXP, (match) => {
23007
+ return match[1];
23008
+ });
23162
23009
  };
23010
+ function parsePSelectors(selector) {
23011
+ let isPureCSS = true;
23012
+ let hasPseudoClasses = false;
23013
+ const tokens = tokenize(selector);
23014
+ if (tokens.length === 0) {
23015
+ return [[], isPureCSS, hasPseudoClasses];
23016
+ }
23017
+ let compoundSelector = [];
23018
+ let complexSelector = [compoundSelector];
23019
+ const selectors = [complexSelector];
23020
+ const storage = [];
23021
+ for (const token of tokens) {
23022
+ switch (token.type) {
23023
+ case "combinator":
23024
+ switch (token.content) {
23025
+ case ">>>":
23026
+ isPureCSS = false;
23027
+ if (storage.length) {
23028
+ compoundSelector.push(stringify(storage));
23029
+ storage.splice(0);
23030
+ }
23031
+ compoundSelector = [];
23032
+ complexSelector.push(
23033
+ ">>>"
23034
+ /* PCombinator.Descendent */
23035
+ );
23036
+ complexSelector.push(compoundSelector);
23037
+ continue;
23038
+ case ">>>>":
23039
+ isPureCSS = false;
23040
+ if (storage.length) {
23041
+ compoundSelector.push(stringify(storage));
23042
+ storage.splice(0);
23043
+ }
23044
+ compoundSelector = [];
23045
+ complexSelector.push(
23046
+ ">>>>"
23047
+ /* PCombinator.Child */
23048
+ );
23049
+ complexSelector.push(compoundSelector);
23050
+ continue;
23051
+ }
23052
+ break;
23053
+ case "pseudo-element":
23054
+ if (!token.name.startsWith("-p-")) {
23055
+ break;
23056
+ }
23057
+ isPureCSS = false;
23058
+ if (storage.length) {
23059
+ compoundSelector.push(stringify(storage));
23060
+ storage.splice(0);
23061
+ }
23062
+ compoundSelector.push({
23063
+ name: token.name.slice(3),
23064
+ value: unquote(token.argument ?? "")
23065
+ });
23066
+ continue;
23067
+ case "pseudo-class":
23068
+ hasPseudoClasses = true;
23069
+ break;
23070
+ case "comma":
23071
+ if (storage.length) {
23072
+ compoundSelector.push(stringify(storage));
23073
+ storage.splice(0);
23074
+ }
23075
+ compoundSelector = [];
23076
+ complexSelector = [compoundSelector];
23077
+ selectors.push(complexSelector);
23078
+ continue;
23079
+ }
23080
+ storage.push(token);
23081
+ }
23082
+ if (storage.length) {
23083
+ compoundSelector.push(stringify(storage));
23084
+ }
23085
+ return [selectors, isPureCSS, hasPseudoClasses];
23086
+ }
23163
23087
 
23164
23088
  // node_modules/puppeteer-core/lib/esm/puppeteer/common/TextQueryHandler.js
23165
23089
  init_dirname();
@@ -23205,12 +23129,36 @@
23205
23129
  const prefix = `${name2}${separator}`;
23206
23130
  if (selector.startsWith(prefix)) {
23207
23131
  selector = selector.slice(prefix.length);
23208
- return { updatedSelector: selector, QueryHandler: QueryHandler2 };
23132
+ return {
23133
+ updatedSelector: selector,
23134
+ selectorHasPseudoClasses: false,
23135
+ QueryHandler: QueryHandler2
23136
+ };
23209
23137
  }
23210
23138
  }
23211
23139
  }
23212
23140
  }
23213
- return { updatedSelector: selector, QueryHandler: PQueryHandler };
23141
+ try {
23142
+ const [pSelector, isPureCSS, hasPseudoClasses] = parsePSelectors(selector);
23143
+ if (isPureCSS) {
23144
+ return {
23145
+ updatedSelector: selector,
23146
+ selectorHasPseudoClasses: hasPseudoClasses,
23147
+ QueryHandler: CSSQueryHandler
23148
+ };
23149
+ }
23150
+ return {
23151
+ updatedSelector: JSON.stringify(pSelector),
23152
+ selectorHasPseudoClasses: hasPseudoClasses,
23153
+ QueryHandler: PQueryHandler
23154
+ };
23155
+ } catch {
23156
+ return {
23157
+ updatedSelector: selector,
23158
+ selectorHasPseudoClasses: false,
23159
+ QueryHandler: CSSQueryHandler
23160
+ };
23161
+ }
23214
23162
  }
23215
23163
 
23216
23164
  // node_modules/puppeteer-core/lib/esm/puppeteer/api/Frame.js
@@ -23385,7 +23333,7 @@
23385
23333
  /**
23386
23334
  * @internal
23387
23335
  */
23388
- _id = (__runInitializers5(this, _instanceExtraInitializers), void 0);
23336
+ _id = __runInitializers5(this, _instanceExtraInitializers);
23389
23337
  /**
23390
23338
  * @internal
23391
23339
  */
@@ -23410,10 +23358,8 @@
23410
23358
  */
23411
23359
  #document() {
23412
23360
  if (!this.#_document) {
23413
- this.#_document = this.isolatedRealm().evaluateHandle(() => {
23361
+ this.#_document = this.mainRealm().evaluateHandle(() => {
23414
23362
  return document;
23415
- }).then((handle) => {
23416
- return this.mainRealm().transferHandle(handle);
23417
23363
  });
23418
23364
  }
23419
23365
  return this.#_document;
@@ -23495,7 +23441,22 @@
23495
23441
  /**
23496
23442
  * Queries the frame for an element matching the given selector.
23497
23443
  *
23498
- * @param selector - The selector to query for.
23444
+ * @param selector -
23445
+ * {@link https://pptr.dev/guides/page-interactions#query-selectors | selector}
23446
+ * to query page for.
23447
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
23448
+ * can be passed as-is and a
23449
+ * {@link https://pptr.dev/guides/page-interactions#p-selectors | Puppeteer-specific seletor syntax}
23450
+ * allows quering by
23451
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
23452
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
23453
+ * and
23454
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
23455
+ * and
23456
+ * {@link https://pptr.dev/guides/page-interactions#-and--combinators | combining these queries across shadow roots}.
23457
+ * Alternatively, you can specify a selector type using a prefix
23458
+ * {@link https://pptr.dev/guides/page-interactions#built-in-selectors | prefix}.
23459
+ *
23499
23460
  * @returns A {@link ElementHandle | element handle} to the first element
23500
23461
  * matching the given selector. Otherwise, `null`.
23501
23462
  */
@@ -23506,13 +23467,28 @@
23506
23467
  /**
23507
23468
  * Queries the frame for all elements matching the given selector.
23508
23469
  *
23509
- * @param selector - The selector to query for.
23470
+ * @param selector -
23471
+ * {@link https://pptr.dev/guides/page-interactions#query-selectors | selector}
23472
+ * to query page for.
23473
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
23474
+ * can be passed as-is and a
23475
+ * {@link https://pptr.dev/guides/page-interactions#p-selectors | Puppeteer-specific seletor syntax}
23476
+ * allows quering by
23477
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
23478
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
23479
+ * and
23480
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
23481
+ * and
23482
+ * {@link https://pptr.dev/guides/page-interactions#-and--combinators | combining these queries across shadow roots}.
23483
+ * Alternatively, you can specify a selector type using a prefix
23484
+ * {@link https://pptr.dev/guides/page-interactions#built-in-selectors | prefix}.
23485
+ *
23510
23486
  * @returns An array of {@link ElementHandle | element handles} that point to
23511
23487
  * elements matching the given selector.
23512
23488
  */
23513
- async $$(selector) {
23489
+ async $$(selector, options) {
23514
23490
  const document2 = await this.#document();
23515
- return await document2.$$(selector);
23491
+ return await document2.$$(selector, options);
23516
23492
  }
23517
23493
  /**
23518
23494
  * Runs the given function on the first element matching the given selector in
@@ -23527,7 +23503,21 @@
23527
23503
  * const searchValue = await frame.$eval('#search', el => el.value);
23528
23504
  * ```
23529
23505
  *
23530
- * @param selector - The selector to query for.
23506
+ * @param selector -
23507
+ * {@link https://pptr.dev/guides/page-interactions#query-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#p-selectors | Puppeteer-specific seletor 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#-and--combinators | combining these queries across shadow roots}.
23519
+ * Alternatively, you can specify a selector type using a prefix
23520
+ * {@link https://pptr.dev/guides/page-interactions#built-in-selectors | prefix}.
23531
23521
  * @param pageFunction - The function to be evaluated in the frame's context.
23532
23522
  * The first element matching the selector will be passed to the function as
23533
23523
  * its first argument.
@@ -23552,7 +23542,21 @@
23552
23542
  * const divsCounts = await frame.$$eval('div', divs => divs.length);
23553
23543
  * ```
23554
23544
  *
23555
- * @param selector - The selector to query for.
23545
+ * @param selector -
23546
+ * {@link https://pptr.dev/guides/page-interactions#query-selectors | selector}
23547
+ * to query page for.
23548
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | CSS selectors}
23549
+ * can be passed as-is and a
23550
+ * {@link https://pptr.dev/guides/page-interactions#p-selectors | Puppeteer-specific seletor syntax}
23551
+ * allows quering by
23552
+ * {@link https://pptr.dev/guides/page-interactions#text-selectors--p-text | text},
23553
+ * {@link https://pptr.dev/guides/page-interactions#aria-selectors--p-aria | a11y role and name},
23554
+ * and
23555
+ * {@link https://pptr.dev/guides/page-interactions#xpath-selectors--p-xpath | xpath}
23556
+ * and
23557
+ * {@link https://pptr.dev/guides/page-interactions#-and--combinators | combining these queries across shadow roots}.
23558
+ * Alternatively, you can specify a selector type using a prefix
23559
+ * {@link https://pptr.dev/guides/page-interactions#built-in-selectors | prefix}.
23556
23560
  * @param pageFunction - The function to be evaluated in the frame's context.
23557
23561
  * An array of elements matching the given selector will be passed to the
23558
23562
  * function as its first argument.
@@ -23600,8 +23604,11 @@
23600
23604
  * @throws Throws if an element matching the given selector doesn't appear.
23601
23605
  */
23602
23606
  async waitForSelector(selector, options = {}) {
23603
- const { updatedSelector, QueryHandler: QueryHandler2 } = getQueryHandlerAndSelector(selector);
23604
- return await QueryHandler2.waitFor(this, updatedSelector, options);
23607
+ const { updatedSelector, QueryHandler: QueryHandler2, selectorHasPseudoClasses } = getQueryHandlerAndSelector(selector);
23608
+ return await QueryHandler2.waitFor(this, updatedSelector, {
23609
+ polling: selectorHasPseudoClasses ? "raf" : void 0,
23610
+ ...options
23611
+ });
23605
23612
  }
23606
23613
  /**
23607
23614
  * @example
@@ -24232,6 +24239,10 @@
24232
24239
  var e9 = new Error(message);
24233
24240
  return e9.name = "SuppressedError", e9.error = error, e9.suppressed = suppressed, e9;
24234
24241
  });
24242
+ var __setFunctionName3 = function(f7, name2, prefix) {
24243
+ if (typeof name2 === "symbol") name2 = name2.description ? "[".concat(name2.description, "]") : "";
24244
+ return Object.defineProperty(f7, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name2) : name2 });
24245
+ };
24235
24246
  var ElementHandle = (() => {
24236
24247
  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
24248
  let _classSuper = JSHandle;
@@ -24241,6 +24252,8 @@
24241
24252
  let _jsonValue_decorators;
24242
24253
  let _$_decorators;
24243
24254
  let _$$_decorators;
24255
+ let _private_$$_decorators;
24256
+ let _private_$$_descriptor;
24244
24257
  let _waitForSelector_decorators;
24245
24258
  let _isVisible_decorators;
24246
24259
  let _isHidden_decorators;
@@ -24273,7 +24286,8 @@
24273
24286
  _getProperties_decorators = [throwIfDisposed(), (_b = ElementHandle2).bindIsolatedHandle.bind(_b)];
24274
24287
  _jsonValue_decorators = [throwIfDisposed(), (_c = ElementHandle2).bindIsolatedHandle.bind(_c)];
24275
24288
  _$_decorators = [throwIfDisposed(), (_d = ElementHandle2).bindIsolatedHandle.bind(_d)];
24276
- _$$_decorators = [throwIfDisposed(), (_e = ElementHandle2).bindIsolatedHandle.bind(_e)];
24289
+ _$$_decorators = [throwIfDisposed()];
24290
+ _private_$$_decorators = [(_e = ElementHandle2).bindIsolatedHandle.bind(_e)];
24277
24291
  _waitForSelector_decorators = [throwIfDisposed(), (_f = ElementHandle2).bindIsolatedHandle.bind(_f)];
24278
24292
  _isVisible_decorators = [throwIfDisposed(), (_g = ElementHandle2).bindIsolatedHandle.bind(_g)];
24279
24293
  _isHidden_decorators = [throwIfDisposed(), (_h = ElementHandle2).bindIsolatedHandle.bind(_h)];
@@ -24304,6 +24318,9 @@
24304
24318
  __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
24319
  __esDecorate6(this, null, _$_decorators, { kind: "method", name: "$", static: false, private: false, access: { has: (obj) => "$" in obj, get: (obj) => obj.$ }, metadata: _metadata }, null, _instanceExtraInitializers);
24306
24320
  __esDecorate6(this, null, _$$_decorators, { kind: "method", name: "$$", static: false, private: false, access: { has: (obj) => "$$" in obj, get: (obj) => obj.$$ }, metadata: _metadata }, null, _instanceExtraInitializers);
24321
+ __esDecorate6(this, _private_$$_descriptor = { value: __setFunctionName3(async function(selector) {
24322
+ return await this.#$$impl(selector);
24323
+ }, "#$$") }, _private_$$_decorators, { kind: "method", name: "#$$", static: false, private: true, access: { has: (obj) => #$$ in obj, get: (obj) => obj.#$$ }, metadata: _metadata }, null, _instanceExtraInitializers);
24307
24324
  __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
24325
  __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
24326
  __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 +24353,7 @@
24336
24353
  * Cached isolatedHandle to prevent
24337
24354
  * trying to adopt it multiple times
24338
24355
  */
24339
- isolatedHandle = (__runInitializers6(this, _instanceExtraInitializers), void 0);
24356
+ isolatedHandle = __runInitializers6(this, _instanceExtraInitializers);
24340
24357
  /**
24341
24358
  * A given method will have it's `this` replaced with an isolated version of
24342
24359
  * `this` when decorated with this decorator.
@@ -24478,7 +24495,26 @@
24478
24495
  * @returns An array of {@link ElementHandle | element handles} that point to
24479
24496
  * elements matching the given selector.
24480
24497
  */
24481
- async $$(selector) {
24498
+ async $$(selector, options) {
24499
+ if (options?.isolate === false) {
24500
+ return await this.#$$impl(selector);
24501
+ }
24502
+ return await this.#$$(selector);
24503
+ }
24504
+ /**
24505
+ * Isolates {@link ElementHandle.$$} if needed.
24506
+ *
24507
+ * @internal
24508
+ */
24509
+ get #$$() {
24510
+ return _private_$$_descriptor.value;
24511
+ }
24512
+ /**
24513
+ * Implementation for {@link ElementHandle.$$}.
24514
+ *
24515
+ * @internal
24516
+ */
24517
+ async #$$impl(selector) {
24482
24518
  const { updatedSelector, QueryHandler: QueryHandler2 } = getQueryHandlerAndSelector(selector);
24483
24519
  return await AsyncIterableUtil.collect(QueryHandler2.queryAll(this, updatedSelector));
24484
24520
  }
@@ -24617,8 +24653,11 @@
24617
24653
  * @throws Throws if an element matching the given selector doesn't appear.
24618
24654
  */
24619
24655
  async waitForSelector(selector, options = {}) {
24620
- const { updatedSelector, QueryHandler: QueryHandler2 } = getQueryHandlerAndSelector(selector);
24621
- return await QueryHandler2.waitFor(this, updatedSelector, options);
24656
+ const { updatedSelector, QueryHandler: QueryHandler2, selectorHasPseudoClasses } = getQueryHandlerAndSelector(selector);
24657
+ return await QueryHandler2.waitFor(this, updatedSelector, {
24658
+ polling: selectorHasPseudoClasses ? "raf" : void 0,
24659
+ ...options
24660
+ });
24622
24661
  }
24623
24662
  async #checkVisibility(visibility) {
24624
24663
  return await this.evaluate(async (element, PuppeteerUtil, visibility2) => {
@@ -25505,6 +25544,20 @@
25505
25544
  remoteObject() {
25506
25545
  return this.#remoteObject;
25507
25546
  }
25547
+ async getProperties() {
25548
+ const response = await this.client.send("Runtime.getProperties", {
25549
+ objectId: this.#remoteObject.objectId,
25550
+ ownProperties: true
25551
+ });
25552
+ const result = /* @__PURE__ */ new Map();
25553
+ for (const property of response.result) {
25554
+ if (!property.enumerable || !property.value) {
25555
+ continue;
25556
+ }
25557
+ result.set(property.name, this.#world.createCdpHandle(property.value));
25558
+ }
25559
+ return result;
25560
+ }
25508
25561
  };
25509
25562
  async function releaseObject(client, remoteObject) {
25510
25563
  if (!remoteObject.objectId) {
@@ -25815,6 +25868,9 @@
25815
25868
  }
25816
25869
  }
25817
25870
  async #onBindingCalled(event) {
25871
+ if (event.executionContextId !== this.#id) {
25872
+ return;
25873
+ }
25818
25874
  let payload;
25819
25875
  try {
25820
25876
  payload = JSON.parse(event.payload);
@@ -25831,9 +25887,6 @@
25831
25887
  return;
25832
25888
  }
25833
25889
  try {
25834
- if (event.executionContextId !== this.#id) {
25835
- return;
25836
- }
25837
25890
  const binding = this.#bindings.get(name2);
25838
25891
  await binding?.run(this, seq, args, isTrivial);
25839
25892
  } catch (err) {
@@ -25919,171 +25972,543 @@
25919
25972
  * a vanilla object containing the serializable properties of the result is
25920
25973
  * returned.
25921
25974
  */
25922
- async evaluate(pageFunction, ...args) {
25923
- return await this.#evaluate(true, pageFunction, ...args);
25975
+ async evaluate(pageFunction, ...args) {
25976
+ return await this.#evaluate(true, pageFunction, ...args);
25977
+ }
25978
+ /**
25979
+ * Evaluates the given function.
25980
+ *
25981
+ * Unlike {@link ExecutionContext.evaluate | evaluate}, this method returns a
25982
+ * handle to the result of the function.
25983
+ *
25984
+ * This method may be better suited if the object cannot be serialized (e.g.
25985
+ * `Map`) and requires further manipulation.
25986
+ *
25987
+ * @example
25988
+ *
25989
+ * ```ts
25990
+ * const context = await page.mainFrame().executionContext();
25991
+ * const handle: JSHandle<typeof globalThis> = await context.evaluateHandle(
25992
+ * () => Promise.resolve(self)
25993
+ * );
25994
+ * ```
25995
+ *
25996
+ * @example
25997
+ * A string can also be passed in instead of a function.
25998
+ *
25999
+ * ```ts
26000
+ * const handle: JSHandle<number> = await context.evaluateHandle('1 + 2');
26001
+ * ```
26002
+ *
26003
+ * @example
26004
+ * Handles can also be passed as `args`. They resolve to their referenced object:
26005
+ *
26006
+ * ```ts
26007
+ * const bodyHandle: ElementHandle<HTMLBodyElement> =
26008
+ * await context.evaluateHandle(() => {
26009
+ * return document.body;
26010
+ * });
26011
+ * const stringHandle: JSHandle<string> = await context.evaluateHandle(
26012
+ * body => body.innerHTML,
26013
+ * body
26014
+ * );
26015
+ * console.log(await stringHandle.jsonValue()); // prints body's innerHTML
26016
+ * // Always dispose your garbage! :)
26017
+ * await bodyHandle.dispose();
26018
+ * await stringHandle.dispose();
26019
+ * ```
26020
+ *
26021
+ * @param pageFunction - The function to evaluate.
26022
+ * @param args - Additional arguments to pass into the function.
26023
+ * @returns A {@link JSHandle | handle} to the result of evaluating the
26024
+ * function. If the result is a `Node`, then this will return an
26025
+ * {@link ElementHandle | element handle}.
26026
+ */
26027
+ async evaluateHandle(pageFunction, ...args) {
26028
+ return await this.#evaluate(false, pageFunction, ...args);
26029
+ }
26030
+ async #evaluate(returnByValue, pageFunction, ...args) {
26031
+ const sourceUrlComment = getSourceUrlComment(getSourcePuppeteerURLIfAvailable(pageFunction)?.toString() ?? PuppeteerURL.INTERNAL_URL);
26032
+ if (isString3(pageFunction)) {
26033
+ const contextId = this.#id;
26034
+ const expression = pageFunction;
26035
+ const expressionWithSourceUrl = SOURCE_URL_REGEX.test(expression) ? expression : `${expression}
26036
+ ${sourceUrlComment}
26037
+ `;
26038
+ const { exceptionDetails: exceptionDetails2, result: remoteObject2 } = await this.#client.send("Runtime.evaluate", {
26039
+ expression: expressionWithSourceUrl,
26040
+ contextId,
26041
+ returnByValue,
26042
+ awaitPromise: true,
26043
+ userGesture: true
26044
+ }).catch(rewriteError2);
26045
+ if (exceptionDetails2) {
26046
+ throw createEvaluationError(exceptionDetails2);
26047
+ }
26048
+ return returnByValue ? valueFromRemoteObject(remoteObject2) : this.#world.createCdpHandle(remoteObject2);
26049
+ }
26050
+ const functionDeclaration = stringifyFunction(pageFunction);
26051
+ const functionDeclarationWithSourceUrl = SOURCE_URL_REGEX.test(functionDeclaration) ? functionDeclaration : `${functionDeclaration}
26052
+ ${sourceUrlComment}
26053
+ `;
26054
+ let callFunctionOnPromise;
26055
+ try {
26056
+ callFunctionOnPromise = this.#client.send("Runtime.callFunctionOn", {
26057
+ functionDeclaration: functionDeclarationWithSourceUrl,
26058
+ executionContextId: this.#id,
26059
+ arguments: args.length ? await Promise.all(args.map(convertArgument.bind(this))) : [],
26060
+ returnByValue,
26061
+ awaitPromise: true,
26062
+ userGesture: true
26063
+ });
26064
+ } catch (error) {
26065
+ if (error instanceof TypeError && error.message.startsWith("Converting circular structure to JSON")) {
26066
+ error.message += " Recursive objects are not allowed.";
26067
+ }
26068
+ throw error;
26069
+ }
26070
+ const { exceptionDetails, result: remoteObject } = await callFunctionOnPromise.catch(rewriteError2);
26071
+ if (exceptionDetails) {
26072
+ throw createEvaluationError(exceptionDetails);
26073
+ }
26074
+ return returnByValue ? valueFromRemoteObject(remoteObject) : this.#world.createCdpHandle(remoteObject);
26075
+ async function convertArgument(arg) {
26076
+ if (arg instanceof LazyArg) {
26077
+ arg = await arg.get(this);
26078
+ }
26079
+ if (typeof arg === "bigint") {
26080
+ return { unserializableValue: `${arg.toString()}n` };
26081
+ }
26082
+ if (Object.is(arg, -0)) {
26083
+ return { unserializableValue: "-0" };
26084
+ }
26085
+ if (Object.is(arg, Infinity)) {
26086
+ return { unserializableValue: "Infinity" };
26087
+ }
26088
+ if (Object.is(arg, -Infinity)) {
26089
+ return { unserializableValue: "-Infinity" };
26090
+ }
26091
+ if (Object.is(arg, NaN)) {
26092
+ return { unserializableValue: "NaN" };
26093
+ }
26094
+ const objectHandle = arg && (arg instanceof CdpJSHandle || arg instanceof CdpElementHandle) ? arg : null;
26095
+ if (objectHandle) {
26096
+ if (objectHandle.realm !== this.#world) {
26097
+ throw new Error("JSHandles can be evaluated only in the context they were created!");
26098
+ }
26099
+ if (objectHandle.disposed) {
26100
+ throw new Error("JSHandle is disposed!");
26101
+ }
26102
+ if (objectHandle.remoteObject().unserializableValue) {
26103
+ return {
26104
+ unserializableValue: objectHandle.remoteObject().unserializableValue
26105
+ };
26106
+ }
26107
+ if (!objectHandle.remoteObject().objectId) {
26108
+ return { value: objectHandle.remoteObject().value };
26109
+ }
26110
+ return { objectId: objectHandle.remoteObject().objectId };
26111
+ }
26112
+ return { value: arg };
26113
+ }
26114
+ }
26115
+ [disposeSymbol]() {
26116
+ this.#disposables.dispose();
26117
+ this.emit("disposed", void 0);
26118
+ }
26119
+ };
26120
+ var rewriteError2 = (error) => {
26121
+ if (error.message.includes("Object reference chain is too long")) {
26122
+ return { result: { type: "undefined" } };
26123
+ }
26124
+ if (error.message.includes("Object couldn't be returned by value")) {
26125
+ return { result: { type: "undefined" } };
26126
+ }
26127
+ if (error.message.endsWith("Cannot find context with specified id") || error.message.endsWith("Inspected target navigated or closed")) {
26128
+ throw new Error("Execution context was destroyed, most likely because of a navigation.");
26129
+ }
26130
+ throw error;
26131
+ };
26132
+
26133
+ // node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Frame.js
26134
+ init_dirname();
26135
+ init_buffer2();
26136
+ init_Errors();
26137
+ init_Deferred();
26138
+ init_disposable();
26139
+
26140
+ // node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Accessibility.js
26141
+ init_dirname();
26142
+ init_buffer2();
26143
+ var Accessibility = class {
26144
+ #realm;
26145
+ /**
26146
+ * @internal
26147
+ */
26148
+ constructor(realm) {
26149
+ this.#realm = realm;
25924
26150
  }
25925
26151
  /**
25926
- * Evaluates the given function.
26152
+ * Captures the current state of the accessibility tree.
26153
+ * The returned object represents the root accessible node of the page.
25927
26154
  *
25928
- * Unlike {@link ExecutionContext.evaluate | evaluate}, this method returns a
25929
- * handle to the result of the function.
26155
+ * @remarks
25930
26156
  *
25931
- * This method may be better suited if the object cannot be serialized (e.g.
25932
- * `Map`) and requires further manipulation.
26157
+ * **NOTE** The Chrome accessibility tree contains nodes that go unused on
26158
+ * most platforms and by most screen readers. Puppeteer will discard them as
26159
+ * well for an easier to process tree, unless `interestingOnly` is set to
26160
+ * `false`.
25933
26161
  *
25934
26162
  * @example
26163
+ * An example of dumping the entire accessibility tree:
25935
26164
  *
25936
26165
  * ```ts
25937
- * const context = await page.mainFrame().executionContext();
25938
- * const handle: JSHandle<typeof globalThis> = await context.evaluateHandle(
25939
- * () => Promise.resolve(self)
25940
- * );
26166
+ * const snapshot = await page.accessibility.snapshot();
26167
+ * console.log(snapshot);
25941
26168
  * ```
25942
26169
  *
25943
26170
  * @example
25944
- * A string can also be passed in instead of a function.
26171
+ * An example of logging the focused node's name:
25945
26172
  *
25946
26173
  * ```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:
26174
+ * const snapshot = await page.accessibility.snapshot();
26175
+ * const node = findFocusedNode(snapshot);
26176
+ * console.log(node && node.name);
25952
26177
  *
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();
26178
+ * function findFocusedNode(node) {
26179
+ * if (node.focused) return node;
26180
+ * for (const child of node.children || []) {
26181
+ * const foundNode = findFocusedNode(child);
26182
+ * return foundNode;
26183
+ * }
26184
+ * return null;
26185
+ * }
25966
26186
  * ```
25967
26187
  *
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}.
26188
+ * @returns An AXNode object representing the snapshot.
25973
26189
  */
25974
- async evaluateHandle(pageFunction, ...args) {
25975
- return await this.#evaluate(false, pageFunction, ...args);
26190
+ async snapshot(options = {}) {
26191
+ const { interestingOnly = true, root = null } = options;
26192
+ const { nodes } = await this.#realm.environment.client.send("Accessibility.getFullAXTree");
26193
+ let backendNodeId;
26194
+ if (root) {
26195
+ const { node } = await this.#realm.environment.client.send("DOM.describeNode", {
26196
+ objectId: root.id
26197
+ });
26198
+ backendNodeId = node.backendNodeId;
26199
+ }
26200
+ const defaultRoot = AXNode.createTree(this.#realm, nodes);
26201
+ let needle = defaultRoot;
26202
+ if (backendNodeId) {
26203
+ needle = defaultRoot.find((node) => {
26204
+ return node.payload.backendDOMNodeId === backendNodeId;
26205
+ });
26206
+ if (!needle) {
26207
+ return null;
26208
+ }
26209
+ }
26210
+ if (!interestingOnly) {
26211
+ return this.serializeTree(needle)[0] ?? null;
26212
+ }
26213
+ const interestingNodes = /* @__PURE__ */ new Set();
26214
+ this.collectInterestingNodes(interestingNodes, defaultRoot, false);
26215
+ if (!interestingNodes.has(needle)) {
26216
+ return null;
26217
+ }
26218
+ return this.serializeTree(needle, interestingNodes)[0] ?? null;
26219
+ }
26220
+ serializeTree(node, interestingNodes) {
26221
+ const children = [];
26222
+ for (const child of node.children) {
26223
+ children.push(...this.serializeTree(child, interestingNodes));
26224
+ }
26225
+ if (interestingNodes && !interestingNodes.has(node)) {
26226
+ return children;
26227
+ }
26228
+ const serializedNode = node.serialize();
26229
+ if (children.length) {
26230
+ serializedNode.children = children;
26231
+ }
26232
+ return [serializedNode];
26233
+ }
26234
+ collectInterestingNodes(collection, node, insideControl) {
26235
+ if (node.isInteresting(insideControl)) {
26236
+ collection.add(node);
26237
+ }
26238
+ if (node.isLeafNode()) {
26239
+ return;
26240
+ }
26241
+ insideControl = insideControl || node.isControl();
26242
+ for (const child of node.children) {
26243
+ this.collectInterestingNodes(collection, child, insideControl);
26244
+ }
26245
+ }
26246
+ };
26247
+ var AXNode = class _AXNode {
26248
+ payload;
26249
+ children = [];
26250
+ #richlyEditable = false;
26251
+ #editable = false;
26252
+ #focusable = false;
26253
+ #hidden = false;
26254
+ #name;
26255
+ #role;
26256
+ #ignored;
26257
+ #cachedHasFocusableChild;
26258
+ #realm;
26259
+ constructor(realm, payload) {
26260
+ this.payload = payload;
26261
+ this.#name = this.payload.name ? this.payload.name.value : "";
26262
+ this.#role = this.payload.role ? this.payload.role.value : "Unknown";
26263
+ this.#ignored = this.payload.ignored;
26264
+ this.#realm = realm;
26265
+ for (const property of this.payload.properties || []) {
26266
+ if (property.name === "editable") {
26267
+ this.#richlyEditable = property.value.value === "richtext";
26268
+ this.#editable = true;
26269
+ }
26270
+ if (property.name === "focusable") {
26271
+ this.#focusable = property.value.value;
26272
+ }
26273
+ if (property.name === "hidden") {
26274
+ this.#hidden = property.value.value;
26275
+ }
26276
+ }
26277
+ }
26278
+ #isPlainTextField() {
26279
+ if (this.#richlyEditable) {
26280
+ return false;
26281
+ }
26282
+ if (this.#editable) {
26283
+ return true;
26284
+ }
26285
+ return this.#role === "textbox" || this.#role === "searchbox";
26286
+ }
26287
+ #isTextOnlyObject() {
26288
+ const role = this.#role;
26289
+ return role === "LineBreak" || role === "text" || role === "InlineTextBox" || role === "StaticText";
26290
+ }
26291
+ #hasFocusableChild() {
26292
+ if (this.#cachedHasFocusableChild === void 0) {
26293
+ this.#cachedHasFocusableChild = false;
26294
+ for (const child of this.children) {
26295
+ if (child.#focusable || child.#hasFocusableChild()) {
26296
+ this.#cachedHasFocusableChild = true;
26297
+ break;
26298
+ }
26299
+ }
26300
+ }
26301
+ return this.#cachedHasFocusableChild;
26302
+ }
26303
+ find(predicate) {
26304
+ if (predicate(this)) {
26305
+ return this;
26306
+ }
26307
+ for (const child of this.children) {
26308
+ const result = child.find(predicate);
26309
+ if (result) {
26310
+ return result;
26311
+ }
26312
+ }
26313
+ return null;
26314
+ }
26315
+ isLeafNode() {
26316
+ if (!this.children.length) {
26317
+ return true;
26318
+ }
26319
+ if (this.#isPlainTextField() || this.#isTextOnlyObject()) {
26320
+ return true;
26321
+ }
26322
+ switch (this.#role) {
26323
+ case "doc-cover":
26324
+ case "graphics-symbol":
26325
+ case "img":
26326
+ case "image":
26327
+ case "Meter":
26328
+ case "scrollbar":
26329
+ case "slider":
26330
+ case "separator":
26331
+ case "progressbar":
26332
+ return true;
26333
+ default:
26334
+ break;
26335
+ }
26336
+ if (this.#hasFocusableChild()) {
26337
+ return false;
26338
+ }
26339
+ if (this.#focusable && this.#name) {
26340
+ return true;
26341
+ }
26342
+ if (this.#role === "heading" && this.#name) {
26343
+ return true;
26344
+ }
26345
+ return false;
26346
+ }
26347
+ isControl() {
26348
+ switch (this.#role) {
26349
+ case "button":
26350
+ case "checkbox":
26351
+ case "ColorWell":
26352
+ case "combobox":
26353
+ case "DisclosureTriangle":
26354
+ case "listbox":
26355
+ case "menu":
26356
+ case "menubar":
26357
+ case "menuitem":
26358
+ case "menuitemcheckbox":
26359
+ case "menuitemradio":
26360
+ case "radio":
26361
+ case "scrollbar":
26362
+ case "searchbox":
26363
+ case "slider":
26364
+ case "spinbutton":
26365
+ case "switch":
26366
+ case "tab":
26367
+ case "textbox":
26368
+ case "tree":
26369
+ case "treeitem":
26370
+ return true;
26371
+ default:
26372
+ return false;
26373
+ }
25976
26374
  }
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);
26375
+ isInteresting(insideControl) {
26376
+ const role = this.#role;
26377
+ if (role === "Ignored" || this.#hidden || this.#ignored) {
26378
+ return false;
25996
26379
  }
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;
26380
+ if (this.#focusable || this.#richlyEditable) {
26381
+ return true;
26016
26382
  }
26017
- const { exceptionDetails, result: remoteObject } = await callFunctionOnPromise.catch(rewriteError2);
26018
- if (exceptionDetails) {
26019
- throw createEvaluationError(exceptionDetails);
26383
+ if (this.isControl()) {
26384
+ return true;
26020
26385
  }
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);
26386
+ if (insideControl) {
26387
+ return false;
26388
+ }
26389
+ return this.isLeafNode() && !!this.#name;
26390
+ }
26391
+ serialize() {
26392
+ const properties = /* @__PURE__ */ new Map();
26393
+ for (const property of this.payload.properties || []) {
26394
+ properties.set(property.name.toLowerCase(), property.value.value);
26395
+ }
26396
+ if (this.payload.name) {
26397
+ properties.set("name", this.payload.name.value);
26398
+ }
26399
+ if (this.payload.value) {
26400
+ properties.set("value", this.payload.value.value);
26401
+ }
26402
+ if (this.payload.description) {
26403
+ properties.set("description", this.payload.description.value);
26404
+ }
26405
+ const node = {
26406
+ role: this.#role,
26407
+ elementHandle: async () => {
26408
+ if (!this.payload.backendDOMNodeId) {
26409
+ return null;
26410
+ }
26411
+ return await this.#realm.adoptBackendNode(this.payload.backendDOMNodeId);
26025
26412
  }
26026
- if (typeof arg === "bigint") {
26027
- return { unserializableValue: `${arg.toString()}n` };
26413
+ };
26414
+ const userStringProperties = [
26415
+ "name",
26416
+ "value",
26417
+ "description",
26418
+ "keyshortcuts",
26419
+ "roledescription",
26420
+ "valuetext"
26421
+ ];
26422
+ const getUserStringPropertyValue = (key) => {
26423
+ return properties.get(key);
26424
+ };
26425
+ for (const userStringProperty of userStringProperties) {
26426
+ if (!properties.has(userStringProperty)) {
26427
+ continue;
26028
26428
  }
26029
- if (Object.is(arg, -0)) {
26030
- return { unserializableValue: "-0" };
26429
+ node[userStringProperty] = getUserStringPropertyValue(userStringProperty);
26430
+ }
26431
+ const booleanProperties = [
26432
+ "disabled",
26433
+ "expanded",
26434
+ "focused",
26435
+ "modal",
26436
+ "multiline",
26437
+ "multiselectable",
26438
+ "readonly",
26439
+ "required",
26440
+ "selected"
26441
+ ];
26442
+ const getBooleanPropertyValue = (key) => {
26443
+ return properties.get(key);
26444
+ };
26445
+ for (const booleanProperty of booleanProperties) {
26446
+ if (booleanProperty === "focused" && this.#role === "RootWebArea") {
26447
+ continue;
26031
26448
  }
26032
- if (Object.is(arg, Infinity)) {
26033
- return { unserializableValue: "Infinity" };
26449
+ const value = getBooleanPropertyValue(booleanProperty);
26450
+ if (!value) {
26451
+ continue;
26034
26452
  }
26035
- if (Object.is(arg, -Infinity)) {
26036
- return { unserializableValue: "-Infinity" };
26453
+ node[booleanProperty] = getBooleanPropertyValue(booleanProperty);
26454
+ }
26455
+ const tristateProperties = ["checked", "pressed"];
26456
+ for (const tristateProperty of tristateProperties) {
26457
+ if (!properties.has(tristateProperty)) {
26458
+ continue;
26037
26459
  }
26038
- if (Object.is(arg, NaN)) {
26039
- return { unserializableValue: "NaN" };
26460
+ const value = properties.get(tristateProperty);
26461
+ node[tristateProperty] = value === "mixed" ? "mixed" : value === "true" ? true : false;
26462
+ }
26463
+ const numericalProperties = [
26464
+ "level",
26465
+ "valuemax",
26466
+ "valuemin"
26467
+ ];
26468
+ const getNumericalPropertyValue = (key) => {
26469
+ return properties.get(key);
26470
+ };
26471
+ for (const numericalProperty of numericalProperties) {
26472
+ if (!properties.has(numericalProperty)) {
26473
+ continue;
26040
26474
  }
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 };
26475
+ node[numericalProperty] = getNumericalPropertyValue(numericalProperty);
26476
+ }
26477
+ const tokenProperties = [
26478
+ "autocomplete",
26479
+ "haspopup",
26480
+ "invalid",
26481
+ "orientation"
26482
+ ];
26483
+ const getTokenPropertyValue = (key) => {
26484
+ return properties.get(key);
26485
+ };
26486
+ for (const tokenProperty of tokenProperties) {
26487
+ const value = getTokenPropertyValue(tokenProperty);
26488
+ if (!value || value === "false") {
26489
+ continue;
26058
26490
  }
26059
- return { value: arg };
26491
+ node[tokenProperty] = getTokenPropertyValue(tokenProperty);
26060
26492
  }
26493
+ return node;
26061
26494
  }
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.");
26495
+ static createTree(realm, payloads) {
26496
+ const nodeById = /* @__PURE__ */ new Map();
26497
+ for (const payload of payloads) {
26498
+ nodeById.set(payload.nodeId, new _AXNode(realm, payload));
26499
+ }
26500
+ for (const node of nodeById.values()) {
26501
+ for (const childId of node.payload.childIds || []) {
26502
+ const child = nodeById.get(childId);
26503
+ if (child) {
26504
+ node.children.push(child);
26505
+ }
26506
+ }
26507
+ }
26508
+ return nodeById.values().next().value;
26076
26509
  }
26077
- throw error;
26078
26510
  };
26079
26511
 
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
26512
  // node_modules/puppeteer-core/lib/esm/puppeteer/cdp/FrameManagerEvents.js
26088
26513
  init_dirname();
26089
26514
  init_buffer2();
@@ -26666,6 +27091,7 @@ ${sourceUrlComment}
26666
27091
  _lifecycleEvents = /* @__PURE__ */ new Set();
26667
27092
  _id;
26668
27093
  _parentId;
27094
+ accessibility;
26669
27095
  worlds;
26670
27096
  constructor(frameManager, frameId, parentFrameId, client) {
26671
27097
  super();
@@ -26680,6 +27106,7 @@ ${sourceUrlComment}
26680
27106
  [MAIN_WORLD]: new IsolatedWorld(this, this._frameManager.timeoutSettings),
26681
27107
  [PUPPETEER_WORLD]: new IsolatedWorld(this, this._frameManager.timeoutSettings)
26682
27108
  };
27109
+ this.accessibility = new Accessibility(this.worlds[MAIN_WORLD]);
26683
27110
  this.on(FrameEvent.FrameSwappedByActivation, () => {
26684
27111
  this._onLoadingStarted();
26685
27112
  this._onLoadingStopped();
@@ -27333,7 +27760,8 @@ ${sourceUrlComment}
27333
27760
  failed: "Failed"
27334
27761
  };
27335
27762
  function handleError(error) {
27336
- if (error.originalMessage.includes("Invalid header")) {
27763
+ if (error.originalMessage.includes("Invalid header") || error.originalMessage.includes('Expected "header"') || // WebDriver BiDi error for invalid values, for example, headers.
27764
+ error.originalMessage.includes("invalid argument")) {
27337
27765
  throw error;
27338
27766
  }
27339
27767
  debugError(error);
@@ -29766,7 +30194,6 @@ ${sourceUrlComment}
29766
30194
  #keyboard;
29767
30195
  #mouse;
29768
30196
  #touchscreen;
29769
- #accessibility;
29770
30197
  #frameManager;
29771
30198
  #emulationManager;
29772
30199
  #tracing;
@@ -29869,7 +30296,6 @@ ${sourceUrlComment}
29869
30296
  this.#keyboard = new CdpKeyboard(client);
29870
30297
  this.#mouse = new CdpMouse(client, this.#keyboard);
29871
30298
  this.#touchscreen = new CdpTouchscreen(client, this.#keyboard);
29872
- this.#accessibility = new Accessibility(client);
29873
30299
  this.#frameManager = new FrameManager(client, this, this._timeoutSettings);
29874
30300
  this.#emulationManager = new EmulationManager(client);
29875
30301
  this.#tracing = new Tracing(client);
@@ -29905,7 +30331,6 @@ ${sourceUrlComment}
29905
30331
  this.#keyboard.updateClient(newSession);
29906
30332
  this.#mouse.updateClient(newSession);
29907
30333
  this.#touchscreen.updateClient(newSession);
29908
- this.#accessibility.updateClient(newSession);
29909
30334
  this.#emulationManager.updateClient(newSession);
29910
30335
  this.#tracing.updateClient(newSession);
29911
30336
  this.#coverage.updateClient(newSession);
@@ -30063,9 +30488,6 @@ ${sourceUrlComment}
30063
30488
  get tracing() {
30064
30489
  return this.#tracing;
30065
30490
  }
30066
- get accessibility() {
30067
- return this.#accessibility;
30068
- }
30069
30491
  frames() {
30070
30492
  return this.#frameManager.frames();
30071
30493
  }
@@ -30796,7 +31218,8 @@ ${sourceUrlComment}
30796
31218
  }
30797
31219
  for (const [targetId, targetInfo] of this.#discoveredTargetsByTargetId.entries()) {
30798
31220
  const targetForFilter = new CdpTarget(targetInfo, void 0, void 0, this, void 0);
30799
- if ((!this.#targetFilterCallback || this.#targetFilterCallback(targetForFilter)) && targetInfo.type !== "browser") {
31221
+ const skipTarget = targetInfo.type === "browser" || targetInfo.url.startsWith("chrome-extension://");
31222
+ if ((!this.#targetFilterCallback || this.#targetFilterCallback(targetForFilter)) && !skipTarget) {
30800
31223
  this.#targetsIdsForInit.add(targetId);
30801
31224
  }
30802
31225
  }
@@ -31474,13 +31897,6 @@ puppeteer-core/lib/esm/puppeteer/common/NetworkManagerEvents.js:
31474
31897
  * SPDX-License-Identifier: Apache-2.0
31475
31898
  *)
31476
31899
 
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
31900
  puppeteer-core/lib/esm/puppeteer/api/JSHandle.js:
31485
31901
  (**
31486
31902
  * @license
@@ -31572,6 +31988,13 @@ puppeteer-core/lib/esm/puppeteer/cdp/AriaQueryHandler.js:
31572
31988
  * SPDX-License-Identifier: Apache-2.0
31573
31989
  *)
31574
31990
 
31991
+ puppeteer-core/lib/esm/puppeteer/common/CSSQueryHandler.js:
31992
+ (**
31993
+ * @license
31994
+ * Copyright 2023 Google Inc.
31995
+ * SPDX-License-Identifier: Apache-2.0
31996
+ *)
31997
+
31575
31998
  puppeteer-core/lib/esm/puppeteer/common/ScriptInjector.js:
31576
31999
  (**
31577
32000
  * @license
@@ -31600,6 +32023,13 @@ puppeteer-core/lib/esm/puppeteer/common/PQueryHandler.js:
31600
32023
  * SPDX-License-Identifier: Apache-2.0
31601
32024
  *)
31602
32025
 
32026
+ puppeteer-core/lib/esm/puppeteer/common/PSelectorParser.js:
32027
+ (**
32028
+ * @license
32029
+ * Copyright 2023 Google Inc.
32030
+ * SPDX-License-Identifier: Apache-2.0
32031
+ *)
32032
+
31603
32033
  puppeteer-core/lib/esm/puppeteer/common/TextQueryHandler.js:
31604
32034
  (**
31605
32035
  * @license
@@ -31670,6 +32100,13 @@ puppeteer-core/lib/esm/puppeteer/cdp/ExecutionContext.js:
31670
32100
  * SPDX-License-Identifier: Apache-2.0
31671
32101
  *)
31672
32102
 
32103
+ puppeteer-core/lib/esm/puppeteer/cdp/Accessibility.js:
32104
+ (**
32105
+ * @license
32106
+ * Copyright 2018 Google Inc.
32107
+ * SPDX-License-Identifier: Apache-2.0
32108
+ *)
32109
+
31673
32110
  puppeteer-core/lib/esm/puppeteer/cdp/FrameManagerEvents.js:
31674
32111
  (**
31675
32112
  * @license