@treasuredata/tdx 0.9.3 → 0.9.5

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 (161) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/client/cdp-api-client.js +1 -1
  8. package/dist/client/engage-api-client.js +1 -1
  9. package/dist/client/http-client.js +1 -1
  10. package/dist/client/llm-api-client.d.ts +52 -1
  11. package/dist/client/llm-api-client.d.ts.map +1 -1
  12. package/dist/client/llm-api-client.js +1 -1
  13. package/dist/client/llm-api-client.js.map +1 -1
  14. package/dist/client/rate-limiter.js +1 -1
  15. package/dist/client/td-api-client.d.ts +45 -1
  16. package/dist/client/td-api-client.d.ts.map +1 -1
  17. package/dist/client/td-api-client.js +1 -1
  18. package/dist/client/td-api-client.js.map +1 -1
  19. package/dist/client/trino-api-client.js +1 -1
  20. package/dist/client/workflow-client.js +1 -1
  21. package/dist/commands/activations.js +1 -1
  22. package/dist/commands/agent-command.js +1 -1
  23. package/dist/commands/api-command.js +1 -1
  24. package/dist/commands/auth-command.js +1 -1
  25. package/dist/commands/chat-command.js +1 -1
  26. package/dist/commands/claude-command.js +1 -1
  27. package/dist/commands/claude-statusline-command.js +1 -1
  28. package/dist/commands/claude-usage-command.js +1 -1
  29. package/dist/commands/command.js +1 -1
  30. package/dist/commands/connection-command.d.ts +35 -0
  31. package/dist/commands/connection-command.d.ts.map +1 -1
  32. package/dist/commands/connection-command.js +1 -1
  33. package/dist/commands/connection-command.js.map +1 -1
  34. package/dist/commands/context-command.js +1 -1
  35. package/dist/commands/databases.js +1 -1
  36. package/dist/commands/describe.js +1 -1
  37. package/dist/commands/engage-command.js +1 -1
  38. package/dist/commands/job-command.js +1 -1
  39. package/dist/commands/journey-command.d.ts.map +1 -1
  40. package/dist/commands/journey-command.js +1 -1
  41. package/dist/commands/journey-command.js.map +1 -1
  42. package/dist/commands/llm-command.js +1 -1
  43. package/dist/commands/llm-proxy.js +1 -1
  44. package/dist/commands/parent-segment-command.js +1 -1
  45. package/dist/commands/profiles-command.js +1 -1
  46. package/dist/commands/query-command.js +1 -1
  47. package/dist/commands/segment-command.js +1 -1
  48. package/dist/commands/segment-create-command.js +1 -1
  49. package/dist/commands/segment-fields-command.js +1 -1
  50. package/dist/commands/segment-pull-command.d.ts.map +1 -1
  51. package/dist/commands/segment-pull-command.js +1 -1
  52. package/dist/commands/segment-pull-command.js.map +1 -1
  53. package/dist/commands/segment-push-command.d.ts.map +1 -1
  54. package/dist/commands/segment-push-command.js +1 -1
  55. package/dist/commands/segment-push-command.js.map +1 -1
  56. package/dist/commands/segment-update-command.js +1 -1
  57. package/dist/commands/segment-use-command.js +1 -1
  58. package/dist/commands/segments.js +1 -1
  59. package/dist/commands/show.js +1 -1
  60. package/dist/commands/tables.js +1 -1
  61. package/dist/commands/use-command.js +1 -1
  62. package/dist/commands/user-command.js +1 -1
  63. package/dist/commands/workflow-command.js +1 -1
  64. package/dist/core/auth.js +1 -1
  65. package/dist/core/config.js +1 -1
  66. package/dist/core/connection-cache.js +1 -1
  67. package/dist/core/credential-cache.js +1 -1
  68. package/dist/core/global-context.js +1 -1
  69. package/dist/core/keychain.js +1 -1
  70. package/dist/core/profile.js +1 -1
  71. package/dist/core/project-config.js +1 -1
  72. package/dist/core/session.js +1 -1
  73. package/dist/core/user-cache.js +1 -1
  74. package/dist/index.js +1 -1
  75. package/dist/proxy/anthropic-adapter.js +1 -1
  76. package/dist/proxy/claude-usage-tracker.js +1 -1
  77. package/dist/proxy/context-signature.js +1 -1
  78. package/dist/proxy/conversation-utils.js +1 -1
  79. package/dist/proxy/server.js +1 -1
  80. package/dist/proxy/session-cache.js +1 -1
  81. package/dist/sdk/agent/agent-yaml.d.ts +15 -2
  82. package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
  83. package/dist/sdk/agent/agent-yaml.js +1 -1
  84. package/dist/sdk/agent/agent-yaml.js.map +1 -1
  85. package/dist/sdk/api.js +1 -1
  86. package/dist/sdk/connection-validator.d.ts +119 -0
  87. package/dist/sdk/connection-validator.d.ts.map +1 -0
  88. package/dist/sdk/connection-validator.js +1 -0
  89. package/dist/sdk/connection-validator.js.map +1 -0
  90. package/dist/sdk/connection.d.ts +120 -1
  91. package/dist/sdk/connection.d.ts.map +1 -1
  92. package/dist/sdk/connection.js +1 -1
  93. package/dist/sdk/connection.js.map +1 -1
  94. package/dist/sdk/engage.js +1 -1
  95. package/dist/sdk/errors.d.ts +4 -0
  96. package/dist/sdk/errors.d.ts.map +1 -1
  97. package/dist/sdk/errors.js +1 -1
  98. package/dist/sdk/errors.js.map +1 -1
  99. package/dist/sdk/index.js +1 -1
  100. package/dist/sdk/job.js +1 -1
  101. package/dist/sdk/journey.js +1 -1
  102. package/dist/sdk/llm.d.ts.map +1 -1
  103. package/dist/sdk/llm.js +1 -1
  104. package/dist/sdk/llm.js.map +1 -1
  105. package/dist/sdk/query.js +1 -1
  106. package/dist/sdk/segment/child-segment-yaml.d.ts +22 -6
  107. package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
  108. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  109. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  110. package/dist/sdk/segment/journey-yaml.js +1 -1
  111. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  112. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  113. package/dist/sdk/segment.js +1 -1
  114. package/dist/sdk/user.js +1 -1
  115. package/dist/sdk/workflow.js +1 -1
  116. package/dist/types/connector-schema.d.ts +182 -0
  117. package/dist/types/connector-schema.d.ts.map +1 -0
  118. package/dist/types/connector-schema.js +1 -0
  119. package/dist/types/connector-schema.js.map +1 -0
  120. package/dist/types/endpoints.js +1 -1
  121. package/dist/types/index.d.ts +3 -1
  122. package/dist/types/index.d.ts.map +1 -1
  123. package/dist/types/index.js +1 -1
  124. package/dist/types/llm.d.ts +107 -2
  125. package/dist/types/llm.d.ts.map +1 -1
  126. package/dist/utils/agent-config.js +1 -1
  127. package/dist/utils/agent-ref-parser.js +1 -1
  128. package/dist/utils/async.js +1 -1
  129. package/dist/utils/chat-cache.js +1 -1
  130. package/dist/utils/colors.js +1 -1
  131. package/dist/utils/command-output.js +1 -1
  132. package/dist/utils/constants.js +1 -1
  133. package/dist/utils/diff.js +1 -1
  134. package/dist/utils/fields-display.js +1 -1
  135. package/dist/utils/file-permissions.js +1 -1
  136. package/dist/utils/format-detector.js +1 -1
  137. package/dist/utils/formatters.js +1 -1
  138. package/dist/utils/journey-utils.d.ts.map +1 -1
  139. package/dist/utils/journey-utils.js +1 -1
  140. package/dist/utils/journey-utils.js.map +1 -1
  141. package/dist/utils/json-loader.js +1 -1
  142. package/dist/utils/llm-backup-utils.js +1 -1
  143. package/dist/utils/model-aliases.js +1 -1
  144. package/dist/utils/model-factors.js +1 -1
  145. package/dist/utils/option-validation.js +1 -1
  146. package/dist/utils/port.js +1 -1
  147. package/dist/utils/process.js +1 -1
  148. package/dist/utils/prompt.js +1 -1
  149. package/dist/utils/segment-path-parser.js +1 -1
  150. package/dist/utils/segment-ref-parser.js +1 -1
  151. package/dist/utils/spinner.js +1 -1
  152. package/dist/utils/sql-parser.js +1 -1
  153. package/dist/utils/sse-parser.js +1 -1
  154. package/dist/utils/string-utils.js +1 -1
  155. package/dist/utils/table-ref-parser.js +1 -1
  156. package/dist/utils/tdx-config.js +1 -1
  157. package/dist/utils/tdx-logger.js +1 -1
  158. package/dist/utils/tree-formatter.js +1 -1
  159. package/dist/utils/version-check.js +1 -1
  160. package/dist/utils/workflow-utils.js +1 -1
  161. package/package.json +1 -1
