@ranger-testing/ranger-cli 2.5.4-alpha.57338f5-12 → 2.5.4-alpha.5f9facb-17
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 +36 -14
- package/build/cli.js +1 -1
- package/build/commands/addEnv.js +1 -1
- package/build/commands/authEncrypt.js +1 -1
- package/build/commands/clean.js +1 -1
- package/build/commands/config.js +1 -1
- package/build/commands/env.js +1 -1
- package/build/commands/feature.js +1 -1
- package/build/commands/hook.js +1 -1
- package/build/commands/hooks/autoPrompt.js +1 -1
- package/build/commands/hooks/disable.js +1 -1
- package/build/commands/hooks/enable.js +1 -1
- package/build/commands/hooks/exitPlanMode.js +1 -1
- package/build/commands/hooks/index.js +1 -1
- package/build/commands/hooks/output.js +1 -1
- package/build/commands/hooks/planReminder.js +1 -1
- package/build/commands/hooks/planStart.js +1 -1
- package/build/commands/hooks/postEdit.js +1 -1
- package/build/commands/hooks/preCompact.js +1 -1
- package/build/commands/hooks/sessionEnd.js +1 -1
- package/build/commands/hooks/sessionStart.js +1 -1
- package/build/commands/hooks/stopHook.js +1 -1
- package/build/commands/index.js +1 -1
- package/build/commands/login.js +1 -1
- package/build/commands/mcpBootstrap.js +1 -1
- package/build/commands/migrateProfile.js +1 -1
- package/build/commands/setup/claude.js +1 -1
- package/build/commands/setup/opencode.js +1 -1
- package/build/commands/setupCi.js +1 -1
- package/build/commands/skillup.js +1 -1
- package/build/commands/start.js +1 -1
- package/build/commands/status.js +1 -1
- package/build/commands/update.js +1 -1
- package/build/commands/updateEnv.js +1 -1
- package/build/commands/useEnv.js +1 -1
- package/build/commands/utils/activeProfile.js +1 -1
- package/build/commands/utils/agentEnv.js +1 -1
- package/build/commands/utils/browserSessionsApi.js +1 -1
- package/build/commands/utils/claudeConfig.js +1 -1
- package/build/commands/utils/claudeOverrideSettings.js +1 -1
- package/build/commands/utils/claudePlugin.js +1 -1
- package/build/commands/utils/cloudProfile.js +1 -1
- package/build/commands/utils/cloudProfileSession.js +1 -1
- package/build/commands/utils/crypto.js +1 -1
- package/build/commands/utils/desirePathLog.js +1 -1
- package/build/commands/utils/deviceAuth.js +1 -1
- package/build/commands/utils/environment.js +1 -1
- package/build/commands/utils/featureApi.js +1 -1
- package/build/commands/utils/fixWebmDuration.js +1 -1
- package/build/commands/utils/gitTracked.js +1 -1
- package/build/commands/utils/keychain.js +1 -1
- package/build/commands/utils/legacyWarning.js +1 -1
- package/build/commands/utils/localAgentInstallationsApi.js +1 -1
- package/build/commands/utils/matchAuthEnvironment.js +1 -1
- package/build/commands/utils/mcpImageBase64.js +1 -1
- package/build/commands/utils/model.js +1 -1
- package/build/commands/utils/opencodeConfig.js +1 -1
- package/build/commands/utils/playwrightCli.js +1 -1
- package/build/commands/utils/profileMessages.js +1 -1
- package/build/commands/utils/profileSetupBanner.js +1 -1
- package/build/commands/utils/projectsConfig.js +1 -1
- package/build/commands/utils/rangerConfig.js +1 -1
- package/build/commands/utils/rangerRoot.js +1 -1
- package/build/commands/utils/resolveProfileContext.js +1 -1
- package/build/commands/utils/resolveProfileUrl.js +1 -1
- package/build/commands/utils/retry.js +1 -1
- package/build/commands/utils/sessionCache.js +1 -1
- package/build/commands/utils/settings.js +1 -1
- package/build/commands/utils/skillContent.js +1 -1
- package/build/commands/utils/skills.js +1 -1
- package/build/commands/utils/stitchWebmFiles.js +1 -1
- package/build/commands/utils/telemetry.js +1 -1
- package/build/commands/utils/tokenRefresh.js +1 -1
- package/build/commands/utils/traceSnapshotMapper.js +1 -1
- package/build/commands/utils/userApi.js +1 -1
- package/build/commands/utils/version.js +1 -1
- package/build/commands/verifyFeature.js +1 -1
- package/build/commands/verifyFeatureCli.js +1 -1
- package/build/skills/ranger/SKILL.md +15 -5
- package/build/skills/ranger/verify.md +15 -3
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
function _0x316a(){const _0x3310de=['zu5qtMW','zeHvqNq','AuHmDue','l3n0zxbZlW','t0HyEu4','C2L6zq','s2r6t20','ALzUvu0','uLv6sgW','nJq1nZG3mfPlrwf5qG','wg5rD2u','uMXLugm','DMLKzw8VD2vIBq','zuz4qu4','C2v0DgLUz3m','ANnVBG','mJrmyvDwy0O','tM8GqvbjihrVA2vUignVBMzPz3vYzwqUifj1BJOGCMfUz2vYihnLDhvWifT0B2TLBL0','y29UC3rYDwn0B3i','l3vWBg9Hzc11CMXZ','BvDptNu','twzMswO','yvnOCMW','mtqYmtG4mgrTBujkuG','wKDjyvy','swvQCxm','CeLyuhu','ouHsuMD1Cq','u2zVq2K','rMfPBgvKihrVignYzwf0zsbICM93C2vYihnLC3nPB246ia','whz2z3O','qNzVzee','AMnODvm','ywTNqwC','AufquNq','l2fWAs92ms9Ty3aVyNjVD3nLCI1ZzxnZAw9UCW','l2fZC2v0CW','wgXMzfy','y1DSzuO','Bwv0ywrHDge','zgnsuKW','nte0ndeYCKnesNbi','rMfPBgvKihrVihvWBg9HzcbMAwXLoIa','AM1MExq','mJK4mtC3EvnhwKXO','zKHbtK8','B2vsDLi','l3n0zxbZ','zhroChG','yxbWBgLJyxrPB24VEMLW','ue9tva','uefuq0G','zLfbq0G','zMvor1a','mtu3odu4offzyurxzG','BgvUz3rO','wKToCe8','rMfPBgvKihrVihvWzgf0zsbICM93C2vYihnLC3nPB246ia','C1fov3y','ww5MrKq','ueHzAeG','tM9wA3O','zK9dBe8','vNLMrwu','uu5Kv2i','mJK5odu0mJnICM5jy0q','oda2ndGWoefizhLqvq','thHnBfq','Aw1Hz2uVCg5N','BfrisKu','mwzuyu1XvG','BhfmtwS','Dgv4Da','swngCNO','rMfPBgvKihrVigDLDcb1CgXVywqGvvjmCZOG','tvjsu1e','B0f2Efu','yMfZzty0','mZnIuxPtsKC','tvrrCum','tNzZBxO','DxbKyxrL','ufDSrfi','vgHlzfO','mJriB2HWCwG','yxbWBgLJyxrPB24VANnVBMW','y2HLy2TSAxn0sxrLBuLK','v3vnBK0','l2fWAs92ms9Ty3aVChjVEhKTC2vZC2LVBG','rMfPBgvKihrVigDLDcbWCM94EsbZzxnZAw9UihrVA2vUoIa','C3rYAw5NAwz5','A0nXBM0','Ahr0Chm6lY90CMfJzs5WBgf5D3jPz2H0lMrLDI8/DhjHy2u9','v3nWAwG','yxbWBgLJyxrPB24VANnVBG','Dg9tDhjPBMC','uNLSDgK','veDdA3y','ugreDMq','DgfZAW','yxbWBhK','v0vVAwW','EfzkteS','qurArem','ywzQwxC','yK5sqvG','EgT5yxm','rMHLDvq','AwXoshK','l2fWAs92ms9Ty3aVyNjVD3nLCI1ZzxnZAw9UCY8','kcGOlISPkYKRksSK','C2vHCMnO','DxjS','zgLNzxn0','ug5hywm','sNPduLC','yNHLz3e','n2TZrxn4Bq','AM5dr1G','sKX2BvG','qMvHCMvYia','ue1huMe','wvLjBhC','rMfPBgvKihrVigDLDcbICM93C2vYihnLC3nPB246ia','y2HLy2TZDw0','y1zuvhq','rMfPBgvKihrVignYzwf0zsbZDgvWigfZC2v0oIa','DxbKyxrLqNjVD3nLCLnLC3nPB24','DhzlyKW','yKHIuK4'];_0x316a=function(){return _0x3310de;};return _0x316a();}(function(_0x2311d1,_0x599029){const _0x333180=_0x5e20,_0x32dea2=_0x2311d1();while(!![]){try{const _0x16dfd6=parseInt(_0x333180(0x22d))/0x1*(-parseInt(_0x333180(0x21d))/0x2)+-parseInt(_0x333180(0x235))/0x3*(parseInt(_0x333180(0x210))/0x4)+-parseInt(_0x333180(0x1fe))/0x5*(-parseInt(_0x333180(0x23b))/0x6)+parseInt(_0x333180(0x1da))/0x7*(-parseInt(_0x333180(0x229))/0x8)+-parseInt(_0x333180(0x202))/0x9*(-parseInt(_0x333180(0x1f0))/0xa)+parseInt(_0x333180(0x213))/0xb*(parseInt(_0x333180(0x1f7))/0xc)+parseInt(_0x333180(0x228))/0xd;if(_0x16dfd6===_0x599029)break;else _0x32dea2['push'](_0x32dea2['shift']());}catch(_0x533cf9){_0x32dea2['push'](_0x32dea2['shift']());}}}(_0x316a,0xe38d0));const _0x2ea533=(function(){const _0x350f9d=_0x5e20,_0x22bdce={'oAvxU':_0x350f9d(0x1d3),'dcRRL':function(_0x206e78,_0x3dec0d){return _0x206e78===_0x3dec0d;},'QiTjd':_0x350f9d(0x232),'bHbRN':'FzTaG','PMGRa':function(_0x306ccd,_0x365c39){return _0x306ccd(_0x365c39);},'QNdWb':'md5','oTCnt':_0x350f9d(0x234),'kCqnm':function(_0x270025,_0x2a5037){return _0x270025!==_0x2a5037;},'OHXyN':_0x350f9d(0x206)};let _0x36293d=!![];return function(_0x482a7f,_0x3497b8){const _0x2c4ec7=_0x350f9d,_0x26f868={'tvKbL':function(_0x533b0b,_0x47e523){const _0x3bc2e4=_0x5e20;return _0x22bdce[_0x3bc2e4(0x1de)](_0x533b0b,_0x47e523);},'dzOab':_0x22bdce[_0x2c4ec7(0x227)],'VTmQs':_0x22bdce['oTCnt']};if(_0x22bdce[_0x2c4ec7(0x242)]('cGlyc',_0x22bdce[_0x2c4ec7(0x1eb)])){const _0x12cd93=_0x36293d?function(){const _0x1f6c8f=_0x2c4ec7,_0x300a7b={'Xvvgz':_0x22bdce[_0x1f6c8f(0x233)]};if(_0x3497b8){if(_0x22bdce[_0x1f6c8f(0x20f)](_0x22bdce['QiTjd'],_0x22bdce[_0x1f6c8f(0x1e6)]))return _0x5ca09a['toString']()[_0x1f6c8f(0x1d4)](_0x300a7b[_0x1f6c8f(0x205)])['toString']()[_0x1f6c8f(0x1f9)](_0x1323fe)[_0x1f6c8f(0x1d4)](_0x300a7b['Xvvgz']);else{const _0x443ef8=_0x3497b8[_0x1f6c8f(0x1c9)](_0x482a7f,arguments);return _0x3497b8=null,_0x443ef8;}}}:function(){};return _0x36293d=![],_0x12cd93;}else return _0x26f868[_0x2c4ec7(0x1e5)](_0x4a348f,_0x26f868['dzOab'])[_0x2c4ec7(0x238)](_0x44cc67)['digest'](_0x26f868['VTmQs']);};}()),_0x279e24=_0x2ea533(this,function(){const _0x1cd0d4=_0x5e20,_0x325862={'Wspih':_0x1cd0d4(0x1d3)};return _0x279e24[_0x1cd0d4(0x1c4)]()[_0x1cd0d4(0x1d4)](_0x325862['Wspih'])[_0x1cd0d4(0x1c4)]()[_0x1cd0d4(0x1f9)](_0x279e24)[_0x1cd0d4(0x1d4)](_0x325862[_0x1cd0d4(0x1c2)]);});_0x279e24();import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{createHash}from'crypto';import{withRetry}from'./retry.js';export async function createBrowserSession(_0x510fcf){const _0x4b5a55=_0x5e20,_0x114410={'RUzHl':function(_0x2b9940){return _0x2b9940();},'cVTTt':function(_0x210b76){return _0x210b76();},'bNRAX':function(_0x30253c,_0x5d8c7d,_0x1b7ac0){return _0x30253c(_0x5d8c7d,_0x1b7ac0);},'FheuT':_0x4b5a55(0x1c3),'RlePc':function(_0x4dc600,_0x4c3d01){return _0x4dc600===_0x4c3d01;},'PnGac':'IUrto'},_0x282c8d=await _0x114410[_0x4b5a55(0x1ef)](getToken);if(!_0x282c8d)throw new Error(_0x4b5a55(0x1f8));const _0x4dc03f=_0x114410[_0x4b5a55(0x1e2)](getApiBaseUrl),_0x599541=await _0x114410[_0x4b5a55(0x1ce)](fetch,_0x4dc03f+_0x4b5a55(0x20a),{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x282c8d,'Content-Type':_0x114410[_0x4b5a55(0x1d0)]},'body':JSON[_0x4b5a55(0x241)]({'environmentName':_0x510fcf?.['environmentName'],'settings':_0x510fcf?.[_0x4b5a55(0x1f5)],'task':_0x510fcf?.[_0x4b5a55(0x1c8)],'url':_0x510fcf?.[_0x4b5a55(0x1d5)],'featureId':_0x510fcf?.['featureId'],'checklistItemId':_0x510fcf?.[_0x4b5a55(0x23d)]})});if(!_0x599541['ok']){if(_0x114410[_0x4b5a55(0x1f2)]('MdzUa',_0x114410[_0x4b5a55(0x1d7)])){const _0x3098ba=_0x1eed13?function(){const _0x15b063=_0x4b5a55;if(_0x36c4bf){const _0x35333f=_0x23d146[_0x15b063(0x1c9)](_0x376051,arguments);return _0x38edff=null,_0x35333f;}}:function(){};return _0x574c68=![],_0x3098ba;}else{const _0x203cf4=await _0x599541[_0x4b5a55(0x22f)]();throw new Error(_0x4b5a55(0x204)+_0x203cf4);}}return _0x599541[_0x4b5a55(0x1f6)]();}export async function updateBrowserSession(_0xb8e0cd,_0x5efc88){const _0x383a9e=_0x5e20,_0x530340={'jchuS':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','afjYw':function(_0x5ea8d9,_0x3632d3,_0xdd6ae){return _0x5ea8d9(_0x3632d3,_0xdd6ae);},'xgowU':'PATCH','Rylti':_0x383a9e(0x1c3),'mWONu':_0x383a9e(0x23e),'eNPNl':function(_0x42c534,_0x4ba0ad,_0x550b71){return _0x42c534(_0x4ba0ad,_0x550b71);}};return _0x530340[_0x383a9e(0x1e7)](withRetry,async()=>{const _0x4e5530=_0x383a9e,_0x3d6ad3=await getToken();if(!_0x3d6ad3)throw new Error(_0x530340[_0x4e5530(0x207)]);const _0x33caf8=getApiBaseUrl(),_0x28d2b0=await _0x530340[_0x4e5530(0x1cd)](fetch,_0x33caf8+'/api/v1/mcp/browser-sessions/'+_0xb8e0cd,{'method':_0x530340['xgowU'],'headers':{'Authorization':_0x4e5530(0x1dd)+_0x3d6ad3,'Content-Type':_0x530340[_0x4e5530(0x1c5)]},'body':JSON[_0x4e5530(0x241)](_0x5efc88)});if(!_0x28d2b0['ok']){if(_0x530340[_0x4e5530(0x1fb)]!==_0x530340[_0x4e5530(0x1fb)])throw new _0x15c68d(_0x4e5530(0x1f8));else{const _0x2f3e77=await _0x28d2b0[_0x4e5530(0x22f)]();throw new Error(_0x4e5530(0x220)+_0x2f3e77);}}return _0x28d2b0[_0x4e5530(0x1f6)]();},{'label':_0x383a9e(0x1e4)});}export async function getBrowserSession(_0x5259a2){const _0x4d17fd=_0x5e20,_0x4830a8={'ZKNpO':function(_0x27bc6e){return _0x27bc6e();},'XnQwe':_0x4d17fd(0x1f8),'WEoil':function(_0x36dfe1,_0x18e644,_0x5565af){return _0x36dfe1(_0x18e644,_0x5565af);}},_0x3e5bf2=await _0x4830a8['ZKNpO'](getToken);if(!_0x3e5bf2)throw new Error(_0x4830a8[_0x4d17fd(0x1f1)]);const _0x47e07a=_0x4830a8[_0x4d17fd(0x21f)](getApiBaseUrl),_0x3a1b28=await _0x4830a8[_0x4d17fd(0x1ca)](fetch,_0x47e07a+_0x4d17fd(0x1d2)+_0x5259a2,{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x3e5bf2}});if(!_0x3a1b28['ok']){const _0x432903=await _0x3a1b28['text']();throw new Error(_0x4d17fd(0x1e0)+_0x432903);}return _0x3a1b28['json']();}export async function getUploadUrls(_0x32dc7c,_0x352be6,_0x210c98,_0x530e88){const _0x127d4c=_0x5e20,_0x2ee2c3={'MffIj':function(_0x1fa177){return _0x1fa177();},'jmfyt':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','EiopC':function(_0x415a2f,_0x5da79f,_0x3d3ebb){return _0x415a2f(_0x5da79f,_0x3d3ebb);},'Iejqs':_0x127d4c(0x219),'xkyas':'application/json','ilNHy':function(_0x261c8e,_0x52204){return _0x261c8e!==_0x52204;},'LxMlT':function(_0x2d61ed,_0x5275af){return _0x2d61ed===_0x5275af;},'YnfFD':_0x127d4c(0x22e)},_0x24e648=await _0x2ee2c3[_0x127d4c(0x1fc)](getToken);if(!_0x24e648)throw new Error(_0x2ee2c3[_0x127d4c(0x212)]);const _0x25bbbb=_0x2ee2c3[_0x127d4c(0x1fc)](getApiBaseUrl),_0x283bfe=await _0x2ee2c3['EiopC'](fetch,_0x25bbbb+'/api/v1/mcp/browser-sessions/'+_0x32dc7c+_0x127d4c(0x1fa),{'method':_0x2ee2c3[_0x127d4c(0x200)],'headers':{'Authorization':'Bearer\x20'+_0x24e648,'Content-Type':_0x2ee2c3[_0x127d4c(0x1cf)]},'body':JSON['stringify']({'filename':_0x352be6,'filetype':_0x210c98,..._0x2ee2c3[_0x127d4c(0x1d1)](_0x530e88?.[_0x127d4c(0x1ec)],undefined)&&{'size':_0x530e88[_0x127d4c(0x1ec)]},..._0x530e88?.[_0x127d4c(0x1e1)]!==undefined&&{'checksum':_0x530e88[_0x127d4c(0x1e1)]},..._0x530e88?.[_0x127d4c(0x20e)]!==undefined&&{'metadata':_0x530e88[_0x127d4c(0x20e)]}})});if(!_0x283bfe['ok']){if(_0x2ee2c3[_0x127d4c(0x22a)](_0x2ee2c3[_0x127d4c(0x222)],_0x127d4c(0x22e))){const _0x308676=await _0x283bfe['text']();throw new Error(_0x127d4c(0x231)+_0x308676);}else{const _0x33d56b=_0x20ebd2['apply'](_0x20eb93,arguments);return _0x1c0855=null,_0x33d56b;}}return _0x283bfe[_0x127d4c(0x1f6)]();}export async function uploadFile(_0x3a541b,_0x272b60,_0x5b13c0){const _0x3dd4f6=_0x5e20,_0x3830b5={'VyfEe':function(_0x5579c3,_0x3e1dc4,_0x3fe7ff){return _0x5579c3(_0x3e1dc4,_0x3fe7ff);},'XWPtV':'PUT'},_0x43d78c=await _0x3830b5[_0x3dd4f6(0x226)](fetch,_0x3a541b,{'method':_0x3830b5['XWPtV'],'headers':{'Content-Type':_0x5b13c0,'Content-Length':_0x272b60[_0x3dd4f6(0x21e)][_0x3dd4f6(0x1c4)]()},'body':_0x272b60});if(!_0x43d78c['ok']){const _0x3ae7ab=await _0x43d78c[_0x3dd4f6(0x22f)]();throw new Error(_0x3dd4f6(0x211)+_0x3ae7ab);}}export async function uploadTrace(_0x318a6a,_0x304cbc){const _0x5dffbc=_0x5e20,_0x45b631={'PWlDR':function(_0x86ae87,_0x235473,_0x5c824a,_0x2abf18){return _0x86ae87(_0x235473,_0x5c824a,_0x2abf18);},'FcwDm':_0x5dffbc(0x218)};return _0x45b631[_0x5dffbc(0x239)](uploadFile,_0x318a6a,_0x304cbc,_0x45b631['FcwDm']);}export async function uploadConversation(_0x5843f9,_0xfa60c4){const _0x5b9acf=_0x5e20,_0x39feee={'TGCkv':function(_0x186622,_0x56f804,_0x5df460,_0x9e4244){return _0x186622(_0x56f804,_0x5df460,_0x9e4244);},'jVnUM':_0x5b9acf(0x23c)};return _0x39feee[_0x5b9acf(0x1c6)](uploadFile,_0x5843f9,_0xfa60c4,_0x39feee[_0x5b9acf(0x1ee)]);}export async function uploadScreenshot(_0x22ffca,_0x13292b){const _0x3e611c=_0x5e20,_0x475bf3={'xVJLK':function(_0x4522ab,_0x10a1df,_0xd0c0f6,_0x4f8291){return _0x4522ab(_0x10a1df,_0xd0c0f6,_0x4f8291);},'xbaYG':_0x3e611c(0x22b)};return _0x475bf3[_0x3e611c(0x1cb)](uploadFile,_0x22ffca,_0x13292b,_0x475bf3['xbaYG']);}export async function uploadVideo(_0x558865,_0x7f746a){const _0x34a13f=_0x5e20,_0x58cc8a={'IcFrz':function(_0x4f497b,_0x47ef69,_0x2bb714,_0x16905e){return _0x4f497b(_0x47ef69,_0x2bb714,_0x16905e);},'ZGIaV':_0x34a13f(0x1f3)};return _0x58cc8a[_0x34a13f(0x230)](uploadFile,_0x558865,_0x7f746a,_0x58cc8a[_0x34a13f(0x1ff)]);}export function buildTraceViewerUrl(_0xe326b6){const _0x18c313=_0x5e20,_0x5b6921=encodeURIComponent(_0xe326b6);return _0x18c313(0x243)+_0x5b6921;}export async function getProxySessionToken(){const _0x70b0c9=_0x5e20,_0x41356c={'MTQqC':_0x70b0c9(0x218),'oeRvR':function(_0x111a62){return _0x111a62();},'jnCGX':function(_0x333a6b,_0x372723){return _0x333a6b!==_0x372723;},'YYIlw':_0x70b0c9(0x1f8),'PHYhH':_0x70b0c9(0x219),'vnjiU':function(_0x3e4091,_0x48b972){return _0x3e4091!==_0x48b972;},'hUcmL':_0x70b0c9(0x21c),'KUBXH':_0x70b0c9(0x20c)},_0x5caf7f=await _0x41356c['oeRvR'](getToken);if(!_0x5caf7f){if(_0x41356c[_0x70b0c9(0x1db)](_0x70b0c9(0x221),_0x70b0c9(0x221)))return _0x1f768d(_0x542ed3,_0x2dd61f,_0x41356c[_0x70b0c9(0x236)]);else throw new Error(_0x41356c[_0x70b0c9(0x1df)]);}const _0x2b6895=_0x41356c[_0x70b0c9(0x215)](getApiBaseUrl),_0x4defd2=await fetch(_0x2b6895+_0x70b0c9(0x23f),{'method':_0x41356c[_0x70b0c9(0x223)],'headers':{'Authorization':_0x70b0c9(0x1dd)+_0x5caf7f}});if(!_0x4defd2['ok']){if(_0x41356c['vnjiU'](_0x41356c['hUcmL'],_0x41356c['KUBXH'])){const _0x3981e1=await _0x4defd2[_0x70b0c9(0x22f)]();throw new Error(_0x70b0c9(0x240)+_0x3981e1);}else{if(_0x5ea5ed){const _0x43674d=_0x36b399[_0x70b0c9(0x1c9)](_0x575a04,arguments);return _0x19f031=null,_0x43674d;}}}const _0x31110f=await _0x4defd2[_0x70b0c9(0x1f6)]();return _0x31110f['sessionToken'];}export function computeChecksum(_0x420705){const _0x56c3d9=_0x5e20,_0x39b775={'KdzOm':function(_0x27374d,_0x38376e){return _0x27374d(_0x38376e);},'PdDvd':'md5','Nvsmz':_0x56c3d9(0x234)};return _0x39b775[_0x56c3d9(0x1ed)](createHash,_0x39b775[_0x56c3d9(0x1c7)])[_0x56c3d9(0x238)](_0x420705)[_0x56c3d9(0x1d6)](_0x39b775[_0x56c3d9(0x237)]);}export async function createVerificationStep(_0x1e414e,_0xadd4b9){const _0x3285d5=_0x5e20,_0x5ba7ff={'lTHJE':function(_0x4cc989){return _0x4cc989();},'fQACH':_0x3285d5(0x1f8),'bxegq':function(_0x56f13,_0x108724,_0x358455){return _0x56f13(_0x108724,_0x358455);}},_0x25b707=await _0x5ba7ff[_0x3285d5(0x22c)](getToken);if(!_0x25b707)throw new Error(_0x5ba7ff[_0x3285d5(0x21b)]);const _0x399bcf=_0x5ba7ff[_0x3285d5(0x22c)](getApiBaseUrl),_0x34b6f6=await _0x5ba7ff[_0x3285d5(0x1d9)](fetch,_0x399bcf+_0x3285d5(0x1d2)+_0x1e414e+'/steps',{'method':_0x3285d5(0x219),'headers':{'Authorization':_0x3285d5(0x1dd)+_0x25b707,'Content-Type':'application/json'},'body':JSON[_0x3285d5(0x241)](_0xadd4b9)});if(!_0x34b6f6['ok']){const _0x153142=await _0x34b6f6[_0x3285d5(0x22f)]();throw new Error('Failed\x20to\x20create\x20verification\x20step:\x20'+_0x153142);}return _0x34b6f6['json']();}export async function createStepAsset(_0x17e2aa,_0x5207df,_0x140bf2){const _0x11ffb4=_0x5e20,_0x2960c1={'fOClO':function(_0x3c362b){return _0x3c362b();},'iHLuA':_0x11ffb4(0x1f8),'aShrl':function(_0x393408){return _0x393408();},'dtNpx':function(_0x5df22c,_0x16ee6,_0x1a9381){return _0x5df22c(_0x16ee6,_0x1a9381);},'pIXPu':_0x11ffb4(0x1c3)},_0x490356=await _0x2960c1[_0x11ffb4(0x225)](getToken);if(!_0x490356)throw new Error(_0x2960c1[_0x11ffb4(0x1e9)]);const _0x3846e8=_0x2960c1[_0x11ffb4(0x1fd)](getApiBaseUrl),_0x24e91a=await _0x2960c1[_0x11ffb4(0x217)](fetch,_0x3846e8+_0x11ffb4(0x1d2)+_0x17e2aa+_0x11ffb4(0x1ea)+_0x5207df+_0x11ffb4(0x20b),{'method':_0x11ffb4(0x219),'headers':{'Authorization':'Bearer\x20'+_0x490356,'Content-Type':_0x2960c1[_0x11ffb4(0x201)]},'body':JSON[_0x11ffb4(0x241)](_0x140bf2)});if(!_0x24e91a['ok']){const _0xb9889f=await _0x24e91a['text']();throw new Error(_0x11ffb4(0x1e3)+_0xb9889f);}return _0x24e91a[_0x11ffb4(0x1f6)]();}export async function updateVerificationStep(_0x186082,_0x26de4a,_0x31fead){const _0x1fbb81=_0x5e20,_0x12c06a={'fHANO':_0x1fbb81(0x23c),'JzCRW':_0x1fbb81(0x1f8),'akgAg':function(_0x529dfc){return _0x529dfc();},'TWSDG':function(_0x24e45d,_0x3a36dc){return _0x24e45d===_0x3a36dc;},'JLvmX':_0x1fbb81(0x203),'cWleJ':function(_0x41dcd8,_0xdf0e9,_0x3e21a3){return _0x41dcd8(_0xdf0e9,_0x3e21a3);},'eFxAN':_0x1fbb81(0x21a),'dHUBt':function(_0x8f1808,_0x23e4da){return _0x8f1808!==_0x23e4da;},'ThKdZ':_0x1fbb81(0x209)},_0x3dab38=await _0x12c06a[_0x1fbb81(0x208)](getToken);if(!_0x3dab38){if(_0x12c06a['TWSDG'](_0x12c06a[_0x1fbb81(0x1dc)],_0x1fbb81(0x203)))throw new Error(_0x12c06a[_0x1fbb81(0x1d8)]);else return _0x38ed80(_0x1b7e6c,_0x579fef,_0x12c06a[_0x1fbb81(0x214)]);}const _0x1ccdf3=_0x12c06a[_0x1fbb81(0x208)](getApiBaseUrl),_0x47233e=await _0x12c06a[_0x1fbb81(0x20d)](fetch,_0x1ccdf3+'/api/v1/mcp/browser-sessions/'+_0x186082+_0x1fbb81(0x1ea)+_0x26de4a,{'method':_0x12c06a[_0x1fbb81(0x1f4)],'headers':{'Authorization':_0x1fbb81(0x1dd)+_0x3dab38,'Content-Type':_0x1fbb81(0x1c3)},'body':JSON['stringify'](_0x31fead)});if(!_0x47233e['ok']){if(_0x12c06a[_0x1fbb81(0x1e8)](_0x12c06a[_0x1fbb81(0x23a)],_0x1fbb81(0x209)))throw new _0x4c30af(_0x12c06a[_0x1fbb81(0x1d8)]);else{const _0x36c5e0=await _0x47233e['text']();throw new Error('Failed\x20to\x20update\x20verification\x20step:\x20'+_0x36c5e0);}}}function _0x5e20(_0xe3c5f1,_0x1f7688){_0xe3c5f1=_0xe3c5f1-0x1c2;const _0x427814=_0x316a();let _0x279e24=_0x427814[_0xe3c5f1];if(_0x5e20['UUtKqf']===undefined){var _0x2ea533=function(_0x5118fc){const _0x28a890='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x5a7bbb='',_0x5336d4='',_0x5ad57a=_0x5a7bbb+_0x2ea533;for(let _0x2be166=0x0,_0x40a121,_0x1fbda0,_0x4ef25e=0x0;_0x1fbda0=_0x5118fc['charAt'](_0x4ef25e++);~_0x1fbda0&&(_0x40a121=_0x2be166%0x4?_0x40a121*0x40+_0x1fbda0:_0x1fbda0,_0x2be166++%0x4)?_0x5a7bbb+=_0x5ad57a['charCodeAt'](_0x4ef25e+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x40a121>>(-0x2*_0x2be166&0x6)):_0x2be166:0x0){_0x1fbda0=_0x28a890['indexOf'](_0x1fbda0);}for(let _0x591a63=0x0,_0x57f31e=_0x5a7bbb['length'];_0x591a63<_0x57f31e;_0x591a63++){_0x5336d4+='%'+('00'+_0x5a7bbb['charCodeAt'](_0x591a63)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5336d4);};_0x5e20['ZvDRBF']=_0x2ea533,_0x5e20['uNRoZd']={},_0x5e20['UUtKqf']=!![];}const _0x316a92=_0x427814[0x0],_0x5e20a1=_0xe3c5f1+_0x316a92,_0x2d07af=_0x5e20['uNRoZd'][_0x5e20a1];if(!_0x2d07af){const _0x1eed13=function(_0x78611){this['tRxFqe']=_0x78611,this['LAjQjh']=[0x1,0x0,0x0],this['QwnxmI']=function(){return'newState';},this['mLbsrW']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['bgHbfH']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x1eed13['prototype']['IjspaO']=function(){const _0x300487=new RegExp(this['mLbsrW']+this['bgHbfH']),_0x1b161a=_0x300487['test'](this['QwnxmI']['toString']())?--this['LAjQjh'][0x1]:--this['LAjQjh'][0x0];return this['pnvUGC'](_0x1b161a);},_0x1eed13['prototype']['pnvUGC']=function(_0x435dbe){if(!Boolean(~_0x435dbe))return _0x435dbe;return this['LuKkVo'](this['tRxFqe']);},_0x1eed13['prototype']['LuKkVo']=function(_0x574c68){for(let _0x36c4bf=0x0,_0x183291=this['LAjQjh']['length'];_0x36c4bf<_0x183291;_0x36c4bf++){this['LAjQjh']['push'](Math['round'](Math['random']())),_0x183291=this['LAjQjh']['length'];}return _0x574c68(this['LAjQjh'][0x0]);},new _0x1eed13(_0x5e20)['IjspaO'](),_0x279e24=_0x5e20['ZvDRBF'](_0x279e24),_0x5e20['uNRoZd'][_0x5e20a1]=_0x279e24;}else _0x279e24=_0x2d07af;return _0x279e24;}export async function getBrowserSessionSteps(_0x530ddd){const _0x38ef7e=_0x5e20,_0x4baa27={'FLKeU':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','ADZDC':function(_0x1609cd){return _0x1609cd();},'NoVkz':function(_0x197d3f,_0x490816,_0xa19d81){return _0x197d3f(_0x490816,_0xa19d81);}},_0x21342d=await getToken();if(!_0x21342d)throw new Error(_0x4baa27['FLKeU']);const _0x5a1ac0=_0x4baa27[_0x38ef7e(0x1cc)](getApiBaseUrl),_0x3a2edb=await _0x4baa27[_0x38ef7e(0x224)](fetch,_0x5a1ac0+_0x38ef7e(0x1d2)+_0x530ddd+_0x38ef7e(0x216),{'method':'GET','headers':{'Authorization':_0x38ef7e(0x1dd)+_0x21342d}});if(!_0x3a2edb['ok']){const _0x3091b2=await _0x3a2edb[_0x38ef7e(0x22f)]();throw new Error('Failed\x20to\x20get\x20browser\x20session\x20steps:\x20'+_0x3091b2);}return _0x3a2edb[_0x38ef7e(0x1f6)]();}
|
|
1
|
+
(function(_0x2f0dd0,_0xc8c3e2){const _0x21ce84=_0x138c,_0x4db8e4=_0x2f0dd0();while(!![]){try{const _0x40f31f=-parseInt(_0x21ce84(0x1d6))/0x1+-parseInt(_0x21ce84(0x1da))/0x2*(-parseInt(_0x21ce84(0x1bb))/0x3)+parseInt(_0x21ce84(0x202))/0x4*(-parseInt(_0x21ce84(0x1b2))/0x5)+parseInt(_0x21ce84(0x1d5))/0x6+parseInt(_0x21ce84(0x1dc))/0x7*(-parseInt(_0x21ce84(0x1cd))/0x8)+-parseInt(_0x21ce84(0x223))/0x9+parseInt(_0x21ce84(0x205))/0xa;if(_0x40f31f===_0xc8c3e2)break;else _0x4db8e4['push'](_0x4db8e4['shift']());}catch(_0x2450a8){_0x4db8e4['push'](_0x4db8e4['shift']());}}}(_0x122b,0xc589e));const _0x34fe6=(function(){let _0x238ea7=!![];return function(_0x9a6eeb,_0x3c62c3){const _0x4d7408=_0x238ea7?function(){if(_0x3c62c3){const _0x48a309=_0x3c62c3['apply'](_0x9a6eeb,arguments);return _0x3c62c3=null,_0x48a309;}}:function(){};return _0x238ea7=![],_0x4d7408;};}()),_0x18ffbc=_0x34fe6(this,function(){const _0x1ca60b=_0x138c,_0x5f0364={'CEnwh':_0x1ca60b(0x1d9)};return _0x18ffbc['toString']()[_0x1ca60b(0x1cb)](_0x5f0364[_0x1ca60b(0x218)])[_0x1ca60b(0x1f6)]()[_0x1ca60b(0x1ae)](_0x18ffbc)[_0x1ca60b(0x1cb)](_0x1ca60b(0x1d9));});_0x18ffbc();import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';function _0x122b(){const _0x18d291=['l2fZC2v0CW','z05ry0e','zgXrq2W','Ahr0Chm6lY90CMfJzs5WBgf5D3jPz2H0lMrLDI8/DhjHy2u9','wxPhBuS','wKj1CNC','C3rYAw5NAwz5','B1rZrfm','sxnPDfu','rMfPBgvKihrVignYzwf0zsbZDgvWigfZC2v0oIa','yxbWBgLJyxrPB24VEMLW','qMvHCMvYia','uefuq0G','q0TrtxK','uvPRwKu','q0vUD2G','AxHxs0K','AwTeveG','zgLNzxn0','rMfPBgvKihrVihvWzgf0zsbICM93C2vYihnLC3nPB246ia','y2HLy2TZDw0','C2vPwvG','rMfPBgvKihrVigDLDcbICM93C2vYihnLC3nPB246ia','wLjpwgK','DMLKzw8VD2vIBq','AuPksxe','nZmYodiXnhbTAfPRCq','BwPACeK','Bwv0ywrHDge','EMnyvvC','B3HgzuC','weDczwm','BgrvD1i','Exf2EuO','Dg9gsKG','yMfZzty0','zNzWvuu','DfritLq','ANnVBG','rxvHyKm','rK9Hq0O','zufHrKS','EKTlwuO','DuLVvK4','t3nNCM0','y29UC3rYDwn0B3i','r3Pdz1q','ywvLu20','y1vbq0C','mtbmve50uKy','yxbWBgLJyxrPB24VANnVBG','zwTxt2y','uKvtAKq','vgrpvuG','qMf3tvG','y2HLy2TSAxn0sxrLBuLK','l3n0zxbZ','qvDkCLC','mZuZnZLUEvnptuy','l2fWAs92ms9Ty3aVyNjVD3nLCI1ZzxnZAw9UCW','qwvOBLy','t0rWuLm','zLLurvO','qxndyLu','BMv5ALu','u0HNCwe','Effdsg0','r0vu','l2fWAs92ms9Ty3aVChjVEhKTC2vZC2LVBG','tffPqMC','Bejlt0q','rMfPBgvKihrVihvWzgf0zsb2zxjPzMLJyxrPB24GC3rLCdOG','rMfPBgvKihrVignYzwf0zsb2zxjPzMLJyxrPB24GC3rLCdOG','vM9qyvu','C2vHCMnO','DxbKyxrL','ota2nJe0nhPMsuHeyW','Evzeuvy','ufvu','Dgv4Da','zvztwxi','CMvjugS','q3D2Aeu','rMfPBgvKihrVigDLDcbWCM94EsbZzxnZAw9UihrVA2vUoIa','mtyYndyWmNHJz3fAta','mZq1oxrqDMvyvq','zw52AxjVBM1LBNroyw1L','ue9tva','kcGOlISPkYKRksSK','mta2ywDqsxDL','l3vWBg9Hzc11CMXZ','n091qKzKtq','B3DjEMG','AgzPtvG','yLLlt3e','A3bAwgm','tM8GqvbjihrVA2vUignVBMzPz3vYzwqUifj1BJOGCMfUz2vYihnLDhvWifT0B2TLBL0','zeP5q0i','DvDTyLa','r2PNtLy','Efb3C1e','rMfPBgvKihrVihvWBg9HzcbMAwXLoIa','rMfPBgvKihrVignYzwf0zsbICM93C2vYihnLC3nPB246ia','sxHsC3i','C2DjA2K','B2Pfsei','DenTCuW','DxjS','yxbWBgLJyxrPB24VANnVBMW','ExvTCMW','tvLsAvu','DhrZAgK','uMnoEw0','sKLSuNO','yxbWBhK','Bu15BMu','Aw1Hz2uVCg5N','Dg9tDhjPBMC','s3rcqxG','tuP4BeC','AuHXvfa','rMfPBgvKihrVigDLDcbICM93C2vYihnLC3nPB24GC3rLChm6ia','BuLVt3K','rMfPBgvKihrVigDLDcb1CgXVywqGvvjmCZOG','C01HBxq','Bwq1','CxDJEKG','wvbizha','l3n0zxbZlW','mtG3odeYnhjnrxvWEG','wxDLvwC','B2Pmv2W','mJGWmZm1nZbZAhvRBvu','l2fWAs92ms9Ty3aVyNjVD3nLCI1ZzxnZAw9UCY8','rvnozwq','BgvUz3rO'];_0x122b=function(){return _0x18d291;};return _0x122b();}import{createHash}from'crypto';import{withRetry}from'./retry.js';export async function createBrowserSession(_0x2074e1){const _0x3f0aae=_0x138c,_0x17d3e3={'qwczH':_0x3f0aae(0x1e1),'fYTEZ':function(_0x256b02,_0x235006,_0x4b9680){return _0x256b02(_0x235006,_0x4b9680);},'LrAls':_0x3f0aae(0x1b3),'iJJIq':function(_0x573b32,_0x355a82){return _0x573b32===_0x355a82;},'neyjU':_0x3f0aae(0x1d3)},_0x3e8f58=await getToken();if(!_0x3e8f58)throw new Error(_0x17d3e3['qwczH']);const _0x3b47c6=getApiBaseUrl(),_0x111845=await _0x17d3e3[_0x3f0aae(0x1bf)](fetch,_0x3b47c6+_0x3f0aae(0x1bc),{'method':_0x3f0aae(0x1d8),'headers':{'Authorization':'Bearer\x20'+_0x3e8f58,'Content-Type':_0x17d3e3['LrAls']},'body':JSON['stringify']({'environmentName':_0x2074e1?.[_0x3f0aae(0x1d7)],'settings':_0x2074e1?.['settings'],'task':_0x2074e1?.['task'],'url':_0x2074e1?.[_0x3f0aae(0x1ec)],'featureId':_0x2074e1?.['featureId'],'checklistItemId':_0x2074e1?.[_0x3f0aae(0x1b8)]})});if(!_0x111845['ok']){if(_0x17d3e3[_0x3f0aae(0x222)](_0x17d3e3[_0x3f0aae(0x1c1)],_0x17d3e3[_0x3f0aae(0x1c1)])){const _0x1d1822=await _0x111845[_0x3f0aae(0x1d0)]();throw new Error(_0x3f0aae(0x1e7)+_0x1d1822);}else throw new _0x111e19(_0x17d3e3[_0x3f0aae(0x1ff)]);}return _0x111845[_0x3f0aae(0x1a7)]();}export async function updateBrowserSession(_0x1076e9,_0x518609){const _0x2b4887=_0x138c,_0x2716ee={'hfiMX':_0x2b4887(0x1ed),'HwbZm':_0x2b4887(0x1e1),'sgIki':function(_0x442705,_0x32dab8){return _0x442705!==_0x32dab8;},'fvpUE':_0x2b4887(0x1aa),'owIzh':function(_0x14fdf0){return _0x14fdf0();},'AWJrW':function(_0x37f0c2,_0x172f2e){return _0x37f0c2!==_0x172f2e;},'seiYX':_0x2b4887(0x1f0),'dlQCl':function(_0x5b655f,_0x3bef68,_0x49ae69){return _0x5b655f(_0x3bef68,_0x49ae69);},'eWeia':_0x2b4887(0x215),'JIlRz':function(_0x12bfa9,_0x5f1e7c){return _0x12bfa9===_0x5f1e7c;},'ESNed':_0x2b4887(0x228),'xQCHm':_0x2b4887(0x210),'cUACG':'updateBrowserSession'};return withRetry(async()=>{const _0x37039c=_0x2b4887,_0x242c65={'xPwsQ':_0x2716ee[_0x37039c(0x1de)],'lBKOD':_0x2716ee['HwbZm']};if(_0x2716ee[_0x37039c(0x1e9)](_0x2716ee[_0x37039c(0x1a5)],_0x2716ee[_0x37039c(0x1a5)]))return _0x597909(_0x279b25,_0x3b415c,_0x242c65[_0x37039c(0x1e5)]);else{const _0x5f107d=await _0x2716ee[_0x37039c(0x1dd)](getToken);if(!_0x5f107d){if(_0x2716ee[_0x37039c(0x1ba)](_0x2716ee[_0x37039c(0x21e)],'ttshi'))throw new _0x5a9b9d(_0x242c65[_0x37039c(0x1c7)]);else throw new Error(_0x2716ee['HwbZm']);}const _0x2aa92c=getApiBaseUrl(),_0x9d639e=await _0x2716ee[_0x37039c(0x20b)](fetch,_0x2aa92c+'/api/v1/mcp/browser-sessions/'+_0x1076e9,{'method':_0x2716ee['eWeia'],'headers':{'Authorization':'Bearer\x20'+_0x5f107d,'Content-Type':_0x37039c(0x1b3)},'body':JSON['stringify'](_0x518609)});if(!_0x9d639e['ok']){if(_0x2716ee[_0x37039c(0x1f2)](_0x2716ee[_0x37039c(0x207)],_0x2716ee[_0x37039c(0x1c3)])){const _0x4eb34b=_0x17fa32['apply'](_0x27734d,arguments);return _0x8f53fe=null,_0x4eb34b;}else{const _0x296eb3=await _0x9d639e['text']();throw new Error(_0x37039c(0x21c)+_0x296eb3);}}return _0x9d639e[_0x37039c(0x1a7)]();}},{'label':_0x2716ee[_0x2b4887(0x1b1)]});}export async function getBrowserSession(_0x4b4fbd){const _0x3c1841=_0x138c,_0xa64124={'FOaCJ':function(_0x2834e0,_0xfb7f43){return _0x2834e0!==_0xfb7f43;},'patiY':_0x3c1841(0x1e3),'ixWKI':_0x3c1841(0x1e1),'AsCbU':function(_0x39cffb){return _0x39cffb();},'gNQcA':function(_0x1313c1,_0x593af8,_0x2410fd){return _0x1313c1(_0x593af8,_0x2410fd);},'TdOUH':_0x3c1841(0x1c4)},_0x3ec802=await getToken();if(!_0x3ec802){if(_0xa64124[_0x3c1841(0x1a9)](_0x3c1841(0x1be),_0xa64124['patiY']))throw new Error(_0xa64124[_0x3c1841(0x219)]);else throw new _0x12c21f('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');}const _0x4d36f3=_0xa64124[_0x3c1841(0x1c0)](getApiBaseUrl),_0x299c8b=await _0xa64124[_0x3c1841(0x20a)](fetch,_0x4d36f3+_0x3c1841(0x206)+_0x4b4fbd,{'method':_0xa64124[_0x3c1841(0x1b6)],'headers':{'Authorization':_0x3c1841(0x214)+_0x3ec802}});if(!_0x299c8b['ok']){const _0x3bfb10=await _0x299c8b['text']();throw new Error(_0x3c1841(0x21f)+_0x3bfb10);}return _0x299c8b[_0x3c1841(0x1a7)]();}export async function getUploadUrls(_0x11b87e,_0x2de7f9,_0xda46f4,_0x5af806){const _0x5ab57d=_0x138c,_0x1f005d={'rZuIh':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','iHqTP':function(_0x2b2d3e,_0x1f338d,_0x5a3ac1){return _0x2b2d3e(_0x1f338d,_0x5a3ac1);},'ojLWl':_0x5ab57d(0x1b3),'RESjD':function(_0x4c8db6,_0x17b6f){return _0x4c8db6!==_0x17b6f;},'zKKYJ':function(_0x58be00,_0x5603d6){return _0x58be00!==_0x5603d6;}},_0x39ebea=await getToken();if(!_0x39ebea)throw new Error(_0x1f005d['rZuIh']);const _0x335dc0=getApiBaseUrl(),_0x1a2d6f=await _0x1f005d[_0x5ab57d(0x1f9)](fetch,_0x335dc0+'/api/v1/mcp/browser-sessions/'+_0x11b87e+_0x5ab57d(0x1db),{'method':_0x5ab57d(0x1d8),'headers':{'Authorization':_0x5ab57d(0x214)+_0x39ebea,'Content-Type':_0x1f005d[_0x5ab57d(0x204)]},'body':JSON['stringify']({'filename':_0x2de7f9,'filetype':_0xda46f4,..._0x1f005d[_0x5ab57d(0x1b5)](_0x5af806?.['size'],undefined)&&{'size':_0x5af806['size']},..._0x1f005d[_0x5ab57d(0x1ab)](_0x5af806?.[_0x5ab57d(0x21d)],undefined)&&{'checksum':_0x5af806[_0x5ab57d(0x21d)]},..._0x1f005d[_0x5ab57d(0x1b5)](_0x5af806?.[_0x5ab57d(0x225)],undefined)&&{'metadata':_0x5af806[_0x5ab57d(0x225)]}})});if(!_0x1a2d6f['ok']){const _0x12543d=await _0x1a2d6f[_0x5ab57d(0x1d0)]();throw new Error(_0x5ab57d(0x1fc)+_0x12543d);}return _0x1a2d6f[_0x5ab57d(0x1a7)]();}export async function uploadFile(_0x6dd548,_0x1d8bf8,_0x1594cd){const _0x112b7c=_0x138c,_0x5abbf0={'ARVPe':function(_0x60d0a9,_0x51b2c1,_0x5c1e2e){return _0x60d0a9(_0x51b2c1,_0x5c1e2e);},'thgmU':_0x112b7c(0x1cf)},_0x4470f0=await _0x5abbf0['ARVPe'](fetch,_0x6dd548,{'method':_0x5abbf0['thgmU'],'headers':{'Content-Type':_0x1594cd,'Content-Length':_0x1d8bf8[_0x112b7c(0x208)][_0x112b7c(0x1f6)]()},'body':_0x1d8bf8});if(!_0x4470f0['ok']){const _0x4a3366=await _0x4470f0[_0x112b7c(0x1d0)]();throw new Error(_0x112b7c(0x1e6)+_0x4a3366);}}export async function uploadTrace(_0x33e232,_0x4abd43){const _0x535143=_0x138c,_0x511b64={'MYRiU':'application/zip'};return uploadFile(_0x33e232,_0x4abd43,_0x511b64[_0x535143(0x1ef)]);}function _0x138c(_0xecb447,_0x179b94){_0xecb447=_0xecb447-0x1a1;const _0x48c9b2=_0x122b();let _0x18ffbc=_0x48c9b2[_0xecb447];if(_0x138c['qAFQIk']===undefined){var _0x34fe6=function(_0x512980){const _0xb7db66='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x11e902='',_0x1dcb65='',_0x23a05c=_0x11e902+_0x34fe6;for(let _0x30624a=0x0,_0x11061b,_0x31e260,_0x45d9e8=0x0;_0x31e260=_0x512980['charAt'](_0x45d9e8++);~_0x31e260&&(_0x11061b=_0x30624a%0x4?_0x11061b*0x40+_0x31e260:_0x31e260,_0x30624a++%0x4)?_0x11e902+=_0x23a05c['charCodeAt'](_0x45d9e8+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x11061b>>(-0x2*_0x30624a&0x6)):_0x30624a:0x0){_0x31e260=_0xb7db66['indexOf'](_0x31e260);}for(let _0x28b5fd=0x0,_0x39cc53=_0x11e902['length'];_0x28b5fd<_0x39cc53;_0x28b5fd++){_0x1dcb65+='%'+('00'+_0x11e902['charCodeAt'](_0x28b5fd)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1dcb65);};_0x138c['XRKklO']=_0x34fe6,_0x138c['SstnPu']={},_0x138c['qAFQIk']=!![];}const _0x122b5d=_0x48c9b2[0x0],_0x138c92=_0xecb447+_0x122b5d,_0x270fad=_0x138c['SstnPu'][_0x138c92];if(!_0x270fad){const _0x14d7ab=function(_0x241182){this['ZTtVkx']=_0x241182,this['KMYGXF']=[0x1,0x0,0x0],this['YREirj']=function(){return'newState';},this['DlNTaS']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['pjjkQl']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x14d7ab['prototype']['ZLlLAR']=function(){const _0x3d90a3=new RegExp(this['DlNTaS']+this['pjjkQl']),_0x1f2b88=_0x3d90a3['test'](this['YREirj']['toString']())?--this['KMYGXF'][0x1]:--this['KMYGXF'][0x0];return this['Cnelap'](_0x1f2b88);},_0x14d7ab['prototype']['Cnelap']=function(_0xde9765){if(!Boolean(~_0xde9765))return _0xde9765;return this['lsmiPs'](this['ZTtVkx']);},_0x14d7ab['prototype']['lsmiPs']=function(_0x289720){for(let _0x54acec=0x0,_0x2e03d4=this['KMYGXF']['length'];_0x54acec<_0x2e03d4;_0x54acec++){this['KMYGXF']['push'](Math['round'](Math['random']())),_0x2e03d4=this['KMYGXF']['length'];}return _0x289720(this['KMYGXF'][0x0]);},new _0x14d7ab(_0x138c)['ZLlLAR'](),_0x18ffbc=_0x138c['XRKklO'](_0x18ffbc),_0x138c['SstnPu'][_0x138c92]=_0x18ffbc;}else _0x18ffbc=_0x270fad;return _0x18ffbc;}export async function uploadConversation(_0x2525a4,_0x5f0680){const _0x35b310=_0x138c,_0x2ab360={'LQiBg':function(_0x57baf0,_0x403261,_0x5eb00c,_0x5128fe){return _0x57baf0(_0x403261,_0x5eb00c,_0x5128fe);},'toFJH':'application/jsonl'};return _0x2ab360[_0x35b310(0x1c6)](uploadFile,_0x2525a4,_0x5f0680,_0x2ab360[_0x35b310(0x1a3)]);}export async function uploadScreenshot(_0x5af3da,_0x3b1066){const _0x3b1b4b=_0x138c,_0x17cedd={'EUutI':function(_0x41b532,_0x3cb37d,_0x2537f4,_0x3dcd72){return _0x41b532(_0x3cb37d,_0x2537f4,_0x3dcd72);},'zplCX':_0x3b1b4b(0x1f5)};return _0x17cedd['EUutI'](uploadFile,_0x5af3da,_0x3b1066,_0x17cedd['zplCX']);}export async function uploadVideo(_0x7613ec,_0x914919){const _0x287650=_0x138c,_0x21ba5f={'ojEHB':'video/webm'};return uploadFile(_0x7613ec,_0x914919,_0x21ba5f[_0x287650(0x1ea)]);}export function buildTraceViewerUrl(_0x11e4ec){const _0x49f3aa=_0x138c,_0x560342={'KXDNf':function(_0x12f7dc,_0x5c843a){return _0x12f7dc(_0x5c843a);}},_0x2b522a=_0x560342['KXDNf'](encodeURIComponent,_0x11e4ec);return _0x49f3aa(0x20c)+_0x2b522a;}export async function getProxySessionToken(){const _0x51ed31=_0x138c,_0x25b5a9={'ekWOf':_0x51ed31(0x1fe),'Kdcgz':_0x51ed31(0x1a4),'yVDQV':_0x51ed31(0x1e1),'kzIjO':function(_0x10ead3){return _0x10ead3();},'Mjesr':function(_0x55b4ce,_0x4c3eef,_0x3e8859){return _0x55b4ce(_0x4c3eef,_0x3e8859);},'YitcX':'POST','dJyCB':function(_0x9e0d3c,_0x43ca93){return _0x9e0d3c!==_0x43ca93;},'ZBurw':_0x51ed31(0x1b0)},_0x3ba5cf=await getToken();if(!_0x3ba5cf)throw new Error(_0x25b5a9[_0x51ed31(0x1ce)]);const _0x1af743=_0x25b5a9['kzIjO'](getApiBaseUrl),_0x24a442=await _0x25b5a9['Mjesr'](fetch,_0x1af743+_0x51ed31(0x1c5),{'method':_0x25b5a9['YitcX'],'headers':{'Authorization':_0x51ed31(0x214)+_0x3ba5cf}});if(!_0x24a442['ok']){if(_0x25b5a9[_0x51ed31(0x1e2)](_0x25b5a9[_0x51ed31(0x20e)],_0x25b5a9['ZBurw']))return _0x3c8a03(_0x25b5a9[_0x51ed31(0x1b4)])[_0x51ed31(0x1cc)](_0x41e54c)[_0x51ed31(0x21b)](_0x25b5a9['Kdcgz']);else{const _0x3e2230=await _0x24a442['text']();throw new Error(_0x51ed31(0x1d4)+_0x3e2230);}}const _0xab5ee9=await _0x24a442[_0x51ed31(0x1a7)]();return _0xab5ee9['sessionToken'];}export function computeChecksum(_0xbcc7f5){const _0x29ce78=_0x138c,_0x46c7ba={'MJxlG':'base64'};return createHash(_0x29ce78(0x1fe))['update'](_0xbcc7f5)[_0x29ce78(0x21b)](_0x46c7ba[_0x29ce78(0x1f8)]);}export async function createVerificationStep(_0x1ced5f,_0x470668){const _0x46f77c=_0x138c,_0x2b6d1d={'EuabC':function(_0x5d6048,_0x6fdfba,_0x12af1c,_0x52e016){return _0x5d6048(_0x6fdfba,_0x12af1c,_0x52e016);},'cEgcO':_0x46f77c(0x213),'tTHNT':function(_0x3413c0){return _0x3413c0();},'YweUg':_0x46f77c(0x1d2),'KtBAx':_0x46f77c(0x1e1),'yqvyJ':function(_0x2eff79){return _0x2eff79();},'bYKOq':_0x46f77c(0x1d8),'uIoVN':_0x46f77c(0x1b3),'IsitU':_0x46f77c(0x226)},_0x251345=await _0x2b6d1d[_0x46f77c(0x1a6)](getToken);if(!_0x251345){if(_0x2b6d1d[_0x46f77c(0x203)]!==_0x46f77c(0x1e8))throw new Error(_0x2b6d1d[_0x46f77c(0x1f7)]);else{const _0x166164=_0x14d7ab?function(){const _0x2f5084=_0x46f77c;if(_0x54acec){const _0x38330a=_0x26ce76[_0x2f5084(0x1f3)](_0xa58d93,arguments);return _0x47e91b=null,_0x38330a;}}:function(){};return _0x289720=![],_0x166164;}}const _0x12e232=_0x2b6d1d[_0x46f77c(0x1a2)](getApiBaseUrl),_0x321bed=await fetch(_0x12e232+_0x46f77c(0x206)+_0x1ced5f+_0x46f77c(0x1b9),{'method':_0x2b6d1d[_0x46f77c(0x1df)],'headers':{'Authorization':'Bearer\x20'+_0x251345,'Content-Type':_0x2b6d1d[_0x46f77c(0x1ac)]},'body':JSON[_0x46f77c(0x20f)](_0x470668)});if(!_0x321bed['ok']){if(_0x2b6d1d[_0x46f77c(0x211)]!=='zcXUW')return _0x2b6d1d[_0x46f77c(0x1a8)](_0x40f4be,_0x10c934,_0x32d79f,_0x2b6d1d['cEgcO']);else{const _0x30bdff=await _0x321bed[_0x46f77c(0x1d0)]();throw new Error(_0x46f77c(0x1c9)+_0x30bdff);}}return _0x321bed['json']();}export async function createStepAsset(_0xd766c6,_0x174b33,_0x117e4c){const _0x1eddf0=_0x138c,_0x5612df={'tCmqL':_0x1eddf0(0x1e1),'mMyne':function(_0x3d9236){return _0x3d9236();},'eVSYr':function(_0x12dd24,_0x240f73){return _0x12dd24!==_0x240f73;},'ldUwR':_0x1eddf0(0x1ad),'RcNym':function(_0x227fbc,_0x31c80e,_0x3765c9){return _0x227fbc(_0x31c80e,_0x3765c9);},'ZROXi':_0x1eddf0(0x1d8)},_0x5d5a46=await _0x5612df[_0x1eddf0(0x1f4)](getToken);if(!_0x5d5a46){if(_0x5612df[_0x1eddf0(0x1d1)](_0x5612df[_0x1eddf0(0x1a1)],_0x5612df[_0x1eddf0(0x1a1)]))throw new _0xbaa3c5(_0x5612df[_0x1eddf0(0x1eb)]);else throw new Error(_0x5612df[_0x1eddf0(0x1eb)]);}const _0x3fd136=_0x5612df[_0x1eddf0(0x1f4)](getApiBaseUrl),_0x266a76=await _0x5612df[_0x1eddf0(0x1f1)](fetch,_0x3fd136+_0x1eddf0(0x206)+_0xd766c6+'/steps/'+_0x174b33+_0x1eddf0(0x209),{'method':_0x5612df[_0x1eddf0(0x220)],'headers':{'Authorization':_0x1eddf0(0x214)+_0x5d5a46,'Content-Type':_0x1eddf0(0x1b3)},'body':JSON[_0x1eddf0(0x20f)](_0x117e4c)});if(!_0x266a76['ok']){const _0x247c3c=await _0x266a76[_0x1eddf0(0x1d0)]();throw new Error(_0x1eddf0(0x212)+_0x247c3c);}return _0x266a76[_0x1eddf0(0x1a7)]();}export async function updateVerificationStep(_0x2b122d,_0x1675c6,_0x147405){const _0x444330=_0x138c,_0x269a1a={'VoPaU':_0x444330(0x1e1),'GzCgT':function(_0x152c5c,_0x50a816,_0x5fe7ad,_0x3e3aaf){return _0x152c5c(_0x50a816,_0x5fe7ad,_0x3e3aaf);},'SHgqa':_0x444330(0x221),'yumrl':function(_0x8251ea,_0x140dbe){return _0x8251ea!==_0x140dbe;},'mIoOy':_0x444330(0x21a),'YzGmK':'GyPpu','mjZpI':function(_0x187b1f){return _0x187b1f();},'sMamt':function(_0x2365f2,_0x1fa64e,_0x5727a1){return _0x2365f2(_0x1fa64e,_0x5727a1);},'oxFeG':'PATCH','kpZXc':_0x444330(0x1b3),'YPHdp':'txHoy'},_0x3249d7=await getToken();if(!_0x3249d7){if(_0x269a1a[_0x444330(0x1ee)](_0x269a1a[_0x444330(0x1fb)],_0x269a1a[_0x444330(0x20d)]))throw new Error(_0x269a1a[_0x444330(0x1ca)]);else throw new _0x38ed37(_0x269a1a['VoPaU']);}const _0x255a91=_0x269a1a[_0x444330(0x224)](getApiBaseUrl),_0x309dc9=await _0x269a1a[_0x444330(0x1fd)](fetch,_0x255a91+_0x444330(0x206)+_0x2b122d+_0x444330(0x201)+_0x1675c6,{'method':_0x269a1a[_0x444330(0x227)],'headers':{'Authorization':_0x444330(0x214)+_0x3249d7,'Content-Type':_0x269a1a[_0x444330(0x1e0)]},'body':JSON[_0x444330(0x20f)](_0x147405)});if(!_0x309dc9['ok']){if(_0x269a1a[_0x444330(0x200)]===_0x269a1a[_0x444330(0x200)]){const _0x44cdaf=await _0x309dc9['text']();throw new Error(_0x444330(0x1c8)+_0x44cdaf);}else return _0x269a1a[_0x444330(0x1af)](_0x292ba4,_0x3bf5e1,_0x3b4f4d,_0x269a1a[_0x444330(0x1c2)]);}}export async function getBrowserSessionSteps(_0x2b766e){const _0x4f5d1c=_0x138c,_0x2b6219={'BGEAd':function(_0x24246e,_0x120259,_0x48b60e,_0x8012b8){return _0x24246e(_0x120259,_0x48b60e,_0x8012b8);},'MyqQF':function(_0x40d0c1){return _0x40d0c1();},'AehnV':_0x4f5d1c(0x1e1),'CKQMy':function(_0x12e31c,_0x521dd5,_0x98d011){return _0x12e31c(_0x521dd5,_0x98d011);},'GjgNV':function(_0x2128fc,_0x471bd3){return _0x2128fc!==_0x471bd3;},'BawMX':_0x4f5d1c(0x217),'XVABl':'KxAjg'},_0x4e641e=await _0x2b6219['MyqQF'](getToken);if(!_0x4e641e)throw new Error(_0x2b6219[_0x4f5d1c(0x1bd)]);const _0x108126=getApiBaseUrl(),_0x61dae9=await _0x2b6219[_0x4f5d1c(0x216)](fetch,_0x108126+_0x4f5d1c(0x206)+_0x2b766e+'/steps',{'method':_0x4f5d1c(0x1c4),'headers':{'Authorization':_0x4f5d1c(0x214)+_0x4e641e}});if(!_0x61dae9['ok']){if(_0x2b6219[_0x4f5d1c(0x1e4)](_0x2b6219[_0x4f5d1c(0x1b7)],_0x2b6219['XVABl'])){const _0x11bac2=await _0x61dae9[_0x4f5d1c(0x1d0)]();throw new Error(_0x4f5d1c(0x1fa)+_0x11bac2);}else return _0x2b6219['BGEAd'](_0x21ac47,_0x326cae,_0x8139d0,'image/png');}return _0x61dae9[_0x4f5d1c(0x1a7)]();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1a5dd2,_0x391daa){const _0x3460c4=_0x73ef,_0x2c4bf1=_0x1a5dd2();while(!![]){try{const _0x58547a=-parseInt(_0x3460c4(0x9b))/0x1+-parseInt(_0x3460c4(0x92))/0x2+parseInt(_0x3460c4(0x88))/0x3+-parseInt(_0x3460c4(0x96))/0x4+parseInt(_0x3460c4(0x9a))/0x5*(parseInt(_0x3460c4(0x9d))/0x6)+parseInt(_0x3460c4(0x98))/0x7+parseInt(_0x3460c4(0x8e))/0x8;if(_0x58547a===_0x391daa)break;else _0x2c4bf1['push'](_0x2c4bf1['shift']());}catch(_0x4cbd79){_0x2c4bf1['push'](_0x2c4bf1['shift']());}}}(_0x10cb,0x48262));import{homedir}from'os';import{join,dirname,parse}from'path';import{existsSync}from'fs';import{readFile,writeFile,mkdir}from'fs/promises';function _0x10cb(){const _0x288648=['CLAUDE_CONFIG_DIR','4328640qkDloc','Wleyu','user','MIZmy','542944NlrcGr','utf-8','thYwT','TiMXc','1632116jeCZps','DsClu','3068471pHixZS','stringify','530DRDzqX','49244TpzIUZ','parse','444BTFCGm','ZJkYP','AmOQn','eEbRo','110970acYRVG','skills','root','.claude','UfrkW'];_0x10cb=function(){return _0x288648;};return _0x10cb();}export function getClaudeConfigDir(){const _0xf3a177=_0x73ef,_0x471111={'ZJkYP':_0xf3a177(0x8b)};return process['env'][_0xf3a177(0x8d)]||join(homedir(),_0x471111[_0xf3a177(0x9e)]);}export function getUserSkillsDir(){const _0x159271=_0x73ef,_0x3cd6c6={'pcleu':function(_0x1745c9,_0x3068c0,_0x2e867a){return _0x1745c9(_0x3068c0,_0x2e867a);},'DsClu':function(_0x4c70ab){return _0x4c70ab();}};return _0x3cd6c6['pcleu'](join,_0x3cd6c6[_0x159271(0x97)](getClaudeConfigDir),'skills');}export function getProjectRoot(){const _0x4554ab=_0x73ef,_0x268b67={'pdbZB':function(_0x4ab730,_0x551cfe){return _0x4ab730(_0x551cfe);},'xJRJq':function(_0x52cc78,_0x5651ae,_0x285c75){return _0x52cc78(_0x5651ae,_0x285c75);}};let _0x5e0f6e=process['cwd']();const _0x4367b9=_0x268b67['pdbZB'](parse,_0x5e0f6e)[_0x4554ab(0x8a)];while(_0x5e0f6e!==_0x4367b9){if(existsSync(_0x268b67['xJRJq'](join,_0x5e0f6e,'.claude')))return _0x5e0f6e;if(existsSync(join(_0x5e0f6e,'.git')))return _0x5e0f6e;_0x5e0f6e=dirname(_0x5e0f6e);}return process['cwd']();}function _0x73ef(_0x595f14,_0x385ce3){_0x595f14=_0x595f14-0x87;const _0x10cb6b=_0x10cb();let _0x73ef2a=_0x10cb6b[_0x595f14];return _0x73ef2a;}export function getProjectSkillsDir(){const _0x966d8f=_0x73ef,_0x292312={'pNdYk':'.claude','TiMXc':_0x966d8f(0x89)};return join(getProjectRoot(),_0x292312['pNdYk'],_0x292312[_0x966d8f(0x95)]);}export function getSkillsDir(_0x4ff04e){const _0x28c4c8=_0x73ef,_0x363569={'tMWAy':function(_0x1f03bf){return _0x1f03bf();}};return _0x4ff04e===_0x28c4c8(0x90)?getUserSkillsDir():_0x363569['tMWAy'](getProjectSkillsDir);}export function getSettingsPath(){const _0x14a45d=_0x73ef,_0x5a2ba5={'UfrkW':function(_0x441c92){return _0x441c92();},'Wleyu':'settings.json'};return join(_0x5a2ba5[_0x14a45d(0x8c)](getClaudeConfigDir),_0x5a2ba5[_0x14a45d(0x8f)]);}export async function loadClaudeSettings(){const _0x2afd5d=_0x73ef,_0x55b72c={'eEbRo':function(_0x3180fe){return _0x3180fe();}},_0x57364e=_0x55b72c[_0x2afd5d(0x87)](getSettingsPath);if(!existsSync(_0x57364e))return{};try{const _0x274b50=await readFile(_0x57364e,_0x2afd5d(0x93));return JSON[_0x2afd5d(0x9c)](_0x274b50);}catch{return{};}}export async function saveClaudeSettings(_0x57a7a1){const _0x472b67=_0x73ef,_0x97ebdd={'AmOQn':function(_0x33ab8b){return _0x33ab8b();},'thYwT':function(_0x8b7e6a,_0x25e198,_0x2c0675,_0x18c127){return _0x8b7e6a(_0x25e198,_0x2c0675,_0x18c127);},'MIZmy':function(_0x180065,_0x1c3fc3){return _0x180065+_0x1c3fc3;}},_0x1e666d=_0x97ebdd[_0x472b67(0x9f)](getSettingsPath),_0x5cecab=getClaudeConfigDir();!existsSync(_0x5cecab)&&await mkdir(_0x5cecab,{'recursive':!![]}),await _0x97ebdd[_0x472b67(0x94)](writeFile,_0x1e666d,_0x97ebdd[_0x472b67(0x91)](JSON[_0x472b67(0x99)](_0x57a7a1,null,0x2),'\x0a'),'utf-8');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xa0c8f0,_0x4d3947){const _0xab634=_0x3203,_0x3bebbb=_0xa0c8f0();while(!![]){try{const _0xf85a88=-parseInt(_0xab634(0x1ef))/0x1+-parseInt(_0xab634(0x1f1))/0x2*(-parseInt(_0xab634(0x1f2))/0x3)+parseInt(_0xab634(0x1ec))/0x4+parseInt(_0xab634(0x1ee))/0x5+-parseInt(_0xab634(0x1f0))/0x6+-parseInt(_0xab634(0x1eb))/0x7+parseInt(_0xab634(0x1ed))/0x8;if(_0xf85a88===_0x4d3947)break;else _0x3bebbb['push'](_0x3bebbb['shift']());}catch(_0x57b65b){_0x3bebbb['push'](_0x3bebbb['shift']());}}}(_0x5a58,0x38899));function _0x3203(_0xc922ce,_0x17a458){_0xc922ce=_0xc922ce-0x1eb;const _0x5a583a=_0x5a58();let _0x320398=_0x5a583a[_0xc922ce];return _0x320398;}import{isByokEnabled}from'./environment.js';function _0x5a58(){const _0x141d05=['1531256eTvUyE','2297305YbtclG','14173oeLicG','2307972ObTYln','296IybfKd','5259YYcBpr','2720347boEWyf','434884rtqQBL'];_0x5a58=function(){return _0x141d05;};return _0x5a58();}const RANGER_CLAUDE_OVERRIDE_SETTINGS={'env':{'CLAUDE_CODE_USE_BEDROCK':'0'}};export function buildClaudeOverrideExtraArgs(){if(isByokEnabled())return{};return{'settings':JSON['stringify'](RANGER_CLAUDE_OVERRIDE_SETTINGS)};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x3a9e95,_0x2295a4){const _0x188dea=_0x156f,_0x517d07=_0x3a9e95();while(!![]){try{const _0x4f2489=parseInt(_0x188dea(0x21e))/0x1+parseInt(_0x188dea(0x222))/0x2+parseInt(_0x188dea(0x213))/0x3+-parseInt(_0x188dea(0x218))/0x4+parseInt(_0x188dea(0x1fd))/0x5+-parseInt(_0x188dea(0x1f3))/0x6*(parseInt(_0x188dea(0x1f4))/0x7)+-parseInt(_0x188dea(0x212))/0x8*(parseInt(_0x188dea(0x21a))/0x9);if(_0x4f2489===_0x2295a4)break;else _0x517d07['push'](_0x517d07['shift']());}catch(_0x177d3f){_0x517d07['push'](_0x517d07['shift']());}}}(_0x45ee,0xb596d));import{spawn}from'child_process';import{existsSync}from'fs';import{readFile}from'fs/promises';function _0x45ee(){const _0x58359a=['PpbyE','filter','length','oylqS','toString','Apvdk','parse','WSMSx','VHmqK','sort','ObSYE','pipe','match','inherit','close','24AlYGjP','3577356lxHiZh','fydfZ','ndswS','marketplace','success','737736fDPgjL','vMErq','1247679soFaOZ','data','Command\x20exited\x20with\x20code\x20','wAYdQ','534356eiGkLN','captureOutput','SyScj','installed_plugins.json','1823694CLEivm','272598NYNsLE','217EyAoZm','claude','OhmFx','toLowerCase','local','output','list','version','user','569420KBiMjR','ignore','stderr','plugins','projectPath','includes'];_0x45ee=function(){return _0x58359a;};return _0x45ee();}import{join,resolve}from'path';import{getClaudeConfigDir,getProjectRoot}from'./claudeConfig.js';export function runClaudeCommand(_0x3a5324,_0x53e5bb){const _0x47d1a9=_0x156f,_0x1ffbcb={'wvEQc':function(_0x3e1b69,_0xe6f7fa){return _0x3e1b69(_0xe6f7fa);},'VmuXt':function(_0x563a64,_0x3974f9){return _0x563a64(_0x3974f9);},'RhvXL':_0x47d1a9(0x20e),'YmpTw':'ignore','acsLC':_0x47d1a9(0x21b),'tNWBR':'error'};return new Promise(_0x1650a8=>{const _0x3f7b8c=_0x47d1a9,_0x4fe5ca={'OhmFx':function(_0x5a56af,_0x33f152){return _0x1ffbcb['VmuXt'](_0x5a56af,_0x33f152);}},_0x793549=_0x53e5bb?.['captureOutput']?[_0x3f7b8c(0x1fe),_0x3f7b8c(0x20e),_0x1ffbcb['RhvXL']]:[_0x1ffbcb['YmpTw'],'inherit',_0x3f7b8c(0x210)],_0x3bfc8d=spawn(_0x3f7b8c(0x1f5),_0x3a5324,{'stdio':_0x793549,'cwd':_0x53e5bb?.['cwd']});let _0x2e058d='';_0x53e5bb?.[_0x3f7b8c(0x21f)]&&_0x3bfc8d['stdout']&&_0x3bfc8d['stdout']['on']('data',_0x57de85=>{const _0x5511a1=_0x3f7b8c;_0x2e058d+=_0x57de85[_0x5511a1(0x207)]();}),_0x53e5bb?.['captureOutput']&&_0x3bfc8d[_0x3f7b8c(0x1ff)]&&_0x3bfc8d[_0x3f7b8c(0x1ff)]['on'](_0x1ffbcb['acsLC'],_0x20e5b5=>{const _0x36f96f=_0x3f7b8c;_0x2e058d+=_0x20e5b5[_0x36f96f(0x207)]();}),_0x3bfc8d['on'](_0x3f7b8c(0x211),_0x3e2ec8=>{const _0x2f3b22=_0x3f7b8c;_0x3e2ec8===0x0?_0x4fe5ca[_0x2f3b22(0x1f6)](_0x1650a8,{'success':!![],'output':_0x2e058d}):_0x4fe5ca['OhmFx'](_0x1650a8,{'success':![],'error':_0x2f3b22(0x21c)+_0x3e2ec8,'output':_0x2e058d});}),_0x3bfc8d['on'](_0x1ffbcb['tNWBR'],_0x4f7a7a=>{_0x1ffbcb['wvEQc'](_0x1650a8,{'success':![],'error':_0x4f7a7a['message']});});});}export async function isMarketplaceAdded(_0x347a1c){const _0x10b649=_0x156f,_0x173094={'mmqFC':function(_0x3fe5bc,_0x3e0087,_0x1a5c34){return _0x3fe5bc(_0x3e0087,_0x1a5c34);},'wAYdQ':'plugin','Apvdk':_0x10b649(0x216),'MosqZ':_0x10b649(0x1fa)},_0x757374=await _0x173094['mmqFC'](runClaudeCommand,[_0x173094[_0x10b649(0x21d)],_0x173094[_0x10b649(0x208)],_0x173094['MosqZ']],{'captureOutput':!![]});if(!_0x757374['success']||!_0x757374['output'])return![];return _0x757374['output'][_0x10b649(0x202)](_0x347a1c);}export async function isPluginInstalled(_0x5adf9c){const _0x2b4c41=_0x156f,_0x4ac3a5={'eDAPk':function(_0xb6991a,_0x1031f5){return _0xb6991a(_0x1031f5);},'oylqS':function(_0x2df586,_0x2b0444){return _0x2df586>_0x2b0444;},'FmWTK':function(_0x37cca4,_0x500903,_0x4c634b){return _0x37cca4(_0x500903,_0x4c634b);},'ObSYE':'plugin'},_0xf83efb=await _0x4ac3a5['eDAPk'](getInstalledPluginInfoFromRegistry,_0x5adf9c);if(_0x4ac3a5[_0x2b4c41(0x206)](_0xf83efb['length'],0x0))return!![];const _0x3b32ef=await _0x4ac3a5['FmWTK'](runClaudeCommand,[_0x4ac3a5[_0x2b4c41(0x20d)],_0x2b4c41(0x1fa)],{'captureOutput':!![]});if(!_0x3b32ef[_0x2b4c41(0x217)]||!_0x3b32ef['output'])return![];return _0x3b32ef[_0x2b4c41(0x1f9)]['includes'](_0x5adf9c);}function getInstalledPluginsPath(){const _0x321d49=_0x156f;return join(getClaudeConfigDir(),_0x321d49(0x200),_0x321d49(0x221));}function sortPluginInfo(_0x16dd94,_0x5320e9){const _0x5a02e8=_0x156f,_0x5df621={'rRCSb':function(_0x1cbb46,_0x205ae3){return _0x1cbb46-_0x205ae3;},'PwbqU':_0x5a02e8(0x1fc)},_0x56a49d={'project':0x0,'local':0x1,'user':0x2};return _0x5df621['rRCSb'](_0x56a49d[_0x16dd94['scope']??_0x5a02e8(0x1fc)],_0x56a49d[_0x5320e9['scope']??_0x5df621['PwbqU']]);}export function parseInstalledPluginInfo(_0x1180db,_0x4bce0d,_0x590b9d){const _0x6ffd6e=_0x156f,_0x289af6={'CloVB':function(_0x149c52,_0x53e4d1){return _0x149c52!==_0x53e4d1;},'SyScj':function(_0x14d8f4,_0x23e2fb){return _0x14d8f4!==_0x23e2fb;},'ndswS':function(_0x5430dd,_0x3081ef){return _0x5430dd(_0x3081ef);}},_0x6fffeb=JSON[_0x6ffd6e(0x209)](_0x1180db),_0x2fb0ae=_0x289af6['ndswS'](resolve,_0x590b9d),_0x39f1d0=_0x6fffeb['plugins']?.[_0x4bce0d]??[];return _0x39f1d0[_0x6ffd6e(0x204)](_0x145c9a=>{const _0x5a65a8=_0x6ffd6e;if(_0x289af6['CloVB'](_0x145c9a['scope'],'project')&&_0x289af6[_0x5a65a8(0x220)](_0x145c9a['scope'],_0x5a65a8(0x1f8)))return!![];if(!_0x145c9a['projectPath'])return!![];return _0x289af6[_0x5a65a8(0x215)](resolve,_0x145c9a[_0x5a65a8(0x201)])===_0x2fb0ae;})['map'](_0x39d135=>({'name':_0x4bce0d,'scope':_0x39d135['scope'],'version':_0x39d135['version']}))[_0x6ffd6e(0x20c)](sortPluginInfo);}function _0x156f(_0x2b0357,_0x4917c6){_0x2b0357=_0x2b0357-0x1f3;const _0x45ee09=_0x45ee();let _0x156f9f=_0x45ee09[_0x2b0357];return _0x156f9f;}async function getInstalledPluginInfoFromRegistry(_0x216fad){const _0x3ab3bd=_0x156f,_0x200b1a={'cXMtY':function(_0x168e6f,_0x11cc9f){return _0x168e6f(_0x11cc9f);},'iOlCB':function(_0x37b975,_0xffb35a,_0x313ab6){return _0x37b975(_0xffb35a,_0x313ab6);},'PpbyE':'utf-8','vMErq':function(_0xfe8a34,_0x30c147,_0x93b94f,_0x366300){return _0xfe8a34(_0x30c147,_0x93b94f,_0x366300);},'asJnV':function(_0x52af3a){return _0x52af3a();}},_0x182ad1=getInstalledPluginsPath();if(!_0x200b1a['cXMtY'](existsSync,_0x182ad1))return[];try{const _0x5e0e5e=await _0x200b1a['iOlCB'](readFile,_0x182ad1,_0x200b1a[_0x3ab3bd(0x203)]);return _0x200b1a[_0x3ab3bd(0x219)](parseInstalledPluginInfo,_0x5e0e5e,_0x216fad,_0x200b1a['asJnV'](getProjectRoot));}catch{return[];}}export async function getPluginInfo(_0x4fe742){const _0xb4bf68=_0x156f,_0x175bfa={'VHmqK':function(_0x254f5b,_0x5721c8){return _0x254f5b(_0x5721c8);},'fydfZ':'plugin','WSMSx':'enabled'},_0xe7e74d=await _0x175bfa[_0xb4bf68(0x20b)](getInstalledPluginInfoFromRegistry,_0x4fe742);if(_0xe7e74d[_0xb4bf68(0x205)]>0x0)return _0xe7e74d[0x0];const _0x2ac46e=await runClaudeCommand([_0x175bfa[_0xb4bf68(0x214)],'list'],{'captureOutput':!![]});if(!_0x2ac46e['success']||!_0x2ac46e['output'])return null;if(!_0x2ac46e['output'][_0xb4bf68(0x202)](_0x4fe742))return null;const _0x530c8c={'name':_0x4fe742},_0xf0d6f4=_0x2ac46e['output'][_0xb4bf68(0x20f)](new RegExp(_0x4fe742+'[\x5cs\x5cS]*?Scope:\x5cs*(user|project|local)','i'));_0xf0d6f4&&(_0x530c8c['scope']=_0xf0d6f4[0x1][_0xb4bf68(0x1f7)]());const _0x435fb8=_0x2ac46e[_0xb4bf68(0x1f9)][_0xb4bf68(0x20f)](new RegExp(_0x4fe742+'[\x5cs\x5cS]*?Version:\x5cs*([\x5cd.]+)','i'));_0x435fb8&&(_0x530c8c[_0xb4bf68(0x1fb)]=_0x435fb8[0x1]);const _0x3bbeb5=_0x2ac46e[_0xb4bf68(0x1f9)]['match'](new RegExp(_0x4fe742+'[\x5cs\x5cS]*?(enabled|disabled)','i'));return _0x3bbeb5&&(_0x530c8c['enabled']=_0x3bbeb5[0x1][_0xb4bf68(0x1f7)]()===_0x175bfa[_0xb4bf68(0x20a)]),_0x530c8c;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _0xb298(_0xcd6926,_0x34904f){_0xcd6926=_0xcd6926-0x185;const _0x1bc0e9=_0x1bc0();let _0xb29886=_0x1bc0e9[_0xcd6926];return _0xb29886;}const _0x3f1027=_0xb298;(function(_0x4afd1d,_0x29068c){const _0x1c2e14=_0xb298,_0x1bfb9a=_0x4afd1d();while(!![]){try{const _0xb3f84=-parseInt(_0x1c2e14(0x1c5))/0x1*(parseInt(_0x1c2e14(0x1fa))/0x2)+-parseInt(_0x1c2e14(0x199))/0x3*(parseInt(_0x1c2e14(0x19e))/0x4)+parseInt(_0x1c2e14(0x1cc))/0x5+parseInt(_0x1c2e14(0x186))/0x6*(-parseInt(_0x1c2e14(0x18b))/0x7)+-parseInt(_0x1c2e14(0x19a))/0x8*(parseInt(_0x1c2e14(0x1ea))/0x9)+parseInt(_0x1c2e14(0x19f))/0xa+parseInt(_0x1c2e14(0x1a3))/0xb;if(_0xb3f84===_0x29068c)break;else _0x1bfb9a['push'](_0x1bfb9a['shift']());}catch(_0x2397a6){_0x1bfb9a['push'](_0x1bfb9a['shift']());}}}(_0x1bc0,0xaf432));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x56722d from'inquirer';import{chromium}from'playwright';import{getApiBaseUrl}from'./environment.js';import{getToken}from'./keychain.js';import{getRangerHomeDir}from'./rangerRoot.js';import{addProfileSetupBanner}from'./profileSetupBanner.js';import{duplicateCookiesForDomains,getSessionCachePath,getStorageStatePath,isCachedSessionLive,isInteractive,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x474551=_0xb298,_0x4e6559={'fhDvM':function(_0xe3d074){return _0xe3d074();},'yBhDj':_0x474551(0x1ab)},_0x41e245=await _0x4e6559['fhDvM'](getToken);if(!_0x41e245)throw new Error(_0x4e6559[_0x474551(0x1eb)]);return _0x41e245;}async function apiRequest(_0x566b7e,_0x2ffce4={}){const _0xcc7df1=_0xb298,_0x133e96={'yKmlb':function(_0xc81e27){return _0xc81e27();},'onISK':function(_0x10588d){return _0x10588d();},'lRWQG':function(_0x4a2a56,_0x5197ba,_0x9ccfa0){return _0x4a2a56(_0x5197ba,_0x9ccfa0);},'TQguz':'application/json','xnetJ':function(_0x5776e4,_0x2b7cce){return _0x5776e4===_0x2b7cce;},'CoIer':'string'},_0x2be767=await _0x133e96[_0xcc7df1(0x190)](requireToken),_0x6922dd=_0x133e96[_0xcc7df1(0x1a1)](getApiBaseUrl),_0x2461af=await _0x133e96['lRWQG'](fetch,''+_0x6922dd+_0x566b7e,{..._0x2ffce4,'headers':{'Authorization':'Bearer\x20'+_0x2be767,'Content-Type':_0x133e96['TQguz'],..._0x2ffce4[_0xcc7df1(0x1e1)]??{}}});if(!_0x2461af['ok']){let _0x40e13d='',_0x8e5664;try{const _0x149a88=await _0x2461af[_0xcc7df1(0x187)]();_0x40e13d=(_0x133e96['xnetJ'](typeof _0x149a88[_0xcc7df1(0x1f5)],_0x133e96['CoIer'])?_0x149a88[_0xcc7df1(0x1f5)]:undefined)??JSON['stringify'](_0x149a88);if(_0x133e96[_0xcc7df1(0x1d6)](typeof _0x149a88['code'],_0x133e96[_0xcc7df1(0x1ca)]))_0x8e5664=_0x149a88[_0xcc7df1(0x1ba)];}catch{_0x40e13d=_0x2461af[_0xcc7df1(0x1bc)];}throw new ApiError('API\x20request\x20'+_0x566b7e+'\x20failed\x20('+_0x2461af[_0xcc7df1(0x18f)]+_0xcc7df1(0x1db)+_0x40e13d,_0x2461af['status'],_0x40e13d,_0x8e5664);}return _0x2461af[_0xcc7df1(0x187)]();}export class ApiError extends Error{['status'];[_0x3f1027(0x1c8)];['code'];constructor(_0x19bb81,_0x41e4be,_0x291090,_0x43aba4){const _0x319945=_0x3f1027,_0x48c2ce={'HxocX':'1|0|4|2|3','szVoZ':'ApiError'},_0xae5e2b=_0x48c2ce[_0x319945(0x1f4)][_0x319945(0x1d7)]('|');let _0x4ecf70=0x0;while(!![]){switch(_0xae5e2b[_0x4ecf70++]){case'0':this['status']=_0x41e4be;continue;case'1':super(_0x19bb81);continue;case'2':this['code']=_0x43aba4;continue;case'3':this[_0x319945(0x1f0)]=_0x48c2ce['szVoZ'];continue;case'4':this[_0x319945(0x1c8)]=_0x291090;continue;}break;}}}export async function fetchCloudProfile(_0x291577){const _0x3e7e7d=_0x3f1027,_0x23182c={'wgffZ':function(_0x2e1b71,_0x383f9f){return _0x2e1b71(_0x383f9f);},'oUlYK':function(_0x183d9f,_0x1bd5d1){return _0x183d9f===_0x1bd5d1;}};try{return await apiRequest('/api/v1/profiles/'+_0x23182c['wgffZ'](encodeURIComponent,_0x291577));}catch(_0x4814e1){if(_0x4814e1 instanceof ApiError&&_0x23182c[_0x3e7e7d(0x1ee)](_0x4814e1[_0x3e7e7d(0x18f)],0x194))return null;throw _0x4814e1;}}export async function listCloudProfiles(){const _0x99996d=_0x3f1027,_0x1efdc2={'qDSNQ':function(_0x11ae28,_0x457c54){return _0x11ae28(_0x457c54);}},_0x180025=await _0x1efdc2[_0x99996d(0x191)](apiRequest,'/api/v1/profiles');return _0x180025['profiles'];}export async function createCloudProfile(_0x1e3465,_0x16cc34,_0x17aa96={}){const _0x4f6387=_0x3f1027,_0x71f1bb={'clLJF':_0x4f6387(0x19d)},_0x59be06={'name':_0x1e3465};if(_0x16cc34)_0x59be06['environment_key']=_0x16cc34;_0x17aa96['settings']&&Object[_0x4f6387(0x19c)](_0x17aa96['settings'])['length']>0x0&&(_0x59be06[_0x4f6387(0x1a0)]=_0x17aa96['settings']);if(_0x17aa96[_0x4f6387(0x1c9)])_0x59be06['username']=_0x17aa96['username'];if(_0x17aa96['password'])_0x59be06[_0x4f6387(0x1bd)]=_0x17aa96['password'];return await apiRequest(_0x71f1bb['clLJF'],{'method':'POST','body':JSON[_0x4f6387(0x1a5)](_0x59be06)});}export async function uploadCloudProfileSession(_0x2abcd3,_0x4eb5f9){const _0x54743f=_0x3f1027,_0x53e815={'Wkdux':'POST'};return await apiRequest(_0x54743f(0x1de)+encodeURIComponent(_0x2abcd3)+'/session',{'method':_0x53e815['Wkdux'],'body':JSON['stringify']({'session_state':_0x4eb5f9})});}export async function saveCloudProfileCredentials(_0x2984fd,_0x1a5346,_0x55a07f){const _0x5544b7=_0x3f1027,_0x19b7ae={'TabPQ':function(_0x11b99a,_0x1d1644,_0x3f1c3b){return _0x11b99a(_0x1d1644,_0x3f1c3b);}};await _0x19b7ae[_0x5544b7(0x1ad)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x2984fd),{'method':_0x5544b7(0x1ef),'body':JSON[_0x5544b7(0x1a5)]({'username':_0x1a5346,'password':_0x55a07f})});}function _0x1bc0(){const _0x4805f6=['environments','JpOAJ','\x22\x20for\x20','status','yKmlb','qDSNQ','\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20','\x20\x20No\x20live\x20session\x20for\x20\x22','gjeCv',').\x20','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','/session','YlkRs','491109OVNeXO','16EdcOGV','IyxFF','keys','/api/v1/profiles','4ehcxWm','2360510kFybCk','settings','onISK','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','22745954JTDBtu','session_state','stringify','lAFol','YsFwh','join','VpXqB','\x20\x20Login\x20successful.\x20Session\x20cached.','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','origin','TabPQ','LkypW','url','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','log','toISOString','\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22','KwJog','you\x27re\x20now\x20at\x20\x22','/login','sessionCheckPath','loginInstructions\x20on\x20the\x20auth\x20environment,\x20or\x20run\x20with\x20a\x20TTY.','goto','code','prompt','statusText','password','eEbfR','invalidateOn','hostname','organizationId','zDIea','length','\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','89TLMHAI','BJFMY','KRUEI','detail','username','CoIer','cookies','4864955lqOYbo','bczEw','protocol','HEmWh','\x22.\x0a','If\x20logins\x20keep\x20failing,\x20declare\x20`invalidateOn:\x20[\x27baseUrl\x27]`\x20on\x20your\x20org\x27s\x20auth-config\x20env\x20so\x20port/domain\x20changes\x20force\x20a\x20fresh\x20login.','RANGER_TEST_USERNAME','cli:manual-login','\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD,\x20configure\x20','rxrQR','xnetJ','split','RANGER_TEST_PASSWORD','vUTFO','odtOL','):\x20','\x22\x20failed\x20validation\x20—\x20refreshing...','TAFwx','/api/v1/profiles/','clientIp','TXIGs','headers','newPage','OmCSQ','env','isArray','jVSww','RwgiV','domains','parse','3837087xvtejm','yBhDj','gEEjJ','POST','oUlYK','PUT','name','auth','QqguS','setupHeaders','HxocX','error','auth_config','QtLag','launch','not_configured','16812qbuCKv','defaultEnvironmentKey','438EmsaDf','json','catch','acYFM','push','76181VpSkMI'];_0x1bc0=function(){return _0x4805f6;};return _0x1bc0();}export async function fetchAuthConfig(){const _0x22368d=_0x3f1027,_0x19574d={'EBCvL':function(_0x2edddc,_0x54ee45){return _0x2edddc(_0x54ee45);}};try{const _0x58c442=await _0x19574d['EBCvL'](apiRequest,'/api/v1/profiles/auth-config');return _0x58c442[_0x22368d(0x1f6)];}catch{return null;}}export function pickAdHocEnvKey(_0xbde37b){const _0x15c50c=_0x3f1027,_0x508b2e={'OmCSQ':function(_0xd5e8c0,_0x44e79e){return _0xd5e8c0===_0x44e79e;}};if(!_0xbde37b)return null;if(_0xbde37b[_0x15c50c(0x185)])return _0xbde37b['defaultEnvironmentKey'];const _0x41bd01=Object['keys'](_0xbde37b[_0x15c50c(0x18c)]??{});if(_0x508b2e[_0x15c50c(0x1e3)](_0x41bd01[_0x15c50c(0x1c3)],0x1))return _0x41bd01[0x0];if(_0x508b2e[_0x15c50c(0x1e3)](_0x41bd01[_0x15c50c(0x1c3)],0x0))return null;throw new Error('Multiple\x20envs\x20in\x20this\x20org\x27s\x20auth\x20config\x20('+_0x41bd01['join'](',\x20')+_0x15c50c(0x195)+'Pass\x20--env\x20<key>\x20or\x20set\x20\x27defaultEnvironmentKey\x27\x20on\x20the\x20auth\x20config.');}export async function resolveAdHocProfile(_0x9efa3=process[_0x3f1027(0x1e4)]){const _0x49879f=_0x3f1027,_0x410da3=_0x9efa3['RANGER_TEST_USERNAME'];if(!_0x410da3)return null;const _0x3648c6=await fetchCloudProfile(_0x410da3);if(_0x3648c6)return{'name':_0x3648c6['name'],'profile':_0x3648c6};const _0x16fcc4=await fetchAuthConfig(),_0x1a7d97=pickAdHocEnvKey(_0x16fcc4),_0x57a683=_0x9efa3[_0x49879f(0x1d8)],_0x583817=await createCloudProfile(_0x410da3,_0x1a7d97??undefined,{'username':_0x410da3,'password':_0x57a683});return console['log']('\x20\x20Created\x20cloud\x20profile\x20\x22'+_0x583817[_0x49879f(0x1f0)]+_0x49879f(0x18e)+_0x410da3),{'name':_0x583817[_0x49879f(0x1f0)],'profile':_0x583817};}export async function writeSessionToLocalCache(_0xc1d03,_0x53fde2,_0x3b28be,_0x41218a,_0x2b7e63,_0xa65e9,_0x494373){const _0x182048=_0x3f1027,_0x545967={'ZEDjN':function(_0x306add,_0x5a7b3b){return _0x306add(_0x5a7b3b);},'bENPL':function(_0x322ae4,_0x22861f,_0x21021c){return _0x322ae4(_0x22861f,_0x21021c);},'rFFdh':_0x182048(0x1f1),'wHJWm':function(_0x168262,_0x337b19){return _0x168262(_0x337b19);},'KwJog':function(_0x51cce0,_0x357f1d,_0xe8cf7a){return _0x51cce0(_0x357f1d,_0xe8cf7a);},'MtmSl':function(_0x272c98,_0x4b9a62){return _0x272c98>_0x4b9a62;},'QyQUj':function(_0x3748f9,_0x232009,_0x25ccf4){return _0x3748f9(_0x232009,_0x25ccf4);}},_0x5af0af=_0x545967['ZEDjN'](sessionCacheHash,{'orgId':_0x53fde2,'profileName':_0xc1d03,'effectiveBaseUrl':_0x3b28be,'setupHeaders':_0x41218a,'invalidateOn':_0x494373?.['invalidateOn'],'userAgent':_0x494373?.['userAgent'],'clientIp':_0x494373?.[_0x182048(0x1df)]}),_0x252988=_0x545967['bENPL'](getSessionCachePath,_0x5af0af,_0xc1d03),_0x34451c=join(getRangerHomeDir(),_0x545967['rFFdh']);!_0x545967['wHJWm'](existsSync,_0x34451c)&&await _0x545967[_0x182048(0x1b4)](mkdir,_0x34451c,{'recursive':!![]});const _0x4a5d46={..._0x2b7e63};_0xa65e9&&_0x545967['MtmSl'](_0xa65e9[_0x182048(0x1c3)],0x0)&&Array[_0x182048(0x1e5)](_0x4a5d46['cookies'])&&(_0x4a5d46[_0x182048(0x1cb)]=_0x545967['QyQUj'](duplicateCookiesForDomains,_0x4a5d46['cookies'],_0xa65e9));const _0x30ab98={'cached_at':new Date()[_0x182048(0x1b2)](),'session_state':_0x4a5d46};await writeFile(_0x252988,JSON[_0x182048(0x1a5)](_0x30ab98,null,0x2));const _0x73c0e7=_0x545967['wHJWm'](getStorageStatePath,_0x252988);return await _0x545967['QyQUj'](writeFile,_0x73c0e7,JSON['stringify'](_0x4a5d46,null,0x2)),_0x73c0e7;}export async function checkLocalCache(_0x43ce63,_0x5da08f,_0x5e2c78,_0x2c519b,_0x2c6321){const _0x5e7872=_0x3f1027,_0x4d7c15={'JpOAJ':function(_0xf3e151,_0x4b92fc,_0x478089){return _0xf3e151(_0x4b92fc,_0x478089);},'qbEHx':'utf-8'},_0xfa5c58=sessionCacheHash({'orgId':_0x5da08f,'profileName':_0x43ce63,'effectiveBaseUrl':_0x5e2c78,'setupHeaders':_0x2c519b,'invalidateOn':_0x2c6321?.[_0x5e7872(0x1bf)],'userAgent':_0x2c6321?.['userAgent'],'clientIp':_0x2c6321?.[_0x5e7872(0x1df)]}),_0x30df16=_0x4d7c15[_0x5e7872(0x18d)](getSessionCachePath,_0xfa5c58,_0x43ce63),_0x5784ba=getStorageStatePath(_0x30df16);if(!existsSync(_0x30df16)||!existsSync(_0x5784ba))return null;try{const _0x23bbd9=await readFile(_0x30df16,_0x4d7c15['qbEHx']);return JSON[_0x5e7872(0x1e9)](_0x23bbd9),{'storageStatePath':_0x5784ba};}catch{return null;}}function launchRealBrowser(){const _0x5a414e=_0x3f1027;return chromium[_0x5a414e(0x1f8)]({'headless':!![]});}function emitSessionValidationHint(_0x15aa66,_0x11601d){const _0x1c57fe=_0x3f1027,_0x46b014={'EBZQK':'Your\x20org\x27s\x20auth-config\x20env\x20may\x20need\x20`invalidateOn:\x20[\x27port\x27]`\x20so\x20sessions\x20captured\x20on\x20one\x20port\x20aren\x27t\x20reused\x20on\x20another.','odtOL':_0x1c57fe(0x1d1),'YsFwh':function(_0x36f240,_0x15bac0){return _0x36f240+_0x15bac0;}};if(!_0x11601d||!_0x11601d['domains']?.[_0x1c57fe(0x1c3)])return;let _0x146138;try{_0x146138=new URL(_0x15aa66);}catch{return;}const _0x2095b7=[];for(const _0x1abfb7 of _0x11601d[_0x1c57fe(0x1e8)]){try{_0x2095b7[_0x1c57fe(0x18a)]({'raw':_0x1abfb7,'url':new URL(_0x1abfb7)});}catch{}}if(_0x2095b7['length']===0x0)return;if(_0x2095b7['some'](_0x26bde2=>_0x26bde2[_0x1c57fe(0x1af)]['origin']===_0x146138[_0x1c57fe(0x1ac)]))return;const _0x4da7ca=_0x2095b7['some'](_0x1e4927=>_0x146138['hostname']===_0x1e4927[_0x1c57fe(0x1af)][_0x1c57fe(0x1c0)]&&_0x146138[_0x1c57fe(0x1ce)]===_0x1e4927[_0x1c57fe(0x1af)]['protocol']&&_0x146138['port']!==_0x1e4927[_0x1c57fe(0x1af)]['port']),_0x501907=_0x4da7ca?_0x46b014['EBZQK']:_0x46b014[_0x1c57fe(0x1da)],_0x1ffe23=_0x2095b7['map'](_0x357a91=>'\x22'+_0x357a91['raw']+'\x22')[_0x1c57fe(0x1a8)](',\x20');console[_0x1c57fe(0x1b1)](_0x46b014[_0x1c57fe(0x1a7)]('\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20'+_0x1ffe23+';\x20',_0x1c57fe(0x1b5)+_0x15aa66+_0x1c57fe(0x192)+_0x501907));}export async function serverSideLogin(_0x1c64a6,_0x15e418){const _0x1bdf23=_0x3f1027,_0x516d4a={'acYFM':function(_0x291174,_0x2a67eb,_0x3cb9bf){return _0x291174(_0x2a67eb,_0x3cb9bf);},'QjpcV':function(_0x634fd,_0x2d8f3d){return _0x634fd instanceof _0x2d8f3d;},'rxrQR':function(_0x5dcb8b,_0x14548c){return _0x5dcb8b===_0x14548c;}},_0x4081d8=process['env'][_0x1bdf23(0x1d2)],_0x3ce5ba=process['env'][_0x1bdf23(0x1d8)],_0x3551b3={};if(_0x4081d8)_0x3551b3[_0x1bdf23(0x1c9)]=_0x4081d8;if(_0x3ce5ba)_0x3551b3['password']=_0x3ce5ba;if(_0x15e418?.['force'])_0x3551b3['force']=!![];try{return await _0x516d4a[_0x1bdf23(0x189)](apiRequest,_0x1bdf23(0x1de)+encodeURIComponent(_0x1c64a6)+_0x1bdf23(0x1b6),{'method':_0x1bdf23(0x1ed),'body':JSON['stringify'](_0x3551b3)});}catch(_0x2da240){if(_0x516d4a['QjpcV'](_0x2da240,ApiError)&&_0x2da240[_0x1bdf23(0x18f)]===0x190&&_0x516d4a[_0x1bdf23(0x1d5)](_0x2da240['code'],_0x1bdf23(0x1f9)))return{'status':'not_configured','error':_0x2da240[_0x1bdf23(0x1c8)]};throw _0x2da240;}}export async function manualBrowserLogin(_0xa99169,_0x1a1346){const _0x3d9242=_0x3f1027,_0x2fa719={'jVSww':function(_0x3f003b,_0x3f066a){return _0x3f003b(_0x3f066a);},'vUTFO':function(_0x3bd37f){return _0x3bd37f();},'VpXqB':'close','zDIea':function(_0x233e92,_0x3e7a25){return _0x233e92+_0x3e7a25;},'loKMA':_0x3d9242(0x1d4),'RnEMs':_0x3d9242(0x1b8),'TXIGs':function(_0x3198a4,_0x26c730){return _0x3198a4>_0x26c730;},'vHqFE':'about:blank','gEEjJ':function(_0x3b7587,_0x298495){return _0x3b7587&&_0x298495;},'frvHX':_0x3d9242(0x196),'mXjrf':'POST'};if(!isInteractive())throw new Error(_0x2fa719[_0x3d9242(0x1c2)]('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0xa99169[_0x3d9242(0x1f0)]+_0x3d9242(0x1d0)+_0x2fa719['loKMA'],_0x2fa719['RnEMs']));const _0xe168ce=_0x1a1346&&_0x2fa719[_0x3d9242(0x1e0)](_0x1a1346['domains']['length'],0x0)?_0x1a1346[_0x3d9242(0x1e8)][0x0]:_0x2fa719['vHqFE'];console[_0x3d9242(0x1b1)]('\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.'),console[_0x3d9242(0x1b1)](_0x3d9242(0x1c4)),await new Promise(_0x30d1d0=>setTimeout(_0x30d1d0,0x7d0));const _0x364cf9=await chromium[_0x3d9242(0x1f8)]({'headless':![]});let _0x510126=null;try{const _0x453c3a={'ignoreHTTPSErrors':!![]};_0x1a1346?.['setupHeaders']&&(_0x453c3a['extraHTTPHeaders']=_0x1a1346['setupHeaders']);const _0x1cbd05=await _0x364cf9['newContext'](_0x453c3a);await addProfileSetupBanner(_0x1cbd05);const _0x163068=await _0x1cbd05[_0x3d9242(0x1e2)]();await _0x163068[_0x3d9242(0x1b9)](_0xe168ce);let _0x335077=![];await new Promise(_0x34d06e=>{const _0x5b725e=_0x3d9242,_0x514a81={'LaeyD':function(_0x14be9b,_0x4e9aed){return _0x14be9b/_0x4e9aed;},'YlkRs':function(_0x55ed64,_0x5a07c0){const _0x22835f=_0xb298;return _0x2fa719[_0x22835f(0x1e6)](_0x55ed64,_0x5a07c0);},'gjeCv':function(_0x1c6e08){const _0x2943c5=_0xb298;return _0x2fa719[_0x2943c5(0x1d9)](_0x1c6e08);}},_0x109d7c=setTimeout(()=>{_0x335077=!![],console['error']('Browser\x20login\x20timed\x20out\x20after\x20'+_0x514a81['LaeyD'](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x34d06e();},MANUAL_LOGIN_TIMEOUT_MS);_0x163068['on'](_0x2fa719[_0x5b725e(0x1a9)],async()=>{const _0x492fc7=_0x5b725e;_0x514a81[_0x492fc7(0x198)](clearTimeout,_0x109d7c);try{const _0x293b64=await _0x1cbd05['storageState']();_0x510126=_0x293b64;}catch{}_0x514a81[_0x492fc7(0x194)](_0x34d06e);});});if(_0x2fa719[_0x3d9242(0x1ec)](_0x335077,!_0x510126))throw new Error('Browser\x20login\x20timed\x20out\x20before\x20completion.');}finally{await _0x364cf9['close']()[_0x3d9242(0x188)](()=>{});}if(!_0x510126)throw new Error(_0x2fa719['frvHX']);return await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0xa99169['name'])+_0x3d9242(0x197),{'method':_0x2fa719['mXjrf'],'body':JSON['stringify']({'session_state':_0x510126,'updated_by':_0x3d9242(0x1d3)})}),{'sessionState':_0x510126};}export async function promptSaveCredentials(_0x4a70c9){const _0x22fc92=_0x3f1027,_0x28b255={'BJFMY':function(_0x9f3f0d,_0x87dc3b){return _0x9f3f0d||_0x87dc3b;},'KRUEI':function(_0x51502a){return _0x51502a();},'LKtdS':'confirm','LkypW':function(_0x13a168,_0x2f3481){return _0x13a168(_0x2f3481);}},_0x2ab042=process[_0x22fc92(0x1e4)][_0x22fc92(0x1d2)],_0x816b55=process[_0x22fc92(0x1e4)]['RANGER_TEST_PASSWORD'];if(_0x28b255[_0x22fc92(0x1c6)](!_0x2ab042,!_0x816b55))return;if(!_0x28b255[_0x22fc92(0x1c7)](isInteractive))return;const {save:_0xc1229}=await _0x56722d[_0x22fc92(0x1bb)]([{'type':_0x28b255['LKtdS'],'name':'save','message':_0x22fc92(0x1b0),'default':![]}]);if(!_0xc1229)return;await apiRequest(_0x22fc92(0x1de)+_0x28b255[_0x22fc92(0x1ae)](encodeURIComponent,_0x4a70c9),{'method':_0x22fc92(0x1ef),'body':JSON[_0x22fc92(0x1a5)]({'username':_0x2ab042,'password':_0x816b55})}),console['log']('\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.');}export async function resolveCloudProfileSession(_0x1e7c3e,_0x31775b={}){const _0x5783fc=_0x3f1027,_0x2586f2={'bczEw':function(_0x34e854,_0x2cdee9,_0xd654a9){return _0x34e854(_0x2cdee9,_0xd654a9);},'plRDG':function(_0x4c55c6,_0x5ee9fa){return _0x4c55c6(_0x5ee9fa);},'lAFol':function(_0xb78f44,_0x11e184){return _0xb78f44(_0x11e184);},'eEbfR':function(_0xfd9bb3,_0x298ae6){return _0xfd9bb3||_0x298ae6;},'IyxFF':function(_0xf7a708,_0x4f4f18){return _0xf7a708(_0x4f4f18);},'HEmWh':function(_0x12522f,_0x506dc4){return _0x12522f===_0x506dc4;},'mOcal':'not_configured','RwgiV':'\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','QqguS':_0x5783fc(0x1aa),'OSBhF':function(_0xe8c4bc,_0x3083f1,_0xee5c7b,_0x3f2740,_0x384bd0,_0x2d7352,_0x46307d,_0x5b27e3){return _0xe8c4bc(_0x3083f1,_0xee5c7b,_0x3f2740,_0x384bd0,_0x2d7352,_0x46307d,_0x5b27e3);},'lJoTS':function(_0x599e18,_0x3e79c9){return _0x599e18&&_0x3e79c9;},'zSstH':function(_0x1f40a7,_0x338a89){return _0x1f40a7(_0x338a89);},'TAFwx':'\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','GBriM':function(_0x288760,_0x5d50ea){return _0x288760 instanceof _0x5d50ea;},'QtLag':function(_0x44c6cd,_0x449a72,_0x4e10da){return _0x44c6cd(_0x449a72,_0x4e10da);}},_0x47de05=_0x1e7c3e['settings']??{},_0x16ddc9=await fetchAuthConfig(),_0x4edf50=_0x16ddc9?_0x2586f2[_0x5783fc(0x1cd)](resolveAuthEnvironmentLocally,_0x16ddc9,_0x1e7c3e['environmentKey']):null,_0x2aa718=_0x4edf50?.[_0x5783fc(0x1e8)],_0x299a23=_0x47de05[_0x5783fc(0x1f3)],_0x44ac28=_0x299a23??_0x4edf50?.[_0x5783fc(0x1f3)],_0x200295=_0x31775b['effectiveBaseUrl']??_0x47de05['baseUrl']??(_0x2aa718&&_0x2aa718['length']>0x0?_0x2aa718[0x0]:''),_0x57dbae={'invalidateOn':_0x4edf50?.[_0x5783fc(0x1bf)],'userAgent':_0x4edf50?.['browserOptions']?.['userAgent']??_0x47de05['userAgent']},_0x4fc353=await checkLocalCache(_0x1e7c3e[_0x5783fc(0x1f0)],_0x1e7c3e['organizationId'],_0x200295,_0x44ac28,_0x57dbae);if(_0x4fc353){if(_0x200295){const _0x24e4ca=await isCachedSessionLive(_0x4fc353['storageStatePath'],_0x200295,{'sessionCheckPath':_0x4edf50?.['sessionCheckPath'],'setupHeaders':_0x44ac28},{'launchBrowser':launchRealBrowser});if(_0x24e4ca)return console['log'](_0x5783fc(0x1b3)+_0x1e7c3e['name']+'\x22'),{'authPath':_0x4fc353['storageStatePath'],'settings':_0x47de05,'resolvedEnv':_0x4edf50};console['log']('\x20\x20Cached\x20session\x20for\x20\x22'+_0x1e7c3e[_0x5783fc(0x1f0)]+_0x5783fc(0x1dc)),_0x2586f2[_0x5783fc(0x1cd)](emitSessionValidationHint,_0x200295,_0x4edf50);}else return{'authPath':_0x4fc353['storageStatePath'],'settings':_0x47de05,'resolvedEnv':_0x4edf50};}if(_0x1e7c3e['sessionState']){const _0xc0298a=await writeSessionToLocalCache(_0x1e7c3e[_0x5783fc(0x1f0)],_0x1e7c3e[_0x5783fc(0x1c1)],_0x200295,_0x44ac28,_0x1e7c3e['sessionState'],_0x2aa718,_0x57dbae);if(_0x200295){const _0x9ec4ef=await isCachedSessionLive(_0xc0298a,_0x200295,{'sessionCheckPath':_0x4edf50?.[_0x5783fc(0x1b7)],'setupHeaders':_0x44ac28},{'launchBrowser':launchRealBrowser});if(_0x9ec4ef)return console['log'](_0x5783fc(0x1a2)+_0x1e7c3e['name']+'\x22,\x20cached\x20locally'),{'authPath':_0xc0298a,'settings':_0x47de05,'resolvedEnv':_0x4edf50};console[_0x5783fc(0x1b1)]('\x20\x20Cloud\x20session\x20for\x20\x22'+_0x1e7c3e['name']+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),_0x2586f2['bczEw'](emitSessionValidationHint,_0x200295,_0x4edf50);}else return{'authPath':_0xc0298a,'settings':_0x47de05,'resolvedEnv':_0x4edf50};}console[_0x5783fc(0x1b1)](_0x5783fc(0x193)+_0x1e7c3e[_0x5783fc(0x1f0)]+'\x22,\x20attempting\x20login...');const _0xec4f34=_0x2586f2['plRDG'](Boolean,process[_0x5783fc(0x1e4)][_0x5783fc(0x1d2)])&&_0x2586f2[_0x5783fc(0x1a6)](Boolean,process[_0x5783fc(0x1e4)]['RANGER_TEST_PASSWORD']),_0x2db1de=Boolean(_0x1e7c3e['username']);if(_0x2586f2[_0x5783fc(0x1be)](_0xec4f34,_0x2db1de))try{const _0xcf4dfb=await _0x2586f2[_0x5783fc(0x19b)](serverSideLogin,_0x1e7c3e['name']);if(_0x2586f2[_0x5783fc(0x1cf)](_0xcf4dfb[_0x5783fc(0x18f)],_0x2586f2['mOcal']))console['log'](_0x2586f2[_0x5783fc(0x1e7)]);else{if(_0xcf4dfb[_0x5783fc(0x18f)]==='success'&&_0xcf4dfb['session_state']){console['log'](_0x2586f2[_0x5783fc(0x1f2)]);const _0xa24325=await _0x2586f2['OSBhF'](writeSessionToLocalCache,_0x1e7c3e[_0x5783fc(0x1f0)],_0x1e7c3e[_0x5783fc(0x1c1)],_0x200295,_0x44ac28,_0xcf4dfb[_0x5783fc(0x1a4)],_0x2aa718,_0x57dbae);return _0x2586f2['lJoTS'](_0xec4f34,!_0x2db1de)&&await _0x2586f2['zSstH'](promptSaveCredentials,_0x1e7c3e['name']),{'authPath':_0xa24325,'settings':_0x47de05,'resolvedEnv':_0x4edf50};}else _0xcf4dfb['test_output']&&(console[_0x5783fc(0x1b1)]('\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:'),console['log'](_0xcf4dfb['test_output'])),console['log'](_0x2586f2[_0x5783fc(0x1dd)]);}}catch(_0x3ec8e2){console['log']('\x20\x20Server-side\x20login\x20error:\x20'+(_0x2586f2['GBriM'](_0x3ec8e2,Error)?_0x3ec8e2['message']:String(_0x3ec8e2))),console[_0x5783fc(0x1b1)](_0x2586f2[_0x5783fc(0x1dd)]);}const {sessionState:_0x1dea65}=await _0x2586f2[_0x5783fc(0x1f7)](manualBrowserLogin,_0x1e7c3e,_0x4edf50),_0x7a21ff=await _0x2586f2['OSBhF'](writeSessionToLocalCache,_0x1e7c3e['name'],_0x1e7c3e['organizationId'],_0x200295,_0x44ac28,_0x1dea65,_0x2aa718,_0x57dbae);return{'authPath':_0x7a21ff,'settings':_0x47de05,'resolvedEnv':_0x4edf50};}
|
|
1
|
+
const _0x38039c=_0x20b4;(function(_0x5ad004,_0x1dfcff){const _0x317149=_0x20b4,_0x24bba5=_0x5ad004();while(!![]){try{const _0x1a22c1=-parseInt(_0x317149(0x1c0))/0x1+-parseInt(_0x317149(0x210))/0x2+parseInt(_0x317149(0x1d7))/0x3+parseInt(_0x317149(0x1ce))/0x4+-parseInt(_0x317149(0x1fb))/0x5+-parseInt(_0x317149(0x1b9))/0x6+parseInt(_0x317149(0x1b0))/0x7;if(_0x1a22c1===_0x1dfcff)break;else _0x24bba5['push'](_0x24bba5['shift']());}catch(_0x31f4ac){_0x24bba5['push'](_0x24bba5['shift']());}}}(_0x1ec1,0x3635f));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x5007ad from'inquirer';import{chromium}from'playwright';import{getApiBaseUrl}from'./environment.js';import{getToken}from'./keychain.js';import{getRangerHomeDir}from'./rangerRoot.js';import{addProfileSetupBanner}from'./profileSetupBanner.js';import{duplicateCookiesForDomains,getSessionCachePath,getStorageStatePath,isCachedSessionLive,isInteractive,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;function _0x1ec1(){const _0x3a8ac5=['some','launch','environment_key','name','GKUak','YGptY','GubyL','2171616jJrFMS','tTMcz','\x20\x20Cloud\x20session\x20for\x20\x22','keys','not_configured','psGoI','length','382491yjjina','oRtgs','domains','cBNHH','json','settings','password','PUT','HfJOZ','OiybC','\x20\x20No\x20live\x20session\x20for\x20\x22','join','wwmpy','qTexP','389924aoxlbx','application/json','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','toISOString','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','effectiveBaseUrl','port','hostname','stringify','707976XHFYwy','tQmCL','close','POST',').\x20','SXCjz','tNtXS','gzPWU','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','/api/v1/profiles','invalidateOn','CHLri','API\x20request\x20','environmentKey','map','log','ApiError','you\x27re\x20now\x20at\x20\x22','nEaeZ','twpuR','newPage','kloDC','\x20\x20Server-side\x20login\x20error:\x20','ghnlS','/api/v1/profiles/','MVWDf','kFjPH','\x22.\x0a','\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','ysBem','\x20\x20Cached\x20session\x20for\x20\x22','status','url','string','lgTGY','832970yLERvl','NCLXL','\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','\x22\x20for\x20','storageStatePath','eeahR','detail','profiles','storageState','OzhlM','organizationId','sessionCheckPath','code','save','origin','username','xzKZt','zBrEv','EpUQs','success','goto','507522vXxoQk','catch','UJDQk','environments','mppJB','OpJFR','FFrJU','uKWHA','auth','cli:manual-login','newContext','\x22\x20failed\x20validation\x20—\x20refreshing...','DMLQC','userAgent','setupHeaders','7373492fWyajo','force'];_0x1ec1=function(){return _0x3a8ac5;};return _0x1ec1();}async function requireToken(){const _0x3954d7=await getToken();if(!_0x3954d7)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');return _0x3954d7;}async function apiRequest(_0x226ccc,_0x2d0439={}){const _0x249f7d=_0x20b4,_0x362da2={'MVWDf':function(_0x21011a,_0x112628,_0x3e9163){return _0x21011a(_0x112628,_0x3e9163);},'SXCjz':_0x249f7d(0x1cf),'eaEoI':function(_0x5d0291,_0x4544e7){return _0x5d0291===_0x4544e7;},'yKbMy':function(_0x4b3c20,_0x44d5df){return _0x4b3c20===_0x44d5df;}},_0x1e960b=await requireToken(),_0x29a6e4=getApiBaseUrl(),_0x5f2f03=await _0x362da2[_0x249f7d(0x1f0)](fetch,''+_0x29a6e4+_0x226ccc,{..._0x2d0439,'headers':{'Authorization':'Bearer\x20'+_0x1e960b,'Content-Type':_0x362da2[_0x249f7d(0x1dc)],..._0x2d0439['headers']??{}}});if(!_0x5f2f03['ok']){let _0x5dc9c4='',_0x5ef87f;try{const _0x25948c=await _0x5f2f03['json']();_0x5dc9c4=(_0x362da2['eaEoI'](typeof _0x25948c['error'],_0x249f7d(0x1f9))?_0x25948c['error']:undefined)??JSON[_0x249f7d(0x1d6)](_0x25948c);if(_0x362da2['yKbMy'](typeof _0x25948c[_0x249f7d(0x207)],_0x249f7d(0x1f9)))_0x5ef87f=_0x25948c[_0x249f7d(0x207)];}catch{_0x5dc9c4=_0x5f2f03['statusText'];}throw new ApiError(_0x249f7d(0x1e3)+_0x226ccc+'\x20failed\x20('+_0x5f2f03['status']+'):\x20'+_0x5dc9c4,_0x5f2f03['status'],_0x5dc9c4,_0x5ef87f);}return _0x5f2f03[_0x249f7d(0x1c4)]();}export class ApiError extends Error{['status'];['detail'];[_0x38039c(0x207)];constructor(_0x175a68,_0x9d0a78,_0x4b7d3e,_0xa866db){const _0x1df257=_0x38039c,_0x1d11b5={'lXRVR':_0x1df257(0x1e7)};super(_0x175a68),this[_0x1df257(0x1f7)]=_0x9d0a78,this[_0x1df257(0x201)]=_0x4b7d3e,this[_0x1df257(0x207)]=_0xa866db,this[_0x1df257(0x1b5)]=_0x1d11b5['lXRVR'];}}export async function fetchCloudProfile(_0x2b2a70){const _0x17cbd7=_0x38039c,_0x503139={'EpUQs':function(_0x25fa8d,_0x606803){return _0x25fa8d(_0x606803);},'cBNHH':function(_0x3818ee,_0x7727f3){return _0x3818ee instanceof _0x7727f3;}};try{return await _0x503139['EpUQs'](apiRequest,'/api/v1/profiles/'+_0x503139[_0x17cbd7(0x20d)](encodeURIComponent,_0x2b2a70));}catch(_0x5b14c0){if(_0x503139[_0x17cbd7(0x1c3)](_0x5b14c0,ApiError)&&_0x5b14c0[_0x17cbd7(0x1f7)]===0x194)return null;throw _0x5b14c0;}}export async function listCloudProfiles(){const _0x2f1c95=_0x38039c,_0x2934f8={'GKUak':_0x2f1c95(0x1e0)},_0x41b42a=await apiRequest(_0x2934f8[_0x2f1c95(0x1b6)]);return _0x41b42a[_0x2f1c95(0x202)];}function _0x20b4(_0x3df69e,_0x3c8234){_0x3df69e=_0x3df69e-0x1ab;const _0x1ec1cc=_0x1ec1();let _0x20b4e6=_0x1ec1cc[_0x3df69e];return _0x20b4e6;}export async function createCloudProfile(_0x22eeeb,_0x1ccbf4,_0x5ab0ef={}){const _0x16ff6e=_0x38039c,_0x57e2a4={'NCLXL':function(_0x5f223c,_0xad2697){return _0x5f223c>_0xad2697;}},_0x36667f={'name':_0x22eeeb};if(_0x1ccbf4)_0x36667f[_0x16ff6e(0x1b4)]=_0x1ccbf4;_0x5ab0ef[_0x16ff6e(0x1c5)]&&_0x57e2a4[_0x16ff6e(0x1fc)](Object[_0x16ff6e(0x1bc)](_0x5ab0ef[_0x16ff6e(0x1c5)])[_0x16ff6e(0x1bf)],0x0)&&(_0x36667f['settings']=_0x5ab0ef['settings']);if(_0x5ab0ef[_0x16ff6e(0x20a)])_0x36667f[_0x16ff6e(0x20a)]=_0x5ab0ef[_0x16ff6e(0x20a)];if(_0x5ab0ef['password'])_0x36667f[_0x16ff6e(0x1c6)]=_0x5ab0ef[_0x16ff6e(0x1c6)];return await apiRequest(_0x16ff6e(0x1e0),{'method':'POST','body':JSON['stringify'](_0x36667f)});}export async function uploadCloudProfileSession(_0x1b0cb4,_0x582351){const _0x426c0f=_0x38039c,_0x15977d={'dclpm':_0x426c0f(0x1da)};return await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x1b0cb4)+'/session',{'method':_0x15977d['dclpm'],'body':JSON['stringify']({'session_state':_0x582351})});}export async function saveCloudProfileCredentials(_0x2d9b8e,_0x1146b6,_0x578f73){const _0x3a71d8=_0x38039c,_0x18adaa={'tNtXS':function(_0x2540c6,_0x4016c8,_0x3d26fe){return _0x2540c6(_0x4016c8,_0x3d26fe);}};await _0x18adaa[_0x3a71d8(0x1dd)](apiRequest,_0x3a71d8(0x1ef)+encodeURIComponent(_0x2d9b8e),{'method':_0x3a71d8(0x1c7),'body':JSON['stringify']({'username':_0x1146b6,'password':_0x578f73})});}export async function fetchAuthConfig(){const _0x551f09={'PqnIJ':function(_0x48d7e8,_0x43d63b){return _0x48d7e8(_0x43d63b);},'kbUAP':'/api/v1/profiles/auth-config'};try{const _0x1f053b=await _0x551f09['PqnIJ'](apiRequest,_0x551f09['kbUAP']);return _0x1f053b['auth_config'];}catch{return null;}}export function pickAdHocEnvKey(_0x7a31e8){const _0x505db2=_0x38039c,_0x3e30c7={'BMiMC':function(_0x27f987,_0x2b142f){return _0x27f987===_0x2b142f;}};if(!_0x7a31e8)return null;if(_0x7a31e8['defaultEnvironmentKey'])return _0x7a31e8['defaultEnvironmentKey'];const _0x5f1ff6=Object['keys'](_0x7a31e8[_0x505db2(0x213)]??{});if(_0x5f1ff6['length']===0x1)return _0x5f1ff6[0x0];if(_0x3e30c7['BMiMC'](_0x5f1ff6['length'],0x0))return null;throw new Error('Multiple\x20envs\x20in\x20this\x20org\x27s\x20auth\x20config\x20('+_0x5f1ff6['join'](',\x20')+_0x505db2(0x1db)+'Pass\x20--env\x20<key>\x20or\x20set\x20\x27defaultEnvironmentKey\x27\x20on\x20the\x20auth\x20config.');}export async function resolveAdHocProfile(_0x3434e4=process['env']){const _0x5690fd=_0x38039c,_0x37c66b={'DMLQC':function(_0x3c6932,_0x3e66a3,_0x4c2fe8,_0x2f5f71){return _0x3c6932(_0x3e66a3,_0x4c2fe8,_0x2f5f71);},'NjpDr':function(_0x5b18df,_0x195feb){return _0x5b18df??_0x195feb;}},_0x2c7e29=_0x3434e4['RANGER_TEST_USERNAME'];if(!_0x2c7e29)return null;const _0x37e30c=await fetchCloudProfile(_0x2c7e29);if(_0x37e30c)return{'name':_0x37e30c['name'],'profile':_0x37e30c};const _0x25baba=await fetchAuthConfig(),_0x5b34ce=pickAdHocEnvKey(_0x25baba),_0x1dd2f4=_0x3434e4['RANGER_TEST_PASSWORD'],_0x15744a=await _0x37c66b[_0x5690fd(0x1ad)](createCloudProfile,_0x2c7e29,_0x37c66b['NjpDr'](_0x5b34ce,undefined),{'username':_0x2c7e29,'password':_0x1dd2f4});return console['log']('\x20\x20Created\x20cloud\x20profile\x20\x22'+_0x15744a['name']+_0x5690fd(0x1fe)+_0x2c7e29),{'name':_0x15744a['name'],'profile':_0x15744a};}export async function writeSessionToLocalCache(_0x4870eb,_0x1d23cc,_0x4b9ebe,_0x4f64e4,_0x3c3eed,_0xcd6a96,_0x3eb5b3){const _0x74f85a=_0x38039c,_0xc3e0fb={'fgpZl':function(_0x4ff07c,_0x2e58ac,_0x689996){return _0x4ff07c(_0x2e58ac,_0x689996);},'OzhlM':function(_0x47271c,_0x5688c4){return _0x47271c>_0x5688c4;},'OiybC':function(_0x40417d,_0x68ef6a,_0x33eb22){return _0x40417d(_0x68ef6a,_0x33eb22);},'JgnIv':function(_0x567b92,_0x25800e){return _0x567b92(_0x25800e);}},_0x13041e=sessionCacheHash({'orgId':_0x1d23cc,'profileName':_0x4870eb,'effectiveBaseUrl':_0x4b9ebe,'setupHeaders':_0x4f64e4,'invalidateOn':_0x3eb5b3?.[_0x74f85a(0x1e1)],'userAgent':_0x3eb5b3?.[_0x74f85a(0x1ae)],'clientIp':_0x3eb5b3?.['clientIp']}),_0x417ac7=_0xc3e0fb['fgpZl'](getSessionCachePath,_0x13041e,_0x4870eb),_0x396d51=join(getRangerHomeDir(),_0x74f85a(0x218));!existsSync(_0x396d51)&&await mkdir(_0x396d51,{'recursive':!![]});const _0x3ddc87={..._0x3c3eed};_0xcd6a96&&_0xc3e0fb[_0x74f85a(0x204)](_0xcd6a96[_0x74f85a(0x1bf)],0x0)&&Array['isArray'](_0x3ddc87['cookies'])&&(_0x3ddc87['cookies']=_0xc3e0fb['fgpZl'](duplicateCookiesForDomains,_0x3ddc87['cookies'],_0xcd6a96));const _0x4a1f7b={'cached_at':new Date()[_0x74f85a(0x1d1)](),'session_state':_0x3ddc87};await _0xc3e0fb[_0x74f85a(0x1c9)](writeFile,_0x417ac7,JSON[_0x74f85a(0x1d6)](_0x4a1f7b,null,0x2));const _0x55afa2=_0xc3e0fb['JgnIv'](getStorageStatePath,_0x417ac7);return await writeFile(_0x55afa2,JSON['stringify'](_0x3ddc87,null,0x2)),_0x55afa2;}export async function checkLocalCache(_0x3efb91,_0x51802a,_0x46e0d1,_0x277786,_0x53faf1){const _0x4a80e9=_0x38039c,_0x5bd7ec={'PZBgV':function(_0x4aaf40,_0x7961ef){return _0x4aaf40(_0x7961ef);},'psGoI':function(_0xddccb6,_0x5c77e4){return _0xddccb6(_0x5c77e4);},'mppJB':function(_0x557b8e,_0x4bf601,_0x39f6e1){return _0x557b8e(_0x4bf601,_0x39f6e1);}},_0x54bdea=_0x5bd7ec['PZBgV'](sessionCacheHash,{'orgId':_0x51802a,'profileName':_0x3efb91,'effectiveBaseUrl':_0x46e0d1,'setupHeaders':_0x277786,'invalidateOn':_0x53faf1?.['invalidateOn'],'userAgent':_0x53faf1?.[_0x4a80e9(0x1ae)],'clientIp':_0x53faf1?.['clientIp']}),_0x359761=getSessionCachePath(_0x54bdea,_0x3efb91),_0x4a2e4d=getStorageStatePath(_0x359761);if(!existsSync(_0x359761)||!_0x5bd7ec[_0x4a80e9(0x1be)](existsSync,_0x4a2e4d))return null;try{const _0x35d936=await _0x5bd7ec[_0x4a80e9(0x214)](readFile,_0x359761,'utf-8');return JSON['parse'](_0x35d936),{'storageStatePath':_0x4a2e4d};}catch{return null;}}function launchRealBrowser(){const _0x472505=_0x38039c;return chromium[_0x472505(0x1b3)]({'headless':!![]});}function emitSessionValidationHint(_0x5e4967,_0x2f1291){const _0x4e6ba2=_0x38039c,_0x3f89ec={'tTMcz':function(_0x53eccc,_0x2b53f3){return _0x53eccc===_0x2b53f3;},'kFjPH':'Your\x20org\x27s\x20auth-config\x20env\x20may\x20need\x20`invalidateOn:\x20[\x27port\x27]`\x20so\x20sessions\x20captured\x20on\x20one\x20port\x20aren\x27t\x20reused\x20on\x20another.','kloDC':'If\x20logins\x20keep\x20failing,\x20declare\x20`invalidateOn:\x20[\x27baseUrl\x27]`\x20on\x20your\x20org\x27s\x20auth-config\x20env\x20so\x20port/domain\x20changes\x20force\x20a\x20fresh\x20login.'};if(!_0x2f1291||!_0x2f1291['domains']?.[_0x4e6ba2(0x1bf)])return;let _0x4b5707;try{_0x4b5707=new URL(_0x5e4967);}catch{return;}const _0x283720=[];for(const _0x4500ec of _0x2f1291[_0x4e6ba2(0x1c2)]){try{_0x283720['push']({'raw':_0x4500ec,'url':new URL(_0x4500ec)});}catch{}}if(_0x3f89ec[_0x4e6ba2(0x1ba)](_0x283720[_0x4e6ba2(0x1bf)],0x0))return;if(_0x283720[_0x4e6ba2(0x1b2)](_0xaca0f6=>_0xaca0f6['url'][_0x4e6ba2(0x209)]===_0x4b5707[_0x4e6ba2(0x209)]))return;const _0x107004=_0x283720[_0x4e6ba2(0x1b2)](_0x138bcb=>_0x4b5707[_0x4e6ba2(0x1d5)]===_0x138bcb[_0x4e6ba2(0x1f8)]['hostname']&&_0x4b5707['protocol']===_0x138bcb[_0x4e6ba2(0x1f8)]['protocol']&&_0x4b5707['port']!==_0x138bcb['url'][_0x4e6ba2(0x1d4)]),_0x4c0d91=_0x107004?_0x3f89ec[_0x4e6ba2(0x1f1)]:_0x3f89ec[_0x4e6ba2(0x1ec)],_0x2a9710=_0x283720[_0x4e6ba2(0x1e5)](_0x35a577=>'\x22'+_0x35a577['raw']+'\x22')[_0x4e6ba2(0x1cb)](',\x20');console['log']('\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20'+_0x2a9710+';\x20'+(_0x4e6ba2(0x1e8)+_0x5e4967+'\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20'+_0x4c0d91));}export async function serverSideLogin(_0x53249d,_0xff44f7){const _0x20cac2=_0x38039c,_0x2df038={'ysBem':'POST','nEaeZ':function(_0x4210eb,_0x25e685){return _0x4210eb===_0x25e685;},'xzKZt':function(_0x56995e,_0x6c2dbe){return _0x56995e===_0x6c2dbe;},'GubyL':'not_configured'},_0x586f1a=process['env']['RANGER_TEST_USERNAME'],_0x3739d8=process['env']['RANGER_TEST_PASSWORD'],_0x12ee06={};if(_0x586f1a)_0x12ee06['username']=_0x586f1a;if(_0x3739d8)_0x12ee06['password']=_0x3739d8;if(_0xff44f7?.[_0x20cac2(0x1b1)])_0x12ee06['force']=!![];try{return await apiRequest(_0x20cac2(0x1ef)+encodeURIComponent(_0x53249d)+'/login',{'method':_0x2df038[_0x20cac2(0x1f5)],'body':JSON['stringify'](_0x12ee06)});}catch(_0x508d08){if(_0x508d08 instanceof ApiError&&_0x2df038[_0x20cac2(0x1e9)](_0x508d08[_0x20cac2(0x1f7)],0x190)&&_0x2df038[_0x20cac2(0x20b)](_0x508d08[_0x20cac2(0x207)],_0x20cac2(0x1bd)))return{'status':_0x2df038[_0x20cac2(0x1b8)],'error':_0x508d08['detail']};throw _0x508d08;}}export async function manualBrowserLogin(_0x4b9390,_0x4eaadc){const _0x5872b7=_0x38039c,_0x3d977c={'qTexP':function(_0x24118f,_0x20b477){return _0x24118f/_0x20b477;},'gzPWU':function(_0x11df30){return _0x11df30();},'FFrJU':_0x5872b7(0x1d9),'zBrEv':'loginInstructions\x20on\x20the\x20auth\x20environment,\x20or\x20run\x20with\x20a\x20TTY.','ghnlS':'about:blank','oRtgs':_0x5872b7(0x1f4),'uKWHA':function(_0x32946e,_0x1e7491){return _0x32946e(_0x1e7491);},'qmBvS':_0x5872b7(0x1da),'twpuR':_0x5872b7(0x219)};if(!isInteractive())throw new Error('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x4b9390[_0x5872b7(0x1b5)]+_0x5872b7(0x1f2)+'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD,\x20configure\x20'+_0x3d977c[_0x5872b7(0x20c)]);const _0x5a51d8=_0x4eaadc&&_0x4eaadc['domains'][_0x5872b7(0x1bf)]>0x0?_0x4eaadc[_0x5872b7(0x1c2)][0x0]:_0x3d977c[_0x5872b7(0x1ee)];console[_0x5872b7(0x1e6)](_0x3d977c[_0x5872b7(0x1c1)]),console['log'](_0x5872b7(0x1fd)),await new Promise(_0x25e79b=>setTimeout(_0x25e79b,0x7d0));const _0x234b89=await chromium[_0x5872b7(0x1b3)]({'headless':![]});let _0x2fedd1=null;try{const _0x53fd24={'ignoreHTTPSErrors':!![]};_0x4eaadc?.['setupHeaders']&&(_0x53fd24['extraHTTPHeaders']=_0x4eaadc['setupHeaders']);const _0x242d5f=await _0x234b89[_0x5872b7(0x1ab)](_0x53fd24);await _0x3d977c[_0x5872b7(0x217)](addProfileSetupBanner,_0x242d5f);const _0x44dc00=await _0x242d5f[_0x5872b7(0x1eb)]();await _0x44dc00[_0x5872b7(0x20f)](_0x5a51d8);let _0x45ad6b=![];await new Promise(_0x5e0d90=>{const _0x1645f0=_0x5872b7,_0x163aab={'DSwIi':function(_0x5e0486){return _0x5e0486();}},_0xef9919=setTimeout(()=>{const _0x67a792=_0x20b4;_0x45ad6b=!![],console['error']('Browser\x20login\x20timed\x20out\x20after\x20'+_0x3d977c[_0x67a792(0x1cd)](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x3d977c[_0x67a792(0x1de)](_0x5e0d90);},MANUAL_LOGIN_TIMEOUT_MS);_0x44dc00['on'](_0x3d977c[_0x1645f0(0x216)],async()=>{const _0x3badd0=_0x1645f0;clearTimeout(_0xef9919);try{const _0x4b290f=await _0x242d5f[_0x3badd0(0x203)]();_0x2fedd1=_0x4b290f;}catch{}_0x163aab['DSwIi'](_0x5e0d90);});});if(_0x45ad6b&&!_0x2fedd1)throw new Error('Browser\x20login\x20timed\x20out\x20before\x20completion.');}finally{await _0x234b89['close']()[_0x5872b7(0x211)](()=>{});}if(!_0x2fedd1)throw new Error('Browser\x20closed\x20before\x20authentication\x20was\x20saved.');return await apiRequest(_0x5872b7(0x1ef)+_0x3d977c['uKWHA'](encodeURIComponent,_0x4b9390[_0x5872b7(0x1b5)])+'/session',{'method':_0x3d977c['qmBvS'],'body':JSON[_0x5872b7(0x1d6)]({'session_state':_0x2fedd1,'updated_by':_0x3d977c[_0x5872b7(0x1ea)]})}),{'sessionState':_0x2fedd1};}export async function promptSaveCredentials(_0x1417ee){const _0xecea21=_0x38039c,_0x5ca246={'wwmpy':'confirm','LPmEM':_0xecea21(0x208),'LRYDR':_0xecea21(0x1d2),'aHLvm':function(_0x202680,_0x22695e){return _0x202680(_0x22695e);},'cueGd':_0xecea21(0x1c7),'ePYAs':_0xecea21(0x1df)},_0x13675c=process['env']['RANGER_TEST_USERNAME'],_0x11ce84=process['env']['RANGER_TEST_PASSWORD'];if(!_0x13675c||!_0x11ce84)return;if(!isInteractive())return;const {save:_0x4ed8ed}=await _0x5007ad['prompt']([{'type':_0x5ca246[_0xecea21(0x1cc)],'name':_0x5ca246['LPmEM'],'message':_0x5ca246['LRYDR'],'default':![]}]);if(!_0x4ed8ed)return;await apiRequest(_0xecea21(0x1ef)+_0x5ca246['aHLvm'](encodeURIComponent,_0x1417ee),{'method':_0x5ca246['cueGd'],'body':JSON['stringify']({'username':_0x13675c,'password':_0x11ce84})}),console['log'](_0x5ca246['ePYAs']);}export async function resolveCloudProfileSession(_0x15ea8b,_0x1e3387={}){const _0x54d6d7=_0x38039c,_0xa20a8f={'lgTGY':function(_0x4d41f4,_0x5d631d,_0x1b6daa){return _0x4d41f4(_0x5d631d,_0x1b6daa);},'OpJFR':function(_0x3b1214,_0x785857){return _0x3b1214>_0x785857;},'YGptY':function(_0x4e2556,_0x4bcf9b,_0x47a362,_0x12d569,_0xcdc8ff,_0x8a8fc4){return _0x4e2556(_0x4bcf9b,_0x47a362,_0x12d569,_0xcdc8ff,_0x8a8fc4);},'DRKdU':function(_0x3016fa,_0x4f02b1,_0x5680e9,_0x27e907,_0x2219df){return _0x3016fa(_0x4f02b1,_0x5680e9,_0x27e907,_0x2219df);},'WzovQ':function(_0x455e48,_0x4ee091,_0x4fd3b6,_0x285241,_0x22fe29){return _0x455e48(_0x4ee091,_0x4fd3b6,_0x285241,_0x22fe29);},'fGzkf':function(_0x3cfbb5,_0x15f9c2){return _0x3cfbb5||_0x15f9c2;},'HfJOZ':function(_0x320a8,_0x2d35b6){return _0x320a8===_0x2d35b6;},'eeahR':function(_0x41cb8d,_0x3afaf0){return _0x41cb8d(_0x3afaf0);},'CHLri':'\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','UJDQk':_0x54d6d7(0x1d0),'tQmCL':function(_0x4ee5e6,_0x4a334b,_0x190c71,_0x33e9ff,_0x5da99f,_0x40b91a,_0x20cb2c,_0x34d949){return _0x4ee5e6(_0x4a334b,_0x190c71,_0x33e9ff,_0x5da99f,_0x40b91a,_0x20cb2c,_0x34d949);}},_0x2d54f6=_0x15ea8b['settings']??{},_0x18e372=await fetchAuthConfig(),_0x3f30d0=_0x18e372?_0xa20a8f[_0x54d6d7(0x1fa)](resolveAuthEnvironmentLocally,_0x18e372,_0x15ea8b[_0x54d6d7(0x1e4)]):null,_0x12a68f=_0x3f30d0?.['domains'],_0x383eb3=_0x2d54f6[_0x54d6d7(0x1af)],_0x56e2ff=_0x383eb3??_0x3f30d0?.['setupHeaders'],_0x36913c=_0x1e3387[_0x54d6d7(0x1d3)]??_0x2d54f6['baseUrl']??(_0x12a68f&&_0xa20a8f[_0x54d6d7(0x215)](_0x12a68f[_0x54d6d7(0x1bf)],0x0)?_0x12a68f[0x0]:''),_0x3659ef={'invalidateOn':_0x3f30d0?.[_0x54d6d7(0x1e1)],'userAgent':_0x3f30d0?.['browserOptions']?.['userAgent']??_0x2d54f6[_0x54d6d7(0x1ae)]},_0x139e8b=await _0xa20a8f[_0x54d6d7(0x1b7)](checkLocalCache,_0x15ea8b['name'],_0x15ea8b[_0x54d6d7(0x205)],_0x36913c,_0x56e2ff,_0x3659ef);if(_0x139e8b){if(_0x36913c){const _0xc99ad=await _0xa20a8f['DRKdU'](isCachedSessionLive,_0x139e8b[_0x54d6d7(0x1ff)],_0x36913c,{'sessionCheckPath':_0x3f30d0?.['sessionCheckPath'],'setupHeaders':_0x56e2ff},{'launchBrowser':launchRealBrowser});if(_0xc99ad)return console['log']('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x15ea8b[_0x54d6d7(0x1b5)]+'\x22'),{'authPath':_0x139e8b['storageStatePath'],'settings':_0x2d54f6,'resolvedEnv':_0x3f30d0};console[_0x54d6d7(0x1e6)](_0x54d6d7(0x1f6)+_0x15ea8b[_0x54d6d7(0x1b5)]+_0x54d6d7(0x1ac)),emitSessionValidationHint(_0x36913c,_0x3f30d0);}else return{'authPath':_0x139e8b[_0x54d6d7(0x1ff)],'settings':_0x2d54f6,'resolvedEnv':_0x3f30d0};}if(_0x15ea8b['sessionState']){const _0x4509b5=await writeSessionToLocalCache(_0x15ea8b['name'],_0x15ea8b[_0x54d6d7(0x205)],_0x36913c,_0x56e2ff,_0x15ea8b['sessionState'],_0x12a68f,_0x3659ef);if(_0x36913c){const _0x8d51a9=await _0xa20a8f['WzovQ'](isCachedSessionLive,_0x4509b5,_0x36913c,{'sessionCheckPath':_0x3f30d0?.[_0x54d6d7(0x206)],'setupHeaders':_0x56e2ff},{'launchBrowser':launchRealBrowser});if(_0x8d51a9)return console[_0x54d6d7(0x1e6)]('\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22'+_0x15ea8b['name']+'\x22,\x20cached\x20locally'),{'authPath':_0x4509b5,'settings':_0x2d54f6,'resolvedEnv':_0x3f30d0};console['log'](_0x54d6d7(0x1bb)+_0x15ea8b[_0x54d6d7(0x1b5)]+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),emitSessionValidationHint(_0x36913c,_0x3f30d0);}else return{'authPath':_0x4509b5,'settings':_0x2d54f6,'resolvedEnv':_0x3f30d0};}console['log'](_0x54d6d7(0x1ca)+_0x15ea8b['name']+'\x22,\x20attempting\x20login...');const _0x12c8dc=Boolean(process['env']['RANGER_TEST_USERNAME'])&&Boolean(process['env']['RANGER_TEST_PASSWORD']),_0x5da936=Boolean(_0x15ea8b['username']);if(_0xa20a8f['fGzkf'](_0x12c8dc,_0x5da936))try{const _0x16bb19=await serverSideLogin(_0x15ea8b['name']);if(_0xa20a8f[_0x54d6d7(0x1c8)](_0x16bb19['status'],_0x54d6d7(0x1bd)))console[_0x54d6d7(0x1e6)](_0x54d6d7(0x1f3));else{if(_0x16bb19['status']===_0x54d6d7(0x20e)&&_0x16bb19['session_state']){console[_0x54d6d7(0x1e6)]('\x20\x20Login\x20successful.\x20Session\x20cached.');const _0x263c81=await writeSessionToLocalCache(_0x15ea8b[_0x54d6d7(0x1b5)],_0x15ea8b['organizationId'],_0x36913c,_0x56e2ff,_0x16bb19['session_state'],_0x12a68f,_0x3659ef);return _0x12c8dc&&!_0x5da936&&await _0xa20a8f[_0x54d6d7(0x200)](promptSaveCredentials,_0x15ea8b['name']),{'authPath':_0x263c81,'settings':_0x2d54f6,'resolvedEnv':_0x3f30d0};}else _0x16bb19['test_output']&&(console['log'](_0xa20a8f[_0x54d6d7(0x1e2)]),console['log'](_0x16bb19['test_output'])),console['log'](_0xa20a8f[_0x54d6d7(0x212)]);}}catch(_0x30bced){console[_0x54d6d7(0x1e6)](_0x54d6d7(0x1ed)+(_0x30bced instanceof Error?_0x30bced['message']:_0xa20a8f['eeahR'](String,_0x30bced))),console[_0x54d6d7(0x1e6)]('\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...');}const {sessionState:_0x4d8dc8}=await manualBrowserLogin(_0x15ea8b,_0x3f30d0),_0x474d4b=await _0xa20a8f[_0x54d6d7(0x1d8)](writeSessionToLocalCache,_0x15ea8b[_0x54d6d7(0x1b5)],_0x15ea8b['organizationId'],_0x36913c,_0x56e2ff,_0x4d8dc8,_0x12a68f,_0x3659ef);return{'authPath':_0x474d4b,'settings':_0x2d54f6,'resolvedEnv':_0x3f30d0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x41fca9=_0x2e73;(function(_0x5b30e4,_0x5ee8c6){const _0x56025d=_0x2e73,_0x2eb582=_0x5b30e4();while(!![]){try{const _0x11fd15=-parseInt(_0x56025d(0x16c))/0x1+-parseInt(_0x56025d(0x15d))/0x2+-parseInt(_0x56025d(0x15a))/0x3*(parseInt(_0x56025d(0x148))/0x4)+parseInt(_0x56025d(0x165))/0x5+-parseInt(_0x56025d(0x159))/0x6*(-parseInt(_0x56025d(0x174))/0x7)+-parseInt(_0x56025d(0x14d))/0x8*(-parseInt(_0x56025d(0x178))/0x9)+parseInt(_0x56025d(0x14b))/0xa;if(_0x11fd15===_0x5ee8c6)break;else _0x2eb582['push'](_0x2eb582['shift']());}catch(_0x2210f7){_0x2eb582['push'](_0x2eb582['shift']());}}}(_0x3d51,0x45d74));import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x239f60=process[_0x41fca9(0x175)],_0xd7eed3={'stdin':process['stdin'],'stdout':process[_0x41fca9(0x164)]}){const _0x32ab28=_0x41fca9,_0x2614b3={'YWdQf':function(_0x534a3e,_0x2d93e5){return _0x534a3e(_0x2d93e5);}};if(_0x239f60['CI'])return![];return Boolean(_0xd7eed3[_0x32ab28(0x162)][_0x32ab28(0x151)])&&_0x2614b3[_0x32ab28(0x16a)](Boolean,_0xd7eed3[_0x32ab28(0x164)]['isTTY']);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x386a74){const _0x269eeb=_0x41fca9,_0x2a4d9d={'hBJOM':_0x269eeb(0x176),'wMLew':function(_0x214138,_0x40fac9){return _0x214138(_0x40fac9);},'azYAa':_0x269eeb(0x14a),'mglch':function(_0x3ffe31,_0x40d950){return _0x3ffe31(_0x40d950);},'mVSUs':_0x269eeb(0x15b)},_0x4d4c30=new Set(_0x386a74[_0x269eeb(0x153)]??DEFAULT_INVALIDATE_ON),_0x4c22d2={'orgId':_0x386a74[_0x269eeb(0x16d)],'profileName':_0x386a74['profileName']};return _0x4d4c30[_0x269eeb(0x158)](_0x2a4d9d['hBJOM'])&&(_0x4c22d2[_0x269eeb(0x15f)]=_0x386a74[_0x269eeb(0x15f)]),_0x4d4c30['has'](_0x269eeb(0x150))&&(_0x4c22d2[_0x269eeb(0x150)]=_0x386a74['setupHeaders']?sortObjectKeys(_0x386a74['setupHeaders']):_0x386a74[_0x269eeb(0x150)]),_0x4d4c30['has']('port')&&(_0x4c22d2[_0x269eeb(0x166)]=_0x2a4d9d['wMLew'](extractPort,_0x386a74['effectiveBaseUrl'])),_0x4d4c30[_0x269eeb(0x158)](_0x269eeb(0x156))&&_0x386a74['userAgent']!==undefined&&(_0x4c22d2['userAgent']=_0x386a74['userAgent']),_0x4d4c30['has'](_0x2a4d9d['azYAa'])&&_0x386a74[_0x269eeb(0x14a)]!==undefined&&(_0x4c22d2[_0x269eeb(0x14a)]=_0x386a74[_0x269eeb(0x14a)]),_0x2a4d9d['mglch'](createHash,_0x269eeb(0x154))[_0x269eeb(0x14e)](JSON[_0x269eeb(0x171)](_0x4c22d2))[_0x269eeb(0x170)](_0x2a4d9d[_0x269eeb(0x163)])[_0x269eeb(0x157)](0x0,0xc);}function _0x2e73(_0x354cb3,_0x3e1793){_0x354cb3=_0x354cb3-0x147;const _0x3d5162=_0x3d51();let _0x2e7314=_0x3d5162[_0x354cb3];return _0x2e7314;}function extractPort(_0x12a7d8){try{return new URL(_0x12a7d8)['port'];}catch{return'';}}function sortObjectKeys(_0x16cb9a){const _0xe7213b={};for(const _0x533e38 of Object['keys'](_0x16cb9a)['sort']()){_0xe7213b[_0x533e38]=_0x16cb9a[_0x533e38];}return _0xe7213b;}export function getSessionCachePath(_0x3a61ce,_0x2f2c44){const _0x1b3478=_0x41fca9;return join(getRangerHomeDir(),'auth',_0x3a61ce+'-'+_0x2f2c44+_0x1b3478(0x169));}function _0x3d51(){const _0x374f4e=['orgId','push','endsWith','digest','stringify','domain','TRJRQ','1012193trNOwN','env','baseUrl','test','9819KgyCsP','keys','362892zmQaYP','close','clientIp','13061500Gqoyyo','goto','1304mXUwhi','update','replace','setupHeaders','isTTY','stRxO','invalidateOn','sha256','LCqxN','userAgent','slice','has','6vnIAIv','15wbMYWO','hex','newPage','1024248cGSdFg','defaultEnvironmentKey','effectiveBaseUrl','startsWith','saVRq','stdin','mVSUs','stdout','490980PvwyxB','port','launchBrowser','domcontentloaded','.json','YWdQf','.localhost','474971sFVten'];_0x3d51=function(){return _0x374f4e;};return _0x3d51();}export function getStorageStatePath(_0x239314){const _0x100010=_0x41fca9,_0x3b81fa={'saVRq':'.storageState.json'};return _0x239314[_0x100010(0x14f)](/\.json$/,_0x3b81fa[_0x100010(0x161)]);}export function needsTunnel(_0x4678e1){const _0x538274=_0x41fca9,_0x2f9410={'TRJRQ':function(_0x32bbc3,_0x20dbf3){return _0x32bbc3===_0x20dbf3;},'LCqxN':'127.0.0.1','stRxO':_0x538274(0x16b),'qFvZc':'localhost.'};let _0x5d367c;try{_0x5d367c=new URL(_0x4678e1)['hostname'];}catch{return![];}if(_0x5d367c==='localhost'||_0x2f9410[_0x538274(0x173)](_0x5d367c,_0x2f9410[_0x538274(0x155)]))return!![];if(_0x5d367c[_0x538274(0x16f)](_0x2f9410[_0x538274(0x152)]))return!![];if(_0x5d367c['includes'](_0x2f9410['qFvZc']))return!![];return![];}export function hostnameOf(_0x130008){return new URL(_0x130008)['hostname'];}export function duplicateCookiesForDomains(_0x59b696,_0x9319de){const _0x7dfaeb=_0x41fca9,_0x8049aa={'GmHou':function(_0x19ab02,_0x1a7ddc){return _0x19ab02(_0x1a7ddc);}},_0x544ea1=[..._0x59b696],_0x4ecd96=new Set(_0x59b696['map'](_0x41afb6=>_0x41afb6[_0x7dfaeb(0x172)]));for(const _0x49f67a of _0x9319de){let _0x4d96a9;try{_0x4d96a9=_0x8049aa['GmHou'](hostnameOf,_0x49f67a);}catch{continue;}if(!_0x4d96a9)continue;const _0x39263d=_0x4d96a9[_0x7dfaeb(0x160)]('.')?_0x4d96a9:'.'+_0x4d96a9;if(_0x4ecd96[_0x7dfaeb(0x158)](_0x4d96a9)||_0x4ecd96['has'](_0x39263d))continue;for(const _0x57e9a7 of _0x59b696){_0x544ea1[_0x7dfaeb(0x16e)]({..._0x57e9a7,'domain':_0x39263d});}_0x4ecd96['add'](_0x39263d);}return _0x544ea1;}export function resolveAuthEnvironmentLocally(_0x442f7b,_0x1a55ea){const _0x1be4d9=_0x41fca9,_0x4432c5=_0x442f7b['environments'];if(_0x1a55ea){const _0x853569=_0x4432c5[_0x1a55ea];if(!_0x853569)return null;return{'key':_0x1a55ea,..._0x853569};}if(_0x442f7b[_0x1be4d9(0x15e)]){const _0x5ef8ae=_0x4432c5[_0x442f7b['defaultEnvironmentKey']];if(!_0x5ef8ae)return null;return{'key':_0x442f7b[_0x1be4d9(0x15e)],..._0x5ef8ae};}const _0x3e8c36=Object[_0x1be4d9(0x147)](_0x4432c5);if(_0x3e8c36['length']===0x1){const _0x4f1d21=_0x3e8c36[0x0];return{'key':_0x4f1d21,..._0x4432c5[_0x4f1d21]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x4b6203,_0x3f08d9){try{if(_0x3f08d9)return new URL(_0x3f08d9,_0x4b6203)['toString']();return new URL(_0x4b6203)['toString']();}catch{return null;}}export function looksLikeLoginUrl(_0xa55023){const _0x6848c3=_0x41fca9;try{const _0x4c01b7=new URL(_0xa55023);return LOGIN_URL_PATTERN[_0x6848c3(0x177)](_0x4c01b7['pathname']);}catch{return LOGIN_URL_PATTERN[_0x6848c3(0x177)](_0xa55023);}}export async function isCachedSessionLive(_0xbaa1c2,_0x5a78af,_0x5dee5b={},_0x4d5992={}){const _0x5aaf3f=_0x41fca9,_0x4d7744={'VvevV':_0x5aaf3f(0x168)},_0x10be9b=buildSessionCheckUrl(_0x5a78af,_0x5dee5b['sessionCheckPath']);if(!_0x10be9b)return!![];if(!_0x4d5992[_0x5aaf3f(0x167)])return!![];let _0x4945f1=null;try{_0x4945f1=await _0x4d5992['launchBrowser']();const _0x11269f=await _0x4945f1['newContext']({'storageState':_0xbaa1c2,'ignoreHTTPSErrors':!![],..._0x5dee5b['setupHeaders']?{'extraHTTPHeaders':_0x5dee5b[_0x5aaf3f(0x150)]}:{}}),_0x30b261=await _0x11269f[_0x5aaf3f(0x15c)](),_0xe42e81=await _0x30b261[_0x5aaf3f(0x14c)](_0x10be9b,{'waitUntil':_0x4d7744['VvevV'],'timeout':0x3a98}),_0x3a8efa=_0xe42e81?.['status']();if(_0x3a8efa===0x191||_0x3a8efa===0x193)return![];const _0x51810d=_0x30b261['url']();if(looksLikeLoginUrl(_0x51810d))return![];return!![];}catch{return![];}finally{if(_0x4945f1)await _0x4945f1[_0x5aaf3f(0x149)]()['catch'](()=>{});}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x4fefec=_0x493e;function _0x493e(_0x2c6125,_0x541646){_0x2c6125=_0x2c6125-0x12d;const _0x552eba=_0x552e();let _0x493ef9=_0x552eba[_0x2c6125];return _0x493ef9;}(function(_0x583614,_0x190585){const _0x579c8d=_0x493e,_0x7a459c=_0x583614();while(!![]){try{const _0xc51b6a=-parseInt(_0x579c8d(0x12d))/0x1*(parseInt(_0x579c8d(0x13b))/0x2)+-parseInt(_0x579c8d(0x13d))/0x3+parseInt(_0x579c8d(0x136))/0x4+parseInt(_0x579c8d(0x139))/0x5*(-parseInt(_0x579c8d(0x138))/0x6)+-parseInt(_0x579c8d(0x133))/0x7+-parseInt(_0x579c8d(0x135))/0x8*(parseInt(_0x579c8d(0x131))/0x9)+-parseInt(_0x579c8d(0x13c))/0xa*(-parseInt(_0x579c8d(0x132))/0xb);if(_0xc51b6a===_0x190585)break;else _0x7a459c['push'](_0x7a459c['shift']());}catch(_0x3fd063){_0x7a459c['push'](_0x7a459c['shift']());}}}(_0x552e,0xa054a));import{createCipheriv,createDecipheriv,randomBytes,pbkdf2Sync}from'crypto';function _0x552e(){const _0x2f62f7=['546348OnXSLG','50NNdnpB','utf8','36494LUCTYh','40WOkUwL','1384491jXNcOu','subarray','4PTDRaD','final','aes-256-gcm','RBsHz','286551njwkRo','5240158nodwWD','1535443dRNdzh','concat','184vhkowF','4591652ieUIUH','lvgyE'];_0x552e=function(){return _0x2f62f7;};return _0x552e();}const ALGORITHM=_0x4fefec(0x12f),SALT='ranger-auth-encryption',KEY_LENGTH=0x20,IV_LENGTH=0x10,TAG_LENGTH=0x10;export function deriveKey(_0x1a41aa){const _0x3384fc={'fIwBC':function(_0x20b0ca,_0x1fb254,_0x326ae0,_0x5840a2,_0x304aa8,_0x2a54e0){return _0x20b0ca(_0x1fb254,_0x326ae0,_0x5840a2,_0x304aa8,_0x2a54e0);}};return _0x3384fc['fIwBC'](pbkdf2Sync,_0x1a41aa,SALT,0x186a0,KEY_LENGTH,'sha256');}export function encrypt(_0x18abd9,_0x1b44f8){const _0x3f7b90=_0x4fefec,_0x505453={'lvgyE':'utf8'},_0x26742d=deriveKey(_0x1b44f8),_0x1e1a2c=randomBytes(IV_LENGTH),_0x13705e=createCipheriv(ALGORITHM,_0x26742d,_0x1e1a2c),_0x355cc5=Buffer[_0x3f7b90(0x134)]([_0x13705e['update'](_0x18abd9,_0x505453[_0x3f7b90(0x137)]),_0x13705e['final']()]),_0x528a45=_0x13705e['getAuthTag']();return Buffer['concat']([_0x1e1a2c,_0x528a45,_0x355cc5]);}export function decrypt(_0x421746,_0x4f2b6a){const _0x4ecf25=_0x4fefec,_0x57f55c={'uyPhG':function(_0x42db6d,_0x27949b){return _0x42db6d(_0x27949b);},'RBsHz':function(_0x59f53a,_0x29eaab){return _0x59f53a+_0x29eaab;},'VLyAr':function(_0x2dd0bc,_0x6741b6){return _0x2dd0bc+_0x6741b6;}},_0x3ff610=_0x57f55c['uyPhG'](deriveKey,_0x4f2b6a),_0x239ddd=_0x421746['subarray'](0x0,IV_LENGTH),_0x57338f=_0x421746[_0x4ecf25(0x13e)](IV_LENGTH,_0x57f55c[_0x4ecf25(0x130)](IV_LENGTH,TAG_LENGTH)),_0x4d2100=_0x421746[_0x4ecf25(0x13e)](_0x57f55c[_0x4ecf25(0x130)](IV_LENGTH,TAG_LENGTH)),_0x3f8240=createDecipheriv(ALGORITHM,_0x3ff610,_0x239ddd);return _0x3f8240['setAuthTag'](_0x57338f),_0x57f55c['VLyAr'](_0x3f8240['update'](_0x4d2100),_0x3f8240[_0x4ecf25(0x12e)](_0x4ecf25(0x13a)));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x535277=_0x3576;(function(_0x47fce6,_0x1686d7){const _0x59464a=_0x3576,_0x171385=_0x47fce6();while(!![]){try{const _0x3a87bd=-parseInt(_0x59464a(0x15e))/0x1+parseInt(_0x59464a(0x182))/0x2*(-parseInt(_0x59464a(0x173))/0x3)+parseInt(_0x59464a(0x15b))/0x4*(-parseInt(_0x59464a(0x16d))/0x5)+parseInt(_0x59464a(0x168))/0x6+parseInt(_0x59464a(0x176))/0x7+-parseInt(_0x59464a(0x17c))/0x8*(-parseInt(_0x59464a(0x181))/0x9)+parseInt(_0x59464a(0x187))/0xa;if(_0x3a87bd===_0x1686d7)break;else _0x171385['push'](_0x171385['shift']());}catch(_0x310779){_0x171385['push'](_0x171385['shift']());}}}(_0x1032,0xe3825));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';function _0x3576(_0x2320a3,_0x2b9e3d){_0x2320a3=_0x2320a3-0x15b;const _0x103279=_0x1032();let _0x357645=_0x103279[_0x2320a3];return _0x357645;}function _0x1032(){const _0x3aa8ea=['2235IgXRNU','=[REDACTED]','Unknown\x20argument','Unknown\x20command','[desire-path]\x20Failed\x20to\x20send:\x20','Not\x20enough\x20non-option\x20arguments','48957NZLumh','--secret','includes','2112453dCLisx','sdCIo','stringify','Missing\x20required\x20argument','FTxSY','Authorization','48ponypz','env','errorType','cZOpg','--authorization','468477lJIOwt','128FciRJT','unknown','DEBUG','--api-key','isTTY','24292980LEtPQJ','LHBrX','5256bWdsKn','Invalid\x20values','no_token','663255CSqUxT','runtime_error','application/json','push','has_token','[desire-path]\x20Payload:\x20','sKJbG','missing_required_argument','[REDACTED]','startsWith','1101066bHfsvf','[desire-path]\x20Sending\x20log\x20to\x20','missing_option','error','--key'];_0x1032=function(){return _0x3aa8ea;};return _0x1032();}import{getCurrentVersion}from'./version.js';const SENSITIVE_FLAGS=new Set(['--token','-t',_0x535277(0x174),_0x535277(0x185),'--apikey',_0x535277(0x16c),'--password','--pass','--auth',_0x535277(0x180),'--header','--cookie','--credentials']),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function looksLikeToken(_0x295e7f){return TOKEN_PATTERNS['some'](_0x1ea7cd=>_0x1ea7cd['test'](_0x295e7f));}export function sanitizeArgs(_0x4923de){const _0x4e3d64=_0x535277,_0x4cf491={'VdCTw':function(_0x3b97e,_0x5d7741){return _0x3b97e(_0x5d7741);}},_0x2b88e0=[];let _0x321888=![];for(let _0x4cab42=0x0;_0x4cab42<_0x4923de['length'];_0x4cab42++){const _0xc86c69=_0x4923de[_0x4cab42];if(_0x321888){_0x2b88e0['push']('[REDACTED]'),_0x321888=![];continue;}if(_0xc86c69['startsWith']('--')||_0xc86c69[_0x4e3d64(0x167)]('-')){const _0x23a6ba=_0xc86c69['indexOf']('=');if(_0x23a6ba!==-0x1){const _0x379806=_0xc86c69['slice'](0x0,_0x23a6ba)['toLowerCase']();if(SENSITIVE_FLAGS['has'](_0x379806)){_0x2b88e0[_0x4e3d64(0x161)](_0xc86c69['slice'](0x0,_0x23a6ba)+_0x4e3d64(0x16e));continue;}}else{const _0x305826=_0xc86c69['toLowerCase']();SENSITIVE_FLAGS['has'](_0x305826)&&(_0x321888=!![]);}_0x2b88e0['push'](_0xc86c69);}else _0x4cf491['VdCTw'](looksLikeToken,_0xc86c69)?_0x2b88e0[_0x4e3d64(0x161)](_0x4e3d64(0x166)):_0x2b88e0[_0x4e3d64(0x161)](_0xc86c69);}return _0x2b88e0['join']('\x20');}export async function logDesirePath(_0x1de65f){const _0x1a5b8c=_0x535277,_0x551d25={'sdCIo':function(_0x33a678){return _0x33a678();},'LHBrX':function(_0x5e2f88){return _0x5e2f88();},'odHmm':_0x1a5b8c(0x162),'avxLV':_0x1a5b8c(0x15d),'sKJbG':_0x1a5b8c(0x17b)};try{const _0x55ea86=await getToken()['catch'](()=>null),_0x200f87=_0x551d25[_0x1a5b8c(0x177)](getApiBaseUrl),_0x542043=_0x551d25[_0x1a5b8c(0x188)](getCurrentVersion),_0x86059=_0x55ea86?_0x551d25['odHmm']:_0x551d25['avxLV'],_0x59b552={..._0x1de65f['metadata'],'authStatus':_0x86059,'isTty':process['stdout'][_0x1a5b8c(0x186)]??![]},_0x17b859={'Content-Type':_0x1a5b8c(0x160)};_0x55ea86&&(_0x17b859[_0x551d25[_0x1a5b8c(0x164)]]='Bearer\x20'+_0x55ea86);const _0x40657b={'rawCommand':_0x1de65f['rawCommand'],'errorMessage':_0x1de65f['errorMessage'],'errorType':_0x1de65f[_0x1a5b8c(0x17e)],'featureId':_0x1de65f['featureId'],'sessionId':_0x1de65f['sessionId'],'metadata':_0x59b552,'cliVersion':_0x542043};process['env'][_0x1a5b8c(0x184)]&&(console['error'](_0x1a5b8c(0x169)+_0x200f87+'/api/v1/mcp/desire-path-logs'),console[_0x1a5b8c(0x16b)](_0x1a5b8c(0x163)+JSON[_0x1a5b8c(0x178)](_0x40657b,null,0x2))),await fetch(_0x200f87+'/api/v1/mcp/desire-path-logs',{'method':'POST','headers':_0x17b859,'body':JSON['stringify'](_0x40657b)});}catch(_0x1cff25){process[_0x1a5b8c(0x17d)]['DEBUG']&&console[_0x1a5b8c(0x16b)](_0x1a5b8c(0x171)+_0x1cff25);}}export function getErrorType(_0x3fc8ff,_0x4484f4){const _0xde241=_0x535277,_0x571bc8={'FTxSY':_0xde241(0x15f),'twxKb':_0xde241(0x183),'cZOpg':'invalid_option_value','rLyyR':_0xde241(0x179)};if(_0x4484f4)return _0x571bc8[_0xde241(0x17a)];if(!_0x3fc8ff)return _0x571bc8['twxKb'];if(_0x3fc8ff['includes'](_0xde241(0x170)))return'unknown_command';if(_0x3fc8ff[_0xde241(0x175)](_0xde241(0x16f)))return'unknown_argument';if(_0x3fc8ff[_0xde241(0x175)](_0xde241(0x172)))return _0xde241(0x165);if(_0x3fc8ff[_0xde241(0x175)](_0xde241(0x15c)))return _0x571bc8[_0xde241(0x17f)];if(_0x3fc8ff[_0xde241(0x175)](_0x571bc8['rLyyR']))return _0xde241(0x16a);return'syntax_error';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x3079c0=_0x6896;(function(_0x275fee,_0x1286a3){const _0xc6a615=_0x6896,_0x51fb3d=_0x275fee();while(!![]){try{const _0x23b49f=-parseInt(_0xc6a615(0x120))/0x1*(-parseInt(_0xc6a615(0x119))/0x2)+parseInt(_0xc6a615(0x121))/0x3+-parseInt(_0xc6a615(0x150))/0x4+parseInt(_0xc6a615(0x13d))/0x5*(-parseInt(_0xc6a615(0x110))/0x6)+parseInt(_0xc6a615(0x111))/0x7*(-parseInt(_0xc6a615(0x10a))/0x8)+-parseInt(_0xc6a615(0x134))/0x9+parseInt(_0xc6a615(0x132))/0xa;if(_0x23b49f===_0x1286a3)break;else _0x51fb3d['push'](_0x51fb3d['shift']());}catch(_0x2b9a76){_0x51fb3d['push'](_0x51fb3d['shift']());}}}(_0x6d35,0x48dc1));import{spawn}from'child_process';import _0x55ccba from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL=_0x3079c0(0x12b),WORKOS_TOKEN_URL='https://api.workos.com/user_management/authenticate';export async function requestDeviceCode(_0xc98650){const _0x62f824=_0x3079c0,_0x495cc0={'VhuvB':function(_0x5772c2,_0x1d3657,_0x1b3c71){return _0x5772c2(_0x1d3657,_0x1b3c71);},'Jseaq':'POST'},_0x1b844c=await _0x495cc0['VhuvB'](fetch,WORKOS_DEVICE_AUTH_URL,{'method':_0x495cc0['Jseaq'],'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0xc98650})});if(!_0x1b844c['ok']){const _0x2dead3=await _0x1b844c['text']();throw new Error('Failed\x20to\x20request\x20device\x20code:\x20'+_0x1b844c[_0x62f824(0x11d)]+'\x20'+_0x2dead3);}return _0x1b844c[_0x62f824(0x156)]();}export async function pollForTokens(_0x3f9c74,_0x181aec,_0x52400e,_0x6ad26b){const _0x3f654f=_0x3079c0,_0x5e0405={'WFQyo':function(_0x5a7119,_0x1f08a7){return _0x5a7119*_0x1f08a7;},'BhHje':function(_0x53d12b,_0xfda20b){return _0x53d12b*_0xfda20b;},'QrqBW':function(_0x506e2c,_0x1b6586){return _0x506e2c(_0x1b6586);},'sGAHM':'application/x-www-form-urlencoded','oaFBX':'urn:ietf:params:oauth:grant-type:device_code','PYNTW':function(_0x486654,_0x954046){return _0x486654===_0x954046;},'OtjWm':'authorization_pending','XYSUM':'slow_down','SwwPL':_0x3f654f(0x142)},_0x4c7462=Date['now']()+_0x5e0405['WFQyo'](_0x6ad26b,0x3e8);let _0x9c43bf=_0x5e0405[_0x3f654f(0x125)](_0x52400e,0x3e8);while(Date[_0x3f654f(0x15d)]()<_0x4c7462){await _0x5e0405[_0x3f654f(0x10c)](sleep,_0x9c43bf);const _0x42cfd5=await fetch(WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x5e0405[_0x3f654f(0x12a)]},'body':new URLSearchParams({'client_id':_0x3f9c74,'device_code':_0x181aec,'grant_type':_0x5e0405['oaFBX']})});if(_0x42cfd5['ok'])return _0x42cfd5[_0x3f654f(0x156)]();const _0x53915e=await _0x42cfd5[_0x3f654f(0x156)]();if(_0x5e0405[_0x3f654f(0x133)](_0x53915e['error'],_0x5e0405[_0x3f654f(0x114)]))continue;if(_0x53915e['error']===_0x5e0405['XYSUM']){_0x9c43bf+=0x3e8;continue;}throw new Error(_0x53915e['error_description']||_0x53915e['error']||_0x5e0405[_0x3f654f(0x14c)]);}throw new Error(_0x3f654f(0x157));}function _0x6d35(){const _0x1ccfde=['xdg-open','tHAJp','POST','SwwPL','email','text','/api-keys','374380OGlVgr','platform','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','utf-8','Using\x20organization:\x20','user_code','json','Device\x20authorization\x20timed\x20out','split','/organization/me','CKInY','NuIGL','ybCXh','now','stdout','8yAJSSI','workosClientId','QrqBW','mcp:write','Select\x20an\x20organization:','organizationId','296580LFngNt','1531327TLRALl','Failed\x20to\x20provision\x20API\x20key:\x20','toString','OtjWm','name','GET','hPZgp','XfRTQ','2ZukvZp','ignore','token','length','status','unref','OPYOV','129831vLCtEx','64938CsGKRo','device_code','Failed\x20to\x20refresh\x20token\x20with\x20org:\x20','/organization/self-serve-signup','BhHje','cxVEz','CLI\x20Key','uclcS','Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','sGAHM','https://api.workos.com/user_management/authorize/device','log','guZYE','Failed\x20to\x20create\x20organization:\x20','refresh_token','application/json','prompt','10225380qqMVhd','PYNTW','620334XTKFIt','WUEnb','VbJKx','stringify','base64url','BUktN','org_id','access_token','Waiting\x20for\x20authentication...','50YYEocA','BPeOI','PvbPO','verification_uri_complete','/cli-auth/token','Authentication\x20failed','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','crqTY','win32','start','Code:\x20','mqeRZ'];_0x6d35=function(){return _0x1ccfde;};return _0x6d35();}async function fetchUserProfile(_0x110f45){const _0x4b7503=_0x3079c0,_0x3151c7={'dmHrR':function(_0x490e31,_0x25daca,_0x4be243){return _0x490e31(_0x25daca,_0x4be243);},'FySVb':_0x4b7503(0x116)},_0x266c4f=getApiBaseUrl();try{const _0x30cc5c=await _0x3151c7['dmHrR'](fetch,_0x266c4f+_0x4b7503(0x159),{'method':_0x3151c7['FySVb'],'headers':{'workos-token':_0x110f45}});if(_0x30cc5c['ok'])return _0x30cc5c[_0x4b7503(0x156)]();}catch{}return null;}function buildKeyName(_0xa0b362,_0x58198c){const _0x43bd6f=_0x3079c0,_0x366f60={'VbJKx':function(_0xe20bdf,_0x26a053){return _0xe20bdf===_0x26a053;}},_0x1e6ef2=_0x58198c['filter'](_0x1d88ce=>_0x1d88ce['name']===_0xa0b362||_0x1d88ce[_0x43bd6f(0x115)]['startsWith'](_0xa0b362+'\x20('));if(_0x366f60[_0x43bd6f(0x136)](_0x1e6ef2['length'],0x0))return _0xa0b362;return _0xa0b362+'\x20('+(_0x1e6ef2['length']+0x1)+')';}export async function provisionApiKey(_0x10aa0a){const _0x10ac2d=_0x3079c0,_0x209978={'hgNbL':function(_0x4ec6d7){return _0x4ec6d7();},'ybCXh':function(_0x35ed33,_0xcb9fd3){return _0x35ed33(_0xcb9fd3);},'JuARX':_0x10ac2d(0x127),'aYzis':_0x10ac2d(0x116),'vVHTz':function(_0x129c06,_0x58dc5a,_0x268cf6){return _0x129c06(_0x58dc5a,_0x268cf6);},'bYzXP':_0x10ac2d(0x10d)},_0x456a60=_0x209978['hgNbL'](getApiBaseUrl),_0x23abec={'Content-Type':'application/json','workos-token':_0x10aa0a},_0x4a1e96=await _0x209978[_0x10ac2d(0x15c)](fetchUserProfile,_0x10aa0a),_0x3a8d40=_0x4a1e96?.['firstName']||_0x4a1e96?.[_0x10ac2d(0x14d)]?.['split']('@')[0x0],_0x1e13ad=_0x3a8d40?_0x3a8d40+'\x27s\x20CLI\x20Key':_0x209978['JuARX'];let _0x1c4a4e=[];try{const _0x51a843=await fetch(_0x456a60+'/api-keys',{'method':_0x209978['aYzis'],'headers':_0x23abec});if(_0x51a843['ok']){const _0x55c0a3=await _0x51a843[_0x10ac2d(0x156)]();_0x1c4a4e=_0x55c0a3['apiKeys'];}}catch{}const _0x11b7d4=_0x209978['vVHTz'](buildKeyName,_0x1e13ad,_0x1c4a4e),_0xdac60e=await fetch(_0x456a60+_0x10ac2d(0x14f),{'method':_0x10ac2d(0x14b),'headers':_0x23abec,'body':JSON[_0x10ac2d(0x137)]({'name':_0x11b7d4,'scope':_0x209978['bYzXP']})});if(!_0xdac60e['ok']){const _0x2de3f0=await _0xdac60e[_0x10ac2d(0x14e)]();throw new Error(_0x10ac2d(0x112)+_0xdac60e[_0x10ac2d(0x11d)]+'\x20'+_0x2de3f0);}const _0x8b91ec=await _0xdac60e[_0x10ac2d(0x156)]();return _0x8b91ec['apiKey'][_0x10ac2d(0x11b)];}export function openBrowser(_0x54790e){const _0x14b68e=_0x3079c0,_0x58b20c={'guZYE':function(_0x36d5eb,_0x431634,_0x501014,_0x54ff4d){return _0x36d5eb(_0x431634,_0x501014,_0x54ff4d);},'uclcS':_0x14b68e(0x146),'OPYOV':function(_0x28c804,_0xe489a2){return _0x28c804===_0xe489a2;},'mqeRZ':'darwin','tHAJp':_0x14b68e(0x149),'BUktN':_0x14b68e(0x11a)};try{if(process['platform']===_0x14b68e(0x145)){const _0x490d86=_0x58b20c[_0x14b68e(0x12d)](spawn,'cmd',['/c',_0x58b20c[_0x14b68e(0x128)],'',_0x54790e],{'detached':!![],'stdio':'ignore','windowsHide':!![]});_0x490d86[_0x14b68e(0x11e)]();return;}const _0x1f3d8c=_0x58b20c[_0x14b68e(0x11f)](process[_0x14b68e(0x151)],_0x58b20c[_0x14b68e(0x148)])?'open':_0x58b20c[_0x14b68e(0x14a)],_0x5815d2=spawn(_0x1f3d8c,[_0x54790e],{'detached':!![],'stdio':_0x58b20c[_0x14b68e(0x139)]});_0x5815d2['unref']();}catch{}}function decodeJwtPayload(_0x545db2){const _0x33c84d=_0x3079c0,_0x33b4c8={'CKInY':_0x33c84d(0x138),'arjyd':_0x33c84d(0x153)},_0x326708=_0x545db2[_0x33c84d(0x158)]('.');if(_0x326708[_0x33c84d(0x11c)]!==0x3)throw new Error('Invalid\x20JWT\x20format');const _0x4ca901=Buffer['from'](_0x326708[0x1],_0x33b4c8[_0x33c84d(0x15a)])[_0x33c84d(0x113)](_0x33b4c8['arjyd']);return JSON['parse'](_0x4ca901);}async function selfServeSignup(_0x1544ad){const _0x5af05d=_0x3079c0,_0x18c5be={'RdxEH':function(_0x5cb775){return _0x5cb775();},'WUEnb':function(_0x36272e,_0x3eaaf7,_0x3a8baa){return _0x36272e(_0x3eaaf7,_0x3a8baa);},'QucnA':_0x5af05d(0x130)},_0x2335aa=_0x18c5be['RdxEH'](getApiBaseUrl),_0x36c4ae=await _0x18c5be[_0x5af05d(0x135)](fetch,_0x2335aa+_0x5af05d(0x124),{'method':'POST','headers':{'Content-Type':_0x18c5be['QucnA'],'workos-token':_0x1544ad}});if(!_0x36c4ae['ok']){const _0x4ee00a=await _0x36c4ae['text']();throw new Error(_0x5af05d(0x12e)+_0x36c4ae['status']+'\x20'+_0x4ee00a);}return _0x36c4ae[_0x5af05d(0x156)]();}async function fetchMyMemberships(_0x41d25f){const _0x3b2321=_0x3079c0,_0x1d8a72=getApiBaseUrl(),_0x5f14e0=await fetch(_0x1d8a72+'/organization/my-memberships',{'method':'GET','headers':{'workos-token':_0x41d25f}});if(!_0x5f14e0['ok']){const _0xb7cb61=await _0x5f14e0[_0x3b2321(0x14e)]();throw new Error('Failed\x20to\x20fetch\x20memberships:\x20'+_0x5f14e0[_0x3b2321(0x11d)]+'\x20'+_0xb7cb61);}const _0x5059e0=await _0x5f14e0[_0x3b2321(0x156)]();return _0x5059e0['memberships'];}async function refreshTokenWithOrg(_0x3eba38,_0x310e86,_0x5e01cb){const _0x277dea=_0x3079c0,_0x17120a={'WJpPz':function(_0x1d247d,_0x5d7cf2,_0x511d7a){return _0x1d247d(_0x5d7cf2,_0x511d7a);}},_0x12658a=await _0x17120a['WJpPz'](fetch,WORKOS_TOKEN_URL,{'method':_0x277dea(0x14b),'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x3eba38,'grant_type':'refresh_token','refresh_token':_0x310e86,'organization_id':_0x5e01cb})});if(!_0x12658a['ok']){const _0x2695c9=await _0x12658a['text']();throw new Error(_0x277dea(0x123)+_0x12658a[_0x277dea(0x11d)]+'\x20'+_0x2695c9);}return _0x12658a['json']();}function _0x6896(_0x5b073e,_0x13c7e2){_0x5b073e=_0x5b073e-0x109;const _0x6d35fe=_0x6d35();let _0x6896c2=_0x6d35fe[_0x5b073e];return _0x6896c2;}async function provisionCliToken(_0x3cc64a){const _0xd71070=_0x3079c0,_0x5bf2c1={'wXwwt':function(_0x204075){return _0x204075();},'BPeOI':function(_0x45f177,_0x3edfe7,_0x37135e){return _0x45f177(_0x3edfe7,_0x37135e);},'PvbPO':_0xd71070(0x14b)},_0x4dc5eb=_0x5bf2c1['wXwwt'](getApiBaseUrl),_0x3bb023=await _0x5bf2c1[_0xd71070(0x13e)](fetch,_0x4dc5eb+_0xd71070(0x141),{'method':_0x5bf2c1[_0xd71070(0x13f)],'headers':{'Content-Type':_0xd71070(0x130),'workos-token':_0x3cc64a}});if(!_0x3bb023['ok']){const _0x49ec35=await _0x3bb023['text']();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x3bb023[_0xd71070(0x11d)]+'\x20'+_0x49ec35);}return _0x3bb023[_0xd71070(0x156)]();}export async function runDeviceAuthFlow(){const _0x1f6a0d=_0x3079c0,_0x553ae7={'fQMZG':function(_0x21ecdf){return _0x21ecdf();},'crqTY':function(_0xca1d1f,_0x1dc121){return _0xca1d1f===_0x1dc121;},'lPYMr':'Setting\x20up\x20your\x20organization...','UPgUL':function(_0x5e3439,_0x2babb2){return _0x5e3439+_0x2babb2;},'hPZgp':_0x1f6a0d(0x129),'XfRTQ':'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','cxVEz':'list','aiXDA':_0x1f6a0d(0x10e),'NuIGL':function(_0x3d83dd,_0x45b2d7,_0x45c2e3,_0x2b229b){return _0x3d83dd(_0x45b2d7,_0x45c2e3,_0x2b229b);},'PYRAc':function(_0x34a4d7,_0x269d09){return _0x34a4d7(_0x269d09);}},_0x1da778=_0x553ae7['fQMZG'](getCurrentEnvironment),_0x3ec6e1=ENVIRONMENT_CONFIGS[_0x1da778][_0x1f6a0d(0x10b)],_0x29aa83=await requestDeviceCode(_0x3ec6e1);console['log']('\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...'),console['log'](_0x1f6a0d(0x143)),openBrowser(_0x29aa83[_0x1f6a0d(0x140)]),console[_0x1f6a0d(0x12c)](_0x1f6a0d(0x152)+_0x29aa83['verification_uri_complete']),console['log'](_0x1f6a0d(0x147)+_0x29aa83[_0x1f6a0d(0x155)]+'\x0a'),process[_0x1f6a0d(0x109)]['write'](_0x1f6a0d(0x13c));let _0x42c634=await pollForTokens(_0x3ec6e1,_0x29aa83[_0x1f6a0d(0x122)],_0x29aa83['interval'],_0x29aa83['expires_in']);console[_0x1f6a0d(0x12c)]('\x20✓');const _0x3e3599=decodeJwtPayload(_0x42c634['access_token']);if(!_0x3e3599[_0x1f6a0d(0x13a)]){const _0x211411=await fetchMyMemberships(_0x42c634['access_token']);let _0x21e6de;if(_0x553ae7[_0x1f6a0d(0x144)](_0x211411[_0x1f6a0d(0x11c)],0x0)){process[_0x1f6a0d(0x109)]['write'](_0x553ae7['lPYMr']);const _0x1cc1ce=await selfServeSignup(_0x42c634[_0x1f6a0d(0x13b)]);_0x21e6de=_0x1cc1ce['organizationId'],console['log']('\x20✓');}else{if(_0x553ae7[_0x1f6a0d(0x144)](_0x211411[_0x1f6a0d(0x11c)],0x1))_0x21e6de=_0x211411[0x0][_0x1f6a0d(0x10f)],console['log'](_0x1f6a0d(0x154)+_0x211411[0x0][_0x1f6a0d(0x115)]);else{const _0x20dc7f=process['stdin']['isTTY']&&process['stdout']['isTTY'];if(!_0x20dc7f)throw new Error(_0x553ae7['UPgUL'](_0x553ae7[_0x1f6a0d(0x117)],_0x553ae7[_0x1f6a0d(0x118)]));const {selected:_0x172061}=await _0x55ccba[_0x1f6a0d(0x131)]([{'type':_0x553ae7[_0x1f6a0d(0x126)],'name':'selected','message':_0x553ae7['aiXDA'],'choices':_0x211411['map'](_0x588761=>({'name':_0x588761['name'],'value':_0x588761['organizationId']}))}]);_0x21e6de=_0x172061;}}_0x42c634=await _0x553ae7[_0x1f6a0d(0x15b)](refreshTokenWithOrg,_0x3ec6e1,_0x42c634['refresh_token'],_0x21e6de);}process[_0x1f6a0d(0x109)]['write']('Provisioning\x20CLI\x20token...');const _0x5824f7=await provisionCliToken(_0x42c634[_0x1f6a0d(0x13b)]);return console[_0x1f6a0d(0x12c)]('\x20✓'),await _0x553ae7['PYRAc'](storeToken,_0x5824f7['token']),_0x42c634['refresh_token']&&await _0x553ae7['PYRAc'](storeRefreshToken,_0x42c634[_0x1f6a0d(0x12f)]),_0x5824f7['token'];}function sleep(_0x1a310a){return new Promise(_0x456cc2=>setTimeout(_0x456cc2,_0x1a310a));}
|
|
1
|
+
(function(_0x354ba6,_0x2d75f3){const _0x45d8dd=_0x560d,_0x4d0ef8=_0x354ba6();while(!![]){try{const _0x813915=parseInt(_0x45d8dd(0x1d3))/0x1+-parseInt(_0x45d8dd(0x1be))/0x2*(parseInt(_0x45d8dd(0x19e))/0x3)+parseInt(_0x45d8dd(0x1c2))/0x4*(parseInt(_0x45d8dd(0x198))/0x5)+parseInt(_0x45d8dd(0x1b6))/0x6+-parseInt(_0x45d8dd(0x1ad))/0x7*(parseInt(_0x45d8dd(0x1d4))/0x8)+parseInt(_0x45d8dd(0x1c6))/0x9+-parseInt(_0x45d8dd(0x19d))/0xa*(parseInt(_0x45d8dd(0x197))/0xb);if(_0x813915===_0x2d75f3)break;else _0x4d0ef8['push'](_0x4d0ef8['shift']());}catch(_0x76db19){_0x4d0ef8['push'](_0x4d0ef8['shift']());}}}(_0x3076,0x31dfb));import{spawn}from'child_process';import _0x164dd0 from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL='https://api.workos.com/user_management/authorize/device',WORKOS_TOKEN_URL='https://api.workos.com/user_management/authenticate';export async function requestDeviceCode(_0x1cf6d7){const _0x1188f3=_0x560d,_0x2dc0b2={'VbcYU':'POST'},_0x1dfe20=await fetch(WORKOS_DEVICE_AUTH_URL,{'method':_0x2dc0b2['VbcYU'],'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x1cf6d7})});if(!_0x1dfe20['ok']){const _0x579d8d=await _0x1dfe20[_0x1188f3(0x1b0)]();throw new Error('Failed\x20to\x20request\x20device\x20code:\x20'+_0x1dfe20[_0x1188f3(0x193)]+'\x20'+_0x579d8d);}return _0x1dfe20['json']();}export async function pollForTokens(_0x55252b,_0x425f46,_0x7bbf6f,_0x3fe3a8){const _0x46d8fd=_0x560d,_0x125072={'YHEhA':function(_0x35bda7,_0x46c387){return _0x35bda7<_0x46c387;},'mDtqe':function(_0x17c6a6,_0x56ed3b,_0x134346){return _0x17c6a6(_0x56ed3b,_0x134346);},'KMPnJ':'urn:ietf:params:oauth:grant-type:device_code','YGmkv':_0x46d8fd(0x1c7)},_0x5ed8e8=Date['now']()+_0x3fe3a8*0x3e8;let _0x115668=_0x7bbf6f*0x3e8;while(_0x125072['YHEhA'](Date['now'](),_0x5ed8e8)){await sleep(_0x115668);const _0x4cad01=await _0x125072[_0x46d8fd(0x1a9)](fetch,WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x55252b,'device_code':_0x425f46,'grant_type':_0x125072[_0x46d8fd(0x1cf)]})});if(_0x4cad01['ok'])return _0x4cad01[_0x46d8fd(0x1b7)]();const _0x2c4931=await _0x4cad01[_0x46d8fd(0x1b7)]();if(_0x2c4931['error']==='authorization_pending')continue;if(_0x2c4931['error']==='slow_down'){_0x115668+=0x3e8;continue;}throw new Error(_0x2c4931[_0x46d8fd(0x1ca)]||_0x2c4931['error']||'Authentication\x20failed');}throw new Error(_0x125072[_0x46d8fd(0x1a7)]);}function _0x560d(_0x56b698,_0x4d8843){_0x56b698=_0x56b698-0x188;const _0x30767f=_0x3076();let _0x560d1e=_0x30767f[_0x56b698];return _0x560d1e;}async function fetchUserProfile(_0x8a7de5){const _0x29991b=_0x560d,_0x2fb382=getApiBaseUrl();try{const _0x3449de=await fetch(_0x2fb382+'/organization/me',{'method':_0x29991b(0x18a),'headers':{'workos-token':_0x8a7de5}});if(_0x3449de['ok'])return _0x3449de[_0x29991b(0x1b7)]();}catch{}return null;}function buildKeyName(_0x43def5,_0xa2d671){const _0x1b6c7a=_0x560d,_0x341326={'dBwZq':function(_0x47ec29,_0x19964b){return _0x47ec29===_0x19964b;}},_0x315020=_0xa2d671[_0x1b6c7a(0x192)](_0x1f7f23=>_0x1f7f23[_0x1b6c7a(0x1cd)]===_0x43def5||_0x1f7f23['name']['startsWith'](_0x43def5+'\x20('));if(_0x341326['dBwZq'](_0x315020[_0x1b6c7a(0x1c1)],0x0))return _0x43def5;return _0x43def5+'\x20('+(_0x315020[_0x1b6c7a(0x1c1)]+0x1)+')';}export async function provisionApiKey(_0x38a093){const _0xad52fe=_0x560d,_0x57163f={'asLHb':function(_0x234d0d,_0x327963){return _0x234d0d(_0x327963);},'cVXJs':_0xad52fe(0x18a),'QdcOK':function(_0x92d97f,_0xb6d381,_0x4de43d){return _0x92d97f(_0xb6d381,_0x4de43d);},'MosQT':'POST'},_0x13b8d5=getApiBaseUrl(),_0xf758d1={'Content-Type':_0xad52fe(0x1ac),'workos-token':_0x38a093},_0xa2b1be=await _0x57163f[_0xad52fe(0x1a8)](fetchUserProfile,_0x38a093),_0x3d0ba3=_0xa2b1be?.[_0xad52fe(0x1b2)]||_0xa2b1be?.['email']?.['split']('@')[0x0],_0x22d6b3=_0x3d0ba3?_0x3d0ba3+_0xad52fe(0x1a5):'CLI\x20Key';let _0x1f0d57=[];try{const _0x59b06f=await fetch(_0x13b8d5+_0xad52fe(0x1ae),{'method':_0x57163f[_0xad52fe(0x1a1)],'headers':_0xf758d1});if(_0x59b06f['ok']){const _0x5dbf30=await _0x59b06f[_0xad52fe(0x1b7)]();_0x1f0d57=_0x5dbf30[_0xad52fe(0x1a2)];}}catch{}const _0x4b8f84=_0x57163f['QdcOK'](buildKeyName,_0x22d6b3,_0x1f0d57),_0x5a73cf=await fetch(_0x13b8d5+_0xad52fe(0x1ae),{'method':_0x57163f['MosQT'],'headers':_0xf758d1,'body':JSON[_0xad52fe(0x19b)]({'name':_0x4b8f84,'scope':'mcp:write'})});if(!_0x5a73cf['ok']){const _0x35e6bb=await _0x5a73cf['text']();throw new Error(_0xad52fe(0x199)+_0x5a73cf[_0xad52fe(0x193)]+'\x20'+_0x35e6bb);}const _0x49d08a=await _0x5a73cf['json']();return _0x49d08a[_0xad52fe(0x1ab)][_0xad52fe(0x1b3)];}export function openBrowser(_0x36f969){const _0x35bea3=_0x560d,_0x38b77e={'AmvpS':'win32','MbQzp':function(_0xe27001,_0x4fde9e,_0x254d29,_0x3e3057){return _0xe27001(_0x4fde9e,_0x254d29,_0x3e3057);},'gBAjT':_0x35bea3(0x1b1),'ArNvq':_0x35bea3(0x1cb),'tlTut':'darwin','dVTla':'ignore'};try{if(process['platform']===_0x38b77e['AmvpS']){const _0x29811e=_0x38b77e['MbQzp'](spawn,_0x38b77e[_0x35bea3(0x195)],['/c',_0x38b77e['ArNvq'],'',_0x36f969],{'detached':!![],'stdio':'ignore','windowsHide':!![]});_0x29811e['unref']();return;}const _0x5a0644=process['platform']===_0x38b77e['tlTut']?'open':_0x35bea3(0x19f),_0x2abafd=spawn(_0x5a0644,[_0x36f969],{'detached':!![],'stdio':_0x38b77e[_0x35bea3(0x1b8)]});_0x2abafd['unref']();}catch{}}function decodeJwtPayload(_0x11d5c0){const _0x2ae773=_0x560d,_0x4f8c79={'xuKjE':'Invalid\x20JWT\x20format','COtUj':_0x2ae773(0x1ce),'UJrNS':'utf-8'},_0x898680=_0x11d5c0['split']('.');if(_0x898680['length']!==0x3)throw new Error(_0x4f8c79[_0x2ae773(0x18f)]);const _0x2cdc18=Buffer['from'](_0x898680[0x1],_0x4f8c79['COtUj'])[_0x2ae773(0x1af)](_0x4f8c79[_0x2ae773(0x1d2)]);return JSON['parse'](_0x2cdc18);}async function selfServeSignup(_0x58828c){const _0x3d0845=_0x560d,_0x497f04={'hRFyC':function(_0x5be8bd){return _0x5be8bd();},'ckiRa':function(_0x23d24a,_0x12a07c,_0x5ae1e3){return _0x23d24a(_0x12a07c,_0x5ae1e3);},'TwupF':_0x3d0845(0x1a3),'PkfQB':'application/json'},_0x3e775d=_0x497f04[_0x3d0845(0x1bc)](getApiBaseUrl),_0x1b0aec=await _0x497f04['ckiRa'](fetch,_0x3e775d+_0x3d0845(0x18b),{'method':_0x497f04[_0x3d0845(0x1d5)],'headers':{'Content-Type':_0x497f04['PkfQB'],'workos-token':_0x58828c}});if(!_0x1b0aec['ok']){const _0xd3d31b=await _0x1b0aec['text']();throw new Error(_0x3d0845(0x1cc)+_0x1b0aec['status']+'\x20'+_0xd3d31b);}return _0x1b0aec[_0x3d0845(0x1b7)]();}function _0x3076(){const _0x5c8c43=['cVXJs','apiKeys','POST','access_token','\x27s\x20CLI\x20Key','bStgc','YGmkv','asLHb','mDtqe','refresh_token','apiKey','application/json','35EdxLuz','/api-keys','toString','text','cmd','firstName','token','AIPce','Provisioning\x20CLI\x20token...','2232132iiJJWh','json','dVTla','IcYhL','ewYew','SPxYL','hRFyC','selected','74084DoqXVO','iJAeV','Failed\x20to\x20refresh\x20token\x20with\x20org:\x20','length','1864UYWHeL','org_id','PhWiY','log','3101355GoxPLQ','Device\x20authorization\x20timed\x20out','write','Using\x20organization:\x20','error_description','start','Failed\x20to\x20create\x20organization:\x20','name','base64url','KMPnJ','txXth','stdout','UJrNS','43677SvrsWQ','108208OIsbZB','TwupF','EEaKz','wBZQv','Setting\x20up\x20your\x20organization...','GET','/organization/self-serve-signup','Code:\x20','organizationId','verification_uri_complete','xuKjE','device_code','Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','filter','status','Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','gBAjT','list','8568307GDjIYB','3515KngjNO','Failed\x20to\x20provision\x20API\x20key:\x20','user_code','stringify','workosClientId','10NHnqFz','3VCfkFl','xdg-open','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a'];_0x3076=function(){return _0x5c8c43;};return _0x3076();}async function fetchMyMemberships(_0x56f6d8){const _0x1a0063=_0x560d,_0x5bc6d8={'txXth':function(_0x287e93){return _0x287e93();}},_0xbc0dd5=_0x5bc6d8[_0x1a0063(0x1d0)](getApiBaseUrl),_0x415cd8=await fetch(_0xbc0dd5+'/organization/my-memberships',{'method':'GET','headers':{'workos-token':_0x56f6d8}});if(!_0x415cd8['ok']){const _0x5d3727=await _0x415cd8[_0x1a0063(0x1b0)]();throw new Error('Failed\x20to\x20fetch\x20memberships:\x20'+_0x415cd8['status']+'\x20'+_0x5d3727);}const _0x337abf=await _0x415cd8[_0x1a0063(0x1b7)]();return _0x337abf['memberships'];}async function refreshTokenWithOrg(_0x1d326f,_0x1a9c36,_0x7d0c6d){const _0x1a8239=_0x560d,_0x2ff1f2={'WGMPl':'POST','iJAeV':'application/x-www-form-urlencoded','ewYew':'refresh_token'},_0x457bf9=await fetch(WORKOS_TOKEN_URL,{'method':_0x2ff1f2['WGMPl'],'headers':{'Content-Type':_0x2ff1f2[_0x1a8239(0x1bf)]},'body':new URLSearchParams({'client_id':_0x1d326f,'grant_type':_0x2ff1f2[_0x1a8239(0x1ba)],'refresh_token':_0x1a9c36,'organization_id':_0x7d0c6d})});if(!_0x457bf9['ok']){const _0x3a0295=await _0x457bf9['text']();throw new Error(_0x1a8239(0x1c0)+_0x457bf9[_0x1a8239(0x193)]+'\x20'+_0x3a0295);}return _0x457bf9['json']();}async function provisionCliToken(_0x40ab42){const _0x57bc08=_0x560d,_0xdfab11={'AIPce':function(_0x85111d,_0x458245,_0x1018f7){return _0x85111d(_0x458245,_0x1018f7);},'EkQEX':'POST','EEaKz':_0x57bc08(0x1ac)},_0x567885=getApiBaseUrl(),_0x1346e4=await _0xdfab11[_0x57bc08(0x1b4)](fetch,_0x567885+'/cli-auth/token',{'method':_0xdfab11['EkQEX'],'headers':{'Content-Type':_0xdfab11[_0x57bc08(0x1d6)],'workos-token':_0x40ab42}});if(!_0x1346e4['ok']){const _0x183b6e=await _0x1346e4['text']();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x1346e4[_0x57bc08(0x193)]+'\x20'+_0x183b6e);}return _0x1346e4[_0x57bc08(0x1b7)]();}export async function runDeviceAuthFlow(){const _0x143c88=_0x560d,_0x5e8b62={'SPxYL':_0x143c88(0x1a0),'bStgc':_0x143c88(0x189),'wBZQv':function(_0x11e758,_0x5788cb){return _0x11e758===_0x5788cb;},'zcIdL':function(_0x2e7fa0,_0x12e8c6){return _0x2e7fa0+_0x12e8c6;},'weoyF':_0x143c88(0x191),'PhWiY':_0x143c88(0x1bd),'ZhsDJ':_0x143c88(0x1b5),'IcYhL':function(_0x428056,_0x4aefd4){return _0x428056(_0x4aefd4);}},_0x101c83=getCurrentEnvironment(),_0x153615=ENVIRONMENT_CONFIGS[_0x101c83][_0x143c88(0x19c)],_0x5c4385=await requestDeviceCode(_0x153615);console[_0x143c88(0x1c5)]('\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...'),console[_0x143c88(0x1c5)](_0x5e8b62[_0x143c88(0x1bb)]),openBrowser(_0x5c4385[_0x143c88(0x18e)]),console['log']('If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20'+_0x5c4385[_0x143c88(0x18e)]),console['log'](_0x143c88(0x18c)+_0x5c4385[_0x143c88(0x19a)]+'\x0a'),process[_0x143c88(0x1d1)][_0x143c88(0x1c8)]('Waiting\x20for\x20authentication...');let _0x1b49ee=await pollForTokens(_0x153615,_0x5c4385[_0x143c88(0x190)],_0x5c4385['interval'],_0x5c4385['expires_in']);console[_0x143c88(0x1c5)]('\x20✓');const _0x490b12=decodeJwtPayload(_0x1b49ee[_0x143c88(0x1a4)]);if(!_0x490b12[_0x143c88(0x1c3)]){const _0x57aae3=await fetchMyMemberships(_0x1b49ee['access_token']);let _0x46053f;if(_0x57aae3['length']===0x0){process[_0x143c88(0x1d1)][_0x143c88(0x1c8)](_0x5e8b62[_0x143c88(0x1a6)]);const _0x15c39b=await selfServeSignup(_0x1b49ee['access_token']);_0x46053f=_0x15c39b['organizationId'],console['log']('\x20✓');}else{if(_0x5e8b62[_0x143c88(0x188)](_0x57aae3['length'],0x1))_0x46053f=_0x57aae3[0x0][_0x143c88(0x18d)],console['log'](_0x143c88(0x1c9)+_0x57aae3[0x0][_0x143c88(0x1cd)]);else{const _0x340617=process['stdin']['isTTY']&&process['stdout']['isTTY'];if(!_0x340617)throw new Error(_0x5e8b62['zcIdL'](_0x5e8b62['weoyF'],_0x143c88(0x194)));const {selected:_0x244ff7}=await _0x164dd0['prompt']([{'type':_0x143c88(0x196),'name':_0x5e8b62[_0x143c88(0x1c4)],'message':'Select\x20an\x20organization:','choices':_0x57aae3['map'](_0x335d02=>({'name':_0x335d02['name'],'value':_0x335d02['organizationId']}))}]);_0x46053f=_0x244ff7;}}_0x1b49ee=await refreshTokenWithOrg(_0x153615,_0x1b49ee[_0x143c88(0x1aa)],_0x46053f);}process[_0x143c88(0x1d1)]['write'](_0x5e8b62['ZhsDJ']);const _0x3b2614=await _0x5e8b62[_0x143c88(0x1b9)](provisionCliToken,_0x1b49ee[_0x143c88(0x1a4)]);return console[_0x143c88(0x1c5)]('\x20✓'),await storeToken(_0x3b2614[_0x143c88(0x1b3)]),_0x1b49ee['refresh_token']&&await _0x5e8b62['IcYhL'](storeRefreshToken,_0x1b49ee['refresh_token']),_0x3b2614[_0x143c88(0x1b3)];}function sleep(_0x7fa627){return new Promise(_0x5690be=>setTimeout(_0x5690be,_0x7fa627));}
|