@ranger-testing/ranger-cli 3.1.7-alpha.62f152a-54 → 3.1.7-alpha.9ed0a8d-59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.js +1 -1
- package/build/commands/addEnv.js +1 -1
- package/build/commands/authEncrypt.js +1 -1
- package/build/commands/clean.js +1 -1
- package/build/commands/config.js +1 -1
- package/build/commands/deleteProfile.js +1 -1
- package/build/commands/env.js +1 -1
- package/build/commands/feature.js +1 -1
- package/build/commands/hook.js +1 -1
- package/build/commands/hooks/autoPrompt.js +1 -1
- package/build/commands/hooks/disable.js +1 -1
- package/build/commands/hooks/enable.js +1 -1
- package/build/commands/hooks/exitPlanMode.js +1 -1
- package/build/commands/hooks/index.js +1 -1
- package/build/commands/hooks/output.js +1 -1
- package/build/commands/hooks/planReminder.js +1 -1
- package/build/commands/hooks/planStart.js +1 -1
- package/build/commands/hooks/postEdit.js +1 -1
- package/build/commands/hooks/preCompact.js +1 -1
- package/build/commands/hooks/sessionEnd.js +1 -1
- package/build/commands/hooks/sessionStart.js +1 -1
- package/build/commands/hooks/stopHook.js +1 -1
- package/build/commands/index.js +1 -1
- package/build/commands/login.js +1 -1
- package/build/commands/mcpBootstrap.js +1 -1
- package/build/commands/migrateProfile.js +1 -1
- package/build/commands/setup/claude.js +1 -1
- package/build/commands/setup/opencode.js +1 -1
- package/build/commands/setupCi.js +1 -1
- package/build/commands/skillup.js +1 -1
- package/build/commands/start.js +1 -1
- package/build/commands/status.js +1 -1
- package/build/commands/update.js +1 -1
- package/build/commands/updateEnv.js +1 -1
- package/build/commands/useEnv.js +1 -1
- package/build/commands/utils/activeProfile.js +1 -1
- package/build/commands/utils/agentEnv.js +1 -1
- package/build/commands/utils/browserSessionsApi.js +1 -1
- package/build/commands/utils/claudeConfig.js +1 -1
- package/build/commands/utils/claudeOverrideSettings.js +1 -1
- package/build/commands/utils/claudePlugin.js +1 -1
- package/build/commands/utils/cloudProfile.js +1 -1
- package/build/commands/utils/cloudProfileSession.js +1 -1
- package/build/commands/utils/crypto.js +1 -1
- package/build/commands/utils/desirePathLog.js +1 -1
- package/build/commands/utils/deviceAuth.js +1 -1
- package/build/commands/utils/environment.js +1 -1
- package/build/commands/utils/featureApi.js +1 -1
- package/build/commands/utils/fixWebmDuration.js +1 -1
- package/build/commands/utils/gitTracked.js +1 -1
- package/build/commands/utils/keychain.js +1 -1
- package/build/commands/utils/legacyWarning.js +1 -1
- package/build/commands/utils/localAgentInstallationsApi.js +1 -1
- package/build/commands/utils/matchAuthEnvironment.js +1 -1
- package/build/commands/utils/mcpImageBase64.js +1 -1
- package/build/commands/utils/model.js +1 -1
- package/build/commands/utils/novaActCli.js +1 -1
- package/build/commands/utils/opencodeConfig.js +1 -1
- package/build/commands/utils/organizationEnvApi.js +1 -1
- package/build/commands/utils/playwrightCli.js +1 -1
- package/build/commands/utils/profileMessages.js +1 -1
- package/build/commands/utils/profileSetupBanner.js +1 -1
- package/build/commands/utils/projectsConfig.js +1 -1
- package/build/commands/utils/rangerConfig.js +1 -1
- package/build/commands/utils/rangerRoot.js +1 -1
- package/build/commands/utils/rangerwrightCli.js +1 -1
- package/build/commands/utils/resolveProfileContext.js +1 -1
- package/build/commands/utils/resolveProfileUrl.js +1 -1
- package/build/commands/utils/retry.js +1 -1
- package/build/commands/utils/scenarioOriginCheck.js +1 -1
- package/build/commands/utils/sessionCache.js +1 -1
- package/build/commands/utils/settings.js +1 -1
- package/build/commands/utils/skillContent.js +1 -1
- package/build/commands/utils/skills.js +1 -1
- package/build/commands/utils/stitchWebmFiles.js +1 -1
- package/build/commands/utils/telemetry.js +1 -1
- package/build/commands/utils/tokenRefresh.js +1 -1
- package/build/commands/utils/traceSnapshotMapper.js +1 -1
- package/build/commands/utils/tunnelClient.js +1 -1
- package/build/commands/utils/userApi.js +1 -1
- package/build/commands/utils/version.js +1 -1
- package/build/commands/verifyFeature.js +1 -1
- package/build/commands/verifyFeatureCli.js +1 -1
- package/build/commands/verifyFeatureNovaCli.js +1 -1
- package/build/commands/verifyFeatureRangerwrightCli.js +1 -1
- package/package.json +2 -5
|
@@ -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 _0x53b5fb=_0x3317;(function(_0x3966a8,_0x481d57){const _0x62efd0=_0x3317,_0x1191a8=_0x3966a8();while(!![]){try{const _0x447a3f=parseInt(_0x62efd0(0xad))/0x1+parseInt(_0x62efd0(0x104))/0x2+-parseInt(_0x62efd0(0xcb))/0x3*(parseInt(_0x62efd0(0xc0))/0x4)+-parseInt(_0x62efd0(0xc4))/0x5+-parseInt(_0x62efd0(0xca))/0x6*(parseInt(_0x62efd0(0xf9))/0x7)+-parseInt(_0x62efd0(0xaa))/0x8*(parseInt(_0x62efd0(0xc6))/0x9)+-parseInt(_0x62efd0(0xcd))/0xa*(-parseInt(_0x62efd0(0xc2))/0xb);if(_0x447a3f===_0x481d57)break;else _0x1191a8['push'](_0x1191a8['shift']());}catch(_0x548ea9){_0x1191a8['push'](_0x1191a8['shift']());}}}(_0x7a98,0x2c00e));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x426f01 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(_0x3e5eed){const _0x4b3a23=_0x3317,_0x5b9bea={'wFrYV':_0x4b3a23(0xa1)};try{return new URL(_0x3e5eed)['host'];}catch{return _0x5b9bea[_0x4b3a23(0x127)];}}function errorMessageForTelemetry(_0x5a9c1e){return _0x5a9c1e instanceof Error?_0x5a9c1e['message']:undefined;}function trackBridgeEvent(_0x329021,_0x1cecf1){const _0x52f77f=_0x3317,_0x4f5999={'XaRMC':function(_0x345551,_0x1dd2c4){return _0x345551===_0x1dd2c4;}};if(!_0x329021)return;const _0x237ae0={'tunnelSessionId':_0x1cecf1[_0x52f77f(0x71)],'tunnelEventType':_0x1cecf1[_0x52f77f(0x121)],'connectionId':_0x1cecf1[_0x52f77f(0x117)],'code':_0x1cecf1['code'],'reason':_0x1cecf1[_0x52f77f(0x126)],'error':_0x1cecf1[_0x52f77f(0x72)],'elapsedMs':_0x1cecf1[_0x52f77f(0x70)],'activeLocalConnections':_0x1cecf1['activeLocalConnections'],'pendingLocalConnections':_0x1cecf1[_0x52f77f(0x103)]};_0x329021[_0x52f77f(0xa3)](_0x52f77f(0x77),_0x237ae0),(_0x1cecf1['type']==='tunnel_error'||_0x4f5999['XaRMC'](_0x1cecf1['type'],_0x52f77f(0xe0)))&&void _0x329021['trackPhaseError'](_0x52f77f(0x8b),new Error(_0x1cecf1['error']??_0x1cecf1[_0x52f77f(0x121)]),_0x237ae0);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x4ad5be=await getToken();if(!_0x4ad5be)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');return _0x4ad5be;}async function apiRequest(_0x4edfbd,_0x598649={}){const _0x270293=_0x3317,_0x3c0916={'YyKOI':function(_0xb00bd9){return _0xb00bd9();},'FEZFs':'application/json','oGXQo':function(_0x586d6c,_0x5e9dfd){return _0x586d6c===_0x5e9dfd;},'uoOky':_0x270293(0xb5),'YJwpk':function(_0x5946ce,_0x288193){return _0x5946ce===_0x288193;}},_0x2d4ae7=await requireToken(),_0x2bfb81=_0x3c0916[_0x270293(0x119)](getApiBaseUrl),_0x558fd6=await fetch(''+_0x2bfb81+_0x4edfbd,{..._0x598649,'headers':{'Authorization':'Bearer\x20'+_0x2d4ae7,'Content-Type':_0x3c0916[_0x270293(0xb8)],..._0x598649['headers']??{}}});if(!_0x558fd6['ok']){let _0x412ae4='',_0x1d60b6;try{const _0x5498ef=await _0x558fd6['json'](),_0x131d47=(_0x3c0916['oGXQo'](typeof _0x5498ef['error'],_0x270293(0xb5))?_0x5498ef['error']:undefined)??JSON['stringify'](_0x5498ef);_0x412ae4=_0x131d47;typeof _0x5498ef['test_output']===_0x3c0916[_0x270293(0x83)]&&_0x5498ef['test_output']&&(_0x412ae4=_0x412ae4+'\x0a'+_0x5498ef[_0x270293(0xf5)]);if(_0x3c0916['YJwpk'](typeof _0x5498ef['code'],_0x3c0916[_0x270293(0x83)]))_0x1d60b6=_0x5498ef['code'];}catch{_0x412ae4=_0x558fd6[_0x270293(0x129)];}throw new ApiError(_0x270293(0xbb)+_0x4edfbd+_0x270293(0x8f)+_0x558fd6[_0x270293(0xf3)]+'):\x20'+_0x412ae4,_0x558fd6[_0x270293(0xf3)],_0x412ae4,_0x1d60b6);}if(_0x3c0916[_0x270293(0x9a)](_0x558fd6['status'],0xcc))return undefined;return _0x558fd6[_0x270293(0x102)]();}export class ApiError extends Error{['status'];[_0x53b5fb(0xe3)];['code'];constructor(_0x5089e6,_0x4cdea5,_0xedd239,_0x37ddf2){const _0xa9791d=_0x53b5fb,_0x514472={'zlbcK':'ApiError'},_0x375b7e='3|4|2|0|1'['split']('|');let _0x3655a5=0x0;while(!![]){switch(_0x375b7e[_0x3655a5++]){case'0':this['code']=_0x37ddf2;continue;case'1':this[_0xa9791d(0x10e)]=_0x514472['zlbcK'];continue;case'2':this[_0xa9791d(0xe3)]=_0xedd239;continue;case'3':super(_0x5089e6);continue;case'4':this[_0xa9791d(0xf3)]=_0x4cdea5;continue;}break;}}}export async function fetchCloudProfile(_0x68e568){const _0x57b4ef={'PJPvT':function(_0x48fa68,_0x173bfe){return _0x48fa68(_0x173bfe);},'UKBZL':function(_0x4910ef,_0xadb94f){return _0x4910ef===_0xadb94f;}};try{return await _0x57b4ef['PJPvT'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x68e568));}catch(_0x19628e){if(_0x19628e instanceof ApiError&&_0x57b4ef['UKBZL'](_0x19628e['status'],0x194))return null;throw _0x19628e;}}export async function listCloudProfiles(){const _0x20112a=_0x53b5fb,_0x1cb453={'mybZA':'/api/v1/profiles'},_0x450a49=await apiRequest(_0x1cb453[_0x20112a(0x122)]);return _0x450a49[_0x20112a(0x97)];}function _0x7a98(){const _0x5edec4=['test_output','username','Nwihm','HLPzW','681464Hghzzx','\x22\x20instead.','DELETE','PUT','\x22;\x20using\x20\x22','raw','\x20Available:\x20','environment_key','EvWkJ','json','pendingLocalConnections','152334irzRcf','NRQCJ','POST','origin','/api/v1/tunnel/sessions/','userAgent','\x20\x20Cloud\x20session\x20for\x20\x22','RANGER_TUNNEL_LOGIN_HEADED','baseUrl','UAqQF','name','cookies','assertedEnv','RANGER_TEST_PASSWORD','URtui','XfPEz','isArray','session_state','defaultEnvironmentKey','connectionId','settings','YyKOI','qlHYL','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','daQnb','\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20','TYfRH','keys','FChbX','type','mybZA','wsEndpoint','tkfPi','\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','reason','wFrYV','save','statusText','ewHtK','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','elapsedMs','sessionId','error','\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20','mQaON','pw_endpoint','Browser\x20login\x20timed\x20out\x20before\x20completion.','tunnel_bridge_event','\x20\x20No\x20live\x20session\x20for\x20\x22','mVcNH','\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a','\x22;\x20proceeding\x20with\x20loginInstructions.','launch','\x22\x20matched\x20by\x20host\x20for\x20','\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20','mPRAr','organizationId','true','effectiveBaseUrl','uoOky','\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22','storageStatePath','tunnel_session_id','password','\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','SRIJy','tunnel_bridge','\x20\x20Cloud\x20profile\x20\x22','\x22.\x0a','ambiguous','\x20failed\x20(','environmentKey','BxZOY','\x20\x20•\x20capture\x20one\x20(a\x20browser\x20opens):\x20ranger\x20profile\x20add\x20','auth_config','RANGER_TEST_USERNAME','kHFTU','length','profiles','trim','mVhUu','YJwpk','TYGWz','Vlhat','EjNaI','\x20\x20Cached\x20session\x20for\x20\x22','pwCQH','\x22,\x20cached\x20locally','invalid-url','BSMtY','trackPhaseEnd','\x20\x20-\x20pass\x20`--env\x20<key>`\x20to\x20pick\x20the\x20auth\x20environment\x20by\x20name,\x20or\x0a','qutiq','trackPhaseStart','crTso','tunnel_login_request','/session','19704bcFKEj','agent','domains','150435dIwvQe','AamUQ','/login','telemetry','\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','environments','auth','tunnel','string','persistSessionState','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','FEZFs','\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).','/api/v1/profiles/auth-config','API\x20request\x20','message','forceLogin','\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22','key','772ExWQOr','\x20\x20•\x20or\x20pass\x20--env\x20<key>\x20to\x20run\x20an\x20automated\x20login\x20for\x20this\x20target.','77JAEYVF','tunnelUrl','1077065GzVOMT','success','549IGzSFV','join','toISOString','pwEndpoint','6IhMJSL','1383kVtBPL','Cloud\x20profile\x20\x22','722310WkOmkI',');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.','map','\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)','stringify','close','slhHa','clientIp','setupHeaders','\x20\x20Options:\x0a','qlhpE','you\x27re\x20now\x20at\x20\x22','MWlGU','HgypP','PanYc','\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20','zNouC','Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20','local_ws_error','dodoT','qXUPM','detail','\x22,\x20and\x20cloud\x20sessions\x20don\x27t\x20apply\x20to\x20localhost.\x0a','No\x20saved\x20session\x20for\x20\x22','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','loginInstructions','Browser\x20login\x20timed\x20out\x20after\x20','wwRCj','parse','sessionState','prompt','/api/v1/profiles/','log','mhkNx','SOqad','sessionCheckPath','some','status','env'];_0x7a98=function(){return _0x5edec4;};return _0x7a98();}export async function deleteCloudProfile(_0xa804cc){const _0x3c36d7=_0x53b5fb,_0x23e68e={'ujnAe':function(_0x2f9046,_0x4a2074,_0x3b74a3){return _0x2f9046(_0x4a2074,_0x3b74a3);},'HLPzW':function(_0x6265e7,_0x38baf9){return _0x6265e7(_0x38baf9);},'ewHtK':_0x3c36d7(0xfb)};try{await _0x23e68e['ujnAe'](apiRequest,'/api/v1/profiles/'+_0x23e68e[_0x3c36d7(0xf8)](encodeURIComponent,_0xa804cc),{'method':_0x23e68e[_0x3c36d7(0x6e)]});}catch(_0xd9cb3){if(_0xd9cb3 instanceof ApiError&&_0xd9cb3['status']===0x194)throw new Error(_0x3c36d7(0xcc)+_0xa804cc+'\x22\x20not\x20found.');throw _0xd9cb3;}}export async function createCloudProfile(_0x579d67,_0x71fcb4,_0x59486d={}){const _0x25a1c7=_0x53b5fb,_0x19d849={'tkfPi':function(_0x3c9f4d,_0x5f4697){return _0x3c9f4d>_0x5f4697;},'mVhUu':'/api/v1/profiles'},_0x1a15c5={'name':_0x579d67};if(_0x71fcb4)_0x1a15c5[_0x25a1c7(0x100)]=_0x71fcb4;_0x59486d['settings']&&_0x19d849[_0x25a1c7(0x124)](Object[_0x25a1c7(0x11f)](_0x59486d['settings'])[_0x25a1c7(0x96)],0x0)&&(_0x1a15c5[_0x25a1c7(0x118)]=_0x59486d[_0x25a1c7(0x118)]);if(_0x59486d['username'])_0x1a15c5[_0x25a1c7(0xf6)]=_0x59486d[_0x25a1c7(0xf6)];if(_0x59486d[_0x25a1c7(0x87)])_0x1a15c5[_0x25a1c7(0x87)]=_0x59486d['password'];return await apiRequest(_0x19d849[_0x25a1c7(0x99)],{'method':_0x25a1c7(0x106),'body':JSON[_0x25a1c7(0xd1)](_0x1a15c5)});}export async function uploadCloudProfileSession(_0x9587cf,_0x35ea9f){const _0x53fe83=_0x53b5fb,_0x26e9f7={'tZoPw':function(_0x2e2e47,_0x512052,_0x2acfb2){return _0x2e2e47(_0x512052,_0x2acfb2);},'Vlhat':_0x53fe83(0x106)};return await _0x26e9f7['tZoPw'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x9587cf)+_0x53fe83(0xa9),{'method':_0x26e9f7[_0x53fe83(0x9c)],'body':JSON['stringify']({'session_state':_0x35ea9f})});}export async function saveCloudProfileCredentials(_0x3a3bb5,_0x3f9770,_0x1fac66){const _0x444678=_0x53b5fb;await apiRequest(_0x444678(0xed)+encodeURIComponent(_0x3a3bb5),{'method':_0x444678(0xfc),'body':JSON['stringify']({'username':_0x3f9770,'password':_0x1fac66})});}export async function fetchAuthConfig(){const _0x5a6bd9=_0x53b5fb,_0x2bd2b3={'dodoT':function(_0x1d1559,_0xb599bc){return _0x1d1559 instanceof _0xb599bc;}};try{const _0x387598=await apiRequest(_0x5a6bd9(0xba));return _0x387598[_0x5a6bd9(0x93)];}catch(_0x20c666){return _0x2bd2b3[_0x5a6bd9(0xe1)](_0x20c666,ApiError)&&_0x20c666[_0x5a6bd9(0xf3)]!==0x194&&console['error'](_0x5a6bd9(0x73)+_0x20c666['message']),null;}}async function createTunnelSession(_0x40d379){const _0x4cd936=_0x53b5fb;return await apiRequest('/api/v1/tunnel/sessions',{'method':_0x4cd936(0x106),'body':JSON[_0x4cd936(0xd1)]({'targetUrl':_0x40d379,'mode':_0x4cd936(0xab)})});}async function deleteTunnelSession(_0x2d8fa6){const _0x285ef5=_0x53b5fb,_0x5c74c1={'wwWoA':'DELETE'};await apiRequest(_0x285ef5(0x108)+_0x2d8fa6,{'method':_0x5c74c1['wwWoA']});}export function pickAdHocEnvKey(_0x5801c3,_0x37c443,_0x5d8915){const _0x1c4911=_0x53b5fb,_0x2d1578={'qlhpE':function(_0x3ce032,_0xe13f2c){return _0x3ce032+_0xe13f2c;},'BxZOY':'\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.','mAxiu':function(_0x51a611,_0x4031c5){return _0x51a611(_0x4031c5);},'tLLId':function(_0x8655a7,_0x1cd950){return _0x8655a7===_0x1cd950;},'gJbUr':function(_0x28fed9,_0x704630){return _0x28fed9+_0x704630;}};if(_0x5d8915){if(!_0x5801c3?.['environments']?.[_0x5d8915]){const _0x396710=Object[_0x1c4911(0x11f)](_0x5801c3?.[_0x1c4911(0xb2)]??{});throw new Error(_0x2d1578[_0x1c4911(0xd7)]('Auth\x20environment\x20\x22'+_0x5d8915+_0x1c4911(0x88),_0x396710[_0x1c4911(0x96)]?_0x1c4911(0xff)+_0x396710['join'](',\x20')+'.':_0x2d1578[_0x1c4911(0x91)])+_0x1c4911(0xd0));}return _0x5d8915;}if(!_0x5801c3)return null;if(_0x37c443){const _0x5a18c9=matchAuthEnvironmentExact(_0x37c443,_0x5801c3);if(_0x5a18c9)return _0x5a18c9;const _0x14cb0a=matchAuthEnvironmentByHost(_0x37c443,_0x5801c3);if(_0x14cb0a&&'key'in _0x14cb0a)return console['log']('\x20\x20Auth\x20env\x20\x22'+_0x14cb0a[_0x1c4911(0xbf)]+_0x1c4911(0x7d)+_0x37c443+_0x1c4911(0xb9)),_0x14cb0a['key'];if(_0x14cb0a&&_0x1c4911(0x8e)in _0x14cb0a)throw new Error('Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20('+_0x14cb0a[_0x1c4911(0x8e)][_0x1c4911(0xc7)](',\x20')+_0x1c4911(0xce));if(_0x2d1578['mAxiu'](needsTunnel,_0x37c443))throw new Error(_0x2d1578['qlhpE']('No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22'+_0x37c443+_0x1c4911(0x8d)+_0x1c4911(0x7a)+_0x1c4911(0xd6)+_0x1c4911(0xa4),'\x20\x20-\x20ask\x20your\x20Ranger\x20admin\x20to\x20add\x20\x22'+_0x37c443['replace'](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a')+(_0x1c4911(0x7e)+_0x37c443+'\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.'));}if(_0x5801c3[_0x1c4911(0x116)])return _0x5801c3[_0x1c4911(0x116)];const _0x74759a=Object['keys'](_0x5801c3[_0x1c4911(0xb2)]??{});if(_0x2d1578['tLLId'](_0x74759a[_0x1c4911(0x96)],0x1))return _0x74759a[0x0];if(_0x74759a['length']===0x0)return null;throw new Error(_0x2d1578['gJbUr']('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x74759a['join'](',\x20')+').\x20','Pass\x20--base-url\x20<your-app-url>\x20so\x20Ranger\x20can\x20match\x20the\x20right\x20one,\x20or\x20create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`.'));}function _0x3317(_0x225507,_0x490a7d){_0x225507=_0x225507-0x6e;const _0x7a986b=_0x7a98();let _0x331721=_0x7a986b[_0x225507];return _0x331721;}export function adHocProfileName(_0x47013d,_0x217e09,_0x186cca){const _0xaf1d11={'VxDXB':function(_0x42bd97,_0x11c8dd){return _0x42bd97===_0x11c8dd;}};if(!_0x217e09||_0xaf1d11['VxDXB'](_0x217e09,_0x186cca))return _0x47013d;return _0x47013d+':'+_0x217e09;}export async function resolveAdHocProfile(_0x5784bf={},_0xc2cfd2=process[_0x53b5fb(0xf4)]){const _0x5f241f=_0x53b5fb,_0x488370={'UAqQF':function(_0x564952,_0x5f4278,_0x4ca010,_0x349170){return _0x564952(_0x5f4278,_0x4ca010,_0x349170);},'NRQCJ':function(_0x95ddd4,_0x29cce3){return _0x95ddd4(_0x29cce3);},'SRIJy':function(_0xac28ed,_0xd2dc0d){return _0xac28ed&&_0xd2dc0d;}},_0x9eb644=_0xc2cfd2['RANGER_TEST_USERNAME'];if(!_0x9eb644)return null;const _0x49b8ce=await fetchAuthConfig(),_0x29c3dc=_0x488370[_0x5f241f(0x10d)](pickAdHocEnvKey,_0x49b8ce,_0x5784bf['targetUrl'],_0x5784bf['envKey']);let _0x3c45b1=adHocProfileName(_0x9eb644,_0x29c3dc,_0x49b8ce?.[_0x5f241f(0x116)]),_0x21e11f=await _0x488370[_0x5f241f(0x105)](fetchCloudProfile,_0x3c45b1);_0x488370[_0x5f241f(0x8a)](_0x21e11f,_0x29c3dc)&&_0x21e11f[_0x5f241f(0x90)]!==_0x29c3dc&&(console['log'](_0x5f241f(0x8c)+_0x3c45b1+_0x5f241f(0x84)+(_0x21e11f[_0x5f241f(0x90)]??'none')+'\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22'+_0x29c3dc+_0x5f241f(0xfd)+_0x9eb644+':'+_0x29c3dc+_0x5f241f(0xfa)),_0x3c45b1=_0x9eb644+':'+_0x29c3dc,_0x21e11f=await _0x488370[_0x5f241f(0x105)](fetchCloudProfile,_0x3c45b1));if(_0x21e11f)return{'name':_0x21e11f[_0x5f241f(0x10e)],'profile':_0x21e11f};const _0x32825a=_0xc2cfd2['RANGER_TEST_PASSWORD'],_0x109f6d=await createCloudProfile(_0x3c45b1,_0x29c3dc??undefined,{'username':_0x9eb644,'password':_0x32825a});return console['log']('\x20\x20Created\x20cloud\x20profile\x20\x22'+_0x109f6d['name']+'\x22\x20for\x20'+_0x9eb644+(_0x29c3dc?'\x20(auth\x20env:\x20'+_0x29c3dc+')':'')),{'name':_0x109f6d['name'],'profile':_0x109f6d};}export async function writeSessionToLocalCache(_0x9e1217,_0x420c12,_0x2f8048,_0x30e13f,_0x162440,_0x3bff75,_0x4d6aae){const _0xd2ae5f=_0x53b5fb,_0x3cfc6e={'Eqpqg':function(_0x45c634,_0x1b999e){return _0x45c634(_0x1b999e);},'ZYkdC':function(_0xa4a2ad,_0x55544d,_0x554d1f){return _0xa4a2ad(_0x55544d,_0x554d1f);},'qlHYL':function(_0x22c27b,_0xc085ac,_0x2eb388){return _0x22c27b(_0xc085ac,_0x2eb388);},'JBxPP':function(_0x4016f3){return _0x4016f3();},'NIOJC':_0xd2ae5f(0xb3),'mPRAr':function(_0x59382f,_0x248565,_0x96d880){return _0x59382f(_0x248565,_0x96d880);},'BSMtY':function(_0x3af2b9,_0x1a4d8b,_0x2b9ed3){return _0x3af2b9(_0x1a4d8b,_0x2b9ed3);}},_0x49d68e=_0x3cfc6e['Eqpqg'](sessionCacheHash,{'orgId':_0x420c12,'profileName':_0x9e1217,'effectiveBaseUrl':_0x2f8048,'setupHeaders':_0x30e13f,'invalidateOn':_0x4d6aae?.['invalidateOn'],'userAgent':_0x4d6aae?.[_0xd2ae5f(0x109)],'clientIp':_0x4d6aae?.[_0xd2ae5f(0xd4)]}),_0x2fabff=_0x3cfc6e['ZYkdC'](getSessionCachePath,_0x49d68e,_0x9e1217),_0x93262c=_0x3cfc6e[_0xd2ae5f(0x11a)](join,_0x3cfc6e['JBxPP'](getRangerHomeDir),_0x3cfc6e['NIOJC']);!existsSync(_0x93262c)&&await mkdir(_0x93262c,{'recursive':!![]});const _0x4a08b6={..._0x162440};_0x3bff75&&_0x3bff75['length']>0x0&&Array[_0xd2ae5f(0x114)](_0x4a08b6[_0xd2ae5f(0x10f)])&&(_0x4a08b6['cookies']=_0x3cfc6e[_0xd2ae5f(0x7f)](duplicateCookiesForDomains,_0x4a08b6[_0xd2ae5f(0x10f)],_0x3bff75));const _0xe83a9a={'cached_at':new Date()[_0xd2ae5f(0xc8)](),'session_state':_0x4a08b6};await _0x3cfc6e[_0xd2ae5f(0xa2)](writeFile,_0x2fabff,JSON[_0xd2ae5f(0xd1)](_0xe83a9a,null,0x2));const _0x1bb75f=getStorageStatePath(_0x2fabff);return await writeFile(_0x1bb75f,JSON[_0xd2ae5f(0xd1)](_0x4a08b6,null,0x2)),_0x1bb75f;}export async function checkLocalCache(_0x4769db,_0x47e45c,_0x1a8da5,_0x2c7b46,_0x6a87bf){const _0x2558eb=_0x53b5fb,_0x546600={'Nwihm':function(_0xeb8fbd,_0x52c6b9){return _0xeb8fbd(_0x52c6b9);},'yMIHr':function(_0x30cff0,_0x42a4a3){return _0x30cff0(_0x42a4a3);}},_0x4d3745=_0x546600[_0x2558eb(0xf7)](sessionCacheHash,{'orgId':_0x47e45c,'profileName':_0x4769db,'effectiveBaseUrl':_0x1a8da5,'setupHeaders':_0x2c7b46,'invalidateOn':_0x6a87bf?.['invalidateOn'],'userAgent':_0x6a87bf?.[_0x2558eb(0x109)],'clientIp':_0x6a87bf?.[_0x2558eb(0xd4)]}),_0x38fed0=getSessionCachePath(_0x4d3745,_0x4769db),_0x2f19eb=getStorageStatePath(_0x38fed0);if(!existsSync(_0x38fed0)||!_0x546600['yMIHr'](existsSync,_0x2f19eb))return null;try{const _0x26a901=await readFile(_0x38fed0,'utf-8');return JSON[_0x2558eb(0xea)](_0x26a901),{'storageStatePath':_0x2f19eb};}catch{return null;}}function launchRealBrowser(){const _0x33f8b5=_0x53b5fb;return chromium[_0x33f8b5(0x7c)]({'headless':!![]});}function emitSessionValidationHint(_0x52c158,_0x51eaf5){const _0x52d823=_0x53b5fb;if(!_0x51eaf5||!_0x51eaf5['domains']?.[_0x52d823(0x96)])return;let _0x33ac8b;try{_0x33ac8b=new URL(_0x52c158);}catch{return;}const _0xa0e7e9=[];for(const _0x3112e2 of _0x51eaf5['domains']){try{_0xa0e7e9['push']({'raw':_0x3112e2,'url':new URL(_0x3112e2)});}catch{}}if(_0xa0e7e9['length']===0x0)return;if(_0xa0e7e9[_0x52d823(0xf2)](_0x23b8a7=>_0x23b8a7['url'][_0x52d823(0x107)]===_0x33ac8b['origin']))return;const _0x539ff=_0xa0e7e9[_0x52d823(0xcf)](_0x267978=>'\x22'+_0x267978[_0x52d823(0xfe)]+'\x22')['join'](',\x20');console['log'](_0x52d823(0xdd)+_0x539ff+';\x20'+(_0x52d823(0xd8)+_0x52c158+_0x52d823(0x11d))+_0x52d823(0xb7));}export async function serverSideLogin(_0x383c14,_0x4dd0e1){const _0x4c6011=_0x53b5fb,_0x2c3bb6={'daQnb':function(_0x73a49e,_0x461232,_0x352b08){return _0x73a49e(_0x461232,_0x352b08);},'zvEVS':_0x4c6011(0x106),'ilnSs':function(_0x2b49ca,_0xfa53e7){return _0x2b49ca instanceof _0xfa53e7;},'kHFTU':function(_0x478a8f,_0x5a11c6){return _0x478a8f===_0x5a11c6;},'xkfYA':'not_configured'},_0x5eb8ec=process[_0x4c6011(0xf4)][_0x4c6011(0x94)],_0x2ed571=process[_0x4c6011(0xf4)]['RANGER_TEST_PASSWORD'],_0x2e1344={};if(_0x5eb8ec)_0x2e1344['username']=_0x5eb8ec;if(_0x2ed571)_0x2e1344[_0x4c6011(0x87)]=_0x2ed571;if(_0x4dd0e1?.['force'])_0x2e1344['force']=!![];if(_0x4dd0e1?.['targetUrl'])_0x2e1344['target_url']=_0x4dd0e1['targetUrl'];if(_0x4dd0e1?.['env'])_0x2e1344[_0x4c6011(0xf4)]=_0x4dd0e1[_0x4c6011(0xf4)];_0x4dd0e1?.['tunnel']&&(_0x2e1344[_0x4c6011(0x86)]=_0x4dd0e1[_0x4c6011(0xb4)][_0x4c6011(0x71)],_0x2e1344[_0x4c6011(0x75)]=_0x4dd0e1['tunnel'][_0x4c6011(0xc9)]);try{return await _0x2c3bb6[_0x4c6011(0x11c)](apiRequest,_0x4c6011(0xed)+encodeURIComponent(_0x383c14)+_0x4c6011(0xaf),{'method':_0x2c3bb6['zvEVS'],'body':JSON['stringify'](_0x2e1344)});}catch(_0x26f887){if(_0x2c3bb6['ilnSs'](_0x26f887,ApiError)&&_0x26f887[_0x4c6011(0xf3)]===0x190&&_0x2c3bb6[_0x4c6011(0x95)](_0x26f887['code'],_0x2c3bb6['xkfYA']))return{'status':'not_configured','error':_0x26f887['detail']};throw _0x26f887;}}async function serverSideLoginWithOptionalTunnel(_0x1e8f70,_0x586f80,_0x4425fa={}){const _0x289f23=_0x53b5fb,_0x5b7caa={'wwRCj':function(_0x560935,_0x3440ae){return _0x560935(_0x3440ae);},'HgypP':function(_0x1fc5b2,_0x3e9d4f){return _0x1fc5b2(_0x3e9d4f);},'PanYc':function(_0x21c5d4,_0x15dcbe){return _0x21c5d4===_0x15dcbe;},'qutiq':_0x289f23(0x81),'EjNaI':_0x289f23(0x125),'RVlYj':function(_0x2eb90b){return _0x2eb90b();},'BMDrz':function(_0x215854,_0x43b4b9,_0x2dd839){return _0x215854(_0x43b4b9,_0x2dd839);},'HTjpC':function(_0x5f3b56,_0x11a0ad){return _0x5f3b56??_0x11a0ad;},'URtui':'tunnel_login_setup','lMcNx':function(_0x4eeb07,_0x49ad03){return _0x4eeb07||_0x49ad03;},'MWlGU':'tunnel_login_cleanup'};if(!_0x5b7caa['HgypP'](needsTunnel,_0x586f80))return await serverSideLogin(_0x1e8f70,{'force':_0x4425fa['force'],'env':_0x4425fa[_0x289f23(0xf4)]});let _0x1b47bf=null,_0x1c0e7b=null,_0x55126c=null,_0x2509a1=null,_0x25373e=![];const _0x4863a4=process['env'][_0x289f23(0x10b)]?.['toLowerCase'](),_0x54c762=_0x4863a4==='1'||_0x5b7caa[_0x289f23(0xdb)](_0x4863a4,_0x5b7caa[_0x289f23(0xa5)]),_0x2462ed={'profileName':_0x1e8f70,'targetUrlHost':targetHostForTelemetry(_0x586f80),'tunnelRequired':!![],'forceLogin':_0x5b7caa[_0x289f23(0xe9)](Boolean,_0x4425fa['force']),'localBrowserServerHeaded':_0x54c762};try{_0x4425fa['telemetry']?.['trackPhaseStart']('tunnel_login_setup',_0x2462ed);_0x54c762&&console['log'](_0x5b7caa[_0x289f23(0x9d)]);_0x1b47bf=await launchBrowserServer({'headless':!_0x54c762}),_0x1c0e7b=await _0x5b7caa[_0x289f23(0xe9)](createTunnelSession,_0x586f80);const _0x57bf58=await _0x5b7caa['RVlYj'](requireToken);_0x55126c=await createTunnelBridge({'localWsUrl':_0x1b47bf[_0x289f23(0x123)],'tunnelServerUrl':_0x1c0e7b[_0x289f23(0xc3)],'sessionId':_0x1c0e7b['sessionId'],'apiKey':_0x57bf58,'onError':_0x499dbd=>{_0x2509a1=_0x499dbd;},'onClose':()=>{const _0x42daef=_0x289f23;_0x2509a1??=new Error(_0x42daef(0xdf)+_0x1e8f70);},'onEvent':_0x9683e0=>trackBridgeEvent(_0x4425fa[_0x289f23(0xb0)],_0x9683e0)}),_0x4425fa['telemetry']?.[_0x289f23(0xa3)]('tunnel_login_setup',{..._0x2462ed,'tunnelSessionId':_0x1c0e7b[_0x289f23(0x71)],'localBrowserServer':!![],'localBrowserServerHeaded':_0x54c762}),_0x25373e=!![];try{return _0x4425fa[_0x289f23(0xb0)]?.[_0x289f23(0xa6)](_0x289f23(0xa8),{..._0x2462ed,'tunnelSessionId':_0x1c0e7b['sessionId']}),await _0x5b7caa['BMDrz'](serverSideLogin,_0x1e8f70,{'force':_0x4425fa['force'],'targetUrl':_0x586f80,'env':_0x4425fa['env'],'tunnel':{'sessionId':_0x1c0e7b['sessionId'],'pwEndpoint':_0x1c0e7b[_0x289f23(0xc9)]}})['then'](_0x3a0b89=>{const _0x17268a=_0x289f23;return _0x4425fa[_0x17268a(0xb0)]?.[_0x17268a(0xa3)]('tunnel_login_request',{..._0x2462ed,'tunnelSessionId':_0x1c0e7b?.[_0x17268a(0x71)],'loginStatus':_0x3a0b89[_0x17268a(0xf3)],'hasSessionState':_0x5b7caa['wwRCj'](Boolean,_0x3a0b89[_0x17268a(0x115)]),'hasTestOutput':Boolean(_0x3a0b89['test_output']),'bridgeError':errorMessageForTelemetry(_0x2509a1)}),_0x3a0b89;});}catch(_0x12c092){await _0x4425fa['telemetry']?.['trackPhaseError']('tunnel_login_request',_0x5b7caa['HTjpC'](_0x2509a1,_0x12c092),{..._0x2462ed,'tunnelSessionId':_0x1c0e7b['sessionId'],'bridgeError':errorMessageForTelemetry(_0x2509a1)});throw _0x2509a1??_0x12c092;}}catch(_0x3e1f1c){!_0x25373e&&await _0x4425fa[_0x289f23(0xb0)]?.['trackPhaseError'](_0x5b7caa[_0x289f23(0x112)],_0x3e1f1c,{..._0x2462ed,'tunnelSessionId':_0x1c0e7b?.['sessionId']});throw _0x3e1f1c;}finally{(_0x5b7caa['lMcNx'](_0x1c0e7b,_0x1b47bf)||_0x55126c)&&(_0x4425fa['telemetry']?.[_0x289f23(0xa6)](_0x5b7caa[_0x289f23(0xd9)],{..._0x2462ed,'tunnelSessionId':_0x1c0e7b?.[_0x289f23(0x71)]}),_0x55126c?.[_0x289f23(0xd2)](),_0x1b47bf&&await _0x1b47bf[_0x289f23(0xd2)]()['catch'](()=>{}),_0x1c0e7b&&await _0x5b7caa[_0x289f23(0xda)](deleteTunnelSession,_0x1c0e7b['sessionId'])['catch'](()=>{}),_0x4425fa['telemetry']?.['trackPhaseEnd'](_0x5b7caa['MWlGU'],{..._0x2462ed,'tunnelSessionId':_0x1c0e7b?.[_0x289f23(0x71)]}));}}export async function manualBrowserLogin(_0x208bf7,_0x341a0e,_0x491144={}){const _0x566cf0=_0x53b5fb,_0x34eba2={'EvWkJ':function(_0x596382){return _0x596382();},'XzaiK':_0x566cf0(0xd2),'AWWzt':function(_0x127d05){return _0x127d05();},'oVGOU':function(_0x4a327f,_0x12221d){return _0x4a327f+_0x12221d;},'FChbX':'or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','AamUQ':function(_0x31cdc5,_0x3b71ec){return _0x31cdc5>_0x3b71ec;},'dchiR':'Browser\x20closed\x20before\x20authentication\x20was\x20saved.','XfPEz':function(_0x5d2dd1,_0x5b7744){return _0x5d2dd1!==_0x5b7744;},'PzjGt':function(_0x54bbe3,_0xc0f3a8){return _0x54bbe3(_0xc0f3a8);},'sljAu':'cli:manual-login'};if(!_0x34eba2['AWWzt'](isInteractive))throw new Error(_0x34eba2['oVGOU']('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x208bf7[_0x566cf0(0x10e)]+_0x566cf0(0x8d),'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20')+_0x34eba2[_0x566cf0(0x120)]);const _0x49a4da=_0x341a0e&&_0x34eba2[_0x566cf0(0xae)](_0x341a0e[_0x566cf0(0xac)][_0x566cf0(0x96)],0x0)?_0x341a0e['domains'][0x0]:'about:blank';console[_0x566cf0(0xee)]('\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.'),console['log'](_0x566cf0(0xdc)),await new Promise(_0x2ed742=>setTimeout(_0x2ed742,0x7d0));const _0x239e97=await chromium[_0x566cf0(0x7c)]({'headless':![]});let _0xc3f248=null;try{const _0x107d37={'ignoreHTTPSErrors':!![]};_0x341a0e?.[_0x566cf0(0xd5)]&&(_0x107d37['extraHTTPHeaders']=_0x341a0e[_0x566cf0(0xd5)]);const _0x27c482=await _0x239e97['newContext'](_0x107d37);await addProfileSetupBanner(_0x27c482);const _0x234e86=await _0x27c482['newPage']();await _0x234e86['goto'](_0x49a4da);let _0x3df6ed=![];await new Promise(_0x1bf653=>{const _0x1b9e25={'SOqad':function(_0x35acb4,_0x467c82){return _0x35acb4(_0x467c82);}},_0xd8bd16=setTimeout(()=>{const _0x5859a0=_0x3317;_0x3df6ed=!![],console[_0x5859a0(0x72)](_0x5859a0(0xe8)+MANUAL_LOGIN_TIMEOUT_MS/0xea60+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x34eba2[_0x5859a0(0x101)](_0x1bf653);},MANUAL_LOGIN_TIMEOUT_MS);_0x234e86['on'](_0x34eba2['XzaiK'],async()=>{const _0x336960=_0x3317;_0x1b9e25[_0x336960(0xf0)](clearTimeout,_0xd8bd16);try{const _0x4587a2=await _0x27c482['storageState']();_0xc3f248=_0x4587a2;}catch{}_0x1bf653();});});if(_0x3df6ed&&!_0xc3f248)throw new Error(_0x566cf0(0x76));}finally{await _0x239e97[_0x566cf0(0xd2)]()['catch'](()=>{});}if(!_0xc3f248)throw new Error(_0x34eba2['dchiR']);return _0x34eba2[_0x566cf0(0x113)](_0x491144[_0x566cf0(0xb6)],![])&&await apiRequest('/api/v1/profiles/'+_0x34eba2['PzjGt'](encodeURIComponent,_0x208bf7['name'])+_0x566cf0(0xa9),{'method':'POST','body':JSON['stringify']({'session_state':_0xc3f248,'updated_by':_0x34eba2['sljAu']})}),{'sessionState':_0xc3f248};}export async function promptSaveCredentials(_0x245558){const _0x31b545=_0x53b5fb,_0x525006={'UVmAu':function(_0x5cafd5,_0x1d0fd0){return _0x5cafd5||_0x1d0fd0;},'TaCWO':'confirm','Iiekp':_0x31b545(0x128),'Dephq':_0x31b545(0x11b)},_0x569aab=process[_0x31b545(0xf4)][_0x31b545(0x94)],_0x54f0d1=process['env'][_0x31b545(0x111)];if(_0x525006['UVmAu'](!_0x569aab,!_0x54f0d1))return;if(!isInteractive())return;const {save:_0x1bad6d}=await _0x426f01[_0x31b545(0xec)]([{'type':_0x525006['TaCWO'],'name':_0x525006['Iiekp'],'message':_0x31b545(0x6f),'default':![]}]);if(!_0x1bad6d)return;await apiRequest(_0x31b545(0xed)+encodeURIComponent(_0x245558),{'method':'PUT','body':JSON['stringify']({'username':_0x569aab,'password':_0x54f0d1})}),console['log'](_0x525006['Dephq']);}export async function resolveCloudProfileSession(_0x281f26,_0xd37cee={}){const _0x2e4844=_0x53b5fb,_0x4f22f5={'TYfRH':function(_0x557ba4){return _0x557ba4();},'dbnEE':function(_0x39d5e5,_0x20ce9,_0x30b94f){return _0x39d5e5(_0x20ce9,_0x30b94f);},'crTso':_0x2e4844(0xb5),'zNouC':function(_0x29ceb1,_0x169809){return _0x29ceb1===_0x169809;},'qXUPM':function(_0x473e1d,_0x50c1c3){return _0x473e1d||_0x50c1c3;},'mhkNx':function(_0x259cea,_0x596b64){return _0x259cea(_0x596b64);},'mVcNH':function(_0x497bf0,_0x5b7554){return _0x497bf0>_0x5b7554;},'yTwMQ':function(_0x3822b1,_0x5b956c,_0x222796,_0x5097fe,_0x360193,_0x4af339){return _0x3822b1(_0x5b956c,_0x222796,_0x5097fe,_0x360193,_0x4af339);},'uIwAU':function(_0x4b9851,_0x381212){return _0x4b9851(_0x381212);},'pwCQH':function(_0x20ba08,_0x56c9d9){return _0x20ba08||_0x56c9d9;},'mQaON':'not_configured','PVLBi':_0x2e4844(0xc5),'TYGWz':'\x20\x20Login\x20successful.\x20Session\x20cached.','EUkci':function(_0x2e72e5,_0x1a9f4a,_0x4e33d8,_0x2261ec,_0x5e90c3,_0x41e005,_0x1bdd1f,_0x2c2e52){return _0x2e72e5(_0x1a9f4a,_0x4e33d8,_0x2261ec,_0x5e90c3,_0x41e005,_0x1bdd1f,_0x2c2e52);},'ecTvH':function(_0x200b47,_0x18683d){return _0x200b47 instanceof _0x18683d;},'IdSrq':function(_0x23f713,_0x17a197){return _0x23f713(_0x17a197);},'FijBx':_0x2e4844(0xe6),'aUbax':_0x2e4844(0xc1),'ARHJu':function(_0x57a584,_0x2d71b6,_0x43fbb1,_0x4693fe){return _0x57a584(_0x2d71b6,_0x43fbb1,_0x4693fe);},'slhHa':function(_0x45a275,_0x33cd85,_0x420b7b,_0x181ec1,_0xcc0993,_0x4980f6,_0x4553fb,_0x18f4f7){return _0x45a275(_0x33cd85,_0x420b7b,_0x181ec1,_0xcc0993,_0x4980f6,_0x4553fb,_0x18f4f7);}},_0x2ba892=_0x281f26['settings']??{},_0x262c0e=await _0x4f22f5[_0x2e4844(0x11e)](fetchAuthConfig),_0xea7a2e=_0x262c0e?_0x4f22f5['dbnEE'](resolveAuthEnvironmentLocally,_0x262c0e,_0xd37cee[_0x2e4844(0x110)]??_0x281f26[_0x2e4844(0x90)]):null,_0x138503=typeof _0xea7a2e?.['loginInstructions']===_0x4f22f5[_0x2e4844(0xa7)]&&_0xea7a2e['loginInstructions']['trim']()?_0xea7a2e['loginInstructions']:undefined,_0xa19eaf=_0x4f22f5[_0x2e4844(0xde)](typeof _0x2ba892['loginInstructions'],_0x4f22f5[_0x2e4844(0xa7)])&&_0x2ba892[_0x2e4844(0xe7)][_0x2e4844(0x98)]()?_0x2ba892[_0x2e4844(0xe7)]:undefined,_0x5b87c1=_0x4f22f5[_0x2e4844(0xe2)](_0xa19eaf,!_0x138503)?_0x2ba892:{..._0x2ba892,'loginInstructions':_0x138503},_0x4d5653=_0x4f22f5['mhkNx'](Boolean,_0x5b87c1['loginInstructions']?.['trim']()),_0x110d8f=_0x4f22f5[_0x2e4844(0xef)](Boolean,_0x2ba892[_0x2e4844(0xbd)]||_0xea7a2e?.[_0x2e4844(0xbd)]),_0x4988e7=_0xea7a2e?.[_0x2e4844(0xac)],_0x1f6f08=_0x2ba892['setupHeaders'],_0x4dadd4=_0x1f6f08??_0xea7a2e?.[_0x2e4844(0xd5)],_0x104044=_0xd37cee[_0x2e4844(0x82)]??_0x2ba892[_0x2e4844(0x10c)]??(_0x4988e7&&_0x4f22f5[_0x2e4844(0x79)](_0x4988e7[_0x2e4844(0x96)],0x0)?_0x4988e7[0x0]:''),_0x3be095=_0x104044?needsTunnel(_0x104044):![],_0x46f069={'invalidateOn':_0xea7a2e?.['invalidateOn'],'userAgent':_0xea7a2e?.['browserOptions']?.['userAgent']??_0x2ba892['userAgent']};_0x110d8f&&console['log']('\x20\x20forceLogin\x20enabled\x20for\x20\x22'+_0x281f26[_0x2e4844(0x10e)]+'\x22,\x20refreshing\x20session...');if(!_0x110d8f){const _0x58d312=await _0x4f22f5['yTwMQ'](checkLocalCache,_0x281f26[_0x2e4844(0x10e)],_0x281f26['organizationId'],_0x104044,_0x4dadd4,_0x46f069);if(_0x58d312){if(_0x104044&&!_0x3be095){const _0x3b53e4=await isCachedSessionLive(_0x58d312['storageStatePath'],_0x104044,{'sessionCheckPath':_0xea7a2e?.[_0x2e4844(0xf1)],'setupHeaders':_0x4dadd4},{'launchBrowser':launchRealBrowser});if(_0x3b53e4)return console['log']('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x281f26[_0x2e4844(0x10e)]+'\x22'),{'authPath':_0x58d312[_0x2e4844(0x85)],'settings':_0x5b87c1,'resolvedEnv':_0xea7a2e};console[_0x2e4844(0xee)](_0x2e4844(0x9e)+_0x281f26[_0x2e4844(0x10e)]+'\x22\x20failed\x20validation\x20—\x20refreshing...'),_0x4f22f5['dbnEE'](emitSessionValidationHint,_0x104044,_0xea7a2e);}else return _0x3be095&&console[_0x2e4844(0xee)](_0x2e4844(0xbe)+_0x281f26['name']+'\x22'),{'authPath':_0x58d312['storageStatePath'],'settings':_0x5b87c1,'resolvedEnv':_0xea7a2e};}}if(!_0x110d8f&&_0x281f26[_0x2e4844(0xeb)]){const _0xb5796e=await writeSessionToLocalCache(_0x281f26[_0x2e4844(0x10e)],_0x281f26['organizationId'],_0x104044,_0x4dadd4,_0x281f26[_0x2e4844(0xeb)],_0x4988e7,_0x46f069);if(_0x104044){const _0x51aff1=await isCachedSessionLive(_0xb5796e,_0x104044,{'sessionCheckPath':_0xea7a2e?.['sessionCheckPath'],'setupHeaders':_0x4dadd4},{'launchBrowser':launchRealBrowser});if(_0x51aff1)return console[_0x2e4844(0xee)]('\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22'+_0x281f26[_0x2e4844(0x10e)]+_0x2e4844(0xa0)),{'authPath':_0xb5796e,'settings':_0x5b87c1,'resolvedEnv':_0xea7a2e};console['log'](_0x2e4844(0x10a)+_0x281f26['name']+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),emitSessionValidationHint(_0x104044,_0xea7a2e);}else return{'authPath':_0xb5796e,'settings':_0x5b87c1,'resolvedEnv':_0xea7a2e};}if(_0x4d5653)return console['log'](_0x2e4844(0x78)+_0x281f26['name']+_0x2e4844(0x7b)),{'authPath':undefined,'settings':_0x5b87c1,'resolvedEnv':_0xea7a2e};console[_0x2e4844(0xee)](_0x2e4844(0x78)+_0x281f26[_0x2e4844(0x10e)]+'\x22,\x20attempting\x20login...');const _0x10cc90=Boolean(process[_0x2e4844(0xf4)]['RANGER_TEST_USERNAME'])&&_0x4f22f5['uIwAU'](Boolean,process[_0x2e4844(0xf4)][_0x2e4844(0x111)]),_0x180f3c=_0x4f22f5['mhkNx'](Boolean,_0x281f26['username']),_0x569ad0=Boolean(_0xd37cee['assertedEnv']),_0x172ddf=_0x104044?_0x4f22f5[_0x2e4844(0xef)](isBareLocalhost,_0x104044):![],_0x3e71b5=_0x4f22f5['qXUPM'](_0x10cc90,_0x180f3c)&&_0x4f22f5[_0x2e4844(0x9f)](!_0x172ddf,_0x569ad0);if(_0x3e71b5)try{const _0x3c06fd=_0x104044?await serverSideLoginWithOptionalTunnel(_0x281f26['name'],_0x104044,{'force':_0x110d8f,'telemetry':_0xd37cee[_0x2e4844(0xb0)],'env':_0xd37cee['assertedEnv']}):await serverSideLogin(_0x281f26['name'],{'force':_0x110d8f,'env':_0xd37cee['assertedEnv']});if(_0x3c06fd[_0x2e4844(0xf3)]===_0x4f22f5[_0x2e4844(0x74)])console['log'](_0x2e4844(0xb1));else{if(_0x3c06fd[_0x2e4844(0xf3)]===_0x4f22f5['PVLBi']&&_0x3c06fd[_0x2e4844(0x115)]){console[_0x2e4844(0xee)](_0x4f22f5[_0x2e4844(0x9b)]);const _0x5df487=await _0x4f22f5['EUkci'](writeSessionToLocalCache,_0x281f26[_0x2e4844(0x10e)],_0x281f26['organizationId'],_0x104044,_0x4dadd4,_0x3c06fd['session_state'],_0x4988e7,_0x46f069);return _0x10cc90&&!_0x180f3c&&await promptSaveCredentials(_0x281f26['name']),{'authPath':_0x5df487,'settings':_0x5b87c1,'resolvedEnv':_0xea7a2e};}else _0x3c06fd[_0x2e4844(0xf5)]&&(console['log'](_0x2e4844(0x89)),console[_0x2e4844(0xee)](_0x3c06fd[_0x2e4844(0xf5)])),console['log']('\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...');}}catch(_0x4497db){console['log']('\x20\x20Server-side\x20login\x20error:\x20'+(_0x4f22f5['ecTvH'](_0x4497db,Error)?_0x4497db[_0x2e4844(0xbc)]:_0x4f22f5['IdSrq'](String,_0x4497db))),console[_0x2e4844(0xee)](_0x4f22f5['FijBx']);}if(_0x172ddf&&!_0x569ad0&&!isInteractive())throw new Error(_0x2e4844(0xe5)+_0x104044+'\x22\x20on\x20profile\x20\x22'+_0x281f26['name']+_0x2e4844(0xe4)+(_0x2e4844(0x92)+_0x281f26[_0x2e4844(0x10e)]+'\x20--url\x20'+_0x104044+'\x0a')+_0x4f22f5['aUbax']);const _0x5ec4c9=_0xea7a2e?{..._0xea7a2e,'domains':_0x4f22f5['dbnEE'](orderLoginDomains,_0x104044,_0xea7a2e[_0x2e4844(0xac)]),'setupHeaders':_0x4dadd4}:_0x104044?{'key':_0x281f26[_0x2e4844(0x90)]??'','domains':[_0x104044],'setupHeaders':_0x4dadd4}:null,{sessionState:_0x39f4b4}=await _0x4f22f5['ARHJu'](manualBrowserLogin,_0x281f26,_0x5ec4c9,{'persistSessionState':!_0x3be095}),_0x24f01b=await _0x4f22f5[_0x2e4844(0xd3)](writeSessionToLocalCache,_0x281f26[_0x2e4844(0x10e)],_0x281f26[_0x2e4844(0x80)],_0x104044,_0x4dadd4,_0x39f4b4,_0x4988e7,_0x46f069);return{'authPath':_0x24f01b,'settings':_0x5b87c1,'resolvedEnv':_0xea7a2e};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x33dbb0=_0x4121;function _0x4121(_0x178702,_0x46c567){_0x178702=_0x178702-0x17b;const _0x4cc7dc=_0x4cc7();let _0x412168=_0x4cc7dc[_0x178702];return _0x412168;}(function(_0x1ee242,_0x4dcd95){const _0x594fc6=_0x4121,_0xdf8fa5=_0x1ee242();while(!![]){try{const _0x3b89c7=-parseInt(_0x594fc6(0x194))/0x1+-parseInt(_0x594fc6(0x1aa))/0x2*(-parseInt(_0x594fc6(0x199))/0x3)+-parseInt(_0x594fc6(0x18c))/0x4+-parseInt(_0x594fc6(0x1a5))/0x5+parseInt(_0x594fc6(0x196))/0x6*(parseInt(_0x594fc6(0x195))/0x7)+parseInt(_0x594fc6(0x1af))/0x8*(-parseInt(_0x594fc6(0x17d))/0x9)+-parseInt(_0x594fc6(0x17c))/0xa*(-parseInt(_0x594fc6(0x198))/0xb);if(_0x3b89c7===_0x4dcd95)break;else _0xdf8fa5['push'](_0xdf8fa5['shift']());}catch(_0x18c086){_0xdf8fa5['push'](_0xdf8fa5['shift']());}}}(_0x4cc7,0x3809c));import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x307bc5=process[_0x33dbb0(0x17b)],_0x5b1dc1={'stdin':process[_0x33dbb0(0x186)],'stdout':process[_0x33dbb0(0x19f)]}){const _0x155bdb=_0x33dbb0,_0x10daf6={'cfhty':function(_0x5b6353,_0x30ecf3){return _0x5b6353(_0x30ecf3);}};if(_0x307bc5['CI'])return![];return _0x10daf6[_0x155bdb(0x1a4)](Boolean,_0x5b1dc1['stdin']['isTTY'])&&_0x10daf6['cfhty'](Boolean,_0x5b1dc1[_0x155bdb(0x19f)]['isTTY']);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x314ec5){const _0x5cdeee=_0x33dbb0,_0x495e56={'ZGpYc':function(_0x14bd80,_0x1d491a){return _0x14bd80(_0x1d491a);},'AzaTl':'baseUrl','imyIs':'setupHeaders','ijhHm':'port','lrpev':_0x5cdeee(0x1a3),'qsSzN':function(_0x237d30,_0x5ece7d){return _0x237d30!==_0x5ece7d;},'nykKD':'clientIp','aRsEY':_0x5cdeee(0x1a2)},_0x15d334=new Set(_0x314ec5[_0x5cdeee(0x182)]??DEFAULT_INVALIDATE_ON);_0x314ec5['effectiveBaseUrl']&&_0x495e56[_0x5cdeee(0x1ae)](needsTunnel,_0x314ec5['effectiveBaseUrl'])&&_0x15d334[_0x5cdeee(0x190)](_0x495e56[_0x5cdeee(0x19b)]);const _0x480b2f={'orgId':_0x314ec5[_0x5cdeee(0x18e)],'profileName':_0x314ec5[_0x5cdeee(0x192)]};return _0x15d334[_0x5cdeee(0x1b0)]('baseUrl')&&(_0x480b2f['effectiveBaseUrl']=_0x314ec5[_0x5cdeee(0x1ac)]),_0x15d334[_0x5cdeee(0x1b0)](_0x495e56['imyIs'])&&(_0x480b2f[_0x5cdeee(0x188)]=_0x314ec5['setupHeaders']?sortObjectKeys(_0x314ec5['setupHeaders']):_0x314ec5['setupHeaders']),_0x15d334[_0x5cdeee(0x1b0)](_0x495e56[_0x5cdeee(0x184)])&&(_0x480b2f['port']=extractPort(_0x314ec5['effectiveBaseUrl'])),_0x15d334[_0x5cdeee(0x1b0)](_0x495e56[_0x5cdeee(0x1a6)])&&_0x495e56['qsSzN'](_0x314ec5['userAgent'],undefined)&&(_0x480b2f[_0x5cdeee(0x1a3)]=_0x314ec5['userAgent']),_0x15d334[_0x5cdeee(0x1b0)](_0x495e56['nykKD'])&&_0x314ec5[_0x5cdeee(0x197)]!==undefined&&(_0x480b2f[_0x5cdeee(0x197)]=_0x314ec5[_0x5cdeee(0x197)]),createHash('sha256')['update'](JSON[_0x5cdeee(0x181)](_0x480b2f))['digest'](_0x495e56['aRsEY'])['slice'](0x0,0xc);}function extractPort(_0x1ece60){const _0xafbad1=_0x33dbb0;try{return new URL(_0x1ece60)[_0xafbad1(0x17f)];}catch{return'';}}function sortObjectKeys(_0x20d7c6){const _0x4b4a7c=_0x33dbb0,_0x3baa4f={};for(const _0x509717 of Object['keys'](_0x20d7c6)[_0x4b4a7c(0x187)]()){_0x3baa4f[_0x509717]=_0x20d7c6[_0x509717];}return _0x3baa4f;}export function getSessionCachePath(_0x1d777f,_0x53bbe1){const _0x4c9dec=_0x33dbb0,_0x1e1481={'zgegf':function(_0x4fb323,_0x2279dc,_0x5a33c5,_0x52e66a){return _0x4fb323(_0x2279dc,_0x5a33c5,_0x52e66a);},'HXefp':function(_0x2b4d5e){return _0x2b4d5e();}};return _0x1e1481['zgegf'](join,_0x1e1481['HXefp'](getRangerHomeDir),_0x4c9dec(0x18a),_0x1d777f+'-'+_0x53bbe1+'.json');}export function getStorageStatePath(_0x12608e){const _0x2b2f9d=_0x33dbb0,_0x1b7141={'xsyYd':'.storageState.json'};return _0x12608e[_0x2b2f9d(0x183)](/\.json$/,_0x1b7141['xsyYd']);}export function needsTunnel(_0x46ab55){const _0x122cd2=_0x33dbb0,_0x4dbf69={'SrMvZ':function(_0x274d95,_0x232683){return _0x274d95===_0x232683;},'QdrGH':_0x122cd2(0x193)};let _0x117c05;try{_0x117c05=new URL(_0x46ab55)[_0x122cd2(0x1a1)];}catch{return![];}if(_0x4dbf69['SrMvZ'](_0x117c05,'localhost')||_0x117c05==='127.0.0.1')return!![];if(_0x117c05[_0x122cd2(0x1a0)](_0x4dbf69[_0x122cd2(0x17e)]))return!![];if(_0x117c05['includes']('localhost.'))return!![];return![];}export function isBareLocalhost(_0x57a069){const _0x116ac9=_0x33dbb0,_0x264d59={'KbOMi':function(_0x47066e,_0x430d38){return _0x47066e===_0x430d38;},'wEdbU':_0x116ac9(0x1a9)};let _0xff1f14;try{_0xff1f14=new URL(_0x57a069)['hostname'];}catch{return![];}return _0xff1f14===_0x116ac9(0x180)||_0x264d59[_0x116ac9(0x189)](_0xff1f14,_0x264d59['wEdbU'])||_0x264d59[_0x116ac9(0x189)](_0xff1f14,'::1')||_0xff1f14==='[::1]';}export function orderLoginDomains(_0x1481e5,_0x29875e){const _0x406d3a=_0x33dbb0,_0x2a8aa1=_0x29875e??[];if(!_0x1481e5)return _0x2a8aa1;return[_0x1481e5,..._0x2a8aa1[_0x406d3a(0x19e)](_0x3e4bf4=>_0x3e4bf4!==_0x1481e5)];}export function hostnameOf(_0xd343ff){return new URL(_0xd343ff)['hostname'];}export function duplicateCookiesForDomains(_0x147c88,_0x3ea853){const _0xd29ede=_0x33dbb0,_0x5adc59={'CGoEZ':function(_0x1c8055,_0x307d17){return _0x1c8055(_0x307d17);}},_0x23d647=[..._0x147c88],_0x3cbdd4=new Set(_0x147c88[_0xd29ede(0x18f)](_0x175307=>_0x175307['domain']));for(const _0xd7dd33 of _0x3ea853){let _0x32489d;try{_0x32489d=_0x5adc59['CGoEZ'](hostnameOf,_0xd7dd33);}catch{continue;}if(!_0x32489d)continue;const _0x5732f7=_0x32489d[_0xd29ede(0x19d)]('.')?_0x32489d:'.'+_0x32489d;if(_0x3cbdd4[_0xd29ede(0x1b0)](_0x32489d)||_0x3cbdd4[_0xd29ede(0x1b0)](_0x5732f7))continue;for(const _0x1c56ec of _0x147c88){_0x23d647['push']({..._0x1c56ec,'domain':_0x5732f7});}_0x3cbdd4[_0xd29ede(0x190)](_0x5732f7);}return _0x23d647;}export function resolveAuthEnvironmentLocally(_0x3ea3fc,_0x3f507d){const _0x52caa3=_0x33dbb0,_0x2e5b8e=_0x3ea3fc['environments'];if(_0x3f507d){const _0x2f0a52=_0x2e5b8e[_0x3f507d];if(!_0x2f0a52)return null;return{'key':_0x3f507d,..._0x2f0a52};}if(_0x3ea3fc[_0x52caa3(0x1a7)]){const _0x1b0e36=_0x2e5b8e[_0x3ea3fc['defaultEnvironmentKey']];if(!_0x1b0e36)return null;return{'key':_0x3ea3fc[_0x52caa3(0x1a7)],..._0x1b0e36};}const _0x4b96b4=Object['keys'](_0x2e5b8e);if(_0x4b96b4['length']===0x1){const _0xa07fe=_0x4b96b4[0x0];return{'key':_0xa07fe,..._0x2e5b8e[_0xa07fe]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x5cedc2,_0x441d2c){try{if(_0x441d2c)return new URL(_0x441d2c,_0x5cedc2)['toString']();return new URL(_0x5cedc2)['toString']();}catch{return null;}}function _0x4cc7(){const _0x54e642=['env','220qqenzd','9LtrYpu','QdrGH','port','localhost','stringify','invalidateOn','replace','ijhHm','fmIXN','stdin','sort','setupHeaders','KbOMi','auth','newContext','1423264TOfmsI','close','orgId','map','add','sessionCheckPath','profileName','.localhost','440000wtiWym','135002SdoYqg','102UMQTEF','clientIp','574442rKRUxx','3TVRLdl','test','AzaTl','domcontentloaded','startsWith','filter','stdout','endsWith','hostname','hex','userAgent','cfhty','1630095AzSanG','lrpev','defaultEnvironmentKey','AcIgP','127.0.0.1','482596OUftFQ','launchBrowser','effectiveBaseUrl','newPage','ZGpYc','2933416mgjqFT','has'];_0x4cc7=function(){return _0x54e642;};return _0x4cc7();}export function looksLikeLoginUrl(_0x1c9ee5){const _0x16dfb0=_0x33dbb0;try{const _0x5c0dca=new URL(_0x1c9ee5);return LOGIN_URL_PATTERN['test'](_0x5c0dca['pathname']);}catch{return LOGIN_URL_PATTERN[_0x16dfb0(0x19a)](_0x1c9ee5);}}export async function isCachedSessionLive(_0x32fe2b,_0x2b9c5c,_0x26966f={},_0x1fd3c5={}){const _0x28c25a=_0x33dbb0,_0x35bb7f={'AcIgP':_0x28c25a(0x19c),'fmIXN':function(_0x472fff,_0x4e4340){return _0x472fff===_0x4e4340;}},_0x4504a6=buildSessionCheckUrl(_0x2b9c5c,_0x26966f[_0x28c25a(0x191)]);if(!_0x4504a6)return!![];if(!_0x1fd3c5['launchBrowser'])return!![];let _0xd41492=null;try{_0xd41492=await _0x1fd3c5[_0x28c25a(0x1ab)]();const _0x483c46=await _0xd41492[_0x28c25a(0x18b)]({'storageState':_0x32fe2b,'ignoreHTTPSErrors':!![],..._0x26966f[_0x28c25a(0x188)]?{'extraHTTPHeaders':_0x26966f[_0x28c25a(0x188)]}:{}}),_0x5f3e76=await _0x483c46[_0x28c25a(0x1ad)](),_0x4031e6=await _0x5f3e76['goto'](_0x4504a6,{'waitUntil':_0x35bb7f[_0x28c25a(0x1a8)],'timeout':0x3a98}),_0x3d3095=_0x4031e6?.['status']();if(_0x3d3095===0x191||_0x35bb7f[_0x28c25a(0x185)](_0x3d3095,0x193))return![];const _0x4788fd=_0x5f3e76['url']();if(looksLikeLoginUrl(_0x4788fd))return![];return!![];}catch{return![];}finally{if(_0xd41492)await _0xd41492[_0x28c25a(0x18d)]()['catch'](()=>{});}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const _0x1a92e3=_0x44bc;(function(_0x3e3a12,_0x5688af){const _0x5d0829=_0x44bc,_0x1baa7c=_0x3e3a12();while(!![]){try{const _0x30b8e1=parseInt(_0x5d0829(0x146))/0x1+parseInt(_0x5d0829(0x13a))/0x2+parseInt(_0x5d0829(0x139))/0x3+parseInt(_0x5d0829(0x13f))/0x4+-parseInt(_0x5d0829(0x145))/0x5+-parseInt(_0x5d0829(0x137))/0x6+parseInt(_0x5d0829(0x143))/0x7*(parseInt(_0x5d0829(0x141))/0x8);if(_0x30b8e1===_0x5688af)break;else _0x1baa7c['push'](_0x1baa7c['shift']());}catch(_0x33796d){_0x1baa7c['push'](_0x1baa7c['shift']());}}}(_0x43e2,0x3fe60));function _0x44bc(_0x39b44e,_0x55b8dd){_0x39b44e=_0x39b44e-0x136;const _0x43e28f=_0x43e2();let _0x44bcbe=_0x43e28f[_0x39b44e];return _0x44bcbe;}import{createCipheriv,createDecipheriv,randomBytes,pbkdf2Sync}from'crypto';const ALGORITHM='aes-256-gcm',SALT=_0x1a92e3(0x138),KEY_LENGTH=0x20,IV_LENGTH=0x10,TAG_LENGTH=0x10;export function deriveKey(_0x37bd3d){const _0x141003={'bhHkb':'sha256'};return pbkdf2Sync(_0x37bd3d,SALT,0x186a0,KEY_LENGTH,_0x141003['bhHkb']);}function _0x43e2(){const _0x374453=['utf8','26472PNsmFS','subarray','21rNHttD','YxSbm','2031815INELOm','305105nHSNPF','concat','2464410DrUWkT','ranger-auth-encryption','578121uusypd','859492KYqxhO','myBNf','YAtQv','final','UvIHv','565364WfBTUx'];_0x43e2=function(){return _0x374453;};return _0x43e2();}export function encrypt(_0x3b894e,_0x246d05){const _0x4aa936=_0x1a92e3,_0xa5dbba={'myBNf':function(_0x2c983e,_0xd8f114){return _0x2c983e(_0xd8f114);},'DPtfB':function(_0x10dac7,_0x56e3ad,_0x1f1bb3,_0x519235){return _0x10dac7(_0x56e3ad,_0x1f1bb3,_0x519235);}},_0x46bbc1=_0xa5dbba[_0x4aa936(0x13b)](deriveKey,_0x246d05),_0x349dfb=randomBytes(IV_LENGTH),_0x3faa33=_0xa5dbba['DPtfB'](createCipheriv,ALGORITHM,_0x46bbc1,_0x349dfb),_0x5490e2=Buffer[_0x4aa936(0x136)]([_0x3faa33['update'](_0x3b894e,'utf8'),_0x3faa33[_0x4aa936(0x13d)]()]),_0x26e17b=_0x3faa33['getAuthTag']();return Buffer[_0x4aa936(0x136)]([_0x349dfb,_0x26e17b,_0x5490e2]);}export function decrypt(_0xa23473,_0x43e34e){const _0x327395=_0x1a92e3,_0x4b1e0f={'YxSbm':function(_0x20a86a,_0x3c2e09){return _0x20a86a+_0x3c2e09;},'UvIHv':function(_0xffe55e,_0x314505){return _0xffe55e+_0x314505;},'YAtQv':_0x327395(0x140)},_0x295411=deriveKey(_0x43e34e),_0x5f59b1=_0xa23473['subarray'](0x0,IV_LENGTH),_0x134610=_0xa23473['subarray'](IV_LENGTH,_0x4b1e0f[_0x327395(0x144)](IV_LENGTH,TAG_LENGTH)),_0x177f3c=_0xa23473[_0x327395(0x142)](IV_LENGTH+TAG_LENGTH),_0x5bccf1=createDecipheriv(ALGORITHM,_0x295411,_0x5f59b1);return _0x5bccf1['setAuthTag'](_0x134610),_0x4b1e0f[_0x327395(0x13e)](_0x5bccf1['update'](_0x177f3c),_0x5bccf1['final'](_0x4b1e0f[_0x327395(0x13c)]));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const _0x2a3c0e=_0x5c2d;(function(_0x35774d,_0x5e282c){const _0x186b0b=_0x5c2d,_0x5dda8a=_0x35774d();while(!![]){try{const _0x1791d9=parseInt(_0x186b0b(0x135))/0x1*(parseInt(_0x186b0b(0x139))/0x2)+parseInt(_0x186b0b(0x13e))/0x3+parseInt(_0x186b0b(0x151))/0x4*(parseInt(_0x186b0b(0x14d))/0x5)+parseInt(_0x186b0b(0x140))/0x6+parseInt(_0x186b0b(0x15e))/0x7+-parseInt(_0x186b0b(0x144))/0x8*(-parseInt(_0x186b0b(0x146))/0x9)+-parseInt(_0x186b0b(0x141))/0xa;if(_0x1791d9===_0x5e282c)break;else _0x5dda8a['push'](_0x5dda8a['shift']());}catch(_0x5788ef){_0x5dda8a['push'](_0x5dda8a['shift']());}}}(_0x16ad,0x652f9));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';function _0x16ad(){const _0x3c3b61=['[desire-path]\x20Payload:\x20','join','LnLpJ','mvQVF','777479MYPxjQ','--pass','slice','[REDACTED]','2nUUnzz','/api/v1/mcp/desire-path-logs','stringify','=[REDACTED]','stdout','2115471srnyhD','DEBUG','4052046MBdJuR','29499840BDZzQV','HTNSD','BcrSs','4325512evgUJH','--auth','9pbHYQU','missing_option','BNoNW','error','Xlazy','--credentials','errorMessage','354895RZQloD','length','--secret','includes','8Mgestp','--token','missing_required_argument','no_token','POST','Unknown\x20command','Not\x20enough\x20non-option\x20arguments','push','[desire-path]\x20Failed\x20to\x20send:\x20','uFGCr','Bearer\x20','sHllH','PJgun','3666719yDMmGn','isTTY','syntax_error','--header','HjgrZ','--key','catch','unknown_command'];_0x16ad=function(){return _0x3c3b61;};return _0x16ad();}import{getCurrentVersion}from'./version.js';const SENSITIVE_FLAGS=new Set([_0x2a3c0e(0x152),'-t',_0x2a3c0e(0x14f),'--api-key','--apikey',_0x2a3c0e(0x12e),'--password',_0x2a3c0e(0x136),_0x2a3c0e(0x145),'--authorization',_0x2a3c0e(0x12c),'--cookie',_0x2a3c0e(0x14b)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function _0x5c2d(_0x43cf72,_0x3253d6){_0x43cf72=_0x43cf72-0x12b;const _0x16adb6=_0x16ad();let _0x5c2d44=_0x16adb6[_0x43cf72];return _0x5c2d44;}function looksLikeToken(_0x3ecd2d){return TOKEN_PATTERNS['some'](_0x185e3a=>_0x185e3a['test'](_0x3ecd2d));}export function sanitizeArgs(_0x240ebc){const _0x3e1859=_0x2a3c0e,_0x1f878a={'mvQVF':function(_0x330fd1,_0x26518d){return _0x330fd1(_0x26518d);},'BcrSs':_0x3e1859(0x138)},_0x32e5a7=[];let _0x54df61=![];for(let _0xc70ee7=0x0;_0xc70ee7<_0x240ebc[_0x3e1859(0x14e)];_0xc70ee7++){const _0x44f189=_0x240ebc[_0xc70ee7];if(_0x54df61){_0x32e5a7['push']('[REDACTED]'),_0x54df61=![];continue;}if(_0x44f189['startsWith']('--')||_0x44f189['startsWith']('-')){const _0x28223f=_0x44f189['indexOf']('=');if(_0x28223f!==-0x1){const _0x13a452=_0x44f189[_0x3e1859(0x137)](0x0,_0x28223f)['toLowerCase']();if(SENSITIVE_FLAGS['has'](_0x13a452)){_0x32e5a7[_0x3e1859(0x158)](_0x44f189['slice'](0x0,_0x28223f)+_0x3e1859(0x13c));continue;}}else{const _0x3b8388=_0x44f189['toLowerCase']();SENSITIVE_FLAGS['has'](_0x3b8388)&&(_0x54df61=!![]);}_0x32e5a7['push'](_0x44f189);}else _0x1f878a[_0x3e1859(0x134)](looksLikeToken,_0x44f189)?_0x32e5a7[_0x3e1859(0x158)](_0x1f878a[_0x3e1859(0x143)]):_0x32e5a7[_0x3e1859(0x158)](_0x44f189);}return _0x32e5a7[_0x3e1859(0x132)]('\x20');}export async function logDesirePath(_0xecfbaf){const _0x1cd2b9=_0x2a3c0e,_0x44b802={'uFGCr':function(_0x527e68){return _0x527e68();},'LnLpJ':function(_0x363ca4){return _0x363ca4();},'iotBa':_0x1cd2b9(0x154),'sHllH':'application/json','BCibc':'Authorization','BNoNW':_0x1cd2b9(0x155)};try{const _0x284018=await _0x44b802[_0x1cd2b9(0x15a)](getToken)[_0x1cd2b9(0x12f)](()=>null),_0x510e5f=_0x44b802['uFGCr'](getApiBaseUrl),_0x26d0da=_0x44b802[_0x1cd2b9(0x133)](getCurrentVersion),_0x39098b=_0x284018?'has_token':_0x44b802['iotBa'],_0x16f7c9={..._0xecfbaf['metadata'],'authStatus':_0x39098b,'isTty':process[_0x1cd2b9(0x13d)][_0x1cd2b9(0x15f)]??![]},_0x2e57b9={'Content-Type':_0x44b802[_0x1cd2b9(0x15c)]};_0x284018&&(_0x2e57b9[_0x44b802['BCibc']]=_0x1cd2b9(0x15b)+_0x284018);const _0x427bec={'rawCommand':_0xecfbaf['rawCommand'],'errorMessage':_0xecfbaf[_0x1cd2b9(0x14c)],'errorType':_0xecfbaf['errorType'],'featureId':_0xecfbaf['featureId'],'sessionId':_0xecfbaf['sessionId'],'metadata':_0x16f7c9,'cliVersion':_0x26d0da};process['env'][_0x1cd2b9(0x13f)]&&(console['error']('[desire-path]\x20Sending\x20log\x20to\x20'+_0x510e5f+'/api/v1/mcp/desire-path-logs'),console['error'](_0x1cd2b9(0x131)+JSON[_0x1cd2b9(0x13b)](_0x427bec,null,0x2))),await fetch(_0x510e5f+_0x1cd2b9(0x13a),{'method':_0x44b802[_0x1cd2b9(0x148)],'headers':_0x2e57b9,'body':JSON['stringify'](_0x427bec)});}catch(_0x4b4fba){process['env'][_0x1cd2b9(0x13f)]&&console[_0x1cd2b9(0x149)](_0x1cd2b9(0x159)+_0x4b4fba);}}export function getErrorType(_0x3a0358,_0x1d500b){const _0x24791d=_0x2a3c0e,_0x1fa349={'Xlazy':'runtime_error','HTNSD':'unknown','foDKK':_0x24791d(0x130),'OueIe':'Unknown\x20argument','PJgun':_0x24791d(0x153),'fZZri':'invalid_option_value','HjgrZ':_0x24791d(0x147)};if(_0x1d500b)return _0x1fa349[_0x24791d(0x14a)];if(!_0x3a0358)return _0x1fa349[_0x24791d(0x142)];if(_0x3a0358['includes'](_0x24791d(0x156)))return _0x1fa349['foDKK'];if(_0x3a0358['includes'](_0x1fa349['OueIe']))return'unknown_argument';if(_0x3a0358[_0x24791d(0x150)](_0x24791d(0x157)))return _0x1fa349[_0x24791d(0x15d)];if(_0x3a0358['includes']('Invalid\x20values'))return _0x1fa349['fZZri'];if(_0x3a0358['includes']('Missing\x20required\x20argument'))return _0x1fa349[_0x24791d(0x12d)];return _0x24791d(0x12b);}
|
|
@@ -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 _0x3255f1=_0xaaf9;(function(_0x518482,_0x541bf4){const _0x1ab837=_0xaaf9,_0x5b7b59=_0x518482();while(!![]){try{const _0xa0385e=-parseInt(_0x1ab837(0x13a))/0x1*(-parseInt(_0x1ab837(0xf7))/0x2)+parseInt(_0x1ab837(0x101))/0x3*(-parseInt(_0x1ab837(0x138))/0x4)+parseInt(_0x1ab837(0x11e))/0x5+parseInt(_0x1ab837(0x10a))/0x6+-parseInt(_0x1ab837(0x12f))/0x7+parseInt(_0x1ab837(0x140))/0x8+-parseInt(_0x1ab837(0x104))/0x9;if(_0xa0385e===_0x541bf4)break;else _0x5b7b59['push'](_0x5b7b59['shift']());}catch(_0x3508ad){_0x5b7b59['push'](_0x5b7b59['shift']());}}}(_0x24ca,0xdafd7));import{spawn}from'child_process';import _0x384df5 from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL=_0x3255f1(0x12b),WORKOS_TOKEN_URL='https://api.workos.com/user_management/authenticate';export async function requestDeviceCode(_0x2c2506){const _0x5abd0b=_0x3255f1,_0x1f433f={'azVJQ':function(_0xf818ad,_0x5c87,_0x3ea5ff){return _0xf818ad(_0x5c87,_0x3ea5ff);},'Duaxp':_0x5abd0b(0xf0),'XCjVk':'application/x-www-form-urlencoded'},_0x5aa197=await _0x1f433f['azVJQ'](fetch,WORKOS_DEVICE_AUTH_URL,{'method':_0x1f433f[_0x5abd0b(0xf9)],'headers':{'Content-Type':_0x1f433f[_0x5abd0b(0xf1)]},'body':new URLSearchParams({'client_id':_0x2c2506})});if(!_0x5aa197['ok']){const _0xd109e8=await _0x5aa197[_0x5abd0b(0x107)]();throw new Error(_0x5abd0b(0x102)+_0x5aa197[_0x5abd0b(0x144)]+'\x20'+_0xd109e8);}return _0x5aa197[_0x5abd0b(0x12e)]();}function _0xaaf9(_0x2facbf,_0x149d5c){_0x2facbf=_0x2facbf-0xf0;const _0x24ca37=_0x24ca();let _0xaaf9a9=_0x24ca37[_0x2facbf];return _0xaaf9a9;}function _0x24ca(){const _0x294355=['Using\x20organization:\x20','yxnLJ','/organization/self-serve-signup','xdg-open','application/x-www-form-urlencoded','device_code','/organization/my-memberships','name','toString','Setting\x20up\x20your\x20organization...','urn:ietf:params:oauth:grant-type:device_code','email','7284830jScleV','CLI\x20Key','fIIHq','lELHT','hADWN','\x27s\x20CLI\x20Key','uVNsW','write','firstName','YhQKg','Failed\x20to\x20fetch\x20memberships:\x20','Device\x20authorization\x20timed\x20out','workosClientId','https://api.workos.com/user_management/authorize/device','organizationId','interval','json','5897815tYgslD','parse','dgHbF','dulbk','selected','RapSn','unref','stdout','now','1528xnVxTL','apiKeys','10ZtllnQ','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','JDNpP','kirOb','SsgVl','/organization/me','4164000HYJCVL','fsJMR','refresh_token','length','status','access_token','authorization_pending','JBTuU','expires_in','dViPv','POST','XCjVk','apiKey','utf-8','Code:\x20','startsWith','tGuKD','282358VxwLWH','memberships','Duaxp','cmd','list','RbfcK','pRXzg','stringify','ignore','GET','10722ZdhDBE','Failed\x20to\x20request\x20device\x20code:\x20','error','15765183wbwiJd','bAgID','/cli-auth/token','text','Ikskc','lOvnd','8803362InEdtW','application/json','Waiting\x20for\x20authentication...','/api-keys','log','Select\x20an\x20organization:','Failed\x20to\x20create\x20organization:\x20','FdpOt'];_0x24ca=function(){return _0x294355;};return _0x24ca();}export async function pollForTokens(_0x1c55d3,_0x15db9d,_0x4a0298,_0x4838cb){const _0x3e003d=_0x3255f1,_0x4b0fb3={'dhUBj':function(_0x29c4fe,_0x5c251c){return _0x29c4fe*_0x5c251c;},'JBTuU':function(_0x1629f7,_0x5bfb49){return _0x1629f7*_0x5bfb49;},'mCRij':function(_0x356abd,_0x342aec){return _0x356abd<_0x342aec;},'yIdjY':function(_0x483c1a,_0x1ac298){return _0x483c1a(_0x1ac298);},'YhQKg':function(_0x32b43b,_0xf46c78,_0x530850){return _0x32b43b(_0xf46c78,_0x530850);},'lELHT':_0x3e003d(0x11c),'JDNpP':function(_0x29b267,_0x3212f2){return _0x29b267===_0x3212f2;}},_0x5cf54a=Date[_0x3e003d(0x137)]()+_0x4b0fb3['dhUBj'](_0x4838cb,0x3e8);let _0x1b970a=_0x4b0fb3[_0x3e003d(0x147)](_0x4a0298,0x3e8);while(_0x4b0fb3['mCRij'](Date[_0x3e003d(0x137)](),_0x5cf54a)){await _0x4b0fb3['yIdjY'](sleep,_0x1b970a);const _0x5b13ad=await _0x4b0fb3[_0x3e003d(0x127)](fetch,WORKOS_TOKEN_URL,{'method':_0x3e003d(0xf0),'headers':{'Content-Type':_0x3e003d(0x116)},'body':new URLSearchParams({'client_id':_0x1c55d3,'device_code':_0x15db9d,'grant_type':_0x4b0fb3[_0x3e003d(0x121)]})});if(_0x5b13ad['ok'])return _0x5b13ad['json']();const _0x107cb6=await _0x5b13ad['json']();if(_0x107cb6['error']===_0x3e003d(0x146))continue;if(_0x4b0fb3[_0x3e003d(0x13c)](_0x107cb6[_0x3e003d(0x103)],'slow_down')){_0x1b970a+=0x3e8;continue;}throw new Error(_0x107cb6['error_description']||_0x107cb6[_0x3e003d(0x103)]||'Authentication\x20failed');}throw new Error(_0x3e003d(0x129));}async function fetchUserProfile(_0x298049){const _0x508e64=_0x3255f1,_0x2fd947=getApiBaseUrl();try{const _0x46033b=await fetch(_0x2fd947+_0x508e64(0x13f),{'method':'GET','headers':{'workos-token':_0x298049}});if(_0x46033b['ok'])return _0x46033b['json']();}catch{}return null;}function buildKeyName(_0x2d9124,_0x58e735){const _0x5755bc=_0x3255f1,_0x2cbfa5={'WuBwB':function(_0x1dc5ce,_0x7bd627){return _0x1dc5ce===_0x7bd627;}},_0x5f224f=_0x58e735['filter'](_0x282492=>_0x282492['name']===_0x2d9124||_0x282492['name'][_0x5755bc(0xf5)](_0x2d9124+'\x20('));if(_0x2cbfa5['WuBwB'](_0x5f224f['length'],0x0))return _0x2d9124;return _0x2d9124+'\x20('+(_0x5f224f[_0x5755bc(0x143)]+0x1)+')';}export async function provisionApiKey(_0x515b0a){const _0x3b88e5=_0x3255f1,_0x3b4996={'IYClw':function(_0x26ba56){return _0x26ba56();},'CyXdk':function(_0x119d52,_0x4a538e){return _0x119d52(_0x4a538e);},'Zpxct':_0x3b88e5(0x11f),'lOvnd':_0x3b88e5(0x100),'swBQF':function(_0x1b13a6,_0x31ed32,_0x10f5f2){return _0x1b13a6(_0x31ed32,_0x10f5f2);},'uVNsW':function(_0x4366b1,_0x4a9424,_0x134904){return _0x4366b1(_0x4a9424,_0x134904);}},_0x122a0b=_0x3b4996['IYClw'](getApiBaseUrl),_0x23db3c={'Content-Type':'application/json','workos-token':_0x515b0a},_0x127e54=await _0x3b4996['CyXdk'](fetchUserProfile,_0x515b0a),_0x2b291e=_0x127e54?.[_0x3b88e5(0x126)]||_0x127e54?.[_0x3b88e5(0x11d)]?.['split']('@')[0x0],_0x5d244e=_0x2b291e?_0x2b291e+_0x3b88e5(0x123):_0x3b4996['Zpxct'];let _0x2a523e=[];try{const _0x1f2a37=await fetch(_0x122a0b+'/api-keys',{'method':_0x3b4996[_0x3b88e5(0x109)],'headers':_0x23db3c});if(_0x1f2a37['ok']){const _0x5b56f5=await _0x1f2a37[_0x3b88e5(0x12e)]();_0x2a523e=_0x5b56f5[_0x3b88e5(0x139)];}}catch{}const _0x1a84cb=_0x3b4996['swBQF'](buildKeyName,_0x5d244e,_0x2a523e),_0x40b5c2=await _0x3b4996[_0x3b88e5(0x124)](fetch,_0x122a0b+_0x3b88e5(0x10d),{'method':'POST','headers':_0x23db3c,'body':JSON[_0x3b88e5(0xfe)]({'name':_0x1a84cb,'scope':'mcp:write'})});if(!_0x40b5c2['ok']){const _0x4e139f=await _0x40b5c2['text']();throw new Error('Failed\x20to\x20provision\x20API\x20key:\x20'+_0x40b5c2['status']+'\x20'+_0x4e139f);}const _0x32ec1e=await _0x40b5c2[_0x3b88e5(0x12e)]();return _0x32ec1e[_0x3b88e5(0xf2)]['token'];}export function openBrowser(_0x4cef76){const _0x3fa80f=_0x3255f1,_0x423db4={'hADWN':_0x3fa80f(0xfa),'pRXzg':'start','SsgVl':_0x3fa80f(0xff),'yxnLJ':function(_0x449e29,_0x139385){return _0x449e29===_0x139385;},'AMIXL':'darwin'};try{if(process['platform']==='win32'){const _0x516f42=spawn(_0x423db4[_0x3fa80f(0x122)],['/c',_0x423db4[_0x3fa80f(0xfd)],'',_0x4cef76],{'detached':!![],'stdio':_0x423db4[_0x3fa80f(0x13e)],'windowsHide':!![]});_0x516f42['unref']();return;}const _0x39f71d=_0x423db4[_0x3fa80f(0x113)](process['platform'],_0x423db4['AMIXL'])?'open':_0x3fa80f(0x115),_0x379c1d=spawn(_0x39f71d,[_0x4cef76],{'detached':!![],'stdio':'ignore'});_0x379c1d[_0x3fa80f(0x135)]();}catch{}}function decodeJwtPayload(_0x331139){const _0xed2fa3=_0x3255f1,_0x3b5078={'BVuhi':'Invalid\x20JWT\x20format','bAgID':'base64url'},_0x7dd591=_0x331139['split']('.');if(_0x7dd591[_0xed2fa3(0x143)]!==0x3)throw new Error(_0x3b5078['BVuhi']);const _0x20d4e2=Buffer['from'](_0x7dd591[0x1],_0x3b5078[_0xed2fa3(0x105)])[_0xed2fa3(0x11a)](_0xed2fa3(0xf3));return JSON[_0xed2fa3(0x130)](_0x20d4e2);}async function selfServeSignup(_0x827549){const _0x1d8749=_0x3255f1,_0x3c126e={'RbfcK':function(_0x111ddc){return _0x111ddc();},'niXTv':'POST','PWEUk':_0x1d8749(0x10b)},_0x576838=_0x3c126e[_0x1d8749(0xfc)](getApiBaseUrl),_0x206c41=await fetch(_0x576838+_0x1d8749(0x114),{'method':_0x3c126e['niXTv'],'headers':{'Content-Type':_0x3c126e['PWEUk'],'workos-token':_0x827549}});if(!_0x206c41['ok']){const _0x54d085=await _0x206c41[_0x1d8749(0x107)]();throw new Error(_0x1d8749(0x110)+_0x206c41[_0x1d8749(0x144)]+'\x20'+_0x54d085);}return _0x206c41['json']();}async function fetchMyMemberships(_0xda3e36){const _0x5e8f89=_0x3255f1,_0x3440a8={'Ikskc':function(_0x24bf44){return _0x24bf44();},'kirOb':function(_0x4b2ace,_0x339568,_0x162dad){return _0x4b2ace(_0x339568,_0x162dad);}},_0x53a3e3=_0x3440a8[_0x5e8f89(0x108)](getApiBaseUrl),_0x591474=await _0x3440a8[_0x5e8f89(0x13d)](fetch,_0x53a3e3+_0x5e8f89(0x118),{'method':'GET','headers':{'workos-token':_0xda3e36}});if(!_0x591474['ok']){const _0x322e6e=await _0x591474['text']();throw new Error(_0x5e8f89(0x128)+_0x591474['status']+'\x20'+_0x322e6e);}const _0x444b91=await _0x591474[_0x5e8f89(0x12e)]();return _0x444b91[_0x5e8f89(0xf8)];}async function refreshTokenWithOrg(_0x22c451,_0xb60820,_0xb702a7){const _0x5b8607=_0x3255f1,_0x48b1a1={'dgHbF':function(_0x3ea3a2,_0x40e207,_0x401854){return _0x3ea3a2(_0x40e207,_0x401854);},'TaSUs':_0x5b8607(0x116),'gBEbR':_0x5b8607(0x142)},_0x4de1ea=await _0x48b1a1[_0x5b8607(0x131)](fetch,WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x48b1a1['TaSUs']},'body':new URLSearchParams({'client_id':_0x22c451,'grant_type':_0x48b1a1['gBEbR'],'refresh_token':_0xb60820,'organization_id':_0xb702a7})});if(!_0x4de1ea['ok']){const _0x5c9e92=await _0x4de1ea[_0x5b8607(0x107)]();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x4de1ea[_0x5b8607(0x144)]+'\x20'+_0x5c9e92);}return _0x4de1ea[_0x5b8607(0x12e)]();}async function provisionCliToken(_0x2ebee0){const _0x5e0942=_0x3255f1,_0x3337d4={'FdpOt':_0x5e0942(0x10b)},_0x4b15b0=getApiBaseUrl(),_0x2c9531=await fetch(_0x4b15b0+_0x5e0942(0x106),{'method':'POST','headers':{'Content-Type':_0x3337d4[_0x5e0942(0x111)],'workos-token':_0x2ebee0}});if(!_0x2c9531['ok']){const _0x137aa8=await _0x2c9531[_0x5e0942(0x107)]();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x2c9531[_0x5e0942(0x144)]+'\x20'+_0x137aa8);}return _0x2c9531['json']();}export async function runDeviceAuthFlow(){const _0x1b5455=_0x3255f1,_0x3d5d9e={'RapSn':function(_0x197be6,_0x527750){return _0x197be6(_0x527750);},'fIIHq':'\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','dViPv':_0x1b5455(0x10c),'wXHEU':function(_0x418ae1,_0x273044,_0x164477,_0x276ab1,_0x37d276){return _0x418ae1(_0x273044,_0x164477,_0x276ab1,_0x37d276);},'jiZaU':function(_0x26efab,_0x924c03){return _0x26efab===_0x924c03;},'tGuKD':_0x1b5455(0x11b),'fsJMR':'Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','dulbk':'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','Qszyd':_0x1b5455(0xfb),'KqGKv':function(_0x717478,_0x4d9d93,_0x6e2f5f,_0x4a22a3){return _0x717478(_0x4d9d93,_0x6e2f5f,_0x4a22a3);},'LwNFl':function(_0x1f6048,_0x5c9711){return _0x1f6048(_0x5c9711);}},_0x292fc1=getCurrentEnvironment(),_0x57e5b6=ENVIRONMENT_CONFIGS[_0x292fc1][_0x1b5455(0x12a)],_0x1cf76b=await _0x3d5d9e[_0x1b5455(0x134)](requestDeviceCode,_0x57e5b6);console['log'](_0x1b5455(0x13b)),console['log'](_0x3d5d9e[_0x1b5455(0x120)]),_0x3d5d9e['RapSn'](openBrowser,_0x1cf76b['verification_uri_complete']),console['log']('If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20'+_0x1cf76b['verification_uri_complete']),console[_0x1b5455(0x10e)](_0x1b5455(0xf4)+_0x1cf76b['user_code']+'\x0a'),process['stdout']['write'](_0x3d5d9e[_0x1b5455(0x149)]);let _0x3de616=await _0x3d5d9e['wXHEU'](pollForTokens,_0x57e5b6,_0x1cf76b[_0x1b5455(0x117)],_0x1cf76b[_0x1b5455(0x12d)],_0x1cf76b[_0x1b5455(0x148)]);console['log']('\x20✓');const _0x4dc3ac=decodeJwtPayload(_0x3de616[_0x1b5455(0x145)]);if(!_0x4dc3ac['org_id']){const _0x1c7e5f=await _0x3d5d9e['RapSn'](fetchMyMemberships,_0x3de616['access_token']);let _0x498a41;if(_0x3d5d9e['jiZaU'](_0x1c7e5f[_0x1b5455(0x143)],0x0)){process[_0x1b5455(0x136)][_0x1b5455(0x125)](_0x3d5d9e[_0x1b5455(0xf6)]);const _0x54eb89=await selfServeSignup(_0x3de616[_0x1b5455(0x145)]);_0x498a41=_0x54eb89[_0x1b5455(0x12c)],console[_0x1b5455(0x10e)]('\x20✓');}else{if(_0x1c7e5f[_0x1b5455(0x143)]===0x1)_0x498a41=_0x1c7e5f[0x0]['organizationId'],console[_0x1b5455(0x10e)](_0x1b5455(0x112)+_0x1c7e5f[0x0]['name']);else{const _0x5befba=process['stdin']['isTTY']&&process['stdout']['isTTY'];if(!_0x5befba)throw new Error(_0x3d5d9e[_0x1b5455(0x141)]+_0x3d5d9e[_0x1b5455(0x132)]);const {selected:_0x5ab4a3}=await _0x384df5['prompt']([{'type':_0x3d5d9e['Qszyd'],'name':_0x1b5455(0x133),'message':_0x1b5455(0x10f),'choices':_0x1c7e5f['map'](_0x43ce13=>({'name':_0x43ce13[_0x1b5455(0x119)],'value':_0x43ce13[_0x1b5455(0x12c)]}))}]);_0x498a41=_0x5ab4a3;}}_0x3de616=await _0x3d5d9e['KqGKv'](refreshTokenWithOrg,_0x57e5b6,_0x3de616[_0x1b5455(0x142)],_0x498a41);}process[_0x1b5455(0x136)][_0x1b5455(0x125)]('Provisioning\x20CLI\x20token...');const _0x4550ff=await provisionCliToken(_0x3de616['access_token']);return console['log']('\x20✓'),await storeToken(_0x4550ff['token']),_0x3de616[_0x1b5455(0x142)]&&await _0x3d5d9e['LwNFl'](storeRefreshToken,_0x3de616[_0x1b5455(0x142)]),_0x4550ff['token'];}function sleep(_0x5dbe9c){return new Promise(_0x38d0af=>setTimeout(_0x38d0af,_0x5dbe9c));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function _0xa790(_0x346e54,_0x709af){_0x346e54=_0x346e54-0x176;const _0x355622=_0x3556();let _0xa7907d=_0x355622[_0x346e54];return _0xa7907d;}const _0x4c178a=_0xa790;function _0x3556(){const _0x234b97=['mOmEu','EqvMQ','client_01J9CBYM2DKWV9HM17D95Z540K','xxruY','find','error','RANGER_CLI_ENV','2636860WdYUJA','https://api.staging.ranger.net','nova-act-cli','toLowerCase','BmTFg','114WAOqrt','CCMJp','staging','114SlISLZ','Invalid\x20RANGER_TRANSPORT=\x22','277434QNesde','client_01J9CBYM7M5ZETCF7G6614DXR2','4475XZdyvx','https://ai-proxy-301751771437.us-central1.run.app','16426ctbqIe','211099kpSPxB','mcp','rangerwright-cli','FpJVw','RANGER_MCP_AUTH_URL','vWxly','prod','104VCbsGy','Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.','330850YybTmW','RANGER_TRANSPORT','https://ai-proxy-716115358910.us-central1.run.app','ZkuJN','RANGER_USE_NOVA_ACT','10908425lcVUDa','true','auto','\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.','env','2936Fwjiuf','local','off'];_0x3556=function(){return _0x234b97;};return _0x3556();}(function(_0x57d3ba,_0x4d365b){const _0x3f280f=_0xa790,_0x4939a5=_0x57d3ba();while(!![]){try{const _0x5595f6=-parseInt(_0x3f280f(0x188))/0x1+parseInt(_0x3f280f(0x17e))/0x2*(parseInt(_0x3f280f(0x178))/0x3)+parseInt(_0x3f280f(0x192))/0x4*(parseInt(_0x3f280f(0x17c))/0x5)+parseInt(_0x3f280f(0x1a1))/0x6*(-parseInt(_0x3f280f(0x17f))/0x7)+parseInt(_0x3f280f(0x186))/0x8*(-parseInt(_0x3f280f(0x17a))/0x9)+-parseInt(_0x3f280f(0x19c))/0xa+parseInt(_0x3f280f(0x18d))/0xb;if(_0x5595f6===_0x4d365b)break;else _0x4939a5['push'](_0x4939a5['shift']());}catch(_0x2452f8){_0x4939a5['push'](_0x4939a5['shift']());}}}(_0x3556,0x5fcfa));export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':'https://api.ranger.net','workosClientId':_0x4c178a(0x17b),'aiProxyUrl':_0x4c178a(0x18a),'mcpAuthUrl':'https://mcp-auth.ranger.net/mcp'},'staging':{'apiBaseUrl':_0x4c178a(0x19d),'workosClientId':_0x4c178a(0x197),'aiProxyUrl':_0x4c178a(0x17d),'mcpAuthUrl':'https://mcp-auth.staging.ranger.net/mcp'},'local':{'apiBaseUrl':'http://localhost:8080','workosClientId':_0x4c178a(0x197),'aiProxyUrl':'http://localhost:8090','mcpAuthUrl':'http://localhost:8080/mcp'}};export const DEFAULT_ENVIRONMENT=_0x4c178a(0x185);export function isValidEnvironment(_0x42891c){const _0x2454bd=_0x4c178a,_0x31dda3={'ZkuJN':'prod','vWxly':_0x2454bd(0x177),'hWsAU':function(_0x12a331,_0x5e0d42){return _0x12a331===_0x5e0d42;}};return _0x42891c===_0x31dda3[_0x2454bd(0x18b)]||_0x42891c===_0x31dda3[_0x2454bd(0x184)]||_0x31dda3['hWsAU'](_0x42891c,_0x2454bd(0x193));}export function getCurrentEnvironment(){const _0x3b25c6=_0x4c178a,_0x12f952={'vBXGl':function(_0x4586d3,_0x750025){return _0x4586d3(_0x750025);}},_0x254f4f=process[_0x3b25c6(0x191)][_0x3b25c6(0x19b)];if(_0x254f4f&&_0x12f952['vBXGl'](isValidEnvironment,_0x254f4f))return _0x254f4f;return DEFAULT_ENVIRONMENT;}export function getApiBaseUrl(){return ENVIRONMENT_CONFIGS[getCurrentEnvironment()]['apiBaseUrl'];}export function getAiProxyUrl(){return ENVIRONMENT_CONFIGS[getCurrentEnvironment()]['aiProxyUrl'];}export function getMcpAuthUrl(){const _0x25c946=_0x4c178a,_0x3f61a5={'BmTFg':function(_0x35054d){return _0x35054d();}};return process[_0x25c946(0x191)][_0x25c946(0x183)]??ENVIRONMENT_CONFIGS[_0x3f61a5[_0x25c946(0x1a0)](getCurrentEnvironment)]['mcpAuthUrl'];}export function isByokEnabled(){const _0x5e0985=_0x4c178a,_0x5d54cb={'bfmDm':_0x5e0985(0x18e)};return process['env']['RANGER_BYOK']===_0x5d54cb['bfmDm'];}function isVerificationTransport(_0x5dea5e){const _0x1120a9=_0x4c178a,_0xd3bc7={'QTKaA':function(_0xd310d,_0x16363a){return _0xd310d===_0x16363a;},'FpJVw':_0x1120a9(0x180),'TgpuJ':function(_0x1aa89f,_0x54f89f){return _0x1aa89f===_0x54f89f;},'CCMJp':'playwright-cli','EqvMQ':_0x1120a9(0x181)};return _0xd3bc7['QTKaA'](_0x5dea5e,_0xd3bc7[_0x1120a9(0x182)])||_0xd3bc7['TgpuJ'](_0x5dea5e,_0xd3bc7[_0x1120a9(0x176)])||_0x5dea5e===_0x1120a9(0x19e)||_0x5dea5e===_0xd3bc7[_0x1120a9(0x196)];}const LEGACY_TRANSPORT_ENV_VARS=[_0x4c178a(0x18c),'RANGER_DISABLE_MCP'];export function getVerificationTransport(){const _0x2842f0=_0x4c178a,_0x1d2fad={'CAXzS':function(_0x142fa5,_0x7df511){return _0x142fa5(_0x7df511);}},_0xe0c68a=process['env'][_0x2842f0(0x189)]?.['trim']();if(_0xe0c68a){if(_0x1d2fad['CAXzS'](isVerificationTransport,_0xe0c68a))return _0xe0c68a;throw new Error(_0x2842f0(0x179)+_0xe0c68a+_0x2842f0(0x190));}const _0x145823=LEGACY_TRANSPORT_ENV_VARS[_0x2842f0(0x199)](_0xa69b0=>process['env'][_0xa69b0]);if(_0x145823)throw new Error(_0x145823+'\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.');return'mcp';}export function resolveHookMode(_0x14f596=process[_0x4c178a(0x191)]){const _0x49e19e=_0x4c178a,_0x348d20={'xxruY':_0x49e19e(0x18f),'RXggP':_0x49e19e(0x194),'mOmEu':function(_0x5292a7,_0x39cd83){return _0x5292a7===_0x39cd83;},'wCfcG':function(_0x1afbe5,_0x4320df){return _0x1afbe5===_0x4320df;}},_0x5076db=_0x14f596['RANGER_HOOKS']?.['trim']()[_0x49e19e(0x19f)]();if(!_0x5076db)return _0x348d20[_0x49e19e(0x198)];if(_0x5076db===_0x348d20['RXggP']||_0x348d20[_0x49e19e(0x195)](_0x5076db,'on')||_0x348d20['wCfcG'](_0x5076db,_0x348d20['xxruY']))return _0x5076db;return console[_0x49e19e(0x19a)]('[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22'+_0x14f596['RANGER_HOOKS']+'\x22.\x20'+_0x49e19e(0x187)),_0x348d20['xxruY'];}
|
|
@@ -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(_0x1b7ecf,_0x13fae1){const _0x295b9c=_0x453c,_0x38811e=_0x1b7ecf();while(!![]){try{const _0xa40586=parseInt(_0x295b9c(0x108))/0x1*(parseInt(_0x295b9c(0x149))/0x2)+parseInt(_0x295b9c(0x116))/0x3+-parseInt(_0x295b9c(0x13c))/0x4*(parseInt(_0x295b9c(0x11b))/0x5)+-parseInt(_0x295b9c(0x14b))/0x6+parseInt(_0x295b9c(0x10e))/0x7*(parseInt(_0x295b9c(0x137))/0x8)+-parseInt(_0x295b9c(0x13a))/0x9*(parseInt(_0x295b9c(0x115))/0xa)+parseInt(_0x295b9c(0x125))/0xb;if(_0xa40586===_0x13fae1)break;else _0x38811e['push'](_0x38811e['shift']());}catch(_0x3ed1fa){_0x38811e['push'](_0x38811e['shift']());}}}(_0x3d20,0xb93f8));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x19d5c6){const _0x5ab06f=_0x453c,_0x281ac4={'pXGFj':function(_0x3f8764){return _0x3f8764();},'FrgJj':function(_0x3c2d9a,_0x15c93e){return _0x3c2d9a===_0x15c93e;}},_0x1da807=await _0x281ac4['pXGFj'](getToken);if(!_0x1da807)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0xf190ea=getApiBaseUrl(),_0x1d506c=await fetch(_0xf190ea+'/api/v1/mcp/features',{'method':_0x5ab06f(0x120),'headers':{'Authorization':'Bearer\x20'+_0x1da807,'Content-Type':'application/json'},'body':JSON['stringify'](_0x19d5c6)});if(!_0x1d506c['ok']){if(_0x281ac4['FrgJj'](_0x1d506c['status'],0x192)){const _0x1798e0=await _0x1d506c[_0x5ab06f(0x146)](),_0x15bcd8=_0x1798e0[_0x5ab06f(0x145)]||_0x5ab06f(0x106);throw new Error((_0x1798e0['message']||_0x5ab06f(0x10a))+'\x0a\x0aUpgrade\x20your\x20plan:\x20'+_0x15bcd8);}const _0x370bba=await _0x1d506c[_0x5ab06f(0x148)]();throw new Error('Failed\x20to\x20create\x20feature\x20review:\x20'+_0x370bba);}return _0x1d506c['json']();}export async function listFeatures(_0x522080){const _0x4a8e50=_0x453c,_0x48730e={'NJaRx':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','ZbyuQ':'gitRepoUrl','vkazZ':'gitBranch','Ijqcj':'offset','CDttK':_0x4a8e50(0x127),'TnIDK':'GET'},_0x34ca7a=await getToken();if(!_0x34ca7a)throw new Error(_0x48730e['NJaRx']);const _0x14cfaf=getApiBaseUrl(),_0x28f8b3=new URLSearchParams();if(_0x522080?.[_0x4a8e50(0x119)])_0x28f8b3['set'](_0x48730e[_0x4a8e50(0x13e)],_0x522080[_0x4a8e50(0x119)]);if(_0x522080?.[_0x4a8e50(0x12a)])_0x28f8b3['set'](_0x48730e['vkazZ'],_0x522080['gitBranch']);if(_0x522080?.[_0x4a8e50(0x11a)])_0x28f8b3[_0x4a8e50(0x10b)]('limit',_0x522080[_0x4a8e50(0x11a)]['toString']());if(_0x522080?.['offset'])_0x28f8b3['set'](_0x48730e['Ijqcj'],_0x522080[_0x4a8e50(0x118)]['toString']());if(_0x522080?.['includeDeleted'])_0x28f8b3['set']('includeDeleted',_0x48730e['CDttK']);const _0x19c89d=_0x14cfaf+'/api/v1/mcp/features'+(_0x28f8b3[_0x4a8e50(0x10c)]()?'?'+_0x28f8b3['toString']():''),_0x15ef86=await fetch(_0x19c89d,{'method':_0x48730e[_0x4a8e50(0x12c)],'headers':{'Authorization':'Bearer\x20'+_0x34ca7a}});if(!_0x15ef86['ok']){const _0x210e01=await _0x15ef86['text']();throw new Error(_0x4a8e50(0x142)+_0x210e01);}return _0x15ef86[_0x4a8e50(0x146)]();}export async function getFeature(_0x27a558){const _0x101074=_0x453c,_0x37130c={'MFSBj':function(_0x326c51){return _0x326c51();},'rNefc':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','VcRZA':function(_0x280ebe,_0x4180ab,_0x18ce78){return _0x280ebe(_0x4180ab,_0x18ce78);},'dmAgE':_0x101074(0x110)},_0x11c7af=await _0x37130c['MFSBj'](getToken);if(!_0x11c7af)throw new Error(_0x37130c['rNefc']);const _0x1e78c4=_0x37130c['MFSBj'](getApiBaseUrl),_0x250a8f=await _0x37130c[_0x101074(0x130)](fetch,_0x1e78c4+'/api/v1/mcp/features/'+_0x27a558,{'method':_0x37130c['dmAgE'],'headers':{'Authorization':'Bearer\x20'+_0x11c7af}});if(!_0x250a8f['ok']){const _0x3bbd34=await _0x250a8f['text']();throw new Error(_0x101074(0x133)+_0x3bbd34);}return _0x250a8f['json']();}export async function updateFeature(_0x153da1,_0x2ac258){const _0x54ea56=_0x453c,_0x22a134={'VtgIH':function(_0x74eba6){return _0x74eba6();},'ulHwt':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','kYPMK':function(_0x45744b,_0x26c597,_0x3f340b){return _0x45744b(_0x26c597,_0x3f340b);},'qdGPh':_0x54ea56(0x147)},_0x5e83ee=await _0x22a134['VtgIH'](getToken);if(!_0x5e83ee)throw new Error(_0x22a134['ulHwt']);const _0x24e575=getApiBaseUrl(),_0x556bbe=await _0x22a134['kYPMK'](fetch,_0x24e575+_0x54ea56(0x129)+_0x153da1,{'method':_0x22a134['qdGPh'],'headers':{'Authorization':_0x54ea56(0x135)+_0x5e83ee,'Content-Type':'application/json'},'body':JSON['stringify'](_0x2ac258)});if(!_0x556bbe['ok']){const _0x3c8331=await _0x556bbe[_0x54ea56(0x148)]();throw new Error(_0x54ea56(0x140)+_0x3c8331);}return _0x556bbe['json']();}export async function createChecklistItem(_0x1ece83,_0x1a060b,_0x8da945){const _0xed90fd=_0x453c,_0x1b1834={'SLWmM':function(_0x284b21){return _0x284b21();},'rdQqG':function(_0x1c9c50){return _0x1c9c50();},'iabQE':_0xed90fd(0x120),'vSqGw':_0xed90fd(0x14c)},_0x5d3c43=await _0x1b1834[_0xed90fd(0x105)](getToken);if(!_0x5d3c43)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x3ffa45=_0x1b1834[_0xed90fd(0x11e)](getApiBaseUrl),_0x424a2f=await fetch(_0x3ffa45+_0xed90fd(0x129)+_0x1ece83+_0xed90fd(0x109),{'method':_0x1b1834['iabQE'],'headers':{'Authorization':'Bearer\x20'+_0x5d3c43,'Content-Type':_0x1b1834[_0xed90fd(0x11c)]},'body':JSON['stringify']({'description':_0x1a060b,'position':_0x8da945})});if(!_0x424a2f['ok']){const _0x30ba0=await _0x424a2f[_0xed90fd(0x148)]();throw new Error('Failed\x20to\x20create\x20scenario:\x20'+_0x30ba0);}return _0x424a2f[_0xed90fd(0x146)]();}export async function updateChecklistItem(_0x3d36e2,_0x35284c,_0x2aa257){const _0xef9b1e=_0x453c,_0x865f89={'DoayX':function(_0x399200){return _0x399200();},'dbtrF':function(_0x9dc3f4,_0x1fad9c,_0x43e1db){return _0x9dc3f4(_0x1fad9c,_0x43e1db);},'cYSZI':'application/json'};return _0x865f89['dbtrF'](withRetry,async()=>{const _0x39cc48=_0x453c,_0x4fa611=await getToken();if(!_0x4fa611)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x314193=_0x865f89['DoayX'](getApiBaseUrl),_0x3c369a=await _0x865f89['dbtrF'](fetch,_0x314193+'/api/v1/mcp/features/'+_0x3d36e2+_0x39cc48(0x124)+_0x35284c,{'method':'PATCH','headers':{'Authorization':_0x39cc48(0x135)+_0x4fa611,'Content-Type':_0x865f89[_0x39cc48(0x134)]},'body':JSON['stringify'](_0x2aa257)});if(!_0x3c369a['ok']){const _0x3d84fd=await _0x3c369a['text']();throw new Error(_0x39cc48(0x13d)+_0x3d84fd);}return _0x3c369a['json']();},{'label':_0xef9b1e(0x113)});}export async function getFeatureReport(_0x368109){const _0x90432e=_0x453c,_0x431bde=await getToken();if(!_0x431bde)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x2240a3=getApiBaseUrl(),_0xcc615=await fetch(_0x2240a3+'/api/v1/mcp/features/'+_0x368109+_0x90432e(0x122),{'method':'GET','headers':{'Authorization':_0x90432e(0x135)+_0x431bde}});if(!_0xcc615['ok']){const _0x4b7309=await _0xcc615[_0x90432e(0x148)]();throw new Error(_0x90432e(0x112)+_0x4b7309);}return _0xcc615['json']();}export async function getFeatureReportMarkdown(_0x1ee020,_0x147a86){const _0x15f229=_0x453c,_0x15389a={'ThCfh':function(_0x343404){return _0x343404();},'AWNxd':function(_0x2ad5a3){return _0x2ad5a3();},'OKlmQ':function(_0x370af9,_0x27faf4){return _0x370af9(_0x27faf4);},'HzmjF':_0x15f229(0x11d),'RehIi':function(_0x414a73,_0x373239){return _0x414a73&&_0x373239;},'kbYgA':'style','WSGUm':_0x15f229(0x110)},_0x380d82=await _0x15389a['ThCfh'](getToken);if(!_0x380d82)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x369b85=_0x15389a[_0x15f229(0x131)](getApiBaseUrl),_0x566e4f=new URLSearchParams(),_0x3530d9=(_0x147a86?.['itemIds']?.['length']??0x0)>0x0,_0xb380d7=_0x15389a[_0x15f229(0x12d)](Boolean,_0x147a86?.[_0x15f229(0x12b)]);_0x3530d9&&_0x147a86?.[_0x15f229(0x11d)]&&_0x566e4f[_0x15f229(0x10b)](_0x15389a['HzmjF'],_0x147a86[_0x15f229(0x11d)]['join'](','));_0xb380d7&&_0x147a86?.[_0x15f229(0x12b)]&&_0x566e4f['set'](_0x15f229(0x12b),_0x147a86[_0x15f229(0x12b)]);_0x15389a[_0x15f229(0x141)](!_0x3530d9,!_0xb380d7)&&_0x147a86?.[_0x15f229(0x128)]&&_0x566e4f[_0x15f229(0x10b)](_0x15389a[_0x15f229(0x107)],_0x147a86[_0x15f229(0x128)]);const _0x1a5c00=_0x369b85+'/api/v1/mcp/features/'+_0x1ee020+'/report/markdown',_0x2bb73c=''+_0x1a5c00+(_0x566e4f['toString']()?'?'+_0x566e4f[_0x15f229(0x10c)]():''),_0x279248=await fetch(_0x2bb73c,{'method':_0x15389a[_0x15f229(0x111)],'headers':{'Authorization':'Bearer\x20'+_0x380d82}});if(!_0x279248['ok']){const _0x1275e0=await _0x279248['text']();throw new Error(_0x15f229(0x123)+_0x1275e0);}return _0x279248[_0x15f229(0x148)]();}export async function listFeatureSessions(_0x405b60){const _0x2c4e5d=_0x453c,_0x7450d5=await getToken();if(!_0x7450d5)throw new Error(_0x2c4e5d(0x126));const _0x29f34d=getApiBaseUrl(),_0x6a6a22=await fetch(_0x29f34d+'/api/v1/mcp/features/'+_0x405b60+'/sessions',{'method':'GET','headers':{'Authorization':_0x2c4e5d(0x135)+_0x7450d5}});if(!_0x6a6a22['ok']){const _0x36c8f8=await _0x6a6a22['text']();throw new Error(_0x2c4e5d(0x10f)+_0x36c8f8);}return _0x6a6a22[_0x2c4e5d(0x146)]();}function _0x453c(_0xec537b,_0x15de4f){_0xec537b=_0xec537b-0x102;const _0x3d202d=_0x3d20();let _0x453c93=_0x3d202d[_0xec537b];return _0x453c93;}export async function startSession(_0x3c24f5,_0x7d9c4a){const _0x8623e4=_0x453c,_0xa191bd={'TnpDT':function(_0x28c96b){return _0x28c96b();},'irGsW':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','mexbt':function(_0x2914db){return _0x2914db();},'yroYe':'POST'},_0x540943=await _0xa191bd[_0x8623e4(0x12f)](getToken);if(!_0x540943)throw new Error(_0xa191bd['irGsW']);const _0x59d53b=_0xa191bd[_0x8623e4(0x14a)](getApiBaseUrl),_0x4f42b0=await fetch(_0x59d53b+'/api/v1/mcp/features/'+_0x3c24f5+_0x8623e4(0x143)+_0x7d9c4a+_0x8623e4(0x117),{'method':_0xa191bd['yroYe'],'headers':{'Authorization':'Bearer\x20'+_0x540943}});if(!_0x4f42b0['ok']){const _0x3d9604=await _0x4f42b0[_0x8623e4(0x148)]();throw new Error(_0x8623e4(0x114)+_0x3d9604);}return _0x4f42b0[_0x8623e4(0x146)]();}export async function concludeSession(_0x3eae3c,_0x569810){const _0x3d83cb=_0x453c,_0x5b5cc9={'UtzWj':function(_0x137ce4){return _0x137ce4();},'oxokH':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','CGmEW':_0x3d83cb(0x120)},_0x20a15c=await _0x5b5cc9[_0x3d83cb(0x13f)](getToken);if(!_0x20a15c)throw new Error(_0x5b5cc9[_0x3d83cb(0x13b)]);const _0x4cdd69=getApiBaseUrl(),_0x2898e5=await fetch(_0x4cdd69+_0x3d83cb(0x129)+_0x3eae3c+'/sessions/'+_0x569810+_0x3d83cb(0x121),{'method':_0x5b5cc9[_0x3d83cb(0x11f)],'headers':{'Authorization':'Bearer\x20'+_0x20a15c}});if(!_0x2898e5['ok']){const _0x52a4c3=await _0x2898e5[_0x3d83cb(0x148)]();throw new Error('Failed\x20to\x20conclude\x20session:\x20'+_0x52a4c3);}return _0x2898e5['json']();}export async function getActionItems(_0x60c077){const _0x581fab=_0x453c,_0x232889={'OYnGk':_0x581fab(0x126),'FezzJ':function(_0x11bd65){return _0x11bd65();},'Xwdlq':_0x581fab(0x110)},_0x254cd4=await getToken();if(!_0x254cd4)throw new Error(_0x232889[_0x581fab(0x10d)]);const _0x36cc63=_0x232889[_0x581fab(0x138)](getApiBaseUrl),_0x57bd63=await fetch(_0x36cc63+_0x581fab(0x129)+_0x60c077+_0x581fab(0x102),{'method':_0x232889[_0x581fab(0x12e)],'headers':{'Authorization':'Bearer\x20'+_0x254cd4}});if(!_0x57bd63['ok']){const _0x39d4a0=await _0x57bd63[_0x581fab(0x148)]();throw new Error(_0x581fab(0x136)+_0x39d4a0);}return _0x57bd63[_0x581fab(0x146)]();}export async function getItemFeedback(_0xcc383c,_0x22d892){const _0x17fee4=_0x453c,_0x50c99a={'rOnrN':function(_0xa5fc90){return _0xa5fc90();},'Sdqhr':'GET'},_0x4c4876=await getToken();if(!_0x4c4876)throw new Error(_0x17fee4(0x126));const _0x2e3f86=_0x50c99a['rOnrN'](getApiBaseUrl),_0x104fef=await fetch(_0x2e3f86+_0x17fee4(0x129)+_0xcc383c+'/checklist-items/'+_0x22d892+_0x17fee4(0x103),{'method':_0x50c99a[_0x17fee4(0x144)],'headers':{'Authorization':_0x17fee4(0x135)+_0x4c4876}});if(!_0x104fef['ok']){const _0x400e01=await _0x104fef[_0x17fee4(0x148)]();throw new Error(_0x17fee4(0x14e)+_0x400e01);}return _0x104fef[_0x17fee4(0x146)]();}export async function markCommentsAddressed(_0x5ccdb9,_0x4d8af6,_0x221988){const _0x4fd129=_0x453c,_0x2d9667={'uAAoY':_0x4fd129(0x126),'dqwvr':_0x4fd129(0x14c)},_0x1e2375=await getToken();if(!_0x1e2375)throw new Error(_0x2d9667[_0x4fd129(0x104)]);const _0x370ac6=getApiBaseUrl(),_0x333d7a=await fetch(_0x370ac6+_0x4fd129(0x129)+_0x5ccdb9+'/comments/address',{'method':'POST','headers':{'Authorization':_0x4fd129(0x135)+_0x1e2375,'Content-Type':_0x2d9667[_0x4fd129(0x132)]},'body':JSON['stringify']({'checklistItemId':_0x4d8af6,'commentIds':_0x221988})});if(!_0x333d7a['ok']){const _0x2d2520=await _0x333d7a['text']();throw new Error('Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20'+_0x2d2520);}}function _0x3d20(){const _0x48669d=['/conclude','/report','Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20','/checklist/','7692080bGzAuD','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','true','style','/api/v1/mcp/features/','gitBranch','sessionId','TnIDK','OKlmQ','Xwdlq','TnpDT','VcRZA','AWNxd','dqwvr','Failed\x20to\x20get\x20feature\x20review:\x20','cYSZI','Bearer\x20','Failed\x20to\x20get\x20action\x20items:\x20','8rIgvFB','FezzJ','/restore','27LrEBvK','oxokH','568fDKDyl','Failed\x20to\x20update\x20scenario:\x20','ZbyuQ','UtzWj','Failed\x20to\x20update\x20feature\x20review:\x20','RehIi','Failed\x20to\x20list\x20feature\x20reviews:\x20','/sessions/','Sdqhr','billingUrl','json','PATCH','text','170LxtgxQ','mexbt','2874654hrrFHb','application/json','DELETE','Failed\x20to\x20get\x20item\x20feedback:\x20','/action-items','/feedback','uAAoY','SLWmM','https://dashboard.ranger.net/billing','kbYgA','10779fOgLOj','/checklist','Feature\x20limit\x20exceeded','set','toString','OYnGk','5890178GctKTQ','Failed\x20to\x20list\x20sessions:\x20','GET','WSGUm','Failed\x20to\x20get\x20feature\x20review\x20report:\x20','updateChecklistItem','Failed\x20to\x20start\x20session:\x20','418550tADRUt','766929rgKEiS','/start','offset','gitRepoUrl','limit','47505QuQauc','vSqGw','itemIds','rdQqG','CGmEW','POST'];_0x3d20=function(){return _0x48669d;};return _0x3d20();}export async function softDeleteFeature(_0x507fec){const _0x4943c2=_0x453c,_0x1eb7dc={'wNWBo':function(_0x532c70){return _0x532c70();}},_0x3e16a0=await getToken();if(!_0x3e16a0)throw new Error(_0x4943c2(0x126));const _0x10addb=_0x1eb7dc['wNWBo'](getApiBaseUrl),_0x27ae76=await fetch(_0x10addb+_0x4943c2(0x129)+_0x507fec,{'method':_0x4943c2(0x14d),'headers':{'Authorization':'Bearer\x20'+_0x3e16a0}});if(!_0x27ae76['ok']){const _0x32443b=await _0x27ae76['text']();throw new Error('Failed\x20to\x20delete\x20feature\x20review:\x20'+_0x32443b);}}export async function restoreFeature(_0x36f8fe){const _0x15f192=_0x453c,_0x32bb1b=await getToken();if(!_0x32bb1b)throw new Error(_0x15f192(0x126));const _0x47809c=getApiBaseUrl(),_0x5d1e45=await fetch(_0x47809c+'/api/v1/mcp/features/'+_0x36f8fe+_0x15f192(0x139),{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x32bb1b}});if(!_0x5d1e45['ok']){const _0x44984b=await _0x5d1e45[_0x15f192(0x148)]();throw new Error('Failed\x20to\x20restore\x20feature\x20review:\x20'+_0x44984b);}}
|