@ranger-testing/ranger-cli 3.1.4-alpha.fb796e7-45 → 3.1.4-alpha.ffeeafe-46
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/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/deleteProfile.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/novaActCli.js +1 -1
- package/build/commands/utils/opencodeConfig.js +1 -1
- package/build/commands/utils/organizationEnvApi.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/rangerwrightCli.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/scenarioOriginCheck.js +1 -0
- 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/tunnelClient.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/commands/verifyFeatureNovaCli.js +1 -1
- package/build/commands/verifyFeatureRangerwrightCli.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x136a80=_0x318f;(function(_0x9d5796,_0x1a1776){const _0x195ece=_0x318f,_0x2a8a4d=_0x9d5796();while(!![]){try{const _0x1e3a1e=-parseInt(_0x195ece(0xc6))/0x1*(parseInt(_0x195ece(0x11f))/0x2)+-parseInt(_0x195ece(0xd2))/0x3*(parseInt(_0x195ece(0xca))/0x4)+-parseInt(_0x195ece(0xbb))/0x5+parseInt(_0x195ece(0xa8))/0x6+-parseInt(_0x195ece(0x114))/0x7+-parseInt(_0x195ece(0x10f))/0x8+parseInt(_0x195ece(0x121))/0x9;if(_0x1e3a1e===_0x1a1776)break;else _0x2a8a4d['push'](_0x2a8a4d['shift']());}catch(_0x2002b7){_0x2a8a4d['push'](_0x2a8a4d['shift']());}}}(_0x17c2,0x1ed41));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';function _0x318f(_0x1b4d24,_0x1c0ed9){_0x1b4d24=_0x1b4d24-0x9e;const _0x17c230=_0x17c2();let _0x318f25=_0x17c230[_0x1b4d24];return _0x318f25;}import _0x1d08e0 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,needsTunnel,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';function targetHostForTelemetry(_0x141a45){const _0xfe54db=_0x318f,_0x2b08da={'exXMu':_0xfe54db(0xee)};try{return new URL(_0x141a45)['host'];}catch{return _0x2b08da['exXMu'];}}function errorMessageForTelemetry(_0x5ef999){return _0x5ef999 instanceof Error?_0x5ef999['message']:undefined;}function trackBridgeEvent(_0x8a5f3f,_0x520a90){const _0x359b34=_0x318f,_0x3b9ab2={'qCqvV':_0x359b34(0x108),'iCgTT':_0x359b34(0xb4)};if(!_0x8a5f3f)return;const _0xc91cc9={'tunnelSessionId':_0x520a90['sessionId'],'tunnelEventType':_0x520a90['type'],'connectionId':_0x520a90[_0x359b34(0x109)],'code':_0x520a90['code'],'reason':_0x520a90['reason'],'error':_0x520a90[_0x359b34(0xd0)],'elapsedMs':_0x520a90['elapsedMs'],'activeLocalConnections':_0x520a90[_0x359b34(0xd4)],'pendingLocalConnections':_0x520a90['pendingLocalConnections']};_0x8a5f3f['trackPhaseEnd']('tunnel_bridge_event',_0xc91cc9),(_0x520a90[_0x359b34(0x10a)]===_0x3b9ab2['qCqvV']||_0x520a90[_0x359b34(0x10a)]===_0x3b9ab2[_0x359b34(0xe5)])&&void _0x8a5f3f[_0x359b34(0xd6)]('tunnel_bridge',new Error(_0x520a90[_0x359b34(0xd0)]??_0x520a90[_0x359b34(0x10a)]),_0xc91cc9);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x2ea254=_0x318f,_0x2a4bd9={'sBfjD':function(_0x2b5b28){return _0x2b5b28();},'WUyJw':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x23723f=await _0x2a4bd9[_0x2ea254(0x106)](getToken);if(!_0x23723f)throw new Error(_0x2a4bd9[_0x2ea254(0xfd)]);return _0x23723f;}async function apiRequest(_0x3f6fbe,_0x266277={}){const _0x59bdb0=_0x318f,_0x3807b1={'HIyDJ':function(_0x1c5735){return _0x1c5735();},'UKtrG':function(_0x7109b7,_0x5bd5f9,_0x42dca2){return _0x7109b7(_0x5bd5f9,_0x42dca2);},'yLCUs':_0x59bdb0(0x125),'aQkqx':function(_0x13e831,_0x477ba4){return _0x13e831===_0x477ba4;},'teKir':'string'},_0x358083=await requireToken(),_0x48422e=_0x3807b1['HIyDJ'](getApiBaseUrl),_0x28fe68=await _0x3807b1[_0x59bdb0(0xe3)](fetch,''+_0x48422e+_0x3f6fbe,{..._0x266277,'headers':{'Authorization':_0x59bdb0(0xf8)+_0x358083,'Content-Type':_0x3807b1['yLCUs'],..._0x266277['headers']??{}}});if(!_0x28fe68['ok']){let _0x137092='',_0x120e98;try{const _0x4ac2b9=await _0x28fe68['json'](),_0x204b70=(_0x3807b1['aQkqx'](typeof _0x4ac2b9['error'],_0x3807b1['teKir'])?_0x4ac2b9[_0x59bdb0(0xd0)]:undefined)??JSON[_0x59bdb0(0x112)](_0x4ac2b9);_0x137092=_0x204b70;typeof _0x4ac2b9['test_output']==='string'&&_0x4ac2b9[_0x59bdb0(0xd9)]&&(_0x137092=_0x137092+'\x0a'+_0x4ac2b9[_0x59bdb0(0xd9)]);if(typeof _0x4ac2b9['code']==='string')_0x120e98=_0x4ac2b9[_0x59bdb0(0xce)];}catch{_0x137092=_0x28fe68['statusText'];}throw new ApiError(_0x59bdb0(0x110)+_0x3f6fbe+'\x20failed\x20('+_0x28fe68['status']+'):\x20'+_0x137092,_0x28fe68[_0x59bdb0(0xeb)],_0x137092,_0x120e98);}if(_0x3807b1['aQkqx'](_0x28fe68['status'],0xcc))return undefined;return _0x28fe68['json']();}export class ApiError extends Error{[_0x136a80(0xeb)];['detail'];['code'];constructor(_0x112db1,_0x557a12,_0x1446d3,_0x5ebd86){const _0x6fa314=_0x136a80,_0x42c326={'pYaDx':_0x6fa314(0xcf)};super(_0x112db1),this[_0x6fa314(0xeb)]=_0x557a12,this['detail']=_0x1446d3,this['code']=_0x5ebd86,this['name']=_0x42c326['pYaDx'];}}export async function fetchCloudProfile(_0x4ab070){const _0x129b83=_0x136a80,_0x2743a9={'gxvGk':function(_0x19e45a,_0x5ddba7){return _0x19e45a===_0x5ddba7;}};try{return await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x4ab070));}catch(_0x57da6a){if(_0x57da6a instanceof ApiError&&_0x2743a9[_0x129b83(0xfe)](_0x57da6a['status'],0x194))return null;throw _0x57da6a;}}export async function listCloudProfiles(){const _0x322f47=_0x136a80,_0x5ed712={'ysOoZ':function(_0x4715bc,_0x1c5d45){return _0x4715bc(_0x1c5d45);}},_0x250243=await _0x5ed712[_0x322f47(0xb0)](apiRequest,'/api/v1/profiles');return _0x250243[_0x322f47(0xcc)];}export async function deleteCloudProfile(_0x25afc3){const _0x4d713a=_0x136a80,_0x554b36={'WUvgb':function(_0xeac05,_0x537b10,_0x2d05b2){return _0xeac05(_0x537b10,_0x2d05b2);},'kxbdy':'DELETE'};try{await _0x554b36[_0x4d713a(0xfb)](apiRequest,_0x4d713a(0xa6)+encodeURIComponent(_0x25afc3),{'method':_0x554b36['kxbdy']});}catch(_0x183d48){if(_0x183d48 instanceof ApiError&&_0x183d48['status']===0x194)throw new Error('Cloud\x20profile\x20\x22'+_0x25afc3+'\x22\x20not\x20found.');throw _0x183d48;}}export async function createCloudProfile(_0x17c4db,_0x280f31,_0x31568e={}){const _0x247146=_0x136a80,_0x5eac6f={'FExrf':function(_0x5074ac,_0x1e96b9){return _0x5074ac>_0x1e96b9;},'sgxKI':function(_0x442141,_0x5bba94,_0x4878f6){return _0x442141(_0x5bba94,_0x4878f6);},'ZpHxJ':'/api/v1/profiles'},_0x1894f4={'name':_0x17c4db};if(_0x280f31)_0x1894f4[_0x247146(0x132)]=_0x280f31;_0x31568e[_0x247146(0x9f)]&&_0x5eac6f['FExrf'](Object['keys'](_0x31568e['settings'])['length'],0x0)&&(_0x1894f4['settings']=_0x31568e[_0x247146(0x9f)]);if(_0x31568e['username'])_0x1894f4[_0x247146(0x12a)]=_0x31568e[_0x247146(0x12a)];if(_0x31568e['password'])_0x1894f4['password']=_0x31568e['password'];return await _0x5eac6f[_0x247146(0xe8)](apiRequest,_0x5eac6f[_0x247146(0x127)],{'method':'POST','body':JSON['stringify'](_0x1894f4)});}export async function uploadCloudProfileSession(_0x2f3a32,_0x2248fc){const _0x2e39e9=_0x136a80,_0x498c5d={'jaKqS':function(_0x32a52e,_0x48fb98,_0x3002d7){return _0x32a52e(_0x48fb98,_0x3002d7);},'guMXb':'POST'};return await _0x498c5d[_0x2e39e9(0xb7)](apiRequest,_0x2e39e9(0xa6)+encodeURIComponent(_0x2f3a32)+'/session',{'method':_0x498c5d['guMXb'],'body':JSON[_0x2e39e9(0x112)]({'session_state':_0x2248fc})});}export async function saveCloudProfileCredentials(_0x501bf1,_0x429ad5,_0x396f85){const _0x11653f=_0x136a80,_0x1d4745={'VOIJs':function(_0x33a2f5,_0x3228fd){return _0x33a2f5(_0x3228fd);},'NnDQO':_0x11653f(0xf7)};await apiRequest(_0x11653f(0xa6)+_0x1d4745['VOIJs'](encodeURIComponent,_0x501bf1),{'method':_0x1d4745[_0x11653f(0x11e)],'body':JSON['stringify']({'username':_0x429ad5,'password':_0x396f85})});}export async function fetchAuthConfig(){const _0x962ed1=_0x136a80,_0x4bca8e={'MEKrF':'/api/v1/profiles/auth-config','dAoiG':function(_0x48f188,_0x4f6bcf){return _0x48f188!==_0x4f6bcf;}};try{const _0x31c5ca=await apiRequest(_0x4bca8e['MEKrF']);return _0x31c5ca[_0x962ed1(0xf9)];}catch(_0x2d6bbe){return _0x2d6bbe instanceof ApiError&&_0x4bca8e['dAoiG'](_0x2d6bbe['status'],0x194)&&console['error']('\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20'+_0x2d6bbe[_0x962ed1(0x10e)]),null;}}async function createTunnelSession(_0x5acf5f){const _0x5b5eda=_0x136a80,_0x4b1d41={'CsyTw':function(_0x2b4c72,_0x2a37b1,_0x347669){return _0x2b4c72(_0x2a37b1,_0x347669);},'jjzal':_0x5b5eda(0xb3),'EgAqF':'agent'};return await _0x4b1d41[_0x5b5eda(0xf1)](apiRequest,_0x4b1d41[_0x5b5eda(0x115)],{'method':_0x5b5eda(0xa3),'body':JSON['stringify']({'targetUrl':_0x5acf5f,'mode':_0x4b1d41[_0x5b5eda(0xa2)]})});}function _0x17c2(){const _0x1aaeef=['userAgent','length','environment_key','gvEXc','raw','pw_endpoint','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','TePkx','settings','mzZNm','\x22\x20failed\x20validation\x20—\x20re-login\x20needed...','EgAqF','POST','\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22','khqQS','/api/v1/profiles/','\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22','37884zeHGMX','OwSGy','browserOptions','prompt','tunnel_login_cleanup','\x22\x20failed\x20validation\x20—\x20refreshing...','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','UkJIE','ysOoZ','sessionId','\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20','/api/v1/tunnel/sessions','local_ws_error','\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22','EjsND','jaKqS','VXiYB','force','HJoxE','908225vXAuDJ','WqFhh','eHfjc','log','launch','wmEpx','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','tunnelUrl','EzxQd','hpHeg','UPmbi','10567cUHgGP','domains','trackPhaseStart','yFZvV','194436IkqEOp','JXvzW','profiles','sHRvE','code','ApiError','error','defaultEnvironmentKey','6rhWhLE','/api/v1/tunnel/sessions/','activeLocalConnections','telemetry','trackPhaseError','\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.','\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','test_output','success','auoEy','wsEndpoint','LotYq','session_state','\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','trim','catch','loginInstructions','UKtrG','iPcdR','iCgTT','parse','sessionCheckPath','sgxKI','env','TxvXC','status','wxkCU','about:blank','invalid-url','cookies','KKUeE','CsyTw','environmentKey','QboTv','\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20','\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','invalidateOn','PUT','Bearer\x20','auth_config','RANGER_TEST_PASSWORD','WUvgb','gSDzl','WUyJw','gxvGk','yFGLm','\x20\x20Login\x20successful.\x20Session\x20cached.','forceLogin','toISOString','storageState','setupHeaders','origin','sBfjD','trackPhaseEnd','tunnel_error','connectionId','type','split','keys','some','message','1706528rwBQol','API\x20request\x20','\x20\x20No\x20live\x20session\x20for\x20\x22','stringify','name','1384502pnzXYm','jjzal','clientIp','cdbDK','\x22;\x20proceeding\x20with\x20loginInstructions.',').\x20','chOnN','confirm','persistSessionState','HtNFX','NnDQO','42AFWJYT','storageStatePath','9286479xExeMB','close','organizationId','/login','application/json','join','ZpHxJ','\x22,\x20cached\x20locally','\x22.\x0a','username','you\x27re\x20now\x20at\x20\x22','HIYlK','wVpRZ','RANGER_TEST_USERNAME','extraHTTPHeaders'];_0x17c2=function(){return _0x1aaeef;};return _0x17c2();}async function deleteTunnelSession(_0x33a7d3){const _0x421d0e=_0x136a80;await apiRequest(_0x421d0e(0xd3)+_0x33a7d3,{'method':'DELETE'});}export function pickAdHocEnvKey(_0x24d97b){const _0x46c236=_0x136a80,_0x3369ee={'wVpRZ':function(_0x3e4596,_0xe20754){return _0x3e4596===_0xe20754;}};if(!_0x24d97b)return null;if(_0x24d97b[_0x46c236(0xd1)])return _0x24d97b['defaultEnvironmentKey'];const _0x6a869f=Object[_0x46c236(0x10c)](_0x24d97b['environments']??{});if(_0x3369ee[_0x46c236(0x12d)](_0x6a869f['length'],0x1))return _0x6a869f[0x0];if(_0x6a869f['length']===0x0)return null;throw new Error('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x6a869f[_0x46c236(0x126)](',\x20')+_0x46c236(0x119)+'Create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`\x20so\x20Ranger\x20can\x20pick\x20the\x20right\x20one.');}export async function resolveAdHocProfile(_0x3daa72=process['env']){const _0x564425=_0x136a80,_0x28adf8={'auoEy':function(_0x3a1152,_0x30a385){return _0x3a1152(_0x30a385);},'khqQS':function(_0x3822b7,_0x42643e,_0x49eec5,_0x26b02a){return _0x3822b7(_0x42643e,_0x49eec5,_0x26b02a);},'RgTwE':function(_0x8e11aa,_0xc6cb87){return _0x8e11aa??_0xc6cb87;}},_0x14e950=_0x3daa72[_0x564425(0x12e)];if(!_0x14e950)return null;const _0x24213e=await fetchCloudProfile(_0x14e950);if(_0x24213e)return{'name':_0x24213e[_0x564425(0x113)],'profile':_0x24213e};const _0x3f0cb4=await fetchAuthConfig(),_0x529a49=_0x28adf8[_0x564425(0xdb)](pickAdHocEnvKey,_0x3f0cb4),_0x598716=_0x3daa72['RANGER_TEST_PASSWORD'],_0x33c01e=await _0x28adf8[_0x564425(0xa5)](createCloudProfile,_0x14e950,_0x28adf8['RgTwE'](_0x529a49,undefined),{'username':_0x14e950,'password':_0x598716});return console[_0x564425(0xbe)]('\x20\x20Created\x20cloud\x20profile\x20\x22'+_0x33c01e[_0x564425(0x113)]+'\x22\x20for\x20'+_0x14e950),{'name':_0x33c01e[_0x564425(0x113)],'profile':_0x33c01e};}export async function writeSessionToLocalCache(_0x1e09a5,_0x407cb6,_0x2cbf5e,_0x30dd76,_0x39761c,_0x427d8e,_0x47dee6){const _0x578d7d=_0x136a80,_0x2ded3e={'NsTrQ':function(_0x49e838,_0x4c1d5f){return _0x49e838(_0x4c1d5f);},'HHoKq':function(_0x5a52ea,_0x15faf9,_0x42f432){return _0x5a52ea(_0x15faf9,_0x42f432);},'TXMPx':function(_0x168cfc){return _0x168cfc();},'yFGLm':'auth','sfHyn':function(_0x17d8ad,_0x4344c3,_0xce7032){return _0x17d8ad(_0x4344c3,_0xce7032);},'EjsND':function(_0x9fb34,_0x25a72e,_0x253030){return _0x9fb34(_0x25a72e,_0x253030);},'wgnPs':function(_0x4e4950,_0x25b2e5,_0x1738fb){return _0x4e4950(_0x25b2e5,_0x1738fb);}},_0x43a9cf=_0x2ded3e['NsTrQ'](sessionCacheHash,{'orgId':_0x407cb6,'profileName':_0x1e09a5,'effectiveBaseUrl':_0x2cbf5e,'setupHeaders':_0x30dd76,'invalidateOn':_0x47dee6?.['invalidateOn'],'userAgent':_0x47dee6?.['userAgent'],'clientIp':_0x47dee6?.[_0x578d7d(0x116)]}),_0x1bf774=_0x2ded3e['HHoKq'](getSessionCachePath,_0x43a9cf,_0x1e09a5),_0x39ccb9=join(_0x2ded3e['TXMPx'](getRangerHomeDir),_0x2ded3e[_0x578d7d(0xff)]);!existsSync(_0x39ccb9)&&await _0x2ded3e['sfHyn'](mkdir,_0x39ccb9,{'recursive':!![]});const _0x5a3ea7={..._0x39761c};_0x427d8e&&_0x427d8e['length']>0x0&&Array['isArray'](_0x5a3ea7[_0x578d7d(0xef)])&&(_0x5a3ea7['cookies']=_0x2ded3e[_0x578d7d(0xb6)](duplicateCookiesForDomains,_0x5a3ea7['cookies'],_0x427d8e));const _0x1c68bb={'cached_at':new Date()[_0x578d7d(0x102)](),'session_state':_0x5a3ea7};await _0x2ded3e['wgnPs'](writeFile,_0x1bf774,JSON[_0x578d7d(0x112)](_0x1c68bb,null,0x2));const _0x519452=_0x2ded3e['NsTrQ'](getStorageStatePath,_0x1bf774);return await writeFile(_0x519452,JSON['stringify'](_0x5a3ea7,null,0x2)),_0x519452;}export async function checkLocalCache(_0xd3c86f,_0x42d90c,_0x3e507f,_0x416aa3,_0x283545){const _0x2e6b52=_0x136a80,_0x33d654={'TePkx':function(_0x3e0758,_0x2f8ac3,_0x1a2aa7){return _0x3e0758(_0x2f8ac3,_0x1a2aa7);},'QboTv':function(_0x32b001,_0x30c68c){return _0x32b001(_0x30c68c);}},_0x4dc3e3=sessionCacheHash({'orgId':_0x42d90c,'profileName':_0xd3c86f,'effectiveBaseUrl':_0x3e507f,'setupHeaders':_0x416aa3,'invalidateOn':_0x283545?.[_0x2e6b52(0xf6)],'userAgent':_0x283545?.['userAgent'],'clientIp':_0x283545?.[_0x2e6b52(0x116)]}),_0x21d177=_0x33d654[_0x2e6b52(0x9e)](getSessionCachePath,_0x4dc3e3,_0xd3c86f),_0xa26c7d=getStorageStatePath(_0x21d177);if(!existsSync(_0x21d177)||!_0x33d654[_0x2e6b52(0xf3)](existsSync,_0xa26c7d))return null;try{const _0x322784=await _0x33d654[_0x2e6b52(0x9e)](readFile,_0x21d177,'utf-8');return JSON[_0x2e6b52(0xe6)](_0x322784),{'storageStatePath':_0xa26c7d};}catch{return null;}}function launchRealBrowser(){const _0x59c771=_0x136a80;return chromium[_0x59c771(0xbf)]({'headless':!![]});}function emitSessionValidationHint(_0x156006,_0x13a6aa){const _0x206a38=_0x136a80,_0x5bc22c={'SYqRv':function(_0x5b298b,_0x1c044b){return _0x5b298b===_0x1c044b;},'yFZvV':function(_0x17741f,_0x4a6933){return _0x17741f+_0x4a6933;}};if(!_0x13a6aa||!_0x13a6aa['domains']?.['length'])return;let _0x4af90a;try{_0x4af90a=new URL(_0x156006);}catch{return;}const _0x1831b2=[];for(const _0x11706c of _0x13a6aa[_0x206a38(0xc7)]){try{_0x1831b2['push']({'raw':_0x11706c,'url':new URL(_0x11706c)});}catch{}}if(_0x5bc22c['SYqRv'](_0x1831b2[_0x206a38(0x131)],0x0))return;if(_0x1831b2[_0x206a38(0x10d)](_0x1fdf91=>_0x1fdf91['url'][_0x206a38(0x105)]===_0x4af90a[_0x206a38(0x105)]))return;const _0x5abfd6=_0x1831b2['map'](_0x1b972f=>'\x22'+_0x1b972f[_0x206a38(0x134)]+'\x22')['join'](',\x20');console[_0x206a38(0xbe)](_0x5bc22c[_0x206a38(0xc9)](_0x206a38(0xf4)+_0x5abfd6+';\x20',_0x206a38(0x12b)+_0x156006+_0x206a38(0xb2))+_0x206a38(0xae));}export async function serverSideLogin(_0x1a1dde,_0x1cf97c){const _0x3dd3c6=_0x136a80,_0x4d4e9a={'fSQYI':function(_0x276513,_0xcd2bc5){return _0x276513(_0xcd2bc5);},'sHRvE':function(_0x2a9de9,_0x343554){return _0x2a9de9 instanceof _0x343554;},'abLIZ':function(_0x474bdc,_0x1ce1d5){return _0x474bdc===_0x1ce1d5;}},_0x4fa127=process['env'][_0x3dd3c6(0x12e)],_0x12d4ef=process['env']['RANGER_TEST_PASSWORD'],_0xabae03={};if(_0x4fa127)_0xabae03[_0x3dd3c6(0x12a)]=_0x4fa127;if(_0x12d4ef)_0xabae03['password']=_0x12d4ef;if(_0x1cf97c?.[_0x3dd3c6(0xb9)])_0xabae03['force']=!![];if(_0x1cf97c?.['targetUrl'])_0xabae03['target_url']=_0x1cf97c['targetUrl'];_0x1cf97c?.['tunnel']&&(_0xabae03['tunnel_session_id']=_0x1cf97c['tunnel'][_0x3dd3c6(0xb1)],_0xabae03[_0x3dd3c6(0x135)]=_0x1cf97c['tunnel']['pwEndpoint']);try{return await apiRequest('/api/v1/profiles/'+_0x4d4e9a['fSQYI'](encodeURIComponent,_0x1a1dde)+_0x3dd3c6(0x124),{'method':_0x3dd3c6(0xa3),'body':JSON[_0x3dd3c6(0x112)](_0xabae03)});}catch(_0x50b677){if(_0x4d4e9a[_0x3dd3c6(0xcd)](_0x50b677,ApiError)&&_0x50b677['status']===0x190&&_0x4d4e9a['abLIZ'](_0x50b677['code'],'not_configured'))return{'status':'not_configured','error':_0x50b677['detail']};throw _0x50b677;}}async function serverSideLoginWithOptionalTunnel(_0x485df1,_0x487c6a,_0x494931={}){const _0x3d3a2f=_0x136a80,_0x3ca489={'ImenH':function(_0x4cbd62,_0x35a048){return _0x4cbd62(_0x35a048);},'wxkCU':function(_0x1f8185,_0x473eef){return _0x1f8185(_0x473eef);},'LotYq':function(_0x1a4ad4,_0x3936e7){return _0x1a4ad4(_0x3936e7);},'OwSGy':function(_0x52f555,_0x11545b){return _0x52f555===_0x11545b;},'mzZNm':'true','fCDQq':function(_0x39c788,_0x3a03b3){return _0x39c788(_0x3a03b3);},'HtNFX':'tunnel_login_setup','WmZiz':_0x3d3a2f(0xd8),'erLXf':function(_0x48bfb1){return _0x48bfb1();},'JXvzW':'tunnel_login_request','QdZvP':function(_0x563fd6,_0x495535){return _0x563fd6(_0x495535);},'cdbDK':function(_0x7a5f86,_0x48970e){return _0x7a5f86??_0x48970e;},'chOnN':_0x3d3a2f(0xac)};if(!_0x3ca489[_0x3d3a2f(0xdd)](needsTunnel,_0x487c6a))return await serverSideLogin(_0x485df1,{'force':_0x494931['force']});let _0x357aa8=null,_0x531ecd=null,_0x51cced=null,_0x5fed73=null,_0x1afe0e=![];const _0x138f5d=process['env']['RANGER_TUNNEL_LOGIN_HEADED']?.['toLowerCase'](),_0x35f2d6=_0x3ca489['OwSGy'](_0x138f5d,'1')||_0x3ca489[_0x3d3a2f(0xa9)](_0x138f5d,_0x3ca489[_0x3d3a2f(0xa0)]),_0x362c6a={'profileName':_0x485df1,'targetUrlHost':_0x3ca489['fCDQq'](targetHostForTelemetry,_0x487c6a),'tunnelRequired':!![],'forceLogin':Boolean(_0x494931['force']),'localBrowserServerHeaded':_0x35f2d6};try{_0x494931['telemetry']?.['trackPhaseStart'](_0x3ca489['HtNFX'],_0x362c6a);_0x35f2d6&&console['log'](_0x3ca489['WmZiz']);_0x357aa8=await _0x3ca489['fCDQq'](launchBrowserServer,{'headless':!_0x35f2d6}),_0x531ecd=await _0x3ca489[_0x3d3a2f(0xdd)](createTunnelSession,_0x487c6a);const _0x40516c=await _0x3ca489['erLXf'](requireToken);_0x51cced=await createTunnelBridge({'localWsUrl':_0x357aa8[_0x3d3a2f(0xdc)],'tunnelServerUrl':_0x531ecd[_0x3d3a2f(0xc2)],'sessionId':_0x531ecd[_0x3d3a2f(0xb1)],'apiKey':_0x40516c,'onError':_0x57cc80=>{_0x5fed73=_0x57cc80;},'onClose':()=>{_0x5fed73??=new Error('Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20'+_0x485df1);},'onEvent':_0x59e3dc=>trackBridgeEvent(_0x494931['telemetry'],_0x59e3dc)}),_0x494931['telemetry']?.[_0x3d3a2f(0x107)](_0x3ca489['HtNFX'],{..._0x362c6a,'tunnelSessionId':_0x531ecd[_0x3d3a2f(0xb1)],'localBrowserServer':!![],'localBrowserServerHeaded':_0x35f2d6}),_0x1afe0e=!![];try{return _0x494931['telemetry']?.['trackPhaseStart'](_0x3ca489['JXvzW'],{..._0x362c6a,'tunnelSessionId':_0x531ecd['sessionId']}),await serverSideLogin(_0x485df1,{'force':_0x494931[_0x3d3a2f(0xb9)],'targetUrl':_0x487c6a,'tunnel':{'sessionId':_0x531ecd['sessionId'],'pwEndpoint':_0x531ecd['pwEndpoint']}})['then'](_0x121f5d=>{const _0x60302=_0x3d3a2f;return _0x494931[_0x60302(0xd5)]?.[_0x60302(0x107)]('tunnel_login_request',{..._0x362c6a,'tunnelSessionId':_0x531ecd?.[_0x60302(0xb1)],'loginStatus':_0x121f5d[_0x60302(0xeb)],'hasSessionState':_0x3ca489['ImenH'](Boolean,_0x121f5d['session_state']),'hasTestOutput':_0x3ca489[_0x60302(0xec)](Boolean,_0x121f5d[_0x60302(0xd9)]),'bridgeError':errorMessageForTelemetry(_0x5fed73)}),_0x121f5d;});}catch(_0x32cb0c){await _0x494931['telemetry']?.['trackPhaseError'](_0x3ca489[_0x3d3a2f(0xcb)],_0x5fed73??_0x32cb0c,{..._0x362c6a,'tunnelSessionId':_0x531ecd[_0x3d3a2f(0xb1)],'bridgeError':_0x3ca489['QdZvP'](errorMessageForTelemetry,_0x5fed73)});throw _0x3ca489[_0x3d3a2f(0x117)](_0x5fed73,_0x32cb0c);}}catch(_0x49a128){!_0x1afe0e&&await _0x494931[_0x3d3a2f(0xd5)]?.[_0x3d3a2f(0xd6)](_0x3ca489[_0x3d3a2f(0x11d)],_0x49a128,{..._0x362c6a,'tunnelSessionId':_0x531ecd?.['sessionId']});throw _0x49a128;}finally{if(_0x531ecd||_0x357aa8||_0x51cced){const _0x5b57f4='3|0|4|1|2'[_0x3d3a2f(0x10b)]('|');let _0x1795ab=0x0;while(!![]){switch(_0x5b57f4[_0x1795ab++]){case'0':_0x51cced?.[_0x3d3a2f(0x122)]();continue;case'1':_0x531ecd&&await deleteTunnelSession(_0x531ecd['sessionId'])['catch'](()=>{});continue;case'2':_0x494931['telemetry']?.['trackPhaseEnd'](_0x3ca489[_0x3d3a2f(0x11a)],{..._0x362c6a,'tunnelSessionId':_0x531ecd?.[_0x3d3a2f(0xb1)]});continue;case'3':_0x494931[_0x3d3a2f(0xd5)]?.[_0x3d3a2f(0xc8)]('tunnel_login_cleanup',{..._0x362c6a,'tunnelSessionId':_0x531ecd?.[_0x3d3a2f(0xb1)]});continue;case'4':_0x357aa8&&await _0x357aa8[_0x3d3a2f(0x122)]()[_0x3d3a2f(0xe1)](()=>{});continue;}break;}}}}export async function manualBrowserLogin(_0x48babb,_0x20205c,_0x13ff7f={}){const _0x5e8422=_0x136a80,_0x2528f4={'KhPlB':function(_0x5680d1,_0x30897b){return _0x5680d1/_0x30897b;},'gSDzl':function(_0x216312){return _0x216312();},'TxvXC':function(_0x309a1d,_0x1a2fe2){return _0x309a1d+_0x1a2fe2;},'iPcdR':'or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','prOXF':function(_0x41f763,_0x542692){return _0x41f763>_0x542692;},'dGHEx':'\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','FcPVN':function(_0x18e5b0,_0x1e9dc6){return _0x18e5b0&&_0x1e9dc6;},'ivcWY':'Browser\x20login\x20timed\x20out\x20before\x20completion.','cdLfX':function(_0x52534e,_0x2397fa){return _0x52534e!==_0x2397fa;}};if(!_0x2528f4[_0x5e8422(0xfc)](isInteractive))throw new Error(_0x2528f4[_0x5e8422(0xea)]('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x48babb[_0x5e8422(0x113)]+_0x5e8422(0x129),_0x5e8422(0xdf))+_0x2528f4[_0x5e8422(0xe4)]);const _0x348ba0=_0x20205c&&_0x2528f4['prOXF'](_0x20205c[_0x5e8422(0xc7)][_0x5e8422(0x131)],0x0)?_0x20205c['domains'][0x0]:_0x5e8422(0xed);console['log'](_0x2528f4['dGHEx']),console['log']('\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a'),await new Promise(_0x21d971=>setTimeout(_0x21d971,0x7d0));const _0x59b0e2=await chromium['launch']({'headless':![]});let _0x3fb60c=null;try{const _0x3f2f6e={'ignoreHTTPSErrors':!![]};_0x20205c?.['setupHeaders']&&(_0x3f2f6e[_0x5e8422(0x12f)]=_0x20205c['setupHeaders']);const _0x3d204f=await _0x59b0e2['newContext'](_0x3f2f6e);await addProfileSetupBanner(_0x3d204f);const _0xa51aec=await _0x3d204f['newPage']();await _0xa51aec['goto'](_0x348ba0);let _0x5b2473=![];await new Promise(_0x3250c3=>{const _0x24bf52=_0x5e8422,_0x3d58ff=setTimeout(()=>{const _0xa1d036=_0x318f;_0x5b2473=!![],console['error']('Browser\x20login\x20timed\x20out\x20after\x20'+_0x2528f4['KhPlB'](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+_0xa1d036(0xd7)),_0x3250c3();},MANUAL_LOGIN_TIMEOUT_MS);_0xa51aec['on'](_0x24bf52(0x122),async()=>{const _0x2a7f0b=_0x24bf52;clearTimeout(_0x3d58ff);try{const _0x3ad9f7=await _0x3d204f[_0x2a7f0b(0x103)]();_0x3fb60c=_0x3ad9f7;}catch{}_0x3250c3();});});if(_0x2528f4['FcPVN'](_0x5b2473,!_0x3fb60c))throw new Error(_0x2528f4['ivcWY']);}finally{await _0x59b0e2['close']()['catch'](()=>{});}if(!_0x3fb60c)throw new Error('Browser\x20closed\x20before\x20authentication\x20was\x20saved.');return _0x2528f4['cdLfX'](_0x13ff7f[_0x5e8422(0x11c)],![])&&await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x48babb['name'])+'/session',{'method':_0x5e8422(0xa3),'body':JSON['stringify']({'session_state':_0x3fb60c,'updated_by':'cli:manual-login'})}),{'sessionState':_0x3fb60c};}export async function promptSaveCredentials(_0x116c43){const _0x49c3e6=_0x136a80,_0x59f22d={'CXgmz':function(_0x3f7ad1){return _0x3f7ad1();},'HIYlK':_0x49c3e6(0x11b),'hpHeg':'save','KKUeE':function(_0x18a088,_0x20589b){return _0x18a088(_0x20589b);}},_0x9f026f=process['env'][_0x49c3e6(0x12e)],_0x494405=process['env'][_0x49c3e6(0xfa)];if(!_0x9f026f||!_0x494405)return;if(!_0x59f22d['CXgmz'](isInteractive))return;const {save:_0x341520}=await _0x1d08e0[_0x49c3e6(0xab)]([{'type':_0x59f22d[_0x49c3e6(0x12c)],'name':_0x59f22d[_0x49c3e6(0xc4)],'message':'Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','default':![]}]);if(!_0x341520)return;await apiRequest('/api/v1/profiles/'+_0x59f22d[_0x49c3e6(0xf0)](encodeURIComponent,_0x116c43),{'method':'PUT','body':JSON[_0x49c3e6(0x112)]({'username':_0x9f026f,'password':_0x494405})}),console[_0x49c3e6(0xbe)]('\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.');}export async function resolveCloudProfileSession(_0x1b6446,_0x3c50cb={}){const _0x5d9b69=_0x136a80,_0x2e85a9={'VXiYB':function(_0x48d023,_0x4b82c2,_0x49e7a8){return _0x48d023(_0x4b82c2,_0x49e7a8);},'YIidf':function(_0x358d81,_0xc344df){return _0x358d81===_0xc344df;},'eHfjc':'string','UkJIE':function(_0x1b13eb,_0x1d5bf6){return _0x1b13eb||_0x1d5bf6;},'UPmbi':function(_0x55dadc,_0x447e82){return _0x55dadc(_0x447e82);},'wmEpx':function(_0x450441,_0x30cb5d,_0x3a7fae,_0x35893b,_0xc3a330,_0x594bdb){return _0x450441(_0x30cb5d,_0x3a7fae,_0x35893b,_0xc3a330,_0x594bdb);},'HJoxE':function(_0x3d1fa7,_0x21fa26){return _0x3d1fa7&&_0x21fa26;},'EzxQd':function(_0x521603,_0x30b794,_0x3f3746,_0x3e8081,_0x5a688f,_0x2c7bf2,_0x41deaa,_0x447fbe){return _0x521603(_0x30b794,_0x3f3746,_0x3e8081,_0x5a688f,_0x2c7bf2,_0x41deaa,_0x447fbe);},'gvEXc':function(_0x1786ff,_0x1714a3){return _0x1786ff(_0x1714a3);},'hheCE':'not_configured','clMzT':_0x5d9b69(0x100),'UmllL':function(_0x371dab,_0x384bff){return _0x371dab&&_0x384bff;},'WqFhh':function(_0x156b6a,_0x552c33,_0x129208,_0xe1cb2){return _0x156b6a(_0x552c33,_0x129208,_0xe1cb2);}},_0x34b0d7=_0x1b6446[_0x5d9b69(0x9f)]??{},_0x20a632=await fetchAuthConfig(),_0x39c513=_0x20a632?_0x2e85a9['VXiYB'](resolveAuthEnvironmentLocally,_0x20a632,_0x1b6446[_0x5d9b69(0xf2)]):null,_0x41293f=_0x2e85a9['YIidf'](typeof _0x39c513?.['loginInstructions'],'string')&&_0x39c513[_0x5d9b69(0xe2)]['trim']()?_0x39c513[_0x5d9b69(0xe2)]:undefined,_0x3c0d5d=typeof _0x34b0d7[_0x5d9b69(0xe2)]===_0x2e85a9[_0x5d9b69(0xbd)]&&_0x34b0d7[_0x5d9b69(0xe2)][_0x5d9b69(0xe0)]()?_0x34b0d7['loginInstructions']:undefined,_0x5d0114=_0x2e85a9[_0x5d9b69(0xaf)](_0x3c0d5d,!_0x41293f)?_0x34b0d7:{..._0x34b0d7,'loginInstructions':_0x41293f},_0x4841c8=Boolean(_0x5d0114['loginInstructions']?.['trim']()),_0x4d60c6=Boolean(_0x34b0d7[_0x5d9b69(0x101)]||_0x39c513?.['forceLogin']),_0x382aee=_0x39c513?.['domains'],_0x2d72d6=_0x34b0d7[_0x5d9b69(0x104)],_0x408fa9=_0x2d72d6??_0x39c513?.['setupHeaders'],_0x2be74b=_0x3c50cb['effectiveBaseUrl']??_0x34b0d7['baseUrl']??(_0x382aee&&_0x382aee['length']>0x0?_0x382aee[0x0]:''),_0x1ae16b=_0x2be74b?_0x2e85a9['UPmbi'](needsTunnel,_0x2be74b):![],_0x70a192={'invalidateOn':_0x39c513?.[_0x5d9b69(0xf6)],'userAgent':_0x39c513?.[_0x5d9b69(0xaa)]?.[_0x5d9b69(0x130)]??_0x34b0d7['userAgent']};_0x4d60c6&&console[_0x5d9b69(0xbe)]('\x20\x20forceLogin\x20enabled\x20for\x20\x22'+_0x1b6446['name']+'\x22,\x20refreshing\x20session...');if(!_0x4d60c6){const _0x37af5b=await _0x2e85a9[_0x5d9b69(0xc0)](checkLocalCache,_0x1b6446[_0x5d9b69(0x113)],_0x1b6446[_0x5d9b69(0x123)],_0x2be74b,_0x408fa9,_0x70a192);if(_0x37af5b){if(_0x2e85a9[_0x5d9b69(0xba)](_0x2be74b,!_0x1ae16b)){const _0x2dfe58=await isCachedSessionLive(_0x37af5b['storageStatePath'],_0x2be74b,{'sessionCheckPath':_0x39c513?.[_0x5d9b69(0xe7)],'setupHeaders':_0x408fa9},{'launchBrowser':launchRealBrowser});if(_0x2dfe58)return console['log'](_0x5d9b69(0xb5)+_0x1b6446[_0x5d9b69(0x113)]+'\x22'),{'authPath':_0x37af5b['storageStatePath'],'settings':_0x5d0114,'resolvedEnv':_0x39c513};console['log']('\x20\x20Cached\x20session\x20for\x20\x22'+_0x1b6446[_0x5d9b69(0x113)]+_0x5d9b69(0xad)),emitSessionValidationHint(_0x2be74b,_0x39c513);}else return _0x1ae16b&&console['log'](_0x5d9b69(0xa4)+_0x1b6446[_0x5d9b69(0x113)]+'\x22'),{'authPath':_0x37af5b[_0x5d9b69(0x120)],'settings':_0x5d0114,'resolvedEnv':_0x39c513};}}if(!_0x4d60c6&&_0x1b6446['sessionState']){if(_0x1ae16b)console['log'](_0x5d9b69(0xa7)+_0x2be74b+'\x22\x20on\x20profile\x20\x22'+_0x1b6446[_0x5d9b69(0x113)]+'\x22');else{const _0x222e97=await _0x2e85a9[_0x5d9b69(0xc3)](writeSessionToLocalCache,_0x1b6446['name'],_0x1b6446['organizationId'],_0x2be74b,_0x408fa9,_0x1b6446['sessionState'],_0x382aee,_0x70a192);if(_0x2be74b){const _0x7e2b6a=await isCachedSessionLive(_0x222e97,_0x2be74b,{'sessionCheckPath':_0x39c513?.[_0x5d9b69(0xe7)],'setupHeaders':_0x408fa9},{'launchBrowser':launchRealBrowser});if(_0x7e2b6a)return console['log']('\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22'+_0x1b6446['name']+_0x5d9b69(0x128)),{'authPath':_0x222e97,'settings':_0x5d0114,'resolvedEnv':_0x39c513};console[_0x5d9b69(0xbe)]('\x20\x20Cloud\x20session\x20for\x20\x22'+_0x1b6446[_0x5d9b69(0x113)]+_0x5d9b69(0xa1)),_0x2e85a9[_0x5d9b69(0xb8)](emitSessionValidationHint,_0x2be74b,_0x39c513);}else return{'authPath':_0x222e97,'settings':_0x5d0114,'resolvedEnv':_0x39c513};}}if(_0x4841c8)return console[_0x5d9b69(0xbe)]('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x1b6446[_0x5d9b69(0x113)]+_0x5d9b69(0x118)),{'authPath':undefined,'settings':_0x5d0114,'resolvedEnv':_0x39c513};console['log'](_0x5d9b69(0x111)+_0x1b6446[_0x5d9b69(0x113)]+'\x22,\x20attempting\x20login...');const _0x139fa0=_0x2e85a9[_0x5d9b69(0xc5)](Boolean,process[_0x5d9b69(0xe9)][_0x5d9b69(0x12e)])&&Boolean(process['env'][_0x5d9b69(0xfa)]),_0x42dcfe=_0x2e85a9[_0x5d9b69(0x133)](Boolean,_0x1b6446[_0x5d9b69(0x12a)]);if(_0x139fa0||_0x42dcfe)try{const _0x2fb8e5=_0x2be74b?await serverSideLoginWithOptionalTunnel(_0x1b6446['name'],_0x2be74b,{'force':_0x4d60c6,'telemetry':_0x3c50cb['telemetry']}):await serverSideLogin(_0x1b6446[_0x5d9b69(0x113)],{'force':_0x4d60c6});if(_0x2fb8e5['status']===_0x2e85a9['hheCE'])console[_0x5d9b69(0xbe)](_0x5d9b69(0xf5));else{if(_0x2fb8e5['status']===_0x5d9b69(0xda)&&_0x2fb8e5['session_state']){console[_0x5d9b69(0xbe)](_0x2e85a9['clMzT']);const _0x2e91e2=await _0x2e85a9[_0x5d9b69(0xc3)](writeSessionToLocalCache,_0x1b6446['name'],_0x1b6446[_0x5d9b69(0x123)],_0x2be74b,_0x408fa9,_0x2fb8e5[_0x5d9b69(0xde)],_0x382aee,_0x70a192);return _0x2e85a9['UmllL'](_0x139fa0,!_0x42dcfe)&&await _0x2e85a9['UPmbi'](promptSaveCredentials,_0x1b6446['name']),{'authPath':_0x2e91e2,'settings':_0x5d0114,'resolvedEnv':_0x39c513};}else _0x2fb8e5['test_output']&&(console[_0x5d9b69(0xbe)](_0x5d9b69(0xc1)),console[_0x5d9b69(0xbe)](_0x2fb8e5[_0x5d9b69(0xd9)])),console[_0x5d9b69(0xbe)]('\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...');}}catch(_0x4b30d3){console[_0x5d9b69(0xbe)]('\x20\x20Server-side\x20login\x20error:\x20'+(_0x4b30d3 instanceof Error?_0x4b30d3['message']:_0x2e85a9['UPmbi'](String,_0x4b30d3))),console[_0x5d9b69(0xbe)](_0x5d9b69(0x136));}const _0x44f827=_0x39c513?{..._0x39c513,'setupHeaders':_0x408fa9}:_0x2be74b?{'key':_0x1b6446[_0x5d9b69(0xf2)]??'','domains':[_0x2be74b],'setupHeaders':_0x408fa9}:null,{sessionState:_0x5d0b96}=await _0x2e85a9[_0x5d9b69(0xbc)](manualBrowserLogin,_0x1b6446,_0x44f827,{'persistSessionState':!_0x1ae16b}),_0x526da7=await writeSessionToLocalCache(_0x1b6446['name'],_0x1b6446[_0x5d9b69(0x123)],_0x2be74b,_0x408fa9,_0x5d0b96,_0x382aee,_0x70a192);return{'authPath':_0x526da7,'settings':_0x5d0114,'resolvedEnv':_0x39c513};}
|
|
1
|
+
(function(_0xcb6e39,_0x1d39af){const _0x156924=_0x5e39,_0x82153c=_0xcb6e39();while(!![]){try{const _0x9dba55=-parseInt(_0x156924(0x8f))/0x1+parseInt(_0x156924(0xda))/0x2*(parseInt(_0x156924(0xb2))/0x3)+parseInt(_0x156924(0xbb))/0x4+-parseInt(_0x156924(0x11c))/0x5*(parseInt(_0x156924(0x88))/0x6)+-parseInt(_0x156924(0x70))/0x7+parseInt(_0x156924(0xb7))/0x8+parseInt(_0x156924(0x11a))/0x9*(-parseInt(_0x156924(0x12f))/0xa);if(_0x9dba55===_0x1d39af)break;else _0x82153c['push'](_0x82153c['shift']());}catch(_0x107296){_0x82153c['push'](_0x82153c['shift']());}}}(_0x4aa6,0x63d82));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0xa77b1d 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,needsTunnel,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{matchAuthEnvironmentByHost,matchAuthEnvironmentExact}from'./matchAuthEnvironment.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';function targetHostForTelemetry(_0x3db3ad){try{return new URL(_0x3db3ad)['host'];}catch{return'invalid-url';}}function errorMessageForTelemetry(_0x1a68cd){const _0x2d193d=_0x5e39;return _0x1a68cd instanceof Error?_0x1a68cd[_0x2d193d(0xd6)]:undefined;}function trackBridgeEvent(_0x22df12,_0x1fbbf7){const _0x4aa949=_0x5e39,_0x23b63f={'WMFOs':_0x4aa949(0xa5),'bUoIQ':function(_0x51b632,_0x532845){return _0x51b632===_0x532845;},'ouuCt':_0x4aa949(0x104)};if(!_0x22df12)return;const _0x4973df={'tunnelSessionId':_0x1fbbf7['sessionId'],'tunnelEventType':_0x1fbbf7['type'],'connectionId':_0x1fbbf7['connectionId'],'code':_0x1fbbf7['code'],'reason':_0x1fbbf7[_0x4aa949(0x10a)],'error':_0x1fbbf7['error'],'elapsedMs':_0x1fbbf7[_0x4aa949(0xbd)],'activeLocalConnections':_0x1fbbf7['activeLocalConnections'],'pendingLocalConnections':_0x1fbbf7[_0x4aa949(0x97)]};_0x22df12['trackPhaseEnd'](_0x23b63f['WMFOs'],_0x4973df),(_0x23b63f['bUoIQ'](_0x1fbbf7[_0x4aa949(0x11e)],_0x23b63f['ouuCt'])||_0x1fbbf7[_0x4aa949(0x11e)]==='local_ws_error')&&void _0x22df12[_0x4aa949(0x87)](_0x4aa949(0x85),new Error(_0x1fbbf7['error']??_0x1fbbf7[_0x4aa949(0x11e)]),_0x4973df);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x2e55d3=_0x5e39,_0x42e1b0={'ChDnc':_0x2e55d3(0xbe)},_0x403909=await getToken();if(!_0x403909)throw new Error(_0x42e1b0['ChDnc']);return _0x403909;}async function apiRequest(_0x5a647a,_0x2aac06={}){const _0x49db50=_0x5e39,_0x343b9a={'JLuNU':function(_0x219270){return _0x219270();},'SmTju':function(_0x18b1c8){return _0x18b1c8();},'qrzge':_0x49db50(0x71),'QrzlY':_0x49db50(0x89)},_0x64d018=await _0x343b9a[_0x49db50(0x6b)](requireToken),_0x429278=_0x343b9a[_0x49db50(0x11b)](getApiBaseUrl),_0x2256dd=await fetch(''+_0x429278+_0x5a647a,{..._0x2aac06,'headers':{'Authorization':'Bearer\x20'+_0x64d018,'Content-Type':_0x343b9a[_0x49db50(0x6d)],..._0x2aac06[_0x49db50(0xce)]??{}}});if(!_0x2256dd['ok']){let _0x580712='',_0x2a07b4;try{const _0x59d7d7=await _0x2256dd['json'](),_0x8b0b1b=(typeof _0x59d7d7['error']===_0x343b9a[_0x49db50(0x86)]?_0x59d7d7[_0x49db50(0xe1)]:undefined)??JSON['stringify'](_0x59d7d7);_0x580712=_0x8b0b1b;typeof _0x59d7d7['test_output']===_0x343b9a['QrzlY']&&_0x59d7d7['test_output']&&(_0x580712=_0x580712+'\x0a'+_0x59d7d7['test_output']);if(typeof _0x59d7d7[_0x49db50(0x78)]==='string')_0x2a07b4=_0x59d7d7[_0x49db50(0x78)];}catch{_0x580712=_0x2256dd['statusText'];}throw new ApiError('API\x20request\x20'+_0x5a647a+'\x20failed\x20('+_0x2256dd[_0x49db50(0xb5)]+'):\x20'+_0x580712,_0x2256dd[_0x49db50(0xb5)],_0x580712,_0x2a07b4);}if(_0x2256dd[_0x49db50(0xb5)]===0xcc)return undefined;return _0x2256dd['json']();}export class ApiError extends Error{['status'];['detail'];['code'];constructor(_0x3cb275,_0x1fc7a8,_0x1b6837,_0x17213f){const _0x4f4c23=_0x5e39,_0x290237={'wXPrU':'ApiError'};super(_0x3cb275),this[_0x4f4c23(0xb5)]=_0x1fc7a8,this['detail']=_0x1b6837,this['code']=_0x17213f,this[_0x4f4c23(0xae)]=_0x290237['wXPrU'];}}export async function fetchCloudProfile(_0xcad205){const _0x2ec4c5=_0x5e39,_0x505ae8={'PunrT':function(_0x86820,_0x5a8414){return _0x86820(_0x5a8414);},'ywuJK':function(_0x4b0214,_0x580485){return _0x4b0214 instanceof _0x580485;},'OvmGv':function(_0x1e4279,_0x3030bd){return _0x1e4279===_0x3030bd;}};try{return await _0x505ae8['PunrT'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0xcad205));}catch(_0xe85ba4){if(_0x505ae8['ywuJK'](_0xe85ba4,ApiError)&&_0x505ae8[_0x2ec4c5(0xcb)](_0xe85ba4[_0x2ec4c5(0xb5)],0x194))return null;throw _0xe85ba4;}}export async function listCloudProfiles(){const _0x17f9a9=_0x5e39,_0x18bcd0={'PDtBI':function(_0x2378c8,_0x4a5eb9){return _0x2378c8(_0x4a5eb9);}},_0x4a637e=await _0x18bcd0['PDtBI'](apiRequest,'/api/v1/profiles');return _0x4a637e[_0x17f9a9(0x93)];}export async function deleteCloudProfile(_0x97175){const _0x4fb4d3=_0x5e39,_0x4badf5={'JoDmT':_0x4fb4d3(0xfb),'GLQzB':function(_0x3b71b5,_0x789fae){return _0x3b71b5===_0x789fae;}};try{await apiRequest(_0x4fb4d3(0x105)+encodeURIComponent(_0x97175),{'method':_0x4badf5['JoDmT']});}catch(_0x3ef29b){if(_0x3ef29b instanceof ApiError&&_0x4badf5['GLQzB'](_0x3ef29b['status'],0x194))throw new Error('Cloud\x20profile\x20\x22'+_0x97175+'\x22\x20not\x20found.');throw _0x3ef29b;}}function _0x5e39(_0x45e873,_0x2dddb3){_0x45e873=_0x45e873-0x6b;const _0x4aa665=_0x4aa6();let _0x5e39cb=_0x4aa665[_0x45e873];return _0x5e39cb;}export async function createCloudProfile(_0x27b05c,_0x2a0b34,_0x158c0f={}){const _0x33ac43=_0x5e39,_0x5b9bb9={'AZUlm':_0x33ac43(0xe0)},_0x2f4294={'name':_0x27b05c};if(_0x2a0b34)_0x2f4294[_0x33ac43(0x6f)]=_0x2a0b34;_0x158c0f[_0x33ac43(0x6e)]&&Object['keys'](_0x158c0f[_0x33ac43(0x6e)])['length']>0x0&&(_0x2f4294[_0x33ac43(0x6e)]=_0x158c0f['settings']);if(_0x158c0f[_0x33ac43(0x102)])_0x2f4294[_0x33ac43(0x102)]=_0x158c0f['username'];if(_0x158c0f[_0x33ac43(0x74)])_0x2f4294[_0x33ac43(0x74)]=_0x158c0f[_0x33ac43(0x74)];return await apiRequest('/api/v1/profiles',{'method':_0x5b9bb9['AZUlm'],'body':JSON[_0x33ac43(0xc4)](_0x2f4294)});}export async function uploadCloudProfileSession(_0x183446,_0x824a89){const _0x5f468e=_0x5e39,_0x51c33b={'TqBpZ':function(_0x3ccfb4,_0x95236c,_0x3a4207){return _0x3ccfb4(_0x95236c,_0x3a4207);},'etGQy':function(_0x4d78df,_0x5a9384){return _0x4d78df(_0x5a9384);},'HGdqs':_0x5f468e(0xe0)};return await _0x51c33b[_0x5f468e(0xfa)](apiRequest,'/api/v1/profiles/'+_0x51c33b['etGQy'](encodeURIComponent,_0x183446)+'/session',{'method':_0x51c33b['HGdqs'],'body':JSON['stringify']({'session_state':_0x824a89})});}export async function saveCloudProfileCredentials(_0x34ff82,_0x4a5362,_0x4a50d1){const _0x371f5e=_0x5e39,_0x292a02={'nNJRJ':function(_0x24ec57,_0x4d3c67,_0x2869b8){return _0x24ec57(_0x4d3c67,_0x2869b8);}};await _0x292a02['nNJRJ'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x34ff82),{'method':_0x371f5e(0xd4),'body':JSON[_0x371f5e(0xc4)]({'username':_0x4a5362,'password':_0x4a50d1})});}export async function fetchAuthConfig(){const _0x47b122=_0x5e39,_0x32abb7={'fFrQC':function(_0x12b08e,_0x475937){return _0x12b08e(_0x475937);},'wEIce':'/api/v1/profiles/auth-config','TKGRj':function(_0xff2046,_0x2695eb){return _0xff2046!==_0x2695eb;}};try{const _0x296185=await _0x32abb7['fFrQC'](apiRequest,_0x32abb7['wEIce']);return _0x296185[_0x47b122(0x10c)];}catch(_0x297a69){return _0x297a69 instanceof ApiError&&_0x32abb7['TKGRj'](_0x297a69[_0x47b122(0xb5)],0x194)&&console[_0x47b122(0xe1)](_0x47b122(0xa8)+_0x297a69[_0x47b122(0xd6)]),null;}}async function createTunnelSession(_0x5dadb1){const _0x5b641e=_0x5e39,_0xd3a3bc={'EpxLF':function(_0x20dae1,_0x10c744,_0x5589b7){return _0x20dae1(_0x10c744,_0x5589b7);},'VBDST':_0x5b641e(0x118),'DfexE':'agent'};return await _0xd3a3bc[_0x5b641e(0xde)](apiRequest,_0xd3a3bc['VBDST'],{'method':_0x5b641e(0xe0),'body':JSON[_0x5b641e(0xc4)]({'targetUrl':_0x5dadb1,'mode':_0xd3a3bc['DfexE']})});}async function deleteTunnelSession(_0x40b00a){const _0x527677={'dYpVM':function(_0x42d88a,_0x4249de,_0x44a50c){return _0x42d88a(_0x4249de,_0x44a50c);},'AfmaJ':'DELETE'};await _0x527677['dYpVM'](apiRequest,'/api/v1/tunnel/sessions/'+_0x40b00a,{'method':_0x527677['AfmaJ']});}export function pickAdHocEnvKey(_0x379863,_0x46f9d9,_0x2e51d3){const _0x42f4d3=_0x5e39,_0xc1146e={'rlIpO':function(_0xc84634,_0x111abd){return _0xc84634+_0x111abd;},'IcvjN':function(_0x1cd204,_0x5023c3){return _0x1cd204+_0x5023c3;},'OpURh':function(_0x4b5eda,_0x2ebec2){return _0x4b5eda in _0x2ebec2;},'HnxFr':_0x42f4d3(0xe6),'hMBsQ':function(_0x34f56e,_0x126e82){return _0x34f56e+_0x126e82;}};if(_0x2e51d3){if(!_0x379863?.[_0x42f4d3(0x10f)]?.[_0x2e51d3]){const _0x4a110d=Object[_0x42f4d3(0x123)](_0x379863?.['environments']??{});throw new Error(_0xc1146e[_0x42f4d3(0xaa)](_0xc1146e[_0x42f4d3(0x110)](_0x42f4d3(0xf9)+_0x2e51d3+_0x42f4d3(0x100),_0x4a110d['length']?_0x42f4d3(0x76)+_0x4a110d[_0x42f4d3(0x114)](',\x20')+'.':'\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.'),'\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)'));}return _0x2e51d3;}if(!_0x379863)return null;if(_0x46f9d9){const _0x2d88ac=matchAuthEnvironmentExact(_0x46f9d9,_0x379863);if(_0x2d88ac)return _0x2d88ac;const _0x14b235=matchAuthEnvironmentByHost(_0x46f9d9,_0x379863);if(_0x14b235&&_0xc1146e['OpURh'](_0x42f4d3(0xa1),_0x14b235))return console['log']('\x20\x20Auth\x20env\x20\x22'+_0x14b235['key']+'\x22\x20matched\x20by\x20host\x20for\x20'+_0x46f9d9+_0x42f4d3(0xf1)),_0x14b235[_0x42f4d3(0xa1)];if(_0x14b235&&_0xc1146e[_0x42f4d3(0x101)](_0xc1146e['HnxFr'],_0x14b235))throw new Error(_0x42f4d3(0x80)+_0x14b235['ambiguous']['join'](',\x20')+_0x42f4d3(0xb0));if(needsTunnel(_0x46f9d9))throw new Error(_0xc1146e['hMBsQ'](_0x42f4d3(0xac)+_0x46f9d9+_0x42f4d3(0xd2)+_0x42f4d3(0x9b)+_0x42f4d3(0xfd)+_0x42f4d3(0xf5)+('\x20\x20-\x20ask\x20your\x20Ranger\x20admin\x20to\x20add\x20\x22'+_0x46f9d9[_0x42f4d3(0x82)](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a'),_0x42f4d3(0xec)+_0x46f9d9+'\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.'));}if(_0x379863['defaultEnvironmentKey'])return _0x379863[_0x42f4d3(0xa0)];const _0x32edb3=Object[_0x42f4d3(0x123)](_0x379863['environments']??{});if(_0x32edb3['length']===0x1)return _0x32edb3[0x0];if(_0x32edb3['length']===0x0)return null;throw new Error(_0xc1146e[_0x42f4d3(0x110)]('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x32edb3['join'](',\x20')+_0x42f4d3(0x11d),_0x42f4d3(0xe4)));}export function adHocProfileName(_0x26429d,_0x5bc9ec,_0xc2dc8b){if(!_0x5bc9ec||_0x5bc9ec===_0xc2dc8b)return _0x26429d;return _0x26429d+':'+_0x5bc9ec;}export async function resolveAdHocProfile(_0x356e1e={},_0x3137f3=process['env']){const _0x4218bb=_0x5e39,_0x222361={'EtwHT':function(_0xbd7e85,_0x137109,_0x1fff8c,_0x52c61c){return _0xbd7e85(_0x137109,_0x1fff8c,_0x52c61c);},'cGQVo':function(_0x333c91,_0x2364df){return _0x333c91(_0x2364df);},'jrxuO':function(_0x446fb6,_0x1752e3){return _0x446fb6!==_0x1752e3;},'jKYCc':function(_0x1d4479,_0x478751,_0x36dae4,_0x11c726){return _0x1d4479(_0x478751,_0x36dae4,_0x11c726);}},_0x4df839=_0x3137f3['RANGER_TEST_USERNAME'];if(!_0x4df839)return null;const _0x583736=await fetchAuthConfig(),_0x16d0e8=pickAdHocEnvKey(_0x583736,_0x356e1e[_0x4218bb(0xf0)],_0x356e1e['envKey']);let _0x4047db=_0x222361[_0x4218bb(0xc3)](adHocProfileName,_0x4df839,_0x16d0e8,_0x583736?.['defaultEnvironmentKey']),_0x9ba88d=await _0x222361[_0x4218bb(0xd1)](fetchCloudProfile,_0x4047db);_0x9ba88d&&_0x16d0e8&&_0x222361['jrxuO'](_0x9ba88d['environmentKey'],_0x16d0e8)&&(console[_0x4218bb(0x128)]('\x20\x20Cloud\x20profile\x20\x22'+_0x4047db+'\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22'+(_0x9ba88d[_0x4218bb(0x9a)]??_0x4218bb(0x113))+'\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22'+_0x16d0e8+'\x22;\x20using\x20\x22'+_0x4df839+':'+_0x16d0e8+'\x22\x20instead.'),_0x4047db=_0x4df839+':'+_0x16d0e8,_0x9ba88d=await fetchCloudProfile(_0x4047db));if(_0x9ba88d)return{'name':_0x9ba88d[_0x4218bb(0xae)],'profile':_0x9ba88d};const _0x5a468b=_0x3137f3['RANGER_TEST_PASSWORD'],_0x48ab94=await _0x222361[_0x4218bb(0xfc)](createCloudProfile,_0x4047db,_0x16d0e8??undefined,{'username':_0x4df839,'password':_0x5a468b});return console[_0x4218bb(0x128)](_0x4218bb(0x7a)+_0x48ab94[_0x4218bb(0xae)]+'\x22\x20for\x20'+_0x4df839+(_0x16d0e8?_0x4218bb(0xb6)+_0x16d0e8+')':'')),{'name':_0x48ab94[_0x4218bb(0xae)],'profile':_0x48ab94};}export async function writeSessionToLocalCache(_0x41fcbf,_0x39139c,_0x58f19d,_0x519838,_0xd6ec46,_0x111c53,_0x947688){const _0x1a822a=_0x5e39,_0x15fc6b={'JWWDz':function(_0x5273a5,_0x5dc06c){return _0x5273a5(_0x5dc06c);},'Mcnyk':function(_0x4a678a,_0x513b5a,_0x345643){return _0x4a678a(_0x513b5a,_0x345643);},'YkDkJ':function(_0x5188d7,_0x3a7cc0,_0x34a66f){return _0x5188d7(_0x3a7cc0,_0x34a66f);},'qUAjn':function(_0x5717c0,_0x259c09){return _0x5717c0>_0x259c09;},'RyVWl':function(_0xcb36ce,_0x429512,_0x2d66ac){return _0xcb36ce(_0x429512,_0x2d66ac);}},_0x295e70=_0x15fc6b['JWWDz'](sessionCacheHash,{'orgId':_0x39139c,'profileName':_0x41fcbf,'effectiveBaseUrl':_0x58f19d,'setupHeaders':_0x519838,'invalidateOn':_0x947688?.[_0x1a822a(0x77)],'userAgent':_0x947688?.[_0x1a822a(0xeb)],'clientIp':_0x947688?.['clientIp']}),_0x2ff5fd=_0x15fc6b[_0x1a822a(0x130)](getSessionCachePath,_0x295e70,_0x41fcbf),_0x5692f7=_0x15fc6b['YkDkJ'](join,getRangerHomeDir(),'auth');!_0x15fc6b['JWWDz'](existsSync,_0x5692f7)&&await mkdir(_0x5692f7,{'recursive':!![]});const _0x50547a={..._0xd6ec46};_0x111c53&&_0x15fc6b[_0x1a822a(0xe7)](_0x111c53[_0x1a822a(0xf8)],0x0)&&Array[_0x1a822a(0xd7)](_0x50547a[_0x1a822a(0xd9)])&&(_0x50547a['cookies']=duplicateCookiesForDomains(_0x50547a[_0x1a822a(0xd9)],_0x111c53));const _0xbac083={'cached_at':new Date()[_0x1a822a(0x107)](),'session_state':_0x50547a};await _0x15fc6b[_0x1a822a(0x130)](writeFile,_0x2ff5fd,JSON[_0x1a822a(0xc4)](_0xbac083,null,0x2));const _0x473e04=getStorageStatePath(_0x2ff5fd);return await _0x15fc6b['RyVWl'](writeFile,_0x473e04,JSON[_0x1a822a(0xc4)](_0x50547a,null,0x2)),_0x473e04;}export async function checkLocalCache(_0x398eba,_0x3f4ca2,_0xfdc4a0,_0x5e589b,_0x15d9ea){const _0x1696e3=_0x5e39,_0x47681e={'EfCfX':function(_0x2b1012,_0x29c7bb,_0x127d01){return _0x2b1012(_0x29c7bb,_0x127d01);},'qzfiK':function(_0x59eabe,_0x112e7a){return _0x59eabe(_0x112e7a);}},_0x5a02a4=sessionCacheHash({'orgId':_0x3f4ca2,'profileName':_0x398eba,'effectiveBaseUrl':_0xfdc4a0,'setupHeaders':_0x5e589b,'invalidateOn':_0x15d9ea?.['invalidateOn'],'userAgent':_0x15d9ea?.[_0x1696e3(0xeb)],'clientIp':_0x15d9ea?.[_0x1696e3(0xcd)]}),_0x192f95=_0x47681e[_0x1696e3(0xd3)](getSessionCachePath,_0x5a02a4,_0x398eba),_0x253dcd=_0x47681e['qzfiK'](getStorageStatePath,_0x192f95);if(!existsSync(_0x192f95)||!existsSync(_0x253dcd))return null;try{const _0x72cd2e=await readFile(_0x192f95,'utf-8');return JSON[_0x1696e3(0xf6)](_0x72cd2e),{'storageStatePath':_0x253dcd};}catch{return null;}}function launchRealBrowser(){return chromium['launch']({'headless':!![]});}function emitSessionValidationHint(_0x228c7e,_0x10c3dc){const _0x2468d1=_0x5e39,_0x5b3aea={'kXpSb':function(_0x314b17,_0x470605){return _0x314b17+_0x470605;}};if(!_0x10c3dc||!_0x10c3dc[_0x2468d1(0x12b)]?.[_0x2468d1(0xf8)])return;let _0x3fc580;try{_0x3fc580=new URL(_0x228c7e);}catch{return;}const _0x3da8f6=[];for(const _0x368a33 of _0x10c3dc['domains']){try{_0x3da8f6[_0x2468d1(0xa7)]({'raw':_0x368a33,'url':new URL(_0x368a33)});}catch{}}if(_0x3da8f6['length']===0x0)return;if(_0x3da8f6[_0x2468d1(0xdb)](_0x82e29e=>_0x82e29e[_0x2468d1(0xb1)]['origin']===_0x3fc580[_0x2468d1(0x7e)]))return;const _0x3e790c=_0x3da8f6['map'](_0x435276=>'\x22'+_0x435276[_0x2468d1(0x9c)]+'\x22')['join'](',\x20');console[_0x2468d1(0x128)](_0x5b3aea['kXpSb']('\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20'+_0x3e790c+';\x20','you\x27re\x20now\x20at\x20\x22'+_0x228c7e+_0x2468d1(0xb8))+_0x2468d1(0xba));}export async function serverSideLogin(_0x37b6a3,_0x14ffc7){const _0x5a0535=_0x5e39,_0x358bcb={'ydgzf':function(_0xe65352,_0x4b007c,_0x1303d9){return _0xe65352(_0x4b007c,_0x1303d9);},'fdRuZ':function(_0x30e56f,_0x2d8c5a){return _0x30e56f instanceof _0x2d8c5a;},'HWUls':function(_0x32b786,_0x15e299){return _0x32b786===_0x15e299;},'JbCET':'not_configured'},_0x374a02=process[_0x5a0535(0x7f)]['RANGER_TEST_USERNAME'],_0xa1f864=process['env'][_0x5a0535(0x92)],_0x39dbd0={};if(_0x374a02)_0x39dbd0[_0x5a0535(0x102)]=_0x374a02;if(_0xa1f864)_0x39dbd0['password']=_0xa1f864;if(_0x14ffc7?.[_0x5a0535(0x124)])_0x39dbd0['force']=!![];if(_0x14ffc7?.['targetUrl'])_0x39dbd0[_0x5a0535(0xa3)]=_0x14ffc7['targetUrl'];_0x14ffc7?.['tunnel']&&(_0x39dbd0[_0x5a0535(0xe5)]=_0x14ffc7[_0x5a0535(0xc0)]['sessionId'],_0x39dbd0[_0x5a0535(0xf4)]=_0x14ffc7['tunnel'][_0x5a0535(0xca)]);try{return await _0x358bcb['ydgzf'](apiRequest,_0x5a0535(0x105)+encodeURIComponent(_0x37b6a3)+'/login',{'method':_0x5a0535(0xe0),'body':JSON['stringify'](_0x39dbd0)});}catch(_0x1a035e){if(_0x358bcb['fdRuZ'](_0x1a035e,ApiError)&&_0x358bcb[_0x5a0535(0x117)](_0x1a035e[_0x5a0535(0xb5)],0x190)&&_0x358bcb[_0x5a0535(0x117)](_0x1a035e[_0x5a0535(0x78)],_0x5a0535(0xed)))return{'status':_0x358bcb['JbCET'],'error':_0x1a035e['detail']};throw _0x1a035e;}}async function serverSideLoginWithOptionalTunnel(_0x5483e5,_0x18dc30,_0x4707ad={}){const _0x56ae57=_0x5e39,_0x3e13e7={'AyoyS':_0x56ae57(0x12a),'SYMCA':function(_0x1e0268,_0xdcdd9c){return _0x1e0268(_0xdcdd9c);},'OPUmh':function(_0x43eb28,_0x4852b6){return _0x43eb28(_0x4852b6);},'ZIQge':function(_0x1db7dc,_0x145f11,_0x5bdfb5){return _0x1db7dc(_0x145f11,_0x5bdfb5);},'hOFTD':function(_0x48802d,_0x5b64a2){return _0x48802d===_0x5b64a2;},'XWroZ':'true','VgBNL':function(_0x1c2965,_0x5dedbe){return _0x1c2965(_0x5dedbe);},'biIKq':'tunnel_login_setup','kUxKV':function(_0x38f124,_0x94806d){return _0x38f124(_0x94806d);},'WtLFy':function(_0x28972f,_0x314ce5,_0x3a6647){return _0x28972f(_0x314ce5,_0x3a6647);},'HOnKl':function(_0x3de128,_0x311788){return _0x3de128??_0x311788;},'mWEqH':function(_0x2e4561,_0x48085a){return _0x2e4561||_0x48085a;},'IsbDL':function(_0x3b5230,_0x42ac8b){return _0x3b5230(_0x42ac8b);}};if(!_0x3e13e7['OPUmh'](needsTunnel,_0x18dc30))return await _0x3e13e7[_0x56ae57(0x129)](serverSideLogin,_0x5483e5,{'force':_0x4707ad['force']});let _0x23e364=null,_0xca1c2e=null,_0x5283cd=null,_0x5ce314=null,_0x1ea505=![];const _0x17bd94=process['env'][_0x56ae57(0xc5)]?.[_0x56ae57(0x12e)](),_0x1cc15f=_0x3e13e7[_0x56ae57(0x7c)](_0x17bd94,'1')||_0x17bd94===_0x3e13e7[_0x56ae57(0xa9)],_0x1d1b34={'profileName':_0x5483e5,'targetUrlHost':targetHostForTelemetry(_0x18dc30),'tunnelRequired':!![],'forceLogin':_0x3e13e7[_0x56ae57(0x98)](Boolean,_0x4707ad['force']),'localBrowserServerHeaded':_0x1cc15f};try{_0x4707ad['telemetry']?.['trackPhaseStart'](_0x3e13e7[_0x56ae57(0x83)],_0x1d1b34);_0x1cc15f&&console['log'](_0x56ae57(0xcf));_0x23e364=await _0x3e13e7[_0x56ae57(0x106)](launchBrowserServer,{'headless':!_0x1cc15f}),_0xca1c2e=await createTunnelSession(_0x18dc30);const _0x24f09f=await requireToken();_0x5283cd=await _0x3e13e7[_0x56ae57(0x106)](createTunnelBridge,{'localWsUrl':_0x23e364['wsEndpoint'],'tunnelServerUrl':_0xca1c2e['tunnelUrl'],'sessionId':_0xca1c2e[_0x56ae57(0x119)],'apiKey':_0x24f09f,'onError':_0x557b5c=>{_0x5ce314=_0x557b5c;},'onClose':()=>{_0x5ce314??=new Error('Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20'+_0x5483e5);},'onEvent':_0x2d42ee=>trackBridgeEvent(_0x4707ad[_0x56ae57(0x96)],_0x2d42ee)}),_0x4707ad[_0x56ae57(0x96)]?.[_0x56ae57(0x120)]('tunnel_login_setup',{..._0x1d1b34,'tunnelSessionId':_0xca1c2e['sessionId'],'localBrowserServer':!![],'localBrowserServerHeaded':_0x1cc15f}),_0x1ea505=!![];try{return _0x4707ad[_0x56ae57(0x96)]?.[_0x56ae57(0xf3)](_0x56ae57(0x12a),{..._0x1d1b34,'tunnelSessionId':_0xca1c2e['sessionId']}),await _0x3e13e7[_0x56ae57(0x125)](serverSideLogin,_0x5483e5,{'force':_0x4707ad[_0x56ae57(0x124)],'targetUrl':_0x18dc30,'tunnel':{'sessionId':_0xca1c2e['sessionId'],'pwEndpoint':_0xca1c2e[_0x56ae57(0xca)]}})[_0x56ae57(0x121)](_0x34e6b5=>{const _0x187e72=_0x56ae57;return _0x4707ad[_0x187e72(0x96)]?.['trackPhaseEnd'](_0x3e13e7[_0x187e72(0xbf)],{..._0x1d1b34,'tunnelSessionId':_0xca1c2e?.['sessionId'],'loginStatus':_0x34e6b5[_0x187e72(0xb5)],'hasSessionState':Boolean(_0x34e6b5['session_state']),'hasTestOutput':Boolean(_0x34e6b5[_0x187e72(0x7b)]),'bridgeError':_0x3e13e7[_0x187e72(0x10d)](errorMessageForTelemetry,_0x5ce314)}),_0x34e6b5;});}catch(_0xe1d685){await _0x4707ad[_0x56ae57(0x96)]?.['trackPhaseError']('tunnel_login_request',_0x3e13e7['HOnKl'](_0x5ce314,_0xe1d685),{..._0x1d1b34,'tunnelSessionId':_0xca1c2e['sessionId'],'bridgeError':errorMessageForTelemetry(_0x5ce314)});throw _0x3e13e7['HOnKl'](_0x5ce314,_0xe1d685);}}catch(_0x304bb1){!_0x1ea505&&await _0x4707ad[_0x56ae57(0x96)]?.['trackPhaseError']('tunnel_login_setup',_0x304bb1,{..._0x1d1b34,'tunnelSessionId':_0xca1c2e?.['sessionId']});throw _0x304bb1;}finally{(_0x3e13e7[_0x56ae57(0xb9)](_0xca1c2e,_0x23e364)||_0x5283cd)&&(_0x4707ad[_0x56ae57(0x96)]?.['trackPhaseStart'](_0x56ae57(0x126),{..._0x1d1b34,'tunnelSessionId':_0xca1c2e?.['sessionId']}),_0x5283cd?.[_0x56ae57(0x99)](),_0x23e364&&await _0x23e364['close']()[_0x56ae57(0x103)](()=>{}),_0xca1c2e&&await _0x3e13e7[_0x56ae57(0x115)](deleteTunnelSession,_0xca1c2e[_0x56ae57(0x119)])['catch'](()=>{}),_0x4707ad[_0x56ae57(0x96)]?.['trackPhaseEnd']('tunnel_login_cleanup',{..._0x1d1b34,'tunnelSessionId':_0xca1c2e?.[_0x56ae57(0x119)]}));}}export async function manualBrowserLogin(_0x2a91ce,_0x5017fa,_0x5ae4fa={}){const _0x37092d=_0x5e39,_0x11f31e={'vOUdP':function(_0x109f06,_0x2a0fcc){return _0x109f06/_0x2a0fcc;},'rRmha':'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','xFImJ':function(_0x5580b7,_0x29b8d5){return _0x5580b7>_0x29b8d5;},'nWKSh':_0x37092d(0x111),'sFVVR':'\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','yPQJY':function(_0x3b4712,_0x3e9287){return _0x3b4712(_0x3e9287);},'vRFxh':function(_0x3925a3,_0x524886){return _0x3925a3&&_0x524886;},'jPHVZ':_0x37092d(0x95),'EZYln':_0x37092d(0x10b),'Ioryw':function(_0x1825f6,_0x4ef879){return _0x1825f6!==_0x4ef879;},'UWybw':_0x37092d(0xe0)};if(!isInteractive())throw new Error(_0x37092d(0x84)+_0x2a91ce['name']+_0x37092d(0xd2)+_0x11f31e[_0x37092d(0xdc)]+_0x37092d(0x72));const _0x12d634=_0x5017fa&&_0x11f31e[_0x37092d(0xee)](_0x5017fa['domains'][_0x37092d(0xf8)],0x0)?_0x5017fa[_0x37092d(0x12b)][0x0]:_0x11f31e[_0x37092d(0x12c)];console[_0x37092d(0x128)](_0x11f31e[_0x37092d(0x73)]),console[_0x37092d(0x128)](_0x37092d(0xf2)),await new Promise(_0xdc4f52=>setTimeout(_0xdc4f52,0x7d0));const _0x362e94=await chromium['launch']({'headless':![]});let _0x467b6b=null;try{const _0x143352={'ignoreHTTPSErrors':!![]};_0x5017fa?.['setupHeaders']&&(_0x143352[_0x37092d(0xaf)]=_0x5017fa[_0x37092d(0xa4)]);const _0x2b8dfb=await _0x362e94['newContext'](_0x143352);await _0x11f31e[_0x37092d(0x94)](addProfileSetupBanner,_0x2b8dfb);const _0x4afc09=await _0x2b8dfb['newPage']();await _0x4afc09['goto'](_0x12d634);let _0x1b0d72=![];await new Promise(_0x891998=>{const _0x576a49={'Rbkwq':function(_0x536cce,_0x266f30){return _0x11f31e['vOUdP'](_0x536cce,_0x266f30);},'bPlBg':function(_0x33bd79){return _0x33bd79();}},_0x3349c8=setTimeout(()=>{const _0x19893d=_0x5e39;_0x1b0d72=!![],console[_0x19893d(0xe1)]('Browser\x20login\x20timed\x20out\x20after\x20'+_0x576a49[_0x19893d(0xd8)](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+_0x19893d(0xea)),_0x576a49['bPlBg'](_0x891998);},MANUAL_LOGIN_TIMEOUT_MS);_0x4afc09['on']('close',async()=>{const _0x20de87=_0x5e39;clearTimeout(_0x3349c8);try{const _0x19169c=await _0x2b8dfb[_0x20de87(0xd0)]();_0x467b6b=_0x19169c;}catch{}_0x891998();});});if(_0x11f31e[_0x37092d(0x6c)](_0x1b0d72,!_0x467b6b))throw new Error(_0x11f31e[_0x37092d(0x79)]);}finally{await _0x362e94['close']()[_0x37092d(0x103)](()=>{});}if(!_0x467b6b)throw new Error(_0x11f31e[_0x37092d(0xe9)]);return _0x11f31e['Ioryw'](_0x5ae4fa[_0x37092d(0x8c)],![])&&await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x2a91ce[_0x37092d(0xae)])+_0x37092d(0x8a),{'method':_0x11f31e['UWybw'],'body':JSON['stringify']({'session_state':_0x467b6b,'updated_by':_0x37092d(0x8b)})}),{'sessionState':_0x467b6b};}function _0x4aa6(){const _0x69afdd=['\x20Available:\x20','invalidateOn','code','jPHVZ','\x20\x20Created\x20cloud\x20profile\x20\x22','test_output','hOFTD','forceLogin','origin','env','Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20(','\x22,\x20refreshing\x20session...','replace','biIKq','No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22','tunnel_bridge','QrzlY','trackPhaseError','122730SstPyH','string','/session','cli:manual-login','persistSessionState','browserOptions','loginInstructions','262710uHISns','aiZZZ','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','RANGER_TEST_PASSWORD','profiles','yPQJY','Browser\x20login\x20timed\x20out\x20before\x20completion.','telemetry','pendingLocalConnections','VgBNL','close','environmentKey','\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a','raw','\x20\x20No\x20live\x20session\x20for\x20\x22','\x20\x20forceLogin\x20enabled\x20for\x20\x22','NyqWR','defaultEnvironmentKey','key','\x22;\x20proceeding\x20with\x20loginInstructions.','target_url','setupHeaders','tunnel_bridge_event','baseUrl','push','\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20','XWroZ','rlIpO','\x22\x20failed\x20validation\x20—\x20refreshing...','No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22','hiAjp','name','extraHTTPHeaders',');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.','url','12NRCqfw','success','tnknl','status','\x20(auth\x20env:\x20','5715808evKWCe','\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20','mWEqH','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','748276eVBcqt','sessionState','elapsedMs','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','AyoyS','tunnel','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','IDUqT','EtwHT','stringify','RANGER_TUNNEL_LOGIN_HEADED','ZXOem','NzsmI','organizationId','PWmVz','pwEndpoint','OvmGv','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','clientIp','headers','\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','storageState','cGQVo','\x22.\x0a','EfCfX','PUT','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','message','isArray','Rbkwq','cookies','143608ojZzia','some','rRmha','\x20\x20Server-side\x20login\x20error:\x20','EpxLF','RANGER_TEST_USERNAME','POST','error','sessionCheckPath','storageStatePath','Pass\x20--base-url\x20<your-app-url>\x20so\x20Ranger\x20can\x20match\x20the\x20right\x20one,\x20or\x20create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`.','tunnel_session_id','ambiguous','qUAjn','\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22','EZYln','\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.','userAgent','\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20','not_configured','xFImJ','kjZpB','targetUrl','\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).','\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','trackPhaseStart','pw_endpoint','\x20\x20-\x20pass\x20`--env\x20<key>`\x20to\x20pick\x20the\x20auth\x20environment\x20by\x20name,\x20or\x0a','parse','ZJuWs','length','Auth\x20environment\x20\x22','TqBpZ','DELETE','jKYCc','\x20\x20Options:\x0a','\x20\x20Cloud\x20session\x20for\x20\x22','effectiveBaseUrl','\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.','OpURh','username','catch','tunnel_error','/api/v1/profiles/','kUxKV','toISOString','YZoFq','dAPxy','reason','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','auth_config','SYMCA','hVVIl','environments','IcvjN','about:blank','UqQMj','none','join','IsbDL','doFSU','HWUls','/api/v1/tunnel/sessions','sessionId','981AZzYPk','SmTju','5PXsKkf',').\x20','type','CzVqK','trackPhaseEnd','then','yMdSn','keys','force','WtLFy','tunnel_login_cleanup','session_state','log','ZIQge','tunnel_login_request','domains','nWKSh','ltzwh','toLowerCase','21160SuFEaC','Mcnyk','JLuNU','vRFxh','qrzge','settings','environment_key','1861930qeGiYC','application/json','or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','sFVVR','password','prompt'];_0x4aa6=function(){return _0x69afdd;};return _0x4aa6();}export async function promptSaveCredentials(_0xaa74d8){const _0x1ab18e=_0x5e39,_0x3903e0={'IDUqT':function(_0x2c8dc6,_0x3edb74){return _0x2c8dc6||_0x3edb74;},'kjZpB':function(_0x5aa3ad){return _0x5aa3ad();},'ZJuWs':_0x1ab18e(0xcc),'dAPxy':function(_0x1e9eb8,_0x4c4749){return _0x1e9eb8(_0x4c4749);},'UqQMj':'PUT','CyRLA':_0x1ab18e(0x91)},_0x3755d2=process['env'][_0x1ab18e(0xdf)],_0x3b845a=process[_0x1ab18e(0x7f)][_0x1ab18e(0x92)];if(_0x3903e0[_0x1ab18e(0xc2)](!_0x3755d2,!_0x3b845a))return;if(!_0x3903e0[_0x1ab18e(0xef)](isInteractive))return;const {save:_0x4a973e}=await _0xa77b1d[_0x1ab18e(0x75)]([{'type':'confirm','name':'save','message':_0x3903e0[_0x1ab18e(0xf7)],'default':![]}]);if(!_0x4a973e)return;await apiRequest('/api/v1/profiles/'+_0x3903e0[_0x1ab18e(0x109)](encodeURIComponent,_0xaa74d8),{'method':_0x3903e0[_0x1ab18e(0x112)],'body':JSON['stringify']({'username':_0x3755d2,'password':_0x3b845a})}),console[_0x1ab18e(0x128)](_0x3903e0['CyRLA']);}export async function resolveCloudProfileSession(_0x3df886,_0x26793e={}){const _0x40580e=_0x5e39,_0x4c1894={'ZXOem':function(_0x41f399,_0x5276b3){return _0x41f399===_0x5276b3;},'hiAjp':function(_0x448619,_0x50047e){return _0x448619===_0x50047e;},'xmlqA':_0x40580e(0x89),'PWmVz':function(_0x2c4ef8,_0x1f5475){return _0x2c4ef8(_0x1f5475);},'aiZZZ':function(_0x952a8a,_0x1b93b0){return _0x952a8a>_0x1b93b0;},'NzsmI':function(_0x4cc080,_0x47ef86){return _0x4cc080(_0x47ef86);},'NyqWR':function(_0x225bc4,_0x136355,_0xc14ea,_0x556eb6,_0x450ef2,_0x18ef10){return _0x225bc4(_0x136355,_0xc14ea,_0x556eb6,_0x450ef2,_0x18ef10);},'tnknl':function(_0x12d5fd,_0x7cdb76,_0x10914d){return _0x12d5fd(_0x7cdb76,_0x10914d);},'ltzwh':function(_0x3a84f5,_0x37b450,_0x23998c,_0x57a29e,_0x5bca8e){return _0x3a84f5(_0x37b450,_0x23998c,_0x57a29e,_0x5bca8e);},'IhnUR':function(_0x87679e,_0x502899){return _0x87679e(_0x502899);},'CzVqK':function(_0x28bfb4,_0x290afd){return _0x28bfb4(_0x290afd);},'TXLbU':function(_0x389ed8,_0x5f43ee){return _0x389ed8||_0x5f43ee;},'YZoFq':function(_0x96ece0,_0x5d8f8e,_0x2bd052){return _0x96ece0(_0x5d8f8e,_0x2bd052);},'doFSU':_0x40580e(0xb3),'yMdSn':function(_0xc3b873,_0x11fa60,_0x3e8d06,_0x534693,_0x373e6a,_0x279d34,_0x27fdc7,_0x26253d){return _0xc3b873(_0x11fa60,_0x3e8d06,_0x534693,_0x373e6a,_0x279d34,_0x27fdc7,_0x26253d);},'hVVIl':function(_0x5a43bd,_0x3c6845){return _0x5a43bd(_0x3c6845);},'wkeal':'\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','ECIHZ':function(_0x345f6e,_0x3e7cb6){return _0x345f6e instanceof _0x3e7cb6;},'QZiwC':function(_0x5ed72a,_0x310c87,_0x392e07,_0x4d4fcb,_0x527be0,_0x36c8d5,_0x5d4149,_0x122e9c){return _0x5ed72a(_0x310c87,_0x392e07,_0x4d4fcb,_0x527be0,_0x36c8d5,_0x5d4149,_0x122e9c);}},_0x30f654=_0x3df886['settings']??{},_0x3463f8=await fetchAuthConfig(),_0x446466=_0x3463f8?resolveAuthEnvironmentLocally(_0x3463f8,_0x3df886[_0x40580e(0x9a)]):null,_0x10aa12=_0x4c1894[_0x40580e(0xc6)](typeof _0x446466?.[_0x40580e(0x8e)],_0x40580e(0x89))&&_0x446466[_0x40580e(0x8e)]['trim']()?_0x446466['loginInstructions']:undefined,_0x30be97=_0x4c1894[_0x40580e(0xad)](typeof _0x30f654['loginInstructions'],_0x4c1894['xmlqA'])&&_0x30f654['loginInstructions']['trim']()?_0x30f654[_0x40580e(0x8e)]:undefined,_0x5dac30=_0x30be97||!_0x10aa12?_0x30f654:{..._0x30f654,'loginInstructions':_0x10aa12},_0x4a7524=_0x4c1894[_0x40580e(0xc9)](Boolean,_0x5dac30['loginInstructions']?.['trim']()),_0x21c704=Boolean(_0x30f654['forceLogin']||_0x446466?.[_0x40580e(0x7d)]),_0x3dfa73=_0x446466?.['domains'],_0x18b2b8=_0x30f654['setupHeaders'],_0x2ff870=_0x18b2b8??_0x446466?.['setupHeaders'],_0x48e1dd=_0x26793e[_0x40580e(0xff)]??_0x30f654[_0x40580e(0xa6)]??(_0x3dfa73&&_0x4c1894[_0x40580e(0x90)](_0x3dfa73[_0x40580e(0xf8)],0x0)?_0x3dfa73[0x0]:''),_0x595e70=_0x48e1dd?_0x4c1894[_0x40580e(0xc7)](needsTunnel,_0x48e1dd):![],_0x40251d={'invalidateOn':_0x446466?.['invalidateOn'],'userAgent':_0x446466?.[_0x40580e(0x8d)]?.['userAgent']??_0x30f654['userAgent']};_0x21c704&&console[_0x40580e(0x128)](_0x40580e(0x9e)+_0x3df886['name']+_0x40580e(0x81));if(!_0x21c704){const _0x1fd21e=await _0x4c1894[_0x40580e(0x9f)](checkLocalCache,_0x3df886['name'],_0x3df886[_0x40580e(0xc8)],_0x48e1dd,_0x2ff870,_0x40251d);if(_0x1fd21e){if(_0x48e1dd&&!_0x595e70){const _0x434ae4=await isCachedSessionLive(_0x1fd21e[_0x40580e(0xe3)],_0x48e1dd,{'sessionCheckPath':_0x446466?.[_0x40580e(0xe2)],'setupHeaders':_0x2ff870},{'launchBrowser':launchRealBrowser});if(_0x434ae4)return console[_0x40580e(0x128)]('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x3df886[_0x40580e(0xae)]+'\x22'),{'authPath':_0x1fd21e[_0x40580e(0xe3)],'settings':_0x5dac30,'resolvedEnv':_0x446466};console[_0x40580e(0x128)]('\x20\x20Cached\x20session\x20for\x20\x22'+_0x3df886['name']+_0x40580e(0xab)),_0x4c1894[_0x40580e(0xb4)](emitSessionValidationHint,_0x48e1dd,_0x446466);}else return _0x595e70&&console['log'](_0x40580e(0xe8)+_0x3df886['name']+'\x22'),{'authPath':_0x1fd21e[_0x40580e(0xe3)],'settings':_0x5dac30,'resolvedEnv':_0x446466};}}if(!_0x21c704&&_0x3df886[_0x40580e(0xbc)]){if(_0x595e70)console['log']('\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22'+_0x48e1dd+'\x22\x20on\x20profile\x20\x22'+_0x3df886[_0x40580e(0xae)]+'\x22');else{const _0xfacf0f=await writeSessionToLocalCache(_0x3df886['name'],_0x3df886['organizationId'],_0x48e1dd,_0x2ff870,_0x3df886['sessionState'],_0x3dfa73,_0x40251d);if(_0x48e1dd){const _0x1e8c70=await _0x4c1894[_0x40580e(0x12d)](isCachedSessionLive,_0xfacf0f,_0x48e1dd,{'sessionCheckPath':_0x446466?.['sessionCheckPath'],'setupHeaders':_0x2ff870},{'launchBrowser':launchRealBrowser});if(_0x1e8c70)return console[_0x40580e(0x128)](_0x40580e(0xd5)+_0x3df886['name']+'\x22,\x20cached\x20locally'),{'authPath':_0xfacf0f,'settings':_0x5dac30,'resolvedEnv':_0x446466};console['log'](_0x40580e(0xfe)+_0x3df886[_0x40580e(0xae)]+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),emitSessionValidationHint(_0x48e1dd,_0x446466);}else return{'authPath':_0xfacf0f,'settings':_0x5dac30,'resolvedEnv':_0x446466};}}if(_0x4a7524)return console[_0x40580e(0x128)](_0x40580e(0x9d)+_0x3df886[_0x40580e(0xae)]+_0x40580e(0xa2)),{'authPath':undefined,'settings':_0x5dac30,'resolvedEnv':_0x446466};console['log']('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x3df886[_0x40580e(0xae)]+'\x22,\x20attempting\x20login...');const _0x3c5ffa=Boolean(process['env'][_0x40580e(0xdf)])&&_0x4c1894['IhnUR'](Boolean,process['env']['RANGER_TEST_PASSWORD']),_0x5cfeb8=_0x4c1894[_0x40580e(0x11f)](Boolean,_0x3df886['username']);if(_0x4c1894['TXLbU'](_0x3c5ffa,_0x5cfeb8))try{const _0x20d374=_0x48e1dd?await serverSideLoginWithOptionalTunnel(_0x3df886[_0x40580e(0xae)],_0x48e1dd,{'force':_0x21c704,'telemetry':_0x26793e['telemetry']}):await _0x4c1894[_0x40580e(0x108)](serverSideLogin,_0x3df886[_0x40580e(0xae)],{'force':_0x21c704});if(_0x20d374[_0x40580e(0xb5)]===_0x40580e(0xed))console[_0x40580e(0x128)]('\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...');else{if(_0x20d374[_0x40580e(0xb5)]===_0x4c1894[_0x40580e(0x116)]&&_0x20d374[_0x40580e(0x127)]){console['log']('\x20\x20Login\x20successful.\x20Session\x20cached.');const _0x298855=await _0x4c1894[_0x40580e(0x122)](writeSessionToLocalCache,_0x3df886['name'],_0x3df886['organizationId'],_0x48e1dd,_0x2ff870,_0x20d374['session_state'],_0x3dfa73,_0x40251d);return _0x3c5ffa&&!_0x5cfeb8&&await _0x4c1894[_0x40580e(0x10e)](promptSaveCredentials,_0x3df886[_0x40580e(0xae)]),{'authPath':_0x298855,'settings':_0x5dac30,'resolvedEnv':_0x446466};}else _0x20d374[_0x40580e(0x7b)]&&(console[_0x40580e(0x128)](_0x40580e(0xc1)),console[_0x40580e(0x128)](_0x20d374['test_output'])),console[_0x40580e(0x128)](_0x4c1894['wkeal']);}}catch(_0x57b130){console['log'](_0x40580e(0xdd)+(_0x4c1894['ECIHZ'](_0x57b130,Error)?_0x57b130['message']:_0x4c1894[_0x40580e(0x11f)](String,_0x57b130))),console[_0x40580e(0x128)](_0x4c1894['wkeal']);}const _0x3c0a9c=_0x446466?{..._0x446466,'setupHeaders':_0x2ff870}:_0x48e1dd?{'key':_0x3df886[_0x40580e(0x9a)]??'','domains':[_0x48e1dd],'setupHeaders':_0x2ff870}:null,{sessionState:_0x5504f1}=await manualBrowserLogin(_0x3df886,_0x3c0a9c,{'persistSessionState':!_0x595e70}),_0x475cb3=await _0x4c1894['QZiwC'](writeSessionToLocalCache,_0x3df886[_0x40580e(0xae)],_0x3df886[_0x40580e(0xc8)],_0x48e1dd,_0x2ff870,_0x5504f1,_0x3dfa73,_0x40251d);return{'authPath':_0x475cb3,'settings':_0x5dac30,'resolvedEnv':_0x446466};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x1ba78f=_0x3f96;function _0x2afd(){const _0x39ab2b=['baseUrl','toString','sort','980320OtkGHt','auth','908436DchRPP','231lSGWCS','29138PhzrdG','clientIp','5078528NxRWhQ','isTTY','stdin','map','hex','localhost.','ppygE','setupHeaders','ZkWOY','has','userAgent','15776784VkiHgg','cuwnb','status','3113646yxtpSp','295687PjXRdV','launchBrowser','sha256','add','push','5tlXhDb','RqVEb','includes','update','stringify','newContext','IloZe','defaultEnvironmentKey','test','port','effectiveBaseUrl','goto','hostname','environments','.json'];_0x2afd=function(){return _0x39ab2b;};return _0x2afd();}(function(_0x2012c0,_0x57afb8){const _0x1623e4=_0x3f96,_0x269b3e=_0x2012c0();while(!![]){try{const _0x2d08a1=parseInt(_0x1623e4(0x9c))/0x1+parseInt(_0x1623e4(0x9e))/0x2*(parseInt(_0x1623e4(0x9d))/0x3)+parseInt(_0x1623e4(0xa0))/0x4+-parseInt(_0x1623e4(0xb4))/0x5*(parseInt(_0x1623e4(0xae))/0x6)+parseInt(_0x1623e4(0xaf))/0x7+-parseInt(_0x1623e4(0x9a))/0x8+-parseInt(_0x1623e4(0xab))/0x9;if(_0x2d08a1===_0x57afb8)break;else _0x269b3e['push'](_0x269b3e['shift']());}catch(_0xc4112d){_0x269b3e['push'](_0x269b3e['shift']());}}}(_0x2afd,0xe75d1));import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x11ef93=process['env'],_0x44c6f8={'stdin':process[_0x1ba78f(0xa2)],'stdout':process['stdout']}){const _0x4e1ff6=_0x1ba78f,_0x532819={'oKiGG':function(_0x1fc39e,_0x39c70c){return _0x1fc39e(_0x39c70c);}};if(_0x11ef93['CI'])return![];return Boolean(_0x44c6f8['stdin'][_0x4e1ff6(0xa1)])&&_0x532819['oKiGG'](Boolean,_0x44c6f8['stdout'][_0x4e1ff6(0xa1)]);}export const DEFAULT_INVALIDATE_ON=[];function _0x3f96(_0x2b3d8e,_0x40a5b1){_0x2b3d8e=_0x2b3d8e-0x90;const _0x2afde7=_0x2afd();let _0x3f96c2=_0x2afde7[_0x2b3d8e];return _0x3f96c2;}export function sessionCacheHash(_0x1cb04e){const _0x3e0471=_0x1ba78f,_0x5f151d={'ZkWOY':_0x3e0471(0x97),'PPmEW':function(_0x5d4bff,_0x5093fd){return _0x5d4bff(_0x5093fd);},'draSw':_0x3e0471(0xaa),'ppygE':function(_0x219ab8,_0x20486d){return _0x219ab8!==_0x20486d;}},_0x1c3655=new Set(_0x1cb04e['invalidateOn']??DEFAULT_INVALIDATE_ON);_0x1cb04e['effectiveBaseUrl']&&needsTunnel(_0x1cb04e['effectiveBaseUrl'])&&_0x1c3655[_0x3e0471(0xb2)](_0x5f151d['ZkWOY']);const _0x517ee8={'orgId':_0x1cb04e['orgId'],'profileName':_0x1cb04e['profileName']};return _0x1c3655['has'](_0x5f151d[_0x3e0471(0xa8)])&&(_0x517ee8['effectiveBaseUrl']=_0x1cb04e[_0x3e0471(0x92)]),_0x1c3655['has'](_0x3e0471(0xa7))&&(_0x517ee8[_0x3e0471(0xa7)]=_0x1cb04e['setupHeaders']?_0x5f151d['PPmEW'](sortObjectKeys,_0x1cb04e[_0x3e0471(0xa7)]):_0x1cb04e[_0x3e0471(0xa7)]),_0x1c3655['has'](_0x3e0471(0x91))&&(_0x517ee8['port']=extractPort(_0x1cb04e[_0x3e0471(0x92)])),_0x1c3655['has'](_0x5f151d['draSw'])&&_0x1cb04e[_0x3e0471(0xaa)]!==undefined&&(_0x517ee8[_0x3e0471(0xaa)]=_0x1cb04e['userAgent']),_0x1c3655['has']('clientIp')&&_0x5f151d[_0x3e0471(0xa6)](_0x1cb04e['clientIp'],undefined)&&(_0x517ee8['clientIp']=_0x1cb04e[_0x3e0471(0x9f)]),createHash(_0x3e0471(0xb1))[_0x3e0471(0xb7)](JSON[_0x3e0471(0xb8)](_0x517ee8))['digest'](_0x3e0471(0xa4))['slice'](0x0,0xc);}function extractPort(_0x18328e){try{return new URL(_0x18328e)['port'];}catch{return'';}}function sortObjectKeys(_0x20eaeb){const _0x1e7c39=_0x1ba78f,_0x38e382={};for(const _0x4fc8f2 of Object['keys'](_0x20eaeb)[_0x1e7c39(0x99)]()){_0x38e382[_0x4fc8f2]=_0x20eaeb[_0x4fc8f2];}return _0x38e382;}export function getSessionCachePath(_0x1bd122,_0x3c7c3c){const _0x44b0aa=_0x1ba78f;return join(getRangerHomeDir(),_0x44b0aa(0x9b),_0x1bd122+'-'+_0x3c7c3c+_0x44b0aa(0x96));}export function getStorageStatePath(_0x2d370f){return _0x2d370f['replace'](/\.json$/,'.storageState.json');}export function needsTunnel(_0x2ec48f){const _0x38b9ca=_0x1ba78f,_0x1822bc={'eBIPI':'localhost','RqVEb':function(_0x12bfa4,_0xf982fa){return _0x12bfa4===_0xf982fa;},'IloZe':_0x38b9ca(0xa5)};let _0x10e6fc;try{_0x10e6fc=new URL(_0x2ec48f)['hostname'];}catch{return![];}if(_0x10e6fc===_0x1822bc['eBIPI']||_0x1822bc[_0x38b9ca(0xb5)](_0x10e6fc,'127.0.0.1'))return!![];if(_0x10e6fc['endsWith']('.localhost'))return!![];if(_0x10e6fc[_0x38b9ca(0xb6)](_0x1822bc[_0x38b9ca(0xba)]))return!![];return![];}export function hostnameOf(_0x1846cd){const _0x5e258c=_0x1ba78f;return new URL(_0x1846cd)[_0x5e258c(0x94)];}export function duplicateCookiesForDomains(_0x253ec7,_0xe16298){const _0x311626=_0x1ba78f,_0x30ad36={'sMtZP':function(_0x519771,_0x3dd45a){return _0x519771(_0x3dd45a);}},_0x534476=[..._0x253ec7],_0x3d73fc=new Set(_0x253ec7[_0x311626(0xa3)](_0x3b6227=>_0x3b6227['domain']));for(const _0x131bfa of _0xe16298){let _0x1f9572;try{_0x1f9572=_0x30ad36['sMtZP'](hostnameOf,_0x131bfa);}catch{continue;}if(!_0x1f9572)continue;const _0x5b6343=_0x1f9572['startsWith']('.')?_0x1f9572:'.'+_0x1f9572;if(_0x3d73fc[_0x311626(0xa9)](_0x1f9572)||_0x3d73fc[_0x311626(0xa9)](_0x5b6343))continue;for(const _0x3baed2 of _0x253ec7){_0x534476[_0x311626(0xb3)]({..._0x3baed2,'domain':_0x5b6343});}_0x3d73fc['add'](_0x5b6343);}return _0x534476;}export function resolveAuthEnvironmentLocally(_0x4ff9cb,_0x3dbc59){const _0x2e28d8=_0x1ba78f,_0x187e40=_0x4ff9cb[_0x2e28d8(0x95)];if(_0x3dbc59){const _0xb78e10=_0x187e40[_0x3dbc59];if(!_0xb78e10)return null;return{'key':_0x3dbc59,..._0xb78e10};}if(_0x4ff9cb[_0x2e28d8(0xbb)]){const _0x52fdd0=_0x187e40[_0x4ff9cb['defaultEnvironmentKey']];if(!_0x52fdd0)return null;return{'key':_0x4ff9cb['defaultEnvironmentKey'],..._0x52fdd0};}const _0x3d8dd1=Object['keys'](_0x187e40);if(_0x3d8dd1['length']===0x1){const _0x268582=_0x3d8dd1[0x0];return{'key':_0x268582,..._0x187e40[_0x268582]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x5a5d94,_0x2d843b){const _0x105527=_0x1ba78f;try{if(_0x2d843b)return new URL(_0x2d843b,_0x5a5d94)[_0x105527(0x98)]();return new URL(_0x5a5d94)[_0x105527(0x98)]();}catch{return null;}}export function looksLikeLoginUrl(_0x31892d){const _0x27ef85=_0x1ba78f;try{const _0x390d92=new URL(_0x31892d);return LOGIN_URL_PATTERN['test'](_0x390d92['pathname']);}catch{return LOGIN_URL_PATTERN[_0x27ef85(0x90)](_0x31892d);}}export async function isCachedSessionLive(_0x5d7a5d,_0x39221e,_0x42736e={},_0x340402={}){const _0x277d5b=_0x1ba78f,_0x4d4319={'VRCMs':function(_0x107786,_0x3fa750,_0x1fd106){return _0x107786(_0x3fa750,_0x1fd106);},'cuwnb':function(_0x5c9698,_0x30e2b8){return _0x5c9698===_0x30e2b8;},'PHKfg':function(_0x11f502,_0x3647f9){return _0x11f502(_0x3647f9);}},_0x565127=_0x4d4319['VRCMs'](buildSessionCheckUrl,_0x39221e,_0x42736e['sessionCheckPath']);if(!_0x565127)return!![];if(!_0x340402[_0x277d5b(0xb0)])return!![];let _0x29c20e=null;try{_0x29c20e=await _0x340402['launchBrowser']();const _0x2d5eb3=await _0x29c20e[_0x277d5b(0xb9)]({'storageState':_0x5d7a5d,'ignoreHTTPSErrors':!![],..._0x42736e[_0x277d5b(0xa7)]?{'extraHTTPHeaders':_0x42736e[_0x277d5b(0xa7)]}:{}}),_0x16eb02=await _0x2d5eb3['newPage'](),_0x168fca=await _0x16eb02[_0x277d5b(0x93)](_0x565127,{'waitUntil':'domcontentloaded','timeout':0x3a98}),_0x5d49ac=_0x168fca?.[_0x277d5b(0xad)]();if(_0x5d49ac===0x191||_0x4d4319[_0x277d5b(0xac)](_0x5d49ac,0x193))return![];const _0x542d5d=_0x16eb02['url']();if(_0x4d4319['PHKfg'](looksLikeLoginUrl,_0x542d5d))return![];return!![];}catch{return![];}finally{if(_0x29c20e)await _0x29c20e['close']()['catch'](()=>{});}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function _0x113b(){const _0xcb7a53=['ESvyX','Vikpc','5128720MxXtoE','2234wscwMQ','update','10159425rYzPrb','utf8','PIiCv','3934560gMkzBT','573XklJqc','concat','15OQeaAy','3717483zCDSNe','txxUP','3148950ONWzeW','HdTEa','3902346GipOBe'];_0x113b=function(){return _0xcb7a53;};return _0x113b();}(function(_0x3ef39b,_0x284054){const _0x1aa028=_0x5073,_0x3d106e=_0x3ef39b();while(!![]){try{const _0x405d54=-parseInt(_0x1aa028(0x106))/0x1*(-parseInt(_0x1aa028(0x111))/0x2)+-parseInt(_0x1aa028(0x10d))/0x3+-parseInt(_0x1aa028(0x105))/0x4+-parseInt(_0x1aa028(0x108))/0x5*(-parseInt(_0x1aa028(0x10b))/0x6)+parseInt(_0x1aa028(0x109))/0x7+-parseInt(_0x1aa028(0x110))/0x8+parseInt(_0x1aa028(0x113))/0x9;if(_0x405d54===_0x284054)break;else _0x3d106e['push'](_0x3d106e['shift']());}catch(_0x42349e){_0x3d106e['push'](_0x3d106e['shift']());}}}(_0x113b,0xe7aa2));import{createCipheriv,createDecipheriv,randomBytes,pbkdf2Sync}from'crypto';const ALGORITHM='aes-256-gcm',SALT='ranger-auth-encryption',KEY_LENGTH=0x20,IV_LENGTH=0x10,TAG_LENGTH=0x10;export function deriveKey(_0x2e736a){const _0x1f75e0=_0x5073,_0x43e7db={'wGDtb':function(_0x3e9a71,_0x58737d,_0xa760f9,_0x2065a0,_0x3c1ad3,_0x1caba3){return _0x3e9a71(_0x58737d,_0xa760f9,_0x2065a0,_0x3c1ad3,_0x1caba3);},'PIiCv':'sha256'};return _0x43e7db['wGDtb'](pbkdf2Sync,_0x2e736a,SALT,0x186a0,KEY_LENGTH,_0x43e7db[_0x1f75e0(0x104)]);}export function encrypt(_0x48e2c9,_0x274711){const _0x59874a=_0x5073,_0x5d8380={'ESvyX':_0x59874a(0x103)},_0x46221e=deriveKey(_0x274711),_0x28cc86=randomBytes(IV_LENGTH),_0x346628=createCipheriv(ALGORITHM,_0x46221e,_0x28cc86),_0x32bfa3=Buffer['concat']([_0x346628[_0x59874a(0x112)](_0x48e2c9,_0x5d8380[_0x59874a(0x10e)]),_0x346628['final']()]),_0xfb313b=_0x346628['getAuthTag']();return Buffer[_0x59874a(0x107)]([_0x28cc86,_0xfb313b,_0x32bfa3]);}function _0x5073(_0x27c9db,_0x481d1f){_0x27c9db=_0x27c9db-0x103;const _0x113b79=_0x113b();let _0x5073e3=_0x113b79[_0x27c9db];return _0x5073e3;}export function decrypt(_0x17705f,_0x11e21b){const _0x4aa734=_0x5073,_0x1829c1={'txxUP':function(_0x27defd,_0x1c6051){return _0x27defd+_0x1c6051;},'DaCdy':function(_0x14c2f7,_0x40fcf6,_0x1695f3,_0x1abbee){return _0x14c2f7(_0x40fcf6,_0x1695f3,_0x1abbee);},'HdTEa':function(_0x206e51,_0xcd89ec){return _0x206e51+_0xcd89ec;},'Vikpc':_0x4aa734(0x103)},_0x5efb54=deriveKey(_0x11e21b),_0x4db737=_0x17705f['subarray'](0x0,IV_LENGTH),_0x12fa8f=_0x17705f['subarray'](IV_LENGTH,IV_LENGTH+TAG_LENGTH),_0x3e2df1=_0x17705f['subarray'](_0x1829c1[_0x4aa734(0x10a)](IV_LENGTH,TAG_LENGTH)),_0x5dd0a7=_0x1829c1['DaCdy'](createDecipheriv,ALGORITHM,_0x5efb54,_0x4db737);return _0x5dd0a7['setAuthTag'](_0x12fa8f),_0x1829c1[_0x4aa734(0x10c)](_0x5dd0a7['update'](_0x3e2df1),_0x5dd0a7['final'](_0x1829c1[_0x4aa734(0x10f)]));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function _0x3600(){const _0x6e4462=['--api-key','617798bVxhfU','--key','slice','startsWith','Authorization','=[REDACTED]','100NJIxhZ','Not\x20enough\x20non-option\x20arguments','3254872EjoKAi','--apikey','length','includes','--pass','toLowerCase','--credentials','--secret','Unknown\x20argument','env','no_token','--cookie','947295qocPcQ','has','some','6387821LQQPTf','198neXdGB','[desire-path]\x20Sending\x20log\x20to\x20','220445XyUWCo','catch','--token','errorType','2374395jgvoTo','stringify','rqBcW','push','join','UjwzD','--authorization','coGSR','5rzSXFl','--password','error','YVglO','2152oxqgAA','rawCommand','[REDACTED]','ggHdO','indexOf','/api/v1/mcp/desire-path-logs','41111QKpsjY','Bearer\x20','test','aSjfM','dsDHT','DEBUG','invalid_option_value'];_0x3600=function(){return _0x6e4462;};return _0x3600();}const _0x1f2469=_0x4f5f;(function(_0x1082f9,_0x53e2ac){const _0x1226c9=_0x4f5f,_0x144e28=_0x1082f9();while(!![]){try{const _0x525b93=-parseInt(_0x1226c9(0xbe))/0x1*(-parseInt(_0x1226c9(0xd0))/0x2)+parseInt(_0x1226c9(0xb6))/0x3+-parseInt(_0x1226c9(0xa0))/0x4+-parseInt(_0x1226c9(0xb2))/0x5*(-parseInt(_0x1226c9(0xb0))/0x6)+-parseInt(_0x1226c9(0xc8))/0x7*(parseInt(_0x1226c9(0xc2))/0x8)+-parseInt(_0x1226c9(0xac))/0x9*(parseInt(_0x1226c9(0x9e))/0xa)+parseInt(_0x1226c9(0xaf))/0xb;if(_0x525b93===_0x53e2ac)break;else _0x144e28['push'](_0x144e28['shift']());}catch(_0x4a83c0){_0x144e28['push'](_0x144e28['shift']());}}}(_0x3600,0xe1f3f));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{getCurrentVersion}from'./version.js';function _0x4f5f(_0x3bc33c,_0xe14d6e){_0x3bc33c=_0x3bc33c-0x9e;const _0x360052=_0x3600();let _0x4f5fd1=_0x360052[_0x3bc33c];return _0x4f5fd1;}const SENSITIVE_FLAGS=new Set([_0x1f2469(0xb4),'-t',_0x1f2469(0xa7),_0x1f2469(0xcf),_0x1f2469(0xa1),_0x1f2469(0xd1),_0x1f2469(0xbf),_0x1f2469(0xa4),'--auth',_0x1f2469(0xbc),'--header',_0x1f2469(0xab),_0x1f2469(0xa6)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function looksLikeToken(_0x4afa40){const _0x123bfb=_0x1f2469;return TOKEN_PATTERNS[_0x123bfb(0xae)](_0x5a7d61=>_0x5a7d61[_0x123bfb(0xca)](_0x4afa40));}export function sanitizeArgs(_0x545641){const _0x362d3d=_0x1f2469,_0x3ed0d3={'UjwzD':_0x362d3d(0xc4),'YDYth':function(_0x550c43,_0x5acb63){return _0x550c43!==_0x5acb63;},'dsDHT':function(_0x556052,_0x354919){return _0x556052(_0x354919);}},_0x1453ec=[];let _0x5744dd=![];for(let _0x2b4ca7=0x0;_0x2b4ca7<_0x545641[_0x362d3d(0xa2)];_0x2b4ca7++){const _0xe72429=_0x545641[_0x2b4ca7];if(_0x5744dd){_0x1453ec['push'](_0x3ed0d3[_0x362d3d(0xbb)]),_0x5744dd=![];continue;}if(_0xe72429[_0x362d3d(0xd3)]('--')||_0xe72429[_0x362d3d(0xd3)]('-')){const _0x38eb8a=_0xe72429[_0x362d3d(0xc6)]('=');if(_0x3ed0d3['YDYth'](_0x38eb8a,-0x1)){const _0x279238=_0xe72429[_0x362d3d(0xd2)](0x0,_0x38eb8a)[_0x362d3d(0xa5)]();if(SENSITIVE_FLAGS[_0x362d3d(0xad)](_0x279238)){_0x1453ec['push'](_0xe72429['slice'](0x0,_0x38eb8a)+_0x362d3d(0xd5));continue;}}else{const _0xbe056a=_0xe72429[_0x362d3d(0xa5)]();SENSITIVE_FLAGS[_0x362d3d(0xad)](_0xbe056a)&&(_0x5744dd=!![]);}_0x1453ec['push'](_0xe72429);}else _0x3ed0d3[_0x362d3d(0xcc)](looksLikeToken,_0xe72429)?_0x1453ec['push'](_0x362d3d(0xc4)):_0x1453ec[_0x362d3d(0xb9)](_0xe72429);}return _0x1453ec[_0x362d3d(0xba)]('\x20');}export async function logDesirePath(_0x5e182d){const _0x5cb073=_0x1f2469,_0x1cbde6={'rqBcW':function(_0x104edb){return _0x104edb();},'ormuI':function(_0x175730){return _0x175730();},'ggHdO':'application/json','coGSR':function(_0x458c86,_0x4f800b,_0x3f9fcd){return _0x458c86(_0x4f800b,_0x3f9fcd);}};try{const _0x226b19=await _0x1cbde6[_0x5cb073(0xb8)](getToken)[_0x5cb073(0xb3)](()=>null),_0xe79070=_0x1cbde6['ormuI'](getApiBaseUrl),_0x3aa833=_0x1cbde6['rqBcW'](getCurrentVersion),_0x19758b=_0x226b19?'has_token':_0x5cb073(0xaa),_0xc796db={..._0x5e182d['metadata'],'authStatus':_0x19758b,'isTty':process['stdout']['isTTY']??![]},_0x230922={'Content-Type':_0x1cbde6[_0x5cb073(0xc5)]};_0x226b19&&(_0x230922[_0x5cb073(0xd4)]=_0x5cb073(0xc9)+_0x226b19);const _0x5d10c2={'rawCommand':_0x5e182d[_0x5cb073(0xc3)],'errorMessage':_0x5e182d['errorMessage'],'errorType':_0x5e182d[_0x5cb073(0xb5)],'featureId':_0x5e182d['featureId'],'sessionId':_0x5e182d['sessionId'],'metadata':_0xc796db,'cliVersion':_0x3aa833};process[_0x5cb073(0xa9)][_0x5cb073(0xcd)]&&(console[_0x5cb073(0xc0)](_0x5cb073(0xb1)+_0xe79070+_0x5cb073(0xc7)),console['error']('[desire-path]\x20Payload:\x20'+JSON[_0x5cb073(0xb7)](_0x5d10c2,null,0x2))),await _0x1cbde6[_0x5cb073(0xbd)](fetch,_0xe79070+'/api/v1/mcp/desire-path-logs',{'method':'POST','headers':_0x230922,'body':JSON[_0x5cb073(0xb7)](_0x5d10c2)});}catch(_0xb90d8b){process['env'][_0x5cb073(0xcd)]&&console['error']('[desire-path]\x20Failed\x20to\x20send:\x20'+_0xb90d8b);}}export function getErrorType(_0x355041,_0xf632ae){const _0x227cb8=_0x1f2469,_0x343c42={'aSjfM':'unknown','DJmKm':'Unknown\x20command','JTXod':'unknown_argument','YVglO':'missing_option','GlytW':'syntax_error'};if(_0xf632ae)return'runtime_error';if(!_0x355041)return _0x343c42[_0x227cb8(0xcb)];if(_0x355041[_0x227cb8(0xa3)](_0x343c42['DJmKm']))return'unknown_command';if(_0x355041['includes'](_0x227cb8(0xa8)))return _0x343c42['JTXod'];if(_0x355041['includes'](_0x227cb8(0x9f)))return'missing_required_argument';if(_0x355041['includes']('Invalid\x20values'))return _0x227cb8(0xce);if(_0x355041['includes']('Missing\x20required\x20argument'))return _0x343c42[_0x227cb8(0xc1)];return _0x343c42['GlytW'];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x31c3b4=_0x126c;function _0x126c(_0x18bbdd,_0x4024ac){_0x18bbdd=_0x18bbdd-0x72;const _0xe0071b=_0xe007();let _0x126c96=_0xe0071b[_0x18bbdd];return _0x126c96;}(function(_0x1d14b1,_0x210f83){const _0x4994e6=_0x126c,_0x510628=_0x1d14b1();while(!![]){try{const _0x38b275=parseInt(_0x4994e6(0x7d))/0x1*(parseInt(_0x4994e6(0xc9))/0x2)+-parseInt(_0x4994e6(0xcd))/0x3*(-parseInt(_0x4994e6(0xb3))/0x4)+-parseInt(_0x4994e6(0x90))/0x5*(parseInt(_0x4994e6(0x9a))/0x6)+-parseInt(_0x4994e6(0x97))/0x7+-parseInt(_0x4994e6(0x72))/0x8*(parseInt(_0x4994e6(0xa4))/0x9)+-parseInt(_0x4994e6(0x91))/0xa*(parseInt(_0x4994e6(0xad))/0xb)+parseInt(_0x4994e6(0xb2))/0xc*(parseInt(_0x4994e6(0x82))/0xd);if(_0x38b275===_0x210f83)break;else _0x510628['push'](_0x510628['shift']());}catch(_0x56f926){_0x510628['push'](_0x510628['shift']());}}}(_0xe007,0xd5815));import{spawn}from'child_process';import _0x1476e1 from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL=_0x31c3b4(0xbc),WORKOS_TOKEN_URL='https://api.workos.com/user_management/authenticate';export async function requestDeviceCode(_0x4fe99b){const _0x2a8501=_0x31c3b4,_0x19907d={'HGGBq':'POST','FeKLF':'application/x-www-form-urlencoded'},_0x15ec97=await fetch(WORKOS_DEVICE_AUTH_URL,{'method':_0x19907d[_0x2a8501(0xc0)],'headers':{'Content-Type':_0x19907d['FeKLF']},'body':new URLSearchParams({'client_id':_0x4fe99b})});if(!_0x15ec97['ok']){const _0x3600d8=await _0x15ec97['text']();throw new Error('Failed\x20to\x20request\x20device\x20code:\x20'+_0x15ec97['status']+'\x20'+_0x3600d8);}return _0x15ec97[_0x2a8501(0xbd)]();}export async function pollForTokens(_0x19dc41,_0x503354,_0x5749ad,_0x18c1f3){const _0x42422c=_0x31c3b4,_0x55c44f={'prvHW':function(_0x450563,_0x135f4a){return _0x450563*_0x135f4a;},'eoXiE':function(_0xef2f13,_0x35cacc){return _0xef2f13*_0x35cacc;},'VQCKr':function(_0xff571c,_0x3179ef){return _0xff571c<_0x3179ef;},'QTfOF':function(_0x5ca952,_0x2ecd67){return _0x5ca952(_0x2ecd67);},'agiZk':'POST','ijRDH':'application/x-www-form-urlencoded','Nohsj':function(_0xa18bbf,_0x4bc93d){return _0xa18bbf===_0x4bc93d;},'ioqxo':_0x42422c(0x8f),'bbfAa':_0x42422c(0x7c)},_0x24272b=Date['now']()+_0x55c44f[_0x42422c(0xac)](_0x18c1f3,0x3e8);let _0x363f7b=_0x55c44f['eoXiE'](_0x5749ad,0x3e8);while(_0x55c44f[_0x42422c(0x9e)](Date[_0x42422c(0xaf)](),_0x24272b)){await _0x55c44f['QTfOF'](sleep,_0x363f7b);const _0x1213cb=await fetch(WORKOS_TOKEN_URL,{'method':_0x55c44f['agiZk'],'headers':{'Content-Type':_0x55c44f[_0x42422c(0x76)]},'body':new URLSearchParams({'client_id':_0x19dc41,'device_code':_0x503354,'grant_type':_0x42422c(0xcc)})});if(_0x1213cb['ok'])return _0x1213cb['json']();const _0x26b81d=await _0x1213cb[_0x42422c(0xbd)]();if(_0x55c44f['Nohsj'](_0x26b81d[_0x42422c(0xb7)],'authorization_pending'))continue;if(_0x26b81d[_0x42422c(0xb7)]===_0x55c44f[_0x42422c(0x86)]){_0x363f7b+=0x3e8;continue;}throw new Error(_0x26b81d[_0x42422c(0x75)]||_0x26b81d[_0x42422c(0xb7)]||'Authentication\x20failed');}throw new Error(_0x55c44f[_0x42422c(0xab)]);}async function fetchUserProfile(_0x34d91f){const _0x4892e5=_0x31c3b4,_0x4eed0b={'MhLZT':function(_0x1936ce,_0x596277,_0x48c34a){return _0x1936ce(_0x596277,_0x48c34a);},'SHDDM':_0x4892e5(0xbe)},_0x3d9709=getApiBaseUrl();try{const _0x4f7cb7=await _0x4eed0b[_0x4892e5(0x9f)](fetch,_0x3d9709+_0x4892e5(0x7e),{'method':_0x4eed0b[_0x4892e5(0x89)],'headers':{'workos-token':_0x34d91f}});if(_0x4f7cb7['ok'])return _0x4f7cb7['json']();}catch{}return null;}function buildKeyName(_0x1ff155,_0x4f401c){const _0x531d50=_0x31c3b4,_0x39ad9d={'XduLD':function(_0x2c82c9,_0x3b52a3){return _0x2c82c9===_0x3b52a3;},'utBrd':function(_0x31da0c,_0x450e73){return _0x31da0c+_0x450e73;}},_0x46ad6b=_0x4f401c['filter'](_0x15ed7f=>_0x15ed7f[_0x531d50(0xcf)]===_0x1ff155||_0x15ed7f['name'][_0x531d50(0xa5)](_0x1ff155+'\x20('));if(_0x39ad9d[_0x531d50(0x83)](_0x46ad6b['length'],0x0))return _0x1ff155;return _0x1ff155+'\x20('+_0x39ad9d['utBrd'](_0x46ad6b[_0x531d50(0x77)],0x1)+')';}export async function provisionApiKey(_0x46b3b9){const _0x17f4a3=_0x31c3b4,_0x4e06f0={'aSKRr':'application/json','itvmY':function(_0x2f466d,_0x483182){return _0x2f466d(_0x483182);},'mGNUX':_0x17f4a3(0xb4),'TeMvJ':function(_0x447891,_0x51c0da,_0x549818){return _0x447891(_0x51c0da,_0x549818);},'UEuaO':'GET','owKPi':'mcp:write'},_0x27084d=getApiBaseUrl(),_0x15989e={'Content-Type':_0x4e06f0['aSKRr'],'workos-token':_0x46b3b9},_0x5cd2d1=await _0x4e06f0[_0x17f4a3(0x88)](fetchUserProfile,_0x46b3b9),_0x1dffcf=_0x5cd2d1?.[_0x17f4a3(0xa2)]||_0x5cd2d1?.[_0x17f4a3(0x8c)]?.['split']('@')[0x0],_0x3b492d=_0x1dffcf?_0x1dffcf+'\x27s\x20CLI\x20Key':_0x4e06f0['mGNUX'];let _0x4fe06f=[];try{const _0x3264e7=await _0x4e06f0[_0x17f4a3(0x99)](fetch,_0x27084d+'/api-keys',{'method':_0x4e06f0[_0x17f4a3(0x8a)],'headers':_0x15989e});if(_0x3264e7['ok']){const _0x10624a=await _0x3264e7['json']();_0x4fe06f=_0x10624a[_0x17f4a3(0xb8)];}}catch{}const _0xd4d039=buildKeyName(_0x3b492d,_0x4fe06f),_0x53ab6c=await fetch(_0x27084d+'/api-keys',{'method':'POST','headers':_0x15989e,'body':JSON['stringify']({'name':_0xd4d039,'scope':_0x4e06f0['owKPi']})});if(!_0x53ab6c['ok']){const _0x3c9484=await _0x53ab6c['text']();throw new Error('Failed\x20to\x20provision\x20API\x20key:\x20'+_0x53ab6c['status']+'\x20'+_0x3c9484);}const _0x557748=await _0x53ab6c[_0x17f4a3(0xbd)]();return _0x557748[_0x17f4a3(0xaa)]['token'];}export function openBrowser(_0x4f3ec1){const _0x3b412c=_0x31c3b4,_0x438198={'dGyne':function(_0x366a86,_0x334027){return _0x366a86===_0x334027;},'GfpXO':'win32','aZyxs':_0x3b412c(0xb5),'kdxvK':_0x3b412c(0x85),'jQeah':function(_0x314b1a,_0x183604,_0x3e4cd7,_0x2c8084){return _0x314b1a(_0x183604,_0x3e4cd7,_0x2c8084);}};try{if(_0x438198['dGyne'](process[_0x3b412c(0x7a)],_0x438198['GfpXO'])){const _0x369688=spawn(_0x3b412c(0xbb),['/c',_0x438198['aZyxs'],'',_0x4f3ec1],{'detached':!![],'stdio':_0x3b412c(0xae),'windowsHide':!![]});_0x369688['unref']();return;}const _0x37d894=process[_0x3b412c(0x7a)]===_0x438198['kdxvK']?'open':_0x3b412c(0xd1),_0x565243=_0x438198[_0x3b412c(0xa7)](spawn,_0x37d894,[_0x4f3ec1],{'detached':!![],'stdio':'ignore'});_0x565243[_0x3b412c(0xb6)]();}catch{}}function decodeJwtPayload(_0x2800f4){const _0xbeb3e4=_0x31c3b4,_0x5e2c61={'NcrFt':function(_0x58b0b9,_0x2e7f91){return _0x58b0b9!==_0x2e7f91;},'dWgIs':_0xbeb3e4(0xa3),'uwVYj':_0xbeb3e4(0x87)},_0xcab3e9=_0x2800f4['split']('.');if(_0x5e2c61[_0xbeb3e4(0x7b)](_0xcab3e9['length'],0x3))throw new Error(_0x5e2c61[_0xbeb3e4(0x92)]);const _0x383f71=Buffer['from'](_0xcab3e9[0x1],_0xbeb3e4(0xc2))[_0xbeb3e4(0xb1)](_0x5e2c61[_0xbeb3e4(0x7f)]);return JSON[_0xbeb3e4(0xc4)](_0x383f71);}async function selfServeSignup(_0x2e87d2){const _0x24b9e9=_0x31c3b4,_0x1493c7={'dlIxn':function(_0x2ce05d){return _0x2ce05d();},'mzYJO':function(_0xae772a,_0x2b012e,_0x1d9af4){return _0xae772a(_0x2b012e,_0x1d9af4);},'ZbGzQ':_0x24b9e9(0x81),'fywsJ':'application/json'},_0x13a461=_0x1493c7['dlIxn'](getApiBaseUrl),_0x2a4541=await _0x1493c7['mzYJO'](fetch,_0x13a461+_0x24b9e9(0x94),{'method':_0x1493c7['ZbGzQ'],'headers':{'Content-Type':_0x1493c7[_0x24b9e9(0xa8)],'workos-token':_0x2e87d2}});if(!_0x2a4541['ok']){const _0x174624=await _0x2a4541[_0x24b9e9(0xc8)]();throw new Error('Failed\x20to\x20create\x20organization:\x20'+_0x2a4541[_0x24b9e9(0x8b)]+'\x20'+_0x174624);}return _0x2a4541['json']();}function _0xe007(){const _0x350f40=['TeMvJ','6asOwRi','aZbeM','log','interval','VQCKr','MhLZT','Failed\x20to\x20fetch\x20memberships:\x20','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','firstName','Invalid\x20JWT\x20format','269442SKSDvy','startsWith','device_code','jQeah','fywsJ','memberships','apiKey','bbfAa','prvHW','11vSKnzq','ignore','now','access_token','toString','1457556IDGRRa','40UWUIUD','CLI\x20Key','start','unref','error','apiKeys','write','tbrim','cmd','https://api.workos.com/user_management/authorize/device','json','GET','org_id','HGGBq','Setting\x20up\x20your\x20organization...','base64url','verification_uri_complete','parse','stdout','token','expires_in','text','14892htUhHK','YtPLN','prompt','urn:ietf:params:oauth:grant-type:device_code','516606OakjTy','/organization/my-memberships','name','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','xdg-open','isTTY','jhWgL','112IszKlu','bqAng','XJtJw','error_description','ijRDH','length','Using\x20organization:\x20','Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','platform','NcrFt','Device\x20authorization\x20timed\x20out','43hhinuE','/organization/me','uwVYj','VhAZU','POST','13aoKrje','XduLD','WpWpb','darwin','ioqxo','utf-8','itvmY','SHDDM','UEuaO','status','email','Provisioning\x20CLI\x20token...','selected','slow_down','1134845ahNfks','6323890QAfRLC','dWgIs','Failed\x20to\x20provision\x20CLI\x20token:\x20','/organization/self-serve-signup','yQnCQ','refresh_token','74578wqxbwY','/cli-auth/token'];_0xe007=function(){return _0x350f40;};return _0xe007();}async function fetchMyMemberships(_0x32b2e9){const _0x2de462=_0x31c3b4,_0x377e0b={'kFTMu':function(_0x5e64f9,_0x23b4f1,_0x45fe45){return _0x5e64f9(_0x23b4f1,_0x45fe45);}},_0x4dcb0a=getApiBaseUrl(),_0x153e7a=await _0x377e0b['kFTMu'](fetch,_0x4dcb0a+_0x2de462(0xce),{'method':'GET','headers':{'workos-token':_0x32b2e9}});if(!_0x153e7a['ok']){const _0x54b2ea=await _0x153e7a['text']();throw new Error(_0x2de462(0xa0)+_0x153e7a['status']+'\x20'+_0x54b2ea);}const _0x4ca0ee=await _0x153e7a['json']();return _0x4ca0ee[_0x2de462(0xa9)];}async function refreshTokenWithOrg(_0x12e9bf,_0x354dce,_0x3193b0){const _0x4247b5=_0x31c3b4,_0x36466f={'YtPLN':'application/x-www-form-urlencoded'},_0x1c4c0f=await fetch(WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x36466f[_0x4247b5(0xca)]},'body':new URLSearchParams({'client_id':_0x12e9bf,'grant_type':'refresh_token','refresh_token':_0x354dce,'organization_id':_0x3193b0})});if(!_0x1c4c0f['ok']){const _0x9139b7=await _0x1c4c0f['text']();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x1c4c0f['status']+'\x20'+_0x9139b7);}return _0x1c4c0f[_0x4247b5(0xbd)]();}async function provisionCliToken(_0x154aba){const _0x5aaac1=_0x31c3b4,_0x310396={'WpWpb':'application/json'},_0x40e049=getApiBaseUrl(),_0x2d391f=await fetch(_0x40e049+_0x5aaac1(0x98),{'method':'POST','headers':{'Content-Type':_0x310396[_0x5aaac1(0x84)],'workos-token':_0x154aba}});if(!_0x2d391f['ok']){const _0x4a85de=await _0x2d391f[_0x5aaac1(0xc8)]();throw new Error(_0x5aaac1(0x93)+_0x2d391f[_0x5aaac1(0x8b)]+'\x20'+_0x4a85de);}return _0x2d391f[_0x5aaac1(0xbd)]();}export async function runDeviceAuthFlow(){const _0x5af263=_0x31c3b4,_0x82b9c3={'tbrim':function(_0x18032f,_0x22bb9f){return _0x18032f(_0x22bb9f);},'VhAZU':_0x5af263(0xa1),'jhWgL':_0x5af263(0xd0),'Kxwkv':function(_0x3347ad,_0x2e47d5){return _0x3347ad===_0x2e47d5;},'yQnCQ':function(_0xa121f2,_0x84ea08){return _0xa121f2(_0x84ea08);},'yaijg':_0x5af263(0x79),'bqAng':'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','aZbeM':'list','wSBFK':_0x5af263(0x8e),'XJtJw':'Select\x20an\x20organization:','PESCL':function(_0x198e1b,_0xd4837e,_0x16341f,_0x37e356){return _0x198e1b(_0xd4837e,_0x16341f,_0x37e356);}},_0x304253=getCurrentEnvironment(),_0x18e1c1=ENVIRONMENT_CONFIGS[_0x304253]['workosClientId'],_0x184c75=await _0x82b9c3[_0x5af263(0xba)](requestDeviceCode,_0x18e1c1);console['log'](_0x82b9c3[_0x5af263(0x80)]),console['log'](_0x82b9c3[_0x5af263(0xd3)]),_0x82b9c3['tbrim'](openBrowser,_0x184c75[_0x5af263(0xc3)]),console['log']('If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20'+_0x184c75['verification_uri_complete']),console['log']('Code:\x20'+_0x184c75['user_code']+'\x0a'),process[_0x5af263(0xc5)][_0x5af263(0xb9)]('Waiting\x20for\x20authentication...');let _0x4ea644=await pollForTokens(_0x18e1c1,_0x184c75[_0x5af263(0xa6)],_0x184c75[_0x5af263(0x9d)],_0x184c75[_0x5af263(0xc7)]);console[_0x5af263(0x9c)]('\x20✓');const _0xdb7de9=decodeJwtPayload(_0x4ea644[_0x5af263(0xb0)]);if(!_0xdb7de9[_0x5af263(0xbf)]){const _0x1ed109=await fetchMyMemberships(_0x4ea644[_0x5af263(0xb0)]);let _0x1ab07a;if(_0x82b9c3['Kxwkv'](_0x1ed109['length'],0x0)){process['stdout']['write'](_0x5af263(0xc1));const _0x346f49=await _0x82b9c3[_0x5af263(0x95)](selfServeSignup,_0x4ea644['access_token']);_0x1ab07a=_0x346f49['organizationId'],console[_0x5af263(0x9c)]('\x20✓');}else{if(_0x82b9c3['Kxwkv'](_0x1ed109['length'],0x1))_0x1ab07a=_0x1ed109[0x0]['organizationId'],console[_0x5af263(0x9c)](_0x5af263(0x78)+_0x1ed109[0x0]['name']);else{const _0x3f36e6=process['stdin']['isTTY']&&process[_0x5af263(0xc5)][_0x5af263(0xd2)];if(!_0x3f36e6)throw new Error(_0x82b9c3['yaijg']+_0x82b9c3[_0x5af263(0x73)]);const {selected:_0x5db825}=await _0x1476e1[_0x5af263(0xcb)]([{'type':_0x82b9c3[_0x5af263(0x9b)],'name':_0x82b9c3['wSBFK'],'message':_0x82b9c3[_0x5af263(0x74)],'choices':_0x1ed109['map'](_0x1d0b5b=>({'name':_0x1d0b5b[_0x5af263(0xcf)],'value':_0x1d0b5b['organizationId']}))}]);_0x1ab07a=_0x5db825;}}_0x4ea644=await _0x82b9c3['PESCL'](refreshTokenWithOrg,_0x18e1c1,_0x4ea644[_0x5af263(0x96)],_0x1ab07a);}process[_0x5af263(0xc5)][_0x5af263(0xb9)](_0x5af263(0x8d));const _0x2f43cb=await provisionCliToken(_0x4ea644['access_token']);return console['log']('\x20✓'),await storeToken(_0x2f43cb['token']),_0x4ea644['refresh_token']&&await storeRefreshToken(_0x4ea644['refresh_token']),_0x2f43cb[_0x5af263(0xc6)];}function sleep(_0x2f9f13){return new Promise(_0x4787e6=>setTimeout(_0x4787e6,_0x2f9f13));}
|
|
1
|
+
const _0x521274=_0x32de;(function(_0x332042,_0x29e178){const _0x217d1f=_0x32de,_0x3c51a2=_0x332042();while(!![]){try{const _0x177deb=parseInt(_0x217d1f(0x10f))/0x1*(parseInt(_0x217d1f(0x12d))/0x2)+parseInt(_0x217d1f(0x153))/0x3+parseInt(_0x217d1f(0x123))/0x4*(-parseInt(_0x217d1f(0x154))/0x5)+-parseInt(_0x217d1f(0x134))/0x6*(parseInt(_0x217d1f(0x14a))/0x7)+-parseInt(_0x217d1f(0x117))/0x8+parseInt(_0x217d1f(0x125))/0x9*(parseInt(_0x217d1f(0x143))/0xa)+-parseInt(_0x217d1f(0x110))/0xb*(parseInt(_0x217d1f(0x132))/0xc);if(_0x177deb===_0x29e178)break;else _0x3c51a2['push'](_0x3c51a2['shift']());}catch(_0x21c05d){_0x3c51a2['push'](_0x3c51a2['shift']());}}}(_0xa06f,0x6c712));import{spawn}from'child_process';import _0x438c56 from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';function _0xa06f(){const _0xfa0c4b=['1918080KiIgcz','202880CPJGDN','https://api.workos.com/user_management/authenticate','text','utf-8','POST','urn:ietf:params:oauth:grant-type:device_code','win32','now','Failed\x20to\x20request\x20device\x20code:\x20','stdout','selected','ensGk','fQPMf','Device\x20authorization\x20timed\x20out','verification_uri_complete','Waiting\x20for\x20authentication...','69XZfESA','7172duALLq','gZWVC','icFni','hwICf','/cli-auth/token','token','json','3458632EPUavM','filter','isTTY','split','write','lOshv','Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','org_id','mcp:write','/organization/my-memberships','bYFxb','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','36MbsfUA','https://api.workos.com/user_management/authorize/device','25929OgheUK','length','GET','access_token','Failed\x20to\x20fetch\x20memberships:\x20','/organization/me','log','Authentication\x20failed','14846skKsml','wNoSb','Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','kbsWZ','firstName','2904shDMWx','application/x-www-form-urlencoded','2022MkhPFV','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','ignore','FiXYs','rsRdI','organizationId','xdg-open','name','/api-keys','from','wEvHg','error','tpAeT','tCtSm','refresh_token','2490THFGkr','Provisioning\x20CLI\x20token...','status','IOSgC','Invalid\x20JWT\x20format','workosClientId','xpxEN','9751qBGAiQ','ZGzwL','memberships','application/json','parse','Xfrkh','Code:\x20','slow_down','HaaYj'];_0xa06f=function(){return _0xfa0c4b;};return _0xa06f();}const WORKOS_DEVICE_AUTH_URL=_0x521274(0x124),WORKOS_TOKEN_URL=_0x521274(0x155);export async function requestDeviceCode(_0x1991da){const _0x44ddfe=_0x521274,_0x1cbe85={'ensGk':function(_0x4f5cbf,_0x3b75be,_0x148ec2){return _0x4f5cbf(_0x3b75be,_0x148ec2);}},_0x340859=await _0x1cbe85[_0x44ddfe(0x10a)](fetch,WORKOS_DEVICE_AUTH_URL,{'method':_0x44ddfe(0x103),'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x1991da})});if(!_0x340859['ok']){const _0x49e73b=await _0x340859['text']();throw new Error(_0x44ddfe(0x107)+_0x340859['status']+'\x20'+_0x49e73b);}return _0x340859[_0x44ddfe(0x116)]();}export async function pollForTokens(_0x51a34a,_0x5e0fae,_0x286f7b,_0x3f3110){const _0x13e889=_0x521274,_0x3d7418={'DGtAk':function(_0xa39d97,_0x1d372f){return _0xa39d97+_0x1d372f;},'fQPMf':function(_0x4da554,_0xf2cb4c){return _0x4da554*_0xf2cb4c;},'FiXYs':function(_0x3df23b,_0x26bf8b){return _0x3df23b*_0x26bf8b;},'arXVg':function(_0x3caac5,_0x99d558){return _0x3caac5<_0x99d558;},'kbsWZ':function(_0x10bd59,_0x443abf){return _0x10bd59(_0x443abf);},'hwICf':function(_0x581c29,_0x1a262f,_0x301eb1){return _0x581c29(_0x1a262f,_0x301eb1);},'hOvAe':'authorization_pending','BsEaH':_0x13e889(0x12c),'xpxEN':_0x13e889(0x10c)},_0x58b367=_0x3d7418['DGtAk'](Date['now'](),_0x3d7418[_0x13e889(0x10b)](_0x3f3110,0x3e8));let _0x43504f=_0x3d7418[_0x13e889(0x137)](_0x286f7b,0x3e8);while(_0x3d7418['arXVg'](Date[_0x13e889(0x106)](),_0x58b367)){await _0x3d7418[_0x13e889(0x130)](sleep,_0x43504f);const _0x4a5be5=await _0x3d7418[_0x13e889(0x113)](fetch,WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x51a34a,'device_code':_0x5e0fae,'grant_type':_0x13e889(0x104)})});if(_0x4a5be5['ok'])return _0x4a5be5[_0x13e889(0x116)]();const _0x4c33f1=await _0x4a5be5[_0x13e889(0x116)]();if(_0x4c33f1['error']===_0x3d7418['hOvAe'])continue;if(_0x4c33f1[_0x13e889(0x13f)]===_0x13e889(0x151)){_0x43504f+=0x3e8;continue;}throw new Error(_0x4c33f1['error_description']||_0x4c33f1[_0x13e889(0x13f)]||_0x3d7418['BsEaH']);}throw new Error(_0x3d7418[_0x13e889(0x149)]);}async function fetchUserProfile(_0xc8c8b6){const _0x55f439=_0x521274,_0xe09eaf={'bmnaq':_0x55f439(0x127)},_0x4ac5fa=getApiBaseUrl();try{const _0x43b48c=await fetch(_0x4ac5fa+_0x55f439(0x12a),{'method':_0xe09eaf['bmnaq'],'headers':{'workos-token':_0xc8c8b6}});if(_0x43b48c['ok'])return _0x43b48c['json']();}catch{}return null;}function buildKeyName(_0x2ce6cd,_0x4a0a44){const _0x142710=_0x521274,_0x2a8d96={'rZFTY':function(_0x6d7cdd,_0x3c7d0a){return _0x6d7cdd===_0x3c7d0a;}},_0xab7722=_0x4a0a44[_0x142710(0x118)](_0x48e181=>_0x48e181[_0x142710(0x13b)]===_0x2ce6cd||_0x48e181[_0x142710(0x13b)]['startsWith'](_0x2ce6cd+'\x20('));if(_0x2a8d96['rZFTY'](_0xab7722['length'],0x0))return _0x2ce6cd;return _0x2ce6cd+'\x20('+(_0xab7722['length']+0x1)+')';}export async function provisionApiKey(_0x2bf262){const _0xe8bf9=_0x521274,_0x4a710b={'pXNKN':function(_0x3f739b){return _0x3f739b();},'pdciR':function(_0x5702a3,_0x3d00f7,_0xdc7338){return _0x5702a3(_0x3d00f7,_0xdc7338);},'Xfrkh':_0xe8bf9(0x127)},_0x19d348=_0x4a710b['pXNKN'](getApiBaseUrl),_0x5cc869={'Content-Type':'application/json','workos-token':_0x2bf262},_0x37fe6b=await fetchUserProfile(_0x2bf262),_0x3f4baf=_0x37fe6b?.[_0xe8bf9(0x131)]||_0x37fe6b?.['email']?.[_0xe8bf9(0x11a)]('@')[0x0],_0x52887d=_0x3f4baf?_0x3f4baf+'\x27s\x20CLI\x20Key':'CLI\x20Key';let _0x71ce8f=[];try{const _0x873b34=await _0x4a710b['pdciR'](fetch,_0x19d348+'/api-keys',{'method':_0x4a710b[_0xe8bf9(0x14f)],'headers':_0x5cc869});if(_0x873b34['ok']){const _0x239c19=await _0x873b34[_0xe8bf9(0x116)]();_0x71ce8f=_0x239c19['apiKeys'];}}catch{}const _0x59221d=buildKeyName(_0x52887d,_0x71ce8f),_0x33f2be=await fetch(_0x19d348+_0xe8bf9(0x13c),{'method':'POST','headers':_0x5cc869,'body':JSON['stringify']({'name':_0x59221d,'scope':_0xe8bf9(0x11f)})});if(!_0x33f2be['ok']){const _0x429cce=await _0x33f2be[_0xe8bf9(0x101)]();throw new Error('Failed\x20to\x20provision\x20API\x20key:\x20'+_0x33f2be['status']+'\x20'+_0x429cce);}const _0x2f86dd=await _0x33f2be[_0xe8bf9(0x116)]();return _0x2f86dd['apiKey']['token'];}export function openBrowser(_0x53d4ab){const _0xe54aa6=_0x521274,_0xc324ef={'HaaYj':function(_0x3d6810,_0x2c29c5){return _0x3d6810===_0x2c29c5;},'tpAeT':'start','gZWVC':'ignore','wEvHg':'open'};try{if(_0xc324ef[_0xe54aa6(0x152)](process['platform'],_0xe54aa6(0x105))){const _0x82e0c2=spawn('cmd',['/c',_0xc324ef[_0xe54aa6(0x140)],'',_0x53d4ab],{'detached':!![],'stdio':_0xc324ef[_0xe54aa6(0x111)],'windowsHide':!![]});_0x82e0c2['unref']();return;}const _0x42be23=process['platform']==='darwin'?_0xc324ef[_0xe54aa6(0x13e)]:_0xe54aa6(0x13a),_0x2756da=spawn(_0x42be23,[_0x53d4ab],{'detached':!![],'stdio':_0xe54aa6(0x136)});_0x2756da['unref']();}catch{}}function decodeJwtPayload(_0x5b8701){const _0x5eea45=_0x521274,_0xadccb8={'tCtSm':_0x5eea45(0x147),'lwcHY':'base64url'},_0x5988b5=_0x5b8701['split']('.');if(_0x5988b5[_0x5eea45(0x126)]!==0x3)throw new Error(_0xadccb8[_0x5eea45(0x141)]);const _0x48739e=Buffer[_0x5eea45(0x13d)](_0x5988b5[0x1],_0xadccb8['lwcHY'])['toString'](_0x5eea45(0x102));return JSON[_0x5eea45(0x14e)](_0x48739e);}async function selfServeSignup(_0x309cc1){const _0x40ebfb=_0x521274,_0x2571c2={'wNoSb':function(_0x270d60,_0x356b8f,_0xfb2e84){return _0x270d60(_0x356b8f,_0xfb2e84);},'IOSgC':'POST','icFni':_0x40ebfb(0x14d)},_0x57e46e=getApiBaseUrl(),_0x421aae=await _0x2571c2[_0x40ebfb(0x12e)](fetch,_0x57e46e+'/organization/self-serve-signup',{'method':_0x2571c2[_0x40ebfb(0x146)],'headers':{'Content-Type':_0x2571c2[_0x40ebfb(0x112)],'workos-token':_0x309cc1}});if(!_0x421aae['ok']){const _0x19c44c=await _0x421aae['text']();throw new Error('Failed\x20to\x20create\x20organization:\x20'+_0x421aae[_0x40ebfb(0x145)]+'\x20'+_0x19c44c);}return _0x421aae['json']();}async function fetchMyMemberships(_0x2a66bb){const _0x21f010=_0x521274,_0x12a131={'QZznD':function(_0x41aa85,_0x41e19c,_0x4fa674){return _0x41aa85(_0x41e19c,_0x4fa674);}},_0x26e5e1=getApiBaseUrl(),_0x58edd8=await _0x12a131['QZznD'](fetch,_0x26e5e1+_0x21f010(0x120),{'method':'GET','headers':{'workos-token':_0x2a66bb}});if(!_0x58edd8['ok']){const _0x46cecd=await _0x58edd8[_0x21f010(0x101)]();throw new Error(_0x21f010(0x129)+_0x58edd8[_0x21f010(0x145)]+'\x20'+_0x46cecd);}const _0x101431=await _0x58edd8[_0x21f010(0x116)]();return _0x101431[_0x21f010(0x14c)];}async function refreshTokenWithOrg(_0x3ccba4,_0x34ec6e,_0x5c8f79){const _0x152e91=_0x521274,_0x211b63={'rTuFz':function(_0x55d6bf,_0x3cfaeb,_0x4b4af9){return _0x55d6bf(_0x3cfaeb,_0x4b4af9);},'iPorE':_0x152e91(0x133),'hplpC':'refresh_token'},_0x22a93e=await _0x211b63['rTuFz'](fetch,WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x211b63['iPorE']},'body':new URLSearchParams({'client_id':_0x3ccba4,'grant_type':_0x211b63['hplpC'],'refresh_token':_0x34ec6e,'organization_id':_0x5c8f79})});if(!_0x22a93e['ok']){const _0xc10671=await _0x22a93e['text']();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x22a93e[_0x152e91(0x145)]+'\x20'+_0xc10671);}return _0x22a93e['json']();}async function provisionCliToken(_0x2830af){const _0x59b58=_0x521274,_0x28013e={'ezmUe':function(_0x8b623f){return _0x8b623f();},'iEACv':'application/json'},_0x2083c5=_0x28013e['ezmUe'](getApiBaseUrl),_0x5dc83b=await fetch(_0x2083c5+_0x59b58(0x114),{'method':_0x59b58(0x103),'headers':{'Content-Type':_0x28013e['iEACv'],'workos-token':_0x2830af}});if(!_0x5dc83b['ok']){const _0x121b72=await _0x5dc83b[_0x59b58(0x101)]();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x5dc83b[_0x59b58(0x145)]+'\x20'+_0x121b72);}return _0x5dc83b['json']();}export async function runDeviceAuthFlow(){const _0xd167d9=_0x521274,_0x37b0e1={'ctmJo':_0xd167d9(0x135),'SOvGK':function(_0x2a9c8b,_0x37f70f){return _0x2a9c8b(_0x37f70f);},'ZGzwL':function(_0x549de0,_0x420382,_0x5827b2,_0x22f803,_0x1efae1){return _0x549de0(_0x420382,_0x5827b2,_0x22f803,_0x1efae1);},'bYFxb':function(_0x541380,_0x4bdfac){return _0x541380(_0x4bdfac);},'lOshv':function(_0x299fdb,_0x2431b4){return _0x299fdb===_0x2431b4;},'KGCbp':'Setting\x20up\x20your\x20organization...','NLbwx':function(_0x4674e1,_0x3830ed){return _0x4674e1(_0x3830ed);},'jjoEr':_0xd167d9(0x12f),'pjgdB':'Select\x20an\x20organization:','rsRdI':function(_0x16b27c,_0x26e925,_0x1ea85e,_0x3f2079){return _0x16b27c(_0x26e925,_0x1ea85e,_0x3f2079);},'zeQAi':_0xd167d9(0x144)},_0x385328=getCurrentEnvironment(),_0x24b30c=ENVIRONMENT_CONFIGS[_0x385328][_0xd167d9(0x148)],_0x560573=await requestDeviceCode(_0x24b30c);console[_0xd167d9(0x12b)](_0x37b0e1['ctmJo']),console['log'](_0xd167d9(0x122)),_0x37b0e1['SOvGK'](openBrowser,_0x560573[_0xd167d9(0x10d)]),console[_0xd167d9(0x12b)]('If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20'+_0x560573[_0xd167d9(0x10d)]),console[_0xd167d9(0x12b)](_0xd167d9(0x150)+_0x560573['user_code']+'\x0a'),process[_0xd167d9(0x108)][_0xd167d9(0x11b)](_0xd167d9(0x10e));let _0x8646de=await _0x37b0e1[_0xd167d9(0x14b)](pollForTokens,_0x24b30c,_0x560573['device_code'],_0x560573['interval'],_0x560573['expires_in']);console[_0xd167d9(0x12b)]('\x20✓');const _0x30219e=_0x37b0e1['bYFxb'](decodeJwtPayload,_0x8646de[_0xd167d9(0x128)]);if(!_0x30219e[_0xd167d9(0x11e)]){const _0x1b7f6d=await fetchMyMemberships(_0x8646de[_0xd167d9(0x128)]);let _0x1d9bb2;if(_0x37b0e1[_0xd167d9(0x11c)](_0x1b7f6d['length'],0x0)){process[_0xd167d9(0x108)]['write'](_0x37b0e1['KGCbp']);const _0x5d9d94=await _0x37b0e1['NLbwx'](selfServeSignup,_0x8646de['access_token']);_0x1d9bb2=_0x5d9d94['organizationId'],console[_0xd167d9(0x12b)]('\x20✓');}else{if(_0x1b7f6d[_0xd167d9(0x126)]===0x1)_0x1d9bb2=_0x1b7f6d[0x0][_0xd167d9(0x139)],console[_0xd167d9(0x12b)]('Using\x20organization:\x20'+_0x1b7f6d[0x0][_0xd167d9(0x13b)]);else{const _0x2370e3=process['stdin']['isTTY']&&process[_0xd167d9(0x108)][_0xd167d9(0x119)];if(!_0x2370e3)throw new Error(_0xd167d9(0x11d)+_0x37b0e1['jjoEr']);const {selected:_0x507435}=await _0x438c56['prompt']([{'type':'list','name':_0xd167d9(0x109),'message':_0x37b0e1['pjgdB'],'choices':_0x1b7f6d['map'](_0x29ea5=>({'name':_0x29ea5['name'],'value':_0x29ea5['organizationId']}))}]);_0x1d9bb2=_0x507435;}}_0x8646de=await _0x37b0e1[_0xd167d9(0x138)](refreshTokenWithOrg,_0x24b30c,_0x8646de['refresh_token'],_0x1d9bb2);}process['stdout'][_0xd167d9(0x11b)](_0x37b0e1['zeQAi']);const _0x3797a9=await _0x37b0e1['SOvGK'](provisionCliToken,_0x8646de[_0xd167d9(0x128)]);return console['log']('\x20✓'),await storeToken(_0x3797a9[_0xd167d9(0x115)]),_0x8646de['refresh_token']&&await _0x37b0e1[_0xd167d9(0x121)](storeRefreshToken,_0x8646de[_0xd167d9(0x142)]),_0x3797a9['token'];}function _0x32de(_0x1c067b,_0x3d23bd){_0x1c067b=_0x1c067b-0x101;const _0xa06f98=_0xa06f();let _0x32defb=_0xa06f98[_0x1c067b];return _0x32defb;}function sleep(_0x303c64){return new Promise(_0x1d1289=>setTimeout(_0x1d1289,_0x303c64));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x1aca06=_0x58d4;(function(_0x3e266f,_0x3e340c){const _0x4cef87=_0x58d4,_0x307242=_0x3e266f();while(!![]){try{const _0x337307=parseInt(_0x4cef87(0x1c1))/0x1+-parseInt(_0x4cef87(0x1b7))/0x2*(-parseInt(_0x4cef87(0x1cb))/0x3)+parseInt(_0x4cef87(0x1ae))/0x4*(parseInt(_0x4cef87(0x1c8))/0x5)+-parseInt(_0x4cef87(0x1b0))/0x6+-parseInt(_0x4cef87(0x1c6))/0x7*(parseInt(_0x4cef87(0x1bd))/0x8)+parseInt(_0x4cef87(0x1b9))/0x9*(parseInt(_0x4cef87(0x1c0))/0xa)+-parseInt(_0x4cef87(0x1ce))/0xb*(parseInt(_0x4cef87(0x1c2))/0xc);if(_0x337307===_0x3e340c)break;else _0x307242['push'](_0x307242['shift']());}catch(_0x52ad13){_0x307242['push'](_0x307242['shift']());}}}(_0x5413,0x88f7d));export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':'https://api.ranger.net','workosClientId':'client_01J9CBYM7M5ZETCF7G6614DXR2','aiProxyUrl':'https://ai-proxy-716115358910.us-central1.run.app','mcpAuthUrl':'https://mcp-auth.ranger.net/mcp'},'staging':{'apiBaseUrl':'https://api.staging.ranger.net','workosClientId':_0x1aca06(0x1cf),'aiProxyUrl':_0x1aca06(0x1d3),'mcpAuthUrl':_0x1aca06(0x1c9)},'local':{'apiBaseUrl':'http://localhost:8080','workosClientId':_0x1aca06(0x1cf),'aiProxyUrl':'http://localhost:8090','mcpAuthUrl':_0x1aca06(0x1d1)}};export const DEFAULT_ENVIRONMENT=_0x1aca06(0x1cc);export function isValidEnvironment(_0xf913e4){const _0x3f2b82=_0x1aca06,_0x2b9976={'sTBtk':_0x3f2b82(0x1b2)};return _0xf913e4===_0x3f2b82(0x1cc)||_0xf913e4===_0x3f2b82(0x1bc)||_0xf913e4===_0x2b9976['sTBtk'];}function _0x58d4(_0x43148a,_0x59e4bb){_0x43148a=_0x43148a-0x1ac;const _0x54131c=_0x5413();let _0x58d4a7=_0x54131c[_0x43148a];return _0x58d4a7;}export function getCurrentEnvironment(){const _0x3c08fd=_0x1aca06,_0x3e6be3=process[_0x3c08fd(0x1c3)][_0x3c08fd(0x1c7)];if(_0x3e6be3&&isValidEnvironment(_0x3e6be3))return _0x3e6be3;return DEFAULT_ENVIRONMENT;}export function getApiBaseUrl(){const _0x142c28={'bkKTe':function(_0x3dcbe5){return _0x3dcbe5();}};return ENVIRONMENT_CONFIGS[_0x142c28['bkKTe'](getCurrentEnvironment)]['apiBaseUrl'];}export function getAiProxyUrl(){return ENVIRONMENT_CONFIGS[getCurrentEnvironment()]['aiProxyUrl'];}export function getMcpAuthUrl(){const _0x2c275c=_0x1aca06;return process['env'][_0x2c275c(0x1c4)]??ENVIRONMENT_CONFIGS[getCurrentEnvironment()][_0x2c275c(0x1ba)];}export function isByokEnabled(){const _0x4ca49c=_0x1aca06;return process['env']['RANGER_BYOK']===_0x4ca49c(0x1d5);}function isVerificationTransport(_0x629de0){const _0x44b2a7=_0x1aca06,_0x1b18ba={'PrOgq':_0x44b2a7(0x1b4),'ocYIg':function(_0x2f80ad,_0x401e0c){return _0x2f80ad===_0x401e0c;},'GRzoY':_0x44b2a7(0x1d4),'rvjVt':function(_0x2115de,_0x41f2e2){return _0x2115de===_0x41f2e2;}};return _0x629de0===_0x1b18ba['PrOgq']||_0x1b18ba['ocYIg'](_0x629de0,_0x1b18ba[_0x44b2a7(0x1b5)])||_0x1b18ba[_0x44b2a7(0x1cd)](_0x629de0,_0x44b2a7(0x1ac))||_0x629de0==='rangerwright-cli';}const LEGACY_TRANSPORT_ENV_VARS=[_0x1aca06(0x1b3),_0x1aca06(0x1af)];export function getVerificationTransport(){const _0x1f0e86=_0x1aca06,_0xda6a6f={'kMgiV':'mcp'},_0x2ec0ec=process[_0x1f0e86(0x1c3)]['RANGER_TRANSPORT']?.['trim']();if(_0x2ec0ec){if(isVerificationTransport(_0x2ec0ec))return _0x2ec0ec;throw new Error(_0x1f0e86(0x1d0)+_0x2ec0ec+_0x1f0e86(0x1bb));}const _0x354b75=LEGACY_TRANSPORT_ENV_VARS['find'](_0x94d5f8=>process['env'][_0x94d5f8]);if(_0x354b75)throw new Error(_0x354b75+_0x1f0e86(0x1b8));return _0xda6a6f[_0x1f0e86(0x1d2)];}function _0x5413(){const _0x183c8f=['RANGER_HOOKS','[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22','60GEcEkp','934421LKNxid','3624CXpuKs','env','RANGER_MCP_AUTH_URL','QRZTT','483231VTnUoS','RANGER_CLI_ENV','290765sYJtsb','https://mcp-auth.staging.ranger.net/mcp','trim','138Nchcjk','prod','rvjVt','60313gwINSz','client_01J9CBYM2DKWV9HM17D95Z540K','Invalid\x20RANGER_TRANSPORT=\x22','http://localhost:8080/mcp','kMgiV','https://ai-proxy-301751771437.us-central1.run.app','playwright-cli','true','nova-act-cli','off','40QLkDVl','RANGER_DISABLE_MCP','2193912IFTmzd','OBsgx','local','RANGER_USE_NOVA_ACT','mcp','GRzoY','auto','23654shQlEP','\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.','1198017CfUOxV','mcpAuthUrl','\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.','staging','32ctFdYe'];_0x5413=function(){return _0x183c8f;};return _0x5413();}export function resolveHookMode(_0x284d48=process['env']){const _0x2a4371=_0x1aca06,_0x267a07={'QRZTT':_0x2a4371(0x1b6),'ztwbn':_0x2a4371(0x1ad),'OBsgx':function(_0x5b47c7,_0x52337f){return _0x5b47c7===_0x52337f;}},_0x11d5d1=_0x284d48[_0x2a4371(0x1be)]?.[_0x2a4371(0x1ca)]()['toLowerCase']();if(!_0x11d5d1)return _0x267a07['QRZTT'];if(_0x11d5d1===_0x267a07['ztwbn']||_0x267a07[_0x2a4371(0x1b1)](_0x11d5d1,'on')||_0x267a07[_0x2a4371(0x1b1)](_0x11d5d1,'auto'))return _0x11d5d1;return console['error'](_0x2a4371(0x1bf)+_0x284d48[_0x2a4371(0x1be)]+'\x22.\x20'+'Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.'),_0x267a07[_0x2a4371(0x1c5)];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x1640f6,_0x4e8958){const _0x1d8fd7=_0x57d2,_0x95ef0d=_0x1640f6();while(!![]){try{const _0x4e3f5a=parseInt(_0x1d8fd7(0xfb))/0x1*(parseInt(_0x1d8fd7(0xe7))/0x2)+-parseInt(_0x1d8fd7(0x105))/0x3+parseInt(_0x1d8fd7(0x10a))/0x4*(parseInt(_0x1d8fd7(0xf0))/0x5)+parseInt(_0x1d8fd7(0xd4))/0x6+parseInt(_0x1d8fd7(0xff))/0x7*(parseInt(_0x1d8fd7(0xc5))/0x8)+-parseInt(_0x1d8fd7(0xcb))/0x9+-parseInt(_0x1d8fd7(0x100))/0xa;if(_0x4e3f5a===_0x4e8958)break;else _0x95ef0d['push'](_0x95ef0d['shift']());}catch(_0x490ca9){_0x95ef0d['push'](_0x95ef0d['shift']());}}}(_0x5104,0x673fc));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0xf4a1b2){const _0x191217=_0x57d2,_0x4b5a27={'uJLaN':function(_0x4a7268){return _0x4a7268();},'cegui':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','LAfVA':function(_0x5ec21d){return _0x5ec21d();},'ZGUfi':function(_0xe542eb,_0x210839,_0x109bc4){return _0xe542eb(_0x210839,_0x109bc4);},'okglP':_0x191217(0x108),'sKmPr':'Feature\x20limit\x20exceeded'},_0x3e21c8=await _0x4b5a27['uJLaN'](getToken);if(!_0x3e21c8)throw new Error(_0x4b5a27['cegui']);const _0x2b3e2a=_0x4b5a27[_0x191217(0xc6)](getApiBaseUrl),_0x1482be=await _0x4b5a27[_0x191217(0xc4)](fetch,_0x2b3e2a+'/api/v1/mcp/features',{'method':_0x4b5a27[_0x191217(0xce)],'headers':{'Authorization':'Bearer\x20'+_0x3e21c8,'Content-Type':_0x191217(0xf9)},'body':JSON[_0x191217(0xf2)](_0xf4a1b2)});if(!_0x1482be['ok']){if(_0x1482be['status']===0x192){const _0x4eeb1e=await _0x1482be[_0x191217(0xee)](),_0x595447=_0x4eeb1e['billingUrl']||'https://dashboard.ranger.net/billing';throw new Error((_0x4eeb1e[_0x191217(0x103)]||_0x4b5a27['sKmPr'])+'\x0a\x0aUpgrade\x20your\x20plan:\x20'+_0x595447);}const _0x9998b6=await _0x1482be[_0x191217(0xcc)]();throw new Error(_0x191217(0xed)+_0x9998b6);}return _0x1482be['json']();}export async function listFeatures(_0x134e30){const _0x2bace3=_0x57d2,_0x276fea={'YZIso':'gitRepoUrl','zSMLV':'gitBranch','EivFD':_0x2bace3(0xd8),'nwHLP':_0x2bace3(0xe3)},_0x5c5175=await getToken();if(!_0x5c5175)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x2ff90d=getApiBaseUrl(),_0xf3e3f4=new URLSearchParams();if(_0x134e30?.['gitRepoUrl'])_0xf3e3f4['set'](_0x276fea[_0x2bace3(0x10b)],_0x134e30['gitRepoUrl']);if(_0x134e30?.[_0x2bace3(0xe2)])_0xf3e3f4[_0x2bace3(0xea)](_0x276fea[_0x2bace3(0xe6)],_0x134e30[_0x2bace3(0xe2)]);if(_0x134e30?.['limit'])_0xf3e3f4['set'](_0x2bace3(0xf3),_0x134e30[_0x2bace3(0xf3)][_0x2bace3(0xc2)]());if(_0x134e30?.['offset'])_0xf3e3f4['set'](_0x276fea[_0x2bace3(0xec)],_0x134e30['offset'][_0x2bace3(0xc2)]());if(_0x134e30?.[_0x2bace3(0xd5)])_0xf3e3f4['set']('includeDeleted',_0x2bace3(0xef));const _0x11b2fc=_0x2ff90d+_0x2bace3(0x106)+(_0xf3e3f4[_0x2bace3(0xc2)]()?'?'+_0xf3e3f4['toString']():''),_0x430a12=await fetch(_0x11b2fc,{'method':_0x276fea[_0x2bace3(0xca)],'headers':{'Authorization':'Bearer\x20'+_0x5c5175}});if(!_0x430a12['ok']){const _0x428031=await _0x430a12[_0x2bace3(0xcc)]();throw new Error(_0x2bace3(0xdb)+_0x428031);}return _0x430a12[_0x2bace3(0xee)]();}export async function getFeature(_0x40401c){const _0x27147d=_0x57d2,_0x49493c={'EzhiK':function(_0x30c090){return _0x30c090();}},_0x223deb=await _0x49493c[_0x27147d(0xd7)](getToken);if(!_0x223deb)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x2b505d=getApiBaseUrl(),_0x1dfbf9=await fetch(_0x2b505d+_0x27147d(0xd3)+_0x40401c,{'method':_0x27147d(0xe3),'headers':{'Authorization':_0x27147d(0xd1)+_0x223deb}});if(!_0x1dfbf9['ok']){const _0xc9140=await _0x1dfbf9['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review:\x20'+_0xc9140);}return _0x1dfbf9['json']();}export async function updateFeature(_0x30a5a2,_0x49b70d){const _0x5f002c=_0x57d2,_0x541970={'ZVrRg':function(_0xc9e054){return _0xc9e054();}},_0x3c51f9=await _0x541970['ZVrRg'](getToken);if(!_0x3c51f9)throw new Error(_0x5f002c(0x102));const _0x24a5b3=getApiBaseUrl(),_0x1d8ba2=await fetch(_0x24a5b3+'/api/v1/mcp/features/'+_0x30a5a2,{'method':_0x5f002c(0xe8),'headers':{'Authorization':_0x5f002c(0xd1)+_0x3c51f9,'Content-Type':_0x5f002c(0xf9)},'body':JSON[_0x5f002c(0xf2)](_0x49b70d)});if(!_0x1d8ba2['ok']){const _0x3e1893=await _0x1d8ba2[_0x5f002c(0xcc)]();throw new Error('Failed\x20to\x20update\x20feature\x20review:\x20'+_0x3e1893);}return _0x1d8ba2[_0x5f002c(0xee)]();}export async function createChecklistItem(_0x1e7861,_0x382c1f,_0x38caef){const _0x26a243=_0x57d2,_0x57b05e={'rjirt':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','Acofu':_0x26a243(0x108),'OjoUV':_0x26a243(0xf9)},_0x34417c=await getToken();if(!_0x34417c)throw new Error(_0x57b05e['rjirt']);const _0xd2b53d=getApiBaseUrl(),_0x6f0210=await fetch(_0xd2b53d+_0x26a243(0xd3)+_0x1e7861+'/checklist',{'method':_0x57b05e['Acofu'],'headers':{'Authorization':_0x26a243(0xd1)+_0x34417c,'Content-Type':_0x57b05e[_0x26a243(0xc7)]},'body':JSON['stringify']({'description':_0x382c1f,'position':_0x38caef})});if(!_0x6f0210['ok']){const _0x25b834=await _0x6f0210['text']();throw new Error(_0x26a243(0xdd)+_0x25b834);}return _0x6f0210['json']();}export async function updateChecklistItem(_0x9a6085,_0xe7eb84,_0xf5826){const _0x1e616e={'AFdVO':function(_0x235252){return _0x235252();},'eIugh':function(_0x184435,_0x402e2e,_0x5b16f7){return _0x184435(_0x402e2e,_0x5b16f7);}};return withRetry(async()=>{const _0x5bf462=_0x57d2,_0x4507d8=await _0x1e616e[_0x5bf462(0x107)](getToken);if(!_0x4507d8)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x4e364f=getApiBaseUrl(),_0x2b0b8a=await _0x1e616e[_0x5bf462(0xe1)](fetch,_0x4e364f+_0x5bf462(0xd3)+_0x9a6085+'/checklist/'+_0xe7eb84,{'method':'PATCH','headers':{'Authorization':_0x5bf462(0xd1)+_0x4507d8,'Content-Type':_0x5bf462(0xf9)},'body':JSON[_0x5bf462(0xf2)](_0xf5826)});if(!_0x2b0b8a['ok']){const _0x505c3e=await _0x2b0b8a[_0x5bf462(0xcc)]();throw new Error('Failed\x20to\x20update\x20scenario:\x20'+_0x505c3e);}return _0x2b0b8a['json']();},{'label':'updateChecklistItem'});}export async function getFeatureReport(_0x2227fd){const _0x221791=_0x57d2,_0x517b6f={'bARYN':function(_0xcd5b34){return _0xcd5b34();},'hfeGA':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','sovuE':'GET'},_0x2a756f=await _0x517b6f['bARYN'](getToken);if(!_0x2a756f)throw new Error(_0x517b6f['hfeGA']);const _0x4c9c1c=_0x517b6f[_0x221791(0xcd)](getApiBaseUrl),_0x55b8e2=await fetch(_0x4c9c1c+_0x221791(0xd3)+_0x2227fd+'/report',{'method':_0x517b6f['sovuE'],'headers':{'Authorization':'Bearer\x20'+_0x2a756f}});if(!_0x55b8e2['ok']){const _0x26efd6=await _0x55b8e2[_0x221791(0xcc)]();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x26efd6);}return _0x55b8e2['json']();}export async function getFeatureReportMarkdown(_0x547502,_0x5d87cc){const _0x244447=_0x57d2,_0x12f382={'NEvwj':function(_0x1e1c66){return _0x1e1c66();},'wdnEF':_0x244447(0x102),'nxrIe':function(_0x1001d8,_0x55fc37){return _0x1001d8(_0x55fc37);},'AaqLw':_0x244447(0xcf),'bfsby':'sessionId','LGUdZ':function(_0x7867a8,_0x5549bf){return _0x7867a8&&_0x5549bf;},'ZCxvP':_0x244447(0xfa),'QwcVr':function(_0x58002f,_0x4f073d,_0x1c19d7){return _0x58002f(_0x4f073d,_0x1c19d7);},'TgVrL':'GET'},_0xee34da=await _0x12f382[_0x244447(0xf1)](getToken);if(!_0xee34da)throw new Error(_0x12f382[_0x244447(0xe4)]);const _0x301752=_0x12f382[_0x244447(0xf1)](getApiBaseUrl),_0x2308fb=new URLSearchParams(),_0x4c55c1=(_0x5d87cc?.['itemIds']?.[_0x244447(0xeb)]??0x0)>0x0,_0x352f07=_0x12f382[_0x244447(0xd6)](Boolean,_0x5d87cc?.['sessionId']);_0x4c55c1&&_0x5d87cc?.['itemIds']&&_0x2308fb[_0x244447(0xea)](_0x12f382[_0x244447(0xe5)],_0x5d87cc[_0x244447(0xcf)][_0x244447(0xf5)](','));_0x352f07&&_0x5d87cc?.['sessionId']&&_0x2308fb[_0x244447(0xea)](_0x12f382['bfsby'],_0x5d87cc['sessionId']);_0x12f382['LGUdZ'](!_0x4c55c1,!_0x352f07)&&_0x5d87cc?.['style']&&_0x2308fb['set'](_0x12f382[_0x244447(0xe0)],_0x5d87cc[_0x244447(0xfa)]);const _0x15e28a=_0x301752+'/api/v1/mcp/features/'+_0x547502+_0x244447(0xd9),_0x39834b=''+_0x15e28a+(_0x2308fb[_0x244447(0xc2)]()?'?'+_0x2308fb[_0x244447(0xc2)]():''),_0x2ab6cb=await _0x12f382['QwcVr'](fetch,_0x39834b,{'method':_0x12f382[_0x244447(0xc8)],'headers':{'Authorization':'Bearer\x20'+_0xee34da}});if(!_0x2ab6cb['ok']){const _0x5a7fcb=await _0x2ab6cb['text']();throw new Error(_0x244447(0xdf)+_0x5a7fcb);}return _0x2ab6cb['text']();}export async function listFeatureSessions(_0x39b94c){const _0x48ff36=_0x57d2,_0x5d9a47={'GAhwd':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','BiaoD':function(_0x46345e){return _0x46345e();}},_0x273575=await getToken();if(!_0x273575)throw new Error(_0x5d9a47[_0x48ff36(0xde)]);const _0xac6029=_0x5d9a47[_0x48ff36(0xf7)](getApiBaseUrl),_0x45f6a7=await fetch(_0xac6029+'/api/v1/mcp/features/'+_0x39b94c+'/sessions',{'method':'GET','headers':{'Authorization':_0x48ff36(0xd1)+_0x273575}});if(!_0x45f6a7['ok']){const _0x291914=await _0x45f6a7[_0x48ff36(0xcc)]();throw new Error(_0x48ff36(0xd2)+_0x291914);}return _0x45f6a7['json']();}export async function startSession(_0x4d93ed,_0x14ed99){const _0xf89e1c=_0x57d2,_0x26d8fc={'BPGxK':function(_0x370626){return _0x370626();},'KgKxB':_0xf89e1c(0x102),'JpkZz':function(_0x4bf3b3,_0x2a95cb,_0x448c6b){return _0x4bf3b3(_0x2a95cb,_0x448c6b);}},_0x4f80e4=await _0x26d8fc['BPGxK'](getToken);if(!_0x4f80e4)throw new Error(_0x26d8fc[_0xf89e1c(0xd0)]);const _0x4f5c0b=_0x26d8fc['BPGxK'](getApiBaseUrl),_0x53dd8f=await _0x26d8fc[_0xf89e1c(0xf8)](fetch,_0x4f5c0b+_0xf89e1c(0xd3)+_0x4d93ed+'/sessions/'+_0x14ed99+'/start',{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x4f80e4}});if(!_0x53dd8f['ok']){const _0x88396e=await _0x53dd8f[_0xf89e1c(0xcc)]();throw new Error('Failed\x20to\x20start\x20session:\x20'+_0x88396e);}return _0x53dd8f[_0xf89e1c(0xee)]();}function _0x5104(){const _0x482f8d=['JpSBZ','join','/conclude','BiaoD','JpkZz','application/json','style','138093jpzKYC','LJTBO','Failed\x20to\x20get\x20action\x20items:\x20','Coiwx','182xbIVtB','3194040TEVPjB','Failed\x20to\x20get\x20item\x20feedback:\x20','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','message','/comments/address','2229939RjrtVf','/api/v1/mcp/features','AFdVO','POST','Failed\x20to\x20delete\x20feature\x20review:\x20','1370392VkNLlZ','YZIso','/action-items','Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20','toString','DUhBg','ZGUfi','20456wsNwGH','LAfVA','OjoUV','TgVrL','/checklist-items/','nwHLP','7204158EGbpEL','text','bARYN','okglP','itemIds','KgKxB','Bearer\x20','Failed\x20to\x20list\x20sessions:\x20','/api/v1/mcp/features/','5063664YfMLDY','includeDeleted','nxrIe','EzhiK','offset','/report/markdown','DELETE','Failed\x20to\x20list\x20feature\x20reviews:\x20','Failed\x20to\x20restore\x20feature\x20review:\x20','Failed\x20to\x20create\x20scenario:\x20','GAhwd','Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20','ZCxvP','eIugh','gitBranch','GET','wdnEF','AaqLw','zSMLV','10BxBbUm','PATCH','MskdS','set','length','EivFD','Failed\x20to\x20create\x20feature\x20review:\x20','json','true','10poVGLk','NEvwj','stringify','limit'];_0x5104=function(){return _0x482f8d;};return _0x5104();}function _0x57d2(_0x4919c7,_0x400cd2){_0x4919c7=_0x4919c7-0xc0;const _0x5104a6=_0x5104();let _0x57d29a=_0x5104a6[_0x4919c7];return _0x57d29a;}export async function concludeSession(_0xd1a4e,_0x5a4980){const _0x47906e=_0x57d2,_0x4fb73a={'MskdS':function(_0x5dc134){return _0x5dc134();},'LJTBO':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','Coiwx':function(_0x4d4909,_0x502d0d,_0x2f1264){return _0x4d4909(_0x502d0d,_0x2f1264);}},_0x47fe5b=await _0x4fb73a[_0x47906e(0xe9)](getToken);if(!_0x47fe5b)throw new Error(_0x4fb73a[_0x47906e(0xfc)]);const _0xe08dba=getApiBaseUrl(),_0x47e86a=await _0x4fb73a[_0x47906e(0xfe)](fetch,_0xe08dba+'/api/v1/mcp/features/'+_0xd1a4e+'/sessions/'+_0x5a4980+_0x47906e(0xf6),{'method':_0x47906e(0x108),'headers':{'Authorization':'Bearer\x20'+_0x47fe5b}});if(!_0x47e86a['ok']){const _0x439ae2=await _0x47e86a[_0x47906e(0xcc)]();throw new Error('Failed\x20to\x20conclude\x20session:\x20'+_0x439ae2);}return _0x47e86a[_0x47906e(0xee)]();}export async function getActionItems(_0x115b03){const _0x2e21df=_0x57d2,_0x517bc4={'WzaFq':function(_0x42446e){return _0x42446e();},'Ayfap':function(_0x538360,_0x568bd3,_0x460c71){return _0x538360(_0x568bd3,_0x460c71);},'roFFh':_0x2e21df(0xe3)},_0x38cf53=await _0x517bc4['WzaFq'](getToken);if(!_0x38cf53)throw new Error(_0x2e21df(0x102));const _0x544a82=getApiBaseUrl(),_0x345e80=await _0x517bc4['Ayfap'](fetch,_0x544a82+_0x2e21df(0xd3)+_0x115b03+_0x2e21df(0xc0),{'method':_0x517bc4['roFFh'],'headers':{'Authorization':_0x2e21df(0xd1)+_0x38cf53}});if(!_0x345e80['ok']){const _0x91766c=await _0x345e80[_0x2e21df(0xcc)]();throw new Error(_0x2e21df(0xfd)+_0x91766c);}return _0x345e80['json']();}export async function getItemFeedback(_0x1315e7,_0xb720bc){const _0x3c117f=_0x57d2,_0x1ea8d0={'wgXLI':function(_0x1e0bdb,_0x3ac802,_0x15d60c){return _0x1e0bdb(_0x3ac802,_0x15d60c);},'xNfCP':_0x3c117f(0xe3)},_0x32c245=await getToken();if(!_0x32c245)throw new Error(_0x3c117f(0x102));const _0x22770c=getApiBaseUrl(),_0x464b62=await _0x1ea8d0['wgXLI'](fetch,_0x22770c+_0x3c117f(0xd3)+_0x1315e7+_0x3c117f(0xc9)+_0xb720bc+'/feedback',{'method':_0x1ea8d0['xNfCP'],'headers':{'Authorization':'Bearer\x20'+_0x32c245}});if(!_0x464b62['ok']){const _0x3d237f=await _0x464b62[_0x3c117f(0xcc)]();throw new Error(_0x3c117f(0x101)+_0x3d237f);}return _0x464b62[_0x3c117f(0xee)]();}export async function markCommentsAddressed(_0x385944,_0x4894d5,_0x588650){const _0x5841cf=_0x57d2,_0x22ab84={'YDIdv':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','DUhBg':function(_0x50e957,_0x58d335,_0x379ddb){return _0x50e957(_0x58d335,_0x379ddb);},'JpSBZ':'POST'},_0x1ececa=await getToken();if(!_0x1ececa)throw new Error(_0x22ab84['YDIdv']);const _0x31ad05=getApiBaseUrl(),_0x503f4c=await _0x22ab84[_0x5841cf(0xc3)](fetch,_0x31ad05+'/api/v1/mcp/features/'+_0x385944+_0x5841cf(0x104),{'method':_0x22ab84[_0x5841cf(0xf4)],'headers':{'Authorization':'Bearer\x20'+_0x1ececa,'Content-Type':'application/json'},'body':JSON[_0x5841cf(0xf2)]({'checklistItemId':_0x4894d5,'commentIds':_0x588650})});if(!_0x503f4c['ok']){const _0x1caafe=await _0x503f4c[_0x5841cf(0xcc)]();throw new Error(_0x5841cf(0xc1)+_0x1caafe);}}export async function softDeleteFeature(_0x473f45){const _0x2263bb=_0x57d2,_0x2d902b=await getToken();if(!_0x2d902b)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x20fb62=getApiBaseUrl(),_0x1274f0=await fetch(_0x20fb62+_0x2263bb(0xd3)+_0x473f45,{'method':_0x2263bb(0xda),'headers':{'Authorization':_0x2263bb(0xd1)+_0x2d902b}});if(!_0x1274f0['ok']){const _0x3e5079=await _0x1274f0[_0x2263bb(0xcc)]();throw new Error(_0x2263bb(0x109)+_0x3e5079);}}export async function restoreFeature(_0x2dc53a){const _0x194ea4=_0x57d2,_0x2c1ecb={'DVIIo':_0x194ea4(0x102),'CqioE':function(_0x1da107){return _0x1da107();},'Ujdwv':function(_0x261cc9,_0x3d3354,_0x4a4d5f){return _0x261cc9(_0x3d3354,_0x4a4d5f);}},_0x36c3d7=await getToken();if(!_0x36c3d7)throw new Error(_0x2c1ecb['DVIIo']);const _0xa2b8a3=_0x2c1ecb['CqioE'](getApiBaseUrl),_0x301ce9=await _0x2c1ecb['Ujdwv'](fetch,_0xa2b8a3+'/api/v1/mcp/features/'+_0x2dc53a+'/restore',{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x36c3d7}});if(!_0x301ce9['ok']){const _0x56291a=await _0x301ce9['text']();throw new Error(_0x194ea4(0xdc)+_0x56291a);}}
|
|
1
|
+
(function(_0x25cd29,_0x1b6d88){const _0x2c32b1=_0x5158,_0x195c4d=_0x25cd29();while(!![]){try{const _0x4fac79=parseInt(_0x2c32b1(0xfb))/0x1*(parseInt(_0x2c32b1(0x11b))/0x2)+-parseInt(_0x2c32b1(0xf4))/0x3*(parseInt(_0x2c32b1(0x107))/0x4)+-parseInt(_0x2c32b1(0x10d))/0x5+parseInt(_0x2c32b1(0x10c))/0x6+parseInt(_0x2c32b1(0x109))/0x7+-parseInt(_0x2c32b1(0x104))/0x8+parseInt(_0x2c32b1(0x115))/0x9*(parseInt(_0x2c32b1(0xf0))/0xa);if(_0x4fac79===_0x1b6d88)break;else _0x195c4d['push'](_0x195c4d['shift']());}catch(_0x256dc3){_0x195c4d['push'](_0x195c4d['shift']());}}}(_0x3e7b,0x481f0));function _0x3e7b(){const _0x4006f7=['style','AcpYF','KysCN','SgbaK','EfPvC','aapxO','3889744fVXLUC','HjSPs','OMFWK','14684jzNEyz','DIhmq','630679tnEkpa','\x0a\x0aUpgrade\x20your\x20plan:\x20','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','3016350WNcwxl','1282805OMFifo','cfQmd','text','Failed\x20to\x20restore\x20feature\x20review:\x20','sessionId','https://dashboard.ranger.net/billing','stringify','POST','9qXLocN','NRvHq','Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20','ZnAhg','gitBranch','aFNNe','409918UTFkqe','Bearer\x20','HzDQa','/comments/address','status','Failed\x20to\x20create\x20scenario:\x20','join','itemIds','message','/report/markdown','xIxIo','DmGtA','/feedback','Failed\x20to\x20update\x20scenario:\x20','json','/checklist/','/conclude','Failed\x20to\x20get\x20feature\x20review:\x20','/api/v1/mcp/features','bNqHc','GET','RIlrX','/api/v1/mcp/features/','limit','toString','billingUrl','sEGXp','JpSvA','application/json','set','4129430fuugES','agiaq','Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20','DELETE','141oYfHNm','/checklist-items/','NOEvg','/report','PATCH','/action-items','Cuumc','1tVGHEn','/sessions/','gitRepoUrl'];_0x3e7b=function(){return _0x4006f7;};return _0x3e7b();}import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x2a1c4b){const _0x553bba=_0x5158,_0x57b978={'UcVhe':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','TIPJI':'POST','SgbaK':_0x553bba(0xee),'jWsBW':function(_0x4078aa,_0x24a3d9){return _0x4078aa===_0x24a3d9;},'DmGtA':_0x553bba(0x112),'XfbOc':'Feature\x20limit\x20exceeded'},_0x1eab62=await getToken();if(!_0x1eab62)throw new Error(_0x57b978['UcVhe']);const _0xae492d=getApiBaseUrl(),_0x1cae9b=await fetch(_0xae492d+_0x553bba(0x12d),{'method':_0x57b978['TIPJI'],'headers':{'Authorization':_0x553bba(0x11c)+_0x1eab62,'Content-Type':_0x57b978[_0x553bba(0x101)]},'body':JSON['stringify'](_0x2a1c4b)});if(!_0x1cae9b['ok']){if(_0x57b978['jWsBW'](_0x1cae9b[_0x553bba(0x11f)],0x192)){const _0xbf29c9=await _0x1cae9b['json'](),_0x4f5a8c=_0xbf29c9[_0x553bba(0xeb)]||_0x57b978[_0x553bba(0x126)];throw new Error((_0xbf29c9[_0x553bba(0x123)]||_0x57b978['XfbOc'])+_0x553bba(0x10a)+_0x4f5a8c);}const _0x3ecf11=await _0x1cae9b['text']();throw new Error('Failed\x20to\x20create\x20feature\x20review:\x20'+_0x3ecf11);}return _0x1cae9b['json']();}export async function listFeatures(_0x2ef00d){const _0x3b6a67=_0x5158,_0x1a8e08={'NRvHq':_0x3b6a67(0x10b),'cfQmd':'gitBranch','gGZzF':'true','AtGwt':'GET'},_0x487f8d=await getToken();if(!_0x487f8d)throw new Error(_0x1a8e08[_0x3b6a67(0x116)]);const _0xdcadf7=getApiBaseUrl(),_0x2760f6=new URLSearchParams();if(_0x2ef00d?.[_0x3b6a67(0xfd)])_0x2760f6[_0x3b6a67(0xef)]('gitRepoUrl',_0x2ef00d['gitRepoUrl']);if(_0x2ef00d?.['gitBranch'])_0x2760f6[_0x3b6a67(0xef)](_0x1a8e08[_0x3b6a67(0x10e)],_0x2ef00d[_0x3b6a67(0x119)]);if(_0x2ef00d?.['limit'])_0x2760f6['set']('limit',_0x2ef00d[_0x3b6a67(0x132)][_0x3b6a67(0x133)]());if(_0x2ef00d?.['offset'])_0x2760f6['set']('offset',_0x2ef00d['offset']['toString']());if(_0x2ef00d?.['includeDeleted'])_0x2760f6[_0x3b6a67(0xef)]('includeDeleted',_0x1a8e08['gGZzF']);const _0x353b90=_0xdcadf7+'/api/v1/mcp/features'+(_0x2760f6[_0x3b6a67(0x133)]()?'?'+_0x2760f6['toString']():''),_0x17f235=await fetch(_0x353b90,{'method':_0x1a8e08['AtGwt'],'headers':{'Authorization':_0x3b6a67(0x11c)+_0x487f8d}});if(!_0x17f235['ok']){const _0x81ea80=await _0x17f235['text']();throw new Error('Failed\x20to\x20list\x20feature\x20reviews:\x20'+_0x81ea80);}return _0x17f235[_0x3b6a67(0x129)]();}export async function getFeature(_0x1f43e0){const _0x5f207f=_0x5158,_0x22313d={'dRoIa':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','sEGXp':function(_0x4a6f6a,_0x1d61b9,_0x3f06d4){return _0x4a6f6a(_0x1d61b9,_0x3f06d4);}},_0xaf74df=await getToken();if(!_0xaf74df)throw new Error(_0x22313d['dRoIa']);const _0x2df858=getApiBaseUrl(),_0x4188b6=await _0x22313d[_0x5f207f(0xec)](fetch,_0x2df858+'/api/v1/mcp/features/'+_0x1f43e0,{'method':_0x5f207f(0x12f),'headers':{'Authorization':'Bearer\x20'+_0xaf74df}});if(!_0x4188b6['ok']){const _0x1e92ff=await _0x4188b6[_0x5f207f(0x10f)]();throw new Error(_0x5f207f(0x12c)+_0x1e92ff);}return _0x4188b6['json']();}export async function updateFeature(_0xa084dc,_0x14534b){const _0x2a56cb=_0x5158,_0x58f042={'qqEcj':function(_0x224c3f,_0x154b50,_0x383042){return _0x224c3f(_0x154b50,_0x383042);},'AcpYF':_0x2a56cb(0xf8),'BWlVj':_0x2a56cb(0xee)},_0x24cacc=await getToken();if(!_0x24cacc)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x30b022=getApiBaseUrl(),_0x33d407=await _0x58f042['qqEcj'](fetch,_0x30b022+'/api/v1/mcp/features/'+_0xa084dc,{'method':_0x58f042[_0x2a56cb(0xff)],'headers':{'Authorization':_0x2a56cb(0x11c)+_0x24cacc,'Content-Type':_0x58f042['BWlVj']},'body':JSON[_0x2a56cb(0x113)](_0x14534b)});if(!_0x33d407['ok']){const _0x1c8fd5=await _0x33d407['text']();throw new Error('Failed\x20to\x20update\x20feature\x20review:\x20'+_0x1c8fd5);}return _0x33d407[_0x2a56cb(0x129)]();}export async function createChecklistItem(_0x1d50d9,_0x59cf14,_0x5c2678){const _0x4467a5=_0x5158,_0x5ac4aa={'bNqHc':function(_0x380781){return _0x380781();},'KysCN':'POST'},_0x1579ef=await _0x5ac4aa[_0x4467a5(0x12e)](getToken);if(!_0x1579ef)throw new Error(_0x4467a5(0x10b));const _0x306c55=getApiBaseUrl(),_0x468465=await fetch(_0x306c55+'/api/v1/mcp/features/'+_0x1d50d9+'/checklist',{'method':_0x5ac4aa[_0x4467a5(0x100)],'headers':{'Authorization':_0x4467a5(0x11c)+_0x1579ef,'Content-Type':'application/json'},'body':JSON['stringify']({'description':_0x59cf14,'position':_0x5c2678})});if(!_0x468465['ok']){const _0x42014e=await _0x468465['text']();throw new Error(_0x4467a5(0x120)+_0x42014e);}return _0x468465['json']();}export async function updateChecklistItem(_0x2bea41,_0x10f327,_0x7087ff){const _0x49712f={'QtpOn':function(_0x12871f){return _0x12871f();},'HjSPs':function(_0x52555e){return _0x52555e();},'WaiTU':'updateChecklistItem'};return withRetry(async()=>{const _0x39ad6c=_0x5158,_0x4474d9=await _0x49712f['QtpOn'](getToken);if(!_0x4474d9)throw new Error(_0x39ad6c(0x10b));const _0x15287d=_0x49712f[_0x39ad6c(0x105)](getApiBaseUrl),_0x528f0b=await fetch(_0x15287d+_0x39ad6c(0x131)+_0x2bea41+_0x39ad6c(0x12a)+_0x10f327,{'method':_0x39ad6c(0xf8),'headers':{'Authorization':_0x39ad6c(0x11c)+_0x4474d9,'Content-Type':_0x39ad6c(0xee)},'body':JSON['stringify'](_0x7087ff)});if(!_0x528f0b['ok']){const _0x54bb9d=await _0x528f0b[_0x39ad6c(0x10f)]();throw new Error(_0x39ad6c(0x128)+_0x54bb9d);}return _0x528f0b[_0x39ad6c(0x129)]();},{'label':_0x49712f['WaiTU']});}export async function getFeatureReport(_0x30ffd5){const _0xef6a9d=_0x5158,_0x2080ca={'HzDQa':function(_0x5a6e8d,_0x4811fb,_0x2b6f09){return _0x5a6e8d(_0x4811fb,_0x2b6f09);}},_0x3f4a35=await getToken();if(!_0x3f4a35)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x536f0c=getApiBaseUrl(),_0x4fd873=await _0x2080ca[_0xef6a9d(0x11d)](fetch,_0x536f0c+'/api/v1/mcp/features/'+_0x30ffd5+_0xef6a9d(0xf7),{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x3f4a35}});if(!_0x4fd873['ok']){const _0x30acf6=await _0x4fd873[_0xef6a9d(0x10f)]();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x30acf6);}return _0x4fd873[_0xef6a9d(0x129)]();}export async function getFeatureReportMarkdown(_0x224d5d,_0x287f92){const _0x145ad2=_0x5158,_0x16f7ec={'OMFWK':function(_0x1bd5b8){return _0x1bd5b8();},'NOEvg':_0x145ad2(0x10b),'EfPvC':function(_0x5e63df,_0x24da4d){return _0x5e63df>_0x24da4d;},'KbGak':function(_0x3da565,_0x239c0c){return _0x3da565(_0x239c0c);},'Cuumc':'itemIds','VNPat':function(_0x2a2a4a,_0x3ee5a0){return _0x2a2a4a&&_0x3ee5a0;}},_0x2fe274=await _0x16f7ec[_0x145ad2(0x106)](getToken);if(!_0x2fe274)throw new Error(_0x16f7ec[_0x145ad2(0xf6)]);const _0x2d1a8b=_0x16f7ec[_0x145ad2(0x106)](getApiBaseUrl),_0x2fe3af=new URLSearchParams(),_0x5acd92=_0x16f7ec[_0x145ad2(0x102)](_0x287f92?.['itemIds']?.['length']??0x0,0x0),_0x4014fa=_0x16f7ec['KbGak'](Boolean,_0x287f92?.['sessionId']);_0x5acd92&&_0x287f92?.['itemIds']&&_0x2fe3af[_0x145ad2(0xef)](_0x16f7ec[_0x145ad2(0xfa)],_0x287f92[_0x145ad2(0x122)][_0x145ad2(0x121)](','));_0x4014fa&&_0x287f92?.[_0x145ad2(0x111)]&&_0x2fe3af['set']('sessionId',_0x287f92[_0x145ad2(0x111)]);_0x16f7ec['VNPat'](!_0x5acd92,!_0x4014fa)&&_0x287f92?.[_0x145ad2(0xfe)]&&_0x2fe3af[_0x145ad2(0xef)]('style',_0x287f92['style']);const _0x47493d=_0x2d1a8b+_0x145ad2(0x131)+_0x224d5d+_0x145ad2(0x124),_0x1e2129=''+_0x47493d+(_0x2fe3af[_0x145ad2(0x133)]()?'?'+_0x2fe3af[_0x145ad2(0x133)]():''),_0x2df1f7=await fetch(_0x1e2129,{'method':_0x145ad2(0x12f),'headers':{'Authorization':_0x145ad2(0x11c)+_0x2fe274}});if(!_0x2df1f7['ok']){const _0x48a413=await _0x2df1f7[_0x145ad2(0x10f)]();throw new Error(_0x145ad2(0x117)+_0x48a413);}return _0x2df1f7[_0x145ad2(0x10f)]();}export async function listFeatureSessions(_0x2fa566){const _0x27ad50=_0x5158,_0x2407cd={'UHHYW':_0x27ad50(0x10b),'UkVBC':function(_0x11209d,_0x196b90,_0x54a6b4){return _0x11209d(_0x196b90,_0x54a6b4);},'aapxO':'GET'},_0x2ba27b=await getToken();if(!_0x2ba27b)throw new Error(_0x2407cd['UHHYW']);const _0x97722=getApiBaseUrl(),_0x5ae5f0=await _0x2407cd['UkVBC'](fetch,_0x97722+_0x27ad50(0x131)+_0x2fa566+'/sessions',{'method':_0x2407cd[_0x27ad50(0x103)],'headers':{'Authorization':'Bearer\x20'+_0x2ba27b}});if(!_0x5ae5f0['ok']){const _0x24980c=await _0x5ae5f0[_0x27ad50(0x10f)]();throw new Error('Failed\x20to\x20list\x20sessions:\x20'+_0x24980c);}return _0x5ae5f0[_0x27ad50(0x129)]();}export async function startSession(_0x2f84b3,_0x3335c3){const _0x351795=_0x5158,_0x55e1a6={'xIxIo':function(_0x4d1350){return _0x4d1350();},'thXgy':_0x351795(0x114)},_0x25971d=await _0x55e1a6[_0x351795(0x125)](getToken);if(!_0x25971d)throw new Error(_0x351795(0x10b));const _0x3ca030=getApiBaseUrl(),_0x34b020=await fetch(_0x3ca030+_0x351795(0x131)+_0x2f84b3+'/sessions/'+_0x3335c3+'/start',{'method':_0x55e1a6['thXgy'],'headers':{'Authorization':_0x351795(0x11c)+_0x25971d}});if(!_0x34b020['ok']){const _0x25a472=await _0x34b020['text']();throw new Error('Failed\x20to\x20start\x20session:\x20'+_0x25a472);}return _0x34b020[_0x351795(0x129)]();}export async function concludeSession(_0x404233,_0x2f03bc){const _0x3b3b20=_0x5158,_0x51c203={'CLcyB':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x10e8db=await getToken();if(!_0x10e8db)throw new Error(_0x51c203['CLcyB']);const _0x5a2066=getApiBaseUrl(),_0x5ab550=await fetch(_0x5a2066+'/api/v1/mcp/features/'+_0x404233+_0x3b3b20(0xfc)+_0x2f03bc+_0x3b3b20(0x12b),{'method':_0x3b3b20(0x114),'headers':{'Authorization':'Bearer\x20'+_0x10e8db}});if(!_0x5ab550['ok']){const _0x689fe2=await _0x5ab550['text']();throw new Error('Failed\x20to\x20conclude\x20session:\x20'+_0x689fe2);}return _0x5ab550[_0x3b3b20(0x129)]();}export async function getActionItems(_0x5f0ee0){const _0x139827=_0x5158,_0x5b1e5d={'HfwUJ':function(_0x5a1e56){return _0x5a1e56();},'kdvgJ':function(_0x4d6059,_0x420b86,_0x492b4e){return _0x4d6059(_0x420b86,_0x492b4e);},'JpSvA':'GET'},_0x2ac7e5=await _0x5b1e5d['HfwUJ'](getToken);if(!_0x2ac7e5)throw new Error(_0x139827(0x10b));const _0x335399=_0x5b1e5d['HfwUJ'](getApiBaseUrl),_0x44b596=await _0x5b1e5d['kdvgJ'](fetch,_0x335399+_0x139827(0x131)+_0x5f0ee0+_0x139827(0xf9),{'method':_0x5b1e5d[_0x139827(0xed)],'headers':{'Authorization':'Bearer\x20'+_0x2ac7e5}});if(!_0x44b596['ok']){const _0x30caab=await _0x44b596['text']();throw new Error('Failed\x20to\x20get\x20action\x20items:\x20'+_0x30caab);}return _0x44b596[_0x139827(0x129)]();}export async function getItemFeedback(_0x38b885,_0x4c9428){const _0x31ae34=_0x5158,_0x1afd4b={'agiaq':function(_0x11e9cc){return _0x11e9cc();},'PorSa':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','DIhmq':function(_0x587032,_0x422fd8,_0x2aca7d){return _0x587032(_0x422fd8,_0x2aca7d);}},_0x1ad160=await _0x1afd4b[_0x31ae34(0xf1)](getToken);if(!_0x1ad160)throw new Error(_0x1afd4b['PorSa']);const _0x2883cf=getApiBaseUrl(),_0x2a1aae=await _0x1afd4b[_0x31ae34(0x108)](fetch,_0x2883cf+_0x31ae34(0x131)+_0x38b885+_0x31ae34(0xf5)+_0x4c9428+_0x31ae34(0x127),{'method':_0x31ae34(0x12f),'headers':{'Authorization':_0x31ae34(0x11c)+_0x1ad160}});if(!_0x2a1aae['ok']){const _0x2ef9c1=await _0x2a1aae[_0x31ae34(0x10f)]();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x2ef9c1);}return _0x2a1aae[_0x31ae34(0x129)]();}export async function markCommentsAddressed(_0x3d3329,_0x2042cb,_0x40aeb7){const _0x4e626f=_0x5158,_0x12b80f={'EdJBH':function(_0x124759){return _0x124759();},'aFNNe':function(_0x4af153,_0x22be60,_0x448ad1){return _0x4af153(_0x22be60,_0x448ad1);},'EzNax':'POST'},_0x222738=await getToken();if(!_0x222738)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x38d0c3=_0x12b80f['EdJBH'](getApiBaseUrl),_0xee4cba=await _0x12b80f[_0x4e626f(0x11a)](fetch,_0x38d0c3+'/api/v1/mcp/features/'+_0x3d3329+_0x4e626f(0x11e),{'method':_0x12b80f['EzNax'],'headers':{'Authorization':_0x4e626f(0x11c)+_0x222738,'Content-Type':'application/json'},'body':JSON['stringify']({'checklistItemId':_0x2042cb,'commentIds':_0x40aeb7})});if(!_0xee4cba['ok']){const _0x336965=await _0xee4cba['text']();throw new Error(_0x4e626f(0xf2)+_0x336965);}}export async function softDeleteFeature(_0xc10e62){const _0x308a4b=_0x5158,_0x21f2d9={'RIlrX':_0x308a4b(0x10b)},_0x33d987=await getToken();if(!_0x33d987)throw new Error(_0x21f2d9[_0x308a4b(0x130)]);const _0x562eca=getApiBaseUrl(),_0x2ac351=await fetch(_0x562eca+'/api/v1/mcp/features/'+_0xc10e62,{'method':_0x308a4b(0xf3),'headers':{'Authorization':_0x308a4b(0x11c)+_0x33d987}});if(!_0x2ac351['ok']){const _0x32e579=await _0x2ac351[_0x308a4b(0x10f)]();throw new Error('Failed\x20to\x20delete\x20feature\x20review:\x20'+_0x32e579);}}function _0x5158(_0xbdfbe2,_0x263d2f){_0xbdfbe2=_0xbdfbe2-0xeb;const _0x3e7b1b=_0x3e7b();let _0x51582f=_0x3e7b1b[_0xbdfbe2];return _0x51582f;}export async function restoreFeature(_0x40c51b){const _0x18a624=_0x5158,_0x1d3048={'ZnAhg':function(_0x58d3b0,_0x308d23,_0x4614a1){return _0x58d3b0(_0x308d23,_0x4614a1);}},_0x26aea4=await getToken();if(!_0x26aea4)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x11f377=getApiBaseUrl(),_0x3d1702=await _0x1d3048[_0x18a624(0x118)](fetch,_0x11f377+_0x18a624(0x131)+_0x40c51b+'/restore',{'method':_0x18a624(0x114),'headers':{'Authorization':'Bearer\x20'+_0x26aea4}});if(!_0x3d1702['ok']){const _0xf0d55b=await _0x3d1702[_0x18a624(0x10f)]();throw new Error(_0x18a624(0x110)+_0xf0d55b);}}
|