@treasuredata/tdx 0.16.9 → 0.16.11

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 (198) hide show
  1. package/README.md +3 -2
  2. package/dist/bin.js +1 -1
  3. package/dist/build-info.json +3 -3
  4. package/dist/cli-categories.js +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/commands/activations.js +1 -1
  7. package/dist/commands/agent-command.js +1 -1
  8. package/dist/commands/agent-test-command.js +1 -1
  9. package/dist/commands/api-command.js +1 -1
  10. package/dist/commands/auth-command.js +1 -1
  11. package/dist/commands/chat-command.js +1 -1
  12. package/dist/commands/claude-command.js +1 -1
  13. package/dist/commands/claude-statusline-command.js +1 -1
  14. package/dist/commands/claude-usage-command.d.ts.map +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/claude-usage-command.js.map +1 -1
  17. package/dist/commands/command.js +1 -1
  18. package/dist/commands/connection-command.js +1 -1
  19. package/dist/commands/databases.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-command.js +1 -1
  22. package/dist/commands/job-command.js +1 -1
  23. package/dist/commands/journey-command.js +1 -1
  24. package/dist/commands/journey-validate-command.js +1 -1
  25. package/dist/commands/llm-command.js +1 -1
  26. package/dist/commands/llm-proxy.js +1 -1
  27. package/dist/commands/mcp-command.js +1 -1
  28. package/dist/commands/parent-segment-command.js +1 -1
  29. package/dist/commands/profile-command.js +1 -1
  30. package/dist/commands/profiles-command.js +1 -1
  31. package/dist/commands/query-command.js +1 -1
  32. package/dist/commands/segment-command.js +1 -1
  33. package/dist/commands/segment-create-command.js +1 -1
  34. package/dist/commands/segment-fields-command.js +1 -1
  35. package/dist/commands/segment-pull-command.js +1 -1
  36. package/dist/commands/segment-push-command.js +1 -1
  37. package/dist/commands/segment-update-command.js +1 -1
  38. package/dist/commands/segment-use-command.js +1 -1
  39. package/dist/commands/segment-validate-command.js +1 -1
  40. package/dist/commands/segments.js +1 -1
  41. package/dist/commands/show.js +1 -1
  42. package/dist/commands/status-command.js +1 -1
  43. package/dist/commands/tables.js +1 -1
  44. package/dist/commands/unset-command.js +1 -1
  45. package/dist/commands/use-command.js +1 -1
  46. package/dist/commands/user-command.js +1 -1
  47. package/dist/commands/workflow-command.js +1 -1
  48. package/dist/core/auth.js +1 -1
  49. package/dist/core/command-output.js +1 -1
  50. package/dist/core/config.js +1 -1
  51. package/dist/core/connection-cache.js +1 -1
  52. package/dist/core/constants.js +1 -1
  53. package/dist/core/credential-cache.js +1 -1
  54. package/dist/core/global-context.js +1 -1
  55. package/dist/core/keychain.js +1 -1
  56. package/dist/core/profile.js +1 -1
  57. package/dist/core/project-config.js +1 -1
  58. package/dist/core/session.js +1 -1
  59. package/dist/core/user-cache.js +1 -1
  60. package/dist/core/version.js +1 -1
  61. package/dist/index.js +1 -1
  62. package/dist/mcp/server.js +1 -1
  63. package/dist/mcp/tools/index.js +1 -1
  64. package/dist/mcp/tools/tdx-run.js +1 -1
  65. package/dist/mcp/tools/tdx-search.js +1 -1
  66. package/dist/mcp/utils.js +1 -1
  67. package/dist/proxy/anthropic-adapter.js +1 -1
  68. package/dist/proxy/claude-usage-tracker.d.ts +31 -0
  69. package/dist/proxy/claude-usage-tracker.d.ts.map +1 -1
  70. package/dist/proxy/claude-usage-tracker.js +1 -1
  71. package/dist/proxy/claude-usage-tracker.js.map +1 -1
  72. package/dist/proxy/context-signature.js +1 -1
  73. package/dist/proxy/conversation-utils.js +1 -1
  74. package/dist/proxy/passthrough-server.d.ts.map +1 -1
  75. package/dist/proxy/passthrough-server.js +1 -1
  76. package/dist/proxy/passthrough-server.js.map +1 -1
  77. package/dist/proxy/server.js +1 -1
  78. package/dist/proxy/session-cache.js +1 -1
  79. package/dist/proxy/sse-usage-parser.js +1 -1
  80. package/dist/sdk/agent/agent-config.js +1 -1
  81. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  82. package/dist/sdk/agent/agent-yaml.js +1 -1
  83. package/dist/sdk/agent/test/evaluator.js +1 -1
  84. package/dist/sdk/agent/test/executor.js +1 -1
  85. package/dist/sdk/agent/test/index.js +1 -1
  86. package/dist/sdk/agent/test/output.js +1 -1
  87. package/dist/sdk/agent/test/parser.js +1 -1
  88. package/dist/sdk/api.js +1 -1
  89. package/dist/sdk/client/cdp-api-client.js +1 -1
  90. package/dist/sdk/client/endpoints.js +1 -1
  91. package/dist/sdk/client/engage-api-client.js +1 -1
  92. package/dist/sdk/client/http-client.js +1 -1
  93. package/dist/sdk/client/llm-api-client.js +1 -1
  94. package/dist/sdk/client/rate-limiter.js +1 -1
  95. package/dist/sdk/client/td-api-client.js +1 -1
  96. package/dist/sdk/client/trino-api-client.js +1 -1
  97. package/dist/sdk/client/workflow-client.js +1 -1
  98. package/dist/sdk/connection-validator.js +1 -1
  99. package/dist/sdk/connection.js +1 -1
  100. package/dist/sdk/engage.js +1 -1
  101. package/dist/sdk/errors.js +1 -1
  102. package/dist/sdk/index.d.ts +0 -1
  103. package/dist/sdk/index.d.ts.map +1 -1
  104. package/dist/sdk/index.js +1 -1
  105. package/dist/sdk/index.js.map +1 -1
  106. package/dist/sdk/io/index.js +1 -1
  107. package/dist/sdk/io/node-filesystem.js +1 -1
  108. package/dist/sdk/job.js +1 -1
  109. package/dist/sdk/journey.js +1 -1
  110. package/dist/sdk/llm/chat-cache.js +1 -1
  111. package/dist/sdk/llm/index.js +1 -1
  112. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  113. package/dist/sdk/llm/model-aliases.js +1 -1
  114. package/dist/sdk/llm/model-factors.js +1 -1
  115. package/dist/sdk/query/index.js +1 -1
  116. package/dist/sdk/query/sql-parser.js +1 -1
  117. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  118. package/dist/sdk/segment/fields-display.js +1 -1
  119. package/dist/sdk/segment/file-discovery.js +1 -1
  120. package/dist/sdk/segment/journey-utils.js +1 -1
  121. package/dist/sdk/segment/journey-yaml.js +1 -1
  122. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  123. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  124. package/dist/sdk/segment/pull-workflow.js +1 -1
  125. package/dist/sdk/segment/push-workflow.js +1 -1
  126. package/dist/sdk/segment/resolution-context.js +1 -1
  127. package/dist/sdk/segment/segment-path-parser.js +1 -1
  128. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  129. package/dist/sdk/segment/target-resolution.js +1 -1
  130. package/dist/sdk/segment/tdx-config.js +1 -1
  131. package/dist/sdk/segment/validate-files.js +1 -1
  132. package/dist/sdk/segment/yaml-validator.js +1 -1
  133. package/dist/sdk/segment.js +1 -1
  134. package/dist/sdk/types/index.js +1 -1
  135. package/dist/sdk/types/progress.js +1 -1
  136. package/dist/sdk/user.js +1 -1
  137. package/dist/sdk/util/format-detector.js +1 -1
  138. package/dist/sdk/util/formatters.js +1 -1
  139. package/dist/sdk/util/index.js +1 -1
  140. package/dist/sdk/util/tree-formatter.js +1 -1
  141. package/dist/sdk/workflow/clone-workflow.js +1 -1
  142. package/dist/sdk/workflow/index.js +1 -1
  143. package/dist/sdk/workflow/pull-workflow.js +1 -1
  144. package/dist/sdk/workflow/push-workflow.js +1 -1
  145. package/dist/sdk/workflow/tdx-config.js +1 -1
  146. package/dist/sdk/workflow/workflow-utils.js +1 -1
  147. package/dist/test-utils/command-runner.js +1 -1
  148. package/dist/test-utils/factories.js +1 -1
  149. package/dist/test-utils/fixtures.js +1 -1
  150. package/dist/test-utils/http-mock.js +1 -1
  151. package/dist/test-utils/index.js +1 -1
  152. package/dist/utils/async.js +1 -1
  153. package/dist/utils/colors.js +1 -1
  154. package/dist/utils/diff.js +1 -1
  155. package/dist/utils/file-permissions.js +1 -1
  156. package/dist/utils/global-cache.js +1 -1
  157. package/dist/utils/json-loader.js +1 -1
  158. package/dist/utils/local-cache.js +1 -1
  159. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  160. package/dist/utils/logger/formatters/index.js +1 -1
  161. package/dist/utils/logger/handlers/console-handler.js +1 -1
  162. package/dist/utils/logger/handlers/file-handler.js +1 -1
  163. package/dist/utils/logger/handlers/index.js +1 -1
  164. package/dist/utils/logger/handlers/null-handler.js +1 -1
  165. package/dist/utils/logger/index.js +1 -1
  166. package/dist/utils/logger/logger.js +1 -1
  167. package/dist/utils/logger/types.js +1 -1
  168. package/dist/utils/option-validation.js +1 -1
  169. package/dist/utils/port.js +1 -1
  170. package/dist/utils/process.js +1 -1
  171. package/dist/utils/prompt.js +1 -1
  172. package/dist/utils/spinner.js +1 -1
  173. package/dist/utils/sse-parser.js +1 -1
  174. package/dist/utils/string-utils.js +1 -1
  175. package/dist/utils/table-ref-parser.js +1 -1
  176. package/dist/utils/tdx-logger.js +1 -1
  177. package/dist/utils/version-check.js +1 -1
  178. package/package.json +1 -1
  179. package/dist/sdk/claude-agent/claude-agent-client.d.ts +0 -73
  180. package/dist/sdk/claude-agent/claude-agent-client.d.ts.map +0 -1
  181. package/dist/sdk/claude-agent/claude-agent-client.js +0 -1
  182. package/dist/sdk/claude-agent/claude-agent-client.js.map +0 -1
  183. package/dist/sdk/claude-agent/environment.d.ts +0 -59
  184. package/dist/sdk/claude-agent/environment.d.ts.map +0 -1
  185. package/dist/sdk/claude-agent/environment.js +0 -1
  186. package/dist/sdk/claude-agent/environment.js.map +0 -1
  187. package/dist/sdk/claude-agent/index.d.ts +0 -15
  188. package/dist/sdk/claude-agent/index.d.ts.map +0 -1
  189. package/dist/sdk/claude-agent/index.js +0 -1
  190. package/dist/sdk/claude-agent/index.js.map +0 -1
  191. package/dist/sdk/claude-agent/system-prompts.d.ts +0 -22
  192. package/dist/sdk/claude-agent/system-prompts.d.ts.map +0 -1
  193. package/dist/sdk/claude-agent/system-prompts.js +0 -1
  194. package/dist/sdk/claude-agent/system-prompts.js.map +0 -1
  195. package/dist/sdk/claude-agent/types.d.ts +0 -107
  196. package/dist/sdk/claude-agent/types.d.ts.map +0 -1
  197. package/dist/sdk/claude-agent/types.js +0 -1
  198. package/dist/sdk/claude-agent/types.js.map +0 -1
