@ranger-testing/ranger-cli 3.1.4 → 3.1.5-alpha.aebd071-49

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 +5 -2
@@ -1 +1 @@
1
- const _0x34624b=_0x21a5;(function(_0xe61449,_0x432dd3){const _0x96b5f=_0x21a5,_0x47b6f1=_0xe61449();while(!![]){try{const _0x50193=parseInt(_0x96b5f(0x188))/0x1+parseInt(_0x96b5f(0x1a5))/0x2*(parseInt(_0x96b5f(0x22e))/0x3)+-parseInt(_0x96b5f(0x1f6))/0x4*(parseInt(_0x96b5f(0x184))/0x5)+parseInt(_0x96b5f(0x1e5))/0x6*(parseInt(_0x96b5f(0x1f2))/0x7)+-parseInt(_0x96b5f(0x205))/0x8+-parseInt(_0x96b5f(0x237))/0x9+parseInt(_0x96b5f(0x211))/0xa;if(_0x50193===_0x432dd3)break;else _0x47b6f1['push'](_0x47b6f1['shift']());}catch(_0x31d51d){_0x47b6f1['push'](_0x47b6f1['shift']());}}}(_0x105c,0x8c75c));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x16a05a from'inquirer';import{chromium}from'playwright';function _0x105c(){const _0x37a34d=['stGhI','session_state','2053478thQNpr',');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.','trackPhaseError','Bearer\x20','4xIqLwm','RANGER_TEST_PASSWORD','Browser\x20login\x20timed\x20out\x20before\x20completion.','LfXIs','IYZeq','json','FdvNT','txluT','\x22,\x20attempting\x20login...','EtZoP','trackPhaseStart','cookies','\x20Available:\x20','organizationId','some','5629024CQlZvG','VUTAp','type','\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22','\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20','jGNzc','EFfcF','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','trackPhaseEnd','invalidateOn','361580QBJRtt','trim','\x22.\x0a','tunnel_bridge','uBWoU','\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.','nnIZY','/api/v1/tunnel/sessions','userAgent','\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22','storageStatePath','hLFYp','password','uAPYf','catch','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','storageState','XCDDe','close','QuTfy','detail','not_configured','pNdIf','sLNKF','yREfQ','test_output','Cloud\x20profile\x20\x22','/login','sessionId','3327SLEUKx','TqbTp','OSMuo','mWjZi','jZdcE','prompt','hMPeX','\x20\x20Options:\x0a','kyhcs','389601QrwKHN','origin','wsEndpoint','ilVui','cpSwT','\x20\x20Login\x20successful.\x20Session\x20cached.','3627055LXUlkV','SNOTw','pttcT','nysiT','671244SZSHks','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','env','\x20\x20Auth\x20env\x20\x22','\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a','YfdZm','FVLsd','keys','/api/v1/profiles/','vZcwc','error','length','elapsedMs','API\x20request\x20','agent','NtIst','EDrvh','Browser\x20login\x20timed\x20out\x20after\x20','ambiguous','log','cli:manual-login','Pxifv','environments','goto','domains','gcPRM','status','url','1888MXusng','ZcjcX','\x22\x20failed\x20validation\x20—\x20refreshing...','OVxVi','/api/v1/profiles','SpaWU','GzFBy','code','bPCYy','eSXan','wVMsD','\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22','about:blank','ZCoyc','RwmUA','\x20\x20Cloud\x20profile\x20\x22','telemetry','join','duqtY','force','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','local_ws_error','sessionState','DXgUf','\x20\x20No\x20live\x20session\x20for\x20\x22','sqZJF','\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.','headers','/session','targetUrl','ApiError','auth','clientIp','\x22;\x20proceeding\x20with\x20loginInstructions.','name','tunnel','string','isArray','hIkRd','push','HbkON','loginInstructions','RTnwM','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','JadLZ','envKey','RANGER_TEST_USERNAME','stringify','tunnel_login_cleanup','Kflwb','sessionCheckPath','pw_endpoint','\x20\x20Created\x20cloud\x20profile\x20\x22','tunnel_login_setup','\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20','ZZQnb','\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).','ZgrgQ','environment_key','wVoUN','\x22,\x20refreshing\x20session...','POST','/api/v1/profiles/auth-config','tunnelUrl','6gAJQur','parse','DONxv','setupHeaders','wYGmx','key','DELETE','eBCVD','none','settings','environmentKey'];_0x105c=function(){return _0x37a34d;};return _0x105c();}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(_0x5172ee){const _0x3d7339={'dfqBt':'invalid-url'};try{return new URL(_0x5172ee)['host'];}catch{return _0x3d7339['dfqBt'];}}function errorMessageForTelemetry(_0x198fc4){return _0x198fc4 instanceof Error?_0x198fc4['message']:undefined;}function trackBridgeEvent(_0x387a96,_0x174396){const _0x541ed8=_0x21a5,_0x9356ee={'inazp':'tunnel_bridge_event','kyhcs':function(_0x2ef5fa,_0x40a7da){return _0x2ef5fa===_0x40a7da;},'ChPzD':'tunnel_error','stGhI':_0x541ed8(0x1ba),'HxKhf':_0x541ed8(0x214)};if(!_0x387a96)return;const _0x416f89={'tunnelSessionId':_0x174396['sessionId'],'tunnelEventType':_0x174396[_0x541ed8(0x207)],'connectionId':_0x174396['connectionId'],'code':_0x174396[_0x541ed8(0x1ac)],'reason':_0x174396['reason'],'error':_0x174396['error'],'elapsedMs':_0x174396[_0x541ed8(0x195)],'activeLocalConnections':_0x174396['activeLocalConnections'],'pendingLocalConnections':_0x174396['pendingLocalConnections']};_0x387a96[_0x541ed8(0x20f)](_0x9356ee['inazp'],_0x416f89),(_0x9356ee[_0x541ed8(0x236)](_0x174396['type'],_0x9356ee['ChPzD'])||_0x174396[_0x541ed8(0x207)]===_0x9356ee[_0x541ed8(0x1f0)])&&void _0x387a96[_0x541ed8(0x1f4)](_0x9356ee['HxKhf'],new Error(_0x174396[_0x541ed8(0x193)]??_0x174396[_0x541ed8(0x207)]),_0x416f89);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x31125d=_0x21a5,_0x4255da=await getToken();if(!_0x4255da)throw new Error(_0x31125d(0x189));return _0x4255da;}async function apiRequest(_0x3473eb,_0x1c7605={}){const _0x2e5971=_0x21a5,_0x3760b0={'EtZoP':'string','VUTAp':function(_0x2d738d,_0x3adad2){return _0x2d738d===_0x3adad2;}},_0x1cc977=await requireToken(),_0x3b5fe4=getApiBaseUrl(),_0x590266=await fetch(''+_0x3b5fe4+_0x3473eb,{..._0x1c7605,'headers':{'Authorization':_0x2e5971(0x1f5)+_0x1cc977,'Content-Type':'application/json',..._0x1c7605[_0x2e5971(0x1c0)]??{}}});if(!_0x590266['ok']){let _0x12d7b8='',_0x37a2e8;try{const _0x4d2100=await _0x590266[_0x2e5971(0x1fb)](),_0x38effb=(typeof _0x4d2100['error']===_0x3760b0['EtZoP']?_0x4d2100['error']:undefined)??JSON['stringify'](_0x4d2100);_0x12d7b8=_0x38effb;typeof _0x4d2100['test_output']===_0x3760b0[_0x2e5971(0x1ff)]&&_0x4d2100[_0x2e5971(0x22a)]&&(_0x12d7b8=_0x12d7b8+'\x0a'+_0x4d2100[_0x2e5971(0x22a)]);if(_0x3760b0[_0x2e5971(0x206)](typeof _0x4d2100['code'],_0x2e5971(0x1c9)))_0x37a2e8=_0x4d2100['code'];}catch{_0x12d7b8=_0x590266['statusText'];}throw new ApiError(_0x2e5971(0x196)+_0x3473eb+'\x20failed\x20('+_0x590266['status']+'):\x20'+_0x12d7b8,_0x590266[_0x2e5971(0x1a3)],_0x12d7b8,_0x37a2e8);}if(_0x590266[_0x2e5971(0x1a3)]===0xcc)return undefined;return _0x590266[_0x2e5971(0x1fb)]();}export class ApiError extends Error{['status'];[_0x34624b(0x225)];[_0x34624b(0x1ac)];constructor(_0x1e1509,_0x250690,_0x5ad460,_0x4ac475){const _0x246695=_0x34624b,_0x54b06a={'QuTfy':_0x246695(0x1c3)},_0x2f4ff8='4|3|0|2|1'['split']('|');let _0x1df8d4=0x0;while(!![]){switch(_0x2f4ff8[_0x1df8d4++]){case'0':this[_0x246695(0x225)]=_0x5ad460;continue;case'1':this[_0x246695(0x1c7)]=_0x54b06a[_0x246695(0x224)];continue;case'2':this[_0x246695(0x1ac)]=_0x4ac475;continue;case'3':this['status']=_0x250690;continue;case'4':super(_0x1e1509);continue;}break;}}}export async function fetchCloudProfile(_0x5d1262){const _0x184c82=_0x34624b,_0x199883={'nysiT':function(_0xabbc6c,_0x4e5090){return _0xabbc6c(_0x4e5090);},'Kflwb':function(_0x389f95,_0x2c823d){return _0x389f95 instanceof _0x2c823d;}};try{return await _0x199883[_0x184c82(0x187)](apiRequest,'/api/v1/profiles/'+_0x199883[_0x184c82(0x187)](encodeURIComponent,_0x5d1262));}catch(_0x93df6){if(_0x199883[_0x184c82(0x1d6)](_0x93df6,ApiError)&&_0x93df6['status']===0x194)return null;throw _0x93df6;}}export async function listCloudProfiles(){const _0x505c42={'vIacv':function(_0x30ae4d,_0x2678fc){return _0x30ae4d(_0x2678fc);}},_0x9652e8=await _0x505c42['vIacv'](apiRequest,'/api/v1/profiles');return _0x9652e8['profiles'];}export async function deleteCloudProfile(_0x2521bd){const _0x11d150=_0x34624b,_0xfdc224={'DCMXy':function(_0x33d83c,_0x36714c){return _0x33d83c(_0x36714c);}};try{await apiRequest(_0x11d150(0x191)+_0xfdc224['DCMXy'](encodeURIComponent,_0x2521bd),{'method':_0x11d150(0x1eb)});}catch(_0x446378){if(_0x446378 instanceof ApiError&&_0x446378['status']===0x194)throw new Error(_0x11d150(0x22b)+_0x2521bd+'\x22\x20not\x20found.');throw _0x446378;}}export async function createCloudProfile(_0x2a9c21,_0x2aaa9a,_0x4391a3={}){const _0x3457ec=_0x34624b,_0x1474e1={'wYGmx':function(_0x508b48,_0x56da8f,_0x2e0a77){return _0x508b48(_0x56da8f,_0x2e0a77);},'YovvO':_0x3457ec(0x1e2)},_0x3d11b5={'name':_0x2a9c21};if(_0x2aaa9a)_0x3d11b5[_0x3457ec(0x1df)]=_0x2aaa9a;_0x4391a3[_0x3457ec(0x1ee)]&&Object[_0x3457ec(0x190)](_0x4391a3[_0x3457ec(0x1ee)])['length']>0x0&&(_0x3d11b5[_0x3457ec(0x1ee)]=_0x4391a3[_0x3457ec(0x1ee)]);if(_0x4391a3['username'])_0x3d11b5['username']=_0x4391a3['username'];if(_0x4391a3[_0x3457ec(0x21d)])_0x3d11b5['password']=_0x4391a3['password'];return await _0x1474e1[_0x3457ec(0x1e9)](apiRequest,_0x3457ec(0x1a9),{'method':_0x1474e1['YovvO'],'body':JSON[_0x3457ec(0x1d4)](_0x3d11b5)});}export async function uploadCloudProfileSession(_0x4b02c8,_0x4f4a3f){const _0x5d06e7=_0x34624b,_0x2877e7={'QOtSe':function(_0x58ae70,_0xf17c8f,_0x5b8819){return _0x58ae70(_0xf17c8f,_0x5b8819);},'vaZOB':function(_0x3c5575,_0x2eda0b){return _0x3c5575(_0x2eda0b);}};return await _0x2877e7['QOtSe'](apiRequest,_0x5d06e7(0x191)+_0x2877e7['vaZOB'](encodeURIComponent,_0x4b02c8)+_0x5d06e7(0x1c1),{'method':_0x5d06e7(0x1e2),'body':JSON['stringify']({'session_state':_0x4f4a3f})});}export async function saveCloudProfileCredentials(_0x58e9ae,_0x1484fb,_0x25d945){const _0x459118=_0x34624b,_0x5cd2c4={'lHeJR':function(_0x1447ec,_0x34ff3c,_0x1b4457){return _0x1447ec(_0x34ff3c,_0x1b4457);},'NtIst':function(_0x42e248,_0x4eb1c4){return _0x42e248(_0x4eb1c4);}};await _0x5cd2c4['lHeJR'](apiRequest,_0x459118(0x191)+_0x5cd2c4[_0x459118(0x198)](encodeURIComponent,_0x58e9ae),{'method':'PUT','body':JSON['stringify']({'username':_0x1484fb,'password':_0x25d945})});}export async function fetchAuthConfig(){const _0x42b21b=_0x34624b,_0x26bf1d={'EFfcF':function(_0x496ff8,_0x593b7d){return _0x496ff8 instanceof _0x593b7d;},'RTnwM':function(_0x4ee341,_0x1b6b1c){return _0x4ee341!==_0x1b6b1c;}};try{const _0x50b141=await apiRequest(_0x42b21b(0x1e3));return _0x50b141['auth_config'];}catch(_0x21b27d){return _0x26bf1d[_0x42b21b(0x20c)](_0x21b27d,ApiError)&&_0x26bf1d[_0x42b21b(0x1cf)](_0x21b27d[_0x42b21b(0x1a3)],0x194)&&console['error']('\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20'+_0x21b27d['message']),null;}}async function createTunnelSession(_0x23eef7){const _0x251fd3=_0x34624b,_0x144e1e={'gcPRM':function(_0x5ba87b,_0x3f3fed,_0xa501c){return _0x5ba87b(_0x3f3fed,_0xa501c);},'txluT':_0x251fd3(0x218)};return await _0x144e1e[_0x251fd3(0x1a2)](apiRequest,_0x144e1e[_0x251fd3(0x1fd)],{'method':_0x251fd3(0x1e2),'body':JSON[_0x251fd3(0x1d4)]({'targetUrl':_0x23eef7,'mode':_0x251fd3(0x197)})});}async function deleteTunnelSession(_0x356276){const _0x3e7601=_0x34624b,_0x47f6d4={'OSMuo':function(_0x22b0a0,_0x4735a9,_0x52fdd){return _0x22b0a0(_0x4735a9,_0x52fdd);}};await _0x47f6d4[_0x3e7601(0x230)](apiRequest,'/api/v1/tunnel/sessions/'+_0x356276,{'method':_0x3e7601(0x1eb)});}export function pickAdHocEnvKey(_0x2d3019,_0x857b5b,_0x5940f5){const _0x12ce70=_0x34624b,_0x386e69={'XCDDe':function(_0x4752cb,_0x2823ef,_0x3b6d40){return _0x4752cb(_0x2823ef,_0x3b6d40);},'SNOTw':function(_0x16c104,_0x42a1a0){return _0x16c104 in _0x42a1a0;},'SpaWU':_0x12ce70(0x19b),'jGNzc':function(_0x1e78f3,_0x10ff23){return _0x1e78f3+_0x10ff23;},'dTwqc':function(_0x1175c8,_0x28c162){return _0x1175c8===_0x28c162;},'zKaue':function(_0x4068ae,_0x4daf47){return _0x4068ae===_0x4daf47;}};if(_0x5940f5){if(!_0x2d3019?.[_0x12ce70(0x19f)]?.[_0x5940f5]){const _0x1bb1bb=Object['keys'](_0x2d3019?.[_0x12ce70(0x19f)]??{});throw new Error('Auth\x20environment\x20\x22'+_0x5940f5+_0x12ce70(0x1bf)+(_0x1bb1bb[_0x12ce70(0x194)]?_0x12ce70(0x202)+_0x1bb1bb['join'](',\x20')+'.':_0x12ce70(0x216))+'\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)');}return _0x5940f5;}if(!_0x2d3019)return null;if(_0x857b5b){const _0x8ddab=_0x386e69[_0x12ce70(0x222)](matchAuthEnvironmentExact,_0x857b5b,_0x2d3019);if(_0x8ddab)return _0x8ddab;const _0x39506c=_0x386e69['XCDDe'](matchAuthEnvironmentByHost,_0x857b5b,_0x2d3019);if(_0x39506c&&'key'in _0x39506c)return console[_0x12ce70(0x19c)](_0x12ce70(0x18c)+_0x39506c['key']+'\x22\x20matched\x20by\x20host\x20for\x20'+_0x857b5b+_0x12ce70(0x1dd)),_0x39506c[_0x12ce70(0x1ea)];if(_0x39506c&&_0x386e69[_0x12ce70(0x185)](_0x386e69[_0x12ce70(0x1aa)],_0x39506c))throw new Error('Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20('+_0x39506c['ambiguous'][_0x12ce70(0x1b6)](',\x20')+_0x12ce70(0x1f3));if(needsTunnel(_0x857b5b))throw new Error(_0x386e69['jGNzc'](_0x386e69[_0x12ce70(0x20b)]('No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22'+_0x857b5b+_0x12ce70(0x213)+_0x12ce70(0x18d),_0x12ce70(0x235))+'\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'+_0x857b5b['replace'](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a'),_0x12ce70(0x20a)+_0x857b5b+'\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.'));}if(_0x2d3019['defaultEnvironmentKey'])return _0x2d3019['defaultEnvironmentKey'];const _0x2f33f5=Object[_0x12ce70(0x190)](_0x2d3019['environments']??{});if(_0x386e69['dTwqc'](_0x2f33f5['length'],0x1))return _0x2f33f5[0x0];if(_0x386e69['zKaue'](_0x2f33f5[_0x12ce70(0x194)],0x0))return null;throw new Error(_0x386e69['jGNzc']('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x2f33f5[_0x12ce70(0x1b6)](',\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(_0x247abe,_0x549263,_0x7cfdb3){if(!_0x549263||_0x549263===_0x7cfdb3)return _0x247abe;return _0x247abe+':'+_0x549263;}export async function resolveAdHocProfile(_0x3f7370={},_0x20b223=process['env']){const _0x480a08=_0x34624b,_0x12498f={'ZcjcX':function(_0x56fd3a){return _0x56fd3a();},'DXgUf':function(_0x1f7302,_0x3aadae,_0x28d56c,_0x4dcf3a){return _0x1f7302(_0x3aadae,_0x28d56c,_0x4dcf3a);},'ilVui':function(_0x388599,_0x56d71b){return _0x388599(_0x56d71b);},'Pxifv':function(_0x4506a4,_0x34cd34){return _0x4506a4??_0x34cd34;}},_0x39adf6=_0x20b223[_0x480a08(0x1d3)];if(!_0x39adf6)return null;const _0x151bf8=await _0x12498f[_0x480a08(0x1a6)](fetchAuthConfig),_0x3edb86=_0x12498f[_0x480a08(0x1bc)](pickAdHocEnvKey,_0x151bf8,_0x3f7370['targetUrl'],_0x3f7370[_0x480a08(0x1d2)]);let _0x46236a=adHocProfileName(_0x39adf6,_0x3edb86,_0x151bf8?.['defaultEnvironmentKey']),_0x427e6e=await _0x12498f['ilVui'](fetchCloudProfile,_0x46236a);_0x427e6e&&_0x3edb86&&_0x427e6e['environmentKey']!==_0x3edb86&&(console['log'](_0x480a08(0x1b4)+_0x46236a+_0x480a08(0x209)+(_0x427e6e['environmentKey']??_0x480a08(0x1ed))+_0x480a08(0x21a)+_0x3edb86+'\x22;\x20using\x20\x22'+_0x39adf6+':'+_0x3edb86+'\x22\x20instead.'),_0x46236a=_0x39adf6+':'+_0x3edb86,_0x427e6e=await _0x12498f[_0x480a08(0x181)](fetchCloudProfile,_0x46236a));if(_0x427e6e)return{'name':_0x427e6e[_0x480a08(0x1c7)],'profile':_0x427e6e};const _0x1dd6de=_0x20b223['RANGER_TEST_PASSWORD'],_0x2a5b82=await createCloudProfile(_0x46236a,_0x12498f[_0x480a08(0x19e)](_0x3edb86,undefined),{'username':_0x39adf6,'password':_0x1dd6de});return console['log'](_0x480a08(0x1d9)+_0x2a5b82[_0x480a08(0x1c7)]+'\x22\x20for\x20'+_0x39adf6+(_0x3edb86?'\x20(auth\x20env:\x20'+_0x3edb86+')':'')),{'name':_0x2a5b82['name'],'profile':_0x2a5b82};}export async function writeSessionToLocalCache(_0x7b9367,_0x2b6466,_0x5590b3,_0x3c6638,_0x4abd32,_0x335aec,_0x3c8f15){const _0x5b15b3=_0x34624b,_0x148640={'LfXIs':function(_0x1867be,_0x1d8e95){return _0x1867be(_0x1d8e95);},'YfdZm':function(_0x2ab28b,_0x538e3c,_0x17987f){return _0x2ab28b(_0x538e3c,_0x17987f);},'koDKP':function(_0x1186c4,_0x4c009f,_0x1ca8b9){return _0x1186c4(_0x4c009f,_0x1ca8b9);}},_0x2b384f=_0x148640[_0x5b15b3(0x1f9)](sessionCacheHash,{'orgId':_0x2b6466,'profileName':_0x7b9367,'effectiveBaseUrl':_0x5590b3,'setupHeaders':_0x3c6638,'invalidateOn':_0x3c8f15?.['invalidateOn'],'userAgent':_0x3c8f15?.['userAgent'],'clientIp':_0x3c8f15?.[_0x5b15b3(0x1c5)]}),_0x32b62b=getSessionCachePath(_0x2b384f,_0x7b9367),_0x320dbf=join(getRangerHomeDir(),_0x5b15b3(0x1c4));!_0x148640['LfXIs'](existsSync,_0x320dbf)&&await mkdir(_0x320dbf,{'recursive':!![]});const _0x8ca26d={..._0x4abd32};_0x335aec&&_0x335aec[_0x5b15b3(0x194)]>0x0&&Array[_0x5b15b3(0x1ca)](_0x8ca26d[_0x5b15b3(0x201)])&&(_0x8ca26d['cookies']=_0x148640['YfdZm'](duplicateCookiesForDomains,_0x8ca26d[_0x5b15b3(0x201)],_0x335aec));const _0x489e7e={'cached_at':new Date()['toISOString'](),'session_state':_0x8ca26d};await _0x148640[_0x5b15b3(0x18e)](writeFile,_0x32b62b,JSON[_0x5b15b3(0x1d4)](_0x489e7e,null,0x2));const _0x216cf2=_0x148640[_0x5b15b3(0x1f9)](getStorageStatePath,_0x32b62b);return await _0x148640['koDKP'](writeFile,_0x216cf2,JSON[_0x5b15b3(0x1d4)](_0x8ca26d,null,0x2)),_0x216cf2;}export async function checkLocalCache(_0x53941b,_0x1fa9e3,_0x3a2397,_0x16de63,_0x43855f){const _0x288899=_0x34624b,_0x24a01c={'gkrWZ':function(_0x51e110,_0xe76c02){return _0x51e110(_0xe76c02);},'yREfQ':function(_0x2c1d21,_0x49726b){return _0x2c1d21(_0x49726b);},'TqbTp':function(_0x3fba4c,_0x169bfe,_0x283c43){return _0x3fba4c(_0x169bfe,_0x283c43);}},_0x53442b=sessionCacheHash({'orgId':_0x1fa9e3,'profileName':_0x53941b,'effectiveBaseUrl':_0x3a2397,'setupHeaders':_0x16de63,'invalidateOn':_0x43855f?.['invalidateOn'],'userAgent':_0x43855f?.[_0x288899(0x219)],'clientIp':_0x43855f?.[_0x288899(0x1c5)]}),_0x2fef11=getSessionCachePath(_0x53442b,_0x53941b),_0x1c3cec=getStorageStatePath(_0x2fef11);if(!_0x24a01c['gkrWZ'](existsSync,_0x2fef11)||!_0x24a01c[_0x288899(0x229)](existsSync,_0x1c3cec))return null;try{const _0xfcf701=await _0x24a01c[_0x288899(0x22f)](readFile,_0x2fef11,'utf-8');return JSON[_0x288899(0x1e6)](_0xfcf701),{'storageStatePath':_0x1c3cec};}catch{return null;}}function launchRealBrowser(){return chromium['launch']({'headless':!![]});}function emitSessionValidationHint(_0x31c133,_0x56f22d){const _0x4051ba=_0x34624b,_0x419a6b={'cpSwT':function(_0x1a35c1,_0x38704e){return _0x1a35c1+_0x38704e;}};if(!_0x56f22d||!_0x56f22d[_0x4051ba(0x1a1)]?.[_0x4051ba(0x194)])return;let _0x253359;try{_0x253359=new URL(_0x31c133);}catch{return;}const _0x22b453=[];for(const _0x13977c of _0x56f22d[_0x4051ba(0x1a1)]){try{_0x22b453[_0x4051ba(0x1cc)]({'raw':_0x13977c,'url':new URL(_0x13977c)});}catch{}}if(_0x22b453['length']===0x0)return;if(_0x22b453[_0x4051ba(0x204)](_0x47f13b=>_0x47f13b[_0x4051ba(0x1a4)][_0x4051ba(0x238)]===_0x253359['origin']))return;const _0x45f97d=_0x22b453['map'](_0x1cb4c1=>'\x22'+_0x1cb4c1['raw']+'\x22')['join'](',\x20');console['log'](_0x419a6b[_0x4051ba(0x182)](_0x4051ba(0x1db)+_0x45f97d+';\x20','you\x27re\x20now\x20at\x20\x22'+_0x31c133+'\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20')+_0x4051ba(0x20d));}export async function serverSideLogin(_0x3c60bd,_0x457bee){const _0x38238b=_0x34624b,_0x5da04c={'nGNjQ':function(_0x17275c,_0x303b70){return _0x17275c(_0x303b70);},'nTDrd':_0x38238b(0x1e2),'jZdcE':function(_0x940321,_0x3dd72e){return _0x940321===_0x3dd72e;},'bkEEY':_0x38238b(0x226)},_0x4088d3=process[_0x38238b(0x18b)][_0x38238b(0x1d3)],_0x410879=process['env'][_0x38238b(0x1f7)],_0x4fb899={};if(_0x4088d3)_0x4fb899['username']=_0x4088d3;if(_0x410879)_0x4fb899[_0x38238b(0x21d)]=_0x410879;if(_0x457bee?.[_0x38238b(0x1b8)])_0x4fb899[_0x38238b(0x1b8)]=!![];if(_0x457bee?.['targetUrl'])_0x4fb899['target_url']=_0x457bee[_0x38238b(0x1c2)];_0x457bee?.['tunnel']&&(_0x4fb899['tunnel_session_id']=_0x457bee[_0x38238b(0x1c8)]['sessionId'],_0x4fb899[_0x38238b(0x1d8)]=_0x457bee['tunnel']['pwEndpoint']);try{return await apiRequest('/api/v1/profiles/'+_0x5da04c['nGNjQ'](encodeURIComponent,_0x3c60bd)+_0x38238b(0x22c),{'method':_0x5da04c['nTDrd'],'body':JSON[_0x38238b(0x1d4)](_0x4fb899)});}catch(_0x309a54){if(_0x309a54 instanceof ApiError&&_0x309a54['status']===0x190&&_0x5da04c[_0x38238b(0x232)](_0x309a54[_0x38238b(0x1ac)],'not_configured'))return{'status':_0x5da04c['bkEEY'],'error':_0x309a54[_0x38238b(0x225)]};throw _0x309a54;}}function _0x21a5(_0xaf58a0,_0x4d09a3){_0xaf58a0=_0xaf58a0-0x181;const _0x105ca5=_0x105c();let _0x21a595=_0x105ca5[_0xaf58a0];return _0x21a595;}async function serverSideLoginWithOptionalTunnel(_0x533f00,_0x12c7ec,_0x439250={}){const _0xb9a559=_0x34624b,_0x431242={'EDrvh':function(_0x45b413,_0x406260){return _0x45b413(_0x406260);},'GzFBy':function(_0x290414,_0x527338){return _0x290414(_0x527338);},'FdvNT':function(_0x3c5ac0,_0x51063b){return _0x3c5ac0(_0x51063b);},'RwmUA':function(_0x4011a5,_0x551137){return _0x4011a5===_0x551137;},'hMPeX':'true','WwoQz':'\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','IYZeq':function(_0x5880cb){return _0x5880cb();},'KIITv':'tunnel_login_request','hIkRd':function(_0x29880e,_0x4b0f6c,_0x347d05){return _0x29880e(_0x4b0f6c,_0x347d05);},'HbkON':function(_0x59e529,_0x13418b){return _0x59e529??_0x13418b;},'JdaLZ':'tunnel_login_cleanup'};if(!_0x431242[_0xb9a559(0x1fc)](needsTunnel,_0x12c7ec))return await serverSideLogin(_0x533f00,{'force':_0x439250['force']});let _0x1bfc81=null,_0x5bf0af=null,_0x23b952=null,_0x375b22=null,_0x3341c6=![];const _0x51979b=process[_0xb9a559(0x18b)]['RANGER_TUNNEL_LOGIN_HEADED']?.['toLowerCase'](),_0x369872=_0x431242[_0xb9a559(0x1b3)](_0x51979b,'1')||_0x51979b===_0x431242[_0xb9a559(0x234)],_0x46bbcd={'profileName':_0x533f00,'targetUrlHost':targetHostForTelemetry(_0x12c7ec),'tunnelRequired':!![],'forceLogin':_0x431242[_0xb9a559(0x199)](Boolean,_0x439250[_0xb9a559(0x1b8)]),'localBrowserServerHeaded':_0x369872};try{_0x439250[_0xb9a559(0x1b5)]?.[_0xb9a559(0x200)]('tunnel_login_setup',_0x46bbcd);_0x369872&&console[_0xb9a559(0x19c)](_0x431242['WwoQz']);_0x1bfc81=await launchBrowserServer({'headless':!_0x369872}),_0x5bf0af=await createTunnelSession(_0x12c7ec);const _0x48524c=await _0x431242[_0xb9a559(0x1fa)](requireToken);_0x23b952=await createTunnelBridge({'localWsUrl':_0x1bfc81[_0xb9a559(0x239)],'tunnelServerUrl':_0x5bf0af[_0xb9a559(0x1e4)],'sessionId':_0x5bf0af['sessionId'],'apiKey':_0x48524c,'onError':_0x2e81c9=>{_0x375b22=_0x2e81c9;},'onClose':()=>{_0x375b22??=new Error('Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20'+_0x533f00);},'onEvent':_0xb71e77=>trackBridgeEvent(_0x439250[_0xb9a559(0x1b5)],_0xb71e77)}),_0x439250['telemetry']?.[_0xb9a559(0x20f)](_0xb9a559(0x1da),{..._0x46bbcd,'tunnelSessionId':_0x5bf0af['sessionId'],'localBrowserServer':!![],'localBrowserServerHeaded':_0x369872}),_0x3341c6=!![];try{return _0x439250[_0xb9a559(0x1b5)]?.[_0xb9a559(0x200)](_0x431242['KIITv'],{..._0x46bbcd,'tunnelSessionId':_0x5bf0af[_0xb9a559(0x22d)]}),await _0x431242[_0xb9a559(0x1cb)](serverSideLogin,_0x533f00,{'force':_0x439250['force'],'targetUrl':_0x12c7ec,'tunnel':{'sessionId':_0x5bf0af[_0xb9a559(0x22d)],'pwEndpoint':_0x5bf0af['pwEndpoint']}})['then'](_0x3b1398=>{const _0x1f698e=_0xb9a559;return _0x439250['telemetry']?.[_0x1f698e(0x20f)]('tunnel_login_request',{..._0x46bbcd,'tunnelSessionId':_0x5bf0af?.['sessionId'],'loginStatus':_0x3b1398[_0x1f698e(0x1a3)],'hasSessionState':_0x431242['EDrvh'](Boolean,_0x3b1398[_0x1f698e(0x1f1)]),'hasTestOutput':_0x431242[_0x1f698e(0x1ab)](Boolean,_0x3b1398[_0x1f698e(0x22a)]),'bridgeError':_0x431242['EDrvh'](errorMessageForTelemetry,_0x375b22)}),_0x3b1398;});}catch(_0x4ee46c){await _0x439250['telemetry']?.['trackPhaseError'](_0x431242['KIITv'],_0x375b22??_0x4ee46c,{..._0x46bbcd,'tunnelSessionId':_0x5bf0af[_0xb9a559(0x22d)],'bridgeError':errorMessageForTelemetry(_0x375b22)});throw _0x431242[_0xb9a559(0x1cd)](_0x375b22,_0x4ee46c);}}catch(_0x343546){!_0x3341c6&&await _0x439250['telemetry']?.[_0xb9a559(0x1f4)](_0xb9a559(0x1da),_0x343546,{..._0x46bbcd,'tunnelSessionId':_0x5bf0af?.['sessionId']});throw _0x343546;}finally{(_0x5bf0af||_0x1bfc81||_0x23b952)&&(_0x439250[_0xb9a559(0x1b5)]?.['trackPhaseStart'](_0x431242['JdaLZ'],{..._0x46bbcd,'tunnelSessionId':_0x5bf0af?.[_0xb9a559(0x22d)]}),_0x23b952?.[_0xb9a559(0x223)](),_0x1bfc81&&await _0x1bfc81['close']()[_0xb9a559(0x21f)](()=>{}),_0x5bf0af&&await deleteTunnelSession(_0x5bf0af['sessionId'])[_0xb9a559(0x21f)](()=>{}),_0x439250['telemetry']?.[_0xb9a559(0x20f)](_0xb9a559(0x1d5),{..._0x46bbcd,'tunnelSessionId':_0x5bf0af?.['sessionId']}));}}export async function manualBrowserLogin(_0x3df7ff,_0x22d07a,_0x5108b7={}){const _0x2a13d2=_0x34624b,_0x511f88={'wVoUN':function(_0x160130,_0x4ef26c){return _0x160130/_0x4ef26c;},'eSXan':function(_0xee7ae7,_0x4d72cd){return _0xee7ae7(_0x4d72cd);},'ZZQnb':'close','nnIZY':function(_0x97243){return _0x97243();},'wVMsD':function(_0x4c9ed8,_0x56ca21){return _0x4c9ed8+_0x56ca21;},'fLPou':function(_0x2e8caa,_0x43c692){return _0x2e8caa+_0x43c692;},'uAPYf':'or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','BcMOU':function(_0x24ccdd,_0x30b951){return _0x24ccdd>_0x30b951;},'APgox':_0x2a13d2(0x1b1),'JadLZ':_0x2a13d2(0x208),'qtbrP':function(_0x4b6c1d,_0x26624f){return _0x4b6c1d(_0x26624f);},'AbDAJ':_0x2a13d2(0x18a),'sqZJF':function(_0x56c86b,_0x1bac3e){return _0x56c86b!==_0x1bac3e;},'Ndyph':'POST','ZgrgQ':_0x2a13d2(0x19d)};if(!_0x511f88[_0x2a13d2(0x217)](isInteractive))throw new Error(_0x511f88[_0x2a13d2(0x1af)](_0x511f88['fLPou']('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x3df7ff[_0x2a13d2(0x1c7)]+'\x22.\x0a','\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20'),_0x511f88[_0x2a13d2(0x21e)]));const _0x4c045f=_0x22d07a&&_0x511f88['BcMOU'](_0x22d07a['domains']['length'],0x0)?_0x22d07a[_0x2a13d2(0x1a1)][0x0]:_0x511f88['APgox'];console['log'](_0x511f88[_0x2a13d2(0x1d1)]),console[_0x2a13d2(0x19c)]('\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a'),await new Promise(_0x386f97=>setTimeout(_0x386f97,0x7d0));const _0x35bcb8=await chromium['launch']({'headless':![]});let _0x21c4ad=null;try{const _0x20abf8={'ignoreHTTPSErrors':!![]};_0x22d07a?.[_0x2a13d2(0x1e8)]&&(_0x20abf8['extraHTTPHeaders']=_0x22d07a[_0x2a13d2(0x1e8)]);const _0x2d4389=await _0x35bcb8['newContext'](_0x20abf8);await _0x511f88['qtbrP'](addProfileSetupBanner,_0x2d4389);const _0x3466fe=await _0x2d4389['newPage']();await _0x3466fe[_0x2a13d2(0x1a0)](_0x4c045f);let _0x571f13=![];await new Promise(_0x19f492=>{const _0x208af4=_0x2a13d2,_0x333dd6=setTimeout(()=>{const _0x4523cd=_0x21a5;_0x571f13=!![],console[_0x4523cd(0x193)](_0x4523cd(0x19a)+_0x511f88[_0x4523cd(0x1e0)](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x19f492();},MANUAL_LOGIN_TIMEOUT_MS);_0x3466fe['on'](_0x511f88[_0x208af4(0x1dc)],async()=>{const _0x58e730=_0x208af4;_0x511f88[_0x58e730(0x1ae)](clearTimeout,_0x333dd6);try{const _0x117f08=await _0x2d4389[_0x58e730(0x221)]();_0x21c4ad=_0x117f08;}catch{}_0x19f492();});});if(_0x571f13&&!_0x21c4ad)throw new Error(_0x2a13d2(0x1f8));}finally{await _0x35bcb8[_0x2a13d2(0x223)]()['catch'](()=>{});}if(!_0x21c4ad)throw new Error(_0x511f88['AbDAJ']);return _0x511f88[_0x2a13d2(0x1be)](_0x5108b7['persistSessionState'],![])&&await apiRequest(_0x2a13d2(0x191)+_0x511f88['eSXan'](encodeURIComponent,_0x3df7ff['name'])+'/session',{'method':_0x511f88['Ndyph'],'body':JSON['stringify']({'session_state':_0x21c4ad,'updated_by':_0x511f88[_0x2a13d2(0x1de)]})}),{'sessionState':_0x21c4ad};}export async function promptSaveCredentials(_0x239622){const _0xcea68e=_0x34624b,_0x36ffb5={'IpNen':function(_0x415daf){return _0x415daf();},'UTpPT':function(_0x27ebff,_0x59d510,_0x50bf36){return _0x27ebff(_0x59d510,_0x50bf36);},'pNdIf':'PUT','hLFYp':_0xcea68e(0x20e)},_0x3c79ec=process[_0xcea68e(0x18b)]['RANGER_TEST_USERNAME'],_0x105f41=process['env']['RANGER_TEST_PASSWORD'];if(!_0x3c79ec||!_0x105f41)return;if(!_0x36ffb5['IpNen'](isInteractive))return;const {save:_0x4ea4e0}=await _0x16a05a[_0xcea68e(0x233)]([{'type':'confirm','name':'save','message':_0xcea68e(0x220),'default':![]}]);if(!_0x4ea4e0)return;await _0x36ffb5['UTpPT'](apiRequest,_0xcea68e(0x191)+encodeURIComponent(_0x239622),{'method':_0x36ffb5[_0xcea68e(0x227)],'body':JSON[_0xcea68e(0x1d4)]({'username':_0x3c79ec,'password':_0x105f41})}),console[_0xcea68e(0x19c)](_0x36ffb5[_0xcea68e(0x21c)]);}export async function resolveCloudProfileSession(_0x33ffcf,_0x4c22a9={}){const _0x55a4c1=_0x34624b,_0x30fb05={'duqtY':function(_0xeda9b5){return _0xeda9b5();},'kKHkz':function(_0x5e6aaa,_0x3ab3d6){return _0x5e6aaa===_0x3ab3d6;},'eBCVD':'string','vZcwc':function(_0x175033,_0x273b0a){return _0x175033(_0x273b0a);},'EAuIo':function(_0x41fc10,_0x121458){return _0x41fc10>_0x121458;},'OVxVi':function(_0x4b82d7,_0x2a8e17,_0x5a7b99,_0x4f3c7e,_0xd4d53b,_0x4ff2b8){return _0x4b82d7(_0x2a8e17,_0x5a7b99,_0x4f3c7e,_0xd4d53b,_0x4ff2b8);},'inkHy':function(_0x8b1e83,_0xdb64df,_0x2fd15c,_0x495605,_0x48229b){return _0x8b1e83(_0xdb64df,_0x2fd15c,_0x495605,_0x48229b);},'DONxv':function(_0x2cfe5a,_0x35812c,_0x589d96){return _0x2cfe5a(_0x35812c,_0x589d96);},'TzHHw':function(_0x1c8593,_0x104b48,_0x39cb1c,_0x5f4187,_0x4a462a,_0x19c28d,_0x2993fd,_0x597530){return _0x1c8593(_0x104b48,_0x39cb1c,_0x5f4187,_0x4a462a,_0x19c28d,_0x2993fd,_0x597530);},'UMLvM':function(_0x21ec4f,_0x12d062){return _0x21ec4f||_0x12d062;},'FVLsd':function(_0x3daff5,_0x305aba){return _0x3daff5===_0x305aba;},'bPCYy':'not_configured','sLNKF':'\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','bujyx':_0x55a4c1(0x183),'uBWoU':_0x55a4c1(0x1d0),'pttcT':_0x55a4c1(0x1b9),'mWjZi':function(_0x3e4aca,_0x4b7933){return _0x3e4aca instanceof _0x4b7933;},'ZCoyc':function(_0x203d6d,_0x50da4c){return _0x203d6d(_0x50da4c);}},_0x4c0c32=_0x33ffcf['settings']??{},_0x202c0b=await _0x30fb05[_0x55a4c1(0x1b7)](fetchAuthConfig),_0x36ff25=_0x202c0b?resolveAuthEnvironmentLocally(_0x202c0b,_0x33ffcf['environmentKey']):null,_0x7f37be=typeof _0x36ff25?.[_0x55a4c1(0x1ce)]===_0x55a4c1(0x1c9)&&_0x36ff25['loginInstructions']['trim']()?_0x36ff25['loginInstructions']:undefined,_0x1d6bd8=_0x30fb05['kKHkz'](typeof _0x4c0c32[_0x55a4c1(0x1ce)],_0x30fb05[_0x55a4c1(0x1ec)])&&_0x4c0c32['loginInstructions'][_0x55a4c1(0x212)]()?_0x4c0c32[_0x55a4c1(0x1ce)]:undefined,_0x27a766=_0x1d6bd8||!_0x7f37be?_0x4c0c32:{..._0x4c0c32,'loginInstructions':_0x7f37be},_0x38b44d=_0x30fb05[_0x55a4c1(0x192)](Boolean,_0x27a766[_0x55a4c1(0x1ce)]?.[_0x55a4c1(0x212)]()),_0x40f36b=Boolean(_0x4c0c32['forceLogin']||_0x36ff25?.['forceLogin']),_0xb5fea1=_0x36ff25?.['domains'],_0x5261cc=_0x4c0c32['setupHeaders'],_0x5c58be=_0x5261cc??_0x36ff25?.['setupHeaders'],_0x2a0aaa=_0x4c22a9['effectiveBaseUrl']??_0x4c0c32['baseUrl']??(_0xb5fea1&&_0x30fb05['EAuIo'](_0xb5fea1['length'],0x0)?_0xb5fea1[0x0]:''),_0x3ca004=_0x2a0aaa?needsTunnel(_0x2a0aaa):![],_0x1dc633={'invalidateOn':_0x36ff25?.[_0x55a4c1(0x210)],'userAgent':_0x36ff25?.['browserOptions']?.['userAgent']??_0x4c0c32['userAgent']};_0x40f36b&&console['log']('\x20\x20forceLogin\x20enabled\x20for\x20\x22'+_0x33ffcf[_0x55a4c1(0x1c7)]+_0x55a4c1(0x1e1));if(!_0x40f36b){const _0x1fe7b2=await _0x30fb05[_0x55a4c1(0x1a8)](checkLocalCache,_0x33ffcf['name'],_0x33ffcf[_0x55a4c1(0x203)],_0x2a0aaa,_0x5c58be,_0x1dc633);if(_0x1fe7b2){if(_0x2a0aaa&&!_0x3ca004){const _0x13208a=await _0x30fb05['inkHy'](isCachedSessionLive,_0x1fe7b2['storageStatePath'],_0x2a0aaa,{'sessionCheckPath':_0x36ff25?.['sessionCheckPath'],'setupHeaders':_0x5c58be},{'launchBrowser':launchRealBrowser});if(_0x13208a)return console[_0x55a4c1(0x19c)]('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x33ffcf['name']+'\x22'),{'authPath':_0x1fe7b2[_0x55a4c1(0x21b)],'settings':_0x27a766,'resolvedEnv':_0x36ff25};console[_0x55a4c1(0x19c)]('\x20\x20Cached\x20session\x20for\x20\x22'+_0x33ffcf[_0x55a4c1(0x1c7)]+_0x55a4c1(0x1a7)),_0x30fb05['DONxv'](emitSessionValidationHint,_0x2a0aaa,_0x36ff25);}else return _0x3ca004&&console['log']('\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x33ffcf[_0x55a4c1(0x1c7)]+'\x22'),{'authPath':_0x1fe7b2[_0x55a4c1(0x21b)],'settings':_0x27a766,'resolvedEnv':_0x36ff25};}}if(!_0x40f36b&&_0x33ffcf[_0x55a4c1(0x1bb)]){if(_0x3ca004)console[_0x55a4c1(0x19c)](_0x55a4c1(0x1b0)+_0x2a0aaa+'\x22\x20on\x20profile\x20\x22'+_0x33ffcf[_0x55a4c1(0x1c7)]+'\x22');else{const _0x138626=await _0x30fb05['TzHHw'](writeSessionToLocalCache,_0x33ffcf['name'],_0x33ffcf['organizationId'],_0x2a0aaa,_0x5c58be,_0x33ffcf[_0x55a4c1(0x1bb)],_0xb5fea1,_0x1dc633);if(_0x2a0aaa){const _0x531a3b=await isCachedSessionLive(_0x138626,_0x2a0aaa,{'sessionCheckPath':_0x36ff25?.[_0x55a4c1(0x1d7)],'setupHeaders':_0x5c58be},{'launchBrowser':launchRealBrowser});if(_0x531a3b)return console[_0x55a4c1(0x19c)]('\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22'+_0x33ffcf[_0x55a4c1(0x1c7)]+'\x22,\x20cached\x20locally'),{'authPath':_0x138626,'settings':_0x27a766,'resolvedEnv':_0x36ff25};console[_0x55a4c1(0x19c)]('\x20\x20Cloud\x20session\x20for\x20\x22'+_0x33ffcf[_0x55a4c1(0x1c7)]+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),_0x30fb05[_0x55a4c1(0x1e7)](emitSessionValidationHint,_0x2a0aaa,_0x36ff25);}else return{'authPath':_0x138626,'settings':_0x27a766,'resolvedEnv':_0x36ff25};}}if(_0x38b44d)return console['log'](_0x55a4c1(0x1bd)+_0x33ffcf['name']+_0x55a4c1(0x1c6)),{'authPath':undefined,'settings':_0x27a766,'resolvedEnv':_0x36ff25};console['log']('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x33ffcf[_0x55a4c1(0x1c7)]+_0x55a4c1(0x1fe));const _0x4db9d6=Boolean(process['env'][_0x55a4c1(0x1d3)])&&_0x30fb05['vZcwc'](Boolean,process[_0x55a4c1(0x18b)][_0x55a4c1(0x1f7)]),_0x5f56a7=Boolean(_0x33ffcf['username']);if(_0x30fb05['UMLvM'](_0x4db9d6,_0x5f56a7))try{const _0x1d8e5b=_0x2a0aaa?await serverSideLoginWithOptionalTunnel(_0x33ffcf['name'],_0x2a0aaa,{'force':_0x40f36b,'telemetry':_0x4c22a9['telemetry']}):await _0x30fb05[_0x55a4c1(0x1e7)](serverSideLogin,_0x33ffcf[_0x55a4c1(0x1c7)],{'force':_0x40f36b});if(_0x30fb05[_0x55a4c1(0x18f)](_0x1d8e5b['status'],_0x30fb05[_0x55a4c1(0x1ad)]))console[_0x55a4c1(0x19c)](_0x30fb05[_0x55a4c1(0x228)]);else{if(_0x30fb05[_0x55a4c1(0x18f)](_0x1d8e5b['status'],'success')&&_0x1d8e5b[_0x55a4c1(0x1f1)]){console['log'](_0x30fb05['bujyx']);const _0x2ec836=await _0x30fb05['TzHHw'](writeSessionToLocalCache,_0x33ffcf['name'],_0x33ffcf['organizationId'],_0x2a0aaa,_0x5c58be,_0x1d8e5b[_0x55a4c1(0x1f1)],_0xb5fea1,_0x1dc633);return _0x4db9d6&&!_0x5f56a7&&await promptSaveCredentials(_0x33ffcf[_0x55a4c1(0x1c7)]),{'authPath':_0x2ec836,'settings':_0x27a766,'resolvedEnv':_0x36ff25};}else _0x1d8e5b['test_output']&&(console['log'](_0x30fb05[_0x55a4c1(0x215)]),console[_0x55a4c1(0x19c)](_0x1d8e5b[_0x55a4c1(0x22a)])),console['log'](_0x30fb05['pttcT']);}}catch(_0xc72078){console[_0x55a4c1(0x19c)]('\x20\x20Server-side\x20login\x20error:\x20'+(_0x30fb05[_0x55a4c1(0x231)](_0xc72078,Error)?_0xc72078['message']:_0x30fb05[_0x55a4c1(0x1b2)](String,_0xc72078))),console['log'](_0x30fb05[_0x55a4c1(0x186)]);}const _0x2cdd25=_0x36ff25?{..._0x36ff25,'setupHeaders':_0x5c58be}:_0x2a0aaa?{'key':_0x33ffcf[_0x55a4c1(0x1ef)]??'','domains':[_0x2a0aaa],'setupHeaders':_0x5c58be}:null,{sessionState:_0x2cc045}=await manualBrowserLogin(_0x33ffcf,_0x2cdd25,{'persistSessionState':!_0x3ca004}),_0x3675c6=await writeSessionToLocalCache(_0x33ffcf['name'],_0x33ffcf['organizationId'],_0x2a0aaa,_0x5c58be,_0x2cc045,_0xb5fea1,_0x1dc633);return{'authPath':_0x3675c6,'settings':_0x27a766,'resolvedEnv':_0x36ff25};}
1
+ const _0x4cc66b=_0x33f5;(function(_0x3cae3c,_0x484026){const _0x16e8f1=_0x33f5,_0x559c09=_0x3cae3c();while(!![]){try{const _0xfb9191=parseInt(_0x16e8f1(0x1e2))/0x1*(-parseInt(_0x16e8f1(0x1d2))/0x2)+-parseInt(_0x16e8f1(0x21e))/0x3+parseInt(_0x16e8f1(0x270))/0x4+-parseInt(_0x16e8f1(0x245))/0x5+-parseInt(_0x16e8f1(0x283))/0x6*(parseInt(_0x16e8f1(0x1d3))/0x7)+-parseInt(_0x16e8f1(0x1d9))/0x8*(parseInt(_0x16e8f1(0x26a))/0x9)+parseInt(_0x16e8f1(0x24c))/0xa;if(_0xfb9191===_0x484026)break;else _0x559c09['push'](_0x559c09['shift']());}catch(_0x300b72){_0x559c09['push'](_0x559c09['shift']());}}}(_0x20e1,0xcaea0));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x1e4fbc from'inquirer';import{chromium}from'playwright';import{getApiBaseUrl}from'./environment.js';import{getToken}from'./keychain.js';import{getRangerHomeDir}from'./rangerRoot.js';import{addProfileSetupBanner}from'./profileSetupBanner.js';import{duplicateCookiesForDomains,getSessionCachePath,getStorageStatePath,isCachedSessionLive,isInteractive,needsTunnel,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{matchAuthEnvironmentByHost,matchAuthEnvironmentExact}from'./matchAuthEnvironment.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';function targetHostForTelemetry(_0xea255){const _0x2dab9a=_0x33f5,_0x298cf0={'KdmfL':_0x2dab9a(0x218)};try{return new URL(_0xea255)['host'];}catch{return _0x298cf0['KdmfL'];}}function errorMessageForTelemetry(_0x591474){const _0x2454e9=_0x33f5;return _0x591474 instanceof Error?_0x591474[_0x2454e9(0x24e)]:undefined;}function trackBridgeEvent(_0x434bbb,_0x348adf){const _0x2e28db=_0x33f5,_0xecbcf6={'sKPgh':_0x2e28db(0x1ff),'QtJNR':'local_ws_error'};if(!_0x434bbb)return;const _0x39cf9d={'tunnelSessionId':_0x348adf[_0x2e28db(0x1e5)],'tunnelEventType':_0x348adf[_0x2e28db(0x25e)],'connectionId':_0x348adf['connectionId'],'code':_0x348adf['code'],'reason':_0x348adf[_0x2e28db(0x25f)],'error':_0x348adf['error'],'elapsedMs':_0x348adf['elapsedMs'],'activeLocalConnections':_0x348adf[_0x2e28db(0x1fb)],'pendingLocalConnections':_0x348adf['pendingLocalConnections']};_0x434bbb['trackPhaseEnd']('tunnel_bridge_event',_0x39cf9d),(_0x348adf[_0x2e28db(0x25e)]===_0xecbcf6[_0x2e28db(0x23a)]||_0x348adf['type']===_0xecbcf6[_0x2e28db(0x258)])&&void _0x434bbb['trackPhaseError']('tunnel_bridge',new Error(_0x348adf['error']??_0x348adf['type']),_0x39cf9d);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x50021a={'HJZPN':function(_0x162688){return _0x162688();},'mUXUT':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0xfa01bb=await _0x50021a['HJZPN'](getToken);if(!_0xfa01bb)throw new Error(_0x50021a['mUXUT']);return _0xfa01bb;}async function apiRequest(_0x55c645,_0x24f839={}){const _0x5caf54=_0x33f5,_0x372b63={'xwMCa':function(_0x2cb77e){return _0x2cb77e();},'EgohG':'application/json','vYRLh':function(_0x198572,_0x27eb63){return _0x198572===_0x27eb63;},'EEpTB':_0x5caf54(0x271)},_0x2a280d=await _0x372b63['xwMCa'](requireToken),_0x18e5fe=getApiBaseUrl(),_0x1d3322=await fetch(''+_0x18e5fe+_0x55c645,{..._0x24f839,'headers':{'Authorization':_0x5caf54(0x269)+_0x2a280d,'Content-Type':_0x372b63[_0x5caf54(0x1dc)],..._0x24f839[_0x5caf54(0x27d)]??{}}});if(!_0x1d3322['ok']){let _0x2d9f32='',_0x208370;try{const _0x41571c=await _0x1d3322['json'](),_0x27af78=(typeof _0x41571c[_0x5caf54(0x1fe)]==='string'?_0x41571c[_0x5caf54(0x1fe)]:undefined)??JSON[_0x5caf54(0x1fa)](_0x41571c);_0x2d9f32=_0x27af78;_0x372b63['vYRLh'](typeof _0x41571c['test_output'],_0x5caf54(0x271))&&_0x41571c[_0x5caf54(0x1f6)]&&(_0x2d9f32=_0x2d9f32+'\x0a'+_0x41571c[_0x5caf54(0x1f6)]);if(typeof _0x41571c[_0x5caf54(0x25a)]===_0x372b63['EEpTB'])_0x208370=_0x41571c['code'];}catch{_0x2d9f32=_0x1d3322[_0x5caf54(0x225)];}throw new ApiError('API\x20request\x20'+_0x55c645+_0x5caf54(0x223)+_0x1d3322['status']+_0x5caf54(0x21f)+_0x2d9f32,_0x1d3322['status'],_0x2d9f32,_0x208370);}if(_0x1d3322['status']===0xcc)return undefined;return _0x1d3322[_0x5caf54(0x22b)]();}export class ApiError extends Error{['status'];[_0x4cc66b(0x259)];['code'];constructor(_0x29df18,_0x2b5af4,_0x44edcf,_0xb7cff0){const _0x536c0a=_0x4cc66b,_0x260e18={'PEUAb':'ApiError'};super(_0x29df18),this['status']=_0x2b5af4,this['detail']=_0x44edcf,this[_0x536c0a(0x25a)]=_0xb7cff0,this[_0x536c0a(0x1e4)]=_0x260e18[_0x536c0a(0x1f4)];}}export async function fetchCloudProfile(_0x92c461){const _0x4db117=_0x4cc66b,_0x15aacc={'XFbTr':function(_0x58783b,_0x48abdb){return _0x58783b(_0x48abdb);}};try{return await _0x15aacc['XFbTr'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x92c461));}catch(_0xf62e17){if(_0xf62e17 instanceof ApiError&&_0xf62e17[_0x4db117(0x1d5)]===0x194)return null;throw _0xf62e17;}}export async function listCloudProfiles(){const _0x3234a6=_0x4cc66b,_0x58cb28={'AyAFt':_0x3234a6(0x244)},_0x4010ce=await apiRequest(_0x58cb28[_0x3234a6(0x235)]);return _0x4010ce[_0x3234a6(0x26f)];}export async function deleteCloudProfile(_0x28c659){const _0x1f5c37=_0x4cc66b,_0x5e92af={'CwVDU':function(_0xb00e2b,_0x852278,_0x18823f){return _0xb00e2b(_0x852278,_0x18823f);},'dEnRs':function(_0x4b1ff9,_0x2fb6c8){return _0x4b1ff9 instanceof _0x2fb6c8;},'TDPHr':function(_0x474c73,_0x387b93){return _0x474c73===_0x387b93;}};try{await _0x5e92af[_0x1f5c37(0x23e)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x28c659),{'method':_0x1f5c37(0x247)});}catch(_0x432ff6){if(_0x5e92af['dEnRs'](_0x432ff6,ApiError)&&_0x5e92af[_0x1f5c37(0x272)](_0x432ff6[_0x1f5c37(0x1d5)],0x194))throw new Error(_0x1f5c37(0x261)+_0x28c659+_0x1f5c37(0x219));throw _0x432ff6;}}export async function createCloudProfile(_0x57004c,_0xe798be,_0x2d81ad={}){const _0x3eb182=_0x4cc66b,_0x438afb={'YkUVT':function(_0x193962,_0x34e85e){return _0x193962>_0x34e85e;},'NbGuJ':function(_0x3c21b3,_0x265f3,_0x5b252b){return _0x3c21b3(_0x265f3,_0x5b252b);},'GlWHT':'/api/v1/profiles','GHXCf':'POST'},_0x3f3813={'name':_0x57004c};if(_0xe798be)_0x3f3813[_0x3eb182(0x24b)]=_0xe798be;_0x2d81ad[_0x3eb182(0x23b)]&&_0x438afb['YkUVT'](Object['keys'](_0x2d81ad[_0x3eb182(0x23b)])['length'],0x0)&&(_0x3f3813[_0x3eb182(0x23b)]=_0x2d81ad['settings']);if(_0x2d81ad[_0x3eb182(0x1de)])_0x3f3813['username']=_0x2d81ad['username'];if(_0x2d81ad[_0x3eb182(0x257)])_0x3f3813[_0x3eb182(0x257)]=_0x2d81ad['password'];return await _0x438afb['NbGuJ'](apiRequest,_0x438afb['GlWHT'],{'method':_0x438afb[_0x3eb182(0x27e)],'body':JSON['stringify'](_0x3f3813)});}export async function uploadCloudProfileSession(_0x2f9ac4,_0xde6563){const _0x354ca2=_0x4cc66b,_0x5eac73={'sIRSa':function(_0x9968c5,_0x26ac09,_0x2497bd){return _0x9968c5(_0x26ac09,_0x2497bd);},'QQukE':function(_0x58a924,_0x2a5c66){return _0x58a924(_0x2a5c66);},'GadJR':_0x354ca2(0x1fd)};return await _0x5eac73['sIRSa'](apiRequest,'/api/v1/profiles/'+_0x5eac73['QQukE'](encodeURIComponent,_0x2f9ac4)+'/session',{'method':_0x5eac73['GadJR'],'body':JSON[_0x354ca2(0x1fa)]({'session_state':_0xde6563})});}export async function saveCloudProfileCredentials(_0x90e6c2,_0x6329fc,_0x582074){const _0x4e6b76=_0x4cc66b,_0x3988cc={'scpYx':function(_0x46cb25,_0x384d28,_0xd50340){return _0x46cb25(_0x384d28,_0xd50340);},'oSwzb':'PUT'};await _0x3988cc[_0x4e6b76(0x27b)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x90e6c2),{'method':_0x3988cc[_0x4e6b76(0x265)],'body':JSON[_0x4e6b76(0x1fa)]({'username':_0x6329fc,'password':_0x582074})});}export async function fetchAuthConfig(){const _0x174272=_0x4cc66b,_0x58bb19={'DgmYP':'/api/v1/profiles/auth-config','xUHHm':function(_0x1d741a,_0x1d393e){return _0x1d741a instanceof _0x1d393e;}};try{const _0xe03067=await apiRequest(_0x58bb19['DgmYP']);return _0xe03067['auth_config'];}catch(_0x269dab){return _0x58bb19[_0x174272(0x26d)](_0x269dab,ApiError)&&_0x269dab[_0x174272(0x1d5)]!==0x194&&console[_0x174272(0x1fe)]('\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20'+_0x269dab['message']),null;}}async function createTunnelSession(_0x5b2bbb){const _0x2044b0=_0x4cc66b,_0x4d47da={'xTsjT':function(_0x58aae5,_0x131320,_0x32fa49){return _0x58aae5(_0x131320,_0x32fa49);},'wBpwk':'POST'};return await _0x4d47da['xTsjT'](apiRequest,'/api/v1/tunnel/sessions',{'method':_0x4d47da['wBpwk'],'body':JSON['stringify']({'targetUrl':_0x5b2bbb,'mode':_0x2044b0(0x210)})});}async function deleteTunnelSession(_0x428fbf){const _0x1b2b01=_0x4cc66b,_0x5b75e8={'vKqDj':function(_0x487bc8,_0x5c0c60,_0x5750cf){return _0x487bc8(_0x5c0c60,_0x5750cf);},'MdiOf':_0x1b2b01(0x247)};await _0x5b75e8[_0x1b2b01(0x275)](apiRequest,'/api/v1/tunnel/sessions/'+_0x428fbf,{'method':_0x5b75e8[_0x1b2b01(0x255)]});}export function pickAdHocEnvKey(_0x29a3dc,_0x34d830,_0x131ed5){const _0x443678=_0x4cc66b,_0x5733db={'zkOcr':function(_0x18d5db,_0x2a055b){return _0x18d5db+_0x2a055b;},'UOQsO':function(_0x2f7e35,_0x4bdc05,_0xae39de){return _0x2f7e35(_0x4bdc05,_0xae39de);},'YXxHm':function(_0x199f6b,_0x5de071){return _0x199f6b in _0x5de071;},'VMnWR':'key','spvcP':function(_0x3c1b19,_0x5b4af3){return _0x3c1b19 in _0x5b4af3;},'yBPwD':function(_0x14a684,_0x32de7a){return _0x14a684+_0x32de7a;},'AWXqc':function(_0x18d5e1,_0x3605d3){return _0x18d5e1+_0x3605d3;},'UWLly':function(_0x4198a4,_0x60bc03){return _0x4198a4===_0x60bc03;},'cGzPg':function(_0x208ffd,_0x67f4){return _0x208ffd+_0x67f4;}};if(_0x131ed5){if(!_0x29a3dc?.['environments']?.[_0x131ed5]){const _0x4f097c=Object['keys'](_0x29a3dc?.['environments']??{});throw new Error(_0x5733db['zkOcr'](_0x5733db['zkOcr']('Auth\x20environment\x20\x22'+_0x131ed5+'\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.',_0x4f097c[_0x443678(0x22a)]?'\x20Available:\x20'+_0x4f097c[_0x443678(0x206)](',\x20')+'.':_0x443678(0x1fc)),'\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)'));}return _0x131ed5;}if(!_0x29a3dc)return null;if(_0x34d830){const _0x156cb3=matchAuthEnvironmentExact(_0x34d830,_0x29a3dc);if(_0x156cb3)return _0x156cb3;const _0x1934bb=_0x5733db[_0x443678(0x20c)](matchAuthEnvironmentByHost,_0x34d830,_0x29a3dc);if(_0x1934bb&&_0x5733db['YXxHm'](_0x5733db[_0x443678(0x24f)],_0x1934bb))return console['log']('\x20\x20Auth\x20env\x20\x22'+_0x1934bb[_0x443678(0x221)]+_0x443678(0x273)+_0x34d830+_0x443678(0x260)),_0x1934bb[_0x443678(0x221)];if(_0x1934bb&&_0x5733db[_0x443678(0x21c)]('ambiguous',_0x1934bb))throw new Error('Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20('+_0x1934bb['ambiguous'][_0x443678(0x206)](',\x20')+_0x443678(0x1f9));if(needsTunnel(_0x34d830))throw new Error(_0x5733db[_0x443678(0x249)](_0x5733db['zkOcr'](_0x5733db['AWXqc'](_0x443678(0x220)+_0x34d830+'\x22.\x0a','\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a'),'\x20\x20Options:\x0a')+_0x443678(0x1ea)+('\x20\x20-\x20ask\x20your\x20Ranger\x20admin\x20to\x20add\x20\x22'+_0x34d830[_0x443678(0x23c)](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a'),_0x443678(0x27a)+_0x34d830+_0x443678(0x227)));}if(_0x29a3dc[_0x443678(0x266)])return _0x29a3dc['defaultEnvironmentKey'];const _0x2ed76f=Object[_0x443678(0x236)](_0x29a3dc[_0x443678(0x215)]??{});if(_0x5733db['UWLly'](_0x2ed76f[_0x443678(0x22a)],0x1))return _0x2ed76f[0x0];if(_0x2ed76f[_0x443678(0x22a)]===0x0)return null;throw new Error(_0x5733db[_0x443678(0x278)](_0x443678(0x207)+_0x2ed76f[_0x443678(0x206)](',\x20')+_0x443678(0x1d6),'Pass\x20--base-url\x20<your-app-url>\x20so\x20Ranger\x20can\x20match\x20the\x20right\x20one,\x20or\x20create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`.'));}function _0x20e1(){const _0x1b7cfb=['\x20\x20Server-side\x20login\x20error:\x20','env','agent','force','envKey','clientIp','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','environments','/api/v1/profiles/','RANGER_TEST_USERNAME','invalid-url','\x22\x20not\x20found.','\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','NvbuS','spvcP','push','390501EUecdZ','):\x20','No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22','key','telemetry','\x20failed\x20(','organizationId','statusText','\x22;\x20using\x20\x22','\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.','CmATx','\x22,\x20refreshing\x20session...','length','json','/login','jMpsR','close','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','QmdFX','true','setupHeaders','bAcie','storageStatePath','AyAFt','keys','\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22','DbJwo','tunnel','sKPgh','settings','replace','newContext','CwVDU','\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','TlzyB','invalidateOn','uTAbO','then','/api/v1/profiles','7505760YYvAqa','BWVqM','DELETE','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','yBPwD','tunnel_login_cleanup','environment_key','59131540WHSIkx','poIHu','message','VMnWR','Xtjsz','target_url','PfIgt','\x20\x20Cloud\x20profile\x20\x22','pwEndpoint','MdiOf','not_configured','password','QtJNR','detail','code','\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','VefhX','\x20\x20Login\x20successful.\x20Session\x20cached.','type','reason','\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).','Cloud\x20profile\x20\x22','fdnVT','effectiveBaseUrl','cookies','oSwzb','defaultEnvironmentKey','ebvNz','sessionCheckPath','Bearer\x20','1104489OdqeiD','PBCmP','newPage','xUHHm','domains','profiles','116852emFIif','string','TDPHr','\x22\x20matched\x20by\x20host\x20for\x20','XGrSM','vKqDj','PUT','Browser\x20login\x20timed\x20out\x20before\x20completion.','cGzPg','catch','\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20','scpYx','toLowerCase','headers','GHXCf','pw_endpoint','JWZwt','targetUrl','session_state','138ZDVYPw','\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22','VwYIF','\x22,\x20attempting\x20login...','FkhuN','xpOKr','utf-8','60fyPXdO','226807yxhuDa','\x20\x20No\x20live\x20session\x20for\x20\x22','status',').\x20','\x22\x20instead.','loginInstructions','72CJZkQD','trackPhaseEnd','origin','EgohG','\x22\x20on\x20profile\x20\x22','username','KIxtX','userAgent','\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22','54340wDdDsE','isArray','name','sessionId','\x20\x20forceLogin\x20enabled\x20for\x20\x22','tunnel_login_request','persistSessionState','baseUrl','\x20\x20-\x20pass\x20`--env\x20<key>`\x20to\x20pick\x20the\x20auth\x20environment\x20by\x20name,\x20or\x0a','wsEndpoint','launch','XSiDx','environmentKey','RANGER_TEST_PASSWORD','\x22\x20failed\x20validation\x20—\x20re-login\x20needed...','sessionState','you\x27re\x20now\x20at\x20\x22','/session','PEUAb','HNrNP','test_output','DwUlY','trackPhaseStart',');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.','stringify','activeLocalConnections','\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.','POST','error','tunnel_error','deBIf','trackPhaseError','kiqcm','tunnel_login_setup','yiiQo','\x22\x20failed\x20validation\x20—\x20refreshing...','join','Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20(','vXdmo','hpruR','log','IvBPv','UOQsO','wzklJ'];_0x20e1=function(){return _0x1b7cfb;};return _0x20e1();}export function adHocProfileName(_0x564b51,_0x211118,_0x3e5efd){if(!_0x211118||_0x211118===_0x3e5efd)return _0x564b51;return _0x564b51+':'+_0x211118;}export async function resolveAdHocProfile(_0x2278de={},_0x6dde34=process[_0x4cc66b(0x20f)]){const _0x4141e7=_0x4cc66b,_0x47f9ee={'plaDx':function(_0x193a1b,_0xc73c5a){return _0x193a1b&&_0xc73c5a;},'bAcie':function(_0x1c0a94,_0x3f3d5b){return _0x1c0a94!==_0x3f3d5b;},'iYeJr':'none','PBCmP':function(_0x3c9678,_0x488b8c){return _0x3c9678(_0x488b8c);},'JUXOe':function(_0x12335a,_0x439547,_0x5ab9d4,_0x59a1ca){return _0x12335a(_0x439547,_0x5ab9d4,_0x59a1ca);}},_0x3f7662=_0x6dde34[_0x4141e7(0x217)];if(!_0x3f7662)return null;const _0x53439f=await fetchAuthConfig(),_0x5da21f=pickAdHocEnvKey(_0x53439f,_0x2278de['targetUrl'],_0x2278de[_0x4141e7(0x212)]);let _0x11b699=adHocProfileName(_0x3f7662,_0x5da21f,_0x53439f?.['defaultEnvironmentKey']),_0x26e200=await fetchCloudProfile(_0x11b699);_0x47f9ee['plaDx'](_0x26e200,_0x5da21f)&&_0x47f9ee[_0x4141e7(0x233)](_0x26e200['environmentKey'],_0x5da21f)&&(console[_0x4141e7(0x20a)](_0x4141e7(0x253)+_0x11b699+_0x4141e7(0x1e1)+(_0x26e200['environmentKey']??_0x47f9ee['iYeJr'])+_0x4141e7(0x284)+_0x5da21f+_0x4141e7(0x226)+_0x3f7662+':'+_0x5da21f+_0x4141e7(0x1d7)),_0x11b699=_0x3f7662+':'+_0x5da21f,_0x26e200=await _0x47f9ee[_0x4141e7(0x26b)](fetchCloudProfile,_0x11b699));if(_0x26e200)return{'name':_0x26e200['name'],'profile':_0x26e200};const _0x103413=_0x6dde34['RANGER_TEST_PASSWORD'],_0x16a8b6=await _0x47f9ee['JUXOe'](createCloudProfile,_0x11b699,_0x5da21f??undefined,{'username':_0x3f7662,'password':_0x103413});return console[_0x4141e7(0x20a)]('\x20\x20Created\x20cloud\x20profile\x20\x22'+_0x16a8b6[_0x4141e7(0x1e4)]+'\x22\x20for\x20'+_0x3f7662+(_0x5da21f?'\x20(auth\x20env:\x20'+_0x5da21f+')':'')),{'name':_0x16a8b6['name'],'profile':_0x16a8b6};}export async function writeSessionToLocalCache(_0x2b4599,_0xda44c6,_0x580c46,_0x2f2a3a,_0x4fc22b,_0x5316bc,_0x30cd1b){const _0x487d87=_0x4cc66b,_0x14b094={'QmdFX':function(_0x34d4ac,_0x1396ff){return _0x34d4ac(_0x1396ff);},'DbJwo':function(_0x283701,_0xaaae58,_0x3f3c5d){return _0x283701(_0xaaae58,_0x3f3c5d);},'mxTlI':function(_0x381810){return _0x381810();},'CyTPS':'auth','poIHu':function(_0x487256,_0x344458){return _0x487256>_0x344458;},'SUJJw':function(_0x175226,_0x2fe2dc,_0x4d9e58){return _0x175226(_0x2fe2dc,_0x4d9e58);}},_0x3db42c=_0x14b094[_0x487d87(0x230)](sessionCacheHash,{'orgId':_0xda44c6,'profileName':_0x2b4599,'effectiveBaseUrl':_0x580c46,'setupHeaders':_0x2f2a3a,'invalidateOn':_0x30cd1b?.[_0x487d87(0x241)],'userAgent':_0x30cd1b?.['userAgent'],'clientIp':_0x30cd1b?.[_0x487d87(0x213)]}),_0x16ae64=_0x14b094[_0x487d87(0x238)](getSessionCachePath,_0x3db42c,_0x2b4599),_0x1064bc=_0x14b094[_0x487d87(0x238)](join,_0x14b094['mxTlI'](getRangerHomeDir),_0x14b094['CyTPS']);!_0x14b094['QmdFX'](existsSync,_0x1064bc)&&await mkdir(_0x1064bc,{'recursive':!![]});const _0x47de09={..._0x4fc22b};_0x5316bc&&_0x14b094[_0x487d87(0x24d)](_0x5316bc['length'],0x0)&&Array[_0x487d87(0x1e3)](_0x47de09[_0x487d87(0x264)])&&(_0x47de09[_0x487d87(0x264)]=_0x14b094['DbJwo'](duplicateCookiesForDomains,_0x47de09['cookies'],_0x5316bc));const _0x33707f={'cached_at':new Date()['toISOString'](),'session_state':_0x47de09};await _0x14b094['SUJJw'](writeFile,_0x16ae64,JSON['stringify'](_0x33707f,null,0x2));const _0x43d931=_0x14b094['QmdFX'](getStorageStatePath,_0x16ae64);return await writeFile(_0x43d931,JSON[_0x487d87(0x1fa)](_0x47de09,null,0x2)),_0x43d931;}export async function checkLocalCache(_0x6b85c8,_0x2d4d9c,_0x2d6845,_0x172cf5,_0x48175f){const _0x471e17=_0x4cc66b,_0x107c0e={'NvbuS':function(_0x3b63b5,_0x528b9e){return _0x3b63b5(_0x528b9e);},'KIxtX':function(_0x1e7c4d,_0x2c26ac,_0x278e71){return _0x1e7c4d(_0x2c26ac,_0x278e71);},'EcLUL':function(_0x125a10,_0x1ceb61){return _0x125a10(_0x1ceb61);},'OWYET':function(_0x8f2080,_0x31a68f){return _0x8f2080(_0x31a68f);},'BWVqM':_0x471e17(0x1d1)},_0x107864=_0x107c0e[_0x471e17(0x21b)](sessionCacheHash,{'orgId':_0x2d4d9c,'profileName':_0x6b85c8,'effectiveBaseUrl':_0x2d6845,'setupHeaders':_0x172cf5,'invalidateOn':_0x48175f?.[_0x471e17(0x241)],'userAgent':_0x48175f?.[_0x471e17(0x1e0)],'clientIp':_0x48175f?.['clientIp']}),_0x45c9db=_0x107c0e[_0x471e17(0x1df)](getSessionCachePath,_0x107864,_0x6b85c8),_0x592387=_0x107c0e['EcLUL'](getStorageStatePath,_0x45c9db);if(!_0x107c0e['EcLUL'](existsSync,_0x45c9db)||!_0x107c0e['OWYET'](existsSync,_0x592387))return null;try{const _0x4fc9a5=await readFile(_0x45c9db,_0x107c0e[_0x471e17(0x246)]);return JSON['parse'](_0x4fc9a5),{'storageStatePath':_0x592387};}catch{return null;}}function launchRealBrowser(){const _0x15ed88=_0x4cc66b;return chromium[_0x15ed88(0x1ec)]({'headless':!![]});}function emitSessionValidationHint(_0x5f1bd9,_0x2d3c55){const _0x556b37=_0x4cc66b,_0x4be72a={'ufesP':function(_0x29cda3,_0x3cc9d1){return _0x29cda3+_0x3cc9d1;}};if(!_0x2d3c55||!_0x2d3c55[_0x556b37(0x26e)]?.['length'])return;let _0x433c0f;try{_0x433c0f=new URL(_0x5f1bd9);}catch{return;}const _0x5577fa=[];for(const _0x448919 of _0x2d3c55[_0x556b37(0x26e)]){try{_0x5577fa[_0x556b37(0x21d)]({'raw':_0x448919,'url':new URL(_0x448919)});}catch{}}if(_0x5577fa[_0x556b37(0x22a)]===0x0)return;if(_0x5577fa['some'](_0x2295e4=>_0x2295e4['url'][_0x556b37(0x1db)]===_0x433c0f[_0x556b37(0x1db)]))return;const _0x22b89d=_0x5577fa['map'](_0xa968c3=>'\x22'+_0xa968c3['raw']+'\x22')['join'](',\x20');console['log'](_0x4be72a['ufesP']('\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20'+_0x22b89d+';\x20',_0x556b37(0x1f2)+_0x5f1bd9+'\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20')+_0x556b37(0x22f));}export async function serverSideLogin(_0x14f0b8,_0x108ab0){const _0x136c2b=_0x4cc66b,_0x120262={'rwzCo':function(_0x1e4671,_0x2da473,_0x1c3c2a){return _0x1e4671(_0x2da473,_0x1c3c2a);},'hbFmS':function(_0x3034a8,_0x34d1f1){return _0x3034a8 instanceof _0x34d1f1;},'deBIf':function(_0x11ed86,_0x280d54){return _0x11ed86===_0x280d54;}},_0x4a1e58=process[_0x136c2b(0x20f)][_0x136c2b(0x217)],_0x328d38=process[_0x136c2b(0x20f)][_0x136c2b(0x1ef)],_0x5a1de1={};if(_0x4a1e58)_0x5a1de1[_0x136c2b(0x1de)]=_0x4a1e58;if(_0x328d38)_0x5a1de1['password']=_0x328d38;if(_0x108ab0?.['force'])_0x5a1de1['force']=!![];if(_0x108ab0?.[_0x136c2b(0x281)])_0x5a1de1[_0x136c2b(0x251)]=_0x108ab0[_0x136c2b(0x281)];_0x108ab0?.['tunnel']&&(_0x5a1de1['tunnel_session_id']=_0x108ab0['tunnel']['sessionId'],_0x5a1de1[_0x136c2b(0x27f)]=_0x108ab0[_0x136c2b(0x239)][_0x136c2b(0x254)]);try{return await _0x120262['rwzCo'](apiRequest,_0x136c2b(0x216)+encodeURIComponent(_0x14f0b8)+_0x136c2b(0x22c),{'method':_0x136c2b(0x1fd),'body':JSON['stringify'](_0x5a1de1)});}catch(_0x4ef48a){if(_0x120262['hbFmS'](_0x4ef48a,ApiError)&&_0x120262['deBIf'](_0x4ef48a[_0x136c2b(0x1d5)],0x190)&&_0x120262[_0x136c2b(0x200)](_0x4ef48a[_0x136c2b(0x25a)],_0x136c2b(0x256)))return{'status':_0x136c2b(0x256),'error':_0x4ef48a['detail']};throw _0x4ef48a;}}async function serverSideLoginWithOptionalTunnel(_0x36b3b6,_0x989f12,_0x57f573={}){const _0x4d888a=_0x4cc66b,_0x10176b={'hpruR':_0x4d888a(0x1e7),'VwYIF':function(_0x41995d,_0x5962ee){return _0x41995d(_0x5962ee);},'Xtjsz':function(_0xeacf38,_0x1f5337){return _0xeacf38(_0x1f5337);},'dWGDx':function(_0x11f135,_0x50b0f6,_0x313341){return _0x11f135(_0x50b0f6,_0x313341);},'yiiQo':'tunnel_login_setup','IvBPv':_0x4d888a(0x21a),'EMrBm':function(_0x4c7f0f,_0x14aa95){return _0x4c7f0f(_0x14aa95);},'kiqcm':function(_0x14a5b2){return _0x14a5b2();},'XGrSM':function(_0xdea0e2,_0x32ef6c,_0x781302){return _0xdea0e2(_0x32ef6c,_0x781302);},'hWlJa':function(_0x1e16da,_0x3a2453){return _0x1e16da??_0x3a2453;},'TJqYU':function(_0x3aad02,_0x507565){return _0x3aad02??_0x507565;},'DzmBc':_0x4d888a(0x24a)};if(!_0x10176b['Xtjsz'](needsTunnel,_0x989f12))return await _0x10176b['dWGDx'](serverSideLogin,_0x36b3b6,{'force':_0x57f573['force']});let _0x21ef48=null,_0x320737=null,_0x3727cf=null,_0x378344=null,_0x5075b5=![];const _0x54c353=process[_0x4d888a(0x20f)]['RANGER_TUNNEL_LOGIN_HEADED']?.[_0x4d888a(0x27c)](),_0x2c47b5=_0x54c353==='1'||_0x54c353===_0x4d888a(0x231),_0x27f5bf={'profileName':_0x36b3b6,'targetUrlHost':targetHostForTelemetry(_0x989f12),'tunnelRequired':!![],'forceLogin':_0x10176b[_0x4d888a(0x285)](Boolean,_0x57f573[_0x4d888a(0x211)]),'localBrowserServerHeaded':_0x2c47b5};try{_0x57f573[_0x4d888a(0x222)]?.[_0x4d888a(0x1f8)](_0x10176b[_0x4d888a(0x204)],_0x27f5bf);_0x2c47b5&&console[_0x4d888a(0x20a)](_0x10176b[_0x4d888a(0x20b)]);_0x21ef48=await _0x10176b['Xtjsz'](launchBrowserServer,{'headless':!_0x2c47b5}),_0x320737=await _0x10176b['EMrBm'](createTunnelSession,_0x989f12);const _0x33b9f3=await _0x10176b[_0x4d888a(0x202)](requireToken);_0x3727cf=await _0x10176b[_0x4d888a(0x250)](createTunnelBridge,{'localWsUrl':_0x21ef48[_0x4d888a(0x1eb)],'tunnelServerUrl':_0x320737['tunnelUrl'],'sessionId':_0x320737[_0x4d888a(0x1e5)],'apiKey':_0x33b9f3,'onError':_0x163e1e=>{_0x378344=_0x163e1e;},'onClose':()=>{_0x378344??=new Error('Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20'+_0x36b3b6);},'onEvent':_0x4a3f99=>trackBridgeEvent(_0x57f573[_0x4d888a(0x222)],_0x4a3f99)}),_0x57f573['telemetry']?.[_0x4d888a(0x1da)](_0x10176b['yiiQo'],{..._0x27f5bf,'tunnelSessionId':_0x320737[_0x4d888a(0x1e5)],'localBrowserServer':!![],'localBrowserServerHeaded':_0x2c47b5}),_0x5075b5=!![];try{return _0x57f573['telemetry']?.[_0x4d888a(0x1f8)](_0x4d888a(0x1e7),{..._0x27f5bf,'tunnelSessionId':_0x320737[_0x4d888a(0x1e5)]}),await _0x10176b[_0x4d888a(0x274)](serverSideLogin,_0x36b3b6,{'force':_0x57f573[_0x4d888a(0x211)],'targetUrl':_0x989f12,'tunnel':{'sessionId':_0x320737[_0x4d888a(0x1e5)],'pwEndpoint':_0x320737['pwEndpoint']}})[_0x4d888a(0x243)](_0x4ac9eb=>{const _0x593b6d=_0x4d888a;return _0x57f573['telemetry']?.['trackPhaseEnd'](_0x10176b[_0x593b6d(0x209)],{..._0x27f5bf,'tunnelSessionId':_0x320737?.[_0x593b6d(0x1e5)],'loginStatus':_0x4ac9eb[_0x593b6d(0x1d5)],'hasSessionState':Boolean(_0x4ac9eb[_0x593b6d(0x282)]),'hasTestOutput':Boolean(_0x4ac9eb[_0x593b6d(0x1f6)]),'bridgeError':_0x10176b[_0x593b6d(0x285)](errorMessageForTelemetry,_0x378344)}),_0x4ac9eb;});}catch(_0x486349){await _0x57f573[_0x4d888a(0x222)]?.['trackPhaseError'](_0x10176b['hpruR'],_0x10176b['hWlJa'](_0x378344,_0x486349),{..._0x27f5bf,'tunnelSessionId':_0x320737['sessionId'],'bridgeError':_0x10176b['VwYIF'](errorMessageForTelemetry,_0x378344)});throw _0x10176b['TJqYU'](_0x378344,_0x486349);}}catch(_0x572d55){!_0x5075b5&&await _0x57f573['telemetry']?.[_0x4d888a(0x201)](_0x4d888a(0x203),_0x572d55,{..._0x27f5bf,'tunnelSessionId':_0x320737?.[_0x4d888a(0x1e5)]});throw _0x572d55;}finally{(_0x320737||_0x21ef48||_0x3727cf)&&(_0x57f573[_0x4d888a(0x222)]?.[_0x4d888a(0x1f8)](_0x10176b['DzmBc'],{..._0x27f5bf,'tunnelSessionId':_0x320737?.[_0x4d888a(0x1e5)]}),_0x3727cf?.[_0x4d888a(0x22e)](),_0x21ef48&&await _0x21ef48[_0x4d888a(0x22e)]()['catch'](()=>{}),_0x320737&&await _0x10176b['EMrBm'](deleteTunnelSession,_0x320737[_0x4d888a(0x1e5)])[_0x4d888a(0x279)](()=>{}),_0x57f573['telemetry']?.[_0x4d888a(0x1da)](_0x10176b['DzmBc'],{..._0x27f5bf,'tunnelSessionId':_0x320737?.['sessionId']}));}}export async function manualBrowserLogin(_0x38c5fc,_0x35dd7c,_0x5857ed={}){const _0xfbf4b0=_0x4cc66b,_0x51ff3e={'wzklJ':'close','PfIgt':function(_0x4fc465,_0x3102d6){return _0x4fc465+_0x3102d6;},'rLMfw':_0xfbf4b0(0x25b),'DwUlY':'or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','fdnVT':function(_0xd2df30,_0x2b5bcd){return _0xd2df30>_0x2b5bcd;},'jMpsR':'about:blank','FkhuN':function(_0x495fb6,_0x40b42b){return _0x495fb6(_0x40b42b);},'qkYWm':function(_0x5175d4,_0x5b2bdd){return _0x5175d4&&_0x5b2bdd;},'JWZwt':_0xfbf4b0(0x277),'umaGb':function(_0x532654,_0x32b0a5){return _0x532654!==_0x32b0a5;},'GIZIL':function(_0x50eb0e,_0x4f48e6,_0x2c4b67){return _0x50eb0e(_0x4f48e6,_0x2c4b67);}};if(!isInteractive())throw new Error(_0x51ff3e[_0xfbf4b0(0x252)]('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x38c5fc['name']+'\x22.\x0a'+_0x51ff3e['rLMfw'],_0x51ff3e[_0xfbf4b0(0x1f7)]));const _0x3439b7=_0x35dd7c&&_0x51ff3e[_0xfbf4b0(0x262)](_0x35dd7c['domains'][_0xfbf4b0(0x22a)],0x0)?_0x35dd7c[_0xfbf4b0(0x26e)][0x0]:_0x51ff3e[_0xfbf4b0(0x22d)];console[_0xfbf4b0(0x20a)](_0xfbf4b0(0x23f)),console[_0xfbf4b0(0x20a)]('\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a'),await new Promise(_0x282367=>setTimeout(_0x282367,0x7d0));const _0x273b8b=await chromium['launch']({'headless':![]});let _0x443267=null;try{const _0x588478={'ignoreHTTPSErrors':!![]};_0x35dd7c?.['setupHeaders']&&(_0x588478['extraHTTPHeaders']=_0x35dd7c[_0xfbf4b0(0x232)]);const _0x47a7a8=await _0x273b8b[_0xfbf4b0(0x23d)](_0x588478);await _0x51ff3e[_0xfbf4b0(0x287)](addProfileSetupBanner,_0x47a7a8);const _0x1cc08b=await _0x47a7a8[_0xfbf4b0(0x26c)]();await _0x1cc08b['goto'](_0x3439b7);let _0x1c4790=![];await new Promise(_0x18562a=>{const _0xadd19=_0xfbf4b0,_0x57041a={'cCzYi':function(_0x3080da,_0x178efd){return _0x3080da/_0x178efd;},'uheCZ':function(_0x13cc36){return _0x13cc36();}},_0x499c17=setTimeout(()=>{const _0x418acf=_0x33f5;_0x1c4790=!![],console[_0x418acf(0x1fe)]('Browser\x20login\x20timed\x20out\x20after\x20'+_0x57041a['cCzYi'](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x57041a['uheCZ'](_0x18562a);},MANUAL_LOGIN_TIMEOUT_MS);_0x1cc08b['on'](_0x51ff3e[_0xadd19(0x20d)],async()=>{clearTimeout(_0x499c17);try{const _0xcbcd3d=await _0x47a7a8['storageState']();_0x443267=_0xcbcd3d;}catch{}_0x18562a();});});if(_0x51ff3e['qkYWm'](_0x1c4790,!_0x443267))throw new Error(_0x51ff3e[_0xfbf4b0(0x280)]);}finally{await _0x273b8b[_0xfbf4b0(0x22e)]()['catch'](()=>{});}if(!_0x443267)throw new Error('Browser\x20closed\x20before\x20authentication\x20was\x20saved.');return _0x51ff3e['umaGb'](_0x5857ed[_0xfbf4b0(0x1e8)],![])&&await _0x51ff3e['GIZIL'](apiRequest,'/api/v1/profiles/'+_0x51ff3e[_0xfbf4b0(0x287)](encodeURIComponent,_0x38c5fc[_0xfbf4b0(0x1e4)])+_0xfbf4b0(0x1f3),{'method':'POST','body':JSON[_0xfbf4b0(0x1fa)]({'session_state':_0x443267,'updated_by':'cli:manual-login'})}),{'sessionState':_0x443267};}function _0x33f5(_0x41dcbe,_0x4f11fd){_0x41dcbe=_0x41dcbe-0x1d1;const _0x20e12d=_0x20e1();let _0x33f587=_0x20e12d[_0x41dcbe];return _0x33f587;}export async function promptSaveCredentials(_0x5a7579){const _0x496f53=_0x4cc66b,_0x4d0579={'xpOKr':function(_0x5e708a){return _0x5e708a();},'ebvNz':function(_0x458802,_0x194bbc,_0x1cd69d){return _0x458802(_0x194bbc,_0x1cd69d);},'cHDzx':function(_0x434018,_0x559538){return _0x434018(_0x559538);},'HNrNP':_0x496f53(0x276),'mmhiV':'\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.'},_0x4f63f1=process['env']['RANGER_TEST_USERNAME'],_0x33507d=process[_0x496f53(0x20f)]['RANGER_TEST_PASSWORD'];if(!_0x4f63f1||!_0x33507d)return;if(!_0x4d0579[_0x496f53(0x288)](isInteractive))return;const {save:_0x4ced7e}=await _0x1e4fbc['prompt']([{'type':'confirm','name':'save','message':'Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','default':![]}]);if(!_0x4ced7e)return;await _0x4d0579[_0x496f53(0x267)](apiRequest,'/api/v1/profiles/'+_0x4d0579['cHDzx'](encodeURIComponent,_0x5a7579),{'method':_0x4d0579[_0x496f53(0x1f5)],'body':JSON['stringify']({'username':_0x4f63f1,'password':_0x33507d})}),console[_0x496f53(0x20a)](_0x4d0579['mmhiV']);}export async function resolveCloudProfileSession(_0xfd2698,_0x423968={}){const _0x556d0c=_0x4cc66b,_0x1d0d44={'uTAbO':function(_0x4c3acc){return _0x4c3acc();},'CmATx':function(_0x5baf7b,_0x14b620){return _0x5baf7b===_0x14b620;},'ELtzR':'string','TlzyB':function(_0x14f149,_0x30c410){return _0x14f149||_0x30c410;},'DLSNf':function(_0x51ea2c,_0x43d4ad){return _0x51ea2c(_0x43d4ad);},'BAJPw':function(_0x5b2235,_0x309dee){return _0x5b2235>_0x309dee;},'XSiDx':function(_0x4d2481,_0x54c30e,_0x3116f9,_0xa65b73,_0x5dfcb8){return _0x4d2481(_0x54c30e,_0x3116f9,_0xa65b73,_0x5dfcb8);},'VefhX':function(_0x558e07,_0x316f3f,_0x525340){return _0x558e07(_0x316f3f,_0x525340);},'vXdmo':function(_0x2e684a,_0xa128fe){return _0x2e684a(_0xa128fe);},'UPXga':function(_0x4354cb,_0x1384fb){return _0x4354cb||_0x1384fb;},'AOHPa':'success','YefCu':_0x556d0c(0x25d),'TXgnp':function(_0x4d4ee7,_0x54e98d,_0x45d28f,_0x5cd623,_0x18bba2,_0x1a793d,_0xf82340,_0x59140e){return _0x4d4ee7(_0x54e98d,_0x45d28f,_0x5cd623,_0x18bba2,_0x1a793d,_0xf82340,_0x59140e);},'Tutug':function(_0x206808,_0x5d0e1a,_0x282632,_0x8fd12a){return _0x206808(_0x5d0e1a,_0x282632,_0x8fd12a);}},_0x824d0a=_0xfd2698['settings']??{},_0x3d3b66=await _0x1d0d44[_0x556d0c(0x242)](fetchAuthConfig),_0x256294=_0x3d3b66?resolveAuthEnvironmentLocally(_0x3d3b66,_0xfd2698[_0x556d0c(0x1ee)]):null,_0x48fb92=typeof _0x256294?.[_0x556d0c(0x1d8)]==='string'&&_0x256294[_0x556d0c(0x1d8)]['trim']()?_0x256294[_0x556d0c(0x1d8)]:undefined,_0x19db88=_0x1d0d44[_0x556d0c(0x228)](typeof _0x824d0a['loginInstructions'],_0x1d0d44['ELtzR'])&&_0x824d0a[_0x556d0c(0x1d8)]['trim']()?_0x824d0a[_0x556d0c(0x1d8)]:undefined,_0x3f2457=_0x1d0d44[_0x556d0c(0x240)](_0x19db88,!_0x48fb92)?_0x824d0a:{..._0x824d0a,'loginInstructions':_0x48fb92},_0x5ce403=Boolean(_0x3f2457[_0x556d0c(0x1d8)]?.['trim']()),_0x4bca58=_0x1d0d44['DLSNf'](Boolean,_0x824d0a['forceLogin']||_0x256294?.['forceLogin']),_0x47b886=_0x256294?.[_0x556d0c(0x26e)],_0x180991=_0x824d0a[_0x556d0c(0x232)],_0x3a5414=_0x180991??_0x256294?.[_0x556d0c(0x232)],_0x345236=_0x423968[_0x556d0c(0x263)]??_0x824d0a[_0x556d0c(0x1e9)]??(_0x47b886&&_0x1d0d44['BAJPw'](_0x47b886['length'],0x0)?_0x47b886[0x0]:''),_0x16fdf0=_0x345236?_0x1d0d44['DLSNf'](needsTunnel,_0x345236):![],_0x131675={'invalidateOn':_0x256294?.['invalidateOn'],'userAgent':_0x256294?.['browserOptions']?.[_0x556d0c(0x1e0)]??_0x824d0a['userAgent']};_0x4bca58&&console['log'](_0x556d0c(0x1e6)+_0xfd2698['name']+_0x556d0c(0x229));if(!_0x4bca58){const _0x1cc384=await checkLocalCache(_0xfd2698[_0x556d0c(0x1e4)],_0xfd2698[_0x556d0c(0x224)],_0x345236,_0x3a5414,_0x131675);if(_0x1cc384){if(_0x345236&&!_0x16fdf0){const _0x286482=await _0x1d0d44[_0x556d0c(0x1ed)](isCachedSessionLive,_0x1cc384['storageStatePath'],_0x345236,{'sessionCheckPath':_0x256294?.['sessionCheckPath'],'setupHeaders':_0x3a5414},{'launchBrowser':launchRealBrowser});if(_0x286482)return console['log'](_0x556d0c(0x237)+_0xfd2698['name']+'\x22'),{'authPath':_0x1cc384['storageStatePath'],'settings':_0x3f2457,'resolvedEnv':_0x256294};console[_0x556d0c(0x20a)]('\x20\x20Cached\x20session\x20for\x20\x22'+_0xfd2698[_0x556d0c(0x1e4)]+_0x556d0c(0x205)),emitSessionValidationHint(_0x345236,_0x256294);}else return _0x16fdf0&&console[_0x556d0c(0x20a)]('\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22'+_0xfd2698['name']+'\x22'),{'authPath':_0x1cc384[_0x556d0c(0x234)],'settings':_0x3f2457,'resolvedEnv':_0x256294};}}if(!_0x4bca58&&_0xfd2698[_0x556d0c(0x1f1)]){if(_0x16fdf0)console[_0x556d0c(0x20a)]('\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22'+_0x345236+_0x556d0c(0x1dd)+_0xfd2698['name']+'\x22');else{const _0x144150=await writeSessionToLocalCache(_0xfd2698['name'],_0xfd2698[_0x556d0c(0x224)],_0x345236,_0x3a5414,_0xfd2698[_0x556d0c(0x1f1)],_0x47b886,_0x131675);if(_0x345236){const _0x379c15=await isCachedSessionLive(_0x144150,_0x345236,{'sessionCheckPath':_0x256294?.[_0x556d0c(0x268)],'setupHeaders':_0x3a5414},{'launchBrowser':launchRealBrowser});if(_0x379c15)return console['log']('\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22'+_0xfd2698[_0x556d0c(0x1e4)]+'\x22,\x20cached\x20locally'),{'authPath':_0x144150,'settings':_0x3f2457,'resolvedEnv':_0x256294};console['log']('\x20\x20Cloud\x20session\x20for\x20\x22'+_0xfd2698['name']+_0x556d0c(0x1f0)),_0x1d0d44[_0x556d0c(0x25c)](emitSessionValidationHint,_0x345236,_0x256294);}else return{'authPath':_0x144150,'settings':_0x3f2457,'resolvedEnv':_0x256294};}}if(_0x5ce403)return console['log'](_0x556d0c(0x1d4)+_0xfd2698[_0x556d0c(0x1e4)]+'\x22;\x20proceeding\x20with\x20loginInstructions.'),{'authPath':undefined,'settings':_0x3f2457,'resolvedEnv':_0x256294};console[_0x556d0c(0x20a)](_0x556d0c(0x1d4)+_0xfd2698[_0x556d0c(0x1e4)]+_0x556d0c(0x286));const _0x351f08=Boolean(process['env']['RANGER_TEST_USERNAME'])&&Boolean(process['env'][_0x556d0c(0x1ef)]),_0x1e5829=_0x1d0d44['vXdmo'](Boolean,_0xfd2698[_0x556d0c(0x1de)]);if(_0x1d0d44['UPXga'](_0x351f08,_0x1e5829))try{const _0x5cd318=_0x345236?await serverSideLoginWithOptionalTunnel(_0xfd2698[_0x556d0c(0x1e4)],_0x345236,{'force':_0x4bca58,'telemetry':_0x423968[_0x556d0c(0x222)]}):await _0x1d0d44['VefhX'](serverSideLogin,_0xfd2698[_0x556d0c(0x1e4)],{'force':_0x4bca58});if(_0x5cd318['status']==='not_configured')console['log']('\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...');else{if(_0x5cd318[_0x556d0c(0x1d5)]===_0x1d0d44['AOHPa']&&_0x5cd318[_0x556d0c(0x282)]){console[_0x556d0c(0x20a)](_0x1d0d44['YefCu']);const _0x42ba6e=await _0x1d0d44['TXgnp'](writeSessionToLocalCache,_0xfd2698[_0x556d0c(0x1e4)],_0xfd2698['organizationId'],_0x345236,_0x3a5414,_0x5cd318[_0x556d0c(0x282)],_0x47b886,_0x131675);return _0x351f08&&!_0x1e5829&&await promptSaveCredentials(_0xfd2698['name']),{'authPath':_0x42ba6e,'settings':_0x3f2457,'resolvedEnv':_0x256294};}else _0x5cd318['test_output']&&(console['log'](_0x556d0c(0x248)),console[_0x556d0c(0x20a)](_0x5cd318[_0x556d0c(0x1f6)])),console['log']('\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...');}}catch(_0x2225d4){console[_0x556d0c(0x20a)](_0x556d0c(0x20e)+(_0x2225d4 instanceof Error?_0x2225d4['message']:_0x1d0d44[_0x556d0c(0x208)](String,_0x2225d4))),console[_0x556d0c(0x20a)](_0x556d0c(0x214));}const _0x3a4298=_0x256294?{..._0x256294,'setupHeaders':_0x3a5414}:_0x345236?{'key':_0xfd2698[_0x556d0c(0x1ee)]??'','domains':[_0x345236],'setupHeaders':_0x3a5414}:null,{sessionState:_0x4c37fb}=await _0x1d0d44['Tutug'](manualBrowserLogin,_0xfd2698,_0x3a4298,{'persistSessionState':!_0x16fdf0}),_0x2aed33=await writeSessionToLocalCache(_0xfd2698['name'],_0xfd2698['organizationId'],_0x345236,_0x3a5414,_0x4c37fb,_0x47b886,_0x131675);return{'authPath':_0x2aed33,'settings':_0x3f2457,'resolvedEnv':_0x256294};}
@@ -1 +1 @@
1
- const _0x3d1c3a=_0x518d;(function(_0x2c0f0d,_0x4985b7){const _0x5873b7=_0x518d,_0x45cf91=_0x2c0f0d();while(!![]){try{const _0x1aae8b=-parseInt(_0x5873b7(0x171))/0x1*(parseInt(_0x5873b7(0x17f))/0x2)+parseInt(_0x5873b7(0x17b))/0x3*(parseInt(_0x5873b7(0x169))/0x4)+parseInt(_0x5873b7(0x18e))/0x5+parseInt(_0x5873b7(0x191))/0x6*(-parseInt(_0x5873b7(0x190))/0x7)+-parseInt(_0x5873b7(0x19b))/0x8*(-parseInt(_0x5873b7(0x197))/0x9)+-parseInt(_0x5873b7(0x178))/0xa+parseInt(_0x5873b7(0x18d))/0xb;if(_0x1aae8b===_0x4985b7)break;else _0x45cf91['push'](_0x45cf91['shift']());}catch(_0x10c822){_0x45cf91['push'](_0x45cf91['shift']());}}}(_0x1039,0x23efc));function _0x518d(_0x1d0205,_0x53e42f){_0x1d0205=_0x1d0205-0x166;const _0x10390c=_0x1039();let _0x518d9f=_0x10390c[_0x1d0205];return _0x518d9f;}import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x5913da=process['env'],_0x2dae63={'stdin':process['stdin'],'stdout':process[_0x3d1c3a(0x166)]}){const _0x47c759=_0x3d1c3a,_0x28f132={'zgWej':function(_0x35c98f,_0x25af3b){return _0x35c98f(_0x25af3b);},'YxxvI':function(_0x379c82,_0x14c254){return _0x379c82(_0x14c254);}};if(_0x5913da['CI'])return![];return _0x28f132['zgWej'](Boolean,_0x2dae63['stdin'][_0x47c759(0x18c)])&&_0x28f132['YxxvI'](Boolean,_0x2dae63[_0x47c759(0x166)]['isTTY']);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x4b8a89){const _0x1f401b=_0x3d1c3a,_0x16165a={'ePcVK':function(_0x2f4cf8,_0x566054){return _0x2f4cf8(_0x566054);},'FANhh':'baseUrl','kVmHa':function(_0xbc56f2,_0x1e9c71){return _0xbc56f2(_0x1e9c71);},'iGEyW':'userAgent','ygbqt':'clientIp','VsXUK':_0x1f401b(0x19a)},_0x14d6bd=new Set(_0x4b8a89[_0x1f401b(0x177)]??DEFAULT_INVALIDATE_ON);_0x4b8a89[_0x1f401b(0x16b)]&&_0x16165a['ePcVK'](needsTunnel,_0x4b8a89[_0x1f401b(0x16b)])&&_0x14d6bd[_0x1f401b(0x167)](_0x16165a['FANhh']);const _0x1334ca={'orgId':_0x4b8a89[_0x1f401b(0x18b)],'profileName':_0x4b8a89[_0x1f401b(0x19c)]};return _0x14d6bd[_0x1f401b(0x17a)](_0x16165a['FANhh'])&&(_0x1334ca['effectiveBaseUrl']=_0x4b8a89['effectiveBaseUrl']),_0x14d6bd[_0x1f401b(0x17a)](_0x1f401b(0x173))&&(_0x1334ca[_0x1f401b(0x173)]=_0x4b8a89[_0x1f401b(0x173)]?_0x16165a[_0x1f401b(0x180)](sortObjectKeys,_0x4b8a89['setupHeaders']):_0x4b8a89[_0x1f401b(0x173)]),_0x14d6bd['has'](_0x1f401b(0x18f))&&(_0x1334ca[_0x1f401b(0x18f)]=extractPort(_0x4b8a89['effectiveBaseUrl'])),_0x14d6bd[_0x1f401b(0x17a)](_0x16165a[_0x1f401b(0x168)])&&_0x4b8a89['userAgent']!==undefined&&(_0x1334ca[_0x1f401b(0x174)]=_0x4b8a89[_0x1f401b(0x174)]),_0x14d6bd['has'](_0x16165a[_0x1f401b(0x183)])&&_0x4b8a89[_0x1f401b(0x193)]!==undefined&&(_0x1334ca[_0x1f401b(0x193)]=_0x4b8a89[_0x1f401b(0x193)]),_0x16165a[_0x1f401b(0x16d)](createHash,_0x16165a[_0x1f401b(0x184)])[_0x1f401b(0x199)](JSON[_0x1f401b(0x186)](_0x1334ca))[_0x1f401b(0x181)](_0x1f401b(0x17e))['slice'](0x0,0xc);}function extractPort(_0x4d4480){const _0x316509=_0x3d1c3a;try{return new URL(_0x4d4480)[_0x316509(0x18f)];}catch{return'';}}function sortObjectKeys(_0x11fce1){const _0x54f1f1={};for(const _0x4fa481 of Object['keys'](_0x11fce1)['sort']()){_0x54f1f1[_0x4fa481]=_0x11fce1[_0x4fa481];}return _0x54f1f1;}export function getSessionCachePath(_0x3b5760,_0x58a44a){const _0x33cc9d=_0x3d1c3a,_0x562869={'nqGVX':_0x33cc9d(0x16f)};return join(getRangerHomeDir(),_0x562869['nqGVX'],_0x3b5760+'-'+_0x58a44a+'.json');}export function getStorageStatePath(_0x3d2a66){const _0x5aa6f6=_0x3d1c3a;return _0x3d2a66['replace'](/\.json$/,_0x5aa6f6(0x179));}export function needsTunnel(_0x15df1f){const _0x3a9922=_0x3d1c3a,_0x4b3b7a={'XlzvI':function(_0x364ed0,_0x248306){return _0x364ed0===_0x248306;},'yhWXU':'localhost','PjGZw':_0x3a9922(0x17c)};let _0x1a0118;try{_0x1a0118=new URL(_0x15df1f)['hostname'];}catch{return![];}if(_0x4b3b7a['XlzvI'](_0x1a0118,_0x4b3b7a[_0x3a9922(0x189)])||_0x1a0118===_0x4b3b7a['PjGZw'])return!![];if(_0x1a0118[_0x3a9922(0x185)]('.localhost'))return!![];if(_0x1a0118[_0x3a9922(0x188)]('localhost.'))return!![];return![];}export function hostnameOf(_0x1b2cd4){return new URL(_0x1b2cd4)['hostname'];}export function duplicateCookiesForDomains(_0x3a5b7f,_0x4016da){const _0x4ba27e=_0x3d1c3a,_0x172b65=[..._0x3a5b7f],_0x50f8f6=new Set(_0x3a5b7f[_0x4ba27e(0x198)](_0x1ceb58=>_0x1ceb58[_0x4ba27e(0x194)]));for(const _0xe60996 of _0x4016da){let _0x3d4992;try{_0x3d4992=hostnameOf(_0xe60996);}catch{continue;}if(!_0x3d4992)continue;const _0x40b030=_0x3d4992[_0x4ba27e(0x175)]('.')?_0x3d4992:'.'+_0x3d4992;if(_0x50f8f6[_0x4ba27e(0x17a)](_0x3d4992)||_0x50f8f6['has'](_0x40b030))continue;for(const _0x4ae363 of _0x3a5b7f){_0x172b65['push']({..._0x4ae363,'domain':_0x40b030});}_0x50f8f6['add'](_0x40b030);}return _0x172b65;}export function resolveAuthEnvironmentLocally(_0x5de3b4,_0xc7583f){const _0x55d84a=_0x3d1c3a,_0x165936=_0x5de3b4[_0x55d84a(0x18a)];if(_0xc7583f){const _0x6d05e4=_0x165936[_0xc7583f];if(!_0x6d05e4)return null;return{'key':_0xc7583f,..._0x6d05e4};}if(_0x5de3b4[_0x55d84a(0x16e)]){const _0x31acd6=_0x165936[_0x5de3b4[_0x55d84a(0x16e)]];if(!_0x31acd6)return null;return{'key':_0x5de3b4['defaultEnvironmentKey'],..._0x31acd6};}const _0x41390a=Object[_0x55d84a(0x187)](_0x165936);if(_0x41390a['length']===0x1){const _0x29f38a=_0x41390a[0x0];return{'key':_0x29f38a,..._0x165936[_0x29f38a]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x79894b,_0x433ad9){const _0x42e222=_0x3d1c3a;try{if(_0x433ad9)return new URL(_0x433ad9,_0x79894b)[_0x42e222(0x196)]();return new URL(_0x79894b)['toString']();}catch{return null;}}export function looksLikeLoginUrl(_0x588e70){const _0x1b6020=_0x3d1c3a;try{const _0x4b890c=new URL(_0x588e70);return LOGIN_URL_PATTERN['test'](_0x4b890c[_0x1b6020(0x172)]);}catch{return LOGIN_URL_PATTERN[_0x1b6020(0x182)](_0x588e70);}}export async function isCachedSessionLive(_0x2a67f2,_0x1c0fe8,_0x148948={},_0x577151={}){const _0x4a6d82=_0x3d1c3a,_0xe9d822={'yoQrn':function(_0x50c584,_0x2021d1){return _0x50c584===_0x2021d1;},'qOwEq':function(_0x5db7e7,_0x43a6ef){return _0x5db7e7===_0x43a6ef;}},_0x1115f1=buildSessionCheckUrl(_0x1c0fe8,_0x148948[_0x4a6d82(0x16a)]);if(!_0x1115f1)return!![];if(!_0x577151[_0x4a6d82(0x176)])return!![];let _0x582f77=null;try{_0x582f77=await _0x577151['launchBrowser']();const _0x1cfe3f=await _0x582f77[_0x4a6d82(0x17d)]({'storageState':_0x2a67f2,'ignoreHTTPSErrors':!![],..._0x148948['setupHeaders']?{'extraHTTPHeaders':_0x148948[_0x4a6d82(0x173)]}:{}}),_0x10c148=await _0x1cfe3f[_0x4a6d82(0x16c)](),_0x491ae7=await _0x10c148[_0x4a6d82(0x192)](_0x1115f1,{'waitUntil':'domcontentloaded','timeout':0x3a98}),_0xb8305c=_0x491ae7?.[_0x4a6d82(0x170)]();if(_0xe9d822[_0x4a6d82(0x195)](_0xb8305c,0x191)||_0xe9d822['qOwEq'](_0xb8305c,0x193))return![];const _0x197245=_0x10c148['url']();if(looksLikeLoginUrl(_0x197245))return![];return!![];}catch{return![];}finally{if(_0x582f77)await _0x582f77['close']()['catch'](()=>{});}}function _0x1039(){const _0x213570=['1004lMzBzz','sessionCheckPath','effectiveBaseUrl','newPage','ePcVK','defaultEnvironmentKey','auth','status','1tSnclG','pathname','setupHeaders','userAgent','startsWith','launchBrowser','invalidateOn','2721410RTtBzX','.storageState.json','has','501GQjXGP','127.0.0.1','newContext','hex','223912RmwiGT','kVmHa','digest','test','ygbqt','VsXUK','endsWith','stringify','keys','includes','yhWXU','environments','orgId','isTTY','3461447tKMfnk','1173640TtaWFr','port','21hSMpiR','237054eWjOQU','goto','clientIp','domain','yoQrn','toString','526482bwzDzP','map','update','sha256','8TPXoHf','profileName','stdout','add','iGEyW'];_0x1039=function(){return _0x213570;};return _0x1039();}
1
+ function _0x23d0(){const _0x435d8a=['push','environments','localhost.','205PXTWHy','has','jgpPi','launchBrowser','invalidateOn','clientIp','url','Tdlkk','goto','lvgXV','190421asIFNi','.localhost','setupHeaders','hostname','toString','add','780214xpiQMk','defaultEnvironmentKey','includes','.storageState.json','194478hYLQUZ','effectiveBaseUrl','replace','domcontentloaded','14284450sixriK','216ybmJzB','length','orgId','sha256','566392hyjKAS','3975138AxkcLb','auth','ycODN','1192698kPRGfS','sessionCheckPath','127.0.0.1','rQnOV','port','digest','bQkZi','map','.json','sort','userAgent','iQjDD','slice','stdout','stringify','3YMPqYW'];_0x23d0=function(){return _0x435d8a;};return _0x23d0();}const _0x451f04=_0x16fb;(function(_0x1672e8,_0x1c1bba){const _0x43df4a=_0x16fb,_0x29b02a=_0x1672e8();while(!![]){try{const _0x16b099=-parseInt(_0x43df4a(0x1f5))/0x1+-parseInt(_0x43df4a(0x1e4))/0x2+parseInt(_0x43df4a(0x204))/0x3*(-parseInt(_0x43df4a(0x1f1))/0x4)+-parseInt(_0x43df4a(0x1d4))/0x5*(-parseInt(_0x43df4a(0x1e8))/0x6)+-parseInt(_0x43df4a(0x1de))/0x7*(parseInt(_0x43df4a(0x1ed))/0x8)+parseInt(_0x43df4a(0x1f2))/0x9+parseInt(_0x43df4a(0x1ec))/0xa;if(_0x16b099===_0x1c1bba)break;else _0x29b02a['push'](_0x29b02a['shift']());}catch(_0x1bdc45){_0x29b02a['push'](_0x29b02a['shift']());}}}(_0x23d0,0xb4b50));import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x2da744=process['env'],_0x52a962={'stdin':process['stdin'],'stdout':process[_0x451f04(0x202)]}){const _0xc50344=_0x451f04,_0x145dcd={'bQkZi':function(_0x233f32,_0x3cce61){return _0x233f32(_0x3cce61);},'VskdJ':function(_0x4664a3,_0x33b5fa){return _0x4664a3(_0x33b5fa);}};if(_0x2da744['CI'])return![];return _0x145dcd[_0xc50344(0x1fb)](Boolean,_0x52a962['stdin']['isTTY'])&&_0x145dcd['VskdJ'](Boolean,_0x52a962[_0xc50344(0x202)]['isTTY']);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x5531e3){const _0x52a36c=_0x451f04,_0x2c4ac5={'lvgXV':function(_0x367e63,_0xaa148b){return _0x367e63(_0xaa148b);},'Tarob':'baseUrl','jgpPi':'setupHeaders','rQnOV':function(_0x33f543,_0x1bcd8d){return _0x33f543!==_0x1bcd8d;},'ycODN':_0x52a36c(0x1d9),'InWHv':function(_0x26794f,_0x5536ec){return _0x26794f!==_0x5536ec;},'iQjDD':function(_0x26b233,_0x48c52b){return _0x26b233(_0x48c52b);}},_0x5aaf18=new Set(_0x5531e3[_0x52a36c(0x1d8)]??DEFAULT_INVALIDATE_ON);_0x5531e3[_0x52a36c(0x1e9)]&&_0x2c4ac5[_0x52a36c(0x1dd)](needsTunnel,_0x5531e3[_0x52a36c(0x1e9)])&&_0x5aaf18[_0x52a36c(0x1e3)]('baseUrl');const _0x10a3c8={'orgId':_0x5531e3[_0x52a36c(0x1ef)],'profileName':_0x5531e3['profileName']};return _0x5aaf18[_0x52a36c(0x1d5)](_0x2c4ac5['Tarob'])&&(_0x10a3c8[_0x52a36c(0x1e9)]=_0x5531e3[_0x52a36c(0x1e9)]),_0x5aaf18['has'](_0x2c4ac5[_0x52a36c(0x1d6)])&&(_0x10a3c8[_0x52a36c(0x1e0)]=_0x5531e3['setupHeaders']?sortObjectKeys(_0x5531e3[_0x52a36c(0x1e0)]):_0x5531e3['setupHeaders']),_0x5aaf18['has'](_0x52a36c(0x1f9))&&(_0x10a3c8['port']=extractPort(_0x5531e3['effectiveBaseUrl'])),_0x5aaf18[_0x52a36c(0x1d5)]('userAgent')&&_0x2c4ac5[_0x52a36c(0x1f8)](_0x5531e3['userAgent'],undefined)&&(_0x10a3c8['userAgent']=_0x5531e3[_0x52a36c(0x1ff)]),_0x5aaf18[_0x52a36c(0x1d5)](_0x2c4ac5[_0x52a36c(0x1f4)])&&_0x2c4ac5['InWHv'](_0x5531e3['clientIp'],undefined)&&(_0x10a3c8['clientIp']=_0x5531e3[_0x52a36c(0x1d9)]),_0x2c4ac5[_0x52a36c(0x200)](createHash,_0x52a36c(0x1f0))['update'](JSON[_0x52a36c(0x203)](_0x10a3c8))[_0x52a36c(0x1fa)]('hex')[_0x52a36c(0x201)](0x0,0xc);}function extractPort(_0x4723bf){try{return new URL(_0x4723bf)['port'];}catch{return'';}}function sortObjectKeys(_0x596c71){const _0xde9263=_0x451f04,_0xf941e4={};for(const _0x2808b7 of Object['keys'](_0x596c71)[_0xde9263(0x1fe)]()){_0xf941e4[_0x2808b7]=_0x596c71[_0x2808b7];}return _0xf941e4;}export function getSessionCachePath(_0x338c12,_0x2d4944){const _0x545e1d=_0x451f04,_0x3c0a1a={'wXmYS':_0x545e1d(0x1f3)};return join(getRangerHomeDir(),_0x3c0a1a['wXmYS'],_0x338c12+'-'+_0x2d4944+_0x545e1d(0x1fd));}export function getStorageStatePath(_0x51af0d){const _0x131945=_0x451f04,_0x391370={'mTBKr':_0x131945(0x1e7)};return _0x51af0d[_0x131945(0x1ea)](/\.json$/,_0x391370['mTBKr']);}export function needsTunnel(_0x232934){const _0x361de9=_0x451f04,_0x54b218={'Tdlkk':function(_0x2b2a10,_0x1e828e){return _0x2b2a10===_0x1e828e;}};let _0x4aa26f;try{_0x4aa26f=new URL(_0x232934)['hostname'];}catch{return![];}if(_0x4aa26f==='localhost'||_0x54b218[_0x361de9(0x1db)](_0x4aa26f,_0x361de9(0x1f7)))return!![];if(_0x4aa26f['endsWith'](_0x361de9(0x1df)))return!![];if(_0x4aa26f[_0x361de9(0x1e6)](_0x361de9(0x1d3)))return!![];return![];}export function hostnameOf(_0x3db0f9){const _0x332036=_0x451f04;return new URL(_0x3db0f9)[_0x332036(0x1e1)];}export function duplicateCookiesForDomains(_0x66ffe,_0x4d269d){const _0x9e8361=_0x451f04,_0x1816f2=[..._0x66ffe],_0x437d99=new Set(_0x66ffe[_0x9e8361(0x1fc)](_0x10455c=>_0x10455c['domain']));for(const _0xeeffdd of _0x4d269d){let _0x87a49;try{_0x87a49=hostnameOf(_0xeeffdd);}catch{continue;}if(!_0x87a49)continue;const _0x3bd9c5=_0x87a49['startsWith']('.')?_0x87a49:'.'+_0x87a49;if(_0x437d99['has'](_0x87a49)||_0x437d99['has'](_0x3bd9c5))continue;for(const _0x395bcc of _0x66ffe){_0x1816f2[_0x9e8361(0x1d1)]({..._0x395bcc,'domain':_0x3bd9c5});}_0x437d99['add'](_0x3bd9c5);}return _0x1816f2;}function _0x16fb(_0x4b6616,_0x226ad7){_0x4b6616=_0x4b6616-0x1d1;const _0x23d068=_0x23d0();let _0x16fb29=_0x23d068[_0x4b6616];return _0x16fb29;}export function resolveAuthEnvironmentLocally(_0x531e44,_0x3eb869){const _0x20d84f=_0x451f04,_0x4c82f7=_0x531e44[_0x20d84f(0x1d2)];if(_0x3eb869){const _0x18f8cf=_0x4c82f7[_0x3eb869];if(!_0x18f8cf)return null;return{'key':_0x3eb869,..._0x18f8cf};}if(_0x531e44['defaultEnvironmentKey']){const _0x5ca423=_0x4c82f7[_0x531e44['defaultEnvironmentKey']];if(!_0x5ca423)return null;return{'key':_0x531e44[_0x20d84f(0x1e5)],..._0x5ca423};}const _0x3b10e8=Object['keys'](_0x4c82f7);if(_0x3b10e8[_0x20d84f(0x1ee)]===0x1){const _0x215dd6=_0x3b10e8[0x0];return{'key':_0x215dd6,..._0x4c82f7[_0x215dd6]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x7e63b0,_0x17ff60){const _0x27bc37=_0x451f04;try{if(_0x17ff60)return new URL(_0x17ff60,_0x7e63b0)[_0x27bc37(0x1e2)]();return new URL(_0x7e63b0)['toString']();}catch{return null;}}export function looksLikeLoginUrl(_0x4b246d){try{const _0x24df73=new URL(_0x4b246d);return LOGIN_URL_PATTERN['test'](_0x24df73['pathname']);}catch{return LOGIN_URL_PATTERN['test'](_0x4b246d);}}export async function isCachedSessionLive(_0x1893ba,_0x4ff75b,_0x5953fe={},_0x134315={}){const _0x158e4a=_0x451f04,_0x41383e={'zQubR':function(_0x3a8cec,_0x4ea96f){return _0x3a8cec===_0x4ea96f;},'sWxuL':function(_0x4934f0,_0x4aec89){return _0x4934f0(_0x4aec89);}},_0x4e4ea5=buildSessionCheckUrl(_0x4ff75b,_0x5953fe[_0x158e4a(0x1f6)]);if(!_0x4e4ea5)return!![];if(!_0x134315[_0x158e4a(0x1d7)])return!![];let _0x19bf9a=null;try{_0x19bf9a=await _0x134315['launchBrowser']();const _0xd3511=await _0x19bf9a['newContext']({'storageState':_0x1893ba,'ignoreHTTPSErrors':!![],..._0x5953fe[_0x158e4a(0x1e0)]?{'extraHTTPHeaders':_0x5953fe['setupHeaders']}:{}}),_0x96ae46=await _0xd3511['newPage'](),_0x557a3a=await _0x96ae46[_0x158e4a(0x1dc)](_0x4e4ea5,{'waitUntil':_0x158e4a(0x1eb),'timeout':0x3a98}),_0xd0139a=_0x557a3a?.['status']();if(_0x41383e['zQubR'](_0xd0139a,0x191)||_0xd0139a===0x193)return![];const _0x3b539b=_0x96ae46[_0x158e4a(0x1da)]();if(_0x41383e['sWxuL'](looksLikeLoginUrl,_0x3b539b))return![];return!![];}catch{return![];}finally{if(_0x19bf9a)await _0x19bf9a['close']()['catch'](()=>{});}}
@@ -1 +1 @@
1
- function _0x3175(_0x2c3359,_0x36d8d7){_0x2c3359=_0x2c3359-0x158;const _0x127272=_0x1272();let _0x3175d2=_0x127272[_0x2c3359];return _0x3175d2;}(function(_0x54204f,_0x570a15){const _0x24ea9a=_0x3175,_0x7d4f3=_0x54204f();while(!![]){try{const _0x48965e=-parseInt(_0x24ea9a(0x164))/0x1+parseInt(_0x24ea9a(0x168))/0x2*(parseInt(_0x24ea9a(0x15c))/0x3)+parseInt(_0x24ea9a(0x15f))/0x4+parseInt(_0x24ea9a(0x167))/0x5*(-parseInt(_0x24ea9a(0x16a))/0x6)+parseInt(_0x24ea9a(0x166))/0x7*(-parseInt(_0x24ea9a(0x169))/0x8)+-parseInt(_0x24ea9a(0x163))/0x9+parseInt(_0x24ea9a(0x158))/0xa;if(_0x48965e===_0x570a15)break;else _0x7d4f3['push'](_0x7d4f3['shift']());}catch(_0x11081e){_0x7d4f3['push'](_0x7d4f3['shift']());}}}(_0x1272,0x82d5d));function _0x1272(){const _0x569f5d=['4210440bPljVx','utf8','subarray','qpoOK','2323359KJWSel','696789iDtvUk','sha256','7367234rGJQOQ','34165sNuAkJ','694ulOJif','8qjinKF','222JpuojC','14766710dmhOSB','OCBJX','setAuthTag','WYshr','2307UuQkIa','xOniA','concat'];_0x1272=function(){return _0x569f5d;};return _0x1272();}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(_0x5710ee){const _0x484c0a=_0x3175,_0x568da6={'evkAM':function(_0x18ed89,_0x196d7e,_0x558886,_0x4b4bff,_0x1d5363,_0x2cf716){return _0x18ed89(_0x196d7e,_0x558886,_0x4b4bff,_0x1d5363,_0x2cf716);}};return _0x568da6['evkAM'](pbkdf2Sync,_0x5710ee,SALT,0x186a0,KEY_LENGTH,_0x484c0a(0x165));}export function encrypt(_0x3a7842,_0x42957e){const _0x54b147=_0x3175,_0x140d8b={'WYshr':function(_0x579dd5,_0xb1564f){return _0x579dd5(_0xb1564f);},'xOniA':function(_0x5efdeb,_0x30e932){return _0x5efdeb(_0x30e932);}},_0x30923f=_0x140d8b[_0x54b147(0x15b)](deriveKey,_0x42957e),_0x28024d=_0x140d8b[_0x54b147(0x15d)](randomBytes,IV_LENGTH),_0x1ae0b5=createCipheriv(ALGORITHM,_0x30923f,_0x28024d),_0x26f4fe=Buffer['concat']([_0x1ae0b5['update'](_0x3a7842,_0x54b147(0x160)),_0x1ae0b5['final']()]),_0x57b85d=_0x1ae0b5['getAuthTag']();return Buffer[_0x54b147(0x15e)]([_0x28024d,_0x57b85d,_0x26f4fe]);}export function decrypt(_0x578864,_0x1260c0){const _0x551576=_0x3175,_0x39b4a6={'fzPtp':function(_0x4d77b0,_0x457ff2){return _0x4d77b0(_0x457ff2);},'OCBJX':function(_0x35c254,_0x415e15,_0x1b974a,_0x294792){return _0x35c254(_0x415e15,_0x1b974a,_0x294792);},'qpoOK':function(_0xc19aa5,_0x40105c){return _0xc19aa5+_0x40105c;}},_0x2d7c47=_0x39b4a6['fzPtp'](deriveKey,_0x1260c0),_0x27727e=_0x578864[_0x551576(0x161)](0x0,IV_LENGTH),_0x3b1229=_0x578864[_0x551576(0x161)](IV_LENGTH,IV_LENGTH+TAG_LENGTH),_0x8c7035=_0x578864[_0x551576(0x161)](IV_LENGTH+TAG_LENGTH),_0x488529=_0x39b4a6[_0x551576(0x159)](createDecipheriv,ALGORITHM,_0x2d7c47,_0x27727e);return _0x488529[_0x551576(0x15a)](_0x3b1229),_0x39b4a6[_0x551576(0x162)](_0x488529['update'](_0x8c7035),_0x488529['final'](_0x551576(0x160)));}
1
+ function _0x3168(_0x299228,_0x5307a9){_0x299228=_0x299228-0x9a;const _0x2805dd=_0x2805();let _0x3168a6=_0x2805dd[_0x299228];return _0x3168a6;}(function(_0x23020f,_0x2ca27c){const _0x508855=_0x3168,_0x1d43af=_0x23020f();while(!![]){try{const _0x5d5aac=parseInt(_0x508855(0xa0))/0x1+-parseInt(_0x508855(0xa5))/0x2*(-parseInt(_0x508855(0xa3))/0x3)+parseInt(_0x508855(0xac))/0x4+-parseInt(_0x508855(0x9b))/0x5*(parseInt(_0x508855(0xab))/0x6)+-parseInt(_0x508855(0xa8))/0x7+parseInt(_0x508855(0xa6))/0x8*(-parseInt(_0x508855(0xa7))/0x9)+parseInt(_0x508855(0xa1))/0xa*(parseInt(_0x508855(0xa2))/0xb);if(_0x5d5aac===_0x2ca27c)break;else _0x1d43af['push'](_0x1d43af['shift']());}catch(_0x3ac55d){_0x1d43af['push'](_0x1d43af['shift']());}}}(_0x2805,0xc4b94));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(_0x481cc3){const _0x219d14=_0x3168,_0x49e765={'ARzHH':function(_0x32ba87,_0x79e16,_0xe427aa,_0x15cf15,_0x11afb3,_0x5e2a31){return _0x32ba87(_0x79e16,_0xe427aa,_0x15cf15,_0x11afb3,_0x5e2a31);},'aiLaR':_0x219d14(0x9a)};return _0x49e765['ARzHH'](pbkdf2Sync,_0x481cc3,SALT,0x186a0,KEY_LENGTH,_0x49e765['aiLaR']);}export function encrypt(_0x1c2d9d,_0x5297ab){const _0x9373b9=_0x3168,_0x476792={'hwQJe':function(_0x530664,_0x1b6d3f,_0x202b2c,_0x4f9852){return _0x530664(_0x1b6d3f,_0x202b2c,_0x4f9852);}},_0x1f9ffe=deriveKey(_0x5297ab),_0x570c63=randomBytes(IV_LENGTH),_0x57598d=_0x476792[_0x9373b9(0x9e)](createCipheriv,ALGORITHM,_0x1f9ffe,_0x570c63),_0x354895=Buffer['concat']([_0x57598d['update'](_0x1c2d9d,_0x9373b9(0x9c)),_0x57598d['final']()]),_0x4fd214=_0x57598d[_0x9373b9(0x9f)]();return Buffer[_0x9373b9(0x9d)]([_0x570c63,_0x4fd214,_0x354895]);}export function decrypt(_0x36fbb9,_0x3300c8){const _0x1ae9ee=_0x3168,_0x4080f7={'vXHrQ':function(_0x5e8ddb,_0x1dbe6c){return _0x5e8ddb+_0x1dbe6c;},'MMQVH':function(_0x2b9610,_0x5e3b1b,_0x8d729f,_0x380e5d){return _0x2b9610(_0x5e3b1b,_0x8d729f,_0x380e5d);}},_0x2ad33c=deriveKey(_0x3300c8),_0x578a02=_0x36fbb9['subarray'](0x0,IV_LENGTH),_0xb4916d=_0x36fbb9['subarray'](IV_LENGTH,_0x4080f7['vXHrQ'](IV_LENGTH,TAG_LENGTH)),_0x4765c9=_0x36fbb9['subarray'](IV_LENGTH+TAG_LENGTH),_0xf07e68=_0x4080f7[_0x1ae9ee(0xaa)](createDecipheriv,ALGORITHM,_0x2ad33c,_0x578a02);return _0xf07e68['setAuthTag'](_0xb4916d),_0x4080f7[_0x1ae9ee(0xa4)](_0xf07e68[_0x1ae9ee(0xa9)](_0x4765c9),_0xf07e68['final'](_0x1ae9ee(0x9c)));}function _0x2805(){const _0x56c99a=['vXHrQ','36KZcrSx','808KeBJSt','60372zuhnuO','152558fZYDYd','update','MMQVH','6JMEhTK','2387140JKGMdL','sha256','921505IOkbMy','utf8','concat','hwQJe','getAuthTag','319174INkULa','45570djPiCo','330gvDEVC','106119PAeDsK'];_0x2805=function(){return _0x56c99a;};return _0x2805();}
@@ -1 +1 @@
1
- const _0x3d0e1a=_0xeb77;(function(_0x202363,_0x1c861f){const _0x2add51=_0xeb77,_0x2cae74=_0x202363();while(!![]){try{const _0x89b0fd=-parseInt(_0x2add51(0x130))/0x1*(-parseInt(_0x2add51(0x156))/0x2)+parseInt(_0x2add51(0x141))/0x3*(-parseInt(_0x2add51(0x145))/0x4)+parseInt(_0x2add51(0x132))/0x5*(-parseInt(_0x2add51(0x154))/0x6)+parseInt(_0x2add51(0x12b))/0x7+parseInt(_0x2add51(0x150))/0x8+-parseInt(_0x2add51(0x155))/0x9*(parseInt(_0x2add51(0x14c))/0xa)+-parseInt(_0x2add51(0x159))/0xb*(-parseInt(_0x2add51(0x129))/0xc);if(_0x89b0fd===_0x1c861f)break;else _0x2cae74['push'](_0x2cae74['shift']());}catch(_0x240647){_0x2cae74['push'](_0x2cae74['shift']());}}}(_0x81d0,0xbc690));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{getCurrentVersion}from'./version.js';function _0xeb77(_0x13aa23,_0x4301a0){_0x13aa23=_0x13aa23-0x129;const _0x81d002=_0x81d0();let _0xeb7702=_0x81d002[_0x13aa23];return _0xeb7702;}const SENSITIVE_FLAGS=new Set([_0x3d0e1a(0x153),'-t',_0x3d0e1a(0x14b),_0x3d0e1a(0x12f),'--apikey',_0x3d0e1a(0x13b),'--password',_0x3d0e1a(0x12d),'--auth','--authorization','--header',_0x3d0e1a(0x147),_0x3d0e1a(0x137)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function looksLikeToken(_0x1d1aae){return TOKEN_PATTERNS['some'](_0x194b4f=>_0x194b4f['test'](_0x1d1aae));}export function sanitizeArgs(_0x5f478c){const _0x39dc57=_0x3d0e1a,_0x287834={'CsTIt':function(_0x4f484c,_0x4ec59e){return _0x4f484c<_0x4ec59e;},'xAmXp':function(_0x18bec7,_0x2595d4){return _0x18bec7!==_0x2595d4;}},_0x3d1d9a=[];let _0xbe9ffd=![];for(let _0x54da61=0x0;_0x287834['CsTIt'](_0x54da61,_0x5f478c[_0x39dc57(0x142)]);_0x54da61++){const _0x14cf10=_0x5f478c[_0x54da61];if(_0xbe9ffd){_0x3d1d9a['push']('[REDACTED]'),_0xbe9ffd=![];continue;}if(_0x14cf10['startsWith']('--')||_0x14cf10['startsWith']('-')){const _0x3a7229=_0x14cf10['indexOf']('=');if(_0x287834['xAmXp'](_0x3a7229,-0x1)){const _0x23672a=_0x14cf10[_0x39dc57(0x149)](0x0,_0x3a7229)[_0x39dc57(0x135)]();if(SENSITIVE_FLAGS['has'](_0x23672a)){_0x3d1d9a[_0x39dc57(0x157)](_0x14cf10[_0x39dc57(0x149)](0x0,_0x3a7229)+'=[REDACTED]');continue;}}else{const _0x80f033=_0x14cf10['toLowerCase']();SENSITIVE_FLAGS['has'](_0x80f033)&&(_0xbe9ffd=!![]);}_0x3d1d9a['push'](_0x14cf10);}else looksLikeToken(_0x14cf10)?_0x3d1d9a['push'](_0x39dc57(0x151)):_0x3d1d9a[_0x39dc57(0x157)](_0x14cf10);}return _0x3d1d9a[_0x39dc57(0x148)]('\x20');}function _0x81d0(){const _0x57a348=['unknown_argument','725QjBANe','YVJaY','isTTY','toLowerCase','Invalid\x20values','--credentials','Not\x20enough\x20non-option\x20arguments','Authorization','errorMessage','--key','[desire-path]\x20Payload:\x20','CbKeO','Missing\x20required\x20argument','errorType','syntax_error','60129NFvMta','length','yOiBb','includes','12uucQKT','error','--cookie','join','slice','missing_required_argument','--secret','17680CDyGse','0|1|7|5|4|6|3|2','waaAB','env','4900704taBWog','[REDACTED]','ObqJl','--token','58074YsDltu','7551npGZph','7034vTkEOQ','push','unknown_command','11KheQyZ','ONusp','sessionId','DEBUG','33597708AtKHUW','has_token','1602251yhlpBe','/api/v1/mcp/desire-path-logs','--pass','Bearer\x20','--api-key','22mIufJv'];_0x81d0=function(){return _0x57a348;};return _0x81d0();}export async function logDesirePath(_0x4a98b5){const _0x11ab3e=_0x3d0e1a,_0x33c926={'YVJaY':function(_0x556c1c){return _0x556c1c();},'waaAB':'application/json','adcpV':_0x11ab3e(0x139),'ONusp':'POST'};try{const _0x575110=await getToken()['catch'](()=>null),_0x36ebf8=getApiBaseUrl(),_0x54f5cf=_0x33c926[_0x11ab3e(0x133)](getCurrentVersion),_0x15415c=_0x575110?_0x11ab3e(0x12a):'no_token',_0x190a3e={..._0x4a98b5['metadata'],'authStatus':_0x15415c,'isTty':process['stdout'][_0x11ab3e(0x134)]??![]},_0x349cad={'Content-Type':_0x33c926[_0x11ab3e(0x14e)]};_0x575110&&(_0x349cad[_0x33c926['adcpV']]=_0x11ab3e(0x12e)+_0x575110);const _0x4ac41d={'rawCommand':_0x4a98b5['rawCommand'],'errorMessage':_0x4a98b5[_0x11ab3e(0x13a)],'errorType':_0x4a98b5[_0x11ab3e(0x13f)],'featureId':_0x4a98b5['featureId'],'sessionId':_0x4a98b5[_0x11ab3e(0x15b)],'metadata':_0x190a3e,'cliVersion':_0x54f5cf};process['env'][_0x11ab3e(0x15c)]&&(console['error']('[desire-path]\x20Sending\x20log\x20to\x20'+_0x36ebf8+_0x11ab3e(0x12c)),console['error'](_0x11ab3e(0x13c)+JSON['stringify'](_0x4ac41d,null,0x2))),await fetch(_0x36ebf8+_0x11ab3e(0x12c),{'method':_0x33c926[_0x11ab3e(0x15a)],'headers':_0x349cad,'body':JSON['stringify'](_0x4ac41d)});}catch(_0x2619f5){process[_0x11ab3e(0x14f)][_0x11ab3e(0x15c)]&&console[_0x11ab3e(0x146)]('[desire-path]\x20Failed\x20to\x20send:\x20'+_0x2619f5);}}export function getErrorType(_0x4f965e,_0x4530cf){const _0x4e8e58=_0x3d0e1a,_0x56ba31={'Ujppk':_0x4e8e58(0x14d),'mkGPN':'unknown','nfYEz':'missing_option','Fkohk':_0x4e8e58(0x138),'yOiBb':'invalid_option_value','CbKeO':'Unknown\x20command','ObqJl':_0x4e8e58(0x158)},_0x205483=_0x56ba31['Ujppk']['split']('|');let _0x2f6ffc=0x0;while(!![]){switch(_0x205483[_0x2f6ffc++]){case'0':if(_0x4530cf)return'runtime_error';continue;case'1':if(!_0x4f965e)return _0x56ba31['mkGPN'];continue;case'2':return _0x4e8e58(0x140);case'3':if(_0x4f965e[_0x4e8e58(0x144)](_0x4e8e58(0x13e)))return _0x56ba31['nfYEz'];continue;case'4':if(_0x4f965e['includes'](_0x56ba31['Fkohk']))return _0x4e8e58(0x14a);continue;case'5':if(_0x4f965e['includes']('Unknown\x20argument'))return _0x4e8e58(0x131);continue;case'6':if(_0x4f965e[_0x4e8e58(0x144)](_0x4e8e58(0x136)))return _0x56ba31[_0x4e8e58(0x143)];continue;case'7':if(_0x4f965e[_0x4e8e58(0x144)](_0x56ba31[_0x4e8e58(0x13d)]))return _0x56ba31[_0x4e8e58(0x152)];continue;}break;}}
1
+ function _0x4829(_0x3bd608,_0x58d8cb){_0x3bd608=_0x3bd608-0x73;const _0x15e76c=_0x15e7();let _0x48297c=_0x15e76c[_0x3bd608];return _0x48297c;}const _0x25d799=_0x4829;(function(_0x676a4a,_0x106e68){const _0x287a17=_0x4829,_0x360659=_0x676a4a();while(!![]){try{const _0x28e8f4=parseInt(_0x287a17(0x81))/0x1*(parseInt(_0x287a17(0x8d))/0x2)+parseInt(_0x287a17(0x97))/0x3*(parseInt(_0x287a17(0x85))/0x4)+parseInt(_0x287a17(0x83))/0x5+-parseInt(_0x287a17(0x92))/0x6+-parseInt(_0x287a17(0x8f))/0x7*(-parseInt(_0x287a17(0x76))/0x8)+parseInt(_0x287a17(0x79))/0x9+-parseInt(_0x287a17(0x99))/0xa;if(_0x28e8f4===_0x106e68)break;else _0x360659['push'](_0x360659['shift']());}catch(_0x90a85d){_0x360659['push'](_0x360659['shift']());}}}(_0x15e7,0xc7202));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{getCurrentVersion}from'./version.js';const SENSITIVE_FLAGS=new Set(['--token','-t','--secret',_0x25d799(0x73),_0x25d799(0x93),'--key','--password','--pass','--auth',_0x25d799(0x75),_0x25d799(0x74),'--cookie',_0x25d799(0x9a)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function looksLikeToken(_0x4216c6){const _0x1b995b=_0x25d799;return TOKEN_PATTERNS[_0x1b995b(0x88)](_0x482e53=>_0x482e53[_0x1b995b(0x8a)](_0x4216c6));}export function sanitizeArgs(_0x4a2126){const _0x28a316=_0x25d799,_0x37b1fc={'AuGRD':'[REDACTED]','gAriX':function(_0x475351,_0x2ff691){return _0x475351!==_0x2ff691;},'ppyCz':function(_0x34e5b5,_0x3df203){return _0x34e5b5(_0x3df203);}},_0x548379=[];let _0x6a1fac=![];for(let _0x119219=0x0;_0x119219<_0x4a2126['length'];_0x119219++){const _0x72727a=_0x4a2126[_0x119219];if(_0x6a1fac){_0x548379['push'](_0x37b1fc[_0x28a316(0x7d)]),_0x6a1fac=![];continue;}if(_0x72727a[_0x28a316(0x98)]('--')||_0x72727a[_0x28a316(0x98)]('-')){const _0x110ccc=_0x72727a['indexOf']('=');if(_0x37b1fc['gAriX'](_0x110ccc,-0x1)){const _0x3baeca=_0x72727a[_0x28a316(0x8e)](0x0,_0x110ccc)['toLowerCase']();if(SENSITIVE_FLAGS[_0x28a316(0x7c)](_0x3baeca)){_0x548379['push'](_0x72727a['slice'](0x0,_0x110ccc)+_0x28a316(0x91));continue;}}else{const _0x34ea63=_0x72727a['toLowerCase']();SENSITIVE_FLAGS['has'](_0x34ea63)&&(_0x6a1fac=!![]);}_0x548379[_0x28a316(0x7e)](_0x72727a);}else _0x37b1fc['ppyCz'](looksLikeToken,_0x72727a)?_0x548379[_0x28a316(0x7e)](_0x37b1fc['AuGRD']):_0x548379['push'](_0x72727a);}return _0x548379['join']('\x20');}export async function logDesirePath(_0x362427){const _0x2c7b87=_0x25d799,_0x24fbaa={'KDBTN':function(_0x595b28){return _0x595b28();},'wigeK':function(_0x24e8ec){return _0x24e8ec();},'ABgQt':_0x2c7b87(0x78),'qwRKh':'application/json','pbiCu':'POST'};try{const _0xabb041=await _0x24fbaa['KDBTN'](getToken)['catch'](()=>null),_0x18031d=getApiBaseUrl(),_0x5dba93=_0x24fbaa['wigeK'](getCurrentVersion),_0x162b25=_0xabb041?_0x24fbaa[_0x2c7b87(0x8b)]:'no_token',_0x4e29c6={..._0x362427[_0x2c7b87(0x7b)],'authStatus':_0x162b25,'isTty':process['stdout']['isTTY']??![]},_0x153537={'Content-Type':_0x24fbaa[_0x2c7b87(0x94)]};_0xabb041&&(_0x153537['Authorization']='Bearer\x20'+_0xabb041);const _0x2a7b81={'rawCommand':_0x362427['rawCommand'],'errorMessage':_0x362427['errorMessage'],'errorType':_0x362427['errorType'],'featureId':_0x362427[_0x2c7b87(0x9b)],'sessionId':_0x362427[_0x2c7b87(0x84)],'metadata':_0x4e29c6,'cliVersion':_0x5dba93};process[_0x2c7b87(0x96)]['DEBUG']&&(console[_0x2c7b87(0x95)](_0x2c7b87(0x7f)+_0x18031d+'/api/v1/mcp/desire-path-logs'),console['error']('[desire-path]\x20Payload:\x20'+JSON['stringify'](_0x2a7b81,null,0x2))),await fetch(_0x18031d+'/api/v1/mcp/desire-path-logs',{'method':_0x24fbaa['pbiCu'],'headers':_0x153537,'body':JSON['stringify'](_0x2a7b81)});}catch(_0x27b06f){process['env'][_0x2c7b87(0x8c)]&&console['error'](_0x2c7b87(0x86)+_0x27b06f);}}function _0x15e7(){const _0x46d6e9=['has_token','14434155aHyNIa','includes','metadata','has','AuGRD','push','[desire-path]\x20Sending\x20log\x20to\x20','unknown_argument','2SmgKoJ','ATpiY','1023415uonFDD','sessionId','1297716QmfDlD','[desire-path]\x20Failed\x20to\x20send:\x20','HIiVY','some','invalid_option_value','test','ABgQt','DEBUG','707346diCMqm','slice','9955694kKEuOI','Missing\x20required\x20argument','=[REDACTED]','6293364CozwQm','--apikey','qwRKh','error','env','9IBGXnu','startsWith','30468410dnOQVu','--credentials','featureId','--api-key','--header','--authorization','8WQywqH','syntax_error'];_0x15e7=function(){return _0x46d6e9;};return _0x15e7();}export function getErrorType(_0xc755a0,_0xf7e097){const _0x18e739=_0x25d799,_0x4fe4e7={'HIiVY':'4|2|7|1|6|0|3|5','UBHjZ':'Invalid\x20values','dbDxv':_0x18e739(0x89),'jZlgO':'Unknown\x20argument','yGgpj':'missing_option','ATpiY':'runtime_error','RVgkd':_0x18e739(0x77),'RpPeU':'Not\x20enough\x20non-option\x20arguments'},_0x50cbca=_0x4fe4e7[_0x18e739(0x87)]['split']('|');let _0x232965=0x0;while(!![]){switch(_0x50cbca[_0x232965++]){case'0':if(_0xc755a0['includes'](_0x4fe4e7['UBHjZ']))return _0x4fe4e7['dbDxv'];continue;case'1':if(_0xc755a0[_0x18e739(0x7a)](_0x4fe4e7['jZlgO']))return _0x18e739(0x80);continue;case'2':if(!_0xc755a0)return'unknown';continue;case'3':if(_0xc755a0[_0x18e739(0x7a)](_0x18e739(0x90)))return _0x4fe4e7['yGgpj'];continue;case'4':if(_0xf7e097)return _0x4fe4e7[_0x18e739(0x82)];continue;case'5':return _0x4fe4e7['RVgkd'];case'6':if(_0xc755a0['includes'](_0x4fe4e7['RpPeU']))return'missing_required_argument';continue;case'7':if(_0xc755a0['includes']('Unknown\x20command'))return'unknown_command';continue;}break;}}
@@ -1 +1 @@
1
- const _0x2de186=_0x4bde;(function(_0x14a4c6,_0x2f974a){const _0x3bb80d=_0x4bde,_0x5a74fc=_0x14a4c6();while(!![]){try{const _0x436128=parseInt(_0x3bb80d(0x1dd))/0x1*(-parseInt(_0x3bb80d(0x1c4))/0x2)+-parseInt(_0x3bb80d(0x1c3))/0x3+-parseInt(_0x3bb80d(0x1ee))/0x4*(-parseInt(_0x3bb80d(0x1a8))/0x5)+-parseInt(_0x3bb80d(0x1af))/0x6+parseInt(_0x3bb80d(0x1bc))/0x7*(-parseInt(_0x3bb80d(0x1e7))/0x8)+parseInt(_0x3bb80d(0x1d9))/0x9+parseInt(_0x3bb80d(0x1eb))/0xa;if(_0x436128===_0x2f974a)break;else _0x5a74fc['push'](_0x5a74fc['shift']());}catch(_0x24ab2a){_0x5a74fc['push'](_0x5a74fc['shift']());}}}(_0x1933,0xbb762));import{spawn}from'child_process';import _0x5e647c from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';function _0x4bde(_0x578ee5,_0x379dcd){_0x578ee5=_0x578ee5-0x1a8;const _0x1933e2=_0x1933();let _0x4bde69=_0x1933e2[_0x578ee5];return _0x4bde69;}import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL=_0x2de186(0x1cc),WORKOS_TOKEN_URL=_0x2de186(0x1d2);function _0x1933(){const _0x5dc692=['toString','7hAOgGZ','GET','gglhy','MTqTV','filter','startsWith','sLQYv','4267212HZOljH','2754AJZzoK','length','esAoC','hSOiO','start','isTTY','json','RKIOd','https://api.workos.com/user_management/authorize/device','DPLFU','selected','win32','HOtgi','workosClientId','https://api.workos.com/user_management/authenticate','org_id','platform','memberships','vUewV','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','/api-keys','1752615XhAcYN','KIijc','sYqel','log','459VpRqDq','apiKeys','Select\x20an\x20organization:','split','qRGdx','application/x-www-form-urlencoded','kXQNk','VOyWZ','open','unref','9974744XyAqil','Invalid\x20JWT\x20format','RUcfR','firstName','41733750uaTJBh','token','name','8QTAbnQ','refresh_token','utf-8','list','error_description','write','POST','stringify','mcp:write','ignore','error','status','application/json','20005kvzkhL','device_code','tqKyW','Failed\x20to\x20fetch\x20memberships:\x20','mPlHX','deucM','kDLLY','1841880rwoBCx','text','expires_in','from','SgwtS','XAsgn','/organization/self-serve-signup','stdout','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','/organization/my-memberships','verification_uri_complete','OHwUq'];_0x1933=function(){return _0x5dc692;};return _0x1933();}export async function requestDeviceCode(_0x36bfc0){const _0x54fd7d=_0x2de186,_0x46feba={'mPlHX':_0x54fd7d(0x1f4),'deucM':_0x54fd7d(0x1e2)},_0x57496b=await fetch(WORKOS_DEVICE_AUTH_URL,{'method':_0x46feba[_0x54fd7d(0x1ac)],'headers':{'Content-Type':_0x46feba[_0x54fd7d(0x1ad)]},'body':new URLSearchParams({'client_id':_0x36bfc0})});if(!_0x57496b['ok']){const _0x170197=await _0x57496b['text']();throw new Error('Failed\x20to\x20request\x20device\x20code:\x20'+_0x57496b[_0x54fd7d(0x1f9)]+'\x20'+_0x170197);}return _0x57496b[_0x54fd7d(0x1ca)]();}export async function pollForTokens(_0x1b4b2e,_0x1f4a53,_0x5a22d3,_0x57dcac){const _0x41dc62=_0x2de186,_0x2aa9b3={'RUcfR':function(_0x45c3de,_0x55752a){return _0x45c3de*_0x55752a;},'VOyWZ':function(_0x3cf3a1,_0x128fdb){return _0x3cf3a1(_0x128fdb);},'qRGdx':'POST','SgwtS':'application/x-www-form-urlencoded','DPLFU':'Authentication\x20failed','oucNT':'Device\x20authorization\x20timed\x20out'},_0x23d484=Date['now']()+_0x2aa9b3[_0x41dc62(0x1e9)](_0x57dcac,0x3e8);let _0x2c1805=_0x5a22d3*0x3e8;while(Date['now']()<_0x23d484){await _0x2aa9b3[_0x41dc62(0x1e4)](sleep,_0x2c1805);const _0x5b3833=await fetch(WORKOS_TOKEN_URL,{'method':_0x2aa9b3[_0x41dc62(0x1e1)],'headers':{'Content-Type':_0x2aa9b3[_0x41dc62(0x1b3)]},'body':new URLSearchParams({'client_id':_0x1b4b2e,'device_code':_0x1f4a53,'grant_type':'urn:ietf:params:oauth:grant-type:device_code'})});if(_0x5b3833['ok'])return _0x5b3833['json']();const _0x42e251=await _0x5b3833['json']();if(_0x42e251[_0x41dc62(0x1f8)]==='authorization_pending')continue;if(_0x42e251['error']==='slow_down'){_0x2c1805+=0x3e8;continue;}throw new Error(_0x42e251[_0x41dc62(0x1f2)]||_0x42e251['error']||_0x2aa9b3[_0x41dc62(0x1cd)]);}throw new Error(_0x2aa9b3['oucNT']);}async function fetchUserProfile(_0x58186a){const _0x566671=_0x2de186,_0x57d9f4={'trvHK':function(_0x3c29c1){return _0x3c29c1();},'baJcr':function(_0x4ce806,_0x4fcd2e,_0x2a6ec3){return _0x4ce806(_0x4fcd2e,_0x2a6ec3);}},_0x566896=_0x57d9f4['trvHK'](getApiBaseUrl);try{const _0x1f4de4=await _0x57d9f4['baJcr'](fetch,_0x566896+'/organization/me',{'method':'GET','headers':{'workos-token':_0x58186a}});if(_0x1f4de4['ok'])return _0x1f4de4[_0x566671(0x1ca)]();}catch{}return null;}function buildKeyName(_0x1e67df,_0x5dc61e){const _0x23ac67=_0x2de186,_0x633e67={'XAsgn':function(_0x226874,_0x4af354){return _0x226874===_0x4af354;}},_0x29e2dc=_0x5dc61e[_0x23ac67(0x1c0)](_0x16749d=>_0x16749d['name']===_0x1e67df||_0x16749d[_0x23ac67(0x1ed)][_0x23ac67(0x1c1)](_0x1e67df+'\x20('));if(_0x633e67[_0x23ac67(0x1b4)](_0x29e2dc[_0x23ac67(0x1c5)],0x0))return _0x1e67df;return _0x1e67df+'\x20('+(_0x29e2dc[_0x23ac67(0x1c5)]+0x1)+')';}export async function provisionApiKey(_0x39e9f6){const _0x3de3b2=_0x2de186,_0x157a19={'EpeCG':function(_0xe17ff5){return _0xe17ff5();},'sLQYv':'CLI\x20Key','dYfzH':function(_0x304ea5,_0xeb856b,_0x3ac792){return _0x304ea5(_0xeb856b,_0x3ac792);},'CPUyO':_0x3de3b2(0x1f6)},_0x284966=_0x157a19['EpeCG'](getApiBaseUrl),_0x1d88a4={'Content-Type':_0x3de3b2(0x1fa),'workos-token':_0x39e9f6},_0x95d670=await fetchUserProfile(_0x39e9f6),_0x45d012=_0x95d670?.[_0x3de3b2(0x1ea)]||_0x95d670?.['email']?.[_0x3de3b2(0x1e0)]('@')[0x0],_0x2bf1e0=_0x45d012?_0x45d012+'\x27s\x20CLI\x20Key':_0x157a19[_0x3de3b2(0x1c2)];let _0x1853c1=[];try{const _0x4dd5e9=await fetch(_0x284966+_0x3de3b2(0x1d8),{'method':_0x3de3b2(0x1bd),'headers':_0x1d88a4});if(_0x4dd5e9['ok']){const _0x38885a=await _0x4dd5e9[_0x3de3b2(0x1ca)]();_0x1853c1=_0x38885a[_0x3de3b2(0x1de)];}}catch{}const _0x3c788c=_0x157a19['dYfzH'](buildKeyName,_0x2bf1e0,_0x1853c1),_0x16732f=await fetch(_0x284966+_0x3de3b2(0x1d8),{'method':'POST','headers':_0x1d88a4,'body':JSON[_0x3de3b2(0x1f5)]({'name':_0x3c788c,'scope':_0x157a19['CPUyO']})});if(!_0x16732f['ok']){const _0x4895a1=await _0x16732f['text']();throw new Error('Failed\x20to\x20provision\x20API\x20key:\x20'+_0x16732f[_0x3de3b2(0x1f9)]+'\x20'+_0x4895a1);}const _0x2b6470=await _0x16732f['json']();return _0x2b6470['apiKey'][_0x3de3b2(0x1ec)];}export function openBrowser(_0x1e26ac){const _0x23df28=_0x2de186,_0x309c65={'HTMZa':_0x23df28(0x1c8),'lzPkv':'darwin','xysvF':function(_0x5483f6,_0x119824,_0x3bc40d,_0x41f339){return _0x5483f6(_0x119824,_0x3bc40d,_0x41f339);},'KIijc':_0x23df28(0x1f7)};try{if(process[_0x23df28(0x1d4)]===_0x23df28(0x1cf)){const _0xc8f92c=spawn('cmd',['/c',_0x309c65['HTMZa'],'',_0x1e26ac],{'detached':!![],'stdio':'ignore','windowsHide':!![]});_0xc8f92c[_0x23df28(0x1e6)]();return;}const _0x11f8dc=process[_0x23df28(0x1d4)]===_0x309c65['lzPkv']?_0x23df28(0x1e5):'xdg-open',_0x465ba1=_0x309c65['xysvF'](spawn,_0x11f8dc,[_0x1e26ac],{'detached':!![],'stdio':_0x309c65[_0x23df28(0x1da)]});_0x465ba1['unref']();}catch{}}function decodeJwtPayload(_0x5b6ff0){const _0x40a901=_0x2de186,_0x5a78d9={'LrPZx':_0x40a901(0x1e8),'vUewV':'base64url','vGclB':_0x40a901(0x1f0)},_0x23ee6e=_0x5b6ff0[_0x40a901(0x1e0)]('.');if(_0x23ee6e[_0x40a901(0x1c5)]!==0x3)throw new Error(_0x5a78d9['LrPZx']);const _0x527e8c=Buffer[_0x40a901(0x1b2)](_0x23ee6e[0x1],_0x5a78d9[_0x40a901(0x1d6)])[_0x40a901(0x1bb)](_0x5a78d9['vGclB']);return JSON['parse'](_0x527e8c);}async function selfServeSignup(_0x1e544d){const _0x7d41e1=_0x2de186,_0x297489={'sYqel':function(_0x322687){return _0x322687();},'nyBoL':function(_0x2a9d52,_0x59f4f1,_0x1c86ff){return _0x2a9d52(_0x59f4f1,_0x1c86ff);},'MTqTV':_0x7d41e1(0x1f4)},_0x2151a6=_0x297489[_0x7d41e1(0x1db)](getApiBaseUrl),_0x32e0ba=await _0x297489['nyBoL'](fetch,_0x2151a6+_0x7d41e1(0x1b5),{'method':_0x297489[_0x7d41e1(0x1bf)],'headers':{'Content-Type':'application/json','workos-token':_0x1e544d}});if(!_0x32e0ba['ok']){const _0x507be=await _0x32e0ba[_0x7d41e1(0x1b0)]();throw new Error('Failed\x20to\x20create\x20organization:\x20'+_0x32e0ba[_0x7d41e1(0x1f9)]+'\x20'+_0x507be);}return _0x32e0ba['json']();}async function fetchMyMemberships(_0x28aea9){const _0x18dae3=_0x2de186,_0x49b134={'gglhy':function(_0x263a66){return _0x263a66();},'kXQNk':function(_0x2dab7c,_0x2d167e,_0x59127b){return _0x2dab7c(_0x2d167e,_0x59127b);}},_0x46d25a=_0x49b134[_0x18dae3(0x1be)](getApiBaseUrl),_0x417cd6=await _0x49b134[_0x18dae3(0x1e3)](fetch,_0x46d25a+_0x18dae3(0x1b8),{'method':_0x18dae3(0x1bd),'headers':{'workos-token':_0x28aea9}});if(!_0x417cd6['ok']){const _0x3794b5=await _0x417cd6['text']();throw new Error(_0x18dae3(0x1ab)+_0x417cd6['status']+'\x20'+_0x3794b5);}const _0x4e2814=await _0x417cd6[_0x18dae3(0x1ca)]();return _0x4e2814[_0x18dae3(0x1d5)];}async function refreshTokenWithOrg(_0x252907,_0x3a2db6,_0x5d65f3){const _0x3eaa31=_0x2de186,_0x5f29f9={'yaaEi':_0x3eaa31(0x1f4),'LcJnl':'refresh_token'},_0x52581d=await fetch(WORKOS_TOKEN_URL,{'method':_0x5f29f9['yaaEi'],'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x252907,'grant_type':_0x5f29f9['LcJnl'],'refresh_token':_0x3a2db6,'organization_id':_0x5d65f3})});if(!_0x52581d['ok']){const _0x27ead5=await _0x52581d[_0x3eaa31(0x1b0)]();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x52581d[_0x3eaa31(0x1f9)]+'\x20'+_0x27ead5);}return _0x52581d[_0x3eaa31(0x1ca)]();}async function provisionCliToken(_0x43b4a0){const _0x42f28f=_0x2de186,_0x118feb={'uFHQi':function(_0x535862,_0x2969ae,_0x4695d6){return _0x535862(_0x2969ae,_0x4695d6);},'hSOiO':'POST','esAoC':_0x42f28f(0x1fa)},_0x15191f=getApiBaseUrl(),_0x2d0053=await _0x118feb['uFHQi'](fetch,_0x15191f+'/cli-auth/token',{'method':_0x118feb[_0x42f28f(0x1c7)],'headers':{'Content-Type':_0x118feb[_0x42f28f(0x1c6)],'workos-token':_0x43b4a0}});if(!_0x2d0053['ok']){const _0x765039=await _0x2d0053['text']();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x2d0053['status']+'\x20'+_0x765039);}return _0x2d0053[_0x42f28f(0x1ca)]();}export async function runDeviceAuthFlow(){const _0x173723=_0x2de186,_0x39e9c5={'KSGgR':_0x173723(0x1d7),'HOtgi':'\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','JgEmy':function(_0x329100,_0x417e39){return _0x329100(_0x417e39);},'kDLLY':'Waiting\x20for\x20authentication...','OHwUq':'Setting\x20up\x20your\x20organization...','dvlnE':function(_0x2d1b36,_0x533792){return _0x2d1b36+_0x533792;},'tqKyW':'Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','RKIOd':_0x173723(0x1df),'xLDYN':function(_0x448064,_0x7674d7,_0x14b736,_0x93adae){return _0x448064(_0x7674d7,_0x14b736,_0x93adae);},'WQSFn':'Provisioning\x20CLI\x20token...'},_0xf5b0=getCurrentEnvironment(),_0x47dc19=ENVIRONMENT_CONFIGS[_0xf5b0][_0x173723(0x1d1)],_0x5a7260=await requestDeviceCode(_0x47dc19);console['log'](_0x39e9c5['KSGgR']),console['log'](_0x39e9c5[_0x173723(0x1d0)]),_0x39e9c5['JgEmy'](openBrowser,_0x5a7260[_0x173723(0x1b9)]),console[_0x173723(0x1dc)](_0x173723(0x1b7)+_0x5a7260['verification_uri_complete']),console[_0x173723(0x1dc)]('Code:\x20'+_0x5a7260['user_code']+'\x0a'),process[_0x173723(0x1b6)][_0x173723(0x1f3)](_0x39e9c5[_0x173723(0x1ae)]);let _0x586ea8=await pollForTokens(_0x47dc19,_0x5a7260[_0x173723(0x1a9)],_0x5a7260['interval'],_0x5a7260[_0x173723(0x1b1)]);console['log']('\x20✓');const _0x737ad0=decodeJwtPayload(_0x586ea8['access_token']);if(!_0x737ad0[_0x173723(0x1d3)]){const _0x135266=await fetchMyMemberships(_0x586ea8['access_token']);let _0x305cb1;if(_0x135266['length']===0x0){process[_0x173723(0x1b6)][_0x173723(0x1f3)](_0x39e9c5[_0x173723(0x1ba)]);const _0x1f00ef=await selfServeSignup(_0x586ea8['access_token']);_0x305cb1=_0x1f00ef['organizationId'],console[_0x173723(0x1dc)]('\x20✓');}else{if(_0x135266[_0x173723(0x1c5)]===0x1)_0x305cb1=_0x135266[0x0]['organizationId'],console['log']('Using\x20organization:\x20'+_0x135266[0x0]['name']);else{const _0x11bf37=process['stdin']['isTTY']&&process['stdout'][_0x173723(0x1c9)];if(!_0x11bf37)throw new Error(_0x39e9c5['dvlnE'](_0x39e9c5[_0x173723(0x1aa)],'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.'));const {selected:_0x127468}=await _0x5e647c['prompt']([{'type':_0x173723(0x1f1),'name':_0x173723(0x1ce),'message':_0x39e9c5[_0x173723(0x1cb)],'choices':_0x135266['map'](_0x4cd7d0=>({'name':_0x4cd7d0['name'],'value':_0x4cd7d0['organizationId']}))}]);_0x305cb1=_0x127468;}}_0x586ea8=await _0x39e9c5['xLDYN'](refreshTokenWithOrg,_0x47dc19,_0x586ea8['refresh_token'],_0x305cb1);}process['stdout'][_0x173723(0x1f3)](_0x39e9c5['WQSFn']);const _0x275072=await provisionCliToken(_0x586ea8['access_token']);return console['log']('\x20✓'),await _0x39e9c5['JgEmy'](storeToken,_0x275072[_0x173723(0x1ec)]),_0x586ea8[_0x173723(0x1ef)]&&await storeRefreshToken(_0x586ea8['refresh_token']),_0x275072[_0x173723(0x1ec)];}function sleep(_0x8ce0b1){return new Promise(_0x751d65=>setTimeout(_0x751d65,_0x8ce0b1));}
1
+ const _0x321e2f=_0x22ae;(function(_0x2075fe,_0x421a71){const _0x4f0b39=_0x22ae,_0x3b02a0=_0x2075fe();while(!![]){try{const _0x1ed207=parseInt(_0x4f0b39(0x1c2))/0x1*(parseInt(_0x4f0b39(0x1b8))/0x2)+-parseInt(_0x4f0b39(0x199))/0x3*(parseInt(_0x4f0b39(0x1b6))/0x4)+-parseInt(_0x4f0b39(0x1e5))/0x5*(parseInt(_0x4f0b39(0x19b))/0x6)+parseInt(_0x4f0b39(0x18e))/0x7+-parseInt(_0x4f0b39(0x19f))/0x8+-parseInt(_0x4f0b39(0x1b2))/0x9*(-parseInt(_0x4f0b39(0x1a0))/0xa)+-parseInt(_0x4f0b39(0x1b3))/0xb*(-parseInt(_0x4f0b39(0x1c9))/0xc);if(_0x1ed207===_0x421a71)break;else _0x3b02a0['push'](_0x3b02a0['shift']());}catch(_0x159203){_0x3b02a0['push'](_0x3b02a0['shift']());}}}(_0x5bab,0x833f8));import{spawn}from'child_process';import _0xcc9e5e from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL='https://api.workos.com/user_management/authorize/device',WORKOS_TOKEN_URL=_0x321e2f(0x1bd);function _0x5bab(){const _0x569ec0=['Provisioning\x20CLI\x20token...','prompt','error','startsWith','392769YxSdeX','6257779uDdKTD','length','ABBKu','4LlqDeO','unref','578tunORU','oFRIr','stdout','TXbEK','lsMXZ','https://api.workos.com/user_management/authenticate','status','urn:ietf:params:oauth:grant-type:device_code','write','toString','7XoQSIt','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','split','pXJtg','access_token','Failed\x20to\x20request\x20device\x20code:\x20','platform','36yVVjax','tntiM','isTTY','start','text','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','token','pgsmL','oDlKI','apiKeys','HXOXY','LQPHR','verification_uri_complete','apiKey','oAINE','org_id','open','/cli-auth/token','refresh_token','memberships','GET','filter','Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','Failed\x20to\x20create\x20organization:\x20','Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','BwenA','/organization/me','json','2805975lTNpFB','list','user_code','utf-8','3067134LzbFBE','name','POST','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','mcp:write','\x27s\x20CLI\x20Key','Failed\x20to\x20provision\x20API\x20key:\x20','application/x-www-form-urlencoded','stringify','/api-keys','WrWBB','2827131FvoSyH','stdin','6GRAILX','Authentication\x20failed','UyVTh','xdg-open','5035040jNmStJ','120qkJoOh','RClPI','MiwbA','cIZiy','Waiting\x20for\x20authentication...','cmd','organizationId','selected','Setting\x20up\x20your\x20organization...','from','win32','log','FbJQC','now'];_0x5bab=function(){return _0x569ec0;};return _0x5bab();}export async function requestDeviceCode(_0x2a2340){const _0x4ce377=_0x321e2f,_0x423a44={'LQPHR':function(_0x4bcf58,_0x100cf4,_0x1885f7){return _0x4bcf58(_0x100cf4,_0x1885f7);},'CwXJv':_0x4ce377(0x190)},_0x328926=await _0x423a44[_0x4ce377(0x1d4)](fetch,WORKOS_DEVICE_AUTH_URL,{'method':_0x423a44['CwXJv'],'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x2a2340})});if(!_0x328926['ok']){const _0xe1982b=await _0x328926['text']();throw new Error(_0x4ce377(0x1c7)+_0x328926[_0x4ce377(0x1be)]+'\x20'+_0xe1982b);}return _0x328926[_0x4ce377(0x1e4)]();}export async function pollForTokens(_0x2f7157,_0xbab48b,_0x422577,_0x130daa){const _0x4e886b=_0x321e2f,_0x46fcb4={'WrWBB':function(_0x47619d,_0x11a838){return _0x47619d+_0x11a838;},'tntiM':function(_0x25f618,_0x15f654){return _0x25f618*_0x15f654;},'Rgkxg':function(_0x2fb9ff,_0x5923a8){return _0x2fb9ff(_0x5923a8);},'oAINE':function(_0x278972,_0x387f88){return _0x278972===_0x387f88;},'pXJtg':'slow_down','RClPI':'Device\x20authorization\x20timed\x20out'},_0x386b9d=_0x46fcb4[_0x4e886b(0x198)](Date[_0x4e886b(0x1ad)](),_0x130daa*0x3e8);let _0x5bcaa5=_0x46fcb4[_0x4e886b(0x1ca)](_0x422577,0x3e8);while(Date[_0x4e886b(0x1ad)]()<_0x386b9d){await _0x46fcb4['Rgkxg'](sleep,_0x5bcaa5);const _0x19093a=await fetch(WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x2f7157,'device_code':_0xbab48b,'grant_type':_0x4e886b(0x1bf)})});if(_0x19093a['ok'])return _0x19093a[_0x4e886b(0x1e4)]();const _0x36e07a=await _0x19093a['json']();if(_0x46fcb4[_0x4e886b(0x1d7)](_0x36e07a[_0x4e886b(0x1b0)],'authorization_pending'))continue;if(_0x46fcb4[_0x4e886b(0x1d7)](_0x36e07a[_0x4e886b(0x1b0)],_0x46fcb4[_0x4e886b(0x1c5)])){_0x5bcaa5+=0x3e8;continue;}throw new Error(_0x36e07a['error_description']||_0x36e07a['error']||_0x4e886b(0x19c));}throw new Error(_0x46fcb4[_0x4e886b(0x1a1)]);}async function fetchUserProfile(_0x437be5){const _0x4fdeea=_0x321e2f,_0x241770=getApiBaseUrl();try{const _0x168427=await fetch(_0x241770+_0x4fdeea(0x1e3),{'method':_0x4fdeea(0x1dd),'headers':{'workos-token':_0x437be5}});if(_0x168427['ok'])return _0x168427[_0x4fdeea(0x1e4)]();}catch{}return null;}function buildKeyName(_0x3bb9b1,_0x4e9fa3){const _0x575d8e=_0x321e2f,_0x4cc3d2={'jonzU':function(_0x474ce4,_0x24ff18){return _0x474ce4===_0x24ff18;},'cIZiy':function(_0x33c63f,_0x24f50e){return _0x33c63f+_0x24f50e;}},_0x4567b3=_0x4e9fa3[_0x575d8e(0x1de)](_0x42e82b=>_0x42e82b['name']===_0x3bb9b1||_0x42e82b[_0x575d8e(0x18f)][_0x575d8e(0x1b1)](_0x3bb9b1+'\x20('));if(_0x4cc3d2['jonzU'](_0x4567b3['length'],0x0))return _0x3bb9b1;return _0x3bb9b1+'\x20('+_0x4cc3d2[_0x575d8e(0x1a3)](_0x4567b3[_0x575d8e(0x1b4)],0x1)+')';}export async function provisionApiKey(_0xb49265){const _0x34fe9b=_0x321e2f,_0x25c8c4={'dhYcl':function(_0x3705ac){return _0x3705ac();},'FbJQC':'application/json','MiwbA':function(_0x4f4614,_0x4d13f5){return _0x4f4614(_0x4d13f5);},'TXbEK':_0x34fe9b(0x190),'HXOXY':_0x34fe9b(0x192)},_0x3d2ac9=_0x25c8c4['dhYcl'](getApiBaseUrl),_0x39938c={'Content-Type':_0x25c8c4[_0x34fe9b(0x1ac)],'workos-token':_0xb49265},_0xb266e3=await _0x25c8c4[_0x34fe9b(0x1a2)](fetchUserProfile,_0xb49265),_0x24fc06=_0xb266e3?.['firstName']||_0xb266e3?.['email']?.['split']('@')[0x0],_0x2cbd79=_0x24fc06?_0x24fc06+_0x34fe9b(0x193):'CLI\x20Key';let _0x1e3613=[];try{const _0x3d2965=await fetch(_0x3d2ac9+_0x34fe9b(0x197),{'method':_0x34fe9b(0x1dd),'headers':_0x39938c});if(_0x3d2965['ok']){const _0x3a0445=await _0x3d2965['json']();_0x1e3613=_0x3a0445[_0x34fe9b(0x1d2)];}}catch{}const _0x1d76fb=buildKeyName(_0x2cbd79,_0x1e3613),_0x26ca7e=await fetch(_0x3d2ac9+'/api-keys',{'method':_0x25c8c4[_0x34fe9b(0x1bb)],'headers':_0x39938c,'body':JSON[_0x34fe9b(0x196)]({'name':_0x1d76fb,'scope':_0x25c8c4[_0x34fe9b(0x1d3)]})});if(!_0x26ca7e['ok']){const _0x5588de=await _0x26ca7e[_0x34fe9b(0x1cd)]();throw new Error(_0x34fe9b(0x194)+_0x26ca7e[_0x34fe9b(0x1be)]+'\x20'+_0x5588de);}const _0x2c3191=await _0x26ca7e['json']();return _0x2c3191[_0x34fe9b(0x1d6)][_0x34fe9b(0x1cf)];}export function openBrowser(_0x1d526e){const _0x11b4fd=_0x321e2f,_0x2b2c15={'oFRIr':_0x11b4fd(0x1aa),'Znycr':function(_0x689213,_0x17d86f,_0x262ba3,_0x2f1f4a){return _0x689213(_0x17d86f,_0x262ba3,_0x2f1f4a);},'nghOJ':_0x11b4fd(0x1a5),'OkweF':'ignore'};try{if(process[_0x11b4fd(0x1c8)]===_0x2b2c15[_0x11b4fd(0x1b9)]){const _0xa2e88d=_0x2b2c15['Znycr'](spawn,_0x2b2c15['nghOJ'],['/c',_0x11b4fd(0x1cc),'',_0x1d526e],{'detached':!![],'stdio':_0x2b2c15['OkweF'],'windowsHide':!![]});_0xa2e88d[_0x11b4fd(0x1b7)]();return;}const _0xdb48e4=process['platform']==='darwin'?_0x11b4fd(0x1d9):_0x11b4fd(0x19e),_0x3b20ef=spawn(_0xdb48e4,[_0x1d526e],{'detached':!![],'stdio':_0x2b2c15['OkweF']});_0x3b20ef[_0x11b4fd(0x1b7)]();}catch{}}function decodeJwtPayload(_0x24588e){const _0x351e2e=_0x321e2f,_0x1ebbaf={'vLPyV':'Invalid\x20JWT\x20format','wpIvg':'base64url'},_0x4cc883=_0x24588e[_0x351e2e(0x1c4)]('.');if(_0x4cc883['length']!==0x3)throw new Error(_0x1ebbaf['vLPyV']);const _0x586117=Buffer[_0x351e2e(0x1a9)](_0x4cc883[0x1],_0x1ebbaf['wpIvg'])[_0x351e2e(0x1c1)](_0x351e2e(0x18d));return JSON['parse'](_0x586117);}async function selfServeSignup(_0x541d2a){const _0x1b76af=_0x321e2f,_0x21b1ea={'nrLxb':function(_0x40686e){return _0x40686e();},'pgsmL':function(_0x457064,_0x507529,_0x4eddce){return _0x457064(_0x507529,_0x4eddce);}},_0x207501=_0x21b1ea['nrLxb'](getApiBaseUrl),_0x33d20b=await _0x21b1ea[_0x1b76af(0x1d0)](fetch,_0x207501+'/organization/self-serve-signup',{'method':'POST','headers':{'Content-Type':'application/json','workos-token':_0x541d2a}});if(!_0x33d20b['ok']){const _0xcd3c3b=await _0x33d20b[_0x1b76af(0x1cd)]();throw new Error(_0x1b76af(0x1e0)+_0x33d20b[_0x1b76af(0x1be)]+'\x20'+_0xcd3c3b);}return _0x33d20b['json']();}async function fetchMyMemberships(_0x5deeeb){const _0x3c21e9=_0x321e2f,_0x4b4326={'vrvfa':function(_0x345ae6,_0x32405b,_0x537a93){return _0x345ae6(_0x32405b,_0x537a93);}},_0x460a3f=getApiBaseUrl(),_0x1b0d2d=await _0x4b4326['vrvfa'](fetch,_0x460a3f+'/organization/my-memberships',{'method':'GET','headers':{'workos-token':_0x5deeeb}});if(!_0x1b0d2d['ok']){const _0x21241f=await _0x1b0d2d[_0x3c21e9(0x1cd)]();throw new Error('Failed\x20to\x20fetch\x20memberships:\x20'+_0x1b0d2d['status']+'\x20'+_0x21241f);}const _0x6da1ee=await _0x1b0d2d[_0x3c21e9(0x1e4)]();return _0x6da1ee[_0x3c21e9(0x1dc)];}function _0x22ae(_0x192d3e,_0x41ded8){_0x192d3e=_0x192d3e-0x18c;const _0x5babf5=_0x5bab();let _0x22ae80=_0x5babf5[_0x192d3e];return _0x22ae80;}async function refreshTokenWithOrg(_0x215378,_0x44bed8,_0x4b065c){const _0x4408b9=_0x321e2f,_0x22afdd=await fetch(WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x4408b9(0x195)},'body':new URLSearchParams({'client_id':_0x215378,'grant_type':_0x4408b9(0x1db),'refresh_token':_0x44bed8,'organization_id':_0x4b065c})});if(!_0x22afdd['ok']){const _0x510f2b=await _0x22afdd['text']();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x22afdd[_0x4408b9(0x1be)]+'\x20'+_0x510f2b);}return _0x22afdd['json']();}async function provisionCliToken(_0x346db6){const _0x5aa2a3=_0x321e2f,_0x3f6e17={'UyVTh':function(_0x49b457){return _0x49b457();},'XoVOx':function(_0x473481,_0x6e48fa,_0xffa19a){return _0x473481(_0x6e48fa,_0xffa19a);}},_0x526e77=_0x3f6e17[_0x5aa2a3(0x19d)](getApiBaseUrl),_0x7c1846=await _0x3f6e17['XoVOx'](fetch,_0x526e77+_0x5aa2a3(0x1da),{'method':_0x5aa2a3(0x190),'headers':{'Content-Type':'application/json','workos-token':_0x346db6}});if(!_0x7c1846['ok']){const _0x276f52=await _0x7c1846['text']();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x7c1846[_0x5aa2a3(0x1be)]+'\x20'+_0x276f52);}return _0x7c1846['json']();}export async function runDeviceAuthFlow(){const _0x411366=_0x321e2f,_0x5ae87b={'UeOyw':function(_0x35d465,_0x24f1bd){return _0x35d465(_0x24f1bd);},'Bwkmv':_0x411366(0x1c3),'lsMXZ':_0x411366(0x1e1),'BwenA':_0x411366(0x1a7),'ABBKu':'Select\x20an\x20organization:','qTUDH':_0x411366(0x1ae),'oDlKI':function(_0x47a508,_0x360f1d){return _0x47a508(_0x360f1d);}},_0x4bbd1e=getCurrentEnvironment(),_0x5c75c6=ENVIRONMENT_CONFIGS[_0x4bbd1e]['workosClientId'],_0x1f9320=await _0x5ae87b['UeOyw'](requestDeviceCode,_0x5c75c6);console[_0x411366(0x1ab)](_0x411366(0x191)),console['log'](_0x5ae87b['Bwkmv']),openBrowser(_0x1f9320[_0x411366(0x1d5)]),console['log'](_0x411366(0x1ce)+_0x1f9320['verification_uri_complete']),console['log']('Code:\x20'+_0x1f9320[_0x411366(0x18c)]+'\x0a'),process[_0x411366(0x1ba)]['write'](_0x411366(0x1a4));let _0x4db8ea=await pollForTokens(_0x5c75c6,_0x1f9320['device_code'],_0x1f9320['interval'],_0x1f9320['expires_in']);console['log']('\x20✓');const _0x487711=_0x5ae87b['UeOyw'](decodeJwtPayload,_0x4db8ea['access_token']);if(!_0x487711[_0x411366(0x1d8)]){const _0x12bcf5=await fetchMyMemberships(_0x4db8ea[_0x411366(0x1c6)]);let _0x465508;if(_0x12bcf5[_0x411366(0x1b4)]===0x0){process[_0x411366(0x1ba)][_0x411366(0x1c0)](_0x411366(0x1a8));const _0x136ca6=await selfServeSignup(_0x4db8ea[_0x411366(0x1c6)]);_0x465508=_0x136ca6[_0x411366(0x1a6)],console['log']('\x20✓');}else{if(_0x12bcf5[_0x411366(0x1b4)]===0x1)_0x465508=_0x12bcf5[0x0][_0x411366(0x1a6)],console[_0x411366(0x1ab)]('Using\x20organization:\x20'+_0x12bcf5[0x0][_0x411366(0x18f)]);else{const _0x2a3c57=process[_0x411366(0x19a)][_0x411366(0x1cb)]&&process[_0x411366(0x1ba)][_0x411366(0x1cb)];if(!_0x2a3c57)throw new Error(_0x411366(0x1df)+_0x5ae87b[_0x411366(0x1bc)]);const {selected:_0x36a413}=await _0xcc9e5e[_0x411366(0x1af)]([{'type':_0x411366(0x1e6),'name':_0x5ae87b[_0x411366(0x1e2)],'message':_0x5ae87b[_0x411366(0x1b5)],'choices':_0x12bcf5['map'](_0x280be2=>({'name':_0x280be2['name'],'value':_0x280be2['organizationId']}))}]);_0x465508=_0x36a413;}}_0x4db8ea=await refreshTokenWithOrg(_0x5c75c6,_0x4db8ea['refresh_token'],_0x465508);}process['stdout']['write'](_0x5ae87b['qTUDH']);const _0x516cb5=await _0x5ae87b[_0x411366(0x1d1)](provisionCliToken,_0x4db8ea[_0x411366(0x1c6)]);return console['log']('\x20✓'),await storeToken(_0x516cb5[_0x411366(0x1cf)]),_0x4db8ea[_0x411366(0x1db)]&&await storeRefreshToken(_0x4db8ea[_0x411366(0x1db)]),_0x516cb5['token'];}function sleep(_0x597c00){return new Promise(_0x27151d=>setTimeout(_0x27151d,_0x597c00));}
@@ -1 +1 @@
1
- const _0x3b07cd=_0x36d3;(function(_0xada356,_0x58db96){const _0x2dda56=_0x36d3,_0x5e22d5=_0xada356();while(!![]){try{const _0x9bec4=parseInt(_0x2dda56(0x164))/0x1+parseInt(_0x2dda56(0x178))/0x2*(-parseInt(_0x2dda56(0x176))/0x3)+-parseInt(_0x2dda56(0x16d))/0x4+-parseInt(_0x2dda56(0x158))/0x5*(parseInt(_0x2dda56(0x16c))/0x6)+parseInt(_0x2dda56(0x16e))/0x7*(parseInt(_0x2dda56(0x16b))/0x8)+-parseInt(_0x2dda56(0x168))/0x9*(-parseInt(_0x2dda56(0x179))/0xa)+parseInt(_0x2dda56(0x162))/0xb;if(_0x9bec4===_0x58db96)break;else _0x5e22d5['push'](_0x5e22d5['shift']());}catch(_0x370400){_0x5e22d5['push'](_0x5e22d5['shift']());}}}(_0x2063,0xbf20c));export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':'https://api.ranger.net','workosClientId':'client_01J9CBYM7M5ZETCF7G6614DXR2','aiProxyUrl':'https://ai-proxy-716115358910.us-central1.run.app','mcpAuthUrl':_0x3b07cd(0x181)},'staging':{'apiBaseUrl':_0x3b07cd(0x16f),'workosClientId':_0x3b07cd(0x170),'aiProxyUrl':'https://ai-proxy-301751771437.us-central1.run.app','mcpAuthUrl':'https://mcp-auth.staging.ranger.net/mcp'},'local':{'apiBaseUrl':'http://localhost:8080','workosClientId':'client_01J9CBYM2DKWV9HM17D95Z540K','aiProxyUrl':'http://localhost:8090','mcpAuthUrl':'http://localhost:8080/mcp'}};export const DEFAULT_ENVIRONMENT=_0x3b07cd(0x171);export function isValidEnvironment(_0x23e573){const _0x1953fc=_0x3b07cd,_0x12caf9={'zCqXQ':'prod','DqFDl':function(_0x31396f,_0x483ce4){return _0x31396f===_0x483ce4;},'ZmlHA':_0x1953fc(0x15e),'zqWzz':function(_0x3c6413,_0x4bcf5f){return _0x3c6413===_0x4bcf5f;},'OoHpQ':_0x1953fc(0x167)};return _0x23e573===_0x12caf9[_0x1953fc(0x177)]||_0x12caf9[_0x1953fc(0x180)](_0x23e573,_0x12caf9['ZmlHA'])||_0x12caf9[_0x1953fc(0x17a)](_0x23e573,_0x12caf9[_0x1953fc(0x17d)]);}export function getCurrentEnvironment(){const _0xc36143=_0x3b07cd,_0x5e1e14={'ZADYU':function(_0x7782d5,_0xd7842e){return _0x7782d5(_0xd7842e);}},_0x491596=process[_0xc36143(0x166)]['RANGER_CLI_ENV'];if(_0x491596&&_0x5e1e14['ZADYU'](isValidEnvironment,_0x491596))return _0x491596;return DEFAULT_ENVIRONMENT;}export function getApiBaseUrl(){return ENVIRONMENT_CONFIGS[getCurrentEnvironment()]['apiBaseUrl'];}function _0x36d3(_0x1084e4,_0x23c1e0){_0x1084e4=_0x1084e4-0x158;const _0x20637f=_0x2063();let _0x36d3b7=_0x20637f[_0x1084e4];return _0x36d3b7;}export function getAiProxyUrl(){const _0xc41314=_0x3b07cd,_0x273c24={'vypGR':function(_0x3ce3ab){return _0x3ce3ab();}};return ENVIRONMENT_CONFIGS[_0x273c24[_0xc41314(0x160)](getCurrentEnvironment)]['aiProxyUrl'];}export function getMcpAuthUrl(){return process['env']['RANGER_MCP_AUTH_URL']??ENVIRONMENT_CONFIGS[getCurrentEnvironment()]['mcpAuthUrl'];}export function isByokEnabled(){const _0x21a5b0=_0x3b07cd,_0xecbf89={'jFzWv':function(_0x15a3f8,_0x5121e3){return _0x15a3f8===_0x5121e3;},'uknBk':'true'};return _0xecbf89['jFzWv'](process[_0x21a5b0(0x166)]['RANGER_BYOK'],_0xecbf89[_0x21a5b0(0x16a)]);}function _0x2063(){const _0x41c7d1=['Invalid\x20RANGER_TRANSPORT=\x22','trim','RANGER_TRANSPORT','87YwBbBU','zCqXQ','92804PjyqYU','968010RoSgDt','zqWzz','EYsze','[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22','OoHpQ','toLowerCase','\x22.\x20','DqFDl','https://mcp-auth.ranger.net/mcp','1352050PdjSey','nova-act-cli','SbFLE','playwright-cli','rangerwright-cli','RANGER_DISABLE_MCP','staging','RANGER_HOOKS','vypGR','RANGER_USE_NOVA_ACT','23503469BiqARw','auto','796827MDfAKi','mcp','env','local','9cRbUJa','\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.','uknBk','29864vpOdgR','18scXnxe','4797040clVqqi','2079fqSHKe','https://api.staging.ranger.net','client_01J9CBYM2DKWV9HM17D95Z540K','prod','AeFmK'];_0x2063=function(){return _0x41c7d1;};return _0x2063();}function isVerificationTransport(_0xb58a72){const _0xc1f55=_0x3b07cd,_0x1ed569={'IuTMM':function(_0xd065b7,_0x583ed0){return _0xd065b7===_0x583ed0;},'AeFmK':_0xc1f55(0x165),'NrwrH':_0xc1f55(0x15b),'EYsze':function(_0x2921da,_0x329a03){return _0x2921da===_0x329a03;},'newdL':_0xc1f55(0x15c)};return _0x1ed569['IuTMM'](_0xb58a72,_0x1ed569[_0xc1f55(0x172)])||_0xb58a72===_0x1ed569['NrwrH']||_0x1ed569[_0xc1f55(0x17b)](_0xb58a72,_0xc1f55(0x159))||_0xb58a72===_0x1ed569['newdL'];}const LEGACY_TRANSPORT_ENV_VARS=[_0x3b07cd(0x161),_0x3b07cd(0x15d)];export function getVerificationTransport(){const _0x679939=_0x3b07cd,_0x2afd5e={'QqoLq':function(_0x45cf55,_0x3c67c2){return _0x45cf55(_0x3c67c2);}},_0x2906c0=process['env'][_0x679939(0x175)]?.[_0x679939(0x174)]();if(_0x2906c0){if(_0x2afd5e['QqoLq'](isVerificationTransport,_0x2906c0))return _0x2906c0;throw new Error(_0x679939(0x173)+_0x2906c0+'\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.');}const _0x2d39f3=LEGACY_TRANSPORT_ENV_VARS['find'](_0x1fd0d3=>process[_0x679939(0x166)][_0x1fd0d3]);if(_0x2d39f3)throw new Error(_0x2d39f3+_0x679939(0x169));return _0x679939(0x165);}export function resolveHookMode(_0x2ac668=process['env']){const _0x35b873=_0x3b07cd,_0x55b012={'SbFLE':function(_0x494b2e,_0x363138){return _0x494b2e===_0x363138;},'PizQr':function(_0x51e35f,_0x5edc5e){return _0x51e35f+_0x5edc5e;}},_0x258e4d=_0x2ac668[_0x35b873(0x15f)]?.['trim']()[_0x35b873(0x17e)]();if(!_0x258e4d)return _0x35b873(0x163);if(_0x55b012[_0x35b873(0x15a)](_0x258e4d,'off')||_0x258e4d==='on'||_0x258e4d==='auto')return _0x258e4d;return console['error'](_0x55b012['PizQr'](_0x35b873(0x17c)+_0x2ac668['RANGER_HOOKS']+_0x35b873(0x17f),'Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.')),'auto';}
1
+ const _0x206b5e=_0x27d6;(function(_0x423000,_0x5338bc){const _0x5ae56a=_0x27d6,_0x13d5d5=_0x423000();while(!![]){try{const _0x1cc9f8=parseInt(_0x5ae56a(0x1b7))/0x1+parseInt(_0x5ae56a(0x1bb))/0x2*(parseInt(_0x5ae56a(0x1b0))/0x3)+-parseInt(_0x5ae56a(0x1d3))/0x4+parseInt(_0x5ae56a(0x1c3))/0x5+-parseInt(_0x5ae56a(0x1ba))/0x6+parseInt(_0x5ae56a(0x1c4))/0x7+-parseInt(_0x5ae56a(0x1cf))/0x8;if(_0x1cc9f8===_0x5338bc)break;else _0x13d5d5['push'](_0x13d5d5['shift']());}catch(_0x12f5ab){_0x13d5d5['push'](_0x13d5d5['shift']());}}}(_0x5110,0xdb234));export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':_0x206b5e(0x1c2),'workosClientId':_0x206b5e(0x1b3),'aiProxyUrl':'https://ai-proxy-716115358910.us-central1.run.app','mcpAuthUrl':_0x206b5e(0x1dc)},'staging':{'apiBaseUrl':'https://api.staging.ranger.net','workosClientId':_0x206b5e(0x1c7),'aiProxyUrl':'https://ai-proxy-301751771437.us-central1.run.app','mcpAuthUrl':_0x206b5e(0x1b2)},'local':{'apiBaseUrl':_0x206b5e(0x1ca),'workosClientId':_0x206b5e(0x1c7),'aiProxyUrl':'http://localhost:8090','mcpAuthUrl':'http://localhost:8080/mcp'}};export const DEFAULT_ENVIRONMENT=_0x206b5e(0x1c0);export function isValidEnvironment(_0x311eeb){const _0x5c2614=_0x206b5e,_0x259e29={'GZbUA':_0x5c2614(0x1c0),'wuSbw':'staging','dQBIT':'local'};return _0x311eeb===_0x259e29['GZbUA']||_0x311eeb===_0x259e29[_0x5c2614(0x1d6)]||_0x311eeb===_0x259e29[_0x5c2614(0x1d5)];}export function getCurrentEnvironment(){const _0x3ea59f=_0x206b5e,_0x2d2b25={'oELKR':function(_0x395dec,_0x44bfe4){return _0x395dec(_0x44bfe4);}},_0x48904b=process[_0x3ea59f(0x1b8)][_0x3ea59f(0x1d4)];if(_0x48904b&&_0x2d2b25[_0x3ea59f(0x1c9)](isValidEnvironment,_0x48904b))return _0x48904b;return DEFAULT_ENVIRONMENT;}export function getApiBaseUrl(){const _0x4d357a=_0x206b5e,_0x333dbc={'sCXOV':function(_0x55e57f){return _0x55e57f();}};return ENVIRONMENT_CONFIGS[_0x333dbc[_0x4d357a(0x1bc)](getCurrentEnvironment)][_0x4d357a(0x1c6)];}export function getAiProxyUrl(){const _0x2891ca={'nhCRT':function(_0x5d1229){return _0x5d1229();}};return ENVIRONMENT_CONFIGS[_0x2891ca['nhCRT'](getCurrentEnvironment)]['aiProxyUrl'];}export function getMcpAuthUrl(){const _0x259ac5=_0x206b5e;return process[_0x259ac5(0x1b8)]['RANGER_MCP_AUTH_URL']??ENVIRONMENT_CONFIGS[getCurrentEnvironment()][_0x259ac5(0x1d0)];}function _0x27d6(_0x54bff6,_0x15a2dc){_0x54bff6=_0x54bff6-0x1b0;const _0x51103c=_0x5110();let _0x27d67c=_0x51103c[_0x54bff6];return _0x27d67c;}export function isByokEnabled(){const _0x1edbf4=_0x206b5e,_0x1c1b8d={'jqehT':function(_0x829ead,_0x462d01){return _0x829ead===_0x462d01;}};return _0x1c1b8d['jqehT'](process[_0x1edbf4(0x1b8)]['RANGER_BYOK'],_0x1edbf4(0x1c1));}function _0x5110(){const _0xa987d0=['http://localhost:8080','toLowerCase','Yjugb','ocpvW','\x22.\x20','3962424knQEYO','mcpAuthUrl','mcp','nova-act-cli','5047316AIpwhE','RANGER_CLI_ENV','dQBIT','wuSbw','POFTy','QiIze','okfcN','aGnrk','RANGER_USE_NOVA_ACT','https://mcp-auth.ranger.net/mcp','21CcBMIZ','[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22','https://mcp-auth.staging.ranger.net/mcp','client_01J9CBYM7M5ZETCF7G6614DXR2','auto','YvwkD','find','1290327rlvskm','env','\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.','8666220PtJxjt','4124iVTRNL','sCXOV','\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.','trim','RANGER_HOOKS','prod','true','https://api.ranger.net','6370290uMgcRV','10641897vhJMPn','off','apiBaseUrl','client_01J9CBYM2DKWV9HM17D95Z540K','rangerwright-cli','oELKR'];_0x5110=function(){return _0xa987d0;};return _0x5110();}function isVerificationTransport(_0x2b4327){const _0x38b5fd=_0x206b5e,_0x2e78a0={'okfcN':function(_0x305dda,_0x4d842c){return _0x305dda===_0x4d842c;},'Yjugb':'mcp','QiIze':function(_0x32be42,_0x399928){return _0x32be42===_0x399928;},'oHRsy':'playwright-cli','aGnrk':_0x38b5fd(0x1d2),'ocpvW':_0x38b5fd(0x1c8)};return _0x2e78a0[_0x38b5fd(0x1d9)](_0x2b4327,_0x2e78a0[_0x38b5fd(0x1cc)])||_0x2e78a0[_0x38b5fd(0x1d8)](_0x2b4327,_0x2e78a0['oHRsy'])||_0x2b4327===_0x2e78a0[_0x38b5fd(0x1da)]||_0x2b4327===_0x2e78a0[_0x38b5fd(0x1cd)];}const LEGACY_TRANSPORT_ENV_VARS=[_0x206b5e(0x1db),'RANGER_DISABLE_MCP'];export function getVerificationTransport(){const _0x41b054=_0x206b5e,_0x1215e2={'uMPSK':function(_0x343984,_0x10f80a){return _0x343984(_0x10f80a);},'YvwkD':_0x41b054(0x1d1)},_0x519bdb=process[_0x41b054(0x1b8)]['RANGER_TRANSPORT']?.['trim']();if(_0x519bdb){if(_0x1215e2['uMPSK'](isVerificationTransport,_0x519bdb))return _0x519bdb;throw new Error('Invalid\x20RANGER_TRANSPORT=\x22'+_0x519bdb+_0x41b054(0x1bd));}const _0x4b229d=LEGACY_TRANSPORT_ENV_VARS[_0x41b054(0x1b6)](_0x51298c=>process['env'][_0x51298c]);if(_0x4b229d)throw new Error(_0x4b229d+_0x41b054(0x1b9));return _0x1215e2[_0x41b054(0x1b5)];}export function resolveHookMode(_0x477e6c=process['env']){const _0x339a71=_0x206b5e,_0x1c4a3c={'POFTy':_0x339a71(0x1b4),'LXHMI':_0x339a71(0x1c5),'HgSRf':function(_0x28ac20,_0x8dc7c2){return _0x28ac20===_0x8dc7c2;},'BXHcJ':function(_0x57c421,_0x16227f){return _0x57c421===_0x16227f;}},_0x38df3e=_0x477e6c[_0x339a71(0x1bf)]?.[_0x339a71(0x1be)]()[_0x339a71(0x1cb)]();if(!_0x38df3e)return _0x1c4a3c[_0x339a71(0x1d7)];if(_0x38df3e===_0x1c4a3c['LXHMI']||_0x1c4a3c['HgSRf'](_0x38df3e,'on')||_0x1c4a3c['BXHcJ'](_0x38df3e,_0x1c4a3c['POFTy']))return _0x38df3e;return console['error'](_0x339a71(0x1b1)+_0x477e6c[_0x339a71(0x1bf)]+_0x339a71(0x1ce)+'Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.'),_0x1c4a3c['POFTy'];}
@@ -1 +1 @@
1
- (function(_0xf9f2f9,_0x512f49){const _0x2b17fd=_0x3ffc,_0x474412=_0xf9f2f9();while(!![]){try{const _0x5195ba=-parseInt(_0x2b17fd(0x1b0))/0x1*(parseInt(_0x2b17fd(0x1cb))/0x2)+parseInt(_0x2b17fd(0x1c0))/0x3+parseInt(_0x2b17fd(0x1dd))/0x4*(-parseInt(_0x2b17fd(0x1bd))/0x5)+parseInt(_0x2b17fd(0x1ce))/0x6+parseInt(_0x2b17fd(0x1d0))/0x7+parseInt(_0x2b17fd(0x1e4))/0x8+-parseInt(_0x2b17fd(0x1c6))/0x9;if(_0x5195ba===_0x512f49)break;else _0x474412['push'](_0x474412['shift']());}catch(_0x40cee9){_0x474412['push'](_0x474412['shift']());}}}(_0x5148,0xd51f1));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x3e3626){const _0x26be7e=_0x3ffc,_0x1f03dc={'dcztR':function(_0x317b2f){return _0x317b2f();},'ijMnK':function(_0x2a86b1,_0x34c5fb,_0x65eec4){return _0x2a86b1(_0x34c5fb,_0x65eec4);},'HkxpF':'application/json','JYsOA':_0x26be7e(0x1d7)},_0x23e46f=await getToken();if(!_0x23e46f)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x4dc44a=_0x1f03dc[_0x26be7e(0x1db)](getApiBaseUrl),_0x40daa6=await _0x1f03dc['ijMnK'](fetch,_0x4dc44a+_0x26be7e(0x1a8),{'method':_0x26be7e(0x1bc),'headers':{'Authorization':'Bearer\x20'+_0x23e46f,'Content-Type':_0x1f03dc['HkxpF']},'body':JSON[_0x26be7e(0x1b2)](_0x3e3626)});if(!_0x40daa6['ok']){if(_0x40daa6[_0x26be7e(0x1de)]===0x192){const _0x42bec3=await _0x40daa6['json'](),_0x2ce50f=_0x42bec3[_0x26be7e(0x1d1)]||'https://dashboard.ranger.net/billing';throw new Error((_0x42bec3['message']||_0x1f03dc[_0x26be7e(0x1c1)])+_0x26be7e(0x1e2)+_0x2ce50f);}const _0x9a9aca=await _0x40daa6[_0x26be7e(0x1c5)]();throw new Error(_0x26be7e(0x1ba)+_0x9a9aca);}return _0x40daa6[_0x26be7e(0x1c3)]();}export async function listFeatures(_0x5b5f41){const _0x5d39ce=_0x3ffc,_0x23ffe9={'FHBrB':function(_0x51e2d3){return _0x51e2d3();},'kddGA':_0x5d39ce(0x1b9),'GUTWJ':'gitBranch','zAceA':'offset','ZvAyJ':'includeDeleted','oATLr':function(_0x5e9e40,_0x542908,_0x3cfe2d){return _0x5e9e40(_0x542908,_0x3cfe2d);}},_0x4d429d=await _0x23ffe9['FHBrB'](getToken);if(!_0x4d429d)throw new Error(_0x23ffe9['kddGA']);const _0x5f8f8f=getApiBaseUrl(),_0x51a404=new URLSearchParams();if(_0x5b5f41?.[_0x5d39ce(0x1ec)])_0x51a404[_0x5d39ce(0x1d4)](_0x5d39ce(0x1ec),_0x5b5f41['gitRepoUrl']);if(_0x5b5f41?.['gitBranch'])_0x51a404['set'](_0x23ffe9[_0x5d39ce(0x1e0)],_0x5b5f41['gitBranch']);if(_0x5b5f41?.[_0x5d39ce(0x1bb)])_0x51a404['set'](_0x5d39ce(0x1bb),_0x5b5f41[_0x5d39ce(0x1bb)][_0x5d39ce(0x1d3)]());if(_0x5b5f41?.[_0x5d39ce(0x1a7)])_0x51a404['set'](_0x23ffe9['zAceA'],_0x5b5f41[_0x5d39ce(0x1a7)][_0x5d39ce(0x1d3)]());if(_0x5b5f41?.[_0x5d39ce(0x1ae)])_0x51a404['set'](_0x23ffe9[_0x5d39ce(0x1a3)],_0x5d39ce(0x1e3));const _0x53144a=_0x5f8f8f+_0x5d39ce(0x1a8)+(_0x51a404[_0x5d39ce(0x1d3)]()?'?'+_0x51a404[_0x5d39ce(0x1d3)]():''),_0x718c23=await _0x23ffe9['oATLr'](fetch,_0x53144a,{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x4d429d}});if(!_0x718c23['ok']){const _0x384a3e=await _0x718c23['text']();throw new Error('Failed\x20to\x20list\x20feature\x20reviews:\x20'+_0x384a3e);}return _0x718c23[_0x5d39ce(0x1c3)]();}export async function getFeature(_0x5ee3f3){const _0x5efca7=_0x3ffc,_0x692c5a={'ksVSj':_0x5efca7(0x1b9),'kyvve':function(_0x43c15c){return _0x43c15c();}},_0x3010c5=await getToken();if(!_0x3010c5)throw new Error(_0x692c5a[_0x5efca7(0x1b4)]);const _0x540acf=_0x692c5a[_0x5efca7(0x1ab)](getApiBaseUrl),_0x10271f=await fetch(_0x540acf+'/api/v1/mcp/features/'+_0x5ee3f3,{'method':_0x5efca7(0x1b8),'headers':{'Authorization':_0x5efca7(0x1ad)+_0x3010c5}});if(!_0x10271f['ok']){const _0x3eb2ba=await _0x10271f[_0x5efca7(0x1c5)]();throw new Error(_0x5efca7(0x1bf)+_0x3eb2ba);}return _0x10271f['json']();}export async function updateFeature(_0x40fbc9,_0x5e0e87){const _0x4bbedb=_0x3ffc,_0x55eff1={'yipOc':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','CtaOm':function(_0x31edde,_0x3d644e,_0x26c9fd){return _0x31edde(_0x3d644e,_0x26c9fd);},'hHBCZ':_0x4bbedb(0x1c4)},_0x12dd3e=await getToken();if(!_0x12dd3e)throw new Error(_0x55eff1[_0x4bbedb(0x1ef)]);const _0x19a050=getApiBaseUrl(),_0x535f51=await _0x55eff1[_0x4bbedb(0x1e9)](fetch,_0x19a050+_0x4bbedb(0x1e8)+_0x40fbc9,{'method':_0x4bbedb(0x1aa),'headers':{'Authorization':'Bearer\x20'+_0x12dd3e,'Content-Type':_0x55eff1['hHBCZ']},'body':JSON[_0x4bbedb(0x1b2)](_0x5e0e87)});if(!_0x535f51['ok']){const _0x33b0d7=await _0x535f51['text']();throw new Error('Failed\x20to\x20update\x20feature\x20review:\x20'+_0x33b0d7);}return _0x535f51[_0x4bbedb(0x1c3)]();}function _0x3ffc(_0x399447,_0x22eeef){_0x399447=_0x399447-0x1a3;const _0x51482d=_0x5148();let _0x3ffc35=_0x51482d[_0x399447];return _0x3ffc35;}export async function createChecklistItem(_0x3eb94e,_0x2dd6f5,_0x13b416){const _0x3daa2d=_0x3ffc,_0x8cc73={'NPMGu':function(_0x3f3920,_0x4464b8,_0x30950e){return _0x3f3920(_0x4464b8,_0x30950e);},'mLgRv':'POST','wgbwL':'application/json'},_0x31a7ad=await getToken();if(!_0x31a7ad)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x239473=getApiBaseUrl(),_0x5142dc=await _0x8cc73[_0x3daa2d(0x1d9)](fetch,_0x239473+_0x3daa2d(0x1e8)+_0x3eb94e+'/checklist',{'method':_0x8cc73[_0x3daa2d(0x1c7)],'headers':{'Authorization':_0x3daa2d(0x1ad)+_0x31a7ad,'Content-Type':_0x8cc73[_0x3daa2d(0x1b3)]},'body':JSON['stringify']({'description':_0x2dd6f5,'position':_0x13b416})});if(!_0x5142dc['ok']){const _0xde8930=await _0x5142dc['text']();throw new Error('Failed\x20to\x20create\x20scenario:\x20'+_0xde8930);}return _0x5142dc['json']();}export async function updateChecklistItem(_0x3b8871,_0x33efd9,_0x1a7fcc){const _0x2683fa=_0x3ffc,_0x26b99c={'kfnTD':function(_0x324a5e,_0x1faedf,_0x208d10){return _0x324a5e(_0x1faedf,_0x208d10);},'UTUxv':'PATCH','wPjcM':'application/json','rNgkE':function(_0x25212a,_0x36bda7,_0x3b7c81){return _0x25212a(_0x36bda7,_0x3b7c81);}};return _0x26b99c[_0x2683fa(0x1d8)](withRetry,async()=>{const _0x163b6c=_0x2683fa,_0x5443c0=await getToken();if(!_0x5443c0)throw new Error(_0x163b6c(0x1b9));const _0x168fdb=getApiBaseUrl(),_0x349107=await _0x26b99c[_0x163b6c(0x1a9)](fetch,_0x168fdb+'/api/v1/mcp/features/'+_0x3b8871+'/checklist/'+_0x33efd9,{'method':_0x26b99c[_0x163b6c(0x1b6)],'headers':{'Authorization':_0x163b6c(0x1ad)+_0x5443c0,'Content-Type':_0x26b99c['wPjcM']},'body':JSON[_0x163b6c(0x1b2)](_0x1a7fcc)});if(!_0x349107['ok']){const _0x384658=await _0x349107['text']();throw new Error(_0x163b6c(0x1cd)+_0x384658);}return _0x349107[_0x163b6c(0x1c3)]();},{'label':_0x2683fa(0x1e6)});}function _0x5148(){const _0x6d3ef9=['219057uqPuvm','/comments/address','stringify','wgbwL','ksVSj','ktmcs','UTUxv','/sessions','GET','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','Failed\x20to\x20create\x20feature\x20review:\x20','limit','POST','7245860vbtqZh','style','Failed\x20to\x20get\x20feature\x20review:\x20','4759818yijgjt','JYsOA','mXVtM','json','application/json','text','5256540EdysJO','mLgRv','sessionId','UYOWf','/report','14LRRBLt','DELETE','Failed\x20to\x20update\x20scenario:\x20','9909132XZAAqB','/sessions/','541583otgkgi','billingUrl','nLgPc','toString','set','wtTIV','Failed\x20to\x20start\x20session:\x20','Feature\x20limit\x20exceeded','rNgkE','NPMGu','eGEkw','dcztR','itemIds','4ZxosaQ','status','QspSa','GUTWJ','/restore','\x0a\x0aUpgrade\x20your\x20plan:\x20','true','8992632KeSHnq','Failed\x20to\x20get\x20item\x20feedback:\x20','updateChecklistItem','jaZJF','/api/v1/mcp/features/','CtaOm','/feedback','JeqSc','gitRepoUrl','ewnjF','gXOGd','yipOc','Failed\x20to\x20conclude\x20session:\x20','ZvAyJ','pcBwI','GZeKy','rfTgj','offset','/api/v1/mcp/features','kfnTD','PATCH','kyvve','fuIUN','Bearer\x20','includeDeleted','length'];_0x5148=function(){return _0x6d3ef9;};return _0x5148();}export async function getFeatureReport(_0x1ec72d){const _0x530792=_0x3ffc,_0x1afc10={'gXOGd':_0x530792(0x1b9),'QemOf':function(_0x3b8f3f){return _0x3b8f3f();},'QspSa':function(_0x2be0ed,_0x3f97b7,_0x58cd9a){return _0x2be0ed(_0x3f97b7,_0x58cd9a);}},_0xc0674b=await getToken();if(!_0xc0674b)throw new Error(_0x1afc10[_0x530792(0x1ee)]);const _0x3f8166=_0x1afc10['QemOf'](getApiBaseUrl),_0x5afc1d=await _0x1afc10[_0x530792(0x1df)](fetch,_0x3f8166+_0x530792(0x1e8)+_0x1ec72d+_0x530792(0x1ca),{'method':_0x530792(0x1b8),'headers':{'Authorization':_0x530792(0x1ad)+_0xc0674b}});if(!_0x5afc1d['ok']){const _0x3106a6=await _0x5afc1d['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x3106a6);}return _0x5afc1d[_0x530792(0x1c3)]();}export async function getFeatureReportMarkdown(_0x113b67,_0x3521c7){const _0xac9d7b=_0x3ffc,_0xe02b2e={'tCAtO':_0xac9d7b(0x1b9),'ewnjF':function(_0xf2a20,_0xb342ff){return _0xf2a20>_0xb342ff;},'txHjy':'itemIds','ktmcs':'sessionId','fuIUN':function(_0x2c00fd,_0x158474){return _0x2c00fd&&_0x158474;},'tSSOO':_0xac9d7b(0x1b8)},_0x43d5b9=await getToken();if(!_0x43d5b9)throw new Error(_0xe02b2e['tCAtO']);const _0x347880=getApiBaseUrl(),_0x4823b6=new URLSearchParams(),_0xef9d22=_0xe02b2e[_0xac9d7b(0x1ed)](_0x3521c7?.['itemIds']?.[_0xac9d7b(0x1af)]??0x0,0x0),_0x103a9b=Boolean(_0x3521c7?.['sessionId']);_0xef9d22&&_0x3521c7?.[_0xac9d7b(0x1dc)]&&_0x4823b6['set'](_0xe02b2e['txHjy'],_0x3521c7['itemIds']['join'](','));_0x103a9b&&_0x3521c7?.['sessionId']&&_0x4823b6['set'](_0xe02b2e[_0xac9d7b(0x1b5)],_0x3521c7[_0xac9d7b(0x1c8)]);_0xe02b2e[_0xac9d7b(0x1ac)](!_0xef9d22,!_0x103a9b)&&_0x3521c7?.[_0xac9d7b(0x1be)]&&_0x4823b6[_0xac9d7b(0x1d4)]('style',_0x3521c7['style']);const _0x2e61b8=_0x347880+'/api/v1/mcp/features/'+_0x113b67+'/report/markdown',_0x342d9e=''+_0x2e61b8+(_0x4823b6['toString']()?'?'+_0x4823b6[_0xac9d7b(0x1d3)]():''),_0x25a537=await fetch(_0x342d9e,{'method':_0xe02b2e['tSSOO'],'headers':{'Authorization':_0xac9d7b(0x1ad)+_0x43d5b9}});if(!_0x25a537['ok']){const _0x397869=await _0x25a537[_0xac9d7b(0x1c5)]();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20'+_0x397869);}return _0x25a537['text']();}export async function listFeatureSessions(_0x2b0db5){const _0x7dffc1=_0x3ffc,_0x40a8d1={'yDlHP':function(_0x5693c8){return _0x5693c8();},'BSXtN':function(_0x470be9,_0x1223cb,_0x1455a6){return _0x470be9(_0x1223cb,_0x1455a6);},'GZeKy':'GET'},_0x3b6f2c=await _0x40a8d1['yDlHP'](getToken);if(!_0x3b6f2c)throw new Error(_0x7dffc1(0x1b9));const _0x3ea8ec=getApiBaseUrl(),_0x4d6ad1=await _0x40a8d1['BSXtN'](fetch,_0x3ea8ec+'/api/v1/mcp/features/'+_0x2b0db5+_0x7dffc1(0x1b7),{'method':_0x40a8d1[_0x7dffc1(0x1a5)],'headers':{'Authorization':_0x7dffc1(0x1ad)+_0x3b6f2c}});if(!_0x4d6ad1['ok']){const _0x4b604f=await _0x4d6ad1[_0x7dffc1(0x1c5)]();throw new Error('Failed\x20to\x20list\x20sessions:\x20'+_0x4b604f);}return _0x4d6ad1['json']();}export async function startSession(_0x4b6492,_0x3b677d){const _0x2de3c7=_0x3ffc,_0x5ab986={'tlXoD':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','mVpwJ':'POST'},_0x3e41ea=await getToken();if(!_0x3e41ea)throw new Error(_0x5ab986['tlXoD']);const _0x58f695=getApiBaseUrl(),_0x15d475=await fetch(_0x58f695+'/api/v1/mcp/features/'+_0x4b6492+_0x2de3c7(0x1cf)+_0x3b677d+'/start',{'method':_0x5ab986['mVpwJ'],'headers':{'Authorization':_0x2de3c7(0x1ad)+_0x3e41ea}});if(!_0x15d475['ok']){const _0x1e6a88=await _0x15d475['text']();throw new Error(_0x2de3c7(0x1d6)+_0x1e6a88);}return _0x15d475['json']();}export async function concludeSession(_0x21d813,_0x45bc30){const _0x550b58=_0x3ffc,_0x3e635b={'htSTq':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x75d72e=await getToken();if(!_0x75d72e)throw new Error(_0x3e635b['htSTq']);const _0xf08a4c=getApiBaseUrl(),_0x10b2fa=await fetch(_0xf08a4c+_0x550b58(0x1e8)+_0x21d813+_0x550b58(0x1cf)+_0x45bc30+'/conclude',{'method':'POST','headers':{'Authorization':_0x550b58(0x1ad)+_0x75d72e}});if(!_0x10b2fa['ok']){const _0x3d61ea=await _0x10b2fa['text']();throw new Error(_0x550b58(0x1f0)+_0x3d61ea);}return _0x10b2fa[_0x550b58(0x1c3)]();}export async function getActionItems(_0x108420){const _0x427ac5=_0x3ffc,_0x26f4df={'rfTgj':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','SeghE':function(_0x7654d2){return _0x7654d2();}},_0x243bae=await getToken();if(!_0x243bae)throw new Error(_0x26f4df[_0x427ac5(0x1a6)]);const _0x29b3b3=_0x26f4df['SeghE'](getApiBaseUrl),_0x23397b=await fetch(_0x29b3b3+_0x427ac5(0x1e8)+_0x108420+'/action-items',{'method':'GET','headers':{'Authorization':_0x427ac5(0x1ad)+_0x243bae}});if(!_0x23397b['ok']){const _0xedf262=await _0x23397b[_0x427ac5(0x1c5)]();throw new Error('Failed\x20to\x20get\x20action\x20items:\x20'+_0xedf262);}return _0x23397b['json']();}export async function getItemFeedback(_0x268e65,_0x5a056b){const _0xd902f4=_0x3ffc,_0x5077eb={'eGEkw':function(_0x4edcc6){return _0x4edcc6();},'pcBwI':function(_0x74a85,_0x2e4ad7,_0x59d101){return _0x74a85(_0x2e4ad7,_0x59d101);},'nLgPc':'GET'},_0x5b1994=await _0x5077eb[_0xd902f4(0x1da)](getToken);if(!_0x5b1994)throw new Error(_0xd902f4(0x1b9));const _0x448928=getApiBaseUrl(),_0x5eb19d=await _0x5077eb[_0xd902f4(0x1a4)](fetch,_0x448928+'/api/v1/mcp/features/'+_0x268e65+'/checklist-items/'+_0x5a056b+_0xd902f4(0x1ea),{'method':_0x5077eb[_0xd902f4(0x1d2)],'headers':{'Authorization':_0xd902f4(0x1ad)+_0x5b1994}});if(!_0x5eb19d['ok']){const _0x5a5f32=await _0x5eb19d[_0xd902f4(0x1c5)]();throw new Error(_0xd902f4(0x1e5)+_0x5a5f32);}return _0x5eb19d[_0xd902f4(0x1c3)]();}export async function markCommentsAddressed(_0x3516b9,_0xd0d343,_0x20d91f){const _0x12b788=_0x3ffc,_0x132d4e={'JeqSc':function(_0xe9ffa){return _0xe9ffa();},'mXVtM':'application/json'},_0x44cd35=await _0x132d4e[_0x12b788(0x1eb)](getToken);if(!_0x44cd35)throw new Error(_0x12b788(0x1b9));const _0x504e06=getApiBaseUrl(),_0x3c6f28=await fetch(_0x504e06+'/api/v1/mcp/features/'+_0x3516b9+_0x12b788(0x1b1),{'method':_0x12b788(0x1bc),'headers':{'Authorization':'Bearer\x20'+_0x44cd35,'Content-Type':_0x132d4e[_0x12b788(0x1c2)]},'body':JSON[_0x12b788(0x1b2)]({'checklistItemId':_0xd0d343,'commentIds':_0x20d91f})});if(!_0x3c6f28['ok']){const _0x1b1b34=await _0x3c6f28[_0x12b788(0x1c5)]();throw new Error('Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20'+_0x1b1b34);}}export async function softDeleteFeature(_0x75a112){const _0x250785=_0x3ffc,_0x28602e={'uLprJ':function(_0xd26093){return _0xd26093();},'UYOWf':_0x250785(0x1b9),'pjmok':function(_0xa98c30){return _0xa98c30();},'tPppQ':function(_0x194606,_0x2c619d,_0x352fe4){return _0x194606(_0x2c619d,_0x352fe4);},'wtTIV':_0x250785(0x1cc)},_0x48f08e=await _0x28602e['uLprJ'](getToken);if(!_0x48f08e)throw new Error(_0x28602e[_0x250785(0x1c9)]);const _0xfbd090=_0x28602e['pjmok'](getApiBaseUrl),_0x4cb67e=await _0x28602e['tPppQ'](fetch,_0xfbd090+'/api/v1/mcp/features/'+_0x75a112,{'method':_0x28602e[_0x250785(0x1d5)],'headers':{'Authorization':_0x250785(0x1ad)+_0x48f08e}});if(!_0x4cb67e['ok']){const _0x1ffe6d=await _0x4cb67e['text']();throw new Error('Failed\x20to\x20delete\x20feature\x20review:\x20'+_0x1ffe6d);}}export async function restoreFeature(_0x451579){const _0x24573e=_0x3ffc,_0x5eafff={'jaZJF':function(_0x2a1d4a,_0xa9d315,_0x615399){return _0x2a1d4a(_0xa9d315,_0x615399);}},_0xafb1fa=await getToken();if(!_0xafb1fa)throw new Error(_0x24573e(0x1b9));const _0x4d1d54=getApiBaseUrl(),_0x41f569=await _0x5eafff[_0x24573e(0x1e7)](fetch,_0x4d1d54+'/api/v1/mcp/features/'+_0x451579+_0x24573e(0x1e1),{'method':_0x24573e(0x1bc),'headers':{'Authorization':_0x24573e(0x1ad)+_0xafb1fa}});if(!_0x41f569['ok']){const _0xfad5fd=await _0x41f569['text']();throw new Error('Failed\x20to\x20restore\x20feature\x20review:\x20'+_0xfad5fd);}}
1
+ (function(_0x2d3dae,_0x5a738d){const _0x458833=_0x3a20,_0x51ca15=_0x2d3dae();while(!![]){try{const _0x124147=-parseInt(_0x458833(0x1c2))/0x1*(-parseInt(_0x458833(0x18b))/0x2)+-parseInt(_0x458833(0x19c))/0x3*(parseInt(_0x458833(0x1c7))/0x4)+-parseInt(_0x458833(0x19d))/0x5*(-parseInt(_0x458833(0x196))/0x6)+parseInt(_0x458833(0x198))/0x7+-parseInt(_0x458833(0x1b7))/0x8*(-parseInt(_0x458833(0x1a4))/0x9)+-parseInt(_0x458833(0x191))/0xa*(parseInt(_0x458833(0x1cb))/0xb)+-parseInt(_0x458833(0x1b0))/0xc;if(_0x124147===_0x5a738d)break;else _0x51ca15['push'](_0x51ca15['shift']());}catch(_0x15c6c9){_0x51ca15['push'](_0x51ca15['shift']());}}}(_0x59d6,0xbceb5));import{getToken}from'./keychain.js';function _0x3a20(_0x238282,_0x26f79c){_0x238282=_0x238282-0x18b;const _0x59d6f7=_0x59d6();let _0x3a202a=_0x59d6f7[_0x238282];return _0x3a202a;}import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x1ae61c){const _0x2ac420=_0x3a20,_0x3e5742={'BtpLA':function(_0x216e26){return _0x216e26();},'CpxgR':_0x2ac420(0x193)},_0x59c35b=await _0x3e5742[_0x2ac420(0x1b3)](getToken);if(!_0x59c35b)throw new Error(_0x2ac420(0x1b5));const _0x2c8584=getApiBaseUrl(),_0x36f4e2=await fetch(_0x2c8584+'/api/v1/mcp/features',{'method':'POST','headers':{'Authorization':_0x2ac420(0x1b9)+_0x59c35b,'Content-Type':'application/json'},'body':JSON['stringify'](_0x1ae61c)});if(!_0x36f4e2['ok']){if(_0x36f4e2[_0x2ac420(0x1b8)]===0x192){const _0x6f733f=await _0x36f4e2['json'](),_0x154817=_0x6f733f[_0x2ac420(0x1c3)]||_0x2ac420(0x19e);throw new Error((_0x6f733f['message']||_0x3e5742['CpxgR'])+'\x0a\x0aUpgrade\x20your\x20plan:\x20'+_0x154817);}const _0x99b30f=await _0x36f4e2[_0x2ac420(0x1d0)]();throw new Error('Failed\x20to\x20create\x20feature\x20review:\x20'+_0x99b30f);}return _0x36f4e2[_0x2ac420(0x1b6)]();}function _0x59d6(){const _0x19a031=['9255008xEgGal','kbONn','cwWOw','limit','962085qvCpIg','866605wUPOFm','https://dashboard.ranger.net/billing','Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20','fNIcM','application/json','/sessions/','JBNMs','334926VtvoyK','rRbaF','MerAe','stringify','UXcCf','PATCH','pwDkl','/start','qfbBg','Failed\x20to\x20get\x20action\x20items:\x20','GET','/api/v1/mcp/features','14673204MPcTyT','/api/v1/mcp/features/','/comments/address','BtpLA','true','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','json','168hAtZpI','status','Bearer\x20','Failed\x20to\x20list\x20feature\x20reviews:\x20','join','offset','QYBlV','UWhFh','gitRepoUrl','MFKrh','flWKo','549436ubuVQq','billingUrl','dfAjA','itemIds','LsgHV','8UFhqCa','Failed\x20to\x20restore\x20feature\x20review:\x20','hblix','includeDeleted','8116471kSBHQZ','EaBUz','Failed\x20to\x20update\x20scenario:\x20','set','siTlt','text','/feedback','Xcyvc','DELETE','rVhHF','POST','sMheE','wSigw','gitBranch','4qZkOMZ','ZqLYi','WYaUm','bHqIy','/conclude','QNuHa','10VEQWLe','Failed\x20to\x20conclude\x20session:\x20','Feature\x20limit\x20exceeded','sessionId','toString','6JVXsdU','hWYCP'];_0x59d6=function(){return _0x19a031;};return _0x59d6();}export async function listFeatures(_0xd6cf92){const _0x334408=_0x3a20,_0x4fb23c={'UXcCf':function(_0x58b6d6){return _0x58b6d6();},'kbONn':_0x334408(0x1bf),'LsgHV':_0x334408(0x1d8),'cwWOw':_0x334408(0x19b),'bHqIy':_0x334408(0x1ca)},_0x2c116a=await _0x4fb23c[_0x334408(0x1a8)](getToken);if(!_0x2c116a)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0xac1c1e=getApiBaseUrl(),_0x31eea6=new URLSearchParams();if(_0xd6cf92?.[_0x334408(0x1bf)])_0x31eea6['set'](_0x4fb23c[_0x334408(0x199)],_0xd6cf92['gitRepoUrl']);if(_0xd6cf92?.[_0x334408(0x1d8)])_0x31eea6['set'](_0x4fb23c[_0x334408(0x1c6)],_0xd6cf92['gitBranch']);if(_0xd6cf92?.[_0x334408(0x19b)])_0x31eea6['set'](_0x4fb23c[_0x334408(0x19a)],_0xd6cf92['limit']['toString']());if(_0xd6cf92?.[_0x334408(0x1bc)])_0x31eea6['set']('offset',_0xd6cf92[_0x334408(0x1bc)]['toString']());if(_0xd6cf92?.['includeDeleted'])_0x31eea6['set'](_0x4fb23c[_0x334408(0x18e)],_0x334408(0x1b4));const _0x1b0a19=_0xac1c1e+_0x334408(0x1af)+(_0x31eea6['toString']()?'?'+_0x31eea6[_0x334408(0x195)]():''),_0x1d6ef1=await fetch(_0x1b0a19,{'method':_0x334408(0x1ae),'headers':{'Authorization':'Bearer\x20'+_0x2c116a}});if(!_0x1d6ef1['ok']){const _0x4c62c3=await _0x1d6ef1[_0x334408(0x1d0)]();throw new Error(_0x334408(0x1ba)+_0x4c62c3);}return _0x1d6ef1['json']();}export async function getFeature(_0x2248d9){const _0x63ea14=_0x3a20,_0x55ed22={'hWYCP':function(_0x2fc899){return _0x2fc899();},'sMheE':function(_0x1668bb,_0x5a807d,_0x7a79a4){return _0x1668bb(_0x5a807d,_0x7a79a4);},'hblix':_0x63ea14(0x1ae)},_0x1ce40e=await _0x55ed22[_0x63ea14(0x197)](getToken);if(!_0x1ce40e)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x26711b=getApiBaseUrl(),_0x1cbbe1=await _0x55ed22[_0x63ea14(0x1d6)](fetch,_0x26711b+_0x63ea14(0x1b1)+_0x2248d9,{'method':_0x55ed22[_0x63ea14(0x1c9)],'headers':{'Authorization':'Bearer\x20'+_0x1ce40e}});if(!_0x1cbbe1['ok']){const _0x1d0888=await _0x1cbbe1[_0x63ea14(0x1d0)]();throw new Error('Failed\x20to\x20get\x20feature\x20review:\x20'+_0x1d0888);}return _0x1cbbe1['json']();}export async function updateFeature(_0xdad7c5,_0x46baef){const _0x5ed8de=_0x3a20,_0x516e5b={'wSigw':function(_0x1088b){return _0x1088b();},'ZqLYi':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','fNIcM':_0x5ed8de(0x1a9),'EaBUz':_0x5ed8de(0x1a1)},_0x5c7c67=await _0x516e5b['wSigw'](getToken);if(!_0x5c7c67)throw new Error(_0x516e5b[_0x5ed8de(0x18c)]);const _0x241e45=_0x516e5b[_0x5ed8de(0x1d7)](getApiBaseUrl),_0x51e1d6=await fetch(_0x241e45+'/api/v1/mcp/features/'+_0xdad7c5,{'method':_0x516e5b[_0x5ed8de(0x1a0)],'headers':{'Authorization':_0x5ed8de(0x1b9)+_0x5c7c67,'Content-Type':_0x516e5b[_0x5ed8de(0x1cc)]},'body':JSON['stringify'](_0x46baef)});if(!_0x51e1d6['ok']){const _0x5de5fa=await _0x51e1d6[_0x5ed8de(0x1d0)]();throw new Error('Failed\x20to\x20update\x20feature\x20review:\x20'+_0x5de5fa);}return _0x51e1d6['json']();}export async function createChecklistItem(_0xedb547,_0x22573a,_0xdd8d0){const _0x11bb87=_0x3a20,_0x37b433={'CUPxS':function(_0x463862){return _0x463862();},'VxgKI':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','rRbaF':'POST'},_0x474999=await _0x37b433['CUPxS'](getToken);if(!_0x474999)throw new Error(_0x37b433['VxgKI']);const _0x58595f=getApiBaseUrl(),_0x37fe99=await fetch(_0x58595f+_0x11bb87(0x1b1)+_0xedb547+'/checklist',{'method':_0x37b433[_0x11bb87(0x1a5)],'headers':{'Authorization':_0x11bb87(0x1b9)+_0x474999,'Content-Type':_0x11bb87(0x1a1)},'body':JSON['stringify']({'description':_0x22573a,'position':_0xdd8d0})});if(!_0x37fe99['ok']){const _0x4a28e7=await _0x37fe99[_0x11bb87(0x1d0)]();throw new Error('Failed\x20to\x20create\x20scenario:\x20'+_0x4a28e7);}return _0x37fe99['json']();}export async function updateChecklistItem(_0x2288f2,_0x530182,_0x4003fe){const _0x5b9203=_0x3a20,_0x101e34={'siTlt':function(_0x701e2e){return _0x701e2e();},'fxaNg':function(_0x50cd47){return _0x50cd47();},'qfbBg':function(_0x5e5977,_0x4243bb,_0x7a6ea6){return _0x5e5977(_0x4243bb,_0x7a6ea6);},'QYBlV':'application/json','UWhFh':'updateChecklistItem'};return _0x101e34[_0x5b9203(0x1ac)](withRetry,async()=>{const _0x3306fa=_0x5b9203,_0x5bcbec=await _0x101e34[_0x3306fa(0x1cf)](getToken);if(!_0x5bcbec)throw new Error(_0x3306fa(0x1b5));const _0x4f4503=_0x101e34['fxaNg'](getApiBaseUrl),_0x16c56c=await _0x101e34['qfbBg'](fetch,_0x4f4503+'/api/v1/mcp/features/'+_0x2288f2+'/checklist/'+_0x530182,{'method':_0x3306fa(0x1a9),'headers':{'Authorization':'Bearer\x20'+_0x5bcbec,'Content-Type':_0x101e34[_0x3306fa(0x1bd)]},'body':JSON['stringify'](_0x4003fe)});if(!_0x16c56c['ok']){const _0x17f0ec=await _0x16c56c[_0x3306fa(0x1d0)]();throw new Error(_0x3306fa(0x1cd)+_0x17f0ec);}return _0x16c56c['json']();},{'label':_0x101e34[_0x5b9203(0x1be)]});}export async function getFeatureReport(_0x1a4758){const _0x138fc3=_0x3a20,_0x3b9475={'hJAwQ':function(_0x27a94b,_0x30bd68,_0x2638ca){return _0x27a94b(_0x30bd68,_0x2638ca);}},_0x7d3a6d=await getToken();if(!_0x7d3a6d)throw new Error(_0x138fc3(0x1b5));const _0x529bff=getApiBaseUrl(),_0x4a0ddc=await _0x3b9475['hJAwQ'](fetch,_0x529bff+_0x138fc3(0x1b1)+_0x1a4758+'/report',{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x7d3a6d}});if(!_0x4a0ddc['ok']){const _0x577c6a=await _0x4a0ddc['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x577c6a);}return _0x4a0ddc['json']();}export async function getFeatureReportMarkdown(_0x8b855,_0x2c6036){const _0x2135d7=_0x3a20,_0x139ece={'dfAjA':function(_0x1bebd3){return _0x1bebd3();},'cRfCs':function(_0x665ad2,_0x453687){return _0x665ad2(_0x453687);},'MerAe':'itemIds','obECq':'style'},_0x28dbab=await getToken();if(!_0x28dbab)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x19fc16=_0x139ece[_0x2135d7(0x1c4)](getApiBaseUrl),_0x187847=new URLSearchParams(),_0x5e9b37=(_0x2c6036?.[_0x2135d7(0x1c5)]?.['length']??0x0)>0x0,_0x156d88=_0x139ece['cRfCs'](Boolean,_0x2c6036?.['sessionId']);_0x5e9b37&&_0x2c6036?.['itemIds']&&_0x187847['set'](_0x139ece[_0x2135d7(0x1a6)],_0x2c6036[_0x2135d7(0x1c5)][_0x2135d7(0x1bb)](','));_0x156d88&&_0x2c6036?.['sessionId']&&_0x187847[_0x2135d7(0x1ce)](_0x2135d7(0x194),_0x2c6036[_0x2135d7(0x194)]);!_0x5e9b37&&!_0x156d88&&_0x2c6036?.['style']&&_0x187847['set'](_0x139ece['obECq'],_0x2c6036['style']);const _0x34acb2=_0x19fc16+'/api/v1/mcp/features/'+_0x8b855+'/report/markdown',_0x2ab458=''+_0x34acb2+(_0x187847['toString']()?'?'+_0x187847['toString']():''),_0x193f5b=await fetch(_0x2ab458,{'method':_0x2135d7(0x1ae),'headers':{'Authorization':'Bearer\x20'+_0x28dbab}});if(!_0x193f5b['ok']){const _0x2bcaed=await _0x193f5b['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20'+_0x2bcaed);}return _0x193f5b[_0x2135d7(0x1d0)]();}export async function listFeatureSessions(_0x412569){const _0xb8fcd0=_0x3a20,_0x4b21c7={'pAfYC':function(_0x461e75){return _0x461e75();},'QNuHa':_0xb8fcd0(0x1b5),'OKcLL':function(_0x2b6166,_0x3a1c0b,_0xfb08c){return _0x2b6166(_0x3a1c0b,_0xfb08c);},'YlDnn':_0xb8fcd0(0x1ae)},_0x56da70=await _0x4b21c7['pAfYC'](getToken);if(!_0x56da70)throw new Error(_0x4b21c7[_0xb8fcd0(0x190)]);const _0x69f14b=getApiBaseUrl(),_0xd79c2b=await _0x4b21c7['OKcLL'](fetch,_0x69f14b+'/api/v1/mcp/features/'+_0x412569+'/sessions',{'method':_0x4b21c7['YlDnn'],'headers':{'Authorization':'Bearer\x20'+_0x56da70}});if(!_0xd79c2b['ok']){const _0x54c5de=await _0xd79c2b[_0xb8fcd0(0x1d0)]();throw new Error('Failed\x20to\x20list\x20sessions:\x20'+_0x54c5de);}return _0xd79c2b[_0xb8fcd0(0x1b6)]();}export async function startSession(_0x1cd9fd,_0x547460){const _0x875b02=_0x3a20,_0x38ff03={'VAaHY':function(_0x34b3f5){return _0x34b3f5();},'JBNMs':function(_0x34e2b4,_0x59b552,_0x976dfd){return _0x34e2b4(_0x59b552,_0x976dfd);},'DrLdk':_0x875b02(0x1d5)},_0xa0327e=await _0x38ff03['VAaHY'](getToken);if(!_0xa0327e)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x5f0e13=getApiBaseUrl(),_0x4590a8=await _0x38ff03[_0x875b02(0x1a3)](fetch,_0x5f0e13+'/api/v1/mcp/features/'+_0x1cd9fd+_0x875b02(0x1a2)+_0x547460+_0x875b02(0x1ab),{'method':_0x38ff03['DrLdk'],'headers':{'Authorization':'Bearer\x20'+_0xa0327e}});if(!_0x4590a8['ok']){const _0x2fef0e=await _0x4590a8[_0x875b02(0x1d0)]();throw new Error('Failed\x20to\x20start\x20session:\x20'+_0x2fef0e);}return _0x4590a8['json']();}export async function concludeSession(_0x29c636,_0x14bd4c){const _0x365a65=_0x3a20,_0x354505={'AiwdG':function(_0xab639b){return _0xab639b();},'pwDkl':function(_0x36f695,_0x376f98,_0x32503b){return _0x36f695(_0x376f98,_0x32503b);}},_0x1d0389=await _0x354505['AiwdG'](getToken);if(!_0x1d0389)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x3c0aee=getApiBaseUrl(),_0x1ce774=await _0x354505[_0x365a65(0x1aa)](fetch,_0x3c0aee+'/api/v1/mcp/features/'+_0x29c636+_0x365a65(0x1a2)+_0x14bd4c+_0x365a65(0x18f),{'method':_0x365a65(0x1d5),'headers':{'Authorization':'Bearer\x20'+_0x1d0389}});if(!_0x1ce774['ok']){const _0x2473f0=await _0x1ce774[_0x365a65(0x1d0)]();throw new Error(_0x365a65(0x192)+_0x2473f0);}return _0x1ce774[_0x365a65(0x1b6)]();}export async function getActionItems(_0x41ef80){const _0x30e5d2=_0x3a20,_0x1163e4={'vRZEN':function(_0xad80d6){return _0xad80d6();},'Xcyvc':_0x30e5d2(0x1b5),'ArTBB':'GET'},_0x3ff340=await _0x1163e4['vRZEN'](getToken);if(!_0x3ff340)throw new Error(_0x1163e4[_0x30e5d2(0x1d2)]);const _0x593dc6=getApiBaseUrl(),_0x232640=await fetch(_0x593dc6+'/api/v1/mcp/features/'+_0x41ef80+'/action-items',{'method':_0x1163e4['ArTBB'],'headers':{'Authorization':_0x30e5d2(0x1b9)+_0x3ff340}});if(!_0x232640['ok']){const _0x89944c=await _0x232640[_0x30e5d2(0x1d0)]();throw new Error(_0x30e5d2(0x1ad)+_0x89944c);}return _0x232640[_0x30e5d2(0x1b6)]();}export async function getItemFeedback(_0x3b6bbc,_0x26fcbb){const _0x3aef1e=_0x3a20,_0x223b3d={'MFKrh':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x570272=await getToken();if(!_0x570272)throw new Error(_0x223b3d[_0x3aef1e(0x1c0)]);const _0x9f15b6=getApiBaseUrl(),_0x1f3078=await fetch(_0x9f15b6+'/api/v1/mcp/features/'+_0x3b6bbc+'/checklist-items/'+_0x26fcbb+_0x3aef1e(0x1d1),{'method':_0x3aef1e(0x1ae),'headers':{'Authorization':'Bearer\x20'+_0x570272}});if(!_0x1f3078['ok']){const _0x56bc58=await _0x1f3078['text']();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x56bc58);}return _0x1f3078[_0x3aef1e(0x1b6)]();}export async function markCommentsAddressed(_0x52a1bc,_0x308f13,_0x3f56a3){const _0xd2950=_0x3a20,_0x308ef7={'TihrK':function(_0x248600){return _0x248600();},'gdFHQ':_0xd2950(0x1b5),'qrSyM':'application/json'},_0x48aa5c=await _0x308ef7['TihrK'](getToken);if(!_0x48aa5c)throw new Error(_0x308ef7['gdFHQ']);const _0x4e0043=_0x308ef7['TihrK'](getApiBaseUrl),_0x492abf=await fetch(_0x4e0043+_0xd2950(0x1b1)+_0x52a1bc+_0xd2950(0x1b2),{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x48aa5c,'Content-Type':_0x308ef7['qrSyM']},'body':JSON[_0xd2950(0x1a7)]({'checklistItemId':_0x308f13,'commentIds':_0x3f56a3})});if(!_0x492abf['ok']){const _0x5daf1f=await _0x492abf['text']();throw new Error(_0xd2950(0x19f)+_0x5daf1f);}}export async function softDeleteFeature(_0x4e1d74){const _0x3b524b=_0x3a20,_0x3fb4ad={'DrCCb':function(_0x412022){return _0x412022();},'flWKo':function(_0x41b4d8,_0x2b25b0,_0x287881){return _0x41b4d8(_0x2b25b0,_0x287881);}},_0x45595b=await _0x3fb4ad['DrCCb'](getToken);if(!_0x45595b)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x258e7c=getApiBaseUrl(),_0x7b1c8b=await _0x3fb4ad[_0x3b524b(0x1c1)](fetch,_0x258e7c+_0x3b524b(0x1b1)+_0x4e1d74,{'method':_0x3b524b(0x1d3),'headers':{'Authorization':_0x3b524b(0x1b9)+_0x45595b}});if(!_0x7b1c8b['ok']){const _0x372391=await _0x7b1c8b[_0x3b524b(0x1d0)]();throw new Error('Failed\x20to\x20delete\x20feature\x20review:\x20'+_0x372391);}}export async function restoreFeature(_0xad4395){const _0x576d5e=_0x3a20,_0x200639={'rVhHF':function(_0x63de57){return _0x63de57();},'WYaUm':function(_0x341668,_0x40f3ab,_0x13be92){return _0x341668(_0x40f3ab,_0x13be92);},'tITIM':_0x576d5e(0x1d5)},_0x21fc55=await _0x200639['rVhHF'](getToken);if(!_0x21fc55)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x25e4c0=_0x200639[_0x576d5e(0x1d4)](getApiBaseUrl),_0x1dbf45=await _0x200639[_0x576d5e(0x18d)](fetch,_0x25e4c0+_0x576d5e(0x1b1)+_0xad4395+'/restore',{'method':_0x200639['tITIM'],'headers':{'Authorization':_0x576d5e(0x1b9)+_0x21fc55}});if(!_0x1dbf45['ok']){const _0x2abca5=await _0x1dbf45[_0x576d5e(0x1d0)]();throw new Error(_0x576d5e(0x1c8)+_0x2abca5);}}