@ranger-testing/ranger-cli 3.1.7-alpha.62f152a-54 → 3.1.7-alpha.a5be4ca-60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.js +1 -1
- package/build/commands/addEnv.js +1 -1
- package/build/commands/authEncrypt.js +1 -1
- package/build/commands/clean.js +1 -1
- package/build/commands/config.js +1 -1
- package/build/commands/deleteProfile.js +1 -1
- package/build/commands/env.js +1 -1
- package/build/commands/feature.js +1 -1
- package/build/commands/hook.js +1 -1
- package/build/commands/hooks/autoPrompt.js +1 -1
- package/build/commands/hooks/disable.js +1 -1
- package/build/commands/hooks/enable.js +1 -1
- package/build/commands/hooks/exitPlanMode.js +1 -1
- package/build/commands/hooks/index.js +1 -1
- package/build/commands/hooks/output.js +1 -1
- package/build/commands/hooks/planReminder.js +1 -1
- package/build/commands/hooks/planStart.js +1 -1
- package/build/commands/hooks/postEdit.js +1 -1
- package/build/commands/hooks/preCompact.js +1 -1
- package/build/commands/hooks/sessionEnd.js +1 -1
- package/build/commands/hooks/sessionStart.js +1 -1
- package/build/commands/hooks/stopHook.js +1 -1
- package/build/commands/index.js +1 -1
- package/build/commands/login.js +1 -1
- package/build/commands/mcpBootstrap.js +1 -1
- package/build/commands/migrateProfile.js +1 -1
- package/build/commands/setup/claude.js +1 -1
- package/build/commands/setup/opencode.js +1 -1
- package/build/commands/setupCi.js +1 -1
- package/build/commands/skillup.js +1 -1
- package/build/commands/start.js +1 -1
- package/build/commands/status.js +1 -1
- package/build/commands/update.js +1 -1
- package/build/commands/updateEnv.js +1 -1
- package/build/commands/useEnv.js +1 -1
- package/build/commands/utils/activeProfile.js +1 -1
- package/build/commands/utils/agentEnv.js +1 -1
- package/build/commands/utils/browserSessionsApi.js +1 -1
- package/build/commands/utils/claudeConfig.js +1 -1
- package/build/commands/utils/claudeOverrideSettings.js +1 -1
- package/build/commands/utils/claudePlugin.js +1 -1
- package/build/commands/utils/cloudProfile.js +1 -1
- package/build/commands/utils/cloudProfileSession.js +1 -1
- package/build/commands/utils/crypto.js +1 -1
- package/build/commands/utils/desirePathLog.js +1 -1
- package/build/commands/utils/deviceAuth.js +1 -1
- package/build/commands/utils/environment.js +1 -1
- package/build/commands/utils/featureApi.js +1 -1
- package/build/commands/utils/fixWebmDuration.js +1 -1
- package/build/commands/utils/gitTracked.js +1 -1
- package/build/commands/utils/keychain.js +1 -1
- package/build/commands/utils/legacyWarning.js +1 -1
- package/build/commands/utils/localAgentInstallationsApi.js +1 -1
- package/build/commands/utils/matchAuthEnvironment.js +1 -1
- package/build/commands/utils/mcpImageBase64.js +1 -1
- package/build/commands/utils/model.js +1 -1
- package/build/commands/utils/novaActCli.js +1 -1
- package/build/commands/utils/opencodeConfig.js +1 -1
- package/build/commands/utils/organizationEnvApi.js +1 -1
- package/build/commands/utils/playwrightCli.js +1 -1
- package/build/commands/utils/profileMessages.js +1 -1
- package/build/commands/utils/profileSetupBanner.js +1 -1
- package/build/commands/utils/projectsConfig.js +1 -1
- package/build/commands/utils/rangerConfig.js +1 -1
- package/build/commands/utils/rangerRoot.js +1 -1
- package/build/commands/utils/rangerwrightCli.js +1 -1
- package/build/commands/utils/resolveProfileContext.js +1 -1
- package/build/commands/utils/resolveProfileUrl.js +1 -1
- package/build/commands/utils/retry.js +1 -1
- package/build/commands/utils/scenarioOriginCheck.js +1 -1
- package/build/commands/utils/sessionCache.js +1 -1
- package/build/commands/utils/settings.js +1 -1
- package/build/commands/utils/skillContent.js +1 -1
- package/build/commands/utils/skills.js +1 -1
- package/build/commands/utils/stitchWebmFiles.js +1 -1
- package/build/commands/utils/telemetry.js +1 -1
- package/build/commands/utils/tokenRefresh.js +1 -1
- package/build/commands/utils/traceSnapshotMapper.js +1 -1
- package/build/commands/utils/tunnelClient.js +1 -1
- package/build/commands/utils/userApi.js +1 -1
- package/build/commands/utils/version.js +1 -1
- package/build/commands/verifyFeature.js +1 -1
- package/build/commands/verifyFeatureCli.js +1 -1
- package/build/commands/verifyFeatureNovaCli.js +1 -1
- package/build/commands/verifyFeatureRangerwrightCli.js +1 -1
- package/package.json +15 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x128150=_0x58e3;(function(_0x4b43ea,_0x1e53b7){const _0x2a0f63=_0x58e3,_0x54f78c=_0x4b43ea();while(!![]){try{const _0x4dd997=-parseInt(_0x2a0f63(0x1db))/0x1+parseInt(_0x2a0f63(0x203))/0x2*(-parseInt(_0x2a0f63(0x1eb))/0x3)+parseInt(_0x2a0f63(0x1cb))/0x4+-parseInt(_0x2a0f63(0x21e))/0x5*(parseInt(_0x2a0f63(0x160))/0x6)+-parseInt(_0x2a0f63(0x1a7))/0x7*(-parseInt(_0x2a0f63(0x210))/0x8)+parseInt(_0x2a0f63(0x175))/0x9*(parseInt(_0x2a0f63(0x1ba))/0xa)+-parseInt(_0x2a0f63(0x1b5))/0xb*(-parseInt(_0x2a0f63(0x1de))/0xc);if(_0x4dd997===_0x1e53b7)break;else _0x54f78c['push'](_0x54f78c['shift']());}catch(_0x150dbf){_0x54f78c['push'](_0x54f78c['shift']());}}}(_0xbd30,0xacb26));function _0x58e3(_0x567f99,_0x1ef247){_0x567f99=_0x567f99-0x15f;const _0xbd3090=_0xbd30();let _0x58e3f2=_0xbd3090[_0x567f99];return _0x58e3f2;}import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x329f71 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,isBareLocalhost,isCachedSessionLive,isInteractive,needsTunnel,orderLoginDomains,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{matchAuthEnvironmentByHost,matchAuthEnvironmentExact}from'./matchAuthEnvironment.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';function targetHostForTelemetry(_0x41440b){const _0x3ef00e=_0x58e3,_0x4db349={'inXPV':_0x3ef00e(0x165)};try{return new URL(_0x41440b)[_0x3ef00e(0x221)];}catch{return _0x4db349[_0x3ef00e(0x1e7)];}}function errorMessageForTelemetry(_0x3ddd32){const _0xe88ed9=_0x58e3;return _0x3ddd32 instanceof Error?_0x3ddd32[_0xe88ed9(0x167)]:undefined;}function trackBridgeEvent(_0x27a57b,_0x531b82){const _0x2df7fd=_0x58e3,_0x59b5d8={'YZoZS':'tunnel_bridge_event','Rzhvy':function(_0x38a1a8,_0x5431ee){return _0x38a1a8===_0x5431ee;},'inSNX':'local_ws_error','OZNyG':'tunnel_bridge'};if(!_0x27a57b)return;const _0x4a8f5c={'tunnelSessionId':_0x531b82[_0x2df7fd(0x1f4)],'tunnelEventType':_0x531b82[_0x2df7fd(0x21b)],'connectionId':_0x531b82['connectionId'],'code':_0x531b82[_0x2df7fd(0x1ac)],'reason':_0x531b82[_0x2df7fd(0x207)],'error':_0x531b82[_0x2df7fd(0x195)],'elapsedMs':_0x531b82['elapsedMs'],'activeLocalConnections':_0x531b82['activeLocalConnections'],'pendingLocalConnections':_0x531b82[_0x2df7fd(0x1d5)]};_0x27a57b['trackPhaseEnd'](_0x59b5d8[_0x2df7fd(0x163)],_0x4a8f5c),(_0x59b5d8[_0x2df7fd(0x1e4)](_0x531b82[_0x2df7fd(0x21b)],_0x2df7fd(0x1fd))||_0x59b5d8[_0x2df7fd(0x1e4)](_0x531b82[_0x2df7fd(0x21b)],_0x59b5d8['inSNX']))&&void _0x27a57b[_0x2df7fd(0x169)](_0x59b5d8[_0x2df7fd(0x1d6)],new Error(_0x531b82['error']??_0x531b82[_0x2df7fd(0x21b)]),_0x4a8f5c);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x13af7b=await getToken();if(!_0x13af7b)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');return _0x13af7b;}async function apiRequest(_0x368cbc,_0x518975={}){const _0x196cb9=_0x58e3,_0xab03c4={'igskq':function(_0x47e7e7){return _0x47e7e7();},'APVvw':function(_0x47670f,_0x5b04d6,_0x24b894){return _0x47670f(_0x5b04d6,_0x24b894);},'bzIig':function(_0x32c007,_0x5a051b){return _0x32c007===_0x5a051b;},'uYacF':_0x196cb9(0x18b)},_0x1f4b81=await _0xab03c4['igskq'](requireToken),_0x2d596f=getApiBaseUrl(),_0xe28e40=await _0xab03c4[_0x196cb9(0x20c)](fetch,''+_0x2d596f+_0x368cbc,{..._0x518975,'headers':{'Authorization':'Bearer\x20'+_0x1f4b81,'Content-Type':'application/json',..._0x518975[_0x196cb9(0x1b0)]??{}}});if(!_0xe28e40['ok']){let _0x360589='',_0xca63fd;try{const _0x352e76=await _0xe28e40[_0x196cb9(0x1f1)](),_0x266a97=(_0xab03c4[_0x196cb9(0x20b)](typeof _0x352e76[_0x196cb9(0x195)],_0x196cb9(0x18b))?_0x352e76[_0x196cb9(0x195)]:undefined)??JSON[_0x196cb9(0x18e)](_0x352e76);_0x360589=_0x266a97;typeof _0x352e76[_0x196cb9(0x1b6)]===_0xab03c4[_0x196cb9(0x1bb)]&&_0x352e76['test_output']&&(_0x360589=_0x360589+'\x0a'+_0x352e76['test_output']);if(typeof _0x352e76['code']===_0xab03c4[_0x196cb9(0x1bb)])_0xca63fd=_0x352e76['code'];}catch{_0x360589=_0xe28e40[_0x196cb9(0x1be)];}throw new ApiError('API\x20request\x20'+_0x368cbc+'\x20failed\x20('+_0xe28e40[_0x196cb9(0x1a2)]+_0x196cb9(0x1c1)+_0x360589,_0xe28e40['status'],_0x360589,_0xca63fd);}if(_0xe28e40['status']===0xcc)return undefined;return _0xe28e40[_0x196cb9(0x1f1)]();}export class ApiError extends Error{[_0x128150(0x1a2)];[_0x128150(0x1cf)];['code'];constructor(_0x48c7b2,_0x12071b,_0x4cc786,_0x47b00e){const _0x3b5e30=_0x128150,_0x508c34={'mwTlL':'ApiError'};super(_0x48c7b2),this[_0x3b5e30(0x1a2)]=_0x12071b,this[_0x3b5e30(0x1cf)]=_0x4cc786,this['code']=_0x47b00e,this['name']=_0x508c34[_0x3b5e30(0x212)];}}export async function fetchCloudProfile(_0x206433){const _0x3657ff=_0x128150,_0x4d5dc8={'otSqT':function(_0x1bb786,_0x303dbd){return _0x1bb786===_0x303dbd;}};try{return await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x206433));}catch(_0x5ee23b){if(_0x5ee23b instanceof ApiError&&_0x4d5dc8['otSqT'](_0x5ee23b[_0x3657ff(0x1a2)],0x194))return null;throw _0x5ee23b;}}export async function listCloudProfiles(){const _0x3dded2=_0x128150,_0x314b25={'KpUuZ':'/api/v1/profiles'},_0xc65e6f=await apiRequest(_0x314b25[_0x3dded2(0x179)]);return _0xc65e6f[_0x3dded2(0x172)];}export async function deleteCloudProfile(_0x51d1b2){const _0x1c9683=_0x128150,_0x522f1b={'aBqCn':function(_0x1f6c39,_0x3cf79f,_0x28bdd6){return _0x1f6c39(_0x3cf79f,_0x28bdd6);},'lEXHO':_0x1c9683(0x1dd),'UctrC':function(_0x4183da,_0x2ad822){return _0x4183da instanceof _0x2ad822;}};try{await _0x522f1b['aBqCn'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x51d1b2),{'method':_0x522f1b['lEXHO']});}catch(_0x39e8bb){if(_0x522f1b['UctrC'](_0x39e8bb,ApiError)&&_0x39e8bb['status']===0x194)throw new Error(_0x1c9683(0x187)+_0x51d1b2+'\x22\x20not\x20found.');throw _0x39e8bb;}}export async function createCloudProfile(_0x289cf3,_0x4e20f0,_0x105d63={}){const _0x15e6b4=_0x128150,_0x35b138={'QyXRf':function(_0x5b9557,_0x5cdb14){return _0x5b9557>_0x5cdb14;},'ejswp':function(_0x9025cf,_0x177d4a,_0x256259){return _0x9025cf(_0x177d4a,_0x256259);},'TrVTm':'/api/v1/profiles'},_0x43f83c={'name':_0x289cf3};if(_0x4e20f0)_0x43f83c[_0x15e6b4(0x176)]=_0x4e20f0;_0x105d63['settings']&&_0x35b138[_0x15e6b4(0x1e1)](Object[_0x15e6b4(0x1fa)](_0x105d63[_0x15e6b4(0x20d)])['length'],0x0)&&(_0x43f83c[_0x15e6b4(0x20d)]=_0x105d63['settings']);if(_0x105d63[_0x15e6b4(0x1d8)])_0x43f83c['username']=_0x105d63[_0x15e6b4(0x1d8)];if(_0x105d63['password'])_0x43f83c['password']=_0x105d63['password'];return await _0x35b138[_0x15e6b4(0x184)](apiRequest,_0x35b138['TrVTm'],{'method':_0x15e6b4(0x1a0),'body':JSON['stringify'](_0x43f83c)});}export async function uploadCloudProfileSession(_0x5a104c,_0xaaf14d){const _0x3ca12b=_0x128150,_0x4e66d8={'oZInz':function(_0x5186b9,_0x480419,_0x50add2){return _0x5186b9(_0x480419,_0x50add2);},'nPpAN':function(_0x2f33a0,_0x1bcbe1){return _0x2f33a0(_0x1bcbe1);}};return await _0x4e66d8['oZInz'](apiRequest,'/api/v1/profiles/'+_0x4e66d8[_0x3ca12b(0x1b9)](encodeURIComponent,_0x5a104c)+'/session',{'method':'POST','body':JSON[_0x3ca12b(0x18e)]({'session_state':_0xaaf14d})});}export async function saveCloudProfileCredentials(_0x67f4b,_0x3b0ea3,_0x2a374f){const _0x29b796=_0x128150;await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x67f4b),{'method':_0x29b796(0x1a5),'body':JSON[_0x29b796(0x18e)]({'username':_0x3b0ea3,'password':_0x2a374f})});}export async function fetchAuthConfig(){const _0x40fc02=_0x128150,_0x2ef2f6={'eSule':function(_0xf4e551,_0x14d1a0){return _0xf4e551 instanceof _0x14d1a0;},'BZsSF':function(_0x457b1d,_0x143e37){return _0x457b1d!==_0x143e37;}};try{const _0x53932e=await apiRequest(_0x40fc02(0x205));return _0x53932e[_0x40fc02(0x166)];}catch(_0x32e211){return _0x2ef2f6['eSule'](_0x32e211,ApiError)&&_0x2ef2f6[_0x40fc02(0x219)](_0x32e211[_0x40fc02(0x1a2)],0x194)&&console['error']('\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20'+_0x32e211['message']),null;}}function _0xbd30(){const _0x33c408=['Browser\x20login\x20timed\x20out\x20after\x20','Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20(','PUT','vqITV','203KNpNTb','oSIaU','userAgent','\x20\x20Server-side\x20login\x20error:\x20','\x22.\x0a','code','pLOpK','toISOString','tunnel_login_request','headers','trackPhaseEnd','LCRXP','rtzLx','BzEuD','11mflGdH','test_output','/api/v1/tunnel/sessions/','log','nPpAN','2069440ycidVa','uYacF','domains','join','statusText','\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.',').\x20','):\x20','/api/v1/profiles/','XuMrQ','GpaHa','newContext','RANGER_TEST_USERNAME','tunnel','fKpda','irjPD','\x22;\x20proceeding\x20with\x20loginInstructions.','2954304NkCbXk','\x20\x20Cloud\x20session\x20for\x20\x22','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','not_configured','detail','env','target_url','force','\x20\x20No\x20live\x20session\x20for\x20\x22','toLowerCase','pendingLocalConnections','OZNyG','\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','username','\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','iOPJZ','1381971vsICDt','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','DELETE','6474108nyaEdz',');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.','upqXP','QyXRf','browserOptions','Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20','Rzhvy','yOaua','sessionCheckPath','inXPV','KeAvp','\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22','assertedEnv','107259EELYdM','HpDre','XgpHw','oKTpq','\x20(auth\x20env:\x20','oISff','json','idPgu','persistSessionState','sessionId','rBCyA','VAatE','\x22\x20matched\x20by\x20host\x20for\x20','\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.','\x22;\x20using\x20\x22','keys','\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22','\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)','tunnel_error','setupHeaders','targetUrl','\x20\x20Login\x20successful.\x20Session\x20cached.','/login','NQmYQ','46WusDZi','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','/api/v1/profiles/auth-config','ambiguous','reason','\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20','or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','4|0|2|1|3','bzIig','APVvw','settings','storageState','\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.','307696OKicVp','HtBsr','mwTlL','trim','environmentKey','organizationId','lyrOk','Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20(','XQRad','BZsSF','\x20\x20Cached\x20session\x20for\x20\x22','type','newPage','\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.','67305rngJkM','FhAxT','parse','host','Auth\x20environment\x20\x22','138mPdqUq','tunnelUrl','cookies','YZoZS','url','invalid-url','auth_config','message','clientIp','trackPhaseError','save','BYdPw','UkTVM','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','iMSfX','utf-8','\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.','jUZMl','profiles','\x20\x20forceLogin\x20enabled\x20for\x20\x22','replace','36dbRRMZ','environment_key','key','sessionState','KpUuZ','tunnel_login_setup','mCcPt','telemetry','QnsQE','trackPhaseStart','loginInstructions','ybGET','length','iwxYI','catch','ejswp','\x20\x20Created\x20cloud\x20profile\x20\x22','\x20\x20-\x20ask\x20your\x20Ranger\x20admin\x20to\x20add\x20\x22','Cloud\x20profile\x20\x22','aeppc','\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22','success','string','prompt','KfomG','stringify','baseUrl','\x22\x20instead.','defaultEnvironmentKey','hTigw','EIgUP','environments','error','\x20\x20•\x20or\x20pass\x20--env\x20<key>\x20to\x20run\x20an\x20automated\x20login\x20for\x20this\x20target.','origin','lrFkp','tunnel_session_id','\x22\x20for\x20','name','eWIEF','OECpQ','push','RANGER_TEST_PASSWORD','POST','\x22\x20on\x20profile\x20\x22','status'];_0xbd30=function(){return _0x33c408;};return _0xbd30();}async function createTunnelSession(_0x5601cf){const _0x3b8db2=_0x128150,_0xfce5b5={'iOPJZ':'/api/v1/tunnel/sessions'};return await apiRequest(_0xfce5b5[_0x3b8db2(0x1da)],{'method':_0x3b8db2(0x1a0),'body':JSON['stringify']({'targetUrl':_0x5601cf,'mode':'agent'})});}async function deleteTunnelSession(_0x29f8c7){const _0x5c5806=_0x128150;await apiRequest(_0x5c5806(0x1b7)+_0x29f8c7,{'method':'DELETE'});}export function pickAdHocEnvKey(_0xc9d2e2,_0x181afc,_0x1f8487){const _0x32eee3=_0x128150,_0x7a8023={'HpDre':function(_0x55c7f1,_0x2c7ee0){return _0x55c7f1+_0x2c7ee0;},'KeAvp':_0x32eee3(0x21d),'UkTVM':function(_0x7dd4d,_0x5097ce,_0x37c392){return _0x7dd4d(_0x5097ce,_0x37c392);},'eWIEF':'key','hTigw':function(_0x55262a,_0x41d034){return _0x55262a in _0x41d034;},'AXNZe':'ambiguous','bceVp':function(_0x46b036,_0x2bf8f5){return _0x46b036(_0x2bf8f5);},'CIWsK':function(_0x17d93c,_0x5fbd10){return _0x17d93c+_0x5fbd10;},'upqXP':function(_0x455d3c,_0x2ceb89){return _0x455d3c===_0x2ceb89;}};if(_0x1f8487){if(!_0xc9d2e2?.['environments']?.[_0x1f8487]){const _0x53b5e9=Object['keys'](_0xc9d2e2?.[_0x32eee3(0x194)]??{});throw new Error(_0x7a8023[_0x32eee3(0x1ec)](_0x32eee3(0x15f)+_0x1f8487+_0x32eee3(0x1f8),_0x53b5e9[_0x32eee3(0x181)]?'\x20Available:\x20'+_0x53b5e9['join'](',\x20')+'.':_0x7a8023[_0x32eee3(0x1e8)])+_0x32eee3(0x1fc));}return _0x1f8487;}if(!_0xc9d2e2)return null;if(_0x181afc){const _0x4604f3=_0x7a8023['UkTVM'](matchAuthEnvironmentExact,_0x181afc,_0xc9d2e2);if(_0x4604f3)return _0x4604f3;const _0x36124e=_0x7a8023[_0x32eee3(0x16c)](matchAuthEnvironmentByHost,_0x181afc,_0xc9d2e2);if(_0x36124e&&_0x7a8023[_0x32eee3(0x19c)]in _0x36124e)return console[_0x32eee3(0x1b8)]('\x20\x20Auth\x20env\x20\x22'+_0x36124e[_0x32eee3(0x177)]+_0x32eee3(0x1f7)+_0x181afc+'\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).'),_0x36124e['key'];if(_0x36124e&&_0x7a8023[_0x32eee3(0x192)](_0x7a8023['AXNZe'],_0x36124e))throw new Error(_0x32eee3(0x217)+_0x36124e[_0x32eee3(0x206)]['join'](',\x20')+_0x32eee3(0x1df));if(_0x7a8023['bceVp'](needsTunnel,_0x181afc))throw new Error(_0x7a8023['CIWsK'](_0x7a8023[_0x32eee3(0x1ec)]('No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22'+_0x181afc+_0x32eee3(0x1ab)+'\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a'+'\x20\x20Options:\x0a','\x20\x20-\x20pass\x20`--env\x20<key>`\x20to\x20pick\x20the\x20auth\x20environment\x20by\x20name,\x20or\x0a')+(_0x32eee3(0x186)+_0x181afc[_0x32eee3(0x174)](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a'),'\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20'+_0x181afc+_0x32eee3(0x170)));}if(_0xc9d2e2[_0x32eee3(0x191)])return _0xc9d2e2['defaultEnvironmentKey'];const _0x2b8355=Object['keys'](_0xc9d2e2[_0x32eee3(0x194)]??{});if(_0x7a8023[_0x32eee3(0x1e0)](_0x2b8355[_0x32eee3(0x181)],0x1))return _0x2b8355[0x0];if(_0x7a8023['upqXP'](_0x2b8355['length'],0x0))return null;throw new Error(_0x32eee3(0x1a4)+_0x2b8355['join'](',\x20')+_0x32eee3(0x1c0)+'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(_0x51c33e,_0x18f6aa,_0x47722b){if(!_0x18f6aa||_0x18f6aa===_0x47722b)return _0x51c33e;return _0x51c33e+':'+_0x18f6aa;}export async function resolveAdHocProfile(_0x2c9839={},_0x398a89=process[_0x128150(0x1d0)]){const _0x56ee0f=_0x128150,_0x403496={'mCcPt':function(_0xc625ab,_0xd8f844,_0x33e52e,_0x4b8832){return _0xc625ab(_0xd8f844,_0x33e52e,_0x4b8832);},'xvGGv':function(_0x5d74a3,_0x14c9d4,_0xe935a1,_0x5b03f1){return _0x5d74a3(_0x14c9d4,_0xe935a1,_0x5b03f1);},'iwxYI':function(_0x36e29c,_0x54b498){return _0x36e29c!==_0x54b498;},'EIgUP':function(_0x5cc333,_0xb10f5){return _0x5cc333(_0xb10f5);},'EYTzw':function(_0x39fb40,_0x4ac6c4){return _0x39fb40??_0x4ac6c4;}},_0x7aafa1=_0x398a89['RANGER_TEST_USERNAME'];if(!_0x7aafa1)return null;const _0x32690a=await fetchAuthConfig(),_0x43380e=_0x403496[_0x56ee0f(0x17b)](pickAdHocEnvKey,_0x32690a,_0x2c9839['targetUrl'],_0x2c9839['envKey']);let _0x327b37=_0x403496['xvGGv'](adHocProfileName,_0x7aafa1,_0x43380e,_0x32690a?.['defaultEnvironmentKey']),_0x9df5dc=await fetchCloudProfile(_0x327b37);_0x9df5dc&&_0x43380e&&_0x403496[_0x56ee0f(0x182)](_0x9df5dc[_0x56ee0f(0x214)],_0x43380e)&&(console['log']('\x20\x20Cloud\x20profile\x20\x22'+_0x327b37+_0x56ee0f(0x1e9)+(_0x9df5dc[_0x56ee0f(0x214)]??'none')+'\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22'+_0x43380e+_0x56ee0f(0x1f9)+_0x7aafa1+':'+_0x43380e+_0x56ee0f(0x190)),_0x327b37=_0x7aafa1+':'+_0x43380e,_0x9df5dc=await _0x403496[_0x56ee0f(0x193)](fetchCloudProfile,_0x327b37));if(_0x9df5dc)return{'name':_0x9df5dc[_0x56ee0f(0x19b)],'profile':_0x9df5dc};const _0x3d279b=_0x398a89['RANGER_TEST_PASSWORD'],_0x2d4760=await _0x403496[_0x56ee0f(0x17b)](createCloudProfile,_0x327b37,_0x403496['EYTzw'](_0x43380e,undefined),{'username':_0x7aafa1,'password':_0x3d279b});return console['log'](_0x56ee0f(0x185)+_0x2d4760['name']+_0x56ee0f(0x19a)+_0x7aafa1+(_0x43380e?_0x56ee0f(0x1ef)+_0x43380e+')':'')),{'name':_0x2d4760['name'],'profile':_0x2d4760};}export async function writeSessionToLocalCache(_0x3428d1,_0x28297b,_0x3cc748,_0x1c1771,_0x13c6a2,_0x360c7c,_0x2e5701){const _0x3d5189=_0x128150,_0x20ba28={'XgpHw':function(_0x1e87f4,_0x2b7cf6){return _0x1e87f4(_0x2b7cf6);},'ybGET':function(_0x17dff0,_0x3271a3,_0x5788a5){return _0x17dff0(_0x3271a3,_0x5788a5);},'oISff':'auth','Lsnlm':function(_0x46db83,_0x380a8a,_0x288f81){return _0x46db83(_0x380a8a,_0x288f81);}},_0x2fdea9=_0x20ba28[_0x3d5189(0x1ed)](sessionCacheHash,{'orgId':_0x28297b,'profileName':_0x3428d1,'effectiveBaseUrl':_0x3cc748,'setupHeaders':_0x1c1771,'invalidateOn':_0x2e5701?.['invalidateOn'],'userAgent':_0x2e5701?.['userAgent'],'clientIp':_0x2e5701?.['clientIp']}),_0x197b3c=_0x20ba28[_0x3d5189(0x180)](getSessionCachePath,_0x2fdea9,_0x3428d1),_0x4184e2=join(getRangerHomeDir(),_0x20ba28[_0x3d5189(0x1f0)]);!existsSync(_0x4184e2)&&await mkdir(_0x4184e2,{'recursive':!![]});const _0x4972b3={..._0x13c6a2};_0x360c7c&&_0x360c7c[_0x3d5189(0x181)]>0x0&&Array['isArray'](_0x4972b3[_0x3d5189(0x162)])&&(_0x4972b3[_0x3d5189(0x162)]=duplicateCookiesForDomains(_0x4972b3['cookies'],_0x360c7c));const _0x26bf2c={'cached_at':new Date()[_0x3d5189(0x1ae)](),'session_state':_0x4972b3};await _0x20ba28['Lsnlm'](writeFile,_0x197b3c,JSON['stringify'](_0x26bf2c,null,0x2));const _0x31bb0f=getStorageStatePath(_0x197b3c);return await _0x20ba28['Lsnlm'](writeFile,_0x31bb0f,JSON[_0x3d5189(0x18e)](_0x4972b3,null,0x2)),_0x31bb0f;}export async function checkLocalCache(_0x13a50f,_0x1aa35c,_0x18aecb,_0x1ba1b5,_0x450f54){const _0x2f924f=_0x128150,_0x1c0e8b={'PDJAG':function(_0x4b9040,_0x1b661f){return _0x4b9040(_0x1b661f);},'BYdPw':function(_0x4a96d4,_0x176436,_0x3ea428){return _0x4a96d4(_0x176436,_0x3ea428);},'oQTAB':function(_0x4f64f1,_0x55ca10){return _0x4f64f1(_0x55ca10);}},_0x5a5a57=_0x1c0e8b['PDJAG'](sessionCacheHash,{'orgId':_0x1aa35c,'profileName':_0x13a50f,'effectiveBaseUrl':_0x18aecb,'setupHeaders':_0x1ba1b5,'invalidateOn':_0x450f54?.['invalidateOn'],'userAgent':_0x450f54?.['userAgent'],'clientIp':_0x450f54?.[_0x2f924f(0x168)]}),_0x59bf4f=_0x1c0e8b[_0x2f924f(0x16b)](getSessionCachePath,_0x5a5a57,_0x13a50f),_0x5614e1=_0x1c0e8b['PDJAG'](getStorageStatePath,_0x59bf4f);if(!_0x1c0e8b['oQTAB'](existsSync,_0x59bf4f)||!existsSync(_0x5614e1))return null;try{const _0x2164c3=await readFile(_0x59bf4f,_0x2f924f(0x16f));return JSON[_0x2f924f(0x220)](_0x2164c3),{'storageStatePath':_0x5614e1};}catch{return null;}}function launchRealBrowser(){return chromium['launch']({'headless':!![]});}function emitSessionValidationHint(_0x5a40f2,_0x394e9c){const _0x149b61=_0x128150,_0x895ff6={'KfomG':function(_0x56e5fe,_0x838fb6){return _0x56e5fe===_0x838fb6;},'RAbUD':function(_0x4cae9a,_0x51b797){return _0x4cae9a+_0x51b797;},'dapKE':function(_0x1ca7e7,_0x11253c){return _0x1ca7e7+_0x11253c;}};if(!_0x394e9c||!_0x394e9c['domains']?.[_0x149b61(0x181)])return;let _0x458afa;try{_0x458afa=new URL(_0x5a40f2);}catch{return;}const _0x9f8313=[];for(const _0x3ce531 of _0x394e9c[_0x149b61(0x1bc)]){try{_0x9f8313[_0x149b61(0x19e)]({'raw':_0x3ce531,'url':new URL(_0x3ce531)});}catch{}}if(_0x895ff6[_0x149b61(0x18d)](_0x9f8313['length'],0x0))return;if(_0x9f8313['some'](_0xbaeb63=>_0xbaeb63[_0x149b61(0x164)][_0x149b61(0x197)]===_0x458afa['origin']))return;const _0x47884d=_0x9f8313['map'](_0x12f8be=>'\x22'+_0x12f8be['raw']+'\x22')[_0x149b61(0x1bd)](',\x20');console[_0x149b61(0x1b8)](_0x895ff6['RAbUD'](_0x895ff6['dapKE']('\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20'+_0x47884d+';\x20','you\x27re\x20now\x20at\x20\x22'+_0x5a40f2+_0x149b61(0x208)),_0x149b61(0x1dc)));}export async function serverSideLogin(_0x37f62b,_0x18d4c4){const _0x5140a6=_0x128150,_0x351d9d={'dqJNh':function(_0x420435,_0x680722,_0x44e74f){return _0x420435(_0x680722,_0x44e74f);},'oSIaU':function(_0x30778c,_0x123e0b){return _0x30778c(_0x123e0b);},'BzEuD':function(_0x27f8c6,_0x4f9dd2){return _0x27f8c6===_0x4f9dd2;}},_0x56be3b=process[_0x5140a6(0x1d0)][_0x5140a6(0x1c6)],_0x14dfd6=process['env'][_0x5140a6(0x19f)],_0x5b322e={};if(_0x56be3b)_0x5b322e['username']=_0x56be3b;if(_0x14dfd6)_0x5b322e['password']=_0x14dfd6;if(_0x18d4c4?.['force'])_0x5b322e['force']=!![];if(_0x18d4c4?.[_0x5140a6(0x1ff)])_0x5b322e[_0x5140a6(0x1d1)]=_0x18d4c4[_0x5140a6(0x1ff)];if(_0x18d4c4?.['env'])_0x5b322e['env']=_0x18d4c4['env'];_0x18d4c4?.['tunnel']&&(_0x5b322e[_0x5140a6(0x199)]=_0x18d4c4['tunnel']['sessionId'],_0x5b322e['pw_endpoint']=_0x18d4c4[_0x5140a6(0x1c7)]['pwEndpoint']);try{return await _0x351d9d['dqJNh'](apiRequest,_0x5140a6(0x1c2)+_0x351d9d[_0x5140a6(0x1a8)](encodeURIComponent,_0x37f62b)+_0x5140a6(0x201),{'method':_0x5140a6(0x1a0),'body':JSON['stringify'](_0x5b322e)});}catch(_0x2f38b2){if(_0x2f38b2 instanceof ApiError&&_0x351d9d[_0x5140a6(0x1b4)](_0x2f38b2['status'],0x190)&&_0x351d9d[_0x5140a6(0x1b4)](_0x2f38b2['code'],'not_configured'))return{'status':_0x5140a6(0x1ce),'error':_0x2f38b2['detail']};throw _0x2f38b2;}}async function serverSideLoginWithOptionalTunnel(_0x3106c1,_0x4e2ad2,_0x4c4220={}){const _0x4a0c7b=_0x128150,_0x1bef9e={'aeppc':_0x4a0c7b(0x1af),'sQcJX':function(_0x426324,_0x3e519a){return _0x426324(_0x3e519a);},'rMcJy':function(_0x4fb3e0,_0x35ecc3){return _0x4fb3e0===_0x35ecc3;},'MTHnB':'true','FhAxT':_0x4a0c7b(0x1d7),'auiRK':function(_0x4c4905,_0x3f389d){return _0x4c4905(_0x3f389d);},'lrFkp':function(_0x4a018a,_0x3abda9){return _0x4a018a(_0x3abda9);},'BJKnS':function(_0x550724,_0x148fc5){return _0x550724(_0x148fc5);},'idPgu':function(_0x38358f,_0x408dfe,_0x7da630){return _0x38358f(_0x408dfe,_0x7da630);},'rBCyA':function(_0x456db3,_0x5186c9){return _0x456db3??_0x5186c9;},'tzKfm':function(_0x404667,_0x43c167){return _0x404667||_0x43c167;},'XuMrQ':function(_0x1178f4,_0x16c2c5){return _0x1178f4(_0x16c2c5);},'IOqbo':'tunnel_login_cleanup'};if(!needsTunnel(_0x4e2ad2))return await serverSideLogin(_0x3106c1,{'force':_0x4c4220['force'],'env':_0x4c4220[_0x4a0c7b(0x1d0)]});let _0x111476=null,_0xc71902=null,_0x5db885=null,_0x1e59f5=null,_0x21d418=![];const _0x20298b=process['env']['RANGER_TUNNEL_LOGIN_HEADED']?.[_0x4a0c7b(0x1d4)](),_0x34317f=_0x1bef9e['rMcJy'](_0x20298b,'1')||_0x20298b===_0x1bef9e['MTHnB'],_0x57c871={'profileName':_0x3106c1,'targetUrlHost':targetHostForTelemetry(_0x4e2ad2),'tunnelRequired':!![],'forceLogin':Boolean(_0x4c4220[_0x4a0c7b(0x1d2)]),'localBrowserServerHeaded':_0x34317f};try{_0x4c4220['telemetry']?.[_0x4a0c7b(0x17e)](_0x4a0c7b(0x17a),_0x57c871);_0x34317f&&console[_0x4a0c7b(0x1b8)](_0x1bef9e[_0x4a0c7b(0x21f)]);_0x111476=await _0x1bef9e['auiRK'](launchBrowserServer,{'headless':!_0x34317f}),_0xc71902=await _0x1bef9e[_0x4a0c7b(0x198)](createTunnelSession,_0x4e2ad2);const _0x1ed6b7=await requireToken();_0x5db885=await _0x1bef9e['BJKnS'](createTunnelBridge,{'localWsUrl':_0x111476['wsEndpoint'],'tunnelServerUrl':_0xc71902[_0x4a0c7b(0x161)],'sessionId':_0xc71902['sessionId'],'apiKey':_0x1ed6b7,'onError':_0x44cf32=>{_0x1e59f5=_0x44cf32;},'onClose':()=>{const _0x469245=_0x4a0c7b;_0x1e59f5??=new Error(_0x469245(0x1e3)+_0x3106c1);},'onEvent':_0x36a179=>trackBridgeEvent(_0x4c4220['telemetry'],_0x36a179)}),_0x4c4220[_0x4a0c7b(0x17c)]?.['trackPhaseEnd']('tunnel_login_setup',{..._0x57c871,'tunnelSessionId':_0xc71902['sessionId'],'localBrowserServer':!![],'localBrowserServerHeaded':_0x34317f}),_0x21d418=!![];try{return _0x4c4220['telemetry']?.['trackPhaseStart']('tunnel_login_request',{..._0x57c871,'tunnelSessionId':_0xc71902['sessionId']}),await _0x1bef9e[_0x4a0c7b(0x1f2)](serverSideLogin,_0x3106c1,{'force':_0x4c4220[_0x4a0c7b(0x1d2)],'targetUrl':_0x4e2ad2,'env':_0x4c4220['env'],'tunnel':{'sessionId':_0xc71902[_0x4a0c7b(0x1f4)],'pwEndpoint':_0xc71902['pwEndpoint']}})['then'](_0x4268b5=>{const _0x246cf5=_0x4a0c7b;return _0x4c4220['telemetry']?.[_0x246cf5(0x1b1)](_0x1bef9e[_0x246cf5(0x188)],{..._0x57c871,'tunnelSessionId':_0xc71902?.[_0x246cf5(0x1f4)],'loginStatus':_0x4268b5[_0x246cf5(0x1a2)],'hasSessionState':_0x1bef9e['sQcJX'](Boolean,_0x4268b5['session_state']),'hasTestOutput':Boolean(_0x4268b5['test_output']),'bridgeError':errorMessageForTelemetry(_0x1e59f5)}),_0x4268b5;});}catch(_0x3c6682){await _0x4c4220['telemetry']?.[_0x4a0c7b(0x169)]('tunnel_login_request',_0x1bef9e['rBCyA'](_0x1e59f5,_0x3c6682),{..._0x57c871,'tunnelSessionId':_0xc71902['sessionId'],'bridgeError':errorMessageForTelemetry(_0x1e59f5)});throw _0x1bef9e[_0x4a0c7b(0x1f5)](_0x1e59f5,_0x3c6682);}}catch(_0x4f47be){!_0x21d418&&await _0x4c4220['telemetry']?.['trackPhaseError'](_0x4a0c7b(0x17a),_0x4f47be,{..._0x57c871,'tunnelSessionId':_0xc71902?.['sessionId']});throw _0x4f47be;}finally{if(_0x1bef9e['tzKfm'](_0xc71902,_0x111476)||_0x5db885){const _0x5967bf=_0x4a0c7b(0x20a)['split']('|');let _0x531aa5=0x0;while(!![]){switch(_0x5967bf[_0x531aa5++]){case'0':_0x5db885?.['close']();continue;case'1':_0xc71902&&await _0x1bef9e[_0x4a0c7b(0x1c3)](deleteTunnelSession,_0xc71902['sessionId'])[_0x4a0c7b(0x183)](()=>{});continue;case'2':_0x111476&&await _0x111476['close']()['catch'](()=>{});continue;case'3':_0x4c4220['telemetry']?.['trackPhaseEnd'](_0x1bef9e['IOqbo'],{..._0x57c871,'tunnelSessionId':_0xc71902?.['sessionId']});continue;case'4':_0x4c4220[_0x4a0c7b(0x17c)]?.['trackPhaseStart']('tunnel_login_cleanup',{..._0x57c871,'tunnelSessionId':_0xc71902?.['sessionId']});continue;}break;}}}}export async function manualBrowserLogin(_0x4a57c8,_0xe202d6,_0x471442={}){const _0x908256=_0x128150,_0x5c28d8={'ULZPJ':function(_0x1de4a4){return _0x1de4a4();},'stApr':'close','cHHkG':function(_0x27e367,_0x4c9ebb){return _0x27e367+_0x4c9ebb;},'UxICH':_0x908256(0x1d9),'LCRXP':function(_0x3dbe1b,_0x5edeec){return _0x3dbe1b(_0x5edeec);},'vqITV':function(_0x3da7c2,_0x237147){return _0x3da7c2&&_0x237147;}};if(!isInteractive())throw new Error(_0x5c28d8['cHHkG']('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x4a57c8['name']+_0x908256(0x1ab)+'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20',_0x908256(0x209)));const _0x3de1f9=_0xe202d6&&_0xe202d6['domains'][_0x908256(0x181)]>0x0?_0xe202d6[_0x908256(0x1bc)][0x0]:'about:blank';console['log'](_0x908256(0x1bf)),console['log'](_0x5c28d8['UxICH']),await new Promise(_0x21c920=>setTimeout(_0x21c920,0x7d0));const _0x1d7282=await chromium['launch']({'headless':![]});let _0x408318=null;try{const _0x2a6a5f={'ignoreHTTPSErrors':!![]};_0xe202d6?.[_0x908256(0x1fe)]&&(_0x2a6a5f['extraHTTPHeaders']=_0xe202d6[_0x908256(0x1fe)]);const _0x4cd855=await _0x1d7282[_0x908256(0x1c5)](_0x2a6a5f);await _0x5c28d8[_0x908256(0x1b2)](addProfileSetupBanner,_0x4cd855);const _0x3f0c80=await _0x4cd855[_0x908256(0x21c)]();await _0x3f0c80['goto'](_0x3de1f9);let _0x401818=![];await new Promise(_0x468106=>{const _0x1469a4={'UBJpH':function(_0x27208f){return _0x27208f();},'zHDAY':function(_0xf740fc){return _0x5c28d8['ULZPJ'](_0xf740fc);}},_0x4dc606=setTimeout(()=>{const _0x34d31f=_0x58e3;_0x401818=!![],console[_0x34d31f(0x195)](_0x34d31f(0x1a3)+MANUAL_LOGIN_TIMEOUT_MS/0xea60+_0x34d31f(0x20f)),_0x1469a4['UBJpH'](_0x468106);},MANUAL_LOGIN_TIMEOUT_MS);_0x3f0c80['on'](_0x5c28d8['stApr'],async()=>{const _0x3824dd=_0x58e3;clearTimeout(_0x4dc606);try{const _0x63a573=await _0x4cd855[_0x3824dd(0x20e)]();_0x408318=_0x63a573;}catch{}_0x1469a4['zHDAY'](_0x468106);});});if(_0x5c28d8[_0x908256(0x1a6)](_0x401818,!_0x408318))throw new Error('Browser\x20login\x20timed\x20out\x20before\x20completion.');}finally{await _0x1d7282['close']()[_0x908256(0x183)](()=>{});}if(!_0x408318)throw new Error(_0x908256(0x16d));return _0x471442[_0x908256(0x1f3)]!==![]&&await apiRequest(_0x908256(0x1c2)+encodeURIComponent(_0x4a57c8['name'])+'/session',{'method':_0x908256(0x1a0),'body':JSON['stringify']({'session_state':_0x408318,'updated_by':'cli:manual-login'})}),{'sessionState':_0x408318};}export async function promptSaveCredentials(_0x3ced73){const _0x3821fb=_0x128150,_0x43f7b2={'oKTpq':function(_0x4f8a1b,_0x5b9d46){return _0x4f8a1b||_0x5b9d46;},'OECpQ':_0x3821fb(0x204),'NQmYQ':function(_0x345135,_0x35fb54,_0x309be6){return _0x345135(_0x35fb54,_0x309be6);},'EeNoT':_0x3821fb(0x1a5),'ELsKB':'\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.'},_0xf41663=process[_0x3821fb(0x1d0)]['RANGER_TEST_USERNAME'],_0x185652=process[_0x3821fb(0x1d0)]['RANGER_TEST_PASSWORD'];if(_0x43f7b2[_0x3821fb(0x1ee)](!_0xf41663,!_0x185652))return;if(!isInteractive())return;const {save:_0x32c9ba}=await _0x329f71[_0x3821fb(0x18c)]([{'type':'confirm','name':_0x3821fb(0x16a),'message':_0x43f7b2[_0x3821fb(0x19d)],'default':![]}]);if(!_0x32c9ba)return;await _0x43f7b2[_0x3821fb(0x202)](apiRequest,_0x3821fb(0x1c2)+encodeURIComponent(_0x3ced73),{'method':_0x43f7b2['EeNoT'],'body':JSON['stringify']({'username':_0xf41663,'password':_0x185652})}),console['log'](_0x43f7b2['ELsKB']);}export async function resolveCloudProfileSession(_0x2c1145,_0x10637f={}){const _0x233ec7=_0x128150,_0x451cc6={'QnsQE':function(_0x550bf8,_0x2c5876,_0x993004){return _0x550bf8(_0x2c5876,_0x993004);},'XQRad':function(_0x36d45e,_0x3fb176){return _0x36d45e||_0x3fb176;},'lyrOk':function(_0x50e97a,_0x3d7db1){return _0x50e97a(_0x3d7db1);},'GpaHa':function(_0x313ae1,_0x4e5f54,_0x4b7642,_0x1bd2ce,_0x462ed5,_0x49fd6c){return _0x313ae1(_0x4e5f54,_0x4b7642,_0x1bd2ce,_0x462ed5,_0x49fd6c);},'VAatE':function(_0x5738d3,_0x220969,_0x2de22c,_0xc7c65b,_0x5f56e0){return _0x5738d3(_0x220969,_0x2de22c,_0xc7c65b,_0x5f56e0);},'cMMYL':function(_0x44f433,_0x5570e8,_0x2bf4eb){return _0x44f433(_0x5570e8,_0x2bf4eb);},'ZiDnd':function(_0x329c3e,_0x4515de){return _0x329c3e(_0x4515de);},'cslXs':function(_0xd29e4,_0x49e779){return _0xd29e4(_0x49e779);},'yOaua':function(_0x294900,_0x55d445){return _0x294900(_0x55d445);},'irjPD':function(_0x51bb69,_0x567c79,_0x9dff0d,_0x4f9410){return _0x51bb69(_0x567c79,_0x9dff0d,_0x4f9410);},'fKpda':_0x233ec7(0x18a),'oqrfv':_0x233ec7(0x200),'pLOpK':function(_0x45f7a8,_0x1bfb3a){return _0x45f7a8&&_0x1bfb3a;},'XcrSu':function(_0x2be434,_0x507b4a){return _0x2be434(_0x507b4a);},'EzDJj':'\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','jUZMl':_0x233ec7(0x1cd),'xBtJZ':function(_0x5c064d,_0x2c080a){return _0x5c064d instanceof _0x2c080a;},'HtBsr':function(_0x1f3433){return _0x1f3433();},'rtzLx':function(_0x38e471,_0x332dfc){return _0x38e471+_0x332dfc;},'UaYHC':function(_0x1d4368,_0x4820dd){return _0x1d4368+_0x4820dd;},'iMSfX':_0x233ec7(0x196),'HDkaq':function(_0x338e37,_0x5876bd,_0x522e1d,_0x810a63,_0x844e52,_0x3e15d3,_0x18b161,_0x1dfe56){return _0x338e37(_0x5876bd,_0x522e1d,_0x810a63,_0x844e52,_0x3e15d3,_0x18b161,_0x1dfe56);}},_0x1b3a4e=_0x2c1145[_0x233ec7(0x20d)]??{},_0x412462=await fetchAuthConfig(),_0xbf54f6=_0x412462?_0x451cc6[_0x233ec7(0x17d)](resolveAuthEnvironmentLocally,_0x412462,_0x10637f[_0x233ec7(0x1ea)]??_0x2c1145[_0x233ec7(0x214)]):null,_0x2f4810=typeof _0xbf54f6?.[_0x233ec7(0x17f)]===_0x233ec7(0x18b)&&_0xbf54f6[_0x233ec7(0x17f)]['trim']()?_0xbf54f6[_0x233ec7(0x17f)]:undefined,_0x556363=typeof _0x1b3a4e[_0x233ec7(0x17f)]===_0x233ec7(0x18b)&&_0x1b3a4e[_0x233ec7(0x17f)]['trim']()?_0x1b3a4e['loginInstructions']:undefined,_0x188bbb=_0x451cc6[_0x233ec7(0x218)](_0x556363,!_0x2f4810)?_0x1b3a4e:{..._0x1b3a4e,'loginInstructions':_0x2f4810},_0x587010=_0x451cc6[_0x233ec7(0x216)](Boolean,_0x188bbb['loginInstructions']?.[_0x233ec7(0x213)]()),_0x32f896=Boolean(_0x1b3a4e['forceLogin']||_0xbf54f6?.['forceLogin']),_0xe6db56=_0xbf54f6?.[_0x233ec7(0x1bc)],_0x4acd87=_0x1b3a4e['setupHeaders'],_0x4325ac=_0x4acd87??_0xbf54f6?.[_0x233ec7(0x1fe)],_0x54072f=_0x10637f['effectiveBaseUrl']??_0x1b3a4e[_0x233ec7(0x18f)]??(_0xe6db56&&_0xe6db56['length']>0x0?_0xe6db56[0x0]:''),_0x21a66c=_0x54072f?needsTunnel(_0x54072f):![],_0x4dce12={'invalidateOn':_0xbf54f6?.['invalidateOn'],'userAgent':_0xbf54f6?.[_0x233ec7(0x1e2)]?.[_0x233ec7(0x1a9)]??_0x1b3a4e['userAgent']};_0x32f896&&console[_0x233ec7(0x1b8)](_0x233ec7(0x173)+_0x2c1145['name']+'\x22,\x20refreshing\x20session...');if(!_0x32f896){const _0x60a9e4=await _0x451cc6[_0x233ec7(0x1c4)](checkLocalCache,_0x2c1145['name'],_0x2c1145['organizationId'],_0x54072f,_0x4325ac,_0x4dce12);if(_0x60a9e4){if(_0x54072f&&!_0x21a66c){const _0x30352f=await _0x451cc6[_0x233ec7(0x1f6)](isCachedSessionLive,_0x60a9e4['storageStatePath'],_0x54072f,{'sessionCheckPath':_0xbf54f6?.[_0x233ec7(0x1e6)],'setupHeaders':_0x4325ac},{'launchBrowser':launchRealBrowser});if(_0x30352f)return console['log'](_0x233ec7(0x189)+_0x2c1145[_0x233ec7(0x19b)]+'\x22'),{'authPath':_0x60a9e4['storageStatePath'],'settings':_0x188bbb,'resolvedEnv':_0xbf54f6};console[_0x233ec7(0x1b8)](_0x233ec7(0x21a)+_0x2c1145['name']+'\x22\x20failed\x20validation\x20—\x20refreshing...'),_0x451cc6['cMMYL'](emitSessionValidationHint,_0x54072f,_0xbf54f6);}else return _0x21a66c&&console[_0x233ec7(0x1b8)](_0x233ec7(0x1fb)+_0x2c1145['name']+'\x22'),{'authPath':_0x60a9e4['storageStatePath'],'settings':_0x188bbb,'resolvedEnv':_0xbf54f6};}}if(!_0x32f896&&_0x2c1145[_0x233ec7(0x178)]){const _0x4650f1=await writeSessionToLocalCache(_0x2c1145[_0x233ec7(0x19b)],_0x2c1145[_0x233ec7(0x215)],_0x54072f,_0x4325ac,_0x2c1145['sessionState'],_0xe6db56,_0x4dce12);if(_0x54072f){const _0x1599b4=await isCachedSessionLive(_0x4650f1,_0x54072f,{'sessionCheckPath':_0xbf54f6?.['sessionCheckPath'],'setupHeaders':_0x4325ac},{'launchBrowser':launchRealBrowser});if(_0x1599b4)return console[_0x233ec7(0x1b8)]('\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22'+_0x2c1145['name']+'\x22,\x20cached\x20locally'),{'authPath':_0x4650f1,'settings':_0x188bbb,'resolvedEnv':_0xbf54f6};console['log'](_0x233ec7(0x1cc)+_0x2c1145[_0x233ec7(0x19b)]+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),_0x451cc6[_0x233ec7(0x17d)](emitSessionValidationHint,_0x54072f,_0xbf54f6);}else return{'authPath':_0x4650f1,'settings':_0x188bbb,'resolvedEnv':_0xbf54f6};}if(_0x587010)return console['log'](_0x233ec7(0x1d3)+_0x2c1145['name']+_0x233ec7(0x1ca)),{'authPath':undefined,'settings':_0x188bbb,'resolvedEnv':_0xbf54f6};console[_0x233ec7(0x1b8)](_0x233ec7(0x1d3)+_0x2c1145[_0x233ec7(0x19b)]+'\x22,\x20attempting\x20login...');const _0x3ff539=_0x451cc6['ZiDnd'](Boolean,process[_0x233ec7(0x1d0)][_0x233ec7(0x1c6)])&&Boolean(process['env']['RANGER_TEST_PASSWORD']),_0x25975b=Boolean(_0x2c1145['username']),_0x145526=_0x451cc6['cslXs'](Boolean,_0x10637f['assertedEnv']),_0x267ff5=_0x54072f?_0x451cc6[_0x233ec7(0x1e5)](isBareLocalhost,_0x54072f):![],_0x1f0c6b=(_0x3ff539||_0x25975b)&&(!_0x267ff5||_0x145526);if(_0x1f0c6b)try{const _0x40ce72=_0x54072f?await _0x451cc6[_0x233ec7(0x1c9)](serverSideLoginWithOptionalTunnel,_0x2c1145['name'],_0x54072f,{'force':_0x32f896,'telemetry':_0x10637f['telemetry'],'env':_0x10637f[_0x233ec7(0x1ea)]}):await serverSideLogin(_0x2c1145[_0x233ec7(0x19b)],{'force':_0x32f896,'env':_0x10637f['assertedEnv']});if(_0x40ce72[_0x233ec7(0x1a2)]===_0x233ec7(0x1ce))console['log']('\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...');else{if(_0x40ce72['status']===_0x451cc6[_0x233ec7(0x1c8)]&&_0x40ce72['session_state']){console['log'](_0x451cc6['oqrfv']);const _0x2fd663=await writeSessionToLocalCache(_0x2c1145[_0x233ec7(0x19b)],_0x2c1145['organizationId'],_0x54072f,_0x4325ac,_0x40ce72['session_state'],_0xe6db56,_0x4dce12);return _0x451cc6['pLOpK'](_0x3ff539,!_0x25975b)&&await _0x451cc6['XcrSu'](promptSaveCredentials,_0x2c1145['name']),{'authPath':_0x2fd663,'settings':_0x188bbb,'resolvedEnv':_0xbf54f6};}else _0x40ce72['test_output']&&(console['log'](_0x451cc6['EzDJj']),console['log'](_0x40ce72[_0x233ec7(0x1b6)])),console[_0x233ec7(0x1b8)](_0x451cc6['jUZMl']);}}catch(_0x4e289d){console['log'](_0x233ec7(0x1aa)+(_0x451cc6['xBtJZ'](_0x4e289d,Error)?_0x4e289d['message']:String(_0x4e289d))),console['log'](_0x451cc6[_0x233ec7(0x171)]);}if(_0x451cc6[_0x233ec7(0x1ad)](_0x267ff5,!_0x145526)&&!_0x451cc6[_0x233ec7(0x211)](isInteractive))throw new Error(_0x451cc6[_0x233ec7(0x1b3)](_0x451cc6['UaYHC']('No\x20saved\x20session\x20for\x20\x22'+_0x54072f+_0x233ec7(0x1a1)+_0x2c1145[_0x233ec7(0x19b)]+'\x22,\x20and\x20cloud\x20sessions\x20don\x27t\x20apply\x20to\x20localhost.\x0a','\x20\x20•\x20capture\x20one\x20(a\x20browser\x20opens):\x20ranger\x20profile\x20add\x20'+_0x2c1145[_0x233ec7(0x19b)]+'\x20--url\x20'+_0x54072f+'\x0a'),_0x451cc6[_0x233ec7(0x16e)]));const _0x303ce6=_0xbf54f6?{..._0xbf54f6,'domains':orderLoginDomains(_0x54072f,_0xbf54f6[_0x233ec7(0x1bc)]),'setupHeaders':_0x4325ac}:_0x54072f?{'key':_0x2c1145['environmentKey']??'','domains':[_0x54072f],'setupHeaders':_0x4325ac}:null,{sessionState:_0x5e7f7d}=await _0x451cc6[_0x233ec7(0x1c9)](manualBrowserLogin,_0x2c1145,_0x303ce6,{'persistSessionState':!_0x21a66c}),_0x398075=await _0x451cc6['HDkaq'](writeSessionToLocalCache,_0x2c1145['name'],_0x2c1145['organizationId'],_0x54072f,_0x4325ac,_0x5e7f7d,_0xe6db56,_0x4dce12);return{'authPath':_0x398075,'settings':_0x188bbb,'resolvedEnv':_0xbf54f6};}
|
|
1
|
+
const _0x25ed96=_0xdb1b;(function(_0x798f6f,_0xbfc016){const _0x1ce422=_0xdb1b,_0x516fc7=_0x798f6f();while(!![]){try{const _0x51b9cc=parseInt(_0x1ce422(0x1bb))/0x1+parseInt(_0x1ce422(0x1ee))/0x2+-parseInt(_0x1ce422(0x188))/0x3*(parseInt(_0x1ce422(0x1fe))/0x4)+-parseInt(_0x1ce422(0x192))/0x5*(-parseInt(_0x1ce422(0x1c6))/0x6)+-parseInt(_0x1ce422(0x1aa))/0x7+parseInt(_0x1ce422(0x1e7))/0x8*(parseInt(_0x1ce422(0x1b8))/0x9)+-parseInt(_0x1ce422(0x1ff))/0xa;if(_0x51b9cc===_0xbfc016)break;else _0x516fc7['push'](_0x516fc7['shift']());}catch(_0xb237cb){_0x516fc7['push'](_0x516fc7['shift']());}}}(_0xa0f0,0xec11d));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x226ce7 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,isBareLocalhost,isCachedSessionLive,isInteractive,needsTunnel,orderLoginDomains,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{matchAuthEnvironmentByHost,matchAuthEnvironmentExact}from'./matchAuthEnvironment.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';function targetHostForTelemetry(_0x93010a){const _0x4b7259=_0xdb1b;try{return new URL(_0x93010a)[_0x4b7259(0x184)];}catch{return _0x4b7259(0x1b4);}}function errorMessageForTelemetry(_0x1d16f2){const _0x20037f=_0xdb1b,_0x56855e={'ZgwII':function(_0x319d3c,_0x46d946){return _0x319d3c instanceof _0x46d946;}};return _0x56855e['ZgwII'](_0x1d16f2,Error)?_0x1d16f2[_0x20037f(0x196)]:undefined;}function trackBridgeEvent(_0x22bbbb,_0x3d7ba7){const _0x16d40e=_0xdb1b,_0x4f0b1b={'wonEv':'tunnel_bridge_event','BZihN':function(_0x3be5eb,_0x596592){return _0x3be5eb===_0x596592;},'IrgCD':'tunnel_error','ClgyF':'local_ws_error'};if(!_0x22bbbb)return;const _0x275220={'tunnelSessionId':_0x3d7ba7['sessionId'],'tunnelEventType':_0x3d7ba7['type'],'connectionId':_0x3d7ba7['connectionId'],'code':_0x3d7ba7['code'],'reason':_0x3d7ba7['reason'],'error':_0x3d7ba7[_0x16d40e(0x21a)],'elapsedMs':_0x3d7ba7[_0x16d40e(0x175)],'activeLocalConnections':_0x3d7ba7['activeLocalConnections'],'pendingLocalConnections':_0x3d7ba7[_0x16d40e(0x18e)]};_0x22bbbb[_0x16d40e(0x1da)](_0x4f0b1b['wonEv'],_0x275220),(_0x4f0b1b[_0x16d40e(0x165)](_0x3d7ba7[_0x16d40e(0x17b)],_0x4f0b1b[_0x16d40e(0x16a)])||_0x4f0b1b['BZihN'](_0x3d7ba7[_0x16d40e(0x17b)],_0x4f0b1b[_0x16d40e(0x1e5)]))&&void _0x22bbbb[_0x16d40e(0x214)]('tunnel_bridge',new Error(_0x3d7ba7['error']??_0x3d7ba7[_0x16d40e(0x17b)]),_0x275220);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x59618d=await getToken();if(!_0x59618d)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');return _0x59618d;}async function apiRequest(_0x45924d,_0x18e67e={}){const _0x663edd=_0xdb1b,_0x2a0329={'eRwOL':function(_0x5a6749){return _0x5a6749();},'ozmxI':function(_0x4429e2,_0x3d1fd9,_0x358fed){return _0x4429e2(_0x3d1fd9,_0x358fed);},'chhYe':function(_0x1883d9,_0x3cff81){return _0x1883d9===_0x3cff81;},'URTcs':'string'},_0xb3e008=await _0x2a0329['eRwOL'](requireToken),_0x44e4ce=getApiBaseUrl(),_0x2d5793=await _0x2a0329[_0x663edd(0x1c7)](fetch,''+_0x44e4ce+_0x45924d,{..._0x18e67e,'headers':{'Authorization':_0x663edd(0x166)+_0xb3e008,'Content-Type':_0x663edd(0x16e),..._0x18e67e[_0x663edd(0x19f)]??{}}});if(!_0x2d5793['ok']){let _0x21d069='',_0x49f3ae;try{const _0x4599d6=await _0x2d5793[_0x663edd(0x1f6)](),_0x134a6f=(_0x2a0329[_0x663edd(0x1c5)](typeof _0x4599d6['error'],_0x663edd(0x1ca))?_0x4599d6[_0x663edd(0x21a)]:undefined)??JSON['stringify'](_0x4599d6);_0x21d069=_0x134a6f;typeof _0x4599d6[_0x663edd(0x1c2)]===_0x2a0329['URTcs']&&_0x4599d6[_0x663edd(0x1c2)]&&(_0x21d069=_0x21d069+'\x0a'+_0x4599d6[_0x663edd(0x1c2)]);if(_0x2a0329['chhYe'](typeof _0x4599d6[_0x663edd(0x1b0)],'string'))_0x49f3ae=_0x4599d6[_0x663edd(0x1b0)];}catch{_0x21d069=_0x2d5793[_0x663edd(0x170)];}throw new ApiError('API\x20request\x20'+_0x45924d+_0x663edd(0x190)+_0x2d5793[_0x663edd(0x17a)]+'):\x20'+_0x21d069,_0x2d5793[_0x663edd(0x17a)],_0x21d069,_0x49f3ae);}if(_0x2d5793[_0x663edd(0x17a)]===0xcc)return undefined;return _0x2d5793['json']();}export class ApiError extends Error{['status'];['detail'];[_0x25ed96(0x1b0)];constructor(_0x486244,_0x8239fe,_0xb70317,_0xe93b9b){const _0x5ba6bb=_0x25ed96,_0x1f25ac={'YQtXB':_0x5ba6bb(0x174)};super(_0x486244),this[_0x5ba6bb(0x17a)]=_0x8239fe,this['detail']=_0xb70317,this[_0x5ba6bb(0x1b0)]=_0xe93b9b,this[_0x5ba6bb(0x1a3)]=_0x1f25ac['YQtXB'];}}export async function fetchCloudProfile(_0x330146){const _0x2f869e=_0x25ed96,_0x3527ae={'UnOgg':function(_0x41df68,_0x3c87f3){return _0x41df68 instanceof _0x3c87f3;},'bJmWU':function(_0x5d1ce0,_0x7ac9cf){return _0x5d1ce0===_0x7ac9cf;}};try{return await apiRequest(_0x2f869e(0x1f5)+encodeURIComponent(_0x330146));}catch(_0x5accf9){if(_0x3527ae[_0x2f869e(0x1d9)](_0x5accf9,ApiError)&&_0x3527ae[_0x2f869e(0x168)](_0x5accf9['status'],0x194))return null;throw _0x5accf9;}}export async function listCloudProfiles(){const _0x21631b=_0x25ed96,_0x353219={'bdgnK':'/api/v1/profiles'},_0x24db0a=await apiRequest(_0x353219['bdgnK']);return _0x24db0a[_0x21631b(0x1d6)];}export async function deleteCloudProfile(_0x98610b){const _0x25bf25=_0x25ed96;try{await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x98610b),{'method':'DELETE'});}catch(_0x4900cc){if(_0x4900cc instanceof ApiError&&_0x4900cc[_0x25bf25(0x17a)]===0x194)throw new Error(_0x25bf25(0x221)+_0x98610b+'\x22\x20not\x20found.');throw _0x4900cc;}}function _0xa0f0(){const _0x32d51b=['/login','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>`.','PWPql','storageStatePath','profiles','fHmRX','Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20(','UnOgg','trackPhaseEnd','Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20(','tunnel_login_request','join','\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20','environment_key','wsEndpoint','\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22','extraHTTPHeaders','organizationId','jicvZ','ClgyF','\x20\x20-\x20pass\x20`--env\x20<key>`\x20to\x20pick\x20the\x20auth\x20environment\x20by\x20name,\x20or\x0a','514328PKsSOH','\x22\x20on\x20profile\x20\x22','PNYWV','map','\x22,\x20and\x20cloud\x20sessions\x20don\x27t\x20apply\x20to\x20localhost.\x0a','invalidateOn','envKey','998270FpKTCL','SfPfg','replace','DELETE','loginInstructions','\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a','QYaWl','/api/v1/profiles/','json','setupHeaders','\x22,\x20attempting\x20login...','sessionId','stringify','\x22,\x20refreshing\x20session...','domains','\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','116HoEbra','5796550tUOTLB','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','newPage','close','ZWQlx','\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20','env','session_state','JfhvB','whskW','kLjxP','\x22\x20matched\x20by\x20host\x20for\x20','ABilH','storageState','YrNqK','browserOptions','success','JKgvX','omPQX','qwEBx','RANGER_TEST_PASSWORD','trackPhaseError','sKsFo','No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','wvYVR','tunnel','error','keys','THitF','opfyK','length','xKPoZ','environmentKey','Cloud\x20profile\x20\x22','sessionCheckPath','Edxdi','auth','/api/v1/profiles','forceLogin','vBKqK','BZihN','Bearer\x20','COuTq','bJmWU','tunnel_session_id','IrgCD','FhCUJ','MkTwG','effectiveBaseUrl','application/json','\x20\x20Login\x20successful.\x20Session\x20cached.','statusText','RANGER_TUNNEL_LOGIN_HEADED','log','isArray','ApiError','elapsedMs','Browser\x20login\x20timed\x20out\x20before\x20completion.','RANGER_TEST_USERNAME','YWemU','GFGzp','status','type','\x22\x20failed\x20validation\x20—\x20re-login\x20needed...','WRPwW','FvZjx','RxAiB','Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20','origin','EfVYm','gRknK','host','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','push','force','173427tBpnNG','/api/v1/profiles/auth-config','\x20\x20•\x20or\x20pass\x20--env\x20<key>\x20to\x20run\x20an\x20automated\x20login\x20for\x20this\x20target.','\x22\x20instead.','Tvifg','tOFCB','pendingLocalConnections','trim','\x20failed\x20(','mcXry','25dIHWvo','settings','trackPhaseStart','none','message','ambiguous','clientIp','\x20\x20Created\x20cloud\x20profile\x20\x22','/session','WmRxp','\x20\x20Server-side\x20login\x20error:\x20','newContext','Browser\x20login\x20timed\x20out\x20after\x20','headers','maXfT','target_url','\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20','name','userAgent','pNWWK','cookies','\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','assertedEnv','\x22;\x20proceeding\x20with\x20loginInstructions.','9821427hfLGat','true','environments','\x20--url\x20','OtQfG','oXZkv','code','RQMZC','NiXEb','parse','invalid-url','sessionState','SqUbD','\x22.\x0a','72QnppYL','utf-8','POST','1708185hzBrJT','key','\x20\x20Cached\x20session\x20for\x20\x22','telemetry','username','KhAzu','\x20\x20No\x20live\x20session\x20for\x20\x22','test_output','\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)','Auth\x20environment\x20\x22','chhYe','2285364SUdSmt','ozmxI','pw_endpoint','\x20\x20-\x20ask\x20your\x20Ranger\x20admin\x20to\x20add\x20\x22','string','defaultEnvironmentKey','ZElnw','/api/v1/tunnel/sessions/','MTObm','\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.','TpHSd','HLGOs'];_0xa0f0=function(){return _0x32d51b;};return _0xa0f0();}export async function createCloudProfile(_0x31293c,_0xbd48f2,_0x59d21d={}){const _0x484f02=_0x25ed96,_0x61197a={'yRphM':function(_0x535625,_0x2e5711,_0x1692e7){return _0x535625(_0x2e5711,_0x1692e7);}},_0x42eb35={'name':_0x31293c};if(_0xbd48f2)_0x42eb35[_0x484f02(0x1df)]=_0xbd48f2;_0x59d21d[_0x484f02(0x193)]&&Object[_0x484f02(0x21b)](_0x59d21d[_0x484f02(0x193)])['length']>0x0&&(_0x42eb35['settings']=_0x59d21d['settings']);if(_0x59d21d['username'])_0x42eb35['username']=_0x59d21d['username'];if(_0x59d21d['password'])_0x42eb35['password']=_0x59d21d['password'];return await _0x61197a['yRphM'](apiRequest,_0x484f02(0x162),{'method':'POST','body':JSON[_0x484f02(0x1fa)](_0x42eb35)});}export async function uploadCloudProfileSession(_0x1f99b9,_0x1a6f6d){const _0x42e3a9=_0x25ed96,_0x3bb642={'QYaWl':function(_0x19ff56,_0xabd062,_0x247e74){return _0x19ff56(_0xabd062,_0x247e74);},'omPQX':function(_0x34b9b5,_0xefcea5){return _0x34b9b5(_0xefcea5);}};return await _0x3bb642[_0x42e3a9(0x1f4)](apiRequest,'/api/v1/profiles/'+_0x3bb642[_0x42e3a9(0x211)](encodeURIComponent,_0x1f99b9)+_0x42e3a9(0x19a),{'method':'POST','body':JSON[_0x42e3a9(0x1fa)]({'session_state':_0x1a6f6d})});}export async function saveCloudProfileCredentials(_0x2fd36d,_0x32c198,_0xb3ac10){const _0x114d60={'cDITo':function(_0x49f149,_0x125a3b,_0x3a0707){return _0x49f149(_0x125a3b,_0x3a0707);},'UaoVV':function(_0x2a59c3,_0x25a720){return _0x2a59c3(_0x25a720);}};await _0x114d60['cDITo'](apiRequest,'/api/v1/profiles/'+_0x114d60['UaoVV'](encodeURIComponent,_0x2fd36d),{'method':'PUT','body':JSON['stringify']({'username':_0x32c198,'password':_0xb3ac10})});}export async function fetchAuthConfig(){const _0x219cc1=_0x25ed96,_0x19c58c={'IdSVf':function(_0x41eb8b,_0x1b53b6){return _0x41eb8b instanceof _0x1b53b6;}};try{const _0x21d146=await apiRequest(_0x219cc1(0x189));return _0x21d146['auth_config'];}catch(_0x49a49b){return _0x19c58c['IdSVf'](_0x49a49b,ApiError)&&_0x49a49b['status']!==0x194&&console['error'](_0x219cc1(0x1de)+_0x49a49b['message']),null;}}function _0xdb1b(_0x441673,_0x15cf64){_0x441673=_0x441673-0x162;const _0xa0f059=_0xa0f0();let _0xdb1b03=_0xa0f059[_0x441673];return _0xdb1b03;}async function createTunnelSession(_0x1c19f9){const _0x4fdff1=_0x25ed96,_0x55595a={'FuVGf':function(_0x194bf6,_0x3a51ee,_0x2bcfd6){return _0x194bf6(_0x3a51ee,_0x2bcfd6);},'MkTwG':'agent'};return await _0x55595a['FuVGf'](apiRequest,'/api/v1/tunnel/sessions',{'method':_0x4fdff1(0x1ba),'body':JSON['stringify']({'targetUrl':_0x1c19f9,'mode':_0x55595a[_0x4fdff1(0x16c)]})});}async function deleteTunnelSession(_0x1b9e61){const _0x3bcd34=_0x25ed96,_0x558b62={'SqUbD':_0x3bcd34(0x1f1)};await apiRequest(_0x3bcd34(0x1cd)+_0x1b9e61,{'method':_0x558b62[_0x3bcd34(0x1b6)]});}export function pickAdHocEnvKey(_0x439fb8,_0x1d3057,_0x1067af){const _0x3419ca=_0x25ed96,_0x18c7bc={'nHRMN':function(_0x229ada,_0x3e10eb){return _0x229ada+_0x3e10eb;},'HLGOs':function(_0x514af3,_0x13a337){return _0x514af3+_0x13a337;},'YWemU':function(_0x4e9320,_0x21185e,_0x62bcad){return _0x4e9320(_0x21185e,_0x62bcad);},'maXfT':function(_0x3ddfd3,_0x39a7f7){return _0x3ddfd3 in _0x39a7f7;},'GVmMt':_0x3419ca(0x197),'EfVYm':function(_0x2e2b41,_0x3a39d5){return _0x2e2b41+_0x3a39d5;},'MTObm':function(_0x532ed3,_0x57923d){return _0x532ed3===_0x57923d;}};if(_0x1067af){if(!_0x439fb8?.[_0x3419ca(0x1ac)]?.[_0x1067af]){const _0x20cf76=Object[_0x3419ca(0x21b)](_0x439fb8?.[_0x3419ca(0x1ac)]??{});throw new Error(_0x18c7bc['nHRMN'](_0x18c7bc['HLGOs'](_0x3419ca(0x1c4)+_0x1067af+'\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.',_0x20cf76[_0x3419ca(0x21e)]?'\x20Available:\x20'+_0x20cf76[_0x3419ca(0x1dd)](',\x20')+'.':_0x3419ca(0x1cf)),_0x3419ca(0x1c3)));}return _0x1067af;}if(!_0x439fb8)return null;if(_0x1d3057){const _0x5971d7=_0x18c7bc[_0x3419ca(0x178)](matchAuthEnvironmentExact,_0x1d3057,_0x439fb8);if(_0x5971d7)return _0x5971d7;const _0x1dfdb8=matchAuthEnvironmentByHost(_0x1d3057,_0x439fb8);if(_0x1dfdb8&&_0x18c7bc[_0x3419ca(0x1a0)](_0x3419ca(0x1bc),_0x1dfdb8))return console[_0x3419ca(0x172)]('\x20\x20Auth\x20env\x20\x22'+_0x1dfdb8[_0x3419ca(0x1bc)]+_0x3419ca(0x20a)+_0x1d3057+'\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).'),_0x1dfdb8[_0x3419ca(0x1bc)];if(_0x1dfdb8&&_0x18c7bc[_0x3419ca(0x1a0)](_0x18c7bc['GVmMt'],_0x1dfdb8))throw new Error(_0x3419ca(0x1d8)+_0x1dfdb8[_0x3419ca(0x197)][_0x3419ca(0x1dd)](',\x20')+');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.');if(needsTunnel(_0x1d3057))throw new Error(_0x18c7bc[_0x3419ca(0x1d1)](_0x18c7bc['EfVYm'](_0x18c7bc[_0x3419ca(0x182)](_0x3419ca(0x216)+_0x1d3057+_0x3419ca(0x1b7),_0x3419ca(0x1f3)),'\x20\x20Options:\x0a')+_0x3419ca(0x1e6)+(_0x3419ca(0x1c9)+_0x1d3057[_0x3419ca(0x1f0)](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a'),_0x3419ca(0x1a2)+_0x1d3057+'\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.'));}if(_0x439fb8['defaultEnvironmentKey'])return _0x439fb8['defaultEnvironmentKey'];const _0x3368d1=Object[_0x3419ca(0x21b)](_0x439fb8['environments']??{});if(_0x3368d1[_0x3419ca(0x21e)]===0x1)return _0x3368d1[0x0];if(_0x18c7bc[_0x3419ca(0x1ce)](_0x3368d1[_0x3419ca(0x21e)],0x0))return null;throw new Error(_0x3419ca(0x1db)+_0x3368d1['join'](',\x20')+').\x20'+_0x3419ca(0x1d3));}export function adHocProfileName(_0x415cd4,_0x35b491,_0x1d113f){if(!_0x35b491||_0x35b491===_0x1d113f)return _0x415cd4;return _0x415cd4+':'+_0x35b491;}export async function resolveAdHocProfile(_0x55c466={},_0x3d5c20=process['env']){const _0x47cf9a=_0x25ed96,_0xb9ad8e={'xKPoZ':function(_0x21ac91,_0x1faf3c){return _0x21ac91&&_0x1faf3c;},'COuTq':_0x47cf9a(0x195),'kLjxP':function(_0x31579b,_0x4bb5be,_0xb877cf,_0x4dc878){return _0x31579b(_0x4bb5be,_0xb877cf,_0x4dc878);},'opfyK':function(_0x41cff0,_0xc34d9b){return _0x41cff0??_0xc34d9b;}},_0x3240c8=_0x3d5c20['RANGER_TEST_USERNAME'];if(!_0x3240c8)return null;const _0x1be6ec=await fetchAuthConfig(),_0x3b72f5=pickAdHocEnvKey(_0x1be6ec,_0x55c466['targetUrl'],_0x55c466[_0x47cf9a(0x1ed)]);let _0x551a58=adHocProfileName(_0x3240c8,_0x3b72f5,_0x1be6ec?.[_0x47cf9a(0x1cb)]),_0x3f02d8=await fetchCloudProfile(_0x551a58);_0xb9ad8e[_0x47cf9a(0x21f)](_0x3f02d8,_0x3b72f5)&&_0x3f02d8[_0x47cf9a(0x220)]!==_0x3b72f5&&(console[_0x47cf9a(0x172)]('\x20\x20Cloud\x20profile\x20\x22'+_0x551a58+'\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22'+(_0x3f02d8['environmentKey']??_0xb9ad8e[_0x47cf9a(0x167)])+'\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22'+_0x3b72f5+'\x22;\x20using\x20\x22'+_0x3240c8+':'+_0x3b72f5+_0x47cf9a(0x18b)),_0x551a58=_0x3240c8+':'+_0x3b72f5,_0x3f02d8=await fetchCloudProfile(_0x551a58));if(_0x3f02d8)return{'name':_0x3f02d8[_0x47cf9a(0x1a3)],'profile':_0x3f02d8};const _0x3100aa=_0x3d5c20['RANGER_TEST_PASSWORD'],_0x445336=await _0xb9ad8e[_0x47cf9a(0x209)](createCloudProfile,_0x551a58,_0xb9ad8e[_0x47cf9a(0x21d)](_0x3b72f5,undefined),{'username':_0x3240c8,'password':_0x3100aa});return console['log'](_0x47cf9a(0x199)+_0x445336[_0x47cf9a(0x1a3)]+'\x22\x20for\x20'+_0x3240c8+(_0x3b72f5?'\x20(auth\x20env:\x20'+_0x3b72f5+')':'')),{'name':_0x445336[_0x47cf9a(0x1a3)],'profile':_0x445336};}export async function writeSessionToLocalCache(_0x16a46e,_0x471448,_0x1f71dc,_0x580697,_0x5b1387,_0x21f84e,_0x2d2c74){const _0x500b03=_0x25ed96,_0x323b62={'THitF':function(_0x3ac85e,_0x2ecdcc){return _0x3ac85e(_0x2ecdcc);},'FvZjx':function(_0x210b0d,_0x572f00,_0x1e22d6){return _0x210b0d(_0x572f00,_0x1e22d6);},'ZElnw':_0x500b03(0x224),'fHmRX':function(_0xf2bbe1,_0x5dd5c8){return _0xf2bbe1(_0x5dd5c8);},'wvYVR':function(_0x2cdefd,_0x53062a){return _0x2cdefd>_0x53062a;},'vBKqK':function(_0x5c0143,_0x50e8e1,_0x57dd8b){return _0x5c0143(_0x50e8e1,_0x57dd8b);},'lWyIx':function(_0x3fef0d,_0x2c7806){return _0x3fef0d(_0x2c7806);}},_0xad280b=_0x323b62[_0x500b03(0x21c)](sessionCacheHash,{'orgId':_0x471448,'profileName':_0x16a46e,'effectiveBaseUrl':_0x1f71dc,'setupHeaders':_0x580697,'invalidateOn':_0x2d2c74?.[_0x500b03(0x1ec)],'userAgent':_0x2d2c74?.['userAgent'],'clientIp':_0x2d2c74?.['clientIp']}),_0x528444=_0x323b62['FvZjx'](getSessionCachePath,_0xad280b,_0x16a46e),_0x429994=_0x323b62[_0x500b03(0x17e)](join,getRangerHomeDir(),_0x323b62[_0x500b03(0x1cc)]);!_0x323b62[_0x500b03(0x1d7)](existsSync,_0x429994)&&await mkdir(_0x429994,{'recursive':!![]});const _0x33bab1={..._0x5b1387};_0x21f84e&&_0x323b62[_0x500b03(0x218)](_0x21f84e['length'],0x0)&&Array[_0x500b03(0x173)](_0x33bab1[_0x500b03(0x1a6)])&&(_0x33bab1['cookies']=duplicateCookiesForDomains(_0x33bab1[_0x500b03(0x1a6)],_0x21f84e));const _0x4663a3={'cached_at':new Date()['toISOString'](),'session_state':_0x33bab1};await _0x323b62[_0x500b03(0x164)](writeFile,_0x528444,JSON['stringify'](_0x4663a3,null,0x2));const _0x48fdaf=_0x323b62['lWyIx'](getStorageStatePath,_0x528444);return await _0x323b62[_0x500b03(0x17e)](writeFile,_0x48fdaf,JSON['stringify'](_0x33bab1,null,0x2)),_0x48fdaf;}export async function checkLocalCache(_0x28d1b4,_0x4ce679,_0x2a8b49,_0x1757eb,_0x17fc6f){const _0x12cf64=_0x25ed96,_0xd1ab1f={'jicvZ':function(_0x1bd8d5,_0xeda901){return _0x1bd8d5(_0xeda901);},'XOuAR':function(_0x494dd7,_0x383449){return _0x494dd7(_0x383449);},'fUunv':function(_0x4c6927,_0xa3735a,_0x3f219a){return _0x4c6927(_0xa3735a,_0x3f219a);},'DDMko':_0x12cf64(0x1b9)},_0x1f325c=sessionCacheHash({'orgId':_0x4ce679,'profileName':_0x28d1b4,'effectiveBaseUrl':_0x2a8b49,'setupHeaders':_0x1757eb,'invalidateOn':_0x17fc6f?.['invalidateOn'],'userAgent':_0x17fc6f?.[_0x12cf64(0x1a4)],'clientIp':_0x17fc6f?.[_0x12cf64(0x198)]}),_0x4cb9d6=getSessionCachePath(_0x1f325c,_0x28d1b4),_0xc69ef8=_0xd1ab1f[_0x12cf64(0x1e4)](getStorageStatePath,_0x4cb9d6);if(!existsSync(_0x4cb9d6)||!_0xd1ab1f['XOuAR'](existsSync,_0xc69ef8))return null;try{const _0x506666=await _0xd1ab1f['fUunv'](readFile,_0x4cb9d6,_0xd1ab1f['DDMko']);return JSON[_0x12cf64(0x1b3)](_0x506666),{'storageStatePath':_0xc69ef8};}catch{return null;}}function launchRealBrowser(){return chromium['launch']({'headless':!![]});}function emitSessionValidationHint(_0x1eede1,_0x794842){const _0xde914e=_0x25ed96,_0x4ff6aa={'whskW':function(_0x13dc01,_0x5f3dd7){return _0x13dc01===_0x5f3dd7;},'JfhvB':function(_0x5e1cb7,_0x157ce0){return _0x5e1cb7+_0x157ce0;},'cVjGb':function(_0x36b602,_0x1a3fd3){return _0x36b602+_0x1a3fd3;}};if(!_0x794842||!_0x794842['domains']?.['length'])return;let _0x3eada4;try{_0x3eada4=new URL(_0x1eede1);}catch{return;}const _0x3993ed=[];for(const _0x571653 of _0x794842[_0xde914e(0x1fc)]){try{_0x3993ed[_0xde914e(0x186)]({'raw':_0x571653,'url':new URL(_0x571653)});}catch{}}if(_0x4ff6aa[_0xde914e(0x208)](_0x3993ed[_0xde914e(0x21e)],0x0))return;if(_0x3993ed['some'](_0x30748f=>_0x30748f['url']['origin']===_0x3eada4[_0xde914e(0x181)]))return;const _0x2d324a=_0x3993ed[_0xde914e(0x1ea)](_0x55b5a8=>'\x22'+_0x55b5a8['raw']+'\x22')['join'](',\x20');console['log'](_0x4ff6aa[_0xde914e(0x207)](_0x4ff6aa['cVjGb'](_0xde914e(0x204)+_0x2d324a+';\x20','you\x27re\x20now\x20at\x20\x22'+_0x1eede1+'\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20'),'If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.'));}export async function serverSideLogin(_0x41e515,_0x27eedf){const _0x40406d=_0x25ed96,_0x345a8f={'NiXEb':function(_0x3534bd,_0x96bdcd){return _0x3534bd(_0x96bdcd);},'Tvifg':_0x40406d(0x1ba),'WRPwW':function(_0x2d480f,_0x529906){return _0x2d480f===_0x529906;},'FhCUJ':'not_configured'},_0x5a867c=process[_0x40406d(0x205)][_0x40406d(0x177)],_0x3d9700=process['env'][_0x40406d(0x213)],_0x3f5094={};if(_0x5a867c)_0x3f5094[_0x40406d(0x1bf)]=_0x5a867c;if(_0x3d9700)_0x3f5094['password']=_0x3d9700;if(_0x27eedf?.[_0x40406d(0x187)])_0x3f5094[_0x40406d(0x187)]=!![];if(_0x27eedf?.['targetUrl'])_0x3f5094[_0x40406d(0x1a1)]=_0x27eedf['targetUrl'];if(_0x27eedf?.['env'])_0x3f5094[_0x40406d(0x205)]=_0x27eedf['env'];_0x27eedf?.[_0x40406d(0x219)]&&(_0x3f5094[_0x40406d(0x169)]=_0x27eedf[_0x40406d(0x219)]['sessionId'],_0x3f5094[_0x40406d(0x1c8)]=_0x27eedf['tunnel']['pwEndpoint']);try{return await apiRequest('/api/v1/profiles/'+_0x345a8f[_0x40406d(0x1b2)](encodeURIComponent,_0x41e515)+_0x40406d(0x1d2),{'method':_0x345a8f[_0x40406d(0x18c)],'body':JSON['stringify'](_0x3f5094)});}catch(_0x22fcad){if(_0x22fcad instanceof ApiError&&_0x345a8f[_0x40406d(0x17d)](_0x22fcad[_0x40406d(0x17a)],0x190)&&_0x22fcad['code']===_0x345a8f['FhCUJ'])return{'status':_0x345a8f[_0x40406d(0x16b)],'error':_0x22fcad['detail']};throw _0x22fcad;}}async function serverSideLoginWithOptionalTunnel(_0x224ba5,_0x15b9af,_0x59ddf9={}){const _0x7e14b3=_0x25ed96,_0x4c16f7={'SfPfg':_0x7e14b3(0x1dc),'qwEBx':function(_0x340818,_0x57ece2){return _0x340818(_0x57ece2);},'SVvrC':'tunnel_login_setup','oquGp':function(_0x38c806,_0x1e4ccf){return _0x38c806??_0x1e4ccf;},'TiFym':function(_0x47e29d,_0x51f3d9){return _0x47e29d||_0x51f3d9;},'PNYWV':'tunnel_login_cleanup','cSyTD':function(_0x472289,_0x566de7){return _0x472289(_0x566de7);}};if(!_0x4c16f7[_0x7e14b3(0x212)](needsTunnel,_0x15b9af))return await serverSideLogin(_0x224ba5,{'force':_0x59ddf9['force'],'env':_0x59ddf9[_0x7e14b3(0x205)]});let _0x759e41=null,_0x4340d5=null,_0x23023e=null,_0x11b191=null,_0x2fe2d2=![];const _0x506ef3=process['env'][_0x7e14b3(0x171)]?.['toLowerCase'](),_0x55b837=_0x506ef3==='1'||_0x506ef3===_0x7e14b3(0x1ab),_0x4e8b25={'profileName':_0x224ba5,'targetUrlHost':_0x4c16f7[_0x7e14b3(0x212)](targetHostForTelemetry,_0x15b9af),'tunnelRequired':!![],'forceLogin':Boolean(_0x59ddf9[_0x7e14b3(0x187)]),'localBrowserServerHeaded':_0x55b837};try{_0x59ddf9['telemetry']?.['trackPhaseStart'](_0x4c16f7['SVvrC'],_0x4e8b25);_0x55b837&&console['log']('\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...');_0x759e41=await _0x4c16f7[_0x7e14b3(0x212)](launchBrowserServer,{'headless':!_0x55b837}),_0x4340d5=await _0x4c16f7[_0x7e14b3(0x212)](createTunnelSession,_0x15b9af);const _0x79cce7=await requireToken();_0x23023e=await _0x4c16f7['qwEBx'](createTunnelBridge,{'localWsUrl':_0x759e41[_0x7e14b3(0x1e0)],'tunnelServerUrl':_0x4340d5['tunnelUrl'],'sessionId':_0x4340d5[_0x7e14b3(0x1f9)],'apiKey':_0x79cce7,'onError':_0x531794=>{_0x11b191=_0x531794;},'onClose':()=>{const _0x5bea94=_0x7e14b3;_0x11b191??=new Error(_0x5bea94(0x180)+_0x224ba5);},'onEvent':_0xf0652=>trackBridgeEvent(_0x59ddf9[_0x7e14b3(0x1be)],_0xf0652)}),_0x59ddf9['telemetry']?.[_0x7e14b3(0x1da)]('tunnel_login_setup',{..._0x4e8b25,'tunnelSessionId':_0x4340d5['sessionId'],'localBrowserServer':!![],'localBrowserServerHeaded':_0x55b837}),_0x2fe2d2=!![];try{return _0x59ddf9[_0x7e14b3(0x1be)]?.[_0x7e14b3(0x194)]('tunnel_login_request',{..._0x4e8b25,'tunnelSessionId':_0x4340d5[_0x7e14b3(0x1f9)]}),await serverSideLogin(_0x224ba5,{'force':_0x59ddf9[_0x7e14b3(0x187)],'targetUrl':_0x15b9af,'env':_0x59ddf9['env'],'tunnel':{'sessionId':_0x4340d5['sessionId'],'pwEndpoint':_0x4340d5['pwEndpoint']}})['then'](_0x2a6a04=>{const _0x2074fc=_0x7e14b3;return _0x59ddf9['telemetry']?.['trackPhaseEnd'](_0x4c16f7[_0x2074fc(0x1ef)],{..._0x4e8b25,'tunnelSessionId':_0x4340d5?.[_0x2074fc(0x1f9)],'loginStatus':_0x2a6a04['status'],'hasSessionState':_0x4c16f7['qwEBx'](Boolean,_0x2a6a04[_0x2074fc(0x206)]),'hasTestOutput':Boolean(_0x2a6a04['test_output']),'bridgeError':errorMessageForTelemetry(_0x11b191)}),_0x2a6a04;});}catch(_0x5c5b57){await _0x59ddf9[_0x7e14b3(0x1be)]?.[_0x7e14b3(0x214)](_0x4c16f7['SfPfg'],_0x4c16f7['oquGp'](_0x11b191,_0x5c5b57),{..._0x4e8b25,'tunnelSessionId':_0x4340d5['sessionId'],'bridgeError':errorMessageForTelemetry(_0x11b191)});throw _0x11b191??_0x5c5b57;}}catch(_0x3ccfe1){!_0x2fe2d2&&await _0x59ddf9[_0x7e14b3(0x1be)]?.[_0x7e14b3(0x214)]('tunnel_login_setup',_0x3ccfe1,{..._0x4e8b25,'tunnelSessionId':_0x4340d5?.[_0x7e14b3(0x1f9)]});throw _0x3ccfe1;}finally{if(_0x4c16f7['TiFym'](_0x4340d5,_0x759e41)||_0x23023e){const _0x593ebf='0|2|3|4|1'['split']('|');let _0x335290=0x0;while(!![]){switch(_0x593ebf[_0x335290++]){case'0':_0x59ddf9['telemetry']?.[_0x7e14b3(0x194)](_0x4c16f7[_0x7e14b3(0x1e9)],{..._0x4e8b25,'tunnelSessionId':_0x4340d5?.[_0x7e14b3(0x1f9)]});continue;case'1':_0x59ddf9['telemetry']?.[_0x7e14b3(0x1da)]('tunnel_login_cleanup',{..._0x4e8b25,'tunnelSessionId':_0x4340d5?.[_0x7e14b3(0x1f9)]});continue;case'2':_0x23023e?.['close']();continue;case'3':_0x759e41&&await _0x759e41['close']()['catch'](()=>{});continue;case'4':_0x4340d5&&await _0x4c16f7['cSyTD'](deleteTunnelSession,_0x4340d5[_0x7e14b3(0x1f9)])['catch'](()=>{});continue;}break;}}}}export async function manualBrowserLogin(_0x3acf8c,_0x56bb9d,_0x47e830={}){const _0x34f6de=_0x25ed96,_0x21e962={'mcXry':function(_0x258ab4,_0x56e59a){return _0x258ab4/_0x56e59a;},'XyVFd':_0x34f6de(0x202),'OtQfG':'about:blank','GbfgK':'\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','GFGzp':_0x34f6de(0x1fd),'LnHPT':function(_0xa1fe4b,_0x4dddd0){return _0xa1fe4b(_0x4dddd0);},'KhAzu':_0x34f6de(0x200),'sKsFo':function(_0x579d20,_0x1c4001){return _0x579d20!==_0x1c4001;},'JDYyW':'cli:manual-login'};if(!isInteractive())throw new Error('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x3acf8c['name']+'\x22.\x0a'+_0x34f6de(0x1a7)+'or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.');const _0x532ef3=_0x56bb9d&&_0x56bb9d[_0x34f6de(0x1fc)][_0x34f6de(0x21e)]>0x0?_0x56bb9d['domains'][0x0]:_0x21e962[_0x34f6de(0x1ae)];console['log'](_0x21e962['GbfgK']),console['log'](_0x21e962[_0x34f6de(0x179)]),await new Promise(_0x4b907a=>setTimeout(_0x4b907a,0x7d0));const _0x5a3cc2=await chromium['launch']({'headless':![]});let _0x45796f=null;try{const _0x19b204={'ignoreHTTPSErrors':!![]};_0x56bb9d?.['setupHeaders']&&(_0x19b204[_0x34f6de(0x1e2)]=_0x56bb9d['setupHeaders']);const _0x4193c8=await _0x5a3cc2[_0x34f6de(0x19d)](_0x19b204);await _0x21e962['LnHPT'](addProfileSetupBanner,_0x4193c8);const _0x53edc5=await _0x4193c8[_0x34f6de(0x201)]();await _0x53edc5['goto'](_0x532ef3);let _0x1b395c=![];await new Promise(_0x4e6adc=>{const _0x1a0166=setTimeout(()=>{const _0x426829=_0xdb1b;_0x1b395c=!![],console[_0x426829(0x21a)](_0x426829(0x19e)+_0x21e962[_0x426829(0x191)](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x4e6adc();},MANUAL_LOGIN_TIMEOUT_MS);_0x53edc5['on'](_0x21e962['XyVFd'],async()=>{const _0xa16973=_0xdb1b;clearTimeout(_0x1a0166);try{const _0x3efa51=await _0x4193c8[_0xa16973(0x20c)]();_0x45796f=_0x3efa51;}catch{}_0x4e6adc();});});if(_0x1b395c&&!_0x45796f)throw new Error(_0x34f6de(0x176));}finally{await _0x5a3cc2['close']()['catch'](()=>{});}if(!_0x45796f)throw new Error(_0x21e962[_0x34f6de(0x1c0)]);return _0x21e962[_0x34f6de(0x215)](_0x47e830['persistSessionState'],![])&&await apiRequest(_0x34f6de(0x1f5)+_0x21e962['LnHPT'](encodeURIComponent,_0x3acf8c['name'])+'/session',{'method':'POST','body':JSON['stringify']({'session_state':_0x45796f,'updated_by':_0x21e962['JDYyW']})}),{'sessionState':_0x45796f};}export async function promptSaveCredentials(_0x3582c9){const _0x55dd16=_0x25ed96,_0x95d1b9={'UzDCk':function(_0x5e84a5,_0x2c2ffe){return _0x5e84a5||_0x2c2ffe;},'tOFCB':function(_0x4e63d4){return _0x4e63d4();},'oXZkv':'save','NUeqY':function(_0x316922,_0x483ed5,_0x31a2ed){return _0x316922(_0x483ed5,_0x31a2ed);}},_0x1d4792=process['env'][_0x55dd16(0x177)],_0x4312d1=process['env']['RANGER_TEST_PASSWORD'];if(_0x95d1b9['UzDCk'](!_0x1d4792,!_0x4312d1))return;if(!_0x95d1b9[_0x55dd16(0x18d)](isInteractive))return;const {save:_0x3e2c6a}=await _0x226ce7['prompt']([{'type':'confirm','name':_0x95d1b9[_0x55dd16(0x1af)],'message':_0x55dd16(0x217),'default':![]}]);if(!_0x3e2c6a)return;await _0x95d1b9['NUeqY'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x3582c9),{'method':'PUT','body':JSON[_0x55dd16(0x1fa)]({'username':_0x1d4792,'password':_0x4312d1})}),console['log']('\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.');}export async function resolveCloudProfileSession(_0x125d20,_0x1425b8={}){const _0x2002da=_0x25ed96,_0x231c97={'Edxdi':function(_0x4c58fb){return _0x4c58fb();},'fsgrP':function(_0x5bb0cb,_0x2c6278){return _0x5bb0cb===_0x2c6278;},'PWPql':_0x2002da(0x1ca),'ZWQlx':function(_0x3c39be,_0x8ecb8a){return _0x3c39be===_0x8ecb8a;},'gRknK':function(_0x14771f,_0x2860b3){return _0x14771f||_0x2860b3;},'YrNqK':function(_0x59f885,_0x2918a0){return _0x59f885(_0x2918a0);},'egwqC':function(_0x1ac0f9,_0x53c0dc){return _0x1ac0f9(_0x53c0dc);},'pYSXP':function(_0x1dc0b6,_0x103430){return _0x1dc0b6>_0x103430;},'WmRxp':function(_0x8cde5a,_0x57d792,_0xed5bd9,_0x507a99,_0x30a468,_0x368cc7){return _0x8cde5a(_0x57d792,_0xed5bd9,_0x507a99,_0x30a468,_0x368cc7);},'PwpuS':function(_0x4c9034,_0x23fc57,_0x565ad6){return _0x4c9034(_0x23fc57,_0x565ad6);},'RQMZC':function(_0x47ec59,_0x230071,_0x565948){return _0x47ec59(_0x230071,_0x565948);},'RxAiB':function(_0x4709a2,_0x5bd746){return _0x4709a2(_0x5bd746);},'HXdTd':function(_0x358881,_0x583016,_0x511604,_0x5df8f1){return _0x358881(_0x583016,_0x511604,_0x5df8f1);},'IzIAr':function(_0x24db32,_0x40911d,_0x4dd511){return _0x24db32(_0x40911d,_0x4dd511);},'mmTNn':'\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','ABilH':function(_0x52904a,_0x52f0b8){return _0x52904a===_0x52f0b8;},'JKgvX':_0x2002da(0x20f),'olOxN':function(_0xadff0,_0x1084da,_0x41ac8b,_0x3c8be0,_0x4149a1,_0x1c0807,_0x18fe2d,_0x33bcce){return _0xadff0(_0x1084da,_0x41ac8b,_0x3c8be0,_0x4149a1,_0x1c0807,_0x18fe2d,_0x33bcce);},'TpHSd':function(_0x36d826,_0x12ce7e){return _0x36d826&&_0x12ce7e;},'YbPtz':function(_0x353ee9,_0x3fa475){return _0x353ee9(_0x3fa475);},'pNWWK':'\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','bNTzM':function(_0x3d4f66,_0x1a5a8c){return _0x3d4f66 instanceof _0x1a5a8c;},'gEzSy':function(_0x563c1d,_0x890838){return _0x563c1d+_0x890838;},'QOQOj':function(_0x45b6bc,_0xc0407c,_0xddbcaf){return _0x45b6bc(_0xc0407c,_0xddbcaf);},'EtVLc':function(_0x530c9c,_0x3d60c5,_0x3a372a,_0x1fb36a,_0x416641,_0x90c4f5,_0x5670cc,_0x22c888){return _0x530c9c(_0x3d60c5,_0x3a372a,_0x1fb36a,_0x416641,_0x90c4f5,_0x5670cc,_0x22c888);}},_0x5d045c=_0x125d20[_0x2002da(0x193)]??{},_0x769213=await _0x231c97[_0x2002da(0x223)](fetchAuthConfig),_0x1901a0=_0x769213?resolveAuthEnvironmentLocally(_0x769213,_0x1425b8['assertedEnv']??_0x125d20['environmentKey']):null,_0x2a7edb=_0x231c97['fsgrP'](typeof _0x1901a0?.[_0x2002da(0x1f2)],_0x231c97[_0x2002da(0x1d4)])&&_0x1901a0['loginInstructions'][_0x2002da(0x18f)]()?_0x1901a0['loginInstructions']:undefined,_0x1dc295=_0x231c97[_0x2002da(0x203)](typeof _0x5d045c[_0x2002da(0x1f2)],'string')&&_0x5d045c[_0x2002da(0x1f2)]['trim']()?_0x5d045c['loginInstructions']:undefined,_0x2f9259=_0x231c97[_0x2002da(0x183)](_0x1dc295,!_0x2a7edb)?_0x5d045c:{..._0x5d045c,'loginInstructions':_0x2a7edb},_0x497e08=_0x231c97[_0x2002da(0x20d)](Boolean,_0x2f9259[_0x2002da(0x1f2)]?.['trim']()),_0x352a3c=_0x231c97['egwqC'](Boolean,_0x5d045c[_0x2002da(0x163)]||_0x1901a0?.['forceLogin']),_0x138242=_0x1901a0?.['domains'],_0x1810f5=_0x5d045c[_0x2002da(0x1f7)],_0x31eca6=_0x1810f5??_0x1901a0?.[_0x2002da(0x1f7)],_0x5e5a68=_0x1425b8[_0x2002da(0x16d)]??_0x5d045c['baseUrl']??(_0x138242&&_0x231c97['pYSXP'](_0x138242['length'],0x0)?_0x138242[0x0]:''),_0x2de6b9=_0x5e5a68?needsTunnel(_0x5e5a68):![],_0x27ec99={'invalidateOn':_0x1901a0?.[_0x2002da(0x1ec)],'userAgent':_0x1901a0?.[_0x2002da(0x20e)]?.['userAgent']??_0x5d045c[_0x2002da(0x1a4)]};_0x352a3c&&console['log']('\x20\x20forceLogin\x20enabled\x20for\x20\x22'+_0x125d20[_0x2002da(0x1a3)]+_0x2002da(0x1fb));if(!_0x352a3c){const _0x2088d6=await _0x231c97[_0x2002da(0x19b)](checkLocalCache,_0x125d20['name'],_0x125d20['organizationId'],_0x5e5a68,_0x31eca6,_0x27ec99);if(_0x2088d6){if(_0x5e5a68&&!_0x2de6b9){const _0x2b2d8f=await isCachedSessionLive(_0x2088d6[_0x2002da(0x1d5)],_0x5e5a68,{'sessionCheckPath':_0x1901a0?.[_0x2002da(0x222)],'setupHeaders':_0x31eca6},{'launchBrowser':launchRealBrowser});if(_0x2b2d8f)return console[_0x2002da(0x172)]('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x125d20['name']+'\x22'),{'authPath':_0x2088d6['storageStatePath'],'settings':_0x2f9259,'resolvedEnv':_0x1901a0};console[_0x2002da(0x172)](_0x2002da(0x1bd)+_0x125d20['name']+'\x22\x20failed\x20validation\x20—\x20refreshing...'),_0x231c97['PwpuS'](emitSessionValidationHint,_0x5e5a68,_0x1901a0);}else return _0x2de6b9&&console[_0x2002da(0x172)](_0x2002da(0x1e1)+_0x125d20[_0x2002da(0x1a3)]+'\x22'),{'authPath':_0x2088d6[_0x2002da(0x1d5)],'settings':_0x2f9259,'resolvedEnv':_0x1901a0};}}if(!_0x352a3c&&_0x125d20[_0x2002da(0x1b5)]){const _0x49ff13=await writeSessionToLocalCache(_0x125d20['name'],_0x125d20['organizationId'],_0x5e5a68,_0x31eca6,_0x125d20['sessionState'],_0x138242,_0x27ec99);if(_0x5e5a68){const _0x9efb45=await isCachedSessionLive(_0x49ff13,_0x5e5a68,{'sessionCheckPath':_0x1901a0?.['sessionCheckPath'],'setupHeaders':_0x31eca6},{'launchBrowser':launchRealBrowser});if(_0x9efb45)return console[_0x2002da(0x172)](_0x2002da(0x185)+_0x125d20['name']+'\x22,\x20cached\x20locally'),{'authPath':_0x49ff13,'settings':_0x2f9259,'resolvedEnv':_0x1901a0};console[_0x2002da(0x172)]('\x20\x20Cloud\x20session\x20for\x20\x22'+_0x125d20[_0x2002da(0x1a3)]+_0x2002da(0x17c)),_0x231c97[_0x2002da(0x1b1)](emitSessionValidationHint,_0x5e5a68,_0x1901a0);}else return{'authPath':_0x49ff13,'settings':_0x2f9259,'resolvedEnv':_0x1901a0};}if(_0x497e08)return console['log']('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x125d20[_0x2002da(0x1a3)]+_0x2002da(0x1a9)),{'authPath':undefined,'settings':_0x2f9259,'resolvedEnv':_0x1901a0};console['log'](_0x2002da(0x1c1)+_0x125d20['name']+_0x2002da(0x1f8));const _0x4bb471=Boolean(process[_0x2002da(0x205)][_0x2002da(0x177)])&&_0x231c97['YrNqK'](Boolean,process['env'][_0x2002da(0x213)]),_0x3a9ca9=_0x231c97[_0x2002da(0x17f)](Boolean,_0x125d20[_0x2002da(0x1bf)]),_0x255a82=Boolean(_0x1425b8[_0x2002da(0x1a8)]),_0x6c0db5=_0x5e5a68?isBareLocalhost(_0x5e5a68):![],_0x355730=_0x231c97['gRknK'](_0x4bb471,_0x3a9ca9)&&_0x231c97[_0x2002da(0x183)](!_0x6c0db5,_0x255a82);if(_0x355730)try{const _0x3877e2=_0x5e5a68?await _0x231c97['HXdTd'](serverSideLoginWithOptionalTunnel,_0x125d20[_0x2002da(0x1a3)],_0x5e5a68,{'force':_0x352a3c,'telemetry':_0x1425b8[_0x2002da(0x1be)],'env':_0x1425b8['assertedEnv']}):await _0x231c97['IzIAr'](serverSideLogin,_0x125d20[_0x2002da(0x1a3)],{'force':_0x352a3c,'env':_0x1425b8['assertedEnv']});if(_0x3877e2['status']==='not_configured')console['log'](_0x231c97['mmTNn']);else{if(_0x231c97[_0x2002da(0x20b)](_0x3877e2[_0x2002da(0x17a)],_0x231c97[_0x2002da(0x210)])&&_0x3877e2['session_state']){console[_0x2002da(0x172)](_0x2002da(0x16f));const _0x2963d3=await _0x231c97['olOxN'](writeSessionToLocalCache,_0x125d20['name'],_0x125d20[_0x2002da(0x1e3)],_0x5e5a68,_0x31eca6,_0x3877e2[_0x2002da(0x206)],_0x138242,_0x27ec99);return _0x231c97[_0x2002da(0x1d0)](_0x4bb471,!_0x3a9ca9)&&await _0x231c97['YbPtz'](promptSaveCredentials,_0x125d20['name']),{'authPath':_0x2963d3,'settings':_0x2f9259,'resolvedEnv':_0x1901a0};}else _0x3877e2['test_output']&&(console['log']('\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:'),console['log'](_0x3877e2['test_output'])),console['log'](_0x231c97[_0x2002da(0x1a5)]);}}catch(_0x4db916){console[_0x2002da(0x172)](_0x2002da(0x19c)+(_0x231c97['bNTzM'](_0x4db916,Error)?_0x4db916['message']:String(_0x4db916))),console['log'](_0x231c97['pNWWK']);}if(_0x6c0db5&&!_0x255a82&&!isInteractive())throw new Error(_0x231c97['gEzSy']('No\x20saved\x20session\x20for\x20\x22'+_0x5e5a68+_0x2002da(0x1e8)+_0x125d20['name']+_0x2002da(0x1eb),'\x20\x20•\x20capture\x20one\x20(a\x20browser\x20opens):\x20ranger\x20profile\x20add\x20'+_0x125d20[_0x2002da(0x1a3)]+_0x2002da(0x1ad)+_0x5e5a68+'\x0a')+_0x2002da(0x18a));const _0x19c610=_0x1901a0?{..._0x1901a0,'domains':_0x231c97['QOQOj'](orderLoginDomains,_0x5e5a68,_0x1901a0[_0x2002da(0x1fc)]),'setupHeaders':_0x31eca6}:_0x5e5a68?{'key':_0x125d20['environmentKey']??'','domains':[_0x5e5a68],'setupHeaders':_0x31eca6}:null,{sessionState:_0x23e6a7}=await manualBrowserLogin(_0x125d20,_0x19c610,{'persistSessionState':!_0x2de6b9}),_0x56ea2f=await _0x231c97['EtVLc'](writeSessionToLocalCache,_0x125d20['name'],_0x125d20['organizationId'],_0x5e5a68,_0x31eca6,_0x23e6a7,_0x138242,_0x27ec99);return{'authPath':_0x56ea2f,'settings':_0x2f9259,'resolvedEnv':_0x1901a0};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x396108=_0x469d;(function(_0x310cc8,_0x4391db){const _0x792bba=_0x469d,_0x482732=_0x310cc8();while(!![]){try{const _0x252692=parseInt(_0x792bba(0x131))/0x1*(parseInt(_0x792bba(0x141))/0x2)+parseInt(_0x792bba(0x14f))/0x3+parseInt(_0x792bba(0x12d))/0x4+-parseInt(_0x792bba(0x14c))/0x5+parseInt(_0x792bba(0x155))/0x6*(parseInt(_0x792bba(0x12c))/0x7)+parseInt(_0x792bba(0x135))/0x8*(parseInt(_0x792bba(0x12b))/0x9)+-parseInt(_0x792bba(0x139))/0xa;if(_0x252692===_0x4391db)break;else _0x482732['push'](_0x482732['shift']());}catch(_0x229a3b){_0x482732['push'](_0x482732['shift']());}}}(_0x2af9,0x917e1));import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x1e9992=process[_0x396108(0x13b)],_0x51c517={'stdin':process['stdin'],'stdout':process[_0x396108(0x134)]}){const _0x49307f=_0x396108,_0x1b3b13={'ftNyw':function(_0x8db514,_0x52d240){return _0x8db514(_0x52d240);}};if(_0x1e9992['CI'])return![];return Boolean(_0x51c517[_0x49307f(0x13a)]['isTTY'])&&_0x1b3b13[_0x49307f(0x142)](Boolean,_0x51c517['stdout']['isTTY']);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x276d67){const _0x29ef0d=_0x396108,_0xfc0cc6={'Sfgzh':function(_0x30068e,_0xe7ed5c){return _0x30068e(_0xe7ed5c);},'qXLKb':'baseUrl','SAflx':'userAgent','DWPDu':function(_0x1ae11c,_0x233e2d){return _0x1ae11c!==_0x233e2d;}},_0x32d139=new Set(_0x276d67['invalidateOn']??DEFAULT_INVALIDATE_ON);_0x276d67[_0x29ef0d(0x12e)]&&_0xfc0cc6['Sfgzh'](needsTunnel,_0x276d67[_0x29ef0d(0x12e)])&&_0x32d139['add'](_0xfc0cc6['qXLKb']);const _0x3a9ce9={'orgId':_0x276d67[_0x29ef0d(0x14e)],'profileName':_0x276d67[_0x29ef0d(0x13c)]};return _0x32d139[_0x29ef0d(0x15e)](_0x29ef0d(0x151))&&(_0x3a9ce9[_0x29ef0d(0x12e)]=_0x276d67[_0x29ef0d(0x12e)]),_0x32d139[_0x29ef0d(0x15e)](_0x29ef0d(0x149))&&(_0x3a9ce9[_0x29ef0d(0x149)]=_0x276d67['setupHeaders']?sortObjectKeys(_0x276d67[_0x29ef0d(0x149)]):_0x276d67['setupHeaders']),_0x32d139[_0x29ef0d(0x15e)](_0x29ef0d(0x15c))&&(_0x3a9ce9[_0x29ef0d(0x15c)]=extractPort(_0x276d67['effectiveBaseUrl'])),_0x32d139['has'](_0xfc0cc6['SAflx'])&&_0xfc0cc6[_0x29ef0d(0x14b)](_0x276d67['userAgent'],undefined)&&(_0x3a9ce9['userAgent']=_0x276d67[_0x29ef0d(0x144)]),_0x32d139['has']('clientIp')&&_0x276d67[_0x29ef0d(0x148)]!==undefined&&(_0x3a9ce9[_0x29ef0d(0x148)]=_0x276d67[_0x29ef0d(0x148)]),_0xfc0cc6[_0x29ef0d(0x154)](createHash,'sha256')['update'](JSON[_0x29ef0d(0x13f)](_0x3a9ce9))[_0x29ef0d(0x157)](_0x29ef0d(0x162))[_0x29ef0d(0x152)](0x0,0xc);}function extractPort(_0x32aa30){const _0x27f4fe=_0x396108;try{return new URL(_0x32aa30)[_0x27f4fe(0x15c)];}catch{return'';}}function sortObjectKeys(_0x11a8c6){const _0x5656ca={};for(const _0x2f8bc8 of Object['keys'](_0x11a8c6)['sort']()){_0x5656ca[_0x2f8bc8]=_0x11a8c6[_0x2f8bc8];}return _0x5656ca;}export function getSessionCachePath(_0x29d976,_0x2bb4be){const _0x50daf7=_0x396108,_0x3791ea={'kbHoS':function(_0x182f76,_0x49d28f,_0x10d182,_0x50035b){return _0x182f76(_0x49d28f,_0x10d182,_0x50035b);}};return _0x3791ea[_0x50daf7(0x146)](join,getRangerHomeDir(),_0x50daf7(0x150),_0x29d976+'-'+_0x2bb4be+_0x50daf7(0x14d));}export function getStorageStatePath(_0x3da326){const _0x3e73c4=_0x396108;return _0x3da326['replace'](/\.json$/,_0x3e73c4(0x158));}export function needsTunnel(_0x1a5bd6){const _0x1e6d9b=_0x396108,_0x452b08={'IZwHt':function(_0x298c75,_0x5dc0d1){return _0x298c75===_0x5dc0d1;},'vFvvs':function(_0x4c0837,_0x42a0a7){return _0x4c0837===_0x42a0a7;},'bcxZR':'127.0.0.1','vyTgS':'localhost.'};let _0x675a7e;try{_0x675a7e=new URL(_0x1a5bd6)['hostname'];}catch{return![];}if(_0x452b08[_0x1e6d9b(0x13d)](_0x675a7e,_0x1e6d9b(0x15d))||_0x452b08[_0x1e6d9b(0x130)](_0x675a7e,_0x452b08['bcxZR']))return!![];if(_0x675a7e['endsWith'](_0x1e6d9b(0x15f)))return!![];if(_0x675a7e[_0x1e6d9b(0x138)](_0x452b08['vyTgS']))return!![];return![];}function _0x469d(_0x54a31a,_0x102bee){_0x54a31a=_0x54a31a-0x12b;const _0x2af983=_0x2af9();let _0x469d2a=_0x2af983[_0x54a31a];return _0x469d2a;}export function isBareLocalhost(_0x2e0d97){const _0x2e9daf=_0x396108,_0x27f108={'fEXeE':function(_0xd8e98,_0x46b03a){return _0xd8e98===_0x46b03a;},'nFAJH':'::1'};let _0x42a744;try{_0x42a744=new URL(_0x2e0d97)[_0x2e9daf(0x160)];}catch{return![];}return _0x27f108['fEXeE'](_0x42a744,'localhost')||_0x27f108['fEXeE'](_0x42a744,'127.0.0.1')||_0x42a744===_0x27f108[_0x2e9daf(0x156)]||_0x42a744==='[::1]';}export function orderLoginDomains(_0x3f8774,_0x10c9b3){const _0x3787b7=_0x396108,_0x31c3ba=_0x10c9b3??[];if(!_0x3f8774)return _0x31c3ba;return[_0x3f8774,..._0x31c3ba[_0x3787b7(0x161)](_0x68f331=>_0x68f331!==_0x3f8774)];}export function hostnameOf(_0x12c37d){const _0x50ef98=_0x396108;return new URL(_0x12c37d)[_0x50ef98(0x160)];}export function duplicateCookiesForDomains(_0x50a976,_0x2113da){const _0x2f1b5b=_0x396108,_0xc24e13=[..._0x50a976],_0x591e39=new Set(_0x50a976[_0x2f1b5b(0x12f)](_0x48c623=>_0x48c623['domain']));for(const _0x566eed of _0x2113da){let _0x62b195;try{_0x62b195=hostnameOf(_0x566eed);}catch{continue;}if(!_0x62b195)continue;const _0x208b73=_0x62b195['startsWith']('.')?_0x62b195:'.'+_0x62b195;if(_0x591e39['has'](_0x62b195)||_0x591e39['has'](_0x208b73))continue;for(const _0x186fd2 of _0x50a976){_0xc24e13['push']({..._0x186fd2,'domain':_0x208b73});}_0x591e39[_0x2f1b5b(0x14a)](_0x208b73);}return _0xc24e13;}export function resolveAuthEnvironmentLocally(_0x1cf939,_0x443740){const _0x166cfb=_0x396108,_0x3222ff=_0x1cf939['environments'];if(_0x443740){const _0x7126ce=_0x3222ff[_0x443740];if(!_0x7126ce)return null;return{'key':_0x443740,..._0x7126ce};}if(_0x1cf939['defaultEnvironmentKey']){const _0x57151d=_0x3222ff[_0x1cf939['defaultEnvironmentKey']];if(!_0x57151d)return null;return{'key':_0x1cf939['defaultEnvironmentKey'],..._0x57151d};}const _0x5d940a=Object[_0x166cfb(0x140)](_0x3222ff);if(_0x5d940a[_0x166cfb(0x15a)]===0x1){const _0x5c995b=_0x5d940a[0x0];return{'key':_0x5c995b,..._0x3222ff[_0x5c995b]};}return null;}function _0x2af9(){const _0x27d572=['digest','.storageState.json','peUbG','length','url','port','localhost','has','.localhost','hostname','filter','hex','9SbAcvc','1906338cmCBuL','2754232veVHGY','effectiveBaseUrl','map','vFvvs','1JILVnR','hEQYu','newContext','stdout','5573432AeuLUs','launchBrowser','newPage','includes','11489720qlZpFu','stdin','env','profileName','IZwHt','domcontentloaded','stringify','keys','304176MXtYsA','ftNyw','goto','userAgent','toString','kbHoS','pathname','clientIp','setupHeaders','add','DWPDu','2601770mxKcZl','.json','orgId','549810sGvAzP','auth','baseUrl','slice','test','Sfgzh','12RkZGhe','nFAJH'];_0x2af9=function(){return _0x27d572;};return _0x2af9();}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x419915,_0x556f22){const _0x169f6f=_0x396108;try{if(_0x556f22)return new URL(_0x556f22,_0x419915)[_0x169f6f(0x145)]();return new URL(_0x419915)[_0x169f6f(0x145)]();}catch{return null;}}export function looksLikeLoginUrl(_0x35a2da){const _0x18b290=_0x396108;try{const _0x18184e=new URL(_0x35a2da);return LOGIN_URL_PATTERN['test'](_0x18184e[_0x18b290(0x147)]);}catch{return LOGIN_URL_PATTERN[_0x18b290(0x153)](_0x35a2da);}}export async function isCachedSessionLive(_0x413f90,_0x164362,_0x183401={},_0x25e8d1={}){const _0x21ac2a=_0x396108,_0x33d5e3={'hEQYu':_0x21ac2a(0x13e),'ytDdw':function(_0x174307,_0x4260c4){return _0x174307===_0x4260c4;},'peUbG':function(_0x3b3275,_0x5adc3c){return _0x3b3275(_0x5adc3c);}},_0x40cbd7=buildSessionCheckUrl(_0x164362,_0x183401['sessionCheckPath']);if(!_0x40cbd7)return!![];if(!_0x25e8d1['launchBrowser'])return!![];let _0xef9428=null;try{_0xef9428=await _0x25e8d1[_0x21ac2a(0x136)]();const _0x4c9325=await _0xef9428[_0x21ac2a(0x133)]({'storageState':_0x413f90,'ignoreHTTPSErrors':!![],..._0x183401['setupHeaders']?{'extraHTTPHeaders':_0x183401[_0x21ac2a(0x149)]}:{}}),_0x2b5afd=await _0x4c9325[_0x21ac2a(0x137)](),_0x43c13e=await _0x2b5afd[_0x21ac2a(0x143)](_0x40cbd7,{'waitUntil':_0x33d5e3[_0x21ac2a(0x132)],'timeout':0x3a98}),_0x9272a=_0x43c13e?.['status']();if(_0x9272a===0x191||_0x33d5e3['ytDdw'](_0x9272a,0x193))return![];const _0x466c04=_0x2b5afd[_0x21ac2a(0x15b)]();if(_0x33d5e3[_0x21ac2a(0x159)](looksLikeLoginUrl,_0x466c04))return![];return!![];}catch{return![];}finally{if(_0xef9428)await _0xef9428['close']()['catch'](()=>{});}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x1f5c69,_0x24e6af){const _0x3081f2=_0xfcc8,_0x7d095a=_0x1f5c69();while(!![]){try{const _0x2f9a28=-parseInt(_0x3081f2(0x12b))/0x1+parseInt(_0x3081f2(0x137))/0x2*(-parseInt(_0x3081f2(0x128))/0x3)+parseInt(_0x3081f2(0x136))/0x4*(parseInt(_0x3081f2(0x12c))/0x5)+parseInt(_0x3081f2(0x12d))/0x6*(parseInt(_0x3081f2(0x13a))/0x7)+parseInt(_0x3081f2(0x12f))/0x8+parseInt(_0x3081f2(0x12a))/0x9*(parseInt(_0x3081f2(0x131))/0xa)+-parseInt(_0x3081f2(0x127))/0xb;if(_0x2f9a28===_0x24e6af)break;else _0x7d095a['push'](_0x7d095a['shift']());}catch(_0x15c151){_0x7d095a['push'](_0x7d095a['shift']());}}}(_0x2582,0xddf64));import{createCipheriv,createDecipheriv,randomBytes,pbkdf2Sync}from'crypto';const ALGORITHM='aes-256-gcm',SALT='ranger-auth-encryption',KEY_LENGTH=0x20,IV_LENGTH=0x10,TAG_LENGTH=0x10;function _0xfcc8(_0x2b83d2,_0x2ea066){_0x2b83d2=_0x2b83d2-0x127;const _0x25828f=_0x2582();let _0xfcc816=_0x25828f[_0x2b83d2];return _0xfcc816;}export function deriveKey(_0x154c25){const _0x50afe4={'lHNBn':function(_0x4b27d3,_0x54eeee,_0x1be655,_0x2eae48,_0x3deb7e,_0x1533a0){return _0x4b27d3(_0x54eeee,_0x1be655,_0x2eae48,_0x3deb7e,_0x1533a0);}};return _0x50afe4['lHNBn'](pbkdf2Sync,_0x154c25,SALT,0x186a0,KEY_LENGTH,'sha256');}function _0x2582(){const _0xf7d782=['concat','OfcBn','LoDtK','getAuthTag','244380RImvEw','22VPpSWp','subarray','dPdUA','203gJUAVp','1978416AUuPYQ','406194LhDxva','dDsfT','11133KcUTva','1682411tffECt','40SteLEt','300654QvKDcK','setAuthTag','14127528clTwSg','utf8','4470LFXapk'];_0x2582=function(){return _0xf7d782;};return _0x2582();}export function encrypt(_0x5351d6,_0x244e80){const _0x44a9dd=_0xfcc8,_0x12aa93={'OfcBn':function(_0x440cf5,_0x50423a){return _0x440cf5(_0x50423a);},'dPdUA':function(_0x4eb2f6,_0x35a766,_0x272ee6,_0x4d5087){return _0x4eb2f6(_0x35a766,_0x272ee6,_0x4d5087);}},_0x3ab6cb=_0x12aa93[_0x44a9dd(0x133)](deriveKey,_0x244e80),_0x380c9d=_0x12aa93['OfcBn'](randomBytes,IV_LENGTH),_0x5959e3=_0x12aa93[_0x44a9dd(0x139)](createCipheriv,ALGORITHM,_0x3ab6cb,_0x380c9d),_0x2ce8e9=Buffer['concat']([_0x5959e3['update'](_0x5351d6,'utf8'),_0x5959e3['final']()]),_0x48b944=_0x5959e3[_0x44a9dd(0x135)]();return Buffer[_0x44a9dd(0x132)]([_0x380c9d,_0x48b944,_0x2ce8e9]);}export function decrypt(_0x312013,_0x1e36c1){const _0x1a53f5=_0xfcc8,_0x52eed1={'Jrtyp':function(_0x25e5a4,_0x336a5e){return _0x25e5a4+_0x336a5e;},'LoDtK':function(_0x3ebc8f,_0x4c24cb){return _0x3ebc8f+_0x4c24cb;},'dDsfT':_0x1a53f5(0x130)},_0x2253d4=deriveKey(_0x1e36c1),_0xd2a0e4=_0x312013[_0x1a53f5(0x138)](0x0,IV_LENGTH),_0x120303=_0x312013[_0x1a53f5(0x138)](IV_LENGTH,_0x52eed1['Jrtyp'](IV_LENGTH,TAG_LENGTH)),_0x1c81bd=_0x312013[_0x1a53f5(0x138)](_0x52eed1[_0x1a53f5(0x134)](IV_LENGTH,TAG_LENGTH)),_0x2c2892=createDecipheriv(ALGORITHM,_0x2253d4,_0xd2a0e4);return _0x2c2892[_0x1a53f5(0x12e)](_0x120303),_0x2c2892['update'](_0x1c81bd)+_0x2c2892['final'](_0x52eed1[_0x1a53f5(0x129)]);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const _0x5bdf99=_0x1e9b;function _0x1174(){const _0x4d6f36=['Not\x20enough\x20non-option\x20arguments','includes','featureId','error','yfUrc','--key','210oWUwdZ','685802QclmDY','startsWith','24sfhgft','errorMessage','347694XbmVoL','toLowerCase','Wymtw','missing_option','slice','--credentials','syntax_error','stringify','Unknown\x20command','missing_required_argument','no_token','--pass','7mNcwmx','catch','1158SpAFLs','some','yoobm','has','application/json','4smRDgD','232045CMUdAd','push','invalid_option_value','uEjOO','3117584cEUgxT','4062420mPRIfJ','2815DjzQeR','errorType','join','env','--authorization','1266726AQDljH','[desire-path]\x20Payload:\x20','length','--apikey','2ZjKwUz','DiIfe','Invalid\x20values','runtime_error','Bearer\x20'];_0x1174=function(){return _0x4d6f36;};return _0x1174();}(function(_0xd2549f,_0x27368f){const _0x5b4a4f=_0x1e9b,_0x41c3c2=_0xd2549f();while(!![]){try{const _0x2a35e1=-parseInt(_0x5b4a4f(0x14b))/0x1*(-parseInt(_0x5b4a4f(0x15b))/0x2)+parseInt(_0x5b4a4f(0x147))/0x3*(-parseInt(_0x5b4a4f(0x16e))/0x4)+parseInt(_0x5b4a4f(0x142))/0x5*(parseInt(_0x5b4a4f(0x169))/0x6)+parseInt(_0x5b4a4f(0x167))/0x7*(parseInt(_0x5b4a4f(0x140))/0x8)+-parseInt(_0x5b4a4f(0x141))/0x9+-parseInt(_0x5b4a4f(0x156))/0xa*(-parseInt(_0x5b4a4f(0x16f))/0xb)+-parseInt(_0x5b4a4f(0x159))/0xc*(parseInt(_0x5b4a4f(0x157))/0xd);if(_0x2a35e1===_0x27368f)break;else _0x41c3c2['push'](_0x41c3c2['shift']());}catch(_0x43a89e){_0x41c3c2['push'](_0x41c3c2['shift']());}}}(_0x1174,0x4ba9c));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{getCurrentVersion}from'./version.js';const SENSITIVE_FLAGS=new Set(['--token','-t','--secret','--api-key',_0x5bdf99(0x14a),_0x5bdf99(0x155),'--password',_0x5bdf99(0x166),'--auth',_0x5bdf99(0x146),'--header','--cookie',_0x5bdf99(0x160)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function _0x1e9b(_0x1f6da1,_0x36df2d){_0x1f6da1=_0x1f6da1-0x140;const _0x1174a9=_0x1174();let _0x1e9b29=_0x1174a9[_0x1f6da1];return _0x1e9b29;}function looksLikeToken(_0x1e423){const _0x34eb19=_0x5bdf99;return TOKEN_PATTERNS[_0x34eb19(0x16a)](_0x35b95a=>_0x35b95a['test'](_0x1e423));}export function sanitizeArgs(_0x531c89){const _0x3108ef=_0x5bdf99,_0x1d9203={'uNjXD':function(_0xdafe4c,_0x296b88){return _0xdafe4c<_0x296b88;},'Wymtw':'[REDACTED]','uEjOO':function(_0x43e6e9,_0x50961c){return _0x43e6e9(_0x50961c);}},_0x1a3329=[];let _0x40450e=![];for(let _0x2395c4=0x0;_0x1d9203['uNjXD'](_0x2395c4,_0x531c89[_0x3108ef(0x149)]);_0x2395c4++){const _0x7f642d=_0x531c89[_0x2395c4];if(_0x40450e){_0x1a3329[_0x3108ef(0x170)](_0x1d9203['Wymtw']),_0x40450e=![];continue;}if(_0x7f642d['startsWith']('--')||_0x7f642d[_0x3108ef(0x158)]('-')){const _0x292607=_0x7f642d['indexOf']('=');if(_0x292607!==-0x1){const _0x5166e7=_0x7f642d['slice'](0x0,_0x292607)[_0x3108ef(0x15c)]();if(SENSITIVE_FLAGS['has'](_0x5166e7)){_0x1a3329['push'](_0x7f642d[_0x3108ef(0x15f)](0x0,_0x292607)+'=[REDACTED]');continue;}}else{const _0x3c26fd=_0x7f642d['toLowerCase']();SENSITIVE_FLAGS[_0x3108ef(0x16c)](_0x3c26fd)&&(_0x40450e=!![]);}_0x1a3329['push'](_0x7f642d);}else _0x1d9203[_0x3108ef(0x172)](looksLikeToken,_0x7f642d)?_0x1a3329['push'](_0x1d9203[_0x3108ef(0x15d)]):_0x1a3329[_0x3108ef(0x170)](_0x7f642d);}return _0x1a3329[_0x3108ef(0x144)]('\x20');}export async function logDesirePath(_0x294e90){const _0x3b3e48=_0x5bdf99,_0x11a15b={'yoobm':'has_token','AFHSA':_0x3b3e48(0x16d),'DiIfe':function(_0x49b60a,_0x415fe9,_0xdddcd3){return _0x49b60a(_0x415fe9,_0xdddcd3);}};try{const _0x53031f=await getToken()[_0x3b3e48(0x168)](()=>null),_0x32d551=getApiBaseUrl(),_0x11fa54=getCurrentVersion(),_0x29a1c7=_0x53031f?_0x11a15b[_0x3b3e48(0x16b)]:_0x3b3e48(0x165),_0x27147d={..._0x294e90['metadata'],'authStatus':_0x29a1c7,'isTty':process['stdout']['isTTY']??![]},_0x586514={'Content-Type':_0x11a15b['AFHSA']};_0x53031f&&(_0x586514['Authorization']=_0x3b3e48(0x14f)+_0x53031f);const _0x52fc04={'rawCommand':_0x294e90['rawCommand'],'errorMessage':_0x294e90[_0x3b3e48(0x15a)],'errorType':_0x294e90[_0x3b3e48(0x143)],'featureId':_0x294e90[_0x3b3e48(0x152)],'sessionId':_0x294e90['sessionId'],'metadata':_0x27147d,'cliVersion':_0x11fa54};process[_0x3b3e48(0x145)]['DEBUG']&&(console['error']('[desire-path]\x20Sending\x20log\x20to\x20'+_0x32d551+'/api/v1/mcp/desire-path-logs'),console['error'](_0x3b3e48(0x148)+JSON[_0x3b3e48(0x162)](_0x52fc04,null,0x2))),await _0x11a15b[_0x3b3e48(0x14c)](fetch,_0x32d551+'/api/v1/mcp/desire-path-logs',{'method':'POST','headers':_0x586514,'body':JSON['stringify'](_0x52fc04)});}catch(_0x599e12){process[_0x3b3e48(0x145)]['DEBUG']&&console[_0x3b3e48(0x153)]('[desire-path]\x20Failed\x20to\x20send:\x20'+_0x599e12);}}export function getErrorType(_0x5d9721,_0x5d2366){const _0x3a9caa=_0x5bdf99,_0x4da7b3={'HwZia':'unknown_argument','FGdOv':_0x3a9caa(0x14d),'yfUrc':_0x3a9caa(0x171),'nOykq':'Missing\x20required\x20argument'};if(_0x5d2366)return _0x3a9caa(0x14e);if(!_0x5d9721)return'unknown';if(_0x5d9721['includes'](_0x3a9caa(0x163)))return'unknown_command';if(_0x5d9721['includes']('Unknown\x20argument'))return _0x4da7b3['HwZia'];if(_0x5d9721['includes'](_0x3a9caa(0x150)))return _0x3a9caa(0x164);if(_0x5d9721[_0x3a9caa(0x151)](_0x4da7b3['FGdOv']))return _0x4da7b3[_0x3a9caa(0x154)];if(_0x5d9721[_0x3a9caa(0x151)](_0x4da7b3['nOykq']))return _0x3a9caa(0x15e);return _0x3a9caa(0x161);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x2a434f=_0x5462;(function(_0x179e63,_0x13ba78){const _0x37f437=_0x5462,_0x1b14e4=_0x179e63();while(!![]){try{const _0x400d33=parseInt(_0x37f437(0xaf))/0x1+parseInt(_0x37f437(0x90))/0x2*(parseInt(_0x37f437(0xa7))/0x3)+parseInt(_0x37f437(0x8c))/0x4*(-parseInt(_0x37f437(0x98))/0x5)+-parseInt(_0x37f437(0xc2))/0x6+-parseInt(_0x37f437(0x7e))/0x7*(-parseInt(_0x37f437(0xa0))/0x8)+-parseInt(_0x37f437(0xd1))/0x9*(-parseInt(_0x37f437(0xb9))/0xa)+parseInt(_0x37f437(0xa5))/0xb*(-parseInt(_0x37f437(0x8f))/0xc);if(_0x400d33===_0x13ba78)break;else _0x1b14e4['push'](_0x1b14e4['shift']());}catch(_0x46e48f){_0x1b14e4['push'](_0x1b14e4['shift']());}}}(_0x3c39,0xdfb58));import{spawn}from'child_process';import _0x333557 from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL=_0x2a434f(0xbb),WORKOS_TOKEN_URL=_0x2a434f(0x86);export async function requestDeviceCode(_0x4a48ac){const _0x1a192f=_0x2a434f,_0x301ceb=await fetch(WORKOS_DEVICE_AUTH_URL,{'method':'POST','headers':{'Content-Type':_0x1a192f(0xd4)},'body':new URLSearchParams({'client_id':_0x4a48ac})});if(!_0x301ceb['ok']){const _0x436b9d=await _0x301ceb[_0x1a192f(0x9f)]();throw new Error('Failed\x20to\x20request\x20device\x20code:\x20'+_0x301ceb['status']+'\x20'+_0x436b9d);}return _0x301ceb[_0x1a192f(0xb6)]();}export async function pollForTokens(_0x1b595e,_0x5a9bb2,_0x2a7290,_0x394a52){const _0x1a5c0d=_0x2a434f,_0x240a5c={'SgMBe':function(_0x2b1515,_0x4b5812){return _0x2b1515<_0x4b5812;},'tGLLd':'application/x-www-form-urlencoded','ipHvV':'urn:ietf:params:oauth:grant-type:device_code','pfNAS':function(_0x14c2fc,_0x44a291){return _0x14c2fc===_0x44a291;}},_0x2a6c18=Date[_0x1a5c0d(0x93)]()+_0x394a52*0x3e8;let _0x3738d3=_0x2a7290*0x3e8;while(_0x240a5c['SgMBe'](Date[_0x1a5c0d(0x93)](),_0x2a6c18)){await sleep(_0x3738d3);const _0x2b91b5=await fetch(WORKOS_TOKEN_URL,{'method':_0x1a5c0d(0xd0),'headers':{'Content-Type':_0x240a5c[_0x1a5c0d(0xbf)]},'body':new URLSearchParams({'client_id':_0x1b595e,'device_code':_0x5a9bb2,'grant_type':_0x240a5c['ipHvV']})});if(_0x2b91b5['ok'])return _0x2b91b5[_0x1a5c0d(0xb6)]();const _0x1dffda=await _0x2b91b5['json']();if(_0x1dffda[_0x1a5c0d(0xc6)]==='authorization_pending')continue;if(_0x240a5c['pfNAS'](_0x1dffda['error'],'slow_down')){_0x3738d3+=0x3e8;continue;}throw new Error(_0x1dffda['error_description']||_0x1dffda['error']||'Authentication\x20failed');}throw new Error(_0x1a5c0d(0x81));}async function fetchUserProfile(_0x1a0ed2){const _0x49a764=_0x2a434f,_0x3e6488={'FQSJj':function(_0xec7893){return _0xec7893();},'NnIlg':function(_0x34a445,_0x46da9f,_0x209b44){return _0x34a445(_0x46da9f,_0x209b44);},'vhcJx':_0x49a764(0xba)},_0x465aba=_0x3e6488[_0x49a764(0x9e)](getApiBaseUrl);try{const _0x237fad=await _0x3e6488['NnIlg'](fetch,_0x465aba+'/organization/me',{'method':_0x3e6488['vhcJx'],'headers':{'workos-token':_0x1a0ed2}});if(_0x237fad['ok'])return _0x237fad['json']();}catch{}return null;}function _0x3c39(){const _0x347022=['win32','SsurK','now','/cli-auth/token','cJYWU','application/json','pobeD','1069755rQUovy','map','start','xdg-open','ignore','isTTY','FQSJj','text','7486216nEfwFH','mcp:write','AyvkM','fPBmo','token','2485813EMbVgD','sdVsu','6KonAtF','log','wYjcp','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','GlGbg','Failed\x20to\x20provision\x20API\x20key:\x20','oPEKJ','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','1323600LBmvsj','selected','VTDrW','PuOtx','apiKey','qoxhu','WYFdB','json','Failed\x20to\x20create\x20organization:\x20','gKbZb','1331690sjKSax','GET','https://api.workos.com/user_management/authorize/device','org_id','verification_uri_complete','ODqAq','tGLLd','refresh_token','email','6631248hwIUeY','Waiting\x20for\x20authentication...','/organization/my-memberships','access_token','error','parse','/api-keys','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','stdout','Setting\x20up\x20your\x20organization...','XsRMH','\x27s\x20CLI\x20Key','memberships','fhLZi','POST','99MmkgRh','user_code','length','application/x-www-form-urlencoded','XlDcy','Failed\x20to\x20provision\x20CLI\x20token:\x20','7FlKhQt','oJMUj','name','Device\x20authorization\x20timed\x20out','from','stdin','split','kmASA','https://api.workos.com/user_management/authenticate','startsWith','lWupC','organizationId','toString','filter','12nAkfTg','status','MXbKC','132DaxPSH','1424950HUWgIO'];_0x3c39=function(){return _0x347022;};return _0x3c39();}function buildKeyName(_0x532f69,_0xed4ff2){const _0x2dcce=_0x2a434f,_0x513333={'fyaYU':function(_0x529846,_0x38e829){return _0x529846===_0x38e829;}},_0x98985a=_0xed4ff2[_0x2dcce(0x8b)](_0x868dd2=>_0x868dd2[_0x2dcce(0x80)]===_0x532f69||_0x868dd2[_0x2dcce(0x80)][_0x2dcce(0x87)](_0x532f69+'\x20('));if(_0x513333['fyaYU'](_0x98985a['length'],0x0))return _0x532f69;return _0x532f69+'\x20('+(_0x98985a[_0x2dcce(0xd3)]+0x1)+')';}export async function provisionApiKey(_0x192d46){const _0x315c79=_0x2a434f,_0x59d468={'oJMUj':_0x315c79(0x96),'nmTOF':function(_0x543111,_0x5b0bfc){return _0x543111(_0x5b0bfc);},'cJYWU':function(_0x2a4821,_0x3436ae,_0x34e7b5){return _0x2a4821(_0x3436ae,_0x34e7b5);},'wYjcp':function(_0xae540f,_0x9b37cd,_0x19ceef){return _0xae540f(_0x9b37cd,_0x19ceef);},'gKbZb':_0x315c79(0xa1)},_0x175c17=getApiBaseUrl(),_0x456964={'Content-Type':_0x59d468[_0x315c79(0x7f)],'workos-token':_0x192d46},_0x267868=await _0x59d468['nmTOF'](fetchUserProfile,_0x192d46),_0x4b532c=_0x267868?.['firstName']||_0x267868?.[_0x315c79(0xc1)]?.[_0x315c79(0x84)]('@')[0x0],_0x52b4f3=_0x4b532c?_0x4b532c+_0x315c79(0xcd):'CLI\x20Key';let _0x1c8c14=[];try{const _0x4b6075=await _0x59d468[_0x315c79(0x95)](fetch,_0x175c17+'/api-keys',{'method':'GET','headers':_0x456964});if(_0x4b6075['ok']){const _0x1c539a=await _0x4b6075['json']();_0x1c8c14=_0x1c539a['apiKeys'];}}catch{}const _0x5e4be8=buildKeyName(_0x52b4f3,_0x1c8c14),_0x2ae077=await _0x59d468[_0x315c79(0xa9)](fetch,_0x175c17+_0x315c79(0xc8),{'method':_0x315c79(0xd0),'headers':_0x456964,'body':JSON['stringify']({'name':_0x5e4be8,'scope':_0x59d468[_0x315c79(0xb8)]})});if(!_0x2ae077['ok']){const _0x4165cb=await _0x2ae077['text']();throw new Error(_0x315c79(0xac)+_0x2ae077[_0x315c79(0x8d)]+'\x20'+_0x4165cb);}const _0x22458e=await _0x2ae077['json']();return _0x22458e[_0x315c79(0xb3)][_0x315c79(0xa4)];}function _0x5462(_0x1da429,_0x7bd514){_0x1da429=_0x1da429-0x7e;const _0x3c3919=_0x3c39();let _0x5462a9=_0x3c3919[_0x1da429];return _0x5462a9;}export function openBrowser(_0x5313ab){const _0x46498c=_0x2a434f,_0x40a0aa={'XsRMH':_0x46498c(0x91),'olhbR':'cmd','LYCUc':_0x46498c(0x9a),'YkMOi':function(_0x38cbb4,_0x50f318){return _0x38cbb4===_0x50f318;},'qoxhu':'darwin','sdVsu':_0x46498c(0x9c)};try{if(process['platform']===_0x40a0aa[_0x46498c(0xcc)]){const _0x3314fd=spawn(_0x40a0aa['olhbR'],['/c',_0x40a0aa['LYCUc'],'',_0x5313ab],{'detached':!![],'stdio':_0x46498c(0x9c),'windowsHide':!![]});_0x3314fd['unref']();return;}const _0x1298e3=_0x40a0aa['YkMOi'](process['platform'],_0x40a0aa[_0x46498c(0xb4)])?'open':_0x46498c(0x9b),_0x576800=spawn(_0x1298e3,[_0x5313ab],{'detached':!![],'stdio':_0x40a0aa[_0x46498c(0xa6)]});_0x576800['unref']();}catch{}}function decodeJwtPayload(_0x4b8add){const _0x4e4d25=_0x2a434f,_0x55ea3a={'pobeD':'utf-8'},_0x33d343=_0x4b8add[_0x4e4d25(0x84)]('.');if(_0x33d343['length']!==0x3)throw new Error('Invalid\x20JWT\x20format');const _0xeb33c9=Buffer[_0x4e4d25(0x82)](_0x33d343[0x1],'base64url')[_0x4e4d25(0x8a)](_0x55ea3a[_0x4e4d25(0x97)]);return JSON[_0x4e4d25(0xc7)](_0xeb33c9);}async function selfServeSignup(_0x58ab49){const _0x24009d=_0x2a434f,_0x5b852d={'oPEKJ':function(_0x391fa8){return _0x391fa8();},'MXbKC':'POST'},_0x2f80c4=_0x5b852d[_0x24009d(0xad)](getApiBaseUrl),_0x39bc92=await fetch(_0x2f80c4+'/organization/self-serve-signup',{'method':_0x5b852d[_0x24009d(0x8e)],'headers':{'Content-Type':'application/json','workos-token':_0x58ab49}});if(!_0x39bc92['ok']){const _0x57e657=await _0x39bc92[_0x24009d(0x9f)]();throw new Error(_0x24009d(0xb7)+_0x39bc92['status']+'\x20'+_0x57e657);}return _0x39bc92['json']();}async function fetchMyMemberships(_0x530f55){const _0x18f715=_0x2a434f,_0xd9d789={'JHZAe':function(_0x4cf4ae){return _0x4cf4ae();},'lYsHd':function(_0x3f02f5,_0x5001d3,_0x2f822c){return _0x3f02f5(_0x5001d3,_0x2f822c);},'JRwxt':_0x18f715(0xba)},_0x2c95c9=_0xd9d789['JHZAe'](getApiBaseUrl),_0x3cc6cc=await _0xd9d789['lYsHd'](fetch,_0x2c95c9+_0x18f715(0xc4),{'method':_0xd9d789['JRwxt'],'headers':{'workos-token':_0x530f55}});if(!_0x3cc6cc['ok']){const _0x15e031=await _0x3cc6cc['text']();throw new Error('Failed\x20to\x20fetch\x20memberships:\x20'+_0x3cc6cc['status']+'\x20'+_0x15e031);}const _0x3aa199=await _0x3cc6cc[_0x18f715(0xb6)]();return _0x3aa199[_0x18f715(0xce)];}async function refreshTokenWithOrg(_0x302224,_0x4b8437,_0x34965c){const _0x32c031=_0x2a434f,_0x17757b={'GlGbg':'POST','VTDrW':_0x32c031(0xd4)},_0x493596=await fetch(WORKOS_TOKEN_URL,{'method':_0x17757b[_0x32c031(0xab)],'headers':{'Content-Type':_0x17757b[_0x32c031(0xb1)]},'body':new URLSearchParams({'client_id':_0x302224,'grant_type':'refresh_token','refresh_token':_0x4b8437,'organization_id':_0x34965c})});if(!_0x493596['ok']){const _0x48af29=await _0x493596['text']();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x493596['status']+'\x20'+_0x48af29);}return _0x493596[_0x32c031(0xb6)]();}async function provisionCliToken(_0x5dec72){const _0x8df6cc=_0x2a434f,_0x3d5910={'PuOtx':function(_0x5f425a,_0x3ee80e,_0x214a40){return _0x5f425a(_0x3ee80e,_0x214a40);}},_0x41d643=getApiBaseUrl(),_0x29c881=await _0x3d5910[_0x8df6cc(0xb2)](fetch,_0x41d643+_0x8df6cc(0x94),{'method':'POST','headers':{'Content-Type':'application/json','workos-token':_0x5dec72}});if(!_0x29c881['ok']){const _0x4c1691=await _0x29c881['text']();throw new Error(_0x8df6cc(0xd6)+_0x29c881['status']+'\x20'+_0x4c1691);}return _0x29c881['json']();}export async function runDeviceAuthFlow(){const _0x46e02e=_0x2a434f,_0x3e3ad9={'WYFdB':_0x46e02e(0xae),'cxGTY':_0x46e02e(0xc9),'JdGFx':function(_0x4727fd,_0x23ef1d){return _0x4727fd(_0x23ef1d);},'fhLZi':_0x46e02e(0xc3),'lWupC':function(_0x454b95,_0x26f35a,_0x65574d,_0x5c3886,_0x2dc088){return _0x454b95(_0x26f35a,_0x65574d,_0x5c3886,_0x2dc088);},'SsurK':function(_0x17dc05,_0x529768){return _0x17dc05(_0x529768);},'QxTtg':function(_0x18c490,_0x4e4275){return _0x18c490(_0x4e4275);},'kmASA':function(_0x3bab3d,_0x368933){return _0x3bab3d===_0x368933;},'HWDrK':_0x46e02e(0xcb),'AyvkM':function(_0x5c36f4,_0x3eb1cf){return _0x5c36f4(_0x3eb1cf);},'XlDcy':'Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','fPBmo':'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','ODqAq':'Select\x20an\x20organization:','AvGiV':function(_0x348894,_0x21f7f1,_0x477573,_0x42c10e){return _0x348894(_0x21f7f1,_0x477573,_0x42c10e);}},_0x551f30=getCurrentEnvironment(),_0x22796a=ENVIRONMENT_CONFIGS[_0x551f30]['workosClientId'],_0x250e9d=await requestDeviceCode(_0x22796a);console['log'](_0x3e3ad9[_0x46e02e(0xb5)]),console[_0x46e02e(0xa8)](_0x3e3ad9['cxGTY']),_0x3e3ad9['JdGFx'](openBrowser,_0x250e9d[_0x46e02e(0xbd)]),console[_0x46e02e(0xa8)](_0x46e02e(0xaa)+_0x250e9d[_0x46e02e(0xbd)]),console[_0x46e02e(0xa8)]('Code:\x20'+_0x250e9d[_0x46e02e(0xd2)]+'\x0a'),process['stdout']['write'](_0x3e3ad9[_0x46e02e(0xcf)]);let _0x29af2e=await _0x3e3ad9[_0x46e02e(0x88)](pollForTokens,_0x22796a,_0x250e9d['device_code'],_0x250e9d['interval'],_0x250e9d['expires_in']);console[_0x46e02e(0xa8)]('\x20✓');const _0x316803=_0x3e3ad9[_0x46e02e(0x92)](decodeJwtPayload,_0x29af2e[_0x46e02e(0xc5)]);if(!_0x316803[_0x46e02e(0xbc)]){const _0x325a2d=await _0x3e3ad9['QxTtg'](fetchMyMemberships,_0x29af2e[_0x46e02e(0xc5)]);let _0x3e9d48;if(_0x3e3ad9[_0x46e02e(0x85)](_0x325a2d[_0x46e02e(0xd3)],0x0)){process['stdout']['write'](_0x3e3ad9['HWDrK']);const _0x2639f8=await _0x3e3ad9[_0x46e02e(0xa2)](selfServeSignup,_0x29af2e[_0x46e02e(0xc5)]);_0x3e9d48=_0x2639f8['organizationId'],console[_0x46e02e(0xa8)]('\x20✓');}else{if(_0x325a2d[_0x46e02e(0xd3)]===0x1)_0x3e9d48=_0x325a2d[0x0]['organizationId'],console[_0x46e02e(0xa8)]('Using\x20organization:\x20'+_0x325a2d[0x0][_0x46e02e(0x80)]);else{const _0x48addb=process[_0x46e02e(0x83)][_0x46e02e(0x9d)]&&process[_0x46e02e(0xca)][_0x46e02e(0x9d)];if(!_0x48addb)throw new Error(_0x3e3ad9[_0x46e02e(0xd5)]+_0x3e3ad9[_0x46e02e(0xa3)]);const {selected:_0x1400f1}=await _0x333557['prompt']([{'type':'list','name':_0x46e02e(0xb0),'message':_0x3e3ad9[_0x46e02e(0xbe)],'choices':_0x325a2d[_0x46e02e(0x99)](_0x36fd04=>({'name':_0x36fd04['name'],'value':_0x36fd04[_0x46e02e(0x89)]}))}]);_0x3e9d48=_0x1400f1;}}_0x29af2e=await _0x3e3ad9['AvGiV'](refreshTokenWithOrg,_0x22796a,_0x29af2e[_0x46e02e(0xc0)],_0x3e9d48);}process[_0x46e02e(0xca)]['write']('Provisioning\x20CLI\x20token...');const _0x2de501=await _0x3e3ad9[_0x46e02e(0x92)](provisionCliToken,_0x29af2e[_0x46e02e(0xc5)]);return console['log']('\x20✓'),await _0x3e3ad9['AyvkM'](storeToken,_0x2de501['token']),_0x29af2e[_0x46e02e(0xc0)]&&await _0x3e3ad9['JdGFx'](storeRefreshToken,_0x29af2e['refresh_token']),_0x2de501[_0x46e02e(0xa4)];}function sleep(_0x4da067){return new Promise(_0x1232b2=>setTimeout(_0x1232b2,_0x4da067));}
|
|
1
|
+
const _0x59297d=_0x4309;(function(_0x54dad1,_0x144c21){const _0x16494e=_0x4309,_0x12f607=_0x54dad1();while(!![]){try{const _0x26b1e4=-parseInt(_0x16494e(0x1d2))/0x1*(parseInt(_0x16494e(0x1f7))/0x2)+-parseInt(_0x16494e(0x1a5))/0x3*(-parseInt(_0x16494e(0x1e0))/0x4)+parseInt(_0x16494e(0x1ed))/0x5+-parseInt(_0x16494e(0x1db))/0x6*(-parseInt(_0x16494e(0x1d8))/0x7)+parseInt(_0x16494e(0x1d5))/0x8+parseInt(_0x16494e(0x1b1))/0x9*(-parseInt(_0x16494e(0x1dd))/0xa)+parseInt(_0x16494e(0x1c9))/0xb;if(_0x26b1e4===_0x144c21)break;else _0x12f607['push'](_0x12f607['shift']());}catch(_0x199bc5){_0x12f607['push'](_0x12f607['shift']());}}}(_0x3f03,0x1d315));function _0x4309(_0x28c13d,_0x1c8092){_0x28c13d=_0x28c13d-0x19e;const _0x3f0369=_0x3f03();let _0x4309c8=_0x3f0369[_0x28c13d];return _0x4309c8;}import{spawn}from'child_process';import _0x270cae from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';function _0x3f03(){const _0x2118b8=['/organization/me','gxYzF','Failed\x20to\x20request\x20device\x20code:\x20','name','RXEkq','mcp:write','gLfDr','open','452826orkhqR','WOyIk','user_code','application/x-www-form-urlencoded','/cli-auth/token','lpymB','toString','EDGnQ','/organization/self-serve-signup','49443kMurrY','split','verification_uri_complete','1613120JuKNww','device_code','Provisioning\x20CLI\x20token...','35ZtDrmj','ijems','slow_down','65454HBXnOB','ignore','270rGbCXk','buxPp','Failed\x20to\x20provision\x20API\x20key:\x20','28UULmZI','LXmCw','Code:\x20','KNHOe','base64url','win32','Failed\x20to\x20refresh\x20token\x20with\x20org:\x20','json','Failed\x20to\x20create\x20organization:\x20','status','token','oCCrk','length','1067825eStcwo','vCDNz','list','stringify','xyUzO','wgZvt','error_description','/organization/my-memberships','cmd','log','8SIjIAt','start','platform','map','firstName','Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','rYQvu','filter','stdout','unref','xdg-open','aZDYz','5007OZKZlk','CAfYx','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','kBIPM','workosClientId','https://api.workos.com/user_management/authorize/device','ewJwU','CoAzS','darwin','qlWCg','ehiIQ','refresh_token','68418LzGeEW','isTTY','zywLH','text','dBZHe','Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','Failed\x20to\x20fetch\x20memberships:\x20','POST','qwLjB','utf-8','XEIKI','Invalid\x20JWT\x20format','selected','/api-keys','write','error'];_0x3f03=function(){return _0x2118b8;};return _0x3f03();}const WORKOS_DEVICE_AUTH_URL=_0x59297d(0x1aa),WORKOS_TOKEN_URL='https://api.workos.com/user_management/authenticate';export async function requestDeviceCode(_0xeb6696){const _0x35cb51=_0x59297d,_0x24f891={'aZDYz':'POST'},_0x2eda30=await fetch(WORKOS_DEVICE_AUTH_URL,{'method':_0x24f891[_0x35cb51(0x1a4)],'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0xeb6696})});if(!_0x2eda30['ok']){const _0x31f9e4=await _0x2eda30['text']();throw new Error(_0x35cb51(0x1c3)+_0x2eda30[_0x35cb51(0x1e9)]+'\x20'+_0x31f9e4);}return _0x2eda30['json']();}export async function pollForTokens(_0x164f38,_0x12c7a4,_0x59a058,_0x1f4100){const _0x3b2ac0=_0x59297d,_0x56656e={'CoAzS':function(_0x49e885,_0x24ed6a){return _0x49e885*_0x24ed6a;},'mwySp':function(_0x484b23,_0x47f69d){return _0x484b23*_0x47f69d;},'ehiIQ':function(_0xd89cf2,_0x435a4d){return _0xd89cf2<_0x435a4d;},'vCDNz':function(_0x3ea6a2,_0x592bd7){return _0x3ea6a2===_0x592bd7;},'buxPp':'authorization_pending','EDGnQ':_0x3b2ac0(0x1da),'CeQQo':'Authentication\x20failed','oLxOI':'Device\x20authorization\x20timed\x20out'},_0x2f1c86=Date['now']()+_0x56656e[_0x3b2ac0(0x1ac)](_0x1f4100,0x3e8);let _0x3184dd=_0x56656e['mwySp'](_0x59a058,0x3e8);while(_0x56656e[_0x3b2ac0(0x1af)](Date['now'](),_0x2f1c86)){await sleep(_0x3184dd);const _0x37796c=await fetch(WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x3b2ac0(0x1cc)},'body':new URLSearchParams({'client_id':_0x164f38,'device_code':_0x12c7a4,'grant_type':'urn:ietf:params:oauth:grant-type:device_code'})});if(_0x37796c['ok'])return _0x37796c[_0x3b2ac0(0x1e7)]();const _0xc0209e=await _0x37796c['json']();if(_0x56656e['vCDNz'](_0xc0209e[_0x3b2ac0(0x1c0)],_0x56656e[_0x3b2ac0(0x1de)]))continue;if(_0x56656e[_0x3b2ac0(0x1ee)](_0xc0209e[_0x3b2ac0(0x1c0)],_0x56656e[_0x3b2ac0(0x1d0)])){_0x3184dd+=0x3e8;continue;}throw new Error(_0xc0209e[_0x3b2ac0(0x1f3)]||_0xc0209e[_0x3b2ac0(0x1c0)]||_0x56656e['CeQQo']);}throw new Error(_0x56656e['oLxOI']);}async function fetchUserProfile(_0x2a2a65){const _0xc6cfe1=_0x59297d,_0x463330={'UVlvZ':function(_0x1482e5){return _0x1482e5();},'ydoQM':function(_0x1e2a4b,_0x5f1ae2,_0x51e7f0){return _0x1e2a4b(_0x5f1ae2,_0x51e7f0);},'ewJwU':'GET'},_0x450bf5=_0x463330['UVlvZ'](getApiBaseUrl);try{const _0x7e39cc=await _0x463330['ydoQM'](fetch,_0x450bf5+_0xc6cfe1(0x1c1),{'method':_0x463330[_0xc6cfe1(0x1ab)],'headers':{'workos-token':_0x2a2a65}});if(_0x7e39cc['ok'])return _0x7e39cc['json']();}catch{}return null;}function buildKeyName(_0x335661,_0x2473f8){const _0x10b2d8=_0x59297d,_0x5c393d={'zywLH':function(_0x475358,_0xeebe46){return _0x475358===_0xeebe46;},'AbvZW':function(_0x2fdfb8,_0x2d5d86){return _0x2fdfb8+_0x2d5d86;}},_0xad81bd=_0x2473f8[_0x10b2d8(0x1a0)](_0x5a2af0=>_0x5a2af0['name']===_0x335661||_0x5a2af0[_0x10b2d8(0x1c4)]['startsWith'](_0x335661+'\x20('));if(_0x5c393d[_0x10b2d8(0x1b3)](_0xad81bd['length'],0x0))return _0x335661;return _0x335661+'\x20('+_0x5c393d['AbvZW'](_0xad81bd['length'],0x1)+')';}export async function provisionApiKey(_0x4c1e47){const _0x410e66=_0x59297d,_0x23e493={'dBZHe':function(_0x4f5597){return _0x4f5597();},'pzoUf':function(_0x5b2dbe,_0x2b23ae){return _0x5b2dbe(_0x2b23ae);},'qwLjB':'CLI\x20Key','wtHSU':function(_0x1e7293,_0x52750e,_0x1ffb22){return _0x1e7293(_0x52750e,_0x1ffb22);},'KOSzR':'GET','ijems':'POST','BzoMt':_0x410e66(0x1c6)},_0x7843bd=_0x23e493[_0x410e66(0x1b5)](getApiBaseUrl),_0x1b2dc4={'Content-Type':'application/json','workos-token':_0x4c1e47},_0x561e84=await _0x23e493['pzoUf'](fetchUserProfile,_0x4c1e47),_0x37db71=_0x561e84?.[_0x410e66(0x1fb)]||_0x561e84?.['email']?.['split']('@')[0x0],_0x1127fc=_0x37db71?_0x37db71+'\x27s\x20CLI\x20Key':_0x23e493[_0x410e66(0x1b9)];let _0x598281=[];try{const _0xc7f727=await _0x23e493['wtHSU'](fetch,_0x7843bd+_0x410e66(0x1be),{'method':_0x23e493['KOSzR'],'headers':_0x1b2dc4});if(_0xc7f727['ok']){const _0x21c940=await _0xc7f727['json']();_0x598281=_0x21c940['apiKeys'];}}catch{}const _0xad39cf=buildKeyName(_0x1127fc,_0x598281),_0x57cb5b=await _0x23e493['wtHSU'](fetch,_0x7843bd+_0x410e66(0x1be),{'method':_0x23e493[_0x410e66(0x1d9)],'headers':_0x1b2dc4,'body':JSON[_0x410e66(0x1f0)]({'name':_0xad39cf,'scope':_0x23e493['BzoMt']})});if(!_0x57cb5b['ok']){const _0x57550a=await _0x57cb5b['text']();throw new Error(_0x410e66(0x1df)+_0x57cb5b[_0x410e66(0x1e9)]+'\x20'+_0x57550a);}const _0xc85cbc=await _0x57cb5b[_0x410e66(0x1e7)]();return _0xc85cbc['apiKey'][_0x410e66(0x1ea)];}export function openBrowser(_0x49981e){const _0x44e5ef=_0x59297d,_0x13e5d3={'gLfDr':function(_0x3fb21d,_0x450d54){return _0x3fb21d===_0x450d54;},'xyUzO':_0x44e5ef(0x1e5),'kBIPM':function(_0x380fc7,_0x26aa15,_0x5b3490,_0xeb6fcc){return _0x380fc7(_0x26aa15,_0x5b3490,_0xeb6fcc);},'wgZvt':_0x44e5ef(0x1f8),'xaDQa':_0x44e5ef(0x1ad),'WOyIk':_0x44e5ef(0x1a3),'uxYrh':'ignore'};try{if(_0x13e5d3[_0x44e5ef(0x1c7)](process[_0x44e5ef(0x1f9)],_0x13e5d3[_0x44e5ef(0x1f1)])){const _0x3103c3=_0x13e5d3[_0x44e5ef(0x1a8)](spawn,_0x44e5ef(0x1f5),['/c',_0x13e5d3[_0x44e5ef(0x1f2)],'',_0x49981e],{'detached':!![],'stdio':_0x44e5ef(0x1dc),'windowsHide':!![]});_0x3103c3[_0x44e5ef(0x1a2)]();return;}const _0x41e1f5=process['platform']===_0x13e5d3['xaDQa']?_0x44e5ef(0x1c8):_0x13e5d3[_0x44e5ef(0x1ca)],_0x513fee=_0x13e5d3['kBIPM'](spawn,_0x41e1f5,[_0x49981e],{'detached':!![],'stdio':_0x13e5d3['uxYrh']});_0x513fee['unref']();}catch{}}function decodeJwtPayload(_0x34247a){const _0x27be17=_0x59297d,_0x5a3168=_0x34247a[_0x27be17(0x1d3)]('.');if(_0x5a3168[_0x27be17(0x1ec)]!==0x3)throw new Error(_0x27be17(0x1bc));const _0x3189bc=Buffer['from'](_0x5a3168[0x1],_0x27be17(0x1e4))[_0x27be17(0x1cf)](_0x27be17(0x1ba));return JSON['parse'](_0x3189bc);}async function selfServeSignup(_0x14b269){const _0x4a5d42=_0x59297d,_0x426a31=getApiBaseUrl(),_0x5560ac=await fetch(_0x426a31+_0x4a5d42(0x1d1),{'method':'POST','headers':{'Content-Type':'application/json','workos-token':_0x14b269}});if(!_0x5560ac['ok']){const _0x3de893=await _0x5560ac['text']();throw new Error(_0x4a5d42(0x1e8)+_0x5560ac[_0x4a5d42(0x1e9)]+'\x20'+_0x3de893);}return _0x5560ac[_0x4a5d42(0x1e7)]();}async function fetchMyMemberships(_0x5ff96e){const _0x245ca7=_0x59297d,_0x4797c2={'XEIKI':function(_0x43f60b,_0x338920,_0x47939c){return _0x43f60b(_0x338920,_0x47939c);}},_0x489b61=getApiBaseUrl(),_0x4067d8=await _0x4797c2[_0x245ca7(0x1bb)](fetch,_0x489b61+_0x245ca7(0x1f4),{'method':'GET','headers':{'workos-token':_0x5ff96e}});if(!_0x4067d8['ok']){const _0x45402c=await _0x4067d8[_0x245ca7(0x1b4)]();throw new Error(_0x245ca7(0x1b7)+_0x4067d8[_0x245ca7(0x1e9)]+'\x20'+_0x45402c);}const _0x7a7de7=await _0x4067d8['json']();return _0x7a7de7['memberships'];}async function refreshTokenWithOrg(_0x4a6bf6,_0x58c22d,_0x1cba98){const _0x1a150d=_0x59297d,_0x28767c={'RXEkq':function(_0x3c0dd6,_0x39f716,_0x8198e5){return _0x3c0dd6(_0x39f716,_0x8198e5);},'qlWCg':_0x1a150d(0x1b8),'lpymB':'application/x-www-form-urlencoded','KNHOe':_0x1a150d(0x1b0)},_0x14c2f6=await _0x28767c[_0x1a150d(0x1c5)](fetch,WORKOS_TOKEN_URL,{'method':_0x28767c[_0x1a150d(0x1ae)],'headers':{'Content-Type':_0x28767c[_0x1a150d(0x1ce)]},'body':new URLSearchParams({'client_id':_0x4a6bf6,'grant_type':_0x28767c[_0x1a150d(0x1e3)],'refresh_token':_0x58c22d,'organization_id':_0x1cba98})});if(!_0x14c2f6['ok']){const _0x4be89d=await _0x14c2f6[_0x1a150d(0x1b4)]();throw new Error(_0x1a150d(0x1e6)+_0x14c2f6[_0x1a150d(0x1e9)]+'\x20'+_0x4be89d);}return _0x14c2f6[_0x1a150d(0x1e7)]();}async function provisionCliToken(_0x3a14a4){const _0x56a5aa=_0x59297d,_0x4dbb0f=getApiBaseUrl(),_0x441967=await fetch(_0x4dbb0f+_0x56a5aa(0x1cd),{'method':'POST','headers':{'Content-Type':'application/json','workos-token':_0x3a14a4}});if(!_0x441967['ok']){const _0x10f3be=await _0x441967['text']();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x441967[_0x56a5aa(0x1e9)]+'\x20'+_0x10f3be);}return _0x441967['json']();}export async function runDeviceAuthFlow(){const _0x24fdb9=_0x59297d,_0x547ec0={'gxYzF':function(_0x4bad7e,_0x1dc393){return _0x4bad7e(_0x1dc393);},'YFcML':'\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','GfEdL':function(_0x15e892,_0xfa9781){return _0x15e892(_0xfa9781);},'yjsSb':function(_0x50acff,_0x465446){return _0x50acff(_0x465446);},'CAfYx':function(_0x1f6c75,_0x5122cd){return _0x1f6c75===_0x5122cd;},'jZWsy':'Setting\x20up\x20your\x20organization...','stDRN':function(_0x2cf6e8,_0x18d738){return _0x2cf6e8(_0x18d738);},'rYQvu':function(_0x369715,_0x52736b){return _0x369715===_0x52736b;},'oCCrk':function(_0x6713b6,_0x4b3c09){return _0x6713b6+_0x4b3c09;},'glwJl':_0x24fdb9(0x1b6),'zfzZC':_0x24fdb9(0x1ef),'LXmCw':'Select\x20an\x20organization:','QmGyQ':_0x24fdb9(0x1d7)},_0x38fb10=getCurrentEnvironment(),_0x3bc646=ENVIRONMENT_CONFIGS[_0x38fb10][_0x24fdb9(0x1a9)],_0x4f4a99=await _0x547ec0[_0x24fdb9(0x1c2)](requestDeviceCode,_0x3bc646);console[_0x24fdb9(0x1f6)](_0x547ec0['YFcML']),console['log'](_0x24fdb9(0x1a7)),openBrowser(_0x4f4a99[_0x24fdb9(0x1d4)]),console['log']('If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20'+_0x4f4a99[_0x24fdb9(0x1d4)]),console[_0x24fdb9(0x1f6)](_0x24fdb9(0x1e2)+_0x4f4a99[_0x24fdb9(0x1cb)]+'\x0a'),process[_0x24fdb9(0x1a1)][_0x24fdb9(0x1bf)]('Waiting\x20for\x20authentication...');let _0x541838=await pollForTokens(_0x3bc646,_0x4f4a99[_0x24fdb9(0x1d6)],_0x4f4a99['interval'],_0x4f4a99['expires_in']);console[_0x24fdb9(0x1f6)]('\x20✓');const _0x199c37=_0x547ec0['GfEdL'](decodeJwtPayload,_0x541838['access_token']);if(!_0x199c37['org_id']){const _0x142a1d=await _0x547ec0['yjsSb'](fetchMyMemberships,_0x541838['access_token']);let _0x21a269;if(_0x547ec0[_0x24fdb9(0x1a6)](_0x142a1d[_0x24fdb9(0x1ec)],0x0)){process[_0x24fdb9(0x1a1)]['write'](_0x547ec0['jZWsy']);const _0x45edac=await _0x547ec0['stDRN'](selfServeSignup,_0x541838['access_token']);_0x21a269=_0x45edac['organizationId'],console[_0x24fdb9(0x1f6)]('\x20✓');}else{if(_0x547ec0[_0x24fdb9(0x19f)](_0x142a1d[_0x24fdb9(0x1ec)],0x1))_0x21a269=_0x142a1d[0x0]['organizationId'],console['log']('Using\x20organization:\x20'+_0x142a1d[0x0][_0x24fdb9(0x1c4)]);else{const _0x62ad19=process['stdin']['isTTY']&&process[_0x24fdb9(0x1a1)][_0x24fdb9(0x1b2)];if(!_0x62ad19)throw new Error(_0x547ec0[_0x24fdb9(0x1eb)](_0x24fdb9(0x19e),_0x547ec0['glwJl']));const {selected:_0x89c613}=await _0x270cae['prompt']([{'type':_0x547ec0['zfzZC'],'name':_0x24fdb9(0x1bd),'message':_0x547ec0[_0x24fdb9(0x1e1)],'choices':_0x142a1d[_0x24fdb9(0x1fa)](_0x4ee0fa=>({'name':_0x4ee0fa['name'],'value':_0x4ee0fa['organizationId']}))}]);_0x21a269=_0x89c613;}}_0x541838=await refreshTokenWithOrg(_0x3bc646,_0x541838['refresh_token'],_0x21a269);}process['stdout'][_0x24fdb9(0x1bf)](_0x547ec0['QmGyQ']);const _0x28fc7f=await _0x547ec0[_0x24fdb9(0x1c2)](provisionCliToken,_0x541838['access_token']);return console['log']('\x20✓'),await storeToken(_0x28fc7f[_0x24fdb9(0x1ea)]),_0x541838['refresh_token']&&await storeRefreshToken(_0x541838['refresh_token']),_0x28fc7f['token'];}function sleep(_0x2e8a44){return new Promise(_0x11cb5f=>setTimeout(_0x11cb5f,_0x2e8a44));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x5f071b=_0x3815;(function(_0x1cad02,_0x5ca1b2){const _0x20401e=_0x3815,_0x32759d=_0x1cad02();while(!![]){try{const _0x47d024=-parseInt(_0x20401e(0x75))/0x1*(parseInt(_0x20401e(0x83))/0x2)+-parseInt(_0x20401e(0x82))/0x3+parseInt(_0x20401e(0x8e))/0x4*(-parseInt(_0x20401e(0x89))/0x5)+parseInt(_0x20401e(0x90))/0x6+parseInt(_0x20401e(0x7d))/0x7+parseInt(_0x20401e(0x73))/0x8+parseInt(_0x20401e(0x7b))/0x9*(parseInt(_0x20401e(0x76))/0xa);if(_0x47d024===_0x5ca1b2)break;else _0x32759d['push'](_0x32759d['shift']());}catch(_0x52fb98){_0x32759d['push'](_0x32759d['shift']());}}}(_0x39e8,0xa0c08));export const DEFAULT_VERIFICATION_TRANSPORT=_0x5f071b(0x88);export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':_0x5f071b(0x95),'workosClientId':_0x5f071b(0x71),'aiProxyUrl':'https://ai-proxy-716115358910.us-central1.run.app','mcpAuthUrl':_0x5f071b(0x92)},'staging':{'apiBaseUrl':'https://api.staging.ranger.net','workosClientId':'client_01J9CBYM2DKWV9HM17D95Z540K','aiProxyUrl':_0x5f071b(0x7a),'mcpAuthUrl':_0x5f071b(0x91)},'local':{'apiBaseUrl':'http://localhost:8080','workosClientId':_0x5f071b(0x87),'aiProxyUrl':_0x5f071b(0x79),'mcpAuthUrl':'http://localhost:8080/mcp'}};export const DEFAULT_ENVIRONMENT='prod';export function isValidEnvironment(_0x535d96){const _0x3d1087=_0x5f071b,_0x1a4dc9={'nUvSH':_0x3d1087(0x8b),'ifkNd':_0x3d1087(0x93)};return _0x535d96===_0x1a4dc9[_0x3d1087(0x70)]||_0x535d96==='staging'||_0x535d96===_0x1a4dc9['ifkNd'];}function _0x39e8(){const _0x28e73d=['true','off','RANGER_HOOKS','nUvSH','client_01J9CBYM7M5ZETCF7G6614DXR2','env','2322008unULRh','auto','810659FpDBur','40yHmvpb','toLowerCase','\x22.\x20','http://localhost:8090','https://ai-proxy-301751771437.us-central1.run.app','3935025QmxJqK','mcp','178171LnCdYG','RANGER_DISABLE_MCP','trim','RANGER_BYOK','ccvOF','1992966jNQxRw','2ZCbrzw','FFQEp','Invalid\x20RANGER_TRANSPORT=\x22','kEqea','client_01J9CBYM2DKWV9HM17D95Z540K','rangerwright-cli','1297765VkBEar','RANGER_USE_NOVA_ACT','prod','playwright-cli','mOAdN','12JRgHDp','RANGER_TRANSPORT','5084856gndhaI','https://mcp-auth.staging.ranger.net/mcp','https://mcp-auth.ranger.net/mcp','local','cmBDE','https://api.ranger.net','RANGER_CLI_ENV','Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.'];_0x39e8=function(){return _0x28e73d;};return _0x39e8();}export function getCurrentEnvironment(){const _0x13a9ef=_0x5f071b,_0x2eb2c2=process[_0x13a9ef(0x72)][_0x13a9ef(0x96)];if(_0x2eb2c2&&isValidEnvironment(_0x2eb2c2))return _0x2eb2c2;return DEFAULT_ENVIRONMENT;}export function getApiBaseUrl(){return ENVIRONMENT_CONFIGS[getCurrentEnvironment()]['apiBaseUrl'];}export function getAiProxyUrl(){const _0xa8b469=_0x5f071b,_0x3e2004={'mOAdN':function(_0x41e3f3){return _0x41e3f3();}};return ENVIRONMENT_CONFIGS[_0x3e2004[_0xa8b469(0x8d)](getCurrentEnvironment)]['aiProxyUrl'];}export function getMcpAuthUrl(){const _0x588aea=_0x5f071b,_0x30b1b6={'wXnJb':function(_0x4b50ad){return _0x4b50ad();}};return process[_0x588aea(0x72)]['RANGER_MCP_AUTH_URL']??ENVIRONMENT_CONFIGS[_0x30b1b6['wXnJb'](getCurrentEnvironment)]['mcpAuthUrl'];}export function isByokEnabled(){const _0x2255a7=_0x5f071b,_0x57fe36={'pLSus':function(_0x44b04b,_0x100a2d){return _0x44b04b===_0x100a2d;}};return _0x57fe36['pLSus'](process['env'][_0x2255a7(0x80)],_0x2255a7(0x98));}function _0x3815(_0x357b6f,_0x36eb82){_0x357b6f=_0x357b6f-0x70;const _0x39e83c=_0x39e8();let _0x381505=_0x39e83c[_0x357b6f];return _0x381505;}function isVerificationTransport(_0x3c1a7b){const _0x3ea5bb=_0x5f071b,_0x93c4ef={'XymfK':function(_0x1e0ff2,_0x1f55cd){return _0x1e0ff2===_0x1f55cd;},'uqhEB':function(_0x5ea875,_0x51ba0f){return _0x5ea875===_0x51ba0f;},'ccvOF':'nova-act-cli','kEqea':function(_0x1163cf,_0x23750a){return _0x1163cf===_0x23750a;},'tqYup':_0x3ea5bb(0x88)};return _0x93c4ef['XymfK'](_0x3c1a7b,_0x3ea5bb(0x7c))||_0x93c4ef['uqhEB'](_0x3c1a7b,_0x3ea5bb(0x8c))||_0x3c1a7b===_0x93c4ef[_0x3ea5bb(0x81)]||_0x93c4ef[_0x3ea5bb(0x86)](_0x3c1a7b,_0x93c4ef['tqYup']);}const LEGACY_TRANSPORT_ENV_VARS=[_0x5f071b(0x8a),_0x5f071b(0x7e)];export function getVerificationTransport(){const _0x3e5399=_0x5f071b,_0xae3489=process[_0x3e5399(0x72)][_0x3e5399(0x8f)]?.[_0x3e5399(0x7f)]();if(_0xae3489){if(isVerificationTransport(_0xae3489))return _0xae3489;throw new Error(_0x3e5399(0x85)+_0xae3489+'\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.');}const _0x366662=LEGACY_TRANSPORT_ENV_VARS['find'](_0x549eaa=>process[_0x3e5399(0x72)][_0x549eaa]);if(_0x366662)throw new Error(_0x366662+'\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.');return DEFAULT_VERIFICATION_TRANSPORT;}export function resolveHookMode(_0x31b08b=process['env']){const _0x565549=_0x5f071b,_0xff7fa={'cmBDE':_0x565549(0x74),'FFQEp':function(_0xbb5d1a,_0x438908){return _0xbb5d1a===_0x438908;},'gbCOh':_0x565549(0x99)},_0x452fd9=_0x31b08b[_0x565549(0x9a)]?.['trim']()[_0x565549(0x77)]();if(!_0x452fd9)return _0xff7fa[_0x565549(0x94)];if(_0xff7fa[_0x565549(0x84)](_0x452fd9,_0xff7fa['gbCOh'])||_0xff7fa['FFQEp'](_0x452fd9,'on')||_0xff7fa[_0x565549(0x84)](_0x452fd9,_0xff7fa['cmBDE']))return _0x452fd9;return console['error']('[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22'+_0x31b08b['RANGER_HOOKS']+_0x565549(0x78)+_0x565549(0x97)),_0xff7fa['cmBDE'];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x414551,_0x44faa1){const _0x32ce87=_0x5771,_0x193c80=_0x414551();while(!![]){try{const _0x3c448e=-parseInt(_0x32ce87(0x1b7))/0x1+-parseInt(_0x32ce87(0x1be))/0x2+parseInt(_0x32ce87(0x1b2))/0x3*(parseInt(_0x32ce87(0x1ad))/0x4)+-parseInt(_0x32ce87(0x1e1))/0x5+-parseInt(_0x32ce87(0x1af))/0x6*(parseInt(_0x32ce87(0x1cc))/0x7)+-parseInt(_0x32ce87(0x1c2))/0x8+parseInt(_0x32ce87(0x1eb))/0x9;if(_0x3c448e===_0x44faa1)break;else _0x193c80['push'](_0x193c80['shift']());}catch(_0x44c1a1){_0x193c80['push'](_0x193c80['shift']());}}}(_0x56e9,0x6a14d));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';function _0x56e9(){const _0x4e8294=['iqsLF','2339588rgJjvn','xRSse','289218JpgEJL','zdATr','/api/v1/mcp/features/','3qcGmmV','length','itemIds','Failed\x20to\x20update\x20scenario:\x20','Failed\x20to\x20list\x20feature\x20reviews:\x20','518713ucHYZt','NYixJ','QpspB','Failed\x20to\x20delete\x20feature\x20review:\x20','/comments/address','/feedback','Failed\x20to\x20get\x20feature\x20review:\x20','199704McazmJ','Failed\x20to\x20get\x20action\x20items:\x20','MKtCb','sessionId','478768qfyImI','text','Failed\x20to\x20start\x20session:\x20','QWZhS','GET','fbCTZ','stringify','sOpYj','raMoi','DnblY','7udhycI','mTjMY','XpvkL','/restore','SNJih','application/json','/start','includeDeleted','/sessions/','mTpYJ','/checklist','iqaUZ','Failed\x20to\x20restore\x20feature\x20review:\x20','Failed\x20to\x20list\x20sessions:\x20','pcqpI','POST','Failed\x20to\x20conclude\x20session:\x20','Bearer\x20','/report/markdown','limit','/api/v1/mcp/features','1436795lKkSKm','GgPeD','Failed\x20to\x20create\x20feature\x20review:\x20','style','\x0a\x0aUpgrade\x20your\x20plan:\x20','RLPhd','SMteK','gitRepoUrl','Failed\x20to\x20update\x20feature\x20review:\x20','HRsmB','7772265qQkFjS','json','UWKMZ','MHuJC','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','set','gYHWj','toString','BRCqq'];_0x56e9=function(){return _0x4e8294;};return _0x56e9();}import{withRetry}from'./retry.js';export async function createFeature(_0x3d7dd9){const _0x551d0b=_0x5771,_0x22ded3={'sOpYj':function(_0x144db0){return _0x144db0();},'iqsLF':_0x551d0b(0x1a7),'MHuJC':'application/json','gTFxV':function(_0x25b410,_0x4c51d7){return _0x25b410===_0x4c51d7;},'KDank':'https://dashboard.ranger.net/billing'},_0x4cdaf9=await _0x22ded3[_0x551d0b(0x1c9)](getToken);if(!_0x4cdaf9)throw new Error(_0x22ded3[_0x551d0b(0x1ac)]);const _0x522ee7=_0x22ded3[_0x551d0b(0x1c9)](getApiBaseUrl),_0x521d4f=await fetch(_0x522ee7+'/api/v1/mcp/features',{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x4cdaf9,'Content-Type':_0x22ded3[_0x551d0b(0x1a6)]},'body':JSON[_0x551d0b(0x1c8)](_0x3d7dd9)});if(!_0x521d4f['ok']){if(_0x22ded3['gTFxV'](_0x521d4f['status'],0x192)){const _0x1cc8f4=await _0x521d4f['json'](),_0x58f4b0=_0x1cc8f4['billingUrl']||_0x22ded3['KDank'];throw new Error((_0x1cc8f4['message']||'Feature\x20limit\x20exceeded')+_0x551d0b(0x1e5)+_0x58f4b0);}const _0xf13d7a=await _0x521d4f['text']();throw new Error(_0x551d0b(0x1e3)+_0xf13d7a);}return _0x521d4f['json']();}export async function listFeatures(_0x5286d9){const _0x41d589=_0x5771,_0x3661a6={'XqVki':function(_0x21d9ef){return _0x21d9ef();},'GgPeD':function(_0x5c2369){return _0x5c2369();}},_0xedcb5f=await _0x3661a6['XqVki'](getToken);if(!_0xedcb5f)throw new Error(_0x41d589(0x1a7));const _0x2180ef=_0x3661a6[_0x41d589(0x1e2)](getApiBaseUrl),_0x4ae1fc=new URLSearchParams();if(_0x5286d9?.[_0x41d589(0x1e8)])_0x4ae1fc['set'](_0x41d589(0x1e8),_0x5286d9['gitRepoUrl']);if(_0x5286d9?.['gitBranch'])_0x4ae1fc['set']('gitBranch',_0x5286d9['gitBranch']);if(_0x5286d9?.['limit'])_0x4ae1fc['set']('limit',_0x5286d9[_0x41d589(0x1df)]['toString']());if(_0x5286d9?.['offset'])_0x4ae1fc[_0x41d589(0x1a8)]('offset',_0x5286d9['offset']['toString']());if(_0x5286d9?.[_0x41d589(0x1d3)])_0x4ae1fc[_0x41d589(0x1a8)](_0x41d589(0x1d3),'true');const _0x41c705=_0x2180ef+_0x41d589(0x1e0)+(_0x4ae1fc['toString']()?'?'+_0x4ae1fc[_0x41d589(0x1aa)]():''),_0x212c84=await fetch(_0x41c705,{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0xedcb5f}});if(!_0x212c84['ok']){const _0x38dbb5=await _0x212c84[_0x41d589(0x1c3)]();throw new Error(_0x41d589(0x1b6)+_0x38dbb5);}return _0x212c84[_0x41d589(0x1ec)]();}export async function getFeature(_0x27c041){const _0x5a206d=_0x5771,_0x146dc2={'mTjMY':function(_0x4b76f8){return _0x4b76f8();},'khdcF':function(_0x48fd66){return _0x48fd66();},'BRCqq':function(_0x27fde0,_0xcf1753,_0x58ab8b){return _0x27fde0(_0xcf1753,_0x58ab8b);},'OcUBd':'GET'},_0x16218a=await _0x146dc2[_0x5a206d(0x1cd)](getToken);if(!_0x16218a)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x5bddc1=_0x146dc2['khdcF'](getApiBaseUrl),_0xddf49d=await _0x146dc2[_0x5a206d(0x1ab)](fetch,_0x5bddc1+_0x5a206d(0x1b1)+_0x27c041,{'method':_0x146dc2['OcUBd'],'headers':{'Authorization':_0x5a206d(0x1dd)+_0x16218a}});if(!_0xddf49d['ok']){const _0x77a17d=await _0xddf49d[_0x5a206d(0x1c3)]();throw new Error(_0x5a206d(0x1bd)+_0x77a17d);}return _0xddf49d[_0x5a206d(0x1ec)]();}export async function updateFeature(_0x2e5da3,_0x1b0fdf){const _0x31dd87=_0x5771,_0x8bc776={'gmVoB':function(_0x2e4b7d){return _0x2e4b7d();},'xPKez':'PATCH'},_0x4b0c3b=await getToken();if(!_0x4b0c3b)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x1e16e5=_0x8bc776['gmVoB'](getApiBaseUrl),_0x16739a=await fetch(_0x1e16e5+_0x31dd87(0x1b1)+_0x2e5da3,{'method':_0x8bc776['xPKez'],'headers':{'Authorization':_0x31dd87(0x1dd)+_0x4b0c3b,'Content-Type':'application/json'},'body':JSON[_0x31dd87(0x1c8)](_0x1b0fdf)});if(!_0x16739a['ok']){const _0xa733f0=await _0x16739a['text']();throw new Error(_0x31dd87(0x1e9)+_0xa733f0);}return _0x16739a['json']();}export async function createChecklistItem(_0x18fae0,_0x30663e,_0x5e65a6){const _0x478140=_0x5771,_0x106b99={'mTpYJ':function(_0x1cfbb8){return _0x1cfbb8();},'EbJLF':_0x478140(0x1a7),'XpvkL':'POST'},_0x396216=await _0x106b99[_0x478140(0x1d5)](getToken);if(!_0x396216)throw new Error(_0x106b99['EbJLF']);const _0x32fbfe=getApiBaseUrl(),_0x2c9f3b=await fetch(_0x32fbfe+_0x478140(0x1b1)+_0x18fae0+_0x478140(0x1d6),{'method':_0x106b99[_0x478140(0x1ce)],'headers':{'Authorization':'Bearer\x20'+_0x396216,'Content-Type':'application/json'},'body':JSON['stringify']({'description':_0x30663e,'position':_0x5e65a6})});if(!_0x2c9f3b['ok']){const _0x2bd247=await _0x2c9f3b[_0x478140(0x1c3)]();throw new Error('Failed\x20to\x20create\x20scenario:\x20'+_0x2bd247);}return _0x2c9f3b['json']();}export async function updateChecklistItem(_0x1699ce,_0x419b5c,_0x2edb38){const _0x2f4bec=_0x5771,_0xf462cb={'xRSse':_0x2f4bec(0x1a7),'uFxxu':'PATCH','nsUAb':'application/json','TRtrB':function(_0x3ca878,_0x3ce81c,_0x5a1044){return _0x3ca878(_0x3ce81c,_0x5a1044);}};return _0xf462cb['TRtrB'](withRetry,async()=>{const _0x17a782=_0x2f4bec,_0x1a3569=await getToken();if(!_0x1a3569)throw new Error(_0xf462cb[_0x17a782(0x1ae)]);const _0x3b1810=getApiBaseUrl(),_0x3032d4=await fetch(_0x3b1810+'/api/v1/mcp/features/'+_0x1699ce+'/checklist/'+_0x419b5c,{'method':_0xf462cb['uFxxu'],'headers':{'Authorization':'Bearer\x20'+_0x1a3569,'Content-Type':_0xf462cb['nsUAb']},'body':JSON[_0x17a782(0x1c8)](_0x2edb38)});if(!_0x3032d4['ok']){const _0x2080f2=await _0x3032d4['text']();throw new Error(_0x17a782(0x1b5)+_0x2080f2);}return _0x3032d4['json']();},{'label':'updateChecklistItem'});}export async function getFeatureReport(_0x4c62cd){const _0x5670ab=_0x5771,_0x281a51={'pcqpI':_0x5670ab(0x1a7),'RLPhd':function(_0x1925d3){return _0x1925d3();},'iqaUZ':function(_0x4deac5,_0x41e1bb,_0x36688a){return _0x4deac5(_0x41e1bb,_0x36688a);}},_0x5f0e52=await getToken();if(!_0x5f0e52)throw new Error(_0x281a51[_0x5670ab(0x1da)]);const _0x58134c=_0x281a51[_0x5670ab(0x1e6)](getApiBaseUrl),_0x2afc95=await _0x281a51[_0x5670ab(0x1d7)](fetch,_0x58134c+_0x5670ab(0x1b1)+_0x4c62cd+'/report',{'method':'GET','headers':{'Authorization':_0x5670ab(0x1dd)+_0x5f0e52}});if(!_0x2afc95['ok']){const _0x10035e=await _0x2afc95[_0x5670ab(0x1c3)]();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x10035e);}return _0x2afc95['json']();}export async function getFeatureReportMarkdown(_0x425f3e,_0x15e109){const _0x344124=_0x5771,_0x449d68={'gYHWj':function(_0x20e4ed){return _0x20e4ed();},'DnblY':_0x344124(0x1c1),'UWKMZ':function(_0x540a94,_0x3b2c20,_0xc7a61b){return _0x540a94(_0x3b2c20,_0xc7a61b);},'fEnTJ':'GET'},_0x4d28a5=await _0x449d68[_0x344124(0x1a9)](getToken);if(!_0x4d28a5)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x466aac=getApiBaseUrl(),_0x399f68=new URLSearchParams(),_0x13860=(_0x15e109?.['itemIds']?.[_0x344124(0x1b3)]??0x0)>0x0,_0x19c862=Boolean(_0x15e109?.[_0x344124(0x1c1)]);_0x13860&&_0x15e109?.['itemIds']&&_0x399f68[_0x344124(0x1a8)](_0x344124(0x1b4),_0x15e109['itemIds']['join'](','));_0x19c862&&_0x15e109?.[_0x344124(0x1c1)]&&_0x399f68[_0x344124(0x1a8)](_0x449d68[_0x344124(0x1cb)],_0x15e109['sessionId']);!_0x13860&&!_0x19c862&&_0x15e109?.['style']&&_0x399f68[_0x344124(0x1a8)](_0x344124(0x1e4),_0x15e109[_0x344124(0x1e4)]);const _0x155b7c=_0x466aac+'/api/v1/mcp/features/'+_0x425f3e+_0x344124(0x1de),_0x3a361c=''+_0x155b7c+(_0x399f68[_0x344124(0x1aa)]()?'?'+_0x399f68['toString']():''),_0x28b3d1=await _0x449d68[_0x344124(0x1a5)](fetch,_0x3a361c,{'method':_0x449d68['fEnTJ'],'headers':{'Authorization':_0x344124(0x1dd)+_0x4d28a5}});if(!_0x28b3d1['ok']){const _0x26840c=await _0x28b3d1[_0x344124(0x1c3)]();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20'+_0x26840c);}return _0x28b3d1[_0x344124(0x1c3)]();}export async function listFeatureSessions(_0x4914dd){const _0xf13b94=_0x5771,_0xa889d2={'SNJih':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','NYixJ':function(_0xc4ec7){return _0xc4ec7();}},_0x57d8d7=await getToken();if(!_0x57d8d7)throw new Error(_0xa889d2[_0xf13b94(0x1d0)]);const _0x340191=_0xa889d2[_0xf13b94(0x1b8)](getApiBaseUrl),_0xc3176d=await fetch(_0x340191+'/api/v1/mcp/features/'+_0x4914dd+'/sessions',{'method':_0xf13b94(0x1c6),'headers':{'Authorization':_0xf13b94(0x1dd)+_0x57d8d7}});if(!_0xc3176d['ok']){const _0x397520=await _0xc3176d[_0xf13b94(0x1c3)]();throw new Error(_0xf13b94(0x1d9)+_0x397520);}return _0xc3176d[_0xf13b94(0x1ec)]();}export async function startSession(_0x555a2c,_0x3cb5e5){const _0x55fa4d=_0x5771,_0x179267=await getToken();if(!_0x179267)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x372156=getApiBaseUrl(),_0x1368f9=await fetch(_0x372156+_0x55fa4d(0x1b1)+_0x555a2c+_0x55fa4d(0x1d4)+_0x3cb5e5+_0x55fa4d(0x1d2),{'method':_0x55fa4d(0x1db),'headers':{'Authorization':'Bearer\x20'+_0x179267}});if(!_0x1368f9['ok']){const _0x353e36=await _0x1368f9[_0x55fa4d(0x1c3)]();throw new Error(_0x55fa4d(0x1c4)+_0x353e36);}return _0x1368f9[_0x55fa4d(0x1ec)]();}function _0x5771(_0x3739b1,_0x827419){_0x3739b1=_0x3739b1-0x1a5;const _0x56e93b=_0x56e9();let _0x5771e1=_0x56e93b[_0x3739b1];return _0x5771e1;}export async function concludeSession(_0x278fd3,_0x1e6c4b){const _0x17a822=_0x5771,_0x16e420={'eXQtH':function(_0x3425d3){return _0x3425d3();},'zdATr':function(_0x5d5602,_0x365513,_0x2e1de9){return _0x5d5602(_0x365513,_0x2e1de9);}},_0x522ff4=await getToken();if(!_0x522ff4)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x30cf36=_0x16e420['eXQtH'](getApiBaseUrl),_0xf17d70=await _0x16e420[_0x17a822(0x1b0)](fetch,_0x30cf36+'/api/v1/mcp/features/'+_0x278fd3+'/sessions/'+_0x1e6c4b+'/conclude',{'method':'POST','headers':{'Authorization':_0x17a822(0x1dd)+_0x522ff4}});if(!_0xf17d70['ok']){const _0xca3426=await _0xf17d70[_0x17a822(0x1c3)]();throw new Error(_0x17a822(0x1dc)+_0xca3426);}return _0xf17d70[_0x17a822(0x1ec)]();}export async function getActionItems(_0x5c390f){const _0x1aa429=_0x5771,_0x317b21={'raMoi':_0x1aa429(0x1a7),'MKtCb':_0x1aa429(0x1c6)},_0x68af11=await getToken();if(!_0x68af11)throw new Error(_0x317b21[_0x1aa429(0x1ca)]);const _0x328c27=getApiBaseUrl(),_0x56740e=await fetch(_0x328c27+'/api/v1/mcp/features/'+_0x5c390f+'/action-items',{'method':_0x317b21[_0x1aa429(0x1c0)],'headers':{'Authorization':'Bearer\x20'+_0x68af11}});if(!_0x56740e['ok']){const _0xacc914=await _0x56740e['text']();throw new Error(_0x1aa429(0x1bf)+_0xacc914);}return _0x56740e['json']();}export async function getItemFeedback(_0x16836f,_0x167af0){const _0x2f29bc=_0x5771,_0x6b8df2={'uBUiM':_0x2f29bc(0x1a7),'QWZhS':function(_0x293e50){return _0x293e50();},'XMMwv':function(_0x5e3c13,_0x12fdb0,_0x23ff0d){return _0x5e3c13(_0x12fdb0,_0x23ff0d);}},_0x3ab2cd=await getToken();if(!_0x3ab2cd)throw new Error(_0x6b8df2['uBUiM']);const _0x3c7dab=_0x6b8df2[_0x2f29bc(0x1c5)](getApiBaseUrl),_0x554ec5=await _0x6b8df2['XMMwv'](fetch,_0x3c7dab+_0x2f29bc(0x1b1)+_0x16836f+'/checklist-items/'+_0x167af0+_0x2f29bc(0x1bc),{'method':'GET','headers':{'Authorization':_0x2f29bc(0x1dd)+_0x3ab2cd}});if(!_0x554ec5['ok']){const _0x27b179=await _0x554ec5[_0x2f29bc(0x1c3)]();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x27b179);}return _0x554ec5[_0x2f29bc(0x1ec)]();}export async function markCommentsAddressed(_0x2dcc6f,_0x1c28be,_0x58c649){const _0x59a509=_0x5771,_0x24fe94={'QpspB':function(_0x558add){return _0x558add();},'fbCTZ':_0x59a509(0x1a7),'SMteK':'POST'},_0x26225a=await _0x24fe94[_0x59a509(0x1b9)](getToken);if(!_0x26225a)throw new Error(_0x24fe94[_0x59a509(0x1c7)]);const _0x36d461=_0x24fe94['QpspB'](getApiBaseUrl),_0x34fe92=await fetch(_0x36d461+_0x59a509(0x1b1)+_0x2dcc6f+_0x59a509(0x1bb),{'method':_0x24fe94[_0x59a509(0x1e7)],'headers':{'Authorization':'Bearer\x20'+_0x26225a,'Content-Type':_0x59a509(0x1d1)},'body':JSON['stringify']({'checklistItemId':_0x1c28be,'commentIds':_0x58c649})});if(!_0x34fe92['ok']){const _0x51b25b=await _0x34fe92[_0x59a509(0x1c3)]();throw new Error('Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20'+_0x51b25b);}}export async function softDeleteFeature(_0x3007c5){const _0x977aae=_0x5771,_0xed7960={'OmMyg':function(_0x56b777){return _0x56b777();},'HRsmB':function(_0x5210ee){return _0x5210ee();}},_0x517b5c=await _0xed7960['OmMyg'](getToken);if(!_0x517b5c)throw new Error(_0x977aae(0x1a7));const _0xf52a0a=_0xed7960[_0x977aae(0x1ea)](getApiBaseUrl),_0x2dc0dc=await fetch(_0xf52a0a+_0x977aae(0x1b1)+_0x3007c5,{'method':'DELETE','headers':{'Authorization':_0x977aae(0x1dd)+_0x517b5c}});if(!_0x2dc0dc['ok']){const _0x5316c5=await _0x2dc0dc['text']();throw new Error(_0x977aae(0x1ba)+_0x5316c5);}}export async function restoreFeature(_0x80fea0){const _0x2d1353=_0x5771,_0x3c0efc={'KbCPc':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','QiasZ':function(_0x2322b1,_0x289761,_0x183a39){return _0x2322b1(_0x289761,_0x183a39);}},_0x3cd647=await getToken();if(!_0x3cd647)throw new Error(_0x3c0efc['KbCPc']);const _0x2ac479=getApiBaseUrl(),_0x9ef00e=await _0x3c0efc['QiasZ'](fetch,_0x2ac479+'/api/v1/mcp/features/'+_0x80fea0+_0x2d1353(0x1cf),{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x3cd647}});if(!_0x9ef00e['ok']){const _0x22d642=await _0x9ef00e[_0x2d1353(0x1c3)]();throw new Error(_0x2d1353(0x1d8)+_0x22d642);}}
|
|
1
|
+
(function(_0x240d99,_0x3e9137){const _0x509c6f=_0x1469,_0x4b69cb=_0x240d99();while(!![]){try{const _0x3d7206=parseInt(_0x509c6f(0x1cb))/0x1*(-parseInt(_0x509c6f(0x1e8))/0x2)+-parseInt(_0x509c6f(0x1de))/0x3+parseInt(_0x509c6f(0x219))/0x4*(-parseInt(_0x509c6f(0x1ff))/0x5)+-parseInt(_0x509c6f(0x203))/0x6*(parseInt(_0x509c6f(0x1d1))/0x7)+-parseInt(_0x509c6f(0x1cf))/0x8*(parseInt(_0x509c6f(0x1e0))/0x9)+parseInt(_0x509c6f(0x1d3))/0xa+parseInt(_0x509c6f(0x1f5))/0xb*(parseInt(_0x509c6f(0x1e3))/0xc);if(_0x3d7206===_0x3e9137)break;else _0x4b69cb['push'](_0x4b69cb['shift']());}catch(_0xee4140){_0x4b69cb['push'](_0x4b69cb['shift']());}}}(_0x4e18,0x54c41));import{getToken}from'./keychain.js';function _0x4e18(){const _0x203ed6=['aGkaO','/conclude','852942WcrjFL','ofSTS','/sessions','JoIdp','Failed\x20to\x20create\x20feature\x20review:\x20','/report','text','COBQb','message','Kctkh','Qltcm','mPjqt','Failed\x20to\x20start\x20session:\x20','OprUU','QZLvG','SsPBo','JwcTK','json','sessionId','Kragl','includeDeleted','qrTYz','20cpvQgM','eYCnK','POST','/checklist-items/','210rrFEMR','Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20','Failed\x20to\x20list\x20feature\x20reviews:\x20','style','34872NStqey','hrKWG','7zpQCQt','Failed\x20to\x20get\x20action\x20items:\x20','3891680iqqpyX','Failed\x20to\x20create\x20scenario:\x20','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','set','/action-items','avoOe','gitRepoUrl','CIeAj','billingUrl','GET','/api/v1/mcp/features/','578934KgvRhQ','heNnE','207Dnzfgd','AXENE','toString','708276FOcZMD','stringify','cecvp','gitBranch','limit','2014KvRbvj','PATCH','Failed\x20to\x20conclude\x20session:\x20','Failed\x20to\x20update\x20feature\x20review:\x20','OuztC','DaQIH','Failed\x20to\x20get\x20feature\x20review:\x20','OxfsH','pVURw','/checklist','Failed\x20to\x20list\x20sessions:\x20','updateChecklistItem','njhvq','220gGypeQ','wynga','Bearer\x20','mYwvI','https://dashboard.ranger.net/billing','Failed\x20to\x20get\x20feature\x20review\x20report:\x20','iQrrI','application/json','itemIds','Failed\x20to\x20delete\x20feature\x20review:\x20','575565cNACDA','mJXzg'];_0x4e18=function(){return _0x203ed6;};return _0x4e18();}import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x3e0b02){const _0x5592a2=_0x1469,_0x428e16={'KRaTi':function(_0x451eda){return _0x451eda();},'rlRVk':function(_0xb1d258){return _0xb1d258();},'njhvq':function(_0x386b85,_0xd2caf1,_0x42e9bb){return _0x386b85(_0xd2caf1,_0x42e9bb);},'ofSTS':'POST'},_0x10da72=await _0x428e16['KRaTi'](getToken);if(!_0x10da72)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x55eeb9=_0x428e16['rlRVk'](getApiBaseUrl),_0x30a8d6=await _0x428e16[_0x5592a2(0x1f4)](fetch,_0x55eeb9+'/api/v1/mcp/features',{'method':_0x428e16[_0x5592a2(0x204)],'headers':{'Authorization':'Bearer\x20'+_0x10da72,'Content-Type':_0x5592a2(0x1fc)},'body':JSON[_0x5592a2(0x1e4)](_0x3e0b02)});if(!_0x30a8d6['ok']){if(_0x30a8d6['status']===0x192){const _0x230fb0=await _0x30a8d6['json'](),_0x31349d=_0x230fb0[_0x5592a2(0x1db)]||_0x5592a2(0x1f9);throw new Error((_0x230fb0[_0x5592a2(0x20b)]||'Feature\x20limit\x20exceeded')+'\x0a\x0aUpgrade\x20your\x20plan:\x20'+_0x31349d);}const _0x1da907=await _0x30a8d6[_0x5592a2(0x209)]();throw new Error(_0x5592a2(0x207)+_0x1da907);}return _0x30a8d6[_0x5592a2(0x214)]();}export async function listFeatures(_0x25fb6a){const _0x24e9c6=_0x1469,_0x41a8b8={'OxfsH':'gitRepoUrl','OprUU':'GET'},_0x4cb5e6=await getToken();if(!_0x4cb5e6)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x5ce65d=getApiBaseUrl(),_0x4921dc=new URLSearchParams();if(_0x25fb6a?.[_0x24e9c6(0x1d9)])_0x4921dc['set'](_0x41a8b8[_0x24e9c6(0x1ef)],_0x25fb6a[_0x24e9c6(0x1d9)]);if(_0x25fb6a?.['gitBranch'])_0x4921dc['set']('gitBranch',_0x25fb6a[_0x24e9c6(0x1e6)]);if(_0x25fb6a?.[_0x24e9c6(0x1e7)])_0x4921dc['set']('limit',_0x25fb6a[_0x24e9c6(0x1e7)]['toString']());if(_0x25fb6a?.['offset'])_0x4921dc['set']('offset',_0x25fb6a['offset'][_0x24e9c6(0x1e2)]());if(_0x25fb6a?.[_0x24e9c6(0x217)])_0x4921dc['set'](_0x24e9c6(0x217),'true');const _0xbdef09=_0x5ce65d+'/api/v1/mcp/features'+(_0x4921dc[_0x24e9c6(0x1e2)]()?'?'+_0x4921dc[_0x24e9c6(0x1e2)]():''),_0x4d0f54=await fetch(_0xbdef09,{'method':_0x41a8b8[_0x24e9c6(0x210)],'headers':{'Authorization':'Bearer\x20'+_0x4cb5e6}});if(!_0x4d0f54['ok']){const _0x3c204f=await _0x4d0f54['text']();throw new Error(_0x24e9c6(0x1cd)+_0x3c204f);}return _0x4d0f54[_0x24e9c6(0x214)]();}export async function getFeature(_0x47d2c6){const _0x55bfac=_0x1469,_0x4e3540={'SsPBo':function(_0xb4c9d9){return _0xb4c9d9();},'JoIdp':_0x55bfac(0x1d5),'fIRVi':function(_0x30b960){return _0x30b960();},'PYqQF':_0x55bfac(0x1dc)},_0x1fd396=await _0x4e3540[_0x55bfac(0x212)](getToken);if(!_0x1fd396)throw new Error(_0x4e3540[_0x55bfac(0x206)]);const _0x47dd26=_0x4e3540['fIRVi'](getApiBaseUrl),_0x23a3a1=await fetch(_0x47dd26+_0x55bfac(0x1dd)+_0x47d2c6,{'method':_0x4e3540['PYqQF'],'headers':{'Authorization':_0x55bfac(0x1f7)+_0x1fd396}});if(!_0x23a3a1['ok']){const _0x41ffd0=await _0x23a3a1['text']();throw new Error(_0x55bfac(0x1ee)+_0x41ffd0);}return _0x23a3a1[_0x55bfac(0x214)]();}export async function updateFeature(_0x3c4dea,_0x42e7af){const _0x78b706=_0x1469,_0x58aa46={'nhznc':function(_0x408d9f){return _0x408d9f();},'JwcTK':function(_0x1d3f68){return _0x1d3f68();},'ektvF':function(_0xae4b,_0x3e6dbd,_0x42d002){return _0xae4b(_0x3e6dbd,_0x42d002);}},_0x328345=await _0x58aa46['nhznc'](getToken);if(!_0x328345)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x411a97=_0x58aa46[_0x78b706(0x213)](getApiBaseUrl),_0x2b5a2f=await _0x58aa46['ektvF'](fetch,_0x411a97+_0x78b706(0x1dd)+_0x3c4dea,{'method':_0x78b706(0x1e9),'headers':{'Authorization':_0x78b706(0x1f7)+_0x328345,'Content-Type':'application/json'},'body':JSON[_0x78b706(0x1e4)](_0x42e7af)});if(!_0x2b5a2f['ok']){const _0x16dc9c=await _0x2b5a2f['text']();throw new Error(_0x78b706(0x1eb)+_0x16dc9c);}return _0x2b5a2f[_0x78b706(0x214)]();}export async function createChecklistItem(_0x636f89,_0x242505,_0x2f0012){const _0x72d8fa=_0x1469,_0x452fe5={'kESvd':_0x72d8fa(0x1d5),'heNnE':function(_0x2d95e9,_0x5b7099,_0x347468){return _0x2d95e9(_0x5b7099,_0x347468);},'QZLvG':_0x72d8fa(0x1c9),'aGkaO':_0x72d8fa(0x1fc)},_0x3e9443=await getToken();if(!_0x3e9443)throw new Error(_0x452fe5['kESvd']);const _0x328a66=getApiBaseUrl(),_0x3dcb60=await _0x452fe5[_0x72d8fa(0x1df)](fetch,_0x328a66+_0x72d8fa(0x1dd)+_0x636f89+_0x72d8fa(0x1f1),{'method':_0x452fe5[_0x72d8fa(0x211)],'headers':{'Authorization':'Bearer\x20'+_0x3e9443,'Content-Type':_0x452fe5[_0x72d8fa(0x201)]},'body':JSON[_0x72d8fa(0x1e4)]({'description':_0x242505,'position':_0x2f0012})});if(!_0x3dcb60['ok']){const _0x2ef126=await _0x3dcb60[_0x72d8fa(0x209)]();throw new Error(_0x72d8fa(0x1d4)+_0x2ef126);}return _0x3dcb60['json']();}export async function updateChecklistItem(_0x50e540,_0x2e5430,_0x2aca89){const _0x59bacc=_0x1469,_0x5c089e={'SbwoA':function(_0x58893e){return _0x58893e();},'qrTYz':function(_0x41ee50,_0x2488ea,_0x1d9ed7){return _0x41ee50(_0x2488ea,_0x1d9ed7);},'Qltcm':_0x59bacc(0x1e9),'COBQb':_0x59bacc(0x1fc),'HmjqF':_0x59bacc(0x1f3)};return withRetry(async()=>{const _0x315ba2=_0x59bacc,_0x5ad0f0=await _0x5c089e['SbwoA'](getToken);if(!_0x5ad0f0)throw new Error(_0x315ba2(0x1d5));const _0x597800=_0x5c089e['SbwoA'](getApiBaseUrl),_0x3161be=await _0x5c089e[_0x315ba2(0x218)](fetch,_0x597800+_0x315ba2(0x1dd)+_0x50e540+'/checklist/'+_0x2e5430,{'method':_0x5c089e[_0x315ba2(0x20d)],'headers':{'Authorization':'Bearer\x20'+_0x5ad0f0,'Content-Type':_0x5c089e[_0x315ba2(0x20a)]},'body':JSON[_0x315ba2(0x1e4)](_0x2aca89)});if(!_0x3161be['ok']){const _0x44dcfa=await _0x3161be[_0x315ba2(0x209)]();throw new Error('Failed\x20to\x20update\x20scenario:\x20'+_0x44dcfa);}return _0x3161be['json']();},{'label':_0x5c089e['HmjqF']});}export async function getFeatureReport(_0x59559a){const _0x2eb895=_0x1469,_0x181e4e={'buAiU':'GET'},_0x1eafba=await getToken();if(!_0x1eafba)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x2a74b3=getApiBaseUrl(),_0x537503=await fetch(_0x2a74b3+'/api/v1/mcp/features/'+_0x59559a+_0x2eb895(0x208),{'method':_0x181e4e['buAiU'],'headers':{'Authorization':'Bearer\x20'+_0x1eafba}});if(!_0x537503['ok']){const _0x1855c4=await _0x537503[_0x2eb895(0x209)]();throw new Error(_0x2eb895(0x1fa)+_0x1855c4);}return _0x537503['json']();}export async function getFeatureReportMarkdown(_0x4a1ac7,_0x3d5b58){const _0x568158=_0x1469,_0x23f092={'cWFCE':_0x568158(0x1d5),'BrQKX':function(_0x2906fd,_0x4bdbb6){return _0x2906fd>_0x4bdbb6;},'OkIcu':_0x568158(0x1fd),'iukQz':function(_0x4f379b,_0x3c557d){return _0x4f379b&&_0x3c557d;},'uTgAv':function(_0xf740e0,_0x2dbfff,_0x4c945f){return _0xf740e0(_0x2dbfff,_0x4c945f);},'qaYSv':_0x568158(0x1dc)},_0x172019=await getToken();if(!_0x172019)throw new Error(_0x23f092['cWFCE']);const _0x111715=getApiBaseUrl(),_0x42abcf=new URLSearchParams(),_0x46ea16=_0x23f092['BrQKX'](_0x3d5b58?.[_0x568158(0x1fd)]?.['length']??0x0,0x0),_0x370fdc=Boolean(_0x3d5b58?.[_0x568158(0x215)]);_0x46ea16&&_0x3d5b58?.[_0x568158(0x1fd)]&&_0x42abcf[_0x568158(0x1d6)](_0x23f092['OkIcu'],_0x3d5b58[_0x568158(0x1fd)]['join'](','));_0x370fdc&&_0x3d5b58?.['sessionId']&&_0x42abcf[_0x568158(0x1d6)](_0x568158(0x215),_0x3d5b58['sessionId']);_0x23f092['iukQz'](!_0x46ea16,!_0x370fdc)&&_0x3d5b58?.['style']&&_0x42abcf[_0x568158(0x1d6)]('style',_0x3d5b58[_0x568158(0x1ce)]);const _0x92799a=_0x111715+_0x568158(0x1dd)+_0x4a1ac7+'/report/markdown',_0x58b2a5=''+_0x92799a+(_0x42abcf[_0x568158(0x1e2)]()?'?'+_0x42abcf[_0x568158(0x1e2)]():''),_0x270632=await _0x23f092['uTgAv'](fetch,_0x58b2a5,{'method':_0x23f092['qaYSv'],'headers':{'Authorization':_0x568158(0x1f7)+_0x172019}});if(!_0x270632['ok']){const _0x2aabd5=await _0x270632['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20'+_0x2aabd5);}return _0x270632['text']();}export async function listFeatureSessions(_0x345e58){const _0x789cb6=_0x1469,_0x3cba53={'wynga':function(_0xf0ebf3){return _0xf0ebf3();},'pVURw':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','OuztC':'GET'},_0x384a87=await _0x3cba53[_0x789cb6(0x1f6)](getToken);if(!_0x384a87)throw new Error(_0x3cba53[_0x789cb6(0x1f0)]);const _0x3aaf9c=getApiBaseUrl(),_0x224af3=await fetch(_0x3aaf9c+'/api/v1/mcp/features/'+_0x345e58+_0x789cb6(0x205),{'method':_0x3cba53[_0x789cb6(0x1ec)],'headers':{'Authorization':_0x789cb6(0x1f7)+_0x384a87}});if(!_0x224af3['ok']){const _0x30ef8f=await _0x224af3['text']();throw new Error(_0x789cb6(0x1f2)+_0x30ef8f);}return _0x224af3[_0x789cb6(0x214)]();}export async function startSession(_0x6a6f,_0x5f161f){const _0x38f97b=_0x1469,_0x532693={'dSkAF':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','UgjfF':function(_0x445836){return _0x445836();},'CIeAj':function(_0x36b1e6,_0x71677,_0xa18b2){return _0x36b1e6(_0x71677,_0xa18b2);},'hrKWG':_0x38f97b(0x1c9)},_0x13b31e=await getToken();if(!_0x13b31e)throw new Error(_0x532693['dSkAF']);const _0x4743b5=_0x532693['UgjfF'](getApiBaseUrl),_0x21d117=await _0x532693[_0x38f97b(0x1da)](fetch,_0x4743b5+'/api/v1/mcp/features/'+_0x6a6f+'/sessions/'+_0x5f161f+'/start',{'method':_0x532693[_0x38f97b(0x1d0)],'headers':{'Authorization':_0x38f97b(0x1f7)+_0x13b31e}});if(!_0x21d117['ok']){const _0x36d8b4=await _0x21d117['text']();throw new Error(_0x38f97b(0x20f)+_0x36d8b4);}return _0x21d117['json']();}export async function concludeSession(_0x222d1e,_0x2a3b92){const _0x26b03e=_0x1469,_0x1ee649={'mJXzg':function(_0x450c6a){return _0x450c6a();},'YMAbv':_0x26b03e(0x1c9)},_0x2cdeef=await _0x1ee649[_0x26b03e(0x200)](getToken);if(!_0x2cdeef)throw new Error(_0x26b03e(0x1d5));const _0x5ac05c=getApiBaseUrl(),_0x910d94=await fetch(_0x5ac05c+'/api/v1/mcp/features/'+_0x222d1e+'/sessions/'+_0x2a3b92+_0x26b03e(0x202),{'method':_0x1ee649['YMAbv'],'headers':{'Authorization':'Bearer\x20'+_0x2cdeef}});if(!_0x910d94['ok']){const _0x56c63f=await _0x910d94['text']();throw new Error(_0x26b03e(0x1ea)+_0x56c63f);}return _0x910d94['json']();}export async function getActionItems(_0x1721db){const _0x2b1114=_0x1469,_0x180b8a=await getToken();if(!_0x180b8a)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x72583f=getApiBaseUrl(),_0x3a621d=await fetch(_0x72583f+_0x2b1114(0x1dd)+_0x1721db+_0x2b1114(0x1d7),{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x180b8a}});if(!_0x3a621d['ok']){const _0x322d11=await _0x3a621d[_0x2b1114(0x209)]();throw new Error(_0x2b1114(0x1d2)+_0x322d11);}return _0x3a621d[_0x2b1114(0x214)]();}export async function getItemFeedback(_0xeb615,_0x3858c0){const _0x1213ea=_0x1469,_0xb56d60={'VdDrO':function(_0x2abaab){return _0x2abaab();},'avoOe':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','iQrrI':function(_0x4a2f53,_0x4b2fb4,_0x3ddb54){return _0x4a2f53(_0x4b2fb4,_0x3ddb54);},'fHepa':'GET'},_0x513d5f=await _0xb56d60['VdDrO'](getToken);if(!_0x513d5f)throw new Error(_0xb56d60[_0x1213ea(0x1d8)]);const _0x104ad0=getApiBaseUrl(),_0x3e5448=await _0xb56d60[_0x1213ea(0x1fb)](fetch,_0x104ad0+'/api/v1/mcp/features/'+_0xeb615+_0x1213ea(0x1ca)+_0x3858c0+'/feedback',{'method':_0xb56d60['fHepa'],'headers':{'Authorization':_0x1213ea(0x1f7)+_0x513d5f}});if(!_0x3e5448['ok']){const _0x3f0141=await _0x3e5448[_0x1213ea(0x209)]();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x3f0141);}return _0x3e5448[_0x1213ea(0x214)]();}export async function markCommentsAddressed(_0x27fba0,_0x2808a2,_0x2d7381){const _0x283da9=_0x1469,_0x312a13={'DaQIH':function(_0x54454d){return _0x54454d();},'Kragl':function(_0x3b0c29){return _0x3b0c29();},'Kctkh':function(_0x1a43a0,_0x223901,_0x367d98){return _0x1a43a0(_0x223901,_0x367d98);},'JFhBI':'application/json'},_0x46b66d=await _0x312a13[_0x283da9(0x1ed)](getToken);if(!_0x46b66d)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0xbd993d=_0x312a13[_0x283da9(0x216)](getApiBaseUrl),_0x5b0324=await _0x312a13[_0x283da9(0x20c)](fetch,_0xbd993d+_0x283da9(0x1dd)+_0x27fba0+'/comments/address',{'method':_0x283da9(0x1c9),'headers':{'Authorization':_0x283da9(0x1f7)+_0x46b66d,'Content-Type':_0x312a13['JFhBI']},'body':JSON[_0x283da9(0x1e4)]({'checklistItemId':_0x2808a2,'commentIds':_0x2d7381})});if(!_0x5b0324['ok']){const _0x3e4a33=await _0x5b0324['text']();throw new Error(_0x283da9(0x1cc)+_0x3e4a33);}}export async function softDeleteFeature(_0x4f7d43){const _0x3e310d=_0x1469,_0x35f5a6=await getToken();if(!_0x35f5a6)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x4ad880=getApiBaseUrl(),_0x5bc1e9=await fetch(_0x4ad880+_0x3e310d(0x1dd)+_0x4f7d43,{'method':'DELETE','headers':{'Authorization':_0x3e310d(0x1f7)+_0x35f5a6}});if(!_0x5bc1e9['ok']){const _0x3a938e=await _0x5bc1e9['text']();throw new Error(_0x3e310d(0x1fe)+_0x3a938e);}}function _0x1469(_0x2e040f,_0x116176){_0x2e040f=_0x2e040f-0x1c8;const _0x4e1825=_0x4e18();let _0x146925=_0x4e1825[_0x2e040f];return _0x146925;}export async function restoreFeature(_0x3b2078){const _0x57d5e2=_0x1469,_0x53eb5d={'mPjqt':function(_0x4d18d2){return _0x4d18d2();},'AXENE':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','mYwvI':function(_0x5adf9c){return _0x5adf9c();},'eYCnK':function(_0x5ea1dc,_0x46608b,_0x60e8ae){return _0x5ea1dc(_0x46608b,_0x60e8ae);},'cecvp':_0x57d5e2(0x1c9)},_0x5c0f55=await _0x53eb5d[_0x57d5e2(0x20e)](getToken);if(!_0x5c0f55)throw new Error(_0x53eb5d[_0x57d5e2(0x1e1)]);const _0x37fd49=_0x53eb5d[_0x57d5e2(0x1f8)](getApiBaseUrl),_0x5ebb6f=await _0x53eb5d[_0x57d5e2(0x1c8)](fetch,_0x37fd49+_0x57d5e2(0x1dd)+_0x3b2078+'/restore',{'method':_0x53eb5d[_0x57d5e2(0x1e5)],'headers':{'Authorization':'Bearer\x20'+_0x5c0f55}});if(!_0x5ebb6f['ok']){const _0x2fa535=await _0x5ebb6f[_0x57d5e2(0x209)]();throw new Error('Failed\x20to\x20restore\x20feature\x20review:\x20'+_0x2fa535);}}
|