'use strict';
import * as _0x3881d1 from 'fs';
import { Project } from 'ts-morph';
import { handleStringLiteral, handleNoSubstitutionTemplate, handleTemplateExpression, handleBinaryExpression } from '@tools/string-duplication/handlers';
import { collectSuppressedLines, isLineSuppressed } from '@tools/string-duplication/directives';
import { logWarningRaw } from '../../fd-toolbox/logging/loggers.js';

var __defProp=Object['defineProperty'],__name=(_0x7f5a55,_0x1ee8b4)=>__defProp(_0x7f5a55,'name',{'value':_0x1ee8b4,'configurable':!![]});const project=new Project({'skipAddingFilesFromTsConfig':!![]});function extractStringsFromFile(_0x3d747e,_0x305357){const _0x3f6b54=_0x3881d1['readFileSync'](_0x3d747e,'utf-8');return extractStringsFromSource(_0x3d747e,_0x3f6b54,_0x305357);}__name(extractStringsFromFile,'extractStringsFromFile');function extractStringsFromSource(_0x1ff195,_0x125627,_0x176b27){const _0x1ef111=[],_0x1e5838=new Set(_0x176b27);try{const _0xc70e7f=collectSuppressedLines(_0x125627),_0x187708=project['createSourceFile'](_0x1ff195,_0x125627,{'overwrite':!![]});_0x187708['forEachDescendant'](_0x5777b2=>{handleStringLiteral(_0x5777b2,_0x1ff195,_0x1e5838,_0x1ef111),handleNoSubstitutionTemplate(_0x5777b2,_0x1ff195,_0x1e5838,_0x1ef111),handleTemplateExpression(_0x5777b2,_0x1ff195,_0x1e5838,_0x1ef111),handleBinaryExpression(_0x5777b2,_0x1ff195,_0x1e5838,_0x1ef111);});for(let _0x5acb90=_0x1ef111['length']-(0x1*-0x1a14+0x21d8+0x7c3*-0x1);_0x5acb90>=-0x3*-0x9a4+-0x216+-0xe5*0x1e;_0x5acb90--){isLineSuppressed(_0x1ef111[_0x5acb90]['line'],_0xc70e7f)&&_0x1ef111['splice'](_0x5acb90,0x1*-0x1b53+-0x1188+0x2cdc);}project['removeSourceFile'](_0x187708);}catch(_0x1d9d7a){let _0x17f2cd='Unknown\x20error\x20occurred.';if(_0x1d9d7a instanceof Error)_0x17f2cd=_0x1d9d7a['message'];else {if(typeof _0x1d9d7a==='string')_0x17f2cd=_0x1d9d7a;}logWarningRaw('[PARSING\x20ERROR]\x20Failed\x20to\x20parse\x20'+_0x1ff195+'.\x20This\x20file\x20was\x20skipped.\x20Error:\x20'+_0x17f2cd);}return _0x1ef111;}__name(extractStringsFromSource,'extractStringsFromSource');

export { extractStringsFromFile, extractStringsFromSource };
