@loxia-labs/loxia-autopilot-one 1.0.18 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/bin/cli.js +1 -1
- package/bin/loxia-terminal-v2.js +1 -1
- package/bin/loxia-terminal.js +1 -1
- package/bin/start-with-terminal.js +1 -1
- package/package.json +1 -1
- package/scripts/install-scanners.js +1 -1
- package/src/analyzers/CSSAnalyzer.js +1 -1
- package/src/analyzers/ConfigValidator.js +1 -1
- package/src/analyzers/ESLintAnalyzer.js +1 -1
- package/src/analyzers/JavaScriptAnalyzer.js +1 -1
- package/src/analyzers/PrettierFormatter.js +1 -1
- package/src/analyzers/PythonAnalyzer.js +1 -1
- package/src/analyzers/SecurityAnalyzer.js +1 -1
- package/src/analyzers/TypeScriptAnalyzer.js +1 -1
- package/src/analyzers/codeCloneDetector/analyzer.js +1 -1
- package/src/analyzers/codeCloneDetector/detector.js +1 -1
- package/src/analyzers/codeCloneDetector/index.js +1 -1
- package/src/analyzers/codeCloneDetector/parser.js +1 -1
- package/src/analyzers/codeCloneDetector/reporter.js +1 -1
- package/src/analyzers/codeCloneDetector/scanner.js +1 -1
- package/src/core/agentPool.js +1 -1
- package/src/core/agentScheduler.js +1 -1
- package/src/core/contextManager.js +1 -1
- package/src/core/messageProcessor.js +1 -1
- package/src/core/orchestrator.js +1 -1
- package/src/core/stateManager.js +1 -1
- package/src/index.js +1 -1
- package/src/interfaces/cli.js +1 -1
- package/src/interfaces/terminal/__tests__/smoke/advancedFeatures.test.js +1 -1
- package/src/interfaces/terminal/__tests__/smoke/agentControl.test.js +1 -1
- package/src/interfaces/terminal/__tests__/smoke/agents.test.js +1 -1
- package/src/interfaces/terminal/__tests__/smoke/components.test.js +1 -1
- package/src/interfaces/terminal/__tests__/smoke/connection.test.js +1 -1
- package/src/interfaces/terminal/__tests__/smoke/enhancements.test.js +1 -1
- package/src/interfaces/terminal/__tests__/smoke/imports.test.js +1 -1
- package/src/interfaces/terminal/__tests__/smoke/messages.test.js +1 -1
- package/src/interfaces/terminal/__tests__/smoke/tools.test.js +1 -1
- package/src/interfaces/terminal/api/apiClient.js +1 -1
- package/src/interfaces/terminal/api/messageRouter.js +1 -1
- package/src/interfaces/terminal/api/session.js +1 -1
- package/src/interfaces/terminal/api/websocket.js +1 -1
- package/src/interfaces/terminal/components/AgentCreator.js +1 -1
- package/src/interfaces/terminal/components/AgentEditor.js +1 -1
- package/src/interfaces/terminal/components/AgentSwitcher.js +1 -1
- package/src/interfaces/terminal/components/ErrorBoundary.js +1 -1
- package/src/interfaces/terminal/components/ErrorPanel.js +1 -1
- package/src/interfaces/terminal/components/Header.js +1 -1
- package/src/interfaces/terminal/components/HelpPanel.js +1 -1
- package/src/interfaces/terminal/components/InputBox.js +1 -1
- package/src/interfaces/terminal/components/Layout.js +1 -1
- package/src/interfaces/terminal/components/LoadingSpinner.js +1 -1
- package/src/interfaces/terminal/components/MessageList.js +1 -1
- package/src/interfaces/terminal/components/MultilineTextInput.js +1 -1
- package/src/interfaces/terminal/components/SearchPanel.js +1 -1
- package/src/interfaces/terminal/components/SettingsPanel.js +1 -1
- package/src/interfaces/terminal/components/StatusBar.js +1 -1
- package/src/interfaces/terminal/components/TextInput.js +1 -1
- package/src/interfaces/terminal/config/agentEditorConstants.js +1 -1
- package/src/interfaces/terminal/config/constants.js +1 -1
- package/src/interfaces/terminal/index.js +1 -1
- package/src/interfaces/terminal/state/useAgentControl.js +1 -1
- package/src/interfaces/terminal/state/useAgents.js +1 -1
- package/src/interfaces/terminal/state/useConnection.js +1 -1
- package/src/interfaces/terminal/state/useMessages.js +1 -1
- package/src/interfaces/terminal/state/useTools.js +1 -1
- package/src/interfaces/terminal/utils/debugLogger.js +1 -1
- package/src/interfaces/terminal/utils/settingsStorage.js +1 -1
- package/src/interfaces/terminal/utils/theme.js +1 -1
- package/src/interfaces/webServer.js +1 -1
- package/src/modules/fileExplorer/controller.js +1 -1
- package/src/modules/fileExplorer/index.js +1 -1
- package/src/modules/fileExplorer/middleware.js +1 -1
- package/src/modules/fileExplorer/routes.js +1 -1
- package/src/services/agentActivityService.js +1 -1
- package/src/services/aiService.js +1 -1
- package/src/services/apiKeyManager.js +1 -1
- package/src/services/benchmarkService.js +1 -1
- package/src/services/budgetService.js +1 -1
- package/src/services/contextInjectionService.js +1 -1
- package/src/services/conversationCompactionService.js +1 -1
- package/src/services/errorHandler.js +1 -1
- package/src/services/fileAttachmentService.js +1 -1
- package/src/services/modelRouterService.js +1 -1
- package/src/services/modelsService.js +1 -1
- package/src/services/qualityInspector.js +1 -1
- package/src/services/tokenCountingService.js +1 -1
- package/src/tools/agentCommunicationTool.js +1 -1
- package/src/tools/agentDelayTool.js +1 -1
- package/src/tools/asyncToolManager.js +1 -1
- package/src/tools/baseTool.js +1 -1
- package/src/tools/browserTool.js +1 -1
- package/src/tools/cloneDetectionTool.js +1 -1
- package/src/tools/dependencyResolverTool.js +1 -1
- package/src/tools/fileContentReplaceTool.js +1 -1
- package/src/tools/fileSystemTool.js +1 -1
- package/src/tools/fileTreeTool.js +1 -1
- package/src/tools/imageTool.js +1 -1
- package/src/tools/importAnalyzerTool.js +1 -1
- package/src/tools/jobDoneTool.js +1 -1
- package/src/tools/seekTool.js +1 -1
- package/src/tools/staticAnalysisTool.js +1 -1
- package/src/tools/taskManagerTool.js +1 -1
- package/src/tools/terminalTool.js +1 -1
- package/src/tools/webTool.js +1 -1
- package/src/types/agent.js +1 -1
- package/src/types/contextReference.js +1 -1
- package/src/types/conversation.js +1 -1
- package/src/types/toolCommand.js +1 -1
- package/src/utilities/attachmentValidator.js +1 -1
- package/src/utilities/configManager.js +1 -1
- package/src/utilities/constants.js +1 -1
- package/src/utilities/directoryAccessManager.js +1 -1
- package/src/utilities/fileProcessor.js +1 -1
- package/src/utilities/logger.js +1 -1
- package/src/utilities/tagParser.js +1 -1
- package/src/utilities/toolConstants.js +1 -1
- package/src/utilities/userDataDir.js +1 -1
- package/web-ui/build/index.html +1 -1
- package/web-ui/build/static/{index-DL2-PyNX.js → index-CcwO7jS4.js} +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a0_0x44e892=a0_0x15cc;(function(_0x2d63d0,_0x49f711){const _0x466ddd=a0_0x15cc,_0x3aaf1a=_0x2d63d0();while(!![]){try{const _0xffdaac=parseInt(_0x466ddd(0x102))/0x1*(-parseInt(_0x466ddd(0x100))/0x2)+parseInt(_0x466ddd(0x111))/0x3+-parseInt(_0x466ddd(0x10b))/0x4*(-parseInt(_0x466ddd(0x10d))/0x5)+-parseInt(_0x466ddd(0xdf))/0x6+-parseInt(_0x466ddd(0xfb))/0x7*(-parseInt(_0x466ddd(0xdd))/0x8)+-parseInt(_0x466ddd(0xf4))/0x9*(parseInt(_0x466ddd(0xea))/0xa)+parseInt(_0x466ddd(0xe4))/0xb*(-parseInt(_0x466ddd(0x10c))/0xc);if(_0xffdaac===_0x49f711)break;else _0x3aaf1a['push'](_0x3aaf1a['shift']());}catch(_0x4d7c7d){_0x3aaf1a['push'](_0x3aaf1a['shift']());}}}(a0_0x5b8c,0xed40e));import a0_0x49145a from'typescript';function a0_0x5b8c(){const _0x408f62=['u3vNz2vZDgLVBG','y2HHCMfJDgvY','C2v2zxjPDhK','BgvUz3rO','BwvZC2fNzq','mJi1nhHfq1PhBa','sMf2yvnJCMLWDcbHBMfSExnPCYbMywLSzwq','u2nYAxb0vgfYz2v0','y3jLyxrLuhjVz3jHBq','y3jLyxrLu291CMnLrMLSzq','mJCZntyXmLn5ENPLta','z2v0u3LUDgfJDgLJrgLHz25VC3rPy3m','mujVugDMqW','BwvZC2fNzvrLEhq','u2vTyw50AwmGyw5HBhLZAxmGC2TPChbLza','vfLqrq','tw9KDwXLs2LUza','u3LUDgf4igvYCM9Y','y29Kzq','zM9YBwf0rgLHz25VC3rPyW','C3rHCNq','ntK4nZzODhfmDMO','nJKZotzOsw5rrNa','nJaWEuH5q2Lx','ChvZAa','v0fstKLorW','u0vwrvjjvfK','nda0mdaZn2XdwfzPtG','tw9KDwXLuMvZB2X1DgLVBKTPBMq','mti4mdHNB1LbzuO','Aw5JBhvKzxm','nJi4nZrRB0Pfqui','zgvIDwC','Bg9Nz2vY','tgf0zxn0','CgfYC2veAwfNBM9ZDgLJCW','mte3n01vEgTUEG','q0furuDpuLK','z2v0u2vTyw50AwneAwfNBM9ZDgLJCW','uMvHy3q','BgLUzq','su1qt1ju','mJuWtwDkDxv1','u1Lovefy','zMLSzq','Dg9mB3DLCKnHC2u','zxjYB3i','y2fUBM90igzPBMqGBw9KDwXL','sNn4rw1PDa','zMLSzu5HBwu','y29TCgLSzxjpChrPB25Z','rvjst1i','mJq4mJy1DxnktLPk','zMLSDgvY'];a0_0x5b8c=function(){return _0x408f62;};return a0_0x5b8c();}function a0_0x15cc(_0xc8238d,_0xc785d1){_0xc8238d=_0xc8238d-0xdc;const _0x5b8ced=a0_0x5b8c();let _0x15cc6d=_0x5b8ced[_0xc8238d];if(a0_0x15cc['KzhjuX']===undefined){var _0x6eb4f3=function(_0x4d0a0a){const _0x325323='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x49145a='',_0x385104='';for(let _0x4006ad=0x0,_0x375b5b,_0x48a2c3,_0x52d214=0x0;_0x48a2c3=_0x4d0a0a['charAt'](_0x52d214++);~_0x48a2c3&&(_0x375b5b=_0x4006ad%0x4?_0x375b5b*0x40+_0x48a2c3:_0x48a2c3,_0x4006ad++%0x4)?_0x49145a+=String['fromCharCode'](0xff&_0x375b5b>>(-0x2*_0x4006ad&0x6)):0x0){_0x48a2c3=_0x325323['indexOf'](_0x48a2c3);}for(let _0x114691=0x0,_0x2205c8=_0x49145a['length'];_0x114691<_0x2205c8;_0x114691++){_0x385104+='%'+('00'+_0x49145a['charCodeAt'](_0x114691)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x385104);};a0_0x15cc['OGlIKl']=_0x6eb4f3,a0_0x15cc['XBlnHA']={},a0_0x15cc['KzhjuX']=!![];}const _0xd4a2c8=_0x5b8ced[0x0],_0x7564c1=_0xc8238d+_0xd4a2c8,_0x1e1273=a0_0x15cc['XBlnHA'][_0x7564c1];return!_0x1e1273?(_0x15cc6d=a0_0x15cc['OGlIKl'](_0x15cc6d),a0_0x15cc['XBlnHA'][_0x7564c1]=_0x15cc6d):_0x15cc6d=_0x1e1273,_0x15cc6d;}import a0_0x385104 from'path';import{STATIC_ANALYSIS}from'../utilities/constants.js';class JavaScriptAnalyzer{constructor(_0x4006ad=null){const _0x312253=a0_0x15cc;this['logger']=_0x4006ad,this[_0x312253(0xf2)]={'allowJs':!![],'checkJs':!![],'noEmit':!![],'jsx':a0_0x49145a[_0x312253(0xf0)][_0x312253(0xe7)],'target':a0_0x49145a[_0x312253(0xfd)][_0x312253(0xe2)],'module':a0_0x49145a[_0x312253(0x106)]['ESNext'],'moduleResolution':a0_0x49145a[_0x312253(0xdc)]['NodeJs'],'esModuleInterop':!![],'skipLibCheck':!![],'strict':![],'noImplicitAny':![]};}async['analyze'](_0x375b5b,_0x48a2c3,_0x52d214={}){const _0x481b14=a0_0x15cc;try{const _0x114691=[],_0x2205c8=a0_0x49145a[_0x481b14(0xff)](_0x375b5b,_0x48a2c3,a0_0x49145a['ScriptTarget']['Latest'],!![]),_0x180b90=this[_0x481b14(0x101)](_0x2205c8);_0x114691[_0x481b14(0x10e)](..._0x180b90);const _0x2fc87a=await this[_0x481b14(0xe6)](_0x375b5b,_0x48a2c3);return _0x114691[_0x481b14(0x10e)](..._0x2fc87a),this[_0x481b14(0xe1)]?.['debug']('JavaScript\x20analysis\x20completed',{'file':_0x375b5b,'totalDiagnostics':_0x114691[_0x481b14(0xf9)],'errors':_0x114691[_0x481b14(0xf5)](_0x2a25df=>_0x2a25df['severity']===STATIC_ANALYSIS['SEVERITY']['ERROR'])['length'],'warnings':_0x114691[_0x481b14(0xf5)](_0x4794ae=>_0x4794ae[_0x481b14(0xf8)]===STATIC_ANALYSIS['SEVERITY']['WARNING'])[_0x481b14(0xf9)]}),_0x114691;}catch(_0x2192ef){return this[_0x481b14(0xe1)]?.[_0x481b14(0xee)](_0x481b14(0xfc),{'file':_0x375b5b,'error':_0x2192ef[_0x481b14(0xfa)]}),[{'file':_0x375b5b,'line':0x0,'column':0x0,'severity':STATIC_ANALYSIS['SEVERITY'][_0x481b14(0xf3)],'rule':'analyzer-error','message':'Analysis\x20failed:\x20'+_0x2192ef['message'],'category':STATIC_ANALYSIS[_0x481b14(0xe5)][_0x481b14(0xeb)]}];}}[a0_0x44e892(0x101)](_0x2f12eb){const _0x2a2f21=a0_0x44e892,_0x43616f=[],_0x25a6bf=_0x7ec4b4=>{const _0x12a161=a0_0x15cc;if(_0x7ec4b4['kind']===a0_0x49145a['SyntaxKind']['Unknown']){const _0x3ce930=_0x2f12eb['getLineAndCharacterOfPosition'](_0x7ec4b4['getStart']());_0x43616f['push']({'file':_0x2f12eb['fileName'],'line':_0x3ce930[_0x12a161(0xe8)]+0x1,'column':_0x3ce930['character']+0x1,'severity':STATIC_ANALYSIS['SEVERITY']['ERROR'],'rule':'syntax-error','message':_0x12a161(0x107),'category':STATIC_ANALYSIS['CATEGORY']['SYNTAX'],'fixable':![]});}a0_0x49145a['forEachChild'](_0x7ec4b4,_0x25a6bf);};_0x25a6bf(_0x2f12eb);if(_0x2f12eb['parseDiagnostics']&&_0x2f12eb['parseDiagnostics'][_0x2a2f21(0xf9)]>0x0)for(const _0xf6237b of _0x2f12eb[_0x2a2f21(0xe3)]){_0x43616f[_0x2a2f21(0x10e)](this[_0x2a2f21(0x109)](_0xf6237b,_0x2f12eb));}return _0x43616f;}async[a0_0x44e892(0xe6)](_0x57d600,_0x4bf23a){const _0x5a494b=a0_0x44e892,_0xf1d632=[];try{const _0x58638b=a0_0x49145a[_0x5a494b(0xff)](_0x57d600,_0x4bf23a,a0_0x49145a[_0x5a494b(0xfd)]['Latest'],!![]),_0x4ea1ce={'getSourceFile':_0x1cbafb=>{if(_0x1cbafb===_0x57d600)return _0x58638b;return undefined;},'getDefaultLibFileName':()=>'lib.d.ts','writeFile':()=>{},'getCurrentDirectory':()=>a0_0x385104['dirname'](_0x57d600),'getDirectories':()=>[],'fileExists':_0x27cd76=>_0x27cd76===_0x57d600,'readFile':_0x583aad=>{if(_0x583aad===_0x57d600)return _0x4bf23a;return undefined;},'getCanonicalFileName':_0x4a9977=>_0x4a9977,'useCaseSensitiveFileNames':()=>!![],'getNewLine':()=>'\x0a'},_0x3f6922=a0_0x49145a[_0x5a494b(0xfe)]({'rootNames':[_0x57d600],'options':this[_0x5a494b(0xf2)],'host':_0x4ea1ce}),_0x15c986=_0x3f6922[_0x5a494b(0xe6)](_0x58638b);for(const _0x515a80 of _0x15c986){_0xf1d632['push'](this['formatDiagnostic'](_0x515a80,_0x58638b));}}catch(_0x254a40){this['logger']?.[_0x5a494b(0xe0)](_0x5a494b(0x104),{'file':_0x57d600,'reason':_0x254a40[_0x5a494b(0xfa)]});}return _0xf1d632;}[a0_0x44e892(0x109)](_0x4baa83,_0xff8f7c){const _0x100495=a0_0x44e892;let _0x591e0e=0x0,_0x287bfe=0x0;if(_0x4baa83[_0x100495(0xec)]&&_0x4baa83['start']!==undefined){const _0x137037=_0x4baa83[_0x100495(0xec)]['getLineAndCharacterOfPosition'](_0x4baa83[_0x100495(0x10a)]);_0x591e0e=_0x137037['line']+0x1,_0x287bfe=_0x137037['character']+0x1;}else{if(_0xff8f7c&&_0x4baa83['start']!==undefined){const _0x11e6b8=_0xff8f7c['getLineAndCharacterOfPosition'](_0x4baa83['start']);_0x591e0e=_0x11e6b8[_0x100495(0xe8)]+0x1,_0x287bfe=_0x11e6b8[_0x100495(0xf7)]+0x1;}}const _0x32d8cb=a0_0x49145a['flattenDiagnosticMessageText'](_0x4baa83[_0x100495(0x103)],'\x0a');let _0x51ef71;switch(_0x4baa83['category']){case a0_0x49145a['DiagnosticCategory']['Error']:_0x51ef71=STATIC_ANALYSIS['SEVERITY'][_0x100495(0xf3)];break;case a0_0x49145a['DiagnosticCategory']['Warning']:_0x51ef71=STATIC_ANALYSIS['SEVERITY'][_0x100495(0x10f)];break;case a0_0x49145a['DiagnosticCategory']['Message']:case a0_0x49145a['DiagnosticCategory'][_0x100495(0xf6)]:_0x51ef71=STATIC_ANALYSIS[_0x100495(0x110)]['INFO'];break;default:_0x51ef71=STATIC_ANALYSIS['SEVERITY']['ERROR'];}let _0x2365e5=STATIC_ANALYSIS['CATEGORY'][_0x100495(0xeb)];const _0x27cdfa=_0x4baa83[_0x100495(0x108)];if(_0x27cdfa>=0x7d0&&_0x27cdfa<0xbb8)_0x2365e5=STATIC_ANALYSIS['CATEGORY'][_0x100495(0x105)];else{if(_0x27cdfa>=0x3e8&&_0x27cdfa<0x7d0)_0x2365e5=STATIC_ANALYSIS['CATEGORY']['SYNTAX'];else _0x27cdfa>=0x8fc&&_0x27cdfa<0x960&&(_0x2365e5=STATIC_ANALYSIS['CATEGORY']['IMPORT']);}return(_0x32d8cb[_0x100495(0xed)]()['includes'](_0x100495(0xef))||_0x32d8cb[_0x100495(0xed)]()[_0x100495(0xde)]('import'))&&(_0x2365e5=STATIC_ANALYSIS[_0x100495(0xe5)][_0x100495(0xe9)]),{'file':_0x4baa83[_0x100495(0xec)]?.[_0x100495(0xf1)]||_0xff8f7c?.['fileName']||'unknown','line':_0x591e0e,'column':_0x287bfe,'severity':_0x51ef71,'rule':'TS'+_0x27cdfa,'message':_0x32d8cb,'category':_0x2365e5,'fixable':![],'code':_0x4baa83['code']};}}export default JavaScriptAnalyzer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a0_0x488e76=a0_0x52a5;(function(_0x28c0d9,_0x5bd60b){const _0x5f43a2=a0_0x52a5,_0x5b63a5=_0x28c0d9();while(!![]){try{const _0x5d40b6=parseInt(_0x5f43a2(0x91))/0x1+parseInt(_0x5f43a2(0x86))/0x2+-parseInt(_0x5f43a2(0x79))/0x3+parseInt(_0x5f43a2(0x82))/0x4+-parseInt(_0x5f43a2(0x81))/0x5*(parseInt(_0x5f43a2(0x8b))/0x6)+-parseInt(_0x5f43a2(0x89))/0x7*(parseInt(_0x5f43a2(0x6e))/0x8)+parseInt(_0x5f43a2(0x6a))/0x9;if(_0x5d40b6===_0x5bd60b)break;else _0x5b63a5['push'](_0x5b63a5['shift']());}catch(_0x4799e7){_0x5b63a5['push'](_0x5b63a5['shift']());}}}(a0_0x300a,0x21853));import a0_0x4585fd from'prettier';import a0_0x12f3b4 from'path';import a0_0x1417a3 from'fs/promises';function a0_0x52a5(_0x26f893,_0x1aeca2){_0x26f893=_0x26f893-0x69;const _0x300adb=a0_0x300a();let _0x52a5d6=_0x300adb[_0x26f893];if(a0_0x52a5['WoanTU']===undefined){var _0x3cb3cc=function(_0x57657c){const _0x26e088='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4585fd='',_0x12f3b4='';for(let _0x1417a3=0x0,_0x2f68ba,_0xf641fd,_0x307213=0x0;_0xf641fd=_0x57657c['charAt'](_0x307213++);~_0xf641fd&&(_0x2f68ba=_0x1417a3%0x4?_0x2f68ba*0x40+_0xf641fd:_0xf641fd,_0x1417a3++%0x4)?_0x4585fd+=String['fromCharCode'](0xff&_0x2f68ba>>(-0x2*_0x1417a3&0x6)):0x0){_0xf641fd=_0x26e088['indexOf'](_0xf641fd);}for(let _0x4d8ac8=0x0,_0x255abc=_0x4585fd['length'];_0x4d8ac8<_0x255abc;_0x4d8ac8++){_0x12f3b4+='%'+('00'+_0x4585fd['charCodeAt'](_0x4d8ac8)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x12f3b4);};a0_0x52a5['gyMeRq']=_0x3cb3cc,a0_0x52a5['FlLwtA']={},a0_0x52a5['WoanTU']=!![];}const _0x33a510=_0x300adb[0x0],_0x1bd25f=_0x26f893+_0x33a510,_0x183794=a0_0x52a5['FlLwtA'][_0x1bd25f];return!_0x183794?(_0x52a5d6=a0_0x52a5['gyMeRq'](_0x52a5d6),a0_0x52a5['FlLwtA'][_0x1bd25f]=_0x52a5d6):_0x52a5d6=_0x183794,_0x52a5d6;}class PrettierFormatter{constructor(_0x2f68ba=null){const _0x47dc33=a0_0x52a5;this[_0x47dc33(0x87)]=_0x2f68ba,this['configCache']=new Map();}async[a0_0x488e76(0x7a)](_0xf641fd,_0x307213,_0x4d8ac8={}){const _0x5ac5d5=a0_0x488e76;try{const _0x255abc=await this['getPrettierConfig'](_0xf641fd,_0x4d8ac8[_0x5ac5d5(0x7e)]),_0x49a2b5=this['getParser'](_0xf641fd),_0x4a3c9f=await a0_0x4585fd[_0x5ac5d5(0x7a)](_0x307213,{..._0x255abc,'filepath':_0xf641fd,'parser':_0x49a2b5}),_0x350e76=_0x4a3c9f!==_0x307213;return{'formatted':_0x350e76,'content':_0x4a3c9f,'original':_0x307213,'changes':_0x350e76?this[_0x5ac5d5(0x83)](_0x307213,_0x4a3c9f):[],'linesChanged':_0x350e76?this['countChangedLines'](_0x307213,_0x4a3c9f):0x0};}catch(_0x5d5a55){this['logger']?.[_0x5ac5d5(0x71)](_0x5ac5d5(0x76),{'file':_0xf641fd,'error':_0x5d5a55[_0x5ac5d5(0x6b)]});throw new Error('Prettier\x20formatting\x20failed:\x20'+_0x5d5a55['message']);}}async[a0_0x488e76(0x6f)](_0x1938ab,_0x33272f,_0x1382ac={}){const _0x313f13=a0_0x488e76;try{const _0x280fd0=await this['getPrettierConfig'](_0x1938ab,_0x1382ac[_0x313f13(0x7e)]),_0xe05a07=this[_0x313f13(0x8d)](_0x1938ab),_0x4c9c62=await a0_0x4585fd['format'](_0x33272f,{..._0x280fd0,'filepath':_0x1938ab,'parser':_0xe05a07});return _0x4c9c62!==_0x33272f;}catch(_0x1366e3){return this[_0x313f13(0x87)]?.[_0x313f13(0x7b)](_0x313f13(0x6d),{'file':_0x1938ab,'error':_0x1366e3[_0x313f13(0x6b)]}),![];}}async[a0_0x488e76(0x85)](_0x13dc21,_0x51e7e7){const _0x514d46=a0_0x488e76,_0x4d6f06=_0x51e7e7||a0_0x12f3b4['dirname'](_0x13dc21);if(this[_0x514d46(0x7f)]['has'](_0x4d6f06))return this['configCache']['get'](_0x4d6f06);let _0x42747e={};if(_0x51e7e7)try{const _0x54342e=await a0_0x4585fd['resolveConfig'](_0x13dc21,{'config':_0x51e7e7});_0x54342e&&(this['logger']?.[_0x514d46(0x88)](_0x514d46(0x7d),{'workingDir':_0x51e7e7}),_0x42747e=_0x54342e);}catch(_0x538525){this[_0x514d46(0x87)]?.['debug']('No Prettier config found, using defaults');}const defaultConfig={'semi':!![],'singleQuote':!![],'tabWidth':0x2,'trailingComma':_0x514d46(0x6c),'printWidth':0x64,'arrowParens':_0x514d46(0x72),'endOfLine':'lf',..._0x42747e};return this['configCache'][_0x514d46(0x78)](_0x4d6f06,defaultConfig),defaultConfig;}[a0_0x488e76(0x8d)](_0xc30eda){const _0x3e2735=a0_0x488e76,_0x533439=a0_0x12f3b4['extname'](_0xc30eda)['toLowerCase'](),_0x6f4fd5={'.js':'babel','.jsx':_0x3e2735(0x70),'.mjs':_0x3e2735(0x70),'.cjs':_0x3e2735(0x70),'.ts':_0x3e2735(0x80),'.tsx':_0x3e2735(0x80),'.json':_0x3e2735(0x75),'.json5':'json5','.css':'css','.scss':'scss','.less':'less','.html':'html','.vue':_0x3e2735(0x8e),'.md':'markdown','.yaml':_0x3e2735(0x92),'.yml':_0x3e2735(0x92)};return _0x6f4fd5[_0x533439]||_0x3e2735(0x70);}[a0_0x488e76(0x83)](_0x23dfbd,_0x14ee91){const _0x231b9a=a0_0x488e76,_0x2af6bd=[],_0x4eaa31=_0x23dfbd[_0x231b9a(0x84)]('\x0a'),_0x3cfbc4=_0x14ee91['split']('\x0a'),_0x3449eb=Math[_0x231b9a(0x8c)](_0x4eaa31[_0x231b9a(0x69)],_0x3cfbc4[_0x231b9a(0x69)]);for(let _0x3bb0a1=0x0;_0x3bb0a1<_0x3449eb;_0x3bb0a1++){const _0x5d4941=_0x4eaa31[_0x3bb0a1],_0x586b5a=_0x3cfbc4[_0x3bb0a1];_0x5d4941!==_0x586b5a&&_0x2af6bd['push']({'line':_0x3bb0a1+0x1,'type':_0x5d4941!==undefined&&_0x586b5a!==undefined?'modified':_0x5d4941!==undefined?'removed':_0x231b9a(0x77),'original':_0x5d4941||'','formatted':_0x586b5a||''});}return _0x2af6bd;}['countChangedLines'](_0x207e29,_0x1bc0b8){const _0x18cace=a0_0x488e76,_0x507e22=_0x207e29['split']('\x0a'),_0x31b0ca=_0x1bc0b8[_0x18cace(0x84)]('\x0a');let _0x6f9a5f=0x0;const _0x8aeb67=Math[_0x18cace(0x8c)](_0x507e22[_0x18cace(0x69)],_0x31b0ca['length']);for(let _0x2c9ff1=0x0;_0x2c9ff1<_0x8aeb67;_0x2c9ff1++){_0x507e22[_0x2c9ff1]!==_0x31b0ca[_0x2c9ff1]&&_0x6f9a5f++;}return _0x6f9a5f;}['getSupportedExtensions'](){const _0x477f8c=a0_0x488e76;return['.js','.jsx','.mjs',_0x477f8c(0x90),'.ts','.tsx',_0x477f8c(0x8a),'.json5','.css','.scss',_0x477f8c(0x8f),_0x477f8c(0x7c),'.vue',_0x477f8c(0x74),'.yaml','.yml'];}[a0_0x488e76(0x73)](_0x1de092){const _0x5b2569=a0_0x12f3b4['extname'](_0x1de092)['toLowerCase']();return this['getSupportedExtensions']()['includes'](_0x5b2569);}}export default PrettierFormatter;function a0_0x300a(){const _0x4f2f6a=['lM1K','ANnVBG','uhjLDhrPzxiGzM9YBwf0DgLUzYbMywLSzwq','ywrKzwq','C2v0','nZeWnti2wuzSCMHW','zM9YBwf0','D2fYBG','lMH0BwW','rM91BMqGuhjLDhrPzxiGy29UzMLN','D29YA2LUz0rPCG','y29UzMLNq2fJAgu','DhLWzxnJCMLWDa','nde1vurir0ff','ntq5otCYAuTrBgfj','zgvZy3jPyMvdAgfUz2vZ','C3bSAxq','z2v0uhjLDhrPzxjdB25MAwC','nde1mZyYy1bYA0T2','Bg9Nz2vY','zgvIDwC','odm3odnJEhP4q0m','lMPZB24','mtu3otHcBMzkA1q','Bwf4','z2v0ugfYC2vY','DNvL','lMXLC3m','lMnQCW','mJyYmtf4uLDTwLK','EwfTBa','BgvUz3rO','mJC0ntCWmNvQs3bqtG','BwvZC2fNzq','zxm1','uhjLDhrPzxiGy2HLy2SGzMfPBgvK','ntzVwMDuDMC','y2HLy2S','yMfIzwW','zxjYB3i','yxzVAwq','AxntDxbWB3j0zwq'];a0_0x300a=function(){return _0x4f2f6a;};return a0_0x300a();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a0_0x177b5d=a0_0x7d5f;(function(_0x1d6abc,_0xff34af){const _0xb9806=a0_0x7d5f,_0x34df63=_0x1d6abc();while(!![]){try{const _0x47d0be=-parseInt(_0xb9806(0x18e))/0x1*(parseInt(_0xb9806(0x18a))/0x2)+parseInt(_0xb9806(0x191))/0x3+-parseInt(_0xb9806(0x171))/0x4+parseInt(_0xb9806(0x17a))/0x5+parseInt(_0xb9806(0x17b))/0x6*(parseInt(_0xb9806(0x187))/0x7)+-parseInt(_0xb9806(0x168))/0x8*(parseInt(_0xb9806(0x18b))/0x9)+parseInt(_0xb9806(0x170))/0xa*(parseInt(_0xb9806(0x184))/0xb);if(_0x47d0be===_0xff34af)break;else _0x34df63['push'](_0x34df63['shift']());}catch(_0x3fc692){_0x34df63['push'](_0x34df63['shift']());}}}(a0_0x2660,0xe37a8));import{spawn}from'child_process';function a0_0x7d5f(_0x10fef1,_0x449125){_0x10fef1=_0x10fef1-0x165;const _0x266093=a0_0x2660();let _0x7d5fd8=_0x266093[_0x10fef1];if(a0_0x7d5f['RbHftx']===undefined){var _0x1280a5=function(_0x3ccff9){const _0xde6aa1='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4697f6='',_0x273f75='';for(let _0x54d114=0x0,_0x3d9859,_0x4049ee,_0x200215=0x0;_0x4049ee=_0x3ccff9['charAt'](_0x200215++);~_0x4049ee&&(_0x3d9859=_0x54d114%0x4?_0x3d9859*0x40+_0x4049ee:_0x4049ee,_0x54d114++%0x4)?_0x4697f6+=String['fromCharCode'](0xff&_0x3d9859>>(-0x2*_0x54d114&0x6)):0x0){_0x4049ee=_0xde6aa1['indexOf'](_0x4049ee);}for(let _0x24b14d=0x0,_0x281461=_0x4697f6['length'];_0x24b14d<_0x281461;_0x24b14d++){_0x273f75+='%'+('00'+_0x4697f6['charCodeAt'](_0x24b14d)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x273f75);};a0_0x7d5f['cYIfMt']=_0x1280a5,a0_0x7d5f['LbKccx']={},a0_0x7d5f['RbHftx']=!![];}const _0x896d9d=_0x266093[0x0],_0x197526=_0x10fef1+_0x896d9d,_0x540db9=a0_0x7d5f['LbKccx'][_0x197526];return!_0x540db9?(_0x7d5fd8=a0_0x7d5f['cYIfMt'](_0x7d5fd8),a0_0x7d5f['LbKccx'][_0x197526]=_0x7d5fd8):_0x7d5fd8=_0x540db9,_0x7d5fd8;}function a0_0x2660(){const _0x226598=['uhL0Ag9UigfUywX5C2LZigzHAwXLza','ChvZAa','ntm2nZC2ogHHBxLVCa','CNvUq29TBwfUza','v0fstKLorW','mtuZmJaWneD0sfDZuW','mtq2nJu5nZDUvxrAEeO','rM91BMqGuhL0Ag9UignVBw1HBMq','lNb5','mMfiqNroBW','Dw5SAw5R','BgLUzq','ndu2nJqWmMTXweTNqG','BwvZC2fNzq','Dg1WzgLY','y2XVC2u','uhL0Ag9UigfUywX5C2LZignVBxbSzxrLza','ohb0DLLkBW','C3vWCg9YDhnbDxrVrML4','DxrMltG','D3jPDgvgAwXL','Bg9Nz2vY','Dgv4Da','q0furuDpuLK','zxjYB3jZ','mtbYChPirNO','mtu0mJy0ng1Izhn6qW','D2fYBG','yw5HBhL6zq','u0vwrvjjvfK','BgvUz3rO','C2v2zxjPDhK','rvjst1i','ChL0Ag9Uq29TBwfUza','z2v0u3vWCg9YDgvKrxH0zw5ZAw9UCW','ntuZmZK2nwfRyM1UBW','nMPNsfPZAa','BM93','y2HLy2TtEw50yxG','q29TBwfUzcb0Aw1LB3v0','zgf0yq','CNvUuhL0Ag9Uu2nYAxb0','Dg9tDhjPBMC','zgvIDwC','C3rKB3v0','mte5mtu0mdLMwKvmDha'];a0_0x2660=function(){return _0x226598;};return a0_0x2660();}import{STATIC_ANALYSIS}from'../utilities/constants.js';import a0_0x4697f6 from'fs/promises';import a0_0x273f75 from'path';import a0_0x54d114 from'os';class PythonAnalyzer{constructor(_0x3d9859=null){this['logger']=_0x3d9859,this['pythonCommand']=null;}async[a0_0x177b5d(0x173)](_0x4049ee,_0x200215,_0x24b14d={}){const _0x49b776=a0_0x177b5d;try{const _0x281461=[],_0x395770=await this['getPythonCommand']();if(!_0x395770)return this['logger']?.[_0x49b776(0x172)]('Python\x20not\x20available,\x20skipping\x20analysis'),[];const _0x4c7e8b=await this[_0x49b776(0x17d)](_0x4049ee,_0x200215,_0x395770);return _0x281461[_0x49b776(0x186)](..._0x4c7e8b),this[_0x49b776(0x16c)]?.[_0x49b776(0x182)](_0x49b776(0x167),{'file':_0x4049ee,'totalDiagnostics':_0x281461['length'],'errors':_0x281461['filter'](_0x170e41=>_0x170e41['severity']===STATIC_ANALYSIS[_0x49b776(0x174)][_0x49b776(0x177)])['length'],'warnings':_0x281461['filter'](_0x2183a5=>_0x2183a5[_0x49b776(0x176)]===STATIC_ANALYSIS[_0x49b776(0x174)][_0x49b776(0x189)])[_0x49b776(0x175)]}),_0x281461;}catch(_0x3fd34b){return this['logger']?.['error'](_0x49b776(0x185),{'file':_0x4049ee,'error':_0x3fd34b[_0x49b776(0x192)]}),[];}}async['checkSyntax'](_0x3bb8fc,_0x2dc25e,_0x32884f){const _0xd1d752=a0_0x177b5d,_0x108647=[],_0x27e397=a0_0x54d114[_0xd1d752(0x165)](),_0x1ea6f3=a0_0x273f75['join'](_0x27e397,'syntax_check_'+Date['now']()+_0xd1d752(0x18d)),_0x882562=a0_0x273f75['join'](_0x27e397,'target_'+Date[_0xd1d752(0x17c)]()+'.py');try{await a0_0x4697f6[_0xd1d752(0x16b)](_0x882562,_0x2dc25e,_0xd1d752(0x16a));const _0x3098e7='\x0aimport\x20ast\x0aimport\x20sys\x0aimport\x20json\x0a\x0adef\x20check_syntax(filepath):\x0a\x20\x20\x20\x20try:\x0a\x20\x20\x20\x20\x20\x20\x20\x20with\x20open(filepath,\x20\x27r\x27,\x20encoding=\x27utf-8\x27)\x20as\x20f:\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20source\x20=\x20f.read()\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20#\x20Try\x20to\x20parse\x20the\x20file\x0a\x20\x20\x20\x20\x20\x20\x20\x20ast.parse(source,\x20filename=filepath)\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20#\x20If\x20successful,\x20no\x20errors\x0a\x20\x20\x20\x20\x20\x20\x20\x20print(json.dumps({\x22success\x22:\x20True,\x20\x22errors\x22:\x20[]}))\x0a\x0a\x20\x20\x20\x20except\x20SyntaxError\x20as\x20e:\x0a\x20\x20\x20\x20\x20\x20\x20\x20error\x20=\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x22file\x22:\x20filepath,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x22line\x22:\x20e.lineno\x20or\x201,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x22column\x22:\x20e.offset\x20or\x201,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x22message\x22:\x20str(e.msg),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x22text\x22:\x20e.text.strip()\x20if\x20e.text\x20else\x20\x22\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20print(json.dumps({\x22success\x22:\x20False,\x20\x22errors\x22:\x20[error]}))\x0a\x0a\x20\x20\x20\x20except\x20Exception\x20as\x20e:\x0a\x20\x20\x20\x20\x20\x20\x20\x20error\x20=\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x22file\x22:\x20filepath,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x22line\x22:\x201,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x22column\x22:\x201,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x22message\x22:\x20str(e),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x22text\x22:\x20\x22\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20print(json.dumps({\x22success\x22:\x20False,\x20\x22errors\x22:\x20[error]}))\x0a\x0aif\x20__name__\x20==\x20\x22__main__\x22:\x0a\x20\x20\x20\x20if\x20len(sys.argv)\x20>\x201:\x0a\x20\x20\x20\x20\x20\x20\x20\x20check_syntax(sys.argv[1])\x0a\x20\x20\x20\x20else:\x0a\x20\x20\x20\x20\x20\x20\x20\x20print(json.dumps({\x22success\x22:\x20False,\x20\x22errors\x22:\x20[{\x22message\x22:\x20\x22No\x20file\x20specified\x22}]}))\x0a';await a0_0x4697f6['writeFile'](_0x1ea6f3,_0x3098e7,'utf-8');const _0x537352=await this[_0xd1d752(0x180)](_0x32884f,_0x1ea6f3,[_0x882562]);try{const _0x352e1b=JSON['parse'](_0x537352['stdout']);if(!_0x352e1b['success']&&_0x352e1b['errors'])for(const _0xb487e9 of _0x352e1b[_0xd1d752(0x16f)]){_0x108647['push']({'file':_0x3bb8fc,'line':_0xb487e9[_0xd1d752(0x190)]||0x1,'column':_0xb487e9['column']||0x1,'severity':STATIC_ANALYSIS['SEVERITY'][_0xd1d752(0x177)],'rule':'SyntaxError','message':_0xb487e9['message'],'category':STATIC_ANALYSIS[_0xd1d752(0x16e)]['SYNTAX'],'fixable':![],'source':'python-ast','code':_0xb487e9[_0xd1d752(0x16d)]||undefined});}}catch(_0x26440d){this[_0xd1d752(0x16c)]?.['warn']('Failed\x20to\x20parse\x20Python\x20syntax\x20check\x20result',{'error':_0x26440d[_0xd1d752(0x192)],'stdout':_0x537352['stdout']});}}finally{try{await a0_0x4697f6[_0xd1d752(0x18f)](_0x1ea6f3),await a0_0x4697f6[_0xd1d752(0x18f)](_0x882562);}catch{}}return _0x108647;}async['getPythonCommand'](){const _0x1005c5=a0_0x177b5d;if(this['pythonCommand'])return this[_0x1005c5(0x178)];const _0x29e7ab=['python3','python'];for(const _0x446d64 of _0x29e7ab){try{const _0x1030cb=await this[_0x1005c5(0x188)](_0x446d64,['--version']);if(_0x1030cb['success'])return this[_0x1005c5(0x178)]=_0x446d64,this[_0x1005c5(0x16c)]?.['debug'](_0x1005c5(0x18c),{'command':_0x446d64,'version':_0x1030cb[_0x1005c5(0x183)]['trim']()}),_0x446d64;}catch{}}return null;}async[a0_0x177b5d(0x180)](_0x904695,_0x106fb1,_0x2be4d7=[]){return this['runCommand'](_0x904695,[_0x106fb1,..._0x2be4d7]);}async['runCommand'](_0x57b115,_0x14c966=[],_0x29b1be={}){return new Promise((_0x421d09,_0x5656cb)=>{const _0x1ee42c=a0_0x7d5f,_0x26fe10=spawn(_0x57b115,_0x14c966,{..._0x29b1be,'shell':!![]});let _0x510e71='',_0x402824='';_0x26fe10['stdout']?.['on'](_0x1ee42c(0x17f),_0xb78fa8=>{_0x510e71+=_0xb78fa8['toString']();}),_0x26fe10['stderr']?.['on']('data',_0x35a67f=>{const _0x5a9ca7=_0x1ee42c;_0x402824+=_0x35a67f[_0x5a9ca7(0x181)]();}),_0x26fe10['on']('error',_0x570787=>{_0x5656cb(_0x570787);}),_0x26fe10['on'](_0x1ee42c(0x166),_0xcdcaea=>{_0x421d09({'success':_0xcdcaea===0x0,'code':_0xcdcaea,'stdout':_0x510e71,'stderr':_0x402824});}),setTimeout(()=>{const _0x58029b=_0x1ee42c;_0x26fe10['kill'](),_0x5656cb(new Error(_0x58029b(0x17e)));},0x2710);});}[a0_0x177b5d(0x179)](){const _0x397303=a0_0x177b5d;return[_0x397303(0x18d)];}[a0_0x177b5d(0x169)](){return![];}}export default PythonAnalyzer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a0_0x5916ed=a0_0x541f;(function(_0x420aed,_0x35a5d0){const _0x4be149=a0_0x541f,_0x4b8ef8=_0x420aed();while(!![]){try{const _0x14104a=-parseInt(_0x4be149(0x1db))/0x1+-parseInt(_0x4be149(0x19b))/0x2+-parseInt(_0x4be149(0x1e4))/0x3+-parseInt(_0x4be149(0x1eb))/0x4*(-parseInt(_0x4be149(0x183))/0x5)+parseInt(_0x4be149(0x18f))/0x6+-parseInt(_0x4be149(0x1d2))/0x7*(-parseInt(_0x4be149(0x1c0))/0x8)+parseInt(_0x4be149(0x1cd))/0x9;if(_0x14104a===_0x35a5d0)break;else _0x4b8ef8['push'](_0x4b8ef8['shift']());}catch(_0x172757){_0x4b8ef8['push'](_0x4b8ef8['shift']());}}}(a0_0x29b5,0xa708e));function a0_0x29b5(){const _0x3df2f9=['BgLUDfrLEhq','u2vTz3jLCa','BwfWtNbTu2v2zxjPDhK','zxnSAw50lxbSDwDPBI1Zzwn1CML0EsbKzxrLy3rLza','CgLWlwf1zgL0ic0TzM9YBwf0igPZB24','zxnSAw50lxbSDwDPBI1Zzwn1CML0Eq','u0vwrvjjvfK','y29Sx29MzNnLDa','tM9Uzq','u2vJDxjPDhKGDNvSBMvYywjPBgL0Eq','nJiYmtm5ngLnANrfBG','CgfJA2fNzq','DgL0Bgu','zxnSAw50lxnLy3vYAxr5','Bw9KDwXL','yMfUzgL0ic1MigPZB24GiG','CgfYC2vtzw1NCMvWuMvZDwX0CW','C2vJDxjPDhK','q1jjveLdquW','CNvSzuLK','BMfTzq','C2vTz3jLCcaTlxzLCNnPB24','mJuZodi1ofbOvfreAG','BNbTic0TDMvYC2LVBG','CNvUu2vTz3jLCa','BNbTigf1zgL0ic0TANnVBG','zxjYB3i','rMfPBgvKihrVihbHCNnLifnLBwDYzxaGB3v0Chv0','uhL0Ag9UihnLy3vYAxr5ihnJyw5Uzxi','tM8GCgfJA2fNzs5QC29UigzVDw5KlcbZA2LWCgLUzYbUCg0GyxvKAxq','rMfPBgvKihrVihbHCNnLig5WBsbHDwrPDcbVDxrWDxq','CMvTzwrPyxrPB24','DMvYC2LVBG','ChvZAa','v0fstKLorW','AMf2yxnJCMLWDa','CgfYC2u','CgfYC2voCg1bDwrPDfjLC3vSDhm','u2vTz3jLCcbZy2fUigzHAwXLza','zgv0zwn0tgfUz3vHz2u','y3DK','AxnbCNjHEq','rvjst1i','CgLWlwf1zgL0ic0TDMvYC2LVBG','C3rHCNq','AxnZDwvFDgv4Da','BwfWrvnmAw50u2v2zxjPDhK','DhLWzxnJCMLWDa','CgLWlwf1zgL0','CNvUugLWqxvKAxq','CgfJA2fNzs5QC29U','zxH0CMe','BM9Kzv9TB2r1BgvZ','yMfUzgL0ic0TDMvYC2LVBG','y29S','BwfWu2vTz3jLCfnLDMvYAxr5','Cgf0Aa','DMLH','zgLYBMfTzq','mtmXnZm0nfnwzMvUwa','DxjS','Bg93','ChL0Ag9U','BgLUzq','C291CMnL','C2v2zxjPDhK','zMLSzq','Dg9mB3DLCKnHC2u','zgvWzw5Kzw5JAwvZ','lNnJyw5UzxjZ','CMvMzxjLBMnLCW','y29SDw1U','otiYndK0nK1KDLfSzW','ywnJzxnZ','yMfUzgL0','BgLUzv9UDw1Izxi','C2vTz3jLCcaTlwnVBMzPzZ1HDxrVic0TANnVBIaI','mJfuALLQBgq','zgvZy3jPChrPB24','zgv0zwn0qxzHAwXHyMXLu2nHBM5LCNm','yw5HBhL6zvbYB2PLy3q','Dg9vChbLCKnHC2u','Bg9JywXty2fUBMvYrgLY','D2fYBG','qMfUzgL0ihnJyw5UzxiGzgv0zwn0zwq','Axnuzxn0rMLSzq','ndqYndeWrwXjAK11','BwvKAxvT','z2v0sw5ZDgfSBfjLy29TBwvUzgf0Aw9UCW','y3DL','zML4ywjSzq','BwfWqMfUzgL0u2v2zxjPDhK','u2vTz3jLCcbUB3qGyxzHAwXHyMXL','u2vTz3jLCcbZy2fUBMvYigrLDgvJDgvKicHZExn0zw0P','tM8GC2vJDxjPDhKGC2nHBM5LCNmGyxzHAwXHyMXLigzVCIbSyw5NDwfNzq','mtmYmtyXn2TcAxHRva','Bwv0ywrHDge','DNvSBNm','Bgf0zxn0','yxzHAwXHyMXLu2nHBM5LCNm','CgLWqxvKAxq','C2vTz3jLCa','mJi0mJG0BufwBvLg','zML4qxzHAwXHyMXL','CMvZDwX0CW','C3rKB3v0','DgvZDa','Bw9Yzv9PBMzV','BwfW','zw50CMLLCW','CgfYC2vcyw5KAxrszxn1BhrZ','Bg9Nz2vY','ywr2AxnVCNK','zgvIDwC','zxnSAw50u2vJDxjPDhK','CNvUqMfUzgL0','BwfWugLWqxvKAxrtzxzLCML0Eq','AgfZu2nHBM5LCNngB3jmyw5NDwfNzq','BwvZC2fNzq','BNbTqxvKAxq','CgfYC2vfu0XPBNrszxn1BhrZ','BM9YBwfSAxPLuMvZDwX0CW','CgfYC2vqAxbbDwrPDfjLC3vSDhm','AM9PBG','BNbTlq','qMfUzgL0','mJvyrMjhDKi','rvnmAw50ihnLy3vYAxr5ihnJyw4GzMfPBgvK'];a0_0x29b5=function(){return _0x3df2f9;};return a0_0x29b5();}import{exec}from'child_process';import{promisify}from'util';import a0_0x4e9488 from'path';import a0_0xd6e153 from'fs/promises';import{STATIC_ANALYSIS}from'../utilities/constants.js';const execAsync=promisify(exec);function a0_0x541f(_0x2ce869,_0x3759c8){_0x2ce869=_0x2ce869-0x181;const _0x29b5ef=a0_0x29b5();let _0x541f2d=_0x29b5ef[_0x2ce869];if(a0_0x541f['buWQvl']===undefined){var _0x4a1de5=function(_0x5f56e8){const _0x2be606='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4e9488='',_0xd6e153='';for(let _0x3f83aa=0x0,_0x20a11e,_0x20c06f,_0xb539cf=0x0;_0x20c06f=_0x5f56e8['charAt'](_0xb539cf++);~_0x20c06f&&(_0x20a11e=_0x3f83aa%0x4?_0x20a11e*0x40+_0x20c06f:_0x20c06f,_0x3f83aa++%0x4)?_0x4e9488+=String['fromCharCode'](0xff&_0x20a11e>>(-0x2*_0x3f83aa&0x6)):0x0){_0x20c06f=_0x2be606['indexOf'](_0x20c06f);}for(let _0x33c524=0x0,_0x5cf76b=_0x4e9488['length'];_0x33c524<_0x5cf76b;_0x33c524++){_0xd6e153+='%'+('00'+_0x4e9488['charCodeAt'](_0x33c524)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0xd6e153);};a0_0x541f['UUiqag']=_0x4a1de5,a0_0x541f['psovZs']={},a0_0x541f['buWQvl']=!![];}const _0x287c21=_0x29b5ef[0x0],_0x2c6cf2=_0x2ce869+_0x287c21,_0x563cd7=a0_0x541f['psovZs'][_0x2c6cf2];return!_0x563cd7?(_0x541f2d=a0_0x541f['UUiqag'](_0x541f2d),a0_0x541f['psovZs'][_0x2c6cf2]=_0x541f2d):_0x541f2d=_0x563cd7,_0x541f2d;}class SecurityAnalyzer{constructor(_0x3f83aa=null){const _0x2db04e=a0_0x541f;this[_0x2db04e(0x1f4)]=_0x3f83aa,this['availableScanners']=null,this['scannerCache']=new Map(),this['localScannerDir']=a0_0x4e9488['join'](process[_0x2db04e(0x1ad)](),_0x2db04e(0x1b9),_0x2db04e(0x1ca));}async[a0_0x5916ed(0x1d4)](){const _0x18e71d=a0_0x5916ed;if(this[_0x18e71d(0x1e8)]!==null)return this['availableScanners'];const _0x20a11e={'semgrep':![],'bandit':![],'npmAudit':![],'pipAudit':![],'eslintSecurity':![]};try{const _0x20c06f=a0_0x4e9488[_0x18e71d(0x200)](this[_0x18e71d(0x1d7)],'semgrep');try{await a0_0xd6e153['access'](_0x20c06f),_0x20a11e['semgrep']=!![],this['logger']?.['debug']('Semgrep\x20scanner\x20detected\x20(local)');}catch{await execAsync(_0x18e71d(0x19a),{'timeout':0x1388}),_0x20a11e['semgrep']=!![],this[_0x18e71d(0x1f4)]?.[_0x18e71d(0x1f6)](_0x18e71d(0x1e2));}}catch(_0xb539cf){this[_0x18e71d(0x1f4)]?.['debug'](_0x18e71d(0x1e1),{'error':_0xb539cf[_0x18e71d(0x1fb)]});}try{await execAsync(_0x18e71d(0x1ba),{'timeout':0x1388}),_0x20a11e['bandit']=!![],this['logger']?.['debug'](_0x18e71d(0x1d9));}catch(_0x33c524){this[_0x18e71d(0x1f4)]?.['debug']('Bandit\x20not\x20available',{'error':_0x33c524['message']});}try{await execAsync(_0x18e71d(0x19c),{'timeout':0x1388}),_0x20a11e[_0x18e71d(0x1fc)]=!![],this['logger']?.['debug']('npm\x20audit\x20available');}catch(_0x5cf76b){this[_0x18e71d(0x1f4)]?.['debug']('npm\x20not\x20available',{'error':_0x5cf76b['message']});}try{await execAsync(_0x18e71d(0x1b0),{'timeout':0x1388}),_0x20a11e['pipAudit']=!![],this['logger']?.['debug']('pip-audit\x20detected');}catch(_0x1780dc){this[_0x18e71d(0x1f4)]?.['debug']('pip-audit\x20not\x20available',{'error':_0x1780dc[_0x18e71d(0x1fb)]});}try{const _0x564fe4=await execAsync('npm\x20list\x20eslint-plugin-security\x20--depth=0\x20--json',{'timeout':0x1388,'cwd':process['cwd']()}),_0x17d7dd=JSON[_0x18e71d(0x1a9)](_0x564fe4['stdout']);_0x17d7dd[_0x18e71d(0x1c9)]&&_0x17d7dd[_0x18e71d(0x1c9)][_0x18e71d(0x18a)]&&(_0x20a11e[_0x18e71d(0x1f7)]=!![],this[_0x18e71d(0x1f4)]?.['debug'](_0x18e71d(0x188)));}catch(_0x3ee3e9){this[_0x18e71d(0x1f4)]?.[_0x18e71d(0x1f6)]('eslint-plugin-security\x20not\x20available',{'error':_0x3ee3e9['message']});}return this['availableScanners']=_0x20a11e,_0x20a11e;}async['analyze'](_0x338b50,_0x3e5e11,_0x4784fb={}){const _0x16540e=a0_0x5916ed,_0x15a7af=[],_0x4974fc=await this[_0x16540e(0x1d4)](),_0x34acf8=this['detectLanguage'](_0x338b50);if(_0x4784fb['skipTestFiles']!==![]&&this[_0x16540e(0x1da)](_0x338b50))return this['logger']?.['debug']('Skipping\x20test\x20file\x20for\x20security\x20scan',{'filePath':_0x338b50}),[];if(_0x34acf8===_0x16540e(0x1a8)||_0x34acf8==='typescript'){if(_0x4974fc['semgrep']){const _0x5b38d2=await this['runSemgrep'](_0x338b50,[_0x34acf8],_0x4784fb);_0x15a7af[_0x16540e(0x1a6)](..._0x5b38d2);}if(_0x4974fc['eslintSecurity']){const _0x5d5e81=await this['runESLintSecurity'](_0x338b50,_0x3e5e11,_0x4784fb);_0x15a7af['push'](..._0x5d5e81);}}if(_0x34acf8===_0x16540e(0x1c3)){if(_0x4974fc[_0x16540e(0x1cf)]){const _0x234993=await this[_0x16540e(0x1f8)](_0x338b50,_0x4784fb);_0x15a7af[_0x16540e(0x1a6)](..._0x234993);}if(_0x4974fc[_0x16540e(0x1ea)]){const _0x68f2db=await this['runSemgrep'](_0x338b50,[_0x34acf8],_0x4784fb);_0x15a7af[_0x16540e(0x1a6)](..._0x68f2db);}}return _0x15a7af['length']===0x0&&!this['hasScannersForLanguage'](_0x4974fc,_0x34acf8)&&this['logger']?.[_0x16540e(0x1d8)](_0x16540e(0x1e3),{'language':_0x34acf8,'filePath':_0x338b50}),this['normalizeResults'](_0x15a7af);}async[a0_0x5916ed(0x1d5)](_0xf75be,_0x3e2465,_0x14d263={}){const _0xc5198c=a0_0x5916ed,_0x2d1c4e=[],_0x49574c=await this[_0xc5198c(0x1d4)]();if(_0x3e2465==='javascript'||_0x3e2465===_0xc5198c(0x1b4)){if(_0x49574c[_0xc5198c(0x1fc)]){const _0x6e1653=await this['runNpmAudit'](_0xf75be,_0x14d263);_0x2d1c4e['push'](..._0x6e1653);}}if(_0x3e2465===_0xc5198c(0x1c3)){if(_0x49574c[_0xc5198c(0x1e9)]){const _0x5e6075=await this['runPipAudit'](_0xf75be,_0x14d263);_0x2d1c4e['push'](..._0x5e6075);}}return this[_0xc5198c(0x1fe)](_0x2d1c4e);}async[a0_0x5916ed(0x19d)](_0xbc6d77,_0x27a446,_0xc7f61b={}){const _0x3ab93d=a0_0x5916ed;try{const _0x9d6390=a0_0x4e9488[_0x3ab93d(0x1bf)](_0xbc6d77),_0x379c3b=await execAsync(_0x3ab93d(0x1d1)+_0xbc6d77+'\x22',{'maxBuffer':0xa*0x400*0x400,'timeout':0x7530,'cwd':_0x9d6390}),_0x324245=JSON['parse'](_0x379c3b[_0x3ab93d(0x1ee)]);return this['parseSemgrepResults'](_0x324245);}catch(_0xa34070){if(_0xa34070['stdout'])try{const _0x562fd8=JSON[_0x3ab93d(0x1a9)](_0xa34070[_0x3ab93d(0x1ee)]);return this[_0x3ab93d(0x195)](_0x562fd8);}catch(_0x263a38){this[_0x3ab93d(0x1f4)]?.['error'](_0x3ab93d(0x1a0),{'error':_0x263a38['message'],'stdout':_0xa34070[_0x3ab93d(0x1ee)]});}return this[_0x3ab93d(0x1f4)]?.['error'](_0x3ab93d(0x1ab),{'error':_0xa34070[_0x3ab93d(0x1fb)]}),[];}}['parseSemgrepResults'](_0x1381c5){const _0x43dc31=a0_0x5916ed,_0x4fb639=[];if(_0x1381c5['results']&&Array[_0x43dc31(0x1ae)](_0x1381c5['results']))for(const _0x427da6 of _0x1381c5['results']){_0x4fb639['push']({'file':_0x427da6[_0x43dc31(0x1bd)],'line':_0x427da6['start']?.[_0x43dc31(0x1c4)]||0x1,'column':_0x427da6[_0x43dc31(0x1b1)]?.[_0x43dc31(0x1bb)]||0x1,'severity':this['mapSemgrepSeverity'](_0x427da6['extra']?.['severity']),'rule':_0x427da6['check_id'],'message':_0x427da6['extra']?.[_0x43dc31(0x1fb)]||_0x427da6['extra']?.['lines']||'Security\x20issue\x20detected','category':'security','scanner':_0x43dc31(0x1ea),'cwe':_0x427da6['extra']?.['metadata']?.[_0x43dc31(0x1de)],'owasp':_0x427da6[_0x43dc31(0x1b8)]?.['metadata']?.['owasp'],'confidence':_0x427da6[_0x43dc31(0x1b8)]?.[_0x43dc31(0x1e5)]?.['confidence'],'references':_0x427da6[_0x43dc31(0x1b8)]?.['metadata']?.[_0x43dc31(0x1cb)]});}return _0x4fb639;}async[a0_0x5916ed(0x1f8)](_0x2db2a5,_0x2ea9f1={}){const _0x1788f7=a0_0x5916ed;try{const _0x12ad0b=await execAsync(_0x1788f7(0x194)+_0x2db2a5+'\x22',{'maxBuffer':0xa*0x400*0x400,'timeout':0x7530}),_0x41aa20=JSON['parse'](_0x12ad0b['stdout']);return this[_0x1788f7(0x1f3)](_0x41aa20);}catch(_0x344101){if(_0x344101['stdout'])try{const _0x2e2ba0=JSON['parse'](_0x344101['stdout']);return this[_0x1788f7(0x1f3)](_0x2e2ba0);}catch(_0x3cda53){this[_0x1788f7(0x1f4)]?.[_0x1788f7(0x19f)]('Failed\x20to\x20parse\x20Bandit\x20output',{'error':_0x3cda53[_0x1788f7(0x1fb)]});}return this['logger']?.[_0x1788f7(0x19f)]('Bandit\x20scan\x20failed',{'error':_0x344101[_0x1788f7(0x1fb)]}),[];}}['parseBanditResults'](_0x50afb8){const _0x3a7a13=a0_0x5916ed,_0x218080=[];if(_0x50afb8[_0x3a7a13(0x1ed)]&&Array['isArray'](_0x50afb8['results']))for(const _0xa927b5 of _0x50afb8[_0x3a7a13(0x1ed)]){_0x218080[_0x3a7a13(0x1a6)]({'file':_0xa927b5['filename'],'line':_0xa927b5[_0x3a7a13(0x1d0)]||0x1,'column':_0xa927b5[_0x3a7a13(0x18c)]||0x1,'severity':this[_0x3a7a13(0x1e0)](_0xa927b5['issue_severity']),'rule':_0xa927b5['test_id'],'message':_0xa927b5[_0x3a7a13(0x1b2)],'category':_0x3a7a13(0x196),'scanner':'bandit','cwe':_0xa927b5['issue_cwe']?.['id']?'CWE-'+_0xa927b5['issue_cwe']['id']:null,'confidence':_0xa927b5['issue_confidence'],'moreInfo':_0xa927b5[_0x3a7a13(0x1f0)]});}return _0x218080;}async['runESLintSecurity'](_0xe09e35,_0x25cab4,_0xb75549={}){const _0x3155c9=a0_0x5916ed;try{const {ESLint:_0x4d3e42}=await import('eslint'),_0x3225ac=new _0x4d3e42({'overrideConfig':{'plugins':['security'],'extends':['plugin:security/recommended'],'parserOptions':{'ecmaVersion':_0x3155c9(0x1e7),'sourceType':_0x3155c9(0x193)}},'useEslintrc':![]}),_0x2b6c32=await _0x3225ac[_0x3155c9(0x185)](_0x25cab4,{'filePath':_0xe09e35});return this['parseESLintResults'](_0x2b6c32,_0xe09e35);}catch(_0x582e48){return this['logger']?.['error'](_0x3155c9(0x184),{'error':_0x582e48['message'],'filePath':_0xe09e35}),[];}}[a0_0x5916ed(0x1fd)](_0x5c66bc,_0x11b7d3){const _0x57c4a9=a0_0x5916ed,_0x46c7e5=[];for(const _0x30bfc2 of _0x5c66bc){if(_0x30bfc2['messages']&&Array[_0x57c4a9(0x1ae)](_0x30bfc2['messages']))for(const _0x4d81f9 of _0x30bfc2['messages']){_0x4d81f9['ruleId']&&_0x4d81f9['ruleId']['startsWith']('security/')&&_0x46c7e5[_0x57c4a9(0x1a6)]({'file':_0x11b7d3,'line':_0x4d81f9[_0x57c4a9(0x1c4)]||0x1,'column':_0x4d81f9['column']||0x1,'severity':this[_0x57c4a9(0x1b3)](_0x4d81f9[_0x57c4a9(0x1c6)]),'rule':_0x4d81f9[_0x57c4a9(0x198)],'message':_0x4d81f9['message'],'category':'security','scanner':_0x57c4a9(0x192),'fixable':_0x4d81f9['fix']!==undefined});}}return _0x46c7e5;}async['runNpmAudit'](_0x4c3c02,_0x43bbdb={}){const _0x232050=a0_0x5916ed;try{const _0x32a169=a0_0x4e9488['join'](_0x4c3c02,_0x232050(0x1b7));try{await a0_0xd6e153['access'](_0x32a169);}catch{return this[_0x232050(0x1f4)]?.['debug'](_0x232050(0x1a2)),[];}const _0x4c0f5a=await execAsync(_0x232050(0x19e),{'cwd':_0x4c3c02,'maxBuffer':0xa*0x400*0x400,'timeout':0xea60}),_0x42764a=JSON['parse'](_0x4c0f5a[_0x232050(0x1ee)]);return this['parseNpmAuditResults'](_0x42764a);}catch(_0x1efc65){if(_0x1efc65[_0x232050(0x1ee)])try{const _0x3b0c08=JSON['parse'](_0x1efc65['stdout']);return this[_0x232050(0x1aa)](_0x3b0c08);}catch(_0x19e081){this[_0x232050(0x1f4)]?.['error'](_0x232050(0x1a3),{'error':_0x19e081[_0x232050(0x1fb)]});}return[];}}['parseNpmAuditResults'](_0x27140f){const _0x8e34e3=a0_0x5916ed,_0x5bbf0e=[];if(_0x27140f['vulnerabilities'])for(const [_0x249437,_0x1cb6f8]of Object[_0x8e34e3(0x1f2)](_0x27140f['vulnerabilities'])){_0x5bbf0e[_0x8e34e3(0x1a6)]({'file':_0x8e34e3(0x1b7),'line':0x1,'column':0x1,'severity':this[_0x8e34e3(0x187)](_0x1cb6f8['severity']),'rule':_0x8e34e3(0x181)+(_0x1cb6f8[_0x8e34e3(0x1be)][0x0]?.[_0x8e34e3(0x1c5)]||_0x8e34e3(0x1f5)),'message':_0x249437+':\x20'+(_0x1cb6f8[_0x8e34e3(0x1be)][0x0]?.[_0x8e34e3(0x191)]||_0x8e34e3(0x18e)),'category':'security','scanner':'npm-audit','package':_0x249437,'vulnerableVersions':_0x1cb6f8['range'],'patchedVersions':_0x1cb6f8[_0x8e34e3(0x1ec)]?'Available':_0x8e34e3(0x18d),'cve':_0x1cb6f8[_0x8e34e3(0x1be)][0x0]?.['cve'],'cvss':_0x1cb6f8['via'][0x0]?.['cvss'],'references':_0x1cb6f8['via'][0x0]?.['url']?[_0x1cb6f8[_0x8e34e3(0x1be)][0x0][_0x8e34e3(0x1c1)]]:[]});}return _0x5bbf0e;}async[a0_0x5916ed(0x1b6)](_0x4dd50f,_0x5cae87={}){const _0x56224b=a0_0x5916ed;try{const requirementsPath=a0_0x4e9488['join'](_0x4dd50f,'requirements.txt');try{await a0_0xd6e153[_0x56224b(0x1ce)](requirementsPath);}catch{return this['logger']?.['debug']('No\x20requirements.txt\x20found,\x20skipping\x20pip-audit'),[];}const _0x52fc84=await execAsync(_0x56224b(0x189),{'cwd':_0x4dd50f,'maxBuffer':0xa*0x400*0x400,'timeout':0xea60}),_0x33b963=JSON['parse'](_0x52fc84[_0x56224b(0x1ee)]);return this['parsePipAuditResults'](_0x33b963);}catch(_0x3bb9fb){if(_0x3bb9fb['stdout'])try{const _0x29547e=JSON[_0x56224b(0x1a9)](_0x3bb9fb['stdout']);return this[_0x56224b(0x1ff)](_0x29547e);}catch(_0x223d95){this[_0x56224b(0x1f4)]?.[_0x56224b(0x19f)]('Failed\x20to\x20parse\x20pip-audit\x20output',{'error':_0x223d95[_0x56224b(0x1fb)]});}return[];}}[a0_0x5916ed(0x1ff)](_0x3e25e5){const _0x5f1f37=a0_0x5916ed,_0x1df0d4=[];if(_0x3e25e5['dependencies']&&Array['isArray'](_0x3e25e5['dependencies']))for(const _0x11b53e of _0x3e25e5['dependencies']){if(_0x11b53e['vulns']&&Array['isArray'](_0x11b53e[_0x5f1f37(0x1e6)]))for(const _0x4e04c7 of _0x11b53e[_0x5f1f37(0x1e6)]){_0x1df0d4[_0x5f1f37(0x1a6)]({'file':'requirements.txt','line':0x1,'column':0x1,'severity':this[_0x5f1f37(0x1f9)](_0x4e04c7[_0x5f1f37(0x1c6)]),'rule':_0x4e04c7['id'],'message':_0x11b53e[_0x5f1f37(0x199)]+':\x20'+(_0x4e04c7[_0x5f1f37(0x1d3)]||_0x5f1f37(0x18e)),'category':_0x5f1f37(0x196),'scanner':_0x5f1f37(0x1b5),'package':_0x11b53e['name'],'vulnerableVersion':_0x11b53e[_0x5f1f37(0x1a5)],'fixedVersions':_0x4e04c7['fix_versions'],'references':_0x4e04c7['aliases']||[]});}}return _0x1df0d4;}[a0_0x5916ed(0x1ac)](_0x1ce197){const _0x3e0c35=a0_0x5916ed,_0x14e623=a0_0x4e9488['extname'](_0x1ce197)[_0x3e0c35(0x1c8)](),_0x3ca1f9={'.js':'javascript','.jsx':'javascript','.mjs':'javascript','.cjs':_0x3e0c35(0x1a8),'.ts':_0x3e0c35(0x1b4),'.tsx':'typescript','.py':_0x3e0c35(0x1c3)};return _0x3ca1f9[_0x14e623]||null;}[a0_0x5916ed(0x1da)](_0x337d13){const _0xcbab6c=a0_0x5916ed,_0x45d2f7=[/\.test\./,/\.spec\./,/__tests__\//,/\/tests?\//,/\.test$/,/\.spec$/];return _0x45d2f7['some'](_0x3043fd=>_0x3043fd[_0xcbab6c(0x1ef)](_0x337d13));}[a0_0x5916ed(0x1fa)](_0x24d397,_0x18330c){const _0x28cc6b=a0_0x5916ed;if(_0x18330c==='javascript'||_0x18330c===_0x28cc6b(0x1b4))return _0x24d397['semgrep']||_0x24d397['eslintSecurity'];if(_0x18330c===_0x28cc6b(0x1c3))return _0x24d397['bandit']||_0x24d397[_0x28cc6b(0x1ea)];return![];}[a0_0x5916ed(0x1fe)](_0x3be85b){const _0x5ab993=a0_0x5916ed;return _0x3be85b[_0x5ab993(0x1f1)](_0x1a96c4=>({'file':_0x1a96c4[_0x5ab993(0x1c7)],'line':_0x1a96c4['line']||0x1,'column':_0x1a96c4[_0x5ab993(0x1cc)]||0x1,'severity':_0x1a96c4[_0x5ab993(0x1c6)]||STATIC_ANALYSIS[_0x5ab993(0x18b)][_0x5ab993(0x1a7)],'rule':_0x1a96c4['rule']||'unknown','message':_0x1a96c4[_0x5ab993(0x1fb)]||'Security\x20issue\x20detected','category':_0x5ab993(0x196),'scanner':_0x1a96c4['scanner'],'cwe':_0x1a96c4['cwe']||null,'owasp':_0x1a96c4['owasp']||null,'confidence':_0x1a96c4['confidence']||null,'fixable':_0x1a96c4[_0x5ab993(0x1df)]||![],'remediation':_0x1a96c4[_0x5ab993(0x1a4)]||_0x1a96c4['moreInfo']||null,'references':_0x1a96c4[_0x5ab993(0x1cb)]||[],'package':_0x1a96c4[_0x5ab993(0x190)]||null}));}[a0_0x5916ed(0x1bc)](_0x39f39c){const _0x14500b=a0_0x5916ed,_0x17e221={'ERROR':STATIC_ANALYSIS['SEVERITY']['CRITICAL'],'WARNING':STATIC_ANALYSIS['SEVERITY']['ERROR'],'INFO':STATIC_ANALYSIS['SEVERITY']['WARNING']};return _0x17e221[_0x39f39c?.['toUpperCase']()]||STATIC_ANALYSIS[_0x14500b(0x18b)]['WARNING'];}[a0_0x5916ed(0x1e0)](_0x14c6a3){const _0x2f20c3=a0_0x5916ed,_0xd6f72c={'HIGH':STATIC_ANALYSIS['SEVERITY'][_0x2f20c3(0x197)],'MEDIUM':STATIC_ANALYSIS[_0x2f20c3(0x18b)]['ERROR'],'LOW':STATIC_ANALYSIS['SEVERITY'][_0x2f20c3(0x1a7)]};return _0xd6f72c[_0x14c6a3?.[_0x2f20c3(0x1d6)]()]||STATIC_ANALYSIS['SEVERITY']['WARNING'];}[a0_0x5916ed(0x1b3)](_0x46e870){const _0x5efd6d=a0_0x5916ed;return _0x46e870===0x2?STATIC_ANALYSIS[_0x5efd6d(0x18b)][_0x5efd6d(0x1af)]:STATIC_ANALYSIS['SEVERITY'][_0x5efd6d(0x1a7)];}['mapNpmSeverity'](_0xb15d7d){const _0x2a6ac4=a0_0x5916ed,_0x594131={'critical':STATIC_ANALYSIS[_0x2a6ac4(0x18b)]['CRITICAL'],'high':STATIC_ANALYSIS['SEVERITY'][_0x2a6ac4(0x197)],'moderate':STATIC_ANALYSIS['SEVERITY']['ERROR'],'low':STATIC_ANALYSIS[_0x2a6ac4(0x18b)]['WARNING'],'info':STATIC_ANALYSIS[_0x2a6ac4(0x18b)]['INFO']};return _0x594131[_0xb15d7d?.['toLowerCase']()]||STATIC_ANALYSIS[_0x2a6ac4(0x18b)][_0x2a6ac4(0x1a7)];}[a0_0x5916ed(0x1f9)](_0x184411){const _0xd22119=a0_0x5916ed;if(!_0x184411)return STATIC_ANALYSIS['SEVERITY'][_0xd22119(0x1af)];const _0x3575d1={'critical':STATIC_ANALYSIS[_0xd22119(0x18b)]['CRITICAL'],'high':STATIC_ANALYSIS[_0xd22119(0x18b)]['CRITICAL'],'medium':STATIC_ANALYSIS['SEVERITY']['ERROR'],'low':STATIC_ANALYSIS['SEVERITY']['WARNING']};return _0x3575d1[_0x184411?.['toLowerCase']()]||STATIC_ANALYSIS['SEVERITY'][_0xd22119(0x1af)];}async['getScannerStatus'](){const _0x3970e1=await this['detectAvailableScanners']();return{'scanners':_0x3970e1,'recommendations':this['getInstallRecommendations'](_0x3970e1)};}[a0_0x5916ed(0x1dd)](_0x39e088){const _0x3eef9f=a0_0x5916ed,_0x401d45=[];return!_0x39e088['semgrep']&&_0x401d45['push']({'scanner':_0x3eef9f(0x186),'reason':'Multi-language\x20SAST\x20with\x20extensive\x20security\x20rules','install':'pip\x20install\x20semgrep\x20OR\x20use\x20Docker:\x20docker\x20pull\x20returntocorp/semgrep','priority':'high'}),!_0x39e088['bandit']&&_0x401d45['push']({'scanner':_0x3eef9f(0x182),'reason':_0x3eef9f(0x1a1),'install':'pip\x20install\x20bandit','priority':_0x3eef9f(0x1dc)}),!_0x39e088['eslintSecurity']&&_0x401d45['push']({'scanner':_0x3eef9f(0x18a),'reason':'JavaScript/TypeScript\x20security\x20rules','install':'npm\x20install\x20--save-dev\x20eslint-plugin-security','priority':'medium'}),!_0x39e088['pipAudit']&&_0x401d45['push']({'scanner':_0x3eef9f(0x1b5),'reason':'Python\x20dependency\x20vulnerability\x20scanner','install':'pip\x20install\x20pip-audit','priority':_0x3eef9f(0x1c2)}),_0x401d45;}}export default SecurityAnalyzer;
|
|
1
|
+
function a0_0xcf6d(){const _0x1ee081=['y2HLy2TFAwq','sMf2yvnJCMLWDc9uExbLu2nYAxb0ihnLy3vYAxr5ihj1BgvZ','CMvMzxjLBMnLCW','AM9PBG','zMLSzw5HBwu','ywXPyxnLCW','BNbTic0TDMvYC2LVBG','nZK1mZCWwvLkzMT2','mty4otCWohDUBxPxva','BNbTigLUC3rHBgWGls1ZyxzLlwrLDIbLC2XPBNqTCgX1z2LUlxnLy3vYAxr5','Cgf0Aa','C2v2zxjPDhK','rMfPBgvKihrVihbHCNnLig5WBsbHDwrPDcbVDxrWDxq','BNbTlwf1zgL0','uhL0Ag9UihnLy3vYAxr5ihnJyw5Uzxi','DgvZDa','DgvZDf9Pza','CNvSzuLK','C2nHBM5LCG','zgvWzw5Kzw5JAwvZ','u2vTz3jLCa','u2vTz3jLCcbUB3qGyxzHAwXHyMXL','zxnSAw50lxbSDwDPBI1Zzwn1CML0EsbKzxrLy3rLza','qxzHAwXHyMXL','Dg9vChbLCKnHC2u','CgLWigLUC3rHBgWGC2vTz3jLCcbpuIb1C2uGrg9JA2vYoIbKB2nRzxiGChvSBcbYzxr1CM50B2nVCNaVC2vTz3jLCa','zgvIDwC','C2vJDxjPDhK','BwfWrvnmAw50u2v2zxjPDhK','BwvZC2fNzxm','BNbTigf1zgL0ic0TANnVBG','BwvZC2fNzq','zML4','DMLH','CNvUrvnmAw50u2vJDxjPDhK','CNvUugLWqxvKAxq','BwfWu2vTz3jLCfnLDMvYAxr5','DNvSBMvYywjPBgL0AwvZ','C2vTz3jLCcaTlxzLCNnPB24','DhLWzxnJCMLWDa','mZm4mtzLDNLYB2e','ywnJzxnZ','BNbTigXPC3qGzxnSAw50lxbSDwDPBI1Zzwn1CML0EsaTlwrLChrOptaGls1QC29U','CgfYC2vfu0XPBNrszxn1BhrZ','u2vJDxjPDhKGDNvSBMvYywjPBgL0Eq','AxnZDwvFy3DL','Bgf0zxn0','BMfTzq','ChvZAa','yMfUzgL0','ChL0Ag9U','C2vJDxjPDhKV','rvjst1i','DNvSBNm','CMvZDwX0CW','mteZmZq4n0feq29Rra','Bw9YzuLUzM8','y29UzMLKzw5Jzq','CNvUu2vTz3jLCa','z2v0u2nHBM5LCLn0yxr1CW','Bg9Nz2vY','BgLUDfrLEhq','CgLWqxvKAxq','yxzHAwXHyMXLu2nHBM5LCNm','Dw5RBM93BG','BwfWqMfUzgL0u2v2zxjPDhK','zgv0zwn0tgfUz3vHz2u','q1jjveLdquW','CNvUtNbTqxvKAxq','lNnJyw5UzxjZ','C2nHBM5LCKnHy2HL','CMvTzwrPyxrPB24','txvSDgKTBgfUz3vHz2uGu0ftvcb3AxrOigv4DgvUC2L2zsbZzwn1CML0EsbYDwXLCW','zxH0CMe','D2fYBG','y3DK','ndm4odGZowzXDLndwG','CgLWlwf1zgL0ic0TDMvYC2LVBG','mtb2Bwj6qvC','BwfWugLWqxvKAxrtzxzLCML0Eq','BgLUzq','Axnuzxn0rMLSzq','Dg9mB3DLCKnHC2u','DMvYC2LVBG','BwvKAxvT','mxL3rxbLwG','AgLNAa','CgfYC2vqAxbbDwrPDfjLC3vSDhm','z2v0sw5ZDgfSBfjLy29TBwvUzgf0Aw9UCW','C3rKB3v0','u2vTz3jLCcbZy2fUigzHAwXLza','y29SDw1U','ofbLug9YBq','zxnSAw50u2vJDxjPDhK','AMf2yxnJCMLWDa','BM9YBwfSAxPLuMvZDwX0CW','C3rHCNq','B3DHC3a','C2vTz3jLCa','mZeXodGZrgHVyNz1','CgfJA2fNzq','yw5HBhL6zq','mJa1tvjLEfH1','AxnbCNjHEq','mtK2mdG4nfPVAw1MEa','Bg9JywXty2fUBMvYrgLY','CNvSzq','v0fstKLorW','q1Dflq','BM9Kzv9TB2r1BgvZ','tM9Uzq','yw5HBhL6zvbYB2PLy3q','CgLWlwf1zgL0ic0TzM9YBwf0igPZB24','zgv0zwn0qxzHAwXHyMXLu2nHBM5LCNm','C2TPCfrLC3rgAwXLCW','CgfYC2vcyw5KAxrszxn1BhrZ','DxjS','CgfYC2voCg1bDwrPDfjLC3vSDhm','zxjYB3i','C291CMnL','CgfYC2u','u2vJDxjPDhKGAxnZDwuGzgv0zwn0zwq','y3zZCW','zML4qxzHAwXHyMXL','u0vwrvjjvfK','AxnZDwvFy29UzMLKzw5Jzq','CgLWlwf1zgL0','rMfPBgvKihrVihbHCNnLihbPCc1HDwrPDcbVDxrWDxq','Bwv0ywrHDge'];a0_0xcf6d=function(){return _0x1ee081;};return a0_0xcf6d();}const a0_0x5af585=a0_0x451e;(function(_0x181486,_0x410c44){const _0x1e3773=a0_0x451e,_0x53a51f=_0x181486();while(!![]){try{const _0x10c9f1=-parseInt(_0x1e3773(0x126))/0x1*(parseInt(_0x1e3773(0x159))/0x2)+-parseInt(_0x1e3773(0x139))/0x3+parseInt(_0x1e3773(0x17a))/0x4*(parseInt(_0x1e3773(0x137))/0x5)+parseInt(_0x1e3773(0x15a))/0x6+-parseInt(_0x1e3773(0x11d))/0x7*(-parseInt(_0x1e3773(0x12d))/0x8)+-parseInt(_0x1e3773(0x108))/0x9*(-parseInt(_0x1e3773(0x11f))/0xa)+parseInt(_0x1e3773(0x134))/0xb;if(_0x10c9f1===_0x410c44)break;else _0x53a51f['push'](_0x53a51f['shift']());}catch(_0x1b8c0c){_0x53a51f['push'](_0x53a51f['shift']());}}}(a0_0xcf6d,0x57730));import{exec}from'child_process';import{promisify}from'util';function a0_0x451e(_0x578e3a,_0x1eb35c){_0x578e3a=_0x578e3a-0xff;const _0xcf6d02=a0_0xcf6d();let _0x451e80=_0xcf6d02[_0x578e3a];if(a0_0x451e['FcUVbn']===undefined){var _0xf0a888=function(_0xf99d0){const _0x2fbfac='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x410f3c='',_0x3a598a='';for(let _0xa0690f=0x0,_0x4d82b0,_0x3f6dc4,_0x274a6e=0x0;_0x3f6dc4=_0xf99d0['charAt'](_0x274a6e++);~_0x3f6dc4&&(_0x4d82b0=_0xa0690f%0x4?_0x4d82b0*0x40+_0x3f6dc4:_0x3f6dc4,_0xa0690f++%0x4)?_0x410f3c+=String['fromCharCode'](0xff&_0x4d82b0>>(-0x2*_0xa0690f&0x6)):0x0){_0x3f6dc4=_0x2fbfac['indexOf'](_0x3f6dc4);}for(let _0x13b60d=0x0,_0x5ae8c9=_0x410f3c['length'];_0x13b60d<_0x5ae8c9;_0x13b60d++){_0x3a598a+='%'+('00'+_0x410f3c['charCodeAt'](_0x13b60d)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3a598a);};a0_0x451e['MiKxpT']=_0xf0a888,a0_0x451e['RxtqAX']={},a0_0x451e['FcUVbn']=!![];}const _0x9c0cdb=_0xcf6d02[0x0],_0x161e34=_0x578e3a+_0x9c0cdb,_0xaf629b=a0_0x451e['RxtqAX'][_0x161e34];return!_0xaf629b?(_0x451e80=a0_0x451e['MiKxpT'](_0x451e80),a0_0x451e['RxtqAX'][_0x161e34]=_0x451e80):_0x451e80=_0xaf629b,_0x451e80;}import a0_0x410f3c from'path';import a0_0x3a598a from'fs/promises';import{STATIC_ANALYSIS}from'../utilities/constants.js';const execAsync=promisify(exec);class SecurityAnalyzer{constructor(_0xa0690f=null){const _0x53ed2e=a0_0x451e;this[_0x53ed2e(0x10d)]=_0xa0690f,this[_0x53ed2e(0x110)]=null,this[_0x53ed2e(0x117)]=new Map(),this['localScannerDir']=a0_0x410f3c['join'](process[_0x53ed2e(0x11c)](),_0x53ed2e(0x13e),_0x53ed2e(0x116));}async[a0_0x5af585(0x142)](){const _0x85ce9c=a0_0x5af585;if(this[_0x85ce9c(0x110)]!==null)return this['availableScanners'];const _0x4d82b0={'semgrep':![],'bandit':![],'npmAudit':![],'pipAudit':![],'eslintSecurity':![]};try{const _0x3f6dc4=a0_0x410f3c[_0x85ce9c(0x155)](this[_0x85ce9c(0x13a)],_0x85ce9c(0x133));try{await a0_0x3a598a[_0x85ce9c(0x17b)](_0x3f6dc4),_0x4d82b0['semgrep']=!![],this[_0x85ce9c(0x10d)]?.['debug']('Semgrep\x20scanner\x20detected\x20(local)');}catch{await execAsync(_0x85ce9c(0x178),{'timeout':0x1388}),_0x4d82b0[_0x85ce9c(0x133)]=!![],this[_0x85ce9c(0x10d)]?.['debug']('Semgrep\x20scanner\x20detected\x20(system)');}}catch(_0x274a6e){this[_0x85ce9c(0x10d)]?.[_0x85ce9c(0x16c)](_0x85ce9c(0x167),{'error':_0x274a6e[_0x85ce9c(0x171)]});}try{await execAsync('bandit\x20--version',{'timeout':0x1388}),_0x4d82b0[_0x85ce9c(0x102)]=!![],this['logger']?.[_0x85ce9c(0x16c)]('Bandit\x20scanner\x20detected');}catch(_0x13b60d){this['logger']?.[_0x85ce9c(0x16c)]('Bandit\x20not\x20available',{'error':_0x13b60d[_0x85ce9c(0x171)]});}try{await execAsync(_0x85ce9c(0x158),{'timeout':0x1388}),_0x4d82b0['npmAudit']=!![],this['logger']?.[_0x85ce9c(0x16c)]('npm\x20audit\x20available');}catch(_0x5ae8c9){this['logger']?.['debug']('npm\x20not\x20available',{'error':_0x5ae8c9[_0x85ce9c(0x171)]});}try{await execAsync(_0x85ce9c(0x11e),{'timeout':0x1388}),_0x4d82b0['pipAudit']=!![],this['logger']?.['debug']('pip-audit\x20detected');}catch(_0xb89070){this['logger']?.[_0x85ce9c(0x16c)]('pip-audit\x20not\x20available',{'error':_0xb89070['message']});}try{const _0x4e3067=await execAsync(_0x85ce9c(0x17c),{'timeout':0x1388,'cwd':process['cwd']()}),_0x45673b=JSON[_0x85ce9c(0x149)](_0x4e3067[_0x85ce9c(0x12a)]);_0x45673b[_0x85ce9c(0x165)]&&_0x45673b['dependencies']['eslint-plugin-security']&&(_0x4d82b0[_0x85ce9c(0x12e)]=!![],this[_0x85ce9c(0x10d)]?.['debug'](_0x85ce9c(0x168)));}catch(_0xf3e3ad){this[_0x85ce9c(0x10d)]?.['debug']('eslint-plugin-security\x20not\x20available',{'error':_0xf3e3ad['message']});}return this[_0x85ce9c(0x110)]=_0x4d82b0,_0x4d82b0;}async[a0_0x5af585(0x136)](_0x2a777d,_0x2ac3c3,_0x164298={}){const _0x4bd302=a0_0x5af585,_0x1af428=[],_0x2d0667=await this['detectAvailableScanners'](),_0x25bdb7=this[_0x4bd302(0x113)](_0x2a777d);if(_0x164298[_0x4bd302(0x143)]!==![]&&this[_0x4bd302(0x122)](_0x2a777d))return this[_0x4bd302(0x10d)]?.[_0x4bd302(0x16c)]('Skipping\x20test\x20file\x20for\x20security\x20scan',{'filePath':_0x2a777d}),[];if(_0x25bdb7==='javascript'||_0x25bdb7==='typescript'){if(_0x2d0667['semgrep']){const _0x2bf573=await this[_0x4bd302(0x10b)](_0x2a777d,[_0x25bdb7],_0x164298);_0x1af428[_0x4bd302(0x101)](..._0x2bf573);}if(_0x2d0667['eslintSecurity']){const _0x15caf5=await this[_0x4bd302(0x174)](_0x2a777d,_0x2ac3c3,_0x164298);_0x1af428['push'](..._0x15caf5);}}if(_0x25bdb7===_0x4bd302(0x103)){if(_0x2d0667[_0x4bd302(0x102)]){const _0x35ed74=await this['runBandit'](_0x2a777d,_0x164298);_0x1af428[_0x4bd302(0x101)](..._0x35ed74);}if(_0x2d0667[_0x4bd302(0x133)]){const _0x58b309=await this[_0x4bd302(0x10b)](_0x2a777d,[_0x25bdb7],_0x164298);_0x1af428['push'](..._0x58b309);}}return _0x1af428['length']===0x0&&!this['hasScannersForLanguage'](_0x2d0667,_0x25bdb7)&&this[_0x4bd302(0x10d)]?.[_0x4bd302(0x11b)]('No\x20security\x20scanners\x20available\x20for\x20language',{'language':_0x25bdb7,'filePath':_0x2a777d}),this[_0x4bd302(0x130)](_0x1af428);}async[a0_0x5af585(0x140)](_0x4efc65,_0x10801a,_0x1bb98a={}){const _0xb74e16=a0_0x5af585,_0x5d761d=[],_0x5c13ea=await this['detectAvailableScanners']();if(_0x10801a==='javascript'||_0x10801a===_0xb74e16(0x179)){if(_0x5c13ea['npmAudit']){const _0x185160=await this[_0xb74e16(0x115)](_0x4efc65,_0x1bb98a);_0x5d761d[_0xb74e16(0x101)](..._0x185160);}}if(_0x10801a===_0xb74e16(0x103)){if(_0x5c13ea[_0xb74e16(0x10f)]){const _0x7f1348=await this['runPipAudit'](_0x4efc65,_0x1bb98a);_0x5d761d['push'](..._0x7f1348);}}return this[_0xb74e16(0x130)](_0x5d761d);}async[a0_0x5af585(0x10b)](_0x4f2970,_0x533082,_0x4c1ea2={}){const _0x23c882=a0_0x5af585;try{const _0x24edae=a0_0x410f3c['dirname'](_0x4f2970),_0x366c1c=await execAsync('semgrep\x20--config=auto\x20--json\x20\x22'+_0x4f2970+'\x22',{'maxBuffer':0xa*0x400*0x400,'timeout':0x7530,'cwd':_0x24edae}),_0x4767c9=JSON[_0x23c882(0x149)](_0x366c1c[_0x23c882(0x12a)]);return this['parseSemgrepResults'](_0x4767c9);}catch(_0x4137ee){if(_0x4137ee[_0x23c882(0x12a)])try{const _0x51a439=JSON['parse'](_0x4137ee[_0x23c882(0x12a)]);return this['parseSemgrepResults'](_0x51a439);}catch(_0x436084){this[_0x23c882(0x10d)]?.[_0x23c882(0x147)]('Failed\x20to\x20parse\x20Semgrep\x20output',{'error':_0x436084['message'],'stdout':_0x4137ee[_0x23c882(0x12a)]});}return this[_0x23c882(0x10d)]?.[_0x23c882(0x147)](_0x23c882(0x12b),{'error':_0x4137ee[_0x23c882(0x171)]}),[];}}['parseSemgrepResults'](_0x14aba1){const _0x175f09=a0_0x5af585,_0xeb4348=[];if(_0x14aba1[_0x175f09(0x107)]&&Array[_0x175f09(0x138)](_0x14aba1['results']))for(const _0x2beee3 of _0x14aba1[_0x175f09(0x107)]){_0xeb4348['push']({'file':_0x2beee3[_0x175f09(0x15c)],'line':_0x2beee3['start']?.[_0x175f09(0x121)]||0x1,'column':_0x2beee3[_0x175f09(0x131)]?.['col']||0x1,'severity':this['mapSemgrepSeverity'](_0x2beee3[_0x175f09(0x11a)]?.['severity']),'rule':_0x2beee3[_0x175f09(0x152)],'message':_0x2beee3['extra']?.['message']||_0x2beee3['extra']?.['lines']||_0x175f09(0x14a),'category':'security','scanner':_0x175f09(0x133),'cwe':_0x2beee3[_0x175f09(0x11a)]?.[_0x175f09(0x151)]?.['cwe'],'owasp':_0x2beee3['extra']?.[_0x175f09(0x151)]?.['owasp'],'confidence':_0x2beee3[_0x175f09(0x11a)]?.['metadata']?.['confidence'],'references':_0x2beee3[_0x175f09(0x11a)]?.['metadata']?.['references']});}return _0xeb4348;}async['runBandit'](_0x191dac,_0x25cfee={}){const _0x16d60c=a0_0x5af585;try{const _0x499c0a=await execAsync('bandit\x20-f\x20json\x20\x22'+_0x191dac+'\x22',{'maxBuffer':0xa*0x400*0x400,'timeout':0x7530}),_0x131ba8=JSON[_0x16d60c(0x149)](_0x499c0a['stdout']);return this[_0x16d60c(0x144)](_0x131ba8);}catch(_0x2f3be5){if(_0x2f3be5[_0x16d60c(0x12a)])try{const _0x34d6af=JSON[_0x16d60c(0x149)](_0x2f3be5[_0x16d60c(0x12a)]);return this['parseBanditResults'](_0x34d6af);}catch(_0x5c8a6a){this[_0x16d60c(0x10d)]?.[_0x16d60c(0x147)]('Failed\x20to\x20parse\x20Bandit\x20output',{'error':_0x5c8a6a['message']});}return this[_0x16d60c(0x10d)]?.[_0x16d60c(0x147)]('Bandit\x20scan\x20failed',{'error':_0x2f3be5['message']}),[];}}[a0_0x5af585(0x144)](_0x323030){const _0x238082=a0_0x5af585,_0x50a445=[];if(_0x323030[_0x238082(0x107)]&&Array['isArray'](_0x323030['results']))for(const _0x66cd98 of _0x323030[_0x238082(0x107)]){_0x50a445['push']({'file':_0x66cd98[_0x238082(0x156)],'line':_0x66cd98['line_number']||0x1,'column':_0x66cd98['col_offset']||0x1,'severity':this[_0x238082(0x112)](_0x66cd98['issue_severity']),'rule':_0x66cd98[_0x238082(0x162)],'message':_0x66cd98['issue_text'],'category':_0x238082(0x16d),'scanner':_0x238082(0x102),'cwe':_0x66cd98['issue_cwe']?.['id']?_0x238082(0x13d)+_0x66cd98[_0x238082(0x17f)]['id']:null,'confidence':_0x66cd98[_0x238082(0x14e)],'moreInfo':_0x66cd98['more_info']});}return _0x50a445;}async[a0_0x5af585(0x174)](_0x5d433c,_0x140714,_0x3e26a1={}){const _0x5af57c=a0_0x5af585;try{const {ESLint:_0x446f7d}=await import('eslint'),_0x1f2412=new _0x446f7d({'overrideConfig':{'plugins':['security'],'extends':['plugin:security/recommended'],'parserOptions':{'ecmaVersion':_0x5af57c(0xff),'sourceType':'module'}},'useEslintrc':![]}),_0x156169=await _0x1f2412[_0x5af57c(0x10e)](_0x140714,{'filePath':_0x5d433c});return this[_0x5af57c(0x17d)](_0x156169,_0x5d433c);}catch(_0x3073d4){return this[_0x5af57c(0x10d)]?.['error']('ESLint\x20security\x20scan\x20failed',{'error':_0x3073d4['message'],'filePath':_0x5d433c}),[];}}[a0_0x5af585(0x17d)](_0x18d54f,_0x49e372){const _0x56fc08=a0_0x5af585,_0x4f1999=[];for(const _0x4be866 of _0x18d54f){if(_0x4be866[_0x56fc08(0x16f)]&&Array['isArray'](_0x4be866['messages']))for(const _0x58c099 of _0x4be866[_0x56fc08(0x16f)]){_0x58c099['ruleId']&&_0x58c099[_0x56fc08(0x163)]['startsWith'](_0x56fc08(0x104))&&_0x4f1999['push']({'file':_0x49e372,'line':_0x58c099[_0x56fc08(0x121)]||0x1,'column':_0x58c099['column']||0x1,'severity':this['mapESLintSeverity'](_0x58c099['severity']),'rule':_0x58c099['ruleId'],'message':_0x58c099['message'],'category':'security','scanner':'eslint-security','fixable':_0x58c099[_0x56fc08(0x172)]!==undefined});}}return _0x4f1999;}async['runNpmAudit'](_0x4fda78,_0x146d2e={}){const _0x5d5745=a0_0x5af585;try{const _0x4c2ce2=a0_0x410f3c[_0x5d5745(0x155)](_0x4fda78,'package.json');try{await a0_0x3a598a[_0x5d5745(0x17b)](_0x4c2ce2);}catch{return this[_0x5d5745(0x10d)]?.[_0x5d5745(0x16c)]('No\x20package.json\x20found,\x20skipping\x20npm\x20audit'),[];}const _0x1515d9=await execAsync(_0x5d5745(0x170),{'cwd':_0x4fda78,'maxBuffer':0xa*0x400*0x400,'timeout':0xea60}),_0x319e1c=JSON['parse'](_0x1515d9['stdout']);return this['parseNpmAuditResults'](_0x319e1c);}catch(_0x240ad2){if(_0x240ad2[_0x5d5745(0x12a)])try{const _0x11646d=JSON['parse'](_0x240ad2[_0x5d5745(0x12a)]);return this['parseNpmAuditResults'](_0x11646d);}catch(_0x314eff){this[_0x5d5745(0x10d)]?.[_0x5d5745(0x147)](_0x5d5745(0x15e),{'error':_0x314eff['message']});}return[];}}[a0_0x5af585(0x146)](_0x5954e6){const _0x2e44b7=a0_0x5af585,_0x4cad24=[];if(_0x5954e6[_0x2e44b7(0x177)])for(const [_0x410c0e,_0x32185d]of Object['entries'](_0x5954e6['vulnerabilities'])){_0x4cad24[_0x2e44b7(0x101)]({'file':'package.json','line':0x1,'column':0x1,'severity':this['mapNpmSeverity'](_0x32185d[_0x2e44b7(0x15d)]),'rule':'npm-'+(_0x32185d['via'][0x0]?.[_0x2e44b7(0x148)]||'advisory'),'message':_0x410c0e+':\x20'+(_0x32185d['via'][0x0]?.['title']||_0x2e44b7(0x17e)),'category':_0x2e44b7(0x16d),'scanner':_0x2e44b7(0x15f),'package':_0x410c0e,'vulnerableVersions':_0x32185d['range'],'patchedVersions':_0x32185d[_0x2e44b7(0x14c)]?_0x2e44b7(0x169):_0x2e44b7(0x13f),'cve':_0x32185d['via'][0x0]?.['cve'],'cvss':_0x32185d[_0x2e44b7(0x173)][0x0]?.[_0x2e44b7(0x14b)],'references':_0x32185d['via'][0x0]?.['url']?[_0x32185d['via'][0x0][_0x2e44b7(0x145)]]:[]});}return _0x4cad24;}async[a0_0x5af585(0x175)](_0x4245d7,_0x47e22a={}){const _0x4fbb65=a0_0x5af585;try{const requirementsPath=a0_0x410f3c['join'](_0x4245d7,'requirements.txt');try{await a0_0x3a598a[_0x4fbb65(0x17b)](requirementsPath);}catch{return this[_0x4fbb65(0x10d)]?.['debug']('No\x20requirements.txt\x20found,\x20skipping\x20pip-audit'),[];}const _0x37a0dd=await execAsync(_0x4fbb65(0x141),{'cwd':_0x4245d7,'maxBuffer':0xa*0x400*0x400,'timeout':0xea60}),_0x27e5a3=JSON['parse'](_0x37a0dd['stdout']);return this[_0x4fbb65(0x128)](_0x27e5a3);}catch(_0x852598){if(_0x852598['stdout'])try{const _0x52c19e=JSON['parse'](_0x852598['stdout']);return this[_0x4fbb65(0x128)](_0x52c19e);}catch(_0x4034b8){this[_0x4fbb65(0x10d)]?.['error'](_0x4fbb65(0x150),{'error':_0x4034b8[_0x4fbb65(0x171)]});}return[];}}['parsePipAuditResults'](_0x1e8ce5){const _0x23e7b8=a0_0x5af585,_0xd50c3=[];if(_0x1e8ce5[_0x23e7b8(0x165)]&&Array[_0x23e7b8(0x138)](_0x1e8ce5[_0x23e7b8(0x165)]))for(const _0x3879d8 of _0x1e8ce5['dependencies']){if(_0x3879d8[_0x23e7b8(0x106)]&&Array[_0x23e7b8(0x138)](_0x3879d8['vulns']))for(const _0x284781 of _0x3879d8['vulns']){_0xd50c3['push']({'file':'requirements.txt','line':0x1,'column':0x1,'severity':this[_0x23e7b8(0x120)](_0x284781['severity']),'rule':_0x284781['id'],'message':_0x3879d8[_0x23e7b8(0x100)]+':\x20'+(_0x284781['description']||_0x23e7b8(0x17e)),'category':'security','scanner':'pip-audit','package':_0x3879d8[_0x23e7b8(0x100)],'vulnerableVersion':_0x3879d8[_0x23e7b8(0x124)],'fixedVersions':_0x284781['fix_versions'],'references':_0x284781[_0x23e7b8(0x157)]||[]});}}return _0xd50c3;}['detectLanguage'](_0x43a5c3){const _0x1847dc=a0_0x5af585,_0x3551de=a0_0x410f3c['extname'](_0x43a5c3)['toLowerCase'](),_0x462282={'.js':'javascript','.jsx':_0x1847dc(0x12f),'.mjs':_0x1847dc(0x12f),'.cjs':'javascript','.ts':_0x1847dc(0x179),'.tsx':_0x1847dc(0x179),'.py':'python'};return _0x462282[_0x3551de]||null;}[a0_0x5af585(0x122)](_0x430cd8){const _0x40f3c6=a0_0x5af585,_0x26f32d=[/\.test\./,/\.spec\./,/__tests__\//,/\/tests?\//,/\.test$/,/\.spec$/];return _0x26f32d['some'](_0x43aa98=>_0x43aa98[_0x40f3c6(0x161)](_0x430cd8));}['hasScannersForLanguage'](_0x2da755,_0x35fa9e){const _0x47a5f2=a0_0x5af585;if(_0x35fa9e===_0x47a5f2(0x12f)||_0x35fa9e==='typescript')return _0x2da755[_0x47a5f2(0x133)]||_0x2da755['eslintSecurity'];if(_0x35fa9e==='python')return _0x2da755['bandit']||_0x2da755['semgrep'];return![];}['normalizeResults'](_0x2d8ea7){const _0x1e6940=a0_0x5af585;return _0x2d8ea7['map'](_0x2dee12=>({'file':_0x2dee12['file'],'line':_0x2dee12[_0x1e6940(0x121)]||0x1,'column':_0x2dee12[_0x1e6940(0x12c)]||0x1,'severity':_0x2dee12[_0x1e6940(0x15d)]||STATIC_ANALYSIS['SEVERITY']['WARNING'],'rule':_0x2dee12[_0x1e6940(0x13b)]||_0x1e6940(0x111),'message':_0x2dee12[_0x1e6940(0x171)]||_0x1e6940(0x14a),'category':'security','scanner':_0x2dee12[_0x1e6940(0x164)],'cwe':_0x2dee12['cwe']||null,'owasp':_0x2dee12[_0x1e6940(0x132)]||null,'confidence':_0x2dee12[_0x1e6940(0x10a)]||null,'fixable':_0x2dee12['fixable']||![],'remediation':_0x2dee12[_0x1e6940(0x118)]||_0x2dee12[_0x1e6940(0x109)]||null,'references':_0x2dee12[_0x1e6940(0x154)]||[],'package':_0x2dee12[_0x1e6940(0x135)]||null}));}[a0_0x5af585(0x176)](_0x2035d4){const _0x273811=a0_0x5af585,_0x45b721={'ERROR':STATIC_ANALYSIS[_0x273811(0x14d)]['CRITICAL'],'WARNING':STATIC_ANALYSIS['SEVERITY']['ERROR'],'INFO':STATIC_ANALYSIS['SEVERITY']['WARNING']};return _0x45b721[_0x2035d4?.['toUpperCase']()]||STATIC_ANALYSIS[_0x273811(0x14d)]['WARNING'];}[a0_0x5af585(0x112)](_0x36e73b){const _0x4fdb18=a0_0x5af585,_0x4eb77b={'HIGH':STATIC_ANALYSIS[_0x4fdb18(0x14d)]['CRITICAL'],'MEDIUM':STATIC_ANALYSIS['SEVERITY'][_0x4fdb18(0x105)],'LOW':STATIC_ANALYSIS['SEVERITY']['WARNING']};return _0x4eb77b[_0x36e73b?.[_0x4fdb18(0x16a)]()]||STATIC_ANALYSIS['SEVERITY'][_0x4fdb18(0x13c)];}[a0_0x5af585(0x16e)](_0x45722f){return _0x45722f===0x2?STATIC_ANALYSIS['SEVERITY']['ERROR']:STATIC_ANALYSIS['SEVERITY']['WARNING'];}['mapNpmSeverity'](_0x2cc993){const _0x10265d=a0_0x5af585,_0xff5152={'critical':STATIC_ANALYSIS[_0x10265d(0x14d)]['CRITICAL'],'high':STATIC_ANALYSIS[_0x10265d(0x14d)][_0x10265d(0x114)],'moderate':STATIC_ANALYSIS[_0x10265d(0x14d)]['ERROR'],'low':STATIC_ANALYSIS[_0x10265d(0x14d)]['WARNING'],'info':STATIC_ANALYSIS[_0x10265d(0x14d)]['INFO']};return _0xff5152[_0x2cc993?.[_0x10265d(0x123)]()]||STATIC_ANALYSIS['SEVERITY']['WARNING'];}[a0_0x5af585(0x120)](_0x2df168){const _0x36de0d=a0_0x5af585;if(!_0x2df168)return STATIC_ANALYSIS[_0x36de0d(0x14d)][_0x36de0d(0x105)];const _0x4ce4ee={'critical':STATIC_ANALYSIS['SEVERITY'][_0x36de0d(0x114)],'high':STATIC_ANALYSIS['SEVERITY'][_0x36de0d(0x114)],'medium':STATIC_ANALYSIS['SEVERITY'][_0x36de0d(0x105)],'low':STATIC_ANALYSIS['SEVERITY'][_0x36de0d(0x13c)]};return _0x4ce4ee[_0x2df168?.[_0x36de0d(0x123)]()]||STATIC_ANALYSIS[_0x36de0d(0x14d)][_0x36de0d(0x105)];}async[a0_0x5af585(0x10c)](){const _0x443d16=await this['detectAvailableScanners']();return{'scanners':_0x443d16,'recommendations':this['getInstallRecommendations'](_0x443d16)};}[a0_0x5af585(0x129)](_0x42ee5a){const _0x4c06fd=a0_0x5af585,_0x1b0683=[];return!_0x42ee5a['semgrep']&&_0x1b0683[_0x4c06fd(0x101)]({'scanner':_0x4c06fd(0x166),'reason':_0x4c06fd(0x119),'install':_0x4c06fd(0x16b),'priority':_0x4c06fd(0x127)}),!_0x42ee5a[_0x4c06fd(0x102)]&&_0x1b0683[_0x4c06fd(0x101)]({'scanner':'Bandit','reason':_0x4c06fd(0x160),'install':'pip\x20install\x20bandit','priority':_0x4c06fd(0x125)}),!_0x42ee5a['eslintSecurity']&&_0x1b0683[_0x4c06fd(0x101)]({'scanner':'eslint-plugin-security','reason':_0x4c06fd(0x153),'install':_0x4c06fd(0x15b),'priority':_0x4c06fd(0x125)}),!_0x42ee5a['pipAudit']&&_0x1b0683['push']({'scanner':_0x4c06fd(0x14f),'reason':'Python\x20dependency\x20vulnerability\x20scanner','install':'pip\x20install\x20pip-audit','priority':'low'}),_0x1b0683;}}export default SecurityAnalyzer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a0_0x424630=a0_0x5862;(function(_0x55ba85,_0x3da57f){const _0x2e456c=a0_0x5862,_0xd6784b=_0x55ba85();while(!![]){try{const _0x19072c=-parseInt(_0x2e456c(0x151))/0x1+parseInt(_0x2e456c(0x161))/0x2*(-parseInt(_0x2e456c(0x144))/0x3)+parseInt(_0x2e456c(0x153))/0x4+-parseInt(_0x2e456c(0x152))/0x5+-parseInt(_0x2e456c(0x166))/0x6*(parseInt(_0x2e456c(0x162))/0x7)+parseInt(_0x2e456c(0x13d))/0x8*(-parseInt(_0x2e456c(0x160))/0x9)+parseInt(_0x2e456c(0x15b))/0xa;if(_0x19072c===_0x3da57f)break;else _0xd6784b['push'](_0xd6784b['shift']());}catch(_0x65f539){_0xd6784b['push'](_0xd6784b['shift']());}}}(a0_0x37e5,0x2ebfd));import a0_0x36d0d2 from'typescript';function a0_0x5862(_0x2eee71,_0x16ff8c){_0x2eee71=_0x2eee71-0x139;const _0x37e556=a0_0x37e5();let _0x586267=_0x37e556[_0x2eee71];if(a0_0x5862['mExmst']===undefined){var _0xc3e11b=function(_0x2b4382){const _0x2f25b5='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x36d0d2='',_0x2bb705='';for(let _0x1a3d2a=0x0,_0x37752b,_0x3e3243,_0x2c1b46=0x0;_0x3e3243=_0x2b4382['charAt'](_0x2c1b46++);~_0x3e3243&&(_0x37752b=_0x1a3d2a%0x4?_0x37752b*0x40+_0x3e3243:_0x3e3243,_0x1a3d2a++%0x4)?_0x36d0d2+=String['fromCharCode'](0xff&_0x37752b>>(-0x2*_0x1a3d2a&0x6)):0x0){_0x3e3243=_0x2f25b5['indexOf'](_0x3e3243);}for(let _0x14836e=0x0,_0x57f939=_0x36d0d2['length'];_0x14836e<_0x57f939;_0x14836e++){_0x2bb705+='%'+('00'+_0x36d0d2['charCodeAt'](_0x14836e)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2bb705);};a0_0x5862['cIUvJw']=_0xc3e11b,a0_0x5862['GASpVs']={},a0_0x5862['mExmst']=!![];}const _0x4c7d9b=_0x37e556[0x0],_0x12f6e5=_0x2eee71+_0x4c7d9b,_0x2d4cc8=a0_0x5862['GASpVs'][_0x12f6e5];return!_0x2d4cc8?(_0x586267=a0_0x5862['cIUvJw'](_0x586267),a0_0x5862['GASpVs'][_0x12f6e5]=_0x586267):_0x586267=_0x2d4cc8,_0x586267;}import a0_0x2bb705 from'path';import{STATIC_ANALYSIS}from'../utilities/constants.js';class TypeScriptAnalyzer{constructor(_0x1a3d2a=null){const _0xabde47=a0_0x5862;this['logger']=_0x1a3d2a,this[_0xabde47(0x13f)]={'noEmit':!![],'jsx':a0_0x36d0d2['JsxEmit']['React'],'target':a0_0x36d0d2['ScriptTarget'][_0xabde47(0x141)],'module':a0_0x36d0d2[_0xabde47(0x15a)][_0xabde47(0x159)],'moduleResolution':a0_0x36d0d2['ModuleResolutionKind']['NodeJs'],'esModuleInterop':!![],'skipLibCheck':!![],'strict':!![],'noImplicitAny':!![],'strictNullChecks':!![],'strictFunctionTypes':!![],'allowJs':![]};}async[a0_0x424630(0x13b)](_0x37752b,_0x3e3243,_0x2c1b46={}){const _0x4db476=a0_0x424630;try{const _0x14836e=[],_0x57f939=a0_0x36d0d2['createSourceFile'](_0x37752b,_0x3e3243,a0_0x36d0d2['ScriptTarget']['Latest'],!![]),_0x378f6f=this['getSyntacticDiagnostics'](_0x57f939);_0x14836e[_0x4db476(0x140)](..._0x378f6f);const _0x4999aa=await this[_0x4db476(0x148)](_0x37752b,_0x3e3243);return _0x14836e['push'](..._0x4999aa),this[_0x4db476(0x165)]?.['debug']('TypeScript\x20analysis\x20completed',{'file':_0x37752b,'totalDiagnostics':_0x14836e[_0x4db476(0x146)],'errors':_0x14836e['filter'](_0x1c05d3=>_0x1c05d3['severity']===STATIC_ANALYSIS[_0x4db476(0x142)][_0x4db476(0x14c)])[_0x4db476(0x146)],'warnings':_0x14836e['filter'](_0x5df02d=>_0x5df02d['severity']===STATIC_ANALYSIS[_0x4db476(0x142)][_0x4db476(0x164)])['length']}),_0x14836e;}catch(_0x22c908){return this['logger']?.['error']('TypeScript\x20analysis\x20failed',{'file':_0x37752b,'error':_0x22c908['message']}),[{'file':_0x37752b,'line':0x0,'column':0x0,'severity':STATIC_ANALYSIS['SEVERITY']['ERROR'],'rule':_0x4db476(0x143),'message':'Analysis\x20failed:\x20'+_0x22c908[_0x4db476(0x15c)],'category':STATIC_ANALYSIS['CATEGORY']['SYNTAX']}];}}['getSyntacticDiagnostics'](_0x437a2c){const _0x180328=a0_0x424630,_0x2a78db=[];if(_0x437a2c['parseDiagnostics']&&_0x437a2c[_0x180328(0x16c)][_0x180328(0x146)]>0x0)for(const _0x54d05f of _0x437a2c['parseDiagnostics']){_0x2a78db[_0x180328(0x140)](this[_0x180328(0x15d)](_0x54d05f,_0x437a2c));}return _0x2a78db;}async['getSemanticDiagnostics'](_0x2ac33e,_0x46e118){const _0x3834bf=a0_0x424630,_0x10a21a=[];try{const _0xef6525=a0_0x36d0d2[_0x3834bf(0x147)](_0x2ac33e,_0x46e118,a0_0x36d0d2[_0x3834bf(0x158)]['Latest'],!![]),_0x2a95ee={'getSourceFile':_0x5bdedc=>{if(_0x5bdedc===_0x2ac33e)return _0xef6525;return undefined;},'getDefaultLibFileName':()=>_0x3834bf(0x157),'writeFile':()=>{},'getCurrentDirectory':()=>a0_0x2bb705['dirname'](_0x2ac33e),'getDirectories':()=>[],'fileExists':_0x294555=>_0x294555===_0x2ac33e,'readFile':_0x517d69=>{if(_0x517d69===_0x2ac33e)return _0x46e118;return undefined;},'getCanonicalFileName':_0x459e97=>_0x459e97,'useCaseSensitiveFileNames':()=>!![],'getNewLine':()=>'\x0a'},_0x3f10eb=a0_0x36d0d2[_0x3834bf(0x150)]({'rootNames':[_0x2ac33e],'options':this['compilerOptions'],'host':_0x2a95ee}),_0x4cb0a1=_0x3f10eb['getSyntacticDiagnostics'](_0xef6525),_0x686b0d=_0x3f10eb[_0x3834bf(0x148)](_0xef6525);for(const _0x164ddf of[..._0x4cb0a1,..._0x686b0d]){_0x10a21a[_0x3834bf(0x140)](this['formatDiagnostic'](_0x164ddf,_0xef6525));}}catch(_0x23d936){this['logger']?.[_0x3834bf(0x15f)](_0x3834bf(0x15e),{'file':_0x2ac33e,'error':_0x23d936['message']});}return _0x10a21a;}[a0_0x424630(0x15d)](_0x2cebf5,_0x1f4355){const _0x1cec21=a0_0x424630;let _0x59fff9=0x0,_0x5cac6a=0x0;if(_0x2cebf5[_0x1cec21(0x13e)]&&_0x2cebf5['start']!==undefined){const _0x2fc690=_0x2cebf5[_0x1cec21(0x13e)]['getLineAndCharacterOfPosition'](_0x2cebf5[_0x1cec21(0x167)]);_0x59fff9=_0x2fc690[_0x1cec21(0x145)]+0x1,_0x5cac6a=_0x2fc690['character']+0x1;}else{if(_0x1f4355&&_0x2cebf5[_0x1cec21(0x167)]!==undefined){const _0xcdd725=_0x1f4355[_0x1cec21(0x16a)](_0x2cebf5['start']);_0x59fff9=_0xcdd725['line']+0x1,_0x5cac6a=_0xcdd725['character']+0x1;}}const _0x403584=a0_0x36d0d2['flattenDiagnosticMessageText'](_0x2cebf5[_0x1cec21(0x156)],'\x0a');let _0x56094e;switch(_0x2cebf5['category']){case a0_0x36d0d2[_0x1cec21(0x14e)][_0x1cec21(0x163)]:_0x56094e=STATIC_ANALYSIS[_0x1cec21(0x142)][_0x1cec21(0x14c)];break;case a0_0x36d0d2['DiagnosticCategory'][_0x1cec21(0x155)]:_0x56094e=STATIC_ANALYSIS[_0x1cec21(0x142)]['WARNING'];break;case a0_0x36d0d2[_0x1cec21(0x14e)]['Message']:case a0_0x36d0d2['DiagnosticCategory'][_0x1cec21(0x13a)]:_0x56094e=STATIC_ANALYSIS[_0x1cec21(0x142)]['INFO'];break;default:_0x56094e=STATIC_ANALYSIS[_0x1cec21(0x142)][_0x1cec21(0x14c)];}let _0xb06755=STATIC_ANALYSIS['CATEGORY'][_0x1cec21(0x14d)];const _0x57cf55=_0x2cebf5[_0x1cec21(0x154)];if(_0x57cf55>=0x7d0&&_0x57cf55<0xbb8)_0xb06755=STATIC_ANALYSIS[_0x1cec21(0x16d)]['TYPE'];else{if(_0x57cf55>=0x3e8&&_0x57cf55<0x7d0)_0xb06755=STATIC_ANALYSIS[_0x1cec21(0x16d)][_0x1cec21(0x14d)];else _0x57cf55>=0x8fc&&_0x57cf55<0x960&&(_0xb06755=STATIC_ANALYSIS['CATEGORY'][_0x1cec21(0x13c)]);}const _0x137df5=_0x403584[_0x1cec21(0x14a)]();if(_0x137df5[_0x1cec21(0x16b)](_0x1cec21(0x14b))||_0x137df5['includes']('import')||_0x137df5[_0x1cec21(0x16b)]('export'))_0xb06755=STATIC_ANALYSIS['CATEGORY'][_0x1cec21(0x13c)];else(_0x137df5['includes'](_0x1cec21(0x169))||_0x137df5['includes'](_0x1cec21(0x14f))||_0x137df5[_0x1cec21(0x16b)](_0x1cec21(0x139)))&&(_0xb06755=STATIC_ANALYSIS[_0x1cec21(0x16d)][_0x1cec21(0x168)]);return{'file':_0x2cebf5['file']?.['fileName']||_0x1f4355?.['fileName']||_0x1cec21(0x149),'line':_0x59fff9,'column':_0x5cac6a,'severity':_0x56094e,'rule':'TS'+_0x57cf55,'message':_0x403584,'category':_0xb06755,'fixable':![],'code':_0x2cebf5['code']};}}export default TypeScriptAnalyzer;function a0_0x37e5(){const _0x553889=['CgfYC2veAwfNBM9ZDgLJCW','q0furuDpuLK','y2XHC3m','u3vNz2vZDgLVBG','yw5HBhL6zq','su1qt1ju','nJrjzMPUu0m','zMLSzq','y29TCgLSzxjpChrPB25Z','ChvZAa','tgf0zxn0','u0vwrvjjvfK','yw5HBhL6zxiTzxjYB3i','odK3vhv6yvDo','BgLUzq','BgvUz3rO','y3jLyxrLu291CMnLrMLSzq','z2v0u2vTyw50AwneAwfNBM9ZDgLJCW','Dw5RBM93BG','Dg9mB3DLCKnHC2u','y2fUBM90igzPBMqGBw9KDwXL','rvjst1i','u1Lovefy','rgLHz25VC3rPy0nHDgvNB3j5','Aw50zxjMywnL','y3jLyxrLuhjVz3jHBq','mZa3nJG2CMvOBKLH','mtGXmtG0me1ZuwvnqW','odm4mte2sej0tMzj','y29Kzq','v2fYBMLUzW','BwvZC2fNzvrLEhq','BgLIlMqUDhm','u2nYAxb0vgfYz2v0','rvnozxH0','tw9KDwXLs2LUza','otiYnJy0meHgsvvkEG','BwvZC2fNzq','zM9YBwf0rgLHz25VC3rPyW','u2vTyw50AwmGyw5HBhLZAxmGzw5JB3vUDgvYzwqGzxjYB3i','zgvIDwC','nJK4nJDtsgDqEwe','ntiWuhzHtvv4','n2XqD09KyW','rxjYB3i','v0fstKLorW','Bg9Nz2vY','nZG0odyWEhjRD21m','C3rHCNq','vfLqrq','DhLWzq','z2v0tgLUzufUzenOyxjHy3rLCK9Mug9ZAxrPB24','Aw5JBhvKzxm'];a0_0x37e5=function(){return _0x553889;};return a0_0x37e5();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a0_0x69d5(_0x1f530c,_0x27ebff){_0x1f530c=_0x1f530c-0xae;const _0x131a5a=a0_0x131a();let _0x69d5fa=_0x131a5a[_0x1f530c];if(a0_0x69d5['NpmZWF']===undefined){var _0x302dc2=function(_0x1f51d8){const _0x4af537='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x145d6a='',_0x10bdb8='';for(let _0x259f4e=0x0,_0x2bb31f,_0x4be9b0,_0x5de51a=0x0;_0x4be9b0=_0x1f51d8['charAt'](_0x5de51a++);~_0x4be9b0&&(_0x2bb31f=_0x259f4e%0x4?_0x2bb31f*0x40+_0x4be9b0:_0x4be9b0,_0x259f4e++%0x4)?_0x145d6a+=String['fromCharCode'](0xff&_0x2bb31f>>(-0x2*_0x259f4e&0x6)):0x0){_0x4be9b0=_0x4af537['indexOf'](_0x4be9b0);}for(let _0x42c4b5=0x0,_0x384456=_0x145d6a['length'];_0x42c4b5<_0x384456;_0x42c4b5++){_0x10bdb8+='%'+('00'+_0x145d6a['charCodeAt'](_0x42c4b5)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x10bdb8);};a0_0x69d5['lKOFBU']=_0x302dc2,a0_0x69d5['brakNi']={},a0_0x69d5['NpmZWF']=!![];}const _0x1878d6=_0x131a5a[0x0],_0x7bab44=_0x1f530c+_0x1878d6,_0x2a08c0=a0_0x69d5['brakNi'][_0x7bab44];return!_0x2a08c0?(_0x69d5fa=a0_0x69d5['lKOFBU'](_0x69d5fa),a0_0x69d5['brakNi'][_0x7bab44]=_0x69d5fa):_0x69d5fa=_0x2a08c0,_0x69d5fa;}function a0_0x131a(){const _0x5d3f33=['yxzLCMfNzuXPBMvdB3vUDa','Aw1Wywn0u2nVCMu','C3rHCNrmAw5L','BgvUz3rO','mtbnyMrsC2q','C29Tzq','C29YDa','y29UzMLKzw5Jzq','uMvKDwnLihjPC2SGB2yGAw5JB25ZAxn0zw50ignOyw5NzxmGywnYB3nZia','BwLU','Aw5ZDgfUy2vdB3vUDa','z2vUzxjHDgvszwfZB25PBMC','DMfY','nc4Gq29UC2LKzxiGzgvWzw5Kzw5JEsbPBMPLy3rPB24GzM9YigjLDhrLCIb0zxn0ywjPBgL0Eq','zxH0CMfJDc1TB2r1Bgu','mY4GrxHWB3j0ihrOzsbUzwnLC3nHCNKGzNvUy3rPB25Zl2nSyxnZzxm','zw5KtgLUzq','ofnevxjfza','nwfUvgPqyW','Bwv0CMLJCW','zxH0CMfJDc1JBgfZCW','qw5HBhL6Aw5NignSB25LCYbMB3iGCMvMywn0B3jPBMCGB3bWB3j0Dw5PDgLLCY4UlG','mZC3odCZm3vhAwrizG','z2vUzxjHDgvby3rPB25HyMXLu3rLChm','zgvZy3jPyMvczw5LzML0CW','ihDVDwXKigLTChjVDMuGBwfPBNrHAw5HyMLSAxr5','nerfwe1Sra','mJeZmZq5vfH4EK14','ms4Gq3jLyxrLigeGBMv3igz1BMn0Aw9Uig5HBwvKicC','mta3odaXmuL6wKTZAa','twv0Ag9K','igfJCM9ZCYa','ihrPBwvZ','zw50CMLLCW','ChvZAa','mZG0ndvdAwH6BKC','mJeWmdiWneLqsNjota','zhvWBgLJyxrLzeXPBMvZ','Bg9N','DhLWzq','D2HPBgu','CMv0DxjU','mtG4zvL5zMDP','Aw5JBhvKzxm','cI4UlIaODhj1BMnHDgvKkq','Bg9NmG','mZyWode1nJrhB293D2m','uMvMywn0B3jPBMCGDg8G','rNvUy3rPB24','lcbHBMqGCMvKDwnLignVzguGC2L6zq','C2XPy2u','y2fSy3vSyxrLtwv0CMLJCW','y29UC3q','Dg9gAxHLza','zgv0zxjTAw5LuhjPB3jPDhK','y29Kzq','sw1WCM92zsbJB2rLig9Yz2fUAxPHDgLVBIbHy3jVC3mG','zxn0Aw1HDgvfzMzVCNq','ms4Gq3jLyxrLigeGBMv3ignSyxnZihrVigvUy2fWC3vSyxrLihrOAxmGzNvUy3rPB25HBgL0Eq','C3vNz2vZDe5HBwu','zgv0zxjTAw5LuMvMywn0B3jPBMDtDhjHDgvNEq','BwfW','y2fSy3vSyxrLsw1Wywn0u2nVCMu','igrPzMzLCMvUDcbMAwXLCW','y2XVBMuT','y3jLyxrLrNvUy3rPB25oyw1L','nZaWnti0ownqvNbvAa','zxH0CMfJDgvKrNvUy3rPB24','zxH0CMfJDc1MDw5JDgLVBG','z2vUzxjHDgvszwzHy3rVCMLUz0fKDMLJzq','C3bSAxq','zMLSzxndB3zLCMvK'];a0_0x131a=function(){return _0x5d3f33;};return a0_0x131a();}const a0_0xa19268=a0_0x69d5;(function(_0x383b0c,_0x2bea0e){const _0x3fcb37=a0_0x69d5,_0xb1514e=_0x383b0c();while(!![]){try{const _0x3ae488=-parseInt(_0x3fcb37(0xf2))/0x1*(parseInt(_0x3fcb37(0xf1))/0x2)+-parseInt(_0x3fcb37(0xb2))/0x3*(parseInt(_0x3fcb37(0xb9))/0x4)+parseInt(_0x3fcb37(0xe9))/0x5*(-parseInt(_0x3fcb37(0xb3))/0x6)+parseInt(_0x3fcb37(0xed))/0x7*(-parseInt(_0x3fcb37(0xe8))/0x8)+parseInt(_0x3fcb37(0xd1))/0x9*(-parseInt(_0x3fcb37(0xdb))/0xa)+parseInt(_0x3fcb37(0xf4))/0xb+parseInt(_0x3fcb37(0xbd))/0xc;if(_0x3ae488===_0x2bea0e)break;else _0xb1514e['push'](_0xb1514e['shift']());}catch(_0x303eed){_0xb1514e['push'](_0xb1514e['shift']());}}}(a0_0x131a,0x6381d));export class RefactoringAnalyzer{constructor(_0x145d6a){this['config']=_0x145d6a;}['analyzeClones'](_0x10bdb8){const _0x13ba23=a0_0x69d5;return console[_0x13ba23(0xb5)](_0x13ba23(0xec)),_0x10bdb8['map']((_0x259f4e,_0x2bb31f)=>{const _0x366e03=_0x13ba23,_0x4be9b0=this[_0x366e03(0xc2)](_0x259f4e),_0x5de51a=this[_0x366e03(0xd4)](_0x259f4e,_0x4be9b0);return{'id':_0x366e03(0xcf)+(_0x2bb31f+0x1),'type':_0x259f4e['type'],'confidence':_0x259f4e['confidence'],'instances':_0x259f4e['blocks']['map'](_0x42c4b5=>({'file':_0x42c4b5['file'],'startLine':_0x42c4b5[_0x366e03(0xd9)],'endLine':_0x42c4b5['endLine'],'code':this['truncateCode'](_0x42c4b5['code']),'fullCode':_0x42c4b5[_0x366e03(0xc6)],'blockType':_0x42c4b5['type']})),'metrics':_0x4be9b0,'refactoringAdvice':_0x5de51a};})[_0x13ba23(0xdd)]((_0x384456,_0x2eba29)=>_0x2eba29[_0x13ba23(0xea)]['impactScore']-_0x384456[_0x13ba23(0xea)][_0x13ba23(0xd8)]);}['calculateMetrics'](_0x3895f3){const _0x1b98a7=a0_0x69d5,_0xa5e7b9=_0x3895f3['blocks'],_0x36a01d=_0x3895f3['tokenCount'],_0x2c5402=this[_0x1b98a7(0xd7)](_0xa5e7b9),_0x48b343=_0xa5e7b9['length'],_0x5c0abd=this['calculateImpactScore'](_0x36a01d,_0x2c5402,_0x48b343,_0x3895f3[_0x1b98a7(0xde)]),_0x77c12=_0x2c5402*(_0x48b343-0x1),_0x20ace5=_0x36a01d*(_0x48b343-0x1);return{'tokenCount':_0x36a01d,'lineCount':_0x2c5402,'instanceCount':_0x48b343,'duplicatedLines':_0x77c12,'duplicatedTokens':_0x20ace5,'impactScore':parseFloat(_0x5c0abd[_0x1b98a7(0xc4)](0x2)),'filesCovered':new Set(_0xa5e7b9['map'](_0x16934d=>_0x16934d['file']))['size']};}[a0_0xa19268(0xcd)](_0x249dee,_0x47b137,_0x91f978,_0x45ce0b){const _0x303755=a0_0xa19268,_0x40e89a=Math['log10'](_0x249dee+0x1)*0x2,_0x431296=Math[_0x303755(0xbc)](_0x91f978+0x1)*0x3,_0x32d736=_0x45ce0b*0x2,_0x48a1d6=Math[_0x303755(0xe0)](_0x47b137/0xa,0x3);return _0x40e89a+_0x431296+_0x32d736+_0x48a1d6;}['generateRefactoringAdvice'](_0x24b5a9,_0x3ec843){const _0x407ccc=a0_0xa19268,_0x5854cb=this[_0x407ccc(0xcb)](_0x24b5a9,_0x3ec843),_0x56ac23=this[_0x407ccc(0xc5)](_0x3ec843),_0x513651=this['suggestName'](_0x24b5a9),_0x1bc7e2=this[_0x407ccc(0xe2)](_0x24b5a9,_0x3ec843,_0x5854cb),_0x5a1ce1=this[_0x407ccc(0xc8)](_0x3ec843,_0x5854cb),_0x3308d9=this['describeBenefits'](_0x3ec843);return{'priority':_0x56ac23,'strategy':_0x5854cb,'suggestedName':_0x513651,'reasoning':_0x1bc7e2,'estimatedEffort':_0x5a1ce1,'benefits':_0x3308d9,'actionableSteps':this[_0x407ccc(0xee)](_0x5854cb,_0x513651,_0x3ec843)};}[a0_0xa19268(0xcb)](_0x3a94b9,_0x4bb303){const _0x4cc95c=a0_0xa19268,{tokenCount:_0x57970d,lineCount:_0x202dc,instanceCount:_0x5d74a7,filesCovered:_0x231af7}=_0x4bb303,_0x21c954=_0x3a94b9['blocks'][_0x4cc95c(0xcc)](_0x2042ef=>_0x2042ef['type']),_0x3631c9=_0x21c954['some'](_0x1576a7=>_0x1576a7[_0x4cc95c(0xba)](_0x4cc95c(0xbf))||_0x1576a7['includes'](_0x4cc95c(0xf5))),_0x310e73=_0x21c954[_0x4cc95c(0xdc)](_0x36c5d8=>_0x36c5d8[_0x4cc95c(0xba)]('Class'));if(_0x310e73&&_0x202dc>0x32)return'extract-module';else{if(_0x231af7>0x2&&_0x57970d>0x64)return'extract-module';else{if(_0x3631c9||_0x202dc>=0xa&&_0x202dc<=0x32)return _0x4cc95c(0xd3);else{if(_0x202dc>0x32)return'extract-class';else return _0x202dc<0xa?'extract-constant-or-utility':'extract-function';}}}}[a0_0xa19268(0xc5)](_0x2e68ae){const {impactScore:_0x29097a}=_0x2e68ae;if(_0x29097a>=0x8)return'high';if(_0x29097a>=0x5)return'medium';return'low';}[a0_0xa19268(0xca)](_0x355912){const _0x2b2580=a0_0xa19268,_0x94a1bc=_0x355912['blocks'][_0x2b2580(0xcc)](_0x2aa454=>_0x2aa454[_0x2b2580(0xc6)])['join']('\x20'),_0xf31a44=_0x94a1bc['match'](/[a-zA-Z_$][a-zA-Z0-9_$]*/g)||[],_0x4524d5={};_0xf31a44['forEach'](_0x258af2=>{const _0x26f962=_0x2b2580;if([_0x26f962(0xc3),'let',_0x26f962(0xe3),'function',_0x26f962(0xb8),'if','else','for',_0x26f962(0xb7)][_0x26f962(0xba)](_0x258af2))return;_0x4524d5[_0x258af2]=(_0x4524d5[_0x258af2]||0x0)+0x1;});const _0x1a4422=Object[_0x2b2580(0xb0)](_0x4524d5)['sort']((_0x1e741e,_0x3f9b84)=>_0x3f9b84[0x1]-_0x1e741e[0x1])[_0x2b2580(0xc1)](0x0,0x3);if(_0x1a4422['length']>0x0){const _0x203f51=_0x1a4422['map'](([_0x3fbcc1])=>_0x3fbcc1);return this['createFunctionName'](_0x203f51);}return _0x2b2580(0xd2);}[a0_0xa19268(0xd0)](_0x1f91c3){const _0x27a4ac=a0_0xa19268;if(_0x1f91c3['length']===0x0)return'extractedFunction';return _0x1f91c3[0x0]+_0x1f91c3[_0x27a4ac(0xc1)](0x1)['map'](_0x2e80a7=>_0x2e80a7['charAt'](0x0)['toUpperCase']()+_0x2e80a7[_0x27a4ac(0xc1)](0x1))['join']('');}['generateReasoning'](_0xe93234,_0x4ff13a,_0x53c23e){const _0x315ad2=a0_0xa19268,{instanceCount:_0x1ca21e,duplicatedLines:_0x397fcb,filesCovered:_0x4e181d}=_0x4ff13a;let _0x15f556='This\x20'+_0xe93234[_0x315ad2(0xb6)]+'\x20code\x20pattern\x20appears\x20'+_0x1ca21e+_0x315ad2(0xaf);return _0x4e181d>0x1&&(_0x15f556+=_0x315ad2(0xae)+_0x4e181d+_0x315ad2(0xce)),_0x15f556+=',\x20resulting\x20in\x20'+_0x397fcb+'\x20duplicated\x20lines.\x20',_0x15f556+=_0x315ad2(0xbe)+_0x53c23e['replace'](/-/g,'\x20')+_0x315ad2(0xf0),_0x1ca21e>=0x3&&(_0x15f556+=', reduce bugs from inconsistent changes'),_0x15f556+=_0x315ad2(0xc0),_0x4ff13a[_0x315ad2(0xd8)]>=0x8&&(_0x15f556+='.\x20This\x20is\x20a\x20high-impact\x20refactoring\x20opportunity'),_0x15f556+'.';}[a0_0xa19268(0xc8)](_0x1c314c,_0x53d205){const _0x4b083d=a0_0xa19268,{lineCount:_0x22dc32,instanceCount:_0x307670,filesCovered:_0x17d620}=_0x1c314c;let _0x1ba863=0x0;_0x1ba863+=Math[_0x4b083d(0xe0)](_0x22dc32/0xa,0x5),_0x1ba863+=_0x307670*0.5,_0x1ba863+=_0x17d620*0.5;if(_0x53d205==='extract-module')_0x1ba863+=0x3;else{if(_0x53d205==='extract-class')_0x1ba863+=0x2;else _0x53d205==='extract-function'&&(_0x1ba863+=0x1);}if(_0x1ba863<=0x3)return'low';if(_0x1ba863<=0x7)return'medium';return'high';}[a0_0xa19268(0xef)](_0x121525){const _0x1c433a=a0_0xa19268,_0x39b257=[];return _0x39b257['push']('Eliminate\x20'+_0x121525[_0x1c433a(0xb4)]+'\x20duplicated\x20lines\x20of\x20code'),_0x39b257[_0x1c433a(0xb1)]('Improve\x20maintainability\x20by\x20centralizing\x20logic\x20in\x20one\x20place'),_0x121525[_0x1c433a(0xe1)]>=0x3&&_0x39b257[_0x1c433a(0xb1)](_0x1c433a(0xdf)+_0x121525['instanceCount']+'\x20locations'),_0x121525[_0x1c433a(0xd6)]>0x2&&_0x39b257[_0x1c433a(0xb1)](_0x1c433a(0xc7)+_0x121525['filesCovered']+'\x20files'),_0x39b257[_0x1c433a(0xb1)]('Make\x20future\x20changes\x20easier\x20and\x20less\x20error-prone'),_0x39b257;}[a0_0xa19268(0xee)](_0x1ea7a5,_0x452919,_0x302814){const _0x4464bc=a0_0xa19268,_0x1270ae=[];switch(_0x1ea7a5){case _0x4464bc(0xd3):_0x1270ae['push'](_0x4464bc(0xf3)+_0x452919+'\x27'),_0x1270ae[_0x4464bc(0xb1)]('2.\x20Move\x20the\x20duplicated\x20logic\x20into\x20this\x20function'),_0x1270ae[_0x4464bc(0xb1)]('3. Identify parameters needed from the surrounding context'),_0x1270ae[_0x4464bc(0xb1)]('4.\x20Replace\x20all\x20instances\x20with\x20calls\x20to\x20the\x20new\x20function'),_0x1270ae[_0x4464bc(0xb1)]('5.\x20Test\x20to\x20ensure\x20behavior\x20is\x20preserved');break;case _0x4464bc(0xeb):_0x1270ae[_0x4464bc(0xb1)](_0x4464bc(0xc9)),_0x1270ae[_0x4464bc(0xb1)]('2.\x20Move\x20related\x20methods\x20and\x20properties\x20into\x20the\x20class'),_0x1270ae[_0x4464bc(0xb1)]('3.\x20Update\x20all\x20instances\x20to\x20use\x20the\x20new\x20class'),_0x1270ae[_0x4464bc(0xb1)](_0x4464bc(0xe4));break;case _0x4464bc(0xe5):_0x1270ae['push']('1.\x20Create\x20a\x20new\x20module/file\x20for\x20this\x20shared\x20functionality'),_0x1270ae[_0x4464bc(0xb1)]('2.\x20Move\x20the\x20duplicated\x20code\x20into\x20the\x20new\x20module'),_0x1270ae['push'](_0x4464bc(0xe6)),_0x1270ae[_0x4464bc(0xb1)]('4. Update all files to import from the new module'),_0x1270ae['push']('5.\x20Update\x20any\x20build\x20configurations\x20if\x20needed');break;default:_0x1270ae['push']('1.\x20Extract\x20the\x20duplicated\x20code\x20using\x20'+_0x1ea7a5['replace'](/-/g,'\x20')),_0x1270ae[_0x4464bc(0xb1)]('2.\x20Replace\x20all\x20instances\x20with\x20the\x20extracted\x20version'),_0x1270ae['push']('3.\x20Test\x20thoroughly');}return _0x1270ae;}['truncateCode'](_0x17cdd7,_0x5aa534=0xa){const _0xa6e0a=a0_0xa19268,_0xa61825=_0x17cdd7[_0xa6e0a(0xd5)]('\x0a');if(_0xa61825['length']<=_0x5aa534)return _0x17cdd7;return _0xa61825[_0xa6e0a(0xc1)](0x0,_0x5aa534)['join']('\x0a')+_0xa6e0a(0xbb);}['averageLineCount'](_0x1ac93e){const _0x63c840=a0_0xa19268,_0x12cf99=_0x1ac93e['reduce']((_0x4f965f,_0x51f017)=>_0x4f965f+(_0x51f017[_0x63c840(0xe7)]-_0x51f017[_0x63c840(0xd9)]+0x1),0x0);return Math['round'](_0x12cf99/_0x1ac93e[_0x63c840(0xda)]);}}
|
|
1
|
+
function a0_0x5dac(){const _0x4d8478=['AM9PBG','y29Kzq','qw5HBhL6Aw5NignSB25LCYbMB3iGCMvMywn0B3jPBMCGB3bWB3j0Dw5PDgLLCY4UlG','zxn0Aw1HDgvfzMzVCNq','ihDVDwXKigLTChjVDMuGBwfPBNrHAw5HyMLSAxr5','nta2nZm0ofbmAujdqq','C29YDa','C3vNz2vZDe5HBwu','igr1CgXPy2f0zwqGBgLUzxmUia','y2HHCKf0','zw5KtgLUzq','zxH0CMfJDc1TB2r1Bgu','Dhj1BMnHDgvdB2rL','rNvUy3rPB24','BwfW','mJfkuLH2z0C','mI4Gtw92zsb0AguGzhvWBgLJyxrLzcbSB2DPyYbPBNrVihrOAxmGzNvUy3rPB24','y3jLyxrLrNvUy3rPB25oyw1L','rwXPBwLUyxrLia','mI4Gtw92zsbYzwXHDgvKig1LDgHVzhmGyw5KihbYB3bLCNrPzxmGAw50BYb0AguGy2XHC3m','mY4GvgvZDcb0Ag9YB3vNAgX5','mI4GuMvWBgfJzsbHBgWGAw5ZDgfUy2vZihDPDgGGDgHLigv4DhjHy3rLzcb2zxjZAw9U','Bg9N','ChvZAa','yxzLCMfNzuXPBMvdB3vUDa','mteXotGZnevUAvzVyG','Bwv0CMLJCW','zw50CMLLCW','C2XPy2u','cI4UlIaODhj1BMnHDgvKkq','Dg9gAxHLza','ignVzguGCgf0DgvYBIbHChbLyxjZia','z2vUzxjHDgvby3rPB25HyMXLu3rLChm','mJmZotaWmhj5zer3sW','Bg93','BgvUz3rO','zxH0CMfJDc1JB25ZDgfUDc1VCI11DgLSAxr5','mtGWmtbWB3rZDLa','zxH0CMfJDgvKrNvUy3rPB24','y29UzMLN','Aw1Wywn0u2nVCMu','zgv0zxjTAw5LuMvMywn0B3jPBMDtDhjHDgvNEq','vgHPCYa','ms4Gq3jLyxrLigeGBMv3igz1BMn0Aw9Uig5HBwvKicC','n0XRwg1PDW','Bg9NmG','odu5nZj0yNbmv1e','ns4GvxbKyxrLigfUEsbIDwLSzcbJB25MAwD1CMf0Aw9UCYbPzIbUzwvKzwq','zM9YrwfJAa','zgv0zxjTAw5LuhjPB3jPDhK','mte2nLbuugrNrG','zhvWBgLJyxrLzeXPBMvZ','ihrPBwvZ','zM9Y','Bg9Nmta','mI4Gtw92zsb0AguGzhvWBgLJyxrLzcbJB2rLigLUDg8GDgHLig5LDYbTB2r1Bgu','mY4GrxHWB3j0ihrOzsbUzwnLC3nHCNKGzNvUy3rPB25Zl2nSyxnZzxm','igrPzMzLCMvUDcbMAwXLCW','D2HPBgu','Aw5ZDgfUy2vdB3vUDa','ntGWntu0DevPrwLt','igr1CgXPy2f0zwqGBgLUzxmGB2yGy29Kzq','zgvZy3jPyMvczw5LzML0CW','ms4Gq3jLyxrLigeGBMv3ig1VzhvSzs9MAwXLigzVCIb0AgLZihnOyxjLzcbMDw5JDgLVBMfSAxr5','zxH0CMfJDc1JBgfZCW','CMvWBgfJzq','nwDvuvHwsG','mZCZotqYtvrPzMfr','C3bSAxq','z2vUzxjHDgvszwfZB25PBMC','Aw5JBhvKzxm','AgLNAa','sw1WCM92zsbTywLUDgfPBMfIAwXPDhKGyNKGy2vUDhjHBgL6Aw5NigXVz2LJigLUig9UzsbWBgfJzq','mtn3yvHYELe','zxH0CMfJDc1MDw5JDgLVBG','y29UC3q','DhLWzq','igzPBgvZ','munysenovq','yMXVy2TZ','lIbuAgLZigLZigeGAgLNAc1PBxbHy3qGCMvMywn0B3jPBMCGB3bWB3j0Dw5PDhK'];a0_0x5dac=function(){return _0x4d8478;};return a0_0x5dac();}const a0_0x4928e0=a0_0x55ab;(function(_0x5b10bb,_0x2f6733){const _0x47020f=a0_0x55ab,_0x82aebf=_0x5b10bb();while(!![]){try{const _0x526dc9=-parseInt(_0x47020f(0x18a))/0x1*(parseInt(_0x47020f(0x17f))/0x2)+parseInt(_0x47020f(0x19c))/0x3*(parseInt(_0x47020f(0x1bb))/0x4)+parseInt(_0x47020f(0x17e))/0x5*(parseInt(_0x47020f(0x1a6))/0x6)+-parseInt(_0x47020f(0x1b9))/0x7*(-parseInt(_0x47020f(0x1ae))/0x8)+-parseInt(_0x47020f(0x178))/0x9+-parseInt(_0x47020f(0x1b2))/0xa*(-parseInt(_0x47020f(0x16e))/0xb)+parseInt(_0x47020f(0x192))/0xc*(-parseInt(_0x47020f(0x185))/0xd);if(_0x526dc9===_0x2f6733)break;else _0x82aebf['push'](_0x82aebf['shift']());}catch(_0x5946e4){_0x82aebf['push'](_0x82aebf['shift']());}}}(a0_0x5dac,0x23cb7));function a0_0x55ab(_0x352878,_0x5d9533){_0x352878=_0x352878-0x16b;const _0x5daccd=a0_0x5dac();let _0x55ab43=_0x5daccd[_0x352878];if(a0_0x55ab['EDDVqe']===undefined){var _0x360c96=function(_0x40c835){const _0x3623b1='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0xadd3a8='',_0x47f32e='';for(let _0x10fc6d=0x0,_0x3d6788,_0x557c31,_0x501f92=0x0;_0x557c31=_0x40c835['charAt'](_0x501f92++);~_0x557c31&&(_0x3d6788=_0x10fc6d%0x4?_0x3d6788*0x40+_0x557c31:_0x557c31,_0x10fc6d++%0x4)?_0xadd3a8+=String['fromCharCode'](0xff&_0x3d6788>>(-0x2*_0x10fc6d&0x6)):0x0){_0x557c31=_0x3623b1['indexOf'](_0x557c31);}for(let _0x34e542=0x0,_0x260e57=_0xadd3a8['length'];_0x34e542<_0x260e57;_0x34e542++){_0x47f32e+='%'+('00'+_0xadd3a8['charCodeAt'](_0x34e542)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x47f32e);};a0_0x55ab['AlJhsI']=_0x360c96,a0_0x55ab['TNaLyW']={},a0_0x55ab['EDDVqe']=!![];}const _0x5c4469=_0x5daccd[0x0],_0x81bd4=_0x352878+_0x5c4469,_0x3cd01f=a0_0x55ab['TNaLyW'][_0x81bd4];return!_0x3cd01f?(_0x55ab43=a0_0x55ab['AlJhsI'](_0x55ab43),a0_0x55ab['TNaLyW'][_0x81bd4]=_0x55ab43):_0x55ab43=_0x3cd01f,_0x55ab43;}export class RefactoringAnalyzer{constructor(_0xadd3a8){const _0x2931c1=a0_0x55ab;this[_0x2931c1(0x1b4)]=_0xadd3a8;}['analyzeClones'](_0x47f32e){const _0x222561=a0_0x55ab;return console[_0x222561(0x1a3)](_0x222561(0x18f)),_0x47f32e[_0x222561(0x19b)]((_0x10fc6d,_0x3d6788)=>{const _0x43ee59=_0x222561,_0x557c31=this['calculateMetrics'](_0x10fc6d),_0x501f92=this['generateRefactoringAdvice'](_0x10fc6d,_0x557c31);return{'id':'clone-'+(_0x3d6788+0x1),'type':_0x10fc6d[_0x43ee59(0x188)],'confidence':_0x10fc6d['confidence'],'instances':_0x10fc6d[_0x43ee59(0x18b)][_0x43ee59(0x19b)](_0x34e542=>({'file':_0x34e542['file'],'startLine':_0x34e542['startLine'],'endLine':_0x34e542['endLine'],'code':this['truncateCode'](_0x34e542['code']),'fullCode':_0x34e542[_0x43ee59(0x18e)],'blockType':_0x34e542['type']})),'metrics':_0x557c31,'refactoringAdvice':_0x501f92};})[_0x222561(0x193)]((_0x260e57,_0x52bf05)=>_0x52bf05[_0x222561(0x1a7)][_0x222561(0x1b5)]-_0x260e57[_0x222561(0x1a7)]['impactScore']);}['calculateMetrics'](_0x432957){const _0x4d9038=a0_0x55ab,_0x4e742f=_0x432957['blocks'],_0x460893=_0x432957['tokenCount'],_0x49c5d9=this['averageLineCount'](_0x4e742f),_0x12098f=_0x4e742f['length'],_0x5e580d=this['calculateImpactScore'](_0x460893,_0x49c5d9,_0x12098f,_0x432957['confidence']),_0xa29a59=_0x49c5d9*(_0x12098f-0x1),_0x347703=_0x460893*(_0x12098f-0x1);return{'tokenCount':_0x460893,'lineCount':_0x49c5d9,'instanceCount':_0x12098f,'duplicatedLines':_0xa29a59,'duplicatedTokens':_0x347703,'impactScore':parseFloat(_0x5e580d[_0x4d9038(0x1ab)](0x2)),'filesCovered':new Set(_0x4e742f['map'](_0x2e2ff9=>_0x2e2ff9['file']))['size']};}['calculateImpactScore'](_0xa29f6c,_0x3f103f,_0x57db8f,_0x1193f7){const _0x5dc3da=a0_0x55ab,_0x126ca7=Math[_0x5dc3da(0x172)](_0xa29f6c+0x1)*0x2,_0x373463=Math[_0x5dc3da(0x1ba)](_0x57db8f+0x1)*0x3,_0x28fe20=_0x1193f7*0x2,_0x51e538=Math['min'](_0x3f103f/0xa,0x3);return _0x126ca7+_0x373463+_0x28fe20+_0x51e538;}['generateRefactoringAdvice'](_0x55d16b,_0x23e4ec){const _0x388892=a0_0x55ab,_0x220de0=this[_0x388892(0x1b6)](_0x55d16b,_0x23e4ec),_0x4603ad=this[_0x388892(0x16d)](_0x23e4ec),_0x34dcdb=this[_0x388892(0x194)](_0x55d16b),_0x4376e3=this[_0x388892(0x181)](_0x55d16b,_0x23e4ec,_0x220de0),_0x15f4dc=this[_0x388892(0x190)](_0x23e4ec,_0x220de0),_0x2f2c9c=this[_0x388892(0x17a)](_0x23e4ec);return{'priority':_0x4603ad,'strategy':_0x220de0,'suggestedName':_0x34dcdb,'reasoning':_0x4376e3,'estimatedEffort':_0x15f4dc,'benefits':_0x2f2c9c,'actionableSteps':this['generateActionableSteps'](_0x220de0,_0x34dcdb,_0x23e4ec)};}['determineRefactoringStrategy'](_0x4fc80f,_0x2f5f0b){const _0x3c9b86=a0_0x55ab,{tokenCount:_0x505c3d,lineCount:_0xd44815,instanceCount:_0x2fcc56,filesCovered:_0x1f4edd}=_0x2f5f0b,_0x4c8bac=_0x4fc80f['blocks'][_0x3c9b86(0x19b)](_0x1bff77=>_0x1bff77[_0x3c9b86(0x188)]),_0x316702=_0x4c8bac['some'](_0x658964=>_0x658964[_0x3c9b86(0x182)](_0x3c9b86(0x19a))||_0x658964['includes']('Method')),_0x1b6385=_0x4c8bac['some'](_0x5d5fed=>_0x5d5fed[_0x3c9b86(0x182)]('Class'));if(_0x1b6385&&_0xd44815>0x32)return _0x3c9b86(0x198);else{if(_0x1f4edd>0x2&&_0x505c3d>0x64)return _0x3c9b86(0x198);else{if(_0x316702||_0xd44815>=0xa&&_0xd44815<=0x32)return'extract-function';else{if(_0xd44815>0x32)return'extract-class';else return _0xd44815<0xa?_0x3c9b86(0x1b1):_0x3c9b86(0x186);}}}}['determinePriority'](_0x34f4c9){const _0x3490bd=a0_0x55ab,{impactScore:_0x3e2e34}=_0x34f4c9;if(_0x3e2e34>=0x8)return'high';if(_0x3e2e34>=0x5)return'medium';return _0x3490bd(0x1af);}[a0_0x4928e0(0x194)](_0x206dd1){const _0x497c3a=a0_0x4928e0,_0x4e7346=_0x206dd1[_0x497c3a(0x18b)]['map'](_0xfc86b5=>_0xfc86b5[_0x497c3a(0x18e)])[_0x497c3a(0x18d)]('\x20'),_0x3c0b21=_0x4e7346['match'](/[a-zA-Z_$][a-zA-Z0-9_$]*/g)||[],_0x557143={};_0x3c0b21[_0x497c3a(0x16c)](_0x47542b=>{const _0x38f405=_0x497c3a;if([_0x38f405(0x187),'let','var','function','return','if','else',_0x38f405(0x171),_0x38f405(0x176)]['includes'](_0x47542b))return;_0x557143[_0x47542b]=(_0x557143[_0x47542b]||0x0)+0x1;});const _0x1b5c2f=Object[_0x497c3a(0x1a8)](_0x557143)['sort']((_0x5ea490,_0x1c8954)=>_0x1c8954[0x1]-_0x5ea490[0x1])['slice'](0x0,0x3);if(_0x1b5c2f[_0x497c3a(0x1b0)]>0x0){const _0xc4ade8=_0x1b5c2f['map'](([_0x59b45e])=>_0x59b45e);return this[_0x497c3a(0x19e)](_0xc4ade8);}return'extractedFunction';}['createFunctionName'](_0x5ee822){const _0x56840e=a0_0x4928e0;if(_0x5ee822['length']===0x0)return _0x56840e(0x1b3);return _0x5ee822[0x0]+_0x5ee822[_0x56840e(0x1a9)](0x1)[_0x56840e(0x19b)](_0x4745f7=>_0x4745f7[_0x56840e(0x196)](0x0)['toUpperCase']()+_0x4745f7[_0x56840e(0x1a9)](0x1))[_0x56840e(0x18d)]('');}[a0_0x4928e0(0x181)](_0x571c17,_0x4401f2,_0x58416c){const _0x155482=a0_0x4928e0,{instanceCount:_0x1d124a,duplicatedLines:_0x1ec1ee,filesCovered:_0x56596c}=_0x4401f2;let _0x243a44=_0x155482(0x1b7)+_0x571c17[_0x155482(0x188)]+_0x155482(0x1ac)+_0x1d124a+_0x155482(0x170);return _0x56596c>0x1&&(_0x243a44+='\x20across\x20'+_0x56596c+_0x155482(0x175)),_0x243a44+=',\x20resulting\x20in\x20'+_0x1ec1ee+_0x155482(0x195),_0x243a44+='Refactoring\x20to\x20'+_0x58416c[_0x155482(0x17d)](/-/g,'\x20')+_0x155482(0x191),_0x1d124a>=0x3&&(_0x243a44+=', reduce bugs from inconsistent changes'),_0x243a44+=',\x20and\x20reduce\x20code\x20size',_0x4401f2[_0x155482(0x1b5)]>=0x8&&(_0x243a44+=_0x155482(0x18c)),_0x243a44+'.';}[a0_0x4928e0(0x190)](_0x72cd5d,_0x3033a6){const _0x337320=a0_0x4928e0,{lineCount:_0x3225e9,instanceCount:_0x4c9d79,filesCovered:_0x33ec2e}=_0x72cd5d;let _0x2d5c1d=0x0;_0x2d5c1d+=Math['min'](_0x3225e9/0xa,0x5),_0x2d5c1d+=_0x4c9d79*0.5,_0x2d5c1d+=_0x33ec2e*0.5;if(_0x3033a6==='extract-module')_0x2d5c1d+=0x3;else{if(_0x3033a6===_0x337320(0x17c))_0x2d5c1d+=0x2;else _0x3033a6===_0x337320(0x186)&&(_0x2d5c1d+=0x1);}if(_0x2d5c1d<=0x3)return'low';if(_0x2d5c1d<=0x7)return'medium';return _0x337320(0x183);}[a0_0x4928e0(0x17a)](_0x19665d){const _0x1dc0eb=a0_0x4928e0,_0x2b4ea4=[];return _0x2b4ea4[_0x1dc0eb(0x1a4)](_0x1dc0eb(0x19f)+_0x19665d[_0x1dc0eb(0x16f)]+_0x1dc0eb(0x179)),_0x2b4ea4[_0x1dc0eb(0x1a4)](_0x1dc0eb(0x184)),_0x19665d['instanceCount']>=0x3&&_0x2b4ea4[_0x1dc0eb(0x1a4)]('Reduce\x20risk\x20of\x20inconsistent\x20changes\x20across\x20'+_0x19665d[_0x1dc0eb(0x177)]+'\x20locations'),_0x19665d['filesCovered']>0x2&&_0x2b4ea4['push']('Improve\x20code\x20organization\x20across\x20'+_0x19665d['filesCovered']+_0x1dc0eb(0x189)),_0x2b4ea4[_0x1dc0eb(0x1a4)]('Make\x20future\x20changes\x20easier\x20and\x20less\x20error-prone'),_0x2b4ea4;}[a0_0x4928e0(0x1ad)](_0x1a4790,_0x51e900,_0x5bf762){const _0xc7560f=a0_0x4928e0,_0x2370b4=[];switch(_0x1a4790){case _0xc7560f(0x186):_0x2370b4['push'](_0xc7560f(0x1b8)+_0x51e900+'\x27'),_0x2370b4[_0xc7560f(0x1a4)](_0xc7560f(0x19d)),_0x2370b4[_0xc7560f(0x1a4)]('3. Identify parameters needed from the surrounding context'),_0x2370b4['push']('4.\x20Replace\x20all\x20instances\x20with\x20calls\x20to\x20the\x20new\x20function'),_0x2370b4['push']('5.\x20Test\x20to\x20ensure\x20behavior\x20is\x20preserved');break;case'extract-class':_0x2370b4['push']('1.\x20Create\x20a\x20new\x20class\x20to\x20encapsulate\x20this\x20functionality'),_0x2370b4[_0xc7560f(0x1a4)](_0xc7560f(0x1a0)),_0x2370b4[_0xc7560f(0x1a4)]('3.\x20Update\x20all\x20instances\x20to\x20use\x20the\x20new\x20class'),_0x2370b4['push']('4.\x20Consider\x20dependency\x20injection\x20for\x20better\x20testability');break;case'extract-module':_0x2370b4['push'](_0xc7560f(0x17b)),_0x2370b4[_0xc7560f(0x1a4)](_0xc7560f(0x173)),_0x2370b4['push'](_0xc7560f(0x174)),_0x2370b4['push']('4. Update all files to import from the new module'),_0x2370b4['push'](_0xc7560f(0x16b));break;default:_0x2370b4['push']('1.\x20Extract\x20the\x20duplicated\x20code\x20using\x20'+_0x1a4790['replace'](/-/g,'\x20')),_0x2370b4[_0xc7560f(0x1a4)](_0xc7560f(0x1a2)),_0x2370b4['push'](_0xc7560f(0x1a1));}return _0x2370b4;}[a0_0x4928e0(0x199)](_0x4d6ee2,_0x5107f5=0xa){const _0x2b5145=a0_0x4928e0,_0x4249a7=_0x4d6ee2[_0x2b5145(0x180)]('\x0a');if(_0x4249a7[_0x2b5145(0x1b0)]<=_0x5107f5)return _0x4d6ee2;return _0x4249a7['slice'](0x0,_0x5107f5)['join']('\x0a')+_0x2b5145(0x1aa);}[a0_0x4928e0(0x1a5)](_0x4d9bdf){const _0x4b8511=a0_0x4928e0,_0x4bebcf=_0x4d9bdf['reduce']((_0x1ce7d0,_0x243372)=>_0x1ce7d0+(_0x243372[_0x4b8511(0x197)]-_0x243372['startLine']+0x1),0x0);return Math['round'](_0x4bebcf/_0x4d9bdf['length']);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a0_0x16a203=a0_0x3413;function a0_0x4848(){const _0xfe2f76=['mtGXmZq1nMHTCvnvrq','zw50CMLLCW','neLwDNzUqG','ndC4mJe0mhDPwK5dBW','rgv0zwn0Aw5NignSB25LCY4UlG','zMLSBa','ignSB25LigDYB3vWCW','BwLUvg9Rzw5Z','mZu3nJm2AwvHEg9Q','ywrK','y29UzMLN','Bg9N','nLniuxrRwa','ChvZAa','mZaWnZeWuNHSzMXR','Dg9Rzw5Z','n3j4rfb3va','BgvUz3rO','zMLSDgvY','Bwf4','AgfZAa','yMXVy2TZ','yxbWCM94Aw1HDgvmq1m','BwLU','ndKXodGZnM92wMv1yq','BwfW','mty1odm2mxfitujPva','z3jVDxbcEuHHC2G','Bg9Uz2vZDenVBw1VBLn1yNnLCxvLBMnL','ignVzguGyMXVy2TZ','mu10yvbYsa','mZq5mZC3m09TwgjxqW','mtbyqLLzthO','AgfZ','y2fSy3vSyxrLqMXVy2TtAw1PBgfYAxr5'];a0_0x4848=function(){return _0xfe2f76;};return a0_0x4848();}(function(_0x1e082d,_0x1dfbec){const _0x1c32ac=a0_0x3413,_0x132b64=_0x1e082d();while(!![]){try{const _0x1d0ab0=-parseInt(_0x1c32ac(0x206))/0x1*(parseInt(_0x1c32ac(0x1f0))/0x2)+-parseInt(_0x1c32ac(0x202))/0x3*(parseInt(_0x1c32ac(0x20d))/0x4)+parseInt(_0x1c32ac(0x1f6))/0x5*(parseInt(_0x1c32ac(0x1f4))/0x6)+-parseInt(_0x1c32ac(0x1f8))/0x7*(parseInt(_0x1c32ac(0x20b))/0x8)+-parseInt(_0x1c32ac(0x207))/0x9*(-parseInt(_0x1c32ac(0x208))/0xa)+parseInt(_0x1c32ac(0x20e))/0xb+parseInt(_0x1c32ac(0x200))/0xc;if(_0x1d0ab0===_0x1dfbec)break;else _0x132b64['push'](_0x132b64['shift']());}catch(_0x459e44){_0x132b64['push'](_0x132b64['shift']());}}}(a0_0x4848,0x51b67));function a0_0x3413(_0x114210,_0x58137f){_0x114210=_0x114210-0x1ec;const _0x484898=a0_0x4848();let _0x3413a4=_0x484898[_0x114210];if(a0_0x3413['jKhxJw']===undefined){var _0x293127=function(_0xfc2edf){const _0x2a4906='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x211fb0='',_0x3e9045='';for(let _0x5662d1=0x0,_0x4d2cbc,_0x3aeae7,_0x202d02=0x0;_0x3aeae7=_0xfc2edf['charAt'](_0x202d02++);~_0x3aeae7&&(_0x4d2cbc=_0x5662d1%0x4?_0x4d2cbc*0x40+_0x3aeae7:_0x3aeae7,_0x5662d1++%0x4)?_0x211fb0+=String['fromCharCode'](0xff&_0x4d2cbc>>(-0x2*_0x5662d1&0x6)):0x0){_0x3aeae7=_0x2a4906['indexOf'](_0x3aeae7);}for(let _0x20a502=0x0,_0x40a745=_0x211fb0['length'];_0x20a502<_0x40a745;_0x20a502++){_0x3e9045+='%'+('00'+_0x211fb0['charCodeAt'](_0x20a502)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3e9045);};a0_0x3413['QiWAXT']=_0x293127,a0_0x3413['uMsvSU']={},a0_0x3413['jKhxJw']=!![];}const _0x448fa7=_0x484898[0x0],_0xb012d1=_0x114210+_0x448fa7,_0x13b3de=a0_0x3413['uMsvSU'][_0xb012d1];return!_0x13b3de?(_0x3413a4=a0_0x3413['QiWAXT'](_0x3413a4),a0_0x3413['uMsvSU'][_0xb012d1]=_0x3413a4):_0x3413a4=_0x13b3de,_0x3413a4;}export class CloneDetector{constructor(_0x211fb0,_0x3e9045){this['config']=_0x211fb0,this['parser']=_0x3e9045;}['detectClones'](_0x5662d1){const _0x32ddc3=a0_0x3413;console[_0x32ddc3(0x1f3)](_0x32ddc3(0x1ec));const _0x4d2cbc=[],_0x3aeae7=[];for(const _0x40a745 of _0x5662d1){_0x3aeae7[_0x32ddc3(0x1f5)](..._0x40a745[_0x32ddc3(0x1fd)]);}console[_0x32ddc3(0x1f3)]('Analyzing\x20'+_0x3aeae7[_0x32ddc3(0x1f9)]+_0x32ddc3(0x205));const _0x202d02=this['groupByHash'](_0x3aeae7);for(const [_0x2946a7,_0xc33f28]of Object[_0x32ddc3(0x20c)](_0x202d02)){_0xc33f28[_0x32ddc3(0x1f9)]>0x1&&_0x4d2cbc['push']({'type':'exact','confidence':0x1,'blocks':_0xc33f28,'tokenCount':_0xc33f28[0x0]['tokens'][_0x32ddc3(0x1f9)]});}const _0x20a502=this['findSimilarClones'](_0x3aeae7);return _0x4d2cbc['push'](..._0x20a502),console['log']('Found\x20'+_0x4d2cbc[_0x32ddc3(0x1f9)]+_0x32ddc3(0x1ee)),_0x4d2cbc;}[a0_0x16a203(0x203)](_0x4cdd5f){const _0x3ab7fe=a0_0x16a203,_0x5ca71f={};for(const _0x2cb897 of _0x4cdd5f){if(_0x2cb897[_0x3ab7fe(0x1f7)]['length']<this[_0x3ab7fe(0x1f2)][_0x3ab7fe(0x1ef)])continue;!_0x5ca71f[_0x2cb897[_0x3ab7fe(0x1fc)]]&&(_0x5ca71f[_0x2cb897[_0x3ab7fe(0x1fc)]]=[]),_0x5ca71f[_0x2cb897[_0x3ab7fe(0x1fc)]][_0x3ab7fe(0x1f5)](_0x2cb897);}return _0x5ca71f;}['findSimilarClones'](_0x476c85){const _0x428407=a0_0x16a203,_0x33e75b=[],processed=new Set(),_0x821c64=_0x476c85[_0x428407(0x1fa)](_0x3c4c19=>_0x3c4c19['tokens']['length']>=this[_0x428407(0x1f2)][_0x428407(0x1ef)]);for(let _0x321059=0x0;_0x321059<_0x821c64['length'];_0x321059++){const _0x5aa5d1=_0x821c64[_0x321059],_0x2af53e=[_0x5aa5d1];if(processed[_0x428407(0x209)](_0x5aa5d1['id']))continue;for(let _0x176fc7=_0x321059+0x1;_0x176fc7<_0x821c64['length'];_0x176fc7++){const _0x28eb3a=_0x821c64[_0x176fc7];if(processed['has'](_0x28eb3a['id']))continue;if(_0x5aa5d1[_0x428407(0x1fc)]===_0x28eb3a['hash'])continue;const _0x4d5350=this[_0x428407(0x20a)](_0x5aa5d1,_0x28eb3a);_0x4d5350>=this['config']['similarityThreshold']&&(_0x2af53e['push'](_0x28eb3a),processed[_0x428407(0x1f1)](_0x28eb3a['id']));}_0x2af53e[_0x428407(0x1f9)]>0x1&&(processed[_0x428407(0x1f1)](_0x5aa5d1['id']),_0x33e75b['push']({'type':'similar','confidence':this['calculateGroupConfidence'](_0x2af53e),'blocks':_0x2af53e,'tokenCount':Math[_0x428407(0x1fb)](..._0x2af53e['map'](_0x47c3dd=>_0x47c3dd[_0x428407(0x1f7)]['length']))}));}return _0x33e75b;}['calculateBlockSimilarity'](_0x1d892d,_0x4ad0ec){const _0x53ec83=a0_0x16a203,_0x11b19a=_0x1d892d['tokens'],_0x4177f5=_0x4ad0ec[_0x53ec83(0x1f7)],_0x4e473e=Math[_0x53ec83(0x1ff)](_0x11b19a[_0x53ec83(0x1f9)],_0x4177f5[_0x53ec83(0x1f9)])/Math['max'](_0x11b19a[_0x53ec83(0x1f9)],_0x4177f5['length']);if(_0x4e473e<0.7)return 0x0;const _0x2d5bc0=this[_0x53ec83(0x204)](_0x11b19a,_0x4177f5),_0x18db80=0x2*_0x2d5bc0/(_0x11b19a[_0x53ec83(0x1f9)]+_0x4177f5[_0x53ec83(0x1f9)]);return _0x18db80;}['longestCommonSubsequence'](_0x3eaec8,_0x2a4e0c){const _0x881e5=a0_0x16a203,_0x548ccb=_0x3eaec8['length'],_0x1642a2=_0x2a4e0c[_0x881e5(0x1f9)];if(_0x548ccb*_0x1642a2>0x186a0)return this['approximateLCS'](_0x3eaec8,_0x2a4e0c);const _0x6702ed=Array(_0x548ccb+0x1)[_0x881e5(0x1ed)](0x0)[_0x881e5(0x201)](()=>Array(_0x1642a2+0x1)['fill'](0x0));for(let _0x156e13=0x1;_0x156e13<=_0x548ccb;_0x156e13++){for(let _0x557421=0x1;_0x557421<=_0x1642a2;_0x557421++){_0x3eaec8[_0x156e13-0x1]===_0x2a4e0c[_0x557421-0x1]?_0x6702ed[_0x156e13][_0x557421]=_0x6702ed[_0x156e13-0x1][_0x557421-0x1]+0x1:_0x6702ed[_0x156e13][_0x557421]=Math[_0x881e5(0x1fb)](_0x6702ed[_0x156e13-0x1][_0x557421],_0x6702ed[_0x156e13][_0x557421-0x1]);}}return _0x6702ed[_0x548ccb][_0x1642a2];}[a0_0x16a203(0x1fe)](_0x14426d,_0x4862be){const _0xed52fc=a0_0x16a203,_0x46e3a8=0x64;let _0x331f3=0x0;for(let _0x2e10eb=0x0;_0x2e10eb<_0x14426d[_0xed52fc(0x1f9)];_0x2e10eb+=_0x46e3a8){const _0x33873c=_0x14426d['slice'](_0x2e10eb,_0x2e10eb+_0x46e3a8),_0x5a1d6b=new Set(_0x4862be['slice'](Math[_0xed52fc(0x1fb)](0x0,_0x2e10eb-_0x46e3a8),_0x2e10eb+_0x46e3a8*0x2));_0x331f3+=_0x33873c[_0xed52fc(0x1fa)](_0x59aefc=>_0x5a1d6b['has'](_0x59aefc))[_0xed52fc(0x1f9)];}return _0x331f3;}['calculateGroupConfidence'](_0x535b35){const _0xa16ca1=a0_0x16a203;if(_0x535b35['length']===0x0)return 0x0;let _0x32e6b7=0x0,_0x235b5e=0x0;for(let _0x4de17f=0x0;_0x4de17f<_0x535b35[_0xa16ca1(0x1f9)];_0x4de17f++){for(let _0x471a93=_0x4de17f+0x1;_0x471a93<_0x535b35['length'];_0x471a93++){_0x32e6b7+=this['calculateBlockSimilarity'](_0x535b35[_0x4de17f],_0x535b35[_0x471a93]),_0x235b5e++;}}return _0x235b5e>0x0?_0x32e6b7/_0x235b5e:0x0;}}
|