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EAAW,wBACrC,mBAAoB,EAAW,kBAC/B,aAAc,EACd,YAEF,OAAO,GAAU,MAAM,IACzB,CAAE,MAAO,GAIP,GAFA,IAAI,MAAM,8BAA8B,MACxC,IAAI,MAAM,EAAM,OACsB,SAAlC,QAAQ,IAAI,kBACd,MAAM,CAEV,CA1CA,MALE,GAAsC,SAAlC,QAAQ,IAAI,kBACd,MAAM,IAAI,MAAM,6CA+CtB,EAIA,OAAO,QAAQ,eAAiB,iBAC9B,aAAa,MAAM,gBACrB,EAEA,OAAO,QAAQ,mBAAqB,MAAO,EAAQ,EArUjB,OAsU5B,QAAQ,IAAI,8BACd,EAAc,WAAW,QAAQ,IAAI,8BAGvC,MAAM,EAAsB,4NAC5B,IAAI,EAAe,KAAK,UAAU,EAAO,cAAc,GA5UzB,MA6U9B,MAAM,QAAqB,EAAO,cAAc,gDAChD,IAAI,EAAU,EAEV,EAAO,EAEX,KAAO,EAAe,GAAW,EAlVH,MAmV5B,EAAU,EAAe,EACzB,GAAQ,QACF,EAAO,cAAc,sBAAsB,YAC3C,IAAI,SAAQ,GAAW,WAAW,EAAuB,IAAd,KAGjD,QAAqB,EAAO,cAAc,GAGD,SAArC,QAAQ,IAAI,4BACV,EAAO,cAAc,yBAE7B,IAAI,EAAmB,EACnB,QAAQ,IAAI,uCACd,EAAmB,WAAW,QAAQ,IAAI,6CAEtC,IAAI,SAAQ,GAAW,WAAW,EAA4B,IAAnB,IAAyB","file":"/npm/@percy/selenium-webdriver@2.2.5/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@percy/selenium-webdriver@2.2.5/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","// Collect client and environment information\nconst sdkPkg = require('./package.json');\nlet seleniumPkg;\ntry {\n  seleniumPkg = require('selenium-webdriver/package.json');\n} catch {\n  /* istanbul ignore next */\n  seleniumPkg = { name: 'unknown', version: 'unknown' };\n}\nconst CLIENT_INFO = `${sdkPkg.name}/${sdkPkg.version}`;\nconst ENV_INFO = `${seleniumPkg.name}/${seleniumPkg.version}`;\nconst utils = require('@percy/sdk-utils');\nconst { DriverMetadata } = require('./driverMetadata');\nconst log = utils.logger('selenium-webdriver');\nconst CS_MAX_SCREENSHOT_LIMIT = 25000;\nconst SCROLL_DEFAULT_SLEEP_TIME = 0.45; // 450ms\n\nconst getWidthsForMultiDOM = (userPassedWidths, eligibleWidths) => {\n  // Deep copy of eligible mobile widths\n  let allWidths = [];\n  if (eligibleWidths?.mobile?.length !== 0) {\n    allWidths = allWidths.concat(eligibleWidths?.mobile);\n  }\n  if (userPassedWidths.length !== 0) {\n    allWidths = allWidths.concat(userPassedWidths);\n  } else {\n    allWidths = allWidths.concat(eligibleWidths.config);\n  }\n\n  return [...new Set(allWidths)].filter(e => e); // Removing duplicates\n};\n\nasync function changeWindowDimensionAndWait(driver, width, height, resizeCount) {\n  try {\n    const caps = await driver.getCapabilities();\n    if (typeof driver?.sendDevToolsCommand === 'function' && caps.getBrowserName() === 'chrome' && process.env.PERCY_DISABLE_CDP_RESIZE !== 'true') {\n      await driver?.sendDevToolsCommand('Emulation.setDeviceMetricsOverride', {\n        height,\n        width,\n        deviceScaleFactor: 1,\n        mobile: false\n      });\n    } else {\n      await driver.manage().window().setRect({ width, height });\n    }\n  } catch (e) {\n    log.debug(`Resizing using CDP failed, falling back to driver resize for width ${width}`, e);\n    await driver.manage().window().setRect({ width, height });\n  }\n\n  try {\n    await driver.wait(async () => {\n      /* istanbul ignore next: no instrumenting injected code */\n      await driver.executeScript('return window.resizeCount') === resizeCount;\n    }, 1000);\n  } catch (e) {\n    log.debug(`Timed out waiting for window resize event for width ${width}`, e);\n  }\n}\n\n// Captures responsive DOM snapshots across different widths\nasync function captureResponsiveDOM(driver, options) {\n  const widths = getWidthsForMultiDOM(options.widths || [], utils.percy?.widths);\n  const domSnapshots = [];\n  const windowSize = await driver.manage().window().getRect();\n  let currentWidth = windowSize.width; let currentHeight = windowSize.height;\n  let lastWindowWidth = currentWidth;\n  let resizeCount = 0;\n  // Setup the resizeCount listener if not present\n  /* istanbul ignore next: no instrumenting injected code */\n  await driver.executeScript('PercyDOM.waitForResize()');\n  let height = currentHeight;\n  if (process.env.PERCY_RESPONSIVE_CAPTURE_MIN_HEIGHT) {\n    height = await driver.executeScript(`return window.outerHeight - window.innerHeight + ${utils.percy?.config?.snapshot?.minHeight}`);\n  }\n  for (let width of widths) {\n    if (lastWindowWidth !== width) {\n      resizeCount++;\n      await changeWindowDimensionAndWait(driver, width, height, resizeCount);\n      lastWindowWidth = width;\n    }\n\n    if (process.env.PERCY_RESPONSIVE_CAPTURE_RELOAD_PAGE) {\n      await driver.navigate().refresh();\n      await driver.executeScript(await utils.fetchPercyDOM());\n    }\n\n    if (process.env.RESPONSIVE_CAPTURE_SLEEP_TIME) {\n      await new Promise(resolve => setTimeout(resolve, parseInt(process.env.RESPONSIVE_CAPTURE_SLEEP_TIME) * 1000));\n    }\n\n    if (process.env.PERCY_ENABLE_LAZY_LOADING_SCROLL) {\n      await module.exports.slowScrollToBottom(driver);\n    }\n\n    let domSnapshot = await captureSerializedDOM(driver, options);\n    domSnapshot.width = width;\n    domSnapshots.push(domSnapshot);\n  }\n\n  // Reset window size back to original dimensions\n  await changeWindowDimensionAndWait(driver, currentWidth, currentHeight, resizeCount + 1);\n  return domSnapshots;\n}\n\nfunction ignoreCanvasSerializationErrors(options) {\n  return options?.ignoreCanvasSerializationErrors ??\n         utils.percy?.config?.snapshot?.ignoreCanvasSerializationErrors ??\n         false;\n}\n\nfunction ignoreStyleSheetSerializationErrors(options) {\n  return options?.ignoreStyleSheetSerializationErrors ??\n         utils.percy?.config?.snapshot?.ignoreStyleSheetSerializationErrors ??\n         false;\n}\n\nasync function captureSerializedDOM(driver, options) {\n  /* istanbul ignore next: no instrumenting injected code */\n  let { domSnapshot } = await driver.executeScript(async (options) => ({\n    /* eslint-disable-next-line no-undef */\n    domSnapshot: await PercyDOM.serialize(options)\n  }), {\n    ...options,\n    ignoreCanvasSerializationErrors: ignoreCanvasSerializationErrors(options),\n    ignoreStyleSheetSerializationErrors: ignoreStyleSheetSerializationErrors(options)\n  });\n\n  /* istanbul ignore next: no instrumenting injected code */\n  domSnapshot.cookies = await driver.manage().getCookies() || [];\n  return domSnapshot;\n}\n\nfunction isResponsiveDOMCaptureValid(options) {\n  if (utils.percy?.config?.percy?.deferUploads) {\n    return false;\n  }\n  return (\n    options?.responsive_snapshot_capture ||\n    options?.responsiveSnapshotCapture ||\n    utils.percy?.config?.snapshot?.responsiveSnapshotCapture ||\n    false\n  );\n}\n\nasync function captureDOM(driver, options = {}) {\n  const responsiveSnapshotCapture = isResponsiveDOMCaptureValid(options);\n  if (responsiveSnapshotCapture) {\n    return await captureResponsiveDOM(driver, options);\n  } else {\n    return await captureSerializedDOM(driver, options);\n  }\n}\n\nasync function currentURL(driver, options) {\n  /* istanbul ignore next: no instrumenting injected code */\n  let { url } = await driver.executeScript(options => ({\n    /* eslint-disable-next-line no-undef */\n    url: document.URL\n  }), options);\n  return url;\n}\n\nconst createRegion = function({\n  boundingBox = null,\n  elementXpath = null,\n  elementCSS = null,\n  padding = null,\n  algorithm = 'ignore',\n  diffSensitivity = null,\n  imageIgnoreThreshold = null,\n  carouselsEnabled = null,\n  bannersEnabled = null,\n  adsEnabled = null,\n  diffIgnoreThreshold = null\n} = {}) {\n  const elementSelector = {};\n  if (boundingBox) elementSelector.boundingBox = boundingBox;\n  if (elementXpath) elementSelector.elementXpath = elementXpath;\n  if (elementCSS) elementSelector.elementCSS = elementCSS;\n\n  const region = {\n    algorithm,\n    elementSelector\n  };\n\n  if (padding) {\n    region.padding = padding;\n  }\n\n  const configuration = {};\n  if (['standard', 'intelliignore'].includes(algorithm)) {\n    if (diffSensitivity !== null) configuration.diffSensitivity = diffSensitivity;\n    if (imageIgnoreThreshold !== null) configuration.imageIgnoreThreshold = imageIgnoreThreshold;\n    if (carouselsEnabled !== null) configuration.carouselsEnabled = carouselsEnabled;\n    if (bannersEnabled !== null) configuration.bannersEnabled = bannersEnabled;\n    if (adsEnabled !== null) configuration.adsEnabled = adsEnabled;\n  }\n\n  if (Object.keys(configuration).length > 0) {\n    region.configuration = configuration;\n  }\n\n  const assertion = {};\n  if (diffIgnoreThreshold !== null) {\n    assertion.diffIgnoreThreshold = diffIgnoreThreshold;\n  }\n\n  if (Object.keys(assertion).length > 0) {\n    region.assertion = assertion;\n  }\n\n  return region;\n};\n\n// Take a DOM snapshot and post it to the snapshot endpoint\nconst percySnapshot = async function percySnapshot(driver, name, options) {\n  if (!driver) throw new Error('An instance of the selenium driver object is required.');\n  if (!name) throw new Error('The `name` argument is required.');\n  if (!(await module.exports.isPercyEnabled())) {\n    if (process.env.PERCY_RAISE_ERROR === 'true') {\n      throw new Error('Percy is not running, disabling snapshots.');\n    } else {\n      return;\n    }\n  }\n  if (utils.percy?.type === 'automate') {\n    throw new Error('Invalid function call - percySnapshot(). Please use percyScreenshot() function while using Percy with Automate. For more information on usage of percyScreenshot, refer https://www.browserstack.com/docs/percy/integrate/functional-and-visual');\n  }\n\n  try {\n    // Inject the DOM serialization script\n    await driver.executeScript(await utils.fetchPercyDOM());\n    // Serialize and capture the DOM\n    /* istanbul ignore next: no instrumenting injected code */\n    let domSnapshot = await captureDOM(driver, options);\n    let url = await currentURL(driver, options);\n    // Post the DOM to the snapshot endpoint with snapshot options and other info\n    const response = await utils.postSnapshot({\n      ...options,\n      environmentInfo: ENV_INFO,\n      clientInfo: CLIENT_INFO,\n      domSnapshot,\n      name,\n      url\n    });\n    return response?.body?.data;\n  } catch (error) {\n    // Handle errors\n    log.error(`Could not take DOM snapshot \"${name}\"`);\n    log.error(error);\n    if (process.env.PERCY_RAISE_ERROR === 'true') {\n      throw error;\n    }\n  }\n};\n\nmodule.exports = percySnapshot;\nmodule.exports.percySnapshot = percySnapshot;\nmodule.exports.createRegion = createRegion;\n\nmodule.exports.request = async function request(data) {\n  return await utils.captureAutomateScreenshot(data);\n}; // To mock in test case\n\nconst getElementIdFromElements = async function getElementIdFromElements(elements) {\n  return Promise.all(elements.map(e => e.getId()));\n};\n\nmodule.exports.percyScreenshot = async function percyScreenshot(driver, name, options) {\n  if (!driver || typeof driver === 'string') {\n    // Unable to test this as couldnt define `browser` from test mjs file\n    try {\n      // browser is defined in wdio context\n      // eslint-disable-next-line no-undef\n      [driver, name, options] = [browser, driver, name];\n    } catch (e) { // ReferenceError: browser is not defined.\n      driver = undefined;\n    }\n  }\n\n  if (!driver) throw new Error('An instance of the selenium driver object is required.');\n  if (!name) throw new Error('The `name` argument is required.');\n  if (!(await module.exports.isPercyEnabled())) {\n    if (process.env.PERCY_RAISE_ERROR === 'true') {\n      throw new Error('Percy is not running, disabling snapshots.');\n    } else {\n      return;\n    }\n  }\n  if (utils.percy?.type !== 'automate') {\n    throw new Error('Invalid function call - percyScreenshot(). Please use percySnapshot() function for taking screenshot. percyScreenshot() should be used only while using Percy with Automate. For more information on usage of PercySnapshot(), refer doc for your language https://www.browserstack.com/docs/percy/integrate/overview');\n  }\n\n  try {\n    const driverData = new DriverMetadata(driver);\n    if (options) {\n      if ('ignoreRegionSeleniumElements' in options) {\n        options.ignore_region_selenium_elements = options.ignoreRegionSeleniumElements;\n        delete options.ignoreRegionSeleniumElements;\n      }\n      if ('considerRegionSeleniumElements' in options) {\n        options.consider_region_selenium_elements = options.considerRegionSeleniumElements;\n        delete options.considerRegionSeleniumElements;\n      }\n      if ('ignore_region_selenium_elements' in options) {\n        options.ignore_region_selenium_elements = await getElementIdFromElements(options.ignore_region_selenium_elements);\n      }\n      if ('consider_region_selenium_elements' in options) {\n        options.consider_region_selenium_elements = await getElementIdFromElements(options.consider_region_selenium_elements);\n      }\n    }\n\n    // Post the driver details to the automate screenshot endpoint with snapshot options and other info\n    const response = await module.exports.request({\n      environmentInfo: ENV_INFO,\n      clientInfo: CLIENT_INFO,\n      sessionId: await driverData.getSessionId(),\n      commandExecutorUrl: await driverData.getCommandExecutorUrl(),\n      capabilities: await driverData.getCapabilities(),\n      snapshotName: name,\n      options\n    });\n    return response?.body?.data;\n  } catch (error) {\n    // Handle errors\n    log.error(`Could not take Screenshot \"${name}\"`);\n    log.error(error.stack);\n    if (process.env.PERCY_RAISE_ERROR === 'true') {\n      throw error;\n    }\n  }\n};\n\n// jasmine cannot mock individual functions, hence adding isPercyEnabled to the exports object\n// also need to define this at the end of the file or else default exports will over-ride this\nmodule.exports.isPercyEnabled = async function isPercyEnabled() {\n  return await utils.isPercyEnabled();\n};\n\nmodule.exports.slowScrollToBottom = async (driver, scrollSleep = SCROLL_DEFAULT_SLEEP_TIME) => {\n  if (process.env.PERCY_LAZY_LOAD_SCROLL_TIME) {\n    scrollSleep = parseFloat(process.env.PERCY_LAZY_LOAD_SCROLL_TIME);\n  }\n\n  const scrollHeightCommand = 'return Math.max(document.body.scrollHeight, document.body.clientHeight, document.body.offsetHeight, document.documentElement.scrollHeight, document.documentElement.clientHeight, document.documentElement.offsetHeight);';\n  let scrollHeight = Math.min(await driver.executeScript(scrollHeightCommand), CS_MAX_SCREENSHOT_LIMIT);\n  const clientHeight = await driver.executeScript('return document.documentElement.clientHeight');\n  let current = 0;\n\n  let page = 1;\n  // Break the loop if maximum scroll height 25000px is reached\n  while (scrollHeight > current && current < CS_MAX_SCREENSHOT_LIMIT) {\n    current = clientHeight * page;\n    page += 1;\n    await driver.executeScript(`window.scrollTo(0, ${current})`);\n    await new Promise(resolve => setTimeout(resolve, scrollSleep * 1000));\n\n    // Recalculate scroll height for dynamically loaded pages\n    scrollHeight = await driver.executeScript(scrollHeightCommand);\n  }\n  // Get back to top\n  if (!(process.env.BYPASS_SCROLL_TO_TOP === 'true')) {\n    await driver.executeScript('window.scrollTo(0, 0)');\n  }\n  let sleepAfterScroll = 1;\n  if (process.env.PERCY_SLEEP_AFTER_LAZY_LOAD_COMPLETE) {\n    sleepAfterScroll = parseFloat(process.env.PERCY_SLEEP_AFTER_LAZY_LOAD_COMPLETE);\n  }\n  await new Promise(resolve => setTimeout(resolve, sleepAfterScroll * 1000));\n};\n"]}