@@ -1 +1 @@
1
- const a27_0x115025=a27_0x583f;(function(_0x32e296,_0x470bf9){const _0x2bda18=a27_0x583f,_0x2feb00=_0x32e296();while(!![]){try{const _0x4c51e8=parseInt(_0x2bda18(0x120))/0x1+-parseInt(_0x2bda18(0x198))/0x2+-parseInt(_0x2bda18(0x144))/0x3+-parseInt(_0x2bda18(0x197))/0x4*(-parseInt(_0x2bda18(0x113))/0x5)+parseInt(_0x2bda18(0x179))/0x6*(-parseInt(_0x2bda18(0x10e))/0x7)+parseInt(_0x2bda18(0x15a))/0x8*(-parseInt(_0x2bda18(0x157))/0x9)+-parseInt(_0x2bda18(0x11e))/0xa*(-parseInt(_0x2bda18(0x19a))/0xb);if(_0x4c51e8===_0x470bf9)break;else _0x2feb00['push'](_0x2feb00['shift']());}catch(_0xe6798b){_0x2feb00['push'](_0x2feb00['shift']());}}}(a27_0x18a9,0x9f792));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{getChalk}from'../utils/colors.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../utils/constants.js';import{confirm}from'../utils/prompt.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../types/endpoints.js';import*as a27_0x4c7b8a from'node:fs';function handleSDKError(_0x1c2ca5,_0x4055cc){const _0x95659c=a27_0x583f;if(_0x1c2ca5 instanceof SDKError)console[_0x95659c(0x10b)]('Error:\x20'+_0x1c2ca5[_0x95659c(0x16c)]),_0x4055cc[_0x95659c(0x154)]&&(_0x1c2ca5['cause']&&console[_0x95659c(0x10b)]('\x20\x20Cause:\x20'+_0x1c2ca5[_0x95659c(0x101)]),_0x1c2ca5[_0x95659c(0x188)]&&(console[_0x95659c(0x10b)]('\x0aStack\x20trace:'),console['error'](_0x1c2ca5[_0x95659c(0x188)])));else throw _0x1c2ca5;}function formatChatHistoryEntry(_0x1ed5b8,_0x4f828d){const _0x52c913=a27_0x583f,_0x143042=getChalk(_0x4f828d),_0x479f58=_0x143042[_0x52c913(0x14c)](_0x1ed5b8['at']);if('input'in _0x1ed5b8){const _0x9a8ee8=_0x143042['cyan'](_0x52c913(0x145));return _0x479f58+'\x20'+_0x9a8ee8+':\x20'+_0x1ed5b8[_0x52c913(0x11a)];}if(_0x52c913(0x1ca)in _0x1ed5b8){const _0x2253c6=_0x143042[_0x52c913(0x149)](_0x52c913(0x1a6));return _0x479f58+'\x20'+_0x2253c6+':\x20'+_0x1ed5b8[_0x52c913(0x1ca)];}if(_0x52c913(0x131)in _0x1ed5b8){const _0x522ce6=_0x143042[_0x52c913(0x14b)](_0x52c913(0x1a1)),{functionName:_0x36cc63,functionArguments:_0x569b57,targetFunction:_0x4edf5c}=_0x1ed5b8[_0x52c913(0x131)];let _0x370bc2=_0x479f58+'\x20'+_0x522ce6+':\x20'+_0x143042[_0x52c913(0x117)](_0x36cc63);if(_0x569b57&&Object['keys'](_0x569b57)[_0x52c913(0x186)]>0x0){const _0x95ad3e=Object[_0x52c913(0x100)](_0x569b57)[_0x52c913(0x180)](([_0x42c647,_0x5ad3f0])=>_0x42c647+'='+JSON[_0x52c913(0x1d1)](_0x5ad3f0))[_0x52c913(0x176)](',\x20');_0x370bc2+='('+_0x95ad3e+')';}_0x4edf5c&&(_0x370bc2+=_0x143042['dim']('\x20['+_0x4edf5c+']'));let _0x45dd83='';if(_0x1ed5b8[_0x52c913(0x131)][_0x52c913(0x158)])_0x45dd83=_0x52c913(0x112)+_0x1ed5b8[_0x52c913(0x131)][_0x52c913(0x158)][_0x52c913(0x16a)];else{if(_0x1ed5b8['tool_call'][_0x52c913(0x14a)])_0x45dd83=_0x52c913(0x19e)+_0x1ed5b8['tool_call']['targetAgent'][_0x52c913(0x16a)];else{if(_0x1ed5b8[_0x52c913(0x131)][_0x52c913(0x12b)])_0x45dd83=_0x52c913(0x181)+_0x1ed5b8[_0x52c913(0x131)][_0x52c913(0x12b)][_0x52c913(0x16a)];else _0x1ed5b8[_0x52c913(0x131)][_0x52c913(0x147)]&&(_0x45dd83=_0x52c913(0x192)+_0x1ed5b8[_0x52c913(0x131)][_0x52c913(0x147)][_0x52c913(0x16a)]);}}return _0x370bc2+_0x45dd83;}if('tool'in _0x1ed5b8){const _0x264923=_0x143042['magenta']('[tool]\x20\x20\x20'),{functionName:_0x16984f,functionArguments:_0x13457a,content:_0x518730,newChat:_0x15d9d2}=_0x1ed5b8[_0x52c913(0x1b6)];let _0x3ac68f=_0x479f58+'\x20'+_0x264923+':\x20'+_0x143042[_0x52c913(0x117)](_0x16984f);if(_0x13457a){const _0x1e5f0a=typeof _0x13457a===_0x52c913(0x116)?_0x13457a:JSON[_0x52c913(0x1d1)](_0x13457a);_0x3ac68f+='('+_0x1e5f0a+')';}return _0x518730&&(_0x3ac68f+='\x0a'+_0x143042['dim'](_0x518730)),_0x15d9d2&&(_0x3ac68f+=_0x143042[_0x52c913(0x14c)](_0x52c913(0x1a8)+_0x15d9d2['id'])),_0x3ac68f;}if(_0x52c913(0x171)in _0x1ed5b8){const _0x423cdc=_0x143042['blue'](_0x52c913(0x161));return _0x479f58+'\x20'+_0x423cdc+':\x20'+_0x1ed5b8[_0x52c913(0x171)][_0x52c913(0x16a)]+'\x20('+_0x1ed5b8[_0x52c913(0x171)][_0x52c913(0x1ca)][_0x52c913(0x186)]+_0x52c913(0x10f);}if(_0x52c913(0x185)in _0x1ed5b8){const _0x3b7a79=_0x143042['blue'](_0x52c913(0x1bc)),{width:_0x3e458a,height:_0x4a155d,headerText:_0x111ecc}=_0x1ed5b8['image'],_0x577e0d=_0x111ecc?'\x20-\x20'+_0x111ecc:'';return _0x479f58+'\x20'+_0x3b7a79+':\x20'+_0x3e458a+'x'+_0x4a155d+_0x577e0d;}if(_0x52c913(0x10b)in _0x1ed5b8){const _0x4045ba=_0x143042['red'](_0x52c913(0x142));return _0x479f58+'\x20'+_0x4045ba+':\x20'+_0x1ed5b8[_0x52c913(0x10b)];}return _0x479f58+'\x20'+_0x143042['dim'](_0x52c913(0x1cd))+':\x20'+JSON['stringify'](_0x1ed5b8);}async function executeChatHistoryCommand(_0x103f9b,_0x16a8a6){const _0x5c6628=a27_0x583f,{options:_0x59a430,args:_0x377128,tdx:_0x402034}=_0x103f9b,_0x3268a6=_0x377128[0x0],_0x45d852=_0x59a430,_0x35b487=_0x45d852[_0x5c6628(0x1a7)];try{if(_0x35b487&&_0x3268a6)return console[_0x5c6628(0x10b)](_0x5c6628(0x136)),console[_0x5c6628(0x10b)](_0x5c6628(0x17c)+_0x16a8a6+_0x5c6628(0x11c)),0x1;if(!_0x3268a6&&!_0x35b487&&_0x59a430['format']!==undefined){const _0x43db00=resolveLimit(_0x59a430[_0x5c6628(0x190)],DEFAULT_LLM_LIMIT),_0x1f9e0c=await withSpinner(_0x5c6628(0x1a3),()=>_0x402034[_0x5c6628(0x110)][_0x5c6628(0x17e)](_0x43db00),{'verbose':_0x59a430['verbose']});return await handleSDKOutput(_0x1f9e0c[_0x5c6628(0x159)],_0x59a430),0x0;}const _0xb4dd8=await getChatIdOrSelect(_0x402034,_0x59a430,_0x35b487,_0x3268a6);if(!_0xb4dd8)return 0x0;return await displayChatHistory(_0xb4dd8,_0x402034,_0x59a430),0x0;}catch(_0x3838c2){return handleSDKError(_0x3838c2,_0x59a430),0x1;}}async function displayChatHistory(_0x45a1fb,_0x481650,_0x2eb5fe){const _0x3ee584=a27_0x583f,_0x55c8a8=await withSpinner(_0x3ee584(0x1b4)+_0x45a1fb+'\x27...',()=>_0x481650[_0x3ee584(0x110)]['history'](_0x45a1fb),{'verbose':_0x2eb5fe[_0x3ee584(0x154)]}),_0x303946=_0x55c8a8[_0x3ee584(0x159)]['data']??[];if(_0x303946[_0x3ee584(0x186)]===0x0){console[_0x3ee584(0x1b7)](_0x3ee584(0x1c0));return;}if(_0x2eb5fe[_0x3ee584(0x1aa)]!==undefined)await handleSDKOutput(_0x303946,_0x2eb5fe);else{const _0x5a9eb6=_0x303946[_0x3ee584(0x180)](_0x3342ae=>formatChatHistoryEntry(_0x3342ae,_0x2eb5fe)),_0x5d0e32=_0x5a9eb6[_0x3ee584(0x176)]('\x0a');await writeOutput(_0x5d0e32,_0x2eb5fe['output'],'table');}}function a27_0x18a9(){const _0x29ff17=['Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','[error]\x20\x20','Validating\x20backup\x20from\x20\x27','221649uRkSHN','[input]\x20\x20','llm:agent:update','targetImageGenerator','A\x20project\x20named\x20\x27','green','targetAgent','yellow','dim','List\x20available\x20LLM\x20models','__load_more__','Getting\x20default\x20project...','...','split','tsv','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','verbose','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.','sort','49455FppRKb','targetKnowledgeBase','data','208qkYKHu','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)','d\x20ago','Fetching\x20agent...','exportedFrom','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','includes','[output]\x20','json','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','Backup\x20cancelled.','tdx\x20chats','projects','llm:agent:create','dryRun','\x20\x20Integrations:\x20','name','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','message','Deleting\x20project\x20\x27','createProject','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','h\x20ago','output','Invalid\x20path\x20syntax:\x20','Agent\x20updated:\x20','getOrCreateDefaultProject','Error:\x20Agent\x20name\x20is\x20required','join','restoreProject','No\x20agents\x20found','1553352lUKfcC','Resolving\x20project\x20\x27','.llm','Usage:\x20','chatId','chats','numeric','map','\x20->\x20WebSearch:','Deleting\x20agent...','Update\x20an\x20existing\x20agent','llm:project:restore','image','length','INVALID_ARGUMENT','stack','Delete\x20an\x20LLM\x20project','toLocaleDateString','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','\x27...','floor','prompts','execute','limit','cyan','\x20->\x20ImageGen:','Project\x20deleted:\x20','projectName','counts','systemPrompt','8020vIJyPe','2272832fsVtON','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)','4225023tFuJjd','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','resolveAgentId','Resolving\x20agent\x20\x27','\x20->\x20Agent:','attributes','select','[tool_call]','set','Fetching\x20chat\x20sessions...','Output\x20directory\x20\x27','\x20\x20Agents:\x20','[content]','last','\x20→\x20chat:\x20','\x27\x20already\x20exists.\x20Overwrite?','format','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','yes','get','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','llm:models','llm:agent:delete','description','createAgent','Project\x20restored:\x20','Fetching\x20chat\x20history\x20for\x20\x27','site','tool','log','integrations','knowledgeBases','prompt','agentId','[image]\x20\x20','outputDir','find','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','No\x20messages\x20found\x20in\x20chat\x20history.','agents','Fetching\x20projects...','No\x20projects\x20found','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.','model','slice','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','maxToolIterations','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','content','\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.','Project\x20context\x20set\x20to:\x20','[unknown]','projectId','default','resolveProjectId','stringify','\x20agent(s)','🤖\x20','Fetching\x20agents...','No\x20chat\x20sessions\x20found.','entries','cause','push','filter','localeCompare','llm:project:delete','(no\x20agent)','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','updatedAt','getBackupMetadata','\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/','error','Agent\x20deleted:\x20','table','14iUCKNo','\x20bytes)','llm','starterMessage','\x20->\x20KB:','1295QsZvie','llm:projects','agent','string','bold','⚒️\x20','all','input','\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22','\x20--last','Create\x20a\x20new\x20LLM\x20project','40KpBbnW','Analyzing\x20project\x20\x27','468488mxtJZH','Creating\x20project\x20\x27','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','LLM_PROJECT_NOT_FOUND','m\x20ago','en-US','Error:\x20Project\x20name\x20is\x20required','lastConversationAt','existsSync','\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.','web','targetWebSearchTool','claude-4.5-haiku','jsonl','\x20project(s)','temperature','updateAgent','tool_call','rmSync','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','\x20\x20Knowledge\x20Bases:\x20','getTime','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','\x0aCancelled','Restore\x20cancelled.','substring','Select\x20a\x20chat\x20session:','Agent\x20created:\x20','Delete\x20an\x20agent','Show\x20agent\x20details','toLowerCase','Error:\x20Backup\x20folder\x20path\x20is\x20required'];a27_0x18a9=function(){return _0x29ff17;};return a27_0x18a9();}async function getChatIdOrSelect(_0x468310,_0x558145,_0x22b4df,_0x381060){const _0x2bd762=a27_0x583f;if(_0x381060)return _0x381060;if(_0x22b4df){const _0x437f4a=await withSpinner('Fetching\x20most\x20recent\x20chat...',()=>_0x468310[_0x2bd762(0x110)]['chats'](0x1),{'verbose':_0x558145[_0x2bd762(0x154)]});if(_0x437f4a['data']['length']===0x0)return console[_0x2bd762(0x1b7)](_0x2bd762(0xff)),undefined;return _0x437f4a[_0x2bd762(0x159)][0x0]['id'];}const _0x2911a3=await selectChatInteractively(_0x468310,_0x558145);if(!_0x2911a3)return console['log'](_0x2bd762(0x137)),undefined;return _0x2911a3;}async function getProjectIdOrDefault(_0x3c5fe3){const _0x5d9486=await getProjectWithName(_0x3c5fe3);return _0x5d9486['id'];}async function getProjectWithName(_0x37aaf2){const _0x1968e8=a27_0x583f,{tdx:_0x5c8f4d,options:_0x48400f}=_0x37aaf2,_0x4323cf=_0x48400f['llmProject'];if(_0x4323cf){const _0x5a4c08=await withSpinner(_0x1968e8(0x17a)+_0x4323cf+_0x1968e8(0x18c),()=>_0x5c8f4d['llm'][_0x1968e8(0x1d0)](_0x4323cf),{'verbose':_0x48400f['verbose']});return{'id':_0x5a4c08[_0x1968e8(0x159)],'name':_0x4323cf};}const _0x2b6040=_0x5c8f4d[_0x1968e8(0x110)]['getCurrentProject']();if(_0x2b6040){const _0x5b04bb=await _0x5c8f4d[_0x1968e8(0x110)][_0x1968e8(0x166)](),_0xd86cff=_0x5b04bb[_0x1968e8(0x1be)](_0x4307ff=>_0x4307ff['id']===_0x2b6040);return{'id':_0x2b6040,'name':_0xd86cff?.['attributes']['name']||'Unknown'};}const _0x198f82=await withSpinner(_0x1968e8(0x14f),()=>_0x5c8f4d[_0x1968e8(0x110)][_0x1968e8(0x174)](),{'verbose':_0x48400f[_0x1968e8(0x154)]});return{'id':_0x198f82['data']['id'],'name':_0x198f82['data']['attributes']['name']};}function toLLMProjectInfo(_0x4c6920){const _0x5532dc=a27_0x583f;return{'name':_0x4c6920[_0x5532dc(0x19f)]['name'],'description':_0x4c6920[_0x5532dc(0x19f)][_0x5532dc(0x1b1)],'createdAt':_0x4c6920[_0x5532dc(0x19f)]['createdAt'],'updatedAt':_0x4c6920[_0x5532dc(0x19f)][_0x5532dc(0x108)]};}function toAgentInfo(_0x50871c){const _0x2ed78f=a27_0x583f;return{'name':_0x50871c[_0x2ed78f(0x19f)]['name'],'description':_0x50871c[_0x2ed78f(0x19f)][_0x2ed78f(0x1b1)],'prompt':truncatePrompt(_0x50871c[_0x2ed78f(0x19f)][_0x2ed78f(0x1ba)]),'createdAt':_0x50871c[_0x2ed78f(0x19f)]['createdAt'],'updatedAt':_0x50871c['attributes'][_0x2ed78f(0x108)]};}function a27_0x583f(_0xa2cd5,_0x11dc9f){_0xa2cd5=_0xa2cd5-0xfe;const _0x18a9d4=a27_0x18a9();let _0x583f9a=_0x18a9d4[_0xa2cd5];return _0x583f9a;}function truncatePrompt(_0x32d64f){const _0x5261cb=a27_0x583f;if(!_0x32d64f)return undefined;const _0x1afc18=0x64;if(_0x32d64f[_0x5261cb(0x186)]<=_0x1afc18)return _0x32d64f;return _0x32d64f[_0x5261cb(0x1c6)](0x0,_0x1afc18)+'...';}export class LLMModelsCommand extends BaseCommand{[a27_0x115025(0x16a)]=a27_0x115025(0x1af);[a27_0x115025(0x1b1)]=a27_0x115025(0x14d);async[a27_0x115025(0x18f)](_0x586c0f){const _0x2a1102=a27_0x115025,{options:_0x42d4d7,tdx:_0x164282}=_0x586c0f;try{const _0x11c1ee=await withSpinner('Fetching\x20available\x20models...',()=>_0x164282['llm']['models'](),{'verbose':_0x42d4d7[_0x2a1102(0x154)]});return await handleSDKOutput(_0x11c1ee['data'],_0x42d4d7),0x0;}catch(_0x19cfc5){return handleSDKError(_0x19cfc5,_0x42d4d7),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a27_0x115025(0x16a)]=a27_0x115025(0x114);['description']='List\x20all\x20LLM\x20projects';async['execute'](_0x41af29){const _0x183df3=a27_0x115025,{options:_0x172b5a,args:_0x444930,tdx:_0xa0cb74}=_0x41af29,_0x502330=getChalk(_0x172b5a),_0x573955=_0x172b5a[_0x183df3(0x12a)],_0x191c91=_0x172b5a[_0x183df3(0x1b5)];try{const _0x3b1e61=_0x444930[0x0],_0x1f40cb=resolveLimit(_0x172b5a[_0x183df3(0x190)],DEFAULT_LLM_LIMIT),_0x497d6d=await withSpinner(_0x183df3(0x1c2),()=>_0xa0cb74['llm']['projects'](_0x1f40cb),{'verbose':_0x172b5a[_0x183df3(0x154)]});let _0x5bb37e=_0x497d6d[_0x183df3(0x159)];_0x3b1e61&&(_0x5bb37e=_0x497d6d[_0x183df3(0x159)][_0x183df3(0x103)](_0x11b583=>matchGlobPattern(_0x11b583['attributes'][_0x183df3(0x16a)],_0x3b1e61)));const _0x560c7c=_0x172b5a['format']===_0x183df3(0x162)||_0x172b5a[_0x183df3(0x1aa)]===_0x183df3(0x12d)||_0x172b5a[_0x183df3(0x1aa)]===_0x183df3(0x10d)||_0x172b5a['format']===_0x183df3(0x152);if(_0x560c7c){const _0x553ae7=_0x5bb37e[_0x183df3(0x180)](_0x1d8df9=>({...toLLMProjectInfo(_0x1d8df9),..._0x573955?{'url':getLLMProjectUrl(_0x191c91,_0x1d8df9['id'])}:{}}));await handleSDKOutput(_0x553ae7,_0x172b5a);}else{const _0x1d65f0=[];if(_0x5bb37e[_0x183df3(0x186)]===0x0)_0x1d65f0[_0x183df3(0x102)](_0x502330[_0x183df3(0x14c)](_0x183df3(0x1c3)));else{const _0x586a5f=[..._0x5bb37e]['sort']((_0x4b7c18,_0x1d5e56)=>_0x4b7c18['attributes'][_0x183df3(0x16a)][_0x183df3(0x104)](_0x1d5e56['attributes']['name']));for(const _0x43fab6 of _0x586a5f){if(_0x573955){const _0x1a89fe=getLLMProjectUrl(_0x191c91,_0x43fab6['id']);_0x1d65f0[_0x183df3(0x102)]('⚒️\x20'+_0x43fab6[_0x183df3(0x19f)][_0x183df3(0x16a)]+'\x20\x20'+_0x502330[_0x183df3(0x14c)](_0x1a89fe));}else _0x1d65f0[_0x183df3(0x102)](_0x183df3(0x118)+_0x43fab6[_0x183df3(0x19f)]['name']);}_0x1d65f0[_0x183df3(0x102)](_0x502330[_0x183df3(0x14c)](_0x5bb37e[_0x183df3(0x186)]+_0x183df3(0x12e)));}await writeOutput(_0x1d65f0[_0x183df3(0x176)]('\x0a'),_0x172b5a[_0x183df3(0x171)],_0x183df3(0x10d));}return 0x0;}catch(_0x13ab10){return handleSDKError(_0x13ab10,_0x172b5a),0x1;}}}export class LLMAgentsCommand extends BaseCommand{['name']='llm:agents';[a27_0x115025(0x1b1)]='List\x20agents\x20in\x20current\x20project';async[a27_0x115025(0x18f)](_0x1934dc){const _0x101eb6=a27_0x115025,{options:_0x429ad1,args:_0x342772,tdx:_0xded6cc}=_0x1934dc,_0x9f5b69=getChalk(_0x429ad1),_0x49ec62=_0x429ad1['web'],_0xd95cfb=_0x429ad1['site'];try{const _0xf810ac=_0x342772[0x0];let _0x3bb18a=_0xf810ac,_0x2f39cb,_0x122e6f;if(_0xf810ac&&_0xf810ac['includes']('/')){const _0xbec3=_0xf810ac['split']('/');if(_0xbec3[_0x101eb6(0x186)]===0x2){const [_0x33df8b,_0x38a1d3]=_0xbec3,_0x3a1dff=await _0xded6cc[_0x101eb6(0x110)]['projects'](),_0x15c858=_0x3a1dff[_0x101eb6(0x1be)](_0x10bea5=>_0x10bea5[_0x101eb6(0x19f)][_0x101eb6(0x16a)][_0x101eb6(0x13e)]()===_0x33df8b['toLowerCase']());if(!_0x15c858)throw new SDKError(ErrorCode[_0x101eb6(0x123)],'Project\x20not\x20found:\x20'+_0x33df8b,undefined,{'helpText':_0x101eb6(0x1ab)});_0x2f39cb=_0x15c858['id'],_0x122e6f=_0x15c858[_0x101eb6(0x19f)][_0x101eb6(0x16a)],_0x3bb18a=_0x38a1d3;}else throw new SDKError(ErrorCode[_0x101eb6(0x187)],'Invalid\x20path\x20syntax:\x20'+_0xf810ac,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else{const _0x3f6c2f=await getProjectWithName(_0x1934dc);_0x2f39cb=_0x3f6c2f['id'],_0x122e6f=_0x3f6c2f[_0x101eb6(0x16a)];}const _0x185e1f=await withSpinner(_0x101eb6(0xfe),()=>_0xded6cc['llm'][_0x101eb6(0x1c1)](_0x2f39cb),{'verbose':_0x429ad1[_0x101eb6(0x154)]});let _0x484fdc=_0x185e1f[_0x101eb6(0x159)];_0x3bb18a&&(_0x484fdc=_0x185e1f[_0x101eb6(0x159)][_0x101eb6(0x103)](_0xd0354a=>matchGlobPattern(_0xd0354a['attributes'][_0x101eb6(0x16a)],_0x3bb18a)));const _0x46c2b5=_0x429ad1[_0x101eb6(0x1aa)]===_0x101eb6(0x162)||_0x429ad1['format']===_0x101eb6(0x12d)||_0x429ad1[_0x101eb6(0x1aa)]===_0x101eb6(0x10d)||_0x429ad1['format']==='tsv';if(_0x46c2b5){const _0x27d3be=_0x484fdc['map'](_0x29e9e5=>({...toAgentInfo(_0x29e9e5),..._0x49ec62?{'chatUrl':getLLMAgentChatUrl(_0xd95cfb,_0x2f39cb,_0x29e9e5['id'])}:{}}));await handleSDKOutput(_0x27d3be,_0x429ad1);}else{const _0x5e99f1=[];_0x5e99f1['push'](_0x9f5b69[_0x101eb6(0x14c)]('['+_0x122e6f+']'));if(_0x484fdc[_0x101eb6(0x186)]===0x0)_0x5e99f1['push'](_0x9f5b69[_0x101eb6(0x14c)](_0x101eb6(0x178)));else{const _0x57f92a=[..._0x484fdc][_0x101eb6(0x156)]((_0x3bf829,_0x1d7fd0)=>_0x3bf829[_0x101eb6(0x19f)][_0x101eb6(0x16a)]['localeCompare'](_0x1d7fd0[_0x101eb6(0x19f)][_0x101eb6(0x16a)]));for(const _0x5aad20 of _0x57f92a){if(_0x49ec62){const _0x4b10a7=getLLMAgentChatUrl(_0xd95cfb,_0x2f39cb,_0x5aad20['id']);_0x5e99f1[_0x101eb6(0x102)](_0x101eb6(0x1d3)+_0x5aad20[_0x101eb6(0x19f)][_0x101eb6(0x16a)]+'\x20\x20'+_0x9f5b69['dim'](_0x4b10a7));}else _0x5e99f1[_0x101eb6(0x102)](_0x101eb6(0x1d3)+_0x5aad20[_0x101eb6(0x19f)]['name']);}_0x5e99f1[_0x101eb6(0x102)](_0x9f5b69[_0x101eb6(0x14c)](_0x484fdc[_0x101eb6(0x186)]+_0x101eb6(0x1d2)));}await writeOutput(_0x5e99f1['join']('\x0a'),_0x429ad1[_0x101eb6(0x171)],_0x101eb6(0x10d));}return 0x0;}catch(_0x446811){return handleSDKError(_0x446811,_0x429ad1),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a27_0x115025(0x16a)]='llm:agent:show';['description']=a27_0x115025(0x13d);async[a27_0x115025(0x18f)](_0x3ef42c){const _0x3a04f5=a27_0x115025,{options:_0x1a32da,args:_0x454379,tdx:_0xc41764}=_0x3ef42c;if(_0x454379['length']===0x0)return console[_0x3a04f5(0x10b)](_0x3a04f5(0x175)),console[_0x3a04f5(0x10b)]('Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>'),0x1;const _0x1ee114=_0x454379[0x0];try{const _0x42993e=await getProjectIdOrDefault(_0x3ef42c),_0x4a1847=await withSpinner('Resolving\x20agent\x20\x27'+_0x1ee114+_0x3a04f5(0x18c),()=>_0xc41764['llm'][_0x3a04f5(0x19c)](_0x1ee114,_0x42993e),{'verbose':_0x1a32da[_0x3a04f5(0x154)]}),_0x372d10=await withSpinner(_0x3a04f5(0x15d),()=>_0xc41764[_0x3a04f5(0x110)]['agent'](_0x4a1847['data']),{'verbose':_0x1a32da[_0x3a04f5(0x154)]});return await handleSDKOutput([_0x372d10[_0x3a04f5(0x159)]],_0x1a32da),0x0;}catch(_0x492e0e){return handleSDKError(_0x492e0e,_0x1a32da),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a27_0x115025(0x16a)]=a27_0x115025(0x167);[a27_0x115025(0x1b1)]='Create\x20a\x20new\x20agent\x20in\x20current\x20project';async[a27_0x115025(0x18f)](_0x248846){const _0x591cad=a27_0x115025,{options:_0x485d80,args:_0x268b18,tdx:_0x5123b9}=_0x248846;if(_0x268b18['length']===0x0)return console[_0x591cad(0x10b)](_0x591cad(0x175)),console['error'](_0x591cad(0x1bf)),console[_0x591cad(0x10b)](_0x591cad(0x153)),0x1;const _0x365334=_0x268b18[0x0],_0x5933fc=_0x485d80,_0x5f4ef9=_0x5933fc[_0x591cad(0x196)],_0x1cc103=_0x5933fc[_0x591cad(0x1c5)]||_0x591cad(0x12c),_0x5d0b41=_0x5933fc[_0x591cad(0x111)],_0x3d73ed=_0x5933fc[_0x591cad(0x1c8)]?Number(_0x5933fc[_0x591cad(0x1c8)]):undefined,_0x3721dd=_0x5933fc[_0x591cad(0x12f)]?Number(_0x5933fc['temperature']):undefined;try{let _0x199d4c,_0x390325;if(_0x365334[_0x591cad(0x160)]('/')){const _0x1665b7=_0x365334[_0x591cad(0x151)]('/');if(_0x1665b7['length']===0x2){const [_0x2e2419,_0x5a1114]=_0x1665b7,_0x411ab1=await withSpinner(_0x591cad(0x17a)+_0x2e2419+_0x591cad(0x18c),()=>_0x5123b9[_0x591cad(0x110)][_0x591cad(0x1d0)](_0x2e2419),{'verbose':_0x485d80[_0x591cad(0x154)]});_0x199d4c=_0x411ab1[_0x591cad(0x159)],_0x390325=_0x5a1114;}else throw new SDKError(ErrorCode[_0x591cad(0x187)],_0x591cad(0x172)+_0x365334,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else _0x199d4c=await getProjectIdOrDefault(_0x248846),_0x390325=_0x365334;const _0x2464f8=await withSpinner('Creating\x20agent\x20\x27'+_0x390325+_0x591cad(0x18c),()=>_0x5123b9[_0x591cad(0x110)][_0x591cad(0x1b2)]({'name':_0x390325,'projectId':_0x199d4c,'modelType':_0x1cc103,'systemPrompt':_0x5f4ef9,'starterMessage':_0x5d0b41,'maxToolIterations':_0x3d73ed,'temperature':_0x3721dd}),{'verbose':_0x485d80[_0x591cad(0x154)]});return console[_0x591cad(0x1b7)](_0x591cad(0x13b)+_0x2464f8[_0x591cad(0x159)]['id']),await handleSDKOutput([_0x2464f8[_0x591cad(0x159)]],_0x485d80),0x0;}catch(_0x1db507){return handleSDKError(_0x1db507,_0x485d80),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a27_0x115025(0x16a)]=a27_0x115025(0x146);[a27_0x115025(0x1b1)]=a27_0x115025(0x183);async[a27_0x115025(0x18f)](_0x1c7e4a){const _0x11fda1=a27_0x115025,{options:_0x5f2ca7,args:_0x35f759,tdx:_0x2712f0}=_0x1c7e4a;if(_0x35f759['length']===0x0)return console['error'](_0x11fda1(0x175)),console[_0x11fda1(0x10b)](_0x11fda1(0x16b)),0x1;const _0x912446=_0x35f759[0x0],_0x11f3a7=_0x5f2ca7,_0x3d67cf=_0x11f3a7[_0x11fda1(0x16a)],_0x3d835d=_0x11f3a7[_0x11fda1(0x1ba)],_0x123297=_0x11f3a7[_0x11fda1(0x1b1)],_0x594422=_0x11f3a7['starterMessage'];if(!_0x3d67cf&&!_0x3d835d&&!_0x123297&&!_0x594422)return console[_0x11fda1(0x10b)](_0x11fda1(0x18b)),console[_0x11fda1(0x10b)](_0x11fda1(0x1c9)),0x1;try{const _0x5cdb5c=await getProjectIdOrDefault(_0x1c7e4a),_0x2668e7=await withSpinner('Resolving\x20agent\x20\x27'+_0x912446+_0x11fda1(0x18c),()=>_0x2712f0[_0x11fda1(0x110)][_0x11fda1(0x19c)](_0x912446,_0x5cdb5c),{'verbose':_0x5f2ca7['verbose']}),_0x5293de=_0x2668e7['data'],_0x1e965a=await withSpinner('Updating\x20agent...',()=>_0x2712f0['llm'][_0x11fda1(0x130)](_0x5293de,{'name':_0x3d67cf,'prompt':_0x3d835d,'description':_0x123297,'starterMessage':_0x594422}),{'verbose':_0x5f2ca7['verbose']});return console['log'](_0x11fda1(0x173)+_0x1e965a[_0x11fda1(0x159)]['id']),await handleSDKOutput([_0x1e965a[_0x11fda1(0x159)]],_0x5f2ca7),0x0;}catch(_0x3506ad){return handleSDKError(_0x3506ad,_0x5f2ca7),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a27_0x115025(0x16a)]=a27_0x115025(0x1b0);[a27_0x115025(0x1b1)]=a27_0x115025(0x13c);async[a27_0x115025(0x18f)](_0x552ff5){const _0x47682f=a27_0x115025,{options:_0x15b753,args:_0x21d28e,tdx:_0x24c2d2}=_0x552ff5;if(_0x21d28e['length']===0x0)return console['error'](_0x47682f(0x175)),console[_0x47682f(0x10b)](_0x47682f(0x16f)),0x1;const _0x1b7f07=_0x21d28e[0x0];try{const _0x5a4d86=await getProjectIdOrDefault(_0x552ff5),_0xd62b42=await withSpinner(_0x47682f(0x19d)+_0x1b7f07+_0x47682f(0x18c),()=>_0x24c2d2[_0x47682f(0x110)][_0x47682f(0x19c)](_0x1b7f07,_0x5a4d86),{'verbose':_0x15b753[_0x47682f(0x154)]}),_0xc46dfd=_0xd62b42[_0x47682f(0x159)];return await withSpinner(_0x47682f(0x182),()=>_0x24c2d2[_0x47682f(0x110)]['deleteAgent'](_0xc46dfd),{'verbose':_0x15b753[_0x47682f(0x154)]}),console['log'](_0x47682f(0x10c)+_0xc46dfd),0x0;}catch(_0xdfb9e5){return handleSDKError(_0xdfb9e5,_0x15b753),0x1;}}}export class LLMHistoryCommand extends BaseCommand{['name']='llm:history';[a27_0x115025(0x1b1)]=a27_0x115025(0x140);async[a27_0x115025(0x18f)](_0x12e6e6){return executeChatHistoryCommand(_0x12e6e6,'tdx\x20llm\x20history');}}export class LLMUseCommand extends BaseCommand{[a27_0x115025(0x16a)]='llm:use';[a27_0x115025(0x1b1)]='Set\x20current\x20project\x20context';async[a27_0x115025(0x18f)](_0x307d47){const _0x56d9a9=a27_0x115025,{options:_0x796968,args:_0x4dccf4,tdx:_0x1ea8bc}=_0x307d47;if(_0x4dccf4[_0x56d9a9(0x186)]===0x0)return console[_0x56d9a9(0x10b)](_0x56d9a9(0x126)),console[_0x56d9a9(0x10b)]('Usage:\x20tdx\x20llm\x20use\x20<project-name>'),0x1;const _0x5abfd7=_0x4dccf4[0x0];try{return await withSpinner('Setting\x20project\x20context\x20to\x20\x27'+_0x5abfd7+_0x56d9a9(0x18c),()=>_0x1ea8bc['llm']['setCurrentProject'](_0x5abfd7),{'verbose':_0x796968['verbose']}),console['log'](_0x56d9a9(0x1cc)+_0x5abfd7),0x0;}catch(_0xceac78){return handleSDKError(_0xceac78,_0x796968),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a27_0x115025(0x16a)]='llm:project:create';[a27_0x115025(0x1b1)]=a27_0x115025(0x11d);async[a27_0x115025(0x18f)](_0x91bd36){const _0x4405ed=a27_0x115025,{options:_0x3fb1d7,args:_0x577302,tdx:_0x376e67}=_0x91bd36;if(_0x577302[_0x4405ed(0x186)]===0x0)return console['error'](_0x4405ed(0x126)),console['error'](_0x4405ed(0x141)),0x1;const _0x4966a4=_0x577302[0x0],_0x328d51=_0x3fb1d7,_0x46f1b1=_0x328d51[_0x4405ed(0x1b1)];try{const _0x4d42c5=await withSpinner(_0x4405ed(0x121)+_0x4966a4+_0x4405ed(0x18c),()=>_0x376e67[_0x4405ed(0x110)][_0x4405ed(0x16e)]({'name':_0x4966a4,'description':_0x46f1b1}),{'verbose':_0x3fb1d7[_0x4405ed(0x154)]});console[_0x4405ed(0x1b7)]('Project\x20created:\x20'+_0x4d42c5[_0x4405ed(0x159)]['id']);const _0x4d868f=toLLMProjectInfo(_0x4d42c5[_0x4405ed(0x159)]);return await handleSDKOutput([_0x4d868f],_0x3fb1d7),0x0;}catch(_0x50786a){return handleSDKError(_0x50786a,_0x3fb1d7),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a27_0x115025(0x16a)]=a27_0x115025(0x105);['description']=a27_0x115025(0x189);async['execute'](_0xdd0bf6){const _0xb4b833=a27_0x115025,{options:_0x2aeeca,args:_0x5b52f0,tdx:_0x3c4062}=_0xdd0bf6;if(_0x5b52f0[_0xb4b833(0x186)]===0x0)return console[_0xb4b833(0x10b)]('Error:\x20Project\x20name\x20is\x20required'),console[_0xb4b833(0x10b)](_0xb4b833(0x122)),0x1;const _0x1177d6=_0x5b52f0[0x0];try{return await withSpinner(_0xb4b833(0x16d)+_0x1177d6+_0xb4b833(0x18c),()=>_0x3c4062[_0xb4b833(0x110)]['deleteProject'](_0x1177d6),{'verbose':_0x2aeeca[_0xb4b833(0x154)]}),console[_0xb4b833(0x1b7)](_0xb4b833(0x193)+_0x1177d6),0x0;}catch(_0x12a118){return handleSDKError(_0x12a118,_0x2aeeca),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a27_0x115025(0x16a)]='llm:project:backup';[a27_0x115025(0x1b1)]=a27_0x115025(0x199);async[a27_0x115025(0x18f)](_0x138cc3){const _0x53ee35=a27_0x115025,{options:_0x1cc569,args:_0x13c078,tdx:_0x5af542}=_0x138cc3,_0x5d0ba9=getChalk(_0x1cc569);console[_0x53ee35(0x1b7)](_0x5d0ba9[_0x53ee35(0x14b)](_0x53ee35(0x1c4))),console['log'](_0x5d0ba9[_0x53ee35(0x14b)](_0x53ee35(0x129))),console[_0x53ee35(0x1b7)](_0x5d0ba9[_0x53ee35(0x14c)]('\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents')),console[_0x53ee35(0x1b7)]();if(_0x13c078[_0x53ee35(0x186)]===0x0)return console[_0x53ee35(0x10b)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x53ee35(0x10b)](_0x53ee35(0x19b)),0x1;const _0x4722a8=_0x13c078[0x0],_0x3cd4b2=_0x1cc569,_0x39f923=_0x3cd4b2[_0x53ee35(0x171)],_0x5cb596=_0x3cd4b2[_0x53ee35(0x168)];try{const _0xf6273f=_0x39f923||_0x4722a8+_0x53ee35(0x17b);if(a27_0x4c7b8a[_0x53ee35(0x128)](_0xf6273f)&&!_0x5cb596){if(!_0x1cc569['yes']){const _0x20144b=await confirm(_0x53ee35(0x1a4)+_0xf6273f+_0x53ee35(0x1a9));if(!_0x20144b)return console[_0x53ee35(0x1b7)](_0x53ee35(0x164)),0x0;}a27_0x4c7b8a[_0x53ee35(0x132)](_0xf6273f,{'recursive':!![]});}const _0x2f6075=await withSpinner(_0x5cb596?_0x53ee35(0x11f)+_0x4722a8+_0x53ee35(0x18c):'Backing\x20up\x20project\x20\x27'+_0x4722a8+'\x27...',()=>_0x5af542['llm']['backupProject'](_0x4722a8,_0x39f923,{'dryRun':_0x5cb596}),{'verbose':_0x1cc569[_0x53ee35(0x154)]}),_0x3dac13=_0x2f6075[_0x53ee35(0x159)];return _0x5cb596?console[_0x53ee35(0x1b7)](_0x53ee35(0x1c7)+_0x3dac13['outputDir']):console[_0x53ee35(0x1b7)]('Project\x20backed\x20up\x20to:\x20'+_0x3dac13[_0x53ee35(0x1bd)]),console[_0x53ee35(0x1b7)](_0x53ee35(0x1a5)+_0x3dac13[_0x53ee35(0x195)][_0x53ee35(0x1c1)]),console[_0x53ee35(0x1b7)]('\x20\x20Knowledge\x20Bases:\x20'+_0x3dac13[_0x53ee35(0x195)][_0x53ee35(0x1b9)]),console[_0x53ee35(0x1b7)]('\x20\x20Prompts:\x20'+_0x3dac13[_0x53ee35(0x195)]['prompts']),console[_0x53ee35(0x1b7)]('\x20\x20Integrations:\x20'+_0x3dac13[_0x53ee35(0x195)][_0x53ee35(0x1b8)]),(_0x1cc569[_0x53ee35(0x1aa)]===_0x53ee35(0x162)||_0x1cc569[_0x53ee35(0x1aa)]===_0x53ee35(0x12d))&&await handleSDKOutput([_0x3dac13],_0x1cc569),0x0;}catch(_0x1fa274){return handleSDKError(_0x1fa274,_0x1cc569),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{['name']=a27_0x115025(0x184);[a27_0x115025(0x1b1)]=a27_0x115025(0x15b);async[a27_0x115025(0x18f)](_0x224e29){const _0x34544a=a27_0x115025,{options:_0x4022d6,args:_0xbc3868,tdx:_0x7d862c}=_0x224e29,_0x5195e6=getChalk(_0x4022d6);console['log'](_0x5195e6[_0x34544a(0x14b)](_0x34544a(0x155))),console[_0x34544a(0x1b7)](_0x5195e6[_0x34544a(0x14b)](_0x34544a(0x1cb))),console[_0x34544a(0x1b7)](_0x5195e6[_0x34544a(0x14c)]('\x20\x20\x20Examples:')),console[_0x34544a(0x1b7)](_0x5195e6['dim'](_0x34544a(0x10a))),console['log'](_0x5195e6[_0x34544a(0x14c)](_0x34544a(0x11b))),console[_0x34544a(0x1b7)]();if(_0xbc3868[_0x34544a(0x186)]===0x0)return console[_0x34544a(0x10b)](_0x34544a(0x13f)),console[_0x34544a(0x10b)]('Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]'),0x1;const _0x50def3=_0xbc3868[0x0],_0x44a34e=_0x4022d6,_0x19c07e=_0x44a34e['name'],_0x32f58d=_0x44a34e['dryRun'];try{if(!_0x32f58d){const _0x42b1ba=_0x7d862c[_0x34544a(0x110)][_0x34544a(0x109)](_0x50def3),_0x151abf=_0x19c07e||_0x42b1ba[_0x34544a(0x15e)][_0x34544a(0x194)],_0x558a14=await withSpinner('Checking\x20for\x20existing\x20projects...',()=>_0x7d862c[_0x34544a(0x110)]['projects'](),{'verbose':_0x4022d6[_0x34544a(0x154)]}),_0x1ec0c6=_0x558a14[_0x34544a(0x159)][_0x34544a(0x1be)](_0x148a7a=>_0x148a7a[_0x34544a(0x19f)]['name']===_0x151abf);if(_0x1ec0c6&&!_0x4022d6[_0x34544a(0x1ac)]){const _0x5f3b98=await confirm(_0x34544a(0x148)+_0x151abf+_0x34544a(0x107));if(!_0x5f3b98)return console[_0x34544a(0x1b7)](_0x34544a(0x138)),0x0;}}const _0x327298=await withSpinner(_0x32f58d?_0x34544a(0x143)+_0x50def3+'\x27...':'Restoring\x20project\x20from\x20\x27'+_0x50def3+'\x27...',()=>_0x7d862c['llm'][_0x34544a(0x177)](_0x50def3,{'name':_0x19c07e,'dryRun':_0x32f58d}),{'verbose':_0x4022d6[_0x34544a(0x154)]}),_0x4542ea=_0x327298[_0x34544a(0x159)];return _0x4542ea['sourceSite']&&console['log'](_0x34544a(0x133)+_0x4542ea['sourceSite']+'\x27'),_0x32f58d?console[_0x34544a(0x1b7)](_0x34544a(0x163)+_0x4542ea[_0x34544a(0x194)]):console[_0x34544a(0x1b7)](_0x34544a(0x1b3)+_0x4542ea[_0x34544a(0x194)]+'\x20('+_0x4542ea[_0x34544a(0x1ce)]+')'),console[_0x34544a(0x1b7)](_0x34544a(0x1a5)+_0x4542ea[_0x34544a(0x195)][_0x34544a(0x1c1)]),console[_0x34544a(0x1b7)](_0x34544a(0x134)+_0x4542ea[_0x34544a(0x195)][_0x34544a(0x1b9)]),console['log']('\x20\x20Prompts:\x20'+_0x4542ea[_0x34544a(0x195)][_0x34544a(0x18e)]),console[_0x34544a(0x1b7)](_0x34544a(0x169)+_0x4542ea[_0x34544a(0x195)]['integrations']),(_0x4022d6[_0x34544a(0x1aa)]===_0x34544a(0x162)||_0x4022d6['format']===_0x34544a(0x12d))&&await handleSDKOutput([_0x4542ea],_0x4022d6),0x0;}catch(_0x5093a4){return handleSDKError(_0x5093a4,_0x4022d6),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x5b8cc4,_0x312df6){const _0x331fae=a27_0x115025,_0xe79725=_0x312df6[_0x331fae(0x190)]||CHAT_SELECTOR_PAGE_SIZE;let _0x319c42=0x0,_0x4f9d87=[];const _0x50571a=(await import('prompts'))[_0x331fae(0x1cf)],_0x5df110=getChalk(_0x312df6);while(!![]){const _0x57d366=await withSpinner(_0x331fae(0x1a3),()=>_0x5b8cc4[_0x331fae(0x110)]['chats'](_0xe79725+_0x319c42),{'verbose':_0x312df6['verbose']});_0x4f9d87=_0x57d366['data'];const _0x40784f=_0x4f9d87[_0x331fae(0x1c6)](_0x319c42,_0x319c42+_0xe79725),_0x552f87=_0x4f9d87['length']>_0x319c42+_0xe79725,_0x489e9f=[...new Set(_0x40784f[_0x331fae(0x180)](_0x3f6220=>_0x3f6220[_0x331fae(0x19f)][_0x331fae(0x1bb)])[_0x331fae(0x103)](_0xcabe95=>_0xcabe95!==undefined))],_0x49c0c5=new Map();await Promise[_0x331fae(0x119)](_0x489e9f[_0x331fae(0x180)](async _0x533b15=>{const _0x205810=_0x331fae;try{const _0x16e00b=await _0x5b8cc4[_0x205810(0x110)][_0x205810(0x115)](_0x533b15);_0x49c0c5[_0x205810(0x1a2)](_0x533b15,_0x16e00b['attributes'][_0x205810(0x16a)]);}catch{_0x49c0c5[_0x205810(0x1a2)](_0x533b15,_0x533b15);}}));const _0x5aa829=_0x40784f[_0x331fae(0x180)](_0x2516df=>{const _0x5e186c=_0x331fae,_0x155e91=_0x2516df[_0x5e186c(0x19f)]['firstInputContent']||'(no\x20message)',_0x26c0e0=_0x155e91[_0x5e186c(0x151)]('\x0a')[0x0],_0x125af2=_0x26c0e0[_0x5e186c(0x186)]>0x50?_0x26c0e0[_0x5e186c(0x139)](0x0,0x4d)+_0x5e186c(0x150):_0x26c0e0,_0x47cd5f=_0x2516df[_0x5e186c(0x19f)][_0x5e186c(0x1bb)]?_0x49c0c5[_0x5e186c(0x1ad)](_0x2516df[_0x5e186c(0x19f)]['agentId'])||_0x2516df[_0x5e186c(0x19f)][_0x5e186c(0x1bb)]:_0x5e186c(0x106),_0x33822c=_0x2516df[_0x5e186c(0x19f)][_0x5e186c(0x127)]||_0x2516df[_0x5e186c(0x19f)][_0x5e186c(0x108)],_0x454df8=new Date(_0x33822c),_0x419411=new Date(),_0x31fce5=_0x419411[_0x5e186c(0x135)]()-_0x454df8[_0x5e186c(0x135)](),_0x1d572f=Math[_0x5e186c(0x18d)](_0x31fce5/0xea60),_0x3e97a3=Math[_0x5e186c(0x18d)](_0x31fce5/0x36ee80),_0x2e1f53=Math[_0x5e186c(0x18d)](_0x31fce5/0x5265c00);let _0x36a565;if(_0x1d572f<0x1)_0x36a565='just\x20now';else{if(_0x1d572f<0x3c)_0x36a565=_0x1d572f+_0x5e186c(0x124);else{if(_0x3e97a3<0x18)_0x36a565=_0x3e97a3+_0x5e186c(0x170);else _0x2e1f53<0x7?_0x36a565=_0x2e1f53+_0x5e186c(0x15c):_0x36a565=_0x454df8[_0x5e186c(0x18a)](_0x5e186c(0x125),{'month':'short','day':_0x5e186c(0x17f)});}}return{'title':_0x125af2+'\x20'+_0x5df110[_0x5e186c(0x14c)]('['+_0x47cd5f+']\x20'+_0x36a565),'value':_0x2516df['id']};});_0x552f87&&_0x5aa829[_0x331fae(0x102)]({'title':_0x5df110[_0x331fae(0x191)]('Load\x20more...'),'value':_0x331fae(0x14e)});const _0x376688=await _0x50571a({'type':_0x331fae(0x1a0),'name':_0x331fae(0x17d),'message':_0x331fae(0x13a),'choices':_0x5aa829,'hint':_0x331fae(0x15f)});if(!_0x376688[_0x331fae(0x17d)])return undefined;if(_0x376688[_0x331fae(0x17d)]===_0x331fae(0x14e)){_0x319c42+=_0xe79725;continue;}return _0x376688[_0x331fae(0x17d)];}}export class ChatsCommand extends BaseCommand{[a27_0x115025(0x16a)]=a27_0x115025(0x17e);['description']=a27_0x115025(0x1ae);async[a27_0x115025(0x18f)](_0x2bef60){const _0x1ee6aa=a27_0x115025;return executeChatHistoryCommand(_0x2bef60,_0x1ee6aa(0x165));}}
1
+ const a27_0x243009=a27_0x4a2f;(function(_0x433332,_0x3b589a){const _0x3e4dbc=a27_0x4a2f,_0x49056a=_0x433332();while(!![]){try{const _0x1162ba=-parseInt(_0x3e4dbc(0x19a))/0x1*(-parseInt(_0x3e4dbc(0x1e3))/0x2)+-parseInt(_0x3e4dbc(0x1e0))/0x3+-parseInt(_0x3e4dbc(0x171))/0x4+-parseInt(_0x3e4dbc(0x1f2))/0x5*(-parseInt(_0x3e4dbc(0x1b5))/0x6)+parseInt(_0x3e4dbc(0x1b1))/0x7*(-parseInt(_0x3e4dbc(0x126))/0x8)+-parseInt(_0x3e4dbc(0x16c))/0x9+-parseInt(_0x3e4dbc(0x165))/0xa*(-parseInt(_0x3e4dbc(0x1e1))/0xb);if(_0x1162ba===_0x3b589a)break;else _0x49056a['push'](_0x49056a['shift']());}catch(_0x250f95){_0x49056a['push'](_0x49056a['shift']());}}}(a27_0x16bc,0x7b8e7));function a27_0x4a2f(_0x4a5ab4,_0x6f1f72){_0x4a5ab4=_0x4a5ab4-0x124;const _0x16bc46=a27_0x16bc();let _0x4a2fc1=_0x16bc46[_0x4a5ab4];return _0x4a2fc1;}import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{getChalk}from'../utils/colors.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../utils/constants.js';import{confirm}from'../utils/prompt.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../types/endpoints.js';import*as a27_0x481419 from'node:fs';function handleSDKError(_0x48bd10,_0x281945){const _0x44e076=a27_0x4a2f;if(_0x48bd10 instanceof SDKError)console[_0x44e076(0x1ab)](_0x44e076(0x1be)+_0x48bd10['message']),_0x281945[_0x44e076(0x1ca)]&&(_0x48bd10[_0x44e076(0x1c4)]&&console[_0x44e076(0x1ab)]('\x20\x20Cause:\x20'+_0x48bd10[_0x44e076(0x1c4)]),_0x48bd10['stack']&&(console['error']('\x0aStack\x20trace:'),console[_0x44e076(0x1ab)](_0x48bd10[_0x44e076(0x15d)])));else throw _0x48bd10;}function formatChatHistoryEntry(_0x580717,_0xaf2bcf){const _0x1e7e33=a27_0x4a2f,_0x6f41c2=getChalk(_0xaf2bcf),_0x46096a=_0x6f41c2['dim'](_0x580717['at']);if(_0x1e7e33(0x174)in _0x580717){const _0x519022=_0x6f41c2['cyan']('[input]\x20\x20');return _0x46096a+'\x20'+_0x519022+':\x20'+_0x580717['input'];}if(_0x1e7e33(0x156)in _0x580717){const _0x2f4fa5=_0x6f41c2[_0x1e7e33(0x1a5)](_0x1e7e33(0x1c5));return _0x46096a+'\x20'+_0x2f4fa5+':\x20'+_0x580717[_0x1e7e33(0x156)];}if('tool_call'in _0x580717){const _0xfbaf21=_0x6f41c2['yellow']('[tool_call]'),{functionName:_0x4bf98d,functionArguments:_0x5b961b,targetFunction:_0x1d182e}=_0x580717[_0x1e7e33(0x1c8)];let _0x243842=_0x46096a+'\x20'+_0xfbaf21+':\x20'+_0x6f41c2[_0x1e7e33(0x18c)](_0x4bf98d);if(_0x5b961b&&Object[_0x1e7e33(0x163)](_0x5b961b)[_0x1e7e33(0x1e9)]>0x0){const _0x41f3f3=Object['entries'](_0x5b961b)['map'](([_0xc645af,_0x196429])=>_0xc645af+'='+JSON[_0x1e7e33(0x157)](_0x196429))[_0x1e7e33(0x189)](',\x20');_0x243842+='('+_0x41f3f3+')';}_0x1d182e&&(_0x243842+=_0x6f41c2[_0x1e7e33(0x181)]('\x20['+_0x1d182e+']'));let _0x5195df='';if(_0x580717['tool_call']['targetKnowledgeBase'])_0x5195df='\x20->\x20KB:'+_0x580717[_0x1e7e33(0x1c8)][_0x1e7e33(0x1d3)][_0x1e7e33(0x1af)];else{if(_0x580717[_0x1e7e33(0x1c8)][_0x1e7e33(0x1d0)])_0x5195df=_0x1e7e33(0x1c7)+_0x580717[_0x1e7e33(0x1c8)][_0x1e7e33(0x1d0)][_0x1e7e33(0x1af)];else{if(_0x580717[_0x1e7e33(0x1c8)]['targetWebSearchTool'])_0x5195df=_0x1e7e33(0x1a9)+_0x580717[_0x1e7e33(0x1c8)][_0x1e7e33(0x175)]['name'];else _0x580717[_0x1e7e33(0x1c8)][_0x1e7e33(0x188)]&&(_0x5195df=_0x1e7e33(0x162)+_0x580717[_0x1e7e33(0x1c8)][_0x1e7e33(0x188)][_0x1e7e33(0x1af)]);}}return _0x243842+_0x5195df;}if(_0x1e7e33(0x192)in _0x580717){const _0x471e42=_0x6f41c2[_0x1e7e33(0x1aa)](_0x1e7e33(0x154)),{functionName:_0x588a05,functionArguments:_0x379ab5,content:_0x3552df,newChat:_0x286c74}=_0x580717[_0x1e7e33(0x192)];let _0x2c37b0=_0x46096a+'\x20'+_0x471e42+':\x20'+_0x6f41c2[_0x1e7e33(0x18c)](_0x588a05);if(_0x379ab5){const _0x2cac1d=typeof _0x379ab5==='string'?_0x379ab5:JSON['stringify'](_0x379ab5);_0x2c37b0+='('+_0x2cac1d+')';}return _0x3552df&&(_0x2c37b0+='\x0a'+_0x6f41c2[_0x1e7e33(0x181)](_0x3552df)),_0x286c74&&(_0x2c37b0+=_0x6f41c2[_0x1e7e33(0x181)](_0x1e7e33(0x1ac)+_0x286c74['id'])),_0x2c37b0;}if(_0x1e7e33(0x143)in _0x580717){const _0x107df6=_0x6f41c2['blue']('[output]\x20');return _0x46096a+'\x20'+_0x107df6+':\x20'+_0x580717[_0x1e7e33(0x143)]['name']+'\x20('+_0x580717[_0x1e7e33(0x143)][_0x1e7e33(0x156)][_0x1e7e33(0x1e9)]+_0x1e7e33(0x12c);}if(_0x1e7e33(0x1e8)in _0x580717){const _0x150b33=_0x6f41c2[_0x1e7e33(0x1bc)](_0x1e7e33(0x12b)),{width:_0x2a8cfd,height:_0x3e3601,headerText:_0x50b8e9}=_0x580717['image'],_0x1fb080=_0x50b8e9?'\x20-\x20'+_0x50b8e9:'';return _0x46096a+'\x20'+_0x150b33+':\x20'+_0x2a8cfd+'x'+_0x3e3601+_0x1fb080;}if('error'in _0x580717){const _0xce2cfa=_0x6f41c2['red']('[error]\x20\x20');return _0x46096a+'\x20'+_0xce2cfa+':\x20'+_0x580717[_0x1e7e33(0x1ab)];}return _0x46096a+'\x20'+_0x6f41c2[_0x1e7e33(0x181)](_0x1e7e33(0x151))+':\x20'+JSON[_0x1e7e33(0x157)](_0x580717);}async function executeChatHistoryCommand(_0x1b98c7,_0xdd8527){const _0x56e786=a27_0x4a2f,{options:_0x4ccecc,args:_0x4788c5,tdx:_0x4d894d}=_0x1b98c7,_0x17fb37=_0x4788c5[0x0],_0x1696d4=_0x4ccecc,_0x1122bb=_0x1696d4[_0x56e786(0x17a)];try{if(_0x1122bb&&_0x17fb37)return console[_0x56e786(0x1ab)]('Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument'),console[_0x56e786(0x1ab)](_0x56e786(0x131)+_0xdd8527+_0x56e786(0x1f1)),0x1;if(!_0x17fb37&&!_0x1122bb&&_0x4ccecc['format']!==undefined){const _0x33494c=resolveLimit(_0x4ccecc['limit'],DEFAULT_LLM_LIMIT),_0x3f0efa=await withSpinner(_0x56e786(0x14c),()=>_0x4d894d[_0x56e786(0x13f)][_0x56e786(0x187)](_0x33494c),{'verbose':_0x4ccecc['verbose']});return await handleSDKOutput(_0x3f0efa[_0x56e786(0x1ce)],_0x4ccecc),0x0;}const _0x490d23=await getChatIdOrSelect(_0x4d894d,_0x4ccecc,_0x1122bb,_0x17fb37);if(!_0x490d23)return 0x0;return await displayChatHistory(_0x490d23,_0x4d894d,_0x4ccecc),0x0;}catch(_0x418052){return handleSDKError(_0x418052,_0x4ccecc),0x1;}}async function displayChatHistory(_0x5d9cf7,_0x569a8c,_0x3eb6ba){const _0x3247e5=a27_0x4a2f,_0x3b3cab=await withSpinner(_0x3247e5(0x130)+_0x5d9cf7+'\x27...',()=>_0x569a8c['llm'][_0x3247e5(0x1b3)](_0x5d9cf7),{'verbose':_0x3eb6ba['verbose']}),_0x162056=_0x3b3cab[_0x3247e5(0x1ce)][_0x3247e5(0x1ce)]??[];if(_0x162056[_0x3247e5(0x1e9)]===0x0){console[_0x3247e5(0x1a3)]('No\x20messages\x20found\x20in\x20chat\x20history.');return;}if(_0x3eb6ba[_0x3247e5(0x14f)]!==undefined)await handleSDKOutput(_0x162056,_0x3eb6ba);else{const _0x357a0e=_0x162056[_0x3247e5(0x136)](_0x2fa5f8=>formatChatHistoryEntry(_0x2fa5f8,_0x3eb6ba)),_0x277f0e=_0x357a0e[_0x3247e5(0x189)]('\x0a');await writeOutput(_0x277f0e,_0x3eb6ba[_0x3247e5(0x143)],_0x3247e5(0x1dc));}}async function getChatIdOrSelect(_0x3fa806,_0xc37201,_0x570fce,_0xba4396){const _0x59b203=a27_0x4a2f;if(_0xba4396)return _0xba4396;if(_0x570fce){const _0x25989d=await withSpinner(_0x59b203(0x15c),()=>_0x3fa806[_0x59b203(0x13f)][_0x59b203(0x187)](0x1),{'verbose':_0xc37201[_0x59b203(0x1ca)]});if(_0x25989d['data'][_0x59b203(0x1e9)]===0x0)return console[_0x59b203(0x1a3)]('No\x20chat\x20sessions\x20found.'),undefined;return _0x25989d['data'][0x0]['id'];}const _0x11d974=await selectChatInteractively(_0x3fa806,_0xc37201);if(!_0x11d974)return console['log'](_0x59b203(0x17d)),undefined;return _0x11d974;}async function getProjectIdOrDefault(_0x1e70bc){const _0x41af7f=await getProjectWithName(_0x1e70bc);return _0x41af7f['id'];}async function getProjectWithName(_0x2d8105){const _0x243734=a27_0x4a2f,{tdx:_0x125bd2,options:_0x4b2121}=_0x2d8105,_0x1a0e42=_0x4b2121[_0x243734(0x1b2)];if(_0x1a0e42){const _0x2eced6=await withSpinner('Resolving\x20project\x20\x27'+_0x1a0e42+_0x243734(0x1c0),()=>_0x125bd2[_0x243734(0x13f)][_0x243734(0x164)](_0x1a0e42),{'verbose':_0x4b2121[_0x243734(0x1ca)]});return{'id':_0x2eced6[_0x243734(0x1ce)],'name':_0x1a0e42};}const _0x195ba5=_0x125bd2[_0x243734(0x13f)][_0x243734(0x12e)]();if(_0x195ba5){const _0x580232=await _0x125bd2['llm'][_0x243734(0x1a6)](),_0x5874cb=_0x580232[_0x243734(0x1f0)](_0x37cba1=>_0x37cba1['id']===_0x195ba5);return{'id':_0x195ba5,'name':_0x5874cb?.['attributes'][_0x243734(0x1af)]||_0x243734(0x1ee)};}const _0x510bdb=await withSpinner(_0x243734(0x177),()=>_0x125bd2['llm'][_0x243734(0x158)](),{'verbose':_0x4b2121[_0x243734(0x1ca)]});return{'id':_0x510bdb[_0x243734(0x1ce)]['id'],'name':_0x510bdb['data']['attributes']['name']};}function toLLMProjectInfo(_0x1d1a2b){const _0x4b4469=a27_0x4a2f;return{'name':_0x1d1a2b[_0x4b4469(0x1db)][_0x4b4469(0x1af)],'description':_0x1d1a2b[_0x4b4469(0x1db)][_0x4b4469(0x17f)],'createdAt':_0x1d1a2b[_0x4b4469(0x1db)][_0x4b4469(0x1ed)],'updatedAt':_0x1d1a2b['attributes'][_0x4b4469(0x1a8)]};}function toAgentInfo(_0x423f87){const _0xf44600=a27_0x4a2f;return{'name':_0x423f87[_0xf44600(0x1db)][_0xf44600(0x1af)],'description':_0x423f87['attributes'][_0xf44600(0x17f)],'prompt':truncatePrompt(_0x423f87[_0xf44600(0x1db)][_0xf44600(0x17e)]),'createdAt':_0x423f87[_0xf44600(0x1db)][_0xf44600(0x1ed)],'updatedAt':_0x423f87[_0xf44600(0x1db)]['updatedAt']};}function truncatePrompt(_0xc8a5d9){const _0x3ca9ec=a27_0x4a2f;if(!_0xc8a5d9)return undefined;const _0x1f5890=0x64;if(_0xc8a5d9[_0x3ca9ec(0x1e9)]<=_0x1f5890)return _0xc8a5d9;return _0xc8a5d9['slice'](0x0,_0x1f5890)+_0x3ca9ec(0x16a);}function a27_0x16bc(){const _0x1c54ef=['dryRun','803754uqzFFW','11tMSdPE','Usage:\x20tdx\x20llm\x20use\x20<project-name>','2TtHPVz','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','Agent\x20updated:\x20','\x27\x20already\x20exists.\x20Overwrite?','\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.','image','length','\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/','yellow','rmSync','createdAt','Unknown','jsonl','find','\x20--last','90455cZFmhC','Deleting\x20project\x20\x27','Backing\x20up\x20project\x20\x27','Error:\x20Agent\x20name\x20is\x20required','maxToolIterations','\x20project(s)','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.','existsSync','Resolving\x20agent\x20\x27','3683816hYgKcd','Updating\x20agent...','llm:project:delete','resolveAgentId','No\x20agents\x20found','[image]\x20\x20','\x20bytes)','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','getCurrentProject','projectName','Fetching\x20chat\x20history\x20for\x20\x27','Usage:\x20','Project\x20deleted:\x20','llm:project:backup','tsv','Project\x20context\x20set\x20to:\x20','map','localeCompare','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','tdx\x20chats','Creating\x20agent\x20\x27','agent','agents','tdx\x20llm\x20history','Checking\x20for\x20existing\x20projects...','llm','Project\x20created:\x20','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','Agent\x20created:\x20','output','Deleting\x20agent...','integrations','llm:history','short','(no\x20agent)','getTime','Agent\x20deleted:\x20','exportedFrom','Fetching\x20chat\x20sessions...','⚒️\x20','\x20\x20Prompts:\x20','format','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','[unknown]','web','llm:projects','[tool]\x20\x20\x20','execute','content','stringify','getOrCreateDefaultProject','site','claude-4.5-haiku','Backup\x20cancelled.','Fetching\x20most\x20recent\x20chat...','stack','createProject','sourceSite','m\x20ago','select','\x20->\x20ImageGen:','keys','resolveProjectId','14316530GnEzlw','llm:agent:update','includes','toLocaleDateString','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','...','slice','5179851lFiEUj','🤖\x20','llm:project:create','push','floor','3320076XPWGRj','Use\x20format:\x20project-name/agent-name','split','input','targetWebSearchTool','yes','Getting\x20default\x20project...','Creating\x20project\x20\x27','LLM_PROJECT_NOT_FOUND','last','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','\x0aCancelled','prompt','description','__load_more__','dim','Show\x20agent\x20details','json','Resolving\x20project\x20\x27','INVALID_ARGUMENT','knowledgeBases','chats','targetImageGenerator','join','Error:\x20Backup\x20folder\x20path\x20is\x20required','No\x20projects\x20found','bold','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','set','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','models','Validating\x20backup\x20from\x20\x27','tool','sort','getBackupMetadata','agentId','prompts','firstInputContent','llm:agents','Output\x20directory\x20\x27','918931QxkjuJ','deleteAgent','counts','Error:\x20Project\x20name\x20is\x20required','restoreProject','en-US','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)','\x20\x20Integrations:\x20','toLowerCase','log','Fetching\x20available\x20models...','green','projects','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','updatedAt','\x20->\x20WebSearch:','magenta','error','\x20→\x20chat:\x20','Set\x20current\x20project\x20context','filter','name','model','7oEUDtf','llmProject','history','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','96EgBEvi','List\x20available\x20LLM\x20models','chatId','Project\x20backed\x20up\x20to:\x20','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','starterMessage','d\x20ago','blue','\x20\x20Knowledge\x20Bases:\x20','Error:\x20','\x20agent(s)','\x27...','lastConversationAt','\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22','Select\x20a\x20chat\x20session:','cause','[content]','Update\x20an\x20existing\x20agent','\x20->\x20Agent:','tool_call','llm:agent:delete','verbose','Invalid\x20path\x20syntax:\x20','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','deleteProject','data','\x20\x20Agents:\x20','targetAgent','Fetching\x20agents...','default','targetKnowledgeBase','llm:use','backupProject','Create\x20a\x20new\x20LLM\x20project','limit','Restoring\x20project\x20from\x20\x27','llm:agent:show','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','attributes','table','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','outputDir'];a27_0x16bc=function(){return _0x1c54ef;};return a27_0x16bc();}export class LLMModelsCommand extends BaseCommand{[a27_0x243009(0x1af)]='llm:models';[a27_0x243009(0x17f)]=a27_0x243009(0x1b6);async['execute'](_0x14d33b){const _0x150d13=a27_0x243009,{options:_0x160c67,tdx:_0x94b901}=_0x14d33b;try{const _0x18e123=await withSpinner(_0x150d13(0x1a4),()=>_0x94b901['llm'][_0x150d13(0x190)](),{'verbose':_0x160c67[_0x150d13(0x1ca)]});return await handleSDKOutput(_0x18e123['data'],_0x160c67),0x0;}catch(_0x4d934d){return handleSDKError(_0x4d934d,_0x160c67),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a27_0x243009(0x1af)]=a27_0x243009(0x153);[a27_0x243009(0x17f)]='List\x20all\x20LLM\x20projects';async[a27_0x243009(0x155)](_0x9db01a){const _0x2a9c9c=a27_0x243009,{options:_0x284cc0,args:_0x4c1609,tdx:_0x3bc464}=_0x9db01a,_0x129b0d=getChalk(_0x284cc0),_0xf95a7e=_0x284cc0[_0x2a9c9c(0x152)],_0x175066=_0x284cc0[_0x2a9c9c(0x159)];try{const _0xf8d2d7=_0x4c1609[0x0],_0x183586=resolveLimit(_0x284cc0['limit'],DEFAULT_LLM_LIMIT),_0xa09ea9=await withSpinner('Fetching\x20projects...',()=>_0x3bc464[_0x2a9c9c(0x13f)][_0x2a9c9c(0x1a6)](_0x183586),{'verbose':_0x284cc0[_0x2a9c9c(0x1ca)]});let _0x5225a1=_0xa09ea9['data'];_0xf8d2d7&&(_0x5225a1=_0xa09ea9['data'][_0x2a9c9c(0x1ae)](_0x9b65de=>matchGlobPattern(_0x9b65de[_0x2a9c9c(0x1db)][_0x2a9c9c(0x1af)],_0xf8d2d7)));const _0xb837c8=_0x284cc0[_0x2a9c9c(0x14f)]===_0x2a9c9c(0x183)||_0x284cc0[_0x2a9c9c(0x14f)]==='jsonl'||_0x284cc0[_0x2a9c9c(0x14f)]==='table'||_0x284cc0['format']===_0x2a9c9c(0x134);if(_0xb837c8){const _0xba3e05=_0x5225a1[_0x2a9c9c(0x136)](_0x3fcd85=>({...toLLMProjectInfo(_0x3fcd85),..._0xf95a7e?{'url':getLLMProjectUrl(_0x175066,_0x3fcd85['id'])}:{}}));await handleSDKOutput(_0xba3e05,_0x284cc0);}else{const _0xe925f1=[];if(_0x5225a1['length']===0x0)_0xe925f1[_0x2a9c9c(0x16f)](_0x129b0d[_0x2a9c9c(0x181)](_0x2a9c9c(0x18b)));else{const _0x91b0cf=[..._0x5225a1][_0x2a9c9c(0x193)]((_0x373acc,_0x416409)=>_0x373acc[_0x2a9c9c(0x1db)][_0x2a9c9c(0x1af)]['localeCompare'](_0x416409[_0x2a9c9c(0x1db)][_0x2a9c9c(0x1af)]));for(const _0x491601 of _0x91b0cf){if(_0xf95a7e){const _0x46fc21=getLLMProjectUrl(_0x175066,_0x491601['id']);_0xe925f1[_0x2a9c9c(0x16f)](_0x2a9c9c(0x14d)+_0x491601[_0x2a9c9c(0x1db)][_0x2a9c9c(0x1af)]+'\x20\x20'+_0x129b0d['dim'](_0x46fc21));}else _0xe925f1[_0x2a9c9c(0x16f)](_0x2a9c9c(0x14d)+_0x491601[_0x2a9c9c(0x1db)][_0x2a9c9c(0x1af)]);}_0xe925f1[_0x2a9c9c(0x16f)](_0x129b0d[_0x2a9c9c(0x181)](_0x5225a1[_0x2a9c9c(0x1e9)]+_0x2a9c9c(0x1f7)));}await writeOutput(_0xe925f1[_0x2a9c9c(0x189)]('\x0a'),_0x284cc0[_0x2a9c9c(0x143)],_0x2a9c9c(0x1dc));}return 0x0;}catch(_0x3e777b){return handleSDKError(_0x3e777b,_0x284cc0),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a27_0x243009(0x1af)]=a27_0x243009(0x198);['description']='List\x20agents\x20in\x20current\x20project';async[a27_0x243009(0x155)](_0x4ce5d6){const _0x30e9cf=a27_0x243009,{options:_0x5889e2,args:_0x12877d,tdx:_0x323354}=_0x4ce5d6,_0xfb72bd=getChalk(_0x5889e2),_0x2c87a4=_0x5889e2['web'],_0x2be186=_0x5889e2['site'];try{const _0x3e1e78=_0x12877d[0x0];let _0x264278=_0x3e1e78,_0x3fea29,_0x13d998;if(_0x3e1e78&&_0x3e1e78['includes']('/')){const _0x26d600=_0x3e1e78['split']('/');if(_0x26d600['length']===0x2){const [_0x375429,_0x1c11b8]=_0x26d600,_0x513910=await _0x323354[_0x30e9cf(0x13f)][_0x30e9cf(0x1a6)](),_0x185a6c=_0x513910['find'](_0x9d4c66=>_0x9d4c66[_0x30e9cf(0x1db)][_0x30e9cf(0x1af)]['toLowerCase']()===_0x375429[_0x30e9cf(0x1a2)]());if(!_0x185a6c)throw new SDKError(ErrorCode[_0x30e9cf(0x179)],'Project\x20not\x20found:\x20'+_0x375429,undefined,{'helpText':_0x30e9cf(0x150)});_0x3fea29=_0x185a6c['id'],_0x13d998=_0x185a6c['attributes'][_0x30e9cf(0x1af)],_0x264278=_0x1c11b8;}else throw new SDKError(ErrorCode[_0x30e9cf(0x185)],_0x30e9cf(0x1cb)+_0x3e1e78,undefined,{'helpText':_0x30e9cf(0x172)});}else{const _0x46a0a5=await getProjectWithName(_0x4ce5d6);_0x3fea29=_0x46a0a5['id'],_0x13d998=_0x46a0a5[_0x30e9cf(0x1af)];}const _0x228859=await withSpinner(_0x30e9cf(0x1d1),()=>_0x323354[_0x30e9cf(0x13f)][_0x30e9cf(0x13c)](_0x3fea29),{'verbose':_0x5889e2['verbose']});let _0x14b515=_0x228859[_0x30e9cf(0x1ce)];_0x264278&&(_0x14b515=_0x228859['data'][_0x30e9cf(0x1ae)](_0x13af6f=>matchGlobPattern(_0x13af6f['attributes'][_0x30e9cf(0x1af)],_0x264278)));const _0x33de68=_0x5889e2['format']===_0x30e9cf(0x183)||_0x5889e2['format']===_0x30e9cf(0x1ef)||_0x5889e2[_0x30e9cf(0x14f)]===_0x30e9cf(0x1dc)||_0x5889e2[_0x30e9cf(0x14f)]===_0x30e9cf(0x134);if(_0x33de68){const _0x3618f3=_0x14b515[_0x30e9cf(0x136)](_0x16887c=>({...toAgentInfo(_0x16887c),..._0x2c87a4?{'chatUrl':getLLMAgentChatUrl(_0x2be186,_0x3fea29,_0x16887c['id'])}:{}}));await handleSDKOutput(_0x3618f3,_0x5889e2);}else{const _0xa0fb61=[];_0xa0fb61['push'](_0xfb72bd[_0x30e9cf(0x181)]('['+_0x13d998+']'));if(_0x14b515[_0x30e9cf(0x1e9)]===0x0)_0xa0fb61[_0x30e9cf(0x16f)](_0xfb72bd[_0x30e9cf(0x181)](_0x30e9cf(0x12a)));else{const _0x117925=[..._0x14b515][_0x30e9cf(0x193)]((_0x262ae0,_0x3519d8)=>_0x262ae0[_0x30e9cf(0x1db)]['name'][_0x30e9cf(0x137)](_0x3519d8[_0x30e9cf(0x1db)]['name']));for(const _0x2f6b60 of _0x117925){if(_0x2c87a4){const _0x1100d7=getLLMAgentChatUrl(_0x2be186,_0x3fea29,_0x2f6b60['id']);_0xa0fb61[_0x30e9cf(0x16f)](_0x30e9cf(0x16d)+_0x2f6b60[_0x30e9cf(0x1db)][_0x30e9cf(0x1af)]+'\x20\x20'+_0xfb72bd[_0x30e9cf(0x181)](_0x1100d7));}else _0xa0fb61[_0x30e9cf(0x16f)]('🤖\x20'+_0x2f6b60['attributes']['name']);}_0xa0fb61['push'](_0xfb72bd[_0x30e9cf(0x181)](_0x14b515[_0x30e9cf(0x1e9)]+_0x30e9cf(0x1bf)));}await writeOutput(_0xa0fb61[_0x30e9cf(0x189)]('\x0a'),_0x5889e2['output'],_0x30e9cf(0x1dc));}return 0x0;}catch(_0x187987){return handleSDKError(_0x187987,_0x5889e2),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a27_0x243009(0x1af)]=a27_0x243009(0x1d9);[a27_0x243009(0x17f)]=a27_0x243009(0x182);async[a27_0x243009(0x155)](_0x9501fd){const _0x3612b5=a27_0x243009,{options:_0x2e2cc4,args:_0x4ab725,tdx:_0x331f80}=_0x9501fd;if(_0x4ab725[_0x3612b5(0x1e9)]===0x0)return console['error'](_0x3612b5(0x1f5)),console['error'](_0x3612b5(0x1e4)),0x1;const _0x5768cb=_0x4ab725[0x0];try{const _0x5422f5=await getProjectIdOrDefault(_0x9501fd),_0x587f1c=await withSpinner(_0x3612b5(0x125)+_0x5768cb+_0x3612b5(0x1c0),()=>_0x331f80['llm'][_0x3612b5(0x129)](_0x5768cb,_0x5422f5),{'verbose':_0x2e2cc4[_0x3612b5(0x1ca)]}),_0x1d85f4=await withSpinner('Fetching\x20agent...',()=>_0x331f80[_0x3612b5(0x13f)]['agent'](_0x587f1c[_0x3612b5(0x1ce)]),{'verbose':_0x2e2cc4[_0x3612b5(0x1ca)]});return await handleSDKOutput([_0x1d85f4[_0x3612b5(0x1ce)]],_0x2e2cc4),0x0;}catch(_0x505364){return handleSDKError(_0x505364,_0x2e2cc4),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a27_0x243009(0x1af)]='llm:agent:create';[a27_0x243009(0x17f)]='Create\x20a\x20new\x20agent\x20in\x20current\x20project';async['execute'](_0x1078b7){const _0x35599d=a27_0x243009,{options:_0x25c0b2,args:_0x12f31d,tdx:_0x4ec23f}=_0x1078b7;if(_0x12f31d[_0x35599d(0x1e9)]===0x0)return console['error'](_0x35599d(0x1f5)),console[_0x35599d(0x1ab)](_0x35599d(0x1da)),console['error'](_0x35599d(0x1a7)),0x1;const _0x1f85a0=_0x12f31d[0x0],_0x59ba4d=_0x25c0b2,_0x1daa3b=_0x59ba4d['systemPrompt'],_0x4489c7=_0x59ba4d[_0x35599d(0x1b0)]||_0x35599d(0x15a),_0x29453e=_0x59ba4d[_0x35599d(0x1ba)],_0x387767=_0x59ba4d[_0x35599d(0x1f6)]?Number(_0x59ba4d[_0x35599d(0x1f6)]):undefined,_0x2ab57c=_0x59ba4d['temperature']?Number(_0x59ba4d['temperature']):undefined;try{let _0x57f87b,_0x41fdbf;if(_0x1f85a0[_0x35599d(0x167)]('/')){const _0x1a8beb=_0x1f85a0[_0x35599d(0x173)]('/');if(_0x1a8beb[_0x35599d(0x1e9)]===0x2){const [_0xf177f1,_0x954f25]=_0x1a8beb,_0x340743=await withSpinner(_0x35599d(0x184)+_0xf177f1+_0x35599d(0x1c0),()=>_0x4ec23f[_0x35599d(0x13f)][_0x35599d(0x164)](_0xf177f1),{'verbose':_0x25c0b2[_0x35599d(0x1ca)]});_0x57f87b=_0x340743[_0x35599d(0x1ce)],_0x41fdbf=_0x954f25;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x35599d(0x1cb)+_0x1f85a0,undefined,{'helpText':_0x35599d(0x172)});}else _0x57f87b=await getProjectIdOrDefault(_0x1078b7),_0x41fdbf=_0x1f85a0;const _0x3e3395=await withSpinner(_0x35599d(0x13a)+_0x41fdbf+'\x27...',()=>_0x4ec23f[_0x35599d(0x13f)]['createAgent']({'name':_0x41fdbf,'projectId':_0x57f87b,'modelType':_0x4489c7,'systemPrompt':_0x1daa3b,'starterMessage':_0x29453e,'maxToolIterations':_0x387767,'temperature':_0x2ab57c}),{'verbose':_0x25c0b2[_0x35599d(0x1ca)]});return console[_0x35599d(0x1a3)](_0x35599d(0x142)+_0x3e3395[_0x35599d(0x1ce)]['id']),await handleSDKOutput([_0x3e3395['data']],_0x25c0b2),0x0;}catch(_0x4158b7){return handleSDKError(_0x4158b7,_0x25c0b2),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a27_0x243009(0x1af)]=a27_0x243009(0x166);[a27_0x243009(0x17f)]=a27_0x243009(0x1c6);async['execute'](_0x595570){const _0x32d9f0=a27_0x243009,{options:_0x11ee0e,args:_0x52f2f9,tdx:_0x384e35}=_0x595570;if(_0x52f2f9[_0x32d9f0(0x1e9)]===0x0)return console['error'](_0x32d9f0(0x1f5)),console[_0x32d9f0(0x1ab)](_0x32d9f0(0x1dd)),0x1;const _0x55e4ce=_0x52f2f9[0x0],_0x49e521=_0x11ee0e,_0x3a6714=_0x49e521[_0x32d9f0(0x1af)],_0xa3e533=_0x49e521[_0x32d9f0(0x17e)],_0x125181=_0x49e521['description'],_0x8b5a53=_0x49e521[_0x32d9f0(0x1ba)];if(!_0x3a6714&&!_0xa3e533&&!_0x125181&&!_0x8b5a53)return console[_0x32d9f0(0x1ab)](_0x32d9f0(0x141)),console[_0x32d9f0(0x1ab)](_0x32d9f0(0x169)),0x1;try{const _0x2719ba=await getProjectIdOrDefault(_0x595570),_0xdb47e3=await withSpinner('Resolving\x20agent\x20\x27'+_0x55e4ce+_0x32d9f0(0x1c0),()=>_0x384e35[_0x32d9f0(0x13f)][_0x32d9f0(0x129)](_0x55e4ce,_0x2719ba),{'verbose':_0x11ee0e[_0x32d9f0(0x1ca)]}),_0x496fbb=_0xdb47e3[_0x32d9f0(0x1ce)],_0x49e73c=await withSpinner(_0x32d9f0(0x127),()=>_0x384e35['llm']['updateAgent'](_0x496fbb,{'name':_0x3a6714,'prompt':_0xa3e533,'description':_0x125181,'starterMessage':_0x8b5a53}),{'verbose':_0x11ee0e['verbose']});return console[_0x32d9f0(0x1a3)](_0x32d9f0(0x1e5)+_0x49e73c[_0x32d9f0(0x1ce)]['id']),await handleSDKOutput([_0x49e73c[_0x32d9f0(0x1ce)]],_0x11ee0e),0x0;}catch(_0x3b03d6){return handleSDKError(_0x3b03d6,_0x11ee0e),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a27_0x243009(0x1af)]=a27_0x243009(0x1c9);[a27_0x243009(0x17f)]='Delete\x20an\x20agent';async[a27_0x243009(0x155)](_0x3ea2a2){const _0x5e0709=a27_0x243009,{options:_0x1fbd30,args:_0x558963,tdx:_0x122295}=_0x3ea2a2;if(_0x558963[_0x5e0709(0x1e9)]===0x0)return console[_0x5e0709(0x1ab)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x5e0709(0x1ab)](_0x5e0709(0x138)),0x1;const _0x1cfd79=_0x558963[0x0];try{const _0x4a735a=await getProjectIdOrDefault(_0x3ea2a2),_0x127acc=await withSpinner(_0x5e0709(0x125)+_0x1cfd79+_0x5e0709(0x1c0),()=>_0x122295[_0x5e0709(0x13f)]['resolveAgentId'](_0x1cfd79,_0x4a735a),{'verbose':_0x1fbd30['verbose']}),_0x485ca5=_0x127acc[_0x5e0709(0x1ce)];return await withSpinner(_0x5e0709(0x144),()=>_0x122295['llm'][_0x5e0709(0x19b)](_0x485ca5),{'verbose':_0x1fbd30[_0x5e0709(0x1ca)]}),console[_0x5e0709(0x1a3)](_0x5e0709(0x14a)+_0x485ca5),0x0;}catch(_0x3d5e41){return handleSDKError(_0x3d5e41,_0x1fbd30),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a27_0x243009(0x1af)]=a27_0x243009(0x146);[a27_0x243009(0x17f)]=a27_0x243009(0x18f);async[a27_0x243009(0x155)](_0x310a31){const _0x13c45f=a27_0x243009;return executeChatHistoryCommand(_0x310a31,_0x13c45f(0x13d));}}export class LLMUseCommand extends BaseCommand{[a27_0x243009(0x1af)]=a27_0x243009(0x1d4);[a27_0x243009(0x17f)]=a27_0x243009(0x1ad);async['execute'](_0x203087){const _0x65aaf6=a27_0x243009,{options:_0x283bd7,args:_0x4ea2ea,tdx:_0x49a605}=_0x203087;if(_0x4ea2ea[_0x65aaf6(0x1e9)]===0x0)return console['error'](_0x65aaf6(0x19d)),console[_0x65aaf6(0x1ab)](_0x65aaf6(0x1e2)),0x1;const _0x3e564b=_0x4ea2ea[0x0];try{return await withSpinner('Setting\x20project\x20context\x20to\x20\x27'+_0x3e564b+_0x65aaf6(0x1c0),()=>_0x49a605[_0x65aaf6(0x13f)]['setCurrentProject'](_0x3e564b),{'verbose':_0x283bd7[_0x65aaf6(0x1ca)]}),console[_0x65aaf6(0x1a3)](_0x65aaf6(0x135)+_0x3e564b),0x0;}catch(_0xc73f22){return handleSDKError(_0xc73f22,_0x283bd7),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a27_0x243009(0x1af)]=a27_0x243009(0x16e);[a27_0x243009(0x17f)]=a27_0x243009(0x1d6);async[a27_0x243009(0x155)](_0x14f910){const _0xfea4e1=a27_0x243009,{options:_0x3511cb,args:_0xb878e4,tdx:_0x23d5a2}=_0x14f910;if(_0xb878e4[_0xfea4e1(0x1e9)]===0x0)return console['error'](_0xfea4e1(0x19d)),console['error'](_0xfea4e1(0x12d)),0x1;const _0x719408=_0xb878e4[0x0],_0x43f438=_0x3511cb,_0x52c7d9=_0x43f438[_0xfea4e1(0x17f)];try{const _0x78c4e5=await withSpinner(_0xfea4e1(0x178)+_0x719408+_0xfea4e1(0x1c0),()=>_0x23d5a2['llm'][_0xfea4e1(0x15e)]({'name':_0x719408,'description':_0x52c7d9}),{'verbose':_0x3511cb['verbose']});console['log'](_0xfea4e1(0x140)+_0x78c4e5[_0xfea4e1(0x1ce)]['id']);const _0x39aeca=toLLMProjectInfo(_0x78c4e5['data']);return await handleSDKOutput([_0x39aeca],_0x3511cb),0x0;}catch(_0x201cc7){return handleSDKError(_0x201cc7,_0x3511cb),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a27_0x243009(0x1af)]=a27_0x243009(0x128);[a27_0x243009(0x17f)]='Delete\x20an\x20LLM\x20project';async['execute'](_0xbaa1b8){const _0x262e39=a27_0x243009,{options:_0xad668b,args:_0x564f43,tdx:_0x492323}=_0xbaa1b8;if(_0x564f43[_0x262e39(0x1e9)]===0x0)return console[_0x262e39(0x1ab)](_0x262e39(0x19d)),console[_0x262e39(0x1ab)](_0x262e39(0x1b9)),0x1;const _0x4df6a5=_0x564f43[0x0];try{return await withSpinner(_0x262e39(0x1f3)+_0x4df6a5+_0x262e39(0x1c0),()=>_0x492323[_0x262e39(0x13f)][_0x262e39(0x1cd)](_0x4df6a5),{'verbose':_0xad668b[_0x262e39(0x1ca)]}),console[_0x262e39(0x1a3)](_0x262e39(0x132)+_0x4df6a5),0x0;}catch(_0x2074d3){return handleSDKError(_0x2074d3,_0xad668b),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a27_0x243009(0x1af)]=a27_0x243009(0x133);[a27_0x243009(0x17f)]=a27_0x243009(0x1a0);async['execute'](_0x4dd2e3){const _0x1c3853=a27_0x243009,{options:_0x1be21e,args:_0x1a70df,tdx:_0x1f509c}=_0x4dd2e3,_0x3ce2e0=getChalk(_0x1be21e);console[_0x1c3853(0x1a3)](_0x3ce2e0[_0x1c3853(0x1eb)](_0x1c3853(0x17b))),console[_0x1c3853(0x1a3)](_0x3ce2e0[_0x1c3853(0x1eb)](_0x1c3853(0x1e7))),console[_0x1c3853(0x1a3)](_0x3ce2e0[_0x1c3853(0x181)]('\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents')),console['log']();if(_0x1a70df[_0x1c3853(0x1e9)]===0x0)return console['error']('Error:\x20Project\x20name\x20is\x20required'),console[_0x1c3853(0x1ab)](_0x1c3853(0x1cc)),0x1;const _0x663614=_0x1a70df[0x0],_0x833522=_0x1be21e,_0x5d01a3=_0x833522[_0x1c3853(0x143)],_0xc0d35c=_0x833522['dryRun'];try{const _0x4d04fe=_0x5d01a3||_0x663614+'.llm';if(a27_0x481419[_0x1c3853(0x124)](_0x4d04fe)&&!_0xc0d35c){if(!_0x1be21e['yes']){const _0x44adce=await confirm(_0x1c3853(0x199)+_0x4d04fe+_0x1c3853(0x1e6));if(!_0x44adce)return console[_0x1c3853(0x1a3)](_0x1c3853(0x15b)),0x0;}a27_0x481419[_0x1c3853(0x1ec)](_0x4d04fe,{'recursive':!![]});}const _0xfd2b3b=await withSpinner(_0xc0d35c?'Analyzing\x20project\x20\x27'+_0x663614+_0x1c3853(0x1c0):_0x1c3853(0x1f4)+_0x663614+_0x1c3853(0x1c0),()=>_0x1f509c['llm'][_0x1c3853(0x1d5)](_0x663614,_0x5d01a3,{'dryRun':_0xc0d35c}),{'verbose':_0x1be21e[_0x1c3853(0x1ca)]}),_0xccd776=_0xfd2b3b['data'];return _0xc0d35c?console[_0x1c3853(0x1a3)]('[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20'+_0xccd776[_0x1c3853(0x1de)]):console['log'](_0x1c3853(0x1b8)+_0xccd776[_0x1c3853(0x1de)]),console[_0x1c3853(0x1a3)](_0x1c3853(0x1cf)+_0xccd776[_0x1c3853(0x19c)][_0x1c3853(0x13c)]),console[_0x1c3853(0x1a3)](_0x1c3853(0x1bd)+_0xccd776[_0x1c3853(0x19c)][_0x1c3853(0x186)]),console[_0x1c3853(0x1a3)](_0x1c3853(0x14e)+_0xccd776[_0x1c3853(0x19c)]['prompts']),console[_0x1c3853(0x1a3)]('\x20\x20Integrations:\x20'+_0xccd776[_0x1c3853(0x19c)][_0x1c3853(0x145)]),(_0x1be21e['format']==='json'||_0x1be21e['format']===_0x1c3853(0x1ef))&&await handleSDKOutput([_0xccd776],_0x1be21e),0x0;}catch(_0x227b81){return handleSDKError(_0x227b81,_0x1be21e),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a27_0x243009(0x1af)]='llm:project:restore';['description']='Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)';async[a27_0x243009(0x155)](_0x327f8d){const _0x449424=a27_0x243009,{options:_0x510e22,args:_0x530307,tdx:_0x58a9ef}=_0x327f8d,_0x28e1d9=getChalk(_0x510e22);console['log'](_0x28e1d9[_0x449424(0x1eb)](_0x449424(0x1f8))),console[_0x449424(0x1a3)](_0x28e1d9[_0x449424(0x1eb)]('\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.')),console[_0x449424(0x1a3)](_0x28e1d9[_0x449424(0x181)]('\x20\x20\x20Examples:')),console[_0x449424(0x1a3)](_0x28e1d9[_0x449424(0x181)](_0x449424(0x1ea))),console[_0x449424(0x1a3)](_0x28e1d9['dim'](_0x449424(0x1c2))),console[_0x449424(0x1a3)]();if(_0x530307[_0x449424(0x1e9)]===0x0)return console[_0x449424(0x1ab)](_0x449424(0x18a)),console[_0x449424(0x1ab)](_0x449424(0x18d)),0x1;const _0xf5f6d9=_0x530307[0x0],_0x2d1cdc=_0x510e22,_0x28f737=_0x2d1cdc[_0x449424(0x1af)],_0x20d608=_0x2d1cdc[_0x449424(0x1df)];try{if(!_0x20d608){const _0x1a4155=_0x58a9ef[_0x449424(0x13f)][_0x449424(0x194)](_0xf5f6d9),_0x36800f=_0x28f737||_0x1a4155[_0x449424(0x14b)][_0x449424(0x12f)],_0x5c212e=await withSpinner(_0x449424(0x13e),()=>_0x58a9ef['llm'][_0x449424(0x1a6)](),{'verbose':_0x510e22[_0x449424(0x1ca)]}),_0x3408ac=_0x5c212e[_0x449424(0x1ce)][_0x449424(0x1f0)](_0x2d0c26=>_0x2d0c26['attributes'][_0x449424(0x1af)]===_0x36800f);if(_0x3408ac&&!_0x510e22[_0x449424(0x176)]){const _0xc3c069=await confirm('A\x20project\x20named\x20\x27'+_0x36800f+'\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?');if(!_0xc3c069)return console[_0x449424(0x1a3)]('Restore\x20cancelled.'),0x0;}}const _0x394e5c=await withSpinner(_0x20d608?_0x449424(0x191)+_0xf5f6d9+'\x27...':_0x449424(0x1d8)+_0xf5f6d9+_0x449424(0x1c0),()=>_0x58a9ef[_0x449424(0x13f)][_0x449424(0x19e)](_0xf5f6d9,{'name':_0x28f737,'dryRun':_0x20d608}),{'verbose':_0x510e22['verbose']}),_0x2c26aa=_0x394e5c['data'];return _0x2c26aa[_0x449424(0x15f)]&&console['log'](_0x449424(0x1b4)+_0x2c26aa[_0x449424(0x15f)]+'\x27'),_0x20d608?console[_0x449424(0x1a3)]('[DRY\x20RUN]\x20Would\x20restore\x20project:\x20'+_0x2c26aa[_0x449424(0x12f)]):console[_0x449424(0x1a3)]('Project\x20restored:\x20'+_0x2c26aa[_0x449424(0x12f)]+'\x20('+_0x2c26aa['projectId']+')'),console[_0x449424(0x1a3)](_0x449424(0x1cf)+_0x2c26aa[_0x449424(0x19c)][_0x449424(0x13c)]),console[_0x449424(0x1a3)]('\x20\x20Knowledge\x20Bases:\x20'+_0x2c26aa[_0x449424(0x19c)][_0x449424(0x186)]),console[_0x449424(0x1a3)]('\x20\x20Prompts:\x20'+_0x2c26aa[_0x449424(0x19c)][_0x449424(0x196)]),console[_0x449424(0x1a3)](_0x449424(0x1a1)+_0x2c26aa[_0x449424(0x19c)][_0x449424(0x145)]),(_0x510e22[_0x449424(0x14f)]===_0x449424(0x183)||_0x510e22['format']===_0x449424(0x1ef))&&await handleSDKOutput([_0x2c26aa],_0x510e22),0x0;}catch(_0x103e32){return handleSDKError(_0x103e32,_0x510e22),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x4fad28,_0xcc12fe){const _0x43ffdf=a27_0x243009,_0x8fd14=_0xcc12fe[_0x43ffdf(0x1d7)]||CHAT_SELECTOR_PAGE_SIZE;let _0x583625=0x0,_0x3352a0=[];const _0x1c2352=(await import('prompts'))[_0x43ffdf(0x1d2)],_0x12a2a9=getChalk(_0xcc12fe);while(!![]){const _0x23fbaa=await withSpinner(_0x43ffdf(0x14c),()=>_0x4fad28[_0x43ffdf(0x13f)][_0x43ffdf(0x187)](_0x8fd14+_0x583625),{'verbose':_0xcc12fe[_0x43ffdf(0x1ca)]});_0x3352a0=_0x23fbaa[_0x43ffdf(0x1ce)];const _0x4b299a=_0x3352a0[_0x43ffdf(0x16b)](_0x583625,_0x583625+_0x8fd14),_0x545b6d=_0x3352a0['length']>_0x583625+_0x8fd14,_0x3c7d08=[...new Set(_0x4b299a[_0x43ffdf(0x136)](_0xc1a8c2=>_0xc1a8c2['attributes'][_0x43ffdf(0x195)])[_0x43ffdf(0x1ae)](_0x46b4ca=>_0x46b4ca!==undefined))],_0x193056=new Map();await Promise['all'](_0x3c7d08[_0x43ffdf(0x136)](async _0x2eb4f2=>{const _0x3f167c=_0x43ffdf;try{const _0x54567f=await _0x4fad28[_0x3f167c(0x13f)][_0x3f167c(0x13b)](_0x2eb4f2);_0x193056['set'](_0x2eb4f2,_0x54567f[_0x3f167c(0x1db)]['name']);}catch{_0x193056[_0x3f167c(0x18e)](_0x2eb4f2,_0x2eb4f2);}}));const _0x451653=_0x4b299a[_0x43ffdf(0x136)](_0x2be538=>{const _0x58c48d=_0x43ffdf,_0x1ec1e2=_0x2be538['attributes'][_0x58c48d(0x197)]||'(no\x20message)',_0xe6cf45=_0x1ec1e2[_0x58c48d(0x173)]('\x0a')[0x0],_0x480f3d=_0xe6cf45[_0x58c48d(0x1e9)]>0x50?_0xe6cf45['substring'](0x0,0x4d)+_0x58c48d(0x16a):_0xe6cf45,_0x2a2827=_0x2be538[_0x58c48d(0x1db)][_0x58c48d(0x195)]?_0x193056['get'](_0x2be538[_0x58c48d(0x1db)][_0x58c48d(0x195)])||_0x2be538['attributes'][_0x58c48d(0x195)]:_0x58c48d(0x148),_0x38fde8=_0x2be538[_0x58c48d(0x1db)][_0x58c48d(0x1c1)]||_0x2be538[_0x58c48d(0x1db)]['updatedAt'],_0x961946=new Date(_0x38fde8),_0x353f34=new Date(),_0x51bc79=_0x353f34[_0x58c48d(0x149)]()-_0x961946['getTime'](),_0x166b0b=Math['floor'](_0x51bc79/0xea60),_0x25e18a=Math['floor'](_0x51bc79/0x36ee80),_0x1c8837=Math[_0x58c48d(0x170)](_0x51bc79/0x5265c00);let _0x26b246;if(_0x166b0b<0x1)_0x26b246='just\x20now';else{if(_0x166b0b<0x3c)_0x26b246=_0x166b0b+_0x58c48d(0x160);else{if(_0x25e18a<0x18)_0x26b246=_0x25e18a+'h\x20ago';else _0x1c8837<0x7?_0x26b246=_0x1c8837+_0x58c48d(0x1bb):_0x26b246=_0x961946[_0x58c48d(0x168)](_0x58c48d(0x19f),{'month':_0x58c48d(0x147),'day':'numeric'});}}return{'title':_0x480f3d+'\x20'+_0x12a2a9[_0x58c48d(0x181)]('['+_0x2a2827+']\x20'+_0x26b246),'value':_0x2be538['id']};});_0x545b6d&&_0x451653['push']({'title':_0x12a2a9['cyan']('Load\x20more...'),'value':_0x43ffdf(0x180)});const _0x44b03b=await _0x1c2352({'type':_0x43ffdf(0x161),'name':_0x43ffdf(0x1b7),'message':_0x43ffdf(0x1c3),'choices':_0x451653,'hint':_0x43ffdf(0x17c)});if(!_0x44b03b['chatId'])return undefined;if(_0x44b03b[_0x43ffdf(0x1b7)]===_0x43ffdf(0x180)){_0x583625+=_0x8fd14;continue;}return _0x44b03b[_0x43ffdf(0x1b7)];}}export class ChatsCommand extends BaseCommand{[a27_0x243009(0x1af)]=a27_0x243009(0x187);[a27_0x243009(0x17f)]='Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history';async[a27_0x243009(0x155)](_0x24367d){const _0x329ff0=a27_0x243009;return executeChatHistoryCommand(_0x24367d,_0x329ff0(0x139));}}
@@ -1 +1 @@
1
- function a28_0x5987(){const _0x268840=['\x0aTesting\x20with\x20Agent\x20SDK:','white','init','http://0.0.0.0:','server','1024227jVwWqC','Project\x20\x27','267592GqfFSF','\x20\x20\x20\x20}','llmProject','green','189ywAWBM','projects','yellow','logger','name','444RrAskF','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','\x20\x20Agents:','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','\x20\x20{','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','\x20\x20Site:','close','Server\x20Configuration:','1051338pTXuiY','7GlrWmf','\x20\x20\x20\x20\x22env\x22:\x20{','\x20\x20Project:','214342AWVCTW','\x0a\x0aShutting\x20down\x20proxy\x20server...','\x20\x20}','SIGTERM','description','site','Starting\x20proxy\x20server...','NOT_FOUND','logLevel','50270djXyzm','bold','llm','exit','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','attributes','project','Port\x20','getOrCreateDefaultProject','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','start','llm:proxy','stop','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','3iFiFIG','26139817SYBzuG','find','cyan','✓\x20Proxy\x20server\x20stopped','created\x20on-demand\x20per\x20model','log','39385kojqtg','\x0aClaude\x20Code\x20Configuration:','port','dim','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','\x27\x20not\x20found'];a28_0x5987=function(){return _0x268840;};return a28_0x5987();}const a28_0x4c10d6=a28_0x225d;(function(_0x20b9b8,_0xa45ee2){const _0x33b07c=a28_0x225d,_0x4db19b=_0x20b9b8();while(!![]){try{const _0x21eaca=-parseInt(_0x33b07c(0x115))/0x1*(parseInt(_0x33b07c(0x141))/0x2)+-parseInt(_0x33b07c(0x128))/0x3+-parseInt(_0x33b07c(0x133))/0x4*(parseInt(_0x33b07c(0x11c))/0x5)+-parseInt(_0x33b07c(0x13d))/0x6+parseInt(_0x33b07c(0x13e))/0x7*(-parseInt(_0x33b07c(0x12a))/0x8)+parseInt(_0x33b07c(0x12e))/0x9*(-parseInt(_0x33b07c(0x107))/0xa)+parseInt(_0x33b07c(0x116))/0xb;if(_0x21eaca===_0xa45ee2)break;else _0x4db19b['push'](_0x4db19b['shift']());}catch(_0x5699e6){_0x4db19b['push'](_0x4db19b['shift']());}}}(a28_0x5987,0x80227));import a28_0x450b58 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';function a28_0x225d(_0x5b0810,_0x52123a){_0x5b0810=_0x5b0810-0x104;const _0x5987a0=a28_0x5987();let _0x225dec=_0x5987a0[_0x5b0810];return _0x225dec;}import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x401cd4,_0x1ddb55){const _0x5cee3c=a28_0x225d,{tdx:_0x5b4d51,options:_0x612619}=_0x401cd4,_0x459118=_0x1ddb55||_0x612619[_0x5cee3c(0x12c)];if(_0x459118){const _0x453469=await _0x5b4d51[_0x5cee3c(0x109)][_0x5cee3c(0x12f)](),_0x2cbd67=_0x453469[_0x5cee3c(0x117)](_0x4bbbc2=>_0x4bbbc2['attributes'][_0x5cee3c(0x132)]===_0x459118);if(!_0x2cbd67)throw new SDKError(ErrorCode[_0x5cee3c(0x105)],_0x5cee3c(0x129)+_0x459118+_0x5cee3c(0x122),undefined,{'helpText':_0x5cee3c(0x110)});return _0x2cbd67['id'];}const _0x3e8d9a=await _0x5b4d51[_0x5cee3c(0x109)][_0x5cee3c(0x10f)]();return _0x3e8d9a['id'];}export class LLMProxyCommand extends BaseCommand{[a28_0x4c10d6(0x132)]=a28_0x4c10d6(0x112);[a28_0x4c10d6(0x145)]='[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration';[a28_0x4c10d6(0x127)];[a28_0x4c10d6(0x131)];async['execute'](_0x44b812){const _0x1a2046=a28_0x4c10d6,{tdx:_0x152ac,options:_0x598a4e}=_0x44b812;try{const _0x49c08e=_0x598a4e,_0xc7fe2e=_0x49c08e[_0x1a2046(0x11e)]||0xfa0,_0x7d80b8=_0x49c08e[_0x1a2046(0x10d)],_0x309d81=await findAvailablePort(_0xc7fe2e);console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x11f)]('Resolving\x20project...'));const _0x87808d=await getProjectIdOrDefault(_0x44b812,_0x7d80b8),_0x57107e=await _0x152ac[_0x1a2046(0x109)][_0x1a2046(0x12f)](),_0x5a7508=_0x57107e['find'](_0x34da61=>_0x34da61['id']===_0x87808d);this[_0x1a2046(0x131)]=new TDXLogger(_0x598a4e[_0x1a2046(0x106)]),await this[_0x1a2046(0x131)][_0x1a2046(0x125)](),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x11f)](_0x1a2046(0x104)));_0x309d81!==_0xc7fe2e&&console[_0x1a2046(0x11b)](a28_0x450b58['yellow'](_0x1a2046(0x10e)+_0xc7fe2e+'\x20is\x20unavailable,\x20using\x20port\x20'+_0x309d81));this[_0x1a2046(0x127)]=new ProxyServer({'port':_0x309d81,'projectId':_0x87808d,'tdx':_0x152ac,'logger':this[_0x1a2046(0x131)],'site':_0x598a4e[_0x1a2046(0x146)]}),await this['server'][_0x1a2046(0x111)](),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x130)]['bold'](_0x1a2046(0x120))),console[_0x1a2046(0x11b)](a28_0x450b58['yellow']('This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.')),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x130)](_0x1a2046(0x136))),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x12d)][_0x1a2046(0x108)](_0x1a2046(0x134))),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x118)](_0x1a2046(0x13c))),console[_0x1a2046(0x11b)](a28_0x450b58['dim']('\x20\x20Address:'),a28_0x450b58[_0x1a2046(0x124)](_0x1a2046(0x126)+_0x309d81)),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x11f)](_0x1a2046(0x140)),a28_0x450b58['white'](_0x5a7508?.[_0x1a2046(0x10c)][_0x1a2046(0x132)]||_0x87808d)),console[_0x1a2046(0x11b)](a28_0x450b58['dim'](_0x1a2046(0x135)),a28_0x450b58[_0x1a2046(0x124)](_0x1a2046(0x11a))),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x11f)](_0x1a2046(0x13a)),a28_0x450b58[_0x1a2046(0x124)](_0x598a4e[_0x1a2046(0x146)])),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x118)](_0x1a2046(0x11d))),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x11f)](_0x1a2046(0x138))),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x124)](_0x1a2046(0x137))),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x124)](_0x1a2046(0x13f))),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x124)]('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:'+_0x309d81+'\x22,')),console[_0x1a2046(0x11b)](a28_0x450b58['white'](_0x1a2046(0x139))),console['log'](a28_0x450b58['white'](_0x1a2046(0x114))),console[_0x1a2046(0x11b)](a28_0x450b58['white'](_0x1a2046(0x12b))),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x124)](_0x1a2046(0x143))),console[_0x1a2046(0x11b)](a28_0x450b58['cyan'](_0x1a2046(0x123))),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x11f)](_0x1a2046(0x121))),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x11f)]('\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript')),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x11f)]('\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a')),console[_0x1a2046(0x11b)](a28_0x450b58[_0x1a2046(0x130)](_0x1a2046(0x10b)));const _0x5f3454=async()=>{const _0x268760=_0x1a2046;console[_0x268760(0x11b)](a28_0x450b58['dim'](_0x268760(0x142))),this['server']&&await this[_0x268760(0x127)][_0x268760(0x113)](),this[_0x268760(0x131)]&&await this[_0x268760(0x131)][_0x268760(0x13b)](),console[_0x268760(0x11b)](a28_0x450b58[_0x268760(0x12d)](_0x268760(0x119))),process[_0x268760(0x10a)](0x0);};return process['on']('SIGINT',_0x5f3454),process['on'](_0x1a2046(0x144),_0x5f3454),await new Promise(()=>{}),0x0;}catch(_0x568bb8){this['server']&&await this[_0x1a2046(0x127)][_0x1a2046(0x113)]();this[_0x1a2046(0x131)]&&await this['logger'][_0x1a2046(0x13b)]();throw _0x568bb8;}}}
1
+ const a28_0x21f8a3=a28_0x265b;(function(_0x2a4024,_0x49b24d){const _0x2b56e8=a28_0x265b,_0x51b054=_0x2a4024();while(!![]){try{const _0x49c014=-parseInt(_0x2b56e8(0x197))/0x1*(-parseInt(_0x2b56e8(0x1aa))/0x2)+-parseInt(_0x2b56e8(0x1b0))/0x3+parseInt(_0x2b56e8(0x18c))/0x4*(parseInt(_0x2b56e8(0x181))/0x5)+-parseInt(_0x2b56e8(0x17a))/0x6*(-parseInt(_0x2b56e8(0x189))/0x7)+parseInt(_0x2b56e8(0x1ad))/0x8*(parseInt(_0x2b56e8(0x1a4))/0x9)+-parseInt(_0x2b56e8(0x1ac))/0xa+parseInt(_0x2b56e8(0x1a2))/0xb*(-parseInt(_0x2b56e8(0x194))/0xc);if(_0x49c014===_0x49b24d)break;else _0x51b054['push'](_0x51b054['shift']());}catch(_0x3385d7){_0x51b054['push'](_0x51b054['shift']());}}}(a28_0x36d4,0xa82c4));import a28_0x1ecd79 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x1775d3,_0x572435){const _0x6a1a8d=a28_0x265b,{tdx:_0x2b24c8,options:_0x5cfa3c}=_0x1775d3,_0x44abac=_0x572435||_0x5cfa3c[_0x6a1a8d(0x193)];if(_0x44abac){const _0x159d14=await _0x2b24c8[_0x6a1a8d(0x185)][_0x6a1a8d(0x180)](),_0x59136f=_0x159d14[_0x6a1a8d(0x1a6)](_0x33e5b8=>_0x33e5b8[_0x6a1a8d(0x19c)]['name']===_0x44abac);if(!_0x59136f)throw new SDKError(ErrorCode['NOT_FOUND'],_0x6a1a8d(0x1b2)+_0x44abac+'\x27\x20not\x20found',undefined,{'helpText':_0x6a1a8d(0x195)});return _0x59136f['id'];}const _0xa0defd=await _0x2b24c8[_0x6a1a8d(0x185)]['getOrCreateDefaultProject']();return _0xa0defd['id'];}function a28_0x265b(_0x57ef1a,_0x52ed40){_0x57ef1a=_0x57ef1a-0x179;const _0x36d4f9=a28_0x36d4();let _0x265bdf=_0x36d4f9[_0x57ef1a];return _0x265bdf;}function a28_0x36d4(){const _0x2e3a6e=['23540AHeiqV','name','project','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','\x0aTesting\x20with\x20Agent\x20SDK:','attributes','close','\x20\x20Address:','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','init','llm:proxy','4609SvyPWq','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','30258BcyKNH','\x0a\x0aShutting\x20down\x20proxy\x20server...','find','✓\x20Proxy\x20server\x20stopped','port','SIGINT','94PAEQlV','cyan','327660MwhnsO','768AuKmAl','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','\x20\x20Site:','3879285tQtwlh','server','Project\x20\x27','created\x20on-demand\x20per\x20model','18yvWHyD','site','dim','\x0aClaude\x20Code\x20Configuration:','white','log','projects','45MjqbQg','Port\x20','Resolving\x20project...','logger','llm','\x20\x20{','yellow','description','2328172RsIySg','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','execute','515868EnjAAE','green','bold','\x20is\x20unavailable,\x20using\x20port\x20','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','\x20\x20Project:','exit','llmProject','45048VLqDvI','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','\x20\x20\x20\x20}'];a28_0x36d4=function(){return _0x2e3a6e;};return a28_0x36d4();}export class LLMProxyCommand extends BaseCommand{[a28_0x21f8a3(0x198)]=a28_0x21f8a3(0x1a1);[a28_0x21f8a3(0x188)]='[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration';[a28_0x21f8a3(0x1b1)];[a28_0x21f8a3(0x184)];async[a28_0x21f8a3(0x18b)](_0x2613db){const _0x42397c=a28_0x21f8a3,{tdx:_0x1efe6f,options:_0x1f3153}=_0x2613db;try{const _0x5d3c11=_0x1f3153,_0x18adb2=_0x5d3c11[_0x42397c(0x1a8)]||0xfa0,_0x41b5a6=_0x5d3c11[_0x42397c(0x199)],_0x439899=await findAvailablePort(_0x18adb2);console['log'](a28_0x1ecd79[_0x42397c(0x17c)](_0x42397c(0x183)));const _0x448b1c=await getProjectIdOrDefault(_0x2613db,_0x41b5a6),_0x31824c=await _0x1efe6f['llm'][_0x42397c(0x180)](),_0x2c3cb4=_0x31824c['find'](_0x197037=>_0x197037['id']===_0x448b1c);this['logger']=new TDXLogger(_0x1f3153['logLevel']),await this[_0x42397c(0x184)][_0x42397c(0x1a0)](),console[_0x42397c(0x17f)](a28_0x1ecd79[_0x42397c(0x17c)]('Starting\x20proxy\x20server...'));_0x439899!==_0x18adb2&&console[_0x42397c(0x17f)](a28_0x1ecd79[_0x42397c(0x187)](_0x42397c(0x182)+_0x18adb2+_0x42397c(0x18f)+_0x439899));this[_0x42397c(0x1b1)]=new ProxyServer({'port':_0x439899,'projectId':_0x448b1c,'tdx':_0x1efe6f,'logger':this[_0x42397c(0x184)],'site':_0x1f3153[_0x42397c(0x17b)]}),await this[_0x42397c(0x1b1)]['start'](),console[_0x42397c(0x17f)](a28_0x1ecd79[_0x42397c(0x187)][_0x42397c(0x18e)](_0x42397c(0x18a))),console[_0x42397c(0x17f)](a28_0x1ecd79[_0x42397c(0x187)](_0x42397c(0x19a))),console[_0x42397c(0x17f)](a28_0x1ecd79[_0x42397c(0x187)](_0x42397c(0x1a3))),console[_0x42397c(0x17f)](a28_0x1ecd79['green']['bold'](_0x42397c(0x1ae))),console[_0x42397c(0x17f)](a28_0x1ecd79[_0x42397c(0x1ab)]('Server\x20Configuration:')),console[_0x42397c(0x17f)](a28_0x1ecd79[_0x42397c(0x17c)](_0x42397c(0x19e)),a28_0x1ecd79[_0x42397c(0x17e)]('http://0.0.0.0:'+_0x439899)),console[_0x42397c(0x17f)](a28_0x1ecd79['dim'](_0x42397c(0x191)),a28_0x1ecd79[_0x42397c(0x17e)](_0x2c3cb4?.[_0x42397c(0x19c)]['name']||_0x448b1c)),console['log'](a28_0x1ecd79['dim']('\x20\x20Agents:'),a28_0x1ecd79[_0x42397c(0x17e)](_0x42397c(0x179))),console[_0x42397c(0x17f)](a28_0x1ecd79[_0x42397c(0x17c)](_0x42397c(0x1af)),a28_0x1ecd79[_0x42397c(0x17e)](_0x1f3153[_0x42397c(0x17b)])),console[_0x42397c(0x17f)](a28_0x1ecd79[_0x42397c(0x1ab)](_0x42397c(0x17d))),console['log'](a28_0x1ecd79[_0x42397c(0x17c)]('\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a')),console[_0x42397c(0x17f)](a28_0x1ecd79['white'](_0x42397c(0x186))),console[_0x42397c(0x17f)](a28_0x1ecd79['white']('\x20\x20\x20\x20\x22env\x22:\x20{')),console['log'](a28_0x1ecd79[_0x42397c(0x17e)]('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:'+_0x439899+'\x22,')),console[_0x42397c(0x17f)](a28_0x1ecd79[_0x42397c(0x17e)]('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,')),console['log'](a28_0x1ecd79[_0x42397c(0x17e)](_0x42397c(0x19f))),console[_0x42397c(0x17f)](a28_0x1ecd79[_0x42397c(0x17e)](_0x42397c(0x196))),console[_0x42397c(0x17f)](a28_0x1ecd79[_0x42397c(0x17e)]('\x20\x20}')),console[_0x42397c(0x17f)](a28_0x1ecd79[_0x42397c(0x1ab)](_0x42397c(0x19b))),console[_0x42397c(0x17f)](a28_0x1ecd79[_0x42397c(0x17c)]('\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK')),console[_0x42397c(0x17f)](a28_0x1ecd79[_0x42397c(0x17c)]('\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript')),console[_0x42397c(0x17f)](a28_0x1ecd79[_0x42397c(0x17c)](_0x42397c(0x190))),console['log'](a28_0x1ecd79[_0x42397c(0x187)]('Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a'));const _0x3d4b8b=async()=>{const _0x3b29a9=_0x42397c;console[_0x3b29a9(0x17f)](a28_0x1ecd79[_0x3b29a9(0x17c)](_0x3b29a9(0x1a5))),this[_0x3b29a9(0x1b1)]&&await this[_0x3b29a9(0x1b1)]['stop'](),this[_0x3b29a9(0x184)]&&await this[_0x3b29a9(0x184)][_0x3b29a9(0x19d)](),console[_0x3b29a9(0x17f)](a28_0x1ecd79[_0x3b29a9(0x18d)](_0x3b29a9(0x1a7))),process[_0x3b29a9(0x192)](0x0);};return process['on'](_0x42397c(0x1a9),_0x3d4b8b),process['on']('SIGTERM',_0x3d4b8b),await new Promise(()=>{}),0x0;}catch(_0x4fe741){this[_0x42397c(0x1b1)]&&await this[_0x42397c(0x1b1)]['stop']();this[_0x42397c(0x184)]&&await this['logger'][_0x42397c(0x19d)]();throw _0x4fe741;}}}
@@ -1 +1 @@
1
- const a29_0x5453af=a29_0x37a3;(function(_0x11336d,_0x25bab6){const _0x355bff=a29_0x37a3,_0x205503=_0x11336d();while(!![]){try{const _0x40ee83=parseInt(_0x355bff(0x20e))/0x1*(-parseInt(_0x355bff(0x1af))/0x2)+-parseInt(_0x355bff(0x16e))/0x3+-parseInt(_0x355bff(0x1eb))/0x4*(parseInt(_0x355bff(0x22e))/0x5)+-parseInt(_0x355bff(0x23a))/0x6+-parseInt(_0x355bff(0x188))/0x7+parseInt(_0x355bff(0x25a))/0x8*(-parseInt(_0x355bff(0x22f))/0x9)+-parseInt(_0x355bff(0x207))/0xa*(-parseInt(_0x355bff(0x219))/0xb);if(_0x40ee83===_0x25bab6)break;else _0x205503['push'](_0x205503['shift']());}catch(_0x3b58b3){_0x205503['push'](_0x205503['shift']());}}}(a29_0x2858,0x36ab1));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a29_0xb8402e from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../types/endpoints.js';import{formatRows,formatAsTable}from'../utils/formatters.js';import{parseYamlString}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import a29_0xfad20c from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../utils/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a29_0x5453af(0x1f9),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x287de2){const _0x30c283=a29_0x5453af,_0x1856a8=process[_0x30c283(0x18a)],_0x4fb5f7=_0x1856a8==='darwin'?_0x30c283(0x254):_0x1856a8===_0x30c283(0x273)?_0x30c283(0x27f):_0x30c283(0x170);spawn(_0x4fb5f7,[_0x287de2],{'detached':!![],'stdio':_0x30c283(0x1a3)})[_0x30c283(0x17d)]();}function migrateLegacyDirectory(){const _0x524e6a=a29_0x5453af;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x20ff67=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x20ff67[_0x524e6a(0x189)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x524e6a(0x173)](a29_0xfad20c['yellow'](_0x524e6a(0x177)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x524e6a(0x1e9))),console[_0x524e6a(0x173)](a29_0xfad20c['dim'](_0x524e6a(0x176)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x524e6a(0x173)](a29_0xfad20c[_0x524e6a(0x195)](_0x524e6a(0x1ef)+LEGACY_PARENT_SEGMENT_DIR+_0x524e6a(0x256)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x524e6a(0x173)](a29_0xfad20c['green'](_0x524e6a(0x1f4)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x56b0fa){const _0x48df7e=_0x56b0fa instanceof Error?_0x56b0fa[_0x524e6a(0x175)]:String(_0x56b0fa);return console[_0x524e6a(0x173)](a29_0xfad20c['red'](_0x524e6a(0x259)+_0x48df7e+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x420a2a){const _0x20b171=a29_0x5453af;return migrateLegacyDirectory(),super[_0x20b171(0x21c)](_0x420a2a);}}function resolveYamlFile(_0x31318c){const _0x4a32fd=a29_0x5453af;if(_0x31318c[_0x4a32fd(0x1b0)](_0x4a32fd(0x1a4))||_0x31318c[_0x4a32fd(0x1b0)]('.yaml'))return _0x31318c;return a29_0xb8402e[_0x4a32fd(0x1cd)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x31318c)+'.yml');}function formatProgressMessage(_0x7db43d){const _0x5bf28c=a29_0x5453af,_0x11215a=_0x7db43d['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x11215a){const [,_0x4c3ec4,_0x1b297c,_0x4a8493='']=_0x11215a;return a29_0xfad20c[_0x5bf28c(0x1b9)](_0x4c3ec4+':')+'\x20'+_0x1b297c+a29_0xfad20c[_0x5bf28c(0x1b9)](_0x4a8493);}return a29_0xfad20c[_0x5bf28c(0x1b9)](_0x7db43d);}function showFileNotFoundError(_0x250727,_0x38c36b){const _0x2c77f7=a29_0x5453af;console[_0x2c77f7(0x173)](a29_0xfad20c[_0x2c77f7(0x286)]('Error:\x20File\x20not\x20found:\x20'+_0x250727+'\x0a')),console[_0x2c77f7(0x173)](a29_0xfad20c[_0x2c77f7(0x162)](_0x2c77f7(0x1c9)+_0x38c36b+_0x2c77f7(0x1d3)));}function showParentSegmentNotSetError(_0x3c876c){const _0x3a04c1=a29_0x5453af;console[_0x3a04c1(0x173)](a29_0xfad20c[_0x3a04c1(0x195)](_0x3a04c1(0x17f))),console[_0x3a04c1(0x173)](_0x3c876c);}export class ParentSegmentListCommand extends BaseCommand{[a29_0x5453af(0x185)]=a29_0x5453af(0x1a6);[a29_0x5453af(0x280)]=a29_0x5453af(0x224);async[a29_0x5453af(0x21f)](_0x197203){const _0x86a2b9=a29_0x5453af,{options:_0xaee5ce,args:_0xa05c5d,tdx:_0x5482af}=_0x197203,_0x375706=_0xa05c5d[0x0];_0xaee5ce[_0x86a2b9(0x19d)]&&(console[_0x86a2b9(0x173)](_0x86a2b9(0x255)+_0xaee5ce[_0x86a2b9(0x180)]),_0x375706&&console[_0x86a2b9(0x173)](_0x86a2b9(0x282)+_0x375706));const _0x2eb430=await withSpinner(_0x375706?_0x86a2b9(0x18f)+_0x375706+_0x86a2b9(0x1d4):_0x86a2b9(0x23f),()=>_0x5482af[_0x86a2b9(0x1a8)][_0x86a2b9(0x1fb)](),{'verbose':_0xaee5ce[_0x86a2b9(0x19d)]});let _0x31fc3f=_0x2eb430[_0x86a2b9(0x1e6)];if(_0x375706){const _0x543e1e=_0x375706['replace'](/[.+^${}()|[\]\\]/g,_0x86a2b9(0x1a0))['replace'](/\*/g,'.*')[_0x86a2b9(0x178)](/\?/g,'.'),_0x2db4d4=new RegExp('^'+_0x543e1e+'$','i');_0x31fc3f=_0x31fc3f[_0x86a2b9(0x1d0)](_0x4bac45=>_0x2db4d4['test'](_0x4bac45[_0x86a2b9(0x19a)]['name']));}_0x31fc3f[_0x86a2b9(0x190)]((_0x2dfb96,_0x384082)=>_0x2dfb96[_0x86a2b9(0x19a)][_0x86a2b9(0x185)][_0x86a2b9(0x26f)](_0x384082['attributes'][_0x86a2b9(0x185)])),console[_0x86a2b9(0x173)]('✔\x20Found\x20'+_0x31fc3f[_0x86a2b9(0x1fc)]+_0x86a2b9(0x1c5)+(_0x31fc3f[_0x86a2b9(0x1fc)]!==0x1?'s':''));if(_0xaee5ce[_0x86a2b9(0x16a)]==='json'||_0xaee5ce[_0x86a2b9(0x16a)]===_0x86a2b9(0x24d))await handleSDKOutput(_0x31fc3f,_0xaee5ce);else{if(_0x31fc3f[_0x86a2b9(0x1fc)]===0x0)_0x375706?console['log']('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x375706):console[_0x86a2b9(0x27e)](_0x86a2b9(0x160));else for(const _0x347e84 of _0x31fc3f){const _0x572bac=_0x347e84[_0x86a2b9(0x19a)][_0x86a2b9(0x1cc)]?a29_0xfad20c['dim']('\x20('+formatRows(_0x347e84['attributes'][_0x86a2b9(0x1cc)])+')'):'';console[_0x86a2b9(0x27e)](_0x86a2b9(0x18d)+_0x347e84[_0x86a2b9(0x19a)][_0x86a2b9(0x185)]+_0x572bac);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a29_0x5453af(0x185)]=a29_0x5453af(0x194);['description']=a29_0x5453af(0x262);async['execute'](_0x4caf9d){const _0x2ef2d9=a29_0x5453af,{options:_0x26ccc9,args:_0x3a1700,tdx:_0x5c87c8}=_0x4caf9d;console[_0x2ef2d9(0x173)](_0x2ef2d9(0x26b)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x2ef2d9(0x229));const _0x1c4f11=_0x26ccc9;if(_0x3a1700[_0x2ef2d9(0x1fc)]===0x0)return console[_0x2ef2d9(0x173)](a29_0xfad20c[_0x2ef2d9(0x286)](_0x2ef2d9(0x230))),console['error']('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x31350b=_0x3a1700[0x0];if(!_0x1c4f11[_0x2ef2d9(0x27b)]||!_0x1c4f11['table'])return console[_0x2ef2d9(0x173)](_0x2ef2d9(0x288)),console[_0x2ef2d9(0x173)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x1c4f11[_0x2ef2d9(0x19d)]&&(console[_0x2ef2d9(0x173)](_0x2ef2d9(0x255)+_0x1c4f11[_0x2ef2d9(0x180)]),console[_0x2ef2d9(0x173)](_0x2ef2d9(0x287)+_0x31350b),console[_0x2ef2d9(0x173)](_0x2ef2d9(0x1f5)+_0x1c4f11[_0x2ef2d9(0x27b)]),console[_0x2ef2d9(0x173)](_0x2ef2d9(0x249)+_0x1c4f11[_0x2ef2d9(0x24a)]));const _0x47b641=await loadJSONFromOptions(_0x1c4f11[_0x2ef2d9(0x19a)],_0x1c4f11['attributesFile']),_0x2059b1=await loadJSONFromOptions(_0x1c4f11[_0x2ef2d9(0x19e)],_0x1c4f11[_0x2ef2d9(0x235)]),_0x573681=await loadJSONFromOptions(_0x1c4f11['customerGroup'],_0x1c4f11[_0x2ef2d9(0x22d)]),_0x5917cd={'name':_0x31350b,'description':_0x1c4f11[_0x2ef2d9(0x280)],'scheduleType':_0x1c4f11[_0x2ef2d9(0x261)],'scheduleOption':_0x1c4f11[_0x2ef2d9(0x213)],'timezone':_0x1c4f11[_0x2ef2d9(0x1f0)],'master':{'parentDatabaseName':_0x1c4f11[_0x2ef2d9(0x27b)],'parentTableName':_0x1c4f11[_0x2ef2d9(0x24a)]},'attributes':_0x47b641,'behaviors':_0x2059b1,'customerGroup':_0x573681},_0x117671=await withSpinner(_0x2ef2d9(0x250)+_0x31350b+_0x2ef2d9(0x1d4),()=>_0x5c87c8[_0x2ef2d9(0x1a8)][_0x2ef2d9(0x1b6)](_0x5917cd),{'verbose':_0x26ccc9[_0x2ef2d9(0x19d)]}),_0x511e05=_0x117671['data'];return console[_0x2ef2d9(0x173)](_0x2ef2d9(0x21d)+_0x511e05[_0x2ef2d9(0x185)]+'\x27\x20with\x20ID:\x20'+_0x511e05['id']),await handleSDKOutput([_0x511e05],_0x26ccc9),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a29_0x5453af(0x185)]=a29_0x5453af(0x218);['description']=a29_0x5453af(0x1ce);async[a29_0x5453af(0x21f)](_0x509ca0){const _0x4d447d=a29_0x5453af,{options:_0x8acd20,args:_0x27fe55,tdx:_0x343386}=_0x509ca0;console[_0x4d447d(0x173)](_0x4d447d(0x244)+_0x4d447d(0x217)+_0x4d447d(0x229));const _0x5f15cc=_0x8acd20;if(_0x27fe55['length']===0x0)return console['error'](a29_0xfad20c[_0x4d447d(0x286)](_0x4d447d(0x230))),console['error'](_0x4d447d(0x277)),0x1;const _0x1b13e7=_0x27fe55[0x0];_0x5f15cc['verbose']&&(console[_0x4d447d(0x173)]('Site:\x20'+_0x5f15cc[_0x4d447d(0x180)]),console[_0x4d447d(0x173)](_0x4d447d(0x1a2)+_0x1b13e7));const _0x6aac09=await withSpinner(_0x4d447d(0x285)+_0x1b13e7+_0x4d447d(0x1d4),()=>_0x343386[_0x4d447d(0x1a8)][_0x4d447d(0x1be)](_0x1b13e7),{'verbose':_0x5f15cc[_0x4d447d(0x19d)]}),_0x2cc103=_0x6aac09[_0x4d447d(0x1e6)],_0x2f2ab3=await loadJSONFromOptions(_0x5f15cc['addAttributes'],_0x5f15cc['addAttributesFile']),_0x5f4bbb=await loadJSONFromOptions(_0x5f15cc[_0x4d447d(0x24b)],_0x5f15cc[_0x4d447d(0x179)]),_0x42bea9={'name':_0x2cc103[_0x4d447d(0x185)],'description':_0x5f15cc[_0x4d447d(0x280)]!==undefined?_0x5f15cc['description']:_0x2cc103[_0x4d447d(0x280)],'scheduleType':_0x5f15cc[_0x4d447d(0x261)]!==undefined?_0x5f15cc[_0x4d447d(0x261)]:_0x2cc103[_0x4d447d(0x261)],'scheduleOption':_0x5f15cc[_0x4d447d(0x213)]!==undefined?_0x5f15cc[_0x4d447d(0x213)]:_0x2cc103['scheduleOption'],'timezone':_0x5f15cc[_0x4d447d(0x1f0)]!==undefined?_0x5f15cc[_0x4d447d(0x1f0)]:_0x2cc103[_0x4d447d(0x1f0)],'master':_0x2cc103[_0x4d447d(0x1d7)],'attributes':_0x2f2ab3?[..._0x2cc103['attributes']||[],..._0x2f2ab3]:_0x2cc103[_0x4d447d(0x19a)],'behaviors':_0x5f4bbb?[..._0x2cc103[_0x4d447d(0x19e)]||[],..._0x5f4bbb]:_0x2cc103[_0x4d447d(0x19e)],'customerGroup':_0x2cc103[_0x4d447d(0x203)]},_0x3c465d=await withSpinner(_0x4d447d(0x24f)+_0x1b13e7+'\x27...',()=>_0x343386[_0x4d447d(0x1a8)][_0x4d447d(0x17e)](_0x1b13e7,_0x42bea9),{'verbose':_0x5f15cc[_0x4d447d(0x19d)]}),_0x32dd5a=_0x3c465d['data'];return console[_0x4d447d(0x173)](_0x4d447d(0x236)+_0x32dd5a[_0x4d447d(0x185)]+'\x27'),await handleSDKOutput([_0x32dd5a],_0x5f15cc),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a29_0x5453af(0x185)]=a29_0x5453af(0x1c3);[a29_0x5453af(0x280)]=a29_0x5453af(0x1ff);async['execute'](_0x5b9348){const _0x24d75e=a29_0x5453af,{options:_0xb0ef4f,args:_0x3a85a2,tdx:_0x59d194}=_0x5b9348,_0x208564=_0xb0ef4f,_0x3095ca=_0x3a85a2[0x0]||_0xb0ef4f['parentSegment'];if(!_0x3095ca)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a'+_0x24d75e(0x271)),0x1;if(_0x208564[_0x24d75e(0x1c8)]&&_0x208564['output'])return console[_0x24d75e(0x173)](a29_0xfad20c['red']('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x24d75e(0x173)](a29_0xfad20c[_0x24d75e(0x1b9)](_0x24d75e(0x1f1))),console[_0x24d75e(0x173)](a29_0xfad20c[_0x24d75e(0x1b9)](_0x24d75e(0x1b2)+PARENT_SEGMENT_DIR+_0x24d75e(0x17a))),console['error'](a29_0xfad20c['cyan'](_0x24d75e(0x20a))),0x1;const _0x1e5546=_0x208564[_0x24d75e(0x1ee)]||a29_0xb8402e[_0x24d75e(0x1cd)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3095ca)+_0x24d75e(0x1a4));_0x208564[_0x24d75e(0x19d)]&&(console[_0x24d75e(0x173)](_0x24d75e(0x255)+_0x208564[_0x24d75e(0x180)]),console['error'](_0x24d75e(0x1a2)+_0x3095ca),console['error'](_0x24d75e(0x1ea)+_0x1e5546));const _0x3725d1=await withSpinner(_0x24d75e(0x1da)+_0x3095ca+_0x24d75e(0x1d4),()=>_0x59d194['segment']['pullParentYaml'](_0x3095ca),{'verbose':_0x208564[_0x24d75e(0x19d)]}),_0x1759bb=_0x3725d1[_0x24d75e(0x1e6)];if(existsSync(_0x1e5546)){const _0x308f3d=readFileSync(_0x1e5546,_0x24d75e(0x193)),_0x49ac12=generateDiff(_0x308f3d,_0x1759bb);if(!hasChanges(_0x49ac12))console[_0x24d75e(0x173)](a29_0xfad20c[_0x24d75e(0x226)]('✔')+'\x20No\x20changes\x20-\x20'+a29_0xfad20c[_0x24d75e(0x162)](_0x1e5546)+'\x20is\x20already\x20up\x20to\x20date');else{console['error'](_0x24d75e(0x209)+_0x1e5546+'\x27:'),console['error']('─'[_0x24d75e(0x1ed)](0x3c)),console[_0x24d75e(0x173)](formatDiffWithColors(_0x49ac12)),console[_0x24d75e(0x173)]('─'[_0x24d75e(0x1ed)](0x3c));if(!_0x208564[_0x24d75e(0x27d)]){const _0x323099=await confirmKey('Overwrite\x20\x27'+_0x1e5546+'\x27?');if(!_0x323099)return console[_0x24d75e(0x173)](_0x24d75e(0x166)),0x1;}writeFileSync(_0x1e5546,_0x1759bb,'utf-8'),console[_0x24d75e(0x173)](a29_0xfad20c[_0x24d75e(0x226)]('✔')+_0x24d75e(0x269)+a29_0xfad20c[_0x24d75e(0x162)](_0x1e5546));}}else{const _0x4b1131=a29_0xb8402e['dirname'](_0x1e5546);!existsSync(_0x4b1131)&&mkdirSync(_0x4b1131,{'recursive':!![]}),writeFileSync(_0x1e5546,_0x1759bb,'utf-8'),console[_0x24d75e(0x173)](a29_0xfad20c[_0x24d75e(0x226)]('✔')+_0x24d75e(0x269)+a29_0xfad20c['cyan'](_0x1e5546));}return saveSessionContext({'parent_segment':_0x3095ca},_0x208564[_0x24d75e(0x264)]),console['error'](a29_0xfad20c[_0x24d75e(0x226)]('✔')+_0x24d75e(0x220)+a29_0xfad20c['dim'](_0x24d75e(0x1dd))+_0x24d75e(0x205)+a29_0xfad20c[_0x24d75e(0x162)](_0x3095ca)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']='segment:parent:push';['description']=a29_0x5453af(0x1ab);async[a29_0x5453af(0x21f)](_0x3f5c79){const _0x755f10=a29_0x5453af,{options:_0x443ec7,args:_0x4d9148,tdx:_0x6f8c09}=_0x3f5c79,_0x350a19=_0x443ec7,_0x3cea7d=_0x4d9148[0x0]||_0x443ec7['parentSegment'];if(!_0x3cea7d)return showParentSegmentNotSetError(_0x755f10(0x16c)+_0x755f10(0x186)),0x1;const _0x5ec535=resolveYamlFile(_0x3cea7d);if(!existsSync(_0x5ec535))return showFileNotFoundError(_0x5ec535,_0x3cea7d),0x1;_0x350a19[_0x755f10(0x19d)]&&(console[_0x755f10(0x173)](_0x755f10(0x255)+_0x350a19[_0x755f10(0x180)]),console[_0x755f10(0x173)](_0x755f10(0x1c0)+_0x5ec535));let _0x271c39;try{_0x271c39=readFileSync(_0x5ec535,_0x755f10(0x193));}catch(_0x5d46a3){const _0x42f599=_0x5d46a3 instanceof Error?_0x5d46a3[_0x755f10(0x175)]:String(_0x5d46a3);return console[_0x755f10(0x173)](_0x755f10(0x1d1)+_0x42f599),0x1;}const _0x5f42f6=await withSpinner(_0x755f10(0x1fd),()=>_0x6f8c09[_0x755f10(0x1a8)]['pushParentYaml'](_0x271c39),{'verbose':_0x350a19[_0x755f10(0x19d)]}),_0x28faf1=_0x5f42f6[_0x755f10(0x1e6)],{isNew:_0x509622,name:_0x2eb933,hasChanges:_0x234a51,diffFormatted:_0x38ae1d}=_0x28faf1;if(!_0x234a51)return console['error'](_0x755f10(0x216)+_0x2eb933+_0x755f10(0x21e)),0x0;_0x509622?console[_0x755f10(0x173)](_0x755f10(0x1b5)+_0x2eb933+'\x27:'):console[_0x755f10(0x173)](_0x755f10(0x183)+_0x2eb933+'\x27:');console[_0x755f10(0x173)]('─'[_0x755f10(0x1ed)](0x3c)),console['error'](_0x38ae1d),console[_0x755f10(0x173)]('─'[_0x755f10(0x1ed)](0x3c));const _0x42e08a=_0x509622?_0x755f10(0x23d)+_0x2eb933+'\x27?':_0x755f10(0x172)+_0x2eb933+'\x27?';if(!_0x350a19[_0x755f10(0x27d)]){const _0xdab7b6=await confirmKey(_0x42e08a);if(!_0xdab7b6)return console[_0x755f10(0x173)](_0x755f10(0x166)),0x1;}const _0x37db5d=_0x509622?_0x755f10(0x22c):_0x755f10(0x275),_0x50a954=await withSpinner(_0x37db5d+_0x755f10(0x240)+_0x2eb933+_0x755f10(0x1d4),()=>_0x28faf1[_0x755f10(0x233)](),{'verbose':_0x350a19[_0x755f10(0x19d)]}),_0x5a7707=_0x50a954[_0x755f10(0x1e6)],_0x2ad86a=getConsoleNextUrl(_0x350a19[_0x755f10(0x180)],_0x755f10(0x181)+_0x5a7707['id']),_0x13a792=_0x509622?_0x755f10(0x27a):_0x755f10(0x243);return console[_0x755f10(0x173)]('✔\x20'+_0x13a792+_0x755f10(0x240)+_0x5a7707['name']+'\x27'),console[_0x755f10(0x173)]('\x20\x20'+_0x2ad86a),0x0;}}function a29_0x37a3(_0x40c398,_0x39ee3d){_0x40c398=_0x40c398-0x15a;const _0x285806=a29_0x2858();let _0x37a3b9=_0x285806[_0x40c398];return _0x37a3b9;}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a29_0x5453af(0x185)]=a29_0x5453af(0x1e0);[a29_0x5453af(0x280)]=a29_0x5453af(0x24e);async[a29_0x5453af(0x21f)](_0x45ed71){const _0x3e90bc=a29_0x5453af,{options:_0x962bc2,args:_0x45792c,tdx:_0x3958fc}=_0x45ed71,_0x359e80=_0x962bc2,_0x4686cf=_0x45792c[0x0]||_0x962bc2[_0x3e90bc(0x200)];if(!_0x4686cf)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+_0x3e90bc(0x252)+_0x3e90bc(0x17c)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x4632d0=resolveYamlFile(_0x4686cf);if(!existsSync(_0x4632d0))return showFileNotFoundError(_0x4632d0,_0x4686cf),0x1;_0x359e80[_0x3e90bc(0x19d)]&&(console['error'](_0x3e90bc(0x255)+_0x359e80[_0x3e90bc(0x180)]),console[_0x3e90bc(0x173)](_0x3e90bc(0x1c0)+_0x4632d0));let _0x2ece75;try{_0x2ece75=readFileSync(_0x4632d0,_0x3e90bc(0x193));}catch(_0x5545fc){const _0x37bdb9=_0x5545fc instanceof Error?_0x5545fc[_0x3e90bc(0x175)]:String(_0x5545fc);return console[_0x3e90bc(0x173)](_0x3e90bc(0x1d1)+_0x37bdb9),0x1;}const _0x48c882=createCommandSpinner(a29_0xfad20c[_0x3e90bc(0x1b9)](_0x3e90bc(0x191)),{'verbose':_0x359e80['verbose']});_0x48c882[_0x3e90bc(0x27f)]();const _0xb55ab3={'onProgress':_0x53bd70=>{const _0x51dd23=_0x3e90bc;_0x48c882[_0x51dd23(0x21b)]=formatProgressMessage(_0x53bd70);}};if(_0x359e80['master'])_0xb55ab3[_0x3e90bc(0x1d7)]=!![];if(_0x359e80['enriched'])_0xb55ab3[_0x3e90bc(0x272)]=!![];_0x359e80['attribute']&&(_0xb55ab3[_0x3e90bc(0x197)]=_0x359e80['attribute']);_0x359e80[_0x3e90bc(0x184)]&&(_0xb55ab3['behavior']=_0x359e80[_0x3e90bc(0x184)]);if(_0x359e80[_0x3e90bc(0x22b)])_0xb55ab3['interval']=_0x359e80['interval'];let _0x5df1d6;try{_0x5df1d6=await _0x3958fc[_0x3e90bc(0x1a8)][_0x3e90bc(0x1b3)](_0x2ece75,_0xb55ab3),_0x48c882[_0x3e90bc(0x161)]();}catch(_0x21ef9f){_0x48c882['stop']();throw _0x21ef9f;}const _0x1cd7e2=_0x359e80[_0x3e90bc(0x22b)]||_0x3e90bc(0x1c6);return this['displayValidateResults'](_0x5df1d6,_0xb55ab3,_0x4632d0,_0x1cd7e2),_0x5df1d6[_0x3e90bc(0x1a7)]?0x0:0x1;}['displayValidateResults'](_0x12670a,_0x893169,_0x1ed089,_0x3b1386){const _0x3398d4=a29_0x5453af;console[_0x3398d4(0x173)]('\x0a'+a29_0xfad20c[_0x3398d4(0x1bf)](_0x3398d4(0x245))+'\x20'+_0x12670a['name']),console[_0x3398d4(0x173)]('═'[_0x3398d4(0x1ed)](0x3c)),this[_0x3398d4(0x25f)](_0x12670a);if(typeof _0x893169[_0x3398d4(0x197)]===_0x3398d4(0x17b)){this['displayAttributesStats'](_0x12670a),this[_0x3398d4(0x1ac)](_0x12670a),this['displayPreviewHints'](_0x1ed089,_0x3b1386,_0x3398d4(0x197),_0x893169[_0x3398d4(0x197)]);return;}if(_0x893169[_0x3398d4(0x197)]===!![]){this[_0x3398d4(0x168)](_0x12670a),this[_0x3398d4(0x1ac)](_0x12670a),this[_0x3398d4(0x246)](_0x1ed089,_0x3b1386,_0x3398d4(0x19a));return;}if(typeof _0x893169['behavior']===_0x3398d4(0x17b)){this[_0x3398d4(0x187)](_0x12670a,_0x3b1386),this[_0x3398d4(0x1ac)](_0x12670a),this['displayPreviewHints'](_0x1ed089,_0x3b1386,_0x3398d4(0x184),_0x893169[_0x3398d4(0x184)]);return;}if(_0x893169[_0x3398d4(0x184)]===!![]){this[_0x3398d4(0x187)](_0x12670a,_0x3b1386),this[_0x3398d4(0x1ac)](_0x12670a),this[_0x3398d4(0x246)](_0x1ed089,_0x3b1386,_0x3398d4(0x19e));return;}this['displayAttributesStats'](_0x12670a),this[_0x3398d4(0x187)](_0x12670a,_0x3b1386),this[_0x3398d4(0x1ac)](_0x12670a),this[_0x3398d4(0x246)](_0x1ed089,_0x3b1386,'all');}[a29_0x5453af(0x246)](_0xbac5a4,_0x86369f,_0x172c84,_0x49e419){const _0x4d82de=a29_0x5453af;console[_0x4d82de(0x173)]('\x0a'+a29_0xfad20c[_0x4d82de(0x1b9)](_0x4d82de(0x23c)));const _0x5155b9=_0x86369f!==_0x4d82de(0x1c6)?'\x20--interval\x20'+_0x86369f:'';if(_0x172c84==='attribute'&&_0x49e419)console['error']('\x20\x20'+a29_0xfad20c[_0x4d82de(0x1b9)](_0x4d82de(0x263)+_0xbac5a4+'\x20--attribute\x20\x22'+_0x49e419+'\x22'+_0x5155b9));else{if(_0x172c84===_0x4d82de(0x184)&&_0x49e419)console[_0x4d82de(0x173)]('\x20\x20'+a29_0xfad20c[_0x4d82de(0x1b9)]('tdx\x20segment\x20parent\x20preview\x20'+_0xbac5a4+_0x4d82de(0x18b)+_0x49e419+'\x22'+_0x5155b9));else(_0x172c84===_0x4d82de(0x19a)||_0x172c84===_0x4d82de(0x19b))&&console[_0x4d82de(0x173)]('\x20\x20'+a29_0xfad20c[_0x4d82de(0x1b9)](_0x4d82de(0x263)+_0xbac5a4+_0x4d82de(0x270)+_0x5155b9));}(_0x172c84===_0x4d82de(0x19e)||_0x172c84==='all')&&console[_0x4d82de(0x173)]('\x20\x20'+a29_0xfad20c[_0x4d82de(0x1b9)](_0x4d82de(0x263)+_0xbac5a4+'\x20--behavior\x20\x22<name>\x22'+_0x5155b9)),_0x172c84===_0x4d82de(0x19b)&&console[_0x4d82de(0x173)]('\x20\x20'+a29_0xfad20c[_0x4d82de(0x1b9)](_0x4d82de(0x263)+_0xbac5a4+_0x4d82de(0x225)+_0x5155b9));}[a29_0x5453af(0x25f)](_0x352caa){const _0xe4decf=a29_0x5453af,{master:_0x34ecbc}=_0x352caa,_0x1fd847=_0x34ecbc[_0xe4decf(0x241)]?a29_0xfad20c[_0xe4decf(0x226)]('✔'):a29_0xfad20c[_0xe4decf(0x286)]('✘');console[_0xe4decf(0x173)]('\x0a'+a29_0xfad20c[_0xe4decf(0x1b9)](_0xe4decf(0x278))),console[_0xe4decf(0x173)](_0x1fd847+'\x20'+a29_0xfad20c[_0xe4decf(0x1bf)](_0x34ecbc['database']+'.'+_0x34ecbc[_0xe4decf(0x24a)])),_0x34ecbc[_0xe4decf(0x241)]?_0x34ecbc[_0xe4decf(0x1d9)]!==undefined&&console['error']('\x20\x20'+a29_0xfad20c[_0xe4decf(0x1b9)](_0xe4decf(0x1d5))+'\x20'+a29_0xfad20c[_0xe4decf(0x162)](formatRows(_0x34ecbc[_0xe4decf(0x1d9)]))):console[_0xe4decf(0x173)]('\x20\x20'+a29_0xfad20c[_0xe4decf(0x286)]('Error:')+'\x20'+_0x34ecbc[_0xe4decf(0x25d)]);}[a29_0x5453af(0x168)](_0x583908){const _0x4daac7=a29_0x5453af;if(_0x583908['attributes'][_0x4daac7(0x1fc)]===0x0)return;console[_0x4daac7(0x173)]('\x0a'+a29_0xfad20c[_0x4daac7(0x1b9)](_0x4daac7(0x165)));for(const _0x599dea of _0x583908[_0x4daac7(0x19a)]){const _0x2e00d6=_0x599dea[_0x4daac7(0x241)]?a29_0xfad20c[_0x4daac7(0x226)]('✔'):a29_0xfad20c[_0x4daac7(0x286)]('✘');let _0x3011b7='';if(_0x599dea[_0x4daac7(0x241)]&&_0x599dea[_0x4daac7(0x21a)]!==undefined&&_0x599dea[_0x4daac7(0x15b)]!==undefined){const _0x1e5162=_0x599dea[_0x4daac7(0x15b)]['toFixed'](0x1),_0x33e25b=_0x599dea[_0x4daac7(0x15b)]>=0x50?a29_0xfad20c['green']:_0x599dea[_0x4daac7(0x15b)]>=0x32?a29_0xfad20c['yellow']:a29_0xfad20c['red'];_0x3011b7='\x20'+a29_0xfad20c[_0x4daac7(0x1b9)](_0x4daac7(0x15d))+'\x20'+_0x33e25b(_0x1e5162+'%')+'\x20('+formatRows(_0x599dea[_0x4daac7(0x21a)])+'\x20rows)';}console[_0x4daac7(0x173)](_0x2e00d6+'\x20'+a29_0xfad20c[_0x4daac7(0x1bf)](_0x599dea[_0x4daac7(0x185)])+_0x3011b7),console[_0x4daac7(0x173)]('\x20\x20'+a29_0xfad20c['dim'](_0x4daac7(0x267))+'\x20'+a29_0xfad20c['bold'](_0x599dea[_0x4daac7(0x27b)]+'.'+_0x599dea[_0x4daac7(0x24a)]));const _0x4feb2f=_0x599dea[_0x4daac7(0x1ae)]===_0x599dea['foreignKey']?a29_0xfad20c[_0x4daac7(0x1b9)](_0x4daac7(0x1bc))+'\x20'+_0x599dea[_0x4daac7(0x1ae)]:a29_0xfad20c['dim']('Join:')+'\x20'+_0x599dea[_0x4daac7(0x1ae)]+_0x4daac7(0x205)+_0x599dea[_0x4daac7(0x266)];console[_0x4daac7(0x173)]('\x20\x20'+_0x4feb2f),console['error']('\x20\x20'+a29_0xfad20c[_0x4daac7(0x1b9)]('Columns:')),this['displayColumns'](_0x599dea[_0x4daac7(0x15c)]),!_0x599dea['schemaValid']&&console[_0x4daac7(0x173)]('\x20\x20'+a29_0xfad20c[_0x4daac7(0x286)](_0x4daac7(0x199))+'\x20'+_0x599dea[_0x4daac7(0x25d)]);}}[a29_0x5453af(0x187)](_0x4fcd68,_0x1c1eb7){const _0x46b45c=a29_0x5453af;if(_0x4fcd68[_0x46b45c(0x19e)]['length']===0x0)return;console[_0x46b45c(0x173)]('\x0a'+a29_0xfad20c['dim']('Behaviors')+'\x20'+a29_0xfad20c['dim']('('+_0x1c1eb7+')'));for(const _0xff7cb1 of _0x4fcd68[_0x46b45c(0x19e)]){const _0x58ecda=_0xff7cb1['schemaValid']?a29_0xfad20c[_0x46b45c(0x226)]('✔'):a29_0xfad20c[_0x46b45c(0x286)]('✘');let _0x267000='';if(_0xff7cb1[_0x46b45c(0x241)]&&_0xff7cb1[_0x46b45c(0x25e)]!==undefined&&_0xff7cb1[_0x46b45c(0x169)]!==undefined){const _0x5698b6=_0xff7cb1['customerPercent']?.[_0x46b45c(0x171)](0x1)||'?',_0x400000=(_0xff7cb1[_0x46b45c(0x211)]??0x0)>=0x32?a29_0xfad20c['green']:(_0xff7cb1['customerPercent']??0x0)>=0x14?a29_0xfad20c['yellow']:a29_0xfad20c['red'];_0x267000='\x20'+a29_0xfad20c[_0x46b45c(0x1b9)](_0x46b45c(0x1f8))+'\x20'+_0x400000(formatRows(_0xff7cb1['customersWithEvents']))+'\x20('+_0x5698b6+_0x46b45c(0x1e3)+a29_0xfad20c['dim'](_0x46b45c(0x23e))+'\x20'+a29_0xfad20c[_0x46b45c(0x162)](formatRows(_0xff7cb1[_0x46b45c(0x169)]));}console['error'](_0x58ecda+'\x20'+a29_0xfad20c['bold'](_0xff7cb1[_0x46b45c(0x185)])+_0x267000),console[_0x46b45c(0x173)]('\x20\x20'+a29_0xfad20c[_0x46b45c(0x1b9)](_0x46b45c(0x267))+'\x20'+a29_0xfad20c[_0x46b45c(0x1bf)](_0xff7cb1[_0x46b45c(0x27b)]+'.'+_0xff7cb1[_0x46b45c(0x24a)]));const _0x38e4d1=_0xff7cb1[_0x46b45c(0x1ae)]===_0xff7cb1['foreignKey']?a29_0xfad20c[_0x46b45c(0x1b9)](_0x46b45c(0x1bc))+'\x20'+_0xff7cb1['joinKey']:a29_0xfad20c[_0x46b45c(0x1b9)]('Join:')+'\x20'+_0xff7cb1['joinKey']+_0x46b45c(0x205)+_0xff7cb1[_0x46b45c(0x266)];console[_0x46b45c(0x173)]('\x20\x20'+_0x38e4d1),console[_0x46b45c(0x173)]('\x20\x20'+a29_0xfad20c[_0x46b45c(0x1b9)](_0x46b45c(0x1c1))),this[_0x46b45c(0x164)](_0xff7cb1[_0x46b45c(0x15c)]),!_0xff7cb1['schemaValid']&&console[_0x46b45c(0x173)]('\x20\x20'+a29_0xfad20c['red'](_0x46b45c(0x199))+'\x20'+_0xff7cb1[_0x46b45c(0x25d)]);}}[a29_0x5453af(0x164)](_0x3e7a4f){const _0x1d6517=a29_0x5453af;for(const _0x4ff222 of _0x3e7a4f){_0x4ff222[_0x1d6517(0x1c7)]===_0x4ff222[_0x1d6517(0x16f)]||_0x4ff222[_0x1d6517(0x16f)]==='*'?console[_0x1d6517(0x173)]('\x20\x20\x20\x20-\x20'+_0x4ff222[_0x1d6517(0x1c7)]):console[_0x1d6517(0x173)](_0x1d6517(0x1c2)+_0x4ff222['label']+'\x20'+a29_0xfad20c[_0x1d6517(0x1b9)]('('+_0x4ff222['column']+')'));}}['displaySummary'](_0x131c1f){const _0x37d232=a29_0x5453af;console[_0x37d232(0x173)]('─'['repeat'](0x3c));if(_0x131c1f['errors'][_0x37d232(0x1fc)]>0x0){console[_0x37d232(0x173)]('\x0a'+a29_0xfad20c[_0x37d232(0x286)](_0x37d232(0x1ad)));for(const _0x29f2b0 of _0x131c1f[_0x37d232(0x22a)]){console[_0x37d232(0x173)]('\x20\x20'+a29_0xfad20c[_0x37d232(0x286)]('•')+'\x20'+_0x29f2b0);}}_0x131c1f[_0x37d232(0x1a7)]&&console['error']('\x0a'+a29_0xfad20c['green']('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a29_0x5453af(0x185)]='segment:parent:preview';[a29_0x5453af(0x280)]=a29_0x5453af(0x228);async[a29_0x5453af(0x21f)](_0x2a9c6f){const _0x36c8d0=a29_0x5453af,{options:_0x57db8f,args:_0x2fe4f4,tdx:_0x269e34}=_0x2a9c6f,_0x2deb39=_0x57db8f,_0x2e01e5=_0x2fe4f4[0x0]||_0x57db8f[_0x36c8d0(0x200)];if(!_0x2e01e5)return showParentSegmentNotSetError(_0x36c8d0(0x1cf)+_0x36c8d0(0x26c)+_0x36c8d0(0x15e)+_0x36c8d0(0x234)+_0x36c8d0(0x1b7)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x36c8d0(0x260)+_0x36c8d0(0x268)),0x1;if(!_0x2deb39['master']&&!_0x2deb39[_0x36c8d0(0x197)]&&!_0x2deb39[_0x36c8d0(0x184)]&&!_0x2deb39[_0x36c8d0(0x272)])return console['error'](a29_0xfad20c['red'](_0x36c8d0(0x1db))),console[_0x36c8d0(0x173)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x36c8d0(0x173)]('Options:'),console['error']('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console['error']('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x36c8d0(0x173)](_0x36c8d0(0x1bb)),console['error'](_0x36c8d0(0x198)),0x1;const _0x13330c=resolveYamlFile(_0x2e01e5);if(!existsSync(_0x13330c))return showFileNotFoundError(_0x13330c,_0x2e01e5),0x1;_0x2deb39[_0x36c8d0(0x19d)]&&(console[_0x36c8d0(0x173)](_0x36c8d0(0x255)+_0x2deb39[_0x36c8d0(0x180)]),console[_0x36c8d0(0x173)]('YAML\x20file:\x20'+_0x13330c));let _0xb7d27;try{_0xb7d27=readFileSync(_0x13330c,_0x36c8d0(0x193));}catch(_0x212e7f){const _0x5b9d39=_0x212e7f instanceof Error?_0x212e7f[_0x36c8d0(0x175)]:String(_0x212e7f);return console[_0x36c8d0(0x173)]('Error\x20reading\x20file:\x20'+_0x5b9d39),0x1;}let _0x2d735c;try{_0x2d735c=parseYamlString(_0xb7d27);}catch(_0xb5a083){const _0x30cbb1=_0xb5a083 instanceof Error?_0xb5a083['message']:String(_0xb5a083);return console[_0x36c8d0(0x173)](a29_0xfad20c[_0x36c8d0(0x286)]('Error\x20parsing\x20YAML:\x20'+_0x30cbb1)),0x1;}if(_0x2deb39[_0x36c8d0(0x197)]===!![]||_0x2deb39[_0x36c8d0(0x197)]===''){const _0x334035=_0x2d735c['attributes']?.[_0x36c8d0(0x25c)](_0x449274=>_0x449274['name'])||[];if(_0x334035['length']===0x0)console[_0x36c8d0(0x173)](a29_0xfad20c[_0x36c8d0(0x286)](_0x36c8d0(0x231)));else{console[_0x36c8d0(0x173)](a29_0xfad20c['red'](_0x36c8d0(0x222))),console[_0x36c8d0(0x173)](_0x36c8d0(0x1bd));for(const _0x25f598 of _0x334035){console[_0x36c8d0(0x173)]('\x20\x20'+a29_0xfad20c['cyan'](_0x25f598));}console[_0x36c8d0(0x173)](_0x36c8d0(0x238)+_0x2e01e5+_0x36c8d0(0x1d6)+_0x334035[0x0]+'\x22');}return 0x1;}if(_0x2deb39[_0x36c8d0(0x184)]===!![]||_0x2deb39[_0x36c8d0(0x184)]===''){const _0xa2ffbd=_0x2d735c[_0x36c8d0(0x19e)]?.['map'](_0x35f209=>_0x35f209[_0x36c8d0(0x185)])||[];if(_0xa2ffbd[_0x36c8d0(0x1fc)]===0x0)console[_0x36c8d0(0x173)](a29_0xfad20c[_0x36c8d0(0x286)](_0x36c8d0(0x1b1)));else{console[_0x36c8d0(0x173)](a29_0xfad20c[_0x36c8d0(0x286)](_0x36c8d0(0x1d2))),console['error'](_0x36c8d0(0x174));for(const _0x597579 of _0xa2ffbd){console['error']('\x20\x20'+a29_0xfad20c[_0x36c8d0(0x162)](_0x597579));}console[_0x36c8d0(0x173)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x2e01e5+'\x20--behavior\x20\x22'+_0xa2ffbd[0x0]+'\x22');}return 0x1;}const _0x3d4f59=createCommandSpinner(a29_0xfad20c['dim']('Fetching\x20sample\x20data...'),{'verbose':_0x2deb39['verbose']});_0x3d4f59[_0x36c8d0(0x27f)]();const _0x54c6b9={'onProgress':_0x2e2f2b=>{_0x3d4f59['text']=formatProgressMessage(_0x2e2f2b);}};if(_0x2deb39[_0x36c8d0(0x1d7)])_0x54c6b9[_0x36c8d0(0x1d7)]=!![];if(_0x2deb39[_0x36c8d0(0x197)]&&typeof _0x2deb39[_0x36c8d0(0x197)]===_0x36c8d0(0x17b))_0x54c6b9[_0x36c8d0(0x197)]=_0x2deb39[_0x36c8d0(0x197)];if(_0x2deb39[_0x36c8d0(0x184)]&&typeof _0x2deb39['behavior']==='string')_0x54c6b9[_0x36c8d0(0x184)]=_0x2deb39[_0x36c8d0(0x184)];if(_0x2deb39[_0x36c8d0(0x272)])_0x54c6b9[_0x36c8d0(0x272)]=!![];if(_0x2deb39['interval'])_0x54c6b9[_0x36c8d0(0x22b)]=_0x2deb39[_0x36c8d0(0x22b)];let _0x312e40;try{_0x312e40=await _0x269e34[_0x36c8d0(0x1a8)][_0x36c8d0(0x1e2)](_0xb7d27,_0x54c6b9),_0x3d4f59['stop']();}catch(_0x1fb77c){_0x3d4f59[_0x36c8d0(0x161)]();throw _0x1fb77c;}return await this[_0x36c8d0(0x1a1)](_0x312e40,{'master':_0x2deb39[_0x36c8d0(0x1d7)],'attribute':typeof _0x2deb39[_0x36c8d0(0x197)]===_0x36c8d0(0x17b)?_0x2deb39[_0x36c8d0(0x197)]:undefined,'behavior':typeof _0x2deb39[_0x36c8d0(0x184)]===_0x36c8d0(0x17b)?_0x2deb39['behavior']:undefined,'enriched':_0x2deb39[_0x36c8d0(0x272)]}),_0x312e40[_0x36c8d0(0x1a7)]?0x0:0x1;}async[a29_0x5453af(0x1a1)](_0x199779,_0x56fc67){const _0x4c1416=a29_0x5453af;console['error']('\x0a'+a29_0xfad20c[_0x4c1416(0x1bf)](_0x4c1416(0x25b))+'\x20'+_0x199779[_0x4c1416(0x185)]),console[_0x4c1416(0x173)]('═'['repeat'](0x3c));if(_0x56fc67[_0x4c1416(0x1d7)]&&_0x199779[_0x4c1416(0x201)]){const _0x40d60a=a29_0xfad20c[_0x4c1416(0x1b9)](_0x4c1416(0x1b8))+'\x20'+a29_0xfad20c[_0x4c1416(0x1bf)](_0x199779[_0x4c1416(0x1d7)]['database']+'.'+_0x199779[_0x4c1416(0x1d7)][_0x4c1416(0x24a)]);await this[_0x4c1416(0x23b)](_0x40d60a,_0x199779['sampleData']);}else{if(_0x56fc67[_0x4c1416(0x197)]&&_0x199779[_0x4c1416(0x201)]){const _0x24ca43=a29_0xfad20c['dim'](_0x4c1416(0x1cb))+'\x20'+a29_0xfad20c[_0x4c1416(0x1bf)](_0x56fc67[_0x4c1416(0x197)]);await this[_0x4c1416(0x23b)](_0x24ca43,_0x199779[_0x4c1416(0x201)]);}else{if(_0x56fc67[_0x4c1416(0x184)]&&_0x199779[_0x4c1416(0x201)]){const _0x68cf02=a29_0xfad20c[_0x4c1416(0x1b9)](_0x4c1416(0x1ba))+'\x20'+a29_0xfad20c[_0x4c1416(0x1bf)](_0x56fc67['behavior']);await this[_0x4c1416(0x23b)](_0x68cf02,_0x199779[_0x4c1416(0x201)]);}else{if(_0x56fc67[_0x4c1416(0x272)]&&_0x199779[_0x4c1416(0x201)]){const _0xbe684d=a29_0xfad20c['dim'](_0x4c1416(0x167))+'\x20'+a29_0xfad20c['bold']('Master\x20+\x20Attributes');await this[_0x4c1416(0x23b)](_0xbe684d,_0x199779['sampleData']);}else!_0x199779['sampleData']&&console[_0x4c1416(0x173)](_0x4c1416(0x1e5));}}}if(_0x199779[_0x4c1416(0x22a)][_0x4c1416(0x1fc)]>0x0){console[_0x4c1416(0x173)]('─'['repeat'](0x3c)),console[_0x4c1416(0x173)]('\x0a'+a29_0xfad20c[_0x4c1416(0x286)](_0x4c1416(0x1ad)));for(const _0x441dd2 of _0x199779[_0x4c1416(0x22a)]){console[_0x4c1416(0x173)]('\x20\x20'+a29_0xfad20c[_0x4c1416(0x286)]('•')+'\x20'+_0x441dd2);}}}async[a29_0x5453af(0x23b)](_0x1c124a,_0x4eaf81){const _0x12b68b=a29_0x5453af;if(_0x4eaf81[_0x12b68b(0x1fc)]===0x0){console[_0x12b68b(0x173)]('\x0a'+_0x1c124a),console[_0x12b68b(0x173)](_0x12b68b(0x284));return;}console['error']('\x0a'+_0x1c124a);const _0x25a659=Object[_0x12b68b(0x237)](_0x4eaf81[0x0])[_0x12b68b(0x25c)](_0x4278ec=>({'name':_0x4278ec,'type':typeof _0x4eaf81[0x0][_0x4278ec]===_0x12b68b(0x227)?_0x12b68b(0x251):_0x12b68b(0x232)})),_0x27f486={'queryId':_0x12b68b(0x1fa),'columns':_0x25a659,'data':_0x4eaf81,'stats':{'state':_0x12b68b(0x283),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x4eaf81[_0x12b68b(0x1fc)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x595769=formatAsTable(_0x27f486,_0x4eaf81[_0x12b68b(0x1fc)],!![]);await writeOutput(_0x595769,undefined,_0x12b68b(0x24a));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a29_0x5453af(0x185)]=a29_0x5453af(0x18e);[a29_0x5453af(0x280)]=a29_0x5453af(0x1f6);async['execute'](_0x5c7057){const _0x4bf6ef=a29_0x5453af,{options:_0x40a94e,args:_0x4983cc,tdx:_0x1b473e}=_0x5c7057,_0x59d70b=_0x40a94e,_0x28130c=_0x4983cc[0x0]||_0x40a94e[_0x4bf6ef(0x200)];if(!_0x28130c)return showParentSegmentNotSetError(_0x4bf6ef(0x16b)+_0x4bf6ef(0x26a)),0x1;const _0x2b4e5e=resolveYamlFile(_0x28130c);if(existsSync(_0x2b4e5e)){_0x59d70b[_0x4bf6ef(0x19d)]&&console[_0x4bf6ef(0x173)]('Found\x20YAML\x20file:\x20'+_0x2b4e5e);let _0x32384;try{_0x32384=readFileSync(_0x2b4e5e,_0x4bf6ef(0x193));}catch(_0x5af553){const _0xf0b0e9=_0x5af553 instanceof Error?_0x5af553['message']:String(_0x5af553);return console['error'](_0x4bf6ef(0x1d1)+_0xf0b0e9),0x1;}const _0x423c4d=await withSpinner(_0x4bf6ef(0x1fd),()=>_0x1b473e[_0x4bf6ef(0x1a8)][_0x4bf6ef(0x1aa)](_0x32384),{'verbose':_0x59d70b[_0x4bf6ef(0x19d)]}),_0x433ddc=_0x423c4d[_0x4bf6ef(0x1e6)],{isNew:_0x5a317e,name:_0x280ac0,hasChanges:_0x2005fc,diffFormatted:_0x2da862}=_0x433ddc;if(_0x2005fc){_0x5a317e?console[_0x4bf6ef(0x173)](_0x4bf6ef(0x1b5)+_0x280ac0+'\x27:'):console['error']('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x280ac0+'\x27:');console[_0x4bf6ef(0x173)]('─'[_0x4bf6ef(0x1ed)](0x3c)),console[_0x4bf6ef(0x173)](_0x2da862),console['error']('─'[_0x4bf6ef(0x1ed)](0x3c));const _0x19e4f8=_0x5a317e?'Create\x20parent\x20segment\x20\x27'+_0x280ac0+_0x4bf6ef(0x1fe):_0x4bf6ef(0x172)+_0x280ac0+_0x4bf6ef(0x1fe);if(!_0x59d70b[_0x4bf6ef(0x27d)]){const _0xc0c64a=await confirmKey(_0x19e4f8);if(!_0xc0c64a)return console[_0x4bf6ef(0x173)](_0x4bf6ef(0x166)),0x1;}const _0xa35174=_0x5a317e?_0x4bf6ef(0x22c):'Updating';await withSpinner(_0xa35174+'\x20parent\x20segment\x20\x27'+_0x280ac0+_0x4bf6ef(0x1d4),()=>_0x433ddc[_0x4bf6ef(0x233)](),{'verbose':_0x59d70b['verbose']});const _0x22a030=_0x5a317e?_0x4bf6ef(0x27a):_0x4bf6ef(0x243);console[_0x4bf6ef(0x173)]('✔\x20'+_0x22a030+'\x20parent\x20segment\x20\x27'+_0x280ac0+'\x27');}else console['error'](_0x4bf6ef(0x216)+_0x280ac0+_0x4bf6ef(0x196));}const _0x54ca59=await withSpinner(_0x4bf6ef(0x163)+_0x28130c+_0x4bf6ef(0x1d4),()=>_0x1b473e[_0x4bf6ef(0x1a8)][_0x4bf6ef(0x208)](_0x28130c),{'verbose':_0x59d70b[_0x4bf6ef(0x19d)]}),_0x6b93db=_0x54ca59[_0x4bf6ef(0x1e6)],_0x465223=getConsoleUrl(_0x59d70b[_0x4bf6ef(0x180)],_0x4bf6ef(0x202)+_0x6b93db[_0x4bf6ef(0x253)]+_0x4bf6ef(0x20f)+_0x6b93db[_0x4bf6ef(0x258)]+'/attempt/'+_0x6b93db[_0x4bf6ef(0x276)]);return console[_0x4bf6ef(0x173)](_0x4bf6ef(0x279)),console[_0x4bf6ef(0x173)]('\x20\x20'+a29_0xfad20c[_0x4bf6ef(0x1b9)](_0x4bf6ef(0x26d))+'\x20'+_0x6b93db[_0x4bf6ef(0x15f)]),console[_0x4bf6ef(0x173)]('\x20\x20'+a29_0xfad20c[_0x4bf6ef(0x1b9)](_0x4bf6ef(0x1c4))+'\x20'+_0x6b93db[_0x4bf6ef(0x1ca)]),console[_0x4bf6ef(0x173)]('\x20\x20'+a29_0xfad20c[_0x4bf6ef(0x1b9)](_0x4bf6ef(0x206))+'\x20'+_0x6b93db[_0x4bf6ef(0x258)]),console['error']('\x20\x20'+a29_0xfad20c['dim'](_0x4bf6ef(0x20c))+'\x20'+_0x6b93db['workflowAttemptId']),console[_0x4bf6ef(0x173)]('\x20\x20'+_0x465223),console['error']('\x0a'+a29_0xfad20c[_0x4bf6ef(0x1b9)]('To\x20cancel:')+_0x4bf6ef(0x1e1)+_0x6b93db[_0x4bf6ef(0x276)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']='segment:parent:fields';[a29_0x5453af(0x280)]=a29_0x5453af(0x223);async[a29_0x5453af(0x21f)](_0x29208e){const _0x424532=a29_0x5453af,{options:_0xd3c295,args:_0x539303,tdx:_0x1305db}=_0x29208e,_0x3a9d0a=_0x539303[0x0]||_0xd3c295[_0x424532(0x200)];if(!_0x3a9d0a)return showParentSegmentNotSetError(_0x424532(0x215)+_0x424532(0x16d)),0x1;_0xd3c295[_0x424532(0x19d)]&&(console[_0x424532(0x173)](_0x424532(0x255)+_0xd3c295['site']),console[_0x424532(0x173)](_0x424532(0x1a2)+_0x3a9d0a));const _0x4a3e4a=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x3a9d0a+_0x424532(0x1d4),()=>_0x1305db[_0x424532(0x1a8)][_0x424532(0x265)](_0x3a9d0a),{'verbose':_0xd3c295['verbose']}),_0xd2df8a=_0x4a3e4a[_0x424532(0x1e6)];console[_0x424532(0x173)](_0x424532(0x1f7)+_0xd2df8a['length']+_0x424532(0x257)+(_0xd2df8a['length']!==0x1?'s':''));if(_0xd3c295[_0x424532(0x1e7)]||_0xd3c295[_0x424532(0x24d)])return await handleSDKOutput(_0xd2df8a,_0xd3c295),0x0;return displayFieldsHumanReadable(_0xd2df8a,_0x3a9d0a),0x0;}}function a29_0x2858(){const _0x2fba94=['displayAttributesStats','totalEvents','format','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','1001721hTjnZl','column','xdg-open','toFixed','Apply\x20changes\x20to\x20\x27','error','Available\x20behaviors:','message','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','\x0a⚠️\x20\x20Both\x20','replace','addBehaviorsFile','/{name}.yml\x0a','string','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','unref','updateParent','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','site','/app/dw/parentSegments/','resolveParentId','\x0aChanges\x20to\x20apply\x20to\x20\x27','behavior','name','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','displayBehaviorsStats','2248176YYQCiF','isDirectory','platform','\x20--behavior\x20\x22','Show\x20parent\x20segment\x20schema\x20(column\x20types)','👥\x20','segment:parent:run','Listing\x20parent\x20segments\x20matching\x20\x27','sort','Validating\x20configuration...','trim','utf-8','segment:parent:create','yellow','\x27\x20is\x20up\x20to\x20date','attribute','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Error:','attributes','all','query','verbose','behaviors','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x5c$&','displayPreviewResults','Parent\x20segment:\x20','ignore','.yml','segment:parent:show','segment:parent:list','allValid','segment','limit','pushParentYaml','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','displaySummary','Errors:','joinKey','46uJVDcH','endsWith','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','using\x20the\x20default\x20path:\x20','validateParentYaml','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','\x0aNew\x20parent\x20segment\x20\x27','createParent','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','Master:','dim','Behavior:','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Join\x20on:','Available\x20attributes:','getParentFull','bold','YAML\x20file:\x20','Columns:','\x20\x20\x20\x20-\x20','segment:parent:pull','Status:','\x20parent\x20segment','-1d','label','use','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','status','Attribute:','population','join','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','filter','Error\x20reading\x20file:\x20','Error:\x20--behavior\x20requires\x20a\x20name\x0a','`\x20to\x20download\x20the\x20configuration\x20first','\x27...','Rows:','\x20--attribute\x20\x22','master','setJobId','rowCount','Fetching\x20parent\x20segment\x20\x27','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Get\x20SQL\x20query\x20for\x20parent\x20segment','parent_segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','segment:parent:validate','\x20tdx\x20wf\x20attempt\x20','previewParentYaml','%)\x20','Executing\x20parent\x20segment\x20query...','\x0aNo\x20sample\x20data\x20available','data','json','Show\x20parent\x20segment\x20details','/\x20directories\x20exist.','Output\x20file:\x20','192xGtvXB','test','repeat','output','\x0a⚠️\x20\x20Migrating:\x20','timezone','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','segment:parent:desc','✔\x20Renamed\x20directory\x20to\x20','Database:\x20','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','✔\x20Found\x20','Customers:','parent_segments','preview','listParents','length','Analyzing\x20changes...','\x27\x20and\x20run\x20workflow?','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','parentSegment','sampleData','/app/workflows/','customerGroup','jobId','\x20=\x20','Session:','4428290oLwyYM','runParent','\x0aChanges\x20to\x20\x27','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','getParentSQL','Attempt:','SELECT\x20*\x20FROM\x20(\x0a','59TWNuHL','/sessions/','\x20[Job\x20ID:\x20','customerPercent','in\x20','scheduleOption','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','✔\x20No\x20changes\x20-\x20\x27','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','segment:parent:update','44xJzmKN','matchedCount','text','run','✔\x20Created\x20parent\x20segment\x20\x27','\x27\x20is\x20already\x20up\x20to\x20date','execute','\x20Context\x20set:\x20','\x20rows\x20','Error:\x20--attribute\x20requires\x20a\x20name\x0a','List\x20available\x20fields\x20for\x20segmentation','List\x20parent\x20segments','\x20--enriched','green','number','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','errors','interval','Creating','customerGroupFile','44215eMYMTT','2882277xCXNar','Error:\x20Parent\x20segment\x20name\x20is\x20required','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','varchar','apply','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','behaviorsFile','✔\x20Updated\x20parent\x20segment\x20\x27','keys','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','877476bzCUKL','displaySampleData','To\x20view\x20sample\x20data:','Create\x20parent\x20segment\x20\x27','Events:','Listing\x20parent\x20segments...','\x20parent\x20segment\x20\x27','schemaValid','toLocaleString','Updated','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Validate:','displayPreviewHints','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','✔\x20Query\x20completed:\x20Processed\x20','Table:\x20','table','addBehaviors','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','jsonl','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Updating\x20parent\x20segment\x20\x27','Creating\x20parent\x20segment\x20\x27','double','Options:\x0a','workflowId','open','Site:\x20','/\x20→\x20','\x20field','workflowSessionId','✘\x20Failed\x20to\x20rename\x20directory:\x20','8coDObC','Preview:','map','schemaError','customersWithEvents','displayMasterInfo','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','scheduleType','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','tdx\x20segment\x20parent\x20preview\x20','session','listFields','foreignKey','Source:','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Audience\x20ID:','Resolving\x20parent\x20segment\x20\x27','localeCompare','\x20--attribute\x20\x22<name>\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','enriched','win32','Fetching\x20SQL\x20for\x20\x27','Updating','workflowAttemptId','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Master\x20Table','\x0a✔\x20Workflow\x20started','Created','database','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','yes','log','start','description','elapsedTimeMillis','Pattern:\x20','FINISHED','\x20\x20No\x20sample\x20data\x20available','Fetching\x20current\x20configuration\x20for\x20\x27','red','Name:\x20','Error:\x20--database\x20and\x20--table\x20are\x20required','web','coveragePercent','columns','Coverage:','Options\x20(one\x20required):\x0a','audienceId','No\x20parent\x20segments\x20found','stop','cyan','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','displayColumns','Attributes','Aborted.','Enriched:'];a29_0x2858=function(){return _0x2fba94;};return a29_0x2858();}export class ParentSegmentViewCommand extends BaseCommand{[a29_0x5453af(0x185)]='segment:parent:view';['description']=a29_0x5453af(0x1e8);async[a29_0x5453af(0x21f)](_0x94cca7){const _0x5864af=a29_0x5453af,{options:_0x5cc6e1,args:_0x3dc832,tdx:_0x26d2a3}=_0x94cca7,_0x32051c=_0x5cc6e1,_0x3d7a0d=_0x3dc832[0x0]||_0x5cc6e1[_0x5864af(0x200)];if(!_0x3d7a0d)return showParentSegmentNotSetError(_0x5864af(0x24c)+_0x5864af(0x19f)+_0x5864af(0x252)+_0x5864af(0x1f2)),0x1;_0x5cc6e1[_0x5864af(0x19d)]&&(console[_0x5864af(0x173)]('Site:\x20'+_0x5cc6e1[_0x5864af(0x180)]),console[_0x5864af(0x173)](_0x5864af(0x1a2)+_0x3d7a0d));const _0x48ef9c=await withSpinner(_0x5864af(0x1da)+_0x3d7a0d+'\x27...',()=>_0x26d2a3[_0x5864af(0x1a8)][_0x5864af(0x1be)](_0x3d7a0d),{'verbose':_0x5cc6e1[_0x5864af(0x19d)]}),_0x30eddc=_0x48ef9c[_0x5864af(0x1e6)];if(_0x32051c[_0x5864af(0x15a)]){const _0x409053=getConsoleNextUrl(_0x32051c[_0x5864af(0x180)],'/app/dw/parentSegments/'+_0x30eddc['id']);return console[_0x5864af(0x173)](a29_0xfad20c['green']('✔')+'\x20Opening\x20'+a29_0xfad20c[_0x5864af(0x162)](_0x409053)),openBrowser(_0x409053),0x0;}return await handleSingleObjectOutput(_0x30eddc,_0x5cc6e1),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a29_0x5453af(0x1f3);[a29_0x5453af(0x280)]=a29_0x5453af(0x18c);async['execute'](_0x3dd26e){const _0x2e3a13=a29_0x5453af,{options:_0x343426,args:_0x390774,tdx:_0x5bb656}=_0x3dd26e,_0x2a80dc=_0x390774[0x0]||_0x343426['parentSegment'];if(!_0x2a80dc)return showParentSegmentNotSetError(_0x2e3a13(0x214)+_0x2e3a13(0x1de)),0x1;_0x343426[_0x2e3a13(0x19d)]&&(console[_0x2e3a13(0x173)]('Site:\x20'+_0x343426['site']),console[_0x2e3a13(0x173)]('Parent\x20segment:\x20'+_0x2a80dc));const _0x3d889e=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2a80dc+_0x2e3a13(0x1d4),()=>_0x5bb656['segment'][_0x2e3a13(0x182)](_0x2a80dc),{'verbose':_0x343426['verbose']}),_0x101035=_0x3d889e[_0x2e3a13(0x1e6)],_0x5f48ac=await withSpinner(_0x2e3a13(0x274)+_0x2a80dc+_0x2e3a13(0x1d4),()=>_0x5bb656[_0x2e3a13(0x1a8)][_0x2e3a13(0x20b)](_0x101035),{'verbose':_0x343426[_0x2e3a13(0x19d)]}),_0x29ce5a=await executeSchemaQuery(_0x5f48ac[_0x2e3a13(0x1e6)],_0x5bb656,_0x343426);return await handleQueryOutput(_0x29ce5a,_0x343426),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a29_0x5453af(0x185)]='segment:parent:sql';[a29_0x5453af(0x280)]=a29_0x5453af(0x1dc);async['execute'](_0x135ebf){const _0x30f8a5=a29_0x5453af,{options:_0x2d106e,args:_0x5379ea,tdx:_0xd20f8f}=_0x135ebf,_0x49df96=_0x5379ea[0x0]||_0x2d106e[_0x30f8a5(0x200)];if(!_0x49df96)return showParentSegmentNotSetError(_0x30f8a5(0x27c)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0x2d106e[_0x30f8a5(0x19d)]&&(console[_0x30f8a5(0x173)](_0x30f8a5(0x255)+_0x2d106e['site']),console['error'](_0x30f8a5(0x1a2)+_0x49df96));const _0x9791c0=await withSpinner(_0x30f8a5(0x26e)+_0x49df96+_0x30f8a5(0x1d4),()=>_0xd20f8f['segment']['resolveParentId'](_0x49df96),{'verbose':_0x2d106e[_0x30f8a5(0x19d)]}),_0x30def8=_0x9791c0[_0x30f8a5(0x1e6)],_0x115aa7=await withSpinner(_0x30f8a5(0x274)+_0x49df96+_0x30f8a5(0x1d4),()=>_0xd20f8f[_0x30f8a5(0x1a8)][_0x30f8a5(0x20b)](_0x30def8),{'verbose':_0x2d106e[_0x30f8a5(0x19d)]}),_0x532c82=_0x115aa7['data'];return _0x2d106e[_0x30f8a5(0x16a)]===_0x30f8a5(0x1e7)||_0x2d106e['format']===_0x30f8a5(0x24d)?await handleSDKOutput([{'sql':_0x532c82}],_0x2d106e):console[_0x30f8a5(0x27e)](_0x532c82),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a29_0x5453af(0x1a5);['description']=a29_0x5453af(0x1df);async['execute'](_0x44652b){const _0xe1aee6=a29_0x5453af,{options:_0x2612a2,args:_0x3efba5,tdx:_0x2cd124}=_0x44652b,_0x5d2c06=_0x3efba5[0x0]||_0x2612a2[_0xe1aee6(0x200)];if(!_0x5d2c06)return showParentSegmentNotSetError(_0xe1aee6(0x247)+_0xe1aee6(0x1b4)),0x1;_0x2612a2['verbose']&&(console[_0xe1aee6(0x173)](_0xe1aee6(0x255)+_0x2612a2[_0xe1aee6(0x180)]),console['error']('Parent\x20segment:\x20'+_0x5d2c06));const _0x20e838=await withSpinner(_0xe1aee6(0x26e)+_0x5d2c06+_0xe1aee6(0x1d4),()=>_0x2cd124['segment'][_0xe1aee6(0x182)](_0x5d2c06),{'verbose':_0x2612a2[_0xe1aee6(0x19d)]}),_0x4dacaf=_0x20e838[_0xe1aee6(0x1e6)],_0x105c8a=await withSpinner(_0xe1aee6(0x274)+_0x5d2c06+'\x27...',()=>_0x2cd124[_0xe1aee6(0x1a8)][_0xe1aee6(0x20b)](_0x4dacaf),{'verbose':_0x2612a2[_0xe1aee6(0x19d)]});let _0x51e514=_0x105c8a[_0xe1aee6(0x1e6)];const _0x3ec0e3=resolveLimit(_0x2612a2[_0xe1aee6(0x1a9)],DEFAULT_DISPLAY_LIMIT),_0x36bd08=/\bLIMIT\s+\d+/i[_0xe1aee6(0x1ec)](_0x51e514);!_0x36bd08&&(_0x51e514=_0x51e514[_0xe1aee6(0x192)]()[_0xe1aee6(0x178)](/;+$/,''),_0x51e514=_0xe1aee6(0x20d)+_0x51e514+_0xe1aee6(0x239)+_0x3ec0e3);_0x2612a2[_0xe1aee6(0x19d)]&&console[_0xe1aee6(0x173)]('SQL\x20query:\x0a'+_0x51e514);const _0x3ce854=await withQuerySpinner(_0xe1aee6(0x1e4),async _0x858275=>{const _0x257101=_0xe1aee6,_0x565567=await _0x2cd124[_0x257101(0x19c)][_0x257101(0x21f)](_0x51e514,{'catalog':'td','schema':'information_schema','onJobId':_0x46cfce=>{const _0x2471e5=_0x257101;_0x858275[_0x2471e5(0x1d8)](_0x46cfce);}});return _0x565567;},{'verbose':_0x2612a2['verbose']}),_0x588cbc=_0x3ce854[_0xe1aee6(0x1e6)],_0x35e9f2=_0x588cbc[_0xe1aee6(0x204)]?_0xe1aee6(0x210)+_0x588cbc['jobId']+']':'';return console[_0xe1aee6(0x173)](_0xe1aee6(0x248)+_0x588cbc['stats']['processedRows'][_0xe1aee6(0x242)]()+_0xe1aee6(0x221)+(_0xe1aee6(0x212)+formatElapsed(_0x588cbc['stats'][_0xe1aee6(0x281)])+_0x35e9f2)),await handleQueryOutput(_0x588cbc,_0x2612a2),0x0;}}
1
+ const a29_0x1bdc06=a29_0x2a31;(function(_0x4e8968,_0x32c464){const _0x507347=a29_0x2a31,_0x64a617=_0x4e8968();while(!![]){try{const _0xcc0486=-parseInt(_0x507347(0x1ab))/0x1*(parseInt(_0x507347(0x1e9))/0x2)+-parseInt(_0x507347(0x213))/0x3+-parseInt(_0x507347(0x22c))/0x4*(-parseInt(_0x507347(0x214))/0x5)+parseInt(_0x507347(0x25f))/0x6+-parseInt(_0x507347(0x2a1))/0x7+parseInt(_0x507347(0x1e5))/0x8*(parseInt(_0x507347(0x2a7))/0x9)+-parseInt(_0x507347(0x2b7))/0xa*(parseInt(_0x507347(0x1ad))/0xb);if(_0xcc0486===_0x32c464)break;else _0x64a617['push'](_0x64a617['shift']());}catch(_0x51779a){_0x64a617['push'](_0x64a617['shift']());}}}(a29_0x52bc,0xcfdc9));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a29_0x583eca from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../types/endpoints.js';import{formatRows,formatAsTable}from'../utils/formatters.js';import{parseYamlString}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import a29_0x2d2d64 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../utils/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a29_0x1bdc06(0x1fe);function openBrowser(_0x5011b7){const _0x5c1777=a29_0x1bdc06,_0x33bc38=process['platform'],_0x18252e=_0x33bc38===_0x5c1777(0x1db)?_0x5c1777(0x1fd):_0x33bc38===_0x5c1777(0x2c3)?_0x5c1777(0x22b):_0x5c1777(0x1d6);spawn(_0x18252e,[_0x5011b7],{'detached':!![],'stdio':_0x5c1777(0x24b)})[_0x5c1777(0x2ae)]();}function migrateLegacyDirectory(){const _0x234f80=a29_0x1bdc06;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x21cf97=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x21cf97[_0x234f80(0x1aa)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a29_0x2d2d64[_0x234f80(0x251)](_0x234f80(0x1d5)+LEGACY_PARENT_SEGMENT_DIR+_0x234f80(0x1f0)+PARENT_SEGMENT_DIR+_0x234f80(0x25b))),console[_0x234f80(0x292)](a29_0x2d2d64['dim'](_0x234f80(0x21b)+LEGACY_PARENT_SEGMENT_DIR+_0x234f80(0x1d1))),![];console[_0x234f80(0x292)](a29_0x2d2d64['yellow']('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20→\x20'+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a29_0x2d2d64[_0x234f80(0x1b5)](_0x234f80(0x1b6)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x563977){const _0x5d94f9=_0x563977 instanceof Error?_0x563977[_0x234f80(0x1e0)]:String(_0x563977);return console[_0x234f80(0x292)](a29_0x2d2d64[_0x234f80(0x29b)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x5d94f9+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a29_0x1bdc06(0x20f)](_0xde9639){return migrateLegacyDirectory(),super['run'](_0xde9639);}}function resolveYamlFile(_0x322cdd){const _0xa6acb7=a29_0x1bdc06;if(_0x322cdd[_0xa6acb7(0x1bd)](_0xa6acb7(0x29c))||_0x322cdd[_0xa6acb7(0x1bd)](_0xa6acb7(0x272)))return _0x322cdd;return a29_0x583eca[_0xa6acb7(0x237)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x322cdd)+_0xa6acb7(0x29c));}function formatProgressMessage(_0x4ab595){const _0x2a22c3=a29_0x1bdc06,_0x249b91=_0x4ab595['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x249b91){const [,_0x13a33e,_0xe3e906,_0x1217c5='']=_0x249b91;return a29_0x2d2d64['dim'](_0x13a33e+':')+'\x20'+_0xe3e906+a29_0x2d2d64[_0x2a22c3(0x2a2)](_0x1217c5);}return a29_0x2d2d64[_0x2a22c3(0x2a2)](_0x4ab595);}function a29_0x52bc(){const _0x27b9da=['isDirectory','526514TYYGeF','elapsedTimeMillis','396979QacvSD','✔\x20No\x20changes\x20-\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','yes','\x20Configuration\x20is\x20valid','format','updateParent','green','✔\x20Renamed\x20directory\x20to\x20','all','\x27\x20and\x20run\x20workflow?','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','foreignKey','segment','map','endsWith','pushParentYaml','Coverage:','FINISHED','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','segment:parent:create','segment:parent:preview','\x20No\x20changes\x20-\x20','Fetching\x20SQL\x20for\x20\x27','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','replace','addBehaviors','sampleData','scheduleType','behavior','\x20is\x20already\x20up\x20to\x20date','Fetching\x20parent\x20segment\x20\x27','length','Updating','information_schema','/\x20directory.\x0a','attributesFile','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','column','\x0a⚠️\x20\x20Both\x20','xdg-open','✔\x20Found\x20','log','Errors:','\x20Opening\x20','darwin','matchedCount','name','`\x20to\x20download\x20the\x20configuration\x20first','\x20--behavior\x20\x22<name>\x22','message','\x0aChanges\x20to\x20apply\x20to\x20\x27','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','repeat','cyan','8qyMkMW','toLocaleString','\x20parent\x20segment\x20\x27','Attempt:','2DfnUzn','Rows:','schemaValid','✔\x20Created\x20parent\x20segment\x20\x27','SQL\x20query:\x0a','customerGroup','Overwrite\x20\x27','/\x20and\x20','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','text','label','\x20--behavior\x20\x22','\x20--enriched','\x0aChanges\x20to\x20\x27','Master\x20Table','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','resolveParentId','totalEvents','description','open','parent_segment','Error:\x20File\x20not\x20found:\x20','toFixed','audienceId','rowCount','Creating','addBehaviorsFile','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','Customers:','Validating\x20configuration...','jobId','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','segment:parent:list','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','run','\x20rows)','Updating\x20parent\x20segment\x20\x27','To\x20view\x20sample\x20data:','1248816MrRzeD','20GTqAOl','database','verbose','Name:\x20','\x27...','attributes','data','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Creating\x20parent\x20segment\x20\x27','\x20--attribute\x20\x22<name>\x22','\x0aNew\x20parent\x20segment\x20\x27','✔\x20Query\x20completed:\x20Processed\x20','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','string','stats','/app/dw/parentSegments/','Error\x20reading\x20file:\x20','Pattern:\x20','/attempt/','Error:','Master\x20+\x20Attributes','To\x20cancel:','Error:\x20--behavior\x20requires\x20a\x20name\x0a','start','460436mBpvcO','displayValidateResults','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','utf-8','parentSegment','Error\x20parsing\x20YAML:\x20','getParentSQL','listFields','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Attributes','join','Attribute:','Create\x20parent\x20segment\x20\x27','attribute','apply','Listing\x20parent\x20segments...','displayBehaviorsStats','execute','/{name}.yml\x0a','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Events:','\x5c$&','tdx\x20segment\x20parent\x20preview\x20','👥\x20','segment:parent:fields','Available\x20attributes:','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','columns','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','ignore','Output\x20file:\x20','segment:parent:validate','coveragePercent','Analyzing\x20changes...','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','yellow','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','displaySampleData','getParentFull','limit','interval','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','sort','json','scheduleOption','/\x20directories\x20exist.','output','\x20Context\x20set:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','9027222byxUJP','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Preview:','Audience\x20ID:','runParent','\x20field','workflowSessionId','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','enriched','Master:','preview','Session:','population','segment:parent:run','double','Site:\x20','Listing\x20parent\x20segments\x20matching\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Created','.yaml','Error:\x20--database\x20and\x20--table\x20are\x20required','Fetching\x20sample\x20data...','processedRows','Parent\x20segment:\x20','Resolving\x20parent\x20segment\x20\x27','displayPreviewHints','✔\x20Updated\x20parent\x20segment\x20\x27','Show\x20parent\x20segment\x20schema\x20(column\x20types)','use','segment:parent:sql','Options\x20(one\x20required):\x0a','master','jsonl','Source:','setJobId','segment:parent:update','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','Available\x20behaviors:','Error:\x20Parent\x20segment\x20name\x20is\x20required','schemaError','List\x20parent\x20segments','workflowAttemptId','addAttributesFile','\x20tdx\x20wf\x20attempt\x20','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','site','allValid','/sessions/','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Error:\x20--attribute\x20requires\x20a\x20name\x0a','\x0aUsage:\x20tdx\x20ps\x20preview\x20','error','\x20=\x20','customersWithEvents','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','displayMasterInfo','dirname','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','displayPreviewResults','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','red','.yml','YAML\x20file:\x20','\x20rows\x20','customerPercent','test','7772639AVoSCf','dim','%)\x20','Options:\x0a','bold','\x20--attribute\x20\x22','12029130atPzmu','List\x20available\x20fields\x20for\x20segmentation','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','Join:','keys','segment:parent:view','unref','web','-1d','\x0aNo\x20sample\x20data\x20available','Status:','displayAttributesStats','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Executing\x20parent\x20segment\x20query...','110YecGgC','stop','Options:','Aborted.','errors','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Listing\x20fields\x20for\x20\x27','joinKey','previewParentYaml','\x20kill','Table:\x20','Enriched:','win32','segment:parent:pull','displaySummary','timezone','Apply\x20changes\x20to\x20\x27','customerGroupFile','behaviors','table','Behavior:','Behaviors','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Found\x20YAML\x20file:\x20'];a29_0x52bc=function(){return _0x27b9da;};return a29_0x52bc();}function showFileNotFoundError(_0x2b7e9b,_0x1a6d48){const _0x52ce34=a29_0x1bdc06;console[_0x52ce34(0x292)](a29_0x2d2d64['red'](_0x52ce34(0x1ff)+_0x2b7e9b+'\x0a')),console[_0x52ce34(0x292)](a29_0x2d2d64['cyan'](_0x52ce34(0x22e)+_0x1a6d48+_0x52ce34(0x1de)));}function showParentSegmentNotSetError(_0x9e6eaf){const _0x475608=a29_0x1bdc06;console[_0x475608(0x292)](a29_0x2d2d64[_0x475608(0x251)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x475608(0x292)](_0x9e6eaf);}export class ParentSegmentListCommand extends BaseCommand{['name']=a29_0x1bdc06(0x20d);[a29_0x1bdc06(0x1fc)]=a29_0x1bdc06(0x287);async[a29_0x1bdc06(0x23e)](_0x5e6482){const _0x45af32=a29_0x1bdc06,{options:_0x16d6b3,args:_0x4deafd,tdx:_0x590919}=_0x5e6482,_0x177692=_0x4deafd[0x0];_0x16d6b3[_0x45af32(0x216)]&&(console[_0x45af32(0x292)]('Site:\x20'+_0x16d6b3[_0x45af32(0x28c)]),_0x177692&&console[_0x45af32(0x292)](_0x45af32(0x225)+_0x177692));const _0x58d6c5=await withSpinner(_0x177692?_0x45af32(0x26f)+_0x177692+_0x45af32(0x218):_0x45af32(0x23c),()=>_0x590919[_0x45af32(0x1bb)]['listParents'](),{'verbose':_0x16d6b3[_0x45af32(0x216)]});let _0x5f19e1=_0x58d6c5[_0x45af32(0x21a)];if(_0x177692){const _0x4c411e=_0x177692['replace'](/[.+^${}()|[\]\\]/g,_0x45af32(0x242))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x425d46=new RegExp('^'+_0x4c411e+'$','i');_0x5f19e1=_0x5f19e1['filter'](_0x4a13c1=>_0x425d46[_0x45af32(0x2a0)](_0x4a13c1[_0x45af32(0x219)][_0x45af32(0x1dd)]));}_0x5f19e1[_0x45af32(0x258)]((_0x2f12f5,_0x1556a3)=>_0x2f12f5[_0x45af32(0x219)][_0x45af32(0x1dd)]['localeCompare'](_0x1556a3[_0x45af32(0x219)][_0x45af32(0x1dd)])),console[_0x45af32(0x292)](_0x45af32(0x1d7)+_0x5f19e1[_0x45af32(0x1ce)]+'\x20parent\x20segment'+(_0x5f19e1[_0x45af32(0x1ce)]!==0x1?'s':''));if(_0x16d6b3['format']===_0x45af32(0x259)||_0x16d6b3['format']===_0x45af32(0x27f))await handleSDKOutput(_0x5f19e1,_0x16d6b3);else{if(_0x5f19e1['length']===0x0)_0x177692?console[_0x45af32(0x1d8)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x177692):console[_0x45af32(0x1d8)]('No\x20parent\x20segments\x20found');else for(const _0xfa9692 of _0x5f19e1){const _0x28cbc4=_0xfa9692[_0x45af32(0x219)][_0x45af32(0x26b)]?a29_0x2d2d64[_0x45af32(0x2a2)]('\x20('+formatRows(_0xfa9692['attributes'][_0x45af32(0x26b)])+')'):'';console[_0x45af32(0x1d8)](_0x45af32(0x244)+_0xfa9692[_0x45af32(0x219)]['name']+_0x28cbc4);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a29_0x1bdc06(0x1dd)]=a29_0x1bdc06(0x1c2);['description']=a29_0x1bdc06(0x1c6);async[a29_0x1bdc06(0x23e)](_0x3aaf9c){const _0x4b42d7=a29_0x1bdc06,{options:_0x338783,args:_0x4c6aaa,tdx:_0x4412ce}=_0x3aaf9c;console[_0x4b42d7(0x292)](_0x4b42d7(0x240)+_0x4b42d7(0x207)+_0x4b42d7(0x1f8));const _0x3c2376=_0x338783;if(_0x4c6aaa[_0x4b42d7(0x1ce)]===0x0)return console[_0x4b42d7(0x292)](a29_0x2d2d64[_0x4b42d7(0x29b)](_0x4b42d7(0x285))),console[_0x4b42d7(0x292)](_0x4b42d7(0x24a)),0x1;const _0x3fb39e=_0x4c6aaa[0x0];if(!_0x3c2376[_0x4b42d7(0x215)]||!_0x3c2376[_0x4b42d7(0x1a5)])return console[_0x4b42d7(0x292)](_0x4b42d7(0x273)),console[_0x4b42d7(0x292)](_0x4b42d7(0x24a)),0x1;_0x3c2376['verbose']&&(console[_0x4b42d7(0x292)](_0x4b42d7(0x26e)+_0x3c2376[_0x4b42d7(0x28c)]),console[_0x4b42d7(0x292)](_0x4b42d7(0x217)+_0x3fb39e),console['error']('Database:\x20'+_0x3c2376[_0x4b42d7(0x215)]),console[_0x4b42d7(0x292)](_0x4b42d7(0x2c1)+_0x3c2376[_0x4b42d7(0x1a5)]));const _0x267976=await loadJSONFromOptions(_0x3c2376[_0x4b42d7(0x219)],_0x3c2376[_0x4b42d7(0x1d2)]),_0x1c3058=await loadJSONFromOptions(_0x3c2376[_0x4b42d7(0x1a4)],_0x3c2376['behaviorsFile']),_0x30f502=await loadJSONFromOptions(_0x3c2376['customerGroup'],_0x3c2376[_0x4b42d7(0x1a3)]),_0x20e324={'name':_0x3fb39e,'description':_0x3c2376['description'],'scheduleType':_0x3c2376['scheduleType'],'scheduleOption':_0x3c2376[_0x4b42d7(0x25a)],'timezone':_0x3c2376['timezone'],'master':{'parentDatabaseName':_0x3c2376['database'],'parentTableName':_0x3c2376['table']},'attributes':_0x267976,'behaviors':_0x1c3058,'customerGroup':_0x30f502},_0x3c4198=await withSpinner(_0x4b42d7(0x21c)+_0x3fb39e+_0x4b42d7(0x218),()=>_0x4412ce[_0x4b42d7(0x1bb)]['createParent'](_0x20e324),{'verbose':_0x338783[_0x4b42d7(0x216)]}),_0x5da1b7=_0x3c4198[_0x4b42d7(0x21a)];return console['error'](_0x4b42d7(0x1ec)+_0x5da1b7[_0x4b42d7(0x1dd)]+'\x27\x20with\x20ID:\x20'+_0x5da1b7['id']),await handleSDKOutput([_0x5da1b7],_0x338783),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a29_0x1bdc06(0x1dd)]=a29_0x1bdc06(0x282);[a29_0x1bdc06(0x1fc)]=a29_0x1bdc06(0x266);async['execute'](_0x19d9cf){const _0x4e0cf7=a29_0x1bdc06,{options:_0x37c281,args:_0x1b405f,tdx:_0x1c0d28}=_0x19d9cf;console[_0x4e0cf7(0x292)](_0x4e0cf7(0x260)+_0x4e0cf7(0x207)+_0x4e0cf7(0x1f8));const _0x329e0e=_0x37c281;if(_0x1b405f['length']===0x0)return console[_0x4e0cf7(0x292)](a29_0x2d2d64[_0x4e0cf7(0x29b)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x4e0cf7(0x292)](_0x4e0cf7(0x2a9)),0x1;const _0x6f4d44=_0x1b405f[0x0];_0x329e0e['verbose']&&(console[_0x4e0cf7(0x292)](_0x4e0cf7(0x26e)+_0x329e0e[_0x4e0cf7(0x28c)]),console[_0x4e0cf7(0x292)](_0x4e0cf7(0x276)+_0x6f4d44));const _0x23b4f1=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x6f4d44+_0x4e0cf7(0x218),()=>_0x1c0d28[_0x4e0cf7(0x1bb)][_0x4e0cf7(0x254)](_0x6f4d44),{'verbose':_0x329e0e[_0x4e0cf7(0x216)]}),_0x1a6492=_0x23b4f1['data'],_0x11a2d0=await loadJSONFromOptions(_0x329e0e['addAttributes'],_0x329e0e[_0x4e0cf7(0x289)]),_0x46beae=await loadJSONFromOptions(_0x329e0e[_0x4e0cf7(0x1c8)],_0x329e0e[_0x4e0cf7(0x204)]),_0x3a827b={'name':_0x1a6492['name'],'description':_0x329e0e[_0x4e0cf7(0x1fc)]!==undefined?_0x329e0e[_0x4e0cf7(0x1fc)]:_0x1a6492[_0x4e0cf7(0x1fc)],'scheduleType':_0x329e0e[_0x4e0cf7(0x1ca)]!==undefined?_0x329e0e[_0x4e0cf7(0x1ca)]:_0x1a6492[_0x4e0cf7(0x1ca)],'scheduleOption':_0x329e0e[_0x4e0cf7(0x25a)]!==undefined?_0x329e0e[_0x4e0cf7(0x25a)]:_0x1a6492['scheduleOption'],'timezone':_0x329e0e[_0x4e0cf7(0x2c6)]!==undefined?_0x329e0e[_0x4e0cf7(0x2c6)]:_0x1a6492['timezone'],'master':_0x1a6492[_0x4e0cf7(0x27e)],'attributes':_0x11a2d0?[..._0x1a6492[_0x4e0cf7(0x219)]||[],..._0x11a2d0]:_0x1a6492[_0x4e0cf7(0x219)],'behaviors':_0x46beae?[..._0x1a6492[_0x4e0cf7(0x1a4)]||[],..._0x46beae]:_0x1a6492[_0x4e0cf7(0x1a4)],'customerGroup':_0x1a6492[_0x4e0cf7(0x1ee)]},_0x1533da=await withSpinner(_0x4e0cf7(0x211)+_0x6f4d44+_0x4e0cf7(0x218),()=>_0x1c0d28[_0x4e0cf7(0x1bb)][_0x4e0cf7(0x1b4)](_0x6f4d44,_0x3a827b),{'verbose':_0x329e0e[_0x4e0cf7(0x216)]}),_0x2fdc84=_0x1533da[_0x4e0cf7(0x21a)];return console[_0x4e0cf7(0x292)](_0x4e0cf7(0x279)+_0x2fdc84[_0x4e0cf7(0x1dd)]+'\x27'),await handleSDKOutput([_0x2fdc84],_0x329e0e),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a29_0x1bdc06(0x1dd)]=a29_0x1bdc06(0x2c4);[a29_0x1bdc06(0x1fc)]=a29_0x1bdc06(0x298);async[a29_0x1bdc06(0x23e)](_0x21ba0b){const _0x4c1560=a29_0x1bdc06,{options:_0x4e5ffa,args:_0x3a0efc,tdx:_0x15c0d6}=_0x21ba0b,_0x8ca58f=_0x4e5ffa,_0x5bde5e=_0x3a0efc[0x0]||_0x4e5ffa['parentSegment'];if(!_0x5bde5e)return showParentSegmentNotSetError(_0x4c1560(0x250)+_0x4c1560(0x1af)),0x1;if(_0x8ca58f[_0x4c1560(0x27b)]&&_0x8ca58f['output'])return console[_0x4c1560(0x292)](a29_0x2d2d64[_0x4c1560(0x29b)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x4c1560(0x292)](a29_0x2d2d64[_0x4c1560(0x2a2)](_0x4c1560(0x1b0))),console[_0x4c1560(0x292)](a29_0x2d2d64[_0x4c1560(0x2a2)]('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x4c1560(0x23f))),console[_0x4c1560(0x292)](a29_0x2d2d64[_0x4c1560(0x1e4)](_0x4c1560(0x252))),0x1;const _0xa1a564=_0x8ca58f[_0x4c1560(0x25c)]||a29_0x583eca[_0x4c1560(0x237)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x5bde5e)+_0x4c1560(0x29c));_0x8ca58f[_0x4c1560(0x216)]&&(console[_0x4c1560(0x292)](_0x4c1560(0x26e)+_0x8ca58f['site']),console[_0x4c1560(0x292)]('Parent\x20segment:\x20'+_0x5bde5e),console[_0x4c1560(0x292)](_0x4c1560(0x24c)+_0xa1a564));const _0x2b7a87=await withSpinner(_0x4c1560(0x1cd)+_0x5bde5e+_0x4c1560(0x218),()=>_0x15c0d6[_0x4c1560(0x1bb)]['pullParentYaml'](_0x5bde5e),{'verbose':_0x8ca58f[_0x4c1560(0x216)]}),_0x27949a=_0x2b7a87[_0x4c1560(0x21a)];if(existsSync(_0xa1a564)){const _0x90ffde=readFileSync(_0xa1a564,_0x4c1560(0x230)),_0x17d71f=generateDiff(_0x90ffde,_0x27949a);if(!hasChanges(_0x17d71f))console[_0x4c1560(0x292)](a29_0x2d2d64[_0x4c1560(0x1b5)]('✔')+_0x4c1560(0x1c4)+a29_0x2d2d64[_0x4c1560(0x1e4)](_0xa1a564)+_0x4c1560(0x1cc));else{console[_0x4c1560(0x292)](_0x4c1560(0x1f6)+_0xa1a564+'\x27:'),console['error']('─'[_0x4c1560(0x1e3)](0x3c)),console['error'](formatDiffWithColors(_0x17d71f)),console[_0x4c1560(0x292)]('─'[_0x4c1560(0x1e3)](0x3c));if(!_0x8ca58f[_0x4c1560(0x1b1)]){const _0x11012b=await confirmKey(_0x4c1560(0x1ef)+_0xa1a564+'\x27?');if(!_0x11012b)return console[_0x4c1560(0x292)](_0x4c1560(0x2ba)),0x1;}writeFileSync(_0xa1a564,_0x27949a,'utf-8'),console['error'](a29_0x2d2d64[_0x4c1560(0x1b5)]('✔')+_0x4c1560(0x257)+a29_0x2d2d64[_0x4c1560(0x1e4)](_0xa1a564));}}else{const _0x25f682=a29_0x583eca[_0x4c1560(0x297)](_0xa1a564);!existsSync(_0x25f682)&&mkdirSync(_0x25f682,{'recursive':!![]}),writeFileSync(_0xa1a564,_0x27949a,_0x4c1560(0x230)),console[_0x4c1560(0x292)](a29_0x2d2d64['green']('✔')+_0x4c1560(0x257)+a29_0x2d2d64[_0x4c1560(0x1e4)](_0xa1a564));}return saveSessionContext({'parent_segment':_0x5bde5e},_0x8ca58f['session']),console[_0x4c1560(0x292)](a29_0x2d2d64[_0x4c1560(0x1b5)]('✔')+_0x4c1560(0x25d)+a29_0x2d2d64[_0x4c1560(0x2a2)](_0x4c1560(0x1fe))+_0x4c1560(0x293)+a29_0x2d2d64['cyan'](_0x5bde5e)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a29_0x1bdc06(0x1dd)]='segment:parent:push';[a29_0x1bdc06(0x1fc)]=a29_0x1bdc06(0x20e);async['execute'](_0x36b7fd){const _0x2e5e8b=a29_0x1bdc06,{options:_0x5486f0,args:_0x3ad309,tdx:_0x1c13b7}=_0x36b7fd,_0x2185cc=_0x5486f0,_0xa08233=_0x3ad309[0x0]||_0x5486f0['parentSegment'];if(!_0xa08233)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'+_0x2e5e8b(0x1b9)),0x1;const _0x315bc5=resolveYamlFile(_0xa08233);if(!existsSync(_0x315bc5))return showFileNotFoundError(_0x315bc5,_0xa08233),0x1;_0x2185cc[_0x2e5e8b(0x216)]&&(console[_0x2e5e8b(0x292)](_0x2e5e8b(0x26e)+_0x2185cc['site']),console[_0x2e5e8b(0x292)](_0x2e5e8b(0x29d)+_0x315bc5));let _0xbf2528;try{_0xbf2528=readFileSync(_0x315bc5,_0x2e5e8b(0x230));}catch(_0xbce452){const _0x2e161b=_0xbce452 instanceof Error?_0xbce452[_0x2e5e8b(0x1e0)]:String(_0xbce452);return console[_0x2e5e8b(0x292)](_0x2e5e8b(0x224)+_0x2e161b),0x1;}const _0x142148=await withSpinner(_0x2e5e8b(0x24f),()=>_0x1c13b7[_0x2e5e8b(0x1bb)][_0x2e5e8b(0x1be)](_0xbf2528),{'verbose':_0x2185cc[_0x2e5e8b(0x216)]}),_0x5e0f4e=_0x142148[_0x2e5e8b(0x21a)],{isNew:_0x2b899c,name:_0x1ff284,hasChanges:_0x1d21db,diffFormatted:_0x1adeca}=_0x5e0f4e;if(!_0x1d21db)return console[_0x2e5e8b(0x292)](_0x2e5e8b(0x1ae)+_0x1ff284+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x2b899c?console[_0x2e5e8b(0x292)](_0x2e5e8b(0x21e)+_0x1ff284+'\x27:'):console[_0x2e5e8b(0x292)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x1ff284+'\x27:');console[_0x2e5e8b(0x292)]('─'['repeat'](0x3c)),console[_0x2e5e8b(0x292)](_0x1adeca),console['error']('─'[_0x2e5e8b(0x1e3)](0x3c));const _0x2950b7=_0x2b899c?'Create\x20parent\x20segment\x20\x27'+_0x1ff284+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x1ff284+'\x27?';if(!_0x2185cc['yes']){const _0x3206de=await confirmKey(_0x2950b7);if(!_0x3206de)return console[_0x2e5e8b(0x292)](_0x2e5e8b(0x2ba)),0x1;}const _0x5e4bb1=_0x2b899c?_0x2e5e8b(0x203):_0x2e5e8b(0x1cf),_0xbb68f0=await withSpinner(_0x5e4bb1+_0x2e5e8b(0x1e7)+_0x1ff284+_0x2e5e8b(0x218),()=>_0x5e0f4e[_0x2e5e8b(0x23b)](),{'verbose':_0x2185cc[_0x2e5e8b(0x216)]}),_0x5cdf35=_0xbb68f0[_0x2e5e8b(0x21a)],_0x43c123=getConsoleNextUrl(_0x2185cc['site'],'/app/dw/parentSegments/'+_0x5cdf35['id']),_0x4bff13=_0x2b899c?_0x2e5e8b(0x271):'Updated';return console['error']('✔\x20'+_0x4bff13+'\x20parent\x20segment\x20\x27'+_0x5cdf35[_0x2e5e8b(0x1dd)]+'\x27'),console['error']('\x20\x20'+_0x43c123),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a29_0x1bdc06(0x24d);[a29_0x1bdc06(0x1fc)]=a29_0x1bdc06(0x28b);async[a29_0x1bdc06(0x23e)](_0x5fb112){const _0x2dcf10=a29_0x1bdc06,{options:_0x74136e,args:_0x282bc7,tdx:_0x54dd8e}=_0x5fb112,_0x1f0e48=_0x74136e,_0x2dbd0c=_0x282bc7[0x0]||_0x74136e[_0x2dcf10(0x231)];if(!_0x2dbd0c)return showParentSegmentNotSetError(_0x2dcf10(0x1e2)+_0x2dcf10(0x249)+_0x2dcf10(0x2a4)+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+_0x2dcf10(0x22f)+_0x2dcf10(0x295)),0x1;const _0x8282a6=resolveYamlFile(_0x2dbd0c);if(!existsSync(_0x8282a6))return showFileNotFoundError(_0x8282a6,_0x2dbd0c),0x1;_0x1f0e48[_0x2dcf10(0x216)]&&(console['error']('Site:\x20'+_0x1f0e48[_0x2dcf10(0x28c)]),console[_0x2dcf10(0x292)](_0x2dcf10(0x29d)+_0x8282a6));let _0x480b3c;try{_0x480b3c=readFileSync(_0x8282a6,_0x2dcf10(0x230));}catch(_0xef198e){const _0x3d31e9=_0xef198e instanceof Error?_0xef198e['message']:String(_0xef198e);return console[_0x2dcf10(0x292)](_0x2dcf10(0x224)+_0x3d31e9),0x1;}const _0x556870=createCommandSpinner(a29_0x2d2d64[_0x2dcf10(0x2a2)](_0x2dcf10(0x20a)),{'verbose':_0x1f0e48[_0x2dcf10(0x216)]});_0x556870[_0x2dcf10(0x22b)]();const _0x51f12f={'onProgress':_0x26eb0e=>{_0x556870['text']=formatProgressMessage(_0x26eb0e);}};if(_0x1f0e48[_0x2dcf10(0x27e)])_0x51f12f[_0x2dcf10(0x27e)]=!![];if(_0x1f0e48[_0x2dcf10(0x267)])_0x51f12f[_0x2dcf10(0x267)]=!![];_0x1f0e48[_0x2dcf10(0x23a)]&&(_0x51f12f[_0x2dcf10(0x23a)]=_0x1f0e48[_0x2dcf10(0x23a)]);_0x1f0e48[_0x2dcf10(0x1cb)]&&(_0x51f12f[_0x2dcf10(0x1cb)]=_0x1f0e48[_0x2dcf10(0x1cb)]);if(_0x1f0e48['interval'])_0x51f12f[_0x2dcf10(0x256)]=_0x1f0e48['interval'];let _0x28a144;try{_0x28a144=await _0x54dd8e[_0x2dcf10(0x1bb)]['validateParentYaml'](_0x480b3c,_0x51f12f),_0x556870['stop']();}catch(_0x5a9861){_0x556870['stop']();throw _0x5a9861;}const _0x1a89c8=_0x1f0e48[_0x2dcf10(0x256)]||'-1d';return this[_0x2dcf10(0x22d)](_0x28a144,_0x51f12f,_0x8282a6,_0x1a89c8),_0x28a144['allValid']?0x0:0x1;}[a29_0x1bdc06(0x22d)](_0x527932,_0x56be13,_0xe463ba,_0x407fc9){const _0x40468f=a29_0x1bdc06;console[_0x40468f(0x292)]('\x0a'+a29_0x2d2d64[_0x40468f(0x2a5)]('Validate:')+'\x20'+_0x527932[_0x40468f(0x1dd)]),console[_0x40468f(0x292)]('═'[_0x40468f(0x1e3)](0x3c)),this[_0x40468f(0x296)](_0x527932);if(typeof _0x56be13[_0x40468f(0x23a)]===_0x40468f(0x221)){this['displayAttributesStats'](_0x527932),this[_0x40468f(0x2c5)](_0x527932),this[_0x40468f(0x278)](_0xe463ba,_0x407fc9,_0x40468f(0x23a),_0x56be13['attribute']);return;}if(_0x56be13[_0x40468f(0x23a)]===!![]){this[_0x40468f(0x2b3)](_0x527932),this[_0x40468f(0x2c5)](_0x527932),this[_0x40468f(0x278)](_0xe463ba,_0x407fc9,'attributes');return;}if(typeof _0x56be13[_0x40468f(0x1cb)]===_0x40468f(0x221)){this['displayBehaviorsStats'](_0x527932,_0x407fc9),this[_0x40468f(0x2c5)](_0x527932),this[_0x40468f(0x278)](_0xe463ba,_0x407fc9,_0x40468f(0x1cb),_0x56be13['behavior']);return;}if(_0x56be13[_0x40468f(0x1cb)]===!![]){this[_0x40468f(0x23d)](_0x527932,_0x407fc9),this[_0x40468f(0x2c5)](_0x527932),this[_0x40468f(0x278)](_0xe463ba,_0x407fc9,_0x40468f(0x1a4));return;}this[_0x40468f(0x2b3)](_0x527932),this[_0x40468f(0x23d)](_0x527932,_0x407fc9),this['displaySummary'](_0x527932),this[_0x40468f(0x278)](_0xe463ba,_0x407fc9,_0x40468f(0x1b7));}['displayPreviewHints'](_0x29abbb,_0xeab634,_0x5186a4,_0x4a26af){const _0x54182d=a29_0x1bdc06;console[_0x54182d(0x292)]('\x0a'+a29_0x2d2d64['dim'](_0x54182d(0x212)));const _0x5e7126=_0xeab634!==_0x54182d(0x2b0)?'\x20--interval\x20'+_0xeab634:'';if(_0x5186a4===_0x54182d(0x23a)&&_0x4a26af)console['error']('\x20\x20'+a29_0x2d2d64[_0x54182d(0x2a2)](_0x54182d(0x243)+_0x29abbb+_0x54182d(0x2a6)+_0x4a26af+'\x22'+_0x5e7126));else{if(_0x5186a4===_0x54182d(0x1cb)&&_0x4a26af)console['error']('\x20\x20'+a29_0x2d2d64['dim']('tdx\x20segment\x20parent\x20preview\x20'+_0x29abbb+_0x54182d(0x1f4)+_0x4a26af+'\x22'+_0x5e7126));else(_0x5186a4==='attributes'||_0x5186a4===_0x54182d(0x1b7))&&console[_0x54182d(0x292)]('\x20\x20'+a29_0x2d2d64[_0x54182d(0x2a2)](_0x54182d(0x243)+_0x29abbb+_0x54182d(0x21d)+_0x5e7126));}(_0x5186a4==='behaviors'||_0x5186a4==='all')&&console['error']('\x20\x20'+a29_0x2d2d64[_0x54182d(0x2a2)]('tdx\x20segment\x20parent\x20preview\x20'+_0x29abbb+_0x54182d(0x1df)+_0x5e7126)),_0x5186a4===_0x54182d(0x1b7)&&console[_0x54182d(0x292)]('\x20\x20'+a29_0x2d2d64[_0x54182d(0x2a2)](_0x54182d(0x243)+_0x29abbb+_0x54182d(0x1f5)+_0x5e7126));}[a29_0x1bdc06(0x296)](_0x21d839){const _0x38a891=a29_0x1bdc06,{master:_0x496e0c}=_0x21d839,_0xa4188c=_0x496e0c['schemaValid']?a29_0x2d2d64[_0x38a891(0x1b5)]('✔'):a29_0x2d2d64[_0x38a891(0x29b)]('✘');console['error']('\x0a'+a29_0x2d2d64[_0x38a891(0x2a2)](_0x38a891(0x1f7))),console['error'](_0xa4188c+'\x20'+a29_0x2d2d64[_0x38a891(0x2a5)](_0x496e0c[_0x38a891(0x215)]+'.'+_0x496e0c['table'])),_0x496e0c[_0x38a891(0x1eb)]?_0x496e0c[_0x38a891(0x202)]!==undefined&&console[_0x38a891(0x292)]('\x20\x20'+a29_0x2d2d64[_0x38a891(0x2a2)](_0x38a891(0x1ea))+'\x20'+a29_0x2d2d64['cyan'](formatRows(_0x496e0c[_0x38a891(0x202)]))):console[_0x38a891(0x292)]('\x20\x20'+a29_0x2d2d64[_0x38a891(0x29b)](_0x38a891(0x227))+'\x20'+_0x496e0c[_0x38a891(0x286)]);}[a29_0x1bdc06(0x2b3)](_0x3aa7cb){const _0x3b159c=a29_0x1bdc06;if(_0x3aa7cb[_0x3b159c(0x219)][_0x3b159c(0x1ce)]===0x0)return;console['error']('\x0a'+a29_0x2d2d64['dim'](_0x3b159c(0x236)));for(const _0x530119 of _0x3aa7cb[_0x3b159c(0x219)]){const _0x3b7cdc=_0x530119['schemaValid']?a29_0x2d2d64['green']('✔'):a29_0x2d2d64['red']('✘');let _0x27ee3e='';if(_0x530119[_0x3b159c(0x1eb)]&&_0x530119['matchedCount']!==undefined&&_0x530119['coveragePercent']!==undefined){const _0x431b3b=_0x530119[_0x3b159c(0x24e)][_0x3b159c(0x200)](0x1),_0x5e5c3b=_0x530119['coveragePercent']>=0x50?a29_0x2d2d64['green']:_0x530119[_0x3b159c(0x24e)]>=0x32?a29_0x2d2d64[_0x3b159c(0x251)]:a29_0x2d2d64['red'];_0x27ee3e='\x20'+a29_0x2d2d64[_0x3b159c(0x2a2)](_0x3b159c(0x1bf))+'\x20'+_0x5e5c3b(_0x431b3b+'%')+'\x20('+formatRows(_0x530119[_0x3b159c(0x1dc)])+_0x3b159c(0x210);}console[_0x3b159c(0x292)](_0x3b7cdc+'\x20'+a29_0x2d2d64['bold'](_0x530119['name'])+_0x27ee3e),console['error']('\x20\x20'+a29_0x2d2d64[_0x3b159c(0x2a2)](_0x3b159c(0x280))+'\x20'+a29_0x2d2d64[_0x3b159c(0x2a5)](_0x530119[_0x3b159c(0x215)]+'.'+_0x530119[_0x3b159c(0x1a5)]));const _0x10ed0a=_0x530119[_0x3b159c(0x2be)]===_0x530119['foreignKey']?a29_0x2d2d64[_0x3b159c(0x2a2)]('Join\x20on:')+'\x20'+_0x530119['joinKey']:a29_0x2d2d64[_0x3b159c(0x2a2)](_0x3b159c(0x2ab))+'\x20'+_0x530119['joinKey']+'\x20=\x20'+_0x530119[_0x3b159c(0x1ba)];console['error']('\x20\x20'+_0x10ed0a),console[_0x3b159c(0x292)]('\x20\x20'+a29_0x2d2d64['dim']('Columns:')),this['displayColumns'](_0x530119[_0x3b159c(0x248)]),!_0x530119['schemaValid']&&console[_0x3b159c(0x292)]('\x20\x20'+a29_0x2d2d64[_0x3b159c(0x29b)](_0x3b159c(0x227))+'\x20'+_0x530119[_0x3b159c(0x286)]);}}[a29_0x1bdc06(0x23d)](_0x44aca0,_0x374462){const _0x33a338=a29_0x1bdc06;if(_0x44aca0[_0x33a338(0x1a4)][_0x33a338(0x1ce)]===0x0)return;console[_0x33a338(0x292)]('\x0a'+a29_0x2d2d64['dim'](_0x33a338(0x1a7))+'\x20'+a29_0x2d2d64[_0x33a338(0x2a2)]('('+_0x374462+')'));for(const _0x5c38eb of _0x44aca0[_0x33a338(0x1a4)]){const _0x4bb594=_0x5c38eb[_0x33a338(0x1eb)]?a29_0x2d2d64[_0x33a338(0x1b5)]('✔'):a29_0x2d2d64['red']('✘');let _0x6e6619='';if(_0x5c38eb[_0x33a338(0x1eb)]&&_0x5c38eb[_0x33a338(0x294)]!==undefined&&_0x5c38eb[_0x33a338(0x1fb)]!==undefined){const _0x2612b7=_0x5c38eb[_0x33a338(0x29f)]?.[_0x33a338(0x200)](0x1)||'?',_0x59a92a=(_0x5c38eb[_0x33a338(0x29f)]??0x0)>=0x32?a29_0x2d2d64[_0x33a338(0x1b5)]:(_0x5c38eb[_0x33a338(0x29f)]??0x0)>=0x14?a29_0x2d2d64[_0x33a338(0x251)]:a29_0x2d2d64[_0x33a338(0x29b)];_0x6e6619='\x20'+a29_0x2d2d64[_0x33a338(0x2a2)](_0x33a338(0x209))+'\x20'+_0x59a92a(formatRows(_0x5c38eb[_0x33a338(0x294)]))+'\x20('+_0x2612b7+_0x33a338(0x2a3)+a29_0x2d2d64[_0x33a338(0x2a2)](_0x33a338(0x241))+'\x20'+a29_0x2d2d64[_0x33a338(0x1e4)](formatRows(_0x5c38eb[_0x33a338(0x1fb)]));}console['error'](_0x4bb594+'\x20'+a29_0x2d2d64[_0x33a338(0x2a5)](_0x5c38eb['name'])+_0x6e6619),console[_0x33a338(0x292)]('\x20\x20'+a29_0x2d2d64[_0x33a338(0x2a2)]('Source:')+'\x20'+a29_0x2d2d64['bold'](_0x5c38eb[_0x33a338(0x215)]+'.'+_0x5c38eb[_0x33a338(0x1a5)]));const _0x4112b7=_0x5c38eb[_0x33a338(0x2be)]===_0x5c38eb[_0x33a338(0x1ba)]?a29_0x2d2d64[_0x33a338(0x2a2)]('Join\x20on:')+'\x20'+_0x5c38eb[_0x33a338(0x2be)]:a29_0x2d2d64[_0x33a338(0x2a2)](_0x33a338(0x2ab))+'\x20'+_0x5c38eb[_0x33a338(0x2be)]+_0x33a338(0x293)+_0x5c38eb['foreignKey'];console['error']('\x20\x20'+_0x4112b7),console[_0x33a338(0x292)]('\x20\x20'+a29_0x2d2d64[_0x33a338(0x2a2)]('Columns:')),this['displayColumns'](_0x5c38eb['columns']),!_0x5c38eb[_0x33a338(0x1eb)]&&console['error']('\x20\x20'+a29_0x2d2d64[_0x33a338(0x29b)](_0x33a338(0x227))+'\x20'+_0x5c38eb['schemaError']);}}['displayColumns'](_0x4aefc1){const _0x580e60=a29_0x1bdc06;for(const _0x48b962 of _0x4aefc1){_0x48b962[_0x580e60(0x1f3)]===_0x48b962[_0x580e60(0x1d4)]||_0x48b962[_0x580e60(0x1d4)]==='*'?console['error']('\x20\x20\x20\x20-\x20'+_0x48b962['label']):console[_0x580e60(0x292)]('\x20\x20\x20\x20-\x20'+_0x48b962['label']+'\x20'+a29_0x2d2d64['dim']('('+_0x48b962[_0x580e60(0x1d4)]+')'));}}[a29_0x1bdc06(0x2c5)](_0x4c1c29){const _0x3865d4=a29_0x1bdc06;console[_0x3865d4(0x292)]('─'[_0x3865d4(0x1e3)](0x3c));if(_0x4c1c29[_0x3865d4(0x2bb)][_0x3865d4(0x1ce)]>0x0){console['error']('\x0a'+a29_0x2d2d64['red'](_0x3865d4(0x1d9)));for(const _0x46f7e4 of _0x4c1c29[_0x3865d4(0x2bb)]){console[_0x3865d4(0x292)]('\x20\x20'+a29_0x2d2d64[_0x3865d4(0x29b)]('•')+'\x20'+_0x46f7e4);}}_0x4c1c29['allValid']&&console[_0x3865d4(0x292)]('\x0a'+a29_0x2d2d64['green']('✔')+_0x3865d4(0x1b2));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a29_0x1bdc06(0x1dd)]=a29_0x1bdc06(0x1c3);[a29_0x1bdc06(0x1fc)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async[a29_0x1bdc06(0x23e)](_0xd91291){const _0x350c30=a29_0x1bdc06,{options:_0x2fb35a,args:_0x264588,tdx:_0x3087a4}=_0xd91291,_0x16e0ab=_0x2fb35a,_0x5833ec=_0x264588[0x0]||_0x2fb35a[_0x350c30(0x231)];if(!_0x5833ec)return showParentSegmentNotSetError(_0x350c30(0x1f1)+_0x350c30(0x29a)+_0x350c30(0x27d)+_0x350c30(0x2b5)+_0x350c30(0x247)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x350c30(0x295)),0x1;if(!_0x16e0ab[_0x350c30(0x27e)]&&!_0x16e0ab[_0x350c30(0x23a)]&&!_0x16e0ab[_0x350c30(0x1cb)]&&!_0x16e0ab[_0x350c30(0x267)])return console['error'](a29_0x2d2d64[_0x350c30(0x29b)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x350c30(0x292)](_0x350c30(0x2bc)),console[_0x350c30(0x292)](_0x350c30(0x2b9)),console['error']('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console['error'](_0x350c30(0x235)),console[_0x350c30(0x292)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console['error']('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x949e6d=resolveYamlFile(_0x5833ec);if(!existsSync(_0x949e6d))return showFileNotFoundError(_0x949e6d,_0x5833ec),0x1;_0x16e0ab['verbose']&&(console[_0x350c30(0x292)](_0x350c30(0x26e)+_0x16e0ab['site']),console[_0x350c30(0x292)](_0x350c30(0x29d)+_0x949e6d));let _0x59d227;try{_0x59d227=readFileSync(_0x949e6d,'utf-8');}catch(_0x1ae3ca){const _0x17d0ff=_0x1ae3ca instanceof Error?_0x1ae3ca['message']:String(_0x1ae3ca);return console[_0x350c30(0x292)](_0x350c30(0x224)+_0x17d0ff),0x1;}let _0x5965a1;try{_0x5965a1=parseYamlString(_0x59d227);}catch(_0x17531e){const _0x1e37ce=_0x17531e instanceof Error?_0x17531e[_0x350c30(0x1e0)]:String(_0x17531e);return console[_0x350c30(0x292)](a29_0x2d2d64['red'](_0x350c30(0x232)+_0x1e37ce)),0x1;}if(_0x16e0ab['attribute']===!![]||_0x16e0ab[_0x350c30(0x23a)]===''){const _0x83fe6=_0x5965a1[_0x350c30(0x219)]?.['map'](_0x2b314d=>_0x2b314d[_0x350c30(0x1dd)])||[];if(_0x83fe6['length']===0x0)console[_0x350c30(0x292)](a29_0x2d2d64[_0x350c30(0x29b)](_0x350c30(0x2aa)));else{console[_0x350c30(0x292)](a29_0x2d2d64[_0x350c30(0x29b)](_0x350c30(0x290))),console['error'](_0x350c30(0x246));for(const _0xfa3bcc of _0x83fe6){console['error']('\x20\x20'+a29_0x2d2d64[_0x350c30(0x1e4)](_0xfa3bcc));}console['error']('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x5833ec+_0x350c30(0x2a6)+_0x83fe6[0x0]+'\x22');}return 0x1;}if(_0x16e0ab[_0x350c30(0x1cb)]===!![]||_0x16e0ab[_0x350c30(0x1cb)]===''){const _0x39f3b8=_0x5965a1[_0x350c30(0x1a4)]?.[_0x350c30(0x1bc)](_0x68141b=>_0x68141b[_0x350c30(0x1dd)])||[];if(_0x39f3b8['length']===0x0)console[_0x350c30(0x292)](a29_0x2d2d64[_0x350c30(0x29b)](_0x350c30(0x206)));else{console['error'](a29_0x2d2d64['red'](_0x350c30(0x22a))),console[_0x350c30(0x292)](_0x350c30(0x284));for(const _0x3d7c87 of _0x39f3b8){console['error']('\x20\x20'+a29_0x2d2d64[_0x350c30(0x1e4)](_0x3d7c87));}console[_0x350c30(0x292)](_0x350c30(0x291)+_0x5833ec+_0x350c30(0x1f4)+_0x39f3b8[0x0]+'\x22');}return 0x1;}const _0x39bfed=createCommandSpinner(a29_0x2d2d64[_0x350c30(0x2a2)](_0x350c30(0x274)),{'verbose':_0x16e0ab[_0x350c30(0x216)]});_0x39bfed[_0x350c30(0x22b)]();const _0xec8f2e={'onProgress':_0x2e3269=>{const _0x5b4e4d=_0x350c30;_0x39bfed[_0x5b4e4d(0x1f2)]=formatProgressMessage(_0x2e3269);}};if(_0x16e0ab['master'])_0xec8f2e['master']=!![];if(_0x16e0ab[_0x350c30(0x23a)]&&typeof _0x16e0ab[_0x350c30(0x23a)]===_0x350c30(0x221))_0xec8f2e[_0x350c30(0x23a)]=_0x16e0ab[_0x350c30(0x23a)];if(_0x16e0ab[_0x350c30(0x1cb)]&&typeof _0x16e0ab[_0x350c30(0x1cb)]===_0x350c30(0x221))_0xec8f2e[_0x350c30(0x1cb)]=_0x16e0ab[_0x350c30(0x1cb)];if(_0x16e0ab['enriched'])_0xec8f2e['enriched']=!![];if(_0x16e0ab[_0x350c30(0x256)])_0xec8f2e[_0x350c30(0x256)]=_0x16e0ab[_0x350c30(0x256)];let _0x501149;try{_0x501149=await _0x3087a4[_0x350c30(0x1bb)][_0x350c30(0x2bf)](_0x59d227,_0xec8f2e),_0x39bfed[_0x350c30(0x2b8)]();}catch(_0x189f80){_0x39bfed[_0x350c30(0x2b8)]();throw _0x189f80;}return await this[_0x350c30(0x299)](_0x501149,{'master':_0x16e0ab[_0x350c30(0x27e)],'attribute':typeof _0x16e0ab[_0x350c30(0x23a)]===_0x350c30(0x221)?_0x16e0ab[_0x350c30(0x23a)]:undefined,'behavior':typeof _0x16e0ab['behavior']===_0x350c30(0x221)?_0x16e0ab[_0x350c30(0x1cb)]:undefined,'enriched':_0x16e0ab[_0x350c30(0x267)]}),_0x501149[_0x350c30(0x28d)]?0x0:0x1;}async[a29_0x1bdc06(0x299)](_0x29be02,_0x37e617){const _0x208232=a29_0x1bdc06;console[_0x208232(0x292)]('\x0a'+a29_0x2d2d64[_0x208232(0x2a5)](_0x208232(0x261))+'\x20'+_0x29be02[_0x208232(0x1dd)]),console[_0x208232(0x292)]('═'['repeat'](0x3c));if(_0x37e617['master']&&_0x29be02[_0x208232(0x1c9)]){const _0x26b8a6=a29_0x2d2d64[_0x208232(0x2a2)](_0x208232(0x268))+'\x20'+a29_0x2d2d64['bold'](_0x29be02['master'][_0x208232(0x215)]+'.'+_0x29be02['master'][_0x208232(0x1a5)]);await this[_0x208232(0x253)](_0x26b8a6,_0x29be02[_0x208232(0x1c9)]);}else{if(_0x37e617['attribute']&&_0x29be02[_0x208232(0x1c9)]){const _0x3f6097=a29_0x2d2d64[_0x208232(0x2a2)](_0x208232(0x238))+'\x20'+a29_0x2d2d64[_0x208232(0x2a5)](_0x37e617['attribute']);await this['displaySampleData'](_0x3f6097,_0x29be02[_0x208232(0x1c9)]);}else{if(_0x37e617[_0x208232(0x1cb)]&&_0x29be02[_0x208232(0x1c9)]){const _0x185997=a29_0x2d2d64['dim'](_0x208232(0x1a6))+'\x20'+a29_0x2d2d64[_0x208232(0x2a5)](_0x37e617[_0x208232(0x1cb)]);await this[_0x208232(0x253)](_0x185997,_0x29be02['sampleData']);}else{if(_0x37e617[_0x208232(0x267)]&&_0x29be02[_0x208232(0x1c9)]){const _0x24d47d=a29_0x2d2d64[_0x208232(0x2a2)](_0x208232(0x2c2))+'\x20'+a29_0x2d2d64[_0x208232(0x2a5)](_0x208232(0x228));await this[_0x208232(0x253)](_0x24d47d,_0x29be02[_0x208232(0x1c9)]);}else!_0x29be02[_0x208232(0x1c9)]&&console['error'](_0x208232(0x2b1));}}}if(_0x29be02[_0x208232(0x2bb)][_0x208232(0x1ce)]>0x0){console[_0x208232(0x292)]('─'[_0x208232(0x1e3)](0x3c)),console[_0x208232(0x292)]('\x0a'+a29_0x2d2d64[_0x208232(0x29b)](_0x208232(0x1d9)));for(const _0x431187 of _0x29be02['errors']){console[_0x208232(0x292)]('\x20\x20'+a29_0x2d2d64[_0x208232(0x29b)]('•')+'\x20'+_0x431187);}}}async['displaySampleData'](_0x4b25d6,_0x5a277b){const _0x46a8aa=a29_0x1bdc06;if(_0x5a277b['length']===0x0){console[_0x46a8aa(0x292)]('\x0a'+_0x4b25d6),console['error']('\x20\x20No\x20sample\x20data\x20available');return;}console[_0x46a8aa(0x292)]('\x0a'+_0x4b25d6);const _0x4b895a=Object[_0x46a8aa(0x2ac)](_0x5a277b[0x0])[_0x46a8aa(0x1bc)](_0xf440bd=>({'name':_0xf440bd,'type':typeof _0x5a277b[0x0][_0xf440bd]==='number'?_0x46a8aa(0x26d):'varchar'})),_0x1839a8={'queryId':_0x46a8aa(0x269),'columns':_0x4b895a,'data':_0x5a277b,'stats':{'state':_0x46a8aa(0x1c0),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x5a277b['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x5574c4=formatAsTable(_0x1839a8,_0x5a277b['length'],!![]);await writeOutput(_0x5574c4,undefined,_0x46a8aa(0x1a5));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a29_0x1bdc06(0x26c);[a29_0x1bdc06(0x1fc)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a29_0x1bdc06(0x23e)](_0x18047d){const _0x2e0c98=a29_0x1bdc06,{options:_0x10c617,args:_0x29d12f,tdx:_0x2df8c2}=_0x18047d,_0x260262=_0x10c617,_0x2759f7=_0x29d12f[0x0]||_0x10c617['parentSegment'];if(!_0x2759f7)return showParentSegmentNotSetError(_0x2e0c98(0x1d3)+_0x2e0c98(0x28f)),0x1;const _0x4303a8=resolveYamlFile(_0x2759f7);if(existsSync(_0x4303a8)){_0x260262['verbose']&&console[_0x2e0c98(0x292)](_0x2e0c98(0x1a9)+_0x4303a8);let _0x4a42e9;try{_0x4a42e9=readFileSync(_0x4303a8,_0x2e0c98(0x230));}catch(_0x2298fb){const _0x5da219=_0x2298fb instanceof Error?_0x2298fb[_0x2e0c98(0x1e0)]:String(_0x2298fb);return console[_0x2e0c98(0x292)](_0x2e0c98(0x224)+_0x5da219),0x1;}const _0x4c4065=await withSpinner('Analyzing\x20changes...',()=>_0x2df8c2[_0x2e0c98(0x1bb)]['pushParentYaml'](_0x4a42e9),{'verbose':_0x260262[_0x2e0c98(0x216)]}),_0x49e470=_0x4c4065['data'],{isNew:_0x3b76fc,name:_0x5f593f,hasChanges:_0x22671f,diffFormatted:_0x3459c9}=_0x49e470;if(_0x22671f){_0x3b76fc?console[_0x2e0c98(0x292)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x5f593f+'\x27:'):console['error'](_0x2e0c98(0x1e1)+_0x5f593f+'\x27:');console[_0x2e0c98(0x292)]('─'[_0x2e0c98(0x1e3)](0x3c)),console[_0x2e0c98(0x292)](_0x3459c9),console[_0x2e0c98(0x292)]('─'[_0x2e0c98(0x1e3)](0x3c));const _0x5868a8=_0x3b76fc?_0x2e0c98(0x239)+_0x5f593f+_0x2e0c98(0x1b8):_0x2e0c98(0x1a2)+_0x5f593f+_0x2e0c98(0x1b8);if(!_0x260262['yes']){const _0xbf8542=await confirmKey(_0x5868a8);if(!_0xbf8542)return console[_0x2e0c98(0x292)]('Aborted.'),0x1;}const _0x438ab1=_0x3b76fc?_0x2e0c98(0x203):'Updating';await withSpinner(_0x438ab1+_0x2e0c98(0x1e7)+_0x5f593f+_0x2e0c98(0x218),()=>_0x49e470[_0x2e0c98(0x23b)](),{'verbose':_0x260262[_0x2e0c98(0x216)]});const _0x3da91e=_0x3b76fc?'Created':'Updated';console[_0x2e0c98(0x292)]('✔\x20'+_0x3da91e+_0x2e0c98(0x1e7)+_0x5f593f+'\x27');}else console['error'](_0x2e0c98(0x1ae)+_0x5f593f+'\x27\x20is\x20up\x20to\x20date');}const _0x360f02=await withSpinner(_0x2e0c98(0x283)+_0x2759f7+_0x2e0c98(0x218),()=>_0x2df8c2[_0x2e0c98(0x1bb)][_0x2e0c98(0x263)](_0x2759f7),{'verbose':_0x260262[_0x2e0c98(0x216)]}),_0x4fd7a5=_0x360f02['data'],_0x332d86=getConsoleUrl(_0x260262['site'],'/app/workflows/'+_0x4fd7a5['workflowId']+_0x2e0c98(0x28e)+_0x4fd7a5['workflowSessionId']+_0x2e0c98(0x226)+_0x4fd7a5[_0x2e0c98(0x288)]);return console[_0x2e0c98(0x292)]('\x0a✔\x20Workflow\x20started'),console[_0x2e0c98(0x292)]('\x20\x20'+a29_0x2d2d64[_0x2e0c98(0x2a2)](_0x2e0c98(0x262))+'\x20'+_0x4fd7a5[_0x2e0c98(0x201)]),console[_0x2e0c98(0x292)]('\x20\x20'+a29_0x2d2d64[_0x2e0c98(0x2a2)](_0x2e0c98(0x2b2))+'\x20'+_0x4fd7a5['status']),console[_0x2e0c98(0x292)]('\x20\x20'+a29_0x2d2d64['dim'](_0x2e0c98(0x26a))+'\x20'+_0x4fd7a5[_0x2e0c98(0x265)]),console[_0x2e0c98(0x292)]('\x20\x20'+a29_0x2d2d64[_0x2e0c98(0x2a2)](_0x2e0c98(0x1e8))+'\x20'+_0x4fd7a5[_0x2e0c98(0x288)]),console[_0x2e0c98(0x292)]('\x20\x20'+_0x332d86),console[_0x2e0c98(0x292)]('\x0a'+a29_0x2d2d64[_0x2e0c98(0x2a2)](_0x2e0c98(0x229))+_0x2e0c98(0x28a)+_0x4fd7a5['workflowAttemptId']+_0x2e0c98(0x2c0)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a29_0x1bdc06(0x1dd)]=a29_0x1bdc06(0x245);[a29_0x1bdc06(0x1fc)]=a29_0x1bdc06(0x2a8);async['execute'](_0x273d4c){const _0x828aa0=a29_0x1bdc06,{options:_0x12d070,args:_0x2a8b4e,tdx:_0x39bec1}=_0x273d4c,_0x487f37=_0x2a8b4e[0x0]||_0x12d070['parentSegment'];if(!_0x487f37)return showParentSegmentNotSetError(_0x828aa0(0x1f9)+_0x828aa0(0x25e)),0x1;_0x12d070[_0x828aa0(0x216)]&&(console['error'](_0x828aa0(0x26e)+_0x12d070[_0x828aa0(0x28c)]),console[_0x828aa0(0x292)](_0x828aa0(0x276)+_0x487f37));const _0x145ab4=await withSpinner(_0x828aa0(0x2bd)+_0x487f37+'\x27...',()=>_0x39bec1['segment'][_0x828aa0(0x234)](_0x487f37),{'verbose':_0x12d070[_0x828aa0(0x216)]}),_0x31af5c=_0x145ab4['data'];console['error'](_0x828aa0(0x1d7)+_0x31af5c['length']+_0x828aa0(0x264)+(_0x31af5c[_0x828aa0(0x1ce)]!==0x1?'s':''));if(_0x12d070['json']||_0x12d070['jsonl'])return await handleSDKOutput(_0x31af5c,_0x12d070),0x0;return displayFieldsHumanReadable(_0x31af5c,_0x487f37),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a29_0x1bdc06(0x2ad);[a29_0x1bdc06(0x1fc)]='Show\x20parent\x20segment\x20details';async[a29_0x1bdc06(0x23e)](_0x426b40){const _0x25c46a=a29_0x1bdc06,{options:_0x519de0,args:_0x452b0f,tdx:_0x26f01c}=_0x426b40,_0x402b40=_0x519de0,_0x4f7e96=_0x452b0f[0x0]||_0x519de0[_0x25c46a(0x231)];if(!_0x4f7e96)return showParentSegmentNotSetError(_0x25c46a(0x20c)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+_0x25c46a(0x1c1)),0x1;_0x519de0[_0x25c46a(0x216)]&&(console[_0x25c46a(0x292)](_0x25c46a(0x26e)+_0x519de0['site']),console[_0x25c46a(0x292)]('Parent\x20segment:\x20'+_0x4f7e96));const _0x5945cd=await withSpinner(_0x25c46a(0x1cd)+_0x4f7e96+_0x25c46a(0x218),()=>_0x26f01c[_0x25c46a(0x1bb)][_0x25c46a(0x254)](_0x4f7e96),{'verbose':_0x519de0['verbose']}),_0x512f02=_0x5945cd['data'];if(_0x402b40[_0x25c46a(0x2af)]){const _0x48dfab=getConsoleNextUrl(_0x402b40[_0x25c46a(0x28c)],_0x25c46a(0x223)+_0x512f02['id']);return console['error'](a29_0x2d2d64[_0x25c46a(0x1b5)]('✔')+_0x25c46a(0x1da)+a29_0x2d2d64['cyan'](_0x48dfab)),openBrowser(_0x48dfab),0x0;}return await handleSingleObjectOutput(_0x512f02,_0x519de0),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a29_0x1bdc06(0x1dd)]='segment:parent:desc';[a29_0x1bdc06(0x1fc)]=a29_0x1bdc06(0x27a);async[a29_0x1bdc06(0x23e)](_0x50fe5d){const _0x345603=a29_0x1bdc06,{options:_0x4a27e1,args:_0x2d626f,tdx:_0x36bc6d}=_0x50fe5d,_0x305817=_0x2d626f[0x0]||_0x4a27e1[_0x345603(0x231)];if(!_0x305817)return showParentSegmentNotSetError(_0x345603(0x205)+_0x345603(0x208)),0x1;_0x4a27e1[_0x345603(0x216)]&&(console['error'](_0x345603(0x26e)+_0x4a27e1[_0x345603(0x28c)]),console[_0x345603(0x292)](_0x345603(0x276)+_0x305817));const _0x18084b=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x305817+_0x345603(0x218),()=>_0x36bc6d['segment']['resolveParentId'](_0x305817),{'verbose':_0x4a27e1[_0x345603(0x216)]}),_0x1b8649=_0x18084b['data'],_0x26c8c5=await withSpinner(_0x345603(0x1c5)+_0x305817+_0x345603(0x218),()=>_0x36bc6d['segment'][_0x345603(0x233)](_0x1b8649),{'verbose':_0x4a27e1[_0x345603(0x216)]}),_0x3f4efe=await executeSchemaQuery(_0x26c8c5['data'],_0x36bc6d,_0x4a27e1);return await handleQueryOutput(_0x3f4efe,_0x4a27e1),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a29_0x1bdc06(0x1dd)]=a29_0x1bdc06(0x27c);[a29_0x1bdc06(0x1fc)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async['execute'](_0x4d7a72){const _0x155b01=a29_0x1bdc06,{options:_0x53610b,args:_0xe67eef,tdx:_0x1d54d5}=_0x4d7a72,_0x36e272=_0xe67eef[0x0]||_0x53610b[_0x155b01(0x231)];if(!_0x36e272)return showParentSegmentNotSetError(_0x155b01(0x220)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0x53610b[_0x155b01(0x216)]&&(console['error'](_0x155b01(0x26e)+_0x53610b[_0x155b01(0x28c)]),console[_0x155b01(0x292)](_0x155b01(0x276)+_0x36e272));const _0x367d0b=await withSpinner(_0x155b01(0x277)+_0x36e272+'\x27...',()=>_0x1d54d5[_0x155b01(0x1bb)][_0x155b01(0x1fa)](_0x36e272),{'verbose':_0x53610b['verbose']}),_0x2d265a=_0x367d0b['data'],_0x33e1a9=await withSpinner(_0x155b01(0x1c5)+_0x36e272+_0x155b01(0x218),()=>_0x1d54d5['segment'][_0x155b01(0x233)](_0x2d265a),{'verbose':_0x53610b[_0x155b01(0x216)]}),_0xdd1e13=_0x33e1a9['data'];return _0x53610b[_0x155b01(0x1b3)]===_0x155b01(0x259)||_0x53610b[_0x155b01(0x1b3)]===_0x155b01(0x27f)?await handleSDKOutput([{'sql':_0xdd1e13}],_0x53610b):console[_0x155b01(0x1d8)](_0xdd1e13),0x0;}}function a29_0x2a31(_0x21f2e1,_0x4bbcbc){_0x21f2e1=_0x21f2e1-0x1a2;const _0x52bc93=a29_0x52bc();let _0x2a3151=_0x52bc93[_0x21f2e1];return _0x2a3151;}export class ParentSegmentShowCommand extends BaseCommand{[a29_0x1bdc06(0x1dd)]='segment:parent:show';['description']=a29_0x1bdc06(0x1a8);async[a29_0x1bdc06(0x23e)](_0x398510){const _0x21207c=a29_0x1bdc06,{options:_0x14581f,args:_0x321b01,tdx:_0x1139fd}=_0x398510,_0x22e597=_0x321b01[0x0]||_0x14581f[_0x21207c(0x231)];if(!_0x22e597)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a'+_0x21207c(0x2b4)),0x1;_0x14581f[_0x21207c(0x216)]&&(console[_0x21207c(0x292)](_0x21207c(0x26e)+_0x14581f[_0x21207c(0x28c)]),console[_0x21207c(0x292)]('Parent\x20segment:\x20'+_0x22e597));const _0x4ee436=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x22e597+_0x21207c(0x218),()=>_0x1139fd[_0x21207c(0x1bb)]['resolveParentId'](_0x22e597),{'verbose':_0x14581f[_0x21207c(0x216)]}),_0x45ab62=_0x4ee436[_0x21207c(0x21a)],_0xbdeca=await withSpinner(_0x21207c(0x1c5)+_0x22e597+_0x21207c(0x218),()=>_0x1139fd[_0x21207c(0x1bb)][_0x21207c(0x233)](_0x45ab62),{'verbose':_0x14581f[_0x21207c(0x216)]});let _0x40cd1e=_0xbdeca['data'];const _0x544760=resolveLimit(_0x14581f[_0x21207c(0x255)],DEFAULT_DISPLAY_LIMIT),_0x3a97fe=/\bLIMIT\s+\d+/i[_0x21207c(0x2a0)](_0x40cd1e);!_0x3a97fe&&(_0x40cd1e=_0x40cd1e['trim']()[_0x21207c(0x1c7)](/;+$/,''),_0x40cd1e='SELECT\x20*\x20FROM\x20(\x0a'+_0x40cd1e+_0x21207c(0x270)+_0x544760);_0x14581f[_0x21207c(0x216)]&&console[_0x21207c(0x292)](_0x21207c(0x1ed)+_0x40cd1e);const _0x2f864f=await withQuerySpinner(_0x21207c(0x2b6),async _0x1b0f5f=>{const _0x381370=_0x21207c,_0x3a50ef=await _0x1139fd['query'][_0x381370(0x23e)](_0x40cd1e,{'catalog':'td','schema':_0x381370(0x1d0),'onJobId':_0xe9f9ec=>{const _0x25ae7b=_0x381370;_0x1b0f5f[_0x25ae7b(0x281)](_0xe9f9ec);}});return _0x3a50ef;},{'verbose':_0x14581f['verbose']}),_0x49e6f6=_0x2f864f[_0x21207c(0x21a)],_0x3f9768=_0x49e6f6[_0x21207c(0x20b)]?'\x20[Job\x20ID:\x20'+_0x49e6f6[_0x21207c(0x20b)]+']':'';return console['error'](_0x21207c(0x21f)+_0x49e6f6['stats'][_0x21207c(0x275)][_0x21207c(0x1e6)]()+_0x21207c(0x29e)+('in\x20'+formatElapsed(_0x49e6f6[_0x21207c(0x222)][_0x21207c(0x1ac)])+_0x3f9768)),await handleQueryOutput(_0x49e6f6,_0x14581f),0x0;}}
@@ -1 +1 @@
1
- const a30_0x39e785=a30_0x4dde;(function(_0x550f8f,_0x518052){const _0x40e7b7=a30_0x4dde,_0x5aed69=_0x550f8f();while(!![]){try{const _0x4fc7cb=-parseInt(_0x40e7b7(0xdb))/0x1+parseInt(_0x40e7b7(0xd1))/0x2+-parseInt(_0x40e7b7(0xd4))/0x3+parseInt(_0x40e7b7(0xd6))/0x4+parseInt(_0x40e7b7(0xd7))/0x5*(-parseInt(_0x40e7b7(0xda))/0x6)+-parseInt(_0x40e7b7(0xd8))/0x7+parseInt(_0x40e7b7(0xd3))/0x8*(parseInt(_0x40e7b7(0xcf))/0x9);if(_0x4fc7cb===_0x518052)break;else _0x5aed69['push'](_0x5aed69['shift']());}catch(_0x46fb76){_0x5aed69['push'](_0x5aed69['shift']());}}}(a30_0x7ba1,0x21ab9));function a30_0x7ba1(){const _0x22219d=['275755KKgdDE','name','message','error','profiles','length','execute','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','List\x20all\x20available\x20profiles','4421646lgerFa','config','205666BvTTDB','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','8PiWROi','709287QDvFiR','description','867236vAVNWI','135CGEzoX','673974RRTDJl','log','14346VAvRUQ'];a30_0x7ba1=function(){return _0x22219d;};return a30_0x7ba1();}function a30_0x4dde(_0x5021e7,_0x477f88){_0x5021e7=_0x5021e7-0xcd;const _0x7ba1f0=a30_0x7ba1();let _0x4dde22=_0x7ba1f0[_0x5021e7];return _0x4dde22;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../utils/command-output.js';export class ProfilesCommand extends BaseCommand{[a30_0x39e785(0xdc)]=a30_0x39e785(0xdf);[a30_0x39e785(0xd5)]=a30_0x39e785(0xce);async[a30_0x39e785(0xe1)](_0x714cf){const _0x55c489=a30_0x39e785,{options:_0x54753d}=_0x714cf;try{const _0x5702f3=listProfiles(),_0x31d90f=getActiveProfile();if(_0x5702f3[_0x55c489(0xe0)]===0x0)return console[_0x55c489(0xd9)](_0x55c489(0xd2)),console[_0x55c489(0xd9)](_0x55c489(0xcd)),console[_0x55c489(0xd9)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x533204=_0x5702f3['map'](_0x3fb3e2=>{const _0x41919b=_0x55c489,_0x22084b=_0x3fb3e2[_0x41919b(0xdc)]===_0x31d90f,_0x3e218a=getProfileParams(_0x3fb3e2[_0x41919b(0xd0)]);return{'name':_0x3fb3e2[_0x41919b(0xdc)],'active':_0x22084b,'scope':_0x3fb3e2['scope'],'description':_0x3fb3e2[_0x41919b(0xd0)]['description']||'','params':_0x3e218a};});return await handleSDKOutput(_0x533204,_0x54753d),0x0;}catch(_0x7ac078){return _0x7ac078 instanceof Error&&console[_0x55c489(0xde)]('Error:\x20'+_0x7ac078[_0x55c489(0xdd)]),0x1;}}}
1
+ const a30_0x2e0b55=a30_0x5bc4;function a30_0x2b21(){const _0xcaba62=['212965zljZNk','9905945JiRmTD','message','9278tOkIGN','config','3643340oPMsKs','10210470SZKkxn','1176981TcKZeE','500016waFlEI','Error:\x20','length','name','9auOibd','error','description','profiles','\x20\x20Global:\x20~/.config/tdx/tdx.json','log','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','scope','39lfRgzg','map','228kbbyox'];a30_0x2b21=function(){return _0xcaba62;};return a30_0x2b21();}function a30_0x5bc4(_0x35f372,_0x92bacd){_0x35f372=_0x35f372-0x1b4;const _0x2b2181=a30_0x2b21();let _0x5bc40f=_0x2b2181[_0x35f372];return _0x5bc40f;}(function(_0x4b1b75,_0x2d3ebf){const _0x1d2e9e=a30_0x5bc4,_0x34c738=_0x4b1b75();while(!![]){try{const _0x729353=-parseInt(_0x1d2e9e(0x1c0))/0x1+-parseInt(_0x1d2e9e(0x1bc))/0x2*(-parseInt(_0x1d2e9e(0x1b6))/0x3)+parseInt(_0x1d2e9e(0x1be))/0x4+parseInt(_0x1d2e9e(0x1b9))/0x5*(parseInt(_0x1d2e9e(0x1b8))/0x6)+-parseInt(_0x1d2e9e(0x1ba))/0x7+-parseInt(_0x1d2e9e(0x1c1))/0x8+-parseInt(_0x1d2e9e(0x1c5))/0x9*(-parseInt(_0x1d2e9e(0x1bf))/0xa);if(_0x729353===_0x2d3ebf)break;else _0x34c738['push'](_0x34c738['shift']());}catch(_0x585bb1){_0x34c738['push'](_0x34c738['shift']());}}}(a30_0x2b21,0xe96c9));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../utils/command-output.js';export class ProfilesCommand extends BaseCommand{[a30_0x2e0b55(0x1c4)]=a30_0x2e0b55(0x1c8);[a30_0x2e0b55(0x1c7)]='List\x20all\x20available\x20profiles';async['execute'](_0x264054){const _0x157cbf=a30_0x2e0b55,{options:_0x3a0a20}=_0x264054;try{const _0x2d2e0e=listProfiles(),_0x5e5693=getActiveProfile();if(_0x2d2e0e[_0x157cbf(0x1c3)]===0x0)return console[_0x157cbf(0x1ca)](_0x157cbf(0x1b4)),console[_0x157cbf(0x1ca)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x157cbf(0x1ca)](_0x157cbf(0x1c9)),0x0;const _0x372929=_0x2d2e0e[_0x157cbf(0x1b7)](_0x5ba04a=>{const _0x22692c=_0x157cbf,_0x43d1df=_0x5ba04a[_0x22692c(0x1c4)]===_0x5e5693,_0x482ae7=getProfileParams(_0x5ba04a[_0x22692c(0x1bd)]);return{'name':_0x5ba04a[_0x22692c(0x1c4)],'active':_0x43d1df,'scope':_0x5ba04a[_0x22692c(0x1b5)],'description':_0x5ba04a['config'][_0x22692c(0x1c7)]||'','params':_0x482ae7};});return await handleSDKOutput(_0x372929,_0x3a0a20),0x0;}catch(_0x167f57){return _0x167f57 instanceof Error&&console[_0x157cbf(0x1c6)](_0x157cbf(0x1c2)+_0x167f57[_0x157cbf(0x1bb)]),0x1;}}}