@treasuredata/tdx 2026.3.20 → 2026.3.21

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 (223) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.d.ts +1 -1
  4. package/dist/cli-categories.js +1 -1
  5. package/dist/cli-categories.js.map +1 -1
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +1 -1
  8. package/dist/cli.js.map +1 -1
  9. package/dist/commands/activations.js +1 -1
  10. package/dist/commands/agent-command.js +1 -1
  11. package/dist/commands/agent-test-command.js +1 -1
  12. package/dist/commands/api-command.js +1 -1
  13. package/dist/commands/auth-command.js +1 -1
  14. package/dist/commands/auth-login-command.js +1 -1
  15. package/dist/commands/chat-command.js +1 -1
  16. package/dist/commands/claude-command.js +1 -1
  17. package/dist/commands/claude-statusline-command.js +1 -1
  18. package/dist/commands/claude-usage-command.js +1 -1
  19. package/dist/commands/command.js +1 -1
  20. package/dist/commands/connection-command.js +1 -1
  21. package/dist/commands/databases.js +1 -1
  22. package/dist/commands/delivery-command.js +1 -1
  23. package/dist/commands/describe.js +1 -1
  24. package/dist/commands/engage-campaign-pull-command.js +1 -1
  25. package/dist/commands/engage-campaign-push-command.js +1 -1
  26. package/dist/commands/engage-campaign-validate-command.js +1 -1
  27. package/dist/commands/engage-command.js +1 -1
  28. package/dist/commands/engage-template-pull-command.js +1 -1
  29. package/dist/commands/engage-template-push-command.js +1 -1
  30. package/dist/commands/engage-template-validate-command.js +1 -1
  31. package/dist/commands/job-command.js +1 -1
  32. package/dist/commands/journey-command.js +1 -1
  33. package/dist/commands/journey-validate-command.js +1 -1
  34. package/dist/commands/llm-command.js +1 -1
  35. package/dist/commands/mcp-command.js +1 -1
  36. package/dist/commands/parent-segment-command.js +1 -1
  37. package/dist/commands/policy-command.d.ts +33 -0
  38. package/dist/commands/policy-command.d.ts.map +1 -0
  39. package/dist/commands/policy-command.js +1 -0
  40. package/dist/commands/policy-command.js.map +1 -0
  41. package/dist/commands/profile-command.js +1 -1
  42. package/dist/commands/profiles-command.js +1 -1
  43. package/dist/commands/query-command.js +1 -1
  44. package/dist/commands/schedule-command.js +1 -1
  45. package/dist/commands/segment-command.js +1 -1
  46. package/dist/commands/segment-create-command.js +1 -1
  47. package/dist/commands/segment-fields-command.js +1 -1
  48. package/dist/commands/segment-pull-command.js +1 -1
  49. package/dist/commands/segment-push-command.js +1 -1
  50. package/dist/commands/segment-update-command.js +1 -1
  51. package/dist/commands/segment-use-command.js +1 -1
  52. package/dist/commands/segment-validate-command.js +1 -1
  53. package/dist/commands/segments.js +1 -1
  54. package/dist/commands/show.js +1 -1
  55. package/dist/commands/status-command.js +1 -1
  56. package/dist/commands/tables.js +1 -1
  57. package/dist/commands/unset-command.js +1 -1
  58. package/dist/commands/upgrade-command.js +1 -1
  59. package/dist/commands/use-command.js +1 -1
  60. package/dist/commands/user-command.js +1 -1
  61. package/dist/commands/workflow-command.js +1 -1
  62. package/dist/core/auth.js +1 -1
  63. package/dist/core/command-output.js +1 -1
  64. package/dist/core/config.js +1 -1
  65. package/dist/core/connection-cache.js +1 -1
  66. package/dist/core/constants.js +1 -1
  67. package/dist/core/credential-cache.js +1 -1
  68. package/dist/core/global-context.js +1 -1
  69. package/dist/core/keychain.js +1 -1
  70. package/dist/core/oauth-keychain.js +1 -1
  71. package/dist/core/oauth.js +1 -1
  72. package/dist/core/profile.js +1 -1
  73. package/dist/core/project-config.js +1 -1
  74. package/dist/core/session.js +1 -1
  75. package/dist/core/user-cache.js +1 -1
  76. package/dist/core/version.js +1 -1
  77. package/dist/index.js +1 -1
  78. package/dist/mcp/server.js +1 -1
  79. package/dist/mcp/tools/index.js +1 -1
  80. package/dist/mcp/tools/tdx-run.js +1 -1
  81. package/dist/mcp/tools/tdx-search.js +1 -1
  82. package/dist/mcp/utils.js +1 -1
  83. package/dist/proxy/claude-usage-tracker.js +1 -1
  84. package/dist/proxy/passthrough-server.js +1 -1
  85. package/dist/proxy/sse-usage-parser.js +1 -1
  86. package/dist/sdk/agent/agent-config.js +1 -1
  87. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  88. package/dist/sdk/agent/agent-yaml.js +1 -1
  89. package/dist/sdk/agent/test/evaluator.js +1 -1
  90. package/dist/sdk/agent/test/executor.js +1 -1
  91. package/dist/sdk/agent/test/index.js +1 -1
  92. package/dist/sdk/agent/test/output.js +1 -1
  93. package/dist/sdk/agent/test/parser.js +1 -1
  94. package/dist/sdk/agent/tool-target-registry.js +1 -1
  95. package/dist/sdk/api.js +1 -1
  96. package/dist/sdk/client/cdp-api-client.js +1 -1
  97. package/dist/sdk/client/delivery-api-client.js +1 -1
  98. package/dist/sdk/client/endpoints.js +1 -1
  99. package/dist/sdk/client/engage-api-client.js +1 -1
  100. package/dist/sdk/client/http-client.js +1 -1
  101. package/dist/sdk/client/llm-api-client.js +1 -1
  102. package/dist/sdk/client/oauth-refresh.js +1 -1
  103. package/dist/sdk/client/rate-limiter.js +1 -1
  104. package/dist/sdk/client/td-api-client.js +1 -1
  105. package/dist/sdk/client/trino-api-client.js +1 -1
  106. package/dist/sdk/client/workflow-client.js +1 -1
  107. package/dist/sdk/connection-validator.js +1 -1
  108. package/dist/sdk/connection.js +1 -1
  109. package/dist/sdk/delivery.js +1 -1
  110. package/dist/sdk/engage/campaign-pull.js +1 -1
  111. package/dist/sdk/engage/campaign-push.js +1 -1
  112. package/dist/sdk/engage/campaign-validator.js +1 -1
  113. package/dist/sdk/engage/campaign-yaml.js +1 -1
  114. package/dist/sdk/engage/template-pull.js +1 -1
  115. package/dist/sdk/engage/template-push.js +1 -1
  116. package/dist/sdk/engage/template-validator.js +1 -1
  117. package/dist/sdk/engage/template-yaml.js +1 -1
  118. package/dist/sdk/engage/types/campaign-def.js +1 -1
  119. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  120. package/dist/sdk/engage/types/template-schema.js +1 -1
  121. package/dist/sdk/engage.js +1 -1
  122. package/dist/sdk/errors.js +1 -1
  123. package/dist/sdk/index.d.ts +7 -0
  124. package/dist/sdk/index.d.ts.map +1 -1
  125. package/dist/sdk/index.js +1 -1
  126. package/dist/sdk/index.js.map +1 -1
  127. package/dist/sdk/io/index.js +1 -1
  128. package/dist/sdk/io/node-filesystem.js +1 -1
  129. package/dist/sdk/job.js +1 -1
  130. package/dist/sdk/journey.js +1 -1
  131. package/dist/sdk/llm/chat-cache.js +1 -1
  132. package/dist/sdk/llm/index.js +1 -1
  133. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  134. package/dist/sdk/llm/model-factors.js +1 -1
  135. package/dist/sdk/personalization.js +1 -1
  136. package/dist/sdk/policy.d.ts +41 -0
  137. package/dist/sdk/policy.d.ts.map +1 -0
  138. package/dist/sdk/policy.js +1 -0
  139. package/dist/sdk/policy.js.map +1 -0
  140. package/dist/sdk/query/index.js +1 -1
  141. package/dist/sdk/query/sql-parser.js +1 -1
  142. package/dist/sdk/realtime.js +1 -1
  143. package/dist/sdk/schedule.js +1 -1
  144. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  145. package/dist/sdk/segment/fields-display.js +1 -1
  146. package/dist/sdk/segment/file-discovery.js +1 -1
  147. package/dist/sdk/segment/journey-utils.js +1 -1
  148. package/dist/sdk/segment/journey-validator.js +1 -1
  149. package/dist/sdk/segment/journey-yaml.js +1 -1
  150. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  151. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  152. package/dist/sdk/segment/pull-workflow.js +1 -1
  153. package/dist/sdk/segment/push-recovery.js +1 -1
  154. package/dist/sdk/segment/push-workflow.js +1 -1
  155. package/dist/sdk/segment/resolution-context.js +1 -1
  156. package/dist/sdk/segment/segment-path-parser.js +1 -1
  157. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  158. package/dist/sdk/segment/segment-validator.js +1 -1
  159. package/dist/sdk/segment/target-resolution.js +1 -1
  160. package/dist/sdk/segment/tdx-config.js +1 -1
  161. package/dist/sdk/segment/types/activation-schema.js +1 -1
  162. package/dist/sdk/segment/types/journey-def.js +1 -1
  163. package/dist/sdk/segment/types/journey-schema.js +1 -1
  164. package/dist/sdk/segment/types/segment-def.js +1 -1
  165. package/dist/sdk/segment/types/segment-schema.js +1 -1
  166. package/dist/sdk/segment/validate-files.js +1 -1
  167. package/dist/sdk/segment/yaml-validator.js +1 -1
  168. package/dist/sdk/segment.js +1 -1
  169. package/dist/sdk/types/index.d.ts +1 -0
  170. package/dist/sdk/types/index.d.ts.map +1 -1
  171. package/dist/sdk/types/index.js +1 -1
  172. package/dist/sdk/types/index.js.map +1 -1
  173. package/dist/sdk/types/policy.d.ts +58 -0
  174. package/dist/sdk/types/policy.d.ts.map +1 -0
  175. package/dist/sdk/types/policy.js +1 -0
  176. package/dist/sdk/types/policy.js.map +1 -0
  177. package/dist/sdk/types/progress.js +1 -1
  178. package/dist/sdk/user.js +1 -1
  179. package/dist/sdk/util/format-detector.js +1 -1
  180. package/dist/sdk/util/formatters.js +1 -1
  181. package/dist/sdk/util/index.js +1 -1
  182. package/dist/sdk/util/paginate.js +1 -1
  183. package/dist/sdk/util/tree-formatter.js +1 -1
  184. package/dist/sdk/workflow/archive-validation.js +1 -1
  185. package/dist/sdk/workflow/clone-workflow.js +1 -1
  186. package/dist/sdk/workflow/index.js +1 -1
  187. package/dist/sdk/workflow/pull-workflow.js +1 -1
  188. package/dist/sdk/workflow/push-workflow.js +1 -1
  189. package/dist/sdk/workflow/tdx-config.js +1 -1
  190. package/dist/sdk/workflow/workflow-utils.js +1 -1
  191. package/dist/test-utils/command-runner.js +1 -1
  192. package/dist/test-utils/factories.js +1 -1
  193. package/dist/test-utils/fixtures.js +1 -1
  194. package/dist/test-utils/http-mock.js +1 -1
  195. package/dist/test-utils/index.js +1 -1
  196. package/dist/utils/async.js +1 -1
  197. package/dist/utils/colors.js +1 -1
  198. package/dist/utils/diff.js +1 -1
  199. package/dist/utils/file-permissions.js +1 -1
  200. package/dist/utils/file-reader.js +1 -1
  201. package/dist/utils/github-releases.js +1 -1
  202. package/dist/utils/global-cache.js +1 -1
  203. package/dist/utils/json-loader.js +1 -1
  204. package/dist/utils/local-cache.js +1 -1
  205. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  206. package/dist/utils/logger/formatters/index.js +1 -1
  207. package/dist/utils/logger/handlers/console-handler.js +1 -1
  208. package/dist/utils/logger/handlers/file-handler.js +1 -1
  209. package/dist/utils/logger/handlers/index.js +1 -1
  210. package/dist/utils/logger/handlers/null-handler.js +1 -1
  211. package/dist/utils/logger/index.js +1 -1
  212. package/dist/utils/logger/logger.js +1 -1
  213. package/dist/utils/logger/types.js +1 -1
  214. package/dist/utils/option-validation.js +1 -1
  215. package/dist/utils/process.js +1 -1
  216. package/dist/utils/prompt.js +1 -1
  217. package/dist/utils/spinner.js +1 -1
  218. package/dist/utils/sse-parser.js +1 -1
  219. package/dist/utils/string-utils.js +1 -1
  220. package/dist/utils/table-ref-parser.js +1 -1
  221. package/dist/utils/tdx-logger.js +1 -1
  222. package/dist/utils/version-check.js +1 -1
  223. package/package.json +1 -1
