@treasuredata/tdx 2026.4.6 → 2026.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/policy-command.js +1 -1
  35. package/dist/commands/profile-command.js +1 -1
  36. package/dist/commands/profiles-command.js +1 -1
  37. package/dist/commands/query-command.js +1 -1
  38. package/dist/commands/schedule-command.js +1 -1
  39. package/dist/commands/segment-command.js +1 -1
  40. package/dist/commands/segment-create-command.js +1 -1
  41. package/dist/commands/segment-fields-command.js +1 -1
  42. package/dist/commands/segment-pull-command.js +1 -1
  43. package/dist/commands/segment-push-command.js +1 -1
  44. package/dist/commands/segment-update-command.js +1 -1
  45. package/dist/commands/segment-use-command.js +1 -1
  46. package/dist/commands/segment-validate-command.js +1 -1
  47. package/dist/commands/segments.js +1 -1
  48. package/dist/commands/show.js +1 -1
  49. package/dist/commands/status-command.js +1 -1
  50. package/dist/commands/tables.js +1 -1
  51. package/dist/commands/unset-command.js +1 -1
  52. package/dist/commands/upgrade-command.js +1 -1
  53. package/dist/commands/use-command.js +1 -1
  54. package/dist/commands/user-command.js +1 -1
  55. package/dist/commands/work-command.js +1 -1
  56. package/dist/commands/workflow-command.js +1 -1
  57. package/dist/core/auth.js +1 -1
  58. package/dist/core/command-output.js +1 -1
  59. package/dist/core/config.js +1 -1
  60. package/dist/core/connection-cache.js +1 -1
  61. package/dist/core/constants.js +1 -1
  62. package/dist/core/credential-cache.js +1 -1
  63. package/dist/core/global-context.js +1 -1
  64. package/dist/core/keychain.js +1 -1
  65. package/dist/core/oauth-keychain.js +1 -1
  66. package/dist/core/oauth.js +1 -1
  67. package/dist/core/profile.js +1 -1
  68. package/dist/core/project-config.js +1 -1
  69. package/dist/core/session.js +1 -1
  70. package/dist/core/user-cache.js +1 -1
  71. package/dist/core/version.js +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/mcp/server.js +1 -1
  74. package/dist/mcp/tools/index.js +1 -1
  75. package/dist/mcp/tools/tdx-run.js +1 -1
  76. package/dist/mcp/tools/tdx-search.js +1 -1
  77. package/dist/mcp/tools/work-create-item.js +1 -1
  78. package/dist/mcp/utils.js +1 -1
  79. package/dist/proxy/claude-usage-tracker.js +1 -1
  80. package/dist/proxy/passthrough-server.js +1 -1
  81. package/dist/proxy/sse-usage-parser.js +1 -1
  82. package/dist/sdk/agent/agent-config.js +1 -1
  83. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  84. package/dist/sdk/agent/agent-yaml.js +1 -1
  85. package/dist/sdk/agent/test/evaluator.js +1 -1
  86. package/dist/sdk/agent/test/executor.js +1 -1
  87. package/dist/sdk/agent/test/index.js +1 -1
  88. package/dist/sdk/agent/test/output.js +1 -1
  89. package/dist/sdk/agent/test/parser.js +1 -1
  90. package/dist/sdk/agent/tool-target-registry.js +1 -1
  91. package/dist/sdk/api.js +1 -1
  92. package/dist/sdk/cas/cas-api-client.js +1 -1
  93. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  94. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  95. package/dist/sdk/cas/index.js +1 -1
  96. package/dist/sdk/cas/pull-workflow.js +1 -1
  97. package/dist/sdk/cas/push-workflow.js +1 -1
  98. package/dist/sdk/client/cdp-api-client.js +1 -1
  99. package/dist/sdk/client/delivery-api-client.js +1 -1
  100. package/dist/sdk/client/endpoints.js +1 -1
  101. package/dist/sdk/client/engage-api-client.js +1 -1
  102. package/dist/sdk/client/http-client.js +1 -1
  103. package/dist/sdk/client/llm-api-client.js +1 -1
  104. package/dist/sdk/client/oauth-refresh.js +1 -1
  105. package/dist/sdk/client/rate-limiter.js +1 -1
  106. package/dist/sdk/client/td-api-client.js +1 -1
  107. package/dist/sdk/client/trino-api-client.js +1 -1
  108. package/dist/sdk/client/workflow-client.js +1 -1
  109. package/dist/sdk/connection-validator.js +1 -1
  110. package/dist/sdk/connection.js +1 -1
  111. package/dist/sdk/delivery.js +1 -1
  112. package/dist/sdk/engage/campaign-pull.js +1 -1
  113. package/dist/sdk/engage/campaign-push.js +1 -1
  114. package/dist/sdk/engage/campaign-validator.js +1 -1
  115. package/dist/sdk/engage/campaign-yaml.js +1 -1
  116. package/dist/sdk/engage/template-pull.js +1 -1
  117. package/dist/sdk/engage/template-push.js +1 -1
  118. package/dist/sdk/engage/template-validator.js +1 -1
  119. package/dist/sdk/engage/template-yaml.js +1 -1
  120. package/dist/sdk/engage/types/campaign-def.js +1 -1
  121. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  122. package/dist/sdk/engage/types/template-schema.js +1 -1
  123. package/dist/sdk/engage.js +1 -1
  124. package/dist/sdk/errors.js +1 -1
  125. package/dist/sdk/index.js +1 -1
  126. package/dist/sdk/io/index.js +1 -1
  127. package/dist/sdk/io/node-filesystem.js +1 -1
  128. package/dist/sdk/job.js +1 -1
  129. package/dist/sdk/journey.js +1 -1
  130. package/dist/sdk/llm/chat-cache.js +1 -1
  131. package/dist/sdk/llm/index.js +1 -1
  132. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  133. package/dist/sdk/llm/model-factors.js +1 -1
  134. package/dist/sdk/personalization.js +1 -1
  135. package/dist/sdk/policy.js +1 -1
  136. package/dist/sdk/query/index.js +1 -1
  137. package/dist/sdk/query/sql-parser.js +1 -1
  138. package/dist/sdk/realtime.js +1 -1
  139. package/dist/sdk/schedule.js +1 -1
  140. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  141. package/dist/sdk/segment/fields-display.js +1 -1
  142. package/dist/sdk/segment/file-discovery.js +1 -1
  143. package/dist/sdk/segment/journey-utils.js +1 -1
  144. package/dist/sdk/segment/journey-validator.js +1 -1
  145. package/dist/sdk/segment/journey-yaml.js +1 -1
  146. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  147. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  148. package/dist/sdk/segment/pull-workflow.js +1 -1
  149. package/dist/sdk/segment/push-recovery.js +1 -1
  150. package/dist/sdk/segment/push-workflow.js +1 -1
  151. package/dist/sdk/segment/resolution-context.js +1 -1
  152. package/dist/sdk/segment/segment-path-parser.js +1 -1
  153. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  154. package/dist/sdk/segment/segment-validator.js +1 -1
  155. package/dist/sdk/segment/target-resolution.js +1 -1
  156. package/dist/sdk/segment/tdx-config.js +1 -1
  157. package/dist/sdk/segment/types/activation-schema.js +1 -1
  158. package/dist/sdk/segment/types/journey-def.js +1 -1
  159. package/dist/sdk/segment/types/journey-schema.js +1 -1
  160. package/dist/sdk/segment/types/segment-def.js +1 -1
  161. package/dist/sdk/segment/types/segment-schema.js +1 -1
  162. package/dist/sdk/segment/validate-files.js +1 -1
  163. package/dist/sdk/segment/yaml-validator.js +1 -1
  164. package/dist/sdk/segment.js +1 -1
  165. package/dist/sdk/types/index.js +1 -1
  166. package/dist/sdk/types/progress.js +1 -1
  167. package/dist/sdk/types/workspace.js +1 -1
  168. package/dist/sdk/user.js +1 -1
  169. package/dist/sdk/util/format-detector.js +1 -1
  170. package/dist/sdk/util/formatters.js +1 -1
  171. package/dist/sdk/util/index.js +1 -1
  172. package/dist/sdk/util/paginate.js +1 -1
  173. package/dist/sdk/util/tree-formatter.js +1 -1
  174. package/dist/sdk/workflow/archive-validation.js +1 -1
  175. package/dist/sdk/workflow/clone-workflow.js +1 -1
  176. package/dist/sdk/workflow/index.js +1 -1
  177. package/dist/sdk/workflow/pull-workflow.js +1 -1
  178. package/dist/sdk/workflow/push-workflow.js +1 -1
  179. package/dist/sdk/workflow/tdx-config.js +1 -1
  180. package/dist/sdk/workflow/workflow-utils.js +1 -1
  181. package/dist/sdk/workspace/access-tracker.js +1 -1
  182. package/dist/sdk/workspace/frontmatter.js +1 -1
  183. package/dist/sdk/workspace/git.js +1 -1
  184. package/dist/sdk/workspace/index.js +1 -1
  185. package/dist/sdk/workspace/templates.js +1 -1
  186. package/dist/sdk/workspace/weekly.js +1 -1
  187. package/dist/sdk/workspace/wikilinks.js +1 -1
  188. package/dist/test-utils/command-runner.js +1 -1
  189. package/dist/test-utils/factories.js +1 -1
  190. package/dist/test-utils/fixtures.js +1 -1
  191. package/dist/test-utils/http-mock.js +1 -1
  192. package/dist/test-utils/index.js +1 -1
  193. package/dist/utils/async.js +1 -1
  194. package/dist/utils/colors.js +1 -1
  195. package/dist/utils/diff.js +1 -1
  196. package/dist/utils/file-permissions.js +1 -1
  197. package/dist/utils/file-reader.js +1 -1
  198. package/dist/utils/github-releases.js +1 -1
  199. package/dist/utils/global-cache.js +1 -1
  200. package/dist/utils/json-loader.js +1 -1
  201. package/dist/utils/local-cache.js +1 -1
  202. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  203. package/dist/utils/logger/formatters/index.js +1 -1
  204. package/dist/utils/logger/handlers/console-handler.js +1 -1
  205. package/dist/utils/logger/handlers/file-handler.js +1 -1
  206. package/dist/utils/logger/handlers/index.js +1 -1
  207. package/dist/utils/logger/handlers/null-handler.js +1 -1
  208. package/dist/utils/logger/index.js +1 -1
  209. package/dist/utils/logger/logger.js +1 -1
  210. package/dist/utils/logger/types.js +1 -1
  211. package/dist/utils/option-validation.js +1 -1
  212. package/dist/utils/process.js +1 -1
  213. package/dist/utils/prompt.js +1 -1
  214. package/dist/utils/spinner.js +1 -1
  215. package/dist/utils/sse-parser.js +1 -1
  216. package/dist/utils/string-utils.js +1 -1
  217. package/dist/utils/table-ref-parser.js +1 -1
  218. package/dist/utils/tdx-logger.js +1 -1
  219. package/dist/utils/version-check.js +1 -1
  220. package/package.json +1 -1
