@ranger-testing/ranger-cli 3.1.4-alpha.ffeeafe-46 → 3.1.5-alpha.9b89f77-48

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.
Files changed (86) hide show
  1. package/build/cli.js +1 -1
  2. package/build/commands/addEnv.js +1 -1
  3. package/build/commands/authEncrypt.js +1 -1
  4. package/build/commands/clean.js +1 -1
  5. package/build/commands/config.js +1 -1
  6. package/build/commands/deleteProfile.js +1 -1
  7. package/build/commands/env.js +1 -1
  8. package/build/commands/feature.js +1 -1
  9. package/build/commands/hook.js +1 -1
  10. package/build/commands/hooks/autoPrompt.js +1 -1
  11. package/build/commands/hooks/disable.js +1 -1
  12. package/build/commands/hooks/enable.js +1 -1
  13. package/build/commands/hooks/exitPlanMode.js +1 -1
  14. package/build/commands/hooks/index.js +1 -1
  15. package/build/commands/hooks/output.js +1 -1
  16. package/build/commands/hooks/planReminder.js +1 -1
  17. package/build/commands/hooks/planStart.js +1 -1
  18. package/build/commands/hooks/postEdit.js +1 -1
  19. package/build/commands/hooks/preCompact.js +1 -1
  20. package/build/commands/hooks/sessionEnd.js +1 -1
  21. package/build/commands/hooks/sessionStart.js +1 -1
  22. package/build/commands/hooks/stopHook.js +1 -1
  23. package/build/commands/index.js +1 -1
  24. package/build/commands/login.js +1 -1
  25. package/build/commands/mcpBootstrap.js +1 -1
  26. package/build/commands/migrateProfile.js +1 -1
  27. package/build/commands/setup/claude.js +1 -1
  28. package/build/commands/setup/opencode.js +1 -1
  29. package/build/commands/setupCi.js +1 -1
  30. package/build/commands/skillup.js +1 -1
  31. package/build/commands/start.js +1 -1
  32. package/build/commands/status.js +1 -1
  33. package/build/commands/update.js +1 -1
  34. package/build/commands/updateEnv.js +1 -1
  35. package/build/commands/useEnv.js +1 -1
  36. package/build/commands/utils/activeProfile.js +1 -1
  37. package/build/commands/utils/agentEnv.js +1 -1
  38. package/build/commands/utils/browserSessionsApi.js +1 -1
  39. package/build/commands/utils/claudeConfig.js +1 -1
  40. package/build/commands/utils/claudeOverrideSettings.js +1 -1
  41. package/build/commands/utils/claudePlugin.js +1 -1
  42. package/build/commands/utils/cloudProfile.js +1 -1
  43. package/build/commands/utils/cloudProfileSession.js +1 -1
  44. package/build/commands/utils/crypto.js +1 -1
  45. package/build/commands/utils/desirePathLog.js +1 -1
  46. package/build/commands/utils/deviceAuth.js +1 -1
  47. package/build/commands/utils/environment.js +1 -1
  48. package/build/commands/utils/featureApi.js +1 -1
  49. package/build/commands/utils/fixWebmDuration.js +1 -1
  50. package/build/commands/utils/gitTracked.js +1 -1
  51. package/build/commands/utils/keychain.js +1 -1
  52. package/build/commands/utils/legacyWarning.js +1 -1
  53. package/build/commands/utils/localAgentInstallationsApi.js +1 -1
  54. package/build/commands/utils/matchAuthEnvironment.js +1 -1
  55. package/build/commands/utils/mcpImageBase64.js +1 -1
  56. package/build/commands/utils/model.js +1 -1
  57. package/build/commands/utils/novaActCli.js +1 -1
  58. package/build/commands/utils/opencodeConfig.js +1 -1
  59. package/build/commands/utils/organizationEnvApi.js +1 -1
  60. package/build/commands/utils/playwrightCli.js +1 -1
  61. package/build/commands/utils/profileMessages.js +1 -1
  62. package/build/commands/utils/profileSetupBanner.js +1 -1
  63. package/build/commands/utils/projectsConfig.js +1 -1
  64. package/build/commands/utils/rangerConfig.js +1 -1
  65. package/build/commands/utils/rangerRoot.js +1 -1
  66. package/build/commands/utils/rangerwrightCli.js +1 -1
  67. package/build/commands/utils/resolveProfileContext.js +1 -1
  68. package/build/commands/utils/resolveProfileUrl.js +1 -1
  69. package/build/commands/utils/retry.js +1 -1
  70. package/build/commands/utils/scenarioOriginCheck.js +1 -1
  71. package/build/commands/utils/sessionCache.js +1 -1
  72. package/build/commands/utils/settings.js +1 -1
  73. package/build/commands/utils/skillContent.js +1 -1
  74. package/build/commands/utils/skills.js +1 -1
  75. package/build/commands/utils/stitchWebmFiles.js +1 -1
  76. package/build/commands/utils/telemetry.js +1 -1
  77. package/build/commands/utils/tokenRefresh.js +1 -1
  78. package/build/commands/utils/traceSnapshotMapper.js +1 -1
  79. package/build/commands/utils/tunnelClient.js +1 -1
  80. package/build/commands/utils/userApi.js +1 -1
  81. package/build/commands/utils/version.js +1 -1
  82. package/build/commands/verifyFeature.js +1 -1
  83. package/build/commands/verifyFeatureCli.js +1 -1
  84. package/build/commands/verifyFeatureNovaCli.js +1 -1
  85. package/build/commands/verifyFeatureRangerwrightCli.js +1 -1
  86. package/package.json +2 -1
