@treasuredata/tdx 2026.3.23 → 2026.3.25

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 (203) 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/auth-login-command.js +1 -1
  11. package/dist/commands/chat-command.js +1 -1
  12. package/dist/commands/claude-command.js +1 -1
  13. package/dist/commands/claude-statusline-command.js +1 -1
  14. package/dist/commands/claude-usage-command.js +1 -1
  15. package/dist/commands/command.js +1 -1
  16. package/dist/commands/connection-command.js +1 -1
  17. package/dist/commands/databases.js +1 -1
  18. package/dist/commands/delivery-command.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-campaign-pull-command.js +1 -1
  21. package/dist/commands/engage-campaign-push-command.js +1 -1
  22. package/dist/commands/engage-campaign-validate-command.js +1 -1
  23. package/dist/commands/engage-command.js +1 -1
  24. package/dist/commands/engage-template-pull-command.js +1 -1
  25. package/dist/commands/engage-template-push-command.js +1 -1
  26. package/dist/commands/engage-template-validate-command.js +1 -1
  27. package/dist/commands/job-command.js +1 -1
  28. package/dist/commands/journey-command.js +1 -1
  29. package/dist/commands/journey-validate-command.js +1 -1
  30. package/dist/commands/llm-command.js +1 -1
  31. package/dist/commands/mcp-command.js +1 -1
  32. package/dist/commands/parent-segment-command.js +1 -1
  33. package/dist/commands/policy-command.js +1 -1
  34. package/dist/commands/profile-command.js +1 -1
  35. package/dist/commands/profiles-command.js +1 -1
  36. package/dist/commands/query-command.js +1 -1
  37. package/dist/commands/schedule-command.js +1 -1
  38. package/dist/commands/segment-command.js +1 -1
  39. package/dist/commands/segment-create-command.js +1 -1
  40. package/dist/commands/segment-fields-command.js +1 -1
  41. package/dist/commands/segment-pull-command.js +1 -1
  42. package/dist/commands/segment-push-command.js +1 -1
  43. package/dist/commands/segment-update-command.js +1 -1
  44. package/dist/commands/segment-use-command.js +1 -1
  45. package/dist/commands/segment-validate-command.js +1 -1
  46. package/dist/commands/segments.js +1 -1
  47. package/dist/commands/show.js +1 -1
  48. package/dist/commands/status-command.js +1 -1
  49. package/dist/commands/tables.js +1 -1
  50. package/dist/commands/unset-command.js +1 -1
  51. package/dist/commands/upgrade-command.js +1 -1
  52. package/dist/commands/use-command.js +1 -1
  53. package/dist/commands/user-command.js +1 -1
  54. package/dist/commands/workflow-command.js +1 -1
  55. package/dist/core/auth.js +1 -1
  56. package/dist/core/command-output.js +1 -1
  57. package/dist/core/config.js +1 -1
  58. package/dist/core/connection-cache.js +1 -1
  59. package/dist/core/constants.js +1 -1
  60. package/dist/core/credential-cache.js +1 -1
  61. package/dist/core/global-context.js +1 -1
  62. package/dist/core/keychain.js +1 -1
  63. package/dist/core/oauth-keychain.js +1 -1
  64. package/dist/core/oauth.js +1 -1
  65. package/dist/core/profile.js +1 -1
  66. package/dist/core/project-config.js +1 -1
  67. package/dist/core/session.js +1 -1
  68. package/dist/core/user-cache.js +1 -1
  69. package/dist/core/version.js +1 -1
  70. package/dist/index.js +1 -1
  71. package/dist/mcp/server.js +1 -1
  72. package/dist/mcp/tools/index.js +1 -1
  73. package/dist/mcp/tools/tdx-run.js +1 -1
  74. package/dist/mcp/tools/tdx-search.js +1 -1
  75. package/dist/mcp/utils.js +1 -1
  76. package/dist/proxy/claude-usage-tracker.js +1 -1
  77. package/dist/proxy/passthrough-server.js +1 -1
  78. package/dist/proxy/sse-usage-parser.js +1 -1
  79. package/dist/sdk/agent/agent-config.js +1 -1
  80. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  81. package/dist/sdk/agent/agent-yaml.js +1 -1
  82. package/dist/sdk/agent/test/evaluator.js +1 -1
  83. package/dist/sdk/agent/test/executor.js +1 -1
  84. package/dist/sdk/agent/test/index.js +1 -1
  85. package/dist/sdk/agent/test/output.js +1 -1
  86. package/dist/sdk/agent/test/parser.js +1 -1
  87. package/dist/sdk/agent/tool-target-registry.js +1 -1
  88. package/dist/sdk/api.js +1 -1
  89. package/dist/sdk/client/cdp-api-client.js +1 -1
  90. package/dist/sdk/client/delivery-api-client.js +1 -1
  91. package/dist/sdk/client/endpoints.js +1 -1
  92. package/dist/sdk/client/engage-api-client.js +1 -1
  93. package/dist/sdk/client/http-client.js +1 -1
  94. package/dist/sdk/client/llm-api-client.js +1 -1
  95. package/dist/sdk/client/oauth-refresh.js +1 -1
  96. package/dist/sdk/client/rate-limiter.js +1 -1
  97. package/dist/sdk/client/td-api-client.js +1 -1
  98. package/dist/sdk/client/trino-api-client.js +1 -1
  99. package/dist/sdk/client/workflow-client.js +1 -1
  100. package/dist/sdk/connection-validator.js +1 -1
  101. package/dist/sdk/connection.js +1 -1
  102. package/dist/sdk/delivery.js +1 -1
  103. package/dist/sdk/engage/campaign-pull.js +1 -1
  104. package/dist/sdk/engage/campaign-push.js +1 -1
  105. package/dist/sdk/engage/campaign-validator.js +1 -1
  106. package/dist/sdk/engage/campaign-yaml.js +1 -1
  107. package/dist/sdk/engage/template-pull.js +1 -1
  108. package/dist/sdk/engage/template-push.js +1 -1
  109. package/dist/sdk/engage/template-validator.js +1 -1
  110. package/dist/sdk/engage/template-yaml.js +1 -1
  111. package/dist/sdk/engage/types/campaign-def.js +1 -1
  112. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  113. package/dist/sdk/engage/types/template-schema.js +1 -1
  114. package/dist/sdk/engage.js +1 -1
  115. package/dist/sdk/errors.js +1 -1
  116. package/dist/sdk/index.js +1 -1
  117. package/dist/sdk/io/index.js +1 -1
  118. package/dist/sdk/io/node-filesystem.js +1 -1
  119. package/dist/sdk/job.js +1 -1
  120. package/dist/sdk/journey.js +1 -1
  121. package/dist/sdk/llm/chat-cache.js +1 -1
  122. package/dist/sdk/llm/index.js +1 -1
  123. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  124. package/dist/sdk/llm/model-factors.js +1 -1
  125. package/dist/sdk/personalization.js +1 -1
  126. package/dist/sdk/policy.js +1 -1
  127. package/dist/sdk/query/index.js +1 -1
  128. package/dist/sdk/query/sql-parser.js +1 -1
  129. package/dist/sdk/realtime.js +1 -1
  130. package/dist/sdk/schedule.js +1 -1
  131. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  132. package/dist/sdk/segment/fields-display.js +1 -1
  133. package/dist/sdk/segment/file-discovery.js +1 -1
  134. package/dist/sdk/segment/journey-utils.js +1 -1
  135. package/dist/sdk/segment/journey-validator.js +1 -1
  136. package/dist/sdk/segment/journey-yaml.js +1 -1
  137. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  138. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  139. package/dist/sdk/segment/pull-workflow.js +1 -1
  140. package/dist/sdk/segment/push-recovery.js +1 -1
  141. package/dist/sdk/segment/push-workflow.js +1 -1
  142. package/dist/sdk/segment/resolution-context.js +1 -1
  143. package/dist/sdk/segment/segment-path-parser.js +1 -1
  144. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  145. package/dist/sdk/segment/segment-validator.js +1 -1
  146. package/dist/sdk/segment/target-resolution.js +1 -1
  147. package/dist/sdk/segment/tdx-config.js +1 -1
  148. package/dist/sdk/segment/types/activation-schema.js +1 -1
  149. package/dist/sdk/segment/types/journey-def.js +1 -1
  150. package/dist/sdk/segment/types/journey-schema.js +1 -1
  151. package/dist/sdk/segment/types/segment-def.js +1 -1
  152. package/dist/sdk/segment/types/segment-schema.js +1 -1
  153. package/dist/sdk/segment/validate-files.js +1 -1
  154. package/dist/sdk/segment/yaml-validator.js +1 -1
  155. package/dist/sdk/segment.js +1 -1
  156. package/dist/sdk/types/index.js +1 -1
  157. package/dist/sdk/types/progress.js +1 -1
  158. package/dist/sdk/user.js +1 -1
  159. package/dist/sdk/util/format-detector.js +1 -1
  160. package/dist/sdk/util/formatters.js +1 -1
  161. package/dist/sdk/util/index.js +1 -1
  162. package/dist/sdk/util/paginate.js +1 -1
  163. package/dist/sdk/util/tree-formatter.js +1 -1
  164. package/dist/sdk/workflow/archive-validation.js +1 -1
  165. package/dist/sdk/workflow/clone-workflow.js +1 -1
  166. package/dist/sdk/workflow/index.js +1 -1
  167. package/dist/sdk/workflow/pull-workflow.js +1 -1
  168. package/dist/sdk/workflow/push-workflow.js +1 -1
  169. package/dist/sdk/workflow/tdx-config.js +1 -1
  170. package/dist/sdk/workflow/workflow-utils.js +1 -1
  171. package/dist/test-utils/command-runner.js +1 -1
  172. package/dist/test-utils/factories.js +1 -1
  173. package/dist/test-utils/fixtures.js +1 -1
  174. package/dist/test-utils/http-mock.js +1 -1
  175. package/dist/test-utils/index.js +1 -1
  176. package/dist/utils/async.js +1 -1
  177. package/dist/utils/colors.js +1 -1
  178. package/dist/utils/diff.js +1 -1
  179. package/dist/utils/file-permissions.js +1 -1
  180. package/dist/utils/file-reader.js +1 -1
  181. package/dist/utils/github-releases.js +1 -1
  182. package/dist/utils/global-cache.js +1 -1
  183. package/dist/utils/json-loader.js +1 -1
  184. package/dist/utils/local-cache.js +1 -1
  185. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  186. package/dist/utils/logger/formatters/index.js +1 -1
  187. package/dist/utils/logger/handlers/console-handler.js +1 -1
  188. package/dist/utils/logger/handlers/file-handler.js +1 -1
  189. package/dist/utils/logger/handlers/index.js +1 -1
  190. package/dist/utils/logger/handlers/null-handler.js +1 -1
  191. package/dist/utils/logger/index.js +1 -1
  192. package/dist/utils/logger/logger.js +1 -1
  193. package/dist/utils/logger/types.js +1 -1
  194. package/dist/utils/option-validation.js +1 -1
  195. package/dist/utils/process.js +1 -1
  196. package/dist/utils/prompt.js +1 -1
  197. package/dist/utils/spinner.js +1 -1
  198. package/dist/utils/sse-parser.js +1 -1
  199. package/dist/utils/string-utils.js +1 -1
  200. package/dist/utils/table-ref-parser.js +1 -1
  201. package/dist/utils/tdx-logger.js +1 -1
  202. package/dist/utils/version-check.js +1 -1
  203. package/package.json +1 -1
