@treasuredata/tdx 2026.4.13 → 2026.4.15

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 (221) hide show
  1. package/README.md +1 -1
  2. package/dist/bin.js +1 -1
  3. package/dist/build-info.json +3 -3
  4. package/dist/cli-categories.js +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/commands/activations.js +1 -1
  7. package/dist/commands/agent-command.js +1 -1
  8. package/dist/commands/agent-test-command.js +1 -1
  9. package/dist/commands/api-command.js +1 -1
  10. package/dist/commands/auth-command.js +1 -1
  11. package/dist/commands/cas-command.js +1 -1
  12. package/dist/commands/cas-segment-command.js +1 -1
  13. package/dist/commands/chat-command.js +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-statusline-command.js +1 -1
  16. package/dist/commands/claude-usage-command.js +1 -1
  17. package/dist/commands/command.js +1 -1
  18. package/dist/commands/connection-command.js +1 -1
  19. package/dist/commands/databases.js +1 -1
  20. package/dist/commands/delivery-command.js +1 -1
  21. package/dist/commands/describe.js +1 -1
  22. package/dist/commands/engage-campaign-pull-command.js +1 -1
  23. package/dist/commands/engage-campaign-push-command.js +1 -1
  24. package/dist/commands/engage-campaign-validate-command.js +1 -1
  25. package/dist/commands/engage-command.js +1 -1
  26. package/dist/commands/engage-template-pull-command.js +1 -1
  27. package/dist/commands/engage-template-push-command.js +1 -1
  28. package/dist/commands/engage-template-validate-command.js +1 -1
  29. package/dist/commands/job-command.js +1 -1
  30. package/dist/commands/journey-command.js +1 -1
  31. package/dist/commands/journey-validate-command.js +1 -1
  32. package/dist/commands/llm-command.js +1 -1
  33. package/dist/commands/mcp-command.js +1 -1
  34. package/dist/commands/parent-segment-command.js +1 -1
  35. package/dist/commands/policy-command.js +1 -1
  36. package/dist/commands/profile-command.js +1 -1
  37. package/dist/commands/profiles-command.js +1 -1
  38. package/dist/commands/query-command.js +1 -1
  39. package/dist/commands/schedule-command.js +1 -1
  40. package/dist/commands/segment-command.js +1 -1
  41. package/dist/commands/segment-create-command.js +1 -1
  42. package/dist/commands/segment-fields-command.js +1 -1
  43. package/dist/commands/segment-pull-command.js +1 -1
  44. package/dist/commands/segment-push-command.js +1 -1
  45. package/dist/commands/segment-update-command.js +1 -1
  46. package/dist/commands/segment-use-command.js +1 -1
  47. package/dist/commands/segment-validate-command.js +1 -1
  48. package/dist/commands/segments.js +1 -1
  49. package/dist/commands/show.js +1 -1
  50. package/dist/commands/status-command.js +1 -1
  51. package/dist/commands/tables.js +1 -1
  52. package/dist/commands/unset-command.js +1 -1
  53. package/dist/commands/upgrade-command.js +1 -1
  54. package/dist/commands/use-command.js +1 -1
  55. package/dist/commands/user-command.js +1 -1
  56. package/dist/commands/work-command.js +1 -1
  57. package/dist/commands/workflow-command.js +1 -1
  58. package/dist/core/auth.js +1 -1
  59. package/dist/core/command-output.js +1 -1
  60. package/dist/core/config.js +1 -1
  61. package/dist/core/connection-cache.js +1 -1
  62. package/dist/core/constants.js +1 -1
  63. package/dist/core/credential-cache.js +1 -1
  64. package/dist/core/global-context.js +1 -1
  65. package/dist/core/keychain.js +1 -1
  66. package/dist/core/oauth-keychain.js +1 -1
  67. package/dist/core/oauth.js +1 -1
  68. package/dist/core/profile.js +1 -1
  69. package/dist/core/project-config.js +1 -1
  70. package/dist/core/session.js +1 -1
  71. package/dist/core/user-cache.js +1 -1
  72. package/dist/core/version.js +1 -1
  73. package/dist/index.js +1 -1
  74. package/dist/mcp/server.js +1 -1
  75. package/dist/mcp/tools/index.js +1 -1
  76. package/dist/mcp/tools/tdx-run.js +1 -1
  77. package/dist/mcp/tools/tdx-search.js +1 -1
  78. package/dist/mcp/tools/work-create-item.js +1 -1
  79. package/dist/mcp/utils.js +1 -1
  80. package/dist/proxy/claude-usage-tracker.js +1 -1
  81. package/dist/proxy/passthrough-server.js +1 -1
  82. package/dist/proxy/sse-usage-parser.js +1 -1
  83. package/dist/sdk/agent/agent-config.js +1 -1
  84. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  85. package/dist/sdk/agent/agent-yaml.js +1 -1
  86. package/dist/sdk/agent/test/evaluator.js +1 -1
  87. package/dist/sdk/agent/test/executor.js +1 -1
  88. package/dist/sdk/agent/test/index.js +1 -1
  89. package/dist/sdk/agent/test/output.js +1 -1
  90. package/dist/sdk/agent/test/parser.js +1 -1
  91. package/dist/sdk/agent/tool-target-registry.js +1 -1
  92. package/dist/sdk/api.js +1 -1
  93. package/dist/sdk/cas/cas-api-client.js +1 -1
  94. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  95. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  96. package/dist/sdk/cas/index.js +1 -1
  97. package/dist/sdk/cas/pull-workflow.js +1 -1
  98. package/dist/sdk/cas/push-workflow.js +1 -1
  99. package/dist/sdk/client/cdp-api-client.js +1 -1
  100. package/dist/sdk/client/delivery-api-client.js +1 -1
  101. package/dist/sdk/client/endpoints.js +1 -1
  102. package/dist/sdk/client/engage-api-client.js +1 -1
  103. package/dist/sdk/client/http-client.js +1 -1
  104. package/dist/sdk/client/llm-api-client.js +1 -1
  105. package/dist/sdk/client/oauth-refresh.js +1 -1
  106. package/dist/sdk/client/rate-limiter.js +1 -1
  107. package/dist/sdk/client/td-api-client.js +1 -1
  108. package/dist/sdk/client/trino-api-client.js +1 -1
  109. package/dist/sdk/client/workflow-client.js +1 -1
  110. package/dist/sdk/connection-validator.js +1 -1
  111. package/dist/sdk/connection.js +1 -1
  112. package/dist/sdk/delivery.js +1 -1
  113. package/dist/sdk/engage/campaign-pull.js +1 -1
  114. package/dist/sdk/engage/campaign-push.js +1 -1
  115. package/dist/sdk/engage/campaign-validator.js +1 -1
  116. package/dist/sdk/engage/campaign-yaml.js +1 -1
  117. package/dist/sdk/engage/template-pull.js +1 -1
  118. package/dist/sdk/engage/template-push.js +1 -1
  119. package/dist/sdk/engage/template-validator.js +1 -1
  120. package/dist/sdk/engage/template-yaml.js +1 -1
  121. package/dist/sdk/engage/types/campaign-def.js +1 -1
  122. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  123. package/dist/sdk/engage/types/template-schema.js +1 -1
  124. package/dist/sdk/engage.js +1 -1
  125. package/dist/sdk/errors.js +1 -1
  126. package/dist/sdk/index.js +1 -1
  127. package/dist/sdk/io/index.js +1 -1
  128. package/dist/sdk/io/node-filesystem.js +1 -1
  129. package/dist/sdk/job.js +1 -1
  130. package/dist/sdk/journey.js +1 -1
  131. package/dist/sdk/llm/chat-cache.js +1 -1
  132. package/dist/sdk/llm/index.js +1 -1
  133. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  134. package/dist/sdk/llm/model-factors.js +1 -1
  135. package/dist/sdk/personalization.js +1 -1
  136. package/dist/sdk/policy.js +1 -1
  137. package/dist/sdk/query/index.js +1 -1
  138. package/dist/sdk/query/sql-parser.js +1 -1
  139. package/dist/sdk/realtime.js +1 -1
  140. package/dist/sdk/schedule.js +1 -1
  141. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  142. package/dist/sdk/segment/fields-display.js +1 -1
  143. package/dist/sdk/segment/file-discovery.js +1 -1
  144. package/dist/sdk/segment/journey-utils.js +1 -1
  145. package/dist/sdk/segment/journey-validator.js +1 -1
  146. package/dist/sdk/segment/journey-yaml.js +1 -1
  147. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  148. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  149. package/dist/sdk/segment/pull-workflow.js +1 -1
  150. package/dist/sdk/segment/push-recovery.js +1 -1
  151. package/dist/sdk/segment/push-workflow.js +1 -1
  152. package/dist/sdk/segment/resolution-context.js +1 -1
  153. package/dist/sdk/segment/segment-path-parser.js +1 -1
  154. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  155. package/dist/sdk/segment/segment-validator.js +1 -1
  156. package/dist/sdk/segment/target-resolution.js +1 -1
  157. package/dist/sdk/segment/tdx-config.js +1 -1
  158. package/dist/sdk/segment/types/activation-schema.js +1 -1
  159. package/dist/sdk/segment/types/journey-def.js +1 -1
  160. package/dist/sdk/segment/types/journey-schema.js +1 -1
  161. package/dist/sdk/segment/types/segment-def.js +1 -1
  162. package/dist/sdk/segment/types/segment-schema.js +1 -1
  163. package/dist/sdk/segment/validate-files.js +1 -1
  164. package/dist/sdk/segment/yaml-validator.js +1 -1
  165. package/dist/sdk/segment.js +1 -1
  166. package/dist/sdk/types/index.js +1 -1
  167. package/dist/sdk/types/progress.js +1 -1
  168. package/dist/sdk/types/workspace.js +1 -1
  169. package/dist/sdk/user.js +1 -1
  170. package/dist/sdk/util/format-detector.js +1 -1
  171. package/dist/sdk/util/formatters.js +1 -1
  172. package/dist/sdk/util/index.js +1 -1
  173. package/dist/sdk/util/paginate.js +1 -1
  174. package/dist/sdk/util/tree-formatter.js +1 -1
  175. package/dist/sdk/workflow/archive-validation.js +1 -1
  176. package/dist/sdk/workflow/clone-workflow.js +1 -1
  177. package/dist/sdk/workflow/index.js +1 -1
  178. package/dist/sdk/workflow/pull-workflow.js +1 -1
  179. package/dist/sdk/workflow/push-workflow.js +1 -1
  180. package/dist/sdk/workflow/tdx-config.js +1 -1
  181. package/dist/sdk/workflow/workflow-utils.js +1 -1
  182. package/dist/sdk/workspace/access-tracker.js +1 -1
  183. package/dist/sdk/workspace/frontmatter.js +1 -1
  184. package/dist/sdk/workspace/git.js +1 -1
  185. package/dist/sdk/workspace/index.js +1 -1
  186. package/dist/sdk/workspace/templates.js +1 -1
  187. package/dist/sdk/workspace/weekly.js +1 -1
  188. package/dist/sdk/workspace/wikilinks.js +1 -1
  189. package/dist/test-utils/command-runner.js +1 -1
  190. package/dist/test-utils/factories.js +1 -1
  191. package/dist/test-utils/fixtures.js +1 -1
  192. package/dist/test-utils/http-mock.js +1 -1
  193. package/dist/test-utils/index.js +1 -1
  194. package/dist/utils/async.js +1 -1
  195. package/dist/utils/colors.js +1 -1
  196. package/dist/utils/diff.js +1 -1
  197. package/dist/utils/file-permissions.js +1 -1
  198. package/dist/utils/file-reader.js +1 -1
  199. package/dist/utils/github-releases.js +1 -1
  200. package/dist/utils/global-cache.js +1 -1
  201. package/dist/utils/json-loader.js +1 -1
  202. package/dist/utils/local-cache.js +1 -1
  203. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  204. package/dist/utils/logger/formatters/index.js +1 -1
  205. package/dist/utils/logger/handlers/console-handler.js +1 -1
  206. package/dist/utils/logger/handlers/file-handler.js +1 -1
  207. package/dist/utils/logger/handlers/index.js +1 -1
  208. package/dist/utils/logger/handlers/null-handler.js +1 -1
  209. package/dist/utils/logger/index.js +1 -1
  210. package/dist/utils/logger/logger.js +1 -1
  211. package/dist/utils/logger/types.js +1 -1
  212. package/dist/utils/option-validation.js +1 -1
  213. package/dist/utils/process.js +1 -1
  214. package/dist/utils/prompt.js +1 -1
  215. package/dist/utils/spinner.js +1 -1
  216. package/dist/utils/sse-parser.js +1 -1
  217. package/dist/utils/string-utils.js +1 -1
  218. package/dist/utils/table-ref-parser.js +1 -1
  219. package/dist/utils/tdx-logger.js +1 -1
  220. package/dist/utils/version-check.js +1 -1
  221. package/package.json +30 -12
