@skrillex1224/playwright-toolkit 2.1.34 → 2.1.35

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.
package/dist/index.cjs CHANGED
@@ -805,6 +805,17 @@ var Humanize = {
805
805
  const { reactionDelay = 250, throwOnMissing = true, scrollIfNeeded = true, restore = false } = options;
806
806
  const targetDesc = target == null ? "Current Position" : typeof target === "string" ? target : "ElementHandle";
807
807
  logger4.start("humanClick", `target=${targetDesc}`);
808
+ const restoreOnce = async () => {
809
+ if (restoreOnce.restored) return;
810
+ restoreOnce.restored = true;
811
+ if (typeof restoreOnce.do !== "function") return;
812
+ try {
813
+ await (0, import_delay2.default)(this.jitterMs(1e3));
814
+ await restoreOnce.do();
815
+ } catch (restoreError) {
816
+ logger4.warn(`humanClick: \u6062\u590D\u6EDA\u52A8\u4F4D\u7F6E\u5931\u8D25: ${restoreError.message}`);
817
+ }
818
+ };
808
819
  try {
809
820
  if (target == null) {
810
821
  await (0, import_delay2.default)(this.jitterMs(reactionDelay, 0.4));
@@ -825,24 +836,13 @@ var Humanize = {
825
836
  } else {
826
837
  element = target;
827
838
  }
828
- const restoreOnce2 = async () => {
829
- if (restoreOnce2.restored) return;
830
- restoreOnce2.restored = true;
831
- if (typeof restoreOnce2.do !== "function") return;
832
- try {
833
- await (0, import_delay2.default)(this.jitterMs(1e3));
834
- await restoreOnce2.do();
835
- } catch (restoreError) {
836
- logger4.warn(`humanClick: \u6062\u590D\u6EDA\u52A8\u4F4D\u7F6E\u5931\u8D25: ${restoreError.message}`);
837
- }
838
- };
839
839
  if (scrollIfNeeded) {
840
840
  const { restore: restoreFn, didScroll } = await this.humanScroll(page, element);
841
- restoreOnce2.do = didScroll && restore ? restoreFn : null;
841
+ restoreOnce.do = didScroll && restore ? restoreFn : null;
842
842
  }
843
843
  const box = await element.boundingBox();
844
844
  if (!box) {
845
- await restoreOnce2();
845
+ await restoreOnce();
846
846
  if (throwOnMissing) {
847
847
  throw new Error("\u65E0\u6CD5\u83B7\u53D6\u5143\u7D20\u4F4D\u7F6E");
848
848
  }
@@ -854,7 +854,7 @@ var Humanize = {
854
854
  await cursor.actions.move({ x, y });
855
855
  await (0, import_delay2.default)(this.jitterMs(reactionDelay, 0.4));
856
856
  await cursor.actions.click();
857
- await restoreOnce2();
857
+ await restoreOnce();
858
858
  logger4.success("humanClick");
859
859
  return true;
860
860
  } catch (error) {