@ranger-testing/ranger-cli 3.1.5-alpha.aebd071-49 → 3.1.6-alpha.4287155-52
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 -1
- package/build/commands/utils/sessionCache.js +1 -1
- package/build/commands/utils/settings.js +1 -1
- package/build/commands/utils/skillContent.js +1 -1
- package/build/commands/utils/skills.js +1 -1
- package/build/commands/utils/stitchWebmFiles.js +1 -1
- package/build/commands/utils/telemetry.js +1 -1
- package/build/commands/utils/tokenRefresh.js +1 -1
- package/build/commands/utils/traceSnapshotMapper.js +1 -1
- package/build/commands/utils/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 +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x4cc66b=_0x33f5;(function(_0x3cae3c,_0x484026){const _0x16e8f1=_0x33f5,_0x559c09=_0x3cae3c();while(!![]){try{const _0xfb9191=parseInt(_0x16e8f1(0x1e2))/0x1*(-parseInt(_0x16e8f1(0x1d2))/0x2)+-parseInt(_0x16e8f1(0x21e))/0x3+parseInt(_0x16e8f1(0x270))/0x4+-parseInt(_0x16e8f1(0x245))/0x5+-parseInt(_0x16e8f1(0x283))/0x6*(parseInt(_0x16e8f1(0x1d3))/0x7)+-parseInt(_0x16e8f1(0x1d9))/0x8*(parseInt(_0x16e8f1(0x26a))/0x9)+parseInt(_0x16e8f1(0x24c))/0xa;if(_0xfb9191===_0x484026)break;else _0x559c09['push'](_0x559c09['shift']());}catch(_0x300b72){_0x559c09['push'](_0x559c09['shift']());}}}(_0x20e1,0xcaea0));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x1e4fbc 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(_0xea255){const _0x2dab9a=_0x33f5,_0x298cf0={'KdmfL':_0x2dab9a(0x218)};try{return new URL(_0xea255)['host'];}catch{return _0x298cf0['KdmfL'];}}function errorMessageForTelemetry(_0x591474){const _0x2454e9=_0x33f5;return _0x591474 instanceof Error?_0x591474[_0x2454e9(0x24e)]:undefined;}function trackBridgeEvent(_0x434bbb,_0x348adf){const _0x2e28db=_0x33f5,_0xecbcf6={'sKPgh':_0x2e28db(0x1ff),'QtJNR':'local_ws_error'};if(!_0x434bbb)return;const _0x39cf9d={'tunnelSessionId':_0x348adf[_0x2e28db(0x1e5)],'tunnelEventType':_0x348adf[_0x2e28db(0x25e)],'connectionId':_0x348adf['connectionId'],'code':_0x348adf['code'],'reason':_0x348adf[_0x2e28db(0x25f)],'error':_0x348adf['error'],'elapsedMs':_0x348adf['elapsedMs'],'activeLocalConnections':_0x348adf[_0x2e28db(0x1fb)],'pendingLocalConnections':_0x348adf['pendingLocalConnections']};_0x434bbb['trackPhaseEnd']('tunnel_bridge_event',_0x39cf9d),(_0x348adf[_0x2e28db(0x25e)]===_0xecbcf6[_0x2e28db(0x23a)]||_0x348adf['type']===_0xecbcf6[_0x2e28db(0x258)])&&void _0x434bbb['trackPhaseError']('tunnel_bridge',new Error(_0x348adf['error']??_0x348adf['type']),_0x39cf9d);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x50021a={'HJZPN':function(_0x162688){return _0x162688();},'mUXUT':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0xfa01bb=await _0x50021a['HJZPN'](getToken);if(!_0xfa01bb)throw new Error(_0x50021a['mUXUT']);return _0xfa01bb;}async function apiRequest(_0x55c645,_0x24f839={}){const _0x5caf54=_0x33f5,_0x372b63={'xwMCa':function(_0x2cb77e){return _0x2cb77e();},'EgohG':'application/json','vYRLh':function(_0x198572,_0x27eb63){return _0x198572===_0x27eb63;},'EEpTB':_0x5caf54(0x271)},_0x2a280d=await _0x372b63['xwMCa'](requireToken),_0x18e5fe=getApiBaseUrl(),_0x1d3322=await fetch(''+_0x18e5fe+_0x55c645,{..._0x24f839,'headers':{'Authorization':_0x5caf54(0x269)+_0x2a280d,'Content-Type':_0x372b63[_0x5caf54(0x1dc)],..._0x24f839[_0x5caf54(0x27d)]??{}}});if(!_0x1d3322['ok']){let _0x2d9f32='',_0x208370;try{const _0x41571c=await _0x1d3322['json'](),_0x27af78=(typeof _0x41571c[_0x5caf54(0x1fe)]==='string'?_0x41571c[_0x5caf54(0x1fe)]:undefined)??JSON[_0x5caf54(0x1fa)](_0x41571c);_0x2d9f32=_0x27af78;_0x372b63['vYRLh'](typeof _0x41571c['test_output'],_0x5caf54(0x271))&&_0x41571c[_0x5caf54(0x1f6)]&&(_0x2d9f32=_0x2d9f32+'\x0a'+_0x41571c[_0x5caf54(0x1f6)]);if(typeof _0x41571c[_0x5caf54(0x25a)]===_0x372b63['EEpTB'])_0x208370=_0x41571c['code'];}catch{_0x2d9f32=_0x1d3322[_0x5caf54(0x225)];}throw new ApiError('API\x20request\x20'+_0x55c645+_0x5caf54(0x223)+_0x1d3322['status']+_0x5caf54(0x21f)+_0x2d9f32,_0x1d3322['status'],_0x2d9f32,_0x208370);}if(_0x1d3322['status']===0xcc)return undefined;return _0x1d3322[_0x5caf54(0x22b)]();}export class ApiError extends Error{['status'];[_0x4cc66b(0x259)];['code'];constructor(_0x29df18,_0x2b5af4,_0x44edcf,_0xb7cff0){const _0x536c0a=_0x4cc66b,_0x260e18={'PEUAb':'ApiError'};super(_0x29df18),this['status']=_0x2b5af4,this['detail']=_0x44edcf,this[_0x536c0a(0x25a)]=_0xb7cff0,this[_0x536c0a(0x1e4)]=_0x260e18[_0x536c0a(0x1f4)];}}export async function fetchCloudProfile(_0x92c461){const _0x4db117=_0x4cc66b,_0x15aacc={'XFbTr':function(_0x58783b,_0x48abdb){return _0x58783b(_0x48abdb);}};try{return await _0x15aacc['XFbTr'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x92c461));}catch(_0xf62e17){if(_0xf62e17 instanceof ApiError&&_0xf62e17[_0x4db117(0x1d5)]===0x194)return null;throw _0xf62e17;}}export async function listCloudProfiles(){const _0x3234a6=_0x4cc66b,_0x58cb28={'AyAFt':_0x3234a6(0x244)},_0x4010ce=await apiRequest(_0x58cb28[_0x3234a6(0x235)]);return _0x4010ce[_0x3234a6(0x26f)];}export async function deleteCloudProfile(_0x28c659){const _0x1f5c37=_0x4cc66b,_0x5e92af={'CwVDU':function(_0xb00e2b,_0x852278,_0x18823f){return _0xb00e2b(_0x852278,_0x18823f);},'dEnRs':function(_0x4b1ff9,_0x2fb6c8){return _0x4b1ff9 instanceof _0x2fb6c8;},'TDPHr':function(_0x474c73,_0x387b93){return _0x474c73===_0x387b93;}};try{await _0x5e92af[_0x1f5c37(0x23e)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x28c659),{'method':_0x1f5c37(0x247)});}catch(_0x432ff6){if(_0x5e92af['dEnRs'](_0x432ff6,ApiError)&&_0x5e92af[_0x1f5c37(0x272)](_0x432ff6[_0x1f5c37(0x1d5)],0x194))throw new Error(_0x1f5c37(0x261)+_0x28c659+_0x1f5c37(0x219));throw _0x432ff6;}}export async function createCloudProfile(_0x57004c,_0xe798be,_0x2d81ad={}){const _0x3eb182=_0x4cc66b,_0x438afb={'YkUVT':function(_0x193962,_0x34e85e){return _0x193962>_0x34e85e;},'NbGuJ':function(_0x3c21b3,_0x265f3,_0x5b252b){return _0x3c21b3(_0x265f3,_0x5b252b);},'GlWHT':'/api/v1/profiles','GHXCf':'POST'},_0x3f3813={'name':_0x57004c};if(_0xe798be)_0x3f3813[_0x3eb182(0x24b)]=_0xe798be;_0x2d81ad[_0x3eb182(0x23b)]&&_0x438afb['YkUVT'](Object['keys'](_0x2d81ad[_0x3eb182(0x23b)])['length'],0x0)&&(_0x3f3813[_0x3eb182(0x23b)]=_0x2d81ad['settings']);if(_0x2d81ad[_0x3eb182(0x1de)])_0x3f3813['username']=_0x2d81ad['username'];if(_0x2d81ad[_0x3eb182(0x257)])_0x3f3813[_0x3eb182(0x257)]=_0x2d81ad['password'];return await _0x438afb['NbGuJ'](apiRequest,_0x438afb['GlWHT'],{'method':_0x438afb[_0x3eb182(0x27e)],'body':JSON['stringify'](_0x3f3813)});}export async function uploadCloudProfileSession(_0x2f9ac4,_0xde6563){const _0x354ca2=_0x4cc66b,_0x5eac73={'sIRSa':function(_0x9968c5,_0x26ac09,_0x2497bd){return _0x9968c5(_0x26ac09,_0x2497bd);},'QQukE':function(_0x58a924,_0x2a5c66){return _0x58a924(_0x2a5c66);},'GadJR':_0x354ca2(0x1fd)};return await _0x5eac73['sIRSa'](apiRequest,'/api/v1/profiles/'+_0x5eac73['QQukE'](encodeURIComponent,_0x2f9ac4)+'/session',{'method':_0x5eac73['GadJR'],'body':JSON[_0x354ca2(0x1fa)]({'session_state':_0xde6563})});}export async function saveCloudProfileCredentials(_0x90e6c2,_0x6329fc,_0x582074){const _0x4e6b76=_0x4cc66b,_0x3988cc={'scpYx':function(_0x46cb25,_0x384d28,_0xd50340){return _0x46cb25(_0x384d28,_0xd50340);},'oSwzb':'PUT'};await _0x3988cc[_0x4e6b76(0x27b)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x90e6c2),{'method':_0x3988cc[_0x4e6b76(0x265)],'body':JSON[_0x4e6b76(0x1fa)]({'username':_0x6329fc,'password':_0x582074})});}export async function fetchAuthConfig(){const _0x174272=_0x4cc66b,_0x58bb19={'DgmYP':'/api/v1/profiles/auth-config','xUHHm':function(_0x1d741a,_0x1d393e){return _0x1d741a instanceof _0x1d393e;}};try{const _0xe03067=await apiRequest(_0x58bb19['DgmYP']);return _0xe03067['auth_config'];}catch(_0x269dab){return _0x58bb19[_0x174272(0x26d)](_0x269dab,ApiError)&&_0x269dab[_0x174272(0x1d5)]!==0x194&&console[_0x174272(0x1fe)]('\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20'+_0x269dab['message']),null;}}async function createTunnelSession(_0x5b2bbb){const _0x2044b0=_0x4cc66b,_0x4d47da={'xTsjT':function(_0x58aae5,_0x131320,_0x32fa49){return _0x58aae5(_0x131320,_0x32fa49);},'wBpwk':'POST'};return await _0x4d47da['xTsjT'](apiRequest,'/api/v1/tunnel/sessions',{'method':_0x4d47da['wBpwk'],'body':JSON['stringify']({'targetUrl':_0x5b2bbb,'mode':_0x2044b0(0x210)})});}async function deleteTunnelSession(_0x428fbf){const _0x1b2b01=_0x4cc66b,_0x5b75e8={'vKqDj':function(_0x487bc8,_0x5c0c60,_0x5750cf){return _0x487bc8(_0x5c0c60,_0x5750cf);},'MdiOf':_0x1b2b01(0x247)};await _0x5b75e8[_0x1b2b01(0x275)](apiRequest,'/api/v1/tunnel/sessions/'+_0x428fbf,{'method':_0x5b75e8[_0x1b2b01(0x255)]});}export function pickAdHocEnvKey(_0x29a3dc,_0x34d830,_0x131ed5){const _0x443678=_0x4cc66b,_0x5733db={'zkOcr':function(_0x18d5db,_0x2a055b){return _0x18d5db+_0x2a055b;},'UOQsO':function(_0x2f7e35,_0x4bdc05,_0xae39de){return _0x2f7e35(_0x4bdc05,_0xae39de);},'YXxHm':function(_0x199f6b,_0x5de071){return _0x199f6b in _0x5de071;},'VMnWR':'key','spvcP':function(_0x3c1b19,_0x5b4af3){return _0x3c1b19 in _0x5b4af3;},'yBPwD':function(_0x14a684,_0x32de7a){return _0x14a684+_0x32de7a;},'AWXqc':function(_0x18d5e1,_0x3605d3){return _0x18d5e1+_0x3605d3;},'UWLly':function(_0x4198a4,_0x60bc03){return _0x4198a4===_0x60bc03;},'cGzPg':function(_0x208ffd,_0x67f4){return _0x208ffd+_0x67f4;}};if(_0x131ed5){if(!_0x29a3dc?.['environments']?.[_0x131ed5]){const _0x4f097c=Object['keys'](_0x29a3dc?.['environments']??{});throw new Error(_0x5733db['zkOcr'](_0x5733db['zkOcr']('Auth\x20environment\x20\x22'+_0x131ed5+'\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.',_0x4f097c[_0x443678(0x22a)]?'\x20Available:\x20'+_0x4f097c[_0x443678(0x206)](',\x20')+'.':_0x443678(0x1fc)),'\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)'));}return _0x131ed5;}if(!_0x29a3dc)return null;if(_0x34d830){const _0x156cb3=matchAuthEnvironmentExact(_0x34d830,_0x29a3dc);if(_0x156cb3)return _0x156cb3;const _0x1934bb=_0x5733db[_0x443678(0x20c)](matchAuthEnvironmentByHost,_0x34d830,_0x29a3dc);if(_0x1934bb&&_0x5733db['YXxHm'](_0x5733db[_0x443678(0x24f)],_0x1934bb))return console['log']('\x20\x20Auth\x20env\x20\x22'+_0x1934bb[_0x443678(0x221)]+_0x443678(0x273)+_0x34d830+_0x443678(0x260)),_0x1934bb[_0x443678(0x221)];if(_0x1934bb&&_0x5733db[_0x443678(0x21c)]('ambiguous',_0x1934bb))throw new Error('Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20('+_0x1934bb['ambiguous'][_0x443678(0x206)](',\x20')+_0x443678(0x1f9));if(needsTunnel(_0x34d830))throw new Error(_0x5733db[_0x443678(0x249)](_0x5733db['zkOcr'](_0x5733db['AWXqc'](_0x443678(0x220)+_0x34d830+'\x22.\x0a','\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a'),'\x20\x20Options:\x0a')+_0x443678(0x1ea)+('\x20\x20-\x20ask\x20your\x20Ranger\x20admin\x20to\x20add\x20\x22'+_0x34d830[_0x443678(0x23c)](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a'),_0x443678(0x27a)+_0x34d830+_0x443678(0x227)));}if(_0x29a3dc[_0x443678(0x266)])return _0x29a3dc['defaultEnvironmentKey'];const _0x2ed76f=Object[_0x443678(0x236)](_0x29a3dc[_0x443678(0x215)]??{});if(_0x5733db['UWLly'](_0x2ed76f[_0x443678(0x22a)],0x1))return _0x2ed76f[0x0];if(_0x2ed76f[_0x443678(0x22a)]===0x0)return null;throw new Error(_0x5733db[_0x443678(0x278)](_0x443678(0x207)+_0x2ed76f[_0x443678(0x206)](',\x20')+_0x443678(0x1d6),'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>`.'));}function _0x20e1(){const _0x1b7cfb=['\x20\x20Server-side\x20login\x20error:\x20','env','agent','force','envKey','clientIp','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','environments','/api/v1/profiles/','RANGER_TEST_USERNAME','invalid-url','\x22\x20not\x20found.','\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','NvbuS','spvcP','push','390501EUecdZ','):\x20','No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22','key','telemetry','\x20failed\x20(','organizationId','statusText','\x22;\x20using\x20\x22','\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.','CmATx','\x22,\x20refreshing\x20session...','length','json','/login','jMpsR','close','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','QmdFX','true','setupHeaders','bAcie','storageStatePath','AyAFt','keys','\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22','DbJwo','tunnel','sKPgh','settings','replace','newContext','CwVDU','\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','TlzyB','invalidateOn','uTAbO','then','/api/v1/profiles','7505760YYvAqa','BWVqM','DELETE','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','yBPwD','tunnel_login_cleanup','environment_key','59131540WHSIkx','poIHu','message','VMnWR','Xtjsz','target_url','PfIgt','\x20\x20Cloud\x20profile\x20\x22','pwEndpoint','MdiOf','not_configured','password','QtJNR','detail','code','\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','VefhX','\x20\x20Login\x20successful.\x20Session\x20cached.','type','reason','\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).','Cloud\x20profile\x20\x22','fdnVT','effectiveBaseUrl','cookies','oSwzb','defaultEnvironmentKey','ebvNz','sessionCheckPath','Bearer\x20','1104489OdqeiD','PBCmP','newPage','xUHHm','domains','profiles','116852emFIif','string','TDPHr','\x22\x20matched\x20by\x20host\x20for\x20','XGrSM','vKqDj','PUT','Browser\x20login\x20timed\x20out\x20before\x20completion.','cGzPg','catch','\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20','scpYx','toLowerCase','headers','GHXCf','pw_endpoint','JWZwt','targetUrl','session_state','138ZDVYPw','\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22','VwYIF','\x22,\x20attempting\x20login...','FkhuN','xpOKr','utf-8','60fyPXdO','226807yxhuDa','\x20\x20No\x20live\x20session\x20for\x20\x22','status',').\x20','\x22\x20instead.','loginInstructions','72CJZkQD','trackPhaseEnd','origin','EgohG','\x22\x20on\x20profile\x20\x22','username','KIxtX','userAgent','\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22','54340wDdDsE','isArray','name','sessionId','\x20\x20forceLogin\x20enabled\x20for\x20\x22','tunnel_login_request','persistSessionState','baseUrl','\x20\x20-\x20pass\x20`--env\x20<key>`\x20to\x20pick\x20the\x20auth\x20environment\x20by\x20name,\x20or\x0a','wsEndpoint','launch','XSiDx','environmentKey','RANGER_TEST_PASSWORD','\x22\x20failed\x20validation\x20—\x20re-login\x20needed...','sessionState','you\x27re\x20now\x20at\x20\x22','/session','PEUAb','HNrNP','test_output','DwUlY','trackPhaseStart',');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.','stringify','activeLocalConnections','\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.','POST','error','tunnel_error','deBIf','trackPhaseError','kiqcm','tunnel_login_setup','yiiQo','\x22\x20failed\x20validation\x20—\x20refreshing...','join','Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20(','vXdmo','hpruR','log','IvBPv','UOQsO','wzklJ'];_0x20e1=function(){return _0x1b7cfb;};return _0x20e1();}export function adHocProfileName(_0x564b51,_0x211118,_0x3e5efd){if(!_0x211118||_0x211118===_0x3e5efd)return _0x564b51;return _0x564b51+':'+_0x211118;}export async function resolveAdHocProfile(_0x2278de={},_0x6dde34=process[_0x4cc66b(0x20f)]){const _0x4141e7=_0x4cc66b,_0x47f9ee={'plaDx':function(_0x193a1b,_0xc73c5a){return _0x193a1b&&_0xc73c5a;},'bAcie':function(_0x1c0a94,_0x3f3d5b){return _0x1c0a94!==_0x3f3d5b;},'iYeJr':'none','PBCmP':function(_0x3c9678,_0x488b8c){return _0x3c9678(_0x488b8c);},'JUXOe':function(_0x12335a,_0x439547,_0x5ab9d4,_0x59a1ca){return _0x12335a(_0x439547,_0x5ab9d4,_0x59a1ca);}},_0x3f7662=_0x6dde34[_0x4141e7(0x217)];if(!_0x3f7662)return null;const _0x53439f=await fetchAuthConfig(),_0x5da21f=pickAdHocEnvKey(_0x53439f,_0x2278de['targetUrl'],_0x2278de[_0x4141e7(0x212)]);let _0x11b699=adHocProfileName(_0x3f7662,_0x5da21f,_0x53439f?.['defaultEnvironmentKey']),_0x26e200=await fetchCloudProfile(_0x11b699);_0x47f9ee['plaDx'](_0x26e200,_0x5da21f)&&_0x47f9ee[_0x4141e7(0x233)](_0x26e200['environmentKey'],_0x5da21f)&&(console[_0x4141e7(0x20a)](_0x4141e7(0x253)+_0x11b699+_0x4141e7(0x1e1)+(_0x26e200['environmentKey']??_0x47f9ee['iYeJr'])+_0x4141e7(0x284)+_0x5da21f+_0x4141e7(0x226)+_0x3f7662+':'+_0x5da21f+_0x4141e7(0x1d7)),_0x11b699=_0x3f7662+':'+_0x5da21f,_0x26e200=await _0x47f9ee[_0x4141e7(0x26b)](fetchCloudProfile,_0x11b699));if(_0x26e200)return{'name':_0x26e200['name'],'profile':_0x26e200};const _0x103413=_0x6dde34['RANGER_TEST_PASSWORD'],_0x16a8b6=await _0x47f9ee['JUXOe'](createCloudProfile,_0x11b699,_0x5da21f??undefined,{'username':_0x3f7662,'password':_0x103413});return console[_0x4141e7(0x20a)]('\x20\x20Created\x20cloud\x20profile\x20\x22'+_0x16a8b6[_0x4141e7(0x1e4)]+'\x22\x20for\x20'+_0x3f7662+(_0x5da21f?'\x20(auth\x20env:\x20'+_0x5da21f+')':'')),{'name':_0x16a8b6['name'],'profile':_0x16a8b6};}export async function writeSessionToLocalCache(_0x2b4599,_0xda44c6,_0x580c46,_0x2f2a3a,_0x4fc22b,_0x5316bc,_0x30cd1b){const _0x487d87=_0x4cc66b,_0x14b094={'QmdFX':function(_0x34d4ac,_0x1396ff){return _0x34d4ac(_0x1396ff);},'DbJwo':function(_0x283701,_0xaaae58,_0x3f3c5d){return _0x283701(_0xaaae58,_0x3f3c5d);},'mxTlI':function(_0x381810){return _0x381810();},'CyTPS':'auth','poIHu':function(_0x487256,_0x344458){return _0x487256>_0x344458;},'SUJJw':function(_0x175226,_0x2fe2dc,_0x4d9e58){return _0x175226(_0x2fe2dc,_0x4d9e58);}},_0x3db42c=_0x14b094[_0x487d87(0x230)](sessionCacheHash,{'orgId':_0xda44c6,'profileName':_0x2b4599,'effectiveBaseUrl':_0x580c46,'setupHeaders':_0x2f2a3a,'invalidateOn':_0x30cd1b?.[_0x487d87(0x241)],'userAgent':_0x30cd1b?.['userAgent'],'clientIp':_0x30cd1b?.[_0x487d87(0x213)]}),_0x16ae64=_0x14b094[_0x487d87(0x238)](getSessionCachePath,_0x3db42c,_0x2b4599),_0x1064bc=_0x14b094[_0x487d87(0x238)](join,_0x14b094['mxTlI'](getRangerHomeDir),_0x14b094['CyTPS']);!_0x14b094['QmdFX'](existsSync,_0x1064bc)&&await mkdir(_0x1064bc,{'recursive':!![]});const _0x47de09={..._0x4fc22b};_0x5316bc&&_0x14b094[_0x487d87(0x24d)](_0x5316bc['length'],0x0)&&Array[_0x487d87(0x1e3)](_0x47de09[_0x487d87(0x264)])&&(_0x47de09[_0x487d87(0x264)]=_0x14b094['DbJwo'](duplicateCookiesForDomains,_0x47de09['cookies'],_0x5316bc));const _0x33707f={'cached_at':new Date()['toISOString'](),'session_state':_0x47de09};await _0x14b094['SUJJw'](writeFile,_0x16ae64,JSON['stringify'](_0x33707f,null,0x2));const _0x43d931=_0x14b094['QmdFX'](getStorageStatePath,_0x16ae64);return await writeFile(_0x43d931,JSON[_0x487d87(0x1fa)](_0x47de09,null,0x2)),_0x43d931;}export async function checkLocalCache(_0x6b85c8,_0x2d4d9c,_0x2d6845,_0x172cf5,_0x48175f){const _0x471e17=_0x4cc66b,_0x107c0e={'NvbuS':function(_0x3b63b5,_0x528b9e){return _0x3b63b5(_0x528b9e);},'KIxtX':function(_0x1e7c4d,_0x2c26ac,_0x278e71){return _0x1e7c4d(_0x2c26ac,_0x278e71);},'EcLUL':function(_0x125a10,_0x1ceb61){return _0x125a10(_0x1ceb61);},'OWYET':function(_0x8f2080,_0x31a68f){return _0x8f2080(_0x31a68f);},'BWVqM':_0x471e17(0x1d1)},_0x107864=_0x107c0e[_0x471e17(0x21b)](sessionCacheHash,{'orgId':_0x2d4d9c,'profileName':_0x6b85c8,'effectiveBaseUrl':_0x2d6845,'setupHeaders':_0x172cf5,'invalidateOn':_0x48175f?.[_0x471e17(0x241)],'userAgent':_0x48175f?.[_0x471e17(0x1e0)],'clientIp':_0x48175f?.['clientIp']}),_0x45c9db=_0x107c0e[_0x471e17(0x1df)](getSessionCachePath,_0x107864,_0x6b85c8),_0x592387=_0x107c0e['EcLUL'](getStorageStatePath,_0x45c9db);if(!_0x107c0e['EcLUL'](existsSync,_0x45c9db)||!_0x107c0e['OWYET'](existsSync,_0x592387))return null;try{const _0x4fc9a5=await readFile(_0x45c9db,_0x107c0e[_0x471e17(0x246)]);return JSON['parse'](_0x4fc9a5),{'storageStatePath':_0x592387};}catch{return null;}}function launchRealBrowser(){const _0x15ed88=_0x4cc66b;return chromium[_0x15ed88(0x1ec)]({'headless':!![]});}function emitSessionValidationHint(_0x5f1bd9,_0x2d3c55){const _0x556b37=_0x4cc66b,_0x4be72a={'ufesP':function(_0x29cda3,_0x3cc9d1){return _0x29cda3+_0x3cc9d1;}};if(!_0x2d3c55||!_0x2d3c55[_0x556b37(0x26e)]?.['length'])return;let _0x433c0f;try{_0x433c0f=new URL(_0x5f1bd9);}catch{return;}const _0x5577fa=[];for(const _0x448919 of _0x2d3c55[_0x556b37(0x26e)]){try{_0x5577fa[_0x556b37(0x21d)]({'raw':_0x448919,'url':new URL(_0x448919)});}catch{}}if(_0x5577fa[_0x556b37(0x22a)]===0x0)return;if(_0x5577fa['some'](_0x2295e4=>_0x2295e4['url'][_0x556b37(0x1db)]===_0x433c0f[_0x556b37(0x1db)]))return;const _0x22b89d=_0x5577fa['map'](_0xa968c3=>'\x22'+_0xa968c3['raw']+'\x22')['join'](',\x20');console['log'](_0x4be72a['ufesP']('\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20'+_0x22b89d+';\x20',_0x556b37(0x1f2)+_0x5f1bd9+'\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20')+_0x556b37(0x22f));}export async function serverSideLogin(_0x14f0b8,_0x108ab0){const _0x136c2b=_0x4cc66b,_0x120262={'rwzCo':function(_0x1e4671,_0x2da473,_0x1c3c2a){return _0x1e4671(_0x2da473,_0x1c3c2a);},'hbFmS':function(_0x3034a8,_0x34d1f1){return _0x3034a8 instanceof _0x34d1f1;},'deBIf':function(_0x11ed86,_0x280d54){return _0x11ed86===_0x280d54;}},_0x4a1e58=process[_0x136c2b(0x20f)][_0x136c2b(0x217)],_0x328d38=process[_0x136c2b(0x20f)][_0x136c2b(0x1ef)],_0x5a1de1={};if(_0x4a1e58)_0x5a1de1[_0x136c2b(0x1de)]=_0x4a1e58;if(_0x328d38)_0x5a1de1['password']=_0x328d38;if(_0x108ab0?.['force'])_0x5a1de1['force']=!![];if(_0x108ab0?.[_0x136c2b(0x281)])_0x5a1de1[_0x136c2b(0x251)]=_0x108ab0[_0x136c2b(0x281)];_0x108ab0?.['tunnel']&&(_0x5a1de1['tunnel_session_id']=_0x108ab0['tunnel']['sessionId'],_0x5a1de1[_0x136c2b(0x27f)]=_0x108ab0[_0x136c2b(0x239)][_0x136c2b(0x254)]);try{return await _0x120262['rwzCo'](apiRequest,_0x136c2b(0x216)+encodeURIComponent(_0x14f0b8)+_0x136c2b(0x22c),{'method':_0x136c2b(0x1fd),'body':JSON['stringify'](_0x5a1de1)});}catch(_0x4ef48a){if(_0x120262['hbFmS'](_0x4ef48a,ApiError)&&_0x120262['deBIf'](_0x4ef48a[_0x136c2b(0x1d5)],0x190)&&_0x120262[_0x136c2b(0x200)](_0x4ef48a[_0x136c2b(0x25a)],_0x136c2b(0x256)))return{'status':_0x136c2b(0x256),'error':_0x4ef48a['detail']};throw _0x4ef48a;}}async function serverSideLoginWithOptionalTunnel(_0x36b3b6,_0x989f12,_0x57f573={}){const _0x4d888a=_0x4cc66b,_0x10176b={'hpruR':_0x4d888a(0x1e7),'VwYIF':function(_0x41995d,_0x5962ee){return _0x41995d(_0x5962ee);},'Xtjsz':function(_0xeacf38,_0x1f5337){return _0xeacf38(_0x1f5337);},'dWGDx':function(_0x11f135,_0x50b0f6,_0x313341){return _0x11f135(_0x50b0f6,_0x313341);},'yiiQo':'tunnel_login_setup','IvBPv':_0x4d888a(0x21a),'EMrBm':function(_0x4c7f0f,_0x14aa95){return _0x4c7f0f(_0x14aa95);},'kiqcm':function(_0x14a5b2){return _0x14a5b2();},'XGrSM':function(_0xdea0e2,_0x32ef6c,_0x781302){return _0xdea0e2(_0x32ef6c,_0x781302);},'hWlJa':function(_0x1e16da,_0x3a2453){return _0x1e16da??_0x3a2453;},'TJqYU':function(_0x3aad02,_0x507565){return _0x3aad02??_0x507565;},'DzmBc':_0x4d888a(0x24a)};if(!_0x10176b['Xtjsz'](needsTunnel,_0x989f12))return await _0x10176b['dWGDx'](serverSideLogin,_0x36b3b6,{'force':_0x57f573['force']});let _0x21ef48=null,_0x320737=null,_0x3727cf=null,_0x378344=null,_0x5075b5=![];const _0x54c353=process[_0x4d888a(0x20f)]['RANGER_TUNNEL_LOGIN_HEADED']?.[_0x4d888a(0x27c)](),_0x2c47b5=_0x54c353==='1'||_0x54c353===_0x4d888a(0x231),_0x27f5bf={'profileName':_0x36b3b6,'targetUrlHost':targetHostForTelemetry(_0x989f12),'tunnelRequired':!![],'forceLogin':_0x10176b[_0x4d888a(0x285)](Boolean,_0x57f573[_0x4d888a(0x211)]),'localBrowserServerHeaded':_0x2c47b5};try{_0x57f573[_0x4d888a(0x222)]?.[_0x4d888a(0x1f8)](_0x10176b[_0x4d888a(0x204)],_0x27f5bf);_0x2c47b5&&console[_0x4d888a(0x20a)](_0x10176b[_0x4d888a(0x20b)]);_0x21ef48=await _0x10176b['Xtjsz'](launchBrowserServer,{'headless':!_0x2c47b5}),_0x320737=await _0x10176b['EMrBm'](createTunnelSession,_0x989f12);const _0x33b9f3=await _0x10176b[_0x4d888a(0x202)](requireToken);_0x3727cf=await _0x10176b[_0x4d888a(0x250)](createTunnelBridge,{'localWsUrl':_0x21ef48[_0x4d888a(0x1eb)],'tunnelServerUrl':_0x320737['tunnelUrl'],'sessionId':_0x320737[_0x4d888a(0x1e5)],'apiKey':_0x33b9f3,'onError':_0x163e1e=>{_0x378344=_0x163e1e;},'onClose':()=>{_0x378344??=new Error('Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20'+_0x36b3b6);},'onEvent':_0x4a3f99=>trackBridgeEvent(_0x57f573[_0x4d888a(0x222)],_0x4a3f99)}),_0x57f573['telemetry']?.[_0x4d888a(0x1da)](_0x10176b['yiiQo'],{..._0x27f5bf,'tunnelSessionId':_0x320737[_0x4d888a(0x1e5)],'localBrowserServer':!![],'localBrowserServerHeaded':_0x2c47b5}),_0x5075b5=!![];try{return _0x57f573['telemetry']?.[_0x4d888a(0x1f8)](_0x4d888a(0x1e7),{..._0x27f5bf,'tunnelSessionId':_0x320737[_0x4d888a(0x1e5)]}),await _0x10176b[_0x4d888a(0x274)](serverSideLogin,_0x36b3b6,{'force':_0x57f573[_0x4d888a(0x211)],'targetUrl':_0x989f12,'tunnel':{'sessionId':_0x320737[_0x4d888a(0x1e5)],'pwEndpoint':_0x320737['pwEndpoint']}})[_0x4d888a(0x243)](_0x4ac9eb=>{const _0x593b6d=_0x4d888a;return _0x57f573['telemetry']?.['trackPhaseEnd'](_0x10176b[_0x593b6d(0x209)],{..._0x27f5bf,'tunnelSessionId':_0x320737?.[_0x593b6d(0x1e5)],'loginStatus':_0x4ac9eb[_0x593b6d(0x1d5)],'hasSessionState':Boolean(_0x4ac9eb[_0x593b6d(0x282)]),'hasTestOutput':Boolean(_0x4ac9eb[_0x593b6d(0x1f6)]),'bridgeError':_0x10176b[_0x593b6d(0x285)](errorMessageForTelemetry,_0x378344)}),_0x4ac9eb;});}catch(_0x486349){await _0x57f573[_0x4d888a(0x222)]?.['trackPhaseError'](_0x10176b['hpruR'],_0x10176b['hWlJa'](_0x378344,_0x486349),{..._0x27f5bf,'tunnelSessionId':_0x320737['sessionId'],'bridgeError':_0x10176b['VwYIF'](errorMessageForTelemetry,_0x378344)});throw _0x10176b['TJqYU'](_0x378344,_0x486349);}}catch(_0x572d55){!_0x5075b5&&await _0x57f573['telemetry']?.[_0x4d888a(0x201)](_0x4d888a(0x203),_0x572d55,{..._0x27f5bf,'tunnelSessionId':_0x320737?.[_0x4d888a(0x1e5)]});throw _0x572d55;}finally{(_0x320737||_0x21ef48||_0x3727cf)&&(_0x57f573[_0x4d888a(0x222)]?.[_0x4d888a(0x1f8)](_0x10176b['DzmBc'],{..._0x27f5bf,'tunnelSessionId':_0x320737?.[_0x4d888a(0x1e5)]}),_0x3727cf?.[_0x4d888a(0x22e)](),_0x21ef48&&await _0x21ef48[_0x4d888a(0x22e)]()['catch'](()=>{}),_0x320737&&await _0x10176b['EMrBm'](deleteTunnelSession,_0x320737[_0x4d888a(0x1e5)])[_0x4d888a(0x279)](()=>{}),_0x57f573['telemetry']?.[_0x4d888a(0x1da)](_0x10176b['DzmBc'],{..._0x27f5bf,'tunnelSessionId':_0x320737?.['sessionId']}));}}export async function manualBrowserLogin(_0x38c5fc,_0x35dd7c,_0x5857ed={}){const _0xfbf4b0=_0x4cc66b,_0x51ff3e={'wzklJ':'close','PfIgt':function(_0x4fc465,_0x3102d6){return _0x4fc465+_0x3102d6;},'rLMfw':_0xfbf4b0(0x25b),'DwUlY':'or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','fdnVT':function(_0xd2df30,_0x2b5bcd){return _0xd2df30>_0x2b5bcd;},'jMpsR':'about:blank','FkhuN':function(_0x495fb6,_0x40b42b){return _0x495fb6(_0x40b42b);},'qkYWm':function(_0x5175d4,_0x5b2bdd){return _0x5175d4&&_0x5b2bdd;},'JWZwt':_0xfbf4b0(0x277),'umaGb':function(_0x532654,_0x32b0a5){return _0x532654!==_0x32b0a5;},'GIZIL':function(_0x50eb0e,_0x4f48e6,_0x2c4b67){return _0x50eb0e(_0x4f48e6,_0x2c4b67);}};if(!isInteractive())throw new Error(_0x51ff3e[_0xfbf4b0(0x252)]('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x38c5fc['name']+'\x22.\x0a'+_0x51ff3e['rLMfw'],_0x51ff3e[_0xfbf4b0(0x1f7)]));const _0x3439b7=_0x35dd7c&&_0x51ff3e[_0xfbf4b0(0x262)](_0x35dd7c['domains'][_0xfbf4b0(0x22a)],0x0)?_0x35dd7c[_0xfbf4b0(0x26e)][0x0]:_0x51ff3e[_0xfbf4b0(0x22d)];console[_0xfbf4b0(0x20a)](_0xfbf4b0(0x23f)),console[_0xfbf4b0(0x20a)]('\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a'),await new Promise(_0x282367=>setTimeout(_0x282367,0x7d0));const _0x273b8b=await chromium['launch']({'headless':![]});let _0x443267=null;try{const _0x588478={'ignoreHTTPSErrors':!![]};_0x35dd7c?.['setupHeaders']&&(_0x588478['extraHTTPHeaders']=_0x35dd7c[_0xfbf4b0(0x232)]);const _0x47a7a8=await _0x273b8b[_0xfbf4b0(0x23d)](_0x588478);await _0x51ff3e[_0xfbf4b0(0x287)](addProfileSetupBanner,_0x47a7a8);const _0x1cc08b=await _0x47a7a8[_0xfbf4b0(0x26c)]();await _0x1cc08b['goto'](_0x3439b7);let _0x1c4790=![];await new Promise(_0x18562a=>{const _0xadd19=_0xfbf4b0,_0x57041a={'cCzYi':function(_0x3080da,_0x178efd){return _0x3080da/_0x178efd;},'uheCZ':function(_0x13cc36){return _0x13cc36();}},_0x499c17=setTimeout(()=>{const _0x418acf=_0x33f5;_0x1c4790=!![],console[_0x418acf(0x1fe)]('Browser\x20login\x20timed\x20out\x20after\x20'+_0x57041a['cCzYi'](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x57041a['uheCZ'](_0x18562a);},MANUAL_LOGIN_TIMEOUT_MS);_0x1cc08b['on'](_0x51ff3e[_0xadd19(0x20d)],async()=>{clearTimeout(_0x499c17);try{const _0xcbcd3d=await _0x47a7a8['storageState']();_0x443267=_0xcbcd3d;}catch{}_0x18562a();});});if(_0x51ff3e['qkYWm'](_0x1c4790,!_0x443267))throw new Error(_0x51ff3e[_0xfbf4b0(0x280)]);}finally{await _0x273b8b[_0xfbf4b0(0x22e)]()['catch'](()=>{});}if(!_0x443267)throw new Error('Browser\x20closed\x20before\x20authentication\x20was\x20saved.');return _0x51ff3e['umaGb'](_0x5857ed[_0xfbf4b0(0x1e8)],![])&&await _0x51ff3e['GIZIL'](apiRequest,'/api/v1/profiles/'+_0x51ff3e[_0xfbf4b0(0x287)](encodeURIComponent,_0x38c5fc[_0xfbf4b0(0x1e4)])+_0xfbf4b0(0x1f3),{'method':'POST','body':JSON[_0xfbf4b0(0x1fa)]({'session_state':_0x443267,'updated_by':'cli:manual-login'})}),{'sessionState':_0x443267};}function _0x33f5(_0x41dcbe,_0x4f11fd){_0x41dcbe=_0x41dcbe-0x1d1;const _0x20e12d=_0x20e1();let _0x33f587=_0x20e12d[_0x41dcbe];return _0x33f587;}export async function promptSaveCredentials(_0x5a7579){const _0x496f53=_0x4cc66b,_0x4d0579={'xpOKr':function(_0x5e708a){return _0x5e708a();},'ebvNz':function(_0x458802,_0x194bbc,_0x1cd69d){return _0x458802(_0x194bbc,_0x1cd69d);},'cHDzx':function(_0x434018,_0x559538){return _0x434018(_0x559538);},'HNrNP':_0x496f53(0x276),'mmhiV':'\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.'},_0x4f63f1=process['env']['RANGER_TEST_USERNAME'],_0x33507d=process[_0x496f53(0x20f)]['RANGER_TEST_PASSWORD'];if(!_0x4f63f1||!_0x33507d)return;if(!_0x4d0579[_0x496f53(0x288)](isInteractive))return;const {save:_0x4ced7e}=await _0x1e4fbc['prompt']([{'type':'confirm','name':'save','message':'Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','default':![]}]);if(!_0x4ced7e)return;await _0x4d0579[_0x496f53(0x267)](apiRequest,'/api/v1/profiles/'+_0x4d0579['cHDzx'](encodeURIComponent,_0x5a7579),{'method':_0x4d0579[_0x496f53(0x1f5)],'body':JSON['stringify']({'username':_0x4f63f1,'password':_0x33507d})}),console[_0x496f53(0x20a)](_0x4d0579['mmhiV']);}export async function resolveCloudProfileSession(_0xfd2698,_0x423968={}){const _0x556d0c=_0x4cc66b,_0x1d0d44={'uTAbO':function(_0x4c3acc){return _0x4c3acc();},'CmATx':function(_0x5baf7b,_0x14b620){return _0x5baf7b===_0x14b620;},'ELtzR':'string','TlzyB':function(_0x14f149,_0x30c410){return _0x14f149||_0x30c410;},'DLSNf':function(_0x51ea2c,_0x43d4ad){return _0x51ea2c(_0x43d4ad);},'BAJPw':function(_0x5b2235,_0x309dee){return _0x5b2235>_0x309dee;},'XSiDx':function(_0x4d2481,_0x54c30e,_0x3116f9,_0xa65b73,_0x5dfcb8){return _0x4d2481(_0x54c30e,_0x3116f9,_0xa65b73,_0x5dfcb8);},'VefhX':function(_0x558e07,_0x316f3f,_0x525340){return _0x558e07(_0x316f3f,_0x525340);},'vXdmo':function(_0x2e684a,_0xa128fe){return _0x2e684a(_0xa128fe);},'UPXga':function(_0x4354cb,_0x1384fb){return _0x4354cb||_0x1384fb;},'AOHPa':'success','YefCu':_0x556d0c(0x25d),'TXgnp':function(_0x4d4ee7,_0x54e98d,_0x45d28f,_0x5cd623,_0x18bba2,_0x1a793d,_0xf82340,_0x59140e){return _0x4d4ee7(_0x54e98d,_0x45d28f,_0x5cd623,_0x18bba2,_0x1a793d,_0xf82340,_0x59140e);},'Tutug':function(_0x206808,_0x5d0e1a,_0x282632,_0x8fd12a){return _0x206808(_0x5d0e1a,_0x282632,_0x8fd12a);}},_0x824d0a=_0xfd2698['settings']??{},_0x3d3b66=await _0x1d0d44[_0x556d0c(0x242)](fetchAuthConfig),_0x256294=_0x3d3b66?resolveAuthEnvironmentLocally(_0x3d3b66,_0xfd2698[_0x556d0c(0x1ee)]):null,_0x48fb92=typeof _0x256294?.[_0x556d0c(0x1d8)]==='string'&&_0x256294[_0x556d0c(0x1d8)]['trim']()?_0x256294[_0x556d0c(0x1d8)]:undefined,_0x19db88=_0x1d0d44[_0x556d0c(0x228)](typeof _0x824d0a['loginInstructions'],_0x1d0d44['ELtzR'])&&_0x824d0a[_0x556d0c(0x1d8)]['trim']()?_0x824d0a[_0x556d0c(0x1d8)]:undefined,_0x3f2457=_0x1d0d44[_0x556d0c(0x240)](_0x19db88,!_0x48fb92)?_0x824d0a:{..._0x824d0a,'loginInstructions':_0x48fb92},_0x5ce403=Boolean(_0x3f2457[_0x556d0c(0x1d8)]?.['trim']()),_0x4bca58=_0x1d0d44['DLSNf'](Boolean,_0x824d0a['forceLogin']||_0x256294?.['forceLogin']),_0x47b886=_0x256294?.[_0x556d0c(0x26e)],_0x180991=_0x824d0a[_0x556d0c(0x232)],_0x3a5414=_0x180991??_0x256294?.[_0x556d0c(0x232)],_0x345236=_0x423968[_0x556d0c(0x263)]??_0x824d0a[_0x556d0c(0x1e9)]??(_0x47b886&&_0x1d0d44['BAJPw'](_0x47b886['length'],0x0)?_0x47b886[0x0]:''),_0x16fdf0=_0x345236?_0x1d0d44['DLSNf'](needsTunnel,_0x345236):![],_0x131675={'invalidateOn':_0x256294?.['invalidateOn'],'userAgent':_0x256294?.['browserOptions']?.[_0x556d0c(0x1e0)]??_0x824d0a['userAgent']};_0x4bca58&&console['log'](_0x556d0c(0x1e6)+_0xfd2698['name']+_0x556d0c(0x229));if(!_0x4bca58){const _0x1cc384=await checkLocalCache(_0xfd2698[_0x556d0c(0x1e4)],_0xfd2698[_0x556d0c(0x224)],_0x345236,_0x3a5414,_0x131675);if(_0x1cc384){if(_0x345236&&!_0x16fdf0){const _0x286482=await _0x1d0d44[_0x556d0c(0x1ed)](isCachedSessionLive,_0x1cc384['storageStatePath'],_0x345236,{'sessionCheckPath':_0x256294?.['sessionCheckPath'],'setupHeaders':_0x3a5414},{'launchBrowser':launchRealBrowser});if(_0x286482)return console['log'](_0x556d0c(0x237)+_0xfd2698['name']+'\x22'),{'authPath':_0x1cc384['storageStatePath'],'settings':_0x3f2457,'resolvedEnv':_0x256294};console[_0x556d0c(0x20a)]('\x20\x20Cached\x20session\x20for\x20\x22'+_0xfd2698[_0x556d0c(0x1e4)]+_0x556d0c(0x205)),emitSessionValidationHint(_0x345236,_0x256294);}else return _0x16fdf0&&console[_0x556d0c(0x20a)]('\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22'+_0xfd2698['name']+'\x22'),{'authPath':_0x1cc384[_0x556d0c(0x234)],'settings':_0x3f2457,'resolvedEnv':_0x256294};}}if(!_0x4bca58&&_0xfd2698[_0x556d0c(0x1f1)]){if(_0x16fdf0)console[_0x556d0c(0x20a)]('\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22'+_0x345236+_0x556d0c(0x1dd)+_0xfd2698['name']+'\x22');else{const _0x144150=await writeSessionToLocalCache(_0xfd2698['name'],_0xfd2698[_0x556d0c(0x224)],_0x345236,_0x3a5414,_0xfd2698[_0x556d0c(0x1f1)],_0x47b886,_0x131675);if(_0x345236){const _0x379c15=await isCachedSessionLive(_0x144150,_0x345236,{'sessionCheckPath':_0x256294?.[_0x556d0c(0x268)],'setupHeaders':_0x3a5414},{'launchBrowser':launchRealBrowser});if(_0x379c15)return console['log']('\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22'+_0xfd2698[_0x556d0c(0x1e4)]+'\x22,\x20cached\x20locally'),{'authPath':_0x144150,'settings':_0x3f2457,'resolvedEnv':_0x256294};console['log']('\x20\x20Cloud\x20session\x20for\x20\x22'+_0xfd2698['name']+_0x556d0c(0x1f0)),_0x1d0d44[_0x556d0c(0x25c)](emitSessionValidationHint,_0x345236,_0x256294);}else return{'authPath':_0x144150,'settings':_0x3f2457,'resolvedEnv':_0x256294};}}if(_0x5ce403)return console['log'](_0x556d0c(0x1d4)+_0xfd2698[_0x556d0c(0x1e4)]+'\x22;\x20proceeding\x20with\x20loginInstructions.'),{'authPath':undefined,'settings':_0x3f2457,'resolvedEnv':_0x256294};console[_0x556d0c(0x20a)](_0x556d0c(0x1d4)+_0xfd2698[_0x556d0c(0x1e4)]+_0x556d0c(0x286));const _0x351f08=Boolean(process['env']['RANGER_TEST_USERNAME'])&&Boolean(process['env'][_0x556d0c(0x1ef)]),_0x1e5829=_0x1d0d44['vXdmo'](Boolean,_0xfd2698[_0x556d0c(0x1de)]);if(_0x1d0d44['UPXga'](_0x351f08,_0x1e5829))try{const _0x5cd318=_0x345236?await serverSideLoginWithOptionalTunnel(_0xfd2698[_0x556d0c(0x1e4)],_0x345236,{'force':_0x4bca58,'telemetry':_0x423968[_0x556d0c(0x222)]}):await _0x1d0d44['VefhX'](serverSideLogin,_0xfd2698[_0x556d0c(0x1e4)],{'force':_0x4bca58});if(_0x5cd318['status']==='not_configured')console['log']('\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...');else{if(_0x5cd318[_0x556d0c(0x1d5)]===_0x1d0d44['AOHPa']&&_0x5cd318[_0x556d0c(0x282)]){console[_0x556d0c(0x20a)](_0x1d0d44['YefCu']);const _0x42ba6e=await _0x1d0d44['TXgnp'](writeSessionToLocalCache,_0xfd2698[_0x556d0c(0x1e4)],_0xfd2698['organizationId'],_0x345236,_0x3a5414,_0x5cd318[_0x556d0c(0x282)],_0x47b886,_0x131675);return _0x351f08&&!_0x1e5829&&await promptSaveCredentials(_0xfd2698['name']),{'authPath':_0x42ba6e,'settings':_0x3f2457,'resolvedEnv':_0x256294};}else _0x5cd318['test_output']&&(console['log'](_0x556d0c(0x248)),console[_0x556d0c(0x20a)](_0x5cd318[_0x556d0c(0x1f6)])),console['log']('\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...');}}catch(_0x2225d4){console[_0x556d0c(0x20a)](_0x556d0c(0x20e)+(_0x2225d4 instanceof Error?_0x2225d4['message']:_0x1d0d44[_0x556d0c(0x208)](String,_0x2225d4))),console[_0x556d0c(0x20a)](_0x556d0c(0x214));}const _0x3a4298=_0x256294?{..._0x256294,'setupHeaders':_0x3a5414}:_0x345236?{'key':_0xfd2698[_0x556d0c(0x1ee)]??'','domains':[_0x345236],'setupHeaders':_0x3a5414}:null,{sessionState:_0x4c37fb}=await _0x1d0d44['Tutug'](manualBrowserLogin,_0xfd2698,_0x3a4298,{'persistSessionState':!_0x16fdf0}),_0x2aed33=await writeSessionToLocalCache(_0xfd2698['name'],_0xfd2698['organizationId'],_0x345236,_0x3a5414,_0x4c37fb,_0x47b886,_0x131675);return{'authPath':_0x2aed33,'settings':_0x3f2457,'resolvedEnv':_0x256294};}
|
|
1
|
+
const _0x565d18=_0x5bca;(function(_0x20e7f8,_0x39e7bc){const _0x2f44ea=_0x5bca,_0x31dc35=_0x20e7f8();while(!![]){try{const _0x2c773e=-parseInt(_0x2f44ea(0x18c))/0x1*(-parseInt(_0x2f44ea(0x12f))/0x2)+parseInt(_0x2f44ea(0x12a))/0x3+parseInt(_0x2f44ea(0x169))/0x4*(parseInt(_0x2f44ea(0x15a))/0x5)+parseInt(_0x2f44ea(0x14a))/0x6*(parseInt(_0x2f44ea(0x19f))/0x7)+-parseInt(_0x2f44ea(0x1b6))/0x8+-parseInt(_0x2f44ea(0x155))/0x9*(parseInt(_0x2f44ea(0x132))/0xa)+parseInt(_0x2f44ea(0x17a))/0xb*(-parseInt(_0x2f44ea(0x170))/0xc);if(_0x2c773e===_0x39e7bc)break;else _0x31dc35['push'](_0x31dc35['shift']());}catch(_0x24908c){_0x31dc35['push'](_0x31dc35['shift']());}}}(_0x5c2e,0x787d7));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x4e7c15 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(_0x51d1bc){const _0x5b9542=_0x5bca;try{return new URL(_0x51d1bc)[_0x5b9542(0x1a3)];}catch{return _0x5b9542(0x148);}}function errorMessageForTelemetry(_0x4d837){const _0x15f58b=_0x5bca,_0x1d95aa={'AKRCX':function(_0x3499ce,_0x448998){return _0x3499ce instanceof _0x448998;}};return _0x1d95aa[_0x15f58b(0x141)](_0x4d837,Error)?_0x4d837[_0x15f58b(0x192)]:undefined;}function trackBridgeEvent(_0x4c6952,_0x48287b){const _0x25e78d=_0x5bca,_0x3f175c={'nByeH':_0x25e78d(0x18a),'ltqSh':function(_0x22370e,_0x104a9d){return _0x22370e===_0x104a9d;},'PVhME':'local_ws_error'};if(!_0x4c6952)return;const _0x3f18e1={'tunnelSessionId':_0x48287b[_0x25e78d(0x179)],'tunnelEventType':_0x48287b['type'],'connectionId':_0x48287b['connectionId'],'code':_0x48287b[_0x25e78d(0x193)],'reason':_0x48287b[_0x25e78d(0x1cd)],'error':_0x48287b['error'],'elapsedMs':_0x48287b['elapsedMs'],'activeLocalConnections':_0x48287b['activeLocalConnections'],'pendingLocalConnections':_0x48287b['pendingLocalConnections']};_0x4c6952[_0x25e78d(0x13e)]('tunnel_bridge_event',_0x3f18e1),(_0x48287b['type']===_0x3f175c['nByeH']||_0x3f175c[_0x25e78d(0x1cb)](_0x48287b[_0x25e78d(0x197)],_0x3f175c['PVhME']))&&void _0x4c6952[_0x25e78d(0x1cf)]('tunnel_bridge',new Error(_0x48287b['error']??_0x48287b[_0x25e78d(0x197)]),_0x3f18e1);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x5b5e9d=_0x5bca,_0x2ec817={'dEbue':function(_0x81f524){return _0x81f524();},'vbkbC':_0x5b5e9d(0x157)},_0x54fb62=await _0x2ec817['dEbue'](getToken);if(!_0x54fb62)throw new Error(_0x2ec817[_0x5b5e9d(0x17f)]);return _0x54fb62;}async function apiRequest(_0x339e9a,_0x1defee={}){const _0x5a5158=_0x5bca,_0x2dba09={'PjRth':function(_0x363543){return _0x363543();},'MVKJV':function(_0x10927e,_0x1a8c93){return _0x10927e===_0x1a8c93;},'UmQoN':_0x5a5158(0x14b)},_0x37587e=await requireToken(),_0x5aab1f=_0x2dba09['PjRth'](getApiBaseUrl),_0xebbf8b=await fetch(''+_0x5aab1f+_0x339e9a,{..._0x1defee,'headers':{'Authorization':_0x5a5158(0x195)+_0x37587e,'Content-Type':_0x5a5158(0x183),..._0x1defee[_0x5a5158(0x159)]??{}}});if(!_0xebbf8b['ok']){let _0x297e9a='',_0x324e8d;try{const _0x446232=await _0xebbf8b['json'](),_0x21829d=(_0x2dba09[_0x5a5158(0x14d)](typeof _0x446232[_0x5a5158(0x15d)],'string')?_0x446232[_0x5a5158(0x15d)]:undefined)??JSON['stringify'](_0x446232);_0x297e9a=_0x21829d;typeof _0x446232['test_output']===_0x2dba09['UmQoN']&&_0x446232['test_output']&&(_0x297e9a=_0x297e9a+'\x0a'+_0x446232[_0x5a5158(0x15e)]);if(_0x2dba09['MVKJV'](typeof _0x446232['code'],_0x2dba09[_0x5a5158(0x1d3)]))_0x324e8d=_0x446232['code'];}catch{_0x297e9a=_0xebbf8b[_0x5a5158(0x190)];}throw new ApiError('API\x20request\x20'+_0x339e9a+_0x5a5158(0x177)+_0xebbf8b['status']+'):\x20'+_0x297e9a,_0xebbf8b['status'],_0x297e9a,_0x324e8d);}if(_0x2dba09[_0x5a5158(0x14d)](_0xebbf8b[_0x5a5158(0x17d)],0xcc))return undefined;return _0xebbf8b['json']();}export class ApiError extends Error{['status'];[_0x565d18(0x1bb)];[_0x565d18(0x193)];constructor(_0x44c329,_0x319601,_0x12ad4e,_0x28a8f1){const _0xcdee69=_0x565d18;super(_0x44c329),this[_0xcdee69(0x17d)]=_0x319601,this['detail']=_0x12ad4e,this['code']=_0x28a8f1,this['name']=_0xcdee69(0x180);}}export async function fetchCloudProfile(_0x58da57){const _0x3a1c2a={'BlRIX':function(_0x6fe2a7,_0x4ee0fe){return _0x6fe2a7===_0x4ee0fe;}};try{return await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x58da57));}catch(_0x3bb5b8){if(_0x3bb5b8 instanceof ApiError&&_0x3a1c2a['BlRIX'](_0x3bb5b8['status'],0x194))return null;throw _0x3bb5b8;}}export async function listCloudProfiles(){const _0x4eb234=_0x565d18,_0x2b9aec={'prVMq':function(_0x5f2478,_0x5e8c34){return _0x5f2478(_0x5e8c34);},'RYPJM':_0x4eb234(0x15f)},_0x1256fc=await _0x2b9aec[_0x4eb234(0x1c7)](apiRequest,_0x2b9aec['RYPJM']);return _0x1256fc['profiles'];}export async function deleteCloudProfile(_0xea9889){const _0x32cb60=_0x565d18,_0x1723f9={'yCvdS':function(_0x5f0617,_0x3c8216,_0x2034ad){return _0x5f0617(_0x3c8216,_0x2034ad);},'lQAPk':'DELETE','ssfKE':function(_0x2d586b,_0x13a562){return _0x2d586b instanceof _0x13a562;}};try{await _0x1723f9[_0x32cb60(0x1bf)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0xea9889),{'method':_0x1723f9[_0x32cb60(0x18f)]});}catch(_0x40de25){if(_0x1723f9[_0x32cb60(0x1c1)](_0x40de25,ApiError)&&_0x40de25['status']===0x194)throw new Error(_0x32cb60(0x1d2)+_0xea9889+_0x32cb60(0x147));throw _0x40de25;}}export async function createCloudProfile(_0x5ed048,_0x3b69ed,_0x1449e6={}){const _0x336e02=_0x565d18,_0x430d4f={'owXCT':'/api/v1/profiles','TsXiP':_0x336e02(0x13f)},_0x4591f1={'name':_0x5ed048};if(_0x3b69ed)_0x4591f1['environment_key']=_0x3b69ed;_0x1449e6[_0x336e02(0x1af)]&&Object[_0x336e02(0x1b3)](_0x1449e6[_0x336e02(0x1af)])['length']>0x0&&(_0x4591f1['settings']=_0x1449e6[_0x336e02(0x1af)]);if(_0x1449e6['username'])_0x4591f1[_0x336e02(0x1b2)]=_0x1449e6['username'];if(_0x1449e6[_0x336e02(0x130)])_0x4591f1[_0x336e02(0x130)]=_0x1449e6['password'];return await apiRequest(_0x430d4f['owXCT'],{'method':_0x430d4f['TsXiP'],'body':JSON[_0x336e02(0x1d1)](_0x4591f1)});}export async function uploadCloudProfileSession(_0x5e369d,_0x1bb4ff){const _0x17a087=_0x565d18,_0x18f43d={'GsWMC':function(_0xc808dd,_0x368cc2){return _0xc808dd(_0x368cc2);},'nCKNC':'POST'};return await apiRequest(_0x17a087(0x1c6)+_0x18f43d['GsWMC'](encodeURIComponent,_0x5e369d)+'/session',{'method':_0x18f43d['nCKNC'],'body':JSON[_0x17a087(0x1d1)]({'session_state':_0x1bb4ff})});}export async function saveCloudProfileCredentials(_0x285923,_0x12be00,_0x168c09){const _0x27d6ac=_0x565d18,_0x395abf={'iUVgM':function(_0x449054,_0x898fac){return _0x449054(_0x898fac);}};await apiRequest(_0x27d6ac(0x1c6)+_0x395abf['iUVgM'](encodeURIComponent,_0x285923),{'method':'PUT','body':JSON[_0x27d6ac(0x1d1)]({'username':_0x12be00,'password':_0x168c09})});}export async function fetchAuthConfig(){const _0x26a4de=_0x565d18,_0x386465={'HciFP':function(_0x4b5d68,_0x424637){return _0x4b5d68(_0x424637);},'WsZcz':'/api/v1/profiles/auth-config','cknqL':function(_0x24d2c,_0x497482){return _0x24d2c instanceof _0x497482;},'SKVRB':function(_0x2d7e6d,_0x4f4b32){return _0x2d7e6d!==_0x4f4b32;}};try{const _0x272a7a=await _0x386465[_0x26a4de(0x154)](apiRequest,_0x386465[_0x26a4de(0x131)]);return _0x272a7a['auth_config'];}catch(_0x263ffe){return _0x386465[_0x26a4de(0x13c)](_0x263ffe,ApiError)&&_0x386465[_0x26a4de(0x13b)](_0x263ffe[_0x26a4de(0x17d)],0x194)&&console['error'](_0x26a4de(0x149)+_0x263ffe['message']),null;}}async function createTunnelSession(_0x58b9fc){const _0x5b6950=_0x565d18;return await apiRequest('/api/v1/tunnel/sessions',{'method':'POST','body':JSON[_0x5b6950(0x1d1)]({'targetUrl':_0x58b9fc,'mode':_0x5b6950(0x146)})});}async function deleteTunnelSession(_0x4a84ee){const _0x7355a5=_0x565d18,_0x1a5e90={'zpeMD':function(_0x1cf899,_0x221403,_0x5309ad){return _0x1cf899(_0x221403,_0x5309ad);}};await _0x1a5e90['zpeMD'](apiRequest,_0x7355a5(0x198)+_0x4a84ee,{'method':'DELETE'});}export function pickAdHocEnvKey(_0x282775,_0x8bce93,_0x42cfa2){const _0x213438=_0x565d18,_0x61635={'pIZQi':function(_0x65b697,_0x56e958){return _0x65b697+_0x56e958;},'MDlMt':function(_0x39c2fe,_0x2b29a5,_0x243dd1){return _0x39c2fe(_0x2b29a5,_0x243dd1);},'oxdYp':function(_0x2cd63b,_0x286b25){return _0x2cd63b in _0x286b25;},'EARUN':'ambiguous','QsgUT':function(_0x7d4a0a,_0x2b3f87){return _0x7d4a0a+_0x2b3f87;}};if(_0x42cfa2){if(!_0x282775?.['environments']?.[_0x42cfa2]){const _0x2f80c5=Object['keys'](_0x282775?.[_0x213438(0x196)]??{});throw new Error(_0x61635[_0x213438(0x173)]('Auth\x20environment\x20\x22'+_0x42cfa2+_0x213438(0x12b),_0x2f80c5[_0x213438(0x19c)]?'\x20Available:\x20'+_0x2f80c5[_0x213438(0x133)](',\x20')+'.':'\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.')+'\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)');}return _0x42cfa2;}if(!_0x282775)return null;if(_0x8bce93){const _0xdb103d=_0x61635['MDlMt'](matchAuthEnvironmentExact,_0x8bce93,_0x282775);if(_0xdb103d)return _0xdb103d;const _0x46a948=matchAuthEnvironmentByHost(_0x8bce93,_0x282775);if(_0x46a948&&_0x61635['oxdYp']('key',_0x46a948))return console['log']('\x20\x20Auth\x20env\x20\x22'+_0x46a948['key']+'\x22\x20matched\x20by\x20host\x20for\x20'+_0x8bce93+'\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).'),_0x46a948[_0x213438(0x144)];if(_0x46a948&&_0x61635[_0x213438(0x163)]in _0x46a948)throw new Error(_0x213438(0x175)+_0x46a948['ambiguous'][_0x213438(0x133)](',\x20')+');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.');if(needsTunnel(_0x8bce93))throw new Error(_0x61635[_0x213438(0x173)](_0x61635['pIZQi'](_0x61635[_0x213438(0x136)]('No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22'+_0x8bce93+'\x22.\x0a',_0x213438(0x1ab))+'\x20\x20Options:\x0a','\x20\x20-\x20pass\x20`--env\x20<key>`\x20to\x20pick\x20the\x20auth\x20environment\x20by\x20name,\x20or\x0a')+('\x20\x20-\x20ask\x20your\x20Ranger\x20admin\x20to\x20add\x20\x22'+_0x8bce93['replace'](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a'),_0x213438(0x1a2)+_0x8bce93+'\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.'));}if(_0x282775['defaultEnvironmentKey'])return _0x282775[_0x213438(0x171)];const _0x3c2045=Object[_0x213438(0x1b3)](_0x282775['environments']??{});if(_0x3c2045[_0x213438(0x19c)]===0x1)return _0x3c2045[0x0];if(_0x3c2045[_0x213438(0x19c)]===0x0)return null;throw new Error('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x3c2045['join'](',\x20')+').\x20'+'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>`.');}function _0x5bca(_0x2c490d,_0x577a01){_0x2c490d=_0x2c490d-0x127;const _0x5c2eb2=_0x5c2e();let _0x5bcac4=_0x5c2eb2[_0x2c490d];return _0x5bcac4;}export function adHocProfileName(_0x3146ec,_0x3d234b,_0x4c0c68){const _0xff9b33=_0x565d18,_0xcee47b={'bMjCf':function(_0x12abac,_0x11e64f){return _0x12abac===_0x11e64f;}};if(!_0x3d234b||_0xcee47b[_0xff9b33(0x1a8)](_0x3d234b,_0x4c0c68))return _0x3146ec;return _0x3146ec+':'+_0x3d234b;}function _0x5c2e(){const _0x58a4c2=['1340368qXsdTI','FQYNh','Browser\x20login\x20timed\x20out\x20after\x20','tunnel_session_id','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','detail','cookies','rrlnQ','\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','yCvdS','\x20\x20No\x20live\x20session\x20for\x20\x22','ssfKE','mgGDx','trackPhaseStart','RANGER_TEST_USERNAME','aVaSX','/api/v1/profiles/','prVMq','tunnel_login_setup','yViLs','xrvRH','ltqSh','RANGER_TEST_PASSWORD','reason','\x22\x20failed\x20validation\x20—\x20refreshing...','trackPhaseError','forceLogin','stringify','Cloud\x20profile\x20\x22','UmQoN','log','ERNZu','\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22','1000707gYMJgO','\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.','catch','\x22;\x20proceeding\x20with\x20loginInstructions.','tunnel_login_request','264HNDIKI','password','WsZcz','30asMKTn','join','fFFHD','aIMVE','QsgUT','DuwOP','pw_endpoint','hBmbS','Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20','SKVRB','cknqL','AtNAd','trackPhaseEnd','POST','lBWLK','AKRCX','VHYfR','\x22\x20failed\x20validation\x20—\x20re-login\x20needed...','key','clientIp','agent','\x22\x20not\x20found.','invalid-url','\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20','396174AwYgrX','string','cLhLH','MVKJV','\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22','\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.','KMNLp','force','organizationId','trim','HciFP','2259729XgJyHT','close','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','Browser\x20login\x20timed\x20out\x20before\x20completion.','headers','5NhEWnU','name','origin','error','test_output','/api/v1/profiles','session_state','\x22;\x20using\x20\x22','MWjyz','EARUN','BvXeu','telemetry','targetUrl','wsEndpoint','persistSessionState','3438980WcFnSo','Fhaie','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','JrCBb','pwEndpoint','ZUbeq','btarV','60icdJoJ','defaultEnvironmentKey','cxruS','pIZQi','setupHeaders','Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20(','loginInstructions','\x20failed\x20(','\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','sessionId','717596aWupxd','environmentKey','push','status','not_configured','vbkbC','ApiError','YIKsg','newContext','application/json','LinOA','IPRSL','tunnel_login_cleanup','raw','/session','fiUFI','tunnel_error','PUT','1144PWgDfd','userAgent','QwCsI','lQAPk','statusText','DqCkK','message','code','ctEjW','Bearer\x20','environments','type','/api/v1/tunnel/sessions/','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','iARQV','\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20','length','prompt','isArray','42NHXfke','env','url','\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20','host','storageState','invalidateOn','baseUrl','UZUnz','bMjCf','dHyUE','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a','\x22,\x20cached\x20locally','CDkDr','\x22\x20for\x20','settings','mPlBZ','pKGan','username','keys','Ttmks','yzuTm'];_0x5c2e=function(){return _0x58a4c2;};return _0x5c2e();}export async function resolveAdHocProfile(_0x52543c={},_0x7b769c=process[_0x565d18(0x1a0)]){const _0x53cb5c=_0x565d18,_0x6e4dc8={'Ttmks':function(_0x46237d){return _0x46237d();},'KMNLp':function(_0x1b15c7,_0x1cc8ce){return _0x1b15c7!==_0x1cc8ce;},'iLczx':'none','aVaSX':function(_0x44a168,_0x339970,_0x5db45d,_0x2c0170){return _0x44a168(_0x339970,_0x5db45d,_0x2c0170);},'jQhEZ':function(_0x4e4bdd,_0x5a9a2d){return _0x4e4bdd??_0x5a9a2d;}},_0xad5e63=_0x7b769c[_0x53cb5c(0x1c4)];if(!_0xad5e63)return null;const _0x1718c8=await _0x6e4dc8[_0x53cb5c(0x1b4)](fetchAuthConfig),_0x5655c7=pickAdHocEnvKey(_0x1718c8,_0x52543c[_0x53cb5c(0x166)],_0x52543c['envKey']);let _0x21e6df=adHocProfileName(_0xad5e63,_0x5655c7,_0x1718c8?.[_0x53cb5c(0x171)]),_0x45037b=await fetchCloudProfile(_0x21e6df);_0x45037b&&_0x5655c7&&_0x6e4dc8[_0x53cb5c(0x150)](_0x45037b['environmentKey'],_0x5655c7)&&(console[_0x53cb5c(0x127)]('\x20\x20Cloud\x20profile\x20\x22'+_0x21e6df+_0x53cb5c(0x129)+(_0x45037b[_0x53cb5c(0x17b)]??_0x6e4dc8['iLczx'])+'\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22'+_0x5655c7+_0x53cb5c(0x161)+_0xad5e63+':'+_0x5655c7+'\x22\x20instead.'),_0x21e6df=_0xad5e63+':'+_0x5655c7,_0x45037b=await fetchCloudProfile(_0x21e6df));if(_0x45037b)return{'name':_0x45037b[_0x53cb5c(0x15b)],'profile':_0x45037b};const _0x31534d=_0x7b769c[_0x53cb5c(0x1cc)],_0x2ec85d=await _0x6e4dc8[_0x53cb5c(0x1c5)](createCloudProfile,_0x21e6df,_0x6e4dc8['jQhEZ'](_0x5655c7,undefined),{'username':_0xad5e63,'password':_0x31534d});return console['log']('\x20\x20Created\x20cloud\x20profile\x20\x22'+_0x2ec85d[_0x53cb5c(0x15b)]+_0x53cb5c(0x1ae)+_0xad5e63+(_0x5655c7?'\x20(auth\x20env:\x20'+_0x5655c7+')':'')),{'name':_0x2ec85d['name'],'profile':_0x2ec85d};}export async function writeSessionToLocalCache(_0x56d46d,_0x4fc95b,_0x24534d,_0x37c289,_0x10b4ce,_0x1f98f3,_0x312447){const _0x9f54cd=_0x565d18,_0x3f2cd0={'mowGW':function(_0x50a3ab,_0x286ba5,_0x58c0cc){return _0x50a3ab(_0x286ba5,_0x58c0cc);},'aIMVE':function(_0x4c0011,_0x4ae1fa,_0x3f547d){return _0x4c0011(_0x4ae1fa,_0x3f547d);},'HGDMq':function(_0x332d16){return _0x332d16();},'IPRSL':'auth','jvwon':function(_0x44b172,_0x34a2c9){return _0x44b172(_0x34a2c9);},'AglUY':function(_0x520e97,_0x5f5651,_0x5252ae){return _0x520e97(_0x5f5651,_0x5252ae);}},_0x330ac4=sessionCacheHash({'orgId':_0x4fc95b,'profileName':_0x56d46d,'effectiveBaseUrl':_0x24534d,'setupHeaders':_0x37c289,'invalidateOn':_0x312447?.['invalidateOn'],'userAgent':_0x312447?.['userAgent'],'clientIp':_0x312447?.[_0x9f54cd(0x145)]}),_0x4f3aad=_0x3f2cd0['mowGW'](getSessionCachePath,_0x330ac4,_0x56d46d),_0x2aad7f=_0x3f2cd0[_0x9f54cd(0x135)](join,_0x3f2cd0['HGDMq'](getRangerHomeDir),_0x3f2cd0[_0x9f54cd(0x185)]);!_0x3f2cd0['jvwon'](existsSync,_0x2aad7f)&&await _0x3f2cd0['AglUY'](mkdir,_0x2aad7f,{'recursive':!![]});const _0x1ad516={..._0x10b4ce};_0x1f98f3&&_0x1f98f3[_0x9f54cd(0x19c)]>0x0&&Array[_0x9f54cd(0x19e)](_0x1ad516['cookies'])&&(_0x1ad516[_0x9f54cd(0x1bc)]=duplicateCookiesForDomains(_0x1ad516['cookies'],_0x1f98f3));const _0x2660bb={'cached_at':new Date()['toISOString'](),'session_state':_0x1ad516};await writeFile(_0x4f3aad,JSON[_0x9f54cd(0x1d1)](_0x2660bb,null,0x2));const _0x1b4c8a=getStorageStatePath(_0x4f3aad);return await writeFile(_0x1b4c8a,JSON['stringify'](_0x1ad516,null,0x2)),_0x1b4c8a;}export async function checkLocalCache(_0x46b074,_0x2a2ce7,_0x5b6060,_0x2d18d3,_0xa137e7){const _0x55345c=_0x565d18,_0x4e8365={'fXACA':function(_0x45d65f,_0x5e0e58){return _0x45d65f(_0x5e0e58);},'xrvRH':function(_0x45ab20,_0xf4e510){return _0x45ab20(_0xf4e510);},'rrlnQ':'utf-8'},_0x4f3c81=_0x4e8365['fXACA'](sessionCacheHash,{'orgId':_0x2a2ce7,'profileName':_0x46b074,'effectiveBaseUrl':_0x5b6060,'setupHeaders':_0x2d18d3,'invalidateOn':_0xa137e7?.[_0x55345c(0x1a5)],'userAgent':_0xa137e7?.['userAgent'],'clientIp':_0xa137e7?.[_0x55345c(0x145)]}),_0xb62019=getSessionCachePath(_0x4f3c81,_0x46b074),_0x1ba8db=getStorageStatePath(_0xb62019);if(!existsSync(_0xb62019)||!_0x4e8365[_0x55345c(0x1ca)](existsSync,_0x1ba8db))return null;try{const _0x4cb02c=await readFile(_0xb62019,_0x4e8365[_0x55345c(0x1bd)]);return JSON['parse'](_0x4cb02c),{'storageStatePath':_0x1ba8db};}catch{return null;}}function launchRealBrowser(){return chromium['launch']({'headless':!![]});}function emitSessionValidationHint(_0x431189,_0x504a24){const _0x5b3d18=_0x565d18,_0x2574a8={'hBmbS':function(_0x285448,_0xc777b4){return _0x285448+_0xc777b4;}};if(!_0x504a24||!_0x504a24['domains']?.['length'])return;let _0x192ad0;try{_0x192ad0=new URL(_0x431189);}catch{return;}const _0x454451=[];for(const _0x5cee39 of _0x504a24['domains']){try{_0x454451[_0x5b3d18(0x17c)]({'raw':_0x5cee39,'url':new URL(_0x5cee39)});}catch{}}if(_0x454451[_0x5b3d18(0x19c)]===0x0)return;if(_0x454451['some'](_0x38053e=>_0x38053e[_0x5b3d18(0x1a1)][_0x5b3d18(0x15c)]===_0x192ad0[_0x5b3d18(0x15c)]))return;const _0x42d828=_0x454451['map'](_0x2453d2=>'\x22'+_0x2453d2[_0x5b3d18(0x187)]+'\x22')[_0x5b3d18(0x133)](',\x20');console[_0x5b3d18(0x127)](_0x2574a8[_0x5b3d18(0x139)](_0x5b3d18(0x19b)+_0x42d828+';\x20'+('you\x27re\x20now\x20at\x20\x22'+_0x431189+'\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20'),_0x5b3d18(0x1ba)));}export async function serverSideLogin(_0x3456f8,_0x2dd443){const _0x228160=_0x565d18,_0x2f9f61={'gjNLx':function(_0x344762,_0xcf6ed9,_0x4b5168){return _0x344762(_0xcf6ed9,_0x4b5168);},'QwCsI':function(_0x1ff178,_0x5f2315){return _0x1ff178(_0x5f2315);},'yViLs':'POST','pXUaO':function(_0x17d648,_0x157880){return _0x17d648 instanceof _0x157880;},'QzSaq':function(_0x5cfaf4,_0x3772c4){return _0x5cfaf4===_0x3772c4;},'kkreN':_0x228160(0x17e)},_0x5beb82=process[_0x228160(0x1a0)][_0x228160(0x1c4)],_0x4db707=process['env'][_0x228160(0x1cc)],_0x416c6e={};if(_0x5beb82)_0x416c6e['username']=_0x5beb82;if(_0x4db707)_0x416c6e[_0x228160(0x130)]=_0x4db707;if(_0x2dd443?.[_0x228160(0x151)])_0x416c6e[_0x228160(0x151)]=!![];if(_0x2dd443?.[_0x228160(0x166)])_0x416c6e['target_url']=_0x2dd443['targetUrl'];_0x2dd443?.['tunnel']&&(_0x416c6e[_0x228160(0x1b9)]=_0x2dd443['tunnel'][_0x228160(0x179)],_0x416c6e[_0x228160(0x138)]=_0x2dd443['tunnel']['pwEndpoint']);try{return await _0x2f9f61['gjNLx'](apiRequest,'/api/v1/profiles/'+_0x2f9f61[_0x228160(0x18e)](encodeURIComponent,_0x3456f8)+'/login',{'method':_0x2f9f61[_0x228160(0x1c9)],'body':JSON['stringify'](_0x416c6e)});}catch(_0x1fd888){if(_0x2f9f61['pXUaO'](_0x1fd888,ApiError)&&_0x1fd888[_0x228160(0x17d)]===0x190&&_0x2f9f61['QzSaq'](_0x1fd888[_0x228160(0x193)],'not_configured'))return{'status':_0x2f9f61['kkreN'],'error':_0x1fd888[_0x228160(0x1bb)]};throw _0x1fd888;}}async function serverSideLoginWithOptionalTunnel(_0xf51ff,_0x38ebc2,_0x2310a5={}){const _0x345a6b=_0x565d18,_0x4367c8={'mPlBZ':function(_0x21b658,_0x1947d7){return _0x21b658(_0x1947d7);},'yzuTm':function(_0x4e50a1,_0xedf8e6,_0x2ba5a0){return _0x4e50a1(_0xedf8e6,_0x2ba5a0);},'dHyUE':'true','FQYNh':function(_0x449139,_0x564366){return _0x449139(_0x564366);},'wKoVG':function(_0x175b9c,_0x21c128){return _0x175b9c(_0x21c128);},'ctEjW':function(_0xf9a54d){return _0xf9a54d();},'njeUF':_0x345a6b(0x1c8),'ZUbeq':_0x345a6b(0x12e),'VxGil':_0x345a6b(0x186)};if(!needsTunnel(_0x38ebc2))return await _0x4367c8[_0x345a6b(0x1b5)](serverSideLogin,_0xf51ff,{'force':_0x2310a5[_0x345a6b(0x151)]});let _0x444436=null,_0x21c6fb=null,_0x3f9af5=null,_0x4220e3=null,_0x192d2e=![];const _0x48a640=process[_0x345a6b(0x1a0)]['RANGER_TUNNEL_LOGIN_HEADED']?.['toLowerCase'](),_0x572b73=_0x48a640==='1'||_0x48a640===_0x4367c8[_0x345a6b(0x1a9)],_0x4b5ff8={'profileName':_0xf51ff,'targetUrlHost':_0x4367c8[_0x345a6b(0x1b7)](targetHostForTelemetry,_0x38ebc2),'tunnelRequired':!![],'forceLogin':_0x4367c8[_0x345a6b(0x1b0)](Boolean,_0x2310a5[_0x345a6b(0x151)]),'localBrowserServerHeaded':_0x572b73};try{_0x2310a5[_0x345a6b(0x165)]?.[_0x345a6b(0x1c3)](_0x345a6b(0x1c8),_0x4b5ff8);_0x572b73&&console['log'](_0x345a6b(0x1be));_0x444436=await _0x4367c8['wKoVG'](launchBrowserServer,{'headless':!_0x572b73}),_0x21c6fb=await createTunnelSession(_0x38ebc2);const _0x56c5ef=await _0x4367c8[_0x345a6b(0x194)](requireToken);_0x3f9af5=await createTunnelBridge({'localWsUrl':_0x444436[_0x345a6b(0x167)],'tunnelServerUrl':_0x21c6fb['tunnelUrl'],'sessionId':_0x21c6fb[_0x345a6b(0x179)],'apiKey':_0x56c5ef,'onError':_0x67531=>{_0x4220e3=_0x67531;},'onClose':()=>{const _0x95122d=_0x345a6b;_0x4220e3??=new Error(_0x95122d(0x13a)+_0xf51ff);},'onEvent':_0x391efe=>trackBridgeEvent(_0x2310a5['telemetry'],_0x391efe)}),_0x2310a5['telemetry']?.['trackPhaseEnd'](_0x4367c8['njeUF'],{..._0x4b5ff8,'tunnelSessionId':_0x21c6fb['sessionId'],'localBrowserServer':!![],'localBrowserServerHeaded':_0x572b73}),_0x192d2e=!![];try{return _0x2310a5[_0x345a6b(0x165)]?.['trackPhaseStart'](_0x4367c8[_0x345a6b(0x16e)],{..._0x4b5ff8,'tunnelSessionId':_0x21c6fb[_0x345a6b(0x179)]}),await serverSideLogin(_0xf51ff,{'force':_0x2310a5[_0x345a6b(0x151)],'targetUrl':_0x38ebc2,'tunnel':{'sessionId':_0x21c6fb[_0x345a6b(0x179)],'pwEndpoint':_0x21c6fb[_0x345a6b(0x16d)]}})['then'](_0xc93bbe=>{const _0x50b34c=_0x345a6b;return _0x2310a5[_0x50b34c(0x165)]?.[_0x50b34c(0x13e)]('tunnel_login_request',{..._0x4b5ff8,'tunnelSessionId':_0x21c6fb?.['sessionId'],'loginStatus':_0xc93bbe[_0x50b34c(0x17d)],'hasSessionState':Boolean(_0xc93bbe[_0x50b34c(0x160)]),'hasTestOutput':_0x4367c8['mPlBZ'](Boolean,_0xc93bbe[_0x50b34c(0x15e)]),'bridgeError':_0x4367c8['mPlBZ'](errorMessageForTelemetry,_0x4220e3)}),_0xc93bbe;});}catch(_0x4c3575){await _0x2310a5['telemetry']?.[_0x345a6b(0x1cf)](_0x345a6b(0x12e),_0x4220e3??_0x4c3575,{..._0x4b5ff8,'tunnelSessionId':_0x21c6fb['sessionId'],'bridgeError':errorMessageForTelemetry(_0x4220e3)});throw _0x4220e3??_0x4c3575;}}catch(_0x4ce1ff){!_0x192d2e&&await _0x2310a5[_0x345a6b(0x165)]?.[_0x345a6b(0x1cf)](_0x4367c8['njeUF'],_0x4ce1ff,{..._0x4b5ff8,'tunnelSessionId':_0x21c6fb?.[_0x345a6b(0x179)]});throw _0x4ce1ff;}finally{(_0x21c6fb||_0x444436||_0x3f9af5)&&(_0x2310a5['telemetry']?.[_0x345a6b(0x1c3)](_0x345a6b(0x186),{..._0x4b5ff8,'tunnelSessionId':_0x21c6fb?.[_0x345a6b(0x179)]}),_0x3f9af5?.['close'](),_0x444436&&await _0x444436['close']()[_0x345a6b(0x12c)](()=>{}),_0x21c6fb&&await _0x4367c8[_0x345a6b(0x1b0)](deleteTunnelSession,_0x21c6fb['sessionId'])['catch'](()=>{}),_0x2310a5['telemetry']?.[_0x345a6b(0x13e)](_0x4367c8['VxGil'],{..._0x4b5ff8,'tunnelSessionId':_0x21c6fb?.[_0x345a6b(0x179)]}));}}export async function manualBrowserLogin(_0x162595,_0x3efa6b,_0x5978ba={}){const _0x361a02=_0x565d18,_0x1bc38b={'lBWLK':function(_0x332247,_0x147e50){return _0x332247/_0x147e50;},'fFFHD':function(_0x2d4aeb){return _0x2d4aeb();},'keNeu':function(_0x16c41e,_0x4b660e,_0x9d22d0){return _0x16c41e(_0x4b660e,_0x9d22d0);},'waeEZ':_0x361a02(0x156),'hhfCp':function(_0x28058c,_0x8280e3){return _0x28058c+_0x8280e3;},'YIKsg':'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','XlaIW':'or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','SRIqn':'about:blank','MWjyz':'\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','NGzvz':function(_0x127290,_0x4ffef7){return _0x127290(_0x4ffef7);},'eMNRT':function(_0x381cb1,_0x5b432a){return _0x381cb1&&_0x5b432a;},'PxEio':function(_0x130fcb,_0x59c732){return _0x130fcb!==_0x59c732;},'iARQV':function(_0x279386,_0x16dcd3,_0x5eb159){return _0x279386(_0x16dcd3,_0x5eb159);},'AtNAd':'POST','LinOA':'cli:manual-login'};if(!_0x1bc38b['fFFHD'](isInteractive))throw new Error(_0x1bc38b['hhfCp']('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x162595[_0x361a02(0x15b)]+'\x22.\x0a'+_0x1bc38b[_0x361a02(0x181)],_0x1bc38b['XlaIW']));const _0x10e104=_0x3efa6b&&_0x3efa6b['domains']['length']>0x0?_0x3efa6b['domains'][0x0]:_0x1bc38b['SRIqn'];console[_0x361a02(0x127)](_0x361a02(0x178)),console['log'](_0x1bc38b[_0x361a02(0x162)]),await new Promise(_0x22c299=>setTimeout(_0x22c299,0x7d0));const _0x32714e=await chromium['launch']({'headless':![]});let _0x2b8d2a=null;try{const _0x42de8c={'ignoreHTTPSErrors':!![]};_0x3efa6b?.[_0x361a02(0x174)]&&(_0x42de8c['extraHTTPHeaders']=_0x3efa6b['setupHeaders']);const _0x22fdb3=await _0x32714e[_0x361a02(0x182)](_0x42de8c);await _0x1bc38b['NGzvz'](addProfileSetupBanner,_0x22fdb3);const _0x18ca9a=await _0x22fdb3['newPage']();await _0x18ca9a['goto'](_0x10e104);let _0x53f9e6=![];await new Promise(_0x4180f6=>{const _0x23134a={'jZPil':function(_0x23d52c,_0x32504a){return _0x23d52c(_0x32504a);},'IziSN':function(_0x3819fc){return _0x1bc38b['fFFHD'](_0x3819fc);}},_0x2e41d5=_0x1bc38b['keNeu'](setTimeout,()=>{const _0x54f340=_0x5bca;_0x53f9e6=!![],console[_0x54f340(0x15d)](_0x54f340(0x1b8)+_0x1bc38b[_0x54f340(0x140)](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+_0x54f340(0x14f)),_0x1bc38b[_0x54f340(0x134)](_0x4180f6);},MANUAL_LOGIN_TIMEOUT_MS);_0x18ca9a['on'](_0x1bc38b['waeEZ'],async()=>{const _0x29e717=_0x5bca;_0x23134a['jZPil'](clearTimeout,_0x2e41d5);try{const _0x594f50=await _0x22fdb3[_0x29e717(0x1a4)]();_0x2b8d2a=_0x594f50;}catch{}_0x23134a['IziSN'](_0x4180f6);});});if(_0x1bc38b['eMNRT'](_0x53f9e6,!_0x2b8d2a))throw new Error(_0x361a02(0x158));}finally{await _0x32714e[_0x361a02(0x156)]()['catch'](()=>{});}if(!_0x2b8d2a)throw new Error(_0x361a02(0x16b));return _0x1bc38b['PxEio'](_0x5978ba[_0x361a02(0x168)],![])&&await _0x1bc38b[_0x361a02(0x19a)](apiRequest,_0x361a02(0x1c6)+encodeURIComponent(_0x162595['name'])+_0x361a02(0x188),{'method':_0x1bc38b[_0x361a02(0x13d)],'body':JSON[_0x361a02(0x1d1)]({'session_state':_0x2b8d2a,'updated_by':_0x1bc38b[_0x361a02(0x184)]})}),{'sessionState':_0x2b8d2a};}export async function promptSaveCredentials(_0xfec496){const _0x56ee93=_0x565d18,_0x4e4e2b={'DuwOP':function(_0x263b61){return _0x263b61();},'DZPGV':function(_0x5f269d,_0x4491de){return _0x5f269d(_0x4491de);},'lgSzw':'\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.'},_0x4f89a6=process['env']['RANGER_TEST_USERNAME'],_0xe40909=process['env'][_0x56ee93(0x1cc)];if(!_0x4f89a6||!_0xe40909)return;if(!_0x4e4e2b[_0x56ee93(0x137)](isInteractive))return;const {save:_0x3dfd40}=await _0x4e7c15[_0x56ee93(0x19d)]([{'type':'confirm','name':'save','message':'Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','default':![]}]);if(!_0x3dfd40)return;await apiRequest(_0x56ee93(0x1c6)+_0x4e4e2b['DZPGV'](encodeURIComponent,_0xfec496),{'method':_0x56ee93(0x18b),'body':JSON['stringify']({'username':_0x4f89a6,'password':_0xe40909})}),console['log'](_0x4e4e2b['lgSzw']);}export async function resolveCloudProfileSession(_0x2b14df,_0x581a66={}){const _0x1027e8=_0x565d18,_0x31f28e={'btarV':function(_0x2ba4ac,_0x170401,_0x21f771){return _0x2ba4ac(_0x170401,_0x21f771);},'CDkDr':function(_0x3fdf4d,_0x5bdb7b){return _0x3fdf4d===_0x5bdb7b;},'BvXeu':function(_0x380231,_0x180be7){return _0x380231||_0x180be7;},'HHgJg':function(_0x4c5271,_0x322fb0){return _0x4c5271(_0x322fb0);},'DqCkK':function(_0x50cc47,_0x18ef12){return _0x50cc47>_0x18ef12;},'oRaEz':function(_0x38d6b5,_0x356917){return _0x38d6b5(_0x356917);},'mgGDx':function(_0x251f84,_0x5006d7){return _0x251f84&&_0x5006d7;},'pKGan':function(_0x105ace,_0x3a9f13,_0x4ebda3,_0x5a4570,_0x5bf19e,_0x5ce025,_0x79433a,_0x53e5af){return _0x105ace(_0x3a9f13,_0x4ebda3,_0x5a4570,_0x5bf19e,_0x5ce025,_0x79433a,_0x53e5af);},'VHYfR':function(_0x52b98a,_0x1701bd,_0x4d6aa1,_0x53a080,_0x2cceb4){return _0x52b98a(_0x1701bd,_0x4d6aa1,_0x53a080,_0x2cceb4);},'MJvEX':function(_0x39c279,_0x4590ff,_0x56c026){return _0x39c279(_0x4590ff,_0x56c026);},'Fhaie':function(_0x5ad758,_0x5008ad){return _0x5ad758(_0x5008ad);},'jaojp':function(_0x54040c,_0x18c4a3,_0x43991e,_0xa6dc0c){return _0x54040c(_0x18c4a3,_0x43991e,_0xa6dc0c);},'cxruS':_0x1027e8(0x17e),'ERNZu':'\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','JrCBb':'success','fiUFI':function(_0x18e0f4,_0x2bb7e1){return _0x18e0f4&&_0x2bb7e1;},'cLhLH':function(_0x4ce03e,_0x47dfb6){return _0x4ce03e instanceof _0x47dfb6;},'bDlVK':_0x1027e8(0x199),'UZUnz':function(_0x2ae75b,_0x42f618,_0x691ba1,_0x1f5098){return _0x2ae75b(_0x42f618,_0x691ba1,_0x1f5098);}},_0x53239a=_0x2b14df[_0x1027e8(0x1af)]??{},_0x45b384=await fetchAuthConfig(),_0x471493=_0x45b384?_0x31f28e[_0x1027e8(0x16f)](resolveAuthEnvironmentLocally,_0x45b384,_0x2b14df['environmentKey']):null,_0x2c4b13=_0x31f28e[_0x1027e8(0x1ad)](typeof _0x471493?.['loginInstructions'],_0x1027e8(0x14b))&&_0x471493['loginInstructions']['trim']()?_0x471493[_0x1027e8(0x176)]:undefined,_0x45ccc7=typeof _0x53239a[_0x1027e8(0x176)]==='string'&&_0x53239a[_0x1027e8(0x176)][_0x1027e8(0x153)]()?_0x53239a[_0x1027e8(0x176)]:undefined,_0x20fb36=_0x31f28e[_0x1027e8(0x164)](_0x45ccc7,!_0x2c4b13)?_0x53239a:{..._0x53239a,'loginInstructions':_0x2c4b13},_0x5801c5=_0x31f28e['HHgJg'](Boolean,_0x20fb36[_0x1027e8(0x176)]?.[_0x1027e8(0x153)]()),_0xff5694=Boolean(_0x53239a[_0x1027e8(0x1d0)]||_0x471493?.['forceLogin']),_0x314722=_0x471493?.['domains'],_0x1fced1=_0x53239a['setupHeaders'],_0x57a9a0=_0x1fced1??_0x471493?.['setupHeaders'],_0x119a9a=_0x581a66['effectiveBaseUrl']??_0x53239a[_0x1027e8(0x1a6)]??(_0x314722&&_0x31f28e[_0x1027e8(0x191)](_0x314722['length'],0x0)?_0x314722[0x0]:''),_0xe0d79c=_0x119a9a?_0x31f28e['oRaEz'](needsTunnel,_0x119a9a):![],_0x2b845f={'invalidateOn':_0x471493?.[_0x1027e8(0x1a5)],'userAgent':_0x471493?.['browserOptions']?.['userAgent']??_0x53239a[_0x1027e8(0x18d)]};_0xff5694&&console[_0x1027e8(0x127)]('\x20\x20forceLogin\x20enabled\x20for\x20\x22'+_0x2b14df['name']+'\x22,\x20refreshing\x20session...');if(!_0xff5694){const _0x40a355=await checkLocalCache(_0x2b14df['name'],_0x2b14df[_0x1027e8(0x152)],_0x119a9a,_0x57a9a0,_0x2b845f);if(_0x40a355){if(_0x31f28e[_0x1027e8(0x1c2)](_0x119a9a,!_0xe0d79c)){const _0x36e68e=await isCachedSessionLive(_0x40a355['storageStatePath'],_0x119a9a,{'sessionCheckPath':_0x471493?.['sessionCheckPath'],'setupHeaders':_0x57a9a0},{'launchBrowser':launchRealBrowser});if(_0x36e68e)return console['log']('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x2b14df['name']+'\x22'),{'authPath':_0x40a355['storageStatePath'],'settings':_0x20fb36,'resolvedEnv':_0x471493};console['log']('\x20\x20Cached\x20session\x20for\x20\x22'+_0x2b14df[_0x1027e8(0x15b)]+_0x1027e8(0x1ce)),_0x31f28e['btarV'](emitSessionValidationHint,_0x119a9a,_0x471493);}else return _0xe0d79c&&console['log']('\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x2b14df[_0x1027e8(0x15b)]+'\x22'),{'authPath':_0x40a355['storageStatePath'],'settings':_0x20fb36,'resolvedEnv':_0x471493};}}if(!_0xff5694&&_0x2b14df['sessionState']){if(_0xe0d79c)console['log'](_0x1027e8(0x14e)+_0x119a9a+'\x22\x20on\x20profile\x20\x22'+_0x2b14df[_0x1027e8(0x15b)]+'\x22');else{const _0x967f37=await _0x31f28e[_0x1027e8(0x1b1)](writeSessionToLocalCache,_0x2b14df['name'],_0x2b14df[_0x1027e8(0x152)],_0x119a9a,_0x57a9a0,_0x2b14df['sessionState'],_0x314722,_0x2b845f);if(_0x119a9a){const _0xc07362=await _0x31f28e[_0x1027e8(0x142)](isCachedSessionLive,_0x967f37,_0x119a9a,{'sessionCheckPath':_0x471493?.['sessionCheckPath'],'setupHeaders':_0x57a9a0},{'launchBrowser':launchRealBrowser});if(_0xc07362)return console['log']('\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22'+_0x2b14df[_0x1027e8(0x15b)]+_0x1027e8(0x1ac)),{'authPath':_0x967f37,'settings':_0x20fb36,'resolvedEnv':_0x471493};console[_0x1027e8(0x127)]('\x20\x20Cloud\x20session\x20for\x20\x22'+_0x2b14df['name']+_0x1027e8(0x143)),_0x31f28e['MJvEX'](emitSessionValidationHint,_0x119a9a,_0x471493);}else return{'authPath':_0x967f37,'settings':_0x20fb36,'resolvedEnv':_0x471493};}}if(_0x5801c5)return console['log'](_0x1027e8(0x1c0)+_0x2b14df['name']+_0x1027e8(0x12d)),{'authPath':undefined,'settings':_0x20fb36,'resolvedEnv':_0x471493};console[_0x1027e8(0x127)]('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x2b14df[_0x1027e8(0x15b)]+'\x22,\x20attempting\x20login...');const _0x399210=Boolean(process[_0x1027e8(0x1a0)]['RANGER_TEST_USERNAME'])&&_0x31f28e[_0x1027e8(0x16a)](Boolean,process[_0x1027e8(0x1a0)][_0x1027e8(0x1cc)]),_0x1914a8=_0x31f28e['HHgJg'](Boolean,_0x2b14df[_0x1027e8(0x1b2)]);if(_0x31f28e['BvXeu'](_0x399210,_0x1914a8))try{const _0x4d624d=_0x119a9a?await _0x31f28e['jaojp'](serverSideLoginWithOptionalTunnel,_0x2b14df['name'],_0x119a9a,{'force':_0xff5694,'telemetry':_0x581a66[_0x1027e8(0x165)]}):await _0x31f28e[_0x1027e8(0x16f)](serverSideLogin,_0x2b14df[_0x1027e8(0x15b)],{'force':_0xff5694});if(_0x4d624d['status']===_0x31f28e[_0x1027e8(0x172)])console['log'](_0x31f28e[_0x1027e8(0x128)]);else{if(_0x4d624d['status']===_0x31f28e[_0x1027e8(0x16c)]&&_0x4d624d[_0x1027e8(0x160)]){console['log']('\x20\x20Login\x20successful.\x20Session\x20cached.');const _0x14b177=await writeSessionToLocalCache(_0x2b14df[_0x1027e8(0x15b)],_0x2b14df[_0x1027e8(0x152)],_0x119a9a,_0x57a9a0,_0x4d624d['session_state'],_0x314722,_0x2b845f);return _0x31f28e[_0x1027e8(0x189)](_0x399210,!_0x1914a8)&&await promptSaveCredentials(_0x2b14df['name']),{'authPath':_0x14b177,'settings':_0x20fb36,'resolvedEnv':_0x471493};}else _0x4d624d[_0x1027e8(0x15e)]&&(console['log'](_0x1027e8(0x1aa)),console[_0x1027e8(0x127)](_0x4d624d[_0x1027e8(0x15e)])),console[_0x1027e8(0x127)](_0x1027e8(0x199));}}catch(_0x3c090d){console['log']('\x20\x20Server-side\x20login\x20error:\x20'+(_0x31f28e[_0x1027e8(0x14c)](_0x3c090d,Error)?_0x3c090d[_0x1027e8(0x192)]:String(_0x3c090d))),console[_0x1027e8(0x127)](_0x31f28e['bDlVK']);}const _0x4f256b=_0x471493?{..._0x471493,'setupHeaders':_0x57a9a0}:_0x119a9a?{'key':_0x2b14df['environmentKey']??'','domains':[_0x119a9a],'setupHeaders':_0x57a9a0}:null,{sessionState:_0x3d3e7c}=await _0x31f28e[_0x1027e8(0x1a7)](manualBrowserLogin,_0x2b14df,_0x4f256b,{'persistSessionState':!_0xe0d79c}),_0xafb26f=await _0x31f28e['pKGan'](writeSessionToLocalCache,_0x2b14df[_0x1027e8(0x15b)],_0x2b14df[_0x1027e8(0x152)],_0x119a9a,_0x57a9a0,_0x3d3e7c,_0x314722,_0x2b845f);return{'authPath':_0xafb26f,'settings':_0x20fb36,'resolvedEnv':_0x471493};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const _0x4eab5a=_0x174a;(function(_0x57006a,_0x2e9e44){const _0xcfca48=_0x174a,_0x2f64cb=_0x57006a();while(!![]){try{const _0x2be16e=parseInt(_0xcfca48(0x166))/0x1+parseInt(_0xcfca48(0x15f))/0x2+-parseInt(_0xcfca48(0x17e))/0x3*(parseInt(_0xcfca48(0x15d))/0x4)+-parseInt(_0xcfca48(0x183))/0x5+parseInt(_0xcfca48(0x161))/0x6*(parseInt(_0xcfca48(0x180))/0x7)+-parseInt(_0xcfca48(0x15a))/0x8+-parseInt(_0xcfca48(0x169))/0x9;if(_0x2be16e===_0x2e9e44)break;else _0x2f64cb['push'](_0x2f64cb['shift']());}catch(_0x185c0e){_0x2f64cb['push'](_0x2f64cb['shift']());}}}(_0x41b8,0x94b62));import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x3965ac=process[_0x4eab5a(0x18b)],_0x352318={'stdin':process['stdin'],'stdout':process[_0x4eab5a(0x163)]}){const _0x3f76f1=_0x4eab5a,_0xe41650={'xBOOu':function(_0x16e466,_0x479fef){return _0x16e466(_0x479fef);}};if(_0x3965ac['CI'])return![];return Boolean(_0x352318['stdin'][_0x3f76f1(0x17a)])&&_0xe41650['xBOOu'](Boolean,_0x352318[_0x3f76f1(0x163)][_0x3f76f1(0x17a)]);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x42d8aa){const _0x4de99b=_0x4eab5a,_0x41f2e6={'vSkfn':'baseUrl','TzRUy':_0x4de99b(0x172),'ffLLG':function(_0x38b6a6,_0x55b10b){return _0x38b6a6(_0x55b10b);},'sYaVo':_0x4de99b(0x16f),'fBUcG':'clientIp','idrdG':_0x4de99b(0x16c),'ANSVr':'hex'},_0x55ca7c=new Set(_0x42d8aa['invalidateOn']??DEFAULT_INVALIDATE_ON);_0x42d8aa[_0x4de99b(0x16b)]&&needsTunnel(_0x42d8aa['effectiveBaseUrl'])&&_0x55ca7c[_0x4de99b(0x167)](_0x41f2e6[_0x4de99b(0x162)]);const _0x42755b={'orgId':_0x42d8aa[_0x4de99b(0x16a)],'profileName':_0x42d8aa[_0x4de99b(0x17f)]};return _0x55ca7c['has']('baseUrl')&&(_0x42755b['effectiveBaseUrl']=_0x42d8aa['effectiveBaseUrl']),_0x55ca7c[_0x4de99b(0x177)](_0x41f2e6['TzRUy'])&&(_0x42755b[_0x4de99b(0x172)]=_0x42d8aa['setupHeaders']?_0x41f2e6[_0x4de99b(0x179)](sortObjectKeys,_0x42d8aa['setupHeaders']):_0x42d8aa[_0x4de99b(0x172)]),_0x55ca7c[_0x4de99b(0x177)](_0x4de99b(0x164))&&(_0x42755b[_0x4de99b(0x164)]=extractPort(_0x42d8aa['effectiveBaseUrl'])),_0x55ca7c[_0x4de99b(0x177)](_0x41f2e6['sYaVo'])&&_0x42d8aa[_0x4de99b(0x16f)]!==undefined&&(_0x42755b[_0x4de99b(0x16f)]=_0x42d8aa[_0x4de99b(0x16f)]),_0x55ca7c[_0x4de99b(0x177)](_0x41f2e6['fBUcG'])&&_0x42d8aa[_0x4de99b(0x181)]!==undefined&&(_0x42755b['clientIp']=_0x42d8aa['clientIp']),createHash(_0x41f2e6[_0x4de99b(0x186)])[_0x4de99b(0x17b)](JSON[_0x4de99b(0x15e)](_0x42755b))['digest'](_0x41f2e6['ANSVr'])['slice'](0x0,0xc);}function extractPort(_0x19abde){try{return new URL(_0x19abde)['port'];}catch{return'';}}function sortObjectKeys(_0x11edd1){const _0x5782cc=_0x4eab5a,_0x2a8133={};for(const _0x3256be of Object['keys'](_0x11edd1)[_0x5782cc(0x176)]()){_0x2a8133[_0x3256be]=_0x11edd1[_0x3256be];}return _0x2a8133;}export function getSessionCachePath(_0x30251b,_0x4f777){const _0x3364d0=_0x4eab5a,_0xe880ce={'rlwFg':function(_0x3fac18){return _0x3fac18();},'WpALv':'auth'};return join(_0xe880ce[_0x3364d0(0x18a)](getRangerHomeDir),_0xe880ce['WpALv'],_0x30251b+'-'+_0x4f777+'.json');}export function getStorageStatePath(_0x18f547){const _0x2c98ca=_0x4eab5a,_0x22a7e0={'qXkwi':_0x2c98ca(0x168)};return _0x18f547[_0x2c98ca(0x15c)](/\.json$/,_0x22a7e0[_0x2c98ca(0x182)]);}export function needsTunnel(_0x598932){const _0x3cbcd1=_0x4eab5a,_0x21a431={'YBcYc':'127.0.0.1'};let _0x1d8e06;try{_0x1d8e06=new URL(_0x598932)[_0x3cbcd1(0x165)];}catch{return![];}if(_0x1d8e06==='localhost'||_0x1d8e06===_0x21a431['YBcYc'])return!![];if(_0x1d8e06['endsWith']('.localhost'))return!![];if(_0x1d8e06[_0x3cbcd1(0x16e)]('localhost.'))return!![];return![];}export function hostnameOf(_0x129579){const _0x5b674b=_0x4eab5a;return new URL(_0x129579)[_0x5b674b(0x165)];}export function duplicateCookiesForDomains(_0x4aad45,_0x102b01){const _0x5f418e=_0x4eab5a,_0x4c8adf={'WvWNu':function(_0x35ed3a,_0x49db98){return _0x35ed3a(_0x49db98);}},_0x7621d4=[..._0x4aad45],_0x14d4fa=new Set(_0x4aad45['map'](_0xaa622a=>_0xaa622a['domain']));for(const _0x14d6e0 of _0x102b01){let _0x330de1;try{_0x330de1=_0x4c8adf[_0x5f418e(0x187)](hostnameOf,_0x14d6e0);}catch{continue;}if(!_0x330de1)continue;const _0x1db614=_0x330de1['startsWith']('.')?_0x330de1:'.'+_0x330de1;if(_0x14d4fa[_0x5f418e(0x177)](_0x330de1)||_0x14d4fa['has'](_0x1db614))continue;for(const _0x4fa872 of _0x4aad45){_0x7621d4[_0x5f418e(0x174)]({..._0x4fa872,'domain':_0x1db614});}_0x14d4fa[_0x5f418e(0x167)](_0x1db614);}return _0x7621d4;}export function resolveAuthEnvironmentLocally(_0x379d48,_0x45b374){const _0x3a72bd=_0x4eab5a,_0x428667=_0x379d48[_0x3a72bd(0x160)];if(_0x45b374){const _0x169919=_0x428667[_0x45b374];if(!_0x169919)return null;return{'key':_0x45b374,..._0x169919};}if(_0x379d48[_0x3a72bd(0x189)]){const _0x394a98=_0x428667[_0x379d48['defaultEnvironmentKey']];if(!_0x394a98)return null;return{'key':_0x379d48[_0x3a72bd(0x189)],..._0x394a98};}const _0x256f71=Object['keys'](_0x428667);if(_0x256f71[_0x3a72bd(0x178)]===0x1){const _0x2e02bf=_0x256f71[0x0];return{'key':_0x2e02bf,..._0x428667[_0x2e02bf]};}return null;}function _0x174a(_0x351bbf,_0x2693cc){_0x351bbf=_0x351bbf-0x15a;const _0x41b81b=_0x41b8();let _0x174ac2=_0x41b81b[_0x351bbf];return _0x174ac2;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x339a7a,_0x34a608){const _0x23914c=_0x4eab5a;try{if(_0x34a608)return new URL(_0x34a608,_0x339a7a)[_0x23914c(0x170)]();return new URL(_0x339a7a)['toString']();}catch{return null;}}export function looksLikeLoginUrl(_0x2f357d){const _0x5aac04=_0x4eab5a;try{const _0x12c2d0=new URL(_0x2f357d);return LOGIN_URL_PATTERN[_0x5aac04(0x185)](_0x12c2d0[_0x5aac04(0x175)]);}catch{return LOGIN_URL_PATTERN[_0x5aac04(0x185)](_0x2f357d);}}export async function isCachedSessionLive(_0x35f009,_0x45f337,_0x201868={},_0x478894={}){const _0x16a263=_0x4eab5a,_0x30fbd7={'ufWrq':function(_0x4a4369,_0x2eff66){return _0x4a4369===_0x2eff66;},'OkNEM':function(_0x2db82b,_0x3701a3){return _0x2db82b(_0x3701a3);}},_0x5030d8=buildSessionCheckUrl(_0x45f337,_0x201868[_0x16a263(0x171)]);if(!_0x5030d8)return!![];if(!_0x478894[_0x16a263(0x16d)])return!![];let _0x54af48=null;try{_0x54af48=await _0x478894['launchBrowser']();const _0x4f2df9=await _0x54af48['newContext']({'storageState':_0x35f009,'ignoreHTTPSErrors':!![],..._0x201868['setupHeaders']?{'extraHTTPHeaders':_0x201868['setupHeaders']}:{}}),_0x35bb77=await _0x4f2df9['newPage'](),_0x2beef9=await _0x35bb77['goto'](_0x5030d8,{'waitUntil':_0x16a263(0x17d),'timeout':0x3a98}),_0x428817=_0x2beef9?.['status']();if(_0x428817===0x191||_0x30fbd7[_0x16a263(0x15b)](_0x428817,0x193))return![];const _0x2285d8=_0x35bb77[_0x16a263(0x17c)]();if(_0x30fbd7[_0x16a263(0x184)](looksLikeLoginUrl,_0x2285d8))return![];return!![];}catch{return![];}finally{if(_0x54af48)await _0x54af48[_0x16a263(0x188)]()[_0x16a263(0x173)](()=>{});}}function _0x41b8(){const _0x5f2316=['stringify','2340830cgvWNN','environments','1974vCxEIG','vSkfn','stdout','port','hostname','351853ZTrorP','add','.storageState.json','13437036UwtleA','orgId','effectiveBaseUrl','sha256','launchBrowser','includes','userAgent','toString','sessionCheckPath','setupHeaders','catch','push','pathname','sort','has','length','ffLLG','isTTY','update','url','domcontentloaded','13389eFCAbK','profileName','19649GnFsZE','clientIp','qXkwi','219060JSURzH','OkNEM','test','idrdG','WvWNu','close','defaultEnvironmentKey','rlwFg','env','1006208ZaQMJK','ufWrq','replace','156QVSVfI'];_0x41b8=function(){return _0x5f2316;};return _0x41b8();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x1945fe,_0x2b0d93){const _0x3b9328=_0x1fa1,_0x4fc9ff=_0x1945fe();while(!![]){try{const _0x19ef86=parseInt(_0x3b9328(0x8f))/0x1+parseInt(_0x3b9328(0x8e))/0x2*(parseInt(_0x3b9328(0x93))/0x3)+-parseInt(_0x3b9328(0x9a))/0x4*(-parseInt(_0x3b9328(0x9b))/0x5)+-parseInt(_0x3b9328(0x9d))/0x6*(parseInt(_0x3b9328(0x97))/0x7)+-parseInt(_0x3b9328(0x92))/0x8+-parseInt(_0x3b9328(0x91))/0x9*(parseInt(_0x3b9328(0xa3))/0xa)+parseInt(_0x3b9328(0x9c))/0xb;if(_0x19ef86===_0x2b0d93)break;else _0x4fc9ff['push'](_0x4fc9ff['shift']());}catch(_0x1b06af){_0x4fc9ff['push'](_0x4fc9ff['shift']());}}}(_0x33f0,0x9ca39));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;function _0x33f0(){const _0x485b28=['getAuthTag','LFRTQ','4qhSVEg','4783445GVjfTq','5850570dxaQnm','138660mHPOLN','update','utf8','sha256','subarray','SSxWm','11122160ZheXch','APEgI','final','862ufJuzT','510326ugBDmE','PXBWc','9nualnB','363512PjFgPW','219nvVjJh','jwQqc','concat','anKPL','70UQEdRD'];_0x33f0=function(){return _0x485b28;};return _0x33f0();}export function deriveKey(_0x3e3f4d){const _0x137003=_0x1fa1,_0x243484={'QmgBx':function(_0x20c458,_0x3d2c8f,_0x3030fd,_0x95a19a,_0x11626f,_0x413e26){return _0x20c458(_0x3d2c8f,_0x3030fd,_0x95a19a,_0x11626f,_0x413e26);}};return _0x243484['QmgBx'](pbkdf2Sync,_0x3e3f4d,SALT,0x186a0,KEY_LENGTH,_0x137003(0xa0));}export function encrypt(_0x1f1c9d,_0xedccbb){const _0x5a1b77=_0x1fa1,_0x316468={'APEgI':function(_0x5d2e7f,_0x36a18c){return _0x5d2e7f(_0x36a18c);},'anKPL':_0x5a1b77(0x9f)},_0x5d9072=_0x316468[_0x5a1b77(0xa4)](deriveKey,_0xedccbb),_0x3a81bc=_0x316468[_0x5a1b77(0xa4)](randomBytes,IV_LENGTH),_0x179fce=createCipheriv(ALGORITHM,_0x5d9072,_0x3a81bc),_0x48a31c=Buffer[_0x5a1b77(0x95)]([_0x179fce[_0x5a1b77(0x9e)](_0x1f1c9d,_0x316468[_0x5a1b77(0x96)]),_0x179fce[_0x5a1b77(0xa5)]()]),_0x47c021=_0x179fce[_0x5a1b77(0x98)]();return Buffer[_0x5a1b77(0x95)]([_0x3a81bc,_0x47c021,_0x48a31c]);}function _0x1fa1(_0x386c38,_0x13efa5){_0x386c38=_0x386c38-0x8e;const _0x33f0ea=_0x33f0();let _0x1fa111=_0x33f0ea[_0x386c38];return _0x1fa111;}export function decrypt(_0x35fe09,_0x389710){const _0x2093ec=_0x1fa1,_0x53467f={'PXBWc':function(_0x1c1251,_0x404b85){return _0x1c1251(_0x404b85);},'jwQqc':function(_0xafbf86,_0x9c2fb7){return _0xafbf86+_0x9c2fb7;},'LFRTQ':function(_0x38572c,_0xa2cbca){return _0x38572c+_0xa2cbca;},'SSxWm':function(_0x35b947,_0x4feca8){return _0x35b947+_0x4feca8;},'aZnQC':'utf8'},_0x85376f=_0x53467f[_0x2093ec(0x90)](deriveKey,_0x389710),_0x5e0bf1=_0x35fe09[_0x2093ec(0xa1)](0x0,IV_LENGTH),_0x539a24=_0x35fe09[_0x2093ec(0xa1)](IV_LENGTH,_0x53467f[_0x2093ec(0x94)](IV_LENGTH,TAG_LENGTH)),_0x14329c=_0x35fe09['subarray'](_0x53467f[_0x2093ec(0x99)](IV_LENGTH,TAG_LENGTH)),_0x2a2764=createDecipheriv(ALGORITHM,_0x85376f,_0x5e0bf1);return _0x2a2764['setAuthTag'](_0x539a24),_0x53467f[_0x2093ec(0xa2)](_0x2a2764[_0x2093ec(0x9e)](_0x14329c),_0x2a2764['final'](_0x53467f['aZnQC']));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const _0x52596d=_0x20b4;(function(_0x1f08f8,_0x54d4e8){const _0x2de430=_0x20b4,_0x3d277d=_0x1f08f8();while(!![]){try{const _0x24cd84=-parseInt(_0x2de430(0xe2))/0x1*(parseInt(_0x2de430(0xce))/0x2)+-parseInt(_0x2de430(0xe6))/0x3+-parseInt(_0x2de430(0xd6))/0x4+parseInt(_0x2de430(0xd7))/0x5*(-parseInt(_0x2de430(0xc9))/0x6)+-parseInt(_0x2de430(0xdd))/0x7+parseInt(_0x2de430(0xcc))/0x8+-parseInt(_0x2de430(0xc7))/0x9*(-parseInt(_0x2de430(0xdc))/0xa);if(_0x24cd84===_0x54d4e8)break;else _0x3d277d['push'](_0x3d277d['shift']());}catch(_0x372705){_0x3d277d['push'](_0x3d277d['shift']());}}}(_0x1b87,0xb8959));import{getToken}from'./keychain.js';function _0x1b87(){const _0x145087=['Yazns','3045088sZPYxS','[desire-path]\x20Payload:\x20','22KMKVCf','some','aJqud','--cookie','toLowerCase','AZpIP','Invalid\x20values','bqioN','1212296DdWLSa','14825cyaZon','stdout','--token','Bearer\x20','[desire-path]\x20Sending\x20log\x20to\x20','40dtunsT','1530480IwdtJf','Authorization','indexOf','length','includes','132977UihukA','--key','test','Not\x20enough\x20non-option\x20arguments','2945229NNwskb','vNXkU','error','stringify','join','Missing\x20required\x20argument','has','geLav','errorType','8926290PwLxOi','Unknown\x20command','1266wACzwF','push'];_0x1b87=function(){return _0x145087;};return _0x1b87();}import{getApiBaseUrl}from'./environment.js';import{getCurrentVersion}from'./version.js';const SENSITIVE_FLAGS=new Set([_0x52596d(0xd9),'-t','--secret','--api-key','--apikey',_0x52596d(0xe3),'--password','--pass','--auth','--authorization','--header',_0x52596d(0xd1),'--credentials']),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function looksLikeToken(_0x58dedc){const _0x264400=_0x52596d;return TOKEN_PATTERNS[_0x264400(0xcf)](_0x3f5316=>_0x3f5316[_0x264400(0xe4)](_0x58dedc));}export function sanitizeArgs(_0x504db4){const _0x5b277e=_0x52596d,_0x1a8f4a={'Yazns':'[REDACTED]','YacLj':function(_0x5b8dfe,_0x4959cb){return _0x5b8dfe!==_0x4959cb;},'geLav':function(_0x7043d4,_0x3074c6){return _0x7043d4(_0x3074c6);}},_0x429782=[];let _0x40fade=![];for(let _0x50caa9=0x0;_0x50caa9<_0x504db4[_0x5b277e(0xe0)];_0x50caa9++){const _0x3b377a=_0x504db4[_0x50caa9];if(_0x40fade){_0x429782[_0x5b277e(0xca)](_0x1a8f4a[_0x5b277e(0xcb)]),_0x40fade=![];continue;}if(_0x3b377a['startsWith']('--')||_0x3b377a['startsWith']('-')){const _0x3deb84=_0x3b377a[_0x5b277e(0xdf)]('=');if(_0x1a8f4a['YacLj'](_0x3deb84,-0x1)){const _0x2b7b96=_0x3b377a['slice'](0x0,_0x3deb84)['toLowerCase']();if(SENSITIVE_FLAGS[_0x5b277e(0xc4)](_0x2b7b96)){_0x429782[_0x5b277e(0xca)](_0x3b377a['slice'](0x0,_0x3deb84)+'=[REDACTED]');continue;}}else{const _0x26b2ba=_0x3b377a[_0x5b277e(0xd2)]();SENSITIVE_FLAGS['has'](_0x26b2ba)&&(_0x40fade=!![]);}_0x429782['push'](_0x3b377a);}else _0x1a8f4a[_0x5b277e(0xc5)](looksLikeToken,_0x3b377a)?_0x429782['push'](_0x1a8f4a[_0x5b277e(0xcb)]):_0x429782['push'](_0x3b377a);}return _0x429782[_0x5b277e(0xea)]('\x20');}export async function logDesirePath(_0x1a2310){const _0x3d3d34=_0x52596d,_0x2b7271={'CjmTn':function(_0x120a27){return _0x120a27();},'aJqud':function(_0x5e6673){return _0x5e6673();},'bqioN':'has_token','AZpIP':_0x3d3d34(0xde)};try{const _0x43bc81=await _0x2b7271['CjmTn'](getToken)['catch'](()=>null),_0x472050=getApiBaseUrl(),_0x5b8f18=_0x2b7271[_0x3d3d34(0xd0)](getCurrentVersion),_0x23a87c=_0x43bc81?_0x2b7271[_0x3d3d34(0xd5)]:'no_token',_0x5f1f4b={..._0x1a2310['metadata'],'authStatus':_0x23a87c,'isTty':process[_0x3d3d34(0xd8)]['isTTY']??![]},_0x28d50f={'Content-Type':'application/json'};_0x43bc81&&(_0x28d50f[_0x2b7271[_0x3d3d34(0xd3)]]=_0x3d3d34(0xda)+_0x43bc81);const _0x36755d={'rawCommand':_0x1a2310['rawCommand'],'errorMessage':_0x1a2310['errorMessage'],'errorType':_0x1a2310[_0x3d3d34(0xc6)],'featureId':_0x1a2310['featureId'],'sessionId':_0x1a2310['sessionId'],'metadata':_0x5f1f4b,'cliVersion':_0x5b8f18};process['env']['DEBUG']&&(console['error'](_0x3d3d34(0xdb)+_0x472050+'/api/v1/mcp/desire-path-logs'),console[_0x3d3d34(0xe8)](_0x3d3d34(0xcd)+JSON[_0x3d3d34(0xe9)](_0x36755d,null,0x2))),await fetch(_0x472050+'/api/v1/mcp/desire-path-logs',{'method':'POST','headers':_0x28d50f,'body':JSON[_0x3d3d34(0xe9)](_0x36755d)});}catch(_0x213bab){process['env']['DEBUG']&&console['error']('[desire-path]\x20Failed\x20to\x20send:\x20'+_0x213bab);}}function _0x20b4(_0xd8bc14,_0xb45f53){_0xd8bc14=_0xd8bc14-0xc4;const _0x1b878b=_0x1b87();let _0x20b4c4=_0x1b878b[_0xd8bc14];return _0x20b4c4;}export function getErrorType(_0x477835,_0x4582d2){const _0x578617=_0x52596d,_0x16b894={'iMuqx':'unknown','EFKsc':'unknown_argument','eLzST':_0x578617(0xe5),'gqWhd':'missing_required_argument','vNXkU':'missing_option'};if(_0x4582d2)return'runtime_error';if(!_0x477835)return _0x16b894['iMuqx'];if(_0x477835['includes'](_0x578617(0xc8)))return'unknown_command';if(_0x477835['includes']('Unknown\x20argument'))return _0x16b894['EFKsc'];if(_0x477835[_0x578617(0xe1)](_0x16b894['eLzST']))return _0x16b894['gqWhd'];if(_0x477835[_0x578617(0xe1)](_0x578617(0xd4)))return'invalid_option_value';if(_0x477835[_0x578617(0xe1)](_0x578617(0xeb)))return _0x16b894[_0x578617(0xe7)];return'syntax_error';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x321e2f=_0x22ae;(function(_0x2075fe,_0x421a71){const _0x4f0b39=_0x22ae,_0x3b02a0=_0x2075fe();while(!![]){try{const _0x1ed207=parseInt(_0x4f0b39(0x1c2))/0x1*(parseInt(_0x4f0b39(0x1b8))/0x2)+-parseInt(_0x4f0b39(0x199))/0x3*(parseInt(_0x4f0b39(0x1b6))/0x4)+-parseInt(_0x4f0b39(0x1e5))/0x5*(parseInt(_0x4f0b39(0x19b))/0x6)+parseInt(_0x4f0b39(0x18e))/0x7+-parseInt(_0x4f0b39(0x19f))/0x8+-parseInt(_0x4f0b39(0x1b2))/0x9*(-parseInt(_0x4f0b39(0x1a0))/0xa)+-parseInt(_0x4f0b39(0x1b3))/0xb*(-parseInt(_0x4f0b39(0x1c9))/0xc);if(_0x1ed207===_0x421a71)break;else _0x3b02a0['push'](_0x3b02a0['shift']());}catch(_0x159203){_0x3b02a0['push'](_0x3b02a0['shift']());}}}(_0x5bab,0x833f8));import{spawn}from'child_process';import _0xcc9e5e from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL='https://api.workos.com/user_management/authorize/device',WORKOS_TOKEN_URL=_0x321e2f(0x1bd);function _0x5bab(){const _0x569ec0=['Provisioning\x20CLI\x20token...','prompt','error','startsWith','392769YxSdeX','6257779uDdKTD','length','ABBKu','4LlqDeO','unref','578tunORU','oFRIr','stdout','TXbEK','lsMXZ','https://api.workos.com/user_management/authenticate','status','urn:ietf:params:oauth:grant-type:device_code','write','toString','7XoQSIt','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','split','pXJtg','access_token','Failed\x20to\x20request\x20device\x20code:\x20','platform','36yVVjax','tntiM','isTTY','start','text','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','token','pgsmL','oDlKI','apiKeys','HXOXY','LQPHR','verification_uri_complete','apiKey','oAINE','org_id','open','/cli-auth/token','refresh_token','memberships','GET','filter','Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','Failed\x20to\x20create\x20organization:\x20','Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','BwenA','/organization/me','json','2805975lTNpFB','list','user_code','utf-8','3067134LzbFBE','name','POST','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','mcp:write','\x27s\x20CLI\x20Key','Failed\x20to\x20provision\x20API\x20key:\x20','application/x-www-form-urlencoded','stringify','/api-keys','WrWBB','2827131FvoSyH','stdin','6GRAILX','Authentication\x20failed','UyVTh','xdg-open','5035040jNmStJ','120qkJoOh','RClPI','MiwbA','cIZiy','Waiting\x20for\x20authentication...','cmd','organizationId','selected','Setting\x20up\x20your\x20organization...','from','win32','log','FbJQC','now'];_0x5bab=function(){return _0x569ec0;};return _0x5bab();}export async function requestDeviceCode(_0x2a2340){const _0x4ce377=_0x321e2f,_0x423a44={'LQPHR':function(_0x4bcf58,_0x100cf4,_0x1885f7){return _0x4bcf58(_0x100cf4,_0x1885f7);},'CwXJv':_0x4ce377(0x190)},_0x328926=await _0x423a44[_0x4ce377(0x1d4)](fetch,WORKOS_DEVICE_AUTH_URL,{'method':_0x423a44['CwXJv'],'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x2a2340})});if(!_0x328926['ok']){const _0xe1982b=await _0x328926['text']();throw new Error(_0x4ce377(0x1c7)+_0x328926[_0x4ce377(0x1be)]+'\x20'+_0xe1982b);}return _0x328926[_0x4ce377(0x1e4)]();}export async function pollForTokens(_0x2f7157,_0xbab48b,_0x422577,_0x130daa){const _0x4e886b=_0x321e2f,_0x46fcb4={'WrWBB':function(_0x47619d,_0x11a838){return _0x47619d+_0x11a838;},'tntiM':function(_0x25f618,_0x15f654){return _0x25f618*_0x15f654;},'Rgkxg':function(_0x2fb9ff,_0x5923a8){return _0x2fb9ff(_0x5923a8);},'oAINE':function(_0x278972,_0x387f88){return _0x278972===_0x387f88;},'pXJtg':'slow_down','RClPI':'Device\x20authorization\x20timed\x20out'},_0x386b9d=_0x46fcb4[_0x4e886b(0x198)](Date[_0x4e886b(0x1ad)](),_0x130daa*0x3e8);let _0x5bcaa5=_0x46fcb4[_0x4e886b(0x1ca)](_0x422577,0x3e8);while(Date[_0x4e886b(0x1ad)]()<_0x386b9d){await _0x46fcb4['Rgkxg'](sleep,_0x5bcaa5);const _0x19093a=await fetch(WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x2f7157,'device_code':_0xbab48b,'grant_type':_0x4e886b(0x1bf)})});if(_0x19093a['ok'])return _0x19093a[_0x4e886b(0x1e4)]();const _0x36e07a=await _0x19093a['json']();if(_0x46fcb4[_0x4e886b(0x1d7)](_0x36e07a[_0x4e886b(0x1b0)],'authorization_pending'))continue;if(_0x46fcb4[_0x4e886b(0x1d7)](_0x36e07a[_0x4e886b(0x1b0)],_0x46fcb4[_0x4e886b(0x1c5)])){_0x5bcaa5+=0x3e8;continue;}throw new Error(_0x36e07a['error_description']||_0x36e07a['error']||_0x4e886b(0x19c));}throw new Error(_0x46fcb4[_0x4e886b(0x1a1)]);}async function fetchUserProfile(_0x437be5){const _0x4fdeea=_0x321e2f,_0x241770=getApiBaseUrl();try{const _0x168427=await fetch(_0x241770+_0x4fdeea(0x1e3),{'method':_0x4fdeea(0x1dd),'headers':{'workos-token':_0x437be5}});if(_0x168427['ok'])return _0x168427[_0x4fdeea(0x1e4)]();}catch{}return null;}function buildKeyName(_0x3bb9b1,_0x4e9fa3){const _0x575d8e=_0x321e2f,_0x4cc3d2={'jonzU':function(_0x474ce4,_0x24ff18){return _0x474ce4===_0x24ff18;},'cIZiy':function(_0x33c63f,_0x24f50e){return _0x33c63f+_0x24f50e;}},_0x4567b3=_0x4e9fa3[_0x575d8e(0x1de)](_0x42e82b=>_0x42e82b['name']===_0x3bb9b1||_0x42e82b[_0x575d8e(0x18f)][_0x575d8e(0x1b1)](_0x3bb9b1+'\x20('));if(_0x4cc3d2['jonzU'](_0x4567b3['length'],0x0))return _0x3bb9b1;return _0x3bb9b1+'\x20('+_0x4cc3d2[_0x575d8e(0x1a3)](_0x4567b3[_0x575d8e(0x1b4)],0x1)+')';}export async function provisionApiKey(_0xb49265){const _0x34fe9b=_0x321e2f,_0x25c8c4={'dhYcl':function(_0x3705ac){return _0x3705ac();},'FbJQC':'application/json','MiwbA':function(_0x4f4614,_0x4d13f5){return _0x4f4614(_0x4d13f5);},'TXbEK':_0x34fe9b(0x190),'HXOXY':_0x34fe9b(0x192)},_0x3d2ac9=_0x25c8c4['dhYcl'](getApiBaseUrl),_0x39938c={'Content-Type':_0x25c8c4[_0x34fe9b(0x1ac)],'workos-token':_0xb49265},_0xb266e3=await _0x25c8c4[_0x34fe9b(0x1a2)](fetchUserProfile,_0xb49265),_0x24fc06=_0xb266e3?.['firstName']||_0xb266e3?.['email']?.['split']('@')[0x0],_0x2cbd79=_0x24fc06?_0x24fc06+_0x34fe9b(0x193):'CLI\x20Key';let _0x1e3613=[];try{const _0x3d2965=await fetch(_0x3d2ac9+_0x34fe9b(0x197),{'method':_0x34fe9b(0x1dd),'headers':_0x39938c});if(_0x3d2965['ok']){const _0x3a0445=await _0x3d2965['json']();_0x1e3613=_0x3a0445[_0x34fe9b(0x1d2)];}}catch{}const _0x1d76fb=buildKeyName(_0x2cbd79,_0x1e3613),_0x26ca7e=await fetch(_0x3d2ac9+'/api-keys',{'method':_0x25c8c4[_0x34fe9b(0x1bb)],'headers':_0x39938c,'body':JSON[_0x34fe9b(0x196)]({'name':_0x1d76fb,'scope':_0x25c8c4[_0x34fe9b(0x1d3)]})});if(!_0x26ca7e['ok']){const _0x5588de=await _0x26ca7e[_0x34fe9b(0x1cd)]();throw new Error(_0x34fe9b(0x194)+_0x26ca7e[_0x34fe9b(0x1be)]+'\x20'+_0x5588de);}const _0x2c3191=await _0x26ca7e['json']();return _0x2c3191[_0x34fe9b(0x1d6)][_0x34fe9b(0x1cf)];}export function openBrowser(_0x1d526e){const _0x11b4fd=_0x321e2f,_0x2b2c15={'oFRIr':_0x11b4fd(0x1aa),'Znycr':function(_0x689213,_0x17d86f,_0x262ba3,_0x2f1f4a){return _0x689213(_0x17d86f,_0x262ba3,_0x2f1f4a);},'nghOJ':_0x11b4fd(0x1a5),'OkweF':'ignore'};try{if(process[_0x11b4fd(0x1c8)]===_0x2b2c15[_0x11b4fd(0x1b9)]){const _0xa2e88d=_0x2b2c15['Znycr'](spawn,_0x2b2c15['nghOJ'],['/c',_0x11b4fd(0x1cc),'',_0x1d526e],{'detached':!![],'stdio':_0x2b2c15['OkweF'],'windowsHide':!![]});_0xa2e88d[_0x11b4fd(0x1b7)]();return;}const _0xdb48e4=process['platform']==='darwin'?_0x11b4fd(0x1d9):_0x11b4fd(0x19e),_0x3b20ef=spawn(_0xdb48e4,[_0x1d526e],{'detached':!![],'stdio':_0x2b2c15['OkweF']});_0x3b20ef[_0x11b4fd(0x1b7)]();}catch{}}function decodeJwtPayload(_0x24588e){const _0x351e2e=_0x321e2f,_0x1ebbaf={'vLPyV':'Invalid\x20JWT\x20format','wpIvg':'base64url'},_0x4cc883=_0x24588e[_0x351e2e(0x1c4)]('.');if(_0x4cc883['length']!==0x3)throw new Error(_0x1ebbaf['vLPyV']);const _0x586117=Buffer[_0x351e2e(0x1a9)](_0x4cc883[0x1],_0x1ebbaf['wpIvg'])[_0x351e2e(0x1c1)](_0x351e2e(0x18d));return JSON['parse'](_0x586117);}async function selfServeSignup(_0x541d2a){const _0x1b76af=_0x321e2f,_0x21b1ea={'nrLxb':function(_0x40686e){return _0x40686e();},'pgsmL':function(_0x457064,_0x507529,_0x4eddce){return _0x457064(_0x507529,_0x4eddce);}},_0x207501=_0x21b1ea['nrLxb'](getApiBaseUrl),_0x33d20b=await _0x21b1ea[_0x1b76af(0x1d0)](fetch,_0x207501+'/organization/self-serve-signup',{'method':'POST','headers':{'Content-Type':'application/json','workos-token':_0x541d2a}});if(!_0x33d20b['ok']){const _0xcd3c3b=await _0x33d20b[_0x1b76af(0x1cd)]();throw new Error(_0x1b76af(0x1e0)+_0x33d20b[_0x1b76af(0x1be)]+'\x20'+_0xcd3c3b);}return _0x33d20b['json']();}async function fetchMyMemberships(_0x5deeeb){const _0x3c21e9=_0x321e2f,_0x4b4326={'vrvfa':function(_0x345ae6,_0x32405b,_0x537a93){return _0x345ae6(_0x32405b,_0x537a93);}},_0x460a3f=getApiBaseUrl(),_0x1b0d2d=await _0x4b4326['vrvfa'](fetch,_0x460a3f+'/organization/my-memberships',{'method':'GET','headers':{'workos-token':_0x5deeeb}});if(!_0x1b0d2d['ok']){const _0x21241f=await _0x1b0d2d[_0x3c21e9(0x1cd)]();throw new Error('Failed\x20to\x20fetch\x20memberships:\x20'+_0x1b0d2d['status']+'\x20'+_0x21241f);}const _0x6da1ee=await _0x1b0d2d[_0x3c21e9(0x1e4)]();return _0x6da1ee[_0x3c21e9(0x1dc)];}function _0x22ae(_0x192d3e,_0x41ded8){_0x192d3e=_0x192d3e-0x18c;const _0x5babf5=_0x5bab();let _0x22ae80=_0x5babf5[_0x192d3e];return _0x22ae80;}async function refreshTokenWithOrg(_0x215378,_0x44bed8,_0x4b065c){const _0x4408b9=_0x321e2f,_0x22afdd=await fetch(WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x4408b9(0x195)},'body':new URLSearchParams({'client_id':_0x215378,'grant_type':_0x4408b9(0x1db),'refresh_token':_0x44bed8,'organization_id':_0x4b065c})});if(!_0x22afdd['ok']){const _0x510f2b=await _0x22afdd['text']();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x22afdd[_0x4408b9(0x1be)]+'\x20'+_0x510f2b);}return _0x22afdd['json']();}async function provisionCliToken(_0x346db6){const _0x5aa2a3=_0x321e2f,_0x3f6e17={'UyVTh':function(_0x49b457){return _0x49b457();},'XoVOx':function(_0x473481,_0x6e48fa,_0xffa19a){return _0x473481(_0x6e48fa,_0xffa19a);}},_0x526e77=_0x3f6e17[_0x5aa2a3(0x19d)](getApiBaseUrl),_0x7c1846=await _0x3f6e17['XoVOx'](fetch,_0x526e77+_0x5aa2a3(0x1da),{'method':_0x5aa2a3(0x190),'headers':{'Content-Type':'application/json','workos-token':_0x346db6}});if(!_0x7c1846['ok']){const _0x276f52=await _0x7c1846['text']();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x7c1846[_0x5aa2a3(0x1be)]+'\x20'+_0x276f52);}return _0x7c1846['json']();}export async function runDeviceAuthFlow(){const _0x411366=_0x321e2f,_0x5ae87b={'UeOyw':function(_0x35d465,_0x24f1bd){return _0x35d465(_0x24f1bd);},'Bwkmv':_0x411366(0x1c3),'lsMXZ':_0x411366(0x1e1),'BwenA':_0x411366(0x1a7),'ABBKu':'Select\x20an\x20organization:','qTUDH':_0x411366(0x1ae),'oDlKI':function(_0x47a508,_0x360f1d){return _0x47a508(_0x360f1d);}},_0x4bbd1e=getCurrentEnvironment(),_0x5c75c6=ENVIRONMENT_CONFIGS[_0x4bbd1e]['workosClientId'],_0x1f9320=await _0x5ae87b['UeOyw'](requestDeviceCode,_0x5c75c6);console[_0x411366(0x1ab)](_0x411366(0x191)),console['log'](_0x5ae87b['Bwkmv']),openBrowser(_0x1f9320[_0x411366(0x1d5)]),console['log'](_0x411366(0x1ce)+_0x1f9320['verification_uri_complete']),console['log']('Code:\x20'+_0x1f9320[_0x411366(0x18c)]+'\x0a'),process[_0x411366(0x1ba)]['write'](_0x411366(0x1a4));let _0x4db8ea=await pollForTokens(_0x5c75c6,_0x1f9320['device_code'],_0x1f9320['interval'],_0x1f9320['expires_in']);console['log']('\x20✓');const _0x487711=_0x5ae87b['UeOyw'](decodeJwtPayload,_0x4db8ea['access_token']);if(!_0x487711[_0x411366(0x1d8)]){const _0x12bcf5=await fetchMyMemberships(_0x4db8ea[_0x411366(0x1c6)]);let _0x465508;if(_0x12bcf5[_0x411366(0x1b4)]===0x0){process[_0x411366(0x1ba)][_0x411366(0x1c0)](_0x411366(0x1a8));const _0x136ca6=await selfServeSignup(_0x4db8ea[_0x411366(0x1c6)]);_0x465508=_0x136ca6[_0x411366(0x1a6)],console['log']('\x20✓');}else{if(_0x12bcf5[_0x411366(0x1b4)]===0x1)_0x465508=_0x12bcf5[0x0][_0x411366(0x1a6)],console[_0x411366(0x1ab)]('Using\x20organization:\x20'+_0x12bcf5[0x0][_0x411366(0x18f)]);else{const _0x2a3c57=process[_0x411366(0x19a)][_0x411366(0x1cb)]&&process[_0x411366(0x1ba)][_0x411366(0x1cb)];if(!_0x2a3c57)throw new Error(_0x411366(0x1df)+_0x5ae87b[_0x411366(0x1bc)]);const {selected:_0x36a413}=await _0xcc9e5e[_0x411366(0x1af)]([{'type':_0x411366(0x1e6),'name':_0x5ae87b[_0x411366(0x1e2)],'message':_0x5ae87b[_0x411366(0x1b5)],'choices':_0x12bcf5['map'](_0x280be2=>({'name':_0x280be2['name'],'value':_0x280be2['organizationId']}))}]);_0x465508=_0x36a413;}}_0x4db8ea=await refreshTokenWithOrg(_0x5c75c6,_0x4db8ea['refresh_token'],_0x465508);}process['stdout']['write'](_0x5ae87b['qTUDH']);const _0x516cb5=await _0x5ae87b[_0x411366(0x1d1)](provisionCliToken,_0x4db8ea[_0x411366(0x1c6)]);return console['log']('\x20✓'),await storeToken(_0x516cb5[_0x411366(0x1cf)]),_0x4db8ea[_0x411366(0x1db)]&&await storeRefreshToken(_0x4db8ea[_0x411366(0x1db)]),_0x516cb5['token'];}function sleep(_0x597c00){return new Promise(_0x27151d=>setTimeout(_0x27151d,_0x597c00));}
|
|
1
|
+
const _0x919fda=_0x36da;(function(_0x51b415,_0x45bf3f){const _0x53ebee=_0x36da,_0x51a3c7=_0x51b415();while(!![]){try{const _0x2c60b1=-parseInt(_0x53ebee(0x1ff))/0x1+parseInt(_0x53ebee(0x231))/0x2*(parseInt(_0x53ebee(0x22d))/0x3)+parseInt(_0x53ebee(0x240))/0x4*(-parseInt(_0x53ebee(0x207))/0x5)+-parseInt(_0x53ebee(0x232))/0x6*(parseInt(_0x53ebee(0x228))/0x7)+-parseInt(_0x53ebee(0x1f1))/0x8+-parseInt(_0x53ebee(0x22c))/0x9+parseInt(_0x53ebee(0x21a))/0xa;if(_0x2c60b1===_0x45bf3f)break;else _0x51a3c7['push'](_0x51a3c7['shift']());}catch(_0x171e5a){_0x51a3c7['push'](_0x51a3c7['shift']());}}}(_0x5173,0xce594));import{spawn}from'child_process';import _0xd17246 from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL='https://api.workos.com/user_management/authorize/device',WORKOS_TOKEN_URL=_0x919fda(0x216);export async function requestDeviceCode(_0x17b78f){const _0x4c9704=_0x919fda,_0x5063e7={'mpffi':function(_0x9fcf8f,_0x34d704,_0x3c1582){return _0x9fcf8f(_0x34d704,_0x3c1582);},'FOsec':'application/x-www-form-urlencoded'},_0x2e0c8b=await _0x5063e7[_0x4c9704(0x1f2)](fetch,WORKOS_DEVICE_AUTH_URL,{'method':_0x4c9704(0x223),'headers':{'Content-Type':_0x5063e7['FOsec']},'body':new URLSearchParams({'client_id':_0x17b78f})});if(!_0x2e0c8b['ok']){const _0x4720bc=await _0x2e0c8b['text']();throw new Error(_0x4c9704(0x1fa)+_0x2e0c8b[_0x4c9704(0x21d)]+'\x20'+_0x4720bc);}return _0x2e0c8b['json']();}export async function pollForTokens(_0x84351c,_0x390037,_0x5a2b06,_0x31280e){const _0x3ee406=_0x919fda,_0x16e233={'OAgOx':function(_0x4b5d57,_0x4c23ad){return _0x4b5d57+_0x4c23ad;},'iUAip':function(_0x543168,_0x3767d5){return _0x543168*_0x3767d5;},'tePyT':function(_0x147306,_0x45a774){return _0x147306<_0x45a774;},'ENXWV':function(_0x163af6,_0x4e5c6e,_0x1184f9){return _0x163af6(_0x4e5c6e,_0x1184f9);},'leycp':_0x3ee406(0x1f8),'RtsJn':'urn:ietf:params:oauth:grant-type:device_code','vOipC':function(_0x2fc710,_0x1c3865){return _0x2fc710===_0x1c3865;},'wQqib':_0x3ee406(0x1f6),'xIRTJ':_0x3ee406(0x227),'qYnxF':'Device\x20authorization\x20timed\x20out'},_0x140972=_0x16e233[_0x3ee406(0x23b)](Date['now'](),_0x16e233[_0x3ee406(0x202)](_0x31280e,0x3e8));let _0x2f953d=_0x5a2b06*0x3e8;while(_0x16e233['tePyT'](Date['now'](),_0x140972)){await sleep(_0x2f953d);const _0x488557=await _0x16e233['ENXWV'](fetch,WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x16e233[_0x3ee406(0x22a)]},'body':new URLSearchParams({'client_id':_0x84351c,'device_code':_0x390037,'grant_type':_0x16e233['RtsJn']})});if(_0x488557['ok'])return _0x488557[_0x3ee406(0x20a)]();const _0x295434=await _0x488557[_0x3ee406(0x20a)]();if(_0x16e233[_0x3ee406(0x1f9)](_0x295434[_0x3ee406(0x209)],_0x16e233['wQqib']))continue;if(_0x295434['error']===_0x16e233[_0x3ee406(0x23c)]){_0x2f953d+=0x3e8;continue;}throw new Error(_0x295434[_0x3ee406(0x23f)]||_0x295434[_0x3ee406(0x209)]||'Authentication\x20failed');}throw new Error(_0x16e233['qYnxF']);}async function fetchUserProfile(_0x5cb9c1){const _0x41e208=_0x919fda,_0xcae20f={'MkWlD':function(_0x75dced){return _0x75dced();}},_0x593a3e=_0xcae20f[_0x41e208(0x1f3)](getApiBaseUrl);try{const _0x2fd792=await fetch(_0x593a3e+'/organization/me',{'method':'GET','headers':{'workos-token':_0x5cb9c1}});if(_0x2fd792['ok'])return _0x2fd792['json']();}catch{}return null;}function buildKeyName(_0x39b6cd,_0x57c7f3){const _0xf7c278=_0x919fda,_0x33fbaf=_0x57c7f3[_0xf7c278(0x22e)](_0x15a22d=>_0x15a22d[_0xf7c278(0x1f7)]===_0x39b6cd||_0x15a22d[_0xf7c278(0x1f7)]['startsWith'](_0x39b6cd+'\x20('));if(_0x33fbaf[_0xf7c278(0x211)]===0x0)return _0x39b6cd;return _0x39b6cd+'\x20('+(_0x33fbaf['length']+0x1)+')';}export async function provisionApiKey(_0x18a06b){const _0xa5c177=_0x919fda,_0x1e9a37={'bLqmD':function(_0x183154){return _0x183154();},'unFIH':function(_0x8b482a,_0x4de0d8,_0x6c31b8){return _0x8b482a(_0x4de0d8,_0x6c31b8);},'jTchD':'GET'},_0x42e351=_0x1e9a37[_0xa5c177(0x200)](getApiBaseUrl),_0x1db362={'Content-Type':_0xa5c177(0x236),'workos-token':_0x18a06b},_0x210262=await fetchUserProfile(_0x18a06b),_0x28b08c=_0x210262?.[_0xa5c177(0x219)]||_0x210262?.['email']?.[_0xa5c177(0x235)]('@')[0x0],_0x566a27=_0x28b08c?_0x28b08c+_0xa5c177(0x214):'CLI\x20Key';let _0xf1e307=[];try{const _0x3fda33=await _0x1e9a37['unFIH'](fetch,_0x42e351+'/api-keys',{'method':_0x1e9a37['jTchD'],'headers':_0x1db362});if(_0x3fda33['ok']){const _0x412ef3=await _0x3fda33[_0xa5c177(0x20a)]();_0xf1e307=_0x412ef3['apiKeys'];}}catch{}const _0x3068f3=buildKeyName(_0x566a27,_0xf1e307),_0x341b03=await _0x1e9a37['unFIH'](fetch,_0x42e351+_0xa5c177(0x220),{'method':_0xa5c177(0x223),'headers':_0x1db362,'body':JSON['stringify']({'name':_0x3068f3,'scope':_0xa5c177(0x237)})});if(!_0x341b03['ok']){const _0x30379c=await _0x341b03['text']();throw new Error('Failed\x20to\x20provision\x20API\x20key:\x20'+_0x341b03['status']+'\x20'+_0x30379c);}const _0x31618d=await _0x341b03['json']();return _0x31618d['apiKey']['token'];}export function openBrowser(_0x4ccabf){const _0x34c9c1=_0x919fda,_0x56ed2e={'nVydg':function(_0x17f165,_0x4a3c77){return _0x17f165===_0x4a3c77;},'VZfKO':_0x34c9c1(0x1fc),'WnEZc':'open','hXmwA':_0x34c9c1(0x22f),'igygZ':function(_0xeab00d,_0x86c481,_0x4a2276,_0x4f833a){return _0xeab00d(_0x86c481,_0x4a2276,_0x4f833a);},'JelDs':'ignore'};try{if(_0x56ed2e['nVydg'](process['platform'],_0x56ed2e['VZfKO'])){const _0xf2fda8=spawn('cmd',['/c',_0x34c9c1(0x210),'',_0x4ccabf],{'detached':!![],'stdio':'ignore','windowsHide':!![]});_0xf2fda8['unref']();return;}const _0x635adf=_0x56ed2e[_0x34c9c1(0x23a)](process[_0x34c9c1(0x205)],_0x34c9c1(0x217))?_0x56ed2e[_0x34c9c1(0x1fb)]:_0x56ed2e['hXmwA'],_0x1e6be5=_0x56ed2e[_0x34c9c1(0x1f5)](spawn,_0x635adf,[_0x4ccabf],{'detached':!![],'stdio':_0x56ed2e['JelDs']});_0x1e6be5['unref']();}catch{}}function decodeJwtPayload(_0x3192be){const _0x10e0a7=_0x919fda,_0x51c500={'JCycZ':_0x10e0a7(0x23e),'ewQZx':'base64url'},_0x101863=_0x3192be[_0x10e0a7(0x235)]('.');if(_0x101863[_0x10e0a7(0x211)]!==0x3)throw new Error(_0x51c500[_0x10e0a7(0x22b)]);const _0x5a564f=Buffer[_0x10e0a7(0x21f)](_0x101863[0x1],_0x51c500[_0x10e0a7(0x239)])['toString']('utf-8');return JSON[_0x10e0a7(0x201)](_0x5a564f);}async function selfServeSignup(_0x117f20){const _0xa12592=_0x919fda,_0x1599c8={'wDubH':function(_0x222139){return _0x222139();},'jzdQQ':function(_0x32fde5,_0x1edc3b,_0x32742d){return _0x32fde5(_0x1edc3b,_0x32742d);},'MSaGP':'POST','sLDBx':'application/json'},_0x516eed=_0x1599c8[_0xa12592(0x222)](getApiBaseUrl),_0x4f6d60=await _0x1599c8['jzdQQ'](fetch,_0x516eed+_0xa12592(0x230),{'method':_0x1599c8['MSaGP'],'headers':{'Content-Type':_0x1599c8[_0xa12592(0x234)],'workos-token':_0x117f20}});if(!_0x4f6d60['ok']){const _0x3bf159=await _0x4f6d60[_0xa12592(0x1fd)]();throw new Error(_0xa12592(0x221)+_0x4f6d60[_0xa12592(0x21d)]+'\x20'+_0x3bf159);}return _0x4f6d60[_0xa12592(0x20a)]();}function _0x36da(_0x1d6049,_0x2978bc){_0x1d6049=_0x1d6049-0x1f0;const _0x51732e=_0x5173();let _0x36da8e=_0x51732e[_0x1d6049];return _0x36da8e;}async function fetchMyMemberships(_0x5a2a76){const _0x474694=_0x919fda,_0x259d12={'adtky':function(_0x53c5df){return _0x53c5df();},'IbxMx':function(_0x172570,_0x1da2b2,_0x2c01fa){return _0x172570(_0x1da2b2,_0x2c01fa);},'IYylH':'GET'},_0x44d925=_0x259d12['adtky'](getApiBaseUrl),_0x50a98d=await _0x259d12['IbxMx'](fetch,_0x44d925+'/organization/my-memberships',{'method':_0x259d12['IYylH'],'headers':{'workos-token':_0x5a2a76}});if(!_0x50a98d['ok']){const _0x17a130=await _0x50a98d[_0x474694(0x1fd)]();throw new Error('Failed\x20to\x20fetch\x20memberships:\x20'+_0x50a98d['status']+'\x20'+_0x17a130);}const _0x5d5329=await _0x50a98d[_0x474694(0x20a)]();return _0x5d5329[_0x474694(0x218)];}async function refreshTokenWithOrg(_0x15e7e7,_0x240369,_0xf8a503){const _0xc141a5=_0x919fda,_0x5cc104={'fUezT':function(_0x10fd81,_0x2470cc,_0x3f9af5){return _0x10fd81(_0x2470cc,_0x3f9af5);},'vaGZE':_0xc141a5(0x215)},_0xc13f81=await _0x5cc104[_0xc141a5(0x21c)](fetch,WORKOS_TOKEN_URL,{'method':_0xc141a5(0x223),'headers':{'Content-Type':_0xc141a5(0x1f8)},'body':new URLSearchParams({'client_id':_0x15e7e7,'grant_type':_0x5cc104[_0xc141a5(0x1f0)],'refresh_token':_0x240369,'organization_id':_0xf8a503})});if(!_0xc13f81['ok']){const _0x15e839=await _0xc13f81[_0xc141a5(0x1fd)]();throw new Error(_0xc141a5(0x20d)+_0xc13f81['status']+'\x20'+_0x15e839);}return _0xc13f81[_0xc141a5(0x20a)]();}function _0x5173(){const _0x4af5ee=['OAgOx','xIRTJ','stdin','Invalid\x20JWT\x20format','error_description','4gifgKU','Using\x20organization:\x20','write','log','iTzMn','vaGZE','7914112nefcUx','mpffi','MkWlD','Code:\x20','igygZ','authorization_pending','name','application/x-www-form-urlencoded','vOipC','Failed\x20to\x20request\x20device\x20code:\x20','WnEZc','win32','text','isTTY','86834OtFnfE','bLqmD','parse','iUAip','org_id','ZKTSW','platform','token','4217485IJKrxb','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','error','json','prompt','verification_uri_complete','Failed\x20to\x20refresh\x20token\x20with\x20org:\x20','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','tWrKf','start','length','Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','CVfQq','\x27s\x20CLI\x20Key','refresh_token','https://api.workos.com/user_management/authenticate','darwin','memberships','firstName','34161160eGxvvg','XFatz','fUezT','status','/cli-auth/token','from','/api-keys','Failed\x20to\x20create\x20organization:\x20','wDubH','POST','interval','device_code','stdout','slow_down','7gfpofq','Waiting\x20for\x20authentication...','leycp','JCycZ','217854NduBvy','381237AgNoXQ','filter','xdg-open','/organization/self-serve-signup','12RmTzjN','8337510KspTjl','RpfLs','sLDBx','split','application/json','mcp:write','access_token','ewQZx','nVydg'];_0x5173=function(){return _0x4af5ee;};return _0x5173();}async function provisionCliToken(_0x24d526){const _0x2454f6=_0x919fda,_0x42b536={'zaUSK':function(_0x38f884,_0x1276f1,_0x4f4db8){return _0x38f884(_0x1276f1,_0x4f4db8);}},_0x2974c6=getApiBaseUrl(),_0x31db8d=await _0x42b536['zaUSK'](fetch,_0x2974c6+_0x2454f6(0x21e),{'method':_0x2454f6(0x223),'headers':{'Content-Type':_0x2454f6(0x236),'workos-token':_0x24d526}});if(!_0x31db8d['ok']){const _0x5c313c=await _0x31db8d['text']();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x31db8d[_0x2454f6(0x21d)]+'\x20'+_0x5c313c);}return _0x31db8d['json']();}export async function runDeviceAuthFlow(){const _0x5e475c=_0x919fda,_0x3e16c1={'iTzMn':function(_0x2e4444,_0x4fa2af){return _0x2e4444(_0x4fa2af);},'XFatz':_0x5e475c(0x229),'xQwCS':function(_0x504f72,_0x53522d,_0x4cddbe,_0x4dfe50,_0x4649e0){return _0x504f72(_0x53522d,_0x4cddbe,_0x4dfe50,_0x4649e0);},'sLYQG':function(_0x5a7dbe,_0x2eac3b){return _0x5a7dbe===_0x2eac3b;},'RpfLs':function(_0x536c9b,_0x210cb3){return _0x536c9b(_0x210cb3);},'CVfQq':function(_0x2ee43a,_0x3fb989){return _0x2ee43a===_0x3fb989;},'sfBEv':function(_0x6539df,_0x2ce303){return _0x6539df+_0x2ce303;},'ZKTSW':'list','xQIsC':'Select\x20an\x20organization:','tWrKf':function(_0x530b21,_0x2b9272,_0x56d329,_0x5e4d30){return _0x530b21(_0x2b9272,_0x56d329,_0x5e4d30);},'JOZjd':'Provisioning\x20CLI\x20token...','xBCOw':function(_0x5ce23b,_0x552f1f){return _0x5ce23b(_0x552f1f);}},_0x1f53f5=getCurrentEnvironment(),_0x502831=ENVIRONMENT_CONFIGS[_0x1f53f5]['workosClientId'],_0x2013ee=await requestDeviceCode(_0x502831);console[_0x5e475c(0x243)]('\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...'),console[_0x5e475c(0x243)](_0x5e475c(0x208)),_0x3e16c1[_0x5e475c(0x244)](openBrowser,_0x2013ee[_0x5e475c(0x20c)]),console[_0x5e475c(0x243)](_0x5e475c(0x20e)+_0x2013ee['verification_uri_complete']),console['log'](_0x5e475c(0x1f4)+_0x2013ee['user_code']+'\x0a'),process[_0x5e475c(0x226)]['write'](_0x3e16c1[_0x5e475c(0x21b)]);let _0x36b671=await _0x3e16c1['xQwCS'](pollForTokens,_0x502831,_0x2013ee[_0x5e475c(0x225)],_0x2013ee[_0x5e475c(0x224)],_0x2013ee['expires_in']);console['log']('\x20✓');const _0x35faf2=decodeJwtPayload(_0x36b671['access_token']);if(!_0x35faf2[_0x5e475c(0x203)]){const _0x3770f3=await fetchMyMemberships(_0x36b671['access_token']);let _0x3205d3;if(_0x3e16c1['sLYQG'](_0x3770f3[_0x5e475c(0x211)],0x0)){process[_0x5e475c(0x226)][_0x5e475c(0x242)]('Setting\x20up\x20your\x20organization...');const _0x20e98d=await _0x3e16c1['RpfLs'](selfServeSignup,_0x36b671[_0x5e475c(0x238)]);_0x3205d3=_0x20e98d['organizationId'],console[_0x5e475c(0x243)]('\x20✓');}else{if(_0x3e16c1[_0x5e475c(0x213)](_0x3770f3[_0x5e475c(0x211)],0x1))_0x3205d3=_0x3770f3[0x0]['organizationId'],console['log'](_0x5e475c(0x241)+_0x3770f3[0x0][_0x5e475c(0x1f7)]);else{const _0x1258bc=process[_0x5e475c(0x23d)]['isTTY']&&process['stdout'][_0x5e475c(0x1fe)];if(!_0x1258bc)throw new Error(_0x3e16c1['sfBEv']('Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a',_0x5e475c(0x212)));const {selected:_0x28806a}=await _0xd17246[_0x5e475c(0x20b)]([{'type':_0x3e16c1[_0x5e475c(0x204)],'name':'selected','message':_0x3e16c1['xQIsC'],'choices':_0x3770f3['map'](_0x1fc1aa=>({'name':_0x1fc1aa['name'],'value':_0x1fc1aa['organizationId']}))}]);_0x3205d3=_0x28806a;}}_0x36b671=await _0x3e16c1[_0x5e475c(0x20f)](refreshTokenWithOrg,_0x502831,_0x36b671[_0x5e475c(0x215)],_0x3205d3);}process[_0x5e475c(0x226)][_0x5e475c(0x242)](_0x3e16c1['JOZjd']);const _0x4507e8=await _0x3e16c1[_0x5e475c(0x233)](provisionCliToken,_0x36b671[_0x5e475c(0x238)]);return console[_0x5e475c(0x243)]('\x20✓'),await storeToken(_0x4507e8[_0x5e475c(0x206)]),_0x36b671['refresh_token']&&await _0x3e16c1['xBCOw'](storeRefreshToken,_0x36b671['refresh_token']),_0x4507e8['token'];}function sleep(_0x18777b){return new Promise(_0x4f9caa=>setTimeout(_0x4f9caa,_0x18777b));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x19be72=_0x4184;function _0xd888(){const _0x5e66a9=['YrrQF','https://ai-proxy-716115358910.us-central1.run.app','kQKtw','staging','error','pBxkW','Invalid\x20RANGER_TRANSPORT=\x22','RANGER_DISABLE_MCP','rangerwright-cli','\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.','576261pMcFzl','wpeyU','RANGER_TRANSPORT','204696ZovzML','SqteU','445608LUJciL','8AOtQCY','aiProxyUrl','44osWGzE','auto','https://api.staging.ranger.net','mcpAuthUrl','find','rigJK','true','7179Uqpkom','mcp','http://localhost:8080/mcp','env','JhkFz','1520876jFNeBY','600390xSVvAQ','RANGER_HOOKS','apiBaseUrl','180oHFstW','RANGER_USE_NOVA_ACT','45138xuhmRo','https://api.ranger.net','local','1aGBWGS','http://localhost:8080','client_01J9CBYM2DKWV9HM17D95Z540K','125AzOjuJ'];_0xd888=function(){return _0x5e66a9;};return _0xd888();}(function(_0x3a74a1,_0x354e12){const _0x4bd1b6=_0x4184,_0x53619b=_0x3a74a1();while(!![]){try{const _0x570055=-parseInt(_0x4bd1b6(0x86))/0x1*(parseInt(_0x4bd1b6(0x99))/0x2)+parseInt(_0x4bd1b6(0x78))/0x3*(-parseInt(_0x4bd1b6(0x81))/0x4)+-parseInt(_0x4bd1b6(0x89))/0x5*(-parseInt(_0x4bd1b6(0x83))/0x6)+parseInt(_0x4bd1b6(0x7d))/0x7*(parseInt(_0x4bd1b6(0x9a))/0x8)+parseInt(_0x4bd1b6(0x94))/0x9+parseInt(_0x4bd1b6(0x7e))/0xa+-parseInt(_0x4bd1b6(0x9c))/0xb*(parseInt(_0x4bd1b6(0x97))/0xc);if(_0x570055===_0x354e12)break;else _0x53619b['push'](_0x53619b['shift']());}catch(_0x11cf62){_0x53619b['push'](_0x53619b['shift']());}}}(_0xd888,0x1fe82));export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':_0x19be72(0x84),'workosClientId':'client_01J9CBYM7M5ZETCF7G6614DXR2','aiProxyUrl':_0x19be72(0x8b),'mcpAuthUrl':'https://mcp-auth.ranger.net/mcp'},'staging':{'apiBaseUrl':_0x19be72(0x9e),'workosClientId':_0x19be72(0x88),'aiProxyUrl':'https://ai-proxy-301751771437.us-central1.run.app','mcpAuthUrl':'https://mcp-auth.staging.ranger.net/mcp'},'local':{'apiBaseUrl':_0x19be72(0x87),'workosClientId':'client_01J9CBYM2DKWV9HM17D95Z540K','aiProxyUrl':'http://localhost:8090','mcpAuthUrl':_0x19be72(0x7a)}};export const DEFAULT_ENVIRONMENT='prod';export function isValidEnvironment(_0x11b2b9){const _0x458858=_0x19be72,_0x604ff7={'oxURw':function(_0x26a27d,_0x2e1523){return _0x26a27d===_0x2e1523;},'rigJK':'prod','FfgjK':_0x458858(0x8d),'wpeyU':_0x458858(0x85)};return _0x604ff7['oxURw'](_0x11b2b9,_0x604ff7[_0x458858(0xa1)])||_0x604ff7['oxURw'](_0x11b2b9,_0x604ff7['FfgjK'])||_0x11b2b9===_0x604ff7[_0x458858(0x95)];}export function getCurrentEnvironment(){const _0xdf30fa=_0x19be72,_0x23d4e2={'YrrQF':function(_0x530256,_0x3c6fd3){return _0x530256(_0x3c6fd3);}},_0x4aba56=process[_0xdf30fa(0x7b)]['RANGER_CLI_ENV'];if(_0x4aba56&&_0x23d4e2[_0xdf30fa(0x8a)](isValidEnvironment,_0x4aba56))return _0x4aba56;return DEFAULT_ENVIRONMENT;}export function getApiBaseUrl(){const _0x1b5833=_0x19be72;return ENVIRONMENT_CONFIGS[getCurrentEnvironment()][_0x1b5833(0x80)];}export function getAiProxyUrl(){const _0x2f516b=_0x19be72;return ENVIRONMENT_CONFIGS[getCurrentEnvironment()][_0x2f516b(0x9b)];}export function getMcpAuthUrl(){const _0xea0931=_0x19be72;return process['env']['RANGER_MCP_AUTH_URL']??ENVIRONMENT_CONFIGS[getCurrentEnvironment()][_0xea0931(0x9f)];}export function isByokEnabled(){const _0x165301=_0x19be72,_0x462870={'kQKtw':_0x165301(0x77)};return process['env']['RANGER_BYOK']===_0x462870[_0x165301(0x8c)];}function isVerificationTransport(_0x431230){const _0x2747b6=_0x19be72,_0x3d8a26={'pBxkW':_0x2747b6(0x79),'jxxYA':function(_0xc3e164,_0x11adb7){return _0xc3e164===_0x11adb7;},'dYgYE':'playwright-cli','uqBti':'nova-act-cli','SqteU':function(_0x119912,_0x5ae27e){return _0x119912===_0x5ae27e;},'JhkFz':_0x2747b6(0x92)};return _0x431230===_0x3d8a26[_0x2747b6(0x8f)]||_0x3d8a26['jxxYA'](_0x431230,_0x3d8a26['dYgYE'])||_0x3d8a26['jxxYA'](_0x431230,_0x3d8a26['uqBti'])||_0x3d8a26[_0x2747b6(0x98)](_0x431230,_0x3d8a26[_0x2747b6(0x7c)]);}const LEGACY_TRANSPORT_ENV_VARS=[_0x19be72(0x82),_0x19be72(0x91)];export function getVerificationTransport(){const _0x34f660=_0x19be72,_0x4c1a6e=process['env'][_0x34f660(0x96)]?.['trim']();if(_0x4c1a6e){if(isVerificationTransport(_0x4c1a6e))return _0x4c1a6e;throw new Error(_0x34f660(0x90)+_0x4c1a6e+'\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.');}const _0x4dc484=LEGACY_TRANSPORT_ENV_VARS[_0x34f660(0xa0)](_0x24925e=>process[_0x34f660(0x7b)][_0x24925e]);if(_0x4dc484)throw new Error(_0x4dc484+_0x34f660(0x93));return'mcp';}function _0x4184(_0x2b4a89,_0x1f4720){_0x2b4a89=_0x2b4a89-0x77;const _0xd8886b=_0xd888();let _0x418439=_0xd8886b[_0x2b4a89];return _0x418439;}export function resolveHookMode(_0x208b51=process[_0x19be72(0x7b)]){const _0x544a2d=_0x19be72,_0x236494={'GnWpM':function(_0x3e31c3,_0x39ed13){return _0x3e31c3===_0x39ed13;}},_0x1b6b95=_0x208b51['RANGER_HOOKS']?.['trim']()['toLowerCase']();if(!_0x1b6b95)return _0x544a2d(0x9d);if(_0x1b6b95==='off'||_0x236494['GnWpM'](_0x1b6b95,'on')||_0x1b6b95==='auto')return _0x1b6b95;return console[_0x544a2d(0x8e)]('[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22'+_0x208b51[_0x544a2d(0x7f)]+'\x22.\x20'+'Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.'),'auto';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x2d3dae,_0x5a738d){const _0x458833=_0x3a20,_0x51ca15=_0x2d3dae();while(!![]){try{const _0x124147=-parseInt(_0x458833(0x1c2))/0x1*(-parseInt(_0x458833(0x18b))/0x2)+-parseInt(_0x458833(0x19c))/0x3*(parseInt(_0x458833(0x1c7))/0x4)+-parseInt(_0x458833(0x19d))/0x5*(-parseInt(_0x458833(0x196))/0x6)+parseInt(_0x458833(0x198))/0x7+-parseInt(_0x458833(0x1b7))/0x8*(-parseInt(_0x458833(0x1a4))/0x9)+-parseInt(_0x458833(0x191))/0xa*(parseInt(_0x458833(0x1cb))/0xb)+-parseInt(_0x458833(0x1b0))/0xc;if(_0x124147===_0x5a738d)break;else _0x51ca15['push'](_0x51ca15['shift']());}catch(_0x15c6c9){_0x51ca15['push'](_0x51ca15['shift']());}}}(_0x59d6,0xbceb5));import{getToken}from'./keychain.js';function _0x3a20(_0x238282,_0x26f79c){_0x238282=_0x238282-0x18b;const _0x59d6f7=_0x59d6();let _0x3a202a=_0x59d6f7[_0x238282];return _0x3a202a;}import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x1ae61c){const _0x2ac420=_0x3a20,_0x3e5742={'BtpLA':function(_0x216e26){return _0x216e26();},'CpxgR':_0x2ac420(0x193)},_0x59c35b=await _0x3e5742[_0x2ac420(0x1b3)](getToken);if(!_0x59c35b)throw new Error(_0x2ac420(0x1b5));const _0x2c8584=getApiBaseUrl(),_0x36f4e2=await fetch(_0x2c8584+'/api/v1/mcp/features',{'method':'POST','headers':{'Authorization':_0x2ac420(0x1b9)+_0x59c35b,'Content-Type':'application/json'},'body':JSON['stringify'](_0x1ae61c)});if(!_0x36f4e2['ok']){if(_0x36f4e2[_0x2ac420(0x1b8)]===0x192){const _0x6f733f=await _0x36f4e2['json'](),_0x154817=_0x6f733f[_0x2ac420(0x1c3)]||_0x2ac420(0x19e);throw new Error((_0x6f733f['message']||_0x3e5742['CpxgR'])+'\x0a\x0aUpgrade\x20your\x20plan:\x20'+_0x154817);}const _0x99b30f=await _0x36f4e2[_0x2ac420(0x1d0)]();throw new Error('Failed\x20to\x20create\x20feature\x20review:\x20'+_0x99b30f);}return _0x36f4e2[_0x2ac420(0x1b6)]();}function _0x59d6(){const _0x19a031=['9255008xEgGal','kbONn','cwWOw','limit','962085qvCpIg','866605wUPOFm','https://dashboard.ranger.net/billing','Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20','fNIcM','application/json','/sessions/','JBNMs','334926VtvoyK','rRbaF','MerAe','stringify','UXcCf','PATCH','pwDkl','/start','qfbBg','Failed\x20to\x20get\x20action\x20items:\x20','GET','/api/v1/mcp/features','14673204MPcTyT','/api/v1/mcp/features/','/comments/address','BtpLA','true','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','json','168hAtZpI','status','Bearer\x20','Failed\x20to\x20list\x20feature\x20reviews:\x20','join','offset','QYBlV','UWhFh','gitRepoUrl','MFKrh','flWKo','549436ubuVQq','billingUrl','dfAjA','itemIds','LsgHV','8UFhqCa','Failed\x20to\x20restore\x20feature\x20review:\x20','hblix','includeDeleted','8116471kSBHQZ','EaBUz','Failed\x20to\x20update\x20scenario:\x20','set','siTlt','text','/feedback','Xcyvc','DELETE','rVhHF','POST','sMheE','wSigw','gitBranch','4qZkOMZ','ZqLYi','WYaUm','bHqIy','/conclude','QNuHa','10VEQWLe','Failed\x20to\x20conclude\x20session:\x20','Feature\x20limit\x20exceeded','sessionId','toString','6JVXsdU','hWYCP'];_0x59d6=function(){return _0x19a031;};return _0x59d6();}export async function listFeatures(_0xd6cf92){const _0x334408=_0x3a20,_0x4fb23c={'UXcCf':function(_0x58b6d6){return _0x58b6d6();},'kbONn':_0x334408(0x1bf),'LsgHV':_0x334408(0x1d8),'cwWOw':_0x334408(0x19b),'bHqIy':_0x334408(0x1ca)},_0x2c116a=await _0x4fb23c[_0x334408(0x1a8)](getToken);if(!_0x2c116a)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0xac1c1e=getApiBaseUrl(),_0x31eea6=new URLSearchParams();if(_0xd6cf92?.[_0x334408(0x1bf)])_0x31eea6['set'](_0x4fb23c[_0x334408(0x199)],_0xd6cf92['gitRepoUrl']);if(_0xd6cf92?.[_0x334408(0x1d8)])_0x31eea6['set'](_0x4fb23c[_0x334408(0x1c6)],_0xd6cf92['gitBranch']);if(_0xd6cf92?.[_0x334408(0x19b)])_0x31eea6['set'](_0x4fb23c[_0x334408(0x19a)],_0xd6cf92['limit']['toString']());if(_0xd6cf92?.[_0x334408(0x1bc)])_0x31eea6['set']('offset',_0xd6cf92[_0x334408(0x1bc)]['toString']());if(_0xd6cf92?.['includeDeleted'])_0x31eea6['set'](_0x4fb23c[_0x334408(0x18e)],_0x334408(0x1b4));const _0x1b0a19=_0xac1c1e+_0x334408(0x1af)+(_0x31eea6['toString']()?'?'+_0x31eea6[_0x334408(0x195)]():''),_0x1d6ef1=await fetch(_0x1b0a19,{'method':_0x334408(0x1ae),'headers':{'Authorization':'Bearer\x20'+_0x2c116a}});if(!_0x1d6ef1['ok']){const _0x4c62c3=await _0x1d6ef1[_0x334408(0x1d0)]();throw new Error(_0x334408(0x1ba)+_0x4c62c3);}return _0x1d6ef1['json']();}export async function getFeature(_0x2248d9){const _0x63ea14=_0x3a20,_0x55ed22={'hWYCP':function(_0x2fc899){return _0x2fc899();},'sMheE':function(_0x1668bb,_0x5a807d,_0x7a79a4){return _0x1668bb(_0x5a807d,_0x7a79a4);},'hblix':_0x63ea14(0x1ae)},_0x1ce40e=await _0x55ed22[_0x63ea14(0x197)](getToken);if(!_0x1ce40e)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x26711b=getApiBaseUrl(),_0x1cbbe1=await _0x55ed22[_0x63ea14(0x1d6)](fetch,_0x26711b+_0x63ea14(0x1b1)+_0x2248d9,{'method':_0x55ed22[_0x63ea14(0x1c9)],'headers':{'Authorization':'Bearer\x20'+_0x1ce40e}});if(!_0x1cbbe1['ok']){const _0x1d0888=await _0x1cbbe1[_0x63ea14(0x1d0)]();throw new Error('Failed\x20to\x20get\x20feature\x20review:\x20'+_0x1d0888);}return _0x1cbbe1['json']();}export async function updateFeature(_0xdad7c5,_0x46baef){const _0x5ed8de=_0x3a20,_0x516e5b={'wSigw':function(_0x1088b){return _0x1088b();},'ZqLYi':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','fNIcM':_0x5ed8de(0x1a9),'EaBUz':_0x5ed8de(0x1a1)},_0x5c7c67=await _0x516e5b['wSigw'](getToken);if(!_0x5c7c67)throw new Error(_0x516e5b[_0x5ed8de(0x18c)]);const _0x241e45=_0x516e5b[_0x5ed8de(0x1d7)](getApiBaseUrl),_0x51e1d6=await fetch(_0x241e45+'/api/v1/mcp/features/'+_0xdad7c5,{'method':_0x516e5b[_0x5ed8de(0x1a0)],'headers':{'Authorization':_0x5ed8de(0x1b9)+_0x5c7c67,'Content-Type':_0x516e5b[_0x5ed8de(0x1cc)]},'body':JSON['stringify'](_0x46baef)});if(!_0x51e1d6['ok']){const _0x5de5fa=await _0x51e1d6[_0x5ed8de(0x1d0)]();throw new Error('Failed\x20to\x20update\x20feature\x20review:\x20'+_0x5de5fa);}return _0x51e1d6['json']();}export async function createChecklistItem(_0xedb547,_0x22573a,_0xdd8d0){const _0x11bb87=_0x3a20,_0x37b433={'CUPxS':function(_0x463862){return _0x463862();},'VxgKI':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','rRbaF':'POST'},_0x474999=await _0x37b433['CUPxS'](getToken);if(!_0x474999)throw new Error(_0x37b433['VxgKI']);const _0x58595f=getApiBaseUrl(),_0x37fe99=await fetch(_0x58595f+_0x11bb87(0x1b1)+_0xedb547+'/checklist',{'method':_0x37b433[_0x11bb87(0x1a5)],'headers':{'Authorization':_0x11bb87(0x1b9)+_0x474999,'Content-Type':_0x11bb87(0x1a1)},'body':JSON['stringify']({'description':_0x22573a,'position':_0xdd8d0})});if(!_0x37fe99['ok']){const _0x4a28e7=await _0x37fe99[_0x11bb87(0x1d0)]();throw new Error('Failed\x20to\x20create\x20scenario:\x20'+_0x4a28e7);}return _0x37fe99['json']();}export async function updateChecklistItem(_0x2288f2,_0x530182,_0x4003fe){const _0x5b9203=_0x3a20,_0x101e34={'siTlt':function(_0x701e2e){return _0x701e2e();},'fxaNg':function(_0x50cd47){return _0x50cd47();},'qfbBg':function(_0x5e5977,_0x4243bb,_0x7a6ea6){return _0x5e5977(_0x4243bb,_0x7a6ea6);},'QYBlV':'application/json','UWhFh':'updateChecklistItem'};return _0x101e34[_0x5b9203(0x1ac)](withRetry,async()=>{const _0x3306fa=_0x5b9203,_0x5bcbec=await _0x101e34[_0x3306fa(0x1cf)](getToken);if(!_0x5bcbec)throw new Error(_0x3306fa(0x1b5));const _0x4f4503=_0x101e34['fxaNg'](getApiBaseUrl),_0x16c56c=await _0x101e34['qfbBg'](fetch,_0x4f4503+'/api/v1/mcp/features/'+_0x2288f2+'/checklist/'+_0x530182,{'method':_0x3306fa(0x1a9),'headers':{'Authorization':'Bearer\x20'+_0x5bcbec,'Content-Type':_0x101e34[_0x3306fa(0x1bd)]},'body':JSON['stringify'](_0x4003fe)});if(!_0x16c56c['ok']){const _0x17f0ec=await _0x16c56c[_0x3306fa(0x1d0)]();throw new Error(_0x3306fa(0x1cd)+_0x17f0ec);}return _0x16c56c['json']();},{'label':_0x101e34[_0x5b9203(0x1be)]});}export async function getFeatureReport(_0x1a4758){const _0x138fc3=_0x3a20,_0x3b9475={'hJAwQ':function(_0x27a94b,_0x30bd68,_0x2638ca){return _0x27a94b(_0x30bd68,_0x2638ca);}},_0x7d3a6d=await getToken();if(!_0x7d3a6d)throw new Error(_0x138fc3(0x1b5));const _0x529bff=getApiBaseUrl(),_0x4a0ddc=await _0x3b9475['hJAwQ'](fetch,_0x529bff+_0x138fc3(0x1b1)+_0x1a4758+'/report',{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x7d3a6d}});if(!_0x4a0ddc['ok']){const _0x577c6a=await _0x4a0ddc['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x577c6a);}return _0x4a0ddc['json']();}export async function getFeatureReportMarkdown(_0x8b855,_0x2c6036){const _0x2135d7=_0x3a20,_0x139ece={'dfAjA':function(_0x1bebd3){return _0x1bebd3();},'cRfCs':function(_0x665ad2,_0x453687){return _0x665ad2(_0x453687);},'MerAe':'itemIds','obECq':'style'},_0x28dbab=await getToken();if(!_0x28dbab)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x19fc16=_0x139ece[_0x2135d7(0x1c4)](getApiBaseUrl),_0x187847=new URLSearchParams(),_0x5e9b37=(_0x2c6036?.[_0x2135d7(0x1c5)]?.['length']??0x0)>0x0,_0x156d88=_0x139ece['cRfCs'](Boolean,_0x2c6036?.['sessionId']);_0x5e9b37&&_0x2c6036?.['itemIds']&&_0x187847['set'](_0x139ece[_0x2135d7(0x1a6)],_0x2c6036[_0x2135d7(0x1c5)][_0x2135d7(0x1bb)](','));_0x156d88&&_0x2c6036?.['sessionId']&&_0x187847[_0x2135d7(0x1ce)](_0x2135d7(0x194),_0x2c6036[_0x2135d7(0x194)]);!_0x5e9b37&&!_0x156d88&&_0x2c6036?.['style']&&_0x187847['set'](_0x139ece['obECq'],_0x2c6036['style']);const _0x34acb2=_0x19fc16+'/api/v1/mcp/features/'+_0x8b855+'/report/markdown',_0x2ab458=''+_0x34acb2+(_0x187847['toString']()?'?'+_0x187847['toString']():''),_0x193f5b=await fetch(_0x2ab458,{'method':_0x2135d7(0x1ae),'headers':{'Authorization':'Bearer\x20'+_0x28dbab}});if(!_0x193f5b['ok']){const _0x2bcaed=await _0x193f5b['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20'+_0x2bcaed);}return _0x193f5b[_0x2135d7(0x1d0)]();}export async function listFeatureSessions(_0x412569){const _0xb8fcd0=_0x3a20,_0x4b21c7={'pAfYC':function(_0x461e75){return _0x461e75();},'QNuHa':_0xb8fcd0(0x1b5),'OKcLL':function(_0x2b6166,_0x3a1c0b,_0xfb08c){return _0x2b6166(_0x3a1c0b,_0xfb08c);},'YlDnn':_0xb8fcd0(0x1ae)},_0x56da70=await _0x4b21c7['pAfYC'](getToken);if(!_0x56da70)throw new Error(_0x4b21c7[_0xb8fcd0(0x190)]);const _0x69f14b=getApiBaseUrl(),_0xd79c2b=await _0x4b21c7['OKcLL'](fetch,_0x69f14b+'/api/v1/mcp/features/'+_0x412569+'/sessions',{'method':_0x4b21c7['YlDnn'],'headers':{'Authorization':'Bearer\x20'+_0x56da70}});if(!_0xd79c2b['ok']){const _0x54c5de=await _0xd79c2b[_0xb8fcd0(0x1d0)]();throw new Error('Failed\x20to\x20list\x20sessions:\x20'+_0x54c5de);}return _0xd79c2b[_0xb8fcd0(0x1b6)]();}export async function startSession(_0x1cd9fd,_0x547460){const _0x875b02=_0x3a20,_0x38ff03={'VAaHY':function(_0x34b3f5){return _0x34b3f5();},'JBNMs':function(_0x34e2b4,_0x59b552,_0x976dfd){return _0x34e2b4(_0x59b552,_0x976dfd);},'DrLdk':_0x875b02(0x1d5)},_0xa0327e=await _0x38ff03['VAaHY'](getToken);if(!_0xa0327e)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x5f0e13=getApiBaseUrl(),_0x4590a8=await _0x38ff03[_0x875b02(0x1a3)](fetch,_0x5f0e13+'/api/v1/mcp/features/'+_0x1cd9fd+_0x875b02(0x1a2)+_0x547460+_0x875b02(0x1ab),{'method':_0x38ff03['DrLdk'],'headers':{'Authorization':'Bearer\x20'+_0xa0327e}});if(!_0x4590a8['ok']){const _0x2fef0e=await _0x4590a8[_0x875b02(0x1d0)]();throw new Error('Failed\x20to\x20start\x20session:\x20'+_0x2fef0e);}return _0x4590a8['json']();}export async function concludeSession(_0x29c636,_0x14bd4c){const _0x365a65=_0x3a20,_0x354505={'AiwdG':function(_0xab639b){return _0xab639b();},'pwDkl':function(_0x36f695,_0x376f98,_0x32503b){return _0x36f695(_0x376f98,_0x32503b);}},_0x1d0389=await _0x354505['AiwdG'](getToken);if(!_0x1d0389)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x3c0aee=getApiBaseUrl(),_0x1ce774=await _0x354505[_0x365a65(0x1aa)](fetch,_0x3c0aee+'/api/v1/mcp/features/'+_0x29c636+_0x365a65(0x1a2)+_0x14bd4c+_0x365a65(0x18f),{'method':_0x365a65(0x1d5),'headers':{'Authorization':'Bearer\x20'+_0x1d0389}});if(!_0x1ce774['ok']){const _0x2473f0=await _0x1ce774[_0x365a65(0x1d0)]();throw new Error(_0x365a65(0x192)+_0x2473f0);}return _0x1ce774[_0x365a65(0x1b6)]();}export async function getActionItems(_0x41ef80){const _0x30e5d2=_0x3a20,_0x1163e4={'vRZEN':function(_0xad80d6){return _0xad80d6();},'Xcyvc':_0x30e5d2(0x1b5),'ArTBB':'GET'},_0x3ff340=await _0x1163e4['vRZEN'](getToken);if(!_0x3ff340)throw new Error(_0x1163e4[_0x30e5d2(0x1d2)]);const _0x593dc6=getApiBaseUrl(),_0x232640=await fetch(_0x593dc6+'/api/v1/mcp/features/'+_0x41ef80+'/action-items',{'method':_0x1163e4['ArTBB'],'headers':{'Authorization':_0x30e5d2(0x1b9)+_0x3ff340}});if(!_0x232640['ok']){const _0x89944c=await _0x232640[_0x30e5d2(0x1d0)]();throw new Error(_0x30e5d2(0x1ad)+_0x89944c);}return _0x232640[_0x30e5d2(0x1b6)]();}export async function getItemFeedback(_0x3b6bbc,_0x26fcbb){const _0x3aef1e=_0x3a20,_0x223b3d={'MFKrh':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x570272=await getToken();if(!_0x570272)throw new Error(_0x223b3d[_0x3aef1e(0x1c0)]);const _0x9f15b6=getApiBaseUrl(),_0x1f3078=await fetch(_0x9f15b6+'/api/v1/mcp/features/'+_0x3b6bbc+'/checklist-items/'+_0x26fcbb+_0x3aef1e(0x1d1),{'method':_0x3aef1e(0x1ae),'headers':{'Authorization':'Bearer\x20'+_0x570272}});if(!_0x1f3078['ok']){const _0x56bc58=await _0x1f3078['text']();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x56bc58);}return _0x1f3078[_0x3aef1e(0x1b6)]();}export async function markCommentsAddressed(_0x52a1bc,_0x308f13,_0x3f56a3){const _0xd2950=_0x3a20,_0x308ef7={'TihrK':function(_0x248600){return _0x248600();},'gdFHQ':_0xd2950(0x1b5),'qrSyM':'application/json'},_0x48aa5c=await _0x308ef7['TihrK'](getToken);if(!_0x48aa5c)throw new Error(_0x308ef7['gdFHQ']);const _0x4e0043=_0x308ef7['TihrK'](getApiBaseUrl),_0x492abf=await fetch(_0x4e0043+_0xd2950(0x1b1)+_0x52a1bc+_0xd2950(0x1b2),{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x48aa5c,'Content-Type':_0x308ef7['qrSyM']},'body':JSON[_0xd2950(0x1a7)]({'checklistItemId':_0x308f13,'commentIds':_0x3f56a3})});if(!_0x492abf['ok']){const _0x5daf1f=await _0x492abf['text']();throw new Error(_0xd2950(0x19f)+_0x5daf1f);}}export async function softDeleteFeature(_0x4e1d74){const _0x3b524b=_0x3a20,_0x3fb4ad={'DrCCb':function(_0x412022){return _0x412022();},'flWKo':function(_0x41b4d8,_0x2b25b0,_0x287881){return _0x41b4d8(_0x2b25b0,_0x287881);}},_0x45595b=await _0x3fb4ad['DrCCb'](getToken);if(!_0x45595b)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x258e7c=getApiBaseUrl(),_0x7b1c8b=await _0x3fb4ad[_0x3b524b(0x1c1)](fetch,_0x258e7c+_0x3b524b(0x1b1)+_0x4e1d74,{'method':_0x3b524b(0x1d3),'headers':{'Authorization':_0x3b524b(0x1b9)+_0x45595b}});if(!_0x7b1c8b['ok']){const _0x372391=await _0x7b1c8b[_0x3b524b(0x1d0)]();throw new Error('Failed\x20to\x20delete\x20feature\x20review:\x20'+_0x372391);}}export async function restoreFeature(_0xad4395){const _0x576d5e=_0x3a20,_0x200639={'rVhHF':function(_0x63de57){return _0x63de57();},'WYaUm':function(_0x341668,_0x40f3ab,_0x13be92){return _0x341668(_0x40f3ab,_0x13be92);},'tITIM':_0x576d5e(0x1d5)},_0x21fc55=await _0x200639['rVhHF'](getToken);if(!_0x21fc55)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x25e4c0=_0x200639[_0x576d5e(0x1d4)](getApiBaseUrl),_0x1dbf45=await _0x200639[_0x576d5e(0x18d)](fetch,_0x25e4c0+_0x576d5e(0x1b1)+_0xad4395+'/restore',{'method':_0x200639['tITIM'],'headers':{'Authorization':_0x576d5e(0x1b9)+_0x21fc55}});if(!_0x1dbf45['ok']){const _0x2abca5=await _0x1dbf45[_0x576d5e(0x1d0)]();throw new Error(_0x576d5e(0x1c8)+_0x2abca5);}}
|
|
1
|
+
(function(_0x774224,_0x418f6c){const _0x2dfb8b=_0x42ef,_0x449cf7=_0x774224();while(!![]){try{const _0x4de8a6=parseInt(_0x2dfb8b(0x12f))/0x1+-parseInt(_0x2dfb8b(0x119))/0x2+parseInt(_0x2dfb8b(0x13d))/0x3+parseInt(_0x2dfb8b(0x141))/0x4+-parseInt(_0x2dfb8b(0x124))/0x5+-parseInt(_0x2dfb8b(0x143))/0x6*(-parseInt(_0x2dfb8b(0x10c))/0x7)+-parseInt(_0x2dfb8b(0x115))/0x8*(parseInt(_0x2dfb8b(0x11a))/0x9);if(_0x4de8a6===_0x418f6c)break;else _0x449cf7['push'](_0x449cf7['shift']());}catch(_0x318e04){_0x449cf7['push'](_0x449cf7['shift']());}}}(_0x4626,0xc56b2));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';function _0x4626(){const _0x24166d=['8vCGWBV','HxTfu','dZORJ','style','772520ObYxXT','6187608bJDkIM','Failed\x20to\x20list\x20feature\x20reviews:\x20','WpsBQ','/report/markdown','YFusM','/sessions/','GET','join','UlIvl','CHWrH','4824285KHEEPg','aJrhR','pZsiw','https://dashboard.ranger.net/billing','Failed\x20to\x20start\x20session:\x20','limit','/api/v1/mcp/features','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','eLgJH','offset','gitBranch','91877fyNYGT','PnVNz','billingUrl','/checklist/','sessionId','/report','Failed\x20to\x20get\x20item\x20feedback:\x20','/sessions','\x0a\x0aUpgrade\x20your\x20plan:\x20','includeDeleted','text','Failed\x20to\x20update\x20feature\x20review:\x20','stringify','zzvJe','681600cKJfwM','itemIds','uBDLx','Fyire','4282140kKwozF','length','8745858pMEcDn','application/json','hXqFF','NyotR','zjAbx','json','dprIb','set','HuRRL','POST','Qlwgd','CQaoO','Bearer\x20','dIQiY','gitRepoUrl','toString','/start','TVjfN','GBzti','/api/v1/mcp/features/','/checklist-items/','7LbYiiS','IwqMK','/checklist','true','Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20','Failed\x20to\x20conclude\x20session:\x20','/conclude','/restore','FuejX'];_0x4626=function(){return _0x24166d;};return _0x4626();}export async function createFeature(_0x15f58c){const _0x17dc9f=_0x42ef,_0x555bd4={'wzFby':function(_0x55fbe1){return _0x55fbe1();},'zzvJe':function(_0x328a58,_0x29d0c3,_0x31415b){return _0x328a58(_0x29d0c3,_0x31415b);},'QvLMR':_0x17dc9f(0x100),'FuejX':_0x17dc9f(0x144),'MHbxe':function(_0xae946b,_0x1d8445){return _0xae946b===_0x1d8445;},'LdYfy':_0x17dc9f(0x127),'hWnKV':'Feature\x20limit\x20exceeded'},_0x1ffd58=await getToken();if(!_0x1ffd58)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x4c900c=_0x555bd4['wzFby'](getApiBaseUrl),_0x1a236c=await _0x555bd4[_0x17dc9f(0x13c)](fetch,_0x4c900c+'/api/v1/mcp/features',{'method':_0x555bd4['QvLMR'],'headers':{'Authorization':_0x17dc9f(0x103)+_0x1ffd58,'Content-Type':_0x555bd4[_0x17dc9f(0x114)]},'body':JSON['stringify'](_0x15f58c)});if(!_0x1a236c['ok']){if(_0x555bd4['MHbxe'](_0x1a236c['status'],0x192)){const _0x27eb7b=await _0x1a236c[_0x17dc9f(0xfc)](),_0x124e64=_0x27eb7b[_0x17dc9f(0x131)]||_0x555bd4['LdYfy'];throw new Error((_0x27eb7b['message']||_0x555bd4['hWnKV'])+_0x17dc9f(0x137)+_0x124e64);}const _0x1dfe66=await _0x1a236c[_0x17dc9f(0x139)]();throw new Error('Failed\x20to\x20create\x20feature\x20review:\x20'+_0x1dfe66);}return _0x1a236c['json']();}export async function listFeatures(_0x42715a){const _0x34d7b3=_0x42ef,_0x3d6216={'TVjfN':function(_0x407ea4){return _0x407ea4();},'coApc':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','uBDLx':'gitRepoUrl','GBzti':_0x34d7b3(0x129),'eLgJH':_0x34d7b3(0x12d),'IwqMK':_0x34d7b3(0x138),'GIkXA':_0x34d7b3(0x10f)},_0x37abf1=await _0x3d6216[_0x34d7b3(0x108)](getToken);if(!_0x37abf1)throw new Error(_0x3d6216['coApc']);const _0x44d7d4=getApiBaseUrl(),_0x22e1d4=new URLSearchParams();if(_0x42715a?.[_0x34d7b3(0x105)])_0x22e1d4[_0x34d7b3(0xfe)](_0x3d6216[_0x34d7b3(0x13f)],_0x42715a[_0x34d7b3(0x105)]);if(_0x42715a?.[_0x34d7b3(0x12e)])_0x22e1d4[_0x34d7b3(0xfe)](_0x34d7b3(0x12e),_0x42715a[_0x34d7b3(0x12e)]);if(_0x42715a?.[_0x34d7b3(0x129)])_0x22e1d4['set'](_0x3d6216[_0x34d7b3(0x109)],_0x42715a[_0x34d7b3(0x129)]['toString']());if(_0x42715a?.['offset'])_0x22e1d4[_0x34d7b3(0xfe)](_0x3d6216[_0x34d7b3(0x12c)],_0x42715a['offset']['toString']());if(_0x42715a?.['includeDeleted'])_0x22e1d4[_0x34d7b3(0xfe)](_0x3d6216[_0x34d7b3(0x10d)],_0x3d6216['GIkXA']);const _0x5c9854=_0x44d7d4+_0x34d7b3(0x12a)+(_0x22e1d4['toString']()?'?'+_0x22e1d4['toString']():''),_0x5e59c4=await fetch(_0x5c9854,{'method':'GET','headers':{'Authorization':_0x34d7b3(0x103)+_0x37abf1}});if(!_0x5e59c4['ok']){const _0x452ef4=await _0x5e59c4['text']();throw new Error(_0x34d7b3(0x11b)+_0x452ef4);}return _0x5e59c4[_0x34d7b3(0xfc)]();}export async function getFeature(_0x476919){const _0x523dec=_0x42ef,_0x2b4563={'vsUHN':function(_0x3eb740){return _0x3eb740();},'HxTfu':_0x523dec(0x12b),'gDBZV':'GET'},_0x329565=await _0x2b4563['vsUHN'](getToken);if(!_0x329565)throw new Error(_0x2b4563[_0x523dec(0x116)]);const _0x21c3ee=getApiBaseUrl(),_0x1fd761=await fetch(_0x21c3ee+'/api/v1/mcp/features/'+_0x476919,{'method':_0x2b4563['gDBZV'],'headers':{'Authorization':_0x523dec(0x103)+_0x329565}});if(!_0x1fd761['ok']){const _0x509b9e=await _0x1fd761[_0x523dec(0x139)]();throw new Error('Failed\x20to\x20get\x20feature\x20review:\x20'+_0x509b9e);}return _0x1fd761[_0x523dec(0xfc)]();}export async function updateFeature(_0x5b8e30,_0x3aa1ef){const _0x33d241=_0x42ef,_0x4187b6={'PnVNz':function(_0x2706fe,_0x32fc80,_0x11de45){return _0x2706fe(_0x32fc80,_0x11de45);},'Qigxc':'PATCH'},_0x104b8a=await getToken();if(!_0x104b8a)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x46ba34=getApiBaseUrl(),_0xa7769b=await _0x4187b6[_0x33d241(0x130)](fetch,_0x46ba34+'/api/v1/mcp/features/'+_0x5b8e30,{'method':_0x4187b6['Qigxc'],'headers':{'Authorization':'Bearer\x20'+_0x104b8a,'Content-Type':_0x33d241(0x144)},'body':JSON['stringify'](_0x3aa1ef)});if(!_0xa7769b['ok']){const _0x3d06c9=await _0xa7769b['text']();throw new Error(_0x33d241(0x13a)+_0x3d06c9);}return _0xa7769b[_0x33d241(0xfc)]();}export async function createChecklistItem(_0x9c9df4,_0x8e4ec8,_0x1b9053){const _0x249596=_0x42ef,_0x30aca7={'gKZJB':function(_0x576593){return _0x576593();},'nNpWw':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','OJVxB':function(_0x2df569,_0x299e61,_0xa08818){return _0x2df569(_0x299e61,_0xa08818);},'ggEsc':'POST'},_0x20c64e=await _0x30aca7['gKZJB'](getToken);if(!_0x20c64e)throw new Error(_0x30aca7['nNpWw']);const _0x575401=getApiBaseUrl(),_0xa44c45=await _0x30aca7['OJVxB'](fetch,_0x575401+'/api/v1/mcp/features/'+_0x9c9df4+_0x249596(0x10e),{'method':_0x30aca7['ggEsc'],'headers':{'Authorization':_0x249596(0x103)+_0x20c64e,'Content-Type':'application/json'},'body':JSON['stringify']({'description':_0x8e4ec8,'position':_0x1b9053})});if(!_0xa44c45['ok']){const _0x1f6e0d=await _0xa44c45[_0x249596(0x139)]();throw new Error('Failed\x20to\x20create\x20scenario:\x20'+_0x1f6e0d);}return _0xa44c45['json']();}export async function updateChecklistItem(_0x2ee2b2,_0x4392ab,_0x3dadf5){const _0x4277d0={'bowiz':function(_0x1eecb8){return _0x1eecb8();},'YFusM':'application/json'};return withRetry(async()=>{const _0x836f4=_0x42ef,_0x5543e7=await getToken();if(!_0x5543e7)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x59b591=_0x4277d0['bowiz'](getApiBaseUrl),_0x171600=await fetch(_0x59b591+_0x836f4(0x10a)+_0x2ee2b2+_0x836f4(0x132)+_0x4392ab,{'method':'PATCH','headers':{'Authorization':'Bearer\x20'+_0x5543e7,'Content-Type':_0x4277d0[_0x836f4(0x11e)]},'body':JSON[_0x836f4(0x13b)](_0x3dadf5)});if(!_0x171600['ok']){const _0x5131bd=await _0x171600['text']();throw new Error('Failed\x20to\x20update\x20scenario:\x20'+_0x5131bd);}return _0x171600[_0x836f4(0xfc)]();},{'label':'updateChecklistItem'});}export async function getFeatureReport(_0x5b77b1){const _0x90be42=_0x42ef,_0x678d8d={'dZORJ':function(_0x228b21){return _0x228b21();},'nwPUX':function(_0x104eba,_0x235bab,_0x348578){return _0x104eba(_0x235bab,_0x348578);}},_0x5b48c5=await getToken();if(!_0x5b48c5)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x4c6e1a=_0x678d8d[_0x90be42(0x117)](getApiBaseUrl),_0x16b0a3=await _0x678d8d['nwPUX'](fetch,_0x4c6e1a+'/api/v1/mcp/features/'+_0x5b77b1+_0x90be42(0x134),{'method':_0x90be42(0x120),'headers':{'Authorization':_0x90be42(0x103)+_0x5b48c5}});if(!_0x16b0a3['ok']){const _0x49e4ea=await _0x16b0a3['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x49e4ea);}return _0x16b0a3[_0x90be42(0xfc)]();}export async function getFeatureReportMarkdown(_0x2e6c17,_0x26d10a){const _0x392b15=_0x42ef,_0xbe4fe1={'Qlwgd':function(_0x411d91){return _0x411d91();},'NKPLY':function(_0x3ff823,_0x1d0d1e){return _0x3ff823>_0x1d0d1e;},'aJrhR':function(_0x135f0e,_0x2d3983){return _0x135f0e(_0x2d3983);},'zjAbx':_0x392b15(0x13e),'CHWrH':_0x392b15(0x118),'pZsiw':'GET'},_0x4bb1f0=await getToken();if(!_0x4bb1f0)throw new Error(_0x392b15(0x12b));const _0x4fd5ae=_0xbe4fe1[_0x392b15(0x101)](getApiBaseUrl),_0x300575=new URLSearchParams(),_0x2ee696=_0xbe4fe1['NKPLY'](_0x26d10a?.['itemIds']?.[_0x392b15(0x142)]??0x0,0x0),_0xda7c2f=_0xbe4fe1[_0x392b15(0x125)](Boolean,_0x26d10a?.['sessionId']);_0x2ee696&&_0x26d10a?.[_0x392b15(0x13e)]&&_0x300575[_0x392b15(0xfe)](_0xbe4fe1[_0x392b15(0x147)],_0x26d10a[_0x392b15(0x13e)][_0x392b15(0x121)](','));_0xda7c2f&&_0x26d10a?.[_0x392b15(0x133)]&&_0x300575['set']('sessionId',_0x26d10a['sessionId']);!_0x2ee696&&!_0xda7c2f&&_0x26d10a?.[_0x392b15(0x118)]&&_0x300575['set'](_0xbe4fe1[_0x392b15(0x123)],_0x26d10a[_0x392b15(0x118)]);const _0x5aaaaf=_0x4fd5ae+_0x392b15(0x10a)+_0x2e6c17+_0x392b15(0x11d),_0x3d91be=''+_0x5aaaaf+(_0x300575['toString']()?'?'+_0x300575[_0x392b15(0x106)]():''),_0x39e513=await fetch(_0x3d91be,{'method':_0xbe4fe1[_0x392b15(0x126)],'headers':{'Authorization':_0x392b15(0x103)+_0x4bb1f0}});if(!_0x39e513['ok']){const _0x1e9b56=await _0x39e513[_0x392b15(0x139)]();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20'+_0x1e9b56);}return _0x39e513[_0x392b15(0x139)]();}export async function listFeatureSessions(_0x24ea20){const _0x7e591=_0x42ef,_0x9b3ed={'LFXCV':function(_0xcf76c2){return _0xcf76c2();},'hXqFF':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0xf7ae06=await _0x9b3ed['LFXCV'](getToken);if(!_0xf7ae06)throw new Error(_0x9b3ed[_0x7e591(0x145)]);const _0x52b767=_0x9b3ed['LFXCV'](getApiBaseUrl),_0x821dd9=await fetch(_0x52b767+_0x7e591(0x10a)+_0x24ea20+_0x7e591(0x136),{'method':'GET','headers':{'Authorization':_0x7e591(0x103)+_0xf7ae06}});if(!_0x821dd9['ok']){const _0x4d686f=await _0x821dd9[_0x7e591(0x139)]();throw new Error('Failed\x20to\x20list\x20sessions:\x20'+_0x4d686f);}return _0x821dd9[_0x7e591(0xfc)]();}export async function startSession(_0x37579c,_0xf3c14b){const _0x57826a=_0x42ef,_0x5f0f58={'NyotR':_0x57826a(0x12b),'Fyire':function(_0x3fee7c,_0x56038c,_0x1132e2){return _0x3fee7c(_0x56038c,_0x1132e2);}},_0x1b5727=await getToken();if(!_0x1b5727)throw new Error(_0x5f0f58[_0x57826a(0x146)]);const _0x5b5a7a=getApiBaseUrl(),_0x3aa914=await _0x5f0f58[_0x57826a(0x140)](fetch,_0x5b5a7a+'/api/v1/mcp/features/'+_0x37579c+_0x57826a(0x11f)+_0xf3c14b+_0x57826a(0x107),{'method':_0x57826a(0x100),'headers':{'Authorization':_0x57826a(0x103)+_0x1b5727}});if(!_0x3aa914['ok']){const _0x479e3b=await _0x3aa914[_0x57826a(0x139)]();throw new Error(_0x57826a(0x128)+_0x479e3b);}return _0x3aa914['json']();}export async function concludeSession(_0x150544,_0x27bb1c){const _0x4551ad=_0x42ef,_0x1a4faa={'UlIvl':_0x4551ad(0x12b),'dprIb':function(_0x12878d){return _0x12878d();},'cSOHX':function(_0x560689,_0xa99048,_0x7344d0){return _0x560689(_0xa99048,_0x7344d0);}},_0x35a41a=await getToken();if(!_0x35a41a)throw new Error(_0x1a4faa[_0x4551ad(0x122)]);const _0x7b9008=_0x1a4faa[_0x4551ad(0xfd)](getApiBaseUrl),_0x11354d=await _0x1a4faa['cSOHX'](fetch,_0x7b9008+_0x4551ad(0x10a)+_0x150544+'/sessions/'+_0x27bb1c+_0x4551ad(0x112),{'method':'POST','headers':{'Authorization':_0x4551ad(0x103)+_0x35a41a}});if(!_0x11354d['ok']){const _0x304f25=await _0x11354d['text']();throw new Error(_0x4551ad(0x111)+_0x304f25);}return _0x11354d['json']();}export async function getActionItems(_0x2f6507){const _0x1495c0=_0x42ef,_0x13d30f={'HuRRL':function(_0x267cc5,_0xde5473,_0x11fae9){return _0x267cc5(_0xde5473,_0x11fae9);},'kMUMO':'GET'},_0x132a8e=await getToken();if(!_0x132a8e)throw new Error(_0x1495c0(0x12b));const _0x3da615=getApiBaseUrl(),_0x5147a4=await _0x13d30f[_0x1495c0(0xff)](fetch,_0x3da615+_0x1495c0(0x10a)+_0x2f6507+'/action-items',{'method':_0x13d30f['kMUMO'],'headers':{'Authorization':_0x1495c0(0x103)+_0x132a8e}});if(!_0x5147a4['ok']){const _0xbde0a8=await _0x5147a4['text']();throw new Error('Failed\x20to\x20get\x20action\x20items:\x20'+_0xbde0a8);}return _0x5147a4['json']();}export async function getItemFeedback(_0x4f124e,_0x269197){const _0x456938=_0x42ef,_0x14eadf={'VRdSq':function(_0x5baf2a){return _0x5baf2a();},'cDbfj':function(_0xf1a03f,_0x246b32,_0x278d89){return _0xf1a03f(_0x246b32,_0x278d89);}},_0x381ac0=await _0x14eadf['VRdSq'](getToken);if(!_0x381ac0)throw new Error(_0x456938(0x12b));const _0x10342d=getApiBaseUrl(),_0x415eb5=await _0x14eadf['cDbfj'](fetch,_0x10342d+_0x456938(0x10a)+_0x4f124e+_0x456938(0x10b)+_0x269197+'/feedback',{'method':_0x456938(0x120),'headers':{'Authorization':_0x456938(0x103)+_0x381ac0}});if(!_0x415eb5['ok']){const _0x17f93=await _0x415eb5['text']();throw new Error(_0x456938(0x135)+_0x17f93);}return _0x415eb5[_0x456938(0xfc)]();}function _0x42ef(_0x386e47,_0x111c65){_0x386e47=_0x386e47-0xfc;const _0x4626f8=_0x4626();let _0x42ef74=_0x4626f8[_0x386e47];return _0x42ef74;}export async function markCommentsAddressed(_0x31c337,_0x23768d,_0x135ffe){const _0x460492=_0x42ef,_0x312478={'moqRB':function(_0x2c0187){return _0x2c0187();},'CmtVl':function(_0x5dc068,_0x49edc8,_0x5decb3){return _0x5dc068(_0x49edc8,_0x5decb3);}},_0x493912=await _0x312478['moqRB'](getToken);if(!_0x493912)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0xaa0a16=getApiBaseUrl(),_0x7806d6=await _0x312478['CmtVl'](fetch,_0xaa0a16+'/api/v1/mcp/features/'+_0x31c337+'/comments/address',{'method':_0x460492(0x100),'headers':{'Authorization':_0x460492(0x103)+_0x493912,'Content-Type':_0x460492(0x144)},'body':JSON[_0x460492(0x13b)]({'checklistItemId':_0x23768d,'commentIds':_0x135ffe})});if(!_0x7806d6['ok']){const _0x15686f=await _0x7806d6['text']();throw new Error(_0x460492(0x110)+_0x15686f);}}export async function softDeleteFeature(_0x30801a){const _0x957e09=_0x42ef,_0x5b558a={'CQaoO':'DELETE'},_0x285ee5=await getToken();if(!_0x285ee5)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x386588=getApiBaseUrl(),_0x45ac70=await fetch(_0x386588+_0x957e09(0x10a)+_0x30801a,{'method':_0x5b558a[_0x957e09(0x102)],'headers':{'Authorization':_0x957e09(0x103)+_0x285ee5}});if(!_0x45ac70['ok']){const _0x4bc551=await _0x45ac70[_0x957e09(0x139)]();throw new Error('Failed\x20to\x20delete\x20feature\x20review:\x20'+_0x4bc551);}}export async function restoreFeature(_0x5ae846){const _0x462f5b=_0x42ef,_0x2aac33={'WpsBQ':function(_0x3b6a33,_0xf03091,_0x231ab4){return _0x3b6a33(_0xf03091,_0x231ab4);},'dIQiY':_0x462f5b(0x100)},_0x2a6445=await getToken();if(!_0x2a6445)throw new Error(_0x462f5b(0x12b));const _0x12d542=getApiBaseUrl(),_0x619a68=await _0x2aac33[_0x462f5b(0x11c)](fetch,_0x12d542+_0x462f5b(0x10a)+_0x5ae846+_0x462f5b(0x113),{'method':_0x2aac33[_0x462f5b(0x104)],'headers':{'Authorization':'Bearer\x20'+_0x2a6445}});if(!_0x619a68['ok']){const _0x32f79a=await _0x619a68['text']();throw new Error('Failed\x20to\x20restore\x20feature\x20review:\x20'+_0x32f79a);}}
|