@treasuredata/tdx 2026.3.32 → 2026.3.33

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 (245) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/auth-login-command.js +1 -1
  13. package/dist/commands/cas-command.js +1 -1
  14. package/dist/commands/cas-segment-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.js +1 -1
  38. package/dist/commands/profile-command.js +1 -1
  39. package/dist/commands/profiles-command.js +1 -1
  40. package/dist/commands/query-command.js +1 -1
  41. package/dist/commands/schedule-command.js +1 -1
  42. package/dist/commands/segment-command.js +1 -1
  43. package/dist/commands/segment-create-command.js +1 -1
  44. package/dist/commands/segment-fields-command.js +1 -1
  45. package/dist/commands/segment-pull-command.js +1 -1
  46. package/dist/commands/segment-push-command.js +1 -1
  47. package/dist/commands/segment-update-command.js +1 -1
  48. package/dist/commands/segment-use-command.js +1 -1
  49. package/dist/commands/segment-validate-command.js +1 -1
  50. package/dist/commands/segments.js +1 -1
  51. package/dist/commands/show.js +1 -1
  52. package/dist/commands/status-command.js +1 -1
  53. package/dist/commands/tables.js +1 -1
  54. package/dist/commands/unset-command.js +1 -1
  55. package/dist/commands/upgrade-command.js +1 -1
  56. package/dist/commands/use-command.js +1 -1
  57. package/dist/commands/user-command.js +1 -1
  58. package/dist/commands/work-command.d.ts +1 -3
  59. package/dist/commands/work-command.d.ts.map +1 -1
  60. package/dist/commands/work-command.js +1 -1
  61. package/dist/commands/work-command.js.map +1 -1
  62. package/dist/commands/workflow-command.js +1 -1
  63. package/dist/core/auth.js +1 -1
  64. package/dist/core/command-output.js +1 -1
  65. package/dist/core/config.js +1 -1
  66. package/dist/core/connection-cache.js +1 -1
  67. package/dist/core/constants.js +1 -1
  68. package/dist/core/credential-cache.js +1 -1
  69. package/dist/core/global-context.js +1 -1
  70. package/dist/core/keychain.js +1 -1
  71. package/dist/core/oauth-keychain.js +1 -1
  72. package/dist/core/oauth.js +1 -1
  73. package/dist/core/profile.js +1 -1
  74. package/dist/core/project-config.js +1 -1
  75. package/dist/core/session.js +1 -1
  76. package/dist/core/user-cache.js +1 -1
  77. package/dist/core/version.js +1 -1
  78. package/dist/index.js +1 -1
  79. package/dist/mcp/server.js +1 -1
  80. package/dist/mcp/tools/index.js +1 -1
  81. package/dist/mcp/tools/tdx-run.js +1 -1
  82. package/dist/mcp/tools/tdx-search.js +1 -1
  83. package/dist/mcp/utils.js +1 -1
  84. package/dist/proxy/claude-usage-tracker.js +1 -1
  85. package/dist/proxy/passthrough-server.js +1 -1
  86. package/dist/proxy/sse-usage-parser.js +1 -1
  87. package/dist/sdk/agent/agent-config.js +1 -1
  88. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  89. package/dist/sdk/agent/agent-yaml.js +1 -1
  90. package/dist/sdk/agent/test/evaluator.js +1 -1
  91. package/dist/sdk/agent/test/executor.js +1 -1
  92. package/dist/sdk/agent/test/index.js +1 -1
  93. package/dist/sdk/agent/test/output.js +1 -1
  94. package/dist/sdk/agent/test/parser.js +1 -1
  95. package/dist/sdk/agent/tool-target-registry.js +1 -1
  96. package/dist/sdk/api.js +1 -1
  97. package/dist/sdk/cas/cas-api-client.js +1 -1
  98. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  99. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  100. package/dist/sdk/cas/index.js +1 -1
  101. package/dist/sdk/cas/pull-workflow.js +1 -1
  102. package/dist/sdk/cas/push-workflow.js +1 -1
  103. package/dist/sdk/client/cdp-api-client.js +1 -1
  104. package/dist/sdk/client/delivery-api-client.js +1 -1
  105. package/dist/sdk/client/endpoints.js +1 -1
  106. package/dist/sdk/client/engage-api-client.js +1 -1
  107. package/dist/sdk/client/http-client.js +1 -1
  108. package/dist/sdk/client/llm-api-client.js +1 -1
  109. package/dist/sdk/client/oauth-refresh.js +1 -1
  110. package/dist/sdk/client/rate-limiter.js +1 -1
  111. package/dist/sdk/client/td-api-client.js +1 -1
  112. package/dist/sdk/client/trino-api-client.js +1 -1
  113. package/dist/sdk/client/workflow-client.js +1 -1
  114. package/dist/sdk/connection-validator.js +1 -1
  115. package/dist/sdk/connection.js +1 -1
  116. package/dist/sdk/delivery.js +1 -1
  117. package/dist/sdk/engage/campaign-pull.js +1 -1
  118. package/dist/sdk/engage/campaign-push.js +1 -1
  119. package/dist/sdk/engage/campaign-validator.js +1 -1
  120. package/dist/sdk/engage/campaign-yaml.js +1 -1
  121. package/dist/sdk/engage/template-pull.js +1 -1
  122. package/dist/sdk/engage/template-push.js +1 -1
  123. package/dist/sdk/engage/template-validator.js +1 -1
  124. package/dist/sdk/engage/template-yaml.js +1 -1
  125. package/dist/sdk/engage/types/campaign-def.js +1 -1
  126. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  127. package/dist/sdk/engage/types/template-schema.js +1 -1
  128. package/dist/sdk/engage.js +1 -1
  129. package/dist/sdk/errors.js +1 -1
  130. package/dist/sdk/index.js +1 -1
  131. package/dist/sdk/io/index.js +1 -1
  132. package/dist/sdk/io/node-filesystem.js +1 -1
  133. package/dist/sdk/job.js +1 -1
  134. package/dist/sdk/journey.js +1 -1
  135. package/dist/sdk/llm/chat-cache.js +1 -1
  136. package/dist/sdk/llm/index.js +1 -1
  137. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  138. package/dist/sdk/llm/model-factors.js +1 -1
  139. package/dist/sdk/personalization.js +1 -1
  140. package/dist/sdk/policy.js +1 -1
  141. package/dist/sdk/query/index.js +1 -1
  142. package/dist/sdk/query/sql-parser.js +1 -1
  143. package/dist/sdk/realtime.js +1 -1
  144. package/dist/sdk/schedule.js +1 -1
  145. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  146. package/dist/sdk/segment/fields-display.js +1 -1
  147. package/dist/sdk/segment/file-discovery.js +1 -1
  148. package/dist/sdk/segment/journey-utils.js +1 -1
  149. package/dist/sdk/segment/journey-validator.js +1 -1
  150. package/dist/sdk/segment/journey-yaml.js +1 -1
  151. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  152. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  153. package/dist/sdk/segment/pull-workflow.js +1 -1
  154. package/dist/sdk/segment/push-recovery.js +1 -1
  155. package/dist/sdk/segment/push-workflow.js +1 -1
  156. package/dist/sdk/segment/resolution-context.js +1 -1
  157. package/dist/sdk/segment/segment-path-parser.js +1 -1
  158. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  159. package/dist/sdk/segment/segment-validator.js +1 -1
  160. package/dist/sdk/segment/target-resolution.js +1 -1
  161. package/dist/sdk/segment/tdx-config.js +1 -1
  162. package/dist/sdk/segment/types/activation-schema.js +1 -1
  163. package/dist/sdk/segment/types/journey-def.js +1 -1
  164. package/dist/sdk/segment/types/journey-schema.js +1 -1
  165. package/dist/sdk/segment/types/segment-def.js +1 -1
  166. package/dist/sdk/segment/types/segment-schema.js +1 -1
  167. package/dist/sdk/segment/validate-files.js +1 -1
  168. package/dist/sdk/segment/yaml-validator.js +1 -1
  169. package/dist/sdk/segment.js +1 -1
  170. package/dist/sdk/types/index.d.ts +1 -1
  171. package/dist/sdk/types/index.d.ts.map +1 -1
  172. package/dist/sdk/types/index.js +1 -1
  173. package/dist/sdk/types/progress.js +1 -1
  174. package/dist/sdk/types/workspace.d.ts +42 -19
  175. package/dist/sdk/types/workspace.d.ts.map +1 -1
  176. package/dist/sdk/types/workspace.js +1 -1
  177. package/dist/sdk/types/workspace.js.map +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/sdk/workspace/frontmatter.js +1 -1
  192. package/dist/sdk/workspace/git.d.ts +15 -0
  193. package/dist/sdk/workspace/git.d.ts.map +1 -1
  194. package/dist/sdk/workspace/git.js +1 -1
  195. package/dist/sdk/workspace/git.js.map +1 -1
  196. package/dist/sdk/workspace/index.d.ts +38 -21
  197. package/dist/sdk/workspace/index.d.ts.map +1 -1
  198. package/dist/sdk/workspace/index.js +1 -1
  199. package/dist/sdk/workspace/index.js.map +1 -1
  200. package/dist/sdk/workspace/templates.js +1 -1
  201. package/dist/sdk/workspace/weekly.d.ts +49 -0
  202. package/dist/sdk/workspace/weekly.d.ts.map +1 -0
  203. package/dist/sdk/workspace/weekly.js +1 -0
  204. package/dist/sdk/workspace/weekly.js.map +1 -0
  205. package/dist/sdk/workspace/wikilinks.d.ts +7 -2
  206. package/dist/sdk/workspace/wikilinks.d.ts.map +1 -1
  207. package/dist/sdk/workspace/wikilinks.js +1 -1
  208. package/dist/sdk/workspace/wikilinks.js.map +1 -1
  209. package/dist/test-utils/command-runner.js +1 -1
  210. package/dist/test-utils/factories.js +1 -1
  211. package/dist/test-utils/fixtures.js +1 -1
  212. package/dist/test-utils/http-mock.js +1 -1
  213. package/dist/test-utils/index.js +1 -1
  214. package/dist/utils/async.js +1 -1
  215. package/dist/utils/colors.js +1 -1
  216. package/dist/utils/diff.js +1 -1
  217. package/dist/utils/file-permissions.js +1 -1
  218. package/dist/utils/file-reader.js +1 -1
  219. package/dist/utils/github-releases.js +1 -1
  220. package/dist/utils/global-cache.js +1 -1
  221. package/dist/utils/json-loader.js +1 -1
  222. package/dist/utils/local-cache.js +1 -1
  223. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  224. package/dist/utils/logger/formatters/index.js +1 -1
  225. package/dist/utils/logger/handlers/console-handler.js +1 -1
  226. package/dist/utils/logger/handlers/file-handler.js +1 -1
  227. package/dist/utils/logger/handlers/index.js +1 -1
  228. package/dist/utils/logger/handlers/null-handler.js +1 -1
  229. package/dist/utils/logger/index.js +1 -1
  230. package/dist/utils/logger/logger.js +1 -1
  231. package/dist/utils/logger/types.js +1 -1
  232. package/dist/utils/option-validation.js +1 -1
  233. package/dist/utils/process.js +1 -1
  234. package/dist/utils/prompt.js +1 -1
  235. package/dist/utils/spinner.js +1 -1
  236. package/dist/utils/sse-parser.js +1 -1
  237. package/dist/utils/string-utils.js +1 -1
  238. package/dist/utils/table-ref-parser.js +1 -1
  239. package/dist/utils/tdx-logger.js +1 -1
  240. package/dist/utils/version-check.js +1 -1
  241. package/package.json +1 -1
  242. package/dist/sdk/workspace/skills.d.ts +0 -34
  243. package/dist/sdk/workspace/skills.d.ts.map +0 -1
  244. package/dist/sdk/workspace/skills.js +0 -1
  245. package/dist/sdk/workspace/skills.js.map +0 -1