@@ -1 +1 @@
1
- const a16_0x55b084=a16_0xbb9d;(function(_0x52f41a,_0x471509){const _0x59a6ce=a16_0xbb9d,_0x146a96=_0x52f41a();while(!![]){try{const _0x53ab3f=parseInt(_0x59a6ce(0x1ae))/0x1*(-parseInt(_0x59a6ce(0x152))/0x2)+parseInt(_0x59a6ce(0x164))/0x3+-parseInt(_0x59a6ce(0x167))/0x4+-parseInt(_0x59a6ce(0x1a5))/0x5+parseInt(_0x59a6ce(0x1a4))/0x6*(parseInt(_0x59a6ce(0x197))/0x7)+-parseInt(_0x59a6ce(0x16b))/0x8*(parseInt(_0x59a6ce(0x1a2))/0x9)+parseInt(_0x59a6ce(0x18f))/0xa;if(_0x53ab3f===_0x471509)break;else _0x146a96['push'](_0x146a96['shift']());}catch(_0x1271ec){_0x146a96['push'](_0x146a96['shift']());}}}(a16_0xeb92,0xbb7b4));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{confirm}from'../utils/prompt.js';import{loadSessionContext,saveSessionContext}from'../core/session.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../core/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';async function resolveWorkspaceIdFromOptions(_0x1720d5,_0x31b481,_0x122fb4=![]){const _0x44bd22=a16_0xbb9d;if(_0x1720d5[_0x44bd22(0x16f)])return await _0x31b481[_0x44bd22(0x154)]['resolveWorkspaceId'](_0x1720d5[_0x44bd22(0x16f)]);const _0x219ac5=loadSessionContext(_0x1720d5['session']);if(_0x219ac5?.['engage_workspace'])return await _0x31b481['engage']['resolveWorkspaceId'](_0x219ac5[_0x44bd22(0x174)]);if(_0x122fb4)throw new SDKError(ErrorCode[_0x44bd22(0x18a)],_0x44bd22(0x155),undefined,{'helpText':_0x44bd22(0x18d)});return undefined;}async function resolveSegmentFromOptions(_0x579eea,_0x1f5244){const _0x5216a6=a16_0xbb9d;if(!_0x579eea[_0x5216a6(0x173)])return{};const _0x28ba94=_0x579eea[_0x5216a6(0x173)],_0x524104=await _0x1f5244[_0x5216a6(0x173)]['resolvePathToResource'](_0x28ba94);return{'audienceId':_0x524104[_0x5216a6(0x14e)],'audienceName':_0x524104[_0x5216a6(0x1a9)],..._0x524104[_0x5216a6(0x17f)]&&{'segmentId':_0x524104['segmentId'],'segmentName':_0x524104[_0x5216a6(0x1c0)]}};}function buildConnectorConfig(_0x13374d){const _0x4ff437=a16_0xbb9d,_0x3fc5c3=_0x13374d[_0x4ff437(0x18b)],_0x573b7d=_0x13374d['jsonColumns'];if(!_0x3fc5c3&&!_0x573b7d)return undefined;return{..._0x3fc5c3&&{'emailSenderId':_0x3fc5c3},..._0x573b7d&&{'jsonColumns':_0x573b7d}};}function a16_0xbb9d(_0x1af5ab,_0x510075){_0x1af5ab=_0x1af5ab-0x13c;const _0xeb9293=a16_0xeb92();let _0xbb9d41=_0xeb9293[_0x1af5ab];return _0xbb9d41;}export class EngageCampaignsCommand extends BaseCommand{[a16_0x55b084(0x189)]=a16_0x55b084(0x14d);[a16_0x55b084(0x1ac)]='List\x20campaigns';async['execute'](_0x237c03){const _0x44dffa=a16_0x55b084,{options:_0x96f8ce,args:_0xc184be,tdx:_0x1a9c90}=_0x237c03,_0x509fb6=_0xc184be[0x0],_0x17d5d5=resolveLimit(_0x96f8ce[_0x44dffa(0x142)],DEFAULT_LLM_LIMIT),_0x330108=_0x96f8ce,_0x2bc9e1=_0x330108[_0x44dffa(0x195)],_0x2c85a9=_0x330108[_0x44dffa(0x147)],_0x47b48b=await resolveWorkspaceIdFromOptions(_0x330108,_0x1a9c90),_0xcb4895=await withSpinner(_0x44dffa(0x1af),()=>_0x1a9c90['engage'][_0x44dffa(0x162)]({'type':_0x2bc9e1,'status':_0x2c85a9,'workspaceId':_0x47b48b,'limit':_0x17d5d5}),{'verbose':_0x96f8ce['verbose']});let _0x41fd2d=_0xcb4895[_0x44dffa(0x1bd)];return _0x509fb6&&(_0x41fd2d=_0xcb4895['data']['filter'](_0x413b7d=>matchGlobPattern(_0x413b7d[_0x44dffa(0x189)],_0x509fb6))),await handleSDKOutput(_0x41fd2d,_0x96f8ce),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a16_0x55b084(0x189)]=a16_0x55b084(0x14c);['description']=a16_0x55b084(0x1a0);async[a16_0x55b084(0x184)](_0x41254a){const _0x5065b8=a16_0x55b084,{options:_0xde8fd9,args:_0x12acdd,tdx:_0x3b3407}=_0x41254a;if(_0x12acdd[_0x5065b8(0x179)]===0x0)return console[_0x5065b8(0x17d)](_0x5065b8(0x1b0)),console[_0x5065b8(0x17d)](_0x5065b8(0x1bb)),0x1;const _0x599a4c=_0x12acdd[0x0],_0x471989=_0xde8fd9,_0x5570cb=await resolveWorkspaceIdFromOptions(_0x471989,_0x3b3407),_0x4c99ea=_0x471989[_0x5065b8(0x141)];if(_0x4c99ea){const _0x4370bd=await withSpinner(_0x5065b8(0x17a)+_0x599a4c+_0x5065b8(0x19d),()=>_0x3b3407[_0x5065b8(0x154)]['getCampaignFull'](_0x599a4c,_0x5570cb),{'verbose':_0xde8fd9[_0x5065b8(0x1b2)]});await handleSDKOutput([_0x4370bd],_0xde8fd9);}else{const _0xaab352=await withSpinner(_0x5065b8(0x17a)+_0x599a4c+_0x5065b8(0x19d),()=>_0x3b3407[_0x5065b8(0x154)]['getCampaign'](_0x599a4c,_0x5570cb),{'verbose':_0xde8fd9[_0x5065b8(0x1b2)]});await handleSDKOutput([_0xaab352],_0xde8fd9);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{[a16_0x55b084(0x189)]=a16_0x55b084(0x16e);[a16_0x55b084(0x1ac)]='Create\x20a\x20new\x20campaign';async[a16_0x55b084(0x184)](_0x5ad43b){const _0x1a018e=a16_0x55b084,{options:_0x1a3ba0,tdx:_0x3b1fda}=_0x5ad43b,_0x21d7c2=_0x1a3ba0,_0x34c5f6=_0x21d7c2[_0x1a018e(0x189)],_0x4f0ec5=_0x21d7c2[_0x1a018e(0x195)];if(!_0x34c5f6)return console['error'](_0x1a018e(0x143)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>'),0x1;if(!_0x4f0ec5)return console['error'](_0x1a018e(0x1c3)),console[_0x1a018e(0x17d)]('Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>'),0x1;const _0x13739c=await resolveWorkspaceIdFromOptions(_0x21d7c2,_0x3b1fda,!![]),_0x1cb412=await resolveSegmentFromOptions(_0x21d7c2,_0x3b1fda),_0x20c47f=buildConnectorConfig(_0x21d7c2),_0x459f66={'name':_0x34c5f6,'campaignType':_0x4f0ec5,'workspaceId':_0x13739c,'description':_0x21d7c2[_0x1a018e(0x1ac)],..._0x1cb412,'connectorConfig':_0x20c47f,'startAt':_0x21d7c2[_0x1a018e(0x15a)],'timezone':_0x21d7c2[_0x1a018e(0x1a7)]},_0x4fb474=await withSpinner('Creating\x20campaign\x20\x27'+_0x34c5f6+_0x1a018e(0x19d),()=>_0x3b1fda[_0x1a018e(0x154)][_0x1a018e(0x1c1)](_0x459f66));return await handleSDKOutput([_0x4fb474[_0x1a018e(0x1bd)]],_0x1a3ba0),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a16_0x55b084(0x189)]='engage:campaign:update';['description']=a16_0x55b084(0x16a);async[a16_0x55b084(0x184)](_0x1c0aeb){const _0x39aafd=a16_0x55b084,{options:_0x8431f0,args:_0x3f3bb0,tdx:_0xcfd97b}=_0x1c0aeb;if(_0x3f3bb0['length']===0x0)return console[_0x39aafd(0x17d)](_0x39aafd(0x1b0)),console['error'](_0x39aafd(0x13f)),0x1;const _0x3bdcc7=_0x3f3bb0[0x0],_0x4f8188=_0x8431f0,_0x4da989=await resolveWorkspaceIdFromOptions(_0x4f8188,_0xcfd97b),_0x2b97f4=await resolveSegmentFromOptions(_0x4f8188,_0xcfd97b),_0xe5f9=buildConnectorConfig(_0x4f8188),_0x535371={'name':_0x4f8188[_0x39aafd(0x189)],'description':_0x4f8188[_0x39aafd(0x1ac)],..._0x2b97f4,'connectorConfig':_0xe5f9,'startAt':_0x4f8188[_0x39aafd(0x15a)],'timezone':_0x4f8188[_0x39aafd(0x1a7)]},_0x476200=Object['fromEntries'](Object['entries'](_0x535371)['filter'](([,_0xb4550e])=>_0xb4550e!==undefined));if(Object[_0x39aafd(0x1be)](_0x476200)[_0x39aafd(0x179)]===0x0)return console['error'](_0x39aafd(0x177)),console[_0x39aafd(0x17d)]('Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone'),0x1;const _0x22c79f=await withSpinner(_0x39aafd(0x15e)+_0x3bdcc7+_0x39aafd(0x19d),()=>_0xcfd97b['engage'][_0x39aafd(0x146)](_0x3bdcc7,_0x476200,_0x4da989),{'verbose':_0x8431f0[_0x39aafd(0x1b2)]});return await handleSDKOutput([_0x22c79f['data']],_0x8431f0),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{['name']=a16_0x55b084(0x14f);['description']=a16_0x55b084(0x1b5);async[a16_0x55b084(0x184)](_0x3bcd41){const _0x22f1f6=a16_0x55b084,{options:_0x3377e9,args:_0x15cf5c,tdx:_0x4aa775}=_0x3bcd41;if(_0x15cf5c[_0x22f1f6(0x179)]===0x0)return console['error'](_0x22f1f6(0x1b0)),console[_0x22f1f6(0x17d)](_0x22f1f6(0x1ad)),0x1;const _0xcfc158=_0x15cf5c[0x0],_0x214f47=_0x3377e9,_0x4de214=await resolveWorkspaceIdFromOptions(_0x214f47,_0x4aa775);if(!_0x3377e9[_0x22f1f6(0x193)]){const _0x5f057=await confirm(_0x22f1f6(0x17b)+_0xcfc158+_0x22f1f6(0x196));if(!_0x5f057)return console[_0x22f1f6(0x1b3)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x22f1f6(0x19b)+_0xcfc158+'\x27...',()=>_0x4aa775['engage'][_0x22f1f6(0x1ab)](_0xcfc158,_0x4de214),{'verbose':_0x3377e9[_0x22f1f6(0x1b2)]}),console[_0x22f1f6(0x1b3)]('Campaign\x20\x27'+_0xcfc158+_0x22f1f6(0x181)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a16_0x55b084(0x189)]=a16_0x55b084(0x151);[a16_0x55b084(0x1ac)]=a16_0x55b084(0x163);async[a16_0x55b084(0x184)](_0x283596){const _0x177354=a16_0x55b084,{options:_0x574e87,args:_0x5877e3,tdx:_0x510f9e}=_0x283596;if(_0x5877e3[_0x177354(0x179)]===0x0)return console[_0x177354(0x17d)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x177354(0x17d)]('Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>'),0x1;const _0x219b51=_0x5877e3[0x0],_0x4d53c1=_0x574e87,_0x273bb9=await resolveWorkspaceIdFromOptions(_0x4d53c1,_0x510f9e);return await withSpinner(_0x177354(0x168)+_0x219b51+_0x177354(0x19d),()=>_0x510f9e['engage'][_0x177354(0x172)](_0x219b51,_0x273bb9),{'verbose':_0x574e87['verbose']}),console[_0x177354(0x1b3)]('Campaign\x20\x27'+_0x219b51+_0x177354(0x16d)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a16_0x55b084(0x189)]=a16_0x55b084(0x165);[a16_0x55b084(0x1ac)]='Pause\x20a\x20campaign';async[a16_0x55b084(0x184)](_0x453f81){const _0x6ef052=a16_0x55b084,{options:_0x10f55e,args:_0x145444,tdx:_0x15d527}=_0x453f81;if(_0x145444['length']===0x0)return console[_0x6ef052(0x17d)](_0x6ef052(0x1b0)),console[_0x6ef052(0x17d)](_0x6ef052(0x183)),0x1;const _0x33e56a=_0x145444[0x0],_0x458b75=_0x10f55e,_0x432cda=await resolveWorkspaceIdFromOptions(_0x458b75,_0x15d527);return await withSpinner('Pausing\x20campaign\x20\x27'+_0x33e56a+_0x6ef052(0x19d),()=>_0x15d527['engage'][_0x6ef052(0x19e)](_0x33e56a,_0x432cda),{'verbose':_0x10f55e['verbose']}),console['log'](_0x6ef052(0x149)+_0x33e56a+_0x6ef052(0x169)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{[a16_0x55b084(0x189)]=a16_0x55b084(0x18c);[a16_0x55b084(0x1ac)]='Resume\x20a\x20paused\x20campaign';async[a16_0x55b084(0x184)](_0x466fae){const _0xa1a541=a16_0x55b084,{options:_0x42e138,args:_0x79dabd,tdx:_0xfc3ace}=_0x466fae;if(_0x79dabd[_0xa1a541(0x179)]===0x0)return console['error'](_0xa1a541(0x1b0)),console[_0xa1a541(0x17d)](_0xa1a541(0x1a3)),0x1;const _0xef71f0=_0x79dabd[0x0],_0x10fb39=_0x42e138,_0x2914f5=await resolveWorkspaceIdFromOptions(_0x10fb39,_0xfc3ace);return await withSpinner(_0xa1a541(0x19c)+_0xef71f0+_0xa1a541(0x19d),()=>_0xfc3ace[_0xa1a541(0x154)][_0xa1a541(0x199)](_0xef71f0,_0x2914f5),{'verbose':_0x42e138[_0xa1a541(0x1b2)]}),console[_0xa1a541(0x1b3)](_0xa1a541(0x149)+_0xef71f0+'\x27\x20resumed\x20successfully'),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{['name']='engage:campaign:duplicate';[a16_0x55b084(0x1ac)]='Duplicate\x20a\x20campaign';async[a16_0x55b084(0x184)](_0x4af660){const _0x520b39=a16_0x55b084,{options:_0x5d5b27,args:_0x405942,tdx:_0x1f5c2b}=_0x4af660;if(_0x405942[_0x520b39(0x179)]===0x0)return console[_0x520b39(0x17d)](_0x520b39(0x1b0)),console[_0x520b39(0x17d)](_0x520b39(0x14b)),0x1;const _0x535856=_0x405942[0x0],_0x3aade3=_0x5d5b27,_0x20e224=await resolveWorkspaceIdFromOptions(_0x3aade3,_0x1f5c2b),_0x82b936=await withSpinner('Duplicating\x20campaign\x20\x27'+_0x535856+_0x520b39(0x19d),()=>_0x1f5c2b[_0x520b39(0x154)]['duplicateCampaign'](_0x535856,_0x20e224),{'verbose':_0x5d5b27[_0x520b39(0x1b2)]});return await handleSDKOutput([_0x82b936[_0x520b39(0x1bd)]],_0x5d5b27),0x0;}}export class EngageTemplatesCommand extends BaseCommand{['name']='engage:templates';['description']=a16_0x55b084(0x16c);async['execute'](_0x18b15b){const _0x4722cd=a16_0x55b084,{options:_0x597c14,args:_0x231ab6,tdx:_0x121380}=_0x18b15b,_0x52168f=_0x231ab6[0x0],_0x4b0436=resolveLimit(_0x597c14[_0x4722cd(0x142)],DEFAULT_LLM_LIMIT),_0xcbf030=_0x597c14,_0x4235d3=await resolveWorkspaceIdFromOptions(_0xcbf030,_0x121380),_0x64f5cb=await withSpinner(_0x4722cd(0x185),()=>_0x121380[_0x4722cd(0x154)][_0x4722cd(0x176)]({'workspaceId':_0x4235d3,'limit':_0x4b0436}),{'verbose':_0x597c14[_0x4722cd(0x1b2)]});let _0x26669a=_0x64f5cb[_0x4722cd(0x1bd)];return _0x52168f&&(_0x26669a=_0x64f5cb[_0x4722cd(0x1bd)]['filter'](_0x24a852=>matchGlobPattern(_0x24a852['name'],_0x52168f))),await handleSDKOutput(_0x26669a,_0x597c14),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a16_0x55b084(0x189)]=a16_0x55b084(0x1ba);[a16_0x55b084(0x1ac)]=a16_0x55b084(0x157);async[a16_0x55b084(0x184)](_0x42d38a){const _0x704c5a=a16_0x55b084,{options:_0x2b18cf,args:_0x121715,tdx:_0x35ae98}=_0x42d38a;if(_0x121715[_0x704c5a(0x179)]===0x0)return console[_0x704c5a(0x17d)](_0x704c5a(0x1b7)),console[_0x704c5a(0x17d)](_0x704c5a(0x186)),0x1;const _0xc5d7d0=_0x121715[0x0],_0x10091d=_0x2b18cf,_0x972964=await resolveWorkspaceIdFromOptions(_0x10091d,_0x35ae98),_0x492084=_0x10091d['full'];if(_0x492084){const _0x379af7=await withSpinner(_0x704c5a(0x156)+_0xc5d7d0+_0x704c5a(0x19d),()=>_0x35ae98[_0x704c5a(0x154)][_0x704c5a(0x13c)](_0xc5d7d0,_0x972964),{'verbose':_0x2b18cf[_0x704c5a(0x1b2)]});await handleSDKOutput([_0x379af7],_0x2b18cf);}else{const _0x59852c=await withSpinner(_0x704c5a(0x156)+_0xc5d7d0+_0x704c5a(0x19d),()=>_0x35ae98[_0x704c5a(0x154)][_0x704c5a(0x14a)](_0xc5d7d0,_0x972964),{'verbose':_0x2b18cf[_0x704c5a(0x1b2)]});await handleSDKOutput([_0x59852c],_0x2b18cf);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a16_0x55b084(0x189)]=a16_0x55b084(0x178);[a16_0x55b084(0x1ac)]=a16_0x55b084(0x1a6);async[a16_0x55b084(0x184)](_0x55906f){const _0x47beb4=a16_0x55b084,{options:_0x5d1ff4,tdx:_0x340b6e}=_0x55906f,_0x4ef547=_0x5d1ff4,_0x2b152c=_0x4ef547[_0x47beb4(0x189)],_0x36608d=_0x4ef547[_0x47beb4(0x187)],_0x43ff0a=_0x4ef547[_0x47beb4(0x18e)];if(!_0x2b152c)return console[_0x47beb4(0x17d)](_0x47beb4(0x143)),console[_0x47beb4(0x17d)](_0x47beb4(0x158)),0x1;if(!_0x36608d)return console['error'](_0x47beb4(0x1a1)),0x1;if(!_0x43ff0a)return console[_0x47beb4(0x17d)]('Error:\x20--html\x20is\x20required'),0x1;const _0xd06cef=await resolveWorkspaceIdFromOptions(_0x4ef547,_0x340b6e,!![]),_0x535df4={'name':_0x2b152c,'subjectTemplate':_0x36608d,'htmlTemplate':_0x43ff0a,'workspaceId':_0xd06cef,'plaintextTemplate':_0x4ef547['plaintext'],'editorType':_0x4ef547['editorType']},_0x318d47=await withSpinner(_0x47beb4(0x182)+_0x2b152c+_0x47beb4(0x19d),()=>_0x340b6e[_0x47beb4(0x154)]['createTemplate'](_0x535df4));return await handleSDKOutput([_0x318d47[_0x47beb4(0x1bd)]],_0x5d1ff4),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{[a16_0x55b084(0x189)]=a16_0x55b084(0x17e);[a16_0x55b084(0x1ac)]=a16_0x55b084(0x15b);async[a16_0x55b084(0x184)](_0x128971){const _0x226450=a16_0x55b084,{options:_0x16365c,args:_0x55935e,tdx:_0x474c79}=_0x128971;if(_0x55935e['length']===0x0)return console['error']('Error:\x20Template\x20name\x20or\x20ID\x20is\x20required'),console[_0x226450(0x17d)](_0x226450(0x1bc)),0x1;const _0x22576f=_0x55935e[0x0],_0x3ed074=_0x16365c,_0x569a52=await resolveWorkspaceIdFromOptions(_0x3ed074,_0x474c79),_0x5c9aff={'name':_0x3ed074[_0x226450(0x189)],'subjectTemplate':_0x3ed074[_0x226450(0x187)],'htmlTemplate':_0x3ed074[_0x226450(0x18e)],'plaintextTemplate':_0x3ed074[_0x226450(0x13e)]},_0x50c8c3=Object[_0x226450(0x188)](Object[_0x226450(0x13d)](_0x5c9aff)[_0x226450(0x170)](([,_0x29b19a])=>_0x29b19a!==undefined));if(Object[_0x226450(0x1be)](_0x50c8c3)[_0x226450(0x179)]===0x0)return console['error'](_0x226450(0x177)),console['error'](_0x226450(0x19f)),0x1;const _0x13d31a=await withSpinner(_0x226450(0x191)+_0x22576f+_0x226450(0x19d),()=>_0x474c79[_0x226450(0x154)][_0x226450(0x1a8)](_0x22576f,_0x50c8c3,_0x569a52),{'verbose':_0x16365c[_0x226450(0x1b2)]});return await handleSDKOutput([_0x13d31a['data']],_0x16365c),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{[a16_0x55b084(0x189)]='engage:template:delete';[a16_0x55b084(0x1ac)]='Delete\x20an\x20email\x20template';async[a16_0x55b084(0x184)](_0x4c606a){const _0x2c356c=a16_0x55b084,{options:_0x2beaea,args:_0x1885fc,tdx:_0x1477d9}=_0x4c606a;if(_0x1885fc[_0x2c356c(0x179)]===0x0)return console[_0x2c356c(0x17d)]('Error:\x20Template\x20name\x20or\x20ID\x20is\x20required'),console['error']('Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>'),0x1;const _0x30f42f=_0x1885fc[0x0],_0x48c223=_0x2beaea,_0xd7a884=await resolveWorkspaceIdFromOptions(_0x48c223,_0x1477d9);if(!_0x2beaea[_0x2c356c(0x193)]){const _0x266eec=await confirm(_0x2c356c(0x1b6)+_0x30f42f+_0x2c356c(0x196));if(!_0x266eec)return console[_0x2c356c(0x1b3)](_0x2c356c(0x140)),0x0;}return await withSpinner('Deleting\x20template\x20\x27'+_0x30f42f+'\x27...',()=>_0x1477d9[_0x2c356c(0x154)][_0x2c356c(0x194)](_0x30f42f,_0xd7a884),{'verbose':_0x2beaea['verbose']}),console['log']('Template\x20\x27'+_0x30f42f+_0x2c356c(0x181)),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{['name']=a16_0x55b084(0x1b8);[a16_0x55b084(0x1ac)]=a16_0x55b084(0x190);async[a16_0x55b084(0x184)](_0x1b8eac){const _0x271894=a16_0x55b084,{options:_0x227ce9,args:_0x3684b9,tdx:_0x3750a4}=_0x1b8eac,_0x164a65=_0x3684b9[0x0],_0x17116c=resolveLimit(_0x227ce9[_0x271894(0x142)],DEFAULT_LLM_LIMIT),_0x4da316=await withSpinner('Fetching\x20workspaces...',()=>_0x3750a4[_0x271894(0x154)][_0x271894(0x175)]({'limit':_0x17116c}),{'verbose':_0x227ce9[_0x271894(0x1b2)]});let _0x237e79=_0x4da316[_0x271894(0x1bd)];return _0x164a65&&(_0x237e79=_0x4da316[_0x271894(0x1bd)][_0x271894(0x170)](_0x23a564=>matchGlobPattern(_0x23a564[_0x271894(0x189)],_0x164a65))),await handleSDKOutput(_0x237e79,_0x227ce9),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a16_0x55b084(0x189)]=a16_0x55b084(0x15d);[a16_0x55b084(0x1ac)]=a16_0x55b084(0x150);async[a16_0x55b084(0x184)](_0x5ae510){const _0x6d7111=a16_0x55b084,{options:_0x28bc02,args:_0x4836fe,tdx:_0x179deb}=_0x5ae510;if(_0x4836fe[_0x6d7111(0x179)]===0x0)return console['error'](_0x6d7111(0x15c)),console[_0x6d7111(0x17d)]('Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>'),0x1;const _0x3a6b46=_0x4836fe[0x0],_0x2be150=_0x28bc02,_0x27e070=_0x2be150[_0x6d7111(0x141)];if(_0x27e070){const _0x5ba728=await withSpinner(_0x6d7111(0x148)+_0x3a6b46+_0x6d7111(0x19d),()=>_0x179deb[_0x6d7111(0x154)]['getWorkspaceFull'](_0x3a6b46),{'verbose':_0x28bc02[_0x6d7111(0x1b2)]});await handleSDKOutput([_0x5ba728],_0x28bc02);}else{const _0x1f5607=await withSpinner('Fetching\x20workspace\x20\x27'+_0x3a6b46+_0x6d7111(0x19d),()=>_0x179deb[_0x6d7111(0x154)][_0x6d7111(0x166)](_0x3a6b46),{'verbose':_0x28bc02[_0x6d7111(0x1b2)]});await handleSDKOutput([_0x1f5607],_0x28bc02);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{['name']=a16_0x55b084(0x180);[a16_0x55b084(0x1ac)]=a16_0x55b084(0x171);async[a16_0x55b084(0x184)](_0x3d3cb1){const _0x353afd=a16_0x55b084,{options:_0x16101c,tdx:_0x13463b}=_0x3d3cb1,_0x22e84f=_0x16101c,_0x10518c=_0x22e84f[_0x353afd(0x189)];if(!_0x10518c)return console[_0x353afd(0x17d)]('Error:\x20--name\x20is\x20required'),console[_0x353afd(0x17d)](_0x353afd(0x1b9)),0x1;const _0x35b089={'name':_0x10518c,'description':_0x22e84f[_0x353afd(0x1ac)]},_0x4668f2=await withSpinner(_0x353afd(0x19a)+_0x10518c+_0x353afd(0x19d),()=>_0x13463b['engage']['createWorkspace'](_0x35b089));return await handleSDKOutput([_0x4668f2[_0x353afd(0x1bd)]],_0x16101c),0x0;}}function a16_0xeb92(){const _0x8b7089=['Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','subject','fromEntries','name','MISSING_ARGUMENT','emailSenderId','engage:campaign:resume','Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22','html','13763220DUxPDC','List\x20workspaces','Updating\x20template\x20\x27','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','yes','deleteTemplate','type','\x27?\x20This\x20cannot\x20be\x20undone.','65688weZMJF','Updating\x20workspace\x20\x27','resumeCampaign','Creating\x20workspace\x20\x27','Deleting\x20campaign\x20\x27','Resuming\x20campaign\x20\x27','\x27...','pauseCampaign','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','Show\x20campaign\x20details','Error:\x20--subject\x20is\x20required','2295BaULjy','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','468XorsWn','6214435OhUjJt','Create\x20an\x20email\x20template','timezone','updateTemplate','parentName','engage:workspace:update','deleteCampaign','description','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','39389aEdTbQ','Fetching\x20campaigns...','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','engage:workspace:delete','verbose','log','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Delete\x20a\x20campaign','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','engage:workspaces','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','engage:template:show','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','data','keys','Deleting\x20workspace\x20\x27','segmentName','createCampaign','Options:\x20--name,\x20--description','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','getTemplateFull','entries','plaintext','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Operation\x20cancelled','full','limit','Error:\x20--name\x20is\x20required','Engage\x20workspace\x20set\x20to:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','updateCampaign','status','Fetching\x20workspace\x20\x27','Campaign\x20\x27','getTemplate','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','engage:campaign:show','engage:campaigns','parentId','engage:campaign:delete','Show\x20workspace\x20details','engage:campaign:launch','32yLVtIf','updateWorkspace','engage','Workspace\x20is\x20required\x20for\x20this\x20operation','Fetching\x20template\x20\x27','Show\x20email\x20template\x20details','Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','startAt','Update\x20an\x20email\x20template','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','engage:workspace:show','Updating\x20campaign\x20\x27','resolveWorkspaceId','Error:\x20Workspace\x20name\x20is\x20required','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','listCampaigns','Launch\x20a\x20campaign','4058052zSYrVB','engage:campaign:pause','getWorkspace','1777232dbvzsB','Launching\x20campaign\x20\x27','\x27\x20paused\x20successfully','Update\x20a\x20campaign','11784amSIQc','List\x20email\x20templates','\x27\x20launched\x20successfully','engage:campaign:create','workspace','filter','Create\x20a\x20workspace','launchCampaign','segment','engage_workspace','listWorkspaces','listTemplates','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','engage:template:create','length','Fetching\x20campaign\x20\x27','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','session','error','engage:template:update','segmentId','engage:workspace:create','\x27\x20deleted\x20successfully','Creating\x20template\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>','execute','Fetching\x20templates...'];a16_0xeb92=function(){return _0x8b7089;};return a16_0xeb92();}export class EngageWorkspaceUpdateCommand extends BaseCommand{['name']=a16_0x55b084(0x1aa);['description']='Update\x20a\x20workspace';async[a16_0x55b084(0x184)](_0x3533cc){const _0x2efcf5=a16_0x55b084,{options:_0x2c037e,args:_0x2ed45a,tdx:_0xb07c99}=_0x3533cc;if(_0x2ed45a[_0x2efcf5(0x179)]===0x0)return console['error'](_0x2efcf5(0x15c)),console['error'](_0x2efcf5(0x1b4)),0x1;const _0x275780=_0x2ed45a[0x0],_0x58e828=_0x2c037e,_0x32417e={'name':_0x58e828[_0x2efcf5(0x189)],'description':_0x58e828[_0x2efcf5(0x1ac)]},_0x1b56c6=Object[_0x2efcf5(0x188)](Object[_0x2efcf5(0x13d)](_0x32417e)['filter'](([,_0x450de7])=>_0x450de7!==undefined));if(Object[_0x2efcf5(0x1be)](_0x1b56c6)['length']===0x0)return console[_0x2efcf5(0x17d)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console['error'](_0x2efcf5(0x1c2)),0x1;const _0x5a76a1=await withSpinner(_0x2efcf5(0x198)+_0x275780+_0x2efcf5(0x19d),()=>_0xb07c99['engage'][_0x2efcf5(0x153)](_0x275780,_0x1b56c6),{'verbose':_0x2c037e[_0x2efcf5(0x1b2)]});return await handleSDKOutput([_0x5a76a1[_0x2efcf5(0x1bd)]],_0x2c037e),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{['name']=a16_0x55b084(0x1b1);[a16_0x55b084(0x1ac)]='Delete\x20a\x20workspace';async['execute'](_0x56b9c1){const _0x25afdb=a16_0x55b084,{options:_0x21b285,args:_0x2daea9,tdx:_0x5b88fc}=_0x56b9c1;if(_0x2daea9[_0x25afdb(0x179)]===0x0)return console[_0x25afdb(0x17d)](_0x25afdb(0x15c)),console[_0x25afdb(0x17d)](_0x25afdb(0x192)),0x1;const _0x396939=_0x2daea9[0x0];if(!_0x21b285[_0x25afdb(0x193)]){const _0x5576f7=await confirm(_0x25afdb(0x145)+_0x396939+_0x25afdb(0x196));if(!_0x5576f7)return console[_0x25afdb(0x1b3)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x25afdb(0x1bf)+_0x396939+_0x25afdb(0x19d),()=>_0x5b88fc[_0x25afdb(0x154)]['deleteWorkspace'](_0x396939),{'verbose':_0x21b285['verbose']}),console[_0x25afdb(0x1b3)]('Workspace\x20\x27'+_0x396939+_0x25afdb(0x181)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a16_0x55b084(0x189)]='engage:workspace:use';[a16_0x55b084(0x1ac)]='Set\x20workspace\x20context\x20for\x20Engage\x20commands';async[a16_0x55b084(0x184)](_0x3ac312){const _0x25ebeb=a16_0x55b084,{options:_0x2babde,args:_0x38249f,tdx:_0x4424fe}=_0x3ac312;if(_0x38249f['length']===0x0)return console[_0x25ebeb(0x17d)](_0x25ebeb(0x160)),console[_0x25ebeb(0x17d)](_0x25ebeb(0x161)),0x1;const _0x3f4403=_0x38249f[0x0];await withSpinner('Verifying\x20workspace\x20\x27'+_0x3f4403+_0x25ebeb(0x19d),()=>_0x4424fe[_0x25ebeb(0x154)][_0x25ebeb(0x15f)](_0x3f4403));const _0x1a960b=_0x2babde[_0x25ebeb(0x17c)]||undefined;return saveSessionContext({'engage_workspace':_0x3f4403},_0x1a960b),console[_0x25ebeb(0x1b3)](_0x25ebeb(0x144)+_0x3f4403),console[_0x25ebeb(0x1b3)](_0x25ebeb(0x159)),0x0;}}
1
+ const a16_0x74be7e=a16_0x2f08;(function(_0x299f76,_0x2be623){const _0x40a981=a16_0x2f08,_0x2a1095=_0x299f76();while(!![]){try{const _0x2c9ca8=-parseInt(_0x40a981(0x1e1))/0x1*(-parseInt(_0x40a981(0x202))/0x2)+-parseInt(_0x40a981(0x203))/0x3+-parseInt(_0x40a981(0x1ef))/0x4+parseInt(_0x40a981(0x1c6))/0x5+parseInt(_0x40a981(0x1c8))/0x6*(-parseInt(_0x40a981(0x1c0))/0x7)+-parseInt(_0x40a981(0x21f))/0x8*(-parseInt(_0x40a981(0x1f0))/0x9)+-parseInt(_0x40a981(0x1d1))/0xa;if(_0x2c9ca8===_0x2be623)break;else _0x2a1095['push'](_0x2a1095['shift']());}catch(_0x163daa){_0x2a1095['push'](_0x2a1095['shift']());}}}(a16_0x2e08,0xc6c09));function a16_0x2f08(_0xaac969,_0xcf88c){_0xaac969=_0xaac969-0x18a;const _0x2e08e0=a16_0x2e08();let _0x2f0845=_0x2e08e0[_0xaac969];return _0x2f0845;}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{confirm}from'../utils/prompt.js';import{loadSessionContext,saveSessionContext}from'../core/session.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../core/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';async function resolveWorkspaceIdFromOptions(_0x2f4ccd,_0x4d69f9,_0x1a2a4f=![]){const _0x588772=a16_0x2f08;if(_0x2f4ccd[_0x588772(0x1ad)])return await _0x4d69f9[_0x588772(0x1e5)][_0x588772(0x190)](_0x2f4ccd[_0x588772(0x1ad)]);const _0x5e2a59=loadSessionContext(_0x2f4ccd['session']);if(_0x5e2a59?.[_0x588772(0x1b6)])return await _0x4d69f9[_0x588772(0x1e5)][_0x588772(0x190)](_0x5e2a59[_0x588772(0x1b6)]);if(_0x1a2a4f)throw new SDKError(ErrorCode['MISSING_ARGUMENT'],_0x588772(0x1dd),undefined,{'helpText':_0x588772(0x1de)});return undefined;}async function resolveSegmentFromOptions(_0x1d014b,_0x1017f6){const _0x3a5358=a16_0x2f08;if(!_0x1d014b['segment'])return{};const _0x4a557b=_0x1d014b[_0x3a5358(0x1f3)],_0x304027=await _0x1017f6['segment'][_0x3a5358(0x21e)](_0x4a557b);return{'audienceId':_0x304027['parentId'],'audienceName':_0x304027[_0x3a5358(0x194)],..._0x304027[_0x3a5358(0x1e3)]&&{'segmentId':_0x304027[_0x3a5358(0x1e3)],'segmentName':_0x304027[_0x3a5358(0x1e0)]}};}function buildConnectorConfig(_0x4b7fbf){const _0x15c64d=a16_0x2f08,_0x23ba5f=_0x4b7fbf[_0x15c64d(0x191)],_0x172fe9=_0x4b7fbf['jsonColumns'];if(!_0x23ba5f&&!_0x172fe9)return undefined;return{..._0x23ba5f&&{'emailSenderId':_0x23ba5f},..._0x172fe9&&{'jsonColumns':_0x172fe9}};}export class EngageCampaignsCommand extends BaseCommand{[a16_0x74be7e(0x1a2)]=a16_0x74be7e(0x200);['description']='List\x20campaigns';async['execute'](_0x118294){const _0x4c7d97=a16_0x74be7e,{options:_0x596eb5,args:_0x416806,tdx:_0x3af60a}=_0x118294,_0x559f18=_0x416806[0x0],_0x45fe46=resolveLimit(_0x596eb5['limit'],DEFAULT_LLM_LIMIT),_0x2b25a1=_0x596eb5,_0x533afb=_0x2b25a1[_0x4c7d97(0x212)],_0x4ccb1e=_0x2b25a1['status'],_0x333be3=await resolveWorkspaceIdFromOptions(_0x2b25a1,_0x3af60a),_0xaeb815=await withSpinner(_0x4c7d97(0x205),()=>_0x3af60a[_0x4c7d97(0x1e5)]['listCampaigns']({'type':_0x533afb,'status':_0x4ccb1e,'workspaceId':_0x333be3,'limit':_0x45fe46}),{'verbose':_0x596eb5[_0x4c7d97(0x1d6)]});let _0xedb5a5=_0xaeb815[_0x4c7d97(0x21a)];return _0x559f18&&(_0xedb5a5=_0xaeb815[_0x4c7d97(0x21a)][_0x4c7d97(0x220)](_0x4ad04e=>matchGlobPattern(_0x4ad04e[_0x4c7d97(0x1a2)],_0x559f18))),await handleSDKOutput(_0xedb5a5,_0x596eb5),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a16_0x74be7e(0x1a2)]=a16_0x74be7e(0x1fd);['description']=a16_0x74be7e(0x1b5);async[a16_0x74be7e(0x19c)](_0x50f8ba){const _0x32c8ab=a16_0x74be7e,{options:_0x4b629a,args:_0x36f257,tdx:_0x2746eb}=_0x50f8ba;if(_0x36f257[_0x32c8ab(0x1a1)]===0x0)return console[_0x32c8ab(0x20f)](_0x32c8ab(0x20a)),console[_0x32c8ab(0x20f)](_0x32c8ab(0x1b4)),0x1;const _0x23db9c=_0x36f257[0x0],_0x2f5c57=_0x4b629a,_0x37d548=await resolveWorkspaceIdFromOptions(_0x2f5c57,_0x2746eb),_0x29520a=_0x2f5c57['full'];if(_0x29520a){const _0x319ad1=await withSpinner(_0x32c8ab(0x1b0)+_0x23db9c+_0x32c8ab(0x221),()=>_0x2746eb[_0x32c8ab(0x1e5)]['getCampaignFull'](_0x23db9c,_0x37d548),{'verbose':_0x4b629a[_0x32c8ab(0x1d6)]});await handleSDKOutput([_0x319ad1],_0x4b629a);}else{const _0x102e3e=await withSpinner(_0x32c8ab(0x1b0)+_0x23db9c+_0x32c8ab(0x221),()=>_0x2746eb[_0x32c8ab(0x1e5)][_0x32c8ab(0x1d2)](_0x23db9c,_0x37d548),{'verbose':_0x4b629a['verbose']});await handleSDKOutput([_0x102e3e],_0x4b629a);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{['name']=a16_0x74be7e(0x196);[a16_0x74be7e(0x1d3)]=a16_0x74be7e(0x1fb);async[a16_0x74be7e(0x19c)](_0x5895fb){const _0x451f91=a16_0x74be7e,{options:_0x164966,tdx:_0x56f693}=_0x5895fb,_0x11a140=_0x164966,_0x5e939c=_0x11a140[_0x451f91(0x1a2)],_0x428a2a=_0x11a140[_0x451f91(0x212)];if(!_0x5e939c)return console[_0x451f91(0x20f)](_0x451f91(0x1cd)),console[_0x451f91(0x20f)](_0x451f91(0x1d0)),0x1;if(!_0x428a2a)return console[_0x451f91(0x20f)](_0x451f91(0x1ca)),console[_0x451f91(0x20f)](_0x451f91(0x1d0)),0x1;const _0x198230=await resolveWorkspaceIdFromOptions(_0x11a140,_0x56f693,!![]),_0x4419cb=await resolveSegmentFromOptions(_0x11a140,_0x56f693),_0x2a0108=buildConnectorConfig(_0x11a140),_0x2b2e49={'name':_0x5e939c,'campaignType':_0x428a2a,'workspaceId':_0x198230,'description':_0x11a140[_0x451f91(0x1d3)],..._0x4419cb,'connectorConfig':_0x2a0108,'startAt':_0x11a140[_0x451f91(0x193)],'timezone':_0x11a140[_0x451f91(0x1a0)]},_0x718034=await withSpinner(_0x451f91(0x1f9)+_0x5e939c+'\x27...',()=>_0x56f693[_0x451f91(0x1e5)][_0x451f91(0x1a3)](_0x2b2e49));return await handleSDKOutput([_0x718034[_0x451f91(0x21a)]],_0x164966),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a16_0x74be7e(0x1a2)]=a16_0x74be7e(0x1a6);['description']=a16_0x74be7e(0x18e);async[a16_0x74be7e(0x19c)](_0x31207f){const _0x4e7c7c=a16_0x74be7e,{options:_0x322a2a,args:_0x3ee469,tdx:_0xd59d07}=_0x31207f;if(_0x3ee469['length']===0x0)return console[_0x4e7c7c(0x20f)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x4e7c7c(0x20f)](_0x4e7c7c(0x21b)),0x1;const _0x13f67f=_0x3ee469[0x0],_0x35b4ee=_0x322a2a,_0x501fd6=await resolveWorkspaceIdFromOptions(_0x35b4ee,_0xd59d07),_0x296d19=await resolveSegmentFromOptions(_0x35b4ee,_0xd59d07),_0x580b7c=buildConnectorConfig(_0x35b4ee),_0x54c33c={'name':_0x35b4ee[_0x4e7c7c(0x1a2)],'description':_0x35b4ee[_0x4e7c7c(0x1d3)],..._0x296d19,'connectorConfig':_0x580b7c,'startAt':_0x35b4ee['startAt'],'timezone':_0x35b4ee[_0x4e7c7c(0x1a0)]},_0x2c7638=Object['fromEntries'](Object[_0x4e7c7c(0x1be)](_0x54c33c)['filter'](([,_0x1e2e38])=>_0x1e2e38!==undefined));if(Object['keys'](_0x2c7638)['length']===0x0)return console[_0x4e7c7c(0x20f)](_0x4e7c7c(0x1ba)),console[_0x4e7c7c(0x20f)](_0x4e7c7c(0x198)),0x1;const _0x4bd3c5=await withSpinner(_0x4e7c7c(0x1a7)+_0x13f67f+_0x4e7c7c(0x221),()=>_0xd59d07[_0x4e7c7c(0x1e5)][_0x4e7c7c(0x195)](_0x13f67f,_0x2c7638,_0x501fd6),{'verbose':_0x322a2a[_0x4e7c7c(0x1d6)]});return await handleSDKOutput([_0x4bd3c5[_0x4e7c7c(0x21a)]],_0x322a2a),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{[a16_0x74be7e(0x1a2)]=a16_0x74be7e(0x1f7);[a16_0x74be7e(0x1d3)]=a16_0x74be7e(0x213);async[a16_0x74be7e(0x19c)](_0x30e905){const _0x1491ab=a16_0x74be7e,{options:_0x99a766,args:_0x545d1f,tdx:_0x17511b}=_0x30e905;if(_0x545d1f['length']===0x0)return console[_0x1491ab(0x20f)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x1491ab(0x20f)](_0x1491ab(0x1bf)),0x1;const _0x15ea9f=_0x545d1f[0x0],_0x2b0eb1=_0x99a766,_0x24af2b=await resolveWorkspaceIdFromOptions(_0x2b0eb1,_0x17511b);if(!_0x99a766['yes']){const _0x15ba25=await confirm(_0x1491ab(0x209)+_0x15ea9f+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x15ba25)return console[_0x1491ab(0x1d7)](_0x1491ab(0x1a9)),0x0;}return await withSpinner(_0x1491ab(0x1a4)+_0x15ea9f+'\x27...',()=>_0x17511b[_0x1491ab(0x1e5)]['deleteCampaign'](_0x15ea9f,_0x24af2b),{'verbose':_0x99a766[_0x1491ab(0x1d6)]}),console['log'](_0x1491ab(0x204)+_0x15ea9f+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a16_0x74be7e(0x1a2)]=a16_0x74be7e(0x19d);[a16_0x74be7e(0x1d3)]=a16_0x74be7e(0x1b3);async[a16_0x74be7e(0x19c)](_0x536dcc){const _0x4c5eb9=a16_0x74be7e,{options:_0x4630b9,args:_0x119f3d,tdx:_0x3178cf}=_0x536dcc;if(_0x119f3d[_0x4c5eb9(0x1a1)]===0x0)return console['error'](_0x4c5eb9(0x20a)),console[_0x4c5eb9(0x20f)]('Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>'),0x1;const _0x15f6c7=_0x119f3d[0x0],_0x18b2c0=_0x4630b9,_0x495346=await resolveWorkspaceIdFromOptions(_0x18b2c0,_0x3178cf);return await withSpinner(_0x4c5eb9(0x192)+_0x15f6c7+_0x4c5eb9(0x221),()=>_0x3178cf[_0x4c5eb9(0x1e5)][_0x4c5eb9(0x1ec)](_0x15f6c7,_0x495346),{'verbose':_0x4630b9[_0x4c5eb9(0x1d6)]}),console[_0x4c5eb9(0x1d7)]('Campaign\x20\x27'+_0x15f6c7+_0x4c5eb9(0x1e6)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a16_0x74be7e(0x1a2)]='engage:campaign:pause';[a16_0x74be7e(0x1d3)]='Pause\x20a\x20campaign';async[a16_0x74be7e(0x19c)](_0x23d4e0){const _0x5936ee=a16_0x74be7e,{options:_0xf3b474,args:_0x332ce8,tdx:_0x4d7b25}=_0x23d4e0;if(_0x332ce8['length']===0x0)return console[_0x5936ee(0x20f)](_0x5936ee(0x20a)),console[_0x5936ee(0x20f)](_0x5936ee(0x1df)),0x1;const _0x36de76=_0x332ce8[0x0],_0x476536=_0xf3b474,_0x1d83eb=await resolveWorkspaceIdFromOptions(_0x476536,_0x4d7b25);return await withSpinner(_0x5936ee(0x201)+_0x36de76+_0x5936ee(0x221),()=>_0x4d7b25[_0x5936ee(0x1e5)]['pauseCampaign'](_0x36de76,_0x1d83eb),{'verbose':_0xf3b474[_0x5936ee(0x1d6)]}),console[_0x5936ee(0x1d7)](_0x5936ee(0x204)+_0x36de76+_0x5936ee(0x18b)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{['name']='engage:campaign:resume';[a16_0x74be7e(0x1d3)]=a16_0x74be7e(0x1fc);async[a16_0x74be7e(0x19c)](_0x3f5fe2){const _0x2c9888=a16_0x74be7e,{options:_0x171ded,args:_0x3c61f4,tdx:_0x2691f4}=_0x3f5fe2;if(_0x3c61f4[_0x2c9888(0x1a1)]===0x0)return console['error'](_0x2c9888(0x20a)),console['error'](_0x2c9888(0x1a8)),0x1;const _0x45cfde=_0x3c61f4[0x0],_0xa26beb=_0x171ded,_0x4ebfcb=await resolveWorkspaceIdFromOptions(_0xa26beb,_0x2691f4);return await withSpinner(_0x2c9888(0x207)+_0x45cfde+_0x2c9888(0x221),()=>_0x2691f4[_0x2c9888(0x1e5)][_0x2c9888(0x1cc)](_0x45cfde,_0x4ebfcb),{'verbose':_0x171ded[_0x2c9888(0x1d6)]}),console[_0x2c9888(0x1d7)](_0x2c9888(0x204)+_0x45cfde+_0x2c9888(0x1ea)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{[a16_0x74be7e(0x1a2)]=a16_0x74be7e(0x1ae);[a16_0x74be7e(0x1d3)]=a16_0x74be7e(0x199);async[a16_0x74be7e(0x19c)](_0x2673ea){const _0x11ff66=a16_0x74be7e,{options:_0x113dad,args:_0x48caa8,tdx:_0x1f3130}=_0x2673ea;if(_0x48caa8['length']===0x0)return console[_0x11ff66(0x20f)](_0x11ff66(0x20a)),console[_0x11ff66(0x20f)]('Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>'),0x1;const _0x14d5e5=_0x48caa8[0x0],_0x1144b2=_0x113dad,_0x28c60d=await resolveWorkspaceIdFromOptions(_0x1144b2,_0x1f3130),_0x17a9d0=await withSpinner(_0x11ff66(0x1d9)+_0x14d5e5+'\x27...',()=>_0x1f3130[_0x11ff66(0x1e5)][_0x11ff66(0x1c1)](_0x14d5e5,_0x28c60d),{'verbose':_0x113dad[_0x11ff66(0x1d6)]});return await handleSDKOutput([_0x17a9d0['data']],_0x113dad),0x0;}}export class EngageTemplatesCommand extends BaseCommand{[a16_0x74be7e(0x1a2)]=a16_0x74be7e(0x1c3);[a16_0x74be7e(0x1d3)]='List\x20email\x20templates';async['execute'](_0x413d86){const _0x3846db=a16_0x74be7e,{options:_0x141f54,args:_0x49791e,tdx:_0x4ea274}=_0x413d86,_0x509198=_0x49791e[0x0],_0x4597b1=resolveLimit(_0x141f54[_0x3846db(0x18a)],DEFAULT_LLM_LIMIT),_0x3658a3=_0x141f54,_0x30f872=await resolveWorkspaceIdFromOptions(_0x3658a3,_0x4ea274),_0x5337a6=await withSpinner('Fetching\x20templates...',()=>_0x4ea274['engage'][_0x3846db(0x210)]({'workspaceId':_0x30f872,'limit':_0x4597b1}),{'verbose':_0x141f54['verbose']});let _0x1878e2=_0x5337a6[_0x3846db(0x21a)];return _0x509198&&(_0x1878e2=_0x5337a6['data'][_0x3846db(0x220)](_0x4dd7a2=>matchGlobPattern(_0x4dd7a2[_0x3846db(0x1a2)],_0x509198))),await handleSDKOutput(_0x1878e2,_0x141f54),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{['name']=a16_0x74be7e(0x18f);['description']=a16_0x74be7e(0x1d5);async['execute'](_0xbca6a3){const _0x47e53c=a16_0x74be7e,{options:_0x52d044,args:_0x1e754e,tdx:_0x555d81}=_0xbca6a3;if(_0x1e754e[_0x47e53c(0x1a1)]===0x0)return console[_0x47e53c(0x20f)](_0x47e53c(0x18d)),console[_0x47e53c(0x20f)](_0x47e53c(0x219)),0x1;const _0x2d4795=_0x1e754e[0x0],_0x5ed2b6=_0x52d044,_0x4cb7b8=await resolveWorkspaceIdFromOptions(_0x5ed2b6,_0x555d81),_0x10a279=_0x5ed2b6['full'];if(_0x10a279){const _0x2b4c48=await withSpinner(_0x47e53c(0x1d8)+_0x2d4795+_0x47e53c(0x221),()=>_0x555d81[_0x47e53c(0x1e5)]['getTemplateFull'](_0x2d4795,_0x4cb7b8),{'verbose':_0x52d044['verbose']});await handleSDKOutput([_0x2b4c48],_0x52d044);}else{const _0x21822d=await withSpinner(_0x47e53c(0x1d8)+_0x2d4795+_0x47e53c(0x221),()=>_0x555d81[_0x47e53c(0x1e5)][_0x47e53c(0x1f2)](_0x2d4795,_0x4cb7b8),{'verbose':_0x52d044[_0x47e53c(0x1d6)]});await handleSDKOutput([_0x21822d],_0x52d044);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a16_0x74be7e(0x1a2)]=a16_0x74be7e(0x1d4);['description']=a16_0x74be7e(0x1e8);async[a16_0x74be7e(0x19c)](_0xaaa999){const _0xd7bb09=a16_0x74be7e,{options:_0x1266bf,tdx:_0x390ea3}=_0xaaa999,_0x1d374=_0x1266bf,_0x2bc9b4=_0x1d374[_0xd7bb09(0x1a2)],_0x1acf92=_0x1d374[_0xd7bb09(0x1f4)],_0x292268=_0x1d374[_0xd7bb09(0x1b1)];if(!_0x2bc9b4)return console[_0xd7bb09(0x20f)](_0xd7bb09(0x1cd)),console['error'](_0xd7bb09(0x1fe)),0x1;if(!_0x1acf92)return console[_0xd7bb09(0x20f)](_0xd7bb09(0x197)),0x1;if(!_0x292268)return console[_0xd7bb09(0x20f)](_0xd7bb09(0x1b8)),0x1;const _0x199254=await resolveWorkspaceIdFromOptions(_0x1d374,_0x390ea3,!![]),_0x6298ac={'name':_0x2bc9b4,'subjectTemplate':_0x1acf92,'htmlTemplate':_0x292268,'workspaceId':_0x199254,'plaintextTemplate':_0x1d374[_0xd7bb09(0x222)],'editorType':_0x1d374[_0xd7bb09(0x1c7)]},_0x47b76c=await withSpinner(_0xd7bb09(0x1ac)+_0x2bc9b4+'\x27...',()=>_0x390ea3[_0xd7bb09(0x1e5)][_0xd7bb09(0x216)](_0x6298ac));return await handleSDKOutput([_0x47b76c['data']],_0x1266bf),0x0;}}function a16_0x2e08(){const _0x3f4ecc=['Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>','Set\x20workspace\x20context\x20for\x20Engage\x20commands','engage:campaigns','Pausing\x20campaign\x20\x27','2zPphDn','761994SgAMGb','Campaign\x20\x27','Fetching\x20campaigns...','Creating\x20workspace\x20\x27','Resuming\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','engage:template:delete','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','Update\x20an\x20email\x20template','Deleting\x20workspace\x20\x27','error','listTemplates','Engage\x20workspace\x20set\x20to:\x20','type','Delete\x20a\x20campaign','updateWorkspace','engage:workspace:create','createTemplate','getWorkspace','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','data','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Fetching\x20workspaces...','Delete\x20a\x20workspace','resolvePathToResource','640yhyjuA','filter','\x27...','plaintext','limit','\x27\x20paused\x20successfully','Show\x20workspace\x20details','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','Update\x20a\x20campaign','engage:template:show','resolveWorkspaceId','emailSenderId','Launching\x20campaign\x20\x27','startAt','parentName','updateCampaign','engage:campaign:create','Error:\x20--subject\x20is\x20required','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','Duplicate\x20a\x20campaign','createWorkspace','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','execute','engage:campaign:launch','List\x20workspaces','yes','timezone','length','name','createCampaign','Deleting\x20campaign\x20\x27','Options:\x20--name,\x20--description','engage:campaign:update','Updating\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','Operation\x20cancelled','engage:workspace:use','Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>','Creating\x20template\x20\x27','workspace','engage:campaign:duplicate','Verifying\x20workspace\x20\x27','Fetching\x20campaign\x20\x27','html','\x27\x20deleted\x20successfully','Launch\x20a\x20campaign','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','Show\x20campaign\x20details','engage_workspace','engage:template:update','Error:\x20--html\x20is\x20required','engage:workspace:update','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Error:\x20Workspace\x20name\x20is\x20required','full','entries','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','35WmXxiA','duplicateCampaign','Template\x20\x27','engage:templates','Updating\x20template\x20\x27','Deleting\x20template\x20\x27','6569805BSxtFf','editorType','953010PsILoa','deleteTemplate','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','getWorkspaceFull','resumeCampaign','Error:\x20--name\x20is\x20required','listWorkspaces','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','8399120kLHIqk','getCampaign','description','engage:template:create','Show\x20email\x20template\x20details','verbose','log','Fetching\x20template\x20\x27','Duplicating\x20campaign\x20\x27','\x27?\x20This\x20cannot\x20be\x20undone.','engage:workspaces','Updating\x20workspace\x20\x27','Workspace\x20is\x20required\x20for\x20this\x20operation','Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22','Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>','segmentName','1344613hLMhmh','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','segmentId','Fetching\x20workspace\x20\x27','engage','\x27\x20launched\x20successfully','deleteWorkspace','Create\x20an\x20email\x20template','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','\x27\x20resumed\x20successfully','Delete\x20an\x20email\x20template','launchCampaign','Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>','session','3674560PDsvdi','108252mHNuBl','Workspace\x20\x27','getTemplate','segment','subject','fromEntries','keys','engage:campaign:delete','Create\x20a\x20workspace','Creating\x20campaign\x20\x27','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','Create\x20a\x20new\x20campaign','Resume\x20a\x20paused\x20campaign','engage:campaign:show'];a16_0x2e08=function(){return _0x3f4ecc;};return a16_0x2e08();}export class EngageTemplateUpdateCommand extends BaseCommand{[a16_0x74be7e(0x1a2)]=a16_0x74be7e(0x1b7);[a16_0x74be7e(0x1d3)]=a16_0x74be7e(0x20d);async['execute'](_0x15a5bd){const _0x11db90=a16_0x74be7e,{options:_0x2fc95c,args:_0x32c0af,tdx:_0x50bf50}=_0x15a5bd;if(_0x32c0af['length']===0x0)return console[_0x11db90(0x20f)](_0x11db90(0x18d)),console['error'](_0x11db90(0x1bb)),0x1;const _0x542384=_0x32c0af[0x0],_0x2fcb2e=_0x2fc95c,_0x24b013=await resolveWorkspaceIdFromOptions(_0x2fcb2e,_0x50bf50),_0x4b1973={'name':_0x2fcb2e['name'],'subjectTemplate':_0x2fcb2e[_0x11db90(0x1f4)],'htmlTemplate':_0x2fcb2e[_0x11db90(0x1b1)],'plaintextTemplate':_0x2fcb2e[_0x11db90(0x222)]},_0x429c53=Object[_0x11db90(0x1f5)](Object[_0x11db90(0x1be)](_0x4b1973)['filter'](([,_0x21d622])=>_0x21d622!==undefined));if(Object[_0x11db90(0x1f6)](_0x429c53)[_0x11db90(0x1a1)]===0x0)return console[_0x11db90(0x20f)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x11db90(0x20f)](_0x11db90(0x1fa)),0x1;const _0x1641e2=await withSpinner(_0x11db90(0x1c4)+_0x542384+_0x11db90(0x221),()=>_0x50bf50[_0x11db90(0x1e5)]['updateTemplate'](_0x542384,_0x429c53,_0x24b013),{'verbose':_0x2fc95c[_0x11db90(0x1d6)]});return await handleSDKOutput([_0x1641e2[_0x11db90(0x21a)]],_0x2fc95c),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{['name']=a16_0x74be7e(0x20b);[a16_0x74be7e(0x1d3)]=a16_0x74be7e(0x1eb);async[a16_0x74be7e(0x19c)](_0x3671ac){const _0x19d9fc=a16_0x74be7e,{options:_0x3ceee,args:_0x11bcc0,tdx:_0x1b5639}=_0x3671ac;if(_0x11bcc0[_0x19d9fc(0x1a1)]===0x0)return console[_0x19d9fc(0x20f)]('Error:\x20Template\x20name\x20or\x20ID\x20is\x20required'),console[_0x19d9fc(0x20f)](_0x19d9fc(0x1ab)),0x1;const _0x3a0bf0=_0x11bcc0[0x0],_0x26bfb0=_0x3ceee,_0x468bf0=await resolveWorkspaceIdFromOptions(_0x26bfb0,_0x1b5639);if(!_0x3ceee['yes']){const _0x3f4c02=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27'+_0x3a0bf0+_0x19d9fc(0x1da));if(!_0x3f4c02)return console[_0x19d9fc(0x1d7)](_0x19d9fc(0x1a9)),0x0;}return await withSpinner(_0x19d9fc(0x1c5)+_0x3a0bf0+_0x19d9fc(0x221),()=>_0x1b5639[_0x19d9fc(0x1e5)][_0x19d9fc(0x1c9)](_0x3a0bf0,_0x468bf0),{'verbose':_0x3ceee[_0x19d9fc(0x1d6)]}),console['log'](_0x19d9fc(0x1c2)+_0x3a0bf0+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{[a16_0x74be7e(0x1a2)]=a16_0x74be7e(0x1db);[a16_0x74be7e(0x1d3)]=a16_0x74be7e(0x19e);async[a16_0x74be7e(0x19c)](_0x2cccf1){const _0x51a654=a16_0x74be7e,{options:_0x3df98e,args:_0x364dc4,tdx:_0x304c6d}=_0x2cccf1,_0x5cb83f=_0x364dc4[0x0],_0x4b096d=resolveLimit(_0x3df98e['limit'],DEFAULT_LLM_LIMIT),_0x322a52=await withSpinner(_0x51a654(0x21c),()=>_0x304c6d[_0x51a654(0x1e5)][_0x51a654(0x1ce)]({'limit':_0x4b096d}),{'verbose':_0x3df98e['verbose']});let _0x2553ac=_0x322a52['data'];return _0x5cb83f&&(_0x2553ac=_0x322a52[_0x51a654(0x21a)][_0x51a654(0x220)](_0x1afd7e=>matchGlobPattern(_0x1afd7e['name'],_0x5cb83f))),await handleSDKOutput(_0x2553ac,_0x3df98e),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a16_0x74be7e(0x1a2)]='engage:workspace:show';[a16_0x74be7e(0x1d3)]=a16_0x74be7e(0x18c);async[a16_0x74be7e(0x19c)](_0x117187){const _0x47684a=a16_0x74be7e,{options:_0x1e48e9,args:_0x30a069,tdx:_0x413cd3}=_0x117187;if(_0x30a069[_0x47684a(0x1a1)]===0x0)return console['error'](_0x47684a(0x218)),console['error'](_0x47684a(0x1ed)),0x1;const _0x85ea34=_0x30a069[0x0],_0x1b5829=_0x1e48e9,_0x4176e4=_0x1b5829[_0x47684a(0x1bd)];if(_0x4176e4){const _0x1cc150=await withSpinner(_0x47684a(0x1e4)+_0x85ea34+_0x47684a(0x221),()=>_0x413cd3[_0x47684a(0x1e5)][_0x47684a(0x1cb)](_0x85ea34),{'verbose':_0x1e48e9[_0x47684a(0x1d6)]});await handleSDKOutput([_0x1cc150],_0x1e48e9);}else{const _0x2d3c7d=await withSpinner('Fetching\x20workspace\x20\x27'+_0x85ea34+'\x27...',()=>_0x413cd3[_0x47684a(0x1e5)][_0x47684a(0x217)](_0x85ea34),{'verbose':_0x1e48e9[_0x47684a(0x1d6)]});await handleSDKOutput([_0x2d3c7d],_0x1e48e9);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{['name']=a16_0x74be7e(0x215);[a16_0x74be7e(0x1d3)]=a16_0x74be7e(0x1f8);async[a16_0x74be7e(0x19c)](_0x2f9fda){const _0x22f5ac=a16_0x74be7e,{options:_0x471215,tdx:_0x37a727}=_0x2f9fda,_0x4c41a5=_0x471215,_0x4ec767=_0x4c41a5[_0x22f5ac(0x1a2)];if(!_0x4ec767)return console[_0x22f5ac(0x20f)]('Error:\x20--name\x20is\x20required'),console[_0x22f5ac(0x20f)](_0x22f5ac(0x1cf)),0x1;const _0x50f3e5={'name':_0x4ec767,'description':_0x4c41a5['description']},_0x52ab45=await withSpinner(_0x22f5ac(0x206)+_0x4ec767+_0x22f5ac(0x221),()=>_0x37a727[_0x22f5ac(0x1e5)][_0x22f5ac(0x19a)](_0x50f3e5));return await handleSDKOutput([_0x52ab45[_0x22f5ac(0x21a)]],_0x471215),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a16_0x74be7e(0x1a2)]=a16_0x74be7e(0x1b9);[a16_0x74be7e(0x1d3)]='Update\x20a\x20workspace';async['execute'](_0x388bad){const _0x303cb9=a16_0x74be7e,{options:_0x4e2d54,args:_0x2f3f84,tdx:_0x179e10}=_0x388bad;if(_0x2f3f84[_0x303cb9(0x1a1)]===0x0)return console['error'](_0x303cb9(0x218)),console['error'](_0x303cb9(0x19b)),0x1;const _0x3fc676=_0x2f3f84[0x0],_0x5c746e=_0x4e2d54,_0x3b1603={'name':_0x5c746e[_0x303cb9(0x1a2)],'description':_0x5c746e[_0x303cb9(0x1d3)]},_0x1e3d5f=Object[_0x303cb9(0x1f5)](Object[_0x303cb9(0x1be)](_0x3b1603)['filter'](([,_0x4ec456])=>_0x4ec456!==undefined));if(Object[_0x303cb9(0x1f6)](_0x1e3d5f)['length']===0x0)return console[_0x303cb9(0x20f)](_0x303cb9(0x1ba)),console[_0x303cb9(0x20f)](_0x303cb9(0x1a5)),0x1;const _0xd4c928=await withSpinner(_0x303cb9(0x1dc)+_0x3fc676+_0x303cb9(0x221),()=>_0x179e10[_0x303cb9(0x1e5)][_0x303cb9(0x214)](_0x3fc676,_0x1e3d5f),{'verbose':_0x4e2d54[_0x303cb9(0x1d6)]});return await handleSDKOutput([_0xd4c928[_0x303cb9(0x21a)]],_0x4e2d54),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{['name']='engage:workspace:delete';['description']=a16_0x74be7e(0x21d);async[a16_0x74be7e(0x19c)](_0x1be78f){const _0x554c87=a16_0x74be7e,{options:_0x16a6d0,args:_0x4eaa7b,tdx:_0x51dad3}=_0x1be78f;if(_0x4eaa7b[_0x554c87(0x1a1)]===0x0)return console[_0x554c87(0x20f)](_0x554c87(0x218)),console['error'](_0x554c87(0x208)),0x1;const _0x26cf8e=_0x4eaa7b[0x0];if(!_0x16a6d0[_0x554c87(0x19f)]){const _0x50d1e3=await confirm(_0x554c87(0x1e9)+_0x26cf8e+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x50d1e3)return console[_0x554c87(0x1d7)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x554c87(0x20e)+_0x26cf8e+_0x554c87(0x221),()=>_0x51dad3['engage'][_0x554c87(0x1e7)](_0x26cf8e),{'verbose':_0x16a6d0[_0x554c87(0x1d6)]}),console[_0x554c87(0x1d7)](_0x554c87(0x1f1)+_0x26cf8e+_0x554c87(0x1b2)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a16_0x74be7e(0x1a2)]=a16_0x74be7e(0x1aa);[a16_0x74be7e(0x1d3)]=a16_0x74be7e(0x1ff);async[a16_0x74be7e(0x19c)](_0x5d9bce){const _0x116fbd=a16_0x74be7e,{options:_0x3bbf5,args:_0x36b684,tdx:_0x415f16}=_0x5d9bce;if(_0x36b684[_0x116fbd(0x1a1)]===0x0)return console[_0x116fbd(0x20f)](_0x116fbd(0x1bc)),console['error'](_0x116fbd(0x20c)),0x1;const _0x59e9bf=_0x36b684[0x0];await withSpinner(_0x116fbd(0x1af)+_0x59e9bf+_0x116fbd(0x221),()=>_0x415f16[_0x116fbd(0x1e5)][_0x116fbd(0x190)](_0x59e9bf));const _0xd00d85=_0x3bbf5[_0x116fbd(0x1ee)]||undefined;return saveSessionContext({'engage_workspace':_0x59e9bf},_0xd00d85),console[_0x116fbd(0x1d7)](_0x116fbd(0x211)+_0x59e9bf),console[_0x116fbd(0x1d7)](_0x116fbd(0x1e2)),0x0;}}
@@ -1 +1 @@
1
- const a17_0x30ad65=a17_0x55cc;(function(_0x1fc521,_0x217a9e){const _0x3a1ad5=a17_0x55cc,_0x2f0117=_0x1fc521();while(!![]){try{const _0x5a6ba2=parseInt(_0x3a1ad5(0x17c))/0x1*(parseInt(_0x3a1ad5(0x162))/0x2)+-parseInt(_0x3a1ad5(0x186))/0x3+parseInt(_0x3a1ad5(0x183))/0x4*(parseInt(_0x3a1ad5(0x174))/0x5)+parseInt(_0x3a1ad5(0x18e))/0x6*(parseInt(_0x3a1ad5(0x18b))/0x7)+parseInt(_0x3a1ad5(0x18a))/0x8*(parseInt(_0x3a1ad5(0x176))/0x9)+-parseInt(_0x3a1ad5(0x166))/0xa*(-parseInt(_0x3a1ad5(0x175))/0xb)+-parseInt(_0x3a1ad5(0x19c))/0xc*(parseInt(_0x3a1ad5(0x165))/0xd);if(_0x5a6ba2===_0x217a9e)break;else _0x2f0117['push'](_0x2f0117['shift']());}catch(_0xb6510){_0x2f0117['push'](_0x2f0117['shift']());}}}(a17_0x4686,0x28de1));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../sdk/query/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';export class JobListCommand extends BaseCommand{[a17_0x30ad65(0x17e)]=a17_0x30ad65(0x1a6);[a17_0x30ad65(0x1a0)]=a17_0x30ad65(0x19b);async['execute'](_0x4198a0){const _0x49e921=a17_0x30ad65,{options:_0x2d1cf8,tdx:_0x37f228}=_0x4198a0;try{const _0x45fde6=resolveLimit(_0x2d1cf8[_0x49e921(0x196)],DEFAULT_DISPLAY_LIMIT),_0x67e489=_0x2d1cf8[_0x49e921(0x16d)];_0x2d1cf8[_0x49e921(0x1a2)]&&(console[_0x49e921(0x1a8)](_0x49e921(0x1a4)+_0x45fde6+'\x20jobs'),_0x67e489&&console['error'](_0x49e921(0x19a)+_0x67e489));const _0x1f8413=await withSpinner('Listing\x20jobs...',()=>_0x37f228[_0x49e921(0x1a6)][_0x49e921(0x195)]({'from':0x0,'to':_0x45fde6-0x1,'status':_0x67e489}),{'verbose':_0x2d1cf8['verbose']}),_0x317cb1=_0x1f8413[_0x49e921(0x173)];console['error']('✔\x20Found\x20'+_0x317cb1['length']+_0x49e921(0x17f)+(_0x317cb1['length']!==0x1?'s':''));const _0x471ebe=_0x317cb1['map'](_0x889890=>{const _0x34324a=_0x49e921;let _0x38d5af;if(_0x889890[_0x34324a(0x16f)]&&_0x889890[_0x34324a(0x193)]){const _0x4aa8be=new Date(_0x889890['start_at'])[_0x34324a(0x191)](),_0x3c10bf=new Date(_0x889890[_0x34324a(0x193)])[_0x34324a(0x191)]();_0x38d5af=Math[_0x34324a(0x19d)]((_0x3c10bf-_0x4aa8be)/0x3e8);}return{'job_id':_0x889890[_0x34324a(0x190)],'type':_0x889890['type'],'status':_0x889890['status'],'user_name':_0x889890['user_name'],'duration_sec':_0x38d5af,'created_at':_0x889890[_0x34324a(0x17d)],'started_at':_0x889890['start_at'],'end_at':_0x889890[_0x34324a(0x193)]};});return await handleSDKOutput(_0x471ebe,_0x2d1cf8),0x0;}catch(_0x1c7d46){if(_0x1c7d46 instanceof SDKError)return console[_0x49e921(0x1a8)](_0x49e921(0x169)+_0x1c7d46[_0x49e921(0x180)]),_0x1c7d46[_0x49e921(0x188)]&&console[_0x49e921(0x1a8)](_0x49e921(0x1ab)+_0x1c7d46[_0x49e921(0x188)]),0x1;throw _0x1c7d46;}}}export class JobShowCommand extends BaseCommand{[a17_0x30ad65(0x17e)]=a17_0x30ad65(0x164);[a17_0x30ad65(0x1a0)]=a17_0x30ad65(0x160);async['execute'](_0x113e1e){const _0x3af46d=a17_0x30ad65,{options:_0x3687ea,args:_0x5733c3,tdx:_0x47bf51}=_0x113e1e,_0x31af8a=_0x5733c3[0x0];if(!_0x31af8a)return console[_0x3af46d(0x1a8)](_0x3af46d(0x170)),console[_0x3af46d(0x1a8)](_0x3af46d(0x178)),0x1;try{const _0x5a770c=await withSpinner(_0x3af46d(0x1aa),()=>_0x47bf51[_0x3af46d(0x1a6)]['show'](_0x31af8a),{'verbose':_0x3687ea[_0x3af46d(0x1a2)]}),_0x4907b2=_0x5a770c['data'];let _0x371280;if(_0x4907b2[_0x3af46d(0x16f)]&&_0x4907b2[_0x3af46d(0x193)]){const _0x5a76f4=new Date(_0x4907b2[_0x3af46d(0x16f)])[_0x3af46d(0x191)](),_0x15c158=new Date(_0x4907b2[_0x3af46d(0x193)])[_0x3af46d(0x191)]();_0x371280=Math['round']((_0x15c158-_0x5a76f4)/0x3e8);}const _0x24bee3={'job_id':_0x4907b2[_0x3af46d(0x190)],'type':_0x4907b2[_0x3af46d(0x181)],'status':_0x4907b2[_0x3af46d(0x16d)],..._0x4907b2[_0x3af46d(0x18c)]&&{'user_name':_0x4907b2['user_name']},..._0x371280!==undefined&&{'duration_sec':_0x371280},..._0x4907b2[_0x3af46d(0x17d)]&&{'created_at':_0x4907b2[_0x3af46d(0x17d)]},..._0x4907b2[_0x3af46d(0x16f)]&&{'started_at':_0x4907b2[_0x3af46d(0x16f)]},..._0x4907b2[_0x3af46d(0x193)]&&{'end_at':_0x4907b2['end_at']},..._0x4907b2[_0x3af46d(0x1a7)]&&{'database':_0x4907b2[_0x3af46d(0x1a7)]},..._0x4907b2['priority']!==undefined&&{'priority':_0x4907b2['priority']},..._0x4907b2[_0x3af46d(0x15f)]&&{'url':_0x4907b2[_0x3af46d(0x15f)]},..._0x4907b2[_0x3af46d(0x19e)]&&{'query':_0x4907b2[_0x3af46d(0x19e)]},..._0x4907b2[_0x3af46d(0x189)]&&{'debug':_0x4907b2[_0x3af46d(0x189)]}};return await handleSingleObjectOutput(_0x24bee3,_0x3687ea),0x0;}catch(_0x7f90ca){if(_0x7f90ca instanceof SDKError)return console[_0x3af46d(0x1a8)]('Error:\x20'+_0x7f90ca[_0x3af46d(0x180)]),_0x7f90ca['cause']&&console[_0x3af46d(0x1a8)](_0x3af46d(0x1ab)+_0x7f90ca[_0x3af46d(0x188)]),0x1;throw _0x7f90ca;}}}function a17_0x55cc(_0xbdf828,_0x5f2b65){_0xbdf828=_0xbdf828-0x15f;const _0x46869b=a17_0x4686();let _0x55cc70=_0x46869b[_0xbdf828];return _0x55cc70;}export class JobKillCommand extends BaseCommand{['name']='job:kill';[a17_0x30ad65(0x1a0)]=a17_0x30ad65(0x1a1);async[a17_0x30ad65(0x187)](_0x9ffcf2){const _0xa81c0e=a17_0x30ad65,{options:_0x347b41,args:_0x47ed20,tdx:_0x1e6d7c}=_0x9ffcf2,_0x1b1f24=_0x47ed20[0x0];if(!_0x1b1f24)return console[_0xa81c0e(0x1a8)](_0xa81c0e(0x170)),console[_0xa81c0e(0x1a8)](_0xa81c0e(0x167)),0x1;try{if(!_0x347b41['yes']){const _0xbe6371=await confirm(_0xa81c0e(0x1a5)+_0x1b1f24+'?');if(!_0xbe6371)return console[_0xa81c0e(0x1a8)](_0xa81c0e(0x1a3)),0x0;}return await withSpinner(_0xa81c0e(0x1a9),()=>_0x1e6d7c[_0xa81c0e(0x1a6)][_0xa81c0e(0x16c)](_0x1b1f24),{'verbose':_0x347b41[_0xa81c0e(0x1a2)]}),console[_0xa81c0e(0x1a8)](_0xa81c0e(0x185)+_0x1b1f24),console[_0xa81c0e(0x1a8)](_0xa81c0e(0x179)+_0x1b1f24+_0xa81c0e(0x163)),0x0;}catch(_0xf000f3){if(_0xf000f3 instanceof SDKError)return console[_0xa81c0e(0x1a8)]('Error:\x20'+_0xf000f3[_0xa81c0e(0x180)]),_0xf000f3[_0xa81c0e(0x188)]&&console[_0xa81c0e(0x1a8)](_0xa81c0e(0x1ab)+_0xf000f3['cause']),0x1;throw _0xf000f3;}}}function a17_0x4686(){const _0x46f550=['data','205umTspI','908171POSymi','33543PBsewu','result','Usage:\x20job\x20show\x20<job-id>','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','length','115799RdRrOi','created_at','name','\x20job','message','type','Database:\x20','23292wCkqii','Get\x20job\x20results','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','57525vPrlWx','execute','cause','debug','256qLForS','3227lensVs','user_name','substring','1746VPopaD','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','job_id','getTime','✔\x20Retrieved\x20','end_at','trino','list','limit','Getting\x20job\x20results...','file','hive','Status\x20filter:\x20','List\x20jobs','604740CXQYhG','round','query','Submit\x20a\x20job','description','Kill\x20a\x20job','verbose','Cancelled','Limit:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','jobs','database','error','Submitting\x20kill\x20request...','Getting\x20job\x20details...','\x20\x20Cause:\x20','url','Show\x20job\x20details','\x20\x20Job\x20ID:\x20','2btGzRf','\x27\x20to\x20verify\x20the\x20job\x20status','job:show','130wEipPg','10czmErQ','Usage:\x20job\x20kill\x20<job-id>','job:submit','Error:\x20','Submitting\x20job...','Job\x20type:\x20','kill','status','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','start_at','Error:\x20Job\x20ID\x20is\x20required','information_schema','Error:\x20Query\x20is\x20required'];a17_0x4686=function(){return _0x46f550;};return a17_0x4686();}export class JobSubmitCommand extends BaseCommand{['name']=a17_0x30ad65(0x168);['description']=a17_0x30ad65(0x19f);async[a17_0x30ad65(0x187)](_0x599d86){const _0x264bdd=a17_0x30ad65,{options:_0x44d622,args:_0x5f419d,tdx:_0xb1e527}=_0x599d86;try{const _0x1464d4=_0x44d622['jobType']||_0x264bdd(0x194),_0x242085=_0x44d622[_0x264bdd(0x198)],_0x27f9c2=_0x44d622[_0x264bdd(0x1a7)]||_0x264bdd(0x171);if(_0x1464d4!==_0x264bdd(0x194)&&_0x1464d4!==_0x264bdd(0x199))return console['error']('Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22'),0x1;let _0x554625;if(_0x242085){if(_0x5f419d[0x0])return console['error']('Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option'),0x1;const _0x470fd7=readSqlStatementsFromFile(_0x242085);if(_0x470fd7[_0x264bdd(0x17b)]===0x0)return console[_0x264bdd(0x1a8)](_0x264bdd(0x18f)),0x1;if(_0x470fd7['length']>0x1)return console[_0x264bdd(0x1a8)](_0x264bdd(0x16e)),0x1;_0x554625=_0x470fd7[0x0];}else{if(!_0x5f419d[0x0])return console[_0x264bdd(0x1a8)](_0x264bdd(0x172)),console['error'](_0x264bdd(0x17a)),0x1;_0x554625=_0x5f419d[0x0];}_0x44d622[_0x264bdd(0x1a2)]&&(console[_0x264bdd(0x1a8)](_0x264bdd(0x16b)+_0x1464d4),console[_0x264bdd(0x1a8)](_0x264bdd(0x182)+_0x27f9c2),console[_0x264bdd(0x1a8)]('Query:\x20'+_0x554625[_0x264bdd(0x18d)](0x0,0x64)+(_0x554625[_0x264bdd(0x17b)]>0x64?'...':'')));const _0x52e6aa=await withSpinner(_0x264bdd(0x16a),()=>_0xb1e527[_0x264bdd(0x1a6)]['submit'](_0x27f9c2,_0x554625,_0x1464d4),{'verbose':_0x44d622[_0x264bdd(0x1a2)]}),_0x5bd68e=_0x52e6aa[_0x264bdd(0x173)];return console[_0x264bdd(0x1a8)]('✔\x20Job\x20submitted'),console[_0x264bdd(0x1a8)](_0x264bdd(0x161)+_0x5bd68e[_0x264bdd(0x190)]),await handleSDKOutput([_0x5bd68e],_0x44d622),0x0;}catch(_0x6e3567){if(_0x6e3567 instanceof SDKError)return console['error'](_0x264bdd(0x169)+_0x6e3567[_0x264bdd(0x180)]),_0x6e3567[_0x264bdd(0x188)]&&console[_0x264bdd(0x1a8)](_0x264bdd(0x1ab)+_0x6e3567['cause']),0x1;throw _0x6e3567;}}}export class JobResultCommand extends BaseCommand{['name']='job:result';[a17_0x30ad65(0x1a0)]=a17_0x30ad65(0x184);async['execute'](_0x366092){const _0xb09ccd=a17_0x30ad65,{options:_0x467269,args:_0x5bfa82,tdx:_0x90a496}=_0x366092,_0x3c959b=_0x5bfa82[0x0];if(!_0x3c959b)return console['error']('Error:\x20Job\x20ID\x20is\x20required'),console[_0xb09ccd(0x1a8)]('Usage:\x20job\x20result\x20<job-id>'),0x1;try{const _0x3aaea3=await withSpinner(_0xb09ccd(0x197),()=>_0x90a496['jobs'][_0xb09ccd(0x177)](_0x3c959b),{'verbose':_0x467269[_0xb09ccd(0x1a2)]}),_0x215712=_0x3aaea3[_0xb09ccd(0x173)];return console['error'](_0xb09ccd(0x192)+_0x215712[_0xb09ccd(0x17b)]+'\x20row'+(_0x215712[_0xb09ccd(0x17b)]!==0x1?'s':'')),await handleSDKOutput(_0x215712,_0x467269),0x0;}catch(_0x31a142){if(_0x31a142 instanceof SDKError)return console[_0xb09ccd(0x1a8)](_0xb09ccd(0x169)+_0x31a142['message']),_0x31a142[_0xb09ccd(0x188)]&&console[_0xb09ccd(0x1a8)]('\x20\x20Cause:\x20'+_0x31a142[_0xb09ccd(0x188)]),0x1;throw _0x31a142;}}}
1
+ const a17_0x133e5a=a17_0x197e;(function(_0x50aa78,_0x5e7f3a){const _0x399f42=a17_0x197e,_0x1b7a4c=_0x50aa78();while(!![]){try{const _0x5d4fff=parseInt(_0x399f42(0x1c2))/0x1*(-parseInt(_0x399f42(0x1cb))/0x2)+parseInt(_0x399f42(0x1b0))/0x3+parseInt(_0x399f42(0x1b2))/0x4*(parseInt(_0x399f42(0x1e6))/0x5)+-parseInt(_0x399f42(0x1d9))/0x6*(-parseInt(_0x399f42(0x1ea))/0x7)+parseInt(_0x399f42(0x1de))/0x8*(-parseInt(_0x399f42(0x1ba))/0x9)+parseInt(_0x399f42(0x1b8))/0xa*(parseInt(_0x399f42(0x1f2))/0xb)+parseInt(_0x399f42(0x1f4))/0xc;if(_0x5d4fff===_0x5e7f3a)break;else _0x1b7a4c['push'](_0x1b7a4c['shift']());}catch(_0x430144){_0x1b7a4c['push'](_0x1b7a4c['shift']());}}}(a17_0x3e71,0x5a376));import{BaseCommand}from'./command.js';function a17_0x3e71(){const _0x3189c0=['execute','substring','✔\x20Found\x20','5zBArxh','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','created_at','jobs','7tpWCqq','\x20\x20Cause:\x20','Error:\x20','\x20\x20Job\x20ID:\x20','Query:\x20','submit','Usage:\x20job\x20kill\x20<job-id>','cause','22KlzMmD','start_at','20112GYQsdA','Submitting\x20job...','job:submit','error','✔\x20Retrieved\x20','debug','name','Getting\x20job\x20details...','\x27\x20to\x20verify\x20the\x20job\x20status','file','url','job:result','541911idynQa','getTime','2171096VtDNma','...','Usage:\x20job\x20show\x20<job-id>','priority','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','kill','2382950GixKGz','Listing\x20jobs...','99gvNabu','map','\x20row','verbose','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','status','description','data','30319YJWMAD','job:kill','round','type','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','Error:\x20Query\x20is\x20required','hive','user_name','end_at','40mTbXXy','message','Status\x20filter:\x20','job:show','database','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','Limit:\x20','jobType','show','✔\x20Job\x20submitted','job_id','List\x20jobs','trino','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','168060YifHWw','Submitting\x20kill\x20request...','Cancelled','Show\x20job\x20details','limit','184568IwFKdq','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','length','\x20job','Error:\x20Job\x20ID\x20is\x20required'];a17_0x3e71=function(){return _0x3189c0;};return a17_0x3e71();}import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../sdk/query/sql-parser.js';function a17_0x197e(_0x37ff13,_0x2d8e4f){_0x37ff13=_0x37ff13-0x1ad;const _0x3e7131=a17_0x3e71();let _0x197ef0=_0x3e7131[_0x37ff13];return _0x197ef0;}import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';export class JobListCommand extends BaseCommand{[a17_0x133e5a(0x1fa)]=a17_0x133e5a(0x1e9);[a17_0x133e5a(0x1c0)]=a17_0x133e5a(0x1d6);async[a17_0x133e5a(0x1e3)](_0x2695f1){const _0x584a92=a17_0x133e5a,{options:_0x16b65c,tdx:_0x1612f0}=_0x2695f1;try{const _0x211734=resolveLimit(_0x16b65c[_0x584a92(0x1dd)],DEFAULT_DISPLAY_LIMIT),_0x5297c5=_0x16b65c[_0x584a92(0x1bf)];_0x16b65c[_0x584a92(0x1bd)]&&(console[_0x584a92(0x1f7)](_0x584a92(0x1d1)+_0x211734+'\x20jobs'),_0x5297c5&&console[_0x584a92(0x1f7)](_0x584a92(0x1cd)+_0x5297c5));const _0x21f006=await withSpinner(_0x584a92(0x1b9),()=>_0x1612f0[_0x584a92(0x1e9)]['list']({'from':0x0,'to':_0x211734-0x1,'status':_0x5297c5}),{'verbose':_0x16b65c['verbose']}),_0x502fa8=_0x21f006[_0x584a92(0x1c1)];console[_0x584a92(0x1f7)](_0x584a92(0x1e5)+_0x502fa8[_0x584a92(0x1e0)]+_0x584a92(0x1e1)+(_0x502fa8[_0x584a92(0x1e0)]!==0x1?'s':''));const _0x58f214=_0x502fa8[_0x584a92(0x1bb)](_0xc42456=>{const _0x232950=_0x584a92;let _0x2fb36e;if(_0xc42456[_0x232950(0x1f3)]&&_0xc42456['end_at']){const _0x515ffd=new Date(_0xc42456['start_at'])[_0x232950(0x1b1)](),_0x1a0e90=new Date(_0xc42456['end_at'])[_0x232950(0x1b1)]();_0x2fb36e=Math[_0x232950(0x1c4)]((_0x1a0e90-_0x515ffd)/0x3e8);}return{'job_id':_0xc42456[_0x232950(0x1d5)],'type':_0xc42456[_0x232950(0x1c5)],'status':_0xc42456[_0x232950(0x1bf)],'user_name':_0xc42456[_0x232950(0x1c9)],'duration_sec':_0x2fb36e,'created_at':_0xc42456['created_at'],'started_at':_0xc42456[_0x232950(0x1f3)],'end_at':_0xc42456[_0x232950(0x1ca)]};});return await handleSDKOutput(_0x58f214,_0x16b65c),0x0;}catch(_0x25047b){if(_0x25047b instanceof SDKError)return console[_0x584a92(0x1f7)](_0x584a92(0x1ec)+_0x25047b['message']),_0x25047b[_0x584a92(0x1f1)]&&console[_0x584a92(0x1f7)](_0x584a92(0x1eb)+_0x25047b[_0x584a92(0x1f1)]),0x1;throw _0x25047b;}}}export class JobShowCommand extends BaseCommand{['name']=a17_0x133e5a(0x1ce);['description']=a17_0x133e5a(0x1dc);async[a17_0x133e5a(0x1e3)](_0x3590ad){const _0x54a2c6=a17_0x133e5a,{options:_0x16c3f7,args:_0xceb6d1,tdx:_0x1759e5}=_0x3590ad,_0x47cdd0=_0xceb6d1[0x0];if(!_0x47cdd0)return console[_0x54a2c6(0x1f7)]('Error:\x20Job\x20ID\x20is\x20required'),console[_0x54a2c6(0x1f7)](_0x54a2c6(0x1b4)),0x1;try{const _0x490d0e=await withSpinner(_0x54a2c6(0x1fb),()=>_0x1759e5['jobs'][_0x54a2c6(0x1d3)](_0x47cdd0),{'verbose':_0x16c3f7[_0x54a2c6(0x1bd)]}),_0x589802=_0x490d0e[_0x54a2c6(0x1c1)];let _0x1c96e1;if(_0x589802['start_at']&&_0x589802[_0x54a2c6(0x1ca)]){const _0x47c84a=new Date(_0x589802[_0x54a2c6(0x1f3)])[_0x54a2c6(0x1b1)](),_0x613662=new Date(_0x589802[_0x54a2c6(0x1ca)])[_0x54a2c6(0x1b1)]();_0x1c96e1=Math[_0x54a2c6(0x1c4)]((_0x613662-_0x47c84a)/0x3e8);}const _0x2f3a51={'job_id':_0x589802[_0x54a2c6(0x1d5)],'type':_0x589802[_0x54a2c6(0x1c5)],'status':_0x589802['status'],..._0x589802[_0x54a2c6(0x1c9)]&&{'user_name':_0x589802[_0x54a2c6(0x1c9)]},..._0x1c96e1!==undefined&&{'duration_sec':_0x1c96e1},..._0x589802[_0x54a2c6(0x1e8)]&&{'created_at':_0x589802[_0x54a2c6(0x1e8)]},..._0x589802['start_at']&&{'started_at':_0x589802['start_at']},..._0x589802['end_at']&&{'end_at':_0x589802[_0x54a2c6(0x1ca)]},..._0x589802[_0x54a2c6(0x1cf)]&&{'database':_0x589802[_0x54a2c6(0x1cf)]},..._0x589802[_0x54a2c6(0x1b5)]!==undefined&&{'priority':_0x589802[_0x54a2c6(0x1b5)]},..._0x589802[_0x54a2c6(0x1ae)]&&{'url':_0x589802['url']},..._0x589802['query']&&{'query':_0x589802['query']},..._0x589802['debug']&&{'debug':_0x589802[_0x54a2c6(0x1f9)]}};return await handleSingleObjectOutput(_0x2f3a51,_0x16c3f7),0x0;}catch(_0x1fe7f9){if(_0x1fe7f9 instanceof SDKError)return console[_0x54a2c6(0x1f7)](_0x54a2c6(0x1ec)+_0x1fe7f9[_0x54a2c6(0x1cc)]),_0x1fe7f9['cause']&&console['error'](_0x54a2c6(0x1eb)+_0x1fe7f9[_0x54a2c6(0x1f1)]),0x1;throw _0x1fe7f9;}}}export class JobKillCommand extends BaseCommand{[a17_0x133e5a(0x1fa)]=a17_0x133e5a(0x1c3);['description']='Kill\x20a\x20job';async['execute'](_0x55c084){const _0x46ea85=a17_0x133e5a,{options:_0x1a7d70,args:_0x4bfe31,tdx:_0x323440}=_0x55c084,_0x4d76bc=_0x4bfe31[0x0];if(!_0x4d76bc)return console[_0x46ea85(0x1f7)](_0x46ea85(0x1e2)),console['error'](_0x46ea85(0x1f0)),0x1;try{if(!_0x1a7d70['yes']){const _0x55139a=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20'+_0x4d76bc+'?');if(!_0x55139a)return console['error'](_0x46ea85(0x1db)),0x0;}return await withSpinner(_0x46ea85(0x1da),()=>_0x323440[_0x46ea85(0x1e9)][_0x46ea85(0x1b7)](_0x4d76bc),{'verbose':_0x1a7d70[_0x46ea85(0x1bd)]}),console[_0x46ea85(0x1f7)](_0x46ea85(0x1df)+_0x4d76bc),console['error'](_0x46ea85(0x1e7)+_0x4d76bc+_0x46ea85(0x1fc)),0x0;}catch(_0x29f8a0){if(_0x29f8a0 instanceof SDKError)return console[_0x46ea85(0x1f7)]('Error:\x20'+_0x29f8a0['message']),_0x29f8a0[_0x46ea85(0x1f1)]&&console['error'](_0x46ea85(0x1eb)+_0x29f8a0[_0x46ea85(0x1f1)]),0x1;throw _0x29f8a0;}}}export class JobSubmitCommand extends BaseCommand{[a17_0x133e5a(0x1fa)]=a17_0x133e5a(0x1f6);[a17_0x133e5a(0x1c0)]='Submit\x20a\x20job';async['execute'](_0x5afbe0){const _0x14a226=a17_0x133e5a,{options:_0x2bf97,args:_0x229e88,tdx:_0x1f8218}=_0x5afbe0;try{const _0x1464ec=_0x2bf97[_0x14a226(0x1d2)]||'trino',_0x339090=_0x2bf97[_0x14a226(0x1ad)],_0x276a3a=_0x2bf97['database']||'information_schema';if(_0x1464ec!==_0x14a226(0x1d7)&&_0x1464ec!==_0x14a226(0x1c8))return console[_0x14a226(0x1f7)](_0x14a226(0x1d8)),0x1;let _0x449908;if(_0x339090){if(_0x229e88[0x0])return console[_0x14a226(0x1f7)](_0x14a226(0x1c6)),0x1;const _0x51a66f=readSqlStatementsFromFile(_0x339090);if(_0x51a66f[_0x14a226(0x1e0)]===0x0)return console[_0x14a226(0x1f7)](_0x14a226(0x1b6)),0x1;if(_0x51a66f[_0x14a226(0x1e0)]>0x1)return console[_0x14a226(0x1f7)](_0x14a226(0x1d0)),0x1;_0x449908=_0x51a66f[0x0];}else{if(!_0x229e88[0x0])return console[_0x14a226(0x1f7)](_0x14a226(0x1c7)),console[_0x14a226(0x1f7)](_0x14a226(0x1be)),0x1;_0x449908=_0x229e88[0x0];}_0x2bf97['verbose']&&(console[_0x14a226(0x1f7)]('Job\x20type:\x20'+_0x1464ec),console[_0x14a226(0x1f7)]('Database:\x20'+_0x276a3a),console[_0x14a226(0x1f7)](_0x14a226(0x1ee)+_0x449908[_0x14a226(0x1e4)](0x0,0x64)+(_0x449908[_0x14a226(0x1e0)]>0x64?_0x14a226(0x1b3):'')));const _0x1dfc87=await withSpinner(_0x14a226(0x1f5),()=>_0x1f8218[_0x14a226(0x1e9)][_0x14a226(0x1ef)](_0x276a3a,_0x449908,_0x1464ec),{'verbose':_0x2bf97[_0x14a226(0x1bd)]}),_0x490cbd=_0x1dfc87[_0x14a226(0x1c1)];return console[_0x14a226(0x1f7)](_0x14a226(0x1d4)),console['error'](_0x14a226(0x1ed)+_0x490cbd[_0x14a226(0x1d5)]),await handleSDKOutput([_0x490cbd],_0x2bf97),0x0;}catch(_0x5d978a){if(_0x5d978a instanceof SDKError)return console[_0x14a226(0x1f7)](_0x14a226(0x1ec)+_0x5d978a['message']),_0x5d978a[_0x14a226(0x1f1)]&&console[_0x14a226(0x1f7)](_0x14a226(0x1eb)+_0x5d978a[_0x14a226(0x1f1)]),0x1;throw _0x5d978a;}}}export class JobResultCommand extends BaseCommand{[a17_0x133e5a(0x1fa)]=a17_0x133e5a(0x1af);[a17_0x133e5a(0x1c0)]='Get\x20job\x20results';async['execute'](_0x1d62c6){const _0x1cc4d5=a17_0x133e5a,{options:_0xaa6ca3,args:_0x179b3b,tdx:_0x2fe4ee}=_0x1d62c6,_0x5222fc=_0x179b3b[0x0];if(!_0x5222fc)return console['error'](_0x1cc4d5(0x1e2)),console[_0x1cc4d5(0x1f7)]('Usage:\x20job\x20result\x20<job-id>'),0x1;try{const _0x28580b=await withSpinner('Getting\x20job\x20results...',()=>_0x2fe4ee['jobs']['result'](_0x5222fc),{'verbose':_0xaa6ca3[_0x1cc4d5(0x1bd)]}),_0x516dd4=_0x28580b['data'];return console[_0x1cc4d5(0x1f7)](_0x1cc4d5(0x1f8)+_0x516dd4['length']+_0x1cc4d5(0x1bc)+(_0x516dd4[_0x1cc4d5(0x1e0)]!==0x1?'s':'')),await handleSDKOutput(_0x516dd4,_0xaa6ca3),0x0;}catch(_0x214075){if(_0x214075 instanceof SDKError)return console[_0x1cc4d5(0x1f7)](_0x1cc4d5(0x1ec)+_0x214075[_0x1cc4d5(0x1cc)]),_0x214075[_0x1cc4d5(0x1f1)]&&console['error'](_0x1cc4d5(0x1eb)+_0x214075['cause']),0x1;throw _0x214075;}}}
@@ -1 +1 @@
1
- const a18_0x52fc43=a18_0x3558;(function(_0x598a92,_0xdfee9f){const _0x5768f2=a18_0x3558,_0x23c343=_0x598a92();while(!![]){try{const _0x33e701=parseInt(_0x5768f2(0x126))/0x1*(parseInt(_0x5768f2(0x186))/0x2)+-parseInt(_0x5768f2(0x160))/0x3+-parseInt(_0x5768f2(0x1a5))/0x4+parseInt(_0x5768f2(0x1b2))/0x5*(parseInt(_0x5768f2(0x1be))/0x6)+parseInt(_0x5768f2(0x1f0))/0x7*(-parseInt(_0x5768f2(0x1ec))/0x8)+parseInt(_0x5768f2(0x121))/0x9*(parseInt(_0x5768f2(0x19b))/0xa)+parseInt(_0x5768f2(0x130))/0xb*(parseInt(_0x5768f2(0x183))/0xc);if(_0x33e701===_0xdfee9f)break;else _0x23c343['push'](_0x23c343['shift']());}catch(_0x19065e){_0x23c343['push'](_0x23c343['shift']());}}}(a18_0x55e3,0xac2d3));function a18_0x55e3(){const _0x42f86d=['listJourneysFromParentSegment','find','2486kjYTkY','parentSegment','/app/ps/','segment','totalGoalAchieved','stageName','Parent\x20segment:\x20','journeyStages','\x20(ID:\x20','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','sort','activation_','...','log','targetDir','error','content','resolveParentId','Write\x20','population','Resolving\x20journey...','json','blue','session','\x20journey\x20files\x20to\x20','length','Warning:\x20Could\x20not\x20resolve\x20segment\x20','hasChanges','root\x20folder','getActivation','Error:\x20Journey\x20not\x20found:\x20','state','\x20changed\x20files','split','red','journey:view','size','segmentName','absolutePath','entered','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','\x22\x20not\x20found','connector_config','\x22\x20resumed','conversionRate','journey:pull','\x20\x20Target:\x20','\x20\x20Parent\x20segment:\x20','3742074cElCpJ','🗺️\x20','toLowerCase','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','yellow','diff','getJourney','Fetching\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','✔\x20Pulled\x20','Resolving\x20parent\x20segment...','Usage:\x20journey\x20pause\x20<name-or-path>','set','\x20unchanged\x20files','folderPath','test','(running)','yes','push','Listing\x20journeys...','\x0aPull\x20summary:','name','audienceId','Usage:\x20journey\x20stats\x20<name-or-path>','reentryMode','segmentPushCommand','resume','filter','verbose','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','then','message','pause','Export\x20journey(s)\x20as\x20YAML\x20files','attributes','36948BKAtYm','completed','includeStats','2534986yUFOFx','description','relativePath','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','(archived)','Show\x20journey\x20statistics','has','Listing\x20folders...','Warning:\x20Stage\x20\x22','type','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','stages','\x20\x20Preserving\x20local\x20segment\x20name:\x20','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','\x20journey','setPhase','journey:resume','stage','buildIdToEmailMap','format','isNew','90LMzCMX','execute','stringify','green','versionNumber','\x20versions)','✔\x20Found\x20','/j/da/je','draft','filePath','2520176AEJdPS','Pattern:\x20','Options:','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','kind','helpText','\x20\x20Statistics\x20not\x20available','cwd','\x20files?','Usage:\x20journey\x20resume\x20<name-or-path>','\x27\x20not\x20found\x20in\x20','Fetching\x20connections\x20for\x20name\x20resolution...','getSegment','12895CAWmjP','Error:\x20','Resuming\x20journey...','\x20\x20Folder\x20path:\x20','folderId','(paused)','Aborted.','\x0aChanges\x20to\x20\x27','Cancelled','Warning:\x20Could\x20not\x20resolve\x20activation\x20','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','resolveJourneyId','462epTxZP','entries','goal','(completed)','segments','/e/','\x20\x20-\x20','Target\x20file:\x20','✔\x20Journey\x20\x22','values','journey','journeys','get','✔\x20Context\x20set:\x20','localeCompare','Fetching\x20parent\x20segment...','\x20=\x20','base','List\x20journeys\x20in\x20current\x20context','join','journeyName','getStatistics','errorCode','\x20(rule\x20match)','journeyId','No\x20statistics\x20available\x20for\x20journey:\x20','relative','Input:\x20','rule','\x20->\x20','listJourneysWithFolders','parentName','Show\x20journey\x20details','Getting\x20journey\x20details...','parent_segment','goalRate','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','exited','repeat','map','Target\x20directory:\x20','buildIdToNameMap','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','\x22\x20paused','utf-8','resourceName','8ZgAFkV','.yml','all','data','2601634qUcEDO','Journey\x20name:\x20','cyan','Resume\x20a\x20paused\x20journey','file','add','args','Pause\x20a\x20running\x20journey','journey:stats','INVALID_ARGUMENT','paused','792369bKnuRF','dryRun','connection','site','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','1tJytVI','journeyBundleName','listFolders','options','dim','user','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','folders'];a18_0x55e3=function(){return _0x42f86d;};return a18_0x55e3();}import a18_0x4d810b from'chalk';import a18_0x513e0b from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey}from'../utils/prompt.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{journeyResponseToDef,toYamlString,parseYamlString,normalizeJourneyDef}from'../sdk/segment/journey-yaml.js';import{segmentResponseToDef,journeyActivationStepToYaml,serializeRule}from'../sdk/segment/child-segment-yaml.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';import{SegmentPushCommand}from'./segment-push-command.js';import{buildFolderIdToPathMap}from'../sdk/segment/resolution-context.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,createJumpTargetCache,resolveJumpTarget}from'../sdk/segment/journey-utils.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import{hyperlink}from'../sdk/util/formatters.js';function formatJourneyState(_0x5a3a70){const _0x552a67=a18_0x3558;switch(_0x5a3a70){case'launched':return a18_0x4d810b[_0x552a67(0x19e)](_0x552a67(0x170));case _0x552a67(0x1a3):return a18_0x4d810b['dim']('(draft)');case _0x552a67(0x120):return a18_0x4d810b[_0x552a67(0x164)](_0x552a67(0x1b7));case _0x552a67(0x184):return a18_0x4d810b[_0x552a67(0x146)](_0x552a67(0x1c1));case'archived':return a18_0x4d810b['dim'](_0x552a67(0x18a));default:return'('+_0x5a3a70+')';}}function formatJourneyItem(_0x203ae9,_0xdc0e29='',_0x188ccc){const _0x2000f4=a18_0x3558,_0x24992b=formatJourneyState(_0x203ae9[_0x2000f4(0x14f)]),_0x4a742a=_0x188ccc?hyperlink(_0x203ae9[_0x2000f4(0x127)],_0x188ccc):_0x203ae9[_0x2000f4(0x127)];return _0xdc0e29+_0x2000f4(0x161)+_0x4a742a+'\x20'+_0x24992b;}function escapeRegex(_0x39a231){return _0x39a231['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&');}function globToRegex(_0x306bb8){const _0x6bfc20=a18_0x3558,_0x31d380=_0x306bb8[_0x6bfc20(0x151)]('*')['map'](escapeRegex);return new RegExp(_0x31d380[_0x6bfc20(0x1d1)]('.*'),'i');}function buildRuleToNameMapping(_0x5d3d43){const _0xfa3624=a18_0x3558,_0x3ba33a=new Map();if(_0x5d3d43[_0xfa3624(0x1c2)])for(const [_0xe31753,_0x49787f]of Object[_0xfa3624(0x1bf)](_0x5d3d43[_0xfa3624(0x1c2)])){if(_0x49787f[_0xfa3624(0x1da)]){const _0x3c1714=serializeRule(_0x49787f[_0xfa3624(0x1da)]),_0x3d0970=_0x3ba33a['get'](_0x3c1714);_0x3d0970?_0x3d0970[_0xfa3624(0x172)](_0xe31753):_0x3ba33a['set'](_0x3c1714,[_0xe31753]);}}return _0x3ba33a;}async function resolveJourneyTarget(_0x1d8d7c,_0x1b9a21,_0x2012ce){const _0x31ac4e=a18_0x3558;if(isYamlFilePath(_0x1d8d7c))try{const _0x296cc7=await resolveYamlFilePath(_0x1d8d7c);return _0x2012ce&&(console['error']('Resolved\x20YAML\x20file:\x20'+_0x1d8d7c),console[_0x31ac4e(0x13f)](_0x31ac4e(0x15f)+_0x296cc7[_0x31ac4e(0x131)]),console[_0x31ac4e(0x13f)]('\x20\x20Name:\x20'+_0x296cc7[_0x31ac4e(0x155)]),console['error'](_0x31ac4e(0x1b5)+(_0x296cc7[_0x31ac4e(0x16e)]||'(root)'))),{'journeyName':_0x296cc7[_0x31ac4e(0x155)],'parentSegment':_0x296cc7[_0x31ac4e(0x131)],'resolved':_0x296cc7};}catch(_0x4385a5){throw new SDKError(ErrorCode[_0x31ac4e(0x11f)],_0x31ac4e(0x125)+_0x4385a5[_0x31ac4e(0x17f)]);}if(!_0x1b9a21)throw new SDKError(ErrorCode[_0x31ac4e(0x11f)],_0x31ac4e(0x1e8));return{'journeyName':_0x1d8d7c,'parentSegment':_0x1b9a21};}export class JourneyListCommand extends BaseCommand{[a18_0x52fc43(0x175)]='journey:list';['description']=a18_0x52fc43(0x1d0);async['execute'](_0x2d9d2c){const _0x48c2a0=a18_0x52fc43,{options:_0x13fae7,args:_0x11c498,tdx:_0x130c10}=_0x2d9d2c,_0x15f9a7=_0x11c498[0x0],_0x38e0db=_0x13fae7[_0x48c2a0(0x131)];if(!_0x38e0db)return console['error']('Error:\x20Parent\x20segment\x20context\x20required'),console[_0x48c2a0(0x13f)](_0x48c2a0(0x193)),0x1;const _0x2e80b9=await withSpinner(_0x48c2a0(0x16a),()=>_0x130c10[_0x48c2a0(0x133)]['resolveParentId'](_0x38e0db),{'verbose':_0x13fae7[_0x48c2a0(0x17c)]}),_0x4925a7=_0x2e80b9['data'];_0x13fae7['verbose']&&(console[_0x48c2a0(0x13f)](_0x48c2a0(0x136)+_0x38e0db+_0x48c2a0(0x138)+_0x4925a7+')'),_0x15f9a7&&console['error'](_0x48c2a0(0x1a6)+_0x15f9a7));const _0xdfb3d4=await withSpinner(_0x48c2a0(0x1cd),()=>_0x130c10['segment']['getParentFull'](_0x4925a7),{'verbose':_0x13fae7[_0x48c2a0(0x17c)]}),_0x160742=_0xdfb3d4['data'],_0x47c991=_0x160742['rootFolderId'],_0x59db27=await withSpinner(_0x48c2a0(0x173),()=>_0x130c10[_0x48c2a0(0x1c8)][_0x48c2a0(0x1dc)](_0x4925a7,_0x47c991),{'verbose':_0x13fae7[_0x48c2a0(0x17c)]});let _0x4656da=_0x59db27[_0x48c2a0(0x1ef)][_0x48c2a0(0x1c9)];const _0x371122=_0x59db27[_0x48c2a0(0x1ef)][_0x48c2a0(0x12d)],_0x40572f=new Map();for(const _0x118461 of _0x371122){_0x40572f[_0x48c2a0(0x16c)](_0x118461['id'],_0x118461[_0x48c2a0(0x175)]);}if(_0x15f9a7){const _0x9ba087=globToRegex(_0x15f9a7);_0x4656da=_0x4656da[_0x48c2a0(0x17b)](_0x5950f4=>_0x9ba087[_0x48c2a0(0x16f)](_0x5950f4[_0x48c2a0(0x127)]));}console[_0x48c2a0(0x13f)](_0x48c2a0(0x1a1)+_0x4656da['length']+_0x48c2a0(0x194)+(_0x4656da['length']!==0x1?'s':''));const _0x25b051=_0x2baf08=>{const _0x5aef2c=_0x48c2a0;return getConsoleNextUrl(_0x13fae7['site'],_0x5aef2c(0x132)+_0x4925a7+_0x5aef2c(0x1c3)+_0x2baf08+'/j/da');};if(_0x13fae7[_0x48c2a0(0x199)]==='table')await handleSDKOutput(_0x4656da,_0x13fae7);else{if(_0x13fae7[_0x48c2a0(0x199)]===_0x48c2a0(0x145)){const _0x30ced0=_0x4656da['map'](_0x203450=>({..._0x203450,'url':_0x25b051(_0x203450['id'])}));await handleSDKOutput(_0x30ced0,_0x13fae7);}else{console[_0x48c2a0(0x13d)]('['+_0x38e0db+']');const _0x3d67ef=new Map(),_0x4f7a1a=[];for(const _0x308dcf of _0x4656da){if(!_0x308dcf[_0x48c2a0(0x1b6)]||_0x308dcf[_0x48c2a0(0x1b6)]===_0x47c991)_0x4f7a1a['push'](_0x308dcf);else{const _0x366f1f=_0x3d67ef[_0x48c2a0(0x1ca)](_0x308dcf[_0x48c2a0(0x1b6)])||[];_0x366f1f[_0x48c2a0(0x172)](_0x308dcf),_0x3d67ef[_0x48c2a0(0x16c)](_0x308dcf[_0x48c2a0(0x1b6)],_0x366f1f);}}const _0x5d684f=(_0x292a27,_0x2f3740)=>_0x292a27[_0x48c2a0(0x127)]['localeCompare'](_0x2f3740[_0x48c2a0(0x127)],undefined,{'sensitivity':_0x48c2a0(0x1cf)});_0x4f7a1a[_0x48c2a0(0x13a)](_0x5d684f);for(const _0x197d2d of _0x4f7a1a){console['log'](formatJourneyItem(_0x197d2d,'',_0x25b051(_0x197d2d['id'])));}const _0x1aea84=[..._0x3d67ef[_0x48c2a0(0x1bf)]()][_0x48c2a0(0x13a)]((_0x2d76a4,_0x16f11a)=>{const _0x34e62c=_0x48c2a0,_0x444cf9=_0x40572f[_0x34e62c(0x1ca)](_0x2d76a4[0x0])||_0x2d76a4[0x0],_0x247a46=_0x40572f['get'](_0x16f11a[0x0])||_0x16f11a[0x0];return _0x444cf9[_0x34e62c(0x1cc)](_0x247a46,undefined,{'sensitivity':'base'});});for(const [_0x167783,_0x5a4e35]of _0x1aea84){const _0xb8b3c2=_0x40572f[_0x48c2a0(0x1ca)](_0x167783)||_0x167783;console[_0x48c2a0(0x13d)]('📁\x20'+_0xb8b3c2),_0x5a4e35[_0x48c2a0(0x13a)](_0x5d684f);for(const _0x84a961 of _0x5a4e35){console[_0x48c2a0(0x13d)](formatJourneyItem(_0x84a961,'\x20\x20',_0x25b051(_0x84a961['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a18_0x52fc43(0x175)]=a18_0x52fc43(0x153);[a18_0x52fc43(0x187)]=a18_0x52fc43(0x1de);async[a18_0x52fc43(0x19c)](_0x909ae){const _0x12ab82=a18_0x52fc43,{options:_0x1d0e1f,args:_0x466fc3,tdx:_0x4e7993}=_0x909ae,_0x1c2f36=_0x466fc3[0x0];if(!_0x1c2f36)return console[_0x12ab82(0x13f)](_0x12ab82(0x163)),console['error']('Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]'),console[_0x12ab82(0x13f)](_0x12ab82(0x1a7)),console[_0x12ab82(0x13f)](_0x12ab82(0x1bc)),0x1;_0x1d0e1f['verbose']&&console['error'](_0x12ab82(0x1d9)+_0x1c2f36);const _0x37c2f2=await resolveJourneyTarget(_0x1c2f36,_0x1d0e1f[_0x12ab82(0x131)],_0x1d0e1f[_0x12ab82(0x17c)]),_0x3e0e69=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x4e7993[_0x12ab82(0x133)][_0x12ab82(0x141)](_0x37c2f2[_0x12ab82(0x131)]),{'verbose':_0x1d0e1f[_0x12ab82(0x17c)]}),_0x5ca62a=_0x3e0e69[_0x12ab82(0x1ef)],_0x468a9c=await withSpinner(_0x12ab82(0x144),()=>_0x4e7993[_0x12ab82(0x1c8)]['resolveJourneyId'](_0x5ca62a,_0x37c2f2[_0x12ab82(0x1d2)]),{'verbose':_0x1d0e1f[_0x12ab82(0x17c)]}),_0x539e3e=_0x468a9c[_0x12ab82(0x1ef)];if(_0x1d0e1f['web']){const _0x3e7a56=getConsoleNextUrl(_0x1d0e1f[_0x12ab82(0x124)],_0x12ab82(0x132)+_0x5ca62a+_0x12ab82(0x1c3)+_0x539e3e+'/j/da/je');return console[_0x12ab82(0x13f)](a18_0x4d810b[_0x12ab82(0x19e)]('✔')+'\x20Opening\x20'+a18_0x4d810b[_0x12ab82(0x118)](_0x3e7a56)),openBrowser(_0x3e7a56),0x0;}const _0x4b02bb=await withSpinner(_0x12ab82(0x1df),()=>_0x4e7993[_0x12ab82(0x1c8)][_0x12ab82(0x166)](_0x539e3e),{'verbose':_0x1d0e1f[_0x12ab82(0x17c)]}),_0x3c454d=_0x4b02bb[_0x12ab82(0x1ef)],_0x566a86=_0x1d0e1f[_0x12ab82(0x185)];let _0x19e767;if(_0x566a86)try{const _0x4752d9=await withSpinner('Getting\x20journey\x20statistics...',()=>_0x4e7993[_0x12ab82(0x1c8)]['getStatistics'](_0x539e3e),{'verbose':_0x1d0e1f[_0x12ab82(0x17c)]});_0x19e767=_0x4752d9['data'];}catch{_0x1d0e1f['verbose']&&console[_0x12ab82(0x13f)](_0x12ab82(0x1ab));}const _0x201027=getConsoleNextUrl(_0x1d0e1f[_0x12ab82(0x124)],_0x12ab82(0x132)+_0x5ca62a+_0x12ab82(0x1c3)+_0x539e3e+_0x12ab82(0x1a2)),_0x43fb79={'id':_0x3c454d['id'],'name':_0x3c454d['attributes']['name'],'description':_0x3c454d['attributes'][_0x12ab82(0x187)],'state':_0x3c454d[_0x12ab82(0x182)][_0x12ab82(0x14f)],'paused':_0x3c454d[_0x12ab82(0x182)][_0x12ab82(0x120)],'reentry_mode':_0x3c454d[_0x12ab82(0x182)][_0x12ab82(0x178)],'stages':_0x3c454d[_0x12ab82(0x182)][_0x12ab82(0x137)]?.[_0x12ab82(0x149)]||0x0,..._0x3c454d['attributes'][_0x12ab82(0x1c0)]&&{'goal':_0x3c454d[_0x12ab82(0x182)]['goal'][_0x12ab82(0x175)]},..._0x19e767&&{'statistics':{'total_entered':_0x19e767['totalEntered'],'goal_achieved':_0x19e767[_0x12ab82(0x134)],'goal_rate':_0x19e767[_0x12ab82(0x1e1)],'stages':_0x19e767[_0x12ab82(0x191)]}},'url':_0x201027};return await handleSingleObjectOutput(_0x43fb79,_0x1d0e1f),0x0;}}function a18_0x3558(_0x149b1c,_0x46f3d9){_0x149b1c=_0x149b1c-0x117;const _0x55e3dd=a18_0x55e3();let _0x3558b8=_0x55e3dd[_0x149b1c];return _0x3558b8;}export class JourneyStatsCommand extends BaseCommand{['name']=a18_0x52fc43(0x11e);[a18_0x52fc43(0x187)]=a18_0x52fc43(0x18b);async[a18_0x52fc43(0x19c)](_0x2e1467){const _0x11e700=a18_0x52fc43,{options:_0x2ea142,args:_0x1ce7d8,tdx:_0x52e335}=_0x2e1467,_0x14a9b0=_0x1ce7d8[0x0];if(!_0x14a9b0)return console[_0x11e700(0x13f)](_0x11e700(0x163)),console[_0x11e700(0x13f)](_0x11e700(0x177)),0x1;_0x2ea142['verbose']&&console[_0x11e700(0x13f)](_0x11e700(0x1d9)+_0x14a9b0);const _0x456a5d=await resolveJourneyTarget(_0x14a9b0,_0x2ea142[_0x11e700(0x131)],_0x2ea142[_0x11e700(0x17c)]),_0x2c27d1=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x52e335[_0x11e700(0x133)][_0x11e700(0x141)](_0x456a5d[_0x11e700(0x131)]),{'verbose':_0x2ea142[_0x11e700(0x17c)]}),_0x362fef=_0x2c27d1[_0x11e700(0x1ef)],_0x2c65a7=await withSpinner(_0x11e700(0x144),()=>_0x52e335[_0x11e700(0x1c8)]['resolveJourneyId'](_0x362fef,_0x456a5d['journeyName']),{'verbose':_0x2ea142['verbose']}),_0x1eaa81=_0x2c65a7[_0x11e700(0x1ef)],_0x2a4e1c=await withSpinner('Getting\x20journey\x20statistics...',()=>_0x52e335[_0x11e700(0x1c8)][_0x11e700(0x1d3)](_0x1eaa81),{'verbose':_0x2ea142[_0x11e700(0x17c)]}),_0x59598d=_0x2a4e1c[_0x11e700(0x1ef)];if(!_0x59598d||_0x59598d[_0x11e700(0x1d6)]===null)return console[_0x11e700(0x13f)](_0x11e700(0x1d7)+_0x456a5d['journeyName']),console[_0x11e700(0x13f)](_0x11e700(0x158)),0x0;const _0x2aba85={'journey_id':_0x59598d[_0x11e700(0x1d6)],'total_entered':_0x59598d['totalEntered'],'goal_achieved':_0x59598d[_0x11e700(0x134)],'goal_rate':_0x59598d[_0x11e700(0x1e1)],'stages':_0x59598d['stages']?.[_0x11e700(0x1e5)](_0x30eaae=>({'name':_0x30eaae[_0x11e700(0x135)],'population':_0x30eaae[_0x11e700(0x143)],'entered':_0x30eaae[_0x11e700(0x157)],'exited':_0x30eaae[_0x11e700(0x1e3)],'conversion_rate':_0x30eaae['conversionRate']}))},_0x4a4961=_0x2ea142[_0x11e700(0x197)];if(_0x4a4961&&_0x59598d[_0x11e700(0x191)]){const _0x2ba178=_0x59598d[_0x11e700(0x191)][_0x11e700(0x12f)](_0x489089=>_0x489089[_0x11e700(0x135)][_0x11e700(0x162)]()===_0x4a4961[_0x11e700(0x162)]());if(_0x2ba178)return await handleSingleObjectOutput({'stage_name':_0x2ba178[_0x11e700(0x135)],'population':_0x2ba178['population'],'entered':_0x2ba178[_0x11e700(0x157)],'exited':_0x2ba178[_0x11e700(0x1e3)],'conversion_rate':_0x2ba178[_0x11e700(0x15c)]},_0x2ea142),0x0;console[_0x11e700(0x13f)](_0x11e700(0x18e)+_0x4a4961+_0x11e700(0x159));}return await handleSingleObjectOutput(_0x2aba85,_0x2ea142),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a18_0x52fc43(0x175)]='journey:pause';[a18_0x52fc43(0x187)]=a18_0x52fc43(0x11d);async[a18_0x52fc43(0x19c)](_0x520e2d){const _0x33251b=a18_0x52fc43,{options:_0x7d549c,args:_0x411499,tdx:_0x79e1da}=_0x520e2d,_0x2924d9=_0x411499[0x0];if(!_0x2924d9)return console['error']('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console['error'](_0x33251b(0x16b)),0x1;_0x7d549c[_0x33251b(0x17c)]&&console[_0x33251b(0x13f)](_0x33251b(0x1d9)+_0x2924d9);const _0x3559ef=await resolveJourneyTarget(_0x2924d9,_0x7d549c[_0x33251b(0x131)],_0x7d549c['verbose']),_0x46a44a=await withSpinner(_0x33251b(0x16a),()=>_0x79e1da[_0x33251b(0x133)][_0x33251b(0x141)](_0x3559ef[_0x33251b(0x131)]),{'verbose':_0x7d549c[_0x33251b(0x17c)]}),_0x3a4728=_0x46a44a[_0x33251b(0x1ef)],_0x6cd80c=await withSpinner(_0x33251b(0x144),()=>_0x79e1da[_0x33251b(0x1c8)]['resolveJourneyId'](_0x3a4728,_0x3559ef[_0x33251b(0x1d2)]),{'verbose':_0x7d549c['verbose']}),_0x15d61f=_0x6cd80c['data'];if(!_0x7d549c[_0x33251b(0x171)]){const _0x9e6523=await confirm(_0x33251b(0x168)+_0x3559ef[_0x33251b(0x1d2)]+'\x22?');if(!_0x9e6523)return console['error'](_0x33251b(0x1ba)),0x0;}const _0x261866=await withSpinner('Pausing\x20journey...',()=>_0x79e1da['journey'][_0x33251b(0x180)](_0x15d61f),{'verbose':_0x7d549c['verbose']}),_0x111ac2=_0x261866[_0x33251b(0x1ef)];return console[_0x33251b(0x13f)](_0x33251b(0x1c6)+_0x111ac2[_0x33251b(0x182)][_0x33251b(0x175)]+_0x33251b(0x1e9)),0x0;}}export class JourneyResumeCommand extends BaseCommand{['name']=a18_0x52fc43(0x196);['description']=a18_0x52fc43(0x119);async['execute'](_0x52fa3b){const _0xcd2127=a18_0x52fc43,{options:_0x1f1ebb,args:_0x51def2,tdx:_0x276b8b}=_0x52fa3b,_0x3c9441=_0x51def2[0x0];if(!_0x3c9441)return console['error'](_0xcd2127(0x163)),console['error'](_0xcd2127(0x1ae)),0x1;_0x1f1ebb[_0xcd2127(0x17c)]&&console[_0xcd2127(0x13f)]('Input:\x20'+_0x3c9441);const _0xafe756=await resolveJourneyTarget(_0x3c9441,_0x1f1ebb['parentSegment'],_0x1f1ebb[_0xcd2127(0x17c)]),_0x2b818e=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x276b8b[_0xcd2127(0x133)]['resolveParentId'](_0xafe756[_0xcd2127(0x131)]),{'verbose':_0x1f1ebb[_0xcd2127(0x17c)]}),_0x35ff56=_0x2b818e['data'],_0x1b90e2=await withSpinner(_0xcd2127(0x144),()=>_0x276b8b[_0xcd2127(0x1c8)][_0xcd2127(0x1bd)](_0x35ff56,_0xafe756['journeyName']),{'verbose':_0x1f1ebb[_0xcd2127(0x17c)]}),_0x300f2e=_0x1b90e2[_0xcd2127(0x1ef)];if(!_0x1f1ebb[_0xcd2127(0x171)]){const _0x3d5bce=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22'+_0xafe756[_0xcd2127(0x1d2)]+'\x22?');if(!_0x3d5bce)return console['error'](_0xcd2127(0x1ba)),0x0;}const _0x51b42f=await withSpinner(_0xcd2127(0x1b4),()=>_0x276b8b[_0xcd2127(0x1c8)][_0xcd2127(0x17a)](_0x300f2e),{'verbose':_0x1f1ebb[_0xcd2127(0x17c)]}),_0x2f7009=_0x51b42f[_0xcd2127(0x1ef)];return console[_0xcd2127(0x13f)](_0xcd2127(0x1c6)+_0x2f7009['attributes'][_0xcd2127(0x175)]+_0xcd2127(0x15b)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a18_0x52fc43(0x175)]=a18_0x52fc43(0x15d);[a18_0x52fc43(0x187)]=a18_0x52fc43(0x181);async[a18_0x52fc43(0x19c)](_0x4db9f7){const _0x57f223=a18_0x52fc43,{options:_0x5cfbea,args:_0x3a3659,tdx:_0x58c854}=_0x4db9f7,_0x3882f4=_0x5cfbea,_0xec9d16=_0x3a3659[0x0],_0x5bb767=_0xec9d16&&isYamlFilePath(_0xec9d16),_0x24c224=await resolveTarget({'arg':_0x5bb767?_0xec9d16:undefined,'contextParent':_0x5cfbea[_0x57f223(0x131)],'cwd':process[_0x57f223(0x1ac)]()});if(!isSuccessfulResolution(_0x24c224))return _0x24c224[_0x57f223(0x1d4)]==='no_parent'?(console[_0x57f223(0x13f)](a18_0x4d810b['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x57f223(0x13f)]('Usage:\x20tdx\x20journey\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Inside\x20a\x20segment\x20folder\x20(with\x20tdx.json)'),console[_0x57f223(0x13f)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment'),console[_0x57f223(0x13f)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file'),console[_0x57f223(0x13f)](_0x57f223(0x1a8))):(console['error'](a18_0x4d810b[_0x57f223(0x152)](_0x57f223(0x1b3)+_0x24c224[_0x57f223(0x17f)]+'\x0a')),_0x24c224[_0x57f223(0x1aa)]&&console[_0x57f223(0x13f)](a18_0x4d810b[_0x57f223(0x118)](_0x24c224[_0x57f223(0x1aa)]))),0x1;let _0x594f5b=_0x5bb767?undefined:_0xec9d16,_0x455a43,_0xeeec2a;_0x24c224[_0x57f223(0x18f)]===_0x57f223(0x11a)&&(_0x594f5b=_0x24c224[_0x57f223(0x1eb)],_0x455a43=_0x24c224[_0x57f223(0x1a4)],_0xeeec2a=_0x24c224[_0x57f223(0x16e)]);const _0xb6a685=_0x24c224[_0x57f223(0x1dd)],_0x46276a=_0x24c224[_0x57f223(0x13e)];_0x3882f4[_0x57f223(0x17c)]&&(console[_0x57f223(0x13f)](_0x57f223(0x136)+_0xb6a685),console['error'](_0x57f223(0x1e6)+_0x46276a),_0x594f5b&&console[_0x57f223(0x13f)](_0x57f223(0x117)+_0x594f5b),_0x455a43&&console['error'](_0x57f223(0x1c5)+_0x455a43),_0xeeec2a&&console[_0x57f223(0x13f)]('Folder\x20path:\x20'+_0xeeec2a));const _0x70fc8f=await withSpinner(_0x57f223(0x16a),()=>_0x58c854['segment']['resolveParentId'](_0xb6a685),{'verbose':_0x5cfbea[_0x57f223(0x17c)]}),_0x277937=_0x70fc8f[_0x57f223(0x1ef)],[_0x4ac24b,_0x31a98d]=await Promise[_0x57f223(0x1ee)]([withSpinner(_0x57f223(0x173),()=>_0x58c854[_0x57f223(0x1c8)][_0x57f223(0x12e)](_0x277937,undefined,{'includeAllVersions':!![]}),{'verbose':_0x5cfbea[_0x57f223(0x17c)]}),withSpinner(_0x57f223(0x18d),()=>_0x58c854[_0x57f223(0x133)][_0x57f223(0x128)](_0x277937),{'verbose':_0x5cfbea[_0x57f223(0x17c)]})]);let _0x42003d=_0x4ac24b[_0x57f223(0x1ef)];const _0x203ac3=_0x31a98d[_0x57f223(0x1ef)],_0x2df10b=buildFolderIdToPathMap(_0x203ac3);if(_0x594f5b){const _0x3aa010=_0x42003d['filter'](_0x1e7449=>_0x1e7449[_0x57f223(0x127)][_0x57f223(0x162)]()===_0x594f5b['toLowerCase']());if(_0x3aa010[_0x57f223(0x149)]===0x0)return console['error'](_0x57f223(0x14e)+_0x594f5b),console[_0x57f223(0x13f)](_0x57f223(0x12c)),0x1;_0x42003d=_0x3aa010;}if(_0xeeec2a!==undefined){const _0x341104=_0x42003d['filter'](_0xa44271=>{const _0x158572=_0x57f223,_0x3af167=_0xa44271[_0x158572(0x1b6)]?_0x2df10b[_0x158572(0x1ca)](_0xa44271[_0x158572(0x1b6)])||'':'';return _0x3af167===_0xeeec2a;});if(_0x341104[_0x57f223(0x149)]===0x0&&_0x42003d[_0x57f223(0x149)]>0x0){console[_0x57f223(0x13f)]('Error:\x20Journey\x20\x27'+_0x594f5b+_0x57f223(0x1af)+(_0xeeec2a||_0x57f223(0x14c))),console[_0x57f223(0x13f)](_0x57f223(0x139));for(const _0x152c97 of _0x42003d){const _0x1faa97=_0x152c97['folderId']?_0x2df10b['get'](_0x152c97[_0x57f223(0x1b6)])||'':'';console['error'](_0x57f223(0x1c4)+(_0x1faa97||'(root)')+'/'+_0x152c97[_0x57f223(0x127)]);}return 0x1;}_0x42003d=_0x341104;}if(_0x42003d[_0x57f223(0x149)]===0x0)return console[_0x57f223(0x13f)]('No\x20journeys\x20found'),0x0;const _0x6528e6=new Map();for(const _0x45e858 of _0x42003d){const _0x460eda=_0x45e858['journeyBundleId'];!_0x6528e6['has'](_0x460eda)&&_0x6528e6[_0x57f223(0x16c)](_0x460eda,[]),_0x6528e6[_0x57f223(0x1ca)](_0x460eda)[_0x57f223(0x172)](_0x45e858);}for(const _0x10aa6b of _0x6528e6[_0x57f223(0x1c7)]()){_0x10aa6b[_0x57f223(0x13a)]((_0x4296ca,_0x5029ef)=>(_0x4296ca[_0x57f223(0x19f)]||0x0)-(_0x5029ef[_0x57f223(0x19f)]||0x0));}const _0x4f5ad6=[],[_0x49cc87,_0xe00dfe]=await Promise['all']([withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x58c854[_0x57f223(0x12b)][_0x57f223(0x198)](),{'verbose':_0x5cfbea[_0x57f223(0x17c)]})[_0x57f223(0x17e)](_0x141e7a=>_0x141e7a[_0x57f223(0x1ef)]),withSpinner(_0x57f223(0x1b0),()=>_0x58c854[_0x57f223(0x123)][_0x57f223(0x1e7)](),{'verbose':_0x5cfbea[_0x57f223(0x17c)]})[_0x57f223(0x17e)](_0x39f07a=>_0x39f07a[_0x57f223(0x1ef)])]);for(const _0x5d788f of _0x6528e6[_0x57f223(0x1c7)]()){const _0x27883a=_0x5d788f[0x0][_0x57f223(0x127)],_0x1dc5fb=_0x5d788f[0x0][_0x57f223(0x1b6)],_0xbbdcd6=_0x1dc5fb?_0x2df10b[_0x57f223(0x1ca)](_0x1dc5fb)||'':'',_0x54826b=_0xbbdcd6?a18_0x513e0b[_0x57f223(0x1d1)](_0x46276a,_0xbbdcd6):_0x46276a,_0x5921c3=_0x455a43||a18_0x513e0b[_0x57f223(0x1d1)](_0x54826b,sanitizeFileName(_0x27883a)+_0x57f223(0x1ed));let _0x4a08d2,_0xfd3e81;if(existsSync(_0x5921c3))try{const _0x1825fd=readFileSync(_0x5921c3,_0x57f223(0x1ea)),_0xdd5dba=parseYamlString(_0x1825fd);_0xfd3e81=_0xdd5dba,_0x4a08d2=buildRuleToNameMapping(_0xdd5dba),_0x3882f4[_0x57f223(0x17c)]&&_0x4a08d2[_0x57f223(0x154)]>0x0&&console[_0x57f223(0x13f)]('Found\x20'+_0x4a08d2[_0x57f223(0x154)]+_0x57f223(0x1e2)+_0x27883a);}catch(_0x4e3b09){_0x3882f4[_0x57f223(0x17c)]&&console['error'](_0x57f223(0x190)+_0x4e3b09[_0x57f223(0x17f)]);}const _0x5e52dd=[],_0x23a656=new Set(),_0x19a566=new Map(),_0x258b23=new Map(),_0x4447bc=new Set(),_0x3ea46e=new Map(),_0x1ff311=new Map(),_0x413a86=createJumpTargetCache();await withProgressSpinner(_0x57f223(0x167)+_0x27883a+_0x57f223(0x13c),async _0x10c34b=>{const _0xd0f0e2=_0x57f223;for(const _0x30e851 of _0x5d788f){const _0x4b4aa5=_0x5d788f['length']>0x1?_0x30e851[_0xd0f0e2(0x127)]+'\x20v'+(_0x30e851['versionNumber']||0x1):_0x30e851['journeyBundleName'];_0x10c34b[_0xd0f0e2(0x195)](_0xd0f0e2(0x167)+_0x4b4aa5);const _0x487ca3=await _0x58c854[_0xd0f0e2(0x1c8)][_0xd0f0e2(0x166)](_0x30e851['id']),_0x2440d4=_0x487ca3[_0xd0f0e2(0x182)]?.[_0xd0f0e2(0x176)],_0x18482d={'resolveSegment':async _0x2e7c22=>{const _0x4c4f56=_0xd0f0e2;if(!_0x2440d4)return{'name':_0x2e7c22,'isJourneyLocal':![]};const _0x50bc94=_0x19a566['get'](_0x2e7c22);if(_0x50bc94)return _0x50bc94;try{const _0x5acae7=await _0x58c854[_0x4c4f56(0x133)][_0x4c4f56(0x1b1)](_0x2440d4,_0x2e7c22),_0x48d97b=_0x5acae7[_0x4c4f56(0x1a9)]===SEGMENT_KIND_JOURNEY;let _0x35fe09,_0x5f4218=_0x5acae7[_0x4c4f56(0x175)];if(_0x48d97b&&_0x5acae7[_0x4c4f56(0x1da)]){const _0x2698be=await segmentResponseToDef(_0x5acae7,{'resolveSegmentName':async _0x255a0d=>{const _0x21d28b=_0x4c4f56,_0x1ec271=_0x19a566['get'](_0x255a0d);if(_0x1ec271)return _0x1ec271[_0x21d28b(0x175)];const _0x3983e6=await _0x18482d['resolveSegment'](_0x255a0d);return _0x3983e6[_0x21d28b(0x175)];}}),_0x4ec548=_0x2698be[_0x4c4f56(0x1da)];_0x35fe09={'description':_0x5acae7[_0x4c4f56(0x187)],'rule':_0x4ec548};const _0x490f34=serializeRule(_0x4ec548),_0x459a78=_0x258b23[_0x4c4f56(0x1ca)](_0x490f34);if(_0x459a78)_0x5f4218=_0x459a78,_0x35fe09=undefined,_0x3882f4['verbose']&&console['error']('\x20\x20Consolidating\x20duplicate\x20segment:\x20'+_0x5acae7[_0x4c4f56(0x175)]+_0x4c4f56(0x1db)+_0x459a78);else{let _0x55ca79=![];if(_0x4a08d2){const _0xdc7cb=_0x4a08d2[_0x4c4f56(0x1ca)](_0x490f34);if(_0xdc7cb){const _0x45fe06=_0xdc7cb[_0x4c4f56(0x12f)](_0xcbe15f=>!_0x23a656['has'](_0xcbe15f));_0x45fe06&&(_0x5f4218=_0x45fe06,_0x23a656[_0x4c4f56(0x11b)](_0x45fe06),_0x258b23[_0x4c4f56(0x16c)](_0x490f34,_0x45fe06),_0x55ca79=!![],_0x3882f4[_0x4c4f56(0x17c)]&&console[_0x4c4f56(0x13f)](_0x4c4f56(0x192)+_0x45fe06+_0x4c4f56(0x1d5)));}}if(!_0x55ca79){const _0x1d34ba=generateJourneyLocalName(_0x5acae7[_0x4c4f56(0x175)]);_0x1d34ba&&(_0x5f4218=_0x1d34ba);let _0x10b2fc=_0x5f4218,_0x2425c1=0x2;while(_0x23a656[_0x4c4f56(0x18c)](_0x10b2fc)){_0x10b2fc=_0x5f4218+'_'+_0x2425c1,_0x2425c1++;}_0x23a656[_0x4c4f56(0x11b)](_0x10b2fc),_0x258b23[_0x4c4f56(0x16c)](_0x490f34,_0x10b2fc),_0x5f4218=_0x10b2fc;}}}const _0x50246f={'name':_0x5f4218,'isJourneyLocal':_0x48d97b,'definition':_0x35fe09};return _0x19a566['set'](_0x2e7c22,_0x50246f),_0x50246f;}catch(_0x1304ef){return _0x5cfbea[_0x4c4f56(0x17c)]&&console[_0x4c4f56(0x13f)](_0x4c4f56(0x14a)+_0x2e7c22+':\x20'+_0x1304ef[_0x4c4f56(0x17f)]),{'name':_0x2e7c22,'isJourneyLocal':![]};}},'resolveActivation':async _0x51d37a=>{const _0x349baa=_0xd0f0e2,_0x3488b4=_0x3ea46e[_0x349baa(0x1ca)](_0x51d37a);if(_0x3488b4)return _0x3488b4;try{const _0x3bc4df=await _0x58c854[_0x349baa(0x1c8)][_0x349baa(0x14d)](_0x30e851['id'],_0x51d37a),_0x5348e3=journeyActivationStepToYaml(_0x3bc4df,_0x49cc87,_0xe00dfe),_0x368523=JSON[_0x349baa(0x19d)]({'name':_0x5348e3[_0x349baa(0x175)],'connection':_0x5348e3[_0x349baa(0x123)],'connector_config':_0x5348e3[_0x349baa(0x15a)]}),_0x4e00c1=_0x1ff311[_0x349baa(0x1ca)](_0x368523);if(_0x4e00c1){const _0x15d532={'name':_0x4e00c1,'isJourneyLocal':!![],'definition':_0x5348e3};return _0x3ea46e[_0x349baa(0x16c)](_0x51d37a,_0x15d532),_0x15d532;}const _0x241eaa=_0x3bc4df[_0x349baa(0x182)]['activationParams'][_0x349baa(0x175)]||_0x51d37a,_0x3082a8=sanitizeYamlKey(_0x241eaa)||_0x349baa(0x13b)+_0x51d37a;let _0x29d933=_0x3082a8,_0x19e186=0x2;while(_0x4447bc[_0x349baa(0x18c)](_0x29d933)){_0x29d933=_0x3082a8+'_'+_0x19e186,_0x19e186++;}_0x4447bc[_0x349baa(0x11b)](_0x29d933),_0x1ff311['set'](_0x368523,_0x29d933);const _0x31e2b0={'name':_0x29d933,'isJourneyLocal':!![],'definition':_0x5348e3};return _0x3ea46e[_0x349baa(0x16c)](_0x51d37a,_0x31e2b0),_0x31e2b0;}catch(_0x20e9db){return _0x5cfbea[_0x349baa(0x17c)]&&console['error'](_0x349baa(0x1bb)+_0x51d37a+':\x20'+_0x20e9db[_0x349baa(0x17f)]),{'name':_0x51d37a,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x351215,_0x40b2c9)=>{return resolveJumpTarget(_0x351215,_0x40b2c9,_0x413a86,_0x599208=>_0x58c854['journey']['getJourney'](_0x599208));}},_0x30d071=await journeyResponseToDef(_0x487ca3,_0x18482d);_0x5e52dd[_0xd0f0e2(0x172)]({'item':_0x30e851,'yaml':_0x30d071});}},{'verbose':_0x5cfbea[_0x57f223(0x17c)]});const _0x513d3c=buildMergedJourneyDef(_0x5e52dd,_0x4a08d2),_0x761d3c=normalizeJourneyDef(_0x513d3c,_0xfd3e81),_0x1c9028=toYamlString(_0x761d3c),_0x5d0930=_0x455a43||a18_0x513e0b[_0x57f223(0x1d1)](_0x54826b,sanitizeFileName(_0x27883a)+_0x57f223(0x1ed));!_0x455a43&&_0xbbdcd6&&!existsSync(_0x54826b)&&mkdirSync(_0x54826b,{'recursive':!![]});const _0x2da048=a18_0x513e0b[_0x57f223(0x1d8)](process[_0x57f223(0x1ac)](),_0x5d0930);if(existsSync(_0x5d0930)){const _0x4dcfcf=readFileSync(_0x5d0930,_0x57f223(0x1ea)),_0x466eea=generateDiff(_0x4dcfcf,_0x1c9028),_0x239a06=hasChanges(_0x466eea);_0x4f5ad6[_0x57f223(0x172)]({'relativePath':_0x2da048,'absolutePath':_0x5d0930,'content':_0x1c9028,'isNew':![],'hasChanges':_0x239a06,'diff':_0x239a06?formatDiffWithColors(_0x466eea):undefined});}else _0x4f5ad6[_0x57f223(0x172)]({'relativePath':_0x2da048,'absolutePath':_0x5d0930,'content':_0x1c9028,'isNew':!![],'hasChanges':![]});}const _0x2d15c0=_0x4f5ad6['filter'](_0xe0ef5a=>_0xe0ef5a[_0x57f223(0x19a)]),_0x51d5e1=_0x4f5ad6['filter'](_0x5008ac=>!_0x5008ac[_0x57f223(0x19a)]&&_0x5008ac['hasChanges']),_0x3ece72=_0x4f5ad6[_0x57f223(0x17b)](_0xbba7aa=>!_0xbba7aa['isNew']&&!_0xbba7aa[_0x57f223(0x14b)]),_0x2a48a1=_0x42003d['length'],_0x13fd99=_0x6528e6[_0x57f223(0x154)],_0x2e6527=_0x2a48a1>_0x13fd99?'\x20('+_0x2a48a1+_0x57f223(0x1a0):'';console[_0x57f223(0x13f)](_0x57f223(0x174)),console[_0x57f223(0x13f)]('\x20\x20'+a18_0x4d810b['cyan'](_0x13fd99+'\x20journeys')+a18_0x4d810b[_0x57f223(0x12a)](_0x2e6527)),console[_0x57f223(0x13f)]('\x20\x20'+a18_0x4d810b[_0x57f223(0x19e)]('+\x20'+_0x2d15c0[_0x57f223(0x149)]+'\x20new\x20files')),console[_0x57f223(0x13f)]('\x20\x20'+a18_0x4d810b[_0x57f223(0x164)]('~\x20'+_0x51d5e1[_0x57f223(0x149)]+_0x57f223(0x150))),console[_0x57f223(0x13f)]('\x20\x20'+a18_0x4d810b[_0x57f223(0x12a)]('=\x20'+_0x3ece72[_0x57f223(0x149)]+_0x57f223(0x16d))),console[_0x57f223(0x13f)](_0x57f223(0x15e)+a18_0x4d810b[_0x57f223(0x118)](_0x46276a)+'\x0a');if(_0x51d5e1[_0x57f223(0x149)]>0x0)for(const _0x182f80 of _0x51d5e1){console[_0x57f223(0x13f)](_0x57f223(0x1b9)+_0x182f80[_0x57f223(0x188)]+'\x27:'),console[_0x57f223(0x13f)]('─'[_0x57f223(0x1e4)](0x3c)),console[_0x57f223(0x13f)](_0x182f80[_0x57f223(0x165)]),console[_0x57f223(0x13f)]('─'['repeat'](0x3c));}if(_0x3882f4[_0x57f223(0x122)])return console[_0x57f223(0x13f)](a18_0x4d810b[_0x57f223(0x164)](_0x57f223(0x17d))),0x0;if(_0x2d15c0[_0x57f223(0x149)]===0x0&&_0x51d5e1[_0x57f223(0x149)]===0x0)return console[_0x57f223(0x13f)](a18_0x4d810b[_0x57f223(0x19e)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0xb6a685},_0x3882f4[_0x57f223(0x147)]),console[_0x57f223(0x13f)](a18_0x4d810b[_0x57f223(0x19e)](_0x57f223(0x1cb)+a18_0x4d810b[_0x57f223(0x12a)](_0x57f223(0x1e0))+_0x57f223(0x1ce)+a18_0x4d810b['cyan'](_0xb6a685))),0x0;if(!_0x3882f4[_0x57f223(0x171)]&&(_0x2d15c0[_0x57f223(0x149)]>0x0||_0x51d5e1['length']>0x0)){const _0x21f114=await confirmKey(_0x57f223(0x142)+(_0x2d15c0[_0x57f223(0x149)]+_0x51d5e1[_0x57f223(0x149)])+_0x57f223(0x1ad));if(!_0x21f114)return console[_0x57f223(0x13f)](_0x57f223(0x1b8)),0x1;}!existsSync(_0x46276a)&&mkdirSync(_0x46276a,{'recursive':!![]});for(const _0x4c7cd7 of _0x4f5ad6){(_0x4c7cd7[_0x57f223(0x19a)]||_0x4c7cd7[_0x57f223(0x14b)])&&writeFileSync(_0x4c7cd7[_0x57f223(0x156)],_0x4c7cd7[_0x57f223(0x140)],_0x57f223(0x1ea));}return console[_0x57f223(0x13f)](a18_0x4d810b[_0x57f223(0x19e)](_0x57f223(0x169)+(_0x2d15c0[_0x57f223(0x149)]+_0x51d5e1['length'])+_0x57f223(0x148)+_0x46276a)),saveSessionContext({'parent_segment':_0xb6a685},_0x3882f4['session']),console[_0x57f223(0x13f)](a18_0x4d810b[_0x57f223(0x19e)](_0x57f223(0x1cb)+a18_0x4d810b[_0x57f223(0x12a)](_0x57f223(0x1e0))+_0x57f223(0x1ce)+a18_0x4d810b[_0x57f223(0x118)](_0xb6a685))),0x0;}}export class JourneyPushCommand extends BaseCommand{['name']='journey:push';[a18_0x52fc43(0x187)]=a18_0x52fc43(0x189);[a18_0x52fc43(0x179)]=new SegmentPushCommand();async[a18_0x52fc43(0x19c)](_0x3ebd8e){const _0x330d89=a18_0x52fc43,_0x31821b=_0x3ebd8e[_0x330d89(0x11c)][0x0];let _0x5e666a;if(_0x31821b){const _0x5a4b95=await resolveTarget({'arg':_0x31821b,'contextParent':_0x3ebd8e[_0x330d89(0x129)][_0x330d89(0x131)],'cwd':process[_0x330d89(0x1ac)]()});isSuccessfulResolution(_0x5a4b95)&&_0x5a4b95[_0x330d89(0x18f)]==='file'&&(_0x5e666a=_0x5a4b95[_0x330d89(0x1a4)]);}const _0x45d580={..._0x3ebd8e,'options':{..._0x3ebd8e[_0x330d89(0x129)],'journeysOnly':!![],..._0x5e666a&&{'singleFilePath':_0x5e666a}}};return this[_0x330d89(0x179)]['execute'](_0x45d580);}}
1
+ const a18_0x5602b0=a18_0x2022;(function(_0x3a5a06,_0x174a6b){const _0x43ed23=a18_0x2022,_0x226c8f=_0x3a5a06();while(!![]){try{const _0x26ec3d=-parseInt(_0x43ed23(0xeb))/0x1*(parseInt(_0x43ed23(0xfa))/0x2)+-parseInt(_0x43ed23(0x153))/0x3+parseInt(_0x43ed23(0x11e))/0x4*(parseInt(_0x43ed23(0x116))/0x5)+parseInt(_0x43ed23(0x163))/0x6+-parseInt(_0x43ed23(0x14c))/0x7+-parseInt(_0x43ed23(0x132))/0x8*(-parseInt(_0x43ed23(0x12d))/0x9)+-parseInt(_0x43ed23(0x194))/0xa;if(_0x26ec3d===_0x174a6b)break;else _0x226c8f['push'](_0x226c8f['shift']());}catch(_0x4e68a9){_0x226c8f['push'](_0x226c8f['shift']());}}}(a18_0x1243,0xefc4f));import a18_0x212540 from'chalk';import a18_0x216d6b from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';function a18_0x1243(){const _0x5e4009=['then','stageName','.yml','length','add','830322bJkSuD','blue','root\x20folder','🗺️\x20','error','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','\x20journeys','Pause\x20a\x20running\x20journey','segment','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','stringify','Resolved\x20YAML\x20file:\x20','state','cyan','parentSegment','content','10158516MZlZHH','stages','Resolving\x20parent\x20segment...','parentName','diff','Getting\x20journey\x20statistics...','\x0aChanges\x20to\x20\x27','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','/j/da','cwd','kind','user','\x20\x20-\x20','paused','Pattern:\x20','hasChanges','Pausing\x20journey...','size','\x20\x20Statistics\x20not\x20available','Folder\x20path:\x20','versionNumber','Getting\x20journey\x20details...','repeat','values','INVALID_ARGUMENT','listJourneysWithFolders','📁\x20','yellow','Error:\x20','filePath','conversionRate','dryRun','no_parent','parent_segment','(draft)','has','get','Journey\x20name:\x20','\x20\x20Consolidating\x20duplicate\x20segment:\x20','Cancelled','Fetching\x20','entered','journeyName','site','message','type','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','sort','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','7776510TzIgPt','green','toLowerCase','split','localeCompare','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','filter','segmentPushCommand','\x20->\x20','verbose','exited','segmentName','\x5c$&','getSegment','test','draft','attributes','\x20unchanged\x20files','web','\x20(ID:\x20','getActivation','✔\x20Journey\x20\x22','buildIdToNameMap','(running)','connection','\x27\x20not\x20found\x20in\x20','resolveJourneyId','Show\x20journey\x20details','resume','goalRate','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','completed','\x20\x20Folder\x20path:\x20','population','rule','table','Found\x20','segments','listJourneysFromParentSegment','errorCode','\x0aPull\x20summary:','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','join','totalEntered','Fetching\x20connections\x20for\x20name\x20resolution...','journey:push','843dcOOvB','entries','Show\x20journey\x20statistics','Resolving\x20journey...','reentryMode','description','Write\x20','Usage:\x20tdx\x20journey\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Inside\x20a\x20segment\x20folder\x20(with\x20tdx.json)','data','Fetching\x20parent\x20segment...','options','yes','totalGoalAchieved','Usage:\x20journey\x20stats\x20<name-or-path>','Listing\x20folders...','548NUMigO','isNew','journeyBundleId','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','\x20versions)','folders','\x20journey\x20files\x20to\x20','getStatistics','red','journey:view','/j/da/je','(completed)','\x22\x20paused','(paused)','Error:\x20Parent\x20segment\x20context\x20required','journey:pull','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','Input:\x20','\x20changed\x20files','\x20journey','targetDir','absolutePath','journeyBundleName','getJourney','...','activation_','\x20files?','archived','40xCLwJZ','\x20Opening\x20','resourceName','\x20\x20Preserving\x20local\x20segment\x20name:\x20','\x22\x20resumed','set','Parent\x20segment:\x20','args','542716mxugxr','find','resolveParentId','pause','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','No\x20journeys\x20found','✔\x20Context\x20set:\x20','rootFolderId','all','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','base','/app/ps/','name','json','resolveSegment','9JlABZa','goal','(archived)','log','\x22\x20not\x20found','10946008EmDCje','utf-8','Target\x20directory:\x20','file','journeys','\x20=\x20','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','/e/','dim','relative','map','session','Listing\x20journeys...','✔\x20Pulled\x20','buildIdToEmailMap','journey:list','push','(root)','setPhase','execute','folderPath','folderId','journey:resume','journey','journeyStages','Warning:\x20Could\x20not\x20resolve\x20activation\x20','13154869NZXPNL','format'];a18_0x1243=function(){return _0x5e4009;};return a18_0x1243();}import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a18_0x2022(_0x1f44d6,_0x419d37){_0x1f44d6=_0x1f44d6-0xcb;const _0x124305=a18_0x1243();let _0x20222d=_0x124305[_0x1f44d6];return _0x20222d;}import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey}from'../utils/prompt.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{journeyResponseToDef,toYamlString,parseYamlString,normalizeJourneyDef}from'../sdk/segment/journey-yaml.js';import{segmentResponseToDef,journeyActivationStepToYaml,serializeRule}from'../sdk/segment/child-segment-yaml.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';import{SegmentPushCommand}from'./segment-push-command.js';import{buildFolderIdToPathMap}from'../sdk/segment/resolution-context.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,createJumpTargetCache,resolveJumpTarget}from'../sdk/segment/journey-utils.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import{hyperlink}from'../sdk/util/formatters.js';function formatJourneyState(_0x194ed2){const _0x2b3394=a18_0x2022;switch(_0x194ed2){case'launched':return a18_0x212540['green'](_0x2b3394(0xd4));case _0x2b3394(0xcc):return a18_0x212540[_0x2b3394(0x13a)](_0x2b3394(0x185));case'paused':return a18_0x212540[_0x2b3394(0x17e)](_0x2b3394(0x107));case _0x2b3394(0xdc):return a18_0x212540[_0x2b3394(0x154)](_0x2b3394(0x105));case _0x2b3394(0x115):return a18_0x212540[_0x2b3394(0x13a)](_0x2b3394(0x12f));default:return'('+_0x194ed2+')';}}function formatJourneyItem(_0x591d5a,_0x491fde='',_0x519bb5){const _0x3a9923=a18_0x2022,_0x3d6a3d=formatJourneyState(_0x591d5a[_0x3a9923(0x15f)]),_0x49d482=_0x519bb5?hyperlink(_0x591d5a[_0x3a9923(0x110)],_0x519bb5):_0x591d5a[_0x3a9923(0x110)];return _0x491fde+_0x3a9923(0x156)+_0x49d482+'\x20'+_0x3d6a3d;}function escapeRegex(_0x48bf57){const _0xcdf9e0=a18_0x2022;return _0x48bf57['replace'](/[.*+?^${}()|[\]\\]/g,_0xcdf9e0(0x1a0));}function globToRegex(_0x5804a5){const _0x4881c1=a18_0x2022,_0x3d1f5a=_0x5804a5[_0x4881c1(0x197)]('*')[_0x4881c1(0x13c)](escapeRegex);return new RegExp(_0x3d1f5a[_0x4881c1(0xe7)]('.*'),'i');}function buildRuleToNameMapping(_0x54c76){const _0x2c0bb4=a18_0x2022,_0x142fdc=new Map();if(_0x54c76['segments'])for(const [_0x5ca410,_0x5bd8ef]of Object[_0x2c0bb4(0xec)](_0x54c76[_0x2c0bb4(0xe2)])){if(_0x5bd8ef[_0x2c0bb4(0xdf)]){const _0x3295d1=serializeRule(_0x5bd8ef[_0x2c0bb4(0xdf)]),_0x49c286=_0x142fdc[_0x2c0bb4(0x187)](_0x3295d1);_0x49c286?_0x49c286[_0x2c0bb4(0x142)](_0x5ca410):_0x142fdc[_0x2c0bb4(0x11b)](_0x3295d1,[_0x5ca410]);}}return _0x142fdc;}async function resolveJourneyTarget(_0x2bf379,_0x1494dc,_0x2437ac){const _0x229d97=a18_0x2022;if(isYamlFilePath(_0x2bf379))try{const _0x49ce59=await resolveYamlFilePath(_0x2bf379);return _0x2437ac&&(console[_0x229d97(0x157)](_0x229d97(0x15e)+_0x2bf379),console[_0x229d97(0x157)]('\x20\x20Parent\x20segment:\x20'+_0x49ce59[_0x229d97(0x161)]),console[_0x229d97(0x157)]('\x20\x20Name:\x20'+_0x49ce59[_0x229d97(0x19f)]),console[_0x229d97(0x157)](_0x229d97(0xdd)+(_0x49ce59[_0x229d97(0x146)]||_0x229d97(0x143)))),{'journeyName':_0x49ce59[_0x229d97(0x19f)],'parentSegment':_0x49ce59[_0x229d97(0x161)],'resolved':_0x49ce59};}catch(_0x1eb3da){throw new SDKError(ErrorCode[_0x229d97(0x17b)],_0x229d97(0x127)+_0x1eb3da[_0x229d97(0x18f)]);}if(!_0x1494dc)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x229d97(0xdb));return{'journeyName':_0x2bf379,'parentSegment':_0x1494dc};}export class JourneyListCommand extends BaseCommand{[a18_0x5602b0(0x12a)]=a18_0x5602b0(0x141);[a18_0x5602b0(0xf0)]='List\x20journeys\x20in\x20current\x20context';async[a18_0x5602b0(0x145)](_0x172169){const _0x386879=a18_0x5602b0,{options:_0x59e74f,args:_0x1b5e94,tdx:_0x4d3723}=_0x172169,_0x482283=_0x1b5e94[0x0],_0x242616=_0x59e74f[_0x386879(0x161)];if(!_0x242616)return console[_0x386879(0x157)](_0x386879(0x108)),console[_0x386879(0x157)](_0x386879(0x15c)),0x1;const _0x43ec4c=await withSpinner(_0x386879(0x165),()=>_0x4d3723['segment'][_0x386879(0x120)](_0x242616),{'verbose':_0x59e74f['verbose']}),_0x128ef0=_0x43ec4c[_0x386879(0xf3)];_0x59e74f[_0x386879(0x19d)]&&(console[_0x386879(0x157)]('Parent\x20segment:\x20'+_0x242616+_0x386879(0xd0)+_0x128ef0+')'),_0x482283&&console['error'](_0x386879(0x171)+_0x482283));const _0x558368=await withSpinner(_0x386879(0xf4),()=>_0x4d3723[_0x386879(0x15b)]['getParentFull'](_0x128ef0),{'verbose':_0x59e74f[_0x386879(0x19d)]}),_0x38d00a=_0x558368[_0x386879(0xf3)],_0x2e6b67=_0x38d00a[_0x386879(0x125)],_0x26bad=await withSpinner(_0x386879(0x13e),()=>_0x4d3723[_0x386879(0x149)][_0x386879(0x17c)](_0x128ef0,_0x2e6b67),{'verbose':_0x59e74f[_0x386879(0x19d)]});let _0x6e1e81=_0x26bad[_0x386879(0xf3)][_0x386879(0x136)];const _0x2b09b6=_0x26bad[_0x386879(0xf3)][_0x386879(0xff)],_0x13b81f=new Map();for(const _0x8ac32d of _0x2b09b6){_0x13b81f[_0x386879(0x11b)](_0x8ac32d['id'],_0x8ac32d[_0x386879(0x12a)]);}if(_0x482283){const _0x224ff3=globToRegex(_0x482283);_0x6e1e81=_0x6e1e81[_0x386879(0x19a)](_0x574fb9=>_0x224ff3[_0x386879(0xcb)](_0x574fb9['journeyBundleName']));}console[_0x386879(0x157)]('✔\x20Found\x20'+_0x6e1e81[_0x386879(0x151)]+_0x386879(0x10d)+(_0x6e1e81['length']!==0x1?'s':''));const _0x24775b=_0x108b84=>{const _0x35d364=_0x386879;return getConsoleNextUrl(_0x59e74f[_0x35d364(0x18e)],_0x35d364(0x129)+_0x128ef0+_0x35d364(0x139)+_0x108b84+_0x35d364(0x16b));};if(_0x59e74f[_0x386879(0x14d)]===_0x386879(0xe0))await handleSDKOutput(_0x6e1e81,_0x59e74f);else{if(_0x59e74f[_0x386879(0x14d)]===_0x386879(0x12b)){const _0x4057e3=_0x6e1e81[_0x386879(0x13c)](_0x984daf=>({..._0x984daf,'url':_0x24775b(_0x984daf['id'])}));await handleSDKOutput(_0x4057e3,_0x59e74f);}else{console[_0x386879(0x130)]('['+_0x242616+']');const _0x5b92d1=new Map(),_0x39bb8a=[];for(const _0x46e6b6 of _0x6e1e81){if(!_0x46e6b6[_0x386879(0x147)]||_0x46e6b6[_0x386879(0x147)]===_0x2e6b67)_0x39bb8a['push'](_0x46e6b6);else{const _0xca549a=_0x5b92d1[_0x386879(0x187)](_0x46e6b6[_0x386879(0x147)])||[];_0xca549a[_0x386879(0x142)](_0x46e6b6),_0x5b92d1[_0x386879(0x11b)](_0x46e6b6['folderId'],_0xca549a);}}const _0x361406=(_0x1baead,_0x580b15)=>_0x1baead[_0x386879(0x110)][_0x386879(0x198)](_0x580b15[_0x386879(0x110)],undefined,{'sensitivity':_0x386879(0x128)});_0x39bb8a[_0x386879(0x192)](_0x361406);for(const _0x51a719 of _0x39bb8a){console[_0x386879(0x130)](formatJourneyItem(_0x51a719,'',_0x24775b(_0x51a719['id'])));}const _0x1fa1ef=[..._0x5b92d1['entries']()][_0x386879(0x192)]((_0x5cdb05,_0x2b0c83)=>{const _0x2f0af4=_0x386879,_0x24619e=_0x13b81f['get'](_0x5cdb05[0x0])||_0x5cdb05[0x0],_0x55657f=_0x13b81f[_0x2f0af4(0x187)](_0x2b0c83[0x0])||_0x2b0c83[0x0];return _0x24619e[_0x2f0af4(0x198)](_0x55657f,undefined,{'sensitivity':_0x2f0af4(0x128)});});for(const [_0x3af759,_0x4990cf]of _0x1fa1ef){const _0x2d09ad=_0x13b81f[_0x386879(0x187)](_0x3af759)||_0x3af759;console[_0x386879(0x130)](_0x386879(0x17d)+_0x2d09ad),_0x4990cf[_0x386879(0x192)](_0x361406);for(const _0x89a3ae of _0x4990cf){console[_0x386879(0x130)](formatJourneyItem(_0x89a3ae,'\x20\x20',_0x24775b(_0x89a3ae['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a18_0x5602b0(0x12a)]=a18_0x5602b0(0x103);['description']=a18_0x5602b0(0xd8);async[a18_0x5602b0(0x145)](_0x4525a6){const _0x38bede=a18_0x5602b0,{options:_0x1f2a63,args:_0x4b34bb,tdx:_0x2e92f2}=_0x4525a6,_0x3f5b54=_0x4b34bb[0x0];if(!_0x3f5b54)return console[_0x38bede(0x157)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x38bede(0x157)]('Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]'),console[_0x38bede(0x157)]('Options:'),console[_0x38bede(0x157)]('\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser'),0x1;_0x1f2a63[_0x38bede(0x19d)]&&console[_0x38bede(0x157)](_0x38bede(0x10b)+_0x3f5b54);const _0x372820=await resolveJourneyTarget(_0x3f5b54,_0x1f2a63[_0x38bede(0x161)],_0x1f2a63[_0x38bede(0x19d)]),_0x34a2ac=await withSpinner(_0x38bede(0x165),()=>_0x2e92f2[_0x38bede(0x15b)][_0x38bede(0x120)](_0x372820[_0x38bede(0x161)]),{'verbose':_0x1f2a63[_0x38bede(0x19d)]}),_0xfcbf74=_0x34a2ac[_0x38bede(0xf3)],_0x2908f5=await withSpinner(_0x38bede(0xee),()=>_0x2e92f2[_0x38bede(0x149)][_0x38bede(0xd7)](_0xfcbf74,_0x372820['journeyName']),{'verbose':_0x1f2a63[_0x38bede(0x19d)]}),_0x1fea10=_0x2908f5[_0x38bede(0xf3)];if(_0x1f2a63[_0x38bede(0xcf)]){const _0x3c0a80=getConsoleNextUrl(_0x1f2a63['site'],_0x38bede(0x129)+_0xfcbf74+_0x38bede(0x139)+_0x1fea10+_0x38bede(0x104));return console[_0x38bede(0x157)](a18_0x212540[_0x38bede(0x195)]('✔')+_0x38bede(0x117)+a18_0x212540['cyan'](_0x3c0a80)),openBrowser(_0x3c0a80),0x0;}const _0x2dc8cb=await withSpinner(_0x38bede(0x178),()=>_0x2e92f2['journey'][_0x38bede(0x111)](_0x1fea10),{'verbose':_0x1f2a63[_0x38bede(0x19d)]}),_0x258c46=_0x2dc8cb[_0x38bede(0xf3)],_0x255b0f=_0x1f2a63['includeStats'];let _0x4c7f73;if(_0x255b0f)try{const _0x245081=await withSpinner(_0x38bede(0x168),()=>_0x2e92f2[_0x38bede(0x149)][_0x38bede(0x101)](_0x1fea10),{'verbose':_0x1f2a63[_0x38bede(0x19d)]});_0x4c7f73=_0x245081['data'];}catch{_0x1f2a63[_0x38bede(0x19d)]&&console[_0x38bede(0x157)](_0x38bede(0x175));}const _0x313bc8=getConsoleNextUrl(_0x1f2a63[_0x38bede(0x18e)],_0x38bede(0x129)+_0xfcbf74+_0x38bede(0x139)+_0x1fea10+'/j/da/je'),_0x800d3e={'id':_0x258c46['id'],'name':_0x258c46[_0x38bede(0xcd)]['name'],'description':_0x258c46[_0x38bede(0xcd)][_0x38bede(0xf0)],'state':_0x258c46[_0x38bede(0xcd)]['state'],'paused':_0x258c46[_0x38bede(0xcd)][_0x38bede(0x170)],'reentry_mode':_0x258c46[_0x38bede(0xcd)][_0x38bede(0xef)],'stages':_0x258c46[_0x38bede(0xcd)][_0x38bede(0x14a)]?.[_0x38bede(0x151)]||0x0,..._0x258c46[_0x38bede(0xcd)][_0x38bede(0x12e)]&&{'goal':_0x258c46[_0x38bede(0xcd)][_0x38bede(0x12e)][_0x38bede(0x12a)]},..._0x4c7f73&&{'statistics':{'total_entered':_0x4c7f73[_0x38bede(0xe8)],'goal_achieved':_0x4c7f73[_0x38bede(0xf7)],'goal_rate':_0x4c7f73['goalRate'],'stages':_0x4c7f73[_0x38bede(0x164)]}},'url':_0x313bc8};return await handleSingleObjectOutput(_0x800d3e,_0x1f2a63),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a18_0x5602b0(0x12a)]='journey:stats';[a18_0x5602b0(0xf0)]=a18_0x5602b0(0xed);async['execute'](_0x1ba043){const _0x5c0c14=a18_0x5602b0,{options:_0x42f67c,args:_0x16fd26,tdx:_0x151d93}=_0x1ba043,_0x5a5b6e=_0x16fd26[0x0];if(!_0x5a5b6e)return console['error']('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x5c0c14(0x157)](_0x5c0c14(0xf8)),0x1;_0x42f67c['verbose']&&console[_0x5c0c14(0x157)](_0x5c0c14(0x10b)+_0x5a5b6e);const _0x18ed9f=await resolveJourneyTarget(_0x5a5b6e,_0x42f67c[_0x5c0c14(0x161)],_0x42f67c['verbose']),_0x2d119f=await withSpinner(_0x5c0c14(0x165),()=>_0x151d93[_0x5c0c14(0x15b)]['resolveParentId'](_0x18ed9f['parentSegment']),{'verbose':_0x42f67c[_0x5c0c14(0x19d)]}),_0x4de985=_0x2d119f[_0x5c0c14(0xf3)],_0xacdd2b=await withSpinner(_0x5c0c14(0xee),()=>_0x151d93[_0x5c0c14(0x149)]['resolveJourneyId'](_0x4de985,_0x18ed9f[_0x5c0c14(0x18d)]),{'verbose':_0x42f67c['verbose']}),_0x29fdca=_0xacdd2b[_0x5c0c14(0xf3)],_0x25c556=await withSpinner(_0x5c0c14(0x168),()=>_0x151d93[_0x5c0c14(0x149)][_0x5c0c14(0x101)](_0x29fdca),{'verbose':_0x42f67c[_0x5c0c14(0x19d)]}),_0x419695=_0x25c556['data'];if(!_0x419695||_0x419695['journeyId']===null)return console[_0x5c0c14(0x157)]('No\x20statistics\x20available\x20for\x20journey:\x20'+_0x18ed9f[_0x5c0c14(0x18d)]),console[_0x5c0c14(0x157)](_0x5c0c14(0xe6)),0x0;const _0x237560={'journey_id':_0x419695['journeyId'],'total_entered':_0x419695['totalEntered'],'goal_achieved':_0x419695[_0x5c0c14(0xf7)],'goal_rate':_0x419695[_0x5c0c14(0xda)],'stages':_0x419695[_0x5c0c14(0x164)]?.[_0x5c0c14(0x13c)](_0x37874c=>({'name':_0x37874c[_0x5c0c14(0x14f)],'population':_0x37874c[_0x5c0c14(0xde)],'entered':_0x37874c['entered'],'exited':_0x37874c['exited'],'conversion_rate':_0x37874c['conversionRate']}))},_0x5ba4bf=_0x42f67c['stage'];if(_0x5ba4bf&&_0x419695[_0x5c0c14(0x164)]){const _0x2b4bc0=_0x419695['stages'][_0x5c0c14(0x11f)](_0x539c39=>_0x539c39['stageName'][_0x5c0c14(0x196)]()===_0x5ba4bf[_0x5c0c14(0x196)]());if(_0x2b4bc0)return await handleSingleObjectOutput({'stage_name':_0x2b4bc0['stageName'],'population':_0x2b4bc0['population'],'entered':_0x2b4bc0[_0x5c0c14(0x18c)],'exited':_0x2b4bc0[_0x5c0c14(0x19e)],'conversion_rate':_0x2b4bc0[_0x5c0c14(0x181)]},_0x42f67c),0x0;console['error']('Warning:\x20Stage\x20\x22'+_0x5ba4bf+_0x5c0c14(0x131));}return await handleSingleObjectOutput(_0x237560,_0x42f67c),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a18_0x5602b0(0x12a)]='journey:pause';[a18_0x5602b0(0xf0)]=a18_0x5602b0(0x15a);async[a18_0x5602b0(0x145)](_0x25b322){const _0x255309=a18_0x5602b0,{options:_0x2b8461,args:_0x76e18a,tdx:_0x3435e4}=_0x25b322,_0x59da66=_0x76e18a[0x0];if(!_0x59da66)return console[_0x255309(0x157)](_0x255309(0xfd)),console[_0x255309(0x157)]('Usage:\x20journey\x20pause\x20<name-or-path>'),0x1;_0x2b8461['verbose']&&console[_0x255309(0x157)](_0x255309(0x10b)+_0x59da66);const _0x2ab5a6=await resolveJourneyTarget(_0x59da66,_0x2b8461[_0x255309(0x161)],_0x2b8461['verbose']),_0x45c244=await withSpinner(_0x255309(0x165),()=>_0x3435e4['segment'][_0x255309(0x120)](_0x2ab5a6[_0x255309(0x161)]),{'verbose':_0x2b8461['verbose']}),_0x2ca816=_0x45c244[_0x255309(0xf3)],_0xb93691=await withSpinner('Resolving\x20journey...',()=>_0x3435e4['journey']['resolveJourneyId'](_0x2ca816,_0x2ab5a6[_0x255309(0x18d)]),{'verbose':_0x2b8461[_0x255309(0x19d)]}),_0xac29ab=_0xb93691[_0x255309(0xf3)];if(!_0x2b8461['yes']){const _0x3abffe=await confirm(_0x255309(0x193)+_0x2ab5a6[_0x255309(0x18d)]+'\x22?');if(!_0x3abffe)return console[_0x255309(0x157)](_0x255309(0x18a)),0x0;}const _0x3ab874=await withSpinner(_0x255309(0x173),()=>_0x3435e4[_0x255309(0x149)][_0x255309(0x121)](_0xac29ab),{'verbose':_0x2b8461[_0x255309(0x19d)]}),_0x5845e8=_0x3ab874[_0x255309(0xf3)];return console[_0x255309(0x157)](_0x255309(0xd2)+_0x5845e8[_0x255309(0xcd)][_0x255309(0x12a)]+_0x255309(0x106)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a18_0x5602b0(0x12a)]=a18_0x5602b0(0x148);[a18_0x5602b0(0xf0)]='Resume\x20a\x20paused\x20journey';async[a18_0x5602b0(0x145)](_0x472920){const _0x47c93f=a18_0x5602b0,{options:_0x52b681,args:_0x164f86,tdx:_0x37c295}=_0x472920,_0x33e056=_0x164f86[0x0];if(!_0x33e056)return console['error'](_0x47c93f(0xfd)),console[_0x47c93f(0x157)]('Usage:\x20journey\x20resume\x20<name-or-path>'),0x1;_0x52b681[_0x47c93f(0x19d)]&&console['error'](_0x47c93f(0x10b)+_0x33e056);const _0x1265ad=await resolveJourneyTarget(_0x33e056,_0x52b681['parentSegment'],_0x52b681['verbose']),_0x5e7c3f=await withSpinner(_0x47c93f(0x165),()=>_0x37c295[_0x47c93f(0x15b)][_0x47c93f(0x120)](_0x1265ad[_0x47c93f(0x161)]),{'verbose':_0x52b681[_0x47c93f(0x19d)]}),_0x5f59a9=_0x5e7c3f[_0x47c93f(0xf3)],_0x1a57e7=await withSpinner(_0x47c93f(0xee),()=>_0x37c295['journey'][_0x47c93f(0xd7)](_0x5f59a9,_0x1265ad[_0x47c93f(0x18d)]),{'verbose':_0x52b681[_0x47c93f(0x19d)]}),_0x31f3b0=_0x1a57e7[_0x47c93f(0xf3)];if(!_0x52b681['yes']){const _0x2723a9=await confirm(_0x47c93f(0x10a)+_0x1265ad['journeyName']+'\x22?');if(!_0x2723a9)return console['error'](_0x47c93f(0x18a)),0x0;}const _0xf55012=await withSpinner('Resuming\x20journey...',()=>_0x37c295[_0x47c93f(0x149)][_0x47c93f(0xd9)](_0x31f3b0),{'verbose':_0x52b681[_0x47c93f(0x19d)]}),_0x3d43cf=_0xf55012[_0x47c93f(0xf3)];return console['error']('✔\x20Journey\x20\x22'+_0x3d43cf[_0x47c93f(0xcd)]['name']+_0x47c93f(0x11a)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a18_0x5602b0(0x12a)]=a18_0x5602b0(0x109);['description']='Export\x20journey(s)\x20as\x20YAML\x20files';async[a18_0x5602b0(0x145)](_0x17b73d){const _0xcdfbf4=a18_0x5602b0,{options:_0x18057e,args:_0x4c62bf,tdx:_0x33a408}=_0x17b73d,_0x3f2f35=_0x18057e,_0x1e7b8d=_0x4c62bf[0x0],_0x18465d=_0x1e7b8d&&isYamlFilePath(_0x1e7b8d),_0x4cab0d=await resolveTarget({'arg':_0x18465d?_0x1e7b8d:undefined,'contextParent':_0x18057e[_0xcdfbf4(0x161)],'cwd':process[_0xcdfbf4(0x16c)]()});if(!isSuccessfulResolution(_0x4cab0d))return _0x4cab0d[_0xcdfbf4(0xe4)]===_0xcdfbf4(0x183)?(console[_0xcdfbf4(0x157)](a18_0x212540[_0xcdfbf4(0x17e)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console['error'](_0xcdfbf4(0xf2)),console[_0xcdfbf4(0x157)](_0xcdfbf4(0x122)),console[_0xcdfbf4(0x157)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file'),console[_0xcdfbf4(0x157)]('\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')):(console[_0xcdfbf4(0x157)](a18_0x212540[_0xcdfbf4(0x102)](_0xcdfbf4(0x17f)+_0x4cab0d[_0xcdfbf4(0x18f)]+'\x0a')),_0x4cab0d['helpText']&&console[_0xcdfbf4(0x157)](a18_0x212540[_0xcdfbf4(0x160)](_0x4cab0d['helpText']))),0x1;let _0x1769eb=_0x18465d?undefined:_0x1e7b8d,_0x44045d,_0x29909a;_0x4cab0d[_0xcdfbf4(0x190)]===_0xcdfbf4(0x135)&&(_0x1769eb=_0x4cab0d[_0xcdfbf4(0x118)],_0x44045d=_0x4cab0d[_0xcdfbf4(0x180)],_0x29909a=_0x4cab0d[_0xcdfbf4(0x146)]);const _0x2dd384=_0x4cab0d[_0xcdfbf4(0x166)],_0x1f159d=_0x4cab0d[_0xcdfbf4(0x10e)];_0x3f2f35['verbose']&&(console[_0xcdfbf4(0x157)](_0xcdfbf4(0x11c)+_0x2dd384),console[_0xcdfbf4(0x157)](_0xcdfbf4(0x134)+_0x1f159d),_0x1769eb&&console[_0xcdfbf4(0x157)](_0xcdfbf4(0x188)+_0x1769eb),_0x44045d&&console[_0xcdfbf4(0x157)]('Target\x20file:\x20'+_0x44045d),_0x29909a&&console[_0xcdfbf4(0x157)](_0xcdfbf4(0x176)+_0x29909a));const _0x312c69=await withSpinner(_0xcdfbf4(0x165),()=>_0x33a408[_0xcdfbf4(0x15b)][_0xcdfbf4(0x120)](_0x2dd384),{'verbose':_0x18057e['verbose']}),_0x183ec0=_0x312c69[_0xcdfbf4(0xf3)],[_0x5885e0,_0x497b6c]=await Promise[_0xcdfbf4(0x126)]([withSpinner(_0xcdfbf4(0x13e),()=>_0x33a408['journey'][_0xcdfbf4(0xe3)](_0x183ec0,undefined,{'includeAllVersions':!![]}),{'verbose':_0x18057e[_0xcdfbf4(0x19d)]}),withSpinner(_0xcdfbf4(0xf9),()=>_0x33a408[_0xcdfbf4(0x15b)]['listFolders'](_0x183ec0),{'verbose':_0x18057e[_0xcdfbf4(0x19d)]})]);let _0x4de47a=_0x5885e0['data'];const _0x42ee35=_0x497b6c[_0xcdfbf4(0xf3)],_0x33b0ac=buildFolderIdToPathMap(_0x42ee35);if(_0x1769eb){const _0x404cff=_0x4de47a[_0xcdfbf4(0x19a)](_0x104d3e=>_0x104d3e['journeyBundleName'][_0xcdfbf4(0x196)]()===_0x1769eb[_0xcdfbf4(0x196)]());if(_0x404cff[_0xcdfbf4(0x151)]===0x0)return console[_0xcdfbf4(0x157)]('Error:\x20Journey\x20not\x20found:\x20'+_0x1769eb),console[_0xcdfbf4(0x157)]('Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys'),0x1;_0x4de47a=_0x404cff;}if(_0x29909a!==undefined){const _0xd29d91=_0x4de47a[_0xcdfbf4(0x19a)](_0x119d33=>{const _0x32bf39=_0xcdfbf4,_0x334019=_0x119d33[_0x32bf39(0x147)]?_0x33b0ac[_0x32bf39(0x187)](_0x119d33[_0x32bf39(0x147)])||'':'';return _0x334019===_0x29909a;});if(_0xd29d91[_0xcdfbf4(0x151)]===0x0&&_0x4de47a[_0xcdfbf4(0x151)]>0x0){console[_0xcdfbf4(0x157)]('Error:\x20Journey\x20\x27'+_0x1769eb+_0xcdfbf4(0xd6)+(_0x29909a||_0xcdfbf4(0x155))),console[_0xcdfbf4(0x157)](_0xcdfbf4(0x191));for(const _0x26dab3 of _0x4de47a){const _0x430400=_0x26dab3['folderId']?_0x33b0ac[_0xcdfbf4(0x187)](_0x26dab3[_0xcdfbf4(0x147)])||'':'';console['error'](_0xcdfbf4(0x16f)+(_0x430400||_0xcdfbf4(0x143))+'/'+_0x26dab3[_0xcdfbf4(0x110)]);}return 0x1;}_0x4de47a=_0xd29d91;}if(_0x4de47a[_0xcdfbf4(0x151)]===0x0)return console[_0xcdfbf4(0x157)](_0xcdfbf4(0x123)),0x0;const _0x34403c=new Map();for(const _0x30ecee of _0x4de47a){const _0x325361=_0x30ecee[_0xcdfbf4(0xfc)];!_0x34403c['has'](_0x325361)&&_0x34403c[_0xcdfbf4(0x11b)](_0x325361,[]),_0x34403c[_0xcdfbf4(0x187)](_0x325361)[_0xcdfbf4(0x142)](_0x30ecee);}for(const _0x40f177 of _0x34403c[_0xcdfbf4(0x17a)]()){_0x40f177[_0xcdfbf4(0x192)]((_0x2471eb,_0x46c2f5)=>(_0x2471eb[_0xcdfbf4(0x177)]||0x0)-(_0x46c2f5[_0xcdfbf4(0x177)]||0x0));}const _0x48aaf6=[],[_0x29eddd,_0x3846e2]=await Promise[_0xcdfbf4(0x126)]([withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x33a408[_0xcdfbf4(0x16e)][_0xcdfbf4(0x140)](),{'verbose':_0x18057e['verbose']})['then'](_0x2a77c8=>_0x2a77c8[_0xcdfbf4(0xf3)]),withSpinner(_0xcdfbf4(0xe9),()=>_0x33a408[_0xcdfbf4(0xd5)][_0xcdfbf4(0xd3)](),{'verbose':_0x18057e[_0xcdfbf4(0x19d)]})[_0xcdfbf4(0x14e)](_0x241225=>_0x241225[_0xcdfbf4(0xf3)])]);for(const _0x2cc7b6 of _0x34403c[_0xcdfbf4(0x17a)]()){const _0x1741bd=_0x2cc7b6[0x0][_0xcdfbf4(0x110)],_0x1763c0=_0x2cc7b6[0x0][_0xcdfbf4(0x147)],_0x411046=_0x1763c0?_0x33b0ac[_0xcdfbf4(0x187)](_0x1763c0)||'':'',_0x4bdffd=_0x411046?a18_0x216d6b[_0xcdfbf4(0xe7)](_0x1f159d,_0x411046):_0x1f159d,_0x4b0f1d=_0x44045d||a18_0x216d6b['join'](_0x4bdffd,sanitizeFileName(_0x1741bd)+_0xcdfbf4(0x150));let _0x3cee84,_0x13814e;if(existsSync(_0x4b0f1d))try{const _0x3b0083=readFileSync(_0x4b0f1d,_0xcdfbf4(0x133)),_0x5b3cfd=parseYamlString(_0x3b0083);_0x13814e=_0x5b3cfd,_0x3cee84=buildRuleToNameMapping(_0x5b3cfd),_0x3f2f35[_0xcdfbf4(0x19d)]&&_0x3cee84[_0xcdfbf4(0x174)]>0x0&&console[_0xcdfbf4(0x157)](_0xcdfbf4(0xe1)+_0x3cee84['size']+_0xcdfbf4(0x158)+_0x1741bd);}catch(_0x5874f6){_0x3f2f35[_0xcdfbf4(0x19d)]&&console[_0xcdfbf4(0x157)](_0xcdfbf4(0x138)+_0x5874f6['message']);}const _0x2512cd=[],_0x29a98d=new Set(),_0x340d48=new Map(),_0x58c67b=new Map(),_0x1bd428=new Set(),_0x5a8eda=new Map(),_0x4f0761=new Map(),_0x53914b=createJumpTargetCache();await withProgressSpinner(_0xcdfbf4(0x18b)+_0x1741bd+_0xcdfbf4(0x112),async _0x228eb5=>{const _0x290c50=_0xcdfbf4;for(const _0x2a14c5 of _0x2cc7b6){const _0x110c4d=_0x2cc7b6[_0x290c50(0x151)]>0x1?_0x2a14c5[_0x290c50(0x110)]+'\x20v'+(_0x2a14c5['versionNumber']||0x1):_0x2a14c5[_0x290c50(0x110)];_0x228eb5[_0x290c50(0x144)](_0x290c50(0x18b)+_0x110c4d);const _0x53589b=await _0x33a408[_0x290c50(0x149)][_0x290c50(0x111)](_0x2a14c5['id']),_0x543adc=_0x53589b['attributes']?.['audienceId'],_0x6346de={'resolveSegment':async _0x3cd252=>{const _0x161a0b=_0x290c50;if(!_0x543adc)return{'name':_0x3cd252,'isJourneyLocal':![]};const _0x23bd93=_0x340d48[_0x161a0b(0x187)](_0x3cd252);if(_0x23bd93)return _0x23bd93;try{const _0x27cf3d=await _0x33a408[_0x161a0b(0x15b)][_0x161a0b(0x1a1)](_0x543adc,_0x3cd252),_0x52b411=_0x27cf3d[_0x161a0b(0x16d)]===SEGMENT_KIND_JOURNEY;let _0x3e1227,_0x154b80=_0x27cf3d[_0x161a0b(0x12a)];if(_0x52b411&&_0x27cf3d[_0x161a0b(0xdf)]){const _0x26580a=await segmentResponseToDef(_0x27cf3d,{'resolveSegmentName':async _0x37d51a=>{const _0x188eb3=_0x161a0b,_0x500cbe=_0x340d48[_0x188eb3(0x187)](_0x37d51a);if(_0x500cbe)return _0x500cbe[_0x188eb3(0x12a)];const _0x4fc110=await _0x6346de[_0x188eb3(0x12c)](_0x37d51a);return _0x4fc110[_0x188eb3(0x12a)];}}),_0x22acca=_0x26580a[_0x161a0b(0xdf)];_0x3e1227={'description':_0x27cf3d[_0x161a0b(0xf0)],'rule':_0x22acca};const _0x4ac4e6=serializeRule(_0x22acca),_0x256570=_0x58c67b['get'](_0x4ac4e6);if(_0x256570)_0x154b80=_0x256570,_0x3e1227=undefined,_0x3f2f35[_0x161a0b(0x19d)]&&console[_0x161a0b(0x157)](_0x161a0b(0x189)+_0x27cf3d[_0x161a0b(0x12a)]+_0x161a0b(0x19c)+_0x256570);else{let _0x1f911a=![];if(_0x3cee84){const _0x439520=_0x3cee84[_0x161a0b(0x187)](_0x4ac4e6);if(_0x439520){const _0x5d0384=_0x439520[_0x161a0b(0x11f)](_0x1e9b62=>!_0x29a98d[_0x161a0b(0x186)](_0x1e9b62));_0x5d0384&&(_0x154b80=_0x5d0384,_0x29a98d[_0x161a0b(0x152)](_0x5d0384),_0x58c67b['set'](_0x4ac4e6,_0x5d0384),_0x1f911a=!![],_0x3f2f35[_0x161a0b(0x19d)]&&console[_0x161a0b(0x157)](_0x161a0b(0x119)+_0x5d0384+'\x20(rule\x20match)'));}}if(!_0x1f911a){const _0xec5f39=generateJourneyLocalName(_0x27cf3d[_0x161a0b(0x12a)]);_0xec5f39&&(_0x154b80=_0xec5f39);let _0x1db0ca=_0x154b80,_0x39f193=0x2;while(_0x29a98d[_0x161a0b(0x186)](_0x1db0ca)){_0x1db0ca=_0x154b80+'_'+_0x39f193,_0x39f193++;}_0x29a98d[_0x161a0b(0x152)](_0x1db0ca),_0x58c67b['set'](_0x4ac4e6,_0x1db0ca),_0x154b80=_0x1db0ca;}}}const _0x5a8169={'name':_0x154b80,'isJourneyLocal':_0x52b411,'definition':_0x3e1227};return _0x340d48[_0x161a0b(0x11b)](_0x3cd252,_0x5a8169),_0x5a8169;}catch(_0x10862e){return _0x18057e[_0x161a0b(0x19d)]&&console['error']('Warning:\x20Could\x20not\x20resolve\x20segment\x20'+_0x3cd252+':\x20'+_0x10862e[_0x161a0b(0x18f)]),{'name':_0x3cd252,'isJourneyLocal':![]};}},'resolveActivation':async _0x468b2b=>{const _0x313087=_0x290c50,_0x3a7520=_0x5a8eda['get'](_0x468b2b);if(_0x3a7520)return _0x3a7520;try{const _0x1d0f80=await _0x33a408[_0x313087(0x149)][_0x313087(0xd1)](_0x2a14c5['id'],_0x468b2b),_0x48558c=journeyActivationStepToYaml(_0x1d0f80,_0x29eddd,_0x3846e2),_0x5a8994=JSON[_0x313087(0x15d)]({'name':_0x48558c[_0x313087(0x12a)],'connection':_0x48558c[_0x313087(0xd5)],'connector_config':_0x48558c['connector_config']}),_0x5c83cc=_0x4f0761['get'](_0x5a8994);if(_0x5c83cc){const _0x5bca66={'name':_0x5c83cc,'isJourneyLocal':!![],'definition':_0x48558c};return _0x5a8eda[_0x313087(0x11b)](_0x468b2b,_0x5bca66),_0x5bca66;}const _0xd255bc=_0x1d0f80[_0x313087(0xcd)]['activationParams'][_0x313087(0x12a)]||_0x468b2b,_0x1744b2=sanitizeYamlKey(_0xd255bc)||_0x313087(0x113)+_0x468b2b;let _0x1b55a7=_0x1744b2,_0x99f044=0x2;while(_0x1bd428[_0x313087(0x186)](_0x1b55a7)){_0x1b55a7=_0x1744b2+'_'+_0x99f044,_0x99f044++;}_0x1bd428[_0x313087(0x152)](_0x1b55a7),_0x4f0761[_0x313087(0x11b)](_0x5a8994,_0x1b55a7);const _0x3d4196={'name':_0x1b55a7,'isJourneyLocal':!![],'definition':_0x48558c};return _0x5a8eda[_0x313087(0x11b)](_0x468b2b,_0x3d4196),_0x3d4196;}catch(_0x59dc5f){return _0x18057e['verbose']&&console[_0x313087(0x157)](_0x313087(0x14b)+_0x468b2b+':\x20'+_0x59dc5f[_0x313087(0x18f)]),{'name':_0x468b2b,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x47aa0c,_0x10cc97)=>{const _0xfd6573=_0x290c50;return resolveJumpTarget(_0x47aa0c,_0x10cc97,_0x53914b,_0x54f333=>_0x33a408[_0xfd6573(0x149)][_0xfd6573(0x111)](_0x54f333));}},_0x37c61a=await journeyResponseToDef(_0x53589b,_0x6346de);_0x2512cd['push']({'item':_0x2a14c5,'yaml':_0x37c61a});}},{'verbose':_0x18057e[_0xcdfbf4(0x19d)]});const _0x24f197=buildMergedJourneyDef(_0x2512cd,_0x3cee84),_0x529efb=normalizeJourneyDef(_0x24f197,_0x13814e),_0xc915f3=toYamlString(_0x529efb),_0x42d5a5=_0x44045d||a18_0x216d6b[_0xcdfbf4(0xe7)](_0x4bdffd,sanitizeFileName(_0x1741bd)+'.yml');!_0x44045d&&_0x411046&&!existsSync(_0x4bdffd)&&mkdirSync(_0x4bdffd,{'recursive':!![]});const _0x10d36c=a18_0x216d6b[_0xcdfbf4(0x13b)](process[_0xcdfbf4(0x16c)](),_0x42d5a5);if(existsSync(_0x42d5a5)){const _0x879c82=readFileSync(_0x42d5a5,_0xcdfbf4(0x133)),_0x51fff6=generateDiff(_0x879c82,_0xc915f3),_0x1b83a6=hasChanges(_0x51fff6);_0x48aaf6[_0xcdfbf4(0x142)]({'relativePath':_0x10d36c,'absolutePath':_0x42d5a5,'content':_0xc915f3,'isNew':![],'hasChanges':_0x1b83a6,'diff':_0x1b83a6?formatDiffWithColors(_0x51fff6):undefined});}else _0x48aaf6[_0xcdfbf4(0x142)]({'relativePath':_0x10d36c,'absolutePath':_0x42d5a5,'content':_0xc915f3,'isNew':!![],'hasChanges':![]});}const _0x5c8754=_0x48aaf6[_0xcdfbf4(0x19a)](_0x2664f2=>_0x2664f2[_0xcdfbf4(0xfb)]),_0x2f74dc=_0x48aaf6['filter'](_0x28be1d=>!_0x28be1d[_0xcdfbf4(0xfb)]&&_0x28be1d[_0xcdfbf4(0x172)]),_0xf89750=_0x48aaf6[_0xcdfbf4(0x19a)](_0x4d8611=>!_0x4d8611[_0xcdfbf4(0xfb)]&&!_0x4d8611[_0xcdfbf4(0x172)]),_0x5c5f07=_0x4de47a[_0xcdfbf4(0x151)],_0x2d2448=_0x34403c[_0xcdfbf4(0x174)],_0x33fc1c=_0x5c5f07>_0x2d2448?'\x20('+_0x5c5f07+_0xcdfbf4(0xfe):'';console[_0xcdfbf4(0x157)](_0xcdfbf4(0xe5)),console[_0xcdfbf4(0x157)]('\x20\x20'+a18_0x212540[_0xcdfbf4(0x160)](_0x2d2448+_0xcdfbf4(0x159))+a18_0x212540[_0xcdfbf4(0x13a)](_0x33fc1c)),console[_0xcdfbf4(0x157)]('\x20\x20'+a18_0x212540[_0xcdfbf4(0x195)]('+\x20'+_0x5c8754[_0xcdfbf4(0x151)]+'\x20new\x20files')),console[_0xcdfbf4(0x157)]('\x20\x20'+a18_0x212540[_0xcdfbf4(0x17e)]('~\x20'+_0x2f74dc['length']+_0xcdfbf4(0x10c))),console[_0xcdfbf4(0x157)]('\x20\x20'+a18_0x212540[_0xcdfbf4(0x13a)]('=\x20'+_0xf89750[_0xcdfbf4(0x151)]+_0xcdfbf4(0xce))),console[_0xcdfbf4(0x157)]('\x20\x20Target:\x20'+a18_0x212540['cyan'](_0x1f159d)+'\x0a');if(_0x2f74dc[_0xcdfbf4(0x151)]>0x0)for(const _0x2bdbdf of _0x2f74dc){console[_0xcdfbf4(0x157)](_0xcdfbf4(0x169)+_0x2bdbdf['relativePath']+'\x27:'),console['error']('─'[_0xcdfbf4(0x179)](0x3c)),console['error'](_0x2bdbdf[_0xcdfbf4(0x167)]),console[_0xcdfbf4(0x157)]('─'[_0xcdfbf4(0x179)](0x3c));}if(_0x3f2f35[_0xcdfbf4(0x182)])return console[_0xcdfbf4(0x157)](a18_0x212540[_0xcdfbf4(0x17e)](_0xcdfbf4(0x16a))),0x0;if(_0x5c8754[_0xcdfbf4(0x151)]===0x0&&_0x2f74dc[_0xcdfbf4(0x151)]===0x0)return console['error'](a18_0x212540[_0xcdfbf4(0x195)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x2dd384},_0x3f2f35[_0xcdfbf4(0x13d)]),console[_0xcdfbf4(0x157)](a18_0x212540[_0xcdfbf4(0x195)](_0xcdfbf4(0x124)+a18_0x212540['dim'](_0xcdfbf4(0x184))+_0xcdfbf4(0x137)+a18_0x212540[_0xcdfbf4(0x160)](_0x2dd384))),0x0;if(!_0x3f2f35[_0xcdfbf4(0xf6)]&&(_0x5c8754['length']>0x0||_0x2f74dc[_0xcdfbf4(0x151)]>0x0)){const _0x418ef3=await confirmKey(_0xcdfbf4(0xf1)+(_0x5c8754[_0xcdfbf4(0x151)]+_0x2f74dc['length'])+_0xcdfbf4(0x114));if(!_0x418ef3)return console['error']('Aborted.'),0x1;}!existsSync(_0x1f159d)&&mkdirSync(_0x1f159d,{'recursive':!![]});for(const _0x1d40e0 of _0x48aaf6){(_0x1d40e0['isNew']||_0x1d40e0[_0xcdfbf4(0x172)])&&writeFileSync(_0x1d40e0[_0xcdfbf4(0x10f)],_0x1d40e0[_0xcdfbf4(0x162)],_0xcdfbf4(0x133));}return console[_0xcdfbf4(0x157)](a18_0x212540['green'](_0xcdfbf4(0x13f)+(_0x5c8754[_0xcdfbf4(0x151)]+_0x2f74dc[_0xcdfbf4(0x151)])+_0xcdfbf4(0x100)+_0x1f159d)),saveSessionContext({'parent_segment':_0x2dd384},_0x3f2f35[_0xcdfbf4(0x13d)]),console['error'](a18_0x212540[_0xcdfbf4(0x195)](_0xcdfbf4(0x124)+a18_0x212540['dim']('parent_segment')+_0xcdfbf4(0x137)+a18_0x212540['cyan'](_0x2dd384))),0x0;}}export class JourneyPushCommand extends BaseCommand{[a18_0x5602b0(0x12a)]=a18_0x5602b0(0xea);[a18_0x5602b0(0xf0)]=a18_0x5602b0(0x199);[a18_0x5602b0(0x19b)]=new SegmentPushCommand();async['execute'](_0x298a03){const _0x127965=a18_0x5602b0,_0x4038c8=_0x298a03[_0x127965(0x11d)][0x0];let _0x1e5b7f;if(_0x4038c8){const _0x572c69=await resolveTarget({'arg':_0x4038c8,'contextParent':_0x298a03[_0x127965(0xf5)]['parentSegment'],'cwd':process[_0x127965(0x16c)]()});isSuccessfulResolution(_0x572c69)&&_0x572c69[_0x127965(0x190)]==='file'&&(_0x1e5b7f=_0x572c69[_0x127965(0x180)]);}const _0x55135e={..._0x298a03,'options':{..._0x298a03[_0x127965(0xf5)],'journeysOnly':!![],..._0x1e5b7f&&{'singleFilePath':_0x1e5b7f}}};return this[_0x127965(0x19b)][_0x127965(0x145)](_0x55135e);}}
@@ -1 +1 @@
1
- const a19_0x2bfb4f=a19_0x12a5;(function(_0x323494,_0x4250e1){const _0x24b30c=a19_0x12a5,_0x33c344=_0x323494();while(!![]){try{const _0x179576=-parseInt(_0x24b30c(0x109))/0x1*(-parseInt(_0x24b30c(0x111))/0x2)+-parseInt(_0x24b30c(0x100))/0x3*(parseInt(_0x24b30c(0xf9))/0x4)+parseInt(_0x24b30c(0xec))/0x5*(-parseInt(_0x24b30c(0xff))/0x6)+-parseInt(_0x24b30c(0x105))/0x7+parseInt(_0x24b30c(0xdf))/0x8*(-parseInt(_0x24b30c(0xf4))/0x9)+parseInt(_0x24b30c(0xfb))/0xa*(-parseInt(_0x24b30c(0x106))/0xb)+parseInt(_0x24b30c(0xeb))/0xc*(parseInt(_0x24b30c(0xde))/0xd);if(_0x179576===_0x4250e1)break;else _0x33c344['push'](_0x33c344['shift']());}catch(_0x139926){_0x33c344['push'](_0x33c344['shift']());}}}(a19_0x3a1c,0x89f4a));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';function a19_0x3a1c(){const _0x37ff16=['endsWith','invalidCount','5803259zhmjcz','4411qAOAeu','warningCount','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','1472ssxIdM','Error:\x20','log','No\x20journey\x20YAML\x20files\x20found\x20in\x20','parentSegment','\x20segment\x20file(s)\x20skipped','valid','yellow','36eULTXl','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20.\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20current\x20directory','\x20error(s)','length','filePath','117kxPMfl','8gBoqaK','verbose','targetDir','dim','.yaml','execute','\x20journey(s)\x20valid','cyan','red','helpText','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','description','4278732qMbboj','400dXxqkw','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','type','green','Error:\x20Directory\x20not\x20found:\x20','errorCode','skippedCount','\x20warning(s)\x20found','2051019NLcNFl','message','✔\x20All\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','warnings','10540OcXmzk','errors','9460MmIcXV','\x20valid','error','\x20warning(s)','43752XCWJEe','741lHyXTn','validCount','Validation\x20failed:\x20'];a19_0x3a1c=function(){return _0x37ff16;};return a19_0x3a1c();}import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a19_0x400e51 from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';function a19_0x12a5(_0x853c1e,_0x538fe1){_0x853c1e=_0x853c1e-0xda;const _0x3a1c03=a19_0x3a1c();let _0x12a5c9=_0x3a1c03[_0x853c1e];return _0x12a5c9;}import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class JourneyValidateCommand extends BaseCommand{['name']='journey:validate';[a19_0x2bfb4f(0xea)]='Validate\x20journey\x20YAML\x20files';async[a19_0x2bfb4f(0xe4)](_0xd9e837){const _0x34da58=a19_0x2bfb4f,{options:_0x242546,args:_0x45cac4}=_0xd9e837,_0x55d0d1=_0x242546,_0x1da04e=await resolveTarget({'arg':_0x45cac4[0x0],'contextParent':_0x242546[_0x34da58(0x10d)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x1da04e))return _0x1da04e[_0x34da58(0xf1)]==='no_parent'?(console[_0x34da58(0xfd)](a19_0x400e51[_0x34da58(0x110)](_0x34da58(0xf7))),console[_0x34da58(0xfd)]('Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)'),console[_0x34da58(0xfd)](_0x34da58(0xda)),console['error'](_0x34da58(0xe9))):(console[_0x34da58(0xfd)](a19_0x400e51[_0x34da58(0xe7)](_0x34da58(0x10a)+_0x1da04e[_0x34da58(0xf5)]+'\x0a')),_0x1da04e[_0x34da58(0xe8)]&&console['error'](a19_0x400e51[_0x34da58(0xe6)](_0x1da04e[_0x34da58(0xe8)]))),0x1;const _0x31b51b=_0x1da04e[_0x34da58(0xe1)],_0x18337c=_0x1da04e[_0x34da58(0xee)]==='file'?_0x1da04e[_0x34da58(0xdd)]:undefined;if(!_0x18337c&&!existsSync(_0x31b51b))return console['error'](a19_0x400e51[_0x34da58(0xe7)](_0x34da58(0xf0)+_0x31b51b+'\x0a')),0x1;let _0x2cb928;if(_0x18337c){if(!_0x18337c[_0x34da58(0x103)]('.yml')&&!_0x18337c['endsWith'](_0x34da58(0xe3)))return console['error'](a19_0x400e51[_0x34da58(0xe7)](_0x34da58(0xed)+_0x18337c+'\x0a')),0x1;_0x2cb928=[_0x18337c];}else _0x2cb928=findYamlFiles(_0x31b51b);if(_0x2cb928[_0x34da58(0xdc)]===0x0)return console[_0x34da58(0xfd)](a19_0x400e51[_0x34da58(0xe7)](_0x34da58(0x108)+_0x31b51b+'\x0a')),0x1;const _0x555da3=validateYamlFiles(_0x2cb928,_0x31b51b,{'filterType':'journey'}),_0x375385=calculateSummary(_0x555da3),_0x299395=_0x555da3['filter'](isValidationResult);if(_0x299395[_0x34da58(0xdc)]===0x0)return console['error'](a19_0x400e51['yellow'](_0x34da58(0x10c)+_0x31b51b+'\x0a')),_0x375385[_0x34da58(0xf2)]>0x0&&console[_0x34da58(0xfd)](a19_0x400e51[_0x34da58(0xe2)]('('+_0x375385['skippedCount']+'\x20segment\x20file(s)\x20skipped)')),0x0;for(const _0x3f8356 of _0x555da3){if(!isValidationResult(_0x3f8356)){_0x55d0d1[_0x34da58(0xe0)]&&console[_0x34da58(0x10b)](a19_0x400e51[_0x34da58(0xe2)]('-\x20'+_0x3f8356['relativePath']+'\x20(skipped:\x20'+_0x3f8356['reason']+')'));continue;}const {relativePath:_0x28ee87,source:_0x2bc55a,result:_0x42920a}=_0x3f8356;if(_0x42920a[_0x34da58(0x10f)]&&_0x42920a[_0x34da58(0xf8)][_0x34da58(0xdc)]===0x0)_0x55d0d1[_0x34da58(0xe0)]&&console['log'](a19_0x400e51[_0x34da58(0xef)]('✔\x20'+_0x28ee87));else _0x42920a[_0x34da58(0x10f)]?(console[_0x34da58(0x10b)](a19_0x400e51[_0x34da58(0x110)]('⚠\x20'+_0x28ee87+':\x20'+_0x42920a['warnings'][_0x34da58(0xdc)]+_0x34da58(0xfe))),console[_0x34da58(0x10b)](formatValidationResult(_0x42920a,_0x2bc55a,_0x28ee87))):(console['log'](a19_0x400e51['red']('✖\x20'+_0x28ee87+':\x20'+_0x42920a[_0x34da58(0xfa)]['length']+_0x34da58(0xdb))),console['log'](formatValidationResult(_0x42920a,_0x2bc55a,_0x28ee87)));}return console[_0x34da58(0x10b)](''),_0x375385['hasErrors']?(console[_0x34da58(0x10b)](a19_0x400e51['red'](_0x34da58(0x102)+_0x375385[_0x34da58(0x104)]+'\x20journey(s)\x20with\x20errors,\x20'+_0x375385[_0x34da58(0x101)]+_0x34da58(0xfc))),_0x375385[_0x34da58(0x107)]>0x0&&console['log'](a19_0x400e51[_0x34da58(0x110)](_0x375385[_0x34da58(0x107)]+_0x34da58(0xf3))),_0x375385[_0x34da58(0xf2)]>0x0&&console[_0x34da58(0x10b)](a19_0x400e51[_0x34da58(0xe2)](_0x375385[_0x34da58(0xf2)]+'\x20segment\x20file(s)\x20skipped')),0x1):(console[_0x34da58(0x10b)](a19_0x400e51[_0x34da58(0xef)](_0x34da58(0xf6)+_0x375385[_0x34da58(0x101)]+_0x34da58(0xe5))),_0x375385[_0x34da58(0x107)]>0x0&&console[_0x34da58(0x10b)](a19_0x400e51[_0x34da58(0x110)](_0x375385[_0x34da58(0x107)]+_0x34da58(0xf3))),_0x375385[_0x34da58(0xf2)]>0x0&&console[_0x34da58(0x10b)](a19_0x400e51[_0x34da58(0xe2)](_0x375385[_0x34da58(0xf2)]+_0x34da58(0x10e))),0x0);}}
1
+ const a19_0xdbeae7=a19_0x5a72;function a19_0x3341(){const _0x3d58b5=['log','Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','Error:\x20Directory\x20not\x20found:\x20','1688TAyRdX','\x20journey(s)\x20valid','journey:validate','\x20(skipped:\x20','description','relativePath','filter','error','\x20warning(s)','endsWith','4cPJoow','hasErrors','green','errors','168260WzduCz','file','targetDir','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','1209450jtiMTt','9wrhKPv','warningCount','execute','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','valid','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','verbose','cyan','.yml','11HoZcAm','length','Validate\x20journey\x20YAML\x20files','201754mElLpE','.yaml','journey','911615XYwArp','\x20warning(s)\x20found','\x20segment\x20file(s)\x20skipped','warnings','324714kmLMHj','\x20valid','validCount','\x20journey(s)\x20with\x20errors,\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20.\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20current\x20directory','skippedCount','3721438LLGLWh','\x20segment\x20file(s)\x20skipped)','red','helpText','yellow','message','\x20error(s)','invalidCount','errorCode','dim','16722yLfUdW','filePath'];a19_0x3341=function(){return _0x3d58b5;};return a19_0x3341();}(function(_0x497db6,_0x53d310){const _0x2bce4e=a19_0x5a72,_0x286fc9=_0x497db6();while(!![]){try{const _0x3e381d=parseInt(_0x2bce4e(0x1cf))/0x1+-parseInt(_0x2bce4e(0x1c8))/0x2*(parseInt(_0x2bce4e(0x1f7))/0x3)+parseInt(_0x2bce4e(0x1ee))/0x4*(parseInt(_0x2bce4e(0x1cb))/0x5)+parseInt(_0x2bce4e(0x1f6))/0x6+-parseInt(_0x2bce4e(0x1d5))/0x7+-parseInt(_0x2bce4e(0x1e4))/0x8*(-parseInt(_0x2bce4e(0x1df))/0x9)+parseInt(_0x2bce4e(0x1f2))/0xa*(parseInt(_0x2bce4e(0x200))/0xb);if(_0x3e381d===_0x53d310)break;else _0x286fc9['push'](_0x286fc9['shift']());}catch(_0x27bb5e){_0x286fc9['push'](_0x286fc9['shift']());}}}(a19_0x3341,0x4524b));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';function a19_0x5a72(_0x2cb3c0,_0xcdff90){_0x2cb3c0=_0x2cb3c0-0x1c7;const _0x33412f=a19_0x3341();let _0x5a72c6=_0x33412f[_0x2cb3c0];return _0x5a72c6;}import{existsSync}from'fs';import a19_0x45053a from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class JourneyValidateCommand extends BaseCommand{['name']=a19_0xdbeae7(0x1e6);[a19_0xdbeae7(0x1e8)]=a19_0xdbeae7(0x1c7);async[a19_0xdbeae7(0x1f9)](_0x3618a0){const _0x1bf17c=a19_0xdbeae7,{options:_0x75d1db,args:_0x1cb41b}=_0x3618a0,_0x35338f=_0x75d1db,_0x467f36=await resolveTarget({'arg':_0x1cb41b[0x0],'contextParent':_0x75d1db['parentSegment'],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x467f36))return _0x467f36[_0x1bf17c(0x1dd)]==='no_parent'?(console[_0x1bf17c(0x1eb)](a19_0x45053a[_0x1bf17c(0x1d9)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x1bf17c(0x1eb)](_0x1bf17c(0x1e2)),console[_0x1bf17c(0x1eb)](_0x1bf17c(0x1d3)),console['error'](_0x1bf17c(0x1fc))):(console[_0x1bf17c(0x1eb)](a19_0x45053a[_0x1bf17c(0x1d7)]('Error:\x20'+_0x467f36[_0x1bf17c(0x1da)]+'\x0a')),_0x467f36[_0x1bf17c(0x1d8)]&&console[_0x1bf17c(0x1eb)](a19_0x45053a[_0x1bf17c(0x1fe)](_0x467f36['helpText']))),0x1;const _0x58241f=_0x467f36[_0x1bf17c(0x1f4)],_0x1749af=_0x467f36['type']===_0x1bf17c(0x1f3)?_0x467f36[_0x1bf17c(0x1e0)]:undefined;if(!_0x1749af&&!existsSync(_0x58241f))return console['error'](a19_0x45053a[_0x1bf17c(0x1d7)](_0x1bf17c(0x1e3)+_0x58241f+'\x0a')),0x1;let _0x4fb410;if(_0x1749af){if(!_0x1749af[_0x1bf17c(0x1ed)](_0x1bf17c(0x1ff))&&!_0x1749af[_0x1bf17c(0x1ed)](_0x1bf17c(0x1c9)))return console[_0x1bf17c(0x1eb)](a19_0x45053a[_0x1bf17c(0x1d7)](_0x1bf17c(0x1fa)+_0x1749af+'\x0a')),0x1;_0x4fb410=[_0x1749af];}else _0x4fb410=findYamlFiles(_0x58241f);if(_0x4fb410[_0x1bf17c(0x201)]===0x0)return console[_0x1bf17c(0x1eb)](a19_0x45053a[_0x1bf17c(0x1d7)](_0x1bf17c(0x1f5)+_0x58241f+'\x0a')),0x1;const _0x55c0c0=validateYamlFiles(_0x4fb410,_0x58241f,{'filterType':_0x1bf17c(0x1ca)}),_0x2ab86b=calculateSummary(_0x55c0c0),_0x568455=_0x55c0c0[_0x1bf17c(0x1ea)](isValidationResult);if(_0x568455[_0x1bf17c(0x201)]===0x0)return console[_0x1bf17c(0x1eb)](a19_0x45053a['yellow']('No\x20journey\x20YAML\x20files\x20found\x20in\x20'+_0x58241f+'\x0a')),_0x2ab86b[_0x1bf17c(0x1d4)]>0x0&&console[_0x1bf17c(0x1eb)](a19_0x45053a[_0x1bf17c(0x1de)]('('+_0x2ab86b['skippedCount']+_0x1bf17c(0x1d6))),0x0;for(const _0x39d51f of _0x55c0c0){if(!isValidationResult(_0x39d51f)){_0x35338f['verbose']&&console['log'](a19_0x45053a[_0x1bf17c(0x1de)]('-\x20'+_0x39d51f[_0x1bf17c(0x1e9)]+_0x1bf17c(0x1e7)+_0x39d51f['reason']+')'));continue;}const {relativePath:_0x56e001,source:_0x47e6d0,result:_0xb82fb5}=_0x39d51f;if(_0xb82fb5[_0x1bf17c(0x1fb)]&&_0xb82fb5['warnings'][_0x1bf17c(0x201)]===0x0)_0x35338f[_0x1bf17c(0x1fd)]&&console['log'](a19_0x45053a['green']('✔\x20'+_0x56e001));else _0xb82fb5[_0x1bf17c(0x1fb)]?(console[_0x1bf17c(0x1e1)](a19_0x45053a[_0x1bf17c(0x1d9)]('⚠\x20'+_0x56e001+':\x20'+_0xb82fb5[_0x1bf17c(0x1ce)][_0x1bf17c(0x201)]+_0x1bf17c(0x1ec))),console[_0x1bf17c(0x1e1)](formatValidationResult(_0xb82fb5,_0x47e6d0,_0x56e001))):(console[_0x1bf17c(0x1e1)](a19_0x45053a['red']('✖\x20'+_0x56e001+':\x20'+_0xb82fb5[_0x1bf17c(0x1f1)][_0x1bf17c(0x201)]+_0x1bf17c(0x1db))),console[_0x1bf17c(0x1e1)](formatValidationResult(_0xb82fb5,_0x47e6d0,_0x56e001)));}return console[_0x1bf17c(0x1e1)](''),_0x2ab86b[_0x1bf17c(0x1ef)]?(console[_0x1bf17c(0x1e1)](a19_0x45053a[_0x1bf17c(0x1d7)]('Validation\x20failed:\x20'+_0x2ab86b[_0x1bf17c(0x1dc)]+_0x1bf17c(0x1d2)+_0x2ab86b['validCount']+_0x1bf17c(0x1d0))),_0x2ab86b[_0x1bf17c(0x1f8)]>0x0&&console[_0x1bf17c(0x1e1)](a19_0x45053a[_0x1bf17c(0x1d9)](_0x2ab86b[_0x1bf17c(0x1f8)]+_0x1bf17c(0x1cc))),_0x2ab86b[_0x1bf17c(0x1d4)]>0x0&&console[_0x1bf17c(0x1e1)](a19_0x45053a[_0x1bf17c(0x1de)](_0x2ab86b[_0x1bf17c(0x1d4)]+_0x1bf17c(0x1cd))),0x1):(console[_0x1bf17c(0x1e1)](a19_0x45053a[_0x1bf17c(0x1f0)]('✔\x20All\x20'+_0x2ab86b[_0x1bf17c(0x1d1)]+_0x1bf17c(0x1e5))),_0x2ab86b['warningCount']>0x0&&console[_0x1bf17c(0x1e1)](a19_0x45053a[_0x1bf17c(0x1d9)](_0x2ab86b[_0x1bf17c(0x1f8)]+'\x20warning(s)\x20found')),_0x2ab86b[_0x1bf17c(0x1d4)]>0x0&&console[_0x1bf17c(0x1e1)](a19_0x45053a['dim'](_0x2ab86b[_0x1bf17c(0x1d4)]+_0x1bf17c(0x1cd))),0x0);}}