'use strict';
import { existsSync } from 'node:fs';
import { mkdir, cp } from 'node:fs/promises';
import _0x1c3e3a from 'node:path';
import { environmentVariables } from '../constants/ci-constants.js';
import { playwrightReportPaths } from '../../../base-repo/constants/gitlab.js';
import { cliLogWarning, cliLogInfo } from '../../../fd-toolbox/logging/cli-logger.js';
import { getStringEnvSetting } from '../../../fd-toolbox/infra/env-functions.js';

var __defProp=Object['defineProperty'],__name=(_0x303c9,_0x5523da)=>__defProp(_0x303c9,'name',{'value':_0x5523da,'configurable':!![]});async function copyPlaywrightReport(){const _0x483986=getStringEnvSetting(environmentVariables['ciProjectDir']);let _0x3fb30a=!![];!_0x483986&&(cliLogWarning('CI_PROJECT_DIR\x20is\x20not\x20defined.\x20Skipping\x20report\x20copy.'),_0x3fb30a=![]);let _0x452aa8='',_0x21aba3='';if(_0x483986){const _0x5b8332=_0x1c3e3a['resolve'](_0x483986,playwrightReportPaths['saasKitTestRepoSource']),_0x215bfd=_0x1c3e3a['resolve'](_0x483986,playwrightReportPaths['mainRepoSource']),_0x42c993=_0x1c3e3a['resolve'](_0x483986,playwrightReportPaths['saasKitTestSubmoduleTarget']),_0x40761a=_0x1c3e3a['resolve'](_0x483986,playwrightReportPaths['mainSubmoduleTarget']);if(existsSync(_0x5b8332))_0x452aa8=_0x5b8332,_0x21aba3=_0x42c993;else existsSync(_0x215bfd)?(_0x452aa8=_0x215bfd,_0x21aba3=_0x40761a):(cliLogWarning('Playwright\x20report\x20not\x20found\x20in\x20expected\x20locations:\x0a\x20\x20\x20\x20\x20\x20\x20\x20-\x20'+_0x5b8332+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20-\x20'+_0x215bfd),_0x3fb30a=![]);if(_0x3fb30a){cliLogInfo('Copying\x20Playwright\x20report\x20from\x20'+_0x452aa8+'\x20to\x20'+_0x21aba3);const _0x20d70d=_0x1c3e3a['resolve'](_0x483986,playwrightReportPaths['stableReportDir']);await mkdir(_0x20d70d,{'recursive':!![]}),await cp(_0x452aa8,_0x20d70d,{'recursive':!![]}),cliLogInfo('Playwright\x20report\x20copied\x20successfully.');}}}__name(copyPlaywrightReport,'copyPlaywrightReport');

export { copyPlaywrightReport };
