@treasuredata/tdx 2026.3.42 → 2026.3.44

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 (222) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/auth-login-command.js +1 -1
  11. package/dist/commands/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/utils.js +1 -1
  79. package/dist/proxy/claude-usage-tracker.js +1 -1
  80. package/dist/proxy/passthrough-server.js +1 -1
  81. package/dist/proxy/sse-usage-parser.js +1 -1
  82. package/dist/sdk/agent/agent-config.js +1 -1
  83. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  84. package/dist/sdk/agent/agent-yaml.js +1 -1
  85. package/dist/sdk/agent/test/evaluator.js +1 -1
  86. package/dist/sdk/agent/test/executor.js +1 -1
  87. package/dist/sdk/agent/test/index.js +1 -1
  88. package/dist/sdk/agent/test/output.js +1 -1
  89. package/dist/sdk/agent/test/parser.js +1 -1
  90. package/dist/sdk/agent/tool-target-registry.js +1 -1
  91. package/dist/sdk/api.js +1 -1
  92. package/dist/sdk/cas/cas-api-client.js +1 -1
  93. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  94. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  95. package/dist/sdk/cas/index.js +1 -1
  96. package/dist/sdk/cas/pull-workflow.js +1 -1
  97. package/dist/sdk/cas/push-workflow.js +1 -1
  98. package/dist/sdk/client/cdp-api-client.js +1 -1
  99. package/dist/sdk/client/delivery-api-client.js +1 -1
  100. package/dist/sdk/client/endpoints.js +1 -1
  101. package/dist/sdk/client/engage-api-client.js +1 -1
  102. package/dist/sdk/client/http-client.js +1 -1
  103. package/dist/sdk/client/llm-api-client.js +1 -1
  104. package/dist/sdk/client/oauth-refresh.js +1 -1
  105. package/dist/sdk/client/rate-limiter.js +1 -1
  106. package/dist/sdk/client/td-api-client.js +1 -1
  107. package/dist/sdk/client/trino-api-client.js +1 -1
  108. package/dist/sdk/client/workflow-client.js +1 -1
  109. package/dist/sdk/connection-validator.js +1 -1
  110. package/dist/sdk/connection.js +1 -1
  111. package/dist/sdk/delivery.js +1 -1
  112. package/dist/sdk/engage/campaign-pull.js +1 -1
  113. package/dist/sdk/engage/campaign-push.js +1 -1
  114. package/dist/sdk/engage/campaign-validator.js +1 -1
  115. package/dist/sdk/engage/campaign-yaml.js +1 -1
  116. package/dist/sdk/engage/template-pull.js +1 -1
  117. package/dist/sdk/engage/template-push.js +1 -1
  118. package/dist/sdk/engage/template-validator.js +1 -1
  119. package/dist/sdk/engage/template-yaml.js +1 -1
  120. package/dist/sdk/engage/types/campaign-def.js +1 -1
  121. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  122. package/dist/sdk/engage/types/template-schema.js +1 -1
  123. package/dist/sdk/engage.js +1 -1
  124. package/dist/sdk/errors.js +1 -1
  125. package/dist/sdk/index.js +1 -1
  126. package/dist/sdk/io/index.js +1 -1
  127. package/dist/sdk/io/node-filesystem.js +1 -1
  128. package/dist/sdk/job.js +1 -1
  129. package/dist/sdk/journey.js +1 -1
  130. package/dist/sdk/llm/chat-cache.js +1 -1
  131. package/dist/sdk/llm/index.js +1 -1
  132. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  133. package/dist/sdk/llm/model-factors.js +1 -1
  134. package/dist/sdk/personalization.js +1 -1
  135. package/dist/sdk/policy.js +1 -1
  136. package/dist/sdk/query/index.js +1 -1
  137. package/dist/sdk/query/sql-parser.js +1 -1
  138. package/dist/sdk/realtime.js +1 -1
  139. package/dist/sdk/schedule.js +1 -1
  140. package/dist/sdk/segment/child-segment-yaml.d.ts +4 -1
  141. package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
  142. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  143. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  144. package/dist/sdk/segment/fields-display.js +1 -1
  145. package/dist/sdk/segment/file-discovery.js +1 -1
  146. package/dist/sdk/segment/journey-utils.js +1 -1
  147. package/dist/sdk/segment/journey-validator.js +1 -1
  148. package/dist/sdk/segment/journey-yaml.js +1 -1
  149. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  150. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  151. package/dist/sdk/segment/pull-workflow.js +1 -1
  152. package/dist/sdk/segment/push-recovery.js +1 -1
  153. package/dist/sdk/segment/push-workflow.js +1 -1
  154. package/dist/sdk/segment/resolution-context.js +1 -1
  155. package/dist/sdk/segment/segment-path-parser.js +1 -1
  156. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  157. package/dist/sdk/segment/segment-validator.js +1 -1
  158. package/dist/sdk/segment/target-resolution.js +1 -1
  159. package/dist/sdk/segment/tdx-config.js +1 -1
  160. package/dist/sdk/segment/types/activation-schema.js +1 -1
  161. package/dist/sdk/segment/types/journey-def.js +1 -1
  162. package/dist/sdk/segment/types/journey-schema.js +1 -1
  163. package/dist/sdk/segment/types/segment-def.js +1 -1
  164. package/dist/sdk/segment/types/segment-schema.js +1 -1
  165. package/dist/sdk/segment/validate-files.js +1 -1
  166. package/dist/sdk/segment/yaml-validator.js +1 -1
  167. package/dist/sdk/segment.js +1 -1
  168. package/dist/sdk/types/index.js +1 -1
  169. package/dist/sdk/types/progress.js +1 -1
  170. package/dist/sdk/types/workspace.js +1 -1
  171. package/dist/sdk/user.js +1 -1
  172. package/dist/sdk/util/format-detector.js +1 -1
  173. package/dist/sdk/util/formatters.js +1 -1
  174. package/dist/sdk/util/index.js +1 -1
  175. package/dist/sdk/util/paginate.js +1 -1
  176. package/dist/sdk/util/tree-formatter.js +1 -1
  177. package/dist/sdk/workflow/archive-validation.js +1 -1
  178. package/dist/sdk/workflow/clone-workflow.js +1 -1
  179. package/dist/sdk/workflow/index.js +1 -1
  180. package/dist/sdk/workflow/pull-workflow.js +1 -1
  181. package/dist/sdk/workflow/push-workflow.js +1 -1
  182. package/dist/sdk/workflow/tdx-config.js +1 -1
  183. package/dist/sdk/workflow/workflow-utils.js +1 -1
  184. package/dist/sdk/workspace/frontmatter.js +1 -1
  185. package/dist/sdk/workspace/git.js +1 -1
  186. package/dist/sdk/workspace/index.js +1 -1
  187. package/dist/sdk/workspace/templates.js +1 -1
  188. package/dist/sdk/workspace/weekly.js +1 -1
  189. package/dist/sdk/workspace/wikilinks.js +1 -1
  190. package/dist/test-utils/command-runner.js +1 -1
  191. package/dist/test-utils/factories.js +1 -1
  192. package/dist/test-utils/fixtures.js +1 -1
  193. package/dist/test-utils/http-mock.js +1 -1
  194. package/dist/test-utils/index.js +1 -1
  195. package/dist/utils/async.js +1 -1
  196. package/dist/utils/colors.js +1 -1
  197. package/dist/utils/diff.js +1 -1
  198. package/dist/utils/file-permissions.js +1 -1
  199. package/dist/utils/file-reader.js +1 -1
  200. package/dist/utils/github-releases.js +1 -1
  201. package/dist/utils/global-cache.js +1 -1
  202. package/dist/utils/json-loader.js +1 -1
  203. package/dist/utils/local-cache.js +1 -1
  204. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  205. package/dist/utils/logger/formatters/index.js +1 -1
  206. package/dist/utils/logger/handlers/console-handler.js +1 -1
  207. package/dist/utils/logger/handlers/file-handler.js +1 -1
  208. package/dist/utils/logger/handlers/index.js +1 -1
  209. package/dist/utils/logger/handlers/null-handler.js +1 -1
  210. package/dist/utils/logger/index.js +1 -1
  211. package/dist/utils/logger/logger.js +1 -1
  212. package/dist/utils/logger/types.js +1 -1
  213. package/dist/utils/option-validation.js +1 -1
  214. package/dist/utils/process.js +1 -1
  215. package/dist/utils/prompt.js +1 -1
  216. package/dist/utils/spinner.js +1 -1
  217. package/dist/utils/sse-parser.js +1 -1
  218. package/dist/utils/string-utils.js +1 -1
  219. package/dist/utils/table-ref-parser.js +1 -1
  220. package/dist/utils/tdx-logger.js +1 -1
  221. package/dist/utils/version-check.js +1 -1
  222. package/package.json +1 -1
