@treasuredata/tdx 2026.3.46 → 2026.3.47

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 (242) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/auth-login-command.js +1 -1
  11. package/dist/commands/cas-command.js +1 -1
  12. package/dist/commands/cas-segment-command.js +1 -1
  13. package/dist/commands/chat-command.js +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-statusline-command.js +1 -1
  16. package/dist/commands/claude-usage-command.js +1 -1
  17. package/dist/commands/command.js +1 -1
  18. package/dist/commands/connection-command.js +1 -1
  19. package/dist/commands/databases.js +1 -1
  20. package/dist/commands/delivery-command.js +1 -1
  21. package/dist/commands/describe.js +1 -1
  22. package/dist/commands/engage-campaign-pull-command.js +1 -1
  23. package/dist/commands/engage-campaign-push-command.js +1 -1
  24. package/dist/commands/engage-campaign-validate-command.js +1 -1
  25. package/dist/commands/engage-command.js +1 -1
  26. package/dist/commands/engage-template-pull-command.js +1 -1
  27. package/dist/commands/engage-template-push-command.js +1 -1
  28. package/dist/commands/engage-template-validate-command.js +1 -1
  29. package/dist/commands/job-command.js +1 -1
  30. package/dist/commands/journey-command.js +1 -1
  31. package/dist/commands/journey-validate-command.js +1 -1
  32. package/dist/commands/llm-command.js +1 -1
  33. package/dist/commands/mcp-command.js +1 -1
  34. package/dist/commands/parent-segment-command.js +1 -1
  35. package/dist/commands/policy-command.js +1 -1
  36. package/dist/commands/profile-command.js +1 -1
  37. package/dist/commands/profiles-command.js +1 -1
  38. package/dist/commands/query-command.js +1 -1
  39. package/dist/commands/schedule-command.js +1 -1
  40. package/dist/commands/segment-command.js +1 -1
  41. package/dist/commands/segment-create-command.js +1 -1
  42. package/dist/commands/segment-fields-command.js +1 -1
  43. package/dist/commands/segment-pull-command.js +1 -1
  44. package/dist/commands/segment-push-command.js +1 -1
  45. package/dist/commands/segment-update-command.js +1 -1
  46. package/dist/commands/segment-use-command.js +1 -1
  47. package/dist/commands/segment-validate-command.js +1 -1
  48. package/dist/commands/segments.js +1 -1
  49. package/dist/commands/show.js +1 -1
  50. package/dist/commands/status-command.js +1 -1
  51. package/dist/commands/tables.js +1 -1
  52. package/dist/commands/unset-command.js +1 -1
  53. package/dist/commands/upgrade-command.js +1 -1
  54. package/dist/commands/use-command.js +1 -1
  55. package/dist/commands/user-command.js +1 -1
  56. package/dist/commands/work-command.js +1 -1
  57. package/dist/commands/workflow-command.js +1 -1
  58. package/dist/core/auth.js +1 -1
  59. package/dist/core/command-output.js +1 -1
  60. package/dist/core/config.js +1 -1
  61. package/dist/core/connection-cache.js +1 -1
  62. package/dist/core/constants.js +1 -1
  63. package/dist/core/credential-cache.js +1 -1
  64. package/dist/core/global-context.js +1 -1
  65. package/dist/core/keychain.js +1 -1
  66. package/dist/core/oauth-keychain.js +1 -1
  67. package/dist/core/oauth.js +1 -1
  68. package/dist/core/profile.js +1 -1
  69. package/dist/core/project-config.js +1 -1
  70. package/dist/core/session.js +1 -1
  71. package/dist/core/user-cache.js +1 -1
  72. package/dist/core/version.js +1 -1
  73. package/dist/index.js +1 -1
  74. package/dist/mcp/server.js +1 -1
  75. package/dist/mcp/tools/index.js +1 -1
  76. package/dist/mcp/tools/tdx-run.js +1 -1
  77. package/dist/mcp/tools/tdx-search.js +1 -1
  78. package/dist/mcp/utils.js +1 -1
  79. package/dist/proxy/claude-usage-tracker.js +1 -1
  80. package/dist/proxy/passthrough-server.js +1 -1
  81. package/dist/proxy/sse-usage-parser.js +1 -1
  82. package/dist/sdk/agent/agent-config.js +1 -1
  83. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  84. package/dist/sdk/agent/agent-yaml.js +1 -1
  85. package/dist/sdk/agent/test/evaluator.js +1 -1
  86. package/dist/sdk/agent/test/executor.js +1 -1
  87. package/dist/sdk/agent/test/index.js +1 -1
  88. package/dist/sdk/agent/test/output.js +1 -1
  89. package/dist/sdk/agent/test/parser.js +1 -1
  90. package/dist/sdk/agent/tool-target-registry.js +1 -1
  91. package/dist/sdk/api.js +1 -1
  92. package/dist/sdk/cas/cas-api-client.js +1 -1
  93. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  94. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  95. package/dist/sdk/cas/index.js +1 -1
  96. package/dist/sdk/cas/pull-workflow.js +1 -1
  97. package/dist/sdk/cas/push-workflow.js +1 -1
  98. package/dist/sdk/client/cdp-api-client.js +1 -1
  99. package/dist/sdk/client/delivery-api-client.js +1 -1
  100. package/dist/sdk/client/endpoints.js +1 -1
  101. package/dist/sdk/client/engage-api-client.js +1 -1
  102. package/dist/sdk/client/http-client.js +1 -1
  103. package/dist/sdk/client/llm-api-client.js +1 -1
  104. package/dist/sdk/client/oauth-refresh.js +1 -1
  105. package/dist/sdk/client/rate-limiter.js +1 -1
  106. package/dist/sdk/client/td-api-client.js +1 -1
  107. package/dist/sdk/client/trino-api-client.js +1 -1
  108. package/dist/sdk/client/workflow-client.js +1 -1
  109. package/dist/sdk/connection-validator.js +1 -1
  110. package/dist/sdk/connection.js +1 -1
  111. package/dist/sdk/delivery.js +1 -1
  112. package/dist/sdk/engage/campaign-pull.js +1 -1
  113. package/dist/sdk/engage/campaign-push.js +1 -1
  114. package/dist/sdk/engage/campaign-validator.js +1 -1
  115. package/dist/sdk/engage/campaign-yaml.js +1 -1
  116. package/dist/sdk/engage/template-pull.js +1 -1
  117. package/dist/sdk/engage/template-push.js +1 -1
  118. package/dist/sdk/engage/template-validator.js +1 -1
  119. package/dist/sdk/engage/template-yaml.js +1 -1
  120. package/dist/sdk/engage/types/campaign-def.js +1 -1
  121. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  122. package/dist/sdk/engage/types/template-schema.js +1 -1
  123. package/dist/sdk/engage.js +1 -1
  124. package/dist/sdk/errors.js +1 -1
  125. package/dist/sdk/index.js +1 -1
  126. package/dist/sdk/io/index.js +1 -1
  127. package/dist/sdk/io/node-filesystem.js +1 -1
  128. package/dist/sdk/job.js +1 -1
  129. package/dist/sdk/journey.js +1 -1
  130. package/dist/sdk/llm/chat-cache.js +1 -1
  131. package/dist/sdk/llm/index.js +1 -1
  132. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  133. package/dist/sdk/llm/model-factors.js +1 -1
  134. package/dist/sdk/personalization.js +1 -1
  135. package/dist/sdk/policy.js +1 -1
  136. package/dist/sdk/query/index.js +1 -1
  137. package/dist/sdk/query/sql-parser.js +1 -1
  138. package/dist/sdk/realtime.js +1 -1
  139. package/dist/sdk/schedule.js +1 -1
  140. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  141. package/dist/sdk/segment/fields-display.js +1 -1
  142. package/dist/sdk/segment/file-discovery.js +1 -1
  143. package/dist/sdk/segment/journey-utils.js +1 -1
  144. package/dist/sdk/segment/journey-validator.js +1 -1
  145. package/dist/sdk/segment/journey-yaml.js +1 -1
  146. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  147. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  148. package/dist/sdk/segment/pull-workflow.js +1 -1
  149. package/dist/sdk/segment/push-recovery.js +1 -1
  150. package/dist/sdk/segment/push-workflow.js +1 -1
  151. package/dist/sdk/segment/resolution-context.js +1 -1
  152. package/dist/sdk/segment/segment-path-parser.js +1 -1
  153. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  154. package/dist/sdk/segment/segment-validator.js +1 -1
  155. package/dist/sdk/segment/target-resolution.js +1 -1
  156. package/dist/sdk/segment/tdx-config.js +1 -1
  157. package/dist/sdk/segment/types/activation-schema.js +1 -1
  158. package/dist/sdk/segment/types/journey-def.js +1 -1
  159. package/dist/sdk/segment/types/journey-schema.js +1 -1
  160. package/dist/sdk/segment/types/segment-def.js +1 -1
  161. package/dist/sdk/segment/types/segment-schema.js +1 -1
  162. package/dist/sdk/segment/validate-files.js +1 -1
  163. package/dist/sdk/segment/yaml-validator.js +1 -1
  164. package/dist/sdk/segment.js +1 -1
  165. package/dist/sdk/types/index.js +1 -1
  166. package/dist/sdk/types/progress.js +1 -1
  167. package/dist/sdk/types/workspace.js +1 -1
  168. package/dist/sdk/user.js +1 -1
  169. package/dist/sdk/util/format-detector.js +1 -1
  170. package/dist/sdk/util/formatters.js +1 -1
  171. package/dist/sdk/util/index.js +1 -1
  172. package/dist/sdk/util/paginate.js +1 -1
  173. package/dist/sdk/util/tree-formatter.js +1 -1
  174. package/dist/sdk/workflow/archive-validation.js +1 -1
  175. package/dist/sdk/workflow/clone-workflow.js +1 -1
  176. package/dist/sdk/workflow/index.js +1 -1
  177. package/dist/sdk/workflow/pull-workflow.js +1 -1
  178. package/dist/sdk/workflow/push-workflow.js +1 -1
  179. package/dist/sdk/workflow/tdx-config.js +1 -1
  180. package/dist/sdk/workflow/workflow-utils.js +1 -1
  181. package/dist/sdk/workspace/builtin-schedules/builtin-schedules/execute-items/TASK.md +62 -0
  182. package/dist/sdk/workspace/builtin-schedules/builtin-schedules/execute-items/schedule.yaml +20 -0
  183. package/dist/sdk/workspace/builtin-schedules/builtin-schedules/item-triage/TASK.md +106 -0
  184. package/dist/sdk/workspace/builtin-schedules/builtin-schedules/item-triage/schedule.yaml +18 -0
  185. package/dist/sdk/workspace/builtin-schedules/builtin-schedules/stale-item-cleanup/TASK.md +26 -0
  186. package/dist/sdk/workspace/builtin-schedules/builtin-schedules/stale-item-cleanup/schedule.yaml +15 -0
  187. package/dist/sdk/workspace/builtin-schedules/builtin-schedules/synthesize-knowledge/TASK.md +26 -0
  188. package/dist/sdk/workspace/builtin-schedules/builtin-schedules/synthesize-knowledge/schedule.yaml +16 -0
  189. package/dist/sdk/workspace/builtin-schedules/builtin-schedules/weekly-review/TASK.md +21 -0
  190. package/dist/sdk/workspace/builtin-schedules/builtin-schedules/weekly-review/schedule.yaml +14 -0
  191. package/dist/sdk/workspace/builtin-schedules/execute-items/TASK.md +62 -0
  192. package/dist/sdk/workspace/builtin-schedules/execute-items/schedule.yaml +20 -0
  193. package/dist/sdk/workspace/builtin-schedules/item-triage/TASK.md +106 -0
  194. package/dist/sdk/workspace/builtin-schedules/item-triage/schedule.yaml +18 -0
  195. package/dist/sdk/workspace/builtin-schedules/stale-item-cleanup/TASK.md +26 -0
  196. package/dist/sdk/workspace/builtin-schedules/stale-item-cleanup/schedule.yaml +15 -0
  197. package/dist/sdk/workspace/builtin-schedules/synthesize-knowledge/TASK.md +26 -0
  198. package/dist/sdk/workspace/builtin-schedules/synthesize-knowledge/schedule.yaml +16 -0
  199. package/dist/sdk/workspace/builtin-schedules/weekly-review/TASK.md +21 -0
  200. package/dist/sdk/workspace/builtin-schedules/weekly-review/schedule.yaml +14 -0
  201. package/dist/sdk/workspace/frontmatter.js +1 -1
  202. package/dist/sdk/workspace/git.js +1 -1
  203. package/dist/sdk/workspace/index.d.ts +5 -1
  204. package/dist/sdk/workspace/index.d.ts.map +1 -1
  205. package/dist/sdk/workspace/index.js +1 -1
  206. package/dist/sdk/workspace/index.js.map +1 -1
  207. package/dist/sdk/workspace/templates.js +1 -1
  208. package/dist/sdk/workspace/weekly.js +1 -1
  209. package/dist/sdk/workspace/wikilinks.js +1 -1
  210. package/dist/test-utils/command-runner.js +1 -1
  211. package/dist/test-utils/factories.js +1 -1
  212. package/dist/test-utils/fixtures.js +1 -1
  213. package/dist/test-utils/http-mock.js +1 -1
  214. package/dist/test-utils/index.js +1 -1
  215. package/dist/utils/async.js +1 -1
  216. package/dist/utils/colors.js +1 -1
  217. package/dist/utils/diff.js +1 -1
  218. package/dist/utils/file-permissions.js +1 -1
  219. package/dist/utils/file-reader.js +1 -1
  220. package/dist/utils/github-releases.js +1 -1
  221. package/dist/utils/global-cache.js +1 -1
  222. package/dist/utils/json-loader.js +1 -1
  223. package/dist/utils/local-cache.js +1 -1
  224. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  225. package/dist/utils/logger/formatters/index.js +1 -1
  226. package/dist/utils/logger/handlers/console-handler.js +1 -1
  227. package/dist/utils/logger/handlers/file-handler.js +1 -1
  228. package/dist/utils/logger/handlers/index.js +1 -1
  229. package/dist/utils/logger/handlers/null-handler.js +1 -1
  230. package/dist/utils/logger/index.js +1 -1
  231. package/dist/utils/logger/logger.js +1 -1
  232. package/dist/utils/logger/types.js +1 -1
  233. package/dist/utils/option-validation.js +1 -1
  234. package/dist/utils/process.js +1 -1
  235. package/dist/utils/prompt.js +1 -1
  236. package/dist/utils/spinner.js +1 -1
  237. package/dist/utils/sse-parser.js +1 -1
  238. package/dist/utils/string-utils.js +1 -1
  239. package/dist/utils/table-ref-parser.js +1 -1
  240. package/dist/utils/tdx-logger.js +1 -1
  241. package/dist/utils/version-check.js +1 -1
  242. package/package.json +2 -2
