@treasuredata/tdx 2026.4.6 → 2026.4.8

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_0x36162f=a57_0x5b0d;(function(_0x3f0f47,_0x4aae19){const _0x2fa672=a57_0x5b0d,_0x1b6318=_0x3f0f47();while(!![]){try{const _0xde9ded=parseInt(_0x2fa672(0xc0))/0x1+-parseInt(_0x2fa672(0xdb))/0x2*(parseInt(_0x2fa672(0xa4))/0x3)+-parseInt(_0x2fa672(0xc9))/0x4+-parseInt(_0x2fa672(0xaf))/0x5*(parseInt(_0x2fa672(0xc1))/0x6)+-parseInt(_0x2fa672(0x96))/0x7*(parseInt(_0x2fa672(0x9b))/0x8)+-parseInt(_0x2fa672(0xa7))/0x9*(parseInt(_0x2fa672(0xa1))/0xa)+-parseInt(_0x2fa672(0xcb))/0xb*(-parseInt(_0x2fa672(0xc8))/0xc);if(_0xde9ded===_0x4aae19)break;else _0x1b6318['push'](_0x1b6318['shift']());}catch(_0x55d217){_0x1b6318['push'](_0x1b6318['shift']());}}}(a57_0x5d9b,0x655f1));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a57_0x3e0ddc from'node:fs';import*as a57_0x635643 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_0x3f933c from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x4c2f6c=a57_0x5b0d;return process.env.TDX_CONFIG_DIR||join(homedir(),'.config',_0x4c2f6c(0x9d));}export function getConfigFile(){const _0x400c33=a57_0x5b0d;return join(getConfigDir(),_0x400c33(0xa8));}export function getConfigFilePath(_0x46bb37){const _0x1c93d1=a57_0x5b0d,_0x33c9b8=getConfigDir();return _0x46bb37?a57_0x635643[_0x1c93d1(0xb8)](_0x33c9b8,_0x1c93d1(0xc3)+_0x46bb37):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a57_0x36162f(0xb5),a57_0x36162f(0xda));export function getLLMProjectCacheFile(_0x2964b7){const _0x56a0e6=a57_0x36162f;return llmProjectCache[_0x56a0e6(0xb1)](_0x2964b7);}export function readCachedLLMProject(_0x321eae){const _0x182e94=a57_0x36162f,_0x7644db=llmProjectCache[_0x182e94(0xd3)](_0x321eae);if(_0x7644db&&typeof _0x7644db['id']===_0x182e94(0xcd)&&typeof _0x7644db[_0x182e94(0xd7)]==='string')return _0x7644db;return null;}export function writeCachedLLMProject(_0x3bc6a9,_0x2554d3,_0x29cc7a){const _0x4affd1=a57_0x36162f;try{llmProjectCache[_0x4affd1(0xca)]({'name':_0x3bc6a9,'id':_0x2554d3},_0x29cc7a);}catch{}}const llmAgentCache=createOptionalProfileCache('llm_default_agent',a57_0x36162f(0xb7));export function getLLMAgentCacheFile(_0x2d5e94){return llmAgentCache['path'](_0x2d5e94);}export function readCachedLLMAgent(_0x2725f7){const _0x27fe3c=a57_0x36162f,_0x188e03=llmAgentCache[_0x27fe3c(0xd3)](_0x2725f7);if(_0x188e03&&typeof _0x188e03['id']===_0x27fe3c(0xcd)&&typeof _0x188e03[_0x27fe3c(0xd7)]===_0x27fe3c(0xcd)&&typeof _0x188e03[_0x27fe3c(0xae)]===_0x27fe3c(0xcd))return _0x188e03;return null;}export function writeCachedLLMAgent(_0x31abd5,_0x34450f,_0x18b385,_0x4fe660){const _0x4daede=a57_0x36162f;try{llmAgentCache[_0x4daede(0xca)]({'name':_0x31abd5,'id':_0x34450f,'projectId':_0x18b385},_0x4fe660);}catch{}}export function clearCachedLLMAgent(_0x40f79b){const _0x399b36=a57_0x36162f;try{llmAgentCache[_0x399b36(0xb6)](_0x40f79b);}catch{}}const accountInfoCache=createOptionalProfileCache('account_info',a57_0x36162f(0xcf),{'suffix':a57_0x36162f(0xa9)});export function getAccountInfoCacheFile(_0x47e887){const _0x3baeb7=a57_0x36162f;return accountInfoCache[_0x3baeb7(0xb1)](_0x47e887);}export function readCachedAccountInfo(_0x49ca71){const _0x37468f=a57_0x36162f,_0x23ac4f=accountInfoCache[_0x37468f(0xd3)](_0x49ca71);if(_0x23ac4f&&typeof _0x23ac4f[_0x37468f(0x98)]===_0x37468f(0xcd)&&typeof _0x23ac4f[_0x37468f(0xcc)]===_0x37468f(0xb0))return _0x23ac4f;return null;}export function writeCachedAccountInfo(_0x116c38,_0x259f0d,_0x102497){const _0x54efae=a57_0x36162f;try{accountInfoCache[_0x54efae(0xca)]({'site':_0x116c38,'accountId':_0x259f0d,'cachedAt':new Date()[_0x54efae(0xa5)]()},_0x102497);}catch{}}export function parseEnvFile(_0x485022){const _0x3d16cf=a57_0x36162f,_0x350c16={};for(const _0x316541 of _0x485022['split']('\x0a')){const _0x45e497=_0x316541[_0x3d16cf(0xd0)]();if(!_0x45e497||_0x45e497[_0x3d16cf(0xbc)]('#'))continue;const _0x1001f1=_0x45e497['match'](/^([^=]+)=(.*)$/);if(_0x1001f1){const _0x30616a=_0x1001f1[0x1][_0x3d16cf(0xd0)]();let _0xf529ad=_0x1001f1[0x2][_0x3d16cf(0xd0)]();(_0xf529ad[_0x3d16cf(0xbc)]('\x22')&&_0xf529ad[_0x3d16cf(0xe0)]('\x22')||_0xf529ad[_0x3d16cf(0xbc)]('\x27')&&_0xf529ad[_0x3d16cf(0xe0)]('\x27'))&&(_0xf529ad=_0xf529ad['slice'](0x1,-0x1)),_0x350c16[_0x30616a]=_0xf529ad;}}return _0x350c16;}function a57_0x5d9b(){const _0xdbafeb=['source','startsWith','proxy','apiKey','us01','189638lrMKlt','287808qxZgAs','stg-us01','.env.','split','ap01','TD_API_KEY_','\x20env\x20var','14249448AfCdMM','144308jRiJSi','write','22MoMzLT','accountId','string','utf-8','config/account-info','trim','stg-ap03','apiKeys','read','readFileSync','stable','yellow','name','next','includes','config/llm-project','1350282fqmQCq','Warning:\x20Unknown\x20site\x20\x27','eu01','ap03','tdx.json','endsWith','map','release_channel','filter','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','warn','parse','506947NolYiP','keychain\x20(profile:\x20','site','toUpperCase','ap02','80lomdxQ','keychain','tdx','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','profile','TDX_ACCESS_TOKEN\x20env\x20var','1862530QbSOzq','existsSync','TDX_ACCESS_TOKEN_','3ttwLIE','toISOString','replace','9xvKBYA','.env','.json','some','TD_API_KEY','accessToken','dev-eu01','projectId','55LljtyJ','number','path','TDX_ACCESS_TOKEN_FILE','\x27,\x20defaulting\x20to\x20us01','stg-ap01','llm_default_project','clear','config/llm-agent','join','TDX_API_KEY\x20env\x20var','stringify'];a57_0x5d9b=function(){return _0xdbafeb;};return a57_0x5d9b();}export function readUserConfig(){const _0x304b1f=a57_0x36162f,_0x3ccf7f=getConfigFile();if(!existsSync(_0x3ccf7f))return{};try{const _0x311e0c=readFileSync(_0x3ccf7f,_0x304b1f(0xce));return parseEnvFile(_0x311e0c);}catch(_0x215e51){return console[_0x304b1f(0x94)](_0x304b1f(0x9e)+_0x3ccf7f+':',_0x215e51),{};}}export function resolveSite(_0x24ca38){const _0xcc834=a57_0x36162f,_0x19f74f=['us01','ap01',_0xcc834(0xdd),_0xcc834(0x9a),_0xcc834(0xde),'dev-us01',_0xcc834(0xad),_0xcc834(0xc2),_0xcc834(0xb4),'stg-ap03'];if(_0x19f74f[_0xcc834(0xd9)](_0x24ca38))return _0x24ca38;if(_0x24ca38 in SITE_ALIASES)return SITE_ALIASES[_0x24ca38];return console['warn'](_0xcc834(0xdc)+_0x24ca38+_0xcc834(0xb3)),_0xcc834(0xbf);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x31df62){const _0x7b0f4a=a57_0x36162f,_0x4cc606=_0x31df62||getActiveProfileName()||undefined;if(_0x4cc606){const _0x472b0f=_0x7b0f4a(0xa3)+normalizeProfileForEnvVar(_0x4cc606);if(process.env[_0x472b0f])return{'accessToken':process.env[_0x472b0f],'source':_0x472b0f+_0x7b0f4a(0xc7)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x7b0f4a(0xa0)};if(process.env.TDX_ACCESS_TOKEN_FILE){const _0x11ae7b=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x11ae7b)return{'accessToken':_0x11ae7b,'source':_0x7b0f4a(0xb2)};}return null;}function readAccessTokenFile(_0x410c8a){try{const _0x544cc9=readFileSync(_0x410c8a,'utf-8')['trim']();return _0x544cc9||null;}catch{return null;}}export function getAccessToken(_0x3434ab){const _0xd7a58a=a57_0x36162f;return resolveAccessToken(_0x3434ab)?.[_0xd7a58a(0xac)];}export function getAPIKey(_0x5a20d7){const _0x731f94=_0x5a20d7||getActiveProfileName();if(_0x731f94){const _0x3d08da='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x731f94);if(process.env[_0x3d08da])return process.env[_0x3d08da];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x43d72e){const _0x44a269=a57_0x36162f;return _0x43d72e[_0x44a269(0x99)]()[_0x44a269(0xa6)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x21b4ed,_0x4d896a){const _0xb61bdd=a57_0x36162f,_0x221499=resolveAccessToken(_0x4d896a);if(_0x221499)return{'apiKey':_0x221499[_0xb61bdd(0xac)],'source':_0x221499[_0xb61bdd(0xbb)],'isDeprecated':![]};const _0x569597=_0x4d896a||getActiveProfileName()||undefined;if(_0x569597){const _0x503523='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x569597);if(process.env[_0x503523])return{'apiKey':process.env[_0x503523],'source':_0x503523+_0xb61bdd(0xc7),'isDeprecated':![]};const _0x1db900=getCachedCredential(_0x21b4ed,_0x569597);if(_0x1db900)return{'apiKey':_0x1db900,'source':_0xb61bdd(0x97)+_0x569597+')','isDeprecated':![]};const _0x318000=await getKeychainAPIKey(_0x569597);if(_0x318000)return setCachedCredential(_0x318000,_0x21b4ed,_0x569597),{'apiKey':_0x318000,'source':_0xb61bdd(0x97)+_0x569597+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0xb61bdd(0xb9),'isDeprecated':![]};if(!_0x569597){const _0x37af1a=getCachedCredential(_0x21b4ed,undefined);if(_0x37af1a)return{'apiKey':_0x37af1a,'source':'keychain','isDeprecated':![]};const _0x1dc0e8=await getKeychainAPIKey(undefined);if(_0x1dc0e8)return setCachedCredential(_0x1dc0e8,_0x21b4ed,undefined),{'apiKey':_0x1dc0e8,'source':_0xb61bdd(0x9c),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x34acea,_0x21f0db){const _0x173483=a57_0x36162f,_0x2ec2f2=await resolveAPIKeyAsync(_0x34acea,_0x21f0db);return _0x2ec2f2?.[_0x173483(0xbe)];}function cleanupLegacyEnvFile(_0x408f03){const _0x5324c0=a57_0x36162f;if(!existsSync(_0x408f03))return![];try{const _0x41197c=readFileSync(_0x408f03,_0x5324c0(0xce)),_0x39f7c2=_0x41197c[_0x5324c0(0xc4)]('\x0a'),_0x5bcd26=_0x39f7c2[_0x5324c0(0x92)](_0x26072b=>{const _0x12f8ed=_0x5324c0,_0x2db33d=_0x26072b['trim']();if(!_0x2db33d||_0x2db33d['startsWith']('#'))return!![];const [_0x30613d]=_0x2db33d[_0x12f8ed(0xc4)]('=');return!_0x30613d[_0x12f8ed(0xbc)](_0x12f8ed(0xab));}),_0x29f2ef=_0x5bcd26[_0x5324c0(0xaa)](_0x1a0390=>{const _0x5833e9=_0x5324c0,_0x266675=_0x1a0390[_0x5833e9(0xd0)]();return _0x266675&&!_0x266675['startsWith']('#');});if(!_0x29f2ef)return unlinkSync(_0x408f03),!![];return writeFileSync(_0x408f03,_0x5bcd26[_0x5324c0(0xb8)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x50e70b=a57_0x36162f;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x55c6d7=a57_0x635643[_0x50e70b(0xb8)](getConfigDir(),'tdx.json');if(!a57_0x3e0ddc[_0x50e70b(0xa2)](_0x55c6d7))return null;try{const _0x5b5825=a57_0x3e0ddc[_0x50e70b(0xd4)](_0x55c6d7,_0x50e70b(0xce)),_0x53c4d7=JSON[_0x50e70b(0x95)](_0x5b5825);return _0x53c4d7[_0x50e70b(0x9f)]||null;}catch{return null;}}export function saveAPIKey(_0x1575b1,_0x4258a9,_0x512288){const _0x43d9d3=a57_0x36162f,_0x1857bc=getConfigDir(),_0x19c1a5=getConfigFilePath(_0x512288);!existsSync(_0x1857bc)&&mkdirSync(_0x1857bc,{'recursive':!![],'mode':0x1c0});let _0x2d2fea={};if(existsSync(_0x19c1a5))try{const _0x3bd2b1=readFileSync(_0x19c1a5,'utf-8');_0x2d2fea=parseEnvFile(_0x3bd2b1);}catch(_0x2fe45c){console[_0x43d9d3(0x94)]('Warning:\x20Failed\x20to\x20read\x20'+_0x19c1a5+':',_0x2fe45c);}const _0x16ac2e=_0x1575b1[_0x43d9d3(0x99)]()[_0x43d9d3(0xa6)](/-/g,'_');_0x2d2fea[_0x43d9d3(0xc6)+_0x16ac2e]=_0x4258a9;const _0x191922=Object['entries'](_0x2d2fea)[_0x43d9d3(0xe1)](([_0x50c036,_0x527574])=>_0x50c036+'='+_0x527574);writeFileSync(_0x19c1a5,_0x191922[_0x43d9d3(0xb8)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x5e8252,_0x458380,_0x58d367){const _0x30ee62=a57_0x36162f;await saveKeychainAPIKey(_0x5e8252,_0x58d367),setCachedCredential(_0x5e8252,_0x458380,_0x58d367);const _0x497472=getConfigFilePath(_0x58d367);cleanupLegacyEnvFile(_0x497472)&&console[_0x30ee62(0x94)](a57_0x3f933c[_0x30ee62(0xd6)](_0x30ee62(0x93)));}export function loadConfig(){const _0x3de020=a57_0x36162f,_0xee4079={'apiKeys':{},'defaultSite':_0x3de020(0xbf)},_0xb95f79=['us01',_0x3de020(0xc5),'eu01',_0x3de020(0x9a),'ap03','dev-us01',_0x3de020(0xad),'stg-us01',_0x3de020(0xb4),_0x3de020(0xd1)],_0x35ffec=getAPIKey();if(_0x35ffec)for(const _0x39c0b2 of _0xb95f79){_0xee4079[_0x3de020(0xd2)][_0x39c0b2]=_0x35ffec;}return _0xee4079;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}function a57_0x5b0d(_0x4d7cb3,_0x717e7f){_0x4d7cb3=_0x4d7cb3-0x92;const _0x5d9bbe=a57_0x5d9b();let _0x5b0dc2=_0x5d9bbe[_0x4d7cb3];return _0x5b0dc2;}export function loadGlobalProxy(){const _0x9054bb=a57_0x36162f,_0x1e4416=a57_0x635643[_0x9054bb(0xb8)](getConfigDir(),'tdx.json');if(!a57_0x3e0ddc[_0x9054bb(0xa2)](_0x1e4416))return undefined;try{const _0x356f20=a57_0x3e0ddc[_0x9054bb(0xd4)](_0x1e4416,_0x9054bb(0xce)),_0x3eca28=JSON[_0x9054bb(0x95)](_0x356f20);return typeof _0x3eca28[_0x9054bb(0xbd)]==='string'?_0x3eca28['proxy']:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x12437a=a57_0x36162f,_0x8871e0=process.env.TDX_RELEASE_CHANNEL;if(_0x8871e0==='next'||_0x8871e0==='stable')return _0x8871e0;const _0x19473f=a57_0x635643[_0x12437a(0xb8)](getConfigDir(),_0x12437a(0xdf));if(!a57_0x3e0ddc[_0x12437a(0xa2)](_0x19473f))return _0x12437a(0xd5);try{const _0x55d18b=a57_0x3e0ddc[_0x12437a(0xd4)](_0x19473f,_0x12437a(0xce)),_0xd3c703=JSON[_0x12437a(0x95)](_0x55d18b);if(_0xd3c703['release_channel']==='next')return _0x12437a(0xd8);}catch{}return _0x12437a(0xd5);}export function saveReleaseChannel(_0x476276){const _0x42173f=a57_0x36162f,_0x1d4b0e=getConfigDir(),_0x350a85=a57_0x635643[_0x42173f(0xb8)](_0x1d4b0e,_0x42173f(0xdf));!existsSync(_0x1d4b0e)&&mkdirSync(_0x1d4b0e,{'recursive':!![],'mode':0x1c0});let _0x50f800={};if(existsSync(_0x350a85))try{const _0x40fc7f=readFileSync(_0x350a85,_0x42173f(0xce));_0x50f800=JSON['parse'](_0x40fc7f);}catch{}_0x50f800[_0x42173f(0xe2)]=_0x476276,writeFileSync(_0x350a85,JSON[_0x42173f(0xba)](_0x50f800,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
+ const a58_0x69f40a=a58_0x1d7b;(function(_0x225f63,_0x159537){const _0x5e2854=a58_0x1d7b,_0x11f320=_0x225f63();while(!![]){try{const _0x220042=-parseInt(_0x5e2854(0x72))/0x1*(-parseInt(_0x5e2854(0x6f))/0x2)+parseInt(_0x5e2854(0x79))/0x3+parseInt(_0x5e2854(0x75))/0x4+-parseInt(_0x5e2854(0x6b))/0x5*(parseInt(_0x5e2854(0x74))/0x6)+parseInt(_0x5e2854(0x6d))/0x7*(-parseInt(_0x5e2854(0x73))/0x8)+-parseInt(_0x5e2854(0x76))/0x9+parseInt(_0x5e2854(0x77))/0xa;if(_0x220042===_0x159537)break;else _0x11f320['push'](_0x11f320['shift']());}catch(_0xccfba){_0x11f320['push'](_0x11f320['shift']());}}}(a58_0x550b,0xf4044));function a58_0x550b(){const _0x4bc6a2=['2796fNHCPl','6312804pWtvOA','11972979MlAqpQ','11902930qpzeMM','connections','1977936eZcNcT','write','655RpnTGx','read','1778eCmiiT','core/connection-cache','622EocQLS','now','connections-{profile}.json','2801LnilVo','60096cXtTFG'];a58_0x550b=function(){return _0x4bc6a2;};return a58_0x550b();}import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a58_0x69f40a(0x71),a58_0x69f40a(0x6e));export function loadCachedConnections(_0x5e8bd3){const _0x465324=a58_0x69f40a,_0x3de4a7=connectionCache[_0x465324(0x6c)](_0x5e8bd3);return _0x3de4a7?.[_0x465324(0x78)]??null;}function a58_0x1d7b(_0x55cf53,_0x462ea4){_0x55cf53=_0x55cf53-0x6a;const _0x550b06=a58_0x550b();let _0x1d7bf=_0x550b06[_0x55cf53];return _0x1d7bf;}export function saveCachedConnections(_0x475a42,_0x577833){const _0x2c6aae=a58_0x69f40a;connectionCache[_0x2c6aae(0x6a)](_0x475a42,{'connections':_0x577833,'cachedAt':Date[_0x2c6aae(0x70)]()});}export function clearConnectionCache(_0x21e48b){connectionCache['clear'](_0x21e48b);}
@@ -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_0x24368e=a59_0x4bb7;(function(_0x504dad,_0x52c815){const _0x5eee1a=a59_0x4bb7,_0x1b5757=_0x504dad();while(!![]){try{const _0x858a92=-parseInt(_0x5eee1a(0x1ca))/0x1*(-parseInt(_0x5eee1a(0x1cb))/0x2)+-parseInt(_0x5eee1a(0x1bf))/0x3*(parseInt(_0x5eee1a(0x1db))/0x4)+parseInt(_0x5eee1a(0x1c6))/0x5*(-parseInt(_0x5eee1a(0x1d1))/0x6)+parseInt(_0x5eee1a(0x1da))/0x7*(parseInt(_0x5eee1a(0x1cd))/0x8)+-parseInt(_0x5eee1a(0x1c5))/0x9+parseInt(_0x5eee1a(0x1d7))/0xa+-parseInt(_0x5eee1a(0x1bc))/0xb*(parseInt(_0x5eee1a(0x1d5))/0xc);if(_0x858a92===_0x52c815)break;else _0x1b5757['push'](_0x1b5757['shift']());}catch(_0x1c080f){_0x1b5757['push'](_0x1b5757['shift']());}}}(a59_0x1591,0x5b0f4));import a59_0x3e0983 from'prompts';function a59_0x1591(){const _0x352764=['other','length','4668069opxjxa','204YIMkzq','push','us\x20\x20\x20-\x20United\x20States','290488MARyrL','text','us01','15027UtKaZw','customSite','trim','Site\x20name\x20cannot\x20be\x20empty','findIndex','select','2692764uofzSC','25Aioczt','Enter\x20custom\x20site','ap01','log','1187AvsOoN','718OlHvVi','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','8jfReav','site','jp\x20\x20\x20-\x20Japan','ap02\x20-\x20Korea','493194ULAKao','Select\x20your\x20Treasure\x20Data\x20site:','eu01','value','156fWMgyK','test','5889340SppxEX'];a59_0x1591=function(){return _0x352764;};return a59_0x1591();}export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;function a59_0x4bb7(_0x536ee8,_0x16c448){_0x536ee8=_0x536ee8-0x1bb;const _0x15912a=a59_0x1591();let _0x4bb7ae=_0x15912a[_0x536ee8];return _0x4bb7ae;}export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x1780e0,_0x184cdd){if(_0x1780e0===undefined)return _0x184cdd;if(typeof _0x1780e0==='number')return _0x1780e0;return parseInt(_0x1780e0,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a59_0x24368e(0x1bb),'value':a59_0x24368e(0x1be)},{'title':a59_0x24368e(0x1cf),'value':a59_0x24368e(0x1c8)},{'title':'eu\x20\x20\x20-\x20Europe','value':a59_0x24368e(0x1d3)},{'title':a59_0x24368e(0x1d0),'value':'ap02'}];export function buildSiteChoices(_0x41596b){const _0x3750af=a59_0x24368e,_0xe8b7fa=[...STANDARD_SITE_CHOICES];let _0x3aff0e=_0xe8b7fa[_0x3750af(0x1c3)](_0x18eabd=>_0x18eabd[_0x3750af(0x1d4)]===_0x41596b);return _0x3aff0e===-0x1&&_0x41596b!==_0x3750af(0x1be)&&(_0xe8b7fa[_0x3750af(0x1dc)]({'title':_0x41596b,'value':_0x41596b}),_0x3aff0e=_0xe8b7fa[_0x3750af(0x1d9)]-0x1),_0xe8b7fa[_0x3750af(0x1dc)]({'title':_0x3750af(0x1c7),'value':_0x3750af(0x1d8)}),{'choices':_0xe8b7fa,'initialIndex':_0x3aff0e>=0x0?_0x3aff0e:0x0};}export async function promptSiteSelection(_0x576f3f,_0x7a6d2a,_0x13d1e5='Cancelled'){const _0x2b2e9=a59_0x24368e,{choices:_0x550f25,initialIndex:_0x54af55}=buildSiteChoices(_0x576f3f),_0x2718ed=_0x7a6d2a?'Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20'+_0x7a6d2a+'):':_0x2b2e9(0x1d2),_0x421712=await a59_0x3e0983({'type':_0x2b2e9(0x1c4),'name':'site','message':_0x2718ed,'choices':_0x550f25,'initial':_0x54af55});if(!_0x421712[_0x2b2e9(0x1ce)])return console[_0x2b2e9(0x1c9)]('\x0a'+_0x13d1e5),null;if(_0x421712['site']!==_0x2b2e9(0x1d8))return _0x421712[_0x2b2e9(0x1ce)];const _0x7ae231=await a59_0x3e0983({'type':_0x2b2e9(0x1bd),'name':'customSite','message':'Enter\x20site\x20name:','initial':'us01','validate':_0x2c0c55=>{const _0x2ec56b=_0x2b2e9;if(!_0x2c0c55||!_0x2c0c55['trim']())return _0x2ec56b(0x1c2);if(!/^[a-z0-9-]+$/[_0x2ec56b(0x1d6)](_0x2c0c55[_0x2ec56b(0x1c1)]()))return _0x2ec56b(0x1cc);return!![];}});if(!_0x7ae231[_0x2b2e9(0x1c0)])return console[_0x2b2e9(0x1c9)]('\x0a'+_0x13d1e5),null;return _0x7ae231[_0x2b2e9(0x1c0)];}
@@ -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(_0x3ba42b,_0x4be1dc){const _0x35610c=a60_0x26ee,_0x1cedc8=_0x3ba42b();while(!![]){try{const _0xc681e5=parseInt(_0x35610c(0x93))/0x1*(parseInt(_0x35610c(0x92))/0x2)+-parseInt(_0x35610c(0x90))/0x3*(-parseInt(_0x35610c(0x91))/0x4)+-parseInt(_0x35610c(0x8a))/0x5*(parseInt(_0x35610c(0x8c))/0x6)+parseInt(_0x35610c(0x8b))/0x7+-parseInt(_0x35610c(0x94))/0x8+-parseInt(_0x35610c(0x98))/0x9*(parseInt(_0x35610c(0x96))/0xa)+parseInt(_0x35610c(0x99))/0xb;if(_0xc681e5===_0x4be1dc)break;else _0x1cedc8['push'](_0x1cedc8['shift']());}catch(_0x2d9234){_0x1cedc8['push'](_0x1cedc8['shift']());}}}(a60_0x709d,0x7c1c6));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x3a0e59,_0xf4cdbf){const _0x15c45b=a60_0x26ee,_0x5c712a=_0x3a0e59||_0x15c45b(0x9a),_0x122d7a=_0xf4cdbf||_0x15c45b(0x97);return _0x5c712a+':'+_0x122d7a;}export function getCachedCredential(_0x451e83,_0x2333db){const _0x4f6293=a60_0x26ee,_0x454406=getCacheKey(_0x451e83,_0x2333db),_0x23b4a7=cache[_0x4f6293(0x8f)](_0x454406);if(!_0x23b4a7)return null;if(Date['now']()-_0x23b4a7[_0x4f6293(0x88)]>CACHE_TTL_MS)return cache[_0x4f6293(0x89)](_0x454406),null;return _0x23b4a7[_0x4f6293(0x95)];}export function setCachedCredential(_0x324a12,_0x38f7be,_0x28a747){const _0x79fadf=a60_0x26ee,_0x31c344=getCacheKey(_0x38f7be,_0x28a747);cache[_0x79fadf(0x8d)](_0x31c344,{'apiKey':_0x324a12,'loadedAt':Date['now']()});}export function clearCredentialCache(){const _0x1d4579=a60_0x26ee;cache[_0x1d4579(0x8e)]();}function a60_0x709d(){const _0x32fef2=['2tTamHu','2232600yFnePK','apiKey','30mqtStR','__default_profile__','2624607wyWpvj','9824342MdEcpH','__default_site__','loadedAt','delete','711295QUQATK','4179035VLscIf','42phPVSu','set','clear','get','67650ETPuTV','120rPRSEm','491488UEKGNL'];a60_0x709d=function(){return _0x32fef2;};return a60_0x709d();}function a60_0x26ee(_0x5ec4d0,_0x3c97be){_0x5ec4d0=_0x5ec4d0-0x88;const _0x709d9f=a60_0x709d();let _0x26eeb3=_0x709d9f[_0x5ec4d0];return _0x26eeb3;}export function clearCachedCredential(_0xdb78b7,_0x3f4447){const _0x4c7967=getCacheKey(_0xdb78b7,_0x3f4447);cache['delete'](_0x4c7967);}
@@ -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_0xa27371=a61_0x2423;(function(_0x4b08d6,_0x4d886e){const _0x3d55bb=a61_0x2423,_0x58ca12=_0x4b08d6();while(!![]){try{const _0x37fc8b=parseInt(_0x3d55bb(0x77))/0x1*(-parseInt(_0x3d55bb(0xb4))/0x2)+-parseInt(_0x3d55bb(0x79))/0x3*(-parseInt(_0x3d55bb(0x82))/0x4)+-parseInt(_0x3d55bb(0xbb))/0x5*(parseInt(_0x3d55bb(0x9a))/0x6)+parseInt(_0x3d55bb(0x8f))/0x7*(-parseInt(_0x3d55bb(0xae))/0x8)+-parseInt(_0x3d55bb(0x8e))/0x9*(-parseInt(_0x3d55bb(0x95))/0xa)+parseInt(_0x3d55bb(0x99))/0xb+parseInt(_0x3d55bb(0x93))/0xc;if(_0x37fc8b===_0x4d886e)break;else _0x58ca12['push'](_0x58ca12['shift']());}catch(_0x3a8068){_0x58ca12['push'](_0x58ca12['shift']());}}}(a61_0x4b98,0x2b7ae));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';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_0x1a1753 from'node:fs';import*as a61_0x5eaffc from'node:path';function a61_0x2423(_0x2c0335,_0x1eb959){_0x2c0335=_0x2c0335-0x75;const _0x4b98db=a61_0x4b98();let _0x2423fa=_0x4b98db[_0x2c0335];return _0x2423fa;}import a61_0x5d2284 from'chalk';export class GlobalContext{[a61_0xa27371(0x97)];[a61_0xa27371(0x9d)];['parent_segment'];[a61_0xa27371(0xb7)];[a61_0xa27371(0x90)];[a61_0xa27371(0xa5)];[a61_0xa27371(0xc2)];[a61_0xa27371(0xba)];[a61_0xa27371(0xa1)];['accessToken'];['proxy'];[a61_0xa27371(0x87)];[a61_0xa27371(0xcc)];['profile'];[a61_0xa27371(0xb6)]=null;['layers'];['activeProfile'];[a61_0xa27371(0xaf)];['configFiles'];constructor(_0xba7a6e){const _0x243640=a61_0xa27371;this[_0x243640(0xaf)]=getSessionID(_0xba7a6e[_0x243640(0x7f)]);const _0x35963d=loadSessionContext(_0xba7a6e[_0x243640(0x7f)]),_0x1608dc=loadProjectConfig(),_0x51a823=this[_0x243640(0xbe)]();if(_0xba7a6e[_0x243640(0x8c)])this[_0x243640(0xa0)]=_0xba7a6e[_0x243640(0x8c)],this[_0x243640(0xb6)]=_0x243640(0x80);else{if(_0x35963d?.[_0x243640(0x8c)])this[_0x243640(0xa0)]=_0x35963d[_0x243640(0x8c)],this[_0x243640(0xb6)]=_0x243640(0x7f);else{if(_0x51a823[_0x243640(0x8c)])this[_0x243640(0xa0)]=_0x51a823[_0x243640(0x8c)],this[_0x243640(0xb6)]=_0x243640(0xb1);else process.env.TDX_PROFILE?(this[_0x243640(0xa0)]=process.env.TDX_PROFILE,this[_0x243640(0xb6)]='env'):(this[_0x243640(0xa0)]=null,this['profileSource']=null);}}const _0x88785e=this[_0x243640(0xa0)]?loadProfile(this[_0x243640(0xa0)]):null,_0x45cd54=_0x3709cb=>{const _0x523b59=_0x243640;if(!_0x3709cb)return{};const _0x3fcf29=_0x3709cb,_0x22e880={};for(const [_0x3c3618,_0x32e18e]of Object[_0x523b59(0xcb)](_0x3fcf29)){typeof _0x32e18e===_0x523b59(0xb0)&&(_0x22e880[_0x3c3618]=_0x32e18e);}return _0x22e880;},_0x2d488f={},_0x4ba5a6=(_0x2d95fd,_0x515c27,_0x28e541)=>{const _0x2c3f09=_0x243640;if(!_0x2d95fd)return![];if(_0x28e541&&_0x2d95fd===_0x28e541)return![];const _0x14d5ed=_0x35963d,_0x5de4ea=_0x1608dc,_0x31e67d=_0x88785e?.[_0x2c3f09(0xb1)],_0x75c66f=_0x51a823,_0x50e513=_0x14d5ed?.[_0x515c27],_0x385a82=_0x5de4ea?.[_0x515c27],_0x122763=_0x31e67d?.[_0x515c27],_0x3ff9b2=_0x75c66f[_0x515c27];return _0x2d95fd!==_0x50e513&&_0x2d95fd!==_0x385a82&&_0x2d95fd!==_0x122763&&_0x2d95fd!==_0x3ff9b2;},_0x5cee9d=[{'optionKey':_0x243640(0x97),'contextKey':_0x243640(0x97),'defaultValue':_0x243640(0xa6)},{'optionKey':_0x243640(0x9d),'contextKey':_0x243640(0x9d)},{'optionKey':'parentSegment','contextKey':'parent_segment'},{'optionKey':_0x243640(0xa7),'contextKey':_0x243640(0x90)},{'optionKey':_0x243640(0x9b),'contextKey':_0x243640(0xa5)},{'optionKey':_0x243640(0xa9),'contextKey':'composable_audience'},{'optionKey':_0x243640(0x8c),'contextKey':_0x243640(0x8c)}];for(const {optionKey:_0x58fcb5,contextKey:_0x121573,defaultValue:_0x4363e7}of _0x5cee9d){const _0xd0043f=_0xba7a6e[_0x58fcb5];_0x4ba5a6(_0xd0043f,_0x121573,_0x4363e7)&&(_0x2d488f[_0x121573]=_0xd0043f);}this[_0x243640(0x85)]={'cliFlags':_0x2d488f,'session':_0x45cd54(_0x35963d),'project':_0x45cd54(_0x1608dc),'profile':_0x45cd54(_0x88785e?.['config']),'global':_0x45cd54(_0x51a823)};const _0x29fde9={...this[_0x243640(0x85)][_0x243640(0xc0)],...this[_0x243640(0x85)]['profile'],...this['layers'][_0x243640(0xcd)]};process.env.TDX_SITE&&!this[_0x243640(0x85)][_0x243640(0x7f)][_0x243640(0x97)]&&!this[_0x243640(0x85)][_0x243640(0x7e)]['site']&&(_0x29fde9[_0x243640(0x97)]=process.env.TDX_SITE);Object[_0x243640(0xb9)](_0x29fde9,this[_0x243640(0x85)][_0x243640(0x7f)]),Object[_0x243640(0xb9)](_0x29fde9,this['layers'][_0x243640(0x7e)]);const _0x32331d=_0x29fde9[_0x243640(0x97)]||_0x243640(0xa6);this['site']=resolveSite(_0x32331d),this[_0x243640(0x9d)]=_0x29fde9[_0x243640(0x9d)],this[_0x243640(0x86)]=_0x29fde9[_0x243640(0x86)],this[_0x243640(0xb7)]=_0x29fde9[_0x243640(0xb7)],this[_0x243640(0x90)]=_0x29fde9[_0x243640(0x90)],this[_0x243640(0xa5)]=_0x29fde9[_0x243640(0xa5)],this[_0x243640(0xc2)]=_0x29fde9['workflow_project'],this[_0x243640(0xba)]=_0x29fde9[_0x243640(0xba)],this[_0x243640(0x87)]=_0xba7a6e[_0x243640(0x87)]||![],this[_0x243640(0xcc)]=_0xba7a6e[_0x243640(0xcc)]??LogLevel[_0x243640(0x84)],this[_0x243640(0x8c)]=this[_0x243640(0xa0)]||undefined,this[_0x243640(0x89)]=getAccessToken(this['activeProfile']||undefined),this[_0x243640(0xa1)]=getAPIKey(this[_0x243640(0xa0)]||undefined);const _0x3ff33e=typeof _0x51a823['proxy']===_0x243640(0xb0)?_0x51a823[_0x243640(0x76)]:undefined;this[_0x243640(0x76)]=_0x3ff33e||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x12f5df=getConfigDir(),_0x43b9c1=a61_0x5eaffc['join'](_0x12f5df,_0x243640(0x98),this['sessionId']+_0x243640(0xad)),_0x3a5ab3=findProjectConfigPath(),_0x6d65=a61_0x5eaffc['join'](_0x12f5df,_0x243640(0x9f)),_0x2d60d4=a61_0x5eaffc[_0x243640(0xc4)](_0x12f5df,_0x243640(0x8b));let _0x561764=null,_0x58194a=null;this[_0x243640(0xa0)]&&(_0x561764=a61_0x5eaffc[_0x243640(0xc4)](_0x12f5df,'profiles',this[_0x243640(0xa0)],_0x243640(0x9f)),_0x58194a=a61_0x5eaffc[_0x243640(0xc4)](_0x12f5df,'profiles',this[_0x243640(0xa0)],_0x243640(0x8b))),this[_0x243640(0x78)]={'session':a61_0x1a1753['existsSync'](_0x43b9c1)?_0x43b9c1:null,'project':_0x3a5ab3,'profile':_0x561764&&a61_0x1a1753[_0x243640(0x81)](_0x561764)?_0x561764:null,'profileCredentials':_0x58194a&&a61_0x1a1753[_0x243640(0x81)](_0x58194a)?_0x58194a:null,'global':a61_0x1a1753[_0x243640(0x81)](_0x6d65)?_0x6d65:null,'globalCredentials':a61_0x1a1753[_0x243640(0x81)](_0x2d60d4)?_0x2d60d4:null};}[a61_0xa27371(0xa3)](_0xe22462,_0x57e191){const _0x5a016b=a61_0xa27371;if(!_0x57e191)return'not\x20set';const _0x583039=_0x57e191;if(this[_0x5a016b(0x85)][_0x5a016b(0x7e)][_0xe22462]===_0x583039){if(_0xe22462===_0x5a016b(0x97)&&_0x583039===_0x5a016b(0xa6)&&!this[_0x5a016b(0x85)][_0x5a016b(0x7f)][_0x5a016b(0x97)]&&!this[_0x5a016b(0x85)][_0x5a016b(0xcd)][_0x5a016b(0x97)]&&!this[_0x5a016b(0x85)][_0x5a016b(0x8c)][_0x5a016b(0x97)]&&!this[_0x5a016b(0x85)][_0x5a016b(0xc0)][_0x5a016b(0x97)])return _0x5a016b(0x8a);return _0x5a016b(0x7d)+_0xe22462[_0x5a016b(0x75)](/_/g,'-');}if(this['layers']['session'][_0xe22462]===_0x583039)return _0x5a016b(0x7f);if(this['layers'][_0x5a016b(0xcd)][_0xe22462]===_0x583039)return _0x5a016b(0xcd);if(this['layers'][_0x5a016b(0x8c)][_0xe22462]===_0x583039)return _0x5a016b(0x7c)+this['activeProfile'];if(this[_0x5a016b(0x85)][_0x5a016b(0xc0)][_0xe22462]===_0x583039)return _0x5a016b(0xc0);return'default';}['loadGlobalConfig'](){const _0x147197=a61_0xa27371,_0xc2825b=a61_0x5eaffc[_0x147197(0xc4)](getConfigDir(),'tdx.json');if(!a61_0x1a1753[_0x147197(0x81)](_0xc2825b))return{};try{const _0x342b85=a61_0x1a1753[_0x147197(0xa8)](_0xc2825b,_0x147197(0xab));return JSON[_0x147197(0x7b)](_0x342b85);}catch{return{};}}[a61_0xa27371(0x96)](_0x2d36a7){const _0x2c0ae5=a61_0xa27371;_0x2d36a7[_0x2c0ae5(0x97)]=this['site'],!_0x2d36a7[_0x2c0ae5(0x9d)]&&this[_0x2c0ae5(0x9d)]&&(_0x2d36a7[_0x2c0ae5(0x9d)]=this[_0x2c0ae5(0x9d)]),!_0x2d36a7[_0x2c0ae5(0xb2)]&&this[_0x2c0ae5(0x86)]&&(_0x2d36a7['parentSegment']=this[_0x2c0ae5(0x86)]),!_0x2d36a7[_0x2c0ae5(0xac)]&&this[_0x2c0ae5(0xb7)]&&(_0x2d36a7[_0x2c0ae5(0xac)]=this[_0x2c0ae5(0xb7)]),!_0x2d36a7['llmProject']&&this[_0x2c0ae5(0x90)]&&(_0x2d36a7['llmProject']=this[_0x2c0ae5(0x90)]),!_0x2d36a7[_0x2c0ae5(0x9b)]&&this[_0x2c0ae5(0xa5)]&&(_0x2d36a7[_0x2c0ae5(0x9b)]=this[_0x2c0ae5(0xa5)]),!_0x2d36a7['workflowProject']&&this['workflow_project']&&(_0x2d36a7[_0x2c0ae5(0xc3)]=this[_0x2c0ae5(0xc2)]),!_0x2d36a7[_0x2c0ae5(0xa9)]&&this[_0x2c0ae5(0xba)]&&(_0x2d36a7['composableAudience']=this[_0x2c0ae5(0xba)]);}[a61_0xa27371(0xa2)](){const _0x3c7e11=a61_0xa27371;return[{'key':_0x3c7e11(0x97),'value':this['site']},{'key':'database','value':this[_0x3c7e11(0x9d)]},{'key':_0x3c7e11(0x86),'value':this['parent_segment']},{'key':_0x3c7e11(0xb7),'value':this['segment_path']},{'key':_0x3c7e11(0x90),'value':this[_0x3c7e11(0x90)]},{'key':_0x3c7e11(0xa5),'value':this[_0x3c7e11(0xa5)]},{'key':_0x3c7e11(0xc2),'value':this[_0x3c7e11(0xc2)]},{'key':_0x3c7e11(0xba),'value':this['composable_audience']},{'key':_0x3c7e11(0x8c),'value':this[_0x3c7e11(0xa0)]||undefined}];}[a61_0xa27371(0x94)](){const _0x44f235=a61_0xa27371;console['log'](a61_0x5d2284[_0x44f235(0xbf)]('[context]'));for(const {key:_0x357906,value:_0x106ad3}of this[_0x44f235(0xa2)]()){_0x106ad3&&console[_0x44f235(0xb3)](a61_0x5d2284[_0x44f235(0xc9)](_0x357906)+':\x20'+_0x106ad3);}}[a61_0xa27371(0x88)](){const _0x4ec3cb=a61_0xa27371;console[_0x4ec3cb(0xb3)](a61_0x5d2284[_0x4ec3cb(0xbf)](_0x4ec3cb(0xca)));for(const {key:_0x564e17,value:_0x3c86fe}of this[_0x4ec3cb(0xa2)]()){if(_0x3c86fe){const _0x5d3c2e=_0x564e17===_0x4ec3cb(0x8c)?_0x4ec3cb(0x9e):'('+this[_0x4ec3cb(0xa3)](_0x564e17,_0x3c86fe)+')';console[_0x4ec3cb(0xb3)](a61_0x5d2284[_0x4ec3cb(0xc9)](_0x564e17)+':\x20'+_0x3c86fe+'\x20'+a61_0x5d2284[_0x4ec3cb(0x9c)](_0x5d3c2e));}}console[_0x4ec3cb(0xb3)]('\x0a'+a61_0x5d2284[_0x4ec3cb(0xbf)](_0x4ec3cb(0x7a)));const _0x5a8bcc=[{'label':_0x4ec3cb(0xb8),'path':this[_0x4ec3cb(0x78)]['session'],'extra':'(session:\x20'+this[_0x4ec3cb(0xaf)]+')'},{'label':'Project','path':this[_0x4ec3cb(0x78)][_0x4ec3cb(0xcd)]},{'label':'Profile','path':this[_0x4ec3cb(0x78)]['profile']},{'label':_0x4ec3cb(0x83),'path':this['configFiles'][_0x4ec3cb(0xbc)]},{'label':_0x4ec3cb(0x91),'path':this[_0x4ec3cb(0x78)][_0x4ec3cb(0xc0)]},{'label':_0x4ec3cb(0x92),'path':this[_0x4ec3cb(0x78)][_0x4ec3cb(0xc8)]}];for(const {label:_0x153832,path:_0x488a92,extra:_0x589ba9}of _0x5a8bcc){if(_0x488a92)console['log'](a61_0x5d2284[_0x4ec3cb(0xc9)](_0x153832)+':\x20'+_0x488a92+'\x20'+a61_0x5d2284[_0x4ec3cb(0xc7)]('✓')+(_0x589ba9?'\x20'+a61_0x5d2284['dim'](_0x589ba9):''));else{if(_0x153832===_0x4ec3cb(0xb8))console[_0x4ec3cb(0xb3)](a61_0x5d2284['cyan'](_0x153832)+':\x20'+a61_0x5d2284[_0x4ec3cb(0x9c)](_0x4ec3cb(0xb5))+'\x20'+a61_0x5d2284[_0x4ec3cb(0x9c)](_0x4ec3cb(0xc5)+this[_0x4ec3cb(0xaf)]+')'));else(_0x153832===_0x4ec3cb(0x8d)||_0x153832===_0x4ec3cb(0x91))&&console[_0x4ec3cb(0xb3)](a61_0x5d2284[_0x4ec3cb(0xc9)](_0x153832)+':\x20'+a61_0x5d2284['dim'](_0x4ec3cb(0xb5)));}}}async[a61_0xa27371(0xa4)](){const _0x3dcc81=a61_0xa27371;if(!this[_0x3dcc81(0x89)]){const _0x4d11dd=await getOAuthTokens(this[_0x3dcc81(0xa0)]||undefined);if(_0x4d11dd){const _0x440a26=0x5*0x3c*0x3e8,_0x13eff2=!_0x4d11dd[_0x3dcc81(0xaa)]||_0x4d11dd[_0x3dcc81(0xaa)]<Date['now']()+_0x440a26;if(_0x13eff2&&_0x4d11dd[_0x3dcc81(0xc1)])try{const _0x403b85=getConsoleUrl(this['site']),_0x45bbdc=await refreshAccessToken(_0x403b85,_0x4d11dd[_0x3dcc81(0xc1)]);await saveOAuthTokens(_0x45bbdc,this[_0x3dcc81(0xa0)]||undefined),this['accessToken']=_0x45bbdc[_0x3dcc81(0xbd)];}catch{this[_0x3dcc81(0x89)]=_0x4d11dd[_0x3dcc81(0xbd)];}else this[_0x3dcc81(0x89)]=_0x4d11dd[_0x3dcc81(0xbd)];return undefined;}}return this['apiKey']=await getAPIKeyAsync(this[_0x3dcc81(0x97)],this[_0x3dcc81(0xa0)]||undefined),this[_0x3dcc81(0xa1)];}static async[a61_0xa27371(0xc6)](_0x3fd792){const _0x1f01f2=a61_0xa27371,_0x1f9979=new GlobalContext(_0x3fd792);return await _0x1f9979[_0x1f01f2(0xa4)](),_0x1f9979;}}function a61_0x4b98(){const _0x335dc1=['activeProfile','apiKey','getParameters','getSource','resolveAPIKeyAsync','llm_agent','us01','llmProject','readFileSync','composableAudience','expires_at','utf-8','segmentPath','.json','24hUpAPP','sessionId','string','config','parentSegment','log','97442GdpUKE','none','profileSource','segment_path','Session','assign','composable_audience','547270ciySXj','profileCredentials','access_token','loadGlobalConfig','bold','global','refresh_token','workflow_project','workflowProject','join','(using\x20session:\x20','createAsync','green','globalCredentials','cyan','[context]','entries','logLevel','project','replace','proxy','1erbXtT','configFiles','259206fYPofV','[configuration\x20files]','parse','profile:\x20','CLI\x20flag:\x20--','cliFlags','session','cli','existsSync','16zwCVsQ','Profile\x20Credentials','INFO','layers','parent_segment','verbose','displayWithSources','accessToken','default','.env','profile','Project','2000763PtUBoS','737233oCCkCb','llm_project','Global','Global\x20Credentials','818208NFygWT','display','10ucQgLA','injectIntoOptions','site','sessions','2585385VbQDJt','18DYITJR','llmAgent','dim','database','(active)','tdx.json'];a61_0x4b98=function(){return _0x335dc1;};return a61_0x4b98();}
@@ -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_0x1e7027=a62_0x4820;(function(_0x4bc64a,_0x5a86c6){const _0xb21567=a62_0x4820,_0x55da2c=_0x4bc64a();while(!![]){try{const _0x4f49ec=-parseInt(_0xb21567(0x93))/0x1+-parseInt(_0xb21567(0x86))/0x2+parseInt(_0xb21567(0x90))/0x3+parseInt(_0xb21567(0x8a))/0x4+parseInt(_0xb21567(0x99))/0x5+parseInt(_0xb21567(0x83))/0x6+-parseInt(_0xb21567(0x7d))/0x7*(parseInt(_0xb21567(0x80))/0x8);if(_0x4f49ec===_0x5a86c6)break;else _0x55da2c['push'](_0x55da2c['shift']());}catch(_0xcdb2f7){_0x55da2c['push'](_0x55da2c['shift']());}}}(a62_0x4e2f,0x9ecfe));const SERVICE_NAME=a62_0x1e7027(0x7f);function a62_0x4e2f(){const _0x4afa17=['8FHWyzL','-25300',':api_key','7322790tNFmXz','@napi-rs/keyring','error','1158958BRdLjB','value','unavailable','includes','4443288CJniyx','access','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.','success','toLowerCase','System\x20keychain\x20is\x20not\x20available','1194456QydJcm','message','deleteCredential','1162396FvvRAR','could\x20not\x20be\x20found','Warning:\x20','not\x20supported','profile:','not\x20found','2536135NrTPuE','__keychain_test__','getPassword','5910079PmsltQ','access_denied','tdx'];a62_0x4e2f=function(){return _0x4afa17;};return a62_0x4e2f();}let EntryClass=null,keyringLoadError=null;function a62_0x4820(_0x3d330d,_0x3ce117){_0x3d330d=_0x3d330d-0x7d;const _0x4e2f9e=a62_0x4e2f();let _0x48208e=_0x4e2f9e[_0x3d330d];return _0x48208e;}async function getEntryClass(){const _0x1eafbd=a62_0x1e7027;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x4fa66f=await import(_0x1eafbd(0x84));return EntryClass=_0x4fa66f['Entry'],EntryClass;}catch(_0x3f3449){return keyringLoadError=_0x3f3449 instanceof Error?_0x3f3449:new Error(String(_0x3f3449)),null;}}function getAccountName(_0x449386){const _0x4cbef8=a62_0x1e7027,_0xef3ac2=_0x449386||'';return _0x4cbef8(0x97)+_0xef3ac2+_0x4cbef8(0x82);}export async function getKeychainAPIKey(_0x31d26b){const _0x6850a6=a62_0x1e7027,_0x20c3c2=await getKeychainAPIKeyWithStatus(_0x31d26b);if(_0x20c3c2[_0x6850a6(0x8d)])return _0x20c3c2[_0x6850a6(0x87)];return _0x20c3c2['reason']===_0x6850a6(0x7e)&&console[_0x6850a6(0x85)](_0x6850a6(0x95)+_0x20c3c2[_0x6850a6(0x91)]),null;}export async function getKeychainAPIKeyWithStatus(_0x3652be){const _0x1ac98d=a62_0x1e7027;try{const _0xcd882a=await getEntryClass();if(!_0xcd882a)return{'success':![],'reason':'unavailable'};const _0x6d8a23=getAccountName(_0x3652be),_0xe5aa2c=new _0xcd882a(SERVICE_NAME,_0x6d8a23),_0x1c6b0e=_0xe5aa2c['getPassword']();if(_0x1c6b0e)return{'success':!![],'value':_0x1c6b0e};return{'success':![],'reason':'not_found'};}catch(_0x2c8fc3){const _0x3a17bb=_0x2c8fc3 instanceof Error?_0x2c8fc3[_0x1ac98d(0x91)]:String(_0x2c8fc3);if(_0x3a17bb[_0x1ac98d(0x89)](_0x1ac98d(0x81))||_0x3a17bb[_0x1ac98d(0x8e)]()[_0x1ac98d(0x89)](_0x1ac98d(0x94))||_0x3a17bb[_0x1ac98d(0x8e)]()[_0x1ac98d(0x89)](_0x1ac98d(0x98))||_0x3a17bb[_0x1ac98d(0x8e)]()[_0x1ac98d(0x89)]('no\x20matching\x20entry'))return{'success':![],'reason':'not_found'};if(_0x3a17bb[_0x1ac98d(0x89)]('-25293')||_0x3a17bb[_0x1ac98d(0x8e)]()['includes']('restricted')||_0x3a17bb[_0x1ac98d(0x8e)]()[_0x1ac98d(0x89)](_0x1ac98d(0x8b)))return{'success':![],'reason':_0x1ac98d(0x7e),'message':_0x1ac98d(0x8c)};return{'success':![],'reason':_0x1ac98d(0x88),'message':_0x3a17bb};}}export async function saveKeychainAPIKey(_0x2d312e,_0x47b2ca){const _0x4c3958=a62_0x1e7027,_0x5b7b96=await getEntryClass();if(!_0x5b7b96)throw new Error(_0x4c3958(0x8f));const _0x3a275a=getAccountName(_0x47b2ca),_0x223eae=new _0x5b7b96(SERVICE_NAME,_0x3a275a);_0x223eae['setPassword'](_0x2d312e);}export async function deleteKeychainAPIKey(_0x4a9db9){const _0x293733=a62_0x1e7027;try{const _0x34932d=await getEntryClass();if(!_0x34932d)return![];const _0x384f62=getAccountName(_0x4a9db9),_0x3d5351=new _0x34932d(SERVICE_NAME,_0x384f62);return _0x3d5351[_0x293733(0x92)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x3dd301=a62_0x1e7027;try{const _0x263d7c=await getEntryClass();if(!_0x263d7c)return![];const _0x39f8b8=new _0x263d7c(SERVICE_NAME,_0x3dd301(0x9a));return _0x39f8b8[_0x3dd301(0x9b)](),!![];}catch(_0x31f3f1){const _0x2e0330=_0x31f3f1 instanceof Error?_0x31f3f1[_0x3dd301(0x91)]['toLowerCase']():'';if(_0x2e0330[_0x3dd301(0x89)]('not\x20available')||_0x2e0330[_0x3dd301(0x89)](_0x3dd301(0x96))||_0x2e0330[_0x3dd301(0x89)]('cannot\x20find'))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_0x11371d=a63_0x2cc7;function a63_0x5daf(){const _0x1f47bc=['478110ifyjmD','1849377jhOKmB','4JgXMUk','@napi-rs/keyring','getPassword','6vtyjlt','profile:','tdx','setPassword','17830LgRTJN','System\x20keychain\x20is\x20not\x20available','1562463xoYZql','6150053xwPTPL','2355305sUASKF','916400MizjkG','deleteCredential'];a63_0x5daf=function(){return _0x1f47bc;};return a63_0x5daf();}(function(_0x38a68d,_0x2713bb){const _0x34d034=a63_0x2cc7,_0x213ef0=_0x38a68d();while(!![]){try{const _0xcbab0f=-parseInt(_0x34d034(0x9c))/0x1+parseInt(_0x34d034(0xa5))/0x2+parseInt(_0x34d034(0x9d))/0x3*(parseInt(_0x34d034(0x9e))/0x4)+-parseInt(_0x34d034(0xa9))/0x5+-parseInt(_0x34d034(0xa1))/0x6*(-parseInt(_0x34d034(0xa8))/0x7)+parseInt(_0x34d034(0x9a))/0x8+-parseInt(_0x34d034(0xa7))/0x9;if(_0xcbab0f===_0x2713bb)break;else _0x213ef0['push'](_0x213ef0['shift']());}catch(_0x378d8b){_0x213ef0['push'](_0x213ef0['shift']());}}}(a63_0x5daf,0x7906d));function a63_0x2cc7(_0x4eb48e,_0x4cfab8){_0x4eb48e=_0x4eb48e-0x9a;const _0x5dafe9=a63_0x5daf();let _0x2cc78c=_0x5dafe9[_0x4eb48e];return _0x2cc78c;}const SERVICE_NAME=a63_0x11371d(0xa3);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x2388ed=a63_0x11371d;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x5446b6=await import(_0x2388ed(0x9f));return EntryClass=_0x5446b6['Entry'],EntryClass;}catch(_0x2d5ab5){return keyringLoadError=_0x2d5ab5 instanceof Error?_0x2d5ab5:new Error(String(_0x2d5ab5)),null;}}function getOAuthAccountName(_0x5c9ff7){const _0x5dc96a=a63_0x11371d,_0x592fa8=_0x5c9ff7||'';return _0x5dc96a(0xa2)+_0x592fa8+':oauth_tokens';}export async function saveOAuthTokens(_0x5a4c24,_0x4edcdf){const _0x53261e=a63_0x11371d,_0x375aa0=await getEntryClass();if(!_0x375aa0)throw new Error(_0x53261e(0xa6));const _0x4e732=getOAuthAccountName(_0x4edcdf),_0x50e543=new _0x375aa0(SERVICE_NAME,_0x4e732);_0x50e543[_0x53261e(0xa4)](JSON['stringify'](_0x5a4c24));}export async function getOAuthTokens(_0x4f4687){const _0x439805=a63_0x11371d;try{const _0x1c7afc=await getEntryClass();if(!_0x1c7afc)return null;const _0x208afb=getOAuthAccountName(_0x4f4687),_0x2103f2=new _0x1c7afc(SERVICE_NAME,_0x208afb),_0x3ad94f=_0x2103f2[_0x439805(0xa0)]();if(_0x3ad94f)return JSON['parse'](_0x3ad94f);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x3618ca){const _0x1d67f3=a63_0x11371d;try{const _0x309c85=await getEntryClass();if(!_0x309c85)return![];const _0x31abb0=getOAuthAccountName(_0x3618ca),_0x4478b0=new _0x309c85(SERVICE_NAME,_0x31abb0);return _0x4478b0[_0x1d67f3(0x9b)](),!![];}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_0xb08823=a64_0x1a24;function a64_0x3b1d(){const _0x2a1a37=['redirect_uri','close','3519894qxHZNY','url','end','text/html','):\x20','5BZkdqQ','codeChallenge','Not\x20Found','650402IcTkpS','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','listen','expires_in','S256','application/x-www-form-urlencoded','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','text','http://127.0.0.1','account_name','toString','/users/initiate_sso','access_token','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','redirectUri','authorization_code','4064zOmYbO','base64url','sha256','scope','EADDRINUSE','error','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','status','randomBytes','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','hex','OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack','code_challenge_method','createServer','searchParams','3353274pFpPxi','response_type','tdx','POST','3937424lJsnsn','6KZECtc','pathname','waitForCallback','code_challenge','/oauth/callback','writeHead','Port\x20','digest','1070261vOvsUT','accountName','code','get','http://localhost:','createHash','redirect_to_path','/oauth/authorize','update','text/plain','clientId','state','set','openid\x20email\x20profile','2762052NJalFn','OAuth\x20token\x20request\x20failed\x20('];a64_0x3b1d=function(){return _0x2a1a37;};return a64_0x3b1d();}(function(_0x44a5c9,_0x15e106){const _0x143a72=a64_0x1a24,_0x2cf767=_0x44a5c9();while(!![]){try{const _0x512344=-parseInt(_0x143a72(0x1b3))/0x1+parseInt(_0x143a72(0x1cd))/0x2+parseInt(_0x143a72(0x1c1))/0x3+-parseInt(_0x143a72(0x1dd))/0x4*(-parseInt(_0x143a72(0x1ca))/0x5)+parseInt(_0x143a72(0x1f2))/0x6*(parseInt(_0x143a72(0x1c5))/0x7)+-parseInt(_0x143a72(0x1f1))/0x8+parseInt(_0x143a72(0x1ed))/0x9;if(_0x512344===_0x15e106)break;else _0x2cf767['push'](_0x2cf767['shift']());}catch(_0x4dc3e5){_0x2cf767['push'](_0x2cf767['shift']());}}}(a64_0x3b1d,0x88b12));import*as a64_0x352fc5 from'node:crypto';import*as a64_0x1b83eb from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';export const OAUTH_CALLBACK_PORT=0xaa4a;function a64_0x1a24(_0x55d1b7,_0x4ac9e2){_0x55d1b7=_0x55d1b7-0x1ad;const _0x3b1d85=a64_0x3b1d();let _0x1a246f=_0x3b1d85[_0x55d1b7];return _0x1a246f;}export const OAUTH_REDIRECT_URI=a64_0xb08823(0x1b7)+OAUTH_CALLBACK_PORT+a64_0xb08823(0x1af);export function getOAuthClientId(){const _0x43d259=a64_0xb08823;return process.env.TD_OAUTH_CLIENT_ID||_0x43d259(0x1ef);}export function generatePKCEPair(){const _0x9a628b=a64_0xb08823,_0x3ee92a=a64_0x352fc5[_0x9a628b(0x1e5)](0x20)[_0x9a628b(0x1d7)](_0x9a628b(0x1de)),_0x10eb8c=a64_0x352fc5[_0x9a628b(0x1b8)](_0x9a628b(0x1df))[_0x9a628b(0x1bb)](_0x3ee92a)[_0x9a628b(0x1b2)](_0x9a628b(0x1de));return{'verifier':_0x3ee92a,'challenge':_0x10eb8c};}export function buildAuthorizeURL(_0x384cae,_0x113ebb){const _0x29ea63=a64_0xb08823,_0x4411ae=new URL(_0x29ea63(0x1ba),_0x384cae);return _0x4411ae[_0x29ea63(0x1ec)]['set'](_0x29ea63(0x1ee),_0x29ea63(0x1b5)),_0x4411ae[_0x29ea63(0x1ec)]['set']('client_id',_0x113ebb[_0x29ea63(0x1bd)]),_0x4411ae[_0x29ea63(0x1ec)][_0x29ea63(0x1bf)](_0x29ea63(0x1c3),_0x113ebb[_0x29ea63(0x1db)]),_0x4411ae['searchParams'][_0x29ea63(0x1bf)](_0x29ea63(0x1be),_0x113ebb['state']),_0x4411ae[_0x29ea63(0x1ec)][_0x29ea63(0x1bf)](_0x29ea63(0x1ae),_0x113ebb[_0x29ea63(0x1cb)]),_0x4411ae['searchParams']['set'](_0x29ea63(0x1ea),_0x29ea63(0x1d1)),_0x113ebb[_0x29ea63(0x1e0)]&&_0x4411ae[_0x29ea63(0x1ec)][_0x29ea63(0x1bf)](_0x29ea63(0x1e0),_0x113ebb['scope']),_0x4411ae[_0x29ea63(0x1d7)]();}export function buildSSOInitiateURL(_0x17500a,_0x2fe755,_0x4b26f6){const _0x2bdf18=a64_0xb08823,_0x3592b6=new URL(_0x2bdf18(0x1d8),_0x17500a);_0x3592b6[_0x2bdf18(0x1ec)][_0x2bdf18(0x1bf)](_0x2bdf18(0x1d6),_0x2fe755);const _0x4b1de6=_0x4b26f6['replace'](_0x17500a,'');return _0x3592b6[_0x2bdf18(0x1ec)]['set'](_0x2bdf18(0x1b9),_0x4b1de6),_0x3592b6[_0x2bdf18(0x1d7)]();}export async function postTokenRequest(_0x37419d,_0x5d35e2){const _0xef9289=a64_0xb08823,_0x2f5de2=new URLSearchParams(_0x5d35e2)[_0xef9289(0x1d7)](),_0x2744ca=await fetch(_0x37419d,{'method':_0xef9289(0x1f0),'headers':{'Content-Type':_0xef9289(0x1d2)},'body':_0x2f5de2});if(!_0x2744ca['ok']){const _0x54a000=await _0x2744ca[_0xef9289(0x1d4)]();throw new Error(_0xef9289(0x1c2)+_0x2744ca[_0xef9289(0x1e4)]+_0xef9289(0x1c9)+_0x54a000);}const _0x2b3223=await _0x2744ca['json']();return{'access_token':_0x2b3223[_0xef9289(0x1d9)],'refresh_token':_0x2b3223['refresh_token'],'scope':_0x2b3223[_0xef9289(0x1e0)],'expires_at':_0x2b3223[_0xef9289(0x1d0)]?Date['now']()+_0x2b3223[_0xef9289(0x1d0)]*0x3e8:undefined};}export async function exchangeCodeForTokens(_0x445ac9,_0x2a7a7d,_0x5ea4ab,_0x5704f1){const _0xc19d8d=a64_0xb08823,_0x4bae27=_0x445ac9+'/oauth/token';return postTokenRequest(_0x4bae27,{'grant_type':_0xc19d8d(0x1dc),'client_id':getOAuthClientId(),'code':_0x2a7a7d,'code_verifier':_0x5ea4ab,'redirect_uri':_0x5704f1});}export function startLocalCallbackServer(){const _0x340327=a64_0xb08823;let _0x4a429e,_0x35cf4c;const _0x29258a=new Promise((_0x2e786b,_0x30d258)=>{_0x4a429e=_0x2e786b,_0x35cf4c=_0x30d258;}),_0x54e4ca=a64_0x1b83eb[_0x340327(0x1eb)]((_0x235dbe,_0x4f711e)=>{const _0x1523ee=_0x340327,_0x525a04=new URL(_0x235dbe[_0x1523ee(0x1c6)]||'/',_0x1523ee(0x1d5));if(_0x525a04[_0x1523ee(0x1f3)]!=='/oauth/callback'){_0x4f711e['writeHead'](0x194,{'Content-Type':_0x1523ee(0x1bc)}),_0x4f711e[_0x1523ee(0x1c7)](_0x1523ee(0x1cc));return;}const _0x5aa780=_0x525a04[_0x1523ee(0x1ec)][_0x1523ee(0x1b6)](_0x1523ee(0x1b5)),_0x86f0d3=_0x525a04[_0x1523ee(0x1ec)]['get'](_0x1523ee(0x1be)),_0x3b4b8e=_0x525a04[_0x1523ee(0x1ec)][_0x1523ee(0x1b6)](_0x1523ee(0x1e2));if(_0x3b4b8e||!_0x5aa780||!_0x86f0d3){_0x4f711e[_0x1523ee(0x1b0)](0x190,{'Content-Type':_0x1523ee(0x1c8)}),_0x4f711e[_0x1523ee(0x1c7)](_0x1523ee(0x1e3)),_0x35cf4c(new Error(_0x1523ee(0x1ce)));return;}_0x4f711e[_0x1523ee(0x1b0)](0xc8,{'Content-Type':_0x1523ee(0x1c8)}),_0x4f711e['end'](_0x1523ee(0x1d3)),_0x4a429e({'code':_0x5aa780,'state':_0x86f0d3});});_0x54e4ca['on'](_0x340327(0x1e2),_0x1a5a4d=>{const _0x4818f2=_0x340327;_0x1a5a4d['code']===_0x4818f2(0x1e1)?_0x35cf4c(new Error(_0x4818f2(0x1b1)+OAUTH_CALLBACK_PORT+_0x4818f2(0x1da))):_0x35cf4c(new Error(_0x4818f2(0x1e6)+_0x1a5a4d['message']));}),_0x54e4ca[_0x340327(0x1cf)](OAUTH_CALLBACK_PORT,'127.0.0.1');const _0x5f5a4e=setTimeout(()=>{const _0x40e064=_0x340327;_0x35cf4c(new Error(_0x40e064(0x1e7))),_0x54e4ca[_0x40e064(0x1c4)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x29258a,'close':()=>{const _0x22d7c9=_0x340327;clearTimeout(_0x5f5a4e),_0x54e4ca[_0x22d7c9(0x1c4)]();}};}export async function startOAuthFlow(_0x1ea216,_0x5dfbfa){const _0xe31503=a64_0xb08823,_0x2997e7=getConsoleUrl(_0x1ea216),_0xeb98b6=getOAuthClientId(),{verifier:_0x2e4a6c,challenge:_0x59f6ac}=generatePKCEPair(),_0xed8fce=a64_0x352fc5['randomBytes'](0x10)[_0xe31503(0x1d7)](_0xe31503(0x1e8)),_0x551a20=startLocalCallbackServer();try{const _0x3c2eb4=OAUTH_REDIRECT_URI,_0x2243d3=buildAuthorizeURL(_0x2997e7,{'clientId':_0xeb98b6,'redirectUri':_0x3c2eb4,'state':_0xed8fce,'codeChallenge':_0x59f6ac,'scope':_0xe31503(0x1c0)}),_0xbf4f3d=_0x5dfbfa?.[_0xe31503(0x1b4)]?buildSSOInitiateURL(_0x2997e7,_0x5dfbfa['accountName'],_0x2243d3):_0x2243d3;openBrowser(_0xbf4f3d);const _0x5c1ffc=await _0x551a20[_0xe31503(0x1ad)]();if(_0x5c1ffc[_0xe31503(0x1be)]!==_0xed8fce)throw new Error(_0xe31503(0x1e9));return await exchangeCodeForTokens(_0x2997e7,_0x5c1ffc[_0xe31503(0x1b5)],_0x2e4a6c,_0x3c2eb4);}finally{_0x551a20[_0xe31503(0x1c4)]();}}
@@ -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_0x3315a5=a65_0x13f2;(function(_0x11b603,_0x4991f8){const _0x45ac87=a65_0x13f2,_0x149bf4=_0x11b603();while(!![]){try{const _0x2fed73=parseInt(_0x45ac87(0x13d))/0x1+parseInt(_0x45ac87(0x12b))/0x2*(-parseInt(_0x45ac87(0x119))/0x3)+-parseInt(_0x45ac87(0x132))/0x4*(parseInt(_0x45ac87(0x126))/0x5)+-parseInt(_0x45ac87(0x11f))/0x6+-parseInt(_0x45ac87(0x13e))/0x7+parseInt(_0x45ac87(0x125))/0x8+parseInt(_0x45ac87(0x116))/0x9*(parseInt(_0x45ac87(0xfd))/0xa);if(_0x2fed73===_0x4991f8)break;else _0x149bf4['push'](_0x149bf4['shift']());}catch(_0x50362b){_0x149bf4['push'](_0x149bf4['shift']());}}}(a65_0x5487,0xeef16));import*as a65_0x1919df from'node:fs';import*as a65_0x18aeea from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME=a65_0x3315a5(0x102);function a65_0x5487(){const _0x14d361=['tdx.json','set','test','object','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','4ZUVoFc','find','keys','\x20already\x20exists','\x0aWarning:\x20Failed\x20to\x20parse\x20','has','name','toISOString','join','filter','llm_agent','899357vdAIPc','5034890vLBVCs','\x27\x20not\x20found\x20in\x20user\x20configuration','user_info','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','description','.env','sort','push','some','message','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','profile','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','existsSync','readdirSync','10fpTNmw','Invalid\x20profile\x20name:\x20','database','Profile\x20','warn','@tdx-studio','site','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)',',\x20creating\x20new\x20file','Warning:\x20Failed\x20to\x20parse\x20','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','To\x20migrate:','\x20\x201.\x20Edit:\x20','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','\x20does\x20not\x20exist','parent_segment','INVALID_PROFILE_CONFIG','parse','stringify','local','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','from','localeCompare','\x27:\x20unknown\x20config\x20key\x20\x27','22690413viDQPY','directory','values','183kpHQBA','string','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','\x27\x20will\x20be\x20ignored','readFileSync',':\x20Invalid\x20JSON\x20syntax','11692254HjCjNq','profiles','.env.','entries','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','Profile\x20\x27','9464928fBeGlk','2840940sPQVcq','map','\x27:\x20config\x20must\x20be\x20an\x20object','llm_project','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','12746iDVyVa','utf-8'];a65_0x5487=function(){return _0x14d361;};return a65_0x5487();}export function getProfileParams(_0x1e4394){const _0xd21e26=a65_0x3315a5,_0x22f910={};if(!_0x1e4394)return _0x22f910;for(const [_0x2b5a50,_0x174f06]of Object[_0xd21e26(0x122)](_0x1e4394)){_0x2b5a50!=='description'&&_0x174f06!==undefined&&(_0x22f910[_0x2b5a50]=_0x174f06);}return _0x22f910;}export function getProfilesDir(){const _0x14aad9=a65_0x3315a5;return a65_0x18aeea['join'](getConfigDir(),_0x14aad9(0x120));}function getProfileDir(_0x59bcd0){const _0x3ad3fe=a65_0x3315a5;return a65_0x18aeea[_0x3ad3fe(0x13a)](getProfilesDir(),_0x59bcd0);}function getProfileConfigPath(_0x4de976){const _0x399135=a65_0x3315a5;return a65_0x18aeea[_0x399135(0x13a)](getProfileDir(_0x4de976),_0x399135(0x12d));}function getProfileEnvPath(_0x9f522c){const _0xec3a8b=a65_0x3315a5;return a65_0x18aeea['join'](getProfileDir(_0x9f522c),_0xec3a8b(0x143));}function getGlobalConfigPath(){const _0x523362=a65_0x3315a5;return a65_0x18aeea[_0x523362(0x13a)](getConfigDir(),'tdx.json');}function validateProfileName(_0x51532b){const _0x1aeeb4=a65_0x3315a5;if(/^@?[a-zA-Z0-9_-]+$/[_0x1aeeb4(0x12f)](_0x51532b))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/['test'](_0x51532b))return;throw new Error(_0x1aeeb4(0xfe)+_0x51532b+_0x1aeeb4(0x104));}function validateProfileConfig(_0x1a3beb,_0x2bd1fb){const _0x4219b1=a65_0x3315a5;if(typeof _0x1a3beb!==_0x4219b1(0x130)||_0x1a3beb===null)throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x2bd1fb+_0x4219b1(0x128));const _0x6c22b6=[_0x4219b1(0x142),_0x4219b1(0x103),'database','parent_segment',_0x4219b1(0x129),_0x4219b1(0x13c),_0x4219b1(0x140)],_0x581f5c=_0x1a3beb;for(const _0x40a72d of Object[_0x4219b1(0x134)](_0x581f5c)){!_0x6c22b6['includes'](_0x40a72d)&&console[_0x4219b1(0x101)]('Warning:\x20Profile\x20\x27'+_0x2bd1fb+_0x4219b1(0x115)+_0x40a72d+_0x4219b1(0x11c));}if(_0x581f5c[_0x4219b1(0x142)]!==undefined&&typeof _0x581f5c['description']!==_0x4219b1(0x11a))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x2bd1fb+_0x4219b1(0x11b));if(_0x581f5c[_0x4219b1(0x103)]!==undefined&&typeof _0x581f5c[_0x4219b1(0x103)]!==_0x4219b1(0x11a))throw new SDKError(ErrorCode[_0x4219b1(0x10e)],_0x4219b1(0x124)+_0x2bd1fb+_0x4219b1(0xf8));if(_0x581f5c['database']!==undefined&&typeof _0x581f5c[_0x4219b1(0xff)]!==_0x4219b1(0x11a))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x4219b1(0x124)+_0x2bd1fb+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x581f5c[_0x4219b1(0x10d)]!==undefined&&typeof _0x581f5c[_0x4219b1(0x10d)]!=='string')throw new SDKError(ErrorCode[_0x4219b1(0x10e)],_0x4219b1(0x124)+_0x2bd1fb+_0x4219b1(0x141));if(_0x581f5c[_0x4219b1(0x129)]!==undefined&&typeof _0x581f5c[_0x4219b1(0x129)]!==_0x4219b1(0x11a))throw new SDKError(ErrorCode[_0x4219b1(0x10e)],_0x4219b1(0x124)+_0x2bd1fb+_0x4219b1(0x131));if(_0x581f5c[_0x4219b1(0x13c)]!==undefined&&typeof _0x581f5c[_0x4219b1(0x13c)]!=='string')throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x4219b1(0x124)+_0x2bd1fb+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x10e617,_0x4e7f7e){const _0xeedd4b=a65_0x3315a5;if(!a65_0x1919df['existsSync'](_0x10e617))return[];try{const _0xe3bd95=a65_0x1919df[_0xeedd4b(0x11d)](_0x10e617,_0xeedd4b(0x12c)),_0x3e5c97=JSON['parse'](_0xe3bd95);if(!_0x3e5c97[_0xeedd4b(0x120)]||typeof _0x3e5c97[_0xeedd4b(0x120)]!==_0xeedd4b(0x130))return[];const _0x4a54c2=[];for(const [_0x52f4a1,_0x12a912]of Object[_0xeedd4b(0x122)](_0x3e5c97[_0xeedd4b(0x120)])){try{validateProfileConfig(_0x12a912,_0x52f4a1);const _0x4a1e8b=getNewCredentialPath(_0x52f4a1),_0x286c8a=getOldCredentialPath(_0x52f4a1),_0x138f46=a65_0x1919df[_0xeedd4b(0xfb)](_0x4a1e8b)||a65_0x1919df[_0xeedd4b(0xfb)](_0x286c8a);_0x4a54c2['push']({'name':_0x52f4a1,'config':_0x12a912,'metadata':{'name':_0x52f4a1,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x138f46,'scope':_0x4e7f7e});}catch(_0x2ad8bf){_0x2ad8bf instanceof Error&&(console[_0xeedd4b(0x101)](_0xeedd4b(0xfa)+_0x10e617+':'),console[_0xeedd4b(0x101)]('\x20\x20'+_0x2ad8bf[_0xeedd4b(0xf7)]+'\x0a'));}}return _0x4a54c2;}catch(_0x27dee0){return _0x27dee0 instanceof SyntaxError?(console['warn'](_0xeedd4b(0x136)+_0x10e617+_0xeedd4b(0x11e)),console[_0xeedd4b(0x101)]('Error:\x20'+_0x27dee0[_0xeedd4b(0xf7)]+'\x0a')):console[_0xeedd4b(0x101)](_0xeedd4b(0x10b)+_0x10e617+':\x20'+_0x27dee0+'\x0a'),[];}}export function getNewCredentialPath(_0x28227a){const _0x295d9e=a65_0x3315a5;return a65_0x18aeea[_0x295d9e(0x13a)](getConfigDir(),_0x295d9e(0x121)+_0x28227a);}function a65_0x13f2(_0x23dd34,_0xf3ba9e){_0x23dd34=_0x23dd34-0xf5;const _0x548715=a65_0x5487();let _0x13f22b=_0x548715[_0x23dd34];return _0x13f22b;}function getOldCredentialPath(_0x2dab8b){const _0x52da88=a65_0x3315a5;return a65_0x18aeea[_0x52da88(0x13a)](getProfilesDir(),_0x2dab8b,_0x52da88(0x143));}function loadProfilesFromTdxJsonFiles(){const _0x18c3c9=a65_0x3315a5,_0x4810e0=[],_0x29f23d=findProjectConfigPath();_0x29f23d&&_0x4810e0[_0x18c3c9(0xf5)](...loadProfilesFromTdxJson(_0x29f23d,_0x18c3c9(0x111)));const _0x2de0c3=a65_0x18aeea[_0x18c3c9(0x13a)](getConfigDir(),_0x18c3c9(0x12d));return _0x4810e0['push'](...loadProfilesFromTdxJson(_0x2de0c3,'user')),_0x4810e0;}function loadProfilesFromDirectories(){const _0x1c4f73=a65_0x3315a5,_0x42ee30=getProfilesDir();if(!a65_0x1919df[_0x1c4f73(0xfb)](_0x42ee30))return[];try{return a65_0x1919df[_0x1c4f73(0xfc)](_0x42ee30,{'withFileTypes':!![]})[_0x1c4f73(0x13b)](_0x34a63b=>_0x34a63b['isDirectory']())['map'](_0x204101=>_0x204101['name'])[_0x1c4f73(0x13b)](_0x122255=>{const _0x577ff0=_0x1c4f73,_0x49eda7=getProfileConfigPath(_0x122255),_0x33dad0=getProfileEnvPath(_0x122255);return a65_0x1919df[_0x577ff0(0xfb)](_0x49eda7)||a65_0x1919df['existsSync'](_0x33dad0);})[_0x1c4f73(0x127)](_0x3ed11e=>{const _0x468898=loadProfileFromDirectory(_0x3ed11e);if(_0x468898)return{..._0x468898,'scope':'directory'};return null;})[_0x1c4f73(0x13b)](_0x2e0322=>_0x2e0322!==null);}catch{return[];}}function loadProfileFromDirectory(_0x128c1c){const _0x540138=a65_0x3315a5,_0x46de94=getProfileConfigPath(_0x128c1c),_0x18cbb2=getOldCredentialPath(_0x128c1c);if(!a65_0x1919df[_0x540138(0xfb)](_0x46de94)&&!a65_0x1919df[_0x540138(0xfb)](_0x18cbb2))return null;let _0x4b39ea={},_0x49f33d={'name':_0x128c1c,'createdAt':new Date()[_0x540138(0x139)]()};if(a65_0x1919df['existsSync'](_0x46de94))try{const _0x844485=a65_0x1919df['readFileSync'](_0x46de94,'utf-8'),_0x232399=JSON[_0x540138(0x10f)](_0x844485),{metadata:_0x30ad5c,..._0x5338e3}=_0x232399;_0x4b39ea=_0x5338e3,_0x30ad5c&&(_0x49f33d=_0x30ad5c);}catch{}return{'name':_0x128c1c,'config':_0x4b39ea,'metadata':_0x49f33d,'hasCredentials':a65_0x1919df['existsSync'](_0x18cbb2),'scope':_0x540138(0x117)};}export function listProfiles(){const _0x271d1d=a65_0x3315a5,_0x41ceb4=loadProfilesFromTdxJsonFiles(),_0x2ac681=loadProfilesFromDirectories();if(_0x2ac681['length']>0x0){const _0x4aecb9=_0x2ac681[_0x271d1d(0x127)](_0x47577e=>_0x47577e[_0x271d1d(0x138)])[_0x271d1d(0x13a)](',\x20'),_0x304e65=getConfigDir();console['warn'](_0x271d1d(0x112)+_0x4aecb9),console['warn']('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console[_0x271d1d(0x101)](_0x271d1d(0x10a)+a65_0x18aeea[_0x271d1d(0x13a)](_0x304e65,'tdx.json')),console[_0x271d1d(0x101)](_0x271d1d(0x105)),console[_0x271d1d(0x101)](_0x271d1d(0x12a));}const _0x533051=[..._0x41ceb4,..._0x2ac681],_0x393162=new Map();for(const _0x47e272 of _0x533051){!_0x393162[_0x271d1d(0x137)](_0x47e272['name'])&&_0x393162[_0x271d1d(0x12e)](_0x47e272[_0x271d1d(0x138)],_0x47e272);}return Array[_0x271d1d(0x113)](_0x393162[_0x271d1d(0x118)]())[_0x271d1d(0x144)]((_0x282f7a,_0x12f8aa)=>_0x282f7a[_0x271d1d(0x138)][_0x271d1d(0x114)](_0x12f8aa['name']));}export function profileExists(_0x145dc1){const _0x20fac5=a65_0x3315a5,_0x497c98=listProfiles();return _0x497c98[_0x20fac5(0xf6)](_0x48b8b5=>_0x48b8b5['name']===_0x145dc1);}export function loadProfile(_0x381d8a){const _0x2e3b1f=a65_0x3315a5;validateProfileName(_0x381d8a);const _0x196f1d=listProfiles(),_0x16c0a3=_0x196f1d[_0x2e3b1f(0x133)](_0x3afba8=>_0x3afba8[_0x2e3b1f(0x138)]===_0x381d8a);return _0x16c0a3||null;}export function saveProfile(_0x15ae02,_0xdbc187,_0x3c8171=![]){saveProfileToUserConfig(_0x15ae02,_0xdbc187);}export function deleteProfile(_0x2e057a){const _0x1fe862=a65_0x3315a5;validateProfileName(_0x2e057a);const _0x3464df=getProfileDir(_0x2e057a);if(!a65_0x1919df[_0x1fe862(0xfb)](_0x3464df))throw new Error(_0x1fe862(0x100)+_0x2e057a+_0x1fe862(0x10c));a65_0x1919df['rmSync'](_0x3464df,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x42d5c6,_0x168bc6){const _0x4c0d30=a65_0x3315a5;validateProfileName(_0x42d5c6);const _0x47b686=getGlobalConfigPath(),_0x22d8e1=getConfigDir();!a65_0x1919df[_0x4c0d30(0xfb)](_0x22d8e1)&&createSecureDirectory(_0x22d8e1);let _0xa05005={};if(a65_0x1919df[_0x4c0d30(0xfb)](_0x47b686))try{const _0x2a2b72=a65_0x1919df[_0x4c0d30(0x11d)](_0x47b686,_0x4c0d30(0x12c));_0xa05005=JSON[_0x4c0d30(0x10f)](_0x2a2b72);}catch{console['warn'](_0x4c0d30(0x107)+_0x47b686+_0x4c0d30(0x106));}!_0xa05005[_0x4c0d30(0x120)]&&(_0xa05005['profiles']={}),_0xa05005['profiles'][_0x42d5c6]=_0x168bc6,writeSecureFile(_0x47b686,JSON[_0x4c0d30(0x110)](_0xa05005,null,0x2));}export function removeProfileFromUserConfig(_0x292dcc){const _0x37e131=a65_0x3315a5;validateProfileName(_0x292dcc);const _0x1dc4a1=getGlobalConfigPath();if(!a65_0x1919df['existsSync'](_0x1dc4a1))throw new Error('Profile\x20\x27'+_0x292dcc+_0x37e131(0x13f));let _0x19501b={};try{const _0x451b1c=a65_0x1919df[_0x37e131(0x11d)](_0x1dc4a1,'utf-8');_0x19501b=JSON[_0x37e131(0x10f)](_0x451b1c);}catch{throw new Error('Failed\x20to\x20parse\x20'+_0x1dc4a1);}if(!_0x19501b[_0x37e131(0x120)]||!_0x19501b[_0x37e131(0x120)][_0x292dcc])throw new Error(_0x37e131(0x124)+_0x292dcc+_0x37e131(0x13f));delete _0x19501b['profiles'][_0x292dcc],_0x19501b[_0x37e131(0xf9)]===_0x292dcc&&delete _0x19501b['profile'],writeSecureFile(_0x1dc4a1,JSON[_0x37e131(0x110)](_0x19501b,null,0x2));}export function getActiveProfile(){const _0x9c9c8a=a65_0x3315a5,_0x3873c3=loadSessionContext();if(_0x3873c3?.['profile'])return _0x3873c3[_0x9c9c8a(0xf9)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x450239=getGlobalConfigPath();if(!a65_0x1919df[_0x9c9c8a(0xfb)](_0x450239))return null;try{const _0x1751ad=a65_0x1919df[_0x9c9c8a(0x11d)](_0x450239,_0x9c9c8a(0x12c)),_0x247966=JSON[_0x9c9c8a(0x10f)](_0x1751ad);return _0x247966[_0x9c9c8a(0xf9)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x4efc42){const _0x4f15ca=a65_0x3315a5,_0x138ae5=getGlobalConfigPath(),_0x1aeae9=getConfigDir();!a65_0x1919df['existsSync'](_0x1aeae9)&&createSecureDirectory(_0x1aeae9);let _0x36e1a6={};if(a65_0x1919df[_0x4f15ca(0xfb)](_0x138ae5))try{const _0x487e42=a65_0x1919df[_0x4f15ca(0x11d)](_0x138ae5,_0x4f15ca(0x12c));_0x36e1a6=JSON[_0x4f15ca(0x10f)](_0x487e42);}catch{console[_0x4f15ca(0x101)](_0x4f15ca(0x107)+_0x138ae5+_0x4f15ca(0x106));}_0x36e1a6[_0x4f15ca(0x103)]=_0x4efc42,writeSecureFile(_0x138ae5,JSON[_0x4f15ca(0x110)](_0x36e1a6,null,0x2));}export function saveActiveProfileToUserConfig(_0x4ceb85){const _0x31401f=a65_0x3315a5;validateProfileName(_0x4ceb85);const _0x5018ec=getGlobalConfigPath(),_0x36356b=getConfigDir();!a65_0x1919df['existsSync'](_0x36356b)&&createSecureDirectory(_0x36356b);let _0x4849f4={};if(a65_0x1919df[_0x31401f(0xfb)](_0x5018ec))try{const _0x3b39bc=a65_0x1919df['readFileSync'](_0x5018ec,_0x31401f(0x12c));_0x4849f4=JSON[_0x31401f(0x10f)](_0x3b39bc);}catch{console[_0x31401f(0x101)](_0x31401f(0x107)+_0x5018ec+',\x20creating\x20new\x20file');}_0x4849f4[_0x31401f(0xf9)]=_0x4ceb85,writeSecureFile(_0x5018ec,JSON[_0x31401f(0x110)](_0x4849f4,null,0x2));}function clearFieldFromUserConfig(_0x54fcb4){const _0xa76098=a65_0x3315a5,_0x3469db=getGlobalConfigPath();if(!a65_0x1919df[_0xa76098(0xfb)](_0x3469db))return;let _0x37f51c={};try{const _0x48dc56=a65_0x1919df['readFileSync'](_0x3469db,'utf-8');_0x37f51c=JSON[_0xa76098(0x10f)](_0x48dc56);}catch{return;}delete _0x37f51c[_0x54fcb4],writeSecureFile(_0x3469db,JSON[_0xa76098(0x110)](_0x37f51c,null,0x2));}export function clearDefaultSiteFromUserConfig(){clearFieldFromUserConfig('site');}export function clearActiveProfileFromUserConfig(){clearFieldFromUserConfig('profile');}export function createProfile(_0x1ceec3,_0x30a95e){const _0x3eb79c=a65_0x3315a5;validateProfileName(_0x1ceec3);if(profileExists(_0x1ceec3))throw new Error(_0x3eb79c(0x100)+_0x1ceec3+_0x3eb79c(0x135));saveProfile(_0x1ceec3,_0x30a95e);}export function saveProfileCredentials(_0x123d8b,_0x2b0f80){const _0x4f13a6=a65_0x3315a5;validateProfileName(_0x123d8b);if(!profileExists(_0x123d8b))throw new Error(_0x4f13a6(0x100)+_0x123d8b+_0x4f13a6(0x10c));const _0x205eeb=getNewCredentialPath(_0x123d8b);writeSecureFile(_0x205eeb,_0x2b0f80);}export function loadProfileCredentials(_0x4356da){const _0x530307=a65_0x3315a5;validateProfileName(_0x4356da);const _0x437546=getNewCredentialPath(_0x4356da);if(a65_0x1919df[_0x530307(0xfb)](_0x437546))try{return a65_0x1919df[_0x530307(0x11d)](_0x437546,_0x530307(0x12c));}catch{}const _0x44a422=getOldCredentialPath(_0x4356da);if(a65_0x1919df[_0x530307(0xfb)](_0x44a422)){console[_0x530307(0x101)](_0x530307(0x123)+_0x4356da+'\x27'),console[_0x530307(0x101)](_0x530307(0x109)),console[_0x530307(0x101)]('\x20\x20mv\x20\x22'+_0x44a422+'\x22\x20\x22'+_0x437546+'\x22'),console[_0x530307(0x101)](_0x530307(0x108));try{return a65_0x1919df[_0x530307(0x11d)](_0x44a422,_0x530307(0x12c));}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 a66_0x42d8(){const _0x13dbe6=['cwd','590958NWeGBN','300825YNpMOC','Failed\x20to\x20load\x20project\x20config\x20from\x20','includes','340uqYlSh',').\x20','14IyrLxX','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','utf-8','readFileSync','existsSync','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','join','4228290hbdfPa','apiKey','stringify','Warning:\x20\x27profile\x27\x20field\x20in\x20','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','297OEhVot','api_key','1010810YuKCAI','3062TBGvyr','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','\x20is\x20ignored.\x20','1332592fYCosm','TD_API_KEY','dirname','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','64071LPxaUz','8JWTqps','code'];a66_0x42d8=function(){return _0x13dbe6;};return a66_0x42d8();}(function(_0x316079,_0x378b0f){const _0x2c6bc0=a66_0x14e5,_0x30cae5=_0x316079();while(!![]){try{const _0x4280f4=-parseInt(_0x2c6bc0(0xa2))/0x1+-parseInt(_0x2c6bc0(0x96))/0x2*(parseInt(_0x2c6bc0(0x93))/0x3)+-parseInt(_0x2c6bc0(0x9e))/0x4*(-parseInt(_0x2c6bc0(0x95))/0x5)+parseInt(_0x2c6bc0(0xa1))/0x6*(-parseInt(_0x2c6bc0(0x87))/0x7)+-parseInt(_0x2c6bc0(0x99))/0x8+-parseInt(_0x2c6bc0(0x9d))/0x9*(-parseInt(_0x2c6bc0(0xa5))/0xa)+parseInt(_0x2c6bc0(0x8e))/0xb;if(_0x4280f4===_0x378b0f)break;else _0x30cae5['push'](_0x30cae5['shift']());}catch(_0x3796d1){_0x30cae5['push'](_0x30cae5['shift']());}}}(a66_0x42d8,0x34716));import*as a66_0x2f152f from'node:fs';import*as a66_0x2ab9f2 from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';function a66_0x14e5(_0x40bba6,_0x1d3563){_0x40bba6=_0x40bba6-0x86;const _0x42d838=a66_0x42d8();let _0x14e500=_0x42d838[_0x40bba6];return _0x14e500;}export function findProjectConfigPath(_0x3beb87){const _0x5e2e8e=a66_0x14e5;let _0x688046=_0x3beb87||process[_0x5e2e8e(0xa0)]();while(!![]){const _0x5bbdf2=a66_0x2ab9f2[_0x5e2e8e(0x8d)](_0x688046,PROJECT_CONFIG_FILENAME);if(a66_0x2f152f[_0x5e2e8e(0x8b)](_0x5bbdf2))return _0x5bbdf2;const _0x56c64e=a66_0x2ab9f2[_0x5e2e8e(0x9b)](_0x688046);if(_0x56c64e===_0x688046)return null;_0x688046=_0x56c64e;}}export function loadProjectConfig(_0x148f66){const _0x58817b=a66_0x14e5,_0x14e014=findProjectConfigPath(_0x148f66);if(!_0x14e014)return null;try{const _0x370cc1=a66_0x2f152f[_0x58817b(0x8a)](_0x14e014,_0x58817b(0x89)),_0x3c5492=JSON['parse'](_0x370cc1),_0x53a056=JSON[_0x58817b(0x90)](_0x3c5492);if(_0x53a056['includes'](_0x58817b(0x9a))||_0x53a056[_0x58817b(0xa4)](_0x58817b(0x8f))||_0x53a056[_0x58817b(0xa4)](_0x58817b(0x94)))throw new Error(_0x58817b(0x88)+_0x14e014+_0x58817b(0x86)+_0x58817b(0x9c));const {metadata:_0x766ee3,profile:_0x33f57c,..._0x8594fe}=_0x3c5492;return _0x33f57c&&console['warn'](_0x58817b(0x91)+_0x14e014+_0x58817b(0x98)+_0x58817b(0x8c)),_0x8594fe;}catch(_0x380bac){if(_0x380bac instanceof Error&&_0x58817b(0x9f)in _0x380bac&&_0x380bac[_0x58817b(0x9f)]==='ENOENT')return null;throw new Error(_0x58817b(0xa3)+_0x14e014+':\x20'+_0x380bac);}}export function saveProjectConfig(_0x25e394,_0x3dd1f4){const _0x148d47=a66_0x14e5,_0x3ecd17=_0x3dd1f4||process[_0x148d47(0xa0)](),_0x1fc6b7=a66_0x2ab9f2[_0x148d47(0x8d)](_0x3ecd17,PROJECT_CONFIG_FILENAME),_0x5772be=JSON[_0x148d47(0x90)](_0x25e394);if(_0x5772be[_0x148d47(0xa4)](_0x148d47(0x9a))||_0x5772be[_0x148d47(0xa4)]('apiKey')||_0x5772be[_0x148d47(0xa4)](_0x148d47(0x94)))throw new Error(_0x148d47(0x97));if('profile'in _0x25e394)throw new Error(_0x148d47(0x92));a66_0x2f152f['writeFileSync'](_0x1fc6b7,JSON[_0x148d47(0x90)](_0x25e394,null,0x2));}export function hasProjectConfig(_0x4657ae){return findProjectConfigPath(_0x4657ae)!==null;}export function getProjectRoot(_0x430063){const _0x5663f2=findProjectConfigPath(_0x430063);return _0x5663f2?a66_0x2ab9f2['dirname'](_0x5663f2):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(_0x1772b3,_0x81b553){const _0x51ccd9=a67_0x4306,_0x2bdeb6=_0x1772b3();while(!![]){try{const _0xe53369=parseInt(_0x51ccd9(0x93))/0x1+-parseInt(_0x51ccd9(0x85))/0x2+parseInt(_0x51ccd9(0x7a))/0x3+parseInt(_0x51ccd9(0x82))/0x4*(-parseInt(_0x51ccd9(0x76))/0x5)+parseInt(_0x51ccd9(0x79))/0x6+parseInt(_0x51ccd9(0x83))/0x7+-parseInt(_0x51ccd9(0x96))/0x8;if(_0xe53369===_0x81b553)break;else _0x2bdeb6['push'](_0x2bdeb6['shift']());}catch(_0x4997c2){_0x2bdeb6['push'](_0x2bdeb6['shift']());}}}(a67_0x3b6f,0xee66a));import*as a67_0x38809a from'node:fs';import*as a67_0x32b029 from'node:path';import*as a67_0x3f06f9 from'node:os';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 _0x27697c=a67_0x4306,_0x2f045f=process.env.TDX_CONFIG_DIR||a67_0x32b029[_0x27697c(0x8d)](a67_0x3f06f9[_0x27697c(0x7f)](),'.config',_0x27697c(0x84));return a67_0x32b029[_0x27697c(0x8d)](_0x2f045f,'sessions');}function getSessionPath(_0x4965e7){const _0x90401c=a67_0x4306;return a67_0x32b029['join'](getSessionsDir(),_0x4965e7+_0x90401c(0x8e));}function a67_0x4306(_0x57f098,_0x46c52c){_0x57f098=_0x57f098-0x76;const _0x3b6f76=a67_0x3b6f();let _0x430684=_0x3b6f76[_0x57f098];return _0x430684;}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x2ea867){if(_0x2ea867)return _0x2ea867;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()['toString']();}export function loadSessionContext(_0x4120ba){const _0x158408=a67_0x4306,_0x4e20cb=getSessionID(_0x4120ba),_0x4681ed=/^\d+$/[_0x158408(0x7e)](_0x4e20cb)?parseInt(_0x4e20cb,0xa):null;return _0x4681ed!==null?loadSessionContextByPID(_0x4681ed):loadSessionContextByString(_0x4e20cb);}export function loadSessionContextByPID(_0xa9a36c){const _0x2d8810=a67_0x4306,_0x1c63dd=getSessionPath(_0xa9a36c);if(!a67_0x38809a[_0x2d8810(0x7d)](_0x1c63dd))return null;try{const _0x5f38fc=a67_0x38809a[_0x2d8810(0x78)](_0x1c63dd,_0x2d8810(0x92)),_0x363507=JSON[_0x2d8810(0x8a)](_0x5f38fc),_0x335bf5=new Date(_0x363507[_0x2d8810(0x80)])[_0x2d8810(0x8c)](),_0x36c79e=Date[_0x2d8810(0x7b)]();if(_0x36c79e-_0x335bf5>SESSION_EXPIRATION_MS)return a67_0x38809a[_0x2d8810(0x97)](_0x1c63dd),null;const _0xd73d35=JSON[_0x2d8810(0x91)](_0x363507);if(_0xd73d35[_0x2d8810(0x94)](_0x2d8810(0x8b))||_0xd73d35[_0x2d8810(0x94)](_0x2d8810(0x89))||_0xd73d35['includes'](_0x2d8810(0x95)))return console[_0x2d8810(0x86)](_0x2d8810(0x87)+_0x1c63dd+_0x2d8810(0x90)),a67_0x38809a[_0x2d8810(0x97)](_0x1c63dd),null;return _0x363507;}catch{try{a67_0x38809a[_0x2d8810(0x97)](_0x1c63dd);}catch{}return null;}}function loadSessionContextByString(_0x4dd4a3){const _0x56721e=a67_0x4306,_0x181856=a67_0x32b029[_0x56721e(0x8d)](getSessionsDir(),_0x4dd4a3+_0x56721e(0x8e));if(!a67_0x38809a[_0x56721e(0x7d)](_0x181856))return null;try{const _0x5c886f=a67_0x38809a['readFileSync'](_0x181856,_0x56721e(0x92)),_0x5dc5e8=JSON[_0x56721e(0x8a)](_0x5c886f),_0x3ee68c=new Date(_0x5dc5e8[_0x56721e(0x80)])['getTime'](),_0x548323=Date['now']();if(_0x548323-_0x3ee68c>SESSION_EXPIRATION_MS)return a67_0x38809a['unlinkSync'](_0x181856),null;const _0x5b9476=JSON['stringify'](_0x5dc5e8);if(_0x5b9476[_0x56721e(0x94)]('TD_API_KEY')||_0x5b9476[_0x56721e(0x94)](_0x56721e(0x89))||_0x5b9476[_0x56721e(0x94)](_0x56721e(0x95)))return console['warn'](_0x56721e(0x87)+_0x181856+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a67_0x38809a[_0x56721e(0x97)](_0x181856),null;return _0x5dc5e8;}catch{try{a67_0x38809a['unlinkSync'](_0x181856);}catch{}return null;}}export function saveSessionContext(_0x371217,_0x50bfa1){const _0x2b118c=a67_0x4306,_0x559a89=getSessionID(_0x50bfa1),_0x54ff14=/^\d+$/[_0x2b118c(0x7e)](_0x559a89)?parseInt(_0x559a89,0xa):getCurrentSessionPID(),_0x4c6201=a67_0x32b029[_0x2b118c(0x8d)](getSessionsDir(),_0x559a89+_0x2b118c(0x8e)),_0x571174=getSessionsDir();createSecureDirectory(_0x571174);const _0x267fab=JSON['stringify'](_0x371217);if(_0x267fab[_0x2b118c(0x94)](_0x2b118c(0x8b))||_0x267fab[_0x2b118c(0x94)](_0x2b118c(0x89))||_0x267fab[_0x2b118c(0x94)](_0x2b118c(0x95)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x4dd08f;const _0x4a5f2c=/^\d+$/[_0x2b118c(0x7e)](_0x559a89)?loadSessionContextByPID(parseInt(_0x559a89,0xa)):loadSessionContextByString(_0x559a89);_0x4a5f2c?_0x4dd08f={..._0x4a5f2c,..._0x371217,'pid':_0x54ff14,'sessionId':_0x559a89!==_0x54ff14[_0x2b118c(0x88)]()?_0x559a89:undefined,'updatedAt':new Date()[_0x2b118c(0x81)]()}:_0x4dd08f={'pid':_0x54ff14,'sessionId':_0x559a89!==_0x54ff14['toString']()?_0x559a89:undefined,..._0x371217,'createdAt':new Date()[_0x2b118c(0x81)](),'updatedAt':new Date()[_0x2b118c(0x81)]()},a67_0x38809a[_0x2b118c(0x77)](_0x4c6201,JSON[_0x2b118c(0x91)](_0x4dd08f,null,0x2));}export function clearSessionContext(_0x38a46e){const _0x11d4fb=a67_0x4306,_0x59537d=getSessionID(_0x38a46e),_0x44ee7c=a67_0x32b029[_0x11d4fb(0x8d)](getSessionsDir(),_0x59537d+_0x11d4fb(0x8e));a67_0x38809a[_0x11d4fb(0x7d)](_0x44ee7c)&&a67_0x38809a[_0x11d4fb(0x97)](_0x44ee7c);}export function clearSessionContextField(_0x54ba19,_0x584ae2){const _0x2e5319=a67_0x4306,_0x4cd87e=getSessionID(_0x584ae2),_0x12f3a9=a67_0x32b029[_0x2e5319(0x8d)](getSessionsDir(),_0x4cd87e+_0x2e5319(0x8e));if(!a67_0x38809a['existsSync'](_0x12f3a9))return;try{const _0x36d044=a67_0x38809a[_0x2e5319(0x78)](_0x12f3a9,_0x2e5319(0x92)),_0x5ead7c=JSON[_0x2e5319(0x8a)](_0x36d044);delete _0x5ead7c[_0x54ba19],a67_0x38809a[_0x2e5319(0x77)](_0x12f3a9,JSON['stringify'](_0x5ead7c,null,0x2));}catch{}}function a67_0x3b6f(){const _0x3ba61b=['includes','api_key','7709488DCmTkG','unlinkSync','replace','sort','42170pDDhSo','writeFileSync','readFileSync','2133648XaXtXQ','46254BQAMTV','now','push','existsSync','test','homedir','createdAt','toISOString','136xnbtEP','6983942vZQDdE','tdx','712162pxjVGR','warn','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','toString','apiKey','parse','TD_API_KEY','getTime','join','.json','endsWith','.\x20This\x20is\x20insecure.\x20Removing\x20session.','stringify','utf-8','1214281oGwqKW'];a67_0x3b6f=function(){return _0x3ba61b;};return a67_0x3b6f();}export function cleanExpiredSessions(){const _0x558343=a67_0x4306,_0x1987a0=getSessionsDir();if(!a67_0x38809a[_0x558343(0x7d)](_0x1987a0))return 0x0;let _0x47cbc7=0x0;const _0x27f2c1=Date[_0x558343(0x7b)]();try{const _0x490d86=a67_0x38809a['readdirSync'](_0x1987a0);for(const _0x424687 of _0x490d86){if(!_0x424687[_0x558343(0x8f)](_0x558343(0x8e)))continue;const _0x5d06a4=a67_0x32b029[_0x558343(0x8d)](_0x1987a0,_0x424687),_0x48d2c5=_0x424687[_0x558343(0x98)](_0x558343(0x8e),''),_0x1dc087=parseInt(_0x48d2c5,0xa),_0x3bc07a=!isNaN(_0x1dc087);if(_0x3bc07a){if(!isProcessRunning(_0x1dc087)){a67_0x38809a['unlinkSync'](_0x5d06a4),_0x47cbc7++;continue;}}try{const _0x13dd82=a67_0x38809a[_0x558343(0x78)](_0x5d06a4,_0x558343(0x92)),_0x542d19=JSON['parse'](_0x13dd82),_0xf0eccb=new Date(_0x542d19[_0x558343(0x80)])[_0x558343(0x8c)]();_0x27f2c1-_0xf0eccb>SESSION_EXPIRATION_MS&&(a67_0x38809a['unlinkSync'](_0x5d06a4),_0x47cbc7++);}catch{a67_0x38809a[_0x558343(0x97)](_0x5d06a4),_0x47cbc7++;}}}catch{}return _0x47cbc7;}export function listActiveSessions(){const _0x41b3ee=a67_0x4306,_0x43d56f=getSessionsDir();if(!a67_0x38809a[_0x41b3ee(0x7d)](_0x43d56f))return[];try{const _0x167cda=a67_0x38809a['readdirSync'](_0x43d56f),_0x3cb317=[];for(const _0x120cbf of _0x167cda){if(!_0x120cbf[_0x41b3ee(0x8f)](_0x41b3ee(0x8e)))continue;const _0x55c624=_0x120cbf[_0x41b3ee(0x98)](_0x41b3ee(0x8e),''),_0xd9ae22=parseInt(_0x55c624,0xa);!isNaN(_0xd9ae22)&&isProcessRunning(_0xd9ae22)&&_0x3cb317[_0x41b3ee(0x7c)](_0xd9ae22);}return _0x3cb317[_0x41b3ee(0x99)]((_0x3c4cfa,_0x35ff02)=>_0x3c4cfa-_0x35ff02);}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
+ const a68_0x45998c=a68_0x5f1c;(function(_0x54a383,_0x44d52b){const _0x22ca9e=a68_0x5f1c,_0x3fb006=_0x54a383();while(!![]){try{const _0x10790f=parseInt(_0x22ca9e(0x8b))/0x1+parseInt(_0x22ca9e(0x85))/0x2+-parseInt(_0x22ca9e(0x8a))/0x3+parseInt(_0x22ca9e(0x89))/0x4+parseInt(_0x22ca9e(0x8c))/0x5+parseInt(_0x22ca9e(0x84))/0x6+-parseInt(_0x22ca9e(0x8e))/0x7*(parseInt(_0x22ca9e(0x83))/0x8);if(_0x10790f===_0x44d52b)break;else _0x3fb006['push'](_0x3fb006['shift']());}catch(_0x411835){_0x3fb006['push'](_0x3fb006['shift']());}}}(a68_0x41a0,0x506aa));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a68_0x45998c(0x90),'core/user-cache');export function loadCachedUsers(_0xe39624){const _0x5f5545=a68_0x45998c,_0x35a49e=userCache[_0x5f5545(0x86)](_0xe39624);return _0x35a49e?.[_0x5f5545(0x8f)]??null;}export function saveCachedUsers(_0x4c287f,_0x13099d){const _0x2eae4b=a68_0x45998c;userCache[_0x2eae4b(0x87)](_0x4c287f,{'users':_0x13099d,'cachedAt':Date[_0x2eae4b(0x8d)]()});}export function clearUserCache(_0x6b759b){const _0xdbeadd=a68_0x45998c;userCache[_0xdbeadd(0x88)](_0x6b759b);}function a68_0x5f1c(_0x58ef73,_0x247c51){_0x58ef73=_0x58ef73-0x83;const _0x41a0a7=a68_0x41a0();let _0x5f1c65=_0x41a0a7[_0x58ef73];return _0x5f1c65;}function a68_0x41a0(){const _0x3139b3=['read','write','clear','2369320NhrOgO','708561ENNwZA','330784aScqWL','1052615LxeSze','now','9328781HiMQoQ','users','users-{profile}.json','8UwxJGt','701304ansqAm','1295470XkoiHX'];a68_0x41a0=function(){return _0x3139b3;};return a68_0x41a0();}
@@ -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(_0x22ad37,_0x24fede){const _0x4b7a43=a69_0x37d0,_0x1915ef=_0x22ad37();while(!![]){try{const _0x5b1b62=-parseInt(_0x4b7a43(0x170))/0x1*(-parseInt(_0x4b7a43(0x16f))/0x2)+-parseInt(_0x4b7a43(0x173))/0x3+parseInt(_0x4b7a43(0x164))/0x4*(-parseInt(_0x4b7a43(0x168))/0x5)+-parseInt(_0x4b7a43(0x16d))/0x6*(parseInt(_0x4b7a43(0x16a))/0x7)+-parseInt(_0x4b7a43(0x16b))/0x8+-parseInt(_0x4b7a43(0x166))/0x9*(parseInt(_0x4b7a43(0x162))/0xa)+-parseInt(_0x4b7a43(0x165))/0xb*(-parseInt(_0x4b7a43(0x163))/0xc);if(_0x5b1b62===_0x24fede)break;else _0x1915ef['push'](_0x1915ef['shift']());}catch(_0x332bc8){_0x1915ef['push'](_0x1915ef['shift']());}}}(a69_0xc253,0xabaa9));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';function a69_0x37d0(_0x22fab1,_0x454187){_0x22fab1=_0x22fab1-0x161;const _0xc2536a=a69_0xc253();let _0x37d0e0=_0xc2536a[_0x22fab1];return _0x37d0e0;}let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x59e16e=a69_0x37d0;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x4738ad=fileURLToPath(import.meta.url),_0x40a250=dirname(_0x4738ad);try{const _0x3e6ad6=join(_0x40a250,_0x59e16e(0x172));cachedBuildInfo=JSON[_0x59e16e(0x171)](readFileSync(_0x3e6ad6,'utf-8'));}catch{cachedBuildInfo={};}return cachedBuildInfo;}function a69_0xc253(){const _0x51ef23=['5ynvAfR','version','7KvaaMq','1683432zcPaDq','../../package.json','3832806GxKyQz','.dev','4oSRice','55299VpICfK','parse','../build-info.json','3459021fdMuCU','utf-8','10zAHClN','180vwiWqY','4247828VmmPFH','3458972InVjjV','9540351GfWCoK','includes'];a69_0xc253=function(){return _0x51ef23;};return a69_0xc253();}export function getVersion(){const _0x3a9c51=a69_0x37d0;if(cachedVersion!==null)return cachedVersion;const _0x5db132=fileURLToPath(import.meta.url),_0x4360ba=dirname(_0x5db132),_0x5c8ad9=getBuildInfo();if(_0x5c8ad9[_0x3a9c51(0x169)])return cachedVersion=_0x5c8ad9['version'],cachedVersion;try{const _0x37f38e=join(_0x4360ba,_0x3a9c51(0x16c)),_0x4e9c2f=JSON[_0x3a9c51(0x171)](readFileSync(_0x37f38e,_0x3a9c51(0x161)));cachedVersion=_0x4e9c2f['version'];}catch{cachedVersion='0.0.0';}return cachedVersion;}export function isDevVersion(){const _0x2311c3=a69_0x37d0,_0x11badf=getVersion();return _0x11badf['includes'](_0x2311c3(0x16e))||_0x11badf[_0x2311c3(0x167)]('-');}