@@ -1 +1 @@
1
- function a58_0x161e(){const _0x42f2cd=['includes','219513qNhnZz','filter','tdx.json','33517VnSNjR','write','8lHRZUS','6dNqfVc','next','startsWith','split','.env.','476788XbYBLu','Warning:\x20Unknown\x20site\x20\x27','read','\x20env\x20var','string','match','stringify','TDX_ACCESS_TOKEN\x20env\x20var','name','ap01','config/llm-project','Warning:\x20Failed\x20to\x20read\x20','accessToken','toISOString','keychain','release_channel','join','source','apiKeys','warn','proxy','TD_API_KEY','llm_default_project','llm_default_agent','slice','path','keychain\x20(profile:\x20','162FFEPSB','endsWith','stable','trim','clear','existsSync','replace','TDX_ACCESS_TOKEN_','toUpperCase','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','476091TgfnzF','apiKey','1225885RwuOOq','ap02','dev-eu01','stg-ap01','TDX_API_KEY_','ap03','parse','some','us01','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','stg-ap03','883905NamBrG','projectId','\x27,\x20defaulting\x20to\x20us01','dev-us01','utf-8','820EtBFjn','TD_API_KEY_','195768OOfBhE','.config','tdx','.json','entries'];a58_0x161e=function(){return _0x42f2cd;};return a58_0x161e();}const a58_0x5df0ac=a58_0x6478;(function(_0x246661,_0x48ef19){const _0x56c617=a58_0x6478,_0x249d6b=_0x246661();while(!![]){try{const _0x709230=parseInt(_0x56c617(0x1aa))/0x1+parseInt(_0x56c617(0x185))/0x2+-parseInt(_0x56c617(0x1b7))/0x3+parseInt(_0x56c617(0x17f))/0x4*(parseInt(_0x56c617(0x1ac))/0x5)+parseInt(_0x56c617(0x180))/0x6*(parseInt(_0x56c617(0x17a))/0x7)+parseInt(_0x56c617(0x1be))/0x8*(-parseInt(_0x56c617(0x1a0))/0x9)+-parseInt(_0x56c617(0x1bc))/0xa*(parseInt(_0x56c617(0x17d))/0xb);if(_0x709230===_0x48ef19)break;else _0x249d6b['push'](_0x249d6b['shift']());}catch(_0x4b0e8e){_0x249d6b['push'](_0x249d6b['shift']());}}}(a58_0x161e,0x3d55f));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a58_0x545a9c from'node:fs';import*as a58_0x3440be 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 a58_0x5cecb6 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x49e0e7=a58_0x6478;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x49e0e7(0x1bf),_0x49e0e7(0x176));}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x74298f){const _0x172286=a58_0x6478,_0xa00fe4=getConfigDir();return _0x74298f?a58_0x3440be[_0x172286(0x195)](_0xa00fe4,_0x172286(0x184)+_0x74298f):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a58_0x5df0ac(0x19b),a58_0x5df0ac(0x18f));export function getLLMProjectCacheFile(_0x3d61f0){const _0x50da9c=a58_0x5df0ac;return llmProjectCache[_0x50da9c(0x19e)](_0x3d61f0);}export function readCachedLLMProject(_0x119c2e){const _0x2a3aa2=a58_0x5df0ac,_0x30d8ca=llmProjectCache[_0x2a3aa2(0x187)](_0x119c2e);if(_0x30d8ca&&typeof _0x30d8ca['id']==='string'&&typeof _0x30d8ca[_0x2a3aa2(0x18d)]==='string')return _0x30d8ca;return null;}export function writeCachedLLMProject(_0x3e2e1b,_0x30547b,_0x606016){const _0x422f24=a58_0x5df0ac;try{llmProjectCache[_0x422f24(0x17e)]({'name':_0x3e2e1b,'id':_0x30547b},_0x606016);}catch{}}const llmAgentCache=createOptionalProfileCache(a58_0x5df0ac(0x19c),'config/llm-agent');export function getLLMAgentCacheFile(_0x43516f){const _0x350740=a58_0x5df0ac;return llmAgentCache[_0x350740(0x19e)](_0x43516f);}export function readCachedLLMAgent(_0x1454ae){const _0x8e221b=a58_0x5df0ac,_0x5c78fa=llmAgentCache[_0x8e221b(0x187)](_0x1454ae);if(_0x5c78fa&&typeof _0x5c78fa['id']===_0x8e221b(0x189)&&typeof _0x5c78fa[_0x8e221b(0x18d)]===_0x8e221b(0x189)&&typeof _0x5c78fa[_0x8e221b(0x1b8)]==='string')return _0x5c78fa;return null;}export function writeCachedLLMAgent(_0x2ed6a2,_0x59ba5b,_0x2948e8,_0x59b5bf){const _0x33d40f=a58_0x5df0ac;try{llmAgentCache[_0x33d40f(0x17e)]({'name':_0x2ed6a2,'id':_0x59ba5b,'projectId':_0x2948e8},_0x59b5bf);}catch{}}export function clearCachedLLMAgent(_0x59776a){const _0x249ad4=a58_0x5df0ac;try{llmAgentCache[_0x249ad4(0x1a4)](_0x59776a);}catch{}}const accountInfoCache=createOptionalProfileCache('account_info','config/account-info',{'suffix':a58_0x5df0ac(0x177)});export function getAccountInfoCacheFile(_0x44c8d0){return accountInfoCache['path'](_0x44c8d0);}export function readCachedAccountInfo(_0x17f73a){const _0x155691=a58_0x5df0ac,_0x5078f9=accountInfoCache['read'](_0x17f73a);if(_0x5078f9&&typeof _0x5078f9['site']===_0x155691(0x189)&&typeof _0x5078f9['accountId']==='number')return _0x5078f9;return null;}export function writeCachedAccountInfo(_0x5d31b6,_0x4b7126,_0x5d290a){const _0x5f1afd=a58_0x5df0ac;try{accountInfoCache[_0x5f1afd(0x17e)]({'site':_0x5d31b6,'accountId':_0x4b7126,'cachedAt':new Date()[_0x5f1afd(0x192)]()},_0x5d290a);}catch{}}export function parseEnvFile(_0xb6f1b5){const _0x7a426b=a58_0x5df0ac,_0xc04452={};for(const _0x4e8d1a of _0xb6f1b5['split']('\x0a')){const _0x3ce349=_0x4e8d1a[_0x7a426b(0x1a3)]();if(!_0x3ce349||_0x3ce349['startsWith']('#'))continue;const _0x42ac43=_0x3ce349[_0x7a426b(0x18a)](/^([^=]+)=(.*)$/);if(_0x42ac43){const _0x1bc52e=_0x42ac43[0x1][_0x7a426b(0x1a3)]();let _0x4c74ba=_0x42ac43[0x2][_0x7a426b(0x1a3)]();(_0x4c74ba[_0x7a426b(0x182)]('\x22')&&_0x4c74ba[_0x7a426b(0x1a1)]('\x22')||_0x4c74ba[_0x7a426b(0x182)]('\x27')&&_0x4c74ba[_0x7a426b(0x1a1)]('\x27'))&&(_0x4c74ba=_0x4c74ba[_0x7a426b(0x19d)](0x1,-0x1)),_0xc04452[_0x1bc52e]=_0x4c74ba;}}return _0xc04452;}export function readUserConfig(){const _0xcfe65=a58_0x5df0ac,_0x523f10=getConfigFile();if(!existsSync(_0x523f10))return{};try{const _0x54e47b=readFileSync(_0x523f10,_0xcfe65(0x1bb));return parseEnvFile(_0x54e47b);}catch(_0x22582d){return console[_0xcfe65(0x198)](_0xcfe65(0x1b5)+_0x523f10+':',_0x22582d),{};}}export function resolveSite(_0x207ba4){const _0x4069bc=a58_0x5df0ac,_0x109439=[_0x4069bc(0x1b4),'ap01','eu01',_0x4069bc(0x1ad),_0x4069bc(0x1b1),_0x4069bc(0x1ba),_0x4069bc(0x1ae),'stg-us01',_0x4069bc(0x1af),_0x4069bc(0x1b6)];if(_0x109439[_0x4069bc(0x179)](_0x207ba4))return _0x207ba4;if(_0x207ba4 in SITE_ALIASES)return SITE_ALIASES[_0x207ba4];return console[_0x4069bc(0x198)](_0x4069bc(0x186)+_0x207ba4+_0x4069bc(0x1b9)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x5d7215){const _0x549a13=a58_0x5df0ac,_0x577725=_0x5d7215||getActiveProfileName()||undefined;if(_0x577725){const _0x35ff51=_0x549a13(0x1a7)+normalizeProfileForEnvVar(_0x577725);if(process.env[_0x35ff51])return{'accessToken':process.env[_0x35ff51],'source':_0x35ff51+_0x549a13(0x188)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x549a13(0x18c)};return null;}export function getAccessToken(_0x3e1818){const _0x1858b9=a58_0x5df0ac;return resolveAccessToken(_0x3e1818)?.[_0x1858b9(0x191)];}export function getAPIKey(_0x186462){const _0x2e6a51=a58_0x5df0ac,_0x192e09=_0x186462||getActiveProfileName();if(_0x192e09){const _0x31dbfb=_0x2e6a51(0x1b0)+normalizeProfileForEnvVar(_0x192e09);if(process.env[_0x31dbfb])return process.env[_0x31dbfb];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x5d9ff7){const _0x292b36=a58_0x5df0ac;return _0x5d9ff7[_0x292b36(0x1a8)]()[_0x292b36(0x1a6)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0xb24691,_0x2a80e7){const _0x2e8585=a58_0x5df0ac,_0x54ab0a=resolveAccessToken(_0x2a80e7);if(_0x54ab0a)return{'apiKey':_0x54ab0a[_0x2e8585(0x191)],'source':_0x54ab0a[_0x2e8585(0x196)],'isDeprecated':![]};const _0x5f3c7f=_0x2a80e7||getActiveProfileName()||undefined;if(_0x5f3c7f){const _0xd52ff=_0x2e8585(0x1b0)+normalizeProfileForEnvVar(_0x5f3c7f);if(process.env[_0xd52ff])return{'apiKey':process.env[_0xd52ff],'source':_0xd52ff+_0x2e8585(0x188),'isDeprecated':![]};const _0x400bc4=getCachedCredential(_0xb24691,_0x5f3c7f);if(_0x400bc4)return{'apiKey':_0x400bc4,'source':_0x2e8585(0x19f)+_0x5f3c7f+')','isDeprecated':![]};const _0x47782b=await getKeychainAPIKey(_0x5f3c7f);if(_0x47782b)return setCachedCredential(_0x47782b,_0xb24691,_0x5f3c7f),{'apiKey':_0x47782b,'source':_0x2e8585(0x19f)+_0x5f3c7f+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':'TDX_API_KEY\x20env\x20var','isDeprecated':![]};if(!_0x5f3c7f){const _0x9fedc9=getCachedCredential(_0xb24691,undefined);if(_0x9fedc9)return{'apiKey':_0x9fedc9,'source':'keychain','isDeprecated':![]};const _0x5d72cb=await getKeychainAPIKey(undefined);if(_0x5d72cb)return setCachedCredential(_0x5d72cb,_0xb24691,undefined),{'apiKey':_0x5d72cb,'source':_0x2e8585(0x193),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x5c38d4,_0xd2d5b9){const _0x2fa816=a58_0x5df0ac,_0x145581=await resolveAPIKeyAsync(_0x5c38d4,_0xd2d5b9);return _0x145581?.[_0x2fa816(0x1ab)];}function cleanupLegacyEnvFile(_0x1f4172){const _0x2678d0=a58_0x5df0ac;if(!existsSync(_0x1f4172))return![];try{const _0x532f20=readFileSync(_0x1f4172,'utf-8'),_0x148340=_0x532f20[_0x2678d0(0x183)]('\x0a'),_0x1c5b9a=_0x148340[_0x2678d0(0x17b)](_0x3b72fe=>{const _0x1f8170=_0x2678d0,_0x12fb5a=_0x3b72fe[_0x1f8170(0x1a3)]();if(!_0x12fb5a||_0x12fb5a[_0x1f8170(0x182)]('#'))return!![];const [_0x48c5e0]=_0x12fb5a[_0x1f8170(0x183)]('=');return!_0x48c5e0[_0x1f8170(0x182)](_0x1f8170(0x19a));}),_0x345106=_0x1c5b9a[_0x2678d0(0x1b3)](_0x17e3ac=>{const _0x53d062=_0x2678d0,_0x2dc34a=_0x17e3ac[_0x53d062(0x1a3)]();return _0x2dc34a&&!_0x2dc34a[_0x53d062(0x182)]('#');});if(!_0x345106)return unlinkSync(_0x1f4172),!![];return writeFileSync(_0x1f4172,_0x1c5b9a[_0x2678d0(0x195)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x559395=a58_0x5df0ac;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x28a498=a58_0x3440be['join'](getConfigDir(),_0x559395(0x17c));if(!a58_0x545a9c[_0x559395(0x1a5)](_0x28a498))return null;try{const _0x479214=a58_0x545a9c['readFileSync'](_0x28a498,_0x559395(0x1bb)),_0x597d62=JSON[_0x559395(0x1b2)](_0x479214);return _0x597d62['profile']||null;}catch{return null;}}export function saveAPIKey(_0x1772a9,_0x1e264a,_0x49c2ae){const _0x4d5a28=a58_0x5df0ac,_0x36997a=getConfigDir(),_0x26715c=getConfigFilePath(_0x49c2ae);!existsSync(_0x36997a)&&mkdirSync(_0x36997a,{'recursive':!![],'mode':0x1c0});let _0x1c431e={};if(existsSync(_0x26715c))try{const _0x2e9d63=readFileSync(_0x26715c,_0x4d5a28(0x1bb));_0x1c431e=parseEnvFile(_0x2e9d63);}catch(_0x57cc5b){console[_0x4d5a28(0x198)](_0x4d5a28(0x190)+_0x26715c+':',_0x57cc5b);}const _0x5820b3=_0x1772a9[_0x4d5a28(0x1a8)]()[_0x4d5a28(0x1a6)](/-/g,'_');_0x1c431e[_0x4d5a28(0x1bd)+_0x5820b3]=_0x1e264a;const _0x482f38=Object[_0x4d5a28(0x178)](_0x1c431e)['map'](([_0x4b19b4,_0x4d2da8])=>_0x4b19b4+'='+_0x4d2da8);writeFileSync(_0x26715c,_0x482f38[_0x4d5a28(0x195)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0xe4bf28,_0x19a86b,_0x3e5070){const _0x5782f3=a58_0x5df0ac;await saveKeychainAPIKey(_0xe4bf28,_0x3e5070),setCachedCredential(_0xe4bf28,_0x19a86b,_0x3e5070);const _0x647c61=getConfigFilePath(_0x3e5070);cleanupLegacyEnvFile(_0x647c61)&&console[_0x5782f3(0x198)](a58_0x5cecb6['yellow'](_0x5782f3(0x1a9)));}export function loadConfig(){const _0x1947fb=a58_0x5df0ac,_0x7c6b1d={'apiKeys':{},'defaultSite':_0x1947fb(0x1b4)},_0x16bf71=[_0x1947fb(0x1b4),_0x1947fb(0x18e),'eu01',_0x1947fb(0x1ad),_0x1947fb(0x1b1),_0x1947fb(0x1ba),_0x1947fb(0x1ae),'stg-us01',_0x1947fb(0x1af),_0x1947fb(0x1b6)],_0x3d3b4e=getAPIKey();if(_0x3d3b4e)for(const _0x52c835 of _0x16bf71){_0x7c6b1d[_0x1947fb(0x197)][_0x52c835]=_0x3d3b4e;}return _0x7c6b1d;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x170d45=a58_0x5df0ac,_0x53cf86=a58_0x3440be[_0x170d45(0x195)](getConfigDir(),'tdx.json');if(!a58_0x545a9c[_0x170d45(0x1a5)](_0x53cf86))return undefined;try{const _0x2e6acd=a58_0x545a9c['readFileSync'](_0x53cf86,_0x170d45(0x1bb)),_0x5c70d5=JSON[_0x170d45(0x1b2)](_0x2e6acd);return typeof _0x5c70d5[_0x170d45(0x199)]===_0x170d45(0x189)?_0x5c70d5[_0x170d45(0x199)]:undefined;}catch{return undefined;}}function a58_0x6478(_0x4f46a7,_0x7fb3c7){_0x4f46a7=_0x4f46a7-0x176;const _0x161e8c=a58_0x161e();let _0x6478a9=_0x161e8c[_0x4f46a7];return _0x6478a9;}export function loadReleaseChannel(){const _0x3c3e83=a58_0x5df0ac,_0x3f4da=process.env.TDX_RELEASE_CHANNEL;if(_0x3f4da===_0x3c3e83(0x181)||_0x3f4da===_0x3c3e83(0x1a2))return _0x3f4da;const _0x246656=a58_0x3440be[_0x3c3e83(0x195)](getConfigDir(),_0x3c3e83(0x17c));if(!a58_0x545a9c[_0x3c3e83(0x1a5)](_0x246656))return _0x3c3e83(0x1a2);try{const _0x23fab7=a58_0x545a9c['readFileSync'](_0x246656,_0x3c3e83(0x1bb)),_0x207099=JSON[_0x3c3e83(0x1b2)](_0x23fab7);if(_0x207099['release_channel']===_0x3c3e83(0x181))return _0x3c3e83(0x181);}catch{}return'stable';}export function saveReleaseChannel(_0x1bd649){const _0x523e7a=a58_0x5df0ac,_0x35573b=getConfigDir(),_0x56553f=a58_0x3440be[_0x523e7a(0x195)](_0x35573b,_0x523e7a(0x17c));!existsSync(_0x35573b)&&mkdirSync(_0x35573b,{'recursive':!![],'mode':0x1c0});let _0x19d691={};if(existsSync(_0x56553f))try{const _0x2eb678=readFileSync(_0x56553f,_0x523e7a(0x1bb));_0x19d691=JSON[_0x523e7a(0x1b2)](_0x2eb678);}catch{}_0x19d691[_0x523e7a(0x194)]=_0x1bd649,writeFileSync(_0x56553f,JSON[_0x523e7a(0x18b)](_0x19d691,null,0x2),{'mode':0x180});}
1
+ const a58_0x33c7eb=a58_0x4d67;(function(_0x1307ce,_0x2246e3){const _0x5db252=a58_0x4d67,_0x1d009c=_0x1307ce();while(!![]){try{const _0x5b1744=parseInt(_0x5db252(0x131))/0x1*(parseInt(_0x5db252(0x152))/0x2)+-parseInt(_0x5db252(0x11e))/0x3+-parseInt(_0x5db252(0x125))/0x4*(-parseInt(_0x5db252(0x142))/0x5)+-parseInt(_0x5db252(0x12f))/0x6+parseInt(_0x5db252(0x109))/0x7+parseInt(_0x5db252(0x13f))/0x8*(-parseInt(_0x5db252(0x145))/0x9)+parseInt(_0x5db252(0x112))/0xa;if(_0x5b1744===_0x2246e3)break;else _0x1d009c['push'](_0x1d009c['shift']());}catch(_0x35cb74){_0x1d009c['push'](_0x1d009c['shift']());}}}(a58_0x4d74,0xd87ae));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a58_0x1dfc50 from'node:fs';import*as a58_0x298cce from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';function a58_0x4d74(){const _0x48dccf=['toUpperCase','proxy','accountId','Warning:\x20Unknown\x20site\x20\x27','filter','ap03','ap01','llm_default_project','stable','startsWith','next','match','40nTUUep','account_info','TDX_API_KEY_','685WEmOvJ','keychain','.env','2737179DtNORp','apiKey','TD_API_KEY','path','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','clear','dev-eu01','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','read','release_channel','yellow','Warning:\x20Failed\x20to\x20read\x20','apiKeys','154136WXdtTn','accessToken','.env.','TDX_ACCESS_TOKEN_','stg-us01','5550748UoShiu','string','join','write','source','includes','profile','warn','dev-us01','6583480hPdXjj','replace','config/llm-agent','endsWith','eu01','map','us01','name','.json','split','\x27,\x20defaulting\x20to\x20us01','stg-ap01','1730739bSSTRa','some','trim','parse','readFileSync','tdx.json','llm_default_agent','24932ZAeStq','entries','config/llm-project','\x20env\x20var','number','utf-8','.config','existsSync','TDX_ACCESS_TOKEN\x20env\x20var','stringify','3786714OHXqQU','stg-ap03','17uYTMFb','ap02'];a58_0x4d74=function(){return _0x48dccf;};return a58_0x4d74();}import a58_0x15e8e4 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x33be55=a58_0x4d67;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x33be55(0x12b),'tdx');}export function getConfigFile(){const _0xa19ea7=a58_0x4d67;return join(getConfigDir(),_0xa19ea7(0x144));}export function getConfigFilePath(_0x26377f){const _0x2ba004=a58_0x4d67,_0x1e8787=getConfigDir();return _0x26377f?a58_0x298cce[_0x2ba004(0x10b)](_0x1e8787,_0x2ba004(0x154)+_0x26377f):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a58_0x33c7eb(0x13a),a58_0x33c7eb(0x127));export function getLLMProjectCacheFile(_0x5b2abb){const _0x244aef=a58_0x33c7eb;return llmProjectCache[_0x244aef(0x148)](_0x5b2abb);}export function readCachedLLMProject(_0xaca216){const _0x59cc39=a58_0x33c7eb,_0x449323=llmProjectCache[_0x59cc39(0x14d)](_0xaca216);if(_0x449323&&typeof _0x449323['id']===_0x59cc39(0x10a)&&typeof _0x449323['name']==='string')return _0x449323;return null;}export function writeCachedLLMProject(_0x22ce98,_0x2b46c9,_0x5db36a){const _0x24c9e2=a58_0x33c7eb;try{llmProjectCache[_0x24c9e2(0x10c)]({'name':_0x22ce98,'id':_0x2b46c9},_0x5db36a);}catch{}}const llmAgentCache=createOptionalProfileCache(a58_0x33c7eb(0x124),a58_0x33c7eb(0x114));export function getLLMAgentCacheFile(_0x8d3523){const _0x296f32=a58_0x33c7eb;return llmAgentCache[_0x296f32(0x148)](_0x8d3523);}export function readCachedLLMAgent(_0x31d69f){const _0x138271=a58_0x33c7eb,_0x175bc5=llmAgentCache[_0x138271(0x14d)](_0x31d69f);if(_0x175bc5&&typeof _0x175bc5['id']===_0x138271(0x10a)&&typeof _0x175bc5[_0x138271(0x119)]==='string'&&typeof _0x175bc5['projectId']==='string')return _0x175bc5;return null;}export function writeCachedLLMAgent(_0x56d76a,_0xd9390f,_0x528269,_0x38b899){try{llmAgentCache['write']({'name':_0x56d76a,'id':_0xd9390f,'projectId':_0x528269},_0x38b899);}catch{}}export function clearCachedLLMAgent(_0x3018cf){const _0x4f54d6=a58_0x33c7eb;try{llmAgentCache[_0x4f54d6(0x14a)](_0x3018cf);}catch{}}const accountInfoCache=createOptionalProfileCache(a58_0x33c7eb(0x140),'config/account-info',{'suffix':a58_0x33c7eb(0x11a)});export function getAccountInfoCacheFile(_0x151bcd){const _0x5267ec=a58_0x33c7eb;return accountInfoCache[_0x5267ec(0x148)](_0x151bcd);}export function readCachedAccountInfo(_0x3f223a){const _0x5d5e00=a58_0x33c7eb,_0x4f1b98=accountInfoCache[_0x5d5e00(0x14d)](_0x3f223a);if(_0x4f1b98&&typeof _0x4f1b98['site']==='string'&&typeof _0x4f1b98[_0x5d5e00(0x135)]===_0x5d5e00(0x129))return _0x4f1b98;return null;}export function writeCachedAccountInfo(_0x251974,_0x32a4ac,_0x47273b){const _0x3c9ff7=a58_0x33c7eb;try{accountInfoCache[_0x3c9ff7(0x10c)]({'site':_0x251974,'accountId':_0x32a4ac,'cachedAt':new Date()['toISOString']()},_0x47273b);}catch{}}export function parseEnvFile(_0x3548b5){const _0x704a=a58_0x33c7eb,_0x3c582f={};for(const _0x395d60 of _0x3548b5[_0x704a(0x11b)]('\x0a')){const _0x5bdba7=_0x395d60['trim']();if(!_0x5bdba7||_0x5bdba7[_0x704a(0x13c)]('#'))continue;const _0x5d065f=_0x5bdba7[_0x704a(0x13e)](/^([^=]+)=(.*)$/);if(_0x5d065f){const _0x16a438=_0x5d065f[0x1][_0x704a(0x120)]();let _0xa47074=_0x5d065f[0x2][_0x704a(0x120)]();(_0xa47074[_0x704a(0x13c)]('\x22')&&_0xa47074[_0x704a(0x115)]('\x22')||_0xa47074[_0x704a(0x13c)]('\x27')&&_0xa47074[_0x704a(0x115)]('\x27'))&&(_0xa47074=_0xa47074['slice'](0x1,-0x1)),_0x3c582f[_0x16a438]=_0xa47074;}}return _0x3c582f;}export function readUserConfig(){const _0x207baf=a58_0x33c7eb,_0x6365b8=getConfigFile();if(!existsSync(_0x6365b8))return{};try{const _0x1e94ce=readFileSync(_0x6365b8,_0x207baf(0x12a));return parseEnvFile(_0x1e94ce);}catch(_0x5bf473){return console[_0x207baf(0x110)](_0x207baf(0x14c)+_0x6365b8+':',_0x5bf473),{};}}export function resolveSite(_0x2e699c){const _0x3d40e7=a58_0x33c7eb,_0x3a8042=[_0x3d40e7(0x118),_0x3d40e7(0x139),_0x3d40e7(0x116),_0x3d40e7(0x132),_0x3d40e7(0x138),_0x3d40e7(0x111),_0x3d40e7(0x14b),_0x3d40e7(0x156),_0x3d40e7(0x11d),_0x3d40e7(0x130)];if(_0x3a8042[_0x3d40e7(0x10e)](_0x2e699c))return _0x2e699c;if(_0x2e699c in SITE_ALIASES)return SITE_ALIASES[_0x2e699c];return console[_0x3d40e7(0x110)](_0x3d40e7(0x136)+_0x2e699c+_0x3d40e7(0x11c)),_0x3d40e7(0x118);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x4b53b4){const _0x41e946=a58_0x33c7eb,_0xb3dcfa=_0x4b53b4||getActiveProfileName()||undefined;if(_0xb3dcfa){const _0x3e18f8=_0x41e946(0x155)+normalizeProfileForEnvVar(_0xb3dcfa);if(process.env[_0x3e18f8])return{'accessToken':process.env[_0x3e18f8],'source':_0x3e18f8+_0x41e946(0x128)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x41e946(0x12d)};return null;}function a58_0x4d67(_0x5cba43,_0x388381){_0x5cba43=_0x5cba43-0x109;const _0x4d7497=a58_0x4d74();let _0x4d6721=_0x4d7497[_0x5cba43];return _0x4d6721;}export function getAccessToken(_0x29edf0){const _0x56880f=a58_0x33c7eb;return resolveAccessToken(_0x29edf0)?.[_0x56880f(0x153)];}export function getAPIKey(_0x483830){const _0x5efee5=a58_0x33c7eb,_0x1363f7=_0x483830||getActiveProfileName();if(_0x1363f7){const _0x4cd6a5=_0x5efee5(0x141)+normalizeProfileForEnvVar(_0x1363f7);if(process.env[_0x4cd6a5])return process.env[_0x4cd6a5];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x352e28){return _0x352e28['toUpperCase']()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x14b4b0,_0x31bfe5){const _0xe247d3=a58_0x33c7eb,_0x3c8572=resolveAccessToken(_0x31bfe5);if(_0x3c8572)return{'apiKey':_0x3c8572[_0xe247d3(0x153)],'source':_0x3c8572[_0xe247d3(0x10d)],'isDeprecated':![]};const _0xbb1801=_0x31bfe5||getActiveProfileName()||undefined;if(_0xbb1801){const _0x38b4a3='TDX_API_KEY_'+normalizeProfileForEnvVar(_0xbb1801);if(process.env[_0x38b4a3])return{'apiKey':process.env[_0x38b4a3],'source':_0x38b4a3+_0xe247d3(0x128),'isDeprecated':![]};const _0x484a06=getCachedCredential(_0x14b4b0,_0xbb1801);if(_0x484a06)return{'apiKey':_0x484a06,'source':'keychain\x20(profile:\x20'+_0xbb1801+')','isDeprecated':![]};const _0x5acb0b=await getKeychainAPIKey(_0xbb1801);if(_0x5acb0b)return setCachedCredential(_0x5acb0b,_0x14b4b0,_0xbb1801),{'apiKey':_0x5acb0b,'source':'keychain\x20(profile:\x20'+_0xbb1801+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':'TDX_API_KEY\x20env\x20var','isDeprecated':![]};if(!_0xbb1801){const _0x2cbbac=getCachedCredential(_0x14b4b0,undefined);if(_0x2cbbac)return{'apiKey':_0x2cbbac,'source':_0xe247d3(0x143),'isDeprecated':![]};const _0x216b39=await getKeychainAPIKey(undefined);if(_0x216b39)return setCachedCredential(_0x216b39,_0x14b4b0,undefined),{'apiKey':_0x216b39,'source':_0xe247d3(0x143),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x5407b9,_0x3f58c9){const _0x54e158=a58_0x33c7eb,_0x188605=await resolveAPIKeyAsync(_0x5407b9,_0x3f58c9);return _0x188605?.[_0x54e158(0x146)];}function cleanupLegacyEnvFile(_0x3b987b){const _0x3dfc5f=a58_0x33c7eb;if(!existsSync(_0x3b987b))return![];try{const _0x1cd4d2=readFileSync(_0x3b987b,_0x3dfc5f(0x12a)),_0x1e85c7=_0x1cd4d2[_0x3dfc5f(0x11b)]('\x0a'),_0x182a8f=_0x1e85c7[_0x3dfc5f(0x137)](_0xa50901=>{const _0x1a3050=_0x3dfc5f,_0x351a6f=_0xa50901[_0x1a3050(0x120)]();if(!_0x351a6f||_0x351a6f['startsWith']('#'))return!![];const [_0x2bbe07]=_0x351a6f[_0x1a3050(0x11b)]('=');return!_0x2bbe07[_0x1a3050(0x13c)](_0x1a3050(0x147));}),_0x420861=_0x182a8f[_0x3dfc5f(0x11f)](_0x553bc2=>{const _0x25133c=_0x3dfc5f,_0x43b3ad=_0x553bc2['trim']();return _0x43b3ad&&!_0x43b3ad[_0x25133c(0x13c)]('#');});if(!_0x420861)return unlinkSync(_0x3b987b),!![];return writeFileSync(_0x3b987b,_0x182a8f['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x370615=a58_0x33c7eb;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x145699=a58_0x298cce['join'](getConfigDir(),'tdx.json');if(!a58_0x1dfc50[_0x370615(0x12c)](_0x145699))return null;try{const _0x43dcc1=a58_0x1dfc50[_0x370615(0x122)](_0x145699,_0x370615(0x12a)),_0x490c15=JSON[_0x370615(0x121)](_0x43dcc1);return _0x490c15[_0x370615(0x10f)]||null;}catch{return null;}}export function saveAPIKey(_0x4f2f2a,_0x210325,_0x50f13f){const _0x2aabd6=a58_0x33c7eb,_0x8a5ad3=getConfigDir(),_0x391395=getConfigFilePath(_0x50f13f);!existsSync(_0x8a5ad3)&&mkdirSync(_0x8a5ad3,{'recursive':!![],'mode':0x1c0});let _0x5aca11={};if(existsSync(_0x391395))try{const _0x12a167=readFileSync(_0x391395,_0x2aabd6(0x12a));_0x5aca11=parseEnvFile(_0x12a167);}catch(_0x5e015f){console[_0x2aabd6(0x110)](_0x2aabd6(0x150)+_0x391395+':',_0x5e015f);}const _0x1811f0=_0x4f2f2a[_0x2aabd6(0x133)]()[_0x2aabd6(0x113)](/-/g,'_');_0x5aca11['TD_API_KEY_'+_0x1811f0]=_0x210325;const _0x18d844=Object[_0x2aabd6(0x126)](_0x5aca11)[_0x2aabd6(0x117)](([_0x5828be,_0x5321e8])=>_0x5828be+'='+_0x5321e8);writeFileSync(_0x391395,_0x18d844['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x3a4357,_0x29520f,_0x587bed){const _0x40eac4=a58_0x33c7eb;await saveKeychainAPIKey(_0x3a4357,_0x587bed),setCachedCredential(_0x3a4357,_0x29520f,_0x587bed);const _0x34c52f=getConfigFilePath(_0x587bed);cleanupLegacyEnvFile(_0x34c52f)&&console['warn'](a58_0x15e8e4[_0x40eac4(0x14f)](_0x40eac4(0x149)));}export function loadConfig(){const _0x1e6e85=a58_0x33c7eb,_0x4690d2={'apiKeys':{},'defaultSite':_0x1e6e85(0x118)},_0x3112d7=[_0x1e6e85(0x118),_0x1e6e85(0x139),_0x1e6e85(0x116),_0x1e6e85(0x132),_0x1e6e85(0x138),_0x1e6e85(0x111),_0x1e6e85(0x14b),_0x1e6e85(0x156),_0x1e6e85(0x11d),_0x1e6e85(0x130)],_0xbdb4bc=getAPIKey();if(_0xbdb4bc)for(const _0x7fe42 of _0x3112d7){_0x4690d2[_0x1e6e85(0x151)][_0x7fe42]=_0xbdb4bc;}return _0x4690d2;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x103921=a58_0x33c7eb,_0x5a512e=a58_0x298cce['join'](getConfigDir(),_0x103921(0x123));if(!a58_0x1dfc50[_0x103921(0x12c)](_0x5a512e))return undefined;try{const _0x11be19=a58_0x1dfc50[_0x103921(0x122)](_0x5a512e,'utf-8'),_0x20ffd4=JSON[_0x103921(0x121)](_0x11be19);return typeof _0x20ffd4[_0x103921(0x134)]===_0x103921(0x10a)?_0x20ffd4[_0x103921(0x134)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x4ead3e=a58_0x33c7eb,_0x48e50e=process.env.TDX_RELEASE_CHANNEL;if(_0x48e50e===_0x4ead3e(0x13d)||_0x48e50e===_0x4ead3e(0x13b))return _0x48e50e;const _0x22c23a=a58_0x298cce[_0x4ead3e(0x10b)](getConfigDir(),_0x4ead3e(0x123));if(!a58_0x1dfc50[_0x4ead3e(0x12c)](_0x22c23a))return'stable';try{const _0xe5df32=a58_0x1dfc50['readFileSync'](_0x22c23a,'utf-8'),_0x392c59=JSON[_0x4ead3e(0x121)](_0xe5df32);if(_0x392c59['release_channel']===_0x4ead3e(0x13d))return _0x4ead3e(0x13d);}catch{}return _0x4ead3e(0x13b);}export function saveReleaseChannel(_0x59eee6){const _0x5cd967=a58_0x33c7eb,_0x457c6a=getConfigDir(),_0x3e1d89=a58_0x298cce['join'](_0x457c6a,_0x5cd967(0x123));!existsSync(_0x457c6a)&&mkdirSync(_0x457c6a,{'recursive':!![],'mode':0x1c0});let _0x5644de={};if(existsSync(_0x3e1d89))try{const _0x151c27=readFileSync(_0x3e1d89,_0x5cd967(0x12a));_0x5644de=JSON['parse'](_0x151c27);}catch{}_0x5644de[_0x5cd967(0x14e)]=_0x59eee6,writeFileSync(_0x3e1d89,JSON[_0x5cd967(0x12e)](_0x5644de,null,0x2),{'mode':0x180});}
@@ -1 +1 @@
1
- const a59_0x555b72=a59_0x5551;(function(_0xb4905e,_0x2b3bbc){const _0x325be7=a59_0x5551,_0x2c0dca=_0xb4905e();while(!![]){try{const _0x825104=parseInt(_0x325be7(0xb4))/0x1+parseInt(_0x325be7(0xb9))/0x2+-parseInt(_0x325be7(0xb3))/0x3*(parseInt(_0x325be7(0xb0))/0x4)+parseInt(_0x325be7(0xb6))/0x5+parseInt(_0x325be7(0xb5))/0x6+parseInt(_0x325be7(0xba))/0x7+-parseInt(_0x325be7(0xb1))/0x8*(parseInt(_0x325be7(0xbb))/0x9);if(_0x825104===_0x2b3bbc)break;else _0x2c0dca['push'](_0x2c0dca['shift']());}catch(_0x26f1f2){_0x2c0dca['push'](_0x2c0dca['shift']());}}}(a59_0x29f4,0x4baa9));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a59_0x555b72(0xad),'core/connection-cache');export function loadCachedConnections(_0x67181b){const _0xab3cc7=a59_0x555b72,_0x76d790=connectionCache[_0xab3cc7(0xae)](_0x67181b);return _0x76d790?.[_0xab3cc7(0xb8)]??null;}export function saveCachedConnections(_0x313b08,_0x18df47){const _0x57beff=a59_0x555b72;connectionCache[_0x57beff(0xb7)](_0x313b08,{'connections':_0x18df47,'cachedAt':Date[_0x57beff(0xb2)]()});}export function clearConnectionCache(_0x93a37f){const _0x36e715=a59_0x555b72;connectionCache[_0x36e715(0xaf)](_0x93a37f);}function a59_0x5551(_0x8cf234,_0x3a993f){_0x8cf234=_0x8cf234-0xad;const _0x29f4eb=a59_0x29f4();let _0x55514c=_0x29f4eb[_0x8cf234];return _0x55514c;}function a59_0x29f4(){const _0x2681fe=['389068XYsAJI','794738PhqTUz','12609MOwHRQ','connections-{profile}.json','read','clear','1506844lBCUXA','2840XoBqjI','now','3KEztLB','227785qdgxIV','2837544wBUAeN','876090VswxpD','write','connections'];a59_0x29f4=function(){return _0x2681fe;};return a59_0x29f4();}
1
+ (function(_0x4f1080,_0x51cc2e){const _0x3c8420=a59_0x23d2,_0x51ae1d=_0x4f1080();while(!![]){try{const _0xc3d920=-parseInt(_0x3c8420(0xe8))/0x1+-parseInt(_0x3c8420(0xe5))/0x2+parseInt(_0x3c8420(0xe9))/0x3+-parseInt(_0x3c8420(0xe7))/0x4+-parseInt(_0x3c8420(0xe2))/0x5+parseInt(_0x3c8420(0xea))/0x6*(-parseInt(_0x3c8420(0xee))/0x7)+-parseInt(_0x3c8420(0xec))/0x8*(-parseInt(_0x3c8420(0xe3))/0x9);if(_0xc3d920===_0x51cc2e)break;else _0x51ae1d['push'](_0x51ae1d['shift']());}catch(_0x4614d2){_0x51ae1d['push'](_0x51ae1d['shift']());}}}(a59_0x52b5,0x950ea));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache('connections-{profile}.json','core/connection-cache');export function loadCachedConnections(_0x3cc947){const _0x313625=a59_0x23d2,_0x3df57c=connectionCache[_0x313625(0xe4)](_0x3cc947);return _0x3df57c?.['connections']??null;}function a59_0x23d2(_0x45b2d0,_0xbf94ef){_0x45b2d0=_0x45b2d0-0xe2;const _0x52b51c=a59_0x52b5();let _0x23d2fd=_0x52b51c[_0x45b2d0];return _0x23d2fd;}export function saveCachedConnections(_0x45511c,_0x49e3a3){const _0x5386f1=a59_0x23d2;connectionCache[_0x5386f1(0xed)](_0x45511c,{'connections':_0x49e3a3,'cachedAt':Date[_0x5386f1(0xe6)]()});}export function clearConnectionCache(_0x136849){const _0x9189d3=a59_0x23d2;connectionCache[_0x9189d3(0xeb)](_0x136849);}function a59_0x52b5(){const _0xa2437=['read','2042700QglahS','now','1658700DNfRCk','1124378PEVzWJ','512811wnfpTx','18pEbiTg','clear','3678440XliYqd','write','1563569GmBFOY','41675CeCGvO','72CDucPo'];a59_0x52b5=function(){return _0xa2437;};return a59_0x52b5();}
@@ -1 +1 @@
1
- const a60_0x1ee2de=a60_0x562c;(function(_0x20fbeb,_0x5b5d22){const _0x2603e4=a60_0x562c,_0x44e09f=_0x20fbeb();while(!![]){try{const _0x28046f=parseInt(_0x2603e4(0xbb))/0x1*(-parseInt(_0x2603e4(0xc3))/0x2)+parseInt(_0x2603e4(0xc7))/0x3+-parseInt(_0x2603e4(0xc5))/0x4+parseInt(_0x2603e4(0xd7))/0x5*(-parseInt(_0x2603e4(0xce))/0x6)+-parseInt(_0x2603e4(0xd6))/0x7+-parseInt(_0x2603e4(0xba))/0x8+parseInt(_0x2603e4(0xcc))/0x9*(parseInt(_0x2603e4(0xbc))/0xa);if(_0x28046f===_0x5b5d22)break;else _0x44e09f['push'](_0x44e09f['shift']());}catch(_0x5bad9d){_0x44e09f['push'](_0x44e09f['shift']());}}}(a60_0x140a,0xe0029));function a60_0x140a(){const _0x3d243a=['ap01','trim','Site\x20name\x20cannot\x20be\x20empty','jp\x20\x20\x20-\x20Japan','Select\x20your\x20Treasure\x20Data\x20site:','5170knPxhF','Enter\x20custom\x20site','2592504yrERPw','ap02','1620846wdatWG','findIndex','Enter\x20site\x20name:','number','site','10165266IhBIGw','other','12vYjCDP','push','log','us01','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','eu01','value','Cancelled','1434258xEyiSK','1351970bpWQRV','text','us\x20\x20\x20-\x20United\x20States','test','select','customSite','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','449456SlXLpH','167EpVbuj','20kAXMZO','ap02\x20-\x20Korea'];a60_0x140a=function(){return _0x3d243a;};return a60_0x140a();}function a60_0x562c(_0x4913c9,_0x48a6c7){_0x4913c9=_0x4913c9-0xb4;const _0x140a85=a60_0x140a();let _0x562c82=_0x140a85[_0x4913c9];return _0x562c82;}import a60_0x43a400 from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x1b61ab,_0x37298d){const _0x412688=a60_0x562c;if(_0x1b61ab===undefined)return _0x37298d;if(typeof _0x1b61ab===_0x412688(0xca))return _0x1b61ab;return parseInt(_0x1b61ab,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a60_0x1ee2de(0xb5),'value':a60_0x1ee2de(0xd1)},{'title':a60_0x1ee2de(0xc1),'value':a60_0x1ee2de(0xbe)},{'title':'eu\x20\x20\x20-\x20Europe','value':a60_0x1ee2de(0xd3)},{'title':a60_0x1ee2de(0xbd),'value':a60_0x1ee2de(0xc6)}];export function buildSiteChoices(_0x461b1d){const _0x363a21=a60_0x1ee2de,_0x16c80d=[...STANDARD_SITE_CHOICES];let _0x14e4ad=_0x16c80d[_0x363a21(0xc8)](_0xc58bfe=>_0xc58bfe[_0x363a21(0xd4)]===_0x461b1d);return _0x14e4ad===-0x1&&_0x461b1d!=='us01'&&(_0x16c80d[_0x363a21(0xcf)]({'title':_0x461b1d,'value':_0x461b1d}),_0x14e4ad=_0x16c80d['length']-0x1),_0x16c80d[_0x363a21(0xcf)]({'title':_0x363a21(0xc4),'value':_0x363a21(0xcd)}),{'choices':_0x16c80d,'initialIndex':_0x14e4ad>=0x0?_0x14e4ad:0x0};}export async function promptSiteSelection(_0x51f7c1,_0x3ab7a0,_0x421a4d=a60_0x1ee2de(0xd5)){const _0x30e17f=a60_0x1ee2de,{choices:_0x283a89,initialIndex:_0x1cbb07}=buildSiteChoices(_0x51f7c1),_0x2ea259=_0x3ab7a0?_0x30e17f(0xd2)+_0x3ab7a0+'):':_0x30e17f(0xc2),_0xb7fb84=await a60_0x43a400({'type':_0x30e17f(0xb7),'name':_0x30e17f(0xcb),'message':_0x2ea259,'choices':_0x283a89,'initial':_0x1cbb07});if(!_0xb7fb84[_0x30e17f(0xcb)])return console['log']('\x0a'+_0x421a4d),null;if(_0xb7fb84[_0x30e17f(0xcb)]!==_0x30e17f(0xcd))return _0xb7fb84[_0x30e17f(0xcb)];const _0x22a577=await a60_0x43a400({'type':_0x30e17f(0xb4),'name':_0x30e17f(0xb8),'message':_0x30e17f(0xc9),'initial':_0x30e17f(0xd1),'validate':_0x4c9191=>{const _0xf6f243=_0x30e17f;if(!_0x4c9191||!_0x4c9191['trim']())return _0xf6f243(0xc0);if(!/^[a-z0-9-]+$/[_0xf6f243(0xb6)](_0x4c9191[_0xf6f243(0xbf)]()))return _0xf6f243(0xb9);return!![];}});if(!_0x22a577[_0x30e17f(0xb8)])return console[_0x30e17f(0xd0)]('\x0a'+_0x421a4d),null;return _0x22a577[_0x30e17f(0xb8)];}
1
+ const a60_0x5d5de6=a60_0x2ccd;(function(_0x57d856,_0x101e95){const _0x344792=a60_0x2ccd,_0x5b51a3=_0x57d856();while(!![]){try{const _0x48d82b=-parseInt(_0x344792(0xcd))/0x1+-parseInt(_0x344792(0xd7))/0x2*(parseInt(_0x344792(0xdd))/0x3)+-parseInt(_0x344792(0xe5))/0x4+-parseInt(_0x344792(0xd3))/0x5+-parseInt(_0x344792(0xe8))/0x6*(-parseInt(_0x344792(0xd4))/0x7)+-parseInt(_0x344792(0xd5))/0x8+parseInt(_0x344792(0xe4))/0x9*(parseInt(_0x344792(0xd9))/0xa);if(_0x48d82b===_0x101e95)break;else _0x5b51a3['push'](_0x5b51a3['shift']());}catch(_0x31e44f){_0x5b51a3['push'](_0x5b51a3['shift']());}}}(a60_0x2983,0x27b0d));import a60_0x1d9dd9 from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;function a60_0x2983(){const _0x7f10c4=['2428616uFygOY','trim','41122DHAwtu','text','3171340NnIYWv','eu01','other','ap02\x20-\x20Korea','30yjOWrs','value','test','us01','Select\x20your\x20Treasure\x20Data\x20site:','Enter\x20custom\x20site','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','27kxLpQK','152516pQxIIm','ap02','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','6XHZoeO','customSite','eu\x20\x20\x20-\x20Europe','findIndex','264270Bdbozg','site','push','us\x20\x20\x20-\x20United\x20States','log','Enter\x20site\x20name:','325185YPZLrV','614558CwhhCO'];a60_0x2983=function(){return _0x7f10c4;};return a60_0x2983();}export const DEFAULT_LISTING_LIMIT=0x2710;function a60_0x2ccd(_0x81d78c,_0x536c90){_0x81d78c=_0x81d78c-0xcc;const _0x29833d=a60_0x2983();let _0x2ccd37=_0x29833d[_0x81d78c];return _0x2ccd37;}export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x12170c,_0x523383){if(_0x12170c===undefined)return _0x523383;if(typeof _0x12170c==='number')return _0x12170c;return parseInt(_0x12170c,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a60_0x5d5de6(0xd0),'value':a60_0x5d5de6(0xe0)},{'title':'jp\x20\x20\x20-\x20Japan','value':'ap01'},{'title':a60_0x5d5de6(0xea),'value':a60_0x5d5de6(0xda)},{'title':a60_0x5d5de6(0xdc),'value':a60_0x5d5de6(0xe6)}];export function buildSiteChoices(_0xd3e79b){const _0x502df2=a60_0x5d5de6,_0x56055d=[...STANDARD_SITE_CHOICES];let _0x21abb7=_0x56055d[_0x502df2(0xcc)](_0x120254=>_0x120254[_0x502df2(0xde)]===_0xd3e79b);return _0x21abb7===-0x1&&_0xd3e79b!==_0x502df2(0xe0)&&(_0x56055d['push']({'title':_0xd3e79b,'value':_0xd3e79b}),_0x21abb7=_0x56055d['length']-0x1),_0x56055d[_0x502df2(0xcf)]({'title':_0x502df2(0xe2),'value':'other'}),{'choices':_0x56055d,'initialIndex':_0x21abb7>=0x0?_0x21abb7:0x0};}export async function promptSiteSelection(_0x5ac0f7,_0x4343ca,_0x277f56='Cancelled'){const _0x1dfd13=a60_0x5d5de6,{choices:_0x5f2ce3,initialIndex:_0x43a5a4}=buildSiteChoices(_0x5ac0f7),_0x5750fd=_0x4343ca?_0x1dfd13(0xe3)+_0x4343ca+'):':_0x1dfd13(0xe1),_0x41230d=await a60_0x1d9dd9({'type':'select','name':_0x1dfd13(0xce),'message':_0x5750fd,'choices':_0x5f2ce3,'initial':_0x43a5a4});if(!_0x41230d[_0x1dfd13(0xce)])return console[_0x1dfd13(0xd1)]('\x0a'+_0x277f56),null;if(_0x41230d[_0x1dfd13(0xce)]!==_0x1dfd13(0xdb))return _0x41230d['site'];const _0x304e7e=await a60_0x1d9dd9({'type':_0x1dfd13(0xd8),'name':_0x1dfd13(0xe9),'message':_0x1dfd13(0xd2),'initial':'us01','validate':_0x10466a=>{const _0x46ade1=_0x1dfd13;if(!_0x10466a||!_0x10466a[_0x46ade1(0xd6)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0x46ade1(0xdf)](_0x10466a[_0x46ade1(0xd6)]()))return _0x46ade1(0xe7);return!![];}});if(!_0x304e7e[_0x1dfd13(0xe9)])return console[_0x1dfd13(0xd1)]('\x0a'+_0x277f56),null;return _0x304e7e['customSite'];}
@@ -1 +1 @@
1
- function a61_0x3017(){const _0x2ac61a=['477885tfCGrX','get','__default_site__','17999610lYYgUL','786946QVLnHl','delete','7911ECsaCZ','set','loadedAt','6918828BWjRDx','apiKey','3384PDTYID','12VOztse','now','3kAVKZA','32454GcBEYk','2078988PbCUeL'];a61_0x3017=function(){return _0x2ac61a;};return a61_0x3017();}(function(_0x105e8f,_0x33d33e){const _0x463174=a61_0x5b1f,_0x236bd5=_0x105e8f();while(!![]){try{const _0x6e0ca5=parseInt(_0x463174(0x1e9))/0x1+parseInt(_0x463174(0x1ef))/0x2*(parseInt(_0x463174(0x1e8))/0x3)+parseInt(_0x463174(0x1e6))/0x4*(parseInt(_0x463174(0x1eb))/0x5)+parseInt(_0x463174(0x1ea))/0x6+parseInt(_0x463174(0x1e3))/0x7+-parseInt(_0x463174(0x1e5))/0x8*(-parseInt(_0x463174(0x1f1))/0x9)+-parseInt(_0x463174(0x1ee))/0xa;if(_0x6e0ca5===_0x33d33e)break;else _0x236bd5['push'](_0x236bd5['shift']());}catch(_0x5a7e85){_0x236bd5['push'](_0x236bd5['shift']());}}}(a61_0x3017,0x97398));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a61_0x5b1f(_0x595686,_0x5c34cb){_0x595686=_0x595686-0x1e3;const _0x30170f=a61_0x3017();let _0x5b1f4e=_0x30170f[_0x595686];return _0x5b1f4e;}function getCacheKey(_0x33ec3b,_0x3c9e66){const _0x1e71e8=a61_0x5b1f,_0x1baca7=_0x33ec3b||_0x1e71e8(0x1ed),_0x4e21fb=_0x3c9e66||'__default_profile__';return _0x1baca7+':'+_0x4e21fb;}export function getCachedCredential(_0x29568f,_0x5e9c18){const _0x3aa835=a61_0x5b1f,_0xf87d98=getCacheKey(_0x29568f,_0x5e9c18),_0xfdc7be=cache[_0x3aa835(0x1ec)](_0xf87d98);if(!_0xfdc7be)return null;if(Date[_0x3aa835(0x1e7)]()-_0xfdc7be[_0x3aa835(0x1f3)]>CACHE_TTL_MS)return cache[_0x3aa835(0x1f0)](_0xf87d98),null;return _0xfdc7be[_0x3aa835(0x1e4)];}export function setCachedCredential(_0xbdcd29,_0x7e35fd,_0x959923){const _0x3af657=a61_0x5b1f,_0x274caf=getCacheKey(_0x7e35fd,_0x959923);cache[_0x3af657(0x1f2)](_0x274caf,{'apiKey':_0xbdcd29,'loadedAt':Date[_0x3af657(0x1e7)]()});}export function clearCredentialCache(){cache['clear']();}export function clearCachedCredential(_0x52e820,_0x21427b){const _0x174143=a61_0x5b1f,_0x37e222=getCacheKey(_0x52e820,_0x21427b);cache[_0x174143(0x1f0)](_0x37e222);}
1
+ (function(_0xb13c24,_0x38988f){const _0x137299=a61_0x41ee,_0x4f29e5=_0xb13c24();while(!![]){try{const _0x322e45=parseInt(_0x137299(0xb0))/0x1+parseInt(_0x137299(0xa1))/0x2*(parseInt(_0x137299(0xa2))/0x3)+-parseInt(_0x137299(0xae))/0x4+-parseInt(_0x137299(0xac))/0x5+parseInt(_0x137299(0xb1))/0x6+-parseInt(_0x137299(0xa5))/0x7*(parseInt(_0x137299(0xa7))/0x8)+-parseInt(_0x137299(0xa4))/0x9*(-parseInt(_0x137299(0xad))/0xa);if(_0x322e45===_0x38988f)break;else _0x4f29e5['push'](_0x4f29e5['shift']());}catch(_0x1dc9eb){_0x4f29e5['push'](_0x4f29e5['shift']());}}}(a61_0xc7f4,0x327d2));function a61_0xc7f4(){const _0x29c31f=['15486pMcxjM','get','336177meEkUR','76503RfHkmz','__default_site__','280yUlMBe','apiKey','now','clear','set','1614370WnCUrd','190LKEzaI','1226008ziDyrq','delete','336978vyniht','319692MtvYAF','loadedAt','46YZYiha'];a61_0xc7f4=function(){return _0x29c31f;};return a61_0xc7f4();}const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x3a9077,_0x3e7e23){const _0x43a16f=a61_0x41ee,_0x4f3956=_0x3a9077||_0x43a16f(0xa6),_0x1b80f9=_0x3e7e23||'__default_profile__';return _0x4f3956+':'+_0x1b80f9;}export function getCachedCredential(_0x845a37,_0x3fe1d8){const _0x57529f=a61_0x41ee,_0xfd417c=getCacheKey(_0x845a37,_0x3fe1d8),_0x2aca29=cache[_0x57529f(0xa3)](_0xfd417c);if(!_0x2aca29)return null;if(Date[_0x57529f(0xa9)]()-_0x2aca29[_0x57529f(0xa0)]>CACHE_TTL_MS)return cache[_0x57529f(0xaf)](_0xfd417c),null;return _0x2aca29[_0x57529f(0xa8)];}export function setCachedCredential(_0x49ba92,_0x20b675,_0x194756){const _0x3735d2=a61_0x41ee,_0x6bbc49=getCacheKey(_0x20b675,_0x194756);cache[_0x3735d2(0xab)](_0x6bbc49,{'apiKey':_0x49ba92,'loadedAt':Date[_0x3735d2(0xa9)]()});}export function clearCredentialCache(){const _0x2069ee=a61_0x41ee;cache[_0x2069ee(0xaa)]();}function a61_0x41ee(_0x3a5c65,_0x382764){_0x3a5c65=_0x3a5c65-0xa0;const _0xc7f442=a61_0xc7f4();let _0x41ee8b=_0xc7f442[_0x3a5c65];return _0x41ee8b;}export function clearCachedCredential(_0x4a5c2c,_0x4a67eb){const _0x4bc581=getCacheKey(_0x4a5c2c,_0x4a67eb);cache['delete'](_0x4bc581);}
@@ -1 +1 @@
1
- const a62_0x3e3d1c=a62_0x1c0a;(function(_0x3eb870,_0x3790f8){const _0x995556=a62_0x1c0a,_0x383d16=_0x3eb870();while(!![]){try{const _0x1f1c6e=-parseInt(_0x995556(0x20d))/0x1+parseInt(_0x995556(0x219))/0x2+-parseInt(_0x995556(0x1e6))/0x3*(parseInt(_0x995556(0x21d))/0x4)+-parseInt(_0x995556(0x22d))/0x5*(-parseInt(_0x995556(0x22e))/0x6)+parseInt(_0x995556(0x1e7))/0x7+parseInt(_0x995556(0x21e))/0x8*(parseInt(_0x995556(0x223))/0x9)+parseInt(_0x995556(0x20a))/0xa*(parseInt(_0x995556(0x204))/0xb);if(_0x1f1c6e===_0x3790f8)break;else _0x383d16['push'](_0x383d16['shift']());}catch(_0x24aa93){_0x383d16['push'](_0x383d16['shift']());}}}(a62_0x189a,0x68969));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';function a62_0x1c0a(_0x436306,_0x3f039a){_0x436306=_0x436306-0x1de;const _0x189a5f=a62_0x189a();let _0x1c0ad8=_0x189a5f[_0x436306];return _0x1c0ad8;}import{getOAuthTokens}from'./oauth-keychain.js';import{loadSessionContext,getSessionID}from'./session.js';function a62_0x189a(){const _0x5538d6=['853247xXyleG','.env','INFO','sessionId','configFiles','us01','activeProfile','site','llm_project','composableAudience','logLevel','profile','727724gWHmuG','proxy','Global','cliFlags','52zejXZs','616oRDOzd','createAsync','composable_audience','Profile\x20Credentials','none','85005XPgJer','project','resolveAPIKeyAsync','session','segment_path','assign','.json','llmProject','profileSource','llmAgent','590eQOqrR','2586fKAHLo','(using\x20session:\x20','getSource','env','segmentPath','apiKey','parent_segment','entries','config','join','191409sefiLW','1581853lewCXy','workflow_project','dim','access_token','replace','displayWithSources','Global\x20Credentials','parentSegment','cyan','getParameters','profile:\x20','(session:\x20','readFileSync','[configuration\x20files]','existsSync','profiles','string','layers','log','[context]','parse','profileCredentials','not\x20set','Profile','accessToken','tdx.json','cli','Project','Session','33kHFCNI','database','utf-8','workflowProject','display','global','2477050swClDp','llm_agent','bold'];a62_0x189a=function(){return _0x5538d6;};return a62_0x189a();}import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a62_0xfae1a7 from'node:fs';import*as a62_0x3c6843 from'node:path';import a62_0x37cf82 from'chalk';export class GlobalContext{[a62_0x3e3d1c(0x214)];[a62_0x3e3d1c(0x205)];[a62_0x3e3d1c(0x1e2)];[a62_0x3e3d1c(0x227)];[a62_0x3e3d1c(0x215)];[a62_0x3e3d1c(0x20b)];[a62_0x3e3d1c(0x1e8)];[a62_0x3e3d1c(0x220)];['apiKey'];[a62_0x3e3d1c(0x1ff)];['proxy'];['verbose'];[a62_0x3e3d1c(0x217)];[a62_0x3e3d1c(0x218)];['profileSource']=null;[a62_0x3e3d1c(0x1f8)];['activeProfile'];[a62_0x3e3d1c(0x210)];[a62_0x3e3d1c(0x211)];constructor(_0x32152){const _0x440829=a62_0x3e3d1c;this[_0x440829(0x210)]=getSessionID(_0x32152[_0x440829(0x226)]);const _0x5b8a65=loadSessionContext(_0x32152[_0x440829(0x226)]),_0x12a075=loadProjectConfig(),_0x39ff15=this['loadGlobalConfig']();if(_0x32152[_0x440829(0x218)])this[_0x440829(0x213)]=_0x32152[_0x440829(0x218)],this[_0x440829(0x22b)]=_0x440829(0x201);else{if(_0x5b8a65?.[_0x440829(0x218)])this[_0x440829(0x213)]=_0x5b8a65[_0x440829(0x218)],this[_0x440829(0x22b)]=_0x440829(0x226);else{if(_0x39ff15[_0x440829(0x218)])this['activeProfile']=_0x39ff15[_0x440829(0x218)],this[_0x440829(0x22b)]='config';else process.env.TDX_PROFILE?(this[_0x440829(0x213)]=process.env.TDX_PROFILE,this[_0x440829(0x22b)]=_0x440829(0x1df)):(this[_0x440829(0x213)]=null,this[_0x440829(0x22b)]=null);}}const _0x487d32=this[_0x440829(0x213)]?loadProfile(this[_0x440829(0x213)]):null,_0x169bdf=_0x5a6a17=>{const _0x29c6c5=_0x440829;if(!_0x5a6a17)return{};const _0x435810=_0x5a6a17,_0x3afdd5={};for(const [_0x14dadd,_0x23a8fe]of Object[_0x29c6c5(0x1e3)](_0x435810)){typeof _0x23a8fe===_0x29c6c5(0x1f7)&&(_0x3afdd5[_0x14dadd]=_0x23a8fe);}return _0x3afdd5;},_0x4e6d6d={},_0x32d83f=(_0x4556fc,_0x4d5bf8,_0x26dbad)=>{if(!_0x4556fc)return![];if(_0x26dbad&&_0x4556fc===_0x26dbad)return![];const _0x50910e=_0x5b8a65,_0x235165=_0x12a075,_0x4b4917=_0x487d32?.['config'],_0x108f57=_0x39ff15,_0x1fc302=_0x50910e?.[_0x4d5bf8],_0x5c8669=_0x235165?.[_0x4d5bf8],_0xca0fb9=_0x4b4917?.[_0x4d5bf8],_0x483c25=_0x108f57[_0x4d5bf8];return _0x4556fc!==_0x1fc302&&_0x4556fc!==_0x5c8669&&_0x4556fc!==_0xca0fb9&&_0x4556fc!==_0x483c25;},_0x3d0666=[{'optionKey':_0x440829(0x214),'contextKey':_0x440829(0x214),'defaultValue':_0x440829(0x212)},{'optionKey':_0x440829(0x205),'contextKey':_0x440829(0x205)},{'optionKey':_0x440829(0x1ee),'contextKey':_0x440829(0x1e2)},{'optionKey':_0x440829(0x22a),'contextKey':_0x440829(0x215)},{'optionKey':'llmAgent','contextKey':_0x440829(0x20b)},{'optionKey':_0x440829(0x216),'contextKey':'composable_audience'},{'optionKey':_0x440829(0x218),'contextKey':_0x440829(0x218)}];for(const {optionKey:_0x318714,contextKey:_0x101525,defaultValue:_0x2ec95c}of _0x3d0666){const _0x1a5fc8=_0x32152[_0x318714];_0x32d83f(_0x1a5fc8,_0x101525,_0x2ec95c)&&(_0x4e6d6d[_0x101525]=_0x1a5fc8);}this[_0x440829(0x1f8)]={'cliFlags':_0x4e6d6d,'session':_0x169bdf(_0x5b8a65),'project':_0x169bdf(_0x12a075),'profile':_0x169bdf(_0x487d32?.[_0x440829(0x1e4)]),'global':_0x169bdf(_0x39ff15)};const _0x1804a={...this['layers'][_0x440829(0x209)],...this[_0x440829(0x1f8)]['profile'],...this[_0x440829(0x1f8)][_0x440829(0x224)]};process.env.TDX_SITE&&!this['layers'][_0x440829(0x226)]['site']&&!this[_0x440829(0x1f8)][_0x440829(0x21c)][_0x440829(0x214)]&&(_0x1804a[_0x440829(0x214)]=process.env.TDX_SITE);Object[_0x440829(0x228)](_0x1804a,this[_0x440829(0x1f8)][_0x440829(0x226)]),Object[_0x440829(0x228)](_0x1804a,this[_0x440829(0x1f8)][_0x440829(0x21c)]);const _0x2e92b5=_0x1804a[_0x440829(0x214)]||_0x440829(0x212);this[_0x440829(0x214)]=resolveSite(_0x2e92b5),this[_0x440829(0x205)]=_0x1804a[_0x440829(0x205)],this[_0x440829(0x1e2)]=_0x1804a[_0x440829(0x1e2)],this[_0x440829(0x227)]=_0x1804a[_0x440829(0x227)],this[_0x440829(0x215)]=_0x1804a[_0x440829(0x215)],this[_0x440829(0x20b)]=_0x1804a[_0x440829(0x20b)],this['workflow_project']=_0x1804a[_0x440829(0x1e8)],this[_0x440829(0x220)]=_0x1804a['composable_audience'],this['verbose']=_0x32152['verbose']||![],this[_0x440829(0x217)]=_0x32152[_0x440829(0x217)]??LogLevel[_0x440829(0x20f)],this[_0x440829(0x218)]=this[_0x440829(0x213)]||undefined,this[_0x440829(0x1ff)]=getAccessToken(this['activeProfile']||undefined),this['apiKey']=getAPIKey(this[_0x440829(0x213)]||undefined);const _0xa3e43e=typeof _0x39ff15['proxy']===_0x440829(0x1f7)?_0x39ff15['proxy']:undefined;this[_0x440829(0x21a)]=_0xa3e43e||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x400454=getConfigDir(),_0x46880a=a62_0x3c6843['join'](_0x400454,'sessions',this[_0x440829(0x210)]+_0x440829(0x229)),_0x3efa85=findProjectConfigPath(),_0x3cedf2=a62_0x3c6843['join'](_0x400454,_0x440829(0x200)),_0x289676=a62_0x3c6843[_0x440829(0x1e5)](_0x400454,_0x440829(0x20e));let _0x4e8a43=null,_0x5b4fd1=null;this[_0x440829(0x213)]&&(_0x4e8a43=a62_0x3c6843[_0x440829(0x1e5)](_0x400454,_0x440829(0x1f6),this[_0x440829(0x213)],_0x440829(0x200)),_0x5b4fd1=a62_0x3c6843[_0x440829(0x1e5)](_0x400454,'profiles',this[_0x440829(0x213)],_0x440829(0x20e))),this[_0x440829(0x211)]={'session':a62_0xfae1a7['existsSync'](_0x46880a)?_0x46880a:null,'project':_0x3efa85,'profile':_0x4e8a43&&a62_0xfae1a7[_0x440829(0x1f5)](_0x4e8a43)?_0x4e8a43:null,'profileCredentials':_0x5b4fd1&&a62_0xfae1a7[_0x440829(0x1f5)](_0x5b4fd1)?_0x5b4fd1:null,'global':a62_0xfae1a7['existsSync'](_0x3cedf2)?_0x3cedf2:null,'globalCredentials':a62_0xfae1a7[_0x440829(0x1f5)](_0x289676)?_0x289676:null};}[a62_0x3e3d1c(0x1de)](_0x586565,_0x363736){const _0x3e89b7=a62_0x3e3d1c;if(!_0x363736)return _0x3e89b7(0x1fd);const _0x15662d=_0x363736;if(this['layers']['cliFlags'][_0x586565]===_0x15662d){if(_0x586565==='site'&&_0x15662d==='us01'&&!this[_0x3e89b7(0x1f8)][_0x3e89b7(0x226)]['site']&&!this[_0x3e89b7(0x1f8)][_0x3e89b7(0x224)][_0x3e89b7(0x214)]&&!this[_0x3e89b7(0x1f8)][_0x3e89b7(0x218)][_0x3e89b7(0x214)]&&!this[_0x3e89b7(0x1f8)]['global'][_0x3e89b7(0x214)])return'default';return'CLI\x20flag:\x20--'+_0x586565[_0x3e89b7(0x1eb)](/_/g,'-');}if(this['layers']['session'][_0x586565]===_0x15662d)return _0x3e89b7(0x226);if(this[_0x3e89b7(0x1f8)][_0x3e89b7(0x224)][_0x586565]===_0x15662d)return _0x3e89b7(0x224);if(this[_0x3e89b7(0x1f8)][_0x3e89b7(0x218)][_0x586565]===_0x15662d)return _0x3e89b7(0x1f1)+this['activeProfile'];if(this['layers'][_0x3e89b7(0x209)][_0x586565]===_0x15662d)return'global';return'default';}['loadGlobalConfig'](){const _0x33236e=a62_0x3e3d1c,_0x5c2c70=a62_0x3c6843[_0x33236e(0x1e5)](getConfigDir(),_0x33236e(0x200));if(!a62_0xfae1a7[_0x33236e(0x1f5)](_0x5c2c70))return{};try{const _0x474b9e=a62_0xfae1a7[_0x33236e(0x1f3)](_0x5c2c70,_0x33236e(0x206));return JSON[_0x33236e(0x1fb)](_0x474b9e);}catch{return{};}}['injectIntoOptions'](_0x2104aa){const _0x18b88c=a62_0x3e3d1c;_0x2104aa[_0x18b88c(0x214)]=this[_0x18b88c(0x214)],!_0x2104aa['database']&&this[_0x18b88c(0x205)]&&(_0x2104aa['database']=this[_0x18b88c(0x205)]),!_0x2104aa[_0x18b88c(0x1ee)]&&this[_0x18b88c(0x1e2)]&&(_0x2104aa[_0x18b88c(0x1ee)]=this[_0x18b88c(0x1e2)]),!_0x2104aa[_0x18b88c(0x1e0)]&&this[_0x18b88c(0x227)]&&(_0x2104aa[_0x18b88c(0x1e0)]=this[_0x18b88c(0x227)]),!_0x2104aa[_0x18b88c(0x22a)]&&this[_0x18b88c(0x215)]&&(_0x2104aa[_0x18b88c(0x22a)]=this[_0x18b88c(0x215)]),!_0x2104aa['llmAgent']&&this[_0x18b88c(0x20b)]&&(_0x2104aa[_0x18b88c(0x22c)]=this[_0x18b88c(0x20b)]),!_0x2104aa[_0x18b88c(0x207)]&&this['workflow_project']&&(_0x2104aa['workflowProject']=this[_0x18b88c(0x1e8)]),!_0x2104aa[_0x18b88c(0x216)]&&this[_0x18b88c(0x220)]&&(_0x2104aa['composableAudience']=this[_0x18b88c(0x220)]);}[a62_0x3e3d1c(0x1f0)](){const _0x23c5f9=a62_0x3e3d1c;return[{'key':_0x23c5f9(0x214),'value':this[_0x23c5f9(0x214)]},{'key':'database','value':this[_0x23c5f9(0x205)]},{'key':'parent_segment','value':this[_0x23c5f9(0x1e2)]},{'key':_0x23c5f9(0x227),'value':this[_0x23c5f9(0x227)]},{'key':_0x23c5f9(0x215),'value':this[_0x23c5f9(0x215)]},{'key':_0x23c5f9(0x20b),'value':this[_0x23c5f9(0x20b)]},{'key':_0x23c5f9(0x1e8),'value':this[_0x23c5f9(0x1e8)]},{'key':_0x23c5f9(0x220),'value':this[_0x23c5f9(0x220)]},{'key':_0x23c5f9(0x218),'value':this[_0x23c5f9(0x213)]||undefined}];}[a62_0x3e3d1c(0x208)](){const _0x343ff1=a62_0x3e3d1c;console['log'](a62_0x37cf82[_0x343ff1(0x20c)](_0x343ff1(0x1fa)));for(const {key:_0x28f8a7,value:_0x531563}of this[_0x343ff1(0x1f0)]()){_0x531563&&console[_0x343ff1(0x1f9)](a62_0x37cf82[_0x343ff1(0x1ef)](_0x28f8a7)+':\x20'+_0x531563);}}[a62_0x3e3d1c(0x1ec)](){const _0x5aacf6=a62_0x3e3d1c;console[_0x5aacf6(0x1f9)](a62_0x37cf82['bold']('[context]'));for(const {key:_0x462da7,value:_0x60c13c}of this['getParameters']()){if(_0x60c13c){const _0x55a9a0=_0x462da7===_0x5aacf6(0x218)?'(active)':'('+this[_0x5aacf6(0x1de)](_0x462da7,_0x60c13c)+')';console[_0x5aacf6(0x1f9)](a62_0x37cf82[_0x5aacf6(0x1ef)](_0x462da7)+':\x20'+_0x60c13c+'\x20'+a62_0x37cf82[_0x5aacf6(0x1e9)](_0x55a9a0));}}console[_0x5aacf6(0x1f9)]('\x0a'+a62_0x37cf82[_0x5aacf6(0x20c)](_0x5aacf6(0x1f4)));const _0x5bdfa9=[{'label':_0x5aacf6(0x203),'path':this[_0x5aacf6(0x211)][_0x5aacf6(0x226)],'extra':_0x5aacf6(0x1f2)+this['sessionId']+')'},{'label':_0x5aacf6(0x202),'path':this['configFiles']['project']},{'label':_0x5aacf6(0x1fe),'path':this[_0x5aacf6(0x211)][_0x5aacf6(0x218)]},{'label':_0x5aacf6(0x221),'path':this[_0x5aacf6(0x211)][_0x5aacf6(0x1fc)]},{'label':'Global','path':this[_0x5aacf6(0x211)]['global']},{'label':_0x5aacf6(0x1ed),'path':this[_0x5aacf6(0x211)]['globalCredentials']}];for(const {label:_0xaf58ba,path:_0x5afe44,extra:_0x35d07b}of _0x5bdfa9){if(_0x5afe44)console[_0x5aacf6(0x1f9)](a62_0x37cf82[_0x5aacf6(0x1ef)](_0xaf58ba)+':\x20'+_0x5afe44+'\x20'+a62_0x37cf82['green']('✓')+(_0x35d07b?'\x20'+a62_0x37cf82[_0x5aacf6(0x1e9)](_0x35d07b):''));else{if(_0xaf58ba===_0x5aacf6(0x203))console[_0x5aacf6(0x1f9)](a62_0x37cf82['cyan'](_0xaf58ba)+':\x20'+a62_0x37cf82[_0x5aacf6(0x1e9)](_0x5aacf6(0x222))+'\x20'+a62_0x37cf82[_0x5aacf6(0x1e9)](_0x5aacf6(0x22f)+this[_0x5aacf6(0x210)]+')'));else(_0xaf58ba===_0x5aacf6(0x202)||_0xaf58ba===_0x5aacf6(0x21b))&&console['log'](a62_0x37cf82[_0x5aacf6(0x1ef)](_0xaf58ba)+':\x20'+a62_0x37cf82[_0x5aacf6(0x1e9)](_0x5aacf6(0x222)));}}}async[a62_0x3e3d1c(0x225)](){const _0x1faffc=a62_0x3e3d1c;if(!this[_0x1faffc(0x1ff)]){const _0x25ff7f=await getOAuthTokens(this['activeProfile']||undefined);if(_0x25ff7f)return this[_0x1faffc(0x1ff)]=_0x25ff7f[_0x1faffc(0x1ea)],undefined;}return this[_0x1faffc(0x1e1)]=await getAPIKeyAsync(this[_0x1faffc(0x214)],this['activeProfile']||undefined),this[_0x1faffc(0x1e1)];}static async[a62_0x3e3d1c(0x21f)](_0x3ce5d2){const _0x456231=a62_0x3e3d1c,_0x118723=new GlobalContext(_0x3ce5d2);return await _0x118723[_0x456231(0x225)](),_0x118723;}}
1
+ const a62_0x367e37=a62_0x2ee1;(function(_0x5cd67f,_0x50b96f){const _0x406f59=a62_0x2ee1,_0xcb9edb=_0x5cd67f();while(!![]){try{const _0x3d18e4=-parseInt(_0x406f59(0xdc))/0x1*(parseInt(_0x406f59(0xbf))/0x2)+parseInt(_0x406f59(0xc5))/0x3+parseInt(_0x406f59(0xf8))/0x4*(parseInt(_0x406f59(0xd3))/0x5)+parseInt(_0x406f59(0xd8))/0x6+-parseInt(_0x406f59(0xd5))/0x7*(parseInt(_0x406f59(0x108))/0x8)+parseInt(_0x406f59(0xfc))/0x9+-parseInt(_0x406f59(0x100))/0xa*(parseInt(_0x406f59(0xf1))/0xb);if(_0x3d18e4===_0x50b96f)break;else _0xcb9edb['push'](_0xcb9edb['shift']());}catch(_0x180af4){_0xcb9edb['push'](_0xcb9edb['shift']());}}}(a62_0x2be6,0xe1bfa));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';import{getOAuthTokens}from'./oauth-keychain.js';function a62_0x2ee1(_0x5b9b77,_0x2c1b92){_0x5b9b77=_0x5b9b77-0xbe;const _0x2be654=a62_0x2be6();let _0x2ee115=_0x2be654[_0x5b9b77];return _0x2ee115;}import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';function a62_0x2be6(){const _0x3d1ea0=['2131rzIItU','resolveAPIKeyAsync','Session','session','database','profileSource','llmAgent','profile','cliFlags','parent_segment','sessionId','activeProfile','.env','proxy','profileCredentials','composableAudience','workflowProject','bold','(session:\x20','log','logLevel','1265riWisR','injectIntoOptions','Project','assign','site','tdx.json','loadGlobalConfig','1943680xgisHe','display','us01','readFileSync','12996297tQxHST','.json','join','(active)','116860PWwrqm','configFiles','config','Profile\x20Credentials','apiKey','global','utf-8','verbose','36056sqTxBU','segmentPath','createAsync','replace','dim','382YJxRnE','profiles','workflow_project','getParameters','Global','project','2997450PpBkOm','[configuration\x20files]','composable_audience','cyan','getSource','existsSync','llm_project','Profile','llm_agent','entries','[context]','cli','CLI\x20flag:\x20--','llmProject','10ZOmbCa','not\x20set','2002cioyEo','segment_path','default','3297336jqSNbQ','layers','parentSegment','accessToken'];a62_0x2be6=function(){return _0x3d1ea0;};return a62_0x2be6();}import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a62_0x28b77c from'node:fs';import*as a62_0x1dee04 from'node:path';import a62_0xd6a8a7 from'chalk';export class GlobalContext{[a62_0x367e37(0xf5)];[a62_0x367e37(0xe0)];[a62_0x367e37(0xe5)];['segment_path'];[a62_0x367e37(0xcb)];[a62_0x367e37(0xcd)];[a62_0x367e37(0xc1)];[a62_0x367e37(0xc7)];['apiKey'];[a62_0x367e37(0xdb)];['proxy'];[a62_0x367e37(0x107)];[a62_0x367e37(0xf0)];['profile'];['profileSource']=null;['layers'];[a62_0x367e37(0xe7)];[a62_0x367e37(0xe6)];['configFiles'];constructor(_0x32a084){const _0x1e5a5f=a62_0x367e37;this[_0x1e5a5f(0xe6)]=getSessionID(_0x32a084[_0x1e5a5f(0xdf)]);const _0x4c4e12=loadSessionContext(_0x32a084[_0x1e5a5f(0xdf)]),_0x22a477=loadProjectConfig(),_0x199b78=this[_0x1e5a5f(0xf7)]();if(_0x32a084[_0x1e5a5f(0xe3)])this[_0x1e5a5f(0xe7)]=_0x32a084[_0x1e5a5f(0xe3)],this[_0x1e5a5f(0xe1)]=_0x1e5a5f(0xd0);else{if(_0x4c4e12?.[_0x1e5a5f(0xe3)])this[_0x1e5a5f(0xe7)]=_0x4c4e12[_0x1e5a5f(0xe3)],this[_0x1e5a5f(0xe1)]='session';else{if(_0x199b78[_0x1e5a5f(0xe3)])this['activeProfile']=_0x199b78['profile'],this[_0x1e5a5f(0xe1)]='config';else process.env.TDX_PROFILE?(this['activeProfile']=process.env.TDX_PROFILE,this[_0x1e5a5f(0xe1)]='env'):(this[_0x1e5a5f(0xe7)]=null,this[_0x1e5a5f(0xe1)]=null);}}const _0x323b37=this[_0x1e5a5f(0xe7)]?loadProfile(this['activeProfile']):null,_0x34f03e=_0x43ada0=>{const _0x5c573e=_0x1e5a5f;if(!_0x43ada0)return{};const _0x31413d=_0x43ada0,_0x30a051={};for(const [_0xfc565c,_0x34c490]of Object[_0x5c573e(0xce)](_0x31413d)){typeof _0x34c490==='string'&&(_0x30a051[_0xfc565c]=_0x34c490);}return _0x30a051;},_0x1eb4a8={},_0x409594=(_0x5ddfe4,_0x42e193,_0x1da94a)=>{const _0x37016e=_0x1e5a5f;if(!_0x5ddfe4)return![];if(_0x1da94a&&_0x5ddfe4===_0x1da94a)return![];const _0x16ed35=_0x4c4e12,_0x2610d2=_0x22a477,_0x2c6629=_0x323b37?.[_0x37016e(0x102)],_0x267291=_0x199b78,_0x3ba372=_0x16ed35?.[_0x42e193],_0x1e6ff2=_0x2610d2?.[_0x42e193],_0x5ea51e=_0x2c6629?.[_0x42e193],_0x5b5387=_0x267291[_0x42e193];return _0x5ddfe4!==_0x3ba372&&_0x5ddfe4!==_0x1e6ff2&&_0x5ddfe4!==_0x5ea51e&&_0x5ddfe4!==_0x5b5387;},_0x3087cd=[{'optionKey':'site','contextKey':_0x1e5a5f(0xf5),'defaultValue':_0x1e5a5f(0xfa)},{'optionKey':_0x1e5a5f(0xe0),'contextKey':'database'},{'optionKey':_0x1e5a5f(0xda),'contextKey':_0x1e5a5f(0xe5)},{'optionKey':'llmProject','contextKey':_0x1e5a5f(0xcb)},{'optionKey':_0x1e5a5f(0xe2),'contextKey':'llm_agent'},{'optionKey':_0x1e5a5f(0xeb),'contextKey':'composable_audience'},{'optionKey':_0x1e5a5f(0xe3),'contextKey':_0x1e5a5f(0xe3)}];for(const {optionKey:_0x4fba3b,contextKey:_0x1c0476,defaultValue:_0x95f2c}of _0x3087cd){const _0x99ebff=_0x32a084[_0x4fba3b];_0x409594(_0x99ebff,_0x1c0476,_0x95f2c)&&(_0x1eb4a8[_0x1c0476]=_0x99ebff);}this[_0x1e5a5f(0xd9)]={'cliFlags':_0x1eb4a8,'session':_0x34f03e(_0x4c4e12),'project':_0x34f03e(_0x22a477),'profile':_0x34f03e(_0x323b37?.['config']),'global':_0x34f03e(_0x199b78)};const _0xe77923={...this[_0x1e5a5f(0xd9)][_0x1e5a5f(0x105)],...this[_0x1e5a5f(0xd9)]['profile'],...this[_0x1e5a5f(0xd9)][_0x1e5a5f(0xc4)]};process.env.TDX_SITE&&!this['layers'][_0x1e5a5f(0xdf)][_0x1e5a5f(0xf5)]&&!this[_0x1e5a5f(0xd9)]['cliFlags'][_0x1e5a5f(0xf5)]&&(_0xe77923[_0x1e5a5f(0xf5)]=process.env.TDX_SITE);Object[_0x1e5a5f(0xf4)](_0xe77923,this[_0x1e5a5f(0xd9)][_0x1e5a5f(0xdf)]),Object[_0x1e5a5f(0xf4)](_0xe77923,this['layers'][_0x1e5a5f(0xe4)]);const _0x5669b3=_0xe77923['site']||_0x1e5a5f(0xfa);this[_0x1e5a5f(0xf5)]=resolveSite(_0x5669b3),this['database']=_0xe77923[_0x1e5a5f(0xe0)],this[_0x1e5a5f(0xe5)]=_0xe77923[_0x1e5a5f(0xe5)],this[_0x1e5a5f(0xd6)]=_0xe77923['segment_path'],this['llm_project']=_0xe77923['llm_project'],this[_0x1e5a5f(0xcd)]=_0xe77923[_0x1e5a5f(0xcd)],this[_0x1e5a5f(0xc1)]=_0xe77923[_0x1e5a5f(0xc1)],this[_0x1e5a5f(0xc7)]=_0xe77923[_0x1e5a5f(0xc7)],this[_0x1e5a5f(0x107)]=_0x32a084[_0x1e5a5f(0x107)]||![],this['logLevel']=_0x32a084[_0x1e5a5f(0xf0)]??LogLevel['INFO'],this['profile']=this['activeProfile']||undefined,this['accessToken']=getAccessToken(this[_0x1e5a5f(0xe7)]||undefined),this['apiKey']=getAPIKey(this[_0x1e5a5f(0xe7)]||undefined);const _0xeb6fc7=typeof _0x199b78[_0x1e5a5f(0xe9)]==='string'?_0x199b78['proxy']:undefined;this[_0x1e5a5f(0xe9)]=_0xeb6fc7||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x298ad0=getConfigDir(),_0x21c50b=a62_0x1dee04[_0x1e5a5f(0xfe)](_0x298ad0,'sessions',this['sessionId']+_0x1e5a5f(0xfd)),_0x5c0416=findProjectConfigPath(),_0x573c84=a62_0x1dee04[_0x1e5a5f(0xfe)](_0x298ad0,_0x1e5a5f(0xf6)),_0x1ef8e0=a62_0x1dee04[_0x1e5a5f(0xfe)](_0x298ad0,_0x1e5a5f(0xe8));let _0x29281a=null,_0x96e6bd=null;this['activeProfile']&&(_0x29281a=a62_0x1dee04[_0x1e5a5f(0xfe)](_0x298ad0,_0x1e5a5f(0xc0),this[_0x1e5a5f(0xe7)],'tdx.json'),_0x96e6bd=a62_0x1dee04[_0x1e5a5f(0xfe)](_0x298ad0,'profiles',this[_0x1e5a5f(0xe7)],'.env')),this[_0x1e5a5f(0x101)]={'session':a62_0x28b77c[_0x1e5a5f(0xca)](_0x21c50b)?_0x21c50b:null,'project':_0x5c0416,'profile':_0x29281a&&a62_0x28b77c[_0x1e5a5f(0xca)](_0x29281a)?_0x29281a:null,'profileCredentials':_0x96e6bd&&a62_0x28b77c['existsSync'](_0x96e6bd)?_0x96e6bd:null,'global':a62_0x28b77c[_0x1e5a5f(0xca)](_0x573c84)?_0x573c84:null,'globalCredentials':a62_0x28b77c['existsSync'](_0x1ef8e0)?_0x1ef8e0:null};}[a62_0x367e37(0xc9)](_0x5af20b,_0x326e47){const _0xf0c183=a62_0x367e37;if(!_0x326e47)return _0xf0c183(0xd4);const _0x43b60a=_0x326e47;if(this[_0xf0c183(0xd9)][_0xf0c183(0xe4)][_0x5af20b]===_0x43b60a){if(_0x5af20b===_0xf0c183(0xf5)&&_0x43b60a===_0xf0c183(0xfa)&&!this[_0xf0c183(0xd9)][_0xf0c183(0xdf)][_0xf0c183(0xf5)]&&!this[_0xf0c183(0xd9)][_0xf0c183(0xc4)][_0xf0c183(0xf5)]&&!this[_0xf0c183(0xd9)]['profile'][_0xf0c183(0xf5)]&&!this[_0xf0c183(0xd9)][_0xf0c183(0x105)][_0xf0c183(0xf5)])return _0xf0c183(0xd7);return _0xf0c183(0xd1)+_0x5af20b[_0xf0c183(0x10b)](/_/g,'-');}if(this[_0xf0c183(0xd9)]['session'][_0x5af20b]===_0x43b60a)return _0xf0c183(0xdf);if(this[_0xf0c183(0xd9)][_0xf0c183(0xc4)][_0x5af20b]===_0x43b60a)return _0xf0c183(0xc4);if(this[_0xf0c183(0xd9)]['profile'][_0x5af20b]===_0x43b60a)return'profile:\x20'+this[_0xf0c183(0xe7)];if(this[_0xf0c183(0xd9)][_0xf0c183(0x105)][_0x5af20b]===_0x43b60a)return'global';return _0xf0c183(0xd7);}[a62_0x367e37(0xf7)](){const _0x580ba2=a62_0x367e37,_0x12afb7=a62_0x1dee04[_0x580ba2(0xfe)](getConfigDir(),_0x580ba2(0xf6));if(!a62_0x28b77c['existsSync'](_0x12afb7))return{};try{const _0x460f17=a62_0x28b77c[_0x580ba2(0xfb)](_0x12afb7,_0x580ba2(0x106));return JSON['parse'](_0x460f17);}catch{return{};}}[a62_0x367e37(0xf2)](_0x3e26ae){const _0x2b8ddc=a62_0x367e37;_0x3e26ae['site']=this[_0x2b8ddc(0xf5)],!_0x3e26ae[_0x2b8ddc(0xe0)]&&this[_0x2b8ddc(0xe0)]&&(_0x3e26ae[_0x2b8ddc(0xe0)]=this[_0x2b8ddc(0xe0)]),!_0x3e26ae[_0x2b8ddc(0xda)]&&this['parent_segment']&&(_0x3e26ae[_0x2b8ddc(0xda)]=this[_0x2b8ddc(0xe5)]),!_0x3e26ae[_0x2b8ddc(0x109)]&&this['segment_path']&&(_0x3e26ae['segmentPath']=this['segment_path']),!_0x3e26ae[_0x2b8ddc(0xd2)]&&this['llm_project']&&(_0x3e26ae['llmProject']=this[_0x2b8ddc(0xcb)]),!_0x3e26ae[_0x2b8ddc(0xe2)]&&this['llm_agent']&&(_0x3e26ae[_0x2b8ddc(0xe2)]=this[_0x2b8ddc(0xcd)]),!_0x3e26ae[_0x2b8ddc(0xec)]&&this[_0x2b8ddc(0xc1)]&&(_0x3e26ae[_0x2b8ddc(0xec)]=this[_0x2b8ddc(0xc1)]),!_0x3e26ae[_0x2b8ddc(0xeb)]&&this[_0x2b8ddc(0xc7)]&&(_0x3e26ae['composableAudience']=this[_0x2b8ddc(0xc7)]);}[a62_0x367e37(0xc2)](){const _0x279ee9=a62_0x367e37;return[{'key':_0x279ee9(0xf5),'value':this['site']},{'key':'database','value':this['database']},{'key':'parent_segment','value':this[_0x279ee9(0xe5)]},{'key':_0x279ee9(0xd6),'value':this[_0x279ee9(0xd6)]},{'key':_0x279ee9(0xcb),'value':this[_0x279ee9(0xcb)]},{'key':_0x279ee9(0xcd),'value':this['llm_agent']},{'key':_0x279ee9(0xc1),'value':this[_0x279ee9(0xc1)]},{'key':_0x279ee9(0xc7),'value':this[_0x279ee9(0xc7)]},{'key':_0x279ee9(0xe3),'value':this[_0x279ee9(0xe7)]||undefined}];}[a62_0x367e37(0xf9)](){const _0x2b6f02=a62_0x367e37;console[_0x2b6f02(0xef)](a62_0xd6a8a7[_0x2b6f02(0xed)](_0x2b6f02(0xcf)));for(const {key:_0x126df5,value:_0x58b011}of this[_0x2b6f02(0xc2)]()){_0x58b011&&console[_0x2b6f02(0xef)](a62_0xd6a8a7[_0x2b6f02(0xc8)](_0x126df5)+':\x20'+_0x58b011);}}['displayWithSources'](){const _0x4c0087=a62_0x367e37;console['log'](a62_0xd6a8a7[_0x4c0087(0xed)](_0x4c0087(0xcf)));for(const {key:_0x115d09,value:_0x267c63}of this[_0x4c0087(0xc2)]()){if(_0x267c63){const _0x4afa86=_0x115d09===_0x4c0087(0xe3)?_0x4c0087(0xff):'('+this[_0x4c0087(0xc9)](_0x115d09,_0x267c63)+')';console[_0x4c0087(0xef)](a62_0xd6a8a7[_0x4c0087(0xc8)](_0x115d09)+':\x20'+_0x267c63+'\x20'+a62_0xd6a8a7[_0x4c0087(0xbe)](_0x4afa86));}}console[_0x4c0087(0xef)]('\x0a'+a62_0xd6a8a7[_0x4c0087(0xed)](_0x4c0087(0xc6)));const _0x11c69d=[{'label':_0x4c0087(0xde),'path':this[_0x4c0087(0x101)][_0x4c0087(0xdf)],'extra':_0x4c0087(0xee)+this[_0x4c0087(0xe6)]+')'},{'label':_0x4c0087(0xf3),'path':this[_0x4c0087(0x101)][_0x4c0087(0xc4)]},{'label':_0x4c0087(0xcc),'path':this[_0x4c0087(0x101)]['profile']},{'label':_0x4c0087(0x103),'path':this[_0x4c0087(0x101)][_0x4c0087(0xea)]},{'label':_0x4c0087(0xc3),'path':this['configFiles']['global']},{'label':'Global\x20Credentials','path':this[_0x4c0087(0x101)]['globalCredentials']}];for(const {label:_0x162136,path:_0x5c0c63,extra:_0x4e2617}of _0x11c69d){if(_0x5c0c63)console['log'](a62_0xd6a8a7['cyan'](_0x162136)+':\x20'+_0x5c0c63+'\x20'+a62_0xd6a8a7['green']('✓')+(_0x4e2617?'\x20'+a62_0xd6a8a7['dim'](_0x4e2617):''));else{if(_0x162136===_0x4c0087(0xde))console[_0x4c0087(0xef)](a62_0xd6a8a7[_0x4c0087(0xc8)](_0x162136)+':\x20'+a62_0xd6a8a7['dim']('none')+'\x20'+a62_0xd6a8a7[_0x4c0087(0xbe)]('(using\x20session:\x20'+this['sessionId']+')'));else(_0x162136===_0x4c0087(0xf3)||_0x162136===_0x4c0087(0xc3))&&console[_0x4c0087(0xef)](a62_0xd6a8a7[_0x4c0087(0xc8)](_0x162136)+':\x20'+a62_0xd6a8a7[_0x4c0087(0xbe)]('none'));}}}async['resolveAPIKeyAsync'](){const _0x3a22b0=a62_0x367e37;if(!this[_0x3a22b0(0xdb)]){const _0x49528c=await getOAuthTokens(this[_0x3a22b0(0xe7)]||undefined);if(_0x49528c)return this[_0x3a22b0(0xdb)]=_0x49528c['access_token'],undefined;}return this[_0x3a22b0(0x104)]=await getAPIKeyAsync(this['site'],this[_0x3a22b0(0xe7)]||undefined),this[_0x3a22b0(0x104)];}static async[a62_0x367e37(0x10a)](_0x42f2c9){const _0x47a683=a62_0x367e37,_0x1ee0de=new GlobalContext(_0x42f2c9);return await _0x1ee0de[_0x47a683(0xdd)](),_0x1ee0de;}}
@@ -1 +1 @@
1
- function a63_0x4023(){const _0xf7164e=['994024wRlqQL','System\x20keychain\x20is\x20not\x20available',':api_key','42qIZdTD','value','714052Hylfpm','toLowerCase','not\x20found','restricted','deleteCredential','unavailable','@napi-rs/keyring','profile:','access','tdx','70ALgEnZ','Warning:\x20','__keychain_test__','no\x20matching\x20entry','message','success','getPassword','69942dLxvHZ','216615YsBCgO','46170MOYmCM','not_found','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.','access_denied','error','4786965dPxZbe','not\x20supported','includes','91LpdsjE','could\x20not\x20be\x20found','cannot\x20find'];a63_0x4023=function(){return _0xf7164e;};return a63_0x4023();}const a63_0x430739=a63_0xaa40;function a63_0xaa40(_0x321f96,_0x4a4bea){_0x321f96=_0x321f96-0x101;const _0x4023d0=a63_0x4023();let _0xaa4061=_0x4023d0[_0x321f96];return _0xaa4061;}(function(_0x3f63be,_0xd56e4b){const _0x9155b3=a63_0xaa40,_0x56bd4c=_0x3f63be();while(!![]){try{const _0x32de76=-parseInt(_0x9155b3(0x104))/0x1*(parseInt(_0x9155b3(0x10a))/0x2)+parseInt(_0x9155b3(0x11f))/0x3+-parseInt(_0x9155b3(0x10c))/0x4+parseInt(_0x9155b3(0x116))/0x5*(-parseInt(_0x9155b3(0x11d))/0x6)+parseInt(_0x9155b3(0x11e))/0x7+-parseInt(_0x9155b3(0x107))/0x8+parseInt(_0x9155b3(0x101))/0x9;if(_0x32de76===_0xd56e4b)break;else _0x56bd4c['push'](_0x56bd4c['shift']());}catch(_0x4716d9){_0x56bd4c['push'](_0x56bd4c['shift']());}}}(a63_0x4023,0x1af09));const SERVICE_NAME=a63_0x430739(0x115);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x5d31a9=a63_0x430739;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x535ad3=await import(_0x5d31a9(0x112));return EntryClass=_0x535ad3['Entry'],EntryClass;}catch(_0x35a295){return keyringLoadError=_0x35a295 instanceof Error?_0x35a295:new Error(String(_0x35a295)),null;}}function getAccountName(_0x157234){const _0x4c0ec1=a63_0x430739,_0x5d5193=_0x157234||'';return _0x4c0ec1(0x113)+_0x5d5193+_0x4c0ec1(0x109);}export async function getKeychainAPIKey(_0x470329){const _0x1c3d74=a63_0x430739,_0xd6272e=await getKeychainAPIKeyWithStatus(_0x470329);if(_0xd6272e[_0x1c3d74(0x11b)])return _0xd6272e[_0x1c3d74(0x10b)];return _0xd6272e['reason']===_0x1c3d74(0x122)&&console[_0x1c3d74(0x123)](_0x1c3d74(0x117)+_0xd6272e[_0x1c3d74(0x11a)]),null;}export async function getKeychainAPIKeyWithStatus(_0x4d5085){const _0x255445=a63_0x430739;try{const _0x468e09=await getEntryClass();if(!_0x468e09)return{'success':![],'reason':'unavailable'};const _0x475bcc=getAccountName(_0x4d5085),_0x392312=new _0x468e09(SERVICE_NAME,_0x475bcc),_0x2948b5=_0x392312['getPassword']();if(_0x2948b5)return{'success':!![],'value':_0x2948b5};return{'success':![],'reason':'not_found'};}catch(_0x157968){const _0xf405d8=_0x157968 instanceof Error?_0x157968['message']:String(_0x157968);if(_0xf405d8[_0x255445(0x103)]('-25300')||_0xf405d8[_0x255445(0x10d)]()[_0x255445(0x103)](_0x255445(0x105))||_0xf405d8[_0x255445(0x10d)]()['includes'](_0x255445(0x10e))||_0xf405d8[_0x255445(0x10d)]()[_0x255445(0x103)](_0x255445(0x119)))return{'success':![],'reason':_0x255445(0x120)};if(_0xf405d8[_0x255445(0x103)]('-25293')||_0xf405d8['toLowerCase']()[_0x255445(0x103)](_0x255445(0x10f))||_0xf405d8['toLowerCase']()[_0x255445(0x103)](_0x255445(0x114)))return{'success':![],'reason':_0x255445(0x122),'message':_0x255445(0x121)};return{'success':![],'reason':_0x255445(0x111),'message':_0xf405d8};}}export async function saveKeychainAPIKey(_0x3179fe,_0x498001){const _0x365038=a63_0x430739,_0x4d6fd3=await getEntryClass();if(!_0x4d6fd3)throw new Error(_0x365038(0x108));const _0x46c73d=getAccountName(_0x498001),_0x567d95=new _0x4d6fd3(SERVICE_NAME,_0x46c73d);_0x567d95['setPassword'](_0x3179fe);}export async function deleteKeychainAPIKey(_0x30d4d9){const _0x830e39=a63_0x430739;try{const _0x45284b=await getEntryClass();if(!_0x45284b)return![];const _0x2e816c=getAccountName(_0x30d4d9),_0x1f98e5=new _0x45284b(SERVICE_NAME,_0x2e816c);return _0x1f98e5[_0x830e39(0x110)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x5a8408=a63_0x430739;try{const _0x1c93ab=await getEntryClass();if(!_0x1c93ab)return![];const _0x3eda0d=new _0x1c93ab(SERVICE_NAME,_0x5a8408(0x118));return _0x3eda0d[_0x5a8408(0x11c)](),!![];}catch(_0x2950cb){const _0x279fd7=_0x2950cb instanceof Error?_0x2950cb['message']['toLowerCase']():'';if(_0x279fd7['includes']('not\x20available')||_0x279fd7[_0x5a8408(0x103)](_0x5a8408(0x102))||_0x279fd7[_0x5a8408(0x103)](_0x5a8408(0x106)))return![];return!![];}}
1
+ const a63_0x14b896=a63_0x2cd9;(function(_0x4fc211,_0x3dd063){const _0x5393ea=a63_0x2cd9,_0x6aa9ee=_0x4fc211();while(!![]){try{const _0x2b2959=parseInt(_0x5393ea(0x181))/0x1+-parseInt(_0x5393ea(0x18f))/0x2*(-parseInt(_0x5393ea(0x177))/0x3)+-parseInt(_0x5393ea(0x17a))/0x4+-parseInt(_0x5393ea(0x197))/0x5*(parseInt(_0x5393ea(0x18d))/0x6)+-parseInt(_0x5393ea(0x172))/0x7+-parseInt(_0x5393ea(0x171))/0x8+parseInt(_0x5393ea(0x18c))/0x9*(parseInt(_0x5393ea(0x17f))/0xa);if(_0x2b2959===_0x3dd063)break;else _0x6aa9ee['push'](_0x6aa9ee['shift']());}catch(_0x45fa4a){_0x6aa9ee['push'](_0x6aa9ee['shift']());}}}(a63_0x3e12,0xca870));const SERVICE_NAME=a63_0x14b896(0x173);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x94743e=a63_0x14b896;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x42e4ee=await import(_0x94743e(0x183));return EntryClass=_0x42e4ee[_0x94743e(0x193)],EntryClass;}catch(_0x317402){return keyringLoadError=_0x317402 instanceof Error?_0x317402:new Error(String(_0x317402)),null;}}function getAccountName(_0x22cf4d){const _0x46f701=a63_0x14b896,_0x57c676=_0x22cf4d||'';return _0x46f701(0x185)+_0x57c676+_0x46f701(0x191);}export async function getKeychainAPIKey(_0x150786){const _0x25d018=a63_0x14b896,_0x48870b=await getKeychainAPIKeyWithStatus(_0x150786);if(_0x48870b[_0x25d018(0x18e)])return _0x48870b[_0x25d018(0x194)];return _0x48870b[_0x25d018(0x174)]===_0x25d018(0x182)&&console[_0x25d018(0x196)](_0x25d018(0x175)+_0x48870b[_0x25d018(0x18a)]),null;}export async function getKeychainAPIKeyWithStatus(_0x273a15){const _0x16b644=a63_0x14b896;try{const _0x3a4d4d=await getEntryClass();if(!_0x3a4d4d)return{'success':![],'reason':'unavailable'};const _0x393d09=getAccountName(_0x273a15),_0x58c97c=new _0x3a4d4d(SERVICE_NAME,_0x393d09),_0x3093cf=_0x58c97c[_0x16b644(0x184)]();if(_0x3093cf)return{'success':!![],'value':_0x3093cf};return{'success':![],'reason':_0x16b644(0x186)};}catch(_0x5733e0){const _0x868c89=_0x5733e0 instanceof Error?_0x5733e0['message']:String(_0x5733e0);if(_0x868c89[_0x16b644(0x188)]('-25300')||_0x868c89['toLowerCase']()[_0x16b644(0x188)](_0x16b644(0x187))||_0x868c89['toLowerCase']()[_0x16b644(0x188)](_0x16b644(0x17b))||_0x868c89[_0x16b644(0x17d)]()[_0x16b644(0x188)](_0x16b644(0x192)))return{'success':![],'reason':_0x16b644(0x186)};if(_0x868c89[_0x16b644(0x188)](_0x16b644(0x180))||_0x868c89[_0x16b644(0x17d)]()['includes'](_0x16b644(0x179))||_0x868c89[_0x16b644(0x17d)]()[_0x16b644(0x188)](_0x16b644(0x176)))return{'success':![],'reason':_0x16b644(0x182),'message':'Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.'};return{'success':![],'reason':_0x16b644(0x170),'message':_0x868c89};}}export async function saveKeychainAPIKey(_0x10039c,_0x5d0794){const _0x2af14e=a63_0x14b896,_0x22f134=await getEntryClass();if(!_0x22f134)throw new Error(_0x2af14e(0x190));const _0x41f2ed=getAccountName(_0x5d0794),_0x49b6e9=new _0x22f134(SERVICE_NAME,_0x41f2ed);_0x49b6e9[_0x2af14e(0x195)](_0x10039c);}export async function deleteKeychainAPIKey(_0x184dfc){const _0x4eb694=a63_0x14b896;try{const _0x4dee48=await getEntryClass();if(!_0x4dee48)return![];const _0x455803=getAccountName(_0x184dfc),_0x136f34=new _0x4dee48(SERVICE_NAME,_0x455803);return _0x136f34[_0x4eb694(0x17c)](),!![];}catch{return![];}}function a63_0x2cd9(_0x3ea769,_0x8f3801){_0x3ea769=_0x3ea769-0x170;const _0x3e1236=a63_0x3e12();let _0x2cd962=_0x3e1236[_0x3ea769];return _0x2cd962;}function a63_0x3e12(){const _0x4a670d=['System\x20keychain\x20is\x20not\x20available',':api_key','no\x20matching\x20entry','Entry','value','setPassword','error','55gJdjYZ','unavailable','1389296gZcWOp','1352540wXvBcY','tdx','reason','Warning:\x20','access','530823XhnQfv','not\x20available','restricted','3684108fFBhkT','not\x20found','deleteCredential','toLowerCase','not\x20supported','3521660cybckm','-25293','789113wtVwxn','access_denied','@napi-rs/keyring','getPassword','profile:','not_found','could\x20not\x20be\x20found','includes','__keychain_test__','message','cannot\x20find','36vNvkIo','140322SfVrxd','success','2ZLQham'];a63_0x3e12=function(){return _0x4a670d;};return a63_0x3e12();}export async function isKeychainAvailable(){const _0x1656f2=a63_0x14b896;try{const _0x2eb498=await getEntryClass();if(!_0x2eb498)return![];const _0x133768=new _0x2eb498(SERVICE_NAME,_0x1656f2(0x189));return _0x133768['getPassword'](),!![];}catch(_0x4c73cf){const _0x23b5b5=_0x4c73cf instanceof Error?_0x4c73cf[_0x1656f2(0x18a)][_0x1656f2(0x17d)]():'';if(_0x23b5b5[_0x1656f2(0x188)](_0x1656f2(0x178))||_0x23b5b5['includes'](_0x1656f2(0x17e))||_0x23b5b5[_0x1656f2(0x188)](_0x1656f2(0x18b)))return![];return!![];}}
@@ -1 +1 @@
1
- function a64_0x4c3a(_0x4c8d09,_0x4ac9c7){_0x4c8d09=_0x4c8d09-0x197;const _0x4ea50b=a64_0x4ea5();let _0x4c3a7d=_0x4ea50b[_0x4c8d09];return _0x4c3a7d;}const a64_0x242d0b=a64_0x4c3a;(function(_0x425096,_0x53767c){const _0x230d77=a64_0x4c3a,_0x5434e1=_0x425096();while(!![]){try{const _0x3552b1=-parseInt(_0x230d77(0x1a6))/0x1+-parseInt(_0x230d77(0x197))/0x2+-parseInt(_0x230d77(0x1a5))/0x3+parseInt(_0x230d77(0x19d))/0x4+parseInt(_0x230d77(0x1a1))/0x5+parseInt(_0x230d77(0x1a0))/0x6+parseInt(_0x230d77(0x19b))/0x7;if(_0x3552b1===_0x53767c)break;else _0x5434e1['push'](_0x5434e1['shift']());}catch(_0x387655){_0x5434e1['push'](_0x5434e1['shift']());}}}(a64_0x4ea5,0xc1ed6));function a64_0x4ea5(){const _0x3dc235=['deleteCredential','stringify','12763884OVGvrV','getPassword','3190908GtXKIt','Entry','System\x20keychain\x20is\x20not\x20available','5021814pVsSXN','1810680lLXnmR','tdx','@napi-rs/keyring',':oauth_tokens','4756101FCzqNG','1165652rttTOX','549798EnJYve','profile:'];a64_0x4ea5=function(){return _0x3dc235;};return a64_0x4ea5();}const SERVICE_NAME=a64_0x242d0b(0x1a2);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x137b2c=a64_0x242d0b;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x275620=await import(_0x137b2c(0x1a3));return EntryClass=_0x275620[_0x137b2c(0x19e)],EntryClass;}catch(_0x26f42a){return keyringLoadError=_0x26f42a instanceof Error?_0x26f42a:new Error(String(_0x26f42a)),null;}}function getOAuthAccountName(_0x3c4cd3){const _0x12d4f0=a64_0x242d0b,_0x22b8ad=_0x3c4cd3||'';return _0x12d4f0(0x198)+_0x22b8ad+_0x12d4f0(0x1a4);}export async function saveOAuthTokens(_0x6972d4,_0x52155d){const _0x498be4=a64_0x242d0b,_0x7497f7=await getEntryClass();if(!_0x7497f7)throw new Error(_0x498be4(0x19f));const _0x261a66=getOAuthAccountName(_0x52155d),_0x589b28=new _0x7497f7(SERVICE_NAME,_0x261a66);_0x589b28['setPassword'](JSON[_0x498be4(0x19a)](_0x6972d4));}export async function getOAuthTokens(_0x12c1b0){const _0x3ddb52=a64_0x242d0b;try{const _0x236fdf=await getEntryClass();if(!_0x236fdf)return null;const _0x12c613=getOAuthAccountName(_0x12c1b0),_0x34b838=new _0x236fdf(SERVICE_NAME,_0x12c613),_0x9dbdc7=_0x34b838[_0x3ddb52(0x19c)]();if(_0x9dbdc7)return JSON['parse'](_0x9dbdc7);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x274f55){const _0x2f2c6d=a64_0x242d0b;try{const _0x4475e3=await getEntryClass();if(!_0x4475e3)return![];const _0x1563fa=getOAuthAccountName(_0x274f55),_0xdb2004=new _0x4475e3(SERVICE_NAME,_0x1563fa);return _0xdb2004[_0x2f2c6d(0x199)](),!![];}catch{return![];}}
1
+ const a64_0x1fe63b=a64_0x3eec;(function(_0x303f5d,_0xe18479){const _0x1e3373=a64_0x3eec,_0x23e331=_0x303f5d();while(!![]){try{const _0xce9828=-parseInt(_0x1e3373(0x1e1))/0x1*(parseInt(_0x1e3373(0x1d6))/0x2)+parseInt(_0x1e3373(0x1e2))/0x3+parseInt(_0x1e3373(0x1db))/0x4+-parseInt(_0x1e3373(0x1d5))/0x5+parseInt(_0x1e3373(0x1d9))/0x6*(parseInt(_0x1e3373(0x1da))/0x7)+parseInt(_0x1e3373(0x1d7))/0x8*(parseInt(_0x1e3373(0x1dd))/0x9)+parseInt(_0x1e3373(0x1e5))/0xa*(-parseInt(_0x1e3373(0x1e6))/0xb);if(_0xce9828===_0xe18479)break;else _0x23e331['push'](_0x23e331['shift']());}catch(_0x3571ae){_0x23e331['push'](_0x23e331['shift']());}}}(a64_0x4074,0x2d610));function a64_0x4074(){const _0x79c800=['2213392aeonCe','setPassword','24018ffQlkU','490MKgNYu','356492KWuBth','getPassword','9SjJkdN','parse','Entry','deleteCredential','87729ileBIE','925689OQuaFW','tdx',':oauth_tokens','40OfZNxz','1857658dVEIAh','profile:','27285vJEtGm','2NQMfdD'];a64_0x4074=function(){return _0x79c800;};return a64_0x4074();}function a64_0x3eec(_0xde48d2,_0x526785){_0xde48d2=_0xde48d2-0x1d5;const _0x40749a=a64_0x4074();let _0x3eec5c=_0x40749a[_0xde48d2];return _0x3eec5c;}const SERVICE_NAME=a64_0x1fe63b(0x1e3);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x9b07a=a64_0x1fe63b;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x553e5e=await import('@napi-rs/keyring');return EntryClass=_0x553e5e[_0x9b07a(0x1df)],EntryClass;}catch(_0x1d8a3a){return keyringLoadError=_0x1d8a3a instanceof Error?_0x1d8a3a:new Error(String(_0x1d8a3a)),null;}}function getOAuthAccountName(_0x221e49){const _0x2d7320=a64_0x1fe63b,_0x2d9c7b=_0x221e49||'';return _0x2d7320(0x1e7)+_0x2d9c7b+_0x2d7320(0x1e4);}export async function saveOAuthTokens(_0x436a1c,_0x4a4bf2){const _0x1c6273=a64_0x1fe63b,_0x2147e3=await getEntryClass();if(!_0x2147e3)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x5179ba=getOAuthAccountName(_0x4a4bf2),_0x41af91=new _0x2147e3(SERVICE_NAME,_0x5179ba);_0x41af91[_0x1c6273(0x1d8)](JSON['stringify'](_0x436a1c));}export async function getOAuthTokens(_0x208285){const _0x270321=a64_0x1fe63b;try{const _0x1d2a8b=await getEntryClass();if(!_0x1d2a8b)return null;const _0x4abd9e=getOAuthAccountName(_0x208285),_0x49f936=new _0x1d2a8b(SERVICE_NAME,_0x4abd9e),_0xd8d7b8=_0x49f936[_0x270321(0x1dc)]();if(_0xd8d7b8)return JSON[_0x270321(0x1de)](_0xd8d7b8);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x261ddb){const _0x297262=a64_0x1fe63b;try{const _0x1d5a68=await getEntryClass();if(!_0x1d5a68)return![];const _0x2b88d1=getOAuthAccountName(_0x261ddb),_0x3a0b17=new _0x1d5a68(SERVICE_NAME,_0x2b88d1);return _0x3a0b17[_0x297262(0x1e0)](),!![];}catch{return![];}}
@@ -1 +1 @@
1
- const a65_0x402ac9=a65_0x4f08;(function(_0x3c3ee9,_0x3c7770){const _0x157f42=a65_0x4f08,_0x8a5b97=_0x3c3ee9();while(!![]){try{const _0x621ad8=-parseInt(_0x157f42(0xbf))/0x1*(-parseInt(_0x157f42(0xc1))/0x2)+parseInt(_0x157f42(0xd1))/0x3*(parseInt(_0x157f42(0xe8))/0x4)+parseInt(_0x157f42(0xd5))/0x5+-parseInt(_0x157f42(0xda))/0x6+parseInt(_0x157f42(0xf5))/0x7+parseInt(_0x157f42(0xc9))/0x8+parseInt(_0x157f42(0xcc))/0x9*(-parseInt(_0x157f42(0xea))/0xa);if(_0x621ad8===_0x3c7770)break;else _0x8a5b97['push'](_0x8a5b97['shift']());}catch(_0x39340){_0x8a5b97['push'](_0x8a5b97['shift']());}}}(a65_0x2c99,0x398d4));import*as a65_0x5e8777 from'node:crypto';import*as a65_0x4001c0 from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';const OAUTH_SUPPORTED_SITES=new Set([a65_0x402ac9(0xed),a65_0x402ac9(0xbb),a65_0x402ac9(0xf4),'stg-ap01',a65_0x402ac9(0xef)]);export function isOAuthSupported(_0x579cca){const _0x354f12=a65_0x402ac9;return OAUTH_SUPPORTED_SITES[_0x354f12(0xe9)](_0x579cca);}export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI=a65_0x402ac9(0xc5)+OAUTH_CALLBACK_PORT+a65_0x402ac9(0xf6);export function getOAuthClientId(){return process.env.TD_OAUTH_CLIENT_ID||'tdx';}export function generatePKCEPair(){const _0x2834a1=a65_0x402ac9,_0x5d6824=a65_0x5e8777[_0x2834a1(0xe2)](0x20)[_0x2834a1(0xf3)]('base64url'),_0x48852a=a65_0x5e8777[_0x2834a1(0xd9)]('sha256')['update'](_0x5d6824)[_0x2834a1(0xd2)](_0x2834a1(0xe0));return{'verifier':_0x5d6824,'challenge':_0x48852a};}function a65_0x4f08(_0x1c6a7a,_0x4dce9e){_0x1c6a7a=_0x1c6a7a-0xbb;const _0x2c99aa=a65_0x2c99();let _0x4f085d=_0x2c99aa[_0x1c6a7a];return _0x4f085d;}export function buildAuthorizeURL(_0x215859,_0x1fc781){const _0x284c26=a65_0x402ac9,_0x1115cb=new URL(_0x284c26(0xe4),_0x215859);return _0x1115cb['searchParams'][_0x284c26(0xc7)]('response_type','code'),_0x1115cb[_0x284c26(0xca)]['set'](_0x284c26(0xbc),_0x1fc781[_0x284c26(0xcf)]),_0x1115cb[_0x284c26(0xca)][_0x284c26(0xc7)](_0x284c26(0xdf),_0x1fc781[_0x284c26(0xcb)]),_0x1115cb[_0x284c26(0xca)][_0x284c26(0xc7)](_0x284c26(0xd3),_0x1fc781[_0x284c26(0xd3)]),_0x1115cb['searchParams'][_0x284c26(0xc7)](_0x284c26(0xe5),_0x1fc781[_0x284c26(0xcd)]),_0x1115cb['searchParams'][_0x284c26(0xc7)](_0x284c26(0xbd),_0x284c26(0xc8)),_0x1fc781[_0x284c26(0xc6)]&&_0x1115cb[_0x284c26(0xca)][_0x284c26(0xc7)](_0x284c26(0xc6),_0x1fc781[_0x284c26(0xc6)]),_0x1115cb[_0x284c26(0xf3)]();}export async function postTokenRequest(_0x311deb,_0x1eb75a){const _0x2dd373=a65_0x402ac9,_0x48807f=new URLSearchParams(_0x1eb75a)[_0x2dd373(0xf3)](),_0x4ed066=await fetch(_0x311deb,{'method':_0x2dd373(0xec),'headers':{'Content-Type':_0x2dd373(0xeb)},'body':_0x48807f});if(!_0x4ed066['ok']){const _0x5d8b83=await _0x4ed066[_0x2dd373(0xce)]();throw new Error(_0x2dd373(0xdd)+_0x4ed066['status']+_0x2dd373(0xd8)+_0x5d8b83);}return await _0x4ed066['json']();}export async function exchangeCodeForTokens(_0x2d2725,_0x20d5b2,_0x5d2a47,_0x100e5e){const _0x1c458d=a65_0x402ac9,_0x2daeb5=_0x2d2725+_0x1c458d(0xf1);return postTokenRequest(_0x2daeb5,{'grant_type':_0x1c458d(0xd4),'client_id':getOAuthClientId(),'code':_0x20d5b2,'code_verifier':_0x5d2a47,'redirect_uri':_0x100e5e});}export function startLocalCallbackServer(){const _0x1ed126=a65_0x402ac9;let _0x12168f,_0x4ad2b6;const _0x22ecf7=new Promise((_0x2ecdb5,_0x46518b)=>{_0x12168f=_0x2ecdb5,_0x4ad2b6=_0x46518b;}),_0x47aa6a=a65_0x4001c0[_0x1ed126(0xbe)]((_0x3130a7,_0x3ab3bf)=>{const _0x482e86=_0x1ed126,_0x2aa864=new URL(_0x3130a7['url']||'/',_0x482e86(0xe3));if(_0x2aa864['pathname']!==_0x482e86(0xf6)){_0x3ab3bf[_0x482e86(0xe1)](0x194,{'Content-Type':_0x482e86(0xf9)}),_0x3ab3bf[_0x482e86(0xe6)](_0x482e86(0xde));return;}const _0x4c52da=_0x2aa864[_0x482e86(0xca)][_0x482e86(0xdb)](_0x482e86(0xf7)),_0x4cc740=_0x2aa864[_0x482e86(0xca)][_0x482e86(0xdb)]('state'),_0x3e28b0=_0x2aa864[_0x482e86(0xca)]['get'](_0x482e86(0xf8));if(_0x3e28b0||!_0x4c52da||!_0x4cc740){_0x3ab3bf[_0x482e86(0xe1)](0x190,{'Content-Type':_0x482e86(0xf2)}),_0x3ab3bf[_0x482e86(0xe6)]('<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>'),_0x4ad2b6(new Error(_0x482e86(0xd7)));return;}_0x3ab3bf[_0x482e86(0xe1)](0xc8,{'Content-Type':_0x482e86(0xf2)}),_0x3ab3bf['end'](_0x482e86(0xd0)),_0x12168f({'code':_0x4c52da,'state':_0x4cc740});});_0x47aa6a['on'](_0x1ed126(0xf8),_0x2adf88=>{const _0x578d0b=_0x1ed126;_0x2adf88[_0x578d0b(0xf7)]===_0x578d0b(0xdc)?_0x4ad2b6(new Error(_0x578d0b(0xc4)+OAUTH_CALLBACK_PORT+'\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.')):_0x4ad2b6(new Error('Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20'+_0x2adf88['message']));}),_0x47aa6a[_0x1ed126(0xee)](OAUTH_CALLBACK_PORT,_0x1ed126(0xd6));const _0x349c42=setTimeout(()=>{const _0x5dec5d=_0x1ed126;_0x4ad2b6(new Error(_0x5dec5d(0xf0))),_0x47aa6a['close']();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x22ecf7,'close':()=>{const _0xffa32a=_0x1ed126;clearTimeout(_0x349c42),_0x47aa6a[_0xffa32a(0xe7)]();}};}function a65_0x2c99(){const _0x20dabd=['/oauth/authorize','code_challenge','end','close','76IoYKHW','has','1140tDMikM','application/x-www-form-urlencoded','POST','dev-us01','listen','stg-ap03','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','/oauth/token','text/html','toString','stg-us01','3099439EPzUCZ','/oauth/callback','code','error','text/plain','dev-eu01','client_id','code_challenge_method','createServer','108971zMsMby','OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack','6GvZTfN','waitForCallback','openid\x20email\x20profile','Port\x20','http://localhost:','scope','set','S256','2085920OOTQaI','searchParams','redirectUri','94158mGVqJw','codeChallenge','text','clientId','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','47451axEyca','digest','state','authorization_code','711940JxIdmA','127.0.0.1','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','):\x20','createHash','269646TaVRLb','get','EADDRINUSE','OAuth\x20token\x20request\x20failed\x20(','Not\x20Found','redirect_uri','base64url','writeHead','randomBytes','http://127.0.0.1'];a65_0x2c99=function(){return _0x20dabd;};return a65_0x2c99();}export async function startOAuthFlow(_0xa76948){const _0x37caee=a65_0x402ac9,_0xe1b52b=getConsoleUrl(_0xa76948),_0x22b783=getOAuthClientId(),{verifier:_0x53c46a,challenge:_0x248e5f}=generatePKCEPair(),_0x34da93=a65_0x5e8777[_0x37caee(0xe2)](0x10)['toString']('hex'),_0x45fd9f=startLocalCallbackServer();try{const _0x33720d=OAUTH_REDIRECT_URI,_0x1a59a0=buildAuthorizeURL(_0xe1b52b,{'clientId':_0x22b783,'redirectUri':_0x33720d,'state':_0x34da93,'codeChallenge':_0x248e5f,'scope':_0x37caee(0xc3)});openBrowser(_0x1a59a0);const _0x2733cd=await _0x45fd9f[_0x37caee(0xc2)]();if(_0x2733cd[_0x37caee(0xd3)]!==_0x34da93)throw new Error(_0x37caee(0xc0));return await exchangeCodeForTokens(_0xe1b52b,_0x2733cd[_0x37caee(0xf7)],_0x53c46a,_0x33720d);}finally{_0x45fd9f[_0x37caee(0xe7)]();}}
1
+ const a65_0x58e58d=a65_0x403f;(function(_0x581012,_0x2abef4){const _0x58295d=a65_0x403f,_0x292d52=_0x581012();while(!![]){try{const _0x54dbe8=-parseInt(_0x58295d(0x169))/0x1*(parseInt(_0x58295d(0x18e))/0x2)+-parseInt(_0x58295d(0x158))/0x3+parseInt(_0x58295d(0x181))/0x4*(-parseInt(_0x58295d(0x189))/0x5)+parseInt(_0x58295d(0x183))/0x6+-parseInt(_0x58295d(0x16a))/0x7+parseInt(_0x58295d(0x15e))/0x8+parseInt(_0x58295d(0x17b))/0x9;if(_0x54dbe8===_0x2abef4)break;else _0x292d52['push'](_0x292d52['shift']());}catch(_0x4e3cf4){_0x292d52['push'](_0x292d52['shift']());}}}(a65_0x9eca,0x22982));import*as a65_0x549173 from'node:crypto';import*as a65_0x15e6a1 from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';const OAUTH_SUPPORTED_SITES=new Set([a65_0x58e58d(0x170),a65_0x58e58d(0x174),a65_0x58e58d(0x18f),'stg-ap01',a65_0x58e58d(0x16e)]);export function isOAuthSupported(_0x4a4d89){return OAUTH_SUPPORTED_SITES['has'](_0x4a4d89);}export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI=a65_0x58e58d(0x164)+OAUTH_CALLBACK_PORT+'/oauth/callback';export function getOAuthClientId(){const _0x2d9c40=a65_0x58e58d;return process.env.TD_OAUTH_CLIENT_ID||_0x2d9c40(0x162);}function a65_0x403f(_0x54da1c,_0x2bb01e){_0x54da1c=_0x54da1c-0x157;const _0x9eca70=a65_0x9eca();let _0x403f9f=_0x9eca70[_0x54da1c];return _0x403f9f;}export function generatePKCEPair(){const _0x4db5a9=a65_0x58e58d,_0x49135f=a65_0x549173['randomBytes'](0x20)[_0x4db5a9(0x187)]('base64url'),_0x3ba82d=a65_0x549173['createHash'](_0x4db5a9(0x188))[_0x4db5a9(0x178)](_0x49135f)['digest'](_0x4db5a9(0x17a));return{'verifier':_0x49135f,'challenge':_0x3ba82d};}function a65_0x9eca(){const _0x3eb102=['OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','codeChallenge','stg-ap03','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','dev-us01','Port\x20','code','pathname','dev-eu01','searchParams','OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack','code_challenge_method','update','close','base64url','2874474wFweBE','status','/oauth/token','127.0.0.1','S256','message','469948sopfCs','json','1002504zVOrEY','writeHead','get','waitForCallback','toString','sha256','5RyWFpe','end','state','redirect_uri','text/html','8kFBdIi','stg-us01','hex','scope','351750vviINb','authorization_code','openid\x20email\x20profile','response_type','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','application/x-www-form-urlencoded','1297376KbdUqA','code_challenge','text/plain','clientId','tdx','client_id','http://localhost:','set','):\x20','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','error','53663maMOje','402885yYcZJz','listen'];a65_0x9eca=function(){return _0x3eb102;};return a65_0x9eca();}export function buildAuthorizeURL(_0x8bbc5f,_0x4467e9){const _0x152482=a65_0x58e58d,_0x51a79b=new URL('/oauth/authorize',_0x8bbc5f);return _0x51a79b[_0x152482(0x175)]['set'](_0x152482(0x15b),_0x152482(0x172)),_0x51a79b[_0x152482(0x175)][_0x152482(0x165)](_0x152482(0x163),_0x4467e9[_0x152482(0x161)]),_0x51a79b[_0x152482(0x175)][_0x152482(0x165)](_0x152482(0x18c),_0x4467e9['redirectUri']),_0x51a79b['searchParams']['set'](_0x152482(0x18b),_0x4467e9[_0x152482(0x18b)]),_0x51a79b[_0x152482(0x175)][_0x152482(0x165)](_0x152482(0x15f),_0x4467e9[_0x152482(0x16d)]),_0x51a79b[_0x152482(0x175)][_0x152482(0x165)](_0x152482(0x177),_0x152482(0x17f)),_0x4467e9[_0x152482(0x157)]&&_0x51a79b['searchParams'][_0x152482(0x165)](_0x152482(0x157),_0x4467e9['scope']),_0x51a79b[_0x152482(0x187)]();}export async function postTokenRequest(_0x2d0dd2,_0x559ef0){const _0x2b5839=a65_0x58e58d,_0x32f84f=new URLSearchParams(_0x559ef0)[_0x2b5839(0x187)](),_0x1f71d1=await fetch(_0x2d0dd2,{'method':'POST','headers':{'Content-Type':_0x2b5839(0x15d)},'body':_0x32f84f});if(!_0x1f71d1['ok']){const _0x196c90=await _0x1f71d1['text']();throw new Error('OAuth\x20token\x20request\x20failed\x20('+_0x1f71d1[_0x2b5839(0x17c)]+_0x2b5839(0x166)+_0x196c90);}return await _0x1f71d1[_0x2b5839(0x182)]();}export async function exchangeCodeForTokens(_0x285e60,_0x3fffaf,_0x481c77,_0x582dab){const _0x5edcbb=a65_0x58e58d,_0x542761=_0x285e60+_0x5edcbb(0x17d);return postTokenRequest(_0x542761,{'grant_type':_0x5edcbb(0x159),'client_id':getOAuthClientId(),'code':_0x3fffaf,'code_verifier':_0x481c77,'redirect_uri':_0x582dab});}export function startLocalCallbackServer(){const _0xc030d0=a65_0x58e58d;let _0x3f7469,_0x3ad2b0;const _0x3b0a7e=new Promise((_0x13abce,_0x1a55c5)=>{_0x3f7469=_0x13abce,_0x3ad2b0=_0x1a55c5;}),_0x5120a4=a65_0x15e6a1['createServer']((_0x159fe9,_0x201118)=>{const _0x3b8741=a65_0x403f,_0xb61548=new URL(_0x159fe9['url']||'/','http://127.0.0.1');if(_0xb61548[_0x3b8741(0x173)]!=='/oauth/callback'){_0x201118['writeHead'](0x194,{'Content-Type':_0x3b8741(0x160)}),_0x201118['end']('Not\x20Found');return;}const _0x6aae95=_0xb61548[_0x3b8741(0x175)][_0x3b8741(0x185)](_0x3b8741(0x172)),_0x59fda0=_0xb61548['searchParams'][_0x3b8741(0x185)](_0x3b8741(0x18b)),_0x7f4c32=_0xb61548['searchParams']['get'](_0x3b8741(0x168));if(_0x7f4c32||!_0x6aae95||!_0x59fda0){_0x201118[_0x3b8741(0x184)](0x190,{'Content-Type':'text/html'}),_0x201118[_0x3b8741(0x18a)](_0x3b8741(0x167)),_0x3ad2b0(new Error(_0x3b8741(0x16c)));return;}_0x201118[_0x3b8741(0x184)](0xc8,{'Content-Type':_0x3b8741(0x18d)}),_0x201118[_0x3b8741(0x18a)]('<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>'),_0x3f7469({'code':_0x6aae95,'state':_0x59fda0});});_0x5120a4['on'](_0xc030d0(0x168),_0x1e82d2=>{const _0x4c1cf4=_0xc030d0;_0x1e82d2[_0x4c1cf4(0x172)]==='EADDRINUSE'?_0x3ad2b0(new Error(_0x4c1cf4(0x171)+OAUTH_CALLBACK_PORT+'\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.')):_0x3ad2b0(new Error(_0x4c1cf4(0x16f)+_0x1e82d2[_0x4c1cf4(0x180)]));}),_0x5120a4[_0xc030d0(0x16b)](OAUTH_CALLBACK_PORT,_0xc030d0(0x17e));const _0xe19636=setTimeout(()=>{const _0x376185=_0xc030d0;_0x3ad2b0(new Error(_0x376185(0x15c))),_0x5120a4[_0x376185(0x179)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x3b0a7e,'close':()=>{const _0x492d0e=_0xc030d0;clearTimeout(_0xe19636),_0x5120a4[_0x492d0e(0x179)]();}};}export async function startOAuthFlow(_0x2ff6fe){const _0x5c9da2=a65_0x58e58d,_0x1e28df=getConsoleUrl(_0x2ff6fe),_0x1b27b2=getOAuthClientId(),{verifier:_0x3fc5a9,challenge:_0x412ab6}=generatePKCEPair(),_0x341a94=a65_0x549173['randomBytes'](0x10)['toString'](_0x5c9da2(0x190)),_0x4ef320=startLocalCallbackServer();try{const _0x6593bb=OAUTH_REDIRECT_URI,_0x26eb87=buildAuthorizeURL(_0x1e28df,{'clientId':_0x1b27b2,'redirectUri':_0x6593bb,'state':_0x341a94,'codeChallenge':_0x412ab6,'scope':_0x5c9da2(0x15a)});openBrowser(_0x26eb87);const _0x1bea44=await _0x4ef320[_0x5c9da2(0x186)]();if(_0x1bea44['state']!==_0x341a94)throw new Error(_0x5c9da2(0x176));return await exchangeCodeForTokens(_0x1e28df,_0x1bea44['code'],_0x3fc5a9,_0x6593bb);}finally{_0x4ef320['close']();}}
@@ -1 +1 @@
1
- const a66_0x719578=a66_0x191f;(function(_0x38dc13,_0x357c42){const _0x529ebd=a66_0x191f,_0x3f53e3=_0x38dc13();while(!![]){try{const _0x16bc62=parseInt(_0x529ebd(0xd6))/0x1+-parseInt(_0x529ebd(0xde))/0x2+parseInt(_0x529ebd(0x10c))/0x3*(-parseInt(_0x529ebd(0x101))/0x4)+parseInt(_0x529ebd(0xef))/0x5+-parseInt(_0x529ebd(0x102))/0x6*(parseInt(_0x529ebd(0xc5))/0x7)+-parseInt(_0x529ebd(0xe1))/0x8*(parseInt(_0x529ebd(0xca))/0x9)+-parseInt(_0x529ebd(0xd1))/0xa*(-parseInt(_0x529ebd(0xff))/0xb);if(_0x16bc62===_0x357c42)break;else _0x3f53e3['push'](_0x3f53e3['shift']());}catch(_0xfad94d){_0x3f53e3['push'](_0x3f53e3['shift']());}}}(a66_0x4b3a,0x962e8));import*as a66_0x2af8fd from'node:fs';import*as a66_0x47d82f 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=a66_0x719578(0xf4);export function getProfileParams(_0x52adcc){const _0xfef369=a66_0x719578,_0x3c9758={};if(!_0x52adcc)return _0x3c9758;for(const [_0x5aeefd,_0x12c3ad]of Object['entries'](_0x52adcc)){_0x5aeefd!==_0xfef369(0x105)&&_0x12c3ad!==undefined&&(_0x3c9758[_0x5aeefd]=_0x12c3ad);}return _0x3c9758;}export function getProfilesDir(){const _0x34096c=a66_0x719578;return a66_0x47d82f[_0x34096c(0xfc)](getConfigDir(),_0x34096c(0x111));}function getProfileDir(_0x55a68a){return a66_0x47d82f['join'](getProfilesDir(),_0x55a68a);}function getProfileConfigPath(_0x4664d2){const _0xc608eb=a66_0x719578;return a66_0x47d82f['join'](getProfileDir(_0x4664d2),_0xc608eb(0x112));}function getProfileEnvPath(_0x3033f0){const _0x268cdb=a66_0x719578;return a66_0x47d82f[_0x268cdb(0xfc)](getProfileDir(_0x3033f0),_0x268cdb(0xf5));}function getGlobalConfigPath(){const _0x4de990=a66_0x719578;return a66_0x47d82f[_0x4de990(0xfc)](getConfigDir(),'tdx.json');}function validateProfileName(_0x58e684){const _0x6391d1=a66_0x719578;if(/^@?[a-zA-Z0-9_-]+$/[_0x6391d1(0xda)](_0x58e684))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/['test'](_0x58e684))return;throw new Error(_0x6391d1(0xf2)+_0x58e684+_0x6391d1(0xc6));}function validateProfileConfig(_0x129f8d,_0x4b3915){const _0x3fef63=a66_0x719578;if(typeof _0x129f8d!==_0x3fef63(0xf9)||_0x129f8d===null)throw new SDKError(ErrorCode[_0x3fef63(0xfe)],_0x3fef63(0xd2)+_0x4b3915+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x13943d=[_0x3fef63(0x105),'site',_0x3fef63(0xcf),_0x3fef63(0xf8),_0x3fef63(0x109),_0x3fef63(0x10f),_0x3fef63(0xcc)],_0xb4b16f=_0x129f8d;for(const _0x5a5e07 of Object[_0x3fef63(0xea)](_0xb4b16f)){!_0x13943d[_0x3fef63(0xce)](_0x5a5e07)&&console[_0x3fef63(0x110)](_0x3fef63(0xe9)+_0x4b3915+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x5a5e07+_0x3fef63(0x10d));}if(_0xb4b16f[_0x3fef63(0x105)]!==undefined&&typeof _0xb4b16f[_0x3fef63(0x105)]!==_0x3fef63(0xd3))throw new SDKError(ErrorCode[_0x3fef63(0xfe)],_0x3fef63(0xd2)+_0x4b3915+_0x3fef63(0xc0));if(_0xb4b16f[_0x3fef63(0xd8)]!==undefined&&typeof _0xb4b16f[_0x3fef63(0xd8)]!==_0x3fef63(0xd3))throw new SDKError(ErrorCode[_0x3fef63(0xfe)],_0x3fef63(0xd2)+_0x4b3915+_0x3fef63(0x113));if(_0xb4b16f[_0x3fef63(0xcf)]!==undefined&&typeof _0xb4b16f[_0x3fef63(0xcf)]!==_0x3fef63(0xd3))throw new SDKError(ErrorCode[_0x3fef63(0xfe)],_0x3fef63(0xd2)+_0x4b3915+_0x3fef63(0xe6));if(_0xb4b16f['parent_segment']!==undefined&&typeof _0xb4b16f[_0x3fef63(0xf8)]!==_0x3fef63(0xd3))throw new SDKError(ErrorCode[_0x3fef63(0xfe)],'Profile\x20\x27'+_0x4b3915+_0x3fef63(0xe8));if(_0xb4b16f[_0x3fef63(0x109)]!==undefined&&typeof _0xb4b16f[_0x3fef63(0x109)]!==_0x3fef63(0xd3))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x3fef63(0xd2)+_0x4b3915+_0x3fef63(0xe2));if(_0xb4b16f[_0x3fef63(0x10f)]!==undefined&&typeof _0xb4b16f[_0x3fef63(0x10f)]!==_0x3fef63(0xd3))throw new SDKError(ErrorCode[_0x3fef63(0xfe)],_0x3fef63(0xd2)+_0x4b3915+_0x3fef63(0x104));return!![];}function loadProfilesFromTdxJson(_0x58e646,_0x425cfa){const _0x4a23c9=a66_0x719578;if(!a66_0x2af8fd[_0x4a23c9(0xf7)](_0x58e646))return[];try{const _0x2a22a9=a66_0x2af8fd[_0x4a23c9(0xfd)](_0x58e646,_0x4a23c9(0xeb)),_0x3fe921=JSON[_0x4a23c9(0x10a)](_0x2a22a9);if(!_0x3fe921['profiles']||typeof _0x3fe921['profiles']!==_0x4a23c9(0xf9))return[];const _0x50020f=[];for(const [_0x378ada,_0x4db850]of Object['entries'](_0x3fe921[_0x4a23c9(0x111)])){try{validateProfileConfig(_0x4db850,_0x378ada);const _0x22bfb=getNewCredentialPath(_0x378ada),_0xcc75e3=getOldCredentialPath(_0x378ada),_0x4d6501=a66_0x2af8fd['existsSync'](_0x22bfb)||a66_0x2af8fd['existsSync'](_0xcc75e3);_0x50020f['push']({'name':_0x378ada,'config':_0x4db850,'metadata':{'name':_0x378ada,'createdAt':new Date()[_0x4a23c9(0x107)]()},'hasCredentials':_0x4d6501,'scope':_0x425cfa});}catch(_0x55bf4d){_0x55bf4d instanceof Error&&(console[_0x4a23c9(0x110)](_0x4a23c9(0xed)+_0x58e646+':'),console['warn']('\x20\x20'+_0x55bf4d[_0x4a23c9(0xc2)]+'\x0a'));}}return _0x50020f;}catch(_0x4f6cfa){return _0x4f6cfa instanceof SyntaxError?(console[_0x4a23c9(0x110)](_0x4a23c9(0xc1)+_0x58e646+_0x4a23c9(0xc3)),console[_0x4a23c9(0x110)](_0x4a23c9(0xc8)+_0x4f6cfa[_0x4a23c9(0xc2)]+'\x0a')):console['warn']('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x58e646+':\x20'+_0x4f6cfa+'\x0a'),[];}}export function getNewCredentialPath(_0x57bb26){const _0xc0bd71=a66_0x719578;return a66_0x47d82f[_0xc0bd71(0xfc)](getConfigDir(),'.env.'+_0x57bb26);}function a66_0x191f(_0x325b80,_0x59ede9){_0x325b80=_0x325b80-0xc0;const _0x4b3a05=a66_0x4b3a();let _0x191f2b=_0x4b3a05[_0x325b80];return _0x191f2b;}function getOldCredentialPath(_0x4bb8e7){const _0x4d2811=a66_0x719578;return a66_0x47d82f[_0x4d2811(0xfc)](getProfilesDir(),_0x4bb8e7,_0x4d2811(0xf5));}function loadProfilesFromTdxJsonFiles(){const _0x616a2=a66_0x719578,_0x411d51=[],_0x567c89=findProjectConfigPath();_0x567c89&&_0x411d51[_0x616a2(0xe4)](...loadProfilesFromTdxJson(_0x567c89,_0x616a2(0xd0)));const _0x25daac=a66_0x47d82f[_0x616a2(0xfc)](getConfigDir(),_0x616a2(0x112));return _0x411d51['push'](...loadProfilesFromTdxJson(_0x25daac,'user')),_0x411d51;}function loadProfilesFromDirectories(){const _0x179e8a=a66_0x719578,_0x31ca55=getProfilesDir();if(!a66_0x2af8fd[_0x179e8a(0xf7)](_0x31ca55))return[];try{return a66_0x2af8fd[_0x179e8a(0xd4)](_0x31ca55,{'withFileTypes':!![]})[_0x179e8a(0xc9)](_0x4372b5=>_0x4372b5[_0x179e8a(0xe0)]())['map'](_0x8f9348=>_0x8f9348[_0x179e8a(0xec)])[_0x179e8a(0xc9)](_0x28311b=>{const _0x9d622f=getProfileConfigPath(_0x28311b),_0x3e7368=getProfileEnvPath(_0x28311b);return a66_0x2af8fd['existsSync'](_0x9d622f)||a66_0x2af8fd['existsSync'](_0x3e7368);})[_0x179e8a(0xfb)](_0x48f295=>{const _0x48aad0=loadProfileFromDirectory(_0x48f295);if(_0x48aad0)return{..._0x48aad0,'scope':'directory'};return null;})[_0x179e8a(0xc9)](_0x4698b2=>_0x4698b2!==null);}catch{return[];}}function loadProfileFromDirectory(_0x184f8a){const _0x2db6b2=a66_0x719578,_0x1e8216=getProfileConfigPath(_0x184f8a),_0x42eedb=getOldCredentialPath(_0x184f8a);if(!a66_0x2af8fd['existsSync'](_0x1e8216)&&!a66_0x2af8fd['existsSync'](_0x42eedb))return null;let _0x1e6a94={},_0x67a5ba={'name':_0x184f8a,'createdAt':new Date()[_0x2db6b2(0x107)]()};if(a66_0x2af8fd['existsSync'](_0x1e8216))try{const _0x3670f2=a66_0x2af8fd[_0x2db6b2(0xfd)](_0x1e8216,'utf-8'),_0x422dac=JSON['parse'](_0x3670f2),{metadata:_0x4d021a,..._0x4383a9}=_0x422dac;_0x1e6a94=_0x4383a9,_0x4d021a&&(_0x67a5ba=_0x4d021a);}catch{}return{'name':_0x184f8a,'config':_0x1e6a94,'metadata':_0x67a5ba,'hasCredentials':a66_0x2af8fd['existsSync'](_0x42eedb),'scope':_0x2db6b2(0x100)};}export function listProfiles(){const _0x2397aa=a66_0x719578,_0x3beeaa=loadProfilesFromTdxJsonFiles(),_0x7d1f34=loadProfilesFromDirectories();if(_0x7d1f34[_0x2397aa(0xf6)]>0x0){const _0x35cd81=_0x7d1f34[_0x2397aa(0xfb)](_0x5d177c=>_0x5d177c['name'])[_0x2397aa(0xfc)](',\x20'),_0x40b9b3=getConfigDir();console[_0x2397aa(0x110)](_0x2397aa(0xd5)+_0x35cd81),console[_0x2397aa(0x110)](_0x2397aa(0xc7)),console['warn']('\x20\x201.\x20Edit:\x20'+a66_0x47d82f[_0x2397aa(0xfc)](_0x40b9b3,_0x2397aa(0x112))),console[_0x2397aa(0x110)](_0x2397aa(0xc4)),console['warn'](_0x2397aa(0xd9));}const _0x49626f=[..._0x3beeaa,..._0x7d1f34],_0x768094=new Map();for(const _0x429574 of _0x49626f){!_0x768094[_0x2397aa(0xf0)](_0x429574['name'])&&_0x768094[_0x2397aa(0x10b)](_0x429574[_0x2397aa(0xec)],_0x429574);}return Array[_0x2397aa(0xdc)](_0x768094[_0x2397aa(0xdf)]())[_0x2397aa(0xcb)]((_0x5a6d5a,_0x458260)=>_0x5a6d5a[_0x2397aa(0xec)][_0x2397aa(0xd7)](_0x458260[_0x2397aa(0xec)]));}export function profileExists(_0x1fd415){const _0x38e358=a66_0x719578,_0x4a2ef3=listProfiles();return _0x4a2ef3[_0x38e358(0xee)](_0x41b970=>_0x41b970[_0x38e358(0xec)]===_0x1fd415);}export function loadProfile(_0x874b41){const _0x5aa72a=a66_0x719578;validateProfileName(_0x874b41);const _0x16efe2=listProfiles(),_0x642316=_0x16efe2[_0x5aa72a(0xf1)](_0x3537cf=>_0x3537cf[_0x5aa72a(0xec)]===_0x874b41);return _0x642316||null;}export function saveProfile(_0x361187,_0x227272,_0x49fc45=![]){saveProfileToUserConfig(_0x361187,_0x227272);}export function deleteProfile(_0x290b4b){const _0x5cbda4=a66_0x719578;validateProfileName(_0x290b4b);const _0x7af0a6=getProfileDir(_0x290b4b);if(!a66_0x2af8fd[_0x5cbda4(0xf7)](_0x7af0a6))throw new Error(_0x5cbda4(0x10e)+_0x290b4b+_0x5cbda4(0xcd));a66_0x2af8fd[_0x5cbda4(0xe3)](_0x7af0a6,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x374ab5,_0x5ac077){const _0xe45f4=a66_0x719578;validateProfileName(_0x374ab5);const _0x2fcf6f=getGlobalConfigPath(),_0x4fe799=getConfigDir();!a66_0x2af8fd[_0xe45f4(0xf7)](_0x4fe799)&&createSecureDirectory(_0x4fe799);let _0x50b7a2={};if(a66_0x2af8fd[_0xe45f4(0xf7)](_0x2fcf6f))try{const _0x17314e=a66_0x2af8fd[_0xe45f4(0xfd)](_0x2fcf6f,_0xe45f4(0xeb));_0x50b7a2=JSON['parse'](_0x17314e);}catch{console[_0xe45f4(0x110)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x2fcf6f+_0xe45f4(0x103));}!_0x50b7a2[_0xe45f4(0x111)]&&(_0x50b7a2[_0xe45f4(0x111)]={}),_0x50b7a2['profiles'][_0x374ab5]=_0x5ac077,writeSecureFile(_0x2fcf6f,JSON[_0xe45f4(0xdd)](_0x50b7a2,null,0x2));}export function removeProfileFromUserConfig(_0x4d34fe){const _0x5c8c22=a66_0x719578;validateProfileName(_0x4d34fe);const _0x49fff2=getGlobalConfigPath();if(!a66_0x2af8fd[_0x5c8c22(0xf7)](_0x49fff2))throw new Error('Profile\x20\x27'+_0x4d34fe+_0x5c8c22(0xe7));let _0x4b694b={};try{const _0x3944d2=a66_0x2af8fd[_0x5c8c22(0xfd)](_0x49fff2,'utf-8');_0x4b694b=JSON[_0x5c8c22(0x10a)](_0x3944d2);}catch{throw new Error(_0x5c8c22(0x106)+_0x49fff2);}if(!_0x4b694b['profiles']||!_0x4b694b['profiles'][_0x4d34fe])throw new Error('Profile\x20\x27'+_0x4d34fe+_0x5c8c22(0xe7));delete _0x4b694b['profiles'][_0x4d34fe],_0x4b694b['profile']===_0x4d34fe&&delete _0x4b694b[_0x5c8c22(0xf3)],writeSecureFile(_0x49fff2,JSON['stringify'](_0x4b694b,null,0x2));}export function getActiveProfile(){const _0x4740ae=a66_0x719578,_0x5372df=loadSessionContext();if(_0x5372df?.['profile'])return _0x5372df[_0x4740ae(0xf3)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x1a6ac5=getGlobalConfigPath();if(!a66_0x2af8fd['existsSync'](_0x1a6ac5))return null;try{const _0x40f176=a66_0x2af8fd[_0x4740ae(0xfd)](_0x1a6ac5,'utf-8'),_0x5f547b=JSON[_0x4740ae(0x10a)](_0x40f176);return _0x5f547b[_0x4740ae(0xf3)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x13e90b){const _0x558156=a66_0x719578,_0x86c9a0=getGlobalConfigPath(),_0x286c20=getConfigDir();!a66_0x2af8fd[_0x558156(0xf7)](_0x286c20)&&createSecureDirectory(_0x286c20);let _0x40da3a={};if(a66_0x2af8fd[_0x558156(0xf7)](_0x86c9a0))try{const _0x1da9e1=a66_0x2af8fd[_0x558156(0xfd)](_0x86c9a0,_0x558156(0xeb));_0x40da3a=JSON[_0x558156(0x10a)](_0x1da9e1);}catch{console[_0x558156(0x110)](_0x558156(0x114)+_0x86c9a0+',\x20creating\x20new\x20file');}_0x40da3a['site']=_0x13e90b,writeSecureFile(_0x86c9a0,JSON[_0x558156(0xdd)](_0x40da3a,null,0x2));}export function saveActiveProfileToUserConfig(_0x5d93e1){const _0xa26975=a66_0x719578;validateProfileName(_0x5d93e1);const _0x3778a0=getGlobalConfigPath(),_0x144a90=getConfigDir();!a66_0x2af8fd[_0xa26975(0xf7)](_0x144a90)&&createSecureDirectory(_0x144a90);let _0x37a41d={};if(a66_0x2af8fd['existsSync'](_0x3778a0))try{const _0x366c6d=a66_0x2af8fd['readFileSync'](_0x3778a0,_0xa26975(0xeb));_0x37a41d=JSON[_0xa26975(0x10a)](_0x366c6d);}catch{console[_0xa26975(0x110)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x3778a0+_0xa26975(0x103));}_0x37a41d[_0xa26975(0xf3)]=_0x5d93e1,writeSecureFile(_0x3778a0,JSON[_0xa26975(0xdd)](_0x37a41d,null,0x2));}function clearFieldFromUserConfig(_0x330c12){const _0x195b63=a66_0x719578,_0x271f18=getGlobalConfigPath();if(!a66_0x2af8fd[_0x195b63(0xf7)](_0x271f18))return;let _0x2eda1a={};try{const _0x3a164a=a66_0x2af8fd[_0x195b63(0xfd)](_0x271f18,_0x195b63(0xeb));_0x2eda1a=JSON[_0x195b63(0x10a)](_0x3a164a);}catch{return;}delete _0x2eda1a[_0x330c12],writeSecureFile(_0x271f18,JSON[_0x195b63(0xdd)](_0x2eda1a,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x339417=a66_0x719578;clearFieldFromUserConfig(_0x339417(0xd8));}export function clearActiveProfileFromUserConfig(){const _0x3cd2fc=a66_0x719578;clearFieldFromUserConfig(_0x3cd2fc(0xf3));}export function createProfile(_0x43671e,_0xee0ff4){const _0x56198f=a66_0x719578;validateProfileName(_0x43671e);if(profileExists(_0x43671e))throw new Error('Profile\x20'+_0x43671e+_0x56198f(0xdb));saveProfile(_0x43671e,_0xee0ff4);}export function saveProfileCredentials(_0x18d446,_0x245fbd){const _0x2d30b7=a66_0x719578;validateProfileName(_0x18d446);if(!profileExists(_0x18d446))throw new Error('Profile\x20'+_0x18d446+_0x2d30b7(0xcd));const _0x163746=getNewCredentialPath(_0x18d446);writeSecureFile(_0x163746,_0x245fbd);}export function loadProfileCredentials(_0x6d4556){const _0x28c5bd=a66_0x719578;validateProfileName(_0x6d4556);const _0x2ce059=getNewCredentialPath(_0x6d4556);if(a66_0x2af8fd['existsSync'](_0x2ce059))try{return a66_0x2af8fd[_0x28c5bd(0xfd)](_0x2ce059,'utf-8');}catch{}const _0x214e4e=getOldCredentialPath(_0x6d4556);if(a66_0x2af8fd['existsSync'](_0x214e4e)){console[_0x28c5bd(0x110)](_0x28c5bd(0xfa)+_0x6d4556+'\x27'),console['warn']('To\x20migrate:'),console[_0x28c5bd(0x110)](_0x28c5bd(0xe5)+_0x214e4e+_0x28c5bd(0x108)+_0x2ce059+'\x22'),console[_0x28c5bd(0x110)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a66_0x2af8fd['readFileSync'](_0x214e4e,_0x28c5bd(0xeb));}catch{return null;}}return null;}function a66_0x4b3a(){const _0x407d6b=['llm_project','parse','set','3Ohbjsx','\x27\x20will\x20be\x20ignored','Profile\x20','llm_agent','warn','profiles','tdx.json','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','Warning:\x20Failed\x20to\x20parse\x20','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','\x0aWarning:\x20Failed\x20to\x20parse\x20','message',':\x20Invalid\x20JSON\x20syntax','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','7buTgEH','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','Error:\x20','filter','5400UCEtnF','sort','user_info','\x20does\x20not\x20exist','includes','database','local','10SFfdQh','Profile\x20\x27','string','readdirSync','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','252319MQXlEb','localeCompare','site','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','test','\x20already\x20exists','from','stringify','1931480bDzCYw','values','isDirectory','2000aXxrSh','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','rmSync','push','\x20\x20mv\x20\x22','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','\x27\x20not\x20found\x20in\x20user\x20configuration','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','Warning:\x20Profile\x20\x27','keys','utf-8','name','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','some','372375pIvtYW','has','find','Invalid\x20profile\x20name:\x20','profile','@tdx-studio','.env','length','existsSync','parent_segment','object','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','map','join','readFileSync','INVALID_PROFILE_CONFIG','30471518MWqVTV','directory','3177004lIRRPp','3430782qAFXUF',',\x20creating\x20new\x20file','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','description','Failed\x20to\x20parse\x20','toISOString','\x22\x20\x22'];a66_0x4b3a=function(){return _0x407d6b;};return a66_0x4b3a();}
1
+ const a66_0x35d036=a66_0x72a6;(function(_0x447b93,_0x403913){const _0x4b8130=a66_0x72a6,_0xbc6c33=_0x447b93();while(!![]){try{const _0x2529f3=parseInt(_0x4b8130(0x215))/0x1*(parseInt(_0x4b8130(0x1de))/0x2)+parseInt(_0x4b8130(0x1c9))/0x3*(parseInt(_0x4b8130(0x1f1))/0x4)+parseInt(_0x4b8130(0x1d1))/0x5+-parseInt(_0x4b8130(0x1dc))/0x6*(parseInt(_0x4b8130(0x1ef))/0x7)+parseInt(_0x4b8130(0x207))/0x8+-parseInt(_0x4b8130(0x204))/0x9*(parseInt(_0x4b8130(0x1cc))/0xa)+parseInt(_0x4b8130(0x1f2))/0xb*(parseInt(_0x4b8130(0x1f0))/0xc);if(_0x2529f3===_0x403913)break;else _0xbc6c33['push'](_0xbc6c33['shift']());}catch(_0x52d8fe){_0xbc6c33['push'](_0xbc6c33['shift']());}}}(a66_0xa4c7,0x349bc));import*as a66_0x3bef7e from'node:fs';import*as a66_0x339127 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=a66_0x35d036(0x1e3);export function getProfileParams(_0x17c916){const _0x4852ca=a66_0x35d036,_0x474275={};if(!_0x17c916)return _0x474275;for(const [_0xd349d3,_0x1dbdd1]of Object['entries'](_0x17c916)){_0xd349d3!==_0x4852ca(0x1e1)&&_0x1dbdd1!==undefined&&(_0x474275[_0xd349d3]=_0x1dbdd1);}return _0x474275;}export function getProfilesDir(){const _0x5a3cae=a66_0x35d036;return a66_0x339127[_0x5a3cae(0x1e6)](getConfigDir(),_0x5a3cae(0x1f7));}function getProfileDir(_0x5a817c){const _0x41dd67=a66_0x35d036;return a66_0x339127[_0x41dd67(0x1e6)](getProfilesDir(),_0x5a817c);}function getProfileConfigPath(_0x59a87d){const _0x54a0f3=a66_0x35d036;return a66_0x339127['join'](getProfileDir(_0x59a87d),_0x54a0f3(0x211));}function getProfileEnvPath(_0x1930ee){const _0x4d9a31=a66_0x35d036;return a66_0x339127['join'](getProfileDir(_0x1930ee),_0x4d9a31(0x1d2));}function a66_0x72a6(_0x155e12,_0x4708d2){_0x155e12=_0x155e12-0x1c6;const _0xa4c71a=a66_0xa4c7();let _0x72a6fd=_0xa4c71a[_0x155e12];return _0x72a6fd;}function getGlobalConfigPath(){const _0x12bdfa=a66_0x35d036;return a66_0x339127[_0x12bdfa(0x1e6)](getConfigDir(),'tdx.json');}function validateProfileName(_0x18d9d7){const _0x5da6c6=a66_0x35d036;if(/^@?[a-zA-Z0-9_-]+$/[_0x5da6c6(0x1c8)](_0x18d9d7))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x5da6c6(0x1c8)](_0x18d9d7))return;throw new Error(_0x5da6c6(0x1ce)+_0x18d9d7+_0x5da6c6(0x213));}function validateProfileConfig(_0x2f324e,_0x21a555){const _0x3e514a=a66_0x35d036;if(typeof _0x2f324e!==_0x3e514a(0x1fb)||_0x2f324e===null)throw new SDKError(ErrorCode[_0x3e514a(0x1fd)],'Profile\x20\x27'+_0x21a555+_0x3e514a(0x20c));const _0x5a85fb=[_0x3e514a(0x1e1),_0x3e514a(0x1f3),'database',_0x3e514a(0x20f),_0x3e514a(0x1ee),'llm_agent',_0x3e514a(0x1df)],_0x36a6f9=_0x2f324e;for(const _0x469c7c of Object[_0x3e514a(0x205)](_0x36a6f9)){!_0x5a85fb[_0x3e514a(0x202)](_0x469c7c)&&console[_0x3e514a(0x209)]('Warning:\x20Profile\x20\x27'+_0x21a555+_0x3e514a(0x1d8)+_0x469c7c+_0x3e514a(0x1f9));}if(_0x36a6f9['description']!==undefined&&typeof _0x36a6f9[_0x3e514a(0x1e1)]!==_0x3e514a(0x208))throw new SDKError(ErrorCode[_0x3e514a(0x1fd)],'Profile\x20\x27'+_0x21a555+_0x3e514a(0x1cd));if(_0x36a6f9['site']!==undefined&&typeof _0x36a6f9[_0x3e514a(0x1f3)]!==_0x3e514a(0x208))throw new SDKError(ErrorCode[_0x3e514a(0x1fd)],_0x3e514a(0x1db)+_0x21a555+_0x3e514a(0x1f6));if(_0x36a6f9[_0x3e514a(0x1ed)]!==undefined&&typeof _0x36a6f9[_0x3e514a(0x1ed)]!==_0x3e514a(0x208))throw new SDKError(ErrorCode[_0x3e514a(0x1fd)],'Profile\x20\x27'+_0x21a555+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x36a6f9['parent_segment']!==undefined&&typeof _0x36a6f9[_0x3e514a(0x20f)]!=='string')throw new SDKError(ErrorCode[_0x3e514a(0x1fd)],_0x3e514a(0x1db)+_0x21a555+'\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string');if(_0x36a6f9[_0x3e514a(0x1ee)]!==undefined&&typeof _0x36a6f9[_0x3e514a(0x1ee)]!==_0x3e514a(0x208))throw new SDKError(ErrorCode[_0x3e514a(0x1fd)],_0x3e514a(0x1db)+_0x21a555+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0x36a6f9[_0x3e514a(0x20b)]!==undefined&&typeof _0x36a6f9[_0x3e514a(0x20b)]!==_0x3e514a(0x208))throw new SDKError(ErrorCode[_0x3e514a(0x1fd)],_0x3e514a(0x1db)+_0x21a555+_0x3e514a(0x1d6));return!![];}function loadProfilesFromTdxJson(_0x592cb9,_0x389448){const _0x160f27=a66_0x35d036;if(!a66_0x3bef7e[_0x160f27(0x1e0)](_0x592cb9))return[];try{const _0x28209d=a66_0x3bef7e[_0x160f27(0x1c6)](_0x592cb9,_0x160f27(0x1d3)),_0x2c9a9e=JSON[_0x160f27(0x1e4)](_0x28209d);if(!_0x2c9a9e[_0x160f27(0x1f7)]||typeof _0x2c9a9e[_0x160f27(0x1f7)]!==_0x160f27(0x1fb))return[];const _0x3137cf=[];for(const [_0x52183a,_0x357f21]of Object[_0x160f27(0x1fc)](_0x2c9a9e[_0x160f27(0x1f7)])){try{validateProfileConfig(_0x357f21,_0x52183a);const _0x44bc8a=getNewCredentialPath(_0x52183a),_0x132c64=getOldCredentialPath(_0x52183a),_0x1c13be=a66_0x3bef7e[_0x160f27(0x1e0)](_0x44bc8a)||a66_0x3bef7e[_0x160f27(0x1e0)](_0x132c64);_0x3137cf[_0x160f27(0x1e8)]({'name':_0x52183a,'config':_0x357f21,'metadata':{'name':_0x52183a,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x1c13be,'scope':_0x389448});}catch(_0x446a39){_0x446a39 instanceof Error&&(console[_0x160f27(0x209)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x592cb9+':'),console[_0x160f27(0x209)]('\x20\x20'+_0x446a39['message']+'\x0a'));}}return _0x3137cf;}catch(_0x4f370e){return _0x4f370e instanceof SyntaxError?(console[_0x160f27(0x209)](_0x160f27(0x200)+_0x592cb9+':\x20Invalid\x20JSON\x20syntax'),console['warn'](_0x160f27(0x1c7)+_0x4f370e['message']+'\x0a')):console[_0x160f27(0x209)](_0x160f27(0x210)+_0x592cb9+':\x20'+_0x4f370e+'\x0a'),[];}}export function getNewCredentialPath(_0x46706e){const _0x3f1156=a66_0x35d036;return a66_0x339127[_0x3f1156(0x1e6)](getConfigDir(),'.env.'+_0x46706e);}function getOldCredentialPath(_0x55a8f1){const _0x5c67fb=a66_0x35d036;return a66_0x339127[_0x5c67fb(0x1e6)](getProfilesDir(),_0x55a8f1,_0x5c67fb(0x1d2));}function loadProfilesFromTdxJsonFiles(){const _0x99f250=a66_0x35d036,_0x346312=[],_0x509aeb=findProjectConfigPath();_0x509aeb&&_0x346312[_0x99f250(0x1e8)](...loadProfilesFromTdxJson(_0x509aeb,'local'));const _0x1515b5=a66_0x339127[_0x99f250(0x1e6)](getConfigDir(),_0x99f250(0x211));return _0x346312['push'](...loadProfilesFromTdxJson(_0x1515b5,_0x99f250(0x1e9))),_0x346312;}function loadProfilesFromDirectories(){const _0x14814f=a66_0x35d036,_0x5f04a0=getProfilesDir();if(!a66_0x3bef7e['existsSync'](_0x5f04a0))return[];try{return a66_0x3bef7e[_0x14814f(0x1d9)](_0x5f04a0,{'withFileTypes':!![]})[_0x14814f(0x1ca)](_0x40a0e2=>_0x40a0e2[_0x14814f(0x1eb)]())[_0x14814f(0x1dd)](_0x162b00=>_0x162b00[_0x14814f(0x1da)])['filter'](_0x576c55=>{const _0x394968=_0x14814f,_0x3f1a63=getProfileConfigPath(_0x576c55),_0x300809=getProfileEnvPath(_0x576c55);return a66_0x3bef7e[_0x394968(0x1e0)](_0x3f1a63)||a66_0x3bef7e['existsSync'](_0x300809);})[_0x14814f(0x1dd)](_0xc3df59=>{const _0x2d9493=loadProfileFromDirectory(_0xc3df59);if(_0x2d9493)return{..._0x2d9493,'scope':'directory'};return null;})['filter'](_0x5efd7f=>_0x5efd7f!==null);}catch{return[];}}function loadProfileFromDirectory(_0x26a150){const _0x1f3166=a66_0x35d036,_0x38e08d=getProfileConfigPath(_0x26a150),_0xfab556=getOldCredentialPath(_0x26a150);if(!a66_0x3bef7e[_0x1f3166(0x1e0)](_0x38e08d)&&!a66_0x3bef7e[_0x1f3166(0x1e0)](_0xfab556))return null;let _0x4c70c0={},_0x1e2b56={'name':_0x26a150,'createdAt':new Date()[_0x1f3166(0x1fe)]()};if(a66_0x3bef7e[_0x1f3166(0x1e0)](_0x38e08d))try{const _0x452edf=a66_0x3bef7e[_0x1f3166(0x1c6)](_0x38e08d,'utf-8'),_0xe1e35f=JSON[_0x1f3166(0x1e4)](_0x452edf),{metadata:_0x46af02,..._0x2e8792}=_0xe1e35f;_0x4c70c0=_0x2e8792,_0x46af02&&(_0x1e2b56=_0x46af02);}catch{}return{'name':_0x26a150,'config':_0x4c70c0,'metadata':_0x1e2b56,'hasCredentials':a66_0x3bef7e[_0x1f3166(0x1e0)](_0xfab556),'scope':'directory'};}export function listProfiles(){const _0xbca274=a66_0x35d036,_0x2bfa1a=loadProfilesFromTdxJsonFiles(),_0x4375bc=loadProfilesFromDirectories();if(_0x4375bc['length']>0x0){const _0x4bff7e=_0x4375bc[_0xbca274(0x1dd)](_0x1014af=>_0x1014af[_0xbca274(0x1da)])[_0xbca274(0x1e6)](',\x20'),_0x315ff5=getConfigDir();console[_0xbca274(0x209)](_0xbca274(0x206)+_0x4bff7e),console[_0xbca274(0x209)](_0xbca274(0x1f4)),console[_0xbca274(0x209)](_0xbca274(0x214)+a66_0x339127[_0xbca274(0x1e6)](_0x315ff5,_0xbca274(0x211))),console[_0xbca274(0x209)](_0xbca274(0x1ec)),console[_0xbca274(0x209)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x1d50f0=[..._0x2bfa1a,..._0x4375bc],_0x4c3c8e=new Map();for(const _0x4ab6be of _0x1d50f0){!_0x4c3c8e[_0xbca274(0x1e5)](_0x4ab6be[_0xbca274(0x1da)])&&_0x4c3c8e[_0xbca274(0x1d5)](_0x4ab6be[_0xbca274(0x1da)],_0x4ab6be);}return Array[_0xbca274(0x1ff)](_0x4c3c8e[_0xbca274(0x1cf)]())[_0xbca274(0x203)]((_0x5e02a3,_0x44ed09)=>_0x5e02a3[_0xbca274(0x1da)][_0xbca274(0x20e)](_0x44ed09[_0xbca274(0x1da)]));}export function profileExists(_0x371a7a){const _0x22525d=listProfiles();return _0x22525d['some'](_0x2d5c78=>_0x2d5c78['name']===_0x371a7a);}export function loadProfile(_0x5c62f2){const _0x8a3c5b=a66_0x35d036;validateProfileName(_0x5c62f2);const _0x4e640d=listProfiles(),_0x3f403e=_0x4e640d[_0x8a3c5b(0x212)](_0x3b6e75=>_0x3b6e75[_0x8a3c5b(0x1da)]===_0x5c62f2);return _0x3f403e||null;}export function saveProfile(_0x48d0e0,_0x3872ef,_0x473188=![]){saveProfileToUserConfig(_0x48d0e0,_0x3872ef);}export function deleteProfile(_0x1857bc){const _0x10d560=a66_0x35d036;validateProfileName(_0x1857bc);const _0x5e5b67=getProfileDir(_0x1857bc);if(!a66_0x3bef7e[_0x10d560(0x1e0)](_0x5e5b67))throw new Error('Profile\x20'+_0x1857bc+_0x10d560(0x1d4));a66_0x3bef7e['rmSync'](_0x5e5b67,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x5c2dae,_0x23c2f8){const _0x4d0647=a66_0x35d036;validateProfileName(_0x5c2dae);const _0x1ed891=getGlobalConfigPath(),_0x345c58=getConfigDir();!a66_0x3bef7e['existsSync'](_0x345c58)&&createSecureDirectory(_0x345c58);let _0x40f05a={};if(a66_0x3bef7e[_0x4d0647(0x1e0)](_0x1ed891))try{const _0xa618ea=a66_0x3bef7e[_0x4d0647(0x1c6)](_0x1ed891,_0x4d0647(0x1d3));_0x40f05a=JSON['parse'](_0xa618ea);}catch{console[_0x4d0647(0x209)](_0x4d0647(0x1e2)+_0x1ed891+',\x20creating\x20new\x20file');}!_0x40f05a[_0x4d0647(0x1f7)]&&(_0x40f05a[_0x4d0647(0x1f7)]={}),_0x40f05a['profiles'][_0x5c2dae]=_0x23c2f8,writeSecureFile(_0x1ed891,JSON[_0x4d0647(0x20d)](_0x40f05a,null,0x2));}export function removeProfileFromUserConfig(_0x1450d3){const _0x24b967=a66_0x35d036;validateProfileName(_0x1450d3);const _0x23c69e=getGlobalConfigPath();if(!a66_0x3bef7e[_0x24b967(0x1e0)](_0x23c69e))throw new Error(_0x24b967(0x1db)+_0x1450d3+'\x27\x20not\x20found\x20in\x20user\x20configuration');let _0x2d5ed5={};try{const _0x649339=a66_0x3bef7e[_0x24b967(0x1c6)](_0x23c69e,_0x24b967(0x1d3));_0x2d5ed5=JSON[_0x24b967(0x1e4)](_0x649339);}catch{throw new Error(_0x24b967(0x1d7)+_0x23c69e);}if(!_0x2d5ed5[_0x24b967(0x1f7)]||!_0x2d5ed5[_0x24b967(0x1f7)][_0x1450d3])throw new Error('Profile\x20\x27'+_0x1450d3+_0x24b967(0x1d0));delete _0x2d5ed5['profiles'][_0x1450d3],_0x2d5ed5[_0x24b967(0x20a)]===_0x1450d3&&delete _0x2d5ed5[_0x24b967(0x20a)],writeSecureFile(_0x23c69e,JSON['stringify'](_0x2d5ed5,null,0x2));}export function getActiveProfile(){const _0x45325d=a66_0x35d036,_0x52465f=loadSessionContext();if(_0x52465f?.[_0x45325d(0x20a)])return _0x52465f[_0x45325d(0x20a)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x156040=getGlobalConfigPath();if(!a66_0x3bef7e[_0x45325d(0x1e0)](_0x156040))return null;try{const _0xaf5c46=a66_0x3bef7e[_0x45325d(0x1c6)](_0x156040,_0x45325d(0x1d3)),_0x3cbf07=JSON[_0x45325d(0x1e4)](_0xaf5c46);return _0x3cbf07['profile']||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x28ff95){const _0x15ca4a=a66_0x35d036,_0x5d8fb2=getGlobalConfigPath(),_0x44b16e=getConfigDir();!a66_0x3bef7e['existsSync'](_0x44b16e)&&createSecureDirectory(_0x44b16e);let _0x27d84a={};if(a66_0x3bef7e[_0x15ca4a(0x1e0)](_0x5d8fb2))try{const _0x326011=a66_0x3bef7e[_0x15ca4a(0x1c6)](_0x5d8fb2,_0x15ca4a(0x1d3));_0x27d84a=JSON[_0x15ca4a(0x1e4)](_0x326011);}catch{console[_0x15ca4a(0x209)](_0x15ca4a(0x1e2)+_0x5d8fb2+_0x15ca4a(0x201));}_0x27d84a[_0x15ca4a(0x1f3)]=_0x28ff95,writeSecureFile(_0x5d8fb2,JSON[_0x15ca4a(0x20d)](_0x27d84a,null,0x2));}export function saveActiveProfileToUserConfig(_0x5c9ca2){const _0x29587a=a66_0x35d036;validateProfileName(_0x5c9ca2);const _0x21b1d9=getGlobalConfigPath(),_0x4bd98b=getConfigDir();!a66_0x3bef7e[_0x29587a(0x1e0)](_0x4bd98b)&&createSecureDirectory(_0x4bd98b);let _0x596a23={};if(a66_0x3bef7e[_0x29587a(0x1e0)](_0x21b1d9))try{const _0x5aeb9a=a66_0x3bef7e['readFileSync'](_0x21b1d9,_0x29587a(0x1d3));_0x596a23=JSON['parse'](_0x5aeb9a);}catch{console[_0x29587a(0x209)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x21b1d9+_0x29587a(0x201));}_0x596a23[_0x29587a(0x20a)]=_0x5c9ca2,writeSecureFile(_0x21b1d9,JSON[_0x29587a(0x20d)](_0x596a23,null,0x2));}function clearFieldFromUserConfig(_0x4ea4b2){const _0x1b2ef9=a66_0x35d036,_0x2d6e51=getGlobalConfigPath();if(!a66_0x3bef7e[_0x1b2ef9(0x1e0)](_0x2d6e51))return;let _0xdc426={};try{const _0x577784=a66_0x3bef7e[_0x1b2ef9(0x1c6)](_0x2d6e51,_0x1b2ef9(0x1d3));_0xdc426=JSON[_0x1b2ef9(0x1e4)](_0x577784);}catch{return;}delete _0xdc426[_0x4ea4b2],writeSecureFile(_0x2d6e51,JSON[_0x1b2ef9(0x20d)](_0xdc426,null,0x2));}function a66_0xa4c7(){const _0x134ec3=['entries','INVALID_PROFILE_CONFIG','toISOString','from','\x0aWarning:\x20Failed\x20to\x20parse\x20',',\x20creating\x20new\x20file','includes','sort','9rWWwyZ','keys','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','870696PGGGyp','string','warn','profile','llm_agent','\x27:\x20config\x20must\x20be\x20an\x20object','stringify','localeCompare','parent_segment','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','tdx.json','find','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','\x20\x201.\x20Edit:\x20','1tutNJd','readFileSync','Error:\x20','test','99pWvzFK','filter','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','2426870IezwBd','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','Invalid\x20profile\x20name:\x20','values','\x27\x20not\x20found\x20in\x20user\x20configuration','323665GxwZAC','.env','utf-8','\x20does\x20not\x20exist','set','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','Failed\x20to\x20parse\x20','\x27:\x20unknown\x20config\x20key\x20\x27','readdirSync','name','Profile\x20\x27','5298Bbicgr','map','427708uAHRZx','user_info','existsSync','description','Warning:\x20Failed\x20to\x20parse\x20','@tdx-studio','parse','has','join','\x20\x20mv\x20\x22','push','user','To\x20migrate:','isDirectory','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','database','llm_project','3199mIzbKn','348lxyzMR','592mOJsVX','178046YDPsIA','site','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','Profile\x20','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','profiles','\x22\x20\x22','\x27\x20will\x20be\x20ignored','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','object'];a66_0xa4c7=function(){return _0x134ec3;};return a66_0xa4c7();}export function clearDefaultSiteFromUserConfig(){clearFieldFromUserConfig('site');}export function clearActiveProfileFromUserConfig(){const _0x4f950c=a66_0x35d036;clearFieldFromUserConfig(_0x4f950c(0x20a));}export function createProfile(_0x541eb0,_0x412359){validateProfileName(_0x541eb0);if(profileExists(_0x541eb0))throw new Error('Profile\x20'+_0x541eb0+'\x20already\x20exists');saveProfile(_0x541eb0,_0x412359);}export function saveProfileCredentials(_0x34e03a,_0x38759c){const _0xf9317f=a66_0x35d036;validateProfileName(_0x34e03a);if(!profileExists(_0x34e03a))throw new Error(_0xf9317f(0x1f5)+_0x34e03a+_0xf9317f(0x1d4));const _0xbc338e=getNewCredentialPath(_0x34e03a);writeSecureFile(_0xbc338e,_0x38759c);}export function loadProfileCredentials(_0x35a723){const _0x3b5e72=a66_0x35d036;validateProfileName(_0x35a723);const _0x30e765=getNewCredentialPath(_0x35a723);if(a66_0x3bef7e[_0x3b5e72(0x1e0)](_0x30e765))try{return a66_0x3bef7e[_0x3b5e72(0x1c6)](_0x30e765,_0x3b5e72(0x1d3));}catch{}const _0xe3fa56=getOldCredentialPath(_0x35a723);if(a66_0x3bef7e[_0x3b5e72(0x1e0)](_0xe3fa56)){console[_0x3b5e72(0x209)](_0x3b5e72(0x1cb)+_0x35a723+'\x27'),console[_0x3b5e72(0x209)](_0x3b5e72(0x1ea)),console[_0x3b5e72(0x209)](_0x3b5e72(0x1e7)+_0xe3fa56+_0x3b5e72(0x1f8)+_0x30e765+'\x22'),console[_0x3b5e72(0x209)](_0x3b5e72(0x1fa));try{return a66_0x3bef7e['readFileSync'](_0xe3fa56,'utf-8');}catch{return null;}}return null;}
@@ -1 +1 @@
1
- const a67_0x419d56=a67_0x485b;function a67_0x50b4(){const _0x6d3854=['tdx.json','567028LqmWUy','api_key','\x20is\x20ignored.\x20','stringify','utf-8','3894UdCXPz','writeFileSync','629236iJDIZm','join','2726256YfagEC','TD_API_KEY','2VVGjYi','5UeMpyk','7LyXNgE','1035297Vlrwmg','ENOENT','18210WSYrFJ','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','dirname','profile','code','existsSync','apiKey','cwd','2695254uaAGLq','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','759270XBsHob',').\x20','Warning:\x20\x27profile\x27\x20field\x20in\x20','includes'];a67_0x50b4=function(){return _0x6d3854;};return a67_0x50b4();}(function(_0x5127e1,_0x2ad61d){const _0x5041fb=a67_0x485b,_0x2552f0=_0x5127e1();while(!![]){try{const _0x21baaf=-parseInt(_0x5041fb(0x89))/0x1*(-parseInt(_0x5041fb(0x85))/0x2)+parseInt(_0x5041fb(0x99))/0x3+parseInt(_0x5041fb(0x7e))/0x4*(-parseInt(_0x5041fb(0x8a))/0x5)+-parseInt(_0x5041fb(0x97))/0x6*(-parseInt(_0x5041fb(0x8b))/0x7)+-parseInt(_0x5041fb(0x87))/0x8+parseInt(_0x5041fb(0x8c))/0x9+parseInt(_0x5041fb(0x8e))/0xa*(-parseInt(_0x5041fb(0x83))/0xb);if(_0x21baaf===_0x2ad61d)break;else _0x2552f0['push'](_0x2552f0['shift']());}catch(_0x77f750){_0x2552f0['push'](_0x2552f0['shift']());}}}(a67_0x50b4,0x4dfa3));import*as a67_0x564331 from'node:fs';import*as a67_0x5d54ca from'node:path';function a67_0x485b(_0x3c78af,_0x5391d1){_0x3c78af=_0x3c78af-0x7d;const _0x50b4d9=a67_0x50b4();let _0x485b8e=_0x50b4d9[_0x3c78af];return _0x485b8e;}const PROJECT_CONFIG_FILENAME=a67_0x419d56(0x7d);export function findProjectConfigPath(_0xf6632c){const _0xd571ed=a67_0x419d56;let _0x4f8625=_0xf6632c||process['cwd']();while(!![]){const _0xc7b18=a67_0x5d54ca['join'](_0x4f8625,PROJECT_CONFIG_FILENAME);if(a67_0x564331[_0xd571ed(0x94)](_0xc7b18))return _0xc7b18;const _0x330dec=a67_0x5d54ca['dirname'](_0x4f8625);if(_0x330dec===_0x4f8625)return null;_0x4f8625=_0x330dec;}}export function loadProjectConfig(_0x1cff74){const _0x3495f6=a67_0x419d56,_0x4c66c5=findProjectConfigPath(_0x1cff74);if(!_0x4c66c5)return null;try{const _0x133da5=a67_0x564331['readFileSync'](_0x4c66c5,_0x3495f6(0x82)),_0x58a7f3=JSON['parse'](_0x133da5),_0x170159=JSON['stringify'](_0x58a7f3);if(_0x170159[_0x3495f6(0x9c)](_0x3495f6(0x88))||_0x170159[_0x3495f6(0x9c)](_0x3495f6(0x95))||_0x170159[_0x3495f6(0x9c)](_0x3495f6(0x7f)))throw new Error('Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20('+_0x4c66c5+_0x3495f6(0x9a)+_0x3495f6(0x90));const {metadata:_0x4acba,profile:_0x2fbba7,..._0x2b942f}=_0x58a7f3;return _0x2fbba7&&console['warn'](_0x3495f6(0x9b)+_0x4c66c5+_0x3495f6(0x80)+'Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'),_0x2b942f;}catch(_0x32eea5){if(_0x32eea5 instanceof Error&&_0x3495f6(0x93)in _0x32eea5&&_0x32eea5[_0x3495f6(0x93)]===_0x3495f6(0x8d))return null;throw new Error('Failed\x20to\x20load\x20project\x20config\x20from\x20'+_0x4c66c5+':\x20'+_0x32eea5);}}export function saveProjectConfig(_0x39e289,_0x265606){const _0x4eb8da=a67_0x419d56,_0x223817=_0x265606||process[_0x4eb8da(0x96)](),_0x510772=a67_0x5d54ca[_0x4eb8da(0x86)](_0x223817,PROJECT_CONFIG_FILENAME),_0xc86cff=JSON[_0x4eb8da(0x81)](_0x39e289);if(_0xc86cff[_0x4eb8da(0x9c)](_0x4eb8da(0x88))||_0xc86cff[_0x4eb8da(0x9c)]('apiKey')||_0xc86cff[_0x4eb8da(0x9c)]('api_key'))throw new Error(_0x4eb8da(0x98));if(_0x4eb8da(0x92)in _0x39e289)throw new Error(_0x4eb8da(0x8f));a67_0x564331[_0x4eb8da(0x84)](_0x510772,JSON[_0x4eb8da(0x81)](_0x39e289,null,0x2));}export function hasProjectConfig(_0x52b47e){return findProjectConfigPath(_0x52b47e)!==null;}export function getProjectRoot(_0x4e4c41){const _0x57240f=a67_0x419d56,_0x3aeb06=findProjectConfigPath(_0x4e4c41);return _0x3aeb06?a67_0x5d54ca[_0x57240f(0x91)](_0x3aeb06):null;}
1
+ function a67_0x3343(){const _0x5bbc5b=['2nmQcyM','464sZmNZd','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','670818cXLrdc','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','625790MAzMmR','stringify','728964JpYuVI','dirname','join','existsSync','code','includes','45RdDiTB','warn','utf-8','api_key','20293mAwfDx','15xVoYYx','writeFileSync','212880LYhgZZ','363848FCetVD','83018xSafZf','apiKey','\x20is\x20ignored.\x20','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','profile','TD_API_KEY','ENOENT','275DPdeQc'];a67_0x3343=function(){return _0x5bbc5b;};return a67_0x3343();}(function(_0x2c4487,_0x3c6c92){const _0xf93d80=a67_0x16f0,_0x1d0095=_0x2c4487();while(!![]){try{const _0x58c2c6=parseInt(_0xf93d80(0x153))/0x1*(parseInt(_0xf93d80(0x15c))/0x2)+-parseInt(_0xf93d80(0x144))/0x3+-parseInt(_0xf93d80(0x152))/0x4*(-parseInt(_0xf93d80(0x14f))/0x5)+parseInt(_0xf93d80(0x140))/0x6+parseInt(_0xf93d80(0x14e))/0x7*(-parseInt(_0xf93d80(0x15d))/0x8)+-parseInt(_0xf93d80(0x14a))/0x9*(parseInt(_0xf93d80(0x142))/0xa)+-parseInt(_0xf93d80(0x15b))/0xb*(-parseInt(_0xf93d80(0x151))/0xc);if(_0x58c2c6===_0x3c6c92)break;else _0x1d0095['push'](_0x1d0095['shift']());}catch(_0xccd3c1){_0x1d0095['push'](_0x1d0095['shift']());}}}(a67_0x3343,0x2db2e));import*as a67_0x9f2e88 from'node:fs';function a67_0x16f0(_0x166b37,_0x4df394){_0x166b37=_0x166b37-0x13f;const _0x334316=a67_0x3343();let _0x16f0bf=_0x334316[_0x166b37];return _0x16f0bf;}import*as a67_0x9f632 from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';export function findProjectConfigPath(_0x4b1b7d){const _0x234011=a67_0x16f0;let _0x32c88a=_0x4b1b7d||process['cwd']();while(!![]){const _0xe2ce38=a67_0x9f632[_0x234011(0x146)](_0x32c88a,PROJECT_CONFIG_FILENAME);if(a67_0x9f2e88[_0x234011(0x147)](_0xe2ce38))return _0xe2ce38;const _0x88a31f=a67_0x9f632[_0x234011(0x145)](_0x32c88a);if(_0x88a31f===_0x32c88a)return null;_0x32c88a=_0x88a31f;}}export function loadProjectConfig(_0xfa257d){const _0x591aea=a67_0x16f0,_0x455aa4=findProjectConfigPath(_0xfa257d);if(!_0x455aa4)return null;try{const _0x156913=a67_0x9f2e88['readFileSync'](_0x455aa4,_0x591aea(0x14c)),_0x55a8dc=JSON['parse'](_0x156913),_0xe01ec=JSON[_0x591aea(0x143)](_0x55a8dc);if(_0xe01ec[_0x591aea(0x149)](_0x591aea(0x159))||_0xe01ec[_0x591aea(0x149)](_0x591aea(0x154))||_0xe01ec[_0x591aea(0x149)](_0x591aea(0x14d)))throw new Error(_0x591aea(0x157)+_0x455aa4+').\x20'+_0x591aea(0x13f));const {metadata:_0x7df604,profile:_0x4cbd07,..._0x28cada}=_0x55a8dc;return _0x4cbd07&&console[_0x591aea(0x14b)]('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0x455aa4+_0x591aea(0x155)+_0x591aea(0x141)),_0x28cada;}catch(_0x266558){if(_0x266558 instanceof Error&&_0x591aea(0x148)in _0x266558&&_0x266558[_0x591aea(0x148)]===_0x591aea(0x15a))return null;throw new Error('Failed\x20to\x20load\x20project\x20config\x20from\x20'+_0x455aa4+':\x20'+_0x266558);}}export function saveProjectConfig(_0x41ebd5,_0xfb2c30){const _0x4dfd3f=a67_0x16f0,_0x584484=_0xfb2c30||process['cwd'](),_0x1ecd65=a67_0x9f632[_0x4dfd3f(0x146)](_0x584484,PROJECT_CONFIG_FILENAME),_0x16b8ff=JSON[_0x4dfd3f(0x143)](_0x41ebd5);if(_0x16b8ff[_0x4dfd3f(0x149)](_0x4dfd3f(0x159))||_0x16b8ff[_0x4dfd3f(0x149)]('apiKey')||_0x16b8ff[_0x4dfd3f(0x149)](_0x4dfd3f(0x14d)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if(_0x4dfd3f(0x158)in _0x41ebd5)throw new Error(_0x4dfd3f(0x156));a67_0x9f2e88[_0x4dfd3f(0x150)](_0x1ecd65,JSON[_0x4dfd3f(0x143)](_0x41ebd5,null,0x2));}export function hasProjectConfig(_0x264c93){return findProjectConfigPath(_0x264c93)!==null;}export function getProjectRoot(_0x4559d0){const _0x49f65f=a67_0x16f0,_0x40d4c2=findProjectConfigPath(_0x4559d0);return _0x40d4c2?a67_0x9f632[_0x49f65f(0x145)](_0x40d4c2):null;}
@@ -1 +1 @@
1
- (function(_0xc85600,_0x5e5fc3){const _0x196310=a68_0x31eb,_0x1fac23=_0xc85600();while(!![]){try{const _0x1e6a0d=-parseInt(_0x196310(0x1f9))/0x1*(-parseInt(_0x196310(0x20b))/0x2)+-parseInt(_0x196310(0x1fe))/0x3*(parseInt(_0x196310(0x1fc))/0x4)+-parseInt(_0x196310(0x1f8))/0x5+parseInt(_0x196310(0x200))/0x6+-parseInt(_0x196310(0x1fd))/0x7+parseInt(_0x196310(0x203))/0x8+parseInt(_0x196310(0x1f2))/0x9*(parseInt(_0x196310(0x1f1))/0xa);if(_0x1e6a0d===_0x5e5fc3)break;else _0x1fac23['push'](_0x1fac23['shift']());}catch(_0x49284a){_0x1fac23['push'](_0x1fac23['shift']());}}}(a68_0x4812,0x87dfe));import*as a68_0x2b56fa from'node:fs';import*as a68_0x1f6fa8 from'node:path';import*as a68_0x141954 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 _0x5d2a04=a68_0x31eb,_0x18c824=process.env.TDX_CONFIG_DIR||a68_0x1f6fa8[_0x5d2a04(0x1f4)](a68_0x141954['homedir'](),'.config','tdx');return a68_0x1f6fa8[_0x5d2a04(0x1f4)](_0x18c824,'sessions');}function getSessionPath(_0x184033){const _0x5dc7c3=a68_0x31eb;return a68_0x1f6fa8[_0x5dc7c3(0x1f4)](getSessionsDir(),_0x184033+_0x5dc7c3(0x20e));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x315078){const _0x5e6789=a68_0x31eb;if(_0x315078)return _0x315078;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x5e6789(0x209)]();}export function loadSessionContext(_0x5a8184){const _0x55ecc8=getSessionID(_0x5a8184),_0x190682=/^\d+$/['test'](_0x55ecc8)?parseInt(_0x55ecc8,0xa):null;return _0x190682!==null?loadSessionContextByPID(_0x190682):loadSessionContextByString(_0x55ecc8);}function a68_0x4812(){const _0x2fc129=['endsWith','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','.json','readFileSync','api_key','toISOString','test','.\x20This\x20is\x20insecure.\x20Removing\x20session.','591530AmKdJQ','63acHkYM','apiKey','join','warn','readdirSync','parse','3448780llTqqb','142lNwLml','stringify','getTime','6524eJYVIA','2965711wbyCnZ','723ahrJFL','replace','3889728lfURWy','createdAt','unlinkSync','7590824zyZRXA','writeFileSync','utf-8','existsSync','now','includes','toString','TD_API_KEY','730lAOcOM'];a68_0x4812=function(){return _0x2fc129;};return a68_0x4812();}export function loadSessionContextByPID(_0x158de0){const _0x57178f=a68_0x31eb,_0x8291a6=getSessionPath(_0x158de0);if(!a68_0x2b56fa[_0x57178f(0x206)](_0x8291a6))return null;try{const _0x7c74da=a68_0x2b56fa['readFileSync'](_0x8291a6,_0x57178f(0x205)),_0x5b2fb0=JSON['parse'](_0x7c74da),_0x527374=new Date(_0x5b2fb0['createdAt'])['getTime'](),_0x27fc93=Date[_0x57178f(0x207)]();if(_0x27fc93-_0x527374>SESSION_EXPIRATION_MS)return a68_0x2b56fa['unlinkSync'](_0x8291a6),null;const _0x5366f6=JSON[_0x57178f(0x1fa)](_0x5b2fb0);if(_0x5366f6[_0x57178f(0x208)](_0x57178f(0x20a))||_0x5366f6[_0x57178f(0x208)]('apiKey')||_0x5366f6[_0x57178f(0x208)](_0x57178f(0x210)))return console[_0x57178f(0x1f5)](_0x57178f(0x20d)+_0x8291a6+_0x57178f(0x1f0)),a68_0x2b56fa[_0x57178f(0x202)](_0x8291a6),null;return _0x5b2fb0;}catch{try{a68_0x2b56fa[_0x57178f(0x202)](_0x8291a6);}catch{}return null;}}function loadSessionContextByString(_0x45328){const _0x1dd9b9=a68_0x31eb,_0x1398a8=a68_0x1f6fa8['join'](getSessionsDir(),_0x45328+_0x1dd9b9(0x20e));if(!a68_0x2b56fa[_0x1dd9b9(0x206)](_0x1398a8))return null;try{const _0x36bc5a=a68_0x2b56fa['readFileSync'](_0x1398a8,_0x1dd9b9(0x205)),_0xd92a54=JSON[_0x1dd9b9(0x1f7)](_0x36bc5a),_0x3999e7=new Date(_0xd92a54[_0x1dd9b9(0x201)])[_0x1dd9b9(0x1fb)](),_0x504530=Date[_0x1dd9b9(0x207)]();if(_0x504530-_0x3999e7>SESSION_EXPIRATION_MS)return a68_0x2b56fa[_0x1dd9b9(0x202)](_0x1398a8),null;const _0x4fcd75=JSON[_0x1dd9b9(0x1fa)](_0xd92a54);if(_0x4fcd75[_0x1dd9b9(0x208)](_0x1dd9b9(0x20a))||_0x4fcd75[_0x1dd9b9(0x208)](_0x1dd9b9(0x1f3))||_0x4fcd75['includes'](_0x1dd9b9(0x210)))return console[_0x1dd9b9(0x1f5)](_0x1dd9b9(0x20d)+_0x1398a8+_0x1dd9b9(0x1f0)),a68_0x2b56fa[_0x1dd9b9(0x202)](_0x1398a8),null;return _0xd92a54;}catch{try{a68_0x2b56fa[_0x1dd9b9(0x202)](_0x1398a8);}catch{}return null;}}function a68_0x31eb(_0x84b898,_0x50ab50){_0x84b898=_0x84b898-0x1ee;const _0x48128e=a68_0x4812();let _0x31eb4b=_0x48128e[_0x84b898];return _0x31eb4b;}export function saveSessionContext(_0x275edc,_0x1a4944){const _0x253e92=a68_0x31eb,_0x2c319c=getSessionID(_0x1a4944),_0x20d9d4=/^\d+$/['test'](_0x2c319c)?parseInt(_0x2c319c,0xa):getCurrentSessionPID(),_0x393dc8=a68_0x1f6fa8[_0x253e92(0x1f4)](getSessionsDir(),_0x2c319c+_0x253e92(0x20e)),_0x5bb354=getSessionsDir();createSecureDirectory(_0x5bb354);const _0x2b1113=JSON[_0x253e92(0x1fa)](_0x275edc);if(_0x2b1113[_0x253e92(0x208)](_0x253e92(0x20a))||_0x2b1113[_0x253e92(0x208)](_0x253e92(0x1f3))||_0x2b1113[_0x253e92(0x208)](_0x253e92(0x210)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x2dcad0;const _0x1be6ab=/^\d+$/[_0x253e92(0x1ef)](_0x2c319c)?loadSessionContextByPID(parseInt(_0x2c319c,0xa)):loadSessionContextByString(_0x2c319c);_0x1be6ab?_0x2dcad0={..._0x1be6ab,..._0x275edc,'pid':_0x20d9d4,'sessionId':_0x2c319c!==_0x20d9d4[_0x253e92(0x209)]()?_0x2c319c:undefined,'updatedAt':new Date()[_0x253e92(0x1ee)]()}:_0x2dcad0={'pid':_0x20d9d4,'sessionId':_0x2c319c!==_0x20d9d4[_0x253e92(0x209)]()?_0x2c319c:undefined,..._0x275edc,'createdAt':new Date()[_0x253e92(0x1ee)](),'updatedAt':new Date()[_0x253e92(0x1ee)]()},a68_0x2b56fa[_0x253e92(0x204)](_0x393dc8,JSON[_0x253e92(0x1fa)](_0x2dcad0,null,0x2));}export function clearSessionContext(_0x9be2d6){const _0x4bb228=a68_0x31eb,_0x118df7=getSessionID(_0x9be2d6),_0x182880=a68_0x1f6fa8[_0x4bb228(0x1f4)](getSessionsDir(),_0x118df7+_0x4bb228(0x20e));a68_0x2b56fa[_0x4bb228(0x206)](_0x182880)&&a68_0x2b56fa[_0x4bb228(0x202)](_0x182880);}export function clearSessionContextField(_0x4931ed,_0x39d08b){const _0x4c7542=a68_0x31eb,_0x568173=getSessionID(_0x39d08b),_0x233348=a68_0x1f6fa8['join'](getSessionsDir(),_0x568173+_0x4c7542(0x20e));if(!a68_0x2b56fa['existsSync'](_0x233348))return;try{const _0x7bd10=a68_0x2b56fa[_0x4c7542(0x20f)](_0x233348,_0x4c7542(0x205)),_0x5a00d7=JSON[_0x4c7542(0x1f7)](_0x7bd10);delete _0x5a00d7[_0x4931ed],a68_0x2b56fa['writeFileSync'](_0x233348,JSON[_0x4c7542(0x1fa)](_0x5a00d7,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x2d8de9=a68_0x31eb,_0x47729a=getSessionsDir();if(!a68_0x2b56fa['existsSync'](_0x47729a))return 0x0;let _0x4654be=0x0;const _0x5a1b96=Date[_0x2d8de9(0x207)]();try{const _0xde9b67=a68_0x2b56fa[_0x2d8de9(0x1f6)](_0x47729a);for(const _0x5b3634 of _0xde9b67){if(!_0x5b3634[_0x2d8de9(0x20c)](_0x2d8de9(0x20e)))continue;const _0x45d132=a68_0x1f6fa8[_0x2d8de9(0x1f4)](_0x47729a,_0x5b3634),_0x2853ec=_0x5b3634[_0x2d8de9(0x1ff)]('.json',''),_0x12fca7=parseInt(_0x2853ec,0xa),_0x211c30=!isNaN(_0x12fca7);if(_0x211c30){if(!isProcessRunning(_0x12fca7)){a68_0x2b56fa['unlinkSync'](_0x45d132),_0x4654be++;continue;}}try{const _0x4301e0=a68_0x2b56fa[_0x2d8de9(0x20f)](_0x45d132,_0x2d8de9(0x205)),_0x3e0666=JSON['parse'](_0x4301e0),_0x3d2f71=new Date(_0x3e0666['createdAt'])[_0x2d8de9(0x1fb)]();_0x5a1b96-_0x3d2f71>SESSION_EXPIRATION_MS&&(a68_0x2b56fa[_0x2d8de9(0x202)](_0x45d132),_0x4654be++);}catch{a68_0x2b56fa[_0x2d8de9(0x202)](_0x45d132),_0x4654be++;}}}catch{}return _0x4654be;}export function listActiveSessions(){const _0x527978=a68_0x31eb,_0x408c71=getSessionsDir();if(!a68_0x2b56fa[_0x527978(0x206)](_0x408c71))return[];try{const _0x45cf7c=a68_0x2b56fa[_0x527978(0x1f6)](_0x408c71),_0x3b7098=[];for(const _0x48bf3e of _0x45cf7c){if(!_0x48bf3e['endsWith']('.json'))continue;const _0x475382=_0x48bf3e['replace']('.json',''),_0x407def=parseInt(_0x475382,0xa);!isNaN(_0x407def)&&isProcessRunning(_0x407def)&&_0x3b7098['push'](_0x407def);}return _0x3b7098['sort']((_0x489af5,_0x1b28d3)=>_0x489af5-_0x1b28d3);}catch{return[];}}
1
+ (function(_0x6ae5bc,_0x56e8ac){const _0x42d669=a68_0x3f5c,_0x356027=_0x6ae5bc();while(!![]){try{const _0x4896f1=-parseInt(_0x42d669(0xf3))/0x1+-parseInt(_0x42d669(0xfe))/0x2+-parseInt(_0x42d669(0xf6))/0x3+-parseInt(_0x42d669(0xee))/0x4*(-parseInt(_0x42d669(0xf0))/0x5)+parseInt(_0x42d669(0xe8))/0x6*(parseInt(_0x42d669(0xe0))/0x7)+parseInt(_0x42d669(0xdc))/0x8*(parseInt(_0x42d669(0xf9))/0x9)+-parseInt(_0x42d669(0xe3))/0xa*(-parseInt(_0x42d669(0xfd))/0xb);if(_0x4896f1===_0x56e8ac)break;else _0x356027['push'](_0x356027['shift']());}catch(_0x20a21e){_0x356027['push'](_0x356027['shift']());}}}(a68_0x22dc,0x8bc63));import*as a68_0x5bcfc7 from'node:fs';import*as a68_0x39ce04 from'node:path';import*as a68_0x128837 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 _0x2ae404=a68_0x3f5c,_0x2d99f1=process.env.TDX_CONFIG_DIR||a68_0x39ce04[_0x2ae404(0xec)](a68_0x128837[_0x2ae404(0xeb)](),_0x2ae404(0xea),_0x2ae404(0xf4));return a68_0x39ce04['join'](_0x2d99f1,'sessions');}function a68_0x22dc(){const _0x4e5364=['Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','includes','TD_API_KEY','toString','32raMckU','readdirSync','unlinkSync','api_key','1099924gCXZOu','endsWith','warn','30kkSOKb','test','createdAt','writeFileSync','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','42TPYTph','.json','.config','homedir','join','getTime','4135396kRImAi','apiKey','5VMcgtm','readFileSync','existsSync','421730MWQpeI','tdx','replace','1275075nAvvBf','push','stringify','37980kWAGvq','.\x20This\x20is\x20insecure.\x20Removing\x20session.','sort','utf-8','44627dmKxmZ','1487108YQqbPZ','now','toISOString','parse'];a68_0x22dc=function(){return _0x4e5364;};return a68_0x22dc();}function a68_0x3f5c(_0x149fe9,_0x1e4793){_0x149fe9=_0x149fe9-0xd6;const _0x22dcd2=a68_0x22dc();let _0x3f5c59=_0x22dcd2[_0x149fe9];return _0x3f5c59;}function getSessionPath(_0x3b9b58){const _0x509ac2=a68_0x3f5c;return a68_0x39ce04[_0x509ac2(0xec)](getSessionsDir(),_0x3b9b58+_0x509ac2(0xe9));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x33f725){const _0x3d28f2=a68_0x3f5c;if(_0x33f725)return _0x33f725;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x3d28f2(0xdb)]();}export function loadSessionContext(_0x2212fb){const _0x3ac2dc=a68_0x3f5c,_0x236028=getSessionID(_0x2212fb),_0x3c36d5=/^\d+$/[_0x3ac2dc(0xe4)](_0x236028)?parseInt(_0x236028,0xa):null;return _0x3c36d5!==null?loadSessionContextByPID(_0x3c36d5):loadSessionContextByString(_0x236028);}export function loadSessionContextByPID(_0x189974){const _0x269eff=a68_0x3f5c,_0x46e329=getSessionPath(_0x189974);if(!a68_0x5bcfc7[_0x269eff(0xf2)](_0x46e329))return null;try{const _0x2deffe=a68_0x5bcfc7[_0x269eff(0xf1)](_0x46e329,_0x269eff(0xfc)),_0x41bf3c=JSON['parse'](_0x2deffe),_0x2a4fd1=new Date(_0x41bf3c['createdAt'])[_0x269eff(0xed)](),_0x1f05f6=Date[_0x269eff(0xff)]();if(_0x1f05f6-_0x2a4fd1>SESSION_EXPIRATION_MS)return a68_0x5bcfc7['unlinkSync'](_0x46e329),null;const _0x6c5794=JSON[_0x269eff(0xf8)](_0x41bf3c);if(_0x6c5794[_0x269eff(0xd9)](_0x269eff(0xda))||_0x6c5794['includes'](_0x269eff(0xef))||_0x6c5794[_0x269eff(0xd9)]('api_key'))return console[_0x269eff(0xe2)](_0x269eff(0xd8)+_0x46e329+_0x269eff(0xfa)),a68_0x5bcfc7[_0x269eff(0xde)](_0x46e329),null;return _0x41bf3c;}catch{try{a68_0x5bcfc7[_0x269eff(0xde)](_0x46e329);}catch{}return null;}}function loadSessionContextByString(_0x586d8c){const _0x546c89=a68_0x3f5c,_0x139118=a68_0x39ce04[_0x546c89(0xec)](getSessionsDir(),_0x586d8c+_0x546c89(0xe9));if(!a68_0x5bcfc7[_0x546c89(0xf2)](_0x139118))return null;try{const _0x5b30a4=a68_0x5bcfc7[_0x546c89(0xf1)](_0x139118,_0x546c89(0xfc)),_0x2d72e2=JSON[_0x546c89(0xd7)](_0x5b30a4),_0xfcafa4=new Date(_0x2d72e2[_0x546c89(0xe5)])[_0x546c89(0xed)](),_0x456e6b=Date[_0x546c89(0xff)]();if(_0x456e6b-_0xfcafa4>SESSION_EXPIRATION_MS)return a68_0x5bcfc7['unlinkSync'](_0x139118),null;const _0x31e39c=JSON['stringify'](_0x2d72e2);if(_0x31e39c[_0x546c89(0xd9)](_0x546c89(0xda))||_0x31e39c[_0x546c89(0xd9)](_0x546c89(0xef))||_0x31e39c[_0x546c89(0xd9)](_0x546c89(0xdf)))return console[_0x546c89(0xe2)](_0x546c89(0xd8)+_0x139118+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a68_0x5bcfc7['unlinkSync'](_0x139118),null;return _0x2d72e2;}catch{try{a68_0x5bcfc7[_0x546c89(0xde)](_0x139118);}catch{}return null;}}export function saveSessionContext(_0x2e88b3,_0xf6d901){const _0x3b6359=a68_0x3f5c,_0x1cdf60=getSessionID(_0xf6d901),_0x53c94a=/^\d+$/[_0x3b6359(0xe4)](_0x1cdf60)?parseInt(_0x1cdf60,0xa):getCurrentSessionPID(),_0x18dd24=a68_0x39ce04[_0x3b6359(0xec)](getSessionsDir(),_0x1cdf60+_0x3b6359(0xe9)),_0x4ea6a2=getSessionsDir();createSecureDirectory(_0x4ea6a2);const _0x2432e8=JSON[_0x3b6359(0xf8)](_0x2e88b3);if(_0x2432e8[_0x3b6359(0xd9)](_0x3b6359(0xda))||_0x2432e8[_0x3b6359(0xd9)](_0x3b6359(0xef))||_0x2432e8[_0x3b6359(0xd9)](_0x3b6359(0xdf)))throw new Error(_0x3b6359(0xe7));let _0x10f368;const _0x14bbed=/^\d+$/[_0x3b6359(0xe4)](_0x1cdf60)?loadSessionContextByPID(parseInt(_0x1cdf60,0xa)):loadSessionContextByString(_0x1cdf60);_0x14bbed?_0x10f368={..._0x14bbed,..._0x2e88b3,'pid':_0x53c94a,'sessionId':_0x1cdf60!==_0x53c94a['toString']()?_0x1cdf60:undefined,'updatedAt':new Date()['toISOString']()}:_0x10f368={'pid':_0x53c94a,'sessionId':_0x1cdf60!==_0x53c94a[_0x3b6359(0xdb)]()?_0x1cdf60:undefined,..._0x2e88b3,'createdAt':new Date()[_0x3b6359(0xd6)](),'updatedAt':new Date()[_0x3b6359(0xd6)]()},a68_0x5bcfc7[_0x3b6359(0xe6)](_0x18dd24,JSON[_0x3b6359(0xf8)](_0x10f368,null,0x2));}export function clearSessionContext(_0x5ff0eb){const _0x2223bc=a68_0x3f5c,_0x57a200=getSessionID(_0x5ff0eb),_0x48cc56=a68_0x39ce04[_0x2223bc(0xec)](getSessionsDir(),_0x57a200+'.json');a68_0x5bcfc7['existsSync'](_0x48cc56)&&a68_0x5bcfc7[_0x2223bc(0xde)](_0x48cc56);}export function clearSessionContextField(_0x4b05cc,_0x90faf){const _0x1edd3f=a68_0x3f5c,_0x32e4b5=getSessionID(_0x90faf),_0x5d032f=a68_0x39ce04[_0x1edd3f(0xec)](getSessionsDir(),_0x32e4b5+_0x1edd3f(0xe9));if(!a68_0x5bcfc7[_0x1edd3f(0xf2)](_0x5d032f))return;try{const _0x735e5e=a68_0x5bcfc7[_0x1edd3f(0xf1)](_0x5d032f,_0x1edd3f(0xfc)),_0x4500c1=JSON[_0x1edd3f(0xd7)](_0x735e5e);delete _0x4500c1[_0x4b05cc],a68_0x5bcfc7['writeFileSync'](_0x5d032f,JSON['stringify'](_0x4500c1,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x25327f=a68_0x3f5c,_0x42586d=getSessionsDir();if(!a68_0x5bcfc7[_0x25327f(0xf2)](_0x42586d))return 0x0;let _0x70fbe=0x0;const _0x37ebe9=Date[_0x25327f(0xff)]();try{const _0x3a9b55=a68_0x5bcfc7[_0x25327f(0xdd)](_0x42586d);for(const _0x2ad90a of _0x3a9b55){if(!_0x2ad90a[_0x25327f(0xe1)](_0x25327f(0xe9)))continue;const _0x562944=a68_0x39ce04[_0x25327f(0xec)](_0x42586d,_0x2ad90a),_0x77c0f3=_0x2ad90a[_0x25327f(0xf5)](_0x25327f(0xe9),''),_0x12f2df=parseInt(_0x77c0f3,0xa),_0x2a0882=!isNaN(_0x12f2df);if(_0x2a0882){if(!isProcessRunning(_0x12f2df)){a68_0x5bcfc7['unlinkSync'](_0x562944),_0x70fbe++;continue;}}try{const _0x41ced5=a68_0x5bcfc7['readFileSync'](_0x562944,_0x25327f(0xfc)),_0x4c4d9c=JSON[_0x25327f(0xd7)](_0x41ced5),_0x25e7f1=new Date(_0x4c4d9c['createdAt'])[_0x25327f(0xed)]();_0x37ebe9-_0x25e7f1>SESSION_EXPIRATION_MS&&(a68_0x5bcfc7['unlinkSync'](_0x562944),_0x70fbe++);}catch{a68_0x5bcfc7[_0x25327f(0xde)](_0x562944),_0x70fbe++;}}}catch{}return _0x70fbe;}export function listActiveSessions(){const _0x1ac485=a68_0x3f5c,_0x29a6b0=getSessionsDir();if(!a68_0x5bcfc7[_0x1ac485(0xf2)](_0x29a6b0))return[];try{const _0x34f231=a68_0x5bcfc7[_0x1ac485(0xdd)](_0x29a6b0),_0x475195=[];for(const _0x28cbb1 of _0x34f231){if(!_0x28cbb1[_0x1ac485(0xe1)](_0x1ac485(0xe9)))continue;const _0x3ba72a=_0x28cbb1[_0x1ac485(0xf5)](_0x1ac485(0xe9),''),_0x44774b=parseInt(_0x3ba72a,0xa);!isNaN(_0x44774b)&&isProcessRunning(_0x44774b)&&_0x475195[_0x1ac485(0xf7)](_0x44774b);}return _0x475195[_0x1ac485(0xfb)]((_0x26bbb2,_0x44151a)=>_0x26bbb2-_0x44151a);}catch{return[];}}
@@ -1 +1 @@
1
- const a69_0x56a60b=a69_0x139d;(function(_0x57007d,_0x2134ab){const _0x51c469=a69_0x139d,_0xfdcc97=_0x57007d();while(!![]){try{const _0x1beee3=parseInt(_0x51c469(0x175))/0x1*(-parseInt(_0x51c469(0x173))/0x2)+-parseInt(_0x51c469(0x176))/0x3+-parseInt(_0x51c469(0x171))/0x4+-parseInt(_0x51c469(0x177))/0x5*(-parseInt(_0x51c469(0x170))/0x6)+-parseInt(_0x51c469(0x17a))/0x7+parseInt(_0x51c469(0x17d))/0x8+parseInt(_0x51c469(0x174))/0x9;if(_0x1beee3===_0x2134ab)break;else _0xfdcc97['push'](_0xfdcc97['shift']());}catch(_0x459bdc){_0xfdcc97['push'](_0xfdcc97['shift']());}}}(a69_0x13d7,0x3b5a5));function a69_0x139d(_0x381529,_0x22f26a){_0x381529=_0x381529-0x16e;const _0x13d76c=a69_0x13d7();let _0x139d5b=_0x13d76c[_0x381529];return _0x139d5b;}import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a69_0x56a60b(0x16f),a69_0x56a60b(0x16e));export function loadCachedUsers(_0x1763be){const _0x317125=a69_0x56a60b,_0x54ef28=userCache[_0x317125(0x179)](_0x1763be);return _0x54ef28?.[_0x317125(0x17c)]??null;}export function saveCachedUsers(_0x39e08b,_0x5ba017){const _0x22629e=a69_0x56a60b;userCache[_0x22629e(0x17b)](_0x39e08b,{'users':_0x5ba017,'cachedAt':Date[_0x22629e(0x178)]()});}export function clearUserCache(_0x36eee1){const _0x36a6c2=a69_0x56a60b;userCache[_0x36a6c2(0x172)](_0x36eee1);}function a69_0x13d7(){const _0x543c6b=['clear','229522XEaSqD','10981260aCryHJ','2cCmIhK','1362060YQAEhl','275yLTsLv','now','read','1904294rLZdGd','write','users','2925280inXPGS','core/user-cache','users-{profile}.json','3414ikbNVv','1673608lyvrwb'];a69_0x13d7=function(){return _0x543c6b;};return a69_0x13d7();}
1
+ const a69_0x2c925b=a69_0x1e04;(function(_0x30eb8c,_0x19fc79){const _0x3e624a=a69_0x1e04,_0xe9a055=_0x30eb8c();while(!![]){try{const _0x250596=parseInt(_0x3e624a(0xa4))/0x1*(parseInt(_0x3e624a(0xa5))/0x2)+-parseInt(_0x3e624a(0xa3))/0x3+parseInt(_0x3e624a(0x99))/0x4+-parseInt(_0x3e624a(0xa7))/0x5+-parseInt(_0x3e624a(0xa0))/0x6*(parseInt(_0x3e624a(0x9d))/0x7)+parseInt(_0x3e624a(0xa8))/0x8+parseInt(_0x3e624a(0x9c))/0x9;if(_0x250596===_0x19fc79)break;else _0xe9a055['push'](_0xe9a055['shift']());}catch(_0x4a7709){_0xe9a055['push'](_0xe9a055['shift']());}}}(a69_0x3b3a,0xaf070));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a69_0x2c925b(0x9f),a69_0x2c925b(0xa1));function a69_0x3b3a(){const _0x2faf32=['core/user-cache','read','2101767TOlgzM','1078139ibZcdL','2cGefEe','users','3267670pWpULA','8196640JlaCpf','278020cjXzRu','write','now','11757276WzTrZW','11417fhwQnu','clear','users-{profile}.json','5178bNSdfA'];a69_0x3b3a=function(){return _0x2faf32;};return a69_0x3b3a();}export function loadCachedUsers(_0x230318){const _0x242429=a69_0x2c925b,_0x446c8a=userCache[_0x242429(0xa2)](_0x230318);return _0x446c8a?.[_0x242429(0xa6)]??null;}export function saveCachedUsers(_0x1fccab,_0x4a429c){const _0x3fdc11=a69_0x2c925b;userCache[_0x3fdc11(0x9a)](_0x1fccab,{'users':_0x4a429c,'cachedAt':Date[_0x3fdc11(0x9b)]()});}function a69_0x1e04(_0x50a47e,_0x4373d9){_0x50a47e=_0x50a47e-0x99;const _0x3b3a9d=a69_0x3b3a();let _0x1e043b=_0x3b3a9d[_0x50a47e];return _0x1e043b;}export function clearUserCache(_0x292d28){const _0xf95262=a69_0x2c925b;userCache[_0xf95262(0x9e)](_0x292d28);}
@@ -1 +1 @@
1
- (function(_0x38e229,_0xaeccdf){const _0x4338d1=a70_0x1512,_0x2da4e6=_0x38e229();while(!![]){try{const _0x1118a9=parseInt(_0x4338d1(0x1d5))/0x1+parseInt(_0x4338d1(0x1d6))/0x2*(parseInt(_0x4338d1(0x1d0))/0x3)+parseInt(_0x4338d1(0x1d4))/0x4+-parseInt(_0x4338d1(0x1cb))/0x5*(-parseInt(_0x4338d1(0x1ce))/0x6)+-parseInt(_0x4338d1(0x1c9))/0x7+-parseInt(_0x4338d1(0x1d8))/0x8*(parseInt(_0x4338d1(0x1d2))/0x9)+-parseInt(_0x4338d1(0x1d3))/0xa;if(_0x1118a9===_0xaeccdf)break;else _0x2da4e6['push'](_0x2da4e6['shift']());}catch(_0x5765d9){_0x2da4e6['push'](_0x2da4e6['shift']());}}}(a70_0x3364,0xacfb0));import{readFileSync}from'fs';import{fileURLToPath}from'url';function a70_0x3364(){const _0x5d1fcc=['4857594xnppHa','0.0.0','258755hxXsUy','.dev','../../package.json','96XjPnig','version','3327hknEAO','includes','708273GsEodH','11921690cUtgEt','3217092wcYhZt','1085281KMPcgh','346otMlbh','parse','32fEUHDs','utf-8'];a70_0x3364=function(){return _0x5d1fcc;};return a70_0x3364();}function a70_0x1512(_0x5233ef,_0x401086){_0x5233ef=_0x5233ef-0x1c8;const _0x3364bd=a70_0x3364();let _0x1512bd=_0x3364bd[_0x5233ef];return _0x1512bd;}import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x5499e5=a70_0x1512;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x29d356=fileURLToPath(import.meta.url),_0x311684=dirname(_0x29d356);try{const _0x18dfcc=join(_0x311684,'../build-info.json');cachedBuildInfo=JSON[_0x5499e5(0x1d7)](readFileSync(_0x18dfcc,_0x5499e5(0x1c8)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x22519c=a70_0x1512;if(cachedVersion!==null)return cachedVersion;const _0x3eabc2=fileURLToPath(import.meta.url),_0x33d535=dirname(_0x3eabc2),_0x463e27=getBuildInfo();if(_0x463e27[_0x22519c(0x1cf)])return cachedVersion=_0x463e27[_0x22519c(0x1cf)],cachedVersion;try{const _0x1e7530=join(_0x33d535,_0x22519c(0x1cd)),_0xe7d2a4=JSON[_0x22519c(0x1d7)](readFileSync(_0x1e7530,_0x22519c(0x1c8)));cachedVersion=_0xe7d2a4['version'];}catch{cachedVersion=_0x22519c(0x1ca);}return cachedVersion;}export function isDevVersion(){const _0x51cacc=a70_0x1512,_0x3e398b=getVersion();return _0x3e398b[_0x51cacc(0x1d1)](_0x51cacc(0x1cc))||_0x3e398b['includes']('-');}
1
+ (function(_0x1c4dd8,_0x3b371e){const _0x200807=a70_0x39e2,_0x1c75da=_0x1c4dd8();while(!![]){try{const _0x485ed6=parseInt(_0x200807(0xb7))/0x1*(-parseInt(_0x200807(0xb5))/0x2)+parseInt(_0x200807(0xc2))/0x3+parseInt(_0x200807(0xc5))/0x4*(-parseInt(_0x200807(0xbb))/0x5)+-parseInt(_0x200807(0xc1))/0x6*(parseInt(_0x200807(0xbe))/0x7)+parseInt(_0x200807(0xc4))/0x8*(-parseInt(_0x200807(0xb8))/0x9)+-parseInt(_0x200807(0xb9))/0xa+parseInt(_0x200807(0xb6))/0xb;if(_0x485ed6===_0x3b371e)break;else _0x1c75da['push'](_0x1c75da['shift']());}catch(_0x26ae09){_0x1c75da['push'](_0x1c75da['shift']());}}}(a70_0x5135,0x1bbd4));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x550597=a70_0x39e2;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x4ce8c2=fileURLToPath(import.meta.url),_0x34f57c=dirname(_0x4ce8c2);try{const _0x240ac1=join(_0x34f57c,_0x550597(0xc0));cachedBuildInfo=JSON['parse'](readFileSync(_0x240ac1,_0x550597(0xbc)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}function a70_0x5135(){const _0x5a78a8=['.dev','../build-info.json','6ZPxakr','317466HaELWV','version','204216TiZNTA','20GURYZi','../../package.json','2ekLeTj','3712390juvlIv','16301aPPRKA','36Iluhpe','1314580iCSnLY','includes','17445lBsXru','utf-8','0.0.0','436660nZKltQ'];a70_0x5135=function(){return _0x5a78a8;};return a70_0x5135();}export function getVersion(){const _0x42c23f=a70_0x39e2;if(cachedVersion!==null)return cachedVersion;const _0x4be011=fileURLToPath(import.meta.url),_0x352cc2=dirname(_0x4be011),_0x3c1f7d=getBuildInfo();if(_0x3c1f7d[_0x42c23f(0xc3)])return cachedVersion=_0x3c1f7d['version'],cachedVersion;try{const _0x3da8a6=join(_0x352cc2,_0x42c23f(0xc6)),_0x565e66=JSON['parse'](readFileSync(_0x3da8a6,_0x42c23f(0xbc)));cachedVersion=_0x565e66[_0x42c23f(0xc3)];}catch{cachedVersion=_0x42c23f(0xbd);}return cachedVersion;}function a70_0x39e2(_0x1bd389,_0x28ddfc){_0x1bd389=_0x1bd389-0xb5;const _0x5135a5=a70_0x5135();let _0x39e20b=_0x5135a5[_0x1bd389];return _0x39e20b;}export function isDevVersion(){const _0x1cbb00=a70_0x39e2,_0x15b01b=getVersion();return _0x15b01b['includes'](_0x1cbb00(0xbf))||_0x15b01b[_0x1cbb00(0xba)]('-');}