@@ -1 +1 @@
1
- const a54_0x35d6e9=a54_0xa539;(function(_0x4d6d5c,_0x233e7f){const _0x56a87f=a54_0xa539,_0x414819=_0x4d6d5c();while(!![]){try{const _0x251d57=-parseInt(_0x56a87f(0x12c))/0x1+parseInt(_0x56a87f(0xf1))/0x2+-parseInt(_0x56a87f(0xe1))/0x3*(-parseInt(_0x56a87f(0xeb))/0x4)+-parseInt(_0x56a87f(0x109))/0x5*(-parseInt(_0x56a87f(0x115))/0x6)+parseInt(_0x56a87f(0xe2))/0x7+parseInt(_0x56a87f(0x10e))/0x8+parseInt(_0x56a87f(0xfd))/0x9*(-parseInt(_0x56a87f(0x11b))/0xa);if(_0x251d57===_0x233e7f)break;else _0x414819['push'](_0x414819['shift']());}catch(_0x34fcae){_0x414819['push'](_0x414819['shift']());}}}(a54_0x16d4,0xe5944));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a54_0x161096 from'node:fs';import*as a54_0x9e867d 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 a54_0x575e31 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x18a712=a54_0xa539;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x18a712(0x121),_0x18a712(0xee));}export function getConfigFile(){const _0x78cf53=a54_0xa539;return join(getConfigDir(),_0x78cf53(0x102));}function a54_0x16d4(){const _0x5194f4=['keychain','.env','projectId','stg-ap03','TD_API_KEY','config/account-info','replace','toUpperCase','6066905PcggFU','readFileSync','.json','stg-us01','llm_default_project','12521120FYqxzR','filter','map','split','dev-us01','warn','parse','6zXBeTN','match','read','keychain\x20(profile:\x20','accessToken','llm_default_agent','50sXaTMQ','slice','yellow','next','config/llm-agent','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','.config','TD_API_KEY_','entries','ap02','ap01','proxy','us01','number','Warning:\x20Unknown\x20site\x20\x27','TDX_ACCESS_TOKEN_','name','1117539VUMRwP','\x27,\x20defaulting\x20to\x20us01','release_channel','ap03','stg-ap01','4405977Wiaiqg','12218647paPfbX','accountId','endsWith','stringify','apiKeys','source','trim','TDX_API_KEY_','eu01','4TbwLYe','clear','join','tdx','stable','\x20env\x20var','2849158GzwZrm','Warning:\x20Failed\x20to\x20read\x20','string','.env.','path','utf-8','existsSync','toISOString','startsWith','write','includes','account_info','9646893CTKjVW','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','tdx.json','config/llm-project'];a54_0x16d4=function(){return _0x5194f4;};return a54_0x16d4();}export function getConfigFilePath(_0x33e412){const _0x1b4bf4=a54_0xa539,_0x452d71=getConfigDir();return _0x33e412?a54_0x9e867d['join'](_0x452d71,_0x1b4bf4(0xf4)+_0x33e412):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a54_0x35d6e9(0x10d),a54_0x35d6e9(0x100));export function getLLMProjectCacheFile(_0x22b49a){return llmProjectCache['path'](_0x22b49a);}export function readCachedLLMProject(_0x283fca){const _0x401251=a54_0x35d6e9,_0x1ee499=llmProjectCache['read'](_0x283fca);if(_0x1ee499&&typeof _0x1ee499['id']===_0x401251(0xf3)&&typeof _0x1ee499[_0x401251(0x12b)]===_0x401251(0xf3))return _0x1ee499;return null;}export function writeCachedLLMProject(_0x414980,_0x1b1ca1,_0x3098d7){const _0x332e05=a54_0x35d6e9;try{llmProjectCache[_0x332e05(0xfa)]({'name':_0x414980,'id':_0x1b1ca1},_0x3098d7);}catch{}}const llmAgentCache=createOptionalProfileCache(a54_0x35d6e9(0x11a),a54_0x35d6e9(0x11f));export function getLLMAgentCacheFile(_0x2be858){const _0xc44fb5=a54_0x35d6e9;return llmAgentCache[_0xc44fb5(0xf5)](_0x2be858);}export function readCachedLLMAgent(_0x3c323d){const _0x14d0f3=a54_0x35d6e9,_0x919543=llmAgentCache[_0x14d0f3(0x117)](_0x3c323d);if(_0x919543&&typeof _0x919543['id']===_0x14d0f3(0xf3)&&typeof _0x919543[_0x14d0f3(0x12b)]===_0x14d0f3(0xf3)&&typeof _0x919543[_0x14d0f3(0x103)]===_0x14d0f3(0xf3))return _0x919543;return null;}export function writeCachedLLMAgent(_0x51f8c8,_0x228475,_0x3cbef1,_0x3c2fae){const _0x4b796a=a54_0x35d6e9;try{llmAgentCache[_0x4b796a(0xfa)]({'name':_0x51f8c8,'id':_0x228475,'projectId':_0x3cbef1},_0x3c2fae);}catch{}}export function clearCachedLLMAgent(_0x364298){const _0x43cf68=a54_0x35d6e9;try{llmAgentCache[_0x43cf68(0xec)](_0x364298);}catch{}}const accountInfoCache=createOptionalProfileCache(a54_0x35d6e9(0xfc),a54_0x35d6e9(0x106),{'suffix':a54_0x35d6e9(0x10b)});export function getAccountInfoCacheFile(_0x33c66f){const _0x5a72d9=a54_0x35d6e9;return accountInfoCache[_0x5a72d9(0xf5)](_0x33c66f);}export function readCachedAccountInfo(_0x37892d){const _0x5dcaf5=a54_0x35d6e9,_0x5df100=accountInfoCache[_0x5dcaf5(0x117)](_0x37892d);if(_0x5df100&&typeof _0x5df100['site']===_0x5dcaf5(0xf3)&&typeof _0x5df100[_0x5dcaf5(0xe3)]===_0x5dcaf5(0x128))return _0x5df100;return null;}export function writeCachedAccountInfo(_0x49b34c,_0x48f513,_0x2f2268){const _0x3a30bd=a54_0x35d6e9;try{accountInfoCache[_0x3a30bd(0xfa)]({'site':_0x49b34c,'accountId':_0x48f513,'cachedAt':new Date()[_0x3a30bd(0xf8)]()},_0x2f2268);}catch{}}function a54_0xa539(_0x140bcc,_0x128166){_0x140bcc=_0x140bcc-0xdd;const _0x16d45a=a54_0x16d4();let _0xa539ba=_0x16d45a[_0x140bcc];return _0xa539ba;}export function parseEnvFile(_0x4ae21c){const _0x1aad6a=a54_0x35d6e9,_0x1eeb7={};for(const _0x6439b2 of _0x4ae21c[_0x1aad6a(0x111)]('\x0a')){const _0x43e187=_0x6439b2[_0x1aad6a(0xe8)]();if(!_0x43e187||_0x43e187[_0x1aad6a(0xf9)]('#'))continue;const _0x435aff=_0x43e187[_0x1aad6a(0x116)](/^([^=]+)=(.*)$/);if(_0x435aff){const _0x148cc6=_0x435aff[0x1]['trim']();let _0x275d76=_0x435aff[0x2][_0x1aad6a(0xe8)]();(_0x275d76[_0x1aad6a(0xf9)]('\x22')&&_0x275d76['endsWith']('\x22')||_0x275d76[_0x1aad6a(0xf9)]('\x27')&&_0x275d76[_0x1aad6a(0xe4)]('\x27'))&&(_0x275d76=_0x275d76[_0x1aad6a(0x11c)](0x1,-0x1)),_0x1eeb7[_0x148cc6]=_0x275d76;}}return _0x1eeb7;}export function readUserConfig(){const _0x453f20=a54_0x35d6e9,_0xccf94d=getConfigFile();if(!existsSync(_0xccf94d))return{};try{const _0x1af895=readFileSync(_0xccf94d,'utf-8');return parseEnvFile(_0x1af895);}catch(_0x1cc16f){return console[_0x453f20(0x113)](_0x453f20(0xfe)+_0xccf94d+':',_0x1cc16f),{};}}export function resolveSite(_0x5f1e30){const _0x211932=a54_0x35d6e9,_0x238a43=[_0x211932(0x127),_0x211932(0x125),_0x211932(0xea),_0x211932(0x124),_0x211932(0xdf),_0x211932(0x112),'dev-eu01',_0x211932(0x10c),'stg-ap01',_0x211932(0x104)];if(_0x238a43[_0x211932(0xfb)](_0x5f1e30))return _0x5f1e30;if(_0x5f1e30 in SITE_ALIASES)return SITE_ALIASES[_0x5f1e30];return console[_0x211932(0x113)](_0x211932(0x129)+_0x5f1e30+_0x211932(0xdd)),_0x211932(0x127);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x445f27){const _0x325e53=a54_0x35d6e9,_0x599916=_0x445f27||getActiveProfileName()||undefined;if(_0x599916){const _0x2297e9=_0x325e53(0x12a)+normalizeProfileForEnvVar(_0x599916);if(process.env[_0x2297e9])return{'accessToken':process.env[_0x2297e9],'source':_0x2297e9+_0x325e53(0xf0)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':'TDX_ACCESS_TOKEN\x20env\x20var'};return null;}export function getAccessToken(_0x1ecfdf){const _0x3a9525=a54_0x35d6e9;return resolveAccessToken(_0x1ecfdf)?.[_0x3a9525(0x119)];}export function getAPIKey(_0x52f087){const _0x54d493=a54_0x35d6e9,_0x11f01e=_0x52f087||getActiveProfileName();if(_0x11f01e){const _0x37c27d=_0x54d493(0xe9)+normalizeProfileForEnvVar(_0x11f01e);if(process.env[_0x37c27d])return process.env[_0x37c27d];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x514edc){const _0x5ccdf1=a54_0x35d6e9;return _0x514edc[_0x5ccdf1(0x108)]()[_0x5ccdf1(0x107)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x4918b1,_0x3946f3){const _0x129e24=a54_0x35d6e9,_0x12b797=resolveAccessToken(_0x3946f3);if(_0x12b797)return{'apiKey':_0x12b797[_0x129e24(0x119)],'source':_0x12b797[_0x129e24(0xe7)],'isDeprecated':![]};const _0x48b773=_0x3946f3||getActiveProfileName()||undefined;if(_0x48b773){const _0x30e812='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x48b773);if(process.env[_0x30e812])return{'apiKey':process.env[_0x30e812],'source':_0x30e812+_0x129e24(0xf0),'isDeprecated':![]};const _0x398e0b=getCachedCredential(_0x4918b1,_0x48b773);if(_0x398e0b)return{'apiKey':_0x398e0b,'source':_0x129e24(0x118)+_0x48b773+')','isDeprecated':![]};const _0x29cca6=await getKeychainAPIKey(_0x48b773);if(_0x29cca6)return setCachedCredential(_0x29cca6,_0x4918b1,_0x48b773),{'apiKey':_0x29cca6,'source':_0x129e24(0x118)+_0x48b773+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':'TDX_API_KEY\x20env\x20var','isDeprecated':![]};if(!_0x48b773){const _0x789711=getCachedCredential(_0x4918b1,undefined);if(_0x789711)return{'apiKey':_0x789711,'source':'keychain','isDeprecated':![]};const _0x520782=await getKeychainAPIKey(undefined);if(_0x520782)return setCachedCredential(_0x520782,_0x4918b1,undefined),{'apiKey':_0x520782,'source':_0x129e24(0x101),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x571e9c,_0x8cecc8){const _0x43ef7e=await resolveAPIKeyAsync(_0x571e9c,_0x8cecc8);return _0x43ef7e?.['apiKey'];}function cleanupLegacyEnvFile(_0x34d298){const _0x478326=a54_0x35d6e9;if(!existsSync(_0x34d298))return![];try{const _0x250d77=readFileSync(_0x34d298,_0x478326(0xf6)),_0x1826b0=_0x250d77['split']('\x0a'),_0x2dd899=_0x1826b0[_0x478326(0x10f)](_0x49b8bf=>{const _0xa54b62=_0x478326,_0x3903ec=_0x49b8bf[_0xa54b62(0xe8)]();if(!_0x3903ec||_0x3903ec[_0xa54b62(0xf9)]('#'))return!![];const [_0x170802]=_0x3903ec[_0xa54b62(0x111)]('=');return!_0x170802[_0xa54b62(0xf9)](_0xa54b62(0x105));}),_0x1969eb=_0x2dd899['some'](_0x2fad1a=>{const _0x34c71=_0x478326,_0xcaacbf=_0x2fad1a[_0x34c71(0xe8)]();return _0xcaacbf&&!_0xcaacbf[_0x34c71(0xf9)]('#');});if(!_0x1969eb)return unlinkSync(_0x34d298),!![];return writeFileSync(_0x34d298,_0x2dd899[_0x478326(0xed)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x8f02d2=a54_0x35d6e9;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x530973=a54_0x9e867d[_0x8f02d2(0xed)](getConfigDir(),_0x8f02d2(0xff));if(!a54_0x161096['existsSync'](_0x530973))return null;try{const _0x49b102=a54_0x161096['readFileSync'](_0x530973,_0x8f02d2(0xf6)),_0x2ea4eb=JSON['parse'](_0x49b102);return _0x2ea4eb['profile']||null;}catch{return null;}}export function saveAPIKey(_0x563c80,_0x2b3b09,_0x32a3c9){const _0x26e731=a54_0x35d6e9,_0x34934e=getConfigDir(),_0x53c410=getConfigFilePath(_0x32a3c9);!existsSync(_0x34934e)&&mkdirSync(_0x34934e,{'recursive':!![],'mode':0x1c0});let _0x3a7b0c={};if(existsSync(_0x53c410))try{const _0x34a787=readFileSync(_0x53c410,_0x26e731(0xf6));_0x3a7b0c=parseEnvFile(_0x34a787);}catch(_0x3d00a8){console[_0x26e731(0x113)](_0x26e731(0xf2)+_0x53c410+':',_0x3d00a8);}const _0x4e753f=_0x563c80['toUpperCase']()[_0x26e731(0x107)](/-/g,'_');_0x3a7b0c[_0x26e731(0x122)+_0x4e753f]=_0x2b3b09;const _0x515213=Object[_0x26e731(0x123)](_0x3a7b0c)[_0x26e731(0x110)](([_0x54f595,_0x2474b1])=>_0x54f595+'='+_0x2474b1);writeFileSync(_0x53c410,_0x515213[_0x26e731(0xed)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x2c5441,_0x446443,_0x47dd3){const _0x374fca=a54_0x35d6e9;await saveKeychainAPIKey(_0x2c5441,_0x47dd3),setCachedCredential(_0x2c5441,_0x446443,_0x47dd3);const _0x274ad8=getConfigFilePath(_0x47dd3);cleanupLegacyEnvFile(_0x274ad8)&&console['warn'](a54_0x575e31[_0x374fca(0x11d)](_0x374fca(0x120)));}export function loadConfig(){const _0x2e2410=a54_0x35d6e9,_0x570c6e={'apiKeys':{},'defaultSite':_0x2e2410(0x127)},_0x3e65ad=[_0x2e2410(0x127),_0x2e2410(0x125),_0x2e2410(0xea),_0x2e2410(0x124),_0x2e2410(0xdf),_0x2e2410(0x112),'dev-eu01',_0x2e2410(0x10c),_0x2e2410(0xe0),_0x2e2410(0x104)],_0x26aeec=getAPIKey();if(_0x26aeec)for(const _0x2a9c00 of _0x3e65ad){_0x570c6e[_0x2e2410(0xe6)][_0x2a9c00]=_0x26aeec;}return _0x570c6e;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x1b62e2=a54_0x35d6e9,_0x319e87=a54_0x9e867d[_0x1b62e2(0xed)](getConfigDir(),'tdx.json');if(!a54_0x161096[_0x1b62e2(0xf7)](_0x319e87))return undefined;try{const _0x4d0489=a54_0x161096['readFileSync'](_0x319e87,_0x1b62e2(0xf6)),_0x573cfc=JSON[_0x1b62e2(0x114)](_0x4d0489);return typeof _0x573cfc[_0x1b62e2(0x126)]==='string'?_0x573cfc[_0x1b62e2(0x126)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x2916b5=a54_0x35d6e9,_0x58130b=process.env.TDX_RELEASE_CHANNEL;if(_0x58130b===_0x2916b5(0x11e)||_0x58130b==='stable')return _0x58130b;const _0x29fa3f=a54_0x9e867d[_0x2916b5(0xed)](getConfigDir(),_0x2916b5(0xff));if(!a54_0x161096[_0x2916b5(0xf7)](_0x29fa3f))return'stable';try{const _0x24dd3d=a54_0x161096[_0x2916b5(0x10a)](_0x29fa3f,'utf-8'),_0x31d310=JSON['parse'](_0x24dd3d);if(_0x31d310[_0x2916b5(0xde)]===_0x2916b5(0x11e))return _0x2916b5(0x11e);}catch{}return _0x2916b5(0xef);}export function saveReleaseChannel(_0x4174fc){const _0xebd367=a54_0x35d6e9,_0x40b6c6=getConfigDir(),_0xa67e41=a54_0x9e867d['join'](_0x40b6c6,_0xebd367(0xff));!existsSync(_0x40b6c6)&&mkdirSync(_0x40b6c6,{'recursive':!![],'mode':0x1c0});let _0x1b1fa8={};if(existsSync(_0xa67e41))try{const _0x454044=readFileSync(_0xa67e41,_0xebd367(0xf6));_0x1b1fa8=JSON['parse'](_0x454044);}catch{}_0x1b1fa8[_0xebd367(0xde)]=_0x4174fc,writeFileSync(_0xa67e41,JSON[_0xebd367(0xe5)](_0x1b1fa8,null,0x2),{'mode':0x180});}
1
+ const a55_0x406663=a55_0x3198;(function(_0x5ea9ba,_0x5cfeb9){const _0x52d56c=a55_0x3198,_0x43be48=_0x5ea9ba();while(!![]){try{const _0xa719ae=-parseInt(_0x52d56c(0x153))/0x1+parseInt(_0x52d56c(0x180))/0x2+-parseInt(_0x52d56c(0x181))/0x3+parseInt(_0x52d56c(0x175))/0x4+parseInt(_0x52d56c(0x148))/0x5+parseInt(_0x52d56c(0x151))/0x6+-parseInt(_0x52d56c(0x14c))/0x7*(parseInt(_0x52d56c(0x17f))/0x8);if(_0xa719ae===_0x5cfeb9)break;else _0x43be48['push'](_0x43be48['shift']());}catch(_0x16aefc){_0x43be48['push'](_0x43be48['shift']());}}}(a55_0x3012,0xa0f2f));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a55_0x5264bd from'node:fs';import*as a55_0x4dbef1 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_0x2a9baf from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';function a55_0x3012(){const _0x5f13c1=['tdx.json','startsWith','write','string','.config','some','join','TD_API_KEY_','parse','ap03','TDX_ACCESS_TOKEN\x20env\x20var','TDX_API_KEY\x20env\x20var','apiKeys','llm_default_project','.json','tdx','143065KdGQqi','stringify','entries','stg-ap03','6839nfpqTS','yellow','ap01','ap02','Warning:\x20Unknown\x20site\x20\x27','1905618XmMlLn','existsSync','101188aWMRWV','replace','site','config/account-info','us01','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','dev-eu01','release_channel','slice','\x27,\x20defaulting\x20to\x20us01','split','TD_API_KEY','.env','source','config/llm-agent','profile','path','.env.','config/llm-project','read','readFileSync','stg-ap01','keychain\x20(profile:\x20','account_info','toUpperCase','stg-us01','warn','\x20env\x20var','utf-8','includes','proxy','accountId','stable','trim','3016600AYEMBd','eu01','TDX_API_KEY_','keychain','accessToken','filter','Warning:\x20Failed\x20to\x20read\x20','map','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','endsWith','2552YLlBuj','520918zFtlpw','866181msUvqs'];a55_0x3012=function(){return _0x5f13c1;};return a55_0x3012();}export function getConfigDir(){const _0x5dd862=a55_0x3198;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x5dd862(0x186),_0x5dd862(0x147));}function a55_0x3198(_0x18a6fd,_0x52180b){_0x18a6fd=_0x18a6fd-0x142;const _0x3012bb=a55_0x3012();let _0x31983b=_0x3012bb[_0x18a6fd];return _0x31983b;}export function getConfigFile(){const _0x58fa3f=a55_0x3198;return join(getConfigDir(),_0x58fa3f(0x15f));}export function getConfigFilePath(_0x3bf960){const _0x30b4e7=a55_0x3198,_0x545751=getConfigDir();return _0x3bf960?a55_0x4dbef1[_0x30b4e7(0x188)](_0x545751,_0x30b4e7(0x164)+_0x3bf960):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a55_0x406663(0x145),a55_0x406663(0x165));export function getLLMProjectCacheFile(_0x2fdcca){const _0x1ec386=a55_0x406663;return llmProjectCache[_0x1ec386(0x163)](_0x2fdcca);}export function readCachedLLMProject(_0x53859a){const _0x3d2e0a=a55_0x406663,_0x42e4b6=llmProjectCache['read'](_0x53859a);if(_0x42e4b6&&typeof _0x42e4b6['id']===_0x3d2e0a(0x185)&&typeof _0x42e4b6['name']===_0x3d2e0a(0x185))return _0x42e4b6;return null;}export function writeCachedLLMProject(_0x587cca,_0x5be9f7,_0x58f1a9){const _0x5ed059=a55_0x406663;try{llmProjectCache[_0x5ed059(0x184)]({'name':_0x587cca,'id':_0x5be9f7},_0x58f1a9);}catch{}}const llmAgentCache=createOptionalProfileCache('llm_default_agent',a55_0x406663(0x161));export function getLLMAgentCacheFile(_0x3ae68c){const _0x25a8bb=a55_0x406663;return llmAgentCache[_0x25a8bb(0x163)](_0x3ae68c);}export function readCachedLLMAgent(_0x57d9a1){const _0x337433=a55_0x406663,_0x58bb8d=llmAgentCache[_0x337433(0x166)](_0x57d9a1);if(_0x58bb8d&&typeof _0x58bb8d['id']===_0x337433(0x185)&&typeof _0x58bb8d['name']===_0x337433(0x185)&&typeof _0x58bb8d['projectId']===_0x337433(0x185))return _0x58bb8d;return null;}export function writeCachedLLMAgent(_0x1c582f,_0x389e42,_0x574b3b,_0x37a94e){const _0x2fc348=a55_0x406663;try{llmAgentCache[_0x2fc348(0x184)]({'name':_0x1c582f,'id':_0x389e42,'projectId':_0x574b3b},_0x37a94e);}catch{}}export function clearCachedLLMAgent(_0x5cfdcf){try{llmAgentCache['clear'](_0x5cfdcf);}catch{}}const accountInfoCache=createOptionalProfileCache(a55_0x406663(0x16a),a55_0x406663(0x156),{'suffix':a55_0x406663(0x146)});export function getAccountInfoCacheFile(_0xc63fe6){const _0x309ffd=a55_0x406663;return accountInfoCache[_0x309ffd(0x163)](_0xc63fe6);}export function readCachedAccountInfo(_0x5232c2){const _0x17087b=a55_0x406663,_0x20a0dc=accountInfoCache['read'](_0x5232c2);if(_0x20a0dc&&typeof _0x20a0dc[_0x17087b(0x155)]===_0x17087b(0x185)&&typeof _0x20a0dc[_0x17087b(0x172)]==='number')return _0x20a0dc;return null;}export function writeCachedAccountInfo(_0xc679a6,_0x105063,_0x16ad4b){const _0x4d3f9a=a55_0x406663;try{accountInfoCache[_0x4d3f9a(0x184)]({'site':_0xc679a6,'accountId':_0x105063,'cachedAt':new Date()['toISOString']()},_0x16ad4b);}catch{}}export function parseEnvFile(_0xfaf623){const _0x1a14c0=a55_0x406663,_0x27baca={};for(const _0xbe34b1 of _0xfaf623['split']('\x0a')){const _0x390958=_0xbe34b1[_0x1a14c0(0x174)]();if(!_0x390958||_0x390958[_0x1a14c0(0x183)]('#'))continue;const _0x3378ef=_0x390958['match'](/^([^=]+)=(.*)$/);if(_0x3378ef){const _0x49bc34=_0x3378ef[0x1]['trim']();let _0x2004d4=_0x3378ef[0x2][_0x1a14c0(0x174)]();(_0x2004d4[_0x1a14c0(0x183)]('\x22')&&_0x2004d4['endsWith']('\x22')||_0x2004d4[_0x1a14c0(0x183)]('\x27')&&_0x2004d4[_0x1a14c0(0x17e)]('\x27'))&&(_0x2004d4=_0x2004d4[_0x1a14c0(0x15b)](0x1,-0x1)),_0x27baca[_0x49bc34]=_0x2004d4;}}return _0x27baca;}export function readUserConfig(){const _0x1ad009=a55_0x406663,_0x399823=getConfigFile();if(!existsSync(_0x399823))return{};try{const _0x4898b9=readFileSync(_0x399823,'utf-8');return parseEnvFile(_0x4898b9);}catch(_0x25783e){return console['warn'](_0x1ad009(0x17d)+_0x399823+':',_0x25783e),{};}}export function resolveSite(_0x4c4349){const _0x6106e2=a55_0x406663,_0x576de7=[_0x6106e2(0x157),_0x6106e2(0x14e),_0x6106e2(0x176),_0x6106e2(0x14f),_0x6106e2(0x18b),'dev-us01',_0x6106e2(0x159),_0x6106e2(0x16c),'stg-ap01',_0x6106e2(0x14b)];if(_0x576de7[_0x6106e2(0x170)](_0x4c4349))return _0x4c4349;if(_0x4c4349 in SITE_ALIASES)return SITE_ALIASES[_0x4c4349];return console[_0x6106e2(0x16d)](_0x6106e2(0x150)+_0x4c4349+_0x6106e2(0x15c)),_0x6106e2(0x157);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x7f991e){const _0x1d3cb1=a55_0x406663,_0x26864e=_0x7f991e||getActiveProfileName()||undefined;if(_0x26864e){const _0x449acb='TDX_ACCESS_TOKEN_'+normalizeProfileForEnvVar(_0x26864e);if(process.env[_0x449acb])return{'accessToken':process.env[_0x449acb],'source':_0x449acb+_0x1d3cb1(0x16e)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x1d3cb1(0x142)};return null;}export function getAccessToken(_0x322ecb){const _0x4051cc=a55_0x406663;return resolveAccessToken(_0x322ecb)?.[_0x4051cc(0x179)];}export function getAPIKey(_0x287c84){const _0x260492=_0x287c84||getActiveProfileName();if(_0x260492){const _0x4c7f4f='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x260492);if(process.env[_0x4c7f4f])return process.env[_0x4c7f4f];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x2f79ee){const _0x195f83=a55_0x406663;return _0x2f79ee[_0x195f83(0x16b)]()[_0x195f83(0x154)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x31c535,_0x13f873){const _0xdc43d2=a55_0x406663,_0xa39f37=resolveAccessToken(_0x13f873);if(_0xa39f37)return{'apiKey':_0xa39f37[_0xdc43d2(0x179)],'source':_0xa39f37[_0xdc43d2(0x160)],'isDeprecated':![]};const _0x324697=_0x13f873||getActiveProfileName()||undefined;if(_0x324697){const _0xef492a=_0xdc43d2(0x177)+normalizeProfileForEnvVar(_0x324697);if(process.env[_0xef492a])return{'apiKey':process.env[_0xef492a],'source':_0xef492a+_0xdc43d2(0x16e),'isDeprecated':![]};const _0x1a3244=getCachedCredential(_0x31c535,_0x324697);if(_0x1a3244)return{'apiKey':_0x1a3244,'source':_0xdc43d2(0x169)+_0x324697+')','isDeprecated':![]};const _0x412ab8=await getKeychainAPIKey(_0x324697);if(_0x412ab8)return setCachedCredential(_0x412ab8,_0x31c535,_0x324697),{'apiKey':_0x412ab8,'source':_0xdc43d2(0x169)+_0x324697+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0xdc43d2(0x143),'isDeprecated':![]};if(!_0x324697){const _0x2ab652=getCachedCredential(_0x31c535,undefined);if(_0x2ab652)return{'apiKey':_0x2ab652,'source':_0xdc43d2(0x178),'isDeprecated':![]};const _0x49cd15=await getKeychainAPIKey(undefined);if(_0x49cd15)return setCachedCredential(_0x49cd15,_0x31c535,undefined),{'apiKey':_0x49cd15,'source':'keychain','isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x310656,_0x98bd94){const _0x5bcdb4=await resolveAPIKeyAsync(_0x310656,_0x98bd94);return _0x5bcdb4?.['apiKey'];}function cleanupLegacyEnvFile(_0x49f933){const _0x366231=a55_0x406663;if(!existsSync(_0x49f933))return![];try{const _0x5d3f74=readFileSync(_0x49f933,'utf-8'),_0x21b1d0=_0x5d3f74[_0x366231(0x15d)]('\x0a'),_0x42bb58=_0x21b1d0[_0x366231(0x17a)](_0x16c011=>{const _0x4daf36=_0x366231,_0x4e7d23=_0x16c011['trim']();if(!_0x4e7d23||_0x4e7d23[_0x4daf36(0x183)]('#'))return!![];const [_0x1f5757]=_0x4e7d23[_0x4daf36(0x15d)]('=');return!_0x1f5757[_0x4daf36(0x183)](_0x4daf36(0x15e));}),_0x296105=_0x42bb58[_0x366231(0x187)](_0x8b6f0f=>{const _0x2c84fa=_0x366231,_0xb6ba82=_0x8b6f0f[_0x2c84fa(0x174)]();return _0xb6ba82&&!_0xb6ba82['startsWith']('#');});if(!_0x296105)return unlinkSync(_0x49f933),!![];return writeFileSync(_0x49f933,_0x42bb58[_0x366231(0x188)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x2a38c3=a55_0x406663;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x5ec40c=a55_0x4dbef1[_0x2a38c3(0x188)](getConfigDir(),'tdx.json');if(!a55_0x5264bd[_0x2a38c3(0x152)](_0x5ec40c))return null;try{const _0x24ba39=a55_0x5264bd[_0x2a38c3(0x167)](_0x5ec40c,_0x2a38c3(0x16f)),_0x3714cc=JSON[_0x2a38c3(0x18a)](_0x24ba39);return _0x3714cc[_0x2a38c3(0x162)]||null;}catch{return null;}}export function saveAPIKey(_0x58e460,_0x1d7a2c,_0x47ee5a){const _0x495a25=a55_0x406663,_0x5425cf=getConfigDir(),_0x2d00df=getConfigFilePath(_0x47ee5a);!existsSync(_0x5425cf)&&mkdirSync(_0x5425cf,{'recursive':!![],'mode':0x1c0});let _0x5c0d3b={};if(existsSync(_0x2d00df))try{const _0xd1406d=readFileSync(_0x2d00df,_0x495a25(0x16f));_0x5c0d3b=parseEnvFile(_0xd1406d);}catch(_0x481a14){console['warn'](_0x495a25(0x17b)+_0x2d00df+':',_0x481a14);}const _0x8bdcf3=_0x58e460[_0x495a25(0x16b)]()['replace'](/-/g,'_');_0x5c0d3b[_0x495a25(0x189)+_0x8bdcf3]=_0x1d7a2c;const _0x2e56cf=Object[_0x495a25(0x14a)](_0x5c0d3b)[_0x495a25(0x17c)](([_0x3b5cb5,_0x4f67be])=>_0x3b5cb5+'='+_0x4f67be);writeFileSync(_0x2d00df,_0x2e56cf[_0x495a25(0x188)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x25895e,_0x4c55f4,_0x436a9a){const _0x240a29=a55_0x406663;await saveKeychainAPIKey(_0x25895e,_0x436a9a),setCachedCredential(_0x25895e,_0x4c55f4,_0x436a9a);const _0x3f375e=getConfigFilePath(_0x436a9a);cleanupLegacyEnvFile(_0x3f375e)&&console[_0x240a29(0x16d)](a55_0x2a9baf[_0x240a29(0x14d)](_0x240a29(0x158)));}export function loadConfig(){const _0x13ab23=a55_0x406663,_0x541dc8={'apiKeys':{},'defaultSite':_0x13ab23(0x157)},_0x6fc11f=[_0x13ab23(0x157),_0x13ab23(0x14e),_0x13ab23(0x176),_0x13ab23(0x14f),_0x13ab23(0x18b),'dev-us01',_0x13ab23(0x159),_0x13ab23(0x16c),_0x13ab23(0x168),_0x13ab23(0x14b)],_0x276700=getAPIKey();if(_0x276700)for(const _0x3ab22f of _0x6fc11f){_0x541dc8[_0x13ab23(0x144)][_0x3ab22f]=_0x276700;}return _0x541dc8;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x49fb84=a55_0x406663,_0x3719c3=a55_0x4dbef1[_0x49fb84(0x188)](getConfigDir(),_0x49fb84(0x182));if(!a55_0x5264bd[_0x49fb84(0x152)](_0x3719c3))return undefined;try{const _0x86c27d=a55_0x5264bd[_0x49fb84(0x167)](_0x3719c3,_0x49fb84(0x16f)),_0x2b7f36=JSON[_0x49fb84(0x18a)](_0x86c27d);return typeof _0x2b7f36['proxy']===_0x49fb84(0x185)?_0x2b7f36[_0x49fb84(0x171)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x201a16=a55_0x406663,_0x181696=process.env.TDX_RELEASE_CHANNEL;if(_0x181696==='next'||_0x181696===_0x201a16(0x173))return _0x181696;const _0x24a4d0=a55_0x4dbef1[_0x201a16(0x188)](getConfigDir(),_0x201a16(0x182));if(!a55_0x5264bd[_0x201a16(0x152)](_0x24a4d0))return _0x201a16(0x173);try{const _0x4e055b=a55_0x5264bd[_0x201a16(0x167)](_0x24a4d0,'utf-8'),_0x5c720e=JSON['parse'](_0x4e055b);if(_0x5c720e[_0x201a16(0x15a)]==='next')return'next';}catch{}return _0x201a16(0x173);}export function saveReleaseChannel(_0xfe44ae){const _0x14857f=a55_0x406663,_0x25d264=getConfigDir(),_0x4b0ca0=a55_0x4dbef1[_0x14857f(0x188)](_0x25d264,'tdx.json');!existsSync(_0x25d264)&&mkdirSync(_0x25d264,{'recursive':!![],'mode':0x1c0});let _0x184278={};if(existsSync(_0x4b0ca0))try{const _0x4a7c5f=readFileSync(_0x4b0ca0,_0x14857f(0x16f));_0x184278=JSON['parse'](_0x4a7c5f);}catch{}_0x184278[_0x14857f(0x15a)]=_0xfe44ae,writeFileSync(_0x4b0ca0,JSON[_0x14857f(0x149)](_0x184278,null,0x2),{'mode':0x180});}
@@ -1 +1 @@
1
- const a55_0x1388e6=a55_0x4d53;function a55_0x5bd1(){const _0x3cfce8=['2275760rudZAv','44313yDdeVk','831456zLNQmb','795100ZZvKnF','read','10yCTrsk','40RtwcYK','22wBrPcx','4669119EEtHzV','8ggSlrT','5082417NHHSED','now','core/connection-cache','write','connections','215636dUZCxf','connections-{profile}.json'];a55_0x5bd1=function(){return _0x3cfce8;};return a55_0x5bd1();}(function(_0x19b5df,_0x1e766e){const _0x35f89d=a55_0x4d53,_0x5c7a7b=_0x19b5df();while(!![]){try{const _0x58dcd8=parseInt(_0x35f89d(0x152))/0x1+parseInt(_0x35f89d(0x15a))/0x2*(parseInt(_0x35f89d(0x155))/0x3)+-parseInt(_0x35f89d(0x157))/0x4+-parseInt(_0x35f89d(0x159))/0x5*(parseInt(_0x35f89d(0x156))/0x6)+-parseInt(_0x35f89d(0x15c))/0x7+-parseInt(_0x35f89d(0x15d))/0x8*(-parseInt(_0x35f89d(0x15e))/0x9)+-parseInt(_0x35f89d(0x154))/0xa*(-parseInt(_0x35f89d(0x15b))/0xb);if(_0x58dcd8===_0x1e766e)break;else _0x5c7a7b['push'](_0x5c7a7b['shift']());}catch(_0x278a71){_0x5c7a7b['push'](_0x5c7a7b['shift']());}}}(a55_0x5bd1,0x5eb89));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a55_0x1388e6(0x153),a55_0x1388e6(0x160));function a55_0x4d53(_0x11b0f7,_0x3ea538){_0x11b0f7=_0x11b0f7-0x152;const _0x5bd1ce=a55_0x5bd1();let _0x4d53d5=_0x5bd1ce[_0x11b0f7];return _0x4d53d5;}export function loadCachedConnections(_0x4d6931){const _0x37476f=a55_0x1388e6,_0xeba317=connectionCache[_0x37476f(0x158)](_0x4d6931);return _0xeba317?.[_0x37476f(0x162)]??null;}export function saveCachedConnections(_0x14ce16,_0x364387){const _0x397f82=a55_0x1388e6;connectionCache[_0x397f82(0x161)](_0x14ce16,{'connections':_0x364387,'cachedAt':Date[_0x397f82(0x15f)]()});}export function clearConnectionCache(_0x2b715c){connectionCache['clear'](_0x2b715c);}
1
+ const a56_0x4a515a=a56_0xaf42;(function(_0x222ad5,_0x383f1c){const _0x544508=a56_0xaf42,_0x54631c=_0x222ad5();while(!![]){try{const _0x32168a=-parseInt(_0x544508(0x10c))/0x1*(parseInt(_0x544508(0x112))/0x2)+-parseInt(_0x544508(0x10d))/0x3*(-parseInt(_0x544508(0x117))/0x4)+-parseInt(_0x544508(0x11a))/0x5*(-parseInt(_0x544508(0x110))/0x6)+-parseInt(_0x544508(0x10e))/0x7+-parseInt(_0x544508(0x113))/0x8*(-parseInt(_0x544508(0x10f))/0x9)+parseInt(_0x544508(0x118))/0xa*(-parseInt(_0x544508(0x10b))/0xb)+-parseInt(_0x544508(0x111))/0xc*(-parseInt(_0x544508(0x119))/0xd);if(_0x32168a===_0x383f1c)break;else _0x54631c['push'](_0x54631c['shift']());}catch(_0x713a52){_0x54631c['push'](_0x54631c['shift']());}}}(a56_0x38db,0x4ea4e));import{createProfileCache}from'../utils/global-cache.js';function a56_0xaf42(_0x452f44,_0x56afec){_0x452f44=_0x452f44-0x109;const _0x38db56=a56_0x38db();let _0xaf426a=_0x38db56[_0x452f44];return _0xaf426a;}function a56_0x38db(){const _0x2472b3=['1476LBAVIm','2qppeTx','8gFSWXg','core/connection-cache','connections-{profile}.json','write','5732HqgJBU','10mztTyJ','42107XVbYsA','15NmTgaM','connections','read','3777323UVWqLB','560869HzuOEO','1146PhQCQY','408989LhBrXR','822285YSUQVm','495294MJjxbV'];a56_0x38db=function(){return _0x2472b3;};return a56_0x38db();}const connectionCache=createProfileCache(a56_0x4a515a(0x115),a56_0x4a515a(0x114));export function loadCachedConnections(_0x25c448){const _0x54e9b1=a56_0x4a515a,_0x50e127=connectionCache[_0x54e9b1(0x10a)](_0x25c448);return _0x50e127?.[_0x54e9b1(0x109)]??null;}export function saveCachedConnections(_0x2bf9ec,_0x276f30){const _0x3d2e17=a56_0x4a515a;connectionCache[_0x3d2e17(0x116)](_0x2bf9ec,{'connections':_0x276f30,'cachedAt':Date['now']()});}export function clearConnectionCache(_0x11d645){connectionCache['clear'](_0x11d645);}
@@ -1 +1 @@
1
- const a56_0x2e2705=a56_0x3c8f;(function(_0x384566,_0x2ad936){const _0x5f4837=a56_0x3c8f,_0x38f78c=_0x384566();while(!![]){try{const _0x480508=-parseInt(_0x5f4837(0x144))/0x1+-parseInt(_0x5f4837(0x147))/0x2*(parseInt(_0x5f4837(0x13a))/0x3)+-parseInt(_0x5f4837(0x139))/0x4*(parseInt(_0x5f4837(0x134))/0x5)+-parseInt(_0x5f4837(0x12f))/0x6+parseInt(_0x5f4837(0x13f))/0x7+parseInt(_0x5f4837(0x130))/0x8*(-parseInt(_0x5f4837(0x132))/0x9)+parseInt(_0x5f4837(0x13e))/0xa;if(_0x480508===_0x2ad936)break;else _0x38f78c['push'](_0x38f78c['shift']());}catch(_0x363566){_0x38f78c['push'](_0x38f78c['shift']());}}}(a56_0x4e83,0x9e84d));import a56_0x3a99d2 from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;function a56_0x3c8f(_0x2f7876,_0x39b7ea){_0x2f7876=_0x2f7876-0x126;const _0x4e83e3=a56_0x4e83();let _0x3c8fca=_0x4e83e3[_0x2f7876];return _0x3c8fca;}export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;function a56_0x4e83(){const _0x2d09e4=['value','294252LEXQXl','16UBNkNp','ap01','1351170aemGpe','Cancelled','145fxDwiy','findIndex','number','Enter\x20site\x20name:','length','140396ERvtWx','500427TcfFAz','trim','us01','us\x20\x20\x20-\x20United\x20States','31948490LgaCmq','1943298eunUzd','jp\x20\x20\x20-\x20Japan','text','ap02\x20-\x20Korea','customSite','955570miJcEm','log','site','6LQiCvz','Site\x20name\x20cannot\x20be\x20empty','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','ap02','other','push','test','Select\x20your\x20Treasure\x20Data\x20site:'];a56_0x4e83=function(){return _0x2d09e4;};return a56_0x4e83();}export function resolveLimit(_0x5d0599,_0x27955b){const _0x24d47f=a56_0x3c8f;if(_0x5d0599===undefined)return _0x27955b;if(typeof _0x5d0599===_0x24d47f(0x136))return _0x5d0599;return parseInt(_0x5d0599,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a56_0x2e2705(0x13d),'value':a56_0x2e2705(0x13c)},{'title':a56_0x2e2705(0x140),'value':a56_0x2e2705(0x131)},{'title':'eu\x20\x20\x20-\x20Europe','value':'eu01'},{'title':a56_0x2e2705(0x142),'value':a56_0x2e2705(0x129)}];export function buildSiteChoices(_0x3aec24){const _0x276742=a56_0x2e2705,_0x564084=[...STANDARD_SITE_CHOICES];let _0x16f00a=_0x564084[_0x276742(0x135)](_0x2bf98d=>_0x2bf98d[_0x276742(0x12e)]===_0x3aec24);return _0x16f00a===-0x1&&_0x3aec24!==_0x276742(0x13c)&&(_0x564084[_0x276742(0x12b)]({'title':_0x3aec24,'value':_0x3aec24}),_0x16f00a=_0x564084[_0x276742(0x138)]-0x1),_0x564084['push']({'title':'Enter\x20custom\x20site','value':_0x276742(0x12a)}),{'choices':_0x564084,'initialIndex':_0x16f00a>=0x0?_0x16f00a:0x0};}export async function promptSiteSelection(_0x43f387,_0x538cb7,_0x22818b=a56_0x2e2705(0x133)){const _0x4aba1d=a56_0x2e2705,{choices:_0x42ef3f,initialIndex:_0x569288}=buildSiteChoices(_0x43f387),_0x24c474=_0x538cb7?_0x4aba1d(0x127)+_0x538cb7+'):':_0x4aba1d(0x12d),_0x5f28f9=await a56_0x3a99d2({'type':'select','name':_0x4aba1d(0x146),'message':_0x24c474,'choices':_0x42ef3f,'initial':_0x569288});if(!_0x5f28f9['site'])return console['log']('\x0a'+_0x22818b),null;if(_0x5f28f9['site']!==_0x4aba1d(0x12a))return _0x5f28f9[_0x4aba1d(0x146)];const _0x21e234=await a56_0x3a99d2({'type':_0x4aba1d(0x141),'name':'customSite','message':_0x4aba1d(0x137),'initial':_0x4aba1d(0x13c),'validate':_0x1abdf0=>{const _0x3ae642=_0x4aba1d;if(!_0x1abdf0||!_0x1abdf0[_0x3ae642(0x13b)]())return _0x3ae642(0x126);if(!/^[a-z0-9-]+$/[_0x3ae642(0x12c)](_0x1abdf0[_0x3ae642(0x13b)]()))return _0x3ae642(0x128);return!![];}});if(!_0x21e234[_0x4aba1d(0x143)])return console[_0x4aba1d(0x145)]('\x0a'+_0x22818b),null;return _0x21e234[_0x4aba1d(0x143)];}
1
+ const a57_0x5e5930=a57_0x5a74;(function(_0x2761f6,_0x44e431){const _0x5dc8da=a57_0x5a74,_0x10ca8a=_0x2761f6();while(!![]){try{const _0x291e24=-parseInt(_0x5dc8da(0x103))/0x1+parseInt(_0x5dc8da(0x100))/0x2*(-parseInt(_0x5dc8da(0x105))/0x3)+-parseInt(_0x5dc8da(0x110))/0x4+-parseInt(_0x5dc8da(0x109))/0x5*(-parseInt(_0x5dc8da(0xf5))/0x6)+-parseInt(_0x5dc8da(0x10f))/0x7+-parseInt(_0x5dc8da(0x107))/0x8*(parseInt(_0x5dc8da(0xfe))/0x9)+parseInt(_0x5dc8da(0x10b))/0xa*(parseInt(_0x5dc8da(0xf8))/0xb);if(_0x291e24===_0x44e431)break;else _0x10ca8a['push'](_0x10ca8a['shift']());}catch(_0x260aac){_0x10ca8a['push'](_0x10ca8a['shift']());}}}(a57_0x3e0e,0x1bace));function a57_0x5a74(_0x3b34c8,_0x43794e){_0x3b34c8=_0x3b34c8-0xf2;const _0x3e0eae=a57_0x3e0e();let _0x5a749e=_0x3e0eae[_0x3b34c8];return _0x5a749e;}import a57_0x16b255 from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x27a4e9,_0x4e111b){if(_0x27a4e9===undefined)return _0x4e111b;if(typeof _0x27a4e9==='number')return _0x27a4e9;return parseInt(_0x27a4e9,0xa);}function a57_0x3e0e(){const _0x5dbd7f=['1186339ZhdOUh','417108EXRRMO','trim','site','findIndex','log','6syMTnR','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','ap01','149908pdvCbN','customSite','select','ap02\x20-\x20Korea','us01','test','997371llySJj','Site\x20name\x20cannot\x20be\x20empty','2UCmFpq','eu01','push','39935GLkcPr','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','332406LoLmWs','Select\x20your\x20Treasure\x20Data\x20site:','16zaRGLs','other','594855AYaJbz','eu\x20\x20\x20-\x20Europe','470qLzjGp','Enter\x20custom\x20site','ap02','length'];a57_0x3e0e=function(){return _0x5dbd7f;};return a57_0x3e0e();}export const STANDARD_SITE_CHOICES=[{'title':'us\x20\x20\x20-\x20United\x20States','value':a57_0x5e5930(0xfc)},{'title':'jp\x20\x20\x20-\x20Japan','value':a57_0x5e5930(0xf7)},{'title':a57_0x5e5930(0x10a),'value':a57_0x5e5930(0x101)},{'title':a57_0x5e5930(0xfb),'value':a57_0x5e5930(0x10d)}];export function buildSiteChoices(_0xcd1b73){const _0x2b5832=a57_0x5e5930,_0x23ecc5=[...STANDARD_SITE_CHOICES];let _0x577f0c=_0x23ecc5[_0x2b5832(0xf3)](_0x4adbee=>_0x4adbee['value']===_0xcd1b73);return _0x577f0c===-0x1&&_0xcd1b73!==_0x2b5832(0xfc)&&(_0x23ecc5[_0x2b5832(0x102)]({'title':_0xcd1b73,'value':_0xcd1b73}),_0x577f0c=_0x23ecc5[_0x2b5832(0x10e)]-0x1),_0x23ecc5[_0x2b5832(0x102)]({'title':_0x2b5832(0x10c),'value':_0x2b5832(0x108)}),{'choices':_0x23ecc5,'initialIndex':_0x577f0c>=0x0?_0x577f0c:0x0};}export async function promptSiteSelection(_0xb3de69,_0x1a1acf,_0x3e698e='Cancelled'){const _0x5db716=a57_0x5e5930,{choices:_0x3b65d0,initialIndex:_0x45e2f0}=buildSiteChoices(_0xb3de69),_0x277d6c=_0x1a1acf?_0x5db716(0x104)+_0x1a1acf+'):':_0x5db716(0x106),_0x2efbf9=await a57_0x16b255({'type':_0x5db716(0xfa),'name':_0x5db716(0xf2),'message':_0x277d6c,'choices':_0x3b65d0,'initial':_0x45e2f0});if(!_0x2efbf9[_0x5db716(0xf2)])return console[_0x5db716(0xf4)]('\x0a'+_0x3e698e),null;if(_0x2efbf9['site']!=='other')return _0x2efbf9[_0x5db716(0xf2)];const _0x543ae0=await a57_0x16b255({'type':'text','name':_0x5db716(0xf9),'message':'Enter\x20site\x20name:','initial':'us01','validate':_0x2eae74=>{const _0x3993a6=_0x5db716;if(!_0x2eae74||!_0x2eae74['trim']())return _0x3993a6(0xff);if(!/^[a-z0-9-]+$/[_0x3993a6(0xfd)](_0x2eae74[_0x3993a6(0x111)]()))return _0x3993a6(0xf6);return!![];}});if(!_0x543ae0[_0x5db716(0xf9)])return console[_0x5db716(0xf4)]('\x0a'+_0x3e698e),null;return _0x543ae0['customSite'];}
@@ -1 +1 @@
1
- (function(_0x28a119,_0x42164a){const _0xcdead6=a57_0x5beb,_0x1dc266=_0x28a119();while(!![]){try{const _0x394482=parseInt(_0xcdead6(0x1f3))/0x1*(parseInt(_0xcdead6(0x1eb))/0x2)+parseInt(_0xcdead6(0x1f1))/0x3*(-parseInt(_0xcdead6(0x1e4))/0x4)+-parseInt(_0xcdead6(0x1f2))/0x5*(-parseInt(_0xcdead6(0x1f4))/0x6)+parseInt(_0xcdead6(0x1e3))/0x7+-parseInt(_0xcdead6(0x1ec))/0x8+-parseInt(_0xcdead6(0x1ea))/0x9*(parseInt(_0xcdead6(0x1f5))/0xa)+parseInt(_0xcdead6(0x1e5))/0xb;if(_0x394482===_0x42164a)break;else _0x1dc266['push'](_0x1dc266['shift']());}catch(_0x1a90ad){_0x1dc266['push'](_0x1dc266['shift']());}}}(a57_0x34d0,0x6800b));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x13d34b,_0x53be0d){const _0x3ee6d8=a57_0x5beb,_0x2f1203=_0x13d34b||_0x3ee6d8(0x1ef),_0x228384=_0x53be0d||_0x3ee6d8(0x1f0);return _0x2f1203+':'+_0x228384;}export function getCachedCredential(_0x4c3181,_0x34fa01){const _0x2d0152=a57_0x5beb,_0x4fb78a=getCacheKey(_0x4c3181,_0x34fa01),_0x352910=cache[_0x2d0152(0x1e7)](_0x4fb78a);if(!_0x352910)return null;if(Date[_0x2d0152(0x1ed)]()-_0x352910[_0x2d0152(0x1e6)]>CACHE_TTL_MS)return cache[_0x2d0152(0x1e9)](_0x4fb78a),null;return _0x352910['apiKey'];}export function setCachedCredential(_0x3c2d6f,_0x2f8aa2,_0x4e65e5){const _0x47172c=a57_0x5beb,_0xc7a52d=getCacheKey(_0x2f8aa2,_0x4e65e5);cache[_0x47172c(0x1e8)](_0xc7a52d,{'apiKey':_0x3c2d6f,'loadedAt':Date[_0x47172c(0x1ed)]()});}function a57_0x34d0(){const _0x4ea053=['delete','27LUtgZN','2vyjzuP','2836296pnDUcD','now','clear','__default_site__','__default_profile__','27465mPIeNf','885dCNymT','56873FeCMFu','13116UIaOwP','2172990uPhJYz','2797942zxChLK','292TdKuGU','13829673yWWges','loadedAt','get','set'];a57_0x34d0=function(){return _0x4ea053;};return a57_0x34d0();}export function clearCredentialCache(){const _0x4f5ba7=a57_0x5beb;cache[_0x4f5ba7(0x1ee)]();}function a57_0x5beb(_0x5d27a1,_0xeda740){_0x5d27a1=_0x5d27a1-0x1e3;const _0x34d079=a57_0x34d0();let _0x5beba9=_0x34d079[_0x5d27a1];return _0x5beba9;}export function clearCachedCredential(_0x2b0975,_0xdce9cf){const _0x5c33fe=a57_0x5beb,_0x25e741=getCacheKey(_0x2b0975,_0xdce9cf);cache[_0x5c33fe(0x1e9)](_0x25e741);}
1
+ (function(_0x1cc9e6,_0x2f3af9){const _0x30816b=a58_0x1e43,_0x39ff82=_0x1cc9e6();while(!![]){try{const _0x1140f7=parseInt(_0x30816b(0x1ba))/0x1+-parseInt(_0x30816b(0x1c1))/0x2+parseInt(_0x30816b(0x1b5))/0x3*(parseInt(_0x30816b(0x1bf))/0x4)+-parseInt(_0x30816b(0x1c2))/0x5+parseInt(_0x30816b(0x1bd))/0x6+parseInt(_0x30816b(0x1b9))/0x7+-parseInt(_0x30816b(0x1b3))/0x8;if(_0x1140f7===_0x2f3af9)break;else _0x39ff82['push'](_0x39ff82['shift']());}catch(_0x579d53){_0x39ff82['push'](_0x39ff82['shift']());}}}(a58_0x4a8a,0x2b97c));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x39d92c,_0x3ed63f){const _0x191ca9=a58_0x1e43,_0x202489=_0x39d92c||_0x191ca9(0x1bc),_0x5a0432=_0x3ed63f||_0x191ca9(0x1bb);return _0x202489+':'+_0x5a0432;}export function getCachedCredential(_0x341070,_0x1735bd){const _0x590cdc=a58_0x1e43,_0x26e7b9=getCacheKey(_0x341070,_0x1735bd),_0x343e26=cache[_0x590cdc(0x1b6)](_0x26e7b9);if(!_0x343e26)return null;if(Date['now']()-_0x343e26[_0x590cdc(0x1b7)]>CACHE_TTL_MS)return cache[_0x590cdc(0x1b8)](_0x26e7b9),null;return _0x343e26[_0x590cdc(0x1b4)];}function a58_0x4a8a(){const _0x39ea2f=['now','622420arWbGi','clear','653362svjiIX','1362155dhwhMm','set','622112FPwRkm','apiKey','3OesEJc','get','loadedAt','delete','2295251kPIObc','338864jwqLYd','__default_profile__','__default_site__','198420iFdyIW'];a58_0x4a8a=function(){return _0x39ea2f;};return a58_0x4a8a();}export function setCachedCredential(_0x1fd27b,_0x36af03,_0x360000){const _0x37cfe1=a58_0x1e43,_0x501608=getCacheKey(_0x36af03,_0x360000);cache[_0x37cfe1(0x1b2)](_0x501608,{'apiKey':_0x1fd27b,'loadedAt':Date[_0x37cfe1(0x1be)]()});}function a58_0x1e43(_0x8089f8,_0x2e112c){_0x8089f8=_0x8089f8-0x1b2;const _0x4a8a0a=a58_0x4a8a();let _0x1e4317=_0x4a8a0a[_0x8089f8];return _0x1e4317;}export function clearCredentialCache(){const _0x512173=a58_0x1e43;cache[_0x512173(0x1c0)]();}export function clearCachedCredential(_0x2a96a1,_0x16d86f){const _0x4b209f=a58_0x1e43,_0x2e828a=getCacheKey(_0x2a96a1,_0x16d86f);cache[_0x4b209f(0x1b8)](_0x2e828a);}
@@ -1 +1 @@
1
- function a58_0x3948(_0xc38a02,_0x471551){_0xc38a02=_0xc38a02-0x75;const _0x237f7e=a58_0x237f();let _0x394885=_0x237f7e[_0xc38a02];return _0x394885;}const a58_0x312f8d=a58_0x3948;(function(_0x24658b,_0x1879a6){const _0x47e7a3=a58_0x3948,_0x46e33c=_0x24658b();while(!![]){try{const _0x3a7703=parseInt(_0x47e7a3(0x96))/0x1+parseInt(_0x47e7a3(0x80))/0x2*(parseInt(_0x47e7a3(0x7f))/0x3)+parseInt(_0x47e7a3(0x87))/0x4*(parseInt(_0x47e7a3(0xa3))/0x5)+-parseInt(_0x47e7a3(0x88))/0x6+-parseInt(_0x47e7a3(0xa2))/0x7*(parseInt(_0x47e7a3(0xb1))/0x8)+-parseInt(_0x47e7a3(0x8c))/0x9+-parseInt(_0x47e7a3(0x79))/0xa*(-parseInt(_0x47e7a3(0x78))/0xb);if(_0x3a7703===_0x1879a6)break;else _0x46e33c['push'](_0x46e33c['shift']());}catch(_0x3ff484){_0x46e33c['push'](_0x46e33c['shift']());}}}(a58_0x237f,0x96a0e));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';import*as a58_0x6370b8 from'node:fs';function a58_0x237f(){const _0x1ac0a0=['profile','216JMQoiA','[context]','(session:\x20','session','site','Global','log','.env','profileCredentials','.json','assign','cyan','tdx.json','bold','existsSync','workflowProject','configFiles','cli','getParameters','cliFlags','profile:\x20','823559HdoTad','150irOLUL','display','verbose','green','segmentPath','displayWithSources','222GCMyfh','29902ydFIUt','profiles','layers','injectIntoOptions','workflow_project','llmAgent','database','176JtllXX','5272902bIoGOP','INFO','llmProject','getSource','5605371PPgQTn','Profile\x20Credentials','(using\x20session:\x20','accessToken','segment_path','parentSegment','dim','join','llm_project','resolveAPIKeyAsync','625328CRuZSB','Project','activeProfile','string','not\x20set','profileSource','proxy','sessionId','globalCredentials','parent_segment','env','Session','227283wUJQXs','15970TxZFUQ','apiKey','config','llm_agent','entries','global','us01','loadGlobalConfig','logLevel','parse','replace','project','readFileSync'];a58_0x237f=function(){return _0x1ac0a0;};return a58_0x237f();}import*as a58_0x2e434f from'node:path';import a58_0x558f5a from'chalk';export class GlobalContext{[a58_0x312f8d(0xb5)];[a58_0x312f8d(0x86)];[a58_0x312f8d(0x9f)];[a58_0x312f8d(0x90)];[a58_0x312f8d(0x94)];[a58_0x312f8d(0xa6)];[a58_0x312f8d(0x84)];[a58_0x312f8d(0xa4)];[a58_0x312f8d(0x8f)];[a58_0x312f8d(0x9c)];[a58_0x312f8d(0x7b)];[a58_0x312f8d(0xab)];[a58_0x312f8d(0xb0)];[a58_0x312f8d(0x9b)]=null;['layers'];[a58_0x312f8d(0x98)];['sessionId'];[a58_0x312f8d(0xc1)];constructor(_0x309cae){const _0x4427ba=a58_0x312f8d;this['sessionId']=getSessionID(_0x309cae[_0x4427ba(0xb4)]);const _0x297e55=loadSessionContext(_0x309cae[_0x4427ba(0xb4)]),_0x2469dd=loadProjectConfig(),_0x3a9e1d=this['loadGlobalConfig']();if(_0x309cae[_0x4427ba(0xb0)])this['activeProfile']=_0x309cae[_0x4427ba(0xb0)],this[_0x4427ba(0x9b)]=_0x4427ba(0xc2);else{if(_0x297e55?.['profile'])this[_0x4427ba(0x98)]=_0x297e55[_0x4427ba(0xb0)],this[_0x4427ba(0x9b)]=_0x4427ba(0xb4);else{if(_0x3a9e1d[_0x4427ba(0xb0)])this['activeProfile']=_0x3a9e1d['profile'],this['profileSource']=_0x4427ba(0xa5);else process.env.TDX_PROFILE?(this[_0x4427ba(0x98)]=process.env.TDX_PROFILE,this['profileSource']=_0x4427ba(0xa0)):(this[_0x4427ba(0x98)]=null,this[_0x4427ba(0x9b)]=null);}}const _0x5cee3b=this[_0x4427ba(0x98)]?loadProfile(this['activeProfile']):null,_0x3d3486=_0x18fdf4=>{const _0x4741b4=_0x4427ba;if(!_0x18fdf4)return{};const _0x1cb809=_0x18fdf4,_0x57c8d7={};for(const [_0x1c4f48,_0xa3fd33]of Object[_0x4741b4(0xa7)](_0x1cb809)){typeof _0xa3fd33===_0x4741b4(0x99)&&(_0x57c8d7[_0x1c4f48]=_0xa3fd33);}return _0x57c8d7;},_0xb6b211={},_0x3006e2=(_0x23f094,_0x3c00e1,_0x511422)=>{const _0x1d0df9=_0x4427ba;if(!_0x23f094)return![];if(_0x511422&&_0x23f094===_0x511422)return![];const _0x32a9d1=_0x297e55,_0x2a9269=_0x2469dd,_0x337449=_0x5cee3b?.[_0x1d0df9(0xa5)],_0x2fccca=_0x3a9e1d,_0x225747=_0x32a9d1?.[_0x3c00e1],_0x1978c3=_0x2a9269?.[_0x3c00e1],_0x5014e6=_0x337449?.[_0x3c00e1],_0x708c11=_0x2fccca[_0x3c00e1];return _0x23f094!==_0x225747&&_0x23f094!==_0x1978c3&&_0x23f094!==_0x5014e6&&_0x23f094!==_0x708c11;},_0x21cfd6=[{'optionKey':_0x4427ba(0xb5),'contextKey':_0x4427ba(0xb5),'defaultValue':'us01'},{'optionKey':'database','contextKey':'database'},{'optionKey':_0x4427ba(0x91),'contextKey':_0x4427ba(0x9f)},{'optionKey':'llmProject','contextKey':_0x4427ba(0x94)},{'optionKey':'llmAgent','contextKey':'llm_agent'},{'optionKey':_0x4427ba(0xb0),'contextKey':_0x4427ba(0xb0)}];for(const {optionKey:_0x587b58,contextKey:_0x36fa2f,defaultValue:_0x46487c}of _0x21cfd6){const _0x32dad7=_0x309cae[_0x587b58];_0x3006e2(_0x32dad7,_0x36fa2f,_0x46487c)&&(_0xb6b211[_0x36fa2f]=_0x32dad7);}this[_0x4427ba(0x82)]={'cliFlags':_0xb6b211,'session':_0x3d3486(_0x297e55),'project':_0x3d3486(_0x2469dd),'profile':_0x3d3486(_0x5cee3b?.['config']),'global':_0x3d3486(_0x3a9e1d)};const _0x1b4160={...this['layers']['global'],...this[_0x4427ba(0x82)][_0x4427ba(0xb0)],...this[_0x4427ba(0x82)][_0x4427ba(0xae)]};process.env.TDX_SITE&&!this[_0x4427ba(0x82)]['session'][_0x4427ba(0xb5)]&&!this['layers']['cliFlags']['site']&&(_0x1b4160['site']=process.env.TDX_SITE);Object[_0x4427ba(0xbb)](_0x1b4160,this['layers'][_0x4427ba(0xb4)]),Object[_0x4427ba(0xbb)](_0x1b4160,this[_0x4427ba(0x82)][_0x4427ba(0x76)]);const _0x21a3b9=_0x1b4160['site']||_0x4427ba(0xa9);this['site']=resolveSite(_0x21a3b9),this['database']=_0x1b4160[_0x4427ba(0x86)],this[_0x4427ba(0x9f)]=_0x1b4160[_0x4427ba(0x9f)],this[_0x4427ba(0x90)]=_0x1b4160['segment_path'],this[_0x4427ba(0x94)]=_0x1b4160['llm_project'],this[_0x4427ba(0xa6)]=_0x1b4160[_0x4427ba(0xa6)],this[_0x4427ba(0x84)]=_0x1b4160[_0x4427ba(0x84)],this[_0x4427ba(0x7b)]=_0x309cae['verbose']||![],this[_0x4427ba(0xab)]=_0x309cae[_0x4427ba(0xab)]??LogLevel[_0x4427ba(0x89)],this[_0x4427ba(0xb0)]=this[_0x4427ba(0x98)]||undefined,this[_0x4427ba(0x8f)]=getAccessToken(this[_0x4427ba(0x98)]||undefined),this[_0x4427ba(0xa4)]=getAPIKey(this[_0x4427ba(0x98)]||undefined);const _0x5e167c=typeof _0x3a9e1d[_0x4427ba(0x9c)]===_0x4427ba(0x99)?_0x3a9e1d[_0x4427ba(0x9c)]:undefined;this[_0x4427ba(0x9c)]=_0x5e167c||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x3bc475=getConfigDir(),_0x476e55=a58_0x2e434f['join'](_0x3bc475,'sessions',this[_0x4427ba(0x9d)]+_0x4427ba(0xba)),_0x2c1409=findProjectConfigPath(),_0x55f86c=a58_0x2e434f[_0x4427ba(0x93)](_0x3bc475,_0x4427ba(0xbd)),_0x3a05d2=a58_0x2e434f[_0x4427ba(0x93)](_0x3bc475,_0x4427ba(0xb8));let _0x45b57d=null,_0x29ab9c=null;this[_0x4427ba(0x98)]&&(_0x45b57d=a58_0x2e434f[_0x4427ba(0x93)](_0x3bc475,_0x4427ba(0x81),this[_0x4427ba(0x98)],_0x4427ba(0xbd)),_0x29ab9c=a58_0x2e434f[_0x4427ba(0x93)](_0x3bc475,_0x4427ba(0x81),this[_0x4427ba(0x98)],_0x4427ba(0xb8))),this[_0x4427ba(0xc1)]={'session':a58_0x6370b8[_0x4427ba(0xbf)](_0x476e55)?_0x476e55:null,'project':_0x2c1409,'profile':_0x45b57d&&a58_0x6370b8[_0x4427ba(0xbf)](_0x45b57d)?_0x45b57d:null,'profileCredentials':_0x29ab9c&&a58_0x6370b8[_0x4427ba(0xbf)](_0x29ab9c)?_0x29ab9c:null,'global':a58_0x6370b8['existsSync'](_0x55f86c)?_0x55f86c:null,'globalCredentials':a58_0x6370b8[_0x4427ba(0xbf)](_0x3a05d2)?_0x3a05d2:null};}[a58_0x312f8d(0x8b)](_0x3b532c,_0xb70958){const _0x5b9e6f=a58_0x312f8d;if(!_0xb70958)return _0x5b9e6f(0x9a);const _0x590cdd=_0xb70958;if(this[_0x5b9e6f(0x82)][_0x5b9e6f(0x76)][_0x3b532c]===_0x590cdd){if(_0x3b532c===_0x5b9e6f(0xb5)&&_0x590cdd===_0x5b9e6f(0xa9)&&!this['layers'][_0x5b9e6f(0xb4)][_0x5b9e6f(0xb5)]&&!this[_0x5b9e6f(0x82)]['project']['site']&&!this[_0x5b9e6f(0x82)][_0x5b9e6f(0xb0)][_0x5b9e6f(0xb5)]&&!this['layers'][_0x5b9e6f(0xa8)][_0x5b9e6f(0xb5)])return'default';return'CLI\x20flag:\x20--'+_0x3b532c[_0x5b9e6f(0xad)](/_/g,'-');}if(this[_0x5b9e6f(0x82)][_0x5b9e6f(0xb4)][_0x3b532c]===_0x590cdd)return _0x5b9e6f(0xb4);if(this[_0x5b9e6f(0x82)]['project'][_0x3b532c]===_0x590cdd)return _0x5b9e6f(0xae);if(this[_0x5b9e6f(0x82)][_0x5b9e6f(0xb0)][_0x3b532c]===_0x590cdd)return _0x5b9e6f(0x77)+this[_0x5b9e6f(0x98)];if(this['layers'][_0x5b9e6f(0xa8)][_0x3b532c]===_0x590cdd)return _0x5b9e6f(0xa8);return'default';}[a58_0x312f8d(0xaa)](){const _0x5d1f54=a58_0x312f8d,_0x52199f=a58_0x2e434f['join'](getConfigDir(),_0x5d1f54(0xbd));if(!a58_0x6370b8[_0x5d1f54(0xbf)](_0x52199f))return{};try{const _0x35cf48=a58_0x6370b8[_0x5d1f54(0xaf)](_0x52199f,'utf-8');return JSON[_0x5d1f54(0xac)](_0x35cf48);}catch{return{};}}[a58_0x312f8d(0x83)](_0x17f2c9){const _0x52ad5b=a58_0x312f8d;_0x17f2c9[_0x52ad5b(0xb5)]=this[_0x52ad5b(0xb5)],!_0x17f2c9[_0x52ad5b(0x86)]&&this[_0x52ad5b(0x86)]&&(_0x17f2c9['database']=this['database']),!_0x17f2c9[_0x52ad5b(0x91)]&&this[_0x52ad5b(0x9f)]&&(_0x17f2c9[_0x52ad5b(0x91)]=this[_0x52ad5b(0x9f)]),!_0x17f2c9[_0x52ad5b(0x7d)]&&this[_0x52ad5b(0x90)]&&(_0x17f2c9[_0x52ad5b(0x7d)]=this['segment_path']),!_0x17f2c9[_0x52ad5b(0x8a)]&&this[_0x52ad5b(0x94)]&&(_0x17f2c9['llmProject']=this[_0x52ad5b(0x94)]),!_0x17f2c9[_0x52ad5b(0x85)]&&this['llm_agent']&&(_0x17f2c9[_0x52ad5b(0x85)]=this[_0x52ad5b(0xa6)]),!_0x17f2c9[_0x52ad5b(0xc0)]&&this['workflow_project']&&(_0x17f2c9[_0x52ad5b(0xc0)]=this[_0x52ad5b(0x84)]);}['getParameters'](){const _0xb8449f=a58_0x312f8d;return[{'key':_0xb8449f(0xb5),'value':this['site']},{'key':_0xb8449f(0x86),'value':this[_0xb8449f(0x86)]},{'key':_0xb8449f(0x9f),'value':this['parent_segment']},{'key':_0xb8449f(0x90),'value':this[_0xb8449f(0x90)]},{'key':_0xb8449f(0x94),'value':this[_0xb8449f(0x94)]},{'key':'llm_agent','value':this[_0xb8449f(0xa6)]},{'key':_0xb8449f(0x84),'value':this[_0xb8449f(0x84)]},{'key':'profile','value':this[_0xb8449f(0x98)]||undefined}];}[a58_0x312f8d(0x7a)](){const _0x4ae0d3=a58_0x312f8d;console[_0x4ae0d3(0xb7)](a58_0x558f5a[_0x4ae0d3(0xbe)](_0x4ae0d3(0xb2)));for(const {key:_0x2ea4da,value:_0x50e405}of this[_0x4ae0d3(0x75)]()){_0x50e405&&console[_0x4ae0d3(0xb7)](a58_0x558f5a[_0x4ae0d3(0xbc)](_0x2ea4da)+':\x20'+_0x50e405);}}[a58_0x312f8d(0x7e)](){const _0x7bbf7e=a58_0x312f8d;console[_0x7bbf7e(0xb7)](a58_0x558f5a[_0x7bbf7e(0xbe)](_0x7bbf7e(0xb2)));for(const {key:_0x3672d4,value:_0x227d86}of this[_0x7bbf7e(0x75)]()){if(_0x227d86){const _0x52e169=_0x3672d4===_0x7bbf7e(0xb0)?'(active)':'('+this[_0x7bbf7e(0x8b)](_0x3672d4,_0x227d86)+')';console[_0x7bbf7e(0xb7)](a58_0x558f5a[_0x7bbf7e(0xbc)](_0x3672d4)+':\x20'+_0x227d86+'\x20'+a58_0x558f5a[_0x7bbf7e(0x92)](_0x52e169));}}console[_0x7bbf7e(0xb7)]('\x0a'+a58_0x558f5a[_0x7bbf7e(0xbe)]('[configuration\x20files]'));const _0x3b8db2=[{'label':'Session','path':this[_0x7bbf7e(0xc1)]['session'],'extra':_0x7bbf7e(0xb3)+this[_0x7bbf7e(0x9d)]+')'},{'label':'Project','path':this[_0x7bbf7e(0xc1)][_0x7bbf7e(0xae)]},{'label':'Profile','path':this[_0x7bbf7e(0xc1)]['profile']},{'label':_0x7bbf7e(0x8d),'path':this[_0x7bbf7e(0xc1)][_0x7bbf7e(0xb9)]},{'label':'Global','path':this[_0x7bbf7e(0xc1)]['global']},{'label':'Global\x20Credentials','path':this[_0x7bbf7e(0xc1)][_0x7bbf7e(0x9e)]}];for(const {label:_0x48f421,path:_0x41310f,extra:_0x2064a7}of _0x3b8db2){if(_0x41310f)console[_0x7bbf7e(0xb7)](a58_0x558f5a[_0x7bbf7e(0xbc)](_0x48f421)+':\x20'+_0x41310f+'\x20'+a58_0x558f5a[_0x7bbf7e(0x7c)]('✓')+(_0x2064a7?'\x20'+a58_0x558f5a[_0x7bbf7e(0x92)](_0x2064a7):''));else{if(_0x48f421===_0x7bbf7e(0xa1))console['log'](a58_0x558f5a[_0x7bbf7e(0xbc)](_0x48f421)+':\x20'+a58_0x558f5a[_0x7bbf7e(0x92)]('none')+'\x20'+a58_0x558f5a[_0x7bbf7e(0x92)](_0x7bbf7e(0x8e)+this['sessionId']+')'));else(_0x48f421===_0x7bbf7e(0x97)||_0x48f421===_0x7bbf7e(0xb6))&&console[_0x7bbf7e(0xb7)](a58_0x558f5a['cyan'](_0x48f421)+':\x20'+a58_0x558f5a[_0x7bbf7e(0x92)]('none'));}}}async[a58_0x312f8d(0x95)](){const _0x3d8110=a58_0x312f8d;if(!this[_0x3d8110(0x8f)]){const _0x20a0ca=await getOAuthTokens(this[_0x3d8110(0x98)]||undefined);if(_0x20a0ca)return this[_0x3d8110(0x8f)]=_0x20a0ca['access_token'],undefined;}return this['apiKey']=await getAPIKeyAsync(this[_0x3d8110(0xb5)],this[_0x3d8110(0x98)]||undefined),this[_0x3d8110(0xa4)];}static async['createAsync'](_0x47bdd1){const _0x3c2013=a58_0x312f8d,_0x573ce5=new GlobalContext(_0x47bdd1);return await _0x573ce5[_0x3c2013(0x95)](),_0x573ce5;}}
1
+ const a59_0x4b373f=a59_0xccca;function a59_0x2af8(){const _0x30fe56=['loadGlobalConfig','Profile\x20Credentials','globalCredentials','getSource','llmProject','apiKey','join','Global\x20Credentials','none','CLI\x20flag:\x20--','project','displayWithSources','13845ozFpHE','profileSource','63kNcrkc','sessionId','[configuration\x20files]','resolveAPIKeyAsync','accessToken','segmentPath','284xANhIc','display','entries','1460238ZPNzCw','site','existsSync','getParameters','150uzVIkb','database','global','layers','default','profiles','log','INFO','proxy','workflowProject','verbose','not\x20set','21gVgwBQ','bold','injectIntoOptions','parse','profile:\x20','us01','llmAgent','3036055GVJnIb','logLevel','green','1108712MCLhLJ','string','Session','.env','tdx.json','profileCredentials','cliFlags','Profile','cyan','utf-8','replace','parentSegment','llm_agent','(active)','configFiles','readFileSync','activeProfile','(session:\x20','config','profile','50UEXNMQ','session','Project','Global','1317317kjyArq','parent_segment','llm_project','segment_path','77074NrChas','workflow_project','(using\x20session:\x20','12679044eZYQVf'];a59_0x2af8=function(){return _0x30fe56;};return a59_0x2af8();}(function(_0x33f1d,_0x5e84f2){const _0x569d39=a59_0xccca,_0x596d91=_0x33f1d();while(!![]){try{const _0x3eb830=parseInt(_0x569d39(0x20e))/0x1+-parseInt(_0x569d39(0x1c1))/0x2*(parseInt(_0x569d39(0x1e0))/0x3)+-parseInt(_0x569d39(0x1d9))/0x4*(-parseInt(_0x569d39(0x1d1))/0x5)+parseInt(_0x569d39(0x1dc))/0x6*(parseInt(_0x569d39(0x1ec))/0x7)+parseInt(_0x569d39(0x1f6))/0x8*(parseInt(_0x569d39(0x1d3))/0x9)+-parseInt(_0x569d39(0x20a))/0xa*(parseInt(_0x569d39(0x1f3))/0xb)+parseInt(_0x569d39(0x1c4))/0xc;if(_0x3eb830===_0x5e84f2)break;else _0x596d91['push'](_0x596d91['shift']());}catch(_0x381f18){_0x596d91['push'](_0x596d91['shift']());}}}(a59_0x2af8,0xeb51e));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';import*as a59_0x23b856 from'node:fs';import*as a59_0x23a8c4 from'node:path';import a59_0x1c019d from'chalk';function a59_0xccca(_0x12eabb,_0x2b82b9){_0x12eabb=_0x12eabb-0x1c0;const _0x2af8bc=a59_0x2af8();let _0xcccaa6=_0x2af8bc[_0x12eabb];return _0xcccaa6;}export class GlobalContext{[a59_0x4b373f(0x1dd)];[a59_0x4b373f(0x1e1)];[a59_0x4b373f(0x20f)];[a59_0x4b373f(0x1c0)];[a59_0x4b373f(0x210)];[a59_0x4b373f(0x202)];[a59_0x4b373f(0x1c2)];[a59_0x4b373f(0x1ca)];[a59_0x4b373f(0x1d7)];['proxy'];['verbose'];[a59_0x4b373f(0x1f4)];[a59_0x4b373f(0x209)];[a59_0x4b373f(0x1d2)]=null;[a59_0x4b373f(0x1e3)];[a59_0x4b373f(0x206)];[a59_0x4b373f(0x1d4)];[a59_0x4b373f(0x204)];constructor(_0x13da0e){const _0x585e15=a59_0x4b373f;this[_0x585e15(0x1d4)]=getSessionID(_0x13da0e[_0x585e15(0x20b)]);const _0x96bc1=loadSessionContext(_0x13da0e[_0x585e15(0x20b)]),_0x145bc1=loadProjectConfig(),_0x230d38=this[_0x585e15(0x1c5)]();if(_0x13da0e[_0x585e15(0x209)])this[_0x585e15(0x206)]=_0x13da0e['profile'],this[_0x585e15(0x1d2)]='cli';else{if(_0x96bc1?.[_0x585e15(0x209)])this['activeProfile']=_0x96bc1[_0x585e15(0x209)],this[_0x585e15(0x1d2)]=_0x585e15(0x20b);else{if(_0x230d38[_0x585e15(0x209)])this[_0x585e15(0x206)]=_0x230d38['profile'],this[_0x585e15(0x1d2)]='config';else process.env.TDX_PROFILE?(this[_0x585e15(0x206)]=process.env.TDX_PROFILE,this['profileSource']='env'):(this[_0x585e15(0x206)]=null,this[_0x585e15(0x1d2)]=null);}}const _0x27f9e8=this['activeProfile']?loadProfile(this['activeProfile']):null,_0xa662d2=_0x2d7d4d=>{const _0x213396=_0x585e15;if(!_0x2d7d4d)return{};const _0x149da6=_0x2d7d4d,_0x514e15={};for(const [_0x527f7d,_0x32112c]of Object[_0x213396(0x1db)](_0x149da6)){typeof _0x32112c===_0x213396(0x1f7)&&(_0x514e15[_0x527f7d]=_0x32112c);}return _0x514e15;},_0x465cf9={},_0x3f6b9a=(_0x2bed69,_0x4e0728,_0x34ffa5)=>{const _0x125d1d=_0x585e15;if(!_0x2bed69)return![];if(_0x34ffa5&&_0x2bed69===_0x34ffa5)return![];const _0x29a021=_0x96bc1,_0x16d9e5=_0x145bc1,_0x3de70b=_0x27f9e8?.[_0x125d1d(0x208)],_0x1fc772=_0x230d38,_0x443cce=_0x29a021?.[_0x4e0728],_0x298cff=_0x16d9e5?.[_0x4e0728],_0x4d1f0d=_0x3de70b?.[_0x4e0728],_0x5778b7=_0x1fc772[_0x4e0728];return _0x2bed69!==_0x443cce&&_0x2bed69!==_0x298cff&&_0x2bed69!==_0x4d1f0d&&_0x2bed69!==_0x5778b7;},_0x13ad43=[{'optionKey':'site','contextKey':'site','defaultValue':_0x585e15(0x1f1)},{'optionKey':_0x585e15(0x1e1),'contextKey':_0x585e15(0x1e1)},{'optionKey':_0x585e15(0x201),'contextKey':_0x585e15(0x20f)},{'optionKey':_0x585e15(0x1c9),'contextKey':_0x585e15(0x210)},{'optionKey':_0x585e15(0x1f2),'contextKey':_0x585e15(0x202)},{'optionKey':'profile','contextKey':_0x585e15(0x209)}];for(const {optionKey:_0x49f256,contextKey:_0x23e473,defaultValue:_0x5b56c1}of _0x13ad43){const _0x2b0720=_0x13da0e[_0x49f256];_0x3f6b9a(_0x2b0720,_0x23e473,_0x5b56c1)&&(_0x465cf9[_0x23e473]=_0x2b0720);}this[_0x585e15(0x1e3)]={'cliFlags':_0x465cf9,'session':_0xa662d2(_0x96bc1),'project':_0xa662d2(_0x145bc1),'profile':_0xa662d2(_0x27f9e8?.[_0x585e15(0x208)]),'global':_0xa662d2(_0x230d38)};const _0xe478c={...this[_0x585e15(0x1e3)][_0x585e15(0x1e2)],...this['layers'][_0x585e15(0x209)],...this['layers'][_0x585e15(0x1cf)]};process.env.TDX_SITE&&!this[_0x585e15(0x1e3)][_0x585e15(0x20b)][_0x585e15(0x1dd)]&&!this[_0x585e15(0x1e3)][_0x585e15(0x1fc)][_0x585e15(0x1dd)]&&(_0xe478c[_0x585e15(0x1dd)]=process.env.TDX_SITE);Object['assign'](_0xe478c,this[_0x585e15(0x1e3)][_0x585e15(0x20b)]),Object['assign'](_0xe478c,this[_0x585e15(0x1e3)][_0x585e15(0x1fc)]);const _0x1e936d=_0xe478c['site']||_0x585e15(0x1f1);this['site']=resolveSite(_0x1e936d),this['database']=_0xe478c[_0x585e15(0x1e1)],this[_0x585e15(0x20f)]=_0xe478c[_0x585e15(0x20f)],this[_0x585e15(0x1c0)]=_0xe478c['segment_path'],this['llm_project']=_0xe478c[_0x585e15(0x210)],this['llm_agent']=_0xe478c[_0x585e15(0x202)],this[_0x585e15(0x1c2)]=_0xe478c[_0x585e15(0x1c2)],this[_0x585e15(0x1ea)]=_0x13da0e['verbose']||![],this[_0x585e15(0x1f4)]=_0x13da0e[_0x585e15(0x1f4)]??LogLevel[_0x585e15(0x1e7)],this[_0x585e15(0x209)]=this['activeProfile']||undefined,this['accessToken']=getAccessToken(this[_0x585e15(0x206)]||undefined),this[_0x585e15(0x1ca)]=getAPIKey(this[_0x585e15(0x206)]||undefined);const _0x5031b4=typeof _0x230d38[_0x585e15(0x1e8)]===_0x585e15(0x1f7)?_0x230d38[_0x585e15(0x1e8)]:undefined;this['proxy']=_0x5031b4||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x1c3fb3=getConfigDir(),_0x5631d1=a59_0x23a8c4[_0x585e15(0x1cb)](_0x1c3fb3,'sessions',this[_0x585e15(0x1d4)]+'.json'),_0x3811cd=findProjectConfigPath(),_0x5654fd=a59_0x23a8c4[_0x585e15(0x1cb)](_0x1c3fb3,_0x585e15(0x1fa)),_0x84fb55=a59_0x23a8c4['join'](_0x1c3fb3,_0x585e15(0x1f9));let _0x43edfb=null,_0x4a3f0b=null;this[_0x585e15(0x206)]&&(_0x43edfb=a59_0x23a8c4[_0x585e15(0x1cb)](_0x1c3fb3,_0x585e15(0x1e5),this[_0x585e15(0x206)],_0x585e15(0x1fa)),_0x4a3f0b=a59_0x23a8c4[_0x585e15(0x1cb)](_0x1c3fb3,_0x585e15(0x1e5),this[_0x585e15(0x206)],_0x585e15(0x1f9))),this[_0x585e15(0x204)]={'session':a59_0x23b856[_0x585e15(0x1de)](_0x5631d1)?_0x5631d1:null,'project':_0x3811cd,'profile':_0x43edfb&&a59_0x23b856[_0x585e15(0x1de)](_0x43edfb)?_0x43edfb:null,'profileCredentials':_0x4a3f0b&&a59_0x23b856[_0x585e15(0x1de)](_0x4a3f0b)?_0x4a3f0b:null,'global':a59_0x23b856[_0x585e15(0x1de)](_0x5654fd)?_0x5654fd:null,'globalCredentials':a59_0x23b856['existsSync'](_0x84fb55)?_0x84fb55:null};}[a59_0x4b373f(0x1c8)](_0x1d56eb,_0x2471ec){const _0x1bdf8b=a59_0x4b373f;if(!_0x2471ec)return _0x1bdf8b(0x1eb);const _0x3495fc=_0x2471ec;if(this[_0x1bdf8b(0x1e3)]['cliFlags'][_0x1d56eb]===_0x3495fc){if(_0x1d56eb==='site'&&_0x3495fc===_0x1bdf8b(0x1f1)&&!this[_0x1bdf8b(0x1e3)][_0x1bdf8b(0x20b)][_0x1bdf8b(0x1dd)]&&!this[_0x1bdf8b(0x1e3)]['project']['site']&&!this[_0x1bdf8b(0x1e3)][_0x1bdf8b(0x209)][_0x1bdf8b(0x1dd)]&&!this['layers'][_0x1bdf8b(0x1e2)][_0x1bdf8b(0x1dd)])return _0x1bdf8b(0x1e4);return _0x1bdf8b(0x1ce)+_0x1d56eb[_0x1bdf8b(0x200)](/_/g,'-');}if(this['layers'][_0x1bdf8b(0x20b)][_0x1d56eb]===_0x3495fc)return _0x1bdf8b(0x20b);if(this['layers'][_0x1bdf8b(0x1cf)][_0x1d56eb]===_0x3495fc)return _0x1bdf8b(0x1cf);if(this[_0x1bdf8b(0x1e3)][_0x1bdf8b(0x209)][_0x1d56eb]===_0x3495fc)return _0x1bdf8b(0x1f0)+this['activeProfile'];if(this[_0x1bdf8b(0x1e3)]['global'][_0x1d56eb]===_0x3495fc)return _0x1bdf8b(0x1e2);return _0x1bdf8b(0x1e4);}['loadGlobalConfig'](){const _0x546a45=a59_0x4b373f,_0x363616=a59_0x23a8c4['join'](getConfigDir(),_0x546a45(0x1fa));if(!a59_0x23b856[_0x546a45(0x1de)](_0x363616))return{};try{const _0x4881ec=a59_0x23b856[_0x546a45(0x205)](_0x363616,_0x546a45(0x1ff));return JSON[_0x546a45(0x1ef)](_0x4881ec);}catch{return{};}}[a59_0x4b373f(0x1ee)](_0x59a2c1){const _0x24d4b8=a59_0x4b373f;_0x59a2c1['site']=this[_0x24d4b8(0x1dd)],!_0x59a2c1['database']&&this[_0x24d4b8(0x1e1)]&&(_0x59a2c1[_0x24d4b8(0x1e1)]=this[_0x24d4b8(0x1e1)]),!_0x59a2c1[_0x24d4b8(0x201)]&&this[_0x24d4b8(0x20f)]&&(_0x59a2c1[_0x24d4b8(0x201)]=this['parent_segment']),!_0x59a2c1[_0x24d4b8(0x1d8)]&&this[_0x24d4b8(0x1c0)]&&(_0x59a2c1[_0x24d4b8(0x1d8)]=this[_0x24d4b8(0x1c0)]),!_0x59a2c1[_0x24d4b8(0x1c9)]&&this[_0x24d4b8(0x210)]&&(_0x59a2c1[_0x24d4b8(0x1c9)]=this[_0x24d4b8(0x210)]),!_0x59a2c1[_0x24d4b8(0x1f2)]&&this['llm_agent']&&(_0x59a2c1[_0x24d4b8(0x1f2)]=this[_0x24d4b8(0x202)]),!_0x59a2c1[_0x24d4b8(0x1e9)]&&this[_0x24d4b8(0x1c2)]&&(_0x59a2c1['workflowProject']=this[_0x24d4b8(0x1c2)]);}[a59_0x4b373f(0x1df)](){const _0x7bceed=a59_0x4b373f;return[{'key':_0x7bceed(0x1dd),'value':this[_0x7bceed(0x1dd)]},{'key':_0x7bceed(0x1e1),'value':this[_0x7bceed(0x1e1)]},{'key':_0x7bceed(0x20f),'value':this[_0x7bceed(0x20f)]},{'key':_0x7bceed(0x1c0),'value':this['segment_path']},{'key':_0x7bceed(0x210),'value':this[_0x7bceed(0x210)]},{'key':'llm_agent','value':this[_0x7bceed(0x202)]},{'key':_0x7bceed(0x1c2),'value':this['workflow_project']},{'key':_0x7bceed(0x209),'value':this['activeProfile']||undefined}];}[a59_0x4b373f(0x1da)](){const _0x3ff065=a59_0x4b373f;console[_0x3ff065(0x1e6)](a59_0x1c019d[_0x3ff065(0x1ed)]('[context]'));for(const {key:_0x5c95e5,value:_0x5d8dd8}of this[_0x3ff065(0x1df)]()){_0x5d8dd8&&console[_0x3ff065(0x1e6)](a59_0x1c019d[_0x3ff065(0x1fe)](_0x5c95e5)+':\x20'+_0x5d8dd8);}}[a59_0x4b373f(0x1d0)](){const _0x21f78d=a59_0x4b373f;console['log'](a59_0x1c019d[_0x21f78d(0x1ed)]('[context]'));for(const {key:_0x54d87d,value:_0x13b8ce}of this[_0x21f78d(0x1df)]()){if(_0x13b8ce){const _0x5d6daf=_0x54d87d===_0x21f78d(0x209)?_0x21f78d(0x203):'('+this[_0x21f78d(0x1c8)](_0x54d87d,_0x13b8ce)+')';console[_0x21f78d(0x1e6)](a59_0x1c019d['cyan'](_0x54d87d)+':\x20'+_0x13b8ce+'\x20'+a59_0x1c019d['dim'](_0x5d6daf));}}console['log']('\x0a'+a59_0x1c019d[_0x21f78d(0x1ed)](_0x21f78d(0x1d5)));const _0xab7c4c=[{'label':_0x21f78d(0x1f8),'path':this[_0x21f78d(0x204)][_0x21f78d(0x20b)],'extra':_0x21f78d(0x207)+this[_0x21f78d(0x1d4)]+')'},{'label':_0x21f78d(0x20c),'path':this[_0x21f78d(0x204)][_0x21f78d(0x1cf)]},{'label':_0x21f78d(0x1fd),'path':this[_0x21f78d(0x204)]['profile']},{'label':_0x21f78d(0x1c6),'path':this[_0x21f78d(0x204)][_0x21f78d(0x1fb)]},{'label':_0x21f78d(0x20d),'path':this['configFiles'][_0x21f78d(0x1e2)]},{'label':_0x21f78d(0x1cc),'path':this[_0x21f78d(0x204)][_0x21f78d(0x1c7)]}];for(const {label:_0x2a9b1a,path:_0x4292ec,extra:_0x4bc470}of _0xab7c4c){if(_0x4292ec)console[_0x21f78d(0x1e6)](a59_0x1c019d[_0x21f78d(0x1fe)](_0x2a9b1a)+':\x20'+_0x4292ec+'\x20'+a59_0x1c019d[_0x21f78d(0x1f5)]('✓')+(_0x4bc470?'\x20'+a59_0x1c019d['dim'](_0x4bc470):''));else{if(_0x2a9b1a===_0x21f78d(0x1f8))console[_0x21f78d(0x1e6)](a59_0x1c019d[_0x21f78d(0x1fe)](_0x2a9b1a)+':\x20'+a59_0x1c019d['dim']('none')+'\x20'+a59_0x1c019d['dim'](_0x21f78d(0x1c3)+this['sessionId']+')'));else(_0x2a9b1a==='Project'||_0x2a9b1a===_0x21f78d(0x20d))&&console[_0x21f78d(0x1e6)](a59_0x1c019d[_0x21f78d(0x1fe)](_0x2a9b1a)+':\x20'+a59_0x1c019d['dim'](_0x21f78d(0x1cd)));}}}async['resolveAPIKeyAsync'](){const _0x47c54e=a59_0x4b373f;if(!this[_0x47c54e(0x1d7)]){const _0x5ed5f3=await getOAuthTokens(this[_0x47c54e(0x206)]||undefined);if(_0x5ed5f3)return this[_0x47c54e(0x1d7)]=_0x5ed5f3['access_token'],undefined;}return this[_0x47c54e(0x1ca)]=await getAPIKeyAsync(this[_0x47c54e(0x1dd)],this[_0x47c54e(0x206)]||undefined),this[_0x47c54e(0x1ca)];}static async['createAsync'](_0x5caa71){const _0x71d63a=a59_0x4b373f,_0x396995=new GlobalContext(_0x5caa71);return await _0x396995[_0x71d63a(0x1d6)](),_0x396995;}}
@@ -1 +1 @@
1
- (function(_0x3172a8,_0x405d86){const _0x2cfd45=a59_0x7be4,_0x11a93d=_0x3172a8();while(!![]){try{const _0x23caa5=-parseInt(_0x2cfd45(0x172))/0x1+-parseInt(_0x2cfd45(0x185))/0x2*(parseInt(_0x2cfd45(0x183))/0x3)+parseInt(_0x2cfd45(0x17d))/0x4*(parseInt(_0x2cfd45(0x17b))/0x5)+-parseInt(_0x2cfd45(0x164))/0x6*(parseInt(_0x2cfd45(0x176))/0x7)+-parseInt(_0x2cfd45(0x173))/0x8+-parseInt(_0x2cfd45(0x17f))/0x9+parseInt(_0x2cfd45(0x184))/0xa;if(_0x23caa5===_0x405d86)break;else _0x11a93d['push'](_0x11a93d['shift']());}catch(_0x5172c7){_0x11a93d['push'](_0x11a93d['shift']());}}}(a59_0x1874,0x50682));const SERVICE_NAME='tdx';let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x778a64=a59_0x7be4;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x3df36b=await import(_0x778a64(0x16b));return EntryClass=_0x3df36b[_0x778a64(0x180)],EntryClass;}catch(_0x2fcd92){return keyringLoadError=_0x2fcd92 instanceof Error?_0x2fcd92:new Error(String(_0x2fcd92)),null;}}function getAccountName(_0x137f82){const _0x11bdf7=a59_0x7be4,_0x1513bf=_0x137f82||'';return _0x11bdf7(0x171)+_0x1513bf+':api_key';}function a59_0x1874(){const _0x500937=['-25300','restricted','49525bnEXDG','not\x20available','16mzLTXb','not\x20supported','1362177BAAjKe','Entry','__keychain_test__','-25293','2742ekwpiS','23139660dkhlGT','1218lrvSqU','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.','System\x20keychain\x20is\x20not\x20available','could\x20not\x20be\x20found','144jHWYQl','not_found','unavailable','toLowerCase','getPassword','message','setPassword','@napi-rs/keyring','access','includes','error','access_denied','deleteCredential','profile:','300769NRMKkA','4981088eTXaHy','success','no\x20matching\x20entry','114583YCRLPY','Warning:\x20','value'];a59_0x1874=function(){return _0x500937;};return a59_0x1874();}export async function getKeychainAPIKey(_0x33751a){const _0x4e3879=a59_0x7be4,_0x340c8d=await getKeychainAPIKeyWithStatus(_0x33751a);if(_0x340c8d[_0x4e3879(0x174)])return _0x340c8d[_0x4e3879(0x178)];return _0x340c8d['reason']==='access_denied'&&console[_0x4e3879(0x16e)](_0x4e3879(0x177)+_0x340c8d[_0x4e3879(0x169)]),null;}export async function getKeychainAPIKeyWithStatus(_0x2fbcc2){const _0x4f71e6=a59_0x7be4;try{const _0x47ad2d=await getEntryClass();if(!_0x47ad2d)return{'success':![],'reason':_0x4f71e6(0x166)};const _0x1aa8a1=getAccountName(_0x2fbcc2),_0x45b412=new _0x47ad2d(SERVICE_NAME,_0x1aa8a1),_0x44f6d3=_0x45b412[_0x4f71e6(0x168)]();if(_0x44f6d3)return{'success':!![],'value':_0x44f6d3};return{'success':![],'reason':_0x4f71e6(0x165)};}catch(_0x5142d2){const _0xd1e418=_0x5142d2 instanceof Error?_0x5142d2[_0x4f71e6(0x169)]:String(_0x5142d2);if(_0xd1e418[_0x4f71e6(0x16d)](_0x4f71e6(0x179))||_0xd1e418['toLowerCase']()[_0x4f71e6(0x16d)](_0x4f71e6(0x163))||_0xd1e418['toLowerCase']()[_0x4f71e6(0x16d)]('not\x20found')||_0xd1e418['toLowerCase']()[_0x4f71e6(0x16d)](_0x4f71e6(0x175)))return{'success':![],'reason':'not_found'};if(_0xd1e418['includes'](_0x4f71e6(0x182))||_0xd1e418[_0x4f71e6(0x167)]()[_0x4f71e6(0x16d)](_0x4f71e6(0x17a))||_0xd1e418[_0x4f71e6(0x167)]()[_0x4f71e6(0x16d)](_0x4f71e6(0x16c)))return{'success':![],'reason':_0x4f71e6(0x16f),'message':_0x4f71e6(0x186)};return{'success':![],'reason':'unavailable','message':_0xd1e418};}}export async function saveKeychainAPIKey(_0x1cb66f,_0x2536db){const _0x3ae9ba=a59_0x7be4,_0x6a7f88=await getEntryClass();if(!_0x6a7f88)throw new Error(_0x3ae9ba(0x162));const _0x2cbcc9=getAccountName(_0x2536db),_0x2be3ab=new _0x6a7f88(SERVICE_NAME,_0x2cbcc9);_0x2be3ab[_0x3ae9ba(0x16a)](_0x1cb66f);}function a59_0x7be4(_0x52ab80,_0x5e6c5a){_0x52ab80=_0x52ab80-0x162;const _0x1874f1=a59_0x1874();let _0x7be4c6=_0x1874f1[_0x52ab80];return _0x7be4c6;}export async function deleteKeychainAPIKey(_0x4fc182){const _0x338430=a59_0x7be4;try{const _0x4c0df7=await getEntryClass();if(!_0x4c0df7)return![];const _0x11e881=getAccountName(_0x4fc182),_0x485e55=new _0x4c0df7(SERVICE_NAME,_0x11e881);return _0x485e55[_0x338430(0x170)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x1df240=a59_0x7be4;try{const _0x262fe3=await getEntryClass();if(!_0x262fe3)return![];const _0x45fbd6=new _0x262fe3(SERVICE_NAME,_0x1df240(0x181));return _0x45fbd6[_0x1df240(0x168)](),!![];}catch(_0x5e5844){const _0xc3e2b4=_0x5e5844 instanceof Error?_0x5e5844[_0x1df240(0x169)]['toLowerCase']():'';if(_0xc3e2b4[_0x1df240(0x16d)](_0x1df240(0x17c))||_0xc3e2b4[_0x1df240(0x16d)](_0x1df240(0x17e))||_0xc3e2b4[_0x1df240(0x16d)]('cannot\x20find'))return![];return!![];}}
1
+ function a60_0x2b32(_0x2891ef,_0x3f6d9e){_0x2891ef=_0x2891ef-0x96;const _0x237130=a60_0x2371();let _0x2b328f=_0x237130[_0x2891ef];return _0x2b328f;}(function(_0x57b573,_0x24eddb){const _0x5b248e=a60_0x2b32,_0x175ea0=_0x57b573();while(!![]){try{const _0x159cf3=parseInt(_0x5b248e(0x9e))/0x1+-parseInt(_0x5b248e(0x96))/0x2*(parseInt(_0x5b248e(0x9c))/0x3)+parseInt(_0x5b248e(0xaf))/0x4*(parseInt(_0x5b248e(0xa1))/0x5)+parseInt(_0x5b248e(0xa5))/0x6*(parseInt(_0x5b248e(0x97))/0x7)+-parseInt(_0x5b248e(0xa2))/0x8*(-parseInt(_0x5b248e(0xae))/0x9)+parseInt(_0x5b248e(0xb2))/0xa+-parseInt(_0x5b248e(0xb4))/0xb;if(_0x159cf3===_0x24eddb)break;else _0x175ea0['push'](_0x175ea0['shift']());}catch(_0xcd4b94){_0x175ea0['push'](_0x175ea0['shift']());}}}(a60_0x2371,0x8d9f7));function a60_0x2371(){const _0x2fbf21=['4365571bVovnm','error','deleteCredential','access_denied','toLowerCase','21eQqLfi','cannot\x20find','1018268aVnLQd','System\x20keychain\x20is\x20not\x20available','__keychain_test__','5MiCRGS','8462440GyWvIb','includes','getPassword','6MTyqzE','reason','no\x20matching\x20entry','Warning:\x20','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.','not\x20available','-25293','message','setPassword','9HrRtJt','1362164pgMczx','unavailable','success','2005420njSAaC','access','17511505nshpGi','not_found','profile:','305362qgsPTK'];a60_0x2371=function(){return _0x2fbf21;};return a60_0x2371();}const SERVICE_NAME='tdx';let EntryClass=null,keyringLoadError=null;async function getEntryClass(){if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x110a4c=await import('@napi-rs/keyring');return EntryClass=_0x110a4c['Entry'],EntryClass;}catch(_0x2df801){return keyringLoadError=_0x2df801 instanceof Error?_0x2df801:new Error(String(_0x2df801)),null;}}function getAccountName(_0x2b2b63){const _0x31a09f=a60_0x2b32,_0xb083fb=_0x2b2b63||'';return _0x31a09f(0xb6)+_0xb083fb+':api_key';}export async function getKeychainAPIKey(_0x115d39){const _0x577d8f=a60_0x2b32,_0x32273f=await getKeychainAPIKeyWithStatus(_0x115d39);if(_0x32273f[_0x577d8f(0xb1)])return _0x32273f['value'];return _0x32273f[_0x577d8f(0xa6)]==='access_denied'&&console[_0x577d8f(0x98)](_0x577d8f(0xa8)+_0x32273f['message']),null;}export async function getKeychainAPIKeyWithStatus(_0xaab0f6){const _0x1c881a=a60_0x2b32;try{const _0x1704cf=await getEntryClass();if(!_0x1704cf)return{'success':![],'reason':_0x1c881a(0xb0)};const _0x209ba8=getAccountName(_0xaab0f6),_0x13d193=new _0x1704cf(SERVICE_NAME,_0x209ba8),_0x1a199d=_0x13d193[_0x1c881a(0xa4)]();if(_0x1a199d)return{'success':!![],'value':_0x1a199d};return{'success':![],'reason':_0x1c881a(0xb5)};}catch(_0x3c93bd){const _0x24c50c=_0x3c93bd instanceof Error?_0x3c93bd[_0x1c881a(0xac)]:String(_0x3c93bd);if(_0x24c50c['includes']('-25300')||_0x24c50c[_0x1c881a(0x9b)]()['includes']('could\x20not\x20be\x20found')||_0x24c50c[_0x1c881a(0x9b)]()[_0x1c881a(0xa3)]('not\x20found')||_0x24c50c[_0x1c881a(0x9b)]()['includes'](_0x1c881a(0xa7)))return{'success':![],'reason':_0x1c881a(0xb5)};if(_0x24c50c[_0x1c881a(0xa3)](_0x1c881a(0xab))||_0x24c50c[_0x1c881a(0x9b)]()[_0x1c881a(0xa3)]('restricted')||_0x24c50c[_0x1c881a(0x9b)]()[_0x1c881a(0xa3)](_0x1c881a(0xb3)))return{'success':![],'reason':_0x1c881a(0x9a),'message':_0x1c881a(0xa9)};return{'success':![],'reason':_0x1c881a(0xb0),'message':_0x24c50c};}}export async function saveKeychainAPIKey(_0x25d569,_0x48dd97){const _0x21ea6a=a60_0x2b32,_0x1249b0=await getEntryClass();if(!_0x1249b0)throw new Error(_0x21ea6a(0x9f));const _0x3ff36f=getAccountName(_0x48dd97),_0x165256=new _0x1249b0(SERVICE_NAME,_0x3ff36f);_0x165256[_0x21ea6a(0xad)](_0x25d569);}export async function deleteKeychainAPIKey(_0x5211d8){const _0x25e98b=a60_0x2b32;try{const _0x96b7c=await getEntryClass();if(!_0x96b7c)return![];const _0xab5e6f=getAccountName(_0x5211d8),_0x36831c=new _0x96b7c(SERVICE_NAME,_0xab5e6f);return _0x36831c[_0x25e98b(0x99)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x370b75=a60_0x2b32;try{const _0xa3259=await getEntryClass();if(!_0xa3259)return![];const _0x2824e0=new _0xa3259(SERVICE_NAME,_0x370b75(0xa0));return _0x2824e0[_0x370b75(0xa4)](),!![];}catch(_0x530027){const _0x402ee2=_0x530027 instanceof Error?_0x530027[_0x370b75(0xac)][_0x370b75(0x9b)]():'';if(_0x402ee2['includes'](_0x370b75(0xaa))||_0x402ee2[_0x370b75(0xa3)]('not\x20supported')||_0x402ee2['includes'](_0x370b75(0x9d)))return![];return!![];}}
@@ -1 +1 @@
1
- const a60_0x56d6c8=a60_0x14aa;(function(_0x19df55,_0x17f559){const _0x1f1e00=a60_0x14aa,_0x520c2c=_0x19df55();while(!![]){try{const _0x3703aa=parseInt(_0x1f1e00(0x1f4))/0x1*(-parseInt(_0x1f1e00(0x1f3))/0x2)+-parseInt(_0x1f1e00(0x1f0))/0x3+parseInt(_0x1f1e00(0x1ea))/0x4*(parseInt(_0x1f1e00(0x1fa))/0x5)+parseInt(_0x1f1e00(0x1f8))/0x6*(parseInt(_0x1f1e00(0x1e9))/0x7)+parseInt(_0x1f1e00(0x1f7))/0x8+parseInt(_0x1f1e00(0x1fc))/0x9*(parseInt(_0x1f1e00(0x1f5))/0xa)+-parseInt(_0x1f1e00(0x1f9))/0xb;if(_0x3703aa===_0x17f559)break;else _0x520c2c['push'](_0x520c2c['shift']());}catch(_0xfe0b7a){_0x520c2c['push'](_0x520c2c['shift']());}}}(a60_0x1acc,0xeafbc));function a60_0x14aa(_0x221b27,_0x32e9d4){_0x221b27=_0x221b27-0x1e9;const _0x1acc30=a60_0x1acc();let _0x14aa40=_0x1acc30[_0x221b27];return _0x14aa40;}function a60_0x1acc(){const _0x2777e5=['profile:','298137LTXMpM','6313352aDdNqT','setPassword','stringify','getPassword','@napi-rs/keyring','deleteCredential','2156694dSPSCc','System\x20keychain\x20is\x20not\x20available',':oauth_tokens','2dLmLZn','396403bgdTBZ','32990YsapsE','tdx','5192016qJNXCx','6oqZkNj','22653092gNDWIl','5LUypsq','parse','5094PvGDWm'];a60_0x1acc=function(){return _0x2777e5;};return a60_0x1acc();}const SERVICE_NAME=a60_0x56d6c8(0x1f6);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x197085=a60_0x56d6c8;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x1ca5a2=await import(_0x197085(0x1ee));return EntryClass=_0x1ca5a2['Entry'],EntryClass;}catch(_0x1c7e1f){return keyringLoadError=_0x1c7e1f instanceof Error?_0x1c7e1f:new Error(String(_0x1c7e1f)),null;}}function getOAuthAccountName(_0x4a12a2){const _0x2adfeb=a60_0x56d6c8,_0xb4d6de=_0x4a12a2||'';return _0x2adfeb(0x1fd)+_0xb4d6de+_0x2adfeb(0x1f2);}export async function saveOAuthTokens(_0x397674,_0x4e1a9c){const _0x4b9429=a60_0x56d6c8,_0x56a789=await getEntryClass();if(!_0x56a789)throw new Error(_0x4b9429(0x1f1));const _0x11beaa=getOAuthAccountName(_0x4e1a9c),_0x487e6a=new _0x56a789(SERVICE_NAME,_0x11beaa);_0x487e6a[_0x4b9429(0x1eb)](JSON[_0x4b9429(0x1ec)](_0x397674));}export async function getOAuthTokens(_0x3405d7){const _0x163ae6=a60_0x56d6c8;try{const _0x1e5b72=await getEntryClass();if(!_0x1e5b72)return null;const _0x4fa9e7=getOAuthAccountName(_0x3405d7),_0x510896=new _0x1e5b72(SERVICE_NAME,_0x4fa9e7),_0x2862a5=_0x510896[_0x163ae6(0x1ed)]();if(_0x2862a5)return JSON[_0x163ae6(0x1fb)](_0x2862a5);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x463d69){const _0x2f6470=a60_0x56d6c8;try{const _0xc6c350=await getEntryClass();if(!_0xc6c350)return![];const _0x414e3e=getOAuthAccountName(_0x463d69),_0x490bdc=new _0xc6c350(SERVICE_NAME,_0x414e3e);return _0x490bdc[_0x2f6470(0x1ef)](),!![];}catch{return![];}}
1
+ const a61_0x2fdf02=a61_0x4159;(function(_0x494b37,_0x528c9e){const _0x50a33f=a61_0x4159,_0x393ca8=_0x494b37();while(!![]){try{const _0x1f08c9=-parseInt(_0x50a33f(0x190))/0x1*(parseInt(_0x50a33f(0x182))/0x2)+parseInt(_0x50a33f(0x180))/0x3+parseInt(_0x50a33f(0x18f))/0x4*(parseInt(_0x50a33f(0x18d))/0x5)+-parseInt(_0x50a33f(0x18e))/0x6+parseInt(_0x50a33f(0x189))/0x7+parseInt(_0x50a33f(0x187))/0x8*(-parseInt(_0x50a33f(0x17d))/0x9)+parseInt(_0x50a33f(0x18b))/0xa;if(_0x1f08c9===_0x528c9e)break;else _0x393ca8['push'](_0x393ca8['shift']());}catch(_0x12089a){_0x393ca8['push'](_0x393ca8['shift']());}}}(a61_0x4786,0x1b238));const SERVICE_NAME=a61_0x2fdf02(0x17e);let EntryClass=null,keyringLoadError=null;function a61_0x4786(){const _0xb1ca66=['56KinUmD','21821lHjZxR','Entry','125289UCxEyf','tdx','getPassword','17877euTAxs','deleteCredential','2bBnWAC','setPassword','System\x20keychain\x20is\x20not\x20available','stringify','profile:','96XdiiWF','parse','1039465XbzToq',':oauth_tokens','949650wjKvra','@napi-rs/keyring','29965NAwHVc','199728wvkVvD'];a61_0x4786=function(){return _0xb1ca66;};return a61_0x4786();}async function getEntryClass(){const _0x490190=a61_0x2fdf02;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x255d05=await import(_0x490190(0x18c));return EntryClass=_0x255d05[_0x490190(0x191)],EntryClass;}catch(_0x3fbadf){return keyringLoadError=_0x3fbadf instanceof Error?_0x3fbadf:new Error(String(_0x3fbadf)),null;}}function getOAuthAccountName(_0x3de0f0){const _0x5b5148=a61_0x2fdf02,_0x58dd86=_0x3de0f0||'';return _0x5b5148(0x186)+_0x58dd86+_0x5b5148(0x18a);}export async function saveOAuthTokens(_0x327622,_0x62377c){const _0x491d18=a61_0x2fdf02,_0x2e04d0=await getEntryClass();if(!_0x2e04d0)throw new Error(_0x491d18(0x184));const _0x13e474=getOAuthAccountName(_0x62377c),_0x2f1674=new _0x2e04d0(SERVICE_NAME,_0x13e474);_0x2f1674[_0x491d18(0x183)](JSON[_0x491d18(0x185)](_0x327622));}function a61_0x4159(_0xc68ffa,_0x18cc8c){_0xc68ffa=_0xc68ffa-0x17d;const _0x47866a=a61_0x4786();let _0x4159a8=_0x47866a[_0xc68ffa];return _0x4159a8;}export async function getOAuthTokens(_0x5b51dc){const _0x54f888=a61_0x2fdf02;try{const _0x3294d3=await getEntryClass();if(!_0x3294d3)return null;const _0x43b814=getOAuthAccountName(_0x5b51dc),_0x388f21=new _0x3294d3(SERVICE_NAME,_0x43b814),_0x4b7613=_0x388f21[_0x54f888(0x17f)]();if(_0x4b7613)return JSON[_0x54f888(0x188)](_0x4b7613);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x57f26b){const _0x42085d=a61_0x2fdf02;try{const _0x54ab26=await getEntryClass();if(!_0x54ab26)return![];const _0x7a06e8=getOAuthAccountName(_0x57f26b),_0x4f1a47=new _0x54ab26(SERVICE_NAME,_0x7a06e8);return _0x4f1a47[_0x42085d(0x181)](),!![];}catch{return![];}}
@@ -1 +1 @@
1
- const a61_0x271916=a61_0x4500;(function(_0x360efa,_0xf8de95){const _0x154a68=a61_0x4500,_0xf8125a=_0x360efa();while(!![]){try{const _0x360f9a=-parseInt(_0x154a68(0x19c))/0x1*(-parseInt(_0x154a68(0x1ac))/0x2)+-parseInt(_0x154a68(0x1b7))/0x3*(parseInt(_0x154a68(0x1c1))/0x4)+parseInt(_0x154a68(0x1d3))/0x5*(parseInt(_0x154a68(0x1ce))/0x6)+-parseInt(_0x154a68(0x1a8))/0x7+parseInt(_0x154a68(0x1ab))/0x8+-parseInt(_0x154a68(0x19e))/0x9+-parseInt(_0x154a68(0x1b4))/0xa*(-parseInt(_0x154a68(0x1a7))/0xb);if(_0x360f9a===_0xf8de95)break;else _0xf8125a['push'](_0xf8125a['shift']());}catch(_0x39abd3){_0xf8125a['push'](_0xf8125a['shift']());}}}(a61_0x99c4,0x5ce24));function a61_0x4500(_0x2dfd80,_0xa3197){_0x2dfd80=_0x2dfd80-0x197;const _0x99c438=a61_0x99c4();let _0x45000f=_0x99c438[_0x2dfd80];return _0x45000f;}import*as a61_0x21524d from'node:crypto';import*as a61_0x3ef7d4 from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';const OAUTH_SUPPORTED_SITES=new Set([a61_0x271916(0x1a9),a61_0x271916(0x1ba),a61_0x271916(0x1b2),a61_0x271916(0x1cf),a61_0x271916(0x1cd)]);function a61_0x99c4(){const _0x4560b5=['message','8FJckJP','redirectUri','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','/oauth/token','randomBytes','end','scope','writeHead','S256','tdx','url','clientId','stg-ap03','3357294vmPAKz','stg-ap01','hex','error','redirect_uri','5ErtTFH','has','digest','base64url','searchParams','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','code_challenge','1AowIbQ','EADDRINUSE','4944663oNfzFR','/oauth/callback','listen','client_id','Port\x20','authorization_code','close','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','):\x20','11MEueCy','4814971YvKtmz','dev-us01','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','3674400lqzMoq','696934heepKK','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','status','get','text/html','127.0.0.1','stg-us01','codeChallenge','6319140uqfega','update','code','572277eKgANs','sha256','set','dev-eu01','text','waitForCallback','state','toString','Not\x20Found'];a61_0x99c4=function(){return _0x4560b5;};return a61_0x99c4();}export function isOAuthSupported(_0x3584a7){const _0x543760=a61_0x271916;return OAUTH_SUPPORTED_SITES[_0x543760(0x1d4)](_0x3584a7);}export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI='http://localhost:'+OAUTH_CALLBACK_PORT+a61_0x271916(0x19f);export function getOAuthClientId(){const _0x44c768=a61_0x271916;return process.env.TD_OAUTH_CLIENT_ID||_0x44c768(0x1ca);}export function generatePKCEPair(){const _0x1e1981=a61_0x271916,_0x19e5ab=a61_0x21524d[_0x1e1981(0x1c5)](0x20)[_0x1e1981(0x1be)](_0x1e1981(0x198)),_0x2b26f7=a61_0x21524d['createHash'](_0x1e1981(0x1b8))[_0x1e1981(0x1b5)](_0x19e5ab)[_0x1e1981(0x197)](_0x1e1981(0x198));return{'verifier':_0x19e5ab,'challenge':_0x2b26f7};}export function buildAuthorizeURL(_0x2580e4,_0xc7600e){const _0x16323d=a61_0x271916,_0x25c154=new URL('/oauth/authorize',_0x2580e4);return _0x25c154[_0x16323d(0x199)][_0x16323d(0x1b9)]('response_type',_0x16323d(0x1b6)),_0x25c154[_0x16323d(0x199)][_0x16323d(0x1b9)](_0x16323d(0x1a1),_0xc7600e[_0x16323d(0x1cc)]),_0x25c154[_0x16323d(0x199)][_0x16323d(0x1b9)](_0x16323d(0x1d2),_0xc7600e[_0x16323d(0x1c2)]),_0x25c154[_0x16323d(0x199)][_0x16323d(0x1b9)](_0x16323d(0x1bd),_0xc7600e['state']),_0x25c154[_0x16323d(0x199)]['set'](_0x16323d(0x19b),_0xc7600e[_0x16323d(0x1b3)]),_0x25c154[_0x16323d(0x199)][_0x16323d(0x1b9)]('code_challenge_method',_0x16323d(0x1c9)),_0xc7600e[_0x16323d(0x1c7)]&&_0x25c154['searchParams'][_0x16323d(0x1b9)](_0x16323d(0x1c7),_0xc7600e[_0x16323d(0x1c7)]),_0x25c154[_0x16323d(0x1be)]();}export async function postTokenRequest(_0x1128d2,_0x5dd8e8){const _0x4736d5=a61_0x271916,_0x5edcc8=new URLSearchParams(_0x5dd8e8)[_0x4736d5(0x1be)](),_0x37d2ae=await fetch(_0x1128d2,{'method':'POST','headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x5edcc8});if(!_0x37d2ae['ok']){const _0x57c140=await _0x37d2ae[_0x4736d5(0x1bb)]();throw new Error('OAuth\x20token\x20request\x20failed\x20('+_0x37d2ae[_0x4736d5(0x1ae)]+_0x4736d5(0x1a6)+_0x57c140);}return await _0x37d2ae['json']();}export async function exchangeCodeForTokens(_0x47923c,_0x3e4952,_0x363003,_0x3603ce){const _0x458b72=a61_0x271916,_0x2cdf06=_0x47923c+_0x458b72(0x1c4);return postTokenRequest(_0x2cdf06,{'grant_type':_0x458b72(0x1a3),'client_id':getOAuthClientId(),'code':_0x3e4952,'code_verifier':_0x363003,'redirect_uri':_0x3603ce});}export function startLocalCallbackServer(){const _0x3c8ef0=a61_0x271916;let _0x25b50f,_0x293d26;const _0x150003=new Promise((_0xb141a1,_0x11898c)=>{_0x25b50f=_0xb141a1,_0x293d26=_0x11898c;}),_0x382873=a61_0x3ef7d4['createServer']((_0x13a132,_0x595bda)=>{const _0x365e84=a61_0x4500,_0x554fa4=new URL(_0x13a132[_0x365e84(0x1cb)]||'/','http://127.0.0.1');if(_0x554fa4['pathname']!==_0x365e84(0x19f)){_0x595bda[_0x365e84(0x1c8)](0x194,{'Content-Type':'text/plain'}),_0x595bda[_0x365e84(0x1c6)](_0x365e84(0x1bf));return;}const _0x5d5d47=_0x554fa4[_0x365e84(0x199)][_0x365e84(0x1af)]('code'),_0x4b2918=_0x554fa4['searchParams']['get'](_0x365e84(0x1bd)),_0x26defa=_0x554fa4[_0x365e84(0x199)][_0x365e84(0x1af)](_0x365e84(0x1d1));if(_0x26defa||!_0x5d5d47||!_0x4b2918){_0x595bda[_0x365e84(0x1c8)](0x190,{'Content-Type':_0x365e84(0x1b0)}),_0x595bda[_0x365e84(0x1c6)](_0x365e84(0x1a5)),_0x293d26(new Error('OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters'));return;}_0x595bda[_0x365e84(0x1c8)](0xc8,{'Content-Type':_0x365e84(0x1b0)}),_0x595bda['end'](_0x365e84(0x1c3)),_0x25b50f({'code':_0x5d5d47,'state':_0x4b2918});});_0x382873['on'](_0x3c8ef0(0x1d1),_0x5d3306=>{const _0x4a7667=_0x3c8ef0;_0x5d3306['code']===_0x4a7667(0x19d)?_0x293d26(new Error(_0x4a7667(0x1a2)+OAUTH_CALLBACK_PORT+_0x4a7667(0x1aa))):_0x293d26(new Error(_0x4a7667(0x19a)+_0x5d3306[_0x4a7667(0x1c0)]));}),_0x382873[_0x3c8ef0(0x1a0)](OAUTH_CALLBACK_PORT,_0x3c8ef0(0x1b1));const _0x23a24b=setTimeout(()=>{const _0x3df804=_0x3c8ef0;_0x293d26(new Error(_0x3df804(0x1ad))),_0x382873[_0x3df804(0x1a4)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x150003,'close':()=>{clearTimeout(_0x23a24b),_0x382873['close']();}};}export async function startOAuthFlow(_0x5308ae){const _0x2c7c24=a61_0x271916,_0x7a68dd=getConsoleUrl(_0x5308ae),_0x50f441=getOAuthClientId(),{verifier:_0x4d7c68,challenge:_0xc49c9d}=generatePKCEPair(),_0x35df7c=a61_0x21524d[_0x2c7c24(0x1c5)](0x10)[_0x2c7c24(0x1be)](_0x2c7c24(0x1d0)),_0x1abda3=startLocalCallbackServer();try{const _0x5ba2de=OAUTH_REDIRECT_URI,_0x5a3918=buildAuthorizeURL(_0x7a68dd,{'clientId':_0x50f441,'redirectUri':_0x5ba2de,'state':_0x35df7c,'codeChallenge':_0xc49c9d});openBrowser(_0x5a3918);const _0x2b2db9=await _0x1abda3[_0x2c7c24(0x1bc)]();if(_0x2b2db9[_0x2c7c24(0x1bd)]!==_0x35df7c)throw new Error('OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack');return await exchangeCodeForTokens(_0x7a68dd,_0x2b2db9[_0x2c7c24(0x1b6)],_0x4d7c68,_0x5ba2de);}finally{_0x1abda3[_0x2c7c24(0x1a4)]();}}
1
+ const a62_0x8ea4ea=a62_0x16f3;(function(_0x551fa0,_0x46c028){const _0x48d847=a62_0x16f3,_0x80bcc8=_0x551fa0();while(!![]){try{const _0x17d91f=-parseInt(_0x48d847(0x1ae))/0x1*(parseInt(_0x48d847(0x19f))/0x2)+-parseInt(_0x48d847(0x1c2))/0x3*(parseInt(_0x48d847(0x19d))/0x4)+-parseInt(_0x48d847(0x192))/0x5+parseInt(_0x48d847(0x1ab))/0x6*(parseInt(_0x48d847(0x1b7))/0x7)+-parseInt(_0x48d847(0x195))/0x8+-parseInt(_0x48d847(0x18d))/0x9+parseInt(_0x48d847(0x1c6))/0xa*(parseInt(_0x48d847(0x19c))/0xb);if(_0x17d91f===_0x46c028)break;else _0x80bcc8['push'](_0x80bcc8['shift']());}catch(_0x442c13){_0x80bcc8['push'](_0x80bcc8['shift']());}}}(a62_0x2b1e,0x25c90));import*as a62_0x4a8496 from'node:crypto';import*as a62_0x94acb9 from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';function a62_0x16f3(_0x5612eb,_0x5ddcf4){_0x5612eb=_0x5612eb-0x189;const _0x2b1e95=a62_0x2b1e();let _0x16f33b=_0x2b1e95[_0x5612eb];return _0x16f33b;}const OAUTH_SUPPORTED_SITES=new Set(['dev-us01',a62_0x8ea4ea(0x1b6),'stg-us01','stg-ap01',a62_0x8ea4ea(0x1a6)]);export function isOAuthSupported(_0x1003b2){const _0x46fcb9=a62_0x8ea4ea;return OAUTH_SUPPORTED_SITES[_0x46fcb9(0x1b4)](_0x1003b2);}export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI=a62_0x8ea4ea(0x1a5)+OAUTH_CALLBACK_PORT+a62_0x8ea4ea(0x19b);export function getOAuthClientId(){const _0x95a570=a62_0x8ea4ea;return process.env.TD_OAUTH_CLIENT_ID||_0x95a570(0x1c4);}function a62_0x2b1e(){const _0x540a42=['redirectUri','digest','/oauth/callback','313533HlqtDV','1996eOLqws','POST','60826jUpIHM','error','authorization_code','update','set','url','http://localhost:','stg-ap03','code','close','http://127.0.0.1','message','214116SBOLbE','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack','3aloLas','pathname','EADDRINUSE','client_id','base64url','sha256','has','/oauth/authorize','dev-eu01','28uqwtcf','Not\x20Found','toString','searchParams','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','application/x-www-form-urlencoded','):\x20','clientId','text/plain','text','redirect_uri','1623FyzSbd','createServer','tdx','/oauth/token','370RNIvmJ','end','S256','waitForCallback','state','json','1796967qoxNfI','codeChallenge','scope','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','writeHead','1319615cNsHhP','get','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','1742424GNnOTO','text/html','listen','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20'];a62_0x2b1e=function(){return _0x540a42;};return a62_0x2b1e();}export function generatePKCEPair(){const _0x261cc3=a62_0x8ea4ea,_0x2f2688=a62_0x4a8496['randomBytes'](0x20)['toString']('base64url'),_0x12e689=a62_0x4a8496['createHash'](_0x261cc3(0x1b3))[_0x261cc3(0x1a2)](_0x2f2688)[_0x261cc3(0x19a)](_0x261cc3(0x1b2));return{'verifier':_0x2f2688,'challenge':_0x12e689};}export function buildAuthorizeURL(_0x10971e,_0x500eae){const _0x4f08fb=a62_0x8ea4ea,_0x1235db=new URL(_0x4f08fb(0x1b5),_0x10971e);return _0x1235db[_0x4f08fb(0x1ba)][_0x4f08fb(0x1a3)]('response_type',_0x4f08fb(0x1a7)),_0x1235db[_0x4f08fb(0x1ba)][_0x4f08fb(0x1a3)](_0x4f08fb(0x1b1),_0x500eae[_0x4f08fb(0x1be)]),_0x1235db['searchParams']['set'](_0x4f08fb(0x1c1),_0x500eae[_0x4f08fb(0x199)]),_0x1235db[_0x4f08fb(0x1ba)]['set'](_0x4f08fb(0x18b),_0x500eae[_0x4f08fb(0x18b)]),_0x1235db[_0x4f08fb(0x1ba)][_0x4f08fb(0x1a3)]('code_challenge',_0x500eae[_0x4f08fb(0x18e)]),_0x1235db[_0x4f08fb(0x1ba)]['set']('code_challenge_method',_0x4f08fb(0x189)),_0x500eae[_0x4f08fb(0x18f)]&&_0x1235db[_0x4f08fb(0x1ba)]['set'](_0x4f08fb(0x18f),_0x500eae[_0x4f08fb(0x18f)]),_0x1235db[_0x4f08fb(0x1b9)]();}export async function postTokenRequest(_0x4c7279,_0x3e5a5d){const _0x1649e0=a62_0x8ea4ea,_0x2250bb=new URLSearchParams(_0x3e5a5d)[_0x1649e0(0x1b9)](),_0x765e80=await fetch(_0x4c7279,{'method':_0x1649e0(0x19e),'headers':{'Content-Type':_0x1649e0(0x1bc)},'body':_0x2250bb});if(!_0x765e80['ok']){const _0x583f92=await _0x765e80[_0x1649e0(0x1c0)]();throw new Error('OAuth\x20token\x20request\x20failed\x20('+_0x765e80['status']+_0x1649e0(0x1bd)+_0x583f92);}return await _0x765e80[_0x1649e0(0x18c)]();}export async function exchangeCodeForTokens(_0x3fdc31,_0x1ddee9,_0x5c70a1,_0xc31631){const _0x1032c5=a62_0x8ea4ea,_0x264ca7=_0x3fdc31+_0x1032c5(0x1c5);return postTokenRequest(_0x264ca7,{'grant_type':_0x1032c5(0x1a1),'client_id':getOAuthClientId(),'code':_0x1ddee9,'code_verifier':_0x5c70a1,'redirect_uri':_0xc31631});}export function startLocalCallbackServer(){const _0x447f1e=a62_0x8ea4ea;let _0x873fa7,_0x4ae74e;const _0x4656df=new Promise((_0x4f9e90,_0x4d8efc)=>{_0x873fa7=_0x4f9e90,_0x4ae74e=_0x4d8efc;}),_0x323c38=a62_0x94acb9[_0x447f1e(0x1c3)]((_0x400cab,_0x128760)=>{const _0x535fca=_0x447f1e,_0x3335cd=new URL(_0x400cab[_0x535fca(0x1a4)]||'/',_0x535fca(0x1a9));if(_0x3335cd[_0x535fca(0x1af)]!==_0x535fca(0x19b)){_0x128760[_0x535fca(0x191)](0x194,{'Content-Type':_0x535fca(0x1bf)}),_0x128760[_0x535fca(0x1c7)](_0x535fca(0x1b8));return;}const _0x554338=_0x3335cd[_0x535fca(0x1ba)][_0x535fca(0x193)]('code'),_0x531c4d=_0x3335cd[_0x535fca(0x1ba)][_0x535fca(0x193)](_0x535fca(0x18b)),_0x1e35e3=_0x3335cd[_0x535fca(0x1ba)]['get'](_0x535fca(0x1a0));if(_0x1e35e3||!_0x554338||!_0x531c4d){_0x128760['writeHead'](0x190,{'Content-Type':_0x535fca(0x196)}),_0x128760['end']('<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>'),_0x4ae74e(new Error(_0x535fca(0x190)));return;}_0x128760[_0x535fca(0x191)](0xc8,{'Content-Type':_0x535fca(0x196)}),_0x128760['end'](_0x535fca(0x1ac)),_0x873fa7({'code':_0x554338,'state':_0x531c4d});});_0x323c38['on']('error',_0x26803c=>{const _0x5ee45a=_0x447f1e;_0x26803c[_0x5ee45a(0x1a7)]===_0x5ee45a(0x1b0)?_0x4ae74e(new Error('Port\x20'+OAUTH_CALLBACK_PORT+_0x5ee45a(0x1bb))):_0x4ae74e(new Error(_0x5ee45a(0x198)+_0x26803c[_0x5ee45a(0x1aa)]));}),_0x323c38[_0x447f1e(0x197)](OAUTH_CALLBACK_PORT,'127.0.0.1');const _0x4922a9=setTimeout(()=>{const _0xd1ce0e=_0x447f1e;_0x4ae74e(new Error(_0xd1ce0e(0x194))),_0x323c38[_0xd1ce0e(0x1a8)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x4656df,'close':()=>{const _0x23c913=_0x447f1e;clearTimeout(_0x4922a9),_0x323c38[_0x23c913(0x1a8)]();}};}export async function startOAuthFlow(_0x25680c){const _0x54061f=a62_0x8ea4ea,_0x49c41b=getConsoleUrl(_0x25680c),_0x644554=getOAuthClientId(),{verifier:_0x5ce765,challenge:_0x2e18b2}=generatePKCEPair(),_0x5609c4=a62_0x4a8496['randomBytes'](0x10)[_0x54061f(0x1b9)]('hex'),_0x5b7e1a=startLocalCallbackServer();try{const _0x380061=OAUTH_REDIRECT_URI,_0x2805c7=buildAuthorizeURL(_0x49c41b,{'clientId':_0x644554,'redirectUri':_0x380061,'state':_0x5609c4,'codeChallenge':_0x2e18b2});openBrowser(_0x2805c7);const _0x30420d=await _0x5b7e1a[_0x54061f(0x18a)]();if(_0x30420d[_0x54061f(0x18b)]!==_0x5609c4)throw new Error(_0x54061f(0x1ad));return await exchangeCodeForTokens(_0x49c41b,_0x30420d[_0x54061f(0x1a7)],_0x5ce765,_0x380061);}finally{_0x5b7e1a[_0x54061f(0x1a8)]();}}
@@ -1 +1 @@
1
- const a62_0x12c943=a62_0x5319;(function(_0x1019cf,_0xda144b){const _0x1ad6a8=a62_0x5319,_0x50a1df=_0x1019cf();while(!![]){try{const _0x565f81=-parseInt(_0x1ad6a8(0x157))/0x1+parseInt(_0x1ad6a8(0x19c))/0x2*(-parseInt(_0x1ad6a8(0x17f))/0x3)+parseInt(_0x1ad6a8(0x198))/0x4*(-parseInt(_0x1ad6a8(0x1a0))/0x5)+parseInt(_0x1ad6a8(0x176))/0x6*(parseInt(_0x1ad6a8(0x163))/0x7)+-parseInt(_0x1ad6a8(0x15a))/0x8*(parseInt(_0x1ad6a8(0x194))/0x9)+-parseInt(_0x1ad6a8(0x18a))/0xa*(-parseInt(_0x1ad6a8(0x18f))/0xb)+-parseInt(_0x1ad6a8(0x164))/0xc*(parseInt(_0x1ad6a8(0x18e))/0xd);if(_0x565f81===_0xda144b)break;else _0x50a1df['push'](_0x50a1df['shift']());}catch(_0x40bd40){_0x50a1df['push'](_0x50a1df['shift']());}}}(a62_0x272c,0xc8192));import*as a62_0x3fa0a7 from'node:fs';import*as a62_0x1afde8 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=a62_0x12c943(0x1a1);export function getProfileParams(_0xfb80dd){const _0x5b5bd1=a62_0x12c943,_0x4fe07b={};if(!_0xfb80dd)return _0x4fe07b;for(const [_0x2d2403,_0x4ec3fc]of Object[_0x5b5bd1(0x169)](_0xfb80dd)){_0x2d2403!==_0x5b5bd1(0x16f)&&_0x4ec3fc!==undefined&&(_0x4fe07b[_0x2d2403]=_0x4ec3fc);}return _0x4fe07b;}export function getProfilesDir(){const _0xc3c128=a62_0x12c943;return a62_0x1afde8[_0xc3c128(0x15d)](getConfigDir(),_0xc3c128(0x19d));}function a62_0x5319(_0x2f4cfa,_0x29e5c4){_0x2f4cfa=_0x2f4cfa-0x14f;const _0x272ca4=a62_0x272c();let _0x5319fa=_0x272ca4[_0x2f4cfa];return _0x5319fa;}function getProfileDir(_0x33ffd9){const _0x12b79c=a62_0x12c943;return a62_0x1afde8[_0x12b79c(0x15d)](getProfilesDir(),_0x33ffd9);}function a62_0x272c(){const _0x2a4c98=['site',',\x20creating\x20new\x20file','has','existsSync','16204250HkBHZq','length','llm_project','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','3581734fQBCDE','11TxLUZY','set','warn','isDirectory','string','50769tuEXJR','user','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','\x27:\x20unknown\x20config\x20key\x20\x27','12FYZLBf','database','readFileSync','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','2tfGtnG','profiles','\x27\x20will\x20be\x20ignored','directory','25595pwlrQN','@tdx-studio','parse','user_info','push','object','tdx.json','.env.','\x22\x20\x22','test','Error:\x20','values','\x0aWarning:\x20Failed\x20to\x20parse\x20','localeCompare','3878Xwlxco','\x27\x20not\x20found\x20in\x20user\x20configuration','Profile\x20','24kFDJhS','Failed\x20to\x20parse\x20','stringify','join','utf-8','Warning:\x20Profile\x20\x27','INVALID_PROFILE_CONFIG','llm_agent','name','39137aEzJNm','12xaAkZt','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','from','entries','map',':\x20Invalid\x20JSON\x20syntax','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','description','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','find','readdirSync','.env','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','toISOString','114MiOtqy','sort','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','Profile\x20\x27','Invalid\x20profile\x20name:\x20','To\x20migrate:','filter','parent_segment','profile','1786128EDXeyx','Warning:\x20Failed\x20to\x20parse\x20','\x20does\x20not\x20exist','includes','\x20\x20mv\x20\x22','keys','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string'];a62_0x272c=function(){return _0x2a4c98;};return a62_0x272c();}function getProfileConfigPath(_0x43dce7){const _0x4a9f8b=a62_0x12c943;return a62_0x1afde8['join'](getProfileDir(_0x43dce7),_0x4a9f8b(0x14f));}function getProfileEnvPath(_0x50080f){return a62_0x1afde8['join'](getProfileDir(_0x50080f),'.env');}function getGlobalConfigPath(){return a62_0x1afde8['join'](getConfigDir(),'tdx.json');}function validateProfileName(_0x2bf95d){const _0x5f0e21=a62_0x12c943;if(/^@?[a-zA-Z0-9_-]+$/[_0x5f0e21(0x152)](_0x2bf95d))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x5f0e21(0x152)](_0x2bf95d))return;throw new Error(_0x5f0e21(0x17a)+_0x2bf95d+_0x5f0e21(0x18d));}function validateProfileConfig(_0x216a63,_0xfc7389){const _0x54ecae=a62_0x12c943;if(typeof _0x216a63!=='object'||_0x216a63===null)throw new SDKError(ErrorCode[_0x54ecae(0x160)],_0x54ecae(0x179)+_0xfc7389+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0xaecf00=[_0x54ecae(0x16f),_0x54ecae(0x186),_0x54ecae(0x199),_0x54ecae(0x17d),_0x54ecae(0x18c),'llm_agent',_0x54ecae(0x1a3)],_0x59cfa9=_0x216a63;for(const _0x206229 of Object[_0x54ecae(0x184)](_0x59cfa9)){!_0xaecf00[_0x54ecae(0x182)](_0x206229)&&console[_0x54ecae(0x191)](_0x54ecae(0x15f)+_0xfc7389+_0x54ecae(0x197)+_0x206229+_0x54ecae(0x19e));}if(_0x59cfa9[_0x54ecae(0x16f)]!==undefined&&typeof _0x59cfa9[_0x54ecae(0x16f)]!==_0x54ecae(0x193))throw new SDKError(ErrorCode[_0x54ecae(0x160)],_0x54ecae(0x179)+_0xfc7389+_0x54ecae(0x165));if(_0x59cfa9[_0x54ecae(0x186)]!==undefined&&typeof _0x59cfa9[_0x54ecae(0x186)]!=='string')throw new SDKError(ErrorCode[_0x54ecae(0x160)],'Profile\x20\x27'+_0xfc7389+_0x54ecae(0x16e));if(_0x59cfa9[_0x54ecae(0x199)]!==undefined&&typeof _0x59cfa9[_0x54ecae(0x199)]!==_0x54ecae(0x193))throw new SDKError(ErrorCode[_0x54ecae(0x160)],_0x54ecae(0x179)+_0xfc7389+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x59cfa9[_0x54ecae(0x17d)]!==undefined&&typeof _0x59cfa9['parent_segment']!=='string')throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0xfc7389+_0x54ecae(0x174));if(_0x59cfa9[_0x54ecae(0x18c)]!==undefined&&typeof _0x59cfa9['llm_project']!==_0x54ecae(0x193))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0xfc7389+_0x54ecae(0x16c));if(_0x59cfa9[_0x54ecae(0x161)]!==undefined&&typeof _0x59cfa9[_0x54ecae(0x161)]!==_0x54ecae(0x193))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x54ecae(0x179)+_0xfc7389+_0x54ecae(0x185));return!![];}function loadProfilesFromTdxJson(_0x52ffcd,_0x58bb0b){const _0x3a3683=a62_0x12c943;if(!a62_0x3fa0a7[_0x3a3683(0x189)](_0x52ffcd))return[];try{const _0x44fe4f=a62_0x3fa0a7[_0x3a3683(0x19a)](_0x52ffcd,_0x3a3683(0x15e)),_0x2928ac=JSON[_0x3a3683(0x1a2)](_0x44fe4f);if(!_0x2928ac[_0x3a3683(0x19d)]||typeof _0x2928ac[_0x3a3683(0x19d)]!==_0x3a3683(0x1a5))return[];const _0x1c249b=[];for(const [_0x320f8c,_0x5e724a]of Object[_0x3a3683(0x169)](_0x2928ac[_0x3a3683(0x19d)])){try{validateProfileConfig(_0x5e724a,_0x320f8c);const _0x480023=getNewCredentialPath(_0x320f8c),_0x1ae1a2=getOldCredentialPath(_0x320f8c),_0x123ccc=a62_0x3fa0a7[_0x3a3683(0x189)](_0x480023)||a62_0x3fa0a7[_0x3a3683(0x189)](_0x1ae1a2);_0x1c249b[_0x3a3683(0x1a4)]({'name':_0x320f8c,'config':_0x5e724a,'metadata':{'name':_0x320f8c,'createdAt':new Date()[_0x3a3683(0x175)]()},'hasCredentials':_0x123ccc,'scope':_0x58bb0b});}catch(_0x141b16){_0x141b16 instanceof Error&&(console['warn'](_0x3a3683(0x19b)+_0x52ffcd+':'),console[_0x3a3683(0x191)]('\x20\x20'+_0x141b16['message']+'\x0a'));}}return _0x1c249b;}catch(_0x112aa0){return _0x112aa0 instanceof SyntaxError?(console[_0x3a3683(0x191)](_0x3a3683(0x155)+_0x52ffcd+_0x3a3683(0x16b)),console[_0x3a3683(0x191)](_0x3a3683(0x153)+_0x112aa0['message']+'\x0a')):console[_0x3a3683(0x191)](_0x3a3683(0x167)+_0x52ffcd+':\x20'+_0x112aa0+'\x0a'),[];}}export function getNewCredentialPath(_0x490458){const _0x27fe8e=a62_0x12c943;return a62_0x1afde8['join'](getConfigDir(),_0x27fe8e(0x150)+_0x490458);}function getOldCredentialPath(_0x1c9018){const _0x1b419f=a62_0x12c943;return a62_0x1afde8[_0x1b419f(0x15d)](getProfilesDir(),_0x1c9018,_0x1b419f(0x173));}function loadProfilesFromTdxJsonFiles(){const _0xc54644=a62_0x12c943,_0x38f494=[],_0x26b357=findProjectConfigPath();_0x26b357&&_0x38f494[_0xc54644(0x1a4)](...loadProfilesFromTdxJson(_0x26b357,'local'));const _0x1a53cb=a62_0x1afde8[_0xc54644(0x15d)](getConfigDir(),_0xc54644(0x14f));return _0x38f494[_0xc54644(0x1a4)](...loadProfilesFromTdxJson(_0x1a53cb,_0xc54644(0x195))),_0x38f494;}function loadProfilesFromDirectories(){const _0xc13d31=a62_0x12c943,_0x111b87=getProfilesDir();if(!a62_0x3fa0a7[_0xc13d31(0x189)](_0x111b87))return[];try{return a62_0x3fa0a7[_0xc13d31(0x172)](_0x111b87,{'withFileTypes':!![]})[_0xc13d31(0x17c)](_0xee6f42=>_0xee6f42[_0xc13d31(0x192)]())[_0xc13d31(0x16a)](_0x26d962=>_0x26d962[_0xc13d31(0x162)])[_0xc13d31(0x17c)](_0x20a313=>{const _0x5ddd37=_0xc13d31,_0x4ad775=getProfileConfigPath(_0x20a313),_0x16c4f8=getProfileEnvPath(_0x20a313);return a62_0x3fa0a7['existsSync'](_0x4ad775)||a62_0x3fa0a7[_0x5ddd37(0x189)](_0x16c4f8);})[_0xc13d31(0x16a)](_0x29d1b1=>{const _0x458db2=_0xc13d31,_0x177405=loadProfileFromDirectory(_0x29d1b1);if(_0x177405)return{..._0x177405,'scope':_0x458db2(0x19f)};return null;})[_0xc13d31(0x17c)](_0x5211da=>_0x5211da!==null);}catch{return[];}}function loadProfileFromDirectory(_0x4320a3){const _0x29739b=a62_0x12c943,_0xfe9e98=getProfileConfigPath(_0x4320a3),_0x499288=getOldCredentialPath(_0x4320a3);if(!a62_0x3fa0a7[_0x29739b(0x189)](_0xfe9e98)&&!a62_0x3fa0a7[_0x29739b(0x189)](_0x499288))return null;let _0x397911={},_0x1febcc={'name':_0x4320a3,'createdAt':new Date()[_0x29739b(0x175)]()};if(a62_0x3fa0a7[_0x29739b(0x189)](_0xfe9e98))try{const _0x30e150=a62_0x3fa0a7[_0x29739b(0x19a)](_0xfe9e98,_0x29739b(0x15e)),_0x1d3f8d=JSON[_0x29739b(0x1a2)](_0x30e150),{metadata:_0x48bed2,..._0x7dc93c}=_0x1d3f8d;_0x397911=_0x7dc93c,_0x48bed2&&(_0x1febcc=_0x48bed2);}catch{}return{'name':_0x4320a3,'config':_0x397911,'metadata':_0x1febcc,'hasCredentials':a62_0x3fa0a7[_0x29739b(0x189)](_0x499288),'scope':_0x29739b(0x19f)};}export function listProfiles(){const _0x2ffe3b=a62_0x12c943,_0x446687=loadProfilesFromTdxJsonFiles(),_0x4edbf6=loadProfilesFromDirectories();if(_0x4edbf6[_0x2ffe3b(0x18b)]>0x0){const _0x914fe4=_0x4edbf6['map'](_0x511ebc=>_0x511ebc[_0x2ffe3b(0x162)])[_0x2ffe3b(0x15d)](',\x20'),_0x3bc943=getConfigDir();console['warn'](_0x2ffe3b(0x166)+_0x914fe4),console[_0x2ffe3b(0x191)](_0x2ffe3b(0x170)),console[_0x2ffe3b(0x191)]('\x20\x201.\x20Edit:\x20'+a62_0x1afde8[_0x2ffe3b(0x15d)](_0x3bc943,_0x2ffe3b(0x14f))),console[_0x2ffe3b(0x191)](_0x2ffe3b(0x16d)),console['warn'](_0x2ffe3b(0x196));}const _0x39aa07=[..._0x446687,..._0x4edbf6],_0x59226f=new Map();for(const _0x192b1b of _0x39aa07){!_0x59226f[_0x2ffe3b(0x188)](_0x192b1b[_0x2ffe3b(0x162)])&&_0x59226f[_0x2ffe3b(0x190)](_0x192b1b[_0x2ffe3b(0x162)],_0x192b1b);}return Array[_0x2ffe3b(0x168)](_0x59226f[_0x2ffe3b(0x154)]())[_0x2ffe3b(0x177)]((_0x27c8b5,_0x4c47ff)=>_0x27c8b5[_0x2ffe3b(0x162)][_0x2ffe3b(0x156)](_0x4c47ff[_0x2ffe3b(0x162)]));}export function profileExists(_0x383b56){const _0x156b22=a62_0x12c943,_0x115c4d=listProfiles();return _0x115c4d['some'](_0x47a37f=>_0x47a37f[_0x156b22(0x162)]===_0x383b56);}export function loadProfile(_0x4acf73){const _0x46ed94=a62_0x12c943;validateProfileName(_0x4acf73);const _0x3d28d5=listProfiles(),_0x55c497=_0x3d28d5[_0x46ed94(0x171)](_0x54576d=>_0x54576d[_0x46ed94(0x162)]===_0x4acf73);return _0x55c497||null;}export function saveProfile(_0x24e00a,_0x58c400,_0x1a2e41=![]){saveProfileToUserConfig(_0x24e00a,_0x58c400);}export function deleteProfile(_0x10585c){const _0x507889=a62_0x12c943;validateProfileName(_0x10585c);const _0x49c454=getProfileDir(_0x10585c);if(!a62_0x3fa0a7[_0x507889(0x189)](_0x49c454))throw new Error(_0x507889(0x159)+_0x10585c+_0x507889(0x181));a62_0x3fa0a7['rmSync'](_0x49c454,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x1d23e2,_0x254d18){const _0x2320a0=a62_0x12c943;validateProfileName(_0x1d23e2);const _0x4cd05d=getGlobalConfigPath(),_0x4fcdd0=getConfigDir();!a62_0x3fa0a7[_0x2320a0(0x189)](_0x4fcdd0)&&createSecureDirectory(_0x4fcdd0);let _0xa9458e={};if(a62_0x3fa0a7['existsSync'](_0x4cd05d))try{const _0x45fb59=a62_0x3fa0a7['readFileSync'](_0x4cd05d,_0x2320a0(0x15e));_0xa9458e=JSON[_0x2320a0(0x1a2)](_0x45fb59);}catch{console[_0x2320a0(0x191)](_0x2320a0(0x180)+_0x4cd05d+_0x2320a0(0x187));}!_0xa9458e[_0x2320a0(0x19d)]&&(_0xa9458e[_0x2320a0(0x19d)]={}),_0xa9458e['profiles'][_0x1d23e2]=_0x254d18,writeSecureFile(_0x4cd05d,JSON[_0x2320a0(0x15c)](_0xa9458e,null,0x2));}export function removeProfileFromUserConfig(_0xe6d263){const _0x5cb2a1=a62_0x12c943;validateProfileName(_0xe6d263);const _0x371258=getGlobalConfigPath();if(!a62_0x3fa0a7[_0x5cb2a1(0x189)](_0x371258))throw new Error(_0x5cb2a1(0x179)+_0xe6d263+'\x27\x20not\x20found\x20in\x20user\x20configuration');let _0x53af8d={};try{const _0x15b326=a62_0x3fa0a7[_0x5cb2a1(0x19a)](_0x371258,'utf-8');_0x53af8d=JSON[_0x5cb2a1(0x1a2)](_0x15b326);}catch{throw new Error(_0x5cb2a1(0x15b)+_0x371258);}if(!_0x53af8d[_0x5cb2a1(0x19d)]||!_0x53af8d[_0x5cb2a1(0x19d)][_0xe6d263])throw new Error(_0x5cb2a1(0x179)+_0xe6d263+_0x5cb2a1(0x158));delete _0x53af8d[_0x5cb2a1(0x19d)][_0xe6d263],_0x53af8d['profile']===_0xe6d263&&delete _0x53af8d[_0x5cb2a1(0x17e)],writeSecureFile(_0x371258,JSON[_0x5cb2a1(0x15c)](_0x53af8d,null,0x2));}export function getActiveProfile(){const _0x52853a=a62_0x12c943,_0x32ab60=loadSessionContext();if(_0x32ab60?.[_0x52853a(0x17e)])return _0x32ab60[_0x52853a(0x17e)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x51b0be=getGlobalConfigPath();if(!a62_0x3fa0a7[_0x52853a(0x189)](_0x51b0be))return null;try{const _0x2e1419=a62_0x3fa0a7[_0x52853a(0x19a)](_0x51b0be,_0x52853a(0x15e)),_0x5975be=JSON['parse'](_0x2e1419);return _0x5975be[_0x52853a(0x17e)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x164a26){const _0x32a46a=a62_0x12c943,_0x7fbaf0=getGlobalConfigPath(),_0x4a1d4a=getConfigDir();!a62_0x3fa0a7['existsSync'](_0x4a1d4a)&&createSecureDirectory(_0x4a1d4a);let _0x44dc4b={};if(a62_0x3fa0a7[_0x32a46a(0x189)](_0x7fbaf0))try{const _0xa94b6=a62_0x3fa0a7[_0x32a46a(0x19a)](_0x7fbaf0,_0x32a46a(0x15e));_0x44dc4b=JSON[_0x32a46a(0x1a2)](_0xa94b6);}catch{console[_0x32a46a(0x191)](_0x32a46a(0x180)+_0x7fbaf0+_0x32a46a(0x187));}_0x44dc4b[_0x32a46a(0x186)]=_0x164a26,writeSecureFile(_0x7fbaf0,JSON['stringify'](_0x44dc4b,null,0x2));}export function saveActiveProfileToUserConfig(_0x903268){const _0x381486=a62_0x12c943;validateProfileName(_0x903268);const _0x4c40a6=getGlobalConfigPath(),_0x1f7ec3=getConfigDir();!a62_0x3fa0a7[_0x381486(0x189)](_0x1f7ec3)&&createSecureDirectory(_0x1f7ec3);let _0x517eb0={};if(a62_0x3fa0a7[_0x381486(0x189)](_0x4c40a6))try{const _0x1e073e=a62_0x3fa0a7['readFileSync'](_0x4c40a6,'utf-8');_0x517eb0=JSON[_0x381486(0x1a2)](_0x1e073e);}catch{console[_0x381486(0x191)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x4c40a6+_0x381486(0x187));}_0x517eb0[_0x381486(0x17e)]=_0x903268,writeSecureFile(_0x4c40a6,JSON[_0x381486(0x15c)](_0x517eb0,null,0x2));}function clearFieldFromUserConfig(_0x3f310f){const _0x2c16e0=a62_0x12c943,_0x100b6=getGlobalConfigPath();if(!a62_0x3fa0a7['existsSync'](_0x100b6))return;let _0x3bdae7={};try{const _0x4cd971=a62_0x3fa0a7[_0x2c16e0(0x19a)](_0x100b6,_0x2c16e0(0x15e));_0x3bdae7=JSON[_0x2c16e0(0x1a2)](_0x4cd971);}catch{return;}delete _0x3bdae7[_0x3f310f],writeSecureFile(_0x100b6,JSON[_0x2c16e0(0x15c)](_0x3bdae7,null,0x2));}export function clearDefaultSiteFromUserConfig(){clearFieldFromUserConfig('site');}export function clearActiveProfileFromUserConfig(){const _0x16b0b7=a62_0x12c943;clearFieldFromUserConfig(_0x16b0b7(0x17e));}export function createProfile(_0x55deb5,_0x2ab87e){const _0x21d79f=a62_0x12c943;validateProfileName(_0x55deb5);if(profileExists(_0x55deb5))throw new Error(_0x21d79f(0x159)+_0x55deb5+'\x20already\x20exists');saveProfile(_0x55deb5,_0x2ab87e);}export function saveProfileCredentials(_0x2b6f49,_0x31912b){const _0x451950=a62_0x12c943;validateProfileName(_0x2b6f49);if(!profileExists(_0x2b6f49))throw new Error(_0x451950(0x159)+_0x2b6f49+_0x451950(0x181));const _0x812e1=getNewCredentialPath(_0x2b6f49);writeSecureFile(_0x812e1,_0x31912b);}export function loadProfileCredentials(_0x2fe783){const _0x898afc=a62_0x12c943;validateProfileName(_0x2fe783);const _0x52930a=getNewCredentialPath(_0x2fe783);if(a62_0x3fa0a7['existsSync'](_0x52930a))try{return a62_0x3fa0a7['readFileSync'](_0x52930a,_0x898afc(0x15e));}catch{}const _0x58a121=getOldCredentialPath(_0x2fe783);if(a62_0x3fa0a7[_0x898afc(0x189)](_0x58a121)){console[_0x898afc(0x191)]('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x2fe783+'\x27'),console['warn'](_0x898afc(0x17b)),console[_0x898afc(0x191)](_0x898afc(0x183)+_0x58a121+_0x898afc(0x151)+_0x52930a+'\x22'),console[_0x898afc(0x191)](_0x898afc(0x178));try{return a62_0x3fa0a7[_0x898afc(0x19a)](_0x58a121,'utf-8');}catch{return null;}}return null;}
1
+ (function(_0x27eb54,_0x3a46be){const _0x281863=a63_0x18a8,_0x2b5017=_0x27eb54();while(!![]){try{const _0x366915=-parseInt(_0x281863(0x16c))/0x1+-parseInt(_0x281863(0x17f))/0x2+parseInt(_0x281863(0x1b5))/0x3*(parseInt(_0x281863(0x183))/0x4)+parseInt(_0x281863(0x1aa))/0x5*(parseInt(_0x281863(0x176))/0x6)+-parseInt(_0x281863(0x174))/0x7*(-parseInt(_0x281863(0x177))/0x8)+parseInt(_0x281863(0x17a))/0x9+-parseInt(_0x281863(0x1a2))/0xa;if(_0x366915===_0x3a46be)break;else _0x2b5017['push'](_0x2b5017['shift']());}catch(_0x390ada){_0x2b5017['push'](_0x2b5017['shift']());}}}(a63_0x1831,0x47e1a));import*as a63_0xb80dc1 from'node:fs';import*as a63_0x3e1566 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='@tdx-studio';export function getProfileParams(_0x5016f8){const _0x4f2af4=a63_0x18a8,_0x774ef9={};if(!_0x5016f8)return _0x774ef9;for(const [_0x32bd14,_0x391e7f]of Object[_0x4f2af4(0x192)](_0x5016f8)){_0x32bd14!=='description'&&_0x391e7f!==undefined&&(_0x774ef9[_0x32bd14]=_0x391e7f);}return _0x774ef9;}export function getProfilesDir(){const _0x33ed9c=a63_0x18a8;return a63_0x3e1566['join'](getConfigDir(),_0x33ed9c(0x1b2));}function getProfileDir(_0x3ae7fe){return a63_0x3e1566['join'](getProfilesDir(),_0x3ae7fe);}function getProfileConfigPath(_0x48afad){const _0x14cb53=a63_0x18a8;return a63_0x3e1566[_0x14cb53(0x1ab)](getProfileDir(_0x48afad),_0x14cb53(0x178));}function getProfileEnvPath(_0x12fe24){const _0x3e9c09=a63_0x18a8;return a63_0x3e1566[_0x3e9c09(0x1ab)](getProfileDir(_0x12fe24),'.env');}function getGlobalConfigPath(){const _0x4b809c=a63_0x18a8;return a63_0x3e1566[_0x4b809c(0x1ab)](getConfigDir(),_0x4b809c(0x178));}function validateProfileName(_0x2decbb){const _0x48a7e0=a63_0x18a8;if(/^@?[a-zA-Z0-9_-]+$/[_0x48a7e0(0x19c)](_0x2decbb))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/['test'](_0x2decbb))return;throw new Error(_0x48a7e0(0x1a1)+_0x2decbb+_0x48a7e0(0x181));}function validateProfileConfig(_0x59fa16,_0x27e4d4){const _0x4449c4=a63_0x18a8;if(typeof _0x59fa16!==_0x4449c4(0x16d)||_0x59fa16===null)throw new SDKError(ErrorCode[_0x4449c4(0x1b7)],'Profile\x20\x27'+_0x27e4d4+_0x4449c4(0x172));const _0x57a16c=[_0x4449c4(0x194),_0x4449c4(0x1b3),'database',_0x4449c4(0x1a7),_0x4449c4(0x1b0),_0x4449c4(0x17c),_0x4449c4(0x18b)],_0x3a96de=_0x59fa16;for(const _0xb4f165 of Object[_0x4449c4(0x17d)](_0x3a96de)){!_0x57a16c['includes'](_0xb4f165)&&console['warn'](_0x4449c4(0x16b)+_0x27e4d4+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0xb4f165+_0x4449c4(0x19a));}if(_0x3a96de[_0x4449c4(0x194)]!==undefined&&typeof _0x3a96de[_0x4449c4(0x194)]!==_0x4449c4(0x18a))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x27e4d4+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x3a96de[_0x4449c4(0x1b3)]!==undefined&&typeof _0x3a96de['site']!==_0x4449c4(0x18a))throw new SDKError(ErrorCode[_0x4449c4(0x1b7)],_0x4449c4(0x16f)+_0x27e4d4+_0x4449c4(0x196));if(_0x3a96de[_0x4449c4(0x193)]!==undefined&&typeof _0x3a96de[_0x4449c4(0x193)]!==_0x4449c4(0x18a))throw new SDKError(ErrorCode[_0x4449c4(0x1b7)],'Profile\x20\x27'+_0x27e4d4+_0x4449c4(0x187));if(_0x3a96de['parent_segment']!==undefined&&typeof _0x3a96de[_0x4449c4(0x1a7)]!==_0x4449c4(0x18a))throw new SDKError(ErrorCode[_0x4449c4(0x1b7)],_0x4449c4(0x16f)+_0x27e4d4+_0x4449c4(0x1b8));if(_0x3a96de[_0x4449c4(0x1b0)]!==undefined&&typeof _0x3a96de[_0x4449c4(0x1b0)]!==_0x4449c4(0x18a))throw new SDKError(ErrorCode[_0x4449c4(0x1b7)],_0x4449c4(0x16f)+_0x27e4d4+_0x4449c4(0x19f));if(_0x3a96de[_0x4449c4(0x17c)]!==undefined&&typeof _0x3a96de[_0x4449c4(0x17c)]!==_0x4449c4(0x18a))throw new SDKError(ErrorCode[_0x4449c4(0x1b7)],_0x4449c4(0x16f)+_0x27e4d4+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x590c65,_0x16be9e){const _0x285351=a63_0x18a8;if(!a63_0xb80dc1[_0x285351(0x189)](_0x590c65))return[];try{const _0x59cfc6=a63_0xb80dc1['readFileSync'](_0x590c65,_0x285351(0x1a0)),_0x1c79d8=JSON['parse'](_0x59cfc6);if(!_0x1c79d8[_0x285351(0x1b2)]||typeof _0x1c79d8['profiles']!==_0x285351(0x16d))return[];const _0x4d4a97=[];for(const [_0x432fc2,_0x2d6c8b]of Object['entries'](_0x1c79d8[_0x285351(0x1b2)])){try{validateProfileConfig(_0x2d6c8b,_0x432fc2);const _0x291b53=getNewCredentialPath(_0x432fc2),_0x374eeb=getOldCredentialPath(_0x432fc2),_0x2a4272=a63_0xb80dc1[_0x285351(0x189)](_0x291b53)||a63_0xb80dc1['existsSync'](_0x374eeb);_0x4d4a97['push']({'name':_0x432fc2,'config':_0x2d6c8b,'metadata':{'name':_0x432fc2,'createdAt':new Date()[_0x285351(0x180)]()},'hasCredentials':_0x2a4272,'scope':_0x16be9e});}catch(_0x820e3){_0x820e3 instanceof Error&&(console['warn']('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x590c65+':'),console[_0x285351(0x179)]('\x20\x20'+_0x820e3[_0x285351(0x190)]+'\x0a'));}}return _0x4d4a97;}catch(_0x266567){return _0x266567 instanceof SyntaxError?(console[_0x285351(0x179)](_0x285351(0x18e)+_0x590c65+_0x285351(0x1a4)),console[_0x285351(0x179)]('Error:\x20'+_0x266567[_0x285351(0x190)]+'\x0a')):console[_0x285351(0x179)](_0x285351(0x18f)+_0x590c65+':\x20'+_0x266567+'\x0a'),[];}}export function getNewCredentialPath(_0x6001a0){const _0x3b87b5=a63_0x18a8;return a63_0x3e1566[_0x3b87b5(0x1ab)](getConfigDir(),_0x3b87b5(0x1a6)+_0x6001a0);}function getOldCredentialPath(_0x106f43){const _0x5d7613=a63_0x18a8;return a63_0x3e1566[_0x5d7613(0x1ab)](getProfilesDir(),_0x106f43,'.env');}function loadProfilesFromTdxJsonFiles(){const _0x3f0432=a63_0x18a8,_0x29e85f=[],_0x27cf13=findProjectConfigPath();_0x27cf13&&_0x29e85f[_0x3f0432(0x1ad)](...loadProfilesFromTdxJson(_0x27cf13,_0x3f0432(0x1af)));const _0x4e6563=a63_0x3e1566[_0x3f0432(0x1ab)](getConfigDir(),'tdx.json');return _0x29e85f['push'](...loadProfilesFromTdxJson(_0x4e6563,_0x3f0432(0x1b6))),_0x29e85f;}function loadProfilesFromDirectories(){const _0x41498c=a63_0x18a8,_0x5b58a6=getProfilesDir();if(!a63_0xb80dc1[_0x41498c(0x189)](_0x5b58a6))return[];try{return a63_0xb80dc1[_0x41498c(0x19d)](_0x5b58a6,{'withFileTypes':!![]})[_0x41498c(0x16e)](_0x322494=>_0x322494['isDirectory']())[_0x41498c(0x17e)](_0x1b35ee=>_0x1b35ee[_0x41498c(0x184)])[_0x41498c(0x16e)](_0x444a29=>{const _0x31b133=_0x41498c,_0x1031db=getProfileConfigPath(_0x444a29),_0xd4256a=getProfileEnvPath(_0x444a29);return a63_0xb80dc1[_0x31b133(0x189)](_0x1031db)||a63_0xb80dc1[_0x31b133(0x189)](_0xd4256a);})[_0x41498c(0x17e)](_0x11ce99=>{const _0x5f764e=loadProfileFromDirectory(_0x11ce99);if(_0x5f764e)return{..._0x5f764e,'scope':'directory'};return null;})[_0x41498c(0x16e)](_0x5a9640=>_0x5a9640!==null);}catch{return[];}}function a63_0x18a8(_0x379a7f,_0x4633f6){_0x379a7f=_0x379a7f-0x16b;const _0x183153=a63_0x1831();let _0x18a8f6=_0x183153[_0x379a7f];return _0x18a8f6;}function loadProfileFromDirectory(_0x3b2463){const _0x30a7b7=a63_0x18a8,_0x425eeb=getProfileConfigPath(_0x3b2463),_0x974814=getOldCredentialPath(_0x3b2463);if(!a63_0xb80dc1[_0x30a7b7(0x189)](_0x425eeb)&&!a63_0xb80dc1[_0x30a7b7(0x189)](_0x974814))return null;let _0x16d2e7={},_0xe556ac={'name':_0x3b2463,'createdAt':new Date()[_0x30a7b7(0x180)]()};if(a63_0xb80dc1['existsSync'](_0x425eeb))try{const _0x23c8a9=a63_0xb80dc1[_0x30a7b7(0x1a3)](_0x425eeb,'utf-8'),_0x487619=JSON[_0x30a7b7(0x1ac)](_0x23c8a9),{metadata:_0x3c156b,..._0x10a729}=_0x487619;_0x16d2e7=_0x10a729,_0x3c156b&&(_0xe556ac=_0x3c156b);}catch{}return{'name':_0x3b2463,'config':_0x16d2e7,'metadata':_0xe556ac,'hasCredentials':a63_0xb80dc1['existsSync'](_0x974814),'scope':_0x30a7b7(0x170)};}export function listProfiles(){const _0x5b248f=a63_0x18a8,_0x5131fe=loadProfilesFromTdxJsonFiles(),_0x523583=loadProfilesFromDirectories();if(_0x523583[_0x5b248f(0x185)]>0x0){const _0x5951e5=_0x523583[_0x5b248f(0x17e)](_0x5d5861=>_0x5d5861[_0x5b248f(0x184)])[_0x5b248f(0x1ab)](',\x20'),_0x37f15c=getConfigDir();console[_0x5b248f(0x179)](_0x5b248f(0x171)+_0x5951e5),console['warn']('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console['warn']('\x20\x201.\x20Edit:\x20'+a63_0x3e1566[_0x5b248f(0x1ab)](_0x37f15c,_0x5b248f(0x178))),console[_0x5b248f(0x179)](_0x5b248f(0x195)),console[_0x5b248f(0x179)](_0x5b248f(0x1a9));}const _0x1d40c2=[..._0x5131fe,..._0x523583],_0x3af011=new Map();for(const _0x435da4 of _0x1d40c2){!_0x3af011[_0x5b248f(0x19e)](_0x435da4[_0x5b248f(0x184)])&&_0x3af011[_0x5b248f(0x1a8)](_0x435da4[_0x5b248f(0x184)],_0x435da4);}return Array[_0x5b248f(0x18d)](_0x3af011[_0x5b248f(0x173)]())[_0x5b248f(0x1b1)]((_0xad7ff4,_0x5dd0cb)=>_0xad7ff4[_0x5b248f(0x184)]['localeCompare'](_0x5dd0cb[_0x5b248f(0x184)]));}export function profileExists(_0x220613){const _0x40934b=a63_0x18a8,_0x4b0f44=listProfiles();return _0x4b0f44['some'](_0x4758eb=>_0x4758eb[_0x40934b(0x184)]===_0x220613);}export function loadProfile(_0x3a1a8b){const _0x1e4db3=a63_0x18a8;validateProfileName(_0x3a1a8b);const _0x2ff7d5=listProfiles(),_0x1a0176=_0x2ff7d5[_0x1e4db3(0x188)](_0x552c2c=>_0x552c2c[_0x1e4db3(0x184)]===_0x3a1a8b);return _0x1a0176||null;}export function saveProfile(_0x292349,_0x475e28,_0x1f8333=![]){saveProfileToUserConfig(_0x292349,_0x475e28);}export function deleteProfile(_0x236d78){const _0x32aef9=a63_0x18a8;validateProfileName(_0x236d78);const _0x461032=getProfileDir(_0x236d78);if(!a63_0xb80dc1[_0x32aef9(0x189)](_0x461032))throw new Error('Profile\x20'+_0x236d78+_0x32aef9(0x199));a63_0xb80dc1[_0x32aef9(0x175)](_0x461032,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x5edda1,_0x43e660){const _0x3466ee=a63_0x18a8;validateProfileName(_0x5edda1);const _0x3c1955=getGlobalConfigPath(),_0x2b62f7=getConfigDir();!a63_0xb80dc1[_0x3466ee(0x189)](_0x2b62f7)&&createSecureDirectory(_0x2b62f7);let _0x11808b={};if(a63_0xb80dc1['existsSync'](_0x3c1955))try{const _0x3eb483=a63_0xb80dc1[_0x3466ee(0x1a3)](_0x3c1955,_0x3466ee(0x1a0));_0x11808b=JSON[_0x3466ee(0x1ac)](_0x3eb483);}catch{console['warn'](_0x3466ee(0x198)+_0x3c1955+_0x3466ee(0x1b9));}!_0x11808b[_0x3466ee(0x1b2)]&&(_0x11808b[_0x3466ee(0x1b2)]={}),_0x11808b[_0x3466ee(0x1b2)][_0x5edda1]=_0x43e660,writeSecureFile(_0x3c1955,JSON[_0x3466ee(0x1b4)](_0x11808b,null,0x2));}export function removeProfileFromUserConfig(_0x53b821){const _0x494888=a63_0x18a8;validateProfileName(_0x53b821);const _0x1bc6a3=getGlobalConfigPath();if(!a63_0xb80dc1[_0x494888(0x189)](_0x1bc6a3))throw new Error(_0x494888(0x16f)+_0x53b821+'\x27\x20not\x20found\x20in\x20user\x20configuration');let _0x2e30ee={};try{const _0x4ada14=a63_0xb80dc1[_0x494888(0x1a3)](_0x1bc6a3,_0x494888(0x1a0));_0x2e30ee=JSON[_0x494888(0x1ac)](_0x4ada14);}catch{throw new Error('Failed\x20to\x20parse\x20'+_0x1bc6a3);}if(!_0x2e30ee[_0x494888(0x1b2)]||!_0x2e30ee[_0x494888(0x1b2)][_0x53b821])throw new Error(_0x494888(0x16f)+_0x53b821+_0x494888(0x197));delete _0x2e30ee[_0x494888(0x1b2)][_0x53b821],_0x2e30ee[_0x494888(0x191)]===_0x53b821&&delete _0x2e30ee[_0x494888(0x191)],writeSecureFile(_0x1bc6a3,JSON[_0x494888(0x1b4)](_0x2e30ee,null,0x2));}export function getActiveProfile(){const _0x61a528=a63_0x18a8,_0x43c073=loadSessionContext();if(_0x43c073?.[_0x61a528(0x191)])return _0x43c073['profile'];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x1f0aff=getGlobalConfigPath();if(!a63_0xb80dc1[_0x61a528(0x189)](_0x1f0aff))return null;try{const _0x1b02a3=a63_0xb80dc1[_0x61a528(0x1a3)](_0x1f0aff,_0x61a528(0x1a0)),_0x55cacd=JSON['parse'](_0x1b02a3);return _0x55cacd['profile']||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0xeed340){const _0x31d9c8=a63_0x18a8,_0x4acbc5=getGlobalConfigPath(),_0x56bdda=getConfigDir();!a63_0xb80dc1[_0x31d9c8(0x189)](_0x56bdda)&&createSecureDirectory(_0x56bdda);let _0x29a53b={};if(a63_0xb80dc1[_0x31d9c8(0x189)](_0x4acbc5))try{const _0x277db2=a63_0xb80dc1[_0x31d9c8(0x1a3)](_0x4acbc5,_0x31d9c8(0x1a0));_0x29a53b=JSON[_0x31d9c8(0x1ac)](_0x277db2);}catch{console[_0x31d9c8(0x179)](_0x31d9c8(0x198)+_0x4acbc5+_0x31d9c8(0x1b9));}_0x29a53b['site']=_0xeed340,writeSecureFile(_0x4acbc5,JSON['stringify'](_0x29a53b,null,0x2));}export function saveActiveProfileToUserConfig(_0x314ae0){const _0x1441f8=a63_0x18a8;validateProfileName(_0x314ae0);const _0x1d3c41=getGlobalConfigPath(),_0x4dd2ae=getConfigDir();!a63_0xb80dc1[_0x1441f8(0x189)](_0x4dd2ae)&&createSecureDirectory(_0x4dd2ae);let _0x2ec101={};if(a63_0xb80dc1[_0x1441f8(0x189)](_0x1d3c41))try{const _0x427ca0=a63_0xb80dc1[_0x1441f8(0x1a3)](_0x1d3c41,_0x1441f8(0x1a0));_0x2ec101=JSON[_0x1441f8(0x1ac)](_0x427ca0);}catch{console['warn'](_0x1441f8(0x198)+_0x1d3c41+_0x1441f8(0x1b9));}_0x2ec101[_0x1441f8(0x191)]=_0x314ae0,writeSecureFile(_0x1d3c41,JSON['stringify'](_0x2ec101,null,0x2));}function clearFieldFromUserConfig(_0x32b126){const _0x3558dd=a63_0x18a8,_0x3a8d30=getGlobalConfigPath();if(!a63_0xb80dc1[_0x3558dd(0x189)](_0x3a8d30))return;let _0x55d4a5={};try{const _0x154184=a63_0xb80dc1[_0x3558dd(0x1a3)](_0x3a8d30,'utf-8');_0x55d4a5=JSON[_0x3558dd(0x1ac)](_0x154184);}catch{return;}delete _0x55d4a5[_0x32b126],writeSecureFile(_0x3a8d30,JSON['stringify'](_0x55d4a5,null,0x2));}function a63_0x1831(){const _0x2d9ef3=['user','INVALID_PROFILE_CONFIG','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string',',\x20creating\x20new\x20file','Warning:\x20Profile\x20\x27','200243kbPsWT','object','filter','Profile\x20\x27','directory','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','\x27:\x20config\x20must\x20be\x20an\x20object','values','1056111EULCXk','rmSync','6PoqzEl','16LBBbLZ','tdx.json','warn','2047563PzDYxt','\x22\x20\x22','llm_agent','keys','map','971398KzxVar','toISOString','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','\x20already\x20exists','1142452TwliBm','name','length','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','find','existsSync','string','user_info','Profile\x20','from','\x0aWarning:\x20Failed\x20to\x20parse\x20','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','message','profile','entries','database','description','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','\x27\x20not\x20found\x20in\x20user\x20configuration','Warning:\x20Failed\x20to\x20parse\x20','\x20does\x20not\x20exist','\x27\x20will\x20be\x20ignored','To\x20migrate:','test','readdirSync','has','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','utf-8','Invalid\x20profile\x20name:\x20','898170yHPLxT','readFileSync',':\x20Invalid\x20JSON\x20syntax','\x20\x20mv\x20\x22','.env.','parent_segment','set','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','1276595XYLdHC','join','parse','push','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','local','llm_project','sort','profiles','site','stringify','3NFeCMZ'];a63_0x1831=function(){return _0x2d9ef3;};return a63_0x1831();}export function clearDefaultSiteFromUserConfig(){const _0x5ba6c9=a63_0x18a8;clearFieldFromUserConfig(_0x5ba6c9(0x1b3));}export function clearActiveProfileFromUserConfig(){const _0x3e064f=a63_0x18a8;clearFieldFromUserConfig(_0x3e064f(0x191));}export function createProfile(_0x119b55,_0x5e8158){const _0x54b28b=a63_0x18a8;validateProfileName(_0x119b55);if(profileExists(_0x119b55))throw new Error('Profile\x20'+_0x119b55+_0x54b28b(0x182));saveProfile(_0x119b55,_0x5e8158);}export function saveProfileCredentials(_0x48f6d4,_0x3599e1){const _0x489e32=a63_0x18a8;validateProfileName(_0x48f6d4);if(!profileExists(_0x48f6d4))throw new Error(_0x489e32(0x18c)+_0x48f6d4+_0x489e32(0x199));const _0x2c90b7=getNewCredentialPath(_0x48f6d4);writeSecureFile(_0x2c90b7,_0x3599e1);}export function loadProfileCredentials(_0x3334de){const _0x569246=a63_0x18a8;validateProfileName(_0x3334de);const _0x261764=getNewCredentialPath(_0x3334de);if(a63_0xb80dc1[_0x569246(0x189)](_0x261764))try{return a63_0xb80dc1[_0x569246(0x1a3)](_0x261764,_0x569246(0x1a0));}catch{}const _0x47b968=getOldCredentialPath(_0x3334de);if(a63_0xb80dc1[_0x569246(0x189)](_0x47b968)){console[_0x569246(0x179)](_0x569246(0x186)+_0x3334de+'\x27'),console[_0x569246(0x179)](_0x569246(0x19b)),console[_0x569246(0x179)](_0x569246(0x1a5)+_0x47b968+_0x569246(0x17b)+_0x261764+'\x22'),console[_0x569246(0x179)](_0x569246(0x1ae));try{return a63_0xb80dc1[_0x569246(0x1a3)](_0x47b968,_0x569246(0x1a0));}catch{return null;}}return null;}
@@ -1 +1 @@
1
- function a63_0x2d4f(_0x49792b,_0x3c1494){_0x49792b=_0x49792b-0x1b9;const _0x89952=a63_0x8995();let _0x2d4ff0=_0x89952[_0x49792b];return _0x2d4ff0;}const a63_0x31e863=a63_0x2d4f;function a63_0x8995(){const _0x34a0fd=['165492zlGncq','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','warn','125GbkBlP','dirname','242645fysRwu','7XPVnpZ','includes','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','readFileSync','existsSync','30wRQkvl','tdx.json','ENOENT','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','stringify','api_key','2204502idyMni','944688wJdIhB','3YCuZGP','writeFileSync','TD_API_KEY','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','code','join','664FURzfE','apiKey','677844RtzHot','utf-8','12739133rnjnob','\x20is\x20ignored.\x20','cwd'];a63_0x8995=function(){return _0x34a0fd;};return a63_0x8995();}(function(_0x4e923d,_0x56c546){const _0x3577cf=a63_0x2d4f,_0x4a1bb3=_0x4e923d();while(!![]){try{const _0xf77cee=-parseInt(_0x3577cf(0x1c9))/0x1+parseInt(_0x3577cf(0x1bf))/0x2*(-parseInt(_0x3577cf(0x1d7))/0x3)+parseInt(_0x3577cf(0x1bd))/0x4*(-parseInt(_0x3577cf(0x1c7))/0x5)+parseInt(_0x3577cf(0x1d5))/0x6*(-parseInt(_0x3577cf(0x1ca))/0x7)+parseInt(_0x3577cf(0x1d6))/0x8+-parseInt(_0x3577cf(0x1c4))/0x9*(parseInt(_0x3577cf(0x1cf))/0xa)+parseInt(_0x3577cf(0x1c1))/0xb;if(_0xf77cee===_0x56c546)break;else _0x4a1bb3['push'](_0x4a1bb3['shift']());}catch(_0x2c5286){_0x4a1bb3['push'](_0x4a1bb3['shift']());}}}(a63_0x8995,0x41673));import*as a63_0x3480e7 from'node:fs';import*as a63_0x5f5bcd from'node:path';const PROJECT_CONFIG_FILENAME=a63_0x31e863(0x1d0);export function findProjectConfigPath(_0x4dba60){const _0x2f6a98=a63_0x31e863;let _0x244dfe=_0x4dba60||process['cwd']();while(!![]){const _0x47197b=a63_0x5f5bcd[_0x2f6a98(0x1bc)](_0x244dfe,PROJECT_CONFIG_FILENAME);if(a63_0x3480e7[_0x2f6a98(0x1ce)](_0x47197b))return _0x47197b;const _0xa82d4a=a63_0x5f5bcd[_0x2f6a98(0x1c8)](_0x244dfe);if(_0xa82d4a===_0x244dfe)return null;_0x244dfe=_0xa82d4a;}}export function loadProjectConfig(_0x23c143){const _0x4bb0d1=a63_0x31e863,_0x130bf7=findProjectConfigPath(_0x23c143);if(!_0x130bf7)return null;try{const _0x2a3448=a63_0x3480e7[_0x4bb0d1(0x1cd)](_0x130bf7,_0x4bb0d1(0x1c0)),_0x1ad268=JSON['parse'](_0x2a3448),_0x3ac559=JSON['stringify'](_0x1ad268);if(_0x3ac559[_0x4bb0d1(0x1cb)](_0x4bb0d1(0x1b9))||_0x3ac559['includes']('apiKey')||_0x3ac559[_0x4bb0d1(0x1cb)]('api_key'))throw new Error(_0x4bb0d1(0x1c5)+_0x130bf7+').\x20'+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0x333d94,profile:_0x38ee0d,..._0xe956b}=_0x1ad268;return _0x38ee0d&&console[_0x4bb0d1(0x1c6)]('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0x130bf7+_0x4bb0d1(0x1c2)+_0x4bb0d1(0x1ba)),_0xe956b;}catch(_0x393665){if(_0x393665 instanceof Error&&_0x4bb0d1(0x1bb)in _0x393665&&_0x393665[_0x4bb0d1(0x1bb)]===_0x4bb0d1(0x1d1))return null;throw new Error('Failed\x20to\x20load\x20project\x20config\x20from\x20'+_0x130bf7+':\x20'+_0x393665);}}export function saveProjectConfig(_0x1eacb1,_0x49458d){const _0x1a9252=a63_0x31e863,_0x13b506=_0x49458d||process[_0x1a9252(0x1c3)](),_0x125f7c=a63_0x5f5bcd[_0x1a9252(0x1bc)](_0x13b506,PROJECT_CONFIG_FILENAME),_0x553468=JSON[_0x1a9252(0x1d3)](_0x1eacb1);if(_0x553468['includes'](_0x1a9252(0x1b9))||_0x553468[_0x1a9252(0x1cb)](_0x1a9252(0x1be))||_0x553468[_0x1a9252(0x1cb)](_0x1a9252(0x1d4)))throw new Error(_0x1a9252(0x1d2));if('profile'in _0x1eacb1)throw new Error(_0x1a9252(0x1cc));a63_0x3480e7[_0x1a9252(0x1d8)](_0x125f7c,JSON[_0x1a9252(0x1d3)](_0x1eacb1,null,0x2));}export function hasProjectConfig(_0xb7ebb4){return findProjectConfigPath(_0xb7ebb4)!==null;}export function getProjectRoot(_0x148c5c){const _0x5dada3=a63_0x31e863,_0x3e251d=findProjectConfigPath(_0x148c5c);return _0x3e251d?a63_0x5f5bcd[_0x5dada3(0x1c8)](_0x3e251d):null;}
1
+ const a64_0x3d2143=a64_0x3ac4;function a64_0x3ac4(_0x2d1d3c,_0x404ae5){_0x2d1d3c=_0x2d1d3c-0x1f1;const _0x5ed578=a64_0x5ed5();let _0x3ac424=_0x5ed578[_0x2d1d3c];return _0x3ac424;}(function(_0x59f3ff,_0x2653b4){const _0x1bfcc0=a64_0x3ac4,_0x36e704=_0x59f3ff();while(!![]){try{const _0x339a99=-parseInt(_0x1bfcc0(0x200))/0x1+parseInt(_0x1bfcc0(0x1fe))/0x2*(parseInt(_0x1bfcc0(0x1f3))/0x3)+-parseInt(_0x1bfcc0(0x1f5))/0x4*(-parseInt(_0x1bfcc0(0x206))/0x5)+parseInt(_0x1bfcc0(0x214))/0x6*(-parseInt(_0x1bfcc0(0x210))/0x7)+parseInt(_0x1bfcc0(0x1fc))/0x8*(-parseInt(_0x1bfcc0(0x213))/0x9)+-parseInt(_0x1bfcc0(0x201))/0xa+-parseInt(_0x1bfcc0(0x20e))/0xb*(-parseInt(_0x1bfcc0(0x20b))/0xc);if(_0x339a99===_0x2653b4)break;else _0x36e704['push'](_0x36e704['shift']());}catch(_0x38083c){_0x36e704['push'](_0x36e704['shift']());}}}(a64_0x5ed5,0x217e9));import*as a64_0x29ef68 from'node:fs';import*as a64_0x12eb19 from'node:path';const PROJECT_CONFIG_FILENAME=a64_0x3d2143(0x1f6);export function findProjectConfigPath(_0x4d898e){const _0x28b8c7=a64_0x3d2143;let _0x25b9ac=_0x4d898e||process[_0x28b8c7(0x211)]();while(!![]){const _0x101a2b=a64_0x12eb19[_0x28b8c7(0x20c)](_0x25b9ac,PROJECT_CONFIG_FILENAME);if(a64_0x29ef68[_0x28b8c7(0x1fd)](_0x101a2b))return _0x101a2b;const _0x4676c5=a64_0x12eb19[_0x28b8c7(0x1f1)](_0x25b9ac);if(_0x4676c5===_0x25b9ac)return null;_0x25b9ac=_0x4676c5;}}export function loadProjectConfig(_0x2085b1){const _0x5a0077=a64_0x3d2143,_0x12485c=findProjectConfigPath(_0x2085b1);if(!_0x12485c)return null;try{const _0x189a00=a64_0x29ef68[_0x5a0077(0x204)](_0x12485c,_0x5a0077(0x1ff)),_0x476409=JSON['parse'](_0x189a00),_0x799ed4=JSON['stringify'](_0x476409);if(_0x799ed4[_0x5a0077(0x205)](_0x5a0077(0x1f7))||_0x799ed4[_0x5a0077(0x205)](_0x5a0077(0x1f4))||_0x799ed4[_0x5a0077(0x205)](_0x5a0077(0x209)))throw new Error(_0x5a0077(0x203)+_0x12485c+_0x5a0077(0x1f2)+_0x5a0077(0x212));const {metadata:_0x40c78e,profile:_0x386912,..._0x2370fe}=_0x476409;return _0x386912&&console['warn'](_0x5a0077(0x1f8)+_0x12485c+_0x5a0077(0x20f)+'Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'),_0x2370fe;}catch(_0x4641ca){if(_0x4641ca instanceof Error&&_0x5a0077(0x208)in _0x4641ca&&_0x4641ca[_0x5a0077(0x208)]===_0x5a0077(0x1f9))return null;throw new Error(_0x5a0077(0x202)+_0x12485c+':\x20'+_0x4641ca);}}export function saveProjectConfig(_0x19299a,_0x2d75d6){const _0x44ce5f=a64_0x3d2143,_0x2442ec=_0x2d75d6||process[_0x44ce5f(0x211)](),_0x4bdefd=a64_0x12eb19[_0x44ce5f(0x20c)](_0x2442ec,PROJECT_CONFIG_FILENAME),_0x201dc2=JSON[_0x44ce5f(0x207)](_0x19299a);if(_0x201dc2['includes'](_0x44ce5f(0x1f7))||_0x201dc2[_0x44ce5f(0x205)](_0x44ce5f(0x1f4))||_0x201dc2['includes']('api_key'))throw new Error(_0x44ce5f(0x20a));if(_0x44ce5f(0x20d)in _0x19299a)throw new Error(_0x44ce5f(0x1fa));a64_0x29ef68[_0x44ce5f(0x1fb)](_0x4bdefd,JSON[_0x44ce5f(0x207)](_0x19299a,null,0x2));}export function hasProjectConfig(_0x24a5fe){return findProjectConfigPath(_0x24a5fe)!==null;}export function getProjectRoot(_0x36af93){const _0x37f5a4=a64_0x3d2143,_0x5e1c7f=findProjectConfigPath(_0x36af93);return _0x5e1c7f?a64_0x12eb19[_0x37f5a4(0x1f1)](_0x5e1c7f):null;}function a64_0x5ed5(){const _0x450213=['utf-8','239645JetedY','1123640ufmVhS','Failed\x20to\x20load\x20project\x20config\x20from\x20','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','readFileSync','includes','21275IvbwNW','stringify','code','api_key','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','36DhWTyv','join','profile','1189859kTRbYf','\x20is\x20ignored.\x20','1414ffyggB','cwd','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','144YFumUg','7422GVcZcp','dirname',').\x20','9tbdzxF','apiKey','212JvNCff','tdx.json','TD_API_KEY','Warning:\x20\x27profile\x27\x20field\x20in\x20','ENOENT','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','writeFileSync','40872XLFCxs','existsSync','180532uKgDyQ'];a64_0x5ed5=function(){return _0x450213;};return a64_0x5ed5();}
@@ -1 +1 @@
1
- (function(_0x4b3df1,_0x218216){const _0x15d5df=a64_0x40a1,_0x405a4b=_0x4b3df1();while(!![]){try{const _0x60dc67=parseInt(_0x15d5df(0x1ba))/0x1*(parseInt(_0x15d5df(0x1ac))/0x2)+-parseInt(_0x15d5df(0x1ab))/0x3+-parseInt(_0x15d5df(0x1bc))/0x4*(-parseInt(_0x15d5df(0x1b1))/0x5)+parseInt(_0x15d5df(0x1be))/0x6+-parseInt(_0x15d5df(0x1cc))/0x7+parseInt(_0x15d5df(0x1b6))/0x8*(-parseInt(_0x15d5df(0x1ce))/0x9)+parseInt(_0x15d5df(0x1c4))/0xa;if(_0x60dc67===_0x218216)break;else _0x405a4b['push'](_0x405a4b['shift']());}catch(_0x58573f){_0x405a4b['push'](_0x405a4b['shift']());}}}(a64_0x16aa,0xe76d4));import*as a64_0x5d9cdf from'node:fs';import*as a64_0x2c1848 from'node:path';import*as a64_0x12351a 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 _0x196a80=a64_0x40a1,_0x3d665b=process.env.TDX_CONFIG_DIR||a64_0x2c1848[_0x196a80(0x1bf)](a64_0x12351a[_0x196a80(0x1b8)](),_0x196a80(0x1c2),'tdx');return a64_0x2c1848['join'](_0x3d665b,_0x196a80(0x1cd));}function getSessionPath(_0x5dc015){const _0x2e6cdf=a64_0x40a1;return a64_0x2c1848[_0x2e6cdf(0x1bf)](getSessionsDir(),_0x5dc015+_0x2e6cdf(0x1c9));}function a64_0x40a1(_0x33abc3,_0x5bba28){_0x33abc3=_0x33abc3-0x1ab;const _0x16aaf5=a64_0x16aa();let _0x40a152=_0x16aaf5[_0x33abc3];return _0x40a152;}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x59f73f){const _0x3e5766=a64_0x40a1;if(_0x59f73f)return _0x59f73f;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x3e5766(0x1c7)]();}export function loadSessionContext(_0x55ff2d){const _0x43b686=getSessionID(_0x55ff2d),_0x134dc0=/^\d+$/['test'](_0x43b686)?parseInt(_0x43b686,0xa):null;return _0x134dc0!==null?loadSessionContextByPID(_0x134dc0):loadSessionContextByString(_0x43b686);}export function loadSessionContextByPID(_0x44886c){const _0x163e85=a64_0x40a1,_0x58d376=getSessionPath(_0x44886c);if(!a64_0x5d9cdf[_0x163e85(0x1b7)](_0x58d376))return null;try{const _0x1f8e78=a64_0x5d9cdf[_0x163e85(0x1b9)](_0x58d376,_0x163e85(0x1c6)),_0x229d3c=JSON[_0x163e85(0x1bb)](_0x1f8e78),_0x1f271e=new Date(_0x229d3c[_0x163e85(0x1c0)])[_0x163e85(0x1b0)](),_0x3a7079=Date[_0x163e85(0x1ca)]();if(_0x3a7079-_0x1f271e>SESSION_EXPIRATION_MS)return a64_0x5d9cdf[_0x163e85(0x1b2)](_0x58d376),null;const _0x2d5dca=JSON[_0x163e85(0x1cf)](_0x229d3c);if(_0x2d5dca[_0x163e85(0x1c1)](_0x163e85(0x1b3))||_0x2d5dca['includes']('apiKey')||_0x2d5dca['includes'](_0x163e85(0x1d0)))return console[_0x163e85(0x1bd)](_0x163e85(0x1ad)+_0x58d376+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a64_0x5d9cdf[_0x163e85(0x1b2)](_0x58d376),null;return _0x229d3c;}catch{try{a64_0x5d9cdf[_0x163e85(0x1b2)](_0x58d376);}catch{}return null;}}function a64_0x16aa(){const _0x340473=['existsSync','homedir','readFileSync','4NEEklO','parse','1960916PFOmlO','warn','2707500AwTCGd','join','createdAt','includes','.config','writeFileSync','43666830abkQdm','apiKey','utf-8','toString','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','.json','now','test','8733389Eadaka','sessions','27zfLurT','stringify','api_key','5506419uehkKX','20246oOQKKy','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','sort','readdirSync','getTime','5hlKZjb','unlinkSync','TD_API_KEY','toISOString','endsWith','3513680uqtTGK'];a64_0x16aa=function(){return _0x340473;};return a64_0x16aa();}function loadSessionContextByString(_0x6656b5){const _0x3e454a=a64_0x40a1,_0x584adf=a64_0x2c1848[_0x3e454a(0x1bf)](getSessionsDir(),_0x6656b5+_0x3e454a(0x1c9));if(!a64_0x5d9cdf[_0x3e454a(0x1b7)](_0x584adf))return null;try{const _0x41f80b=a64_0x5d9cdf[_0x3e454a(0x1b9)](_0x584adf,'utf-8'),_0x203295=JSON[_0x3e454a(0x1bb)](_0x41f80b),_0x5e2dc7=new Date(_0x203295[_0x3e454a(0x1c0)])[_0x3e454a(0x1b0)](),_0x56f235=Date[_0x3e454a(0x1ca)]();if(_0x56f235-_0x5e2dc7>SESSION_EXPIRATION_MS)return a64_0x5d9cdf[_0x3e454a(0x1b2)](_0x584adf),null;const _0x90edf3=JSON[_0x3e454a(0x1cf)](_0x203295);if(_0x90edf3[_0x3e454a(0x1c1)]('TD_API_KEY')||_0x90edf3[_0x3e454a(0x1c1)]('apiKey')||_0x90edf3[_0x3e454a(0x1c1)](_0x3e454a(0x1d0)))return console[_0x3e454a(0x1bd)](_0x3e454a(0x1ad)+_0x584adf+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a64_0x5d9cdf['unlinkSync'](_0x584adf),null;return _0x203295;}catch{try{a64_0x5d9cdf['unlinkSync'](_0x584adf);}catch{}return null;}}export function saveSessionContext(_0x3e7f6b,_0x305b84){const _0x3b859e=a64_0x40a1,_0x736e79=getSessionID(_0x305b84),_0x2c9530=/^\d+$/[_0x3b859e(0x1cb)](_0x736e79)?parseInt(_0x736e79,0xa):getCurrentSessionPID(),_0x3bf29f=a64_0x2c1848[_0x3b859e(0x1bf)](getSessionsDir(),_0x736e79+'.json'),_0x27aa08=getSessionsDir();createSecureDirectory(_0x27aa08);const _0x4d1cb5=JSON[_0x3b859e(0x1cf)](_0x3e7f6b);if(_0x4d1cb5[_0x3b859e(0x1c1)]('TD_API_KEY')||_0x4d1cb5[_0x3b859e(0x1c1)](_0x3b859e(0x1c5))||_0x4d1cb5[_0x3b859e(0x1c1)]('api_key'))throw new Error(_0x3b859e(0x1c8));let _0x17ce57;const _0x4aa44d=/^\d+$/[_0x3b859e(0x1cb)](_0x736e79)?loadSessionContextByPID(parseInt(_0x736e79,0xa)):loadSessionContextByString(_0x736e79);_0x4aa44d?_0x17ce57={..._0x4aa44d,..._0x3e7f6b,'pid':_0x2c9530,'sessionId':_0x736e79!==_0x2c9530[_0x3b859e(0x1c7)]()?_0x736e79:undefined,'updatedAt':new Date()[_0x3b859e(0x1b4)]()}:_0x17ce57={'pid':_0x2c9530,'sessionId':_0x736e79!==_0x2c9530[_0x3b859e(0x1c7)]()?_0x736e79:undefined,..._0x3e7f6b,'createdAt':new Date()[_0x3b859e(0x1b4)](),'updatedAt':new Date()[_0x3b859e(0x1b4)]()},a64_0x5d9cdf[_0x3b859e(0x1c3)](_0x3bf29f,JSON['stringify'](_0x17ce57,null,0x2));}export function clearSessionContext(_0xc3630a){const _0xfea9d=a64_0x40a1,_0x4a22e5=getSessionID(_0xc3630a),_0x3fb274=a64_0x2c1848['join'](getSessionsDir(),_0x4a22e5+_0xfea9d(0x1c9));a64_0x5d9cdf[_0xfea9d(0x1b7)](_0x3fb274)&&a64_0x5d9cdf[_0xfea9d(0x1b2)](_0x3fb274);}export function clearSessionContextField(_0x406b21,_0x598c0b){const _0xfe80c4=a64_0x40a1,_0x3f3c1f=getSessionID(_0x598c0b),_0x3501a9=a64_0x2c1848[_0xfe80c4(0x1bf)](getSessionsDir(),_0x3f3c1f+_0xfe80c4(0x1c9));if(!a64_0x5d9cdf[_0xfe80c4(0x1b7)](_0x3501a9))return;try{const _0x3c88cc=a64_0x5d9cdf[_0xfe80c4(0x1b9)](_0x3501a9,_0xfe80c4(0x1c6)),_0x37f2a3=JSON['parse'](_0x3c88cc);delete _0x37f2a3[_0x406b21],a64_0x5d9cdf[_0xfe80c4(0x1c3)](_0x3501a9,JSON[_0xfe80c4(0x1cf)](_0x37f2a3,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0xe14056=a64_0x40a1,_0x4f9092=getSessionsDir();if(!a64_0x5d9cdf['existsSync'](_0x4f9092))return 0x0;let _0x2840fa=0x0;const _0x376c0f=Date[_0xe14056(0x1ca)]();try{const _0x23ad31=a64_0x5d9cdf[_0xe14056(0x1af)](_0x4f9092);for(const _0xacb772 of _0x23ad31){if(!_0xacb772[_0xe14056(0x1b5)](_0xe14056(0x1c9)))continue;const _0x5a69a9=a64_0x2c1848['join'](_0x4f9092,_0xacb772),_0x4fac69=_0xacb772['replace'](_0xe14056(0x1c9),''),_0x3d57fa=parseInt(_0x4fac69,0xa),_0x204751=!isNaN(_0x3d57fa);if(_0x204751){if(!isProcessRunning(_0x3d57fa)){a64_0x5d9cdf['unlinkSync'](_0x5a69a9),_0x2840fa++;continue;}}try{const _0x5cc869=a64_0x5d9cdf['readFileSync'](_0x5a69a9,_0xe14056(0x1c6)),_0x149028=JSON[_0xe14056(0x1bb)](_0x5cc869),_0x14b143=new Date(_0x149028[_0xe14056(0x1c0)])[_0xe14056(0x1b0)]();_0x376c0f-_0x14b143>SESSION_EXPIRATION_MS&&(a64_0x5d9cdf['unlinkSync'](_0x5a69a9),_0x2840fa++);}catch{a64_0x5d9cdf[_0xe14056(0x1b2)](_0x5a69a9),_0x2840fa++;}}}catch{}return _0x2840fa;}export function listActiveSessions(){const _0x5bf964=a64_0x40a1,_0x2fe886=getSessionsDir();if(!a64_0x5d9cdf[_0x5bf964(0x1b7)](_0x2fe886))return[];try{const _0x4311ed=a64_0x5d9cdf[_0x5bf964(0x1af)](_0x2fe886),_0x54c051=[];for(const _0x38b8b6 of _0x4311ed){if(!_0x38b8b6['endsWith'](_0x5bf964(0x1c9)))continue;const _0x342dc7=_0x38b8b6['replace']('.json',''),_0x5d8d53=parseInt(_0x342dc7,0xa);!isNaN(_0x5d8d53)&&isProcessRunning(_0x5d8d53)&&_0x54c051['push'](_0x5d8d53);}return _0x54c051[_0x5bf964(0x1ae)]((_0x28dd8f,_0x4153c3)=>_0x28dd8f-_0x4153c3);}catch{return[];}}
1
+ function a65_0x59e7(){const _0x1da2ff=['.json','6480088TvgTiR','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','createdAt','13781430ncjqEa','.\x20This\x20is\x20insecure.\x20Removing\x20session.','existsSync','api_key','now','parse','unlinkSync','toISOString','push','96MkiOQW','warn','.config','tdx','replace','endsWith','writeFileSync','3OogfSx','readFileSync','35609WlTbnP','join','stringify','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','2784966aJIzJV','getTime','apiKey','includes','9nsvYhm','sessions','toString','6142890LLovvw','readdirSync','136780jddIrD','546118qtLLsV','test','sort','TD_API_KEY','homedir','utf-8'];a65_0x59e7=function(){return _0x1da2ff;};return a65_0x59e7();}(function(_0x505cc4,_0x2d21ee){const _0x5a265c=a65_0x143c,_0x137d5a=_0x505cc4();while(!![]){try{const _0x420f7c=-parseInt(_0x5a265c(0x133))/0x1*(-parseInt(_0x5a265c(0x143))/0x2)+parseInt(_0x5a265c(0x139))/0x3+-parseInt(_0x5a265c(0x142))/0x4+parseInt(_0x5a265c(0x140))/0x5+-parseInt(_0x5a265c(0x156))/0x6*(parseInt(_0x5a265c(0x135))/0x7)+-parseInt(_0x5a265c(0x14a))/0x8*(parseInt(_0x5a265c(0x13d))/0x9)+-parseInt(_0x5a265c(0x14d))/0xa;if(_0x420f7c===_0x2d21ee)break;else _0x137d5a['push'](_0x137d5a['shift']());}catch(_0x4df0c2){_0x137d5a['push'](_0x137d5a['shift']());}}}(a65_0x59e7,0xa4250));import*as a65_0x57e6db from'node:fs';import*as a65_0x30decc from'node:path';import*as a65_0x3e3d48 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 _0x41cae0=a65_0x143c,_0x53d305=process.env.TDX_CONFIG_DIR||a65_0x30decc['join'](a65_0x3e3d48[_0x41cae0(0x147)](),_0x41cae0(0x12e),_0x41cae0(0x12f));return a65_0x30decc['join'](_0x53d305,_0x41cae0(0x13e));}function a65_0x143c(_0x7663fb,_0x319cd7){_0x7663fb=_0x7663fb-0x12d;const _0x59e7ca=a65_0x59e7();let _0x143cfb=_0x59e7ca[_0x7663fb];return _0x143cfb;}function getSessionPath(_0x2d4f63){const _0x1b98b3=a65_0x143c;return a65_0x30decc[_0x1b98b3(0x136)](getSessionsDir(),_0x2d4f63+_0x1b98b3(0x149));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x593b97){const _0x254a64=a65_0x143c;if(_0x593b97)return _0x593b97;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x254a64(0x13f)]();}export function loadSessionContext(_0x526c18){const _0x2e8fef=a65_0x143c,_0x5139a0=getSessionID(_0x526c18),_0x1af572=/^\d+$/[_0x2e8fef(0x144)](_0x5139a0)?parseInt(_0x5139a0,0xa):null;return _0x1af572!==null?loadSessionContextByPID(_0x1af572):loadSessionContextByString(_0x5139a0);}export function loadSessionContextByPID(_0x3dd844){const _0x6de654=a65_0x143c,_0x35368b=getSessionPath(_0x3dd844);if(!a65_0x57e6db[_0x6de654(0x14f)](_0x35368b))return null;try{const _0x6e7aa5=a65_0x57e6db[_0x6de654(0x134)](_0x35368b,_0x6de654(0x148)),_0x9d74a=JSON[_0x6de654(0x152)](_0x6e7aa5),_0x4b48b2=new Date(_0x9d74a[_0x6de654(0x14c)])[_0x6de654(0x13a)](),_0x2635c1=Date[_0x6de654(0x151)]();if(_0x2635c1-_0x4b48b2>SESSION_EXPIRATION_MS)return a65_0x57e6db[_0x6de654(0x153)](_0x35368b),null;const _0x3e7b8d=JSON[_0x6de654(0x137)](_0x9d74a);if(_0x3e7b8d['includes']('TD_API_KEY')||_0x3e7b8d[_0x6de654(0x13c)](_0x6de654(0x13b))||_0x3e7b8d['includes'](_0x6de654(0x150)))return console[_0x6de654(0x12d)](_0x6de654(0x14b)+_0x35368b+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a65_0x57e6db[_0x6de654(0x153)](_0x35368b),null;return _0x9d74a;}catch{try{a65_0x57e6db[_0x6de654(0x153)](_0x35368b);}catch{}return null;}}function loadSessionContextByString(_0x2f83f2){const _0x15eab9=a65_0x143c,_0x529c7f=a65_0x30decc[_0x15eab9(0x136)](getSessionsDir(),_0x2f83f2+_0x15eab9(0x149));if(!a65_0x57e6db[_0x15eab9(0x14f)](_0x529c7f))return null;try{const _0x3e87a9=a65_0x57e6db[_0x15eab9(0x134)](_0x529c7f,'utf-8'),_0x1456dd=JSON['parse'](_0x3e87a9),_0x5b0eb6=new Date(_0x1456dd[_0x15eab9(0x14c)])[_0x15eab9(0x13a)](),_0xd76ce8=Date[_0x15eab9(0x151)]();if(_0xd76ce8-_0x5b0eb6>SESSION_EXPIRATION_MS)return a65_0x57e6db[_0x15eab9(0x153)](_0x529c7f),null;const _0x248dee=JSON[_0x15eab9(0x137)](_0x1456dd);if(_0x248dee['includes'](_0x15eab9(0x146))||_0x248dee[_0x15eab9(0x13c)](_0x15eab9(0x13b))||_0x248dee['includes'](_0x15eab9(0x150)))return console[_0x15eab9(0x12d)](_0x15eab9(0x14b)+_0x529c7f+_0x15eab9(0x14e)),a65_0x57e6db[_0x15eab9(0x153)](_0x529c7f),null;return _0x1456dd;}catch{try{a65_0x57e6db[_0x15eab9(0x153)](_0x529c7f);}catch{}return null;}}export function saveSessionContext(_0x496bd0,_0x6b3415){const _0x4bf2bf=a65_0x143c,_0xfb3cad=getSessionID(_0x6b3415),_0x5e8423=/^\d+$/[_0x4bf2bf(0x144)](_0xfb3cad)?parseInt(_0xfb3cad,0xa):getCurrentSessionPID(),_0x40f09a=a65_0x30decc[_0x4bf2bf(0x136)](getSessionsDir(),_0xfb3cad+_0x4bf2bf(0x149)),_0x2fd3b3=getSessionsDir();createSecureDirectory(_0x2fd3b3);const _0x10b6b5=JSON['stringify'](_0x496bd0);if(_0x10b6b5['includes']('TD_API_KEY')||_0x10b6b5[_0x4bf2bf(0x13c)](_0x4bf2bf(0x13b))||_0x10b6b5[_0x4bf2bf(0x13c)]('api_key'))throw new Error(_0x4bf2bf(0x138));let _0x46f399;const _0x538c09=/^\d+$/[_0x4bf2bf(0x144)](_0xfb3cad)?loadSessionContextByPID(parseInt(_0xfb3cad,0xa)):loadSessionContextByString(_0xfb3cad);_0x538c09?_0x46f399={..._0x538c09,..._0x496bd0,'pid':_0x5e8423,'sessionId':_0xfb3cad!==_0x5e8423[_0x4bf2bf(0x13f)]()?_0xfb3cad:undefined,'updatedAt':new Date()['toISOString']()}:_0x46f399={'pid':_0x5e8423,'sessionId':_0xfb3cad!==_0x5e8423[_0x4bf2bf(0x13f)]()?_0xfb3cad:undefined,..._0x496bd0,'createdAt':new Date()['toISOString'](),'updatedAt':new Date()[_0x4bf2bf(0x154)]()},a65_0x57e6db[_0x4bf2bf(0x132)](_0x40f09a,JSON[_0x4bf2bf(0x137)](_0x46f399,null,0x2));}export function clearSessionContext(_0x472f2a){const _0x439a66=a65_0x143c,_0x83e630=getSessionID(_0x472f2a),_0x154dfb=a65_0x30decc[_0x439a66(0x136)](getSessionsDir(),_0x83e630+_0x439a66(0x149));a65_0x57e6db[_0x439a66(0x14f)](_0x154dfb)&&a65_0x57e6db[_0x439a66(0x153)](_0x154dfb);}export function clearSessionContextField(_0x2cdcc9,_0x58d0e1){const _0x2b5b43=a65_0x143c,_0x597482=getSessionID(_0x58d0e1),_0x19be86=a65_0x30decc[_0x2b5b43(0x136)](getSessionsDir(),_0x597482+'.json');if(!a65_0x57e6db['existsSync'](_0x19be86))return;try{const _0x8a362b=a65_0x57e6db[_0x2b5b43(0x134)](_0x19be86,_0x2b5b43(0x148)),_0x395664=JSON['parse'](_0x8a362b);delete _0x395664[_0x2cdcc9],a65_0x57e6db[_0x2b5b43(0x132)](_0x19be86,JSON['stringify'](_0x395664,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x3a90cf=a65_0x143c,_0x4e269c=getSessionsDir();if(!a65_0x57e6db['existsSync'](_0x4e269c))return 0x0;let _0x4b5164=0x0;const _0x21da5a=Date[_0x3a90cf(0x151)]();try{const _0x4958c9=a65_0x57e6db['readdirSync'](_0x4e269c);for(const _0x155ccd of _0x4958c9){if(!_0x155ccd[_0x3a90cf(0x131)](_0x3a90cf(0x149)))continue;const _0x20a02c=a65_0x30decc['join'](_0x4e269c,_0x155ccd),_0x2e2664=_0x155ccd[_0x3a90cf(0x130)](_0x3a90cf(0x149),''),_0x1b9b33=parseInt(_0x2e2664,0xa),_0x35ea35=!isNaN(_0x1b9b33);if(_0x35ea35){if(!isProcessRunning(_0x1b9b33)){a65_0x57e6db[_0x3a90cf(0x153)](_0x20a02c),_0x4b5164++;continue;}}try{const _0x37b03a=a65_0x57e6db[_0x3a90cf(0x134)](_0x20a02c,_0x3a90cf(0x148)),_0x36761a=JSON[_0x3a90cf(0x152)](_0x37b03a),_0x1a8235=new Date(_0x36761a[_0x3a90cf(0x14c)])[_0x3a90cf(0x13a)]();_0x21da5a-_0x1a8235>SESSION_EXPIRATION_MS&&(a65_0x57e6db['unlinkSync'](_0x20a02c),_0x4b5164++);}catch{a65_0x57e6db[_0x3a90cf(0x153)](_0x20a02c),_0x4b5164++;}}}catch{}return _0x4b5164;}export function listActiveSessions(){const _0x4d886c=a65_0x143c,_0x2c888d=getSessionsDir();if(!a65_0x57e6db[_0x4d886c(0x14f)](_0x2c888d))return[];try{const _0x303995=a65_0x57e6db[_0x4d886c(0x141)](_0x2c888d),_0x2b6ef3=[];for(const _0x493353 of _0x303995){if(!_0x493353[_0x4d886c(0x131)](_0x4d886c(0x149)))continue;const _0xdaeebf=_0x493353[_0x4d886c(0x130)]('.json',''),_0x7bf1fd=parseInt(_0xdaeebf,0xa);!isNaN(_0x7bf1fd)&&isProcessRunning(_0x7bf1fd)&&_0x2b6ef3[_0x4d886c(0x155)](_0x7bf1fd);}return _0x2b6ef3[_0x4d886c(0x145)]((_0x1a6106,_0x29d286)=>_0x1a6106-_0x29d286);}catch{return[];}}
@@ -1 +1 @@
1
- const a65_0x56552e=a65_0x1a74;(function(_0x177c9d,_0x3a9e34){const _0x4cfc0e=a65_0x1a74,_0x1611d3=_0x177c9d();while(!![]){try{const _0x4cd308=parseInt(_0x4cfc0e(0x163))/0x1+parseInt(_0x4cfc0e(0x160))/0x2*(parseInt(_0x4cfc0e(0x161))/0x3)+-parseInt(_0x4cfc0e(0x15e))/0x4*(-parseInt(_0x4cfc0e(0x155))/0x5)+-parseInt(_0x4cfc0e(0x15f))/0x6*(-parseInt(_0x4cfc0e(0x156))/0x7)+parseInt(_0x4cfc0e(0x159))/0x8+parseInt(_0x4cfc0e(0x15a))/0x9+-parseInt(_0x4cfc0e(0x157))/0xa;if(_0x4cd308===_0x3a9e34)break;else _0x1611d3['push'](_0x1611d3['shift']());}catch(_0x41ea88){_0x1611d3['push'](_0x1611d3['shift']());}}}(a65_0x5ebf,0x2e84e));function a65_0x5ebf(){const _0x430b7a=['366039kUTawP','5020kYWwNa','7gFWjkv','9900080IaEGgv','clear','1257296NXzKrQ','2255571CITljJ','read','write','core/user-cache','1228XZOnkm','292674RlOBua','38vGJgGH','7851YaOqKQ','users'];a65_0x5ebf=function(){return _0x430b7a;};return a65_0x5ebf();}import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache('users-{profile}.json',a65_0x56552e(0x15d));export function loadCachedUsers(_0x290a0d){const _0x29105c=a65_0x56552e,_0xfdff2e=userCache[_0x29105c(0x15b)](_0x290a0d);return _0xfdff2e?.[_0x29105c(0x162)]??null;}export function saveCachedUsers(_0x337c79,_0x10cd52){const _0x3e87cc=a65_0x56552e;userCache[_0x3e87cc(0x15c)](_0x337c79,{'users':_0x10cd52,'cachedAt':Date['now']()});}function a65_0x1a74(_0x30db38,_0x2734f6){_0x30db38=_0x30db38-0x155;const _0x5ebf5a=a65_0x5ebf();let _0x1a74b5=_0x5ebf5a[_0x30db38];return _0x1a74b5;}export function clearUserCache(_0x299273){const _0x2bd3e=a65_0x56552e;userCache[_0x2bd3e(0x158)](_0x299273);}
1
+ const a66_0x19e867=a66_0x387c;function a66_0x387c(_0x33e345,_0x3b6bda){_0x33e345=_0x33e345-0xe3;const _0x3026ae=a66_0x3026();let _0x387c00=_0x3026ae[_0x33e345];return _0x387c00;}(function(_0xa46934,_0x2d405f){const _0x3861b7=a66_0x387c,_0x550993=_0xa46934();while(!![]){try{const _0x28d519=parseInt(_0x3861b7(0xf0))/0x1*(-parseInt(_0x3861b7(0xe7))/0x2)+parseInt(_0x3861b7(0xea))/0x3+parseInt(_0x3861b7(0xed))/0x4+parseInt(_0x3861b7(0xe6))/0x5*(parseInt(_0x3861b7(0xec))/0x6)+-parseInt(_0x3861b7(0xe8))/0x7+-parseInt(_0x3861b7(0xe3))/0x8+parseInt(_0x3861b7(0xe4))/0x9;if(_0x28d519===_0x2d405f)break;else _0x550993['push'](_0x550993['shift']());}catch(_0x574828){_0x550993['push'](_0x550993['shift']());}}}(a66_0x3026,0x3e569));import{createProfileCache}from'../utils/global-cache.js';function a66_0x3026(){const _0x3bb2eb=['2336416fXQAzo','1989765KJiBya','core/user-cache','130GSmDUJ','32gxQTRb','379624TACcvD','users-{profile}.json','720987jJnmRj','write','86484SaXdQN','445068ebyhvM','now','users','21614XsuCfL','read'];a66_0x3026=function(){return _0x3bb2eb;};return a66_0x3026();}const userCache=createProfileCache(a66_0x19e867(0xe9),a66_0x19e867(0xe5));export function loadCachedUsers(_0x5826ae){const _0xed60a7=a66_0x19e867,_0xe449b4=userCache[_0xed60a7(0xf1)](_0x5826ae);return _0xe449b4?.[_0xed60a7(0xef)]??null;}export function saveCachedUsers(_0x4037d9,_0x2dd6b0){const _0x298fea=a66_0x19e867;userCache[_0x298fea(0xeb)](_0x4037d9,{'users':_0x2dd6b0,'cachedAt':Date[_0x298fea(0xee)]()});}export function clearUserCache(_0x21298a){userCache['clear'](_0x21298a);}
@@ -1 +1 @@
1
- (function(_0x211e37,_0x337eda){const _0x5267f8=a66_0xea19,_0x3e89f5=_0x211e37();while(!![]){try{const _0x233515=parseInt(_0x5267f8(0x10c))/0x1+-parseInt(_0x5267f8(0x101))/0x2*(-parseInt(_0x5267f8(0x108))/0x3)+-parseInt(_0x5267f8(0x102))/0x4*(-parseInt(_0x5267f8(0x103))/0x5)+-parseInt(_0x5267f8(0x106))/0x6*(parseInt(_0x5267f8(0x10b))/0x7)+parseInt(_0x5267f8(0x10a))/0x8+parseInt(_0x5267f8(0x107))/0x9*(-parseInt(_0x5267f8(0x105))/0xa)+parseInt(_0x5267f8(0x111))/0xb*(parseInt(_0x5267f8(0x100))/0xc);if(_0x233515===_0x337eda)break;else _0x3e89f5['push'](_0x3e89f5['shift']());}catch(_0x391486){_0x3e89f5['push'](_0x3e89f5['shift']());}}}(a66_0x4704,0x5a1db));import{readFileSync}from'fs';function a66_0xea19(_0x2bc449,_0x2b16b5){_0x2bc449=_0x2bc449-0x100;const _0x4704d8=a66_0x4704();let _0xea1956=_0x4704d8[_0x2bc449];return _0xea1956;}import{fileURLToPath}from'url';function a66_0x4704(){const _0xa5c368=['1979706nJQUCM','9OsAuRQ','6BwWvvL','utf-8','1362984qTVwEG','7IWqktg','361448PHSovg','version','../../package.json','.dev','0.0.0','80399tMcKoY','parse','636ZsmZls','26468dpBcIp','43964UwQHHq','70TbNhHL','../build-info.json','4004740kjWyPr'];a66_0x4704=function(){return _0xa5c368;};return a66_0x4704();}import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x475e57=a66_0xea19;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x2f2011=fileURLToPath(import.meta.url),_0x4475f9=dirname(_0x2f2011);try{const _0x21f15b=join(_0x4475f9,_0x475e57(0x104));cachedBuildInfo=JSON[_0x475e57(0x112)](readFileSync(_0x21f15b,_0x475e57(0x109)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x1c8274=a66_0xea19;if(cachedVersion!==null)return cachedVersion;const _0x3aa808=fileURLToPath(import.meta.url),_0x555fff=dirname(_0x3aa808),_0x446149=getBuildInfo();if(_0x446149[_0x1c8274(0x10d)])return cachedVersion=_0x446149[_0x1c8274(0x10d)],cachedVersion;try{const _0x2aaa2f=join(_0x555fff,_0x1c8274(0x10e)),_0xff5902=JSON[_0x1c8274(0x112)](readFileSync(_0x2aaa2f,_0x1c8274(0x109)));cachedVersion=_0xff5902[_0x1c8274(0x10d)];}catch{cachedVersion=_0x1c8274(0x110);}return cachedVersion;}export function isDevVersion(){const _0x1693cf=a66_0xea19,_0x4ff18c=getVersion();return _0x4ff18c['includes'](_0x1693cf(0x10f))||_0x4ff18c['includes']('-');}
1
+ (function(_0x29fefc,_0x3182de){const _0x1418a4=a67_0x4116,_0x39e3a0=_0x29fefc();while(!![]){try{const _0x580527=parseInt(_0x1418a4(0x154))/0x1*(parseInt(_0x1418a4(0x146))/0x2)+parseInt(_0x1418a4(0x149))/0x3*(-parseInt(_0x1418a4(0x148))/0x4)+parseInt(_0x1418a4(0x147))/0x5*(-parseInt(_0x1418a4(0x152))/0x6)+-parseInt(_0x1418a4(0x150))/0x7+-parseInt(_0x1418a4(0x14f))/0x8+parseInt(_0x1418a4(0x156))/0x9+parseInt(_0x1418a4(0x153))/0xa*(parseInt(_0x1418a4(0x14c))/0xb);if(_0x580527===_0x3182de)break;else _0x39e3a0['push'](_0x39e3a0['shift']());}catch(_0x101f69){_0x39e3a0['push'](_0x39e3a0['shift']());}}}(a67_0x1f7e,0x544a7));import{readFileSync}from'fs';import{fileURLToPath}from'url';function a67_0x1f7e(){const _0x1a2a07=['92884tASZAF','51CPyRdZ','includes','version','16260079upIeLo','utf-8','.dev','3405088NvBuvC','3331958jZEbNV','parse','6sMuAaw','10ypNrwT','4RVEvmb','../build-info.json','1251414oHwfSr','../../package.json','34178SgNqQK','219745IpTHTb'];a67_0x1f7e=function(){return _0x1a2a07;};return a67_0x1f7e();}import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;function a67_0x4116(_0x1b5c1a,_0x1f1d7e){_0x1b5c1a=_0x1b5c1a-0x146;const _0x1f7e0e=a67_0x1f7e();let _0x411660=_0x1f7e0e[_0x1b5c1a];return _0x411660;}export function getBuildInfo(){const _0x8cc6c2=a67_0x4116;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x282268=fileURLToPath(import.meta.url),_0x1e58f=dirname(_0x282268);try{const _0x27bd71=join(_0x1e58f,_0x8cc6c2(0x155));cachedBuildInfo=JSON[_0x8cc6c2(0x151)](readFileSync(_0x27bd71,_0x8cc6c2(0x14d)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x58bdb0=a67_0x4116;if(cachedVersion!==null)return cachedVersion;const _0x4499dc=fileURLToPath(import.meta.url),_0xe6f6ad=dirname(_0x4499dc),_0x1037ff=getBuildInfo();if(_0x1037ff[_0x58bdb0(0x14b)])return cachedVersion=_0x1037ff[_0x58bdb0(0x14b)],cachedVersion;try{const _0x16c490=join(_0xe6f6ad,_0x58bdb0(0x157)),_0x4b0397=JSON[_0x58bdb0(0x151)](readFileSync(_0x16c490,_0x58bdb0(0x14d)));cachedVersion=_0x4b0397[_0x58bdb0(0x14b)];}catch{cachedVersion='0.0.0';}return cachedVersion;}export function isDevVersion(){const _0x1fd476=a67_0x4116,_0x410833=getVersion();return _0x410833['includes'](_0x1fd476(0x14e))||_0x410833[_0x1fd476(0x14a)]('-');}