@@ -1 +1 @@
1
- function a26_0x4b11(_0x3ce488,_0x5790b2){_0x3ce488=_0x3ce488-0xba;const _0x9b18de=a26_0x9b18();let _0x4b11e3=_0x9b18de[_0x3ce488];return _0x4b11e3;}const a26_0x370aa0=a26_0x4b11;(function(_0x1160e3,_0xf4f349){const _0x517d5b=a26_0x4b11,_0x497db9=_0x1160e3();while(!![]){try{const _0x295610=parseInt(_0x517d5b(0xbd))/0x1+parseInt(_0x517d5b(0xe2))/0x2+-parseInt(_0x517d5b(0xe4))/0x3*(parseInt(_0x517d5b(0xc3))/0x4)+-parseInt(_0x517d5b(0xc5))/0x5+-parseInt(_0x517d5b(0xcd))/0x6*(-parseInt(_0x517d5b(0xdf))/0x7)+-parseInt(_0x517d5b(0xe5))/0x8+-parseInt(_0x517d5b(0xe1))/0x9*(-parseInt(_0x517d5b(0xc8))/0xa);if(_0x295610===_0xf4f349)break;else _0x497db9['push'](_0x497db9['shift']());}catch(_0x2ab796){_0x497db9['push'](_0x497db9['shift']());}}}(a26_0x9b18,0xba974));import{BaseCommand}from'./command.js';import{findYamlFiles,isYamlFile}from'../sdk/segment/file-discovery.js';function a26_0x9b18(){const _0x50364f=['validCount','valid','skippedCount','\x20template(s)\x20valid','dim','resolve','error','green','\x20(skipped:\x20','template','length','378ageEbU','engage:template:validate','532629FUMCtT','572070rCFVwm','yellow','3746055qChGvx','10160440SXvcHt','\x20warning(s)','\x20non-template\x20file(s)\x20skipped','errors','.yaml','138361RAtyIl','endsWith','warningCount','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','log','warnings','4INIFCt','invalidCount','5467150acqNVQ','dirname','Error:\x20Directory\x20not\x20found:\x20','520dsAGTs','.yml','\x20error(s)','Validate\x20template\x20YAML\x20files','\x20warning(s)\x20found','97182CXVIcC','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','name','\x20valid','red','✔\x20All\x20','No\x20template\x20YAML\x20files\x20found\x20in\x20'];a26_0x9b18=function(){return _0x50364f;};return a26_0x9b18();}import{existsSync}from'fs';import a26_0x4d046c from'chalk';import a26_0x1ef9d4 from'path';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class EngageTemplateValidateCommand extends BaseCommand{[a26_0x370aa0(0xcf)]=a26_0x370aa0(0xe0);['description']=a26_0x370aa0(0xcb);async['execute'](_0x113174){const _0x10174c=a26_0x370aa0,{options:_0x4090a2,args:_0x58dd8f}=_0x113174,_0x37a6e=_0x4090a2,_0x586b92=_0x58dd8f[0x0],_0xcab847=_0x586b92?a26_0x1ef9d4[_0x10174c(0xd9)](_0x586b92):undefined,_0x3c2cd4=_0xcab847?isYamlFile(_0xcab847):![];let _0x1a446e,_0x4ad424;if(_0x3c2cd4&&_0xcab847)_0x1a446e=a26_0x1ef9d4[_0x10174c(0xc6)](_0xcab847),_0x4ad424=_0xcab847;else _0xcab847?_0x1a446e=_0xcab847:_0x1a446e=process['cwd']();if(!_0x4ad424&&!existsSync(_0x1a446e))return console[_0x10174c(0xda)](a26_0x4d046c[_0x10174c(0xd1)](_0x10174c(0xc7)+_0x1a446e+'\x0a')),0x1;let _0x3df2db;if(_0x4ad424){if(!_0x4ad424[_0x10174c(0xbe)](_0x10174c(0xc9))&&!_0x4ad424[_0x10174c(0xbe)](_0x10174c(0xbc)))return console[_0x10174c(0xda)](a26_0x4d046c[_0x10174c(0xd1)](_0x10174c(0xc0)+_0x4ad424+'\x0a')),0x1;_0x3df2db=[_0x4ad424];}else _0x3df2db=findYamlFiles(_0x1a446e);if(_0x3df2db[_0x10174c(0xde)]===0x0)return console[_0x10174c(0xda)](a26_0x4d046c[_0x10174c(0xd1)](_0x10174c(0xce)+_0x1a446e+'\x0a')),0x1;const _0x35fafe=validateYamlFiles(_0x3df2db,_0x1a446e,{'filterType':_0x10174c(0xdd)}),_0x1ce51e=calculateSummary(_0x35fafe),_0x2209d0=_0x35fafe['filter'](isValidationResult);if(_0x2209d0['length']===0x0)return console['error'](a26_0x4d046c[_0x10174c(0xe3)](_0x10174c(0xd3)+_0x1a446e+'\x0a')),_0x1ce51e[_0x10174c(0xd6)]>0x0&&console[_0x10174c(0xda)](a26_0x4d046c[_0x10174c(0xd8)]('('+_0x1ce51e['skippedCount']+'\x20non-template\x20file(s)\x20skipped)')),0x0;for(const _0x548b3a of _0x35fafe){if(!isValidationResult(_0x548b3a)){_0x37a6e['verbose']&&console['log'](a26_0x4d046c[_0x10174c(0xd8)]('-\x20'+_0x548b3a['relativePath']+_0x10174c(0xdc)+_0x548b3a['reason']+')'));continue;}const {relativePath:_0x2a4891,source:_0x1b0803,result:_0x5898a4}=_0x548b3a;if(_0x5898a4[_0x10174c(0xd5)]&&_0x5898a4[_0x10174c(0xc2)][_0x10174c(0xde)]===0x0)_0x37a6e['verbose']&&console['log'](a26_0x4d046c[_0x10174c(0xdb)]('✔\x20'+_0x2a4891));else _0x5898a4[_0x10174c(0xd5)]?(console[_0x10174c(0xc1)](a26_0x4d046c['yellow']('⚠\x20'+_0x2a4891+':\x20'+_0x5898a4[_0x10174c(0xc2)][_0x10174c(0xde)]+_0x10174c(0xe6))),console['log'](formatValidationResult(_0x5898a4,_0x1b0803,_0x2a4891))):(console['log'](a26_0x4d046c[_0x10174c(0xd1)]('✖\x20'+_0x2a4891+':\x20'+_0x5898a4[_0x10174c(0xbb)]['length']+_0x10174c(0xca))),console[_0x10174c(0xc1)](formatValidationResult(_0x5898a4,_0x1b0803,_0x2a4891)));}return console['log'](''),_0x1ce51e['hasErrors']?(console[_0x10174c(0xc1)](a26_0x4d046c['red']('Validation\x20failed:\x20'+_0x1ce51e[_0x10174c(0xc4)]+'\x20template(s)\x20with\x20errors,\x20'+_0x1ce51e[_0x10174c(0xd4)]+_0x10174c(0xd0))),_0x1ce51e[_0x10174c(0xbf)]>0x0&&console[_0x10174c(0xc1)](a26_0x4d046c[_0x10174c(0xe3)](_0x1ce51e[_0x10174c(0xbf)]+'\x20warning(s)\x20found')),_0x1ce51e[_0x10174c(0xd6)]>0x0&&console[_0x10174c(0xc1)](a26_0x4d046c['dim'](_0x1ce51e[_0x10174c(0xd6)]+_0x10174c(0xba))),0x1):(console[_0x10174c(0xc1)](a26_0x4d046c['green'](_0x10174c(0xd2)+_0x1ce51e[_0x10174c(0xd4)]+_0x10174c(0xd7))),_0x1ce51e[_0x10174c(0xbf)]>0x0&&console['log'](a26_0x4d046c[_0x10174c(0xe3)](_0x1ce51e['warningCount']+_0x10174c(0xcc))),_0x1ce51e[_0x10174c(0xd6)]>0x0&&console[_0x10174c(0xc1)](a26_0x4d046c[_0x10174c(0xd8)](_0x1ce51e['skippedCount']+_0x10174c(0xba))),0x0);}}
1
+ const a26_0x1a4b8e=a26_0x32b3;(function(_0x12399d,_0x2356fe){const _0x49763e=a26_0x32b3,_0xdba1aa=_0x12399d();while(!![]){try{const _0x14f279=-parseInt(_0x49763e(0x14b))/0x1+-parseInt(_0x49763e(0x13f))/0x2*(-parseInt(_0x49763e(0x137))/0x3)+-parseInt(_0x49763e(0x144))/0x4+-parseInt(_0x49763e(0x135))/0x5+parseInt(_0x49763e(0x14c))/0x6+-parseInt(_0x49763e(0x129))/0x7*(parseInt(_0x49763e(0x13c))/0x8)+parseInt(_0x49763e(0x152))/0x9;if(_0x14f279===_0x2356fe)break;else _0xdba1aa['push'](_0xdba1aa['shift']());}catch(_0x1b9890){_0xdba1aa['push'](_0xdba1aa['shift']());}}}(a26_0x472c,0xbaaa3));function a26_0x472c(){const _0x3dcf44=['1068438QZyqwJ','5798358yfFwEl','validCount','filter','resolve','dim','verbose','11571426rwNgYU','.yml','yellow','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','dirname','\x20valid','763343opIsWL','relativePath','\x20template(s)\x20valid','error','name','Error:\x20Directory\x20not\x20found:\x20','red','\x20template(s)\x20with\x20errors,\x20','template','endsWith','\x20non-template\x20file(s)\x20skipped)','\x20non-template\x20file(s)\x20skipped','3217290ureexo','.yaml','342903AIZtAV','engage:template:validate','cwd','Validate\x20template\x20YAML\x20files','log','40vcIZlQ','warnings','green','22wYjhcj','No\x20template\x20YAML\x20files\x20found\x20in\x20','skippedCount','warningCount','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','1950792EnCKTY','valid','\x20error(s)','execute','reason','length','errors'];a26_0x472c=function(){return _0x3dcf44;};return a26_0x472c();}import{BaseCommand}from'./command.js';import{findYamlFiles,isYamlFile}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a26_0x126ac2 from'chalk';function a26_0x32b3(_0x38161,_0x107f67){_0x38161=_0x38161-0x128;const _0x472c31=a26_0x472c();let _0x32b3f5=_0x472c31[_0x38161];return _0x32b3f5;}import a26_0x594a8f from'path';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class EngageTemplateValidateCommand extends BaseCommand{[a26_0x1a4b8e(0x12d)]=a26_0x1a4b8e(0x138);['description']=a26_0x1a4b8e(0x13a);async[a26_0x1a4b8e(0x147)](_0x3e8c02){const _0x23a935=a26_0x1a4b8e,{options:_0x50731b,args:_0x59cff0}=_0x3e8c02,_0xa05a14=_0x50731b,_0x15a1e7=_0x59cff0[0x0],_0x2809a6=_0x15a1e7?a26_0x594a8f[_0x23a935(0x14f)](_0x15a1e7):undefined,_0x1cc6a1=_0x2809a6?isYamlFile(_0x2809a6):![];let _0x236cc4,_0x4408c8;if(_0x1cc6a1&&_0x2809a6)_0x236cc4=a26_0x594a8f[_0x23a935(0x156)](_0x2809a6),_0x4408c8=_0x2809a6;else _0x2809a6?_0x236cc4=_0x2809a6:_0x236cc4=process[_0x23a935(0x139)]();if(!_0x4408c8&&!existsSync(_0x236cc4))return console[_0x23a935(0x12c)](a26_0x126ac2['red'](_0x23a935(0x12e)+_0x236cc4+'\x0a')),0x1;let _0x2b75d5;if(_0x4408c8){if(!_0x4408c8[_0x23a935(0x132)](_0x23a935(0x153))&&!_0x4408c8[_0x23a935(0x132)](_0x23a935(0x136)))return console[_0x23a935(0x12c)](a26_0x126ac2['red'](_0x23a935(0x155)+_0x4408c8+'\x0a')),0x1;_0x2b75d5=[_0x4408c8];}else _0x2b75d5=findYamlFiles(_0x236cc4);if(_0x2b75d5[_0x23a935(0x149)]===0x0)return console['error'](a26_0x126ac2[_0x23a935(0x12f)](_0x23a935(0x143)+_0x236cc4+'\x0a')),0x1;const _0x50deef=validateYamlFiles(_0x2b75d5,_0x236cc4,{'filterType':_0x23a935(0x131)}),_0x4314a9=calculateSummary(_0x50deef),_0x5d0ffe=_0x50deef[_0x23a935(0x14e)](isValidationResult);if(_0x5d0ffe[_0x23a935(0x149)]===0x0)return console[_0x23a935(0x12c)](a26_0x126ac2['yellow'](_0x23a935(0x140)+_0x236cc4+'\x0a')),_0x4314a9['skippedCount']>0x0&&console['error'](a26_0x126ac2[_0x23a935(0x150)]('('+_0x4314a9[_0x23a935(0x141)]+_0x23a935(0x133))),0x0;for(const _0x35fef5 of _0x50deef){if(!isValidationResult(_0x35fef5)){_0xa05a14[_0x23a935(0x151)]&&console[_0x23a935(0x13b)](a26_0x126ac2['dim']('-\x20'+_0x35fef5[_0x23a935(0x12a)]+'\x20(skipped:\x20'+_0x35fef5[_0x23a935(0x148)]+')'));continue;}const {relativePath:_0x363414,source:_0x5c0ab7,result:_0x185407}=_0x35fef5;if(_0x185407[_0x23a935(0x145)]&&_0x185407[_0x23a935(0x13d)][_0x23a935(0x149)]===0x0)_0xa05a14[_0x23a935(0x151)]&&console[_0x23a935(0x13b)](a26_0x126ac2[_0x23a935(0x13e)]('✔\x20'+_0x363414));else _0x185407[_0x23a935(0x145)]?(console['log'](a26_0x126ac2['yellow']('⚠\x20'+_0x363414+':\x20'+_0x185407[_0x23a935(0x13d)][_0x23a935(0x149)]+'\x20warning(s)')),console[_0x23a935(0x13b)](formatValidationResult(_0x185407,_0x5c0ab7,_0x363414))):(console[_0x23a935(0x13b)](a26_0x126ac2['red']('✖\x20'+_0x363414+':\x20'+_0x185407[_0x23a935(0x14a)][_0x23a935(0x149)]+_0x23a935(0x146))),console[_0x23a935(0x13b)](formatValidationResult(_0x185407,_0x5c0ab7,_0x363414)));}return console[_0x23a935(0x13b)](''),_0x4314a9['hasErrors']?(console[_0x23a935(0x13b)](a26_0x126ac2['red']('Validation\x20failed:\x20'+_0x4314a9['invalidCount']+_0x23a935(0x130)+_0x4314a9['validCount']+_0x23a935(0x128))),_0x4314a9[_0x23a935(0x142)]>0x0&&console[_0x23a935(0x13b)](a26_0x126ac2[_0x23a935(0x154)](_0x4314a9['warningCount']+'\x20warning(s)\x20found')),_0x4314a9[_0x23a935(0x141)]>0x0&&console[_0x23a935(0x13b)](a26_0x126ac2[_0x23a935(0x150)](_0x4314a9[_0x23a935(0x141)]+_0x23a935(0x134))),0x1):(console[_0x23a935(0x13b)](a26_0x126ac2['green']('✔\x20All\x20'+_0x4314a9[_0x23a935(0x14d)]+_0x23a935(0x12b))),_0x4314a9['warningCount']>0x0&&console[_0x23a935(0x13b)](a26_0x126ac2[_0x23a935(0x154)](_0x4314a9[_0x23a935(0x142)]+'\x20warning(s)\x20found')),_0x4314a9['skippedCount']>0x0&&console[_0x23a935(0x13b)](a26_0x126ac2['dim'](_0x4314a9[_0x23a935(0x141)]+_0x23a935(0x134))),0x0);}}
@@ -1 +1 @@
1
- const a27_0x325a0c=a27_0xc226;(function(_0x2516f3,_0x4a431e){const _0x56b003=a27_0xc226,_0x3433c7=_0x2516f3();while(!![]){try{const _0x15b25a=parseInt(_0x56b003(0xa2))/0x1+parseInt(_0x56b003(0xa4))/0x2*(-parseInt(_0x56b003(0xdf))/0x3)+-parseInt(_0x56b003(0xdc))/0x4+parseInt(_0x56b003(0xb8))/0x5*(parseInt(_0x56b003(0xbd))/0x6)+-parseInt(_0x56b003(0xda))/0x7+parseInt(_0x56b003(0xd2))/0x8*(parseInt(_0x56b003(0xe1))/0x9)+-parseInt(_0x56b003(0xb6))/0xa;if(_0x15b25a===_0x4a431e)break;else _0x3433c7['push'](_0x3433c7['shift']());}catch(_0x98809b){_0x3433c7['push'](_0x3433c7['shift']());}}}(a27_0xf925,0x4f331));import{BaseCommand}from'./command.js';function a27_0xc226(_0x43f895,_0xc7bb1b){_0x43f895=_0x43f895-0x9e;const _0xf92556=a27_0xf925();let _0xc226e6=_0xf92556[_0x43f895];return _0xc226e6;}import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}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';import{getJobUrl}from'../sdk/client/endpoints.js';function a27_0xf925(){const _0x2f914b=['mo\x20ago','presto','222UOJCgU','Query\x20is\x20required\x0aUsage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','jobs','name','List\x20jobs','green','join','Show\x20job\x20details','trino','args','error','push','priority','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','length','Limit:\x20','Listing\x20jobs...','start_at','limit','Submit\x20a\x20job','884264mDpcDi','Get\x20job\x20results','end_at','execute','✔\x20Found\x20','description','--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','job_id','1003394lwLKjk','\x20\x20Job\x20ID:\x20','1764896lvhYrN','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20kill\x20<job-id>','show','3DUVmLJ','map','45wzqnWN','getTime','job:kill','query','dim','status','yes','round','type','Status\x20filter:\x20','hive','submit','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20result\x20<job-id>','red','file','log','user_name','Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','Getting\x20job\x20details...','✔\x20Retrieved\x20','just\x20now','h\x20ago','540005nIqiyi','✔\x20Job\x20submitted','616454KtxarY','Query:\x20','Kill\x20a\x20job','abs','data','Submitting\x20job...','success','debug','result','database','INVALID_ARGUMENT','Database:\x20','created_at','job:result','substring','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','Getting\x20job\x20results...','validate','3075250SctRcz','\x27\x20to\x20verify\x20the\x20job\x20status','58385Vlktag','verbose','floor'];a27_0xf925=function(){return _0x2f914b;};return a27_0xf925();}import{hyperlink}from'../sdk/util/formatters.js';import a27_0x37dbec from'chalk';function formatDuration(_0x2334f9){const _0x595d94=a27_0xc226;if(_0x2334f9<0x3c)return _0x2334f9+'s';if(_0x2334f9<0xe10)return Math[_0x595d94(0xba)](_0x2334f9/0x3c)+'m\x20'+_0x2334f9%0x3c+'s';const _0x7592a2=Math['floor'](_0x2334f9/0xe10),_0x4e1f76=Math['floor'](_0x2334f9%0xe10/0x3c);return _0x4e1f76>0x0?_0x7592a2+'h\x20'+_0x4e1f76+'m':_0x7592a2+'h';}function formatRelativeTime(_0x595907){const _0x9fd923=a27_0xc226,_0x3654bd=Date['now']()-_0x595907[_0x9fd923(0xe2)](),_0x43f578=Math[_0x9fd923(0xba)](Math[_0x9fd923(0xa7)](_0x3654bd)/0x3e8);if(_0x43f578<0x3c)return _0x9fd923(0xa0);const _0x143d78=Math[_0x9fd923(0xba)](_0x43f578/0x3c);if(_0x143d78<0x3c)return _0x143d78+'m\x20ago';const _0x5b96ad=Math[_0x9fd923(0xba)](_0x143d78/0x3c);if(_0x5b96ad<0x18)return _0x5b96ad+_0x9fd923(0xa1);const _0x2ccebe=Math[_0x9fd923(0xba)](_0x5b96ad/0x18);if(_0x2ccebe<0x1e)return _0x2ccebe+'d\x20ago';return Math['floor'](_0x2ccebe/0x1e)+_0x9fd923(0xbb);}export class JobListCommand extends BaseCommand{[a27_0x325a0c(0xc0)]=a27_0x325a0c(0xbf);[a27_0x325a0c(0xd7)]=a27_0x325a0c(0xc1);async[a27_0x325a0c(0xd5)](_0x256109){const _0x38f8bd=a27_0x325a0c,{options:_0x589090,tdx:_0x1076d1}=_0x256109,_0x3995b5=resolveLimit(_0x589090[_0x38f8bd(0xd0)],DEFAULT_DISPLAY_LIMIT),_0x28fc98=_0x589090[_0x38f8bd(0xe6)];_0x589090[_0x38f8bd(0xb9)]&&(console[_0x38f8bd(0xc7)](_0x38f8bd(0xcd)+_0x3995b5+'\x20jobs'),_0x28fc98&&console['error'](_0x38f8bd(0xea)+_0x28fc98));const _0x5a2732=await withSpinner(_0x38f8bd(0xce),()=>_0x1076d1[_0x38f8bd(0xbf)]['list']({'from':0x0,'to':_0x3995b5-0x1,'status':_0x28fc98}),{'verbose':_0x589090[_0x38f8bd(0xb9)]}),_0x3e35cc=_0x5a2732['data'];console['error'](_0x38f8bd(0xd6)+_0x3e35cc['length']+'\x20job'+(_0x3e35cc[_0x38f8bd(0xcc)]!==0x1?'s':''));const _0x408455=_0x589090['site'];if(isStructuredFormat(_0x589090)){const _0x3479cd=_0x3e35cc[_0x38f8bd(0xe0)](_0xa72a6b=>{const _0x5ca357=_0x38f8bd;let _0x54ce75;if(_0xa72a6b['start_at']&&_0xa72a6b[_0x5ca357(0xd4)]){const _0x1ef50a=new Date(_0xa72a6b[_0x5ca357(0xcf)])[_0x5ca357(0xe2)](),_0x55e928=new Date(_0xa72a6b[_0x5ca357(0xd4)])['getTime']();_0x54ce75=Math[_0x5ca357(0xe8)]((_0x55e928-_0x1ef50a)/0x3e8);}return{'job_id':_0xa72a6b[_0x5ca357(0xd9)],'type':_0xa72a6b['type']===_0x5ca357(0xbc)?_0x5ca357(0xc5):_0xa72a6b[_0x5ca357(0xe9)],'status':_0xa72a6b[_0x5ca357(0xe6)],'user_name':_0xa72a6b['user_name'],'duration_sec':_0x54ce75,'created_at':_0xa72a6b[_0x5ca357(0xb0)],'started_at':_0xa72a6b[_0x5ca357(0xcf)],'end_at':_0xa72a6b[_0x5ca357(0xd4)]};});await handleSDKOutput(_0x3479cd,_0x589090);}else for(const _0x1b0cde of _0x3e35cc){const _0x3b166f=_0x1b0cde[_0x38f8bd(0xe6)]===_0x38f8bd(0xaa)?a27_0x37dbec[_0x38f8bd(0xc2)]:_0x1b0cde[_0x38f8bd(0xe6)]===_0x38f8bd(0xc7)?a27_0x37dbec[_0x38f8bd(0xee)]:a27_0x37dbec[_0x38f8bd(0xe5)],_0xdd9059=_0x3b166f(_0x1b0cde[_0x38f8bd(0xe6)]),_0x597dec=getJobUrl(_0x408455,_0x1b0cde[_0x38f8bd(0xd9)]),_0x2df308=hyperlink(_0x1b0cde[_0x38f8bd(0xd9)],_0x597dec),_0x30dadb=a27_0x37dbec[_0x38f8bd(0xe5)](_0x1b0cde[_0x38f8bd(0xe9)]===_0x38f8bd(0xbc)?_0x38f8bd(0xc5):_0x1b0cde[_0x38f8bd(0xe9)]),_0x53dc2a=[];if(_0x1b0cde[_0x38f8bd(0xcf)]&&_0x1b0cde[_0x38f8bd(0xd4)]){const _0x522150=Math[_0x38f8bd(0xe8)]((new Date(_0x1b0cde[_0x38f8bd(0xd4)])[_0x38f8bd(0xe2)]()-new Date(_0x1b0cde[_0x38f8bd(0xcf)])[_0x38f8bd(0xe2)]())/0x3e8);_0x53dc2a[_0x38f8bd(0xc8)](formatDuration(_0x522150));}if(_0x1b0cde[_0x38f8bd(0xd4)])_0x53dc2a[_0x38f8bd(0xc8)](formatRelativeTime(new Date(_0x1b0cde[_0x38f8bd(0xd4)])));else _0x1b0cde[_0x38f8bd(0xcf)]&&_0x53dc2a[_0x38f8bd(0xc8)](formatRelativeTime(new Date(_0x1b0cde[_0x38f8bd(0xcf)])));const _0x568973=_0x53dc2a[_0x38f8bd(0xcc)]>0x0?a27_0x37dbec[_0x38f8bd(0xe5)]('\x20'+_0x53dc2a[_0x38f8bd(0xc3)](',\x20')):'';console[_0x38f8bd(0xf0)]('⚡\x20'+_0x2df308+'\x20'+_0x30dadb+'\x20'+_0xdd9059+_0x568973);}return 0x0;}}export class JobShowCommand extends BaseCommand{[a27_0x325a0c(0xc0)]='job:show';[a27_0x325a0c(0xd7)]=a27_0x325a0c(0xc4);[a27_0x325a0c(0xb5)](_0x568ba8){const _0x2963b6=a27_0x325a0c,_0x4bb5f2=_0x568ba8[_0x2963b6(0xc6)][0x0];if(!_0x4bb5f2)return'Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20show\x20<job-id>';return undefined;}async[a27_0x325a0c(0xd5)](_0x1ad955){const _0xa21b4d=a27_0x325a0c,{options:_0x43f958,args:_0x42b2cb,tdx:_0x3654ba}=_0x1ad955,_0x497baf=_0x42b2cb[0x0],_0x7731c=await withSpinner(_0xa21b4d(0x9e),()=>_0x3654ba['jobs'][_0xa21b4d(0xde)](_0x497baf),{'verbose':_0x43f958[_0xa21b4d(0xb9)]}),_0x3ba725=_0x7731c[_0xa21b4d(0xa8)];let _0x96516e;if(_0x3ba725[_0xa21b4d(0xcf)]&&_0x3ba725['end_at']){const _0x487487=new Date(_0x3ba725[_0xa21b4d(0xcf)])['getTime'](),_0x3cf328=new Date(_0x3ba725[_0xa21b4d(0xd4)])[_0xa21b4d(0xe2)]();_0x96516e=Math[_0xa21b4d(0xe8)]((_0x3cf328-_0x487487)/0x3e8);}const _0xb4cf86={'job_id':_0x3ba725[_0xa21b4d(0xd9)],'type':_0x3ba725['type'],'status':_0x3ba725[_0xa21b4d(0xe6)],..._0x3ba725[_0xa21b4d(0xf1)]&&{'user_name':_0x3ba725[_0xa21b4d(0xf1)]},..._0x96516e!==undefined&&{'duration_sec':_0x96516e},..._0x3ba725[_0xa21b4d(0xb0)]&&{'created_at':_0x3ba725[_0xa21b4d(0xb0)]},..._0x3ba725[_0xa21b4d(0xcf)]&&{'started_at':_0x3ba725[_0xa21b4d(0xcf)]},..._0x3ba725[_0xa21b4d(0xd4)]&&{'end_at':_0x3ba725[_0xa21b4d(0xd4)]},..._0x3ba725[_0xa21b4d(0xad)]&&{'database':_0x3ba725[_0xa21b4d(0xad)]},..._0x3ba725[_0xa21b4d(0xc9)]!==undefined&&{'priority':_0x3ba725[_0xa21b4d(0xc9)]},..._0x3ba725['url']&&{'url':_0x3ba725['url']},..._0x3ba725[_0xa21b4d(0xe4)]&&{'query':_0x3ba725[_0xa21b4d(0xe4)]},..._0x3ba725['debug']&&{'debug':_0x3ba725[_0xa21b4d(0xab)]}};return await handleSingleObjectOutput(_0xb4cf86,_0x43f958),0x0;}}export class JobKillCommand extends BaseCommand{[a27_0x325a0c(0xc0)]=a27_0x325a0c(0xe3);[a27_0x325a0c(0xd7)]=a27_0x325a0c(0xa6);['validate'](_0x2a5f2d){const _0x138d74=a27_0x325a0c,_0x38acff=_0x2a5f2d['args'][0x0];if(!_0x38acff)return _0x138d74(0xdd);return undefined;}async[a27_0x325a0c(0xd5)](_0x7516f){const _0x5f5c42=a27_0x325a0c,{options:_0x5ad702,args:_0x19f8d2,tdx:_0x4d0605}=_0x7516f,_0x8b3f97=_0x19f8d2[0x0];if(!_0x5ad702[_0x5f5c42(0xe7)]){const _0x2a05ec=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20'+_0x8b3f97+'?');if(!_0x2a05ec)return console[_0x5f5c42(0xc7)]('Cancelled'),0x0;}return await withSpinner('Submitting\x20kill\x20request...',()=>_0x4d0605[_0x5f5c42(0xbf)]['kill'](_0x8b3f97),{'verbose':_0x5ad702[_0x5f5c42(0xb9)]}),console['error'](_0x5f5c42(0xca)+_0x8b3f97),console[_0x5f5c42(0xc7)](_0x5f5c42(0xb3)+_0x8b3f97+_0x5f5c42(0xb7)),0x0;}}export class JobSubmitCommand extends BaseCommand{[a27_0x325a0c(0xc0)]='job:submit';[a27_0x325a0c(0xd7)]=a27_0x325a0c(0xd1);async[a27_0x325a0c(0xd5)](_0x3c7800){const _0x4bbac1=a27_0x325a0c,{options:_0x309cc,args:_0x1b7861,tdx:_0x26b470}=_0x3c7800,_0x149fbc=_0x309cc['jobType']||'trino',_0x113c2c=_0x309cc[_0x4bbac1(0xef)],_0x4d0a60=_0x309cc[_0x4bbac1(0xad)]||'information_schema',_0x3fea05=_0x309cc['result'];if(_0x149fbc!=='trino'&&_0x149fbc!==_0x4bbac1(0xeb))throw new SDKError(ErrorCode[_0x4bbac1(0xae)],_0x4bbac1(0xd8));let _0x47f419;if(_0x113c2c){if(_0x1b7861[0x0])throw new SDKError(ErrorCode[_0x4bbac1(0xae)],_0x4bbac1(0xcb));const _0x178937=readSqlStatementsFromFile(_0x113c2c);if(_0x178937[_0x4bbac1(0xcc)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'No\x20SQL\x20statements\x20found\x20in\x20file');if(_0x178937[_0x4bbac1(0xcc)]>0x1)throw new SDKError(ErrorCode[_0x4bbac1(0xae)],_0x4bbac1(0xf2));_0x47f419=_0x178937[0x0];}else{if(!_0x1b7861[0x0])throw new SDKError(ErrorCode[_0x4bbac1(0xae)],_0x4bbac1(0xbe));_0x47f419=_0x1b7861[0x0];}_0x309cc[_0x4bbac1(0xb9)]&&(console[_0x4bbac1(0xc7)]('Job\x20type:\x20'+_0x149fbc),console[_0x4bbac1(0xc7)](_0x4bbac1(0xaf)+_0x4d0a60),console[_0x4bbac1(0xc7)](_0x4bbac1(0xa5)+_0x47f419[_0x4bbac1(0xb2)](0x0,0x64)+(_0x47f419['length']>0x64?'...':'')));const _0x4c32d3=await withSpinner(_0x4bbac1(0xa9),()=>_0x26b470['jobs'][_0x4bbac1(0xec)](_0x4d0a60,_0x47f419,_0x149fbc,_0x3fea05),{'verbose':_0x309cc[_0x4bbac1(0xb9)]}),_0xec0718=_0x4c32d3[_0x4bbac1(0xa8)];return console[_0x4bbac1(0xc7)](_0x4bbac1(0xa3)),console[_0x4bbac1(0xc7)](_0x4bbac1(0xdb)+_0xec0718[_0x4bbac1(0xd9)]),await handleSDKOutput([_0xec0718],_0x309cc),0x0;}}export class JobResultCommand extends BaseCommand{[a27_0x325a0c(0xc0)]=a27_0x325a0c(0xb1);['description']=a27_0x325a0c(0xd3);[a27_0x325a0c(0xb5)](_0x5472bf){const _0x1f62bc=a27_0x325a0c,_0x2992dd=_0x5472bf[_0x1f62bc(0xc6)][0x0];if(!_0x2992dd)return _0x1f62bc(0xed);return undefined;}async[a27_0x325a0c(0xd5)](_0x57713c){const _0x3bafa1=a27_0x325a0c,{options:_0x5d1ca0,args:_0x163fc9,tdx:_0x3a7193}=_0x57713c,_0x3f805b=_0x163fc9[0x0],_0x2d0fdf=await withSpinner(_0x3bafa1(0xb4),()=>_0x3a7193[_0x3bafa1(0xbf)][_0x3bafa1(0xac)](_0x3f805b),{'verbose':_0x5d1ca0[_0x3bafa1(0xb9)]}),_0x2d658b=_0x2d0fdf[_0x3bafa1(0xa8)];return console['error'](_0x3bafa1(0x9f)+_0x2d658b[_0x3bafa1(0xcc)]+'\x20row'+(_0x2d658b[_0x3bafa1(0xcc)]!==0x1?'s':'')),await handleSDKOutput(_0x2d658b,_0x5d1ca0),0x0;}}
1
+ const a27_0x28e51a=a27_0x41b2;(function(_0x238940,_0x34a160){const _0x247fdf=a27_0x41b2,_0x45f4ef=_0x238940();while(!![]){try{const _0x538ea2=-parseInt(_0x247fdf(0x218))/0x1+parseInt(_0x247fdf(0x1d6))/0x2*(parseInt(_0x247fdf(0x213))/0x3)+parseInt(_0x247fdf(0x1de))/0x4*(parseInt(_0x247fdf(0x217))/0x5)+parseInt(_0x247fdf(0x203))/0x6*(-parseInt(_0x247fdf(0x21a))/0x7)+-parseInt(_0x247fdf(0x1d5))/0x8+-parseInt(_0x247fdf(0x1cb))/0x9*(parseInt(_0x247fdf(0x1db))/0xa)+-parseInt(_0x247fdf(0x1e9))/0xb*(-parseInt(_0x247fdf(0x210))/0xc);if(_0x538ea2===_0x34a160)break;else _0x45f4ef['push'](_0x45f4ef['shift']());}catch(_0x54aa03){_0x45f4ef['push'](_0x45f4ef['shift']());}}}(a27_0x1583,0xbe90b));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}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';function a27_0x1583(){const _0x276253=['error','just\x20now','Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','floor','m\x20ago','job:submit','--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','Show\x20job\x20details','462306EirCth','end_at','user_name','No\x20SQL\x20statements\x20found\x20in\x20file','type','round','result','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20result\x20<job-id>','status','presto','substring','validate','length','1560sJRAJa','✔\x20Found\x20','args','11031Cajdjx','\x27\x20to\x20verify\x20the\x20job\x20status','\x20job','\x20jobs','32735QsDTZD','1382287iGBBks','submit','133FBcufz','name','url','...','\x20\x20Job\x20ID:\x20','list','dim','job_id','Database:\x20','description','yes','9414zYIexZ','kill','start_at','created_at','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','Status\x20filter:\x20','Submit\x20a\x20job','Getting\x20job\x20details...','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20kill\x20<job-id>','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','5371040pajOal','44ehwzsc','data','success','verbose','Get\x20job\x20results','1060rLQOMQ','debug','trino','516bZdnxV','jobs','information_schema','getTime','join','map','Job\x20type:\x20','Getting\x20job\x20results...','Listing\x20jobs...','Limit:\x20','Cancelled','294767qLubYJ','show','Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','push','priority','database','Query:\x20','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20show\x20<job-id>','List\x20jobs','green','INVALID_ARGUMENT','✔\x20Job\x20submitted','Query\x20is\x20required\x0aUsage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','query','✔\x20Retrieved\x20','now','abs','execute'];a27_0x1583=function(){return _0x276253;};return a27_0x1583();}import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getJobUrl}from'../sdk/client/endpoints.js';function a27_0x41b2(_0xac060e,_0x46b057){_0xac060e=_0xac060e-0x1c7;const _0x158322=a27_0x1583();let _0x41b27a=_0x158322[_0xac060e];return _0x41b27a;}import{hyperlink}from'../sdk/util/formatters.js';import a27_0x733393 from'chalk';function formatDuration(_0x21f108){const _0x57306c=a27_0x41b2;if(_0x21f108<0x3c)return _0x21f108+'s';if(_0x21f108<0xe10)return Math[_0x57306c(0x1fe)](_0x21f108/0x3c)+'m\x20'+_0x21f108%0x3c+'s';const _0x2190a4=Math[_0x57306c(0x1fe)](_0x21f108/0xe10),_0x841919=Math['floor'](_0x21f108%0xe10/0x3c);return _0x841919>0x0?_0x2190a4+'h\x20'+_0x841919+'m':_0x2190a4+'h';}function formatRelativeTime(_0x4a229f){const _0x5bb9a4=a27_0x41b2,_0x4dcb40=Date[_0x5bb9a4(0x1f8)]()-_0x4a229f[_0x5bb9a4(0x1e1)](),_0x54f7db=Math['floor'](Math[_0x5bb9a4(0x1f9)](_0x4dcb40)/0x3e8);if(_0x54f7db<0x3c)return _0x5bb9a4(0x1fc);const _0x4e0878=Math[_0x5bb9a4(0x1fe)](_0x54f7db/0x3c);if(_0x4e0878<0x3c)return _0x4e0878+_0x5bb9a4(0x1ff);const _0x2c29ad=Math[_0x5bb9a4(0x1fe)](_0x4e0878/0x3c);if(_0x2c29ad<0x18)return _0x2c29ad+'h\x20ago';const _0x387b59=Math[_0x5bb9a4(0x1fe)](_0x2c29ad/0x18);if(_0x387b59<0x1e)return _0x387b59+'d\x20ago';return Math[_0x5bb9a4(0x1fe)](_0x387b59/0x1e)+'mo\x20ago';}export class JobListCommand extends BaseCommand{[a27_0x28e51a(0x21b)]='jobs';[a27_0x28e51a(0x1c9)]=a27_0x28e51a(0x1f1);async[a27_0x28e51a(0x1fa)](_0x8493ce){const _0x1715ee=a27_0x28e51a,{options:_0x215060,tdx:_0x5ab5f7}=_0x8493ce,_0x4df480=resolveLimit(_0x215060['limit'],DEFAULT_DISPLAY_LIMIT),_0x32c98a=_0x215060[_0x1715ee(0x20b)];_0x215060[_0x1715ee(0x1d9)]&&(console[_0x1715ee(0x1fb)](_0x1715ee(0x1e7)+_0x4df480+_0x1715ee(0x216)),_0x32c98a&&console['error'](_0x1715ee(0x1d0)+_0x32c98a));const _0x5c5fb6=await withSpinner(_0x1715ee(0x1e6),()=>_0x5ab5f7[_0x1715ee(0x1df)][_0x1715ee(0x21f)]({'from':0x0,'to':_0x4df480-0x1,'status':_0x32c98a}),{'verbose':_0x215060[_0x1715ee(0x1d9)]}),_0x53634b=_0x5c5fb6[_0x1715ee(0x1d7)];console[_0x1715ee(0x1fb)](_0x1715ee(0x211)+_0x53634b[_0x1715ee(0x20f)]+_0x1715ee(0x215)+(_0x53634b[_0x1715ee(0x20f)]!==0x1?'s':''));const _0xc3b4d9=_0x215060['site'];if(isStructuredFormat(_0x215060)){const _0x38fdde=_0x53634b[_0x1715ee(0x1e3)](_0x5a5bd4=>{const _0x288d65=_0x1715ee;let _0x2d6c23;if(_0x5a5bd4[_0x288d65(0x1cd)]&&_0x5a5bd4['end_at']){const _0x2b9969=new Date(_0x5a5bd4['start_at'])[_0x288d65(0x1e1)](),_0x21278c=new Date(_0x5a5bd4[_0x288d65(0x204)])['getTime']();_0x2d6c23=Math[_0x288d65(0x208)]((_0x21278c-_0x2b9969)/0x3e8);}return{'job_id':_0x5a5bd4[_0x288d65(0x1c7)],'type':_0x5a5bd4['type']===_0x288d65(0x20c)?_0x288d65(0x1dd):_0x5a5bd4[_0x288d65(0x207)],'status':_0x5a5bd4[_0x288d65(0x20b)],'user_name':_0x5a5bd4[_0x288d65(0x205)],'duration_sec':_0x2d6c23,'created_at':_0x5a5bd4['created_at'],'started_at':_0x5a5bd4[_0x288d65(0x1cd)],'end_at':_0x5a5bd4['end_at']};});await handleSDKOutput(_0x38fdde,_0x215060);}else for(const _0x1385e7 of _0x53634b){const _0x5a920f=_0x1385e7[_0x1715ee(0x20b)]===_0x1715ee(0x1d8)?a27_0x733393[_0x1715ee(0x1f2)]:_0x1385e7[_0x1715ee(0x20b)]===_0x1715ee(0x1fb)?a27_0x733393['red']:a27_0x733393['dim'],_0x392b46=_0x5a920f(_0x1385e7['status']),_0x5b9f95=getJobUrl(_0xc3b4d9,_0x1385e7[_0x1715ee(0x1c7)]),_0x1c3876=hyperlink(_0x1385e7[_0x1715ee(0x1c7)],_0x5b9f95),_0x1e7ef1=a27_0x733393[_0x1715ee(0x220)](_0x1385e7['type']==='presto'?_0x1715ee(0x1dd):_0x1385e7[_0x1715ee(0x207)]),_0x2da381=[];if(_0x1385e7['start_at']&&_0x1385e7[_0x1715ee(0x204)]){const _0x251ebd=Math[_0x1715ee(0x208)]((new Date(_0x1385e7['end_at'])['getTime']()-new Date(_0x1385e7['start_at'])[_0x1715ee(0x1e1)]())/0x3e8);_0x2da381['push'](formatDuration(_0x251ebd));}if(_0x1385e7[_0x1715ee(0x204)])_0x2da381[_0x1715ee(0x1ec)](formatRelativeTime(new Date(_0x1385e7[_0x1715ee(0x204)])));else _0x1385e7['start_at']&&_0x2da381[_0x1715ee(0x1ec)](formatRelativeTime(new Date(_0x1385e7['start_at'])));const _0x2458dd=_0x2da381[_0x1715ee(0x20f)]>0x0?a27_0x733393[_0x1715ee(0x220)]('\x20'+_0x2da381[_0x1715ee(0x1e2)](',\x20')):'';console['log']('⚡\x20'+_0x1c3876+'\x20'+_0x1e7ef1+'\x20'+_0x392b46+_0x2458dd);}return 0x0;}}export class JobShowCommand extends BaseCommand{[a27_0x28e51a(0x21b)]='job:show';['description']=a27_0x28e51a(0x202);['validate'](_0x4c467a){const _0x5286dc=a27_0x28e51a,_0x2cea07=_0x4c467a[_0x5286dc(0x212)][0x0];if(!_0x2cea07)return _0x5286dc(0x1f0);return undefined;}async[a27_0x28e51a(0x1fa)](_0x5584ed){const _0x1af46d=a27_0x28e51a,{options:_0x321882,args:_0x3c04ce,tdx:_0x5d6b55}=_0x5584ed,_0x126a8b=_0x3c04ce[0x0],_0x5f1197=await withSpinner(_0x1af46d(0x1d2),()=>_0x5d6b55[_0x1af46d(0x1df)][_0x1af46d(0x1ea)](_0x126a8b),{'verbose':_0x321882['verbose']}),_0x3c4aeb=_0x5f1197[_0x1af46d(0x1d7)];let _0x2002ca;if(_0x3c4aeb[_0x1af46d(0x1cd)]&&_0x3c4aeb[_0x1af46d(0x204)]){const _0x482815=new Date(_0x3c4aeb[_0x1af46d(0x1cd)])[_0x1af46d(0x1e1)](),_0x2d3772=new Date(_0x3c4aeb['end_at'])[_0x1af46d(0x1e1)]();_0x2002ca=Math[_0x1af46d(0x208)]((_0x2d3772-_0x482815)/0x3e8);}const _0x5cde63={'job_id':_0x3c4aeb['job_id'],'type':_0x3c4aeb[_0x1af46d(0x207)],'status':_0x3c4aeb[_0x1af46d(0x20b)],..._0x3c4aeb[_0x1af46d(0x205)]&&{'user_name':_0x3c4aeb[_0x1af46d(0x205)]},..._0x2002ca!==undefined&&{'duration_sec':_0x2002ca},..._0x3c4aeb[_0x1af46d(0x1ce)]&&{'created_at':_0x3c4aeb[_0x1af46d(0x1ce)]},..._0x3c4aeb[_0x1af46d(0x1cd)]&&{'started_at':_0x3c4aeb['start_at']},..._0x3c4aeb[_0x1af46d(0x204)]&&{'end_at':_0x3c4aeb[_0x1af46d(0x204)]},..._0x3c4aeb[_0x1af46d(0x1ee)]&&{'database':_0x3c4aeb[_0x1af46d(0x1ee)]},..._0x3c4aeb[_0x1af46d(0x1ed)]!==undefined&&{'priority':_0x3c4aeb[_0x1af46d(0x1ed)]},..._0x3c4aeb[_0x1af46d(0x21c)]&&{'url':_0x3c4aeb[_0x1af46d(0x21c)]},..._0x3c4aeb[_0x1af46d(0x1f6)]&&{'query':_0x3c4aeb[_0x1af46d(0x1f6)]},..._0x3c4aeb[_0x1af46d(0x1dc)]&&{'debug':_0x3c4aeb[_0x1af46d(0x1dc)]}};return await handleSingleObjectOutput(_0x5cde63,_0x321882),0x0;}}export class JobKillCommand extends BaseCommand{[a27_0x28e51a(0x21b)]='job:kill';[a27_0x28e51a(0x1c9)]='Kill\x20a\x20job';['validate'](_0x514dad){const _0x2e2499=a27_0x28e51a,_0x7692a=_0x514dad[_0x2e2499(0x212)][0x0];if(!_0x7692a)return _0x2e2499(0x1d3);return undefined;}async[a27_0x28e51a(0x1fa)](_0x366beb){const _0x301a04=a27_0x28e51a,{options:_0x2421de,args:_0x231c3f,tdx:_0x172a7c}=_0x366beb,_0x78be21=_0x231c3f[0x0];if(!_0x2421de[_0x301a04(0x1ca)]){const _0x26d102=await confirm(_0x301a04(0x1cf)+_0x78be21+'?');if(!_0x26d102)return console[_0x301a04(0x1fb)](_0x301a04(0x1e8)),0x0;}return await withSpinner('Submitting\x20kill\x20request...',()=>_0x172a7c[_0x301a04(0x1df)][_0x301a04(0x1cc)](_0x78be21),{'verbose':_0x2421de['verbose']}),console[_0x301a04(0x1fb)](_0x301a04(0x1d4)+_0x78be21),console['error']('\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20'+_0x78be21+_0x301a04(0x214)),0x0;}}export class JobSubmitCommand extends BaseCommand{[a27_0x28e51a(0x21b)]=a27_0x28e51a(0x200);[a27_0x28e51a(0x1c9)]=a27_0x28e51a(0x1d1);async[a27_0x28e51a(0x1fa)](_0x2546c3){const _0x2b0ac7=a27_0x28e51a,{options:_0x4a5ff3,args:_0xd6cd14,tdx:_0x286b8d}=_0x2546c3,_0x51eb6f=_0x4a5ff3['jobType']||'trino',_0x21a532=_0x4a5ff3['file'],_0x5488bd=_0x4a5ff3[_0x2b0ac7(0x1ee)]||_0x2b0ac7(0x1e0),_0x22a2c8=_0x4a5ff3['result'];if(_0x51eb6f!=='trino'&&_0x51eb6f!=='hive')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2b0ac7(0x201));let _0x583448;if(_0x21a532){if(_0xd6cd14[0x0])throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2b0ac7(0x1eb));const _0x1ad674=readSqlStatementsFromFile(_0x21a532);if(_0x1ad674[_0x2b0ac7(0x20f)]===0x0)throw new SDKError(ErrorCode[_0x2b0ac7(0x1f3)],_0x2b0ac7(0x206));if(_0x1ad674[_0x2b0ac7(0x20f)]>0x1)throw new SDKError(ErrorCode[_0x2b0ac7(0x1f3)],_0x2b0ac7(0x1fd));_0x583448=_0x1ad674[0x0];}else{if(!_0xd6cd14[0x0])throw new SDKError(ErrorCode[_0x2b0ac7(0x1f3)],_0x2b0ac7(0x1f5));_0x583448=_0xd6cd14[0x0];}_0x4a5ff3[_0x2b0ac7(0x1d9)]&&(console[_0x2b0ac7(0x1fb)](_0x2b0ac7(0x1e4)+_0x51eb6f),console[_0x2b0ac7(0x1fb)](_0x2b0ac7(0x1c8)+_0x5488bd),console[_0x2b0ac7(0x1fb)](_0x2b0ac7(0x1ef)+_0x583448[_0x2b0ac7(0x20d)](0x0,0x64)+(_0x583448[_0x2b0ac7(0x20f)]>0x64?_0x2b0ac7(0x21d):'')));const _0x24ca0d=await withSpinner('Submitting\x20job...',()=>_0x286b8d[_0x2b0ac7(0x1df)][_0x2b0ac7(0x219)](_0x5488bd,_0x583448,_0x51eb6f,_0x22a2c8),{'verbose':_0x4a5ff3[_0x2b0ac7(0x1d9)]}),_0x8a6ca1=_0x24ca0d[_0x2b0ac7(0x1d7)];return console['error'](_0x2b0ac7(0x1f4)),console[_0x2b0ac7(0x1fb)](_0x2b0ac7(0x21e)+_0x8a6ca1[_0x2b0ac7(0x1c7)]),await handleSDKOutput([_0x8a6ca1],_0x4a5ff3),0x0;}}export class JobResultCommand extends BaseCommand{[a27_0x28e51a(0x21b)]='job:result';[a27_0x28e51a(0x1c9)]=a27_0x28e51a(0x1da);[a27_0x28e51a(0x20e)](_0x59972c){const _0x288804=a27_0x28e51a,_0x4e7c95=_0x59972c['args'][0x0];if(!_0x4e7c95)return _0x288804(0x20a);return undefined;}async['execute'](_0x55988f){const _0x3d6bf7=a27_0x28e51a,{options:_0x964d0b,args:_0x211995,tdx:_0x44ebf5}=_0x55988f,_0x44daee=_0x211995[0x0],_0x141c40=await withSpinner(_0x3d6bf7(0x1e5),()=>_0x44ebf5[_0x3d6bf7(0x1df)][_0x3d6bf7(0x209)](_0x44daee),{'verbose':_0x964d0b[_0x3d6bf7(0x1d9)]}),_0x33e4f6=_0x141c40[_0x3d6bf7(0x1d7)];return console[_0x3d6bf7(0x1fb)](_0x3d6bf7(0x1f7)+_0x33e4f6['length']+'\x20row'+(_0x33e4f6[_0x3d6bf7(0x20f)]!==0x1?'s':'')),await handleSDKOutput(_0x33e4f6,_0x964d0b),0x0;}}
@@ -1 +1 @@
1
- const a28_0x3eb276=a28_0x49b9;(function(_0x11c9a0,_0x31d6f4){const _0x37f7f1=a28_0x49b9,_0x147921=_0x11c9a0();while(!![]){try{const _0x56de65=parseInt(_0x37f7f1(0x127))/0x1+-parseInt(_0x37f7f1(0x143))/0x2*(-parseInt(_0x37f7f1(0x124))/0x3)+parseInt(_0x37f7f1(0x18f))/0x4*(parseInt(_0x37f7f1(0x15e))/0x5)+parseInt(_0x37f7f1(0x1a1))/0x6*(parseInt(_0x37f7f1(0xdf))/0x7)+-parseInt(_0x37f7f1(0xd5))/0x8*(parseInt(_0x37f7f1(0xea))/0x9)+-parseInt(_0x37f7f1(0x132))/0xa*(-parseInt(_0x37f7f1(0xd7))/0xb)+-parseInt(_0x37f7f1(0x180))/0xc*(parseInt(_0x37f7f1(0x152))/0xd);if(_0x56de65===_0x31d6f4)break;else _0x147921['push'](_0x147921['shift']());}catch(_0x36febf){_0x147921['push'](_0x147921['shift']());}}}(a28_0x194a,0xa7385));import a28_0x4a3c27 from'chalk';import a28_0x22a743 from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{aggregateStageHistory,assembleJourneyStats,buildStageNameMap}from'../sdk/journey.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey,isInteractive}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{createTdxConfigContent}from'../sdk/segment/tdx-config.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 requireNameOrPath(_0x3390ae){const _0x1ba0c3=a28_0x49b9;return!_0x3390ae&&(console[_0x1ba0c3(0x1b1)](_0x1ba0c3(0xc7)),console[_0x1ba0c3(0x1b1)](_0x1ba0c3(0x1af))),!!_0x3390ae;}function withJsonFormat(_0xa2350e){const _0x1aaf9f=a28_0x49b9;if(!_0xa2350e[_0x1aaf9f(0x1c9)]&&!_0xa2350e[_0x1aaf9f(0xf2)]&&!_0xa2350e[_0x1aaf9f(0xf3)]&&!_0xa2350e[_0x1aaf9f(0x1c0)])return{..._0xa2350e,'format':_0x1aaf9f(0xf2),'json':!![]};return _0xa2350e;}function formatJourneyState(_0x438025){const _0x45eaf7=a28_0x49b9;switch(_0x438025){case _0x45eaf7(0x146):return a28_0x4a3c27[_0x45eaf7(0x111)]('(running)');case'draft':return a28_0x4a3c27[_0x45eaf7(0xc0)](_0x45eaf7(0x134));case _0x45eaf7(0xbe):return a28_0x4a3c27[_0x45eaf7(0x138)](_0x45eaf7(0x121));case _0x45eaf7(0xeb):return a28_0x4a3c27[_0x45eaf7(0x1b8)](_0x45eaf7(0xfd));case _0x45eaf7(0x14e):return a28_0x4a3c27[_0x45eaf7(0xc0)](_0x45eaf7(0x126));default:return'('+_0x438025+')';}}function formatJourneyItem(_0x2272e0,_0x162b03='',_0x54928b){const _0x23fb80=a28_0x49b9,_0x56ed11=formatJourneyState(_0x2272e0[_0x23fb80(0x142)]),_0x4b5bda=_0x54928b?hyperlink(_0x2272e0[_0x23fb80(0x16c)],_0x54928b):_0x2272e0[_0x23fb80(0x16c)];return _0x162b03+'🗺️\x20'+_0x4b5bda+'\x20'+_0x56ed11;}function escapeRegex(_0xe4d900){const _0x4bc247=a28_0x49b9;return _0xe4d900['replace'](/[.*+?^${}()|[\]\\]/g,_0x4bc247(0x103));}function globToRegex(_0x58c7ce){const _0xfb24ec=a28_0x49b9,_0x534f87=_0x58c7ce['split']('*')[_0xfb24ec(0x1ad)](escapeRegex);return new RegExp(_0x534f87[_0xfb24ec(0x116)]('.*'),'i');}function buildRuleToNameMapping(_0x3b2a22){const _0x2334d1=a28_0x49b9,_0x285570=new Map();if(_0x3b2a22[_0x2334d1(0x15d)])for(const [_0x57857c,_0x527df3]of Object['entries'](_0x3b2a22[_0x2334d1(0x15d)])){if(_0x527df3[_0x2334d1(0x129)]){const _0x50e3b1=serializeRule(_0x527df3[_0x2334d1(0x129)]),_0x1e7402=_0x285570[_0x2334d1(0x104)](_0x50e3b1);_0x1e7402?_0x1e7402[_0x2334d1(0xd8)](_0x57857c):_0x285570[_0x2334d1(0x110)](_0x50e3b1,[_0x57857c]);}}return _0x285570;}async function resolveJourneyIdFromInput(_0x55cc4b,_0x1cacbc,_0x35cec1){const _0x54ef14=a28_0x49b9,_0x5465ab=await resolveJourneyTarget(_0x55cc4b,_0x1cacbc[_0x54ef14(0x183)],_0x1cacbc[_0x54ef14(0x154)]),_0x1136c4=_0x5465ab[_0x54ef14(0x183)];if(!_0x1136c4)throw new SDKError(ErrorCode[_0x54ef14(0x18c)],'Could\x20not\x20resolve\x20parent\x20segment.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');const _0x226848=await withSpinner(_0x54ef14(0x181),()=>_0x35cec1[_0x54ef14(0x1ba)][_0x54ef14(0x1b3)](_0x1136c4),{'verbose':_0x1cacbc[_0x54ef14(0x154)]}),_0x448d5f=_0x226848['data'],_0x371847=await withSpinner(_0x54ef14(0x122),()=>_0x35cec1[_0x54ef14(0x17b)][_0x54ef14(0x19f)](_0x448d5f,_0x5465ab[_0x54ef14(0x10c)]),{'verbose':_0x1cacbc['verbose']});return{'journeyId':_0x371847['data'],'journeyName':_0x5465ab['journeyName'],'parentSegmentId':_0x448d5f};}function a28_0x194a(){const _0x599b7c=['Found\x20','connector_config','\x0aChanges\x20to\x20\x27','add','Table:\x20','List\x20activations\x20for\x20a\x20journey','state','14422TgwfjP','No\x20journeys\x20found','Resolved\x20YAML\x20file:\x20','launched','View\x20a\x20specific\x20version\x20of\x20a\x20journey','journeyId','test','completionRate','journey:list','filter','segmentPushCommand','archived','journey:columns','resourceName','segmentName','13ZIqZsq','base','verbose','log','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x20\x20Statistics\x20not\x20available','localeCompare','hasChanges','/app/ps/','...','\x22\x20resumed','segments','410ezYJSS','\x20Created\x20v','renderStats','Error:\x20--version\x20option\x20is\x20required','getSegment','Resolving\x20version...','📁\x20',',\x20version:\x20','\x20\x20Consolidating\x20duplicate\x20segment:\x20','getLatestJourneyId','(root)','includeStats','conversion','journey:view','journeyBundleName','execute','Error:\x20Invalid\x20--type\x20\x22','\x20unchanged\x20files','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','history','cyan','resume','Pause\x20a\x20running\x20journey','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','\x20version','versionNumber','\x20\x20Preserving\x20local\x20segment\x20name:\x20','args','\x20new\x20files','journey','\x20Opening\x20','folderPath','getColumnMapping','table','15897036SlUrRi','Resolving\x20parent\x20segment...','Listing\x20journeys...','parentSegment','✔\x20All\x20files\x20are\x20up\x20to\x20date','Parent\x20segment:\x20','\x20not\x20found.\x20Available:\x20','parentName','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','diff','activationParams','Error:\x20Journey\x20not\x20found:\x20','INVALID_ARGUMENT','\x20activation','message','1576PFdGeR','links','listJourneysFromParentSegment','journey:activations','repeat','Fetching\x20journeys\x20and\x20folders...','getJourney','pause','toLowerCase','\x20\x20Target:\x20','journey:version:view','completeMilestoneRate','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','Resuming\x20journey...','data','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','resolveJourneyId','all','6UyaakP','description','Show\x20journey\x20table\x20column\x20mapping','If\x20the\x20journey\x20is\x20active,\x20the\x20date\x20range\x20may\x20be\x20too\x20wide.\x20Try\x20a\x20shorter\x20period\x20(max\x20~90\x20days).','type','Error:\x20Invalid\x20version\x20number:\x20','has','\x22.\x20Must\x20be\x20\x22conversion\x22\x20or\x20\x22activation\x22.','relative','Error:\x20Stage\x20\x22','exitOrJumpRate','.yml','map','✔\x20Found\x20','Usage:\x20journey\x20<subcommand>\x20<name-or-path>','Show\x20journey\x20details','error','journey:stats','resolveParentId','Getting\x20journey\x20statistics...','Pausing\x20journey...','journey:push','Getting\x20journey\x20traffic\x20data...','blue','options','segment','Fetching\x20','Options:','file','\x0aError:','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','tsv','Show\x20journey\x20statistics','journey:resume','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','attributes','Listing\x20journey\x20versions...','filePath','dryRun','folderId','format','Error:\x20','Folder\x20path:\x20','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','goal','paused','stringify','dim','\x20=\x20','Error:\x20Version\x20','Fetching\x20parent\x20segment...','then','\x20\x20Folder\x20path:\x20','user','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','journey:versions','reentryMode','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','No\x20statistics\x20available\x20for\x20journey:\x20','bold','journey:pause','name','red','version','journeyStages','size','listVersions','length','5384728Dvtvvn','\x20journey','11yQQBre','push','\x20(draft)\x20—\x20\x22','journey:version:create','\x20files?','includeHistory','createdAt','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','6009101zWTFTu','listJourneysWithFolders','✔\x20Journey\x20\x22','getStatistics','web','Cancelled','Pattern:\x20','absolutePath','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','activation_','exitOrJumpSize','9pKbpMI','completed','cwd','tdx.json','audienceId','\x20journeys','\x20details...','/e/','json','jsonl','connection','values','helpText','Export\x20journey(s)\x20as\x20YAML\x20files','Usage:\x20journey\x20version\x20view\x20<name-or-path>\x20--version\x20N','parent_segment','✔\x20Context\x20set:\x20','-\x20no\x20files\x20written','yes','(completed)','journey:pull','sort','hasPeriod','utf-8','Error:\x20Journey\x20\x27','\x5c$&','get','buildIdToNameMap','root\x20folder','kind','Database:\x20','List\x20journeys\x20in\x20current\x20context','createVersion','Traffic\x20data\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','journeyName','isNew','Aborted.','listFolders','set','green','\x0aPull\x20summary:','\x20(rule\x20match)','\x20->\x20','Creating\x20new\x20version...','join','database','Journey\x20name:\x20','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','errorCode','session','getParentFull','journey:traffic','Getting\x20version\x20','limit','find','(paused)','Resolving\x20journey...','site','237kmkBRm','stages','(archived)','193356TkrCmv','journeyBundleId','rule','nodes','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','buildIdToEmailMap','rootFolderId','no_parent','\x22\x20paused','/j/da/je','from','10290010ySzIAn','targetDir','(draft)','enteredSize','\x20\x20Name:\x20','Create\x20a\x20new\x20draft\x20version\x20of\x20journey\x20\x22','yellow','Input:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','\x20(ID:\x20'];a28_0x194a=function(){return _0x599b7c;};return a28_0x194a();}async function resolveJourneyTarget(_0x56d3cc,_0x1fd742,_0x4a9b2d){const _0x1bb298=a28_0x49b9;if(isYamlFilePath(_0x56d3cc))try{const _0x11852a=await resolveYamlFilePath(_0x56d3cc);return _0x4a9b2d&&(console[_0x1bb298(0x1b1)](_0x1bb298(0x145)+_0x56d3cc),console[_0x1bb298(0x1b1)]('\x20\x20Parent\x20segment:\x20'+_0x11852a[_0x1bb298(0x183)]),console[_0x1bb298(0x1b1)](_0x1bb298(0x136)+_0x11852a['segmentName']),console[_0x1bb298(0x1b1)](_0x1bb298(0xc5)+(_0x11852a[_0x1bb298(0x17d)]||'(root)'))),{'journeyName':_0x11852a[_0x1bb298(0x151)],'parentSegment':_0x11852a[_0x1bb298(0x183)],'resolved':_0x11852a};}catch(_0x11fbe9){throw new SDKError(ErrorCode[_0x1bb298(0x18c)],_0x1bb298(0x1c3)+_0x11fbe9[_0x1bb298(0x18e)]);}if(!_0x1fd742)throw new SDKError(ErrorCode[_0x1bb298(0x18c)],_0x1bb298(0x1bf));return{'journeyName':_0x56d3cc,'parentSegment':_0x1fd742};}export class JourneyListCommand extends BaseCommand{[a28_0x3eb276(0xce)]=a28_0x3eb276(0x14b);[a28_0x3eb276(0x1a2)]=a28_0x3eb276(0x109);async[a28_0x3eb276(0x16d)](_0x591319){const _0x53dbc9=a28_0x3eb276,{options:_0x50eac9,args:_0x1eee22,tdx:_0x56bfa4}=_0x591319,_0x4a2b89=_0x1eee22[0x0],_0x290595=_0x50eac9[_0x53dbc9(0x183)];if(!_0x290595)return console[_0x53dbc9(0x1b1)]('Error:\x20Parent\x20segment\x20context\x20required'),console[_0x53dbc9(0x1b1)]('Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22'),0x1;const _0x4a1f46=await withSpinner(_0x53dbc9(0x181),()=>_0x56bfa4[_0x53dbc9(0x1ba)][_0x53dbc9(0x1b3)](_0x290595),{'verbose':_0x50eac9[_0x53dbc9(0x154)]}),_0x579e6d=_0x4a1f46[_0x53dbc9(0x19d)];_0x50eac9['verbose']&&(console[_0x53dbc9(0x1b1)]('Parent\x20segment:\x20'+_0x290595+_0x53dbc9(0x13b)+_0x579e6d+')'),_0x4a2b89&&console['error'](_0x53dbc9(0xe5)+_0x4a2b89));const _0x3dd0bb=await withSpinner(_0x53dbc9(0xc3),()=>_0x56bfa4[_0x53dbc9(0x1ba)][_0x53dbc9(0x11c)](_0x579e6d),{'verbose':_0x50eac9[_0x53dbc9(0x154)]}),_0x1288bd=_0x3dd0bb[_0x53dbc9(0x19d)],_0x1a8c7e=_0x1288bd[_0x53dbc9(0x12d)],_0x2f8eed=await withSpinner(_0x53dbc9(0x182),()=>_0x56bfa4[_0x53dbc9(0x17b)][_0x53dbc9(0xe0)](_0x579e6d,_0x1a8c7e),{'verbose':_0x50eac9[_0x53dbc9(0x154)]});let _0x3eb2da=_0x2f8eed[_0x53dbc9(0x19d)]['journeys'];const _0x241f5e=_0x2f8eed['data']['folders'],_0x35c574=new Map();for(const _0x31a900 of _0x241f5e){_0x35c574['set'](_0x31a900['id'],_0x31a900[_0x53dbc9(0xce)]);}if(_0x4a2b89){const _0x46b3da=globToRegex(_0x4a2b89);_0x3eb2da=_0x3eb2da[_0x53dbc9(0x14c)](_0x4a1091=>_0x46b3da[_0x53dbc9(0x149)](_0x4a1091[_0x53dbc9(0x16c)]));}console['error'](_0x53dbc9(0x1ae)+_0x3eb2da[_0x53dbc9(0xd4)]+_0x53dbc9(0xd6)+(_0x3eb2da[_0x53dbc9(0xd4)]!==0x1?'s':''));const _0x30c6e5=_0x20f9e8=>{const _0x1660d6=_0x53dbc9;return getConsoleNextUrl(_0x50eac9[_0x1660d6(0x123)],_0x1660d6(0x15a)+_0x579e6d+_0x1660d6(0xf1)+_0x20f9e8+'/j/da');};if(_0x50eac9[_0x53dbc9(0x1c9)]==='table')await handleSDKOutput(_0x3eb2da,_0x50eac9);else{if(_0x50eac9[_0x53dbc9(0x1c9)]===_0x53dbc9(0xf2)){const _0x4b9de3=_0x3eb2da['map'](_0x3e6794=>({..._0x3e6794,'url':_0x30c6e5(_0x3e6794['id'])}));await handleSDKOutput(_0x4b9de3,_0x50eac9);}else{console['log']('['+_0x290595+']');const _0x5874ea=new Map(),_0x9c921=[];for(const _0x5e9301 of _0x3eb2da){if(!_0x5e9301['folderId']||_0x5e9301[_0x53dbc9(0x1c8)]===_0x1a8c7e)_0x9c921['push'](_0x5e9301);else{const _0x5866fc=_0x5874ea[_0x53dbc9(0x104)](_0x5e9301['folderId'])||[];_0x5866fc['push'](_0x5e9301),_0x5874ea[_0x53dbc9(0x110)](_0x5e9301['folderId'],_0x5866fc);}}const _0x484a71=(_0x10529c,_0x1119cc)=>_0x10529c[_0x53dbc9(0x16c)][_0x53dbc9(0x158)](_0x1119cc[_0x53dbc9(0x16c)],undefined,{'sensitivity':'base'});_0x9c921['sort'](_0x484a71);for(const _0x2527c7 of _0x9c921){console['log'](formatJourneyItem(_0x2527c7,'',_0x30c6e5(_0x2527c7['id'])));}const _0x3fb601=[..._0x5874ea['entries']()][_0x53dbc9(0xff)]((_0x14d559,_0x54a274)=>{const _0x275409=_0x53dbc9,_0x258d45=_0x35c574[_0x275409(0x104)](_0x14d559[0x0])||_0x14d559[0x0],_0x46c21e=_0x35c574[_0x275409(0x104)](_0x54a274[0x0])||_0x54a274[0x0];return _0x258d45['localeCompare'](_0x46c21e,undefined,{'sensitivity':_0x275409(0x153)});});for(const [_0xdfbd8e,_0x60bc2d]of _0x3fb601){const _0x584bae=_0x35c574[_0x53dbc9(0x104)](_0xdfbd8e)||_0xdfbd8e;console['log'](_0x53dbc9(0x164)+_0x584bae),_0x60bc2d[_0x53dbc9(0xff)](_0x484a71);for(const _0x3709e3 of _0x60bc2d){console[_0x53dbc9(0x155)](formatJourneyItem(_0x3709e3,'\x20\x20',_0x30c6e5(_0x3709e3['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a28_0x3eb276(0xce)]=a28_0x3eb276(0x16b);['description']=a28_0x3eb276(0x1b0);async[a28_0x3eb276(0x16d)](_0x11726b){const _0x15e039=a28_0x3eb276,{options:_0x1a2b33,args:_0x6b309e,tdx:_0x12abd1}=_0x11726b,_0xec0974=_0x6b309e[0x0];if(!_0xec0974)return console['error'](_0x15e039(0xc7)),console[_0x15e039(0x1b1)](_0x15e039(0x12b)),console[_0x15e039(0x1b1)](_0x15e039(0x1bc)),console[_0x15e039(0x1b1)](_0x15e039(0x175)),0x1;_0x1a2b33[_0x15e039(0x154)]&&console[_0x15e039(0x1b1)](_0x15e039(0x139)+_0xec0974);const {journeyId:_0x3a2c18,parentSegmentId:_0x153e75}=await resolveJourneyIdFromInput(_0xec0974,_0x1a2b33,_0x12abd1);if(_0x1a2b33[_0x15e039(0xe3)]){const _0x54487c=getConsoleNextUrl(_0x1a2b33[_0x15e039(0x123)],_0x15e039(0x15a)+_0x153e75+'/e/'+_0x3a2c18+_0x15e039(0x130));return console[_0x15e039(0x1b1)](a28_0x4a3c27[_0x15e039(0x111)]('✔')+_0x15e039(0x17c)+a28_0x4a3c27['cyan'](_0x54487c)),openBrowser(_0x54487c),0x0;}const _0x5e95f4=await withSpinner('Getting\x20journey\x20details...',()=>_0x12abd1[_0x15e039(0x17b)][_0x15e039(0x195)](_0x3a2c18),{'verbose':_0x1a2b33[_0x15e039(0x154)]}),_0x3d4258=_0x5e95f4['data'],_0x121fc8=_0x1a2b33[_0x15e039(0x169)];let _0x5046ae;if(_0x121fc8)try{const _0x5a5139=await withSpinner(_0x15e039(0x1b4),()=>_0x12abd1[_0x15e039(0x17b)][_0x15e039(0xe2)](_0x3a2c18),{'verbose':_0x1a2b33[_0x15e039(0x154)]});_0x5046ae=_0x5a5139[_0x15e039(0x19d)];}catch{_0x1a2b33[_0x15e039(0x154)]&&console[_0x15e039(0x1b1)](_0x15e039(0x157));}const _0x3aaed7=getConsoleNextUrl(_0x1a2b33[_0x15e039(0x123)],_0x15e039(0x15a)+_0x153e75+_0x15e039(0xf1)+_0x3a2c18+_0x15e039(0x130)),_0x3e2a81={'id':_0x3d4258['id'],'name':_0x3d4258[_0x15e039(0x1c4)][_0x15e039(0xce)],'description':_0x3d4258[_0x15e039(0x1c4)]['description'],'state':_0x3d4258['attributes'][_0x15e039(0x142)],'paused':_0x3d4258['attributes'][_0x15e039(0xbe)],'reentry_mode':_0x3d4258[_0x15e039(0x1c4)][_0x15e039(0xc9)],'stages':_0x3d4258[_0x15e039(0x1c4)][_0x15e039(0xd1)]?.['length']||0x0,..._0x3d4258['attributes'][_0x15e039(0xbd)]&&{'goal':_0x3d4258[_0x15e039(0x1c4)][_0x15e039(0xbd)]['name']},..._0x5046ae&&{'statistics':{'size':_0x5046ae[_0x15e039(0xd2)],'entered':_0x5046ae['enteredSize'],'goal_achieved':_0x5046ae['goalSize'],'completion_rate':_0x5046ae[_0x15e039(0x14a)],'exit_or_jump':_0x5046ae[_0x15e039(0xe9)],'exit_or_jump_rate':_0x5046ae[_0x15e039(0x1ab)],'stages':_0x5046ae[_0x15e039(0x125)]}},'url':_0x3aaed7};return await handleSingleObjectOutput(_0x3e2a81,_0x1a2b33),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a28_0x3eb276(0xce)]=a28_0x3eb276(0x1b2);[a28_0x3eb276(0x1a2)]=a28_0x3eb276(0x1c1);async['execute'](_0x56d99f){const _0x541f38=a28_0x3eb276,{options:_0x1f3575,args:_0x4afc70,tdx:_0x1bc4c2}=_0x56d99f,_0x282c11=_0x4afc70[0x0];if(!requireNameOrPath(_0x282c11))return 0x1;_0x1f3575['verbose']&&console[_0x541f38(0x1b1)](_0x541f38(0x139)+_0x282c11);const _0x2b504a=_0x1f3575,_0x2b9e30=_0x2b504a[_0x541f38(0x131)],_0x524f32=_0x2b504a['to'],_0x3e3c74=_0x2b504a[_0x541f38(0xdc)],_0x5f5c44=_0x2b504a['stage'];_0x3e3c74&&!_0x2b9e30&&!_0x524f32&&console[_0x541f38(0x1b1)]('Warning:\x20--include-history\x20without\x20--from/--to\x20may\x20return\x20all-time\x20history');const _0x4f1d60=_0x3e3c74?withJsonFormat(_0x1f3575):_0x1f3575,{journeyId:_0x198061,journeyName:_0x2dfdf9}=await resolveJourneyIdFromInput(_0x282c11,_0x4f1d60,_0x1bc4c2),_0x3fd515=_0x2b9e30||_0x524f32?{'from':_0x2b9e30,'to':_0x524f32}:undefined,_0x107e96=await withSpinner(_0x541f38(0x1b4),()=>Promise[_0x541f38(0x1a0)]([_0x1bc4c2[_0x541f38(0x17b)]['getJourney'](_0x198061),_0x1bc4c2['journey'][_0x541f38(0xe2)](_0x198061,_0x3fd515)]),{'verbose':_0x4f1d60[_0x541f38(0x154)]}),[_0x2ce2ca,_0x7f084a]=_0x107e96['data'];if(!_0x7f084a||_0x7f084a[_0x541f38(0x148)]===null)return console[_0x541f38(0x1b1)](_0x541f38(0xcb)+_0x2dfdf9),console['error'](_0x541f38(0xbc)),0x0;const _0x4b9fd4=buildStageNameMap(_0x2ce2ca),_0x38ba7c=!!(_0x3fd515&&_0x7f084a['history']?.[_0x541f38(0xd4)]),_0x1af715={'stageNameMap':_0x4b9fd4,'hasPeriod':_0x38ba7c,'includeHistory':!!_0x3e3c74};if(_0x5f5c44&&_0x7f084a['stages']){const _0x177234=_0x7f084a[_0x541f38(0x125)][_0x541f38(0x120)](_0x114d48=>{const _0x5e7536=_0x541f38,_0x5b9e61=_0x4b9fd4[_0x5e7536(0x104)](_0x114d48['id'])??'';return _0x5b9e61['toLowerCase']()===_0x5f5c44[_0x5e7536(0x197)]();});if(_0x177234)return await handleSingleObjectOutput(formatStageStats(_0x177234,_0x1af715),_0x4f1d60),0x0;const _0x191b0a=_0x7f084a['stages']['map'](_0x2be628=>_0x4b9fd4[_0x541f38(0x104)](_0x2be628['id'])??_0x2be628['id']);return console['error'](_0x541f38(0x1aa)+_0x5f5c44+'\x22\x20not\x20found'),console[_0x541f38(0x1b1)]('Available\x20stages:\x20'+_0x191b0a[_0x541f38(0x116)](',\x20')),0x1;}const _0x2ce8eb=_0x7f084a[_0x541f38(0x125)]?.['map'](_0x39bef2=>formatStageStats(_0x39bef2,_0x1af715)),_0x331d9e=assembleJourneyStats(_0x7f084a,{'from':_0x2b9e30,'to':_0x524f32,'includeHistory':_0x3e3c74});return await this[_0x541f38(0x160)](_0x331d9e,_0x2ce8eb??[],_0x4f1d60),0x0;}async[a28_0x3eb276(0x160)](_0x4a2c4e,_0x41d19a,_0xd97138){const _0x168cc9=a28_0x3eb276,_0x508b79=_0xd97138[_0x168cc9(0x1c9)]==='json'||_0xd97138[_0x168cc9(0x1c9)]==='jsonl'||_0xd97138[_0x168cc9(0xf2)]||_0xd97138[_0x168cc9(0xf3)];if(_0x508b79){_0x4a2c4e['stages']=_0x41d19a,await handleSingleObjectOutput(_0x4a2c4e,_0xd97138);return;}await handleSingleObjectOutput(_0x4a2c4e,_0xd97138);for(const _0x4e49a9 of _0x41d19a){console['log'](''),console['log'](String(a28_0x4a3c27[_0x168cc9(0x172)][_0x168cc9(0xcc)]('['+_0x4e49a9[_0x168cc9(0xce)]+']'))+a28_0x4a3c27[_0x168cc9(0xc0)]('\x20'+_0x4e49a9['id']));const {id:_0x515f69,name:_0x4c0db9,..._0x484348}=_0x4e49a9;await handleSingleObjectOutput(_0x484348,_0xd97138);}}}export class JourneyTrafficCommand extends BaseCommand{['name']=a28_0x3eb276(0x11d);[a28_0x3eb276(0x1a2)]='Get\x20journey\x20traffic\x20data\x20(Sankey\x20charts)';async[a28_0x3eb276(0x16d)](_0x11fc86){const _0x34c4a4=a28_0x3eb276,{options:_0x1431c0,args:_0x2ceecb,tdx:_0x502064}=_0x11fc86,_0xfd8ba1=_0x2ceecb[0x0];if(!requireNameOrPath(_0xfd8ba1))return 0x1;_0x1431c0[_0x34c4a4(0x154)]&&console[_0x34c4a4(0x1b1)](_0x34c4a4(0x139)+_0xfd8ba1);const _0x62c1d0=_0x1431c0,_0x54be18=_0x62c1d0[_0x34c4a4(0x1a5)],_0x59c299=_0x62c1d0[_0x34c4a4(0x131)],_0x3f1c30=_0x62c1d0['to'],_0x5f3cb2=_0x62c1d0[_0x34c4a4(0x11f)];if(_0x54be18&&_0x54be18!==_0x34c4a4(0x16a)&&_0x54be18!=='activation')return console[_0x34c4a4(0x1b1)](_0x34c4a4(0x16e)+_0x54be18+_0x34c4a4(0x1a8)),0x1;const _0x425f13=withJsonFormat(_0x1431c0),{journeyId:_0x1dc8a5,journeyName:_0x129ced}=await resolveJourneyIdFromInput(_0xfd8ba1,_0x425f13,_0x502064),_0x109c18={'type':_0x54be18,'from':_0x59c299,'to':_0x3f1c30,'limit':_0x5f3cb2},_0x67f22d=await withSpinner(_0x34c4a4(0x1b7),()=>_0x502064[_0x34c4a4(0x17b)]['getTrafficData'](_0x1dc8a5,_0x109c18),{'verbose':_0x425f13[_0x34c4a4(0x154)]}),_0x4f4e84=_0x67f22d[_0x34c4a4(0x19d)],_0x463841=_0x4f4e84[_0x34c4a4(0x16a)]&&(_0x4f4e84['conversion'][_0x34c4a4(0x12a)][_0x34c4a4(0xd4)]>0x0||_0x4f4e84['conversion'][_0x34c4a4(0x190)][_0x34c4a4(0xd4)]>0x0),_0x10f2b1=_0x4f4e84['activation']&&_0x4f4e84['activation'][_0x34c4a4(0xd4)]>0x0;if(!_0x463841&&!_0x10f2b1)return console[_0x34c4a4(0x1b1)]('No\x20traffic\x20data\x20available\x20for\x20journey:\x20'+_0x129ced),console['error'](_0x34c4a4(0x10b)),_0x59c299&&_0x3f1c30&&console[_0x34c4a4(0x1b1)](_0x34c4a4(0x1a4)),0x0;return await handleSingleObjectOutput(_0x4f4e84,_0x425f13),0x0;}}function formatStageStats(_0x50cd71,_0x18d9d5){const _0xcc4439=a28_0x3eb276,_0x48bffa=_0x18d9d5[_0xcc4439(0x100)]&&_0x50cd71[_0xcc4439(0x171)]?.[_0xcc4439(0xd4)]?aggregateStageHistory(_0x50cd71[_0xcc4439(0x171)]):{'size':_0x50cd71[_0xcc4439(0xd2)],'entered':_0x50cd71[_0xcc4439(0x135)],'milestone':_0x50cd71['milestoneSize'],'milestone_rate':_0x50cd71[_0xcc4439(0x19a)],'exit_or_jump':_0x50cd71[_0xcc4439(0xe9)],'exit_or_jump_rate':_0x50cd71['exitOrJumpRate']},_0x3fd7a6={'id':_0x50cd71['id'],'name':_0x18d9d5['stageNameMap'][_0xcc4439(0x104)](_0x50cd71['id'])??_0x50cd71['id'],..._0x48bffa};return _0x18d9d5[_0xcc4439(0x100)]&&_0x18d9d5[_0xcc4439(0xdc)]&&_0x50cd71[_0xcc4439(0x171)]&&(_0x3fd7a6[_0xcc4439(0x171)]=_0x50cd71[_0xcc4439(0x171)]),_0x3fd7a6;}export class JourneyPauseCommand extends BaseCommand{['name']=a28_0x3eb276(0xcd);[a28_0x3eb276(0x1a2)]=a28_0x3eb276(0x174);async[a28_0x3eb276(0x16d)](_0x5ba841){const _0x3c4783=a28_0x3eb276,{options:_0x58d4ac,args:_0x5d97de,tdx:_0xfedd93}=_0x5ba841,_0x380db7=_0x5d97de[0x0];if(!requireNameOrPath(_0x380db7))return 0x1;_0x58d4ac[_0x3c4783(0x154)]&&console[_0x3c4783(0x1b1)]('Input:\x20'+_0x380db7);const {journeyId:_0x3fa696,journeyName:_0x2b33d2}=await resolveJourneyIdFromInput(_0x380db7,_0x58d4ac,_0xfedd93);if(!_0x58d4ac['yes']){const _0x14de72=await confirm(_0x3c4783(0xca)+_0x2b33d2+'\x22?');if(!_0x14de72)return console[_0x3c4783(0x1b1)](_0x3c4783(0xe4)),0x0;}const _0x1a161c=await withSpinner(_0x3c4783(0x1b5),()=>_0xfedd93['journey'][_0x3c4783(0x196)](_0x3fa696),{'verbose':_0x58d4ac['verbose']}),_0x1631ec=_0x1a161c[_0x3c4783(0x19d)];return console[_0x3c4783(0x1b1)]('✔\x20Journey\x20\x22'+_0x1631ec[_0x3c4783(0x1c4)]['name']+_0x3c4783(0x12f)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a28_0x3eb276(0xce)]=a28_0x3eb276(0x1c2);[a28_0x3eb276(0x1a2)]='Resume\x20a\x20paused\x20journey';async[a28_0x3eb276(0x16d)](_0x35767b){const _0x4e7b6b=a28_0x3eb276,{options:_0x3ebe23,args:_0x30191d,tdx:_0x212e0e}=_0x35767b,_0x38c534=_0x30191d[0x0];if(!requireNameOrPath(_0x38c534))return 0x1;_0x3ebe23[_0x4e7b6b(0x154)]&&console['error'](_0x4e7b6b(0x139)+_0x38c534);const {journeyId:_0x38106e,journeyName:_0x15986f}=await resolveJourneyIdFromInput(_0x38c534,_0x3ebe23,_0x212e0e);if(!_0x3ebe23[_0x4e7b6b(0xfc)]){const _0x5db04f=await confirm(_0x4e7b6b(0xde)+_0x15986f+'\x22?');if(!_0x5db04f)return console[_0x4e7b6b(0x1b1)](_0x4e7b6b(0xe4)),0x0;}const _0x1bf64=await withSpinner(_0x4e7b6b(0x19c),()=>_0x212e0e[_0x4e7b6b(0x17b)][_0x4e7b6b(0x173)](_0x38106e),{'verbose':_0x3ebe23[_0x4e7b6b(0x154)]}),_0x4b686f=_0x1bf64[_0x4e7b6b(0x19d)];return console['error'](_0x4e7b6b(0xe1)+_0x4b686f[_0x4e7b6b(0x1c4)][_0x4e7b6b(0xce)]+_0x4e7b6b(0x15c)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a28_0x3eb276(0xce)]=a28_0x3eb276(0xfe);[a28_0x3eb276(0x1a2)]=a28_0x3eb276(0xf7);async[a28_0x3eb276(0x16d)](_0x461dc4){const _0x5e4a27=a28_0x3eb276,{options:_0x379a48,args:_0x537637,tdx:_0x4db2dd}=_0x461dc4,_0x1c305e=_0x379a48,_0x1f0dce=_0x537637[0x0],_0x5b05f0=_0x1f0dce&&isYamlFilePath(_0x1f0dce),_0x1978e6=await resolveTarget({'arg':_0x5b05f0?_0x1f0dce:undefined,'contextParent':_0x379a48[_0x5e4a27(0x183)],'cwd':process[_0x5e4a27(0xec)]()});if(!isSuccessfulResolution(_0x1978e6))return _0x1978e6[_0x5e4a27(0x11a)]===_0x5e4a27(0x12e)?(console[_0x5e4a27(0x1b1)](a28_0x4a3c27[_0x5e4a27(0x138)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console['error']('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['error'](_0x5e4a27(0x13a)),console[_0x5e4a27(0x1b1)](_0x5e4a27(0x19b)),console['error'](_0x5e4a27(0xe7))):(console['error'](a28_0x4a3c27[_0x5e4a27(0xcf)](_0x5e4a27(0xba)+_0x1978e6['message']+'\x0a')),_0x1978e6[_0x5e4a27(0xf6)]&&console[_0x5e4a27(0x1b1)](a28_0x4a3c27[_0x5e4a27(0x172)](_0x1978e6[_0x5e4a27(0xf6)]))),0x1;let _0x319485=_0x5b05f0?undefined:_0x1f0dce,_0x4c4460,_0xef5d3f;_0x1978e6[_0x5e4a27(0x1a5)]===_0x5e4a27(0x1bd)&&(_0x319485=_0x1978e6[_0x5e4a27(0x150)],_0x4c4460=_0x1978e6[_0x5e4a27(0x1c6)],_0xef5d3f=_0x1978e6[_0x5e4a27(0x17d)]);const _0xdd931f=_0x1978e6[_0x5e4a27(0x187)],_0x41e80c=_0x1978e6[_0x5e4a27(0x133)];_0x1c305e[_0x5e4a27(0x154)]&&(console[_0x5e4a27(0x1b1)](_0x5e4a27(0x185)+_0xdd931f),console[_0x5e4a27(0x1b1)]('Target\x20directory:\x20'+_0x41e80c),_0x319485&&console[_0x5e4a27(0x1b1)](_0x5e4a27(0x118)+_0x319485),_0x4c4460&&console['error']('Target\x20file:\x20'+_0x4c4460),_0xef5d3f&&console['error'](_0x5e4a27(0xbb)+_0xef5d3f));const _0x7e927=await withSpinner(_0x5e4a27(0x181),()=>_0x4db2dd[_0x5e4a27(0x1ba)][_0x5e4a27(0x1b3)](_0xdd931f),{'verbose':_0x379a48[_0x5e4a27(0x154)]}),_0xe188fc=_0x7e927[_0x5e4a27(0x19d)],{journeys:_0x3d8a9f,folders:_0x1b1d74}=await withSpinner(_0x5e4a27(0x194),async()=>{const _0x1b9c8e=_0x5e4a27,[_0x49e3a6,_0x47aa26]=await Promise['all']([_0x4db2dd[_0x1b9c8e(0x17b)][_0x1b9c8e(0x191)](_0xe188fc,undefined,{'includeAllVersions':!![]}),_0x4db2dd[_0x1b9c8e(0x1ba)][_0x1b9c8e(0x10f)](_0xe188fc)]);return{'journeys':_0x49e3a6,'folders':_0x47aa26};},{'verbose':_0x379a48[_0x5e4a27(0x154)]})[_0x5e4a27(0xc4)](_0x2239be=>_0x2239be['data']);let _0x2354b6=_0x3d8a9f;const _0x3a7dd4=buildFolderIdToPathMap(_0x1b1d74);if(_0x319485){const _0x152243=_0x2354b6[_0x5e4a27(0x14c)](_0x4b4878=>_0x4b4878['journeyBundleName']['toLowerCase']()===_0x319485[_0x5e4a27(0x197)]());if(_0x152243[_0x5e4a27(0xd4)]===0x0)return console[_0x5e4a27(0x1b1)](_0x5e4a27(0x18b)+_0x319485),console[_0x5e4a27(0x1b1)](_0x5e4a27(0x19e)),0x1;_0x2354b6=_0x152243;}if(_0xef5d3f!==undefined){const _0x3a5dd4=_0x2354b6[_0x5e4a27(0x14c)](_0x5d54a1=>{const _0x9d163a=_0x5e4a27,_0x891efc=_0x5d54a1[_0x9d163a(0x1c8)]?_0x3a7dd4['get'](_0x5d54a1[_0x9d163a(0x1c8)])||'':'';return _0x891efc===_0xef5d3f;});if(_0x3a5dd4[_0x5e4a27(0xd4)]===0x0&&_0x2354b6[_0x5e4a27(0xd4)]>0x0){console[_0x5e4a27(0x1b1)](_0x5e4a27(0x102)+_0x319485+'\x27\x20not\x20found\x20in\x20'+(_0xef5d3f||_0x5e4a27(0x106))),console[_0x5e4a27(0x1b1)]('Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:');for(const _0x31a36d of _0x2354b6){const _0xd9868d=_0x31a36d[_0x5e4a27(0x1c8)]?_0x3a7dd4[_0x5e4a27(0x104)](_0x31a36d['folderId'])||'':'';console['error']('\x20\x20-\x20'+(_0xd9868d||_0x5e4a27(0x168))+'/'+_0x31a36d['journeyBundleName']);}return 0x1;}_0x2354b6=_0x3a5dd4;}if(_0x2354b6[_0x5e4a27(0xd4)]===0x0)return console[_0x5e4a27(0x1b1)](_0x5e4a27(0x144)),0x0;const _0x1b8899=new Map();for(const _0x5427bf of _0x2354b6){const _0x19a443=_0x5427bf[_0x5e4a27(0x128)];!_0x1b8899[_0x5e4a27(0x1a7)](_0x19a443)&&_0x1b8899[_0x5e4a27(0x110)](_0x19a443,[]),_0x1b8899['get'](_0x19a443)[_0x5e4a27(0xd8)](_0x5427bf);}for(const _0x2cfede of _0x1b8899[_0x5e4a27(0xf5)]()){_0x2cfede['sort']((_0x1973fd,_0x4c524e)=>(_0x1973fd[_0x5e4a27(0x177)]||0x0)-(_0x4c524e[_0x5e4a27(0x177)]||0x0));}const _0x87e391=[],{idToEmailMap:_0x10cbd8,connectionIdToNameMap:_0x2afd96}=await withSpinner('Fetching\x20users\x20and\x20connections...',async()=>{const _0x2ee94c=_0x5e4a27,[_0x42a236,_0x575592]=await Promise[_0x2ee94c(0x1a0)]([_0x4db2dd[_0x2ee94c(0xc6)][_0x2ee94c(0x12c)](),_0x4db2dd[_0x2ee94c(0xf4)][_0x2ee94c(0x105)]()]);return{'idToEmailMap':_0x42a236,'connectionIdToNameMap':_0x575592};},{'verbose':_0x379a48[_0x5e4a27(0x154)]})[_0x5e4a27(0xc4)](_0x5e4b73=>_0x5e4b73[_0x5e4a27(0x19d)]);for(const _0x107642 of _0x1b8899[_0x5e4a27(0xf5)]()){const _0x515467=_0x107642[0x0]['journeyBundleName'],_0x116553=_0x107642[0x0][_0x5e4a27(0x1c8)],_0x457a41=_0x116553?_0x3a7dd4[_0x5e4a27(0x104)](_0x116553)||'':'',_0x30cedf=_0x457a41?a28_0x22a743[_0x5e4a27(0x116)](_0x41e80c,_0x457a41):_0x41e80c,_0x20b002=_0x4c4460||a28_0x22a743[_0x5e4a27(0x116)](_0x30cedf,sanitizeFileName(_0x515467)+_0x5e4a27(0x1ac));let _0x2ed93f,_0x2005d3;if(existsSync(_0x20b002))try{const _0x5401d5=readFileSync(_0x20b002,_0x5e4a27(0x101)),_0x1ea84f=parseYamlString(_0x5401d5);_0x2005d3=_0x1ea84f,_0x2ed93f=buildRuleToNameMapping(_0x1ea84f),_0x1c305e['verbose']&&_0x2ed93f[_0x5e4a27(0xd2)]>0x0&&console['error'](_0x5e4a27(0x13c)+_0x2ed93f[_0x5e4a27(0xd2)]+_0x5e4a27(0x188)+_0x515467);}catch(_0x3364da){_0x1c305e[_0x5e4a27(0x154)]&&console[_0x5e4a27(0x1b1)](_0x5e4a27(0x170)+_0x3364da[_0x5e4a27(0x18e)]);}const _0x55d94f=[],_0x4f974a=new Set(),_0x5a13fb=new Map(),_0x7e3713=new Map(),_0x3163a5=new Set(),_0x3244c1=new Map(),_0x529ab1=new Map(),_0xc6bf74=createJumpTargetCache();await withProgressSpinner(_0x5e4a27(0x1bb)+_0x515467+_0x5e4a27(0x15b),async _0x5ac17a=>{const _0x16e3f2=_0x5e4a27;for(const _0x3ba678 of _0x107642){const _0x58f6e8=_0x107642[_0x16e3f2(0xd4)]>0x1?_0x3ba678[_0x16e3f2(0x16c)]+'\x20v'+(_0x3ba678[_0x16e3f2(0x177)]||0x1):_0x3ba678[_0x16e3f2(0x16c)];_0x5ac17a['setPhase'](_0x16e3f2(0x1bb)+_0x58f6e8);const _0x1baf30=await _0x4db2dd[_0x16e3f2(0x17b)][_0x16e3f2(0x195)](_0x3ba678['id']),_0x1aa053=_0x1baf30['attributes']?.[_0x16e3f2(0xee)],_0xdce78d={'resolveSegment':async _0x5051bb=>{const _0x453da6=_0x16e3f2;if(!_0x1aa053)return{'name':_0x5051bb,'isJourneyLocal':![]};const _0x505984=_0x5a13fb[_0x453da6(0x104)](_0x5051bb);if(_0x505984)return _0x505984;try{const _0x572ae7=await _0x4db2dd[_0x453da6(0x1ba)][_0x453da6(0x162)](_0x1aa053,_0x5051bb),_0x14e32a=_0x572ae7[_0x453da6(0x107)]===SEGMENT_KIND_JOURNEY;let _0x3d7d58,_0x1cd674=_0x572ae7[_0x453da6(0xce)];if(_0x14e32a&&_0x572ae7[_0x453da6(0x129)]){const _0x409c44=await segmentResponseToDef(_0x572ae7,{'resolveSegmentName':async _0x3f7ccc=>{const _0x48c2f0=_0x453da6,_0x46ad75=_0x5a13fb['get'](_0x3f7ccc);if(_0x46ad75)return _0x46ad75[_0x48c2f0(0xce)];const _0x33a463=await _0xdce78d['resolveSegment'](_0x3f7ccc);return _0x33a463[_0x48c2f0(0xce)];}}),_0x31b3b3=_0x409c44[_0x453da6(0x129)];_0x3d7d58={'description':_0x572ae7[_0x453da6(0x1a2)],'rule':_0x31b3b3};const _0xe9b170=serializeRule(_0x31b3b3),_0x16a1b4=_0x7e3713[_0x453da6(0x104)](_0xe9b170);if(_0x16a1b4)_0x1cd674=_0x16a1b4,_0x3d7d58=undefined,_0x1c305e['verbose']&&console[_0x453da6(0x1b1)](_0x453da6(0x166)+_0x572ae7[_0x453da6(0xce)]+_0x453da6(0x114)+_0x16a1b4);else{let _0x43420c=![];if(_0x2ed93f){const _0x475373=_0x2ed93f['get'](_0xe9b170);if(_0x475373){const _0x4eb78c=_0x475373[_0x453da6(0x120)](_0x2fc55c=>!_0x4f974a['has'](_0x2fc55c));_0x4eb78c&&(_0x1cd674=_0x4eb78c,_0x4f974a[_0x453da6(0x13f)](_0x4eb78c),_0x7e3713[_0x453da6(0x110)](_0xe9b170,_0x4eb78c),_0x43420c=!![],_0x1c305e[_0x453da6(0x154)]&&console['error'](_0x453da6(0x178)+_0x4eb78c+_0x453da6(0x113)));}}if(!_0x43420c){const _0x1264ea=generateJourneyLocalName(_0x572ae7[_0x453da6(0xce)]);_0x1264ea&&(_0x1cd674=_0x1264ea);let _0x57e3b8=_0x1cd674,_0x358e6e=0x2;while(_0x4f974a['has'](_0x57e3b8)){_0x57e3b8=_0x1cd674+'_'+_0x358e6e,_0x358e6e++;}_0x4f974a[_0x453da6(0x13f)](_0x57e3b8),_0x7e3713[_0x453da6(0x110)](_0xe9b170,_0x57e3b8),_0x1cd674=_0x57e3b8;}}}const _0x41ba82={'name':_0x1cd674,'isJourneyLocal':_0x14e32a,'definition':_0x3d7d58};return _0x5a13fb[_0x453da6(0x110)](_0x5051bb,_0x41ba82),_0x41ba82;}catch(_0x11db36){return _0x379a48[_0x453da6(0x154)]&&console[_0x453da6(0x1b1)]('Warning:\x20Could\x20not\x20resolve\x20segment\x20'+_0x5051bb+':\x20'+_0x11db36[_0x453da6(0x18e)]),{'name':_0x5051bb,'isJourneyLocal':![]};}},'resolveActivation':async _0x50d99c=>{const _0x440add=_0x16e3f2,_0x27684f=_0x3244c1[_0x440add(0x104)](_0x50d99c);if(_0x27684f)return _0x27684f;try{const _0xd9ff1=await _0x4db2dd['journey']['getActivation'](_0x3ba678['id'],_0x50d99c),_0x1837ea=journeyActivationStepToYaml(_0xd9ff1,_0x10cbd8,_0x2afd96),_0x4eefe1=JSON[_0x440add(0xbf)]({'name':_0x1837ea[_0x440add(0xce)],'connection':_0x1837ea[_0x440add(0xf4)],'connector_config':_0x1837ea[_0x440add(0x13d)]}),_0x488292=_0x529ab1['get'](_0x4eefe1);if(_0x488292){const _0x65214={'name':_0x488292,'isJourneyLocal':!![],'definition':_0x1837ea};return _0x3244c1[_0x440add(0x110)](_0x50d99c,_0x65214),_0x65214;}const _0x866268=_0xd9ff1['attributes'][_0x440add(0x18a)][_0x440add(0xce)]||_0x50d99c,_0x531d6a=sanitizeYamlKey(_0x866268)||_0x440add(0xe8)+_0x50d99c;let _0x8f85b8=_0x531d6a,_0x2a7f74=0x2;while(_0x3163a5[_0x440add(0x1a7)](_0x8f85b8)){_0x8f85b8=_0x531d6a+'_'+_0x2a7f74,_0x2a7f74++;}_0x3163a5['add'](_0x8f85b8),_0x529ab1[_0x440add(0x110)](_0x4eefe1,_0x8f85b8);const _0x33afa4={'name':_0x8f85b8,'isJourneyLocal':!![],'definition':_0x1837ea};return _0x3244c1[_0x440add(0x110)](_0x50d99c,_0x33afa4),_0x33afa4;}catch(_0x22cff0){return _0x379a48[_0x440add(0x154)]&&console[_0x440add(0x1b1)]('Warning:\x20Could\x20not\x20resolve\x20activation\x20'+_0x50d99c+':\x20'+_0x22cff0[_0x440add(0x18e)]),{'name':_0x50d99c,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0xaf057d,_0x41ccb1)=>{return resolveJumpTarget(_0xaf057d,_0x41ccb1,_0xc6bf74,_0xaa3fd4=>_0x4db2dd['journey']['getJourney'](_0xaa3fd4));}},_0x14798c=await journeyResponseToDef(_0x1baf30,_0xdce78d);_0x55d94f[_0x16e3f2(0xd8)]({'item':_0x3ba678,'yaml':_0x14798c});}},{'verbose':_0x379a48[_0x5e4a27(0x154)]});const _0x1ba56d=await _0x4db2dd[_0x5e4a27(0x17b)][_0x5e4a27(0x167)](_0x107642[0x0]['journeyBundleId']),_0x5de47a=buildMergedJourneyDef(_0x55d94f,_0x2ed93f,_0x1ba56d),_0x5adaac=normalizeJourneyDef(_0x5de47a,_0x2005d3),_0x577825=toYamlString(_0x5adaac),_0xe45c34=_0x4c4460||a28_0x22a743[_0x5e4a27(0x116)](_0x30cedf,sanitizeFileName(_0x515467)+_0x5e4a27(0x1ac));!_0x4c4460&&_0x457a41&&!existsSync(_0x30cedf)&&mkdirSync(_0x30cedf,{'recursive':!![]});const _0x238a55=a28_0x22a743[_0x5e4a27(0x1a9)](process['cwd'](),_0xe45c34);if(existsSync(_0xe45c34)){const _0x3bf15c=readFileSync(_0xe45c34,_0x5e4a27(0x101)),_0x3237b8=generateDiff(_0x3bf15c,_0x577825),_0x1b779e=hasChanges(_0x3237b8);_0x87e391[_0x5e4a27(0xd8)]({'relativePath':_0x238a55,'absolutePath':_0xe45c34,'content':_0x577825,'isNew':![],'hasChanges':_0x1b779e,'diff':_0x1b779e?formatDiffWithColors(_0x3237b8):undefined});}else _0x87e391[_0x5e4a27(0xd8)]({'relativePath':_0x238a55,'absolutePath':_0xe45c34,'content':_0x577825,'isNew':!![],'hasChanges':![]});}const _0x1e8825=_0x87e391[_0x5e4a27(0x14c)](_0x379974=>_0x379974[_0x5e4a27(0x10d)]),_0x1cce91=_0x87e391[_0x5e4a27(0x14c)](_0x5175d2=>!_0x5175d2[_0x5e4a27(0x10d)]&&_0x5175d2[_0x5e4a27(0x159)]),_0x51e67c=_0x87e391[_0x5e4a27(0x14c)](_0x3883a1=>!_0x3883a1['isNew']&&!_0x3883a1[_0x5e4a27(0x159)]),_0x1c2342=_0x2354b6['length'],_0xe86285=_0x1b8899[_0x5e4a27(0xd2)],_0x5d3a5c=_0x1c2342>_0xe86285?'\x20('+_0x1c2342+'\x20versions)':'';console['error'](_0x5e4a27(0x112)),console['error']('\x20\x20'+a28_0x4a3c27['cyan'](_0xe86285+_0x5e4a27(0xef))+a28_0x4a3c27[_0x5e4a27(0xc0)](_0x5d3a5c)),console['error']('\x20\x20'+a28_0x4a3c27['green']('+\x20'+_0x1e8825[_0x5e4a27(0xd4)]+_0x5e4a27(0x17a))),console[_0x5e4a27(0x1b1)]('\x20\x20'+a28_0x4a3c27['yellow']('~\x20'+_0x1cce91[_0x5e4a27(0xd4)]+'\x20changed\x20files')),console[_0x5e4a27(0x1b1)]('\x20\x20'+a28_0x4a3c27[_0x5e4a27(0xc0)]('=\x20'+_0x51e67c[_0x5e4a27(0xd4)]+_0x5e4a27(0x16f))),console[_0x5e4a27(0x1b1)](_0x5e4a27(0x198)+a28_0x4a3c27[_0x5e4a27(0x172)](_0x41e80c)+'\x0a');if(_0x1cce91[_0x5e4a27(0xd4)]>0x0)for(const _0x2acc05 of _0x1cce91){console[_0x5e4a27(0x1b1)](_0x5e4a27(0x13e)+_0x2acc05['relativePath']+'\x27:'),console[_0x5e4a27(0x1b1)]('─'[_0x5e4a27(0x193)](0x3c)),console[_0x5e4a27(0x1b1)](_0x2acc05[_0x5e4a27(0x189)]),console[_0x5e4a27(0x1b1)]('─'['repeat'](0x3c));}if(_0x1c305e[_0x5e4a27(0x1c7)])return console[_0x5e4a27(0x1b1)](a28_0x4a3c27['yellow']('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x1e8825['length']===0x0&&_0x1cce91[_0x5e4a27(0xd4)]===0x0)return console['error'](a28_0x4a3c27[_0x5e4a27(0x111)](_0x5e4a27(0x184))),saveSessionContext({'parent_segment':_0xdd931f},_0x1c305e[_0x5e4a27(0x11b)]),console[_0x5e4a27(0x1b1)](a28_0x4a3c27[_0x5e4a27(0x111)](_0x5e4a27(0xfa)+a28_0x4a3c27[_0x5e4a27(0xc0)](_0x5e4a27(0xf9))+_0x5e4a27(0xc1)+a28_0x4a3c27[_0x5e4a27(0x172)](_0xdd931f))),0x0;if(!_0x1c305e[_0x5e4a27(0xfc)]&&(_0x1e8825[_0x5e4a27(0xd4)]>0x0||_0x1cce91[_0x5e4a27(0xd4)]>0x0)){if(!isInteractive())return console[_0x5e4a27(0x1b1)](a28_0x4a3c27[_0x5e4a27(0xcf)](_0x5e4a27(0x1be)),_0x5e4a27(0x156)),console[_0x5e4a27(0x1b1)](a28_0x4a3c27[_0x5e4a27(0xc0)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x7e2f82=await confirmKey('Write\x20'+(_0x1e8825['length']+_0x1cce91['length'])+_0x5e4a27(0xdb));if(!_0x7e2f82)return console[_0x5e4a27(0x1b1)](a28_0x4a3c27['yellow'](_0x5e4a27(0x10e)),_0x5e4a27(0xfb)),0x1;}!existsSync(_0x41e80c)&&mkdirSync(_0x41e80c,{'recursive':!![]});const _0x18a853=a28_0x22a743[_0x5e4a27(0x116)](_0x41e80c,_0x5e4a27(0xed));writeFileSync(_0x18a853,createTdxConfigContent(_0xdd931f),'utf-8');for(const _0x264aec of _0x87e391){(_0x264aec[_0x5e4a27(0x10d)]||_0x264aec[_0x5e4a27(0x159)])&&writeFileSync(_0x264aec[_0x5e4a27(0xe6)],_0x264aec['content'],_0x5e4a27(0x101));}return console[_0x5e4a27(0x1b1)](a28_0x4a3c27['green']('✔\x20Pulled\x20'+(_0x1e8825[_0x5e4a27(0xd4)]+_0x1cce91['length'])+'\x20journey\x20files\x20to\x20'+_0x41e80c)),saveSessionContext({'parent_segment':_0xdd931f},_0x1c305e['session']),console['error'](a28_0x4a3c27['green'](_0x5e4a27(0xfa)+a28_0x4a3c27['dim'](_0x5e4a27(0xf9))+_0x5e4a27(0xc1)+a28_0x4a3c27[_0x5e4a27(0x172)](_0xdd931f))),0x0;}}export class JourneyColumnsCommand extends BaseCommand{[a28_0x3eb276(0xce)]=a28_0x3eb276(0x14f);['description']=a28_0x3eb276(0x1a3);async['execute'](_0x57c612){const _0x2e4932=a28_0x3eb276,{options:_0xc9b8e,args:_0x5d9d23,tdx:_0x28804f}=_0x57c612,_0x263abf=_0x5d9d23[0x0];if(!requireNameOrPath(_0x263abf))return 0x1;_0xc9b8e[_0x2e4932(0x154)]&&console[_0x2e4932(0x1b1)](_0x2e4932(0x139)+_0x263abf);const {journeyId:_0x51f21d}=await resolveJourneyIdFromInput(_0x263abf,_0xc9b8e,_0x28804f),_0x39ba8b=await withSpinner('Getting\x20column\x20mapping...',()=>_0x28804f[_0x2e4932(0x17b)][_0x2e4932(0x17e)](_0x51f21d),{'verbose':_0xc9b8e[_0x2e4932(0x154)]}),_0x3649f4=_0x39ba8b[_0x2e4932(0x19d)];return console[_0x2e4932(0x155)](_0x2e4932(0x108)+_0x3649f4[_0x2e4932(0x117)]),console[_0x2e4932(0x155)](_0x2e4932(0x140)+_0x3649f4[_0x2e4932(0x17f)]),await handleSDKOutput(_0x3649f4['columns'],_0xc9b8e),0x0;}}export class JourneyActivationsCommand extends BaseCommand{[a28_0x3eb276(0xce)]=a28_0x3eb276(0x192);[a28_0x3eb276(0x1a2)]=a28_0x3eb276(0x141);async[a28_0x3eb276(0x16d)](_0x3885b8){const _0x36e0a7=a28_0x3eb276,{options:_0xa483c4,args:_0x797846,tdx:_0x23476c}=_0x3885b8,_0xf7c608=_0x797846[0x0];if(!requireNameOrPath(_0xf7c608))return 0x1;_0xa483c4['verbose']&&console[_0x36e0a7(0x1b1)]('Input:\x20'+_0xf7c608);const {journeyId:_0x44a663}=await resolveJourneyIdFromInput(_0xf7c608,_0xa483c4,_0x23476c),_0x4dbda4=await withSpinner('Listing\x20journey\x20activations...',()=>_0x23476c[_0x36e0a7(0x17b)]['listActivationsFlat'](_0x44a663),{'verbose':_0xa483c4[_0x36e0a7(0x154)]}),_0x16b7e8=_0x4dbda4['data'];return console[_0x36e0a7(0x1b1)](_0x36e0a7(0x13c)+_0x16b7e8[_0x36e0a7(0xd4)]+_0x36e0a7(0x18d)+(_0x16b7e8[_0x36e0a7(0xd4)]!==0x1?'s':'')),await handleSDKOutput(_0x16b7e8,_0xa483c4),0x0;}}export class JourneyPushCommand extends BaseCommand{[a28_0x3eb276(0xce)]=a28_0x3eb276(0x1b6);[a28_0x3eb276(0x1a2)]=a28_0x3eb276(0x119);['segmentPushCommand']=new SegmentPushCommand();async[a28_0x3eb276(0x16d)](_0x145094){const _0x4a075d=a28_0x3eb276,_0x4e3c65=_0x145094[_0x4a075d(0x179)][0x0];let _0x551b05;if(_0x4e3c65){const _0x2060aa=await resolveTarget({'arg':_0x4e3c65,'contextParent':_0x145094[_0x4a075d(0x1b9)][_0x4a075d(0x183)],'cwd':process[_0x4a075d(0xec)]()});isSuccessfulResolution(_0x2060aa)&&_0x2060aa[_0x4a075d(0x1a5)]===_0x4a075d(0x1bd)&&(_0x551b05=_0x2060aa['filePath']);}const _0x59ddc2={..._0x145094,'options':{..._0x145094[_0x4a075d(0x1b9)],'journeysOnly':!![],..._0x551b05&&{'singleFilePath':_0x551b05}}};return this[_0x4a075d(0x14d)][_0x4a075d(0x16d)](_0x59ddc2);}}function a28_0x49b9(_0x4044eb,_0x27accd){_0x4044eb=_0x4044eb-0xba;const _0x194acd=a28_0x194a();let _0x49b941=_0x194acd[_0x4044eb];return _0x49b941;}export class JourneyVersionsCommand extends BaseCommand{['name']=a28_0x3eb276(0xc8);[a28_0x3eb276(0x1a2)]='List\x20all\x20versions\x20of\x20a\x20journey';async[a28_0x3eb276(0x16d)](_0x40292f){const _0x2d315e=a28_0x3eb276,{options:_0x45310e,args:_0x545986,tdx:_0x41417f}=_0x40292f,_0x49c062=_0x545986[0x0];if(!requireNameOrPath(_0x49c062))return 0x1;if(_0x45310e[_0x2d315e(0x154)])console[_0x2d315e(0x1b1)]('Input:\x20'+_0x49c062);const {journeyId:_0x3438cb}=await resolveJourneyIdFromInput(_0x49c062,_0x45310e,_0x41417f),_0xc77a3=await withSpinner(_0x2d315e(0x1c5),()=>_0x41417f[_0x2d315e(0x17b)][_0x2d315e(0xd3)](_0x3438cb),{'verbose':_0x45310e[_0x2d315e(0x154)]}),{bundleName:_0x4e0cde,versions:_0x3b048e,latestJourneyId:_0x23d79d}=_0xc77a3['data'];console[_0x2d315e(0x1b1)](_0x4e0cde+':\x20'+_0x3b048e[_0x2d315e(0xd4)]+_0x2d315e(0x176)+(_0x3b048e['length']!==0x1?'s':''));const _0x2fe3d4=_0x3b048e[_0x2d315e(0x1ad)](_0x321001=>({'version':_0x321001[_0x2d315e(0x177)],'journey_id':_0x321001[_0x2d315e(0x148)],'name':_0x321001[_0x2d315e(0xce)],'state':_0x321001['state'],'paused':_0x321001[_0x2d315e(0xbe)],'latest':_0x321001['journeyId']===_0x23d79d,'created_at':_0x321001[_0x2d315e(0xdd)]}));return await handleSDKOutput(_0x2fe3d4,_0x45310e),0x0;}}export class JourneyVersionCreateCommand extends BaseCommand{['name']=a28_0x3eb276(0xda);[a28_0x3eb276(0x1a2)]='Create\x20a\x20new\x20draft\x20version\x20of\x20a\x20journey';async['execute'](_0x363ebb){const _0x53aae5=a28_0x3eb276,{options:_0x1eeecd,args:_0x2af08f,tdx:_0x227502}=_0x363ebb,_0x1ecb7b=_0x2af08f[0x0];if(!requireNameOrPath(_0x1ecb7b))return 0x1;if(_0x1eeecd['verbose'])console[_0x53aae5(0x1b1)](_0x53aae5(0x139)+_0x1ecb7b);const {journeyId:_0x4b3227,journeyName:_0x5c8b3c}=await resolveJourneyIdFromInput(_0x1ecb7b,_0x1eeecd,_0x227502);if(!_0x1eeecd[_0x53aae5(0xfc)]){const _0x5f20d1=await confirm(_0x53aae5(0x137)+_0x5c8b3c+'\x22?');if(!_0x5f20d1)return console[_0x53aae5(0x1b1)](_0x53aae5(0xe4)),0x0;}const _0x37215d=await withSpinner(_0x53aae5(0x115),()=>_0x227502['journey'][_0x53aae5(0x10a)](_0x4b3227),{'verbose':_0x1eeecd[_0x53aae5(0x154)]}),_0x36ce61=_0x37215d[_0x53aae5(0x19d)];return console[_0x53aae5(0x1b1)](a28_0x4a3c27[_0x53aae5(0x111)]('✔')+_0x53aae5(0x15f)+_0x36ce61[_0x53aae5(0x1c4)][_0x53aae5(0x177)]+_0x53aae5(0xd9)+_0x36ce61['attributes'][_0x53aae5(0xce)]+'\x22'),console[_0x53aae5(0x1b1)]('\x20\x20Journey\x20ID:\x20'+_0x36ce61['id']),await handleSingleObjectOutput({'id':_0x36ce61['id'],'name':_0x36ce61[_0x53aae5(0x1c4)]['name'],'version':_0x36ce61[_0x53aae5(0x1c4)][_0x53aae5(0x177)],'state':_0x36ce61[_0x53aae5(0x1c4)][_0x53aae5(0x142)],'bundle_id':_0x36ce61[_0x53aae5(0x1c4)]['journeyBundleId'],'created_at':_0x36ce61[_0x53aae5(0x1c4)]['createdAt']},_0x1eeecd),0x0;}}export class JourneyVersionViewCommand extends BaseCommand{[a28_0x3eb276(0xce)]=a28_0x3eb276(0x199);[a28_0x3eb276(0x1a2)]=a28_0x3eb276(0x147);async[a28_0x3eb276(0x16d)](_0x4f42cc){const _0xc6f0e=a28_0x3eb276,{options:_0x2a8010,args:_0x51c946,tdx:_0x5ec639}=_0x4f42cc,_0x1d4569=_0x51c946[0x0];if(!requireNameOrPath(_0x1d4569))return 0x1;const _0x38ff90=_0x2a8010[_0xc6f0e(0xd0)];if(!_0x38ff90)return console[_0xc6f0e(0x1b1)](_0xc6f0e(0x161)),console[_0xc6f0e(0x1b1)](_0xc6f0e(0xf8)),0x1;const _0x5302e6=parseInt(_0x38ff90,0xa);if(isNaN(_0x5302e6)||_0x5302e6<0x1)return console[_0xc6f0e(0x1b1)](_0xc6f0e(0x1a6)+_0x38ff90),0x1;if(_0x2a8010[_0xc6f0e(0x154)])console[_0xc6f0e(0x1b1)](_0xc6f0e(0x139)+_0x1d4569+_0xc6f0e(0x165)+_0x5302e6);const {journeyId:_0x243d92,parentSegmentId:_0x341149}=await resolveJourneyIdFromInput(_0x1d4569,_0x2a8010,_0x5ec639),_0x35da8c=await withSpinner(_0xc6f0e(0x163),()=>_0x5ec639[_0xc6f0e(0x17b)][_0xc6f0e(0xd3)](_0x243d92),{'verbose':_0x2a8010[_0xc6f0e(0x154)]}),{versions:_0xc9042f,latestJourneyId:_0x21c65d}=_0x35da8c[_0xc6f0e(0x19d)],_0x2f80ff=_0xc9042f[_0xc6f0e(0x120)](_0x53f403=>_0x53f403['versionNumber']===_0x5302e6);if(!_0x2f80ff){const _0x51af9c=_0xc9042f['map'](_0x53c626=>'v'+_0x53c626['versionNumber'])['join'](',\x20');return console[_0xc6f0e(0x1b1)](_0xc6f0e(0xc2)+_0x5302e6+_0xc6f0e(0x186)+_0x51af9c),0x1;}const _0x3949fb=await withSpinner(_0xc6f0e(0x11e)+_0x5302e6+_0xc6f0e(0xf0),()=>_0x5ec639[_0xc6f0e(0x17b)][_0xc6f0e(0x195)](_0x2f80ff[_0xc6f0e(0x148)]),{'verbose':_0x2a8010[_0xc6f0e(0x154)]}),_0x23a1a7=_0x3949fb[_0xc6f0e(0x19d)],_0x2fcdf3=getConsoleNextUrl(_0x2a8010[_0xc6f0e(0x123)],'/app/ps/'+_0x341149+'/e/'+_0x2f80ff[_0xc6f0e(0x148)]+_0xc6f0e(0x130));return await handleSingleObjectOutput({'id':_0x23a1a7['id'],'name':_0x23a1a7[_0xc6f0e(0x1c4)][_0xc6f0e(0xce)],'version':_0x23a1a7['attributes'][_0xc6f0e(0x177)],'description':_0x23a1a7['attributes'][_0xc6f0e(0x1a2)],'state':_0x23a1a7[_0xc6f0e(0x1c4)][_0xc6f0e(0x142)],'paused':_0x23a1a7[_0xc6f0e(0x1c4)][_0xc6f0e(0xbe)],'reentry_mode':_0x23a1a7['attributes'][_0xc6f0e(0xc9)],'stages':_0x23a1a7[_0xc6f0e(0x1c4)]['journeyStages']?.['length']||0x0,..._0x23a1a7[_0xc6f0e(0x1c4)]['goal']&&{'goal':_0x23a1a7[_0xc6f0e(0x1c4)][_0xc6f0e(0xbd)][_0xc6f0e(0xce)]},'latest':_0x2f80ff[_0xc6f0e(0x148)]===_0x21c65d,'created_at':_0x23a1a7[_0xc6f0e(0x1c4)][_0xc6f0e(0xdd)],'updated_at':_0x23a1a7['attributes']['updatedAt'],'url':_0x2fcdf3},_0x2a8010),0x0;}}
1
+ function a28_0x5a5f(_0xa6a75,_0x3929bb){_0xa6a75=_0xa6a75-0x8a;const _0x497284=a28_0x4972();let _0x5a5f02=_0x497284[_0xa6a75];return _0x5a5f02;}const a28_0x13f224=a28_0x5a5f;(function(_0x370102,_0x2e0ac7){const _0x53755c=a28_0x5a5f,_0x392eae=_0x370102();while(!![]){try{const _0x236d38=parseInt(_0x53755c(0x15c))/0x1*(-parseInt(_0x53755c(0x17d))/0x2)+parseInt(_0x53755c(0x134))/0x3+-parseInt(_0x53755c(0x177))/0x4+-parseInt(_0x53755c(0x191))/0x5+-parseInt(_0x53755c(0x180))/0x6+-parseInt(_0x53755c(0xb6))/0x7+parseInt(_0x53755c(0x8d))/0x8;if(_0x236d38===_0x2e0ac7)break;else _0x392eae['push'](_0x392eae['shift']());}catch(_0x4c9d60){_0x392eae['push'](_0x392eae['shift']());}}}(a28_0x4972,0xb72ac));import a28_0x428bd7 from'chalk';import a28_0x28a74c from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{aggregateStageHistory,assembleJourneyStats,buildStageNameMap}from'../sdk/journey.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey,isInteractive}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';function a28_0x4972(){const _0x5e0126=['/app/ps/','connection','buildIdToNameMap','Warning:\x20Could\x20not\x20resolve\x20activation\x20','\x22.\x20Must\x20be\x20\x22conversion\x22\x20or\x20\x22activation\x22.','1053747CBQqAI','segmentPushCommand','stages','parentSegment','getSegment','resolveJourneyId','getTrafficData','If\x20the\x20journey\x20is\x20active,\x20the\x20date\x20range\x20may\x20be\x20too\x20wide.\x20Try\x20a\x20shorter\x20period\x20(max\x20~90\x20days).','Parent\x20segment:\x20','Options:','Error:\x20','toLowerCase','log','✔\x20Journey\x20\x22','📁\x20','\x20=\x20','Cancelled','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','journey:push','journey:view','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','\x20\x20Statistics\x20not\x20available','\x20details...','listJourneysFromParentSegment','(running)','journey:pause','diff','format','journey','\x20unchanged\x20files','\x22\x20resumed','archived','hasChanges','Available\x20stages:\x20','error','journey:resume','(paused)','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','listActivationsFlat','2jljOBk','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','attributes','createdAt','table','errorCode','\x20journey\x20files\x20to\x20','size','\x20new\x20files','completionRate','add','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','\x5c$&','listJourneysWithFolders','launched','from','folderPath','(draft)','journey:pull','\x20version','\x20\x20Journey\x20ID:\x20','Warning:\x20Could\x20not\x20resolve\x20segment\x20','Could\x20not\x20resolve\x20parent\x20segment.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','exitOrJumpRate','\x20changed\x20files','sort','green','382696wlKllS','\x20journeys','join','\x20versions)','Resolving\x20journey...','Table:\x20','505094tEjuSw','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','journey:stats','3888864VgWXNO','push','versionNumber','Found\x20','localeCompare','segments','INVALID_ARGUMENT','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)','test','Error:\x20Invalid\x20--type\x20\x22','Resolved\x20YAML\x20file:\x20','split','List\x20journeys\x20in\x20current\x20context','Resume\x20a\x20paused\x20journey','includeHistory','Usage:\x20journey\x20<subcommand>\x20<name-or-path>','options','7382390KgLXpi','\x20->\x20','journey:versions','journey:version:view','dryRun','Error:\x20Journey\x20\x27','\x20(rule\x20match)','\x0aChanges\x20to\x20\x27','paused','goalSize','27435352ifnyoO','Write\x20','targetDir','isNew','yellow','version','Target\x20file:\x20','segmentName','\x27\x20not\x20found\x20in\x20','No\x20journeys\x20found','Fetching\x20users\x20and\x20connections...','journeys','Error:\x20Parent\x20segment\x20context\x20required','updatedAt','data','cwd','activation','\x20\x20Name:\x20','json','journey:list','relativePath','yes','cyan','args','stageNameMap','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','List\x20activations\x20for\x20a\x20journey','Fetching\x20journeys\x20and\x20folders...','buildIdToEmailMap','site','exitOrJumpSize','Get\x20journey\x20traffic\x20data\x20(Sankey\x20charts)','columns','message','stringify','\x20activation','\x20\x20Consolidating\x20duplicate\x20segment:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','type','listFolders','journeyName','2135182NOeLUP','journeyStages','\x0aError:','completeMilestoneRate','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','journeyBundleId','folderId','set','Getting\x20journey\x20details...','find','\x20Created\x20v','history','journeyId','Getting\x20column\x20mapping...','segment','pause','enteredSize','completed','\x20\x20-\x20','getColumnMapping','(completed)','utf-8','user','jsonl','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Error:\x20Journey\x20not\x20found:\x20','\x20not\x20found.\x20Available:\x20','.yml','Aborted.','listVersions','folders','activation_','-\x20no\x20files\x20written','file','filter','\x20\x20Target:\x20','Pause\x20a\x20running\x20journey','parent_segment','values','/e/','Pausing\x20journey...','\x20(ID:\x20','resolveSegment','audienceId','(root)','includeStats','goal','resolveParentId','\x20\x20Folder\x20path:\x20','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','web','base','get','journey:activations','bold','description','has','🗺️\x20','Create\x20a\x20new\x20draft\x20version\x20of\x20journey\x20\x22','map','rule','Input:\x20','✔\x20All\x20files\x20are\x20up\x20to\x20date','Pattern:\x20','stage','replace','state','\x22\x20paused','all','Listing\x20journeys...','/j/da/je','reentryMode','Fetching\x20','length','execute','Getting\x20journey\x20statistics...','✔\x20Context\x20set:\x20','tsv','session','renderStats','entries','Traffic\x20data\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','conversion','getActivation','parentName','Getting\x20version\x20','dim','...','Resolving\x20version...','Folder\x20path:\x20','getJourney','draft','helpText','getStatistics','verbose','name','journeyBundleName','absolutePath','Error:\x20Stage\x20\x22','tdx.json','blue','connector_config','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','Fetching\x20parent\x20segment...','Resolving\x20parent\x20segment...','milestoneSize','Usage:\x20journey\x20version\x20view\x20<name-or-path>\x20--version\x20N','journey:traffic','nodes','rootFolderId','✔\x20Found\x20','\x20Opening\x20','limit','resourceName','kind','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','filePath','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Listing\x20journey\x20versions...','createVersion'];a28_0x4972=function(){return _0x5e0126;};return a28_0x4972();}import{SegmentPushCommand}from'./segment-push-command.js';import{buildFolderIdToPathMap}from'../sdk/segment/resolution-context.js';import{createTdxConfigContent}from'../sdk/segment/tdx-config.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 requireNameOrPath(_0x2177b3){const _0x260fd6=a28_0x5a5f;return!_0x2177b3&&(console['error'](_0x260fd6(0xa6)),console[_0x260fd6(0x156)](_0x260fd6(0x18f))),!!_0x2177b3;}function withJsonFormat(_0x4542a5){const _0x40477f=a28_0x5a5f;if(!_0x4542a5[_0x40477f(0x14f)]&&!_0x4542a5[_0x40477f(0x9f)]&&!_0x4542a5[_0x40477f(0xcd)]&&!_0x4542a5[_0x40477f(0x103)])return{..._0x4542a5,'format':'json','json':!![]};return _0x4542a5;}function formatJourneyState(_0x1a4ff6){const _0x3b0ef8=a28_0x5a5f;switch(_0x1a4ff6){case _0x3b0ef8(0x16a):return a28_0x428bd7['green'](_0x3b0ef8(0x14c));case _0x3b0ef8(0x111):return a28_0x428bd7[_0x3b0ef8(0x10c)](_0x3b0ef8(0x16d));case _0x3b0ef8(0x8b):return a28_0x428bd7[_0x3b0ef8(0x91)](_0x3b0ef8(0x158));case _0x3b0ef8(0xc7):return a28_0x428bd7[_0x3b0ef8(0x11a)](_0x3b0ef8(0xca));case _0x3b0ef8(0x153):return a28_0x428bd7[_0x3b0ef8(0x10c)]('(archived)');default:return'('+_0x1a4ff6+')';}}function formatJourneyItem(_0x38e719,_0x2ab88c='',_0x5a3219){const _0x417a83=a28_0x5a5f,_0x88c76e=formatJourneyState(_0x38e719[_0x417a83(0xf8)]),_0x26e013=_0x5a3219?hyperlink(_0x38e719['journeyBundleName'],_0x5a3219):_0x38e719[_0x417a83(0x116)];return _0x2ab88c+_0x417a83(0xef)+_0x26e013+'\x20'+_0x88c76e;}function escapeRegex(_0x5c388a){const _0x1d676d=a28_0x5a5f;return _0x5c388a[_0x1d676d(0xf7)](/[.*+?^${}()|[\]\\]/g,_0x1d676d(0x168));}function globToRegex(_0x13d694){const _0x391c80=a28_0x5a5f,_0x46a3ae=_0x13d694[_0x391c80(0x18b)]('*')[_0x391c80(0xf1)](escapeRegex);return new RegExp(_0x46a3ae[_0x391c80(0x179)]('.*'),'i');}function buildRuleToNameMapping(_0x5ce9a2){const _0x324387=a28_0x5a5f,_0x2dde7c=new Map();if(_0x5ce9a2[_0x324387(0x185)])for(const [_0x3bfb73,_0x48d690]of Object['entries'](_0x5ce9a2[_0x324387(0x185)])){if(_0x48d690[_0x324387(0xf2)]){const _0x3995bb=serializeRule(_0x48d690[_0x324387(0xf2)]),_0x36c869=_0x2dde7c[_0x324387(0xea)](_0x3995bb);_0x36c869?_0x36c869[_0x324387(0x181)](_0x3bfb73):_0x2dde7c[_0x324387(0xbd)](_0x3995bb,[_0x3bfb73]);}}return _0x2dde7c;}async function resolveJourneyIdFromInput(_0x29c8f2,_0x280069,_0x49c686){const _0x1800ba=a28_0x5a5f,_0x3eb712=await resolveJourneyTarget(_0x29c8f2,_0x280069['parentSegment'],_0x280069['verbose']),_0x4a63a4=_0x3eb712['parentSegment'];if(!_0x4a63a4)throw new SDKError(ErrorCode[_0x1800ba(0x186)],_0x1800ba(0x172));const _0x5a0a48=await withSpinner(_0x1800ba(0x11f),()=>_0x49c686[_0x1800ba(0xc4)][_0x1800ba(0xe5)](_0x4a63a4),{'verbose':_0x280069[_0x1800ba(0x114)]}),_0x3e5467=_0x5a0a48['data'],_0x41d82b=await withSpinner(_0x1800ba(0x17b),()=>_0x49c686[_0x1800ba(0x150)][_0x1800ba(0x139)](_0x3e5467,_0x3eb712[_0x1800ba(0xb5)]),{'verbose':_0x280069[_0x1800ba(0x114)]});return{'journeyId':_0x41d82b[_0x1800ba(0x9b)],'journeyName':_0x3eb712[_0x1800ba(0xb5)],'parentSegmentId':_0x3e5467};}async function resolveJourneyTarget(_0x5baf80,_0x2d84d1,_0x4d6803){const _0x2ca28a=a28_0x5a5f;if(isYamlFilePath(_0x5baf80))try{const _0x28850c=await resolveYamlFilePath(_0x5baf80);return _0x4d6803&&(console['error'](_0x2ca28a(0x18a)+_0x5baf80),console[_0x2ca28a(0x156)]('\x20\x20Parent\x20segment:\x20'+_0x28850c['parentSegment']),console[_0x2ca28a(0x156)](_0x2ca28a(0x9e)+_0x28850c[_0x2ca28a(0x94)]),console[_0x2ca28a(0x156)](_0x2ca28a(0xe6)+(_0x28850c[_0x2ca28a(0x16c)]||_0x2ca28a(0xe2)))),{'journeyName':_0x28850c[_0x2ca28a(0x94)],'parentSegment':_0x28850c[_0x2ca28a(0x137)],'resolved':_0x28850c};}catch(_0x4d7e99){throw new SDKError(ErrorCode[_0x2ca28a(0x186)],_0x2ca28a(0x12c)+_0x4d7e99[_0x2ca28a(0xae)]);}if(!_0x2d84d1)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return{'journeyName':_0x5baf80,'parentSegment':_0x2d84d1};}export class JourneyListCommand extends BaseCommand{[a28_0x13f224(0x115)]=a28_0x13f224(0xa0);[a28_0x13f224(0xed)]=a28_0x13f224(0x18c);async['execute'](_0x18d4a1){const _0x2e519e=a28_0x13f224,{options:_0x321672,args:_0x88f137,tdx:_0x670b98}=_0x18d4a1,_0x3a9bb6=_0x88f137[0x0],_0x680b0d=_0x321672[_0x2e519e(0x137)];if(!_0x680b0d)return console[_0x2e519e(0x156)](_0x2e519e(0x99)),console['error']('Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22'),0x1;const _0x33fa99=await withSpinner(_0x2e519e(0x11f),()=>_0x670b98[_0x2e519e(0xc4)]['resolveParentId'](_0x680b0d),{'verbose':_0x321672[_0x2e519e(0x114)]}),_0x31545f=_0x33fa99['data'];_0x321672[_0x2e519e(0x114)]&&(console['error'](_0x2e519e(0x13c)+_0x680b0d+_0x2e519e(0xdf)+_0x31545f+')'),_0x3a9bb6&&console[_0x2e519e(0x156)](_0x2e519e(0xf5)+_0x3a9bb6));const _0x10fc20=await withSpinner(_0x2e519e(0x11e),()=>_0x670b98[_0x2e519e(0xc4)]['getParentFull'](_0x31545f),{'verbose':_0x321672[_0x2e519e(0x114)]}),_0x227141=_0x10fc20['data'],_0x41955f=_0x227141[_0x2e519e(0x124)],_0x1f357e=await withSpinner(_0x2e519e(0xfb),()=>_0x670b98[_0x2e519e(0x150)][_0x2e519e(0x169)](_0x31545f,_0x41955f),{'verbose':_0x321672[_0x2e519e(0x114)]});let _0x5e9d3d=_0x1f357e[_0x2e519e(0x9b)][_0x2e519e(0x98)];const _0xa734c9=_0x1f357e[_0x2e519e(0x9b)][_0x2e519e(0xd4)],_0x42a781=new Map();for(const _0xbbde6f of _0xa734c9){_0x42a781[_0x2e519e(0xbd)](_0xbbde6f['id'],_0xbbde6f[_0x2e519e(0x115)]);}if(_0x3a9bb6){const _0xa30349=globToRegex(_0x3a9bb6);_0x5e9d3d=_0x5e9d3d['filter'](_0xcc21db=>_0xa30349[_0x2e519e(0x188)](_0xcc21db[_0x2e519e(0x116)]));}console[_0x2e519e(0x156)](_0x2e519e(0x125)+_0x5e9d3d[_0x2e519e(0xff)]+'\x20journey'+(_0x5e9d3d[_0x2e519e(0xff)]!==0x1?'s':''));const _0x1e8b9d=_0x5275da=>{const _0x4b9587=_0x2e519e;return getConsoleNextUrl(_0x321672[_0x4b9587(0xaa)],_0x4b9587(0x12f)+_0x31545f+'/e/'+_0x5275da+'/j/da');};if(_0x321672[_0x2e519e(0x14f)]===_0x2e519e(0x160))await handleSDKOutput(_0x5e9d3d,_0x321672);else{if(_0x321672[_0x2e519e(0x14f)]===_0x2e519e(0x9f)){const _0x3edb63=_0x5e9d3d[_0x2e519e(0xf1)](_0x301342=>({..._0x301342,'url':_0x1e8b9d(_0x301342['id'])}));await handleSDKOutput(_0x3edb63,_0x321672);}else{console['log']('['+_0x680b0d+']');const _0x2c8d9a=new Map(),_0x97705a=[];for(const _0x191093 of _0x5e9d3d){if(!_0x191093['folderId']||_0x191093[_0x2e519e(0xbc)]===_0x41955f)_0x97705a[_0x2e519e(0x181)](_0x191093);else{const _0xf97356=_0x2c8d9a[_0x2e519e(0xea)](_0x191093['folderId'])||[];_0xf97356[_0x2e519e(0x181)](_0x191093),_0x2c8d9a[_0x2e519e(0xbd)](_0x191093[_0x2e519e(0xbc)],_0xf97356);}}const _0x14595d=(_0x1b6b9c,_0x2b2414)=>_0x1b6b9c[_0x2e519e(0x116)]['localeCompare'](_0x2b2414[_0x2e519e(0x116)],undefined,{'sensitivity':_0x2e519e(0xe9)});_0x97705a[_0x2e519e(0x175)](_0x14595d);for(const _0x2058b4 of _0x97705a){console[_0x2e519e(0x140)](formatJourneyItem(_0x2058b4,'',_0x1e8b9d(_0x2058b4['id'])));}const _0x151b89=[..._0x2c8d9a[_0x2e519e(0x106)]()][_0x2e519e(0x175)]((_0x47075c,_0x38df0b)=>{const _0x4f4d1f=_0x2e519e,_0x1e859=_0x42a781[_0x4f4d1f(0xea)](_0x47075c[0x0])||_0x47075c[0x0],_0x49d8a4=_0x42a781[_0x4f4d1f(0xea)](_0x38df0b[0x0])||_0x38df0b[0x0];return _0x1e859[_0x4f4d1f(0x184)](_0x49d8a4,undefined,{'sensitivity':_0x4f4d1f(0xe9)});});for(const [_0x2c593e,_0x1b1940]of _0x151b89){const _0x561364=_0x42a781['get'](_0x2c593e)||_0x2c593e;console['log'](_0x2e519e(0x142)+_0x561364),_0x1b1940[_0x2e519e(0x175)](_0x14595d);for(const _0x19caea of _0x1b1940){console[_0x2e519e(0x140)](formatJourneyItem(_0x19caea,'\x20\x20',_0x1e8b9d(_0x19caea['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{['name']=a28_0x13f224(0x147);[a28_0x13f224(0xed)]='Show\x20journey\x20details';async[a28_0x13f224(0x100)](_0x491db9){const _0x395c4c=a28_0x13f224,{options:_0x24fe92,args:_0x26da5d,tdx:_0x29329a}=_0x491db9,_0x3d3a23=_0x26da5d[0x0];if(!_0x3d3a23)return console[_0x395c4c(0x156)](_0x395c4c(0xa6)),console[_0x395c4c(0x156)](_0x395c4c(0xe7)),console[_0x395c4c(0x156)](_0x395c4c(0x13d)),console[_0x395c4c(0x156)](_0x395c4c(0x148)),0x1;_0x24fe92[_0x395c4c(0x114)]&&console[_0x395c4c(0x156)](_0x395c4c(0xf3)+_0x3d3a23);const {journeyId:_0x1d4651,parentSegmentId:_0x341d2e}=await resolveJourneyIdFromInput(_0x3d3a23,_0x24fe92,_0x29329a);if(_0x24fe92[_0x395c4c(0xe8)]){const _0x2fb1a7=getConsoleNextUrl(_0x24fe92[_0x395c4c(0xaa)],_0x395c4c(0x12f)+_0x341d2e+_0x395c4c(0xdd)+_0x1d4651+_0x395c4c(0xfc));return console[_0x395c4c(0x156)](a28_0x428bd7['green']('✔')+_0x395c4c(0x126)+a28_0x428bd7['cyan'](_0x2fb1a7)),openBrowser(_0x2fb1a7),0x0;}const _0x4d19f9=await withSpinner(_0x395c4c(0xbe),()=>_0x29329a[_0x395c4c(0x150)]['getJourney'](_0x1d4651),{'verbose':_0x24fe92[_0x395c4c(0x114)]}),_0x2e1d8f=_0x4d19f9[_0x395c4c(0x9b)],_0x566046=_0x24fe92[_0x395c4c(0xe3)];let _0x495342;if(_0x566046)try{const _0x308fc8=await withSpinner(_0x395c4c(0x101),()=>_0x29329a[_0x395c4c(0x150)][_0x395c4c(0x113)](_0x1d4651),{'verbose':_0x24fe92[_0x395c4c(0x114)]});_0x495342=_0x308fc8[_0x395c4c(0x9b)];}catch{_0x24fe92[_0x395c4c(0x114)]&&console[_0x395c4c(0x156)](_0x395c4c(0x149));}const _0x543778=getConsoleNextUrl(_0x24fe92[_0x395c4c(0xaa)],_0x395c4c(0x12f)+_0x341d2e+'/e/'+_0x1d4651+_0x395c4c(0xfc)),_0x4f8396={'id':_0x2e1d8f['id'],'name':_0x2e1d8f[_0x395c4c(0x15e)][_0x395c4c(0x115)],'description':_0x2e1d8f[_0x395c4c(0x15e)][_0x395c4c(0xed)],'state':_0x2e1d8f[_0x395c4c(0x15e)][_0x395c4c(0xf8)],'paused':_0x2e1d8f['attributes']['paused'],'reentry_mode':_0x2e1d8f[_0x395c4c(0x15e)][_0x395c4c(0xfd)],'stages':_0x2e1d8f[_0x395c4c(0x15e)][_0x395c4c(0xb7)]?.[_0x395c4c(0xff)]||0x0,..._0x2e1d8f[_0x395c4c(0x15e)][_0x395c4c(0xe4)]&&{'goal':_0x2e1d8f[_0x395c4c(0x15e)][_0x395c4c(0xe4)][_0x395c4c(0x115)]},..._0x495342&&{'statistics':{'size':_0x495342[_0x395c4c(0x163)],'entered':_0x495342[_0x395c4c(0xc6)],'goal_achieved':_0x495342[_0x395c4c(0x8c)],'completion_rate':_0x495342[_0x395c4c(0x165)],'exit_or_jump':_0x495342[_0x395c4c(0xab)],'exit_or_jump_rate':_0x495342['exitOrJumpRate'],'stages':_0x495342['stages']}},'url':_0x543778};return await handleSingleObjectOutput(_0x4f8396,_0x24fe92),0x0;}}export class JourneyStatsCommand extends BaseCommand{['name']=a28_0x13f224(0x17f);[a28_0x13f224(0xed)]='Show\x20journey\x20statistics';async[a28_0x13f224(0x100)](_0x131355){const _0x48362c=a28_0x13f224,{options:_0x337ad5,args:_0x33e562,tdx:_0x400233}=_0x131355,_0x20916c=_0x33e562[0x0];if(!requireNameOrPath(_0x20916c))return 0x1;_0x337ad5[_0x48362c(0x114)]&&console[_0x48362c(0x156)](_0x48362c(0xf3)+_0x20916c);const _0xcd662e=_0x337ad5,_0x47eefb=_0xcd662e[_0x48362c(0x16b)],_0x1e719f=_0xcd662e['to'],_0x2cec4a=_0xcd662e[_0x48362c(0x18e)],_0x1f3571=_0xcd662e[_0x48362c(0xf6)];_0x2cec4a&&!_0x47eefb&&!_0x1e719f&&console[_0x48362c(0x156)]('Warning:\x20--include-history\x20without\x20--from/--to\x20may\x20return\x20all-time\x20history');const _0x4f143d=_0x2cec4a?withJsonFormat(_0x337ad5):_0x337ad5,{journeyId:_0x1fbe72,journeyName:_0x7517a3}=await resolveJourneyIdFromInput(_0x20916c,_0x4f143d,_0x400233),_0x1a4b3d=_0x47eefb||_0x1e719f?{'from':_0x47eefb,'to':_0x1e719f}:undefined,_0x5d6f9b=await withSpinner(_0x48362c(0x101),()=>Promise[_0x48362c(0xfa)]([_0x400233['journey'][_0x48362c(0x110)](_0x1fbe72),_0x400233[_0x48362c(0x150)][_0x48362c(0x113)](_0x1fbe72,_0x1a4b3d)]),{'verbose':_0x4f143d[_0x48362c(0x114)]}),[_0x3d8459,_0x55bece]=_0x5d6f9b['data'];if(!_0x55bece||_0x55bece[_0x48362c(0xc2)]===null)return console['error']('No\x20statistics\x20available\x20for\x20journey:\x20'+_0x7517a3),console[_0x48362c(0x156)](_0x48362c(0x17e)),0x0;const _0xaf7b9c=buildStageNameMap(_0x3d8459),_0x19eaac=!!(_0x1a4b3d&&_0x55bece[_0x48362c(0xc1)]?.[_0x48362c(0xff)]),_0x5c964f={'stageNameMap':_0xaf7b9c,'hasPeriod':_0x19eaac,'includeHistory':!!_0x2cec4a};if(_0x1f3571&&_0x55bece['stages']){const _0x1889c6=_0x55bece['stages']['find'](_0x47c3ca=>{const _0xb0abde=_0x48362c,_0x189cec=_0xaf7b9c[_0xb0abde(0xea)](_0x47c3ca['id'])??'';return _0x189cec[_0xb0abde(0x13f)]()===_0x1f3571['toLowerCase']();});if(_0x1889c6)return await handleSingleObjectOutput(formatStageStats(_0x1889c6,_0x5c964f),_0x4f143d),0x0;const _0x33cf69=_0x55bece[_0x48362c(0x136)][_0x48362c(0xf1)](_0x4e169b=>_0xaf7b9c[_0x48362c(0xea)](_0x4e169b['id'])??_0x4e169b['id']);return console[_0x48362c(0x156)](_0x48362c(0x118)+_0x1f3571+'\x22\x20not\x20found'),console[_0x48362c(0x156)](_0x48362c(0x155)+_0x33cf69['join'](',\x20')),0x1;}const _0x2a1d22=_0x55bece['stages']?.[_0x48362c(0xf1)](_0x4a035e=>formatStageStats(_0x4a035e,_0x5c964f)),_0x5d6590=assembleJourneyStats(_0x55bece,{'from':_0x47eefb,'to':_0x1e719f,'includeHistory':_0x2cec4a});return await this[_0x48362c(0x105)](_0x5d6590,_0x2a1d22??[],_0x4f143d),0x0;}async[a28_0x13f224(0x105)](_0x3ef4d3,_0x32f15b,_0xcd2613){const _0x2bb132=a28_0x13f224,_0xa6dd01=_0xcd2613[_0x2bb132(0x14f)]===_0x2bb132(0x9f)||_0xcd2613['format']===_0x2bb132(0xcd)||_0xcd2613[_0x2bb132(0x9f)]||_0xcd2613['jsonl'];if(_0xa6dd01){_0x3ef4d3[_0x2bb132(0x136)]=_0x32f15b,await handleSingleObjectOutput(_0x3ef4d3,_0xcd2613);return;}await handleSingleObjectOutput(_0x3ef4d3,_0xcd2613);for(const _0x368d58 of _0x32f15b){console['log'](''),console[_0x2bb132(0x140)](String(a28_0x428bd7[_0x2bb132(0xa3)][_0x2bb132(0xec)]('['+_0x368d58['name']+']'))+a28_0x428bd7[_0x2bb132(0x10c)]('\x20'+_0x368d58['id']));const {id:_0x165a00,name:_0x45e47c,..._0x57e81f}=_0x368d58;await handleSingleObjectOutput(_0x57e81f,_0xcd2613);}}}export class JourneyTrafficCommand extends BaseCommand{[a28_0x13f224(0x115)]=a28_0x13f224(0x122);[a28_0x13f224(0xed)]=a28_0x13f224(0xac);async[a28_0x13f224(0x100)](_0x154ad0){const _0x4ffddd=a28_0x13f224,{options:_0x597eec,args:_0x3e5cb7,tdx:_0x1eb46c}=_0x154ad0,_0x49ab87=_0x3e5cb7[0x0];if(!requireNameOrPath(_0x49ab87))return 0x1;_0x597eec[_0x4ffddd(0x114)]&&console['error'](_0x4ffddd(0xf3)+_0x49ab87);const _0x3a827c=_0x597eec,_0x5a3aef=_0x3a827c[_0x4ffddd(0xb3)],_0x251063=_0x3a827c[_0x4ffddd(0x16b)],_0x2d57d2=_0x3a827c['to'],_0xfecde2=_0x3a827c[_0x4ffddd(0x127)];if(_0x5a3aef&&_0x5a3aef!==_0x4ffddd(0x108)&&_0x5a3aef!==_0x4ffddd(0x9d))return console[_0x4ffddd(0x156)](_0x4ffddd(0x189)+_0x5a3aef+_0x4ffddd(0x133)),0x1;const _0x43ee35=withJsonFormat(_0x597eec),{journeyId:_0x49de94,journeyName:_0x3a8a12}=await resolveJourneyIdFromInput(_0x49ab87,_0x43ee35,_0x1eb46c),_0x124715={'type':_0x5a3aef,'from':_0x251063,'to':_0x2d57d2,'limit':_0xfecde2},_0x4e55e1=await withSpinner('Getting\x20journey\x20traffic\x20data...',()=>_0x1eb46c['journey'][_0x4ffddd(0x13a)](_0x49de94,_0x124715),{'verbose':_0x43ee35[_0x4ffddd(0x114)]}),_0x458f73=_0x4e55e1[_0x4ffddd(0x9b)],_0x47b84d=_0x458f73['conversion']&&(_0x458f73[_0x4ffddd(0x108)][_0x4ffddd(0x123)][_0x4ffddd(0xff)]>0x0||_0x458f73[_0x4ffddd(0x108)]['links'][_0x4ffddd(0xff)]>0x0),_0x3f1c32=_0x458f73[_0x4ffddd(0x9d)]&&_0x458f73[_0x4ffddd(0x9d)][_0x4ffddd(0xff)]>0x0;if(!_0x47b84d&&!_0x3f1c32)return console[_0x4ffddd(0x156)]('No\x20traffic\x20data\x20available\x20for\x20journey:\x20'+_0x3a8a12),console[_0x4ffddd(0x156)](_0x4ffddd(0x107)),_0x251063&&_0x2d57d2&&console[_0x4ffddd(0x156)](_0x4ffddd(0x13b)),0x0;return await handleSingleObjectOutput(_0x458f73,_0x43ee35),0x0;}}function formatStageStats(_0x4719d4,_0x2cd13e){const _0x3b0f2c=a28_0x13f224,_0xb37b85=_0x2cd13e['hasPeriod']&&_0x4719d4[_0x3b0f2c(0xc1)]?.['length']?aggregateStageHistory(_0x4719d4['history']):{'size':_0x4719d4[_0x3b0f2c(0x163)],'entered':_0x4719d4[_0x3b0f2c(0xc6)],'milestone':_0x4719d4[_0x3b0f2c(0x120)],'milestone_rate':_0x4719d4[_0x3b0f2c(0xb9)],'exit_or_jump':_0x4719d4[_0x3b0f2c(0xab)],'exit_or_jump_rate':_0x4719d4[_0x3b0f2c(0x173)]},_0x2357e4={'id':_0x4719d4['id'],'name':_0x2cd13e[_0x3b0f2c(0xa5)][_0x3b0f2c(0xea)](_0x4719d4['id'])??_0x4719d4['id'],..._0xb37b85};return _0x2cd13e['hasPeriod']&&_0x2cd13e[_0x3b0f2c(0x18e)]&&_0x4719d4[_0x3b0f2c(0xc1)]&&(_0x2357e4[_0x3b0f2c(0xc1)]=_0x4719d4[_0x3b0f2c(0xc1)]),_0x2357e4;}export class JourneyPauseCommand extends BaseCommand{['name']=a28_0x13f224(0x14d);['description']=a28_0x13f224(0xda);async[a28_0x13f224(0x100)](_0x5dc61b){const _0x4f7126=a28_0x13f224,{options:_0x1b3b53,args:_0x3902a3,tdx:_0x4b69ab}=_0x5dc61b,_0x1715fa=_0x3902a3[0x0];if(!requireNameOrPath(_0x1715fa))return 0x1;_0x1b3b53[_0x4f7126(0x114)]&&console[_0x4f7126(0x156)](_0x4f7126(0xf3)+_0x1715fa);const {journeyId:_0x4d732c,journeyName:_0x31bd02}=await resolveJourneyIdFromInput(_0x1715fa,_0x1b3b53,_0x4b69ab);if(!_0x1b3b53[_0x4f7126(0xa2)]){const _0x2b32ad=await confirm(_0x4f7126(0xb2)+_0x31bd02+'\x22?');if(!_0x2b32ad)return console[_0x4f7126(0x156)](_0x4f7126(0x144)),0x0;}const _0x3c4297=await withSpinner(_0x4f7126(0xde),()=>_0x4b69ab['journey'][_0x4f7126(0xc5)](_0x4d732c),{'verbose':_0x1b3b53[_0x4f7126(0x114)]}),_0x362c01=_0x3c4297[_0x4f7126(0x9b)];return console[_0x4f7126(0x156)]('✔\x20Journey\x20\x22'+_0x362c01[_0x4f7126(0x15e)]['name']+_0x4f7126(0xf9)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a28_0x13f224(0x115)]=a28_0x13f224(0x157);[a28_0x13f224(0xed)]=a28_0x13f224(0x18d);async[a28_0x13f224(0x100)](_0x898cb6){const _0x37e143=a28_0x13f224,{options:_0x5653e7,args:_0x560c21,tdx:_0x1c0eb8}=_0x898cb6,_0x1d70f7=_0x560c21[0x0];if(!requireNameOrPath(_0x1d70f7))return 0x1;_0x5653e7[_0x37e143(0x114)]&&console[_0x37e143(0x156)](_0x37e143(0xf3)+_0x1d70f7);const {journeyId:_0x318055,journeyName:_0x188db5}=await resolveJourneyIdFromInput(_0x1d70f7,_0x5653e7,_0x1c0eb8);if(!_0x5653e7[_0x37e143(0xa2)]){const _0x34cac2=await confirm(_0x37e143(0x12a)+_0x188db5+'\x22?');if(!_0x34cac2)return console[_0x37e143(0x156)](_0x37e143(0x144)),0x0;}const _0x17bf26=await withSpinner('Resuming\x20journey...',()=>_0x1c0eb8[_0x37e143(0x150)]['resume'](_0x318055),{'verbose':_0x5653e7['verbose']}),_0x334e0a=_0x17bf26[_0x37e143(0x9b)];return console[_0x37e143(0x156)](_0x37e143(0x141)+_0x334e0a[_0x37e143(0x15e)][_0x37e143(0x115)]+_0x37e143(0x152)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a28_0x13f224(0x115)]=a28_0x13f224(0x16e);[a28_0x13f224(0xed)]='Export\x20journey(s)\x20as\x20YAML\x20files';async[a28_0x13f224(0x100)](_0xbd2de8){const _0xe050af=a28_0x13f224,{options:_0x562992,args:_0x1f3d49,tdx:_0x50a3d9}=_0xbd2de8,_0x299450=_0x562992,_0x5ec26f=_0x1f3d49[0x0],_0x21212d=_0x5ec26f&&isYamlFilePath(_0x5ec26f),_0x48c6f8=await resolveTarget({'arg':_0x21212d?_0x5ec26f:undefined,'contextParent':_0x562992[_0xe050af(0x137)],'cwd':process[_0xe050af(0x9c)]()});if(!isSuccessfulResolution(_0x48c6f8))return _0x48c6f8[_0xe050af(0x161)]==='no_parent'?(console['error'](a28_0x428bd7[_0xe050af(0x91)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0xe050af(0x156)](_0xe050af(0x187)),console[_0xe050af(0x156)](_0xe050af(0x15d)),console[_0xe050af(0x156)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file'),console[_0xe050af(0x156)](_0xe050af(0x159))):(console['error'](a28_0x428bd7['red'](_0xe050af(0x13e)+_0x48c6f8[_0xe050af(0xae)]+'\x0a')),_0x48c6f8[_0xe050af(0x112)]&&console[_0xe050af(0x156)](a28_0x428bd7[_0xe050af(0xa3)](_0x48c6f8[_0xe050af(0x112)]))),0x1;let _0x201ef5=_0x21212d?undefined:_0x5ec26f,_0x3605a2,_0x539dc6;_0x48c6f8['type']===_0xe050af(0xd7)&&(_0x201ef5=_0x48c6f8[_0xe050af(0x128)],_0x3605a2=_0x48c6f8[_0xe050af(0x12b)],_0x539dc6=_0x48c6f8[_0xe050af(0x16c)]);const _0x18a721=_0x48c6f8[_0xe050af(0x10a)],_0x2d5aa9=_0x48c6f8[_0xe050af(0x8f)];_0x299450[_0xe050af(0x114)]&&(console[_0xe050af(0x156)](_0xe050af(0x13c)+_0x18a721),console[_0xe050af(0x156)]('Target\x20directory:\x20'+_0x2d5aa9),_0x201ef5&&console['error']('Journey\x20name:\x20'+_0x201ef5),_0x3605a2&&console[_0xe050af(0x156)](_0xe050af(0x93)+_0x3605a2),_0x539dc6&&console[_0xe050af(0x156)](_0xe050af(0x10f)+_0x539dc6));const _0x2893cd=await withSpinner(_0xe050af(0x11f),()=>_0x50a3d9[_0xe050af(0xc4)]['resolveParentId'](_0x18a721),{'verbose':_0x562992['verbose']}),_0x36dc47=_0x2893cd[_0xe050af(0x9b)],{journeys:_0x3a1dc0,folders:_0x5cf0c7}=await withSpinner(_0xe050af(0xa8),async()=>{const _0x2996d3=_0xe050af,[_0x2c83df,_0x2fe4fa]=await Promise[_0x2996d3(0xfa)]([_0x50a3d9[_0x2996d3(0x150)][_0x2996d3(0x14b)](_0x36dc47,undefined,{'includeAllVersions':!![]}),_0x50a3d9[_0x2996d3(0xc4)][_0x2996d3(0xb4)](_0x36dc47)]);return{'journeys':_0x2c83df,'folders':_0x2fe4fa};},{'verbose':_0x562992[_0xe050af(0x114)]})['then'](_0x167b1a=>_0x167b1a[_0xe050af(0x9b)]);let _0x514e69=_0x3a1dc0;const _0x4ccb00=buildFolderIdToPathMap(_0x5cf0c7);if(_0x201ef5){const _0x297170=_0x514e69[_0xe050af(0xd8)](_0x44164b=>_0x44164b[_0xe050af(0x116)][_0xe050af(0x13f)]()===_0x201ef5[_0xe050af(0x13f)]());if(_0x297170['length']===0x0)return console[_0xe050af(0x156)](_0xe050af(0xcf)+_0x201ef5),console[_0xe050af(0x156)](_0xe050af(0x145)),0x1;_0x514e69=_0x297170;}if(_0x539dc6!==undefined){const _0x5177c5=_0x514e69[_0xe050af(0xd8)](_0x2c08a6=>{const _0x3e8bd2=_0xe050af,_0x186ab6=_0x2c08a6[_0x3e8bd2(0xbc)]?_0x4ccb00[_0x3e8bd2(0xea)](_0x2c08a6[_0x3e8bd2(0xbc)])||'':'';return _0x186ab6===_0x539dc6;});if(_0x5177c5[_0xe050af(0xff)]===0x0&&_0x514e69[_0xe050af(0xff)]>0x0){console['error'](_0xe050af(0x196)+_0x201ef5+_0xe050af(0x95)+(_0x539dc6||'root\x20folder')),console[_0xe050af(0x156)](_0xe050af(0x167));for(const _0x217216 of _0x514e69){const _0x1b7957=_0x217216[_0xe050af(0xbc)]?_0x4ccb00[_0xe050af(0xea)](_0x217216[_0xe050af(0xbc)])||'':'';console[_0xe050af(0x156)](_0xe050af(0xc8)+(_0x1b7957||_0xe050af(0xe2))+'/'+_0x217216[_0xe050af(0x116)]);}return 0x1;}_0x514e69=_0x5177c5;}if(_0x514e69[_0xe050af(0xff)]===0x0)return console[_0xe050af(0x156)](_0xe050af(0x96)),0x0;const _0x2eab81=new Map();for(const _0x438331 of _0x514e69){const _0x59d3cf=_0x438331[_0xe050af(0xbb)];!_0x2eab81[_0xe050af(0xee)](_0x59d3cf)&&_0x2eab81[_0xe050af(0xbd)](_0x59d3cf,[]),_0x2eab81[_0xe050af(0xea)](_0x59d3cf)['push'](_0x438331);}for(const _0xc11b8f of _0x2eab81[_0xe050af(0xdc)]()){_0xc11b8f['sort']((_0x4d6654,_0x390873)=>(_0x4d6654['versionNumber']||0x0)-(_0x390873['versionNumber']||0x0));}const _0xb7c73c=[],{idToEmailMap:_0x159eb5,connectionIdToNameMap:_0x3d4aed}=await withSpinner(_0xe050af(0x97),async()=>{const _0x16b97f=_0xe050af,[_0x22fef0,_0x14cdf6]=await Promise[_0x16b97f(0xfa)]([_0x50a3d9[_0x16b97f(0xcc)][_0x16b97f(0xa9)](),_0x50a3d9[_0x16b97f(0x130)][_0x16b97f(0x131)]()]);return{'idToEmailMap':_0x22fef0,'connectionIdToNameMap':_0x14cdf6};},{'verbose':_0x562992['verbose']})['then'](_0x21a718=>_0x21a718[_0xe050af(0x9b)]);for(const _0x42a3f1 of _0x2eab81[_0xe050af(0xdc)]()){const _0x3d322f=_0x42a3f1[0x0][_0xe050af(0x116)],_0x4de027=_0x42a3f1[0x0][_0xe050af(0xbc)],_0x40a775=_0x4de027?_0x4ccb00['get'](_0x4de027)||'':'',_0x446280=_0x40a775?a28_0x28a74c['join'](_0x2d5aa9,_0x40a775):_0x2d5aa9,_0x43fa10=_0x3605a2||a28_0x28a74c['join'](_0x446280,sanitizeFileName(_0x3d322f)+'.yml');let _0x11f82c,_0x9afe5;if(existsSync(_0x43fa10))try{const _0x4c88dd=readFileSync(_0x43fa10,_0xe050af(0xcb)),_0x327a63=parseYamlString(_0x4c88dd);_0x9afe5=_0x327a63,_0x11f82c=buildRuleToNameMapping(_0x327a63),_0x299450[_0xe050af(0x114)]&&_0x11f82c['size']>0x0&&console[_0xe050af(0x156)]('Found\x20'+_0x11f82c['size']+_0xe050af(0x11c)+_0x3d322f);}catch(_0x482cc0){_0x299450['verbose']&&console[_0xe050af(0x156)](_0xe050af(0x11d)+_0x482cc0[_0xe050af(0xae)]);}const _0xc2a07c=[],_0x1794dd=new Set(),_0x26924b=new Map(),_0x53d9d0=new Map(),_0x34b376=new Set(),_0x5125bb=new Map(),_0x247502=new Map(),_0x3c5988=createJumpTargetCache();await withProgressSpinner(_0xe050af(0xfe)+_0x3d322f+_0xe050af(0x10d),async _0x95f78c=>{const _0x48b2aa=_0xe050af;for(const _0x2fd4aa of _0x42a3f1){const _0x8e2c69=_0x42a3f1[_0x48b2aa(0xff)]>0x1?_0x2fd4aa[_0x48b2aa(0x116)]+'\x20v'+(_0x2fd4aa[_0x48b2aa(0x182)]||0x1):_0x2fd4aa['journeyBundleName'];_0x95f78c['setPhase'](_0x48b2aa(0xfe)+_0x8e2c69);const _0x463f24=await _0x50a3d9[_0x48b2aa(0x150)][_0x48b2aa(0x110)](_0x2fd4aa['id']),_0x4de013=_0x463f24['attributes']?.[_0x48b2aa(0xe1)],_0x38b56f={'resolveSegment':async _0x971b3f=>{const _0x7fdf2=_0x48b2aa;if(!_0x4de013)return{'name':_0x971b3f,'isJourneyLocal':![]};const _0x2389fc=_0x26924b[_0x7fdf2(0xea)](_0x971b3f);if(_0x2389fc)return _0x2389fc;try{const _0x58a1eb=await _0x50a3d9[_0x7fdf2(0xc4)][_0x7fdf2(0x138)](_0x4de013,_0x971b3f),_0x240bd8=_0x58a1eb[_0x7fdf2(0x129)]===SEGMENT_KIND_JOURNEY;let _0x1f99ce,_0x1f3532=_0x58a1eb[_0x7fdf2(0x115)];if(_0x240bd8&&_0x58a1eb[_0x7fdf2(0xf2)]){const _0x33073c=await segmentResponseToDef(_0x58a1eb,{'resolveSegmentName':async _0x163ea1=>{const _0x1d456b=_0x7fdf2,_0x2486e6=_0x26924b[_0x1d456b(0xea)](_0x163ea1);if(_0x2486e6)return _0x2486e6[_0x1d456b(0x115)];const _0x1ca6f1=await _0x38b56f[_0x1d456b(0xe0)](_0x163ea1);return _0x1ca6f1[_0x1d456b(0x115)];}}),_0x438d7a=_0x33073c[_0x7fdf2(0xf2)];_0x1f99ce={'description':_0x58a1eb[_0x7fdf2(0xed)],'rule':_0x438d7a};const _0x28d95d=serializeRule(_0x438d7a),_0x42146a=_0x53d9d0[_0x7fdf2(0xea)](_0x28d95d);if(_0x42146a)_0x1f3532=_0x42146a,_0x1f99ce=undefined,_0x299450['verbose']&&console[_0x7fdf2(0x156)](_0x7fdf2(0xb1)+_0x58a1eb[_0x7fdf2(0x115)]+_0x7fdf2(0x192)+_0x42146a);else{let _0x45aa1b=![];if(_0x11f82c){const _0x40647a=_0x11f82c[_0x7fdf2(0xea)](_0x28d95d);if(_0x40647a){const _0x3ef347=_0x40647a[_0x7fdf2(0xbf)](_0x7d88a7=>!_0x1794dd[_0x7fdf2(0xee)](_0x7d88a7));_0x3ef347&&(_0x1f3532=_0x3ef347,_0x1794dd[_0x7fdf2(0x166)](_0x3ef347),_0x53d9d0[_0x7fdf2(0xbd)](_0x28d95d,_0x3ef347),_0x45aa1b=!![],_0x299450[_0x7fdf2(0x114)]&&console[_0x7fdf2(0x156)]('\x20\x20Preserving\x20local\x20segment\x20name:\x20'+_0x3ef347+_0x7fdf2(0x197)));}}if(!_0x45aa1b){const _0x39f753=generateJourneyLocalName(_0x58a1eb[_0x7fdf2(0x115)]);_0x39f753&&(_0x1f3532=_0x39f753);let _0x444b4d=_0x1f3532,_0x4470dd=0x2;while(_0x1794dd[_0x7fdf2(0xee)](_0x444b4d)){_0x444b4d=_0x1f3532+'_'+_0x4470dd,_0x4470dd++;}_0x1794dd[_0x7fdf2(0x166)](_0x444b4d),_0x53d9d0[_0x7fdf2(0xbd)](_0x28d95d,_0x444b4d),_0x1f3532=_0x444b4d;}}}const _0x3bc205={'name':_0x1f3532,'isJourneyLocal':_0x240bd8,'definition':_0x1f99ce};return _0x26924b['set'](_0x971b3f,_0x3bc205),_0x3bc205;}catch(_0x4dc019){return _0x562992[_0x7fdf2(0x114)]&&console[_0x7fdf2(0x156)](_0x7fdf2(0x171)+_0x971b3f+':\x20'+_0x4dc019[_0x7fdf2(0xae)]),{'name':_0x971b3f,'isJourneyLocal':![]};}},'resolveActivation':async _0x14138a=>{const _0x294041=_0x48b2aa,_0x2c16a2=_0x5125bb[_0x294041(0xea)](_0x14138a);if(_0x2c16a2)return _0x2c16a2;try{const _0x120b34=await _0x50a3d9[_0x294041(0x150)][_0x294041(0x109)](_0x2fd4aa['id'],_0x14138a),_0x422d52=journeyActivationStepToYaml(_0x120b34,_0x159eb5,_0x3d4aed),_0x3bbbf9=JSON[_0x294041(0xaf)]({'name':_0x422d52[_0x294041(0x115)],'connection':_0x422d52[_0x294041(0x130)],'connector_config':_0x422d52[_0x294041(0x11b)]}),_0x227790=_0x247502['get'](_0x3bbbf9);if(_0x227790){const _0x43a995={'name':_0x227790,'isJourneyLocal':!![],'definition':_0x422d52};return _0x5125bb[_0x294041(0xbd)](_0x14138a,_0x43a995),_0x43a995;}const _0x551e99=_0x120b34[_0x294041(0x15e)]['activationParams'][_0x294041(0x115)]||_0x14138a,_0x3aefe0=sanitizeYamlKey(_0x551e99)||_0x294041(0xd5)+_0x14138a;let _0x13a80e=_0x3aefe0,_0x2a9007=0x2;while(_0x34b376['has'](_0x13a80e)){_0x13a80e=_0x3aefe0+'_'+_0x2a9007,_0x2a9007++;}_0x34b376[_0x294041(0x166)](_0x13a80e),_0x247502[_0x294041(0xbd)](_0x3bbbf9,_0x13a80e);const _0xeeb743={'name':_0x13a80e,'isJourneyLocal':!![],'definition':_0x422d52};return _0x5125bb[_0x294041(0xbd)](_0x14138a,_0xeeb743),_0xeeb743;}catch(_0xe280d1){return _0x562992[_0x294041(0x114)]&&console['error'](_0x294041(0x132)+_0x14138a+':\x20'+_0xe280d1[_0x294041(0xae)]),{'name':_0x14138a,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x257a5a,_0x540f87)=>{const _0x9996c3=_0x48b2aa;return resolveJumpTarget(_0x257a5a,_0x540f87,_0x3c5988,_0x350425=>_0x50a3d9['journey'][_0x9996c3(0x110)](_0x350425));}},_0x111166=await journeyResponseToDef(_0x463f24,_0x38b56f);_0xc2a07c['push']({'item':_0x2fd4aa,'yaml':_0x111166});}},{'verbose':_0x562992[_0xe050af(0x114)]});const _0x272fce=await _0x50a3d9[_0xe050af(0x150)]['getLatestJourneyId'](_0x42a3f1[0x0][_0xe050af(0xbb)]),_0x55a9f2=buildMergedJourneyDef(_0xc2a07c,_0x11f82c,_0x272fce),_0x218d2d=normalizeJourneyDef(_0x55a9f2,_0x9afe5),_0x2f89ce=toYamlString(_0x218d2d),_0x2b528c=_0x3605a2||a28_0x28a74c[_0xe050af(0x179)](_0x446280,sanitizeFileName(_0x3d322f)+_0xe050af(0xd1));!_0x3605a2&&_0x40a775&&!existsSync(_0x446280)&&mkdirSync(_0x446280,{'recursive':!![]});const _0x30e082=a28_0x28a74c['relative'](process[_0xe050af(0x9c)](),_0x2b528c);if(existsSync(_0x2b528c)){const _0x1a89d0=readFileSync(_0x2b528c,'utf-8'),_0x280fca=generateDiff(_0x1a89d0,_0x2f89ce),_0x1444fb=hasChanges(_0x280fca);_0xb7c73c[_0xe050af(0x181)]({'relativePath':_0x30e082,'absolutePath':_0x2b528c,'content':_0x2f89ce,'isNew':![],'hasChanges':_0x1444fb,'diff':_0x1444fb?formatDiffWithColors(_0x280fca):undefined});}else _0xb7c73c[_0xe050af(0x181)]({'relativePath':_0x30e082,'absolutePath':_0x2b528c,'content':_0x2f89ce,'isNew':!![],'hasChanges':![]});}const _0x47c013=_0xb7c73c[_0xe050af(0xd8)](_0x570422=>_0x570422[_0xe050af(0x90)]),_0xa91747=_0xb7c73c[_0xe050af(0xd8)](_0x28ba19=>!_0x28ba19[_0xe050af(0x90)]&&_0x28ba19[_0xe050af(0x154)]),_0x16e43d=_0xb7c73c[_0xe050af(0xd8)](_0x4e8043=>!_0x4e8043[_0xe050af(0x90)]&&!_0x4e8043[_0xe050af(0x154)]),_0x470200=_0x514e69[_0xe050af(0xff)],_0x1261a7=_0x2eab81['size'],_0x2d5aea=_0x470200>_0x1261a7?'\x20('+_0x470200+_0xe050af(0x17a):'';console[_0xe050af(0x156)]('\x0aPull\x20summary:'),console['error']('\x20\x20'+a28_0x428bd7[_0xe050af(0xa3)](_0x1261a7+_0xe050af(0x178))+a28_0x428bd7[_0xe050af(0x10c)](_0x2d5aea)),console['error']('\x20\x20'+a28_0x428bd7['green']('+\x20'+_0x47c013[_0xe050af(0xff)]+_0xe050af(0x164))),console[_0xe050af(0x156)]('\x20\x20'+a28_0x428bd7[_0xe050af(0x91)]('~\x20'+_0xa91747[_0xe050af(0xff)]+_0xe050af(0x174))),console[_0xe050af(0x156)]('\x20\x20'+a28_0x428bd7[_0xe050af(0x10c)]('=\x20'+_0x16e43d[_0xe050af(0xff)]+_0xe050af(0x151))),console[_0xe050af(0x156)](_0xe050af(0xd9)+a28_0x428bd7['cyan'](_0x2d5aa9)+'\x0a');if(_0xa91747[_0xe050af(0xff)]>0x0)for(const _0x28f69e of _0xa91747){console[_0xe050af(0x156)](_0xe050af(0x8a)+_0x28f69e[_0xe050af(0xa1)]+'\x27:'),console['error']('─'['repeat'](0x3c)),console['error'](_0x28f69e[_0xe050af(0x14e)]),console[_0xe050af(0x156)]('─'['repeat'](0x3c));}if(_0x299450[_0xe050af(0x195)])return console[_0xe050af(0x156)](a28_0x428bd7[_0xe050af(0x91)](_0xe050af(0x15a))),0x0;if(_0x47c013[_0xe050af(0xff)]===0x0&&_0xa91747['length']===0x0)return console[_0xe050af(0x156)](a28_0x428bd7['green'](_0xe050af(0xf4))),saveSessionContext({'parent_segment':_0x18a721},_0x299450['session']),console[_0xe050af(0x156)](a28_0x428bd7[_0xe050af(0x176)](_0xe050af(0x102)+a28_0x428bd7['dim'](_0xe050af(0xdb))+_0xe050af(0x143)+a28_0x428bd7[_0xe050af(0xa3)](_0x18a721))),0x0;if(!_0x299450['yes']&&(_0x47c013[_0xe050af(0xff)]>0x0||_0xa91747['length']>0x0)){if(!isInteractive())return console[_0xe050af(0x156)](a28_0x428bd7['red'](_0xe050af(0xb8)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a28_0x428bd7['dim'](_0xe050af(0xce))),0x1;const _0x1602e9=await confirmKey(_0xe050af(0x8e)+(_0x47c013[_0xe050af(0xff)]+_0xa91747['length'])+'\x20files?');if(!_0x1602e9)return console[_0xe050af(0x156)](a28_0x428bd7['yellow'](_0xe050af(0xd2)),_0xe050af(0xd6)),0x1;}!existsSync(_0x2d5aa9)&&mkdirSync(_0x2d5aa9,{'recursive':!![]});const _0x2e71b4=a28_0x28a74c[_0xe050af(0x179)](_0x2d5aa9,_0xe050af(0x119));writeFileSync(_0x2e71b4,createTdxConfigContent(_0x18a721),'utf-8');for(const _0x14889f of _0xb7c73c){(_0x14889f[_0xe050af(0x90)]||_0x14889f[_0xe050af(0x154)])&&writeFileSync(_0x14889f[_0xe050af(0x117)],_0x14889f['content'],_0xe050af(0xcb));}return console[_0xe050af(0x156)](a28_0x428bd7[_0xe050af(0x176)]('✔\x20Pulled\x20'+(_0x47c013['length']+_0xa91747[_0xe050af(0xff)])+_0xe050af(0x162)+_0x2d5aa9)),saveSessionContext({'parent_segment':_0x18a721},_0x299450[_0xe050af(0x104)]),console[_0xe050af(0x156)](a28_0x428bd7[_0xe050af(0x176)](_0xe050af(0x102)+a28_0x428bd7[_0xe050af(0x10c)](_0xe050af(0xdb))+_0xe050af(0x143)+a28_0x428bd7['cyan'](_0x18a721))),0x0;}}export class JourneyColumnsCommand extends BaseCommand{[a28_0x13f224(0x115)]='journey:columns';[a28_0x13f224(0xed)]='Show\x20journey\x20table\x20column\x20mapping';async[a28_0x13f224(0x100)](_0x56a563){const _0x22b449=a28_0x13f224,{options:_0x4f0ebe,args:_0x452641,tdx:_0x1c3d1f}=_0x56a563,_0x131210=_0x452641[0x0];if(!requireNameOrPath(_0x131210))return 0x1;_0x4f0ebe[_0x22b449(0x114)]&&console[_0x22b449(0x156)](_0x22b449(0xf3)+_0x131210);const {journeyId:_0x545764}=await resolveJourneyIdFromInput(_0x131210,_0x4f0ebe,_0x1c3d1f),_0x15571b=await withSpinner(_0x22b449(0xc3),()=>_0x1c3d1f['journey'][_0x22b449(0xc9)](_0x545764),{'verbose':_0x4f0ebe[_0x22b449(0x114)]}),_0x374d3b=_0x15571b[_0x22b449(0x9b)];return console[_0x22b449(0x140)]('Database:\x20'+_0x374d3b['database']),console[_0x22b449(0x140)](_0x22b449(0x17c)+_0x374d3b[_0x22b449(0x160)]),await handleSDKOutput(_0x374d3b[_0x22b449(0xad)],_0x4f0ebe),0x0;}}export class JourneyActivationsCommand extends BaseCommand{[a28_0x13f224(0x115)]=a28_0x13f224(0xeb);[a28_0x13f224(0xed)]=a28_0x13f224(0xa7);async['execute'](_0x2c0289){const _0x5215e1=a28_0x13f224,{options:_0x238f9d,args:_0x146740,tdx:_0x5c13fc}=_0x2c0289,_0x18f4d2=_0x146740[0x0];if(!requireNameOrPath(_0x18f4d2))return 0x1;_0x238f9d[_0x5215e1(0x114)]&&console[_0x5215e1(0x156)](_0x5215e1(0xf3)+_0x18f4d2);const {journeyId:_0x537673}=await resolveJourneyIdFromInput(_0x18f4d2,_0x238f9d,_0x5c13fc),_0x50b06b=await withSpinner('Listing\x20journey\x20activations...',()=>_0x5c13fc[_0x5215e1(0x150)][_0x5215e1(0x15b)](_0x537673),{'verbose':_0x238f9d[_0x5215e1(0x114)]}),_0x1b6fbf=_0x50b06b[_0x5215e1(0x9b)];return console[_0x5215e1(0x156)](_0x5215e1(0x183)+_0x1b6fbf[_0x5215e1(0xff)]+_0x5215e1(0xb0)+(_0x1b6fbf[_0x5215e1(0xff)]!==0x1?'s':'')),await handleSDKOutput(_0x1b6fbf,_0x238f9d),0x0;}}export class JourneyPushCommand extends BaseCommand{[a28_0x13f224(0x115)]=a28_0x13f224(0x146);[a28_0x13f224(0xed)]=a28_0x13f224(0xba);[a28_0x13f224(0x135)]=new SegmentPushCommand();async['execute'](_0x1927cd){const _0x526c5f=a28_0x13f224,_0x3906ff=_0x1927cd[_0x526c5f(0xa4)][0x0];let _0x5ed9b6;if(_0x3906ff){const _0x49aeda=await resolveTarget({'arg':_0x3906ff,'contextParent':_0x1927cd[_0x526c5f(0x190)][_0x526c5f(0x137)],'cwd':process[_0x526c5f(0x9c)]()});isSuccessfulResolution(_0x49aeda)&&_0x49aeda[_0x526c5f(0xb3)]===_0x526c5f(0xd7)&&(_0x5ed9b6=_0x49aeda[_0x526c5f(0x12b)]);}const _0x31631e={..._0x1927cd,'options':{..._0x1927cd[_0x526c5f(0x190)],'journeysOnly':!![],..._0x5ed9b6&&{'singleFilePath':_0x5ed9b6}}};return this[_0x526c5f(0x135)]['execute'](_0x31631e);}}export class JourneyVersionsCommand extends BaseCommand{[a28_0x13f224(0x115)]=a28_0x13f224(0x193);[a28_0x13f224(0xed)]='List\x20all\x20versions\x20of\x20a\x20journey';async['execute'](_0x2c674f){const _0x5304fa=a28_0x13f224,{options:_0x24c4d3,args:_0x2abd79,tdx:_0x49576f}=_0x2c674f,_0x59d6f5=_0x2abd79[0x0];if(!requireNameOrPath(_0x59d6f5))return 0x1;if(_0x24c4d3[_0x5304fa(0x114)])console['error'](_0x5304fa(0xf3)+_0x59d6f5);const {journeyId:_0x520631}=await resolveJourneyIdFromInput(_0x59d6f5,_0x24c4d3,_0x49576f),_0x150cd3=await withSpinner(_0x5304fa(0x12d),()=>_0x49576f[_0x5304fa(0x150)][_0x5304fa(0xd3)](_0x520631),{'verbose':_0x24c4d3['verbose']}),{bundleName:_0x55bcee,versions:_0x5d092b,latestJourneyId:_0x3bf777}=_0x150cd3[_0x5304fa(0x9b)];console['error'](_0x55bcee+':\x20'+_0x5d092b[_0x5304fa(0xff)]+_0x5304fa(0x16f)+(_0x5d092b[_0x5304fa(0xff)]!==0x1?'s':''));const _0x1c687d=_0x5d092b[_0x5304fa(0xf1)](_0x3ff44e=>({'version':_0x3ff44e[_0x5304fa(0x182)],'journey_id':_0x3ff44e[_0x5304fa(0xc2)],'name':_0x3ff44e[_0x5304fa(0x115)],'state':_0x3ff44e[_0x5304fa(0xf8)],'paused':_0x3ff44e[_0x5304fa(0x8b)],'latest':_0x3ff44e['journeyId']===_0x3bf777,'created_at':_0x3ff44e[_0x5304fa(0x15f)]}));return await handleSDKOutput(_0x1c687d,_0x24c4d3),0x0;}}export class JourneyVersionCreateCommand extends BaseCommand{['name']='journey:version:create';[a28_0x13f224(0xed)]='Create\x20a\x20new\x20draft\x20version\x20of\x20a\x20journey';async[a28_0x13f224(0x100)](_0xfe0523){const _0x98f1dd=a28_0x13f224,{options:_0x4a989b,args:_0x3447fa,tdx:_0x4a8686}=_0xfe0523,_0x223586=_0x3447fa[0x0];if(!requireNameOrPath(_0x223586))return 0x1;if(_0x4a989b[_0x98f1dd(0x114)])console[_0x98f1dd(0x156)]('Input:\x20'+_0x223586);const {journeyId:_0xae9ed,journeyName:_0x3a1ee6}=await resolveJourneyIdFromInput(_0x223586,_0x4a989b,_0x4a8686);if(!_0x4a989b[_0x98f1dd(0xa2)]){const _0x371698=await confirm(_0x98f1dd(0xf0)+_0x3a1ee6+'\x22?');if(!_0x371698)return console['error']('Cancelled'),0x0;}const _0x20b994=await withSpinner('Creating\x20new\x20version...',()=>_0x4a8686[_0x98f1dd(0x150)][_0x98f1dd(0x12e)](_0xae9ed),{'verbose':_0x4a989b['verbose']}),_0x3703b5=_0x20b994[_0x98f1dd(0x9b)];return console[_0x98f1dd(0x156)](a28_0x428bd7[_0x98f1dd(0x176)]('✔')+_0x98f1dd(0xc0)+_0x3703b5[_0x98f1dd(0x15e)][_0x98f1dd(0x182)]+'\x20(draft)\x20—\x20\x22'+_0x3703b5[_0x98f1dd(0x15e)][_0x98f1dd(0x115)]+'\x22'),console[_0x98f1dd(0x156)](_0x98f1dd(0x170)+_0x3703b5['id']),await handleSingleObjectOutput({'id':_0x3703b5['id'],'name':_0x3703b5[_0x98f1dd(0x15e)]['name'],'version':_0x3703b5[_0x98f1dd(0x15e)][_0x98f1dd(0x182)],'state':_0x3703b5[_0x98f1dd(0x15e)][_0x98f1dd(0xf8)],'bundle_id':_0x3703b5[_0x98f1dd(0x15e)][_0x98f1dd(0xbb)],'created_at':_0x3703b5[_0x98f1dd(0x15e)][_0x98f1dd(0x15f)]},_0x4a989b),0x0;}}export class JourneyVersionViewCommand extends BaseCommand{[a28_0x13f224(0x115)]=a28_0x13f224(0x194);['description']='View\x20a\x20specific\x20version\x20of\x20a\x20journey';async[a28_0x13f224(0x100)](_0x5066e9){const _0x5e5a09=a28_0x13f224,{options:_0x54e55d,args:_0x46e25a,tdx:_0x2652c8}=_0x5066e9,_0x25b6e2=_0x46e25a[0x0];if(!requireNameOrPath(_0x25b6e2))return 0x1;const _0x515849=_0x54e55d[_0x5e5a09(0x92)];if(!_0x515849)return console[_0x5e5a09(0x156)]('Error:\x20--version\x20option\x20is\x20required'),console['error'](_0x5e5a09(0x121)),0x1;const _0x4534c7=parseInt(_0x515849,0xa);if(isNaN(_0x4534c7)||_0x4534c7<0x1)return console['error']('Error:\x20Invalid\x20version\x20number:\x20'+_0x515849),0x1;if(_0x54e55d[_0x5e5a09(0x114)])console[_0x5e5a09(0x156)](_0x5e5a09(0xf3)+_0x25b6e2+',\x20version:\x20'+_0x4534c7);const {journeyId:_0x3b5bbf,parentSegmentId:_0x56ab28}=await resolveJourneyIdFromInput(_0x25b6e2,_0x54e55d,_0x2652c8),_0x3f1d35=await withSpinner(_0x5e5a09(0x10e),()=>_0x2652c8[_0x5e5a09(0x150)]['listVersions'](_0x3b5bbf),{'verbose':_0x54e55d[_0x5e5a09(0x114)]}),{versions:_0x1b5829,latestJourneyId:_0x3a5b1e}=_0x3f1d35['data'],_0x552df1=_0x1b5829[_0x5e5a09(0xbf)](_0x396fc9=>_0x396fc9[_0x5e5a09(0x182)]===_0x4534c7);if(!_0x552df1){const _0x5b65a0=_0x1b5829[_0x5e5a09(0xf1)](_0x3f2a34=>'v'+_0x3f2a34[_0x5e5a09(0x182)])[_0x5e5a09(0x179)](',\x20');return console[_0x5e5a09(0x156)]('Error:\x20Version\x20'+_0x4534c7+_0x5e5a09(0xd0)+_0x5b65a0),0x1;}const _0x2f2096=await withSpinner(_0x5e5a09(0x10b)+_0x4534c7+_0x5e5a09(0x14a),()=>_0x2652c8['journey'][_0x5e5a09(0x110)](_0x552df1[_0x5e5a09(0xc2)]),{'verbose':_0x54e55d[_0x5e5a09(0x114)]}),_0x33e6da=_0x2f2096[_0x5e5a09(0x9b)],_0x5ca21f=getConsoleNextUrl(_0x54e55d[_0x5e5a09(0xaa)],_0x5e5a09(0x12f)+_0x56ab28+_0x5e5a09(0xdd)+_0x552df1[_0x5e5a09(0xc2)]+_0x5e5a09(0xfc));return await handleSingleObjectOutput({'id':_0x33e6da['id'],'name':_0x33e6da[_0x5e5a09(0x15e)][_0x5e5a09(0x115)],'version':_0x33e6da[_0x5e5a09(0x15e)]['versionNumber'],'description':_0x33e6da['attributes'][_0x5e5a09(0xed)],'state':_0x33e6da[_0x5e5a09(0x15e)][_0x5e5a09(0xf8)],'paused':_0x33e6da[_0x5e5a09(0x15e)][_0x5e5a09(0x8b)],'reentry_mode':_0x33e6da['attributes']['reentryMode'],'stages':_0x33e6da[_0x5e5a09(0x15e)][_0x5e5a09(0xb7)]?.[_0x5e5a09(0xff)]||0x0,..._0x33e6da['attributes']['goal']&&{'goal':_0x33e6da[_0x5e5a09(0x15e)][_0x5e5a09(0xe4)][_0x5e5a09(0x115)]},'latest':_0x552df1[_0x5e5a09(0xc2)]===_0x3a5b1e,'created_at':_0x33e6da[_0x5e5a09(0x15e)][_0x5e5a09(0x15f)],'updated_at':_0x33e6da['attributes'][_0x5e5a09(0x9a)],'url':_0x5ca21f},_0x54e55d),0x0;}}
@@ -1 +1 @@
1
- const a29_0x3e91c6=a29_0x220b;(function(_0x1586e8,_0x4314ea){const _0x3d6617=a29_0x220b,_0x45b653=_0x1586e8();while(!![]){try{const _0x12ebb9=-parseInt(_0x3d6617(0xca))/0x1+-parseInt(_0x3d6617(0xc6))/0x2*(-parseInt(_0x3d6617(0xcd))/0x3)+-parseInt(_0x3d6617(0xea))/0x4+-parseInt(_0x3d6617(0xdf))/0x5+-parseInt(_0x3d6617(0xe4))/0x6*(parseInt(_0x3d6617(0xb1))/0x7)+-parseInt(_0x3d6617(0xcf))/0x8*(-parseInt(_0x3d6617(0xcb))/0x9)+parseInt(_0x3d6617(0xc3))/0xa;if(_0x12ebb9===_0x4314ea)break;else _0x45b653['push'](_0x45b653['shift']());}catch(_0x56f2d5){_0x45b653['push'](_0x45b653['shift']());}}}(a29_0x1ea2,0xb62c7));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';function a29_0x220b(_0x55b275,_0x5f3e7f){_0x55b275=_0x55b275-0xb0;const _0x1ea22e=a29_0x1ea2();let _0x220bec=_0x1ea22e[_0x55b275];return _0x220bec;}import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';function a29_0x1ea2(){const _0x4466fa=['\x20warning(s)\x20found','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','no_parent','\x20segment\x20file(s)\x20skipped','2729732VNvYBS','No\x20journey\x20YAML\x20files\x20found\x20in\x20','7RVfCVA','\x20valid','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','execute','description','filter','\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','endsWith','warnings','Validate\x20journey\x20YAML\x20files','errors','skippedCount','\x20journey(s)\x20with\x20errors,\x20','verbose','invalidCount','dim','valid','warningCount','23541720SRoOtA','green','name','2102JYHNPs','helpText','\x20journey(s)\x20valid','length','232634iWrDRH','4041423nTqtqU','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','129sXDBaP','cwd','16jBQEYk','cyan','\x20warning(s)','journey:validate','Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','errorCode','.yaml','validCount','\x20segment\x20file(s)\x20skipped)','type','\x20error(s)','yellow','red','reason','filePath','✔\x20All\x20','5512430sMRcvT','error','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','relativePath','message','3202338XoxGXj','log'];a29_0x1ea2=function(){return _0x4466fa;};return a29_0x1ea2();}import a29_0x2c8fcf 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{[a29_0x3e91c6(0xc5)]=a29_0x3e91c6(0xd2);[a29_0x3e91c6(0xb5)]=a29_0x3e91c6(0xba);async[a29_0x3e91c6(0xb4)](_0x34f95a){const _0x58a15f=a29_0x3e91c6,{options:_0xe49e55,args:_0xde3a98}=_0x34f95a,_0x541135=_0xe49e55,_0x565355=await resolveTarget({'arg':_0xde3a98[0x0],'contextParent':_0xe49e55['parentSegment'],'cwd':process[_0x58a15f(0xce)]()});if(!isSuccessfulResolution(_0x565355))return _0x565355[_0x58a15f(0xd4)]===_0x58a15f(0xe8)?(console[_0x58a15f(0xe0)](a29_0x2c8fcf[_0x58a15f(0xda)](_0x58a15f(0xe7))),console[_0x58a15f(0xe0)](_0x58a15f(0xd3)),console[_0x58a15f(0xe0)](_0x58a15f(0xb7)),console['error'](_0x58a15f(0xb3))):(console[_0x58a15f(0xe0)](a29_0x2c8fcf[_0x58a15f(0xdb)]('Error:\x20'+_0x565355[_0x58a15f(0xe3)]+'\x0a')),_0x565355[_0x58a15f(0xc7)]&&console['error'](a29_0x2c8fcf[_0x58a15f(0xd0)](_0x565355[_0x58a15f(0xc7)]))),0x1;const _0xed22e=_0x565355['targetDir'],_0x239255=_0x565355[_0x58a15f(0xd8)]==='file'?_0x565355[_0x58a15f(0xdd)]:undefined;if(!_0x239255&&!existsSync(_0xed22e))return console['error'](a29_0x2c8fcf[_0x58a15f(0xdb)]('Error:\x20Directory\x20not\x20found:\x20'+_0xed22e+'\x0a')),0x1;let _0x4c2e74;if(_0x239255){if(!_0x239255[_0x58a15f(0xb8)]('.yml')&&!_0x239255['endsWith'](_0x58a15f(0xd5)))return console[_0x58a15f(0xe0)](a29_0x2c8fcf[_0x58a15f(0xdb)](_0x58a15f(0xcc)+_0x239255+'\x0a')),0x1;_0x4c2e74=[_0x239255];}else _0x4c2e74=findYamlFiles(_0xed22e);if(_0x4c2e74[_0x58a15f(0xc9)]===0x0)return console['error'](a29_0x2c8fcf[_0x58a15f(0xdb)](_0x58a15f(0xe1)+_0xed22e+'\x0a')),0x1;const _0x4f365f=validateYamlFiles(_0x4c2e74,_0xed22e,{'filterType':'journey'}),_0x5dbaac=calculateSummary(_0x4f365f),_0x5c825e=_0x4f365f[_0x58a15f(0xb6)](isValidationResult);if(_0x5c825e[_0x58a15f(0xc9)]===0x0)return console[_0x58a15f(0xe0)](a29_0x2c8fcf[_0x58a15f(0xda)](_0x58a15f(0xb0)+_0xed22e+'\x0a')),_0x5dbaac['skippedCount']>0x0&&console[_0x58a15f(0xe0)](a29_0x2c8fcf[_0x58a15f(0xc0)]('('+_0x5dbaac[_0x58a15f(0xbc)]+_0x58a15f(0xd7))),0x0;for(const _0x13618a of _0x4f365f){if(!isValidationResult(_0x13618a)){_0x541135[_0x58a15f(0xbe)]&&console['log'](a29_0x2c8fcf[_0x58a15f(0xc0)]('-\x20'+_0x13618a[_0x58a15f(0xe2)]+'\x20(skipped:\x20'+_0x13618a[_0x58a15f(0xdc)]+')'));continue;}const {relativePath:_0x1bc62a,source:_0x51581c,result:_0x4fe686}=_0x13618a;if(_0x4fe686['valid']&&_0x4fe686[_0x58a15f(0xb9)][_0x58a15f(0xc9)]===0x0)_0x541135['verbose']&&console[_0x58a15f(0xe5)](a29_0x2c8fcf[_0x58a15f(0xc4)]('✔\x20'+_0x1bc62a));else _0x4fe686[_0x58a15f(0xc1)]?(console[_0x58a15f(0xe5)](a29_0x2c8fcf[_0x58a15f(0xda)]('⚠\x20'+_0x1bc62a+':\x20'+_0x4fe686['warnings'][_0x58a15f(0xc9)]+_0x58a15f(0xd1))),console[_0x58a15f(0xe5)](formatValidationResult(_0x4fe686,_0x51581c,_0x1bc62a))):(console['log'](a29_0x2c8fcf[_0x58a15f(0xdb)]('✖\x20'+_0x1bc62a+':\x20'+_0x4fe686[_0x58a15f(0xbb)][_0x58a15f(0xc9)]+_0x58a15f(0xd9))),console[_0x58a15f(0xe5)](formatValidationResult(_0x4fe686,_0x51581c,_0x1bc62a)));}return console[_0x58a15f(0xe5)](''),_0x5dbaac['hasErrors']?(console[_0x58a15f(0xe5)](a29_0x2c8fcf['red']('Validation\x20failed:\x20'+_0x5dbaac[_0x58a15f(0xbf)]+_0x58a15f(0xbd)+_0x5dbaac[_0x58a15f(0xd6)]+_0x58a15f(0xb2))),_0x5dbaac['warningCount']>0x0&&console[_0x58a15f(0xe5)](a29_0x2c8fcf[_0x58a15f(0xda)](_0x5dbaac[_0x58a15f(0xc2)]+_0x58a15f(0xe6))),_0x5dbaac[_0x58a15f(0xbc)]>0x0&&console[_0x58a15f(0xe5)](a29_0x2c8fcf[_0x58a15f(0xc0)](_0x5dbaac[_0x58a15f(0xbc)]+_0x58a15f(0xe9))),0x1):(console['log'](a29_0x2c8fcf['green'](_0x58a15f(0xde)+_0x5dbaac[_0x58a15f(0xd6)]+_0x58a15f(0xc8))),_0x5dbaac[_0x58a15f(0xc2)]>0x0&&console[_0x58a15f(0xe5)](a29_0x2c8fcf[_0x58a15f(0xda)](_0x5dbaac['warningCount']+_0x58a15f(0xe6))),_0x5dbaac['skippedCount']>0x0&&console[_0x58a15f(0xe5)](a29_0x2c8fcf[_0x58a15f(0xc0)](_0x5dbaac[_0x58a15f(0xbc)]+'\x20segment\x20file(s)\x20skipped')),0x0);}}
1
+ const a29_0x1d604e=a29_0x4511;(function(_0x5865a5,_0x5f3c6e){const _0x38594c=a29_0x4511,_0x28c6be=_0x5865a5();while(!![]){try{const _0x1d4a65=-parseInt(_0x38594c(0xe3))/0x1*(-parseInt(_0x38594c(0x10e))/0x2)+-parseInt(_0x38594c(0x103))/0x3*(-parseInt(_0x38594c(0x101))/0x4)+-parseInt(_0x38594c(0xf4))/0x5+parseInt(_0x38594c(0xfe))/0x6+parseInt(_0x38594c(0xe5))/0x7+-parseInt(_0x38594c(0xff))/0x8*(-parseInt(_0x38594c(0xfb))/0x9)+-parseInt(_0x38594c(0x106))/0xa*(parseInt(_0x38594c(0x10b))/0xb);if(_0x1d4a65===_0x5f3c6e)break;else _0x28c6be['push'](_0x28c6be['shift']());}catch(_0x3b8bcf){_0x28c6be['push'](_0x28c6be['shift']());}}}(a29_0x23b6,0x2a880));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a29_0x29ec5d from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';function a29_0x4511(_0x4e65d2,_0x15d6cd){_0x4e65d2=_0x4e65d2-0xda;const _0x23b627=a29_0x23b6();let _0x451163=_0x23b627[_0x4e65d2];return _0x451163;}export class JourneyValidateCommand extends BaseCommand{[a29_0x1d604e(0xf2)]=a29_0x1d604e(0xef);[a29_0x1d604e(0xdd)]=a29_0x1d604e(0xed);async[a29_0x1d604e(0x109)](_0xf50561){const _0x2ef44a=a29_0x1d604e,{options:_0x49ee2a,args:_0x57e7db}=_0xf50561,_0x394c74=_0x49ee2a,_0x57d661=await resolveTarget({'arg':_0x57e7db[0x0],'contextParent':_0x49ee2a[_0x2ef44a(0xfa)],'cwd':process[_0x2ef44a(0xf7)]()});if(!isSuccessfulResolution(_0x57d661))return _0x57d661[_0x2ef44a(0x10d)]==='no_parent'?(console[_0x2ef44a(0xdb)](a29_0x29ec5d[_0x2ef44a(0xde)](_0x2ef44a(0xf8))),console[_0x2ef44a(0xdb)](_0x2ef44a(0xda)),console['error'](_0x2ef44a(0x104)),console[_0x2ef44a(0xdb)](_0x2ef44a(0xfc))):(console[_0x2ef44a(0xdb)](a29_0x29ec5d[_0x2ef44a(0xfd)]('Error:\x20'+_0x57d661[_0x2ef44a(0xee)]+'\x0a')),_0x57d661[_0x2ef44a(0xf9)]&&console['error'](a29_0x29ec5d['cyan'](_0x57d661[_0x2ef44a(0xf9)]))),0x1;const _0x3205fd=_0x57d661['targetDir'],_0x35cc60=_0x57d661['type']===_0x2ef44a(0xe4)?_0x57d661['filePath']:undefined;if(!_0x35cc60&&!existsSync(_0x3205fd))return console[_0x2ef44a(0xdb)](a29_0x29ec5d['red'](_0x2ef44a(0xeb)+_0x3205fd+'\x0a')),0x1;let _0x422809;if(_0x35cc60){if(!_0x35cc60[_0x2ef44a(0xdf)]('.yml')&&!_0x35cc60[_0x2ef44a(0xdf)]('.yaml'))return console['error'](a29_0x29ec5d[_0x2ef44a(0xfd)](_0x2ef44a(0xe9)+_0x35cc60+'\x0a')),0x1;_0x422809=[_0x35cc60];}else _0x422809=findYamlFiles(_0x3205fd);if(_0x422809[_0x2ef44a(0x100)]===0x0)return console['error'](a29_0x29ec5d[_0x2ef44a(0xfd)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x3205fd+'\x0a')),0x1;const _0x20a559=validateYamlFiles(_0x422809,_0x3205fd,{'filterType':_0x2ef44a(0xf3)}),_0x5cf5d8=calculateSummary(_0x20a559),_0x118f03=_0x20a559[_0x2ef44a(0x107)](isValidationResult);if(_0x118f03[_0x2ef44a(0x100)]===0x0)return console[_0x2ef44a(0xdb)](a29_0x29ec5d[_0x2ef44a(0xde)](_0x2ef44a(0xf0)+_0x3205fd+'\x0a')),_0x5cf5d8[_0x2ef44a(0xe2)]>0x0&&console[_0x2ef44a(0xdb)](a29_0x29ec5d[_0x2ef44a(0x108)]('('+_0x5cf5d8['skippedCount']+'\x20segment\x20file(s)\x20skipped)')),0x0;for(const _0x574740 of _0x20a559){if(!isValidationResult(_0x574740)){_0x394c74['verbose']&&console[_0x2ef44a(0x10c)](a29_0x29ec5d[_0x2ef44a(0x108)]('-\x20'+_0x574740[_0x2ef44a(0xf1)]+'\x20(skipped:\x20'+_0x574740[_0x2ef44a(0x10f)]+')'));continue;}const {relativePath:_0x52a527,source:_0x49afc2,result:_0x2de2d2}=_0x574740;if(_0x2de2d2[_0x2ef44a(0xe8)]&&_0x2de2d2[_0x2ef44a(0x102)][_0x2ef44a(0x100)]===0x0)_0x394c74['verbose']&&console[_0x2ef44a(0x10c)](a29_0x29ec5d['green']('✔\x20'+_0x52a527));else _0x2de2d2[_0x2ef44a(0xe8)]?(console[_0x2ef44a(0x10c)](a29_0x29ec5d[_0x2ef44a(0xde)]('⚠\x20'+_0x52a527+':\x20'+_0x2de2d2[_0x2ef44a(0x102)][_0x2ef44a(0x100)]+'\x20warning(s)')),console[_0x2ef44a(0x10c)](formatValidationResult(_0x2de2d2,_0x49afc2,_0x52a527))):(console[_0x2ef44a(0x10c)](a29_0x29ec5d[_0x2ef44a(0xfd)]('✖\x20'+_0x52a527+':\x20'+_0x2de2d2[_0x2ef44a(0xf5)][_0x2ef44a(0x100)]+_0x2ef44a(0xe1))),console['log'](formatValidationResult(_0x2de2d2,_0x49afc2,_0x52a527)));}return console[_0x2ef44a(0x10c)](''),_0x5cf5d8[_0x2ef44a(0x10a)]?(console[_0x2ef44a(0x10c)](a29_0x29ec5d['red'](_0x2ef44a(0xe6)+_0x5cf5d8['invalidCount']+'\x20journey(s)\x20with\x20errors,\x20'+_0x5cf5d8[_0x2ef44a(0xe0)]+_0x2ef44a(0xdc))),_0x5cf5d8['warningCount']>0x0&&console[_0x2ef44a(0x10c)](a29_0x29ec5d[_0x2ef44a(0xde)](_0x5cf5d8[_0x2ef44a(0xe7)]+_0x2ef44a(0xec))),_0x5cf5d8[_0x2ef44a(0xe2)]>0x0&&console[_0x2ef44a(0x10c)](a29_0x29ec5d[_0x2ef44a(0x108)](_0x5cf5d8[_0x2ef44a(0xe2)]+_0x2ef44a(0x105))),0x1):(console[_0x2ef44a(0x10c)](a29_0x29ec5d['green'](_0x2ef44a(0xf6)+_0x5cf5d8[_0x2ef44a(0xe0)]+_0x2ef44a(0xea))),_0x5cf5d8[_0x2ef44a(0xe7)]>0x0&&console[_0x2ef44a(0x10c)](a29_0x29ec5d['yellow'](_0x5cf5d8[_0x2ef44a(0xe7)]+_0x2ef44a(0xec))),_0x5cf5d8['skippedCount']>0x0&&console[_0x2ef44a(0x10c)](a29_0x29ec5d[_0x2ef44a(0x108)](_0x5cf5d8[_0x2ef44a(0xe2)]+_0x2ef44a(0x105))),0x0);}}function a29_0x23b6(){const _0x10bd2f=['execute','hasErrors','11iLhHfy','log','errorCode','63278hEsUNL','reason','Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','error','\x20valid','description','yellow','endsWith','validCount','\x20error(s)','skippedCount','2KsxkUw','file','543781pvlkpm','Validation\x20failed:\x20','warningCount','valid','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','\x20journey(s)\x20valid','Error:\x20Directory\x20not\x20found:\x20','\x20warning(s)\x20found','Validate\x20journey\x20YAML\x20files','message','journey:validate','No\x20journey\x20YAML\x20files\x20found\x20in\x20','relativePath','name','journey','530835FaAECz','errors','✔\x20All\x20','cwd','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','helpText','parentSegment','18VCUWBN','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','red','1217532nojYvv','176392scnqFJ','length','1102052JmQEtK','warnings','3NvWZWC','\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','\x20segment\x20file(s)\x20skipped','3831190OOVuei','filter','dim'];a29_0x23b6=function(){return _0x10bd2f;};return a29_0x23b6();}