@ranger-testing/ranger-cli 3.0.1-alpha.bb18058-34 → 3.0.1-alpha.c0b290b-36
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/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 -0
- 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 +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
function _0x4d38(){const _0x47db2f=['GHRep','keys','extraHTTPHeaders','newContext','storageState','environmentKey','\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.','string','mvZrn','dtOwE','API\x20request\x20','2224BSYdgU','password','join','toISOString','length','loginInstructions','json','TFVbV','test_output','settings','parse','\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20','\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','vEgvg','\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20','name','zIwaz','\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','1240030zNfEaS','some','xXAcl','dZLOD','trim','statusText','xAWmR','tkmoy','defaultEnvironmentKey','63414HNFIWU','hTwYx','5418728bXTJPq','newPage','xpbCK','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','HVmTJ','6XldEcd','auth','launch','username','origin','FofMl','auth_config','cookies','570354uduilh','\x20\x20Cloud\x20session\x20for\x20\x22','\x22\x20failed\x20validation\x20—\x20re-login\x20needed...','BXbIB','pQMeF','/session','\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20','goto','detail','invalidateOn','error','fRfiz','IDLpY','storageStatePath','\x22\x20for\x20','you\x27re\x20now\x20at\x20\x22','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','POST','userAgent','domains','status','\x20\x20Cached\x20session\x20for\x20\x22','621135cGllcc','jEAbM','/api/v1/profiles/','not_configured','ngvYt','UqIVB','QhmvS','organizationId','map','nfCSa','sessionCheckPath','log','praic','EHVUH','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','close','\x20failed\x20(','WOqZE','NhMAx','2323328octgkF','env','\x22,\x20attempting\x20login...','stringify','cqSla','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','isArray','push','baseUrl','url','260613mgUmuT','about:blank','PHPZq','/login','RANGER_TEST_USERNAME','save','code','RANGER_TEST_PASSWORD','gBDTo','Bearer\x20','ApiError','\x20\x20Created\x20cloud\x20profile\x20\x22','force'];_0x4d38=function(){return _0x47db2f;};return _0x4d38();}const _0xc45c82=_0x365e;(function(_0x56898d,_0x415c1c){const _0x20ab3d=_0x365e,_0x4441ba=_0x56898d();while(!![]){try{const _0x297063=parseInt(_0x20ab3d(0x1d8))/0x1*(-parseInt(_0x20ab3d(0x213))/0x2)+-parseInt(_0x20ab3d(0x231))/0x3+parseInt(_0x20ab3d(0x1ce))/0x4+-parseInt(_0x20ab3d(0x203))/0x5+-parseInt(_0x20ab3d(0x21b))/0x6+-parseInt(_0x20ab3d(0x20e))/0x7+parseInt(_0x20ab3d(0x1f0))/0x8*(parseInt(_0x20ab3d(0x20c))/0x9);if(_0x297063===_0x415c1c)break;else _0x4441ba['push'](_0x4441ba['shift']());}catch(_0xf9dd22){_0x4441ba['push'](_0x4441ba['shift']());}}}(_0x4d38,0x69d9f));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x310049 from'inquirer';import{chromium}from'playwright';import{getApiBaseUrl}from'./environment.js';import{getToken}from'./keychain.js';import{getRangerHomeDir}from'./rangerRoot.js';import{addProfileSetupBanner}from'./profileSetupBanner.js';import{duplicateCookiesForDomains,getSessionCachePath,getStorageStatePath,isCachedSessionLive,isInteractive,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x2f9441={'eDSaP':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x1c7852=await getToken();if(!_0x1c7852)throw new Error(_0x2f9441['eDSaP']);return _0x1c7852;}async function apiRequest(_0x851cb3,_0x22f750={}){const _0x389f07=_0x365e,_0x2f91e9={'cqSla':function(_0x525baf){return _0x525baf();},'jEAbM':function(_0xc53e40){return _0xc53e40();},'TFVbV':function(_0x5df92b,_0x498902){return _0x5df92b===_0x498902;}},_0x517354=await _0x2f91e9[_0x389f07(0x1d2)](requireToken),_0x4310bc=_0x2f91e9[_0x389f07(0x232)](getApiBaseUrl),_0x5a6b9b=await fetch(''+_0x4310bc+_0x851cb3,{..._0x22f750,'headers':{'Authorization':_0x389f07(0x1e1)+_0x517354,'Content-Type':'application/json',..._0x22f750['headers']??{}}});if(!_0x5a6b9b['ok']){let _0x22abcb='',_0xa6118f;try{const _0x2099a9=await _0x5a6b9b[_0x389f07(0x1f6)]();_0x22abcb=(typeof _0x2099a9['error']==='string'?_0x2099a9['error']:undefined)??JSON['stringify'](_0x2099a9);if(_0x2f91e9['TFVbV'](typeof _0x2099a9[_0x389f07(0x1de)],'string'))_0xa6118f=_0x2099a9[_0x389f07(0x1de)];}catch{_0x22abcb=_0x5a6b9b[_0x389f07(0x208)];}throw new ApiError(_0x389f07(0x1ef)+_0x851cb3+_0x389f07(0x1cb)+_0x5a6b9b[_0x389f07(0x22f)]+'):\x20'+_0x22abcb,_0x5a6b9b[_0x389f07(0x22f)],_0x22abcb,_0xa6118f);}if(_0x2f91e9[_0x389f07(0x1f7)](_0x5a6b9b['status'],0xcc))return undefined;return _0x5a6b9b['json']();}export class ApiError extends Error{[_0xc45c82(0x22f)];['detail'];[_0xc45c82(0x1de)];constructor(_0x386e2b,_0x5259ce,_0x5be22b,_0x1ab39a){const _0x27a655=_0xc45c82;super(_0x386e2b),this['status']=_0x5259ce,this[_0x27a655(0x223)]=_0x5be22b,this[_0x27a655(0x1de)]=_0x1ab39a,this[_0x27a655(0x200)]=_0x27a655(0x1e2);}}export async function fetchCloudProfile(_0x4e2c13){const _0x3300ad=_0xc45c82,_0x2ac0be={'HVmTJ':function(_0x126ae5,_0x591f76){return _0x126ae5(_0x591f76);}};try{return await _0x2ac0be[_0x3300ad(0x212)](apiRequest,_0x3300ad(0x233)+encodeURIComponent(_0x4e2c13));}catch(_0x24e609){if(_0x24e609 instanceof ApiError&&_0x24e609[_0x3300ad(0x22f)]===0x194)return null;throw _0x24e609;}}export async function listCloudProfiles(){const _0xcc7869={'WSMmk':function(_0x10d10d,_0x3d9493){return _0x10d10d(_0x3d9493);}},_0x178545=await _0xcc7869['WSMmk'](apiRequest,'/api/v1/profiles');return _0x178545['profiles'];}export async function deleteCloudProfile(_0x4fff04){const _0x233130=_0xc45c82,_0x355ce0={'UckjZ':function(_0x38e267,_0x24a161){return _0x38e267 instanceof _0x24a161;},'mYbYK':function(_0x37a191,_0x11a444){return _0x37a191===_0x11a444;}};try{await apiRequest(_0x233130(0x233)+encodeURIComponent(_0x4fff04),{'method':'DELETE'});}catch(_0x3bc350){if(_0x355ce0['UckjZ'](_0x3bc350,ApiError)&&_0x355ce0['mYbYK'](_0x3bc350['status'],0x194))throw new Error('Cloud\x20profile\x20\x22'+_0x4fff04+'\x22\x20not\x20found.');throw _0x3bc350;}}export async function createCloudProfile(_0x58248e,_0x4c93d2,_0x48640d={}){const _0x301ddd=_0xc45c82,_0x40d2bb={'xshsR':function(_0x49c6bd,_0x22133f){return _0x49c6bd>_0x22133f;},'UsoLH':function(_0x17d78e,_0x4537e1,_0x1c8a6a){return _0x17d78e(_0x4537e1,_0x1c8a6a);}},_0xb1170a={'name':_0x58248e};if(_0x4c93d2)_0xb1170a['environment_key']=_0x4c93d2;_0x48640d['settings']&&_0x40d2bb['xshsR'](Object[_0x301ddd(0x1e6)](_0x48640d['settings'])[_0x301ddd(0x1f4)],0x0)&&(_0xb1170a['settings']=_0x48640d[_0x301ddd(0x1f9)]);if(_0x48640d[_0x301ddd(0x216)])_0xb1170a[_0x301ddd(0x216)]=_0x48640d[_0x301ddd(0x216)];if(_0x48640d['password'])_0xb1170a[_0x301ddd(0x1f1)]=_0x48640d[_0x301ddd(0x1f1)];return await _0x40d2bb['UsoLH'](apiRequest,'/api/v1/profiles',{'method':'POST','body':JSON[_0x301ddd(0x1d1)](_0xb1170a)});}function _0x365e(_0x2b2ff1,_0xb71f30){_0x2b2ff1=_0x2b2ff1-0x1cb;const _0x4d38d0=_0x4d38();let _0x365e81=_0x4d38d0[_0x2b2ff1];return _0x365e81;}export async function uploadCloudProfileSession(_0x27fce0,_0x1efe2e){const _0x56bbcd=_0xc45c82,_0x192c58={'oBHkl':function(_0x4786e8,_0xfa1a83){return _0x4786e8(_0xfa1a83);}};return await apiRequest('/api/v1/profiles/'+_0x192c58['oBHkl'](encodeURIComponent,_0x27fce0)+_0x56bbcd(0x220),{'method':_0x56bbcd(0x22c),'body':JSON[_0x56bbcd(0x1d1)]({'session_state':_0x1efe2e})});}export async function saveCloudProfileCredentials(_0x3a5f2e,_0x4f777e,_0x54c55b){const _0x5866c9=_0xc45c82,_0x230e89={'XNRXP':function(_0x596ae7,_0x2bc163){return _0x596ae7(_0x2bc163);},'FmMSw':'PUT'};await apiRequest(_0x5866c9(0x233)+_0x230e89['XNRXP'](encodeURIComponent,_0x3a5f2e),{'method':_0x230e89['FmMSw'],'body':JSON['stringify']({'username':_0x4f777e,'password':_0x54c55b})});}export async function fetchAuthConfig(){const _0x4a6a5a=_0xc45c82,_0x58654f={'hTwYx':function(_0x5d1c5e,_0x282703){return _0x5d1c5e(_0x282703);},'GcVau':function(_0x596aef,_0x402459){return _0x596aef!==_0x402459;}};try{const _0x3f9599=await _0x58654f[_0x4a6a5a(0x20d)](apiRequest,'/api/v1/profiles/auth-config');return _0x3f9599[_0x4a6a5a(0x219)];}catch(_0x156a80){return _0x156a80 instanceof ApiError&&_0x58654f['GcVau'](_0x156a80[_0x4a6a5a(0x22f)],0x194)&&console['error'](_0x4a6a5a(0x1fb)+_0x156a80['message']),null;}}export function pickAdHocEnvKey(_0x543f1a){const _0x41d4a6=_0xc45c82,_0x5d81f3={'zIwaz':function(_0x5156a1,_0x1044de){return _0x5156a1===_0x1044de;}};if(!_0x543f1a)return null;if(_0x543f1a['defaultEnvironmentKey'])return _0x543f1a[_0x41d4a6(0x20b)];const _0x1fc3b8=Object['keys'](_0x543f1a['environments']??{});if(_0x5d81f3[_0x41d4a6(0x201)](_0x1fc3b8[_0x41d4a6(0x1f4)],0x1))return _0x1fc3b8[0x0];if(_0x1fc3b8['length']===0x0)return null;throw new Error('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x1fc3b8['join'](',\x20')+').\x20'+'Create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`\x20so\x20Ranger\x20can\x20pick\x20the\x20right\x20one.');}export async function resolveAdHocProfile(_0xfbd497=process[_0xc45c82(0x1cf)]){const _0x4e181d=_0xc45c82,_0x3d622f={'icyfO':function(_0xda19e5,_0x3c1f03){return _0xda19e5(_0x3c1f03);},'agfJZ':function(_0x16d39a,_0x5531c4,_0x19eec3,_0x38d536){return _0x16d39a(_0x5531c4,_0x19eec3,_0x38d536);}},_0x5d59f6=_0xfbd497['RANGER_TEST_USERNAME'];if(!_0x5d59f6)return null;const _0x1b81ef=await _0x3d622f['icyfO'](fetchCloudProfile,_0x5d59f6);if(_0x1b81ef)return{'name':_0x1b81ef['name'],'profile':_0x1b81ef};const _0x5a6f1c=await fetchAuthConfig(),_0x546f51=_0x3d622f['icyfO'](pickAdHocEnvKey,_0x5a6f1c),_0xa960b7=_0xfbd497[_0x4e181d(0x1df)],_0x39c91f=await _0x3d622f['agfJZ'](createCloudProfile,_0x5d59f6,_0x546f51??undefined,{'username':_0x5d59f6,'password':_0xa960b7});return console[_0x4e181d(0x23c)](_0x4e181d(0x1e3)+_0x39c91f['name']+_0x4e181d(0x229)+_0x5d59f6),{'name':_0x39c91f[_0x4e181d(0x200)],'profile':_0x39c91f};}export async function writeSessionToLocalCache(_0x471c46,_0x290066,_0x406aa9,_0x249c3c,_0x2c0fa5,_0x4f1375,_0x420448){const _0x477178=_0xc45c82,_0x69d210={'QhmvS':function(_0x52567d,_0x39f009,_0x38df97){return _0x52567d(_0x39f009,_0x38df97);},'dZLOD':function(_0x316234,_0x2068e5,_0x577473){return _0x316234(_0x2068e5,_0x577473);},'cqsoK':function(_0x3579ff){return _0x3579ff();},'Kteez':_0x477178(0x214),'KMhmH':function(_0x4f1f09,_0x3c3de8){return _0x4f1f09>_0x3c3de8;},'BKXkl':function(_0x11dd00,_0x185823){return _0x11dd00(_0x185823);}},_0x1f09d2=sessionCacheHash({'orgId':_0x290066,'profileName':_0x471c46,'effectiveBaseUrl':_0x406aa9,'setupHeaders':_0x249c3c,'invalidateOn':_0x420448?.[_0x477178(0x224)],'userAgent':_0x420448?.[_0x477178(0x22d)],'clientIp':_0x420448?.['clientIp']}),_0x318c13=_0x69d210[_0x477178(0x237)](getSessionCachePath,_0x1f09d2,_0x471c46),_0x2bf032=_0x69d210[_0x477178(0x206)](join,_0x69d210['cqsoK'](getRangerHomeDir),_0x69d210['Kteez']);!existsSync(_0x2bf032)&&await mkdir(_0x2bf032,{'recursive':!![]});const _0x23fe17={..._0x2c0fa5};_0x4f1375&&_0x69d210['KMhmH'](_0x4f1375[_0x477178(0x1f4)],0x0)&&Array[_0x477178(0x1d4)](_0x23fe17[_0x477178(0x21a)])&&(_0x23fe17['cookies']=_0x69d210['QhmvS'](duplicateCookiesForDomains,_0x23fe17['cookies'],_0x4f1375));const _0x36a5b0={'cached_at':new Date()[_0x477178(0x1f3)](),'session_state':_0x23fe17};await _0x69d210[_0x477178(0x206)](writeFile,_0x318c13,JSON['stringify'](_0x36a5b0,null,0x2));const _0x15b7c9=_0x69d210['BKXkl'](getStorageStatePath,_0x318c13);return await writeFile(_0x15b7c9,JSON['stringify'](_0x23fe17,null,0x2)),_0x15b7c9;}export async function checkLocalCache(_0x53c6d1,_0x3818e2,_0x1a55a1,_0x4801e0,_0x31d205){const _0x122604=_0xc45c82,_0x183a39={'NhMAx':function(_0x41d204,_0x3e889c,_0x1153e2){return _0x41d204(_0x3e889c,_0x1153e2);},'fRfiz':function(_0x338429,_0x17f034){return _0x338429(_0x17f034);}},_0xf12b3e=sessionCacheHash({'orgId':_0x3818e2,'profileName':_0x53c6d1,'effectiveBaseUrl':_0x1a55a1,'setupHeaders':_0x4801e0,'invalidateOn':_0x31d205?.[_0x122604(0x224)],'userAgent':_0x31d205?.[_0x122604(0x22d)],'clientIp':_0x31d205?.['clientIp']}),_0x54f56d=_0x183a39['NhMAx'](getSessionCachePath,_0xf12b3e,_0x53c6d1),_0x468a98=_0x183a39[_0x122604(0x226)](getStorageStatePath,_0x54f56d);if(!existsSync(_0x54f56d)||!existsSync(_0x468a98))return null;try{const _0x53b60c=await _0x183a39[_0x122604(0x1cd)](readFile,_0x54f56d,'utf-8');return JSON[_0x122604(0x1fa)](_0x53b60c),{'storageStatePath':_0x468a98};}catch{return null;}}function launchRealBrowser(){return chromium['launch']({'headless':!![]});}function emitSessionValidationHint(_0x260b74,_0x4e774a){const _0xf3bc4d=_0xc45c82,_0x489215={'EHVUH':function(_0x6ea0bb,_0x101834){return _0x6ea0bb+_0x101834;}};if(!_0x4e774a||!_0x4e774a['domains']?.['length'])return;let _0xfecb16;try{_0xfecb16=new URL(_0x260b74);}catch{return;}const _0x2032dc=[];for(const _0x34f0fa of _0x4e774a['domains']){try{_0x2032dc[_0xf3bc4d(0x1d5)]({'raw':_0x34f0fa,'url':new URL(_0x34f0fa)});}catch{}}if(_0x2032dc['length']===0x0)return;if(_0x2032dc[_0xf3bc4d(0x204)](_0x2b867b=>_0x2b867b[_0xf3bc4d(0x1d7)][_0xf3bc4d(0x217)]===_0xfecb16['origin']))return;const _0x5dccee=_0x2032dc[_0xf3bc4d(0x239)](_0x15b61e=>'\x22'+_0x15b61e['raw']+'\x22')[_0xf3bc4d(0x1f2)](',\x20');console[_0xf3bc4d(0x23c)](_0x489215[_0xf3bc4d(0x23e)](_0x489215['EHVUH'](_0xf3bc4d(0x221)+_0x5dccee+';\x20',_0xf3bc4d(0x22a)+_0x260b74+_0xf3bc4d(0x1ff)),_0xf3bc4d(0x22b)));}export async function serverSideLogin(_0x128d02,_0x2784af){const _0x1559b2=_0xc45c82,_0x120039={'WOqZE':function(_0x3a65a7,_0x5a9b05,_0x44dd61){return _0x3a65a7(_0x5a9b05,_0x44dd61);},'xAWmR':function(_0x276a69,_0x53e238){return _0x276a69===_0x53e238;},'dtOwE':_0x1559b2(0x234)},_0x3c27bf=process[_0x1559b2(0x1cf)]['RANGER_TEST_USERNAME'],_0x2cdbfe=process[_0x1559b2(0x1cf)][_0x1559b2(0x1df)],_0x592210={};if(_0x3c27bf)_0x592210['username']=_0x3c27bf;if(_0x2cdbfe)_0x592210[_0x1559b2(0x1f1)]=_0x2cdbfe;if(_0x2784af?.[_0x1559b2(0x1e4)])_0x592210[_0x1559b2(0x1e4)]=!![];try{return await _0x120039[_0x1559b2(0x1cc)](apiRequest,_0x1559b2(0x233)+encodeURIComponent(_0x128d02)+_0x1559b2(0x1db),{'method':_0x1559b2(0x22c),'body':JSON[_0x1559b2(0x1d1)](_0x592210)});}catch(_0x9dc608){if(_0x9dc608 instanceof ApiError&&_0x120039[_0x1559b2(0x209)](_0x9dc608[_0x1559b2(0x22f)],0x190)&&_0x9dc608['code']===_0x120039[_0x1559b2(0x1ee)])return{'status':'not_configured','error':_0x9dc608['detail']};throw _0x9dc608;}}export async function manualBrowserLogin(_0x119d88,_0x7b182c){const _0x521a74=_0xc45c82,_0x3590b5={'fnGFs':function(_0x39c7d1,_0xf5c841){return _0x39c7d1/_0xf5c841;},'BXbIB':function(_0x137a37){return _0x137a37();},'FJXPj':function(_0x3d3b58,_0x2a0736,_0x26265f){return _0x3d3b58(_0x2a0736,_0x26265f);},'xXAcl':_0x521a74(0x1d9),'hZkqR':_0x521a74(0x1fc),'jNqKK':'\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','FofMl':'Browser\x20login\x20timed\x20out\x20before\x20completion.','nfCSa':function(_0x3900fb,_0x2a61ff,_0xb512be){return _0x3900fb(_0x2a61ff,_0xb512be);},'enrwd':function(_0x1d9f90,_0x5b74f7){return _0x1d9f90(_0x5b74f7);}};if(!_0x3590b5[_0x521a74(0x21e)](isInteractive))throw new Error('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x119d88['name']+'\x22.\x0a'+'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20'+'or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.');const _0x15f90a=_0x7b182c&&_0x7b182c['domains'][_0x521a74(0x1f4)]>0x0?_0x7b182c['domains'][0x0]:_0x3590b5[_0x521a74(0x205)];console[_0x521a74(0x23c)](_0x3590b5['hZkqR']),console['log'](_0x3590b5['jNqKK']),await new Promise(_0x1163e1=>setTimeout(_0x1163e1,0x7d0));const _0x21fbec=await chromium[_0x521a74(0x215)]({'headless':![]});let _0x551826=null;try{const _0x3c98ab={'ignoreHTTPSErrors':!![]};_0x7b182c?.['setupHeaders']&&(_0x3c98ab[_0x521a74(0x1e7)]=_0x7b182c['setupHeaders']);const _0x2a2298=await _0x21fbec[_0x521a74(0x1e8)](_0x3c98ab);await addProfileSetupBanner(_0x2a2298);const _0x140334=await _0x2a2298[_0x521a74(0x20f)]();await _0x140334[_0x521a74(0x222)](_0x15f90a);let _0x5b26ec=![];await new Promise(_0x13ea7e=>{const _0x5308e6=_0x521a74,_0x2ac322={'gBDTo':function(_0x155c4e){return _0x155c4e();}},_0x1a03a2=_0x3590b5['FJXPj'](setTimeout,()=>{const _0x109002=_0x365e;_0x5b26ec=!![],console[_0x109002(0x225)]('Browser\x20login\x20timed\x20out\x20after\x20'+_0x3590b5['fnGFs'](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+_0x109002(0x1eb)),_0x3590b5['BXbIB'](_0x13ea7e);},MANUAL_LOGIN_TIMEOUT_MS);_0x140334['on'](_0x5308e6(0x240),async()=>{const _0x1f0631=_0x5308e6;clearTimeout(_0x1a03a2);try{const _0x550091=await _0x2a2298[_0x1f0631(0x1e9)]();_0x551826=_0x550091;}catch{}_0x2ac322[_0x1f0631(0x1e0)](_0x13ea7e);});});if(_0x5b26ec&&!_0x551826)throw new Error(_0x3590b5[_0x521a74(0x218)]);}finally{await _0x21fbec[_0x521a74(0x240)]()['catch'](()=>{});}if(!_0x551826)throw new Error(_0x521a74(0x1d3));return await _0x3590b5[_0x521a74(0x23a)](apiRequest,_0x521a74(0x233)+_0x3590b5['enrwd'](encodeURIComponent,_0x119d88[_0x521a74(0x200)])+'/session',{'method':'POST','body':JSON['stringify']({'session_state':_0x551826,'updated_by':'cli:manual-login'})}),{'sessionState':_0x551826};}export async function promptSaveCredentials(_0x1fa8e1){const _0x3df326=_0xc45c82,_0x2c245f={'tkmoy':function(_0x2af4a6,_0xb4aa82){return _0x2af4a6||_0xb4aa82;},'QZSxZ':function(_0x36a65b){return _0x36a65b();},'pQMeF':'confirm','sxZIT':_0x3df326(0x1dd),'mvZrn':_0x3df326(0x1fd),'iyeWV':function(_0x582f2f,_0xa64789){return _0x582f2f(_0xa64789);},'IDLpY':_0x3df326(0x211)},_0x23c2e9=process[_0x3df326(0x1cf)][_0x3df326(0x1dc)],_0x2d0302=process[_0x3df326(0x1cf)]['RANGER_TEST_PASSWORD'];if(_0x2c245f[_0x3df326(0x20a)](!_0x23c2e9,!_0x2d0302))return;if(!_0x2c245f['QZSxZ'](isInteractive))return;const {save:_0x4c7526}=await _0x310049['prompt']([{'type':_0x2c245f[_0x3df326(0x21f)],'name':_0x2c245f['sxZIT'],'message':_0x2c245f[_0x3df326(0x1ed)],'default':![]}]);if(!_0x4c7526)return;await apiRequest('/api/v1/profiles/'+_0x2c245f['iyeWV'](encodeURIComponent,_0x1fa8e1),{'method':'PUT','body':JSON['stringify']({'username':_0x23c2e9,'password':_0x2d0302})}),console['log'](_0x2c245f[_0x3df326(0x227)]);}export async function resolveCloudProfileSession(_0x3f2033,_0x48f007={}){const _0x25c627=_0xc45c82,_0x3da30b={'GHRep':function(_0x55ed52){return _0x55ed52();},'PHPZq':_0x25c627(0x1ec),'UqIVB':function(_0x438baa,_0x4f51d3){return _0x438baa(_0x4f51d3);},'dVBVT':function(_0x15e9d5,_0x3525c2,_0x538ccd,_0x51d7d9,_0x2d486a,_0x4b4281){return _0x15e9d5(_0x3525c2,_0x538ccd,_0x51d7d9,_0x2d486a,_0x4b4281);},'ngvYt':function(_0x3e379,_0x50ae97,_0x247c3e,_0x4c0156,_0x363576){return _0x3e379(_0x50ae97,_0x247c3e,_0x4c0156,_0x363576);},'tlzlU':function(_0x5c99b1,_0x23a069,_0x44a9de,_0x4e489d,_0xceac00){return _0x5c99b1(_0x23a069,_0x44a9de,_0x4e489d,_0xceac00);},'PePSg':function(_0xcd4b81,_0x8f674d){return _0xcd4b81(_0x8f674d);},'rbVTZ':function(_0x312d19,_0x31c0e8){return _0x312d19||_0x31c0e8;},'LUCSi':_0x25c627(0x202),'vEgvg':function(_0x2e9cdc,_0x26aa04){return _0x2e9cdc===_0x26aa04;},'fdMRa':'success','FygLO':'\x20\x20Login\x20successful.\x20Session\x20cached.','cAkey':_0x25c627(0x23f),'xpbCK':'\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','xciaz':function(_0x4e4007,_0x75a0a4){return _0x4e4007 instanceof _0x75a0a4;},'praic':function(_0x46475e,_0x4556df){return _0x46475e(_0x4556df);},'JoyXg':function(_0x3cbb98,_0x1fbca8,_0xed60e4,_0x598ebf,_0x35246c,_0x14b6be,_0x522c40,_0x158f2d){return _0x3cbb98(_0x1fbca8,_0xed60e4,_0x598ebf,_0x35246c,_0x14b6be,_0x522c40,_0x158f2d);}},_0x1bff43=_0x3f2033['settings']??{},_0x1717fa=await _0x3da30b[_0x25c627(0x1e5)](fetchAuthConfig),_0x53a380=_0x1717fa?resolveAuthEnvironmentLocally(_0x1717fa,_0x3f2033[_0x25c627(0x1ea)]):null,_0x43c63a=typeof _0x53a380?.[_0x25c627(0x1f5)]===_0x3da30b[_0x25c627(0x1da)]&&_0x53a380[_0x25c627(0x1f5)]['trim']()?_0x53a380[_0x25c627(0x1f5)]:undefined,_0x2d763e=typeof _0x1bff43[_0x25c627(0x1f5)]===_0x3da30b[_0x25c627(0x1da)]&&_0x1bff43['loginInstructions'][_0x25c627(0x207)]()?_0x1bff43[_0x25c627(0x1f5)]:undefined,_0x4e8e31=_0x2d763e||!_0x43c63a?_0x1bff43:{..._0x1bff43,'loginInstructions':_0x43c63a},_0x3d878c=_0x3da30b['UqIVB'](Boolean,_0x4e8e31['loginInstructions']?.['trim']()),_0xecf803=_0x53a380?.[_0x25c627(0x22e)],_0x10e55d=_0x1bff43['setupHeaders'],_0x422a18=_0x10e55d??_0x53a380?.['setupHeaders'],_0x3308fa=_0x48f007['effectiveBaseUrl']??_0x1bff43[_0x25c627(0x1d6)]??(_0xecf803&&_0xecf803[_0x25c627(0x1f4)]>0x0?_0xecf803[0x0]:''),_0x38cc16={'invalidateOn':_0x53a380?.[_0x25c627(0x224)],'userAgent':_0x53a380?.['browserOptions']?.['userAgent']??_0x1bff43['userAgent']},_0x5c0e20=await _0x3da30b['dVBVT'](checkLocalCache,_0x3f2033[_0x25c627(0x200)],_0x3f2033[_0x25c627(0x238)],_0x3308fa,_0x422a18,_0x38cc16);if(_0x5c0e20){if(_0x3308fa){const _0x4901f7=await _0x3da30b[_0x25c627(0x235)](isCachedSessionLive,_0x5c0e20[_0x25c627(0x228)],_0x3308fa,{'sessionCheckPath':_0x53a380?.[_0x25c627(0x23b)],'setupHeaders':_0x422a18},{'launchBrowser':launchRealBrowser});if(_0x4901f7)return console[_0x25c627(0x23c)]('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x3f2033[_0x25c627(0x200)]+'\x22'),{'authPath':_0x5c0e20[_0x25c627(0x228)],'settings':_0x4e8e31,'resolvedEnv':_0x53a380};console[_0x25c627(0x23c)](_0x25c627(0x230)+_0x3f2033['name']+'\x22\x20failed\x20validation\x20—\x20refreshing...'),emitSessionValidationHint(_0x3308fa,_0x53a380);}else return{'authPath':_0x5c0e20['storageStatePath'],'settings':_0x4e8e31,'resolvedEnv':_0x53a380};}if(_0x3f2033['sessionState']){const _0x47f449=await writeSessionToLocalCache(_0x3f2033['name'],_0x3f2033[_0x25c627(0x238)],_0x3308fa,_0x422a18,_0x3f2033['sessionState'],_0xecf803,_0x38cc16);if(_0x3308fa){const _0x596e84=await _0x3da30b['tlzlU'](isCachedSessionLive,_0x47f449,_0x3308fa,{'sessionCheckPath':_0x53a380?.['sessionCheckPath'],'setupHeaders':_0x422a18},{'launchBrowser':launchRealBrowser});if(_0x596e84)return console[_0x25c627(0x23c)]('\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22'+_0x3f2033['name']+'\x22,\x20cached\x20locally'),{'authPath':_0x47f449,'settings':_0x4e8e31,'resolvedEnv':_0x53a380};console[_0x25c627(0x23c)](_0x25c627(0x21c)+_0x3f2033[_0x25c627(0x200)]+_0x25c627(0x21d)),emitSessionValidationHint(_0x3308fa,_0x53a380);}else return{'authPath':_0x47f449,'settings':_0x4e8e31,'resolvedEnv':_0x53a380};}if(_0x3d878c)return console[_0x25c627(0x23c)]('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x3f2033['name']+'\x22;\x20proceeding\x20with\x20loginInstructions.'),{'authPath':undefined,'settings':_0x4e8e31,'resolvedEnv':_0x53a380};console['log']('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x3f2033[_0x25c627(0x200)]+_0x25c627(0x1d0));const _0x250d8b=Boolean(process[_0x25c627(0x1cf)][_0x25c627(0x1dc)])&&Boolean(process['env']['RANGER_TEST_PASSWORD']),_0xfd7243=_0x3da30b['PePSg'](Boolean,_0x3f2033[_0x25c627(0x216)]);if(_0x3da30b['rbVTZ'](_0x250d8b,_0xfd7243))try{const _0xe194cb=await _0x3da30b[_0x25c627(0x236)](serverSideLogin,_0x3f2033[_0x25c627(0x200)]);if(_0xe194cb[_0x25c627(0x22f)]===_0x25c627(0x234))console[_0x25c627(0x23c)](_0x3da30b['LUCSi']);else{if(_0x3da30b[_0x25c627(0x1fe)](_0xe194cb['status'],_0x3da30b['fdMRa'])&&_0xe194cb['session_state']){console[_0x25c627(0x23c)](_0x3da30b['FygLO']);const _0x1cf35d=await writeSessionToLocalCache(_0x3f2033['name'],_0x3f2033[_0x25c627(0x238)],_0x3308fa,_0x422a18,_0xe194cb['session_state'],_0xecf803,_0x38cc16);return _0x250d8b&&!_0xfd7243&&await promptSaveCredentials(_0x3f2033['name']),{'authPath':_0x1cf35d,'settings':_0x4e8e31,'resolvedEnv':_0x53a380};}else _0xe194cb[_0x25c627(0x1f8)]&&(console[_0x25c627(0x23c)](_0x3da30b['cAkey']),console['log'](_0xe194cb[_0x25c627(0x1f8)])),console['log'](_0x3da30b[_0x25c627(0x210)]);}}catch(_0x566921){console['log']('\x20\x20Server-side\x20login\x20error:\x20'+(_0x3da30b['xciaz'](_0x566921,Error)?_0x566921['message']:_0x3da30b[_0x25c627(0x23d)](String,_0x566921))),console[_0x25c627(0x23c)]('\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...');}const {sessionState:_0x43b63d}=await manualBrowserLogin(_0x3f2033,_0x53a380),_0x24cb3f=await _0x3da30b['JoyXg'](writeSessionToLocalCache,_0x3f2033['name'],_0x3f2033['organizationId'],_0x3308fa,_0x422a18,_0x43b63d,_0xecf803,_0x38cc16);return{'authPath':_0x24cb3f,'settings':_0x4e8e31,'resolvedEnv':_0x53a380};}
|
|
1
|
+
const _0x210f40=_0xd99f;(function(_0x93cad9,_0x3fd774){const _0x2d55d4=_0xd99f,_0x251423=_0x93cad9();while(!![]){try{const _0xc7db00=parseInt(_0x2d55d4(0xe0))/0x1+-parseInt(_0x2d55d4(0xef))/0x2+parseInt(_0x2d55d4(0x103))/0x3+-parseInt(_0x2d55d4(0xe5))/0x4*(parseInt(_0x2d55d4(0xf9))/0x5)+-parseInt(_0x2d55d4(0x15e))/0x6+-parseInt(_0x2d55d4(0x157))/0x7*(-parseInt(_0x2d55d4(0xf0))/0x8)+parseInt(_0x2d55d4(0xea))/0x9;if(_0xc7db00===_0x3fd774)break;else _0x251423['push'](_0x251423['shift']());}catch(_0x2e732a){_0x251423['push'](_0x251423['shift']());}}}(_0x539c,0x6acf9));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x572fab from'inquirer';import{chromium}from'playwright';import{getApiBaseUrl}from'./environment.js';import{getToken}from'./keychain.js';import{getRangerHomeDir}from'./rangerRoot.js';import{addProfileSetupBanner}from'./profileSetupBanner.js';import{duplicateCookiesForDomains,getSessionCachePath,getStorageStatePath,isCachedSessionLive,isInteractive,needsTunnel,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x542a2d=_0xd99f,_0x37c6d2={'YJTmR':_0x542a2d(0x109)},_0x527854=await getToken();if(!_0x527854)throw new Error(_0x37c6d2['YJTmR']);return _0x527854;}async function apiRequest(_0x2dcb2a,_0x5cdf7a={}){const _0x5deb07=_0xd99f,_0x4324ab={'tZYOv':function(_0x43fd19){return _0x43fd19();},'acbso':function(_0x28ffb5,_0x20837b){return _0x28ffb5===_0x20837b;},'YmfCJ':'string','SDULT':function(_0x3b4252,_0x17a22c){return _0x3b4252===_0x17a22c;}},_0x4fd596=await _0x4324ab[_0x5deb07(0x141)](requireToken),_0x26add1=getApiBaseUrl(),_0x28d1ac=await fetch(''+_0x26add1+_0x2dcb2a,{..._0x5cdf7a,'headers':{'Authorization':'Bearer\x20'+_0x4fd596,'Content-Type':'application/json',..._0x5cdf7a['headers']??{}}});if(!_0x28d1ac['ok']){let _0x574046='',_0x1314c3;try{const _0x4563a3=await _0x28d1ac[_0x5deb07(0x162)]();_0x574046=(_0x4324ab[_0x5deb07(0x10b)](typeof _0x4563a3['error'],_0x4324ab['YmfCJ'])?_0x4563a3[_0x5deb07(0xd9)]:undefined)??JSON[_0x5deb07(0x149)](_0x4563a3);if(_0x4324ab[_0x5deb07(0xf5)](typeof _0x4563a3[_0x5deb07(0x11d)],_0x4324ab[_0x5deb07(0x102)]))_0x1314c3=_0x4563a3['code'];}catch{_0x574046=_0x28d1ac['statusText'];}throw new ApiError('API\x20request\x20'+_0x2dcb2a+'\x20failed\x20('+_0x28d1ac['status']+'):\x20'+_0x574046,_0x28d1ac['status'],_0x574046,_0x1314c3);}if(_0x28d1ac[_0x5deb07(0x117)]===0xcc)return undefined;return _0x28d1ac['json']();}export class ApiError extends Error{['status'];[_0x210f40(0x11c)];[_0x210f40(0x11d)];constructor(_0x3d3fb1,_0x5186c1,_0x383947,_0x28c3e4){const _0x56f5e5=_0x210f40,_0x19391a={'zWVop':_0x56f5e5(0x144)};super(_0x3d3fb1),this['status']=_0x5186c1,this['detail']=_0x383947,this[_0x56f5e5(0x11d)]=_0x28c3e4,this['name']=_0x19391a['zWVop'];}}export async function fetchCloudProfile(_0x2f5a19){const _0x57ec6e={'uohTS':function(_0x23fd3b,_0x529078){return _0x23fd3b(_0x529078);},'VDKfM':function(_0x5be85c,_0x17d4e9){return _0x5be85c instanceof _0x17d4e9;}};try{return await _0x57ec6e['uohTS'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x2f5a19));}catch(_0x480e13){if(_0x57ec6e['VDKfM'](_0x480e13,ApiError)&&_0x480e13['status']===0x194)return null;throw _0x480e13;}}export async function listCloudProfiles(){const _0x2bcc24=_0x210f40,_0x2c8d99={'SEjMU':_0x2bcc24(0x15f)},_0x33513d=await apiRequest(_0x2c8d99['SEjMU']);return _0x33513d[_0x2bcc24(0x14b)];}function _0x539c(){const _0x442a68=['storageState','mQJfB','RANGER_TEST_PASSWORD','hHJyU','Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20(','goto','wWQXK','password','env','sessionId','lXHdD','\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','mvLxs','message','nxLFX','name','username','qWAsQ','gLdWw','OHgsZ','effectiveBaseUrl','toISOString','sessionState','cRbEc','isArray','cwpJJ','\x20\x20Server-side\x20login\x20error:\x20','tZYOv','\x22\x20failed\x20validation\x20—\x20refreshing...','FhFlJ','ApiError','NPyVJ','test_output','close','RANGER_TEST_USERNAME','stringify','GqZQT','profiles','/api/v1/profiles/','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','Browser\x20login\x20timed\x20out\x20after\x20','/api/v1/tunnel/sessions/','domains','or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','cli:manual-login','newContext','usLLd','join','storageStatePath','290570ObpBaT','JAvGh','sessionCheckPath','RhHoU','log','auth_config','VKzMB','956274oDoWja','/api/v1/profiles','setupHeaders','\x20\x20Cached\x20session\x20for\x20\x22','json','length','Ttbva','error','/api/v1/profiles/auth-config','loginInstructions','not_configured','settings','\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','zdQUv','345580LbUtlr','environments','force','mORSB','syuQC','248pRKxcP','cookies','tunnel','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','utf-8','949590TXmelx','Cloud\x20profile\x20\x22','IvrBD','catch','\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22','45008TYNCeH','32igBFBj','\x22\x20for\x20','baseUrl','confirm','nPIxZ','SDULT','\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','\x20\x20Created\x20cloud\x20profile\x20\x22','38755hmlsav','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','POST','some','QLtls','pwEndpoint','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','yNGRU','YmfCJ','1448436laCJZj','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','keys','extraHTTPHeaders','PPSZO','session_state','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','you\x27re\x20now\x20at\x20\x22','acbso','\x22;\x20proceeding\x20with\x20loginInstructions.','\x20\x20Cloud\x20session\x20for\x20\x22','dUGgN','organizationId','wsEndpoint','origin','pBmkC','biNrQ','invalidateOn','eNJNj','\x20\x20No\x20live\x20session\x20for\x20\x22','status','\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22','tUuxf','\x22\x20without\x20local-target\x20validation','targetUrl','detail','code','environmentKey','newPage','/api/v1/tunnel/sessions','\x20\x20Login\x20successful.\x20Session\x20cached.','string','DELETE','/session','\x22\x20not\x20found.'];_0x539c=function(){return _0x442a68;};return _0x539c();}export async function deleteCloudProfile(_0x4f6a94){const _0x4891aa=_0x210f40,_0x539ebe={'NIgAP':function(_0x4c305c,_0x199918,_0x20e96f){return _0x4c305c(_0x199918,_0x20e96f);},'iOQGj':function(_0x126d08,_0x34320b){return _0x126d08 instanceof _0x34320b;}};try{await _0x539ebe['NIgAP'](apiRequest,_0x4891aa(0x14c)+encodeURIComponent(_0x4f6a94),{'method':_0x4891aa(0x123)});}catch(_0x23d67f){if(_0x539ebe['iOQGj'](_0x23d67f,ApiError)&&_0x23d67f['status']===0x194)throw new Error(_0x4891aa(0xeb)+_0x4f6a94+_0x4891aa(0x125));throw _0x23d67f;}}export async function createCloudProfile(_0x5e51b1,_0x32d961,_0x5810d7={}){const _0x336bb2=_0x210f40,_0x1055cf={'lXHdD':_0x336bb2(0xfc)},_0xa1421a={'name':_0x5e51b1};if(_0x32d961)_0xa1421a['environment_key']=_0x32d961;_0x5810d7[_0x336bb2(0xdd)]&&Object[_0x336bb2(0x105)](_0x5810d7[_0x336bb2(0xdd)])['length']>0x0&&(_0xa1421a['settings']=_0x5810d7['settings']);if(_0x5810d7[_0x336bb2(0x136)])_0xa1421a['username']=_0x5810d7['username'];if(_0x5810d7['password'])_0xa1421a['password']=_0x5810d7[_0x336bb2(0x12d)];return await apiRequest('/api/v1/profiles',{'method':_0x1055cf[_0x336bb2(0x130)],'body':JSON['stringify'](_0xa1421a)});}export async function uploadCloudProfileSession(_0x586b82,_0x27b35c){const _0xc339e9=_0x210f40,_0x5ea13f={'WBoVO':function(_0x5b355a,_0x129986){return _0x5b355a(_0x129986);},'wWQXK':_0xc339e9(0xfc)};return await apiRequest(_0xc339e9(0x14c)+_0x5ea13f['WBoVO'](encodeURIComponent,_0x586b82)+'/session',{'method':_0x5ea13f[_0xc339e9(0x12c)],'body':JSON[_0xc339e9(0x149)]({'session_state':_0x27b35c})});}export async function saveCloudProfileCredentials(_0x13b0b7,_0x173f23,_0x408e80){const _0x43ae3f=_0x210f40,_0xd4bc4f={'QLtls':function(_0x338188,_0x9b1155){return _0x338188(_0x9b1155);},'gLdWw':'PUT'};await apiRequest('/api/v1/profiles/'+_0xd4bc4f[_0x43ae3f(0xfe)](encodeURIComponent,_0x13b0b7),{'method':_0xd4bc4f[_0x43ae3f(0x138)],'body':JSON[_0x43ae3f(0x149)]({'username':_0x173f23,'password':_0x408e80})});}export async function fetchAuthConfig(){const _0x2d48d0=_0x210f40,_0x1bdfed={'lQZiY':_0x2d48d0(0xda),'FhFlJ':function(_0x20621b,_0x3ec406){return _0x20621b instanceof _0x3ec406;}};try{const _0x4fdfed=await apiRequest(_0x1bdfed['lQZiY']);return _0x4fdfed[_0x2d48d0(0x15c)];}catch(_0x2c51a3){return _0x1bdfed[_0x2d48d0(0x143)](_0x2c51a3,ApiError)&&_0x2c51a3[_0x2d48d0(0x117)]!==0x194&&console[_0x2d48d0(0xd9)]('\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20'+_0x2c51a3['message']),null;}}async function createTunnelSession(_0x3a6022){const _0x603975=_0x210f40,_0x46d3c9={'uLqeV':function(_0x2713ab,_0x5239e4,_0x215cc6){return _0x2713ab(_0x5239e4,_0x215cc6);},'usLLd':'POST'};return await _0x46d3c9['uLqeV'](apiRequest,_0x603975(0x120),{'method':_0x46d3c9[_0x603975(0x154)],'body':JSON[_0x603975(0x149)]({'targetUrl':_0x3a6022,'mode':'agent'})});}async function deleteTunnelSession(_0x46e63e){const _0x49148d=_0x210f40;await apiRequest(_0x49148d(0x14f)+_0x46e63e,{'method':'DELETE'});}export function pickAdHocEnvKey(_0x7dd61e){const _0x3e9c45=_0x210f40,_0x50c85d={'NPyVJ':function(_0x36243a,_0x1c86e3){return _0x36243a===_0x1c86e3;}};if(!_0x7dd61e)return null;if(_0x7dd61e['defaultEnvironmentKey'])return _0x7dd61e['defaultEnvironmentKey'];const _0xdf3b5b=Object['keys'](_0x7dd61e[_0x3e9c45(0xe1)]??{});if(_0x50c85d[_0x3e9c45(0x145)](_0xdf3b5b[_0x3e9c45(0x163)],0x1))return _0xdf3b5b[0x0];if(_0xdf3b5b[_0x3e9c45(0x163)]===0x0)return null;throw new Error(_0x3e9c45(0x12a)+_0xdf3b5b[_0x3e9c45(0x155)](',\x20')+').\x20'+'Create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`\x20so\x20Ranger\x20can\x20pick\x20the\x20right\x20one.');}export async function resolveAdHocProfile(_0x238e67=process[_0x210f40(0x12e)]){const _0xc80afd=_0x210f40,_0x2b6cd7={'mvLxs':function(_0x4881da,_0x48318){return _0x4881da(_0x48318);},'hHJyU':function(_0x1b6bac,_0x5b5250){return _0x1b6bac(_0x5b5250);},'ANEPO':function(_0x2e9d30,_0x35470f,_0x2a62aa,_0x32ad6c){return _0x2e9d30(_0x35470f,_0x2a62aa,_0x32ad6c);},'cwpJJ':function(_0x5bdc84,_0x15e661){return _0x5bdc84??_0x15e661;}},_0x47f2f8=_0x238e67[_0xc80afd(0x148)];if(!_0x47f2f8)return null;const _0x132f9d=await _0x2b6cd7[_0xc80afd(0x132)](fetchCloudProfile,_0x47f2f8);if(_0x132f9d)return{'name':_0x132f9d[_0xc80afd(0x135)],'profile':_0x132f9d};const _0x4c1dcb=await fetchAuthConfig(),_0x4e5b5e=_0x2b6cd7[_0xc80afd(0x129)](pickAdHocEnvKey,_0x4c1dcb),_0x490349=_0x238e67['RANGER_TEST_PASSWORD'],_0x387514=await _0x2b6cd7['ANEPO'](createCloudProfile,_0x47f2f8,_0x2b6cd7[_0xc80afd(0x13f)](_0x4e5b5e,undefined),{'username':_0x47f2f8,'password':_0x490349});return console['log'](_0xc80afd(0xf8)+_0x387514[_0xc80afd(0x135)]+_0xc80afd(0xf1)+_0x47f2f8),{'name':_0x387514[_0xc80afd(0x135)],'profile':_0x387514};}export async function writeSessionToLocalCache(_0x17d1c0,_0x524a56,_0x47a8bd,_0x4685ea,_0x18e673,_0x1fae51,_0x2430c8){const _0x92bed=_0x210f40,_0x317997={'IvrBD':function(_0xd73997,_0x594196,_0x1de9fd){return _0xd73997(_0x594196,_0x1de9fd);},'KtrXu':function(_0x2385c6,_0x287146){return _0x2385c6(_0x287146);},'Rgwet':function(_0xbbe8e4,_0x458e8a){return _0xbbe8e4>_0x458e8a;},'hTItA':function(_0x58447f,_0x360ed6,_0x17af23){return _0x58447f(_0x360ed6,_0x17af23);}},_0x1ac504=sessionCacheHash({'orgId':_0x524a56,'profileName':_0x17d1c0,'effectiveBaseUrl':_0x47a8bd,'setupHeaders':_0x4685ea,'invalidateOn':_0x2430c8?.['invalidateOn'],'userAgent':_0x2430c8?.['userAgent'],'clientIp':_0x2430c8?.['clientIp']}),_0x3620d6=getSessionCachePath(_0x1ac504,_0x17d1c0),_0x4ad8f2=_0x317997[_0x92bed(0xec)](join,getRangerHomeDir(),'auth');!_0x317997['KtrXu'](existsSync,_0x4ad8f2)&&await mkdir(_0x4ad8f2,{'recursive':!![]});const _0x384a1a={..._0x18e673};_0x1fae51&&_0x317997['Rgwet'](_0x1fae51[_0x92bed(0x163)],0x0)&&Array[_0x92bed(0x13e)](_0x384a1a['cookies'])&&(_0x384a1a[_0x92bed(0xe6)]=_0x317997['IvrBD'](duplicateCookiesForDomains,_0x384a1a[_0x92bed(0xe6)],_0x1fae51));const _0x122c2e={'cached_at':new Date()[_0x92bed(0x13b)](),'session_state':_0x384a1a};await _0x317997[_0x92bed(0xec)](writeFile,_0x3620d6,JSON[_0x92bed(0x149)](_0x122c2e,null,0x2));const _0x3bd742=getStorageStatePath(_0x3620d6);return await _0x317997['hTItA'](writeFile,_0x3bd742,JSON['stringify'](_0x384a1a,null,0x2)),_0x3bd742;}export async function checkLocalCache(_0x51d0ac,_0x742ffe,_0x146c01,_0x6d42e8,_0x3fc31c){const _0x10cc9d=_0x210f40,_0x386dd1={'vluBE':function(_0xbc5fbc,_0x186905){return _0xbc5fbc(_0x186905);}},_0x361618=_0x386dd1['vluBE'](sessionCacheHash,{'orgId':_0x742ffe,'profileName':_0x51d0ac,'effectiveBaseUrl':_0x146c01,'setupHeaders':_0x6d42e8,'invalidateOn':_0x3fc31c?.['invalidateOn'],'userAgent':_0x3fc31c?.['userAgent'],'clientIp':_0x3fc31c?.['clientIp']}),_0x5dd9cd=getSessionCachePath(_0x361618,_0x51d0ac),_0x328a26=_0x386dd1['vluBE'](getStorageStatePath,_0x5dd9cd);if(!existsSync(_0x5dd9cd)||!existsSync(_0x328a26))return null;try{const _0x375fcd=await readFile(_0x5dd9cd,_0x10cc9d(0xe9));return JSON['parse'](_0x375fcd),{'storageStatePath':_0x328a26};}catch{return null;}}function launchRealBrowser(){return chromium['launch']({'headless':!![]});}function _0xd99f(_0x3268bb,_0x151461){_0x3268bb=_0x3268bb-0xd8;const _0x539cce=_0x539c();let _0xd99f99=_0x539cce[_0x3268bb];return _0xd99f99;}function emitSessionValidationHint(_0x180fd1,_0x4a02b4){const _0x195b58=_0x210f40,_0x46651a={'RctYH':function(_0x2f57f9,_0x56cd0f){return _0x2f57f9===_0x56cd0f;},'eNJNj':function(_0x3d1c0e,_0x51561d){return _0x3d1c0e+_0x51561d;},'AylXh':function(_0x4753a6,_0x1370e7){return _0x4753a6+_0x1370e7;}};if(!_0x4a02b4||!_0x4a02b4['domains']?.[_0x195b58(0x163)])return;let _0x19c98a;try{_0x19c98a=new URL(_0x180fd1);}catch{return;}const _0x5e7f22=[];for(const _0x44186a of _0x4a02b4['domains']){try{_0x5e7f22['push']({'raw':_0x44186a,'url':new URL(_0x44186a)});}catch{}}if(_0x46651a['RctYH'](_0x5e7f22[_0x195b58(0x163)],0x0))return;if(_0x5e7f22[_0x195b58(0xfd)](_0x3424ba=>_0x3424ba['url']['origin']===_0x19c98a[_0x195b58(0x111)]))return;const _0x303ade=_0x5e7f22['map'](_0x1c2d00=>'\x22'+_0x1c2d00['raw']+'\x22')[_0x195b58(0x155)](',\x20');console['log'](_0x46651a[_0x195b58(0x115)](_0x46651a['AylXh']('\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20'+_0x303ade+';\x20',_0x195b58(0x10a)+_0x180fd1+'\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20'),_0x195b58(0x100)));}export async function serverSideLogin(_0x31da03,_0x46e02e){const _0x2f76c8=_0x210f40,_0x551b2d={'tRCGB':_0x2f76c8(0xdc)},_0x4c23e4=process[_0x2f76c8(0x12e)]['RANGER_TEST_USERNAME'],_0x5a3deb=process['env']['RANGER_TEST_PASSWORD'],_0x32d002={};if(_0x4c23e4)_0x32d002[_0x2f76c8(0x136)]=_0x4c23e4;if(_0x5a3deb)_0x32d002['password']=_0x5a3deb;if(_0x46e02e?.[_0x2f76c8(0xe2)])_0x32d002[_0x2f76c8(0xe2)]=!![];if(_0x46e02e?.[_0x2f76c8(0x11b)])_0x32d002['target_url']=_0x46e02e[_0x2f76c8(0x11b)];_0x46e02e?.[_0x2f76c8(0xe7)]&&(_0x32d002['tunnel_session_id']=_0x46e02e[_0x2f76c8(0xe7)][_0x2f76c8(0x12f)],_0x32d002['pw_endpoint']=_0x46e02e['tunnel'][_0x2f76c8(0xff)]);try{return await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x31da03)+'/login',{'method':'POST','body':JSON[_0x2f76c8(0x149)](_0x32d002)});}catch(_0x1b3856){if(_0x1b3856 instanceof ApiError&&_0x1b3856['status']===0x190&&_0x1b3856[_0x2f76c8(0x11d)]===_0x2f76c8(0xdc))return{'status':_0x551b2d['tRCGB'],'error':_0x1b3856['detail']};throw _0x1b3856;}}async function serverSideLoginWithOptionalTunnel(_0x173d81,_0x51433a){const _0x43a4a7=_0x210f40,_0x112dbf={'cRbEc':function(_0x338d5a,_0x1eb34a){return _0x338d5a(_0x1eb34a);},'pBmkC':function(_0x28f873){return _0x28f873();}};if(!needsTunnel(_0x51433a))return await serverSideLogin(_0x173d81);let _0x3be77a=null,_0x44076d=null,_0x4294be=null;try{_0x3be77a=await _0x112dbf[_0x43a4a7(0x13d)](launchBrowserServer,{'headless':!![]}),_0x44076d=await createTunnelSession(_0x51433a);const _0x29da4d=await _0x112dbf[_0x43a4a7(0x112)](requireToken);return _0x4294be=await _0x112dbf['cRbEc'](createTunnelBridge,{'localWsUrl':_0x3be77a[_0x43a4a7(0x110)],'tunnelServerUrl':_0x44076d['tunnelUrl'],'sessionId':_0x44076d['sessionId'],'apiKey':_0x29da4d}),await serverSideLogin(_0x173d81,{'targetUrl':_0x51433a,'tunnel':{'sessionId':_0x44076d['sessionId'],'pwEndpoint':_0x44076d[_0x43a4a7(0xff)]}});}finally{_0x4294be?.['close'](),_0x3be77a&&await _0x3be77a['close']()[_0x43a4a7(0xed)](()=>{}),_0x44076d&&await _0x112dbf[_0x43a4a7(0x13d)](deleteTunnelSession,_0x44076d['sessionId'])['catch'](()=>{});}}export async function manualBrowserLogin(_0x7cdb7,_0x519602){const _0x33712b=_0x210f40,_0x2f1faa={'wvRyK':function(_0x46df67,_0x1f9b29,_0x3cdf05){return _0x46df67(_0x1f9b29,_0x3cdf05);},'gveFe':_0x33712b(0x147),'qWAsQ':function(_0x1e22c7){return _0x1e22c7();},'syuQC':function(_0x28db6a,_0x2d0572){return _0x28db6a+_0x2d0572;},'exmGV':_0x33712b(0xde),'pdnVv':_0x33712b(0x151),'sdOay':function(_0x365038,_0x49f80b){return _0x365038>_0x49f80b;},'tUuxf':function(_0xecc5b4,_0x33c39b){return _0xecc5b4&&_0x33c39b;},'mAeiP':_0x33712b(0xf7),'RiHoF':_0x33712b(0x152)};if(!_0x2f1faa[_0x33712b(0x137)](isInteractive))throw new Error(_0x2f1faa[_0x33712b(0xe4)]('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x7cdb7['name']+'\x22.\x0a',_0x2f1faa['exmGV'])+_0x2f1faa['pdnVv']);const _0x814bfd=_0x519602&&_0x2f1faa['sdOay'](_0x519602[_0x33712b(0x150)][_0x33712b(0x163)],0x0)?_0x519602[_0x33712b(0x150)][0x0]:'about:blank';console[_0x33712b(0x15b)](_0x33712b(0x131)),console[_0x33712b(0x15b)]('\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a'),await new Promise(_0x5aa1bc=>setTimeout(_0x5aa1bc,0x7d0));const _0x4974f1=await chromium['launch']({'headless':![]});let _0x366237=null;try{const _0x54d532={'ignoreHTTPSErrors':!![]};_0x519602?.['setupHeaders']&&(_0x54d532[_0x33712b(0x106)]=_0x519602['setupHeaders']);const _0x21d09e=await _0x4974f1[_0x33712b(0x153)](_0x54d532);await addProfileSetupBanner(_0x21d09e);const _0x3c19a0=await _0x21d09e[_0x33712b(0x11f)]();await _0x3c19a0[_0x33712b(0x12b)](_0x814bfd);let _0x576542=![];await new Promise(_0x51f84f=>{const _0x43e387={'zdyCm':function(_0x945a71){return _0x945a71();}},_0x244fea=_0x2f1faa['wvRyK'](setTimeout,()=>{const _0x1a42ad=_0xd99f;_0x576542=!![],console['error'](_0x1a42ad(0x14e)+MANUAL_LOGIN_TIMEOUT_MS/0xea60+_0x1a42ad(0xf6)),_0x43e387['zdyCm'](_0x51f84f);},MANUAL_LOGIN_TIMEOUT_MS);_0x3c19a0['on'](_0x2f1faa['gveFe'],async()=>{const _0x5cf315=_0xd99f;clearTimeout(_0x244fea);try{const _0x31ffab=await _0x21d09e[_0x5cf315(0x126)]();_0x366237=_0x31ffab;}catch{}_0x51f84f();});});if(_0x2f1faa[_0x33712b(0x119)](_0x576542,!_0x366237))throw new Error('Browser\x20login\x20timed\x20out\x20before\x20completion.');}finally{await _0x4974f1[_0x33712b(0x147)]()['catch'](()=>{});}if(!_0x366237)throw new Error(_0x2f1faa['mAeiP']);return await apiRequest(_0x33712b(0x14c)+encodeURIComponent(_0x7cdb7['name'])+_0x33712b(0x124),{'method':_0x33712b(0xfc),'body':JSON[_0x33712b(0x149)]({'session_state':_0x366237,'updated_by':_0x2f1faa['RiHoF']})}),{'sessionState':_0x366237};}export async function promptSaveCredentials(_0x2a2f3a){const _0x1e070e=_0x210f40,_0x25e709={'nxLFX':function(_0x39ba50,_0x47df09){return _0x39ba50||_0x47df09;},'mQJfB':function(_0x4efa08){return _0x4efa08();},'VKzMB':_0x1e070e(0xf3),'PPSZO':_0x1e070e(0xfa),'nPewu':function(_0x4d8f0b,_0x3f7821){return _0x4d8f0b(_0x3f7821);},'yNGRU':'\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.'},_0x27d788=process[_0x1e070e(0x12e)][_0x1e070e(0x148)],_0x52ba93=process['env']['RANGER_TEST_PASSWORD'];if(_0x25e709[_0x1e070e(0x134)](!_0x27d788,!_0x52ba93))return;if(!_0x25e709[_0x1e070e(0x127)](isInteractive))return;const {save:_0x57af76}=await _0x572fab['prompt']([{'type':_0x25e709[_0x1e070e(0x15d)],'name':'save','message':_0x25e709[_0x1e070e(0x107)],'default':![]}]);if(!_0x57af76)return;await apiRequest('/api/v1/profiles/'+_0x25e709['nPewu'](encodeURIComponent,_0x2a2f3a),{'method':'PUT','body':JSON['stringify']({'username':_0x27d788,'password':_0x52ba93})}),console[_0x1e070e(0x15b)](_0x25e709[_0x1e070e(0x101)]);}export async function resolveCloudProfileSession(_0x36ebf1,_0x43c607={}){const _0x589f44=_0x210f40,_0x4cda1b={'RhHoU':function(_0x184852,_0x164b12,_0x4a258a){return _0x184852(_0x164b12,_0x4a258a);},'SONRZ':_0x589f44(0x122),'biNrQ':function(_0x57bde8,_0x25161c){return _0x57bde8===_0x25161c;},'mORSB':function(_0x3da114,_0x31035a){return _0x3da114||_0x31035a;},'Ttbva':function(_0x1a10f6,_0x493b21){return _0x1a10f6(_0x493b21);},'GqZQT':function(_0x3d795a,_0xccb6cf){return _0x3d795a&&_0xccb6cf;},'NOlBA':function(_0x1aca7e,_0x50a85f,_0x449022,_0x2e380a,_0x9a120e){return _0x1aca7e(_0x50a85f,_0x449022,_0x2e380a,_0x9a120e);},'dUGgN':function(_0x4fcf74,_0xcb94de,_0x5064ea,_0x2266b3,_0xd80dcc,_0x314e2d,_0x4e383c,_0x564a6f){return _0x4fcf74(_0xcb94de,_0x5064ea,_0x2266b3,_0xd80dcc,_0x314e2d,_0x4e383c,_0x564a6f);},'JAvGh':function(_0x297940,_0x4cb44c){return _0x297940&&_0x4cb44c;},'FFmZJ':function(_0x51e17d,_0x4958e9,_0x43ef1e){return _0x51e17d(_0x4958e9,_0x43ef1e);},'zdQUv':function(_0x995f94,_0x526bdf){return _0x995f94(_0x526bdf);},'OHgsZ':function(_0x4de17e,_0x17fabd){return _0x4de17e||_0x17fabd;},'wMCGB':_0x589f44(0xdc),'cVXut':_0x589f44(0x121),'mHkGV':function(_0x25bb9e,_0x572c5f,_0x317690,_0x4f5f02,_0x4872fa,_0x3058b2,_0x37227e,_0x52cb09){return _0x25bb9e(_0x572c5f,_0x317690,_0x4f5f02,_0x4872fa,_0x3058b2,_0x37227e,_0x52cb09);},'EIsSh':function(_0x43ea03,_0x54be28){return _0x43ea03(_0x54be28);},'nPIxZ':_0x589f44(0x14d)},_0x56abb9=_0x36ebf1[_0x589f44(0xdd)]??{},_0x13c900=await fetchAuthConfig(),_0x597d5e=_0x13c900?_0x4cda1b[_0x589f44(0x15a)](resolveAuthEnvironmentLocally,_0x13c900,_0x36ebf1[_0x589f44(0x11e)]):null,_0x400e6a=typeof _0x597d5e?.[_0x589f44(0xdb)]===_0x4cda1b['SONRZ']&&_0x597d5e['loginInstructions']['trim']()?_0x597d5e[_0x589f44(0xdb)]:undefined,_0x212cf5=_0x4cda1b[_0x589f44(0x113)](typeof _0x56abb9[_0x589f44(0xdb)],_0x4cda1b['SONRZ'])&&_0x56abb9[_0x589f44(0xdb)]['trim']()?_0x56abb9['loginInstructions']:undefined,_0x40d876=_0x4cda1b[_0x589f44(0xe3)](_0x212cf5,!_0x400e6a)?_0x56abb9:{..._0x56abb9,'loginInstructions':_0x400e6a},_0xf9708e=Boolean(_0x40d876[_0x589f44(0xdb)]?.['trim']()),_0x4ddac4=_0x597d5e?.[_0x589f44(0x150)],_0x48b5cc=_0x56abb9['setupHeaders'],_0x561aa9=_0x48b5cc??_0x597d5e?.[_0x589f44(0x160)],_0x3703b1=_0x43c607[_0x589f44(0x13a)]??_0x56abb9[_0x589f44(0xf2)]??(_0x4ddac4&&_0x4ddac4['length']>0x0?_0x4ddac4[0x0]:''),_0x2161a1=_0x3703b1?_0x4cda1b[_0x589f44(0xd8)](needsTunnel,_0x3703b1):![],_0x276534={'invalidateOn':_0x597d5e?.[_0x589f44(0x114)],'userAgent':_0x597d5e?.['browserOptions']?.['userAgent']??_0x56abb9['userAgent']},_0x230aed=await checkLocalCache(_0x36ebf1['name'],_0x36ebf1[_0x589f44(0x10f)],_0x3703b1,_0x561aa9,_0x276534);if(_0x230aed){if(_0x4cda1b[_0x589f44(0x14a)](_0x3703b1,!_0x2161a1)){const _0x505085=await _0x4cda1b['NOlBA'](isCachedSessionLive,_0x230aed[_0x589f44(0x156)],_0x3703b1,{'sessionCheckPath':_0x597d5e?.['sessionCheckPath'],'setupHeaders':_0x561aa9},{'launchBrowser':launchRealBrowser});if(_0x505085)return console[_0x589f44(0x15b)](_0x589f44(0xee)+_0x36ebf1['name']+'\x22'),{'authPath':_0x230aed[_0x589f44(0x156)],'settings':_0x40d876,'resolvedEnv':_0x597d5e};console['log'](_0x589f44(0x161)+_0x36ebf1[_0x589f44(0x135)]+_0x589f44(0x142)),emitSessionValidationHint(_0x3703b1,_0x597d5e);}else return _0x2161a1&&console[_0x589f44(0x15b)](_0x589f44(0x118)+_0x36ebf1[_0x589f44(0x135)]+'\x22'),{'authPath':_0x230aed[_0x589f44(0x156)],'settings':_0x40d876,'resolvedEnv':_0x597d5e};}if(_0x36ebf1[_0x589f44(0x13c)]){const _0x502678=await _0x4cda1b[_0x589f44(0x10e)](writeSessionToLocalCache,_0x36ebf1[_0x589f44(0x135)],_0x36ebf1[_0x589f44(0x10f)],_0x3703b1,_0x561aa9,_0x36ebf1['sessionState'],_0x4ddac4,_0x276534);if(_0x4cda1b[_0x589f44(0x158)](_0x3703b1,!_0x2161a1)){const _0x396a5f=await isCachedSessionLive(_0x502678,_0x3703b1,{'sessionCheckPath':_0x597d5e?.[_0x589f44(0x159)],'setupHeaders':_0x561aa9},{'launchBrowser':launchRealBrowser});if(_0x396a5f)return console[_0x589f44(0x15b)](_0x589f44(0x104)+_0x36ebf1['name']+'\x22,\x20cached\x20locally'),{'authPath':_0x502678,'settings':_0x40d876,'resolvedEnv':_0x597d5e};console['log'](_0x589f44(0x10d)+_0x36ebf1[_0x589f44(0x135)]+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),_0x4cda1b['FFmZJ'](emitSessionValidationHint,_0x3703b1,_0x597d5e);}else return _0x2161a1&&console['log']('\x20\x20Cloud\x20session\x20copied\x20to\x20local\x20cache\x20for\x20\x22'+_0x36ebf1['name']+_0x589f44(0x11a)),{'authPath':_0x502678,'settings':_0x40d876,'resolvedEnv':_0x597d5e};}if(_0xf9708e)return console[_0x589f44(0x15b)]('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x36ebf1['name']+_0x589f44(0x10c)),{'authPath':undefined,'settings':_0x40d876,'resolvedEnv':_0x597d5e};console[_0x589f44(0x15b)](_0x589f44(0x116)+_0x36ebf1[_0x589f44(0x135)]+'\x22,\x20attempting\x20login...');const _0x32adc5=_0x4cda1b[_0x589f44(0xd8)](Boolean,process['env'][_0x589f44(0x148)])&&Boolean(process['env'][_0x589f44(0x128)]),_0x1d8e2b=_0x4cda1b['zdQUv'](Boolean,_0x36ebf1[_0x589f44(0x136)]);if(_0x4cda1b[_0x589f44(0x139)](_0x32adc5,_0x1d8e2b))try{const _0x1c4f4b=_0x3703b1?await serverSideLoginWithOptionalTunnel(_0x36ebf1[_0x589f44(0x135)],_0x3703b1):await _0x4cda1b[_0x589f44(0xdf)](serverSideLogin,_0x36ebf1[_0x589f44(0x135)]);if(_0x1c4f4b[_0x589f44(0x117)]===_0x4cda1b['wMCGB'])console[_0x589f44(0x15b)](_0x589f44(0xfb));else{if(_0x1c4f4b['status']==='success'&&_0x1c4f4b[_0x589f44(0x108)]){console[_0x589f44(0x15b)](_0x4cda1b['cVXut']);const _0x5f3a6a=await _0x4cda1b['mHkGV'](writeSessionToLocalCache,_0x36ebf1[_0x589f44(0x135)],_0x36ebf1[_0x589f44(0x10f)],_0x3703b1,_0x561aa9,_0x1c4f4b[_0x589f44(0x108)],_0x4ddac4,_0x276534);return _0x32adc5&&!_0x1d8e2b&&await _0x4cda1b['EIsSh'](promptSaveCredentials,_0x36ebf1['name']),{'authPath':_0x5f3a6a,'settings':_0x40d876,'resolvedEnv':_0x597d5e};}else _0x1c4f4b[_0x589f44(0x146)]&&(console[_0x589f44(0x15b)](_0x4cda1b[_0x589f44(0xf4)]),console['log'](_0x1c4f4b['test_output'])),console[_0x589f44(0x15b)](_0x589f44(0xe8));}}catch(_0x5cca89){console[_0x589f44(0x15b)](_0x589f44(0x140)+(_0x5cca89 instanceof Error?_0x5cca89[_0x589f44(0x133)]:String(_0x5cca89))),console[_0x589f44(0x15b)](_0x589f44(0xe8));}const _0x256f27=_0x597d5e?{..._0x597d5e,'setupHeaders':_0x561aa9}:_0x3703b1?{'key':_0x36ebf1[_0x589f44(0x11e)]??'','domains':[_0x3703b1],'setupHeaders':_0x561aa9}:null,{sessionState:_0x2c8642}=await manualBrowserLogin(_0x36ebf1,_0x256f27),_0x561d42=await writeSessionToLocalCache(_0x36ebf1[_0x589f44(0x135)],_0x36ebf1[_0x589f44(0x10f)],_0x3703b1,_0x561aa9,_0x2c8642,_0x4ddac4,_0x276534);return{'authPath':_0x561d42,'settings':_0x40d876,'resolvedEnv':_0x597d5e};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x487731=_0x4ee2;(function(_0x134683,_0x592118){const _0x4def3c=_0x4ee2,_0x5f4365=_0x134683();while(!![]){try{const _0x5bfb5a=-parseInt(_0x4def3c(0x13e))/0x1*(parseInt(_0x4def3c(0x11d))/0x2)+-parseInt(_0x4def3c(0x133))/0x3+parseInt(_0x4def3c(0x11b))/0x4*(parseInt(_0x4def3c(0x126))/0x5)+-parseInt(_0x4def3c(0x123))/0x6*(-parseInt(_0x4def3c(0x11f))/0x7)+-parseInt(_0x4def3c(0x12a))/0x8+parseInt(_0x4def3c(0x12e))/0x9*(-parseInt(_0x4def3c(0x13f))/0xa)+parseInt(_0x4def3c(0x11e))/0xb;if(_0x5bfb5a===_0x592118)break;else _0x5f4365['push'](_0x5f4365['shift']());}catch(_0x5f2228){_0x5f4365['push'](_0x5f4365['shift']());}}}(_0x9a80,0xecd18));import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x39b7d9=process[_0x487731(0x12b)],_0xfd2242={'stdin':process[_0x487731(0x136)],'stdout':process[_0x487731(0x139)]}){const _0x546982=_0x487731,_0x4e8068={'joaTl':function(_0x22f45b,_0x49a7b5){return _0x22f45b(_0x49a7b5);}};if(_0x39b7d9['CI'])return![];return Boolean(_0xfd2242[_0x546982(0x136)][_0x546982(0x129)])&&_0x4e8068['joaTl'](Boolean,_0xfd2242[_0x546982(0x139)][_0x546982(0x129)]);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x55cc6e){const _0x2aab3e=_0x487731,_0x5a602c={'JAeUM':'baseUrl','bvngj':_0x2aab3e(0x118),'JJxnG':function(_0x14b3e4,_0xef68c9){return _0x14b3e4(_0xef68c9);},'rfPTZ':function(_0x205178,_0x1e1a30){return _0x205178!==_0x1e1a30;},'wqYsB':_0x2aab3e(0x116),'PWvww':function(_0x58cce1,_0x257b5c){return _0x58cce1(_0x257b5c);}},_0x3663ff=new Set(_0x55cc6e['invalidateOn']??DEFAULT_INVALIDATE_ON),_0x13edaa={'orgId':_0x55cc6e['orgId'],'profileName':_0x55cc6e[_0x2aab3e(0x137)]};return _0x3663ff[_0x2aab3e(0x113)](_0x5a602c[_0x2aab3e(0x122)])&&(_0x13edaa[_0x2aab3e(0x127)]=_0x55cc6e[_0x2aab3e(0x127)]),_0x3663ff['has'](_0x5a602c['bvngj'])&&(_0x13edaa['setupHeaders']=_0x55cc6e['setupHeaders']?_0x5a602c['JJxnG'](sortObjectKeys,_0x55cc6e[_0x2aab3e(0x118)]):_0x55cc6e['setupHeaders']),_0x3663ff['has'](_0x2aab3e(0x121))&&(_0x13edaa[_0x2aab3e(0x121)]=extractPort(_0x55cc6e['effectiveBaseUrl'])),_0x3663ff['has'](_0x2aab3e(0x12c))&&_0x5a602c['rfPTZ'](_0x55cc6e[_0x2aab3e(0x12c)],undefined)&&(_0x13edaa[_0x2aab3e(0x12c)]=_0x55cc6e[_0x2aab3e(0x12c)]),_0x3663ff[_0x2aab3e(0x113)](_0x5a602c[_0x2aab3e(0x13a)])&&_0x5a602c[_0x2aab3e(0x135)](_0x55cc6e[_0x2aab3e(0x116)],undefined)&&(_0x13edaa[_0x2aab3e(0x116)]=_0x55cc6e[_0x2aab3e(0x116)]),_0x5a602c['PWvww'](createHash,'sha256')['update'](JSON[_0x2aab3e(0x11a)](_0x13edaa))['digest'](_0x2aab3e(0x131))['slice'](0x0,0xc);}function extractPort(_0x34731e){try{return new URL(_0x34731e)['port'];}catch{return'';}}function sortObjectKeys(_0x207c4d){const _0x33be5d=_0x487731,_0x46b07d={};for(const _0x53ea22 of Object[_0x33be5d(0x132)](_0x207c4d)['sort']()){_0x46b07d[_0x53ea22]=_0x207c4d[_0x53ea22];}return _0x46b07d;}export function getSessionCachePath(_0x46daf6,_0x42cb23){const _0x4114db=_0x487731,_0x4ef049={'CYSSR':function(_0x48fa15,_0x47ecb6,_0x89ccaa,_0x59205b){return _0x48fa15(_0x47ecb6,_0x89ccaa,_0x59205b);}};return _0x4ef049[_0x4114db(0x130)](join,getRangerHomeDir(),'auth',_0x46daf6+'-'+_0x42cb23+_0x4114db(0x125));}export function getStorageStatePath(_0x555174){const _0x33adc1=_0x487731;return _0x555174['replace'](/\.json$/,_0x33adc1(0x12d));}export function needsTunnel(_0xc5ed2f){const _0x1f55f0=_0x487731,_0x320089={'cBXgw':'localhost','ZPkzr':function(_0xa4ce9c,_0x43591e){return _0xa4ce9c===_0x43591e;},'nxJup':_0x1f55f0(0x13d),'RrKvC':_0x1f55f0(0x11c)};let _0x1dd86a;try{_0x1dd86a=new URL(_0xc5ed2f)['hostname'];}catch{return![];}if(_0x1dd86a===_0x320089[_0x1f55f0(0x13b)]||_0x320089['ZPkzr'](_0x1dd86a,_0x1f55f0(0x117)))return!![];if(_0x1dd86a['endsWith'](_0x320089[_0x1f55f0(0x119)]))return!![];if(_0x1dd86a['includes'](_0x320089['RrKvC']))return!![];return![];}function _0x9a80(){const _0x7c363f=['1971474DAKpCI','close','rfPTZ','stdin','profileName','toString','stdout','wqYsB','cBXgw','add','.localhost','1dPRQnP','171280qMStwj','has','url','test','clientIp','127.0.0.1','setupHeaders','nxJup','stringify','765972fYWMcw','localhost.','2391202MHTdUE','35805902iNlgsa','217bhEuHc','defaultEnvironmentKey','port','JAeUM','237678FKhlxB','hostname','.json','5wFTunz','effectiveBaseUrl','map','isTTY','8374360YjxDLI','env','userAgent','.storageState.json','423SvvwCi','newPage','CYSSR','hex','keys'];_0x9a80=function(){return _0x7c363f;};return _0x9a80();}function _0x4ee2(_0x162ad6,_0x2967cb){_0x162ad6=_0x162ad6-0x113;const _0x9a80d0=_0x9a80();let _0x4ee2f0=_0x9a80d0[_0x162ad6];return _0x4ee2f0;}export function hostnameOf(_0x1e7be5){const _0x55b26b=_0x487731;return new URL(_0x1e7be5)[_0x55b26b(0x124)];}export function duplicateCookiesForDomains(_0x3f248b,_0x3a218c){const _0x3e042f=_0x487731,_0x268b45=[..._0x3f248b],_0x4e4ede=new Set(_0x3f248b[_0x3e042f(0x128)](_0x5858a0=>_0x5858a0['domain']));for(const _0x25f366 of _0x3a218c){let _0x3515ad;try{_0x3515ad=hostnameOf(_0x25f366);}catch{continue;}if(!_0x3515ad)continue;const _0x3b25d0=_0x3515ad['startsWith']('.')?_0x3515ad:'.'+_0x3515ad;if(_0x4e4ede[_0x3e042f(0x113)](_0x3515ad)||_0x4e4ede[_0x3e042f(0x113)](_0x3b25d0))continue;for(const _0x2f6d48 of _0x3f248b){_0x268b45['push']({..._0x2f6d48,'domain':_0x3b25d0});}_0x4e4ede[_0x3e042f(0x13c)](_0x3b25d0);}return _0x268b45;}export function resolveAuthEnvironmentLocally(_0x1c57fb,_0x74f2a5){const _0x26251a=_0x487731,_0x1b7ad0=_0x1c57fb['environments'];if(_0x74f2a5){const _0x240a40=_0x1b7ad0[_0x74f2a5];if(!_0x240a40)return null;return{'key':_0x74f2a5,..._0x240a40};}if(_0x1c57fb[_0x26251a(0x120)]){const _0x32e869=_0x1b7ad0[_0x1c57fb['defaultEnvironmentKey']];if(!_0x32e869)return null;return{'key':_0x1c57fb['defaultEnvironmentKey'],..._0x32e869};}const _0x258d51=Object[_0x26251a(0x132)](_0x1b7ad0);if(_0x258d51['length']===0x1){const _0xcab15f=_0x258d51[0x0];return{'key':_0xcab15f,..._0x1b7ad0[_0xcab15f]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x1ae651,_0x34363c){const _0x5160a8=_0x487731;try{if(_0x34363c)return new URL(_0x34363c,_0x1ae651)['toString']();return new URL(_0x1ae651)[_0x5160a8(0x138)]();}catch{return null;}}export function looksLikeLoginUrl(_0x17d70f){const _0x3616a1=_0x487731;try{const _0x2dfe0b=new URL(_0x17d70f);return LOGIN_URL_PATTERN[_0x3616a1(0x115)](_0x2dfe0b['pathname']);}catch{return LOGIN_URL_PATTERN['test'](_0x17d70f);}}export async function isCachedSessionLive(_0x353955,_0x57e499,_0x34b19d={},_0x1db430={}){const _0x4a4f29=_0x487731,_0x362f0e={'wPbMR':'domcontentloaded','TUVJW':function(_0x52b88b,_0x3f4395){return _0x52b88b===_0x3f4395;}},_0x1117b0=buildSessionCheckUrl(_0x57e499,_0x34b19d['sessionCheckPath']);if(!_0x1117b0)return!![];if(!_0x1db430['launchBrowser'])return!![];let _0x3b7a78=null;try{_0x3b7a78=await _0x1db430['launchBrowser']();const _0x3aeeb2=await _0x3b7a78['newContext']({'storageState':_0x353955,'ignoreHTTPSErrors':!![],..._0x34b19d[_0x4a4f29(0x118)]?{'extraHTTPHeaders':_0x34b19d['setupHeaders']}:{}}),_0x5305f7=await _0x3aeeb2[_0x4a4f29(0x12f)](),_0x5d9463=await _0x5305f7['goto'](_0x1117b0,{'waitUntil':_0x362f0e['wPbMR'],'timeout':0x3a98}),_0x43948d=_0x5d9463?.['status']();if(_0x43948d===0x191||_0x362f0e['TUVJW'](_0x43948d,0x193))return![];const _0x4bdedc=_0x5305f7[_0x4a4f29(0x114)]();if(looksLikeLoginUrl(_0x4bdedc))return![];return!![];}catch{return![];}finally{if(_0x3b7a78)await _0x3b7a78[_0x4a4f29(0x134)]()['catch'](()=>{});}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function _0xdfba(_0x1af902,_0x3e4396){_0x1af902=_0x1af902-0x195;const _0x3b6f81=_0x3b6f();let _0xdfba07=_0x3b6f81[_0x1af902];return _0xdfba07;}const _0x50000c=_0xdfba;(function(_0x2cc586,_0x24ed95){const _0x482dc2=_0xdfba,_0x1d5b96=_0x2cc586();while(!![]){try{const _0x2ea8a8=parseInt(_0x482dc2(0x1a1))/0x1+-parseInt(_0x482dc2(0x197))/0x2+parseInt(_0x482dc2(0x19a))/0x3*(-parseInt(_0x482dc2(0x1a7))/0x4)+-parseInt(_0x482dc2(0x1a6))/0x5*(parseInt(_0x482dc2(0x195))/0x6)+-parseInt(_0x482dc2(0x19d))/0x7+-parseInt(_0x482dc2(0x19b))/0x8+parseInt(_0x482dc2(0x1a3))/0x9;if(_0x2ea8a8===_0x24ed95)break;else _0x1d5b96['push'](_0x1d5b96['shift']());}catch(_0xc21522){_0x1d5b96['push'](_0x1d5b96['shift']());}}}(_0x3b6f,0xf3a6f));import{createCipheriv,createDecipheriv,randomBytes,pbkdf2Sync}from'crypto';const ALGORITHM=_0x50000c(0x1a0),SALT='ranger-auth-encryption',KEY_LENGTH=0x20,IV_LENGTH=0x10,TAG_LENGTH=0x10;export function deriveKey(_0xa696a4){const _0x105b91=_0x50000c,_0x30cd7a={'zDtep':function(_0x2a0c05,_0xde6ca7,_0x3f7710,_0x528be8,_0x28667f,_0x1c8ae8){return _0x2a0c05(_0xde6ca7,_0x3f7710,_0x528be8,_0x28667f,_0x1c8ae8);},'MxxOi':'sha256'};return _0x30cd7a[_0x105b91(0x1a2)](pbkdf2Sync,_0xa696a4,SALT,0x186a0,KEY_LENGTH,_0x30cd7a[_0x105b91(0x198)]);}export function encrypt(_0x4c3ef4,_0x2fbff6){const _0x4d3f26=_0x50000c,_0x429ec4={'GsmOS':function(_0x5355b5,_0x3bd437){return _0x5355b5(_0x3bd437);},'xSFdL':function(_0x3803bf,_0x4f4355,_0x4e732d,_0xabb139){return _0x3803bf(_0x4f4355,_0x4e732d,_0xabb139);},'ovyVn':'utf8'},_0x373c4d=deriveKey(_0x2fbff6),_0x7d6645=_0x429ec4['GsmOS'](randomBytes,IV_LENGTH),_0x183729=_0x429ec4[_0x4d3f26(0x1a5)](createCipheriv,ALGORITHM,_0x373c4d,_0x7d6645),_0x513327=Buffer['concat']([_0x183729['update'](_0x4c3ef4,_0x429ec4[_0x4d3f26(0x1a4)]),_0x183729['final']()]),_0x3ff8eb=_0x183729[_0x4d3f26(0x196)]();return Buffer[_0x4d3f26(0x199)]([_0x7d6645,_0x3ff8eb,_0x513327]);}export function decrypt(_0x4de9dc,_0x5b3af8){const _0x10b5d4=_0x50000c,_0x23824e={'EREWd':function(_0x1df355,_0x311b57){return _0x1df355(_0x311b57);},'xGwFP':function(_0x39b15b,_0x1c39a8){return _0x39b15b+_0x1c39a8;},'JmpPy':'utf8'},_0x3c3147=_0x23824e['EREWd'](deriveKey,_0x5b3af8),_0x4c36a4=_0x4de9dc['subarray'](0x0,IV_LENGTH),_0x4fc318=_0x4de9dc['subarray'](IV_LENGTH,IV_LENGTH+TAG_LENGTH),_0x10ca9b=_0x4de9dc['subarray'](IV_LENGTH+TAG_LENGTH),_0x2d65e0=createDecipheriv(ALGORITHM,_0x3c3147,_0x4c36a4);return _0x2d65e0[_0x10b5d4(0x19c)](_0x4fc318),_0x23824e['xGwFP'](_0x2d65e0[_0x10b5d4(0x19f)](_0x10ca9b),_0x2d65e0['final'](_0x23824e[_0x10b5d4(0x19e)]));}function _0x3b6f(){const _0x5a5349=['concat','17007vgGlCd','3648232PIiceR','setAuthTag','7035126YPaWsH','JmpPy','update','aes-256-gcm','1561717SWcRtP','zDtep','39121740jNGgxl','ovyVn','xSFdL','7294215vBgEIa','772qUnmnJ','6NLXmxA','getAuthTag','1793142MFJflU','MxxOi'];_0x3b6f=function(){return _0x5a5349;};return _0x3b6f();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x4f346f=_0x1608;(function(_0x20384e,_0x45e260){const _0x18db98=_0x1608,_0x37a7a2=_0x20384e();while(!![]){try{const _0x16c6fb=parseInt(_0x18db98(0x115))/0x1*(parseInt(_0x18db98(0xf5))/0x2)+-parseInt(_0x18db98(0x101))/0x3+-parseInt(_0x18db98(0xf8))/0x4+-parseInt(_0x18db98(0x100))/0x5*(-parseInt(_0x18db98(0xfc))/0x6)+parseInt(_0x18db98(0x10e))/0x7+parseInt(_0x18db98(0xe7))/0x8+parseInt(_0x18db98(0x103))/0x9*(-parseInt(_0x18db98(0xfe))/0xa);if(_0x16c6fb===_0x45e260)break;else _0x37a7a2['push'](_0x37a7a2['shift']());}catch(_0x19303d){_0x37a7a2['push'](_0x37a7a2['shift']());}}}(_0x5eea,0x7b707));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';function _0x5eea(){const _0x510cfe=['325130MkozGk','zotwN','includes','823444ZSKDZI','WSSKv','--key','--header','14826McbCtY','--authorization','20AjqLJg','has_token','365FNINMQ','738987PEQJBq','stringify','2920869LbpzUw','runtime_error','error','toLowerCase','rnLPB','=[REDACTED]','no_token','vRNPd','missing_option','--password','pdCIB','5508426lDquaH','DFyJZ','indexOf','join','--api-key','env','featureId','2yhGOLy','errorType','2515584aDbrIL','startsWith','unknown_command','slice','--apikey','sessionId','--token','--cookie','length','--credentials','Authorization','has','/api/v1/mcp/desire-path-logs','missing_required_argument'];_0x5eea=function(){return _0x510cfe;};return _0x5eea();}import{getCurrentVersion}from'./version.js';const SENSITIVE_FLAGS=new Set([_0x4f346f(0xed),'-t','--secret',_0x4f346f(0x112),_0x4f346f(0xeb),_0x4f346f(0xfa),_0x4f346f(0x10c),'--pass','--auth',_0x4f346f(0xfd),_0x4f346f(0xfb),_0x4f346f(0xee),_0x4f346f(0xf0)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function _0x1608(_0x34339b,_0x50f9f2){_0x34339b=_0x34339b-0xe7;const _0x5eea9e=_0x5eea();let _0x16084d=_0x5eea9e[_0x34339b];return _0x16084d;}function looksLikeToken(_0x5386ed){return TOKEN_PATTERNS['some'](_0x5ec4df=>_0x5ec4df['test'](_0x5386ed));}export function sanitizeArgs(_0x40fbd5){const _0x36af10=_0x4f346f,_0x1bd5af={'rnLPB':function(_0x5a07ef,_0x5cbb13){return _0x5a07ef<_0x5cbb13;},'jYvIe':'[REDACTED]','WSSKv':function(_0x439e18,_0x2620fc){return _0x439e18(_0x2620fc);}},_0x1372f5=[];let _0x4119f1=![];for(let _0x5261c6=0x0;_0x1bd5af[_0x36af10(0x107)](_0x5261c6,_0x40fbd5[_0x36af10(0xef)]);_0x5261c6++){const _0x3a43a3=_0x40fbd5[_0x5261c6];if(_0x4119f1){_0x1372f5['push'](_0x1bd5af['jYvIe']),_0x4119f1=![];continue;}if(_0x3a43a3['startsWith']('--')||_0x3a43a3[_0x36af10(0xe8)]('-')){const _0x10d5d3=_0x3a43a3[_0x36af10(0x110)]('=');if(_0x10d5d3!==-0x1){const _0x44d26c=_0x3a43a3['slice'](0x0,_0x10d5d3)[_0x36af10(0x106)]();if(SENSITIVE_FLAGS[_0x36af10(0xf2)](_0x44d26c)){_0x1372f5['push'](_0x3a43a3[_0x36af10(0xea)](0x0,_0x10d5d3)+_0x36af10(0x108));continue;}}else{const _0x43b696=_0x3a43a3[_0x36af10(0x106)]();SENSITIVE_FLAGS['has'](_0x43b696)&&(_0x4119f1=!![]);}_0x1372f5['push'](_0x3a43a3);}else _0x1bd5af[_0x36af10(0xf9)](looksLikeToken,_0x3a43a3)?_0x1372f5['push'](_0x1bd5af['jYvIe']):_0x1372f5['push'](_0x3a43a3);}return _0x1372f5[_0x36af10(0x111)]('\x20');}export async function logDesirePath(_0xc45dc2){const _0x338e00=_0x4f346f,_0x1b52c6={'iDTaO':function(_0x62db00){return _0x62db00();},'WLmUQ':function(_0x2c791f){return _0x2c791f();},'JWtTC':_0x338e00(0xff),'GkopW':'application/json','vRNPd':_0x338e00(0xf1),'DFyJZ':function(_0x320cfe,_0x4aeecc,_0x2c0cbc){return _0x320cfe(_0x4aeecc,_0x2c0cbc);},'zotwN':'POST'};try{const _0x2df36c=await getToken()['catch'](()=>null),_0x77d86e=_0x1b52c6['iDTaO'](getApiBaseUrl),_0x383a8a=_0x1b52c6['WLmUQ'](getCurrentVersion),_0x5d5538=_0x2df36c?_0x1b52c6['JWtTC']:_0x338e00(0x109),_0x3460ee={..._0xc45dc2['metadata'],'authStatus':_0x5d5538,'isTty':process['stdout']['isTTY']??![]},_0x3f1660={'Content-Type':_0x1b52c6['GkopW']};_0x2df36c&&(_0x3f1660[_0x1b52c6[_0x338e00(0x10a)]]='Bearer\x20'+_0x2df36c);const _0xce1fe1={'rawCommand':_0xc45dc2['rawCommand'],'errorMessage':_0xc45dc2['errorMessage'],'errorType':_0xc45dc2[_0x338e00(0x116)],'featureId':_0xc45dc2[_0x338e00(0x114)],'sessionId':_0xc45dc2[_0x338e00(0xec)],'metadata':_0x3460ee,'cliVersion':_0x383a8a};process['env']['DEBUG']&&(console['error']('[desire-path]\x20Sending\x20log\x20to\x20'+_0x77d86e+_0x338e00(0xf3)),console[_0x338e00(0x105)]('[desire-path]\x20Payload:\x20'+JSON[_0x338e00(0x102)](_0xce1fe1,null,0x2))),await _0x1b52c6[_0x338e00(0x10f)](fetch,_0x77d86e+_0x338e00(0xf3),{'method':_0x1b52c6[_0x338e00(0xf6)],'headers':_0x3f1660,'body':JSON['stringify'](_0xce1fe1)});}catch(_0x929407){process[_0x338e00(0x113)]['DEBUG']&&console[_0x338e00(0x105)]('[desire-path]\x20Failed\x20to\x20send:\x20'+_0x929407);}}export function getErrorType(_0x154917,_0x182774){const _0x11a013=_0x4f346f,_0x481783={'QBvMF':_0x11a013(0xe9),'LTiao':'Unknown\x20argument','pdCIB':'Not\x20enough\x20non-option\x20arguments','oVlXP':'Invalid\x20values','essNX':_0x11a013(0x10b)};if(_0x182774)return _0x11a013(0x104);if(!_0x154917)return'unknown';if(_0x154917['includes']('Unknown\x20command'))return _0x481783['QBvMF'];if(_0x154917[_0x11a013(0xf7)](_0x481783['LTiao']))return'unknown_argument';if(_0x154917['includes'](_0x481783[_0x11a013(0x10d)]))return _0x11a013(0xf4);if(_0x154917['includes'](_0x481783['oVlXP']))return'invalid_option_value';if(_0x154917[_0x11a013(0xf7)]('Missing\x20required\x20argument'))return _0x481783['essNX'];return'syntax_error';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x37b0e3=_0x55fc;(function(_0x253c1c,_0x3ccdcb){const _0x5a16d9=_0x55fc,_0x38f474=_0x253c1c();while(!![]){try{const _0x21c84f=-parseInt(_0x5a16d9(0x1af))/0x1*(-parseInt(_0x5a16d9(0x1bd))/0x2)+parseInt(_0x5a16d9(0x1ad))/0x3*(parseInt(_0x5a16d9(0x1be))/0x4)+parseInt(_0x5a16d9(0x1ae))/0x5+-parseInt(_0x5a16d9(0x18b))/0x6*(parseInt(_0x5a16d9(0x1c7))/0x7)+-parseInt(_0x5a16d9(0x195))/0x8+-parseInt(_0x5a16d9(0x1a1))/0x9*(-parseInt(_0x5a16d9(0x1aa))/0xa)+-parseInt(_0x5a16d9(0x1a9))/0xb*(parseInt(_0x5a16d9(0x1c1))/0xc);if(_0x21c84f===_0x3ccdcb)break;else _0x38f474['push'](_0x38f474['shift']());}catch(_0x3d6742){_0x38f474['push'](_0x38f474['shift']());}}}(_0x3fc6,0xe250a));import{spawn}from'child_process';import _0x57a2ab from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL='https://api.workos.com/user_management/authorize/device',WORKOS_TOKEN_URL=_0x37b0e3(0x197);export async function requestDeviceCode(_0x5e2df2){const _0x3c6fe6=_0x37b0e3,_0x49cb76={'ojukG':_0x3c6fe6(0x18c),'hwqev':'application/x-www-form-urlencoded'},_0x39b976=await fetch(WORKOS_DEVICE_AUTH_URL,{'method':_0x49cb76[_0x3c6fe6(0x193)],'headers':{'Content-Type':_0x49cb76['hwqev']},'body':new URLSearchParams({'client_id':_0x5e2df2})});if(!_0x39b976['ok']){const _0x24e350=await _0x39b976['text']();throw new Error(_0x3c6fe6(0x191)+_0x39b976[_0x3c6fe6(0x1cf)]+'\x20'+_0x24e350);}return _0x39b976['json']();}export async function pollForTokens(_0x1c8015,_0x5a4791,_0x83dff8,_0x3c46f1){const _0x55e9cc=_0x37b0e3,_0x15d2a8={'cipUc':function(_0x51f695,_0x4f0f35){return _0x51f695+_0x4f0f35;},'zTgHq':function(_0x2527af,_0x21e07a){return _0x2527af*_0x21e07a;},'AoGed':function(_0x431eea,_0x2d1670,_0x1e73cc){return _0x431eea(_0x2d1670,_0x1e73cc);},'FFsdq':_0x55e9cc(0x1b8),'UcQrt':_0x55e9cc(0x1a3),'nKdSe':_0x55e9cc(0x184)},_0x3f26d0=_0x15d2a8['cipUc'](Date['now'](),_0x3c46f1*0x3e8);let _0x1fad2b=_0x15d2a8[_0x55e9cc(0x1c9)](_0x83dff8,0x3e8);while(Date[_0x55e9cc(0x18a)]()<_0x3f26d0){await sleep(_0x1fad2b);const _0x487a5f=await _0x15d2a8[_0x55e9cc(0x1ab)](fetch,WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x1c8015,'device_code':_0x5a4791,'grant_type':_0x15d2a8['FFsdq']})});if(_0x487a5f['ok'])return _0x487a5f[_0x55e9cc(0x1b6)]();const _0x4206aa=await _0x487a5f[_0x55e9cc(0x1b6)]();if(_0x4206aa['error']==='authorization_pending')continue;if(_0x4206aa[_0x55e9cc(0x1a5)]===_0x15d2a8[_0x55e9cc(0x1bf)]){_0x1fad2b+=0x3e8;continue;}throw new Error(_0x4206aa[_0x55e9cc(0x1a7)]||_0x4206aa['error']||_0x55e9cc(0x199));}throw new Error(_0x15d2a8[_0x55e9cc(0x192)]);}async function fetchUserProfile(_0x56fb34){const _0x2c0eeb=_0x37b0e3,_0x29e279={'vWkXT':function(_0x31b152,_0x3cf5b5,_0x2aac28){return _0x31b152(_0x3cf5b5,_0x2aac28);},'WvIRY':_0x2c0eeb(0x19f)},_0x4cebc0=getApiBaseUrl();try{const _0x429fcc=await _0x29e279['vWkXT'](fetch,_0x4cebc0+_0x2c0eeb(0x1ca),{'method':_0x29e279['WvIRY'],'headers':{'workos-token':_0x56fb34}});if(_0x429fcc['ok'])return _0x429fcc['json']();}catch{}return null;}function buildKeyName(_0x19950d,_0x3b891c){const _0x15780a=_0x37b0e3,_0x2b19ab={'yWmcW':function(_0x28b6c4,_0x23c1ed){return _0x28b6c4+_0x23c1ed;}},_0x2fa81f=_0x3b891c[_0x15780a(0x186)](_0x9840b4=>_0x9840b4[_0x15780a(0x19a)]===_0x19950d||_0x9840b4['name'][_0x15780a(0x198)](_0x19950d+'\x20('));if(_0x2fa81f[_0x15780a(0x1ac)]===0x0)return _0x19950d;return _0x19950d+'\x20('+_0x2b19ab[_0x15780a(0x1cc)](_0x2fa81f['length'],0x1)+')';}export async function provisionApiKey(_0x3e6c93){const _0x4fdd0b=_0x37b0e3,_0x548afb={'oxhYT':'application/json','aSQZK':_0x4fdd0b(0x1a6),'zlrAU':function(_0x189b37,_0x10b5b8,_0x3ea7e5){return _0x189b37(_0x10b5b8,_0x3ea7e5);},'HvCyD':_0x4fdd0b(0x19f),'zFBoo':function(_0x15a13b,_0x579ba9,_0x215358){return _0x15a13b(_0x579ba9,_0x215358);},'VxYHK':'mcp:write'},_0x35ace2=getApiBaseUrl(),_0x12fd7a={'Content-Type':_0x548afb[_0x4fdd0b(0x1b2)],'workos-token':_0x3e6c93},_0x534962=await fetchUserProfile(_0x3e6c93),_0x5a0846=_0x534962?.[_0x4fdd0b(0x19d)]||_0x534962?.['email']?.['split']('@')[0x0],_0x23c806=_0x5a0846?_0x5a0846+'\x27s\x20CLI\x20Key':_0x548afb['aSQZK'];let _0x1e8644=[];try{const _0x4a86f1=await _0x548afb[_0x4fdd0b(0x180)](fetch,_0x35ace2+'/api-keys',{'method':_0x548afb[_0x4fdd0b(0x1c8)],'headers':_0x12fd7a});if(_0x4a86f1['ok']){const _0x730d5=await _0x4a86f1[_0x4fdd0b(0x1b6)]();_0x1e8644=_0x730d5['apiKeys'];}}catch{}const _0xa535cf=buildKeyName(_0x23c806,_0x1e8644),_0x13f223=await _0x548afb[_0x4fdd0b(0x17f)](fetch,_0x35ace2+'/api-keys',{'method':_0x4fdd0b(0x18c),'headers':_0x12fd7a,'body':JSON[_0x4fdd0b(0x194)]({'name':_0xa535cf,'scope':_0x548afb[_0x4fdd0b(0x1a8)]})});if(!_0x13f223['ok']){const _0x23222d=await _0x13f223['text']();throw new Error('Failed\x20to\x20provision\x20API\x20key:\x20'+_0x13f223[_0x4fdd0b(0x1cf)]+'\x20'+_0x23222d);}const _0x3311bc=await _0x13f223[_0x4fdd0b(0x1b6)]();return _0x3311bc['apiKey']['token'];}export function openBrowser(_0x4a6c86){const _0x3deec0=_0x37b0e3,_0x3ac3f6={'SaNlq':function(_0xb88ac5,_0x526ac0){return _0xb88ac5===_0x526ac0;},'MHcVr':'cmd','LwpQo':'darwin','dsHWl':'open','QMpBD':'xdg-open','YNvYh':function(_0x59d5b2,_0x1419e6,_0x4d2ffc,_0x4d08b1){return _0x59d5b2(_0x1419e6,_0x4d2ffc,_0x4d08b1);},'RKYiV':_0x3deec0(0x188)};try{if(_0x3ac3f6['SaNlq'](process['platform'],'win32')){const _0x3b8bb7=spawn(_0x3ac3f6['MHcVr'],['/c','start','',_0x4a6c86],{'detached':!![],'stdio':'ignore','windowsHide':!![]});_0x3b8bb7[_0x3deec0(0x187)]();return;}const _0x39f95b=process['platform']===_0x3ac3f6['LwpQo']?_0x3ac3f6[_0x3deec0(0x1a2)]:_0x3ac3f6[_0x3deec0(0x1c0)],_0x1dcb92=_0x3ac3f6['YNvYh'](spawn,_0x39f95b,[_0x4a6c86],{'detached':!![],'stdio':_0x3ac3f6[_0x3deec0(0x182)]});_0x1dcb92[_0x3deec0(0x187)]();}catch{}}function _0x55fc(_0x12a5c7,_0x4ebe67){_0x12a5c7=_0x12a5c7-0x17f;const _0x3fc63e=_0x3fc6();let _0x55fc30=_0x3fc63e[_0x12a5c7];return _0x55fc30;}function decodeJwtPayload(_0x581901){const _0x472a84=_0x37b0e3,_0x5e9a07={'fKZCK':function(_0x1e9519,_0x9a5109){return _0x1e9519!==_0x9a5109;},'MpWEY':'Invalid\x20JWT\x20format','BUjOg':'base64url','AaJzp':_0x472a84(0x1c2)},_0x57ca9d=_0x581901[_0x472a84(0x18f)]('.');if(_0x5e9a07['fKZCK'](_0x57ca9d[_0x472a84(0x1ac)],0x3))throw new Error(_0x5e9a07['MpWEY']);const _0x555c71=Buffer['from'](_0x57ca9d[0x1],_0x5e9a07['BUjOg'])['toString'](_0x5e9a07[_0x472a84(0x1ba)]);return JSON['parse'](_0x555c71);}async function selfServeSignup(_0x222d7d){const _0xc8a329=_0x37b0e3,_0x3706ff={'eSfGV':function(_0x2ca3cd){return _0x2ca3cd();},'qWXtB':'application/json'},_0x35a53b=_0x3706ff[_0xc8a329(0x1cd)](getApiBaseUrl),_0xc66676=await fetch(_0x35a53b+_0xc8a329(0x1a0),{'method':_0xc8a329(0x18c),'headers':{'Content-Type':_0x3706ff['qWXtB'],'workos-token':_0x222d7d}});if(!_0xc66676['ok']){const _0x2ff8bd=await _0xc66676[_0xc8a329(0x1cb)]();throw new Error(_0xc8a329(0x185)+_0xc66676[_0xc8a329(0x1cf)]+'\x20'+_0x2ff8bd);}return _0xc66676[_0xc8a329(0x1b6)]();}async function fetchMyMemberships(_0x299169){const _0x3d1a1a=_0x37b0e3,_0x1cf9fd={'UBMuX':function(_0x240bbd){return _0x240bbd();}},_0x4c4642=_0x1cf9fd['UBMuX'](getApiBaseUrl),_0x5a8d25=await fetch(_0x4c4642+'/organization/my-memberships',{'method':_0x3d1a1a(0x19f),'headers':{'workos-token':_0x299169}});if(!_0x5a8d25['ok']){const _0x1d9d44=await _0x5a8d25['text']();throw new Error(_0x3d1a1a(0x1c4)+_0x5a8d25[_0x3d1a1a(0x1cf)]+'\x20'+_0x1d9d44);}const _0x13642c=await _0x5a8d25[_0x3d1a1a(0x1b6)]();return _0x13642c['memberships'];}async function refreshTokenWithOrg(_0x4163aa,_0x8b971b,_0x330249){const _0x4d79ce=_0x37b0e3,_0xe616b1={'EKqUt':'refresh_token'},_0x4ee28f=await fetch(WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x4163aa,'grant_type':_0xe616b1['EKqUt'],'refresh_token':_0x8b971b,'organization_id':_0x330249})});if(!_0x4ee28f['ok']){const _0x16f09c=await _0x4ee28f[_0x4d79ce(0x1cb)]();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x4ee28f['status']+'\x20'+_0x16f09c);}return _0x4ee28f['json']();}async function provisionCliToken(_0x5ebd5c){const _0x3c0817=_0x37b0e3,_0x163951={'sJpbu':function(_0x30aa73){return _0x30aa73();},'IlkvR':function(_0x391402,_0x31cdfd,_0x2d4b78){return _0x391402(_0x31cdfd,_0x2d4b78);}},_0x5adddd=_0x163951[_0x3c0817(0x1b7)](getApiBaseUrl),_0xe775ea=await _0x163951['IlkvR'](fetch,_0x5adddd+_0x3c0817(0x1b0),{'method':_0x3c0817(0x18c),'headers':{'Content-Type':'application/json','workos-token':_0x5ebd5c}});if(!_0xe775ea['ok']){const _0x39415e=await _0xe775ea['text']();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0xe775ea['status']+'\x20'+_0x39415e);}return _0xe775ea['json']();}function _0x3fc6(){const _0xfa8d4c=['9RKGCEL','dsHWl','slow_down','EXpvT','error','CLI\x20Key','error_description','VxYHK','363EzCudz','12299030WxWyWS','AoGed','length','3YXgpEU','3051945VBadbE','460961lyXxVu','/cli-auth/token','Using\x20organization:\x20','oxhYT','stdout','Provisioning\x20CLI\x20token...','organizationId','json','sJpbu','urn:ietf:params:oauth:grant-type:device_code','expires_in','AaJzp','JSQoZ','token','2wwajSw','3878060jCHeHE','UcQrt','QMpBD','466056BKneJa','utf-8','device_code','Failed\x20to\x20fetch\x20memberships:\x20','write','HNUYH','7FQvRLf','HvCyD','zTgHq','/organization/me','text','yWmcW','eSfGV','rxrtM','status','zFBoo','zlrAU','Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','RKYiV','verification_uri_complete','Device\x20authorization\x20timed\x20out','Failed\x20to\x20create\x20organization:\x20','filter','unref','ignore','Setting\x20up\x20your\x20organization...','now','4884294KDSdlG','POST','refresh_token','EKrIU','split','user_code','Failed\x20to\x20request\x20device\x20code:\x20','nKdSe','ojukG','stringify','1984632UYXKqI','log','https://api.workos.com/user_management/authenticate','startsWith','Authentication\x20failed','name','map','access_token','firstName','interval','GET','/organization/self-serve-signup'];_0x3fc6=function(){return _0xfa8d4c;};return _0x3fc6();}export async function runDeviceAuthFlow(){const _0x43af07=_0x37b0e3,_0x3df906={'HNUYH':function(_0xc2a8c5){return _0xc2a8c5();},'VcROk':function(_0xee4b28,_0x249602){return _0xee4b28(_0x249602);},'EXpvT':'\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','EDZcL':'\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','rxrtM':function(_0x14a05e,_0x468c3c){return _0x14a05e===_0x468c3c;},'JSQoZ':'Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','hwhVl':_0x43af07(0x181),'EKrIU':'selected','Xeztn':'Select\x20an\x20organization:'},_0x2b97d3=_0x3df906[_0x43af07(0x1c6)](getCurrentEnvironment),_0x377122=ENVIRONMENT_CONFIGS[_0x2b97d3]['workosClientId'],_0x25e889=await _0x3df906['VcROk'](requestDeviceCode,_0x377122);console[_0x43af07(0x196)](_0x3df906[_0x43af07(0x1a4)]),console['log'](_0x3df906['EDZcL']),openBrowser(_0x25e889[_0x43af07(0x183)]),console[_0x43af07(0x196)]('If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20'+_0x25e889[_0x43af07(0x183)]),console[_0x43af07(0x196)]('Code:\x20'+_0x25e889[_0x43af07(0x190)]+'\x0a'),process[_0x43af07(0x1b3)]['write']('Waiting\x20for\x20authentication...');let _0x3df2ed=await pollForTokens(_0x377122,_0x25e889[_0x43af07(0x1c3)],_0x25e889[_0x43af07(0x19e)],_0x25e889[_0x43af07(0x1b9)]);console['log']('\x20✓');const _0x23205d=_0x3df906['VcROk'](decodeJwtPayload,_0x3df2ed[_0x43af07(0x19c)]);if(!_0x23205d['org_id']){const _0x3e02fb=await fetchMyMemberships(_0x3df2ed['access_token']);let _0x5c5b24;if(_0x3df906[_0x43af07(0x1ce)](_0x3e02fb[_0x43af07(0x1ac)],0x0)){process['stdout'][_0x43af07(0x1c5)](_0x43af07(0x189));const _0x12eabf=await _0x3df906['VcROk'](selfServeSignup,_0x3df2ed['access_token']);_0x5c5b24=_0x12eabf[_0x43af07(0x1b5)],console[_0x43af07(0x196)]('\x20✓');}else{if(_0x3df906['rxrtM'](_0x3e02fb['length'],0x1))_0x5c5b24=_0x3e02fb[0x0]['organizationId'],console[_0x43af07(0x196)](_0x43af07(0x1b1)+_0x3e02fb[0x0]['name']);else{const _0x5ac2a3=process['stdin']['isTTY']&&process['stdout']['isTTY'];if(!_0x5ac2a3)throw new Error(_0x3df906[_0x43af07(0x1bb)]+_0x3df906['hwhVl']);const {selected:_0x3329db}=await _0x57a2ab['prompt']([{'type':'list','name':_0x3df906[_0x43af07(0x18e)],'message':_0x3df906['Xeztn'],'choices':_0x3e02fb[_0x43af07(0x19b)](_0x232e7c=>({'name':_0x232e7c[_0x43af07(0x19a)],'value':_0x232e7c['organizationId']}))}]);_0x5c5b24=_0x3329db;}}_0x3df2ed=await refreshTokenWithOrg(_0x377122,_0x3df2ed[_0x43af07(0x18d)],_0x5c5b24);}process['stdout'][_0x43af07(0x1c5)](_0x43af07(0x1b4));const _0x218bfd=await _0x3df906['VcROk'](provisionCliToken,_0x3df2ed['access_token']);return console['log']('\x20✓'),await storeToken(_0x218bfd['token']),_0x3df2ed['refresh_token']&&await storeRefreshToken(_0x3df2ed[_0x43af07(0x18d)]),_0x218bfd[_0x43af07(0x1bc)];}function sleep(_0x33045b){return new Promise(_0x5e6019=>setTimeout(_0x5e6019,_0x33045b));}
|
|
1
|
+
const _0x10b416=_0x59df;(function(_0x4f63b1,_0x282f4c){const _0x2addf9=_0x59df,_0x47caeb=_0x4f63b1();while(!![]){try{const _0x143b5b=parseInt(_0x2addf9(0xd1))/0x1+-parseInt(_0x2addf9(0xd8))/0x2+parseInt(_0x2addf9(0xc7))/0x3*(parseInt(_0x2addf9(0xd7))/0x4)+parseInt(_0x2addf9(0xe1))/0x5*(parseInt(_0x2addf9(0x100))/0x6)+parseInt(_0x2addf9(0xba))/0x7+-parseInt(_0x2addf9(0xe7))/0x8*(-parseInt(_0x2addf9(0xd6))/0x9)+-parseInt(_0x2addf9(0xd5))/0xa;if(_0x143b5b===_0x282f4c)break;else _0x47caeb['push'](_0x47caeb['shift']());}catch(_0x49212b){_0x47caeb['push'](_0x47caeb['shift']());}}}(_0x1155,0x26168));import{spawn}from'child_process';import _0x2cf217 from'inquirer';function _0x59df(_0x22355d,_0x16a28b){_0x22355d=_0x22355d-0xb1;const _0x115573=_0x1155();let _0x59df84=_0x115573[_0x22355d];return _0x59df84;}import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL='https://api.workos.com/user_management/authorize/device',WORKOS_TOKEN_URL=_0x10b416(0xef);export async function requestDeviceCode(_0xdc497c){const _0x84248f=_0x10b416,_0x1f72f3=await fetch(WORKOS_DEVICE_AUTH_URL,{'method':'POST','headers':{'Content-Type':_0x84248f(0xcf)},'body':new URLSearchParams({'client_id':_0xdc497c})});if(!_0x1f72f3['ok']){const _0x43b4cc=await _0x1f72f3['text']();throw new Error('Failed\x20to\x20request\x20device\x20code:\x20'+_0x1f72f3['status']+'\x20'+_0x43b4cc);}return _0x1f72f3[_0x84248f(0xb1)]();}export async function pollForTokens(_0x3c0cea,_0xeaf784,_0x2ec476,_0xd0f56d){const _0x48d5a3=_0x10b416,_0x9846fc={'RSWdw':function(_0x5c9c6d,_0x33a3b0){return _0x5c9c6d*_0x33a3b0;},'YRXub':function(_0x29beff,_0x1cefe1){return _0x29beff<_0x1cefe1;},'ngnvp':function(_0x561123,_0x3e1a2f,_0x256127){return _0x561123(_0x3e1a2f,_0x256127);},'ZcGwI':'POST','kUxbm':function(_0x4eda07,_0xd34c33){return _0x4eda07===_0xd34c33;},'pJvxe':'authorization_pending','lVTax':'slow_down'},_0x5ebde2=Date[_0x48d5a3(0xdb)]()+_0x9846fc['RSWdw'](_0xd0f56d,0x3e8);let _0x42634b=_0x9846fc['RSWdw'](_0x2ec476,0x3e8);while(_0x9846fc[_0x48d5a3(0xb6)](Date['now'](),_0x5ebde2)){await sleep(_0x42634b);const _0x5a16d6=await _0x9846fc['ngnvp'](fetch,WORKOS_TOKEN_URL,{'method':_0x9846fc['ZcGwI'],'headers':{'Content-Type':_0x48d5a3(0xcf)},'body':new URLSearchParams({'client_id':_0x3c0cea,'device_code':_0xeaf784,'grant_type':'urn:ietf:params:oauth:grant-type:device_code'})});if(_0x5a16d6['ok'])return _0x5a16d6['json']();const _0x39052c=await _0x5a16d6[_0x48d5a3(0xb1)]();if(_0x9846fc['kUxbm'](_0x39052c['error'],_0x9846fc[_0x48d5a3(0xda)]))continue;if(_0x39052c[_0x48d5a3(0xf7)]===_0x9846fc[_0x48d5a3(0xfd)]){_0x42634b+=0x3e8;continue;}throw new Error(_0x39052c[_0x48d5a3(0xd2)]||_0x39052c[_0x48d5a3(0xf7)]||_0x48d5a3(0xfa));}throw new Error(_0x48d5a3(0xce));}async function fetchUserProfile(_0x3eef5d){const _0x1853f8=_0x10b416,_0x24bb2d={'MPhRu':_0x1853f8(0xd9)},_0x4b2d9e=getApiBaseUrl();try{const _0x298a02=await fetch(_0x4b2d9e+_0x1853f8(0xc5),{'method':_0x24bb2d[_0x1853f8(0xe0)],'headers':{'workos-token':_0x3eef5d}});if(_0x298a02['ok'])return _0x298a02['json']();}catch{}return null;}function buildKeyName(_0x47ff19,_0x145d54){const _0x58e17d=_0x10b416,_0x53c785={'UGKvk':function(_0xb5063a,_0x190506){return _0xb5063a===_0x190506;},'FAbNg':function(_0x3670b3,_0x41ccf9){return _0x3670b3+_0x41ccf9;}},_0x5b8cf6=_0x145d54[_0x58e17d(0xb4)](_0x22600f=>_0x22600f['name']===_0x47ff19||_0x22600f['name'][_0x58e17d(0xfe)](_0x47ff19+'\x20('));if(_0x53c785['UGKvk'](_0x5b8cf6['length'],0x0))return _0x47ff19;return _0x47ff19+'\x20('+_0x53c785[_0x58e17d(0xeb)](_0x5b8cf6['length'],0x1)+')';}export async function provisionApiKey(_0x30c60b){const _0x285d4b=_0x10b416,_0x21439e={'ImtCt':function(_0x31232e){return _0x31232e();},'OLkpl':function(_0x218ea0,_0x2c9460){return _0x218ea0(_0x2c9460);},'WJxsI':'CLI\x20Key','oVoFF':function(_0x223b1d,_0x1463ab,_0x76f927){return _0x223b1d(_0x1463ab,_0x76f927);},'Nwzrn':function(_0x8b5173,_0x44b483,_0x427e1d){return _0x8b5173(_0x44b483,_0x427e1d);},'fRVUz':'POST'},_0x199d03=_0x21439e['ImtCt'](getApiBaseUrl),_0x492b88={'Content-Type':_0x285d4b(0xb5),'workos-token':_0x30c60b},_0x25d0b1=await _0x21439e['OLkpl'](fetchUserProfile,_0x30c60b),_0x4930a3=_0x25d0b1?.[_0x285d4b(0xc8)]||_0x25d0b1?.[_0x285d4b(0xb9)]?.['split']('@')[0x0],_0x496a17=_0x4930a3?_0x4930a3+_0x285d4b(0xfb):_0x21439e['WJxsI'];let _0x4fd484=[];try{const _0x1c8d4a=await _0x21439e[_0x285d4b(0xe2)](fetch,_0x199d03+'/api-keys',{'method':_0x285d4b(0xd9),'headers':_0x492b88});if(_0x1c8d4a['ok']){const _0x38bf48=await _0x1c8d4a['json']();_0x4fd484=_0x38bf48[_0x285d4b(0xf2)];}}catch{}const _0x318250=_0x21439e['Nwzrn'](buildKeyName,_0x496a17,_0x4fd484),_0x52a846=await fetch(_0x199d03+_0x285d4b(0xca),{'method':_0x21439e['fRVUz'],'headers':_0x492b88,'body':JSON[_0x285d4b(0xc4)]({'name':_0x318250,'scope':'mcp:write'})});if(!_0x52a846['ok']){const _0x2e5358=await _0x52a846[_0x285d4b(0xb2)]();throw new Error(_0x285d4b(0xbd)+_0x52a846[_0x285d4b(0xc3)]+'\x20'+_0x2e5358);}const _0x4c096f=await _0x52a846[_0x285d4b(0xb1)]();return _0x4c096f[_0x285d4b(0x101)]['token'];}export function openBrowser(_0x2ccb76){const _0x560b92=_0x10b416,_0x1782ef={'oRKHY':'win32','tcCiZ':'ignore','LbTrp':function(_0x2ad1a5,_0x52ba0){return _0x2ad1a5===_0x52ba0;},'dLvsh':'open','gQGHb':_0x560b92(0xfc)};try{if(process['platform']===_0x1782ef['oRKHY']){const _0x591c3c=spawn(_0x560b92(0xd0),['/c',_0x560b92(0xdc),'',_0x2ccb76],{'detached':!![],'stdio':_0x1782ef[_0x560b92(0xdf)],'windowsHide':!![]});_0x591c3c[_0x560b92(0xed)]();return;}const _0x241ff7=_0x1782ef[_0x560b92(0xc9)](process[_0x560b92(0xbc)],'darwin')?_0x1782ef['dLvsh']:_0x1782ef[_0x560b92(0xb3)],_0x11f76c=spawn(_0x241ff7,[_0x2ccb76],{'detached':!![],'stdio':_0x560b92(0x105)});_0x11f76c['unref']();}catch{}}function decodeJwtPayload(_0x2c21a6){const _0x54d9e1=_0x10b416,_0x510bc5={'EFKul':function(_0x407eae,_0x385ba6){return _0x407eae!==_0x385ba6;},'uFzxm':_0x54d9e1(0x102)},_0x492ebf=_0x2c21a6[_0x54d9e1(0xea)]('.');if(_0x510bc5[_0x54d9e1(0xe8)](_0x492ebf['length'],0x3))throw new Error(_0x54d9e1(0xf0));const _0xc3b131=Buffer[_0x54d9e1(0xde)](_0x492ebf[0x1],_0x54d9e1(0xcb))['toString'](_0x510bc5[_0x54d9e1(0xf3)]);return JSON['parse'](_0xc3b131);}async function selfServeSignup(_0x17ea4a){const _0x1badd4=_0x10b416,_0x123aa8={'kvGej':function(_0x1c7254){return _0x1c7254();},'oWZVg':'application/json'},_0x5bdbfa=_0x123aa8[_0x1badd4(0xf5)](getApiBaseUrl),_0x13665c=await fetch(_0x5bdbfa+'/organization/self-serve-signup',{'method':_0x1badd4(0xd4),'headers':{'Content-Type':_0x123aa8[_0x1badd4(0xbf)],'workos-token':_0x17ea4a}});if(!_0x13665c['ok']){const _0x19d65f=await _0x13665c['text']();throw new Error('Failed\x20to\x20create\x20organization:\x20'+_0x13665c[_0x1badd4(0xc3)]+'\x20'+_0x19d65f);}return _0x13665c[_0x1badd4(0xb1)]();}async function fetchMyMemberships(_0x23eb2e){const _0x54764a=_0x10b416,_0x516488={'ArOtq':function(_0x2d1c6a,_0x384214,_0x5d5e53){return _0x2d1c6a(_0x384214,_0x5d5e53);}},_0x127a5c=getApiBaseUrl(),_0x3dfaf9=await _0x516488[_0x54764a(0xff)](fetch,_0x127a5c+'/organization/my-memberships',{'method':_0x54764a(0xd9),'headers':{'workos-token':_0x23eb2e}});if(!_0x3dfaf9['ok']){const _0x192cea=await _0x3dfaf9[_0x54764a(0xb2)]();throw new Error('Failed\x20to\x20fetch\x20memberships:\x20'+_0x3dfaf9[_0x54764a(0xc3)]+'\x20'+_0x192cea);}const _0x248c87=await _0x3dfaf9[_0x54764a(0xb1)]();return _0x248c87['memberships'];}function _0x1155(){const _0x316f7b=['YWhLY','408ZQlOKD','EFKul','organizationId','split','FAbNg','Using\x20organization:\x20','unref','map','https://api.workos.com/user_management/authenticate','Invalid\x20JWT\x20format','wmxeQ','apiKeys','uFzxm','workosClientId','kvGej','Waiting\x20for\x20authentication...','error','Failed\x20to\x20provision\x20CLI\x20token:\x20','length','Authentication\x20failed','\x27s\x20CLI\x20Key','xdg-open','lVTax','startsWith','ArOtq','17778dlOOTk','apiKey','utf-8','Setting\x20up\x20your\x20organization...','expires_in','ignore','json','text','gQGHb','filter','application/json','YRXub','Failed\x20to\x20refresh\x20token\x20with\x20org:\x20','access_token','email','2063460aJPrHp','user_code','platform','Failed\x20to\x20provision\x20API\x20key:\x20','ImzTq','oWZVg','dhQYS','yhqFX','interval','status','stringify','/organization/me','device_code','29217ZVeDND','firstName','LbTrp','/api-keys','base64url','paDAU','token','Device\x20authorization\x20timed\x20out','application/x-www-form-urlencoded','cmd','75087rmeRpo','error_description','log','POST','1479160PRJfBU','15003NeuEKp','20KRCwBi','464496UurvKw','GET','pJvxe','now','start','pnTZH','from','tcCiZ','MPhRu','55OhKctE','oVoFF','isTTY','stdout','name'];_0x1155=function(){return _0x316f7b;};return _0x1155();}async function refreshTokenWithOrg(_0x4188b9,_0x1cfe1c,_0x2dd398){const _0x1f66a0=_0x10b416,_0x262883={'kYdMc':function(_0x4c9fcf,_0x482fbb,_0x238cd3){return _0x4c9fcf(_0x482fbb,_0x238cd3);},'VBgna':_0x1f66a0(0xd4)},_0x360339=await _0x262883['kYdMc'](fetch,WORKOS_TOKEN_URL,{'method':_0x262883['VBgna'],'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x4188b9,'grant_type':'refresh_token','refresh_token':_0x1cfe1c,'organization_id':_0x2dd398})});if(!_0x360339['ok']){const _0x54a079=await _0x360339[_0x1f66a0(0xb2)]();throw new Error(_0x1f66a0(0xb7)+_0x360339[_0x1f66a0(0xc3)]+'\x20'+_0x54a079);}return _0x360339[_0x1f66a0(0xb1)]();}async function provisionCliToken(_0x266ca1){const _0x52e7d1=_0x10b416,_0x2e232d={'XAxym':function(_0x50da62){return _0x50da62();},'yQjER':function(_0x2c8ffe,_0x43b58e,_0x1b9dda){return _0x2c8ffe(_0x43b58e,_0x1b9dda);},'DeIQX':_0x52e7d1(0xd4)},_0x4120d5=_0x2e232d['XAxym'](getApiBaseUrl),_0x29a3c4=await _0x2e232d['yQjER'](fetch,_0x4120d5+'/cli-auth/token',{'method':_0x2e232d['DeIQX'],'headers':{'Content-Type':'application/json','workos-token':_0x266ca1}});if(!_0x29a3c4['ok']){const _0x4fba81=await _0x29a3c4[_0x52e7d1(0xb2)]();throw new Error(_0x52e7d1(0xf8)+_0x29a3c4[_0x52e7d1(0xc3)]+'\x20'+_0x4fba81);}return _0x29a3c4[_0x52e7d1(0xb1)]();}export async function runDeviceAuthFlow(){const _0xd9f213=_0x10b416,_0x428e9f={'paDAU':function(_0x2d6e34,_0x36b97a){return _0x2d6e34(_0x36b97a);},'YWhLY':function(_0x3d5880,_0x1b2978,_0x2fe30c,_0x3438a1,_0x1ac186){return _0x3d5880(_0x1b2978,_0x2fe30c,_0x3438a1,_0x1ac186);},'mAitc':_0xd9f213(0x103),'yhqFX':function(_0x591683,_0x38e43a){return _0x591683===_0x38e43a;},'wmxeQ':function(_0x5d9aed,_0x5d59e1){return _0x5d9aed+_0x5d59e1;},'dhQYS':'Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','QXGyi':'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','KtsAj':'selected','ImzTq':'Select\x20an\x20organization:','dwnuB':'Provisioning\x20CLI\x20token...','pnTZH':function(_0x269ce6,_0x2698a6){return _0x269ce6(_0x2698a6);}},_0x1f3c46=getCurrentEnvironment(),_0x512c21=ENVIRONMENT_CONFIGS[_0x1f3c46][_0xd9f213(0xf4)],_0x288dfc=await _0x428e9f[_0xd9f213(0xcc)](requestDeviceCode,_0x512c21);console[_0xd9f213(0xd3)]('\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...'),console[_0xd9f213(0xd3)]('\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a'),openBrowser(_0x288dfc['verification_uri_complete']),console[_0xd9f213(0xd3)]('If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20'+_0x288dfc['verification_uri_complete']),console['log']('Code:\x20'+_0x288dfc[_0xd9f213(0xbb)]+'\x0a'),process['stdout']['write'](_0xd9f213(0xf6));let _0x1b85b8=await _0x428e9f[_0xd9f213(0xe6)](pollForTokens,_0x512c21,_0x288dfc[_0xd9f213(0xc6)],_0x288dfc[_0xd9f213(0xc2)],_0x288dfc[_0xd9f213(0x104)]);console[_0xd9f213(0xd3)]('\x20✓');const _0xfce92e=decodeJwtPayload(_0x1b85b8[_0xd9f213(0xb8)]);if(!_0xfce92e['org_id']){const _0x3963f6=await _0x428e9f[_0xd9f213(0xcc)](fetchMyMemberships,_0x1b85b8['access_token']);let _0x332100;if(_0x3963f6[_0xd9f213(0xf9)]===0x0){process[_0xd9f213(0xe4)]['write'](_0x428e9f['mAitc']);const _0x3f87aa=await _0x428e9f['paDAU'](selfServeSignup,_0x1b85b8[_0xd9f213(0xb8)]);_0x332100=_0x3f87aa['organizationId'],console['log']('\x20✓');}else{if(_0x428e9f[_0xd9f213(0xc1)](_0x3963f6['length'],0x1))_0x332100=_0x3963f6[0x0][_0xd9f213(0xe9)],console['log'](_0xd9f213(0xec)+_0x3963f6[0x0][_0xd9f213(0xe5)]);else{const _0x203d04=process['stdin'][_0xd9f213(0xe3)]&&process[_0xd9f213(0xe4)]['isTTY'];if(!_0x203d04)throw new Error(_0x428e9f[_0xd9f213(0xf1)](_0x428e9f[_0xd9f213(0xc0)],_0x428e9f['QXGyi']));const {selected:_0x289df9}=await _0x2cf217['prompt']([{'type':'list','name':_0x428e9f['KtsAj'],'message':_0x428e9f[_0xd9f213(0xbe)],'choices':_0x3963f6[_0xd9f213(0xee)](_0x2ca845=>({'name':_0x2ca845[_0xd9f213(0xe5)],'value':_0x2ca845[_0xd9f213(0xe9)]}))}]);_0x332100=_0x289df9;}}_0x1b85b8=await refreshTokenWithOrg(_0x512c21,_0x1b85b8['refresh_token'],_0x332100);}process['stdout']['write'](_0x428e9f['dwnuB']);const _0x43b110=await _0x428e9f[_0xd9f213(0xdd)](provisionCliToken,_0x1b85b8[_0xd9f213(0xb8)]);return console[_0xd9f213(0xd3)]('\x20✓'),await _0x428e9f['pnTZH'](storeToken,_0x43b110[_0xd9f213(0xcd)]),_0x1b85b8['refresh_token']&&await storeRefreshToken(_0x1b85b8['refresh_token']),_0x43b110[_0xd9f213(0xcd)];}function sleep(_0x58b2d0){return new Promise(_0x5abdd7=>setTimeout(_0x5abdd7,_0x58b2d0));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function _0x2dde(){const _0x355054=['gQNSH','\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.','RANGER_CLI_ENV','trim','client_01J9CBYM2DKWV9HM17D95Z540K','[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22','8275850xFZGGE','xyOTs','https://mcp-auth.staging.ranger.net/mcp','RANGER_USE_NOVA_ACT','env','DMqxr','449486ACHqup','https://ai-proxy-716115358910.us-central1.run.app','error','6956739AoZXpB','\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.','4125yGoAld','712pSmnuq','playwright-cli','mrHml','1066544aivOgL','https://mcp-auth.ranger.net/mcp','RANGER_DISABLE_MCP','find','Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.','VJiHv','staging','RiUbs','778602GIEjhQ','65amPKTC','RANGER_TRANSPORT','toLowerCase','apiBaseUrl','mcp','aiProxyUrl','1NDUMlK','rangerwright-cli','Zzsnd','LTnmD','XafOd','RANGER_MCP_AUTH_URL','2895025ybDRrk','HqlyR','client_01J9CBYM7M5ZETCF7G6614DXR2','prod'];_0x2dde=function(){return _0x355054;};return _0x2dde();}const _0x3f46c7=_0x26af;(function(_0x284018,_0x25a249){const _0x1ed21a=_0x26af,_0x29d2c1=_0x284018();while(!![]){try{const _0x19413f=-parseInt(_0x1ed21a(0x147))/0x1*(parseInt(_0x1ed21a(0x15d))/0x2)+parseInt(_0x1ed21a(0x134))/0x3*(-parseInt(_0x1ed21a(0x135))/0x4)+-parseInt(_0x1ed21a(0x141))/0x5*(-parseInt(_0x1ed21a(0x140))/0x6)+-parseInt(_0x1ed21a(0x14d))/0x7+parseInt(_0x1ed21a(0x138))/0x8+parseInt(_0x1ed21a(0x132))/0x9+-parseInt(_0x1ed21a(0x157))/0xa;if(_0x19413f===_0x25a249)break;else _0x29d2c1['push'](_0x29d2c1['shift']());}catch(_0x17b3fb){_0x29d2c1['push'](_0x29d2c1['shift']());}}}(_0x2dde,0xd77af));export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':'https://api.ranger.net','workosClientId':_0x3f46c7(0x14f),'aiProxyUrl':_0x3f46c7(0x15e),'mcpAuthUrl':_0x3f46c7(0x139)},'staging':{'apiBaseUrl':'https://api.staging.ranger.net','workosClientId':_0x3f46c7(0x155),'aiProxyUrl':'https://ai-proxy-301751771437.us-central1.run.app','mcpAuthUrl':_0x3f46c7(0x159)},'local':{'apiBaseUrl':'http://localhost:8080','workosClientId':'client_01J9CBYM2DKWV9HM17D95Z540K','aiProxyUrl':'http://localhost:8090','mcpAuthUrl':'http://localhost:8080/mcp'}};export const DEFAULT_ENVIRONMENT='prod';export function isValidEnvironment(_0x4e9f75){const _0x5b29f7=_0x3f46c7,_0x53e542={'VJiHv':function(_0x902b23,_0x3740aa){return _0x902b23===_0x3740aa;},'HqlyR':function(_0x4b3cf7,_0x37af88){return _0x4b3cf7===_0x37af88;},'rQaAq':_0x5b29f7(0x13e),'XNlvJ':'local'};return _0x53e542[_0x5b29f7(0x13d)](_0x4e9f75,_0x5b29f7(0x150))||_0x53e542[_0x5b29f7(0x14e)](_0x4e9f75,_0x53e542['rQaAq'])||_0x4e9f75===_0x53e542['XNlvJ'];}export function getCurrentEnvironment(){const _0x4740fc=_0x3f46c7,_0x1466be=process[_0x4740fc(0x15b)][_0x4740fc(0x153)];if(_0x1466be&&isValidEnvironment(_0x1466be))return _0x1466be;return DEFAULT_ENVIRONMENT;}function _0x26af(_0x2f379c,_0x50bdf0){_0x2f379c=_0x2f379c-0x132;const _0x2dde98=_0x2dde();let _0x26af58=_0x2dde98[_0x2f379c];return _0x26af58;}export function getApiBaseUrl(){const _0x4e905e=_0x3f46c7;return ENVIRONMENT_CONFIGS[getCurrentEnvironment()][_0x4e905e(0x144)];}export function getAiProxyUrl(){const _0xa13128=_0x3f46c7,_0x370248={'YcsIg':function(_0x16fcde){return _0x16fcde();}};return ENVIRONMENT_CONFIGS[_0x370248['YcsIg'](getCurrentEnvironment)][_0xa13128(0x146)];}export function getMcpAuthUrl(){const _0x113c29=_0x3f46c7,_0x571cb9={'Zzsnd':function(_0x1701d3){return _0x1701d3();}};return process['env'][_0x113c29(0x14c)]??ENVIRONMENT_CONFIGS[_0x571cb9[_0x113c29(0x149)](getCurrentEnvironment)]['mcpAuthUrl'];}export function isByokEnabled(){const _0x44a3c1=_0x3f46c7,_0x201248={'RiUbs':function(_0x13a0e0,_0x4f52f3){return _0x13a0e0===_0x4f52f3;},'hnvez':'true'};return _0x201248[_0x44a3c1(0x13f)](process['env']['RANGER_BYOK'],_0x201248['hnvez']);}function isVerificationTransport(_0x1ef6c2){const _0x3bbf59=_0x3f46c7,_0x15db03={'XafOd':function(_0x563f06,_0x3919be){return _0x563f06===_0x3919be;},'xyOTs':_0x3bbf59(0x136),'DMqxr':function(_0x2c9216,_0x14ace2){return _0x2c9216===_0x14ace2;},'LTnmD':'nova-act-cli'};return _0x15db03[_0x3bbf59(0x14b)](_0x1ef6c2,'mcp')||_0x1ef6c2===_0x15db03[_0x3bbf59(0x158)]||_0x15db03[_0x3bbf59(0x15c)](_0x1ef6c2,_0x15db03[_0x3bbf59(0x14a)])||_0x1ef6c2===_0x3bbf59(0x148);}const LEGACY_TRANSPORT_ENV_VARS=[_0x3f46c7(0x15a),_0x3f46c7(0x13a)];export function getVerificationTransport(){const _0x469a9b=_0x3f46c7,_0x486344={'mrHml':function(_0x4aa6e0,_0x54ee98){return _0x4aa6e0(_0x54ee98);}},_0x4376be=process['env'][_0x469a9b(0x142)]?.[_0x469a9b(0x154)]();if(_0x4376be){if(_0x486344[_0x469a9b(0x137)](isVerificationTransport,_0x4376be))return _0x4376be;throw new Error('Invalid\x20RANGER_TRANSPORT=\x22'+_0x4376be+_0x469a9b(0x133));}const _0x13ea0e=LEGACY_TRANSPORT_ENV_VARS[_0x469a9b(0x13b)](_0x93b618=>process[_0x469a9b(0x15b)][_0x93b618]);if(_0x13ea0e)throw new Error(_0x13ea0e+_0x469a9b(0x152));return _0x469a9b(0x145);}export function resolveHookMode(_0x453946=process['env']){const _0x466ebb=_0x3f46c7,_0x48c474={'gQNSH':'auto'},_0x2c8238=_0x453946['RANGER_HOOKS']?.['trim']()[_0x466ebb(0x143)]();if(!_0x2c8238)return'auto';if(_0x2c8238==='off'||_0x2c8238==='on'||_0x2c8238===_0x48c474[_0x466ebb(0x151)])return _0x2c8238;return console[_0x466ebb(0x15f)](_0x466ebb(0x156)+_0x453946['RANGER_HOOKS']+'\x22.\x20'+_0x466ebb(0x13c)),_0x48c474[_0x466ebb(0x151)];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x2c6006,_0x46afac){const _0x3f4c03=_0x4fb1,_0xe24554=_0x2c6006();while(!![]){try{const _0x341408=-parseInt(_0x3f4c03(0x134))/0x1*(-parseInt(_0x3f4c03(0x168))/0x2)+-parseInt(_0x3f4c03(0x172))/0x3+parseInt(_0x3f4c03(0x163))/0x4+-parseInt(_0x3f4c03(0x138))/0x5*(-parseInt(_0x3f4c03(0x16b))/0x6)+parseInt(_0x3f4c03(0x15a))/0x7+parseInt(_0x3f4c03(0x160))/0x8+parseInt(_0x3f4c03(0x153))/0x9*(parseInt(_0x3f4c03(0x144))/0xa);if(_0x341408===_0x46afac)break;else _0xe24554['push'](_0xe24554['shift']());}catch(_0x270333){_0xe24554['push'](_0xe24554['shift']());}}}(_0xf96b,0x93699));import{getToken}from'./keychain.js';function _0x4fb1(_0x1b62ff,_0x4c95e2){_0x1b62ff=_0x1b62ff-0x131;const _0xf96b10=_0xf96b();let _0x4fb131=_0xf96b10[_0x1b62ff];return _0x4fb131;}import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x1f2dc3){const _0x4f527a=_0x4fb1,_0x30656d={'suzRP':function(_0x1252b4){return _0x1252b4();},'ulQgo':function(_0x264be7,_0x53c043,_0x59c5c8){return _0x264be7(_0x53c043,_0x59c5c8);},'fMDGk':function(_0xe3ac56,_0x3afcc9){return _0xe3ac56===_0x3afcc9;}},_0xaf034b=await _0x30656d[_0x4f527a(0x164)](getToken);if(!_0xaf034b)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x42b5c5=_0x30656d[_0x4f527a(0x164)](getApiBaseUrl),_0x229552=await _0x30656d['ulQgo'](fetch,_0x42b5c5+_0x4f527a(0x141),{'method':_0x4f527a(0x133),'headers':{'Authorization':_0x4f527a(0x167)+_0xaf034b,'Content-Type':'application/json'},'body':JSON[_0x4f527a(0x17c)](_0x1f2dc3)});if(!_0x229552['ok']){if(_0x30656d['fMDGk'](_0x229552[_0x4f527a(0x16e)],0x192)){const _0x422c88=await _0x229552['json'](),_0x34eaac=_0x422c88[_0x4f527a(0x169)]||'https://dashboard.ranger.net/billing';throw new Error((_0x422c88['message']||_0x4f527a(0x17b))+_0x4f527a(0x161)+_0x34eaac);}const _0x2a3a32=await _0x229552['text']();throw new Error(_0x4f527a(0x174)+_0x2a3a32);}return _0x229552[_0x4f527a(0x135)]();}export async function listFeatures(_0x1ccc48){const _0x5ede73=_0x4fb1,_0x526424={'TBnNj':_0x5ede73(0x14d),'BQfDY':function(_0xa45e14){return _0xa45e14();},'pFAvo':'gitRepoUrl','UJzOC':'gitBranch','dSvbU':'limit','oUsJD':'offset','WHQkv':_0x5ede73(0x15f),'TzrHD':_0x5ede73(0x14a)},_0x149742=await getToken();if(!_0x149742)throw new Error(_0x526424['TBnNj']);const _0x9c2942=_0x526424['BQfDY'](getApiBaseUrl),_0x1b8393=new URLSearchParams();if(_0x1ccc48?.[_0x5ede73(0x171)])_0x1b8393[_0x5ede73(0x178)](_0x526424['pFAvo'],_0x1ccc48[_0x5ede73(0x171)]);if(_0x1ccc48?.[_0x5ede73(0x173)])_0x1b8393[_0x5ede73(0x178)](_0x526424['UJzOC'],_0x1ccc48[_0x5ede73(0x173)]);if(_0x1ccc48?.[_0x5ede73(0x150)])_0x1b8393[_0x5ede73(0x178)](_0x526424['dSvbU'],_0x1ccc48[_0x5ede73(0x150)]['toString']());if(_0x1ccc48?.[_0x5ede73(0x157)])_0x1b8393[_0x5ede73(0x178)](_0x526424['oUsJD'],_0x1ccc48[_0x5ede73(0x157)][_0x5ede73(0x13d)]());if(_0x1ccc48?.[_0x5ede73(0x15f)])_0x1b8393[_0x5ede73(0x178)](_0x526424[_0x5ede73(0x13f)],_0x526424[_0x5ede73(0x166)]);const _0x295344=_0x9c2942+'/api/v1/mcp/features'+(_0x1b8393[_0x5ede73(0x13d)]()?'?'+_0x1b8393['toString']():''),_0x22fbfd=await fetch(_0x295344,{'method':_0x5ede73(0x170),'headers':{'Authorization':_0x5ede73(0x167)+_0x149742}});if(!_0x22fbfd['ok']){const _0xf17fde=await _0x22fbfd[_0x5ede73(0x13e)]();throw new Error(_0x5ede73(0x140)+_0xf17fde);}return _0x22fbfd['json']();}export async function getFeature(_0x29e4bf){const _0x3e3f98=_0x4fb1,_0x2bc1e4={'lophn':function(_0x38b165){return _0x38b165();},'syZbu':_0x3e3f98(0x14d),'Sjbll':'GET'},_0x339705=await _0x2bc1e4[_0x3e3f98(0x145)](getToken);if(!_0x339705)throw new Error(_0x2bc1e4[_0x3e3f98(0x179)]);const _0x38df11=getApiBaseUrl(),_0x2e92df=await fetch(_0x38df11+_0x3e3f98(0x14c)+_0x29e4bf,{'method':_0x2bc1e4[_0x3e3f98(0x151)],'headers':{'Authorization':'Bearer\x20'+_0x339705}});if(!_0x2e92df['ok']){const _0x4f9563=await _0x2e92df['text']();throw new Error(_0x3e3f98(0x152)+_0x4f9563);}return _0x2e92df[_0x3e3f98(0x135)]();}export async function updateFeature(_0x21ebb0,_0x3c7166){const _0x1f0cee=_0x4fb1,_0x1203ff={'uovla':function(_0x3f4b88){return _0x3f4b88();},'Fblcd':_0x1f0cee(0x14d),'OPxnl':_0x1f0cee(0x154)},_0x2e0461=await _0x1203ff[_0x1f0cee(0x16d)](getToken);if(!_0x2e0461)throw new Error(_0x1203ff[_0x1f0cee(0x175)]);const _0x38ca97=getApiBaseUrl(),_0x62308=await fetch(_0x38ca97+_0x1f0cee(0x14c)+_0x21ebb0,{'method':_0x1203ff['OPxnl'],'headers':{'Authorization':_0x1f0cee(0x167)+_0x2e0461,'Content-Type':'application/json'},'body':JSON[_0x1f0cee(0x17c)](_0x3c7166)});if(!_0x62308['ok']){const _0x3a46f3=await _0x62308[_0x1f0cee(0x13e)]();throw new Error(_0x1f0cee(0x143)+_0x3a46f3);}return _0x62308[_0x1f0cee(0x135)]();}export async function createChecklistItem(_0x54eb00,_0xfe60f4,_0x34e8a0){const _0x1fe635=_0x4fb1,_0x279764={'VRloW':_0x1fe635(0x14d),'rSBHL':function(_0x4cbc77){return _0x4cbc77();},'MJuis':function(_0x482ef3,_0x50dac4,_0x2a1674){return _0x482ef3(_0x50dac4,_0x2a1674);},'cuoeH':'application/json'},_0x34583f=await getToken();if(!_0x34583f)throw new Error(_0x279764[_0x1fe635(0x146)]);const _0x4b2590=_0x279764[_0x1fe635(0x148)](getApiBaseUrl),_0x1a0608=await _0x279764[_0x1fe635(0x13b)](fetch,_0x4b2590+_0x1fe635(0x14c)+_0x54eb00+'/checklist',{'method':'POST','headers':{'Authorization':_0x1fe635(0x167)+_0x34583f,'Content-Type':_0x279764['cuoeH']},'body':JSON['stringify']({'description':_0xfe60f4,'position':_0x34e8a0})});if(!_0x1a0608['ok']){const _0x40713a=await _0x1a0608[_0x1fe635(0x13e)]();throw new Error(_0x1fe635(0x155)+_0x40713a);}return _0x1a0608['json']();}function _0xf96b(){const _0x549c63=['GET','gitRepoUrl','2623146gjYwOb','gitBranch','Failed\x20to\x20create\x20feature\x20review:\x20','Fblcd','qnzMf','syeqb','set','syZbu','kAUtE','Feature\x20limit\x20exceeded','stringify','Failed\x20to\x20delete\x20feature\x20review:\x20','oJBfo','iuzpK','POST','1234WlOCzL','json','QNefO','OWetC','10ztzDUh','/sessions','EpBYQ','MJuis','sessionId','toString','text','WHQkv','Failed\x20to\x20list\x20feature\x20reviews:\x20','/api/v1/mcp/features','WqRTT','Failed\x20to\x20update\x20feature\x20review:\x20','10rfgswN','lophn','VRloW','RVUQO','rSBHL','style','true','PmXcJ','/api/v1/mcp/features/','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','MaUdl','Failed\x20to\x20conclude\x20session:\x20','limit','Sjbll','Failed\x20to\x20get\x20feature\x20review:\x20','3091167qEAuoM','PATCH','Failed\x20to\x20create\x20scenario:\x20','/report','offset','seoCJ','/action-items','4151756EKnPYz','updateChecklistItem','vSQCw','/sessions/','KjjMf','includeDeleted','58160UIUFqy','\x0a\x0aUpgrade\x20your\x20plan:\x20','itemIds','1708104yfRhUs','suzRP','length','TzrHD','Bearer\x20','32vSSTRR','billingUrl','/report/markdown','262716wcxmZv','/checklist-items/','uovla','status','ImLIO'];_0xf96b=function(){return _0x549c63;};return _0xf96b();}export async function updateChecklistItem(_0x2bd583,_0x2f3a51,_0x30ce36){const _0x3fe058=_0x4fb1,_0x855bdc={'EpBYQ':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','MpVwv':function(_0x1931bb){return _0x1931bb();},'qnzMf':'application/json','thqLd':function(_0x1062f9,_0x5518ce,_0x4ea990){return _0x1062f9(_0x5518ce,_0x4ea990);}};return _0x855bdc['thqLd'](withRetry,async()=>{const _0x1d9097=_0x4fb1,_0x4e179a=await getToken();if(!_0x4e179a)throw new Error(_0x855bdc[_0x1d9097(0x13a)]);const _0x1da62f=_0x855bdc['MpVwv'](getApiBaseUrl),_0x4562a8=await fetch(_0x1da62f+'/api/v1/mcp/features/'+_0x2bd583+'/checklist/'+_0x2f3a51,{'method':'PATCH','headers':{'Authorization':_0x1d9097(0x167)+_0x4e179a,'Content-Type':_0x855bdc[_0x1d9097(0x176)]},'body':JSON[_0x1d9097(0x17c)](_0x30ce36)});if(!_0x4562a8['ok']){const _0x241b54=await _0x4562a8[_0x1d9097(0x13e)]();throw new Error('Failed\x20to\x20update\x20scenario:\x20'+_0x241b54);}return _0x4562a8['json']();},{'label':_0x3fe058(0x15b)});}export async function getFeatureReport(_0x1f4c2){const _0x308bd2=_0x4fb1,_0x49b97f={'WqRTT':function(_0xf89aee){return _0xf89aee();}},_0x670ac8=await _0x49b97f[_0x308bd2(0x142)](getToken);if(!_0x670ac8)throw new Error(_0x308bd2(0x14d));const _0x4855ee=getApiBaseUrl(),_0x4b65e1=await fetch(_0x4855ee+_0x308bd2(0x14c)+_0x1f4c2+_0x308bd2(0x156),{'method':_0x308bd2(0x170),'headers':{'Authorization':_0x308bd2(0x167)+_0x670ac8}});if(!_0x4b65e1['ok']){const _0xe473c1=await _0x4b65e1['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0xe473c1);}return _0x4b65e1[_0x308bd2(0x135)]();}export async function getFeatureReportMarkdown(_0x2f488f,_0x3c3a76){const _0x2008c5=_0x4fb1,_0x442741={'seoCJ':function(_0x5d5e07){return _0x5d5e07();},'OWetC':'sessionId','oJBfo':function(_0x2410f0,_0x5519fb){return _0x2410f0&&_0x5519fb;}},_0x4890c0=await getToken();if(!_0x4890c0)throw new Error(_0x2008c5(0x14d));const _0x407fdf=_0x442741[_0x2008c5(0x158)](getApiBaseUrl),_0xcfd340=new URLSearchParams(),_0x37af6c=(_0x3c3a76?.['itemIds']?.[_0x2008c5(0x165)]??0x0)>0x0,_0x265c18=Boolean(_0x3c3a76?.['sessionId']);_0x37af6c&&_0x3c3a76?.['itemIds']&&_0xcfd340[_0x2008c5(0x178)](_0x2008c5(0x162),_0x3c3a76[_0x2008c5(0x162)]['join'](','));_0x265c18&&_0x3c3a76?.[_0x2008c5(0x13c)]&&_0xcfd340[_0x2008c5(0x178)](_0x442741[_0x2008c5(0x137)],_0x3c3a76['sessionId']);_0x442741[_0x2008c5(0x131)](!_0x37af6c,!_0x265c18)&&_0x3c3a76?.['style']&&_0xcfd340[_0x2008c5(0x178)](_0x2008c5(0x149),_0x3c3a76[_0x2008c5(0x149)]);const _0x347998=_0x407fdf+'/api/v1/mcp/features/'+_0x2f488f+_0x2008c5(0x16a),_0x40e915=''+_0x347998+(_0xcfd340[_0x2008c5(0x13d)]()?'?'+_0xcfd340['toString']():''),_0x280aab=await fetch(_0x40e915,{'method':_0x2008c5(0x170),'headers':{'Authorization':'Bearer\x20'+_0x4890c0}});if(!_0x280aab['ok']){const _0xad6ebd=await _0x280aab[_0x2008c5(0x13e)]();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20'+_0xad6ebd);}return _0x280aab['text']();}export async function listFeatureSessions(_0x2cf825){const _0x20e4fa=_0x4fb1,_0x574cfc={'MaUdl':function(_0x292299){return _0x292299();},'KjjMf':function(_0x1c0e09){return _0x1c0e09();},'PWWjt':function(_0x56224c,_0x5e085c,_0xdf18ba){return _0x56224c(_0x5e085c,_0xdf18ba);},'kOYXz':_0x20e4fa(0x170)},_0x235949=await _0x574cfc[_0x20e4fa(0x14e)](getToken);if(!_0x235949)throw new Error(_0x20e4fa(0x14d));const _0xa644dd=_0x574cfc[_0x20e4fa(0x15e)](getApiBaseUrl),_0x4c10ae=await _0x574cfc['PWWjt'](fetch,_0xa644dd+_0x20e4fa(0x14c)+_0x2cf825+_0x20e4fa(0x139),{'method':_0x574cfc['kOYXz'],'headers':{'Authorization':_0x20e4fa(0x167)+_0x235949}});if(!_0x4c10ae['ok']){const _0x1ae6a1=await _0x4c10ae[_0x20e4fa(0x13e)]();throw new Error('Failed\x20to\x20list\x20sessions:\x20'+_0x1ae6a1);}return _0x4c10ae[_0x20e4fa(0x135)]();}export async function startSession(_0x67b15f,_0x398a2c){const _0x6ec37c=_0x4fb1,_0x421971={'wjYTy':function(_0x572e5f){return _0x572e5f();},'yMCHZ':_0x6ec37c(0x14d),'NwwHi':function(_0xa9c59b,_0x405bb0,_0x131f44){return _0xa9c59b(_0x405bb0,_0x131f44);}},_0x1d65f2=await _0x421971['wjYTy'](getToken);if(!_0x1d65f2)throw new Error(_0x421971['yMCHZ']);const _0x39139c=getApiBaseUrl(),_0x14a0e6=await _0x421971['NwwHi'](fetch,_0x39139c+_0x6ec37c(0x14c)+_0x67b15f+_0x6ec37c(0x15d)+_0x398a2c+'/start',{'method':_0x6ec37c(0x133),'headers':{'Authorization':'Bearer\x20'+_0x1d65f2}});if(!_0x14a0e6['ok']){const _0x4eb0d8=await _0x14a0e6[_0x6ec37c(0x13e)]();throw new Error('Failed\x20to\x20start\x20session:\x20'+_0x4eb0d8);}return _0x14a0e6['json']();}export async function concludeSession(_0x3db640,_0xa73a34){const _0x44ed52=_0x4fb1,_0x473d4f={'pXdEo':function(_0x3bc67b){return _0x3bc67b();},'zVWqI':_0x44ed52(0x14d),'PmXcJ':function(_0x3096ee){return _0x3096ee();},'QNefO':function(_0x4bd51f,_0x253341,_0x3ac54e){return _0x4bd51f(_0x253341,_0x3ac54e);}},_0x8938bb=await _0x473d4f['pXdEo'](getToken);if(!_0x8938bb)throw new Error(_0x473d4f['zVWqI']);const _0x1f0a9c=_0x473d4f[_0x44ed52(0x14b)](getApiBaseUrl),_0x3a5a72=await _0x473d4f[_0x44ed52(0x136)](fetch,_0x1f0a9c+'/api/v1/mcp/features/'+_0x3db640+'/sessions/'+_0xa73a34+'/conclude',{'method':_0x44ed52(0x133),'headers':{'Authorization':_0x44ed52(0x167)+_0x8938bb}});if(!_0x3a5a72['ok']){const _0x30cc3c=await _0x3a5a72['text']();throw new Error(_0x44ed52(0x14f)+_0x30cc3c);}return _0x3a5a72['json']();}export async function getActionItems(_0x22f849){const _0x8aadfe=_0x4fb1,_0x19f60a={'SSteG':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','vSQCw':_0x8aadfe(0x170)},_0x3fdda5=await getToken();if(!_0x3fdda5)throw new Error(_0x19f60a['SSteG']);const _0x3b322f=getApiBaseUrl(),_0x44df69=await fetch(_0x3b322f+'/api/v1/mcp/features/'+_0x22f849+_0x8aadfe(0x159),{'method':_0x19f60a[_0x8aadfe(0x15c)],'headers':{'Authorization':_0x8aadfe(0x167)+_0x3fdda5}});if(!_0x44df69['ok']){const _0x178151=await _0x44df69['text']();throw new Error('Failed\x20to\x20get\x20action\x20items:\x20'+_0x178151);}return _0x44df69['json']();}export async function getItemFeedback(_0x515d12,_0x292db1){const _0x4cce58=_0x4fb1,_0x2bf773={'dTxbc':function(_0x104e64){return _0x104e64();},'iuzpK':function(_0x4d54ee){return _0x4d54ee();},'RVUQO':_0x4cce58(0x170)},_0x3eedf7=await _0x2bf773['dTxbc'](getToken);if(!_0x3eedf7)throw new Error(_0x4cce58(0x14d));const _0xe6d86a=_0x2bf773[_0x4cce58(0x132)](getApiBaseUrl),_0x2699cb=await fetch(_0xe6d86a+_0x4cce58(0x14c)+_0x515d12+_0x4cce58(0x16c)+_0x292db1+'/feedback',{'method':_0x2bf773[_0x4cce58(0x147)],'headers':{'Authorization':_0x4cce58(0x167)+_0x3eedf7}});if(!_0x2699cb['ok']){const _0x4a4c7d=await _0x2699cb[_0x4cce58(0x13e)]();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x4a4c7d);}return _0x2699cb['json']();}export async function markCommentsAddressed(_0x50a7e5,_0x36836e,_0x5d54ba){const _0x5351ce=_0x4fb1,_0xa2ea7={'RslGL':function(_0x34f5e6){return _0x34f5e6();},'syeqb':function(_0x224c5b){return _0x224c5b();},'ImLIO':'application/json'},_0x292534=await _0xa2ea7['RslGL'](getToken);if(!_0x292534)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x2e3f3e=_0xa2ea7[_0x5351ce(0x177)](getApiBaseUrl),_0x2b3684=await fetch(_0x2e3f3e+_0x5351ce(0x14c)+_0x50a7e5+'/comments/address',{'method':'POST','headers':{'Authorization':_0x5351ce(0x167)+_0x292534,'Content-Type':_0xa2ea7[_0x5351ce(0x16f)]},'body':JSON[_0x5351ce(0x17c)]({'checklistItemId':_0x36836e,'commentIds':_0x5d54ba})});if(!_0x2b3684['ok']){const _0xe3ae5e=await _0x2b3684['text']();throw new Error('Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20'+_0xe3ae5e);}}export async function softDeleteFeature(_0x39bfb1){const _0x1c8583=_0x4fb1,_0x3df761={'eHoDp':function(_0x49ead2){return _0x49ead2();},'kAUtE':'DELETE'},_0x462e83=await getToken();if(!_0x462e83)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x3cab10=_0x3df761['eHoDp'](getApiBaseUrl),_0x226cde=await fetch(_0x3cab10+'/api/v1/mcp/features/'+_0x39bfb1,{'method':_0x3df761[_0x1c8583(0x17a)],'headers':{'Authorization':_0x1c8583(0x167)+_0x462e83}});if(!_0x226cde['ok']){const _0x510b7e=await _0x226cde[_0x1c8583(0x13e)]();throw new Error(_0x1c8583(0x17d)+_0x510b7e);}}export async function restoreFeature(_0x3ea715){const _0x105aa2=_0x4fb1,_0x15b6ec={'kqGQF':function(_0x583dd5){return _0x583dd5();}},_0x3f7531=await _0x15b6ec['kqGQF'](getToken);if(!_0x3f7531)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x20ca55=_0x15b6ec['kqGQF'](getApiBaseUrl),_0x1a2935=await fetch(_0x20ca55+_0x105aa2(0x14c)+_0x3ea715+'/restore',{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x3f7531}});if(!_0x1a2935['ok']){const _0x17ea44=await _0x1a2935['text']();throw new Error('Failed\x20to\x20restore\x20feature\x20review:\x20'+_0x17ea44);}}
|
|
1
|
+
(function(_0x21a7fe,_0x58460f){const _0x2ade2e=_0x2dc6,_0x1b139c=_0x21a7fe();while(!![]){try{const _0x522784=parseInt(_0x2ade2e(0x177))/0x1*(-parseInt(_0x2ade2e(0x182))/0x2)+-parseInt(_0x2ade2e(0x197))/0x3*(-parseInt(_0x2ade2e(0x17f))/0x4)+parseInt(_0x2ade2e(0x18c))/0x5*(-parseInt(_0x2ade2e(0x173))/0x6)+parseInt(_0x2ade2e(0x19b))/0x7*(-parseInt(_0x2ade2e(0x18a))/0x8)+-parseInt(_0x2ade2e(0x158))/0x9*(parseInt(_0x2ade2e(0x16c))/0xa)+-parseInt(_0x2ade2e(0x176))/0xb*(parseInt(_0x2ade2e(0x1a1))/0xc)+-parseInt(_0x2ade2e(0x194))/0xd*(-parseInt(_0x2ade2e(0x188))/0xe);if(_0x522784===_0x58460f)break;else _0x1b139c['push'](_0x1b139c['shift']());}catch(_0x495e7e){_0x1b139c['push'](_0x1b139c['shift']());}}}(_0x408d,0x9eee4));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x1d9fbb){const _0x2d69a7=_0x2dc6,_0x322c4e={'mKIWK':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','bdqcD':function(_0x1e22a0,_0x440e7f,_0x3258e0){return _0x1e22a0(_0x440e7f,_0x3258e0);},'SOGjo':'POST','QiZXp':'https://dashboard.ranger.net/billing','LGhBL':_0x2d69a7(0x15c)},_0x1305c9=await getToken();if(!_0x1305c9)throw new Error(_0x322c4e[_0x2d69a7(0x1a3)]);const _0x3d1064=getApiBaseUrl(),_0x2f4974=await _0x322c4e['bdqcD'](fetch,_0x3d1064+'/api/v1/mcp/features',{'method':_0x322c4e['SOGjo'],'headers':{'Authorization':'Bearer\x20'+_0x1305c9,'Content-Type':_0x2d69a7(0x184)},'body':JSON['stringify'](_0x1d9fbb)});if(!_0x2f4974['ok']){if(_0x2f4974[_0x2d69a7(0x179)]===0x192){const _0x1363bc=await _0x2f4974[_0x2d69a7(0x161)](),_0x499504=_0x1363bc['billingUrl']||_0x322c4e[_0x2d69a7(0x164)];throw new Error((_0x1363bc[_0x2d69a7(0x15a)]||_0x322c4e['LGhBL'])+_0x2d69a7(0x186)+_0x499504);}const _0x112592=await _0x2f4974['text']();throw new Error(_0x2d69a7(0x17d)+_0x112592);}return _0x2f4974['json']();}export async function listFeatures(_0x57c68a){const _0x51457c=_0x2dc6,_0x1c3209={'PVKzr':_0x51457c(0x1a2),'CbgyM':function(_0x3321a5){return _0x3321a5();},'bzWcZ':_0x51457c(0x18d),'aHyTr':_0x51457c(0x16d),'LzZDd':'true','ROesi':'GET'},_0x48fdd3=await getToken();if(!_0x48fdd3)throw new Error(_0x1c3209[_0x51457c(0x15b)]);const _0x19a8b8=_0x1c3209[_0x51457c(0x17b)](getApiBaseUrl),_0x506659=new URLSearchParams();if(_0x57c68a?.[_0x51457c(0x18d)])_0x506659['set'](_0x1c3209['bzWcZ'],_0x57c68a['gitRepoUrl']);if(_0x57c68a?.['gitBranch'])_0x506659[_0x51457c(0x17a)](_0x51457c(0x196),_0x57c68a['gitBranch']);if(_0x57c68a?.[_0x51457c(0x16d)])_0x506659['set'](_0x1c3209['aHyTr'],_0x57c68a[_0x51457c(0x16d)]['toString']());if(_0x57c68a?.['offset'])_0x506659['set'](_0x51457c(0x19a),_0x57c68a[_0x51457c(0x19a)]['toString']());if(_0x57c68a?.['includeDeleted'])_0x506659[_0x51457c(0x17a)](_0x51457c(0x180),_0x1c3209['LzZDd']);const _0x427f19=_0x19a8b8+'/api/v1/mcp/features'+(_0x506659[_0x51457c(0x187)]()?'?'+_0x506659['toString']():''),_0x20792d=await fetch(_0x427f19,{'method':_0x1c3209['ROesi'],'headers':{'Authorization':'Bearer\x20'+_0x48fdd3}});if(!_0x20792d['ok']){const _0x2d9239=await _0x20792d['text']();throw new Error(_0x51457c(0x178)+_0x2d9239);}return _0x20792d[_0x51457c(0x161)]();}export async function getFeature(_0x16b46b){const _0xb2115b=_0x2dc6,_0x2269f4={'evWjB':function(_0x4ec306){return _0x4ec306();},'mJhnu':_0xb2115b(0x1a2),'BYHEb':function(_0x5831ba){return _0x5831ba();}},_0x4d891d=await _0x2269f4['evWjB'](getToken);if(!_0x4d891d)throw new Error(_0x2269f4['mJhnu']);const _0x5bba6c=_0x2269f4['BYHEb'](getApiBaseUrl),_0x1e7e3e=await fetch(_0x5bba6c+_0xb2115b(0x199)+_0x16b46b,{'method':_0xb2115b(0x167),'headers':{'Authorization':'Bearer\x20'+_0x4d891d}});if(!_0x1e7e3e['ok']){const _0x208886=await _0x1e7e3e['text']();throw new Error(_0xb2115b(0x160)+_0x208886);}return _0x1e7e3e[_0xb2115b(0x161)]();}function _0x408d(){const _0x5e880d=['sessionId','rAdUz','itemIds','444dCkcrz','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','mKIWK','1206jNKuGT','vqdIc','message','PVKzr','Feature\x20limit\x20exceeded','stringify','Failed\x20to\x20create\x20scenario:\x20','length','Failed\x20to\x20get\x20feature\x20review:\x20','json','join','/comments/address','QiZXp','Failed\x20to\x20list\x20sessions:\x20','IVWhN','GET','Failed\x20to\x20get\x20action\x20items:\x20','style','pxBpi','IjVQG','61370KQSRpL','limit','Failed\x20to\x20update\x20scenario:\x20','Failed\x20to\x20get\x20item\x20feedback:\x20','/sessions/','RoSUI','DePuZ','6pOMeul','PATCH','hSsCO','274263NfTcSA','1PoHdzF','Failed\x20to\x20list\x20feature\x20reviews:\x20','status','set','CbgyM','oaquP','Failed\x20to\x20create\x20feature\x20review:\x20','/report','548iXMTwR','includeDeleted','zqByD','1813262ahlaid','bxmmr','application/json','POST','\x0a\x0aUpgrade\x20your\x20plan:\x20','toString','41690124NPosHH','omDXx','16GgukrS','TasMp','3122435futbPJ','gitRepoUrl','/checklist','DELETE','Bearer\x20','JlmRA','Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20','Failed\x20to\x20delete\x20feature\x20review:\x20','13UlHJZm','text','gitBranch','24915yTXuWU','JPbok','/api/v1/mcp/features/','offset','660359sAAoPJ','Failed\x20to\x20update\x20feature\x20review:\x20','uaEiZ'];_0x408d=function(){return _0x5e880d;};return _0x408d();}export async function updateFeature(_0x402e38,_0x2b305d){const _0x25ecb3=_0x2dc6,_0xc166ee=await getToken();if(!_0xc166ee)throw new Error(_0x25ecb3(0x1a2));const _0x199c61=getApiBaseUrl(),_0x2d87c5=await fetch(_0x199c61+'/api/v1/mcp/features/'+_0x402e38,{'method':_0x25ecb3(0x174),'headers':{'Authorization':_0x25ecb3(0x190)+_0xc166ee,'Content-Type':_0x25ecb3(0x184)},'body':JSON[_0x25ecb3(0x15d)](_0x2b305d)});if(!_0x2d87c5['ok']){const _0xdf9e7d=await _0x2d87c5[_0x25ecb3(0x195)]();throw new Error(_0x25ecb3(0x19c)+_0xdf9e7d);}return _0x2d87c5[_0x25ecb3(0x161)]();}function _0x2dc6(_0x3951c7,_0x9c3b81){_0x3951c7=_0x3951c7-0x158;const _0x408d5f=_0x408d();let _0x2dc6bd=_0x408d5f[_0x3951c7];return _0x2dc6bd;}export async function createChecklistItem(_0x3ede77,_0x37811c,_0x540877){const _0x10798c=_0x2dc6,_0x54e71a={'AGxgt':function(_0x2cdf19){return _0x2cdf19();},'DbKfk':_0x10798c(0x185),'KVbAM':_0x10798c(0x184)},_0x59dddc=await _0x54e71a['AGxgt'](getToken);if(!_0x59dddc)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x1b58d1=getApiBaseUrl(),_0x341de0=await fetch(_0x1b58d1+'/api/v1/mcp/features/'+_0x3ede77+_0x10798c(0x18e),{'method':_0x54e71a['DbKfk'],'headers':{'Authorization':'Bearer\x20'+_0x59dddc,'Content-Type':_0x54e71a['KVbAM']},'body':JSON['stringify']({'description':_0x37811c,'position':_0x540877})});if(!_0x341de0['ok']){const _0x32d5eb=await _0x341de0['text']();throw new Error(_0x10798c(0x15e)+_0x32d5eb);}return _0x341de0['json']();}export async function updateChecklistItem(_0x3f783b,_0x23723f,_0x598c25){const _0x3edc5f=_0x2dc6,_0x5aeb72={'TasMp':function(_0x472032){return _0x472032();},'fFybn':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','CZplh':'PATCH','uaEiZ':function(_0x2834cf,_0x14db64,_0x5ba861){return _0x2834cf(_0x14db64,_0x5ba861);}};return _0x5aeb72[_0x3edc5f(0x19d)](withRetry,async()=>{const _0x1779cf=_0x3edc5f,_0x3b590a=await _0x5aeb72[_0x1779cf(0x18b)](getToken);if(!_0x3b590a)throw new Error(_0x5aeb72['fFybn']);const _0x2271dd=_0x5aeb72[_0x1779cf(0x18b)](getApiBaseUrl),_0x1b5c58=await fetch(_0x2271dd+_0x1779cf(0x199)+_0x3f783b+'/checklist/'+_0x23723f,{'method':_0x5aeb72['CZplh'],'headers':{'Authorization':'Bearer\x20'+_0x3b590a,'Content-Type':'application/json'},'body':JSON['stringify'](_0x598c25)});if(!_0x1b5c58['ok']){const _0x2a04f4=await _0x1b5c58[_0x1779cf(0x195)]();throw new Error(_0x1779cf(0x16e)+_0x2a04f4);}return _0x1b5c58[_0x1779cf(0x161)]();},{'label':'updateChecklistItem'});}export async function getFeatureReport(_0x5fb8e3){const _0xfc786b=_0x2dc6,_0x24c0a5={'tcXrx':function(_0x1b370c){return _0x1b370c();},'xcOnX':_0xfc786b(0x1a2),'zqByD':function(_0x1dc676,_0x3e7954,_0x174851){return _0x1dc676(_0x3e7954,_0x174851);},'xBKzy':'GET'},_0x39bd44=await _0x24c0a5['tcXrx'](getToken);if(!_0x39bd44)throw new Error(_0x24c0a5['xcOnX']);const _0x2d6ee6=getApiBaseUrl(),_0x1196a0=await _0x24c0a5[_0xfc786b(0x181)](fetch,_0x2d6ee6+_0xfc786b(0x199)+_0x5fb8e3+_0xfc786b(0x17e),{'method':_0x24c0a5['xBKzy'],'headers':{'Authorization':'Bearer\x20'+_0x39bd44}});if(!_0x1196a0['ok']){const _0x13350e=await _0x1196a0[_0xfc786b(0x195)]();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x13350e);}return _0x1196a0['json']();}export async function getFeatureReportMarkdown(_0x527739,_0x66cf38){const _0x2a7d3d=_0x2dc6,_0x4a462f={'oaquP':function(_0x112fad){return _0x112fad();},'TyoAh':_0x2a7d3d(0x1a0),'lnIit':'sessionId','LCGLI':function(_0x2dc617,_0x49ce95){return _0x2dc617&&_0x49ce95;},'nSBWx':_0x2a7d3d(0x169),'IjVQG':'GET'},_0x24029c=await getToken();if(!_0x24029c)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x5bdec2=_0x4a462f[_0x2a7d3d(0x17c)](getApiBaseUrl),_0x23eca3=new URLSearchParams(),_0x364fb7=(_0x66cf38?.['itemIds']?.[_0x2a7d3d(0x15f)]??0x0)>0x0,_0x15482d=Boolean(_0x66cf38?.['sessionId']);_0x364fb7&&_0x66cf38?.[_0x2a7d3d(0x1a0)]&&_0x23eca3[_0x2a7d3d(0x17a)](_0x4a462f['TyoAh'],_0x66cf38['itemIds'][_0x2a7d3d(0x162)](','));_0x15482d&&_0x66cf38?.[_0x2a7d3d(0x19e)]&&_0x23eca3['set'](_0x4a462f['lnIit'],_0x66cf38['sessionId']);_0x4a462f['LCGLI'](!_0x364fb7,!_0x15482d)&&_0x66cf38?.[_0x2a7d3d(0x169)]&&_0x23eca3[_0x2a7d3d(0x17a)](_0x4a462f['nSBWx'],_0x66cf38[_0x2a7d3d(0x169)]);const _0x5c2d72=_0x5bdec2+_0x2a7d3d(0x199)+_0x527739+'/report/markdown',_0x29d1f6=''+_0x5c2d72+(_0x23eca3['toString']()?'?'+_0x23eca3['toString']():''),_0x511ed7=await fetch(_0x29d1f6,{'method':_0x4a462f[_0x2a7d3d(0x16b)],'headers':{'Authorization':'Bearer\x20'+_0x24029c}});if(!_0x511ed7['ok']){const _0x5771f0=await _0x511ed7['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20'+_0x5771f0);}return _0x511ed7['text']();}export async function listFeatureSessions(_0x5ed420){const _0x550d98=_0x2dc6,_0x28c2fc={'IVWhN':function(_0x5a0f2e,_0x1a65f4,_0x57f8f0){return _0x5a0f2e(_0x1a65f4,_0x57f8f0);},'UQaPt':_0x550d98(0x167)},_0x576bba=await getToken();if(!_0x576bba)throw new Error(_0x550d98(0x1a2));const _0x2c516c=getApiBaseUrl(),_0x4d5118=await _0x28c2fc[_0x550d98(0x166)](fetch,_0x2c516c+_0x550d98(0x199)+_0x5ed420+'/sessions',{'method':_0x28c2fc['UQaPt'],'headers':{'Authorization':'Bearer\x20'+_0x576bba}});if(!_0x4d5118['ok']){const _0x130b95=await _0x4d5118[_0x550d98(0x195)]();throw new Error(_0x550d98(0x165)+_0x130b95);}return _0x4d5118[_0x550d98(0x161)]();}export async function startSession(_0x19d34d,_0x51c4ed){const _0x4709ad=_0x2dc6,_0x1d6f2d={'ZXQYW':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','GXZKl':function(_0x3eeffa,_0x2b0f51,_0x36390b){return _0x3eeffa(_0x2b0f51,_0x36390b);},'rAdUz':_0x4709ad(0x185)},_0x481f61=await getToken();if(!_0x481f61)throw new Error(_0x1d6f2d['ZXQYW']);const _0x42c5e4=getApiBaseUrl(),_0x533d71=await _0x1d6f2d['GXZKl'](fetch,_0x42c5e4+'/api/v1/mcp/features/'+_0x19d34d+'/sessions/'+_0x51c4ed+'/start',{'method':_0x1d6f2d[_0x4709ad(0x19f)],'headers':{'Authorization':'Bearer\x20'+_0x481f61}});if(!_0x533d71['ok']){const _0x3bc9b1=await _0x533d71['text']();throw new Error('Failed\x20to\x20start\x20session:\x20'+_0x3bc9b1);}return _0x533d71['json']();}export async function concludeSession(_0x1dfdef,_0x17c704){const _0x4ab50a=_0x2dc6,_0x45c429={'aoBBu':function(_0x56a6b3){return _0x56a6b3();},'JPbok':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','omDXx':function(_0x1044f0){return _0x1044f0();},'bxmmr':'POST'},_0x2f64da=await _0x45c429['aoBBu'](getToken);if(!_0x2f64da)throw new Error(_0x45c429[_0x4ab50a(0x198)]);const _0x5b90f5=_0x45c429[_0x4ab50a(0x189)](getApiBaseUrl),_0xc8bec5=await fetch(_0x5b90f5+'/api/v1/mcp/features/'+_0x1dfdef+_0x4ab50a(0x170)+_0x17c704+'/conclude',{'method':_0x45c429[_0x4ab50a(0x183)],'headers':{'Authorization':'Bearer\x20'+_0x2f64da}});if(!_0xc8bec5['ok']){const _0x435445=await _0xc8bec5[_0x4ab50a(0x195)]();throw new Error('Failed\x20to\x20conclude\x20session:\x20'+_0x435445);}return _0xc8bec5[_0x4ab50a(0x161)]();}export async function getActionItems(_0x1a74c3){const _0x381e32=_0x2dc6,_0x310515={'AMfBQ':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','sGCvo':function(_0x3161a7){return _0x3161a7();}},_0x251fb4=await getToken();if(!_0x251fb4)throw new Error(_0x310515['AMfBQ']);const _0x43a08f=_0x310515['sGCvo'](getApiBaseUrl),_0x327070=await fetch(_0x43a08f+_0x381e32(0x199)+_0x1a74c3+'/action-items',{'method':_0x381e32(0x167),'headers':{'Authorization':'Bearer\x20'+_0x251fb4}});if(!_0x327070['ok']){const _0xdd0bbe=await _0x327070['text']();throw new Error(_0x381e32(0x168)+_0xdd0bbe);}return _0x327070['json']();}export async function getItemFeedback(_0x518e43,_0xc6aa44){const _0x1873e6=_0x2dc6,_0x5d3425={'naGGZ':function(_0x58079a){return _0x58079a();},'qVWcR':function(_0x10b0af){return _0x10b0af();}},_0x43e4e1=await _0x5d3425['naGGZ'](getToken);if(!_0x43e4e1)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x1646f4=_0x5d3425['qVWcR'](getApiBaseUrl),_0x163414=await fetch(_0x1646f4+'/api/v1/mcp/features/'+_0x518e43+'/checklist-items/'+_0xc6aa44+'/feedback',{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x43e4e1}});if(!_0x163414['ok']){const _0x1f920e=await _0x163414['text']();throw new Error(_0x1873e6(0x16f)+_0x1f920e);}return _0x163414['json']();}export async function markCommentsAddressed(_0x40e852,_0x2528bf,_0xc0d8db){const _0x37384e=_0x2dc6,_0x26353a={'JlmRA':function(_0x3c6a8a){return _0x3c6a8a();},'aVJDP':'POST','qXEYS':'application/json'},_0x4b6cf5=await getToken();if(!_0x4b6cf5)throw new Error(_0x37384e(0x1a2));const _0x4c3f25=_0x26353a[_0x37384e(0x191)](getApiBaseUrl),_0x34d025=await fetch(_0x4c3f25+'/api/v1/mcp/features/'+_0x40e852+_0x37384e(0x163),{'method':_0x26353a['aVJDP'],'headers':{'Authorization':_0x37384e(0x190)+_0x4b6cf5,'Content-Type':_0x26353a['qXEYS']},'body':JSON['stringify']({'checklistItemId':_0x2528bf,'commentIds':_0xc0d8db})});if(!_0x34d025['ok']){const _0x4926d9=await _0x34d025['text']();throw new Error(_0x37384e(0x192)+_0x4926d9);}}export async function softDeleteFeature(_0x595184){const _0x582a82=_0x2dc6,_0x214948={'KgSep':_0x582a82(0x1a2),'pxBpi':function(_0x5ec4b4){return _0x5ec4b4();},'DePuZ':_0x582a82(0x18f)},_0x17a701=await getToken();if(!_0x17a701)throw new Error(_0x214948['KgSep']);const _0x41b935=_0x214948[_0x582a82(0x16a)](getApiBaseUrl),_0x549a58=await fetch(_0x41b935+_0x582a82(0x199)+_0x595184,{'method':_0x214948[_0x582a82(0x172)],'headers':{'Authorization':'Bearer\x20'+_0x17a701}});if(!_0x549a58['ok']){const _0x2ba6e8=await _0x549a58[_0x582a82(0x195)]();throw new Error(_0x582a82(0x193)+_0x2ba6e8);}}export async function restoreFeature(_0x54ef99){const _0x27c9f6=_0x2dc6,_0x1f79b0={'RoSUI':function(_0x962030){return _0x962030();},'hSsCO':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','vqdIc':function(_0x568bac){return _0x568bac();}},_0x138b5d=await _0x1f79b0[_0x27c9f6(0x171)](getToken);if(!_0x138b5d)throw new Error(_0x1f79b0[_0x27c9f6(0x175)]);const _0x415165=_0x1f79b0[_0x27c9f6(0x159)](getApiBaseUrl),_0x2eeb61=await fetch(_0x415165+'/api/v1/mcp/features/'+_0x54ef99+'/restore',{'method':'POST','headers':{'Authorization':_0x27c9f6(0x190)+_0x138b5d}});if(!_0x2eeb61['ok']){const _0x4f206f=await _0x2eeb61['text']();throw new Error('Failed\x20to\x20restore\x20feature\x20review:\x20'+_0x4f206f);}}
|