@@ -1 +1 @@
1
- const a57_0x2a6207=a57_0x5c33;(function(_0x14d916,_0x4a6057){const _0x450e7d=a57_0x5c33,_0x4f4b5b=_0x14d916();while(!![]){try{const _0x48c07b=parseInt(_0x450e7d(0x18e))/0x1*(parseInt(_0x450e7d(0x1be))/0x2)+parseInt(_0x450e7d(0x1a1))/0x3+-parseInt(_0x450e7d(0x191))/0x4+parseInt(_0x450e7d(0x19b))/0x5+-parseInt(_0x450e7d(0x1a0))/0x6*(parseInt(_0x450e7d(0x1a6))/0x7)+-parseInt(_0x450e7d(0x1b1))/0x8+-parseInt(_0x450e7d(0x1ba))/0x9*(parseInt(_0x450e7d(0x1bf))/0xa);if(_0x48c07b===_0x4a6057)break;else _0x4f4b5b['push'](_0x4f4b5b['shift']());}catch(_0x603fe5){_0x4f4b5b['push'](_0x4f4b5b['shift']());}}}(a57_0x3c41,0xa585d));function a57_0x3c41(){const _0x544726=['1328070QQdSfk','10MqBtFG','match','.env.','TDX_API_KEY_','tdx.json','startsWith','stable','split','.json','keychain\x20(profile:\x20','llm_default_project','.config','stg-ap03','config/llm-project','TDX_API_KEY\x20env\x20var','readFileSync','join','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','filter','existsSync','source','Warning:\x20Failed\x20to\x20read\x20','stg-ap01','ap02','toISOString','us01','accountId','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','2PcQuPY','warn','yellow','618652tdocbU','apiKey','TDX_ACCESS_TOKEN\x20env\x20var','string','ap03','\x20env\x20var','config/llm-agent','read','accessToken','eu01','1777570rDRMeD','write','\x27,\x20defaulting\x20to\x20us01','projectId','entries','36XFGhxy','2907963wkEAhP','trim','some','llm_default_agent','endsWith','101017gfqctJ','.env','site','utf-8','stringify','stg-us01','slice','next','Warning:\x20Unknown\x20site\x20\x27','replace','keychain','5652032jOxTFu','map','path','dev-us01','TD_API_KEY','TD_API_KEY_','release_channel','dev-eu01','name','9244539bsELyH','ap01','proxy','number'];a57_0x3c41=function(){return _0x544726;};return a57_0x3c41();}import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';function a57_0x5c33(_0xe697ea,_0x4018cb){_0xe697ea=_0xe697ea-0x17b;const _0x3c41f7=a57_0x3c41();let _0x5c3314=_0x3c41f7[_0xe697ea];return _0x5c3314;}import*as a57_0x3502c5 from'node:fs';import*as a57_0x472eb6 from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a57_0x59a7d4 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x293b11=a57_0x5c33;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x293b11(0x17d),'tdx');}export function getConfigFile(){const _0x5933f6=a57_0x5c33;return join(getConfigDir(),_0x5933f6(0x1a7));}export function getConfigFilePath(_0x11a0e7){const _0x2e66d4=a57_0x5c33,_0x44c651=getConfigDir();return _0x11a0e7?a57_0x472eb6[_0x2e66d4(0x182)](_0x44c651,_0x2e66d4(0x1c1)+_0x11a0e7):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a57_0x2a6207(0x17c),a57_0x2a6207(0x17f));export function getLLMProjectCacheFile(_0x226c68){return llmProjectCache['path'](_0x226c68);}export function readCachedLLMProject(_0x30ce25){const _0x40637b=a57_0x2a6207,_0x6ba655=llmProjectCache[_0x40637b(0x198)](_0x30ce25);if(_0x6ba655&&typeof _0x6ba655['id']===_0x40637b(0x194)&&typeof _0x6ba655[_0x40637b(0x1b9)]===_0x40637b(0x194))return _0x6ba655;return null;}export function writeCachedLLMProject(_0x3c5ef2,_0x58b23e,_0x3ea3d8){try{llmProjectCache['write']({'name':_0x3c5ef2,'id':_0x58b23e},_0x3ea3d8);}catch{}}const llmAgentCache=createOptionalProfileCache(a57_0x2a6207(0x1a4),a57_0x2a6207(0x197));export function getLLMAgentCacheFile(_0x4fa41b){const _0x53c3dd=a57_0x2a6207;return llmAgentCache[_0x53c3dd(0x1b3)](_0x4fa41b);}export function readCachedLLMAgent(_0x434ced){const _0x2a2310=a57_0x2a6207,_0xa10a78=llmAgentCache[_0x2a2310(0x198)](_0x434ced);if(_0xa10a78&&typeof _0xa10a78['id']==='string'&&typeof _0xa10a78[_0x2a2310(0x1b9)]===_0x2a2310(0x194)&&typeof _0xa10a78[_0x2a2310(0x19e)]===_0x2a2310(0x194))return _0xa10a78;return null;}export function writeCachedLLMAgent(_0x2de66b,_0x56fe60,_0x1c2283,_0x1e23f5){const _0x362415=a57_0x2a6207;try{llmAgentCache[_0x362415(0x19c)]({'name':_0x2de66b,'id':_0x56fe60,'projectId':_0x1c2283},_0x1e23f5);}catch{}}export function clearCachedLLMAgent(_0x5859d4){try{llmAgentCache['clear'](_0x5859d4);}catch{}}const accountInfoCache=createOptionalProfileCache('account_info','config/account-info',{'suffix':a57_0x2a6207(0x1c7)});export function getAccountInfoCacheFile(_0x14cf76){const _0x307c40=a57_0x2a6207;return accountInfoCache[_0x307c40(0x1b3)](_0x14cf76);}export function readCachedAccountInfo(_0x31e2ab){const _0x32ea15=a57_0x2a6207,_0x5de6ef=accountInfoCache['read'](_0x31e2ab);if(_0x5de6ef&&typeof _0x5de6ef[_0x32ea15(0x1a8)]===_0x32ea15(0x194)&&typeof _0x5de6ef[_0x32ea15(0x18c)]===_0x32ea15(0x1bd))return _0x5de6ef;return null;}export function writeCachedAccountInfo(_0x24839e,_0x6d65c2,_0xc7664b){const _0x1f1a48=a57_0x2a6207;try{accountInfoCache[_0x1f1a48(0x19c)]({'site':_0x24839e,'accountId':_0x6d65c2,'cachedAt':new Date()[_0x1f1a48(0x18a)]()},_0xc7664b);}catch{}}export function parseEnvFile(_0x37e774){const _0x1ef505=a57_0x2a6207,_0x400bba={};for(const _0x5a4fc4 of _0x37e774[_0x1ef505(0x1c6)]('\x0a')){const _0x69f3ec=_0x5a4fc4[_0x1ef505(0x1a2)]();if(!_0x69f3ec||_0x69f3ec['startsWith']('#'))continue;const _0x4e1fd4=_0x69f3ec[_0x1ef505(0x1c0)](/^([^=]+)=(.*)$/);if(_0x4e1fd4){const _0x548bea=_0x4e1fd4[0x1]['trim']();let _0x4cb2b2=_0x4e1fd4[0x2][_0x1ef505(0x1a2)]();(_0x4cb2b2[_0x1ef505(0x1c4)]('\x22')&&_0x4cb2b2[_0x1ef505(0x1a5)]('\x22')||_0x4cb2b2[_0x1ef505(0x1c4)]('\x27')&&_0x4cb2b2['endsWith']('\x27'))&&(_0x4cb2b2=_0x4cb2b2[_0x1ef505(0x1ac)](0x1,-0x1)),_0x400bba[_0x548bea]=_0x4cb2b2;}}return _0x400bba;}export function readUserConfig(){const _0x3fdbdd=a57_0x2a6207,_0x58a2c9=getConfigFile();if(!existsSync(_0x58a2c9))return{};try{const _0x109241=readFileSync(_0x58a2c9,_0x3fdbdd(0x1a9));return parseEnvFile(_0x109241);}catch(_0x392eb7){return console[_0x3fdbdd(0x18f)](_0x3fdbdd(0x18d)+_0x58a2c9+':',_0x392eb7),{};}}export function resolveSite(_0x405109){const _0x1c6ffb=a57_0x2a6207,_0x947dee=[_0x1c6ffb(0x18b),'ap01',_0x1c6ffb(0x19a),_0x1c6ffb(0x189),_0x1c6ffb(0x195),_0x1c6ffb(0x1b4),'dev-eu01',_0x1c6ffb(0x1ab),'stg-ap01','stg-ap03'];if(_0x947dee['includes'](_0x405109))return _0x405109;if(_0x405109 in SITE_ALIASES)return SITE_ALIASES[_0x405109];return console[_0x1c6ffb(0x18f)](_0x1c6ffb(0x1ae)+_0x405109+_0x1c6ffb(0x19d)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x15e1fe){const _0x42b9fd=a57_0x2a6207,_0x282747=_0x15e1fe||getActiveProfileName()||undefined;if(_0x282747){const _0x34c3a9='TDX_ACCESS_TOKEN_'+normalizeProfileForEnvVar(_0x282747);if(process.env[_0x34c3a9])return{'accessToken':process.env[_0x34c3a9],'source':_0x34c3a9+_0x42b9fd(0x196)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x42b9fd(0x193)};if(process.env.TDX_ACCESS_TOKEN_FILE){const _0x4fb513=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x4fb513)return{'accessToken':_0x4fb513,'source':'TDX_ACCESS_TOKEN_FILE'};}return null;}function readAccessTokenFile(_0x51802b){try{const _0x311d5b=readFileSync(_0x51802b,'utf-8')['trim']();return _0x311d5b||null;}catch{return null;}}export function getAccessToken(_0x5deea2){const _0x4f1c43=a57_0x2a6207;return resolveAccessToken(_0x5deea2)?.[_0x4f1c43(0x199)];}export function getAPIKey(_0x412497){const _0x1f58b5=a57_0x2a6207,_0x1e8f2d=_0x412497||getActiveProfileName();if(_0x1e8f2d){const _0x42f90b=_0x1f58b5(0x1c2)+normalizeProfileForEnvVar(_0x1e8f2d);if(process.env[_0x42f90b])return process.env[_0x42f90b];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x155aaf){return _0x155aaf['toUpperCase']()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0xf738ea,_0x474b7a){const _0x11dc15=a57_0x2a6207,_0x513ac3=resolveAccessToken(_0x474b7a);if(_0x513ac3)return{'apiKey':_0x513ac3[_0x11dc15(0x199)],'source':_0x513ac3[_0x11dc15(0x186)],'isDeprecated':![]};const _0x39328f=_0x474b7a||getActiveProfileName()||undefined;if(_0x39328f){const _0x3bec05='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x39328f);if(process.env[_0x3bec05])return{'apiKey':process.env[_0x3bec05],'source':_0x3bec05+_0x11dc15(0x196),'isDeprecated':![]};const _0x22d93d=getCachedCredential(_0xf738ea,_0x39328f);if(_0x22d93d)return{'apiKey':_0x22d93d,'source':_0x11dc15(0x17b)+_0x39328f+')','isDeprecated':![]};const _0x3ed155=await getKeychainAPIKey(_0x39328f);if(_0x3ed155)return setCachedCredential(_0x3ed155,_0xf738ea,_0x39328f),{'apiKey':_0x3ed155,'source':'keychain\x20(profile:\x20'+_0x39328f+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x11dc15(0x180),'isDeprecated':![]};if(!_0x39328f){const _0x148b9e=getCachedCredential(_0xf738ea,undefined);if(_0x148b9e)return{'apiKey':_0x148b9e,'source':_0x11dc15(0x1b0),'isDeprecated':![]};const _0x549506=await getKeychainAPIKey(undefined);if(_0x549506)return setCachedCredential(_0x549506,_0xf738ea,undefined),{'apiKey':_0x549506,'source':_0x11dc15(0x1b0),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x3c788f,_0x4c5c09){const _0x293cd4=a57_0x2a6207,_0x280ec1=await resolveAPIKeyAsync(_0x3c788f,_0x4c5c09);return _0x280ec1?.[_0x293cd4(0x192)];}function cleanupLegacyEnvFile(_0x3efba3){const _0x385115=a57_0x2a6207;if(!existsSync(_0x3efba3))return![];try{const _0x5deaeb=readFileSync(_0x3efba3,_0x385115(0x1a9)),_0x38da91=_0x5deaeb['split']('\x0a'),_0x484297=_0x38da91[_0x385115(0x184)](_0x4f505e=>{const _0x3cbf67=_0x385115,_0x53c114=_0x4f505e['trim']();if(!_0x53c114||_0x53c114[_0x3cbf67(0x1c4)]('#'))return!![];const [_0x3f33f6]=_0x53c114[_0x3cbf67(0x1c6)]('=');return!_0x3f33f6['startsWith'](_0x3cbf67(0x1b5));}),_0x59a977=_0x484297[_0x385115(0x1a3)](_0x25ddbf=>{const _0x30df81=_0x385115,_0x4e9de5=_0x25ddbf[_0x30df81(0x1a2)]();return _0x4e9de5&&!_0x4e9de5[_0x30df81(0x1c4)]('#');});if(!_0x59a977)return unlinkSync(_0x3efba3),!![];return writeFileSync(_0x3efba3,_0x484297[_0x385115(0x182)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x5116f0=a57_0x2a6207;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x48446d=a57_0x472eb6[_0x5116f0(0x182)](getConfigDir(),_0x5116f0(0x1c3));if(!a57_0x3502c5[_0x5116f0(0x185)](_0x48446d))return null;try{const _0x258db6=a57_0x3502c5['readFileSync'](_0x48446d,_0x5116f0(0x1a9)),_0x195779=JSON['parse'](_0x258db6);return _0x195779['profile']||null;}catch{return null;}}export function saveAPIKey(_0x314300,_0x5536a3,_0x2daabb){const _0x228df8=a57_0x2a6207,_0xeda912=getConfigDir(),_0x34af91=getConfigFilePath(_0x2daabb);!existsSync(_0xeda912)&&mkdirSync(_0xeda912,{'recursive':!![],'mode':0x1c0});let _0x5e7639={};if(existsSync(_0x34af91))try{const _0x5e125d=readFileSync(_0x34af91,_0x228df8(0x1a9));_0x5e7639=parseEnvFile(_0x5e125d);}catch(_0x263b32){console[_0x228df8(0x18f)](_0x228df8(0x187)+_0x34af91+':',_0x263b32);}const _0x46e2b7=_0x314300['toUpperCase']()[_0x228df8(0x1af)](/-/g,'_');_0x5e7639[_0x228df8(0x1b6)+_0x46e2b7]=_0x5536a3;const _0x339bf7=Object[_0x228df8(0x19f)](_0x5e7639)[_0x228df8(0x1b2)](([_0x33951e,_0x25439e])=>_0x33951e+'='+_0x25439e);writeFileSync(_0x34af91,_0x339bf7[_0x228df8(0x182)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x48ba31,_0x4e3486,_0x244249){const _0x58cda0=a57_0x2a6207;await saveKeychainAPIKey(_0x48ba31,_0x244249),setCachedCredential(_0x48ba31,_0x4e3486,_0x244249);const _0x5498a2=getConfigFilePath(_0x244249);cleanupLegacyEnvFile(_0x5498a2)&&console[_0x58cda0(0x18f)](a57_0x59a7d4[_0x58cda0(0x190)](_0x58cda0(0x183)));}export function loadConfig(){const _0x1cadee=a57_0x2a6207,_0x5883ac={'apiKeys':{},'defaultSite':'us01'},_0x4ac8ec=['us01',_0x1cadee(0x1bb),_0x1cadee(0x19a),_0x1cadee(0x189),_0x1cadee(0x195),_0x1cadee(0x1b4),_0x1cadee(0x1b8),_0x1cadee(0x1ab),_0x1cadee(0x188),_0x1cadee(0x17e)],_0xb6eb74=getAPIKey();if(_0xb6eb74)for(const _0x4bd8d7 of _0x4ac8ec){_0x5883ac['apiKeys'][_0x4bd8d7]=_0xb6eb74;}return _0x5883ac;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x5ab539=a57_0x2a6207,_0x188b75=a57_0x472eb6[_0x5ab539(0x182)](getConfigDir(),'tdx.json');if(!a57_0x3502c5['existsSync'](_0x188b75))return undefined;try{const _0x52af55=a57_0x3502c5[_0x5ab539(0x181)](_0x188b75,_0x5ab539(0x1a9)),_0x21e59c=JSON['parse'](_0x52af55);return typeof _0x21e59c[_0x5ab539(0x1bc)]===_0x5ab539(0x194)?_0x21e59c[_0x5ab539(0x1bc)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x37fb81=a57_0x2a6207,_0x2b32b0=process.env.TDX_RELEASE_CHANNEL;if(_0x2b32b0==='next'||_0x2b32b0==='stable')return _0x2b32b0;const _0x38d39a=a57_0x472eb6[_0x37fb81(0x182)](getConfigDir(),_0x37fb81(0x1c3));if(!a57_0x3502c5[_0x37fb81(0x185)](_0x38d39a))return _0x37fb81(0x1c5);try{const _0x4d1067=a57_0x3502c5[_0x37fb81(0x181)](_0x38d39a,'utf-8'),_0x212ac5=JSON['parse'](_0x4d1067);if(_0x212ac5[_0x37fb81(0x1b7)]===_0x37fb81(0x1ad))return _0x37fb81(0x1ad);}catch{}return _0x37fb81(0x1c5);}export function saveReleaseChannel(_0x2097cc){const _0xc8063b=a57_0x2a6207,_0x27bdc8=getConfigDir(),_0x7e316e=a57_0x472eb6['join'](_0x27bdc8,_0xc8063b(0x1c3));!existsSync(_0x27bdc8)&&mkdirSync(_0x27bdc8,{'recursive':!![],'mode':0x1c0});let _0x3569e8={};if(existsSync(_0x7e316e))try{const _0x51c012=readFileSync(_0x7e316e,_0xc8063b(0x1a9));_0x3569e8=JSON['parse'](_0x51c012);}catch{}_0x3569e8[_0xc8063b(0x1b7)]=_0x2097cc,writeFileSync(_0x7e316e,JSON[_0xc8063b(0x1aa)](_0x3569e8,null,0x2),{'mode':0x180});}
1
+ const a57_0x3a7d7b=a57_0x5be0;(function(_0x30a123,_0x4ef62f){const _0xd3036d=a57_0x5be0,_0x1b0fb7=_0x30a123();while(!![]){try{const _0x33b205=parseInt(_0xd3036d(0xcf))/0x1+parseInt(_0xd3036d(0xf9))/0x2+-parseInt(_0xd3036d(0xd3))/0x3+-parseInt(_0xd3036d(0xc4))/0x4*(-parseInt(_0xd3036d(0xb0))/0x5)+-parseInt(_0xd3036d(0xf4))/0x6*(parseInt(_0xd3036d(0xbb))/0x7)+-parseInt(_0xd3036d(0xde))/0x8+-parseInt(_0xd3036d(0xbd))/0x9*(parseInt(_0xd3036d(0xc9))/0xa);if(_0x33b205===_0x4ef62f)break;else _0x1b0fb7['push'](_0x1b0fb7['shift']());}catch(_0x1b8f5c){_0x1b0fb7['push'](_0x1b0fb7['shift']());}}}(a57_0x33e8,0x2203c));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a57_0x3140aa from'node:fs';function a57_0x33e8(){const _0x5b5e8c=['⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','stg-us01','split','TD_API_KEY','existsSync','stable','accessToken','.env','stg-ap01','path','toISOString','apiKey','keychain\x20(profile:\x20','slice','map','\x20env\x20var','name','ap01','TD_API_KEY_','269226hFKVXZ','trim','profile','join','ap02','389296xdIwmO','dev-eu01','account_info','utf-8','keychain','toUpperCase','write','10620XSqrFF','string','number','llm_default_agent','yellow','replace','TDX_ACCESS_TOKEN\x20env\x20var','config/llm-agent','parse','entries','stringify','14xzlPZK','tdx.json','11556PNUEXY','release_channel','TDX_ACCESS_TOKEN_FILE','tdx','clear','match','Warning:\x20Unknown\x20site\x20\x27','100RrXOMt','llm_default_project','source','site','config/llm-project','220XHTfUo','us01','startsWith','next','readFileSync','warn','213197qwMnXh','eu01','dev-us01','.env.','591072EowiYF','\x27,\x20defaulting\x20to\x20us01','config/account-info','.json','stg-ap03','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','proxy','read','Warning:\x20Failed\x20to\x20read\x20','apiKeys','TDX_API_KEY_','52856IeyGoc','endsWith','TDX_API_KEY\x20env\x20var'];a57_0x33e8=function(){return _0x5b5e8c;};return a57_0x33e8();}import*as a57_0x51c057 from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a57_0x31a9bb from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x3f5aee=a57_0x5be0;return process.env.TDX_CONFIG_DIR||join(homedir(),'.config',_0x3f5aee(0xc0));}export function getConfigFile(){const _0x58bc26=a57_0x5be0;return join(getConfigDir(),_0x58bc26(0xe8));}export function getConfigFilePath(_0x2e0a5a){const _0x1ec6ba=a57_0x5be0,_0x21e2d0=getConfigDir();return _0x2e0a5a?a57_0x51c057[_0x1ec6ba(0xf7)](_0x21e2d0,_0x1ec6ba(0xd2)+_0x2e0a5a):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a57_0x3a7d7b(0xc5),a57_0x3a7d7b(0xc8));export function getLLMProjectCacheFile(_0x5cc024){return llmProjectCache['path'](_0x5cc024);}export function readCachedLLMProject(_0x244627){const _0x48c619=a57_0x3a7d7b,_0x4ab919=llmProjectCache['read'](_0x244627);if(_0x4ab919&&typeof _0x4ab919['id']===_0x48c619(0xb1)&&typeof _0x4ab919[_0x48c619(0xf1)]===_0x48c619(0xb1))return _0x4ab919;return null;}export function writeCachedLLMProject(_0xbe3d31,_0x117bde,_0x5d215b){const _0x104adf=a57_0x3a7d7b;try{llmProjectCache[_0x104adf(0xaf)]({'name':_0xbe3d31,'id':_0x117bde},_0x5d215b);}catch{}}const llmAgentCache=createOptionalProfileCache(a57_0x3a7d7b(0xb3),a57_0x3a7d7b(0xb7));export function getLLMAgentCacheFile(_0x4b5e3e){const _0x338fed=a57_0x3a7d7b;return llmAgentCache[_0x338fed(0xea)](_0x4b5e3e);}export function readCachedLLMAgent(_0xf4d1cc){const _0x183c0a=a57_0x3a7d7b,_0x4874fc=llmAgentCache['read'](_0xf4d1cc);if(_0x4874fc&&typeof _0x4874fc['id']==='string'&&typeof _0x4874fc[_0x183c0a(0xf1)]==='string'&&typeof _0x4874fc['projectId']===_0x183c0a(0xb1))return _0x4874fc;return null;}export function writeCachedLLMAgent(_0x16684c,_0x106337,_0x52299c,_0x303645){const _0x2a61d0=a57_0x3a7d7b;try{llmAgentCache[_0x2a61d0(0xaf)]({'name':_0x16684c,'id':_0x106337,'projectId':_0x52299c},_0x303645);}catch{}}export function clearCachedLLMAgent(_0x20786c){const _0x3e32ca=a57_0x3a7d7b;try{llmAgentCache[_0x3e32ca(0xc1)](_0x20786c);}catch{}}const accountInfoCache=createOptionalProfileCache(a57_0x3a7d7b(0xfb),a57_0x3a7d7b(0xd5),{'suffix':a57_0x3a7d7b(0xd6)});export function getAccountInfoCacheFile(_0x486998){const _0x38370f=a57_0x3a7d7b;return accountInfoCache[_0x38370f(0xea)](_0x486998);}export function readCachedAccountInfo(_0x7b1305){const _0x59c75a=a57_0x3a7d7b,_0x2b0608=accountInfoCache[_0x59c75a(0xda)](_0x7b1305);if(_0x2b0608&&typeof _0x2b0608[_0x59c75a(0xc7)]===_0x59c75a(0xb1)&&typeof _0x2b0608['accountId']===_0x59c75a(0xb2))return _0x2b0608;return null;}export function writeCachedAccountInfo(_0x25a230,_0x147d53,_0xe2e085){const _0x3294ad=a57_0x3a7d7b;try{accountInfoCache[_0x3294ad(0xaf)]({'site':_0x25a230,'accountId':_0x147d53,'cachedAt':new Date()[_0x3294ad(0xeb)]()},_0xe2e085);}catch{}}export function parseEnvFile(_0x15c01b){const _0x39a1cc=a57_0x3a7d7b,_0x535da6={};for(const _0x46f5e3 of _0x15c01b[_0x39a1cc(0xe3)]('\x0a')){const _0x22103a=_0x46f5e3[_0x39a1cc(0xf5)]();if(!_0x22103a||_0x22103a['startsWith']('#'))continue;const _0x1074cc=_0x22103a[_0x39a1cc(0xc2)](/^([^=]+)=(.*)$/);if(_0x1074cc){const _0x76e7cc=_0x1074cc[0x1][_0x39a1cc(0xf5)]();let _0x490539=_0x1074cc[0x2]['trim']();(_0x490539[_0x39a1cc(0xcb)]('\x22')&&_0x490539['endsWith']('\x22')||_0x490539[_0x39a1cc(0xcb)]('\x27')&&_0x490539[_0x39a1cc(0xdf)]('\x27'))&&(_0x490539=_0x490539[_0x39a1cc(0xee)](0x1,-0x1)),_0x535da6[_0x76e7cc]=_0x490539;}}return _0x535da6;}export function readUserConfig(){const _0xf650d9=a57_0x3a7d7b,_0x36c68b=getConfigFile();if(!existsSync(_0x36c68b))return{};try{const _0x33fed1=readFileSync(_0x36c68b,'utf-8');return parseEnvFile(_0x33fed1);}catch(_0xeb4d7a){return console[_0xf650d9(0xce)](_0xf650d9(0xd8)+_0x36c68b+':',_0xeb4d7a),{};}}export function resolveSite(_0x2fa638){const _0x8084e6=a57_0x3a7d7b,_0x484511=[_0x8084e6(0xca),_0x8084e6(0xf2),_0x8084e6(0xd0),_0x8084e6(0xf8),'ap03',_0x8084e6(0xd1),_0x8084e6(0xfa),_0x8084e6(0xe2),_0x8084e6(0xe9),_0x8084e6(0xd7)];if(_0x484511['includes'](_0x2fa638))return _0x2fa638;if(_0x2fa638 in SITE_ALIASES)return SITE_ALIASES[_0x2fa638];return console[_0x8084e6(0xce)](_0x8084e6(0xc3)+_0x2fa638+_0x8084e6(0xd4)),_0x8084e6(0xca);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x4a3a06){const _0x1ea59b=a57_0x3a7d7b,_0x5e792c=_0x4a3a06||getActiveProfileName()||undefined;if(_0x5e792c){const _0x3ba206='TDX_ACCESS_TOKEN_'+normalizeProfileForEnvVar(_0x5e792c);if(process.env[_0x3ba206])return{'accessToken':process.env[_0x3ba206],'source':_0x3ba206+_0x1ea59b(0xf0)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x1ea59b(0xb6)};if(process.env.TDX_ACCESS_TOKEN_FILE){const _0x243ca6=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x243ca6)return{'accessToken':_0x243ca6,'source':_0x1ea59b(0xbf)};}return null;}function readAccessTokenFile(_0x526e91){const _0x565d71=a57_0x3a7d7b;try{const _0x56b71e=readFileSync(_0x526e91,'utf-8')[_0x565d71(0xf5)]();return _0x56b71e||null;}catch{return null;}}export function getAccessToken(_0x2eedad){return resolveAccessToken(_0x2eedad)?.['accessToken'];}export function getAPIKey(_0x57332e){const _0x1e5644=a57_0x3a7d7b,_0x5b2b13=_0x57332e||getActiveProfileName();if(_0x5b2b13){const _0x138306=_0x1e5644(0xdd)+normalizeProfileForEnvVar(_0x5b2b13);if(process.env[_0x138306])return process.env[_0x138306];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x125cac){const _0x273593=a57_0x3a7d7b;return _0x125cac[_0x273593(0xae)]()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x196b6f,_0x3dcbaa){const _0x2d913d=a57_0x3a7d7b,_0x542f74=resolveAccessToken(_0x3dcbaa);if(_0x542f74)return{'apiKey':_0x542f74[_0x2d913d(0xe7)],'source':_0x542f74[_0x2d913d(0xc6)],'isDeprecated':![]};const _0x45cca5=_0x3dcbaa||getActiveProfileName()||undefined;if(_0x45cca5){const _0x4a17f9=_0x2d913d(0xdd)+normalizeProfileForEnvVar(_0x45cca5);if(process.env[_0x4a17f9])return{'apiKey':process.env[_0x4a17f9],'source':_0x4a17f9+'\x20env\x20var','isDeprecated':![]};const _0x7cdefe=getCachedCredential(_0x196b6f,_0x45cca5);if(_0x7cdefe)return{'apiKey':_0x7cdefe,'source':_0x2d913d(0xed)+_0x45cca5+')','isDeprecated':![]};const _0x3c9e26=await getKeychainAPIKey(_0x45cca5);if(_0x3c9e26)return setCachedCredential(_0x3c9e26,_0x196b6f,_0x45cca5),{'apiKey':_0x3c9e26,'source':_0x2d913d(0xed)+_0x45cca5+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x2d913d(0xe0),'isDeprecated':![]};if(!_0x45cca5){const _0x412ee0=getCachedCredential(_0x196b6f,undefined);if(_0x412ee0)return{'apiKey':_0x412ee0,'source':_0x2d913d(0xad),'isDeprecated':![]};const _0x15413f=await getKeychainAPIKey(undefined);if(_0x15413f)return setCachedCredential(_0x15413f,_0x196b6f,undefined),{'apiKey':_0x15413f,'source':_0x2d913d(0xad),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x3064c7,_0x46b5f7){const _0x19bb13=a57_0x3a7d7b,_0x36ffa6=await resolveAPIKeyAsync(_0x3064c7,_0x46b5f7);return _0x36ffa6?.[_0x19bb13(0xec)];}function cleanupLegacyEnvFile(_0x55d30a){const _0x3c6e2e=a57_0x3a7d7b;if(!existsSync(_0x55d30a))return![];try{const _0x2af8ff=readFileSync(_0x55d30a,'utf-8'),_0x2be82c=_0x2af8ff[_0x3c6e2e(0xe3)]('\x0a'),_0x404651=_0x2be82c['filter'](_0x14f887=>{const _0x6583c7=_0x3c6e2e,_0x300acb=_0x14f887['trim']();if(!_0x300acb||_0x300acb[_0x6583c7(0xcb)]('#'))return!![];const [_0x3bd829]=_0x300acb['split']('=');return!_0x3bd829[_0x6583c7(0xcb)](_0x6583c7(0xe4));}),_0x3dac0d=_0x404651['some'](_0x4bb183=>{const _0xea1e72=_0x3c6e2e,_0x355a8b=_0x4bb183[_0xea1e72(0xf5)]();return _0x355a8b&&!_0x355a8b[_0xea1e72(0xcb)]('#');});if(!_0x3dac0d)return unlinkSync(_0x55d30a),!![];return writeFileSync(_0x55d30a,_0x404651[_0x3c6e2e(0xf7)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x217a5c=a57_0x3a7d7b;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x1ecfcc=a57_0x51c057['join'](getConfigDir(),'tdx.json');if(!a57_0x3140aa[_0x217a5c(0xe5)](_0x1ecfcc))return null;try{const _0x32466c=a57_0x3140aa[_0x217a5c(0xcd)](_0x1ecfcc,_0x217a5c(0xfc)),_0x42dfff=JSON[_0x217a5c(0xb8)](_0x32466c);return _0x42dfff[_0x217a5c(0xf6)]||null;}catch{return null;}}export function saveAPIKey(_0x53c8de,_0x56b598,_0x29dc9a){const _0x5b47bd=a57_0x3a7d7b,_0x47ad4a=getConfigDir(),_0x42fece=getConfigFilePath(_0x29dc9a);!existsSync(_0x47ad4a)&&mkdirSync(_0x47ad4a,{'recursive':!![],'mode':0x1c0});let _0x5d566f={};if(existsSync(_0x42fece))try{const _0x1d34de=readFileSync(_0x42fece,_0x5b47bd(0xfc));_0x5d566f=parseEnvFile(_0x1d34de);}catch(_0x4d1ab2){console['warn'](_0x5b47bd(0xdb)+_0x42fece+':',_0x4d1ab2);}const _0x12c689=_0x53c8de[_0x5b47bd(0xae)]()[_0x5b47bd(0xb5)](/-/g,'_');_0x5d566f[_0x5b47bd(0xf3)+_0x12c689]=_0x56b598;const _0x545c2f=Object[_0x5b47bd(0xb9)](_0x5d566f)[_0x5b47bd(0xef)](([_0x179dc9,_0x50e748])=>_0x179dc9+'='+_0x50e748);writeFileSync(_0x42fece,_0x545c2f[_0x5b47bd(0xf7)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x23bb4a,_0x5eaab0,_0x115593){const _0x1041d6=a57_0x3a7d7b;await saveKeychainAPIKey(_0x23bb4a,_0x115593),setCachedCredential(_0x23bb4a,_0x5eaab0,_0x115593);const _0x2eab1f=getConfigFilePath(_0x115593);cleanupLegacyEnvFile(_0x2eab1f)&&console[_0x1041d6(0xce)](a57_0x31a9bb[_0x1041d6(0xb4)](_0x1041d6(0xe1)));}export function loadConfig(){const _0x233567=a57_0x3a7d7b,_0x178718={'apiKeys':{},'defaultSite':_0x233567(0xca)},_0x21960b=['us01',_0x233567(0xf2),'eu01',_0x233567(0xf8),'ap03',_0x233567(0xd1),_0x233567(0xfa),'stg-us01',_0x233567(0xe9),_0x233567(0xd7)],_0x41596b=getAPIKey();if(_0x41596b)for(const _0x2a0347 of _0x21960b){_0x178718[_0x233567(0xdc)][_0x2a0347]=_0x41596b;}return _0x178718;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}function a57_0x5be0(_0x11bc4f,_0x6a46df){_0x11bc4f=_0x11bc4f-0xad;const _0x33e819=a57_0x33e8();let _0x5be0e7=_0x33e819[_0x11bc4f];return _0x5be0e7;}export function loadGlobalProxy(){const _0x24a180=a57_0x3a7d7b,_0x7a509c=a57_0x51c057['join'](getConfigDir(),_0x24a180(0xbc));if(!a57_0x3140aa['existsSync'](_0x7a509c))return undefined;try{const _0xbcbd02=a57_0x3140aa[_0x24a180(0xcd)](_0x7a509c,'utf-8'),_0x41877b=JSON['parse'](_0xbcbd02);return typeof _0x41877b[_0x24a180(0xd9)]===_0x24a180(0xb1)?_0x41877b[_0x24a180(0xd9)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x277b2e=a57_0x3a7d7b,_0x1a1989=process.env.TDX_RELEASE_CHANNEL;if(_0x1a1989===_0x277b2e(0xcc)||_0x1a1989===_0x277b2e(0xe6))return _0x1a1989;const _0x54032b=a57_0x51c057[_0x277b2e(0xf7)](getConfigDir(),'tdx.json');if(!a57_0x3140aa[_0x277b2e(0xe5)](_0x54032b))return _0x277b2e(0xe6);try{const _0x298e5a=a57_0x3140aa[_0x277b2e(0xcd)](_0x54032b,_0x277b2e(0xfc)),_0x474cf6=JSON[_0x277b2e(0xb8)](_0x298e5a);if(_0x474cf6[_0x277b2e(0xbe)]===_0x277b2e(0xcc))return'next';}catch{}return _0x277b2e(0xe6);}export function saveReleaseChannel(_0x3008bf){const _0x58c9cd=a57_0x3a7d7b,_0x1368c8=getConfigDir(),_0xd091e3=a57_0x51c057[_0x58c9cd(0xf7)](_0x1368c8,'tdx.json');!existsSync(_0x1368c8)&&mkdirSync(_0x1368c8,{'recursive':!![],'mode':0x1c0});let _0x1437d8={};if(existsSync(_0xd091e3))try{const _0x112e6f=readFileSync(_0xd091e3,_0x58c9cd(0xfc));_0x1437d8=JSON[_0x58c9cd(0xb8)](_0x112e6f);}catch{}_0x1437d8['release_channel']=_0x3008bf,writeFileSync(_0xd091e3,JSON[_0x58c9cd(0xba)](_0x1437d8,null,0x2),{'mode':0x180});}
@@ -1 +1 @@
1
- const a58_0x16aebe=a58_0x3d83;(function(_0x5ec793,_0x33d488){const _0x3886cc=a58_0x3d83,_0x34afb7=_0x5ec793();while(!![]){try{const _0x7dbc4c=-parseInt(_0x3886cc(0xed))/0x1*(parseInt(_0x3886cc(0xe3))/0x2)+-parseInt(_0x3886cc(0xe8))/0x3+-parseInt(_0x3886cc(0xeb))/0x4*(-parseInt(_0x3886cc(0xe4))/0x5)+-parseInt(_0x3886cc(0xe9))/0x6+parseInt(_0x3886cc(0xee))/0x7+parseInt(_0x3886cc(0xe2))/0x8*(parseInt(_0x3886cc(0xec))/0x9)+parseInt(_0x3886cc(0xe7))/0xa;if(_0x7dbc4c===_0x33d488)break;else _0x34afb7['push'](_0x34afb7['shift']());}catch(_0x221c80){_0x34afb7['push'](_0x34afb7['shift']());}}}(a58_0xe214,0xdf9df));function a58_0x3d83(_0x1fd5cb,_0x4d912d){_0x1fd5cb=_0x1fd5cb-0xe2;const _0xe214d8=a58_0xe214();let _0x3d837d=_0xe214d8[_0x1fd5cb];return _0x3d837d;}function a58_0xe214(){const _0x58ff42=['connections','997456QqMPIw','1925898STjibj','3490YSqIkj','core/connection-cache','now','18194960xxsGBm','2582136ofCJWY','6246654YqnRbb','write','5112YfXJpJ','27pxIPLD','1LcVPlv','4865833zBmmBa'];a58_0xe214=function(){return _0x58ff42;};return a58_0xe214();}import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache('connections-{profile}.json',a58_0x16aebe(0xe5));export function loadCachedConnections(_0x28fad2){const _0xe6b94e=a58_0x16aebe,_0x4a7c09=connectionCache['read'](_0x28fad2);return _0x4a7c09?.[_0xe6b94e(0xef)]??null;}export function saveCachedConnections(_0x15138e,_0x1df014){const _0x411912=a58_0x16aebe;connectionCache[_0x411912(0xea)](_0x15138e,{'connections':_0x1df014,'cachedAt':Date[_0x411912(0xe6)]()});}export function clearConnectionCache(_0x137a64){connectionCache['clear'](_0x137a64);}
1
+ function a58_0x2d9c(_0x3b0da1,_0x3c6d12){_0x3b0da1=_0x3b0da1-0x198;const _0xeb4b5d=a58_0xeb4b();let _0x2d9cdc=_0xeb4b5d[_0x3b0da1];return _0x2d9cdc;}const a58_0x565555=a58_0x2d9c;(function(_0x5e3182,_0x8791e6){const _0xbcd922=a58_0x2d9c,_0x501dc7=_0x5e3182();while(!![]){try{const _0x1374b0=parseInt(_0xbcd922(0x1a5))/0x1+parseInt(_0xbcd922(0x1a1))/0x2+parseInt(_0xbcd922(0x1a9))/0x3+-parseInt(_0xbcd922(0x19d))/0x4*(parseInt(_0xbcd922(0x19b))/0x5)+parseInt(_0xbcd922(0x1a4))/0x6*(parseInt(_0xbcd922(0x19c))/0x7)+-parseInt(_0xbcd922(0x1a3))/0x8*(-parseInt(_0xbcd922(0x199))/0x9)+-parseInt(_0xbcd922(0x19e))/0xa*(parseInt(_0xbcd922(0x1a7))/0xb);if(_0x1374b0===_0x8791e6)break;else _0x501dc7['push'](_0x501dc7['shift']());}catch(_0x1d22ac){_0x501dc7['push'](_0x501dc7['shift']());}}}(a58_0xeb4b,0xd59f3));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a58_0x565555(0x19a),a58_0x565555(0x1a2));export function loadCachedConnections(_0xce24a8){const _0x2f1a47=a58_0x565555,_0x1a944f=connectionCache[_0x2f1a47(0x1a8)](_0xce24a8);return _0x1a944f?.[_0x2f1a47(0x198)]??null;}export function saveCachedConnections(_0x530e5a,_0x813f77){const _0x42ed35=a58_0x565555;connectionCache[_0x42ed35(0x1a0)](_0x530e5a,{'connections':_0x813f77,'cachedAt':Date[_0x42ed35(0x19f)]()});}export function clearConnectionCache(_0xce5c50){const _0x1be126=a58_0x565555;connectionCache[_0x1be126(0x1a6)](_0xce5c50);}function a58_0xeb4b(){const _0x35d1b2=['connections','80559cNDZHr','connections-{profile}.json','716665LGBgSB','7NYhHdg','40ZoEhcI','10QAMbyH','now','write','2182044TXsFDF','core/connection-cache','104yJfCEx','727026IDiOKN','1380372rGvRBp','clear','5469959DrmOhT','read','289998zEQbsv'];a58_0xeb4b=function(){return _0x35d1b2;};return a58_0xeb4b();}
@@ -1 +1 @@
1
- const a59_0x2a1550=a59_0x1234;(function(_0xf3f00a,_0x3eeca6){const _0x16cf0c=a59_0x1234,_0x55a0d1=_0xf3f00a();while(!![]){try{const _0x413d35=-parseInt(_0x16cf0c(0xb2))/0x1+-parseInt(_0x16cf0c(0x9d))/0x2*(-parseInt(_0x16cf0c(0xab))/0x3)+parseInt(_0x16cf0c(0xa3))/0x4+parseInt(_0x16cf0c(0x9e))/0x5*(parseInt(_0x16cf0c(0xa6))/0x6)+parseInt(_0x16cf0c(0xb5))/0x7*(-parseInt(_0x16cf0c(0xb0))/0x8)+parseInt(_0x16cf0c(0xb6))/0x9*(-parseInt(_0x16cf0c(0xad))/0xa)+-parseInt(_0x16cf0c(0xac))/0xb*(-parseInt(_0x16cf0c(0xa0))/0xc);if(_0x413d35===_0x3eeca6)break;else _0x55a0d1['push'](_0x55a0d1['shift']());}catch(_0x2d964b){_0x55a0d1['push'](_0x55a0d1['shift']());}}}(a59_0x2d7b,0xd98b8));import a59_0x3f59ea from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x3f2e26,_0xfb9432){if(_0x3f2e26===undefined)return _0xfb9432;if(typeof _0x3f2e26==='number')return _0x3f2e26;return parseInt(_0x3f2e26,0xa);}function a59_0x2d7b(){const _0xd91930=['36YAswXr','us\x20\x20\x20-\x20United\x20States','other','ap01','findIndex','test','log','site','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','346WLOoqU','125rSTEPH','Select\x20your\x20Treasure\x20Data\x20site:','756uazKaA','push','Enter\x20site\x20name:','85548lIIMYF','eu01','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','382362xBRQlP','customSite','Site\x20name\x20cannot\x20be\x20empty','trim','value','6162Emrslj','181137NhfEqe','604780AZxGJL','eu\x20\x20\x20-\x20Europe','select','7824Oodjei','ap02\x20-\x20Korea','795615GZzawd','us01','ap02','7721uheXZm'];a59_0x2d7b=function(){return _0xd91930;};return a59_0x2d7b();}function a59_0x1234(_0x492723,_0x4fcbe8){_0x492723=_0x492723-0x9a;const _0x2d7bc6=a59_0x2d7b();let _0x123463=_0x2d7bc6[_0x492723];return _0x123463;}export const STANDARD_SITE_CHOICES=[{'title':a59_0x2a1550(0xb7),'value':a59_0x2a1550(0xb3)},{'title':'jp\x20\x20\x20-\x20Japan','value':a59_0x2a1550(0xb9)},{'title':a59_0x2a1550(0xae),'value':a59_0x2a1550(0xa4)},{'title':a59_0x2a1550(0xb1),'value':a59_0x2a1550(0xb4)}];export function buildSiteChoices(_0x45ba7e){const _0x5e816f=a59_0x2a1550,_0x2a72d1=[...STANDARD_SITE_CHOICES];let _0x3fa906=_0x2a72d1[_0x5e816f(0xba)](_0x412d65=>_0x412d65[_0x5e816f(0xaa)]===_0x45ba7e);return _0x3fa906===-0x1&&_0x45ba7e!=='us01'&&(_0x2a72d1['push']({'title':_0x45ba7e,'value':_0x45ba7e}),_0x3fa906=_0x2a72d1['length']-0x1),_0x2a72d1[_0x5e816f(0xa1)]({'title':'Enter\x20custom\x20site','value':_0x5e816f(0xb8)}),{'choices':_0x2a72d1,'initialIndex':_0x3fa906>=0x0?_0x3fa906:0x0};}export async function promptSiteSelection(_0xaffd77,_0xd73db2,_0x417389='Cancelled'){const _0x36a633=a59_0x2a1550,{choices:_0x4d31a9,initialIndex:_0x27890b}=buildSiteChoices(_0xaffd77),_0x2f2eab=_0xd73db2?_0x36a633(0x9c)+_0xd73db2+'):':_0x36a633(0x9f),_0x26c98b=await a59_0x3f59ea({'type':_0x36a633(0xaf),'name':_0x36a633(0x9b),'message':_0x2f2eab,'choices':_0x4d31a9,'initial':_0x27890b});if(!_0x26c98b[_0x36a633(0x9b)])return console[_0x36a633(0x9a)]('\x0a'+_0x417389),null;if(_0x26c98b['site']!=='other')return _0x26c98b[_0x36a633(0x9b)];const _0x4a5294=await a59_0x3f59ea({'type':'text','name':_0x36a633(0xa7),'message':_0x36a633(0xa2),'initial':_0x36a633(0xb3),'validate':_0x36a49=>{const _0x25963b=_0x36a633;if(!_0x36a49||!_0x36a49[_0x25963b(0xa9)]())return _0x25963b(0xa8);if(!/^[a-z0-9-]+$/[_0x25963b(0xbb)](_0x36a49[_0x25963b(0xa9)]()))return _0x25963b(0xa5);return!![];}});if(!_0x4a5294[_0x36a633(0xa7)])return console[_0x36a633(0x9a)]('\x0a'+_0x417389),null;return _0x4a5294[_0x36a633(0xa7)];}
1
+ const a59_0x4a3c10=a59_0x537d;(function(_0x13b47e,_0x5c35a5){const _0x46778f=a59_0x537d,_0x316cdd=_0x13b47e();while(!![]){try{const _0x3bc965=parseInt(_0x46778f(0x103))/0x1+-parseInt(_0x46778f(0xfa))/0x2*(parseInt(_0x46778f(0x109))/0x3)+-parseInt(_0x46778f(0x10c))/0x4*(-parseInt(_0x46778f(0x101))/0x5)+-parseInt(_0x46778f(0x102))/0x6*(-parseInt(_0x46778f(0x10e))/0x7)+-parseInt(_0x46778f(0x10a))/0x8*(-parseInt(_0x46778f(0x10f))/0x9)+-parseInt(_0x46778f(0x100))/0xa+-parseInt(_0x46778f(0xf8))/0xb;if(_0x3bc965===_0x5c35a5)break;else _0x316cdd['push'](_0x316cdd['shift']());}catch(_0x216d69){_0x316cdd['push'](_0x316cdd['shift']());}}}(a59_0x22f0,0x80257));import a59_0xcc979b from'prompts';function a59_0x22f0(){const _0x1aea33=['ap02','findIndex','length','11211phqrOR','5161112iftdmw','ap01','136hXsZVP','push','63buNMTB','9KjFstZ','site','Enter\x20site\x20name:','jp\x20\x20\x20-\x20Japan','number','test','customSite','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','eu\x20\x20\x20-\x20Europe','5530393cfyCTk','trim','136TUWIrH','log','us01','Enter\x20custom\x20site','eu01','select','10137850mydswT','148105pEAMnj','395028VETyVN','50756sDtLFr','ap02\x20-\x20Korea','other'];a59_0x22f0=function(){return _0x1aea33;};return a59_0x22f0();}export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x5e0164,_0x4bbb51){const _0x2c5685=a59_0x537d;if(_0x5e0164===undefined)return _0x4bbb51;if(typeof _0x5e0164===_0x2c5685(0x113))return _0x5e0164;return parseInt(_0x5e0164,0xa);}export const STANDARD_SITE_CHOICES=[{'title':'us\x20\x20\x20-\x20United\x20States','value':a59_0x4a3c10(0xfc)},{'title':a59_0x4a3c10(0x112),'value':a59_0x4a3c10(0x10b)},{'title':a59_0x4a3c10(0xf7),'value':a59_0x4a3c10(0xfe)},{'title':a59_0x4a3c10(0x104),'value':a59_0x4a3c10(0x106)}];function a59_0x537d(_0x257812,_0x3402db){_0x257812=_0x257812-0xf5;const _0x22f0bd=a59_0x22f0();let _0x537d36=_0x22f0bd[_0x257812];return _0x537d36;}export function buildSiteChoices(_0x27c26a){const _0x2e93a8=a59_0x4a3c10,_0x3a771b=[...STANDARD_SITE_CHOICES];let _0x1125d9=_0x3a771b[_0x2e93a8(0x107)](_0xdab59a=>_0xdab59a['value']===_0x27c26a);return _0x1125d9===-0x1&&_0x27c26a!=='us01'&&(_0x3a771b['push']({'title':_0x27c26a,'value':_0x27c26a}),_0x1125d9=_0x3a771b[_0x2e93a8(0x108)]-0x1),_0x3a771b[_0x2e93a8(0x10d)]({'title':_0x2e93a8(0xfd),'value':'other'}),{'choices':_0x3a771b,'initialIndex':_0x1125d9>=0x0?_0x1125d9:0x0};}export async function promptSiteSelection(_0x42f72a,_0x4c6812,_0x304264='Cancelled'){const _0x20cc02=a59_0x4a3c10,{choices:_0x12e774,initialIndex:_0x45b3f3}=buildSiteChoices(_0x42f72a),_0x1a79b4=_0x4c6812?'Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20'+_0x4c6812+'):':'Select\x20your\x20Treasure\x20Data\x20site:',_0x41c3d2=await a59_0xcc979b({'type':_0x20cc02(0xff),'name':_0x20cc02(0x110),'message':_0x1a79b4,'choices':_0x12e774,'initial':_0x45b3f3});if(!_0x41c3d2[_0x20cc02(0x110)])return console[_0x20cc02(0xfb)]('\x0a'+_0x304264),null;if(_0x41c3d2['site']!==_0x20cc02(0x105))return _0x41c3d2[_0x20cc02(0x110)];const _0x3d3a6a=await a59_0xcc979b({'type':'text','name':_0x20cc02(0xf5),'message':_0x20cc02(0x111),'initial':_0x20cc02(0xfc),'validate':_0x5da5b8=>{const _0x49774e=_0x20cc02;if(!_0x5da5b8||!_0x5da5b8[_0x49774e(0xf9)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0x49774e(0x114)](_0x5da5b8[_0x49774e(0xf9)]()))return _0x49774e(0xf6);return!![];}});if(!_0x3d3a6a[_0x20cc02(0xf5)])return console['log']('\x0a'+_0x304264),null;return _0x3d3a6a[_0x20cc02(0xf5)];}
@@ -1 +1 @@
1
- (function(_0x55365f,_0x489b5a){const _0x283978=a60_0x29f2,_0x295a1a=_0x55365f();while(!![]){try{const _0x563e84=parseInt(_0x283978(0x89))/0x1+parseInt(_0x283978(0x93))/0x2+-parseInt(_0x283978(0x8b))/0x3+parseInt(_0x283978(0x92))/0x4+parseInt(_0x283978(0x8e))/0x5+-parseInt(_0x283978(0x95))/0x6*(-parseInt(_0x283978(0x94))/0x7)+parseInt(_0x283978(0x99))/0x8*(-parseInt(_0x283978(0x91))/0x9);if(_0x563e84===_0x489b5a)break;else _0x295a1a['push'](_0x295a1a['shift']());}catch(_0x2b92fc){_0x295a1a['push'](_0x295a1a['shift']());}}}(a60_0x4edb,0x767a2));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x118213,_0x31ac22){const _0x53a903=a60_0x29f2,_0x30b79b=_0x118213||_0x53a903(0x8d),_0x50fc86=_0x31ac22||_0x53a903(0x8c);return _0x30b79b+':'+_0x50fc86;}function a60_0x29f2(_0x168e15,_0x22ecb7){_0x168e15=_0x168e15-0x88;const _0x4edb3c=a60_0x4edb();let _0x29f291=_0x4edb3c[_0x168e15];return _0x29f291;}function a60_0x4edb(){const _0x384806=['__default_site__','2793415IJVZzV','now','delete','533700GEBtok','2990460WkNUyZ','556148gMMcHp','1483391OgFQdy','6WHBMfn','clear','apiKey','loadedAt','176KwbYnp','get','949139qjOAOb','set','2866626CGmflN','__default_profile__'];a60_0x4edb=function(){return _0x384806;};return a60_0x4edb();}export function getCachedCredential(_0x2daddd,_0x2b36f8){const _0x13bc27=a60_0x29f2,_0x1ed9eb=getCacheKey(_0x2daddd,_0x2b36f8),_0x42c42f=cache[_0x13bc27(0x88)](_0x1ed9eb);if(!_0x42c42f)return null;if(Date[_0x13bc27(0x8f)]()-_0x42c42f[_0x13bc27(0x98)]>CACHE_TTL_MS)return cache[_0x13bc27(0x90)](_0x1ed9eb),null;return _0x42c42f[_0x13bc27(0x97)];}export function setCachedCredential(_0x4546d2,_0x159ce8,_0x1d5c72){const _0xf75d9f=a60_0x29f2,_0x4e00db=getCacheKey(_0x159ce8,_0x1d5c72);cache[_0xf75d9f(0x8a)](_0x4e00db,{'apiKey':_0x4546d2,'loadedAt':Date['now']()});}export function clearCredentialCache(){const _0x19d09a=a60_0x29f2;cache[_0x19d09a(0x96)]();}export function clearCachedCredential(_0x3577e1,_0x2a2f3d){const _0x32448a=a60_0x29f2,_0x33ab25=getCacheKey(_0x3577e1,_0x2a2f3d);cache[_0x32448a(0x90)](_0x33ab25);}
1
+ (function(_0x182366,_0x2fb84b){const _0x4b141f=a60_0x3f57,_0x1d3102=_0x182366();while(!![]){try{const _0x170f8f=parseInt(_0x4b141f(0x10a))/0x1*(parseInt(_0x4b141f(0x10b))/0x2)+parseInt(_0x4b141f(0x10d))/0x3*(-parseInt(_0x4b141f(0x104))/0x4)+parseInt(_0x4b141f(0x105))/0x5*(-parseInt(_0x4b141f(0x101))/0x6)+-parseInt(_0x4b141f(0x103))/0x7*(-parseInt(_0x4b141f(0x102))/0x8)+parseInt(_0x4b141f(0xff))/0x9+-parseInt(_0x4b141f(0x106))/0xa+-parseInt(_0x4b141f(0x10c))/0xb*(parseInt(_0x4b141f(0xfe))/0xc);if(_0x170f8f===_0x2fb84b)break;else _0x1d3102['push'](_0x1d3102['shift']());}catch(_0x4fb482){_0x1d3102['push'](_0x1d3102['shift']());}}}(a60_0x493a,0x4ea96));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a60_0x493a(){const _0x479458=['16PhfmlT','1895264oTPbcs','12YUQtVY','1810PmbNqW','519040QxNqnm','get','loadedAt','delete','591001XaYfxp','2YKCghv','4246XnLgSa','581043VpDSVX','now','clear','set','5028Xfmshj','5114520skWyFq','apiKey','9678hlCGiK'];a60_0x493a=function(){return _0x479458;};return a60_0x493a();}function getCacheKey(_0x3c9b8d,_0x13a30d){const _0x1bf85e=_0x3c9b8d||'__default_site__',_0x5cbb69=_0x13a30d||'__default_profile__';return _0x1bf85e+':'+_0x5cbb69;}export function getCachedCredential(_0x591b3c,_0x2d6e4d){const _0x37dfec=a60_0x3f57,_0x3b61e1=getCacheKey(_0x591b3c,_0x2d6e4d),_0x1e568e=cache[_0x37dfec(0x107)](_0x3b61e1);if(!_0x1e568e)return null;if(Date[_0x37dfec(0x10e)]()-_0x1e568e[_0x37dfec(0x108)]>CACHE_TTL_MS)return cache[_0x37dfec(0x109)](_0x3b61e1),null;return _0x1e568e[_0x37dfec(0x100)];}export function setCachedCredential(_0x2cb439,_0x1de618,_0x4e8248){const _0x24f474=a60_0x3f57,_0x27893b=getCacheKey(_0x1de618,_0x4e8248);cache[_0x24f474(0xfd)](_0x27893b,{'apiKey':_0x2cb439,'loadedAt':Date[_0x24f474(0x10e)]()});}export function clearCredentialCache(){const _0x254153=a60_0x3f57;cache[_0x254153(0x10f)]();}function a60_0x3f57(_0xe09085,_0x2f3b69){_0xe09085=_0xe09085-0xfd;const _0x493a1f=a60_0x493a();let _0x3f57d3=_0x493a1f[_0xe09085];return _0x3f57d3;}export function clearCachedCredential(_0x43e47f,_0x4dbdbc){const _0x3c809c=getCacheKey(_0x43e47f,_0x4dbdbc);cache['delete'](_0x3c809c);}
@@ -1 +1 @@
1
- const a61_0x33091b=a61_0x5f43;(function(_0x1a9d18,_0x5b5765){const _0x403023=a61_0x5f43,_0x26567e=_0x1a9d18();while(!![]){try{const _0x4e788a=parseInt(_0x403023(0xd4))/0x1+-parseInt(_0x403023(0xc9))/0x2+-parseInt(_0x403023(0x98))/0x3+-parseInt(_0x403023(0xbf))/0x4+parseInt(_0x403023(0xb2))/0x5+-parseInt(_0x403023(0x9c))/0x6+parseInt(_0x403023(0xcf))/0x7;if(_0x4e788a===_0x5b5765)break;else _0x26567e['push'](_0x26567e['shift']());}catch(_0x46e28f){_0x26567e['push'](_0x26567e['shift']());}}}(a61_0x2ac8,0xcf8a3));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';import{getOAuthTokens,saveOAuthTokens}from'./oauth-keychain.js';function a61_0x2ac8(){const _0x5fa1d3=['site','Global\x20Credentials','activeProfile','CLI\x20flag:\x20--','config','join','us01','cli','composableAudience','resolveAPIKeyAsync','bold','loadGlobalConfig','llm_agent','log','INFO','composable_audience','Global','readFileSync','layers','env','[configuration\x20files]','workflow_project','2974449ilSEfn','verbose','string','[context]','6795486PlReeb','Session','now','getSource','profile','logLevel','parse','utf-8','segmentPath','proxy','sessionId','profileSource','parentSegment','accessToken','global','expires_at','llm_project','Profile','existsSync','getParameters','database','project','8293700biIVAy','llmAgent','(using\x20session:\x20','none','parent_segment','default','Project','configFiles','segment_path','workflowProject','tdx.json','llmProject','Profile\x20Credentials','2633644ZFrfHy','(active)','session','.env','cliFlags','profile:\x20','dim','profiles','assign','green','1530520msqyxL','sessions','displayWithSources','profileCredentials','createAsync','access_token','10615164cFPMVv','apiKey','cyan','refresh_token','replace','1222626uxGtSf','display'];a61_0x2ac8=function(){return _0x5fa1d3;};return a61_0x2ac8();}function a61_0x5f43(_0x1420ff,_0x2a6992){_0x1420ff=_0x1420ff-0x92;const _0x2ac887=a61_0x2ac8();let _0x5f438c=_0x2ac887[_0x1420ff];return _0x5f438c;}import{refreshAccessToken}from'../sdk/client/oauth-refresh.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a61_0x5d20a4 from'node:fs';import*as a61_0x2a17cf from'node:path';import a61_0x1c1f89 from'chalk';export class GlobalContext{[a61_0x33091b(0xd6)];[a61_0x33091b(0xb0)];[a61_0x33091b(0xb6)];[a61_0x33091b(0xba)];[a61_0x33091b(0xac)];[a61_0x33091b(0xe2)];['workflow_project'];[a61_0x33091b(0xe5)];[a61_0x33091b(0xd0)];[a61_0x33091b(0xa9)];['proxy'];[a61_0x33091b(0x99)];['logLevel'];[a61_0x33091b(0xa0)];['profileSource']=null;[a61_0x33091b(0x94)];['activeProfile'];[a61_0x33091b(0xa6)];[a61_0x33091b(0xb9)];constructor(_0x3cbb8e){const _0x3e9368=a61_0x33091b;this['sessionId']=getSessionID(_0x3cbb8e[_0x3e9368(0xc1)]);const _0x4e188a=loadSessionContext(_0x3cbb8e['session']),_0x1c19d9=loadProjectConfig(),_0x31952c=this[_0x3e9368(0xe1)]();if(_0x3cbb8e[_0x3e9368(0xa0)])this[_0x3e9368(0xd8)]=_0x3cbb8e[_0x3e9368(0xa0)],this['profileSource']=_0x3e9368(0xdd);else{if(_0x4e188a?.['profile'])this[_0x3e9368(0xd8)]=_0x4e188a['profile'],this[_0x3e9368(0xa7)]='session';else{if(_0x31952c['profile'])this[_0x3e9368(0xd8)]=_0x31952c[_0x3e9368(0xa0)],this[_0x3e9368(0xa7)]=_0x3e9368(0xda);else process.env.TDX_PROFILE?(this['activeProfile']=process.env.TDX_PROFILE,this[_0x3e9368(0xa7)]=_0x3e9368(0x95)):(this[_0x3e9368(0xd8)]=null,this[_0x3e9368(0xa7)]=null);}}const _0x20176e=this[_0x3e9368(0xd8)]?loadProfile(this[_0x3e9368(0xd8)]):null,_0x2ea314=_0x320afa=>{const _0x1a428b=_0x3e9368;if(!_0x320afa)return{};const _0x133003=_0x320afa,_0x5619b5={};for(const [_0x112d9a,_0x48e506]of Object['entries'](_0x133003)){typeof _0x48e506===_0x1a428b(0x9a)&&(_0x5619b5[_0x112d9a]=_0x48e506);}return _0x5619b5;},_0x137159={},_0x182677=(_0x4a41d0,_0xf39c9b,_0x115604)=>{const _0x18772c=_0x3e9368;if(!_0x4a41d0)return![];if(_0x115604&&_0x4a41d0===_0x115604)return![];const _0x3c8a62=_0x4e188a,_0x2d6e92=_0x1c19d9,_0x224b7a=_0x20176e?.[_0x18772c(0xda)],_0x2181fb=_0x31952c,_0x1a04c2=_0x3c8a62?.[_0xf39c9b],_0xe966ab=_0x2d6e92?.[_0xf39c9b],_0x1d5023=_0x224b7a?.[_0xf39c9b],_0x258e20=_0x2181fb[_0xf39c9b];return _0x4a41d0!==_0x1a04c2&&_0x4a41d0!==_0xe966ab&&_0x4a41d0!==_0x1d5023&&_0x4a41d0!==_0x258e20;},_0x4e71ca=[{'optionKey':_0x3e9368(0xd6),'contextKey':_0x3e9368(0xd6),'defaultValue':'us01'},{'optionKey':_0x3e9368(0xb0),'contextKey':_0x3e9368(0xb0)},{'optionKey':_0x3e9368(0xa8),'contextKey':_0x3e9368(0xb6)},{'optionKey':'llmProject','contextKey':'llm_project'},{'optionKey':_0x3e9368(0xb3),'contextKey':_0x3e9368(0xe2)},{'optionKey':_0x3e9368(0xde),'contextKey':'composable_audience'},{'optionKey':_0x3e9368(0xa0),'contextKey':_0x3e9368(0xa0)}];for(const {optionKey:_0x41ee07,contextKey:_0x20f982,defaultValue:_0x5b7a9e}of _0x4e71ca){const _0x146b1c=_0x3cbb8e[_0x41ee07];_0x182677(_0x146b1c,_0x20f982,_0x5b7a9e)&&(_0x137159[_0x20f982]=_0x146b1c);}this[_0x3e9368(0x94)]={'cliFlags':_0x137159,'session':_0x2ea314(_0x4e188a),'project':_0x2ea314(_0x1c19d9),'profile':_0x2ea314(_0x20176e?.[_0x3e9368(0xda)]),'global':_0x2ea314(_0x31952c)};const _0x4744e5={...this[_0x3e9368(0x94)][_0x3e9368(0xaa)],...this[_0x3e9368(0x94)][_0x3e9368(0xa0)],...this[_0x3e9368(0x94)][_0x3e9368(0xb1)]};process.env.TDX_SITE&&!this[_0x3e9368(0x94)][_0x3e9368(0xc1)][_0x3e9368(0xd6)]&&!this['layers'][_0x3e9368(0xc3)]['site']&&(_0x4744e5['site']=process.env.TDX_SITE);Object[_0x3e9368(0xc7)](_0x4744e5,this[_0x3e9368(0x94)][_0x3e9368(0xc1)]),Object['assign'](_0x4744e5,this['layers'][_0x3e9368(0xc3)]);const _0x4c86bf=_0x4744e5[_0x3e9368(0xd6)]||_0x3e9368(0xdc);this['site']=resolveSite(_0x4c86bf),this[_0x3e9368(0xb0)]=_0x4744e5['database'],this[_0x3e9368(0xb6)]=_0x4744e5[_0x3e9368(0xb6)],this[_0x3e9368(0xba)]=_0x4744e5['segment_path'],this[_0x3e9368(0xac)]=_0x4744e5[_0x3e9368(0xac)],this['llm_agent']=_0x4744e5[_0x3e9368(0xe2)],this[_0x3e9368(0x97)]=_0x4744e5['workflow_project'],this[_0x3e9368(0xe5)]=_0x4744e5[_0x3e9368(0xe5)],this[_0x3e9368(0x99)]=_0x3cbb8e[_0x3e9368(0x99)]||![],this[_0x3e9368(0xa1)]=_0x3cbb8e['logLevel']??LogLevel[_0x3e9368(0xe4)],this[_0x3e9368(0xa0)]=this['activeProfile']||undefined,this[_0x3e9368(0xa9)]=getAccessToken(this['activeProfile']||undefined),this[_0x3e9368(0xd0)]=getAPIKey(this[_0x3e9368(0xd8)]||undefined);const _0x578401=typeof _0x31952c[_0x3e9368(0xa5)]==='string'?_0x31952c[_0x3e9368(0xa5)]:undefined;this['proxy']=_0x578401||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x3cb259=getConfigDir(),_0x5ad1d0=a61_0x2a17cf[_0x3e9368(0xdb)](_0x3cb259,_0x3e9368(0xca),this[_0x3e9368(0xa6)]+'.json'),_0x56dba6=findProjectConfigPath(),_0x3f8140=a61_0x2a17cf[_0x3e9368(0xdb)](_0x3cb259,'tdx.json'),_0xcafea=a61_0x2a17cf[_0x3e9368(0xdb)](_0x3cb259,_0x3e9368(0xc2));let _0x2b91d0=null,_0x563cb3=null;this[_0x3e9368(0xd8)]&&(_0x2b91d0=a61_0x2a17cf[_0x3e9368(0xdb)](_0x3cb259,'profiles',this['activeProfile'],_0x3e9368(0xbc)),_0x563cb3=a61_0x2a17cf['join'](_0x3cb259,_0x3e9368(0xc6),this[_0x3e9368(0xd8)],'.env')),this[_0x3e9368(0xb9)]={'session':a61_0x5d20a4[_0x3e9368(0xae)](_0x5ad1d0)?_0x5ad1d0:null,'project':_0x56dba6,'profile':_0x2b91d0&&a61_0x5d20a4['existsSync'](_0x2b91d0)?_0x2b91d0:null,'profileCredentials':_0x563cb3&&a61_0x5d20a4[_0x3e9368(0xae)](_0x563cb3)?_0x563cb3:null,'global':a61_0x5d20a4['existsSync'](_0x3f8140)?_0x3f8140:null,'globalCredentials':a61_0x5d20a4['existsSync'](_0xcafea)?_0xcafea:null};}[a61_0x33091b(0x9f)](_0xe5a605,_0x56330c){const _0x2d367b=a61_0x33091b;if(!_0x56330c)return'not\x20set';const _0x2cd0ec=_0x56330c;if(this[_0x2d367b(0x94)]['cliFlags'][_0xe5a605]===_0x2cd0ec){if(_0xe5a605===_0x2d367b(0xd6)&&_0x2cd0ec===_0x2d367b(0xdc)&&!this[_0x2d367b(0x94)][_0x2d367b(0xc1)][_0x2d367b(0xd6)]&&!this['layers'][_0x2d367b(0xb1)][_0x2d367b(0xd6)]&&!this[_0x2d367b(0x94)][_0x2d367b(0xa0)][_0x2d367b(0xd6)]&&!this[_0x2d367b(0x94)][_0x2d367b(0xaa)][_0x2d367b(0xd6)])return _0x2d367b(0xb7);return _0x2d367b(0xd9)+_0xe5a605[_0x2d367b(0xd3)](/_/g,'-');}if(this['layers'][_0x2d367b(0xc1)][_0xe5a605]===_0x2cd0ec)return _0x2d367b(0xc1);if(this['layers'][_0x2d367b(0xb1)][_0xe5a605]===_0x2cd0ec)return _0x2d367b(0xb1);if(this['layers'][_0x2d367b(0xa0)][_0xe5a605]===_0x2cd0ec)return _0x2d367b(0xc4)+this[_0x2d367b(0xd8)];if(this['layers'][_0x2d367b(0xaa)][_0xe5a605]===_0x2cd0ec)return _0x2d367b(0xaa);return'default';}[a61_0x33091b(0xe1)](){const _0x22514c=a61_0x33091b,_0x18d57c=a61_0x2a17cf[_0x22514c(0xdb)](getConfigDir(),'tdx.json');if(!a61_0x5d20a4[_0x22514c(0xae)](_0x18d57c))return{};try{const _0x176170=a61_0x5d20a4[_0x22514c(0x93)](_0x18d57c,_0x22514c(0xa3));return JSON[_0x22514c(0xa2)](_0x176170);}catch{return{};}}['injectIntoOptions'](_0x3a5e6c){const _0x18bcca=a61_0x33091b;_0x3a5e6c[_0x18bcca(0xd6)]=this[_0x18bcca(0xd6)],!_0x3a5e6c[_0x18bcca(0xb0)]&&this[_0x18bcca(0xb0)]&&(_0x3a5e6c[_0x18bcca(0xb0)]=this['database']),!_0x3a5e6c[_0x18bcca(0xa8)]&&this[_0x18bcca(0xb6)]&&(_0x3a5e6c[_0x18bcca(0xa8)]=this[_0x18bcca(0xb6)]),!_0x3a5e6c[_0x18bcca(0xa4)]&&this[_0x18bcca(0xba)]&&(_0x3a5e6c['segmentPath']=this[_0x18bcca(0xba)]),!_0x3a5e6c[_0x18bcca(0xbd)]&&this[_0x18bcca(0xac)]&&(_0x3a5e6c[_0x18bcca(0xbd)]=this[_0x18bcca(0xac)]),!_0x3a5e6c[_0x18bcca(0xb3)]&&this[_0x18bcca(0xe2)]&&(_0x3a5e6c[_0x18bcca(0xb3)]=this['llm_agent']),!_0x3a5e6c[_0x18bcca(0xbb)]&&this[_0x18bcca(0x97)]&&(_0x3a5e6c['workflowProject']=this['workflow_project']),!_0x3a5e6c[_0x18bcca(0xde)]&&this[_0x18bcca(0xe5)]&&(_0x3a5e6c['composableAudience']=this[_0x18bcca(0xe5)]);}[a61_0x33091b(0xaf)](){const _0x293b6c=a61_0x33091b;return[{'key':'site','value':this[_0x293b6c(0xd6)]},{'key':_0x293b6c(0xb0),'value':this['database']},{'key':_0x293b6c(0xb6),'value':this[_0x293b6c(0xb6)]},{'key':_0x293b6c(0xba),'value':this[_0x293b6c(0xba)]},{'key':_0x293b6c(0xac),'value':this[_0x293b6c(0xac)]},{'key':_0x293b6c(0xe2),'value':this[_0x293b6c(0xe2)]},{'key':_0x293b6c(0x97),'value':this[_0x293b6c(0x97)]},{'key':_0x293b6c(0xe5),'value':this[_0x293b6c(0xe5)]},{'key':_0x293b6c(0xa0),'value':this[_0x293b6c(0xd8)]||undefined}];}[a61_0x33091b(0xd5)](){const _0x43b82d=a61_0x33091b;console[_0x43b82d(0xe3)](a61_0x1c1f89[_0x43b82d(0xe0)](_0x43b82d(0x9b)));for(const {key:_0x226128,value:_0x1f200d}of this[_0x43b82d(0xaf)]()){_0x1f200d&&console['log'](a61_0x1c1f89[_0x43b82d(0xd1)](_0x226128)+':\x20'+_0x1f200d);}}[a61_0x33091b(0xcb)](){const _0x488a5c=a61_0x33091b;console[_0x488a5c(0xe3)](a61_0x1c1f89[_0x488a5c(0xe0)](_0x488a5c(0x9b)));for(const {key:_0x4be3b2,value:_0x280412}of this[_0x488a5c(0xaf)]()){if(_0x280412){const _0x4f841c=_0x4be3b2===_0x488a5c(0xa0)?_0x488a5c(0xc0):'('+this[_0x488a5c(0x9f)](_0x4be3b2,_0x280412)+')';console[_0x488a5c(0xe3)](a61_0x1c1f89[_0x488a5c(0xd1)](_0x4be3b2)+':\x20'+_0x280412+'\x20'+a61_0x1c1f89[_0x488a5c(0xc5)](_0x4f841c));}}console['log']('\x0a'+a61_0x1c1f89['bold'](_0x488a5c(0x96)));const _0x65ebb6=[{'label':_0x488a5c(0x9d),'path':this['configFiles'][_0x488a5c(0xc1)],'extra':'(session:\x20'+this[_0x488a5c(0xa6)]+')'},{'label':_0x488a5c(0xb8),'path':this['configFiles'][_0x488a5c(0xb1)]},{'label':_0x488a5c(0xad),'path':this[_0x488a5c(0xb9)][_0x488a5c(0xa0)]},{'label':_0x488a5c(0xbe),'path':this[_0x488a5c(0xb9)][_0x488a5c(0xcc)]},{'label':_0x488a5c(0x92),'path':this[_0x488a5c(0xb9)][_0x488a5c(0xaa)]},{'label':_0x488a5c(0xd7),'path':this['configFiles']['globalCredentials']}];for(const {label:_0x572706,path:_0x4b34ee,extra:_0x1aa4d1}of _0x65ebb6){if(_0x4b34ee)console[_0x488a5c(0xe3)](a61_0x1c1f89[_0x488a5c(0xd1)](_0x572706)+':\x20'+_0x4b34ee+'\x20'+a61_0x1c1f89[_0x488a5c(0xc8)]('✓')+(_0x1aa4d1?'\x20'+a61_0x1c1f89[_0x488a5c(0xc5)](_0x1aa4d1):''));else{if(_0x572706==='Session')console[_0x488a5c(0xe3)](a61_0x1c1f89['cyan'](_0x572706)+':\x20'+a61_0x1c1f89[_0x488a5c(0xc5)](_0x488a5c(0xb5))+'\x20'+a61_0x1c1f89[_0x488a5c(0xc5)](_0x488a5c(0xb4)+this[_0x488a5c(0xa6)]+')'));else(_0x572706===_0x488a5c(0xb8)||_0x572706===_0x488a5c(0x92))&&console[_0x488a5c(0xe3)](a61_0x1c1f89[_0x488a5c(0xd1)](_0x572706)+':\x20'+a61_0x1c1f89[_0x488a5c(0xc5)]('none'));}}}async[a61_0x33091b(0xdf)](){const _0x5a2511=a61_0x33091b;if(!this['accessToken']){const _0x1dff42=await getOAuthTokens(this[_0x5a2511(0xd8)]||undefined);if(_0x1dff42){const _0x3ec2fa=0x5*0x3c*0x3e8,_0xa6ac28=!_0x1dff42[_0x5a2511(0xab)]||_0x1dff42[_0x5a2511(0xab)]<Date[_0x5a2511(0x9e)]()+_0x3ec2fa;if(_0xa6ac28&&_0x1dff42[_0x5a2511(0xd2)])try{const _0x671f66=getConsoleUrl(this['site']),_0x580fff=await refreshAccessToken(_0x671f66,_0x1dff42['refresh_token']);await saveOAuthTokens(_0x580fff,this['activeProfile']||undefined),this[_0x5a2511(0xa9)]=_0x580fff[_0x5a2511(0xce)];}catch{this[_0x5a2511(0xa9)]=_0x1dff42[_0x5a2511(0xce)];}else this[_0x5a2511(0xa9)]=_0x1dff42[_0x5a2511(0xce)];return undefined;}}return this[_0x5a2511(0xd0)]=await getAPIKeyAsync(this[_0x5a2511(0xd6)],this[_0x5a2511(0xd8)]||undefined),this[_0x5a2511(0xd0)];}static async[a61_0x33091b(0xcd)](_0x41f463){const _0x127d15=new GlobalContext(_0x41f463);return await _0x127d15['resolveAPIKeyAsync'](),_0x127d15;}}
1
+ const a61_0x33a1d8=a61_0x4e7c;(function(_0x18cf8b,_0x27ef71){const _0x2730e9=a61_0x4e7c,_0x50455b=_0x18cf8b();while(!![]){try{const _0x5dbf28=-parseInt(_0x2730e9(0x226))/0x1*(parseInt(_0x2730e9(0x1fd))/0x2)+-parseInt(_0x2730e9(0x208))/0x3+-parseInt(_0x2730e9(0x1f2))/0x4*(-parseInt(_0x2730e9(0x21f))/0x5)+parseInt(_0x2730e9(0x1f0))/0x6+-parseInt(_0x2730e9(0x228))/0x7*(parseInt(_0x2730e9(0x1ff))/0x8)+-parseInt(_0x2730e9(0x235))/0x9*(parseInt(_0x2730e9(0x1fe))/0xa)+-parseInt(_0x2730e9(0x230))/0xb*(-parseInt(_0x2730e9(0x1e9))/0xc);if(_0x5dbf28===_0x27ef71)break;else _0x50455b['push'](_0x50455b['shift']());}catch(_0x491fe){_0x50455b['push'](_0x50455b['shift']());}}}(a61_0x5cf1,0x3b846));function a61_0x5cf1(){const _0x4fbe29=['activeProfile','.json','tdx.json','1699782NolvAs','assign','104fHideJ','parent_segment','CLI\x20flag:\x20--','database','(using\x20session:\x20','log','apiKey','accessToken','llmAgent','getParameters','.env','2694nhlemw','1258970ukLiOg','216zJIhRD','parentSegment','parse','replace','session','composable_audience','workflowProject','cli','resolveAPIKeyAsync','1227207UmEILW','expires_at','[context]','config','join','cyan','refresh_token','readFileSync','layers','dim','project','llmProject','llm_agent','Project','llm_project','loadGlobalConfig','profile','profiles','existsSync','not\x20set','(active)','INFO','now','50410CbiZZG','site','Profile','composableAudience','workflow_project','configFiles','globalCredentials','346FIYfPW','none','17038UyjfoO','logLevel','Session','access_token','segmentPath','cliFlags','verbose','proxy','195723DfiSIR','env','profileSource','profileCredentials','bold','9FfsMgJ','createAsync','string','Global','[configuration\x20files]','516EhYtnT','global','sessionId','segment_path'];a61_0x5cf1=function(){return _0x4fbe29;};return a61_0x5cf1();}import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';import{getOAuthTokens,saveOAuthTokens}from'./oauth-keychain.js';import{refreshAccessToken}from'../sdk/client/oauth-refresh.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';function a61_0x4e7c(_0x477205,_0x3c1665){_0x477205=_0x477205-0x1e6;const _0x5cf19d=a61_0x5cf1();let _0x4e7c0f=_0x5cf19d[_0x477205];return _0x4e7c0f;}import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a61_0x26ab68 from'node:fs';import*as a61_0x6f20b4 from'node:path';import a61_0x3d7474 from'chalk';export class GlobalContext{[a61_0x33a1d8(0x220)];[a61_0x33a1d8(0x1f5)];['parent_segment'];[a61_0x33a1d8(0x1ec)];[a61_0x33a1d8(0x216)];[a61_0x33a1d8(0x214)];['workflow_project'];[a61_0x33a1d8(0x204)];[a61_0x33a1d8(0x1f8)];['accessToken'];[a61_0x33a1d8(0x22f)];[a61_0x33a1d8(0x22e)];['logLevel'];[a61_0x33a1d8(0x218)];[a61_0x33a1d8(0x232)]=null;[a61_0x33a1d8(0x210)];[a61_0x33a1d8(0x1ed)];[a61_0x33a1d8(0x1eb)];[a61_0x33a1d8(0x224)];constructor(_0x4bca6a){const _0x271b07=a61_0x33a1d8;this[_0x271b07(0x1eb)]=getSessionID(_0x4bca6a['session']);const _0x5e5020=loadSessionContext(_0x4bca6a[_0x271b07(0x203)]),_0x499639=loadProjectConfig(),_0x3b6d0c=this[_0x271b07(0x217)]();if(_0x4bca6a['profile'])this[_0x271b07(0x1ed)]=_0x4bca6a[_0x271b07(0x218)],this['profileSource']=_0x271b07(0x206);else{if(_0x5e5020?.[_0x271b07(0x218)])this['activeProfile']=_0x5e5020['profile'],this[_0x271b07(0x232)]=_0x271b07(0x203);else{if(_0x3b6d0c['profile'])this[_0x271b07(0x1ed)]=_0x3b6d0c[_0x271b07(0x218)],this[_0x271b07(0x232)]=_0x271b07(0x20b);else process.env.TDX_PROFILE?(this['activeProfile']=process.env.TDX_PROFILE,this[_0x271b07(0x232)]=_0x271b07(0x231)):(this['activeProfile']=null,this[_0x271b07(0x232)]=null);}}const _0x4f769c=this[_0x271b07(0x1ed)]?loadProfile(this[_0x271b07(0x1ed)]):null,_0x1fb978=_0x37044c=>{const _0x2788fb=_0x271b07;if(!_0x37044c)return{};const _0x27433c=_0x37044c,_0xdc89b6={};for(const [_0xd08539,_0x560ce9]of Object['entries'](_0x27433c)){typeof _0x560ce9===_0x2788fb(0x1e6)&&(_0xdc89b6[_0xd08539]=_0x560ce9);}return _0xdc89b6;},_0x13ed10={},_0x46580e=(_0x473848,_0x220c36,_0x21d1f7)=>{const _0x4e5a4b=_0x271b07;if(!_0x473848)return![];if(_0x21d1f7&&_0x473848===_0x21d1f7)return![];const _0x45200a=_0x5e5020,_0x4bb6e7=_0x499639,_0x45a4f1=_0x4f769c?.[_0x4e5a4b(0x20b)],_0x5c081f=_0x3b6d0c,_0x4fa828=_0x45200a?.[_0x220c36],_0x27cee0=_0x4bb6e7?.[_0x220c36],_0x393c4a=_0x45a4f1?.[_0x220c36],_0x30100f=_0x5c081f[_0x220c36];return _0x473848!==_0x4fa828&&_0x473848!==_0x27cee0&&_0x473848!==_0x393c4a&&_0x473848!==_0x30100f;},_0x532894=[{'optionKey':_0x271b07(0x220),'contextKey':'site','defaultValue':'us01'},{'optionKey':'database','contextKey':_0x271b07(0x1f5)},{'optionKey':_0x271b07(0x200),'contextKey':'parent_segment'},{'optionKey':'llmProject','contextKey':_0x271b07(0x216)},{'optionKey':_0x271b07(0x1fa),'contextKey':'llm_agent'},{'optionKey':_0x271b07(0x222),'contextKey':_0x271b07(0x204)},{'optionKey':'profile','contextKey':'profile'}];for(const {optionKey:_0x53e367,contextKey:_0x5bd415,defaultValue:_0x1a52cb}of _0x532894){const _0x76dec3=_0x4bca6a[_0x53e367];_0x46580e(_0x76dec3,_0x5bd415,_0x1a52cb)&&(_0x13ed10[_0x5bd415]=_0x76dec3);}this[_0x271b07(0x210)]={'cliFlags':_0x13ed10,'session':_0x1fb978(_0x5e5020),'project':_0x1fb978(_0x499639),'profile':_0x1fb978(_0x4f769c?.[_0x271b07(0x20b)]),'global':_0x1fb978(_0x3b6d0c)};const _0x3897ce={...this[_0x271b07(0x210)][_0x271b07(0x1ea)],...this['layers'][_0x271b07(0x218)],...this['layers'][_0x271b07(0x212)]};process.env.TDX_SITE&&!this[_0x271b07(0x210)][_0x271b07(0x203)][_0x271b07(0x220)]&&!this[_0x271b07(0x210)][_0x271b07(0x22d)][_0x271b07(0x220)]&&(_0x3897ce['site']=process.env.TDX_SITE);Object[_0x271b07(0x1f1)](_0x3897ce,this[_0x271b07(0x210)][_0x271b07(0x203)]),Object[_0x271b07(0x1f1)](_0x3897ce,this[_0x271b07(0x210)][_0x271b07(0x22d)]);const _0xf75262=_0x3897ce[_0x271b07(0x220)]||'us01';this['site']=resolveSite(_0xf75262),this[_0x271b07(0x1f5)]=_0x3897ce['database'],this['parent_segment']=_0x3897ce[_0x271b07(0x1f3)],this['segment_path']=_0x3897ce[_0x271b07(0x1ec)],this[_0x271b07(0x216)]=_0x3897ce[_0x271b07(0x216)],this['llm_agent']=_0x3897ce[_0x271b07(0x214)],this[_0x271b07(0x223)]=_0x3897ce[_0x271b07(0x223)],this[_0x271b07(0x204)]=_0x3897ce['composable_audience'],this[_0x271b07(0x22e)]=_0x4bca6a[_0x271b07(0x22e)]||![],this[_0x271b07(0x229)]=_0x4bca6a[_0x271b07(0x229)]??LogLevel[_0x271b07(0x21d)],this[_0x271b07(0x218)]=this[_0x271b07(0x1ed)]||undefined,this[_0x271b07(0x1f9)]=getAccessToken(this[_0x271b07(0x1ed)]||undefined),this['apiKey']=getAPIKey(this['activeProfile']||undefined);const _0x9d0596=typeof _0x3b6d0c[_0x271b07(0x22f)]===_0x271b07(0x1e6)?_0x3b6d0c[_0x271b07(0x22f)]:undefined;this[_0x271b07(0x22f)]=_0x9d0596||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x3737c4=getConfigDir(),_0x5d9a60=a61_0x6f20b4['join'](_0x3737c4,'sessions',this['sessionId']+_0x271b07(0x1ee)),_0x2cc255=findProjectConfigPath(),_0x487fd6=a61_0x6f20b4[_0x271b07(0x20c)](_0x3737c4,_0x271b07(0x1ef)),_0x4baca4=a61_0x6f20b4[_0x271b07(0x20c)](_0x3737c4,_0x271b07(0x1fc));let _0x46b7c1=null,_0xbde809=null;this[_0x271b07(0x1ed)]&&(_0x46b7c1=a61_0x6f20b4[_0x271b07(0x20c)](_0x3737c4,_0x271b07(0x219),this[_0x271b07(0x1ed)],_0x271b07(0x1ef)),_0xbde809=a61_0x6f20b4[_0x271b07(0x20c)](_0x3737c4,'profiles',this[_0x271b07(0x1ed)],_0x271b07(0x1fc))),this[_0x271b07(0x224)]={'session':a61_0x26ab68[_0x271b07(0x21a)](_0x5d9a60)?_0x5d9a60:null,'project':_0x2cc255,'profile':_0x46b7c1&&a61_0x26ab68[_0x271b07(0x21a)](_0x46b7c1)?_0x46b7c1:null,'profileCredentials':_0xbde809&&a61_0x26ab68[_0x271b07(0x21a)](_0xbde809)?_0xbde809:null,'global':a61_0x26ab68[_0x271b07(0x21a)](_0x487fd6)?_0x487fd6:null,'globalCredentials':a61_0x26ab68[_0x271b07(0x21a)](_0x4baca4)?_0x4baca4:null};}['getSource'](_0x1a5152,_0x3dbd01){const _0x387415=a61_0x33a1d8;if(!_0x3dbd01)return _0x387415(0x21b);const _0x5d8acd=_0x3dbd01;if(this['layers']['cliFlags'][_0x1a5152]===_0x5d8acd){if(_0x1a5152==='site'&&_0x5d8acd==='us01'&&!this['layers'][_0x387415(0x203)][_0x387415(0x220)]&&!this[_0x387415(0x210)][_0x387415(0x212)][_0x387415(0x220)]&&!this[_0x387415(0x210)][_0x387415(0x218)][_0x387415(0x220)]&&!this['layers'][_0x387415(0x1ea)][_0x387415(0x220)])return'default';return _0x387415(0x1f4)+_0x1a5152[_0x387415(0x202)](/_/g,'-');}if(this[_0x387415(0x210)][_0x387415(0x203)][_0x1a5152]===_0x5d8acd)return _0x387415(0x203);if(this[_0x387415(0x210)][_0x387415(0x212)][_0x1a5152]===_0x5d8acd)return'project';if(this['layers'][_0x387415(0x218)][_0x1a5152]===_0x5d8acd)return'profile:\x20'+this[_0x387415(0x1ed)];if(this[_0x387415(0x210)][_0x387415(0x1ea)][_0x1a5152]===_0x5d8acd)return _0x387415(0x1ea);return'default';}[a61_0x33a1d8(0x217)](){const _0x461917=a61_0x33a1d8,_0x2ee5fe=a61_0x6f20b4['join'](getConfigDir(),_0x461917(0x1ef));if(!a61_0x26ab68[_0x461917(0x21a)](_0x2ee5fe))return{};try{const _0x158ae2=a61_0x26ab68[_0x461917(0x20f)](_0x2ee5fe,'utf-8');return JSON[_0x461917(0x201)](_0x158ae2);}catch{return{};}}['injectIntoOptions'](_0x471f4c){const _0x48630c=a61_0x33a1d8;_0x471f4c[_0x48630c(0x220)]=this[_0x48630c(0x220)],!_0x471f4c[_0x48630c(0x1f5)]&&this[_0x48630c(0x1f5)]&&(_0x471f4c['database']=this[_0x48630c(0x1f5)]),!_0x471f4c[_0x48630c(0x200)]&&this['parent_segment']&&(_0x471f4c[_0x48630c(0x200)]=this[_0x48630c(0x1f3)]),!_0x471f4c[_0x48630c(0x22c)]&&this[_0x48630c(0x1ec)]&&(_0x471f4c[_0x48630c(0x22c)]=this[_0x48630c(0x1ec)]),!_0x471f4c[_0x48630c(0x213)]&&this[_0x48630c(0x216)]&&(_0x471f4c[_0x48630c(0x213)]=this[_0x48630c(0x216)]),!_0x471f4c[_0x48630c(0x1fa)]&&this[_0x48630c(0x214)]&&(_0x471f4c['llmAgent']=this[_0x48630c(0x214)]),!_0x471f4c[_0x48630c(0x205)]&&this[_0x48630c(0x223)]&&(_0x471f4c[_0x48630c(0x205)]=this[_0x48630c(0x223)]),!_0x471f4c[_0x48630c(0x222)]&&this[_0x48630c(0x204)]&&(_0x471f4c[_0x48630c(0x222)]=this[_0x48630c(0x204)]);}[a61_0x33a1d8(0x1fb)](){const _0x5cc705=a61_0x33a1d8;return[{'key':_0x5cc705(0x220),'value':this[_0x5cc705(0x220)]},{'key':_0x5cc705(0x1f5),'value':this[_0x5cc705(0x1f5)]},{'key':'parent_segment','value':this[_0x5cc705(0x1f3)]},{'key':'segment_path','value':this['segment_path']},{'key':_0x5cc705(0x216),'value':this[_0x5cc705(0x216)]},{'key':_0x5cc705(0x214),'value':this[_0x5cc705(0x214)]},{'key':'workflow_project','value':this[_0x5cc705(0x223)]},{'key':_0x5cc705(0x204),'value':this[_0x5cc705(0x204)]},{'key':_0x5cc705(0x218),'value':this[_0x5cc705(0x1ed)]||undefined}];}['display'](){const _0x2e78c8=a61_0x33a1d8;console['log'](a61_0x3d7474[_0x2e78c8(0x234)](_0x2e78c8(0x20a)));for(const {key:_0x3ec408,value:_0x33d81d}of this[_0x2e78c8(0x1fb)]()){_0x33d81d&&console['log'](a61_0x3d7474[_0x2e78c8(0x20d)](_0x3ec408)+':\x20'+_0x33d81d);}}['displayWithSources'](){const _0x36a064=a61_0x33a1d8;console['log'](a61_0x3d7474['bold']('[context]'));for(const {key:_0xcfd31e,value:_0x58c9bb}of this[_0x36a064(0x1fb)]()){if(_0x58c9bb){const _0x330e53=_0xcfd31e===_0x36a064(0x218)?_0x36a064(0x21c):'('+this['getSource'](_0xcfd31e,_0x58c9bb)+')';console[_0x36a064(0x1f7)](a61_0x3d7474[_0x36a064(0x20d)](_0xcfd31e)+':\x20'+_0x58c9bb+'\x20'+a61_0x3d7474[_0x36a064(0x211)](_0x330e53));}}console['log']('\x0a'+a61_0x3d7474[_0x36a064(0x234)](_0x36a064(0x1e8)));const _0x1bf9a5=[{'label':_0x36a064(0x22a),'path':this[_0x36a064(0x224)][_0x36a064(0x203)],'extra':'(session:\x20'+this[_0x36a064(0x1eb)]+')'},{'label':_0x36a064(0x215),'path':this['configFiles'][_0x36a064(0x212)]},{'label':_0x36a064(0x221),'path':this[_0x36a064(0x224)]['profile']},{'label':'Profile\x20Credentials','path':this[_0x36a064(0x224)][_0x36a064(0x233)]},{'label':_0x36a064(0x1e7),'path':this[_0x36a064(0x224)][_0x36a064(0x1ea)]},{'label':'Global\x20Credentials','path':this[_0x36a064(0x224)][_0x36a064(0x225)]}];for(const {label:_0x28785c,path:_0x1af10d,extra:_0x3fac8b}of _0x1bf9a5){if(_0x1af10d)console[_0x36a064(0x1f7)](a61_0x3d7474[_0x36a064(0x20d)](_0x28785c)+':\x20'+_0x1af10d+'\x20'+a61_0x3d7474['green']('✓')+(_0x3fac8b?'\x20'+a61_0x3d7474['dim'](_0x3fac8b):''));else{if(_0x28785c===_0x36a064(0x22a))console['log'](a61_0x3d7474[_0x36a064(0x20d)](_0x28785c)+':\x20'+a61_0x3d7474[_0x36a064(0x211)](_0x36a064(0x227))+'\x20'+a61_0x3d7474['dim'](_0x36a064(0x1f6)+this[_0x36a064(0x1eb)]+')'));else(_0x28785c==='Project'||_0x28785c===_0x36a064(0x1e7))&&console[_0x36a064(0x1f7)](a61_0x3d7474[_0x36a064(0x20d)](_0x28785c)+':\x20'+a61_0x3d7474[_0x36a064(0x211)](_0x36a064(0x227)));}}}async[a61_0x33a1d8(0x207)](){const _0x59d6ee=a61_0x33a1d8;if(!this[_0x59d6ee(0x1f9)]){const _0x55618a=await getOAuthTokens(this[_0x59d6ee(0x1ed)]||undefined);if(_0x55618a){const _0x1a2146=0x5*0x3c*0x3e8,_0x1b373e=!_0x55618a[_0x59d6ee(0x209)]||_0x55618a['expires_at']<Date[_0x59d6ee(0x21e)]()+_0x1a2146;if(_0x1b373e&&_0x55618a[_0x59d6ee(0x20e)])try{const _0x9d840f=getConsoleUrl(this[_0x59d6ee(0x220)]),_0x396d2f=await refreshAccessToken(_0x9d840f,_0x55618a['refresh_token']);await saveOAuthTokens(_0x396d2f,this[_0x59d6ee(0x1ed)]||undefined),this[_0x59d6ee(0x1f9)]=_0x396d2f[_0x59d6ee(0x22b)];}catch{this[_0x59d6ee(0x1f9)]=_0x55618a[_0x59d6ee(0x22b)];}else this[_0x59d6ee(0x1f9)]=_0x55618a[_0x59d6ee(0x22b)];return undefined;}}return this[_0x59d6ee(0x1f8)]=await getAPIKeyAsync(this[_0x59d6ee(0x220)],this[_0x59d6ee(0x1ed)]||undefined),this[_0x59d6ee(0x1f8)];}static async[a61_0x33a1d8(0x236)](_0xb7f795){const _0x491243=a61_0x33a1d8,_0x4cfb2e=new GlobalContext(_0xb7f795);return await _0x4cfb2e[_0x491243(0x207)](),_0x4cfb2e;}}
@@ -1 +1 @@
1
- function a62_0x33e1(){const _0x5b837b=['setPassword','Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.','Warning:\x20','restricted','profile:','value','includes',':api_key','tdx','@napi-rs/keyring','17078WXImmi','3039844eHldiO','could\x20not\x20be\x20found','186205VwbImJ','error','186KJQvAR','not_found','-25293','deleteCredential','unavailable','no\x20matching\x20entry','not\x20supported','5515888sYDxfX','Entry','getPassword','not\x20found','access_denied','580mIssmA','1027033ONzrCy','324DBUUau','cannot\x20find','__keychain_test__','8HHrwPm','88794gWmTBJ','not\x20available','24568533pwgvzN','toLowerCase','message'];a62_0x33e1=function(){return _0x5b837b;};return a62_0x33e1();}const a62_0x28ce37=a62_0x38bf;(function(_0x2a45d1,_0x51ab4c){const _0xe9d138=a62_0x38bf,_0x5457b2=_0x2a45d1();while(!![]){try{const _0x124b8c=parseInt(_0xe9d138(0x131))/0x1+parseInt(_0xe9d138(0x11f))/0x2*(parseInt(_0xe9d138(0x132))/0x3)+parseInt(_0xe9d138(0x120))/0x4+parseInt(_0xe9d138(0x122))/0x5*(-parseInt(_0xe9d138(0x124))/0x6)+parseInt(_0xe9d138(0x12b))/0x7*(parseInt(_0xe9d138(0x135))/0x8)+-parseInt(_0xe9d138(0x110))/0x9*(-parseInt(_0xe9d138(0x130))/0xa)+-parseInt(_0xe9d138(0x112))/0xb;if(_0x124b8c===_0x51ab4c)break;else _0x5457b2['push'](_0x5457b2['shift']());}catch(_0x6cfe4b){_0x5457b2['push'](_0x5457b2['shift']());}}}(a62_0x33e1,0xa65e4));const SERVICE_NAME=a62_0x28ce37(0x11d);function a62_0x38bf(_0x1db76e,_0x3a96e1){_0x1db76e=_0x1db76e-0x110;const _0x33e1c4=a62_0x33e1();let _0x38bfaf=_0x33e1c4[_0x1db76e];return _0x38bfaf;}let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x3a8870=a62_0x28ce37;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x2a3ebc=await import(_0x3a8870(0x11e));return EntryClass=_0x2a3ebc[_0x3a8870(0x12c)],EntryClass;}catch(_0x2548bc){return keyringLoadError=_0x2548bc instanceof Error?_0x2548bc:new Error(String(_0x2548bc)),null;}}function getAccountName(_0x15e3bd){const _0x23231f=a62_0x28ce37,_0x130b87=_0x15e3bd||'';return _0x23231f(0x119)+_0x130b87+_0x23231f(0x11c);}export async function getKeychainAPIKey(_0x2ae957){const _0x4895b5=a62_0x28ce37,_0x2680c4=await getKeychainAPIKeyWithStatus(_0x2ae957);if(_0x2680c4['success'])return _0x2680c4[_0x4895b5(0x11a)];return _0x2680c4['reason']===_0x4895b5(0x12f)&&console[_0x4895b5(0x123)](_0x4895b5(0x117)+_0x2680c4[_0x4895b5(0x114)]),null;}export async function getKeychainAPIKeyWithStatus(_0x4e22c0){const _0x3ff778=a62_0x28ce37;try{const _0xd98e4b=await getEntryClass();if(!_0xd98e4b)return{'success':![],'reason':_0x3ff778(0x128)};const _0x3a573e=getAccountName(_0x4e22c0),_0xf84e36=new _0xd98e4b(SERVICE_NAME,_0x3a573e),_0x54f1e5=_0xf84e36['getPassword']();if(_0x54f1e5)return{'success':!![],'value':_0x54f1e5};return{'success':![],'reason':_0x3ff778(0x125)};}catch(_0x4b65b2){const _0x4821d9=_0x4b65b2 instanceof Error?_0x4b65b2['message']:String(_0x4b65b2);if(_0x4821d9[_0x3ff778(0x11b)]('-25300')||_0x4821d9['toLowerCase']()[_0x3ff778(0x11b)](_0x3ff778(0x121))||_0x4821d9[_0x3ff778(0x113)]()[_0x3ff778(0x11b)](_0x3ff778(0x12e))||_0x4821d9[_0x3ff778(0x113)]()[_0x3ff778(0x11b)](_0x3ff778(0x129)))return{'success':![],'reason':'not_found'};if(_0x4821d9[_0x3ff778(0x11b)](_0x3ff778(0x126))||_0x4821d9['toLowerCase']()[_0x3ff778(0x11b)](_0x3ff778(0x118))||_0x4821d9[_0x3ff778(0x113)]()[_0x3ff778(0x11b)]('access'))return{'success':![],'reason':_0x3ff778(0x12f),'message':_0x3ff778(0x116)};return{'success':![],'reason':_0x3ff778(0x128),'message':_0x4821d9};}}export async function saveKeychainAPIKey(_0x66f2e5,_0x1f0445){const _0x2ae684=a62_0x28ce37,_0x10aae7=await getEntryClass();if(!_0x10aae7)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x2c1db3=getAccountName(_0x1f0445),_0x528a86=new _0x10aae7(SERVICE_NAME,_0x2c1db3);_0x528a86[_0x2ae684(0x115)](_0x66f2e5);}export async function deleteKeychainAPIKey(_0x45713d){const _0x13a9b9=a62_0x28ce37;try{const _0x31f64f=await getEntryClass();if(!_0x31f64f)return![];const _0x1a6a5d=getAccountName(_0x45713d),_0x586114=new _0x31f64f(SERVICE_NAME,_0x1a6a5d);return _0x586114[_0x13a9b9(0x127)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x404bdb=a62_0x28ce37;try{const _0x4f9a25=await getEntryClass();if(!_0x4f9a25)return![];const _0x42ef06=new _0x4f9a25(SERVICE_NAME,_0x404bdb(0x134));return _0x42ef06[_0x404bdb(0x12d)](),!![];}catch(_0x4f6a74){const _0x241937=_0x4f6a74 instanceof Error?_0x4f6a74[_0x404bdb(0x114)][_0x404bdb(0x113)]():'';if(_0x241937[_0x404bdb(0x11b)](_0x404bdb(0x111))||_0x241937[_0x404bdb(0x11b)](_0x404bdb(0x12a))||_0x241937[_0x404bdb(0x11b)](_0x404bdb(0x133)))return![];return!![];}}
1
+ const a62_0xacf82a=a62_0x416c;(function(_0x2de2b6,_0x3b4e3e){const _0x5afe14=a62_0x416c,_0x99630c=_0x2de2b6();while(!![]){try{const _0xc1b67e=parseInt(_0x5afe14(0xd1))/0x1+parseInt(_0x5afe14(0xe9))/0x2*(parseInt(_0x5afe14(0xd5))/0x3)+-parseInt(_0x5afe14(0xec))/0x4*(-parseInt(_0x5afe14(0xdc))/0x5)+parseInt(_0x5afe14(0xd2))/0x6+parseInt(_0x5afe14(0xd9))/0x7*(-parseInt(_0x5afe14(0xe2))/0x8)+-parseInt(_0x5afe14(0xe4))/0x9*(-parseInt(_0x5afe14(0xe3))/0xa)+-parseInt(_0x5afe14(0xd8))/0xb;if(_0xc1b67e===_0x3b4e3e)break;else _0x99630c['push'](_0x99630c['shift']());}catch(_0x621900){_0x99630c['push'](_0x99630c['shift']());}}}(a62_0x45ac,0xecd23));const SERVICE_NAME=a62_0xacf82a(0xd4);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0xf9ef3b=a62_0xacf82a;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x4cbedf=await import('@napi-rs/keyring');return EntryClass=_0x4cbedf[_0xf9ef3b(0xee)],EntryClass;}catch(_0x29c1fb){return keyringLoadError=_0x29c1fb instanceof Error?_0x29c1fb:new Error(String(_0x29c1fb)),null;}}function a62_0x45ac(){const _0x2c2b8f=['System\x20keychain\x20is\x20not\x20available','toLowerCase','deleteCredential','reason','access_denied','-25300','93713jOVxwH','6054348AJsJcC','restricted','tdx','365487ejtoDd','profile:','could\x20not\x20be\x20found','23023572BJueHs','672EwGIsN','includes','message','5piRzNz','unavailable','not\x20supported','Warning:\x20','-25293','success','55576pPTuEf','10237340ORwWdv','9CvXzVJ','no\x20matching\x20entry','not_found','access','not\x20found','26IYebEH','getPassword','cannot\x20find','78804PYxbEz','error','Entry'];a62_0x45ac=function(){return _0x2c2b8f;};return a62_0x45ac();}function getAccountName(_0x436139){const _0x32c54f=a62_0xacf82a,_0x1675ca=_0x436139||'';return _0x32c54f(0xd6)+_0x1675ca+':api_key';}function a62_0x416c(_0x209de8,_0x4cd264){_0x209de8=_0x209de8-0xcd;const _0x45ac64=a62_0x45ac();let _0x416c6f=_0x45ac64[_0x209de8];return _0x416c6f;}export async function getKeychainAPIKey(_0x20d641){const _0x4c3bf9=a62_0xacf82a,_0x12b619=await getKeychainAPIKeyWithStatus(_0x20d641);if(_0x12b619[_0x4c3bf9(0xe1)])return _0x12b619['value'];return _0x12b619[_0x4c3bf9(0xce)]===_0x4c3bf9(0xcf)&&console[_0x4c3bf9(0xed)](_0x4c3bf9(0xdf)+_0x12b619[_0x4c3bf9(0xdb)]),null;}export async function getKeychainAPIKeyWithStatus(_0x43f096){const _0x5771a9=a62_0xacf82a;try{const _0x5ede14=await getEntryClass();if(!_0x5ede14)return{'success':![],'reason':_0x5771a9(0xdd)};const _0x1684e5=getAccountName(_0x43f096),_0xcd83c2=new _0x5ede14(SERVICE_NAME,_0x1684e5),_0x21f596=_0xcd83c2[_0x5771a9(0xea)]();if(_0x21f596)return{'success':!![],'value':_0x21f596};return{'success':![],'reason':_0x5771a9(0xe6)};}catch(_0x42cc68){const _0x4ef270=_0x42cc68 instanceof Error?_0x42cc68[_0x5771a9(0xdb)]:String(_0x42cc68);if(_0x4ef270[_0x5771a9(0xda)](_0x5771a9(0xd0))||_0x4ef270[_0x5771a9(0xf0)]()['includes'](_0x5771a9(0xd7))||_0x4ef270[_0x5771a9(0xf0)]()[_0x5771a9(0xda)](_0x5771a9(0xe8))||_0x4ef270['toLowerCase']()[_0x5771a9(0xda)](_0x5771a9(0xe5)))return{'success':![],'reason':_0x5771a9(0xe6)};if(_0x4ef270[_0x5771a9(0xda)](_0x5771a9(0xe0))||_0x4ef270[_0x5771a9(0xf0)]()[_0x5771a9(0xda)](_0x5771a9(0xd3))||_0x4ef270['toLowerCase']()[_0x5771a9(0xda)](_0x5771a9(0xe7)))return{'success':![],'reason':_0x5771a9(0xcf),'message':'Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.'};return{'success':![],'reason':_0x5771a9(0xdd),'message':_0x4ef270};}}export async function saveKeychainAPIKey(_0x2ea67f,_0x5cd716){const _0x236855=a62_0xacf82a,_0x28cfe4=await getEntryClass();if(!_0x28cfe4)throw new Error(_0x236855(0xef));const _0x44fdb2=getAccountName(_0x5cd716),_0x17e19d=new _0x28cfe4(SERVICE_NAME,_0x44fdb2);_0x17e19d['setPassword'](_0x2ea67f);}export async function deleteKeychainAPIKey(_0x41b950){const _0x496d2c=a62_0xacf82a;try{const _0x166185=await getEntryClass();if(!_0x166185)return![];const _0x501cea=getAccountName(_0x41b950),_0x1d19df=new _0x166185(SERVICE_NAME,_0x501cea);return _0x1d19df[_0x496d2c(0xcd)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x2c3d43=a62_0xacf82a;try{const _0x3c51a4=await getEntryClass();if(!_0x3c51a4)return![];const _0xd809aa=new _0x3c51a4(SERVICE_NAME,'__keychain_test__');return _0xd809aa[_0x2c3d43(0xea)](),!![];}catch(_0x77b17d){const _0x14583c=_0x77b17d instanceof Error?_0x77b17d[_0x2c3d43(0xdb)][_0x2c3d43(0xf0)]():'';if(_0x14583c[_0x2c3d43(0xda)]('not\x20available')||_0x14583c['includes'](_0x2c3d43(0xde))||_0x14583c['includes'](_0x2c3d43(0xeb)))return![];return!![];}}
@@ -1 +1 @@
1
- (function(_0x52176c,_0x4c202e){const _0x494acb=a63_0x489e,_0xf0368b=_0x52176c();while(!![]){try{const _0x412f96=parseInt(_0x494acb(0xcc))/0x1+parseInt(_0x494acb(0xc4))/0x2*(parseInt(_0x494acb(0xbd))/0x3)+-parseInt(_0x494acb(0xc3))/0x4*(parseInt(_0x494acb(0xc1))/0x5)+-parseInt(_0x494acb(0xc6))/0x6*(-parseInt(_0x494acb(0xbe))/0x7)+-parseInt(_0x494acb(0xd0))/0x8+-parseInt(_0x494acb(0xcf))/0x9*(parseInt(_0x494acb(0xc7))/0xa)+-parseInt(_0x494acb(0xc9))/0xb*(parseInt(_0x494acb(0xca))/0xc);if(_0x412f96===_0x4c202e)break;else _0xf0368b['push'](_0xf0368b['shift']());}catch(_0x4ebd92){_0xf0368b['push'](_0xf0368b['shift']());}}}(a63_0x19fb,0x297cb));const SERVICE_NAME='tdx';let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x485556=a63_0x489e;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x19c7d5=await import(_0x485556(0xc8));return EntryClass=_0x19c7d5['Entry'],EntryClass;}catch(_0x264fac){return keyringLoadError=_0x264fac instanceof Error?_0x264fac:new Error(String(_0x264fac)),null;}}function getOAuthAccountName(_0x66c7e2){const _0x15c1c8=a63_0x489e,_0x423f54=_0x66c7e2||'';return'profile:'+_0x423f54+_0x15c1c8(0xc2);}export async function saveOAuthTokens(_0x42cb49,_0x464b34){const _0xeed992=a63_0x489e,_0x388271=await getEntryClass();if(!_0x388271)throw new Error(_0xeed992(0xbf));const _0x21e197=getOAuthAccountName(_0x464b34),_0x36b3c2=new _0x388271(SERVICE_NAME,_0x21e197);_0x36b3c2[_0xeed992(0xce)](JSON[_0xeed992(0xc0)](_0x42cb49));}function a63_0x19fb(){const _0x532de6=['System\x20keychain\x20is\x20not\x20available','stringify','25RPwEih',':oauth_tokens','10676eQpqVJ','56928YoDpSq','deleteCredential','6QWvVVy','407880xxwPlx','@napi-rs/keyring','12221XkOnwX','1236TzIfOj','parse','235126XZwCdl','getPassword','setPassword','9oCwzWx','298672HxhGXi','6FqxPBB','586439RFxtSt'];a63_0x19fb=function(){return _0x532de6;};return a63_0x19fb();}export async function getOAuthTokens(_0x37c166){const _0x20a63f=a63_0x489e;try{const _0x4c1054=await getEntryClass();if(!_0x4c1054)return null;const _0x1f712c=getOAuthAccountName(_0x37c166),_0x426da9=new _0x4c1054(SERVICE_NAME,_0x1f712c),_0x50868c=_0x426da9[_0x20a63f(0xcd)]();if(_0x50868c)return JSON[_0x20a63f(0xcb)](_0x50868c);return null;}catch{return null;}}function a63_0x489e(_0x3b7dec,_0x354549){_0x3b7dec=_0x3b7dec-0xbd;const _0x19fb7b=a63_0x19fb();let _0x489e8c=_0x19fb7b[_0x3b7dec];return _0x489e8c;}export async function deleteOAuthTokens(_0x1cfd0e){const _0x57e35e=a63_0x489e;try{const _0x1e0266=await getEntryClass();if(!_0x1e0266)return![];const _0x20a027=getOAuthAccountName(_0x1cfd0e),_0x1cfead=new _0x1e0266(SERVICE_NAME,_0x20a027);return _0x1cfead[_0x57e35e(0xc5)](),!![];}catch{return![];}}
1
+ const a63_0x40b9a3=a63_0x47b9;(function(_0x8065ec,_0x2cd2b5){const _0x46fa66=a63_0x47b9,_0x44c369=_0x8065ec();while(!![]){try{const _0x23dae1=-parseInt(_0x46fa66(0xf5))/0x1+-parseInt(_0x46fa66(0xea))/0x2+-parseInt(_0x46fa66(0xf7))/0x3*(-parseInt(_0x46fa66(0xf3))/0x4)+-parseInt(_0x46fa66(0xf1))/0x5+-parseInt(_0x46fa66(0xf0))/0x6+parseInt(_0x46fa66(0xf6))/0x7+parseInt(_0x46fa66(0xe9))/0x8*(parseInt(_0x46fa66(0xef))/0x9);if(_0x23dae1===_0x2cd2b5)break;else _0x44c369['push'](_0x44c369['shift']());}catch(_0x19f36c){_0x44c369['push'](_0x44c369['shift']());}}}(a63_0x15ec,0xa82f8));const SERVICE_NAME=a63_0x40b9a3(0xf2);function a63_0x15ec(){const _0x654a49=['6856728csJHpL','1821585nmEYDO','tdx','1769924GQcASi','getPassword','957338kKEhjH','3232915RllChl','6pyXcDd','Entry','deleteCredential','46672bFInRg','1264176bFXMSJ','setPassword',':oauth_tokens','@napi-rs/keyring','System\x20keychain\x20is\x20not\x20available','3762loxZYw'];a63_0x15ec=function(){return _0x654a49;};return a63_0x15ec();}let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x3dcd3e=a63_0x40b9a3;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x12c075=await import(_0x3dcd3e(0xed));return EntryClass=_0x12c075[_0x3dcd3e(0xf8)],EntryClass;}catch(_0x1356cd){return keyringLoadError=_0x1356cd instanceof Error?_0x1356cd:new Error(String(_0x1356cd)),null;}}function getOAuthAccountName(_0x502b94){const _0x4bc438=a63_0x40b9a3,_0x44b075=_0x502b94||'';return'profile:'+_0x44b075+_0x4bc438(0xec);}function a63_0x47b9(_0x1abb17,_0x413370){_0x1abb17=_0x1abb17-0xe8;const _0x15ec13=a63_0x15ec();let _0x47b97c=_0x15ec13[_0x1abb17];return _0x47b97c;}export async function saveOAuthTokens(_0x4be90a,_0x20e78b){const _0x4aa4f=a63_0x40b9a3,_0x5aa7c3=await getEntryClass();if(!_0x5aa7c3)throw new Error(_0x4aa4f(0xee));const _0x2cfc97=getOAuthAccountName(_0x20e78b),_0x22b5a4=new _0x5aa7c3(SERVICE_NAME,_0x2cfc97);_0x22b5a4[_0x4aa4f(0xeb)](JSON['stringify'](_0x4be90a));}export async function getOAuthTokens(_0x4efb1a){const _0x5cfa3d=a63_0x40b9a3;try{const _0x35e84d=await getEntryClass();if(!_0x35e84d)return null;const _0x5432bb=getOAuthAccountName(_0x4efb1a),_0x581776=new _0x35e84d(SERVICE_NAME,_0x5432bb),_0x4bb3fd=_0x581776[_0x5cfa3d(0xf4)]();if(_0x4bb3fd)return JSON['parse'](_0x4bb3fd);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x558671){const _0x2b29e7=a63_0x40b9a3;try{const _0x4cf424=await getEntryClass();if(!_0x4cf424)return![];const _0x405bea=getOAuthAccountName(_0x558671),_0x2582c1=new _0x4cf424(SERVICE_NAME,_0x405bea);return _0x2582c1[_0x2b29e7(0xe8)](),!![];}catch{return![];}}
@@ -1 +1 @@
1
- const a64_0x224f70=a64_0x3bb5;function a64_0x6e85(){const _0x172f24=['response_type','access_token','EADDRINUSE','url','hex','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','refresh_token','get','OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack','2jZzuLl','account_name','tdx','OAuth\x20token\x20request\x20failed\x20(','digest','3576324VqWhcK','code_challenge','407970BXxnJo','searchParams','1644592HKrmZc','http://127.0.0.1','redirectUri','authorization_code','now','code_challenge_method','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','/oauth/token','base64url','application/x-www-form-urlencoded','6639040jAteoF','createHash','waitForCallback','sha256','http://localhost:','replace','listen','openid\x20email\x20profile','POST','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','text/plain','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','close','end','redirect_uri','client_id','toString','Not\x20Found','text','58669QDqiYm','redirect_to_path','codeChallenge','randomBytes','accountName','/oauth/authorize','4598525nOQnqI','pathname','Port\x20','expires_in','127.0.0.1','json','scope','createServer','code','/oauth/callback','clientId','state','status','set','error','/users/initiate_sso','2744371MeYSlK','writeHead'];a64_0x6e85=function(){return _0x172f24;};return a64_0x6e85();}(function(_0xc6c9a1,_0x5ed49a){const _0x131fea=a64_0x3bb5,_0x1b887f=_0xc6c9a1();while(!![]){try{const _0x498951=parseInt(_0x131fea(0x1a9))/0x1*(parseInt(_0x131fea(0x182))/0x2)+parseInt(_0x131fea(0x189))/0x3+parseInt(_0x131fea(0x18b))/0x4+parseInt(_0x131fea(0x1af))/0x5+-parseInt(_0x131fea(0x187))/0x6+parseInt(_0x131fea(0x177))/0x7+-parseInt(_0x131fea(0x195))/0x8;if(_0x498951===_0x5ed49a)break;else _0x1b887f['push'](_0x1b887f['shift']());}catch(_0xe87fdb){_0x1b887f['push'](_0x1b887f['shift']());}}}(a64_0x6e85,0x7806f));import*as a64_0x3532b4 from'node:crypto';import*as a64_0x18d0b0 from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI=a64_0x224f70(0x199)+OAUTH_CALLBACK_PORT+a64_0x224f70(0x170);export function getOAuthClientId(){const _0x295b0d=a64_0x224f70;return process.env.TD_OAUTH_CLIENT_ID||_0x295b0d(0x184);}export function generatePKCEPair(){const _0x37a411=a64_0x224f70,_0xf12503=a64_0x3532b4[_0x37a411(0x1ac)](0x20)[_0x37a411(0x1a6)](_0x37a411(0x193)),_0x5911db=a64_0x3532b4[_0x37a411(0x196)](_0x37a411(0x198))['update'](_0xf12503)[_0x37a411(0x186)](_0x37a411(0x193));return{'verifier':_0xf12503,'challenge':_0x5911db};}export function buildAuthorizeURL(_0x5e1183,_0x1494a7){const _0x2ddb66=a64_0x224f70,_0xb6018b=new URL(_0x2ddb66(0x1ae),_0x5e1183);return _0xb6018b[_0x2ddb66(0x18a)][_0x2ddb66(0x174)](_0x2ddb66(0x179),_0x2ddb66(0x1b7)),_0xb6018b[_0x2ddb66(0x18a)][_0x2ddb66(0x174)](_0x2ddb66(0x1a5),_0x1494a7[_0x2ddb66(0x171)]),_0xb6018b[_0x2ddb66(0x18a)][_0x2ddb66(0x174)](_0x2ddb66(0x1a4),_0x1494a7[_0x2ddb66(0x18d)]),_0xb6018b[_0x2ddb66(0x18a)][_0x2ddb66(0x174)](_0x2ddb66(0x172),_0x1494a7[_0x2ddb66(0x172)]),_0xb6018b[_0x2ddb66(0x18a)][_0x2ddb66(0x174)](_0x2ddb66(0x188),_0x1494a7[_0x2ddb66(0x1ab)]),_0xb6018b['searchParams'][_0x2ddb66(0x174)](_0x2ddb66(0x190),'S256'),_0x1494a7[_0x2ddb66(0x1b5)]&&_0xb6018b[_0x2ddb66(0x18a)]['set'](_0x2ddb66(0x1b5),_0x1494a7['scope']),_0xb6018b['toString']();}export function buildSSOInitiateURL(_0x5d7e5b,_0xfb46de,_0x47a153){const _0x518817=a64_0x224f70,_0x377d2b=new URL(_0x518817(0x176),_0x5d7e5b);_0x377d2b[_0x518817(0x18a)][_0x518817(0x174)](_0x518817(0x183),_0xfb46de);const _0x6b372f=_0x47a153[_0x518817(0x19a)](_0x5d7e5b,'');return _0x377d2b[_0x518817(0x18a)]['set'](_0x518817(0x1aa),_0x6b372f),_0x377d2b[_0x518817(0x1a6)]();}export async function postTokenRequest(_0x32e253,_0x425609){const _0x3582c7=a64_0x224f70,_0x4fccab=new URLSearchParams(_0x425609)[_0x3582c7(0x1a6)](),_0x225538=await fetch(_0x32e253,{'method':_0x3582c7(0x19d),'headers':{'Content-Type':_0x3582c7(0x194)},'body':_0x4fccab});if(!_0x225538['ok']){const _0x3fa313=await _0x225538[_0x3582c7(0x1a8)]();throw new Error(_0x3582c7(0x185)+_0x225538[_0x3582c7(0x173)]+'):\x20'+_0x3fa313);}const _0x1b06fe=await _0x225538[_0x3582c7(0x1b4)]();return{'access_token':_0x1b06fe[_0x3582c7(0x17a)],'refresh_token':_0x1b06fe[_0x3582c7(0x17f)],'scope':_0x1b06fe[_0x3582c7(0x1b5)],'expires_at':_0x1b06fe['expires_in']?Date[_0x3582c7(0x18f)]()+_0x1b06fe[_0x3582c7(0x1b2)]*0x3e8:undefined};}export async function exchangeCodeForTokens(_0x169051,_0x11fe48,_0x157522,_0x3e2743){const _0x1c33b3=a64_0x224f70,_0x421f4e=_0x169051+_0x1c33b3(0x192);return postTokenRequest(_0x421f4e,{'grant_type':_0x1c33b3(0x18e),'client_id':getOAuthClientId(),'code':_0x11fe48,'code_verifier':_0x157522,'redirect_uri':_0x3e2743});}export function startLocalCallbackServer(){const _0x27b5c9=a64_0x224f70;let _0x9af17e,_0x527f9a;const _0x1e80f1=new Promise((_0x3bcf64,_0xd308f4)=>{_0x9af17e=_0x3bcf64,_0x527f9a=_0xd308f4;}),_0x15a003=a64_0x18d0b0[_0x27b5c9(0x1b6)]((_0x1c3d2f,_0x334d55)=>{const _0x4714eb=_0x27b5c9,_0x26e849=new URL(_0x1c3d2f[_0x4714eb(0x17c)]||'/',_0x4714eb(0x18c));if(_0x26e849[_0x4714eb(0x1b0)]!==_0x4714eb(0x170)){_0x334d55['writeHead'](0x194,{'Content-Type':_0x4714eb(0x19f)}),_0x334d55['end'](_0x4714eb(0x1a7));return;}const _0x3c1134=_0x26e849[_0x4714eb(0x18a)][_0x4714eb(0x180)](_0x4714eb(0x1b7)),_0x31ef99=_0x26e849[_0x4714eb(0x18a)][_0x4714eb(0x180)](_0x4714eb(0x172)),_0x5165ed=_0x26e849['searchParams'][_0x4714eb(0x180)](_0x4714eb(0x175));if(_0x5165ed||!_0x3c1134||!_0x31ef99){_0x334d55[_0x4714eb(0x178)](0x190,{'Content-Type':'text/html'}),_0x334d55['end'](_0x4714eb(0x17e)),_0x527f9a(new Error(_0x4714eb(0x191)));return;}_0x334d55[_0x4714eb(0x178)](0xc8,{'Content-Type':'text/html'}),_0x334d55[_0x4714eb(0x1a3)](_0x4714eb(0x1a1)),_0x9af17e({'code':_0x3c1134,'state':_0x31ef99});});_0x15a003['on']('error',_0x5c0ecd=>{const _0x2c476=_0x27b5c9;_0x5c0ecd[_0x2c476(0x1b7)]===_0x2c476(0x17b)?_0x527f9a(new Error(_0x2c476(0x1b1)+OAUTH_CALLBACK_PORT+_0x2c476(0x19e))):_0x527f9a(new Error('Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20'+_0x5c0ecd['message']));}),_0x15a003[_0x27b5c9(0x19b)](OAUTH_CALLBACK_PORT,_0x27b5c9(0x1b3));const _0x39a700=setTimeout(()=>{const _0x6c65ca=_0x27b5c9;_0x527f9a(new Error(_0x6c65ca(0x1a0))),_0x15a003[_0x6c65ca(0x1a2)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x1e80f1,'close':()=>{const _0x3b9539=_0x27b5c9;clearTimeout(_0x39a700),_0x15a003[_0x3b9539(0x1a2)]();}};}function a64_0x3bb5(_0x17be9d,_0x4d2a24){_0x17be9d=_0x17be9d-0x170;const _0x6e8505=a64_0x6e85();let _0x3bb5ea=_0x6e8505[_0x17be9d];return _0x3bb5ea;}export async function startOAuthFlow(_0x637aec,_0x5cf1da){const _0x392a64=a64_0x224f70,_0x20962d=getConsoleUrl(_0x637aec),_0x3079fb=getOAuthClientId(),{verifier:_0x240c36,challenge:_0x251547}=generatePKCEPair(),_0x705734=a64_0x3532b4[_0x392a64(0x1ac)](0x10)[_0x392a64(0x1a6)](_0x392a64(0x17d)),_0x281f0e=startLocalCallbackServer();try{const _0x103b25=OAUTH_REDIRECT_URI,_0x258231=buildAuthorizeURL(_0x20962d,{'clientId':_0x3079fb,'redirectUri':_0x103b25,'state':_0x705734,'codeChallenge':_0x251547,'scope':_0x392a64(0x19c)}),_0x3e5212=_0x5cf1da?.['accountName']?buildSSOInitiateURL(_0x20962d,_0x5cf1da[_0x392a64(0x1ad)],_0x258231):_0x258231;openBrowser(_0x3e5212);const _0x50123d=await _0x281f0e[_0x392a64(0x197)]();if(_0x50123d[_0x392a64(0x172)]!==_0x705734)throw new Error(_0x392a64(0x181));return await exchangeCodeForTokens(_0x20962d,_0x50123d['code'],_0x240c36,_0x103b25);}finally{_0x281f0e[_0x392a64(0x1a2)]();}}
1
+ const a64_0x1614cc=a64_0x158e;(function(_0x1d1d4f,_0x5c42fe){const _0x38ae91=a64_0x158e,_0xafae28=_0x1d1d4f();while(!![]){try{const _0x2cf35d=parseInt(_0x38ae91(0xf4))/0x1*(parseInt(_0x38ae91(0x112))/0x2)+-parseInt(_0x38ae91(0x10c))/0x3*(-parseInt(_0x38ae91(0x109))/0x4)+parseInt(_0x38ae91(0xe5))/0x5+parseInt(_0x38ae91(0xe9))/0x6*(-parseInt(_0x38ae91(0x126))/0x7)+parseInt(_0x38ae91(0xf0))/0x8+parseInt(_0x38ae91(0xee))/0x9+-parseInt(_0x38ae91(0x120))/0xa;if(_0x2cf35d===_0x5c42fe)break;else _0xafae28['push'](_0xafae28['shift']());}catch(_0x12ff2b){_0xafae28['push'](_0xafae28['shift']());}}}(a64_0x2245,0xdb5e0));function a64_0x158e(_0x42f84f,_0x317637){_0x42f84f=_0x42f84f-0xe5;const _0x224518=a64_0x2245();let _0x158ec5=_0x224518[_0x42f84f];return _0x158ec5;}import*as a64_0x3e8548 from'node:crypto';import*as a64_0x37e788 from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';function a64_0x2245(){const _0x1de32c=['EADDRINUSE','state','redirect_to_path','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','13261851XQfsHL','accountName','13541216DMxWQJ','createHash','code_challenge_method','redirectUri','47oqbWfb','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','code','codeChallenge','text/plain','end','OAuth\x20token\x20request\x20failed\x20(','scope','application/x-www-form-urlencoded','digest','refresh_token','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','get','randomBytes','clientId','waitForCallback','Port\x20','searchParams','expires_in','authorization_code','Not\x20Found','5836ghHgNk','sha256','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','2733NauvnB','POST','http://localhost:','base64url','createServer','client_id','40724APHoHl','error','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','pathname','url','access_token','text/html','close','text','http://127.0.0.1','redirect_uri','toString','writeHead','response_type','37063980LIoxvO','set','update','/oauth/callback','):\x20','account_name','139853OcXlsZ','hex','tdx','2355930KcJDgu','now','/oauth/token','/users/initiate_sso','396jAKapK'];a64_0x2245=function(){return _0x1de32c;};return a64_0x2245();}export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI=a64_0x1614cc(0x10e)+OAUTH_CALLBACK_PORT+a64_0x1614cc(0x123);export function getOAuthClientId(){const _0x32c667=a64_0x1614cc;return process.env.TD_OAUTH_CLIENT_ID||_0x32c667(0x128);}export function generatePKCEPair(){const _0x308053=a64_0x1614cc,_0x2cadca=a64_0x3e8548[_0x308053(0x101)](0x20)[_0x308053(0x11d)](_0x308053(0x10f)),_0x50eb1e=a64_0x3e8548[_0x308053(0xf1)](_0x308053(0x10a))[_0x308053(0x122)](_0x2cadca)[_0x308053(0xfd)](_0x308053(0x10f));return{'verifier':_0x2cadca,'challenge':_0x50eb1e};}export function buildAuthorizeURL(_0x416a03,_0x4e1109){const _0x3ecf01=a64_0x1614cc,_0x4d12cd=new URL('/oauth/authorize',_0x416a03);return _0x4d12cd[_0x3ecf01(0x105)][_0x3ecf01(0x121)](_0x3ecf01(0x11f),_0x3ecf01(0xf6)),_0x4d12cd['searchParams'][_0x3ecf01(0x121)](_0x3ecf01(0x111),_0x4e1109[_0x3ecf01(0x102)]),_0x4d12cd['searchParams'][_0x3ecf01(0x121)](_0x3ecf01(0x11c),_0x4e1109[_0x3ecf01(0xf3)]),_0x4d12cd[_0x3ecf01(0x105)][_0x3ecf01(0x121)]('state',_0x4e1109[_0x3ecf01(0xeb)]),_0x4d12cd[_0x3ecf01(0x105)]['set']('code_challenge',_0x4e1109[_0x3ecf01(0xf7)]),_0x4d12cd[_0x3ecf01(0x105)]['set'](_0x3ecf01(0xf2),'S256'),_0x4e1109[_0x3ecf01(0xfb)]&&_0x4d12cd[_0x3ecf01(0x105)][_0x3ecf01(0x121)](_0x3ecf01(0xfb),_0x4e1109['scope']),_0x4d12cd[_0x3ecf01(0x11d)]();}export function buildSSOInitiateURL(_0x285835,_0x47eb87,_0x127898){const _0x127dc9=a64_0x1614cc,_0x289887=new URL(_0x127dc9(0xe8),_0x285835);_0x289887[_0x127dc9(0x105)]['set'](_0x127dc9(0x125),_0x47eb87);const _0x38bcca=_0x127898['replace'](_0x285835,'');return _0x289887[_0x127dc9(0x105)][_0x127dc9(0x121)](_0x127dc9(0xec),_0x38bcca),_0x289887['toString']();}export async function postTokenRequest(_0x5bd214,_0x85e439){const _0x356b0a=a64_0x1614cc,_0x4c5cde=new URLSearchParams(_0x85e439)[_0x356b0a(0x11d)](),_0x1f34d8=await fetch(_0x5bd214,{'method':_0x356b0a(0x10d),'headers':{'Content-Type':_0x356b0a(0xfc)},'body':_0x4c5cde});if(!_0x1f34d8['ok']){const _0x1aa0f3=await _0x1f34d8[_0x356b0a(0x11a)]();throw new Error(_0x356b0a(0xfa)+_0x1f34d8['status']+_0x356b0a(0x124)+_0x1aa0f3);}const _0x52d0c9=await _0x1f34d8['json']();return{'access_token':_0x52d0c9[_0x356b0a(0x117)],'refresh_token':_0x52d0c9[_0x356b0a(0xfe)],'scope':_0x52d0c9[_0x356b0a(0xfb)],'expires_at':_0x52d0c9[_0x356b0a(0x106)]?Date[_0x356b0a(0xe6)]()+_0x52d0c9[_0x356b0a(0x106)]*0x3e8:undefined};}export async function exchangeCodeForTokens(_0x42ac0c,_0x58be8e,_0x3bbd7d,_0x332f56){const _0x5e7f8f=a64_0x1614cc,_0x5e291f=_0x42ac0c+_0x5e7f8f(0xe7);return postTokenRequest(_0x5e291f,{'grant_type':_0x5e7f8f(0x107),'client_id':getOAuthClientId(),'code':_0x58be8e,'code_verifier':_0x3bbd7d,'redirect_uri':_0x332f56});}export function startLocalCallbackServer(){const _0x21f083=a64_0x1614cc;let _0x2621fa,_0x177ac7;const _0x1162d6=new Promise((_0x2fc787,_0x543da0)=>{_0x2621fa=_0x2fc787,_0x177ac7=_0x543da0;}),_0x3e0c50=a64_0x37e788[_0x21f083(0x110)]((_0x10ba15,_0x34923c)=>{const _0x4d540d=_0x21f083,_0x5052dc=new URL(_0x10ba15[_0x4d540d(0x116)]||'/',_0x4d540d(0x11b));if(_0x5052dc[_0x4d540d(0x115)]!=='/oauth/callback'){_0x34923c[_0x4d540d(0x11e)](0x194,{'Content-Type':_0x4d540d(0xf8)}),_0x34923c['end'](_0x4d540d(0x108));return;}const _0x2d2c2a=_0x5052dc[_0x4d540d(0x105)]['get'](_0x4d540d(0xf6)),_0x30b8ab=_0x5052dc['searchParams'][_0x4d540d(0x100)]('state'),_0x218165=_0x5052dc[_0x4d540d(0x105)][_0x4d540d(0x100)]('error');if(_0x218165||!_0x2d2c2a||!_0x30b8ab){_0x34923c[_0x4d540d(0x11e)](0x190,{'Content-Type':_0x4d540d(0x118)}),_0x34923c[_0x4d540d(0xf9)]('<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>'),_0x177ac7(new Error(_0x4d540d(0xed)));return;}_0x34923c[_0x4d540d(0x11e)](0xc8,{'Content-Type':_0x4d540d(0x118)}),_0x34923c['end'](_0x4d540d(0xf5)),_0x2621fa({'code':_0x2d2c2a,'state':_0x30b8ab});});_0x3e0c50['on'](_0x21f083(0x113),_0x32989f=>{const _0x38a6b0=_0x21f083;_0x32989f[_0x38a6b0(0xf6)]===_0x38a6b0(0xea)?_0x177ac7(new Error(_0x38a6b0(0x104)+OAUTH_CALLBACK_PORT+_0x38a6b0(0x114))):_0x177ac7(new Error(_0x38a6b0(0x10b)+_0x32989f['message']));}),_0x3e0c50['listen'](OAUTH_CALLBACK_PORT,'127.0.0.1');const _0x1e0ec6=setTimeout(()=>{const _0x45d536=_0x21f083;_0x177ac7(new Error(_0x45d536(0xff))),_0x3e0c50[_0x45d536(0x119)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x1162d6,'close':()=>{const _0x446d03=_0x21f083;clearTimeout(_0x1e0ec6),_0x3e0c50[_0x446d03(0x119)]();}};}export async function startOAuthFlow(_0x5bd276,_0x4c18f0){const _0x24fe39=a64_0x1614cc,_0x16bf76=getConsoleUrl(_0x5bd276),_0x38ffd8=getOAuthClientId(),{verifier:_0x4f6d48,challenge:_0x3203cc}=generatePKCEPair(),_0x11410e=a64_0x3e8548[_0x24fe39(0x101)](0x10)[_0x24fe39(0x11d)](_0x24fe39(0x127)),_0xd12068=startLocalCallbackServer();try{const _0x564a9a=OAUTH_REDIRECT_URI,_0x26c8bc=buildAuthorizeURL(_0x16bf76,{'clientId':_0x38ffd8,'redirectUri':_0x564a9a,'state':_0x11410e,'codeChallenge':_0x3203cc,'scope':'openid\x20email\x20profile'}),_0x4369d2=_0x4c18f0?.[_0x24fe39(0xef)]?buildSSOInitiateURL(_0x16bf76,_0x4c18f0[_0x24fe39(0xef)],_0x26c8bc):_0x26c8bc;openBrowser(_0x4369d2);const _0x258202=await _0xd12068[_0x24fe39(0x103)]();if(_0x258202[_0x24fe39(0xeb)]!==_0x11410e)throw new Error('OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack');return await exchangeCodeForTokens(_0x16bf76,_0x258202['code'],_0x4f6d48,_0x564a9a);}finally{_0xd12068['close']();}}
@@ -1 +1 @@
1
- (function(_0x29bd35,_0x481aca){const _0x2daf5b=a65_0x2035,_0x4b686b=_0x29bd35();while(!![]){try{const _0xb9c322=-parseInt(_0x2daf5b(0x132))/0x1*(-parseInt(_0x2daf5b(0x13d))/0x2)+-parseInt(_0x2daf5b(0xf0))/0x3+parseInt(_0x2daf5b(0xfb))/0x4+-parseInt(_0x2daf5b(0xfd))/0x5*(parseInt(_0x2daf5b(0x113))/0x6)+-parseInt(_0x2daf5b(0x114))/0x7*(-parseInt(_0x2daf5b(0x12e))/0x8)+-parseInt(_0x2daf5b(0xf5))/0x9+parseInt(_0x2daf5b(0x12b))/0xa;if(_0xb9c322===_0x481aca)break;else _0x4b686b['push'](_0x4b686b['shift']());}catch(_0x4549ec){_0x4b686b['push'](_0x4b686b['shift']());}}}(a65_0x5750,0x9527a));import*as a65_0x45092c from'node:fs';import*as a65_0x1f6bb1 from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';function a65_0x5750(){const _0xe07465=['string','\x27\x20will\x20be\x20ignored','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','user','values','test','.env','readdirSync','INVALID_PROFILE_CONFIG','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','\x27:\x20unknown\x20config\x20key\x20\x27','warn','site','\x27\x20not\x20found\x20in\x20user\x20configuration','5150460TxafqX','Error:\x20','description','16AMKuni','Invalid\x20profile\x20name:\x20','filter',',\x20creating\x20new\x20file','1nDYMcP','database','Failed\x20to\x20parse\x20','To\x20migrate:','localeCompare','\x27:\x20config\x20must\x20be\x20an\x20object','from','profiles','parent_segment','existsSync','Profile\x20','611422mqkACx','user_info','258567drKfGB','isDirectory','push','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','Profile\x20\x27','5242176qOhiqA','tdx.json','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','length','rmSync','Warning:\x20Failed\x20to\x20parse\x20','624660MDzqkO','entries','5PwRCeQ','.env.','object','stringify','utf-8','llm_project','toISOString','map','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','parse','join','find','local','name','llm_agent','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','message','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','\x20does\x20not\x20exist','profile','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','1607754ccmdCt','1997198KAhARk','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','\x20\x201.\x20Edit:\x20','readFileSync','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','Warning:\x20Profile\x20\x27','sort','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','includes'];a65_0x5750=function(){return _0xe07465;};return a65_0x5750();}import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME='@tdx-studio';export function getProfileParams(_0x59eaee){const _0x2fa01c=a65_0x2035,_0x35e555={};if(!_0x59eaee)return _0x35e555;for(const [_0x1031e9,_0x53c3ea]of Object[_0x2fa01c(0xfc)](_0x59eaee)){_0x1031e9!==_0x2fa01c(0x12d)&&_0x53c3ea!==undefined&&(_0x35e555[_0x1031e9]=_0x53c3ea);}return _0x35e555;}export function getProfilesDir(){const _0x1da3db=a65_0x2035;return a65_0x1f6bb1[_0x1da3db(0x107)](getConfigDir(),'profiles');}function getProfileDir(_0x163e2d){return a65_0x1f6bb1['join'](getProfilesDir(),_0x163e2d);}function getProfileConfigPath(_0x22dc57){const _0x3e6a19=a65_0x2035;return a65_0x1f6bb1[_0x3e6a19(0x107)](getProfileDir(_0x22dc57),'tdx.json');}function getProfileEnvPath(_0x2502ad){const _0x3a9293=a65_0x2035;return a65_0x1f6bb1['join'](getProfileDir(_0x2502ad),_0x3a9293(0x123));}function getGlobalConfigPath(){const _0x59da7e=a65_0x2035;return a65_0x1f6bb1[_0x59da7e(0x107)](getConfigDir(),_0x59da7e(0xf6));}function validateProfileName(_0x50a120){const _0x1a0320=a65_0x2035;if(/^@?[a-zA-Z0-9_-]+$/[_0x1a0320(0x122)](_0x50a120))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x1a0320(0x122)](_0x50a120))return;throw new Error(_0x1a0320(0x12f)+_0x50a120+_0x1a0320(0x126));}function validateProfileConfig(_0x3cb000,_0xf08188){const _0x31441f=a65_0x2035;if(typeof _0x3cb000!==_0x31441f(0xff)||_0x3cb000===null)throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x31441f(0xf4)+_0xf08188+_0x31441f(0x137));const _0x146a6c=['description','site','database',_0x31441f(0x13a),'llm_project',_0x31441f(0x10b),_0x31441f(0xef)],_0x15bc4c=_0x3cb000;for(const _0x21b918 of Object['keys'](_0x15bc4c)){!_0x146a6c[_0x31441f(0x11c)](_0x21b918)&&console['warn'](_0x31441f(0x119)+_0xf08188+_0x31441f(0x127)+_0x21b918+_0x31441f(0x11e));}if(_0x15bc4c[_0x31441f(0x12d)]!==undefined&&typeof _0x15bc4c['description']!=='string')throw new SDKError(ErrorCode[_0x31441f(0x125)],_0x31441f(0xf4)+_0xf08188+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x15bc4c[_0x31441f(0x129)]!==undefined&&typeof _0x15bc4c['site']!=='string')throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x31441f(0xf4)+_0xf08188+_0x31441f(0x10d));if(_0x15bc4c[_0x31441f(0x133)]!==undefined&&typeof _0x15bc4c[_0x31441f(0x133)]!=='string')throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0xf08188+_0x31441f(0xf7));if(_0x15bc4c['parent_segment']!==undefined&&typeof _0x15bc4c[_0x31441f(0x13a)]!==_0x31441f(0x11d))throw new SDKError(ErrorCode[_0x31441f(0x125)],_0x31441f(0xf4)+_0xf08188+_0x31441f(0x112));if(_0x15bc4c[_0x31441f(0x102)]!==undefined&&typeof _0x15bc4c['llm_project']!=='string')throw new SDKError(ErrorCode[_0x31441f(0x125)],'Profile\x20\x27'+_0xf08188+_0x31441f(0x10f));if(_0x15bc4c[_0x31441f(0x10b)]!==undefined&&typeof _0x15bc4c[_0x31441f(0x10b)]!==_0x31441f(0x11d))throw new SDKError(ErrorCode[_0x31441f(0x125)],_0x31441f(0xf4)+_0xf08188+_0x31441f(0x105));return!![];}function loadProfilesFromTdxJson(_0x2c5f7c,_0x2467b7){const _0x1dc56f=a65_0x2035;if(!a65_0x45092c['existsSync'](_0x2c5f7c))return[];try{const _0x1e21fa=a65_0x45092c[_0x1dc56f(0x117)](_0x2c5f7c,_0x1dc56f(0x101)),_0x3bbf28=JSON[_0x1dc56f(0x106)](_0x1e21fa);if(!_0x3bbf28[_0x1dc56f(0x139)]||typeof _0x3bbf28[_0x1dc56f(0x139)]!==_0x1dc56f(0xff))return[];const _0x2e200f=[];for(const [_0x2ad40b,_0xbe8b5]of Object[_0x1dc56f(0xfc)](_0x3bbf28[_0x1dc56f(0x139)])){try{validateProfileConfig(_0xbe8b5,_0x2ad40b);const _0x329e7c=getNewCredentialPath(_0x2ad40b),_0x47ec51=getOldCredentialPath(_0x2ad40b),_0x44d464=a65_0x45092c['existsSync'](_0x329e7c)||a65_0x45092c[_0x1dc56f(0x13b)](_0x47ec51);_0x2e200f[_0x1dc56f(0xf2)]({'name':_0x2ad40b,'config':_0xbe8b5,'metadata':{'name':_0x2ad40b,'createdAt':new Date()[_0x1dc56f(0x103)]()},'hasCredentials':_0x44d464,'scope':_0x2467b7});}catch(_0x20b348){_0x20b348 instanceof Error&&(console['warn'](_0x1dc56f(0x11f)+_0x2c5f7c+':'),console[_0x1dc56f(0x128)]('\x20\x20'+_0x20b348[_0x1dc56f(0x10e)]+'\x0a'));}}return _0x2e200f;}catch(_0x51749f){return _0x51749f instanceof SyntaxError?(console['warn']('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x2c5f7c+':\x20Invalid\x20JSON\x20syntax'),console[_0x1dc56f(0x128)](_0x1dc56f(0x12c)+_0x51749f['message']+'\x0a')):console[_0x1dc56f(0x128)](_0x1dc56f(0x11b)+_0x2c5f7c+':\x20'+_0x51749f+'\x0a'),[];}}export function getNewCredentialPath(_0x2f90fd){const _0x19ee4b=a65_0x2035;return a65_0x1f6bb1[_0x19ee4b(0x107)](getConfigDir(),_0x19ee4b(0xfe)+_0x2f90fd);}function getOldCredentialPath(_0x3f413c){const _0x431b9c=a65_0x2035;return a65_0x1f6bb1['join'](getProfilesDir(),_0x3f413c,_0x431b9c(0x123));}function loadProfilesFromTdxJsonFiles(){const _0x1d13e5=a65_0x2035,_0x54bd4f=[],_0x5662cd=findProjectConfigPath();_0x5662cd&&_0x54bd4f[_0x1d13e5(0xf2)](...loadProfilesFromTdxJson(_0x5662cd,_0x1d13e5(0x109)));const _0x4f4632=a65_0x1f6bb1[_0x1d13e5(0x107)](getConfigDir(),'tdx.json');return _0x54bd4f[_0x1d13e5(0xf2)](...loadProfilesFromTdxJson(_0x4f4632,_0x1d13e5(0x120))),_0x54bd4f;}function loadProfilesFromDirectories(){const _0x20b6f1=a65_0x2035,_0x3657f0=getProfilesDir();if(!a65_0x45092c[_0x20b6f1(0x13b)](_0x3657f0))return[];try{return a65_0x45092c[_0x20b6f1(0x124)](_0x3657f0,{'withFileTypes':!![]})[_0x20b6f1(0x130)](_0xe4d8e4=>_0xe4d8e4[_0x20b6f1(0xf1)]())[_0x20b6f1(0x104)](_0x1011b3=>_0x1011b3['name'])[_0x20b6f1(0x130)](_0x536e16=>{const _0x4b06d6=_0x20b6f1,_0x19fa3c=getProfileConfigPath(_0x536e16),_0x4acbba=getProfileEnvPath(_0x536e16);return a65_0x45092c[_0x4b06d6(0x13b)](_0x19fa3c)||a65_0x45092c['existsSync'](_0x4acbba);})[_0x20b6f1(0x104)](_0x373519=>{const _0x3f49fd=loadProfileFromDirectory(_0x373519);if(_0x3f49fd)return{..._0x3f49fd,'scope':'directory'};return null;})['filter'](_0x45bee3=>_0x45bee3!==null);}catch{return[];}}function loadProfileFromDirectory(_0x2602de){const _0x32ca80=a65_0x2035,_0x1f37b1=getProfileConfigPath(_0x2602de),_0xf3496f=getOldCredentialPath(_0x2602de);if(!a65_0x45092c[_0x32ca80(0x13b)](_0x1f37b1)&&!a65_0x45092c[_0x32ca80(0x13b)](_0xf3496f))return null;let _0x1a9afc={},_0x40d633={'name':_0x2602de,'createdAt':new Date()[_0x32ca80(0x103)]()};if(a65_0x45092c['existsSync'](_0x1f37b1))try{const _0x2c5d23=a65_0x45092c[_0x32ca80(0x117)](_0x1f37b1,_0x32ca80(0x101)),_0x2e679c=JSON[_0x32ca80(0x106)](_0x2c5d23),{metadata:_0x2e83d4,..._0x42f661}=_0x2e679c;_0x1a9afc=_0x42f661,_0x2e83d4&&(_0x40d633=_0x2e83d4);}catch{}return{'name':_0x2602de,'config':_0x1a9afc,'metadata':_0x40d633,'hasCredentials':a65_0x45092c['existsSync'](_0xf3496f),'scope':'directory'};}export function listProfiles(){const _0x456636=a65_0x2035,_0x3cf13e=loadProfilesFromTdxJsonFiles(),_0x221aed=loadProfilesFromDirectories();if(_0x221aed[_0x456636(0xf8)]>0x0){const _0x1d1a0b=_0x221aed[_0x456636(0x104)](_0x4bf619=>_0x4bf619[_0x456636(0x10a)])['join'](',\x20'),_0x225fc8=getConfigDir();console[_0x456636(0x128)](_0x456636(0x115)+_0x1d1a0b),console[_0x456636(0x128)](_0x456636(0x10c)),console[_0x456636(0x128)](_0x456636(0x116)+a65_0x1f6bb1[_0x456636(0x107)](_0x225fc8,_0x456636(0xf6))),console[_0x456636(0x128)](_0x456636(0xf3)),console['warn']('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x449369=[..._0x3cf13e,..._0x221aed],_0x30e733=new Map();for(const _0x324249 of _0x449369){!_0x30e733['has'](_0x324249[_0x456636(0x10a)])&&_0x30e733['set'](_0x324249['name'],_0x324249);}return Array[_0x456636(0x138)](_0x30e733[_0x456636(0x121)]())[_0x456636(0x11a)]((_0x58d11d,_0x3ec9a3)=>_0x58d11d[_0x456636(0x10a)][_0x456636(0x136)](_0x3ec9a3[_0x456636(0x10a)]));}export function profileExists(_0x3478aa){const _0x21019e=a65_0x2035,_0x456aa7=listProfiles();return _0x456aa7['some'](_0x394e10=>_0x394e10[_0x21019e(0x10a)]===_0x3478aa);}export function loadProfile(_0x459e34){const _0x5c29d6=a65_0x2035;validateProfileName(_0x459e34);const _0x1d245c=listProfiles(),_0x53cd99=_0x1d245c[_0x5c29d6(0x108)](_0x4c7423=>_0x4c7423[_0x5c29d6(0x10a)]===_0x459e34);return _0x53cd99||null;}export function saveProfile(_0x57b368,_0x5afea2,_0x5c08ab=![]){saveProfileToUserConfig(_0x57b368,_0x5afea2);}export function deleteProfile(_0x14b159){const _0x516de6=a65_0x2035;validateProfileName(_0x14b159);const _0x3885c0=getProfileDir(_0x14b159);if(!a65_0x45092c['existsSync'](_0x3885c0))throw new Error(_0x516de6(0x13c)+_0x14b159+_0x516de6(0x110));a65_0x45092c[_0x516de6(0xf9)](_0x3885c0,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x19934d,_0x381f3f){const _0x533ddb=a65_0x2035;validateProfileName(_0x19934d);const _0x13854=getGlobalConfigPath(),_0x263792=getConfigDir();!a65_0x45092c[_0x533ddb(0x13b)](_0x263792)&&createSecureDirectory(_0x263792);let _0x3ef4e7={};if(a65_0x45092c[_0x533ddb(0x13b)](_0x13854))try{const _0x436a49=a65_0x45092c[_0x533ddb(0x117)](_0x13854,_0x533ddb(0x101));_0x3ef4e7=JSON[_0x533ddb(0x106)](_0x436a49);}catch{console['warn'](_0x533ddb(0xfa)+_0x13854+',\x20creating\x20new\x20file');}!_0x3ef4e7[_0x533ddb(0x139)]&&(_0x3ef4e7[_0x533ddb(0x139)]={}),_0x3ef4e7[_0x533ddb(0x139)][_0x19934d]=_0x381f3f,writeSecureFile(_0x13854,JSON[_0x533ddb(0x100)](_0x3ef4e7,null,0x2));}function a65_0x2035(_0x3ed5ba,_0x3c64d0){_0x3ed5ba=_0x3ed5ba-0xef;const _0x57503a=a65_0x5750();let _0x2035cb=_0x57503a[_0x3ed5ba];return _0x2035cb;}export function removeProfileFromUserConfig(_0x3c1e6a){const _0x548c8f=a65_0x2035;validateProfileName(_0x3c1e6a);const _0x3928e5=getGlobalConfigPath();if(!a65_0x45092c[_0x548c8f(0x13b)](_0x3928e5))throw new Error('Profile\x20\x27'+_0x3c1e6a+_0x548c8f(0x12a));let _0x4937b0={};try{const _0x4e748f=a65_0x45092c[_0x548c8f(0x117)](_0x3928e5,_0x548c8f(0x101));_0x4937b0=JSON[_0x548c8f(0x106)](_0x4e748f);}catch{throw new Error(_0x548c8f(0x134)+_0x3928e5);}if(!_0x4937b0[_0x548c8f(0x139)]||!_0x4937b0[_0x548c8f(0x139)][_0x3c1e6a])throw new Error(_0x548c8f(0xf4)+_0x3c1e6a+_0x548c8f(0x12a));delete _0x4937b0[_0x548c8f(0x139)][_0x3c1e6a],_0x4937b0['profile']===_0x3c1e6a&&delete _0x4937b0[_0x548c8f(0x111)],writeSecureFile(_0x3928e5,JSON[_0x548c8f(0x100)](_0x4937b0,null,0x2));}export function getActiveProfile(){const _0x7ea08e=a65_0x2035,_0x8863ba=loadSessionContext();if(_0x8863ba?.['profile'])return _0x8863ba[_0x7ea08e(0x111)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x4601d7=getGlobalConfigPath();if(!a65_0x45092c['existsSync'](_0x4601d7))return null;try{const _0x13fb05=a65_0x45092c[_0x7ea08e(0x117)](_0x4601d7,_0x7ea08e(0x101)),_0x4a1fc8=JSON[_0x7ea08e(0x106)](_0x13fb05);return _0x4a1fc8[_0x7ea08e(0x111)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x518ed4){const _0x3a7bfb=a65_0x2035,_0x3529be=getGlobalConfigPath(),_0x529c2e=getConfigDir();!a65_0x45092c['existsSync'](_0x529c2e)&&createSecureDirectory(_0x529c2e);let _0x3eec55={};if(a65_0x45092c[_0x3a7bfb(0x13b)](_0x3529be))try{const _0x5e8a86=a65_0x45092c[_0x3a7bfb(0x117)](_0x3529be,_0x3a7bfb(0x101));_0x3eec55=JSON[_0x3a7bfb(0x106)](_0x5e8a86);}catch{console[_0x3a7bfb(0x128)](_0x3a7bfb(0xfa)+_0x3529be+_0x3a7bfb(0x131));}_0x3eec55[_0x3a7bfb(0x129)]=_0x518ed4,writeSecureFile(_0x3529be,JSON['stringify'](_0x3eec55,null,0x2));}export function saveActiveProfileToUserConfig(_0x27de99){const _0x36e3fc=a65_0x2035;validateProfileName(_0x27de99);const _0x453794=getGlobalConfigPath(),_0x14cd4f=getConfigDir();!a65_0x45092c[_0x36e3fc(0x13b)](_0x14cd4f)&&createSecureDirectory(_0x14cd4f);let _0x411aa1={};if(a65_0x45092c[_0x36e3fc(0x13b)](_0x453794))try{const _0x1b9e0d=a65_0x45092c['readFileSync'](_0x453794,_0x36e3fc(0x101));_0x411aa1=JSON['parse'](_0x1b9e0d);}catch{console[_0x36e3fc(0x128)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x453794+',\x20creating\x20new\x20file');}_0x411aa1[_0x36e3fc(0x111)]=_0x27de99,writeSecureFile(_0x453794,JSON[_0x36e3fc(0x100)](_0x411aa1,null,0x2));}function clearFieldFromUserConfig(_0x59cca2){const _0x1559d5=a65_0x2035,_0x1b3b61=getGlobalConfigPath();if(!a65_0x45092c['existsSync'](_0x1b3b61))return;let _0x27a726={};try{const _0x2ac62b=a65_0x45092c[_0x1559d5(0x117)](_0x1b3b61,'utf-8');_0x27a726=JSON['parse'](_0x2ac62b);}catch{return;}delete _0x27a726[_0x59cca2],writeSecureFile(_0x1b3b61,JSON[_0x1559d5(0x100)](_0x27a726,null,0x2));}export function clearDefaultSiteFromUserConfig(){clearFieldFromUserConfig('site');}export function clearActiveProfileFromUserConfig(){const _0x5f39cd=a65_0x2035;clearFieldFromUserConfig(_0x5f39cd(0x111));}export function createProfile(_0x444033,_0x5bfc04){const _0x4c5619=a65_0x2035;validateProfileName(_0x444033);if(profileExists(_0x444033))throw new Error(_0x4c5619(0x13c)+_0x444033+'\x20already\x20exists');saveProfile(_0x444033,_0x5bfc04);}export function saveProfileCredentials(_0x1245ab,_0x140b39){const _0x573d18=a65_0x2035;validateProfileName(_0x1245ab);if(!profileExists(_0x1245ab))throw new Error(_0x573d18(0x13c)+_0x1245ab+_0x573d18(0x110));const _0x56b830=getNewCredentialPath(_0x1245ab);writeSecureFile(_0x56b830,_0x140b39);}export function loadProfileCredentials(_0x417c2a){const _0x41dcbb=a65_0x2035;validateProfileName(_0x417c2a);const _0x453187=getNewCredentialPath(_0x417c2a);if(a65_0x45092c['existsSync'](_0x453187))try{return a65_0x45092c[_0x41dcbb(0x117)](_0x453187,_0x41dcbb(0x101));}catch{}const _0x2c964c=getOldCredentialPath(_0x417c2a);if(a65_0x45092c['existsSync'](_0x2c964c)){console[_0x41dcbb(0x128)](_0x41dcbb(0x118)+_0x417c2a+'\x27'),console['warn'](_0x41dcbb(0x135)),console[_0x41dcbb(0x128)]('\x20\x20mv\x20\x22'+_0x2c964c+'\x22\x20\x22'+_0x453187+'\x22'),console[_0x41dcbb(0x128)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a65_0x45092c[_0x41dcbb(0x117)](_0x2c964c,_0x41dcbb(0x101));}catch{return null;}}return null;}
1
+ const a65_0x503618=a65_0x5833;(function(_0x5aa681,_0x173153){const _0x3b2f9c=a65_0x5833,_0x21d91f=_0x5aa681();while(!![]){try{const _0x371c5f=-parseInt(_0x3b2f9c(0x212))/0x1*(parseInt(_0x3b2f9c(0x201))/0x2)+parseInt(_0x3b2f9c(0x232))/0x3*(-parseInt(_0x3b2f9c(0x1f9))/0x4)+-parseInt(_0x3b2f9c(0x1f8))/0x5*(-parseInt(_0x3b2f9c(0x218))/0x6)+-parseInt(_0x3b2f9c(0x20d))/0x7+parseInt(_0x3b2f9c(0x208))/0x8*(parseInt(_0x3b2f9c(0x1ea))/0x9)+-parseInt(_0x3b2f9c(0x23c))/0xa*(-parseInt(_0x3b2f9c(0x213))/0xb)+parseInt(_0x3b2f9c(0x220))/0xc;if(_0x371c5f===_0x173153)break;else _0x21d91f['push'](_0x21d91f['shift']());}catch(_0x48a6c6){_0x21d91f['push'](_0x21d91f['shift']());}}}(a65_0xeb33,0x79174));import*as a65_0x1e3c3b from'node:fs';import*as a65_0x5ccc4f from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getConfigDir}from'./config.js';function a65_0x5833(_0x142363,_0x4b65b7){_0x142363=_0x142363-0x1ea;const _0xeb3386=a65_0xeb33();let _0x58332d=_0xeb3386[_0x142363];return _0x58332d;}import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';function a65_0xeb33(){const _0x412cc2=['parse','toISOString','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','length','Warning:\x20Profile\x20\x27','Profile\x20','Error:\x20','1040220rMPKJN','\x20\x20mv\x20\x22',',\x20creating\x20new\x20file','\x27:\x20config\x20must\x20be\x20an\x20object','.env.','llm_project','stringify','\x20\x201.\x20Edit:\x20','localeCompare','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','\x20does\x20not\x20exist','description','Invalid\x20profile\x20name:\x20','join','isDirectory','tdx.json','llm_agent','string','1015959nsqSqW','@tdx-studio','\x27:\x20unknown\x20config\x20key\x20\x27','user_info','existsSync','sort','\x20already\x20exists','Profile\x20\x27','warn','filter','2510ePqfTr','.env','database','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','4275Snpflg','keys','\x27\x20will\x20be\x20ignored','\x22\x20\x22','values','profile','object','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','readdirSync','To\x20migrate:','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','set','message','5pjmsJr','4usyyml','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','includes','parent_segment','site','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','readFileSync','18hapGbb','profiles','name','\x27\x20not\x20found\x20in\x20user\x20configuration','Warning:\x20Failed\x20to\x20parse\x20','local','entries','13696yiGcme',':\x20Invalid\x20JSON\x20syntax','has','directory','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','1344924NTLERS','Failed\x20to\x20parse\x20','utf-8','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','72232MkKFMB','27533stTZOg','push','INVALID_PROFILE_CONFIG','map','test','892338vtCaYH'];a65_0xeb33=function(){return _0x412cc2;};return a65_0xeb33();}export const STUDIO_PROFILE_NAME=a65_0x503618(0x233);export function getProfileParams(_0x424410){const _0x3d80ed=a65_0x503618,_0xe45f10={};if(!_0x424410)return _0xe45f10;for(const [_0x443b8f,_0x25086e]of Object[_0x3d80ed(0x207)](_0x424410)){_0x443b8f!=='description'&&_0x25086e!==undefined&&(_0xe45f10[_0x443b8f]=_0x25086e);}return _0xe45f10;}export function getProfilesDir(){const _0xec0c83=a65_0x503618;return a65_0x5ccc4f[_0xec0c83(0x22d)](getConfigDir(),_0xec0c83(0x202));}function getProfileDir(_0x3b090e){const _0x1f015b=a65_0x503618;return a65_0x5ccc4f[_0x1f015b(0x22d)](getProfilesDir(),_0x3b090e);}function getProfileConfigPath(_0x24580d){return a65_0x5ccc4f['join'](getProfileDir(_0x24580d),'tdx.json');}function getProfileEnvPath(_0x39f3b7){const _0x5a147c=a65_0x503618;return a65_0x5ccc4f[_0x5a147c(0x22d)](getProfileDir(_0x39f3b7),_0x5a147c(0x23d));}function getGlobalConfigPath(){const _0x1e2c91=a65_0x503618;return a65_0x5ccc4f[_0x1e2c91(0x22d)](getConfigDir(),_0x1e2c91(0x22f));}function validateProfileName(_0x16555e){const _0x388679=a65_0x503618;if(/^@?[a-zA-Z0-9_-]+$/['test'](_0x16555e))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x388679(0x217)](_0x16555e))return;throw new Error(_0x388679(0x22c)+_0x16555e+_0x388679(0x229));}function validateProfileConfig(_0xf7a4fb,_0x37a9d4){const _0x3818f2=a65_0x503618;if(typeof _0xf7a4fb!==_0x3818f2(0x1f0)||_0xf7a4fb===null)throw new SDKError(ErrorCode[_0x3818f2(0x215)],'Profile\x20\x27'+_0x37a9d4+_0x3818f2(0x223));const _0x22e07b=[_0x3818f2(0x22b),_0x3818f2(0x1fd),_0x3818f2(0x23e),_0x3818f2(0x1fc),'llm_project',_0x3818f2(0x230),_0x3818f2(0x235)],_0x225b1=_0xf7a4fb;for(const _0x642fbb of Object[_0x3818f2(0x1eb)](_0x225b1)){!_0x22e07b[_0x3818f2(0x1fb)](_0x642fbb)&&console[_0x3818f2(0x23a)](_0x3818f2(0x21d)+_0x37a9d4+_0x3818f2(0x234)+_0x642fbb+_0x3818f2(0x1ec));}if(_0x225b1['description']!==undefined&&typeof _0x225b1[_0x3818f2(0x22b)]!==_0x3818f2(0x231))throw new SDKError(ErrorCode[_0x3818f2(0x215)],'Profile\x20\x27'+_0x37a9d4+_0x3818f2(0x1fe));if(_0x225b1[_0x3818f2(0x1fd)]!==undefined&&typeof _0x225b1['site']!=='string')throw new SDKError(ErrorCode[_0x3818f2(0x215)],'Profile\x20\x27'+_0x37a9d4+_0x3818f2(0x1f5));if(_0x225b1['database']!==undefined&&typeof _0x225b1[_0x3818f2(0x23e)]!==_0x3818f2(0x231))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x37a9d4+_0x3818f2(0x210));if(_0x225b1[_0x3818f2(0x1fc)]!==undefined&&typeof _0x225b1[_0x3818f2(0x1fc)]!==_0x3818f2(0x231))throw new SDKError(ErrorCode[_0x3818f2(0x215)],_0x3818f2(0x239)+_0x37a9d4+_0x3818f2(0x211));if(_0x225b1['llm_project']!==undefined&&typeof _0x225b1[_0x3818f2(0x225)]!==_0x3818f2(0x231))throw new SDKError(ErrorCode[_0x3818f2(0x215)],_0x3818f2(0x239)+_0x37a9d4+_0x3818f2(0x1f1));if(_0x225b1[_0x3818f2(0x230)]!==undefined&&typeof _0x225b1[_0x3818f2(0x230)]!==_0x3818f2(0x231))throw new SDKError(ErrorCode[_0x3818f2(0x215)],_0x3818f2(0x239)+_0x37a9d4+_0x3818f2(0x23f));return!![];}function loadProfilesFromTdxJson(_0x5d04a5,_0x2a914b){const _0x4a420c=a65_0x503618;if(!a65_0x1e3c3b[_0x4a420c(0x236)](_0x5d04a5))return[];try{const _0x1bf397=a65_0x1e3c3b['readFileSync'](_0x5d04a5,_0x4a420c(0x20f)),_0x2d106c=JSON[_0x4a420c(0x219)](_0x1bf397);if(!_0x2d106c[_0x4a420c(0x202)]||typeof _0x2d106c[_0x4a420c(0x202)]!==_0x4a420c(0x1f0))return[];const _0x4f371b=[];for(const [_0x207e33,_0x562040]of Object['entries'](_0x2d106c[_0x4a420c(0x202)])){try{validateProfileConfig(_0x562040,_0x207e33);const _0x2bc718=getNewCredentialPath(_0x207e33),_0x14623f=getOldCredentialPath(_0x207e33),_0x349ed3=a65_0x1e3c3b['existsSync'](_0x2bc718)||a65_0x1e3c3b[_0x4a420c(0x236)](_0x14623f);_0x4f371b[_0x4a420c(0x214)]({'name':_0x207e33,'config':_0x562040,'metadata':{'name':_0x207e33,'createdAt':new Date()[_0x4a420c(0x21a)]()},'hasCredentials':_0x349ed3,'scope':_0x2a914b});}catch(_0x3f253b){_0x3f253b instanceof Error&&(console[_0x4a420c(0x23a)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x5d04a5+':'),console[_0x4a420c(0x23a)]('\x20\x20'+_0x3f253b[_0x4a420c(0x1f7)]+'\x0a'));}}return _0x4f371b;}catch(_0x667f1c){return _0x667f1c instanceof SyntaxError?(console[_0x4a420c(0x23a)]('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x5d04a5+_0x4a420c(0x209)),console[_0x4a420c(0x23a)](_0x4a420c(0x21f)+_0x667f1c[_0x4a420c(0x1f7)]+'\x0a')):console[_0x4a420c(0x23a)](_0x4a420c(0x1f4)+_0x5d04a5+':\x20'+_0x667f1c+'\x0a'),[];}}export function getNewCredentialPath(_0x24b449){const _0x91f7f1=a65_0x503618;return a65_0x5ccc4f[_0x91f7f1(0x22d)](getConfigDir(),_0x91f7f1(0x224)+_0x24b449);}function getOldCredentialPath(_0x493f6a){const _0x2988ad=a65_0x503618;return a65_0x5ccc4f[_0x2988ad(0x22d)](getProfilesDir(),_0x493f6a,_0x2988ad(0x23d));}function loadProfilesFromTdxJsonFiles(){const _0x2c8f9d=a65_0x503618,_0xe0e631=[],_0x185e3f=findProjectConfigPath();_0x185e3f&&_0xe0e631[_0x2c8f9d(0x214)](...loadProfilesFromTdxJson(_0x185e3f,_0x2c8f9d(0x206)));const _0x2822bb=a65_0x5ccc4f[_0x2c8f9d(0x22d)](getConfigDir(),_0x2c8f9d(0x22f));return _0xe0e631[_0x2c8f9d(0x214)](...loadProfilesFromTdxJson(_0x2822bb,'user')),_0xe0e631;}function loadProfilesFromDirectories(){const _0x22a769=a65_0x503618,_0x3736dc=getProfilesDir();if(!a65_0x1e3c3b[_0x22a769(0x236)](_0x3736dc))return[];try{return a65_0x1e3c3b[_0x22a769(0x1f2)](_0x3736dc,{'withFileTypes':!![]})[_0x22a769(0x23b)](_0x4239c7=>_0x4239c7[_0x22a769(0x22e)]())[_0x22a769(0x216)](_0x45860a=>_0x45860a['name'])[_0x22a769(0x23b)](_0x12267f=>{const _0x3008e5=_0x22a769,_0x3f2ab0=getProfileConfigPath(_0x12267f),_0x70a1df=getProfileEnvPath(_0x12267f);return a65_0x1e3c3b[_0x3008e5(0x236)](_0x3f2ab0)||a65_0x1e3c3b[_0x3008e5(0x236)](_0x70a1df);})[_0x22a769(0x216)](_0x178946=>{const _0x449567=_0x22a769,_0x4ee8a1=loadProfileFromDirectory(_0x178946);if(_0x4ee8a1)return{..._0x4ee8a1,'scope':_0x449567(0x20b)};return null;})[_0x22a769(0x23b)](_0x2ec7a0=>_0x2ec7a0!==null);}catch{return[];}}function loadProfileFromDirectory(_0x144904){const _0x21fc89=a65_0x503618,_0x2a9362=getProfileConfigPath(_0x144904),_0x139343=getOldCredentialPath(_0x144904);if(!a65_0x1e3c3b[_0x21fc89(0x236)](_0x2a9362)&&!a65_0x1e3c3b['existsSync'](_0x139343))return null;let _0x4affbf={},_0x2e37d4={'name':_0x144904,'createdAt':new Date()[_0x21fc89(0x21a)]()};if(a65_0x1e3c3b['existsSync'](_0x2a9362))try{const _0x45355e=a65_0x1e3c3b[_0x21fc89(0x200)](_0x2a9362,'utf-8'),_0x4825a8=JSON['parse'](_0x45355e),{metadata:_0x4ff714,..._0x115134}=_0x4825a8;_0x4affbf=_0x115134,_0x4ff714&&(_0x2e37d4=_0x4ff714);}catch{}return{'name':_0x144904,'config':_0x4affbf,'metadata':_0x2e37d4,'hasCredentials':a65_0x1e3c3b['existsSync'](_0x139343),'scope':_0x21fc89(0x20b)};}export function listProfiles(){const _0x322550=a65_0x503618,_0x185aff=loadProfilesFromTdxJsonFiles(),_0x2c777d=loadProfilesFromDirectories();if(_0x2c777d[_0x322550(0x21c)]>0x0){const _0x2fe31f=_0x2c777d[_0x322550(0x216)](_0x1896a2=>_0x1896a2[_0x322550(0x203)])[_0x322550(0x22d)](',\x20'),_0x398bc2=getConfigDir();console[_0x322550(0x23a)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x2fe31f),console[_0x322550(0x23a)](_0x322550(0x21b)),console['warn'](_0x322550(0x227)+a65_0x5ccc4f[_0x322550(0x22d)](_0x398bc2,_0x322550(0x22f))),console[_0x322550(0x23a)]('\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'),console['warn'](_0x322550(0x1fa));}const _0x10c066=[..._0x185aff,..._0x2c777d],_0x3c1d3f=new Map();for(const _0x3f4556 of _0x10c066){!_0x3c1d3f[_0x322550(0x20a)](_0x3f4556[_0x322550(0x203)])&&_0x3c1d3f[_0x322550(0x1f6)](_0x3f4556[_0x322550(0x203)],_0x3f4556);}return Array['from'](_0x3c1d3f[_0x322550(0x1ee)]())[_0x322550(0x237)]((_0x5bea40,_0x5a3b37)=>_0x5bea40['name'][_0x322550(0x228)](_0x5a3b37[_0x322550(0x203)]));}export function profileExists(_0x2b6c60){const _0x5a922a=listProfiles();return _0x5a922a['some'](_0xc986a4=>_0xc986a4['name']===_0x2b6c60);}export function loadProfile(_0x5c3be7){const _0x73b09e=a65_0x503618;validateProfileName(_0x5c3be7);const _0x2c9cff=listProfiles(),_0x4a2d3f=_0x2c9cff['find'](_0x1f7eda=>_0x1f7eda[_0x73b09e(0x203)]===_0x5c3be7);return _0x4a2d3f||null;}export function saveProfile(_0x16a4f1,_0x1f7388,_0x5359dd=![]){saveProfileToUserConfig(_0x16a4f1,_0x1f7388);}export function deleteProfile(_0x1670f0){const _0xe55694=a65_0x503618;validateProfileName(_0x1670f0);const _0x5ce803=getProfileDir(_0x1670f0);if(!a65_0x1e3c3b[_0xe55694(0x236)](_0x5ce803))throw new Error(_0xe55694(0x21e)+_0x1670f0+_0xe55694(0x22a));a65_0x1e3c3b['rmSync'](_0x5ce803,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x143b03,_0x423999){const _0x507cff=a65_0x503618;validateProfileName(_0x143b03);const _0xa0a362=getGlobalConfigPath(),_0x5c220f=getConfigDir();!a65_0x1e3c3b[_0x507cff(0x236)](_0x5c220f)&&createSecureDirectory(_0x5c220f);let _0x593a33={};if(a65_0x1e3c3b[_0x507cff(0x236)](_0xa0a362))try{const _0x1240c5=a65_0x1e3c3b[_0x507cff(0x200)](_0xa0a362,_0x507cff(0x20f));_0x593a33=JSON[_0x507cff(0x219)](_0x1240c5);}catch{console['warn'](_0x507cff(0x205)+_0xa0a362+_0x507cff(0x222));}!_0x593a33[_0x507cff(0x202)]&&(_0x593a33['profiles']={}),_0x593a33[_0x507cff(0x202)][_0x143b03]=_0x423999,writeSecureFile(_0xa0a362,JSON['stringify'](_0x593a33,null,0x2));}export function removeProfileFromUserConfig(_0x5460bd){const _0x1f3123=a65_0x503618;validateProfileName(_0x5460bd);const _0x2f2d74=getGlobalConfigPath();if(!a65_0x1e3c3b[_0x1f3123(0x236)](_0x2f2d74))throw new Error(_0x1f3123(0x239)+_0x5460bd+_0x1f3123(0x204));let _0x1e322a={};try{const _0x3c558b=a65_0x1e3c3b[_0x1f3123(0x200)](_0x2f2d74,_0x1f3123(0x20f));_0x1e322a=JSON[_0x1f3123(0x219)](_0x3c558b);}catch{throw new Error(_0x1f3123(0x20e)+_0x2f2d74);}if(!_0x1e322a[_0x1f3123(0x202)]||!_0x1e322a[_0x1f3123(0x202)][_0x5460bd])throw new Error(_0x1f3123(0x239)+_0x5460bd+_0x1f3123(0x204));delete _0x1e322a[_0x1f3123(0x202)][_0x5460bd],_0x1e322a[_0x1f3123(0x1ef)]===_0x5460bd&&delete _0x1e322a[_0x1f3123(0x1ef)],writeSecureFile(_0x2f2d74,JSON[_0x1f3123(0x226)](_0x1e322a,null,0x2));}export function getActiveProfile(){const _0x5ffae2=a65_0x503618,_0x23df3e=loadSessionContext();if(_0x23df3e?.['profile'])return _0x23df3e[_0x5ffae2(0x1ef)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0xbd651f=getGlobalConfigPath();if(!a65_0x1e3c3b[_0x5ffae2(0x236)](_0xbd651f))return null;try{const _0x15874d=a65_0x1e3c3b[_0x5ffae2(0x200)](_0xbd651f,_0x5ffae2(0x20f)),_0x1e42a5=JSON[_0x5ffae2(0x219)](_0x15874d);return _0x1e42a5[_0x5ffae2(0x1ef)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0xc696ce){const _0x3d8710=a65_0x503618,_0x3291ea=getGlobalConfigPath(),_0xfed8fd=getConfigDir();!a65_0x1e3c3b[_0x3d8710(0x236)](_0xfed8fd)&&createSecureDirectory(_0xfed8fd);let _0x3e0a68={};if(a65_0x1e3c3b[_0x3d8710(0x236)](_0x3291ea))try{const _0x351eb6=a65_0x1e3c3b['readFileSync'](_0x3291ea,_0x3d8710(0x20f));_0x3e0a68=JSON[_0x3d8710(0x219)](_0x351eb6);}catch{console[_0x3d8710(0x23a)](_0x3d8710(0x205)+_0x3291ea+_0x3d8710(0x222));}_0x3e0a68['site']=_0xc696ce,writeSecureFile(_0x3291ea,JSON['stringify'](_0x3e0a68,null,0x2));}export function saveActiveProfileToUserConfig(_0xffdb35){const _0x57d4e0=a65_0x503618;validateProfileName(_0xffdb35);const _0x227835=getGlobalConfigPath(),_0x121629=getConfigDir();!a65_0x1e3c3b[_0x57d4e0(0x236)](_0x121629)&&createSecureDirectory(_0x121629);let _0x760597={};if(a65_0x1e3c3b['existsSync'](_0x227835))try{const _0x1929f0=a65_0x1e3c3b[_0x57d4e0(0x200)](_0x227835,'utf-8');_0x760597=JSON[_0x57d4e0(0x219)](_0x1929f0);}catch{console[_0x57d4e0(0x23a)](_0x57d4e0(0x205)+_0x227835+_0x57d4e0(0x222));}_0x760597[_0x57d4e0(0x1ef)]=_0xffdb35,writeSecureFile(_0x227835,JSON['stringify'](_0x760597,null,0x2));}function clearFieldFromUserConfig(_0x5825a6){const _0xe40262=a65_0x503618,_0x26d53f=getGlobalConfigPath();if(!a65_0x1e3c3b[_0xe40262(0x236)](_0x26d53f))return;let _0x2e0a5c={};try{const _0x47e40b=a65_0x1e3c3b[_0xe40262(0x200)](_0x26d53f,_0xe40262(0x20f));_0x2e0a5c=JSON[_0xe40262(0x219)](_0x47e40b);}catch{return;}delete _0x2e0a5c[_0x5825a6],writeSecureFile(_0x26d53f,JSON['stringify'](_0x2e0a5c,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x1b0514=a65_0x503618;clearFieldFromUserConfig(_0x1b0514(0x1fd));}export function clearActiveProfileFromUserConfig(){clearFieldFromUserConfig('profile');}export function createProfile(_0x35b2ae,_0x30c04a){const _0x46b889=a65_0x503618;validateProfileName(_0x35b2ae);if(profileExists(_0x35b2ae))throw new Error(_0x46b889(0x21e)+_0x35b2ae+_0x46b889(0x238));saveProfile(_0x35b2ae,_0x30c04a);}export function saveProfileCredentials(_0x310a73,_0x47d7e3){const _0x15992e=a65_0x503618;validateProfileName(_0x310a73);if(!profileExists(_0x310a73))throw new Error(_0x15992e(0x21e)+_0x310a73+_0x15992e(0x22a));const _0x1bac11=getNewCredentialPath(_0x310a73);writeSecureFile(_0x1bac11,_0x47d7e3);}export function loadProfileCredentials(_0x3e0a9b){const _0x50041e=a65_0x503618;validateProfileName(_0x3e0a9b);const _0x23c511=getNewCredentialPath(_0x3e0a9b);if(a65_0x1e3c3b['existsSync'](_0x23c511))try{return a65_0x1e3c3b[_0x50041e(0x200)](_0x23c511,_0x50041e(0x20f));}catch{}const _0x3e71de=getOldCredentialPath(_0x3e0a9b);if(a65_0x1e3c3b[_0x50041e(0x236)](_0x3e71de)){console[_0x50041e(0x23a)](_0x50041e(0x1ff)+_0x3e0a9b+'\x27'),console[_0x50041e(0x23a)](_0x50041e(0x1f3)),console[_0x50041e(0x23a)](_0x50041e(0x221)+_0x3e71de+_0x50041e(0x1ed)+_0x23c511+'\x22'),console[_0x50041e(0x23a)](_0x50041e(0x20c));try{return a65_0x1e3c3b[_0x50041e(0x200)](_0x3e71de,'utf-8');}catch{return null;}}return null;}
@@ -1 +1 @@
1
- function a66_0x33bf(_0x4780e1,_0x4e0c87){_0x4780e1=_0x4780e1-0x156;const _0x2af870=a66_0x2af8();let _0x33bf7c=_0x2af870[_0x4780e1];return _0x33bf7c;}const a66_0x499b60=a66_0x33bf;(function(_0x5f1539,_0x2bd9f9){const _0x48d42=a66_0x33bf,_0x128771=_0x5f1539();while(!![]){try{const _0x276722=-parseInt(_0x48d42(0x173))/0x1*(parseInt(_0x48d42(0x177))/0x2)+-parseInt(_0x48d42(0x172))/0x3*(-parseInt(_0x48d42(0x169))/0x4)+-parseInt(_0x48d42(0x16c))/0x5*(-parseInt(_0x48d42(0x15a))/0x6)+parseInt(_0x48d42(0x16e))/0x7+parseInt(_0x48d42(0x16f))/0x8*(-parseInt(_0x48d42(0x16a))/0x9)+parseInt(_0x48d42(0x174))/0xa+-parseInt(_0x48d42(0x166))/0xb*(parseInt(_0x48d42(0x15f))/0xc);if(_0x276722===_0x2bd9f9)break;else _0x128771['push'](_0x128771['shift']());}catch(_0x4334ba){_0x128771['push'](_0x128771['shift']());}}}(a66_0x2af8,0xbe8f4));import*as a66_0x283940 from'node:fs';import*as a66_0x4aecad from'node:path';const PROJECT_CONFIG_FILENAME=a66_0x499b60(0x15c);export function findProjectConfigPath(_0x16e8af){const _0x916296=a66_0x499b60;let _0x5973a4=_0x16e8af||process[_0x916296(0x16b)]();while(!![]){const _0x4827a2=a66_0x4aecad[_0x916296(0x15d)](_0x5973a4,PROJECT_CONFIG_FILENAME);if(a66_0x283940[_0x916296(0x158)](_0x4827a2))return _0x4827a2;const _0x44fc6a=a66_0x4aecad[_0x916296(0x163)](_0x5973a4);if(_0x44fc6a===_0x5973a4)return null;_0x5973a4=_0x44fc6a;}}function a66_0x2af8(){const _0x1e128e=['api_key','3835092mzaCHx','TD_API_KEY','\x20is\x20ignored.\x20','parse','dirname','warn','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','11qdGRNy','ENOENT','code','676NVlBTI','3733713BUorED','cwd','11980HMHRRY','utf-8','4894442OtsODo','8hTSlss','includes','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','1641DuXATg','1AhSvQI','3525580VsySux','apiKey','Failed\x20to\x20load\x20project\x20config\x20from\x20','1649662effrnd','readFileSync','stringify','Warning:\x20\x27profile\x27\x20field\x20in\x20','existsSync','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','2994RGQhnR','profile','tdx.json','join'];a66_0x2af8=function(){return _0x1e128e;};return a66_0x2af8();}export function loadProjectConfig(_0xa13d23){const _0x2c6623=a66_0x499b60,_0x3ef62d=findProjectConfigPath(_0xa13d23);if(!_0x3ef62d)return null;try{const _0xe265df=a66_0x283940[_0x2c6623(0x178)](_0x3ef62d,_0x2c6623(0x16d)),_0x1deda1=JSON[_0x2c6623(0x162)](_0xe265df),_0x1595d4=JSON[_0x2c6623(0x156)](_0x1deda1);if(_0x1595d4[_0x2c6623(0x170)](_0x2c6623(0x160))||_0x1595d4[_0x2c6623(0x170)]('apiKey')||_0x1595d4['includes'](_0x2c6623(0x15e)))throw new Error(_0x2c6623(0x165)+_0x3ef62d+').\x20'+_0x2c6623(0x171));const {metadata:_0x4881c8,profile:_0x57e6a7,..._0xf2fad6}=_0x1deda1;return _0x57e6a7&&console[_0x2c6623(0x164)](_0x2c6623(0x157)+_0x3ef62d+_0x2c6623(0x161)+'Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'),_0xf2fad6;}catch(_0x32cd44){if(_0x32cd44 instanceof Error&&_0x2c6623(0x168)in _0x32cd44&&_0x32cd44[_0x2c6623(0x168)]===_0x2c6623(0x167))return null;throw new Error(_0x2c6623(0x176)+_0x3ef62d+':\x20'+_0x32cd44);}}export function saveProjectConfig(_0x1e8dc7,_0xc34031){const _0x49ed3d=a66_0x499b60,_0x5c09f0=_0xc34031||process['cwd'](),_0x531596=a66_0x4aecad[_0x49ed3d(0x15d)](_0x5c09f0,PROJECT_CONFIG_FILENAME),_0x55a114=JSON[_0x49ed3d(0x156)](_0x1e8dc7);if(_0x55a114[_0x49ed3d(0x170)](_0x49ed3d(0x160))||_0x55a114['includes'](_0x49ed3d(0x175))||_0x55a114[_0x49ed3d(0x170)](_0x49ed3d(0x15e)))throw new Error(_0x49ed3d(0x159));if(_0x49ed3d(0x15b)in _0x1e8dc7)throw new Error('\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.');a66_0x283940['writeFileSync'](_0x531596,JSON[_0x49ed3d(0x156)](_0x1e8dc7,null,0x2));}export function hasProjectConfig(_0x57de4e){return findProjectConfigPath(_0x57de4e)!==null;}export function getProjectRoot(_0x476a00){const _0x498089=a66_0x499b60,_0xbeb61a=findProjectConfigPath(_0x476a00);return _0xbeb61a?a66_0x4aecad[_0x498089(0x163)](_0xbeb61a):null;}
1
+ (function(_0x2fd3e3,_0x269e67){const _0x51ccc8=a66_0x50e4,_0x28a030=_0x2fd3e3();while(!![]){try{const _0x1d6eae=parseInt(_0x51ccc8(0x1e6))/0x1*(-parseInt(_0x51ccc8(0x206))/0x2)+parseInt(_0x51ccc8(0x1fb))/0x3*(parseInt(_0x51ccc8(0x1ee))/0x4)+parseInt(_0x51ccc8(0x1f6))/0x5*(-parseInt(_0x51ccc8(0x1f4))/0x6)+-parseInt(_0x51ccc8(0x1f9))/0x7+parseInt(_0x51ccc8(0x203))/0x8+-parseInt(_0x51ccc8(0x200))/0x9+-parseInt(_0x51ccc8(0x1f7))/0xa*(-parseInt(_0x51ccc8(0x1e9))/0xb);if(_0x1d6eae===_0x269e67)break;else _0x28a030['push'](_0x28a030['shift']());}catch(_0x52ee0f){_0x28a030['push'](_0x28a030['shift']());}}}(a66_0x44e2,0x5d378));function a66_0x44e2(){const _0x17bf85=['includes','TD_API_KEY','5008104Aokuct','utf-8','apiKey','1302976LYpRdA','stringify','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','1iKbxfT','Failed\x20to\x20load\x20project\x20config\x20from\x20','code','11GyWXRw','cwd','join','parse','profile','112btXTLi','dirname','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','Warning:\x20\x27profile\x27\x20field\x20in\x20','api_key','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','13254eTOGbp',').\x20','65QbifCO','10260490DUhGce','warn','1296099jjbLEE','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','20340EYwqhj','\x20is\x20ignored.\x20','readFileSync','writeFileSync','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','5352516jlvJea'];a66_0x44e2=function(){return _0x17bf85;};return a66_0x44e2();}import*as a66_0x5cfcc7 from'node:fs';import*as a66_0x7f104b from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';export function findProjectConfigPath(_0x1cdaec){const _0x1ef35b=a66_0x50e4;let _0x40cac7=_0x1cdaec||process[_0x1ef35b(0x1ea)]();while(!![]){const _0x444afc=a66_0x7f104b[_0x1ef35b(0x1eb)](_0x40cac7,PROJECT_CONFIG_FILENAME);if(a66_0x5cfcc7['existsSync'](_0x444afc))return _0x444afc;const _0x79830b=a66_0x7f104b[_0x1ef35b(0x1ef)](_0x40cac7);if(_0x79830b===_0x40cac7)return null;_0x40cac7=_0x79830b;}}export function loadProjectConfig(_0x2c4c3f){const _0x470393=a66_0x50e4,_0x1de139=findProjectConfigPath(_0x2c4c3f);if(!_0x1de139)return null;try{const _0x3ce29c=a66_0x5cfcc7[_0x470393(0x1fd)](_0x1de139,_0x470393(0x204)),_0x37d00d=JSON[_0x470393(0x1ec)](_0x3ce29c),_0x16a187=JSON[_0x470393(0x207)](_0x37d00d);if(_0x16a187[_0x470393(0x201)](_0x470393(0x202))||_0x16a187[_0x470393(0x201)](_0x470393(0x205))||_0x16a187['includes'](_0x470393(0x1f2)))throw new Error(_0x470393(0x1fa)+_0x1de139+_0x470393(0x1f5)+_0x470393(0x1f3));const {metadata:_0x487f78,profile:_0x5d427d,..._0x58de22}=_0x37d00d;return _0x5d427d&&console[_0x470393(0x1f8)](_0x470393(0x1f1)+_0x1de139+_0x470393(0x1fc)+_0x470393(0x1ff)),_0x58de22;}catch(_0x592b98){if(_0x592b98 instanceof Error&&'code'in _0x592b98&&_0x592b98[_0x470393(0x1e8)]==='ENOENT')return null;throw new Error(_0x470393(0x1e7)+_0x1de139+':\x20'+_0x592b98);}}function a66_0x50e4(_0x3de82b,_0x718458){_0x3de82b=_0x3de82b-0x1e6;const _0x44e26e=a66_0x44e2();let _0x50e4d0=_0x44e26e[_0x3de82b];return _0x50e4d0;}export function saveProjectConfig(_0x47041d,_0x3fb464){const _0x4c47cd=a66_0x50e4,_0x3de65e=_0x3fb464||process[_0x4c47cd(0x1ea)](),_0x3a758b=a66_0x7f104b['join'](_0x3de65e,PROJECT_CONFIG_FILENAME),_0x3029ce=JSON['stringify'](_0x47041d);if(_0x3029ce[_0x4c47cd(0x201)](_0x4c47cd(0x202))||_0x3029ce[_0x4c47cd(0x201)]('apiKey')||_0x3029ce[_0x4c47cd(0x201)](_0x4c47cd(0x1f2)))throw new Error(_0x4c47cd(0x208));if(_0x4c47cd(0x1ed)in _0x47041d)throw new Error(_0x4c47cd(0x1f0));a66_0x5cfcc7[_0x4c47cd(0x1fe)](_0x3a758b,JSON[_0x4c47cd(0x207)](_0x47041d,null,0x2));}export function hasProjectConfig(_0x4a693c){return findProjectConfigPath(_0x4a693c)!==null;}export function getProjectRoot(_0x14c91b){const _0x2c26a5=a66_0x50e4,_0x53f91b=findProjectConfigPath(_0x14c91b);return _0x53f91b?a66_0x7f104b[_0x2c26a5(0x1ef)](_0x53f91b):null;}
@@ -1 +1 @@
1
- function a67_0x2594(){const _0x8d552=['9264oVjrlS','2591930tAXHuM','createdAt','sort','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','now','6KSUIOq','existsSync','readdirSync','1701469rWykCy','push','132awdiiq','52328RvIjKn','sessions','utf-8','1966853gmIpkh','endsWith','209306BCBPaT','45lRcyHn','tdx','readFileSync','apiKey','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','homedir','replace','writeFileSync','api_key','join','TD_API_KEY','warn','test','includes','toString','getTime','unlinkSync','stringify','504265pvRwqt','3qThKKF','toISOString','parse','.json','.\x20This\x20is\x20insecure.\x20Removing\x20session.'];a67_0x2594=function(){return _0x8d552;};return a67_0x2594();}(function(_0x179e4c,_0x24b60e){const _0x5eaf91=a67_0x4354,_0x4a4b19=_0x179e4c();while(!![]){try{const _0x5d1018=-parseInt(_0x5eaf91(0x197))/0x1*(-parseInt(_0x5eaf91(0x183))/0x2)+-parseInt(_0x5eaf91(0x1a7))/0x3*(-parseInt(_0x5eaf91(0x19c))/0x4)+-parseInt(_0x5eaf91(0x196))/0x5*(-parseInt(_0x5eaf91(0x1a2))/0x6)+-parseInt(_0x5eaf91(0x181))/0x7+parseInt(_0x5eaf91(0x1a8))/0x8*(parseInt(_0x5eaf91(0x184))/0x9)+-parseInt(_0x5eaf91(0x19d))/0xa+parseInt(_0x5eaf91(0x1a5))/0xb;if(_0x5d1018===_0x24b60e)break;else _0x4a4b19['push'](_0x4a4b19['shift']());}catch(_0x255c1c){_0x4a4b19['push'](_0x4a4b19['shift']());}}}(a67_0x2594,0x28058));import*as a67_0x4718ce from'node:fs';import*as a67_0x7b3145 from'node:path';import*as a67_0x52882f from'node:os';import{getPPID,isProcessRunning}from'../utils/process.js';function a67_0x4354(_0x409ac8,_0x985139){_0x409ac8=_0x409ac8-0x180;const _0x259458=a67_0x2594();let _0x435427=_0x259458[_0x409ac8];return _0x435427;}import{createSecureDirectory}from'../utils/file-permissions.js';const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function getSessionsDir(){const _0x5e1c5d=a67_0x4354,_0x18872a=process.env.TDX_CONFIG_DIR||a67_0x7b3145['join'](a67_0x52882f[_0x5e1c5d(0x189)](),'.config',_0x5e1c5d(0x185));return a67_0x7b3145['join'](_0x18872a,_0x5e1c5d(0x1a9));}function getSessionPath(_0xf47674){const _0x14bcbd=a67_0x4354;return a67_0x7b3145[_0x14bcbd(0x18d)](getSessionsDir(),_0xf47674+_0x14bcbd(0x19a));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x13fbed){if(_0x13fbed)return _0x13fbed;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()['toString']();}export function loadSessionContext(_0x107889){const _0x400656=a67_0x4354,_0x865fbb=getSessionID(_0x107889),_0x17bce8=/^\d+$/[_0x400656(0x190)](_0x865fbb)?parseInt(_0x865fbb,0xa):null;return _0x17bce8!==null?loadSessionContextByPID(_0x17bce8):loadSessionContextByString(_0x865fbb);}export function loadSessionContextByPID(_0x451ac4){const _0x5bef1c=a67_0x4354,_0x3b67a0=getSessionPath(_0x451ac4);if(!a67_0x4718ce['existsSync'](_0x3b67a0))return null;try{const _0xefdb8f=a67_0x4718ce[_0x5bef1c(0x186)](_0x3b67a0,_0x5bef1c(0x180)),_0x2caef6=JSON[_0x5bef1c(0x199)](_0xefdb8f),_0x5e879a=new Date(_0x2caef6[_0x5bef1c(0x19e)])['getTime'](),_0x3ea7d4=Date[_0x5bef1c(0x1a1)]();if(_0x3ea7d4-_0x5e879a>SESSION_EXPIRATION_MS)return a67_0x4718ce[_0x5bef1c(0x194)](_0x3b67a0),null;const _0x4e0755=JSON[_0x5bef1c(0x195)](_0x2caef6);if(_0x4e0755[_0x5bef1c(0x191)](_0x5bef1c(0x18e))||_0x4e0755[_0x5bef1c(0x191)](_0x5bef1c(0x187))||_0x4e0755[_0x5bef1c(0x191)](_0x5bef1c(0x18c)))return console['warn'](_0x5bef1c(0x188)+_0x3b67a0+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a67_0x4718ce[_0x5bef1c(0x194)](_0x3b67a0),null;return _0x2caef6;}catch{try{a67_0x4718ce[_0x5bef1c(0x194)](_0x3b67a0);}catch{}return null;}}function loadSessionContextByString(_0x4946cd){const _0x2df73b=a67_0x4354,_0x5086c2=a67_0x7b3145['join'](getSessionsDir(),_0x4946cd+_0x2df73b(0x19a));if(!a67_0x4718ce[_0x2df73b(0x1a3)](_0x5086c2))return null;try{const _0x4169d7=a67_0x4718ce['readFileSync'](_0x5086c2,_0x2df73b(0x180)),_0x331461=JSON[_0x2df73b(0x199)](_0x4169d7),_0x2c8952=new Date(_0x331461[_0x2df73b(0x19e)])['getTime'](),_0x5c981c=Date[_0x2df73b(0x1a1)]();if(_0x5c981c-_0x2c8952>SESSION_EXPIRATION_MS)return a67_0x4718ce[_0x2df73b(0x194)](_0x5086c2),null;const _0x54136f=JSON[_0x2df73b(0x195)](_0x331461);if(_0x54136f['includes'](_0x2df73b(0x18e))||_0x54136f[_0x2df73b(0x191)](_0x2df73b(0x187))||_0x54136f[_0x2df73b(0x191)](_0x2df73b(0x18c)))return console[_0x2df73b(0x18f)](_0x2df73b(0x188)+_0x5086c2+_0x2df73b(0x19b)),a67_0x4718ce[_0x2df73b(0x194)](_0x5086c2),null;return _0x331461;}catch{try{a67_0x4718ce[_0x2df73b(0x194)](_0x5086c2);}catch{}return null;}}export function saveSessionContext(_0x38f9c7,_0x2312aa){const _0x1b68d2=a67_0x4354,_0x20fc05=getSessionID(_0x2312aa),_0x34eaae=/^\d+$/[_0x1b68d2(0x190)](_0x20fc05)?parseInt(_0x20fc05,0xa):getCurrentSessionPID(),_0x3ec3ad=a67_0x7b3145[_0x1b68d2(0x18d)](getSessionsDir(),_0x20fc05+_0x1b68d2(0x19a)),_0x1ea011=getSessionsDir();createSecureDirectory(_0x1ea011);const _0x26f73b=JSON[_0x1b68d2(0x195)](_0x38f9c7);if(_0x26f73b[_0x1b68d2(0x191)]('TD_API_KEY')||_0x26f73b[_0x1b68d2(0x191)](_0x1b68d2(0x187))||_0x26f73b[_0x1b68d2(0x191)]('api_key'))throw new Error(_0x1b68d2(0x1a0));let _0x34bb09;const _0x2f2fe7=/^\d+$/['test'](_0x20fc05)?loadSessionContextByPID(parseInt(_0x20fc05,0xa)):loadSessionContextByString(_0x20fc05);_0x2f2fe7?_0x34bb09={..._0x2f2fe7,..._0x38f9c7,'pid':_0x34eaae,'sessionId':_0x20fc05!==_0x34eaae[_0x1b68d2(0x192)]()?_0x20fc05:undefined,'updatedAt':new Date()[_0x1b68d2(0x198)]()}:_0x34bb09={'pid':_0x34eaae,'sessionId':_0x20fc05!==_0x34eaae[_0x1b68d2(0x192)]()?_0x20fc05:undefined,..._0x38f9c7,'createdAt':new Date()[_0x1b68d2(0x198)](),'updatedAt':new Date()[_0x1b68d2(0x198)]()},a67_0x4718ce['writeFileSync'](_0x3ec3ad,JSON['stringify'](_0x34bb09,null,0x2));}export function clearSessionContext(_0x332a32){const _0x164b95=a67_0x4354,_0x1d4c68=getSessionID(_0x332a32),_0x5ac441=a67_0x7b3145[_0x164b95(0x18d)](getSessionsDir(),_0x1d4c68+'.json');a67_0x4718ce['existsSync'](_0x5ac441)&&a67_0x4718ce[_0x164b95(0x194)](_0x5ac441);}export function clearSessionContextField(_0x241aba,_0x5253f0){const _0x356cb7=a67_0x4354,_0x415ad4=getSessionID(_0x5253f0),_0x27b8a2=a67_0x7b3145[_0x356cb7(0x18d)](getSessionsDir(),_0x415ad4+_0x356cb7(0x19a));if(!a67_0x4718ce[_0x356cb7(0x1a3)](_0x27b8a2))return;try{const _0x57a9f9=a67_0x4718ce[_0x356cb7(0x186)](_0x27b8a2,_0x356cb7(0x180)),_0xe94342=JSON[_0x356cb7(0x199)](_0x57a9f9);delete _0xe94342[_0x241aba],a67_0x4718ce[_0x356cb7(0x18b)](_0x27b8a2,JSON[_0x356cb7(0x195)](_0xe94342,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x4ed59b=a67_0x4354,_0x1cb657=getSessionsDir();if(!a67_0x4718ce[_0x4ed59b(0x1a3)](_0x1cb657))return 0x0;let _0x33ce4b=0x0;const _0x4854d6=Date['now']();try{const _0x44b30c=a67_0x4718ce[_0x4ed59b(0x1a4)](_0x1cb657);for(const _0x3129b3 of _0x44b30c){if(!_0x3129b3[_0x4ed59b(0x182)](_0x4ed59b(0x19a)))continue;const _0x141647=a67_0x7b3145[_0x4ed59b(0x18d)](_0x1cb657,_0x3129b3),_0x1e7584=_0x3129b3[_0x4ed59b(0x18a)](_0x4ed59b(0x19a),''),_0x2b624c=parseInt(_0x1e7584,0xa),_0xb45eca=!isNaN(_0x2b624c);if(_0xb45eca){if(!isProcessRunning(_0x2b624c)){a67_0x4718ce['unlinkSync'](_0x141647),_0x33ce4b++;continue;}}try{const _0x52c371=a67_0x4718ce['readFileSync'](_0x141647,'utf-8'),_0x3593de=JSON[_0x4ed59b(0x199)](_0x52c371),_0xb7cd87=new Date(_0x3593de[_0x4ed59b(0x19e)])[_0x4ed59b(0x193)]();_0x4854d6-_0xb7cd87>SESSION_EXPIRATION_MS&&(a67_0x4718ce[_0x4ed59b(0x194)](_0x141647),_0x33ce4b++);}catch{a67_0x4718ce[_0x4ed59b(0x194)](_0x141647),_0x33ce4b++;}}}catch{}return _0x33ce4b;}export function listActiveSessions(){const _0x4bdbd8=a67_0x4354,_0x5143c4=getSessionsDir();if(!a67_0x4718ce[_0x4bdbd8(0x1a3)](_0x5143c4))return[];try{const _0x2d78f1=a67_0x4718ce['readdirSync'](_0x5143c4),_0x2a5598=[];for(const _0x84e21d of _0x2d78f1){if(!_0x84e21d[_0x4bdbd8(0x182)](_0x4bdbd8(0x19a)))continue;const _0x5e3246=_0x84e21d[_0x4bdbd8(0x18a)](_0x4bdbd8(0x19a),''),_0x11d226=parseInt(_0x5e3246,0xa);!isNaN(_0x11d226)&&isProcessRunning(_0x11d226)&&_0x2a5598[_0x4bdbd8(0x1a6)](_0x11d226);}return _0x2a5598[_0x4bdbd8(0x19f)]((_0x2db09a,_0x116307)=>_0x2db09a-_0x116307);}catch{return[];}}
1
+ (function(_0xa6d178,_0x2513c2){const _0x2b4a9b=a67_0x5da0,_0xc14067=_0xa6d178();while(!![]){try{const _0x2a0f7e=parseInt(_0x2b4a9b(0x1eb))/0x1*(parseInt(_0x2b4a9b(0x1fd))/0x2)+parseInt(_0x2b4a9b(0x1fe))/0x3*(parseInt(_0x2b4a9b(0x1e7))/0x4)+parseInt(_0x2b4a9b(0x1e2))/0x5*(-parseInt(_0x2b4a9b(0x1f2))/0x6)+parseInt(_0x2b4a9b(0x1e5))/0x7+-parseInt(_0x2b4a9b(0x1fc))/0x8*(parseInt(_0x2b4a9b(0x1ed))/0x9)+parseInt(_0x2b4a9b(0x206))/0xa*(parseInt(_0x2b4a9b(0x1e8))/0xb)+parseInt(_0x2b4a9b(0x1ea))/0xc*(-parseInt(_0x2b4a9b(0x202))/0xd);if(_0x2a0f7e===_0x2513c2)break;else _0xc14067['push'](_0xc14067['shift']());}catch(_0x32885d){_0xc14067['push'](_0xc14067['shift']());}}}(a67_0x326a,0x2d742));import*as a67_0x433164 from'node:fs';import*as a67_0x1f5229 from'node:path';import*as a67_0xc7f053 from'node:os';function a67_0x5da0(_0xdc725b,_0x43c068){_0xdc725b=_0xdc725b-0x1dc;const _0x326a57=a67_0x326a();let _0x5da0b7=_0x326a57[_0xdc725b];return _0x5da0b7;}import{getPPID,isProcessRunning}from'../utils/process.js';import{createSecureDirectory}from'../utils/file-permissions.js';const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function getSessionsDir(){const _0x16de72=a67_0x5da0,_0x28f802=process.env.TDX_CONFIG_DIR||a67_0x1f5229[_0x16de72(0x1f7)](a67_0xc7f053[_0x16de72(0x201)](),'.config',_0x16de72(0x1dc));return a67_0x1f5229[_0x16de72(0x1f7)](_0x28f802,_0x16de72(0x1e1));}function getSessionPath(_0x5d1736){const _0x4e51c9=a67_0x5da0;return a67_0x1f5229[_0x4e51c9(0x1f7)](getSessionsDir(),_0x5d1736+'.json');}function a67_0x326a(){const _0x2f5904=['join','existsSync','parse','unlinkSync','push','2250824hmLOqF','2cSYQFr','819705Fxzwwr','toString','readFileSync','homedir','47008DoUfru','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','.\x20This\x20is\x20insecure.\x20Removing\x20session.','warn','191990fYaXlz','tdx','sort','readdirSync','createdAt','utf-8','sessions','890imCWZg','test','now','1972145sGOGGZ','TD_API_KEY','4KhmvUQ','110SNjlWW','replace','516DdOabh','175277mKiejc','writeFileSync','9xWgOYG','stringify','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','getTime','apiKey','10086XAjMuF','endsWith','.json','toISOString','includes'];a67_0x326a=function(){return _0x2f5904;};return a67_0x326a();}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x16a6ee){const _0x241ef8=a67_0x5da0;if(_0x16a6ee)return _0x16a6ee;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x241ef8(0x1ff)]();}export function loadSessionContext(_0x34ddbc){const _0x28051e=a67_0x5da0,_0x45e4d9=getSessionID(_0x34ddbc),_0x3ab7ab=/^\d+$/[_0x28051e(0x1e3)](_0x45e4d9)?parseInt(_0x45e4d9,0xa):null;return _0x3ab7ab!==null?loadSessionContextByPID(_0x3ab7ab):loadSessionContextByString(_0x45e4d9);}export function loadSessionContextByPID(_0x1eb2e6){const _0x5a69de=a67_0x5da0,_0x232dc=getSessionPath(_0x1eb2e6);if(!a67_0x433164[_0x5a69de(0x1f8)](_0x232dc))return null;try{const _0x24814b=a67_0x433164[_0x5a69de(0x200)](_0x232dc,'utf-8'),_0x3f7776=JSON[_0x5a69de(0x1f9)](_0x24814b),_0x4bd189=new Date(_0x3f7776[_0x5a69de(0x1df)])[_0x5a69de(0x1f0)](),_0x26c812=Date['now']();if(_0x26c812-_0x4bd189>SESSION_EXPIRATION_MS)return a67_0x433164[_0x5a69de(0x1fa)](_0x232dc),null;const _0x204839=JSON['stringify'](_0x3f7776);if(_0x204839['includes']('TD_API_KEY')||_0x204839['includes'](_0x5a69de(0x1f1))||_0x204839['includes']('api_key'))return console[_0x5a69de(0x205)](_0x5a69de(0x203)+_0x232dc+_0x5a69de(0x204)),a67_0x433164[_0x5a69de(0x1fa)](_0x232dc),null;return _0x3f7776;}catch{try{a67_0x433164['unlinkSync'](_0x232dc);}catch{}return null;}}function loadSessionContextByString(_0x41eee2){const _0x339d7c=a67_0x5da0,_0x2582e7=a67_0x1f5229[_0x339d7c(0x1f7)](getSessionsDir(),_0x41eee2+_0x339d7c(0x1f4));if(!a67_0x433164[_0x339d7c(0x1f8)](_0x2582e7))return null;try{const _0x21257a=a67_0x433164[_0x339d7c(0x200)](_0x2582e7,_0x339d7c(0x1e0)),_0xe51584=JSON[_0x339d7c(0x1f9)](_0x21257a),_0xa7fab0=new Date(_0xe51584[_0x339d7c(0x1df)])[_0x339d7c(0x1f0)](),_0x18cd07=Date[_0x339d7c(0x1e4)]();if(_0x18cd07-_0xa7fab0>SESSION_EXPIRATION_MS)return a67_0x433164[_0x339d7c(0x1fa)](_0x2582e7),null;const _0xa2bef8=JSON[_0x339d7c(0x1ee)](_0xe51584);if(_0xa2bef8[_0x339d7c(0x1f6)]('TD_API_KEY')||_0xa2bef8['includes']('apiKey')||_0xa2bef8['includes']('api_key'))return console[_0x339d7c(0x205)](_0x339d7c(0x203)+_0x2582e7+_0x339d7c(0x204)),a67_0x433164[_0x339d7c(0x1fa)](_0x2582e7),null;return _0xe51584;}catch{try{a67_0x433164[_0x339d7c(0x1fa)](_0x2582e7);}catch{}return null;}}export function saveSessionContext(_0x3d76c4,_0x158079){const _0x54cd89=a67_0x5da0,_0xee7668=getSessionID(_0x158079),_0x41b7d7=/^\d+$/[_0x54cd89(0x1e3)](_0xee7668)?parseInt(_0xee7668,0xa):getCurrentSessionPID(),_0x39f0d7=a67_0x1f5229[_0x54cd89(0x1f7)](getSessionsDir(),_0xee7668+_0x54cd89(0x1f4)),_0x46326=getSessionsDir();createSecureDirectory(_0x46326);const _0x392f02=JSON[_0x54cd89(0x1ee)](_0x3d76c4);if(_0x392f02['includes'](_0x54cd89(0x1e6))||_0x392f02[_0x54cd89(0x1f6)]('apiKey')||_0x392f02['includes']('api_key'))throw new Error(_0x54cd89(0x1ef));let _0x4775b8;const _0x3bdfcb=/^\d+$/['test'](_0xee7668)?loadSessionContextByPID(parseInt(_0xee7668,0xa)):loadSessionContextByString(_0xee7668);_0x3bdfcb?_0x4775b8={..._0x3bdfcb,..._0x3d76c4,'pid':_0x41b7d7,'sessionId':_0xee7668!==_0x41b7d7[_0x54cd89(0x1ff)]()?_0xee7668:undefined,'updatedAt':new Date()[_0x54cd89(0x1f5)]()}:_0x4775b8={'pid':_0x41b7d7,'sessionId':_0xee7668!==_0x41b7d7[_0x54cd89(0x1ff)]()?_0xee7668:undefined,..._0x3d76c4,'createdAt':new Date()[_0x54cd89(0x1f5)](),'updatedAt':new Date()['toISOString']()},a67_0x433164['writeFileSync'](_0x39f0d7,JSON[_0x54cd89(0x1ee)](_0x4775b8,null,0x2));}export function clearSessionContext(_0xfb4681){const _0x275017=a67_0x5da0,_0x43005a=getSessionID(_0xfb4681),_0x4904c6=a67_0x1f5229[_0x275017(0x1f7)](getSessionsDir(),_0x43005a+_0x275017(0x1f4));a67_0x433164['existsSync'](_0x4904c6)&&a67_0x433164[_0x275017(0x1fa)](_0x4904c6);}export function clearSessionContextField(_0x7cb5b6,_0x55d583){const _0x266ce4=a67_0x5da0,_0x5cc006=getSessionID(_0x55d583),_0x58b2d0=a67_0x1f5229['join'](getSessionsDir(),_0x5cc006+_0x266ce4(0x1f4));if(!a67_0x433164[_0x266ce4(0x1f8)](_0x58b2d0))return;try{const _0x56c828=a67_0x433164[_0x266ce4(0x200)](_0x58b2d0,_0x266ce4(0x1e0)),_0x89459=JSON['parse'](_0x56c828);delete _0x89459[_0x7cb5b6],a67_0x433164[_0x266ce4(0x1ec)](_0x58b2d0,JSON[_0x266ce4(0x1ee)](_0x89459,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x3b7744=a67_0x5da0,_0x44e93a=getSessionsDir();if(!a67_0x433164['existsSync'](_0x44e93a))return 0x0;let _0x5e7613=0x0;const _0x204b92=Date['now']();try{const _0x2e3937=a67_0x433164[_0x3b7744(0x1de)](_0x44e93a);for(const _0x162bcb of _0x2e3937){if(!_0x162bcb[_0x3b7744(0x1f3)](_0x3b7744(0x1f4)))continue;const _0x51daa9=a67_0x1f5229['join'](_0x44e93a,_0x162bcb),_0x404d33=_0x162bcb[_0x3b7744(0x1e9)](_0x3b7744(0x1f4),''),_0x2847cb=parseInt(_0x404d33,0xa),_0x367f9a=!isNaN(_0x2847cb);if(_0x367f9a){if(!isProcessRunning(_0x2847cb)){a67_0x433164[_0x3b7744(0x1fa)](_0x51daa9),_0x5e7613++;continue;}}try{const _0xb393f5=a67_0x433164[_0x3b7744(0x200)](_0x51daa9,_0x3b7744(0x1e0)),_0x2b282c=JSON[_0x3b7744(0x1f9)](_0xb393f5),_0x19e05c=new Date(_0x2b282c[_0x3b7744(0x1df)])['getTime']();_0x204b92-_0x19e05c>SESSION_EXPIRATION_MS&&(a67_0x433164[_0x3b7744(0x1fa)](_0x51daa9),_0x5e7613++);}catch{a67_0x433164['unlinkSync'](_0x51daa9),_0x5e7613++;}}}catch{}return _0x5e7613;}export function listActiveSessions(){const _0xeefcf7=a67_0x5da0,_0x443654=getSessionsDir();if(!a67_0x433164[_0xeefcf7(0x1f8)](_0x443654))return[];try{const _0x4fcce7=a67_0x433164[_0xeefcf7(0x1de)](_0x443654),_0x5dcf14=[];for(const _0x3a43ed of _0x4fcce7){if(!_0x3a43ed['endsWith']('.json'))continue;const _0x3c2341=_0x3a43ed[_0xeefcf7(0x1e9)]('.json',''),_0x5a7a3a=parseInt(_0x3c2341,0xa);!isNaN(_0x5a7a3a)&&isProcessRunning(_0x5a7a3a)&&_0x5dcf14[_0xeefcf7(0x1fb)](_0x5a7a3a);}return _0x5dcf14[_0xeefcf7(0x1dd)]((_0x3fab7b,_0x48b220)=>_0x3fab7b-_0x48b220);}catch{return[];}}
@@ -1 +1 @@
1
- const a68_0x556936=a68_0x3c14;(function(_0x41e687,_0x3105ab){const _0x3ab9a8=a68_0x3c14,_0x10816c=_0x41e687();while(!![]){try{const _0x772b8f=-parseInt(_0x3ab9a8(0x1b7))/0x1+parseInt(_0x3ab9a8(0x1ad))/0x2+parseInt(_0x3ab9a8(0x1b9))/0x3+-parseInt(_0x3ab9a8(0x1b1))/0x4+-parseInt(_0x3ab9a8(0x1b6))/0x5+-parseInt(_0x3ab9a8(0x1b4))/0x6*(parseInt(_0x3ab9a8(0x1b2))/0x7)+parseInt(_0x3ab9a8(0x1b5))/0x8*(parseInt(_0x3ab9a8(0x1ae))/0x9);if(_0x772b8f===_0x3105ab)break;else _0x10816c['push'](_0x10816c['shift']());}catch(_0x1b1d61){_0x10816c['push'](_0x10816c['shift']());}}}(a68_0xeb30,0xda5f0));function a68_0x3c14(_0x1ddc4f,_0x84f5a2){_0x1ddc4f=_0x1ddc4f-0x1ad;const _0xeb30de=a68_0xeb30();let _0x3c14e1=_0xeb30de[_0x1ddc4f];return _0x3c14e1;}import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a68_0x556936(0x1b0),a68_0x556936(0x1af));function a68_0xeb30(){const _0x983ca4=['2863670QvHwVd','221354oSoClZ','now','3140181JerZuG','read','clear','1707980VhsoDm','18PYsfYD','core/user-cache','users-{profile}.json','7099392clgDRU','7525BRWSgI','users','6990Gvmsbc','11260168TXnyoV'];a68_0xeb30=function(){return _0x983ca4;};return a68_0xeb30();}export function loadCachedUsers(_0x2dbd00){const _0x2b7ca4=a68_0x556936,_0x25114e=userCache[_0x2b7ca4(0x1ba)](_0x2dbd00);return _0x25114e?.[_0x2b7ca4(0x1b3)]??null;}export function saveCachedUsers(_0x55a9fb,_0x39a790){const _0x2a1ebe=a68_0x556936;userCache['write'](_0x55a9fb,{'users':_0x39a790,'cachedAt':Date[_0x2a1ebe(0x1b8)]()});}export function clearUserCache(_0x28eda8){const _0x3f0829=a68_0x556936;userCache[_0x3f0829(0x1bb)](_0x28eda8);}
1
+ function a68_0x10b8(_0xa36bd5,_0x36b638){_0xa36bd5=_0xa36bd5-0x92;const _0x55eeeb=a68_0x55ee();let _0x10b8c8=_0x55eeeb[_0xa36bd5];return _0x10b8c8;}const a68_0x39084a=a68_0x10b8;(function(_0x424e67,_0x22df08){const _0x3e80f2=a68_0x10b8,_0x3ccc86=_0x424e67();while(!![]){try{const _0x3e7396=parseInt(_0x3e80f2(0x9d))/0x1+parseInt(_0x3e80f2(0x9e))/0x2*(parseInt(_0x3e80f2(0xa1))/0x3)+parseInt(_0x3e80f2(0x9a))/0x4*(-parseInt(_0x3e80f2(0x92))/0x5)+-parseInt(_0x3e80f2(0x96))/0x6+parseInt(_0x3e80f2(0x97))/0x7*(-parseInt(_0x3e80f2(0xa0))/0x8)+-parseInt(_0x3e80f2(0x95))/0x9*(parseInt(_0x3e80f2(0x9f))/0xa)+parseInt(_0x3e80f2(0x94))/0xb*(parseInt(_0x3e80f2(0x99))/0xc);if(_0x3e7396===_0x22df08)break;else _0x3ccc86['push'](_0x3ccc86['shift']());}catch(_0x4466ea){_0x3ccc86['push'](_0x3ccc86['shift']());}}}(a68_0x55ee,0x6864e));function a68_0x55ee(){const _0x3d6ba2=['182943XGUPyS','173940nVylir','users-{profile}.json','5533bJzXwv','117nBjbPh','3815532dzxbxB','1918Qmlodn','users','51852QOnaVH','88EXgYwH','now','core/user-cache','736459CuSvYo','6DlygOH','612110nxzOLB','13672MdaRGu'];a68_0x55ee=function(){return _0x3d6ba2;};return a68_0x55ee();}import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a68_0x39084a(0x93),a68_0x39084a(0x9c));export function loadCachedUsers(_0x402354){const _0x1c4264=a68_0x39084a,_0xe4a9be=userCache['read'](_0x402354);return _0xe4a9be?.[_0x1c4264(0x98)]??null;}export function saveCachedUsers(_0x2f6267,_0x5ec497){const _0x5418b7=a68_0x39084a;userCache['write'](_0x2f6267,{'users':_0x5ec497,'cachedAt':Date[_0x5418b7(0x9b)]()});}export function clearUserCache(_0x5da756){userCache['clear'](_0x5da756);}
@@ -1 +1 @@
1
- (function(_0x7e2c4b,_0x37558f){const _0x2bd288=a69_0x303c,_0x2bbd0b=_0x7e2c4b();while(!![]){try{const _0x568fb4=parseInt(_0x2bd288(0x9d))/0x1*(-parseInt(_0x2bd288(0xa1))/0x2)+parseInt(_0x2bd288(0x9e))/0x3*(-parseInt(_0x2bd288(0x92))/0x4)+-parseInt(_0x2bd288(0x93))/0x5*(parseInt(_0x2bd288(0x9b))/0x6)+parseInt(_0x2bd288(0x98))/0x7*(-parseInt(_0x2bd288(0xa4))/0x8)+parseInt(_0x2bd288(0xa3))/0x9*(parseInt(_0x2bd288(0x97))/0xa)+parseInt(_0x2bd288(0x96))/0xb*(-parseInt(_0x2bd288(0xa0))/0xc)+parseInt(_0x2bd288(0x9a))/0xd*(parseInt(_0x2bd288(0xa6))/0xe);if(_0x568fb4===_0x37558f)break;else _0x2bbd0b['push'](_0x2bbd0b['shift']());}catch(_0x21eb93){_0x2bbd0b['push'](_0x2bbd0b['shift']());}}}(a69_0x13c0,0x68c94));function a69_0x303c(_0x436540,_0x5f1dac){_0x436540=_0x436540-0x92;const _0x13c05d=a69_0x13c0();let _0x303c7d=_0x13c05d[_0x436540];return _0x303c7d;}import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';function a69_0x13c0(){const _0x2b51d2=['utf-8','759501RSCXEM','1137784Ylracz','../../package.json','35822738qXxMDJ','2974444OjRIUz','5FWTTAr','../build-info.json','includes','4415444zaYvqY','10weiSlH','21DjCYtC','parse','13MSjhLL','2171388eREwkS','version','12190YYGIrH','3LJDyxO','.dev','12NONUxi','46HUWoXz'];a69_0x13c0=function(){return _0x2b51d2;};return a69_0x13c0();}let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x21a78e=a69_0x303c;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x5eca11=fileURLToPath(import.meta.url),_0x453347=dirname(_0x5eca11);try{const _0xf0b2d=join(_0x453347,_0x21a78e(0x94));cachedBuildInfo=JSON[_0x21a78e(0x99)](readFileSync(_0xf0b2d,_0x21a78e(0xa2)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x190ea6=a69_0x303c;if(cachedVersion!==null)return cachedVersion;const _0x371cf8=fileURLToPath(import.meta.url),_0x58d8e9=dirname(_0x371cf8),_0x33433a=getBuildInfo();if(_0x33433a[_0x190ea6(0x9c)])return cachedVersion=_0x33433a[_0x190ea6(0x9c)],cachedVersion;try{const _0x390573=join(_0x58d8e9,_0x190ea6(0xa5)),_0x433f6f=JSON['parse'](readFileSync(_0x390573,_0x190ea6(0xa2)));cachedVersion=_0x433f6f['version'];}catch{cachedVersion='0.0.0';}return cachedVersion;}export function isDevVersion(){const _0x3448c5=a69_0x303c,_0x59eab5=getVersion();return _0x59eab5[_0x3448c5(0x95)](_0x3448c5(0x9f))||_0x59eab5[_0x3448c5(0x95)]('-');}
1
+ (function(_0x154d95,_0xd7700b){const _0x2c5bc5=a69_0x3dce,_0x9fa243=_0x154d95();while(!![]){try{const _0x585367=parseInt(_0x2c5bc5(0xf3))/0x1+parseInt(_0x2c5bc5(0xe6))/0x2+-parseInt(_0x2c5bc5(0xf0))/0x3+parseInt(_0x2c5bc5(0xee))/0x4+-parseInt(_0x2c5bc5(0xed))/0x5+parseInt(_0x2c5bc5(0xec))/0x6+-parseInt(_0x2c5bc5(0xf2))/0x7;if(_0x585367===_0xd7700b)break;else _0x9fa243['push'](_0x9fa243['shift']());}catch(_0x6e74de){_0x9fa243['push'](_0x9fa243['shift']());}}}(a69_0x3b36,0x83f8e));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x2dde8e=a69_0x3dce;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x121399=fileURLToPath(import.meta.url),_0x1fba8c=dirname(_0x121399);try{const _0x2fb37a=join(_0x1fba8c,_0x2dde8e(0xf1));cachedBuildInfo=JSON['parse'](readFileSync(_0x2fb37a,'utf-8'));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x507fb4=a69_0x3dce;if(cachedVersion!==null)return cachedVersion;const _0x30bfbb=fileURLToPath(import.meta.url),_0x38eebf=dirname(_0x30bfbb),_0x5d6aa9=getBuildInfo();if(_0x5d6aa9[_0x507fb4(0xe9)])return cachedVersion=_0x5d6aa9['version'],cachedVersion;try{const _0xba86d8=join(_0x38eebf,_0x507fb4(0xe7)),_0x5417e2=JSON['parse'](readFileSync(_0xba86d8,_0x507fb4(0xe8)));cachedVersion=_0x5417e2[_0x507fb4(0xe9)];}catch{cachedVersion=_0x507fb4(0xeb);}return cachedVersion;}function a69_0x3b36(){const _0x1a0829=['297188SCJppj','784862BaSmgd','../../package.json','utf-8','version','.dev','0.0.0','4039230HwSZgS','4144975BkaBaK','1754124NZRQVR','includes','302094wrMFYn','../build-info.json','2317728bNBgbO'];a69_0x3b36=function(){return _0x1a0829;};return a69_0x3b36();}function a69_0x3dce(_0x3d4a60,_0x296c80){_0x3d4a60=_0x3d4a60-0xe6;const _0x3b36c4=a69_0x3b36();let _0x3dce54=_0x3b36c4[_0x3d4a60];return _0x3dce54;}export function isDevVersion(){const _0x3d0ef7=a69_0x3dce,_0x56c474=getVersion();return _0x56c474[_0x3d0ef7(0xef)](_0x3d0ef7(0xea))||_0x56c474['includes']('-');}