@@ -1 +1 @@
1
- const a55_0x359e31=a55_0x2438;function a55_0x2438(_0x3ba8f0,_0x5c7cb5){_0x3ba8f0=_0x3ba8f0-0x82;const _0x4dfa2d=a55_0x4dfa();let _0x2438dd=_0x4dfa2d[_0x3ba8f0];return _0x2438dd;}(function(_0x71b7c0,_0x2ebf91){const _0x51bc5d=a55_0x2438,_0x364ec5=_0x71b7c0();while(!![]){try{const _0x82c10f=-parseInt(_0x51bc5d(0xb7))/0x1*(parseInt(_0x51bc5d(0x8c))/0x2)+-parseInt(_0x51bc5d(0xb3))/0x3*(-parseInt(_0x51bc5d(0x83))/0x4)+parseInt(_0x51bc5d(0xaf))/0x5*(parseInt(_0x51bc5d(0x86))/0x6)+-parseInt(_0x51bc5d(0xc9))/0x7*(-parseInt(_0x51bc5d(0xb9))/0x8)+-parseInt(_0x51bc5d(0x95))/0x9*(parseInt(_0x51bc5d(0xa7))/0xa)+-parseInt(_0x51bc5d(0xd1))/0xb+parseInt(_0x51bc5d(0xbd))/0xc;if(_0x82c10f===_0x2ebf91)break;else _0x364ec5['push'](_0x364ec5['shift']());}catch(_0xb05950){_0x364ec5['push'](_0x364ec5['shift']());}}}(a55_0x4dfa,0x6ba4a));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a55_0x59f4e6 from'node:fs';import*as a55_0x5bf237 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 a55_0x305ae0 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){return process.env.TDX_CONFIG_DIR||join(homedir(),'.config','tdx');}export function getConfigFile(){const _0x588efa=a55_0x2438;return join(getConfigDir(),_0x588efa(0xcb));}export function getConfigFilePath(_0x1b5d80){const _0xe40743=a55_0x2438,_0x1531cb=getConfigDir();return _0x1b5d80?a55_0x5bf237[_0xe40743(0xa0)](_0x1531cb,_0xe40743(0x9f)+_0x1b5d80):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a55_0x359e31(0x92),a55_0x359e31(0xac));export function getLLMProjectCacheFile(_0x577b0a){const _0x2330c7=a55_0x359e31;return llmProjectCache[_0x2330c7(0x94)](_0x577b0a);}export function readCachedLLMProject(_0x4c9084){const _0x478392=a55_0x359e31,_0x327129=llmProjectCache['read'](_0x4c9084);if(_0x327129&&typeof _0x327129['id']===_0x478392(0xc4)&&typeof _0x327129[_0x478392(0xb1)]===_0x478392(0xc4))return _0x327129;return null;}export function writeCachedLLMProject(_0x5e1cf8,_0xf0468c,_0x2aa7c3){try{llmProjectCache['write']({'name':_0x5e1cf8,'id':_0xf0468c},_0x2aa7c3);}catch{}}const llmAgentCache=createOptionalProfileCache('llm_default_agent',a55_0x359e31(0x98));export function getLLMAgentCacheFile(_0x251739){const _0xeda17e=a55_0x359e31;return llmAgentCache[_0xeda17e(0x94)](_0x251739);}export function readCachedLLMAgent(_0x53e4ec){const _0x59dfc4=a55_0x359e31,_0x17ff24=llmAgentCache['read'](_0x53e4ec);if(_0x17ff24&&typeof _0x17ff24['id']==='string'&&typeof _0x17ff24[_0x59dfc4(0xb1)]==='string'&&typeof _0x17ff24[_0x59dfc4(0xad)]===_0x59dfc4(0xc4))return _0x17ff24;return null;}export function writeCachedLLMAgent(_0x1f45ae,_0x4209fe,_0x5b6643,_0x430857){const _0x5a0a91=a55_0x359e31;try{llmAgentCache[_0x5a0a91(0xa6)]({'name':_0x1f45ae,'id':_0x4209fe,'projectId':_0x5b6643},_0x430857);}catch{}}export function clearCachedLLMAgent(_0x54d0e6){const _0x320c7=a55_0x359e31;try{llmAgentCache[_0x320c7(0xc1)](_0x54d0e6);}catch{}}const accountInfoCache=createOptionalProfileCache('account_info',a55_0x359e31(0x84),{'suffix':a55_0x359e31(0x88)});export function getAccountInfoCacheFile(_0x3d8a25){const _0x120d4d=a55_0x359e31;return accountInfoCache[_0x120d4d(0x94)](_0x3d8a25);}export function readCachedAccountInfo(_0x4ccc5b){const _0x36c6ac=a55_0x359e31,_0x5d1417=accountInfoCache[_0x36c6ac(0xcd)](_0x4ccc5b);if(_0x5d1417&&typeof _0x5d1417['site']===_0x36c6ac(0xc4)&&typeof _0x5d1417[_0x36c6ac(0xc5)]===_0x36c6ac(0xc7))return _0x5d1417;return null;}export function writeCachedAccountInfo(_0x2092ad,_0x4da08b,_0x1883a4){const _0x54b7ba=a55_0x359e31;try{accountInfoCache['write']({'site':_0x2092ad,'accountId':_0x4da08b,'cachedAt':new Date()[_0x54b7ba(0xae)]()},_0x1883a4);}catch{}}export function parseEnvFile(_0x9a61e7){const _0x526be8=a55_0x359e31,_0x277336={};for(const _0x23a949 of _0x9a61e7[_0x526be8(0xa5)]('\x0a')){const _0x301382=_0x23a949['trim']();if(!_0x301382||_0x301382['startsWith']('#'))continue;const _0x1d873d=_0x301382[_0x526be8(0x85)](/^([^=]+)=(.*)$/);if(_0x1d873d){const _0x5ecb29=_0x1d873d[0x1][_0x526be8(0xce)]();let _0x1be6f9=_0x1d873d[0x2][_0x526be8(0xce)]();(_0x1be6f9[_0x526be8(0xbc)]('\x22')&&_0x1be6f9[_0x526be8(0x97)]('\x22')||_0x1be6f9[_0x526be8(0xbc)]('\x27')&&_0x1be6f9['endsWith']('\x27'))&&(_0x1be6f9=_0x1be6f9[_0x526be8(0x8f)](0x1,-0x1)),_0x277336[_0x5ecb29]=_0x1be6f9;}}return _0x277336;}export function readUserConfig(){const _0x4b7f49=a55_0x359e31,_0x5bf149=getConfigFile();if(!existsSync(_0x5bf149))return{};try{const _0x46a616=readFileSync(_0x5bf149,_0x4b7f49(0xc3));return parseEnvFile(_0x46a616);}catch(_0x375312){return console[_0x4b7f49(0xa2)](_0x4b7f49(0xd0)+_0x5bf149+':',_0x375312),{};}}export function resolveSite(_0x34b5e6){const _0x1f8ba1=a55_0x359e31,_0x32ad46=[_0x1f8ba1(0xcf),'ap01',_0x1f8ba1(0xb6),_0x1f8ba1(0xaa),_0x1f8ba1(0xca),'dev-us01',_0x1f8ba1(0x91),'stg-us01',_0x1f8ba1(0x9e),_0x1f8ba1(0x8e)];if(_0x32ad46[_0x1f8ba1(0xc0)](_0x34b5e6))return _0x34b5e6;if(_0x34b5e6 in SITE_ALIASES)return SITE_ALIASES[_0x34b5e6];return console[_0x1f8ba1(0xa2)]('Warning:\x20Unknown\x20site\x20\x27'+_0x34b5e6+_0x1f8ba1(0x8b)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x344974){const _0x34b6d1=a55_0x359e31,_0x574a07=_0x344974||getActiveProfileName()||undefined;if(_0x574a07){const _0xfd4894=_0x34b6d1(0xa9)+normalizeProfileForEnvVar(_0x574a07);if(process.env[_0xfd4894])return{'accessToken':process.env[_0xfd4894],'source':_0xfd4894+'\x20env\x20var'};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x34b6d1(0x90)};return null;}export function getAccessToken(_0x52bb21){const _0x23e53f=a55_0x359e31;return resolveAccessToken(_0x52bb21)?.[_0x23e53f(0xa1)];}export function getAPIKey(_0x1746e6){const _0xd29bb9=a55_0x359e31,_0x6779f6=_0x1746e6||getActiveProfileName();if(_0x6779f6){const _0x4bdd20=_0xd29bb9(0xc2)+normalizeProfileForEnvVar(_0x6779f6);if(process.env[_0x4bdd20])return process.env[_0x4bdd20];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x5b23e8){const _0x3d5f3d=a55_0x359e31;return _0x5b23e8['toUpperCase']()[_0x3d5f3d(0x9a)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x9ce827,_0x376d51){const _0x16b60d=a55_0x359e31,_0x25b5a5=resolveAccessToken(_0x376d51);if(_0x25b5a5)return{'apiKey':_0x25b5a5[_0x16b60d(0xa1)],'source':_0x25b5a5[_0x16b60d(0x9b)],'isDeprecated':![]};const _0x3d5dd6=_0x376d51||getActiveProfileName()||undefined;if(_0x3d5dd6){const _0x12017f=_0x16b60d(0xc2)+normalizeProfileForEnvVar(_0x3d5dd6);if(process.env[_0x12017f])return{'apiKey':process.env[_0x12017f],'source':_0x12017f+_0x16b60d(0x93),'isDeprecated':![]};const _0x157284=getCachedCredential(_0x9ce827,_0x3d5dd6);if(_0x157284)return{'apiKey':_0x157284,'source':_0x16b60d(0x82)+_0x3d5dd6+')','isDeprecated':![]};const _0x4b8cf9=await getKeychainAPIKey(_0x3d5dd6);if(_0x4b8cf9)return setCachedCredential(_0x4b8cf9,_0x9ce827,_0x3d5dd6),{'apiKey':_0x4b8cf9,'source':_0x16b60d(0x82)+_0x3d5dd6+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x16b60d(0xa4),'isDeprecated':![]};if(!_0x3d5dd6){const _0x55607d=getCachedCredential(_0x9ce827,undefined);if(_0x55607d)return{'apiKey':_0x55607d,'source':_0x16b60d(0x8d),'isDeprecated':![]};const _0xd3a1a1=await getKeychainAPIKey(undefined);if(_0xd3a1a1)return setCachedCredential(_0xd3a1a1,_0x9ce827,undefined),{'apiKey':_0xd3a1a1,'source':_0x16b60d(0x8d),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x63b29c,_0x23d7e9){const _0x58b18f=a55_0x359e31,_0x18a3d4=await resolveAPIKeyAsync(_0x63b29c,_0x23d7e9);return _0x18a3d4?.[_0x58b18f(0xab)];}function cleanupLegacyEnvFile(_0x10d1d5){const _0x2657cb=a55_0x359e31;if(!existsSync(_0x10d1d5))return![];try{const _0x48c523=readFileSync(_0x10d1d5,'utf-8'),_0x16d53f=_0x48c523['split']('\x0a'),_0x1b56d9=_0x16d53f[_0x2657cb(0x89)](_0x47eedf=>{const _0x168518=_0x2657cb,_0xcad52c=_0x47eedf[_0x168518(0xce)]();if(!_0xcad52c||_0xcad52c[_0x168518(0xbc)]('#'))return!![];const [_0x291bb3]=_0xcad52c[_0x168518(0xa5)]('=');return!_0x291bb3[_0x168518(0xbc)]('TD_API_KEY');}),_0x1fc2cb=_0x1b56d9[_0x2657cb(0xb0)](_0x1362e7=>{const _0x3ec219=_0x2657cb,_0x4a6cef=_0x1362e7[_0x3ec219(0xce)]();return _0x4a6cef&&!_0x4a6cef[_0x3ec219(0xbc)]('#');});if(!_0x1fc2cb)return unlinkSync(_0x10d1d5),!![];return writeFileSync(_0x10d1d5,_0x1b56d9[_0x2657cb(0xa0)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x270a20=a55_0x359e31;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x4ddc42=a55_0x5bf237[_0x270a20(0xa0)](getConfigDir(),'tdx.json');if(!a55_0x59f4e6['existsSync'](_0x4ddc42))return null;try{const _0x540003=a55_0x59f4e6[_0x270a20(0x99)](_0x4ddc42,_0x270a20(0xc3)),_0xecd36e=JSON[_0x270a20(0xc6)](_0x540003);return _0xecd36e[_0x270a20(0xbe)]||null;}catch{return null;}}export function saveAPIKey(_0x4bb22c,_0x4d7d47,_0x30d126){const _0x22d5b7=a55_0x359e31,_0x3146ca=getConfigDir(),_0x2fbd03=getConfigFilePath(_0x30d126);!existsSync(_0x3146ca)&&mkdirSync(_0x3146ca,{'recursive':!![],'mode':0x1c0});let _0x419b13={};if(existsSync(_0x2fbd03))try{const _0x19c81f=readFileSync(_0x2fbd03,_0x22d5b7(0xc3));_0x419b13=parseEnvFile(_0x19c81f);}catch(_0x4e7100){console[_0x22d5b7(0xa2)]('Warning:\x20Failed\x20to\x20read\x20'+_0x2fbd03+':',_0x4e7100);}const _0x3bc673=_0x4bb22c[_0x22d5b7(0x87)]()[_0x22d5b7(0x9a)](/-/g,'_');_0x419b13[_0x22d5b7(0x96)+_0x3bc673]=_0x4d7d47;const _0x5a0cbf=Object[_0x22d5b7(0xc8)](_0x419b13)[_0x22d5b7(0xbb)](([_0x5cc73a,_0x2a4c05])=>_0x5cc73a+'='+_0x2a4c05);writeFileSync(_0x2fbd03,_0x5a0cbf[_0x22d5b7(0xa0)]('\x0a')+'\x0a',{'mode':0x180});}function a55_0x4dfa(){const _0x4ef8b9=['some','name','ap01','83193TkfIUQ','proxy','tdx.json','eu01','1FOfVpG','release_channel','920CObeAl','stable','map','startsWith','14951832YKcDWS','profile','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','includes','clear','TDX_API_KEY_','utf-8','string','accountId','parse','number','entries','40243sLzudc','ap03','.env','next','read','trim','us01','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','3792547TBWWHS','keychain\x20(profile:\x20','16QKwAuS','config/account-info','match','6LxQlTI','toUpperCase','.json','filter','yellow','\x27,\x20defaulting\x20to\x20us01','1215254MyugRN','keychain','stg-ap03','slice','TDX_ACCESS_TOKEN\x20env\x20var','dev-eu01','llm_default_project','\x20env\x20var','path','3589398paxkCa','TD_API_KEY_','endsWith','config/llm-agent','readFileSync','replace','source','stringify','dev-us01','stg-ap01','.env.','join','accessToken','warn','apiKeys','TDX_API_KEY\x20env\x20var','split','write','20WAfXCm','existsSync','TDX_ACCESS_TOKEN_','ap02','apiKey','config/llm-project','projectId','toISOString','864545qoNawT'];a55_0x4dfa=function(){return _0x4ef8b9;};return a55_0x4dfa();}export async function saveAPIKeyAsync(_0x419bc6,_0x2fdada,_0x70ee32){const _0x3b3d8d=a55_0x359e31;await saveKeychainAPIKey(_0x419bc6,_0x70ee32),setCachedCredential(_0x419bc6,_0x2fdada,_0x70ee32);const _0x3158d4=getConfigFilePath(_0x70ee32);cleanupLegacyEnvFile(_0x3158d4)&&console[_0x3b3d8d(0xa2)](a55_0x305ae0[_0x3b3d8d(0x8a)](_0x3b3d8d(0xbf)));}export function loadConfig(){const _0x2403a1=a55_0x359e31,_0x3939f0={'apiKeys':{},'defaultSite':'us01'},_0xb49fc9=[_0x2403a1(0xcf),_0x2403a1(0xb2),_0x2403a1(0xb6),_0x2403a1(0xaa),_0x2403a1(0xca),_0x2403a1(0x9d),_0x2403a1(0x91),'stg-us01',_0x2403a1(0x9e),_0x2403a1(0x8e)],_0x4ae886=getAPIKey();if(_0x4ae886)for(const _0x791105 of _0xb49fc9){_0x3939f0[_0x2403a1(0xa3)][_0x791105]=_0x4ae886;}return _0x3939f0;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x2a60ef=a55_0x359e31,_0x5382e1=a55_0x5bf237[_0x2a60ef(0xa0)](getConfigDir(),_0x2a60ef(0xb5));if(!a55_0x59f4e6[_0x2a60ef(0xa8)](_0x5382e1))return undefined;try{const _0xe2903e=a55_0x59f4e6[_0x2a60ef(0x99)](_0x5382e1,_0x2a60ef(0xc3)),_0xdd0ff7=JSON[_0x2a60ef(0xc6)](_0xe2903e);return typeof _0xdd0ff7[_0x2a60ef(0xb4)]==='string'?_0xdd0ff7['proxy']:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x3f2ec2=a55_0x359e31,_0x17ed45=process.env.TDX_RELEASE_CHANNEL;if(_0x17ed45===_0x3f2ec2(0xcc)||_0x17ed45===_0x3f2ec2(0xba))return _0x17ed45;const _0x3fb158=a55_0x5bf237[_0x3f2ec2(0xa0)](getConfigDir(),_0x3f2ec2(0xb5));if(!a55_0x59f4e6[_0x3f2ec2(0xa8)](_0x3fb158))return _0x3f2ec2(0xba);try{const _0x1a6361=a55_0x59f4e6[_0x3f2ec2(0x99)](_0x3fb158,_0x3f2ec2(0xc3)),_0x18d3ba=JSON[_0x3f2ec2(0xc6)](_0x1a6361);if(_0x18d3ba[_0x3f2ec2(0xb8)]===_0x3f2ec2(0xcc))return _0x3f2ec2(0xcc);}catch{}return _0x3f2ec2(0xba);}export function saveReleaseChannel(_0x3df18a){const _0x10fd9f=a55_0x359e31,_0x37e17d=getConfigDir(),_0x49bfb1=a55_0x5bf237['join'](_0x37e17d,_0x10fd9f(0xb5));!existsSync(_0x37e17d)&&mkdirSync(_0x37e17d,{'recursive':!![],'mode':0x1c0});let _0x3352df={};if(existsSync(_0x49bfb1))try{const _0x5de0ce=readFileSync(_0x49bfb1,_0x10fd9f(0xc3));_0x3352df=JSON['parse'](_0x5de0ce);}catch{}_0x3352df[_0x10fd9f(0xb8)]=_0x3df18a,writeFileSync(_0x49bfb1,JSON[_0x10fd9f(0x9c)](_0x3352df,null,0x2),{'mode':0x180});}
1
+ const a55_0x31ef49=a55_0x2303;(function(_0x17aa5a,_0x4d49a0){const _0x15d312=a55_0x2303,_0x25c803=_0x17aa5a();while(!![]){try{const _0x350695=parseInt(_0x15d312(0x9d))/0x1*(-parseInt(_0x15d312(0xbd))/0x2)+-parseInt(_0x15d312(0x92))/0x3+-parseInt(_0x15d312(0x78))/0x4*(-parseInt(_0x15d312(0x96))/0x5)+parseInt(_0x15d312(0xaf))/0x6+parseInt(_0x15d312(0x89))/0x7+-parseInt(_0x15d312(0x97))/0x8+-parseInt(_0x15d312(0x9a))/0x9;if(_0x350695===_0x4d49a0)break;else _0x25c803['push'](_0x25c803['shift']());}catch(_0x3ab7e6){_0x25c803['push'](_0x25c803['shift']());}}}(a55_0x3f41,0x43c50));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a55_0x1a88dc from'node:fs';import*as a55_0x24c711 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 a55_0x4edcf4 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x30fa49=a55_0x2303;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x30fa49(0x7f),_0x30fa49(0xad));}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x15ffc0){const _0x20d354=a55_0x2303,_0x2e51f5=getConfigDir();return _0x15ffc0?a55_0x24c711['join'](_0x2e51f5,_0x20d354(0xa0)+_0x15ffc0):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a55_0x31ef49(0x86),'config/llm-project');export function getLLMProjectCacheFile(_0x2191a6){return llmProjectCache['path'](_0x2191a6);}export function readCachedLLMProject(_0x4fc152){const _0x47c00f=a55_0x31ef49,_0x3f25cc=llmProjectCache[_0x47c00f(0xc0)](_0x4fc152);if(_0x3f25cc&&typeof _0x3f25cc['id']===_0x47c00f(0xa5)&&typeof _0x3f25cc['name']==='string')return _0x3f25cc;return null;}export function writeCachedLLMProject(_0xd73c9f,_0x52afa0,_0xea7bde){const _0xb263ae=a55_0x31ef49;try{llmProjectCache[_0xb263ae(0x7e)]({'name':_0xd73c9f,'id':_0x52afa0},_0xea7bde);}catch{}}const llmAgentCache=createOptionalProfileCache(a55_0x31ef49(0x79),a55_0x31ef49(0x95));export function getLLMAgentCacheFile(_0x414ae6){return llmAgentCache['path'](_0x414ae6);}export function readCachedLLMAgent(_0x566bec){const _0x1b966c=a55_0x31ef49,_0x364a0f=llmAgentCache[_0x1b966c(0xc0)](_0x566bec);if(_0x364a0f&&typeof _0x364a0f['id']==='string'&&typeof _0x364a0f['name']==='string'&&typeof _0x364a0f['projectId']===_0x1b966c(0xa5))return _0x364a0f;return null;}export function writeCachedLLMAgent(_0x4b695e,_0x31b81c,_0x521fa9,_0x515884){try{llmAgentCache['write']({'name':_0x4b695e,'id':_0x31b81c,'projectId':_0x521fa9},_0x515884);}catch{}}export function clearCachedLLMAgent(_0x73d4f){const _0x13c5a7=a55_0x31ef49;try{llmAgentCache[_0x13c5a7(0x9b)](_0x73d4f);}catch{}}const accountInfoCache=createOptionalProfileCache(a55_0x31ef49(0xb6),a55_0x31ef49(0xb0),{'suffix':'.json'});export function getAccountInfoCacheFile(_0x244d8b){const _0x3a7af6=a55_0x31ef49;return accountInfoCache[_0x3a7af6(0xb9)](_0x244d8b);}function a55_0x2303(_0xa6b7e3,_0x50358c){_0xa6b7e3=_0xa6b7e3-0x77;const _0x3f415c=a55_0x3f41();let _0x230381=_0x3f415c[_0xa6b7e3];return _0x230381;}function a55_0x3f41(){const _0x281890=['read','keychain','36012bCBJzn','llm_default_agent','entries','site','accessToken','includes','write','.config','split','TD_API_KEY','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','startsWith','TDX_ACCESS_TOKEN\x20env\x20var','dev-eu01','llm_default_project','keychain\x20(profile:\x20','join','3011652ShHhlq','\x20env\x20var','toUpperCase','us01','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','profile','TDX_API_KEY_','map','yellow','880674ffSLEf','number','source','config/llm-agent','205ghqueu','1897384BQNlCZ','stg-us01','stg-ap03','1451583lYUjWh','clear','endsWith','1mSKXNG','\x27,\x20defaulting\x20to\x20us01','stringify','.env.','match','readFileSync','utf-8','replace','string','TD_API_KEY_','tdx.json','dev-us01','TDX_API_KEY\x20env\x20var','warn','ap03','eu01','tdx','proxy','1042596JuGklh','config/account-info','next','release_channel','ap01','slice','ap02','account_info','apiKeys','parse','path','toISOString','existsSync','stable','7046Ehhccw','trim','Warning:\x20Failed\x20to\x20read\x20'];a55_0x3f41=function(){return _0x281890;};return a55_0x3f41();}export function readCachedAccountInfo(_0x1ad421){const _0x4f382e=a55_0x31ef49,_0x385ba6=accountInfoCache[_0x4f382e(0xc0)](_0x1ad421);if(_0x385ba6&&typeof _0x385ba6[_0x4f382e(0x7b)]===_0x4f382e(0xa5)&&typeof _0x385ba6['accountId']===_0x4f382e(0x93))return _0x385ba6;return null;}export function writeCachedAccountInfo(_0x337830,_0x169877,_0x2da284){const _0x8b15ee=a55_0x31ef49;try{accountInfoCache[_0x8b15ee(0x7e)]({'site':_0x337830,'accountId':_0x169877,'cachedAt':new Date()[_0x8b15ee(0xba)]()},_0x2da284);}catch{}}export function parseEnvFile(_0x540753){const _0x5382ad=a55_0x31ef49,_0x23ca81={};for(const _0x3c5bee of _0x540753[_0x5382ad(0x80)]('\x0a')){const _0x237a7a=_0x3c5bee[_0x5382ad(0xbe)]();if(!_0x237a7a||_0x237a7a['startsWith']('#'))continue;const _0xa0ad54=_0x237a7a[_0x5382ad(0xa1)](/^([^=]+)=(.*)$/);if(_0xa0ad54){const _0x255cf0=_0xa0ad54[0x1]['trim']();let _0x27491f=_0xa0ad54[0x2][_0x5382ad(0xbe)]();(_0x27491f[_0x5382ad(0x83)]('\x22')&&_0x27491f['endsWith']('\x22')||_0x27491f['startsWith']('\x27')&&_0x27491f[_0x5382ad(0x9c)]('\x27'))&&(_0x27491f=_0x27491f[_0x5382ad(0xb4)](0x1,-0x1)),_0x23ca81[_0x255cf0]=_0x27491f;}}return _0x23ca81;}export function readUserConfig(){const _0x15b4e3=a55_0x31ef49,_0x171985=getConfigFile();if(!existsSync(_0x171985))return{};try{const _0x18059b=readFileSync(_0x171985,_0x15b4e3(0xa3));return parseEnvFile(_0x18059b);}catch(_0xbb15c){return console[_0x15b4e3(0xaa)](_0x15b4e3(0x82)+_0x171985+':',_0xbb15c),{};}}export function resolveSite(_0x1cd53c){const _0x2fb85a=a55_0x31ef49,_0x3da33e=['us01',_0x2fb85a(0xb3),_0x2fb85a(0xac),'ap02',_0x2fb85a(0xab),_0x2fb85a(0xa8),_0x2fb85a(0x85),_0x2fb85a(0x98),'stg-ap01',_0x2fb85a(0x99)];if(_0x3da33e[_0x2fb85a(0x7d)](_0x1cd53c))return _0x1cd53c;if(_0x1cd53c in SITE_ALIASES)return SITE_ALIASES[_0x1cd53c];return console[_0x2fb85a(0xaa)]('Warning:\x20Unknown\x20site\x20\x27'+_0x1cd53c+_0x2fb85a(0x9e)),_0x2fb85a(0x8c);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x332075){const _0x2f4290=a55_0x31ef49,_0x421264=_0x332075||getActiveProfileName()||undefined;if(_0x421264){const _0x16f224='TDX_ACCESS_TOKEN_'+normalizeProfileForEnvVar(_0x421264);if(process.env[_0x16f224])return{'accessToken':process.env[_0x16f224],'source':_0x16f224+_0x2f4290(0x8a)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x2f4290(0x84)};return null;}export function getAccessToken(_0x5d4abf){const _0x185832=a55_0x31ef49;return resolveAccessToken(_0x5d4abf)?.[_0x185832(0x7c)];}export function getAPIKey(_0x115b9f){const _0x31fd1c=a55_0x31ef49,_0x17e76c=_0x115b9f||getActiveProfileName();if(_0x17e76c){const _0x359936=_0x31fd1c(0x8f)+normalizeProfileForEnvVar(_0x17e76c);if(process.env[_0x359936])return process.env[_0x359936];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x4d1574){const _0x121acc=a55_0x31ef49;return _0x4d1574[_0x121acc(0x8b)]()[_0x121acc(0xa4)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x54bdd8,_0x4d0090){const _0x25977f=a55_0x31ef49,_0x8ebba4=resolveAccessToken(_0x4d0090);if(_0x8ebba4)return{'apiKey':_0x8ebba4[_0x25977f(0x7c)],'source':_0x8ebba4[_0x25977f(0x94)],'isDeprecated':![]};const _0x34bebf=_0x4d0090||getActiveProfileName()||undefined;if(_0x34bebf){const _0x20be0f='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x34bebf);if(process.env[_0x20be0f])return{'apiKey':process.env[_0x20be0f],'source':_0x20be0f+_0x25977f(0x8a),'isDeprecated':![]};const _0x4e0eb2=getCachedCredential(_0x54bdd8,_0x34bebf);if(_0x4e0eb2)return{'apiKey':_0x4e0eb2,'source':_0x25977f(0x87)+_0x34bebf+')','isDeprecated':![]};const _0x1941d4=await getKeychainAPIKey(_0x34bebf);if(_0x1941d4)return setCachedCredential(_0x1941d4,_0x54bdd8,_0x34bebf),{'apiKey':_0x1941d4,'source':'keychain\x20(profile:\x20'+_0x34bebf+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x25977f(0xa9),'isDeprecated':![]};if(!_0x34bebf){const _0x3ec5e0=getCachedCredential(_0x54bdd8,undefined);if(_0x3ec5e0)return{'apiKey':_0x3ec5e0,'source':'keychain','isDeprecated':![]};const _0x49e10c=await getKeychainAPIKey(undefined);if(_0x49e10c)return setCachedCredential(_0x49e10c,_0x54bdd8,undefined),{'apiKey':_0x49e10c,'source':_0x25977f(0x77),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x32c9e1,_0xf22ebd){const _0x11dfb5=await resolveAPIKeyAsync(_0x32c9e1,_0xf22ebd);return _0x11dfb5?.['apiKey'];}function cleanupLegacyEnvFile(_0x13b340){const _0x774c6e=a55_0x31ef49;if(!existsSync(_0x13b340))return![];try{const _0x47ef22=readFileSync(_0x13b340,_0x774c6e(0xa3)),_0x3d3a90=_0x47ef22[_0x774c6e(0x80)]('\x0a'),_0x38d0cf=_0x3d3a90['filter'](_0x5a20d9=>{const _0x59aef4=_0x774c6e,_0x6de9ed=_0x5a20d9[_0x59aef4(0xbe)]();if(!_0x6de9ed||_0x6de9ed[_0x59aef4(0x83)]('#'))return!![];const [_0x4b3f60]=_0x6de9ed[_0x59aef4(0x80)]('=');return!_0x4b3f60[_0x59aef4(0x83)](_0x59aef4(0x81));}),_0x3a8a49=_0x38d0cf['some'](_0x59c0a1=>{const _0x27ea06=_0x774c6e,_0x54b549=_0x59c0a1[_0x27ea06(0xbe)]();return _0x54b549&&!_0x54b549[_0x27ea06(0x83)]('#');});if(!_0x3a8a49)return unlinkSync(_0x13b340),!![];return writeFileSync(_0x13b340,_0x38d0cf['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x194f60=a55_0x31ef49;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x2a4697=a55_0x24c711[_0x194f60(0x88)](getConfigDir(),_0x194f60(0xa7));if(!a55_0x1a88dc[_0x194f60(0xbb)](_0x2a4697))return null;try{const _0x4dd703=a55_0x1a88dc['readFileSync'](_0x2a4697,'utf-8'),_0xbe421d=JSON[_0x194f60(0xb8)](_0x4dd703);return _0xbe421d[_0x194f60(0x8e)]||null;}catch{return null;}}export function saveAPIKey(_0x385da5,_0x511046,_0xb5a72a){const _0x464a8e=a55_0x31ef49,_0x5d9823=getConfigDir(),_0x44e46f=getConfigFilePath(_0xb5a72a);!existsSync(_0x5d9823)&&mkdirSync(_0x5d9823,{'recursive':!![],'mode':0x1c0});let _0x4bcaa1={};if(existsSync(_0x44e46f))try{const _0x57a0eb=readFileSync(_0x44e46f,'utf-8');_0x4bcaa1=parseEnvFile(_0x57a0eb);}catch(_0x1d49b0){console[_0x464a8e(0xaa)](_0x464a8e(0xbf)+_0x44e46f+':',_0x1d49b0);}const _0x232f1f=_0x385da5[_0x464a8e(0x8b)]()['replace'](/-/g,'_');_0x4bcaa1[_0x464a8e(0xa6)+_0x232f1f]=_0x511046;const _0x1a910f=Object[_0x464a8e(0x7a)](_0x4bcaa1)[_0x464a8e(0x90)](([_0x26942b,_0x4685d9])=>_0x26942b+'='+_0x4685d9);writeFileSync(_0x44e46f,_0x1a910f['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x387953,_0x2afb9b,_0x1a9417){const _0x5f167f=a55_0x31ef49;await saveKeychainAPIKey(_0x387953,_0x1a9417),setCachedCredential(_0x387953,_0x2afb9b,_0x1a9417);const _0x271b35=getConfigFilePath(_0x1a9417);cleanupLegacyEnvFile(_0x271b35)&&console[_0x5f167f(0xaa)](a55_0x4edcf4[_0x5f167f(0x91)](_0x5f167f(0x8d)));}export function loadConfig(){const _0x2bf080=a55_0x31ef49,_0x44c584={'apiKeys':{},'defaultSite':'us01'},_0x316993=[_0x2bf080(0x8c),_0x2bf080(0xb3),_0x2bf080(0xac),_0x2bf080(0xb5),'ap03',_0x2bf080(0xa8),_0x2bf080(0x85),'stg-us01','stg-ap01','stg-ap03'],_0x59fe72=getAPIKey();if(_0x59fe72)for(const _0x5d25bb of _0x316993){_0x44c584[_0x2bf080(0xb7)][_0x5d25bb]=_0x59fe72;}return _0x44c584;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x137f3e=a55_0x31ef49,_0x101e15=a55_0x24c711[_0x137f3e(0x88)](getConfigDir(),_0x137f3e(0xa7));if(!a55_0x1a88dc[_0x137f3e(0xbb)](_0x101e15))return undefined;try{const _0x46282f=a55_0x1a88dc[_0x137f3e(0xa2)](_0x101e15,_0x137f3e(0xa3)),_0x40e114=JSON['parse'](_0x46282f);return typeof _0x40e114[_0x137f3e(0xae)]==='string'?_0x40e114['proxy']:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x5ac003=a55_0x31ef49,_0x2c80b6=process.env.TDX_RELEASE_CHANNEL;if(_0x2c80b6===_0x5ac003(0xb1)||_0x2c80b6===_0x5ac003(0xbc))return _0x2c80b6;const _0x38a33f=a55_0x24c711[_0x5ac003(0x88)](getConfigDir(),'tdx.json');if(!a55_0x1a88dc[_0x5ac003(0xbb)](_0x38a33f))return _0x5ac003(0xbc);try{const _0x273fa0=a55_0x1a88dc[_0x5ac003(0xa2)](_0x38a33f,_0x5ac003(0xa3)),_0x47419f=JSON[_0x5ac003(0xb8)](_0x273fa0);if(_0x47419f[_0x5ac003(0xb2)]==='next')return'next';}catch{}return _0x5ac003(0xbc);}export function saveReleaseChannel(_0x3f8655){const _0x3ab9a5=a55_0x31ef49,_0x471b74=getConfigDir(),_0x444fb=a55_0x24c711[_0x3ab9a5(0x88)](_0x471b74,_0x3ab9a5(0xa7));!existsSync(_0x471b74)&&mkdirSync(_0x471b74,{'recursive':!![],'mode':0x1c0});let _0x3c5035={};if(existsSync(_0x444fb))try{const _0x43ade9=readFileSync(_0x444fb,_0x3ab9a5(0xa3));_0x3c5035=JSON['parse'](_0x43ade9);}catch{}_0x3c5035[_0x3ab9a5(0xb2)]=_0x3f8655,writeFileSync(_0x444fb,JSON[_0x3ab9a5(0x9f)](_0x3c5035,null,0x2),{'mode':0x180});}
@@ -1 +1 @@
1
- const a56_0x418ed4=a56_0x3a12;(function(_0x2f37b1,_0x4e08bf){const _0x3fcab0=a56_0x3a12,_0x590ab3=_0x2f37b1();while(!![]){try{const _0x3e2a22=-parseInt(_0x3fcab0(0x106))/0x1*(parseInt(_0x3fcab0(0xfe))/0x2)+-parseInt(_0x3fcab0(0xfc))/0x3+-parseInt(_0x3fcab0(0xff))/0x4*(parseInt(_0x3fcab0(0x100))/0x5)+parseInt(_0x3fcab0(0x102))/0x6+parseInt(_0x3fcab0(0x104))/0x7+parseInt(_0x3fcab0(0xfb))/0x8+parseInt(_0x3fcab0(0xfd))/0x9;if(_0x3e2a22===_0x4e08bf)break;else _0x590ab3['push'](_0x590ab3['shift']());}catch(_0x335759){_0x590ab3['push'](_0x590ab3['shift']());}}}(a56_0x50ba,0x9e3c8));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a56_0x418ed4(0x103),a56_0x418ed4(0x108));export function loadCachedConnections(_0x504940){const _0x358dc6=a56_0x418ed4,_0x1f1281=connectionCache[_0x358dc6(0x101)](_0x504940);return _0x1f1281?.[_0x358dc6(0x105)]??null;}function a56_0x3a12(_0x85f89f,_0x46ef2c){_0x85f89f=_0x85f89f-0xfb;const _0x50ba2b=a56_0x50ba();let _0x3a12d2=_0x50ba2b[_0x85f89f];return _0x3a12d2;}function a56_0x50ba(){const _0x4ca0eb=['read','875376pAAutw','connections-{profile}.json','919009PpfRdf','connections','987659ePmSNW','write','core/connection-cache','3236384cKUogj','3884217GPXDHX','25805718oASDUr','2EPQpPD','28RyEpXD','441785qeGmuA'];a56_0x50ba=function(){return _0x4ca0eb;};return a56_0x50ba();}export function saveCachedConnections(_0x2a5d0d,_0x55ce7a){const _0x3d76c2=a56_0x418ed4;connectionCache[_0x3d76c2(0x107)](_0x2a5d0d,{'connections':_0x55ce7a,'cachedAt':Date['now']()});}export function clearConnectionCache(_0x253fae){connectionCache['clear'](_0x253fae);}
1
+ const a56_0x4d8747=a56_0x5dea;(function(_0x95801e,_0x4b6ced){const _0x498db0=a56_0x5dea,_0x577374=_0x95801e();while(!![]){try{const _0x99e695=-parseInt(_0x498db0(0x128))/0x1*(-parseInt(_0x498db0(0x122))/0x2)+-parseInt(_0x498db0(0x123))/0x3*(parseInt(_0x498db0(0x125))/0x4)+parseInt(_0x498db0(0x12b))/0x5+parseInt(_0x498db0(0x127))/0x6+parseInt(_0x498db0(0x124))/0x7*(-parseInt(_0x498db0(0x12c))/0x8)+parseInt(_0x498db0(0x121))/0x9+parseInt(_0x498db0(0x129))/0xa*(-parseInt(_0x498db0(0x126))/0xb);if(_0x99e695===_0x4b6ced)break;else _0x577374['push'](_0x577374['shift']());}catch(_0x2a27d1){_0x577374['push'](_0x577374['shift']());}}}(a56_0x2399,0xd2fae));function a56_0x2399(){const _0x5d5381=['1735324QvippL','6PCRTSk','8099035BzSoUm','1292464bseokP','11649VIIxNd','10078878twMNRU','1xsAGae','14390fEAjtZ','connections-{profile}.json','3122805zIcJak','8MPlvCw','clear','core/connection-cache','write','9173484CPData'];a56_0x2399=function(){return _0x5d5381;};return a56_0x2399();}import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a56_0x4d8747(0x12a),a56_0x4d8747(0x12e));function a56_0x5dea(_0x48f59e,_0x19dcf2){_0x48f59e=_0x48f59e-0x121;const _0x2399f2=a56_0x2399();let _0x5dea4f=_0x2399f2[_0x48f59e];return _0x5dea4f;}export function loadCachedConnections(_0x9a5184){const _0x59ed15=connectionCache['read'](_0x9a5184);return _0x59ed15?.['connections']??null;}export function saveCachedConnections(_0x1da375,_0x29719b){const _0x4e2431=a56_0x4d8747;connectionCache[_0x4e2431(0x12f)](_0x1da375,{'connections':_0x29719b,'cachedAt':Date['now']()});}export function clearConnectionCache(_0x3fa058){const _0x145a39=a56_0x4d8747;connectionCache[_0x145a39(0x12d)](_0x3fa058);}
@@ -1 +1 @@
1
- const a57_0x132b0d=a57_0x13b2;function a57_0x13b2(_0x380fc6,_0x408718){_0x380fc6=_0x380fc6-0xe4;const _0x4ea8f8=a57_0x4ea8();let _0x13b263=_0x4ea8f8[_0x380fc6];return _0x13b263;}(function(_0x5a9368,_0x562593){const _0x374b2a=a57_0x13b2,_0x292de4=_0x5a9368();while(!![]){try{const _0x3cfb7e=parseInt(_0x374b2a(0xfb))/0x1+parseInt(_0x374b2a(0xf1))/0x2+parseInt(_0x374b2a(0xf4))/0x3*(parseInt(_0x374b2a(0xe9))/0x4)+-parseInt(_0x374b2a(0xfa))/0x5+parseInt(_0x374b2a(0xe6))/0x6+-parseInt(_0x374b2a(0xf3))/0x7+-parseInt(_0x374b2a(0xe4))/0x8;if(_0x3cfb7e===_0x562593)break;else _0x292de4['push'](_0x292de4['shift']());}catch(_0x4e7c96){_0x292de4['push'](_0x292de4['shift']());}}}(a57_0x4ea8,0x57e41));import a57_0x4e707b from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;function a57_0x4ea8(){const _0x2545de=['ap01','other','site','527352pvOSJt','length','2039968hbcEzH','1940256wlLVKv','push','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','ap02\x20-\x20Korea','Enter\x20custom\x20site','Site\x20name\x20cannot\x20be\x20empty','132970fOTvGO','161451oznFuI','us01','number','findIndex','text','value','8834288rlBLmK','select','4262556unBUrC','Select\x20your\x20Treasure\x20Data\x20site:','log','4PwgRiD','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','customSite','trim','eu01'];a57_0x4ea8=function(){return _0x2545de;};return a57_0x4ea8();}export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x1833f8,_0x443a26){const _0x1fb456=a57_0x13b2;if(_0x1833f8===undefined)return _0x443a26;if(typeof _0x1833f8===_0x1fb456(0xfd))return _0x1833f8;return parseInt(_0x1833f8,0xa);}export const STANDARD_SITE_CHOICES=[{'title':'us\x20\x20\x20-\x20United\x20States','value':'us01'},{'title':'jp\x20\x20\x20-\x20Japan','value':a57_0x132b0d(0xee)},{'title':'eu\x20\x20\x20-\x20Europe','value':a57_0x132b0d(0xed)},{'title':a57_0x132b0d(0xf7),'value':'ap02'}];export function buildSiteChoices(_0x3df50e){const _0x286ac3=a57_0x132b0d,_0x92636f=[...STANDARD_SITE_CHOICES];let _0x37b599=_0x92636f[_0x286ac3(0xfe)](_0x304929=>_0x304929[_0x286ac3(0x100)]===_0x3df50e);return _0x37b599===-0x1&&_0x3df50e!==_0x286ac3(0xfc)&&(_0x92636f[_0x286ac3(0xf5)]({'title':_0x3df50e,'value':_0x3df50e}),_0x37b599=_0x92636f[_0x286ac3(0xf2)]-0x1),_0x92636f[_0x286ac3(0xf5)]({'title':_0x286ac3(0xf8),'value':_0x286ac3(0xef)}),{'choices':_0x92636f,'initialIndex':_0x37b599>=0x0?_0x37b599:0x0};}export async function promptSiteSelection(_0xebda59,_0x2006f8,_0x554d62='Cancelled'){const _0x1dca10=a57_0x132b0d,{choices:_0x281955,initialIndex:_0x18b162}=buildSiteChoices(_0xebda59),_0x162136=_0x2006f8?_0x1dca10(0xea)+_0x2006f8+'):':_0x1dca10(0xe7),_0x3305ee=await a57_0x4e707b({'type':_0x1dca10(0xe5),'name':_0x1dca10(0xf0),'message':_0x162136,'choices':_0x281955,'initial':_0x18b162});if(!_0x3305ee[_0x1dca10(0xf0)])return console['log']('\x0a'+_0x554d62),null;if(_0x3305ee[_0x1dca10(0xf0)]!==_0x1dca10(0xef))return _0x3305ee[_0x1dca10(0xf0)];const _0x5bffa1=await a57_0x4e707b({'type':_0x1dca10(0xff),'name':_0x1dca10(0xeb),'message':'Enter\x20site\x20name:','initial':_0x1dca10(0xfc),'validate':_0x2a75c2=>{const _0x31662f=_0x1dca10;if(!_0x2a75c2||!_0x2a75c2['trim']())return _0x31662f(0xf9);if(!/^[a-z0-9-]+$/['test'](_0x2a75c2[_0x31662f(0xec)]()))return _0x31662f(0xf6);return!![];}});if(!_0x5bffa1[_0x1dca10(0xeb)])return console[_0x1dca10(0xe8)]('\x0a'+_0x554d62),null;return _0x5bffa1[_0x1dca10(0xeb)];}
1
+ const a57_0x5a9660=a57_0x2961;(function(_0x172aca,_0x7258e2){const _0x8f690c=a57_0x2961,_0x4fb029=_0x172aca();while(!![]){try{const _0x68f35b=parseInt(_0x8f690c(0x96))/0x1*(-parseInt(_0x8f690c(0x95))/0x2)+-parseInt(_0x8f690c(0x9d))/0x3+parseInt(_0x8f690c(0xa0))/0x4*(parseInt(_0x8f690c(0xa1))/0x5)+parseInt(_0x8f690c(0xa8))/0x6+-parseInt(_0x8f690c(0xa7))/0x7*(-parseInt(_0x8f690c(0xa9))/0x8)+parseInt(_0x8f690c(0x8f))/0x9*(parseInt(_0x8f690c(0x9c))/0xa)+-parseInt(_0x8f690c(0x9b))/0xb;if(_0x68f35b===_0x7258e2)break;else _0x4fb029['push'](_0x4fb029['shift']());}catch(_0xa2789f){_0x4fb029['push'](_0x4fb029['shift']());}}}(a57_0x55d2,0x6b170));import a57_0x110fdc from'prompts';function a57_0x2961(_0x140372,_0x580b87){_0x140372=_0x140372-0x8d;const _0x55d285=a57_0x55d2();let _0x2961fa=_0x55d285[_0x140372];return _0x2961fa;}export const DEFAULT_DISPLAY_LIMIT=0x28;function a57_0x55d2(){const _0xa8eedb=['us\x20\x20\x20-\x20United\x20States','Enter\x20custom\x20site','value','762706RoPQgn','1UyZhSt','eu01','eu\x20\x20\x20-\x20Europe','length','us01','7239551GRqnhW','6657440rXHpcJ','1933353uVYvcC','ap01','Site\x20name\x20cannot\x20be\x20empty','8yUdOmR','985155klhLYD','push','Select\x20your\x20Treasure\x20Data\x20site:','site','select','customSite','7XOcKkI','4061064rUaIWG','3087480SWNaTM','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','number','Cancelled','trim','log','9ohEpOX','other','test'];a57_0x55d2=function(){return _0xa8eedb;};return a57_0x55d2();}export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x12bfd5,_0x35bdea){const _0x15e249=a57_0x2961;if(_0x12bfd5===undefined)return _0x35bdea;if(typeof _0x12bfd5===_0x15e249(0xab))return _0x12bfd5;return parseInt(_0x12bfd5,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a57_0x5a9660(0x92),'value':a57_0x5a9660(0x9a)},{'title':'jp\x20\x20\x20-\x20Japan','value':a57_0x5a9660(0x9e)},{'title':a57_0x5a9660(0x98),'value':a57_0x5a9660(0x97)},{'title':'ap02\x20-\x20Korea','value':'ap02'}];export function buildSiteChoices(_0x2feddc){const _0x29325b=a57_0x5a9660,_0x161601=[...STANDARD_SITE_CHOICES];let _0xf8d2e0=_0x161601['findIndex'](_0x3ed0f1=>_0x3ed0f1[_0x29325b(0x94)]===_0x2feddc);return _0xf8d2e0===-0x1&&_0x2feddc!==_0x29325b(0x9a)&&(_0x161601[_0x29325b(0xa2)]({'title':_0x2feddc,'value':_0x2feddc}),_0xf8d2e0=_0x161601[_0x29325b(0x99)]-0x1),_0x161601['push']({'title':_0x29325b(0x93),'value':_0x29325b(0x90)}),{'choices':_0x161601,'initialIndex':_0xf8d2e0>=0x0?_0xf8d2e0:0x0};}export async function promptSiteSelection(_0x4a7803,_0x3fef38,_0x23cd30=a57_0x5a9660(0xac)){const _0x403342=a57_0x5a9660,{choices:_0x2f5461,initialIndex:_0x43421c}=buildSiteChoices(_0x4a7803),_0x319b69=_0x3fef38?_0x403342(0xaa)+_0x3fef38+'):':_0x403342(0xa3),_0x3e4350=await a57_0x110fdc({'type':_0x403342(0xa5),'name':_0x403342(0xa4),'message':_0x319b69,'choices':_0x2f5461,'initial':_0x43421c});if(!_0x3e4350['site'])return console['log']('\x0a'+_0x23cd30),null;if(_0x3e4350[_0x403342(0xa4)]!=='other')return _0x3e4350[_0x403342(0xa4)];const _0x500258=await a57_0x110fdc({'type':'text','name':'customSite','message':'Enter\x20site\x20name:','initial':'us01','validate':_0x3401cb=>{const _0xccfdbe=_0x403342;if(!_0x3401cb||!_0x3401cb['trim']())return _0xccfdbe(0x9f);if(!/^[a-z0-9-]+$/[_0xccfdbe(0x91)](_0x3401cb[_0xccfdbe(0x8d)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x500258[_0x403342(0xa6)])return console[_0x403342(0x8e)]('\x0a'+_0x23cd30),null;return _0x500258[_0x403342(0xa6)];}
@@ -1 +1 @@
1
- (function(_0x142444,_0x121b31){const _0x14cc9b=a58_0x2b7f,_0x4e0a61=_0x142444();while(!![]){try{const _0x14ec86=parseInt(_0x14cc9b(0x172))/0x1*(parseInt(_0x14cc9b(0x166))/0x2)+-parseInt(_0x14cc9b(0x174))/0x3+parseInt(_0x14cc9b(0x16f))/0x4+parseInt(_0x14cc9b(0x164))/0x5+-parseInt(_0x14cc9b(0x170))/0x6+-parseInt(_0x14cc9b(0x16c))/0x7*(-parseInt(_0x14cc9b(0x16a))/0x8)+parseInt(_0x14cc9b(0x173))/0x9;if(_0x14ec86===_0x121b31)break;else _0x4e0a61['push'](_0x4e0a61['shift']());}catch(_0x34ab63){_0x4e0a61['push'](_0x4e0a61['shift']());}}}(a58_0x5abf,0x4c3dd));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a58_0x2b7f(_0x5a5f7b,_0x5bdc89){_0x5a5f7b=_0x5a5f7b-0x164;const _0x5abf97=a58_0x5abf();let _0x2b7fc3=_0x5abf97[_0x5a5f7b];return _0x2b7fc3;}function getCacheKey(_0x12af63,_0x3761cf){const _0x589a24=a58_0x2b7f,_0x4ab15c=_0x12af63||_0x589a24(0x167),_0x1818cf=_0x3761cf||_0x589a24(0x169);return _0x4ab15c+':'+_0x1818cf;}export function getCachedCredential(_0x2372c5,_0x5a6df0){const _0x9a0771=a58_0x2b7f,_0x4cd668=getCacheKey(_0x2372c5,_0x5a6df0),_0x3c6da6=cache[_0x9a0771(0x168)](_0x4cd668);if(!_0x3c6da6)return null;if(Date['now']()-_0x3c6da6['loadedAt']>CACHE_TTL_MS)return cache['delete'](_0x4cd668),null;return _0x3c6da6[_0x9a0771(0x16b)];}export function setCachedCredential(_0x276ec5,_0xc7ac0a,_0x1f9876){const _0x15c1b2=a58_0x2b7f,_0x1872d1=getCacheKey(_0xc7ac0a,_0x1f9876);cache[_0x15c1b2(0x16e)](_0x1872d1,{'apiKey':_0x276ec5,'loadedAt':Date[_0x15c1b2(0x171)]()});}export function clearCredentialCache(){const _0xc6f01e=a58_0x2b7f;cache[_0xc6f01e(0x16d)]();}export function clearCachedCredential(_0x49efda,_0x115fc3){const _0x11aec5=a58_0x2b7f,_0x35695d=getCacheKey(_0x49efda,_0x115fc3);cache[_0x11aec5(0x165)](_0x35695d);}function a58_0x5abf(){const _0x3b526c=['935712XXJvAF','1835274IckJaH','now','31985WkpuLc','1351881EZuzkH','1547292zGaAaq','2395195fxrDOT','delete','14QZmmiP','__default_site__','get','__default_profile__','8ImbBPg','apiKey','327999GgavWf','clear','set'];a58_0x5abf=function(){return _0x3b526c;};return a58_0x5abf();}
1
+ (function(_0x296df1,_0x164b1d){const _0x167696=a58_0x48c6,_0x29d4ae=_0x296df1();while(!![]){try{const _0x51023a=-parseInt(_0x167696(0x14d))/0x1*(parseInt(_0x167696(0x153))/0x2)+parseInt(_0x167696(0x149))/0x3*(-parseInt(_0x167696(0x151))/0x4)+-parseInt(_0x167696(0x14f))/0x5+parseInt(_0x167696(0x154))/0x6*(parseInt(_0x167696(0x142))/0x7)+-parseInt(_0x167696(0x145))/0x8*(-parseInt(_0x167696(0x148))/0x9)+-parseInt(_0x167696(0x150))/0xa+parseInt(_0x167696(0x14e))/0xb*(parseInt(_0x167696(0x14a))/0xc);if(_0x51023a===_0x164b1d)break;else _0x29d4ae['push'](_0x29d4ae['shift']());}catch(_0x141df8){_0x29d4ae['push'](_0x29d4ae['shift']());}}}(a58_0x1676,0x2bc2c));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x328187,_0x1e5490){const _0x543c6f=a58_0x48c6,_0xf32b7e=_0x328187||'__default_site__',_0x52ddfa=_0x1e5490||_0x543c6f(0x146);return _0xf32b7e+':'+_0x52ddfa;}function a58_0x1676(){const _0x1b3700=['120eAEHdn','51695CsSnQW','loadedAt','get','562808xhcZEV','__default_profile__','set','9lRWtsP','39684gHBSAt','852YHmadj','clear','delete','209851FXuYlZ','126071nIzyFZ','152115VytqIX','3344760nXdYIn','84nxfpjg','now','2Quvlmv'];a58_0x1676=function(){return _0x1b3700;};return a58_0x1676();}export function getCachedCredential(_0x2b4a27,_0x338d63){const _0x4743cf=a58_0x48c6,_0x52dd0d=getCacheKey(_0x2b4a27,_0x338d63),_0x161133=cache[_0x4743cf(0x144)](_0x52dd0d);if(!_0x161133)return null;if(Date[_0x4743cf(0x152)]()-_0x161133[_0x4743cf(0x143)]>CACHE_TTL_MS)return cache[_0x4743cf(0x14c)](_0x52dd0d),null;return _0x161133['apiKey'];}export function setCachedCredential(_0x16343d,_0x399636,_0x4ee244){const _0x5795cb=a58_0x48c6,_0xc7796c=getCacheKey(_0x399636,_0x4ee244);cache[_0x5795cb(0x147)](_0xc7796c,{'apiKey':_0x16343d,'loadedAt':Date[_0x5795cb(0x152)]()});}export function clearCredentialCache(){const _0x1585ef=a58_0x48c6;cache[_0x1585ef(0x14b)]();}function a58_0x48c6(_0x3732ba,_0x35eaef){_0x3732ba=_0x3732ba-0x142;const _0x16764e=a58_0x1676();let _0x48c697=_0x16764e[_0x3732ba];return _0x48c697;}export function clearCachedCredential(_0x200f35,_0x160f69){const _0x1203b4=a58_0x48c6,_0x5c272f=getCacheKey(_0x200f35,_0x160f69);cache[_0x1203b4(0x14c)](_0x5c272f);}
@@ -1 +1 @@
1
- function a59_0x5479(){const _0x2af5d0=['display','segment_path','configFiles','tdx.json','config','none','database','profiles','478PuuWSX','logLevel','4080920UTFVuX','Session','getParameters','workflowProject','site','(using\x20session:\x20','Global','displayWithSources','readFileSync','getSource','env','llm_agent','replace','9KpFSag','parent_segment','createAsync','utf-8','4kpumzR','assign','cyan','loadGlobalConfig','activeProfile','project','workflow_project','default','resolveAPIKeyAsync','join','parentSegment','(session:\x20','(active)','463965befwwd','dim','bold','accessToken','sessionId','Profile\x20Credentials','apiKey','CLI\x20flag:\x20--','INFO','11swuuWI','profileCredentials','profile','250jmBsXe','not\x20set','session','.json','parse','proxy','verbose','.env','globalCredentials','1705900nkiFMB','string','[context]','llm_project','4228959VqZfGq','access_token','5299bchBMj','global','us01','llmProject','sessions','982896RtYMBa','injectIntoOptions','segmentPath','6096mtSVFk','layers','llmAgent','profileSource','cliFlags','Global\x20Credentials','Project','log','existsSync'];a59_0x5479=function(){return _0x2af5d0;};return a59_0x5479();}const a59_0x1b5d74=a59_0x2696;(function(_0x107113,_0x41b722){const _0x5123ab=a59_0x2696,_0x25e221=_0x107113();while(!![]){try{const _0xe2bc08=parseInt(_0x5123ab(0x10d))/0x1*(-parseInt(_0x5123ab(0x135))/0x2)+-parseInt(_0x5123ab(0x11a))/0x3*(-parseInt(_0x5123ab(0x148))/0x4)+-parseInt(_0x5123ab(0x101))/0x5+parseInt(_0x5123ab(0x124))/0x6*(-parseInt(_0x5123ab(0x11c))/0x7)+parseInt(_0x5123ab(0x137))/0x8*(parseInt(_0x5123ab(0x144))/0x9)+-parseInt(_0x5123ab(0x116))/0xa+-parseInt(_0x5123ab(0x10a))/0xb*(parseInt(_0x5123ab(0x121))/0xc);if(_0xe2bc08===_0x41b722)break;else _0x25e221['push'](_0x25e221['shift']());}catch(_0x1b224f){_0x25e221['push'](_0x25e221['shift']());}}}(a59_0x5479,0xb608f));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';import{getOAuthTokens}from'./oauth-keychain.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';function a59_0x2696(_0x301805,_0x132c3e){_0x301805=_0x301805-0xf6;const _0x547991=a59_0x5479();let _0x2696d5=_0x547991[_0x301805];return _0x2696d5;}import*as a59_0x81a4e3 from'node:fs';import*as a59_0x558544 from'node:path';import a59_0x36d565 from'chalk';export class GlobalContext{['site'];[a59_0x1b5d74(0x133)];[a59_0x1b5d74(0x145)];['segment_path'];['llm_project'];['llm_agent'];[a59_0x1b5d74(0xfa)];[a59_0x1b5d74(0x107)];[a59_0x1b5d74(0x104)];['proxy'];[a59_0x1b5d74(0x113)];['logLevel'];[a59_0x1b5d74(0x10c)];[a59_0x1b5d74(0x127)]=null;[a59_0x1b5d74(0x125)];[a59_0x1b5d74(0xf8)];[a59_0x1b5d74(0x105)];[a59_0x1b5d74(0x12f)];constructor(_0x344c42){const _0x7e5a0f=a59_0x1b5d74;this[_0x7e5a0f(0x105)]=getSessionID(_0x344c42[_0x7e5a0f(0x10f)]);const _0x361e44=loadSessionContext(_0x344c42[_0x7e5a0f(0x10f)]),_0x4462ca=loadProjectConfig(),_0x300823=this['loadGlobalConfig']();if(_0x344c42[_0x7e5a0f(0x10c)])this['activeProfile']=_0x344c42[_0x7e5a0f(0x10c)],this[_0x7e5a0f(0x127)]='cli';else{if(_0x361e44?.[_0x7e5a0f(0x10c)])this['activeProfile']=_0x361e44['profile'],this[_0x7e5a0f(0x127)]=_0x7e5a0f(0x10f);else{if(_0x300823['profile'])this[_0x7e5a0f(0xf8)]=_0x300823[_0x7e5a0f(0x10c)],this[_0x7e5a0f(0x127)]='config';else process.env.TDX_PROFILE?(this[_0x7e5a0f(0xf8)]=process.env.TDX_PROFILE,this['profileSource']=_0x7e5a0f(0x141)):(this['activeProfile']=null,this['profileSource']=null);}}const _0xd12b7b=this['activeProfile']?loadProfile(this['activeProfile']):null,_0x1dd749=_0x5789b5=>{const _0x53b468=_0x7e5a0f;if(!_0x5789b5)return{};const _0x5b8f21=_0x5789b5,_0x57bc43={};for(const [_0xe9c249,_0x261665]of Object['entries'](_0x5b8f21)){typeof _0x261665===_0x53b468(0x117)&&(_0x57bc43[_0xe9c249]=_0x261665);}return _0x57bc43;},_0xfaa05d={},_0x434b0b=(_0x5e3537,_0x1e170e,_0x34d0d3)=>{const _0x2c9cf6=_0x7e5a0f;if(!_0x5e3537)return![];if(_0x34d0d3&&_0x5e3537===_0x34d0d3)return![];const _0x2d9691=_0x361e44,_0x19bd7f=_0x4462ca,_0x6cca90=_0xd12b7b?.[_0x2c9cf6(0x131)],_0x490a58=_0x300823,_0x21c3f0=_0x2d9691?.[_0x1e170e],_0x1287ea=_0x19bd7f?.[_0x1e170e],_0x24ff35=_0x6cca90?.[_0x1e170e],_0x18d25b=_0x490a58[_0x1e170e];return _0x5e3537!==_0x21c3f0&&_0x5e3537!==_0x1287ea&&_0x5e3537!==_0x24ff35&&_0x5e3537!==_0x18d25b;},_0x2cecc7=[{'optionKey':_0x7e5a0f(0x13b),'contextKey':'site','defaultValue':_0x7e5a0f(0x11e)},{'optionKey':'database','contextKey':_0x7e5a0f(0x133)},{'optionKey':'parentSegment','contextKey':'parent_segment'},{'optionKey':_0x7e5a0f(0x11f),'contextKey':_0x7e5a0f(0x119)},{'optionKey':_0x7e5a0f(0x126),'contextKey':_0x7e5a0f(0x142)},{'optionKey':_0x7e5a0f(0x10c),'contextKey':_0x7e5a0f(0x10c)}];for(const {optionKey:_0x356954,contextKey:_0x3d8cba,defaultValue:_0x7417bd}of _0x2cecc7){const _0x2b8099=_0x344c42[_0x356954];_0x434b0b(_0x2b8099,_0x3d8cba,_0x7417bd)&&(_0xfaa05d[_0x3d8cba]=_0x2b8099);}this[_0x7e5a0f(0x125)]={'cliFlags':_0xfaa05d,'session':_0x1dd749(_0x361e44),'project':_0x1dd749(_0x4462ca),'profile':_0x1dd749(_0xd12b7b?.[_0x7e5a0f(0x131)]),'global':_0x1dd749(_0x300823)};const _0xf3f448={...this[_0x7e5a0f(0x125)][_0x7e5a0f(0x11d)],...this[_0x7e5a0f(0x125)][_0x7e5a0f(0x10c)],...this[_0x7e5a0f(0x125)][_0x7e5a0f(0xf9)]};process.env.TDX_SITE&&!this[_0x7e5a0f(0x125)][_0x7e5a0f(0x10f)][_0x7e5a0f(0x13b)]&&!this['layers'][_0x7e5a0f(0x128)]['site']&&(_0xf3f448[_0x7e5a0f(0x13b)]=process.env.TDX_SITE);Object[_0x7e5a0f(0x149)](_0xf3f448,this[_0x7e5a0f(0x125)][_0x7e5a0f(0x10f)]),Object['assign'](_0xf3f448,this['layers'][_0x7e5a0f(0x128)]);const _0x1a009c=_0xf3f448[_0x7e5a0f(0x13b)]||_0x7e5a0f(0x11e);this['site']=resolveSite(_0x1a009c),this[_0x7e5a0f(0x133)]=_0xf3f448[_0x7e5a0f(0x133)],this[_0x7e5a0f(0x145)]=_0xf3f448['parent_segment'],this[_0x7e5a0f(0x12e)]=_0xf3f448[_0x7e5a0f(0x12e)],this['llm_project']=_0xf3f448['llm_project'],this['llm_agent']=_0xf3f448['llm_agent'],this[_0x7e5a0f(0xfa)]=_0xf3f448[_0x7e5a0f(0xfa)],this[_0x7e5a0f(0x113)]=_0x344c42['verbose']||![],this[_0x7e5a0f(0x136)]=_0x344c42[_0x7e5a0f(0x136)]??LogLevel[_0x7e5a0f(0x109)],this['profile']=this[_0x7e5a0f(0xf8)]||undefined,this[_0x7e5a0f(0x104)]=getAccessToken(this[_0x7e5a0f(0xf8)]||undefined),this[_0x7e5a0f(0x107)]=getAPIKey(this[_0x7e5a0f(0xf8)]||undefined);const _0x4174f1=typeof _0x300823['proxy']===_0x7e5a0f(0x117)?_0x300823[_0x7e5a0f(0x112)]:undefined;this[_0x7e5a0f(0x112)]=_0x4174f1||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x42a652=getConfigDir(),_0x5436d8=a59_0x558544[_0x7e5a0f(0xfd)](_0x42a652,_0x7e5a0f(0x120),this[_0x7e5a0f(0x105)]+_0x7e5a0f(0x110)),_0x28fa98=findProjectConfigPath(),_0x5e4cf0=a59_0x558544[_0x7e5a0f(0xfd)](_0x42a652,_0x7e5a0f(0x130)),_0x5ccb8a=a59_0x558544[_0x7e5a0f(0xfd)](_0x42a652,_0x7e5a0f(0x114));let _0xd5a98c=null,_0x1f54fb=null;this['activeProfile']&&(_0xd5a98c=a59_0x558544[_0x7e5a0f(0xfd)](_0x42a652,_0x7e5a0f(0x134),this[_0x7e5a0f(0xf8)],_0x7e5a0f(0x130)),_0x1f54fb=a59_0x558544[_0x7e5a0f(0xfd)](_0x42a652,_0x7e5a0f(0x134),this['activeProfile'],_0x7e5a0f(0x114))),this[_0x7e5a0f(0x12f)]={'session':a59_0x81a4e3[_0x7e5a0f(0x12c)](_0x5436d8)?_0x5436d8:null,'project':_0x28fa98,'profile':_0xd5a98c&&a59_0x81a4e3['existsSync'](_0xd5a98c)?_0xd5a98c:null,'profileCredentials':_0x1f54fb&&a59_0x81a4e3[_0x7e5a0f(0x12c)](_0x1f54fb)?_0x1f54fb:null,'global':a59_0x81a4e3[_0x7e5a0f(0x12c)](_0x5e4cf0)?_0x5e4cf0:null,'globalCredentials':a59_0x81a4e3[_0x7e5a0f(0x12c)](_0x5ccb8a)?_0x5ccb8a:null};}[a59_0x1b5d74(0x140)](_0x11260d,_0x135962){const _0xae8109=a59_0x1b5d74;if(!_0x135962)return _0xae8109(0x10e);const _0x1d4215=_0x135962;if(this['layers']['cliFlags'][_0x11260d]===_0x1d4215){if(_0x11260d===_0xae8109(0x13b)&&_0x1d4215===_0xae8109(0x11e)&&!this[_0xae8109(0x125)][_0xae8109(0x10f)][_0xae8109(0x13b)]&&!this[_0xae8109(0x125)][_0xae8109(0xf9)]['site']&&!this['layers'][_0xae8109(0x10c)]['site']&&!this[_0xae8109(0x125)][_0xae8109(0x11d)][_0xae8109(0x13b)])return _0xae8109(0xfb);return _0xae8109(0x108)+_0x11260d[_0xae8109(0x143)](/_/g,'-');}if(this['layers']['session'][_0x11260d]===_0x1d4215)return _0xae8109(0x10f);if(this[_0xae8109(0x125)][_0xae8109(0xf9)][_0x11260d]===_0x1d4215)return'project';if(this[_0xae8109(0x125)]['profile'][_0x11260d]===_0x1d4215)return'profile:\x20'+this[_0xae8109(0xf8)];if(this[_0xae8109(0x125)][_0xae8109(0x11d)][_0x11260d]===_0x1d4215)return _0xae8109(0x11d);return _0xae8109(0xfb);}[a59_0x1b5d74(0xf7)](){const _0xb027d=a59_0x1b5d74,_0x1a74c5=a59_0x558544['join'](getConfigDir(),_0xb027d(0x130));if(!a59_0x81a4e3[_0xb027d(0x12c)](_0x1a74c5))return{};try{const _0x22cefc=a59_0x81a4e3[_0xb027d(0x13f)](_0x1a74c5,_0xb027d(0x147));return JSON[_0xb027d(0x111)](_0x22cefc);}catch{return{};}}[a59_0x1b5d74(0x122)](_0x564629){const _0x1117ca=a59_0x1b5d74;_0x564629['site']=this[_0x1117ca(0x13b)],!_0x564629[_0x1117ca(0x133)]&&this[_0x1117ca(0x133)]&&(_0x564629[_0x1117ca(0x133)]=this[_0x1117ca(0x133)]),!_0x564629[_0x1117ca(0xfe)]&&this[_0x1117ca(0x145)]&&(_0x564629[_0x1117ca(0xfe)]=this[_0x1117ca(0x145)]),!_0x564629[_0x1117ca(0x123)]&&this[_0x1117ca(0x12e)]&&(_0x564629[_0x1117ca(0x123)]=this[_0x1117ca(0x12e)]),!_0x564629[_0x1117ca(0x11f)]&&this[_0x1117ca(0x119)]&&(_0x564629[_0x1117ca(0x11f)]=this['llm_project']),!_0x564629[_0x1117ca(0x126)]&&this[_0x1117ca(0x142)]&&(_0x564629[_0x1117ca(0x126)]=this['llm_agent']),!_0x564629[_0x1117ca(0x13a)]&&this[_0x1117ca(0xfa)]&&(_0x564629[_0x1117ca(0x13a)]=this[_0x1117ca(0xfa)]);}['getParameters'](){const _0xbfa2c5=a59_0x1b5d74;return[{'key':_0xbfa2c5(0x13b),'value':this['site']},{'key':_0xbfa2c5(0x133),'value':this[_0xbfa2c5(0x133)]},{'key':_0xbfa2c5(0x145),'value':this[_0xbfa2c5(0x145)]},{'key':_0xbfa2c5(0x12e),'value':this['segment_path']},{'key':'llm_project','value':this[_0xbfa2c5(0x119)]},{'key':_0xbfa2c5(0x142),'value':this['llm_agent']},{'key':_0xbfa2c5(0xfa),'value':this[_0xbfa2c5(0xfa)]},{'key':_0xbfa2c5(0x10c),'value':this[_0xbfa2c5(0xf8)]||undefined}];}[a59_0x1b5d74(0x12d)](){const _0x422689=a59_0x1b5d74;console[_0x422689(0x12b)](a59_0x36d565[_0x422689(0x103)](_0x422689(0x118)));for(const {key:_0x4035c4,value:_0x404e41}of this['getParameters']()){_0x404e41&&console['log'](a59_0x36d565[_0x422689(0xf6)](_0x4035c4)+':\x20'+_0x404e41);}}[a59_0x1b5d74(0x13e)](){const _0x1d5b44=a59_0x1b5d74;console['log'](a59_0x36d565[_0x1d5b44(0x103)](_0x1d5b44(0x118)));for(const {key:_0x30a0b7,value:_0x32ab33}of this[_0x1d5b44(0x139)]()){if(_0x32ab33){const _0x4e254f=_0x30a0b7==='profile'?_0x1d5b44(0x100):'('+this['getSource'](_0x30a0b7,_0x32ab33)+')';console[_0x1d5b44(0x12b)](a59_0x36d565[_0x1d5b44(0xf6)](_0x30a0b7)+':\x20'+_0x32ab33+'\x20'+a59_0x36d565['dim'](_0x4e254f));}}console['log']('\x0a'+a59_0x36d565[_0x1d5b44(0x103)]('[configuration\x20files]'));const _0x39ddc8=[{'label':'Session','path':this[_0x1d5b44(0x12f)][_0x1d5b44(0x10f)],'extra':_0x1d5b44(0xff)+this[_0x1d5b44(0x105)]+')'},{'label':'Project','path':this['configFiles']['project']},{'label':'Profile','path':this['configFiles'][_0x1d5b44(0x10c)]},{'label':_0x1d5b44(0x106),'path':this[_0x1d5b44(0x12f)][_0x1d5b44(0x10b)]},{'label':_0x1d5b44(0x13d),'path':this['configFiles'][_0x1d5b44(0x11d)]},{'label':_0x1d5b44(0x129),'path':this[_0x1d5b44(0x12f)][_0x1d5b44(0x115)]}];for(const {label:_0x11b145,path:_0x9bbb8c,extra:_0x49e5f0}of _0x39ddc8){if(_0x9bbb8c)console[_0x1d5b44(0x12b)](a59_0x36d565[_0x1d5b44(0xf6)](_0x11b145)+':\x20'+_0x9bbb8c+'\x20'+a59_0x36d565['green']('✓')+(_0x49e5f0?'\x20'+a59_0x36d565['dim'](_0x49e5f0):''));else{if(_0x11b145===_0x1d5b44(0x138))console[_0x1d5b44(0x12b)](a59_0x36d565[_0x1d5b44(0xf6)](_0x11b145)+':\x20'+a59_0x36d565['dim'](_0x1d5b44(0x132))+'\x20'+a59_0x36d565[_0x1d5b44(0x102)](_0x1d5b44(0x13c)+this[_0x1d5b44(0x105)]+')'));else(_0x11b145===_0x1d5b44(0x12a)||_0x11b145===_0x1d5b44(0x13d))&&console[_0x1d5b44(0x12b)](a59_0x36d565[_0x1d5b44(0xf6)](_0x11b145)+':\x20'+a59_0x36d565['dim']('none'));}}}async[a59_0x1b5d74(0xfc)](){const _0x36efd6=a59_0x1b5d74;if(!this[_0x36efd6(0x104)]){const _0x1ebe1e=await getOAuthTokens(this[_0x36efd6(0xf8)]||undefined);if(_0x1ebe1e)return this['accessToken']=_0x1ebe1e[_0x36efd6(0x11b)],undefined;}return this[_0x36efd6(0x107)]=await getAPIKeyAsync(this[_0x36efd6(0x13b)],this['activeProfile']||undefined),this['apiKey'];}static async[a59_0x1b5d74(0x146)](_0x2552c8){const _0x2e8452=new GlobalContext(_0x2552c8);return await _0x2e8452['resolveAPIKeyAsync'](),_0x2e8452;}}
1
+ const a59_0x334f5e=a59_0x12c2;function a59_0x12c2(_0xe1f4af,_0xd4b3ee){_0xe1f4af=_0xe1f4af-0x1af;const _0x269dfe=a59_0x269d();let _0x12c2a1=_0x269dfe[_0xe1f4af];return _0x12c2a1;}(function(_0x28d1ba,_0x4387bb){const _0x44429c=a59_0x12c2,_0x393f35=_0x28d1ba();while(!![]){try{const _0x122549=parseInt(_0x44429c(0x1ea))/0x1*(-parseInt(_0x44429c(0x1f4))/0x2)+-parseInt(_0x44429c(0x1d7))/0x3+-parseInt(_0x44429c(0x1e2))/0x4*(-parseInt(_0x44429c(0x1c7))/0x5)+parseInt(_0x44429c(0x1d6))/0x6+parseInt(_0x44429c(0x1cb))/0x7*(-parseInt(_0x44429c(0x1ce))/0x8)+parseInt(_0x44429c(0x1ee))/0x9*(-parseInt(_0x44429c(0x1fa))/0xa)+parseInt(_0x44429c(0x1c1))/0xb*(parseInt(_0x44429c(0x1ba))/0xc);if(_0x122549===_0x4387bb)break;else _0x393f35['push'](_0x393f35['shift']());}catch(_0x105f6f){_0x393f35['push'](_0x393f35['shift']());}}}(a59_0x269d,0xb92d0));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';function a59_0x269d(){const _0x4174bc=['site','configFiles','llm_agent','us01','1pgTmxb','(active)','config','llmAgent','216018IQylRG','parent_segment','readFileSync','parse','llmProject','Profile\x20Credentials','1450060JjJTUt','cliFlags','green','database','getSource','injectIntoOptions','220bpPjAt','Global','logLevel','verbose','getParameters','[configuration\x20files]','Profile','cyan','display','workflow_project','accessToken','env','parentSegment','segment_path','assign','.env','sessionId','none','layers','workflowProject','12uNUWGL','[context]','globalCredentials','profile','existsSync','profileSource','default','28707481BUVMrQ','not\x20set','join','access_token','CLI\x20flag:\x20--','segmentPath','10ycgVfk','profileCredentials','loadGlobalConfig','tdx.json','7vWtvsl','Session','activeProfile','4003304cMoIkY','replace','session','.json','log','string','profile:\x20','createAsync','630366BPqUXD','3312999OrlMaz','project','global','proxy','displayWithSources','llm_project','dim','bold','Project','(session:\x20','entries','1802936SfBqmV','INFO','profiles','apiKey'];a59_0x269d=function(){return _0x4174bc;};return a59_0x269d();}import{getOAuthTokens}from'./oauth-keychain.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 a59_0x2515bf from'node:fs';import*as a59_0x254dba from'node:path';import a59_0x537064 from'chalk';export class GlobalContext{[a59_0x334f5e(0x1e6)];[a59_0x334f5e(0x1f7)];['parent_segment'];['segment_path'];['llm_project'];['llm_agent'];[a59_0x334f5e(0x1af)];[a59_0x334f5e(0x1e5)];['accessToken'];[a59_0x334f5e(0x1da)];[a59_0x334f5e(0x1fd)];[a59_0x334f5e(0x1fc)];['profile'];[a59_0x334f5e(0x1bf)]=null;[a59_0x334f5e(0x1b8)];[a59_0x334f5e(0x1cd)];[a59_0x334f5e(0x1b6)];['configFiles'];constructor(_0x49e18c){const _0x53fba0=a59_0x334f5e;this[_0x53fba0(0x1b6)]=getSessionID(_0x49e18c['session']);const _0x1b5534=loadSessionContext(_0x49e18c[_0x53fba0(0x1d0)]),_0x2d9951=loadProjectConfig(),_0x4db5cb=this[_0x53fba0(0x1c9)]();if(_0x49e18c['profile'])this[_0x53fba0(0x1cd)]=_0x49e18c[_0x53fba0(0x1bd)],this['profileSource']='cli';else{if(_0x1b5534?.[_0x53fba0(0x1bd)])this[_0x53fba0(0x1cd)]=_0x1b5534[_0x53fba0(0x1bd)],this['profileSource']='session';else{if(_0x4db5cb[_0x53fba0(0x1bd)])this[_0x53fba0(0x1cd)]=_0x4db5cb[_0x53fba0(0x1bd)],this['profileSource']=_0x53fba0(0x1ec);else process.env.TDX_PROFILE?(this[_0x53fba0(0x1cd)]=process.env.TDX_PROFILE,this[_0x53fba0(0x1bf)]=_0x53fba0(0x1b1)):(this[_0x53fba0(0x1cd)]=null,this[_0x53fba0(0x1bf)]=null);}}const _0x417aae=this[_0x53fba0(0x1cd)]?loadProfile(this[_0x53fba0(0x1cd)]):null,_0x2c8c62=_0xae09e7=>{const _0xff116b=_0x53fba0;if(!_0xae09e7)return{};const _0x1a155f=_0xae09e7,_0x41192f={};for(const [_0xe3e9a4,_0x24fd86]of Object[_0xff116b(0x1e1)](_0x1a155f)){typeof _0x24fd86===_0xff116b(0x1d3)&&(_0x41192f[_0xe3e9a4]=_0x24fd86);}return _0x41192f;},_0x283f72={},_0x587d47=(_0x50811e,_0x4fac88,_0x154932)=>{const _0xfc49ad=_0x53fba0;if(!_0x50811e)return![];if(_0x154932&&_0x50811e===_0x154932)return![];const _0x1e145b=_0x1b5534,_0x56a7cf=_0x2d9951,_0x477460=_0x417aae?.[_0xfc49ad(0x1ec)],_0x1d1635=_0x4db5cb,_0x2882d6=_0x1e145b?.[_0x4fac88],_0x1356ab=_0x56a7cf?.[_0x4fac88],_0xf5ff38=_0x477460?.[_0x4fac88],_0x1b564b=_0x1d1635[_0x4fac88];return _0x50811e!==_0x2882d6&&_0x50811e!==_0x1356ab&&_0x50811e!==_0xf5ff38&&_0x50811e!==_0x1b564b;},_0x15b904=[{'optionKey':_0x53fba0(0x1e6),'contextKey':_0x53fba0(0x1e6),'defaultValue':'us01'},{'optionKey':_0x53fba0(0x1f7),'contextKey':'database'},{'optionKey':'parentSegment','contextKey':'parent_segment'},{'optionKey':_0x53fba0(0x1f2),'contextKey':_0x53fba0(0x1dc)},{'optionKey':_0x53fba0(0x1ed),'contextKey':_0x53fba0(0x1e8)},{'optionKey':_0x53fba0(0x1bd),'contextKey':_0x53fba0(0x1bd)}];for(const {optionKey:_0x2b8738,contextKey:_0x4dd3c3,defaultValue:_0x3de177}of _0x15b904){const _0x25180a=_0x49e18c[_0x2b8738];_0x587d47(_0x25180a,_0x4dd3c3,_0x3de177)&&(_0x283f72[_0x4dd3c3]=_0x25180a);}this[_0x53fba0(0x1b8)]={'cliFlags':_0x283f72,'session':_0x2c8c62(_0x1b5534),'project':_0x2c8c62(_0x2d9951),'profile':_0x2c8c62(_0x417aae?.[_0x53fba0(0x1ec)]),'global':_0x2c8c62(_0x4db5cb)};const _0x507bf8={...this[_0x53fba0(0x1b8)][_0x53fba0(0x1d9)],...this[_0x53fba0(0x1b8)][_0x53fba0(0x1bd)],...this[_0x53fba0(0x1b8)][_0x53fba0(0x1d8)]};process.env.TDX_SITE&&!this[_0x53fba0(0x1b8)][_0x53fba0(0x1d0)]['site']&&!this[_0x53fba0(0x1b8)]['cliFlags'][_0x53fba0(0x1e6)]&&(_0x507bf8['site']=process.env.TDX_SITE);Object[_0x53fba0(0x1b4)](_0x507bf8,this[_0x53fba0(0x1b8)][_0x53fba0(0x1d0)]),Object[_0x53fba0(0x1b4)](_0x507bf8,this[_0x53fba0(0x1b8)][_0x53fba0(0x1f5)]);const _0x349489=_0x507bf8[_0x53fba0(0x1e6)]||_0x53fba0(0x1e9);this[_0x53fba0(0x1e6)]=resolveSite(_0x349489),this[_0x53fba0(0x1f7)]=_0x507bf8[_0x53fba0(0x1f7)],this[_0x53fba0(0x1ef)]=_0x507bf8[_0x53fba0(0x1ef)],this['segment_path']=_0x507bf8[_0x53fba0(0x1b3)],this[_0x53fba0(0x1dc)]=_0x507bf8[_0x53fba0(0x1dc)],this[_0x53fba0(0x1e8)]=_0x507bf8['llm_agent'],this[_0x53fba0(0x1af)]=_0x507bf8[_0x53fba0(0x1af)],this[_0x53fba0(0x1fd)]=_0x49e18c[_0x53fba0(0x1fd)]||![],this[_0x53fba0(0x1fc)]=_0x49e18c[_0x53fba0(0x1fc)]??LogLevel[_0x53fba0(0x1e3)],this['profile']=this[_0x53fba0(0x1cd)]||undefined,this['accessToken']=getAccessToken(this[_0x53fba0(0x1cd)]||undefined),this[_0x53fba0(0x1e5)]=getAPIKey(this['activeProfile']||undefined);const _0x17a6a4=typeof _0x4db5cb[_0x53fba0(0x1da)]===_0x53fba0(0x1d3)?_0x4db5cb[_0x53fba0(0x1da)]:undefined;this[_0x53fba0(0x1da)]=_0x17a6a4||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x5b86d3=getConfigDir(),_0x257c5b=a59_0x254dba[_0x53fba0(0x1c3)](_0x5b86d3,'sessions',this[_0x53fba0(0x1b6)]+_0x53fba0(0x1d1)),_0x2832c6=findProjectConfigPath(),_0x46f06c=a59_0x254dba[_0x53fba0(0x1c3)](_0x5b86d3,_0x53fba0(0x1ca)),_0x572940=a59_0x254dba[_0x53fba0(0x1c3)](_0x5b86d3,_0x53fba0(0x1b5));let _0x50219b=null,_0x20909b=null;this['activeProfile']&&(_0x50219b=a59_0x254dba[_0x53fba0(0x1c3)](_0x5b86d3,_0x53fba0(0x1e4),this['activeProfile'],'tdx.json'),_0x20909b=a59_0x254dba[_0x53fba0(0x1c3)](_0x5b86d3,_0x53fba0(0x1e4),this[_0x53fba0(0x1cd)],'.env')),this[_0x53fba0(0x1e7)]={'session':a59_0x2515bf[_0x53fba0(0x1be)](_0x257c5b)?_0x257c5b:null,'project':_0x2832c6,'profile':_0x50219b&&a59_0x2515bf[_0x53fba0(0x1be)](_0x50219b)?_0x50219b:null,'profileCredentials':_0x20909b&&a59_0x2515bf[_0x53fba0(0x1be)](_0x20909b)?_0x20909b:null,'global':a59_0x2515bf['existsSync'](_0x46f06c)?_0x46f06c:null,'globalCredentials':a59_0x2515bf[_0x53fba0(0x1be)](_0x572940)?_0x572940:null};}['getSource'](_0x18a3e2,_0x57bbdb){const _0x24aa75=a59_0x334f5e;if(!_0x57bbdb)return _0x24aa75(0x1c2);const _0x29ab5f=_0x57bbdb;if(this[_0x24aa75(0x1b8)][_0x24aa75(0x1f5)][_0x18a3e2]===_0x29ab5f){if(_0x18a3e2===_0x24aa75(0x1e6)&&_0x29ab5f===_0x24aa75(0x1e9)&&!this[_0x24aa75(0x1b8)]['session'][_0x24aa75(0x1e6)]&&!this['layers'][_0x24aa75(0x1d8)][_0x24aa75(0x1e6)]&&!this[_0x24aa75(0x1b8)][_0x24aa75(0x1bd)]['site']&&!this[_0x24aa75(0x1b8)][_0x24aa75(0x1d9)][_0x24aa75(0x1e6)])return _0x24aa75(0x1c0);return _0x24aa75(0x1c5)+_0x18a3e2[_0x24aa75(0x1cf)](/_/g,'-');}if(this[_0x24aa75(0x1b8)][_0x24aa75(0x1d0)][_0x18a3e2]===_0x29ab5f)return _0x24aa75(0x1d0);if(this[_0x24aa75(0x1b8)][_0x24aa75(0x1d8)][_0x18a3e2]===_0x29ab5f)return _0x24aa75(0x1d8);if(this[_0x24aa75(0x1b8)]['profile'][_0x18a3e2]===_0x29ab5f)return _0x24aa75(0x1d4)+this['activeProfile'];if(this[_0x24aa75(0x1b8)][_0x24aa75(0x1d9)][_0x18a3e2]===_0x29ab5f)return _0x24aa75(0x1d9);return _0x24aa75(0x1c0);}['loadGlobalConfig'](){const _0x4cca6b=a59_0x334f5e,_0x196224=a59_0x254dba[_0x4cca6b(0x1c3)](getConfigDir(),_0x4cca6b(0x1ca));if(!a59_0x2515bf['existsSync'](_0x196224))return{};try{const _0xa158b3=a59_0x2515bf[_0x4cca6b(0x1f0)](_0x196224,'utf-8');return JSON[_0x4cca6b(0x1f1)](_0xa158b3);}catch{return{};}}[a59_0x334f5e(0x1f9)](_0x5c1080){const _0x2afb55=a59_0x334f5e;_0x5c1080[_0x2afb55(0x1e6)]=this[_0x2afb55(0x1e6)],!_0x5c1080['database']&&this['database']&&(_0x5c1080['database']=this[_0x2afb55(0x1f7)]),!_0x5c1080[_0x2afb55(0x1b2)]&&this[_0x2afb55(0x1ef)]&&(_0x5c1080[_0x2afb55(0x1b2)]=this[_0x2afb55(0x1ef)]),!_0x5c1080[_0x2afb55(0x1c6)]&&this['segment_path']&&(_0x5c1080['segmentPath']=this[_0x2afb55(0x1b3)]),!_0x5c1080['llmProject']&&this[_0x2afb55(0x1dc)]&&(_0x5c1080[_0x2afb55(0x1f2)]=this['llm_project']),!_0x5c1080[_0x2afb55(0x1ed)]&&this['llm_agent']&&(_0x5c1080[_0x2afb55(0x1ed)]=this['llm_agent']),!_0x5c1080[_0x2afb55(0x1b9)]&&this[_0x2afb55(0x1af)]&&(_0x5c1080[_0x2afb55(0x1b9)]=this[_0x2afb55(0x1af)]);}[a59_0x334f5e(0x1fe)](){const _0xdce785=a59_0x334f5e;return[{'key':_0xdce785(0x1e6),'value':this[_0xdce785(0x1e6)]},{'key':_0xdce785(0x1f7),'value':this[_0xdce785(0x1f7)]},{'key':_0xdce785(0x1ef),'value':this[_0xdce785(0x1ef)]},{'key':_0xdce785(0x1b3),'value':this[_0xdce785(0x1b3)]},{'key':'llm_project','value':this[_0xdce785(0x1dc)]},{'key':_0xdce785(0x1e8),'value':this[_0xdce785(0x1e8)]},{'key':_0xdce785(0x1af),'value':this[_0xdce785(0x1af)]},{'key':'profile','value':this[_0xdce785(0x1cd)]||undefined}];}[a59_0x334f5e(0x202)](){const _0x425ee7=a59_0x334f5e;console['log'](a59_0x537064[_0x425ee7(0x1de)]('[context]'));for(const {key:_0x5506df,value:_0xca1ca0}of this[_0x425ee7(0x1fe)]()){_0xca1ca0&&console[_0x425ee7(0x1d2)](a59_0x537064[_0x425ee7(0x201)](_0x5506df)+':\x20'+_0xca1ca0);}}[a59_0x334f5e(0x1db)](){const _0x22bd23=a59_0x334f5e;console[_0x22bd23(0x1d2)](a59_0x537064[_0x22bd23(0x1de)](_0x22bd23(0x1bb)));for(const {key:_0x452acb,value:_0x2a183c}of this[_0x22bd23(0x1fe)]()){if(_0x2a183c){const _0x35f5d8=_0x452acb===_0x22bd23(0x1bd)?_0x22bd23(0x1eb):'('+this[_0x22bd23(0x1f8)](_0x452acb,_0x2a183c)+')';console[_0x22bd23(0x1d2)](a59_0x537064[_0x22bd23(0x201)](_0x452acb)+':\x20'+_0x2a183c+'\x20'+a59_0x537064[_0x22bd23(0x1dd)](_0x35f5d8));}}console[_0x22bd23(0x1d2)]('\x0a'+a59_0x537064['bold'](_0x22bd23(0x1ff)));const _0x3ae778=[{'label':_0x22bd23(0x1cc),'path':this[_0x22bd23(0x1e7)][_0x22bd23(0x1d0)],'extra':_0x22bd23(0x1e0)+this[_0x22bd23(0x1b6)]+')'},{'label':_0x22bd23(0x1df),'path':this[_0x22bd23(0x1e7)][_0x22bd23(0x1d8)]},{'label':_0x22bd23(0x200),'path':this[_0x22bd23(0x1e7)][_0x22bd23(0x1bd)]},{'label':_0x22bd23(0x1f3),'path':this[_0x22bd23(0x1e7)][_0x22bd23(0x1c8)]},{'label':_0x22bd23(0x1fb),'path':this[_0x22bd23(0x1e7)][_0x22bd23(0x1d9)]},{'label':'Global\x20Credentials','path':this[_0x22bd23(0x1e7)][_0x22bd23(0x1bc)]}];for(const {label:_0x590d7a,path:_0x3023ad,extra:_0x4485a4}of _0x3ae778){if(_0x3023ad)console['log'](a59_0x537064['cyan'](_0x590d7a)+':\x20'+_0x3023ad+'\x20'+a59_0x537064[_0x22bd23(0x1f6)]('✓')+(_0x4485a4?'\x20'+a59_0x537064['dim'](_0x4485a4):''));else{if(_0x590d7a===_0x22bd23(0x1cc))console[_0x22bd23(0x1d2)](a59_0x537064[_0x22bd23(0x201)](_0x590d7a)+':\x20'+a59_0x537064['dim']('none')+'\x20'+a59_0x537064[_0x22bd23(0x1dd)]('(using\x20session:\x20'+this[_0x22bd23(0x1b6)]+')'));else(_0x590d7a==='Project'||_0x590d7a===_0x22bd23(0x1fb))&&console['log'](a59_0x537064['cyan'](_0x590d7a)+':\x20'+a59_0x537064[_0x22bd23(0x1dd)](_0x22bd23(0x1b7)));}}}async['resolveAPIKeyAsync'](){const _0xfa7883=a59_0x334f5e;if(!this[_0xfa7883(0x1b0)]){const _0x14b761=await getOAuthTokens(this[_0xfa7883(0x1cd)]||undefined);if(_0x14b761)return this[_0xfa7883(0x1b0)]=_0x14b761[_0xfa7883(0x1c4)],undefined;}return this[_0xfa7883(0x1e5)]=await getAPIKeyAsync(this['site'],this[_0xfa7883(0x1cd)]||undefined),this['apiKey'];}static async[a59_0x334f5e(0x1d5)](_0x193efa){const _0x4d0d25=new GlobalContext(_0x193efa);return await _0x4d0d25['resolveAPIKeyAsync'](),_0x4d0d25;}}
@@ -1 +1 @@
1
- const a60_0x29311f=a60_0x50aa;(function(_0x29b19f,_0x338f6e){const _0x2c70c9=a60_0x50aa,_0x157716=_0x29b19f();while(!![]){try{const _0x12b9a6=-parseInt(_0x2c70c9(0xfc))/0x1+-parseInt(_0x2c70c9(0xeb))/0x2+-parseInt(_0x2c70c9(0xec))/0x3*(-parseInt(_0x2c70c9(0x107))/0x4)+parseInt(_0x2c70c9(0xf3))/0x5+parseInt(_0x2c70c9(0xf0))/0x6*(-parseInt(_0x2c70c9(0x104))/0x7)+parseInt(_0x2c70c9(0xf7))/0x8*(parseInt(_0x2c70c9(0xf5))/0x9)+-parseInt(_0x2c70c9(0x103))/0xa*(-parseInt(_0x2c70c9(0xfa))/0xb);if(_0x12b9a6===_0x338f6e)break;else _0x157716['push'](_0x157716['shift']());}catch(_0x1e8e14){_0x157716['push'](_0x157716['shift']());}}}(a60_0x202e,0xc598f));const SERVICE_NAME=a60_0x29311f(0xf4);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x50cef0=a60_0x29311f;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x2f6354=await import(_0x50cef0(0xf6));return EntryClass=_0x2f6354['Entry'],EntryClass;}catch(_0x21e6fa){return keyringLoadError=_0x21e6fa instanceof Error?_0x21e6fa:new Error(String(_0x21e6fa)),null;}}function getAccountName(_0x5d542a){const _0x4dd782=a60_0x29311f,_0x10e3a9=_0x5d542a||'';return'profile:'+_0x10e3a9+_0x4dd782(0xf9);}export async function getKeychainAPIKey(_0x1aa9b1){const _0x16f1ad=a60_0x29311f,_0x1adb52=await getKeychainAPIKeyWithStatus(_0x1aa9b1);if(_0x1adb52['success'])return _0x1adb52[_0x16f1ad(0xfb)];return _0x1adb52['reason']===_0x16f1ad(0xfd)&&console[_0x16f1ad(0xf8)]('Warning:\x20'+_0x1adb52[_0x16f1ad(0x102)]),null;}function a60_0x50aa(_0x3a6381,_0x29e02b){_0x3a6381=_0x3a6381-0xea;const _0x202ef9=a60_0x202e();let _0x50aaf7=_0x202ef9[_0x3a6381];return _0x50aaf7;}export async function getKeychainAPIKeyWithStatus(_0xe7d69a){const _0x4be8f6=a60_0x29311f;try{const _0x5ea27c=await getEntryClass();if(!_0x5ea27c)return{'success':![],'reason':'unavailable'};const _0x4841e2=getAccountName(_0xe7d69a),_0x325506=new _0x5ea27c(SERVICE_NAME,_0x4841e2),_0xccc952=_0x325506[_0x4be8f6(0xff)]();if(_0xccc952)return{'success':!![],'value':_0xccc952};return{'success':![],'reason':_0x4be8f6(0x108)};}catch(_0x5a8ddf){const _0x14c33c=_0x5a8ddf instanceof Error?_0x5a8ddf['message']:String(_0x5a8ddf);if(_0x14c33c['includes']('-25300')||_0x14c33c[_0x4be8f6(0x101)]()[_0x4be8f6(0x105)]('could\x20not\x20be\x20found')||_0x14c33c[_0x4be8f6(0x101)]()[_0x4be8f6(0x105)]('not\x20found')||_0x14c33c['toLowerCase']()[_0x4be8f6(0x105)](_0x4be8f6(0x106)))return{'success':![],'reason':_0x4be8f6(0x108)};if(_0x14c33c[_0x4be8f6(0x105)]('-25293')||_0x14c33c[_0x4be8f6(0x101)]()['includes'](_0x4be8f6(0xee))||_0x14c33c[_0x4be8f6(0x101)]()['includes'](_0x4be8f6(0xef)))return{'success':![],'reason':_0x4be8f6(0xfd),'message':'Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.'};return{'success':![],'reason':_0x4be8f6(0x100),'message':_0x14c33c};}}export async function saveKeychainAPIKey(_0x4ade83,_0x3fd194){const _0x1ddf09=a60_0x29311f,_0x1db8f7=await getEntryClass();if(!_0x1db8f7)throw new Error(_0x1ddf09(0xf2));const _0xd4a1e3=getAccountName(_0x3fd194),_0x301567=new _0x1db8f7(SERVICE_NAME,_0xd4a1e3);_0x301567[_0x1ddf09(0xea)](_0x4ade83);}function a60_0x202e(){const _0x159f30=['cannot\x20find','setPassword','3217036pyIgGU','2220FwRBlt','__keychain_test__','restricted','access','6rpHfBx','not\x20supported','System\x20keychain\x20is\x20not\x20available','7333685NWfxWW','tdx','1278KVtoLu','@napi-rs/keyring','11576llxcTE','error',':api_key','10509906JmEcDv','value','208831lruHpi','access_denied','not\x20available','getPassword','unavailable','toLowerCase','message','10BnxyEX','9138983jQzIcC','includes','no\x20matching\x20entry','7052TZBJhD','not_found','deleteCredential'];a60_0x202e=function(){return _0x159f30;};return a60_0x202e();}export async function deleteKeychainAPIKey(_0x267888){const _0x2a7a22=a60_0x29311f;try{const _0x115c5b=await getEntryClass();if(!_0x115c5b)return![];const _0x251812=getAccountName(_0x267888),_0x13269c=new _0x115c5b(SERVICE_NAME,_0x251812);return _0x13269c[_0x2a7a22(0x109)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x2b37e0=a60_0x29311f;try{const _0x1ec953=await getEntryClass();if(!_0x1ec953)return![];const _0x1689dc=new _0x1ec953(SERVICE_NAME,_0x2b37e0(0xed));return _0x1689dc['getPassword'](),!![];}catch(_0x2233b1){const _0x4e3892=_0x2233b1 instanceof Error?_0x2233b1[_0x2b37e0(0x102)][_0x2b37e0(0x101)]():'';if(_0x4e3892[_0x2b37e0(0x105)](_0x2b37e0(0xfe))||_0x4e3892[_0x2b37e0(0x105)](_0x2b37e0(0xf1))||_0x4e3892[_0x2b37e0(0x105)](_0x2b37e0(0x10a)))return![];return!![];}}
1
+ const a60_0x3ad203=a60_0xd0a7;function a60_0xd0a7(_0x58c6a5,_0x5866bd){_0x58c6a5=_0x58c6a5-0x1b5;const _0x4d26bf=a60_0x4d26();let _0xd0a7a9=_0x4d26bf[_0x58c6a5];return _0xd0a7a9;}(function(_0x76dbab,_0x4ad1bb){const _0x5b9459=a60_0xd0a7,_0x12883f=_0x76dbab();while(!![]){try{const _0x478218=parseInt(_0x5b9459(0x1cb))/0x1+parseInt(_0x5b9459(0x1b9))/0x2+-parseInt(_0x5b9459(0x1c7))/0x3+-parseInt(_0x5b9459(0x1c5))/0x4+-parseInt(_0x5b9459(0x1c6))/0x5*(parseInt(_0x5b9459(0x1bd))/0x6)+-parseInt(_0x5b9459(0x1ca))/0x7+parseInt(_0x5b9459(0x1d1))/0x8;if(_0x478218===_0x4ad1bb)break;else _0x12883f['push'](_0x12883f['shift']());}catch(_0x41c33e){_0x12883f['push'](_0x12883f['shift']());}}}(a60_0x4d26,0x49f40));const SERVICE_NAME=a60_0x3ad203(0x1ce);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x30a47d=a60_0x3ad203;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x2d0d76=await import('@napi-rs/keyring');return EntryClass=_0x2d0d76[_0x30a47d(0x1b6)],EntryClass;}catch(_0x31e5a4){return keyringLoadError=_0x31e5a4 instanceof Error?_0x31e5a4:new Error(String(_0x31e5a4)),null;}}function getAccountName(_0x22db4c){const _0x2d4801=a60_0x3ad203,_0x1d2303=_0x22db4c||'';return _0x2d4801(0x1d3)+_0x1d2303+_0x2d4801(0x1c3);}export async function getKeychainAPIKey(_0x4dc580){const _0x57902d=a60_0x3ad203,_0x908bc6=await getKeychainAPIKeyWithStatus(_0x4dc580);if(_0x908bc6[_0x57902d(0x1c8)])return _0x908bc6['value'];return _0x908bc6[_0x57902d(0x1b8)]==='access_denied'&&console[_0x57902d(0x1b7)]('Warning:\x20'+_0x908bc6['message']),null;}export async function getKeychainAPIKeyWithStatus(_0xc5a5c0){const _0x1ea116=a60_0x3ad203;try{const _0x275fee=await getEntryClass();if(!_0x275fee)return{'success':![],'reason':'unavailable'};const _0x11f1e9=getAccountName(_0xc5a5c0),_0x4ec757=new _0x275fee(SERVICE_NAME,_0x11f1e9),_0x1dce57=_0x4ec757[_0x1ea116(0x1be)]();if(_0x1dce57)return{'success':!![],'value':_0x1dce57};return{'success':![],'reason':_0x1ea116(0x1cd)};}catch(_0x13a35f){const _0x45d5bb=_0x13a35f instanceof Error?_0x13a35f['message']:String(_0x13a35f);if(_0x45d5bb[_0x1ea116(0x1d0)]('-25300')||_0x45d5bb[_0x1ea116(0x1c2)]()[_0x1ea116(0x1d0)](_0x1ea116(0x1cf))||_0x45d5bb['toLowerCase']()['includes'](_0x1ea116(0x1c9))||_0x45d5bb['toLowerCase']()[_0x1ea116(0x1d0)](_0x1ea116(0x1c4)))return{'success':![],'reason':'not_found'};if(_0x45d5bb['includes'](_0x1ea116(0x1bb))||_0x45d5bb['toLowerCase']()[_0x1ea116(0x1d0)](_0x1ea116(0x1ba))||_0x45d5bb[_0x1ea116(0x1c2)]()[_0x1ea116(0x1d0)]('access'))return{'success':![],'reason':'access_denied','message':_0x1ea116(0x1bf)};return{'success':![],'reason':_0x1ea116(0x1cc),'message':_0x45d5bb};}}export async function saveKeychainAPIKey(_0x1ad3fb,_0x592218){const _0x51dddd=a60_0x3ad203,_0x12cae3=await getEntryClass();if(!_0x12cae3)throw new Error(_0x51dddd(0x1d4));const _0x1ef944=getAccountName(_0x592218),_0x3a95fc=new _0x12cae3(SERVICE_NAME,_0x1ef944);_0x3a95fc['setPassword'](_0x1ad3fb);}export async function deleteKeychainAPIKey(_0x453308){try{const _0x523d10=await getEntryClass();if(!_0x523d10)return![];const _0x11d199=getAccountName(_0x453308),_0x3ffd6c=new _0x523d10(SERVICE_NAME,_0x11d199);return _0x3ffd6c['deleteCredential'](),!![];}catch{return![];}}function a60_0x4d26(){const _0x578283=['System\x20keychain\x20is\x20not\x20available','__keychain_test__','Entry','error','reason','1177388XtcLdz','restricted','-25293','not\x20supported','6zLRRsg','getPassword','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.','message','cannot\x20find','toLowerCase',':api_key','no\x20matching\x20entry','1223680DgMGmQ','65050tjzslG','239034YDRAzm','success','not\x20found','2306192xPxGMM','371452RTNuyE','unavailable','not_found','tdx','could\x20not\x20be\x20found','includes','566640YlTGLN','not\x20available','profile:'];a60_0x4d26=function(){return _0x578283;};return a60_0x4d26();}export async function isKeychainAvailable(){const _0x10545b=a60_0x3ad203;try{const _0x3bcac6=await getEntryClass();if(!_0x3bcac6)return![];const _0x3a0c68=new _0x3bcac6(SERVICE_NAME,_0x10545b(0x1b5));return _0x3a0c68['getPassword'](),!![];}catch(_0x1cc242){const _0xcfed96=_0x1cc242 instanceof Error?_0x1cc242[_0x10545b(0x1c0)][_0x10545b(0x1c2)]():'';if(_0xcfed96['includes'](_0x10545b(0x1d2))||_0xcfed96[_0x10545b(0x1d0)](_0x10545b(0x1bc))||_0xcfed96[_0x10545b(0x1d0)](_0x10545b(0x1c1)))return![];return!![];}}
@@ -1 +1 @@
1
- function a61_0x2dfe(_0x4ba910,_0x4b5d6a){_0x4ba910=_0x4ba910-0x17c;const _0x33897d=a61_0x3389();let _0x2dfe8c=_0x33897d[_0x4ba910];return _0x2dfe8c;}(function(_0x31576e,_0x1088ad){const _0x14e96a=a61_0x2dfe,_0x317365=_0x31576e();while(!![]){try{const _0x4b1ee6=-parseInt(_0x14e96a(0x18c))/0x1+-parseInt(_0x14e96a(0x18b))/0x2*(-parseInt(_0x14e96a(0x187))/0x3)+-parseInt(_0x14e96a(0x189))/0x4*(parseInt(_0x14e96a(0x188))/0x5)+parseInt(_0x14e96a(0x182))/0x6+parseInt(_0x14e96a(0x17d))/0x7+-parseInt(_0x14e96a(0x183))/0x8*(parseInt(_0x14e96a(0x18a))/0x9)+-parseInt(_0x14e96a(0x18d))/0xa*(parseInt(_0x14e96a(0x17e))/0xb);if(_0x4b1ee6===_0x1088ad)break;else _0x317365['push'](_0x317365['shift']());}catch(_0x1bc820){_0x317365['push'](_0x317365['shift']());}}}(a61_0x3389,0x73bfb));const SERVICE_NAME='tdx';let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x386ea2=a61_0x2dfe;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x5bd380=await import(_0x386ea2(0x17c));return EntryClass=_0x5bd380[_0x386ea2(0x184)],EntryClass;}catch(_0x163cb4){return keyringLoadError=_0x163cb4 instanceof Error?_0x163cb4:new Error(String(_0x163cb4)),null;}}function a61_0x3389(){const _0x366871=['2815401RxxYjC','3642005VPppVF','4ApDNCV','547812gqNEUZ','2oBAhlk','182472FkbVTl','69590WZuEEJ','@napi-rs/keyring','5564615bLboRg','275XrFhIT','deleteCredential','stringify','parse','1144506zwCGVj','48jduILD','Entry','getPassword',':oauth_tokens'];a61_0x3389=function(){return _0x366871;};return a61_0x3389();}function getOAuthAccountName(_0x571dc0){const _0x1891c7=a61_0x2dfe,_0x3a4c48=_0x571dc0||'';return'profile:'+_0x3a4c48+_0x1891c7(0x186);}export async function saveOAuthTokens(_0x455013,_0x1d066a){const _0x519f50=a61_0x2dfe,_0x22e920=await getEntryClass();if(!_0x22e920)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x167ee7=getOAuthAccountName(_0x1d066a),_0xabd3cf=new _0x22e920(SERVICE_NAME,_0x167ee7);_0xabd3cf['setPassword'](JSON[_0x519f50(0x180)](_0x455013));}export async function getOAuthTokens(_0x103801){const _0xb954eb=a61_0x2dfe;try{const _0x49f2ee=await getEntryClass();if(!_0x49f2ee)return null;const _0x536a26=getOAuthAccountName(_0x103801),_0x4cddd4=new _0x49f2ee(SERVICE_NAME,_0x536a26),_0x3287c8=_0x4cddd4[_0xb954eb(0x185)]();if(_0x3287c8)return JSON[_0xb954eb(0x181)](_0x3287c8);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x1629a5){const _0x4f5afc=a61_0x2dfe;try{const _0x3d1823=await getEntryClass();if(!_0x3d1823)return![];const _0xf14d6b=getOAuthAccountName(_0x1629a5),_0x397080=new _0x3d1823(SERVICE_NAME,_0xf14d6b);return _0x397080[_0x4f5afc(0x17f)](),!![];}catch{return![];}}
1
+ (function(_0x1183fb,_0x587070){const _0x240883=a61_0x2375,_0x16a132=_0x1183fb();while(!![]){try{const _0x5b2f0c=parseInt(_0x240883(0x84))/0x1*(parseInt(_0x240883(0x7b))/0x2)+parseInt(_0x240883(0x83))/0x3*(parseInt(_0x240883(0x88))/0x4)+parseInt(_0x240883(0x82))/0x5*(parseInt(_0x240883(0x7e))/0x6)+-parseInt(_0x240883(0x89))/0x7*(parseInt(_0x240883(0x7c))/0x8)+-parseInt(_0x240883(0x86))/0x9+parseInt(_0x240883(0x7f))/0xa*(parseInt(_0x240883(0x78))/0xb)+-parseInt(_0x240883(0x80))/0xc*(-parseInt(_0x240883(0x85))/0xd);if(_0x5b2f0c===_0x587070)break;else _0x16a132['push'](_0x16a132['shift']());}catch(_0x34cd25){_0x16a132['push'](_0x16a132['shift']());}}}(a61_0x320d,0x30030));const SERVICE_NAME='tdx';let EntryClass=null,keyringLoadError=null;function a61_0x2375(_0x2b5cc,_0x3f1079){_0x2b5cc=_0x2b5cc-0x78;const _0x320de6=a61_0x320d();let _0x23755c=_0x320de6[_0x2b5cc];return _0x23755c;}async function getEntryClass(){const _0x591af7=a61_0x2375;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x1da84d=await import(_0x591af7(0x81));return EntryClass=_0x1da84d[_0x591af7(0x7d)],EntryClass;}catch(_0x32f3d6){return keyringLoadError=_0x32f3d6 instanceof Error?_0x32f3d6:new Error(String(_0x32f3d6)),null;}}function getOAuthAccountName(_0x373798){const _0x20d36c=_0x373798||'';return'profile:'+_0x20d36c+':oauth_tokens';}export async function saveOAuthTokens(_0x123047,_0x1c1fbc){const _0x3af068=a61_0x2375,_0x2cbee0=await getEntryClass();if(!_0x2cbee0)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x2a16d0=getOAuthAccountName(_0x1c1fbc),_0x598478=new _0x2cbee0(SERVICE_NAME,_0x2a16d0);_0x598478[_0x3af068(0x79)](JSON[_0x3af068(0x8a)](_0x123047));}export async function getOAuthTokens(_0xf2fbe6){const _0x4acb08=a61_0x2375;try{const _0x11657e=await getEntryClass();if(!_0x11657e)return null;const _0x58c18a=getOAuthAccountName(_0xf2fbe6),_0x490f69=new _0x11657e(SERVICE_NAME,_0x58c18a),_0x1a11bd=_0x490f69[_0x4acb08(0x7a)]();if(_0x1a11bd)return JSON['parse'](_0x1a11bd);return null;}catch{return null;}}function a61_0x320d(){const _0x5d2702=['12181HadgGd','1863303gyBKBh','3316635XvdKWc','deleteCredential','4KbrpkW','15155DdUDqn','stringify','1947PtZjQv','setPassword','getPassword','38cDVvrZ','1000fTeSgM','Entry','944136LEmXPf','2110vQDXUd','12ImQJOT','@napi-rs/keyring','5nRpXZw','798969UyaoCD'];a61_0x320d=function(){return _0x5d2702;};return a61_0x320d();}export async function deleteOAuthTokens(_0xa66914){const _0x119cc3=a61_0x2375;try{const _0x4992d4=await getEntryClass();if(!_0x4992d4)return![];const _0x5263cc=getOAuthAccountName(_0xa66914),_0x584e80=new _0x4992d4(SERVICE_NAME,_0x5263cc);return _0x584e80[_0x119cc3(0x87)](),!![];}catch{return![];}}
@@ -1 +1 @@
1
- const a62_0x1fbfa9=a62_0x489b;(function(_0x4b9bf5,_0x430285){const _0x470f2b=a62_0x489b,_0x18eb9b=_0x4b9bf5();while(!![]){try{const _0x16840a=parseInt(_0x470f2b(0x10e))/0x1*(-parseInt(_0x470f2b(0xf0))/0x2)+parseInt(_0x470f2b(0x10a))/0x3+parseInt(_0x470f2b(0xd3))/0x4*(-parseInt(_0x470f2b(0x107))/0x5)+parseInt(_0x470f2b(0x104))/0x6*(parseInt(_0x470f2b(0x101))/0x7)+-parseInt(_0x470f2b(0xf8))/0x8+parseInt(_0x470f2b(0x103))/0x9*(-parseInt(_0x470f2b(0xe1))/0xa)+parseInt(_0x470f2b(0xd6))/0xb;if(_0x16840a===_0x430285)break;else _0x18eb9b['push'](_0x18eb9b['shift']());}catch(_0x258aa3){_0x18eb9b['push'](_0x18eb9b['shift']());}}}(a62_0x4480,0x406ab));import*as a62_0x6e7aaf from'node:crypto';import*as a62_0xceb216 from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';function a62_0x489b(_0x9686b9,_0x2b7d5e){_0x9686b9=_0x9686b9-0xd2;const _0x448029=a62_0x4480();let _0x489b00=_0x448029[_0x9686b9];return _0x489b00;}import{openBrowser}from'../utils/process.js';const OAUTH_SUPPORTED_SITES=new Set([a62_0x1fbfa9(0xff),a62_0x1fbfa9(0xf1),a62_0x1fbfa9(0xd2),a62_0x1fbfa9(0x110),a62_0x1fbfa9(0xfa)]);export function isOAuthSupported(_0x5da2fe){return OAUTH_SUPPORTED_SITES['has'](_0x5da2fe);}function a62_0x4480(){const _0x4f92f2=['tdx','error','2034640aGcxJf','Not\x20Found','stg-ap03','clientId','code_challenge','http://127.0.0.1','127.0.0.1','dev-us01','code','7ProvdW','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','9zAuokh','2970186jqdBnF','OAuth\x20token\x20request\x20failed\x20(','close','975dsYHdV','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','url','411903HRKJbt','/oauth/authorize','get','scope','754yJsJRR','toString','stg-ap01','stg-us01','9188iCrLlK','text','listen','10427879FEVLuv','Port\x20','base64url','authorization_code','redirectUri','createServer','update','):\x20','code_challenge_method','/oauth/callback','writeHead','3933030tposMU','codeChallenge','pathname','state','hex','end','S256','searchParams','text/plain','waitForCallback','set','message','client_id','response_type','/oauth/token','586zadiPt','dev-eu01','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','text/html','POST'];a62_0x4480=function(){return _0x4f92f2;};return a62_0x4480();}export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI='http://localhost:'+OAUTH_CALLBACK_PORT+'/oauth/callback';export function getOAuthClientId(){const _0x70d21d=a62_0x1fbfa9;return process.env.TD_OAUTH_CLIENT_ID||_0x70d21d(0xf6);}export function generatePKCEPair(){const _0x48958a=a62_0x1fbfa9,_0x54b47a=a62_0x6e7aaf['randomBytes'](0x20)[_0x48958a(0x10f)](_0x48958a(0xd8)),_0x51b9bc=a62_0x6e7aaf['createHash']('sha256')[_0x48958a(0xdc)](_0x54b47a)['digest']('base64url');return{'verifier':_0x54b47a,'challenge':_0x51b9bc};}export function buildAuthorizeURL(_0x158524,_0x183c8b){const _0x16fa0b=a62_0x1fbfa9,_0x16066e=new URL(_0x16fa0b(0x10b),_0x158524);return _0x16066e[_0x16fa0b(0xe8)][_0x16fa0b(0xeb)](_0x16fa0b(0xee),_0x16fa0b(0x100)),_0x16066e[_0x16fa0b(0xe8)]['set'](_0x16fa0b(0xed),_0x183c8b[_0x16fa0b(0xfb)]),_0x16066e[_0x16fa0b(0xe8)][_0x16fa0b(0xeb)]('redirect_uri',_0x183c8b[_0x16fa0b(0xda)]),_0x16066e[_0x16fa0b(0xe8)]['set']('state',_0x183c8b[_0x16fa0b(0xe4)]),_0x16066e['searchParams'][_0x16fa0b(0xeb)](_0x16fa0b(0xfc),_0x183c8b[_0x16fa0b(0xe2)]),_0x16066e['searchParams']['set'](_0x16fa0b(0xde),_0x16fa0b(0xe7)),_0x183c8b[_0x16fa0b(0x10d)]&&_0x16066e[_0x16fa0b(0xe8)]['set'](_0x16fa0b(0x10d),_0x183c8b[_0x16fa0b(0x10d)]),_0x16066e['toString']();}export async function postTokenRequest(_0x3980fa,_0x2cacae){const _0x31513a=a62_0x1fbfa9,_0x574c57=new URLSearchParams(_0x2cacae)[_0x31513a(0x10f)](),_0x2bf1c8=await fetch(_0x3980fa,{'method':_0x31513a(0xf5),'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x574c57});if(!_0x2bf1c8['ok']){const _0x1d4a30=await _0x2bf1c8[_0x31513a(0xd4)]();throw new Error(_0x31513a(0x105)+_0x2bf1c8['status']+_0x31513a(0xdd)+_0x1d4a30);}return await _0x2bf1c8['json']();}export async function exchangeCodeForTokens(_0x4f3730,_0x150493,_0x3f83a7,_0x4bee47){const _0x19fae5=a62_0x1fbfa9,_0x200c4f=_0x4f3730+_0x19fae5(0xef);return postTokenRequest(_0x200c4f,{'grant_type':_0x19fae5(0xd9),'client_id':getOAuthClientId(),'code':_0x150493,'code_verifier':_0x3f83a7,'redirect_uri':_0x4bee47});}export function startLocalCallbackServer(){const _0x3a2e0d=a62_0x1fbfa9;let _0x335a4e,_0x3268a8;const _0x29967f=new Promise((_0x16ebec,_0x340353)=>{_0x335a4e=_0x16ebec,_0x3268a8=_0x340353;}),_0x2afab5=a62_0xceb216[_0x3a2e0d(0xdb)]((_0x32a8a7,_0x328ec8)=>{const _0x903308=_0x3a2e0d,_0x213208=new URL(_0x32a8a7[_0x903308(0x109)]||'/',_0x903308(0xfd));if(_0x213208[_0x903308(0xe3)]!==_0x903308(0xdf)){_0x328ec8[_0x903308(0xe0)](0x194,{'Content-Type':_0x903308(0xe9)}),_0x328ec8[_0x903308(0xe6)](_0x903308(0xf9));return;}const _0xa84d71=_0x213208['searchParams'][_0x903308(0x10c)](_0x903308(0x100)),_0x2d24f2=_0x213208['searchParams']['get'](_0x903308(0xe4)),_0x51efd8=_0x213208[_0x903308(0xe8)][_0x903308(0x10c)](_0x903308(0xf7));if(_0x51efd8||!_0xa84d71||!_0x2d24f2){_0x328ec8[_0x903308(0xe0)](0x190,{'Content-Type':_0x903308(0xf4)}),_0x328ec8[_0x903308(0xe6)](_0x903308(0x108)),_0x3268a8(new Error('OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters'));return;}_0x328ec8['writeHead'](0xc8,{'Content-Type':'text/html'}),_0x328ec8[_0x903308(0xe6)](_0x903308(0xf3)),_0x335a4e({'code':_0xa84d71,'state':_0x2d24f2});});_0x2afab5['on'](_0x3a2e0d(0xf7),_0x34590e=>{const _0xf340fd=_0x3a2e0d;_0x34590e['code']==='EADDRINUSE'?_0x3268a8(new Error(_0xf340fd(0xd7)+OAUTH_CALLBACK_PORT+_0xf340fd(0xf2))):_0x3268a8(new Error('Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20'+_0x34590e[_0xf340fd(0xec)]));}),_0x2afab5[_0x3a2e0d(0xd5)](OAUTH_CALLBACK_PORT,_0x3a2e0d(0xfe));const _0x3f8ef6=setTimeout(()=>{const _0x16815a=_0x3a2e0d;_0x3268a8(new Error(_0x16815a(0x102))),_0x2afab5[_0x16815a(0x106)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x29967f,'close':()=>{const _0x5e2e01=_0x3a2e0d;clearTimeout(_0x3f8ef6),_0x2afab5[_0x5e2e01(0x106)]();}};}export async function startOAuthFlow(_0x21c8de){const _0x3760a8=a62_0x1fbfa9,_0x3f644a=getConsoleUrl(_0x21c8de),_0x1ca916=getOAuthClientId(),{verifier:_0x4cfa77,challenge:_0x3696b1}=generatePKCEPair(),_0x348dad=a62_0x6e7aaf['randomBytes'](0x10)['toString'](_0x3760a8(0xe5)),_0x531a40=startLocalCallbackServer();try{const _0x54ad9f=OAUTH_REDIRECT_URI,_0x21d6dd=buildAuthorizeURL(_0x3f644a,{'clientId':_0x1ca916,'redirectUri':_0x54ad9f,'state':_0x348dad,'codeChallenge':_0x3696b1});openBrowser(_0x21d6dd);const _0x185b23=await _0x531a40[_0x3760a8(0xea)]();if(_0x185b23[_0x3760a8(0xe4)]!==_0x348dad)throw new Error('OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack');return await exchangeCodeForTokens(_0x3f644a,_0x185b23[_0x3760a8(0x100)],_0x4cfa77,_0x54ad9f);}finally{_0x531a40[_0x3760a8(0x106)]();}}
1
+ const a62_0x15c851=a62_0x5e4b;(function(_0x5744e5,_0x3bccb1){const _0x273ca1=a62_0x5e4b,_0x34acb7=_0x5744e5();while(!![]){try{const _0x4e087b=parseInt(_0x273ca1(0x1a4))/0x1+-parseInt(_0x273ca1(0x1a2))/0x2+-parseInt(_0x273ca1(0x18b))/0x3*(parseInt(_0x273ca1(0x19c))/0x4)+-parseInt(_0x273ca1(0x1b4))/0x5+-parseInt(_0x273ca1(0x1b0))/0x6*(parseInt(_0x273ca1(0x1c1))/0x7)+-parseInt(_0x273ca1(0x190))/0x8*(-parseInt(_0x273ca1(0x18d))/0x9)+parseInt(_0x273ca1(0x19e))/0xa;if(_0x4e087b===_0x3bccb1)break;else _0x34acb7['push'](_0x34acb7['shift']());}catch(_0xcfac33){_0x34acb7['push'](_0x34acb7['shift']());}}}(a62_0x1c26,0x49a47));import*as a62_0x330dc3 from'node:crypto';import*as a62_0x525643 from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';const OAUTH_SUPPORTED_SITES=new Set([a62_0x15c851(0x1a0),a62_0x15c851(0x199),'stg-us01',a62_0x15c851(0x1c4),a62_0x15c851(0x195)]);export function isOAuthSupported(_0x154968){return OAUTH_SUPPORTED_SITES['has'](_0x154968);}export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI='http://localhost:'+OAUTH_CALLBACK_PORT+a62_0x15c851(0x1c5);function a62_0x1c26(){const _0x2822e5=['stg-ap01','/oauth/callback','code_challenge','2031rWCEfp','close','126PtuVxd','127.0.0.1','set','226728UZAcBG','base64url','end','text','createServer','stg-ap03','scope','http://127.0.0.1','POST','dev-eu01','code','client_id','848GVCoQt','/oauth/token','1577740gxnkDC','redirect_uri','dev-us01','response_type','171396akgfqT','toString','587295OZdvgQ','clientId','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','update','authorization_code','url','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','state','message','listen','S256','241008JEkiLv','digest','randomBytes','text/html','2854070cldkog','Not\x20Found','EADDRINUSE','error','sha256','codeChallenge','waitForCallback','application/x-www-form-urlencoded','pathname','text/plain','searchParams','tdx','hex','7pJXwJX','writeHead','get'];a62_0x1c26=function(){return _0x2822e5;};return a62_0x1c26();}export function getOAuthClientId(){const _0x2e64af=a62_0x15c851;return process.env.TD_OAUTH_CLIENT_ID||_0x2e64af(0x1bf);}export function generatePKCEPair(){const _0x49155f=a62_0x15c851,_0x559b0e=a62_0x330dc3[_0x49155f(0x1b2)](0x20)[_0x49155f(0x1a3)](_0x49155f(0x191)),_0x4f5a04=a62_0x330dc3['createHash'](_0x49155f(0x1b8))[_0x49155f(0x1a7)](_0x559b0e)[_0x49155f(0x1b1)](_0x49155f(0x191));return{'verifier':_0x559b0e,'challenge':_0x4f5a04};}export function buildAuthorizeURL(_0x353f6d,_0x317c4c){const _0x1ed6f4=a62_0x15c851,_0x5f3975=new URL('/oauth/authorize',_0x353f6d);return _0x5f3975['searchParams'][_0x1ed6f4(0x18f)](_0x1ed6f4(0x1a1),'code'),_0x5f3975['searchParams'][_0x1ed6f4(0x18f)](_0x1ed6f4(0x19b),_0x317c4c[_0x1ed6f4(0x1a5)]),_0x5f3975[_0x1ed6f4(0x1be)]['set'](_0x1ed6f4(0x19f),_0x317c4c['redirectUri']),_0x5f3975['searchParams'][_0x1ed6f4(0x18f)]('state',_0x317c4c[_0x1ed6f4(0x1ac)]),_0x5f3975[_0x1ed6f4(0x1be)][_0x1ed6f4(0x18f)](_0x1ed6f4(0x18a),_0x317c4c[_0x1ed6f4(0x1b9)]),_0x5f3975[_0x1ed6f4(0x1be)]['set']('code_challenge_method',_0x1ed6f4(0x1af)),_0x317c4c['scope']&&_0x5f3975[_0x1ed6f4(0x1be)][_0x1ed6f4(0x18f)]('scope',_0x317c4c[_0x1ed6f4(0x196)]),_0x5f3975['toString']();}export async function postTokenRequest(_0x41898f,_0x6e755a){const _0x1849ce=a62_0x15c851,_0x1c5be4=new URLSearchParams(_0x6e755a)[_0x1849ce(0x1a3)](),_0xbfbfba=await fetch(_0x41898f,{'method':_0x1849ce(0x198),'headers':{'Content-Type':_0x1849ce(0x1bb)},'body':_0x1c5be4});if(!_0xbfbfba['ok']){const _0x17d75c=await _0xbfbfba[_0x1849ce(0x193)]();throw new Error('OAuth\x20token\x20request\x20failed\x20('+_0xbfbfba['status']+'):\x20'+_0x17d75c);}return await _0xbfbfba['json']();}export async function exchangeCodeForTokens(_0x46be2d,_0x32d6e1,_0xe83d1c,_0x1256ac){const _0x1db8b9=a62_0x15c851,_0x29f125=_0x46be2d+_0x1db8b9(0x19d);return postTokenRequest(_0x29f125,{'grant_type':_0x1db8b9(0x1a8),'client_id':getOAuthClientId(),'code':_0x32d6e1,'code_verifier':_0xe83d1c,'redirect_uri':_0x1256ac});}function a62_0x5e4b(_0x4fa972,_0x28cbd7){_0x4fa972=_0x4fa972-0x18a;const _0x1c26b3=a62_0x1c26();let _0x5e4b12=_0x1c26b3[_0x4fa972];return _0x5e4b12;}export function startLocalCallbackServer(){const _0x3f7806=a62_0x15c851;let _0x42b45,_0x4d3366;const _0x18b8b3=new Promise((_0x578e07,_0x53a51e)=>{_0x42b45=_0x578e07,_0x4d3366=_0x53a51e;}),_0x15a776=a62_0x525643[_0x3f7806(0x194)]((_0x1340a8,_0x511bd0)=>{const _0x1e5dd9=_0x3f7806,_0x5a7b50=new URL(_0x1340a8[_0x1e5dd9(0x1a9)]||'/',_0x1e5dd9(0x197));if(_0x5a7b50[_0x1e5dd9(0x1bc)]!==_0x1e5dd9(0x1c5)){_0x511bd0[_0x1e5dd9(0x1c2)](0x194,{'Content-Type':_0x1e5dd9(0x1bd)}),_0x511bd0[_0x1e5dd9(0x192)](_0x1e5dd9(0x1b5));return;}const _0x575060=_0x5a7b50[_0x1e5dd9(0x1be)]['get'](_0x1e5dd9(0x19a)),_0x29c027=_0x5a7b50[_0x1e5dd9(0x1be)][_0x1e5dd9(0x1c3)](_0x1e5dd9(0x1ac)),_0x46607f=_0x5a7b50[_0x1e5dd9(0x1be)][_0x1e5dd9(0x1c3)]('error');if(_0x46607f||!_0x575060||!_0x29c027){_0x511bd0['writeHead'](0x190,{'Content-Type':_0x1e5dd9(0x1b3)}),_0x511bd0[_0x1e5dd9(0x192)](_0x1e5dd9(0x1a6)),_0x4d3366(new Error(_0x1e5dd9(0x1ab)));return;}_0x511bd0[_0x1e5dd9(0x1c2)](0xc8,{'Content-Type':_0x1e5dd9(0x1b3)}),_0x511bd0[_0x1e5dd9(0x192)](_0x1e5dd9(0x1aa)),_0x42b45({'code':_0x575060,'state':_0x29c027});});_0x15a776['on'](_0x3f7806(0x1b7),_0x371861=>{const _0x58d0e6=_0x3f7806;_0x371861[_0x58d0e6(0x19a)]===_0x58d0e6(0x1b6)?_0x4d3366(new Error('Port\x20'+OAUTH_CALLBACK_PORT+'\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.')):_0x4d3366(new Error('Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20'+_0x371861[_0x58d0e6(0x1ad)]));}),_0x15a776[_0x3f7806(0x1ae)](OAUTH_CALLBACK_PORT,_0x3f7806(0x18e));const _0xd8efb=setTimeout(()=>{_0x4d3366(new Error('OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes')),_0x15a776['close']();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x18b8b3,'close':()=>{clearTimeout(_0xd8efb),_0x15a776['close']();}};}export async function startOAuthFlow(_0x2dfd5b){const _0x3ca71c=a62_0x15c851,_0x3ff7d6=getConsoleUrl(_0x2dfd5b),_0xcecc0c=getOAuthClientId(),{verifier:_0x5ce49b,challenge:_0x41ec87}=generatePKCEPair(),_0x116990=a62_0x330dc3['randomBytes'](0x10)[_0x3ca71c(0x1a3)](_0x3ca71c(0x1c0)),_0x3098f3=startLocalCallbackServer();try{const _0x577e9f=OAUTH_REDIRECT_URI,_0x4638e6=buildAuthorizeURL(_0x3ff7d6,{'clientId':_0xcecc0c,'redirectUri':_0x577e9f,'state':_0x116990,'codeChallenge':_0x41ec87});openBrowser(_0x4638e6);const _0x47c33c=await _0x3098f3[_0x3ca71c(0x1ba)]();if(_0x47c33c[_0x3ca71c(0x1ac)]!==_0x116990)throw new Error('OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack');return await exchangeCodeForTokens(_0x3ff7d6,_0x47c33c[_0x3ca71c(0x19a)],_0x5ce49b,_0x577e9f);}finally{_0x3098f3[_0x3ca71c(0x18c)]();}}
@@ -1 +1 @@
1
- const a63_0x29e1cd=a63_0x73f1;(function(_0x20d2f6,_0x369340){const _0x4b84a0=a63_0x73f1,_0x43a898=_0x20d2f6();while(!![]){try{const _0xddd99b=-parseInt(_0x4b84a0(0x165))/0x1*(parseInt(_0x4b84a0(0x185))/0x2)+parseInt(_0x4b84a0(0x1a4))/0x3+-parseInt(_0x4b84a0(0x16c))/0x4+-parseInt(_0x4b84a0(0x17f))/0x5+-parseInt(_0x4b84a0(0x19f))/0x6*(parseInt(_0x4b84a0(0x18d))/0x7)+-parseInt(_0x4b84a0(0x18f))/0x8+-parseInt(_0x4b84a0(0x197))/0x9*(-parseInt(_0x4b84a0(0x192))/0xa);if(_0xddd99b===_0x369340)break;else _0x43a898['push'](_0x43a898['shift']());}catch(_0x25d00a){_0x43a898['push'](_0x43a898['shift']());}}}(a63_0x57f7,0x38a0a));import*as a63_0x124190 from'node:fs';import*as a63_0x5f0a49 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';function a63_0x73f1(_0x1109f5,_0x5342ba){_0x1109f5=_0x1109f5-0x165;const _0x57f7e5=a63_0x57f7();let _0x73f1c4=_0x57f7e5[_0x1109f5];return _0x73f1c4;}import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME=a63_0x29e1cd(0x171);export function getProfileParams(_0x551d49){const _0x5674ca=a63_0x29e1cd,_0x205618={};if(!_0x551d49)return _0x205618;for(const [_0x420526,_0x55beb3]of Object['entries'](_0x551d49)){_0x420526!==_0x5674ca(0x181)&&_0x55beb3!==undefined&&(_0x205618[_0x420526]=_0x55beb3);}return _0x205618;}export function getProfilesDir(){const _0xe007fc=a63_0x29e1cd;return a63_0x5f0a49[_0xe007fc(0x1a8)](getConfigDir(),_0xe007fc(0x1ae));}function getProfileDir(_0x2433bf){const _0x6994ab=a63_0x29e1cd;return a63_0x5f0a49[_0x6994ab(0x1a8)](getProfilesDir(),_0x2433bf);}function getProfileConfigPath(_0x12a2cb){const _0x5122b3=a63_0x29e1cd;return a63_0x5f0a49[_0x5122b3(0x1a8)](getProfileDir(_0x12a2cb),_0x5122b3(0x1a5));}function getProfileEnvPath(_0x1b9a41){const _0x184f80=a63_0x29e1cd;return a63_0x5f0a49[_0x184f80(0x1a8)](getProfileDir(_0x1b9a41),_0x184f80(0x174));}function getGlobalConfigPath(){const _0x3359ab=a63_0x29e1cd;return a63_0x5f0a49['join'](getConfigDir(),_0x3359ab(0x1a5));}function a63_0x57f7(){const _0x49ce51=['160097SiGAIg','llm_agent','240296zSdThk','parent_segment','stringify','5410WShFjL','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','\x20\x20mv\x20\x22','\x20does\x20not\x20exist','object','18351yvnbkZ','Warning:\x20Profile\x20\x27','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','set','\x27:\x20unknown\x20config\x20key\x20\x27','toISOString','directory','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','102ddEynE','filter','has','utf-8','parse','164352MVirlK','tdx.json','isDirectory','INVALID_PROFILE_CONFIG','join','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','Error:\x20','\x27:\x20config\x20must\x20be\x20an\x20object','string','Profile\x20','profiles','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','includes','llm_project','database','1OJtpbh','Failed\x20to\x20parse\x20','some','Profile\x20\x27','name','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','user_info','259476pjrqmy','\x0aWarning:\x20Failed\x20to\x20parse\x20','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','\x20\x201.\x20Edit:\x20','push','@tdx-studio','message','\x27\x20will\x20be\x20ignored','.env','test','\x27\x20not\x20found\x20in\x20user\x20configuration','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','sort','local','profile','site','warn','values','1572125KYHsOP','existsSync','description','find','readFileSync',',\x20creating\x20new\x20file','255598ooOuJz',':\x20Invalid\x20JSON\x20syntax','Invalid\x20profile\x20name:\x20','Warning:\x20Failed\x20to\x20parse\x20','user','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','from','map'];a63_0x57f7=function(){return _0x49ce51;};return a63_0x57f7();}function validateProfileName(_0x3fcba0){const _0x318bdd=a63_0x29e1cd;if(/^@?[a-zA-Z0-9_-]+$/[_0x318bdd(0x175)](_0x3fcba0))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x318bdd(0x175)](_0x3fcba0))return;throw new Error(_0x318bdd(0x187)+_0x3fcba0+_0x318bdd(0x193));}function validateProfileConfig(_0x3a0989,_0x495568){const _0xa7ae2a=a63_0x29e1cd;if(typeof _0x3a0989!==_0xa7ae2a(0x196)||_0x3a0989===null)throw new SDKError(ErrorCode[_0xa7ae2a(0x1a7)],_0xa7ae2a(0x168)+_0x495568+_0xa7ae2a(0x1ab));const _0x57fc51=['description',_0xa7ae2a(0x17c),_0xa7ae2a(0x1b2),_0xa7ae2a(0x190),_0xa7ae2a(0x1b1),_0xa7ae2a(0x18e),_0xa7ae2a(0x16b)],_0x50f191=_0x3a0989;for(const _0x5aacb7 of Object['keys'](_0x50f191)){!_0x57fc51[_0xa7ae2a(0x1b0)](_0x5aacb7)&&console[_0xa7ae2a(0x17d)](_0xa7ae2a(0x198)+_0x495568+_0xa7ae2a(0x19b)+_0x5aacb7+_0xa7ae2a(0x173));}if(_0x50f191[_0xa7ae2a(0x181)]!==undefined&&typeof _0x50f191[_0xa7ae2a(0x181)]!==_0xa7ae2a(0x1ac))throw new SDKError(ErrorCode[_0xa7ae2a(0x1a7)],_0xa7ae2a(0x168)+_0x495568+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x50f191[_0xa7ae2a(0x17c)]!==undefined&&typeof _0x50f191['site']!==_0xa7ae2a(0x1ac))throw new SDKError(ErrorCode[_0xa7ae2a(0x1a7)],_0xa7ae2a(0x168)+_0x495568+_0xa7ae2a(0x16a));if(_0x50f191['database']!==undefined&&typeof _0x50f191[_0xa7ae2a(0x1b2)]!==_0xa7ae2a(0x1ac))throw new SDKError(ErrorCode[_0xa7ae2a(0x1a7)],_0xa7ae2a(0x168)+_0x495568+_0xa7ae2a(0x178));if(_0x50f191[_0xa7ae2a(0x190)]!==undefined&&typeof _0x50f191['parent_segment']!==_0xa7ae2a(0x1ac))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x495568+_0xa7ae2a(0x1af));if(_0x50f191[_0xa7ae2a(0x1b1)]!==undefined&&typeof _0x50f191[_0xa7ae2a(0x1b1)]!==_0xa7ae2a(0x1ac))throw new SDKError(ErrorCode[_0xa7ae2a(0x1a7)],'Profile\x20\x27'+_0x495568+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0x50f191[_0xa7ae2a(0x18e)]!==undefined&&typeof _0x50f191[_0xa7ae2a(0x18e)]!==_0xa7ae2a(0x1ac))throw new SDKError(ErrorCode[_0xa7ae2a(0x1a7)],'Profile\x20\x27'+_0x495568+_0xa7ae2a(0x1a9));return!![];}function loadProfilesFromTdxJson(_0x20b08c,_0x58c2f7){const _0x349903=a63_0x29e1cd;if(!a63_0x124190[_0x349903(0x180)](_0x20b08c))return[];try{const _0x113d7b=a63_0x124190[_0x349903(0x183)](_0x20b08c,_0x349903(0x1a2)),_0x17da57=JSON[_0x349903(0x1a3)](_0x113d7b);if(!_0x17da57[_0x349903(0x1ae)]||typeof _0x17da57[_0x349903(0x1ae)]!==_0x349903(0x196))return[];const _0x34b3c9=[];for(const [_0x1171dd,_0x489acc]of Object['entries'](_0x17da57['profiles'])){try{validateProfileConfig(_0x489acc,_0x1171dd);const _0x660bbd=getNewCredentialPath(_0x1171dd),_0x39082d=getOldCredentialPath(_0x1171dd),_0x46a5ea=a63_0x124190[_0x349903(0x180)](_0x660bbd)||a63_0x124190[_0x349903(0x180)](_0x39082d);_0x34b3c9[_0x349903(0x170)]({'name':_0x1171dd,'config':_0x489acc,'metadata':{'name':_0x1171dd,'createdAt':new Date()[_0x349903(0x19c)]()},'hasCredentials':_0x46a5ea,'scope':_0x58c2f7});}catch(_0x3a1c73){_0x3a1c73 instanceof Error&&(console[_0x349903(0x17d)](_0x349903(0x19e)+_0x20b08c+':'),console[_0x349903(0x17d)]('\x20\x20'+_0x3a1c73['message']+'\x0a'));}}return _0x34b3c9;}catch(_0x18f8a4){return _0x18f8a4 instanceof SyntaxError?(console[_0x349903(0x17d)](_0x349903(0x16d)+_0x20b08c+_0x349903(0x186)),console[_0x349903(0x17d)](_0x349903(0x1aa)+_0x18f8a4[_0x349903(0x172)]+'\x0a')):console[_0x349903(0x17d)](_0x349903(0x16e)+_0x20b08c+':\x20'+_0x18f8a4+'\x0a'),[];}}export function getNewCredentialPath(_0x4f7ee0){return a63_0x5f0a49['join'](getConfigDir(),'.env.'+_0x4f7ee0);}function getOldCredentialPath(_0x405aae){return a63_0x5f0a49['join'](getProfilesDir(),_0x405aae,'.env');}function loadProfilesFromTdxJsonFiles(){const _0x1f7e5a=a63_0x29e1cd,_0x1272ed=[],_0x1798ab=findProjectConfigPath();_0x1798ab&&_0x1272ed['push'](...loadProfilesFromTdxJson(_0x1798ab,_0x1f7e5a(0x17a)));const _0x312a83=a63_0x5f0a49[_0x1f7e5a(0x1a8)](getConfigDir(),_0x1f7e5a(0x1a5));return _0x1272ed['push'](...loadProfilesFromTdxJson(_0x312a83,_0x1f7e5a(0x189))),_0x1272ed;}function loadProfilesFromDirectories(){const _0x301f2c=a63_0x29e1cd,_0x3cbf7f=getProfilesDir();if(!a63_0x124190[_0x301f2c(0x180)](_0x3cbf7f))return[];try{return a63_0x124190['readdirSync'](_0x3cbf7f,{'withFileTypes':!![]})[_0x301f2c(0x1a0)](_0x3a48e3=>_0x3a48e3[_0x301f2c(0x1a6)]())[_0x301f2c(0x18c)](_0x1dd113=>_0x1dd113['name'])[_0x301f2c(0x1a0)](_0x224c4c=>{const _0xb0c44c=_0x301f2c,_0x5192ce=getProfileConfigPath(_0x224c4c),_0x121916=getProfileEnvPath(_0x224c4c);return a63_0x124190[_0xb0c44c(0x180)](_0x5192ce)||a63_0x124190['existsSync'](_0x121916);})[_0x301f2c(0x18c)](_0x59b36d=>{const _0x4cf455=_0x301f2c,_0x1d0178=loadProfileFromDirectory(_0x59b36d);if(_0x1d0178)return{..._0x1d0178,'scope':_0x4cf455(0x19d)};return null;})[_0x301f2c(0x1a0)](_0x1f8d1f=>_0x1f8d1f!==null);}catch{return[];}}function loadProfileFromDirectory(_0x43f752){const _0x6df798=a63_0x29e1cd,_0x512d49=getProfileConfigPath(_0x43f752),_0x36d33b=getOldCredentialPath(_0x43f752);if(!a63_0x124190[_0x6df798(0x180)](_0x512d49)&&!a63_0x124190['existsSync'](_0x36d33b))return null;let _0x3706b2={},_0x20a54e={'name':_0x43f752,'createdAt':new Date()['toISOString']()};if(a63_0x124190[_0x6df798(0x180)](_0x512d49))try{const _0x2c2025=a63_0x124190[_0x6df798(0x183)](_0x512d49,_0x6df798(0x1a2)),_0x42b6e5=JSON[_0x6df798(0x1a3)](_0x2c2025),{metadata:_0x24adf4,..._0x4722b6}=_0x42b6e5;_0x3706b2=_0x4722b6,_0x24adf4&&(_0x20a54e=_0x24adf4);}catch{}return{'name':_0x43f752,'config':_0x3706b2,'metadata':_0x20a54e,'hasCredentials':a63_0x124190[_0x6df798(0x180)](_0x36d33b),'scope':_0x6df798(0x19d)};}export function listProfiles(){const _0x5d4def=a63_0x29e1cd,_0x3e6af0=loadProfilesFromTdxJsonFiles(),_0x1354e5=loadProfilesFromDirectories();if(_0x1354e5['length']>0x0){const _0x64743d=_0x1354e5['map'](_0x1dd6b8=>_0x1dd6b8[_0x5d4def(0x169)])['join'](',\x20'),_0x380669=getConfigDir();console[_0x5d4def(0x17d)](_0x5d4def(0x199)+_0x64743d),console['warn']('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console['warn'](_0x5d4def(0x16f)+a63_0x5f0a49[_0x5d4def(0x1a8)](_0x380669,_0x5d4def(0x1a5))),console['warn'](_0x5d4def(0x177)),console[_0x5d4def(0x17d)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x2604ab=[..._0x3e6af0,..._0x1354e5],_0x11c001=new Map();for(const _0x3df89a of _0x2604ab){!_0x11c001[_0x5d4def(0x1a1)](_0x3df89a[_0x5d4def(0x169)])&&_0x11c001[_0x5d4def(0x19a)](_0x3df89a[_0x5d4def(0x169)],_0x3df89a);}return Array[_0x5d4def(0x18b)](_0x11c001[_0x5d4def(0x17e)]())[_0x5d4def(0x179)]((_0x16a3bd,_0x3e7b9c)=>_0x16a3bd[_0x5d4def(0x169)]['localeCompare'](_0x3e7b9c['name']));}export function profileExists(_0x3a5cb1){const _0x12ceb4=a63_0x29e1cd,_0x5d95b4=listProfiles();return _0x5d95b4[_0x12ceb4(0x167)](_0x5b44f7=>_0x5b44f7['name']===_0x3a5cb1);}export function loadProfile(_0x4ab1b7){const _0x1005ed=a63_0x29e1cd;validateProfileName(_0x4ab1b7);const _0x4bf467=listProfiles(),_0x5d98bc=_0x4bf467[_0x1005ed(0x182)](_0x2c9a37=>_0x2c9a37[_0x1005ed(0x169)]===_0x4ab1b7);return _0x5d98bc||null;}export function saveProfile(_0x4b91e7,_0xb301b5,_0x1dcc80=![]){saveProfileToUserConfig(_0x4b91e7,_0xb301b5);}export function deleteProfile(_0x1882d5){const _0x514293=a63_0x29e1cd;validateProfileName(_0x1882d5);const _0x268090=getProfileDir(_0x1882d5);if(!a63_0x124190[_0x514293(0x180)](_0x268090))throw new Error(_0x514293(0x1ad)+_0x1882d5+_0x514293(0x195));a63_0x124190['rmSync'](_0x268090,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x4b2833,_0x339646){const _0x1fa933=a63_0x29e1cd;validateProfileName(_0x4b2833);const _0x1fe322=getGlobalConfigPath(),_0x4a6beb=getConfigDir();!a63_0x124190[_0x1fa933(0x180)](_0x4a6beb)&&createSecureDirectory(_0x4a6beb);let _0xefd63={};if(a63_0x124190[_0x1fa933(0x180)](_0x1fe322))try{const _0x514df0=a63_0x124190[_0x1fa933(0x183)](_0x1fe322,_0x1fa933(0x1a2));_0xefd63=JSON[_0x1fa933(0x1a3)](_0x514df0);}catch{console[_0x1fa933(0x17d)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x1fe322+_0x1fa933(0x184));}!_0xefd63[_0x1fa933(0x1ae)]&&(_0xefd63[_0x1fa933(0x1ae)]={}),_0xefd63['profiles'][_0x4b2833]=_0x339646,writeSecureFile(_0x1fe322,JSON[_0x1fa933(0x191)](_0xefd63,null,0x2));}export function removeProfileFromUserConfig(_0x4b5864){const _0x1b6807=a63_0x29e1cd;validateProfileName(_0x4b5864);const _0x1bc6ca=getGlobalConfigPath();if(!a63_0x124190['existsSync'](_0x1bc6ca))throw new Error(_0x1b6807(0x168)+_0x4b5864+_0x1b6807(0x176));let _0x20f9ae={};try{const _0x111d4e=a63_0x124190['readFileSync'](_0x1bc6ca,_0x1b6807(0x1a2));_0x20f9ae=JSON['parse'](_0x111d4e);}catch{throw new Error(_0x1b6807(0x166)+_0x1bc6ca);}if(!_0x20f9ae[_0x1b6807(0x1ae)]||!_0x20f9ae[_0x1b6807(0x1ae)][_0x4b5864])throw new Error(_0x1b6807(0x168)+_0x4b5864+_0x1b6807(0x176));delete _0x20f9ae['profiles'][_0x4b5864],_0x20f9ae[_0x1b6807(0x17b)]===_0x4b5864&&delete _0x20f9ae['profile'],writeSecureFile(_0x1bc6ca,JSON[_0x1b6807(0x191)](_0x20f9ae,null,0x2));}export function getActiveProfile(){const _0x20a8d2=a63_0x29e1cd,_0x141989=loadSessionContext();if(_0x141989?.[_0x20a8d2(0x17b)])return _0x141989[_0x20a8d2(0x17b)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x2d9b7a=getGlobalConfigPath();if(!a63_0x124190[_0x20a8d2(0x180)](_0x2d9b7a))return null;try{const _0xd36868=a63_0x124190[_0x20a8d2(0x183)](_0x2d9b7a,_0x20a8d2(0x1a2)),_0x16336a=JSON[_0x20a8d2(0x1a3)](_0xd36868);return _0x16336a[_0x20a8d2(0x17b)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x35c45a){const _0xe2fd1d=a63_0x29e1cd,_0x2d6cb6=getGlobalConfigPath(),_0x3e2ae6=getConfigDir();!a63_0x124190[_0xe2fd1d(0x180)](_0x3e2ae6)&&createSecureDirectory(_0x3e2ae6);let _0x125a13={};if(a63_0x124190[_0xe2fd1d(0x180)](_0x2d6cb6))try{const _0x2d026d=a63_0x124190[_0xe2fd1d(0x183)](_0x2d6cb6,_0xe2fd1d(0x1a2));_0x125a13=JSON[_0xe2fd1d(0x1a3)](_0x2d026d);}catch{console[_0xe2fd1d(0x17d)](_0xe2fd1d(0x188)+_0x2d6cb6+_0xe2fd1d(0x184));}_0x125a13[_0xe2fd1d(0x17c)]=_0x35c45a,writeSecureFile(_0x2d6cb6,JSON[_0xe2fd1d(0x191)](_0x125a13,null,0x2));}export function saveActiveProfileToUserConfig(_0x126bd7){const _0x18ffe6=a63_0x29e1cd;validateProfileName(_0x126bd7);const _0x40e043=getGlobalConfigPath(),_0x53175a=getConfigDir();!a63_0x124190[_0x18ffe6(0x180)](_0x53175a)&&createSecureDirectory(_0x53175a);let _0xfc773={};if(a63_0x124190['existsSync'](_0x40e043))try{const _0x225134=a63_0x124190['readFileSync'](_0x40e043,_0x18ffe6(0x1a2));_0xfc773=JSON[_0x18ffe6(0x1a3)](_0x225134);}catch{console[_0x18ffe6(0x17d)](_0x18ffe6(0x188)+_0x40e043+_0x18ffe6(0x184));}_0xfc773[_0x18ffe6(0x17b)]=_0x126bd7,writeSecureFile(_0x40e043,JSON['stringify'](_0xfc773,null,0x2));}function clearFieldFromUserConfig(_0x165d51){const _0x3b44f7=a63_0x29e1cd,_0x3ac296=getGlobalConfigPath();if(!a63_0x124190['existsSync'](_0x3ac296))return;let _0x3a9da7={};try{const _0x42e492=a63_0x124190[_0x3b44f7(0x183)](_0x3ac296,'utf-8');_0x3a9da7=JSON[_0x3b44f7(0x1a3)](_0x42e492);}catch{return;}delete _0x3a9da7[_0x165d51],writeSecureFile(_0x3ac296,JSON[_0x3b44f7(0x191)](_0x3a9da7,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x3e698c=a63_0x29e1cd;clearFieldFromUserConfig(_0x3e698c(0x17c));}export function clearActiveProfileFromUserConfig(){const _0x34411c=a63_0x29e1cd;clearFieldFromUserConfig(_0x34411c(0x17b));}export function createProfile(_0xea857d,_0x2c4259){const _0x4f488e=a63_0x29e1cd;validateProfileName(_0xea857d);if(profileExists(_0xea857d))throw new Error(_0x4f488e(0x1ad)+_0xea857d+'\x20already\x20exists');saveProfile(_0xea857d,_0x2c4259);}export function saveProfileCredentials(_0x153b00,_0x1dafa4){const _0x32489a=a63_0x29e1cd;validateProfileName(_0x153b00);if(!profileExists(_0x153b00))throw new Error('Profile\x20'+_0x153b00+_0x32489a(0x195));const _0x3168bd=getNewCredentialPath(_0x153b00);writeSecureFile(_0x3168bd,_0x1dafa4);}export function loadProfileCredentials(_0x1b6fd0){const _0x10cc13=a63_0x29e1cd;validateProfileName(_0x1b6fd0);const _0x3e4373=getNewCredentialPath(_0x1b6fd0);if(a63_0x124190[_0x10cc13(0x180)](_0x3e4373))try{return a63_0x124190[_0x10cc13(0x183)](_0x3e4373,_0x10cc13(0x1a2));}catch{}const _0x59189e=getOldCredentialPath(_0x1b6fd0);if(a63_0x124190['existsSync'](_0x59189e)){console[_0x10cc13(0x17d)]('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x1b6fd0+'\x27'),console[_0x10cc13(0x17d)]('To\x20migrate:'),console[_0x10cc13(0x17d)](_0x10cc13(0x194)+_0x59189e+'\x22\x20\x22'+_0x3e4373+'\x22'),console['warn'](_0x10cc13(0x18a));try{return a63_0x124190[_0x10cc13(0x183)](_0x59189e,_0x10cc13(0x1a2));}catch{return null;}}return null;}
1
+ const a63_0x1f724a=a63_0xe94e;(function(_0x207eda,_0x46b9ac){const _0x14b3bc=a63_0xe94e,_0x4942bc=_0x207eda();while(!![]){try{const _0xdb5c01=-parseInt(_0x14b3bc(0xef))/0x1+parseInt(_0x14b3bc(0xe6))/0x2+-parseInt(_0x14b3bc(0xc5))/0x3*(parseInt(_0x14b3bc(0xea))/0x4)+parseInt(_0x14b3bc(0xe9))/0x5*(parseInt(_0x14b3bc(0xbc))/0x6)+-parseInt(_0x14b3bc(0xe4))/0x7+-parseInt(_0x14b3bc(0xbd))/0x8+-parseInt(_0x14b3bc(0xd6))/0x9;if(_0xdb5c01===_0x46b9ac)break;else _0x4942bc['push'](_0x4942bc['shift']());}catch(_0x544aa6){_0x4942bc['push'](_0x4942bc['shift']());}}}(a63_0x5bf5,0x4a4aa));import*as a63_0x50dfd8 from'node:fs';import*as a63_0x248f35 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=a63_0x1f724a(0xd1);export function getProfileParams(_0x5f182b){const _0x54c988=a63_0x1f724a,_0x16df79={};if(!_0x5f182b)return _0x16df79;for(const [_0x471e76,_0x2c4e66]of Object[_0x54c988(0xf9)](_0x5f182b)){_0x471e76!==_0x54c988(0xcc)&&_0x2c4e66!==undefined&&(_0x16df79[_0x471e76]=_0x2c4e66);}return _0x16df79;}export function getProfilesDir(){const _0x5a1e12=a63_0x1f724a;return a63_0x248f35[_0x5a1e12(0xe1)](getConfigDir(),_0x5a1e12(0xdb));}function getProfileDir(_0x4f2a6c){const _0x462952=a63_0x1f724a;return a63_0x248f35[_0x462952(0xe1)](getProfilesDir(),_0x4f2a6c);}function getProfileConfigPath(_0x9fc076){const _0x4232f0=a63_0x1f724a;return a63_0x248f35[_0x4232f0(0xe1)](getProfileDir(_0x9fc076),_0x4232f0(0xbf));}function getProfileEnvPath(_0x4b70c5){const _0x5f43d2=a63_0x1f724a;return a63_0x248f35[_0x5f43d2(0xe1)](getProfileDir(_0x4b70c5),_0x5f43d2(0xee));}function getGlobalConfigPath(){const _0x127879=a63_0x1f724a;return a63_0x248f35[_0x127879(0xe1)](getConfigDir(),_0x127879(0xbf));}function validateProfileName(_0x284890){const _0x4ce353=a63_0x1f724a;if(/^@?[a-zA-Z0-9_-]+$/[_0x4ce353(0xf4)](_0x284890))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/['test'](_0x284890))return;throw new Error(_0x4ce353(0xed)+_0x284890+_0x4ce353(0xdf));}function a63_0x5bf5(){const _0x4bd9bb=['1952532ZksDAH','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','from','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','readFileSync','profiles','llm_agent','push','some','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','\x20does\x20not\x20exist','join','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','.env.','628159otgnCJ','toISOString','981162HiagbQ','name','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','1845375norWJc','132aexCJa','directory','\x20\x201.\x20Edit:\x20','Invalid\x20profile\x20name:\x20','.env','60062eAncLS','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','llm_project','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','warn','test','object','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','\x27:\x20unknown\x20config\x20key\x20\x27','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','entries','\x0aWarning:\x20Failed\x20to\x20parse\x20','To\x20migrate:','INVALID_PROFILE_CONFIG','map','stringify','existsSync','message','database','rmSync','find','Profile\x20','site','includes','6EZDDrJ','1353920qfkyhQ',',\x20creating\x20new\x20file','tdx.json','Warning:\x20Failed\x20to\x20parse\x20','\x27\x20not\x20found\x20in\x20user\x20configuration','length','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','Failed\x20to\x20parse\x20','1761bySIxN','set','Warning:\x20Profile\x20\x27','string','parse','keys','readdirSync','description','Error:\x20','Profile\x20\x27','parent_segment','localeCompare','@tdx-studio','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','profile','utf-8','filter'];a63_0x5bf5=function(){return _0x4bd9bb;};return a63_0x5bf5();}function validateProfileConfig(_0x55c846,_0x2f51c2){const _0x832e4b=a63_0x1f724a;if(typeof _0x55c846!==_0x832e4b(0xf5)||_0x55c846===null)throw new SDKError(ErrorCode[_0x832e4b(0xfc)],_0x832e4b(0xce)+_0x2f51c2+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x33432b=['description',_0x832e4b(0xba),_0x832e4b(0x101),_0x832e4b(0xcf),_0x832e4b(0xf1),_0x832e4b(0xdc),'user_info'],_0x5b13a0=_0x55c846;for(const _0x3e95eb of Object[_0x832e4b(0xca)](_0x5b13a0)){!_0x33432b[_0x832e4b(0xbb)](_0x3e95eb)&&console[_0x832e4b(0xf3)](_0x832e4b(0xc7)+_0x2f51c2+_0x832e4b(0xf7)+_0x3e95eb+'\x27\x20will\x20be\x20ignored');}if(_0x5b13a0[_0x832e4b(0xcc)]!==undefined&&typeof _0x5b13a0['description']!==_0x832e4b(0xc8))throw new SDKError(ErrorCode[_0x832e4b(0xfc)],_0x832e4b(0xce)+_0x2f51c2+_0x832e4b(0xd2));if(_0x5b13a0[_0x832e4b(0xba)]!==undefined&&typeof _0x5b13a0[_0x832e4b(0xba)]!==_0x832e4b(0xc8))throw new SDKError(ErrorCode[_0x832e4b(0xfc)],_0x832e4b(0xce)+_0x2f51c2+_0x832e4b(0xf0));if(_0x5b13a0[_0x832e4b(0x101)]!==undefined&&typeof _0x5b13a0[_0x832e4b(0x101)]!==_0x832e4b(0xc8))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x832e4b(0xce)+_0x2f51c2+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x5b13a0[_0x832e4b(0xcf)]!==undefined&&typeof _0x5b13a0[_0x832e4b(0xcf)]!==_0x832e4b(0xc8))throw new SDKError(ErrorCode[_0x832e4b(0xfc)],_0x832e4b(0xce)+_0x2f51c2+'\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string');if(_0x5b13a0[_0x832e4b(0xf1)]!==undefined&&typeof _0x5b13a0[_0x832e4b(0xf1)]!==_0x832e4b(0xc8))throw new SDKError(ErrorCode[_0x832e4b(0xfc)],_0x832e4b(0xce)+_0x2f51c2+_0x832e4b(0xf2));if(_0x5b13a0[_0x832e4b(0xdc)]!==undefined&&typeof _0x5b13a0['llm_agent']!==_0x832e4b(0xc8))throw new SDKError(ErrorCode[_0x832e4b(0xfc)],_0x832e4b(0xce)+_0x2f51c2+_0x832e4b(0xe8));return!![];}function loadProfilesFromTdxJson(_0x354724,_0x61893f){const _0x2b4af2=a63_0x1f724a;if(!a63_0x50dfd8[_0x2b4af2(0xff)](_0x354724))return[];try{const _0x2b2ebe=a63_0x50dfd8['readFileSync'](_0x354724,_0x2b4af2(0xd4)),_0x1cc0d8=JSON[_0x2b4af2(0xc9)](_0x2b2ebe);if(!_0x1cc0d8[_0x2b4af2(0xdb)]||typeof _0x1cc0d8[_0x2b4af2(0xdb)]!==_0x2b4af2(0xf5))return[];const _0x3a78e0=[];for(const [_0x5a596f,_0xf1ec75]of Object[_0x2b4af2(0xf9)](_0x1cc0d8['profiles'])){try{validateProfileConfig(_0xf1ec75,_0x5a596f);const _0x3abc00=getNewCredentialPath(_0x5a596f),_0x29f17d=getOldCredentialPath(_0x5a596f),_0x5043b6=a63_0x50dfd8[_0x2b4af2(0xff)](_0x3abc00)||a63_0x50dfd8[_0x2b4af2(0xff)](_0x29f17d);_0x3a78e0['push']({'name':_0x5a596f,'config':_0xf1ec75,'metadata':{'name':_0x5a596f,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x5043b6,'scope':_0x61893f});}catch(_0x2b251f){_0x2b251f instanceof Error&&(console[_0x2b4af2(0xf3)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x354724+':'),console[_0x2b4af2(0xf3)]('\x20\x20'+_0x2b251f['message']+'\x0a'));}}return _0x3a78e0;}catch(_0x5172d1){return _0x5172d1 instanceof SyntaxError?(console[_0x2b4af2(0xf3)](_0x2b4af2(0xfa)+_0x354724+':\x20Invalid\x20JSON\x20syntax'),console[_0x2b4af2(0xf3)](_0x2b4af2(0xcd)+_0x5172d1[_0x2b4af2(0x100)]+'\x0a')):console[_0x2b4af2(0xf3)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x354724+':\x20'+_0x5172d1+'\x0a'),[];}}export function getNewCredentialPath(_0x50e0d9){const _0x48e46c=a63_0x1f724a;return a63_0x248f35[_0x48e46c(0xe1)](getConfigDir(),_0x48e46c(0xe3)+_0x50e0d9);}function a63_0xe94e(_0x369991,_0x32ab98){_0x369991=_0x369991-0xb7;const _0x5bf513=a63_0x5bf5();let _0xe94eaf=_0x5bf513[_0x369991];return _0xe94eaf;}function getOldCredentialPath(_0x51d722){const _0xd39439=a63_0x1f724a;return a63_0x248f35[_0xd39439(0xe1)](getProfilesDir(),_0x51d722,_0xd39439(0xee));}function loadProfilesFromTdxJsonFiles(){const _0x361d5e=a63_0x1f724a,_0x48d98b=[],_0x1ab89c=findProjectConfigPath();_0x1ab89c&&_0x48d98b[_0x361d5e(0xdd)](...loadProfilesFromTdxJson(_0x1ab89c,'local'));const _0x5f32be=a63_0x248f35[_0x361d5e(0xe1)](getConfigDir(),_0x361d5e(0xbf));return _0x48d98b[_0x361d5e(0xdd)](...loadProfilesFromTdxJson(_0x5f32be,'user')),_0x48d98b;}function loadProfilesFromDirectories(){const _0x1a12de=a63_0x1f724a,_0x4db128=getProfilesDir();if(!a63_0x50dfd8[_0x1a12de(0xff)](_0x4db128))return[];try{return a63_0x50dfd8[_0x1a12de(0xcb)](_0x4db128,{'withFileTypes':!![]})[_0x1a12de(0xd5)](_0x1decc6=>_0x1decc6['isDirectory']())[_0x1a12de(0xfd)](_0x1c4892=>_0x1c4892[_0x1a12de(0xe7)])[_0x1a12de(0xd5)](_0x3d06a5=>{const _0x2c827a=_0x1a12de,_0x4e608f=getProfileConfigPath(_0x3d06a5),_0x5d7c5e=getProfileEnvPath(_0x3d06a5);return a63_0x50dfd8[_0x2c827a(0xff)](_0x4e608f)||a63_0x50dfd8[_0x2c827a(0xff)](_0x5d7c5e);})[_0x1a12de(0xfd)](_0x2321ab=>{const _0x221ce4=_0x1a12de,_0x27077b=loadProfileFromDirectory(_0x2321ab);if(_0x27077b)return{..._0x27077b,'scope':_0x221ce4(0xeb)};return null;})['filter'](_0x2f233d=>_0x2f233d!==null);}catch{return[];}}function loadProfileFromDirectory(_0x2df680){const _0xafbd6e=a63_0x1f724a,_0x574ff1=getProfileConfigPath(_0x2df680),_0x1d918a=getOldCredentialPath(_0x2df680);if(!a63_0x50dfd8[_0xafbd6e(0xff)](_0x574ff1)&&!a63_0x50dfd8[_0xafbd6e(0xff)](_0x1d918a))return null;let _0x393284={},_0x215f9b={'name':_0x2df680,'createdAt':new Date()[_0xafbd6e(0xe5)]()};if(a63_0x50dfd8[_0xafbd6e(0xff)](_0x574ff1))try{const _0x56ab6c=a63_0x50dfd8[_0xafbd6e(0xda)](_0x574ff1,_0xafbd6e(0xd4)),_0x9b03e0=JSON[_0xafbd6e(0xc9)](_0x56ab6c),{metadata:_0x182b92,..._0x499217}=_0x9b03e0;_0x393284=_0x499217,_0x182b92&&(_0x215f9b=_0x182b92);}catch{}return{'name':_0x2df680,'config':_0x393284,'metadata':_0x215f9b,'hasCredentials':a63_0x50dfd8['existsSync'](_0x1d918a),'scope':_0xafbd6e(0xeb)};}export function listProfiles(){const _0x1eaaf2=a63_0x1f724a,_0x5c8f15=loadProfilesFromTdxJsonFiles(),_0x379623=loadProfilesFromDirectories();if(_0x379623[_0x1eaaf2(0xc2)]>0x0){const _0x551011=_0x379623[_0x1eaaf2(0xfd)](_0x526b42=>_0x526b42[_0x1eaaf2(0xe7)])[_0x1eaaf2(0xe1)](',\x20'),_0x539a7b=getConfigDir();console['warn'](_0x1eaaf2(0xd7)+_0x551011),console[_0x1eaaf2(0xf3)](_0x1eaaf2(0xe2)),console['warn'](_0x1eaaf2(0xec)+a63_0x248f35[_0x1eaaf2(0xe1)](_0x539a7b,_0x1eaaf2(0xbf))),console['warn'](_0x1eaaf2(0xd9)),console[_0x1eaaf2(0xf3)](_0x1eaaf2(0xf8));}const _0x2b70bb=[..._0x5c8f15,..._0x379623],_0x1f37bd=new Map();for(const _0x41c7b4 of _0x2b70bb){!_0x1f37bd['has'](_0x41c7b4['name'])&&_0x1f37bd[_0x1eaaf2(0xc6)](_0x41c7b4['name'],_0x41c7b4);}return Array[_0x1eaaf2(0xd8)](_0x1f37bd['values']())['sort']((_0x31c434,_0x40fbad)=>_0x31c434['name'][_0x1eaaf2(0xd0)](_0x40fbad[_0x1eaaf2(0xe7)]));}export function profileExists(_0x2c74b8){const _0x128f2e=a63_0x1f724a,_0x56d2a9=listProfiles();return _0x56d2a9[_0x128f2e(0xde)](_0x11f619=>_0x11f619[_0x128f2e(0xe7)]===_0x2c74b8);}export function loadProfile(_0xb4a602){const _0x4fa09c=a63_0x1f724a;validateProfileName(_0xb4a602);const _0x3ba496=listProfiles(),_0x162447=_0x3ba496[_0x4fa09c(0xb8)](_0x23fbfc=>_0x23fbfc[_0x4fa09c(0xe7)]===_0xb4a602);return _0x162447||null;}export function saveProfile(_0x5e9864,_0x5ed01b,_0x1e9168=![]){saveProfileToUserConfig(_0x5e9864,_0x5ed01b);}export function deleteProfile(_0xfd5ba3){const _0x1f9ffd=a63_0x1f724a;validateProfileName(_0xfd5ba3);const _0x5853e1=getProfileDir(_0xfd5ba3);if(!a63_0x50dfd8[_0x1f9ffd(0xff)](_0x5853e1))throw new Error(_0x1f9ffd(0xb9)+_0xfd5ba3+'\x20does\x20not\x20exist');a63_0x50dfd8[_0x1f9ffd(0xb7)](_0x5853e1,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x36212b,_0x264be8){const _0x50ea53=a63_0x1f724a;validateProfileName(_0x36212b);const _0x47fda8=getGlobalConfigPath(),_0xee2c44=getConfigDir();!a63_0x50dfd8[_0x50ea53(0xff)](_0xee2c44)&&createSecureDirectory(_0xee2c44);let _0x47c127={};if(a63_0x50dfd8[_0x50ea53(0xff)](_0x47fda8))try{const _0x1075b1=a63_0x50dfd8[_0x50ea53(0xda)](_0x47fda8,'utf-8');_0x47c127=JSON[_0x50ea53(0xc9)](_0x1075b1);}catch{console[_0x50ea53(0xf3)](_0x50ea53(0xc0)+_0x47fda8+_0x50ea53(0xbe));}!_0x47c127['profiles']&&(_0x47c127[_0x50ea53(0xdb)]={}),_0x47c127[_0x50ea53(0xdb)][_0x36212b]=_0x264be8,writeSecureFile(_0x47fda8,JSON[_0x50ea53(0xfe)](_0x47c127,null,0x2));}export function removeProfileFromUserConfig(_0x422299){const _0x39ee15=a63_0x1f724a;validateProfileName(_0x422299);const _0x531838=getGlobalConfigPath();if(!a63_0x50dfd8['existsSync'](_0x531838))throw new Error('Profile\x20\x27'+_0x422299+_0x39ee15(0xc1));let _0x412d90={};try{const _0x40fad0=a63_0x50dfd8['readFileSync'](_0x531838,_0x39ee15(0xd4));_0x412d90=JSON[_0x39ee15(0xc9)](_0x40fad0);}catch{throw new Error(_0x39ee15(0xc4)+_0x531838);}if(!_0x412d90[_0x39ee15(0xdb)]||!_0x412d90[_0x39ee15(0xdb)][_0x422299])throw new Error(_0x39ee15(0xce)+_0x422299+_0x39ee15(0xc1));delete _0x412d90[_0x39ee15(0xdb)][_0x422299],_0x412d90['profile']===_0x422299&&delete _0x412d90['profile'],writeSecureFile(_0x531838,JSON[_0x39ee15(0xfe)](_0x412d90,null,0x2));}export function getActiveProfile(){const _0x344d80=a63_0x1f724a,_0x4e4941=loadSessionContext();if(_0x4e4941?.[_0x344d80(0xd3)])return _0x4e4941[_0x344d80(0xd3)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x1f09f7=getGlobalConfigPath();if(!a63_0x50dfd8[_0x344d80(0xff)](_0x1f09f7))return null;try{const _0x502cd7=a63_0x50dfd8[_0x344d80(0xda)](_0x1f09f7,_0x344d80(0xd4)),_0x71a478=JSON[_0x344d80(0xc9)](_0x502cd7);return _0x71a478[_0x344d80(0xd3)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x40fff7){const _0xa1ac3e=a63_0x1f724a,_0x58c865=getGlobalConfigPath(),_0x458a5f=getConfigDir();!a63_0x50dfd8[_0xa1ac3e(0xff)](_0x458a5f)&&createSecureDirectory(_0x458a5f);let _0x374bf5={};if(a63_0x50dfd8[_0xa1ac3e(0xff)](_0x58c865))try{const _0x1a7a30=a63_0x50dfd8['readFileSync'](_0x58c865,_0xa1ac3e(0xd4));_0x374bf5=JSON[_0xa1ac3e(0xc9)](_0x1a7a30);}catch{console[_0xa1ac3e(0xf3)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x58c865+_0xa1ac3e(0xbe));}_0x374bf5[_0xa1ac3e(0xba)]=_0x40fff7,writeSecureFile(_0x58c865,JSON[_0xa1ac3e(0xfe)](_0x374bf5,null,0x2));}export function saveActiveProfileToUserConfig(_0x3eb261){const _0x53d9a6=a63_0x1f724a;validateProfileName(_0x3eb261);const _0x1238ec=getGlobalConfigPath(),_0x494e01=getConfigDir();!a63_0x50dfd8[_0x53d9a6(0xff)](_0x494e01)&&createSecureDirectory(_0x494e01);let _0x56b75e={};if(a63_0x50dfd8[_0x53d9a6(0xff)](_0x1238ec))try{const _0x5e3e08=a63_0x50dfd8[_0x53d9a6(0xda)](_0x1238ec,'utf-8');_0x56b75e=JSON[_0x53d9a6(0xc9)](_0x5e3e08);}catch{console['warn'](_0x53d9a6(0xc0)+_0x1238ec+_0x53d9a6(0xbe));}_0x56b75e[_0x53d9a6(0xd3)]=_0x3eb261,writeSecureFile(_0x1238ec,JSON[_0x53d9a6(0xfe)](_0x56b75e,null,0x2));}function clearFieldFromUserConfig(_0x1d03f8){const _0x5237b8=a63_0x1f724a,_0x2e3d3f=getGlobalConfigPath();if(!a63_0x50dfd8[_0x5237b8(0xff)](_0x2e3d3f))return;let _0xe9c3f5={};try{const _0x1b582b=a63_0x50dfd8[_0x5237b8(0xda)](_0x2e3d3f,_0x5237b8(0xd4));_0xe9c3f5=JSON['parse'](_0x1b582b);}catch{return;}delete _0xe9c3f5[_0x1d03f8],writeSecureFile(_0x2e3d3f,JSON['stringify'](_0xe9c3f5,null,0x2));}export function clearDefaultSiteFromUserConfig(){clearFieldFromUserConfig('site');}export function clearActiveProfileFromUserConfig(){const _0x2206e8=a63_0x1f724a;clearFieldFromUserConfig(_0x2206e8(0xd3));}export function createProfile(_0x31a6bc,_0x5a6b30){const _0x5b67a6=a63_0x1f724a;validateProfileName(_0x31a6bc);if(profileExists(_0x31a6bc))throw new Error(_0x5b67a6(0xb9)+_0x31a6bc+'\x20already\x20exists');saveProfile(_0x31a6bc,_0x5a6b30);}export function saveProfileCredentials(_0x42ca63,_0x55bf37){const _0x419bb5=a63_0x1f724a;validateProfileName(_0x42ca63);if(!profileExists(_0x42ca63))throw new Error(_0x419bb5(0xb9)+_0x42ca63+_0x419bb5(0xe0));const _0x473fd0=getNewCredentialPath(_0x42ca63);writeSecureFile(_0x473fd0,_0x55bf37);}export function loadProfileCredentials(_0x2c5974){const _0x9e6a4c=a63_0x1f724a;validateProfileName(_0x2c5974);const _0xbd6044=getNewCredentialPath(_0x2c5974);if(a63_0x50dfd8[_0x9e6a4c(0xff)](_0xbd6044))try{return a63_0x50dfd8[_0x9e6a4c(0xda)](_0xbd6044,_0x9e6a4c(0xd4));}catch{}const _0x14efd5=getOldCredentialPath(_0x2c5974);if(a63_0x50dfd8['existsSync'](_0x14efd5)){console[_0x9e6a4c(0xf3)](_0x9e6a4c(0xf6)+_0x2c5974+'\x27'),console['warn'](_0x9e6a4c(0xfb)),console[_0x9e6a4c(0xf3)]('\x20\x20mv\x20\x22'+_0x14efd5+'\x22\x20\x22'+_0xbd6044+'\x22'),console[_0x9e6a4c(0xf3)](_0x9e6a4c(0xc3));try{return a63_0x50dfd8[_0x9e6a4c(0xda)](_0x14efd5,'utf-8');}catch{return null;}}return null;}
@@ -1 +1 @@
1
- (function(_0x4582fa,_0x452434){const _0x586479=a64_0x18b0,_0x2e9b60=_0x4582fa();while(!![]){try{const _0x2dd527=-parseInt(_0x586479(0x131))/0x1+parseInt(_0x586479(0x129))/0x2+-parseInt(_0x586479(0x11f))/0x3+parseInt(_0x586479(0x12c))/0x4*(-parseInt(_0x586479(0x12f))/0x5)+-parseInt(_0x586479(0x12d))/0x6*(parseInt(_0x586479(0x11e))/0x7)+parseInt(_0x586479(0x11a))/0x8*(-parseInt(_0x586479(0x132))/0x9)+-parseInt(_0x586479(0x125))/0xa*(-parseInt(_0x586479(0x135))/0xb);if(_0x2dd527===_0x452434)break;else _0x2e9b60['push'](_0x2e9b60['shift']());}catch(_0x4d0f17){_0x2e9b60['push'](_0x2e9b60['shift']());}}}(a64_0x6ada,0xad7ca));import*as a64_0x46a675 from'node:fs';import*as a64_0x342dd9 from'node:path';function a64_0x6ada(){const _0x1ceccd=['Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','writeFileSync','existsSync','readFileSync','290ypBPwI',').\x20','apiKey','profile','1754636QZJjYu','ENOENT','code','1305236DzofAA','145710BGYKcT','\x20is\x20ignored.\x20','5zHNYSG','includes','221374DQLUcl','2624193wXInrK','dirname','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','643621BtngoK','parse','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','cwd','8Ybfgqx','stringify','join','api_key','77wdUNuJ','2271420UmDWHV','warn'];a64_0x6ada=function(){return _0x1ceccd;};return a64_0x6ada();}function a64_0x18b0(_0x478f25,_0x1e0deb){_0x478f25=_0x478f25-0x118;const _0x6adaf=a64_0x6ada();let _0x18b0e7=_0x6adaf[_0x478f25];return _0x18b0e7;}const PROJECT_CONFIG_FILENAME='tdx.json';export function findProjectConfigPath(_0x4fef33){const _0xa879e=a64_0x18b0;let _0x4aa1a7=_0x4fef33||process[_0xa879e(0x119)]();while(!![]){const _0x42a0=a64_0x342dd9[_0xa879e(0x11c)](_0x4aa1a7,PROJECT_CONFIG_FILENAME);if(a64_0x46a675[_0xa879e(0x123)](_0x42a0))return _0x42a0;const _0x5de6d8=a64_0x342dd9[_0xa879e(0x133)](_0x4aa1a7);if(_0x5de6d8===_0x4aa1a7)return null;_0x4aa1a7=_0x5de6d8;}}export function loadProjectConfig(_0x48a3a1){const _0x33348b=a64_0x18b0,_0x4a6d7b=findProjectConfigPath(_0x48a3a1);if(!_0x4a6d7b)return null;try{const _0x3d37f0=a64_0x46a675[_0x33348b(0x124)](_0x4a6d7b,'utf-8'),_0x521ec4=JSON[_0x33348b(0x136)](_0x3d37f0),_0x28645e=JSON[_0x33348b(0x11b)](_0x521ec4);if(_0x28645e[_0x33348b(0x130)]('TD_API_KEY')||_0x28645e[_0x33348b(0x130)](_0x33348b(0x127))||_0x28645e[_0x33348b(0x130)](_0x33348b(0x11d)))throw new Error('Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20('+_0x4a6d7b+_0x33348b(0x126)+_0x33348b(0x118));const {metadata:_0x340bbc,profile:_0x5d5195,..._0x1123ac}=_0x521ec4;return _0x5d5195&&console[_0x33348b(0x120)]('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0x4a6d7b+_0x33348b(0x12e)+_0x33348b(0x121)),_0x1123ac;}catch(_0x36a6d7){if(_0x36a6d7 instanceof Error&&_0x33348b(0x12b)in _0x36a6d7&&_0x36a6d7[_0x33348b(0x12b)]===_0x33348b(0x12a))return null;throw new Error('Failed\x20to\x20load\x20project\x20config\x20from\x20'+_0x4a6d7b+':\x20'+_0x36a6d7);}}export function saveProjectConfig(_0x3039ec,_0x4a23e3){const _0x1f4acc=a64_0x18b0,_0x327ebe=_0x4a23e3||process[_0x1f4acc(0x119)](),_0x2d4bff=a64_0x342dd9[_0x1f4acc(0x11c)](_0x327ebe,PROJECT_CONFIG_FILENAME),_0x3dd390=JSON['stringify'](_0x3039ec);if(_0x3dd390[_0x1f4acc(0x130)]('TD_API_KEY')||_0x3dd390['includes'](_0x1f4acc(0x127))||_0x3dd390[_0x1f4acc(0x130)]('api_key'))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if(_0x1f4acc(0x128)in _0x3039ec)throw new Error(_0x1f4acc(0x134));a64_0x46a675[_0x1f4acc(0x122)](_0x2d4bff,JSON[_0x1f4acc(0x11b)](_0x3039ec,null,0x2));}export function hasProjectConfig(_0x2ffa90){return findProjectConfigPath(_0x2ffa90)!==null;}export function getProjectRoot(_0x437cbf){const _0x284260=a64_0x18b0,_0x4eade8=findProjectConfigPath(_0x437cbf);return _0x4eade8?a64_0x342dd9[_0x284260(0x133)](_0x4eade8):null;}
1
+ (function(_0x1f770e,_0x35b34f){const _0xd15afd=a64_0x1dea,_0xb38093=_0x1f770e();while(!![]){try{const _0x583d43=parseInt(_0xd15afd(0xe1))/0x1*(parseInt(_0xd15afd(0xf9))/0x2)+parseInt(_0xd15afd(0x101))/0x3*(-parseInt(_0xd15afd(0xfa))/0x4)+-parseInt(_0xd15afd(0x100))/0x5*(parseInt(_0xd15afd(0xf0))/0x6)+parseInt(_0xd15afd(0xfe))/0x7*(-parseInt(_0xd15afd(0xf8))/0x8)+parseInt(_0xd15afd(0xe5))/0x9+parseInt(_0xd15afd(0xe7))/0xa*(-parseInt(_0xd15afd(0xec))/0xb)+parseInt(_0xd15afd(0xff))/0xc;if(_0x583d43===_0x35b34f)break;else _0xb38093['push'](_0xb38093['shift']());}catch(_0x310456){_0xb38093['push'](_0xb38093['shift']());}}}(a64_0x3c9e,0xb22fd));import*as a64_0x4a95a5 from'node:fs';import*as a64_0x26de0c from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';function a64_0x1dea(_0x516845,_0x560219){_0x516845=_0x516845-0xdf;const _0x3c9eb4=a64_0x3c9e();let _0x1dea34=_0x3c9eb4[_0x516845];return _0x1dea34;}export function findProjectConfigPath(_0x247652){const _0x16e27a=a64_0x1dea;let _0x4d7f1e=_0x247652||process['cwd']();while(!![]){const _0x1d0506=a64_0x26de0c[_0x16e27a(0xee)](_0x4d7f1e,PROJECT_CONFIG_FILENAME);if(a64_0x4a95a5[_0x16e27a(0xe3)](_0x1d0506))return _0x1d0506;const _0x89a456=a64_0x26de0c[_0x16e27a(0xe6)](_0x4d7f1e);if(_0x89a456===_0x4d7f1e)return null;_0x4d7f1e=_0x89a456;}}export function loadProjectConfig(_0x513463){const _0x561c89=a64_0x1dea,_0x4e0a9c=findProjectConfigPath(_0x513463);if(!_0x4e0a9c)return null;try{const _0x5f21b8=a64_0x4a95a5[_0x561c89(0xf4)](_0x4e0a9c,_0x561c89(0xfd)),_0x3f6463=JSON[_0x561c89(0xeb)](_0x5f21b8),_0x2c0a35=JSON['stringify'](_0x3f6463);if(_0x2c0a35['includes'](_0x561c89(0xea))||_0x2c0a35[_0x561c89(0xf2)](_0x561c89(0xfc))||_0x2c0a35['includes'](_0x561c89(0xe9)))throw new Error(_0x561c89(0xf5)+_0x4e0a9c+_0x561c89(0xf7)+_0x561c89(0xe4));const {metadata:_0x5e7245,profile:_0x321056,..._0x57c000}=_0x3f6463;return _0x321056&&console[_0x561c89(0xed)](_0x561c89(0xf6)+_0x4e0a9c+_0x561c89(0xe2)+_0x561c89(0xfb)),_0x57c000;}catch(_0x2649d9){if(_0x2649d9 instanceof Error&&'code'in _0x2649d9&&_0x2649d9['code']===_0x561c89(0xf1))return null;throw new Error('Failed\x20to\x20load\x20project\x20config\x20from\x20'+_0x4e0a9c+':\x20'+_0x2649d9);}}function a64_0x3c9e(){const _0x2e3aa2=['API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','api_key','TD_API_KEY','parse','27137klMzWg','warn','join','writeFileSync','126486hlBpAf','ENOENT','includes','cwd','readFileSync','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','Warning:\x20\x27profile\x27\x20field\x20in\x20',').\x20','928656SXFAKz','504410QaBRHw','20HVxyDu','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','apiKey','utf-8','63lYafyN','27813900VhPxNm','130vibKzA','373593yLrKJp','stringify','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','1VGIZgw','\x20is\x20ignored.\x20','existsSync','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','3622131eakTrw','dirname','110amYfJu'];a64_0x3c9e=function(){return _0x2e3aa2;};return a64_0x3c9e();}export function saveProjectConfig(_0x42cf78,_0x176dff){const _0x41359a=a64_0x1dea,_0x534770=_0x176dff||process[_0x41359a(0xf3)](),_0x536bf4=a64_0x26de0c['join'](_0x534770,PROJECT_CONFIG_FILENAME),_0x58b1bc=JSON[_0x41359a(0xdf)](_0x42cf78);if(_0x58b1bc['includes'](_0x41359a(0xea))||_0x58b1bc[_0x41359a(0xf2)](_0x41359a(0xfc))||_0x58b1bc[_0x41359a(0xf2)](_0x41359a(0xe9)))throw new Error(_0x41359a(0xe8));if('profile'in _0x42cf78)throw new Error(_0x41359a(0xe0));a64_0x4a95a5[_0x41359a(0xef)](_0x536bf4,JSON['stringify'](_0x42cf78,null,0x2));}export function hasProjectConfig(_0x3e36a5){return findProjectConfigPath(_0x3e36a5)!==null;}export function getProjectRoot(_0x80da41){const _0x3547ff=a64_0x1dea,_0x5ef640=findProjectConfigPath(_0x80da41);return _0x5ef640?a64_0x26de0c[_0x3547ff(0xe6)](_0x5ef640):null;}
@@ -1 +1 @@
1
- (function(_0x1fbd04,_0x230454){const _0x4c6a2e=a65_0x56c2,_0x36a992=_0x1fbd04();while(!![]){try{const _0x5c5c8d=parseInt(_0x4c6a2e(0x1b2))/0x1+-parseInt(_0x4c6a2e(0x19d))/0x2+parseInt(_0x4c6a2e(0x1b0))/0x3*(parseInt(_0x4c6a2e(0x19a))/0x4)+parseInt(_0x4c6a2e(0x19b))/0x5*(-parseInt(_0x4c6a2e(0x1af))/0x6)+-parseInt(_0x4c6a2e(0x193))/0x7+parseInt(_0x4c6a2e(0x1a0))/0x8+parseInt(_0x4c6a2e(0x195))/0x9;if(_0x5c5c8d===_0x230454)break;else _0x36a992['push'](_0x36a992['shift']());}catch(_0xb0a037){_0x36a992['push'](_0x36a992['shift']());}}}(a65_0x3fab,0xab82c));import*as a65_0x395dd6 from'node:fs';import*as a65_0x5dca87 from'node:path';import*as a65_0x4a04d7 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 _0x11f397=a65_0x56c2,_0x1149ec=process.env.TDX_CONFIG_DIR||a65_0x5dca87[_0x11f397(0x1ae)](a65_0x4a04d7[_0x11f397(0x197)](),_0x11f397(0x1b1),_0x11f397(0x192));return a65_0x5dca87[_0x11f397(0x1ae)](_0x1149ec,'sessions');}function getSessionPath(_0x167ecf){const _0x2b4eea=a65_0x56c2;return a65_0x5dca87[_0x2b4eea(0x1ae)](getSessionsDir(),_0x167ecf+_0x2b4eea(0x1b3));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x57e7f2){const _0x5dfc96=a65_0x56c2;if(_0x57e7f2)return _0x57e7f2;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x5dfc96(0x1ab)]();}export function loadSessionContext(_0x4e5583){const _0x13effc=getSessionID(_0x4e5583),_0x68540a=/^\d+$/['test'](_0x13effc)?parseInt(_0x13effc,0xa):null;return _0x68540a!==null?loadSessionContextByPID(_0x68540a):loadSessionContextByString(_0x13effc);}export function loadSessionContextByPID(_0x2b3c43){const _0x5d3162=a65_0x56c2,_0x218883=getSessionPath(_0x2b3c43);if(!a65_0x395dd6['existsSync'](_0x218883))return null;try{const _0x3a32d4=a65_0x395dd6[_0x5d3162(0x1a7)](_0x218883,_0x5d3162(0x194)),_0x331929=JSON[_0x5d3162(0x1a3)](_0x3a32d4),_0x21bf65=new Date(_0x331929[_0x5d3162(0x1a9)])['getTime'](),_0x5052c8=Date['now']();if(_0x5052c8-_0x21bf65>SESSION_EXPIRATION_MS)return a65_0x395dd6[_0x5d3162(0x191)](_0x218883),null;const _0x3cd143=JSON[_0x5d3162(0x1a8)](_0x331929);if(_0x3cd143[_0x5d3162(0x19c)](_0x5d3162(0x1b4))||_0x3cd143[_0x5d3162(0x19c)]('apiKey')||_0x3cd143['includes'](_0x5d3162(0x196)))return console[_0x5d3162(0x1ad)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x218883+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a65_0x395dd6[_0x5d3162(0x191)](_0x218883),null;return _0x331929;}catch{try{a65_0x395dd6[_0x5d3162(0x191)](_0x218883);}catch{}return null;}}function a65_0x3fab(){const _0x6e29fa=['readFileSync','stringify','createdAt','push','toString','replace','warn','join','12NhBXIB','3lYTSda','.config','624355jNFrgD','.json','TD_API_KEY','unlinkSync','tdx','664559NLkovd','utf-8','14318964nVUdCE','api_key','homedir','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','existsSync','216800yPoFKJ','3364525ETfneO','includes','2442060LQwNms','.\x20This\x20is\x20insecure.\x20Removing\x20session.','now','8757872bRNrQL','getTime','test','parse','toISOString','apiKey','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'];a65_0x3fab=function(){return _0x6e29fa;};return a65_0x3fab();}function loadSessionContextByString(_0x16d03f){const _0xf128c3=a65_0x56c2,_0x1327c5=a65_0x5dca87[_0xf128c3(0x1ae)](getSessionsDir(),_0x16d03f+_0xf128c3(0x1b3));if(!a65_0x395dd6[_0xf128c3(0x199)](_0x1327c5))return null;try{const _0x4d7864=a65_0x395dd6['readFileSync'](_0x1327c5,_0xf128c3(0x194)),_0x510947=JSON[_0xf128c3(0x1a3)](_0x4d7864),_0x3cbcee=new Date(_0x510947['createdAt'])['getTime'](),_0x14361e=Date['now']();if(_0x14361e-_0x3cbcee>SESSION_EXPIRATION_MS)return a65_0x395dd6['unlinkSync'](_0x1327c5),null;const _0x410072=JSON[_0xf128c3(0x1a8)](_0x510947);if(_0x410072[_0xf128c3(0x19c)](_0xf128c3(0x1b4))||_0x410072[_0xf128c3(0x19c)](_0xf128c3(0x1a5))||_0x410072[_0xf128c3(0x19c)]('api_key'))return console[_0xf128c3(0x1ad)](_0xf128c3(0x1a6)+_0x1327c5+_0xf128c3(0x19e)),a65_0x395dd6[_0xf128c3(0x191)](_0x1327c5),null;return _0x510947;}catch{try{a65_0x395dd6[_0xf128c3(0x191)](_0x1327c5);}catch{}return null;}}export function saveSessionContext(_0x117894,_0x189a2b){const _0x543655=a65_0x56c2,_0x12ba43=getSessionID(_0x189a2b),_0x5d7779=/^\d+$/['test'](_0x12ba43)?parseInt(_0x12ba43,0xa):getCurrentSessionPID(),_0x38f268=a65_0x5dca87[_0x543655(0x1ae)](getSessionsDir(),_0x12ba43+'.json'),_0x2b02da=getSessionsDir();createSecureDirectory(_0x2b02da);const _0x25783d=JSON['stringify'](_0x117894);if(_0x25783d[_0x543655(0x19c)]('TD_API_KEY')||_0x25783d[_0x543655(0x19c)](_0x543655(0x1a5))||_0x25783d[_0x543655(0x19c)](_0x543655(0x196)))throw new Error(_0x543655(0x198));let _0x218eb1;const _0x15da55=/^\d+$/[_0x543655(0x1a2)](_0x12ba43)?loadSessionContextByPID(parseInt(_0x12ba43,0xa)):loadSessionContextByString(_0x12ba43);_0x15da55?_0x218eb1={..._0x15da55,..._0x117894,'pid':_0x5d7779,'sessionId':_0x12ba43!==_0x5d7779['toString']()?_0x12ba43:undefined,'updatedAt':new Date()[_0x543655(0x1a4)]()}:_0x218eb1={'pid':_0x5d7779,'sessionId':_0x12ba43!==_0x5d7779[_0x543655(0x1ab)]()?_0x12ba43:undefined,..._0x117894,'createdAt':new Date()[_0x543655(0x1a4)](),'updatedAt':new Date()['toISOString']()},a65_0x395dd6['writeFileSync'](_0x38f268,JSON[_0x543655(0x1a8)](_0x218eb1,null,0x2));}export function clearSessionContext(_0x1f9824){const _0x3e6c61=a65_0x56c2,_0x1dae0d=getSessionID(_0x1f9824),_0x5427e5=a65_0x5dca87[_0x3e6c61(0x1ae)](getSessionsDir(),_0x1dae0d+_0x3e6c61(0x1b3));a65_0x395dd6['existsSync'](_0x5427e5)&&a65_0x395dd6['unlinkSync'](_0x5427e5);}export function clearSessionContextField(_0x22fff0,_0x4a578e){const _0x5bc4b3=a65_0x56c2,_0x38bf51=getSessionID(_0x4a578e),_0x299cc3=a65_0x5dca87[_0x5bc4b3(0x1ae)](getSessionsDir(),_0x38bf51+_0x5bc4b3(0x1b3));if(!a65_0x395dd6[_0x5bc4b3(0x199)](_0x299cc3))return;try{const _0x37ee2f=a65_0x395dd6[_0x5bc4b3(0x1a7)](_0x299cc3,_0x5bc4b3(0x194)),_0x58e931=JSON[_0x5bc4b3(0x1a3)](_0x37ee2f);delete _0x58e931[_0x22fff0],a65_0x395dd6['writeFileSync'](_0x299cc3,JSON[_0x5bc4b3(0x1a8)](_0x58e931,null,0x2));}catch{}}function a65_0x56c2(_0x140bf3,_0x46be69){_0x140bf3=_0x140bf3-0x191;const _0x3fab36=a65_0x3fab();let _0x56c29a=_0x3fab36[_0x140bf3];return _0x56c29a;}export function cleanExpiredSessions(){const _0x3bec71=a65_0x56c2,_0xdfc7e9=getSessionsDir();if(!a65_0x395dd6['existsSync'](_0xdfc7e9))return 0x0;let _0x1b8426=0x0;const _0x470096=Date[_0x3bec71(0x19f)]();try{const _0x3bf972=a65_0x395dd6['readdirSync'](_0xdfc7e9);for(const _0x19d1c8 of _0x3bf972){if(!_0x19d1c8['endsWith']('.json'))continue;const _0xd24ffe=a65_0x5dca87[_0x3bec71(0x1ae)](_0xdfc7e9,_0x19d1c8),_0x199fa3=_0x19d1c8[_0x3bec71(0x1ac)](_0x3bec71(0x1b3),''),_0x5cf8fa=parseInt(_0x199fa3,0xa),_0x2124d9=!isNaN(_0x5cf8fa);if(_0x2124d9){if(!isProcessRunning(_0x5cf8fa)){a65_0x395dd6['unlinkSync'](_0xd24ffe),_0x1b8426++;continue;}}try{const _0x582627=a65_0x395dd6[_0x3bec71(0x1a7)](_0xd24ffe,'utf-8'),_0x411b5e=JSON[_0x3bec71(0x1a3)](_0x582627),_0x114a17=new Date(_0x411b5e[_0x3bec71(0x1a9)])[_0x3bec71(0x1a1)]();_0x470096-_0x114a17>SESSION_EXPIRATION_MS&&(a65_0x395dd6[_0x3bec71(0x191)](_0xd24ffe),_0x1b8426++);}catch{a65_0x395dd6[_0x3bec71(0x191)](_0xd24ffe),_0x1b8426++;}}}catch{}return _0x1b8426;}export function listActiveSessions(){const _0x3ebb8e=a65_0x56c2,_0x4f5274=getSessionsDir();if(!a65_0x395dd6[_0x3ebb8e(0x199)](_0x4f5274))return[];try{const _0x40e497=a65_0x395dd6['readdirSync'](_0x4f5274),_0x3865a5=[];for(const _0x10994f of _0x40e497){if(!_0x10994f['endsWith']('.json'))continue;const _0xf8462d=_0x10994f[_0x3ebb8e(0x1ac)]('.json',''),_0x4573e7=parseInt(_0xf8462d,0xa);!isNaN(_0x4573e7)&&isProcessRunning(_0x4573e7)&&_0x3865a5[_0x3ebb8e(0x1aa)](_0x4573e7);}return _0x3865a5['sort']((_0x42fc58,_0x54f5df)=>_0x42fc58-_0x54f5df);}catch{return[];}}
1
+ (function(_0x1643ea,_0x4888a0){const _0x39b2c7=a65_0x2068,_0x31083e=_0x1643ea();while(!![]){try{const _0x2c6f94=-parseInt(_0x39b2c7(0x197))/0x1+parseInt(_0x39b2c7(0x199))/0x2*(-parseInt(_0x39b2c7(0x182))/0x3)+parseInt(_0x39b2c7(0x187))/0x4*(-parseInt(_0x39b2c7(0x172))/0x5)+parseInt(_0x39b2c7(0x176))/0x6*(-parseInt(_0x39b2c7(0x17f))/0x7)+-parseInt(_0x39b2c7(0x193))/0x8+parseInt(_0x39b2c7(0x195))/0x9+parseInt(_0x39b2c7(0x171))/0xa*(parseInt(_0x39b2c7(0x181))/0xb);if(_0x2c6f94===_0x4888a0)break;else _0x31083e['push'](_0x31083e['shift']());}catch(_0x53d022){_0x31083e['push'](_0x31083e['shift']());}}}(a65_0x5c13,0xa1a71));import*as a65_0x365d1f from'node:fs';import*as a65_0x419538 from'node:path';import*as a65_0xd8805f 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 _0x3954a3=a65_0x2068,_0x4e89b7=process.env.TDX_CONFIG_DIR||a65_0x419538[_0x3954a3(0x189)](a65_0xd8805f[_0x3954a3(0x18e)](),_0x3954a3(0x198),_0x3954a3(0x175));return a65_0x419538[_0x3954a3(0x189)](_0x4e89b7,_0x3954a3(0x191));}function getSessionPath(_0x8a35b1){const _0x127d5d=a65_0x2068;return a65_0x419538[_0x127d5d(0x189)](getSessionsDir(),_0x8a35b1+_0x127d5d(0x184));}export function getCurrentSessionPID(){return getPPID();}function a65_0x2068(_0x35e806,_0xbcafc4){_0x35e806=_0x35e806-0x171;const _0x5c136f=a65_0x5c13();let _0x20686c=_0x5c136f[_0x35e806];return _0x20686c;}export function getSessionID(_0xa21f7a){const _0x59c01a=a65_0x2068;if(_0xa21f7a)return _0xa21f7a;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x59c01a(0x177)]();}export function loadSessionContext(_0x3c7101){const _0x484e0=getSessionID(_0x3c7101),_0x1c3fb8=/^\d+$/['test'](_0x484e0)?parseInt(_0x484e0,0xa):null;return _0x1c3fb8!==null?loadSessionContextByPID(_0x1c3fb8):loadSessionContextByString(_0x484e0);}function a65_0x5c13(){const _0x2cacd1=['1450EthYmH','2141850EpNsRH','now','getTime','tdx','18ZbtQAc','toString','unlinkSync','utf-8','readdirSync','endsWith','writeFileSync','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','parse','1807141tjByYM','test','217778SrnmRP','21djiUWx','createdAt','.json','toISOString','stringify','8YwJorP','warn','join','includes','TD_API_KEY','readFileSync','sort','homedir','existsSync','api_key','sessions','.\x20This\x20is\x20insecure.\x20Removing\x20session.','2924120hGMZFW','apiKey','7935831GCuldD','replace','399245UYJvIQ','.config','198386vRPjse'];a65_0x5c13=function(){return _0x2cacd1;};return a65_0x5c13();}export function loadSessionContextByPID(_0x43e4d4){const _0x302417=a65_0x2068,_0x539d27=getSessionPath(_0x43e4d4);if(!a65_0x365d1f['existsSync'](_0x539d27))return null;try{const _0xca5911=a65_0x365d1f['readFileSync'](_0x539d27,_0x302417(0x179)),_0xe78ea7=JSON['parse'](_0xca5911),_0x1781aa=new Date(_0xe78ea7[_0x302417(0x183)])['getTime'](),_0x39e340=Date[_0x302417(0x173)]();if(_0x39e340-_0x1781aa>SESSION_EXPIRATION_MS)return a65_0x365d1f[_0x302417(0x178)](_0x539d27),null;const _0x27338d=JSON['stringify'](_0xe78ea7);if(_0x27338d[_0x302417(0x18a)]('TD_API_KEY')||_0x27338d['includes'](_0x302417(0x194))||_0x27338d[_0x302417(0x18a)]('api_key'))return console['warn'](_0x302417(0x17d)+_0x539d27+_0x302417(0x192)),a65_0x365d1f['unlinkSync'](_0x539d27),null;return _0xe78ea7;}catch{try{a65_0x365d1f[_0x302417(0x178)](_0x539d27);}catch{}return null;}}function loadSessionContextByString(_0x8eef9e){const _0x3f58c0=a65_0x2068,_0x47d9b9=a65_0x419538[_0x3f58c0(0x189)](getSessionsDir(),_0x8eef9e+_0x3f58c0(0x184));if(!a65_0x365d1f[_0x3f58c0(0x18f)](_0x47d9b9))return null;try{const _0x6c19c2=a65_0x365d1f[_0x3f58c0(0x18c)](_0x47d9b9,'utf-8'),_0x224de4=JSON['parse'](_0x6c19c2),_0x494948=new Date(_0x224de4['createdAt'])['getTime'](),_0x593221=Date[_0x3f58c0(0x173)]();if(_0x593221-_0x494948>SESSION_EXPIRATION_MS)return a65_0x365d1f[_0x3f58c0(0x178)](_0x47d9b9),null;const _0x3f0f54=JSON['stringify'](_0x224de4);if(_0x3f0f54[_0x3f58c0(0x18a)](_0x3f58c0(0x18b))||_0x3f0f54[_0x3f58c0(0x18a)]('apiKey')||_0x3f0f54[_0x3f58c0(0x18a)](_0x3f58c0(0x190)))return console[_0x3f58c0(0x188)](_0x3f58c0(0x17d)+_0x47d9b9+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a65_0x365d1f['unlinkSync'](_0x47d9b9),null;return _0x224de4;}catch{try{a65_0x365d1f['unlinkSync'](_0x47d9b9);}catch{}return null;}}export function saveSessionContext(_0x3a7183,_0x50e876){const _0x412e57=a65_0x2068,_0x22906e=getSessionID(_0x50e876),_0x1148ff=/^\d+$/[_0x412e57(0x180)](_0x22906e)?parseInt(_0x22906e,0xa):getCurrentSessionPID(),_0xef217f=a65_0x419538[_0x412e57(0x189)](getSessionsDir(),_0x22906e+_0x412e57(0x184)),_0x5b84e5=getSessionsDir();createSecureDirectory(_0x5b84e5);const _0x323d58=JSON['stringify'](_0x3a7183);if(_0x323d58[_0x412e57(0x18a)](_0x412e57(0x18b))||_0x323d58[_0x412e57(0x18a)]('apiKey')||_0x323d58['includes'](_0x412e57(0x190)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x55f0c5;const _0x3e3e1c=/^\d+$/[_0x412e57(0x180)](_0x22906e)?loadSessionContextByPID(parseInt(_0x22906e,0xa)):loadSessionContextByString(_0x22906e);_0x3e3e1c?_0x55f0c5={..._0x3e3e1c,..._0x3a7183,'pid':_0x1148ff,'sessionId':_0x22906e!==_0x1148ff[_0x412e57(0x177)]()?_0x22906e:undefined,'updatedAt':new Date()[_0x412e57(0x185)]()}:_0x55f0c5={'pid':_0x1148ff,'sessionId':_0x22906e!==_0x1148ff[_0x412e57(0x177)]()?_0x22906e:undefined,..._0x3a7183,'createdAt':new Date()[_0x412e57(0x185)](),'updatedAt':new Date()[_0x412e57(0x185)]()},a65_0x365d1f[_0x412e57(0x17c)](_0xef217f,JSON[_0x412e57(0x186)](_0x55f0c5,null,0x2));}export function clearSessionContext(_0x5f4442){const _0x25f985=a65_0x2068,_0x4c2122=getSessionID(_0x5f4442),_0x19a071=a65_0x419538[_0x25f985(0x189)](getSessionsDir(),_0x4c2122+_0x25f985(0x184));a65_0x365d1f[_0x25f985(0x18f)](_0x19a071)&&a65_0x365d1f['unlinkSync'](_0x19a071);}export function clearSessionContextField(_0x5d3724,_0x5389ab){const _0x65bcf9=a65_0x2068,_0x13714d=getSessionID(_0x5389ab),_0x506bf3=a65_0x419538[_0x65bcf9(0x189)](getSessionsDir(),_0x13714d+'.json');if(!a65_0x365d1f[_0x65bcf9(0x18f)](_0x506bf3))return;try{const _0x4fd4cd=a65_0x365d1f[_0x65bcf9(0x18c)](_0x506bf3,_0x65bcf9(0x179)),_0x3ce804=JSON[_0x65bcf9(0x17e)](_0x4fd4cd);delete _0x3ce804[_0x5d3724],a65_0x365d1f[_0x65bcf9(0x17c)](_0x506bf3,JSON[_0x65bcf9(0x186)](_0x3ce804,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x5c7b3a=a65_0x2068,_0x372a0a=getSessionsDir();if(!a65_0x365d1f[_0x5c7b3a(0x18f)](_0x372a0a))return 0x0;let _0x1ae147=0x0;const _0x5a9396=Date[_0x5c7b3a(0x173)]();try{const _0x3b2ba9=a65_0x365d1f[_0x5c7b3a(0x17a)](_0x372a0a);for(const _0x48dfe2 of _0x3b2ba9){if(!_0x48dfe2[_0x5c7b3a(0x17b)](_0x5c7b3a(0x184)))continue;const _0xf90e19=a65_0x419538[_0x5c7b3a(0x189)](_0x372a0a,_0x48dfe2),_0x4a9ff0=_0x48dfe2[_0x5c7b3a(0x196)]('.json',''),_0xd4e955=parseInt(_0x4a9ff0,0xa),_0x3174ae=!isNaN(_0xd4e955);if(_0x3174ae){if(!isProcessRunning(_0xd4e955)){a65_0x365d1f[_0x5c7b3a(0x178)](_0xf90e19),_0x1ae147++;continue;}}try{const _0x1a0bfd=a65_0x365d1f[_0x5c7b3a(0x18c)](_0xf90e19,'utf-8'),_0x1a13a5=JSON[_0x5c7b3a(0x17e)](_0x1a0bfd),_0x283207=new Date(_0x1a13a5['createdAt'])[_0x5c7b3a(0x174)]();_0x5a9396-_0x283207>SESSION_EXPIRATION_MS&&(a65_0x365d1f[_0x5c7b3a(0x178)](_0xf90e19),_0x1ae147++);}catch{a65_0x365d1f['unlinkSync'](_0xf90e19),_0x1ae147++;}}}catch{}return _0x1ae147;}export function listActiveSessions(){const _0x57e54a=a65_0x2068,_0x2e7d3d=getSessionsDir();if(!a65_0x365d1f[_0x57e54a(0x18f)](_0x2e7d3d))return[];try{const _0x879a6=a65_0x365d1f[_0x57e54a(0x17a)](_0x2e7d3d),_0x8d20d9=[];for(const _0x3b3f41 of _0x879a6){if(!_0x3b3f41[_0x57e54a(0x17b)](_0x57e54a(0x184)))continue;const _0x18d9a1=_0x3b3f41[_0x57e54a(0x196)]('.json',''),_0x20467e=parseInt(_0x18d9a1,0xa);!isNaN(_0x20467e)&&isProcessRunning(_0x20467e)&&_0x8d20d9['push'](_0x20467e);}return _0x8d20d9[_0x57e54a(0x18d)]((_0xb94955,_0x41eb38)=>_0xb94955-_0x41eb38);}catch{return[];}}
@@ -1 +1 @@
1
- (function(_0x1444ab,_0x1949e5){const _0x327f67=a66_0x56a5,_0x2d7c4a=_0x1444ab();while(!![]){try{const _0x4fc5d1=-parseInt(_0x327f67(0xaf))/0x1*(-parseInt(_0x327f67(0xb3))/0x2)+parseInt(_0x327f67(0xaa))/0x3+parseInt(_0x327f67(0xb4))/0x4+-parseInt(_0x327f67(0xab))/0x5*(parseInt(_0x327f67(0xb2))/0x6)+-parseInt(_0x327f67(0xb0))/0x7+parseInt(_0x327f67(0xac))/0x8+-parseInt(_0x327f67(0xae))/0x9;if(_0x4fc5d1===_0x1949e5)break;else _0x2d7c4a['push'](_0x2d7c4a['shift']());}catch(_0xb2e2b5){_0x2d7c4a['push'](_0x2d7c4a['shift']());}}}(a66_0xf4a1,0x72df3));function a66_0xf4a1(){const _0x1d87c4=['1481600DNVpdS','7126360NmVewl','write','11079657HXfuOT','596TGlfbe','1085322ebZEOQ','read','6DbXZwq','1030lpLvCN','2918288kchFVH','676941joZDSL'];a66_0xf4a1=function(){return _0x1d87c4;};return a66_0xf4a1();}function a66_0x56a5(_0x4c9409,_0x4828db){_0x4c9409=_0x4c9409-0xaa;const _0xf4a1d4=a66_0xf4a1();let _0x56a5f2=_0xf4a1d4[_0x4c9409];return _0x56a5f2;}import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache('users-{profile}.json','core/user-cache');export function loadCachedUsers(_0x2add96){const _0xb294cf=a66_0x56a5,_0x4da415=userCache[_0xb294cf(0xb1)](_0x2add96);return _0x4da415?.['users']??null;}export function saveCachedUsers(_0x15b627,_0x3916b9){const _0x4b1fa2=a66_0x56a5;userCache[_0x4b1fa2(0xad)](_0x15b627,{'users':_0x3916b9,'cachedAt':Date['now']()});}export function clearUserCache(_0x5ba960){userCache['clear'](_0x5ba960);}
1
+ function a66_0x3494(_0x2b4c2f,_0x5a9ead){_0x2b4c2f=_0x2b4c2f-0x1da;const _0x181812=a66_0x1818();let _0x349433=_0x181812[_0x2b4c2f];return _0x349433;}const a66_0x42f521=a66_0x3494;(function(_0x2725b5,_0x4d3d13){const _0x2d7062=a66_0x3494,_0x584767=_0x2725b5();while(!![]){try{const _0x4c9742=-parseInt(_0x2d7062(0x1e8))/0x1+parseInt(_0x2d7062(0x1e6))/0x2*(parseInt(_0x2d7062(0x1e0))/0x3)+-parseInt(_0x2d7062(0x1e5))/0x4+-parseInt(_0x2d7062(0x1e2))/0x5+parseInt(_0x2d7062(0x1dc))/0x6*(parseInt(_0x2d7062(0x1df))/0x7)+-parseInt(_0x2d7062(0x1e1))/0x8+-parseInt(_0x2d7062(0x1e4))/0x9*(-parseInt(_0x2d7062(0x1e7))/0xa);if(_0x4c9742===_0x4d3d13)break;else _0x584767['push'](_0x584767['shift']());}catch(_0x3ff463){_0x584767['push'](_0x584767['shift']());}}}(a66_0x1818,0x4fc8a));import{createProfileCache}from'../utils/global-cache.js';function a66_0x1818(){const _0x3e9a80=['now','586914vekaoC','clear','users','14RnxHYZ','3XYyMjr','3408448HcansZ','1587670CuUJWP','read','2745qOWAiT','1233444KmvPOP','1272966XAsgjL','19690lrgfhM','53921uAqgdW','core/user-cache'];a66_0x1818=function(){return _0x3e9a80;};return a66_0x1818();}const userCache=createProfileCache('users-{profile}.json',a66_0x42f521(0x1da));export function loadCachedUsers(_0x369642){const _0x291329=a66_0x42f521,_0x243b2b=userCache[_0x291329(0x1e3)](_0x369642);return _0x243b2b?.[_0x291329(0x1de)]??null;}export function saveCachedUsers(_0x49d488,_0x424290){const _0x10d5cc=a66_0x42f521;userCache['write'](_0x49d488,{'users':_0x424290,'cachedAt':Date[_0x10d5cc(0x1db)]()});}export function clearUserCache(_0xedf778){const _0x8bcc45=a66_0x42f521;userCache[_0x8bcc45(0x1dd)](_0xedf778);}
@@ -1 +1 @@
1
- (function(_0x35f580,_0x4dc26a){const _0x239fa9=a67_0x217e,_0x471f1a=_0x35f580();while(!![]){try{const _0x25dffe=parseInt(_0x239fa9(0x11a))/0x1+-parseInt(_0x239fa9(0x112))/0x2+parseInt(_0x239fa9(0x10f))/0x3+parseInt(_0x239fa9(0x10c))/0x4+-parseInt(_0x239fa9(0x110))/0x5*(-parseInt(_0x239fa9(0x119))/0x6)+parseInt(_0x239fa9(0x118))/0x7+-parseInt(_0x239fa9(0x10e))/0x8;if(_0x25dffe===_0x4dc26a)break;else _0x471f1a['push'](_0x471f1a['shift']());}catch(_0x35800d){_0x471f1a['push'](_0x471f1a['shift']());}}}(a67_0x3738,0xc0b1a));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;function a67_0x217e(_0x46cfb2,_0x274491){_0x46cfb2=_0x46cfb2-0x10b;const _0x3738c6=a67_0x3738();let _0x217e8f=_0x3738c6[_0x46cfb2];return _0x217e8f;}export function getBuildInfo(){const _0x2e0290=a67_0x217e;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x462a25=fileURLToPath(import.meta.url),_0x29bb5b=dirname(_0x462a25);try{const _0x504d7a=join(_0x29bb5b,_0x2e0290(0x115));cachedBuildInfo=JSON[_0x2e0290(0x10b)](readFileSync(_0x504d7a,'utf-8'));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x526edb=a67_0x217e;if(cachedVersion!==null)return cachedVersion;const _0x78b139=fileURLToPath(import.meta.url),_0x14e6ba=dirname(_0x78b139),_0x225217=getBuildInfo();if(_0x225217['version'])return cachedVersion=_0x225217[_0x526edb(0x10d)],cachedVersion;try{const _0x417484=join(_0x14e6ba,_0x526edb(0x116)),_0x3840a8=JSON['parse'](readFileSync(_0x417484,_0x526edb(0x113)));cachedVersion=_0x3840a8['version'];}catch{cachedVersion=_0x526edb(0x117);}return cachedVersion;}function a67_0x3738(){const _0x2898d5=['28020160tybcdd','4670052YYkUVW','513185MiQEvw','.dev','61720EcNRqp','utf-8','includes','../build-info.json','../../package.json','0.0.0','902566tKBgFX','78mDASEG','1263872QAXkJk','parse','155516xLJJwC','version'];a67_0x3738=function(){return _0x2898d5;};return a67_0x3738();}export function isDevVersion(){const _0x10042d=a67_0x217e,_0x419df4=getVersion();return _0x419df4['includes'](_0x10042d(0x111))||_0x419df4[_0x10042d(0x114)]('-');}
1
+ (function(_0x523def,_0xaeaa19){const _0x36119c=a67_0x2480,_0x2f5943=_0x523def();while(!![]){try{const _0x5cc21b=parseInt(_0x36119c(0x1e7))/0x1*(parseInt(_0x36119c(0x1ed))/0x2)+-parseInt(_0x36119c(0x1e8))/0x3+-parseInt(_0x36119c(0x1e5))/0x4+-parseInt(_0x36119c(0x1f1))/0x5+parseInt(_0x36119c(0x1ee))/0x6*(parseInt(_0x36119c(0x1f5))/0x7)+-parseInt(_0x36119c(0x1f0))/0x8*(-parseInt(_0x36119c(0x1ea))/0x9)+-parseInt(_0x36119c(0x1f2))/0xa*(-parseInt(_0x36119c(0x1ec))/0xb);if(_0x5cc21b===_0xaeaa19)break;else _0x2f5943['push'](_0x2f5943['shift']());}catch(_0x194f13){_0x2f5943['push'](_0x2f5943['shift']());}}}(a67_0x2419,0x65407));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';function a67_0x2419(){const _0x3e4f26=['1572TdIHTT','parse','32UbaIvr','2276495Ixkajk','912850jhUZRg','utf-8','0.0.0','10458YQXdXk','2954412ecptSB','../build-info.json','1XszBQb','660003ASXrQf','version','1148706cxaLLy','.dev','33BkrqfZ','1305622AeQziW'];a67_0x2419=function(){return _0x3e4f26;};return a67_0x2419();}let cachedBuildInfo=null,cachedVersion=null;function a67_0x2480(_0x1b4c8a,_0x3c732d){_0x1b4c8a=_0x1b4c8a-0x1e5;const _0x24198d=a67_0x2419();let _0x248004=_0x24198d[_0x1b4c8a];return _0x248004;}export function getBuildInfo(){const _0x9c0269=a67_0x2480;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x2b4599=fileURLToPath(import.meta.url),_0x56d52d=dirname(_0x2b4599);try{const _0xa8435b=join(_0x56d52d,_0x9c0269(0x1e6));cachedBuildInfo=JSON['parse'](readFileSync(_0xa8435b,_0x9c0269(0x1f3)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x46d97e=a67_0x2480;if(cachedVersion!==null)return cachedVersion;const _0x5d9c84=fileURLToPath(import.meta.url),_0x2e9b0c=dirname(_0x5d9c84),_0x44e06c=getBuildInfo();if(_0x44e06c[_0x46d97e(0x1e9)])return cachedVersion=_0x44e06c['version'],cachedVersion;try{const _0x5f59cb=join(_0x2e9b0c,'../../package.json'),_0x582470=JSON[_0x46d97e(0x1ef)](readFileSync(_0x5f59cb,_0x46d97e(0x1f3)));cachedVersion=_0x582470[_0x46d97e(0x1e9)];}catch{cachedVersion=_0x46d97e(0x1f4);}return cachedVersion;}export function isDevVersion(){const _0x11adfc=a67_0x2480,_0x2fc32c=getVersion();return _0x2fc32c['includes'](_0x11adfc(0x1eb))||_0x2fc32c['includes']('-');}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(_0x4d5986,_0x4d085b){var _0x2490be=a68_0xfd70,_0x3a6ceb=_0x4d5986();while(!![]){try{var _0x27f507=-parseInt(_0x2490be(0x129))/0x1*(-parseInt(_0x2490be(0x127))/0x2)+-parseInt(_0x2490be(0x12c))/0x3+parseInt(_0x2490be(0x12d))/0x4+parseInt(_0x2490be(0x12a))/0x5*(parseInt(_0x2490be(0x12f))/0x6)+parseInt(_0x2490be(0x12b))/0x7+-parseInt(_0x2490be(0x12e))/0x8*(-parseInt(_0x2490be(0x131))/0x9)+parseInt(_0x2490be(0x128))/0xa*(-parseInt(_0x2490be(0x130))/0xb);if(_0x27f507===_0x4d085b)break;else _0x3a6ceb['push'](_0x3a6ceb['shift']());}catch(_0x1a56df){_0x3a6ceb['push'](_0x3a6ceb['shift']());}}}(a68_0x3b32,0xc602c));export*from'./sdk/types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./sdk/client/http-client.js';function a68_0xfd70(_0x43a4da,_0x5d45ec){_0x43a4da=_0x43a4da-0x127;var _0x3b32cd=a68_0x3b32();var _0xfd7080=_0x3b32cd[_0x43a4da];return _0xfd7080;}function a68_0x3b32(){var _0x3e6074=['10720031BWusZF','2682558geXJYk','3017888LulIpE','9063760SFbdMu','3336678bdDdmn','713581PvrXzp','9ADTMtA','54654aZcdRe','590RwOLhl','57SZQEFl','5ajIiNu'];a68_0x3b32=function(){return _0x3e6074;};return a68_0x3b32();}export*from'./sdk/client/td-api-client.js';export{TrinoApiClient}from'./sdk/client/trino-api-client.js';export*from'./sdk/client/rate-limiter.js';export*from'./sdk/types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';
1
+ (function(_0x191fb0,_0x1c0b29){var _0x59fe6a=a68_0x2304,_0x588f35=_0x191fb0();while(!![]){try{var _0x34462a=parseInt(_0x59fe6a(0x14d))/0x1+-parseInt(_0x59fe6a(0x147))/0x2*(parseInt(_0x59fe6a(0x14b))/0x3)+parseInt(_0x59fe6a(0x146))/0x4*(parseInt(_0x59fe6a(0x145))/0x5)+parseInt(_0x59fe6a(0x14a))/0x6+-parseInt(_0x59fe6a(0x148))/0x7*(-parseInt(_0x59fe6a(0x14f))/0x8)+parseInt(_0x59fe6a(0x14c))/0x9*(parseInt(_0x59fe6a(0x14e))/0xa)+-parseInt(_0x59fe6a(0x149))/0xb;if(_0x34462a===_0x1c0b29)break;else _0x588f35['push'](_0x588f35['shift']());}catch(_0x3ae005){_0x588f35['push'](_0x588f35['shift']());}}}(a68_0x288c,0x76d9e));export*from'./sdk/types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./sdk/client/http-client.js';function a68_0x2304(_0x1d137c,_0x4b5924){_0x1d137c=_0x1d137c-0x145;var _0x288ca3=a68_0x288c();var _0x230412=_0x288ca3[_0x1d137c];return _0x230412;}export*from'./sdk/client/td-api-client.js';export{TrinoApiClient}from'./sdk/client/trino-api-client.js';export*from'./sdk/client/rate-limiter.js';export*from'./sdk/types/trino.js';function a68_0x288c(){var _0x45ae97=['508216YtXOeZ','3320nXDeza','1997373ARVBme','23820489EdyAyl','4640622drzYSV','453LWkZxo','156537zIxovO','817746xUldqP','280LYWPZq','16OOQnSy','10veNKkT'];a68_0x288c=function(){return _0x45ae97;};return a68_0x288c();}export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';