{"version":3,"file":"compare_image_snapshot.logic.mjs","names":[],"sources":["../../../src/client/snapshot/compare_image_snapshot.logic.ts"],"sourcesContent":["import { isAbsolute, relative, resolve } from 'pathe'\nimport type { ToMatchImageSnapshotOptions } from '../../shared/types.ts'\n\nexport function prettifyOptions(options: ToMatchImageSnapshotOptions<any> | undefined) {\n\tif (!options) return 'none'\n\n\treturn [\n\t\t`failureThreshold: ${options.failureThreshold ?? 0} ${options.failureThresholdType ?? 'pixels'}`,\n\t\toptions.timeout ? `timeout: ${options.timeout} ms` : '',\n\t\t`comparisonMethod: ${options.comparisonMethod ?? 'pixel'}`,\n\t\toptions.diffOptions ? `diffOptions: ${JSON.stringify(options.diffOptions)}` : '',\n\t\toptions.createMissingBaseline ? 'createMissingBaseline: true' : '',\n\t]\n\t\t.filter(Boolean)\n\t\t.join('\\n                ')\n}\n\n/**\n * Formats a snapshot path for display in a failure message.\n *\n * Paths within the project root are shown relative to it so that the failure output can be shared\n * verbatim without leaking the local absolute path, while remaining clickable in editors and terminals.\n * Paths outside the project root stay absolute, as a `../../..` chain is neither shorter nor clearer.\n */\nexport function formatSnapshotPath(projectRoot: string, path: string) {\n\tconst absolutePath = resolve(projectRoot, path)\n\tconst relativePath = relative(projectRoot, absolutePath)\n\tif (!relativePath || relativePath === '..' || relativePath.startsWith('../') || isAbsolute(relativePath)) {\n\t\treturn absolutePath\n\t}\n\treturn `./${relativePath}`\n}\n"],"mappings":";;;AAGA,SAAgB,gBAAgB,SAAuD;AACtF,KAAI,CAAC,QAAS,QAAO;AAErB,QAAO;EACN,qBAAqB,QAAQ,oBAAoB,EAAE,GAAG,QAAQ,wBAAwB;EACtF,QAAQ,UAAU,YAAY,QAAQ,QAAQ,OAAO;EACrD,qBAAqB,QAAQ,oBAAoB;EACjD,QAAQ,cAAc,gBAAgB,KAAK,UAAU,QAAQ,YAAY,KAAK;EAC9E,QAAQ,wBAAwB,gCAAgC;EAChE,CACC,OAAO,QAAQ,CACf,KAAK,qBAAqB;;;;;;;;;AAU7B,SAAgB,mBAAmB,aAAqB,MAAc;CACrE,MAAM,eAAe,QAAQ,aAAa,KAAK;CAC/C,MAAM,eAAe,SAAS,aAAa,aAAa;AACxD,KAAI,CAAC,gBAAgB,iBAAiB,QAAQ,aAAa,WAAW,MAAM,IAAI,WAAW,aAAa,CACvG,QAAO;AAER,QAAO,KAAK"}