@@ -1 +1 @@
1
- (function(_0xcb6e39,_0x1d39af){const _0x156924=_0x5e39,_0x82153c=_0xcb6e39();while(!![]){try{const _0x9dba55=-parseInt(_0x156924(0x8f))/0x1+parseInt(_0x156924(0xda))/0x2*(parseInt(_0x156924(0xb2))/0x3)+parseInt(_0x156924(0xbb))/0x4+-parseInt(_0x156924(0x11c))/0x5*(parseInt(_0x156924(0x88))/0x6)+-parseInt(_0x156924(0x70))/0x7+parseInt(_0x156924(0xb7))/0x8+parseInt(_0x156924(0x11a))/0x9*(-parseInt(_0x156924(0x12f))/0xa);if(_0x9dba55===_0x1d39af)break;else _0x82153c['push'](_0x82153c['shift']());}catch(_0x107296){_0x82153c['push'](_0x82153c['shift']());}}}(_0x4aa6,0x63d82));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0xa77b1d from'inquirer';import{chromium}from'playwright';import{getApiBaseUrl}from'./environment.js';import{getToken}from'./keychain.js';import{getRangerHomeDir}from'./rangerRoot.js';import{addProfileSetupBanner}from'./profileSetupBanner.js';import{duplicateCookiesForDomains,getSessionCachePath,getStorageStatePath,isCachedSessionLive,isInteractive,needsTunnel,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{matchAuthEnvironmentByHost,matchAuthEnvironmentExact}from'./matchAuthEnvironment.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';function targetHostForTelemetry(_0x3db3ad){try{return new URL(_0x3db3ad)['host'];}catch{return'invalid-url';}}function errorMessageForTelemetry(_0x1a68cd){const _0x2d193d=_0x5e39;return _0x1a68cd instanceof Error?_0x1a68cd[_0x2d193d(0xd6)]:undefined;}function trackBridgeEvent(_0x22df12,_0x1fbbf7){const _0x4aa949=_0x5e39,_0x23b63f={'WMFOs':_0x4aa949(0xa5),'bUoIQ':function(_0x51b632,_0x532845){return _0x51b632===_0x532845;},'ouuCt':_0x4aa949(0x104)};if(!_0x22df12)return;const _0x4973df={'tunnelSessionId':_0x1fbbf7['sessionId'],'tunnelEventType':_0x1fbbf7['type'],'connectionId':_0x1fbbf7['connectionId'],'code':_0x1fbbf7['code'],'reason':_0x1fbbf7[_0x4aa949(0x10a)],'error':_0x1fbbf7['error'],'elapsedMs':_0x1fbbf7[_0x4aa949(0xbd)],'activeLocalConnections':_0x1fbbf7['activeLocalConnections'],'pendingLocalConnections':_0x1fbbf7[_0x4aa949(0x97)]};_0x22df12['trackPhaseEnd'](_0x23b63f['WMFOs'],_0x4973df),(_0x23b63f['bUoIQ'](_0x1fbbf7[_0x4aa949(0x11e)],_0x23b63f['ouuCt'])||_0x1fbbf7[_0x4aa949(0x11e)]==='local_ws_error')&&void _0x22df12[_0x4aa949(0x87)](_0x4aa949(0x85),new Error(_0x1fbbf7['error']??_0x1fbbf7[_0x4aa949(0x11e)]),_0x4973df);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x2e55d3=_0x5e39,_0x42e1b0={'ChDnc':_0x2e55d3(0xbe)},_0x403909=await getToken();if(!_0x403909)throw new Error(_0x42e1b0['ChDnc']);return _0x403909;}async function apiRequest(_0x5a647a,_0x2aac06={}){const _0x49db50=_0x5e39,_0x343b9a={'JLuNU':function(_0x219270){return _0x219270();},'SmTju':function(_0x18b1c8){return _0x18b1c8();},'qrzge':_0x49db50(0x71),'QrzlY':_0x49db50(0x89)},_0x64d018=await _0x343b9a[_0x49db50(0x6b)](requireToken),_0x429278=_0x343b9a[_0x49db50(0x11b)](getApiBaseUrl),_0x2256dd=await fetch(''+_0x429278+_0x5a647a,{..._0x2aac06,'headers':{'Authorization':'Bearer\x20'+_0x64d018,'Content-Type':_0x343b9a[_0x49db50(0x6d)],..._0x2aac06[_0x49db50(0xce)]??{}}});if(!_0x2256dd['ok']){let _0x580712='',_0x2a07b4;try{const _0x59d7d7=await _0x2256dd['json'](),_0x8b0b1b=(typeof _0x59d7d7['error']===_0x343b9a[_0x49db50(0x86)]?_0x59d7d7[_0x49db50(0xe1)]:undefined)??JSON['stringify'](_0x59d7d7);_0x580712=_0x8b0b1b;typeof _0x59d7d7['test_output']===_0x343b9a['QrzlY']&&_0x59d7d7['test_output']&&(_0x580712=_0x580712+'\x0a'+_0x59d7d7['test_output']);if(typeof _0x59d7d7[_0x49db50(0x78)]==='string')_0x2a07b4=_0x59d7d7[_0x49db50(0x78)];}catch{_0x580712=_0x2256dd['statusText'];}throw new ApiError('API\x20request\x20'+_0x5a647a+'\x20failed\x20('+_0x2256dd[_0x49db50(0xb5)]+'):\x20'+_0x580712,_0x2256dd[_0x49db50(0xb5)],_0x580712,_0x2a07b4);}if(_0x2256dd[_0x49db50(0xb5)]===0xcc)return undefined;return _0x2256dd['json']();}export class ApiError extends Error{['status'];['detail'];['code'];constructor(_0x3cb275,_0x1fc7a8,_0x1b6837,_0x17213f){const _0x4f4c23=_0x5e39,_0x290237={'wXPrU':'ApiError'};super(_0x3cb275),this[_0x4f4c23(0xb5)]=_0x1fc7a8,this['detail']=_0x1b6837,this['code']=_0x17213f,this[_0x4f4c23(0xae)]=_0x290237['wXPrU'];}}export async function fetchCloudProfile(_0xcad205){const _0x2ec4c5=_0x5e39,_0x505ae8={'PunrT':function(_0x86820,_0x5a8414){return _0x86820(_0x5a8414);},'ywuJK':function(_0x4b0214,_0x580485){return _0x4b0214 instanceof _0x580485;},'OvmGv':function(_0x1e4279,_0x3030bd){return _0x1e4279===_0x3030bd;}};try{return await _0x505ae8['PunrT'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0xcad205));}catch(_0xe85ba4){if(_0x505ae8['ywuJK'](_0xe85ba4,ApiError)&&_0x505ae8[_0x2ec4c5(0xcb)](_0xe85ba4[_0x2ec4c5(0xb5)],0x194))return null;throw _0xe85ba4;}}export async function listCloudProfiles(){const _0x17f9a9=_0x5e39,_0x18bcd0={'PDtBI':function(_0x2378c8,_0x4a5eb9){return _0x2378c8(_0x4a5eb9);}},_0x4a637e=await _0x18bcd0['PDtBI'](apiRequest,'/api/v1/profiles');return _0x4a637e[_0x17f9a9(0x93)];}export async function deleteCloudProfile(_0x97175){const _0x4fb4d3=_0x5e39,_0x4badf5={'JoDmT':_0x4fb4d3(0xfb),'GLQzB':function(_0x3b71b5,_0x789fae){return _0x3b71b5===_0x789fae;}};try{await apiRequest(_0x4fb4d3(0x105)+encodeURIComponent(_0x97175),{'method':_0x4badf5['JoDmT']});}catch(_0x3ef29b){if(_0x3ef29b instanceof ApiError&&_0x4badf5['GLQzB'](_0x3ef29b['status'],0x194))throw new Error('Cloud\x20profile\x20\x22'+_0x97175+'\x22\x20not\x20found.');throw _0x3ef29b;}}function _0x5e39(_0x45e873,_0x2dddb3){_0x45e873=_0x45e873-0x6b;const _0x4aa665=_0x4aa6();let _0x5e39cb=_0x4aa665[_0x45e873];return _0x5e39cb;}export async function createCloudProfile(_0x27b05c,_0x2a0b34,_0x158c0f={}){const _0x33ac43=_0x5e39,_0x5b9bb9={'AZUlm':_0x33ac43(0xe0)},_0x2f4294={'name':_0x27b05c};if(_0x2a0b34)_0x2f4294[_0x33ac43(0x6f)]=_0x2a0b34;_0x158c0f[_0x33ac43(0x6e)]&&Object['keys'](_0x158c0f[_0x33ac43(0x6e)])['length']>0x0&&(_0x2f4294[_0x33ac43(0x6e)]=_0x158c0f['settings']);if(_0x158c0f[_0x33ac43(0x102)])_0x2f4294[_0x33ac43(0x102)]=_0x158c0f['username'];if(_0x158c0f[_0x33ac43(0x74)])_0x2f4294[_0x33ac43(0x74)]=_0x158c0f[_0x33ac43(0x74)];return await apiRequest('/api/v1/profiles',{'method':_0x5b9bb9['AZUlm'],'body':JSON[_0x33ac43(0xc4)](_0x2f4294)});}export async function uploadCloudProfileSession(_0x183446,_0x824a89){const _0x5f468e=_0x5e39,_0x51c33b={'TqBpZ':function(_0x3ccfb4,_0x95236c,_0x3a4207){return _0x3ccfb4(_0x95236c,_0x3a4207);},'etGQy':function(_0x4d78df,_0x5a9384){return _0x4d78df(_0x5a9384);},'HGdqs':_0x5f468e(0xe0)};return await _0x51c33b[_0x5f468e(0xfa)](apiRequest,'/api/v1/profiles/'+_0x51c33b['etGQy'](encodeURIComponent,_0x183446)+'/session',{'method':_0x51c33b['HGdqs'],'body':JSON['stringify']({'session_state':_0x824a89})});}export async function saveCloudProfileCredentials(_0x34ff82,_0x4a5362,_0x4a50d1){const _0x371f5e=_0x5e39,_0x292a02={'nNJRJ':function(_0x24ec57,_0x4d3c67,_0x2869b8){return _0x24ec57(_0x4d3c67,_0x2869b8);}};await _0x292a02['nNJRJ'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x34ff82),{'method':_0x371f5e(0xd4),'body':JSON[_0x371f5e(0xc4)]({'username':_0x4a5362,'password':_0x4a50d1})});}export async function fetchAuthConfig(){const _0x47b122=_0x5e39,_0x32abb7={'fFrQC':function(_0x12b08e,_0x475937){return _0x12b08e(_0x475937);},'wEIce':'/api/v1/profiles/auth-config','TKGRj':function(_0xff2046,_0x2695eb){return _0xff2046!==_0x2695eb;}};try{const _0x296185=await _0x32abb7['fFrQC'](apiRequest,_0x32abb7['wEIce']);return _0x296185[_0x47b122(0x10c)];}catch(_0x297a69){return _0x297a69 instanceof ApiError&&_0x32abb7['TKGRj'](_0x297a69[_0x47b122(0xb5)],0x194)&&console[_0x47b122(0xe1)](_0x47b122(0xa8)+_0x297a69[_0x47b122(0xd6)]),null;}}async function createTunnelSession(_0x5dadb1){const _0x5b641e=_0x5e39,_0xd3a3bc={'EpxLF':function(_0x20dae1,_0x10c744,_0x5589b7){return _0x20dae1(_0x10c744,_0x5589b7);},'VBDST':_0x5b641e(0x118),'DfexE':'agent'};return await _0xd3a3bc[_0x5b641e(0xde)](apiRequest,_0xd3a3bc['VBDST'],{'method':_0x5b641e(0xe0),'body':JSON[_0x5b641e(0xc4)]({'targetUrl':_0x5dadb1,'mode':_0xd3a3bc['DfexE']})});}async function deleteTunnelSession(_0x40b00a){const _0x527677={'dYpVM':function(_0x42d88a,_0x4249de,_0x44a50c){return _0x42d88a(_0x4249de,_0x44a50c);},'AfmaJ':'DELETE'};await _0x527677['dYpVM'](apiRequest,'/api/v1/tunnel/sessions/'+_0x40b00a,{'method':_0x527677['AfmaJ']});}export function pickAdHocEnvKey(_0x379863,_0x46f9d9,_0x2e51d3){const _0x42f4d3=_0x5e39,_0xc1146e={'rlIpO':function(_0xc84634,_0x111abd){return _0xc84634+_0x111abd;},'IcvjN':function(_0x1cd204,_0x5023c3){return _0x1cd204+_0x5023c3;},'OpURh':function(_0x4b5eda,_0x2ebec2){return _0x4b5eda in _0x2ebec2;},'HnxFr':_0x42f4d3(0xe6),'hMBsQ':function(_0x34f56e,_0x126e82){return _0x34f56e+_0x126e82;}};if(_0x2e51d3){if(!_0x379863?.[_0x42f4d3(0x10f)]?.[_0x2e51d3]){const _0x4a110d=Object[_0x42f4d3(0x123)](_0x379863?.['environments']??{});throw new Error(_0xc1146e[_0x42f4d3(0xaa)](_0xc1146e[_0x42f4d3(0x110)](_0x42f4d3(0xf9)+_0x2e51d3+_0x42f4d3(0x100),_0x4a110d['length']?_0x42f4d3(0x76)+_0x4a110d[_0x42f4d3(0x114)](',\x20')+'.':'\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.'),'\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)'));}return _0x2e51d3;}if(!_0x379863)return null;if(_0x46f9d9){const _0x2d88ac=matchAuthEnvironmentExact(_0x46f9d9,_0x379863);if(_0x2d88ac)return _0x2d88ac;const _0x14b235=matchAuthEnvironmentByHost(_0x46f9d9,_0x379863);if(_0x14b235&&_0xc1146e['OpURh'](_0x42f4d3(0xa1),_0x14b235))return console['log']('\x20\x20Auth\x20env\x20\x22'+_0x14b235['key']+'\x22\x20matched\x20by\x20host\x20for\x20'+_0x46f9d9+_0x42f4d3(0xf1)),_0x14b235[_0x42f4d3(0xa1)];if(_0x14b235&&_0xc1146e[_0x42f4d3(0x101)](_0xc1146e['HnxFr'],_0x14b235))throw new Error(_0x42f4d3(0x80)+_0x14b235['ambiguous']['join'](',\x20')+_0x42f4d3(0xb0));if(needsTunnel(_0x46f9d9))throw new Error(_0xc1146e['hMBsQ'](_0x42f4d3(0xac)+_0x46f9d9+_0x42f4d3(0xd2)+_0x42f4d3(0x9b)+_0x42f4d3(0xfd)+_0x42f4d3(0xf5)+('\x20\x20-\x20ask\x20your\x20Ranger\x20admin\x20to\x20add\x20\x22'+_0x46f9d9[_0x42f4d3(0x82)](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a'),_0x42f4d3(0xec)+_0x46f9d9+'\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.'));}if(_0x379863['defaultEnvironmentKey'])return _0x379863[_0x42f4d3(0xa0)];const _0x32edb3=Object[_0x42f4d3(0x123)](_0x379863['environments']??{});if(_0x32edb3['length']===0x1)return _0x32edb3[0x0];if(_0x32edb3['length']===0x0)return null;throw new Error(_0xc1146e[_0x42f4d3(0x110)]('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x32edb3['join'](',\x20')+_0x42f4d3(0x11d),_0x42f4d3(0xe4)));}export function adHocProfileName(_0x26429d,_0x5bc9ec,_0xc2dc8b){if(!_0x5bc9ec||_0x5bc9ec===_0xc2dc8b)return _0x26429d;return _0x26429d+':'+_0x5bc9ec;}export async function resolveAdHocProfile(_0x356e1e={},_0x3137f3=process['env']){const _0x4218bb=_0x5e39,_0x222361={'EtwHT':function(_0xbd7e85,_0x137109,_0x1fff8c,_0x52c61c){return _0xbd7e85(_0x137109,_0x1fff8c,_0x52c61c);},'cGQVo':function(_0x333c91,_0x2364df){return _0x333c91(_0x2364df);},'jrxuO':function(_0x446fb6,_0x1752e3){return _0x446fb6!==_0x1752e3;},'jKYCc':function(_0x1d4479,_0x478751,_0x36dae4,_0x11c726){return _0x1d4479(_0x478751,_0x36dae4,_0x11c726);}},_0x4df839=_0x3137f3['RANGER_TEST_USERNAME'];if(!_0x4df839)return null;const _0x583736=await fetchAuthConfig(),_0x16d0e8=pickAdHocEnvKey(_0x583736,_0x356e1e[_0x4218bb(0xf0)],_0x356e1e['envKey']);let _0x4047db=_0x222361[_0x4218bb(0xc3)](adHocProfileName,_0x4df839,_0x16d0e8,_0x583736?.['defaultEnvironmentKey']),_0x9ba88d=await _0x222361[_0x4218bb(0xd1)](fetchCloudProfile,_0x4047db);_0x9ba88d&&_0x16d0e8&&_0x222361['jrxuO'](_0x9ba88d['environmentKey'],_0x16d0e8)&&(console[_0x4218bb(0x128)]('\x20\x20Cloud\x20profile\x20\x22'+_0x4047db+'\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22'+(_0x9ba88d[_0x4218bb(0x9a)]??_0x4218bb(0x113))+'\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22'+_0x16d0e8+'\x22;\x20using\x20\x22'+_0x4df839+':'+_0x16d0e8+'\x22\x20instead.'),_0x4047db=_0x4df839+':'+_0x16d0e8,_0x9ba88d=await fetchCloudProfile(_0x4047db));if(_0x9ba88d)return{'name':_0x9ba88d[_0x4218bb(0xae)],'profile':_0x9ba88d};const _0x5a468b=_0x3137f3['RANGER_TEST_PASSWORD'],_0x48ab94=await _0x222361[_0x4218bb(0xfc)](createCloudProfile,_0x4047db,_0x16d0e8??undefined,{'username':_0x4df839,'password':_0x5a468b});return console[_0x4218bb(0x128)](_0x4218bb(0x7a)+_0x48ab94[_0x4218bb(0xae)]+'\x22\x20for\x20'+_0x4df839+(_0x16d0e8?_0x4218bb(0xb6)+_0x16d0e8+')':'')),{'name':_0x48ab94[_0x4218bb(0xae)],'profile':_0x48ab94};}export async function writeSessionToLocalCache(_0x41fcbf,_0x39139c,_0x58f19d,_0x519838,_0xd6ec46,_0x111c53,_0x947688){const _0x1a822a=_0x5e39,_0x15fc6b={'JWWDz':function(_0x5273a5,_0x5dc06c){return _0x5273a5(_0x5dc06c);},'Mcnyk':function(_0x4a678a,_0x513b5a,_0x345643){return _0x4a678a(_0x513b5a,_0x345643);},'YkDkJ':function(_0x5188d7,_0x3a7cc0,_0x34a66f){return _0x5188d7(_0x3a7cc0,_0x34a66f);},'qUAjn':function(_0x5717c0,_0x259c09){return _0x5717c0>_0x259c09;},'RyVWl':function(_0xcb36ce,_0x429512,_0x2d66ac){return _0xcb36ce(_0x429512,_0x2d66ac);}},_0x295e70=_0x15fc6b['JWWDz'](sessionCacheHash,{'orgId':_0x39139c,'profileName':_0x41fcbf,'effectiveBaseUrl':_0x58f19d,'setupHeaders':_0x519838,'invalidateOn':_0x947688?.[_0x1a822a(0x77)],'userAgent':_0x947688?.[_0x1a822a(0xeb)],'clientIp':_0x947688?.['clientIp']}),_0x2ff5fd=_0x15fc6b[_0x1a822a(0x130)](getSessionCachePath,_0x295e70,_0x41fcbf),_0x5692f7=_0x15fc6b['YkDkJ'](join,getRangerHomeDir(),'auth');!_0x15fc6b['JWWDz'](existsSync,_0x5692f7)&&await mkdir(_0x5692f7,{'recursive':!![]});const _0x50547a={..._0xd6ec46};_0x111c53&&_0x15fc6b[_0x1a822a(0xe7)](_0x111c53[_0x1a822a(0xf8)],0x0)&&Array[_0x1a822a(0xd7)](_0x50547a[_0x1a822a(0xd9)])&&(_0x50547a['cookies']=duplicateCookiesForDomains(_0x50547a[_0x1a822a(0xd9)],_0x111c53));const _0xbac083={'cached_at':new Date()[_0x1a822a(0x107)](),'session_state':_0x50547a};await _0x15fc6b[_0x1a822a(0x130)](writeFile,_0x2ff5fd,JSON[_0x1a822a(0xc4)](_0xbac083,null,0x2));const _0x473e04=getStorageStatePath(_0x2ff5fd);return await _0x15fc6b['RyVWl'](writeFile,_0x473e04,JSON[_0x1a822a(0xc4)](_0x50547a,null,0x2)),_0x473e04;}export async function checkLocalCache(_0x398eba,_0x3f4ca2,_0xfdc4a0,_0x5e589b,_0x15d9ea){const _0x1696e3=_0x5e39,_0x47681e={'EfCfX':function(_0x2b1012,_0x29c7bb,_0x127d01){return _0x2b1012(_0x29c7bb,_0x127d01);},'qzfiK':function(_0x59eabe,_0x112e7a){return _0x59eabe(_0x112e7a);}},_0x5a02a4=sessionCacheHash({'orgId':_0x3f4ca2,'profileName':_0x398eba,'effectiveBaseUrl':_0xfdc4a0,'setupHeaders':_0x5e589b,'invalidateOn':_0x15d9ea?.['invalidateOn'],'userAgent':_0x15d9ea?.[_0x1696e3(0xeb)],'clientIp':_0x15d9ea?.[_0x1696e3(0xcd)]}),_0x192f95=_0x47681e[_0x1696e3(0xd3)](getSessionCachePath,_0x5a02a4,_0x398eba),_0x253dcd=_0x47681e['qzfiK'](getStorageStatePath,_0x192f95);if(!existsSync(_0x192f95)||!existsSync(_0x253dcd))return null;try{const _0x72cd2e=await readFile(_0x192f95,'utf-8');return JSON[_0x1696e3(0xf6)](_0x72cd2e),{'storageStatePath':_0x253dcd};}catch{return null;}}function launchRealBrowser(){return chromium['launch']({'headless':!![]});}function emitSessionValidationHint(_0x228c7e,_0x10c3dc){const _0x2468d1=_0x5e39,_0x5b3aea={'kXpSb':function(_0x314b17,_0x470605){return _0x314b17+_0x470605;}};if(!_0x10c3dc||!_0x10c3dc[_0x2468d1(0x12b)]?.[_0x2468d1(0xf8)])return;let _0x3fc580;try{_0x3fc580=new URL(_0x228c7e);}catch{return;}const _0x3da8f6=[];for(const _0x368a33 of _0x10c3dc['domains']){try{_0x3da8f6[_0x2468d1(0xa7)]({'raw':_0x368a33,'url':new URL(_0x368a33)});}catch{}}if(_0x3da8f6['length']===0x0)return;if(_0x3da8f6[_0x2468d1(0xdb)](_0x82e29e=>_0x82e29e[_0x2468d1(0xb1)]['origin']===_0x3fc580[_0x2468d1(0x7e)]))return;const _0x3e790c=_0x3da8f6['map'](_0x435276=>'\x22'+_0x435276[_0x2468d1(0x9c)]+'\x22')['join'](',\x20');console[_0x2468d1(0x128)](_0x5b3aea['kXpSb']('\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20'+_0x3e790c+';\x20','you\x27re\x20now\x20at\x20\x22'+_0x228c7e+_0x2468d1(0xb8))+_0x2468d1(0xba));}export async function serverSideLogin(_0x37b6a3,_0x14ffc7){const _0x5a0535=_0x5e39,_0x358bcb={'ydgzf':function(_0xe65352,_0x4b007c,_0x1303d9){return _0xe65352(_0x4b007c,_0x1303d9);},'fdRuZ':function(_0x30e56f,_0x2d8c5a){return _0x30e56f instanceof _0x2d8c5a;},'HWUls':function(_0x32b786,_0x15e299){return _0x32b786===_0x15e299;},'JbCET':'not_configured'},_0x374a02=process[_0x5a0535(0x7f)]['RANGER_TEST_USERNAME'],_0xa1f864=process['env'][_0x5a0535(0x92)],_0x39dbd0={};if(_0x374a02)_0x39dbd0[_0x5a0535(0x102)]=_0x374a02;if(_0xa1f864)_0x39dbd0['password']=_0xa1f864;if(_0x14ffc7?.[_0x5a0535(0x124)])_0x39dbd0['force']=!![];if(_0x14ffc7?.['targetUrl'])_0x39dbd0[_0x5a0535(0xa3)]=_0x14ffc7['targetUrl'];_0x14ffc7?.['tunnel']&&(_0x39dbd0[_0x5a0535(0xe5)]=_0x14ffc7[_0x5a0535(0xc0)]['sessionId'],_0x39dbd0[_0x5a0535(0xf4)]=_0x14ffc7['tunnel'][_0x5a0535(0xca)]);try{return await _0x358bcb['ydgzf'](apiRequest,_0x5a0535(0x105)+encodeURIComponent(_0x37b6a3)+'/login',{'method':_0x5a0535(0xe0),'body':JSON['stringify'](_0x39dbd0)});}catch(_0x1a035e){if(_0x358bcb['fdRuZ'](_0x1a035e,ApiError)&&_0x358bcb[_0x5a0535(0x117)](_0x1a035e[_0x5a0535(0xb5)],0x190)&&_0x358bcb[_0x5a0535(0x117)](_0x1a035e[_0x5a0535(0x78)],_0x5a0535(0xed)))return{'status':_0x358bcb['JbCET'],'error':_0x1a035e['detail']};throw _0x1a035e;}}async function serverSideLoginWithOptionalTunnel(_0x5483e5,_0x18dc30,_0x4707ad={}){const _0x56ae57=_0x5e39,_0x3e13e7={'AyoyS':_0x56ae57(0x12a),'SYMCA':function(_0x1e0268,_0xdcdd9c){return _0x1e0268(_0xdcdd9c);},'OPUmh':function(_0x43eb28,_0x4852b6){return _0x43eb28(_0x4852b6);},'ZIQge':function(_0x1db7dc,_0x145f11,_0x5bdfb5){return _0x1db7dc(_0x145f11,_0x5bdfb5);},'hOFTD':function(_0x48802d,_0x5b64a2){return _0x48802d===_0x5b64a2;},'XWroZ':'true','VgBNL':function(_0x1c2965,_0x5dedbe){return _0x1c2965(_0x5dedbe);},'biIKq':'tunnel_login_setup','kUxKV':function(_0x38f124,_0x94806d){return _0x38f124(_0x94806d);},'WtLFy':function(_0x28972f,_0x314ce5,_0x3a6647){return _0x28972f(_0x314ce5,_0x3a6647);},'HOnKl':function(_0x3de128,_0x311788){return _0x3de128??_0x311788;},'mWEqH':function(_0x2e4561,_0x48085a){return _0x2e4561||_0x48085a;},'IsbDL':function(_0x3b5230,_0x42ac8b){return _0x3b5230(_0x42ac8b);}};if(!_0x3e13e7['OPUmh'](needsTunnel,_0x18dc30))return await _0x3e13e7[_0x56ae57(0x129)](serverSideLogin,_0x5483e5,{'force':_0x4707ad['force']});let _0x23e364=null,_0xca1c2e=null,_0x5283cd=null,_0x5ce314=null,_0x1ea505=![];const _0x17bd94=process['env'][_0x56ae57(0xc5)]?.[_0x56ae57(0x12e)](),_0x1cc15f=_0x3e13e7[_0x56ae57(0x7c)](_0x17bd94,'1')||_0x17bd94===_0x3e13e7[_0x56ae57(0xa9)],_0x1d1b34={'profileName':_0x5483e5,'targetUrlHost':targetHostForTelemetry(_0x18dc30),'tunnelRequired':!![],'forceLogin':_0x3e13e7[_0x56ae57(0x98)](Boolean,_0x4707ad['force']),'localBrowserServerHeaded':_0x1cc15f};try{_0x4707ad['telemetry']?.['trackPhaseStart'](_0x3e13e7[_0x56ae57(0x83)],_0x1d1b34);_0x1cc15f&&console['log'](_0x56ae57(0xcf));_0x23e364=await _0x3e13e7[_0x56ae57(0x106)](launchBrowserServer,{'headless':!_0x1cc15f}),_0xca1c2e=await createTunnelSession(_0x18dc30);const _0x24f09f=await requireToken();_0x5283cd=await _0x3e13e7[_0x56ae57(0x106)](createTunnelBridge,{'localWsUrl':_0x23e364['wsEndpoint'],'tunnelServerUrl':_0xca1c2e['tunnelUrl'],'sessionId':_0xca1c2e[_0x56ae57(0x119)],'apiKey':_0x24f09f,'onError':_0x557b5c=>{_0x5ce314=_0x557b5c;},'onClose':()=>{_0x5ce314??=new Error('Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20'+_0x5483e5);},'onEvent':_0x2d42ee=>trackBridgeEvent(_0x4707ad[_0x56ae57(0x96)],_0x2d42ee)}),_0x4707ad[_0x56ae57(0x96)]?.[_0x56ae57(0x120)]('tunnel_login_setup',{..._0x1d1b34,'tunnelSessionId':_0xca1c2e['sessionId'],'localBrowserServer':!![],'localBrowserServerHeaded':_0x1cc15f}),_0x1ea505=!![];try{return _0x4707ad[_0x56ae57(0x96)]?.[_0x56ae57(0xf3)](_0x56ae57(0x12a),{..._0x1d1b34,'tunnelSessionId':_0xca1c2e['sessionId']}),await _0x3e13e7[_0x56ae57(0x125)](serverSideLogin,_0x5483e5,{'force':_0x4707ad[_0x56ae57(0x124)],'targetUrl':_0x18dc30,'tunnel':{'sessionId':_0xca1c2e['sessionId'],'pwEndpoint':_0xca1c2e[_0x56ae57(0xca)]}})[_0x56ae57(0x121)](_0x34e6b5=>{const _0x187e72=_0x56ae57;return _0x4707ad[_0x187e72(0x96)]?.['trackPhaseEnd'](_0x3e13e7[_0x187e72(0xbf)],{..._0x1d1b34,'tunnelSessionId':_0xca1c2e?.['sessionId'],'loginStatus':_0x34e6b5[_0x187e72(0xb5)],'hasSessionState':Boolean(_0x34e6b5['session_state']),'hasTestOutput':Boolean(_0x34e6b5[_0x187e72(0x7b)]),'bridgeError':_0x3e13e7[_0x187e72(0x10d)](errorMessageForTelemetry,_0x5ce314)}),_0x34e6b5;});}catch(_0xe1d685){await _0x4707ad[_0x56ae57(0x96)]?.['trackPhaseError']('tunnel_login_request',_0x3e13e7['HOnKl'](_0x5ce314,_0xe1d685),{..._0x1d1b34,'tunnelSessionId':_0xca1c2e['sessionId'],'bridgeError':errorMessageForTelemetry(_0x5ce314)});throw _0x3e13e7['HOnKl'](_0x5ce314,_0xe1d685);}}catch(_0x304bb1){!_0x1ea505&&await _0x4707ad[_0x56ae57(0x96)]?.['trackPhaseError']('tunnel_login_setup',_0x304bb1,{..._0x1d1b34,'tunnelSessionId':_0xca1c2e?.['sessionId']});throw _0x304bb1;}finally{(_0x3e13e7[_0x56ae57(0xb9)](_0xca1c2e,_0x23e364)||_0x5283cd)&&(_0x4707ad[_0x56ae57(0x96)]?.['trackPhaseStart'](_0x56ae57(0x126),{..._0x1d1b34,'tunnelSessionId':_0xca1c2e?.['sessionId']}),_0x5283cd?.[_0x56ae57(0x99)](),_0x23e364&&await _0x23e364['close']()[_0x56ae57(0x103)](()=>{}),_0xca1c2e&&await _0x3e13e7[_0x56ae57(0x115)](deleteTunnelSession,_0xca1c2e[_0x56ae57(0x119)])['catch'](()=>{}),_0x4707ad[_0x56ae57(0x96)]?.['trackPhaseEnd']('tunnel_login_cleanup',{..._0x1d1b34,'tunnelSessionId':_0xca1c2e?.[_0x56ae57(0x119)]}));}}export async function manualBrowserLogin(_0x2a91ce,_0x5017fa,_0x5ae4fa={}){const _0x37092d=_0x5e39,_0x11f31e={'vOUdP':function(_0x109f06,_0x2a0fcc){return _0x109f06/_0x2a0fcc;},'rRmha':'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','xFImJ':function(_0x5580b7,_0x29b8d5){return _0x5580b7>_0x29b8d5;},'nWKSh':_0x37092d(0x111),'sFVVR':'\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','yPQJY':function(_0x3b4712,_0x3e9287){return _0x3b4712(_0x3e9287);},'vRFxh':function(_0x3925a3,_0x524886){return _0x3925a3&&_0x524886;},'jPHVZ':_0x37092d(0x95),'EZYln':_0x37092d(0x10b),'Ioryw':function(_0x1825f6,_0x4ef879){return _0x1825f6!==_0x4ef879;},'UWybw':_0x37092d(0xe0)};if(!isInteractive())throw new Error(_0x37092d(0x84)+_0x2a91ce['name']+_0x37092d(0xd2)+_0x11f31e[_0x37092d(0xdc)]+_0x37092d(0x72));const _0x12d634=_0x5017fa&&_0x11f31e[_0x37092d(0xee)](_0x5017fa['domains'][_0x37092d(0xf8)],0x0)?_0x5017fa[_0x37092d(0x12b)][0x0]:_0x11f31e[_0x37092d(0x12c)];console[_0x37092d(0x128)](_0x11f31e[_0x37092d(0x73)]),console[_0x37092d(0x128)](_0x37092d(0xf2)),await new Promise(_0xdc4f52=>setTimeout(_0xdc4f52,0x7d0));const _0x362e94=await chromium['launch']({'headless':![]});let _0x467b6b=null;try{const _0x143352={'ignoreHTTPSErrors':!![]};_0x5017fa?.['setupHeaders']&&(_0x143352[_0x37092d(0xaf)]=_0x5017fa[_0x37092d(0xa4)]);const _0x2b8dfb=await _0x362e94['newContext'](_0x143352);await _0x11f31e[_0x37092d(0x94)](addProfileSetupBanner,_0x2b8dfb);const _0x4afc09=await _0x2b8dfb['newPage']();await _0x4afc09['goto'](_0x12d634);let _0x1b0d72=![];await new Promise(_0x891998=>{const _0x576a49={'Rbkwq':function(_0x536cce,_0x266f30){return _0x11f31e['vOUdP'](_0x536cce,_0x266f30);},'bPlBg':function(_0x33bd79){return _0x33bd79();}},_0x3349c8=setTimeout(()=>{const _0x19893d=_0x5e39;_0x1b0d72=!![],console[_0x19893d(0xe1)]('Browser\x20login\x20timed\x20out\x20after\x20'+_0x576a49[_0x19893d(0xd8)](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+_0x19893d(0xea)),_0x576a49['bPlBg'](_0x891998);},MANUAL_LOGIN_TIMEOUT_MS);_0x4afc09['on']('close',async()=>{const _0x20de87=_0x5e39;clearTimeout(_0x3349c8);try{const _0x19169c=await _0x2b8dfb[_0x20de87(0xd0)]();_0x467b6b=_0x19169c;}catch{}_0x891998();});});if(_0x11f31e[_0x37092d(0x6c)](_0x1b0d72,!_0x467b6b))throw new Error(_0x11f31e[_0x37092d(0x79)]);}finally{await _0x362e94['close']()[_0x37092d(0x103)](()=>{});}if(!_0x467b6b)throw new Error(_0x11f31e[_0x37092d(0xe9)]);return _0x11f31e['Ioryw'](_0x5ae4fa[_0x37092d(0x8c)],![])&&await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x2a91ce[_0x37092d(0xae)])+_0x37092d(0x8a),{'method':_0x11f31e['UWybw'],'body':JSON['stringify']({'session_state':_0x467b6b,'updated_by':_0x37092d(0x8b)})}),{'sessionState':_0x467b6b};}function _0x4aa6(){const _0x69afdd=['\x20Available:\x20','invalidateOn','code','jPHVZ','\x20\x20Created\x20cloud\x20profile\x20\x22','test_output','hOFTD','forceLogin','origin','env','Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20(','\x22,\x20refreshing\x20session...','replace','biIKq','No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22','tunnel_bridge','QrzlY','trackPhaseError','122730SstPyH','string','/session','cli:manual-login','persistSessionState','browserOptions','loginInstructions','262710uHISns','aiZZZ','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','RANGER_TEST_PASSWORD','profiles','yPQJY','Browser\x20login\x20timed\x20out\x20before\x20completion.','telemetry','pendingLocalConnections','VgBNL','close','environmentKey','\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a','raw','\x20\x20No\x20live\x20session\x20for\x20\x22','\x20\x20forceLogin\x20enabled\x20for\x20\x22','NyqWR','defaultEnvironmentKey','key','\x22;\x20proceeding\x20with\x20loginInstructions.','target_url','setupHeaders','tunnel_bridge_event','baseUrl','push','\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20','XWroZ','rlIpO','\x22\x20failed\x20validation\x20—\x20refreshing...','No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22','hiAjp','name','extraHTTPHeaders',');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.','url','12NRCqfw','success','tnknl','status','\x20(auth\x20env:\x20','5715808evKWCe','\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20','mWEqH','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','748276eVBcqt','sessionState','elapsedMs','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','AyoyS','tunnel','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','IDUqT','EtwHT','stringify','RANGER_TUNNEL_LOGIN_HEADED','ZXOem','NzsmI','organizationId','PWmVz','pwEndpoint','OvmGv','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','clientIp','headers','\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','storageState','cGQVo','\x22.\x0a','EfCfX','PUT','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','message','isArray','Rbkwq','cookies','143608ojZzia','some','rRmha','\x20\x20Server-side\x20login\x20error:\x20','EpxLF','RANGER_TEST_USERNAME','POST','error','sessionCheckPath','storageStatePath','Pass\x20--base-url\x20<your-app-url>\x20so\x20Ranger\x20can\x20match\x20the\x20right\x20one,\x20or\x20create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`.','tunnel_session_id','ambiguous','qUAjn','\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22','EZYln','\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.','userAgent','\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20','not_configured','xFImJ','kjZpB','targetUrl','\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).','\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','trackPhaseStart','pw_endpoint','\x20\x20-\x20pass\x20`--env\x20<key>`\x20to\x20pick\x20the\x20auth\x20environment\x20by\x20name,\x20or\x0a','parse','ZJuWs','length','Auth\x20environment\x20\x22','TqBpZ','DELETE','jKYCc','\x20\x20Options:\x0a','\x20\x20Cloud\x20session\x20for\x20\x22','effectiveBaseUrl','\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.','OpURh','username','catch','tunnel_error','/api/v1/profiles/','kUxKV','toISOString','YZoFq','dAPxy','reason','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','auth_config','SYMCA','hVVIl','environments','IcvjN','about:blank','UqQMj','none','join','IsbDL','doFSU','HWUls','/api/v1/tunnel/sessions','sessionId','981AZzYPk','SmTju','5PXsKkf',').\x20','type','CzVqK','trackPhaseEnd','then','yMdSn','keys','force','WtLFy','tunnel_login_cleanup','session_state','log','ZIQge','tunnel_login_request','domains','nWKSh','ltzwh','toLowerCase','21160SuFEaC','Mcnyk','JLuNU','vRFxh','qrzge','settings','environment_key','1861930qeGiYC','application/json','or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','sFVVR','password','prompt'];_0x4aa6=function(){return _0x69afdd;};return _0x4aa6();}export async function promptSaveCredentials(_0xaa74d8){const _0x1ab18e=_0x5e39,_0x3903e0={'IDUqT':function(_0x2c8dc6,_0x3edb74){return _0x2c8dc6||_0x3edb74;},'kjZpB':function(_0x5aa3ad){return _0x5aa3ad();},'ZJuWs':_0x1ab18e(0xcc),'dAPxy':function(_0x1e9eb8,_0x4c4749){return _0x1e9eb8(_0x4c4749);},'UqQMj':'PUT','CyRLA':_0x1ab18e(0x91)},_0x3755d2=process['env'][_0x1ab18e(0xdf)],_0x3b845a=process[_0x1ab18e(0x7f)][_0x1ab18e(0x92)];if(_0x3903e0[_0x1ab18e(0xc2)](!_0x3755d2,!_0x3b845a))return;if(!_0x3903e0[_0x1ab18e(0xef)](isInteractive))return;const {save:_0x4a973e}=await _0xa77b1d[_0x1ab18e(0x75)]([{'type':'confirm','name':'save','message':_0x3903e0[_0x1ab18e(0xf7)],'default':![]}]);if(!_0x4a973e)return;await apiRequest('/api/v1/profiles/'+_0x3903e0[_0x1ab18e(0x109)](encodeURIComponent,_0xaa74d8),{'method':_0x3903e0[_0x1ab18e(0x112)],'body':JSON['stringify']({'username':_0x3755d2,'password':_0x3b845a})}),console[_0x1ab18e(0x128)](_0x3903e0['CyRLA']);}export async function resolveCloudProfileSession(_0x3df886,_0x26793e={}){const _0x40580e=_0x5e39,_0x4c1894={'ZXOem':function(_0x41f399,_0x5276b3){return _0x41f399===_0x5276b3;},'hiAjp':function(_0x448619,_0x50047e){return _0x448619===_0x50047e;},'xmlqA':_0x40580e(0x89),'PWmVz':function(_0x2c4ef8,_0x1f5475){return _0x2c4ef8(_0x1f5475);},'aiZZZ':function(_0x952a8a,_0x1b93b0){return _0x952a8a>_0x1b93b0;},'NzsmI':function(_0x4cc080,_0x47ef86){return _0x4cc080(_0x47ef86);},'NyqWR':function(_0x225bc4,_0x136355,_0xc14ea,_0x556eb6,_0x450ef2,_0x18ef10){return _0x225bc4(_0x136355,_0xc14ea,_0x556eb6,_0x450ef2,_0x18ef10);},'tnknl':function(_0x12d5fd,_0x7cdb76,_0x10914d){return _0x12d5fd(_0x7cdb76,_0x10914d);},'ltzwh':function(_0x3a84f5,_0x37b450,_0x23998c,_0x57a29e,_0x5bca8e){return _0x3a84f5(_0x37b450,_0x23998c,_0x57a29e,_0x5bca8e);},'IhnUR':function(_0x87679e,_0x502899){return _0x87679e(_0x502899);},'CzVqK':function(_0x28bfb4,_0x290afd){return _0x28bfb4(_0x290afd);},'TXLbU':function(_0x389ed8,_0x5f43ee){return _0x389ed8||_0x5f43ee;},'YZoFq':function(_0x96ece0,_0x5d8f8e,_0x2bd052){return _0x96ece0(_0x5d8f8e,_0x2bd052);},'doFSU':_0x40580e(0xb3),'yMdSn':function(_0xc3b873,_0x11fa60,_0x3e8d06,_0x534693,_0x373e6a,_0x279d34,_0x27fdc7,_0x26253d){return _0xc3b873(_0x11fa60,_0x3e8d06,_0x534693,_0x373e6a,_0x279d34,_0x27fdc7,_0x26253d);},'hVVIl':function(_0x5a43bd,_0x3c6845){return _0x5a43bd(_0x3c6845);},'wkeal':'\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','ECIHZ':function(_0x345f6e,_0x3e7cb6){return _0x345f6e instanceof _0x3e7cb6;},'QZiwC':function(_0x5ed72a,_0x310c87,_0x392e07,_0x4d4fcb,_0x527be0,_0x36c8d5,_0x5d4149,_0x122e9c){return _0x5ed72a(_0x310c87,_0x392e07,_0x4d4fcb,_0x527be0,_0x36c8d5,_0x5d4149,_0x122e9c);}},_0x30f654=_0x3df886['settings']??{},_0x3463f8=await fetchAuthConfig(),_0x446466=_0x3463f8?resolveAuthEnvironmentLocally(_0x3463f8,_0x3df886[_0x40580e(0x9a)]):null,_0x10aa12=_0x4c1894[_0x40580e(0xc6)](typeof _0x446466?.[_0x40580e(0x8e)],_0x40580e(0x89))&&_0x446466[_0x40580e(0x8e)]['trim']()?_0x446466['loginInstructions']:undefined,_0x30be97=_0x4c1894[_0x40580e(0xad)](typeof _0x30f654['loginInstructions'],_0x4c1894['xmlqA'])&&_0x30f654['loginInstructions']['trim']()?_0x30f654[_0x40580e(0x8e)]:undefined,_0x5dac30=_0x30be97||!_0x10aa12?_0x30f654:{..._0x30f654,'loginInstructions':_0x10aa12},_0x4a7524=_0x4c1894[_0x40580e(0xc9)](Boolean,_0x5dac30['loginInstructions']?.['trim']()),_0x21c704=Boolean(_0x30f654['forceLogin']||_0x446466?.[_0x40580e(0x7d)]),_0x3dfa73=_0x446466?.['domains'],_0x18b2b8=_0x30f654['setupHeaders'],_0x2ff870=_0x18b2b8??_0x446466?.['setupHeaders'],_0x48e1dd=_0x26793e[_0x40580e(0xff)]??_0x30f654[_0x40580e(0xa6)]??(_0x3dfa73&&_0x4c1894[_0x40580e(0x90)](_0x3dfa73[_0x40580e(0xf8)],0x0)?_0x3dfa73[0x0]:''),_0x595e70=_0x48e1dd?_0x4c1894[_0x40580e(0xc7)](needsTunnel,_0x48e1dd):![],_0x40251d={'invalidateOn':_0x446466?.['invalidateOn'],'userAgent':_0x446466?.[_0x40580e(0x8d)]?.['userAgent']??_0x30f654['userAgent']};_0x21c704&&console[_0x40580e(0x128)](_0x40580e(0x9e)+_0x3df886['name']+_0x40580e(0x81));if(!_0x21c704){const _0x1fd21e=await _0x4c1894[_0x40580e(0x9f)](checkLocalCache,_0x3df886['name'],_0x3df886[_0x40580e(0xc8)],_0x48e1dd,_0x2ff870,_0x40251d);if(_0x1fd21e){if(_0x48e1dd&&!_0x595e70){const _0x434ae4=await isCachedSessionLive(_0x1fd21e[_0x40580e(0xe3)],_0x48e1dd,{'sessionCheckPath':_0x446466?.[_0x40580e(0xe2)],'setupHeaders':_0x2ff870},{'launchBrowser':launchRealBrowser});if(_0x434ae4)return console[_0x40580e(0x128)]('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x3df886[_0x40580e(0xae)]+'\x22'),{'authPath':_0x1fd21e[_0x40580e(0xe3)],'settings':_0x5dac30,'resolvedEnv':_0x446466};console[_0x40580e(0x128)]('\x20\x20Cached\x20session\x20for\x20\x22'+_0x3df886['name']+_0x40580e(0xab)),_0x4c1894[_0x40580e(0xb4)](emitSessionValidationHint,_0x48e1dd,_0x446466);}else return _0x595e70&&console['log'](_0x40580e(0xe8)+_0x3df886['name']+'\x22'),{'authPath':_0x1fd21e[_0x40580e(0xe3)],'settings':_0x5dac30,'resolvedEnv':_0x446466};}}if(!_0x21c704&&_0x3df886[_0x40580e(0xbc)]){if(_0x595e70)console['log']('\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22'+_0x48e1dd+'\x22\x20on\x20profile\x20\x22'+_0x3df886[_0x40580e(0xae)]+'\x22');else{const _0xfacf0f=await writeSessionToLocalCache(_0x3df886['name'],_0x3df886['organizationId'],_0x48e1dd,_0x2ff870,_0x3df886['sessionState'],_0x3dfa73,_0x40251d);if(_0x48e1dd){const _0x1e8c70=await _0x4c1894[_0x40580e(0x12d)](isCachedSessionLive,_0xfacf0f,_0x48e1dd,{'sessionCheckPath':_0x446466?.['sessionCheckPath'],'setupHeaders':_0x2ff870},{'launchBrowser':launchRealBrowser});if(_0x1e8c70)return console[_0x40580e(0x128)](_0x40580e(0xd5)+_0x3df886['name']+'\x22,\x20cached\x20locally'),{'authPath':_0xfacf0f,'settings':_0x5dac30,'resolvedEnv':_0x446466};console['log'](_0x40580e(0xfe)+_0x3df886[_0x40580e(0xae)]+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),emitSessionValidationHint(_0x48e1dd,_0x446466);}else return{'authPath':_0xfacf0f,'settings':_0x5dac30,'resolvedEnv':_0x446466};}}if(_0x4a7524)return console[_0x40580e(0x128)](_0x40580e(0x9d)+_0x3df886[_0x40580e(0xae)]+_0x40580e(0xa2)),{'authPath':undefined,'settings':_0x5dac30,'resolvedEnv':_0x446466};console['log']('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x3df886[_0x40580e(0xae)]+'\x22,\x20attempting\x20login...');const _0x3c5ffa=Boolean(process['env'][_0x40580e(0xdf)])&&_0x4c1894['IhnUR'](Boolean,process['env']['RANGER_TEST_PASSWORD']),_0x5cfeb8=_0x4c1894[_0x40580e(0x11f)](Boolean,_0x3df886['username']);if(_0x4c1894['TXLbU'](_0x3c5ffa,_0x5cfeb8))try{const _0x20d374=_0x48e1dd?await serverSideLoginWithOptionalTunnel(_0x3df886[_0x40580e(0xae)],_0x48e1dd,{'force':_0x21c704,'telemetry':_0x26793e['telemetry']}):await _0x4c1894[_0x40580e(0x108)](serverSideLogin,_0x3df886[_0x40580e(0xae)],{'force':_0x21c704});if(_0x20d374[_0x40580e(0xb5)]===_0x40580e(0xed))console[_0x40580e(0x128)]('\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...');else{if(_0x20d374[_0x40580e(0xb5)]===_0x4c1894[_0x40580e(0x116)]&&_0x20d374[_0x40580e(0x127)]){console['log']('\x20\x20Login\x20successful.\x20Session\x20cached.');const _0x298855=await _0x4c1894[_0x40580e(0x122)](writeSessionToLocalCache,_0x3df886['name'],_0x3df886['organizationId'],_0x48e1dd,_0x2ff870,_0x20d374['session_state'],_0x3dfa73,_0x40251d);return _0x3c5ffa&&!_0x5cfeb8&&await _0x4c1894[_0x40580e(0x10e)](promptSaveCredentials,_0x3df886[_0x40580e(0xae)]),{'authPath':_0x298855,'settings':_0x5dac30,'resolvedEnv':_0x446466};}else _0x20d374[_0x40580e(0x7b)]&&(console[_0x40580e(0x128)](_0x40580e(0xc1)),console[_0x40580e(0x128)](_0x20d374['test_output'])),console[_0x40580e(0x128)](_0x4c1894['wkeal']);}}catch(_0x57b130){console['log'](_0x40580e(0xdd)+(_0x4c1894['ECIHZ'](_0x57b130,Error)?_0x57b130['message']:_0x4c1894[_0x40580e(0x11f)](String,_0x57b130))),console[_0x40580e(0x128)](_0x4c1894['wkeal']);}const _0x3c0a9c=_0x446466?{..._0x446466,'setupHeaders':_0x2ff870}:_0x48e1dd?{'key':_0x3df886[_0x40580e(0x9a)]??'','domains':[_0x48e1dd],'setupHeaders':_0x2ff870}:null,{sessionState:_0x5504f1}=await manualBrowserLogin(_0x3df886,_0x3c0a9c,{'persistSessionState':!_0x595e70}),_0x475cb3=await _0x4c1894['QZiwC'](writeSessionToLocalCache,_0x3df886[_0x40580e(0xae)],_0x3df886[_0x40580e(0xc8)],_0x48e1dd,_0x2ff870,_0x5504f1,_0x3dfa73,_0x40251d);return{'authPath':_0x475cb3,'settings':_0x5dac30,'resolvedEnv':_0x446466};}
1
+ const _0x4bac8e=_0x24ab;(function(_0x3cefb7,_0xb08a73){const _0xdb78b=_0x24ab,_0x1f311c=_0x3cefb7();while(!![]){try{const _0x2215df=-parseInt(_0xdb78b(0x1e1))/0x1*(parseInt(_0xdb78b(0x1b2))/0x2)+-parseInt(_0xdb78b(0x1ea))/0x3*(parseInt(_0xdb78b(0x1e4))/0x4)+parseInt(_0xdb78b(0x191))/0x5+parseInt(_0xdb78b(0x196))/0x6+parseInt(_0xdb78b(0x178))/0x7+-parseInt(_0xdb78b(0x1a4))/0x8+parseInt(_0xdb78b(0x195))/0x9;if(_0x2215df===_0xb08a73)break;else _0x1f311c['push'](_0x1f311c['shift']());}catch(_0x59cfa0){_0x1f311c['push'](_0x1f311c['shift']());}}}(_0x34c4,0x74eba));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x25107d 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(_0x4a6003){const _0xc96b23=_0x24ab,_0x3b83f6={'yWUQK':'invalid-url'};try{return new URL(_0x4a6003)[_0xc96b23(0x17a)];}catch{return _0x3b83f6[_0xc96b23(0x1ac)];}}function errorMessageForTelemetry(_0x179eab){const _0x52e210={'TUFyg':function(_0x4e1e8a,_0x2c14db){return _0x4e1e8a instanceof _0x2c14db;}};return _0x52e210['TUFyg'](_0x179eab,Error)?_0x179eab['message']:undefined;}function trackBridgeEvent(_0x215f30,_0x581bac){const _0x20e872=_0x24ab,_0x42c35f={'gPEZo':function(_0x575a9d,_0x4a6a95){return _0x575a9d===_0x4a6a95;},'SDnvr':'local_ws_error','xnpeW':'tunnel_bridge'};if(!_0x215f30)return;const _0x19ce99={'tunnelSessionId':_0x581bac[_0x20e872(0x15f)],'tunnelEventType':_0x581bac['type'],'connectionId':_0x581bac[_0x20e872(0x15d)],'code':_0x581bac['code'],'reason':_0x581bac['reason'],'error':_0x581bac[_0x20e872(0x1e3)],'elapsedMs':_0x581bac[_0x20e872(0x18a)],'activeLocalConnections':_0x581bac[_0x20e872(0x17d)],'pendingLocalConnections':_0x581bac['pendingLocalConnections']};_0x215f30[_0x20e872(0x1d4)]('tunnel_bridge_event',_0x19ce99),(_0x42c35f[_0x20e872(0x1ef)](_0x581bac[_0x20e872(0x1b5)],_0x20e872(0x162))||_0x42c35f['gPEZo'](_0x581bac[_0x20e872(0x1b5)],_0x42c35f['SDnvr']))&&void _0x215f30[_0x20e872(0x1e8)](_0x42c35f[_0x20e872(0x1a0)],new Error(_0x581bac['error']??_0x581bac['type']),_0x19ce99);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x4d103c=_0x24ab,_0x359024={'jhBjS':_0x4d103c(0x1f8)},_0x2de857=await getToken();if(!_0x2de857)throw new Error(_0x359024['jhBjS']);return _0x2de857;}function _0x34c4(){const _0x530407=['utf-8','ambiguous','\x20\x20forceLogin\x20enabled\x20for\x20\x22','prompt','Auth\x20environment\x20\x22','4726449fSrmFH','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','host','/api/v1/tunnel/sessions/','confirm','activeLocalConnections','GrmOq','\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.','tunnel_login_request','JUpIu','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','statusText','join','RCVPe','not_configured','storageState','newPage','ukAoe','elapsedMs','\x20\x20No\x20live\x20session\x20for\x20\x22','goto','Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20','catch','you\x27re\x20now\x20at\x20\x22','trim','2392265dtaQjI','VbCNt','string','oDGNs','5826528FyXuRY','4154766WEmCFI','tKnjN','log','\x22\x20failed\x20validation\x20—\x20refreshing...','RANGER_TUNNEL_LOGIN_HEADED','test_output','\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20','settings','YFLYX','\x22\x20matched\x20by\x20host\x20for\x20','xnpeW','sessionState','CwJlE','\x20\x20Cloud\x20session\x20for\x20\x22','5353200TkzmPb','BDsBV','\x22.\x0a','clientIp','):\x20','code','tzuVy','password','yWUQK','rUnTn','fBcfq','FaOjJ','isArray','environmentKey','42EjGzBJ','NBrNy','status','type','ehaaD','Iojya','TIliU','defaultEnvironmentKey','WWNhd','username','invalidateOn','trackPhaseStart','Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20(','env','POST','JbsfZ','auth','/api/v1/profiles/','gywRK','\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22','length','/login','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','storageStatePath','session_state','zITYm','\x20\x20Login\x20successful.\x20Session\x20cached.','TEjIF','/session','browserOptions','RVWzM','profiles','wsEndpoint','AbXym','trackPhaseEnd','userAgent','\x22\x20failed\x20validation\x20—\x20re-login\x20needed...','detail','airpa','application/json','force',');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.','setupHeaders','parse','sessionCheckPath','forceLogin','Cloud\x20profile\x20\x22','25131cLrkNi','replace','error','188UdWRty','telemetry','yfxIj','EUtLH','trackPhaseError','/api/v1/profiles','52194pkyJrC','\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22','tunnel_login_setup','\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','RANGER_TEST_USERNAME','gPEZo','glEgc','xElKP','\x22\x20on\x20profile\x20\x22','obLFB','domains','\x22,\x20refreshing\x20session...','IwzfU','RANGER_TEST_PASSWORD','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','agent','environments','\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22','/api/v1/tunnel/sessions','aDFiA','iUJJr','\x22;\x20using\x20\x22','dLDnj','jGlTJ','\x20\x20Options:\x0a','WrmhS','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','EuwXC','TDuxI','success','connectionId','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','sessionId','name','true','tunnel_error','cookies','launch','organizationId','loginInstructions','\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.','tunnel','raw','stringify','close','key','effectiveBaseUrl','ApiError','\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20','Browser\x20login\x20timed\x20out\x20after\x20','json','targetUrl'];_0x34c4=function(){return _0x530407;};return _0x34c4();}async function apiRequest(_0x318ca3,_0x17cd40={}){const _0x26eb7e=_0x24ab,_0x5362e8={'RVWzM':function(_0x37a73f){return _0x37a73f();},'TIliU':function(_0x144200,_0x3bb011,_0x5e6b89){return _0x144200(_0x3bb011,_0x5e6b89);},'QOykO':function(_0xae88ab,_0x13feb0){return _0xae88ab===_0x13feb0;},'dLDnj':_0x26eb7e(0x193),'yfxIj':function(_0x563fa1,_0x744b6e){return _0x563fa1===_0x744b6e;}},_0x5c0eef=await _0x5362e8[_0x26eb7e(0x1d0)](requireToken),_0x5e3e6f=_0x5362e8['RVWzM'](getApiBaseUrl),_0x4c3e0c=await _0x5362e8[_0x26eb7e(0x1b8)](fetch,''+_0x5e3e6f+_0x318ca3,{..._0x17cd40,'headers':{'Authorization':'Bearer\x20'+_0x5c0eef,'Content-Type':_0x26eb7e(0x1d9),..._0x17cd40['headers']??{}}});if(!_0x4c3e0c['ok']){let _0x302983='',_0x180197;try{const _0x413609=await _0x4c3e0c[_0x26eb7e(0x171)](),_0x29963b=(_0x5362e8['QOykO'](typeof _0x413609[_0x26eb7e(0x1e3)],'string')?_0x413609['error']:undefined)??JSON[_0x26eb7e(0x16a)](_0x413609);_0x302983=_0x29963b;typeof _0x413609['test_output']===_0x5362e8[_0x26eb7e(0x155)]&&_0x413609[_0x26eb7e(0x19b)]&&(_0x302983=_0x302983+'\x0a'+_0x413609[_0x26eb7e(0x19b)]);if(typeof _0x413609[_0x26eb7e(0x1a9)]===_0x5362e8[_0x26eb7e(0x155)])_0x180197=_0x413609[_0x26eb7e(0x1a9)];}catch{_0x302983=_0x4c3e0c[_0x26eb7e(0x183)];}throw new ApiError('API\x20request\x20'+_0x318ca3+'\x20failed\x20('+_0x4c3e0c[_0x26eb7e(0x1b4)]+_0x26eb7e(0x1a8)+_0x302983,_0x4c3e0c[_0x26eb7e(0x1b4)],_0x302983,_0x180197);}if(_0x5362e8[_0x26eb7e(0x1e6)](_0x4c3e0c['status'],0xcc))return undefined;return _0x4c3e0c[_0x26eb7e(0x171)]();}export class ApiError extends Error{[_0x4bac8e(0x1b4)];['detail'];[_0x4bac8e(0x1a9)];constructor(_0x593625,_0x50ecec,_0x4a31da,_0x4bd011){const _0x425495=_0x4bac8e,_0x32be43={'qGmCu':_0x425495(0x16e)};super(_0x593625),this[_0x425495(0x1b4)]=_0x50ecec,this[_0x425495(0x1d7)]=_0x4a31da,this['code']=_0x4bd011,this['name']=_0x32be43['qGmCu'];}}export async function fetchCloudProfile(_0x57bc9a){const _0x113e53=_0x4bac8e,_0x59776e={'WrmhS':function(_0x422354,_0x464e23){return _0x422354(_0x464e23);},'IYsXf':function(_0x375114,_0x153df){return _0x375114(_0x153df);},'rNNTA':function(_0x35920f,_0x272db9){return _0x35920f instanceof _0x272db9;}};try{return await _0x59776e[_0x113e53(0x158)](apiRequest,_0x113e53(0x1c3)+_0x59776e['IYsXf'](encodeURIComponent,_0x57bc9a));}catch(_0x50543c){if(_0x59776e['rNNTA'](_0x50543c,ApiError)&&_0x50543c[_0x113e53(0x1b4)]===0x194)return null;throw _0x50543c;}}export async function listCloudProfiles(){const _0x92e9ee=_0x4bac8e,_0x1f8436={'oDGNs':_0x92e9ee(0x1e9)},_0x5688b6=await apiRequest(_0x1f8436[_0x92e9ee(0x194)]);return _0x5688b6[_0x92e9ee(0x1d1)];}export async function deleteCloudProfile(_0x111084){const _0xc808a4=_0x4bac8e,_0x25af54={'sAOSI':function(_0x5424b2,_0x196c79,_0x26f620){return _0x5424b2(_0x196c79,_0x26f620);},'TDuxI':function(_0x5a456d,_0x3a05a0){return _0x5a456d===_0x3a05a0;}};try{await _0x25af54['sAOSI'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x111084),{'method':'DELETE'});}catch(_0x3a3e6d){if(_0x3a3e6d instanceof ApiError&&_0x25af54[_0xc808a4(0x15b)](_0x3a3e6d[_0xc808a4(0x1b4)],0x194))throw new Error(_0xc808a4(0x1e0)+_0x111084+'\x22\x20not\x20found.');throw _0x3a3e6d;}}function _0x24ab(_0x10993a,_0x4c2f4a){_0x10993a=_0x10993a-0x155;const _0x34c435=_0x34c4();let _0x24ab02=_0x34c435[_0x10993a];return _0x24ab02;}export async function createCloudProfile(_0x30bed3,_0x5a84ab,_0x2b13e9={}){const _0x9e19cf=_0x4bac8e,_0x46b475={'pHyyi':function(_0x3889ed,_0x1ad666){return _0x3889ed>_0x1ad666;},'CwJlE':function(_0x468684,_0x3b5b48,_0xad5980){return _0x468684(_0x3b5b48,_0xad5980);},'CPhIC':_0x9e19cf(0x1c0)},_0x37135a={'name':_0x30bed3};if(_0x5a84ab)_0x37135a['environment_key']=_0x5a84ab;_0x2b13e9[_0x9e19cf(0x19d)]&&_0x46b475['pHyyi'](Object['keys'](_0x2b13e9[_0x9e19cf(0x19d)])['length'],0x0)&&(_0x37135a[_0x9e19cf(0x19d)]=_0x2b13e9['settings']);if(_0x2b13e9[_0x9e19cf(0x1bb)])_0x37135a['username']=_0x2b13e9[_0x9e19cf(0x1bb)];if(_0x2b13e9[_0x9e19cf(0x1ab)])_0x37135a['password']=_0x2b13e9[_0x9e19cf(0x1ab)];return await _0x46b475[_0x9e19cf(0x1a2)](apiRequest,'/api/v1/profiles',{'method':_0x46b475['CPhIC'],'body':JSON[_0x9e19cf(0x16a)](_0x37135a)});}export async function uploadCloudProfileSession(_0x32a4b1,_0x3596be){const _0x119e72=_0x4bac8e,_0x3c543a={'tmOTI':function(_0x82c93f,_0x2ad552,_0x14faaa){return _0x82c93f(_0x2ad552,_0x14faaa);}};return await _0x3c543a['tmOTI'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x32a4b1)+_0x119e72(0x1ce),{'method':'POST','body':JSON['stringify']({'session_state':_0x3596be})});}export async function saveCloudProfileCredentials(_0x274aa6,_0x2033da,_0x39dd60){const _0x5d211e=_0x4bac8e,_0x11e566={'sYDRR':'PUT'};await apiRequest(_0x5d211e(0x1c3)+encodeURIComponent(_0x274aa6),{'method':_0x11e566['sYDRR'],'body':JSON[_0x5d211e(0x16a)]({'username':_0x2033da,'password':_0x39dd60})});}export async function fetchAuthConfig(){const _0x5badf7=_0x4bac8e;try{const _0x27a2be=await apiRequest('/api/v1/profiles/auth-config');return _0x27a2be['auth_config'];}catch(_0x3399d8){return _0x3399d8 instanceof ApiError&&_0x3399d8['status']!==0x194&&console[_0x5badf7(0x1e3)](_0x5badf7(0x16f)+_0x3399d8['message']),null;}}async function createTunnelSession(_0x529c22){const _0x1b9c82=_0x4bac8e;return await apiRequest(_0x1b9c82(0x1fc),{'method':'POST','body':JSON['stringify']({'targetUrl':_0x529c22,'mode':_0x1b9c82(0x1f9)})});}async function deleteTunnelSession(_0x14bea9){const _0x157009=_0x4bac8e,_0x20dad2={'JUpIu':'DELETE'};await apiRequest(_0x157009(0x17b)+_0x14bea9,{'method':_0x20dad2[_0x157009(0x181)]});}export function pickAdHocEnvKey(_0x1ed67e,_0x53ffd8,_0x5cc9ee){const _0x4d07fe=_0x4bac8e,_0x54a498={'MOFvV':function(_0xabcf8c,_0x21ff8d,_0x4ce2e9){return _0xabcf8c(_0x21ff8d,_0x4ce2e9);},'TEjIF':function(_0x1beef4,_0x151397){return _0x1beef4 in _0x151397;},'Iojya':_0x4d07fe(0x16c),'EuwXC':function(_0x4033fc,_0x52ad05){return _0x4033fc(_0x52ad05);},'glEgc':function(_0x3124ba,_0x21d6a3){return _0x3124ba+_0x21d6a3;},'aDFiA':function(_0x3f38c3,_0x4c2585){return _0x3f38c3+_0x4c2585;}};if(_0x5cc9ee){if(!_0x1ed67e?.['environments']?.[_0x5cc9ee]){const _0x592360=Object['keys'](_0x1ed67e?.[_0x4d07fe(0x1fa)]??{});throw new Error(_0x4d07fe(0x177)+_0x5cc9ee+'\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.'+(_0x592360[_0x4d07fe(0x1c6)]?'\x20Available:\x20'+_0x592360[_0x4d07fe(0x184)](',\x20')+'.':_0x4d07fe(0x167))+'\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)');}return _0x5cc9ee;}if(!_0x1ed67e)return null;if(_0x53ffd8){const _0x48d736=_0x54a498['MOFvV'](matchAuthEnvironmentExact,_0x53ffd8,_0x1ed67e);if(_0x48d736)return _0x48d736;const _0x37ba3b=matchAuthEnvironmentByHost(_0x53ffd8,_0x1ed67e);if(_0x37ba3b&&_0x54a498[_0x4d07fe(0x1cd)](_0x54a498[_0x4d07fe(0x1b7)],_0x37ba3b))return console[_0x4d07fe(0x198)]('\x20\x20Auth\x20env\x20\x22'+_0x37ba3b['key']+_0x4d07fe(0x19f)+_0x53ffd8+'\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).'),_0x37ba3b['key'];if(_0x37ba3b&&_0x4d07fe(0x174)in _0x37ba3b)throw new Error(_0x4d07fe(0x1be)+_0x37ba3b[_0x4d07fe(0x174)][_0x4d07fe(0x184)](',\x20')+_0x4d07fe(0x1db));if(_0x54a498[_0x4d07fe(0x15a)](needsTunnel,_0x53ffd8))throw new Error(_0x54a498['glEgc'](_0x54a498[_0x4d07fe(0x1f0)](_0x54a498['glEgc']('No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22'+_0x53ffd8+_0x4d07fe(0x1a6)+'\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a',_0x4d07fe(0x157)),'\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'+_0x53ffd8[_0x4d07fe(0x1e2)](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a')+('\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20'+_0x53ffd8+_0x4d07fe(0x17f)));}if(_0x1ed67e['defaultEnvironmentKey'])return _0x1ed67e['defaultEnvironmentKey'];const _0x156e0f=Object['keys'](_0x1ed67e[_0x4d07fe(0x1fa)]??{});if(_0x156e0f[_0x4d07fe(0x1c6)]===0x1)return _0x156e0f[0x0];if(_0x156e0f['length']===0x0)return null;throw new Error(_0x54a498[_0x4d07fe(0x1fd)]('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x156e0f['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>`.'));}export function adHocProfileName(_0x3380e2,_0x48b488,_0x3f3d92){if(!_0x48b488||_0x48b488===_0x3f3d92)return _0x3380e2;return _0x3380e2+':'+_0x48b488;}export async function resolveAdHocProfile(_0x4854e9={},_0x117e51=process[_0x4bac8e(0x1bf)]){const _0xb8c278=_0x4bac8e,_0x26a616={'RouDM':'none','IwzfU':function(_0x3035b7,_0x57aa5c){return _0x3035b7(_0x57aa5c);},'WWNhd':function(_0x29a87b,_0x65f629,_0x4acbfc,_0x3460f6){return _0x29a87b(_0x65f629,_0x4acbfc,_0x3460f6);}},_0x5d4d2e=_0x117e51['RANGER_TEST_USERNAME'];if(!_0x5d4d2e)return null;const _0x3c5f7e=await fetchAuthConfig(),_0x230721=pickAdHocEnvKey(_0x3c5f7e,_0x4854e9[_0xb8c278(0x172)],_0x4854e9['envKey']);let _0x1c45cc=adHocProfileName(_0x5d4d2e,_0x230721,_0x3c5f7e?.[_0xb8c278(0x1b9)]),_0x1c4e96=await fetchCloudProfile(_0x1c45cc);_0x1c4e96&&_0x230721&&_0x1c4e96[_0xb8c278(0x1b1)]!==_0x230721&&(console['log']('\x20\x20Cloud\x20profile\x20\x22'+_0x1c45cc+'\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22'+(_0x1c4e96['environmentKey']??_0x26a616['RouDM'])+_0xb8c278(0x1eb)+_0x230721+_0xb8c278(0x1ff)+_0x5d4d2e+':'+_0x230721+'\x22\x20instead.'),_0x1c45cc=_0x5d4d2e+':'+_0x230721,_0x1c4e96=await _0x26a616[_0xb8c278(0x1f6)](fetchCloudProfile,_0x1c45cc));if(_0x1c4e96)return{'name':_0x1c4e96['name'],'profile':_0x1c4e96};const _0x455ccd=_0x117e51[_0xb8c278(0x1f7)],_0x5ad473=await _0x26a616[_0xb8c278(0x1ba)](createCloudProfile,_0x1c45cc,_0x230721??undefined,{'username':_0x5d4d2e,'password':_0x455ccd});return console[_0xb8c278(0x198)]('\x20\x20Created\x20cloud\x20profile\x20\x22'+_0x5ad473['name']+'\x22\x20for\x20'+_0x5d4d2e+(_0x230721?'\x20(auth\x20env:\x20'+_0x230721+')':'')),{'name':_0x5ad473[_0xb8c278(0x160)],'profile':_0x5ad473};}export async function writeSessionToLocalCache(_0x1a9fcc,_0xf19486,_0x2b0e4c,_0x40e459,_0x138a5f,_0x2ac039,_0x25b3c4){const _0x4b4407=_0x4bac8e,_0x481457={'TRuqH':function(_0x49729d){return _0x49729d();},'xoBUd':_0x4b4407(0x1c2),'xElKP':function(_0x5bf479,_0x359553,_0xcb6db8){return _0x5bf479(_0x359553,_0xcb6db8);},'vUxiH':function(_0x54f1d3,_0x4c48d8,_0x413b7e){return _0x54f1d3(_0x4c48d8,_0x413b7e);},'XCGNn':function(_0x1a4b05,_0x2279be,_0x4b8cf6){return _0x1a4b05(_0x2279be,_0x4b8cf6);},'WGxny':function(_0x5f4b57,_0x214d99){return _0x5f4b57(_0x214d99);}},_0xced09e=sessionCacheHash({'orgId':_0xf19486,'profileName':_0x1a9fcc,'effectiveBaseUrl':_0x2b0e4c,'setupHeaders':_0x40e459,'invalidateOn':_0x25b3c4?.['invalidateOn'],'userAgent':_0x25b3c4?.[_0x4b4407(0x1d5)],'clientIp':_0x25b3c4?.['clientIp']}),_0x4b669f=getSessionCachePath(_0xced09e,_0x1a9fcc),_0x1913ea=join(_0x481457['TRuqH'](getRangerHomeDir),_0x481457['xoBUd']);!existsSync(_0x1913ea)&&await _0x481457[_0x4b4407(0x1f1)](mkdir,_0x1913ea,{'recursive':!![]});const _0x4ac7aa={..._0x138a5f};_0x2ac039&&_0x2ac039['length']>0x0&&Array[_0x4b4407(0x1b0)](_0x4ac7aa['cookies'])&&(_0x4ac7aa['cookies']=_0x481457['vUxiH'](duplicateCookiesForDomains,_0x4ac7aa[_0x4b4407(0x163)],_0x2ac039));const _0xf9c022={'cached_at':new Date()['toISOString'](),'session_state':_0x4ac7aa};await _0x481457['XCGNn'](writeFile,_0x4b669f,JSON['stringify'](_0xf9c022,null,0x2));const _0x2909da=_0x481457['WGxny'](getStorageStatePath,_0x4b669f);return await writeFile(_0x2909da,JSON['stringify'](_0x4ac7aa,null,0x2)),_0x2909da;}export async function checkLocalCache(_0x5edfe5,_0x1a3a95,_0xac23d9,_0x46f20c,_0x2b0ca2){const _0x524ad2=_0x4bac8e,_0x10bf1b={'FZoxY':function(_0x1df707,_0x196f9f,_0x4e5b02){return _0x1df707(_0x196f9f,_0x4e5b02);},'nEVdD':function(_0xae44d6,_0x14b03f){return _0xae44d6(_0x14b03f);},'iUJJr':function(_0x2f6fdf,_0x58cb52,_0x3ed551){return _0x2f6fdf(_0x58cb52,_0x3ed551);}},_0x518f91=sessionCacheHash({'orgId':_0x1a3a95,'profileName':_0x5edfe5,'effectiveBaseUrl':_0xac23d9,'setupHeaders':_0x46f20c,'invalidateOn':_0x2b0ca2?.[_0x524ad2(0x1bc)],'userAgent':_0x2b0ca2?.[_0x524ad2(0x1d5)],'clientIp':_0x2b0ca2?.[_0x524ad2(0x1a7)]}),_0x4ba44a=_0x10bf1b['FZoxY'](getSessionCachePath,_0x518f91,_0x5edfe5),_0x569139=getStorageStatePath(_0x4ba44a);if(!existsSync(_0x4ba44a)||!_0x10bf1b['nEVdD'](existsSync,_0x569139))return null;try{const _0x25b567=await _0x10bf1b[_0x524ad2(0x1fe)](readFile,_0x4ba44a,_0x524ad2(0x173));return JSON[_0x524ad2(0x1dd)](_0x25b567),{'storageStatePath':_0x569139};}catch{return null;}}function launchRealBrowser(){const _0x8f7cc4=_0x4bac8e;return chromium[_0x8f7cc4(0x164)]({'headless':!![]});}function emitSessionValidationHint(_0x54de2f,_0x4f5542){const _0x17f3e3=_0x4bac8e;if(!_0x4f5542||!_0x4f5542[_0x17f3e3(0x1f4)]?.[_0x17f3e3(0x1c6)])return;let _0x52c08a;try{_0x52c08a=new URL(_0x54de2f);}catch{return;}const _0x5b577e=[];for(const _0xf24fb2 of _0x4f5542[_0x17f3e3(0x1f4)]){try{_0x5b577e['push']({'raw':_0xf24fb2,'url':new URL(_0xf24fb2)});}catch{}}if(_0x5b577e['length']===0x0)return;if(_0x5b577e['some'](_0x5090f5=>_0x5090f5['url']['origin']===_0x52c08a['origin']))return;const _0x4a2d08=_0x5b577e['map'](_0x26e81b=>'\x22'+_0x26e81b[_0x17f3e3(0x169)]+'\x22')[_0x17f3e3(0x184)](',\x20');console[_0x17f3e3(0x198)](_0x17f3e3(0x19c)+_0x4a2d08+';\x20'+(_0x17f3e3(0x18f)+_0x54de2f+'\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20')+'If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.');}export async function serverSideLogin(_0x2c6eb5,_0x110e49){const _0x3ac140=_0x4bac8e,_0x2f4e29={'zITYm':'POST','SVpwh':function(_0x3f17dd,_0x1aca25){return _0x3f17dd===_0x1aca25;},'rUnTn':_0x3ac140(0x186)},_0x5af870=process[_0x3ac140(0x1bf)][_0x3ac140(0x1ee)],_0x32fb79=process['env'][_0x3ac140(0x1f7)],_0x50e0dc={};if(_0x5af870)_0x50e0dc[_0x3ac140(0x1bb)]=_0x5af870;if(_0x32fb79)_0x50e0dc[_0x3ac140(0x1ab)]=_0x32fb79;if(_0x110e49?.['force'])_0x50e0dc[_0x3ac140(0x1da)]=!![];if(_0x110e49?.[_0x3ac140(0x172)])_0x50e0dc['target_url']=_0x110e49[_0x3ac140(0x172)];_0x110e49?.[_0x3ac140(0x168)]&&(_0x50e0dc['tunnel_session_id']=_0x110e49['tunnel'][_0x3ac140(0x15f)],_0x50e0dc['pw_endpoint']=_0x110e49['tunnel']['pwEndpoint']);try{return await apiRequest(_0x3ac140(0x1c3)+encodeURIComponent(_0x2c6eb5)+_0x3ac140(0x1c7),{'method':_0x2f4e29[_0x3ac140(0x1cb)],'body':JSON['stringify'](_0x50e0dc)});}catch(_0x595c9b){if(_0x595c9b instanceof ApiError&&_0x595c9b[_0x3ac140(0x1b4)]===0x190&&_0x2f4e29['SVpwh'](_0x595c9b[_0x3ac140(0x1a9)],'not_configured'))return{'status':_0x2f4e29[_0x3ac140(0x1ad)],'error':_0x595c9b[_0x3ac140(0x1d7)]};throw _0x595c9b;}}async function serverSideLoginWithOptionalTunnel(_0x4df715,_0xe867b,_0x3f038c={}){const _0x4cf0c2=_0x4bac8e,_0xfe303c={'FxnuU':function(_0xc0e38c,_0x37f536){return _0xc0e38c(_0x37f536);},'jGlTJ':function(_0x3b32fb,_0xe97824){return _0x3b32fb===_0xe97824;},'NBrNy':_0x4cf0c2(0x1ec),'ySoso':_0x4cf0c2(0x1ed),'yRkrN':function(_0x59c51f,_0x254ff7){return _0x59c51f(_0x254ff7);},'JbsfZ':_0x4cf0c2(0x180),'pfHMb':function(_0x2904e1,_0x5c0523,_0x126e56){return _0x2904e1(_0x5c0523,_0x126e56);},'dRMDd':function(_0x5cfc68,_0x3d48c2){return _0x5cfc68(_0x3d48c2);},'YFLYX':function(_0x3d0abb,_0x192989){return _0x3d0abb(_0x192989);}};if(!_0xfe303c['FxnuU'](needsTunnel,_0xe867b))return await serverSideLogin(_0x4df715,{'force':_0x3f038c['force']});let _0x412a51=null,_0x37f1c1=null,_0x38e643=null,_0x3a4cbd=null,_0x185ce8=![];const _0x19798b=process['env'][_0x4cf0c2(0x19a)]?.['toLowerCase'](),_0x4df15c=_0x19798b==='1'||_0xfe303c[_0x4cf0c2(0x156)](_0x19798b,_0x4cf0c2(0x161)),_0x1a1a8c={'profileName':_0x4df715,'targetUrlHost':targetHostForTelemetry(_0xe867b),'tunnelRequired':!![],'forceLogin':Boolean(_0x3f038c[_0x4cf0c2(0x1da)]),'localBrowserServerHeaded':_0x4df15c};try{_0x3f038c[_0x4cf0c2(0x1e5)]?.[_0x4cf0c2(0x1bd)](_0xfe303c[_0x4cf0c2(0x1b3)],_0x1a1a8c);_0x4df15c&&console[_0x4cf0c2(0x198)](_0xfe303c['ySoso']);_0x412a51=await launchBrowserServer({'headless':!_0x4df15c}),_0x37f1c1=await createTunnelSession(_0xe867b);const _0x2c3756=await requireToken();_0x38e643=await _0xfe303c['yRkrN'](createTunnelBridge,{'localWsUrl':_0x412a51[_0x4cf0c2(0x1d2)],'tunnelServerUrl':_0x37f1c1['tunnelUrl'],'sessionId':_0x37f1c1[_0x4cf0c2(0x15f)],'apiKey':_0x2c3756,'onError':_0x4916d5=>{_0x3a4cbd=_0x4916d5;},'onClose':()=>{const _0x3c73a5=_0x4cf0c2;_0x3a4cbd??=new Error(_0x3c73a5(0x18d)+_0x4df715);},'onEvent':_0x3c76df=>trackBridgeEvent(_0x3f038c[_0x4cf0c2(0x1e5)],_0x3c76df)}),_0x3f038c[_0x4cf0c2(0x1e5)]?.[_0x4cf0c2(0x1d4)](_0xfe303c[_0x4cf0c2(0x1b3)],{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1[_0x4cf0c2(0x15f)],'localBrowserServer':!![],'localBrowserServerHeaded':_0x4df15c}),_0x185ce8=!![];try{return _0x3f038c['telemetry']?.[_0x4cf0c2(0x1bd)](_0xfe303c[_0x4cf0c2(0x1c1)],{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1['sessionId']}),await _0xfe303c['pfHMb'](serverSideLogin,_0x4df715,{'force':_0x3f038c['force'],'targetUrl':_0xe867b,'tunnel':{'sessionId':_0x37f1c1[_0x4cf0c2(0x15f)],'pwEndpoint':_0x37f1c1['pwEndpoint']}})['then'](_0x185586=>{const _0x44bf01=_0x4cf0c2;return _0x3f038c['telemetry']?.[_0x44bf01(0x1d4)](_0x44bf01(0x180),{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1?.[_0x44bf01(0x15f)],'loginStatus':_0x185586[_0x44bf01(0x1b4)],'hasSessionState':_0xfe303c['FxnuU'](Boolean,_0x185586[_0x44bf01(0x1ca)]),'hasTestOutput':Boolean(_0x185586[_0x44bf01(0x19b)]),'bridgeError':_0xfe303c['FxnuU'](errorMessageForTelemetry,_0x3a4cbd)}),_0x185586;});}catch(_0x420eec){await _0x3f038c['telemetry']?.[_0x4cf0c2(0x1e8)](_0xfe303c['JbsfZ'],_0x3a4cbd??_0x420eec,{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1['sessionId'],'bridgeError':_0xfe303c['dRMDd'](errorMessageForTelemetry,_0x3a4cbd)});throw _0x3a4cbd??_0x420eec;}}catch(_0x5f38f2){!_0x185ce8&&await _0x3f038c[_0x4cf0c2(0x1e5)]?.[_0x4cf0c2(0x1e8)](_0x4cf0c2(0x1ec),_0x5f38f2,{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1?.[_0x4cf0c2(0x15f)]});throw _0x5f38f2;}finally{(_0x37f1c1||_0x412a51||_0x38e643)&&(_0x3f038c['telemetry']?.[_0x4cf0c2(0x1bd)]('tunnel_login_cleanup',{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1?.[_0x4cf0c2(0x15f)]}),_0x38e643?.[_0x4cf0c2(0x16b)](),_0x412a51&&await _0x412a51[_0x4cf0c2(0x16b)]()['catch'](()=>{}),_0x37f1c1&&await _0xfe303c[_0x4cf0c2(0x19e)](deleteTunnelSession,_0x37f1c1['sessionId'])[_0x4cf0c2(0x18e)](()=>{}),_0x3f038c[_0x4cf0c2(0x1e5)]?.[_0x4cf0c2(0x1d4)]('tunnel_login_cleanup',{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1?.[_0x4cf0c2(0x15f)]}));}}export async function manualBrowserLogin(_0xfdd2f7,_0x11e038,_0xcb9f00={}){const _0x217c5f=_0x4bac8e,_0x4ff482={'ukAoe':function(_0x68c206){return _0x68c206();},'EUtLH':function(_0x2adf3b,_0x1845f5,_0x31c07a){return _0x2adf3b(_0x1845f5,_0x31c07a);},'tKnjN':function(_0x5ec392){return _0x5ec392();},'tzuVy':function(_0x1e59dd,_0x164b1b){return _0x1e59dd+_0x164b1b;},'AbXym':'or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','FaOjJ':'about:blank','aYoIo':'Browser\x20closed\x20before\x20authentication\x20was\x20saved.'};if(!_0x4ff482[_0x217c5f(0x197)](isInteractive))throw new Error(_0x4ff482[_0x217c5f(0x1aa)](_0x4ff482[_0x217c5f(0x1aa)]('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0xfdd2f7['name']+_0x217c5f(0x1a6),'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20'),_0x4ff482[_0x217c5f(0x1d3)]));const _0x22502b=_0x11e038&&_0x11e038[_0x217c5f(0x1f4)][_0x217c5f(0x1c6)]>0x0?_0x11e038[_0x217c5f(0x1f4)][0x0]:_0x4ff482[_0x217c5f(0x1af)];console[_0x217c5f(0x198)]('\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.'),console['log']('\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a'),await new Promise(_0x10f889=>setTimeout(_0x10f889,0x7d0));const _0x4486d3=await chromium[_0x217c5f(0x164)]({'headless':![]});let _0x225cd9=null;try{const _0x1479ae={'ignoreHTTPSErrors':!![]};_0x11e038?.['setupHeaders']&&(_0x1479ae['extraHTTPHeaders']=_0x11e038['setupHeaders']);const _0x15d372=await _0x4486d3['newContext'](_0x1479ae);await addProfileSetupBanner(_0x15d372);const _0x187a4d=await _0x15d372[_0x217c5f(0x188)]();await _0x187a4d[_0x217c5f(0x18c)](_0x22502b);let _0x24d02b=![];await new Promise(_0x4d8059=>{const _0x21d1c4=_0x217c5f,_0xfa511b=_0x4ff482[_0x21d1c4(0x1e7)](setTimeout,()=>{const _0x2a9ac1=_0x21d1c4;_0x24d02b=!![],console['error'](_0x2a9ac1(0x170)+MANUAL_LOGIN_TIMEOUT_MS/0xea60+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x4ff482['ukAoe'](_0x4d8059);},MANUAL_LOGIN_TIMEOUT_MS);_0x187a4d['on']('close',async()=>{const _0x2bac68=_0x21d1c4;clearTimeout(_0xfa511b);try{const _0x58901c=await _0x15d372[_0x2bac68(0x187)]();_0x225cd9=_0x58901c;}catch{}_0x4ff482[_0x2bac68(0x189)](_0x4d8059);});});if(_0x24d02b&&!_0x225cd9)throw new Error('Browser\x20login\x20timed\x20out\x20before\x20completion.');}finally{await _0x4486d3[_0x217c5f(0x16b)]()[_0x217c5f(0x18e)](()=>{});}if(!_0x225cd9)throw new Error(_0x4ff482['aYoIo']);return _0xcb9f00['persistSessionState']!==![]&&await _0x4ff482['EUtLH'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0xfdd2f7['name'])+'/session',{'method':_0x217c5f(0x1c0),'body':JSON['stringify']({'session_state':_0x225cd9,'updated_by':'cli:manual-login'})}),{'sessionState':_0x225cd9};}export async function promptSaveCredentials(_0x59d87e){const _0x4ac7a1=_0x4bac8e,_0x3f3550={'ehaaD':function(_0x20efb,_0x2f9d7e){return _0x20efb||_0x2f9d7e;},'VbCNt':_0x4ac7a1(0x182),'isGYn':function(_0x42fd8e,_0x5533f1,_0x45255c){return _0x42fd8e(_0x5533f1,_0x45255c);},'fBcfq':'PUT'},_0x519c3a=process['env'][_0x4ac7a1(0x1ee)],_0x4650cd=process[_0x4ac7a1(0x1bf)]['RANGER_TEST_PASSWORD'];if(_0x3f3550[_0x4ac7a1(0x1b6)](!_0x519c3a,!_0x4650cd))return;if(!isInteractive())return;const {save:_0x9b5fa5}=await _0x25107d[_0x4ac7a1(0x176)]([{'type':_0x4ac7a1(0x17c),'name':'save','message':_0x3f3550[_0x4ac7a1(0x192)],'default':![]}]);if(!_0x9b5fa5)return;await _0x3f3550['isGYn'](apiRequest,_0x4ac7a1(0x1c3)+encodeURIComponent(_0x59d87e),{'method':_0x3f3550[_0x4ac7a1(0x1ae)],'body':JSON['stringify']({'username':_0x519c3a,'password':_0x4650cd})}),console['log'](_0x4ac7a1(0x179));}export async function resolveCloudProfileSession(_0x672803,_0x38409d={}){const _0x4afa7c=_0x4bac8e,_0xc182a={'GjEZc':function(_0x449374){return _0x449374();},'TGKSy':function(_0x270fd5,_0x2f06cc,_0x54fe52){return _0x270fd5(_0x2f06cc,_0x54fe52);},'BDsBV':function(_0x3d77c6,_0x583c22){return _0x3d77c6===_0x583c22;},'airpa':_0x4afa7c(0x193),'PUAyj':function(_0x2cfd62,_0x47198d){return _0x2cfd62(_0x47198d);},'MDRja':function(_0x40de80,_0x24129d,_0x4880c7,_0x3e3f15,_0x5098b3,_0x6033ba){return _0x40de80(_0x24129d,_0x4880c7,_0x3e3f15,_0x5098b3,_0x6033ba);},'obLFB':function(_0x3b84b7,_0x359cc7){return _0x3b84b7&&_0x359cc7;},'uKDzV':function(_0x4c4a6f,_0x4e7df7,_0xd6bd43){return _0x4c4a6f(_0x4e7df7,_0xd6bd43);},'gcFnY':function(_0x2b40f4,_0x545531,_0x5d27c4,_0x482ad1,_0x38aaec){return _0x2b40f4(_0x545531,_0x5d27c4,_0x482ad1,_0x38aaec);},'vusBl':function(_0x49338f,_0x12afaa,_0xe4c00f){return _0x49338f(_0x12afaa,_0xe4c00f);},'zKkpy':function(_0x402845,_0x208f45){return _0x402845(_0x208f45);},'wXKFP':function(_0xf88672,_0x5e789b){return _0xf88672||_0x5e789b;},'SbQgm':function(_0x5c9c62,_0x160a78,_0x41e7b4,_0x31a4de){return _0x5c9c62(_0x160a78,_0x41e7b4,_0x31a4de);},'WBpHT':_0x4afa7c(0x186),'gywRK':'\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','RCVPe':'\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','ATBGN':function(_0x265262,_0x3b9c03){return _0x265262 instanceof _0x3b9c03;},'PvroN':function(_0x1f1f8e,_0x5cc158){return _0x1f1f8e(_0x5cc158);},'GrmOq':function(_0x1f2141,_0x199cb2,_0x2a2005,_0x392c9c,_0x58893e,_0x3be7f6,_0x44262c,_0x42c55a){return _0x1f2141(_0x199cb2,_0x2a2005,_0x392c9c,_0x58893e,_0x3be7f6,_0x44262c,_0x42c55a);}},_0x3a4d07=_0x672803[_0x4afa7c(0x19d)]??{},_0x385bb4=await _0xc182a['GjEZc'](fetchAuthConfig),_0x2b5569=_0x385bb4?_0xc182a['TGKSy'](resolveAuthEnvironmentLocally,_0x385bb4,_0x672803[_0x4afa7c(0x1b1)]):null,_0xc56582=typeof _0x2b5569?.['loginInstructions']==='string'&&_0x2b5569['loginInstructions']['trim']()?_0x2b5569[_0x4afa7c(0x166)]:undefined,_0x57abea=_0xc182a[_0x4afa7c(0x1a5)](typeof _0x3a4d07[_0x4afa7c(0x166)],_0xc182a[_0x4afa7c(0x1d8)])&&_0x3a4d07['loginInstructions'][_0x4afa7c(0x190)]()?_0x3a4d07['loginInstructions']:undefined,_0x462dc5=_0x57abea||!_0xc56582?_0x3a4d07:{..._0x3a4d07,'loginInstructions':_0xc56582},_0x282aa3=_0xc182a['PUAyj'](Boolean,_0x462dc5['loginInstructions']?.['trim']()),_0x13bbc8=_0xc182a['PUAyj'](Boolean,_0x3a4d07[_0x4afa7c(0x1df)]||_0x2b5569?.[_0x4afa7c(0x1df)]),_0x2cea7e=_0x2b5569?.['domains'],_0x53073e=_0x3a4d07['setupHeaders'],_0x1a0971=_0x53073e??_0x2b5569?.[_0x4afa7c(0x1dc)],_0xc3b665=_0x38409d[_0x4afa7c(0x16d)]??_0x3a4d07['baseUrl']??(_0x2cea7e&&_0x2cea7e[_0x4afa7c(0x1c6)]>0x0?_0x2cea7e[0x0]:''),_0x49183f=_0xc3b665?_0xc182a['PUAyj'](needsTunnel,_0xc3b665):![],_0x29faaf={'invalidateOn':_0x2b5569?.['invalidateOn'],'userAgent':_0x2b5569?.[_0x4afa7c(0x1cf)]?.[_0x4afa7c(0x1d5)]??_0x3a4d07['userAgent']};_0x13bbc8&&console[_0x4afa7c(0x198)](_0x4afa7c(0x175)+_0x672803['name']+_0x4afa7c(0x1f5));if(!_0x13bbc8){const _0x428aac=await _0xc182a['MDRja'](checkLocalCache,_0x672803[_0x4afa7c(0x160)],_0x672803[_0x4afa7c(0x165)],_0xc3b665,_0x1a0971,_0x29faaf);if(_0x428aac){if(_0xc182a[_0x4afa7c(0x1f3)](_0xc3b665,!_0x49183f)){const _0xf3f3bc=await isCachedSessionLive(_0x428aac[_0x4afa7c(0x1c9)],_0xc3b665,{'sessionCheckPath':_0x2b5569?.['sessionCheckPath'],'setupHeaders':_0x1a0971},{'launchBrowser':launchRealBrowser});if(_0xf3f3bc)return console['log']('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x672803[_0x4afa7c(0x160)]+'\x22'),{'authPath':_0x428aac['storageStatePath'],'settings':_0x462dc5,'resolvedEnv':_0x2b5569};console['log']('\x20\x20Cached\x20session\x20for\x20\x22'+_0x672803[_0x4afa7c(0x160)]+_0x4afa7c(0x199)),_0xc182a['uKDzV'](emitSessionValidationHint,_0xc3b665,_0x2b5569);}else return _0x49183f&&console[_0x4afa7c(0x198)](_0x4afa7c(0x1c5)+_0x672803['name']+'\x22'),{'authPath':_0x428aac['storageStatePath'],'settings':_0x462dc5,'resolvedEnv':_0x2b5569};}}if(!_0x13bbc8&&_0x672803['sessionState']){if(_0x49183f)console[_0x4afa7c(0x198)](_0x4afa7c(0x1fb)+_0xc3b665+_0x4afa7c(0x1f2)+_0x672803['name']+'\x22');else{const _0x13181a=await writeSessionToLocalCache(_0x672803[_0x4afa7c(0x160)],_0x672803[_0x4afa7c(0x165)],_0xc3b665,_0x1a0971,_0x672803[_0x4afa7c(0x1a1)],_0x2cea7e,_0x29faaf);if(_0xc3b665){const _0x41e47a=await _0xc182a['gcFnY'](isCachedSessionLive,_0x13181a,_0xc3b665,{'sessionCheckPath':_0x2b5569?.[_0x4afa7c(0x1de)],'setupHeaders':_0x1a0971},{'launchBrowser':launchRealBrowser});if(_0x41e47a)return console[_0x4afa7c(0x198)](_0x4afa7c(0x1c8)+_0x672803['name']+'\x22,\x20cached\x20locally'),{'authPath':_0x13181a,'settings':_0x462dc5,'resolvedEnv':_0x2b5569};console['log'](_0x4afa7c(0x1a3)+_0x672803[_0x4afa7c(0x160)]+_0x4afa7c(0x1d6)),_0xc182a['vusBl'](emitSessionValidationHint,_0xc3b665,_0x2b5569);}else return{'authPath':_0x13181a,'settings':_0x462dc5,'resolvedEnv':_0x2b5569};}}if(_0x282aa3)return console['log'](_0x4afa7c(0x18b)+_0x672803[_0x4afa7c(0x160)]+'\x22;\x20proceeding\x20with\x20loginInstructions.'),{'authPath':undefined,'settings':_0x462dc5,'resolvedEnv':_0x2b5569};console[_0x4afa7c(0x198)](_0x4afa7c(0x18b)+_0x672803['name']+'\x22,\x20attempting\x20login...');const _0x1d48a9=Boolean(process['env']['RANGER_TEST_USERNAME'])&&_0xc182a['zKkpy'](Boolean,process[_0x4afa7c(0x1bf)]['RANGER_TEST_PASSWORD']),_0x41038a=Boolean(_0x672803[_0x4afa7c(0x1bb)]);if(_0xc182a['wXKFP'](_0x1d48a9,_0x41038a))try{const _0x2f806c=_0xc3b665?await _0xc182a['SbQgm'](serverSideLoginWithOptionalTunnel,_0x672803['name'],_0xc3b665,{'force':_0x13bbc8,'telemetry':_0x38409d['telemetry']}):await serverSideLogin(_0x672803[_0x4afa7c(0x160)],{'force':_0x13bbc8});if(_0x2f806c[_0x4afa7c(0x1b4)]===_0xc182a['WBpHT'])console[_0x4afa7c(0x198)](_0xc182a[_0x4afa7c(0x1c4)]);else{if(_0x2f806c[_0x4afa7c(0x1b4)]===_0x4afa7c(0x15c)&&_0x2f806c[_0x4afa7c(0x1ca)]){console[_0x4afa7c(0x198)](_0x4afa7c(0x1cc));const _0x489096=await writeSessionToLocalCache(_0x672803['name'],_0x672803['organizationId'],_0xc3b665,_0x1a0971,_0x2f806c['session_state'],_0x2cea7e,_0x29faaf);return _0x1d48a9&&!_0x41038a&&await promptSaveCredentials(_0x672803[_0x4afa7c(0x160)]),{'authPath':_0x489096,'settings':_0x462dc5,'resolvedEnv':_0x2b5569};}else _0x2f806c[_0x4afa7c(0x19b)]&&(console[_0x4afa7c(0x198)](_0x4afa7c(0x15e)),console[_0x4afa7c(0x198)](_0x2f806c[_0x4afa7c(0x19b)])),console[_0x4afa7c(0x198)](_0xc182a[_0x4afa7c(0x185)]);}}catch(_0x5a186e){console[_0x4afa7c(0x198)]('\x20\x20Server-side\x20login\x20error:\x20'+(_0xc182a['ATBGN'](_0x5a186e,Error)?_0x5a186e['message']:_0xc182a['PvroN'](String,_0x5a186e))),console['log'](_0x4afa7c(0x159));}const _0x448177=_0x2b5569?{..._0x2b5569,'setupHeaders':_0x1a0971}:_0xc3b665?{'key':_0x672803['environmentKey']??'','domains':[_0xc3b665],'setupHeaders':_0x1a0971}:null,{sessionState:_0x21b24c}=await manualBrowserLogin(_0x672803,_0x448177,{'persistSessionState':!_0x49183f}),_0x2d730d=await _0xc182a[_0x4afa7c(0x17e)](writeSessionToLocalCache,_0x672803[_0x4afa7c(0x160)],_0x672803['organizationId'],_0xc3b665,_0x1a0971,_0x21b24c,_0x2cea7e,_0x29faaf);return{'authPath':_0x2d730d,'settings':_0x462dc5,'resolvedEnv':_0x2b5569};}
@@ -1 +1 @@
1
- const _0x1ba78f=_0x3f96;function _0x2afd(){const _0x39ab2b=['baseUrl','toString','sort','980320OtkGHt','auth','908436DchRPP','231lSGWCS','29138PhzrdG','clientIp','5078528NxRWhQ','isTTY','stdin','map','hex','localhost.','ppygE','setupHeaders','ZkWOY','has','userAgent','15776784VkiHgg','cuwnb','status','3113646yxtpSp','295687PjXRdV','launchBrowser','sha256','add','push','5tlXhDb','RqVEb','includes','update','stringify','newContext','IloZe','defaultEnvironmentKey','test','port','effectiveBaseUrl','goto','hostname','environments','.json'];_0x2afd=function(){return _0x39ab2b;};return _0x2afd();}(function(_0x2012c0,_0x57afb8){const _0x1623e4=_0x3f96,_0x269b3e=_0x2012c0();while(!![]){try{const _0x2d08a1=parseInt(_0x1623e4(0x9c))/0x1+parseInt(_0x1623e4(0x9e))/0x2*(parseInt(_0x1623e4(0x9d))/0x3)+parseInt(_0x1623e4(0xa0))/0x4+-parseInt(_0x1623e4(0xb4))/0x5*(parseInt(_0x1623e4(0xae))/0x6)+parseInt(_0x1623e4(0xaf))/0x7+-parseInt(_0x1623e4(0x9a))/0x8+-parseInt(_0x1623e4(0xab))/0x9;if(_0x2d08a1===_0x57afb8)break;else _0x269b3e['push'](_0x269b3e['shift']());}catch(_0xc4112d){_0x269b3e['push'](_0x269b3e['shift']());}}}(_0x2afd,0xe75d1));import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x11ef93=process['env'],_0x44c6f8={'stdin':process[_0x1ba78f(0xa2)],'stdout':process['stdout']}){const _0x4e1ff6=_0x1ba78f,_0x532819={'oKiGG':function(_0x1fc39e,_0x39c70c){return _0x1fc39e(_0x39c70c);}};if(_0x11ef93['CI'])return![];return Boolean(_0x44c6f8['stdin'][_0x4e1ff6(0xa1)])&&_0x532819['oKiGG'](Boolean,_0x44c6f8['stdout'][_0x4e1ff6(0xa1)]);}export const DEFAULT_INVALIDATE_ON=[];function _0x3f96(_0x2b3d8e,_0x40a5b1){_0x2b3d8e=_0x2b3d8e-0x90;const _0x2afde7=_0x2afd();let _0x3f96c2=_0x2afde7[_0x2b3d8e];return _0x3f96c2;}export function sessionCacheHash(_0x1cb04e){const _0x3e0471=_0x1ba78f,_0x5f151d={'ZkWOY':_0x3e0471(0x97),'PPmEW':function(_0x5d4bff,_0x5093fd){return _0x5d4bff(_0x5093fd);},'draSw':_0x3e0471(0xaa),'ppygE':function(_0x219ab8,_0x20486d){return _0x219ab8!==_0x20486d;}},_0x1c3655=new Set(_0x1cb04e['invalidateOn']??DEFAULT_INVALIDATE_ON);_0x1cb04e['effectiveBaseUrl']&&needsTunnel(_0x1cb04e['effectiveBaseUrl'])&&_0x1c3655[_0x3e0471(0xb2)](_0x5f151d['ZkWOY']);const _0x517ee8={'orgId':_0x1cb04e['orgId'],'profileName':_0x1cb04e['profileName']};return _0x1c3655['has'](_0x5f151d[_0x3e0471(0xa8)])&&(_0x517ee8['effectiveBaseUrl']=_0x1cb04e[_0x3e0471(0x92)]),_0x1c3655['has'](_0x3e0471(0xa7))&&(_0x517ee8[_0x3e0471(0xa7)]=_0x1cb04e['setupHeaders']?_0x5f151d['PPmEW'](sortObjectKeys,_0x1cb04e[_0x3e0471(0xa7)]):_0x1cb04e[_0x3e0471(0xa7)]),_0x1c3655['has'](_0x3e0471(0x91))&&(_0x517ee8['port']=extractPort(_0x1cb04e[_0x3e0471(0x92)])),_0x1c3655['has'](_0x5f151d['draSw'])&&_0x1cb04e[_0x3e0471(0xaa)]!==undefined&&(_0x517ee8[_0x3e0471(0xaa)]=_0x1cb04e['userAgent']),_0x1c3655['has']('clientIp')&&_0x5f151d[_0x3e0471(0xa6)](_0x1cb04e['clientIp'],undefined)&&(_0x517ee8['clientIp']=_0x1cb04e[_0x3e0471(0x9f)]),createHash(_0x3e0471(0xb1))[_0x3e0471(0xb7)](JSON[_0x3e0471(0xb8)](_0x517ee8))['digest'](_0x3e0471(0xa4))['slice'](0x0,0xc);}function extractPort(_0x18328e){try{return new URL(_0x18328e)['port'];}catch{return'';}}function sortObjectKeys(_0x20eaeb){const _0x1e7c39=_0x1ba78f,_0x38e382={};for(const _0x4fc8f2 of Object['keys'](_0x20eaeb)[_0x1e7c39(0x99)]()){_0x38e382[_0x4fc8f2]=_0x20eaeb[_0x4fc8f2];}return _0x38e382;}export function getSessionCachePath(_0x1bd122,_0x3c7c3c){const _0x44b0aa=_0x1ba78f;return join(getRangerHomeDir(),_0x44b0aa(0x9b),_0x1bd122+'-'+_0x3c7c3c+_0x44b0aa(0x96));}export function getStorageStatePath(_0x2d370f){return _0x2d370f['replace'](/\.json$/,'.storageState.json');}export function needsTunnel(_0x2ec48f){const _0x38b9ca=_0x1ba78f,_0x1822bc={'eBIPI':'localhost','RqVEb':function(_0x12bfa4,_0xf982fa){return _0x12bfa4===_0xf982fa;},'IloZe':_0x38b9ca(0xa5)};let _0x10e6fc;try{_0x10e6fc=new URL(_0x2ec48f)['hostname'];}catch{return![];}if(_0x10e6fc===_0x1822bc['eBIPI']||_0x1822bc[_0x38b9ca(0xb5)](_0x10e6fc,'127.0.0.1'))return!![];if(_0x10e6fc['endsWith']('.localhost'))return!![];if(_0x10e6fc[_0x38b9ca(0xb6)](_0x1822bc[_0x38b9ca(0xba)]))return!![];return![];}export function hostnameOf(_0x1846cd){const _0x5e258c=_0x1ba78f;return new URL(_0x1846cd)[_0x5e258c(0x94)];}export function duplicateCookiesForDomains(_0x253ec7,_0xe16298){const _0x311626=_0x1ba78f,_0x30ad36={'sMtZP':function(_0x519771,_0x3dd45a){return _0x519771(_0x3dd45a);}},_0x534476=[..._0x253ec7],_0x3d73fc=new Set(_0x253ec7[_0x311626(0xa3)](_0x3b6227=>_0x3b6227['domain']));for(const _0x131bfa of _0xe16298){let _0x1f9572;try{_0x1f9572=_0x30ad36['sMtZP'](hostnameOf,_0x131bfa);}catch{continue;}if(!_0x1f9572)continue;const _0x5b6343=_0x1f9572['startsWith']('.')?_0x1f9572:'.'+_0x1f9572;if(_0x3d73fc[_0x311626(0xa9)](_0x1f9572)||_0x3d73fc[_0x311626(0xa9)](_0x5b6343))continue;for(const _0x3baed2 of _0x253ec7){_0x534476[_0x311626(0xb3)]({..._0x3baed2,'domain':_0x5b6343});}_0x3d73fc['add'](_0x5b6343);}return _0x534476;}export function resolveAuthEnvironmentLocally(_0x4ff9cb,_0x3dbc59){const _0x2e28d8=_0x1ba78f,_0x187e40=_0x4ff9cb[_0x2e28d8(0x95)];if(_0x3dbc59){const _0xb78e10=_0x187e40[_0x3dbc59];if(!_0xb78e10)return null;return{'key':_0x3dbc59,..._0xb78e10};}if(_0x4ff9cb[_0x2e28d8(0xbb)]){const _0x52fdd0=_0x187e40[_0x4ff9cb['defaultEnvironmentKey']];if(!_0x52fdd0)return null;return{'key':_0x4ff9cb['defaultEnvironmentKey'],..._0x52fdd0};}const _0x3d8dd1=Object['keys'](_0x187e40);if(_0x3d8dd1['length']===0x1){const _0x268582=_0x3d8dd1[0x0];return{'key':_0x268582,..._0x187e40[_0x268582]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x5a5d94,_0x2d843b){const _0x105527=_0x1ba78f;try{if(_0x2d843b)return new URL(_0x2d843b,_0x5a5d94)[_0x105527(0x98)]();return new URL(_0x5a5d94)[_0x105527(0x98)]();}catch{return null;}}export function looksLikeLoginUrl(_0x31892d){const _0x27ef85=_0x1ba78f;try{const _0x390d92=new URL(_0x31892d);return LOGIN_URL_PATTERN['test'](_0x390d92['pathname']);}catch{return LOGIN_URL_PATTERN[_0x27ef85(0x90)](_0x31892d);}}export async function isCachedSessionLive(_0x5d7a5d,_0x39221e,_0x42736e={},_0x340402={}){const _0x277d5b=_0x1ba78f,_0x4d4319={'VRCMs':function(_0x107786,_0x3fa750,_0x1fd106){return _0x107786(_0x3fa750,_0x1fd106);},'cuwnb':function(_0x5c9698,_0x30e2b8){return _0x5c9698===_0x30e2b8;},'PHKfg':function(_0x11f502,_0x3647f9){return _0x11f502(_0x3647f9);}},_0x565127=_0x4d4319['VRCMs'](buildSessionCheckUrl,_0x39221e,_0x42736e['sessionCheckPath']);if(!_0x565127)return!![];if(!_0x340402[_0x277d5b(0xb0)])return!![];let _0x29c20e=null;try{_0x29c20e=await _0x340402['launchBrowser']();const _0x2d5eb3=await _0x29c20e[_0x277d5b(0xb9)]({'storageState':_0x5d7a5d,'ignoreHTTPSErrors':!![],..._0x42736e[_0x277d5b(0xa7)]?{'extraHTTPHeaders':_0x42736e[_0x277d5b(0xa7)]}:{}}),_0x16eb02=await _0x2d5eb3['newPage'](),_0x168fca=await _0x16eb02[_0x277d5b(0x93)](_0x565127,{'waitUntil':'domcontentloaded','timeout':0x3a98}),_0x5d49ac=_0x168fca?.[_0x277d5b(0xad)]();if(_0x5d49ac===0x191||_0x4d4319[_0x277d5b(0xac)](_0x5d49ac,0x193))return![];const _0x542d5d=_0x16eb02['url']();if(_0x4d4319['PHKfg'](looksLikeLoginUrl,_0x542d5d))return![];return!![];}catch{return![];}finally{if(_0x29c20e)await _0x29c20e['close']()['catch'](()=>{});}}
1
+ (function(_0x2c9d22,_0x472230){const _0xff663f=_0x26be,_0x233c50=_0x2c9d22();while(!![]){try{const _0x1a5471=-parseInt(_0xff663f(0xda))/0x1+parseInt(_0xff663f(0xd9))/0x2+-parseInt(_0xff663f(0xc7))/0x3+parseInt(_0xff663f(0xce))/0x4*(-parseInt(_0xff663f(0xbe))/0x5)+-parseInt(_0xff663f(0xcb))/0x6*(-parseInt(_0xff663f(0xca))/0x7)+-parseInt(_0xff663f(0xc1))/0x8*(parseInt(_0xff663f(0xb8))/0x9)+parseInt(_0xff663f(0xc3))/0xa;if(_0x1a5471===_0x472230)break;else _0x233c50['push'](_0x233c50['shift']());}catch(_0x393d68){_0x233c50['push'](_0x233c50['shift']());}}}(_0x5ee8,0xc7862));import{createHash}from'crypto';function _0x5ee8(){const _0x1811b9=['port','has','url','baseUrl','tucAS','842452RzIsJQ','1268867PYtzLR','.storageState.json','close','pemvc','toString','effectiveBaseUrl','clientIp','DFtBZ','DkIgu','push','localhost','userAgent','newContext','AthSR','sha256','ywHTe','1818rINFrL','newPage','slice','.json','dzpep','ZGJPE','150ebRSyX','stdin','localhost.','16872YjmxgS','isTTY','17294780MjRBhq','hex','test','stdout','483558rzYsNE','defaultEnvironmentKey','launchBrowser','413XITNxu','92058rfGxTY','MSDia','setupHeaders','51016OhNGwp','pathname','status','boesI','127.0.0.1','add'];_0x5ee8=function(){return _0x1811b9;};return _0x5ee8();}import{join}from'path';function _0x26be(_0x541fe3,_0x3d1666){_0x541fe3=_0x541fe3-0xaf;const _0x5ee80c=_0x5ee8();let _0x26be8c=_0x5ee80c[_0x541fe3];return _0x26be8c;}import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x565e8a=process['env'],_0x4e41d5={'stdin':process['stdin'],'stdout':process['stdout']}){const _0x327446=_0x26be,_0x20d4c9={'AthSR':function(_0x169ed2,_0x4e382c){return _0x169ed2(_0x4e382c);}};if(_0x565e8a['CI'])return![];return _0x20d4c9[_0x327446(0xb5)](Boolean,_0x4e41d5[_0x327446(0xbf)][_0x327446(0xc2)])&&_0x20d4c9[_0x327446(0xb5)](Boolean,_0x4e41d5[_0x327446(0xc6)][_0x327446(0xc2)]);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x4e7820){const _0x9902d6=_0x26be,_0x54b889={'DkIgu':function(_0x4eee20,_0x140524){return _0x4eee20(_0x140524);},'pemvc':_0x9902d6(0xd7),'tPvUB':'port','yEKiW':'clientIp','DFtBZ':function(_0x4ed350,_0x51bf90){return _0x4ed350!==_0x51bf90;},'boesI':_0x9902d6(0xb6),'ywHTe':_0x9902d6(0xc4)},_0x4bdc5f=new Set(_0x4e7820['invalidateOn']??DEFAULT_INVALIDATE_ON);_0x4e7820[_0x9902d6(0xdf)]&&_0x54b889[_0x9902d6(0xb0)](needsTunnel,_0x4e7820['effectiveBaseUrl'])&&_0x4bdc5f['add']('baseUrl');const _0x397677={'orgId':_0x4e7820['orgId'],'profileName':_0x4e7820['profileName']};return _0x4bdc5f['has'](_0x54b889[_0x9902d6(0xdd)])&&(_0x397677[_0x9902d6(0xdf)]=_0x4e7820[_0x9902d6(0xdf)]),_0x4bdc5f['has'](_0x9902d6(0xcd))&&(_0x397677[_0x9902d6(0xcd)]=_0x4e7820['setupHeaders']?_0x54b889['DkIgu'](sortObjectKeys,_0x4e7820['setupHeaders']):_0x4e7820[_0x9902d6(0xcd)]),_0x4bdc5f[_0x9902d6(0xd5)](_0x54b889['tPvUB'])&&(_0x397677['port']=extractPort(_0x4e7820['effectiveBaseUrl'])),_0x4bdc5f['has']('userAgent')&&_0x4e7820['userAgent']!==undefined&&(_0x397677['userAgent']=_0x4e7820[_0x9902d6(0xb3)]),_0x4bdc5f['has'](_0x54b889['yEKiW'])&&_0x54b889[_0x9902d6(0xaf)](_0x4e7820[_0x9902d6(0xe0)],undefined)&&(_0x397677[_0x9902d6(0xe0)]=_0x4e7820[_0x9902d6(0xe0)]),_0x54b889['DkIgu'](createHash,_0x54b889[_0x9902d6(0xd1)])['update'](JSON['stringify'](_0x397677))['digest'](_0x54b889[_0x9902d6(0xb7)])[_0x9902d6(0xba)](0x0,0xc);}function extractPort(_0x5738eb){const _0x1d696f=_0x26be;try{return new URL(_0x5738eb)[_0x1d696f(0xd4)];}catch{return'';}}function sortObjectKeys(_0x1a448a){const _0x41c642={};for(const _0x439361 of Object['keys'](_0x1a448a)['sort']()){_0x41c642[_0x439361]=_0x1a448a[_0x439361];}return _0x41c642;}export function getSessionCachePath(_0x5ef14b,_0x41e895){const _0xa66f9=_0x26be,_0x8ecd6d={'ZGJPE':function(_0xb8c30e,_0x2d1a12,_0x4c4138,_0x3d0b60){return _0xb8c30e(_0x2d1a12,_0x4c4138,_0x3d0b60);},'FZSpi':'auth'};return _0x8ecd6d[_0xa66f9(0xbd)](join,getRangerHomeDir(),_0x8ecd6d['FZSpi'],_0x5ef14b+'-'+_0x41e895+_0xa66f9(0xbb));}export function getStorageStatePath(_0x398787){const _0x5330fb=_0x26be;return _0x398787['replace'](/\.json$/,_0x5330fb(0xdb));}export function needsTunnel(_0x412fc5){const _0x23520b=_0x26be,_0x260ecd={'muQXS':function(_0x1c5873,_0x10be69){return _0x1c5873===_0x10be69;},'hqcIu':_0x23520b(0xd2),'dzpep':'.localhost','qfZVb':_0x23520b(0xc0)};let _0xcec776;try{_0xcec776=new URL(_0x412fc5)['hostname'];}catch{return![];}if(_0x260ecd['muQXS'](_0xcec776,_0x23520b(0xb2))||_0xcec776===_0x260ecd['hqcIu'])return!![];if(_0xcec776['endsWith'](_0x260ecd[_0x23520b(0xbc)]))return!![];if(_0xcec776['includes'](_0x260ecd['qfZVb']))return!![];return![];}export function hostnameOf(_0x83f236){return new URL(_0x83f236)['hostname'];}export function duplicateCookiesForDomains(_0x53bf60,_0x40a439){const _0x5e5959=_0x26be,_0x49b424=[..._0x53bf60],_0x4efdd6=new Set(_0x53bf60['map'](_0x377a91=>_0x377a91['domain']));for(const _0x4dbf88 of _0x40a439){let _0x1642b1;try{_0x1642b1=hostnameOf(_0x4dbf88);}catch{continue;}if(!_0x1642b1)continue;const _0x4cb81e=_0x1642b1['startsWith']('.')?_0x1642b1:'.'+_0x1642b1;if(_0x4efdd6['has'](_0x1642b1)||_0x4efdd6[_0x5e5959(0xd5)](_0x4cb81e))continue;for(const _0x1d42c4 of _0x53bf60){_0x49b424[_0x5e5959(0xb1)]({..._0x1d42c4,'domain':_0x4cb81e});}_0x4efdd6[_0x5e5959(0xd3)](_0x4cb81e);}return _0x49b424;}export function resolveAuthEnvironmentLocally(_0x58c0a9,_0x39d138){const _0x247c43=_0x26be,_0x303ea1={'MSDia':function(_0x2b761d,_0xc15550){return _0x2b761d===_0xc15550;}},_0x17952d=_0x58c0a9['environments'];if(_0x39d138){const _0x5a030e=_0x17952d[_0x39d138];if(!_0x5a030e)return null;return{'key':_0x39d138,..._0x5a030e};}if(_0x58c0a9[_0x247c43(0xc8)]){const _0x296a10=_0x17952d[_0x58c0a9['defaultEnvironmentKey']];if(!_0x296a10)return null;return{'key':_0x58c0a9[_0x247c43(0xc8)],..._0x296a10};}const _0x11471b=Object['keys'](_0x17952d);if(_0x303ea1[_0x247c43(0xcc)](_0x11471b['length'],0x1)){const _0x3fee0d=_0x11471b[0x0];return{'key':_0x3fee0d,..._0x17952d[_0x3fee0d]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x43a1e5,_0xb81bb0){const _0x3f6094=_0x26be;try{if(_0xb81bb0)return new URL(_0xb81bb0,_0x43a1e5)[_0x3f6094(0xde)]();return new URL(_0x43a1e5)[_0x3f6094(0xde)]();}catch{return null;}}export function looksLikeLoginUrl(_0x7772e8){const _0x2ae1a8=_0x26be;try{const _0x13cee7=new URL(_0x7772e8);return LOGIN_URL_PATTERN[_0x2ae1a8(0xc5)](_0x13cee7[_0x2ae1a8(0xcf)]);}catch{return LOGIN_URL_PATTERN[_0x2ae1a8(0xc5)](_0x7772e8);}}export async function isCachedSessionLive(_0x298c0c,_0x3b9dfd,_0x3bf7e6={},_0x3b5630={}){const _0x1853fb=_0x26be,_0x533e50={'RRLsA':function(_0xc4294b,_0x3956e9,_0x5e292a){return _0xc4294b(_0x3956e9,_0x5e292a);},'NitfV':'domcontentloaded','tucAS':function(_0x5c787a,_0x5b69a3){return _0x5c787a===_0x5b69a3;}},_0x22767f=_0x533e50['RRLsA'](buildSessionCheckUrl,_0x3b9dfd,_0x3bf7e6['sessionCheckPath']);if(!_0x22767f)return!![];if(!_0x3b5630[_0x1853fb(0xc9)])return!![];let _0x4f6bd2=null;try{_0x4f6bd2=await _0x3b5630[_0x1853fb(0xc9)]();const _0x6bdd02=await _0x4f6bd2[_0x1853fb(0xb4)]({'storageState':_0x298c0c,'ignoreHTTPSErrors':!![],..._0x3bf7e6['setupHeaders']?{'extraHTTPHeaders':_0x3bf7e6['setupHeaders']}:{}}),_0x4a38b1=await _0x6bdd02[_0x1853fb(0xb9)](),_0x27e9ab=await _0x4a38b1['goto'](_0x22767f,{'waitUntil':_0x533e50['NitfV'],'timeout':0x3a98}),_0x232971=_0x27e9ab?.[_0x1853fb(0xd0)]();if(_0x232971===0x191||_0x533e50[_0x1853fb(0xd8)](_0x232971,0x193))return![];const _0x2ed27f=_0x4a38b1[_0x1853fb(0xd6)]();if(looksLikeLoginUrl(_0x2ed27f))return![];return!![];}catch{return![];}finally{if(_0x4f6bd2)await _0x4f6bd2[_0x1853fb(0xdc)]()['catch'](()=>{});}}
@@ -1 +1 @@
1
- function _0x113b(){const _0xcb7a53=['ESvyX','Vikpc','5128720MxXtoE','2234wscwMQ','update','10159425rYzPrb','utf8','PIiCv','3934560gMkzBT','573XklJqc','concat','15OQeaAy','3717483zCDSNe','txxUP','3148950ONWzeW','HdTEa','3902346GipOBe'];_0x113b=function(){return _0xcb7a53;};return _0x113b();}(function(_0x3ef39b,_0x284054){const _0x1aa028=_0x5073,_0x3d106e=_0x3ef39b();while(!![]){try{const _0x405d54=-parseInt(_0x1aa028(0x106))/0x1*(-parseInt(_0x1aa028(0x111))/0x2)+-parseInt(_0x1aa028(0x10d))/0x3+-parseInt(_0x1aa028(0x105))/0x4+-parseInt(_0x1aa028(0x108))/0x5*(-parseInt(_0x1aa028(0x10b))/0x6)+parseInt(_0x1aa028(0x109))/0x7+-parseInt(_0x1aa028(0x110))/0x8+parseInt(_0x1aa028(0x113))/0x9;if(_0x405d54===_0x284054)break;else _0x3d106e['push'](_0x3d106e['shift']());}catch(_0x42349e){_0x3d106e['push'](_0x3d106e['shift']());}}}(_0x113b,0xe7aa2));import{createCipheriv,createDecipheriv,randomBytes,pbkdf2Sync}from'crypto';const ALGORITHM='aes-256-gcm',SALT='ranger-auth-encryption',KEY_LENGTH=0x20,IV_LENGTH=0x10,TAG_LENGTH=0x10;export function deriveKey(_0x2e736a){const _0x1f75e0=_0x5073,_0x43e7db={'wGDtb':function(_0x3e9a71,_0x58737d,_0xa760f9,_0x2065a0,_0x3c1ad3,_0x1caba3){return _0x3e9a71(_0x58737d,_0xa760f9,_0x2065a0,_0x3c1ad3,_0x1caba3);},'PIiCv':'sha256'};return _0x43e7db['wGDtb'](pbkdf2Sync,_0x2e736a,SALT,0x186a0,KEY_LENGTH,_0x43e7db[_0x1f75e0(0x104)]);}export function encrypt(_0x48e2c9,_0x274711){const _0x59874a=_0x5073,_0x5d8380={'ESvyX':_0x59874a(0x103)},_0x46221e=deriveKey(_0x274711),_0x28cc86=randomBytes(IV_LENGTH),_0x346628=createCipheriv(ALGORITHM,_0x46221e,_0x28cc86),_0x32bfa3=Buffer['concat']([_0x346628[_0x59874a(0x112)](_0x48e2c9,_0x5d8380[_0x59874a(0x10e)]),_0x346628['final']()]),_0xfb313b=_0x346628['getAuthTag']();return Buffer[_0x59874a(0x107)]([_0x28cc86,_0xfb313b,_0x32bfa3]);}function _0x5073(_0x27c9db,_0x481d1f){_0x27c9db=_0x27c9db-0x103;const _0x113b79=_0x113b();let _0x5073e3=_0x113b79[_0x27c9db];return _0x5073e3;}export function decrypt(_0x17705f,_0x11e21b){const _0x4aa734=_0x5073,_0x1829c1={'txxUP':function(_0x27defd,_0x1c6051){return _0x27defd+_0x1c6051;},'DaCdy':function(_0x14c2f7,_0x40fcf6,_0x1695f3,_0x1abbee){return _0x14c2f7(_0x40fcf6,_0x1695f3,_0x1abbee);},'HdTEa':function(_0x206e51,_0xcd89ec){return _0x206e51+_0xcd89ec;},'Vikpc':_0x4aa734(0x103)},_0x5efb54=deriveKey(_0x11e21b),_0x4db737=_0x17705f['subarray'](0x0,IV_LENGTH),_0x12fa8f=_0x17705f['subarray'](IV_LENGTH,IV_LENGTH+TAG_LENGTH),_0x3e2df1=_0x17705f['subarray'](_0x1829c1[_0x4aa734(0x10a)](IV_LENGTH,TAG_LENGTH)),_0x5dd0a7=_0x1829c1['DaCdy'](createDecipheriv,ALGORITHM,_0x5efb54,_0x4db737);return _0x5dd0a7['setAuthTag'](_0x12fa8f),_0x1829c1[_0x4aa734(0x10c)](_0x5dd0a7['update'](_0x3e2df1),_0x5dd0a7['final'](_0x1829c1[_0x4aa734(0x10f)]));}
1
+ function _0xe663(_0x5aecfc,_0x517a5f){_0x5aecfc=_0x5aecfc-0x79;const _0x191ea0=_0x191e();let _0xe663cd=_0x191ea0[_0x5aecfc];return _0xe663cd;}(function(_0x367609,_0x1f96c6){const _0xf955c8=_0xe663,_0x49af5f=_0x367609();while(!![]){try{const _0x46961f=-parseInt(_0xf955c8(0x7a))/0x1+parseInt(_0xf955c8(0x7b))/0x2*(-parseInt(_0xf955c8(0x7c))/0x3)+parseInt(_0xf955c8(0x86))/0x4+-parseInt(_0xf955c8(0x79))/0x5*(-parseInt(_0xf955c8(0x84))/0x6)+parseInt(_0xf955c8(0x83))/0x7+-parseInt(_0xf955c8(0x81))/0x8*(parseInt(_0xf955c8(0x82))/0x9)+-parseInt(_0xf955c8(0x87))/0xa;if(_0x46961f===_0x1f96c6)break;else _0x49af5f['push'](_0x49af5f['shift']());}catch(_0x3c1d00){_0x49af5f['push'](_0x49af5f['shift']());}}}(_0x191e,0x3f21e));import{createCipheriv,createDecipheriv,randomBytes,pbkdf2Sync}from'crypto';const ALGORITHM='aes-256-gcm',SALT='ranger-auth-encryption',KEY_LENGTH=0x20,IV_LENGTH=0x10,TAG_LENGTH=0x10;export function deriveKey(_0x3bb293){const _0x168d7e={'rdBPx':function(_0x4d334c,_0x4baa30,_0x54c622,_0x3baa54,_0x196c4c,_0x16f0ac){return _0x4d334c(_0x4baa30,_0x54c622,_0x3baa54,_0x196c4c,_0x16f0ac);}};return _0x168d7e['rdBPx'](pbkdf2Sync,_0x3bb293,SALT,0x186a0,KEY_LENGTH,'sha256');}export function encrypt(_0x2fe8ee,_0x4fd2e2){const _0x318010=_0xe663,_0x36801b={'lEyPd':function(_0x38a3ee,_0x48ea43){return _0x38a3ee(_0x48ea43);},'QBYDS':'utf8'},_0x3284f6=_0x36801b['lEyPd'](deriveKey,_0x4fd2e2),_0x4a4edd=randomBytes(IV_LENGTH),_0x23bc0a=createCipheriv(ALGORITHM,_0x3284f6,_0x4a4edd),_0x465bcf=Buffer['concat']([_0x23bc0a['update'](_0x2fe8ee,_0x36801b[_0x318010(0x85)]),_0x23bc0a[_0x318010(0x80)]()]),_0xea45b9=_0x23bc0a['getAuthTag']();return Buffer['concat']([_0x4a4edd,_0xea45b9,_0x465bcf]);}function _0x191e(){const _0x477fb1=['3175536FxtjiS','10734bIfiEZ','QBYDS','1501504qbTiLL','2857830TFnDuB','175QvuYwr','38530AkVymO','1066mUcblH','1563ATLNrq','hJxDh','subarray','utf8','final','248344xLFgdX','9nNwQBc'];_0x191e=function(){return _0x477fb1;};return _0x191e();}export function decrypt(_0x123ab1,_0x2ba913){const _0x3d3e56=_0xe663,_0x4f9e2d={'KwPZG':function(_0x40052f,_0x55abe3){return _0x40052f(_0x55abe3);},'TTdBK':function(_0x2810d7,_0x4baa9d){return _0x2810d7+_0x4baa9d;},'hJxDh':function(_0x1fda3a,_0x7ecbd5,_0x46778c,_0x116052){return _0x1fda3a(_0x7ecbd5,_0x46778c,_0x116052);}},_0x5cfb32=_0x4f9e2d['KwPZG'](deriveKey,_0x2ba913),_0x30343d=_0x123ab1['subarray'](0x0,IV_LENGTH),_0x2234c0=_0x123ab1[_0x3d3e56(0x7e)](IV_LENGTH,_0x4f9e2d['TTdBK'](IV_LENGTH,TAG_LENGTH)),_0x2eda44=_0x123ab1['subarray'](IV_LENGTH+TAG_LENGTH),_0x44b176=_0x4f9e2d[_0x3d3e56(0x7d)](createDecipheriv,ALGORITHM,_0x5cfb32,_0x30343d);return _0x44b176['setAuthTag'](_0x2234c0),_0x44b176['update'](_0x2eda44)+_0x44b176[_0x3d3e56(0x80)](_0x3d3e56(0x7f));}
@@ -1 +1 @@
1
- function _0x3600(){const _0x6e4462=['--api-key','617798bVxhfU','--key','slice','startsWith','Authorization','=[REDACTED]','100NJIxhZ','Not\x20enough\x20non-option\x20arguments','3254872EjoKAi','--apikey','length','includes','--pass','toLowerCase','--credentials','--secret','Unknown\x20argument','env','no_token','--cookie','947295qocPcQ','has','some','6387821LQQPTf','198neXdGB','[desire-path]\x20Sending\x20log\x20to\x20','220445XyUWCo','catch','--token','errorType','2374395jgvoTo','stringify','rqBcW','push','join','UjwzD','--authorization','coGSR','5rzSXFl','--password','error','YVglO','2152oxqgAA','rawCommand','[REDACTED]','ggHdO','indexOf','/api/v1/mcp/desire-path-logs','41111QKpsjY','Bearer\x20','test','aSjfM','dsDHT','DEBUG','invalid_option_value'];_0x3600=function(){return _0x6e4462;};return _0x3600();}const _0x1f2469=_0x4f5f;(function(_0x1082f9,_0x53e2ac){const _0x1226c9=_0x4f5f,_0x144e28=_0x1082f9();while(!![]){try{const _0x525b93=-parseInt(_0x1226c9(0xbe))/0x1*(-parseInt(_0x1226c9(0xd0))/0x2)+parseInt(_0x1226c9(0xb6))/0x3+-parseInt(_0x1226c9(0xa0))/0x4+-parseInt(_0x1226c9(0xb2))/0x5*(-parseInt(_0x1226c9(0xb0))/0x6)+-parseInt(_0x1226c9(0xc8))/0x7*(parseInt(_0x1226c9(0xc2))/0x8)+-parseInt(_0x1226c9(0xac))/0x9*(parseInt(_0x1226c9(0x9e))/0xa)+parseInt(_0x1226c9(0xaf))/0xb;if(_0x525b93===_0x53e2ac)break;else _0x144e28['push'](_0x144e28['shift']());}catch(_0x4a83c0){_0x144e28['push'](_0x144e28['shift']());}}}(_0x3600,0xe1f3f));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{getCurrentVersion}from'./version.js';function _0x4f5f(_0x3bc33c,_0xe14d6e){_0x3bc33c=_0x3bc33c-0x9e;const _0x360052=_0x3600();let _0x4f5fd1=_0x360052[_0x3bc33c];return _0x4f5fd1;}const SENSITIVE_FLAGS=new Set([_0x1f2469(0xb4),'-t',_0x1f2469(0xa7),_0x1f2469(0xcf),_0x1f2469(0xa1),_0x1f2469(0xd1),_0x1f2469(0xbf),_0x1f2469(0xa4),'--auth',_0x1f2469(0xbc),'--header',_0x1f2469(0xab),_0x1f2469(0xa6)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function looksLikeToken(_0x4afa40){const _0x123bfb=_0x1f2469;return TOKEN_PATTERNS[_0x123bfb(0xae)](_0x5a7d61=>_0x5a7d61[_0x123bfb(0xca)](_0x4afa40));}export function sanitizeArgs(_0x545641){const _0x362d3d=_0x1f2469,_0x3ed0d3={'UjwzD':_0x362d3d(0xc4),'YDYth':function(_0x550c43,_0x5acb63){return _0x550c43!==_0x5acb63;},'dsDHT':function(_0x556052,_0x354919){return _0x556052(_0x354919);}},_0x1453ec=[];let _0x5744dd=![];for(let _0x2b4ca7=0x0;_0x2b4ca7<_0x545641[_0x362d3d(0xa2)];_0x2b4ca7++){const _0xe72429=_0x545641[_0x2b4ca7];if(_0x5744dd){_0x1453ec['push'](_0x3ed0d3[_0x362d3d(0xbb)]),_0x5744dd=![];continue;}if(_0xe72429[_0x362d3d(0xd3)]('--')||_0xe72429[_0x362d3d(0xd3)]('-')){const _0x38eb8a=_0xe72429[_0x362d3d(0xc6)]('=');if(_0x3ed0d3['YDYth'](_0x38eb8a,-0x1)){const _0x279238=_0xe72429[_0x362d3d(0xd2)](0x0,_0x38eb8a)[_0x362d3d(0xa5)]();if(SENSITIVE_FLAGS[_0x362d3d(0xad)](_0x279238)){_0x1453ec['push'](_0xe72429['slice'](0x0,_0x38eb8a)+_0x362d3d(0xd5));continue;}}else{const _0xbe056a=_0xe72429[_0x362d3d(0xa5)]();SENSITIVE_FLAGS[_0x362d3d(0xad)](_0xbe056a)&&(_0x5744dd=!![]);}_0x1453ec['push'](_0xe72429);}else _0x3ed0d3[_0x362d3d(0xcc)](looksLikeToken,_0xe72429)?_0x1453ec['push'](_0x362d3d(0xc4)):_0x1453ec[_0x362d3d(0xb9)](_0xe72429);}return _0x1453ec[_0x362d3d(0xba)]('\x20');}export async function logDesirePath(_0x5e182d){const _0x5cb073=_0x1f2469,_0x1cbde6={'rqBcW':function(_0x104edb){return _0x104edb();},'ormuI':function(_0x175730){return _0x175730();},'ggHdO':'application/json','coGSR':function(_0x458c86,_0x4f800b,_0x3f9fcd){return _0x458c86(_0x4f800b,_0x3f9fcd);}};try{const _0x226b19=await _0x1cbde6[_0x5cb073(0xb8)](getToken)[_0x5cb073(0xb3)](()=>null),_0xe79070=_0x1cbde6['ormuI'](getApiBaseUrl),_0x3aa833=_0x1cbde6['rqBcW'](getCurrentVersion),_0x19758b=_0x226b19?'has_token':_0x5cb073(0xaa),_0xc796db={..._0x5e182d['metadata'],'authStatus':_0x19758b,'isTty':process['stdout']['isTTY']??![]},_0x230922={'Content-Type':_0x1cbde6[_0x5cb073(0xc5)]};_0x226b19&&(_0x230922[_0x5cb073(0xd4)]=_0x5cb073(0xc9)+_0x226b19);const _0x5d10c2={'rawCommand':_0x5e182d[_0x5cb073(0xc3)],'errorMessage':_0x5e182d['errorMessage'],'errorType':_0x5e182d[_0x5cb073(0xb5)],'featureId':_0x5e182d['featureId'],'sessionId':_0x5e182d['sessionId'],'metadata':_0xc796db,'cliVersion':_0x3aa833};process[_0x5cb073(0xa9)][_0x5cb073(0xcd)]&&(console[_0x5cb073(0xc0)](_0x5cb073(0xb1)+_0xe79070+_0x5cb073(0xc7)),console['error']('[desire-path]\x20Payload:\x20'+JSON[_0x5cb073(0xb7)](_0x5d10c2,null,0x2))),await _0x1cbde6[_0x5cb073(0xbd)](fetch,_0xe79070+'/api/v1/mcp/desire-path-logs',{'method':'POST','headers':_0x230922,'body':JSON[_0x5cb073(0xb7)](_0x5d10c2)});}catch(_0xb90d8b){process['env'][_0x5cb073(0xcd)]&&console['error']('[desire-path]\x20Failed\x20to\x20send:\x20'+_0xb90d8b);}}export function getErrorType(_0x355041,_0xf632ae){const _0x227cb8=_0x1f2469,_0x343c42={'aSjfM':'unknown','DJmKm':'Unknown\x20command','JTXod':'unknown_argument','YVglO':'missing_option','GlytW':'syntax_error'};if(_0xf632ae)return'runtime_error';if(!_0x355041)return _0x343c42[_0x227cb8(0xcb)];if(_0x355041[_0x227cb8(0xa3)](_0x343c42['DJmKm']))return'unknown_command';if(_0x355041['includes'](_0x227cb8(0xa8)))return _0x343c42['JTXod'];if(_0x355041['includes'](_0x227cb8(0x9f)))return'missing_required_argument';if(_0x355041['includes']('Invalid\x20values'))return _0x227cb8(0xce);if(_0x355041['includes']('Missing\x20required\x20argument'))return _0x343c42[_0x227cb8(0xc1)];return _0x343c42['GlytW'];}
1
+ const _0x52ec34=_0x3d69;(function(_0x24398d,_0x48c13b){const _0x121399=_0x3d69,_0x3d353e=_0x24398d();while(!![]){try{const _0x4e34f5=parseInt(_0x121399(0x127))/0x1+-parseInt(_0x121399(0x131))/0x2+parseInt(_0x121399(0x151))/0x3*(parseInt(_0x121399(0x123))/0x4)+-parseInt(_0x121399(0x133))/0x5+parseInt(_0x121399(0x14b))/0x6*(-parseInt(_0x121399(0x136))/0x7)+-parseInt(_0x121399(0x13e))/0x8*(-parseInt(_0x121399(0x130))/0x9)+parseInt(_0x121399(0x12a))/0xa;if(_0x4e34f5===_0x48c13b)break;else _0x3d353e['push'](_0x3d353e['shift']());}catch(_0x4342bf){_0x3d353e['push'](_0x3d353e['shift']());}}}(_0x196c,0xaa5e4));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{getCurrentVersion}from'./version.js';function _0x3d69(_0xddaa53,_0x286db7){_0xddaa53=_0xddaa53-0x11e;const _0x196cfd=_0x196c();let _0x3d690b=_0x196cfd[_0xddaa53];return _0x3d690b;}const SENSITIVE_FLAGS=new Set([_0x52ec34(0x146),'-t',_0x52ec34(0x12f),'--api-key','--apikey',_0x52ec34(0x132),_0x52ec34(0x126),_0x52ec34(0x134),'--auth',_0x52ec34(0x11f),_0x52ec34(0x128),_0x52ec34(0x120),_0x52ec34(0x145)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function looksLikeToken(_0x5b0846){return TOKEN_PATTERNS['some'](_0xa86b37=>_0xa86b37['test'](_0x5b0846));}export function sanitizeArgs(_0xe79a7e){const _0x26b8ad=_0x52ec34,_0x4a26cf={'lnoXu':function(_0x872bae,_0x54f341){return _0x872bae<_0x54f341;},'sBsYX':_0x26b8ad(0x14a),'AmlYa':function(_0x3708d1,_0x1fe86f){return _0x3708d1!==_0x1fe86f;},'wPFHJ':function(_0x1b1500,_0x3122ee){return _0x1b1500(_0x3122ee);}},_0x8ea53e=[];let _0x25c973=![];for(let _0x2545ac=0x0;_0x4a26cf['lnoXu'](_0x2545ac,_0xe79a7e['length']);_0x2545ac++){const _0x220273=_0xe79a7e[_0x2545ac];if(_0x25c973){_0x8ea53e['push'](_0x4a26cf[_0x26b8ad(0x129)]),_0x25c973=![];continue;}if(_0x220273['startsWith']('--')||_0x220273['startsWith']('-')){const _0x2d06a4=_0x220273[_0x26b8ad(0x150)]('=');if(_0x4a26cf['AmlYa'](_0x2d06a4,-0x1)){const _0x1b5cf8=_0x220273['slice'](0x0,_0x2d06a4)['toLowerCase']();if(SENSITIVE_FLAGS['has'](_0x1b5cf8)){_0x8ea53e['push'](_0x220273[_0x26b8ad(0x122)](0x0,_0x2d06a4)+_0x26b8ad(0x124));continue;}}else{const _0x2dc3b8=_0x220273['toLowerCase']();SENSITIVE_FLAGS['has'](_0x2dc3b8)&&(_0x25c973=!![]);}_0x8ea53e['push'](_0x220273);}else _0x4a26cf['wPFHJ'](looksLikeToken,_0x220273)?_0x8ea53e[_0x26b8ad(0x11e)](_0x4a26cf[_0x26b8ad(0x129)]):_0x8ea53e[_0x26b8ad(0x11e)](_0x220273);}return _0x8ea53e['join']('\x20');}export async function logDesirePath(_0x1feb89){const _0xb59f4d=_0x52ec34,_0x5dff2f={'qfdDG':function(_0x2325fa){return _0x2325fa();},'YwBLx':'application/json','vFZFY':_0xb59f4d(0x121)};try{const _0x2b35ab=await getToken()[_0xb59f4d(0x139)](()=>null),_0x49ad52=_0x5dff2f[_0xb59f4d(0x13b)](getApiBaseUrl),_0x2a6470=_0x5dff2f['qfdDG'](getCurrentVersion),_0x96c81f=_0x2b35ab?_0xb59f4d(0x147):'no_token',_0x494fa6={..._0x1feb89[_0xb59f4d(0x142)],'authStatus':_0x96c81f,'isTty':process['stdout']['isTTY']??![]},_0x21c080={'Content-Type':_0x5dff2f[_0xb59f4d(0x13a)]};_0x2b35ab&&(_0x21c080['Authorization']='Bearer\x20'+_0x2b35ab);const _0x215b75={'rawCommand':_0x1feb89[_0xb59f4d(0x12c)],'errorMessage':_0x1feb89['errorMessage'],'errorType':_0x1feb89['errorType'],'featureId':_0x1feb89[_0xb59f4d(0x140)],'sessionId':_0x1feb89['sessionId'],'metadata':_0x494fa6,'cliVersion':_0x2a6470};process[_0xb59f4d(0x13c)]['DEBUG']&&(console[_0xb59f4d(0x135)](_0xb59f4d(0x12e)+_0x49ad52+'/api/v1/mcp/desire-path-logs'),console['error'](_0xb59f4d(0x125)+JSON[_0xb59f4d(0x138)](_0x215b75,null,0x2))),await fetch(_0x49ad52+'/api/v1/mcp/desire-path-logs',{'method':_0x5dff2f['vFZFY'],'headers':_0x21c080,'body':JSON[_0xb59f4d(0x138)](_0x215b75)});}catch(_0x54935e){process[_0xb59f4d(0x13c)][_0xb59f4d(0x148)]&&console['error']('[desire-path]\x20Failed\x20to\x20send:\x20'+_0x54935e);}}function _0x196c(){const _0x25ab9c=['metadata','nWhhG','unknown_argument','--credentials','--token','has_token','DEBUG','epzAD','[REDACTED]','684642mMenzR','Not\x20enough\x20non-option\x20arguments','missing_required_argument','split','includes','indexOf','3645ETvMPv','push','--authorization','--cookie','POST','slice','4428HMqZjQ','=[REDACTED]','[desire-path]\x20Payload:\x20','--password','1159979IspmEw','--header','sBsYX','9159320MSASHh','goKrG','rawCommand','Missing\x20required\x20argument','[desire-path]\x20Sending\x20log\x20to\x20','--secret','27nLsUsY','2051092LJzTwY','--key','2996515lBjcjs','--pass','error','70nKjSkO','HTRLo','stringify','catch','YwBLx','qfdDG','env','XKZwd','114216hkSLcB','ZedXh','featureId','Unknown\x20argument'];_0x196c=function(){return _0x25ab9c;};return _0x196c();}export function getErrorType(_0x56c24d,_0x395dfb){const _0x44621f=_0x52ec34,_0x488117={'ZedXh':'0|5|4|3|6|2|7|1','goKrG':'Unknown\x20command','nWhhG':'unknown_command','XKZwd':'unknown','HTRLo':_0x44621f(0x14d),'epzAD':_0x44621f(0x12d)},_0x557a49=_0x488117[_0x44621f(0x13f)][_0x44621f(0x14e)]('|');let _0x316227=0x0;while(!![]){switch(_0x557a49[_0x316227++]){case'0':if(_0x395dfb)return'runtime_error';continue;case'1':return'syntax_error';case'2':if(_0x56c24d['includes']('Invalid\x20values'))return'invalid_option_value';continue;case'3':if(_0x56c24d['includes'](_0x44621f(0x141)))return _0x44621f(0x144);continue;case'4':if(_0x56c24d[_0x44621f(0x14f)](_0x488117[_0x44621f(0x12b)]))return _0x488117[_0x44621f(0x143)];continue;case'5':if(!_0x56c24d)return _0x488117[_0x44621f(0x13d)];continue;case'6':if(_0x56c24d['includes'](_0x44621f(0x14c)))return _0x488117[_0x44621f(0x137)];continue;case'7':if(_0x56c24d['includes'](_0x488117[_0x44621f(0x149)]))return'missing_option';continue;}break;}}
@@ -1 +1 @@
1
- const _0x521274=_0x32de;(function(_0x332042,_0x29e178){const _0x217d1f=_0x32de,_0x3c51a2=_0x332042();while(!![]){try{const _0x177deb=parseInt(_0x217d1f(0x10f))/0x1*(parseInt(_0x217d1f(0x12d))/0x2)+parseInt(_0x217d1f(0x153))/0x3+parseInt(_0x217d1f(0x123))/0x4*(-parseInt(_0x217d1f(0x154))/0x5)+-parseInt(_0x217d1f(0x134))/0x6*(parseInt(_0x217d1f(0x14a))/0x7)+-parseInt(_0x217d1f(0x117))/0x8+parseInt(_0x217d1f(0x125))/0x9*(parseInt(_0x217d1f(0x143))/0xa)+-parseInt(_0x217d1f(0x110))/0xb*(parseInt(_0x217d1f(0x132))/0xc);if(_0x177deb===_0x29e178)break;else _0x3c51a2['push'](_0x3c51a2['shift']());}catch(_0x21c05d){_0x3c51a2['push'](_0x3c51a2['shift']());}}}(_0xa06f,0x6c712));import{spawn}from'child_process';import _0x438c56 from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';function _0xa06f(){const _0xfa0c4b=['1918080KiIgcz','202880CPJGDN','https://api.workos.com/user_management/authenticate','text','utf-8','POST','urn:ietf:params:oauth:grant-type:device_code','win32','now','Failed\x20to\x20request\x20device\x20code:\x20','stdout','selected','ensGk','fQPMf','Device\x20authorization\x20timed\x20out','verification_uri_complete','Waiting\x20for\x20authentication...','69XZfESA','7172duALLq','gZWVC','icFni','hwICf','/cli-auth/token','token','json','3458632EPUavM','filter','isTTY','split','write','lOshv','Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','org_id','mcp:write','/organization/my-memberships','bYFxb','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','36MbsfUA','https://api.workos.com/user_management/authorize/device','25929OgheUK','length','GET','access_token','Failed\x20to\x20fetch\x20memberships:\x20','/organization/me','log','Authentication\x20failed','14846skKsml','wNoSb','Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','kbsWZ','firstName','2904shDMWx','application/x-www-form-urlencoded','2022MkhPFV','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','ignore','FiXYs','rsRdI','organizationId','xdg-open','name','/api-keys','from','wEvHg','error','tpAeT','tCtSm','refresh_token','2490THFGkr','Provisioning\x20CLI\x20token...','status','IOSgC','Invalid\x20JWT\x20format','workosClientId','xpxEN','9751qBGAiQ','ZGzwL','memberships','application/json','parse','Xfrkh','Code:\x20','slow_down','HaaYj'];_0xa06f=function(){return _0xfa0c4b;};return _0xa06f();}const WORKOS_DEVICE_AUTH_URL=_0x521274(0x124),WORKOS_TOKEN_URL=_0x521274(0x155);export async function requestDeviceCode(_0x1991da){const _0x44ddfe=_0x521274,_0x1cbe85={'ensGk':function(_0x4f5cbf,_0x3b75be,_0x148ec2){return _0x4f5cbf(_0x3b75be,_0x148ec2);}},_0x340859=await _0x1cbe85[_0x44ddfe(0x10a)](fetch,WORKOS_DEVICE_AUTH_URL,{'method':_0x44ddfe(0x103),'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x1991da})});if(!_0x340859['ok']){const _0x49e73b=await _0x340859['text']();throw new Error(_0x44ddfe(0x107)+_0x340859['status']+'\x20'+_0x49e73b);}return _0x340859[_0x44ddfe(0x116)]();}export async function pollForTokens(_0x51a34a,_0x5e0fae,_0x286f7b,_0x3f3110){const _0x13e889=_0x521274,_0x3d7418={'DGtAk':function(_0xa39d97,_0x1d372f){return _0xa39d97+_0x1d372f;},'fQPMf':function(_0x4da554,_0xf2cb4c){return _0x4da554*_0xf2cb4c;},'FiXYs':function(_0x3df23b,_0x26bf8b){return _0x3df23b*_0x26bf8b;},'arXVg':function(_0x3caac5,_0x99d558){return _0x3caac5<_0x99d558;},'kbsWZ':function(_0x10bd59,_0x443abf){return _0x10bd59(_0x443abf);},'hwICf':function(_0x581c29,_0x1a262f,_0x301eb1){return _0x581c29(_0x1a262f,_0x301eb1);},'hOvAe':'authorization_pending','BsEaH':_0x13e889(0x12c),'xpxEN':_0x13e889(0x10c)},_0x58b367=_0x3d7418['DGtAk'](Date['now'](),_0x3d7418[_0x13e889(0x10b)](_0x3f3110,0x3e8));let _0x43504f=_0x3d7418[_0x13e889(0x137)](_0x286f7b,0x3e8);while(_0x3d7418['arXVg'](Date[_0x13e889(0x106)](),_0x58b367)){await _0x3d7418[_0x13e889(0x130)](sleep,_0x43504f);const _0x4a5be5=await _0x3d7418[_0x13e889(0x113)](fetch,WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x51a34a,'device_code':_0x5e0fae,'grant_type':_0x13e889(0x104)})});if(_0x4a5be5['ok'])return _0x4a5be5[_0x13e889(0x116)]();const _0x4c33f1=await _0x4a5be5[_0x13e889(0x116)]();if(_0x4c33f1['error']===_0x3d7418['hOvAe'])continue;if(_0x4c33f1[_0x13e889(0x13f)]===_0x13e889(0x151)){_0x43504f+=0x3e8;continue;}throw new Error(_0x4c33f1['error_description']||_0x4c33f1[_0x13e889(0x13f)]||_0x3d7418['BsEaH']);}throw new Error(_0x3d7418[_0x13e889(0x149)]);}async function fetchUserProfile(_0xc8c8b6){const _0x55f439=_0x521274,_0xe09eaf={'bmnaq':_0x55f439(0x127)},_0x4ac5fa=getApiBaseUrl();try{const _0x43b48c=await fetch(_0x4ac5fa+_0x55f439(0x12a),{'method':_0xe09eaf['bmnaq'],'headers':{'workos-token':_0xc8c8b6}});if(_0x43b48c['ok'])return _0x43b48c['json']();}catch{}return null;}function buildKeyName(_0x2ce6cd,_0x4a0a44){const _0x142710=_0x521274,_0x2a8d96={'rZFTY':function(_0x6d7cdd,_0x3c7d0a){return _0x6d7cdd===_0x3c7d0a;}},_0xab7722=_0x4a0a44[_0x142710(0x118)](_0x48e181=>_0x48e181[_0x142710(0x13b)]===_0x2ce6cd||_0x48e181[_0x142710(0x13b)]['startsWith'](_0x2ce6cd+'\x20('));if(_0x2a8d96['rZFTY'](_0xab7722['length'],0x0))return _0x2ce6cd;return _0x2ce6cd+'\x20('+(_0xab7722['length']+0x1)+')';}export async function provisionApiKey(_0x2bf262){const _0xe8bf9=_0x521274,_0x4a710b={'pXNKN':function(_0x3f739b){return _0x3f739b();},'pdciR':function(_0x5702a3,_0x3d00f7,_0xdc7338){return _0x5702a3(_0x3d00f7,_0xdc7338);},'Xfrkh':_0xe8bf9(0x127)},_0x19d348=_0x4a710b['pXNKN'](getApiBaseUrl),_0x5cc869={'Content-Type':'application/json','workos-token':_0x2bf262},_0x37fe6b=await fetchUserProfile(_0x2bf262),_0x3f4baf=_0x37fe6b?.[_0xe8bf9(0x131)]||_0x37fe6b?.['email']?.[_0xe8bf9(0x11a)]('@')[0x0],_0x52887d=_0x3f4baf?_0x3f4baf+'\x27s\x20CLI\x20Key':'CLI\x20Key';let _0x71ce8f=[];try{const _0x873b34=await _0x4a710b['pdciR'](fetch,_0x19d348+'/api-keys',{'method':_0x4a710b[_0xe8bf9(0x14f)],'headers':_0x5cc869});if(_0x873b34['ok']){const _0x239c19=await _0x873b34[_0xe8bf9(0x116)]();_0x71ce8f=_0x239c19['apiKeys'];}}catch{}const _0x59221d=buildKeyName(_0x52887d,_0x71ce8f),_0x33f2be=await fetch(_0x19d348+_0xe8bf9(0x13c),{'method':'POST','headers':_0x5cc869,'body':JSON['stringify']({'name':_0x59221d,'scope':_0xe8bf9(0x11f)})});if(!_0x33f2be['ok']){const _0x429cce=await _0x33f2be[_0xe8bf9(0x101)]();throw new Error('Failed\x20to\x20provision\x20API\x20key:\x20'+_0x33f2be['status']+'\x20'+_0x429cce);}const _0x2f86dd=await _0x33f2be[_0xe8bf9(0x116)]();return _0x2f86dd['apiKey']['token'];}export function openBrowser(_0x53d4ab){const _0xe54aa6=_0x521274,_0xc324ef={'HaaYj':function(_0x3d6810,_0x2c29c5){return _0x3d6810===_0x2c29c5;},'tpAeT':'start','gZWVC':'ignore','wEvHg':'open'};try{if(_0xc324ef[_0xe54aa6(0x152)](process['platform'],_0xe54aa6(0x105))){const _0x82e0c2=spawn('cmd',['/c',_0xc324ef[_0xe54aa6(0x140)],'',_0x53d4ab],{'detached':!![],'stdio':_0xc324ef[_0xe54aa6(0x111)],'windowsHide':!![]});_0x82e0c2['unref']();return;}const _0x42be23=process['platform']==='darwin'?_0xc324ef[_0xe54aa6(0x13e)]:_0xe54aa6(0x13a),_0x2756da=spawn(_0x42be23,[_0x53d4ab],{'detached':!![],'stdio':_0xe54aa6(0x136)});_0x2756da['unref']();}catch{}}function decodeJwtPayload(_0x5b8701){const _0x5eea45=_0x521274,_0xadccb8={'tCtSm':_0x5eea45(0x147),'lwcHY':'base64url'},_0x5988b5=_0x5b8701['split']('.');if(_0x5988b5[_0x5eea45(0x126)]!==0x3)throw new Error(_0xadccb8[_0x5eea45(0x141)]);const _0x48739e=Buffer[_0x5eea45(0x13d)](_0x5988b5[0x1],_0xadccb8['lwcHY'])['toString'](_0x5eea45(0x102));return JSON[_0x5eea45(0x14e)](_0x48739e);}async function selfServeSignup(_0x309cc1){const _0x40ebfb=_0x521274,_0x2571c2={'wNoSb':function(_0x270d60,_0x356b8f,_0xfb2e84){return _0x270d60(_0x356b8f,_0xfb2e84);},'IOSgC':'POST','icFni':_0x40ebfb(0x14d)},_0x57e46e=getApiBaseUrl(),_0x421aae=await _0x2571c2[_0x40ebfb(0x12e)](fetch,_0x57e46e+'/organization/self-serve-signup',{'method':_0x2571c2[_0x40ebfb(0x146)],'headers':{'Content-Type':_0x2571c2[_0x40ebfb(0x112)],'workos-token':_0x309cc1}});if(!_0x421aae['ok']){const _0x19c44c=await _0x421aae['text']();throw new Error('Failed\x20to\x20create\x20organization:\x20'+_0x421aae[_0x40ebfb(0x145)]+'\x20'+_0x19c44c);}return _0x421aae['json']();}async function fetchMyMemberships(_0x2a66bb){const _0x21f010=_0x521274,_0x12a131={'QZznD':function(_0x41aa85,_0x41e19c,_0x4fa674){return _0x41aa85(_0x41e19c,_0x4fa674);}},_0x26e5e1=getApiBaseUrl(),_0x58edd8=await _0x12a131['QZznD'](fetch,_0x26e5e1+_0x21f010(0x120),{'method':'GET','headers':{'workos-token':_0x2a66bb}});if(!_0x58edd8['ok']){const _0x46cecd=await _0x58edd8[_0x21f010(0x101)]();throw new Error(_0x21f010(0x129)+_0x58edd8[_0x21f010(0x145)]+'\x20'+_0x46cecd);}const _0x101431=await _0x58edd8[_0x21f010(0x116)]();return _0x101431[_0x21f010(0x14c)];}async function refreshTokenWithOrg(_0x3ccba4,_0x34ec6e,_0x5c8f79){const _0x152e91=_0x521274,_0x211b63={'rTuFz':function(_0x55d6bf,_0x3cfaeb,_0x4b4af9){return _0x55d6bf(_0x3cfaeb,_0x4b4af9);},'iPorE':_0x152e91(0x133),'hplpC':'refresh_token'},_0x22a93e=await _0x211b63['rTuFz'](fetch,WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x211b63['iPorE']},'body':new URLSearchParams({'client_id':_0x3ccba4,'grant_type':_0x211b63['hplpC'],'refresh_token':_0x34ec6e,'organization_id':_0x5c8f79})});if(!_0x22a93e['ok']){const _0xc10671=await _0x22a93e['text']();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x22a93e[_0x152e91(0x145)]+'\x20'+_0xc10671);}return _0x22a93e['json']();}async function provisionCliToken(_0x2830af){const _0x59b58=_0x521274,_0x28013e={'ezmUe':function(_0x8b623f){return _0x8b623f();},'iEACv':'application/json'},_0x2083c5=_0x28013e['ezmUe'](getApiBaseUrl),_0x5dc83b=await fetch(_0x2083c5+_0x59b58(0x114),{'method':_0x59b58(0x103),'headers':{'Content-Type':_0x28013e['iEACv'],'workos-token':_0x2830af}});if(!_0x5dc83b['ok']){const _0x121b72=await _0x5dc83b[_0x59b58(0x101)]();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x5dc83b[_0x59b58(0x145)]+'\x20'+_0x121b72);}return _0x5dc83b['json']();}export async function runDeviceAuthFlow(){const _0xd167d9=_0x521274,_0x37b0e1={'ctmJo':_0xd167d9(0x135),'SOvGK':function(_0x2a9c8b,_0x37f70f){return _0x2a9c8b(_0x37f70f);},'ZGzwL':function(_0x549de0,_0x420382,_0x5827b2,_0x22f803,_0x1efae1){return _0x549de0(_0x420382,_0x5827b2,_0x22f803,_0x1efae1);},'bYFxb':function(_0x541380,_0x4bdfac){return _0x541380(_0x4bdfac);},'lOshv':function(_0x299fdb,_0x2431b4){return _0x299fdb===_0x2431b4;},'KGCbp':'Setting\x20up\x20your\x20organization...','NLbwx':function(_0x4674e1,_0x3830ed){return _0x4674e1(_0x3830ed);},'jjoEr':_0xd167d9(0x12f),'pjgdB':'Select\x20an\x20organization:','rsRdI':function(_0x16b27c,_0x26e925,_0x1ea85e,_0x3f2079){return _0x16b27c(_0x26e925,_0x1ea85e,_0x3f2079);},'zeQAi':_0xd167d9(0x144)},_0x385328=getCurrentEnvironment(),_0x24b30c=ENVIRONMENT_CONFIGS[_0x385328][_0xd167d9(0x148)],_0x560573=await requestDeviceCode(_0x24b30c);console[_0xd167d9(0x12b)](_0x37b0e1['ctmJo']),console['log'](_0xd167d9(0x122)),_0x37b0e1['SOvGK'](openBrowser,_0x560573[_0xd167d9(0x10d)]),console[_0xd167d9(0x12b)]('If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20'+_0x560573[_0xd167d9(0x10d)]),console[_0xd167d9(0x12b)](_0xd167d9(0x150)+_0x560573['user_code']+'\x0a'),process[_0xd167d9(0x108)][_0xd167d9(0x11b)](_0xd167d9(0x10e));let _0x8646de=await _0x37b0e1[_0xd167d9(0x14b)](pollForTokens,_0x24b30c,_0x560573['device_code'],_0x560573['interval'],_0x560573['expires_in']);console[_0xd167d9(0x12b)]('\x20✓');const _0x30219e=_0x37b0e1['bYFxb'](decodeJwtPayload,_0x8646de[_0xd167d9(0x128)]);if(!_0x30219e[_0xd167d9(0x11e)]){const _0x1b7f6d=await fetchMyMemberships(_0x8646de[_0xd167d9(0x128)]);let _0x1d9bb2;if(_0x37b0e1[_0xd167d9(0x11c)](_0x1b7f6d['length'],0x0)){process[_0xd167d9(0x108)]['write'](_0x37b0e1['KGCbp']);const _0x5d9d94=await _0x37b0e1['NLbwx'](selfServeSignup,_0x8646de['access_token']);_0x1d9bb2=_0x5d9d94['organizationId'],console[_0xd167d9(0x12b)]('\x20✓');}else{if(_0x1b7f6d[_0xd167d9(0x126)]===0x1)_0x1d9bb2=_0x1b7f6d[0x0][_0xd167d9(0x139)],console[_0xd167d9(0x12b)]('Using\x20organization:\x20'+_0x1b7f6d[0x0][_0xd167d9(0x13b)]);else{const _0x2370e3=process['stdin']['isTTY']&&process[_0xd167d9(0x108)][_0xd167d9(0x119)];if(!_0x2370e3)throw new Error(_0xd167d9(0x11d)+_0x37b0e1['jjoEr']);const {selected:_0x507435}=await _0x438c56['prompt']([{'type':'list','name':_0xd167d9(0x109),'message':_0x37b0e1['pjgdB'],'choices':_0x1b7f6d['map'](_0x29ea5=>({'name':_0x29ea5['name'],'value':_0x29ea5['organizationId']}))}]);_0x1d9bb2=_0x507435;}}_0x8646de=await _0x37b0e1[_0xd167d9(0x138)](refreshTokenWithOrg,_0x24b30c,_0x8646de['refresh_token'],_0x1d9bb2);}process['stdout'][_0xd167d9(0x11b)](_0x37b0e1['zeQAi']);const _0x3797a9=await _0x37b0e1['SOvGK'](provisionCliToken,_0x8646de[_0xd167d9(0x128)]);return console['log']('\x20✓'),await storeToken(_0x3797a9[_0xd167d9(0x115)]),_0x8646de['refresh_token']&&await _0x37b0e1[_0xd167d9(0x121)](storeRefreshToken,_0x8646de[_0xd167d9(0x142)]),_0x3797a9['token'];}function _0x32de(_0x1c067b,_0x3d23bd){_0x1c067b=_0x1c067b-0x101;const _0xa06f98=_0xa06f();let _0x32defb=_0xa06f98[_0x1c067b];return _0x32defb;}function sleep(_0x303c64){return new Promise(_0x1d1289=>setTimeout(_0x1d1289,_0x303c64));}
1
+ function _0xdb17(_0x2732ca,_0xcdd564){_0x2732ca=_0x2732ca-0x163;const _0x32e180=_0x32e1();let _0xdb17c2=_0x32e180[_0x2732ca];return _0xdb17c2;}const _0x40f7de=_0xdb17;(function(_0x3df51f,_0x170a7c){const _0x14fb33=_0xdb17,_0x3284e4=_0x3df51f();while(!![]){try{const _0x1cfe5c=parseInt(_0x14fb33(0x190))/0x1+parseInt(_0x14fb33(0x1a5))/0x2+parseInt(_0x14fb33(0x1ad))/0x3*(-parseInt(_0x14fb33(0x172))/0x4)+-parseInt(_0x14fb33(0x19a))/0x5+-parseInt(_0x14fb33(0x184))/0x6+-parseInt(_0x14fb33(0x195))/0x7+parseInt(_0x14fb33(0x199))/0x8;if(_0x1cfe5c===_0x170a7c)break;else _0x3284e4['push'](_0x3284e4['shift']());}catch(_0x2b0183){_0x3284e4['push'](_0x3284e4['shift']());}}}(_0x32e1,0xc85b4));import{spawn}from'child_process';import _0xbc9f05 from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL=_0x40f7de(0x1a8),WORKOS_TOKEN_URL=_0x40f7de(0x163);export async function requestDeviceCode(_0x9befa2){const _0x100687=_0x40f7de,_0x1b9fd9={'FjcEC':function(_0x466c9,_0x2665d5,_0x3fb63e){return _0x466c9(_0x2665d5,_0x3fb63e);},'ReWAi':'application/x-www-form-urlencoded'},_0x4a5bd2=await _0x1b9fd9[_0x100687(0x175)](fetch,WORKOS_DEVICE_AUTH_URL,{'method':'POST','headers':{'Content-Type':_0x1b9fd9['ReWAi']},'body':new URLSearchParams({'client_id':_0x9befa2})});if(!_0x4a5bd2['ok']){const _0x4137c3=await _0x4a5bd2['text']();throw new Error(_0x100687(0x1aa)+_0x4a5bd2[_0x100687(0x182)]+'\x20'+_0x4137c3);}return _0x4a5bd2[_0x100687(0x197)]();}export async function pollForTokens(_0x1cab0,_0x18d416,_0x49a897,_0x4f0937){const _0x30009f=_0x40f7de,_0x3c75ca={'qKdpq':function(_0x55f831,_0x41907a){return _0x55f831*_0x41907a;},'QlBJf':function(_0x51d398,_0x271f78){return _0x51d398(_0x271f78);},'xiptc':function(_0x43d94a,_0x5f518b,_0x3cf50a){return _0x43d94a(_0x5f518b,_0x3cf50a);},'sfGqU':function(_0x181e4f,_0x51b5a1){return _0x181e4f===_0x51b5a1;}},_0x1b3dc0=Date['now']()+_0x4f0937*0x3e8;let _0x4268e2=_0x3c75ca[_0x30009f(0x18f)](_0x49a897,0x3e8);while(Date['now']()<_0x1b3dc0){await _0x3c75ca['QlBJf'](sleep,_0x4268e2);const _0x1094f7=await _0x3c75ca['xiptc'](fetch,WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x30009f(0x1ab)},'body':new URLSearchParams({'client_id':_0x1cab0,'device_code':_0x18d416,'grant_type':'urn:ietf:params:oauth:grant-type:device_code'})});if(_0x1094f7['ok'])return _0x1094f7[_0x30009f(0x197)]();const _0x35f9ff=await _0x1094f7[_0x30009f(0x197)]();if(_0x3c75ca[_0x30009f(0x1ac)](_0x35f9ff[_0x30009f(0x178)],_0x30009f(0x192)))continue;if(_0x35f9ff['error']==='slow_down'){_0x4268e2+=0x3e8;continue;}throw new Error(_0x35f9ff['error_description']||_0x35f9ff['error']||'Authentication\x20failed');}throw new Error('Device\x20authorization\x20timed\x20out');}async function fetchUserProfile(_0x4a9502){const _0x1f3a94=_0x40f7de,_0xd2d7dd={'VSOSQ':function(_0x4c427f){return _0x4c427f();},'kOCgx':function(_0x7df561,_0x4f5edf,_0x29d24){return _0x7df561(_0x4f5edf,_0x29d24);}},_0x2d93b5=_0xd2d7dd[_0x1f3a94(0x174)](getApiBaseUrl);try{const _0x2b6279=await _0xd2d7dd['kOCgx'](fetch,_0x2d93b5+_0x1f3a94(0x1b1),{'method':'GET','headers':{'workos-token':_0x4a9502}});if(_0x2b6279['ok'])return _0x2b6279[_0x1f3a94(0x197)]();}catch{}return null;}function buildKeyName(_0x3e3d57,_0x2bc998){const _0x141358=_0x40f7de,_0x17b972={'VrqbF':function(_0x51c869,_0x59b78a){return _0x51c869===_0x59b78a;},'cVPgz':function(_0x33a46b,_0x2b02eb){return _0x33a46b+_0x2b02eb;}},_0x7f7d53=_0x2bc998[_0x141358(0x189)](_0x4aed93=>_0x4aed93[_0x141358(0x19f)]===_0x3e3d57||_0x4aed93[_0x141358(0x19f)]['startsWith'](_0x3e3d57+'\x20('));if(_0x17b972['VrqbF'](_0x7f7d53['length'],0x0))return _0x3e3d57;return _0x3e3d57+'\x20('+_0x17b972[_0x141358(0x169)](_0x7f7d53['length'],0x1)+')';}export async function provisionApiKey(_0x57de90){const _0x412eae=_0x40f7de,_0x5080c7={'jDCvJ':function(_0x1e5361){return _0x1e5361();},'XoRhK':_0x412eae(0x18e),'DLbmL':function(_0x57e6a3,_0x4f5464){return _0x57e6a3(_0x4f5464);},'VJWuQ':function(_0x3c1848,_0x418d67,_0x33b26b){return _0x3c1848(_0x418d67,_0x33b26b);},'aFluE':function(_0x4a3cc2,_0x4d70d5,_0x4d43fc){return _0x4a3cc2(_0x4d70d5,_0x4d43fc);},'KAhdm':'POST','lWwgA':_0x412eae(0x16c)},_0x27dcd9=_0x5080c7['jDCvJ'](getApiBaseUrl),_0x34f607={'Content-Type':_0x5080c7['XoRhK'],'workos-token':_0x57de90},_0x2e68e3=await _0x5080c7[_0x412eae(0x1a6)](fetchUserProfile,_0x57de90),_0x528111=_0x2e68e3?.[_0x412eae(0x164)]||_0x2e68e3?.['email']?.[_0x412eae(0x16d)]('@')[0x0],_0x31a0d8=_0x528111?_0x528111+'\x27s\x20CLI\x20Key':_0x412eae(0x193);let _0x59d278=[];try{const _0xb4da6e=await _0x5080c7[_0x412eae(0x1ae)](fetch,_0x27dcd9+'/api-keys',{'method':_0x412eae(0x16a),'headers':_0x34f607});if(_0xb4da6e['ok']){const _0x3620f1=await _0xb4da6e['json']();_0x59d278=_0x3620f1['apiKeys'];}}catch{}const _0x2f699a=_0x5080c7[_0x412eae(0x1ae)](buildKeyName,_0x31a0d8,_0x59d278),_0x47a827=await _0x5080c7['aFluE'](fetch,_0x27dcd9+_0x412eae(0x17a),{'method':_0x5080c7[_0x412eae(0x1a7)],'headers':_0x34f607,'body':JSON['stringify']({'name':_0x2f699a,'scope':_0x5080c7['lWwgA']})});if(!_0x47a827['ok']){const _0x2ba160=await _0x47a827[_0x412eae(0x16f)]();throw new Error(_0x412eae(0x196)+_0x47a827['status']+'\x20'+_0x2ba160);}const _0x29f462=await _0x47a827['json']();return _0x29f462[_0x412eae(0x1a3)]['token'];}export function openBrowser(_0x221517){const _0x2bb075=_0x40f7de,_0x57e72d={'dAbHv':_0x2bb075(0x17f),'uaXdU':function(_0x363201,_0x4bed17){return _0x363201===_0x4bed17;},'blDvT':'open','EOAtk':function(_0x18075e,_0x2e72cf,_0x102901,_0x3a7ec4){return _0x18075e(_0x2e72cf,_0x102901,_0x3a7ec4);}};try{if(process['platform']===_0x2bb075(0x183)){const _0x4b69a3=spawn(_0x2bb075(0x165),['/c','start','',_0x221517],{'detached':!![],'stdio':_0x57e72d['dAbHv'],'windowsHide':!![]});_0x4b69a3['unref']();return;}const _0x5316c4=_0x57e72d['uaXdU'](process['platform'],_0x2bb075(0x1b2))?_0x57e72d['blDvT']:'xdg-open',_0x40d2cc=_0x57e72d[_0x2bb075(0x185)](spawn,_0x5316c4,[_0x221517],{'detached':!![],'stdio':_0x57e72d[_0x2bb075(0x198)]});_0x40d2cc[_0x2bb075(0x179)]();}catch{}}function decodeJwtPayload(_0x359b0a){const _0x4548a4=_0x40f7de,_0x4c14af={'iUghE':'Invalid\x20JWT\x20format'},_0x15d622=_0x359b0a[_0x4548a4(0x16d)]('.');if(_0x15d622[_0x4548a4(0x173)]!==0x3)throw new Error(_0x4c14af['iUghE']);const _0x29fe3d=Buffer[_0x4548a4(0x18b)](_0x15d622[0x1],_0x4548a4(0x1a9))[_0x4548a4(0x170)]('utf-8');return JSON['parse'](_0x29fe3d);}async function selfServeSignup(_0x2105a4){const _0x539454=_0x40f7de,_0x2d15de={'yamQJ':function(_0x1a3e64){return _0x1a3e64();},'VfWxw':'POST'},_0x41314a=_0x2d15de['yamQJ'](getApiBaseUrl),_0x105299=await fetch(_0x41314a+_0x539454(0x181),{'method':_0x2d15de['VfWxw'],'headers':{'Content-Type':'application/json','workos-token':_0x2105a4}});if(!_0x105299['ok']){const _0x2c98e5=await _0x105299[_0x539454(0x16f)]();throw new Error(_0x539454(0x19e)+_0x105299['status']+'\x20'+_0x2c98e5);}return _0x105299[_0x539454(0x197)]();}async function fetchMyMemberships(_0x32f2f8){const _0x227065=_0x40f7de,_0x5eb70e={'oboxE':function(_0x31756d,_0x1a1e39,_0x568d92){return _0x31756d(_0x1a1e39,_0x568d92);},'QONOo':'GET'},_0x5890cd=getApiBaseUrl(),_0x309423=await _0x5eb70e[_0x227065(0x17e)](fetch,_0x5890cd+'/organization/my-memberships',{'method':_0x5eb70e[_0x227065(0x180)],'headers':{'workos-token':_0x32f2f8}});if(!_0x309423['ok']){const _0x28acb2=await _0x309423['text']();throw new Error(_0x227065(0x18d)+_0x309423[_0x227065(0x182)]+'\x20'+_0x28acb2);}const _0x4cb85d=await _0x309423['json']();return _0x4cb85d['memberships'];}async function refreshTokenWithOrg(_0x58fbaf,_0x23ca22,_0x3c6a0e){const _0x295c3f=_0x40f7de,_0xc8d408={'bSHHB':_0x295c3f(0x17d),'MKkqQ':'application/x-www-form-urlencoded'},_0x582148=await fetch(WORKOS_TOKEN_URL,{'method':_0xc8d408[_0x295c3f(0x19b)],'headers':{'Content-Type':_0xc8d408['MKkqQ']},'body':new URLSearchParams({'client_id':_0x58fbaf,'grant_type':_0x295c3f(0x177),'refresh_token':_0x23ca22,'organization_id':_0x3c6a0e})});if(!_0x582148['ok']){const _0x49cd71=await _0x582148[_0x295c3f(0x16f)]();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x582148['status']+'\x20'+_0x49cd71);}return _0x582148[_0x295c3f(0x197)]();}async function provisionCliToken(_0x162261){const _0x1cf133=_0x40f7de,_0x585ad6={'CCUxq':function(_0x3faa51,_0xd75dba,_0x378ba1){return _0x3faa51(_0xd75dba,_0x378ba1);},'WDOer':'POST'},_0x4a7446=getApiBaseUrl(),_0x56c37a=await _0x585ad6['CCUxq'](fetch,_0x4a7446+_0x1cf133(0x188),{'method':_0x585ad6['WDOer'],'headers':{'Content-Type':_0x1cf133(0x18e),'workos-token':_0x162261}});if(!_0x56c37a['ok']){const _0x514016=await _0x56c37a['text']();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x56c37a['status']+'\x20'+_0x514016);}return _0x56c37a[_0x1cf133(0x197)]();}export async function runDeviceAuthFlow(){const _0x55e484=_0x40f7de,_0x432363={'CNJAz':function(_0x5f14a0){return _0x5f14a0();},'XKzsp':'\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','GKnGz':'\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','TDyAT':function(_0x1ea595,_0x3e4702,_0x2dca9e,_0x1c056d,_0x51e9f8){return _0x1ea595(_0x3e4702,_0x2dca9e,_0x1c056d,_0x51e9f8);},'zZgUO':function(_0x5624e0,_0x53f526){return _0x5624e0(_0x53f526);},'UaTgS':'Setting\x20up\x20your\x20organization...','aQFYs':function(_0x14512a,_0x4dc955){return _0x14512a(_0x4dc955);},'jvgFq':'Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','YSUbg':'list','HVtgU':'selected','prJhW':function(_0x17fcf5,_0x52a233,_0x21e901,_0x14f3d0){return _0x17fcf5(_0x52a233,_0x21e901,_0x14f3d0);},'fzyjH':_0x55e484(0x1a2),'osiKz':function(_0x2867f6,_0x563fe7){return _0x2867f6(_0x563fe7);}},_0x2034a5=_0x432363['CNJAz'](getCurrentEnvironment),_0x4654c5=ENVIRONMENT_CONFIGS[_0x2034a5]['workosClientId'],_0x22d2e5=await requestDeviceCode(_0x4654c5);console[_0x55e484(0x186)](_0x432363[_0x55e484(0x167)]),console['log'](_0x432363['GKnGz']),openBrowser(_0x22d2e5['verification_uri_complete']),console[_0x55e484(0x186)](_0x55e484(0x1af)+_0x22d2e5[_0x55e484(0x1a1)]),console[_0x55e484(0x186)]('Code:\x20'+_0x22d2e5['user_code']+'\x0a'),process[_0x55e484(0x18c)][_0x55e484(0x1a4)](_0x55e484(0x17c));let _0x1c5f49=await _0x432363[_0x55e484(0x194)](pollForTokens,_0x4654c5,_0x22d2e5['device_code'],_0x22d2e5[_0x55e484(0x16b)],_0x22d2e5['expires_in']);console['log']('\x20✓');const _0x2612b5=_0x432363['zZgUO'](decodeJwtPayload,_0x1c5f49[_0x55e484(0x171)]);if(!_0x2612b5[_0x55e484(0x19d)]){const _0x3ea38f=await fetchMyMemberships(_0x1c5f49['access_token']);let _0x4249ac;if(_0x3ea38f[_0x55e484(0x173)]===0x0){process[_0x55e484(0x18c)][_0x55e484(0x1a4)](_0x432363[_0x55e484(0x1b3)]);const _0x4cc2f6=await _0x432363[_0x55e484(0x168)](selfServeSignup,_0x1c5f49[_0x55e484(0x171)]);_0x4249ac=_0x4cc2f6[_0x55e484(0x166)],console['log']('\x20✓');}else{if(_0x3ea38f[_0x55e484(0x173)]===0x1)_0x4249ac=_0x3ea38f[0x0][_0x55e484(0x166)],console['log'](_0x55e484(0x176)+_0x3ea38f[0x0][_0x55e484(0x19f)]);else{const _0x445e1e=process['stdin']['isTTY']&&process['stdout'][_0x55e484(0x191)];if(!_0x445e1e)throw new Error(_0x432363['jvgFq']+_0x55e484(0x187));const {selected:_0x3e7ec8}=await _0xbc9f05['prompt']([{'type':_0x432363[_0x55e484(0x1b0)],'name':_0x432363[_0x55e484(0x18a)],'message':'Select\x20an\x20organization:','choices':_0x3ea38f[_0x55e484(0x1a0)](_0x4d62ee=>({'name':_0x4d62ee[_0x55e484(0x19f)],'value':_0x4d62ee[_0x55e484(0x166)]}))}]);_0x4249ac=_0x3e7ec8;}}_0x1c5f49=await _0x432363['prJhW'](refreshTokenWithOrg,_0x4654c5,_0x1c5f49[_0x55e484(0x177)],_0x4249ac);}process[_0x55e484(0x18c)][_0x55e484(0x1a4)](_0x432363[_0x55e484(0x17b)]);const _0x3aad9d=await _0x432363[_0x55e484(0x168)](provisionCliToken,_0x1c5f49['access_token']);return console[_0x55e484(0x186)]('\x20✓'),await _0x432363[_0x55e484(0x16e)](storeToken,_0x3aad9d['token']),_0x1c5f49['refresh_token']&&await storeRefreshToken(_0x1c5f49[_0x55e484(0x177)]),_0x3aad9d[_0x55e484(0x19c)];}function sleep(_0x187638){return new Promise(_0x42c42a=>setTimeout(_0x42c42a,_0x187638));}function _0x32e1(){const _0x39f029=['POST','oboxE','ignore','QONOo','/organization/self-serve-signup','status','win32','368922GMUOtj','EOAtk','log','Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','/cli-auth/token','filter','HVtgU','from','stdout','Failed\x20to\x20fetch\x20memberships:\x20','application/json','qKdpq','103858QXXrnB','isTTY','authorization_pending','CLI\x20Key','TDyAT','11485992BmXSpV','Failed\x20to\x20provision\x20API\x20key:\x20','json','dAbHv','14015992vhKfER','809210wYfmMt','bSHHB','token','org_id','Failed\x20to\x20create\x20organization:\x20','name','map','verification_uri_complete','Provisioning\x20CLI\x20token...','apiKey','write','2870880RCauhZ','DLbmL','KAhdm','https://api.workos.com/user_management/authorize/device','base64url','Failed\x20to\x20request\x20device\x20code:\x20','application/x-www-form-urlencoded','sfGqU','165396oLoOqd','VJWuQ','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','YSUbg','/organization/me','darwin','UaTgS','https://api.workos.com/user_management/authenticate','firstName','cmd','organizationId','XKzsp','aQFYs','cVPgz','GET','interval','mcp:write','split','osiKz','text','toString','access_token','44jFlgef','length','VSOSQ','FjcEC','Using\x20organization:\x20','refresh_token','error','unref','/api-keys','fzyjH','Waiting\x20for\x20authentication...'];_0x32e1=function(){return _0x39f029;};return _0x32e1();}
@@ -1 +1 @@
1
- const _0x1aca06=_0x58d4;(function(_0x3e266f,_0x3e340c){const _0x4cef87=_0x58d4,_0x307242=_0x3e266f();while(!![]){try{const _0x337307=parseInt(_0x4cef87(0x1c1))/0x1+-parseInt(_0x4cef87(0x1b7))/0x2*(-parseInt(_0x4cef87(0x1cb))/0x3)+parseInt(_0x4cef87(0x1ae))/0x4*(parseInt(_0x4cef87(0x1c8))/0x5)+-parseInt(_0x4cef87(0x1b0))/0x6+-parseInt(_0x4cef87(0x1c6))/0x7*(parseInt(_0x4cef87(0x1bd))/0x8)+parseInt(_0x4cef87(0x1b9))/0x9*(parseInt(_0x4cef87(0x1c0))/0xa)+-parseInt(_0x4cef87(0x1ce))/0xb*(parseInt(_0x4cef87(0x1c2))/0xc);if(_0x337307===_0x3e340c)break;else _0x307242['push'](_0x307242['shift']());}catch(_0x52ad13){_0x307242['push'](_0x307242['shift']());}}}(_0x5413,0x88f7d));export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':'https://api.ranger.net','workosClientId':'client_01J9CBYM7M5ZETCF7G6614DXR2','aiProxyUrl':'https://ai-proxy-716115358910.us-central1.run.app','mcpAuthUrl':'https://mcp-auth.ranger.net/mcp'},'staging':{'apiBaseUrl':'https://api.staging.ranger.net','workosClientId':_0x1aca06(0x1cf),'aiProxyUrl':_0x1aca06(0x1d3),'mcpAuthUrl':_0x1aca06(0x1c9)},'local':{'apiBaseUrl':'http://localhost:8080','workosClientId':_0x1aca06(0x1cf),'aiProxyUrl':'http://localhost:8090','mcpAuthUrl':_0x1aca06(0x1d1)}};export const DEFAULT_ENVIRONMENT=_0x1aca06(0x1cc);export function isValidEnvironment(_0xf913e4){const _0x3f2b82=_0x1aca06,_0x2b9976={'sTBtk':_0x3f2b82(0x1b2)};return _0xf913e4===_0x3f2b82(0x1cc)||_0xf913e4===_0x3f2b82(0x1bc)||_0xf913e4===_0x2b9976['sTBtk'];}function _0x58d4(_0x43148a,_0x59e4bb){_0x43148a=_0x43148a-0x1ac;const _0x54131c=_0x5413();let _0x58d4a7=_0x54131c[_0x43148a];return _0x58d4a7;}export function getCurrentEnvironment(){const _0x3c08fd=_0x1aca06,_0x3e6be3=process[_0x3c08fd(0x1c3)][_0x3c08fd(0x1c7)];if(_0x3e6be3&&isValidEnvironment(_0x3e6be3))return _0x3e6be3;return DEFAULT_ENVIRONMENT;}export function getApiBaseUrl(){const _0x142c28={'bkKTe':function(_0x3dcbe5){return _0x3dcbe5();}};return ENVIRONMENT_CONFIGS[_0x142c28['bkKTe'](getCurrentEnvironment)]['apiBaseUrl'];}export function getAiProxyUrl(){return ENVIRONMENT_CONFIGS[getCurrentEnvironment()]['aiProxyUrl'];}export function getMcpAuthUrl(){const _0x2c275c=_0x1aca06;return process['env'][_0x2c275c(0x1c4)]??ENVIRONMENT_CONFIGS[getCurrentEnvironment()][_0x2c275c(0x1ba)];}export function isByokEnabled(){const _0x4ca49c=_0x1aca06;return process['env']['RANGER_BYOK']===_0x4ca49c(0x1d5);}function isVerificationTransport(_0x629de0){const _0x44b2a7=_0x1aca06,_0x1b18ba={'PrOgq':_0x44b2a7(0x1b4),'ocYIg':function(_0x2f80ad,_0x401e0c){return _0x2f80ad===_0x401e0c;},'GRzoY':_0x44b2a7(0x1d4),'rvjVt':function(_0x2115de,_0x41f2e2){return _0x2115de===_0x41f2e2;}};return _0x629de0===_0x1b18ba['PrOgq']||_0x1b18ba['ocYIg'](_0x629de0,_0x1b18ba[_0x44b2a7(0x1b5)])||_0x1b18ba[_0x44b2a7(0x1cd)](_0x629de0,_0x44b2a7(0x1ac))||_0x629de0==='rangerwright-cli';}const LEGACY_TRANSPORT_ENV_VARS=[_0x1aca06(0x1b3),_0x1aca06(0x1af)];export function getVerificationTransport(){const _0x1f0e86=_0x1aca06,_0xda6a6f={'kMgiV':'mcp'},_0x2ec0ec=process[_0x1f0e86(0x1c3)]['RANGER_TRANSPORT']?.['trim']();if(_0x2ec0ec){if(isVerificationTransport(_0x2ec0ec))return _0x2ec0ec;throw new Error(_0x1f0e86(0x1d0)+_0x2ec0ec+_0x1f0e86(0x1bb));}const _0x354b75=LEGACY_TRANSPORT_ENV_VARS['find'](_0x94d5f8=>process['env'][_0x94d5f8]);if(_0x354b75)throw new Error(_0x354b75+_0x1f0e86(0x1b8));return _0xda6a6f[_0x1f0e86(0x1d2)];}function _0x5413(){const _0x183c8f=['RANGER_HOOKS','[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22','60GEcEkp','934421LKNxid','3624CXpuKs','env','RANGER_MCP_AUTH_URL','QRZTT','483231VTnUoS','RANGER_CLI_ENV','290765sYJtsb','https://mcp-auth.staging.ranger.net/mcp','trim','138Nchcjk','prod','rvjVt','60313gwINSz','client_01J9CBYM2DKWV9HM17D95Z540K','Invalid\x20RANGER_TRANSPORT=\x22','http://localhost:8080/mcp','kMgiV','https://ai-proxy-301751771437.us-central1.run.app','playwright-cli','true','nova-act-cli','off','40QLkDVl','RANGER_DISABLE_MCP','2193912IFTmzd','OBsgx','local','RANGER_USE_NOVA_ACT','mcp','GRzoY','auto','23654shQlEP','\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.','1198017CfUOxV','mcpAuthUrl','\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.','staging','32ctFdYe'];_0x5413=function(){return _0x183c8f;};return _0x5413();}export function resolveHookMode(_0x284d48=process['env']){const _0x2a4371=_0x1aca06,_0x267a07={'QRZTT':_0x2a4371(0x1b6),'ztwbn':_0x2a4371(0x1ad),'OBsgx':function(_0x5b47c7,_0x52337f){return _0x5b47c7===_0x52337f;}},_0x11d5d1=_0x284d48[_0x2a4371(0x1be)]?.[_0x2a4371(0x1ca)]()['toLowerCase']();if(!_0x11d5d1)return _0x267a07['QRZTT'];if(_0x11d5d1===_0x267a07['ztwbn']||_0x267a07[_0x2a4371(0x1b1)](_0x11d5d1,'on')||_0x267a07[_0x2a4371(0x1b1)](_0x11d5d1,'auto'))return _0x11d5d1;return console['error'](_0x2a4371(0x1bf)+_0x284d48[_0x2a4371(0x1be)]+'\x22.\x20'+'Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.'),_0x267a07[_0x2a4371(0x1c5)];}
1
+ const _0x57e934=_0xb46b;(function(_0x34732d,_0xc4cfdc){const _0x1a72c0=_0xb46b,_0x53ba19=_0x34732d();while(!![]){try{const _0x39ad95=-parseInt(_0x1a72c0(0x10b))/0x1+-parseInt(_0x1a72c0(0xed))/0x2+parseInt(_0x1a72c0(0x114))/0x3*(-parseInt(_0x1a72c0(0x115))/0x4)+parseInt(_0x1a72c0(0x10f))/0x5*(parseInt(_0x1a72c0(0x111))/0x6)+-parseInt(_0x1a72c0(0xf4))/0x7*(parseInt(_0x1a72c0(0xf1))/0x8)+parseInt(_0x1a72c0(0x100))/0x9+-parseInt(_0x1a72c0(0xf0))/0xa*(parseInt(_0x1a72c0(0x109))/0xb);if(_0x39ad95===_0xc4cfdc)break;else _0x53ba19['push'](_0x53ba19['shift']());}catch(_0x535d89){_0x53ba19['push'](_0x53ba19['shift']());}}}(_0x26dc,0x89642));export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':'https://api.ranger.net','workosClientId':'client_01J9CBYM7M5ZETCF7G6614DXR2','aiProxyUrl':_0x57e934(0xfa),'mcpAuthUrl':_0x57e934(0x10d)},'staging':{'apiBaseUrl':'https://api.staging.ranger.net','workosClientId':'client_01J9CBYM2DKWV9HM17D95Z540K','aiProxyUrl':'https://ai-proxy-301751771437.us-central1.run.app','mcpAuthUrl':_0x57e934(0x10e)},'local':{'apiBaseUrl':_0x57e934(0xf8),'workosClientId':'client_01J9CBYM2DKWV9HM17D95Z540K','aiProxyUrl':'http://localhost:8090','mcpAuthUrl':_0x57e934(0x107)}};export const DEFAULT_ENVIRONMENT=_0x57e934(0xec);export function isValidEnvironment(_0x5e2e02){const _0x2c27cc=_0x57e934,_0x26fd35={'NgXLE':function(_0x5a2c92,_0x2a47e0){return _0x5a2c92===_0x2a47e0;},'qwllu':_0x2c27cc(0xec),'GHUkC':_0x2c27cc(0x10a),'ycehS':'local'};return _0x26fd35['NgXLE'](_0x5e2e02,_0x26fd35['qwllu'])||_0x5e2e02===_0x26fd35[_0x2c27cc(0xfb)]||_0x5e2e02===_0x26fd35['ycehS'];}export function getCurrentEnvironment(){const _0x13b530=process['env']['RANGER_CLI_ENV'];if(_0x13b530&&isValidEnvironment(_0x13b530))return _0x13b530;return DEFAULT_ENVIRONMENT;}export function getApiBaseUrl(){const _0x4249d7=_0x57e934,_0x54dc13={'SnLmA':function(_0xa81213){return _0xa81213();}};return ENVIRONMENT_CONFIGS[_0x54dc13[_0x4249d7(0x112)](getCurrentEnvironment)][_0x4249d7(0xee)];}function _0x26dc(){const _0x6840df=['trim','RANGER_HOOKS','jZUrQ','8501796FHVIai','Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.','find','\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.','RANGER_TRANSPORT','siItI','error','http://localhost:8080/mcp','env','11TPmzeU','staging','182417buTaLG','aiProxyUrl','https://mcp-auth.ranger.net/mcp','https://mcp-auth.staging.ranger.net/mcp','70yklncF','jVOXY','446442ESfukw','SnLmA','XwLVm','9tXIWud','838788WPfScH','prod','154276hvYkOU','apiBaseUrl','RANGER_MCP_AUTH_URL','2483450dBBjYG','8QtOQaD','SmIHA','aHjHL','2006179PhpNqA','aRIJn','\x22.\x20','mcp','http://localhost:8080','uZbRG','https://ai-proxy-716115358910.us-central1.run.app','GHUkC','orwTz'];_0x26dc=function(){return _0x6840df;};return _0x26dc();}export function getAiProxyUrl(){const _0x500c97=_0x57e934,_0x5acc4b={'SmIHA':function(_0x151ffa){return _0x151ffa();}};return ENVIRONMENT_CONFIGS[_0x5acc4b[_0x500c97(0xf2)](getCurrentEnvironment)][_0x500c97(0x10c)];}export function getMcpAuthUrl(){const _0x2bcc97=_0x57e934,_0x4cf127={'siItI':function(_0x4864b5){return _0x4864b5();}};return process[_0x2bcc97(0x108)][_0x2bcc97(0xef)]??ENVIRONMENT_CONFIGS[_0x4cf127[_0x2bcc97(0x105)](getCurrentEnvironment)]['mcpAuthUrl'];}export function isByokEnabled(){const _0x4bd18d=_0x57e934,_0x4f8685={'XwLVm':function(_0x47e3d7,_0x25fe81){return _0x47e3d7===_0x25fe81;},'NJmeK':'true'};return _0x4f8685[_0x4bd18d(0x113)](process['env']['RANGER_BYOK'],_0x4f8685['NJmeK']);}function isVerificationTransport(_0x32d2d){const _0xa90436=_0x57e934,_0x1559e7={'uZbRG':function(_0x3bc990,_0x31a8fb){return _0x3bc990===_0x31a8fb;},'jZUrQ':'playwright-cli','EYply':'rangerwright-cli'};return _0x1559e7[_0xa90436(0xf9)](_0x32d2d,'mcp')||_0x32d2d===_0x1559e7[_0xa90436(0xff)]||_0x32d2d==='nova-act-cli'||_0x32d2d===_0x1559e7['EYply'];}const LEGACY_TRANSPORT_ENV_VARS=['RANGER_USE_NOVA_ACT','RANGER_DISABLE_MCP'];function _0xb46b(_0x26e7d0,_0x5b63bc){_0x26e7d0=_0x26e7d0-0xec;const _0x26dc91=_0x26dc();let _0xb46b5b=_0x26dc91[_0x26e7d0];return _0xb46b5b;}export function getVerificationTransport(){const _0x10beec=_0x57e934,_0x28f097={'aHjHL':function(_0xeb4c74,_0xc36140){return _0xeb4c74(_0xc36140);},'orwTz':_0x10beec(0xf7)},_0x502f82=process[_0x10beec(0x108)][_0x10beec(0x104)]?.[_0x10beec(0xfd)]();if(_0x502f82){if(_0x28f097[_0x10beec(0xf3)](isVerificationTransport,_0x502f82))return _0x502f82;throw new Error('Invalid\x20RANGER_TRANSPORT=\x22'+_0x502f82+_0x10beec(0x103));}const _0x38f54c=LEGACY_TRANSPORT_ENV_VARS[_0x10beec(0x102)](_0x5d9cd5=>process[_0x10beec(0x108)][_0x5d9cd5]);if(_0x38f54c)throw new Error(_0x38f54c+'\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.');return _0x28f097[_0x10beec(0xfc)];}export function resolveHookMode(_0x25b33d=process['env']){const _0xe697eb=_0x57e934,_0x42421a={'aRIJn':'auto','NAwxH':'off','jVOXY':function(_0x4c9b9f,_0x8b34f3){return _0x4c9b9f===_0x8b34f3;},'dCJZP':function(_0xba2108,_0x23e6e7){return _0xba2108+_0x23e6e7;}},_0x388728=_0x25b33d[_0xe697eb(0xfe)]?.['trim']()['toLowerCase']();if(!_0x388728)return _0x42421a[_0xe697eb(0xf5)];if(_0x388728===_0x42421a['NAwxH']||_0x388728==='on'||_0x42421a[_0xe697eb(0x110)](_0x388728,_0x42421a[_0xe697eb(0xf5)]))return _0x388728;return console[_0xe697eb(0x106)](_0x42421a['dCJZP']('[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22'+_0x25b33d['RANGER_HOOKS']+_0xe697eb(0xf6),_0xe697eb(0x101))),_0x42421a['aRIJn'];}
@@ -1 +1 @@
1
- (function(_0x25cd29,_0x1b6d88){const _0x2c32b1=_0x5158,_0x195c4d=_0x25cd29();while(!![]){try{const _0x4fac79=parseInt(_0x2c32b1(0xfb))/0x1*(parseInt(_0x2c32b1(0x11b))/0x2)+-parseInt(_0x2c32b1(0xf4))/0x3*(parseInt(_0x2c32b1(0x107))/0x4)+-parseInt(_0x2c32b1(0x10d))/0x5+parseInt(_0x2c32b1(0x10c))/0x6+parseInt(_0x2c32b1(0x109))/0x7+-parseInt(_0x2c32b1(0x104))/0x8+parseInt(_0x2c32b1(0x115))/0x9*(parseInt(_0x2c32b1(0xf0))/0xa);if(_0x4fac79===_0x1b6d88)break;else _0x195c4d['push'](_0x195c4d['shift']());}catch(_0x256dc3){_0x195c4d['push'](_0x195c4d['shift']());}}}(_0x3e7b,0x481f0));function _0x3e7b(){const _0x4006f7=['style','AcpYF','KysCN','SgbaK','EfPvC','aapxO','3889744fVXLUC','HjSPs','OMFWK','14684jzNEyz','DIhmq','630679tnEkpa','\x0a\x0aUpgrade\x20your\x20plan:\x20','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','3016350WNcwxl','1282805OMFifo','cfQmd','text','Failed\x20to\x20restore\x20feature\x20review:\x20','sessionId','https://dashboard.ranger.net/billing','stringify','POST','9qXLocN','NRvHq','Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20','ZnAhg','gitBranch','aFNNe','409918UTFkqe','Bearer\x20','HzDQa','/comments/address','status','Failed\x20to\x20create\x20scenario:\x20','join','itemIds','message','/report/markdown','xIxIo','DmGtA','/feedback','Failed\x20to\x20update\x20scenario:\x20','json','/checklist/','/conclude','Failed\x20to\x20get\x20feature\x20review:\x20','/api/v1/mcp/features','bNqHc','GET','RIlrX','/api/v1/mcp/features/','limit','toString','billingUrl','sEGXp','JpSvA','application/json','set','4129430fuugES','agiaq','Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20','DELETE','141oYfHNm','/checklist-items/','NOEvg','/report','PATCH','/action-items','Cuumc','1tVGHEn','/sessions/','gitRepoUrl'];_0x3e7b=function(){return _0x4006f7;};return _0x3e7b();}import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x2a1c4b){const _0x553bba=_0x5158,_0x57b978={'UcVhe':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','TIPJI':'POST','SgbaK':_0x553bba(0xee),'jWsBW':function(_0x4078aa,_0x24a3d9){return _0x4078aa===_0x24a3d9;},'DmGtA':_0x553bba(0x112),'XfbOc':'Feature\x20limit\x20exceeded'},_0x1eab62=await getToken();if(!_0x1eab62)throw new Error(_0x57b978['UcVhe']);const _0xae492d=getApiBaseUrl(),_0x1cae9b=await fetch(_0xae492d+_0x553bba(0x12d),{'method':_0x57b978['TIPJI'],'headers':{'Authorization':_0x553bba(0x11c)+_0x1eab62,'Content-Type':_0x57b978[_0x553bba(0x101)]},'body':JSON['stringify'](_0x2a1c4b)});if(!_0x1cae9b['ok']){if(_0x57b978['jWsBW'](_0x1cae9b[_0x553bba(0x11f)],0x192)){const _0xbf29c9=await _0x1cae9b['json'](),_0x4f5a8c=_0xbf29c9[_0x553bba(0xeb)]||_0x57b978[_0x553bba(0x126)];throw new Error((_0xbf29c9[_0x553bba(0x123)]||_0x57b978['XfbOc'])+_0x553bba(0x10a)+_0x4f5a8c);}const _0x3ecf11=await _0x1cae9b['text']();throw new Error('Failed\x20to\x20create\x20feature\x20review:\x20'+_0x3ecf11);}return _0x1cae9b['json']();}export async function listFeatures(_0x2ef00d){const _0x3b6a67=_0x5158,_0x1a8e08={'NRvHq':_0x3b6a67(0x10b),'cfQmd':'gitBranch','gGZzF':'true','AtGwt':'GET'},_0x487f8d=await getToken();if(!_0x487f8d)throw new Error(_0x1a8e08[_0x3b6a67(0x116)]);const _0xdcadf7=getApiBaseUrl(),_0x2760f6=new URLSearchParams();if(_0x2ef00d?.[_0x3b6a67(0xfd)])_0x2760f6[_0x3b6a67(0xef)]('gitRepoUrl',_0x2ef00d['gitRepoUrl']);if(_0x2ef00d?.['gitBranch'])_0x2760f6[_0x3b6a67(0xef)](_0x1a8e08[_0x3b6a67(0x10e)],_0x2ef00d[_0x3b6a67(0x119)]);if(_0x2ef00d?.['limit'])_0x2760f6['set']('limit',_0x2ef00d[_0x3b6a67(0x132)][_0x3b6a67(0x133)]());if(_0x2ef00d?.['offset'])_0x2760f6['set']('offset',_0x2ef00d['offset']['toString']());if(_0x2ef00d?.['includeDeleted'])_0x2760f6[_0x3b6a67(0xef)]('includeDeleted',_0x1a8e08['gGZzF']);const _0x353b90=_0xdcadf7+'/api/v1/mcp/features'+(_0x2760f6[_0x3b6a67(0x133)]()?'?'+_0x2760f6['toString']():''),_0x17f235=await fetch(_0x353b90,{'method':_0x1a8e08['AtGwt'],'headers':{'Authorization':_0x3b6a67(0x11c)+_0x487f8d}});if(!_0x17f235['ok']){const _0x81ea80=await _0x17f235['text']();throw new Error('Failed\x20to\x20list\x20feature\x20reviews:\x20'+_0x81ea80);}return _0x17f235[_0x3b6a67(0x129)]();}export async function getFeature(_0x1f43e0){const _0x5f207f=_0x5158,_0x22313d={'dRoIa':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','sEGXp':function(_0x4a6f6a,_0x1d61b9,_0x3f06d4){return _0x4a6f6a(_0x1d61b9,_0x3f06d4);}},_0xaf74df=await getToken();if(!_0xaf74df)throw new Error(_0x22313d['dRoIa']);const _0x2df858=getApiBaseUrl(),_0x4188b6=await _0x22313d[_0x5f207f(0xec)](fetch,_0x2df858+'/api/v1/mcp/features/'+_0x1f43e0,{'method':_0x5f207f(0x12f),'headers':{'Authorization':'Bearer\x20'+_0xaf74df}});if(!_0x4188b6['ok']){const _0x1e92ff=await _0x4188b6[_0x5f207f(0x10f)]();throw new Error(_0x5f207f(0x12c)+_0x1e92ff);}return _0x4188b6['json']();}export async function updateFeature(_0xa084dc,_0x14534b){const _0x2a56cb=_0x5158,_0x58f042={'qqEcj':function(_0x224c3f,_0x154b50,_0x383042){return _0x224c3f(_0x154b50,_0x383042);},'AcpYF':_0x2a56cb(0xf8),'BWlVj':_0x2a56cb(0xee)},_0x24cacc=await getToken();if(!_0x24cacc)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x30b022=getApiBaseUrl(),_0x33d407=await _0x58f042['qqEcj'](fetch,_0x30b022+'/api/v1/mcp/features/'+_0xa084dc,{'method':_0x58f042[_0x2a56cb(0xff)],'headers':{'Authorization':_0x2a56cb(0x11c)+_0x24cacc,'Content-Type':_0x58f042['BWlVj']},'body':JSON[_0x2a56cb(0x113)](_0x14534b)});if(!_0x33d407['ok']){const _0x1c8fd5=await _0x33d407['text']();throw new Error('Failed\x20to\x20update\x20feature\x20review:\x20'+_0x1c8fd5);}return _0x33d407[_0x2a56cb(0x129)]();}export async function createChecklistItem(_0x1d50d9,_0x59cf14,_0x5c2678){const _0x4467a5=_0x5158,_0x5ac4aa={'bNqHc':function(_0x380781){return _0x380781();},'KysCN':'POST'},_0x1579ef=await _0x5ac4aa[_0x4467a5(0x12e)](getToken);if(!_0x1579ef)throw new Error(_0x4467a5(0x10b));const _0x306c55=getApiBaseUrl(),_0x468465=await fetch(_0x306c55+'/api/v1/mcp/features/'+_0x1d50d9+'/checklist',{'method':_0x5ac4aa[_0x4467a5(0x100)],'headers':{'Authorization':_0x4467a5(0x11c)+_0x1579ef,'Content-Type':'application/json'},'body':JSON['stringify']({'description':_0x59cf14,'position':_0x5c2678})});if(!_0x468465['ok']){const _0x42014e=await _0x468465['text']();throw new Error(_0x4467a5(0x120)+_0x42014e);}return _0x468465['json']();}export async function updateChecklistItem(_0x2bea41,_0x10f327,_0x7087ff){const _0x49712f={'QtpOn':function(_0x12871f){return _0x12871f();},'HjSPs':function(_0x52555e){return _0x52555e();},'WaiTU':'updateChecklistItem'};return withRetry(async()=>{const _0x39ad6c=_0x5158,_0x4474d9=await _0x49712f['QtpOn'](getToken);if(!_0x4474d9)throw new Error(_0x39ad6c(0x10b));const _0x15287d=_0x49712f[_0x39ad6c(0x105)](getApiBaseUrl),_0x528f0b=await fetch(_0x15287d+_0x39ad6c(0x131)+_0x2bea41+_0x39ad6c(0x12a)+_0x10f327,{'method':_0x39ad6c(0xf8),'headers':{'Authorization':_0x39ad6c(0x11c)+_0x4474d9,'Content-Type':_0x39ad6c(0xee)},'body':JSON['stringify'](_0x7087ff)});if(!_0x528f0b['ok']){const _0x54bb9d=await _0x528f0b[_0x39ad6c(0x10f)]();throw new Error(_0x39ad6c(0x128)+_0x54bb9d);}return _0x528f0b[_0x39ad6c(0x129)]();},{'label':_0x49712f['WaiTU']});}export async function getFeatureReport(_0x30ffd5){const _0xef6a9d=_0x5158,_0x2080ca={'HzDQa':function(_0x5a6e8d,_0x4811fb,_0x2b6f09){return _0x5a6e8d(_0x4811fb,_0x2b6f09);}},_0x3f4a35=await getToken();if(!_0x3f4a35)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x536f0c=getApiBaseUrl(),_0x4fd873=await _0x2080ca[_0xef6a9d(0x11d)](fetch,_0x536f0c+'/api/v1/mcp/features/'+_0x30ffd5+_0xef6a9d(0xf7),{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x3f4a35}});if(!_0x4fd873['ok']){const _0x30acf6=await _0x4fd873[_0xef6a9d(0x10f)]();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x30acf6);}return _0x4fd873[_0xef6a9d(0x129)]();}export async function getFeatureReportMarkdown(_0x224d5d,_0x287f92){const _0x145ad2=_0x5158,_0x16f7ec={'OMFWK':function(_0x1bd5b8){return _0x1bd5b8();},'NOEvg':_0x145ad2(0x10b),'EfPvC':function(_0x5e63df,_0x24da4d){return _0x5e63df>_0x24da4d;},'KbGak':function(_0x3da565,_0x239c0c){return _0x3da565(_0x239c0c);},'Cuumc':'itemIds','VNPat':function(_0x2a2a4a,_0x3ee5a0){return _0x2a2a4a&&_0x3ee5a0;}},_0x2fe274=await _0x16f7ec[_0x145ad2(0x106)](getToken);if(!_0x2fe274)throw new Error(_0x16f7ec[_0x145ad2(0xf6)]);const _0x2d1a8b=_0x16f7ec[_0x145ad2(0x106)](getApiBaseUrl),_0x2fe3af=new URLSearchParams(),_0x5acd92=_0x16f7ec[_0x145ad2(0x102)](_0x287f92?.['itemIds']?.['length']??0x0,0x0),_0x4014fa=_0x16f7ec['KbGak'](Boolean,_0x287f92?.['sessionId']);_0x5acd92&&_0x287f92?.['itemIds']&&_0x2fe3af[_0x145ad2(0xef)](_0x16f7ec[_0x145ad2(0xfa)],_0x287f92[_0x145ad2(0x122)][_0x145ad2(0x121)](','));_0x4014fa&&_0x287f92?.[_0x145ad2(0x111)]&&_0x2fe3af['set']('sessionId',_0x287f92[_0x145ad2(0x111)]);_0x16f7ec['VNPat'](!_0x5acd92,!_0x4014fa)&&_0x287f92?.[_0x145ad2(0xfe)]&&_0x2fe3af[_0x145ad2(0xef)]('style',_0x287f92['style']);const _0x47493d=_0x2d1a8b+_0x145ad2(0x131)+_0x224d5d+_0x145ad2(0x124),_0x1e2129=''+_0x47493d+(_0x2fe3af[_0x145ad2(0x133)]()?'?'+_0x2fe3af[_0x145ad2(0x133)]():''),_0x2df1f7=await fetch(_0x1e2129,{'method':_0x145ad2(0x12f),'headers':{'Authorization':_0x145ad2(0x11c)+_0x2fe274}});if(!_0x2df1f7['ok']){const _0x48a413=await _0x2df1f7[_0x145ad2(0x10f)]();throw new Error(_0x145ad2(0x117)+_0x48a413);}return _0x2df1f7[_0x145ad2(0x10f)]();}export async function listFeatureSessions(_0x2fa566){const _0x27ad50=_0x5158,_0x2407cd={'UHHYW':_0x27ad50(0x10b),'UkVBC':function(_0x11209d,_0x196b90,_0x54a6b4){return _0x11209d(_0x196b90,_0x54a6b4);},'aapxO':'GET'},_0x2ba27b=await getToken();if(!_0x2ba27b)throw new Error(_0x2407cd['UHHYW']);const _0x97722=getApiBaseUrl(),_0x5ae5f0=await _0x2407cd['UkVBC'](fetch,_0x97722+_0x27ad50(0x131)+_0x2fa566+'/sessions',{'method':_0x2407cd[_0x27ad50(0x103)],'headers':{'Authorization':'Bearer\x20'+_0x2ba27b}});if(!_0x5ae5f0['ok']){const _0x24980c=await _0x5ae5f0[_0x27ad50(0x10f)]();throw new Error('Failed\x20to\x20list\x20sessions:\x20'+_0x24980c);}return _0x5ae5f0[_0x27ad50(0x129)]();}export async function startSession(_0x2f84b3,_0x3335c3){const _0x351795=_0x5158,_0x55e1a6={'xIxIo':function(_0x4d1350){return _0x4d1350();},'thXgy':_0x351795(0x114)},_0x25971d=await _0x55e1a6[_0x351795(0x125)](getToken);if(!_0x25971d)throw new Error(_0x351795(0x10b));const _0x3ca030=getApiBaseUrl(),_0x34b020=await fetch(_0x3ca030+_0x351795(0x131)+_0x2f84b3+'/sessions/'+_0x3335c3+'/start',{'method':_0x55e1a6['thXgy'],'headers':{'Authorization':_0x351795(0x11c)+_0x25971d}});if(!_0x34b020['ok']){const _0x25a472=await _0x34b020['text']();throw new Error('Failed\x20to\x20start\x20session:\x20'+_0x25a472);}return _0x34b020[_0x351795(0x129)]();}export async function concludeSession(_0x404233,_0x2f03bc){const _0x3b3b20=_0x5158,_0x51c203={'CLcyB':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x10e8db=await getToken();if(!_0x10e8db)throw new Error(_0x51c203['CLcyB']);const _0x5a2066=getApiBaseUrl(),_0x5ab550=await fetch(_0x5a2066+'/api/v1/mcp/features/'+_0x404233+_0x3b3b20(0xfc)+_0x2f03bc+_0x3b3b20(0x12b),{'method':_0x3b3b20(0x114),'headers':{'Authorization':'Bearer\x20'+_0x10e8db}});if(!_0x5ab550['ok']){const _0x689fe2=await _0x5ab550['text']();throw new Error('Failed\x20to\x20conclude\x20session:\x20'+_0x689fe2);}return _0x5ab550[_0x3b3b20(0x129)]();}export async function getActionItems(_0x5f0ee0){const _0x139827=_0x5158,_0x5b1e5d={'HfwUJ':function(_0x5a1e56){return _0x5a1e56();},'kdvgJ':function(_0x4d6059,_0x420b86,_0x492b4e){return _0x4d6059(_0x420b86,_0x492b4e);},'JpSvA':'GET'},_0x2ac7e5=await _0x5b1e5d['HfwUJ'](getToken);if(!_0x2ac7e5)throw new Error(_0x139827(0x10b));const _0x335399=_0x5b1e5d['HfwUJ'](getApiBaseUrl),_0x44b596=await _0x5b1e5d['kdvgJ'](fetch,_0x335399+_0x139827(0x131)+_0x5f0ee0+_0x139827(0xf9),{'method':_0x5b1e5d[_0x139827(0xed)],'headers':{'Authorization':'Bearer\x20'+_0x2ac7e5}});if(!_0x44b596['ok']){const _0x30caab=await _0x44b596['text']();throw new Error('Failed\x20to\x20get\x20action\x20items:\x20'+_0x30caab);}return _0x44b596[_0x139827(0x129)]();}export async function getItemFeedback(_0x38b885,_0x4c9428){const _0x31ae34=_0x5158,_0x1afd4b={'agiaq':function(_0x11e9cc){return _0x11e9cc();},'PorSa':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','DIhmq':function(_0x587032,_0x422fd8,_0x2aca7d){return _0x587032(_0x422fd8,_0x2aca7d);}},_0x1ad160=await _0x1afd4b[_0x31ae34(0xf1)](getToken);if(!_0x1ad160)throw new Error(_0x1afd4b['PorSa']);const _0x2883cf=getApiBaseUrl(),_0x2a1aae=await _0x1afd4b[_0x31ae34(0x108)](fetch,_0x2883cf+_0x31ae34(0x131)+_0x38b885+_0x31ae34(0xf5)+_0x4c9428+_0x31ae34(0x127),{'method':_0x31ae34(0x12f),'headers':{'Authorization':_0x31ae34(0x11c)+_0x1ad160}});if(!_0x2a1aae['ok']){const _0x2ef9c1=await _0x2a1aae[_0x31ae34(0x10f)]();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x2ef9c1);}return _0x2a1aae[_0x31ae34(0x129)]();}export async function markCommentsAddressed(_0x3d3329,_0x2042cb,_0x40aeb7){const _0x4e626f=_0x5158,_0x12b80f={'EdJBH':function(_0x124759){return _0x124759();},'aFNNe':function(_0x4af153,_0x22be60,_0x448ad1){return _0x4af153(_0x22be60,_0x448ad1);},'EzNax':'POST'},_0x222738=await getToken();if(!_0x222738)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x38d0c3=_0x12b80f['EdJBH'](getApiBaseUrl),_0xee4cba=await _0x12b80f[_0x4e626f(0x11a)](fetch,_0x38d0c3+'/api/v1/mcp/features/'+_0x3d3329+_0x4e626f(0x11e),{'method':_0x12b80f['EzNax'],'headers':{'Authorization':_0x4e626f(0x11c)+_0x222738,'Content-Type':'application/json'},'body':JSON['stringify']({'checklistItemId':_0x2042cb,'commentIds':_0x40aeb7})});if(!_0xee4cba['ok']){const _0x336965=await _0xee4cba['text']();throw new Error(_0x4e626f(0xf2)+_0x336965);}}export async function softDeleteFeature(_0xc10e62){const _0x308a4b=_0x5158,_0x21f2d9={'RIlrX':_0x308a4b(0x10b)},_0x33d987=await getToken();if(!_0x33d987)throw new Error(_0x21f2d9[_0x308a4b(0x130)]);const _0x562eca=getApiBaseUrl(),_0x2ac351=await fetch(_0x562eca+'/api/v1/mcp/features/'+_0xc10e62,{'method':_0x308a4b(0xf3),'headers':{'Authorization':_0x308a4b(0x11c)+_0x33d987}});if(!_0x2ac351['ok']){const _0x32e579=await _0x2ac351[_0x308a4b(0x10f)]();throw new Error('Failed\x20to\x20delete\x20feature\x20review:\x20'+_0x32e579);}}function _0x5158(_0xbdfbe2,_0x263d2f){_0xbdfbe2=_0xbdfbe2-0xeb;const _0x3e7b1b=_0x3e7b();let _0x51582f=_0x3e7b1b[_0xbdfbe2];return _0x51582f;}export async function restoreFeature(_0x40c51b){const _0x18a624=_0x5158,_0x1d3048={'ZnAhg':function(_0x58d3b0,_0x308d23,_0x4614a1){return _0x58d3b0(_0x308d23,_0x4614a1);}},_0x26aea4=await getToken();if(!_0x26aea4)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x11f377=getApiBaseUrl(),_0x3d1702=await _0x1d3048[_0x18a624(0x118)](fetch,_0x11f377+_0x18a624(0x131)+_0x40c51b+'/restore',{'method':_0x18a624(0x114),'headers':{'Authorization':'Bearer\x20'+_0x26aea4}});if(!_0x3d1702['ok']){const _0xf0d55b=await _0x3d1702[_0x18a624(0x10f)]();throw new Error(_0x18a624(0x110)+_0xf0d55b);}}
1
+ (function(_0x3348ba,_0x653be3){const _0x2656b4=_0x1adc,_0x4f8df9=_0x3348ba();while(!![]){try{const _0x1b2ac8=-parseInt(_0x2656b4(0x152))/0x1*(-parseInt(_0x2656b4(0x17e))/0x2)+parseInt(_0x2656b4(0x168))/0x3+parseInt(_0x2656b4(0x139))/0x4*(-parseInt(_0x2656b4(0x17d))/0x5)+parseInt(_0x2656b4(0x13a))/0x6+-parseInt(_0x2656b4(0x16d))/0x7+-parseInt(_0x2656b4(0x16b))/0x8*(-parseInt(_0x2656b4(0x169))/0x9)+-parseInt(_0x2656b4(0x143))/0xa*(-parseInt(_0x2656b4(0x13f))/0xb);if(_0x1b2ac8===_0x653be3)break;else _0x4f8df9['push'](_0x4f8df9['shift']());}catch(_0xa9e6eb){_0x4f8df9['push'](_0x4f8df9['shift']());}}}(_0x2877,0xf335e));function _0x2877(){const _0x49074a=['json','Feature\x20limit\x20exceeded','93407BWOnoZ','QLyMu','GET','toString','kdPok','Lqxub','jhwoE','LmwHj','sNzml','Failed\x20to\x20conclude\x20session:\x20','/report/markdown','pcvIN','stringify','limit','/conclude','zCOHn','nxOJe','xrazM','zjUHv','/sessions/','Bearer\x20','/sessions','4218903sSAFCx','9uGIkiE','/restore','3432128rhNcZT','GzXfa','13602729eKvFdu','itemIds','QQFOw','POST','mrucw','dKYsc','/action-items','SSJPk','DyziP','status','updateChecklistItem','Failed\x20to\x20list\x20sessions:\x20','/api/v1/mcp/features','text','klJKL','jnlBI','10CxrQjP','12FJVeMu','hpufn','uZjMK','set','https://dashboard.ranger.net/billing','843204MiSpag','1141170QNSYbH','gitRepoUrl','gitBranch','/start','/api/v1/mcp/features/','11sAiFzp','style','application/json','kdFlH','7750850GtBdfD','Failed\x20to\x20update\x20feature\x20review:\x20','offset','VXcVM','sessionId','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20','fUeQE','ioRhB','wZOME','includeDeleted','PATCH','/comments/address'];_0x2877=function(){return _0x49074a;};return _0x2877();}import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';function _0x1adc(_0x1c5e90,_0x567c72){_0x1c5e90=_0x1c5e90-0x137;const _0x28779f=_0x2877();let _0x1adc97=_0x28779f[_0x1c5e90];return _0x1adc97;}export async function createFeature(_0x3a78b4){const _0x3941e6=_0x1adc,_0xad874e={'VXcVM':function(_0x4a9b51){return _0x4a9b51();},'SSJPk':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','QQFOw':_0x3941e6(0x141),'hpufn':function(_0x31a100,_0x5b071a){return _0x31a100===_0x5b071a;}},_0x417288=await _0xad874e[_0x3941e6(0x146)](getToken);if(!_0x417288)throw new Error(_0xad874e[_0x3941e6(0x174)]);const _0x586815=getApiBaseUrl(),_0x171277=await fetch(_0x586815+_0x3941e6(0x179),{'method':_0x3941e6(0x170),'headers':{'Authorization':'Bearer\x20'+_0x417288,'Content-Type':_0xad874e[_0x3941e6(0x16f)]},'body':JSON[_0x3941e6(0x15e)](_0x3a78b4)});if(!_0x171277['ok']){if(_0xad874e[_0x3941e6(0x17f)](_0x171277[_0x3941e6(0x176)],0x192)){const _0x47598b=await _0x171277[_0x3941e6(0x150)](),_0x4cfde4=_0x47598b['billingUrl']||_0x3941e6(0x138);throw new Error((_0x47598b['message']||_0x3941e6(0x151))+'\x0a\x0aUpgrade\x20your\x20plan:\x20'+_0x4cfde4);}const _0x56f53c=await _0x171277[_0x3941e6(0x17a)]();throw new Error('Failed\x20to\x20create\x20feature\x20review:\x20'+_0x56f53c);}return _0x171277[_0x3941e6(0x150)]();}export async function listFeatures(_0x248d69){const _0x175a38=_0x1adc,_0x574d65={'Lqxub':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','kdFlH':_0x175a38(0x13b),'klJKL':_0x175a38(0x15f),'rwVDV':_0x175a38(0x145),'pcvIN':function(_0x4ed2de,_0x5affc4,_0x1d7239){return _0x4ed2de(_0x5affc4,_0x1d7239);}},_0x34b539=await getToken();if(!_0x34b539)throw new Error(_0x574d65[_0x175a38(0x157)]);const _0x3cd001=getApiBaseUrl(),_0x147383=new URLSearchParams();if(_0x248d69?.[_0x175a38(0x13b)])_0x147383[_0x175a38(0x137)](_0x574d65[_0x175a38(0x142)],_0x248d69['gitRepoUrl']);if(_0x248d69?.[_0x175a38(0x13c)])_0x147383['set']('gitBranch',_0x248d69['gitBranch']);if(_0x248d69?.[_0x175a38(0x15f)])_0x147383['set'](_0x574d65[_0x175a38(0x17b)],_0x248d69[_0x175a38(0x15f)]['toString']());if(_0x248d69?.[_0x175a38(0x145)])_0x147383['set'](_0x574d65['rwVDV'],_0x248d69['offset']['toString']());if(_0x248d69?.[_0x175a38(0x14d)])_0x147383['set'](_0x175a38(0x14d),'true');const _0x1d6970=_0x3cd001+_0x175a38(0x179)+(_0x147383['toString']()?'?'+_0x147383['toString']():''),_0x496e6f=await _0x574d65[_0x175a38(0x15d)](fetch,_0x1d6970,{'method':_0x175a38(0x154),'headers':{'Authorization':_0x175a38(0x166)+_0x34b539}});if(!_0x496e6f['ok']){const _0x23a93=await _0x496e6f[_0x175a38(0x17a)]();throw new Error('Failed\x20to\x20list\x20feature\x20reviews:\x20'+_0x23a93);}return _0x496e6f['json']();}export async function getFeature(_0x4856ec){const _0x28d5e0=_0x1adc,_0x55bea9={'xrazM':_0x28d5e0(0x148)},_0x230092=await getToken();if(!_0x230092)throw new Error(_0x55bea9[_0x28d5e0(0x163)]);const _0x569f62=getApiBaseUrl(),_0x4b0ac6=await fetch(_0x569f62+_0x28d5e0(0x13e)+_0x4856ec,{'method':'GET','headers':{'Authorization':_0x28d5e0(0x166)+_0x230092}});if(!_0x4b0ac6['ok']){const _0x5b8fb5=await _0x4b0ac6[_0x28d5e0(0x17a)]();throw new Error('Failed\x20to\x20get\x20feature\x20review:\x20'+_0x5b8fb5);}return _0x4b0ac6[_0x28d5e0(0x150)]();}export async function updateFeature(_0x21b444,_0x3d5a8c){const _0xa503f2=_0x1adc,_0x29abd8={'nxOJe':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','sPbBL':function(_0x386d3b,_0x575086,_0x5e70e1){return _0x386d3b(_0x575086,_0x5e70e1);}},_0x53c6e3=await getToken();if(!_0x53c6e3)throw new Error(_0x29abd8[_0xa503f2(0x162)]);const _0x44f42d=getApiBaseUrl(),_0x5e22f5=await _0x29abd8['sPbBL'](fetch,_0x44f42d+_0xa503f2(0x13e)+_0x21b444,{'method':_0xa503f2(0x14e),'headers':{'Authorization':'Bearer\x20'+_0x53c6e3,'Content-Type':_0xa503f2(0x141)},'body':JSON['stringify'](_0x3d5a8c)});if(!_0x5e22f5['ok']){const _0x2aa5be=await _0x5e22f5[_0xa503f2(0x17a)]();throw new Error(_0xa503f2(0x144)+_0x2aa5be);}return _0x5e22f5[_0xa503f2(0x150)]();}export async function createChecklistItem(_0x5698ff,_0x17519e,_0x17bf39){const _0x1fe2f6=_0x1adc,_0x3c3114={'hAiwj':function(_0x302bef){return _0x302bef();},'SQKlo':_0x1fe2f6(0x170),'kdPok':_0x1fe2f6(0x141)},_0xedd788=await _0x3c3114['hAiwj'](getToken);if(!_0xedd788)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x14acd7=getApiBaseUrl(),_0x2ee2ba=await fetch(_0x14acd7+_0x1fe2f6(0x13e)+_0x5698ff+'/checklist',{'method':_0x3c3114['SQKlo'],'headers':{'Authorization':_0x1fe2f6(0x166)+_0xedd788,'Content-Type':_0x3c3114[_0x1fe2f6(0x156)]},'body':JSON[_0x1fe2f6(0x15e)]({'description':_0x17519e,'position':_0x17bf39})});if(!_0x2ee2ba['ok']){const _0x1d0861=await _0x2ee2ba[_0x1fe2f6(0x17a)]();throw new Error('Failed\x20to\x20create\x20scenario:\x20'+_0x1d0861);}return _0x2ee2ba['json']();}export async function updateChecklistItem(_0x294d6d,_0x1bc018,_0x251946){const _0x5cb266=_0x1adc,_0x3ada83={'fUeQE':function(_0x19cf9d){return _0x19cf9d();},'beBoZ':_0x5cb266(0x141),'gefuY':_0x5cb266(0x177)};return withRetry(async()=>{const _0x41185a=_0x5cb266,_0x2639d5=await _0x3ada83[_0x41185a(0x14a)](getToken);if(!_0x2639d5)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x14a19f=getApiBaseUrl(),_0x11397e=await fetch(_0x14a19f+'/api/v1/mcp/features/'+_0x294d6d+'/checklist/'+_0x1bc018,{'method':'PATCH','headers':{'Authorization':_0x41185a(0x166)+_0x2639d5,'Content-Type':_0x3ada83['beBoZ']},'body':JSON['stringify'](_0x251946)});if(!_0x11397e['ok']){const _0x1a85e4=await _0x11397e['text']();throw new Error('Failed\x20to\x20update\x20scenario:\x20'+_0x1a85e4);}return _0x11397e['json']();},{'label':_0x3ada83['gefuY']});}export async function getFeatureReport(_0x102aaf){const _0x453423=_0x1adc,_0x4c2534={'QLyMu':_0x453423(0x154)},_0x29620d=await getToken();if(!_0x29620d)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x41cdd6=getApiBaseUrl(),_0x30d8dc=await fetch(_0x41cdd6+_0x453423(0x13e)+_0x102aaf+'/report',{'method':_0x4c2534[_0x453423(0x153)],'headers':{'Authorization':'Bearer\x20'+_0x29620d}});if(!_0x30d8dc['ok']){const _0x38b5d3=await _0x30d8dc['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x38b5d3);}return _0x30d8dc[_0x453423(0x150)]();}export async function getFeatureReportMarkdown(_0x459807,_0x10a856){const _0x25e2f9=_0x1adc,_0x2002ca={'jhwoE':function(_0x406330){return _0x406330();},'bjObH':function(_0x1cc630){return _0x1cc630();},'jnlBI':function(_0x51ecfe,_0x3ed123){return _0x51ecfe>_0x3ed123;},'LmwHj':function(_0x37c638,_0x10c2a9){return _0x37c638(_0x10c2a9);},'JiQQl':_0x25e2f9(0x16e),'mlJwL':_0x25e2f9(0x147),'sNzml':_0x25e2f9(0x154)},_0x15d64c=await _0x2002ca[_0x25e2f9(0x158)](getToken);if(!_0x15d64c)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x1ccf6b=_0x2002ca['bjObH'](getApiBaseUrl),_0x4f880d=new URLSearchParams(),_0x43a234=_0x2002ca[_0x25e2f9(0x17c)](_0x10a856?.[_0x25e2f9(0x16e)]?.['length']??0x0,0x0),_0x4af2c3=_0x2002ca[_0x25e2f9(0x159)](Boolean,_0x10a856?.[_0x25e2f9(0x147)]);_0x43a234&&_0x10a856?.[_0x25e2f9(0x16e)]&&_0x4f880d['set'](_0x2002ca['JiQQl'],_0x10a856[_0x25e2f9(0x16e)]['join'](','));_0x4af2c3&&_0x10a856?.[_0x25e2f9(0x147)]&&_0x4f880d['set'](_0x2002ca['mlJwL'],_0x10a856[_0x25e2f9(0x147)]);!_0x43a234&&!_0x4af2c3&&_0x10a856?.[_0x25e2f9(0x140)]&&_0x4f880d[_0x25e2f9(0x137)](_0x25e2f9(0x140),_0x10a856[_0x25e2f9(0x140)]);const _0x5a865b=_0x1ccf6b+'/api/v1/mcp/features/'+_0x459807+_0x25e2f9(0x15c),_0x5c55a1=''+_0x5a865b+(_0x4f880d[_0x25e2f9(0x155)]()?'?'+_0x4f880d[_0x25e2f9(0x155)]():''),_0xb9bb88=await fetch(_0x5c55a1,{'method':_0x2002ca[_0x25e2f9(0x15a)],'headers':{'Authorization':'Bearer\x20'+_0x15d64c}});if(!_0xb9bb88['ok']){const _0x55f0f0=await _0xb9bb88['text']();throw new Error(_0x25e2f9(0x149)+_0x55f0f0);}return _0xb9bb88['text']();}export async function listFeatureSessions(_0x364d76){const _0x1c1162=_0x1adc,_0x1add9e={'mrucw':function(_0x4c148f,_0x461e2f,_0x4541e5){return _0x4c148f(_0x461e2f,_0x4541e5);}},_0x4ff5d4=await getToken();if(!_0x4ff5d4)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x504d43=getApiBaseUrl(),_0x30da08=await _0x1add9e[_0x1c1162(0x171)](fetch,_0x504d43+'/api/v1/mcp/features/'+_0x364d76+_0x1c1162(0x167),{'method':'GET','headers':{'Authorization':_0x1c1162(0x166)+_0x4ff5d4}});if(!_0x30da08['ok']){const _0xae651f=await _0x30da08[_0x1c1162(0x17a)]();throw new Error(_0x1c1162(0x178)+_0xae651f);}return _0x30da08[_0x1c1162(0x150)]();}export async function startSession(_0x2c78ce,_0x107860){const _0x1632e1=_0x1adc,_0xb30223={'PgckP':function(_0x43475e){return _0x43475e();}},_0xb7599=await getToken();if(!_0xb7599)throw new Error(_0x1632e1(0x148));const _0x5eb7f0=_0xb30223['PgckP'](getApiBaseUrl),_0x1db8fb=await fetch(_0x5eb7f0+'/api/v1/mcp/features/'+_0x2c78ce+_0x1632e1(0x165)+_0x107860+_0x1632e1(0x13d),{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0xb7599}});if(!_0x1db8fb['ok']){const _0x513b67=await _0x1db8fb['text']();throw new Error('Failed\x20to\x20start\x20session:\x20'+_0x513b67);}return _0x1db8fb[_0x1632e1(0x150)]();}export async function concludeSession(_0x5119a3,_0x1852d8){const _0x137d8d=_0x1adc,_0x3ab2f6={'ioRhB':function(_0x144f2e){return _0x144f2e();},'BrUPq':function(_0x4f4c27,_0x3d08d8,_0x378a03){return _0x4f4c27(_0x3d08d8,_0x378a03);}},_0x1683ef=await getToken();if(!_0x1683ef)throw new Error(_0x137d8d(0x148));const _0xdf3203=_0x3ab2f6[_0x137d8d(0x14b)](getApiBaseUrl),_0x79fd27=await _0x3ab2f6['BrUPq'](fetch,_0xdf3203+_0x137d8d(0x13e)+_0x5119a3+_0x137d8d(0x165)+_0x1852d8+_0x137d8d(0x160),{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x1683ef}});if(!_0x79fd27['ok']){const _0x1ee2bc=await _0x79fd27['text']();throw new Error(_0x137d8d(0x15b)+_0x1ee2bc);}return _0x79fd27['json']();}export async function getActionItems(_0x5c93f5){const _0x310a6b=_0x1adc,_0x31ae30={'uZjMK':_0x310a6b(0x148)},_0x3c9d5b=await getToken();if(!_0x3c9d5b)throw new Error(_0x31ae30[_0x310a6b(0x180)]);const _0x33d4c5=getApiBaseUrl(),_0xb3ba5d=await fetch(_0x33d4c5+_0x310a6b(0x13e)+_0x5c93f5+_0x310a6b(0x173),{'method':_0x310a6b(0x154),'headers':{'Authorization':_0x310a6b(0x166)+_0x3c9d5b}});if(!_0xb3ba5d['ok']){const _0x126973=await _0xb3ba5d[_0x310a6b(0x17a)]();throw new Error('Failed\x20to\x20get\x20action\x20items:\x20'+_0x126973);}return _0xb3ba5d[_0x310a6b(0x150)]();}export async function getItemFeedback(_0x4b8c7c,_0x216540){const _0x3a11d0=_0x1adc,_0x48decf={'DyziP':function(_0x14fb9f){return _0x14fb9f();},'eMkXl':function(_0x14d14b,_0x305f02,_0xce5372){return _0x14d14b(_0x305f02,_0xce5372);}},_0x17bb11=await _0x48decf['DyziP'](getToken);if(!_0x17bb11)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x33f154=_0x48decf[_0x3a11d0(0x175)](getApiBaseUrl),_0x50d1d2=await _0x48decf['eMkXl'](fetch,_0x33f154+_0x3a11d0(0x13e)+_0x4b8c7c+'/checklist-items/'+_0x216540+'/feedback',{'method':'GET','headers':{'Authorization':_0x3a11d0(0x166)+_0x17bb11}});if(!_0x50d1d2['ok']){const _0x4fe779=await _0x50d1d2['text']();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x4fe779);}return _0x50d1d2[_0x3a11d0(0x150)]();}export async function markCommentsAddressed(_0x25f42d,_0x22b296,_0x2c3665){const _0x1ef55a=_0x1adc,_0x127210={'zCOHn':function(_0x320a6f){return _0x320a6f();},'eNYnp':function(_0x5f44fe){return _0x5f44fe();},'zjUHv':_0x1ef55a(0x170),'TBPav':'application/json'},_0x18a5d4=await _0x127210[_0x1ef55a(0x161)](getToken);if(!_0x18a5d4)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x227cd=_0x127210['eNYnp'](getApiBaseUrl),_0x57c066=await fetch(_0x227cd+_0x1ef55a(0x13e)+_0x25f42d+_0x1ef55a(0x14f),{'method':_0x127210[_0x1ef55a(0x164)],'headers':{'Authorization':_0x1ef55a(0x166)+_0x18a5d4,'Content-Type':_0x127210['TBPav']},'body':JSON[_0x1ef55a(0x15e)]({'checklistItemId':_0x22b296,'commentIds':_0x2c3665})});if(!_0x57c066['ok']){const _0x29e1c0=await _0x57c066[_0x1ef55a(0x17a)]();throw new Error('Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20'+_0x29e1c0);}}export async function softDeleteFeature(_0x1bc420){const _0x5b5af9=_0x1adc,_0x4d2ab0={'GzXfa':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','dKYsc':'DELETE'},_0x38ee23=await getToken();if(!_0x38ee23)throw new Error(_0x4d2ab0[_0x5b5af9(0x16c)]);const _0x2e0a87=getApiBaseUrl(),_0x28b69a=await fetch(_0x2e0a87+'/api/v1/mcp/features/'+_0x1bc420,{'method':_0x4d2ab0[_0x5b5af9(0x172)],'headers':{'Authorization':_0x5b5af9(0x166)+_0x38ee23}});if(!_0x28b69a['ok']){const _0xcac15e=await _0x28b69a[_0x5b5af9(0x17a)]();throw new Error('Failed\x20to\x20delete\x20feature\x20review:\x20'+_0xcac15e);}}export async function restoreFeature(_0x44b760){const _0x449cac=_0x1adc,_0xc95574={'wZOME':_0x449cac(0x148),'YrEtq':_0x449cac(0x170)},_0xdba80f=await getToken();if(!_0xdba80f)throw new Error(_0xc95574[_0x449cac(0x14c)]);const _0x5d2c33=getApiBaseUrl(),_0x58cc06=await fetch(_0x5d2c33+'/api/v1/mcp/features/'+_0x44b760+_0x449cac(0x16a),{'method':_0xc95574['YrEtq'],'headers':{'Authorization':'Bearer\x20'+_0xdba80f}});if(!_0x58cc06['ok']){const _0x4a519f=await _0x58cc06['text']();throw new Error('Failed\x20to\x20restore\x20feature\x20review:\x20'+_0x4a519f);}}