@@ -1 +1 @@
1
- const a57_0x2f3093=a57_0x451b;(function(_0x56308d,_0xb9ecb2){const _0x507da5=a57_0x451b,_0x400734=_0x56308d();while(!![]){try{const _0x43fec1=-parseInt(_0x507da5(0xf1))/0x1*(-parseInt(_0x507da5(0x108))/0x2)+-parseInt(_0x507da5(0x110))/0x3+parseInt(_0x507da5(0x137))/0x4*(parseInt(_0x507da5(0x131))/0x5)+-parseInt(_0x507da5(0x118))/0x6*(parseInt(_0x507da5(0x109))/0x7)+parseInt(_0x507da5(0xf9))/0x8+-parseInt(_0x507da5(0x12c))/0x9*(-parseInt(_0x507da5(0xfc))/0xa)+-parseInt(_0x507da5(0x102))/0xb*(-parseInt(_0x507da5(0x11b))/0xc);if(_0x43fec1===_0xb9ecb2)break;else _0x400734['push'](_0x400734['shift']());}catch(_0x250353){_0x400734['push'](_0x400734['shift']());}}}(a57_0x30f3,0x39cb4));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a57_0x15ca53 from'node:fs';import*as a57_0x8d98d9 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 a57_0x451b(_0x4eb09e,_0x16fa83){_0x4eb09e=_0x4eb09e-0xef;const _0x30f3d7=a57_0x30f3();let _0x451ba0=_0x30f3d7[_0x4eb09e];return _0x451ba0;}import a57_0x3eedd8 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x55d6f0=a57_0x451b;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x55d6f0(0x106),_0x55d6f0(0x10e));}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x31d495){const _0x263cc0=a57_0x451b,_0xfc67b9=getConfigDir();return _0x31d495?a57_0x8d98d9[_0x263cc0(0x11a)](_0xfc67b9,'.env.'+_0x31d495):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a57_0x2f3093(0xfa),a57_0x2f3093(0x101));export function getLLMProjectCacheFile(_0x39792f){const _0x1d7241=a57_0x2f3093;return llmProjectCache[_0x1d7241(0xf2)](_0x39792f);}export function readCachedLLMProject(_0x43973e){const _0x4aa0f4=a57_0x2f3093,_0x429dc8=llmProjectCache[_0x4aa0f4(0x100)](_0x43973e);if(_0x429dc8&&typeof _0x429dc8['id']===_0x4aa0f4(0xfe)&&typeof _0x429dc8['name']===_0x4aa0f4(0xfe))return _0x429dc8;return null;}export function writeCachedLLMProject(_0xe25992,_0x2d20ac,_0xf22033){const _0x18ade2=a57_0x2f3093;try{llmProjectCache[_0x18ade2(0x123)]({'name':_0xe25992,'id':_0x2d20ac},_0xf22033);}catch{}}function a57_0x30f3(){const _0x1a2405=['TDX_ACCESS_TOKEN\x20env\x20var','write','existsSync','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','number','us01','site','entries','next','config/llm-agent','62235AANLBj','replace','stg-ap03','tdx.json','stg-us01','728300GskZqo','apiKeys','account_info','apiKey','TDX_API_KEY\x20env\x20var','source','8yolxQj','slice','.json','Warning:\x20Failed\x20to\x20read\x20','warn','199qzvAmI','path','stg-ap01','keychain\x20(profile:\x20','ap02','TDX_ACCESS_TOKEN_FILE','TDX_API_KEY_','map','1979432kBQTXc','llm_default_project','ap01','230ywkzgt','match','string','parse','read','config/llm-project','449845LLafeu','dev-us01','llm_default_agent','name','.config','projectId','1038jVJgvE','21xQKVYy','TD_API_KEY_','yellow','readFileSync','TDX_ACCESS_TOKEN_','tdx','toUpperCase','1393245QQAalM','includes','release_channel','dev-eu01','stable','trim','eu01','\x27,\x20defaulting\x20to\x20us01','445242exElxM','accessToken','join','36SnvufS','Warning:\x20Unknown\x20site\x20\x27','ap03','split','keychain','startsWith','utf-8'];a57_0x30f3=function(){return _0x1a2405;};return a57_0x30f3();}const llmAgentCache=createOptionalProfileCache(a57_0x2f3093(0x104),a57_0x2f3093(0x12b));export function getLLMAgentCacheFile(_0x44c0e5){const _0x50a3d4=a57_0x2f3093;return llmAgentCache[_0x50a3d4(0xf2)](_0x44c0e5);}export function readCachedLLMAgent(_0x24c71f){const _0x52701f=a57_0x2f3093,_0x50f8a8=llmAgentCache[_0x52701f(0x100)](_0x24c71f);if(_0x50f8a8&&typeof _0x50f8a8['id']===_0x52701f(0xfe)&&typeof _0x50f8a8[_0x52701f(0x105)]===_0x52701f(0xfe)&&typeof _0x50f8a8[_0x52701f(0x107)]===_0x52701f(0xfe))return _0x50f8a8;return null;}export function writeCachedLLMAgent(_0x4e104e,_0x443a60,_0xba9d97,_0xe15307){const _0x57510=a57_0x2f3093;try{llmAgentCache[_0x57510(0x123)]({'name':_0x4e104e,'id':_0x443a60,'projectId':_0xba9d97},_0xe15307);}catch{}}export function clearCachedLLMAgent(_0x41b90f){try{llmAgentCache['clear'](_0x41b90f);}catch{}}const accountInfoCache=createOptionalProfileCache(a57_0x2f3093(0x133),'config/account-info',{'suffix':a57_0x2f3093(0x139)});export function getAccountInfoCacheFile(_0x4281fe){const _0x3a9d61=a57_0x2f3093;return accountInfoCache[_0x3a9d61(0xf2)](_0x4281fe);}export function readCachedAccountInfo(_0x5aac63){const _0x441109=a57_0x2f3093,_0x3a39e4=accountInfoCache['read'](_0x5aac63);if(_0x3a39e4&&typeof _0x3a39e4[_0x441109(0x128)]===_0x441109(0xfe)&&typeof _0x3a39e4['accountId']===_0x441109(0x126))return _0x3a39e4;return null;}export function writeCachedAccountInfo(_0x4cde99,_0x5b75ed,_0x41f535){const _0x2806e0=a57_0x2f3093;try{accountInfoCache[_0x2806e0(0x123)]({'site':_0x4cde99,'accountId':_0x5b75ed,'cachedAt':new Date()['toISOString']()},_0x41f535);}catch{}}export function parseEnvFile(_0x5e801b){const _0x205ba3=a57_0x2f3093,_0x4fc32b={};for(const _0x3c0149 of _0x5e801b[_0x205ba3(0x11e)]('\x0a')){const _0x267018=_0x3c0149['trim']();if(!_0x267018||_0x267018['startsWith']('#'))continue;const _0x1918b1=_0x267018[_0x205ba3(0xfd)](/^([^=]+)=(.*)$/);if(_0x1918b1){const _0x103504=_0x1918b1[0x1][_0x205ba3(0x115)]();let _0x2dd021=_0x1918b1[0x2][_0x205ba3(0x115)]();(_0x2dd021[_0x205ba3(0x120)]('\x22')&&_0x2dd021['endsWith']('\x22')||_0x2dd021[_0x205ba3(0x120)]('\x27')&&_0x2dd021['endsWith']('\x27'))&&(_0x2dd021=_0x2dd021[_0x205ba3(0x138)](0x1,-0x1)),_0x4fc32b[_0x103504]=_0x2dd021;}}return _0x4fc32b;}export function readUserConfig(){const _0x842447=a57_0x2f3093,_0x1f1ada=getConfigFile();if(!existsSync(_0x1f1ada))return{};try{const _0x4dcdb2=readFileSync(_0x1f1ada,'utf-8');return parseEnvFile(_0x4dcdb2);}catch(_0x5e7696){return console[_0x842447(0xf0)](_0x842447(0x125)+_0x1f1ada+':',_0x5e7696),{};}}export function resolveSite(_0xa6329d){const _0x16d523=a57_0x2f3093,_0x288c58=['us01',_0x16d523(0xfb),_0x16d523(0x116),'ap02',_0x16d523(0x11d),_0x16d523(0x103),_0x16d523(0x113),_0x16d523(0x130),'stg-ap01',_0x16d523(0x12e)];if(_0x288c58[_0x16d523(0x111)](_0xa6329d))return _0xa6329d;if(_0xa6329d in SITE_ALIASES)return SITE_ALIASES[_0xa6329d];return console['warn'](_0x16d523(0x11c)+_0xa6329d+_0x16d523(0x117)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x5a4a65){const _0x240dde=a57_0x2f3093,_0x2770ab=_0x5a4a65||getActiveProfileName()||undefined;if(_0x2770ab){const _0x10578c=_0x240dde(0x10d)+normalizeProfileForEnvVar(_0x2770ab);if(process.env[_0x10578c])return{'accessToken':process.env[_0x10578c],'source':_0x10578c+'\x20env\x20var'};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x240dde(0x122)};if(process.env.TDX_ACCESS_TOKEN_FILE){const _0x433a04=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x433a04)return{'accessToken':_0x433a04,'source':_0x240dde(0xf6)};}return null;}function readAccessTokenFile(_0x22e2f3){const _0x5decae=a57_0x2f3093;try{const _0x2ee724=readFileSync(_0x22e2f3,_0x5decae(0x121))['trim']();return _0x2ee724||null;}catch{return null;}}export function getAccessToken(_0x7e7949){const _0x3fc00c=a57_0x2f3093;return resolveAccessToken(_0x7e7949)?.[_0x3fc00c(0x119)];}export function getAPIKey(_0x66320e){const _0x1255e5=a57_0x2f3093,_0x14eae7=_0x66320e||getActiveProfileName();if(_0x14eae7){const _0x5b2c4b=_0x1255e5(0xf7)+normalizeProfileForEnvVar(_0x14eae7);if(process.env[_0x5b2c4b])return process.env[_0x5b2c4b];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x30a5f3){const _0x395f21=a57_0x2f3093;return _0x30a5f3[_0x395f21(0x10f)]()[_0x395f21(0x12d)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x1faaa0,_0x584235){const _0x3fc715=a57_0x2f3093,_0x463c69=resolveAccessToken(_0x584235);if(_0x463c69)return{'apiKey':_0x463c69['accessToken'],'source':_0x463c69[_0x3fc715(0x136)],'isDeprecated':![]};const _0x355a4f=_0x584235||getActiveProfileName()||undefined;if(_0x355a4f){const _0x69c987='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x355a4f);if(process.env[_0x69c987])return{'apiKey':process.env[_0x69c987],'source':_0x69c987+'\x20env\x20var','isDeprecated':![]};const _0x338ed=getCachedCredential(_0x1faaa0,_0x355a4f);if(_0x338ed)return{'apiKey':_0x338ed,'source':_0x3fc715(0xf4)+_0x355a4f+')','isDeprecated':![]};const _0x8834e8=await getKeychainAPIKey(_0x355a4f);if(_0x8834e8)return setCachedCredential(_0x8834e8,_0x1faaa0,_0x355a4f),{'apiKey':_0x8834e8,'source':_0x3fc715(0xf4)+_0x355a4f+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x3fc715(0x135),'isDeprecated':![]};if(!_0x355a4f){const _0x50592f=getCachedCredential(_0x1faaa0,undefined);if(_0x50592f)return{'apiKey':_0x50592f,'source':'keychain','isDeprecated':![]};const _0x3cca11=await getKeychainAPIKey(undefined);if(_0x3cca11)return setCachedCredential(_0x3cca11,_0x1faaa0,undefined),{'apiKey':_0x3cca11,'source':_0x3fc715(0x11f),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x2ddd42,_0x330bb2){const _0x53174c=a57_0x2f3093,_0x4be9f5=await resolveAPIKeyAsync(_0x2ddd42,_0x330bb2);return _0x4be9f5?.[_0x53174c(0x134)];}function cleanupLegacyEnvFile(_0x10fe47){const _0x412e42=a57_0x2f3093;if(!existsSync(_0x10fe47))return![];try{const _0x31fea7=readFileSync(_0x10fe47,_0x412e42(0x121)),_0x14a618=_0x31fea7[_0x412e42(0x11e)]('\x0a'),_0x2552cf=_0x14a618['filter'](_0x2c03b6=>{const _0x39cbb6=_0x412e42,_0x3f6b2f=_0x2c03b6['trim']();if(!_0x3f6b2f||_0x3f6b2f[_0x39cbb6(0x120)]('#'))return!![];const [_0x44e76e]=_0x3f6b2f[_0x39cbb6(0x11e)]('=');return!_0x44e76e['startsWith']('TD_API_KEY');}),_0x31a5ef=_0x2552cf['some'](_0x11b55b=>{const _0x560e19=_0x412e42,_0x1b240b=_0x11b55b[_0x560e19(0x115)]();return _0x1b240b&&!_0x1b240b['startsWith']('#');});if(!_0x31a5ef)return unlinkSync(_0x10fe47),!![];return writeFileSync(_0x10fe47,_0x2552cf[_0x412e42(0x11a)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x318b63=a57_0x2f3093;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0xca15cc=a57_0x8d98d9[_0x318b63(0x11a)](getConfigDir(),_0x318b63(0x12f));if(!a57_0x15ca53[_0x318b63(0x124)](_0xca15cc))return null;try{const _0x179d0b=a57_0x15ca53['readFileSync'](_0xca15cc,_0x318b63(0x121)),_0x3f8416=JSON[_0x318b63(0xff)](_0x179d0b);return _0x3f8416['profile']||null;}catch{return null;}}export function saveAPIKey(_0x2a5e69,_0x29d3c4,_0x4af294){const _0x44c0b3=a57_0x2f3093,_0x205fc2=getConfigDir(),_0x4d909a=getConfigFilePath(_0x4af294);!existsSync(_0x205fc2)&&mkdirSync(_0x205fc2,{'recursive':!![],'mode':0x1c0});let _0x10dcd6={};if(existsSync(_0x4d909a))try{const _0x5c220d=readFileSync(_0x4d909a,_0x44c0b3(0x121));_0x10dcd6=parseEnvFile(_0x5c220d);}catch(_0x4e7599){console[_0x44c0b3(0xf0)](_0x44c0b3(0xef)+_0x4d909a+':',_0x4e7599);}const _0xdc98db=_0x2a5e69['toUpperCase']()[_0x44c0b3(0x12d)](/-/g,'_');_0x10dcd6[_0x44c0b3(0x10a)+_0xdc98db]=_0x29d3c4;const _0x17293a=Object[_0x44c0b3(0x129)](_0x10dcd6)[_0x44c0b3(0xf8)](([_0x3a23f7,_0x938510])=>_0x3a23f7+'='+_0x938510);writeFileSync(_0x4d909a,_0x17293a['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x23d8ed,_0x35da4b,_0x403f35){const _0x30e153=a57_0x2f3093;await saveKeychainAPIKey(_0x23d8ed,_0x403f35),setCachedCredential(_0x23d8ed,_0x35da4b,_0x403f35);const _0x3da03b=getConfigFilePath(_0x403f35);cleanupLegacyEnvFile(_0x3da03b)&&console['warn'](a57_0x3eedd8[_0x30e153(0x10b)]('⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'));}export function loadConfig(){const _0x5a939=a57_0x2f3093,_0x1a12b7={'apiKeys':{},'defaultSite':_0x5a939(0x127)},_0x3ce193=[_0x5a939(0x127),'ap01',_0x5a939(0x116),_0x5a939(0xf5),'ap03','dev-us01','dev-eu01',_0x5a939(0x130),_0x5a939(0xf3),'stg-ap03'],_0x1a841e=getAPIKey();if(_0x1a841e)for(const _0x255b75 of _0x3ce193){_0x1a12b7[_0x5a939(0x132)][_0x255b75]=_0x1a841e;}return _0x1a12b7;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x24b49d=a57_0x2f3093,_0x2105f7=a57_0x8d98d9[_0x24b49d(0x11a)](getConfigDir(),_0x24b49d(0x12f));if(!a57_0x15ca53['existsSync'](_0x2105f7))return undefined;try{const _0x4d7c42=a57_0x15ca53[_0x24b49d(0x10c)](_0x2105f7,_0x24b49d(0x121)),_0x1aa796=JSON[_0x24b49d(0xff)](_0x4d7c42);return typeof _0x1aa796['proxy']===_0x24b49d(0xfe)?_0x1aa796['proxy']:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x3aabbb=a57_0x2f3093,_0x492d3b=process.env.TDX_RELEASE_CHANNEL;if(_0x492d3b===_0x3aabbb(0x12a)||_0x492d3b===_0x3aabbb(0x114))return _0x492d3b;const _0x41e454=a57_0x8d98d9['join'](getConfigDir(),'tdx.json');if(!a57_0x15ca53[_0x3aabbb(0x124)](_0x41e454))return'stable';try{const _0x2cbb84=a57_0x15ca53[_0x3aabbb(0x10c)](_0x41e454,_0x3aabbb(0x121)),_0x17bfe1=JSON[_0x3aabbb(0xff)](_0x2cbb84);if(_0x17bfe1[_0x3aabbb(0x112)]==='next')return _0x3aabbb(0x12a);}catch{}return _0x3aabbb(0x114);}export function saveReleaseChannel(_0x2914ac){const _0x50af98=a57_0x2f3093,_0x2abf66=getConfigDir(),_0x208b85=a57_0x8d98d9[_0x50af98(0x11a)](_0x2abf66,_0x50af98(0x12f));!existsSync(_0x2abf66)&&mkdirSync(_0x2abf66,{'recursive':!![],'mode':0x1c0});let _0x39b4a3={};if(existsSync(_0x208b85))try{const _0x395029=readFileSync(_0x208b85,_0x50af98(0x121));_0x39b4a3=JSON[_0x50af98(0xff)](_0x395029);}catch{}_0x39b4a3[_0x50af98(0x112)]=_0x2914ac,writeFileSync(_0x208b85,JSON['stringify'](_0x39b4a3,null,0x2),{'mode':0x180});}
1
+ const a57_0x5f0c55=a57_0x286c;(function(_0x164261,_0x49b1a1){const _0x3cde09=a57_0x286c,_0xfdefc3=_0x164261();while(!![]){try{const _0x43fcb3=-parseInt(_0x3cde09(0x130))/0x1+-parseInt(_0x3cde09(0x108))/0x2*(-parseInt(_0x3cde09(0x114))/0x3)+parseInt(_0x3cde09(0x104))/0x4+parseInt(_0x3cde09(0x101))/0x5*(-parseInt(_0x3cde09(0x13e))/0x6)+parseInt(_0x3cde09(0x144))/0x7*(parseInt(_0x3cde09(0x124))/0x8)+-parseInt(_0x3cde09(0x126))/0x9*(-parseInt(_0x3cde09(0x119))/0xa)+-parseInt(_0x3cde09(0x12e))/0xb;if(_0x43fcb3===_0x49b1a1)break;else _0xfdefc3['push'](_0xfdefc3['shift']());}catch(_0xd0610a){_0xfdefc3['push'](_0xfdefc3['shift']());}}}(a57_0x2789,0x8b4a3));import{homedir}from'os';import{join}from'path';function a57_0x286c(_0x302472,_0x96a349){_0x302472=_0x302472-0xf8;const _0x278919=a57_0x2789();let _0x286caf=_0x278919[_0x302472];return _0x286caf;}import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a57_0x57ec4b from'node:fs';import*as a57_0x573bb8 from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a57_0x55c74f from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';function a57_0x2789(){const _0xdf5fd9=['433202UwgwPN','name','.env','projectId','.env.','dev-eu01','\x27,\x20defaulting\x20to\x20us01','ap01','endsWith','apiKeys','10740jzMVJF','site','account_info','1028420FeXwHH','toISOString','map','clear','89986ufNRHr','\x20env\x20var','eu01','existsSync','stringify','stg-us01','profile','TDX_API_KEY\x20env\x20var','us01','filter','apiKey','replace','9JXjYQy','split','llm_default_project','.config','llm_default_agent','4468790Tgwveq','join','source','TDX_ACCESS_TOKEN\x20env\x20var','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','trim','read','stable','stg-ap03','stg-ap01','release_channel','136ZEEOKk','entries','18oTOQHj','includes','yellow','match','proxy','accessToken','config/llm-agent','string','15777014jtotcv','toUpperCase','229995fuJtJl','ap03','Warning:\x20Unknown\x20site\x20\x27','dev-us01','Warning:\x20Failed\x20to\x20read\x20','readFileSync','some','tdx.json','parse','ap02','TDX_ACCESS_TOKEN_FILE','warn','accountId','utf-8','288OGTvmE','TDX_API_KEY_','keychain','tdx','startsWith','keychain\x20(profile:\x20'];a57_0x2789=function(){return _0xdf5fd9;};return a57_0x2789();}export function getConfigDir(){const _0x421534=a57_0x286c;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x421534(0x117),_0x421534(0x141));}export function getConfigFile(){const _0x197b16=a57_0x286c;return join(getConfigDir(),_0x197b16(0xf9));}export function getConfigFilePath(_0x2d6dbb){const _0x8aa949=a57_0x286c,_0x272456=getConfigDir();return _0x2d6dbb?a57_0x573bb8[_0x8aa949(0x11a)](_0x272456,_0x8aa949(0xfb)+_0x2d6dbb):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache(a57_0x5f0c55(0x116),'config/llm-project');export function getLLMProjectCacheFile(_0x485ffa){return llmProjectCache['path'](_0x485ffa);}export function readCachedLLMProject(_0x219daa){const _0x4edde2=a57_0x5f0c55,_0x123487=llmProjectCache[_0x4edde2(0x11f)](_0x219daa);if(_0x123487&&typeof _0x123487['id']===_0x4edde2(0x12d)&&typeof _0x123487[_0x4edde2(0xf8)]===_0x4edde2(0x12d))return _0x123487;return null;}export function writeCachedLLMProject(_0x51678c,_0x1520df,_0x5a72f8){try{llmProjectCache['write']({'name':_0x51678c,'id':_0x1520df},_0x5a72f8);}catch{}}const llmAgentCache=createOptionalProfileCache(a57_0x5f0c55(0x118),a57_0x5f0c55(0x12c));export function getLLMAgentCacheFile(_0x4dba23){return llmAgentCache['path'](_0x4dba23);}export function readCachedLLMAgent(_0x1d2cdb){const _0x8b733a=a57_0x5f0c55,_0x455d1b=llmAgentCache[_0x8b733a(0x11f)](_0x1d2cdb);if(_0x455d1b&&typeof _0x455d1b['id']===_0x8b733a(0x12d)&&typeof _0x455d1b[_0x8b733a(0xf8)]===_0x8b733a(0x12d)&&typeof _0x455d1b[_0x8b733a(0xfa)]===_0x8b733a(0x12d))return _0x455d1b;return null;}export function writeCachedLLMAgent(_0x1e26d5,_0x503e63,_0x3443a9,_0x5ba510){try{llmAgentCache['write']({'name':_0x1e26d5,'id':_0x503e63,'projectId':_0x3443a9},_0x5ba510);}catch{}}export function clearCachedLLMAgent(_0x28fa01){const _0x331e67=a57_0x5f0c55;try{llmAgentCache[_0x331e67(0x107)](_0x28fa01);}catch{}}const accountInfoCache=createOptionalProfileCache(a57_0x5f0c55(0x103),'config/account-info',{'suffix':'.json'});export function getAccountInfoCacheFile(_0x44dec6){return accountInfoCache['path'](_0x44dec6);}export function readCachedAccountInfo(_0x5ba5cb){const _0x3cc2cf=a57_0x5f0c55,_0x18b1be=accountInfoCache['read'](_0x5ba5cb);if(_0x18b1be&&typeof _0x18b1be[_0x3cc2cf(0x102)]===_0x3cc2cf(0x12d)&&typeof _0x18b1be[_0x3cc2cf(0x13c)]==='number')return _0x18b1be;return null;}export function writeCachedAccountInfo(_0x1cf2f3,_0x5efabd,_0x433b54){const _0x4b36a1=a57_0x5f0c55;try{accountInfoCache['write']({'site':_0x1cf2f3,'accountId':_0x5efabd,'cachedAt':new Date()[_0x4b36a1(0x105)]()},_0x433b54);}catch{}}export function parseEnvFile(_0x11f2ed){const _0x2842f6=a57_0x5f0c55,_0x36897b={};for(const _0x25e417 of _0x11f2ed[_0x2842f6(0x115)]('\x0a')){const _0x879339=_0x25e417[_0x2842f6(0x11e)]();if(!_0x879339||_0x879339[_0x2842f6(0x142)]('#'))continue;const _0xd01d7c=_0x879339[_0x2842f6(0x129)](/^([^=]+)=(.*)$/);if(_0xd01d7c){const _0x521f24=_0xd01d7c[0x1]['trim']();let _0x2a6382=_0xd01d7c[0x2][_0x2842f6(0x11e)]();(_0x2a6382[_0x2842f6(0x142)]('\x22')&&_0x2a6382['endsWith']('\x22')||_0x2a6382[_0x2842f6(0x142)]('\x27')&&_0x2a6382[_0x2842f6(0xff)]('\x27'))&&(_0x2a6382=_0x2a6382['slice'](0x1,-0x1)),_0x36897b[_0x521f24]=_0x2a6382;}}return _0x36897b;}export function readUserConfig(){const _0x178c71=a57_0x5f0c55,_0x2b72fe=getConfigFile();if(!existsSync(_0x2b72fe))return{};try{const _0x47ebdf=readFileSync(_0x2b72fe,_0x178c71(0x13d));return parseEnvFile(_0x47ebdf);}catch(_0x467931){return console['warn'](_0x178c71(0x11d)+_0x2b72fe+':',_0x467931),{};}}export function resolveSite(_0x42f552){const _0x568ab6=a57_0x5f0c55,_0x579b9a=[_0x568ab6(0x110),'ap01',_0x568ab6(0x10a),_0x568ab6(0x139),_0x568ab6(0x131),'dev-us01',_0x568ab6(0xfc),_0x568ab6(0x10d),_0x568ab6(0x122),_0x568ab6(0x121)];if(_0x579b9a[_0x568ab6(0x127)](_0x42f552))return _0x42f552;if(_0x42f552 in SITE_ALIASES)return SITE_ALIASES[_0x42f552];return console[_0x568ab6(0x13b)](_0x568ab6(0x132)+_0x42f552+_0x568ab6(0xfd)),_0x568ab6(0x110);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x345135){const _0x460359=a57_0x5f0c55,_0x2c0f41=_0x345135||getActiveProfileName()||undefined;if(_0x2c0f41){const _0x1a7cf6='TDX_ACCESS_TOKEN_'+normalizeProfileForEnvVar(_0x2c0f41);if(process.env[_0x1a7cf6])return{'accessToken':process.env[_0x1a7cf6],'source':_0x1a7cf6+_0x460359(0x109)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x460359(0x11c)};if(process.env.TDX_ACCESS_TOKEN_FILE){const _0x40e1f9=readAccessTokenFile(process.env.TDX_ACCESS_TOKEN_FILE);if(_0x40e1f9)return{'accessToken':_0x40e1f9,'source':_0x460359(0x13a)};}return null;}function readAccessTokenFile(_0x41aa1e){const _0x15e113=a57_0x5f0c55;try{const _0x139326=readFileSync(_0x41aa1e,_0x15e113(0x13d))[_0x15e113(0x11e)]();return _0x139326||null;}catch{return null;}}export function getAccessToken(_0x1493fd){const _0x3660c0=a57_0x5f0c55;return resolveAccessToken(_0x1493fd)?.[_0x3660c0(0x12b)];}export function getAPIKey(_0x35424c){const _0x1cf0c0=a57_0x5f0c55,_0x4b268d=_0x35424c||getActiveProfileName();if(_0x4b268d){const _0x54bb37=_0x1cf0c0(0x13f)+normalizeProfileForEnvVar(_0x4b268d);if(process.env[_0x54bb37])return process.env[_0x54bb37];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x6604ef){const _0x17408d=a57_0x5f0c55;return _0x6604ef[_0x17408d(0x12f)]()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x3b52e3,_0x5acbb2){const _0x252cee=a57_0x5f0c55,_0x12ac76=resolveAccessToken(_0x5acbb2);if(_0x12ac76)return{'apiKey':_0x12ac76[_0x252cee(0x12b)],'source':_0x12ac76[_0x252cee(0x11b)],'isDeprecated':![]};const _0x445df5=_0x5acbb2||getActiveProfileName()||undefined;if(_0x445df5){const _0x2ceeea=_0x252cee(0x13f)+normalizeProfileForEnvVar(_0x445df5);if(process.env[_0x2ceeea])return{'apiKey':process.env[_0x2ceeea],'source':_0x2ceeea+_0x252cee(0x109),'isDeprecated':![]};const _0x4863a4=getCachedCredential(_0x3b52e3,_0x445df5);if(_0x4863a4)return{'apiKey':_0x4863a4,'source':_0x252cee(0x143)+_0x445df5+')','isDeprecated':![]};const _0x493a6e=await getKeychainAPIKey(_0x445df5);if(_0x493a6e)return setCachedCredential(_0x493a6e,_0x3b52e3,_0x445df5),{'apiKey':_0x493a6e,'source':_0x252cee(0x143)+_0x445df5+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x252cee(0x10f),'isDeprecated':![]};if(!_0x445df5){const _0x1ca1ca=getCachedCredential(_0x3b52e3,undefined);if(_0x1ca1ca)return{'apiKey':_0x1ca1ca,'source':_0x252cee(0x140),'isDeprecated':![]};const _0x27050d=await getKeychainAPIKey(undefined);if(_0x27050d)return setCachedCredential(_0x27050d,_0x3b52e3,undefined),{'apiKey':_0x27050d,'source':_0x252cee(0x140),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x48cab1,_0x2bae33){const _0x486cf6=a57_0x5f0c55,_0x2cb278=await resolveAPIKeyAsync(_0x48cab1,_0x2bae33);return _0x2cb278?.[_0x486cf6(0x112)];}function cleanupLegacyEnvFile(_0x3ac64a){const _0xeb0ee4=a57_0x5f0c55;if(!existsSync(_0x3ac64a))return![];try{const _0x399068=readFileSync(_0x3ac64a,_0xeb0ee4(0x13d)),_0x2adba4=_0x399068[_0xeb0ee4(0x115)]('\x0a'),_0x9df2e0=_0x2adba4[_0xeb0ee4(0x111)](_0x23256e=>{const _0x1ae6a1=_0xeb0ee4,_0x37e351=_0x23256e[_0x1ae6a1(0x11e)]();if(!_0x37e351||_0x37e351[_0x1ae6a1(0x142)]('#'))return!![];const [_0x16032b]=_0x37e351[_0x1ae6a1(0x115)]('=');return!_0x16032b[_0x1ae6a1(0x142)]('TD_API_KEY');}),_0x28d718=_0x9df2e0[_0xeb0ee4(0x136)](_0x522df5=>{const _0x1be4f1=_0xeb0ee4,_0x1128c4=_0x522df5[_0x1be4f1(0x11e)]();return _0x1128c4&&!_0x1128c4[_0x1be4f1(0x142)]('#');});if(!_0x28d718)return unlinkSync(_0x3ac64a),!![];return writeFileSync(_0x3ac64a,_0x9df2e0[_0xeb0ee4(0x11a)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x15de26=a57_0x5f0c55;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x33acde=a57_0x573bb8[_0x15de26(0x11a)](getConfigDir(),_0x15de26(0x137));if(!a57_0x57ec4b[_0x15de26(0x10b)](_0x33acde))return null;try{const _0x4d2a95=a57_0x57ec4b[_0x15de26(0x135)](_0x33acde,_0x15de26(0x13d)),_0xd36669=JSON[_0x15de26(0x138)](_0x4d2a95);return _0xd36669[_0x15de26(0x10e)]||null;}catch{return null;}}export function saveAPIKey(_0x1cc135,_0x1bac72,_0x5ad29f){const _0x21e44b=a57_0x5f0c55,_0x1d17fb=getConfigDir(),_0x6128bd=getConfigFilePath(_0x5ad29f);!existsSync(_0x1d17fb)&&mkdirSync(_0x1d17fb,{'recursive':!![],'mode':0x1c0});let _0x544a72={};if(existsSync(_0x6128bd))try{const _0x25421f=readFileSync(_0x6128bd,_0x21e44b(0x13d));_0x544a72=parseEnvFile(_0x25421f);}catch(_0x1b06c0){console['warn'](_0x21e44b(0x134)+_0x6128bd+':',_0x1b06c0);}const _0x43a8b3=_0x1cc135['toUpperCase']()[_0x21e44b(0x113)](/-/g,'_');_0x544a72['TD_API_KEY_'+_0x43a8b3]=_0x1bac72;const _0x136997=Object[_0x21e44b(0x125)](_0x544a72)[_0x21e44b(0x106)](([_0x2e3355,_0x1557e3])=>_0x2e3355+'='+_0x1557e3);writeFileSync(_0x6128bd,_0x136997[_0x21e44b(0x11a)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x19c623,_0x2309c8,_0x23de2f){const _0x5bc6a3=a57_0x5f0c55;await saveKeychainAPIKey(_0x19c623,_0x23de2f),setCachedCredential(_0x19c623,_0x2309c8,_0x23de2f);const _0x189d02=getConfigFilePath(_0x23de2f);cleanupLegacyEnvFile(_0x189d02)&&console[_0x5bc6a3(0x13b)](a57_0x55c74f[_0x5bc6a3(0x128)]('⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'));}export function loadConfig(){const _0xad3517=a57_0x5f0c55,_0x220129={'apiKeys':{},'defaultSite':'us01'},_0x201c57=[_0xad3517(0x110),_0xad3517(0xfe),'eu01',_0xad3517(0x139),_0xad3517(0x131),_0xad3517(0x133),_0xad3517(0xfc),'stg-us01','stg-ap01',_0xad3517(0x121)],_0xfc8880=getAPIKey();if(_0xfc8880)for(const _0x1db53f of _0x201c57){_0x220129[_0xad3517(0x100)][_0x1db53f]=_0xfc8880;}return _0x220129;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x13dc76=a57_0x5f0c55,_0xd2648b=a57_0x573bb8[_0x13dc76(0x11a)](getConfigDir(),_0x13dc76(0x137));if(!a57_0x57ec4b[_0x13dc76(0x10b)](_0xd2648b))return undefined;try{const _0x2d6f91=a57_0x57ec4b[_0x13dc76(0x135)](_0xd2648b,_0x13dc76(0x13d)),_0x3cd8ec=JSON['parse'](_0x2d6f91);return typeof _0x3cd8ec[_0x13dc76(0x12a)]===_0x13dc76(0x12d)?_0x3cd8ec[_0x13dc76(0x12a)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x44de78=a57_0x5f0c55,_0x383baa=process.env.TDX_RELEASE_CHANNEL;if(_0x383baa==='next'||_0x383baa===_0x44de78(0x120))return _0x383baa;const _0xd1938a=a57_0x573bb8[_0x44de78(0x11a)](getConfigDir(),_0x44de78(0x137));if(!a57_0x57ec4b[_0x44de78(0x10b)](_0xd1938a))return _0x44de78(0x120);try{const _0x16e195=a57_0x57ec4b[_0x44de78(0x135)](_0xd1938a,_0x44de78(0x13d)),_0x2100ec=JSON['parse'](_0x16e195);if(_0x2100ec[_0x44de78(0x123)]==='next')return'next';}catch{}return _0x44de78(0x120);}export function saveReleaseChannel(_0xbbe9fd){const _0xe156e3=a57_0x5f0c55,_0x3a3813=getConfigDir(),_0x1002ca=a57_0x573bb8[_0xe156e3(0x11a)](_0x3a3813,'tdx.json');!existsSync(_0x3a3813)&&mkdirSync(_0x3a3813,{'recursive':!![],'mode':0x1c0});let _0xfb52b2={};if(existsSync(_0x1002ca))try{const _0x1cb95c=readFileSync(_0x1002ca,'utf-8');_0xfb52b2=JSON[_0xe156e3(0x138)](_0x1cb95c);}catch{}_0xfb52b2['release_channel']=_0xbbe9fd,writeFileSync(_0x1002ca,JSON[_0xe156e3(0x10c)](_0xfb52b2,null,0x2),{'mode':0x180});}
@@ -1 +1 @@
1
- const a58_0x593d73=a58_0x14d5;function a58_0x1028(){const _0x19eec8=['read','262260KMlnDB','core/connection-cache','66KuDxgP','18478528cNXmnP','connections','4009785AmhAAe','2100092CwwYvY','now','connections-{profile}.json','write','clear','1024304VzZQwH','499656EsEzFm','209405MerapK'];a58_0x1028=function(){return _0x19eec8;};return a58_0x1028();}(function(_0xb4f49,_0x29ea8d){const _0x2baffc=a58_0x14d5,_0x3b5956=_0xb4f49();while(!![]){try{const _0x59df14=parseInt(_0x2baffc(0x10b))/0x1+parseInt(_0x2baffc(0x10a))/0x2+parseInt(_0x2baffc(0x10e))/0x3+parseInt(_0x2baffc(0x114))/0x4+parseInt(_0x2baffc(0x113))/0x5+parseInt(_0x2baffc(0x110))/0x6*(parseInt(_0x2baffc(0x10c))/0x7)+-parseInt(_0x2baffc(0x111))/0x8;if(_0x59df14===_0x29ea8d)break;else _0x3b5956['push'](_0x3b5956['shift']());}catch(_0x3a5461){_0x3b5956['push'](_0x3b5956['shift']());}}}(a58_0x1028,0x6cc11));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a58_0x593d73(0x116),a58_0x593d73(0x10f));export function loadCachedConnections(_0x41ecd0){const _0x13a2b3=a58_0x593d73,_0xd41c83=connectionCache[_0x13a2b3(0x10d)](_0x41ecd0);return _0xd41c83?.[_0x13a2b3(0x112)]??null;}function a58_0x14d5(_0x6248ee,_0x3e2b55){_0x6248ee=_0x6248ee-0x10a;const _0x102813=a58_0x1028();let _0x14d594=_0x102813[_0x6248ee];return _0x14d594;}export function saveCachedConnections(_0x4c722f,_0x2128b7){const _0x52c9c3=a58_0x593d73;connectionCache[_0x52c9c3(0x117)](_0x4c722f,{'connections':_0x2128b7,'cachedAt':Date[_0x52c9c3(0x115)]()});}export function clearConnectionCache(_0x5bada5){const _0x267f12=a58_0x593d73;connectionCache[_0x267f12(0x118)](_0x5bada5);}
1
+ const a58_0x55b15a=a58_0x3c4c;function a58_0x3c4c(_0x60ed58,_0x47e9d3){_0x60ed58=_0x60ed58-0x1db;const _0x4f406f=a58_0x4f40();let _0x3c4c44=_0x4f406f[_0x60ed58];return _0x3c4c44;}(function(_0x3cc14d,_0x5b3a96){const _0x211ff6=a58_0x3c4c,_0x4186fa=_0x3cc14d();while(!![]){try{const _0x42d5c2=parseInt(_0x211ff6(0x1e3))/0x1+-parseInt(_0x211ff6(0x1e6))/0x2*(parseInt(_0x211ff6(0x1eb))/0x3)+parseInt(_0x211ff6(0x1e2))/0x4*(-parseInt(_0x211ff6(0x1ec))/0x5)+parseInt(_0x211ff6(0x1e5))/0x6*(parseInt(_0x211ff6(0x1db))/0x7)+parseInt(_0x211ff6(0x1e9))/0x8*(-parseInt(_0x211ff6(0x1e7))/0x9)+parseInt(_0x211ff6(0x1e4))/0xa*(-parseInt(_0x211ff6(0x1ea))/0xb)+parseInt(_0x211ff6(0x1dc))/0xc;if(_0x42d5c2===_0x5b3a96)break;else _0x4186fa['push'](_0x4186fa['shift']());}catch(_0x896aa7){_0x4186fa['push'](_0x4186fa['shift']());}}}(a58_0x4f40,0x88baf));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a58_0x55b15a(0x1df),'core/connection-cache');function a58_0x4f40(){const _0x4e9eea=['84yQueQc','3785NDTNYL','504toPXoK','17749872DfwKzS','now','clear','connections-{profile}.json','write','connections','1804LReYOe','179538oIXxJb','306410mpIowx','74424ZqjZSv','16382QadRTD','15858EtXydX','read','4504IaqgsT','154Etyuze'];a58_0x4f40=function(){return _0x4e9eea;};return a58_0x4f40();}export function loadCachedConnections(_0x38ee68){const _0x2fe08c=a58_0x55b15a,_0x4813fd=connectionCache[_0x2fe08c(0x1e8)](_0x38ee68);return _0x4813fd?.[_0x2fe08c(0x1e1)]??null;}export function saveCachedConnections(_0x32b111,_0x25d72c){const _0x4a4aa5=a58_0x55b15a;connectionCache[_0x4a4aa5(0x1e0)](_0x32b111,{'connections':_0x25d72c,'cachedAt':Date[_0x4a4aa5(0x1dd)]()});}export function clearConnectionCache(_0x39f4da){const _0xf5a678=a58_0x55b15a;connectionCache[_0xf5a678(0x1de)](_0x39f4da);}
@@ -1 +1 @@
1
- const a59_0x49c07c=a59_0x23bb;(function(_0x183b98,_0x5294b1){const _0x2c64c8=a59_0x23bb,_0x5a0c6b=_0x183b98();while(!![]){try{const _0x1fb309=parseInt(_0x2c64c8(0x107))/0x1+parseInt(_0x2c64c8(0xfb))/0x2*(-parseInt(_0x2c64c8(0xf9))/0x3)+-parseInt(_0x2c64c8(0x10e))/0x4+-parseInt(_0x2c64c8(0x10a))/0x5+parseInt(_0x2c64c8(0x104))/0x6+-parseInt(_0x2c64c8(0x102))/0x7*(-parseInt(_0x2c64c8(0xf5))/0x8)+parseInt(_0x2c64c8(0xf8))/0x9;if(_0x1fb309===_0x5294b1)break;else _0x5a0c6b['push'](_0x5a0c6b['shift']());}catch(_0x5225c1){_0x5a0c6b['push'](_0x5a0c6b['shift']());}}}(a59_0x43b2,0x5fe31));function a59_0x23bb(_0x53a729,_0x52bf37){_0x53a729=_0x53a729-0xf5;const _0x43b28a=a59_0x43b2();let _0x23bb8c=_0x43b28a[_0x53a729];return _0x23bb8c;}import a59_0x2ccd01 from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x3f6012,_0x556ea2){if(_0x3f6012===undefined)return _0x556ea2;if(typeof _0x3f6012==='number')return _0x3f6012;return parseInt(_0x3f6012,0xa);}export const STANDARD_SITE_CHOICES=[{'title':'us\x20\x20\x20-\x20United\x20States','value':a59_0x49c07c(0x108)},{'title':'jp\x20\x20\x20-\x20Japan','value':a59_0x49c07c(0x105)},{'title':a59_0x49c07c(0xfe),'value':a59_0x49c07c(0xfd)},{'title':'ap02\x20-\x20Korea','value':'ap02'}];export function buildSiteChoices(_0x5e9fb4){const _0x5ee16d=a59_0x49c07c,_0x2a537=[...STANDARD_SITE_CHOICES];let _0x4b6c64=_0x2a537[_0x5ee16d(0x10b)](_0x2a77b4=>_0x2a77b4[_0x5ee16d(0x103)]===_0x5e9fb4);return _0x4b6c64===-0x1&&_0x5e9fb4!==_0x5ee16d(0x108)&&(_0x2a537['push']({'title':_0x5e9fb4,'value':_0x5e9fb4}),_0x4b6c64=_0x2a537[_0x5ee16d(0x10c)]-0x1),_0x2a537[_0x5ee16d(0x106)]({'title':_0x5ee16d(0xf7),'value':'other'}),{'choices':_0x2a537,'initialIndex':_0x4b6c64>=0x0?_0x4b6c64:0x0};}function a59_0x43b2(){const _0x220a7f=['6670161NSIMwJ','46524mjJdrv','test','98GaIApm','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','eu01','eu\x20\x20\x20-\x20Europe','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','trim','site','49qgVIIR','value','2029806HvjCdw','ap01','push','584680PZARpK','us01','customSite','3630330OGmUyv','findIndex','length','Cancelled','2099292pxyGPe','Site\x20name\x20cannot\x20be\x20empty','select','845056ziasXo','log','Enter\x20custom\x20site'];a59_0x43b2=function(){return _0x220a7f;};return a59_0x43b2();}export async function promptSiteSelection(_0x19944d,_0x202386,_0x2a1d1d=a59_0x49c07c(0x10d)){const _0x4eb0dc=a59_0x49c07c,{choices:_0x5cb6d7,initialIndex:_0x5b235d}=buildSiteChoices(_0x19944d),_0xd22070=_0x202386?_0x4eb0dc(0xff)+_0x202386+'):':'Select\x20your\x20Treasure\x20Data\x20site:',_0x5ec6bd=await a59_0x2ccd01({'type':_0x4eb0dc(0x110),'name':_0x4eb0dc(0x101),'message':_0xd22070,'choices':_0x5cb6d7,'initial':_0x5b235d});if(!_0x5ec6bd[_0x4eb0dc(0x101)])return console['log']('\x0a'+_0x2a1d1d),null;if(_0x5ec6bd['site']!=='other')return _0x5ec6bd[_0x4eb0dc(0x101)];const _0x5f34f5=await a59_0x2ccd01({'type':'text','name':_0x4eb0dc(0x109),'message':'Enter\x20site\x20name:','initial':'us01','validate':_0x12ff09=>{const _0x4117e0=_0x4eb0dc;if(!_0x12ff09||!_0x12ff09[_0x4117e0(0x100)]())return _0x4117e0(0x10f);if(!/^[a-z0-9-]+$/[_0x4117e0(0xfa)](_0x12ff09[_0x4117e0(0x100)]()))return _0x4117e0(0xfc);return!![];}});if(!_0x5f34f5[_0x4eb0dc(0x109)])return console[_0x4eb0dc(0xf6)]('\x0a'+_0x2a1d1d),null;return _0x5f34f5[_0x4eb0dc(0x109)];}
1
+ const a59_0x3ea704=a59_0xe51d;(function(_0x1b5a42,_0x423e34){const _0x287f96=a59_0xe51d,_0x17f7e1=_0x1b5a42();while(!![]){try{const _0xad64d=-parseInt(_0x287f96(0x132))/0x1+-parseInt(_0x287f96(0x129))/0x2*(-parseInt(_0x287f96(0x12a))/0x3)+parseInt(_0x287f96(0x119))/0x4*(-parseInt(_0x287f96(0x133))/0x5)+-parseInt(_0x287f96(0x11a))/0x6+-parseInt(_0x287f96(0x118))/0x7+-parseInt(_0x287f96(0x11d))/0x8+-parseInt(_0x287f96(0x11e))/0x9*(-parseInt(_0x287f96(0x122))/0xa);if(_0xad64d===_0x423e34)break;else _0x17f7e1['push'](_0x17f7e1['shift']());}catch(_0x35e232){_0x17f7e1['push'](_0x17f7e1['shift']());}}}(a59_0x1977,0x31e88));import a59_0x3c1bdb from'prompts';export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x4778ac,_0x4f00e6){if(_0x4778ac===undefined)return _0x4f00e6;if(typeof _0x4778ac==='number')return _0x4778ac;return parseInt(_0x4778ac,0xa);}function a59_0x1977(){const _0x4acb68=['eu01','2BDcuOH','1069197DPqPxg','select','ap01','us\x20\x20\x20-\x20United\x20States','other','value','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','customSite','370416kJKUiy','915730GNCRob','jp\x20\x20\x20-\x20Japan','log','findIndex','ap02','1817977ZrdXEX','4hpWbOv','1654542RHzlhd','push','Select\x20your\x20Treasure\x20Data\x20site:','2360584FxehiY','288cZHUZQ','us01','Enter\x20custom\x20site','site','385040Idwluc','Enter\x20site\x20name:','trim','text','eu\x20\x20\x20-\x20Europe','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens'];a59_0x1977=function(){return _0x4acb68;};return a59_0x1977();}function a59_0xe51d(_0x4f6a6b,_0x21a6ec){_0x4f6a6b=_0x4f6a6b-0x118;const _0x1977e6=a59_0x1977();let _0xe51d0=_0x1977e6[_0x4f6a6b];return _0xe51d0;}export const STANDARD_SITE_CHOICES=[{'title':a59_0x3ea704(0x12d),'value':a59_0x3ea704(0x11f)},{'title':a59_0x3ea704(0x134),'value':a59_0x3ea704(0x12c)},{'title':a59_0x3ea704(0x126),'value':a59_0x3ea704(0x128)},{'title':'ap02\x20-\x20Korea','value':a59_0x3ea704(0x137)}];export function buildSiteChoices(_0x37b38e){const _0x46f366=a59_0x3ea704,_0x52f251=[...STANDARD_SITE_CHOICES];let _0x2ed6fc=_0x52f251[_0x46f366(0x136)](_0xbf0e4b=>_0xbf0e4b[_0x46f366(0x12f)]===_0x37b38e);return _0x2ed6fc===-0x1&&_0x37b38e!==_0x46f366(0x11f)&&(_0x52f251[_0x46f366(0x11b)]({'title':_0x37b38e,'value':_0x37b38e}),_0x2ed6fc=_0x52f251['length']-0x1),_0x52f251[_0x46f366(0x11b)]({'title':_0x46f366(0x120),'value':_0x46f366(0x12e)}),{'choices':_0x52f251,'initialIndex':_0x2ed6fc>=0x0?_0x2ed6fc:0x0};}export async function promptSiteSelection(_0x57a3fa,_0x3541f3,_0x7283fc='Cancelled'){const _0x3dde37=a59_0x3ea704,{choices:_0x41e505,initialIndex:_0x51c56e}=buildSiteChoices(_0x57a3fa),_0x1ecb71=_0x3541f3?_0x3dde37(0x130)+_0x3541f3+'):':_0x3dde37(0x11c),_0x27dc16=await a59_0x3c1bdb({'type':_0x3dde37(0x12b),'name':_0x3dde37(0x121),'message':_0x1ecb71,'choices':_0x41e505,'initial':_0x51c56e});if(!_0x27dc16[_0x3dde37(0x121)])return console['log']('\x0a'+_0x7283fc),null;if(_0x27dc16['site']!==_0x3dde37(0x12e))return _0x27dc16['site'];const _0x47ca3e=await a59_0x3c1bdb({'type':_0x3dde37(0x125),'name':_0x3dde37(0x131),'message':_0x3dde37(0x123),'initial':_0x3dde37(0x11f),'validate':_0x42eb7b=>{const _0xebbead=_0x3dde37;if(!_0x42eb7b||!_0x42eb7b[_0xebbead(0x124)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/['test'](_0x42eb7b[_0xebbead(0x124)]()))return _0xebbead(0x127);return!![];}});if(!_0x47ca3e[_0x3dde37(0x131)])return console[_0x3dde37(0x135)]('\x0a'+_0x7283fc),null;return _0x47ca3e[_0x3dde37(0x131)];}
@@ -1 +1 @@
1
- function a60_0x3391(_0xbfb284,_0x4ff4dc){_0xbfb284=_0xbfb284-0x7d;const _0x336025=a60_0x3360();let _0x339187=_0x336025[_0xbfb284];return _0x339187;}(function(_0x278330,_0x509d28){const _0x285a9c=a60_0x3391,_0x4c4174=_0x278330();while(!![]){try{const _0x19266b=parseInt(_0x285a9c(0x8f))/0x1*(parseInt(_0x285a9c(0x86))/0x2)+-parseInt(_0x285a9c(0x87))/0x3*(parseInt(_0x285a9c(0x82))/0x4)+parseInt(_0x285a9c(0x7d))/0x5*(parseInt(_0x285a9c(0x8a))/0x6)+-parseInt(_0x285a9c(0x7e))/0x7*(parseInt(_0x285a9c(0x8b))/0x8)+parseInt(_0x285a9c(0x8c))/0x9+-parseInt(_0x285a9c(0x7f))/0xa*(parseInt(_0x285a9c(0x84))/0xb)+parseInt(_0x285a9c(0x81))/0xc*(parseInt(_0x285a9c(0x83))/0xd);if(_0x19266b===_0x509d28)break;else _0x4c4174['push'](_0x4c4174['shift']());}catch(_0x4813bf){_0x4c4174['push'](_0x4c4174['shift']());}}}(a60_0x3360,0x3f9f4));function a60_0x3360(){const _0x476f1f=['delete','1JomLHi','1710oTNmpJ','1776628SormyZ','860AGfvBb','clear','60NUYjVU','1397252HokMpk','275067IdnuZe','18469uCPjgS','apiKey','140564iObQhn','3PIwGRn','loadedAt','now','7068ZCsTsR','8dzQDZi','3862386yordXi','set'];a60_0x3360=function(){return _0x476f1f;};return a60_0x3360();}const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x1af4b3,_0x1d8dbb){const _0x2b25f9=_0x1af4b3||'__default_site__',_0x3b2699=_0x1d8dbb||'__default_profile__';return _0x2b25f9+':'+_0x3b2699;}export function getCachedCredential(_0x4b06b6,_0x4faefd){const _0x427962=a60_0x3391,_0x4a2977=getCacheKey(_0x4b06b6,_0x4faefd),_0x282b90=cache['get'](_0x4a2977);if(!_0x282b90)return null;if(Date['now']()-_0x282b90[_0x427962(0x88)]>CACHE_TTL_MS)return cache[_0x427962(0x8e)](_0x4a2977),null;return _0x282b90[_0x427962(0x85)];}export function setCachedCredential(_0x4e6b5c,_0x295356,_0x35b8ee){const _0x23febe=a60_0x3391,_0x30e1a6=getCacheKey(_0x295356,_0x35b8ee);cache[_0x23febe(0x8d)](_0x30e1a6,{'apiKey':_0x4e6b5c,'loadedAt':Date[_0x23febe(0x89)]()});}export function clearCredentialCache(){const _0x3080e1=a60_0x3391;cache[_0x3080e1(0x80)]();}export function clearCachedCredential(_0x3e1ddb,_0x12d792){const _0x535046=a60_0x3391,_0x10a448=getCacheKey(_0x3e1ddb,_0x12d792);cache[_0x535046(0x8e)](_0x10a448);}
1
+ (function(_0x297848,_0x1bb8af){const _0x36de6b=a60_0x3b4f,_0x5a0eea=_0x297848();while(!![]){try{const _0x5a50c6=parseInt(_0x36de6b(0x10b))/0x1+-parseInt(_0x36de6b(0x102))/0x2*(parseInt(_0x36de6b(0xff))/0x3)+-parseInt(_0x36de6b(0x104))/0x4+-parseInt(_0x36de6b(0x108))/0x5+-parseInt(_0x36de6b(0x103))/0x6+-parseInt(_0x36de6b(0xfd))/0x7+parseInt(_0x36de6b(0x10a))/0x8*(parseInt(_0x36de6b(0x100))/0x9);if(_0x5a50c6===_0x1bb8af)break;else _0x5a0eea['push'](_0x5a0eea['shift']());}catch(_0x2aead0){_0x5a0eea['push'](_0x5a0eea['shift']());}}}(a60_0xaca7,0xe4fec));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x5e01ef,_0x3d7ce2){const _0x502ba3=a60_0x3b4f,_0x5d77e0=_0x5e01ef||_0x502ba3(0x10c),_0x5076e2=_0x3d7ce2||'__default_profile__';return _0x5d77e0+':'+_0x5076e2;}export function getCachedCredential(_0x55f5c0,_0x4f34e6){const _0x58ae7e=a60_0x3b4f,_0x1d3537=getCacheKey(_0x55f5c0,_0x4f34e6),_0x2af9f9=cache[_0x58ae7e(0x106)](_0x1d3537);if(!_0x2af9f9)return null;if(Date[_0x58ae7e(0x107)]()-_0x2af9f9[_0x58ae7e(0x105)]>CACHE_TTL_MS)return cache[_0x58ae7e(0x109)](_0x1d3537),null;return _0x2af9f9['apiKey'];}function a60_0x3b4f(_0x249a64,_0x53e255){_0x249a64=_0x249a64-0xfd;const _0xaca70c=a60_0xaca7();let _0x3b4f2d=_0xaca70c[_0x249a64];return _0x3b4f2d;}export function setCachedCredential(_0xf0932,_0x8db9c5,_0x5dd9c3){const _0x3c9345=a60_0x3b4f,_0xcdf524=getCacheKey(_0x8db9c5,_0x5dd9c3);cache[_0x3c9345(0xfe)](_0xcdf524,{'apiKey':_0xf0932,'loadedAt':Date[_0x3c9345(0x107)]()});}export function clearCredentialCache(){const _0x30dfea=a60_0x3b4f;cache[_0x30dfea(0x101)]();}export function clearCachedCredential(_0x196d4b,_0x130fb4){const _0x72328c=a60_0x3b4f,_0x5d3b24=getCacheKey(_0x196d4b,_0x130fb4);cache[_0x72328c(0x109)](_0x5d3b24);}function a60_0xaca7(){const _0x57816f=['__default_site__','11523925intIrI','set','180KOtkza','9BPleHB','clear','23248IBjMio','10679754JMjamf','1128404gYvUdw','loadedAt','get','now','8687260tGIiIy','delete','53024432xyynxX','453137wmkpjE'];a60_0xaca7=function(){return _0x57816f;};return a60_0xaca7();}
@@ -1 +1 @@
1
- const a61_0x455589=a61_0x22b8;(function(_0x45a35c,_0x55ca7a){const _0x3db64e=a61_0x22b8,_0x386099=_0x45a35c();while(!![]){try{const _0x130a76=-parseInt(_0x3db64e(0x160))/0x1*(parseInt(_0x3db64e(0x199))/0x2)+parseInt(_0x3db64e(0x195))/0x3*(-parseInt(_0x3db64e(0x192))/0x4)+parseInt(_0x3db64e(0x16b))/0x5*(parseInt(_0x3db64e(0x179))/0x6)+parseInt(_0x3db64e(0x154))/0x7+parseInt(_0x3db64e(0x16c))/0x8*(parseInt(_0x3db64e(0x193))/0x9)+-parseInt(_0x3db64e(0x1a4))/0xa*(-parseInt(_0x3db64e(0x168))/0xb)+parseInt(_0x3db64e(0x152))/0xc;if(_0x130a76===_0x55ca7a)break;else _0x386099['push'](_0x386099['shift']());}catch(_0x487ba5){_0x386099['push'](_0x386099['shift']());}}}(a61_0x448c,0x1cbb2));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';function a61_0x22b8(_0x38461f,_0x5ca697){_0x38461f=_0x38461f-0x14f;const _0x448c79=a61_0x448c();let _0x22b88d=_0x448c79[_0x38461f];return _0x22b88d;}import{getOAuthTokens,saveOAuthTokens}from'./oauth-keychain.js';function a61_0x448c(){const _0x1a3372=['us01','parent_segment','assign','composableAudience','session','resolveAPIKeyAsync','apiKey','replace','bold','layers','profileSource','1RqzWRP','tdx.json','Project','Profile\x20Credentials','parentSegment','profile','INFO','llm_agent','49401VPqaOe','(session:\x20','default','5ozcUqv','1016664LQznVV','[configuration\x20files]','accessToken','segment_path','logLevel','site','refresh_token','.env','env','[context]','getSource','dim','cli','1315452dSHkWg','verbose','profile:\x20','llmAgent','string','llm_project','not\x20set','(using\x20session:\x20','expires_at','activeProfile','composable_audience','database','displayWithSources','loadGlobalConfig','profiles','globalCredentials','none','createAsync','access_token','Global\x20Credentials','global','configFiles','log','llmProject','Profile','20jxhhZJ','9SyGZwB','utf-8','88353ijlqki','workflowProject','config','segmentPath','299986oKLWvT','existsSync','getParameters','green','Session','profileCredentials','proxy','cyan','CLI\x20flag:\x20--','.json','sessionId','20TShyRk','workflow_project','display','join','cliFlags','now','Global','sessions','readFileSync','494856sHPpfi','project','128695Zndgby'];a61_0x448c=function(){return _0x1a3372;};return a61_0x448c();}import{refreshAccessToken}from'../sdk/client/oauth-refresh.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a61_0x5dc2e6 from'node:fs';import*as a61_0x3fa129 from'node:path';import a61_0x2204bb from'chalk';export class GlobalContext{['site'];[a61_0x455589(0x184)];[a61_0x455589(0x156)];['segment_path'];[a61_0x455589(0x17e)];[a61_0x455589(0x167)];[a61_0x455589(0x1a5)];[a61_0x455589(0x183)];['apiKey'];['accessToken'];[a61_0x455589(0x19f)];[a61_0x455589(0x17a)];[a61_0x455589(0x170)];[a61_0x455589(0x165)];[a61_0x455589(0x15f)]=null;['layers'];[a61_0x455589(0x182)];[a61_0x455589(0x1a3)];['configFiles'];constructor(_0x14f92a){const _0x2e1bce=a61_0x455589;this['sessionId']=getSessionID(_0x14f92a[_0x2e1bce(0x159)]);const _0x421981=loadSessionContext(_0x14f92a[_0x2e1bce(0x159)]),_0x3428b1=loadProjectConfig(),_0x5819a4=this[_0x2e1bce(0x186)]();if(_0x14f92a[_0x2e1bce(0x165)])this[_0x2e1bce(0x182)]=_0x14f92a[_0x2e1bce(0x165)],this['profileSource']=_0x2e1bce(0x178);else{if(_0x421981?.[_0x2e1bce(0x165)])this[_0x2e1bce(0x182)]=_0x421981[_0x2e1bce(0x165)],this['profileSource']='session';else{if(_0x5819a4[_0x2e1bce(0x165)])this[_0x2e1bce(0x182)]=_0x5819a4[_0x2e1bce(0x165)],this[_0x2e1bce(0x15f)]=_0x2e1bce(0x197);else process.env.TDX_PROFILE?(this['activeProfile']=process.env.TDX_PROFILE,this[_0x2e1bce(0x15f)]=_0x2e1bce(0x174)):(this[_0x2e1bce(0x182)]=null,this['profileSource']=null);}}const _0x42d6e7=this['activeProfile']?loadProfile(this['activeProfile']):null,_0x5f1e60=_0x365c03=>{const _0x50b88b=_0x2e1bce;if(!_0x365c03)return{};const _0xd5c126=_0x365c03,_0x44ad8c={};for(const [_0x14ffb9,_0x2dd421]of Object['entries'](_0xd5c126)){typeof _0x2dd421===_0x50b88b(0x17d)&&(_0x44ad8c[_0x14ffb9]=_0x2dd421);}return _0x44ad8c;},_0x1fa949={},_0x2cef42=(_0x4be20d,_0x1bb511,_0x2237e3)=>{const _0x450d4e=_0x2e1bce;if(!_0x4be20d)return![];if(_0x2237e3&&_0x4be20d===_0x2237e3)return![];const _0x1a26a2=_0x421981,_0x564db8=_0x3428b1,_0x52538c=_0x42d6e7?.[_0x450d4e(0x197)],_0x28006b=_0x5819a4,_0xa3b454=_0x1a26a2?.[_0x1bb511],_0x47a461=_0x564db8?.[_0x1bb511],_0xd41177=_0x52538c?.[_0x1bb511],_0x209419=_0x28006b[_0x1bb511];return _0x4be20d!==_0xa3b454&&_0x4be20d!==_0x47a461&&_0x4be20d!==_0xd41177&&_0x4be20d!==_0x209419;},_0x5b1d66=[{'optionKey':_0x2e1bce(0x171),'contextKey':_0x2e1bce(0x171),'defaultValue':_0x2e1bce(0x155)},{'optionKey':_0x2e1bce(0x184),'contextKey':'database'},{'optionKey':'parentSegment','contextKey':_0x2e1bce(0x156)},{'optionKey':_0x2e1bce(0x190),'contextKey':_0x2e1bce(0x17e)},{'optionKey':_0x2e1bce(0x17c),'contextKey':_0x2e1bce(0x167)},{'optionKey':_0x2e1bce(0x158),'contextKey':_0x2e1bce(0x183)},{'optionKey':_0x2e1bce(0x165),'contextKey':_0x2e1bce(0x165)}];for(const {optionKey:_0x34297f,contextKey:_0x5ae896,defaultValue:_0x3f7e14}of _0x5b1d66){const _0x15fb2b=_0x14f92a[_0x34297f];_0x2cef42(_0x15fb2b,_0x5ae896,_0x3f7e14)&&(_0x1fa949[_0x5ae896]=_0x15fb2b);}this['layers']={'cliFlags':_0x1fa949,'session':_0x5f1e60(_0x421981),'project':_0x5f1e60(_0x3428b1),'profile':_0x5f1e60(_0x42d6e7?.[_0x2e1bce(0x197)]),'global':_0x5f1e60(_0x5819a4)};const _0x25e011={...this['layers']['global'],...this[_0x2e1bce(0x15e)]['profile'],...this[_0x2e1bce(0x15e)][_0x2e1bce(0x153)]};process.env.TDX_SITE&&!this['layers'][_0x2e1bce(0x159)]['site']&&!this[_0x2e1bce(0x15e)][_0x2e1bce(0x1a8)][_0x2e1bce(0x171)]&&(_0x25e011[_0x2e1bce(0x171)]=process.env.TDX_SITE);Object[_0x2e1bce(0x157)](_0x25e011,this[_0x2e1bce(0x15e)][_0x2e1bce(0x159)]),Object['assign'](_0x25e011,this[_0x2e1bce(0x15e)][_0x2e1bce(0x1a8)]);const _0x4b5a35=_0x25e011[_0x2e1bce(0x171)]||_0x2e1bce(0x155);this[_0x2e1bce(0x171)]=resolveSite(_0x4b5a35),this[_0x2e1bce(0x184)]=_0x25e011[_0x2e1bce(0x184)],this[_0x2e1bce(0x156)]=_0x25e011[_0x2e1bce(0x156)],this[_0x2e1bce(0x16f)]=_0x25e011['segment_path'],this[_0x2e1bce(0x17e)]=_0x25e011[_0x2e1bce(0x17e)],this['llm_agent']=_0x25e011[_0x2e1bce(0x167)],this[_0x2e1bce(0x1a5)]=_0x25e011[_0x2e1bce(0x1a5)],this['composable_audience']=_0x25e011[_0x2e1bce(0x183)],this['verbose']=_0x14f92a[_0x2e1bce(0x17a)]||![],this[_0x2e1bce(0x170)]=_0x14f92a[_0x2e1bce(0x170)]??LogLevel[_0x2e1bce(0x166)],this[_0x2e1bce(0x165)]=this[_0x2e1bce(0x182)]||undefined,this[_0x2e1bce(0x16e)]=getAccessToken(this[_0x2e1bce(0x182)]||undefined),this[_0x2e1bce(0x15b)]=getAPIKey(this[_0x2e1bce(0x182)]||undefined);const _0x1e098b=typeof _0x5819a4[_0x2e1bce(0x19f)]===_0x2e1bce(0x17d)?_0x5819a4[_0x2e1bce(0x19f)]:undefined;this[_0x2e1bce(0x19f)]=_0x1e098b||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x5241c4=getConfigDir(),_0x53d545=a61_0x3fa129[_0x2e1bce(0x1a7)](_0x5241c4,_0x2e1bce(0x150),this[_0x2e1bce(0x1a3)]+_0x2e1bce(0x1a2)),_0x271f14=findProjectConfigPath(),_0x56136f=a61_0x3fa129[_0x2e1bce(0x1a7)](_0x5241c4,_0x2e1bce(0x161)),_0x38b8e9=a61_0x3fa129[_0x2e1bce(0x1a7)](_0x5241c4,_0x2e1bce(0x173));let _0x40b06b=null,_0x100ea1=null;this[_0x2e1bce(0x182)]&&(_0x40b06b=a61_0x3fa129[_0x2e1bce(0x1a7)](_0x5241c4,'profiles',this[_0x2e1bce(0x182)],_0x2e1bce(0x161)),_0x100ea1=a61_0x3fa129[_0x2e1bce(0x1a7)](_0x5241c4,_0x2e1bce(0x187),this[_0x2e1bce(0x182)],_0x2e1bce(0x173))),this[_0x2e1bce(0x18e)]={'session':a61_0x5dc2e6[_0x2e1bce(0x19a)](_0x53d545)?_0x53d545:null,'project':_0x271f14,'profile':_0x40b06b&&a61_0x5dc2e6[_0x2e1bce(0x19a)](_0x40b06b)?_0x40b06b:null,'profileCredentials':_0x100ea1&&a61_0x5dc2e6[_0x2e1bce(0x19a)](_0x100ea1)?_0x100ea1:null,'global':a61_0x5dc2e6['existsSync'](_0x56136f)?_0x56136f:null,'globalCredentials':a61_0x5dc2e6[_0x2e1bce(0x19a)](_0x38b8e9)?_0x38b8e9:null};}[a61_0x455589(0x176)](_0x495219,_0x2d52c6){const _0x47d6eb=a61_0x455589;if(!_0x2d52c6)return _0x47d6eb(0x17f);const _0x144917=_0x2d52c6;if(this[_0x47d6eb(0x15e)][_0x47d6eb(0x1a8)][_0x495219]===_0x144917){if(_0x495219===_0x47d6eb(0x171)&&_0x144917===_0x47d6eb(0x155)&&!this[_0x47d6eb(0x15e)][_0x47d6eb(0x159)][_0x47d6eb(0x171)]&&!this['layers'][_0x47d6eb(0x153)][_0x47d6eb(0x171)]&&!this[_0x47d6eb(0x15e)][_0x47d6eb(0x165)]['site']&&!this[_0x47d6eb(0x15e)][_0x47d6eb(0x18d)][_0x47d6eb(0x171)])return _0x47d6eb(0x16a);return _0x47d6eb(0x1a1)+_0x495219[_0x47d6eb(0x15c)](/_/g,'-');}if(this['layers'][_0x47d6eb(0x159)][_0x495219]===_0x144917)return _0x47d6eb(0x159);if(this['layers'][_0x47d6eb(0x153)][_0x495219]===_0x144917)return _0x47d6eb(0x153);if(this['layers'][_0x47d6eb(0x165)][_0x495219]===_0x144917)return _0x47d6eb(0x17b)+this['activeProfile'];if(this['layers'][_0x47d6eb(0x18d)][_0x495219]===_0x144917)return'global';return _0x47d6eb(0x16a);}[a61_0x455589(0x186)](){const _0x19d79a=a61_0x455589,_0x52fd0b=a61_0x3fa129['join'](getConfigDir(),_0x19d79a(0x161));if(!a61_0x5dc2e6[_0x19d79a(0x19a)](_0x52fd0b))return{};try{const _0x17a0f4=a61_0x5dc2e6[_0x19d79a(0x151)](_0x52fd0b,_0x19d79a(0x194));return JSON['parse'](_0x17a0f4);}catch{return{};}}['injectIntoOptions'](_0x11d59e){const _0x10317f=a61_0x455589;_0x11d59e[_0x10317f(0x171)]=this[_0x10317f(0x171)],!_0x11d59e[_0x10317f(0x184)]&&this['database']&&(_0x11d59e['database']=this['database']),!_0x11d59e[_0x10317f(0x164)]&&this[_0x10317f(0x156)]&&(_0x11d59e[_0x10317f(0x164)]=this[_0x10317f(0x156)]),!_0x11d59e[_0x10317f(0x198)]&&this[_0x10317f(0x16f)]&&(_0x11d59e[_0x10317f(0x198)]=this[_0x10317f(0x16f)]),!_0x11d59e[_0x10317f(0x190)]&&this[_0x10317f(0x17e)]&&(_0x11d59e['llmProject']=this[_0x10317f(0x17e)]),!_0x11d59e[_0x10317f(0x17c)]&&this['llm_agent']&&(_0x11d59e[_0x10317f(0x17c)]=this[_0x10317f(0x167)]),!_0x11d59e[_0x10317f(0x196)]&&this[_0x10317f(0x1a5)]&&(_0x11d59e['workflowProject']=this[_0x10317f(0x1a5)]),!_0x11d59e[_0x10317f(0x158)]&&this[_0x10317f(0x183)]&&(_0x11d59e[_0x10317f(0x158)]=this[_0x10317f(0x183)]);}[a61_0x455589(0x19b)](){const _0x339f20=a61_0x455589;return[{'key':_0x339f20(0x171),'value':this[_0x339f20(0x171)]},{'key':'database','value':this[_0x339f20(0x184)]},{'key':_0x339f20(0x156),'value':this[_0x339f20(0x156)]},{'key':_0x339f20(0x16f),'value':this['segment_path']},{'key':'llm_project','value':this['llm_project']},{'key':_0x339f20(0x167),'value':this[_0x339f20(0x167)]},{'key':'workflow_project','value':this[_0x339f20(0x1a5)]},{'key':_0x339f20(0x183),'value':this[_0x339f20(0x183)]},{'key':_0x339f20(0x165),'value':this[_0x339f20(0x182)]||undefined}];}[a61_0x455589(0x1a6)](){const _0x113cbe=a61_0x455589;console['log'](a61_0x2204bb['bold']('[context]'));for(const {key:_0x43c7d2,value:_0x3b932c}of this[_0x113cbe(0x19b)]()){_0x3b932c&&console[_0x113cbe(0x18f)](a61_0x2204bb[_0x113cbe(0x1a0)](_0x43c7d2)+':\x20'+_0x3b932c);}}[a61_0x455589(0x185)](){const _0x319b61=a61_0x455589;console[_0x319b61(0x18f)](a61_0x2204bb[_0x319b61(0x15d)](_0x319b61(0x175)));for(const {key:_0x317280,value:_0x37d740}of this['getParameters']()){if(_0x37d740){const _0xed3065=_0x317280==='profile'?'(active)':'('+this[_0x319b61(0x176)](_0x317280,_0x37d740)+')';console['log'](a61_0x2204bb[_0x319b61(0x1a0)](_0x317280)+':\x20'+_0x37d740+'\x20'+a61_0x2204bb['dim'](_0xed3065));}}console[_0x319b61(0x18f)]('\x0a'+a61_0x2204bb[_0x319b61(0x15d)](_0x319b61(0x16d)));const _0x5612f3=[{'label':_0x319b61(0x19d),'path':this[_0x319b61(0x18e)][_0x319b61(0x159)],'extra':_0x319b61(0x169)+this[_0x319b61(0x1a3)]+')'},{'label':_0x319b61(0x162),'path':this['configFiles'][_0x319b61(0x153)]},{'label':_0x319b61(0x191),'path':this['configFiles'][_0x319b61(0x165)]},{'label':_0x319b61(0x163),'path':this[_0x319b61(0x18e)][_0x319b61(0x19e)]},{'label':_0x319b61(0x14f),'path':this['configFiles'][_0x319b61(0x18d)]},{'label':_0x319b61(0x18c),'path':this['configFiles'][_0x319b61(0x188)]}];for(const {label:_0x4d57c0,path:_0x1bbd28,extra:_0x4d7e56}of _0x5612f3){if(_0x1bbd28)console[_0x319b61(0x18f)](a61_0x2204bb[_0x319b61(0x1a0)](_0x4d57c0)+':\x20'+_0x1bbd28+'\x20'+a61_0x2204bb[_0x319b61(0x19c)]('✓')+(_0x4d7e56?'\x20'+a61_0x2204bb[_0x319b61(0x177)](_0x4d7e56):''));else{if(_0x4d57c0===_0x319b61(0x19d))console['log'](a61_0x2204bb[_0x319b61(0x1a0)](_0x4d57c0)+':\x20'+a61_0x2204bb[_0x319b61(0x177)](_0x319b61(0x189))+'\x20'+a61_0x2204bb[_0x319b61(0x177)](_0x319b61(0x180)+this[_0x319b61(0x1a3)]+')'));else(_0x4d57c0==='Project'||_0x4d57c0==='Global')&&console['log'](a61_0x2204bb[_0x319b61(0x1a0)](_0x4d57c0)+':\x20'+a61_0x2204bb['dim']('none'));}}}async[a61_0x455589(0x15a)](){const _0x56e123=a61_0x455589;if(!this[_0x56e123(0x16e)]){const _0x3afd1b=await getOAuthTokens(this[_0x56e123(0x182)]||undefined);if(_0x3afd1b){const _0x4dc186=0x5*0x3c*0x3e8,_0x4f4a71=!_0x3afd1b[_0x56e123(0x181)]||_0x3afd1b[_0x56e123(0x181)]<Date[_0x56e123(0x1a9)]()+_0x4dc186;if(_0x4f4a71&&_0x3afd1b[_0x56e123(0x172)])try{const _0x30da36=getConsoleUrl(this[_0x56e123(0x171)]),_0x11a94d=await refreshAccessToken(_0x30da36,_0x3afd1b[_0x56e123(0x172)]);await saveOAuthTokens(_0x11a94d,this[_0x56e123(0x182)]||undefined),this['accessToken']=_0x11a94d[_0x56e123(0x18b)];}catch{this[_0x56e123(0x16e)]=_0x3afd1b[_0x56e123(0x18b)];}else this['accessToken']=_0x3afd1b[_0x56e123(0x18b)];return undefined;}}return this[_0x56e123(0x15b)]=await getAPIKeyAsync(this[_0x56e123(0x171)],this['activeProfile']||undefined),this[_0x56e123(0x15b)];}static async[a61_0x455589(0x18a)](_0x51d766){const _0x40f2b0=a61_0x455589,_0x5c7d44=new GlobalContext(_0x51d766);return await _0x5c7d44[_0x40f2b0(0x15a)](),_0x5c7d44;}}
1
+ const a61_0x53715d=a61_0x5c5c;(function(_0x505aab,_0x3c9d96){const _0x2ecb74=a61_0x5c5c,_0x30b165=_0x505aab();while(!![]){try{const _0xbbc56e=parseInt(_0x2ecb74(0xb3))/0x1*(parseInt(_0x2ecb74(0x89))/0x2)+parseInt(_0x2ecb74(0xbf))/0x3*(-parseInt(_0x2ecb74(0x86))/0x4)+parseInt(_0x2ecb74(0x9f))/0x5+parseInt(_0x2ecb74(0x8e))/0x6+parseInt(_0x2ecb74(0xa3))/0x7+parseInt(_0x2ecb74(0xc3))/0x8+-parseInt(_0x2ecb74(0xbe))/0x9;if(_0xbbc56e===_0x3c9d96)break;else _0x30b165['push'](_0x30b165['shift']());}catch(_0x3e21fc){_0x30b165['push'](_0x30b165['shift']());}}}(a61_0x4534,0x802ca));import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';import{getOAuthTokens,saveOAuthTokens}from'./oauth-keychain.js';import{refreshAccessToken}from'../sdk/client/oauth-refresh.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';function a61_0x4534(){const _0x598599=['.env','resolveAPIKeyAsync','segment_path','Profile','tdx.json','469787xLKSTX','apiKey','createAsync','global','globalCredentials','log','us01','injectIntoOptions','workflow_project','parentSegment','accessToken','19303380gaaens','291qTLpFw','sessionId','composable_audience','proxy','2843672gUwtiL','now','assign','access_token','env','Project','bold','database','string','Global','existsSync','displayWithSources','session','site','parse','utf-8','(active)','Profile\x20Credentials','CLI\x20flag:\x20--','[context]','parent_segment','profileSource','cli','verbose','configFiles','profiles','2148rsUunO','project','config','2cZhyoy','replace','composableAudience','cliFlags','default','3367656XnCBhA','display','loadGlobalConfig','readFileSync','llm_agent','join','llmProject','Session','activeProfile','llmAgent','profile','Global\x20Credentials','getParameters','cyan','(using\x20session:\x20','getSource','sessions','1968280sjtDqT','layers','profile:\x20','INFO','6592131EQwilV','expires_at','workflowProject','.json','green','none','refresh_token','logLevel','entries','dim','llm_project'];a61_0x4534=function(){return _0x598599;};return a61_0x4534();}function a61_0x5c5c(_0x5d8818,_0x4a5e84){_0x5d8818=_0x5d8818-0x70;const _0x45343c=a61_0x4534();let _0x5c5c2c=_0x45343c[_0x5d8818];return _0x5c5c2c;}import*as a61_0x32208f from'node:fs';import*as a61_0x1ade84 from'node:path';import a61_0x52b3a9 from'chalk';export class GlobalContext{['site'];[a61_0x53715d(0x73)];[a61_0x53715d(0x80)];[a61_0x53715d(0xb0)];[a61_0x53715d(0xad)];[a61_0x53715d(0x92)];[a61_0x53715d(0xbb)];['composable_audience'];['apiKey'];[a61_0x53715d(0xbd)];[a61_0x53715d(0xc2)];[a61_0x53715d(0x83)];[a61_0x53715d(0xaa)];[a61_0x53715d(0x98)];[a61_0x53715d(0x81)]=null;[a61_0x53715d(0xa0)];[a61_0x53715d(0x96)];[a61_0x53715d(0xc0)];[a61_0x53715d(0x84)];constructor(_0x14a577){const _0x17ca86=a61_0x53715d;this[_0x17ca86(0xc0)]=getSessionID(_0x14a577[_0x17ca86(0x78)]);const _0x186c1e=loadSessionContext(_0x14a577[_0x17ca86(0x78)]),_0x56681=loadProjectConfig(),_0x4739df=this[_0x17ca86(0x90)]();if(_0x14a577[_0x17ca86(0x98)])this[_0x17ca86(0x96)]=_0x14a577['profile'],this['profileSource']=_0x17ca86(0x82);else{if(_0x186c1e?.[_0x17ca86(0x98)])this[_0x17ca86(0x96)]=_0x186c1e[_0x17ca86(0x98)],this[_0x17ca86(0x81)]=_0x17ca86(0x78);else{if(_0x4739df[_0x17ca86(0x98)])this[_0x17ca86(0x96)]=_0x4739df[_0x17ca86(0x98)],this[_0x17ca86(0x81)]=_0x17ca86(0x88);else process.env.TDX_PROFILE?(this[_0x17ca86(0x96)]=process.env.TDX_PROFILE,this[_0x17ca86(0x81)]=_0x17ca86(0x70)):(this[_0x17ca86(0x96)]=null,this[_0x17ca86(0x81)]=null);}}const _0x2113bb=this[_0x17ca86(0x96)]?loadProfile(this[_0x17ca86(0x96)]):null,_0x272211=_0x11bc45=>{const _0x1ed574=_0x17ca86;if(!_0x11bc45)return{};const _0x15c56f=_0x11bc45,_0x4e7a17={};for(const [_0x439bd2,_0x5d5350]of Object[_0x1ed574(0xab)](_0x15c56f)){typeof _0x5d5350===_0x1ed574(0x74)&&(_0x4e7a17[_0x439bd2]=_0x5d5350);}return _0x4e7a17;},_0x82ca25={},_0x3f0909=(_0x1c3797,_0x56e705,_0x1b049c)=>{const _0x195a12=_0x17ca86;if(!_0x1c3797)return![];if(_0x1b049c&&_0x1c3797===_0x1b049c)return![];const _0x4f41c1=_0x186c1e,_0x13a654=_0x56681,_0x38152d=_0x2113bb?.[_0x195a12(0x88)],_0x550aa6=_0x4739df,_0x59d8ae=_0x4f41c1?.[_0x56e705],_0x546d8=_0x13a654?.[_0x56e705],_0x575a31=_0x38152d?.[_0x56e705],_0x4648d7=_0x550aa6[_0x56e705];return _0x1c3797!==_0x59d8ae&&_0x1c3797!==_0x546d8&&_0x1c3797!==_0x575a31&&_0x1c3797!==_0x4648d7;},_0x35ca86=[{'optionKey':_0x17ca86(0x79),'contextKey':_0x17ca86(0x79),'defaultValue':_0x17ca86(0xb9)},{'optionKey':'database','contextKey':_0x17ca86(0x73)},{'optionKey':'parentSegment','contextKey':_0x17ca86(0x80)},{'optionKey':_0x17ca86(0x94),'contextKey':'llm_project'},{'optionKey':_0x17ca86(0x97),'contextKey':_0x17ca86(0x92)},{'optionKey':'composableAudience','contextKey':_0x17ca86(0xc1)},{'optionKey':_0x17ca86(0x98),'contextKey':_0x17ca86(0x98)}];for(const {optionKey:_0x403fbb,contextKey:_0x1fb2eb,defaultValue:_0x5c35fe}of _0x35ca86){const _0x28fcc5=_0x14a577[_0x403fbb];_0x3f0909(_0x28fcc5,_0x1fb2eb,_0x5c35fe)&&(_0x82ca25[_0x1fb2eb]=_0x28fcc5);}this[_0x17ca86(0xa0)]={'cliFlags':_0x82ca25,'session':_0x272211(_0x186c1e),'project':_0x272211(_0x56681),'profile':_0x272211(_0x2113bb?.['config']),'global':_0x272211(_0x4739df)};const _0xb4ba95={...this[_0x17ca86(0xa0)][_0x17ca86(0xb6)],...this[_0x17ca86(0xa0)][_0x17ca86(0x98)],...this[_0x17ca86(0xa0)][_0x17ca86(0x87)]};process.env.TDX_SITE&&!this['layers'][_0x17ca86(0x78)][_0x17ca86(0x79)]&&!this[_0x17ca86(0xa0)][_0x17ca86(0x8c)][_0x17ca86(0x79)]&&(_0xb4ba95['site']=process.env.TDX_SITE);Object[_0x17ca86(0xc5)](_0xb4ba95,this['layers'][_0x17ca86(0x78)]),Object[_0x17ca86(0xc5)](_0xb4ba95,this[_0x17ca86(0xa0)][_0x17ca86(0x8c)]);const _0x2c6aac=_0xb4ba95[_0x17ca86(0x79)]||_0x17ca86(0xb9);this[_0x17ca86(0x79)]=resolveSite(_0x2c6aac),this[_0x17ca86(0x73)]=_0xb4ba95[_0x17ca86(0x73)],this[_0x17ca86(0x80)]=_0xb4ba95[_0x17ca86(0x80)],this['segment_path']=_0xb4ba95[_0x17ca86(0xb0)],this[_0x17ca86(0xad)]=_0xb4ba95[_0x17ca86(0xad)],this['llm_agent']=_0xb4ba95[_0x17ca86(0x92)],this[_0x17ca86(0xbb)]=_0xb4ba95[_0x17ca86(0xbb)],this['composable_audience']=_0xb4ba95[_0x17ca86(0xc1)],this[_0x17ca86(0x83)]=_0x14a577['verbose']||![],this['logLevel']=_0x14a577[_0x17ca86(0xaa)]??LogLevel[_0x17ca86(0xa2)],this[_0x17ca86(0x98)]=this[_0x17ca86(0x96)]||undefined,this['accessToken']=getAccessToken(this[_0x17ca86(0x96)]||undefined),this[_0x17ca86(0xb4)]=getAPIKey(this[_0x17ca86(0x96)]||undefined);const _0x2396b4=typeof _0x4739df['proxy']===_0x17ca86(0x74)?_0x4739df[_0x17ca86(0xc2)]:undefined;this[_0x17ca86(0xc2)]=_0x2396b4||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0xfb2e53=getConfigDir(),_0x24ffcd=a61_0x1ade84[_0x17ca86(0x93)](_0xfb2e53,_0x17ca86(0x9e),this[_0x17ca86(0xc0)]+_0x17ca86(0xa6)),_0x26a15c=findProjectConfigPath(),_0x2b74f1=a61_0x1ade84['join'](_0xfb2e53,_0x17ca86(0xb2)),_0x4f5d58=a61_0x1ade84['join'](_0xfb2e53,_0x17ca86(0xae));let _0x56e65c=null,_0x32c962=null;this['activeProfile']&&(_0x56e65c=a61_0x1ade84[_0x17ca86(0x93)](_0xfb2e53,_0x17ca86(0x85),this[_0x17ca86(0x96)],_0x17ca86(0xb2)),_0x32c962=a61_0x1ade84[_0x17ca86(0x93)](_0xfb2e53,_0x17ca86(0x85),this['activeProfile'],'.env')),this[_0x17ca86(0x84)]={'session':a61_0x32208f[_0x17ca86(0x76)](_0x24ffcd)?_0x24ffcd:null,'project':_0x26a15c,'profile':_0x56e65c&&a61_0x32208f['existsSync'](_0x56e65c)?_0x56e65c:null,'profileCredentials':_0x32c962&&a61_0x32208f[_0x17ca86(0x76)](_0x32c962)?_0x32c962:null,'global':a61_0x32208f[_0x17ca86(0x76)](_0x2b74f1)?_0x2b74f1:null,'globalCredentials':a61_0x32208f[_0x17ca86(0x76)](_0x4f5d58)?_0x4f5d58:null};}[a61_0x53715d(0x9d)](_0x168b14,_0x342503){const _0x565c67=a61_0x53715d;if(!_0x342503)return'not\x20set';const _0x3deeaa=_0x342503;if(this['layers'][_0x565c67(0x8c)][_0x168b14]===_0x3deeaa){if(_0x168b14==='site'&&_0x3deeaa==='us01'&&!this['layers'][_0x565c67(0x78)][_0x565c67(0x79)]&&!this[_0x565c67(0xa0)][_0x565c67(0x87)]['site']&&!this[_0x565c67(0xa0)][_0x565c67(0x98)][_0x565c67(0x79)]&&!this[_0x565c67(0xa0)]['global'][_0x565c67(0x79)])return _0x565c67(0x8d);return _0x565c67(0x7e)+_0x168b14[_0x565c67(0x8a)](/_/g,'-');}if(this[_0x565c67(0xa0)][_0x565c67(0x78)][_0x168b14]===_0x3deeaa)return _0x565c67(0x78);if(this['layers']['project'][_0x168b14]===_0x3deeaa)return _0x565c67(0x87);if(this[_0x565c67(0xa0)][_0x565c67(0x98)][_0x168b14]===_0x3deeaa)return _0x565c67(0xa1)+this['activeProfile'];if(this[_0x565c67(0xa0)][_0x565c67(0xb6)][_0x168b14]===_0x3deeaa)return _0x565c67(0xb6);return _0x565c67(0x8d);}[a61_0x53715d(0x90)](){const _0x5ac717=a61_0x53715d,_0x537c4e=a61_0x1ade84['join'](getConfigDir(),_0x5ac717(0xb2));if(!a61_0x32208f[_0x5ac717(0x76)](_0x537c4e))return{};try{const _0x3ea88c=a61_0x32208f[_0x5ac717(0x91)](_0x537c4e,_0x5ac717(0x7b));return JSON[_0x5ac717(0x7a)](_0x3ea88c);}catch{return{};}}[a61_0x53715d(0xba)](_0x447221){const _0x475dee=a61_0x53715d;_0x447221['site']=this[_0x475dee(0x79)],!_0x447221[_0x475dee(0x73)]&&this['database']&&(_0x447221[_0x475dee(0x73)]=this[_0x475dee(0x73)]),!_0x447221[_0x475dee(0xbc)]&&this[_0x475dee(0x80)]&&(_0x447221['parentSegment']=this[_0x475dee(0x80)]),!_0x447221['segmentPath']&&this[_0x475dee(0xb0)]&&(_0x447221['segmentPath']=this[_0x475dee(0xb0)]),!_0x447221['llmProject']&&this[_0x475dee(0xad)]&&(_0x447221['llmProject']=this[_0x475dee(0xad)]),!_0x447221['llmAgent']&&this[_0x475dee(0x92)]&&(_0x447221[_0x475dee(0x97)]=this[_0x475dee(0x92)]),!_0x447221[_0x475dee(0xa5)]&&this[_0x475dee(0xbb)]&&(_0x447221[_0x475dee(0xa5)]=this[_0x475dee(0xbb)]),!_0x447221[_0x475dee(0x8b)]&&this[_0x475dee(0xc1)]&&(_0x447221['composableAudience']=this['composable_audience']);}['getParameters'](){const _0x15c355=a61_0x53715d;return[{'key':_0x15c355(0x79),'value':this['site']},{'key':_0x15c355(0x73),'value':this[_0x15c355(0x73)]},{'key':'parent_segment','value':this[_0x15c355(0x80)]},{'key':_0x15c355(0xb0),'value':this['segment_path']},{'key':_0x15c355(0xad),'value':this[_0x15c355(0xad)]},{'key':_0x15c355(0x92),'value':this[_0x15c355(0x92)]},{'key':_0x15c355(0xbb),'value':this[_0x15c355(0xbb)]},{'key':_0x15c355(0xc1),'value':this[_0x15c355(0xc1)]},{'key':'profile','value':this[_0x15c355(0x96)]||undefined}];}[a61_0x53715d(0x8f)](){const _0x1a2718=a61_0x53715d;console[_0x1a2718(0xb8)](a61_0x52b3a9[_0x1a2718(0x72)](_0x1a2718(0x7f)));for(const {key:_0x43a768,value:_0x26934f}of this[_0x1a2718(0x9a)]()){_0x26934f&&console[_0x1a2718(0xb8)](a61_0x52b3a9[_0x1a2718(0x9b)](_0x43a768)+':\x20'+_0x26934f);}}[a61_0x53715d(0x77)](){const _0x27fbad=a61_0x53715d;console['log'](a61_0x52b3a9[_0x27fbad(0x72)]('[context]'));for(const {key:_0x7e8f7f,value:_0xc782e9}of this[_0x27fbad(0x9a)]()){if(_0xc782e9){const _0x2e65cc=_0x7e8f7f===_0x27fbad(0x98)?_0x27fbad(0x7c):'('+this[_0x27fbad(0x9d)](_0x7e8f7f,_0xc782e9)+')';console[_0x27fbad(0xb8)](a61_0x52b3a9['cyan'](_0x7e8f7f)+':\x20'+_0xc782e9+'\x20'+a61_0x52b3a9[_0x27fbad(0xac)](_0x2e65cc));}}console[_0x27fbad(0xb8)]('\x0a'+a61_0x52b3a9[_0x27fbad(0x72)]('[configuration\x20files]'));const _0x29165b=[{'label':'Session','path':this[_0x27fbad(0x84)][_0x27fbad(0x78)],'extra':'(session:\x20'+this[_0x27fbad(0xc0)]+')'},{'label':_0x27fbad(0x71),'path':this[_0x27fbad(0x84)][_0x27fbad(0x87)]},{'label':_0x27fbad(0xb1),'path':this[_0x27fbad(0x84)][_0x27fbad(0x98)]},{'label':_0x27fbad(0x7d),'path':this[_0x27fbad(0x84)]['profileCredentials']},{'label':_0x27fbad(0x75),'path':this['configFiles'][_0x27fbad(0xb6)]},{'label':_0x27fbad(0x99),'path':this[_0x27fbad(0x84)][_0x27fbad(0xb7)]}];for(const {label:_0x128d6c,path:_0x2596e2,extra:_0x5dca94}of _0x29165b){if(_0x2596e2)console[_0x27fbad(0xb8)](a61_0x52b3a9[_0x27fbad(0x9b)](_0x128d6c)+':\x20'+_0x2596e2+'\x20'+a61_0x52b3a9[_0x27fbad(0xa7)]('✓')+(_0x5dca94?'\x20'+a61_0x52b3a9[_0x27fbad(0xac)](_0x5dca94):''));else{if(_0x128d6c===_0x27fbad(0x95))console['log'](a61_0x52b3a9[_0x27fbad(0x9b)](_0x128d6c)+':\x20'+a61_0x52b3a9[_0x27fbad(0xac)](_0x27fbad(0xa8))+'\x20'+a61_0x52b3a9[_0x27fbad(0xac)](_0x27fbad(0x9c)+this[_0x27fbad(0xc0)]+')'));else(_0x128d6c===_0x27fbad(0x71)||_0x128d6c==='Global')&&console[_0x27fbad(0xb8)](a61_0x52b3a9['cyan'](_0x128d6c)+':\x20'+a61_0x52b3a9['dim'](_0x27fbad(0xa8)));}}}async[a61_0x53715d(0xaf)](){const _0x4eb671=a61_0x53715d;if(!this[_0x4eb671(0xbd)]){const _0x20378d=await getOAuthTokens(this['activeProfile']||undefined);if(_0x20378d){const _0x4887f0=0x5*0x3c*0x3e8,_0x52f070=!_0x20378d[_0x4eb671(0xa4)]||_0x20378d[_0x4eb671(0xa4)]<Date[_0x4eb671(0xc4)]()+_0x4887f0;if(_0x52f070&&_0x20378d[_0x4eb671(0xa9)])try{const _0x216324=getConsoleUrl(this[_0x4eb671(0x79)]),_0x4255c8=await refreshAccessToken(_0x216324,_0x20378d['refresh_token']);await saveOAuthTokens(_0x4255c8,this['activeProfile']||undefined),this['accessToken']=_0x4255c8['access_token'];}catch{this[_0x4eb671(0xbd)]=_0x20378d[_0x4eb671(0xc6)];}else this['accessToken']=_0x20378d[_0x4eb671(0xc6)];return undefined;}}return this[_0x4eb671(0xb4)]=await getAPIKeyAsync(this[_0x4eb671(0x79)],this[_0x4eb671(0x96)]||undefined),this[_0x4eb671(0xb4)];}static async[a61_0x53715d(0xb5)](_0x476cce){const _0x823bb2=a61_0x53715d,_0x14b9a8=new GlobalContext(_0x476cce);return await _0x14b9a8[_0x823bb2(0xaf)](),_0x14b9a8;}}
@@ -1 +1 @@
1
- const a62_0x23703c=a62_0x4d7f;function a62_0x4d7f(_0x2a4270,_0x258782){_0x2a4270=_0x2a4270-0x79;const _0x10fd8a=a62_0x10fd();let _0x4d7f67=_0x10fd8a[_0x2a4270];return _0x4d7f67;}(function(_0x1b23e6,_0x5ebd9c){const _0x30f70a=a62_0x4d7f,_0x392c49=_0x1b23e6();while(!![]){try{const _0x3e9171=parseInt(_0x30f70a(0x81))/0x1*(-parseInt(_0x30f70a(0x9c))/0x2)+parseInt(_0x30f70a(0x88))/0x3*(-parseInt(_0x30f70a(0x8c))/0x4)+parseInt(_0x30f70a(0x82))/0x5*(-parseInt(_0x30f70a(0x91))/0x6)+-parseInt(_0x30f70a(0x85))/0x7*(parseInt(_0x30f70a(0x95))/0x8)+-parseInt(_0x30f70a(0x99))/0x9+-parseInt(_0x30f70a(0x79))/0xa*(parseInt(_0x30f70a(0x89))/0xb)+parseInt(_0x30f70a(0x97))/0xc*(parseInt(_0x30f70a(0x80))/0xd);if(_0x3e9171===_0x5ebd9c)break;else _0x392c49['push'](_0x392c49['shift']());}catch(_0x3bb78b){_0x392c49['push'](_0x392c49['shift']());}}}(a62_0x10fd,0xde36f));const SERVICE_NAME=a62_0x23703c(0x7e);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x1fdaf2=a62_0x23703c;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x466b2b=await import(_0x1fdaf2(0x8f));return EntryClass=_0x466b2b['Entry'],EntryClass;}catch(_0x21e8e4){return keyringLoadError=_0x21e8e4 instanceof Error?_0x21e8e4:new Error(String(_0x21e8e4)),null;}}function getAccountName(_0x51c6e0){const _0x455b28=a62_0x23703c,_0x216a34=_0x51c6e0||'';return _0x455b28(0x7a)+_0x216a34+_0x455b28(0x96);}export async function getKeychainAPIKey(_0x5c811a){const _0x553015=a62_0x23703c,_0x4b4a17=await getKeychainAPIKeyWithStatus(_0x5c811a);if(_0x4b4a17[_0x553015(0x98)])return _0x4b4a17[_0x553015(0x7d)];return _0x4b4a17[_0x553015(0x90)]===_0x553015(0x83)&&console[_0x553015(0x9b)](_0x553015(0x9a)+_0x4b4a17[_0x553015(0x86)]),null;}export async function getKeychainAPIKeyWithStatus(_0xca1ac2){const _0x518f78=a62_0x23703c;try{const _0x55c6ba=await getEntryClass();if(!_0x55c6ba)return{'success':![],'reason':_0x518f78(0x84)};const _0x409a21=getAccountName(_0xca1ac2),_0x52db18=new _0x55c6ba(SERVICE_NAME,_0x409a21),_0x5b141c=_0x52db18[_0x518f78(0x92)]();if(_0x5b141c)return{'success':!![],'value':_0x5b141c};return{'success':![],'reason':_0x518f78(0x94)};}catch(_0x599eb6){const _0xdb87b5=_0x599eb6 instanceof Error?_0x599eb6[_0x518f78(0x86)]:String(_0x599eb6);if(_0xdb87b5[_0x518f78(0x7f)](_0x518f78(0x87))||_0xdb87b5[_0x518f78(0x9f)]()[_0x518f78(0x7f)]('could\x20not\x20be\x20found')||_0xdb87b5[_0x518f78(0x9f)]()['includes'](_0x518f78(0x8a))||_0xdb87b5[_0x518f78(0x9f)]()[_0x518f78(0x7f)](_0x518f78(0x7c)))return{'success':![],'reason':'not_found'};if(_0xdb87b5['includes'](_0x518f78(0x8d))||_0xdb87b5['toLowerCase']()[_0x518f78(0x7f)](_0x518f78(0x8b))||_0xdb87b5[_0x518f78(0x9f)]()[_0x518f78(0x7f)](_0x518f78(0x93)))return{'success':![],'reason':_0x518f78(0x83),'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':_0x518f78(0x84),'message':_0xdb87b5};}}export async function saveKeychainAPIKey(_0x16c204,_0x2b81cd){const _0x3fd89b=a62_0x23703c,_0x171709=await getEntryClass();if(!_0x171709)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x54ad1f=getAccountName(_0x2b81cd),_0x131548=new _0x171709(SERVICE_NAME,_0x54ad1f);_0x131548[_0x3fd89b(0x8e)](_0x16c204);}function a62_0x10fd(){const _0x58432e=['430XSbYZR','access_denied','unavailable','56WeDRdc','message','-25300','474hSWQrx','13717YzvWvY','not\x20found','restricted','34108kdCdmd','-25293','setPassword','@napi-rs/keyring','reason','92268jFAjvd','getPassword','access','not_found','691576tclLHm',':api_key','6628596gIbRuG','success','7146063CorQbt','Warning:\x20','error','1460794qBnNVt','not\x20available','__keychain_test__','toLowerCase','deleteCredential','820uIdApX','profile:','cannot\x20find','no\x20matching\x20entry','value','tdx','includes','156fOgsio','2KxxRGt'];a62_0x10fd=function(){return _0x58432e;};return a62_0x10fd();}export async function deleteKeychainAPIKey(_0x592d68){const _0x559c51=a62_0x23703c;try{const _0x133fef=await getEntryClass();if(!_0x133fef)return![];const _0x11f2c4=getAccountName(_0x592d68),_0x44dbb9=new _0x133fef(SERVICE_NAME,_0x11f2c4);return _0x44dbb9[_0x559c51(0xa0)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x4512d9=a62_0x23703c;try{const _0x210efc=await getEntryClass();if(!_0x210efc)return![];const _0x4078a0=new _0x210efc(SERVICE_NAME,_0x4512d9(0x9e));return _0x4078a0[_0x4512d9(0x92)](),!![];}catch(_0xe4892d){const _0x39dab8=_0xe4892d instanceof Error?_0xe4892d['message'][_0x4512d9(0x9f)]():'';if(_0x39dab8['includes'](_0x4512d9(0x9d))||_0x39dab8[_0x4512d9(0x7f)]('not\x20supported')||_0x39dab8[_0x4512d9(0x7f)](_0x4512d9(0x7b)))return![];return!![];}}
1
+ function a62_0x2083(_0x503798,_0x2ca361){_0x503798=_0x503798-0x16a;const _0x437da7=a62_0x437d();let _0x208361=_0x437da7[_0x503798];return _0x208361;}const a62_0x1fbc46=a62_0x2083;function a62_0x437d(){const _0xff9723=['toLowerCase','not_found','success','restricted','not\x20available','includes','value','access','-25300','-25293','Entry','tdx','Warning:\x20','174594oaXXEB','179456yrzCfm','2552AvuCAi','20zFCYYX','447QmQwyc','System\x20keychain\x20is\x20not\x20available','getPassword','profile:','794HjYlJy','not\x20found','unavailable','access_denied','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.','10DRIcfy','12GDTeZc','reason','could\x20not\x20be\x20found',':api_key','message','setPassword','18FJheyV','no\x20matching\x20entry','3681WJEobQ','714263zNeBCE','116080OpwYCo','2356471NRcPHV','@napi-rs/keyring'];a62_0x437d=function(){return _0xff9723;};return a62_0x437d();}(function(_0x4ac705,_0x1f6f3e){const _0x18b8a3=a62_0x2083,_0x1f32b1=_0x4ac705();while(!![]){try{const _0x3ccff4=-parseInt(_0x18b8a3(0x170))/0x1+parseInt(_0x18b8a3(0x188))/0x2*(-parseInt(_0x18b8a3(0x184))/0x3)+-parseInt(_0x18b8a3(0x181))/0x4*(parseInt(_0x18b8a3(0x18d))/0x5)+-parseInt(_0x18b8a3(0x16c))/0x6*(parseInt(_0x18b8a3(0x180))/0x7)+-parseInt(_0x18b8a3(0x182))/0x8*(-parseInt(_0x18b8a3(0x16e))/0x9)+parseInt(_0x18b8a3(0x183))/0xa*(parseInt(_0x18b8a3(0x16f))/0xb)+-parseInt(_0x18b8a3(0x18e))/0xc*(-parseInt(_0x18b8a3(0x171))/0xd);if(_0x3ccff4===_0x1f6f3e)break;else _0x1f32b1['push'](_0x1f32b1['shift']());}catch(_0x92ba9c){_0x1f32b1['push'](_0x1f32b1['shift']());}}}(a62_0x437d,0x18db9));const SERVICE_NAME=a62_0x1fbc46(0x17e);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x243781=a62_0x1fbc46;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x110ea6=await import(_0x243781(0x172));return EntryClass=_0x110ea6[_0x243781(0x17d)],EntryClass;}catch(_0x35305c){return keyringLoadError=_0x35305c instanceof Error?_0x35305c:new Error(String(_0x35305c)),null;}}function getAccountName(_0x53922c){const _0x1f5518=a62_0x1fbc46,_0x3f5da8=_0x53922c||'';return _0x1f5518(0x187)+_0x3f5da8+_0x1f5518(0x191);}export async function getKeychainAPIKey(_0x1b8932){const _0x3a64d1=a62_0x1fbc46,_0x4e5153=await getKeychainAPIKeyWithStatus(_0x1b8932);if(_0x4e5153[_0x3a64d1(0x175)])return _0x4e5153[_0x3a64d1(0x179)];return _0x4e5153[_0x3a64d1(0x18f)]===_0x3a64d1(0x18b)&&console['error'](_0x3a64d1(0x17f)+_0x4e5153['message']),null;}export async function getKeychainAPIKeyWithStatus(_0x2f4fe8){const _0x52fd47=a62_0x1fbc46;try{const _0x5dd771=await getEntryClass();if(!_0x5dd771)return{'success':![],'reason':'unavailable'};const _0x28dd92=getAccountName(_0x2f4fe8),_0x18edfb=new _0x5dd771(SERVICE_NAME,_0x28dd92),_0x1f9401=_0x18edfb[_0x52fd47(0x186)]();if(_0x1f9401)return{'success':!![],'value':_0x1f9401};return{'success':![],'reason':_0x52fd47(0x174)};}catch(_0x541cfd){const _0xabb3f9=_0x541cfd instanceof Error?_0x541cfd[_0x52fd47(0x16a)]:String(_0x541cfd);if(_0xabb3f9[_0x52fd47(0x178)](_0x52fd47(0x17b))||_0xabb3f9[_0x52fd47(0x173)]()[_0x52fd47(0x178)](_0x52fd47(0x190))||_0xabb3f9[_0x52fd47(0x173)]()[_0x52fd47(0x178)](_0x52fd47(0x189))||_0xabb3f9[_0x52fd47(0x173)]()[_0x52fd47(0x178)](_0x52fd47(0x16d)))return{'success':![],'reason':'not_found'};if(_0xabb3f9[_0x52fd47(0x178)](_0x52fd47(0x17c))||_0xabb3f9[_0x52fd47(0x173)]()[_0x52fd47(0x178)](_0x52fd47(0x176))||_0xabb3f9[_0x52fd47(0x173)]()[_0x52fd47(0x178)](_0x52fd47(0x17a)))return{'success':![],'reason':'access_denied','message':_0x52fd47(0x18c)};return{'success':![],'reason':_0x52fd47(0x18a),'message':_0xabb3f9};}}export async function saveKeychainAPIKey(_0x2361c1,_0x56b15e){const _0x2bb3d8=a62_0x1fbc46,_0x6e293e=await getEntryClass();if(!_0x6e293e)throw new Error(_0x2bb3d8(0x185));const _0x19449d=getAccountName(_0x56b15e),_0x374d0f=new _0x6e293e(SERVICE_NAME,_0x19449d);_0x374d0f[_0x2bb3d8(0x16b)](_0x2361c1);}export async function deleteKeychainAPIKey(_0x1ace02){try{const _0x52b2f0=await getEntryClass();if(!_0x52b2f0)return![];const _0x3f4a48=getAccountName(_0x1ace02),_0xf09515=new _0x52b2f0(SERVICE_NAME,_0x3f4a48);return _0xf09515['deleteCredential'](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0xf65c69=a62_0x1fbc46;try{const _0x2bca88=await getEntryClass();if(!_0x2bca88)return![];const _0x1ff325=new _0x2bca88(SERVICE_NAME,'__keychain_test__');return _0x1ff325[_0xf65c69(0x186)](),!![];}catch(_0x1d64ce){const _0x1c862f=_0x1d64ce instanceof Error?_0x1d64ce[_0xf65c69(0x16a)][_0xf65c69(0x173)]():'';if(_0x1c862f[_0xf65c69(0x178)](_0xf65c69(0x177))||_0x1c862f[_0xf65c69(0x178)]('not\x20supported')||_0x1c862f[_0xf65c69(0x178)]('cannot\x20find'))return![];return!![];}}
@@ -1 +1 @@
1
- (function(_0x463e9c,_0x158deb){const _0x172a6a=a63_0x42f8,_0x5e3bc9=_0x463e9c();while(!![]){try{const _0x5101f9=-parseInt(_0x172a6a(0x107))/0x1+-parseInt(_0x172a6a(0x114))/0x2+parseInt(_0x172a6a(0x10b))/0x3+-parseInt(_0x172a6a(0x10f))/0x4+parseInt(_0x172a6a(0x10e))/0x5+parseInt(_0x172a6a(0x111))/0x6*(parseInt(_0x172a6a(0x112))/0x7)+-parseInt(_0x172a6a(0x10a))/0x8*(-parseInt(_0x172a6a(0x115))/0x9);if(_0x5101f9===_0x158deb)break;else _0x5e3bc9['push'](_0x5e3bc9['shift']());}catch(_0x3c3d75){_0x5e3bc9['push'](_0x5e3bc9['shift']());}}}(a63_0x29e9,0x738e3));const SERVICE_NAME='tdx';function a63_0x42f8(_0x27ea7c,_0x30a149){_0x27ea7c=_0x27ea7c-0x106;const _0x29e9cd=a63_0x29e9();let _0x42f86=_0x29e9cd[_0x27ea7c];return _0x42f86;}let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x2752f0=a63_0x42f8;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0xbdd738=await import(_0x2752f0(0x113));return EntryClass=_0xbdd738[_0x2752f0(0x106)],EntryClass;}catch(_0x110285){return keyringLoadError=_0x110285 instanceof Error?_0x110285:new Error(String(_0x110285)),null;}}function a63_0x29e9(){const _0x4ee2c7=['394560ZdWxqq','1807888zwwwyU',':oauth_tokens','54MWZXko','397817niKsON','@napi-rs/keyring','970232MLJVDF','40401yKVqyV','Entry','602661xFgafH','deleteCredential','setPassword','2168vywpHy','618462nFjOUZ','parse','stringify'];a63_0x29e9=function(){return _0x4ee2c7;};return a63_0x29e9();}function getOAuthAccountName(_0x2e57b8){const _0x5c2c40=a63_0x42f8,_0x3718fb=_0x2e57b8||'';return'profile:'+_0x3718fb+_0x5c2c40(0x110);}export async function saveOAuthTokens(_0x4c42cb,_0x14e59c){const _0x17819c=a63_0x42f8,_0xaf3898=await getEntryClass();if(!_0xaf3898)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x4fa6be=getOAuthAccountName(_0x14e59c),_0x14c896=new _0xaf3898(SERVICE_NAME,_0x4fa6be);_0x14c896[_0x17819c(0x109)](JSON[_0x17819c(0x10d)](_0x4c42cb));}export async function getOAuthTokens(_0x34b2c1){const _0x2635a1=a63_0x42f8;try{const _0x1f1dc1=await getEntryClass();if(!_0x1f1dc1)return null;const _0x23dc96=getOAuthAccountName(_0x34b2c1),_0x4f4872=new _0x1f1dc1(SERVICE_NAME,_0x23dc96),_0x4d0465=_0x4f4872['getPassword']();if(_0x4d0465)return JSON[_0x2635a1(0x10c)](_0x4d0465);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x19ca50){const _0x5357ae=a63_0x42f8;try{const _0x296ec0=await getEntryClass();if(!_0x296ec0)return![];const _0x5eda09=getOAuthAccountName(_0x19ca50),_0x5dda70=new _0x296ec0(SERVICE_NAME,_0x5eda09);return _0x5dda70[_0x5357ae(0x108)](),!![];}catch{return![];}}
1
+ const a63_0x894120=a63_0x11d4;(function(_0x2c7fa9,_0x9ab04){const _0x2e29f5=a63_0x11d4,_0xde764b=_0x2c7fa9();while(!![]){try{const _0x1ef4c2=parseInt(_0x2e29f5(0x1ad))/0x1*(parseInt(_0x2e29f5(0x1b7))/0x2)+-parseInt(_0x2e29f5(0x1b5))/0x3*(-parseInt(_0x2e29f5(0x1b6))/0x4)+parseInt(_0x2e29f5(0x1b8))/0x5*(-parseInt(_0x2e29f5(0x1b2))/0x6)+parseInt(_0x2e29f5(0x1b4))/0x7*(parseInt(_0x2e29f5(0x1bd))/0x8)+-parseInt(_0x2e29f5(0x1be))/0x9+-parseInt(_0x2e29f5(0x1ba))/0xa*(parseInt(_0x2e29f5(0x1ae))/0xb)+parseInt(_0x2e29f5(0x1b3))/0xc*(parseInt(_0x2e29f5(0x1b9))/0xd);if(_0x1ef4c2===_0x9ab04)break;else _0xde764b['push'](_0xde764b['shift']());}catch(_0x59fe0b){_0xde764b['push'](_0xde764b['shift']());}}}(a63_0x3127,0xa70ca));const SERVICE_NAME=a63_0x894120(0x1af);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x30e279=a63_0x894120;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x3f88c5=await import(_0x30e279(0x1b0));return EntryClass=_0x3f88c5['Entry'],EntryClass;}catch(_0x5bd5bd){return keyringLoadError=_0x5bd5bd instanceof Error?_0x5bd5bd:new Error(String(_0x5bd5bd)),null;}}function getOAuthAccountName(_0x13962d){const _0x358495=_0x13962d||'';return'profile:'+_0x358495+':oauth_tokens';}function a63_0x11d4(_0x171054,_0x2dc0f3){_0x171054=_0x171054-0x1ad;const _0x3127c1=a63_0x3127();let _0x11d4da=_0x3127c1[_0x171054];return _0x11d4da;}export async function saveOAuthTokens(_0x16582a,_0x350ed3){const _0x121545=a63_0x894120,_0x5355f6=await getEntryClass();if(!_0x5355f6)throw new Error(_0x121545(0x1b1));const _0x2e7aa3=getOAuthAccountName(_0x350ed3),_0x35f69b=new _0x5355f6(SERVICE_NAME,_0x2e7aa3);_0x35f69b[_0x121545(0x1bb)](JSON[_0x121545(0x1bc)](_0x16582a));}function a63_0x3127(){const _0x68a465=['10559403OAhQUe','1YskFqy','6589PNDHly','tdx','@napi-rs/keyring','System\x20keychain\x20is\x20not\x20available','882ezuypu','876TmYJBH','21wFanUA','30HfecXz','546348oirCmn','979990wVpauJ','19330ZxSptz','263406SdbJlz','20260xfubkQ','setPassword','stringify','811696zSxJIN'];a63_0x3127=function(){return _0x68a465;};return a63_0x3127();}export async function getOAuthTokens(_0x2d08d7){try{const _0x20e090=await getEntryClass();if(!_0x20e090)return null;const _0x580a5d=getOAuthAccountName(_0x2d08d7),_0x34fd95=new _0x20e090(SERVICE_NAME,_0x580a5d),_0x35cb7f=_0x34fd95['getPassword']();if(_0x35cb7f)return JSON['parse'](_0x35cb7f);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x4ec76e){try{const _0x49bce9=await getEntryClass();if(!_0x49bce9)return![];const _0x2d81f8=getOAuthAccountName(_0x4ec76e),_0x692133=new _0x49bce9(SERVICE_NAME,_0x2d81f8);return _0x692133['deleteCredential'](),!![];}catch{return![];}}
@@ -1 +1 @@
1
- function a64_0x1948(){const _0x2e8735=['/oauth/token','text/html','toString','POST','629811bOYzEC','828FmKQxu','code','url','EADDRINUSE','127.0.0.1','error','scope','state','expires_in','pathname','146eOqYDZ','replace','get','now','redirect_to_path','clientId','waitForCallback','redirectUri','4333RCdXkN','client_id','json','accountName','1412584BWTwBC','searchParams','code_challenge','end','close','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','authorization_code','Not\x20Found','575PAkvuK','text','):\x20','writeHead','code_challenge_method','tdx','text/plain','S256','OAuth\x20token\x20request\x20failed\x20(','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','application/x-www-form-urlencoded','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','redirect_uri','1695560CzxDlD','base64url','set','87136hWJugB','/oauth/callback','message','Port\x20','hex','sha256','1615590GAHiqb','openid\x20email\x20profile','update','access_token','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','30WqqYVy','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','randomBytes'];a64_0x1948=function(){return _0x2e8735;};return a64_0x1948();}const a64_0x3bef71=a64_0x3325;(function(_0x308fa9,_0x462b64){const _0x4780c1=a64_0x3325,_0x3f9dcc=_0x308fa9();while(!![]){try{const _0x17f1d9=-parseInt(_0x4780c1(0x131))/0x1*(parseInt(_0x4780c1(0x15e))/0x2)+parseInt(_0x4780c1(0x153))/0x3+-parseInt(_0x4780c1(0x141))/0x4*(parseInt(_0x4780c1(0x14c))/0x5)+parseInt(_0x4780c1(0x154))/0x6*(-parseInt(_0x4780c1(0x166))/0x7)+-parseInt(_0x4780c1(0x129))/0x8+parseInt(_0x4780c1(0x147))/0x9+parseInt(_0x4780c1(0x13e))/0xa;if(_0x17f1d9===_0x462b64)break;else _0x3f9dcc['push'](_0x3f9dcc['shift']());}catch(_0x5692b6){_0x3f9dcc['push'](_0x3f9dcc['shift']());}}}(a64_0x1948,0x1e5a9));import*as a64_0x58f746 from'node:crypto';import*as a64_0x3f8fa0 from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI='http://localhost:'+OAUTH_CALLBACK_PORT+a64_0x3bef71(0x142);export function getOAuthClientId(){const _0x14b330=a64_0x3bef71;return process.env.TD_OAUTH_CLIENT_ID||_0x14b330(0x136);}export function generatePKCEPair(){const _0x5872f6=a64_0x3bef71,_0x47811c=a64_0x58f746[_0x5872f6(0x14e)](0x20)[_0x5872f6(0x151)](_0x5872f6(0x13f)),_0x5d27b0=a64_0x58f746['createHash'](_0x5872f6(0x146))[_0x5872f6(0x149)](_0x47811c)['digest'](_0x5872f6(0x13f));return{'verifier':_0x47811c,'challenge':_0x5d27b0};}export function buildAuthorizeURL(_0x265aca,_0x53e63){const _0x33b109=a64_0x3bef71,_0x49db3d=new URL('/oauth/authorize',_0x265aca);return _0x49db3d[_0x33b109(0x12a)][_0x33b109(0x140)]('response_type',_0x33b109(0x155)),_0x49db3d[_0x33b109(0x12a)][_0x33b109(0x140)](_0x33b109(0x167),_0x53e63[_0x33b109(0x163)]),_0x49db3d[_0x33b109(0x12a)]['set'](_0x33b109(0x13d),_0x53e63[_0x33b109(0x165)]),_0x49db3d[_0x33b109(0x12a)]['set'](_0x33b109(0x15b),_0x53e63[_0x33b109(0x15b)]),_0x49db3d[_0x33b109(0x12a)]['set'](_0x33b109(0x12b),_0x53e63['codeChallenge']),_0x49db3d[_0x33b109(0x12a)][_0x33b109(0x140)](_0x33b109(0x135),_0x33b109(0x138)),_0x53e63['scope']&&_0x49db3d['searchParams'][_0x33b109(0x140)](_0x33b109(0x15a),_0x53e63[_0x33b109(0x15a)]),_0x49db3d['toString']();}function a64_0x3325(_0x447c5f,_0x5495fb){_0x447c5f=_0x447c5f-0x128;const _0x194801=a64_0x1948();let _0x3325a9=_0x194801[_0x447c5f];return _0x3325a9;}export function buildSSOInitiateURL(_0xfcf1b8,_0x3ff7a1,_0x2ff472){const _0x56c235=a64_0x3bef71,_0x4bcfa0=new URL('/users/initiate_sso',_0xfcf1b8);_0x4bcfa0[_0x56c235(0x12a)][_0x56c235(0x140)]('account_name',_0x3ff7a1);const _0xccdecc=_0x2ff472[_0x56c235(0x15f)](_0xfcf1b8,'');return _0x4bcfa0[_0x56c235(0x12a)][_0x56c235(0x140)](_0x56c235(0x162),_0xccdecc),_0x4bcfa0['toString']();}export async function postTokenRequest(_0x38fc85,_0x43a3bf){const _0x28a7c6=a64_0x3bef71,_0x5eef93=new URLSearchParams(_0x43a3bf)[_0x28a7c6(0x151)](),_0x14ce2f=await fetch(_0x38fc85,{'method':_0x28a7c6(0x152),'headers':{'Content-Type':_0x28a7c6(0x13b)},'body':_0x5eef93});if(!_0x14ce2f['ok']){const _0x34945a=await _0x14ce2f[_0x28a7c6(0x132)]();throw new Error(_0x28a7c6(0x139)+_0x14ce2f['status']+_0x28a7c6(0x133)+_0x34945a);}const _0xfd19fd=await _0x14ce2f[_0x28a7c6(0x168)]();return{'access_token':_0xfd19fd[_0x28a7c6(0x14a)],'refresh_token':_0xfd19fd['refresh_token'],'scope':_0xfd19fd['scope'],'expires_at':_0xfd19fd[_0x28a7c6(0x15c)]?Date[_0x28a7c6(0x161)]()+_0xfd19fd['expires_in']*0x3e8:undefined};}export async function exchangeCodeForTokens(_0x2808a0,_0x1b3756,_0x593c2f,_0x1b398c){const _0x3af476=a64_0x3bef71,_0x54688c=_0x2808a0+_0x3af476(0x14f);return postTokenRequest(_0x54688c,{'grant_type':_0x3af476(0x12f),'client_id':getOAuthClientId(),'code':_0x1b3756,'code_verifier':_0x593c2f,'redirect_uri':_0x1b398c});}export function startLocalCallbackServer(){const _0x233369=a64_0x3bef71;let _0x2ffa33,_0x576228;const _0xb7d336=new Promise((_0x225243,_0x4244c1)=>{_0x2ffa33=_0x225243,_0x576228=_0x4244c1;}),_0x154268=a64_0x3f8fa0['createServer']((_0x4105c6,_0x4fc27b)=>{const _0x11ce8e=a64_0x3325,_0x34f369=new URL(_0x4105c6[_0x11ce8e(0x156)]||'/','http://127.0.0.1');if(_0x34f369[_0x11ce8e(0x15d)]!==_0x11ce8e(0x142)){_0x4fc27b[_0x11ce8e(0x134)](0x194,{'Content-Type':_0x11ce8e(0x137)}),_0x4fc27b[_0x11ce8e(0x12c)](_0x11ce8e(0x130));return;}const _0xa7dd93=_0x34f369['searchParams'][_0x11ce8e(0x160)]('code'),_0x557130=_0x34f369[_0x11ce8e(0x12a)]['get'](_0x11ce8e(0x15b)),_0x5d8498=_0x34f369[_0x11ce8e(0x12a)][_0x11ce8e(0x160)](_0x11ce8e(0x159));if(_0x5d8498||!_0xa7dd93||!_0x557130){_0x4fc27b[_0x11ce8e(0x134)](0x190,{'Content-Type':_0x11ce8e(0x150)}),_0x4fc27b['end'](_0x11ce8e(0x13a)),_0x576228(new Error(_0x11ce8e(0x14d)));return;}_0x4fc27b[_0x11ce8e(0x134)](0xc8,{'Content-Type':_0x11ce8e(0x150)}),_0x4fc27b[_0x11ce8e(0x12c)](_0x11ce8e(0x13c)),_0x2ffa33({'code':_0xa7dd93,'state':_0x557130});});_0x154268['on']('error',_0x92ac60=>{const _0x153c41=a64_0x3325;_0x92ac60['code']===_0x153c41(0x157)?_0x576228(new Error(_0x153c41(0x144)+OAUTH_CALLBACK_PORT+_0x153c41(0x12e))):_0x576228(new Error(_0x153c41(0x14b)+_0x92ac60[_0x153c41(0x143)]));}),_0x154268['listen'](OAUTH_CALLBACK_PORT,_0x233369(0x158));const _0x212b86=setTimeout(()=>{const _0x289e3b=_0x233369;_0x576228(new Error('OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes')),_0x154268[_0x289e3b(0x12d)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0xb7d336,'close':()=>{const _0x207ba4=_0x233369;clearTimeout(_0x212b86),_0x154268[_0x207ba4(0x12d)]();}};}export async function startOAuthFlow(_0x34cb8c,_0x47a4cb){const _0xe4204f=a64_0x3bef71,_0x55f563=getConsoleUrl(_0x34cb8c),_0x12b032=getOAuthClientId(),{verifier:_0x34fbcd,challenge:_0x4ce99b}=generatePKCEPair(),_0x929ca8=a64_0x58f746['randomBytes'](0x10)[_0xe4204f(0x151)](_0xe4204f(0x145)),_0x2187b3=startLocalCallbackServer();try{const _0x173aca=OAUTH_REDIRECT_URI,_0x3157fe=buildAuthorizeURL(_0x55f563,{'clientId':_0x12b032,'redirectUri':_0x173aca,'state':_0x929ca8,'codeChallenge':_0x4ce99b,'scope':_0xe4204f(0x148)}),_0x57cae0=_0x47a4cb?.[_0xe4204f(0x128)]?buildSSOInitiateURL(_0x55f563,_0x47a4cb[_0xe4204f(0x128)],_0x3157fe):_0x3157fe;openBrowser(_0x57cae0);const _0x4a4173=await _0x2187b3[_0xe4204f(0x164)]();if(_0x4a4173[_0xe4204f(0x15b)]!==_0x929ca8)throw new Error('OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack');return await exchangeCodeForTokens(_0x55f563,_0x4a4173['code'],_0x34fbcd,_0x173aca);}finally{_0x2187b3['close']();}}
1
+ (function(_0x3bcdb2,_0xe92594){const _0x458871=a64_0x2c08,_0x3b9e04=_0x3bcdb2();while(!![]){try{const _0x45fba1=parseInt(_0x458871(0x142))/0x1*(-parseInt(_0x458871(0x13f))/0x2)+parseInt(_0x458871(0x169))/0x3*(parseInt(_0x458871(0x151))/0x4)+parseInt(_0x458871(0x17b))/0x5+parseInt(_0x458871(0x15b))/0x6+parseInt(_0x458871(0x182))/0x7+parseInt(_0x458871(0x170))/0x8+-parseInt(_0x458871(0x172))/0x9*(parseInt(_0x458871(0x17d))/0xa);if(_0x45fba1===_0xe92594)break;else _0x3b9e04['push'](_0x3b9e04['shift']());}catch(_0x5c27c9){_0x3b9e04['push'](_0x3b9e04['shift']());}}}(a64_0x4fb1,0x505c6));function a64_0x2c08(_0x566797,_0x55d2af){_0x566797=_0x566797-0x13f;const _0x4fb1bb=a64_0x4fb1();let _0x2c0832=_0x4fb1bb[_0x566797];return _0x2c0832;}import*as a64_0x509630 from'node:crypto';import*as a64_0x46e3d3 from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI='http://localhost:'+OAUTH_CALLBACK_PORT+'/oauth/callback';export function getOAuthClientId(){return process.env.TD_OAUTH_CLIENT_ID||'tdx';}export function generatePKCEPair(){const _0x222081=a64_0x2c08,_0x4a9fc6=a64_0x509630[_0x222081(0x17c)](0x20)[_0x222081(0x179)](_0x222081(0x171)),_0x572729=a64_0x509630[_0x222081(0x16f)](_0x222081(0x164))[_0x222081(0x147)](_0x4a9fc6)['digest'](_0x222081(0x171));return{'verifier':_0x4a9fc6,'challenge':_0x572729};}export function buildAuthorizeURL(_0xd30244,_0x2b1420){const _0xa4eaee=a64_0x2c08,_0x4afe2b=new URL('/oauth/authorize',_0xd30244);return _0x4afe2b[_0xa4eaee(0x15d)][_0xa4eaee(0x146)](_0xa4eaee(0x176),_0xa4eaee(0x159)),_0x4afe2b[_0xa4eaee(0x15d)][_0xa4eaee(0x146)](_0xa4eaee(0x178),_0x2b1420[_0xa4eaee(0x155)]),_0x4afe2b[_0xa4eaee(0x15d)][_0xa4eaee(0x146)](_0xa4eaee(0x175),_0x2b1420[_0xa4eaee(0x16c)]),_0x4afe2b['searchParams'][_0xa4eaee(0x146)]('state',_0x2b1420['state']),_0x4afe2b[_0xa4eaee(0x15d)][_0xa4eaee(0x146)](_0xa4eaee(0x160),_0x2b1420[_0xa4eaee(0x154)]),_0x4afe2b[_0xa4eaee(0x15d)][_0xa4eaee(0x146)](_0xa4eaee(0x180),'S256'),_0x2b1420['scope']&&_0x4afe2b[_0xa4eaee(0x15d)][_0xa4eaee(0x146)]('scope',_0x2b1420[_0xa4eaee(0x149)]),_0x4afe2b[_0xa4eaee(0x179)]();}export function buildSSOInitiateURL(_0x3c3500,_0x5567d4,_0x273114){const _0x22dfa9=a64_0x2c08,_0x1d203b=new URL(_0x22dfa9(0x145),_0x3c3500);_0x1d203b['searchParams'][_0x22dfa9(0x146)](_0x22dfa9(0x14e),_0x5567d4);const _0xe6c6e=_0x273114[_0x22dfa9(0x14c)](_0x3c3500,'');return _0x1d203b[_0x22dfa9(0x15d)]['set'](_0x22dfa9(0x173),_0xe6c6e),_0x1d203b['toString']();}export async function postTokenRequest(_0x28f398,_0x45c028){const _0x1f5483=a64_0x2c08,_0x1119e8=new URLSearchParams(_0x45c028)[_0x1f5483(0x179)](),_0x42145b=await fetch(_0x28f398,{'method':_0x1f5483(0x15e),'headers':{'Content-Type':_0x1f5483(0x177)},'body':_0x1119e8});if(!_0x42145b['ok']){const _0x214b36=await _0x42145b[_0x1f5483(0x165)]();throw new Error(_0x1f5483(0x148)+_0x42145b[_0x1f5483(0x16a)]+_0x1f5483(0x141)+_0x214b36);}const _0x11d2ec=await _0x42145b['json']();return{'access_token':_0x11d2ec[_0x1f5483(0x168)],'refresh_token':_0x11d2ec[_0x1f5483(0x17a)],'scope':_0x11d2ec[_0x1f5483(0x149)],'expires_at':_0x11d2ec[_0x1f5483(0x174)]?Date['now']()+_0x11d2ec['expires_in']*0x3e8:undefined};}export async function exchangeCodeForTokens(_0x2670b9,_0x17f7ad,_0x235638,_0x15fcac){const _0x1d79d7=a64_0x2c08,_0x35d4f1=_0x2670b9+'/oauth/token';return postTokenRequest(_0x35d4f1,{'grant_type':_0x1d79d7(0x16e),'client_id':getOAuthClientId(),'code':_0x17f7ad,'code_verifier':_0x235638,'redirect_uri':_0x15fcac});}export function startLocalCallbackServer(){const _0x2a0283=a64_0x2c08;let _0x173ec6,_0xfba628;const _0x40aa8a=new Promise((_0x105e0e,_0x550990)=>{_0x173ec6=_0x105e0e,_0xfba628=_0x550990;}),_0x12210f=a64_0x46e3d3['createServer']((_0x20ea57,_0x135b89)=>{const _0x28c2d9=a64_0x2c08,_0xe2accf=new URL(_0x20ea57[_0x28c2d9(0x162)]||'/',_0x28c2d9(0x143));if(_0xe2accf[_0x28c2d9(0x167)]!==_0x28c2d9(0x14f)){_0x135b89['writeHead'](0x194,{'Content-Type':_0x28c2d9(0x163)}),_0x135b89[_0x28c2d9(0x152)](_0x28c2d9(0x14b));return;}const _0xe7f432=_0xe2accf[_0x28c2d9(0x15d)]['get'](_0x28c2d9(0x159)),_0x53c14d=_0xe2accf[_0x28c2d9(0x15d)][_0x28c2d9(0x15f)]('state'),_0x469bd0=_0xe2accf[_0x28c2d9(0x15d)]['get'](_0x28c2d9(0x150));if(_0x469bd0||!_0xe7f432||!_0x53c14d){_0x135b89['writeHead'](0x190,{'Content-Type':_0x28c2d9(0x166)}),_0x135b89[_0x28c2d9(0x152)](_0x28c2d9(0x16d)),_0xfba628(new Error(_0x28c2d9(0x153)));return;}_0x135b89[_0x28c2d9(0x15a)](0xc8,{'Content-Type':_0x28c2d9(0x166)}),_0x135b89[_0x28c2d9(0x152)](_0x28c2d9(0x17f)),_0x173ec6({'code':_0xe7f432,'state':_0x53c14d});});_0x12210f['on'](_0x2a0283(0x150),_0xf61e77=>{const _0x3694e4=_0x2a0283;_0xf61e77['code']===_0x3694e4(0x140)?_0xfba628(new Error(_0x3694e4(0x181)+OAUTH_CALLBACK_PORT+_0x3694e4(0x16b))):_0xfba628(new Error(_0x3694e4(0x17e)+_0xf61e77[_0x3694e4(0x158)]));}),_0x12210f['listen'](OAUTH_CALLBACK_PORT,'127.0.0.1');const _0x7ff20b=setTimeout(()=>{const _0x588ba5=_0x2a0283;_0xfba628(new Error(_0x588ba5(0x144))),_0x12210f[_0x588ba5(0x157)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x40aa8a,'close':()=>{const _0x2050bb=_0x2a0283;clearTimeout(_0x7ff20b),_0x12210f[_0x2050bb(0x157)]();}};}function a64_0x4fb1(){const _0x10c022=['set','update','OAuth\x20token\x20request\x20failed\x20(','scope','hex','Not\x20Found','replace','accountName','account_name','/oauth/callback','error','682796ntIpNa','end','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','codeChallenge','clientId','OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack','close','message','code','writeHead','1858200oqmtpq','waitForCallback','searchParams','POST','get','code_challenge','state','url','text/plain','sha256','text','text/html','pathname','access_token','3kHhaFH','status','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','redirectUri','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','authorization_code','createHash','1837888kWNqNl','base64url','9SjwjNi','redirect_to_path','expires_in','redirect_uri','response_type','application/x-www-form-urlencoded','client_id','toString','refresh_token','1969635DrvlBe','randomBytes','2578180UhyHNJ','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','code_challenge_method','Port\x20','731668BYTiLq','1243220esTCZb','EADDRINUSE','):\x20','1uuTakB','http://127.0.0.1','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','/users/initiate_sso'];a64_0x4fb1=function(){return _0x10c022;};return a64_0x4fb1();}export async function startOAuthFlow(_0x4b4878,_0x2a97d7){const _0x1eeddf=a64_0x2c08,_0x531d87=getConsoleUrl(_0x4b4878),_0x5dfbf9=getOAuthClientId(),{verifier:_0x196e0e,challenge:_0x3d8a17}=generatePKCEPair(),_0x4889a5=a64_0x509630[_0x1eeddf(0x17c)](0x10)[_0x1eeddf(0x179)](_0x1eeddf(0x14a)),_0x435ba7=startLocalCallbackServer();try{const _0x1723d8=OAUTH_REDIRECT_URI,_0x2fc473=buildAuthorizeURL(_0x531d87,{'clientId':_0x5dfbf9,'redirectUri':_0x1723d8,'state':_0x4889a5,'codeChallenge':_0x3d8a17,'scope':'openid\x20email\x20profile'}),_0x53b99e=_0x2a97d7?.[_0x1eeddf(0x14d)]?buildSSOInitiateURL(_0x531d87,_0x2a97d7[_0x1eeddf(0x14d)],_0x2fc473):_0x2fc473;openBrowser(_0x53b99e);const _0x781a58=await _0x435ba7[_0x1eeddf(0x15c)]();if(_0x781a58[_0x1eeddf(0x161)]!==_0x4889a5)throw new Error(_0x1eeddf(0x156));return await exchangeCodeForTokens(_0x531d87,_0x781a58[_0x1eeddf(0x159)],_0x196e0e,_0x1723d8);}finally{_0x435ba7[_0x1eeddf(0x157)]();}}
@@ -1 +1 @@
1
- const a65_0x1bd7a1=a65_0x41b0;(function(_0x415286,_0x321b45){const _0x5eda2d=a65_0x41b0,_0x3f4c0c=_0x415286();while(!![]){try{const _0x35ae0b=-parseInt(_0x5eda2d(0x17d))/0x1*(-parseInt(_0x5eda2d(0x198))/0x2)+parseInt(_0x5eda2d(0x17e))/0x3*(-parseInt(_0x5eda2d(0x1a6))/0x4)+parseInt(_0x5eda2d(0x1a9))/0x5*(-parseInt(_0x5eda2d(0x189))/0x6)+-parseInt(_0x5eda2d(0x18d))/0x7+parseInt(_0x5eda2d(0x18f))/0x8+-parseInt(_0x5eda2d(0x19f))/0x9+parseInt(_0x5eda2d(0x185))/0xa;if(_0x35ae0b===_0x321b45)break;else _0x3f4c0c['push'](_0x3f4c0c['shift']());}catch(_0x3a2eef){_0x3f4c0c['push'](_0x3f4c0c['shift']());}}}(a65_0x3159,0xaf5f2));import*as a65_0x6b1c53 from'node:fs';import*as a65_0x49fa67 from'node:path';function a65_0x3159(){const _0x5e2a40=['test','6497136VSCnYP','stringify','\x27\x20must\x20be\x20a\x20string','Profile\x20\x27','To\x20migrate:','database','INVALID_PROFILE_CONFIG','2084wtgCRu','name','profiles','35005uccZdN','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','Profile\x20','warn','directory','\x27\x20will\x20be\x20ignored','readdirSync','push','llm_agent',',\x20creating\x20new\x20file','entries','local','account_name','description','.env.','\x20already\x20exists','tdx.json','includes','utf-8','.env','sort','message','some','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','\x20\x201.\x20Edit:\x20','values','Warning:\x20Failed\x20to\x20parse\x20','set','join','Failed\x20to\x20parse\x20','has','\x22\x20\x22','\x27:\x20config\x20must\x20be\x20an\x20object','site','Invalid\x20profile\x20name:\x20','\x27\x20not\x20found\x20in\x20user\x20configuration','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','2iNuPKF','2289YFQfKq','isDirectory','existsSync','@tdx-studio','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','readFileSync','\x27:\x20unknown\x20config\x20key\x20\x27','9513470GYLrdI','parse','toISOString','from','492twZYfY',':\x20Invalid\x20JSON\x20syntax','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','map','2840733lJxval','Error:\x20','10592680pybrga','llm_project','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','keys','\x20does\x20not\x20exist','localeCompare','rmSync','filter','Warning:\x20Profile\x20\x27','542218MnmXdt','find','user_info','profile','\x20\x20mv\x20\x22','string'];a65_0x3159=function(){return _0x5e2a40;};return a65_0x3159();}import{SDKError,ErrorCode}from'../sdk/errors.js';function a65_0x41b0(_0x124fdf,_0x3df04e){_0x124fdf=_0x124fdf-0x172;const _0x3159f=a65_0x3159();let _0x41b06d=_0x3159f[_0x124fdf];return _0x41b06d;}import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME=a65_0x1bd7a1(0x181);export function getProfileParams(_0x4ece97){const _0x31d455=a65_0x1bd7a1,_0x3cba5a={};if(!_0x4ece97)return _0x3cba5a;for(const [_0xaedc03,_0x459576]of Object[_0x31d455(0x1b3)](_0x4ece97)){_0xaedc03!==_0x31d455(0x1b6)&&_0x459576!==undefined&&(_0x3cba5a[_0xaedc03]=_0x459576);}return _0x3cba5a;}export function getProfilesDir(){const _0x3bbea6=a65_0x1bd7a1;return a65_0x49fa67[_0x3bbea6(0x173)](getConfigDir(),_0x3bbea6(0x1a8));}function getProfileDir(_0x48b803){const _0x34ade6=a65_0x1bd7a1;return a65_0x49fa67[_0x34ade6(0x173)](getProfilesDir(),_0x48b803);}function getProfileConfigPath(_0x2398da){const _0x4aa860=a65_0x1bd7a1;return a65_0x49fa67[_0x4aa860(0x173)](getProfileDir(_0x2398da),_0x4aa860(0x1b9));}function getProfileEnvPath(_0x100646){const _0x4f157d=a65_0x1bd7a1;return a65_0x49fa67[_0x4f157d(0x173)](getProfileDir(_0x100646),'.env');}function getGlobalConfigPath(){const _0x750bb6=a65_0x1bd7a1;return a65_0x49fa67['join'](getConfigDir(),_0x750bb6(0x1b9));}function validateProfileName(_0x46ea11){const _0x95112a=a65_0x1bd7a1;if(/^@?[a-zA-Z0-9_-]+$/[_0x95112a(0x19e)](_0x46ea11))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x95112a(0x19e)](_0x46ea11))return;throw new Error(_0x95112a(0x179)+_0x46ea11+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.');}function validateProfileConfig(_0x58d81c,_0x48943b){const _0x4e5d56=a65_0x1bd7a1;if(typeof _0x58d81c!=='object'||_0x58d81c===null)throw new SDKError(ErrorCode[_0x4e5d56(0x1a5)],_0x4e5d56(0x1a2)+_0x48943b+_0x4e5d56(0x177));const _0x57ed0f=[_0x4e5d56(0x1b6),'site',_0x4e5d56(0x1a4),'parent_segment',_0x4e5d56(0x190),_0x4e5d56(0x1b1),_0x4e5d56(0x1b5),_0x4e5d56(0x19a)],_0x1dcced=_0x58d81c;for(const _0x247d92 of Object[_0x4e5d56(0x192)](_0x1dcced)){!_0x57ed0f[_0x4e5d56(0x1ba)](_0x247d92)&&console[_0x4e5d56(0x1ac)](_0x4e5d56(0x197)+_0x48943b+_0x4e5d56(0x184)+_0x247d92+_0x4e5d56(0x1ae));}const _0x1e901b=_0x57ed0f[_0x4e5d56(0x196)](_0x369396=>_0x369396!==_0x4e5d56(0x19a));for(const _0x486dca of _0x1e901b){if(_0x1dcced[_0x486dca]!==undefined&&typeof _0x1dcced[_0x486dca]!==_0x4e5d56(0x19d))throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],'Profile\x20\x27'+_0x48943b+'\x27:\x20\x27'+_0x486dca+_0x4e5d56(0x1a1));}return!![];}function loadProfilesFromTdxJson(_0x37af25,_0x4873c5){const _0x5b553a=a65_0x1bd7a1;if(!a65_0x6b1c53[_0x5b553a(0x180)](_0x37af25))return[];try{const _0x2a797e=a65_0x6b1c53[_0x5b553a(0x183)](_0x37af25,'utf-8'),_0xd35ccd=JSON['parse'](_0x2a797e);if(!_0xd35ccd[_0x5b553a(0x1a8)]||typeof _0xd35ccd['profiles']!=='object')return[];const _0x3c25f6=[];for(const [_0x24de9e,_0x47c1d6]of Object[_0x5b553a(0x1b3)](_0xd35ccd[_0x5b553a(0x1a8)])){try{validateProfileConfig(_0x47c1d6,_0x24de9e);const _0x1c87fa=getNewCredentialPath(_0x24de9e),_0x1ca63c=getOldCredentialPath(_0x24de9e),_0x442e45=a65_0x6b1c53[_0x5b553a(0x180)](_0x1c87fa)||a65_0x6b1c53[_0x5b553a(0x180)](_0x1ca63c);_0x3c25f6[_0x5b553a(0x1b0)]({'name':_0x24de9e,'config':_0x47c1d6,'metadata':{'name':_0x24de9e,'createdAt':new Date()[_0x5b553a(0x187)]()},'hasCredentials':_0x442e45,'scope':_0x4873c5});}catch(_0x5c2d31){_0x5c2d31 instanceof Error&&(console[_0x5b553a(0x1ac)](_0x5b553a(0x1aa)+_0x37af25+':'),console[_0x5b553a(0x1ac)]('\x20\x20'+_0x5c2d31[_0x5b553a(0x1be)]+'\x0a'));}}return _0x3c25f6;}catch(_0x23474f){return _0x23474f instanceof SyntaxError?(console[_0x5b553a(0x1ac)]('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x37af25+_0x5b553a(0x18a)),console['warn'](_0x5b553a(0x18e)+_0x23474f[_0x5b553a(0x1be)]+'\x0a')):console['warn'](_0x5b553a(0x1c0)+_0x37af25+':\x20'+_0x23474f+'\x0a'),[];}}export function getNewCredentialPath(_0x2d55bc){const _0x4da0a4=a65_0x1bd7a1;return a65_0x49fa67[_0x4da0a4(0x173)](getConfigDir(),_0x4da0a4(0x1b7)+_0x2d55bc);}function getOldCredentialPath(_0x7443df){const _0x17cfa3=a65_0x1bd7a1;return a65_0x49fa67[_0x17cfa3(0x173)](getProfilesDir(),_0x7443df,_0x17cfa3(0x1bc));}function loadProfilesFromTdxJsonFiles(){const _0x197c93=a65_0x1bd7a1,_0x10c4c4=[],_0x441134=findProjectConfigPath();_0x441134&&_0x10c4c4[_0x197c93(0x1b0)](...loadProfilesFromTdxJson(_0x441134,_0x197c93(0x1b4)));const _0x3d6b8f=a65_0x49fa67['join'](getConfigDir(),_0x197c93(0x1b9));return _0x10c4c4[_0x197c93(0x1b0)](...loadProfilesFromTdxJson(_0x3d6b8f,'user')),_0x10c4c4;}function loadProfilesFromDirectories(){const _0xdfefc1=a65_0x1bd7a1,_0x268998=getProfilesDir();if(!a65_0x6b1c53[_0xdfefc1(0x180)](_0x268998))return[];try{return a65_0x6b1c53[_0xdfefc1(0x1af)](_0x268998,{'withFileTypes':!![]})['filter'](_0x5beb61=>_0x5beb61[_0xdfefc1(0x17f)]())[_0xdfefc1(0x18c)](_0x3f004c=>_0x3f004c[_0xdfefc1(0x1a7)])[_0xdfefc1(0x196)](_0x5174ca=>{const _0x44872e=_0xdfefc1,_0x3789a8=getProfileConfigPath(_0x5174ca),_0x410200=getProfileEnvPath(_0x5174ca);return a65_0x6b1c53[_0x44872e(0x180)](_0x3789a8)||a65_0x6b1c53['existsSync'](_0x410200);})[_0xdfefc1(0x18c)](_0x320686=>{const _0x33b6fe=_0xdfefc1,_0xee2a46=loadProfileFromDirectory(_0x320686);if(_0xee2a46)return{..._0xee2a46,'scope':_0x33b6fe(0x1ad)};return null;})[_0xdfefc1(0x196)](_0xaf10bc=>_0xaf10bc!==null);}catch{return[];}}function loadProfileFromDirectory(_0x2f0fcf){const _0x310458=a65_0x1bd7a1,_0xab2933=getProfileConfigPath(_0x2f0fcf),_0x19027a=getOldCredentialPath(_0x2f0fcf);if(!a65_0x6b1c53[_0x310458(0x180)](_0xab2933)&&!a65_0x6b1c53[_0x310458(0x180)](_0x19027a))return null;let _0xb44abd={},_0x38947a={'name':_0x2f0fcf,'createdAt':new Date()[_0x310458(0x187)]()};if(a65_0x6b1c53['existsSync'](_0xab2933))try{const _0x589860=a65_0x6b1c53[_0x310458(0x183)](_0xab2933,_0x310458(0x1bb)),_0x344413=JSON[_0x310458(0x186)](_0x589860),{metadata:_0x244020,..._0x3f98f7}=_0x344413;_0xb44abd=_0x3f98f7,_0x244020&&(_0x38947a=_0x244020);}catch{}return{'name':_0x2f0fcf,'config':_0xb44abd,'metadata':_0x38947a,'hasCredentials':a65_0x6b1c53[_0x310458(0x180)](_0x19027a),'scope':_0x310458(0x1ad)};}export function listProfiles(){const _0x3b3561=a65_0x1bd7a1,_0x3ded53=loadProfilesFromTdxJsonFiles(),_0x1f1511=loadProfilesFromDirectories();if(_0x1f1511['length']>0x0){const _0x1b8a7c=_0x1f1511['map'](_0x49770c=>_0x49770c[_0x3b3561(0x1a7)])[_0x3b3561(0x173)](',\x20'),_0x29dee4=getConfigDir();console['warn'](_0x3b3561(0x17c)+_0x1b8a7c),console[_0x3b3561(0x1ac)](_0x3b3561(0x18b)),console['warn'](_0x3b3561(0x1c1)+a65_0x49fa67['join'](_0x29dee4,_0x3b3561(0x1b9))),console[_0x3b3561(0x1ac)](_0x3b3561(0x191)),console['warn']('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x2d82e1=[..._0x3ded53,..._0x1f1511],_0x53fd34=new Map();for(const _0x47edcc of _0x2d82e1){!_0x53fd34[_0x3b3561(0x175)](_0x47edcc[_0x3b3561(0x1a7)])&&_0x53fd34[_0x3b3561(0x172)](_0x47edcc[_0x3b3561(0x1a7)],_0x47edcc);}return Array[_0x3b3561(0x188)](_0x53fd34[_0x3b3561(0x1c2)]())[_0x3b3561(0x1bd)]((_0x37fa4c,_0x30e454)=>_0x37fa4c['name'][_0x3b3561(0x194)](_0x30e454[_0x3b3561(0x1a7)]));}export function profileExists(_0x4d81d7){const _0x3928b8=a65_0x1bd7a1,_0x2cad69=listProfiles();return _0x2cad69[_0x3928b8(0x1bf)](_0x1461f5=>_0x1461f5[_0x3928b8(0x1a7)]===_0x4d81d7);}export function loadProfile(_0x1098ab){const _0x4ea7a2=a65_0x1bd7a1;validateProfileName(_0x1098ab);const _0x11e1a4=listProfiles(),_0x420917=_0x11e1a4[_0x4ea7a2(0x199)](_0xe6a86d=>_0xe6a86d['name']===_0x1098ab);return _0x420917||null;}export function saveProfile(_0x288026,_0x257c52,_0x45b3e1=![]){saveProfileToUserConfig(_0x288026,_0x257c52);}export function deleteProfile(_0x43cf7e){const _0x1b8390=a65_0x1bd7a1;validateProfileName(_0x43cf7e);const _0xabff91=getProfileDir(_0x43cf7e);if(!a65_0x6b1c53['existsSync'](_0xabff91))throw new Error('Profile\x20'+_0x43cf7e+_0x1b8390(0x193));a65_0x6b1c53[_0x1b8390(0x195)](_0xabff91,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x4806d1,_0x447ffc){const _0x4c88e7=a65_0x1bd7a1;validateProfileName(_0x4806d1);const _0x4a6792=getGlobalConfigPath(),_0xa47ebc=getConfigDir();!a65_0x6b1c53['existsSync'](_0xa47ebc)&&createSecureDirectory(_0xa47ebc);let _0xc7c862={};if(a65_0x6b1c53[_0x4c88e7(0x180)](_0x4a6792))try{const _0x15de0b=a65_0x6b1c53[_0x4c88e7(0x183)](_0x4a6792,'utf-8');_0xc7c862=JSON[_0x4c88e7(0x186)](_0x15de0b);}catch{console[_0x4c88e7(0x1ac)](_0x4c88e7(0x1c3)+_0x4a6792+_0x4c88e7(0x1b2));}!_0xc7c862[_0x4c88e7(0x1a8)]&&(_0xc7c862[_0x4c88e7(0x1a8)]={}),_0xc7c862[_0x4c88e7(0x1a8)][_0x4806d1]=_0x447ffc,writeSecureFile(_0x4a6792,JSON[_0x4c88e7(0x1a0)](_0xc7c862,null,0x2));}export function removeProfileFromUserConfig(_0x59e6ef){const _0x275075=a65_0x1bd7a1;validateProfileName(_0x59e6ef);const _0x31f5bb=getGlobalConfigPath();if(!a65_0x6b1c53[_0x275075(0x180)](_0x31f5bb))throw new Error(_0x275075(0x1a2)+_0x59e6ef+_0x275075(0x17a));let _0x19a4f7={};try{const _0x34348c=a65_0x6b1c53['readFileSync'](_0x31f5bb,_0x275075(0x1bb));_0x19a4f7=JSON[_0x275075(0x186)](_0x34348c);}catch{throw new Error(_0x275075(0x174)+_0x31f5bb);}if(!_0x19a4f7[_0x275075(0x1a8)]||!_0x19a4f7[_0x275075(0x1a8)][_0x59e6ef])throw new Error(_0x275075(0x1a2)+_0x59e6ef+'\x27\x20not\x20found\x20in\x20user\x20configuration');delete _0x19a4f7[_0x275075(0x1a8)][_0x59e6ef],_0x19a4f7[_0x275075(0x19b)]===_0x59e6ef&&delete _0x19a4f7[_0x275075(0x19b)],writeSecureFile(_0x31f5bb,JSON['stringify'](_0x19a4f7,null,0x2));}export function getActiveProfile(){const _0x4270d2=a65_0x1bd7a1,_0x3fd5d0=loadSessionContext();if(_0x3fd5d0?.['profile'])return _0x3fd5d0[_0x4270d2(0x19b)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x3831cb=getGlobalConfigPath();if(!a65_0x6b1c53[_0x4270d2(0x180)](_0x3831cb))return null;try{const _0x25b1a7=a65_0x6b1c53[_0x4270d2(0x183)](_0x3831cb,'utf-8'),_0x21bb5c=JSON[_0x4270d2(0x186)](_0x25b1a7);return _0x21bb5c[_0x4270d2(0x19b)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x596b42){const _0x5cf0ca=a65_0x1bd7a1,_0x3cc33f=getGlobalConfigPath(),_0x2c72c8=getConfigDir();!a65_0x6b1c53['existsSync'](_0x2c72c8)&&createSecureDirectory(_0x2c72c8);let _0x2d9de7={};if(a65_0x6b1c53['existsSync'](_0x3cc33f))try{const _0xe236a3=a65_0x6b1c53[_0x5cf0ca(0x183)](_0x3cc33f,_0x5cf0ca(0x1bb));_0x2d9de7=JSON['parse'](_0xe236a3);}catch{console[_0x5cf0ca(0x1ac)](_0x5cf0ca(0x1c3)+_0x3cc33f+_0x5cf0ca(0x1b2));}_0x2d9de7[_0x5cf0ca(0x178)]=_0x596b42,writeSecureFile(_0x3cc33f,JSON[_0x5cf0ca(0x1a0)](_0x2d9de7,null,0x2));}export function saveActiveProfileToUserConfig(_0x25d653){const _0x4c851b=a65_0x1bd7a1;validateProfileName(_0x25d653);const _0xe6459e=getGlobalConfigPath(),_0x1ef6b0=getConfigDir();!a65_0x6b1c53[_0x4c851b(0x180)](_0x1ef6b0)&&createSecureDirectory(_0x1ef6b0);let _0x189acb={};if(a65_0x6b1c53['existsSync'](_0xe6459e))try{const _0x3ed63e=a65_0x6b1c53[_0x4c851b(0x183)](_0xe6459e,_0x4c851b(0x1bb));_0x189acb=JSON[_0x4c851b(0x186)](_0x3ed63e);}catch{console[_0x4c851b(0x1ac)](_0x4c851b(0x1c3)+_0xe6459e+_0x4c851b(0x1b2));}_0x189acb[_0x4c851b(0x19b)]=_0x25d653,writeSecureFile(_0xe6459e,JSON[_0x4c851b(0x1a0)](_0x189acb,null,0x2));}function clearFieldFromUserConfig(_0x5628a8){const _0x13436f=a65_0x1bd7a1,_0x15d87e=getGlobalConfigPath();if(!a65_0x6b1c53[_0x13436f(0x180)](_0x15d87e))return;let _0x3d33c5={};try{const _0x8ef919=a65_0x6b1c53[_0x13436f(0x183)](_0x15d87e,_0x13436f(0x1bb));_0x3d33c5=JSON[_0x13436f(0x186)](_0x8ef919);}catch{return;}delete _0x3d33c5[_0x5628a8],writeSecureFile(_0x15d87e,JSON[_0x13436f(0x1a0)](_0x3d33c5,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x2b3a24=a65_0x1bd7a1;clearFieldFromUserConfig(_0x2b3a24(0x178));}export function clearActiveProfileFromUserConfig(){clearFieldFromUserConfig('profile');}export function createProfile(_0x273f45,_0x5ac790){const _0x7ffe70=a65_0x1bd7a1;validateProfileName(_0x273f45);if(profileExists(_0x273f45))throw new Error(_0x7ffe70(0x1ab)+_0x273f45+_0x7ffe70(0x1b8));saveProfile(_0x273f45,_0x5ac790);}export function saveProfileCredentials(_0x25b849,_0x455c23){const _0x2a8c14=a65_0x1bd7a1;validateProfileName(_0x25b849);if(!profileExists(_0x25b849))throw new Error(_0x2a8c14(0x1ab)+_0x25b849+_0x2a8c14(0x193));const _0x5af0b8=getNewCredentialPath(_0x25b849);writeSecureFile(_0x5af0b8,_0x455c23);}export function loadProfileCredentials(_0x40dcf4){const _0x3c84dc=a65_0x1bd7a1;validateProfileName(_0x40dcf4);const _0x37fc7c=getNewCredentialPath(_0x40dcf4);if(a65_0x6b1c53[_0x3c84dc(0x180)](_0x37fc7c))try{return a65_0x6b1c53[_0x3c84dc(0x183)](_0x37fc7c,_0x3c84dc(0x1bb));}catch{}const _0x14273b=getOldCredentialPath(_0x40dcf4);if(a65_0x6b1c53[_0x3c84dc(0x180)](_0x14273b)){console[_0x3c84dc(0x1ac)](_0x3c84dc(0x17b)+_0x40dcf4+'\x27'),console[_0x3c84dc(0x1ac)](_0x3c84dc(0x1a3)),console[_0x3c84dc(0x1ac)](_0x3c84dc(0x19c)+_0x14273b+_0x3c84dc(0x176)+_0x37fc7c+'\x22'),console[_0x3c84dc(0x1ac)](_0x3c84dc(0x182));try{return a65_0x6b1c53[_0x3c84dc(0x183)](_0x14273b,_0x3c84dc(0x1bb));}catch{return null;}}return null;}
1
+ (function(_0x264a03,_0x3e489b){const _0x2e792d=a65_0x4e76,_0x2e7c5d=_0x264a03();while(!![]){try{const _0x543d7d=parseInt(_0x2e792d(0xfa))/0x1*(-parseInt(_0x2e792d(0x103))/0x2)+parseInt(_0x2e792d(0xe2))/0x3*(-parseInt(_0x2e792d(0xe4))/0x4)+parseInt(_0x2e792d(0xcd))/0x5*(-parseInt(_0x2e792d(0xee))/0x6)+-parseInt(_0x2e792d(0xd0))/0x7+-parseInt(_0x2e792d(0xcb))/0x8*(parseInt(_0x2e792d(0xd6))/0x9)+parseInt(_0x2e792d(0xdd))/0xa+parseInt(_0x2e792d(0xe1))/0xb;if(_0x543d7d===_0x3e489b)break;else _0x2e7c5d['push'](_0x2e7c5d['shift']());}catch(_0x55ed9a){_0x2e7c5d['push'](_0x2e7c5d['shift']());}}}(a65_0x1b25,0x50ee5));import*as a65_0x5ae30d from'node:fs';import*as a65_0x57c52d from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getConfigDir}from'./config.js';function a65_0x4e76(_0x17e4de,_0x2072d0){_0x17e4de=_0x17e4de-0xbb;const _0x1b250c=a65_0x1b25();let _0x4e7666=_0x1b250c[_0x17e4de];return _0x4e7666;}import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME='@tdx-studio';function a65_0x1b25(){const _0x18b2ca=['readFileSync','4786929TxxbjK','existsSync','includes','keys','name','map','Warning:\x20Profile\x20\x27','6172510ylkrKt','Profile\x20\x27','localeCompare','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','18407158ALQyav','328794ryFhiN','account_name','12VrWMeE','some',',\x20creating\x20new\x20file','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','.env','entries','string','set','tdx.json','toISOString','858jShUzp','test','\x27\x20will\x20be\x20ignored','database','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','\x27:\x20unknown\x20config\x20key\x20\x27','user_info','llm_agent','profiles','\x27:\x20\x27','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','sort','12997nkyiwm','llm_project','find','\x0aWarning:\x20Failed\x20to\x20parse\x20','utf-8','\x27\x20not\x20found\x20in\x20user\x20configuration','\x20\x201.\x20Edit:\x20','rmSync','parse','82WwovEd','\x27\x20must\x20be\x20a\x20string','values','push','.env.','\x20already\x20exists','\x27:\x20config\x20must\x20be\x20an\x20object','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','stringify','Profile\x20','filter','description','warn','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','Failed\x20to\x20parse\x20','user','message','profile','site','object','INVALID_PROFILE_CONFIG','join','parent_segment','Error:\x20','8NSNXGG','\x22\x20\x22','18145kNXkOq','\x20\x20mv\x20\x22','Warning:\x20Failed\x20to\x20parse\x20','326459NCLGUS','To\x20migrate:','directory','local','length'];a65_0x1b25=function(){return _0x18b2ca;};return a65_0x1b25();}export function getProfileParams(_0x562fe9){const _0x39c472=a65_0x4e76,_0x3b3f9c={};if(!_0x562fe9)return _0x3b3f9c;for(const [_0x5deaa1,_0x2c1ebd]of Object[_0x39c472(0xe9)](_0x562fe9)){_0x5deaa1!==_0x39c472(0xbe)&&_0x2c1ebd!==undefined&&(_0x3b3f9c[_0x5deaa1]=_0x2c1ebd);}return _0x3b3f9c;}export function getProfilesDir(){const _0x22d672=a65_0x4e76;return a65_0x57c52d[_0x22d672(0xc8)](getConfigDir(),'profiles');}function getProfileDir(_0x13e1c1){const _0x51bebb=a65_0x4e76;return a65_0x57c52d[_0x51bebb(0xc8)](getProfilesDir(),_0x13e1c1);}function getProfileConfigPath(_0xb9d1c4){const _0x3c0367=a65_0x4e76;return a65_0x57c52d[_0x3c0367(0xc8)](getProfileDir(_0xb9d1c4),_0x3c0367(0xec));}function getProfileEnvPath(_0x5402df){const _0x23ec63=a65_0x4e76;return a65_0x57c52d[_0x23ec63(0xc8)](getProfileDir(_0x5402df),_0x23ec63(0xe8));}function getGlobalConfigPath(){const _0x14112e=a65_0x4e76;return a65_0x57c52d[_0x14112e(0xc8)](getConfigDir(),_0x14112e(0xec));}function validateProfileName(_0x382b0a){const _0x185588=a65_0x4e76;if(/^@?[a-zA-Z0-9_-]+$/[_0x185588(0xef)](_0x382b0a))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x185588(0xef)](_0x382b0a))return;throw new Error('Invalid\x20profile\x20name:\x20'+_0x382b0a+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.');}function validateProfileConfig(_0x2b83a2,_0x3e5d7a){const _0x35ea59=a65_0x4e76;if(typeof _0x2b83a2!==_0x35ea59(0xc6)||_0x2b83a2===null)throw new SDKError(ErrorCode[_0x35ea59(0xc7)],'Profile\x20\x27'+_0x3e5d7a+_0x35ea59(0x109));const _0x3c9907=[_0x35ea59(0xbe),_0x35ea59(0xc5),_0x35ea59(0xf1),_0x35ea59(0xc9),_0x35ea59(0xfb),_0x35ea59(0xf5),_0x35ea59(0xe3),_0x35ea59(0xf4)],_0x257298=_0x2b83a2;for(const _0x344688 of Object[_0x35ea59(0xd9)](_0x257298)){!_0x3c9907[_0x35ea59(0xd8)](_0x344688)&&console['warn'](_0x35ea59(0xdc)+_0x3e5d7a+_0x35ea59(0xf3)+_0x344688+_0x35ea59(0xf0));}const _0x102c07=_0x3c9907[_0x35ea59(0xbd)](_0x2e0d02=>_0x2e0d02!==_0x35ea59(0xf4));for(const _0x24b290 of _0x102c07){if(_0x257298[_0x24b290]!==undefined&&typeof _0x257298[_0x24b290]!==_0x35ea59(0xea))throw new SDKError(ErrorCode[_0x35ea59(0xc7)],_0x35ea59(0xde)+_0x3e5d7a+_0x35ea59(0xf7)+_0x24b290+_0x35ea59(0x104));}return!![];}function loadProfilesFromTdxJson(_0x114ce8,_0x5e0fe4){const _0x2581b4=a65_0x4e76;if(!a65_0x5ae30d['existsSync'](_0x114ce8))return[];try{const _0x491998=a65_0x5ae30d['readFileSync'](_0x114ce8,_0x2581b4(0xfe)),_0x9c996b=JSON['parse'](_0x491998);if(!_0x9c996b[_0x2581b4(0xf6)]||typeof _0x9c996b['profiles']!=='object')return[];const _0x2d7594=[];for(const [_0xc99c6e,_0x13be96]of Object['entries'](_0x9c996b[_0x2581b4(0xf6)])){try{validateProfileConfig(_0x13be96,_0xc99c6e);const _0x198978=getNewCredentialPath(_0xc99c6e),_0x3ce1e9=getOldCredentialPath(_0xc99c6e),_0x42d525=a65_0x5ae30d[_0x2581b4(0xd7)](_0x198978)||a65_0x5ae30d[_0x2581b4(0xd7)](_0x3ce1e9);_0x2d7594[_0x2581b4(0x106)]({'name':_0xc99c6e,'config':_0x13be96,'metadata':{'name':_0xc99c6e,'createdAt':new Date()[_0x2581b4(0xed)]()},'hasCredentials':_0x42d525,'scope':_0x5e0fe4});}catch(_0x13790b){_0x13790b instanceof Error&&(console[_0x2581b4(0xbf)](_0x2581b4(0xf2)+_0x114ce8+':'),console[_0x2581b4(0xbf)]('\x20\x20'+_0x13790b[_0x2581b4(0xc3)]+'\x0a'));}}return _0x2d7594;}catch(_0x10a338){return _0x10a338 instanceof SyntaxError?(console['warn'](_0x2581b4(0xfd)+_0x114ce8+':\x20Invalid\x20JSON\x20syntax'),console[_0x2581b4(0xbf)](_0x2581b4(0xca)+_0x10a338[_0x2581b4(0xc3)]+'\x0a')):console['warn']('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x114ce8+':\x20'+_0x10a338+'\x0a'),[];}}export function getNewCredentialPath(_0x2b5534){const _0xe2359e=a65_0x4e76;return a65_0x57c52d['join'](getConfigDir(),_0xe2359e(0x107)+_0x2b5534);}function getOldCredentialPath(_0x2172f6){const _0x4eacb7=a65_0x4e76;return a65_0x57c52d['join'](getProfilesDir(),_0x2172f6,_0x4eacb7(0xe8));}function loadProfilesFromTdxJsonFiles(){const _0x3d4434=a65_0x4e76,_0x493105=[],_0x2558c7=findProjectConfigPath();_0x2558c7&&_0x493105['push'](...loadProfilesFromTdxJson(_0x2558c7,_0x3d4434(0xd3)));const _0x191eed=a65_0x57c52d['join'](getConfigDir(),_0x3d4434(0xec));return _0x493105[_0x3d4434(0x106)](...loadProfilesFromTdxJson(_0x191eed,_0x3d4434(0xc2))),_0x493105;}function loadProfilesFromDirectories(){const _0x3a7aa5=a65_0x4e76,_0x3bcac1=getProfilesDir();if(!a65_0x5ae30d['existsSync'](_0x3bcac1))return[];try{return a65_0x5ae30d['readdirSync'](_0x3bcac1,{'withFileTypes':!![]})[_0x3a7aa5(0xbd)](_0x5f04e0=>_0x5f04e0['isDirectory']())[_0x3a7aa5(0xdb)](_0x3f93e2=>_0x3f93e2[_0x3a7aa5(0xda)])[_0x3a7aa5(0xbd)](_0x4c750c=>{const _0x2c5f65=_0x3a7aa5,_0x13e1a8=getProfileConfigPath(_0x4c750c),_0x253bea=getProfileEnvPath(_0x4c750c);return a65_0x5ae30d[_0x2c5f65(0xd7)](_0x13e1a8)||a65_0x5ae30d['existsSync'](_0x253bea);})[_0x3a7aa5(0xdb)](_0x21ec41=>{const _0xe5383e=loadProfileFromDirectory(_0x21ec41);if(_0xe5383e)return{..._0xe5383e,'scope':'directory'};return null;})[_0x3a7aa5(0xbd)](_0x269e83=>_0x269e83!==null);}catch{return[];}}function loadProfileFromDirectory(_0x1ee5fd){const _0x5dd226=a65_0x4e76,_0x143960=getProfileConfigPath(_0x1ee5fd),_0x67c165=getOldCredentialPath(_0x1ee5fd);if(!a65_0x5ae30d[_0x5dd226(0xd7)](_0x143960)&&!a65_0x5ae30d['existsSync'](_0x67c165))return null;let _0x5d3336={},_0x5426b4={'name':_0x1ee5fd,'createdAt':new Date()[_0x5dd226(0xed)]()};if(a65_0x5ae30d[_0x5dd226(0xd7)](_0x143960))try{const _0x5e9147=a65_0x5ae30d[_0x5dd226(0xd5)](_0x143960,_0x5dd226(0xfe)),_0x22400a=JSON[_0x5dd226(0x102)](_0x5e9147),{metadata:_0x1bd50f,..._0x149a15}=_0x22400a;_0x5d3336=_0x149a15,_0x1bd50f&&(_0x5426b4=_0x1bd50f);}catch{}return{'name':_0x1ee5fd,'config':_0x5d3336,'metadata':_0x5426b4,'hasCredentials':a65_0x5ae30d[_0x5dd226(0xd7)](_0x67c165),'scope':_0x5dd226(0xd2)};}export function listProfiles(){const _0x2c5db4=a65_0x4e76,_0xb15d22=loadProfilesFromTdxJsonFiles(),_0x426f1f=loadProfilesFromDirectories();if(_0x426f1f[_0x2c5db4(0xd4)]>0x0){const _0x39ae6d=_0x426f1f[_0x2c5db4(0xdb)](_0x488062=>_0x488062[_0x2c5db4(0xda)])[_0x2c5db4(0xc8)](',\x20'),_0x474ae8=getConfigDir();console[_0x2c5db4(0xbf)](_0x2c5db4(0xc0)+_0x39ae6d),console[_0x2c5db4(0xbf)]('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console['warn'](_0x2c5db4(0x100)+a65_0x57c52d[_0x2c5db4(0xc8)](_0x474ae8,'tdx.json')),console[_0x2c5db4(0xbf)](_0x2c5db4(0xf8)),console[_0x2c5db4(0xbf)](_0x2c5db4(0xe0));}const _0x5e3a5f=[..._0xb15d22,..._0x426f1f],_0x4dbe68=new Map();for(const _0x4256da of _0x5e3a5f){!_0x4dbe68['has'](_0x4256da['name'])&&_0x4dbe68[_0x2c5db4(0xeb)](_0x4256da[_0x2c5db4(0xda)],_0x4256da);}return Array['from'](_0x4dbe68[_0x2c5db4(0x105)]())[_0x2c5db4(0xf9)]((_0x4938d3,_0x1677d6)=>_0x4938d3['name'][_0x2c5db4(0xdf)](_0x1677d6['name']));}export function profileExists(_0x28b460){const _0xe33556=a65_0x4e76,_0x305bed=listProfiles();return _0x305bed[_0xe33556(0xe5)](_0x10e240=>_0x10e240['name']===_0x28b460);}export function loadProfile(_0x3363cd){const _0x348409=a65_0x4e76;validateProfileName(_0x3363cd);const _0x284f14=listProfiles(),_0xe9bb12=_0x284f14[_0x348409(0xfc)](_0x540f15=>_0x540f15[_0x348409(0xda)]===_0x3363cd);return _0xe9bb12||null;}export function saveProfile(_0x5c5507,_0x24ad40,_0x27b368=![]){saveProfileToUserConfig(_0x5c5507,_0x24ad40);}export function deleteProfile(_0x324dec){const _0x20dc23=a65_0x4e76;validateProfileName(_0x324dec);const _0x32af3d=getProfileDir(_0x324dec);if(!a65_0x5ae30d[_0x20dc23(0xd7)](_0x32af3d))throw new Error(_0x20dc23(0xbc)+_0x324dec+'\x20does\x20not\x20exist');a65_0x5ae30d[_0x20dc23(0x101)](_0x32af3d,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x4da13e,_0x27b8fd){const _0x55b4ba=a65_0x4e76;validateProfileName(_0x4da13e);const _0x1c2ebb=getGlobalConfigPath(),_0x7a3560=getConfigDir();!a65_0x5ae30d[_0x55b4ba(0xd7)](_0x7a3560)&&createSecureDirectory(_0x7a3560);let _0x24eb75={};if(a65_0x5ae30d['existsSync'](_0x1c2ebb))try{const _0x2c1174=a65_0x5ae30d['readFileSync'](_0x1c2ebb,_0x55b4ba(0xfe));_0x24eb75=JSON[_0x55b4ba(0x102)](_0x2c1174);}catch{console[_0x55b4ba(0xbf)](_0x55b4ba(0xcf)+_0x1c2ebb+_0x55b4ba(0xe6));}!_0x24eb75[_0x55b4ba(0xf6)]&&(_0x24eb75['profiles']={}),_0x24eb75['profiles'][_0x4da13e]=_0x27b8fd,writeSecureFile(_0x1c2ebb,JSON['stringify'](_0x24eb75,null,0x2));}export function removeProfileFromUserConfig(_0x1791b2){const _0x147109=a65_0x4e76;validateProfileName(_0x1791b2);const _0xf928fe=getGlobalConfigPath();if(!a65_0x5ae30d[_0x147109(0xd7)](_0xf928fe))throw new Error('Profile\x20\x27'+_0x1791b2+_0x147109(0xff));let _0x5ce676={};try{const _0x41e08f=a65_0x5ae30d[_0x147109(0xd5)](_0xf928fe,_0x147109(0xfe));_0x5ce676=JSON[_0x147109(0x102)](_0x41e08f);}catch{throw new Error(_0x147109(0xc1)+_0xf928fe);}if(!_0x5ce676[_0x147109(0xf6)]||!_0x5ce676[_0x147109(0xf6)][_0x1791b2])throw new Error('Profile\x20\x27'+_0x1791b2+_0x147109(0xff));delete _0x5ce676[_0x147109(0xf6)][_0x1791b2],_0x5ce676['profile']===_0x1791b2&&delete _0x5ce676[_0x147109(0xc4)],writeSecureFile(_0xf928fe,JSON['stringify'](_0x5ce676,null,0x2));}export function getActiveProfile(){const _0x37eb8f=a65_0x4e76,_0x1b4064=loadSessionContext();if(_0x1b4064?.['profile'])return _0x1b4064['profile'];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x2d580f=getGlobalConfigPath();if(!a65_0x5ae30d[_0x37eb8f(0xd7)](_0x2d580f))return null;try{const _0xe24dfd=a65_0x5ae30d['readFileSync'](_0x2d580f,'utf-8'),_0x80e354=JSON[_0x37eb8f(0x102)](_0xe24dfd);return _0x80e354[_0x37eb8f(0xc4)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x44fd8b){const _0x4ace1b=a65_0x4e76,_0x8691c6=getGlobalConfigPath(),_0x197ced=getConfigDir();!a65_0x5ae30d['existsSync'](_0x197ced)&&createSecureDirectory(_0x197ced);let _0x3f9279={};if(a65_0x5ae30d[_0x4ace1b(0xd7)](_0x8691c6))try{const _0xf75dd4=a65_0x5ae30d[_0x4ace1b(0xd5)](_0x8691c6,_0x4ace1b(0xfe));_0x3f9279=JSON[_0x4ace1b(0x102)](_0xf75dd4);}catch{console[_0x4ace1b(0xbf)](_0x4ace1b(0xcf)+_0x8691c6+_0x4ace1b(0xe6));}_0x3f9279['site']=_0x44fd8b,writeSecureFile(_0x8691c6,JSON[_0x4ace1b(0xbb)](_0x3f9279,null,0x2));}export function saveActiveProfileToUserConfig(_0x4819b4){const _0x44a845=a65_0x4e76;validateProfileName(_0x4819b4);const _0x1579a0=getGlobalConfigPath(),_0x566866=getConfigDir();!a65_0x5ae30d[_0x44a845(0xd7)](_0x566866)&&createSecureDirectory(_0x566866);let _0x342416={};if(a65_0x5ae30d['existsSync'](_0x1579a0))try{const _0x3931b0=a65_0x5ae30d[_0x44a845(0xd5)](_0x1579a0,_0x44a845(0xfe));_0x342416=JSON[_0x44a845(0x102)](_0x3931b0);}catch{console[_0x44a845(0xbf)](_0x44a845(0xcf)+_0x1579a0+_0x44a845(0xe6));}_0x342416[_0x44a845(0xc4)]=_0x4819b4,writeSecureFile(_0x1579a0,JSON[_0x44a845(0xbb)](_0x342416,null,0x2));}function clearFieldFromUserConfig(_0x14b64e){const _0x402d81=a65_0x4e76,_0x4fe876=getGlobalConfigPath();if(!a65_0x5ae30d[_0x402d81(0xd7)](_0x4fe876))return;let _0x52264d={};try{const _0x3a7d41=a65_0x5ae30d[_0x402d81(0xd5)](_0x4fe876,_0x402d81(0xfe));_0x52264d=JSON[_0x402d81(0x102)](_0x3a7d41);}catch{return;}delete _0x52264d[_0x14b64e],writeSecureFile(_0x4fe876,JSON[_0x402d81(0xbb)](_0x52264d,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x3f9b0b=a65_0x4e76;clearFieldFromUserConfig(_0x3f9b0b(0xc5));}export function clearActiveProfileFromUserConfig(){const _0x2c0e82=a65_0x4e76;clearFieldFromUserConfig(_0x2c0e82(0xc4));}export function createProfile(_0x336d6e,_0x512f4b){const _0x24169d=a65_0x4e76;validateProfileName(_0x336d6e);if(profileExists(_0x336d6e))throw new Error(_0x24169d(0xbc)+_0x336d6e+_0x24169d(0x108));saveProfile(_0x336d6e,_0x512f4b);}export function saveProfileCredentials(_0xdd3592,_0x61b673){validateProfileName(_0xdd3592);if(!profileExists(_0xdd3592))throw new Error('Profile\x20'+_0xdd3592+'\x20does\x20not\x20exist');const _0x250f19=getNewCredentialPath(_0xdd3592);writeSecureFile(_0x250f19,_0x61b673);}export function loadProfileCredentials(_0x3d596c){const _0x33a6ea=a65_0x4e76;validateProfileName(_0x3d596c);const _0x85564f=getNewCredentialPath(_0x3d596c);if(a65_0x5ae30d[_0x33a6ea(0xd7)](_0x85564f))try{return a65_0x5ae30d[_0x33a6ea(0xd5)](_0x85564f,'utf-8');}catch{}const _0x27597f=getOldCredentialPath(_0x3d596c);if(a65_0x5ae30d[_0x33a6ea(0xd7)](_0x27597f)){console[_0x33a6ea(0xbf)](_0x33a6ea(0xe7)+_0x3d596c+'\x27'),console[_0x33a6ea(0xbf)](_0x33a6ea(0xd1)),console[_0x33a6ea(0xbf)](_0x33a6ea(0xce)+_0x27597f+_0x33a6ea(0xcc)+_0x85564f+'\x22'),console['warn'](_0x33a6ea(0x10a));try{return a65_0x5ae30d[_0x33a6ea(0xd5)](_0x27597f,'utf-8');}catch{return null;}}return null;}
@@ -1 +1 @@
1
- const a66_0x4f6beb=a66_0x3d24;function a66_0x3cb1(){const _0x1e82d4=['api_key','2xeidPF','887184cLzbLc','includes','11301hHvtyE','Failed\x20to\x20load\x20project\x20config\x20from\x20','join','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','cwd','existsSync','parse','24225AWJycg','\x20is\x20ignored.\x20','apiKey','TD_API_KEY','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','ENOENT','1204154GUGbKO','writeFileSync','400124rZsNjC','utf-8','6nZRDpc','profile','183672lhfnwi','dirname','tdx.json',').\x20','warn','stringify','220317BfMsjb','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','Warning:\x20\x27profile\x27\x20field\x20in\x20'];a66_0x3cb1=function(){return _0x1e82d4;};return a66_0x3cb1();}function a66_0x3d24(_0x5e587a,_0x1aa60c){_0x5e587a=_0x5e587a-0x1d9;const _0x3cb15e=a66_0x3cb1();let _0x3d2400=_0x3cb15e[_0x5e587a];return _0x3d2400;}(function(_0x30b6d3,_0x540d4f){const _0x20524c=a66_0x3d24,_0x2b00c1=_0x30b6d3();while(!![]){try{const _0x2783a0=parseInt(_0x20524c(0x1f4))/0x1*(-parseInt(_0x20524c(0x1f1))/0x2)+-parseInt(_0x20524c(0x1ed))/0x3+parseInt(_0x20524c(0x1e3))/0x4+parseInt(_0x20524c(0x1db))/0x5+parseInt(_0x20524c(0x1e5))/0x6*(parseInt(_0x20524c(0x1e1))/0x7)+-parseInt(_0x20524c(0x1f2))/0x8+parseInt(_0x20524c(0x1e7))/0x9;if(_0x2783a0===_0x540d4f)break;else _0x2b00c1['push'](_0x2b00c1['shift']());}catch(_0x3a47eb){_0x2b00c1['push'](_0x2b00c1['shift']());}}}(a66_0x3cb1,0x18d24));import*as a66_0x40570d from'node:fs';import*as a66_0x261031 from'node:path';const PROJECT_CONFIG_FILENAME=a66_0x4f6beb(0x1e9);export function findProjectConfigPath(_0x230e54){const _0x305224=a66_0x4f6beb;let _0x34b089=_0x230e54||process[_0x305224(0x1f8)]();while(!![]){const _0xebb58f=a66_0x261031[_0x305224(0x1f6)](_0x34b089,PROJECT_CONFIG_FILENAME);if(a66_0x40570d[_0x305224(0x1d9)](_0xebb58f))return _0xebb58f;const _0x30b7bf=a66_0x261031[_0x305224(0x1e8)](_0x34b089);if(_0x30b7bf===_0x34b089)return null;_0x34b089=_0x30b7bf;}}export function loadProjectConfig(_0x2350d9){const _0x28c45e=a66_0x4f6beb,_0x347c34=findProjectConfigPath(_0x2350d9);if(!_0x347c34)return null;try{const _0x45ac64=a66_0x40570d['readFileSync'](_0x347c34,_0x28c45e(0x1e4)),_0x14c41c=JSON[_0x28c45e(0x1da)](_0x45ac64),_0x2cf256=JSON[_0x28c45e(0x1ec)](_0x14c41c);if(_0x2cf256[_0x28c45e(0x1f3)]('TD_API_KEY')||_0x2cf256[_0x28c45e(0x1f3)](_0x28c45e(0x1dd))||_0x2cf256[_0x28c45e(0x1f3)](_0x28c45e(0x1f0)))throw new Error(_0x28c45e(0x1f7)+_0x347c34+_0x28c45e(0x1ea)+_0x28c45e(0x1ee));const {metadata:_0x415862,profile:_0x563dee,..._0x54d4c5}=_0x14c41c;return _0x563dee&&console[_0x28c45e(0x1eb)](_0x28c45e(0x1ef)+_0x347c34+_0x28c45e(0x1dc)+'Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'),_0x54d4c5;}catch(_0x47cc58){if(_0x47cc58 instanceof Error&&'code'in _0x47cc58&&_0x47cc58['code']===_0x28c45e(0x1e0))return null;throw new Error(_0x28c45e(0x1f5)+_0x347c34+':\x20'+_0x47cc58);}}export function saveProjectConfig(_0x2989fc,_0x390fea){const _0x198bd1=a66_0x4f6beb,_0x33b8bc=_0x390fea||process[_0x198bd1(0x1f8)](),_0x16d35f=a66_0x261031['join'](_0x33b8bc,PROJECT_CONFIG_FILENAME),_0x2f10f5=JSON[_0x198bd1(0x1ec)](_0x2989fc);if(_0x2f10f5['includes'](_0x198bd1(0x1de))||_0x2f10f5[_0x198bd1(0x1f3)](_0x198bd1(0x1dd))||_0x2f10f5[_0x198bd1(0x1f3)](_0x198bd1(0x1f0)))throw new Error(_0x198bd1(0x1df));if(_0x198bd1(0x1e6)in _0x2989fc)throw new Error('\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.');a66_0x40570d[_0x198bd1(0x1e2)](_0x16d35f,JSON[_0x198bd1(0x1ec)](_0x2989fc,null,0x2));}export function hasProjectConfig(_0x4456ed){return findProjectConfigPath(_0x4456ed)!==null;}export function getProjectRoot(_0x3c97ac){const _0x4a3a1a=a66_0x4f6beb,_0xf0f83f=findProjectConfigPath(_0x3c97ac);return _0xf0f83f?a66_0x261031[_0x4a3a1a(0x1e8)](_0xf0f83f):null;}
1
+ const a66_0x4b0b07=a66_0x22c4;(function(_0x47edef,_0x2e64bb){const _0x2b5bc0=a66_0x22c4,_0x1dbda0=_0x47edef();while(!![]){try{const _0xe8d5b3=parseInt(_0x2b5bc0(0x1e7))/0x1*(-parseInt(_0x2b5bc0(0x1ed))/0x2)+parseInt(_0x2b5bc0(0x1f8))/0x3*(parseInt(_0x2b5bc0(0x1e1))/0x4)+parseInt(_0x2b5bc0(0x1eb))/0x5+parseInt(_0x2b5bc0(0x1db))/0x6*(-parseInt(_0x2b5bc0(0x1dd))/0x7)+-parseInt(_0x2b5bc0(0x1f7))/0x8*(parseInt(_0x2b5bc0(0x1f6))/0x9)+parseInt(_0x2b5bc0(0x1e4))/0xa+parseInt(_0x2b5bc0(0x1f4))/0xb;if(_0xe8d5b3===_0x2e64bb)break;else _0x1dbda0['push'](_0x1dbda0['shift']());}catch(_0x19f82b){_0x1dbda0['push'](_0x1dbda0['shift']());}}}(a66_0x2005,0x99c03));import*as a66_0x112432 from'node:fs';import*as a66_0x24e25e from'node:path';const PROJECT_CONFIG_FILENAME=a66_0x4b0b07(0x1ef);export function findProjectConfigPath(_0x8331cc){const _0xd325b0=a66_0x4b0b07;let _0x4fc8da=_0x8331cc||process[_0xd325b0(0x1ee)]();while(!![]){const _0x12c32b=a66_0x24e25e[_0xd325b0(0x1f9)](_0x4fc8da,PROJECT_CONFIG_FILENAME);if(a66_0x112432[_0xd325b0(0x1f2)](_0x12c32b))return _0x12c32b;const _0x3167eb=a66_0x24e25e['dirname'](_0x4fc8da);if(_0x3167eb===_0x4fc8da)return null;_0x4fc8da=_0x3167eb;}}function a66_0x2005(){const _0x1c3b13=['\x20is\x20ignored.\x20','10687800jmnMYN','writeFileSync','dirname','1248545tBxxOD','readFileSync','code','utf-8','690880MwIbjF','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','2vznlbs','cwd','tdx.json','Warning:\x20\x27profile\x27\x20field\x20in\x20','parse','existsSync','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','9031429JbAskK','TD_API_KEY','9TXvXns','436984DhtRDR','968043ZAPeLo','join','ENOENT','profile','2506470cHaPTc','warn','7zoTCMi','api_key','includes','Failed\x20to\x20load\x20project\x20config\x20from\x20','4oYyVqw','stringify'];a66_0x2005=function(){return _0x1c3b13;};return a66_0x2005();}function a66_0x22c4(_0x5cfe16,_0x128c52){_0x5cfe16=_0x5cfe16-0x1da;const _0x200584=a66_0x2005();let _0x22c4b2=_0x200584[_0x5cfe16];return _0x22c4b2;}export function loadProjectConfig(_0x358a06){const _0x10f784=a66_0x4b0b07,_0x4e4c67=findProjectConfigPath(_0x358a06);if(!_0x4e4c67)return null;try{const _0x3f571d=a66_0x112432[_0x10f784(0x1e8)](_0x4e4c67,_0x10f784(0x1ea)),_0x26ff69=JSON[_0x10f784(0x1f1)](_0x3f571d),_0x542550=JSON[_0x10f784(0x1e2)](_0x26ff69);if(_0x542550[_0x10f784(0x1df)](_0x10f784(0x1f5))||_0x542550[_0x10f784(0x1df)]('apiKey')||_0x542550[_0x10f784(0x1df)](_0x10f784(0x1de)))throw new Error(_0x10f784(0x1f3)+_0x4e4c67+').\x20'+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0x50d261,profile:_0x18238e,..._0x882673}=_0x26ff69;return _0x18238e&&console[_0x10f784(0x1dc)](_0x10f784(0x1f0)+_0x4e4c67+_0x10f784(0x1e3)+_0x10f784(0x1ec)),_0x882673;}catch(_0x28acad){if(_0x28acad instanceof Error&&_0x10f784(0x1e9)in _0x28acad&&_0x28acad[_0x10f784(0x1e9)]===_0x10f784(0x1fa))return null;throw new Error(_0x10f784(0x1e0)+_0x4e4c67+':\x20'+_0x28acad);}}export function saveProjectConfig(_0x253474,_0x30d2b7){const _0x42855a=a66_0x4b0b07,_0x305fad=_0x30d2b7||process[_0x42855a(0x1ee)](),_0xf08fe2=a66_0x24e25e[_0x42855a(0x1f9)](_0x305fad,PROJECT_CONFIG_FILENAME),_0x30992c=JSON[_0x42855a(0x1e2)](_0x253474);if(_0x30992c[_0x42855a(0x1df)](_0x42855a(0x1f5))||_0x30992c[_0x42855a(0x1df)]('apiKey')||_0x30992c[_0x42855a(0x1df)](_0x42855a(0x1de)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if(_0x42855a(0x1da)in _0x253474)throw new Error('\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.');a66_0x112432[_0x42855a(0x1e5)](_0xf08fe2,JSON[_0x42855a(0x1e2)](_0x253474,null,0x2));}export function hasProjectConfig(_0xefe992){return findProjectConfigPath(_0xefe992)!==null;}export function getProjectRoot(_0x70c6ca){const _0x1504c6=a66_0x4b0b07,_0x431bfb=findProjectConfigPath(_0x70c6ca);return _0x431bfb?a66_0x24e25e[_0x1504c6(0x1e6)](_0x431bfb):null;}
@@ -1 +1 @@
1
- (function(_0x557186,_0x5b500a){const _0x2671da=a67_0x2059,_0xcbab22=_0x557186();while(!![]){try{const _0x1f4bc2=-parseInt(_0x2671da(0x82))/0x1*(parseInt(_0x2671da(0x81))/0x2)+-parseInt(_0x2671da(0x86))/0x3+parseInt(_0x2671da(0x73))/0x4*(parseInt(_0x2671da(0x8b))/0x5)+-parseInt(_0x2671da(0x76))/0x6+-parseInt(_0x2671da(0x67))/0x7+-parseInt(_0x2671da(0x6d))/0x8*(parseInt(_0x2671da(0x6e))/0x9)+parseInt(_0x2671da(0x7f))/0xa;if(_0x1f4bc2===_0x5b500a)break;else _0xcbab22['push'](_0xcbab22['shift']());}catch(_0x587c21){_0xcbab22['push'](_0xcbab22['shift']());}}}(a67_0x34f4,0x23b02));import*as a67_0x1f8468 from'node:fs';import*as a67_0x226a5e from'node:path';import*as a67_0x576a25 from'node:os';import{getPPID,isProcessRunning}from'../utils/process.js';function a67_0x34f4(){const _0x1092d9=['parse','6634210KWItYG','endsWith','76058MAzyZG','5GHxJuE','toString','api_key','stringify','190479ntHvuc','now','.\x20This\x20is\x20insecure.\x20Removing\x20session.','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','homedir','5vZlEzk','sessions','test','apiKey','getTime','854672IkWhJR','utf-8','join','.json','toISOString','includes','546632YAaVNj','9exHyJj','existsSync','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','push','readFileSync','6680YAoQIg','tdx','unlinkSync','449100RWBVFP','writeFileSync','sort','readdirSync','TD_API_KEY','replace','warn','createdAt'];a67_0x34f4=function(){return _0x1092d9;};return a67_0x34f4();}import{createSecureDirectory}from'../utils/file-permissions.js';const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function getSessionsDir(){const _0x1dc253=a67_0x2059,_0x21e4aa=process.env.TDX_CONFIG_DIR||a67_0x226a5e[_0x1dc253(0x69)](a67_0x576a25[_0x1dc253(0x8a)](),'.config',_0x1dc253(0x74));return a67_0x226a5e['join'](_0x21e4aa,_0x1dc253(0x8c));}function getSessionPath(_0x176cae){const _0x24ec98=a67_0x2059;return a67_0x226a5e['join'](getSessionsDir(),_0x176cae+_0x24ec98(0x6a));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x471fc9){const _0x6f6c84=a67_0x2059;if(_0x471fc9)return _0x471fc9;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x6f6c84(0x83)]();}export function loadSessionContext(_0x3df489){const _0x262dd5=a67_0x2059,_0x1d8573=getSessionID(_0x3df489),_0x46ed88=/^\d+$/[_0x262dd5(0x64)](_0x1d8573)?parseInt(_0x1d8573,0xa):null;return _0x46ed88!==null?loadSessionContextByPID(_0x46ed88):loadSessionContextByString(_0x1d8573);}export function loadSessionContextByPID(_0x4c3598){const _0x2ef95d=a67_0x2059,_0x2241e6=getSessionPath(_0x4c3598);if(!a67_0x1f8468['existsSync'](_0x2241e6))return null;try{const _0x4ec713=a67_0x1f8468[_0x2ef95d(0x72)](_0x2241e6,_0x2ef95d(0x68)),_0x560716=JSON[_0x2ef95d(0x7e)](_0x4ec713),_0x419561=new Date(_0x560716[_0x2ef95d(0x7d)])[_0x2ef95d(0x66)](),_0x5a0276=Date[_0x2ef95d(0x87)]();if(_0x5a0276-_0x419561>SESSION_EXPIRATION_MS)return a67_0x1f8468[_0x2ef95d(0x75)](_0x2241e6),null;const _0x144e6a=JSON['stringify'](_0x560716);if(_0x144e6a[_0x2ef95d(0x6c)](_0x2ef95d(0x7a))||_0x144e6a[_0x2ef95d(0x6c)]('apiKey')||_0x144e6a['includes'](_0x2ef95d(0x84)))return console[_0x2ef95d(0x7c)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x2241e6+_0x2ef95d(0x88)),a67_0x1f8468[_0x2ef95d(0x75)](_0x2241e6),null;return _0x560716;}catch{try{a67_0x1f8468['unlinkSync'](_0x2241e6);}catch{}return null;}}function loadSessionContextByString(_0x4cb805){const _0x4ec381=a67_0x2059,_0x1b1d07=a67_0x226a5e[_0x4ec381(0x69)](getSessionsDir(),_0x4cb805+'.json');if(!a67_0x1f8468[_0x4ec381(0x6f)](_0x1b1d07))return null;try{const _0x21a742=a67_0x1f8468[_0x4ec381(0x72)](_0x1b1d07,'utf-8'),_0x49e3f8=JSON[_0x4ec381(0x7e)](_0x21a742),_0x33dc6c=new Date(_0x49e3f8[_0x4ec381(0x7d)])[_0x4ec381(0x66)](),_0x5a9f26=Date[_0x4ec381(0x87)]();if(_0x5a9f26-_0x33dc6c>SESSION_EXPIRATION_MS)return a67_0x1f8468[_0x4ec381(0x75)](_0x1b1d07),null;const _0x496dc9=JSON[_0x4ec381(0x85)](_0x49e3f8);if(_0x496dc9[_0x4ec381(0x6c)]('TD_API_KEY')||_0x496dc9[_0x4ec381(0x6c)](_0x4ec381(0x65))||_0x496dc9[_0x4ec381(0x6c)](_0x4ec381(0x84)))return console[_0x4ec381(0x7c)](_0x4ec381(0x70)+_0x1b1d07+_0x4ec381(0x88)),a67_0x1f8468[_0x4ec381(0x75)](_0x1b1d07),null;return _0x49e3f8;}catch{try{a67_0x1f8468[_0x4ec381(0x75)](_0x1b1d07);}catch{}return null;}}export function saveSessionContext(_0x2416c2,_0x5f0986){const _0x40a8df=a67_0x2059,_0x1993f7=getSessionID(_0x5f0986),_0x1c0c88=/^\d+$/['test'](_0x1993f7)?parseInt(_0x1993f7,0xa):getCurrentSessionPID(),_0x4f58ee=a67_0x226a5e['join'](getSessionsDir(),_0x1993f7+_0x40a8df(0x6a)),_0x3b5e5b=getSessionsDir();createSecureDirectory(_0x3b5e5b);const _0x2a59c0=JSON['stringify'](_0x2416c2);if(_0x2a59c0['includes']('TD_API_KEY')||_0x2a59c0[_0x40a8df(0x6c)]('apiKey')||_0x2a59c0[_0x40a8df(0x6c)](_0x40a8df(0x84)))throw new Error(_0x40a8df(0x89));let _0x8d7269;const _0x4524df=/^\d+$/[_0x40a8df(0x64)](_0x1993f7)?loadSessionContextByPID(parseInt(_0x1993f7,0xa)):loadSessionContextByString(_0x1993f7);_0x4524df?_0x8d7269={..._0x4524df,..._0x2416c2,'pid':_0x1c0c88,'sessionId':_0x1993f7!==_0x1c0c88[_0x40a8df(0x83)]()?_0x1993f7:undefined,'updatedAt':new Date()['toISOString']()}:_0x8d7269={'pid':_0x1c0c88,'sessionId':_0x1993f7!==_0x1c0c88[_0x40a8df(0x83)]()?_0x1993f7:undefined,..._0x2416c2,'createdAt':new Date()[_0x40a8df(0x6b)](),'updatedAt':new Date()[_0x40a8df(0x6b)]()},a67_0x1f8468[_0x40a8df(0x77)](_0x4f58ee,JSON[_0x40a8df(0x85)](_0x8d7269,null,0x2));}export function clearSessionContext(_0x52a4f9){const _0x9ba843=a67_0x2059,_0x54c565=getSessionID(_0x52a4f9),_0x253be6=a67_0x226a5e[_0x9ba843(0x69)](getSessionsDir(),_0x54c565+'.json');a67_0x1f8468['existsSync'](_0x253be6)&&a67_0x1f8468['unlinkSync'](_0x253be6);}export function clearSessionContextField(_0x2da459,_0x44a530){const _0x5aa013=a67_0x2059,_0x1f6ae5=getSessionID(_0x44a530),_0x14fb67=a67_0x226a5e[_0x5aa013(0x69)](getSessionsDir(),_0x1f6ae5+'.json');if(!a67_0x1f8468['existsSync'](_0x14fb67))return;try{const _0x7d76bf=a67_0x1f8468[_0x5aa013(0x72)](_0x14fb67,_0x5aa013(0x68)),_0xce1bd5=JSON[_0x5aa013(0x7e)](_0x7d76bf);delete _0xce1bd5[_0x2da459],a67_0x1f8468[_0x5aa013(0x77)](_0x14fb67,JSON[_0x5aa013(0x85)](_0xce1bd5,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x28cddf=a67_0x2059,_0x35f82f=getSessionsDir();if(!a67_0x1f8468['existsSync'](_0x35f82f))return 0x0;let _0x113788=0x0;const _0x336989=Date['now']();try{const _0x53ff54=a67_0x1f8468[_0x28cddf(0x79)](_0x35f82f);for(const _0x222f9b of _0x53ff54){if(!_0x222f9b[_0x28cddf(0x80)]('.json'))continue;const _0x6cfe6a=a67_0x226a5e[_0x28cddf(0x69)](_0x35f82f,_0x222f9b),_0x3db251=_0x222f9b['replace']('.json',''),_0x4a938e=parseInt(_0x3db251,0xa),_0x28c447=!isNaN(_0x4a938e);if(_0x28c447){if(!isProcessRunning(_0x4a938e)){a67_0x1f8468[_0x28cddf(0x75)](_0x6cfe6a),_0x113788++;continue;}}try{const _0x12e4b5=a67_0x1f8468[_0x28cddf(0x72)](_0x6cfe6a,_0x28cddf(0x68)),_0x2f66c4=JSON[_0x28cddf(0x7e)](_0x12e4b5),_0xfe1a58=new Date(_0x2f66c4[_0x28cddf(0x7d)])['getTime']();_0x336989-_0xfe1a58>SESSION_EXPIRATION_MS&&(a67_0x1f8468[_0x28cddf(0x75)](_0x6cfe6a),_0x113788++);}catch{a67_0x1f8468[_0x28cddf(0x75)](_0x6cfe6a),_0x113788++;}}}catch{}return _0x113788;}function a67_0x2059(_0x194e22,_0x93eb39){_0x194e22=_0x194e22-0x64;const _0x34f4db=a67_0x34f4();let _0x205930=_0x34f4db[_0x194e22];return _0x205930;}export function listActiveSessions(){const _0x3e2b11=a67_0x2059,_0x233cc5=getSessionsDir();if(!a67_0x1f8468[_0x3e2b11(0x6f)](_0x233cc5))return[];try{const _0x5d3f4b=a67_0x1f8468['readdirSync'](_0x233cc5),_0x223b0c=[];for(const _0x2c30c of _0x5d3f4b){if(!_0x2c30c[_0x3e2b11(0x80)](_0x3e2b11(0x6a)))continue;const _0x582905=_0x2c30c[_0x3e2b11(0x7b)](_0x3e2b11(0x6a),''),_0x37016b=parseInt(_0x582905,0xa);!isNaN(_0x37016b)&&isProcessRunning(_0x37016b)&&_0x223b0c[_0x3e2b11(0x71)](_0x37016b);}return _0x223b0c[_0x3e2b11(0x78)]((_0x4ce10c,_0x653838)=>_0x4ce10c-_0x653838);}catch{return[];}}
1
+ (function(_0x1bf1c7,_0x168c73){const _0x44f276=a67_0x335b,_0x5b2d84=_0x1bf1c7();while(!![]){try{const _0x42f182=parseInt(_0x44f276(0x1a4))/0x1*(-parseInt(_0x44f276(0x1aa))/0x2)+parseInt(_0x44f276(0x1b6))/0x3*(parseInt(_0x44f276(0x1a7))/0x4)+-parseInt(_0x44f276(0x19e))/0x5*(parseInt(_0x44f276(0x1ad))/0x6)+parseInt(_0x44f276(0x19b))/0x7+-parseInt(_0x44f276(0x1a1))/0x8+-parseInt(_0x44f276(0x1b7))/0x9+parseInt(_0x44f276(0x196))/0xa;if(_0x42f182===_0x168c73)break;else _0x5b2d84['push'](_0x5b2d84['shift']());}catch(_0x12132b){_0x5b2d84['push'](_0x5b2d84['shift']());}}}(a67_0x3e5d,0xecb59));import*as a67_0x24b158 from'node:fs';import*as a67_0x221c8e from'node:path';import*as a67_0x29968a 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 _0x4e6422=a67_0x335b,_0x2ea4b9=process.env.TDX_CONFIG_DIR||a67_0x221c8e[_0x4e6422(0x1a9)](a67_0x29968a[_0x4e6422(0x1ab)](),_0x4e6422(0x198),_0x4e6422(0x1bf));return a67_0x221c8e[_0x4e6422(0x1a9)](_0x2ea4b9,_0x4e6422(0x1b9));}function getSessionPath(_0x53988d){const _0x4ffd3d=a67_0x335b;return a67_0x221c8e[_0x4ffd3d(0x1a9)](getSessionsDir(),_0x53988d+'.json');}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x25d558){const _0x44868f=a67_0x335b;if(_0x25d558)return _0x25d558;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0x44868f(0x1a8)]();}export function loadSessionContext(_0x94dfe1){const _0x5bd0be=a67_0x335b,_0x335305=getSessionID(_0x94dfe1),_0x1479fc=/^\d+$/[_0x5bd0be(0x19a)](_0x335305)?parseInt(_0x335305,0xa):null;return _0x1479fc!==null?loadSessionContextByPID(_0x1479fc):loadSessionContextByString(_0x335305);}export function loadSessionContextByPID(_0x40e4ea){const _0x51eb60=a67_0x335b,_0x1bd650=getSessionPath(_0x40e4ea);if(!a67_0x24b158[_0x51eb60(0x1b0)](_0x1bd650))return null;try{const _0x45eca0=a67_0x24b158['readFileSync'](_0x1bd650,_0x51eb60(0x1a5)),_0x4bb9c9=JSON[_0x51eb60(0x19d)](_0x45eca0),_0x3c1b31=new Date(_0x4bb9c9['createdAt'])['getTime'](),_0x34636e=Date['now']();if(_0x34636e-_0x3c1b31>SESSION_EXPIRATION_MS)return a67_0x24b158['unlinkSync'](_0x1bd650),null;const _0x276203=JSON['stringify'](_0x4bb9c9);if(_0x276203['includes']('TD_API_KEY')||_0x276203[_0x51eb60(0x1b8)]('apiKey')||_0x276203['includes'](_0x51eb60(0x1ac)))return console[_0x51eb60(0x1b5)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x1bd650+_0x51eb60(0x197)),a67_0x24b158[_0x51eb60(0x1bb)](_0x1bd650),null;return _0x4bb9c9;}catch{try{a67_0x24b158[_0x51eb60(0x1bb)](_0x1bd650);}catch{}return null;}}function loadSessionContextByString(_0x25484d){const _0x1a1ea9=a67_0x335b,_0x10690d=a67_0x221c8e[_0x1a1ea9(0x1a9)](getSessionsDir(),_0x25484d+_0x1a1ea9(0x1bc));if(!a67_0x24b158['existsSync'](_0x10690d))return null;try{const _0x3bd1ba=a67_0x24b158[_0x1a1ea9(0x1be)](_0x10690d,'utf-8'),_0x19267f=JSON['parse'](_0x3bd1ba),_0x2f580d=new Date(_0x19267f[_0x1a1ea9(0x1ba)])[_0x1a1ea9(0x19c)](),_0x4fc784=Date['now']();if(_0x4fc784-_0x2f580d>SESSION_EXPIRATION_MS)return a67_0x24b158[_0x1a1ea9(0x1bb)](_0x10690d),null;const _0x3afddc=JSON[_0x1a1ea9(0x1bd)](_0x19267f);if(_0x3afddc[_0x1a1ea9(0x1b8)]('TD_API_KEY')||_0x3afddc[_0x1a1ea9(0x1b8)](_0x1a1ea9(0x1b4))||_0x3afddc[_0x1a1ea9(0x1b8)](_0x1a1ea9(0x1ac)))return console['warn'](_0x1a1ea9(0x199)+_0x10690d+_0x1a1ea9(0x197)),a67_0x24b158['unlinkSync'](_0x10690d),null;return _0x19267f;}catch{try{a67_0x24b158[_0x1a1ea9(0x1bb)](_0x10690d);}catch{}return null;}}export function saveSessionContext(_0x3368ff,_0xb73622){const _0x4a99a8=a67_0x335b,_0x31da02=getSessionID(_0xb73622),_0x23417a=/^\d+$/[_0x4a99a8(0x19a)](_0x31da02)?parseInt(_0x31da02,0xa):getCurrentSessionPID(),_0x3e3c0b=a67_0x221c8e[_0x4a99a8(0x1a9)](getSessionsDir(),_0x31da02+_0x4a99a8(0x1bc)),_0x43b8b5=getSessionsDir();createSecureDirectory(_0x43b8b5);const _0x2056f7=JSON[_0x4a99a8(0x1bd)](_0x3368ff);if(_0x2056f7[_0x4a99a8(0x1b8)](_0x4a99a8(0x1ae))||_0x2056f7[_0x4a99a8(0x1b8)](_0x4a99a8(0x1b4))||_0x2056f7[_0x4a99a8(0x1b8)]('api_key'))throw new Error(_0x4a99a8(0x1a6));let _0x3bd5e7;const _0x19cf6b=/^\d+$/[_0x4a99a8(0x19a)](_0x31da02)?loadSessionContextByPID(parseInt(_0x31da02,0xa)):loadSessionContextByString(_0x31da02);_0x19cf6b?_0x3bd5e7={..._0x19cf6b,..._0x3368ff,'pid':_0x23417a,'sessionId':_0x31da02!==_0x23417a[_0x4a99a8(0x1a8)]()?_0x31da02:undefined,'updatedAt':new Date()[_0x4a99a8(0x1a0)]()}:_0x3bd5e7={'pid':_0x23417a,'sessionId':_0x31da02!==_0x23417a[_0x4a99a8(0x1a8)]()?_0x31da02:undefined,..._0x3368ff,'createdAt':new Date()[_0x4a99a8(0x1a0)](),'updatedAt':new Date()[_0x4a99a8(0x1a0)]()},a67_0x24b158[_0x4a99a8(0x1b3)](_0x3e3c0b,JSON[_0x4a99a8(0x1bd)](_0x3bd5e7,null,0x2));}export function clearSessionContext(_0x37ab30){const _0x30f4a7=a67_0x335b,_0x2b0f24=getSessionID(_0x37ab30),_0x46f639=a67_0x221c8e['join'](getSessionsDir(),_0x2b0f24+_0x30f4a7(0x1bc));a67_0x24b158[_0x30f4a7(0x1b0)](_0x46f639)&&a67_0x24b158[_0x30f4a7(0x1bb)](_0x46f639);}function a67_0x3e5d(){const _0x28d02c=['55SjLwBf','utf-8','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','4tfKfqE','toString','join','22766JsCMqH','homedir','api_key','66RXonmT','TD_API_KEY','push','existsSync','now','sort','writeFileSync','apiKey','warn','3416487BfjQcz','3642516uTMVlV','includes','sessions','createdAt','unlinkSync','.json','stringify','readFileSync','tdx','21035940YWrNee','.\x20This\x20is\x20insecure.\x20Removing\x20session.','.config','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','test','4549930tlsFEC','getTime','parse','322005lKjcis','replace','toISOString','9469216adAbLa','endsWith','readdirSync'];a67_0x3e5d=function(){return _0x28d02c;};return a67_0x3e5d();}export function clearSessionContextField(_0x436c09,_0x1ea1eb){const _0x142e18=a67_0x335b,_0x229733=getSessionID(_0x1ea1eb),_0x1d6d2b=a67_0x221c8e['join'](getSessionsDir(),_0x229733+'.json');if(!a67_0x24b158[_0x142e18(0x1b0)](_0x1d6d2b))return;try{const _0x59bdec=a67_0x24b158[_0x142e18(0x1be)](_0x1d6d2b,_0x142e18(0x1a5)),_0x3f6c95=JSON[_0x142e18(0x19d)](_0x59bdec);delete _0x3f6c95[_0x436c09],a67_0x24b158[_0x142e18(0x1b3)](_0x1d6d2b,JSON[_0x142e18(0x1bd)](_0x3f6c95,null,0x2));}catch{}}function a67_0x335b(_0x4ef03a,_0x2c074a){_0x4ef03a=_0x4ef03a-0x196;const _0x3e5dbd=a67_0x3e5d();let _0x335b97=_0x3e5dbd[_0x4ef03a];return _0x335b97;}export function cleanExpiredSessions(){const _0x10c3c6=a67_0x335b,_0x29e152=getSessionsDir();if(!a67_0x24b158[_0x10c3c6(0x1b0)](_0x29e152))return 0x0;let _0x45e04e=0x0;const _0x5de184=Date[_0x10c3c6(0x1b1)]();try{const _0x9c85eb=a67_0x24b158['readdirSync'](_0x29e152);for(const _0x12e738 of _0x9c85eb){if(!_0x12e738['endsWith'](_0x10c3c6(0x1bc)))continue;const _0x4ac9d3=a67_0x221c8e['join'](_0x29e152,_0x12e738),_0x4b628c=_0x12e738[_0x10c3c6(0x19f)]('.json',''),_0xf0e099=parseInt(_0x4b628c,0xa),_0x2a5528=!isNaN(_0xf0e099);if(_0x2a5528){if(!isProcessRunning(_0xf0e099)){a67_0x24b158[_0x10c3c6(0x1bb)](_0x4ac9d3),_0x45e04e++;continue;}}try{const _0x4a6fd3=a67_0x24b158[_0x10c3c6(0x1be)](_0x4ac9d3,_0x10c3c6(0x1a5)),_0x3cca84=JSON[_0x10c3c6(0x19d)](_0x4a6fd3),_0x2958cf=new Date(_0x3cca84[_0x10c3c6(0x1ba)])[_0x10c3c6(0x19c)]();_0x5de184-_0x2958cf>SESSION_EXPIRATION_MS&&(a67_0x24b158['unlinkSync'](_0x4ac9d3),_0x45e04e++);}catch{a67_0x24b158['unlinkSync'](_0x4ac9d3),_0x45e04e++;}}}catch{}return _0x45e04e;}export function listActiveSessions(){const _0x29a289=a67_0x335b,_0x2eb584=getSessionsDir();if(!a67_0x24b158[_0x29a289(0x1b0)](_0x2eb584))return[];try{const _0x11a93a=a67_0x24b158[_0x29a289(0x1a3)](_0x2eb584),_0x2942e4=[];for(const _0x330629 of _0x11a93a){if(!_0x330629[_0x29a289(0x1a2)](_0x29a289(0x1bc)))continue;const _0x2c08f0=_0x330629[_0x29a289(0x19f)](_0x29a289(0x1bc),''),_0x2cc0ed=parseInt(_0x2c08f0,0xa);!isNaN(_0x2cc0ed)&&isProcessRunning(_0x2cc0ed)&&_0x2942e4[_0x29a289(0x1af)](_0x2cc0ed);}return _0x2942e4[_0x29a289(0x1b2)]((_0x41fee0,_0x471065)=>_0x41fee0-_0x471065);}catch{return[];}}
@@ -1 +1 @@
1
- const a68_0x32da44=a68_0x30c2;(function(_0x1240ce,_0x219ee4){const _0x5129bb=a68_0x30c2,_0x135e66=_0x1240ce();while(!![]){try{const _0x387f03=parseInt(_0x5129bb(0x121))/0x1+parseInt(_0x5129bb(0x11d))/0x2+-parseInt(_0x5129bb(0x123))/0x3+parseInt(_0x5129bb(0x11f))/0x4+-parseInt(_0x5129bb(0x11b))/0x5+parseInt(_0x5129bb(0x11e))/0x6*(parseInt(_0x5129bb(0x11c))/0x7)+parseInt(_0x5129bb(0x117))/0x8*(-parseInt(_0x5129bb(0x120))/0x9);if(_0x387f03===_0x219ee4)break;else _0x135e66['push'](_0x135e66['shift']());}catch(_0x106df5){_0x135e66['push'](_0x135e66['shift']());}}}(a68_0x5bd5,0x2b273));import{createProfileCache}from'../utils/global-cache.js';function a68_0x5bd5(){const _0x652ac7=['1196160IgfEIu','7VNEstG','65280WlfjqW','293022AbQLJw','1230940AFkOVq','801CgQtrm','64307fDMHpG','users','51453ZlSpjm','read','1832KYAtKZ','users-{profile}.json','clear','core/user-cache'];a68_0x5bd5=function(){return _0x652ac7;};return a68_0x5bd5();}const userCache=createProfileCache(a68_0x32da44(0x118),a68_0x32da44(0x11a));export function loadCachedUsers(_0x2d4160){const _0x2b9ed2=a68_0x32da44,_0x6a6fcb=userCache[_0x2b9ed2(0x124)](_0x2d4160);return _0x6a6fcb?.[_0x2b9ed2(0x122)]??null;}function a68_0x30c2(_0x3ab531,_0x3c7dd5){_0x3ab531=_0x3ab531-0x117;const _0x5bd5ef=a68_0x5bd5();let _0x30c237=_0x5bd5ef[_0x3ab531];return _0x30c237;}export function saveCachedUsers(_0x281859,_0x5f36da){userCache['write'](_0x281859,{'users':_0x5f36da,'cachedAt':Date['now']()});}export function clearUserCache(_0x95ba47){const _0x21a715=a68_0x32da44;userCache[_0x21a715(0x119)](_0x95ba47);}
1
+ const a68_0x371892=a68_0x2026;function a68_0x5ebf(){const _0x49c4aa=['users','7243740rCgdnk','493436QkiIqH','clear','write','read','16291632JWBpeK','416106yLgOjX','9YOFTbj','1077642VphanA','2873110MuwHtQ','core/user-cache','411330uHJckp'];a68_0x5ebf=function(){return _0x49c4aa;};return a68_0x5ebf();}(function(_0x1ed163,_0x5324ab){const _0x258918=a68_0x2026,_0x7ef661=_0x1ed163();while(!![]){try{const _0x37cae5=parseInt(_0x258918(0xe5))/0x1+parseInt(_0x258918(0xf0))/0x2+-parseInt(_0x258918(0xf1))/0x3*(parseInt(_0x258918(0xeb))/0x4)+parseInt(_0x258918(0xe6))/0x5+parseInt(_0x258918(0xe8))/0x6+parseInt(_0x258918(0xea))/0x7+-parseInt(_0x258918(0xef))/0x8;if(_0x37cae5===_0x5324ab)break;else _0x7ef661['push'](_0x7ef661['shift']());}catch(_0x3ba526){_0x7ef661['push'](_0x7ef661['shift']());}}}(a68_0x5ebf,0x88069));function a68_0x2026(_0xb361e2,_0x2bcda6){_0xb361e2=_0xb361e2-0xe5;const _0x5ebf6a=a68_0x5ebf();let _0x2026b2=_0x5ebf6a[_0xb361e2];return _0x2026b2;}import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache('users-{profile}.json',a68_0x371892(0xe7));export function loadCachedUsers(_0x20e9e8){const _0x4e44bf=a68_0x371892,_0x35020c=userCache[_0x4e44bf(0xee)](_0x20e9e8);return _0x35020c?.[_0x4e44bf(0xe9)]??null;}export function saveCachedUsers(_0x185036,_0x5a22ba){const _0x4a4b77=a68_0x371892;userCache[_0x4a4b77(0xed)](_0x185036,{'users':_0x5a22ba,'cachedAt':Date['now']()});}export function clearUserCache(_0x77e3ee){const _0xbf7e57=a68_0x371892;userCache[_0xbf7e57(0xec)](_0x77e3ee);}
@@ -1 +1 @@
1
- (function(_0x1ed496,_0x3c60fe){const _0x22a0b6=a69_0x1ea7,_0x517842=_0x1ed496();while(!![]){try{const _0xd3eb45=-parseInt(_0x22a0b6(0xd9))/0x1*(parseInt(_0x22a0b6(0xd1))/0x2)+parseInt(_0x22a0b6(0xd5))/0x3+-parseInt(_0x22a0b6(0xd8))/0x4*(-parseInt(_0x22a0b6(0xc9))/0x5)+-parseInt(_0x22a0b6(0xda))/0x6*(parseInt(_0x22a0b6(0xce))/0x7)+-parseInt(_0x22a0b6(0xcc))/0x8*(parseInt(_0x22a0b6(0xd7))/0x9)+-parseInt(_0x22a0b6(0xc7))/0xa*(-parseInt(_0x22a0b6(0xd3))/0xb)+parseInt(_0x22a0b6(0xd2))/0xc*(-parseInt(_0x22a0b6(0xca))/0xd);if(_0xd3eb45===_0x3c60fe)break;else _0x517842['push'](_0x517842['shift']());}catch(_0x4f5e50){_0x517842['push'](_0x517842['shift']());}}}(a69_0x4b99,0xca345));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';function a69_0x4b99(){const _0x17b55b=['../build-info.json','225955JfuRSc','2495727FXxXTm','.dev','4552OnytNa','version','416913HftajM','../../package.json','utf-8','451378jBrexP','12PGiJAu','11297DTRwBa','includes','497097AHbBar','parse','522jJQRHD','116QhciBd','4DXsAue','102qauaTA','14530hwHcwB'];a69_0x4b99=function(){return _0x17b55b;};return a69_0x4b99();}let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x565a5b=a69_0x1ea7;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x12b507=fileURLToPath(import.meta.url),_0x30d923=dirname(_0x12b507);try{const _0x36b27d=join(_0x30d923,_0x565a5b(0xc8));cachedBuildInfo=JSON[_0x565a5b(0xd6)](readFileSync(_0x36b27d,'utf-8'));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x3d0f90=a69_0x1ea7;if(cachedVersion!==null)return cachedVersion;const _0x5a7237=fileURLToPath(import.meta.url),_0x723ed=dirname(_0x5a7237),_0xe5df62=getBuildInfo();if(_0xe5df62[_0x3d0f90(0xcd)])return cachedVersion=_0xe5df62['version'],cachedVersion;try{const _0x5589b6=join(_0x723ed,_0x3d0f90(0xcf)),_0x108e67=JSON['parse'](readFileSync(_0x5589b6,_0x3d0f90(0xd0)));cachedVersion=_0x108e67[_0x3d0f90(0xcd)];}catch{cachedVersion='0.0.0';}return cachedVersion;}function a69_0x1ea7(_0x244ee1,_0x5bcd2a){_0x244ee1=_0x244ee1-0xc7;const _0x4b99fd=a69_0x4b99();let _0x1ea763=_0x4b99fd[_0x244ee1];return _0x1ea763;}export function isDevVersion(){const _0x4aba34=a69_0x1ea7,_0x5a6fe7=getVersion();return _0x5a6fe7[_0x4aba34(0xd4)](_0x4aba34(0xcb))||_0x5a6fe7[_0x4aba34(0xd4)]('-');}
1
+ (function(_0x2c95c7,_0x377b7e){const _0x4e10a3=a69_0x58fc,_0x98e082=_0x2c95c7();while(!![]){try{const _0x27169d=-parseInt(_0x4e10a3(0x1a8))/0x1+-parseInt(_0x4e10a3(0x1a9))/0x2+parseInt(_0x4e10a3(0x1a2))/0x3+parseInt(_0x4e10a3(0x1a4))/0x4*(-parseInt(_0x4e10a3(0x1aa))/0x5)+-parseInt(_0x4e10a3(0x1a5))/0x6*(-parseInt(_0x4e10a3(0x199))/0x7)+-parseInt(_0x4e10a3(0x19e))/0x8+parseInt(_0x4e10a3(0x1a0))/0x9*(parseInt(_0x4e10a3(0x1a1))/0xa);if(_0x27169d===_0x377b7e)break;else _0x98e082['push'](_0x98e082['shift']());}catch(_0x43de35){_0x98e082['push'](_0x98e082['shift']());}}}(a69_0xb60c,0x19ba1));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x1839e7=a69_0x58fc;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x110b2a=fileURLToPath(import.meta.url),_0x456967=dirname(_0x110b2a);try{const _0x42e930=join(_0x456967,_0x1839e7(0x19b));cachedBuildInfo=JSON['parse'](readFileSync(_0x42e930,_0x1839e7(0x1a3)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}function a69_0x58fc(_0x4f0323,_0x247517){_0x4f0323=_0x4f0323-0x199;const _0xb60c20=a69_0xb60c();let _0x58fc93=_0xb60c20[_0x4f0323];return _0x58fc93;}export function getVersion(){const _0x41c132=a69_0x58fc;if(cachedVersion!==null)return cachedVersion;const _0x143116=fileURLToPath(import.meta.url),_0x38cf08=dirname(_0x143116),_0x1f75e8=getBuildInfo();if(_0x1f75e8[_0x41c132(0x19d)])return cachedVersion=_0x1f75e8[_0x41c132(0x19d)],cachedVersion;try{const _0x45962d=join(_0x38cf08,_0x41c132(0x19a)),_0x11b206=JSON[_0x41c132(0x19f)](readFileSync(_0x45962d,_0x41c132(0x1a3)));cachedVersion=_0x11b206[_0x41c132(0x19d)];}catch{cachedVersion=_0x41c132(0x1a7);}return cachedVersion;}export function isDevVersion(){const _0x3824e8=a69_0x58fc,_0x4654c7=getVersion();return _0x4654c7[_0x3824e8(0x19c)](_0x3824e8(0x1a6))||_0x4654c7[_0x3824e8(0x19c)]('-');}function a69_0xb60c(){const _0x210ead=['33440QbJWMO','22200glrkQv','utf-8','4lJWZXE','547482CqXaOY','.dev','0.0.0','12313YKLbFg','166580pHAcTX','889545TgzPzu','7ZnbFZB','../../package.json','../build-info.json','includes','version','914800oKRuzc','parse','1062FAWeYa'];a69_0xb60c=function(){return _0x210ead;};return a69_0xb60c();}