@@ -1 +1 @@
1
- const a58_0x594233=a58_0x5c62;(function(_0x2424e1,_0x2a4d1e){const _0x32870f=a58_0x5c62,_0x30d411=_0x2424e1();while(!![]){try{const _0x504239=-parseInt(_0x32870f(0x1fc))/0x1+parseInt(_0x32870f(0x1fe))/0x2+-parseInt(_0x32870f(0x1df))/0x3+parseInt(_0x32870f(0x21e))/0x4*(-parseInt(_0x32870f(0x210))/0x5)+parseInt(_0x32870f(0x1e3))/0x6*(-parseInt(_0x32870f(0x203))/0x7)+parseInt(_0x32870f(0x207))/0x8*(-parseInt(_0x32870f(0x20e))/0x9)+parseInt(_0x32870f(0x1f7))/0xa*(parseInt(_0x32870f(0x222))/0xb);if(_0x504239===_0x2a4d1e)break;else _0x30d411['push'](_0x30d411['shift']());}catch(_0x315ab6){_0x30d411['push'](_0x30d411['shift']());}}}(a58_0x42e8,0xdacf3));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a58_0x58a3ee from'node:fs';import*as a58_0x36f69b from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a58_0x2af573 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x5eafb7=a58_0x5c62;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x5eafb7(0x1f6),'tdx');}export function getConfigFile(){const _0x5ad3e2=a58_0x5c62;return join(getConfigDir(),_0x5ad3e2(0x1f8));}export function getConfigFilePath(_0x5b3d1f){const _0x1a09fa=a58_0x5c62,_0x281bbf=getConfigDir();return _0x5b3d1f?a58_0x36f69b['join'](_0x281bbf,_0x1a09fa(0x1dd)+_0x5b3d1f):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache('llm_default_project','config/llm-project');export function getLLMProjectCacheFile(_0x5e314c){const _0x2c15dd=a58_0x5c62;return llmProjectCache[_0x2c15dd(0x1dc)](_0x5e314c);}export function readCachedLLMProject(_0x1348fe){const _0x3ce0cd=a58_0x5c62,_0x282737=llmProjectCache['read'](_0x1348fe);if(_0x282737&&typeof _0x282737['id']===_0x3ce0cd(0x204)&&typeof _0x282737[_0x3ce0cd(0x21b)]===_0x3ce0cd(0x204))return _0x282737;return null;}export function writeCachedLLMProject(_0x19f6c6,_0x10588a,_0x18be97){const _0x4c9a5f=a58_0x5c62;try{llmProjectCache[_0x4c9a5f(0x1fd)]({'name':_0x19f6c6,'id':_0x10588a},_0x18be97);}catch{}}const llmAgentCache=createOptionalProfileCache(a58_0x594233(0x214),a58_0x594233(0x1fa));export function getLLMAgentCacheFile(_0x43b0f8){return llmAgentCache['path'](_0x43b0f8);}export function readCachedLLMAgent(_0x29d4b1){const _0x5a8b77=a58_0x594233,_0x173c46=llmAgentCache[_0x5a8b77(0x228)](_0x29d4b1);if(_0x173c46&&typeof _0x173c46['id']==='string'&&typeof _0x173c46[_0x5a8b77(0x21b)]===_0x5a8b77(0x204)&&typeof _0x173c46['projectId']==='string')return _0x173c46;return null;}function a58_0x5c62(_0x50baf3,_0x385b3e){_0x50baf3=_0x50baf3-0x1db;const _0x42e888=a58_0x42e8();let _0x5c629e=_0x42e888[_0x50baf3];return _0x5c629e;}export function writeCachedLLMAgent(_0x2c92a6,_0x4cb606,_0x3f0c40,_0x4c5ee9){const _0x1c922c=a58_0x594233;try{llmAgentCache[_0x1c922c(0x1fd)]({'name':_0x2c92a6,'id':_0x4cb606,'projectId':_0x3f0c40},_0x4c5ee9);}catch{}}export function clearCachedLLMAgent(_0x543402){const _0x54e487=a58_0x594233;try{llmAgentCache[_0x54e487(0x217)](_0x543402);}catch{}}const accountInfoCache=createOptionalProfileCache(a58_0x594233(0x1f3),a58_0x594233(0x208),{'suffix':a58_0x594233(0x1ea)});export function getAccountInfoCacheFile(_0x33370a){const _0x4fc902=a58_0x594233;return accountInfoCache[_0x4fc902(0x1dc)](_0x33370a);}export function readCachedAccountInfo(_0x5bf761){const _0x2c2162=a58_0x594233,_0x401a00=accountInfoCache['read'](_0x5bf761);if(_0x401a00&&typeof _0x401a00[_0x2c2162(0x21f)]===_0x2c2162(0x204)&&typeof _0x401a00['accountId']==='number')return _0x401a00;return null;}export function writeCachedAccountInfo(_0x1fe884,_0x3f95d2,_0x4e54f8){const _0x2c76a8=a58_0x594233;try{accountInfoCache[_0x2c76a8(0x1fd)]({'site':_0x1fe884,'accountId':_0x3f95d2,'cachedAt':new Date()[_0x2c76a8(0x1f1)]()},_0x4e54f8);}catch{}}export function parseEnvFile(_0x974f52){const _0x1bb53a=a58_0x594233,_0xfc9f61={};for(const _0x4f64d8 of _0x974f52[_0x1bb53a(0x212)]('\x0a')){const _0x285923=_0x4f64d8[_0x1bb53a(0x211)]();if(!_0x285923||_0x285923[_0x1bb53a(0x216)]('#'))continue;const _0x2acf90=_0x285923[_0x1bb53a(0x1eb)](/^([^=]+)=(.*)$/);if(_0x2acf90){const _0x5ee738=_0x2acf90[0x1][_0x1bb53a(0x211)]();let _0x62ef0a=_0x2acf90[0x2][_0x1bb53a(0x211)]();(_0x62ef0a['startsWith']('\x22')&&_0x62ef0a[_0x1bb53a(0x1f2)]('\x22')||_0x62ef0a[_0x1bb53a(0x216)]('\x27')&&_0x62ef0a[_0x1bb53a(0x1f2)]('\x27'))&&(_0x62ef0a=_0x62ef0a[_0x1bb53a(0x225)](0x1,-0x1)),_0xfc9f61[_0x5ee738]=_0x62ef0a;}}return _0xfc9f61;}export function readUserConfig(){const _0x438404=a58_0x594233,_0x5c888b=getConfigFile();if(!existsSync(_0x5c888b))return{};try{const _0x1f66b1=readFileSync(_0x5c888b,_0x438404(0x226));return parseEnvFile(_0x1f66b1);}catch(_0x156dc8){return console['warn'](_0x438404(0x1f0)+_0x5c888b+':',_0x156dc8),{};}}export function resolveSite(_0x36b9be){const _0xb3f777=a58_0x594233,_0x30fcc6=[_0xb3f777(0x220),_0xb3f777(0x1e9),_0xb3f777(0x21c),_0xb3f777(0x1f9),_0xb3f777(0x1e5),_0xb3f777(0x209),'dev-eu01','stg-us01','stg-ap01',_0xb3f777(0x1ed)];if(_0x30fcc6[_0xb3f777(0x201)](_0x36b9be))return _0x36b9be;if(_0x36b9be in SITE_ALIASES)return SITE_ALIASES[_0x36b9be];return console['warn'](_0xb3f777(0x213)+_0x36b9be+'\x27,\x20defaulting\x20to\x20us01'),_0xb3f777(0x220);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x5bf51e){const _0x19d715=a58_0x594233,_0x18a823=_0x5bf51e||getActiveProfileName()||undefined;if(_0x18a823){const _0x504f23=_0x19d715(0x1e8)+normalizeProfileForEnvVar(_0x18a823);if(process.env[_0x504f23])return{'accessToken':process.env[_0x504f23],'source':_0x504f23+_0x19d715(0x1e7)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x19d715(0x1e2)};return null;}export function getAccessToken(_0x3402d0){const _0x3822bf=a58_0x594233;return resolveAccessToken(_0x3402d0)?.[_0x3822bf(0x20b)];}export function getAPIKey(_0x2d7791){const _0x323f74=_0x2d7791||getActiveProfileName();if(_0x323f74){const _0x9cd109='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x323f74);if(process.env[_0x9cd109])return process.env[_0x9cd109];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x4c98fc){const _0x5c6956=a58_0x594233;return _0x4c98fc[_0x5c6956(0x20a)]()[_0x5c6956(0x20d)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0xe0cc7,_0x35e8a2){const _0x593b04=a58_0x594233,_0x9a0be4=resolveAccessToken(_0x35e8a2);if(_0x9a0be4)return{'apiKey':_0x9a0be4[_0x593b04(0x20b)],'source':_0x9a0be4[_0x593b04(0x1e4)],'isDeprecated':![]};const _0x2f94a2=_0x35e8a2||getActiveProfileName()||undefined;if(_0x2f94a2){const _0x421e37=_0x593b04(0x219)+normalizeProfileForEnvVar(_0x2f94a2);if(process.env[_0x421e37])return{'apiKey':process.env[_0x421e37],'source':_0x421e37+'\x20env\x20var','isDeprecated':![]};const _0x5b0e37=getCachedCredential(_0xe0cc7,_0x2f94a2);if(_0x5b0e37)return{'apiKey':_0x5b0e37,'source':_0x593b04(0x200)+_0x2f94a2+')','isDeprecated':![]};const _0x35bf2f=await getKeychainAPIKey(_0x2f94a2);if(_0x35bf2f)return setCachedCredential(_0x35bf2f,_0xe0cc7,_0x2f94a2),{'apiKey':_0x35bf2f,'source':'keychain\x20(profile:\x20'+_0x2f94a2+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x593b04(0x1fb),'isDeprecated':![]};if(!_0x2f94a2){const _0x3a295=getCachedCredential(_0xe0cc7,undefined);if(_0x3a295)return{'apiKey':_0x3a295,'source':_0x593b04(0x21a),'isDeprecated':![]};const _0x52ec71=await getKeychainAPIKey(undefined);if(_0x52ec71)return setCachedCredential(_0x52ec71,_0xe0cc7,undefined),{'apiKey':_0x52ec71,'source':_0x593b04(0x21a),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x504adc,_0x21828c){const _0x30a46b=a58_0x594233,_0x3c9bec=await resolveAPIKeyAsync(_0x504adc,_0x21828c);return _0x3c9bec?.[_0x30a46b(0x205)];}function cleanupLegacyEnvFile(_0xde3b87){const _0x59f18e=a58_0x594233;if(!existsSync(_0xde3b87))return![];try{const _0x23047d=readFileSync(_0xde3b87,_0x59f18e(0x226)),_0x5ab593=_0x23047d[_0x59f18e(0x212)]('\x0a'),_0x2002b0=_0x5ab593[_0x59f18e(0x1e1)](_0x34b37d=>{const _0x44100f=_0x59f18e,_0x4042eb=_0x34b37d[_0x44100f(0x211)]();if(!_0x4042eb||_0x4042eb[_0x44100f(0x216)]('#'))return!![];const [_0x4dff51]=_0x4042eb[_0x44100f(0x212)]('=');return!_0x4dff51[_0x44100f(0x216)](_0x44100f(0x1db));}),_0x1f953a=_0x2002b0[_0x59f18e(0x227)](_0x3811ae=>{const _0x243446=_0x59f18e,_0x36fbd3=_0x3811ae[_0x243446(0x211)]();return _0x36fbd3&&!_0x36fbd3['startsWith']('#');});if(!_0x1f953a)return unlinkSync(_0xde3b87),!![];return writeFileSync(_0xde3b87,_0x2002b0['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x3a5d22=a58_0x594233;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x118b1a=a58_0x36f69b['join'](getConfigDir(),_0x3a5d22(0x202));if(!a58_0x58a3ee['existsSync'](_0x118b1a))return null;try{const _0x22472f=a58_0x58a3ee[_0x3a5d22(0x1ff)](_0x118b1a,_0x3a5d22(0x226)),_0x5b3742=JSON[_0x3a5d22(0x1e0)](_0x22472f);return _0x5b3742['profile']||null;}catch{return null;}}function a58_0x42e8(){const _0x5bc2dc=['stg-ap01','dev-eu01','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','toISOString','endsWith','account_info','proxy','next','.config','30tLUeUy','.env','ap02','config/llm-agent','TDX_API_KEY\x20env\x20var','1426200HQRIKt','write','739098PPqoea','readFileSync','keychain\x20(profile:\x20','includes','tdx.json','1224097oRhQQW','string','apiKey','apiKeys','96aGtmpy','config/account-info','dev-us01','toUpperCase','accessToken','stringify','replace','5328XKdVPc','join','3179170uTXeNr','trim','split','Warning:\x20Unknown\x20site\x20\x27','llm_default_agent','release_channel','startsWith','clear','TD_API_KEY_','TDX_API_KEY_','keychain','name','eu01','map','8wElgaN','site','us01','Warning:\x20Failed\x20to\x20read\x20','18475941TyCWfw','stable','existsSync','slice','utf-8','some','read','TD_API_KEY','path','.env.','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','2274003doGlWA','parse','filter','TDX_ACCESS_TOKEN\x20env\x20var','36mXrZvS','source','ap03','entries','\x20env\x20var','TDX_ACCESS_TOKEN_','ap01','.json','match','warn','stg-ap03'];a58_0x42e8=function(){return _0x5bc2dc;};return a58_0x42e8();}export function saveAPIKey(_0x3f0007,_0x5bc454,_0x6d5050){const _0x419c77=a58_0x594233,_0xaf4a6a=getConfigDir(),_0x5a69ea=getConfigFilePath(_0x6d5050);!existsSync(_0xaf4a6a)&&mkdirSync(_0xaf4a6a,{'recursive':!![],'mode':0x1c0});let _0x23584e={};if(existsSync(_0x5a69ea))try{const _0x54e9fb=readFileSync(_0x5a69ea,_0x419c77(0x226));_0x23584e=parseEnvFile(_0x54e9fb);}catch(_0x53839c){console['warn'](_0x419c77(0x221)+_0x5a69ea+':',_0x53839c);}const _0x268ba7=_0x3f0007[_0x419c77(0x20a)]()[_0x419c77(0x20d)](/-/g,'_');_0x23584e[_0x419c77(0x218)+_0x268ba7]=_0x5bc454;const _0x8f214c=Object[_0x419c77(0x1e6)](_0x23584e)[_0x419c77(0x21d)](([_0x15c9a7,_0x185e9d])=>_0x15c9a7+'='+_0x185e9d);writeFileSync(_0x5a69ea,_0x8f214c[_0x419c77(0x20f)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x55c596,_0x4d9ec3,_0x517cd0){const _0x1bb3f3=a58_0x594233;await saveKeychainAPIKey(_0x55c596,_0x517cd0),setCachedCredential(_0x55c596,_0x4d9ec3,_0x517cd0);const _0x277387=getConfigFilePath(_0x517cd0);cleanupLegacyEnvFile(_0x277387)&&console[_0x1bb3f3(0x1ec)](a58_0x2af573['yellow'](_0x1bb3f3(0x1de)));}export function loadConfig(){const _0x455e0d=a58_0x594233,_0x140859={'apiKeys':{},'defaultSite':_0x455e0d(0x220)},_0x1d8adf=[_0x455e0d(0x220),_0x455e0d(0x1e9),'eu01',_0x455e0d(0x1f9),_0x455e0d(0x1e5),_0x455e0d(0x209),_0x455e0d(0x1ef),'stg-us01',_0x455e0d(0x1ee),'stg-ap03'],_0x29ae91=getAPIKey();if(_0x29ae91)for(const _0x2d6cb3 of _0x1d8adf){_0x140859[_0x455e0d(0x206)][_0x2d6cb3]=_0x29ae91;}return _0x140859;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}export function loadGlobalProxy(){const _0x598895=a58_0x594233,_0x12cc4a=a58_0x36f69b[_0x598895(0x20f)](getConfigDir(),_0x598895(0x202));if(!a58_0x58a3ee['existsSync'](_0x12cc4a))return undefined;try{const _0x239163=a58_0x58a3ee['readFileSync'](_0x12cc4a,_0x598895(0x226)),_0x93a63e=JSON[_0x598895(0x1e0)](_0x239163);return typeof _0x93a63e[_0x598895(0x1f4)]===_0x598895(0x204)?_0x93a63e[_0x598895(0x1f4)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x2e9878=a58_0x594233,_0x2399f9=process.env.TDX_RELEASE_CHANNEL;if(_0x2399f9===_0x2e9878(0x1f5)||_0x2399f9===_0x2e9878(0x223))return _0x2399f9;const _0x416169=a58_0x36f69b[_0x2e9878(0x20f)](getConfigDir(),_0x2e9878(0x202));if(!a58_0x58a3ee[_0x2e9878(0x224)](_0x416169))return _0x2e9878(0x223);try{const _0x16bbb5=a58_0x58a3ee[_0x2e9878(0x1ff)](_0x416169,_0x2e9878(0x226)),_0x35fbd2=JSON['parse'](_0x16bbb5);if(_0x35fbd2[_0x2e9878(0x215)]===_0x2e9878(0x1f5))return _0x2e9878(0x1f5);}catch{}return _0x2e9878(0x223);}export function saveReleaseChannel(_0x40d1dd){const _0x2e9795=a58_0x594233,_0x4cc042=getConfigDir(),_0x21f9c1=a58_0x36f69b[_0x2e9795(0x20f)](_0x4cc042,_0x2e9795(0x202));!existsSync(_0x4cc042)&&mkdirSync(_0x4cc042,{'recursive':!![],'mode':0x1c0});let _0x537826={};if(existsSync(_0x21f9c1))try{const _0x46a40e=readFileSync(_0x21f9c1,'utf-8');_0x537826=JSON['parse'](_0x46a40e);}catch{}_0x537826[_0x2e9795(0x215)]=_0x40d1dd,writeFileSync(_0x21f9c1,JSON[_0x2e9795(0x20c)](_0x537826,null,0x2),{'mode':0x180});}
1
+ const a58_0x2f7d01=a58_0x25e6;(function(_0x2a9437,_0x2ec3d1){const _0x4b0e45=a58_0x25e6,_0x44cb54=_0x2a9437();while(!![]){try{const _0x2f70c6=parseInt(_0x4b0e45(0x11b))/0x1+-parseInt(_0x4b0e45(0x11d))/0x2+-parseInt(_0x4b0e45(0x122))/0x3+-parseInt(_0x4b0e45(0x123))/0x4*(-parseInt(_0x4b0e45(0x14f))/0x5)+parseInt(_0x4b0e45(0x13d))/0x6*(parseInt(_0x4b0e45(0x12a))/0x7)+parseInt(_0x4b0e45(0x142))/0x8*(-parseInt(_0x4b0e45(0x146))/0x9)+-parseInt(_0x4b0e45(0x11e))/0xa;if(_0x2f70c6===_0x2ec3d1)break;else _0x44cb54['push'](_0x44cb54['shift']());}catch(_0x49df2e){_0x44cb54['push'](_0x44cb54['shift']());}}}(a58_0x4e4e,0x2d01f));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a58_0x5c3ebb from'node:fs';import*as a58_0x5bfae1 from'node:path';import{SITE_ALIASES}from'../sdk/types/index.js';import{getKeychainAPIKey,saveKeychainAPIKey}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a58_0x3b5eb9 from'chalk';import{getGlobalCacheDir,createOptionalProfileCache}from'../utils/global-cache.js';export function getConfigDir(){const _0x5699dc=a58_0x25e6;return process.env.TDX_CONFIG_DIR||join(homedir(),_0x5699dc(0x119),_0x5699dc(0x148));}export function getConfigFile(){const _0x56a4f8=a58_0x25e6;return join(getConfigDir(),_0x56a4f8(0x137));}export function getConfigFilePath(_0x96ff89){const _0x39e546=a58_0x25e6,_0x5c6536=getConfigDir();return _0x96ff89?a58_0x5bfae1['join'](_0x5c6536,_0x39e546(0x13e)+_0x96ff89):getConfigFile();}export function getCacheDir(){return getGlobalCacheDir();}const llmProjectCache=createOptionalProfileCache('llm_default_project',a58_0x2f7d01(0x10d));export function getLLMProjectCacheFile(_0x394977){return llmProjectCache['path'](_0x394977);}export function readCachedLLMProject(_0x328fa0){const _0x595f9c=a58_0x2f7d01,_0x274088=llmProjectCache[_0x595f9c(0x154)](_0x328fa0);if(_0x274088&&typeof _0x274088['id']===_0x595f9c(0x132)&&typeof _0x274088[_0x595f9c(0x153)]===_0x595f9c(0x132))return _0x274088;return null;}export function writeCachedLLMProject(_0x368b7a,_0x46834f,_0x3e27dd){const _0x357255=a58_0x2f7d01;try{llmProjectCache[_0x357255(0x129)]({'name':_0x368b7a,'id':_0x46834f},_0x3e27dd);}catch{}}const llmAgentCache=createOptionalProfileCache(a58_0x2f7d01(0x13b),a58_0x2f7d01(0x13c));export function getLLMAgentCacheFile(_0xbfd691){const _0x10c995=a58_0x2f7d01;return llmAgentCache[_0x10c995(0x14e)](_0xbfd691);}export function readCachedLLMAgent(_0x132685){const _0x4f8c38=a58_0x2f7d01,_0x5bf96b=llmAgentCache[_0x4f8c38(0x154)](_0x132685);if(_0x5bf96b&&typeof _0x5bf96b['id']==='string'&&typeof _0x5bf96b[_0x4f8c38(0x153)]===_0x4f8c38(0x132)&&typeof _0x5bf96b[_0x4f8c38(0x116)]==='string')return _0x5bf96b;return null;}export function writeCachedLLMAgent(_0x5b27d6,_0xa280a7,_0x1df697,_0x3eacae){const _0x1c60fd=a58_0x2f7d01;try{llmAgentCache[_0x1c60fd(0x129)]({'name':_0x5b27d6,'id':_0xa280a7,'projectId':_0x1df697},_0x3eacae);}catch{}}export function clearCachedLLMAgent(_0x1be921){const _0x4ab0eb=a58_0x2f7d01;try{llmAgentCache[_0x4ab0eb(0x115)](_0x1be921);}catch{}}const accountInfoCache=createOptionalProfileCache(a58_0x2f7d01(0x111),a58_0x2f7d01(0x113),{'suffix':'.json'});export function getAccountInfoCacheFile(_0x3cb80c){return accountInfoCache['path'](_0x3cb80c);}export function readCachedAccountInfo(_0x5dee76){const _0x21fe70=a58_0x2f7d01,_0x147cd5=accountInfoCache['read'](_0x5dee76);if(_0x147cd5&&typeof _0x147cd5[_0x21fe70(0x12f)]===_0x21fe70(0x132)&&typeof _0x147cd5[_0x21fe70(0x12b)]==='number')return _0x147cd5;return null;}export function writeCachedAccountInfo(_0x56df0f,_0x5f773a,_0x15ce1f){const _0x4dc522=a58_0x2f7d01;try{accountInfoCache[_0x4dc522(0x129)]({'site':_0x56df0f,'accountId':_0x5f773a,'cachedAt':new Date()[_0x4dc522(0x128)]()},_0x15ce1f);}catch{}}export function parseEnvFile(_0x26776f){const _0x3ac1f8=a58_0x2f7d01,_0x113cae={};for(const _0x173f9a of _0x26776f[_0x3ac1f8(0x110)]('\x0a')){const _0x7bba66=_0x173f9a[_0x3ac1f8(0x13a)]();if(!_0x7bba66||_0x7bba66[_0x3ac1f8(0x134)]('#'))continue;const _0x2bb5c4=_0x7bba66[_0x3ac1f8(0x13f)](/^([^=]+)=(.*)$/);if(_0x2bb5c4){const _0x21a7c7=_0x2bb5c4[0x1][_0x3ac1f8(0x13a)]();let _0xfb05bd=_0x2bb5c4[0x2]['trim']();(_0xfb05bd[_0x3ac1f8(0x134)]('\x22')&&_0xfb05bd['endsWith']('\x22')||_0xfb05bd[_0x3ac1f8(0x134)]('\x27')&&_0xfb05bd['endsWith']('\x27'))&&(_0xfb05bd=_0xfb05bd['slice'](0x1,-0x1)),_0x113cae[_0x21a7c7]=_0xfb05bd;}}return _0x113cae;}export function readUserConfig(){const _0x3198a2=a58_0x2f7d01,_0x3a111e=getConfigFile();if(!existsSync(_0x3a111e))return{};try{const _0x232095=readFileSync(_0x3a111e,_0x3198a2(0x14c));return parseEnvFile(_0x232095);}catch(_0x38b3a9){return console[_0x3198a2(0x11c)]('Warning:\x20Failed\x20to\x20read\x20config\x20file\x20'+_0x3a111e+':',_0x38b3a9),{};}}export function resolveSite(_0x362e36){const _0x228c91=a58_0x2f7d01,_0x2b6efe=[_0x228c91(0x124),_0x228c91(0x14d),_0x228c91(0x11f),_0x228c91(0x149),_0x228c91(0x156),_0x228c91(0x10b),_0x228c91(0x12c),_0x228c91(0x155),_0x228c91(0x157),_0x228c91(0x140)];if(_0x2b6efe[_0x228c91(0x131)](_0x362e36))return _0x362e36;if(_0x362e36 in SITE_ALIASES)return SITE_ALIASES[_0x362e36];return console[_0x228c91(0x11c)](_0x228c91(0x138)+_0x362e36+_0x228c91(0x125)),_0x228c91(0x124);}let cachedUserConfig=null;function a58_0x4e4e(){const _0x2f4fb6=['release_channel','keychain','replace','202347oSKIeA','Warning:\x20Failed\x20to\x20read\x20','tdx','ap02','map','toUpperCase','utf-8','ap01','path','13920zNnswy','stringify','some','parse','name','read','stg-us01','ap03','stg-ap01','dev-us01','next','config/llm-project','keychain\x20(profile:\x20','TDX_API_KEY_','split','account_info','accessToken','config/account-info','\x20env\x20var','clear','projectId','tdx.json','existsSync','.config','TDX_API_KEY\x20env\x20var','339666MVuGis','warn','263888LLdUMg','1152610eccHhq','eu01','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','TDX_ACCESS_TOKEN_','32031yRuZoz','140fXEwlb','us01','\x27,\x20defaulting\x20to\x20us01','stable','apiKeys','toISOString','write','7uEOPnY','accountId','dev-eu01','yellow','proxy','site','readFileSync','includes','string','source','startsWith','join','TD_API_KEY','.env','Warning:\x20Unknown\x20site\x20\x27','profile','trim','llm_default_agent','config/llm-agent','570354twLbFV','.env.','match','stg-ap03','TDX_ACCESS_TOKEN\x20env\x20var','32XFdTVc'];a58_0x4e4e=function(){return _0x2f4fb6;};return a58_0x4e4e();}export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function resolveAccessToken(_0x9eb787){const _0x317215=a58_0x2f7d01,_0x5dc726=_0x9eb787||getActiveProfileName()||undefined;if(_0x5dc726){const _0xdca69c=_0x317215(0x121)+normalizeProfileForEnvVar(_0x5dc726);if(process.env[_0xdca69c])return{'accessToken':process.env[_0xdca69c],'source':_0xdca69c+_0x317215(0x114)};}if(process.env.TDX_ACCESS_TOKEN)return{'accessToken':process.env.TDX_ACCESS_TOKEN,'source':_0x317215(0x141)};return null;}export function getAccessToken(_0x8b84f2){const _0x38187d=a58_0x2f7d01;return resolveAccessToken(_0x8b84f2)?.[_0x38187d(0x112)];}export function getAPIKey(_0x136b90){const _0x4bb8fe=a58_0x2f7d01,_0x46f153=_0x136b90||getActiveProfileName();if(_0x46f153){const _0x10e628=_0x4bb8fe(0x10f)+normalizeProfileForEnvVar(_0x46f153);if(process.env[_0x10e628])return process.env[_0x10e628];}if(process.env.TDX_API_KEY)return process.env.TDX_API_KEY;return undefined;}export function normalizeProfileForEnvVar(_0x35ec06){const _0x3e7df2=a58_0x2f7d01;return _0x35ec06['toUpperCase']()[_0x3e7df2(0x145)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x5d6d5b,_0x28199b){const _0x209401=a58_0x2f7d01,_0xd1374a=resolveAccessToken(_0x28199b);if(_0xd1374a)return{'apiKey':_0xd1374a[_0x209401(0x112)],'source':_0xd1374a[_0x209401(0x133)],'isDeprecated':![]};const _0x3e97a6=_0x28199b||getActiveProfileName()||undefined;if(_0x3e97a6){const _0x205d05='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x3e97a6);if(process.env[_0x205d05])return{'apiKey':process.env[_0x205d05],'source':_0x205d05+_0x209401(0x114),'isDeprecated':![]};const _0x192252=getCachedCredential(_0x5d6d5b,_0x3e97a6);if(_0x192252)return{'apiKey':_0x192252,'source':_0x209401(0x10e)+_0x3e97a6+')','isDeprecated':![]};const _0x20a5e8=await getKeychainAPIKey(_0x3e97a6);if(_0x20a5e8)return setCachedCredential(_0x20a5e8,_0x5d6d5b,_0x3e97a6),{'apiKey':_0x20a5e8,'source':_0x209401(0x10e)+_0x3e97a6+')','isDeprecated':![]};}if(process.env.TDX_API_KEY)return{'apiKey':process.env.TDX_API_KEY,'source':_0x209401(0x11a),'isDeprecated':![]};if(!_0x3e97a6){const _0x51050f=getCachedCredential(_0x5d6d5b,undefined);if(_0x51050f)return{'apiKey':_0x51050f,'source':'keychain','isDeprecated':![]};const _0x99d180=await getKeychainAPIKey(undefined);if(_0x99d180)return setCachedCredential(_0x99d180,_0x5d6d5b,undefined),{'apiKey':_0x99d180,'source':_0x209401(0x144),'isDeprecated':![]};}return null;}export async function getAPIKeyAsync(_0x28630f,_0x399572){const _0x34057e=await resolveAPIKeyAsync(_0x28630f,_0x399572);return _0x34057e?.['apiKey'];}function cleanupLegacyEnvFile(_0x319f85){const _0x3c31e5=a58_0x2f7d01;if(!existsSync(_0x319f85))return![];try{const _0xb8044a=readFileSync(_0x319f85,_0x3c31e5(0x14c)),_0x12a304=_0xb8044a[_0x3c31e5(0x110)]('\x0a'),_0x471991=_0x12a304['filter'](_0x554b27=>{const _0x305e22=_0x3c31e5,_0xc242cc=_0x554b27['trim']();if(!_0xc242cc||_0xc242cc['startsWith']('#'))return!![];const [_0x2ff074]=_0xc242cc[_0x305e22(0x110)]('=');return!_0x2ff074[_0x305e22(0x134)](_0x305e22(0x136));}),_0x11bc68=_0x471991[_0x3c31e5(0x151)](_0x146054=>{const _0x10988e=_0x3c31e5,_0x583475=_0x146054[_0x10988e(0x13a)]();return _0x583475&&!_0x583475[_0x10988e(0x134)]('#');});if(!_0x11bc68)return unlinkSync(_0x319f85),!![];return writeFileSync(_0x319f85,_0x471991['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function getActiveProfileName(){const _0x4d98f1=a58_0x2f7d01;if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x399ff7=a58_0x5bfae1[_0x4d98f1(0x135)](getConfigDir(),_0x4d98f1(0x117));if(!a58_0x5c3ebb[_0x4d98f1(0x118)](_0x399ff7))return null;try{const _0xc2d74c=a58_0x5c3ebb[_0x4d98f1(0x130)](_0x399ff7,'utf-8'),_0x53e3af=JSON[_0x4d98f1(0x152)](_0xc2d74c);return _0x53e3af[_0x4d98f1(0x139)]||null;}catch{return null;}}export function saveAPIKey(_0x5cc51a,_0x505d2c,_0x2ba1b6){const _0x5eb3d6=a58_0x2f7d01,_0x1fc449=getConfigDir(),_0xba26a5=getConfigFilePath(_0x2ba1b6);!existsSync(_0x1fc449)&&mkdirSync(_0x1fc449,{'recursive':!![],'mode':0x1c0});let _0x3434e5={};if(existsSync(_0xba26a5))try{const _0x4e63b1=readFileSync(_0xba26a5,_0x5eb3d6(0x14c));_0x3434e5=parseEnvFile(_0x4e63b1);}catch(_0x35190b){console[_0x5eb3d6(0x11c)](_0x5eb3d6(0x147)+_0xba26a5+':',_0x35190b);}const _0x3950b8=_0x5cc51a[_0x5eb3d6(0x14b)]()[_0x5eb3d6(0x145)](/-/g,'_');_0x3434e5['TD_API_KEY_'+_0x3950b8]=_0x505d2c;const _0x33bd44=Object['entries'](_0x3434e5)[_0x5eb3d6(0x14a)](([_0x244210,_0xe3cfc0])=>_0x244210+'='+_0xe3cfc0);writeFileSync(_0xba26a5,_0x33bd44['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x53ac29,_0x1ef46f,_0x1ec2ee){const _0x2cc565=a58_0x2f7d01;await saveKeychainAPIKey(_0x53ac29,_0x1ec2ee),setCachedCredential(_0x53ac29,_0x1ef46f,_0x1ec2ee);const _0x56635c=getConfigFilePath(_0x1ec2ee);cleanupLegacyEnvFile(_0x56635c)&&console[_0x2cc565(0x11c)](a58_0x3b5eb9[_0x2cc565(0x12d)](_0x2cc565(0x120)));}export function loadConfig(){const _0x2f82d4=a58_0x2f7d01,_0x2af9d0={'apiKeys':{},'defaultSite':_0x2f82d4(0x124)},_0x49de62=['us01',_0x2f82d4(0x14d),_0x2f82d4(0x11f),_0x2f82d4(0x149),_0x2f82d4(0x156),_0x2f82d4(0x10b),'dev-eu01',_0x2f82d4(0x155),_0x2f82d4(0x157),_0x2f82d4(0x140)],_0x1649db=getAPIKey();if(_0x1649db)for(const _0x2664b1 of _0x49de62){_0x2af9d0[_0x2f82d4(0x127)][_0x2664b1]=_0x1649db;}return _0x2af9d0;}export function isExperimentalAvailable(){return!!process.env.TDX_EXPERIMENTAL;}function a58_0x25e6(_0x386258,_0x4840f1){_0x386258=_0x386258-0x10b;const _0x4e4e5d=a58_0x4e4e();let _0x25e6e2=_0x4e4e5d[_0x386258];return _0x25e6e2;}export function loadGlobalProxy(){const _0x591562=a58_0x2f7d01,_0x376ce3=a58_0x5bfae1[_0x591562(0x135)](getConfigDir(),_0x591562(0x117));if(!a58_0x5c3ebb['existsSync'](_0x376ce3))return undefined;try{const _0x54830e=a58_0x5c3ebb[_0x591562(0x130)](_0x376ce3,_0x591562(0x14c)),_0x500a57=JSON['parse'](_0x54830e);return typeof _0x500a57[_0x591562(0x12e)]==='string'?_0x500a57[_0x591562(0x12e)]:undefined;}catch{return undefined;}}export function loadReleaseChannel(){const _0x54caaf=a58_0x2f7d01,_0x137e9b=process.env.TDX_RELEASE_CHANNEL;if(_0x137e9b===_0x54caaf(0x10c)||_0x137e9b==='stable')return _0x137e9b;const _0x58f5cd=a58_0x5bfae1[_0x54caaf(0x135)](getConfigDir(),_0x54caaf(0x117));if(!a58_0x5c3ebb[_0x54caaf(0x118)](_0x58f5cd))return _0x54caaf(0x126);try{const _0x3a2754=a58_0x5c3ebb[_0x54caaf(0x130)](_0x58f5cd,_0x54caaf(0x14c)),_0x3304b6=JSON[_0x54caaf(0x152)](_0x3a2754);if(_0x3304b6[_0x54caaf(0x143)]===_0x54caaf(0x10c))return _0x54caaf(0x10c);}catch{}return _0x54caaf(0x126);}export function saveReleaseChannel(_0x1b60ce){const _0x1f7fca=a58_0x2f7d01,_0x1603bf=getConfigDir(),_0xad93ba=a58_0x5bfae1['join'](_0x1603bf,'tdx.json');!existsSync(_0x1603bf)&&mkdirSync(_0x1603bf,{'recursive':!![],'mode':0x1c0});let _0x40076d={};if(existsSync(_0xad93ba))try{const _0x390603=readFileSync(_0xad93ba,_0x1f7fca(0x14c));_0x40076d=JSON['parse'](_0x390603);}catch{}_0x40076d[_0x1f7fca(0x143)]=_0x1b60ce,writeFileSync(_0xad93ba,JSON[_0x1f7fca(0x150)](_0x40076d,null,0x2),{'mode':0x180});}
@@ -1 +1 @@
1
- const a59_0x153abe=a59_0x27fb;(function(_0x15803d,_0x30caf7){const _0x629321=a59_0x27fb,_0x499bd1=_0x15803d();while(!![]){try{const _0x1efc24=parseInt(_0x629321(0xb2))/0x1*(parseInt(_0x629321(0xbf))/0x2)+-parseInt(_0x629321(0xbd))/0x3+-parseInt(_0x629321(0xb8))/0x4*(-parseInt(_0x629321(0xb7))/0x5)+parseInt(_0x629321(0xb5))/0x6+parseInt(_0x629321(0xbc))/0x7+parseInt(_0x629321(0xb3))/0x8*(parseInt(_0x629321(0xb9))/0x9)+-parseInt(_0x629321(0xbb))/0xa;if(_0x1efc24===_0x30caf7)break;else _0x499bd1['push'](_0x499bd1['shift']());}catch(_0x304721){_0x499bd1['push'](_0x499bd1['shift']());}}}(a59_0x3828,0x5e80d));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache(a59_0x153abe(0xbe),a59_0x153abe(0xb4));export function loadCachedConnections(_0x1e4f53){const _0x224f77=a59_0x153abe,_0x2abcb8=connectionCache[_0x224f77(0xb6)](_0x1e4f53);return _0x2abcb8?.['connections']??null;}export function saveCachedConnections(_0x462600,_0x39ff7c){const _0x372c13=a59_0x153abe;connectionCache[_0x372c13(0xc1)](_0x462600,{'connections':_0x39ff7c,'cachedAt':Date[_0x372c13(0xc0)]()});}function a59_0x27fb(_0x361162,_0x5625cd){_0x361162=_0x361162-0xb2;const _0x382814=a59_0x3828();let _0x27fbed=_0x382814[_0x361162];return _0x27fbed;}function a59_0x3828(){const _0x43fd35=['now','write','622331RZFTdO','8JyVxmR','core/connection-cache','1203114TDYJbE','read','820mLCjAA','7768yDKDPp','6776190wGgufl','clear','12254570jBNynQ','1209082SLtkkr','1363296zdoiZD','connections-{profile}.json','2DVoHnn'];a59_0x3828=function(){return _0x43fd35;};return a59_0x3828();}export function clearConnectionCache(_0x531356){const _0x10534d=a59_0x153abe;connectionCache[_0x10534d(0xba)](_0x531356);}
1
+ const a59_0x56b2a6=a59_0x43a0;function a59_0x1b07(){const _0x14d492=['core/connection-cache','connections','6lAtHiH','read','5096470LDHDaM','9oOuliK','1921808UPSkcf','clear','786663BYmKKE','3661136ngoYmD','write','4391685CONhrd','12kiuOEB','10Lffhmb','209383IOUudu','54440023WjxyaM'];a59_0x1b07=function(){return _0x14d492;};return a59_0x1b07();}(function(_0x50230d,_0x1fb141){const _0x327d1c=a59_0x43a0,_0x2566c9=_0x50230d();while(!![]){try{const _0x50295b=-parseInt(_0x327d1c(0xa5))/0x1*(parseInt(_0x327d1c(0xa4))/0x2)+-parseInt(_0x327d1c(0xaf))/0x3*(parseInt(_0x327d1c(0xa3))/0x4)+-parseInt(_0x327d1c(0xa2))/0x5*(parseInt(_0x327d1c(0xa9))/0x6)+-parseInt(_0x327d1c(0xad))/0x7+-parseInt(_0x327d1c(0xb0))/0x8+-parseInt(_0x327d1c(0xac))/0x9*(parseInt(_0x327d1c(0xab))/0xa)+parseInt(_0x327d1c(0xa6))/0xb;if(_0x50295b===_0x1fb141)break;else _0x2566c9['push'](_0x2566c9['shift']());}catch(_0x55e815){_0x2566c9['push'](_0x2566c9['shift']());}}}(a59_0x1b07,0xf3011));import{createProfileCache}from'../utils/global-cache.js';const connectionCache=createProfileCache('connections-{profile}.json',a59_0x56b2a6(0xa7));export function loadCachedConnections(_0x5143c3){const _0x1e9b2c=a59_0x56b2a6,_0x463347=connectionCache[_0x1e9b2c(0xaa)](_0x5143c3);return _0x463347?.[_0x1e9b2c(0xa8)]??null;}function a59_0x43a0(_0x1856da,_0x4f1e68){_0x1856da=_0x1856da-0xa2;const _0x1b07fa=a59_0x1b07();let _0x43a0b6=_0x1b07fa[_0x1856da];return _0x43a0b6;}export function saveCachedConnections(_0x217050,_0x24667b){const _0x2cea66=a59_0x56b2a6;connectionCache[_0x2cea66(0xb1)](_0x217050,{'connections':_0x24667b,'cachedAt':Date['now']()});}export function clearConnectionCache(_0x29933a){const _0xe6c7f6=a59_0x56b2a6;connectionCache[_0xe6c7f6(0xae)](_0x29933a);}
@@ -1 +1 @@
1
- const a60_0x18686e=a60_0x3098;function a60_0x1c8c(){const _0x19933f=['value','trim','push','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','us01','Enter\x20custom\x20site','eu01','test','668030dHPIop','3071341pRwtuw','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','other','log','customSite','500470SVhIId','length','130461BrHgLj','us\x20\x20\x20-\x20United\x20States','eu\x20\x20\x20-\x20Europe','3658743vmNYKA','Cancelled','findIndex','280062oguPdu','site','ap01','1tSnqZU','select','12FmPfuF','Enter\x20site\x20name:','jp\x20\x20\x20-\x20Japan','1757896tzEDRE'];a60_0x1c8c=function(){return _0x19933f;};return a60_0x1c8c();}(function(_0x310922,_0x1e49f9){const _0x34c31d=a60_0x3098,_0x116778=_0x310922();while(!![]){try{const _0x38d1be=parseInt(_0x34c31d(0x1d5))/0x1*(-parseInt(_0x34c31d(0x1ca))/0x2)+parseInt(_0x34c31d(0x1cc))/0x3*(-parseInt(_0x34c31d(0x1d7))/0x4)+parseInt(_0x34c31d(0x1c4))/0x5+-parseInt(_0x34c31d(0x1d2))/0x6+parseInt(_0x34c31d(0x1c5))/0x7+-parseInt(_0x34c31d(0x1da))/0x8+parseInt(_0x34c31d(0x1cf))/0x9;if(_0x38d1be===_0x1e49f9)break;else _0x116778['push'](_0x116778['shift']());}catch(_0x5b88fc){_0x116778['push'](_0x116778['shift']());}}}(a60_0x1c8c,0x5100a));import a60_0x175429 from'prompts';function a60_0x3098(_0x25df0e,_0x59bf57){_0x25df0e=_0x25df0e-0x1c1;const _0x1c8cc2=a60_0x1c8c();let _0x3098ae=_0x1c8cc2[_0x25df0e];return _0x3098ae;}export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x568172,_0xf47a31){if(_0x568172===undefined)return _0xf47a31;if(typeof _0x568172==='number')return _0x568172;return parseInt(_0x568172,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a60_0x18686e(0x1cd),'value':a60_0x18686e(0x1df)},{'title':a60_0x18686e(0x1d9),'value':a60_0x18686e(0x1d4)},{'title':a60_0x18686e(0x1ce),'value':a60_0x18686e(0x1c2)},{'title':'ap02\x20-\x20Korea','value':'ap02'}];export function buildSiteChoices(_0x5655a2){const _0x12365a=a60_0x18686e,_0xffee9d=[...STANDARD_SITE_CHOICES];let _0x2061f0=_0xffee9d[_0x12365a(0x1d1)](_0x3475fa=>_0x3475fa[_0x12365a(0x1db)]===_0x5655a2);return _0x2061f0===-0x1&&_0x5655a2!==_0x12365a(0x1df)&&(_0xffee9d[_0x12365a(0x1dd)]({'title':_0x5655a2,'value':_0x5655a2}),_0x2061f0=_0xffee9d[_0x12365a(0x1cb)]-0x1),_0xffee9d[_0x12365a(0x1dd)]({'title':_0x12365a(0x1c1),'value':_0x12365a(0x1c7)}),{'choices':_0xffee9d,'initialIndex':_0x2061f0>=0x0?_0x2061f0:0x0};}export async function promptSiteSelection(_0x26250b,_0x512549,_0xab2ca8=a60_0x18686e(0x1d0)){const _0x180eda=a60_0x18686e,{choices:_0x53a9d7,initialIndex:_0x22712f}=buildSiteChoices(_0x26250b),_0x248ec4=_0x512549?_0x180eda(0x1c6)+_0x512549+'):':'Select\x20your\x20Treasure\x20Data\x20site:',_0x4598fb=await a60_0x175429({'type':_0x180eda(0x1d6),'name':_0x180eda(0x1d3),'message':_0x248ec4,'choices':_0x53a9d7,'initial':_0x22712f});if(!_0x4598fb[_0x180eda(0x1d3)])return console[_0x180eda(0x1c8)]('\x0a'+_0xab2ca8),null;if(_0x4598fb[_0x180eda(0x1d3)]!==_0x180eda(0x1c7))return _0x4598fb[_0x180eda(0x1d3)];const _0x28ef27=await a60_0x175429({'type':'text','name':'customSite','message':_0x180eda(0x1d8),'initial':'us01','validate':_0x167549=>{const _0x5cd68a=_0x180eda;if(!_0x167549||!_0x167549[_0x5cd68a(0x1dc)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0x5cd68a(0x1c3)](_0x167549[_0x5cd68a(0x1dc)]()))return _0x5cd68a(0x1de);return!![];}});if(!_0x28ef27[_0x180eda(0x1c9)])return console[_0x180eda(0x1c8)]('\x0a'+_0xab2ca8),null;return _0x28ef27[_0x180eda(0x1c9)];}
1
+ const a60_0xa5d29=a60_0x3c7c;(function(_0x39ce21,_0x4afaab){const _0x26a403=a60_0x3c7c,_0x23b38c=_0x39ce21();while(!![]){try{const _0x7f89c=-parseInt(_0x26a403(0xf3))/0x1*(parseInt(_0x26a403(0xd4))/0x2)+parseInt(_0x26a403(0xef))/0x3+parseInt(_0x26a403(0xe1))/0x4+parseInt(_0x26a403(0xe8))/0x5*(-parseInt(_0x26a403(0xd3))/0x6)+parseInt(_0x26a403(0xd1))/0x7+parseInt(_0x26a403(0xe5))/0x8*(-parseInt(_0x26a403(0xdb))/0x9)+-parseInt(_0x26a403(0xd5))/0xa*(-parseInt(_0x26a403(0xe4))/0xb);if(_0x7f89c===_0x4afaab)break;else _0x23b38c['push'](_0x23b38c['shift']());}catch(_0x2e729f){_0x23b38c['push'](_0x23b38c['shift']());}}}(a60_0x46cf,0x1e9d3));import a60_0x4d808d from'prompts';function a60_0x3c7c(_0x244526,_0x190794){_0x244526=_0x244526-0xd1;const _0x46cfad=a60_0x46cf();let _0x3c7c15=_0x46cfad[_0x244526];return _0x3c7c15;}export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;export function resolveLimit(_0x44dc73,_0xea9e2a){const _0x176c30=a60_0x3c7c;if(_0x44dc73===undefined)return _0xea9e2a;if(typeof _0x44dc73===_0x176c30(0xe3))return _0x44dc73;return parseInt(_0x44dc73,0xa);}export const STANDARD_SITE_CHOICES=[{'title':a60_0xa5d29(0xed),'value':'us01'},{'title':a60_0xa5d29(0xdf),'value':a60_0xa5d29(0xd9)},{'title':a60_0xa5d29(0xdd),'value':a60_0xa5d29(0xea)},{'title':a60_0xa5d29(0xe0),'value':a60_0xa5d29(0xe6)}];function a60_0x46cf(){const _0x350647=['1245535kwcTpS','site','eu01','Enter\x20custom\x20site','other','us\x20\x20\x20-\x20United\x20States','text','735888owYxnH','push','Enter\x20site\x20name:','us01','179NRzzrx','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','447902YJDctr','customSite','6OcpLgT','2228MHaFcM','202750QtVmEf','findIndex','Site\x20name\x20cannot\x20be\x20empty','log','ap01','test','31923gBRCZQ','trim','eu\x20\x20\x20-\x20Europe','value','jp\x20\x20\x20-\x20Japan','ap02\x20-\x20Korea','853560nBUYVX','Cancelled','number','99Wtgvwp','296UAsMXJ','ap02','select'];a60_0x46cf=function(){return _0x350647;};return a60_0x46cf();}export function buildSiteChoices(_0x176f86){const _0x4ec8d5=a60_0xa5d29,_0x9b01bc=[...STANDARD_SITE_CHOICES];let _0x2ed9d7=_0x9b01bc[_0x4ec8d5(0xd6)](_0x573835=>_0x573835[_0x4ec8d5(0xde)]===_0x176f86);return _0x2ed9d7===-0x1&&_0x176f86!=='us01'&&(_0x9b01bc['push']({'title':_0x176f86,'value':_0x176f86}),_0x2ed9d7=_0x9b01bc['length']-0x1),_0x9b01bc[_0x4ec8d5(0xf0)]({'title':_0x4ec8d5(0xeb),'value':_0x4ec8d5(0xec)}),{'choices':_0x9b01bc,'initialIndex':_0x2ed9d7>=0x0?_0x2ed9d7:0x0};}export async function promptSiteSelection(_0x474732,_0x2af238,_0x3890f2=a60_0xa5d29(0xe2)){const _0x5d8427=a60_0xa5d29,{choices:_0x39a1f4,initialIndex:_0x54a7ed}=buildSiteChoices(_0x474732),_0x57059d=_0x2af238?_0x5d8427(0xf4)+_0x2af238+'):':'Select\x20your\x20Treasure\x20Data\x20site:',_0x1a7759=await a60_0x4d808d({'type':_0x5d8427(0xe7),'name':_0x5d8427(0xe9),'message':_0x57059d,'choices':_0x39a1f4,'initial':_0x54a7ed});if(!_0x1a7759['site'])return console['log']('\x0a'+_0x3890f2),null;if(_0x1a7759[_0x5d8427(0xe9)]!==_0x5d8427(0xec))return _0x1a7759[_0x5d8427(0xe9)];const _0x4d69c9=await a60_0x4d808d({'type':_0x5d8427(0xee),'name':_0x5d8427(0xd2),'message':_0x5d8427(0xf1),'initial':_0x5d8427(0xf2),'validate':_0x48770d=>{const _0x12c7be=_0x5d8427;if(!_0x48770d||!_0x48770d[_0x12c7be(0xdc)]())return _0x12c7be(0xd7);if(!/^[a-z0-9-]+$/[_0x12c7be(0xda)](_0x48770d[_0x12c7be(0xdc)]()))return _0x12c7be(0xf5);return!![];}});if(!_0x4d69c9[_0x5d8427(0xd2)])return console[_0x5d8427(0xd8)]('\x0a'+_0x3890f2),null;return _0x4d69c9[_0x5d8427(0xd2)];}
@@ -1 +1 @@
1
- (function(_0x3e68d1,_0x3c498d){const _0x291d26=a61_0x46ee,_0x18b5d9=_0x3e68d1();while(!![]){try{const _0x428fcb=-parseInt(_0x291d26(0x19a))/0x1*(parseInt(_0x291d26(0x193))/0x2)+parseInt(_0x291d26(0x18a))/0x3+parseInt(_0x291d26(0x194))/0x4*(-parseInt(_0x291d26(0x196))/0x5)+parseInt(_0x291d26(0x18c))/0x6+parseInt(_0x291d26(0x199))/0x7*(parseInt(_0x291d26(0x18f))/0x8)+parseInt(_0x291d26(0x188))/0x9*(parseInt(_0x291d26(0x191))/0xa)+parseInt(_0x291d26(0x192))/0xb;if(_0x428fcb===_0x3c498d)break;else _0x18b5d9['push'](_0x18b5d9['shift']());}catch(_0x48c0af){_0x18b5d9['push'](_0x18b5d9['shift']());}}}(a61_0x384f,0x80627));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a61_0x46ee(_0x4d9071,_0x27b2fc){_0x4d9071=_0x4d9071-0x187;const _0x384fc0=a61_0x384f();let _0x46ee9d=_0x384fc0[_0x4d9071];return _0x46ee9d;}function getCacheKey(_0x587cf3,_0x2e8da2){const _0x1d7b58=a61_0x46ee,_0x164011=_0x587cf3||_0x1d7b58(0x197),_0x3116bb=_0x2e8da2||_0x1d7b58(0x18b);return _0x164011+':'+_0x3116bb;}export function getCachedCredential(_0x4ffbb0,_0x33c8c2){const _0x2e7e9f=a61_0x46ee,_0x53ac6f=getCacheKey(_0x4ffbb0,_0x33c8c2),_0x499c84=cache[_0x2e7e9f(0x18e)](_0x53ac6f);if(!_0x499c84)return null;if(Date[_0x2e7e9f(0x198)]()-_0x499c84[_0x2e7e9f(0x18d)]>CACHE_TTL_MS)return cache[_0x2e7e9f(0x187)](_0x53ac6f),null;return _0x499c84[_0x2e7e9f(0x190)];}export function setCachedCredential(_0x5eb11c,_0x22aad2,_0x4b7bc){const _0x2933e5=a61_0x46ee,_0x10985a=getCacheKey(_0x22aad2,_0x4b7bc);cache[_0x2933e5(0x195)](_0x10985a,{'apiKey':_0x5eb11c,'loadedAt':Date[_0x2933e5(0x198)]()});}function a61_0x384f(){const _0x383dbe=['__default_profile__','3882342Jizvpw','loadedAt','get','228000QLuoTT','apiKey','4982140QmOKDX','4054204MEKRse','12pmJTtA','4LxbRNm','set','1088215ueeWIG','__default_site__','now','21GOugvE','142649YbnSJc','delete','9BPSpTT','clear','195lpUDxI'];a61_0x384f=function(){return _0x383dbe;};return a61_0x384f();}export function clearCredentialCache(){const _0x2467d6=a61_0x46ee;cache[_0x2467d6(0x189)]();}export function clearCachedCredential(_0x219e11,_0x27ad19){const _0x5e7725=a61_0x46ee,_0x89685d=getCacheKey(_0x219e11,_0x27ad19);cache[_0x5e7725(0x187)](_0x89685d);}
1
+ function a61_0x211d(){const _0x33fd95=['99tlLEiZ','159010eplwaU','get','loadedAt','6nTcQmJ','12CkfMuJ','1227665XkyNdN','654872ExgaVM','1SkbHuP','769458AgFFRH','224640zFsbYO','apiKey','__default_site__','1629761WHCtfh','4GMqqKu','delete','239019YwCxXO','now','clear'];a61_0x211d=function(){return _0x33fd95;};return a61_0x211d();}(function(_0x3d1663,_0x4f4dae){const _0x29cd40=a61_0x1479,_0x47b7dd=_0x3d1663();while(!![]){try{const _0xeb1e8e=parseInt(_0x29cd40(0x145))/0x1*(parseInt(_0x29cd40(0x146))/0x2)+parseInt(_0x29cd40(0x147))/0x3+parseInt(_0x29cd40(0x14b))/0x4*(parseInt(_0x29cd40(0x143))/0x5)+parseInt(_0x29cd40(0x141))/0x6*(-parseInt(_0x29cd40(0x14a))/0x7)+-parseInt(_0x29cd40(0x144))/0x8+parseInt(_0x29cd40(0x13d))/0x9*(-parseInt(_0x29cd40(0x13e))/0xa)+parseInt(_0x29cd40(0x13a))/0xb*(-parseInt(_0x29cd40(0x142))/0xc);if(_0xeb1e8e===_0x4f4dae)break;else _0x47b7dd['push'](_0x47b7dd['shift']());}catch(_0x7d9bf2){_0x47b7dd['push'](_0x47b7dd['shift']());}}}(a61_0x211d,0x2f51c));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x13f5ce,_0x4be63b){const _0x12d38c=a61_0x1479,_0x5f3fb8=_0x13f5ce||_0x12d38c(0x149),_0x414d30=_0x4be63b||'__default_profile__';return _0x5f3fb8+':'+_0x414d30;}export function getCachedCredential(_0x58780c,_0x3e5b78){const _0x42be04=a61_0x1479,_0x35e82b=getCacheKey(_0x58780c,_0x3e5b78),_0x196be6=cache[_0x42be04(0x13f)](_0x35e82b);if(!_0x196be6)return null;if(Date[_0x42be04(0x13b)]()-_0x196be6[_0x42be04(0x140)]>CACHE_TTL_MS)return cache[_0x42be04(0x139)](_0x35e82b),null;return _0x196be6[_0x42be04(0x148)];}export function setCachedCredential(_0x309ec9,_0x42b7ea,_0x475631){const _0x348251=a61_0x1479,_0xd7688c=getCacheKey(_0x42b7ea,_0x475631);cache['set'](_0xd7688c,{'apiKey':_0x309ec9,'loadedAt':Date[_0x348251(0x13b)]()});}export function clearCredentialCache(){const _0x5e7f8b=a61_0x1479;cache[_0x5e7f8b(0x13c)]();}function a61_0x1479(_0x4dd6f0,_0x22f867){_0x4dd6f0=_0x4dd6f0-0x139;const _0x211da1=a61_0x211d();let _0x147922=_0x211da1[_0x4dd6f0];return _0x147922;}export function clearCachedCredential(_0x18c56d,_0x3cb503){const _0x4b8f40=getCacheKey(_0x18c56d,_0x3cb503);cache['delete'](_0x4b8f40);}
@@ -1 +1 @@
1
- const a62_0x15e19f=a62_0x2307;(function(_0x540a14,_0x3dd22d){const _0x86c416=a62_0x2307,_0x372de3=_0x540a14();while(!![]){try{const _0x4fed77=-parseInt(_0x86c416(0x8b))/0x1*(parseInt(_0x86c416(0xb8))/0x2)+parseInt(_0x86c416(0xa5))/0x3*(-parseInt(_0x86c416(0xae))/0x4)+parseInt(_0x86c416(0xb0))/0x5*(parseInt(_0x86c416(0x96))/0x6)+parseInt(_0x86c416(0x6f))/0x7*(parseInt(_0x86c416(0x75))/0x8)+-parseInt(_0x86c416(0x6c))/0x9+parseInt(_0x86c416(0x83))/0xa*(-parseInt(_0x86c416(0xa4))/0xb)+parseInt(_0x86c416(0xa3))/0xc*(parseInt(_0x86c416(0x9e))/0xd);if(_0x4fed77===_0x3dd22d)break;else _0x372de3['push'](_0x372de3['shift']());}catch(_0x2ede3f){_0x372de3['push'](_0x372de3['shift']());}}}(a62_0x3739,0xdff5d));function a62_0x3739(){const _0x2881b1=['(active)','CLI\x20flag:\x20--','logLevel','.env','llmAgent','activeProfile','48IeaLHJ','join','[configuration\x20files]','globalCredentials','proxy','replace','env','segment_path','169jBWgDF','getSource','access_token','apiKey','segmentPath','3165768cqyOaK','77UrDfww','3592641YTmfqx','Profile','assign','loadGlobalConfig','global','layers','readFileSync','.json','createAsync','4yfhyce','profileCredentials','236915etUdtO','us01','llm_agent','config','profile','resolveAPIKeyAsync','llm_project','displayWithSources','1667886TwFuaK','default','sessions','configFiles','Profile\x20Credentials','verbose','composableAudience','accessToken','not\x20set','tdx.json','display','llmProject','3840327VGPlhH','[context]','workflowProject','266wiKdzI','dim','cliFlags','getParameters','profileSource','entries','219064tifhpy','profiles','(session:\x20','Session','injectIntoOptions','parentSegment','Global\x20Credentials','INFO','sessionId','workflow_project','none','project','Global','bold','913890zowCJy','green','database','composable_audience','log','profile:\x20','string','parent_segment','2XqkhoR','existsSync','session','site','cyan'];a62_0x3739=function(){return _0x2881b1;};return a62_0x3739();}import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';import{getOAuthTokens}from'./oauth-keychain.js';import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a62_0x381146 from'node:fs';function a62_0x2307(_0xa055ac,_0xe69d6c){_0xa055ac=_0xa055ac-0x67;const _0x37390d=a62_0x3739();let _0x2307f9=_0x37390d[_0xa055ac];return _0x2307f9;}import*as a62_0x212cf7 from'node:path';import a62_0x18fb45 from'chalk';export class GlobalContext{['site'];['database'];['parent_segment'];[a62_0x15e19f(0x9d)];[a62_0x15e19f(0xb6)];[a62_0x15e19f(0xb2)];[a62_0x15e19f(0x7e)];[a62_0x15e19f(0x86)];['apiKey'];[a62_0x15e19f(0x67)];[a62_0x15e19f(0x9a)];['verbose'];[a62_0x15e19f(0x92)];['profile'];['profileSource']=null;[a62_0x15e19f(0xaa)];[a62_0x15e19f(0x95)];['sessionId'];[a62_0x15e19f(0xbb)];constructor(_0x8f7685){const _0x4434af=a62_0x15e19f;this[_0x4434af(0x7d)]=getSessionID(_0x8f7685['session']);const _0x3c74ca=loadSessionContext(_0x8f7685[_0x4434af(0x8d)]),_0x369252=loadProjectConfig(),_0x542d81=this[_0x4434af(0xa8)]();if(_0x8f7685[_0x4434af(0xb4)])this[_0x4434af(0x95)]=_0x8f7685['profile'],this['profileSource']='cli';else{if(_0x3c74ca?.[_0x4434af(0xb4)])this['activeProfile']=_0x3c74ca['profile'],this[_0x4434af(0x73)]=_0x4434af(0x8d);else{if(_0x542d81['profile'])this[_0x4434af(0x95)]=_0x542d81['profile'],this[_0x4434af(0x73)]=_0x4434af(0xb3);else process.env.TDX_PROFILE?(this[_0x4434af(0x95)]=process.env.TDX_PROFILE,this[_0x4434af(0x73)]=_0x4434af(0x9c)):(this['activeProfile']=null,this[_0x4434af(0x73)]=null);}}const _0x4f041a=this[_0x4434af(0x95)]?loadProfile(this['activeProfile']):null,_0x3dc90f=_0xe59a7a=>{const _0x4453ce=_0x4434af;if(!_0xe59a7a)return{};const _0x4fe935=_0xe59a7a,_0x2b68f1={};for(const [_0x1879ce,_0x80450c]of Object[_0x4453ce(0x74)](_0x4fe935)){typeof _0x80450c===_0x4453ce(0x89)&&(_0x2b68f1[_0x1879ce]=_0x80450c);}return _0x2b68f1;},_0x3fb7e2={},_0x5a41c=(_0x516bec,_0x5763ff,_0x46c010)=>{if(!_0x516bec)return![];if(_0x46c010&&_0x516bec===_0x46c010)return![];const _0x89a4bc=_0x3c74ca,_0x44897c=_0x369252,_0x4b20a=_0x4f041a?.['config'],_0x5a16b7=_0x542d81,_0x24f9b0=_0x89a4bc?.[_0x5763ff],_0x21022d=_0x44897c?.[_0x5763ff],_0x3b7c25=_0x4b20a?.[_0x5763ff],_0xe08152=_0x5a16b7[_0x5763ff];return _0x516bec!==_0x24f9b0&&_0x516bec!==_0x21022d&&_0x516bec!==_0x3b7c25&&_0x516bec!==_0xe08152;},_0x928e54=[{'optionKey':_0x4434af(0x8e),'contextKey':'site','defaultValue':_0x4434af(0xb1)},{'optionKey':_0x4434af(0x85),'contextKey':_0x4434af(0x85)},{'optionKey':_0x4434af(0x7a),'contextKey':_0x4434af(0x8a)},{'optionKey':_0x4434af(0x6b),'contextKey':_0x4434af(0xb6)},{'optionKey':_0x4434af(0x94),'contextKey':_0x4434af(0xb2)},{'optionKey':'composableAudience','contextKey':_0x4434af(0x86)},{'optionKey':_0x4434af(0xb4),'contextKey':'profile'}];for(const {optionKey:_0x18d31f,contextKey:_0x50518e,defaultValue:_0x545b88}of _0x928e54){const _0x1a9bf2=_0x8f7685[_0x18d31f];_0x5a41c(_0x1a9bf2,_0x50518e,_0x545b88)&&(_0x3fb7e2[_0x50518e]=_0x1a9bf2);}this['layers']={'cliFlags':_0x3fb7e2,'session':_0x3dc90f(_0x3c74ca),'project':_0x3dc90f(_0x369252),'profile':_0x3dc90f(_0x4f041a?.['config']),'global':_0x3dc90f(_0x542d81)};const _0x29f8a1={...this[_0x4434af(0xaa)][_0x4434af(0xa9)],...this[_0x4434af(0xaa)][_0x4434af(0xb4)],...this['layers'][_0x4434af(0x80)]};process.env.TDX_SITE&&!this[_0x4434af(0xaa)][_0x4434af(0x8d)][_0x4434af(0x8e)]&&!this['layers']['cliFlags'][_0x4434af(0x8e)]&&(_0x29f8a1[_0x4434af(0x8e)]=process.env.TDX_SITE);Object[_0x4434af(0xa7)](_0x29f8a1,this[_0x4434af(0xaa)][_0x4434af(0x8d)]),Object[_0x4434af(0xa7)](_0x29f8a1,this[_0x4434af(0xaa)]['cliFlags']);const _0x3b6cc4=_0x29f8a1[_0x4434af(0x8e)]||_0x4434af(0xb1);this[_0x4434af(0x8e)]=resolveSite(_0x3b6cc4),this['database']=_0x29f8a1[_0x4434af(0x85)],this[_0x4434af(0x8a)]=_0x29f8a1[_0x4434af(0x8a)],this[_0x4434af(0x9d)]=_0x29f8a1[_0x4434af(0x9d)],this[_0x4434af(0xb6)]=_0x29f8a1['llm_project'],this[_0x4434af(0xb2)]=_0x29f8a1[_0x4434af(0xb2)],this[_0x4434af(0x7e)]=_0x29f8a1[_0x4434af(0x7e)],this[_0x4434af(0x86)]=_0x29f8a1[_0x4434af(0x86)],this[_0x4434af(0xbd)]=_0x8f7685[_0x4434af(0xbd)]||![],this[_0x4434af(0x92)]=_0x8f7685[_0x4434af(0x92)]??LogLevel[_0x4434af(0x7c)],this[_0x4434af(0xb4)]=this[_0x4434af(0x95)]||undefined,this[_0x4434af(0x67)]=getAccessToken(this[_0x4434af(0x95)]||undefined),this[_0x4434af(0xa1)]=getAPIKey(this[_0x4434af(0x95)]||undefined);const _0x51332e=typeof _0x542d81[_0x4434af(0x9a)]===_0x4434af(0x89)?_0x542d81['proxy']:undefined;this[_0x4434af(0x9a)]=_0x51332e||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x55e457=getConfigDir(),_0x25fc93=a62_0x212cf7[_0x4434af(0x97)](_0x55e457,_0x4434af(0xba),this[_0x4434af(0x7d)]+_0x4434af(0xac)),_0x28b946=findProjectConfigPath(),_0x5530ce=a62_0x212cf7[_0x4434af(0x97)](_0x55e457,_0x4434af(0x69)),_0xae0a7d=a62_0x212cf7[_0x4434af(0x97)](_0x55e457,_0x4434af(0x93));let _0x199233=null,_0x1091f1=null;this[_0x4434af(0x95)]&&(_0x199233=a62_0x212cf7[_0x4434af(0x97)](_0x55e457,_0x4434af(0x76),this['activeProfile'],_0x4434af(0x69)),_0x1091f1=a62_0x212cf7[_0x4434af(0x97)](_0x55e457,_0x4434af(0x76),this[_0x4434af(0x95)],_0x4434af(0x93))),this['configFiles']={'session':a62_0x381146[_0x4434af(0x8c)](_0x25fc93)?_0x25fc93:null,'project':_0x28b946,'profile':_0x199233&&a62_0x381146[_0x4434af(0x8c)](_0x199233)?_0x199233:null,'profileCredentials':_0x1091f1&&a62_0x381146[_0x4434af(0x8c)](_0x1091f1)?_0x1091f1:null,'global':a62_0x381146[_0x4434af(0x8c)](_0x5530ce)?_0x5530ce:null,'globalCredentials':a62_0x381146[_0x4434af(0x8c)](_0xae0a7d)?_0xae0a7d:null};}[a62_0x15e19f(0x9f)](_0x52b921,_0x15eed5){const _0x45ac38=a62_0x15e19f;if(!_0x15eed5)return _0x45ac38(0x68);const _0x222149=_0x15eed5;if(this['layers'][_0x45ac38(0x71)][_0x52b921]===_0x222149){if(_0x52b921===_0x45ac38(0x8e)&&_0x222149==='us01'&&!this[_0x45ac38(0xaa)]['session'][_0x45ac38(0x8e)]&&!this[_0x45ac38(0xaa)][_0x45ac38(0x80)][_0x45ac38(0x8e)]&&!this['layers']['profile']['site']&&!this[_0x45ac38(0xaa)][_0x45ac38(0xa9)][_0x45ac38(0x8e)])return _0x45ac38(0xb9);return _0x45ac38(0x91)+_0x52b921[_0x45ac38(0x9b)](/_/g,'-');}if(this[_0x45ac38(0xaa)]['session'][_0x52b921]===_0x222149)return _0x45ac38(0x8d);if(this['layers'][_0x45ac38(0x80)][_0x52b921]===_0x222149)return _0x45ac38(0x80);if(this[_0x45ac38(0xaa)]['profile'][_0x52b921]===_0x222149)return _0x45ac38(0x88)+this[_0x45ac38(0x95)];if(this[_0x45ac38(0xaa)][_0x45ac38(0xa9)][_0x52b921]===_0x222149)return _0x45ac38(0xa9);return _0x45ac38(0xb9);}[a62_0x15e19f(0xa8)](){const _0x34775f=a62_0x15e19f,_0x462ad=a62_0x212cf7[_0x34775f(0x97)](getConfigDir(),_0x34775f(0x69));if(!a62_0x381146[_0x34775f(0x8c)](_0x462ad))return{};try{const _0x5a07e9=a62_0x381146[_0x34775f(0xab)](_0x462ad,'utf-8');return JSON['parse'](_0x5a07e9);}catch{return{};}}[a62_0x15e19f(0x79)](_0x5595f2){const _0x1b8c65=a62_0x15e19f;_0x5595f2[_0x1b8c65(0x8e)]=this[_0x1b8c65(0x8e)],!_0x5595f2['database']&&this[_0x1b8c65(0x85)]&&(_0x5595f2[_0x1b8c65(0x85)]=this[_0x1b8c65(0x85)]),!_0x5595f2[_0x1b8c65(0x7a)]&&this[_0x1b8c65(0x8a)]&&(_0x5595f2[_0x1b8c65(0x7a)]=this[_0x1b8c65(0x8a)]),!_0x5595f2[_0x1b8c65(0xa2)]&&this[_0x1b8c65(0x9d)]&&(_0x5595f2['segmentPath']=this[_0x1b8c65(0x9d)]),!_0x5595f2[_0x1b8c65(0x6b)]&&this[_0x1b8c65(0xb6)]&&(_0x5595f2[_0x1b8c65(0x6b)]=this[_0x1b8c65(0xb6)]),!_0x5595f2['llmAgent']&&this['llm_agent']&&(_0x5595f2[_0x1b8c65(0x94)]=this[_0x1b8c65(0xb2)]),!_0x5595f2[_0x1b8c65(0x6e)]&&this[_0x1b8c65(0x7e)]&&(_0x5595f2[_0x1b8c65(0x6e)]=this[_0x1b8c65(0x7e)]),!_0x5595f2[_0x1b8c65(0xbe)]&&this['composable_audience']&&(_0x5595f2[_0x1b8c65(0xbe)]=this[_0x1b8c65(0x86)]);}[a62_0x15e19f(0x72)](){const _0x18e97a=a62_0x15e19f;return[{'key':_0x18e97a(0x8e),'value':this[_0x18e97a(0x8e)]},{'key':'database','value':this[_0x18e97a(0x85)]},{'key':'parent_segment','value':this[_0x18e97a(0x8a)]},{'key':_0x18e97a(0x9d),'value':this[_0x18e97a(0x9d)]},{'key':_0x18e97a(0xb6),'value':this[_0x18e97a(0xb6)]},{'key':_0x18e97a(0xb2),'value':this[_0x18e97a(0xb2)]},{'key':'workflow_project','value':this[_0x18e97a(0x7e)]},{'key':_0x18e97a(0x86),'value':this[_0x18e97a(0x86)]},{'key':_0x18e97a(0xb4),'value':this[_0x18e97a(0x95)]||undefined}];}[a62_0x15e19f(0x6a)](){const _0x386ce7=a62_0x15e19f;console[_0x386ce7(0x87)](a62_0x18fb45[_0x386ce7(0x82)](_0x386ce7(0x6d)));for(const {key:_0x21254a,value:_0x5ab7a0}of this['getParameters']()){_0x5ab7a0&&console[_0x386ce7(0x87)](a62_0x18fb45[_0x386ce7(0x8f)](_0x21254a)+':\x20'+_0x5ab7a0);}}[a62_0x15e19f(0xb7)](){const _0xbf9804=a62_0x15e19f;console[_0xbf9804(0x87)](a62_0x18fb45[_0xbf9804(0x82)](_0xbf9804(0x6d)));for(const {key:_0x20cdb5,value:_0x453742}of this['getParameters']()){if(_0x453742){const _0x5b616f=_0x20cdb5===_0xbf9804(0xb4)?_0xbf9804(0x90):'('+this[_0xbf9804(0x9f)](_0x20cdb5,_0x453742)+')';console['log'](a62_0x18fb45[_0xbf9804(0x8f)](_0x20cdb5)+':\x20'+_0x453742+'\x20'+a62_0x18fb45[_0xbf9804(0x70)](_0x5b616f));}}console[_0xbf9804(0x87)]('\x0a'+a62_0x18fb45['bold'](_0xbf9804(0x98)));const _0x3ab13e=[{'label':_0xbf9804(0x78),'path':this[_0xbf9804(0xbb)][_0xbf9804(0x8d)],'extra':_0xbf9804(0x77)+this[_0xbf9804(0x7d)]+')'},{'label':'Project','path':this[_0xbf9804(0xbb)]['project']},{'label':_0xbf9804(0xa6),'path':this[_0xbf9804(0xbb)][_0xbf9804(0xb4)]},{'label':_0xbf9804(0xbc),'path':this[_0xbf9804(0xbb)][_0xbf9804(0xaf)]},{'label':'Global','path':this[_0xbf9804(0xbb)][_0xbf9804(0xa9)]},{'label':_0xbf9804(0x7b),'path':this['configFiles'][_0xbf9804(0x99)]}];for(const {label:_0x1a4aaa,path:_0x343e0e,extra:_0x3954f6}of _0x3ab13e){if(_0x343e0e)console['log'](a62_0x18fb45[_0xbf9804(0x8f)](_0x1a4aaa)+':\x20'+_0x343e0e+'\x20'+a62_0x18fb45[_0xbf9804(0x84)]('✓')+(_0x3954f6?'\x20'+a62_0x18fb45[_0xbf9804(0x70)](_0x3954f6):''));else{if(_0x1a4aaa===_0xbf9804(0x78))console[_0xbf9804(0x87)](a62_0x18fb45['cyan'](_0x1a4aaa)+':\x20'+a62_0x18fb45[_0xbf9804(0x70)](_0xbf9804(0x7f))+'\x20'+a62_0x18fb45[_0xbf9804(0x70)]('(using\x20session:\x20'+this['sessionId']+')'));else(_0x1a4aaa==='Project'||_0x1a4aaa===_0xbf9804(0x81))&&console['log'](a62_0x18fb45[_0xbf9804(0x8f)](_0x1a4aaa)+':\x20'+a62_0x18fb45[_0xbf9804(0x70)](_0xbf9804(0x7f)));}}}async['resolveAPIKeyAsync'](){const _0x412e34=a62_0x15e19f;if(!this[_0x412e34(0x67)]){const _0x428eb0=await getOAuthTokens(this['activeProfile']||undefined);if(_0x428eb0)return this[_0x412e34(0x67)]=_0x428eb0[_0x412e34(0xa0)],undefined;}return this['apiKey']=await getAPIKeyAsync(this[_0x412e34(0x8e)],this[_0x412e34(0x95)]||undefined),this[_0x412e34(0xa1)];}static async[a62_0x15e19f(0xad)](_0x44249d){const _0x33f83a=a62_0x15e19f,_0x397ee9=new GlobalContext(_0x44249d);return await _0x397ee9[_0x33f83a(0xb5)](),_0x397ee9;}}
1
+ const a62_0x4fe4e7=a62_0xeeab;(function(_0x3b6406,_0x39d587){const _0x155750=a62_0xeeab,_0x31e57a=_0x3b6406();while(!![]){try{const _0x24cc45=-parseInt(_0x155750(0x12d))/0x1+-parseInt(_0x155750(0x139))/0x2+parseInt(_0x155750(0x11f))/0x3+parseInt(_0x155750(0x10a))/0x4+parseInt(_0x155750(0x12e))/0x5*(-parseInt(_0x155750(0xfa))/0x6)+-parseInt(_0x155750(0x132))/0x7*(-parseInt(_0x155750(0x135))/0x8)+-parseInt(_0x155750(0xfe))/0x9;if(_0x24cc45===_0x39d587)break;else _0x31e57a['push'](_0x31e57a['shift']());}catch(_0x25db0a){_0x31e57a['push'](_0x31e57a['shift']());}}}(a62_0x5b6f,0xebef1));function a62_0x5b6f(){const _0x5d27a1=['8750853DgvlYc','parent_segment','existsSync','resolveAPIKeyAsync','getSource','llm_project','INFO','getParameters','env','[configuration\x20files]','workflowProject','replace','2785432QJRzxV','log','.json','dim','session','access_token','composable_audience','Global','.env','(using\x20session:\x20','Profile\x20Credentials','cliFlags','activeProfile','tdx.json','configFiles','profile:\x20','profiles','[context]','llmProject','sessionId','display','5158659uACcuC','globalCredentials','createAsync','global','green','config','profileSource','Profile','not\x20set','(active)','cyan','entries','logLevel','Session','847357znefSL','5CqgHbW','assign','parentSegment','segment_path','7ZOcAMF','composableAudience','join','6201256mfKfvG','apiKey','accessToken','loadGlobalConfig','86990SCUoFS','proxy','profile','parse','llm_agent','profileCredentials','layers','default','database','readFileSync','injectIntoOptions','displayWithSources','cli','llmAgent','none','sessions','site','us01','verbose','CLI\x20flag:\x20--','2169084zsJwsO','project','workflow_project','Project'];a62_0x5b6f=function(){return _0x5d27a1;};return a62_0x5b6f();}import{resolveSite,getAPIKey,getAccessToken,getAPIKeyAsync,getConfigDir}from'./config.js';function a62_0xeeab(_0x31ef85,_0x38988e){_0x31ef85=_0x31ef85-0xea;const _0x5b6f68=a62_0x5b6f();let _0xeeabc=_0x5b6f68[_0x31ef85];return _0xeeabc;}import{getOAuthTokens}from'./oauth-keychain.js';import{loadSessionContext,getSessionID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{loadProfile}from'./profile.js';import{LogLevel}from'../utils/logger/index.js';import*as a62_0x4230ca from'node:fs';import*as a62_0x417785 from'node:path';import a62_0x5442d0 from'chalk';export class GlobalContext{[a62_0x4fe4e7(0xf6)];[a62_0x4fe4e7(0xee)];['parent_segment'];[a62_0x4fe4e7(0x131)];[a62_0x4fe4e7(0x103)];[a62_0x4fe4e7(0xea)];[a62_0x4fe4e7(0xfc)];[a62_0x4fe4e7(0x110)];['apiKey'];[a62_0x4fe4e7(0x137)];['proxy'];['verbose'];[a62_0x4fe4e7(0x12b)];[a62_0x4fe4e7(0x13b)];[a62_0x4fe4e7(0x125)]=null;[a62_0x4fe4e7(0xec)];['activeProfile'];[a62_0x4fe4e7(0x11d)];[a62_0x4fe4e7(0x118)];constructor(_0x5367be){const _0x33ed7c=a62_0x4fe4e7;this['sessionId']=getSessionID(_0x5367be['session']);const _0x2c42e0=loadSessionContext(_0x5367be['session']),_0x2290c1=loadProjectConfig(),_0x23a399=this[_0x33ed7c(0x138)]();if(_0x5367be[_0x33ed7c(0x13b)])this['activeProfile']=_0x5367be[_0x33ed7c(0x13b)],this[_0x33ed7c(0x125)]=_0x33ed7c(0xf2);else{if(_0x2c42e0?.[_0x33ed7c(0x13b)])this[_0x33ed7c(0x116)]=_0x2c42e0[_0x33ed7c(0x13b)],this['profileSource']='session';else{if(_0x23a399[_0x33ed7c(0x13b)])this[_0x33ed7c(0x116)]=_0x23a399[_0x33ed7c(0x13b)],this['profileSource']='config';else process.env.TDX_PROFILE?(this[_0x33ed7c(0x116)]=process.env.TDX_PROFILE,this['profileSource']=_0x33ed7c(0x106)):(this[_0x33ed7c(0x116)]=null,this[_0x33ed7c(0x125)]=null);}}const _0x26fc08=this['activeProfile']?loadProfile(this['activeProfile']):null,_0x358e8a=_0x58508a=>{const _0xd27f63=_0x33ed7c;if(!_0x58508a)return{};const _0x335b9d=_0x58508a,_0x362854={};for(const [_0x179588,_0x209ff4]of Object[_0xd27f63(0x12a)](_0x335b9d)){typeof _0x209ff4==='string'&&(_0x362854[_0x179588]=_0x209ff4);}return _0x362854;},_0x4e1703={},_0x2b4e33=(_0x35fd21,_0x394b09,_0x4043b4)=>{const _0x437068=_0x33ed7c;if(!_0x35fd21)return![];if(_0x4043b4&&_0x35fd21===_0x4043b4)return![];const _0x5cf75e=_0x2c42e0,_0x173db9=_0x2290c1,_0x578456=_0x26fc08?.[_0x437068(0x124)],_0x364d40=_0x23a399,_0x5260ca=_0x5cf75e?.[_0x394b09],_0x5945c5=_0x173db9?.[_0x394b09],_0x5bb832=_0x578456?.[_0x394b09],_0x18fa0c=_0x364d40[_0x394b09];return _0x35fd21!==_0x5260ca&&_0x35fd21!==_0x5945c5&&_0x35fd21!==_0x5bb832&&_0x35fd21!==_0x18fa0c;},_0xad3440=[{'optionKey':_0x33ed7c(0xf6),'contextKey':'site','defaultValue':'us01'},{'optionKey':_0x33ed7c(0xee),'contextKey':'database'},{'optionKey':_0x33ed7c(0x130),'contextKey':'parent_segment'},{'optionKey':'llmProject','contextKey':'llm_project'},{'optionKey':'llmAgent','contextKey':_0x33ed7c(0xea)},{'optionKey':_0x33ed7c(0x133),'contextKey':'composable_audience'},{'optionKey':_0x33ed7c(0x13b),'contextKey':_0x33ed7c(0x13b)}];for(const {optionKey:_0x39018a,contextKey:_0x3daa78,defaultValue:_0x598c2a}of _0xad3440){const _0x1b69ad=_0x5367be[_0x39018a];_0x2b4e33(_0x1b69ad,_0x3daa78,_0x598c2a)&&(_0x4e1703[_0x3daa78]=_0x1b69ad);}this[_0x33ed7c(0xec)]={'cliFlags':_0x4e1703,'session':_0x358e8a(_0x2c42e0),'project':_0x358e8a(_0x2290c1),'profile':_0x358e8a(_0x26fc08?.[_0x33ed7c(0x124)]),'global':_0x358e8a(_0x23a399)};const _0x1301d5={...this[_0x33ed7c(0xec)][_0x33ed7c(0x122)],...this[_0x33ed7c(0xec)][_0x33ed7c(0x13b)],...this['layers'][_0x33ed7c(0xfb)]};process.env.TDX_SITE&&!this['layers'][_0x33ed7c(0x10e)][_0x33ed7c(0xf6)]&&!this[_0x33ed7c(0xec)]['cliFlags'][_0x33ed7c(0xf6)]&&(_0x1301d5[_0x33ed7c(0xf6)]=process.env.TDX_SITE);Object[_0x33ed7c(0x12f)](_0x1301d5,this['layers']['session']),Object[_0x33ed7c(0x12f)](_0x1301d5,this[_0x33ed7c(0xec)][_0x33ed7c(0x115)]);const _0x2fba6c=_0x1301d5[_0x33ed7c(0xf6)]||_0x33ed7c(0xf7);this[_0x33ed7c(0xf6)]=resolveSite(_0x2fba6c),this['database']=_0x1301d5['database'],this[_0x33ed7c(0xff)]=_0x1301d5['parent_segment'],this[_0x33ed7c(0x131)]=_0x1301d5[_0x33ed7c(0x131)],this[_0x33ed7c(0x103)]=_0x1301d5[_0x33ed7c(0x103)],this[_0x33ed7c(0xea)]=_0x1301d5[_0x33ed7c(0xea)],this[_0x33ed7c(0xfc)]=_0x1301d5['workflow_project'],this[_0x33ed7c(0x110)]=_0x1301d5[_0x33ed7c(0x110)],this['verbose']=_0x5367be[_0x33ed7c(0xf8)]||![],this['logLevel']=_0x5367be[_0x33ed7c(0x12b)]??LogLevel[_0x33ed7c(0x104)],this[_0x33ed7c(0x13b)]=this[_0x33ed7c(0x116)]||undefined,this[_0x33ed7c(0x137)]=getAccessToken(this[_0x33ed7c(0x116)]||undefined),this['apiKey']=getAPIKey(this[_0x33ed7c(0x116)]||undefined);const _0x99024f=typeof _0x23a399[_0x33ed7c(0x13a)]==='string'?_0x23a399[_0x33ed7c(0x13a)]:undefined;this[_0x33ed7c(0x13a)]=_0x99024f||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const _0x51ba56=getConfigDir(),_0x3e9dac=a62_0x417785[_0x33ed7c(0x134)](_0x51ba56,_0x33ed7c(0xf5),this[_0x33ed7c(0x11d)]+_0x33ed7c(0x10c)),_0x26f5df=findProjectConfigPath(),_0x12e3ee=a62_0x417785[_0x33ed7c(0x134)](_0x51ba56,_0x33ed7c(0x117)),_0x53e932=a62_0x417785[_0x33ed7c(0x134)](_0x51ba56,_0x33ed7c(0x112));let _0x2f1563=null,_0x2f77d4=null;this[_0x33ed7c(0x116)]&&(_0x2f1563=a62_0x417785[_0x33ed7c(0x134)](_0x51ba56,'profiles',this['activeProfile'],'tdx.json'),_0x2f77d4=a62_0x417785[_0x33ed7c(0x134)](_0x51ba56,_0x33ed7c(0x11a),this[_0x33ed7c(0x116)],_0x33ed7c(0x112))),this[_0x33ed7c(0x118)]={'session':a62_0x4230ca[_0x33ed7c(0x100)](_0x3e9dac)?_0x3e9dac:null,'project':_0x26f5df,'profile':_0x2f1563&&a62_0x4230ca['existsSync'](_0x2f1563)?_0x2f1563:null,'profileCredentials':_0x2f77d4&&a62_0x4230ca[_0x33ed7c(0x100)](_0x2f77d4)?_0x2f77d4:null,'global':a62_0x4230ca['existsSync'](_0x12e3ee)?_0x12e3ee:null,'globalCredentials':a62_0x4230ca[_0x33ed7c(0x100)](_0x53e932)?_0x53e932:null};}['getSource'](_0x3b7298,_0x68ce2b){const _0x4b3fc8=a62_0x4fe4e7;if(!_0x68ce2b)return _0x4b3fc8(0x127);const _0x5abff2=_0x68ce2b;if(this['layers'][_0x4b3fc8(0x115)][_0x3b7298]===_0x5abff2){if(_0x3b7298===_0x4b3fc8(0xf6)&&_0x5abff2===_0x4b3fc8(0xf7)&&!this['layers'][_0x4b3fc8(0x10e)]['site']&&!this[_0x4b3fc8(0xec)][_0x4b3fc8(0xfb)]['site']&&!this[_0x4b3fc8(0xec)]['profile'][_0x4b3fc8(0xf6)]&&!this[_0x4b3fc8(0xec)][_0x4b3fc8(0x122)][_0x4b3fc8(0xf6)])return _0x4b3fc8(0xed);return _0x4b3fc8(0xf9)+_0x3b7298[_0x4b3fc8(0x109)](/_/g,'-');}if(this[_0x4b3fc8(0xec)][_0x4b3fc8(0x10e)][_0x3b7298]===_0x5abff2)return _0x4b3fc8(0x10e);if(this[_0x4b3fc8(0xec)][_0x4b3fc8(0xfb)][_0x3b7298]===_0x5abff2)return _0x4b3fc8(0xfb);if(this[_0x4b3fc8(0xec)][_0x4b3fc8(0x13b)][_0x3b7298]===_0x5abff2)return _0x4b3fc8(0x119)+this[_0x4b3fc8(0x116)];if(this[_0x4b3fc8(0xec)][_0x4b3fc8(0x122)][_0x3b7298]===_0x5abff2)return _0x4b3fc8(0x122);return _0x4b3fc8(0xed);}[a62_0x4fe4e7(0x138)](){const _0x2a30ab=a62_0x4fe4e7,_0x4cd4ee=a62_0x417785['join'](getConfigDir(),_0x2a30ab(0x117));if(!a62_0x4230ca['existsSync'](_0x4cd4ee))return{};try{const _0x1487de=a62_0x4230ca[_0x2a30ab(0xef)](_0x4cd4ee,'utf-8');return JSON[_0x2a30ab(0x13c)](_0x1487de);}catch{return{};}}[a62_0x4fe4e7(0xf0)](_0x4e1679){const _0x477215=a62_0x4fe4e7;_0x4e1679[_0x477215(0xf6)]=this['site'],!_0x4e1679[_0x477215(0xee)]&&this[_0x477215(0xee)]&&(_0x4e1679[_0x477215(0xee)]=this[_0x477215(0xee)]),!_0x4e1679['parentSegment']&&this[_0x477215(0xff)]&&(_0x4e1679[_0x477215(0x130)]=this[_0x477215(0xff)]),!_0x4e1679['segmentPath']&&this[_0x477215(0x131)]&&(_0x4e1679['segmentPath']=this['segment_path']),!_0x4e1679[_0x477215(0x11c)]&&this['llm_project']&&(_0x4e1679[_0x477215(0x11c)]=this[_0x477215(0x103)]),!_0x4e1679[_0x477215(0xf3)]&&this[_0x477215(0xea)]&&(_0x4e1679[_0x477215(0xf3)]=this[_0x477215(0xea)]),!_0x4e1679[_0x477215(0x108)]&&this['workflow_project']&&(_0x4e1679[_0x477215(0x108)]=this[_0x477215(0xfc)]),!_0x4e1679[_0x477215(0x133)]&&this[_0x477215(0x110)]&&(_0x4e1679['composableAudience']=this[_0x477215(0x110)]);}[a62_0x4fe4e7(0x105)](){const _0x4dc945=a62_0x4fe4e7;return[{'key':_0x4dc945(0xf6),'value':this['site']},{'key':_0x4dc945(0xee),'value':this['database']},{'key':_0x4dc945(0xff),'value':this[_0x4dc945(0xff)]},{'key':'segment_path','value':this['segment_path']},{'key':_0x4dc945(0x103),'value':this[_0x4dc945(0x103)]},{'key':_0x4dc945(0xea),'value':this['llm_agent']},{'key':'workflow_project','value':this[_0x4dc945(0xfc)]},{'key':_0x4dc945(0x110),'value':this[_0x4dc945(0x110)]},{'key':_0x4dc945(0x13b),'value':this['activeProfile']||undefined}];}[a62_0x4fe4e7(0x11e)](){const _0x3bca9a=a62_0x4fe4e7;console['log'](a62_0x5442d0['bold'](_0x3bca9a(0x11b)));for(const {key:_0x23aa54,value:_0x301629}of this[_0x3bca9a(0x105)]()){_0x301629&&console['log'](a62_0x5442d0[_0x3bca9a(0x129)](_0x23aa54)+':\x20'+_0x301629);}}[a62_0x4fe4e7(0xf1)](){const _0x3e16a4=a62_0x4fe4e7;console[_0x3e16a4(0x10b)](a62_0x5442d0['bold']('[context]'));for(const {key:_0x54a43d,value:_0x367d2f}of this[_0x3e16a4(0x105)]()){if(_0x367d2f){const _0x2c7f8a=_0x54a43d===_0x3e16a4(0x13b)?_0x3e16a4(0x128):'('+this[_0x3e16a4(0x102)](_0x54a43d,_0x367d2f)+')';console[_0x3e16a4(0x10b)](a62_0x5442d0['cyan'](_0x54a43d)+':\x20'+_0x367d2f+'\x20'+a62_0x5442d0[_0x3e16a4(0x10d)](_0x2c7f8a));}}console[_0x3e16a4(0x10b)]('\x0a'+a62_0x5442d0['bold'](_0x3e16a4(0x107)));const _0x3c24ea=[{'label':'Session','path':this['configFiles'][_0x3e16a4(0x10e)],'extra':'(session:\x20'+this[_0x3e16a4(0x11d)]+')'},{'label':_0x3e16a4(0xfd),'path':this[_0x3e16a4(0x118)][_0x3e16a4(0xfb)]},{'label':_0x3e16a4(0x126),'path':this['configFiles']['profile']},{'label':_0x3e16a4(0x114),'path':this[_0x3e16a4(0x118)][_0x3e16a4(0xeb)]},{'label':_0x3e16a4(0x111),'path':this[_0x3e16a4(0x118)][_0x3e16a4(0x122)]},{'label':'Global\x20Credentials','path':this[_0x3e16a4(0x118)][_0x3e16a4(0x120)]}];for(const {label:_0x56d5f0,path:_0x348e67,extra:_0x109ba3}of _0x3c24ea){if(_0x348e67)console[_0x3e16a4(0x10b)](a62_0x5442d0['cyan'](_0x56d5f0)+':\x20'+_0x348e67+'\x20'+a62_0x5442d0[_0x3e16a4(0x123)]('✓')+(_0x109ba3?'\x20'+a62_0x5442d0[_0x3e16a4(0x10d)](_0x109ba3):''));else{if(_0x56d5f0===_0x3e16a4(0x12c))console[_0x3e16a4(0x10b)](a62_0x5442d0[_0x3e16a4(0x129)](_0x56d5f0)+':\x20'+a62_0x5442d0[_0x3e16a4(0x10d)](_0x3e16a4(0xf4))+'\x20'+a62_0x5442d0[_0x3e16a4(0x10d)](_0x3e16a4(0x113)+this[_0x3e16a4(0x11d)]+')'));else(_0x56d5f0===_0x3e16a4(0xfd)||_0x56d5f0===_0x3e16a4(0x111))&&console[_0x3e16a4(0x10b)](a62_0x5442d0[_0x3e16a4(0x129)](_0x56d5f0)+':\x20'+a62_0x5442d0[_0x3e16a4(0x10d)](_0x3e16a4(0xf4)));}}}async[a62_0x4fe4e7(0x101)](){const _0x5a3f26=a62_0x4fe4e7;if(!this[_0x5a3f26(0x137)]){const _0x18ea2f=await getOAuthTokens(this[_0x5a3f26(0x116)]||undefined);if(_0x18ea2f)return this['accessToken']=_0x18ea2f[_0x5a3f26(0x10f)],undefined;}return this[_0x5a3f26(0x136)]=await getAPIKeyAsync(this[_0x5a3f26(0xf6)],this[_0x5a3f26(0x116)]||undefined),this[_0x5a3f26(0x136)];}static async[a62_0x4fe4e7(0x121)](_0x4ec4c1){const _0x47fa66=a62_0x4fe4e7,_0x115b25=new GlobalContext(_0x4ec4c1);return await _0x115b25[_0x47fa66(0x101)](),_0x115b25;}}
@@ -1 +1 @@
1
- const a63_0x41bce4=a63_0xc157;(function(_0x5ddef7,_0x948389){const _0x3b949d=a63_0xc157,_0x380329=_0x5ddef7();while(!![]){try{const _0x66212d=-parseInt(_0x3b949d(0xb8))/0x1+parseInt(_0x3b949d(0xae))/0x2+parseInt(_0x3b949d(0xbe))/0x3*(parseInt(_0x3b949d(0xb6))/0x4)+-parseInt(_0x3b949d(0xb4))/0x5+parseInt(_0x3b949d(0xb2))/0x6*(parseInt(_0x3b949d(0xbd))/0x7)+-parseInt(_0x3b949d(0xca))/0x8+-parseInt(_0x3b949d(0xcd))/0x9*(-parseInt(_0x3b949d(0xb0))/0xa);if(_0x66212d===_0x948389)break;else _0x380329['push'](_0x380329['shift']());}catch(_0x1ca6e9){_0x380329['push'](_0x380329['shift']());}}}(a63_0x5b82,0x7c3a0));function a63_0x5b82(){const _0x1e35ba=['profile:','__keychain_test__','toLowerCase','Entry','deleteCredential','-25293','-25300','includes','not\x20supported','reason','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.','7419904zdBsWL','Warning:\x20','message','9HqeAdG',':api_key','value','1448942sjTdGy','tdx','12176940ZjMbMq','unavailable','66KQefnF','getPassword','3007595JtpYDC','not_found','20TrkToa','not\x20available','706684lFKxPc','could\x20not\x20be\x20found','access_denied','access','@napi-rs/keyring','438571bHswUk','67905UwGAeC'];a63_0x5b82=function(){return _0x1e35ba;};return a63_0x5b82();}const SERVICE_NAME=a63_0x41bce4(0xaf);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x38bf15=a63_0x41bce4;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x6fc03a=await import(_0x38bf15(0xbc));return EntryClass=_0x6fc03a[_0x38bf15(0xc2)],EntryClass;}catch(_0x11ff3f){return keyringLoadError=_0x11ff3f instanceof Error?_0x11ff3f:new Error(String(_0x11ff3f)),null;}}function getAccountName(_0x4a4d30){const _0x1ddba8=a63_0x41bce4,_0x437b6d=_0x4a4d30||'';return _0x1ddba8(0xbf)+_0x437b6d+_0x1ddba8(0xac);}export async function getKeychainAPIKey(_0x4c83bf){const _0x42e230=a63_0x41bce4,_0x5b8cda=await getKeychainAPIKeyWithStatus(_0x4c83bf);if(_0x5b8cda['success'])return _0x5b8cda[_0x42e230(0xad)];return _0x5b8cda[_0x42e230(0xc8)]===_0x42e230(0xba)&&console['error'](_0x42e230(0xcb)+_0x5b8cda[_0x42e230(0xcc)]),null;}export async function getKeychainAPIKeyWithStatus(_0x329b00){const _0x3f42d2=a63_0x41bce4;try{const _0x5ec41=await getEntryClass();if(!_0x5ec41)return{'success':![],'reason':_0x3f42d2(0xb1)};const _0x4c7f6b=getAccountName(_0x329b00),_0x1cedd9=new _0x5ec41(SERVICE_NAME,_0x4c7f6b),_0x14b07f=_0x1cedd9['getPassword']();if(_0x14b07f)return{'success':!![],'value':_0x14b07f};return{'success':![],'reason':_0x3f42d2(0xb5)};}catch(_0x30aef2){const _0x3f56d0=_0x30aef2 instanceof Error?_0x30aef2[_0x3f42d2(0xcc)]:String(_0x30aef2);if(_0x3f56d0[_0x3f42d2(0xc6)](_0x3f42d2(0xc5))||_0x3f56d0[_0x3f42d2(0xc1)]()['includes'](_0x3f42d2(0xb9))||_0x3f56d0[_0x3f42d2(0xc1)]()[_0x3f42d2(0xc6)]('not\x20found')||_0x3f56d0[_0x3f42d2(0xc1)]()[_0x3f42d2(0xc6)]('no\x20matching\x20entry'))return{'success':![],'reason':_0x3f42d2(0xb5)};if(_0x3f56d0[_0x3f42d2(0xc6)](_0x3f42d2(0xc4))||_0x3f56d0[_0x3f42d2(0xc1)]()['includes']('restricted')||_0x3f56d0[_0x3f42d2(0xc1)]()[_0x3f42d2(0xc6)](_0x3f42d2(0xbb)))return{'success':![],'reason':'access_denied','message':_0x3f42d2(0xc9)};return{'success':![],'reason':'unavailable','message':_0x3f56d0};}}function a63_0xc157(_0x452ca2,_0x284beb){_0x452ca2=_0x452ca2-0xac;const _0x5b82c4=a63_0x5b82();let _0xc1571c=_0x5b82c4[_0x452ca2];return _0xc1571c;}export async function saveKeychainAPIKey(_0xf61570,_0x289531){const _0x1d68ed=await getEntryClass();if(!_0x1d68ed)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x147119=getAccountName(_0x289531),_0xf2735=new _0x1d68ed(SERVICE_NAME,_0x147119);_0xf2735['setPassword'](_0xf61570);}export async function deleteKeychainAPIKey(_0x5869c6){const _0x52c674=a63_0x41bce4;try{const _0xa20088=await getEntryClass();if(!_0xa20088)return![];const _0x2bd051=getAccountName(_0x5869c6),_0x197876=new _0xa20088(SERVICE_NAME,_0x2bd051);return _0x197876[_0x52c674(0xc3)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x3c0cc6=a63_0x41bce4;try{const _0x2067d4=await getEntryClass();if(!_0x2067d4)return![];const _0x3962e5=new _0x2067d4(SERVICE_NAME,_0x3c0cc6(0xc0));return _0x3962e5[_0x3c0cc6(0xb3)](),!![];}catch(_0x320831){const _0x1466bc=_0x320831 instanceof Error?_0x320831[_0x3c0cc6(0xcc)][_0x3c0cc6(0xc1)]():'';if(_0x1466bc[_0x3c0cc6(0xc6)](_0x3c0cc6(0xb7))||_0x1466bc['includes'](_0x3c0cc6(0xc7))||_0x1466bc[_0x3c0cc6(0xc6)]('cannot\x20find'))return![];return!![];}}
1
+ (function(_0x428851,_0x7e743c){const _0x57ba45=a63_0x4b15,_0x29a27d=_0x428851();while(!![]){try{const _0x165dab=parseInt(_0x57ba45(0x1f2))/0x1*(-parseInt(_0x57ba45(0x1f7))/0x2)+parseInt(_0x57ba45(0x1ec))/0x3*(-parseInt(_0x57ba45(0x1de))/0x4)+-parseInt(_0x57ba45(0x1f8))/0x5*(-parseInt(_0x57ba45(0x1e7))/0x6)+-parseInt(_0x57ba45(0x1d9))/0x7+parseInt(_0x57ba45(0x1e0))/0x8*(parseInt(_0x57ba45(0x1f6))/0x9)+-parseInt(_0x57ba45(0x1fa))/0xa*(-parseInt(_0x57ba45(0x1e4))/0xb)+parseInt(_0x57ba45(0x1f4))/0xc*(-parseInt(_0x57ba45(0x1f9))/0xd);if(_0x165dab===_0x7e743c)break;else _0x29a27d['push'](_0x29a27d['shift']());}catch(_0x5e2ed6){_0x29a27d['push'](_0x29a27d['shift']());}}}(a63_0x3b1f,0xb39b9));const SERVICE_NAME='tdx';function a63_0x3b1f(){const _0x5cd870=['977OqIxru','restricted','288yajSLS','not_found','108qRPcTO','194knxdZl','4610590YjCaJr','115206SrjPxG','10RybOLK','System\x20keychain\x20is\x20not\x20available','error','includes','-25300','message','4824638OTBolq','no\x20matching\x20entry','toLowerCase','Entry','getPassword','4RunjkT','not\x20available','223792tJtmZU','__keychain_test__',':api_key','profile:','9323677nExzFQ','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.','setPassword','6nxzpaT','@napi-rs/keyring','unavailable','access_denied','-25293','1119147FmAfqa','value','could\x20not\x20be\x20found','deleteCredential','reason','Warning:\x20'];a63_0x3b1f=function(){return _0x5cd870;};return a63_0x3b1f();}let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x5db167=a63_0x4b15;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x3451aa=await import(_0x5db167(0x1e8));return EntryClass=_0x3451aa[_0x5db167(0x1dc)],EntryClass;}catch(_0x574d87){return keyringLoadError=_0x574d87 instanceof Error?_0x574d87:new Error(String(_0x574d87)),null;}}function getAccountName(_0x1ef8f2){const _0x5508dd=a63_0x4b15,_0x4d8b4e=_0x1ef8f2||'';return _0x5508dd(0x1e3)+_0x4d8b4e+_0x5508dd(0x1e2);}export async function getKeychainAPIKey(_0x2551a1){const _0x3a0c0b=a63_0x4b15,_0x49e0bb=await getKeychainAPIKeyWithStatus(_0x2551a1);if(_0x49e0bb['success'])return _0x49e0bb[_0x3a0c0b(0x1ed)];return _0x49e0bb[_0x3a0c0b(0x1f0)]===_0x3a0c0b(0x1ea)&&console[_0x3a0c0b(0x1fc)](_0x3a0c0b(0x1f1)+_0x49e0bb[_0x3a0c0b(0x1d8)]),null;}export async function getKeychainAPIKeyWithStatus(_0x76f80c){const _0x34e37a=a63_0x4b15;try{const _0x128e2c=await getEntryClass();if(!_0x128e2c)return{'success':![],'reason':_0x34e37a(0x1e9)};const _0x212a36=getAccountName(_0x76f80c),_0x45b038=new _0x128e2c(SERVICE_NAME,_0x212a36),_0x114d1b=_0x45b038['getPassword']();if(_0x114d1b)return{'success':!![],'value':_0x114d1b};return{'success':![],'reason':_0x34e37a(0x1f5)};}catch(_0x39ca95){const _0x20d918=_0x39ca95 instanceof Error?_0x39ca95[_0x34e37a(0x1d8)]:String(_0x39ca95);if(_0x20d918[_0x34e37a(0x1fd)](_0x34e37a(0x1fe))||_0x20d918[_0x34e37a(0x1db)]()[_0x34e37a(0x1fd)](_0x34e37a(0x1ee))||_0x20d918[_0x34e37a(0x1db)]()[_0x34e37a(0x1fd)]('not\x20found')||_0x20d918['toLowerCase']()[_0x34e37a(0x1fd)](_0x34e37a(0x1da)))return{'success':![],'reason':_0x34e37a(0x1f5)};if(_0x20d918[_0x34e37a(0x1fd)](_0x34e37a(0x1eb))||_0x20d918[_0x34e37a(0x1db)]()[_0x34e37a(0x1fd)](_0x34e37a(0x1f3))||_0x20d918[_0x34e37a(0x1db)]()[_0x34e37a(0x1fd)]('access'))return{'success':![],'reason':'access_denied','message':_0x34e37a(0x1e5)};return{'success':![],'reason':_0x34e37a(0x1e9),'message':_0x20d918};}}function a63_0x4b15(_0x547713,_0x4f7406){_0x547713=_0x547713-0x1d8;const _0x3b1f0b=a63_0x3b1f();let _0x4b153a=_0x3b1f0b[_0x547713];return _0x4b153a;}export async function saveKeychainAPIKey(_0x38235d,_0x16d67d){const _0x38ecfc=a63_0x4b15,_0x236e6b=await getEntryClass();if(!_0x236e6b)throw new Error(_0x38ecfc(0x1fb));const _0x15b444=getAccountName(_0x16d67d),_0x92e828=new _0x236e6b(SERVICE_NAME,_0x15b444);_0x92e828[_0x38ecfc(0x1e6)](_0x38235d);}export async function deleteKeychainAPIKey(_0x41a34c){const _0x4f6ea6=a63_0x4b15;try{const _0x405312=await getEntryClass();if(!_0x405312)return![];const _0x46c98a=getAccountName(_0x41a34c),_0x1dbe3e=new _0x405312(SERVICE_NAME,_0x46c98a);return _0x1dbe3e[_0x4f6ea6(0x1ef)](),!![];}catch{return![];}}export async function isKeychainAvailable(){const _0x1d83df=a63_0x4b15;try{const _0x23a96b=await getEntryClass();if(!_0x23a96b)return![];const _0x92023a=new _0x23a96b(SERVICE_NAME,_0x1d83df(0x1e1));return _0x92023a[_0x1d83df(0x1dd)](),!![];}catch(_0x3ca5d7){const _0x3f3211=_0x3ca5d7 instanceof Error?_0x3ca5d7[_0x1d83df(0x1d8)][_0x1d83df(0x1db)]():'';if(_0x3f3211[_0x1d83df(0x1fd)](_0x1d83df(0x1df))||_0x3f3211[_0x1d83df(0x1fd)]('not\x20supported')||_0x3f3211[_0x1d83df(0x1fd)]('cannot\x20find'))return![];return!![];}}
@@ -1 +1 @@
1
- const a64_0x3fe681=a64_0x3369;(function(_0x53901f,_0x8ef38b){const _0x18c501=a64_0x3369,_0x23e0c4=_0x53901f();while(!![]){try{const _0x3060de=parseInt(_0x18c501(0x15e))/0x1+parseInt(_0x18c501(0x16c))/0x2*(-parseInt(_0x18c501(0x16b))/0x3)+-parseInt(_0x18c501(0x161))/0x4+-parseInt(_0x18c501(0x169))/0x5*(-parseInt(_0x18c501(0x15a))/0x6)+parseInt(_0x18c501(0x165))/0x7*(parseInt(_0x18c501(0x168))/0x8)+-parseInt(_0x18c501(0x167))/0x9+parseInt(_0x18c501(0x160))/0xa*(parseInt(_0x18c501(0x166))/0xb);if(_0x3060de===_0x8ef38b)break;else _0x23e0c4['push'](_0x23e0c4['shift']());}catch(_0x4a52c9){_0x23e0c4['push'](_0x23e0c4['shift']());}}}(a64_0x4c63,0xc7e8d));const SERVICE_NAME=a64_0x3fe681(0x15c);function a64_0x4c63(){const _0x4cc52d=['50tJvBIC','226848GptEhy','profile:','parse','stringify','2108729NXHStB','1491336oLrmxM','5507460SVfjqT','24XtDhoo','5AKGWIy','Entry','33HLgziR','112754RPOxoW',':oauth_tokens','getPassword','1560246leSHyg','setPassword','tdx','System\x20keychain\x20is\x20not\x20available','265966EQtaeC','@napi-rs/keyring'];a64_0x4c63=function(){return _0x4cc52d;};return a64_0x4c63();}let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x56cf3b=a64_0x3fe681;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x46ce1b=await import(_0x56cf3b(0x15f));return EntryClass=_0x46ce1b[_0x56cf3b(0x16a)],EntryClass;}catch(_0x528d71){return keyringLoadError=_0x528d71 instanceof Error?_0x528d71:new Error(String(_0x528d71)),null;}}function getOAuthAccountName(_0x477422){const _0x410ed8=a64_0x3fe681,_0x4904a2=_0x477422||'';return _0x410ed8(0x162)+_0x4904a2+_0x410ed8(0x158);}export async function saveOAuthTokens(_0x589ead,_0x3ead4e){const _0x27695e=a64_0x3fe681,_0x5690e3=await getEntryClass();if(!_0x5690e3)throw new Error(_0x27695e(0x15d));const _0x3cfcf2=getOAuthAccountName(_0x3ead4e),_0x12c3ec=new _0x5690e3(SERVICE_NAME,_0x3cfcf2);_0x12c3ec[_0x27695e(0x15b)](JSON[_0x27695e(0x164)](_0x589ead));}export async function getOAuthTokens(_0x21a60e){const _0x17a848=a64_0x3fe681;try{const _0x1a8bf4=await getEntryClass();if(!_0x1a8bf4)return null;const _0x472aa5=getOAuthAccountName(_0x21a60e),_0x47a021=new _0x1a8bf4(SERVICE_NAME,_0x472aa5),_0x14bb7b=_0x47a021[_0x17a848(0x159)]();if(_0x14bb7b)return JSON[_0x17a848(0x163)](_0x14bb7b);return null;}catch{return null;}}function a64_0x3369(_0x1c2969,_0x3b5782){_0x1c2969=_0x1c2969-0x158;const _0x4c6370=a64_0x4c63();let _0x33699d=_0x4c6370[_0x1c2969];return _0x33699d;}export async function deleteOAuthTokens(_0x1dea1d){try{const _0x215f89=await getEntryClass();if(!_0x215f89)return![];const _0x1e8a43=getOAuthAccountName(_0x1dea1d),_0x3c520d=new _0x215f89(SERVICE_NAME,_0x1e8a43);return _0x3c520d['deleteCredential'](),!![];}catch{return![];}}
1
+ function a64_0xf738(_0x292296,_0x307e72){_0x292296=_0x292296-0x9f;const _0xacd844=a64_0xacd8();let _0xf73839=_0xacd844[_0x292296];return _0xf73839;}const a64_0x4284b8=a64_0xf738;(function(_0x33604c,_0x5e191a){const _0x25de37=a64_0xf738,_0x217359=_0x33604c();while(!![]){try{const _0x5c4fa0=-parseInt(_0x25de37(0xa3))/0x1+parseInt(_0x25de37(0xac))/0x2+-parseInt(_0x25de37(0xae))/0x3*(-parseInt(_0x25de37(0xa5))/0x4)+parseInt(_0x25de37(0xa0))/0x5+parseInt(_0x25de37(0xad))/0x6*(parseInt(_0x25de37(0xa6))/0x7)+-parseInt(_0x25de37(0xa9))/0x8+-parseInt(_0x25de37(0x9f))/0x9;if(_0x5c4fa0===_0x5e191a)break;else _0x217359['push'](_0x217359['shift']());}catch(_0x5459f7){_0x217359['push'](_0x217359['shift']());}}}(a64_0xacd8,0x5f4fe));const SERVICE_NAME=a64_0x4284b8(0xaa);let EntryClass=null,keyringLoadError=null;async function getEntryClass(){const _0x1e7e99=a64_0x4284b8;if(EntryClass!==null)return EntryClass;if(keyringLoadError!==null)return null;try{const _0x2d0ea6=await import(_0x1e7e99(0xab));return EntryClass=_0x2d0ea6[_0x1e7e99(0xa7)],EntryClass;}catch(_0x2d256b){return keyringLoadError=_0x2d256b instanceof Error?_0x2d256b:new Error(String(_0x2d256b)),null;}}function a64_0xacd8(){const _0x567809=['parse','211226akxbUs',':oauth_tokens','8NdqHKF','22267eCQqDl','Entry','stringify','4741464vpqAzp','tdx','@napi-rs/keyring','1070308rqudKJ','474DtSuZJ','34158uOJfxk','System\x20keychain\x20is\x20not\x20available','3498678UHgbZq','3869120StvWqb','profile:'];a64_0xacd8=function(){return _0x567809;};return a64_0xacd8();}function getOAuthAccountName(_0xd7d156){const _0x2c70f0=a64_0x4284b8,_0x3f80fc=_0xd7d156||'';return _0x2c70f0(0xa1)+_0x3f80fc+_0x2c70f0(0xa4);}export async function saveOAuthTokens(_0x32f015,_0x5ee0a3){const _0x2e964c=a64_0x4284b8,_0x54a15f=await getEntryClass();if(!_0x54a15f)throw new Error(_0x2e964c(0xaf));const _0x1467bd=getOAuthAccountName(_0x5ee0a3),_0x4033f3=new _0x54a15f(SERVICE_NAME,_0x1467bd);_0x4033f3['setPassword'](JSON[_0x2e964c(0xa8)](_0x32f015));}export async function getOAuthTokens(_0x33261e){const _0xb87704=a64_0x4284b8;try{const _0xf1fe72=await getEntryClass();if(!_0xf1fe72)return null;const _0x26a580=getOAuthAccountName(_0x33261e),_0x4b0903=new _0xf1fe72(SERVICE_NAME,_0x26a580),_0x3d0f5a=_0x4b0903['getPassword']();if(_0x3d0f5a)return JSON[_0xb87704(0xa2)](_0x3d0f5a);return null;}catch{return null;}}export async function deleteOAuthTokens(_0x36a8a8){try{const _0x26a8ee=await getEntryClass();if(!_0x26a8ee)return![];const _0x57bed0=getOAuthAccountName(_0x36a8a8),_0x2500f1=new _0x26a8ee(SERVICE_NAME,_0x57bed0);return _0x2500f1['deleteCredential'](),!![];}catch{return![];}}
@@ -1 +1 @@
1
- function a65_0x2880(_0xfc6f72,_0xb0b40f){_0xfc6f72=_0xfc6f72-0xd5;const _0x5cf2dc=a65_0x5cf2();let _0x288050=_0x5cf2dc[_0xfc6f72];return _0x288050;}const a65_0x65ed68=a65_0x2880;(function(_0x154fab,_0x4ba7ce){const _0xd6282c=a65_0x2880,_0xfbaee7=_0x154fab();while(!![]){try{const _0x511af1=parseInt(_0xd6282c(0xef))/0x1+parseInt(_0xd6282c(0xfc))/0x2+parseInt(_0xd6282c(0xe0))/0x3*(-parseInt(_0xd6282c(0xee))/0x4)+parseInt(_0xd6282c(0xf3))/0x5*(parseInt(_0xd6282c(0xe3))/0x6)+-parseInt(_0xd6282c(0xde))/0x7+parseInt(_0xd6282c(0xea))/0x8+-parseInt(_0xd6282c(0xfb))/0x9;if(_0x511af1===_0x4ba7ce)break;else _0xfbaee7['push'](_0xfbaee7['shift']());}catch(_0x58e31){_0xfbaee7['push'](_0xfbaee7['shift']());}}}(a65_0x5cf2,0x8b5c9));import*as a65_0x170c3a from'node:crypto';import*as a65_0x49f53b from'node:http';function a65_0x5cf2(){const _0x4fbe73=['stg-us01','application/x-www-form-urlencoded','writeHead','stg-ap01','authorization_code','client_id','hex','<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','POST','http://127.0.0.1','searchParams','toString','sha256','OAuth\x20token\x20request\x20failed\x20(','openid\x20email\x20profile','url','/oauth/callback','OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters','scope','dev-eu01','redirect_uri','):\x20','2694713fqQmAk','S256','1551EuIppV','text/html','createServer','6650778LmGRtv','has','tdx','digest','code','error','base64url','6370824MuIgTl','code_challenge_method','127.0.0.1','response_type','164dzSeNO','833166sglJFR','status','get','text/plain','5HjUqTo','close','state','end','dev-us01','set','listen','<html><body><h1>Authentication\x20Failed</h1><p>An\x20error\x20occurred\x20during\x20authentication.\x20Please\x20close\x20this\x20window\x20and\x20try\x20again.</p></body></html>','23571099vyVxdG','1716020Iayriv','message','randomBytes'];a65_0x5cf2=function(){return _0x4fbe73;};return a65_0x5cf2();}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';const OAUTH_SUPPORTED_SITES=new Set([a65_0x65ed68(0xf7),a65_0x65ed68(0xdb),a65_0x65ed68(0xff),a65_0x65ed68(0x102),'stg-ap03']);export function isOAuthSupported(_0x17cd21){const _0x21e173=a65_0x65ed68;return OAUTH_SUPPORTED_SITES[_0x21e173(0xe4)](_0x17cd21);}export const OAUTH_CALLBACK_PORT=0xaa4a;export const OAUTH_REDIRECT_URI='http://localhost:'+OAUTH_CALLBACK_PORT+a65_0x65ed68(0xd8);export function getOAuthClientId(){const _0x557433=a65_0x65ed68;return process.env.TD_OAUTH_CLIENT_ID||_0x557433(0xe5);}export function generatePKCEPair(){const _0x2872ee=a65_0x65ed68,_0x8b88a5=a65_0x170c3a[_0x2872ee(0xfe)](0x20)['toString'](_0x2872ee(0xe9)),_0x1db6f8=a65_0x170c3a['createHash'](_0x2872ee(0x10b))['update'](_0x8b88a5)[_0x2872ee(0xe6)](_0x2872ee(0xe9));return{'verifier':_0x8b88a5,'challenge':_0x1db6f8};}export function buildAuthorizeURL(_0x4d887a,_0x57bdd4){const _0x2b8303=a65_0x65ed68,_0x4270fc=new URL('/oauth/authorize',_0x4d887a);return _0x4270fc[_0x2b8303(0x109)][_0x2b8303(0xf8)](_0x2b8303(0xed),_0x2b8303(0xe7)),_0x4270fc[_0x2b8303(0x109)][_0x2b8303(0xf8)](_0x2b8303(0x104),_0x57bdd4['clientId']),_0x4270fc[_0x2b8303(0x109)]['set'](_0x2b8303(0xdc),_0x57bdd4['redirectUri']),_0x4270fc[_0x2b8303(0x109)][_0x2b8303(0xf8)](_0x2b8303(0xf5),_0x57bdd4[_0x2b8303(0xf5)]),_0x4270fc['searchParams'][_0x2b8303(0xf8)]('code_challenge',_0x57bdd4['codeChallenge']),_0x4270fc[_0x2b8303(0x109)][_0x2b8303(0xf8)](_0x2b8303(0xeb),_0x2b8303(0xdf)),_0x57bdd4[_0x2b8303(0xda)]&&_0x4270fc[_0x2b8303(0x109)][_0x2b8303(0xf8)]('scope',_0x57bdd4['scope']),_0x4270fc[_0x2b8303(0x10a)]();}export async function postTokenRequest(_0x28e8d1,_0x1ecc54){const _0x177087=a65_0x65ed68,_0x28426b=new URLSearchParams(_0x1ecc54)['toString'](),_0xfc4daf=await fetch(_0x28e8d1,{'method':_0x177087(0x107),'headers':{'Content-Type':_0x177087(0x100)},'body':_0x28426b});if(!_0xfc4daf['ok']){const _0x30e615=await _0xfc4daf['text']();throw new Error(_0x177087(0xd5)+_0xfc4daf[_0x177087(0xf0)]+_0x177087(0xdd)+_0x30e615);}return await _0xfc4daf['json']();}export async function exchangeCodeForTokens(_0x34ee31,_0xfee26b,_0x5762f0,_0x2718ee){const _0x5a42e6=a65_0x65ed68,_0x102586=_0x34ee31+'/oauth/token';return postTokenRequest(_0x102586,{'grant_type':_0x5a42e6(0x103),'client_id':getOAuthClientId(),'code':_0xfee26b,'code_verifier':_0x5762f0,'redirect_uri':_0x2718ee});}export function startLocalCallbackServer(){const _0x4093ce=a65_0x65ed68;let _0x5aae28,_0xb14ae0;const _0x3bb344=new Promise((_0x4af33e,_0x27b202)=>{_0x5aae28=_0x4af33e,_0xb14ae0=_0x27b202;}),_0x587d9b=a65_0x49f53b[_0x4093ce(0xe2)]((_0x25d4cc,_0x329977)=>{const _0xb3bfce=_0x4093ce,_0x4b57dd=new URL(_0x25d4cc[_0xb3bfce(0xd7)]||'/',_0xb3bfce(0x108));if(_0x4b57dd['pathname']!=='/oauth/callback'){_0x329977[_0xb3bfce(0x101)](0x194,{'Content-Type':_0xb3bfce(0xf2)}),_0x329977['end']('Not\x20Found');return;}const _0x20aecd=_0x4b57dd[_0xb3bfce(0x109)][_0xb3bfce(0xf1)](_0xb3bfce(0xe7)),_0xb19d21=_0x4b57dd[_0xb3bfce(0x109)][_0xb3bfce(0xf1)](_0xb3bfce(0xf5)),_0x29c80b=_0x4b57dd[_0xb3bfce(0x109)][_0xb3bfce(0xf1)]('error');if(_0x29c80b||!_0x20aecd||!_0xb19d21){_0x329977[_0xb3bfce(0x101)](0x190,{'Content-Type':_0xb3bfce(0xe1)}),_0x329977[_0xb3bfce(0xf6)](_0xb3bfce(0xfa)),_0xb14ae0(new Error(_0xb3bfce(0xd9)));return;}_0x329977[_0xb3bfce(0x101)](0xc8,{'Content-Type':_0xb3bfce(0xe1)}),_0x329977[_0xb3bfce(0xf6)](_0xb3bfce(0x106)),_0x5aae28({'code':_0x20aecd,'state':_0xb19d21});});_0x587d9b['on'](_0x4093ce(0xe8),_0x5b234c=>{const _0x164cca=_0x4093ce;_0x5b234c[_0x164cca(0xe7)]==='EADDRINUSE'?_0xb14ae0(new Error('Port\x20'+OAUTH_CALLBACK_PORT+'\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.')):_0xb14ae0(new Error('Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20'+_0x5b234c[_0x164cca(0xfd)]));}),_0x587d9b[_0x4093ce(0xf9)](OAUTH_CALLBACK_PORT,_0x4093ce(0xec));const _0x21cf9e=setTimeout(()=>{const _0x437411=_0x4093ce;_0xb14ae0(new Error('OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes')),_0x587d9b[_0x437411(0xf4)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x3bb344,'close':()=>{const _0x2c2770=_0x4093ce;clearTimeout(_0x21cf9e),_0x587d9b[_0x2c2770(0xf4)]();}};}export async function startOAuthFlow(_0x2806c9){const _0x5226cf=a65_0x65ed68,_0x2e6245=getConsoleUrl(_0x2806c9),_0x545933=getOAuthClientId(),{verifier:_0x2b5acb,challenge:_0x2a9a86}=generatePKCEPair(),_0x14d7fd=a65_0x170c3a['randomBytes'](0x10)[_0x5226cf(0x10a)](_0x5226cf(0x105)),_0x34c338=startLocalCallbackServer();try{const _0x297696=OAUTH_REDIRECT_URI,_0x5c7e8a=buildAuthorizeURL(_0x2e6245,{'clientId':_0x545933,'redirectUri':_0x297696,'state':_0x14d7fd,'codeChallenge':_0x2a9a86,'scope':_0x5226cf(0xd6)});openBrowser(_0x5c7e8a);const _0x4490e2=await _0x34c338['waitForCallback']();if(_0x4490e2[_0x5226cf(0xf5)]!==_0x14d7fd)throw new Error('OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack');return await exchangeCodeForTokens(_0x2e6245,_0x4490e2[_0x5226cf(0xe7)],_0x2b5acb,_0x297696);}finally{_0x34c338[_0x5226cf(0xf4)]();}}
1
+ const a65_0x1df586=a65_0x2ae2;(function(_0x416c5a,_0x29b599){const _0x525eda=a65_0x2ae2,_0x4687d3=_0x416c5a();while(!![]){try{const _0x5ad54d=-parseInt(_0x525eda(0x1a6))/0x1*(-parseInt(_0x525eda(0x1b2))/0x2)+-parseInt(_0x525eda(0x1bc))/0x3*(-parseInt(_0x525eda(0x1a0))/0x4)+-parseInt(_0x525eda(0x186))/0x5*(-parseInt(_0x525eda(0x18e))/0x6)+parseInt(_0x525eda(0x1a8))/0x7+-parseInt(_0x525eda(0x19d))/0x8*(parseInt(_0x525eda(0x1a9))/0x9)+-parseInt(_0x525eda(0x1b9))/0xa+parseInt(_0x525eda(0x195))/0xb;if(_0x5ad54d===_0x29b599)break;else _0x4687d3['push'](_0x4687d3['shift']());}catch(_0x8b439e){_0x4687d3['push'](_0x4687d3['shift']());}}}(a65_0xfa49,0xc244a));import*as a65_0x231da0 from'node:crypto';import*as a65_0x23e788 from'node:http';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';const OAUTH_SUPPORTED_SITES=new Set([a65_0x1df586(0x1b5),a65_0x1df586(0x188),a65_0x1df586(0x184),a65_0x1df586(0x197),'stg-ap03']);export function isOAuthSupported(_0x2f92b2){return OAUTH_SUPPORTED_SITES['has'](_0x2f92b2);}export const OAUTH_CALLBACK_PORT=0xaa4a;function a65_0xfa49(){const _0x2a7133=['<html><body><h1>Authentication\x20Successful</h1><p>You\x20can\x20close\x20this\x20window\x20and\x20return\x20to\x20the\x20terminal.</p></body></html>','message','digest','64062OxYnSf','text','/oauth/callback','clientId','end','close','toString','674410WOJwfN','127.0.0.1','stg-ap01','OAuth\x20callback\x20timed\x20out\x20after\x202\x20minutes','/oauth/authorize','EADDRINUSE','status','get','62064MKgYZj','Failed\x20to\x20start\x20OAuth\x20callback\x20server:\x20','error','207636MQMPws','createHash','):\x20','client_id','randomBytes','POST','831799pfjUea','code','1415932ZJkqyG','342QWQXlA','redirectUri','/oauth/token','S256','state','redirect_uri','<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','http://127.0.0.1','2TNGMpx','update','Not\x20Found','dev-us01','listen','codeChallenge','set','7905290tbscRd','createServer','text/plain','9NxmJVZ','text/html','code_challenge_method','http://localhost:','searchParams','base64url','hex','\x20is\x20already\x20in\x20use.\x20Stop\x20the\x20process\x20using\x20it\x20and\x20retry.','tdx','url','Port\x20','stg-us01','scope','295pVNiRl','code_challenge','dev-eu01','writeHead','waitForCallback'];a65_0xfa49=function(){return _0x2a7133;};return a65_0xfa49();}export const OAUTH_REDIRECT_URI=a65_0x1df586(0x1bf)+OAUTH_CALLBACK_PORT+'/oauth/callback';export function getOAuthClientId(){const _0x39bb78=a65_0x1df586;return process.env.TD_OAUTH_CLIENT_ID||_0x39bb78(0x181);}export function generatePKCEPair(){const _0x1ecf61=a65_0x1df586,_0x406800=a65_0x231da0[_0x1ecf61(0x1a4)](0x20)[_0x1ecf61(0x194)](_0x1ecf61(0x17e)),_0x34f06a=a65_0x231da0[_0x1ecf61(0x1a1)]('sha256')[_0x1ecf61(0x1b3)](_0x406800)[_0x1ecf61(0x18d)](_0x1ecf61(0x17e));return{'verifier':_0x406800,'challenge':_0x34f06a};}export function buildAuthorizeURL(_0x1ccfa3,_0x5747c2){const _0x56a459=a65_0x1df586,_0x2f9946=new URL(_0x56a459(0x199),_0x1ccfa3);return _0x2f9946['searchParams']['set']('response_type',_0x56a459(0x1a7)),_0x2f9946['searchParams'][_0x56a459(0x1b8)](_0x56a459(0x1a3),_0x5747c2[_0x56a459(0x191)]),_0x2f9946[_0x56a459(0x17d)]['set'](_0x56a459(0x1ae),_0x5747c2[_0x56a459(0x1aa)]),_0x2f9946['searchParams'][_0x56a459(0x1b8)](_0x56a459(0x1ad),_0x5747c2[_0x56a459(0x1ad)]),_0x2f9946[_0x56a459(0x17d)][_0x56a459(0x1b8)](_0x56a459(0x187),_0x5747c2[_0x56a459(0x1b7)]),_0x2f9946[_0x56a459(0x17d)][_0x56a459(0x1b8)](_0x56a459(0x1be),_0x56a459(0x1ac)),_0x5747c2[_0x56a459(0x185)]&&_0x2f9946[_0x56a459(0x17d)][_0x56a459(0x1b8)](_0x56a459(0x185),_0x5747c2[_0x56a459(0x185)]),_0x2f9946['toString']();}export async function postTokenRequest(_0x130964,_0x5039f9){const _0x1f421d=a65_0x1df586,_0x81a0c1=new URLSearchParams(_0x5039f9)['toString'](),_0x52c7e1=await fetch(_0x130964,{'method':_0x1f421d(0x1a5),'headers':{'Content-Type':_0x1f421d(0x1b0)},'body':_0x81a0c1});if(!_0x52c7e1['ok']){const _0x56f166=await _0x52c7e1[_0x1f421d(0x18f)]();throw new Error('OAuth\x20token\x20request\x20failed\x20('+_0x52c7e1[_0x1f421d(0x19b)]+_0x1f421d(0x1a2)+_0x56f166);}return await _0x52c7e1['json']();}function a65_0x2ae2(_0x50c09b,_0xbb9819){_0x50c09b=_0x50c09b-0x17d;const _0xfa498f=a65_0xfa49();let _0x2ae27d=_0xfa498f[_0x50c09b];return _0x2ae27d;}export async function exchangeCodeForTokens(_0x4960e9,_0x57e791,_0x4c3f45,_0x3cd751){const _0x884ef7=a65_0x1df586,_0x3dc3b7=_0x4960e9+_0x884ef7(0x1ab);return postTokenRequest(_0x3dc3b7,{'grant_type':'authorization_code','client_id':getOAuthClientId(),'code':_0x57e791,'code_verifier':_0x4c3f45,'redirect_uri':_0x3cd751});}export function startLocalCallbackServer(){const _0x161e26=a65_0x1df586;let _0x4038cc,_0x4e4b89;const _0x377caf=new Promise((_0x13be22,_0x323fe2)=>{_0x4038cc=_0x13be22,_0x4e4b89=_0x323fe2;}),_0x1609f3=a65_0x23e788[_0x161e26(0x1ba)]((_0x59787f,_0x3206f0)=>{const _0x11ae7b=_0x161e26,_0x5b33f1=new URL(_0x59787f[_0x11ae7b(0x182)]||'/',_0x11ae7b(0x1b1));if(_0x5b33f1['pathname']!==_0x11ae7b(0x190)){_0x3206f0[_0x11ae7b(0x189)](0x194,{'Content-Type':_0x11ae7b(0x1bb)}),_0x3206f0[_0x11ae7b(0x192)](_0x11ae7b(0x1b4));return;}const _0x2a431d=_0x5b33f1[_0x11ae7b(0x17d)][_0x11ae7b(0x19c)](_0x11ae7b(0x1a7)),_0x5a4a3f=_0x5b33f1[_0x11ae7b(0x17d)]['get'](_0x11ae7b(0x1ad)),_0x26c1ba=_0x5b33f1[_0x11ae7b(0x17d)]['get'](_0x11ae7b(0x19f));if(_0x26c1ba||!_0x2a431d||!_0x5a4a3f){_0x3206f0['writeHead'](0x190,{'Content-Type':_0x11ae7b(0x1bd)}),_0x3206f0[_0x11ae7b(0x192)](_0x11ae7b(0x1af)),_0x4e4b89(new Error('OAuth\x20callback\x20received\x20an\x20error\x20or\x20missing\x20parameters'));return;}_0x3206f0[_0x11ae7b(0x189)](0xc8,{'Content-Type':_0x11ae7b(0x1bd)}),_0x3206f0[_0x11ae7b(0x192)](_0x11ae7b(0x18b)),_0x4038cc({'code':_0x2a431d,'state':_0x5a4a3f});});_0x1609f3['on'](_0x161e26(0x19f),_0x426055=>{const _0x5e1b64=_0x161e26;_0x426055['code']===_0x5e1b64(0x19a)?_0x4e4b89(new Error(_0x5e1b64(0x183)+OAUTH_CALLBACK_PORT+_0x5e1b64(0x180))):_0x4e4b89(new Error(_0x5e1b64(0x19e)+_0x426055[_0x5e1b64(0x18c)]));}),_0x1609f3[_0x161e26(0x1b6)](OAUTH_CALLBACK_PORT,_0x161e26(0x196));const _0x425bd1=setTimeout(()=>{const _0x24ae94=_0x161e26;_0x4e4b89(new Error(_0x24ae94(0x198))),_0x1609f3[_0x24ae94(0x193)]();},0x2*0x3c*0x3e8);return{'waitForCallback':()=>_0x377caf,'close':()=>{const _0x270729=_0x161e26;clearTimeout(_0x425bd1),_0x1609f3[_0x270729(0x193)]();}};}export async function startOAuthFlow(_0x4f55a9){const _0x319a2c=a65_0x1df586,_0xbe93d3=getConsoleUrl(_0x4f55a9),_0x54498f=getOAuthClientId(),{verifier:_0x55ecb0,challenge:_0x49d0cb}=generatePKCEPair(),_0x456fdb=a65_0x231da0[_0x319a2c(0x1a4)](0x10)[_0x319a2c(0x194)](_0x319a2c(0x17f)),_0x40cb4a=startLocalCallbackServer();try{const _0x48fbfb=OAUTH_REDIRECT_URI,_0x5eab49=buildAuthorizeURL(_0xbe93d3,{'clientId':_0x54498f,'redirectUri':_0x48fbfb,'state':_0x456fdb,'codeChallenge':_0x49d0cb,'scope':'openid\x20email\x20profile'});openBrowser(_0x5eab49);const _0x127f69=await _0x40cb4a[_0x319a2c(0x18a)]();if(_0x127f69[_0x319a2c(0x1ad)]!==_0x456fdb)throw new Error('OAuth\x20state\x20mismatch\x20—\x20possible\x20CSRF\x20attack');return await exchangeCodeForTokens(_0xbe93d3,_0x127f69[_0x319a2c(0x1a7)],_0x55ecb0,_0x48fbfb);}finally{_0x40cb4a[_0x319a2c(0x193)]();}}
@@ -1 +1 @@
1
- (function(_0x1e1e28,_0x2d54d9){const _0x3666f0=a66_0x1131,_0x1f3086=_0x1e1e28();while(!![]){try{const _0x50331d=parseInt(_0x3666f0(0x1e1))/0x1*(-parseInt(_0x3666f0(0x1ee))/0x2)+-parseInt(_0x3666f0(0x1e3))/0x3+-parseInt(_0x3666f0(0x21b))/0x4*(parseInt(_0x3666f0(0x1f2))/0x5)+-parseInt(_0x3666f0(0x1ea))/0x6*(-parseInt(_0x3666f0(0x1ef))/0x7)+-parseInt(_0x3666f0(0x205))/0x8+parseInt(_0x3666f0(0x211))/0x9+parseInt(_0x3666f0(0x20d))/0xa;if(_0x50331d===_0x2d54d9)break;else _0x1f3086['push'](_0x1f3086['shift']());}catch(_0x4dd2e5){_0x1f3086['push'](_0x1f3086['shift']());}}}(a66_0x51bc,0xdd8e3));import*as a66_0x4d0c7b from'node:fs';import*as a66_0x29b817 from'node:path';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME='@tdx-studio';export function getProfileParams(_0x5353a6){const _0x5d4f3c=a66_0x1131,_0x54a61e={};if(!_0x5353a6)return _0x54a61e;for(const [_0x7ad666,_0x209dfd]of Object['entries'](_0x5353a6)){_0x7ad666!==_0x5d4f3c(0x212)&&_0x209dfd!==undefined&&(_0x54a61e[_0x7ad666]=_0x209dfd);}return _0x54a61e;}export function getProfilesDir(){const _0x3f34e2=a66_0x1131;return a66_0x29b817[_0x3f34e2(0x21c)](getConfigDir(),_0x3f34e2(0x207));}function getProfileDir(_0x2d6947){const _0x48dfb4=a66_0x1131;return a66_0x29b817[_0x48dfb4(0x21c)](getProfilesDir(),_0x2d6947);}function a66_0x51bc(){const _0x3746ce=['llm_project','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','Profile\x20','.env','find','user','\x27\x20not\x20found\x20in\x20user\x20configuration','database','localeCompare','\x27:\x20config\x20must\x20be\x20an\x20object','name','map','set','stringify','directory','isDirectory',',\x20creating\x20new\x20file','81fGrblM','Failed\x20to\x20parse\x20','2947932FsidsX','has','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','readdirSync','existsSync','toISOString','\x22\x20\x22','354pjTRkZ','utf-8','readFileSync','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','3422ZTNDPe','53347tRLcDQ','To\x20migrate:','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.','5975105NvNbpH','string','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','length','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','\x20already\x20exists','Error:\x20','warn','Warning:\x20Failed\x20to\x20parse\x20','local','message','some','test','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','rmSync','push','profile','user_info','entries','8576368NjuhEn','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','profiles','Profile\x20\x27','sort','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','\x20does\x20not\x20exist','tdx.json','33787330GIyXYb','from','site','parse','4206789fxyMPl','description','INVALID_PROFILE_CONFIG','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','object','llm_agent','parent_segment','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','\x27\x20will\x20be\x20ignored','Invalid\x20profile\x20name:\x20','4OPMDdo','join',':\x20Invalid\x20JSON\x20syntax','filter','.env.','Warning:\x20Profile\x20\x27','\x0aWarning:\x20Failed\x20to\x20parse\x20'];a66_0x51bc=function(){return _0x3746ce;};return a66_0x51bc();}function getProfileConfigPath(_0x16e412){const _0x48468e=a66_0x1131;return a66_0x29b817['join'](getProfileDir(_0x16e412),_0x48468e(0x20c));}function getProfileEnvPath(_0x5bf7f9){const _0x1ff593=a66_0x1131;return a66_0x29b817[_0x1ff593(0x21c)](getProfileDir(_0x5bf7f9),_0x1ff593(0x1d3));}function getGlobalConfigPath(){const _0x73a6eb=a66_0x1131;return a66_0x29b817[_0x73a6eb(0x21c)](getConfigDir(),_0x73a6eb(0x20c));}function validateProfileName(_0x5497ca){const _0x3175f1=a66_0x1131;if(/^@?[a-zA-Z0-9_-]+$/[_0x3175f1(0x1fe)](_0x5497ca))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/['test'](_0x5497ca))return;throw new Error(_0x3175f1(0x21a)+_0x5497ca+_0x3175f1(0x1f1));}function validateProfileConfig(_0x3557ad,_0x234acc){const _0x41db5c=a66_0x1131;if(typeof _0x3557ad!=='object'||_0x3557ad===null)throw new SDKError(ErrorCode[_0x41db5c(0x213)],_0x41db5c(0x208)+_0x234acc+_0x41db5c(0x1d9));const _0x2edbf8=['description',_0x41db5c(0x20f),_0x41db5c(0x1d7),_0x41db5c(0x217),_0x41db5c(0x1d0),_0x41db5c(0x216),_0x41db5c(0x203)],_0x236cc1=_0x3557ad;for(const _0x197c06 of Object['keys'](_0x236cc1)){!_0x2edbf8['includes'](_0x197c06)&&console['warn'](_0x41db5c(0x1ce)+_0x234acc+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x197c06+_0x41db5c(0x219));}if(_0x236cc1['description']!==undefined&&typeof _0x236cc1[_0x41db5c(0x212)]!==_0x41db5c(0x1f3))throw new SDKError(ErrorCode[_0x41db5c(0x213)],_0x41db5c(0x208)+_0x234acc+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x236cc1[_0x41db5c(0x20f)]!==undefined&&typeof _0x236cc1['site']!==_0x41db5c(0x1f3))throw new SDKError(ErrorCode[_0x41db5c(0x213)],_0x41db5c(0x208)+_0x234acc+_0x41db5c(0x206));if(_0x236cc1[_0x41db5c(0x1d7)]!==undefined&&typeof _0x236cc1[_0x41db5c(0x1d7)]!==_0x41db5c(0x1f3))throw new SDKError(ErrorCode[_0x41db5c(0x213)],_0x41db5c(0x208)+_0x234acc+_0x41db5c(0x218));if(_0x236cc1[_0x41db5c(0x217)]!==undefined&&typeof _0x236cc1[_0x41db5c(0x217)]!==_0x41db5c(0x1f3))throw new SDKError(ErrorCode[_0x41db5c(0x213)],_0x41db5c(0x208)+_0x234acc+_0x41db5c(0x1f4));if(_0x236cc1['llm_project']!==undefined&&typeof _0x236cc1['llm_project']!==_0x41db5c(0x1f3))throw new SDKError(ErrorCode[_0x41db5c(0x213)],_0x41db5c(0x208)+_0x234acc+_0x41db5c(0x214));if(_0x236cc1[_0x41db5c(0x216)]!==undefined&&typeof _0x236cc1['llm_agent']!=='string')throw new SDKError(ErrorCode['INVALID_PROFILE_CONFIG'],_0x41db5c(0x208)+_0x234acc+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function a66_0x1131(_0x13261e,_0x3bfba0){_0x13261e=_0x13261e-0x1cc;const _0x51bc0b=a66_0x51bc();let _0x11314e=_0x51bc0b[_0x13261e];return _0x11314e;}function loadProfilesFromTdxJson(_0x482def,_0x4d3684){const _0x370307=a66_0x1131;if(!a66_0x4d0c7b[_0x370307(0x1e7)](_0x482def))return[];try{const _0xde8d23=a66_0x4d0c7b['readFileSync'](_0x482def,_0x370307(0x1eb)),_0x1395dd=JSON[_0x370307(0x210)](_0xde8d23);if(!_0x1395dd[_0x370307(0x207)]||typeof _0x1395dd[_0x370307(0x207)]!==_0x370307(0x215))return[];const _0x5e4612=[];for(const [_0x1e5796,_0x330aab]of Object[_0x370307(0x204)](_0x1395dd[_0x370307(0x207)])){try{validateProfileConfig(_0x330aab,_0x1e5796);const _0x117283=getNewCredentialPath(_0x1e5796),_0x4e694a=getOldCredentialPath(_0x1e5796),_0x40cf2e=a66_0x4d0c7b[_0x370307(0x1e7)](_0x117283)||a66_0x4d0c7b[_0x370307(0x1e7)](_0x4e694a);_0x5e4612[_0x370307(0x201)]({'name':_0x1e5796,'config':_0x330aab,'metadata':{'name':_0x1e5796,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x40cf2e,'scope':_0x4d3684});}catch(_0x132877){_0x132877 instanceof Error&&(console[_0x370307(0x1f9)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x482def+':'),console[_0x370307(0x1f9)]('\x20\x20'+_0x132877[_0x370307(0x1fc)]+'\x0a'));}}return _0x5e4612;}catch(_0x2744ef){return _0x2744ef instanceof SyntaxError?(console[_0x370307(0x1f9)](_0x370307(0x1cf)+_0x482def+_0x370307(0x21d)),console[_0x370307(0x1f9)](_0x370307(0x1f8)+_0x2744ef[_0x370307(0x1fc)]+'\x0a')):console[_0x370307(0x1f9)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x482def+':\x20'+_0x2744ef+'\x0a'),[];}}export function getNewCredentialPath(_0x4fb82a){const _0x5a8e3b=a66_0x1131;return a66_0x29b817[_0x5a8e3b(0x21c)](getConfigDir(),_0x5a8e3b(0x1cd)+_0x4fb82a);}function getOldCredentialPath(_0x2584e0){const _0x49af19=a66_0x1131;return a66_0x29b817['join'](getProfilesDir(),_0x2584e0,_0x49af19(0x1d3));}function loadProfilesFromTdxJsonFiles(){const _0x18ef6c=a66_0x1131,_0x5bec3b=[],_0x2f59dc=findProjectConfigPath();_0x2f59dc&&_0x5bec3b['push'](...loadProfilesFromTdxJson(_0x2f59dc,_0x18ef6c(0x1fb)));const _0x1258ab=a66_0x29b817[_0x18ef6c(0x21c)](getConfigDir(),_0x18ef6c(0x20c));return _0x5bec3b[_0x18ef6c(0x201)](...loadProfilesFromTdxJson(_0x1258ab,_0x18ef6c(0x1d5))),_0x5bec3b;}function loadProfilesFromDirectories(){const _0x458167=a66_0x1131,_0x30c158=getProfilesDir();if(!a66_0x4d0c7b[_0x458167(0x1e7)](_0x30c158))return[];try{return a66_0x4d0c7b[_0x458167(0x1e6)](_0x30c158,{'withFileTypes':!![]})[_0x458167(0x1cc)](_0x12007a=>_0x12007a[_0x458167(0x1df)]())[_0x458167(0x1db)](_0x29fdee=>_0x29fdee[_0x458167(0x1da)])['filter'](_0x5a7f83=>{const _0x3d4df8=_0x458167,_0x3f06e4=getProfileConfigPath(_0x5a7f83),_0xfeb3cc=getProfileEnvPath(_0x5a7f83);return a66_0x4d0c7b[_0x3d4df8(0x1e7)](_0x3f06e4)||a66_0x4d0c7b[_0x3d4df8(0x1e7)](_0xfeb3cc);})[_0x458167(0x1db)](_0x4e625e=>{const _0x205ace=_0x458167,_0x4932f3=loadProfileFromDirectory(_0x4e625e);if(_0x4932f3)return{..._0x4932f3,'scope':_0x205ace(0x1de)};return null;})[_0x458167(0x1cc)](_0x49b414=>_0x49b414!==null);}catch{return[];}}function loadProfileFromDirectory(_0xf259ca){const _0x5ef79b=a66_0x1131,_0x34cd23=getProfileConfigPath(_0xf259ca),_0x49e342=getOldCredentialPath(_0xf259ca);if(!a66_0x4d0c7b[_0x5ef79b(0x1e7)](_0x34cd23)&&!a66_0x4d0c7b[_0x5ef79b(0x1e7)](_0x49e342))return null;let _0x1bda61={},_0x4931f1={'name':_0xf259ca,'createdAt':new Date()[_0x5ef79b(0x1e8)]()};if(a66_0x4d0c7b['existsSync'](_0x34cd23))try{const _0x4d0962=a66_0x4d0c7b['readFileSync'](_0x34cd23,'utf-8'),_0x18e0d8=JSON[_0x5ef79b(0x210)](_0x4d0962),{metadata:_0x463ddb,..._0x480492}=_0x18e0d8;_0x1bda61=_0x480492,_0x463ddb&&(_0x4931f1=_0x463ddb);}catch{}return{'name':_0xf259ca,'config':_0x1bda61,'metadata':_0x4931f1,'hasCredentials':a66_0x4d0c7b['existsSync'](_0x49e342),'scope':_0x5ef79b(0x1de)};}export function listProfiles(){const _0x2cb44b=a66_0x1131,_0x1566b7=loadProfilesFromTdxJsonFiles(),_0x466927=loadProfilesFromDirectories();if(_0x466927[_0x2cb44b(0x1f5)]>0x0){const _0x53b7ce=_0x466927[_0x2cb44b(0x1db)](_0x5f42cc=>_0x5f42cc[_0x2cb44b(0x1da)])[_0x2cb44b(0x21c)](',\x20'),_0x3e26b1=getConfigDir();console[_0x2cb44b(0x1f9)](_0x2cb44b(0x20a)+_0x53b7ce),console[_0x2cb44b(0x1f9)](_0x2cb44b(0x1f6)),console[_0x2cb44b(0x1f9)]('\x20\x201.\x20Edit:\x20'+a66_0x29b817[_0x2cb44b(0x21c)](_0x3e26b1,'tdx.json')),console[_0x2cb44b(0x1f9)](_0x2cb44b(0x1d1)),console[_0x2cb44b(0x1f9)](_0x2cb44b(0x1e5));}const _0x41cb38=[..._0x1566b7,..._0x466927],_0x4d57e8=new Map();for(const _0x57db0f of _0x41cb38){!_0x4d57e8[_0x2cb44b(0x1e4)](_0x57db0f[_0x2cb44b(0x1da)])&&_0x4d57e8[_0x2cb44b(0x1dc)](_0x57db0f[_0x2cb44b(0x1da)],_0x57db0f);}return Array[_0x2cb44b(0x20e)](_0x4d57e8['values']())[_0x2cb44b(0x209)]((_0x2b82d6,_0x287232)=>_0x2b82d6['name'][_0x2cb44b(0x1d8)](_0x287232[_0x2cb44b(0x1da)]));}export function profileExists(_0x338a47){const _0x5437ef=a66_0x1131,_0x2f8e3b=listProfiles();return _0x2f8e3b[_0x5437ef(0x1fd)](_0x512aa4=>_0x512aa4[_0x5437ef(0x1da)]===_0x338a47);}export function loadProfile(_0x38092f){const _0x3954d6=a66_0x1131;validateProfileName(_0x38092f);const _0x34a9e3=listProfiles(),_0x876997=_0x34a9e3[_0x3954d6(0x1d4)](_0x42dba8=>_0x42dba8[_0x3954d6(0x1da)]===_0x38092f);return _0x876997||null;}export function saveProfile(_0x1550e4,_0x5095c7,_0x36896d=![]){saveProfileToUserConfig(_0x1550e4,_0x5095c7);}export function deleteProfile(_0x195a5a){const _0x333fbc=a66_0x1131;validateProfileName(_0x195a5a);const _0x4a8690=getProfileDir(_0x195a5a);if(!a66_0x4d0c7b['existsSync'](_0x4a8690))throw new Error(_0x333fbc(0x1d2)+_0x195a5a+_0x333fbc(0x20b));a66_0x4d0c7b[_0x333fbc(0x200)](_0x4a8690,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x49f1be,_0x2e2de7){const _0x1cbcd0=a66_0x1131;validateProfileName(_0x49f1be);const _0x58d6cb=getGlobalConfigPath(),_0x38eb95=getConfigDir();!a66_0x4d0c7b['existsSync'](_0x38eb95)&&createSecureDirectory(_0x38eb95);let _0xb5eac4={};if(a66_0x4d0c7b[_0x1cbcd0(0x1e7)](_0x58d6cb))try{const _0x1aa632=a66_0x4d0c7b[_0x1cbcd0(0x1ec)](_0x58d6cb,_0x1cbcd0(0x1eb));_0xb5eac4=JSON[_0x1cbcd0(0x210)](_0x1aa632);}catch{console['warn']('Warning:\x20Failed\x20to\x20parse\x20'+_0x58d6cb+_0x1cbcd0(0x1e0));}!_0xb5eac4[_0x1cbcd0(0x207)]&&(_0xb5eac4[_0x1cbcd0(0x207)]={}),_0xb5eac4[_0x1cbcd0(0x207)][_0x49f1be]=_0x2e2de7,writeSecureFile(_0x58d6cb,JSON['stringify'](_0xb5eac4,null,0x2));}export function removeProfileFromUserConfig(_0x3059d7){const _0x55282f=a66_0x1131;validateProfileName(_0x3059d7);const _0x2804ac=getGlobalConfigPath();if(!a66_0x4d0c7b[_0x55282f(0x1e7)](_0x2804ac))throw new Error(_0x55282f(0x208)+_0x3059d7+_0x55282f(0x1d6));let _0x4b9adf={};try{const _0x274524=a66_0x4d0c7b[_0x55282f(0x1ec)](_0x2804ac,_0x55282f(0x1eb));_0x4b9adf=JSON[_0x55282f(0x210)](_0x274524);}catch{throw new Error(_0x55282f(0x1e2)+_0x2804ac);}if(!_0x4b9adf[_0x55282f(0x207)]||!_0x4b9adf[_0x55282f(0x207)][_0x3059d7])throw new Error(_0x55282f(0x208)+_0x3059d7+_0x55282f(0x1d6));delete _0x4b9adf['profiles'][_0x3059d7],_0x4b9adf[_0x55282f(0x202)]===_0x3059d7&&delete _0x4b9adf[_0x55282f(0x202)],writeSecureFile(_0x2804ac,JSON[_0x55282f(0x1dd)](_0x4b9adf,null,0x2));}export function getActiveProfile(){const _0x44ea4d=a66_0x1131,_0x3d0c71=loadSessionContext();if(_0x3d0c71?.[_0x44ea4d(0x202)])return _0x3d0c71[_0x44ea4d(0x202)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x2f15a4=getGlobalConfigPath();if(!a66_0x4d0c7b['existsSync'](_0x2f15a4))return null;try{const _0x4c9c46=a66_0x4d0c7b[_0x44ea4d(0x1ec)](_0x2f15a4,'utf-8'),_0x12696f=JSON[_0x44ea4d(0x210)](_0x4c9c46);return _0x12696f[_0x44ea4d(0x202)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x9b059c){const _0x489111=a66_0x1131,_0x204578=getGlobalConfigPath(),_0x1af367=getConfigDir();!a66_0x4d0c7b[_0x489111(0x1e7)](_0x1af367)&&createSecureDirectory(_0x1af367);let _0x1e1b1a={};if(a66_0x4d0c7b[_0x489111(0x1e7)](_0x204578))try{const _0x152a32=a66_0x4d0c7b[_0x489111(0x1ec)](_0x204578,_0x489111(0x1eb));_0x1e1b1a=JSON['parse'](_0x152a32);}catch{console['warn'](_0x489111(0x1fa)+_0x204578+_0x489111(0x1e0));}_0x1e1b1a[_0x489111(0x20f)]=_0x9b059c,writeSecureFile(_0x204578,JSON['stringify'](_0x1e1b1a,null,0x2));}export function saveActiveProfileToUserConfig(_0x151ba4){const _0x3f70fb=a66_0x1131;validateProfileName(_0x151ba4);const _0x2036d7=getGlobalConfigPath(),_0x2b759f=getConfigDir();!a66_0x4d0c7b[_0x3f70fb(0x1e7)](_0x2b759f)&&createSecureDirectory(_0x2b759f);let _0xf4cd48={};if(a66_0x4d0c7b['existsSync'](_0x2036d7))try{const _0x45d8e5=a66_0x4d0c7b[_0x3f70fb(0x1ec)](_0x2036d7,_0x3f70fb(0x1eb));_0xf4cd48=JSON[_0x3f70fb(0x210)](_0x45d8e5);}catch{console['warn'](_0x3f70fb(0x1fa)+_0x2036d7+_0x3f70fb(0x1e0));}_0xf4cd48['profile']=_0x151ba4,writeSecureFile(_0x2036d7,JSON['stringify'](_0xf4cd48,null,0x2));}function clearFieldFromUserConfig(_0x57e384){const _0x1b3260=a66_0x1131,_0x49256c=getGlobalConfigPath();if(!a66_0x4d0c7b[_0x1b3260(0x1e7)](_0x49256c))return;let _0x2670b2={};try{const _0x1e54a2=a66_0x4d0c7b['readFileSync'](_0x49256c,_0x1b3260(0x1eb));_0x2670b2=JSON['parse'](_0x1e54a2);}catch{return;}delete _0x2670b2[_0x57e384],writeSecureFile(_0x49256c,JSON[_0x1b3260(0x1dd)](_0x2670b2,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x5466cf=a66_0x1131;clearFieldFromUserConfig(_0x5466cf(0x20f));}export function clearActiveProfileFromUserConfig(){const _0x4f0d18=a66_0x1131;clearFieldFromUserConfig(_0x4f0d18(0x202));}export function createProfile(_0x23e459,_0x2bfe3d){const _0x2a390c=a66_0x1131;validateProfileName(_0x23e459);if(profileExists(_0x23e459))throw new Error(_0x2a390c(0x1d2)+_0x23e459+_0x2a390c(0x1f7));saveProfile(_0x23e459,_0x2bfe3d);}export function saveProfileCredentials(_0x3e425d,_0x549b24){const _0x542107=a66_0x1131;validateProfileName(_0x3e425d);if(!profileExists(_0x3e425d))throw new Error('Profile\x20'+_0x3e425d+_0x542107(0x20b));const _0x41d064=getNewCredentialPath(_0x3e425d);writeSecureFile(_0x41d064,_0x549b24);}export function loadProfileCredentials(_0x27e138){const _0x5b7299=a66_0x1131;validateProfileName(_0x27e138);const _0x140171=getNewCredentialPath(_0x27e138);if(a66_0x4d0c7b[_0x5b7299(0x1e7)](_0x140171))try{return a66_0x4d0c7b['readFileSync'](_0x140171,_0x5b7299(0x1eb));}catch{}const _0x2c2589=getOldCredentialPath(_0x27e138);if(a66_0x4d0c7b['existsSync'](_0x2c2589)){console[_0x5b7299(0x1f9)](_0x5b7299(0x1ed)+_0x27e138+'\x27'),console[_0x5b7299(0x1f9)](_0x5b7299(0x1f0)),console[_0x5b7299(0x1f9)]('\x20\x20mv\x20\x22'+_0x2c2589+_0x5b7299(0x1e9)+_0x140171+'\x22'),console[_0x5b7299(0x1f9)](_0x5b7299(0x1ff));try{return a66_0x4d0c7b[_0x5b7299(0x1ec)](_0x2c2589,_0x5b7299(0x1eb));}catch{return null;}}return null;}
1
+ const a66_0x1c550f=a66_0xc6dd;(function(_0x312dee,_0x436f82){const _0x56e00e=a66_0xc6dd,_0x52de7d=_0x312dee();while(!![]){try{const _0x1c9802=-parseInt(_0x56e00e(0x84))/0x1*(-parseInt(_0x56e00e(0xa7))/0x2)+parseInt(_0x56e00e(0xb5))/0x3+parseInt(_0x56e00e(0x8a))/0x4+-parseInt(_0x56e00e(0x8d))/0x5*(-parseInt(_0x56e00e(0x7f))/0x6)+-parseInt(_0x56e00e(0xc1))/0x7*(parseInt(_0x56e00e(0x88))/0x8)+-parseInt(_0x56e00e(0x91))/0x9+-parseInt(_0x56e00e(0xbc))/0xa;if(_0x1c9802===_0x436f82)break;else _0x52de7d['push'](_0x52de7d['shift']());}catch(_0x495cfb){_0x52de7d['push'](_0x52de7d['shift']());}}}(a66_0x91da,0xdd779));import*as a66_0x35c432 from'node:fs';import*as a66_0x52303e from'node:path';function a66_0xc6dd(_0x275904,_0x10eba9){_0x275904=_0x275904-0x7a;const _0x91daf4=a66_0x91da();let _0xc6ddc=_0x91daf4[_0x275904];return _0xc6ddc;}import{SDKError,ErrorCode}from'../sdk/errors.js';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';function a66_0x91da(){const _0x15a47e=['tdx.json',':\x20Invalid\x20JSON\x20syntax','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','sort','profiles','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','description','parent_segment','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','set','\x27\x20will\x20be\x20ignored','1276233hMbydy','Invalid\x20profile\x20name:\x20','filter','values','name','INVALID_PROFILE_CONFIG','has','5130800pkgMBL','find','entries','utf-8','@tdx-studio','38353bWplSi','message','.env.','To\x20migrate:','Profile\x20\x27','Warning:\x20Failed\x20to\x20parse\x20','readFileSync','\x27:\x20unknown\x20config\x20key\x20\x27','localeCompare','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','warn','existsSync','toISOString','join','621474befjFT','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','Failed\x20to\x20parse\x20','Warning:\x20Profile\x20\x27','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','1306343knRcJm','keys','push','llm_project','200nFquEB','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','498252eobzyx','Profile\x20','database','60sjaEpr','some','\x20already\x20exists','string','13878729glKMpH','profile','local',',\x20creating\x20new\x20file','test','user_info','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','rmSync','llm_agent','stringify','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','map','.env','parse','isDirectory','\x27\x20not\x20found\x20in\x20user\x20configuration','directory','\x0aWarning:\x20Failed\x20to\x20parse\x20','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','site','length','includes','2Ikkpkg','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','from'];a66_0x91da=function(){return _0x15a47e;};return a66_0x91da();}import{loadSessionContext}from'./session.js';export const STUDIO_PROFILE_NAME=a66_0x1c550f(0xc0);export function getProfileParams(_0x5e7847){const _0x372c26=a66_0x1c550f,_0x39aa73={};if(!_0x5e7847)return _0x39aa73;for(const [_0x16c50a,_0xd740f7]of Object[_0x372c26(0xbe)](_0x5e7847)){_0x16c50a!==_0x372c26(0xb0)&&_0xd740f7!==undefined&&(_0x39aa73[_0x16c50a]=_0xd740f7);}return _0x39aa73;}export function getProfilesDir(){const _0x464149=a66_0x1c550f;return a66_0x52303e[_0x464149(0x7e)](getConfigDir(),_0x464149(0xae));}function getProfileDir(_0x42cddc){const _0x527c06=a66_0x1c550f;return a66_0x52303e[_0x527c06(0x7e)](getProfilesDir(),_0x42cddc);}function getProfileConfigPath(_0x484b02){const _0x1df963=a66_0x1c550f;return a66_0x52303e[_0x1df963(0x7e)](getProfileDir(_0x484b02),_0x1df963(0xaa));}function getProfileEnvPath(_0x4f5a67){const _0x4e1201=a66_0x1c550f;return a66_0x52303e[_0x4e1201(0x7e)](getProfileDir(_0x4f5a67),'.env');}function getGlobalConfigPath(){const _0x33c38b=a66_0x1c550f;return a66_0x52303e['join'](getConfigDir(),_0x33c38b(0xaa));}function validateProfileName(_0x4fc2ef){const _0x581b09=a66_0x1c550f;if(/^@?[a-zA-Z0-9_-]+$/[_0x581b09(0x95)](_0x4fc2ef))return;if(/^@tdx-studio:[a-zA-Z0-9_-]+:\d+(:\d+)?$/[_0x581b09(0x95)](_0x4fc2ef))return;throw new Error(_0x581b09(0xb6)+_0x4fc2ef+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20underscore,\x20and\x20optional\x20@\x20prefix\x20for\x20reserved\x20profiles.');}function validateProfileConfig(_0x5be9cd,_0x178ab0){const _0x4712de=a66_0x1c550f;if(typeof _0x5be9cd!=='object'||_0x5be9cd===null)throw new SDKError(ErrorCode[_0x4712de(0xba)],_0x4712de(0xc5)+_0x178ab0+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x4d2ef5=[_0x4712de(0xb0),_0x4712de(0xa4),_0x4712de(0x8c),_0x4712de(0xb1),_0x4712de(0x87),_0x4712de(0x99),_0x4712de(0x96)],_0x41a281=_0x5be9cd;for(const _0x305072 of Object[_0x4712de(0x85)](_0x41a281)){!_0x4d2ef5[_0x4712de(0xa6)](_0x305072)&&console[_0x4712de(0x7b)](_0x4712de(0x82)+_0x178ab0+_0x4712de(0xc8)+_0x305072+_0x4712de(0xb4));}if(_0x41a281[_0x4712de(0xb0)]!==undefined&&typeof _0x41a281[_0x4712de(0xb0)]!==_0x4712de(0x90))throw new SDKError(ErrorCode[_0x4712de(0xba)],'Profile\x20\x27'+_0x178ab0+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x41a281['site']!==undefined&&typeof _0x41a281[_0x4712de(0xa4)]!=='string')throw new SDKError(ErrorCode[_0x4712de(0xba)],_0x4712de(0xc5)+_0x178ab0+_0x4712de(0x83));if(_0x41a281[_0x4712de(0x8c)]!==undefined&&typeof _0x41a281[_0x4712de(0x8c)]!=='string')throw new SDKError(ErrorCode[_0x4712de(0xba)],_0x4712de(0xc5)+_0x178ab0+_0x4712de(0xaf));if(_0x41a281[_0x4712de(0xb1)]!==undefined&&typeof _0x41a281['parent_segment']!==_0x4712de(0x90))throw new SDKError(ErrorCode[_0x4712de(0xba)],'Profile\x20\x27'+_0x178ab0+_0x4712de(0x7a));if(_0x41a281[_0x4712de(0x87)]!==undefined&&typeof _0x41a281['llm_project']!=='string')throw new SDKError(ErrorCode[_0x4712de(0xba)],'Profile\x20\x27'+_0x178ab0+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0x41a281['llm_agent']!==undefined&&typeof _0x41a281[_0x4712de(0x99)]!==_0x4712de(0x90))throw new SDKError(ErrorCode[_0x4712de(0xba)],'Profile\x20\x27'+_0x178ab0+_0x4712de(0x89));return!![];}function loadProfilesFromTdxJson(_0x1b08a3,_0x1a0dbd){const _0xefc744=a66_0x1c550f;if(!a66_0x35c432['existsSync'](_0x1b08a3))return[];try{const _0x271b0d=a66_0x35c432[_0xefc744(0xc7)](_0x1b08a3,_0xefc744(0xbf)),_0xd7b5f3=JSON['parse'](_0x271b0d);if(!_0xd7b5f3[_0xefc744(0xae)]||typeof _0xd7b5f3[_0xefc744(0xae)]!=='object')return[];const _0xa5a410=[];for(const [_0x2d3276,_0x3f3c54]of Object[_0xefc744(0xbe)](_0xd7b5f3[_0xefc744(0xae)])){try{validateProfileConfig(_0x3f3c54,_0x2d3276);const _0x4a887d=getNewCredentialPath(_0x2d3276),_0x1d2c30=getOldCredentialPath(_0x2d3276),_0x21c6e1=a66_0x35c432[_0xefc744(0x7c)](_0x4a887d)||a66_0x35c432[_0xefc744(0x7c)](_0x1d2c30);_0xa5a410['push']({'name':_0x2d3276,'config':_0x3f3c54,'metadata':{'name':_0x2d3276,'createdAt':new Date()[_0xefc744(0x7d)]()},'hasCredentials':_0x21c6e1,'scope':_0x1a0dbd});}catch(_0x1b5dd1){_0x1b5dd1 instanceof Error&&(console[_0xefc744(0x7b)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x1b08a3+':'),console[_0xefc744(0x7b)]('\x20\x20'+_0x1b5dd1['message']+'\x0a'));}}return _0xa5a410;}catch(_0x282743){return _0x282743 instanceof SyntaxError?(console[_0xefc744(0x7b)](_0xefc744(0xa2)+_0x1b08a3+_0xefc744(0xab)),console[_0xefc744(0x7b)]('Error:\x20'+_0x282743[_0xefc744(0xc2)]+'\x0a')):console[_0xefc744(0x7b)](_0xefc744(0x80)+_0x1b08a3+':\x20'+_0x282743+'\x0a'),[];}}export function getNewCredentialPath(_0x22d005){const _0x5af0ff=a66_0x1c550f;return a66_0x52303e[_0x5af0ff(0x7e)](getConfigDir(),_0x5af0ff(0xc3)+_0x22d005);}function getOldCredentialPath(_0x197f66){const _0x5cdd18=a66_0x1c550f;return a66_0x52303e['join'](getProfilesDir(),_0x197f66,_0x5cdd18(0x9d));}function loadProfilesFromTdxJsonFiles(){const _0x7aaf6d=a66_0x1c550f,_0x5ec9e2=[],_0xf939b6=findProjectConfigPath();_0xf939b6&&_0x5ec9e2[_0x7aaf6d(0x86)](...loadProfilesFromTdxJson(_0xf939b6,_0x7aaf6d(0x93)));const _0x5d5cf7=a66_0x52303e[_0x7aaf6d(0x7e)](getConfigDir(),_0x7aaf6d(0xaa));return _0x5ec9e2['push'](...loadProfilesFromTdxJson(_0x5d5cf7,'user')),_0x5ec9e2;}function loadProfilesFromDirectories(){const _0x56d480=a66_0x1c550f,_0x23d866=getProfilesDir();if(!a66_0x35c432[_0x56d480(0x7c)](_0x23d866))return[];try{return a66_0x35c432['readdirSync'](_0x23d866,{'withFileTypes':!![]})['filter'](_0x37477d=>_0x37477d[_0x56d480(0x9f)]())['map'](_0x34ae3b=>_0x34ae3b[_0x56d480(0xb9)])[_0x56d480(0xb7)](_0x2b2156=>{const _0xd0bac9=_0x56d480,_0x17e908=getProfileConfigPath(_0x2b2156),_0x2fadec=getProfileEnvPath(_0x2b2156);return a66_0x35c432[_0xd0bac9(0x7c)](_0x17e908)||a66_0x35c432[_0xd0bac9(0x7c)](_0x2fadec);})[_0x56d480(0x9c)](_0x9955=>{const _0x59eccb=_0x56d480,_0x1f510c=loadProfileFromDirectory(_0x9955);if(_0x1f510c)return{..._0x1f510c,'scope':_0x59eccb(0xa1)};return null;})[_0x56d480(0xb7)](_0x2f4363=>_0x2f4363!==null);}catch{return[];}}function loadProfileFromDirectory(_0x4f5c00){const _0x4f1e86=a66_0x1c550f,_0x24e658=getProfileConfigPath(_0x4f5c00),_0x45c9f2=getOldCredentialPath(_0x4f5c00);if(!a66_0x35c432[_0x4f1e86(0x7c)](_0x24e658)&&!a66_0x35c432[_0x4f1e86(0x7c)](_0x45c9f2))return null;let _0x3dc133={},_0x5f4caf={'name':_0x4f5c00,'createdAt':new Date()[_0x4f1e86(0x7d)]()};if(a66_0x35c432[_0x4f1e86(0x7c)](_0x24e658))try{const _0x12935c=a66_0x35c432[_0x4f1e86(0xc7)](_0x24e658,_0x4f1e86(0xbf)),_0x4eb793=JSON[_0x4f1e86(0x9e)](_0x12935c),{metadata:_0x23e316,..._0x26f2ef}=_0x4eb793;_0x3dc133=_0x26f2ef,_0x23e316&&(_0x5f4caf=_0x23e316);}catch{}return{'name':_0x4f5c00,'config':_0x3dc133,'metadata':_0x5f4caf,'hasCredentials':a66_0x35c432[_0x4f1e86(0x7c)](_0x45c9f2),'scope':_0x4f1e86(0xa1)};}export function listProfiles(){const _0x3791e6=a66_0x1c550f,_0x1bfb82=loadProfilesFromTdxJsonFiles(),_0x4f021d=loadProfilesFromDirectories();if(_0x4f021d[_0x3791e6(0xa5)]>0x0){const _0x3c5ac0=_0x4f021d[_0x3791e6(0x9c)](_0xeec9d=>_0xeec9d[_0x3791e6(0xb9)])[_0x3791e6(0x7e)](',\x20'),_0x4d6126=getConfigDir();console[_0x3791e6(0x7b)](_0x3791e6(0xa3)+_0x3c5ac0),console[_0x3791e6(0x7b)](_0x3791e6(0xac)),console[_0x3791e6(0x7b)]('\x20\x201.\x20Edit:\x20'+a66_0x52303e['join'](_0x4d6126,_0x3791e6(0xaa))),console[_0x3791e6(0x7b)](_0x3791e6(0xb2)),console[_0x3791e6(0x7b)](_0x3791e6(0x9b));}const _0x2f5dd0=[..._0x1bfb82,..._0x4f021d],_0x18ff18=new Map();for(const _0x29b8fe of _0x2f5dd0){!_0x18ff18[_0x3791e6(0xbb)](_0x29b8fe['name'])&&_0x18ff18[_0x3791e6(0xb3)](_0x29b8fe[_0x3791e6(0xb9)],_0x29b8fe);}return Array[_0x3791e6(0xa9)](_0x18ff18[_0x3791e6(0xb8)]())[_0x3791e6(0xad)]((_0x2196c2,_0x2f2c36)=>_0x2196c2[_0x3791e6(0xb9)][_0x3791e6(0xc9)](_0x2f2c36[_0x3791e6(0xb9)]));}export function profileExists(_0x161d51){const _0x1e2f4f=a66_0x1c550f,_0x223331=listProfiles();return _0x223331[_0x1e2f4f(0x8e)](_0x4fcb46=>_0x4fcb46[_0x1e2f4f(0xb9)]===_0x161d51);}export function loadProfile(_0x4d7429){const _0x1945d9=a66_0x1c550f;validateProfileName(_0x4d7429);const _0x35c6f8=listProfiles(),_0x48e247=_0x35c6f8[_0x1945d9(0xbd)](_0x5abe71=>_0x5abe71['name']===_0x4d7429);return _0x48e247||null;}export function saveProfile(_0x20bf12,_0x1dd2dc,_0x3b0834=![]){saveProfileToUserConfig(_0x20bf12,_0x1dd2dc);}export function deleteProfile(_0x374aa0){const _0x49613e=a66_0x1c550f;validateProfileName(_0x374aa0);const _0xf59dbc=getProfileDir(_0x374aa0);if(!a66_0x35c432[_0x49613e(0x7c)](_0xf59dbc))throw new Error('Profile\x20'+_0x374aa0+'\x20does\x20not\x20exist');a66_0x35c432[_0x49613e(0x98)](_0xf59dbc,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x1d5dcd,_0x4b22dd){const _0x44436f=a66_0x1c550f;validateProfileName(_0x1d5dcd);const _0x454829=getGlobalConfigPath(),_0x282841=getConfigDir();!a66_0x35c432[_0x44436f(0x7c)](_0x282841)&&createSecureDirectory(_0x282841);let _0x94c166={};if(a66_0x35c432['existsSync'](_0x454829))try{const _0x42fc9d=a66_0x35c432[_0x44436f(0xc7)](_0x454829,'utf-8');_0x94c166=JSON['parse'](_0x42fc9d);}catch{console['warn'](_0x44436f(0xc6)+_0x454829+',\x20creating\x20new\x20file');}!_0x94c166[_0x44436f(0xae)]&&(_0x94c166[_0x44436f(0xae)]={}),_0x94c166[_0x44436f(0xae)][_0x1d5dcd]=_0x4b22dd,writeSecureFile(_0x454829,JSON[_0x44436f(0x9a)](_0x94c166,null,0x2));}export function removeProfileFromUserConfig(_0x28e0fa){const _0x1f65b5=a66_0x1c550f;validateProfileName(_0x28e0fa);const _0x1e6944=getGlobalConfigPath();if(!a66_0x35c432[_0x1f65b5(0x7c)](_0x1e6944))throw new Error(_0x1f65b5(0xc5)+_0x28e0fa+_0x1f65b5(0xa0));let _0x2a5e80={};try{const _0x187362=a66_0x35c432[_0x1f65b5(0xc7)](_0x1e6944,_0x1f65b5(0xbf));_0x2a5e80=JSON[_0x1f65b5(0x9e)](_0x187362);}catch{throw new Error(_0x1f65b5(0x81)+_0x1e6944);}if(!_0x2a5e80[_0x1f65b5(0xae)]||!_0x2a5e80[_0x1f65b5(0xae)][_0x28e0fa])throw new Error(_0x1f65b5(0xc5)+_0x28e0fa+_0x1f65b5(0xa0));delete _0x2a5e80['profiles'][_0x28e0fa],_0x2a5e80[_0x1f65b5(0x92)]===_0x28e0fa&&delete _0x2a5e80[_0x1f65b5(0x92)],writeSecureFile(_0x1e6944,JSON['stringify'](_0x2a5e80,null,0x2));}export function getActiveProfile(){const _0x7ede3=a66_0x1c550f,_0x16e911=loadSessionContext();if(_0x16e911?.['profile'])return _0x16e911[_0x7ede3(0x92)];if(process.env.TDX_PROFILE)return process.env.TDX_PROFILE;const _0x4e1a50=getGlobalConfigPath();if(!a66_0x35c432[_0x7ede3(0x7c)](_0x4e1a50))return null;try{const _0x51142a=a66_0x35c432['readFileSync'](_0x4e1a50,'utf-8'),_0x3b120a=JSON[_0x7ede3(0x9e)](_0x51142a);return _0x3b120a[_0x7ede3(0x92)]||null;}catch{return null;}}export function saveDefaultSiteToUserConfig(_0x10cf22){const _0x54a467=a66_0x1c550f,_0x2ce3df=getGlobalConfigPath(),_0x136ccc=getConfigDir();!a66_0x35c432[_0x54a467(0x7c)](_0x136ccc)&&createSecureDirectory(_0x136ccc);let _0xd0740c={};if(a66_0x35c432['existsSync'](_0x2ce3df))try{const _0xa085d7=a66_0x35c432[_0x54a467(0xc7)](_0x2ce3df,_0x54a467(0xbf));_0xd0740c=JSON[_0x54a467(0x9e)](_0xa085d7);}catch{console['warn'](_0x54a467(0xc6)+_0x2ce3df+_0x54a467(0x94));}_0xd0740c[_0x54a467(0xa4)]=_0x10cf22,writeSecureFile(_0x2ce3df,JSON[_0x54a467(0x9a)](_0xd0740c,null,0x2));}export function saveActiveProfileToUserConfig(_0x586873){const _0x265dd3=a66_0x1c550f;validateProfileName(_0x586873);const _0x46dea4=getGlobalConfigPath(),_0x35a024=getConfigDir();!a66_0x35c432[_0x265dd3(0x7c)](_0x35a024)&&createSecureDirectory(_0x35a024);let _0x4377a3={};if(a66_0x35c432[_0x265dd3(0x7c)](_0x46dea4))try{const _0x2e02de=a66_0x35c432['readFileSync'](_0x46dea4,_0x265dd3(0xbf));_0x4377a3=JSON[_0x265dd3(0x9e)](_0x2e02de);}catch{console[_0x265dd3(0x7b)](_0x265dd3(0xc6)+_0x46dea4+_0x265dd3(0x94));}_0x4377a3[_0x265dd3(0x92)]=_0x586873,writeSecureFile(_0x46dea4,JSON[_0x265dd3(0x9a)](_0x4377a3,null,0x2));}function clearFieldFromUserConfig(_0x2239de){const _0x2d93a2=a66_0x1c550f,_0x28b57d=getGlobalConfigPath();if(!a66_0x35c432[_0x2d93a2(0x7c)](_0x28b57d))return;let _0x5e0137={};try{const _0x2ea8a2=a66_0x35c432['readFileSync'](_0x28b57d,_0x2d93a2(0xbf));_0x5e0137=JSON[_0x2d93a2(0x9e)](_0x2ea8a2);}catch{return;}delete _0x5e0137[_0x2239de],writeSecureFile(_0x28b57d,JSON[_0x2d93a2(0x9a)](_0x5e0137,null,0x2));}export function clearDefaultSiteFromUserConfig(){const _0x12f0fe=a66_0x1c550f;clearFieldFromUserConfig(_0x12f0fe(0xa4));}export function clearActiveProfileFromUserConfig(){const _0xb570ad=a66_0x1c550f;clearFieldFromUserConfig(_0xb570ad(0x92));}export function createProfile(_0x2b2f5f,_0x5078b4){const _0x2739be=a66_0x1c550f;validateProfileName(_0x2b2f5f);if(profileExists(_0x2b2f5f))throw new Error('Profile\x20'+_0x2b2f5f+_0x2739be(0x8f));saveProfile(_0x2b2f5f,_0x5078b4);}export function saveProfileCredentials(_0x57b2cf,_0x2a4edd){const _0x474f9b=a66_0x1c550f;validateProfileName(_0x57b2cf);if(!profileExists(_0x57b2cf))throw new Error(_0x474f9b(0x8b)+_0x57b2cf+'\x20does\x20not\x20exist');const _0x476b74=getNewCredentialPath(_0x57b2cf);writeSecureFile(_0x476b74,_0x2a4edd);}export function loadProfileCredentials(_0x113685){const _0x22a388=a66_0x1c550f;validateProfileName(_0x113685);const _0x1fd1c5=getNewCredentialPath(_0x113685);if(a66_0x35c432['existsSync'](_0x1fd1c5))try{return a66_0x35c432[_0x22a388(0xc7)](_0x1fd1c5,'utf-8');}catch{}const _0x3183bc=getOldCredentialPath(_0x113685);if(a66_0x35c432[_0x22a388(0x7c)](_0x3183bc)){console[_0x22a388(0x7b)](_0x22a388(0xa8)+_0x113685+'\x27'),console[_0x22a388(0x7b)](_0x22a388(0xc4)),console[_0x22a388(0x7b)]('\x20\x20mv\x20\x22'+_0x3183bc+'\x22\x20\x22'+_0x1fd1c5+'\x22'),console[_0x22a388(0x7b)](_0x22a388(0x97));try{return a66_0x35c432['readFileSync'](_0x3183bc,_0x22a388(0xbf));}catch{return null;}}return null;}
@@ -1 +1 @@
1
- function a67_0x354f(){const _0x293805=['\x20is\x20ignored.\x20','api_key','includes','code','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','13031333bkZrry','stringify','2256GqZMus','dirname','apiKey','6975604BsCBOJ','cwd','TD_API_KEY','161880pkhdxz','join','2525864hLBNtw','9240pxoLFm','2iSDHcf','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','writeFileSync',').\x20','warn','ENOENT','profile','5165dlLFep','46521hZsNkq','readFileSync','Warning:\x20\x27profile\x27\x20field\x20in\x20','1414680rPeRaK','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.'];a67_0x354f=function(){return _0x293805;};return a67_0x354f();}(function(_0x36f84b,_0x53b5d0){const _0xf9119f=a67_0x108e,_0x4d6748=_0x36f84b();while(!![]){try{const _0x36f94b=parseInt(_0xf9119f(0xeb))/0x1+-parseInt(_0xf9119f(0xef))/0x2*(parseInt(_0xf9119f(0xfa))/0x3)+-parseInt(_0xf9119f(0xe8))/0x4+parseInt(_0xf9119f(0xf6))/0x5*(parseInt(_0xf9119f(0xe5))/0x6)+-parseInt(_0xf9119f(0xe3))/0x7+-parseInt(_0xf9119f(0xed))/0x8+parseInt(_0xf9119f(0xf7))/0x9*(parseInt(_0xf9119f(0xee))/0xa);if(_0x36f94b===_0x53b5d0)break;else _0x4d6748['push'](_0x4d6748['shift']());}catch(_0x5cd704){_0x4d6748['push'](_0x4d6748['shift']());}}}(a67_0x354f,0xe3eff));import*as a67_0x384c1d from'node:fs';import*as a67_0x4903e8 from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';export function findProjectConfigPath(_0x32ae7a){const _0xdc3a24=a67_0x108e;let _0x1c203b=_0x32ae7a||process[_0xdc3a24(0xe9)]();while(!![]){const _0x272127=a67_0x4903e8[_0xdc3a24(0xec)](_0x1c203b,PROJECT_CONFIG_FILENAME);if(a67_0x384c1d['existsSync'](_0x272127))return _0x272127;const _0x42bfb1=a67_0x4903e8[_0xdc3a24(0xe6)](_0x1c203b);if(_0x42bfb1===_0x1c203b)return null;_0x1c203b=_0x42bfb1;}}export function loadProjectConfig(_0x2a7ee6){const _0x1b5736=a67_0x108e,_0x454636=findProjectConfigPath(_0x2a7ee6);if(!_0x454636)return null;try{const _0x4464ef=a67_0x384c1d[_0x1b5736(0xf8)](_0x454636,'utf-8'),_0x16c41a=JSON['parse'](_0x4464ef),_0x413f9b=JSON[_0x1b5736(0xe4)](_0x16c41a);if(_0x413f9b['includes']('TD_API_KEY')||_0x413f9b[_0x1b5736(0xe0)](_0x1b5736(0xe7))||_0x413f9b['includes'](_0x1b5736(0xdf)))throw new Error('Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20('+_0x454636+_0x1b5736(0xf2)+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0x17bf6c,profile:_0x1e5de3,..._0x5ac0b4}=_0x16c41a;return _0x1e5de3&&console[_0x1b5736(0xf3)](_0x1b5736(0xf9)+_0x454636+_0x1b5736(0xde)+_0x1b5736(0xe2)),_0x5ac0b4;}catch(_0x5f210b){if(_0x5f210b instanceof Error&&_0x1b5736(0xe1)in _0x5f210b&&_0x5f210b['code']===_0x1b5736(0xf4))return null;throw new Error('Failed\x20to\x20load\x20project\x20config\x20from\x20'+_0x454636+':\x20'+_0x5f210b);}}export function saveProjectConfig(_0xe600d2,_0x240435){const _0x4e197e=a67_0x108e,_0x22619e=_0x240435||process[_0x4e197e(0xe9)](),_0x240637=a67_0x4903e8['join'](_0x22619e,PROJECT_CONFIG_FILENAME),_0x47a711=JSON[_0x4e197e(0xe4)](_0xe600d2);if(_0x47a711[_0x4e197e(0xe0)](_0x4e197e(0xea))||_0x47a711[_0x4e197e(0xe0)](_0x4e197e(0xe7))||_0x47a711[_0x4e197e(0xe0)]('api_key'))throw new Error(_0x4e197e(0xf0));if(_0x4e197e(0xf5)in _0xe600d2)throw new Error(_0x4e197e(0xfb));a67_0x384c1d[_0x4e197e(0xf1)](_0x240637,JSON[_0x4e197e(0xe4)](_0xe600d2,null,0x2));}function a67_0x108e(_0x14408d,_0x4bd095){_0x14408d=_0x14408d-0xde;const _0x354f22=a67_0x354f();let _0x108e8e=_0x354f22[_0x14408d];return _0x108e8e;}export function hasProjectConfig(_0x2095b5){return findProjectConfigPath(_0x2095b5)!==null;}export function getProjectRoot(_0x173bdc){const _0x35179f=a67_0x108e,_0x525642=findProjectConfigPath(_0x173bdc);return _0x525642?a67_0x4903e8[_0x35179f(0xe6)](_0x525642):null;}
1
+ const a67_0x26b077=a67_0x4519;(function(_0x1c7378,_0x3b76c8){const _0x1af3fb=a67_0x4519,_0x65098c=_0x1c7378();while(!![]){try{const _0x41e5a6=-parseInt(_0x1af3fb(0x1b2))/0x1+parseInt(_0x1af3fb(0x1aa))/0x2+-parseInt(_0x1af3fb(0x1a6))/0x3+parseInt(_0x1af3fb(0x1ac))/0x4*(parseInt(_0x1af3fb(0x19b))/0x5)+-parseInt(_0x1af3fb(0x1a3))/0x6*(parseInt(_0x1af3fb(0x19d))/0x7)+-parseInt(_0x1af3fb(0x1a0))/0x8*(parseInt(_0x1af3fb(0x1b0))/0x9)+parseInt(_0x1af3fb(0x1a1))/0xa;if(_0x41e5a6===_0x3b76c8)break;else _0x65098c['push'](_0x65098c['shift']());}catch(_0x21224d){_0x65098c['push'](_0x65098c['shift']());}}}(a67_0x16a9,0x9c2ef));import*as a67_0x16f099 from'node:fs';import*as a67_0x51ed14 from'node:path';const PROJECT_CONFIG_FILENAME=a67_0x26b077(0x1a7);export function findProjectConfigPath(_0x278504){const _0x59a51a=a67_0x26b077;let _0x1fa6c6=_0x278504||process['cwd']();while(!![]){const _0xac2fef=a67_0x51ed14[_0x59a51a(0x1ae)](_0x1fa6c6,PROJECT_CONFIG_FILENAME);if(a67_0x16f099[_0x59a51a(0x199)](_0xac2fef))return _0xac2fef;const _0x36a774=a67_0x51ed14[_0x59a51a(0x1b3)](_0x1fa6c6);if(_0x36a774===_0x1fa6c6)return null;_0x1fa6c6=_0x36a774;}}function a67_0x16a9(){const _0x5bafe3=['apiKey','7dxokXf','Failed\x20to\x20load\x20project\x20config\x20from\x20','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','7152GfaDgo','16950010zhVpGX','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','1467822rnUFJt','utf-8','Warning:\x20\x27profile\x27\x20field\x20in\x20','1396686ofqHHT','tdx.json','TD_API_KEY','api_key','1966770EPNZEj','parse','596EKDfgQ','warn','join','code','3357chKVHQ','stringify','1066369tFvUEs','dirname','\x20is\x20ignored.\x20','cwd','writeFileSync','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','existsSync','includes','2395ZddQIl'];a67_0x16a9=function(){return _0x5bafe3;};return a67_0x16a9();}export function loadProjectConfig(_0x40b37c){const _0x2728ec=a67_0x26b077,_0x20e5e3=findProjectConfigPath(_0x40b37c);if(!_0x20e5e3)return null;try{const _0x28b3a8=a67_0x16f099['readFileSync'](_0x20e5e3,_0x2728ec(0x1a4)),_0x1dc28c=JSON[_0x2728ec(0x1ab)](_0x28b3a8),_0x56f949=JSON[_0x2728ec(0x1b1)](_0x1dc28c);if(_0x56f949[_0x2728ec(0x19a)](_0x2728ec(0x1a8))||_0x56f949['includes'](_0x2728ec(0x19c))||_0x56f949[_0x2728ec(0x19a)](_0x2728ec(0x1a9)))throw new Error(_0x2728ec(0x198)+_0x20e5e3+').\x20'+_0x2728ec(0x1a2));const {metadata:_0x3c3a71,profile:_0x158fc4,..._0x3486d2}=_0x1dc28c;return _0x158fc4&&console[_0x2728ec(0x1ad)](_0x2728ec(0x1a5)+_0x20e5e3+_0x2728ec(0x1b4)+_0x2728ec(0x19f)),_0x3486d2;}catch(_0x1b5a90){if(_0x1b5a90 instanceof Error&&'code'in _0x1b5a90&&_0x1b5a90[_0x2728ec(0x1af)]==='ENOENT')return null;throw new Error(_0x2728ec(0x19e)+_0x20e5e3+':\x20'+_0x1b5a90);}}function a67_0x4519(_0x310b2c,_0x542dc7){_0x310b2c=_0x310b2c-0x196;const _0x16a99e=a67_0x16a9();let _0x4519b3=_0x16a99e[_0x310b2c];return _0x4519b3;}export function saveProjectConfig(_0x33a721,_0x22dfbd){const _0x5612ef=a67_0x26b077,_0x3016f3=_0x22dfbd||process[_0x5612ef(0x196)](),_0x5cc162=a67_0x51ed14['join'](_0x3016f3,PROJECT_CONFIG_FILENAME),_0x3840db=JSON[_0x5612ef(0x1b1)](_0x33a721);if(_0x3840db['includes']('TD_API_KEY')||_0x3840db['includes'](_0x5612ef(0x19c))||_0x3840db[_0x5612ef(0x19a)](_0x5612ef(0x1a9)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if('profile'in _0x33a721)throw new Error('\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.');a67_0x16f099[_0x5612ef(0x197)](_0x5cc162,JSON['stringify'](_0x33a721,null,0x2));}export function hasProjectConfig(_0x20f14){return findProjectConfigPath(_0x20f14)!==null;}export function getProjectRoot(_0xed8c42){const _0xbc5aea=findProjectConfigPath(_0xed8c42);return _0xbc5aea?a67_0x51ed14['dirname'](_0xbc5aea):null;}
@@ -1 +1 @@
1
- (function(_0x224316,_0x40e68e){const _0x43e6fd=a68_0x5bf0,_0x18c10b=_0x224316();while(!![]){try{const _0x4842d4=-parseInt(_0x43e6fd(0xda))/0x1+parseInt(_0x43e6fd(0xee))/0x2*(parseInt(_0x43e6fd(0xd2))/0x3)+-parseInt(_0x43e6fd(0xd6))/0x4+-parseInt(_0x43e6fd(0xf1))/0x5+parseInt(_0x43e6fd(0xeb))/0x6*(parseInt(_0x43e6fd(0xd4))/0x7)+-parseInt(_0x43e6fd(0xe8))/0x8*(parseInt(_0x43e6fd(0xd1))/0x9)+-parseInt(_0x43e6fd(0xe6))/0xa*(-parseInt(_0x43e6fd(0xd7))/0xb);if(_0x4842d4===_0x40e68e)break;else _0x18c10b['push'](_0x18c10b['shift']());}catch(_0x18e203){_0x18c10b['push'](_0x18c10b['shift']());}}}(a68_0x21ca,0xb6e79));function a68_0x5bf0(_0x51eed2,_0x19ef59){_0x51eed2=_0x51eed2-0xd1;const _0x21ca48=a68_0x21ca();let _0x5bf0d6=_0x21ca48[_0x51eed2];return _0x5bf0d6;}import*as a68_0x40d936 from'node:fs';import*as a68_0x10de60 from'node:path';import*as a68_0x4d875d 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 _0x4f8a33=a68_0x5bf0,_0x5af39a=process.env.TDX_CONFIG_DIR||a68_0x10de60['join'](a68_0x4d875d[_0x4f8a33(0xd9)](),_0x4f8a33(0xdd),_0x4f8a33(0xe9));return a68_0x10de60['join'](_0x5af39a,_0x4f8a33(0xf6));}function getSessionPath(_0x3deb51){return a68_0x10de60['join'](getSessionsDir(),_0x3deb51+'.json');}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x184e73){const _0xfae103=a68_0x5bf0;if(_0x184e73)return _0x184e73;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()[_0xfae103(0xde)]();}export function loadSessionContext(_0x4e23c9){const _0xa270c5=a68_0x5bf0,_0x45609e=getSessionID(_0x4e23c9),_0x32e6e8=/^\d+$/[_0xa270c5(0xdb)](_0x45609e)?parseInt(_0x45609e,0xa):null;return _0x32e6e8!==null?loadSessionContextByPID(_0x32e6e8):loadSessionContextByString(_0x45609e);}export function loadSessionContextByPID(_0x5c4847){const _0x354b83=a68_0x5bf0,_0x38f904=getSessionPath(_0x5c4847);if(!a68_0x40d936[_0x354b83(0xf8)](_0x38f904))return null;try{const _0x63016e=a68_0x40d936[_0x354b83(0xe3)](_0x38f904,_0x354b83(0xd3)),_0x51699e=JSON[_0x354b83(0xef)](_0x63016e),_0x346aa6=new Date(_0x51699e['createdAt'])[_0x354b83(0xf0)](),_0x5255f5=Date[_0x354b83(0xe5)]();if(_0x5255f5-_0x346aa6>SESSION_EXPIRATION_MS)return a68_0x40d936[_0x354b83(0xe1)](_0x38f904),null;const _0x4f7718=JSON[_0x354b83(0xec)](_0x51699e);if(_0x4f7718[_0x354b83(0xd5)](_0x354b83(0xed))||_0x4f7718['includes'](_0x354b83(0xe4))||_0x4f7718[_0x354b83(0xd5)](_0x354b83(0xf3)))return console['warn'](_0x354b83(0xf7)+_0x38f904+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a68_0x40d936[_0x354b83(0xe1)](_0x38f904),null;return _0x51699e;}catch{try{a68_0x40d936[_0x354b83(0xe1)](_0x38f904);}catch{}return null;}}function loadSessionContextByString(_0x208d35){const _0x371f60=a68_0x5bf0,_0x231b69=a68_0x10de60[_0x371f60(0xf2)](getSessionsDir(),_0x208d35+_0x371f60(0xea));if(!a68_0x40d936[_0x371f60(0xf8)](_0x231b69))return null;try{const _0x5112a0=a68_0x40d936[_0x371f60(0xe3)](_0x231b69,_0x371f60(0xd3)),_0x12ed13=JSON[_0x371f60(0xef)](_0x5112a0),_0x35d80c=new Date(_0x12ed13['createdAt'])[_0x371f60(0xf0)](),_0x103a76=Date[_0x371f60(0xe5)]();if(_0x103a76-_0x35d80c>SESSION_EXPIRATION_MS)return a68_0x40d936[_0x371f60(0xe1)](_0x231b69),null;const _0x4ea065=JSON[_0x371f60(0xec)](_0x12ed13);if(_0x4ea065[_0x371f60(0xd5)](_0x371f60(0xed))||_0x4ea065[_0x371f60(0xd5)](_0x371f60(0xe4))||_0x4ea065[_0x371f60(0xd5)](_0x371f60(0xf3)))return console[_0x371f60(0xf4)](_0x371f60(0xf7)+_0x231b69+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a68_0x40d936[_0x371f60(0xe1)](_0x231b69),null;return _0x12ed13;}catch{try{a68_0x40d936[_0x371f60(0xe1)](_0x231b69);}catch{}return null;}}export function saveSessionContext(_0x2ce15b,_0x33b1a3){const _0x2c60ed=a68_0x5bf0,_0x4dbd80=getSessionID(_0x33b1a3),_0x1f8862=/^\d+$/[_0x2c60ed(0xdb)](_0x4dbd80)?parseInt(_0x4dbd80,0xa):getCurrentSessionPID(),_0x5c5de8=a68_0x10de60[_0x2c60ed(0xf2)](getSessionsDir(),_0x4dbd80+_0x2c60ed(0xea)),_0x368001=getSessionsDir();createSecureDirectory(_0x368001);const _0x3b83c8=JSON['stringify'](_0x2ce15b);if(_0x3b83c8[_0x2c60ed(0xd5)]('TD_API_KEY')||_0x3b83c8[_0x2c60ed(0xd5)](_0x2c60ed(0xe4))||_0x3b83c8[_0x2c60ed(0xd5)](_0x2c60ed(0xf3)))throw new Error(_0x2c60ed(0xe2));let _0x4a4ced;const _0xac8dfe=/^\d+$/[_0x2c60ed(0xdb)](_0x4dbd80)?loadSessionContextByPID(parseInt(_0x4dbd80,0xa)):loadSessionContextByString(_0x4dbd80);_0xac8dfe?_0x4a4ced={..._0xac8dfe,..._0x2ce15b,'pid':_0x1f8862,'sessionId':_0x4dbd80!==_0x1f8862[_0x2c60ed(0xde)]()?_0x4dbd80:undefined,'updatedAt':new Date()[_0x2c60ed(0xf9)]()}:_0x4a4ced={'pid':_0x1f8862,'sessionId':_0x4dbd80!==_0x1f8862[_0x2c60ed(0xde)]()?_0x4dbd80:undefined,..._0x2ce15b,'createdAt':new Date()[_0x2c60ed(0xf9)](),'updatedAt':new Date()[_0x2c60ed(0xf9)]()},a68_0x40d936[_0x2c60ed(0xd8)](_0x5c5de8,JSON[_0x2c60ed(0xec)](_0x4a4ced,null,0x2));}export function clearSessionContext(_0x40a90a){const _0x34ae64=a68_0x5bf0,_0x440163=getSessionID(_0x40a90a),_0x19e6b3=a68_0x10de60[_0x34ae64(0xf2)](getSessionsDir(),_0x440163+'.json');a68_0x40d936['existsSync'](_0x19e6b3)&&a68_0x40d936['unlinkSync'](_0x19e6b3);}function a68_0x21ca(){const _0x35707c=['39eQuayS','utf-8','8762425qCBYxY','includes','4659404CXzPar','242lbjKUU','writeFileSync','homedir','1262842dksBnp','test','endsWith','.config','toString','readdirSync','replace','unlinkSync','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','readFileSync','apiKey','now','1514660wadkFM','push','16FToBqG','tdx','.json','6PWkqul','stringify','TD_API_KEY','60142ewjbtl','parse','getTime','7182740TTrjTq','join','api_key','warn','sort','sessions','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','existsSync','toISOString','1626894SZQrrz'];a68_0x21ca=function(){return _0x35707c;};return a68_0x21ca();}export function clearSessionContextField(_0x4fd240,_0x435fe9){const _0x2cb0ed=a68_0x5bf0,_0x3e17a6=getSessionID(_0x435fe9),_0x520968=a68_0x10de60['join'](getSessionsDir(),_0x3e17a6+_0x2cb0ed(0xea));if(!a68_0x40d936['existsSync'](_0x520968))return;try{const _0x4b5227=a68_0x40d936[_0x2cb0ed(0xe3)](_0x520968,_0x2cb0ed(0xd3)),_0x411c9b=JSON['parse'](_0x4b5227);delete _0x411c9b[_0x4fd240],a68_0x40d936['writeFileSync'](_0x520968,JSON[_0x2cb0ed(0xec)](_0x411c9b,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x559138=a68_0x5bf0,_0x346ec3=getSessionsDir();if(!a68_0x40d936['existsSync'](_0x346ec3))return 0x0;let _0x4063ed=0x0;const _0x2ea169=Date[_0x559138(0xe5)]();try{const _0x2dd444=a68_0x40d936[_0x559138(0xdf)](_0x346ec3);for(const _0xd52719 of _0x2dd444){if(!_0xd52719['endsWith'](_0x559138(0xea)))continue;const _0x3597ea=a68_0x10de60[_0x559138(0xf2)](_0x346ec3,_0xd52719),_0x193671=_0xd52719[_0x559138(0xe0)]('.json',''),_0x2c9f81=parseInt(_0x193671,0xa),_0x133497=!isNaN(_0x2c9f81);if(_0x133497){if(!isProcessRunning(_0x2c9f81)){a68_0x40d936[_0x559138(0xe1)](_0x3597ea),_0x4063ed++;continue;}}try{const _0x51cf60=a68_0x40d936['readFileSync'](_0x3597ea,_0x559138(0xd3)),_0x254717=JSON[_0x559138(0xef)](_0x51cf60),_0x39fb92=new Date(_0x254717['createdAt'])[_0x559138(0xf0)]();_0x2ea169-_0x39fb92>SESSION_EXPIRATION_MS&&(a68_0x40d936[_0x559138(0xe1)](_0x3597ea),_0x4063ed++);}catch{a68_0x40d936[_0x559138(0xe1)](_0x3597ea),_0x4063ed++;}}}catch{}return _0x4063ed;}export function listActiveSessions(){const _0x214673=a68_0x5bf0,_0x4de089=getSessionsDir();if(!a68_0x40d936[_0x214673(0xf8)](_0x4de089))return[];try{const _0x253b69=a68_0x40d936[_0x214673(0xdf)](_0x4de089),_0x56fc6d=[];for(const _0x42bfe4 of _0x253b69){if(!_0x42bfe4[_0x214673(0xdc)](_0x214673(0xea)))continue;const _0x2a7d37=_0x42bfe4[_0x214673(0xe0)](_0x214673(0xea),''),_0x584b5b=parseInt(_0x2a7d37,0xa);!isNaN(_0x584b5b)&&isProcessRunning(_0x584b5b)&&_0x56fc6d[_0x214673(0xe7)](_0x584b5b);}return _0x56fc6d[_0x214673(0xf5)]((_0x59fa90,_0x3dc186)=>_0x59fa90-_0x3dc186);}catch{return[];}}
1
+ (function(_0x50d3e0,_0x2cc0c5){const _0x2ab8b3=a68_0x2c47,_0x510909=_0x50d3e0();while(!![]){try{const _0x5021e0=-parseInt(_0x2ab8b3(0x1f7))/0x1*(-parseInt(_0x2ab8b3(0x1e8))/0x2)+-parseInt(_0x2ab8b3(0x1f6))/0x3+-parseInt(_0x2ab8b3(0x1f9))/0x4+-parseInt(_0x2ab8b3(0x1f4))/0x5+parseInt(_0x2ab8b3(0x1e6))/0x6*(-parseInt(_0x2ab8b3(0x1dd))/0x7)+parseInt(_0x2ab8b3(0x1da))/0x8*(parseInt(_0x2ab8b3(0x1f0))/0x9)+-parseInt(_0x2ab8b3(0x1e4))/0xa*(-parseInt(_0x2ab8b3(0x1fc))/0xb);if(_0x5021e0===_0x2cc0c5)break;else _0x510909['push'](_0x510909['shift']());}catch(_0x5585a8){_0x510909['push'](_0x510909['shift']());}}}(a68_0x3b3b,0xe7f8e));import*as a68_0x416d62 from'node:fs';import*as a68_0xea5cb8 from'node:path';function a68_0x3b3b(){const _0x695d28=['20AqPXAT','includes','12ERbIbE','createdAt','215938BUymPT','warn','api_key','existsSync','.\x20This\x20is\x20insecure.\x20Removing\x20session.','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','test','parse','768042TdqElY','homedir','sort','stringify','6734715wzvvtz','TD_API_KEY','278097DHYoNh','5PFABgy','apiKey','465924reEujt','readdirSync','now','10974810jrKXqU','.json','tdx','writeFileSync','sessions','toISOString','replace','toString','getTime','8HPFhqr','endsWith','unlinkSync','400127EZzzro','join','push','utf-8','readFileSync','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','.config'];a68_0x3b3b=function(){return _0x695d28;};return a68_0x3b3b();}import*as a68_0x37da79 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 _0x2709b9=a68_0x2c47,_0x117830=process.env.TDX_CONFIG_DIR||a68_0xea5cb8[_0x2709b9(0x1de)](a68_0x37da79[_0x2709b9(0x1f1)](),_0x2709b9(0x1e3),_0x2709b9(0x1fe));return a68_0xea5cb8[_0x2709b9(0x1de)](_0x117830,_0x2709b9(0x200));}function getSessionPath(_0x6853ed){const _0x16bd8d=a68_0x2c47;return a68_0xea5cb8[_0x16bd8d(0x1de)](getSessionsDir(),_0x6853ed+_0x16bd8d(0x1fd));}function a68_0x2c47(_0x3c88c1,_0x28a545){_0x3c88c1=_0x3c88c1-0x1d9;const _0x3b3b65=a68_0x3b3b();let _0x2c47a2=_0x3b3b65[_0x3c88c1];return _0x2c47a2;}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x37ca62){if(_0x37ca62)return _0x37ca62;if(process.env.TDX_SESSION)return process.env.TDX_SESSION;return getCurrentSessionPID()['toString']();}export function loadSessionContext(_0x53890c){const _0x3c9042=a68_0x2c47,_0x4865ea=getSessionID(_0x53890c),_0x538941=/^\d+$/[_0x3c9042(0x1ee)](_0x4865ea)?parseInt(_0x4865ea,0xa):null;return _0x538941!==null?loadSessionContextByPID(_0x538941):loadSessionContextByString(_0x4865ea);}export function loadSessionContextByPID(_0x1d0c2a){const _0x2c8554=a68_0x2c47,_0x46799c=getSessionPath(_0x1d0c2a);if(!a68_0x416d62[_0x2c8554(0x1eb)](_0x46799c))return null;try{const _0x4187fa=a68_0x416d62[_0x2c8554(0x1e1)](_0x46799c,'utf-8'),_0x5a2141=JSON[_0x2c8554(0x1ef)](_0x4187fa),_0x1dd8b8=new Date(_0x5a2141['createdAt'])['getTime'](),_0xe2d00c=Date[_0x2c8554(0x1fb)]();if(_0xe2d00c-_0x1dd8b8>SESSION_EXPIRATION_MS)return a68_0x416d62[_0x2c8554(0x1dc)](_0x46799c),null;const _0x23a23f=JSON[_0x2c8554(0x1f3)](_0x5a2141);if(_0x23a23f['includes'](_0x2c8554(0x1f5))||_0x23a23f[_0x2c8554(0x1e5)](_0x2c8554(0x1f8))||_0x23a23f[_0x2c8554(0x1e5)](_0x2c8554(0x1ea)))return console[_0x2c8554(0x1e9)](_0x2c8554(0x1ed)+_0x46799c+_0x2c8554(0x1ec)),a68_0x416d62[_0x2c8554(0x1dc)](_0x46799c),null;return _0x5a2141;}catch{try{a68_0x416d62[_0x2c8554(0x1dc)](_0x46799c);}catch{}return null;}}function loadSessionContextByString(_0x1b6059){const _0x366dd8=a68_0x2c47,_0x296357=a68_0xea5cb8[_0x366dd8(0x1de)](getSessionsDir(),_0x1b6059+_0x366dd8(0x1fd));if(!a68_0x416d62['existsSync'](_0x296357))return null;try{const _0x5bd10b=a68_0x416d62[_0x366dd8(0x1e1)](_0x296357,'utf-8'),_0x31a682=JSON[_0x366dd8(0x1ef)](_0x5bd10b),_0xa11ee=new Date(_0x31a682[_0x366dd8(0x1e7)])['getTime'](),_0x7d04dc=Date[_0x366dd8(0x1fb)]();if(_0x7d04dc-_0xa11ee>SESSION_EXPIRATION_MS)return a68_0x416d62[_0x366dd8(0x1dc)](_0x296357),null;const _0x23a479=JSON[_0x366dd8(0x1f3)](_0x31a682);if(_0x23a479[_0x366dd8(0x1e5)](_0x366dd8(0x1f5))||_0x23a479[_0x366dd8(0x1e5)](_0x366dd8(0x1f8))||_0x23a479[_0x366dd8(0x1e5)]('api_key'))return console['warn']('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x296357+_0x366dd8(0x1ec)),a68_0x416d62[_0x366dd8(0x1dc)](_0x296357),null;return _0x31a682;}catch{try{a68_0x416d62[_0x366dd8(0x1dc)](_0x296357);}catch{}return null;}}export function saveSessionContext(_0x847a11,_0x56b7f4){const _0x2d88e7=a68_0x2c47,_0x3c1ee6=getSessionID(_0x56b7f4),_0xc02462=/^\d+$/[_0x2d88e7(0x1ee)](_0x3c1ee6)?parseInt(_0x3c1ee6,0xa):getCurrentSessionPID(),_0x448083=a68_0xea5cb8[_0x2d88e7(0x1de)](getSessionsDir(),_0x3c1ee6+'.json'),_0x4f81e=getSessionsDir();createSecureDirectory(_0x4f81e);const _0xf9026e=JSON[_0x2d88e7(0x1f3)](_0x847a11);if(_0xf9026e['includes'](_0x2d88e7(0x1f5))||_0xf9026e['includes'](_0x2d88e7(0x1f8))||_0xf9026e[_0x2d88e7(0x1e5)](_0x2d88e7(0x1ea)))throw new Error(_0x2d88e7(0x1e2));let _0x3036a4;const _0x1afb58=/^\d+$/['test'](_0x3c1ee6)?loadSessionContextByPID(parseInt(_0x3c1ee6,0xa)):loadSessionContextByString(_0x3c1ee6);_0x1afb58?_0x3036a4={..._0x1afb58,..._0x847a11,'pid':_0xc02462,'sessionId':_0x3c1ee6!==_0xc02462[_0x2d88e7(0x203)]()?_0x3c1ee6:undefined,'updatedAt':new Date()[_0x2d88e7(0x201)]()}:_0x3036a4={'pid':_0xc02462,'sessionId':_0x3c1ee6!==_0xc02462[_0x2d88e7(0x203)]()?_0x3c1ee6:undefined,..._0x847a11,'createdAt':new Date()['toISOString'](),'updatedAt':new Date()['toISOString']()},a68_0x416d62[_0x2d88e7(0x1ff)](_0x448083,JSON[_0x2d88e7(0x1f3)](_0x3036a4,null,0x2));}export function clearSessionContext(_0x424e30){const _0x33d02e=a68_0x2c47,_0x42c730=getSessionID(_0x424e30),_0x773c20=a68_0xea5cb8[_0x33d02e(0x1de)](getSessionsDir(),_0x42c730+'.json');a68_0x416d62['existsSync'](_0x773c20)&&a68_0x416d62[_0x33d02e(0x1dc)](_0x773c20);}export function clearSessionContextField(_0x194768,_0x54b55c){const _0x8dcc72=a68_0x2c47,_0x2419e9=getSessionID(_0x54b55c),_0x3f8694=a68_0xea5cb8[_0x8dcc72(0x1de)](getSessionsDir(),_0x2419e9+'.json');if(!a68_0x416d62['existsSync'](_0x3f8694))return;try{const _0x11c662=a68_0x416d62[_0x8dcc72(0x1e1)](_0x3f8694,_0x8dcc72(0x1e0)),_0x2282f1=JSON[_0x8dcc72(0x1ef)](_0x11c662);delete _0x2282f1[_0x194768],a68_0x416d62[_0x8dcc72(0x1ff)](_0x3f8694,JSON[_0x8dcc72(0x1f3)](_0x2282f1,null,0x2));}catch{}}export function cleanExpiredSessions(){const _0x46338d=a68_0x2c47,_0x4bde62=getSessionsDir();if(!a68_0x416d62[_0x46338d(0x1eb)](_0x4bde62))return 0x0;let _0x528b51=0x0;const _0x4f2b38=Date[_0x46338d(0x1fb)]();try{const _0x25f24e=a68_0x416d62[_0x46338d(0x1fa)](_0x4bde62);for(const _0x43ec3b of _0x25f24e){if(!_0x43ec3b[_0x46338d(0x1db)](_0x46338d(0x1fd)))continue;const _0x1cb255=a68_0xea5cb8[_0x46338d(0x1de)](_0x4bde62,_0x43ec3b),_0x1473c7=_0x43ec3b[_0x46338d(0x202)](_0x46338d(0x1fd),''),_0xec4a4a=parseInt(_0x1473c7,0xa),_0x4f074c=!isNaN(_0xec4a4a);if(_0x4f074c){if(!isProcessRunning(_0xec4a4a)){a68_0x416d62[_0x46338d(0x1dc)](_0x1cb255),_0x528b51++;continue;}}try{const _0x28f4ae=a68_0x416d62[_0x46338d(0x1e1)](_0x1cb255,_0x46338d(0x1e0)),_0x42105d=JSON[_0x46338d(0x1ef)](_0x28f4ae),_0x1acc9c=new Date(_0x42105d[_0x46338d(0x1e7)])[_0x46338d(0x1d9)]();_0x4f2b38-_0x1acc9c>SESSION_EXPIRATION_MS&&(a68_0x416d62[_0x46338d(0x1dc)](_0x1cb255),_0x528b51++);}catch{a68_0x416d62[_0x46338d(0x1dc)](_0x1cb255),_0x528b51++;}}}catch{}return _0x528b51;}export function listActiveSessions(){const _0x2384a6=a68_0x2c47,_0x1e2b5d=getSessionsDir();if(!a68_0x416d62[_0x2384a6(0x1eb)](_0x1e2b5d))return[];try{const _0x56a255=a68_0x416d62[_0x2384a6(0x1fa)](_0x1e2b5d),_0x3ff362=[];for(const _0xa70040 of _0x56a255){if(!_0xa70040[_0x2384a6(0x1db)](_0x2384a6(0x1fd)))continue;const _0x2fffeb=_0xa70040[_0x2384a6(0x202)](_0x2384a6(0x1fd),''),_0x186f64=parseInt(_0x2fffeb,0xa);!isNaN(_0x186f64)&&isProcessRunning(_0x186f64)&&_0x3ff362[_0x2384a6(0x1df)](_0x186f64);}return _0x3ff362[_0x2384a6(0x1f2)]((_0x528bc3,_0x15a836)=>_0x528bc3-_0x15a836);}catch{return[];}}
@@ -1 +1 @@
1
- const a69_0x5bf256=a69_0xf3b9;(function(_0x5895e8,_0x3e2c31){const _0x51ade1=a69_0xf3b9,_0x5895e0=_0x5895e8();while(!![]){try{const _0x50c0b9=parseInt(_0x51ade1(0xf5))/0x1*(-parseInt(_0x51ade1(0xf8))/0x2)+parseInt(_0x51ade1(0xf9))/0x3*(-parseInt(_0x51ade1(0xfc))/0x4)+parseInt(_0x51ade1(0x105))/0x5*(parseInt(_0x51ade1(0xf7))/0x6)+-parseInt(_0x51ade1(0x104))/0x7*(-parseInt(_0x51ade1(0xfa))/0x8)+-parseInt(_0x51ade1(0xfe))/0x9*(parseInt(_0x51ade1(0xf6))/0xa)+parseInt(_0x51ade1(0x103))/0xb+parseInt(_0x51ade1(0xfb))/0xc;if(_0x50c0b9===_0x3e2c31)break;else _0x5895e0['push'](_0x5895e0['shift']());}catch(_0x1eb9ec){_0x5895e0['push'](_0x5895e0['shift']());}}}(a69_0x419d,0xe4bbf));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a69_0x5bf256(0x102),'core/user-cache');export function loadCachedUsers(_0x43625b){const _0x9aef38=a69_0x5bf256,_0x4c026c=userCache[_0x9aef38(0xfd)](_0x43625b);return _0x4c026c?.[_0x9aef38(0xff)]??null;}export function saveCachedUsers(_0x3fe6b4,_0x427648){const _0x3819b9=a69_0x5bf256;userCache[_0x3819b9(0x100)](_0x3fe6b4,{'users':_0x427648,'cachedAt':Date[_0x3819b9(0x101)]()});}function a69_0x419d(){const _0x1d4590=['531225BScgfd','users','write','now','users-{profile}.json','11907038skxVld','742DSwHlj','5eHVBRA','341564BxnWfX','120uoTIQQ','8088618ajsgVc','4FMOWuj','5604042BrJhfV','51584AcsAif','12987456YnQLBs','4znoEuy','read'];a69_0x419d=function(){return _0x1d4590;};return a69_0x419d();}function a69_0xf3b9(_0x42a7cf,_0x37c22d){_0x42a7cf=_0x42a7cf-0xf5;const _0x419dfd=a69_0x419d();let _0xf3b9c2=_0x419dfd[_0x42a7cf];return _0xf3b9c2;}export function clearUserCache(_0x110024){userCache['clear'](_0x110024);}
1
+ const a69_0x42babf=a69_0x3784;(function(_0x1227ea,_0x977b9d){const _0x5ef648=a69_0x3784,_0x4984ab=_0x1227ea();while(!![]){try{const _0x5b53b5=-parseInt(_0x5ef648(0x10b))/0x1+parseInt(_0x5ef648(0x116))/0x2*(-parseInt(_0x5ef648(0x10c))/0x3)+parseInt(_0x5ef648(0x10d))/0x4*(-parseInt(_0x5ef648(0x111))/0x5)+parseInt(_0x5ef648(0x118))/0x6*(parseInt(_0x5ef648(0x114))/0x7)+-parseInt(_0x5ef648(0x110))/0x8+parseInt(_0x5ef648(0x117))/0x9+parseInt(_0x5ef648(0x11a))/0xa*(parseInt(_0x5ef648(0x10e))/0xb);if(_0x5b53b5===_0x977b9d)break;else _0x4984ab['push'](_0x4984ab['shift']());}catch(_0xd709b3){_0x4984ab['push'](_0x4984ab['shift']());}}}(a69_0x2a8f,0x7c7cf));import{createProfileCache}from'../utils/global-cache.js';const userCache=createProfileCache(a69_0x42babf(0x10f),a69_0x42babf(0x112));export function loadCachedUsers(_0x137194){const _0x1cbda4=a69_0x42babf,_0x34a76f=userCache[_0x1cbda4(0x10a)](_0x137194);return _0x34a76f?.[_0x1cbda4(0x115)]??null;}function a69_0x3784(_0x470bce,_0x27fcdc){_0x470bce=_0x470bce-0x109;const _0x2a8f90=a69_0x2a8f();let _0x378428=_0x2a8f90[_0x470bce];return _0x378428;}export function saveCachedUsers(_0x23f2e2,_0x20194a){const _0x4c9343=a69_0x42babf;userCache[_0x4c9343(0x113)](_0x23f2e2,{'users':_0x20194a,'cachedAt':Date[_0x4c9343(0x109)]()});}function a69_0x2a8f(){const _0x3c4942=['56LdCKuY','users','155576yAWXTJ','2261151BZqnbm','665274UcfCJO','clear','30OojukL','now','read','241641kwQecy','6GJlqmP','88pOFxoE','1297307OxRcjE','users-{profile}.json','2888720UUefFO','50880SSAJlH','core/user-cache','write'];a69_0x2a8f=function(){return _0x3c4942;};return a69_0x2a8f();}export function clearUserCache(_0x481b37){const _0x2272f0=a69_0x42babf;userCache[_0x2272f0(0x119)](_0x481b37);}
@@ -1 +1 @@
1
- (function(_0x37ac91,_0x296abf){const _0x3def7f=a70_0x4282,_0x5ad1c8=_0x37ac91();while(!![]){try{const _0x25143b=parseInt(_0x3def7f(0x185))/0x1*(-parseInt(_0x3def7f(0x181))/0x2)+parseInt(_0x3def7f(0x18b))/0x3+-parseInt(_0x3def7f(0x180))/0x4*(parseInt(_0x3def7f(0x184))/0x5)+-parseInt(_0x3def7f(0x18e))/0x6+parseInt(_0x3def7f(0x190))/0x7*(parseInt(_0x3def7f(0x18d))/0x8)+-parseInt(_0x3def7f(0x18c))/0x9*(parseInt(_0x3def7f(0x182))/0xa)+parseInt(_0x3def7f(0x183))/0xb*(parseInt(_0x3def7f(0x192))/0xc);if(_0x25143b===_0x296abf)break;else _0x5ad1c8['push'](_0x5ad1c8['shift']());}catch(_0x4226a9){_0x5ad1c8['push'](_0x5ad1c8['shift']());}}}(a70_0x3492,0x4f2bb));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;export function getBuildInfo(){const _0x4ee362=a70_0x4282;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x370ea0=fileURLToPath(import.meta.url),_0x50bf21=dirname(_0x370ea0);try{const _0x26ae02=join(_0x50bf21,'../build-info.json');cachedBuildInfo=JSON[_0x4ee362(0x18f)](readFileSync(_0x26ae02,_0x4ee362(0x187)));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x733cf1=a70_0x4282;if(cachedVersion!==null)return cachedVersion;const _0x55ea20=fileURLToPath(import.meta.url),_0x49262d=dirname(_0x55ea20),_0x3e5255=getBuildInfo();if(_0x3e5255['version'])return cachedVersion=_0x3e5255[_0x733cf1(0x189)],cachedVersion;try{const _0x22e120=join(_0x49262d,_0x733cf1(0x186)),_0x4ff26e=JSON[_0x733cf1(0x18f)](readFileSync(_0x22e120,_0x733cf1(0x187)));cachedVersion=_0x4ff26e[_0x733cf1(0x189)];}catch{cachedVersion=_0x733cf1(0x18a);}return cachedVersion;}export function isDevVersion(){const _0xd43ad1=a70_0x4282,_0xee9143=getVersion();return _0xee9143[_0xd43ad1(0x188)](_0xd43ad1(0x191))||_0xee9143[_0xd43ad1(0x188)]('-');}function a70_0x4282(_0x583c25,_0x5b94d4){_0x583c25=_0x583c25-0x180;const _0x34929c=a70_0x3492();let _0x4282f0=_0x34929c[_0x583c25];return _0x4282f0;}function a70_0x3492(){const _0x42acce=['includes','version','0.0.0','442569KQbtHN','63lGeXur','148600liqHsn','3350832fwaDor','parse','14UWGAol','.dev','22005708pfnCAm','212jiUKxp','6WxOiHA','496130zGivcF','11XkMnFh','39825zokwaq','122097ocDQTf','../../package.json','utf-8'];a70_0x3492=function(){return _0x42acce;};return a70_0x3492();}
1
+ (function(_0x548b93,_0x251b06){const _0x1a3097=a70_0x6b38,_0x629cc6=_0x548b93();while(!![]){try{const _0x23d3a0=-parseInt(_0x1a3097(0xcf))/0x1*(parseInt(_0x1a3097(0xce))/0x2)+parseInt(_0x1a3097(0xd6))/0x3*(parseInt(_0x1a3097(0xd5))/0x4)+-parseInt(_0x1a3097(0xda))/0x5+-parseInt(_0x1a3097(0xcb))/0x6*(-parseInt(_0x1a3097(0xcc))/0x7)+parseInt(_0x1a3097(0xd8))/0x8+-parseInt(_0x1a3097(0xd2))/0x9*(-parseInt(_0x1a3097(0xd4))/0xa)+-parseInt(_0x1a3097(0xd7))/0xb;if(_0x23d3a0===_0x251b06)break;else _0x629cc6['push'](_0x629cc6['shift']());}catch(_0xe4aeae){_0x629cc6['push'](_0x629cc6['shift']());}}}(a70_0x491d,0xbb116));import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';let cachedBuildInfo=null,cachedVersion=null;function a70_0x6b38(_0x41b737,_0x32c58e){_0x41b737=_0x41b737-0xca;const _0x491da=a70_0x491d();let _0x6b3878=_0x491da[_0x41b737];return _0x6b3878;}export function getBuildInfo(){const _0x5ef2c5=a70_0x6b38;if(cachedBuildInfo!==null)return cachedBuildInfo;const _0x520572=fileURLToPath(import.meta.url),_0x3d1263=dirname(_0x520572);try{const _0x3a190e=join(_0x3d1263,_0x5ef2c5(0xd9));cachedBuildInfo=JSON[_0x5ef2c5(0xd0)](readFileSync(_0x3a190e,'utf-8'));}catch{cachedBuildInfo={};}return cachedBuildInfo;}export function getVersion(){const _0x9853d0=a70_0x6b38;if(cachedVersion!==null)return cachedVersion;const _0x5aa60e=fileURLToPath(import.meta.url),_0x1dce74=dirname(_0x5aa60e),_0x4afff8=getBuildInfo();if(_0x4afff8[_0x9853d0(0xd3)])return cachedVersion=_0x4afff8['version'],cachedVersion;try{const _0x41ba39=join(_0x1dce74,_0x9853d0(0xd1)),_0x4ecf8c=JSON[_0x9853d0(0xd0)](readFileSync(_0x41ba39,'utf-8'));cachedVersion=_0x4ecf8c[_0x9853d0(0xd3)];}catch{cachedVersion=_0x9853d0(0xca);}return cachedVersion;}function a70_0x491d(){const _0x543ea9=['../../package.json','495arECGr','version','100580OlDmJo','288EjBepL','54399qoXpGD','6911993AimWXd','5864280ZjKUtl','../build-info.json','4097035qRxcFV','0.0.0','6RWRSiT','3783479zPGEDI','includes','1836596vOHoRP','1reRMTY','parse'];a70_0x491d=function(){return _0x543ea9;};return a70_0x491d();}export function isDevVersion(){const _0x3509b9=a70_0x6b38,_0x6bd741=getVersion();return _0x6bd741[_0x3509b9(0xcd)]('.dev')||_0x6bd741[_0x3509b9(0xcd)]('-');}