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OACV,EAAQ,cAAc,mBAElB,EAAa,EAAmB,EAAU,MAAQ,EAAU,OAC5D,EAAkB,EAAa,EAAQ,cAAc,eACrD,EAAS,CACb,OAAQ,CACN,OAAQ,EAAkB,SAAS,UACnC,KAAM,EAAoB,SAAS,WAErC,mBACA,cAEF,GAA6B,WAAzB,EAAQ,cAA6B,GAA4C,SAAzB,EAAQ,aAAyB,EAC3F,EAAI,eAAe,WAAW,KAAK,QAAQ,GAAgB,CAAE,WAAW,IACxE,MAAM,EAAkB,cAAc,IAAI,KAAK,MAAM,IACrD,EAAI,eAAe,eAAe,EAAe,GACjD,EAAO,OAAO,KAAO,EAAgB,SAAS,SAChD,CAKA,OAJI,IACF,OAAO,MAAM,qCAAqC,EAAW,QAAQ,MACrE,EAAO,MAAQ,QAAQ,EAAQ,2DAA2D,EAAQ,cAAc,8BAA8B,EAAW,QAAQ,OAE5J,CAAM,EAEX,0BAA6B,IAC/B,EAAG,OAAQ,CACT,kCACA,+BACA","file":"/npm/cypress-visual-regression@5.3.0/dist/plugin.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/cypress-visual-regression@5.3.0/dist/plugin.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n  for (var name in all)\n    __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n  if (from && typeof from === \"object\" || typeof from === \"function\") {\n    for (let key of __getOwnPropNames(from))\n      if (!__hasOwnProp.call(to, key) && key !== except)\n        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n  }\n  return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n  // If the importer is in node compatibility mode or this is not an ESM\n  // file that has been converted to a CommonJS file using a Babel-\n  // compatible transform (i.e. \"__esModule\" has not been set), then set\n  // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n  isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n  mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/plugin.ts\nvar plugin_exports = {};\n__export(plugin_exports, {\n  compareSnapshots: () => compareSnapshots,\n  configureVisualRegression: () => configureVisualRegression,\n  updateSnapshot: () => updateSnapshot\n});\nmodule.exports = __toCommonJS(plugin_exports);\nvar fs = __toESM(require(\"fs\"));\nvar import_fs = require(\"fs\");\nvar path = __toESM(require(\"path\"));\nvar import_pixelmatch = __toESM(require(\"pixelmatch\"));\nvar import_pngjs2 = require(\"pngjs\");\nvar import_sanitize_filename = __toESM(require(\"sanitize-filename\"));\n\n// src/utils/image.ts\nvar import_pngjs = require(\"pngjs\");\nvar adjustCanvas = (image, width, height) => {\n  if (image.width === width && image.height === height) {\n    return image;\n  }\n  const imageAdjustedCanvas = new import_pngjs.PNG({ width, height, inputHasAlpha: true });\n  import_pngjs.PNG.bitblt(image, imageAdjustedCanvas, 0, 0, image.width, image.height, 0, 0);\n  return imageAdjustedCanvas;\n};\n\n// src/utils/logger.ts\nvar import_chalk = __toESM(require(\"chalk\"));\nvar import_util = require(\"util\");\nvar logLevelKeys = {\n  debug: 3,\n  info: 2,\n  warn: 1,\n  error: 0\n};\nvar isLogLevel = (level) => {\n  return level in logLevelKeys;\n};\nvar logLevel = () => {\n  const envLevel = isLogLevel(process.env.visual_regression_log ?? \"\") ? process.env.visual_regression_log ?? \"error\" : \"error\";\n  return logLevelKeys[envLevel];\n};\nvar format = (colorFormat, messages) => {\n  for (const msg of messages) {\n    if (typeof msg === \"string\") {\n      console.log(colorFormat(msg));\n    } else {\n      console.log(\n        colorFormat(\n          (0, import_util.inspect)(msg, {\n            showHidden: false,\n            customInspect: false,\n            colors: true,\n            depth: null,\n            maxArrayLength: Infinity\n          })\n        )\n      );\n    }\n  }\n};\nvar printDate = (colorFormat) => {\n  console.log(colorFormat(`LOGGER [${(/* @__PURE__ */ new Date()).toISOString()}]`));\n};\nvar error = (...messages) => {\n  if (logLevel() < logLevelKeys.error) return;\n  printDate(import_chalk.default.redBright.bold);\n  format(import_chalk.default.redBright, messages);\n};\nvar warn = (...messages) => {\n  if (logLevel() < logLevelKeys.warn) return;\n  printDate(import_chalk.default.yellow.bold);\n  format(import_chalk.default.yellowBright, messages);\n};\nvar info = (...messages) => {\n  if (logLevel() < logLevelKeys.info) return;\n  printDate(import_chalk.default.blue.bold);\n  format(import_chalk.default.blueBright, messages);\n};\nvar debug = (...messages) => {\n  if (logLevel() < logLevelKeys.debug) return;\n  printDate(import_chalk.default.magenta.bold);\n  format(import_chalk.default.magenta, messages);\n};\nvar always = (...messages) => {\n  printDate(import_chalk.default.grey.bold);\n  format(import_chalk.default.greenBright, messages);\n};\nvar logger = {\n  error,\n  warn,\n  info,\n  debug,\n  always,\n  logLevel\n};\n\n// src/plugin.ts\nvar import_node_fs = require(\"fs\");\nvar updateSnapshot = async (options) => {\n  const destDir = path.join(options.baseDirectory, options.spec.relative);\n  const sanitizedFileName = (0, import_sanitize_filename.default)(options.screenshotName);\n  const destFile = path.join(destDir, `${sanitizedFileName}.png`);\n  fs.mkdirSync(destDir, { recursive: true });\n  fs.copyFileSync(options.screenshotAbsolutePath, destFile);\n  const fileBuffer = fs.readFileSync(destFile);\n  logger.info(`Updated base snapshot '${options.screenshotName}' at ${destFile}`);\n  return { images: { actual: fileBuffer.toString(\"base64\") }, baseGenerated: true };\n};\nvar compareSnapshots = async (options) => {\n  const sanitizedFileName = (0, import_sanitize_filename.default)(options.screenshotName);\n  const retryAttempt = options.retryAttempt;\n  const expectedImagePath = path.join(options.baseDirectory, options.spec.relative, `${sanitizedFileName}.png`);\n  if (!(0, import_fs.existsSync)(expectedImagePath)) {\n    return { error: `Base screenshot not found at ${expectedImagePath}`, images: { actual: \"\" } };\n  }\n  const expectedImageBuffer = (0, import_node_fs.readFileSync)(expectedImagePath);\n  const expectedImage = import_pngjs2.PNG.sync.read(expectedImageBuffer);\n  const actualImagePath = options.screenshotAbsolutePath;\n  const actualImageBuffer = (0, import_node_fs.readFileSync)(actualImagePath);\n  const actualImage = import_pngjs2.PNG.sync.read(actualImageBuffer);\n  const diffFileName = retryAttempt > 0 ? `${sanitizedFileName} (attempt ${retryAttempt + 1}).png` : `${sanitizedFileName}.png`;\n  const diffImagePath = path.join(options.diffDirectory, options.spec.relative, diffFileName);\n  const diffImage = new import_pngjs2.PNG({\n    width: Math.max(actualImage.width, expectedImage.width),\n    height: Math.max(actualImage.height, expectedImage.height)\n  });\n  const imgActualFullCanvas = adjustCanvas(actualImage, diffImage.width, diffImage.height);\n  const imgExpectedFullCanvas = adjustCanvas(expectedImage, diffImage.width, diffImage.height);\n  const mismatchedPixels = (0, import_pixelmatch.default)(\n    imgActualFullCanvas.data,\n    imgExpectedFullCanvas.data,\n    diffImage.data,\n    diffImage.width,\n    diffImage.height,\n    options.pluginOptions.pixelmatchOptions\n  );\n  const percentage = mismatchedPixels / diffImage.width / diffImage.height;\n  const regressionError = percentage > options.pluginOptions.errorThreshold;\n  const result = {\n    images: {\n      actual: actualImageBuffer.toString(\"base64\"),\n      base: expectedImageBuffer.toString(\"base64\")\n    },\n    mismatchedPixels,\n    percentage\n  };\n  if (options.generateDiff === \"always\" || regressionError && options.generateDiff === \"fail\") {\n    (0, import_node_fs.mkdirSync)(path.dirname(diffImagePath), { recursive: true });\n    const diffImageBuffer = import_pngjs2.PNG.sync.write(diffImage);\n    (0, import_node_fs.writeFileSync)(diffImagePath, diffImageBuffer);\n    result.images.diff = diffImageBuffer.toString(\"base64\");\n  }\n  if (regressionError) {\n    logger.error(`Error in visual regression found: ${percentage.toFixed(2)}`);\n    result.error = `The '${options.screenshotName}' image is different. Threshold limit of '${options.pluginOptions.errorThreshold}' exceeded: '${percentage.toFixed(2)}'`;\n  }\n  return result;\n};\nvar configureVisualRegression = (on) => {\n  on(\"task\", {\n    compareSnapshots,\n    updateSnapshot\n  });\n};\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n  compareSnapshots,\n  configureVisualRegression,\n  updateSnapshot\n});\n"]}