@treasuredata/tdx 2026.4.7 → 2026.4.9

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 (232) 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/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/policy-command.js +1 -1
  35. package/dist/commands/profile-command.js +1 -1
  36. package/dist/commands/profiles-command.js +1 -1
  37. package/dist/commands/query-command.js +1 -1
  38. package/dist/commands/schedule-command.js +1 -1
  39. package/dist/commands/segment-command.js +1 -1
  40. package/dist/commands/segment-create-command.js +1 -1
  41. package/dist/commands/segment-fields-command.js +1 -1
  42. package/dist/commands/segment-pull-command.js +1 -1
  43. package/dist/commands/segment-push-command.js +1 -1
  44. package/dist/commands/segment-update-command.js +1 -1
  45. package/dist/commands/segment-use-command.js +1 -1
  46. package/dist/commands/segment-validate-command.js +1 -1
  47. package/dist/commands/segments.js +1 -1
  48. package/dist/commands/show.js +1 -1
  49. package/dist/commands/status-command.js +1 -1
  50. package/dist/commands/tables.js +1 -1
  51. package/dist/commands/unset-command.js +1 -1
  52. package/dist/commands/upgrade-command.js +1 -1
  53. package/dist/commands/use-command.js +1 -1
  54. package/dist/commands/user-command.js +1 -1
  55. package/dist/commands/work-command.js +1 -1
  56. package/dist/commands/workflow-command.js +1 -1
  57. package/dist/core/auth.js +1 -1
  58. package/dist/core/command-output.js +1 -1
  59. package/dist/core/config.js +1 -1
  60. package/dist/core/connection-cache.js +1 -1
  61. package/dist/core/constants.js +1 -1
  62. package/dist/core/credential-cache.js +1 -1
  63. package/dist/core/global-context.js +1 -1
  64. package/dist/core/keychain.js +1 -1
  65. package/dist/core/oauth-keychain.js +1 -1
  66. package/dist/core/oauth.js +1 -1
  67. package/dist/core/profile.js +1 -1
  68. package/dist/core/project-config.js +1 -1
  69. package/dist/core/session.js +1 -1
  70. package/dist/core/user-cache.js +1 -1
  71. package/dist/core/version.js +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/mcp/server.js +1 -1
  74. package/dist/mcp/tools/index.js +1 -1
  75. package/dist/mcp/tools/tdx-run.js +1 -1
  76. package/dist/mcp/tools/tdx-search.js +1 -1
  77. package/dist/mcp/tools/work-create-item.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/access-tracker.d.ts +2 -0
  182. package/dist/sdk/workspace/access-tracker.d.ts.map +1 -1
  183. package/dist/sdk/workspace/access-tracker.js +1 -1
  184. package/dist/sdk/workspace/access-tracker.js.map +1 -1
  185. package/dist/sdk/workspace/frontmatter.js +1 -1
  186. package/dist/sdk/workspace/git.js +1 -1
  187. package/dist/sdk/workspace/index.d.ts +2 -0
  188. package/dist/sdk/workspace/index.d.ts.map +1 -1
  189. package/dist/sdk/workspace/index.js +1 -1
  190. package/dist/sdk/workspace/index.js.map +1 -1
  191. package/dist/sdk/workspace/templates.js +1 -1
  192. package/dist/sdk/workspace/weekly.js +1 -1
  193. package/dist/sdk/workspace/wikilinks.js +1 -1
  194. package/dist/test-utils/command-runner.js +1 -1
  195. package/dist/test-utils/factories.js +1 -1
  196. package/dist/test-utils/fixtures.js +1 -1
  197. package/dist/test-utils/http-mock.js +1 -1
  198. package/dist/test-utils/index.js +1 -1
  199. package/dist/utils/async.js +1 -1
  200. package/dist/utils/colors.js +1 -1
  201. package/dist/utils/diff.js +1 -1
  202. package/dist/utils/file-permissions.js +1 -1
  203. package/dist/utils/file-reader.js +1 -1
  204. package/dist/utils/github-releases.js +1 -1
  205. package/dist/utils/global-cache.js +1 -1
  206. package/dist/utils/json-loader.js +1 -1
  207. package/dist/utils/local-cache.js +1 -1
  208. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  209. package/dist/utils/logger/formatters/index.js +1 -1
  210. package/dist/utils/logger/handlers/console-handler.js +1 -1
  211. package/dist/utils/logger/handlers/file-handler.js +1 -1
  212. package/dist/utils/logger/handlers/index.js +1 -1
  213. package/dist/utils/logger/handlers/null-handler.js +1 -1
  214. package/dist/utils/logger/index.js +1 -1
  215. package/dist/utils/logger/logger.js +1 -1
  216. package/dist/utils/logger/types.js +1 -1
  217. package/dist/utils/option-validation.js +1 -1
  218. package/dist/utils/process.d.ts +3 -0
  219. package/dist/utils/process.d.ts.map +1 -1
  220. package/dist/utils/process.js +1 -1
  221. package/dist/utils/process.js.map +1 -1
  222. package/dist/utils/prompt.js +1 -1
  223. package/dist/utils/spinner.js +1 -1
  224. package/dist/utils/sse-parser.js +1 -1
  225. package/dist/utils/string-utils.js +1 -1
  226. package/dist/utils/table-ref-parser.js +1 -1
  227. package/dist/utils/tdx-logger.js +1 -1
  228. package/dist/utils/version-check.d.ts +10 -2
  229. package/dist/utils/version-check.d.ts.map +1 -1
  230. package/dist/utils/version-check.js +1 -1
  231. package/dist/utils/version-check.js.map +1 -1
  232. package/package.json +1 -1
@@ -1 +1 @@
1
- const a25_0x364dfe=a25_0x4a39;(function(_0x27224d,_0x23a26a){const _0x169017=a25_0x4a39,_0x51d24b=_0x27224d();while(!![]){try{const _0x155fa3=-parseInt(_0x169017(0xea))/0x1+parseInt(_0x169017(0x101))/0x2*(parseInt(_0x169017(0x105))/0x3)+-parseInt(_0x169017(0xee))/0x4+parseInt(_0x169017(0xe3))/0x5*(-parseInt(_0x169017(0xf9))/0x6)+parseInt(_0x169017(0x10f))/0x7+-parseInt(_0x169017(0x104))/0x8+-parseInt(_0x169017(0xf4))/0x9*(-parseInt(_0x169017(0xed))/0xa);if(_0x155fa3===_0x23a26a)break;else _0x51d24b['push'](_0x51d24b['shift']());}catch(_0x3a9fa8){_0x51d24b['push'](_0x51d24b['shift']());}}}(a25_0x5d6a,0x225e3));import{BaseCommand}from'./command.js';function a25_0x4a39(_0x2808de,_0x225c40){_0x2808de=_0x2808de-0xe0;const _0x5d6a57=a25_0x5d6a();let _0x4a3940=_0x5d6a57[_0x2808de];return _0x4a3940;}import{findYamlFiles,isYamlFile}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a25_0xc223c8 from'chalk';import a25_0x5c1c46 from'path';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';function a25_0x5d6a(){const _0x16ed71=['\x20warning(s)\x20found','invalidCount','\x20non-template\x20file(s)\x20skipped','green','resolve','\x20non-template\x20file(s)\x20skipped)','warnings','validCount','1109710pyyvMo','description','template','relativePath','✔\x20All\x20','error','yellow','skippedCount','filter','45jGwPic','Error:\x20Directory\x20not\x20found:\x20','\x20warning(s)','.yml','Validate\x20template\x20YAML\x20files','\x20template(s)\x20valid','name','134461ECgkoz','.yaml','warningCount','6259370ijHEfx','829652FgiTaN','engage:template:validate','\x20(skipped:\x20','Validation\x20failed:\x20','No\x20template\x20YAML\x20files\x20found\x20in\x20','errors','9VvGcyg','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','valid','\x20template(s)\x20with\x20errors,\x20','verbose','182964OOpuCX','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','\x20valid','endsWith','reason','red','length','dim','166256mVbBxT','log','\x20error(s)','2214080fAXURa','9spRqgm','cwd'];a25_0x5d6a=function(){return _0x16ed71;};return a25_0x5d6a();}import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class EngageTemplateValidateCommand extends BaseCommand{[a25_0x364dfe(0xe9)]=a25_0x364dfe(0xef);[a25_0x364dfe(0x110)]=a25_0x364dfe(0xe7);async['execute'](_0x3d9417){const _0x2297bf=a25_0x364dfe,{options:_0x4fd727,args:_0x2cb635}=_0x3d9417,_0x17b1f2=_0x4fd727,_0x3ab05e=_0x2cb635[0x0],_0x459592=_0x3ab05e?a25_0x5c1c46[_0x2297bf(0x10b)](_0x3ab05e):undefined,_0x1c523c=_0x459592?isYamlFile(_0x459592):![];let _0x2df53e,_0xd9f0c5;if(_0x1c523c&&_0x459592)_0x2df53e=a25_0x5c1c46['dirname'](_0x459592),_0xd9f0c5=_0x459592;else _0x459592?_0x2df53e=_0x459592:_0x2df53e=process[_0x2297bf(0x106)]();if(!_0xd9f0c5&&!existsSync(_0x2df53e))return console[_0x2297bf(0x114)](a25_0xc223c8[_0x2297bf(0xfe)](_0x2297bf(0xe4)+_0x2df53e+'\x0a')),0x1;let _0x32e3ad;if(_0xd9f0c5){if(!_0xd9f0c5[_0x2297bf(0xfc)](_0x2297bf(0xe6))&&!_0xd9f0c5[_0x2297bf(0xfc)](_0x2297bf(0xeb)))return console[_0x2297bf(0x114)](a25_0xc223c8['red'](_0x2297bf(0xf5)+_0xd9f0c5+'\x0a')),0x1;_0x32e3ad=[_0xd9f0c5];}else _0x32e3ad=findYamlFiles(_0x2df53e);if(_0x32e3ad[_0x2297bf(0xff)]===0x0)return console[_0x2297bf(0x114)](a25_0xc223c8[_0x2297bf(0xfe)](_0x2297bf(0xfa)+_0x2df53e+'\x0a')),0x1;const _0x2d21aa=validateYamlFiles(_0x32e3ad,_0x2df53e,{'filterType':_0x2297bf(0x111)}),_0x11a413=calculateSummary(_0x2d21aa),_0x1d7c1c=_0x2d21aa[_0x2297bf(0xe2)](isValidationResult);if(_0x1d7c1c[_0x2297bf(0xff)]===0x0)return console[_0x2297bf(0x114)](a25_0xc223c8[_0x2297bf(0xe0)](_0x2297bf(0xf2)+_0x2df53e+'\x0a')),_0x11a413[_0x2297bf(0xe1)]>0x0&&console[_0x2297bf(0x114)](a25_0xc223c8[_0x2297bf(0x100)]('('+_0x11a413[_0x2297bf(0xe1)]+_0x2297bf(0x10c))),0x0;for(const _0x32baec of _0x2d21aa){if(!isValidationResult(_0x32baec)){_0x17b1f2[_0x2297bf(0xf8)]&&console[_0x2297bf(0x102)](a25_0xc223c8[_0x2297bf(0x100)]('-\x20'+_0x32baec[_0x2297bf(0x112)]+_0x2297bf(0xf0)+_0x32baec[_0x2297bf(0xfd)]+')'));continue;}const {relativePath:_0x32895d,source:_0x3d9daa,result:_0x196c0b}=_0x32baec;if(_0x196c0b['valid']&&_0x196c0b[_0x2297bf(0x10d)]['length']===0x0)_0x17b1f2['verbose']&&console[_0x2297bf(0x102)](a25_0xc223c8[_0x2297bf(0x10a)]('✔\x20'+_0x32895d));else _0x196c0b[_0x2297bf(0xf6)]?(console['log'](a25_0xc223c8[_0x2297bf(0xe0)]('⚠\x20'+_0x32895d+':\x20'+_0x196c0b[_0x2297bf(0x10d)][_0x2297bf(0xff)]+_0x2297bf(0xe5))),console[_0x2297bf(0x102)](formatValidationResult(_0x196c0b,_0x3d9daa,_0x32895d))):(console['log'](a25_0xc223c8[_0x2297bf(0xfe)]('✖\x20'+_0x32895d+':\x20'+_0x196c0b[_0x2297bf(0xf3)]['length']+_0x2297bf(0x103))),console[_0x2297bf(0x102)](formatValidationResult(_0x196c0b,_0x3d9daa,_0x32895d)));}return console['log'](''),_0x11a413['hasErrors']?(console[_0x2297bf(0x102)](a25_0xc223c8[_0x2297bf(0xfe)](_0x2297bf(0xf1)+_0x11a413[_0x2297bf(0x108)]+_0x2297bf(0xf7)+_0x11a413[_0x2297bf(0x10e)]+_0x2297bf(0xfb))),_0x11a413[_0x2297bf(0xec)]>0x0&&console[_0x2297bf(0x102)](a25_0xc223c8[_0x2297bf(0xe0)](_0x11a413['warningCount']+_0x2297bf(0x107))),_0x11a413['skippedCount']>0x0&&console[_0x2297bf(0x102)](a25_0xc223c8[_0x2297bf(0x100)](_0x11a413[_0x2297bf(0xe1)]+_0x2297bf(0x109))),0x1):(console[_0x2297bf(0x102)](a25_0xc223c8['green'](_0x2297bf(0x113)+_0x11a413['validCount']+_0x2297bf(0xe8))),_0x11a413[_0x2297bf(0xec)]>0x0&&console[_0x2297bf(0x102)](a25_0xc223c8['yellow'](_0x11a413[_0x2297bf(0xec)]+_0x2297bf(0x107))),_0x11a413['skippedCount']>0x0&&console[_0x2297bf(0x102)](a25_0xc223c8[_0x2297bf(0x100)](_0x11a413['skippedCount']+_0x2297bf(0x109))),0x0);}}
1
+ const a25_0xf34920=a25_0x149e;(function(_0xebdd28,_0x375e07){const _0x4ee1ca=a25_0x149e,_0x3e480f=_0xebdd28();while(!![]){try{const _0x10b2c6=-parseInt(_0x4ee1ca(0x11a))/0x1*(parseInt(_0x4ee1ca(0xec))/0x2)+parseInt(_0x4ee1ca(0x11b))/0x3+-parseInt(_0x4ee1ca(0x100))/0x4+parseInt(_0x4ee1ca(0x10a))/0x5*(-parseInt(_0x4ee1ca(0x101))/0x6)+parseInt(_0x4ee1ca(0x102))/0x7*(parseInt(_0x4ee1ca(0xf6))/0x8)+-parseInt(_0x4ee1ca(0x105))/0x9*(-parseInt(_0x4ee1ca(0x11d))/0xa)+parseInt(_0x4ee1ca(0xfa))/0xb;if(_0x10b2c6===_0x375e07)break;else _0x3e480f['push'](_0x3e480f['shift']());}catch(_0x5d14a1){_0x3e480f['push'](_0x3e480f['shift']());}}}(a25_0x5c6b,0x5bac6));import{BaseCommand}from'./command.js';import{findYamlFiles,isYamlFile}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';function a25_0x149e(_0x39f731,_0x4454d7){_0x39f731=_0x39f731-0xec;const _0x5c6bdc=a25_0x5c6b();let _0x149ec5=_0x5c6bdc[_0x39f731];return _0x149ec5;}import a25_0x5421ca from'chalk';import a25_0xb5ee2c 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{[a25_0xf34920(0x103)]=a25_0xf34920(0xf8);[a25_0xf34920(0xed)]=a25_0xf34920(0xf4);async[a25_0xf34920(0x106)](_0x1ac0e3){const _0x4606f2=a25_0xf34920,{options:_0x4bfe23,args:_0x3276e5}=_0x1ac0e3,_0x30b552=_0x4bfe23,_0x2d8e69=_0x3276e5[0x0],_0x2cb6fd=_0x2d8e69?a25_0xb5ee2c[_0x4606f2(0xf1)](_0x2d8e69):undefined,_0x546730=_0x2cb6fd?isYamlFile(_0x2cb6fd):![];let _0x43879d,_0x19e17a;if(_0x546730&&_0x2cb6fd)_0x43879d=a25_0xb5ee2c[_0x4606f2(0x10f)](_0x2cb6fd),_0x19e17a=_0x2cb6fd;else _0x2cb6fd?_0x43879d=_0x2cb6fd:_0x43879d=process[_0x4606f2(0x111)]();if(!_0x19e17a&&!existsSync(_0x43879d))return console['error'](a25_0x5421ca[_0x4606f2(0xfb)](_0x4606f2(0x112)+_0x43879d+'\x0a')),0x1;let _0x2e2a40;if(_0x19e17a){if(!_0x19e17a[_0x4606f2(0xfc)](_0x4606f2(0x10c))&&!_0x19e17a[_0x4606f2(0xfc)](_0x4606f2(0xfd)))return console[_0x4606f2(0x107)](a25_0x5421ca[_0x4606f2(0xfb)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x19e17a+'\x0a')),0x1;_0x2e2a40=[_0x19e17a];}else _0x2e2a40=findYamlFiles(_0x43879d);if(_0x2e2a40[_0x4606f2(0x115)]===0x0)return console['error'](a25_0x5421ca[_0x4606f2(0xfb)](_0x4606f2(0x109)+_0x43879d+'\x0a')),0x1;const _0x344445=validateYamlFiles(_0x2e2a40,_0x43879d,{'filterType':_0x4606f2(0xfe)}),_0x4645bf=calculateSummary(_0x344445),_0x428989=_0x344445['filter'](isValidationResult);if(_0x428989['length']===0x0)return console[_0x4606f2(0x107)](a25_0x5421ca[_0x4606f2(0x11e)](_0x4606f2(0x113)+_0x43879d+'\x0a')),_0x4645bf[_0x4606f2(0x104)]>0x0&&console['error'](a25_0x5421ca['dim']('('+_0x4645bf[_0x4606f2(0x104)]+'\x20non-template\x20file(s)\x20skipped)')),0x0;for(const _0x3054a8 of _0x344445){if(!isValidationResult(_0x3054a8)){_0x30b552[_0x4606f2(0x119)]&&console[_0x4606f2(0x117)](a25_0x5421ca[_0x4606f2(0xf3)]('-\x20'+_0x3054a8[_0x4606f2(0xf5)]+_0x4606f2(0x118)+_0x3054a8[_0x4606f2(0xf0)]+')'));continue;}const {relativePath:_0x8209c0,source:_0x1fad0f,result:_0x56621b}=_0x3054a8;if(_0x56621b[_0x4606f2(0x10b)]&&_0x56621b['warnings']['length']===0x0)_0x30b552['verbose']&&console[_0x4606f2(0x117)](a25_0x5421ca['green']('✔\x20'+_0x8209c0));else _0x56621b[_0x4606f2(0x10b)]?(console['log'](a25_0x5421ca[_0x4606f2(0x11e)]('⚠\x20'+_0x8209c0+':\x20'+_0x56621b[_0x4606f2(0x11c)][_0x4606f2(0x115)]+'\x20warning(s)')),console[_0x4606f2(0x117)](formatValidationResult(_0x56621b,_0x1fad0f,_0x8209c0))):(console[_0x4606f2(0x117)](a25_0x5421ca[_0x4606f2(0xfb)]('✖\x20'+_0x8209c0+':\x20'+_0x56621b[_0x4606f2(0x10d)][_0x4606f2(0x115)]+_0x4606f2(0x116))),console[_0x4606f2(0x117)](formatValidationResult(_0x56621b,_0x1fad0f,_0x8209c0)));}return console['log'](''),_0x4645bf[_0x4606f2(0xf9)]?(console[_0x4606f2(0x117)](a25_0x5421ca['red'](_0x4606f2(0x11f)+_0x4645bf[_0x4606f2(0x114)]+_0x4606f2(0x108)+_0x4645bf[_0x4606f2(0x10e)]+_0x4606f2(0xef))),_0x4645bf[_0x4606f2(0xee)]>0x0&&console[_0x4606f2(0x117)](a25_0x5421ca[_0x4606f2(0x11e)](_0x4645bf[_0x4606f2(0xee)]+_0x4606f2(0xff))),_0x4645bf['skippedCount']>0x0&&console[_0x4606f2(0x117)](a25_0x5421ca['dim'](_0x4645bf[_0x4606f2(0x104)]+'\x20non-template\x20file(s)\x20skipped')),0x1):(console[_0x4606f2(0x117)](a25_0x5421ca[_0x4606f2(0xf7)](_0x4606f2(0xf2)+_0x4645bf[_0x4606f2(0x10e)]+'\x20template(s)\x20valid')),_0x4645bf[_0x4606f2(0xee)]>0x0&&console[_0x4606f2(0x117)](a25_0x5421ca[_0x4606f2(0x11e)](_0x4645bf[_0x4606f2(0xee)]+'\x20warning(s)\x20found')),_0x4645bf[_0x4606f2(0x104)]>0x0&&console[_0x4606f2(0x117)](a25_0x5421ca[_0x4606f2(0xf3)](_0x4645bf[_0x4606f2(0x104)]+_0x4606f2(0x110))),0x0);}}function a25_0x5c6b(){const _0x208666=['.yml','errors','validCount','dirname','\x20non-template\x20file(s)\x20skipped','cwd','Error:\x20Directory\x20not\x20found:\x20','No\x20template\x20YAML\x20files\x20found\x20in\x20','invalidCount','length','\x20error(s)','log','\x20(skipped:\x20','verbose','413QqaXzF','1116846ffJfun','warnings','10iOdBiP','yellow','Validation\x20failed:\x20','278IakXvp','description','warningCount','\x20valid','reason','resolve','✔\x20All\x20','dim','Validate\x20template\x20YAML\x20files','relativePath','8nEoZYh','green','engage:template:validate','hasErrors','4185929QJQeJp','red','endsWith','.yaml','template','\x20warning(s)\x20found','1053456EAhwhl','135870dXCJJW','1010583ZpIHhe','name','skippedCount','433530BWCWjR','execute','error','\x20template(s)\x20with\x20errors,\x20','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','55oOTAZj','valid'];a25_0x5c6b=function(){return _0x208666;};return a25_0x5c6b();}
@@ -1 +1 @@
1
- const a26_0xbf4631=a26_0x161d;(function(_0x6069e4,_0x512e7d){const _0x48ef06=a26_0x161d,_0x5ab66e=_0x6069e4();while(!![]){try{const _0x40fec4=parseInt(_0x48ef06(0x18e))/0x1+parseInt(_0x48ef06(0x1a0))/0x2*(parseInt(_0x48ef06(0x1c3))/0x3)+parseInt(_0x48ef06(0x1b5))/0x4*(-parseInt(_0x48ef06(0x1a3))/0x5)+-parseInt(_0x48ef06(0x18f))/0x6*(-parseInt(_0x48ef06(0x1d2))/0x7)+-parseInt(_0x48ef06(0x1c0))/0x8*(-parseInt(_0x48ef06(0x1a9))/0x9)+-parseInt(_0x48ef06(0x180))/0xa*(parseInt(_0x48ef06(0x1b2))/0xb)+-parseInt(_0x48ef06(0x196))/0xc*(parseInt(_0x48ef06(0x19e))/0xd);if(_0x40fec4===_0x512e7d)break;else _0x5ab66e['push'](_0x5ab66e['shift']());}catch(_0x377fbe){_0x5ab66e['push'](_0x5ab66e['shift']());}}}(a26_0x3253,0xd6802));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';function a26_0x3253(){const _0x115919=['Show\x20job\x20details','url','kill','Getting\x20job\x20details...','user_name','List\x20jobs','execute','hive','11lkdbLS','error','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','4xetUHH','Query\x20is\x20required\x0aUsage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','jobType','Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','trino','type','Database:\x20','database','just\x20now','Getting\x20job\x20results...','yes','32ZSXaMq','\x27\x20to\x20verify\x20the\x20job\x20status','floor','3014733lAHRnJ','file','Listing\x20jobs...','--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','now','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20result\x20<job-id>','map','No\x20SQL\x20statements\x20found\x20in\x20file','log','args','verbose','created_at','Cancelled','site','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20kill\x20<job-id>','8308839vSBMPB','result','\x20row','end_at','getTime','✔\x20Job\x20submitted','query','Query:\x20','Submitting\x20job...','data','job_id','Kill\x20a\x20job','length','push','priority','h\x20ago','6244510gjQzte','Status\x20filter:\x20','\x20jobs','mo\x20ago','...','jobs','Submit\x20a\x20job','submit','name','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','INVALID_ARGUMENT','show','start_at','round','775185PwkwAM','6xVUJaD','abs','\x20job','job:submit','✔\x20Found\x20','debug','status','22745748jKIJUN','Submitting\x20kill\x20request...','presto','Job\x20type:\x20','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20show\x20<job-id>','red','description','join','13HmlkOF','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','2lTEQmw','job:result','Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','1779185mbUUdk','substring','validate','Limit:\x20','dim','limit','1771398zwcGOd'];a26_0x3253=function(){return _0x115919;};return a26_0x3253();}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';function a26_0x161d(_0x46234b,_0x3c43ad){_0x46234b=_0x46234b-0x179;const _0x325318=a26_0x3253();let _0x161ddb=_0x325318[_0x46234b];return _0x161ddb;}import{getJobUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a26_0x46d3ab from'chalk';function formatDuration(_0x1926f7){const _0x4e8c73=a26_0x161d;if(_0x1926f7<0x3c)return _0x1926f7+'s';if(_0x1926f7<0xe10)return Math['floor'](_0x1926f7/0x3c)+'m\x20'+_0x1926f7%0x3c+'s';const _0x3e4697=Math[_0x4e8c73(0x1c2)](_0x1926f7/0xe10),_0x7ba71a=Math[_0x4e8c73(0x1c2)](_0x1926f7%0xe10/0x3c);return _0x7ba71a>0x0?_0x3e4697+'h\x20'+_0x7ba71a+'m':_0x3e4697+'h';}function formatRelativeTime(_0xd6a20d){const _0xf54111=a26_0x161d,_0x3033b7=Date[_0xf54111(0x1c7)]()-_0xd6a20d[_0xf54111(0x1d6)](),_0x37d489=Math['floor'](Math[_0xf54111(0x190)](_0x3033b7)/0x3e8);if(_0x37d489<0x3c)return _0xf54111(0x1bd);const _0x28fa24=Math[_0xf54111(0x1c2)](_0x37d489/0x3c);if(_0x28fa24<0x3c)return _0x28fa24+'m\x20ago';const _0x705900=Math[_0xf54111(0x1c2)](_0x28fa24/0x3c);if(_0x705900<0x18)return _0x705900+_0xf54111(0x17f);const _0x375aae=Math[_0xf54111(0x1c2)](_0x705900/0x18);if(_0x375aae<0x1e)return _0x375aae+'d\x20ago';return Math[_0xf54111(0x1c2)](_0x375aae/0x1e)+_0xf54111(0x183);}export class JobListCommand extends BaseCommand{[a26_0xbf4631(0x188)]='jobs';[a26_0xbf4631(0x19c)]=a26_0xbf4631(0x1af);async[a26_0xbf4631(0x1b0)](_0x5241ff){const _0x4a45d1=a26_0xbf4631,{options:_0x10aa16,tdx:_0x4ff72e}=_0x5241ff,_0x4ef32d=resolveLimit(_0x10aa16[_0x4a45d1(0x1a8)],DEFAULT_DISPLAY_LIMIT),_0x148e17=_0x10aa16[_0x4a45d1(0x195)];_0x10aa16['verbose']&&(console['error'](_0x4a45d1(0x1a6)+_0x4ef32d+_0x4a45d1(0x182)),_0x148e17&&console[_0x4a45d1(0x1b3)](_0x4a45d1(0x181)+_0x148e17));const _0x2842d2=await withSpinner(_0x4a45d1(0x1c5),()=>_0x4ff72e[_0x4a45d1(0x185)]['list']({'from':0x0,'to':_0x4ef32d-0x1,'status':_0x148e17}),{'verbose':_0x10aa16[_0x4a45d1(0x1cd)]}),_0x559055=_0x2842d2['data'];console[_0x4a45d1(0x1b3)](_0x4a45d1(0x193)+_0x559055[_0x4a45d1(0x17c)]+_0x4a45d1(0x191)+(_0x559055[_0x4a45d1(0x17c)]!==0x1?'s':''));const _0x2d5537=_0x10aa16[_0x4a45d1(0x1d0)];if(isStructuredFormat(_0x10aa16)){const _0x5ce3ad=_0x559055[_0x4a45d1(0x1c9)](_0x27c946=>{const _0x456363=_0x4a45d1;let _0x49f25f;if(_0x27c946[_0x456363(0x18c)]&&_0x27c946[_0x456363(0x1d5)]){const _0x4ab9c1=new Date(_0x27c946['start_at'])[_0x456363(0x1d6)](),_0x1dc06f=new Date(_0x27c946[_0x456363(0x1d5)])['getTime']();_0x49f25f=Math[_0x456363(0x18d)]((_0x1dc06f-_0x4ab9c1)/0x3e8);}return{'job_id':_0x27c946[_0x456363(0x17a)],'type':_0x27c946[_0x456363(0x1ba)]===_0x456363(0x198)?_0x456363(0x1b9):_0x27c946['type'],'status':_0x27c946['status'],'user_name':_0x27c946[_0x456363(0x1ae)],'duration_sec':_0x49f25f,'created_at':_0x27c946['created_at'],'started_at':_0x27c946[_0x456363(0x18c)],'end_at':_0x27c946[_0x456363(0x1d5)]};});await handleSDKOutput(_0x5ce3ad,_0x10aa16);}else for(const _0x1da066 of _0x559055){const _0x20ddfd=_0x1da066[_0x4a45d1(0x195)]==='success'?a26_0x46d3ab['green']:_0x1da066[_0x4a45d1(0x195)]==='error'?a26_0x46d3ab[_0x4a45d1(0x19b)]:a26_0x46d3ab['dim'],_0x1bcd7b=_0x20ddfd(_0x1da066[_0x4a45d1(0x195)]),_0x3e363b=getJobUrl(_0x2d5537,_0x1da066[_0x4a45d1(0x17a)]),_0x44d179=hyperlink(_0x1da066[_0x4a45d1(0x17a)],_0x3e363b),_0x4632f4=a26_0x46d3ab[_0x4a45d1(0x1a7)](_0x1da066[_0x4a45d1(0x1ba)]===_0x4a45d1(0x198)?_0x4a45d1(0x1b9):_0x1da066['type']),_0x41809f=[];if(_0x1da066[_0x4a45d1(0x18c)]&&_0x1da066[_0x4a45d1(0x1d5)]){const _0x629820=Math[_0x4a45d1(0x18d)]((new Date(_0x1da066[_0x4a45d1(0x1d5)])[_0x4a45d1(0x1d6)]()-new Date(_0x1da066[_0x4a45d1(0x18c)])[_0x4a45d1(0x1d6)]())/0x3e8);_0x41809f[_0x4a45d1(0x17d)](formatDuration(_0x629820));}if(_0x1da066[_0x4a45d1(0x1d5)])_0x41809f[_0x4a45d1(0x17d)](formatRelativeTime(new Date(_0x1da066[_0x4a45d1(0x1d5)])));else _0x1da066[_0x4a45d1(0x18c)]&&_0x41809f[_0x4a45d1(0x17d)](formatRelativeTime(new Date(_0x1da066[_0x4a45d1(0x18c)])));const _0xa19224=_0x41809f[_0x4a45d1(0x17c)]>0x0?a26_0x46d3ab[_0x4a45d1(0x1a7)]('\x20'+_0x41809f[_0x4a45d1(0x19d)](',\x20')):'';console[_0x4a45d1(0x1cb)]('⚡\x20'+_0x44d179+'\x20'+_0x4632f4+'\x20'+_0x1bcd7b+_0xa19224);}return 0x0;}}export class JobShowCommand extends BaseCommand{[a26_0xbf4631(0x188)]='job:show';['description']=a26_0xbf4631(0x1aa);[a26_0xbf4631(0x1a5)](_0x4a1a5c){const _0x3e2ad2=a26_0xbf4631,_0xad1900=_0x4a1a5c[_0x3e2ad2(0x1cc)][0x0];if(!_0xad1900)return _0x3e2ad2(0x19a);return undefined;}async[a26_0xbf4631(0x1b0)](_0x1f8db2){const _0x31fc3f=a26_0xbf4631,{options:_0x2835d8,args:_0x5e59b6,tdx:_0x253b98}=_0x1f8db2,_0x4aea2a=_0x5e59b6[0x0],_0x56dbf0=await withSpinner(_0x31fc3f(0x1ad),()=>_0x253b98[_0x31fc3f(0x185)][_0x31fc3f(0x18b)](_0x4aea2a),{'verbose':_0x2835d8[_0x31fc3f(0x1cd)]}),_0x238d53=_0x56dbf0[_0x31fc3f(0x179)];let _0x233a64;if(_0x238d53[_0x31fc3f(0x18c)]&&_0x238d53[_0x31fc3f(0x1d5)]){const _0x46082d=new Date(_0x238d53[_0x31fc3f(0x18c)])[_0x31fc3f(0x1d6)](),_0x5370d7=new Date(_0x238d53[_0x31fc3f(0x1d5)])[_0x31fc3f(0x1d6)]();_0x233a64=Math[_0x31fc3f(0x18d)]((_0x5370d7-_0x46082d)/0x3e8);}const _0xa8447a={'job_id':_0x238d53[_0x31fc3f(0x17a)],'type':_0x238d53['type'],'status':_0x238d53['status'],..._0x238d53[_0x31fc3f(0x1ae)]&&{'user_name':_0x238d53[_0x31fc3f(0x1ae)]},..._0x233a64!==undefined&&{'duration_sec':_0x233a64},..._0x238d53[_0x31fc3f(0x1ce)]&&{'created_at':_0x238d53['created_at']},..._0x238d53[_0x31fc3f(0x18c)]&&{'started_at':_0x238d53[_0x31fc3f(0x18c)]},..._0x238d53[_0x31fc3f(0x1d5)]&&{'end_at':_0x238d53[_0x31fc3f(0x1d5)]},..._0x238d53[_0x31fc3f(0x1bc)]&&{'database':_0x238d53[_0x31fc3f(0x1bc)]},..._0x238d53[_0x31fc3f(0x17e)]!==undefined&&{'priority':_0x238d53[_0x31fc3f(0x17e)]},..._0x238d53[_0x31fc3f(0x1ab)]&&{'url':_0x238d53['url']},..._0x238d53['query']&&{'query':_0x238d53[_0x31fc3f(0x1d8)]},..._0x238d53[_0x31fc3f(0x194)]&&{'debug':_0x238d53['debug']}};return await handleSingleObjectOutput(_0xa8447a,_0x2835d8),0x0;}}export class JobKillCommand extends BaseCommand{[a26_0xbf4631(0x188)]='job:kill';[a26_0xbf4631(0x19c)]=a26_0xbf4631(0x17b);[a26_0xbf4631(0x1a5)](_0x4fbda8){const _0x315b9a=a26_0xbf4631,_0x19f719=_0x4fbda8[_0x315b9a(0x1cc)][0x0];if(!_0x19f719)return _0x315b9a(0x1d1);return undefined;}async[a26_0xbf4631(0x1b0)](_0x4c18aa){const _0x2eb680=a26_0xbf4631,{options:_0x47dcff,args:_0xe61619,tdx:_0x2d608f}=_0x4c18aa,_0x4567eb=_0xe61619[0x0];if(!_0x47dcff[_0x2eb680(0x1bf)]){const _0x2bee90=await confirm(_0x2eb680(0x189)+_0x4567eb+'?');if(!_0x2bee90)return console['error'](_0x2eb680(0x1cf)),0x0;}return await withSpinner(_0x2eb680(0x197),()=>_0x2d608f['jobs'][_0x2eb680(0x1ac)](_0x4567eb),{'verbose':_0x47dcff[_0x2eb680(0x1cd)]}),console['error'](_0x2eb680(0x1b4)+_0x4567eb),console[_0x2eb680(0x1b3)](_0x2eb680(0x19f)+_0x4567eb+_0x2eb680(0x1c1)),0x0;}}export class JobSubmitCommand extends BaseCommand{['name']=a26_0xbf4631(0x192);['description']=a26_0xbf4631(0x186);async[a26_0xbf4631(0x1b0)](_0x385d2c){const _0x47f361=a26_0xbf4631,{options:_0xf7b5c8,args:_0x58a7fa,tdx:_0x48ddb4}=_0x385d2c,_0x40eb4c=_0xf7b5c8[_0x47f361(0x1b7)]||_0x47f361(0x1b9),_0x5c6d1b=_0xf7b5c8[_0x47f361(0x1c4)],_0x439cd0=_0xf7b5c8[_0x47f361(0x1bc)]||'information_schema',_0x2c9214=_0xf7b5c8[_0x47f361(0x1d3)];if(_0x40eb4c!==_0x47f361(0x1b9)&&_0x40eb4c!==_0x47f361(0x1b1))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x47f361(0x1c6));let _0x3ee933;if(_0x5c6d1b){if(_0x58a7fa[0x0])throw new SDKError(ErrorCode[_0x47f361(0x18a)],_0x47f361(0x1a2));const _0x29dd93=readSqlStatementsFromFile(_0x5c6d1b);if(_0x29dd93['length']===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x47f361(0x1ca));if(_0x29dd93['length']>0x1)throw new SDKError(ErrorCode[_0x47f361(0x18a)],_0x47f361(0x1b8));_0x3ee933=_0x29dd93[0x0];}else{if(!_0x58a7fa[0x0])throw new SDKError(ErrorCode[_0x47f361(0x18a)],_0x47f361(0x1b6));_0x3ee933=_0x58a7fa[0x0];}_0xf7b5c8[_0x47f361(0x1cd)]&&(console[_0x47f361(0x1b3)](_0x47f361(0x199)+_0x40eb4c),console[_0x47f361(0x1b3)](_0x47f361(0x1bb)+_0x439cd0),console[_0x47f361(0x1b3)](_0x47f361(0x1d9)+_0x3ee933[_0x47f361(0x1a4)](0x0,0x64)+(_0x3ee933[_0x47f361(0x17c)]>0x64?_0x47f361(0x184):'')));const _0xc71531=await withSpinner(_0x47f361(0x1da),()=>_0x48ddb4[_0x47f361(0x185)][_0x47f361(0x187)](_0x439cd0,_0x3ee933,_0x40eb4c,_0x2c9214),{'verbose':_0xf7b5c8[_0x47f361(0x1cd)]}),_0x4c1807=_0xc71531[_0x47f361(0x179)];return console[_0x47f361(0x1b3)](_0x47f361(0x1d7)),console[_0x47f361(0x1b3)]('\x20\x20Job\x20ID:\x20'+_0x4c1807[_0x47f361(0x17a)]),await handleSDKOutput([_0x4c1807],_0xf7b5c8),0x0;}}export class JobResultCommand extends BaseCommand{[a26_0xbf4631(0x188)]=a26_0xbf4631(0x1a1);['description']='Get\x20job\x20results';['validate'](_0x2554a0){const _0x4c7db5=a26_0xbf4631,_0x272bf8=_0x2554a0['args'][0x0];if(!_0x272bf8)return _0x4c7db5(0x1c8);return undefined;}async['execute'](_0x13d587){const _0x37b97f=a26_0xbf4631,{options:_0x538f33,args:_0x1a6ca6,tdx:_0x43ce14}=_0x13d587,_0x3ec72c=_0x1a6ca6[0x0],_0x37cf02=await withSpinner(_0x37b97f(0x1be),()=>_0x43ce14[_0x37b97f(0x185)][_0x37b97f(0x1d3)](_0x3ec72c),{'verbose':_0x538f33[_0x37b97f(0x1cd)]}),_0x4a7b22=_0x37cf02[_0x37b97f(0x179)];return console[_0x37b97f(0x1b3)]('✔\x20Retrieved\x20'+_0x4a7b22['length']+_0x37b97f(0x1d4)+(_0x4a7b22[_0x37b97f(0x17c)]!==0x1?'s':'')),await handleSDKOutput(_0x4a7b22,_0x538f33),0x0;}}
1
+ const a26_0x3d3515=a26_0x387a;(function(_0x466435,_0x51f6ca){const _0x5f4c00=a26_0x387a,_0x4b4eec=_0x466435();while(!![]){try{const _0x5edf42=parseInt(_0x5f4c00(0x1b7))/0x1*(-parseInt(_0x5f4c00(0x19d))/0x2)+parseInt(_0x5f4c00(0x199))/0x3*(-parseInt(_0x5f4c00(0x1c6))/0x4)+parseInt(_0x5f4c00(0x198))/0x5+parseInt(_0x5f4c00(0x1a6))/0x6*(-parseInt(_0x5f4c00(0x1a8))/0x7)+-parseInt(_0x5f4c00(0x18b))/0x8+-parseInt(_0x5f4c00(0x1d2))/0x9+-parseInt(_0x5f4c00(0x17e))/0xa*(-parseInt(_0x5f4c00(0x1c9))/0xb);if(_0x5edf42===_0x51f6ca)break;else _0x4b4eec['push'](_0x4b4eec['shift']());}catch(_0x5108e4){_0x4b4eec['push'](_0x4b4eec['shift']());}}}(a26_0x3ad3,0xa224d));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';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getJobUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a26_0x51996c from'chalk';function formatDuration(_0x4fe282){const _0x3e9750=a26_0x387a;if(_0x4fe282<0x3c)return _0x4fe282+'s';if(_0x4fe282<0xe10)return Math[_0x3e9750(0x184)](_0x4fe282/0x3c)+'m\x20'+_0x4fe282%0x3c+'s';const _0x46977b=Math[_0x3e9750(0x184)](_0x4fe282/0xe10),_0x4dfaf1=Math[_0x3e9750(0x184)](_0x4fe282%0xe10/0x3c);return _0x4dfaf1>0x0?_0x46977b+'h\x20'+_0x4dfaf1+'m':_0x46977b+'h';}function formatRelativeTime(_0x2e3ea7){const _0x14526b=a26_0x387a,_0x329cb1=Date[_0x14526b(0x195)]()-_0x2e3ea7[_0x14526b(0x188)](),_0x385ac7=Math['floor'](Math['abs'](_0x329cb1)/0x3e8);if(_0x385ac7<0x3c)return _0x14526b(0x1b1);const _0x300f5f=Math[_0x14526b(0x184)](_0x385ac7/0x3c);if(_0x300f5f<0x3c)return _0x300f5f+'m\x20ago';const _0x5051f4=Math[_0x14526b(0x184)](_0x300f5f/0x3c);if(_0x5051f4<0x18)return _0x5051f4+_0x14526b(0x19a);const _0x1c6b86=Math[_0x14526b(0x184)](_0x5051f4/0x18);if(_0x1c6b86<0x1e)return _0x1c6b86+_0x14526b(0x196);return Math['floor'](_0x1c6b86/0x1e)+_0x14526b(0x190);}export class JobListCommand extends BaseCommand{[a26_0x3d3515(0x1b8)]=a26_0x3d3515(0x1d3);[a26_0x3d3515(0x1d0)]=a26_0x3d3515(0x1ba);async[a26_0x3d3515(0x1c5)](_0x44b705){const _0x3ecdf6=a26_0x3d3515,{options:_0x44bd37,tdx:_0xc1aec2}=_0x44b705,_0x2caa0e=resolveLimit(_0x44bd37[_0x3ecdf6(0x1c7)],DEFAULT_DISPLAY_LIMIT),_0x49f201=_0x44bd37[_0x3ecdf6(0x1cf)];_0x44bd37[_0x3ecdf6(0x1ce)]&&(console[_0x3ecdf6(0x197)]('Limit:\x20'+_0x2caa0e+'\x20jobs'),_0x49f201&&console[_0x3ecdf6(0x197)](_0x3ecdf6(0x19f)+_0x49f201));const _0x117e53=await withSpinner('Listing\x20jobs...',()=>_0xc1aec2[_0x3ecdf6(0x1d3)][_0x3ecdf6(0x1a7)]({'from':0x0,'to':_0x2caa0e-0x1,'status':_0x49f201}),{'verbose':_0x44bd37[_0x3ecdf6(0x1ce)]}),_0x1a0e61=_0x117e53[_0x3ecdf6(0x182)];console[_0x3ecdf6(0x197)]('✔\x20Found\x20'+_0x1a0e61[_0x3ecdf6(0x18f)]+'\x20job'+(_0x1a0e61[_0x3ecdf6(0x18f)]!==0x1?'s':''));const _0x1de5e2=_0x44bd37[_0x3ecdf6(0x17f)];if(isStructuredFormat(_0x44bd37)){const _0x559cd6=_0x1a0e61[_0x3ecdf6(0x1b9)](_0x1daf9d=>{const _0x49dce3=_0x3ecdf6;let _0x738406;if(_0x1daf9d[_0x49dce3(0x1d5)]&&_0x1daf9d[_0x49dce3(0x1ae)]){const _0x4a56ff=new Date(_0x1daf9d['start_at'])[_0x49dce3(0x188)](),_0x3478d5=new Date(_0x1daf9d[_0x49dce3(0x1ae)])[_0x49dce3(0x188)]();_0x738406=Math[_0x49dce3(0x1ac)]((_0x3478d5-_0x4a56ff)/0x3e8);}return{'job_id':_0x1daf9d[_0x49dce3(0x1c3)],'type':_0x1daf9d[_0x49dce3(0x1a0)]===_0x49dce3(0x19b)?_0x49dce3(0x183):_0x1daf9d[_0x49dce3(0x1a0)],'status':_0x1daf9d[_0x49dce3(0x1cf)],'user_name':_0x1daf9d['user_name'],'duration_sec':_0x738406,'created_at':_0x1daf9d[_0x49dce3(0x1b3)],'started_at':_0x1daf9d['start_at'],'end_at':_0x1daf9d[_0x49dce3(0x1ae)]};});await handleSDKOutput(_0x559cd6,_0x44bd37);}else for(const _0x2c035e of _0x1a0e61){const _0x5a47f4=_0x2c035e[_0x3ecdf6(0x1cf)]===_0x3ecdf6(0x1b6)?a26_0x51996c[_0x3ecdf6(0x1bd)]:_0x2c035e['status']==='error'?a26_0x51996c[_0x3ecdf6(0x1bc)]:a26_0x51996c[_0x3ecdf6(0x1b4)],_0x3a7d38=_0x5a47f4(_0x2c035e[_0x3ecdf6(0x1cf)]),_0x264faf=getJobUrl(_0x1de5e2,_0x2c035e['job_id']),_0x38c528=hyperlink(_0x2c035e[_0x3ecdf6(0x1c3)],_0x264faf),_0x33ee5b=a26_0x51996c[_0x3ecdf6(0x1b4)](_0x2c035e[_0x3ecdf6(0x1a0)]==='presto'?_0x3ecdf6(0x183):_0x2c035e[_0x3ecdf6(0x1a0)]),_0xaf9d80=[];if(_0x2c035e[_0x3ecdf6(0x1d5)]&&_0x2c035e[_0x3ecdf6(0x1ae)]){const _0x372c72=Math[_0x3ecdf6(0x1ac)]((new Date(_0x2c035e[_0x3ecdf6(0x1ae)])[_0x3ecdf6(0x188)]()-new Date(_0x2c035e['start_at'])[_0x3ecdf6(0x188)]())/0x3e8);_0xaf9d80[_0x3ecdf6(0x19c)](formatDuration(_0x372c72));}if(_0x2c035e[_0x3ecdf6(0x1ae)])_0xaf9d80[_0x3ecdf6(0x19c)](formatRelativeTime(new Date(_0x2c035e[_0x3ecdf6(0x1ae)])));else _0x2c035e[_0x3ecdf6(0x1d5)]&&_0xaf9d80['push'](formatRelativeTime(new Date(_0x2c035e['start_at'])));const _0x7c78c8=_0xaf9d80['length']>0x0?a26_0x51996c[_0x3ecdf6(0x1b4)]('\x20'+_0xaf9d80[_0x3ecdf6(0x1ab)](',\x20')):'';console[_0x3ecdf6(0x180)]('⚡\x20'+_0x38c528+'\x20'+_0x33ee5b+'\x20'+_0x3a7d38+_0x7c78c8);}return 0x0;}}export class JobShowCommand extends BaseCommand{[a26_0x3d3515(0x1b8)]=a26_0x3d3515(0x1ad);[a26_0x3d3515(0x1d0)]=a26_0x3d3515(0x18a);['validate'](_0x33cbad){const _0x2a0b85=a26_0x3d3515,_0x443fc6=_0x33cbad[_0x2a0b85(0x18d)][0x0];if(!_0x443fc6)return _0x2a0b85(0x1bb);return undefined;}async[a26_0x3d3515(0x1c5)](_0x4e6ab6){const _0x5cc0fb=a26_0x3d3515,{options:_0x4cce63,args:_0x49ca62,tdx:_0x336344}=_0x4e6ab6,_0x54ebd3=_0x49ca62[0x0],_0x3bde6d=await withSpinner(_0x5cc0fb(0x1be),()=>_0x336344['jobs']['show'](_0x54ebd3),{'verbose':_0x4cce63[_0x5cc0fb(0x1ce)]}),_0x596002=_0x3bde6d[_0x5cc0fb(0x182)];let _0x578801;if(_0x596002[_0x5cc0fb(0x1d5)]&&_0x596002[_0x5cc0fb(0x1ae)]){const _0x5e9b89=new Date(_0x596002[_0x5cc0fb(0x1d5)])[_0x5cc0fb(0x188)](),_0x13b9e3=new Date(_0x596002['end_at'])['getTime']();_0x578801=Math[_0x5cc0fb(0x1ac)]((_0x13b9e3-_0x5e9b89)/0x3e8);}const _0x5abaf0={'job_id':_0x596002[_0x5cc0fb(0x1c3)],'type':_0x596002[_0x5cc0fb(0x1a0)],'status':_0x596002['status'],..._0x596002['user_name']&&{'user_name':_0x596002['user_name']},..._0x578801!==undefined&&{'duration_sec':_0x578801},..._0x596002[_0x5cc0fb(0x1b3)]&&{'created_at':_0x596002[_0x5cc0fb(0x1b3)]},..._0x596002[_0x5cc0fb(0x1d5)]&&{'started_at':_0x596002[_0x5cc0fb(0x1d5)]},..._0x596002[_0x5cc0fb(0x1ae)]&&{'end_at':_0x596002[_0x5cc0fb(0x1ae)]},..._0x596002[_0x5cc0fb(0x191)]&&{'database':_0x596002['database']},..._0x596002[_0x5cc0fb(0x1a4)]!==undefined&&{'priority':_0x596002['priority']},..._0x596002[_0x5cc0fb(0x19e)]&&{'url':_0x596002[_0x5cc0fb(0x19e)]},..._0x596002[_0x5cc0fb(0x192)]&&{'query':_0x596002[_0x5cc0fb(0x192)]},..._0x596002[_0x5cc0fb(0x1b2)]&&{'debug':_0x596002[_0x5cc0fb(0x1b2)]}};return await handleSingleObjectOutput(_0x5abaf0,_0x4cce63),0x0;}}function a26_0x387a(_0xd7b53,_0x3c55db){_0xd7b53=_0xd7b53-0x17d;const _0x3ad35b=a26_0x3ad3();let _0x387abd=_0x3ad35b[_0xd7b53];return _0x387abd;}export class JobKillCommand extends BaseCommand{['name']='job:kill';[a26_0x3d3515(0x1d0)]=a26_0x3d3515(0x194);[a26_0x3d3515(0x1ca)](_0x467346){const _0x4eb3e0=a26_0x3d3515,_0x2ed477=_0x467346['args'][0x0];if(!_0x2ed477)return _0x4eb3e0(0x1bf);return undefined;}async[a26_0x3d3515(0x1c5)](_0x48e06e){const _0x4c8cc4=a26_0x3d3515,{options:_0x219222,args:_0x188b19,tdx:_0x50a884}=_0x48e06e,_0x5b2bfc=_0x188b19[0x0];if(!_0x219222[_0x4c8cc4(0x1a1)]){const _0x4cda4f=await confirm(_0x4c8cc4(0x1a2)+_0x5b2bfc+'?');if(!_0x4cda4f)return console[_0x4c8cc4(0x197)]('Cancelled'),0x0;}return await withSpinner(_0x4c8cc4(0x1d4),()=>_0x50a884[_0x4c8cc4(0x1d3)][_0x4c8cc4(0x181)](_0x5b2bfc),{'verbose':_0x219222[_0x4c8cc4(0x1ce)]}),console['error'](_0x4c8cc4(0x1a3)+_0x5b2bfc),console[_0x4c8cc4(0x197)](_0x4c8cc4(0x18c)+_0x5b2bfc+_0x4c8cc4(0x18e)),0x0;}}function a26_0x3ad3(){const _0x1b39df=['name','map','List\x20jobs','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20show\x20<job-id>','red','green','Getting\x20job\x20details...','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20kill\x20<job-id>','Get\x20job\x20results','hive','✔\x20Job\x20submitted','job_id','Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','execute','4YTIFTu','limit','Submit\x20a\x20job','33337139lJUpyb','validate','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20result\x20<job-id>','...','substring','verbose','status','description','submit','10276992kEiXoR','jobs','Submitting\x20kill\x20request...','start_at','job:result','Job\x20type:\x20','10iWHrLJ','site','log','kill','data','trino','floor','Query:\x20','No\x20SQL\x20statements\x20found\x20in\x20file','INVALID_ARGUMENT','getTime','Submitting\x20job...','Show\x20job\x20details','4206176mekzBV','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','args','\x27\x20to\x20verify\x20the\x20job\x20status','length','mo\x20ago','database','query','\x20\x20Job\x20ID:\x20','Kill\x20a\x20job','now','d\x20ago','error','6554050djZhYZ','2049378SqgedT','h\x20ago','presto','push','1125034MCBRti','url','Status\x20filter:\x20','type','yes','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','priority','✔\x20Retrieved\x20','516kreOBK','list','16401LNJMtI','Database:\x20','--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','join','round','job:show','end_at','result','\x20row','just\x20now','debug','created_at','dim','Query\x20is\x20required\x0aUsage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','success','2mNvkXu'];a26_0x3ad3=function(){return _0x1b39df;};return a26_0x3ad3();}export class JobSubmitCommand extends BaseCommand{[a26_0x3d3515(0x1b8)]='job:submit';['description']=a26_0x3d3515(0x1c8);async[a26_0x3d3515(0x1c5)](_0x3c12b2){const _0xe32a42=a26_0x3d3515,{options:_0x4a1269,args:_0xc66b47,tdx:_0xa6534f}=_0x3c12b2,_0x4926f5=_0x4a1269['jobType']||_0xe32a42(0x183),_0x37960b=_0x4a1269['file'],_0x5b7c6f=_0x4a1269[_0xe32a42(0x191)]||'information_schema',_0x55a7be=_0x4a1269[_0xe32a42(0x1af)];if(_0x4926f5!=='trino'&&_0x4926f5!==_0xe32a42(0x1c1))throw new SDKError(ErrorCode[_0xe32a42(0x187)],_0xe32a42(0x1aa));let _0x44eca0;if(_0x37960b){if(_0xc66b47[0x0])throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option');const _0x5e7957=readSqlStatementsFromFile(_0x37960b);if(_0x5e7957[_0xe32a42(0x18f)]===0x0)throw new SDKError(ErrorCode[_0xe32a42(0x187)],_0xe32a42(0x186));if(_0x5e7957[_0xe32a42(0x18f)]>0x1)throw new SDKError(ErrorCode[_0xe32a42(0x187)],_0xe32a42(0x1c4));_0x44eca0=_0x5e7957[0x0];}else{if(!_0xc66b47[0x0])throw new SDKError(ErrorCode[_0xe32a42(0x187)],_0xe32a42(0x1b5));_0x44eca0=_0xc66b47[0x0];}_0x4a1269[_0xe32a42(0x1ce)]&&(console[_0xe32a42(0x197)](_0xe32a42(0x17d)+_0x4926f5),console['error'](_0xe32a42(0x1a9)+_0x5b7c6f),console[_0xe32a42(0x197)](_0xe32a42(0x185)+_0x44eca0[_0xe32a42(0x1cd)](0x0,0x64)+(_0x44eca0[_0xe32a42(0x18f)]>0x64?_0xe32a42(0x1cc):'')));const _0xcf72e3=await withSpinner(_0xe32a42(0x189),()=>_0xa6534f[_0xe32a42(0x1d3)][_0xe32a42(0x1d1)](_0x5b7c6f,_0x44eca0,_0x4926f5,_0x55a7be),{'verbose':_0x4a1269[_0xe32a42(0x1ce)]}),_0x46f84d=_0xcf72e3[_0xe32a42(0x182)];return console[_0xe32a42(0x197)](_0xe32a42(0x1c2)),console['error'](_0xe32a42(0x193)+_0x46f84d['job_id']),await handleSDKOutput([_0x46f84d],_0x4a1269),0x0;}}export class JobResultCommand extends BaseCommand{[a26_0x3d3515(0x1b8)]=a26_0x3d3515(0x1d6);[a26_0x3d3515(0x1d0)]=a26_0x3d3515(0x1c0);[a26_0x3d3515(0x1ca)](_0x5b778d){const _0x5631c7=a26_0x3d3515,_0x3acf8a=_0x5b778d[_0x5631c7(0x18d)][0x0];if(!_0x3acf8a)return _0x5631c7(0x1cb);return undefined;}async[a26_0x3d3515(0x1c5)](_0x9de80){const _0x5be423=a26_0x3d3515,{options:_0x21c0d3,args:_0x2c59fc,tdx:_0x2f11fd}=_0x9de80,_0x2338f4=_0x2c59fc[0x0],_0x5c221b=await withSpinner('Getting\x20job\x20results...',()=>_0x2f11fd[_0x5be423(0x1d3)][_0x5be423(0x1af)](_0x2338f4),{'verbose':_0x21c0d3[_0x5be423(0x1ce)]}),_0x218eaa=_0x5c221b[_0x5be423(0x182)];return console['error'](_0x5be423(0x1a5)+_0x218eaa[_0x5be423(0x18f)]+_0x5be423(0x1b0)+(_0x218eaa[_0x5be423(0x18f)]!==0x1?'s':'')),await handleSDKOutput(_0x218eaa,_0x21c0d3),0x0;}}
@@ -1 +1 @@
1
- const a27_0x3d26ae=a27_0x2150;(function(_0xacad7c,_0x36d645){const _0x431c28=a27_0x2150,_0xd7a9fb=_0xacad7c();while(!![]){try{const _0x37b6c3=parseInt(_0x431c28(0x13d))/0x1*(-parseInt(_0x431c28(0x1af))/0x2)+parseInt(_0x431c28(0x1a5))/0x3+parseInt(_0x431c28(0x17e))/0x4*(-parseInt(_0x431c28(0x154))/0x5)+-parseInt(_0x431c28(0x18f))/0x6*(-parseInt(_0x431c28(0x1d4))/0x7)+parseInt(_0x431c28(0x144))/0x8+-parseInt(_0x431c28(0x164))/0x9*(-parseInt(_0x431c28(0x153))/0xa)+parseInt(_0x431c28(0x17b))/0xb;if(_0x37b6c3===_0x36d645)break;else _0xd7a9fb['push'](_0xd7a9fb['shift']());}catch(_0x6e1afe){_0xd7a9fb['push'](_0xd7a9fb['shift']());}}}(a27_0x117b,0xcc54d));import a27_0x36bf62 from'chalk';import a27_0x745048 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';function a27_0x2150(_0x1fdd06,_0x3e5995){_0x1fdd06=_0x1fdd06-0xfb;const _0x117b3b=a27_0x117b();let _0x215037=_0x117b3b[_0x1fdd06];return _0x215037;}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(_0x1d031b){const _0x18c68=a27_0x2150;return!_0x1d031b&&(console[_0x18c68(0x14b)](_0x18c68(0x19e)),console['error']('Usage:\x20journey\x20<subcommand>\x20<name-or-path>')),!!_0x1d031b;}function withJsonFormat(_0x2da335){const _0x31e27f=a27_0x2150;if(!_0x2da335[_0x31e27f(0x143)]&&!_0x2da335[_0x31e27f(0x1b7)]&&!_0x2da335[_0x31e27f(0x148)]&&!_0x2da335[_0x31e27f(0x108)])return{..._0x2da335,'format':_0x31e27f(0x1b7),'json':!![]};return _0x2da335;}function formatJourneyState(_0x42b868){const _0x538b2f=a27_0x2150;switch(_0x42b868){case _0x538b2f(0x188):return a27_0x36bf62[_0x538b2f(0x1f5)]('(running)');case _0x538b2f(0x171):return a27_0x36bf62[_0x538b2f(0x10c)](_0x538b2f(0x1bc));case'paused':return a27_0x36bf62[_0x538b2f(0x18c)](_0x538b2f(0x109));case _0x538b2f(0x13b):return a27_0x36bf62['blue'](_0x538b2f(0x1a0));case _0x538b2f(0x166):return a27_0x36bf62[_0x538b2f(0x10c)]('(archived)');default:return'('+_0x42b868+')';}}function formatJourneyItem(_0xd8f4de,_0x1124ee='',_0x1e62af){const _0x569873=a27_0x2150,_0x181566=formatJourneyState(_0xd8f4de[_0x569873(0x1f0)]),_0x306138=_0x1e62af?hyperlink(_0xd8f4de[_0x569873(0x17d)],_0x1e62af):_0xd8f4de[_0x569873(0x17d)];return _0x1124ee+_0x569873(0x111)+_0x306138+'\x20'+_0x181566;}function escapeRegex(_0x2d9e46){const _0x3ff062=a27_0x2150;return _0x2d9e46['replace'](/[.*+?^${}()|[\]\\]/g,_0x3ff062(0x14c));}function globToRegex(_0x50b613){const _0x22e416=a27_0x2150,_0x569685=_0x50b613['split']('*')[_0x22e416(0x150)](escapeRegex);return new RegExp(_0x569685[_0x22e416(0x134)]('.*'),'i');}function buildRuleToNameMapping(_0x151a9a){const _0x143c0d=a27_0x2150,_0x4d3efd=new Map();if(_0x151a9a[_0x143c0d(0x1c9)])for(const [_0x23b083,_0x32908a]of Object['entries'](_0x151a9a[_0x143c0d(0x1c9)])){if(_0x32908a['rule']){const _0x86e96=serializeRule(_0x32908a['rule']),_0x12f6ad=_0x4d3efd[_0x143c0d(0x173)](_0x86e96);_0x12f6ad?_0x12f6ad['push'](_0x23b083):_0x4d3efd['set'](_0x86e96,[_0x23b083]);}}return _0x4d3efd;}async function resolveJourneyIdFromInput(_0x11dee6,_0x477e70,_0x119ce0){const _0x38e224=a27_0x2150,_0x256615=await resolveJourneyTarget(_0x11dee6,_0x477e70[_0x38e224(0x1ec)],_0x477e70[_0x38e224(0x1e3)]),_0x4f39a2=_0x256615[_0x38e224(0x1ec)];if(!_0x4f39a2)throw new SDKError(ErrorCode[_0x38e224(0x1db)],_0x38e224(0x162));const _0x1cff55=await withSpinner(_0x38e224(0x1e2),()=>_0x119ce0[_0x38e224(0x1aa)][_0x38e224(0x13a)](_0x4f39a2),{'verbose':_0x477e70[_0x38e224(0x1e3)]}),_0x5ac3ca=_0x1cff55['data'],_0x57dd5b=await withSpinner(_0x38e224(0x1c3),()=>_0x119ce0[_0x38e224(0x15c)][_0x38e224(0x106)](_0x5ac3ca,_0x256615[_0x38e224(0x189)]),{'verbose':_0x477e70[_0x38e224(0x1e3)]});return{'journeyId':_0x57dd5b['data'],'journeyName':_0x256615[_0x38e224(0x189)],'parentSegmentId':_0x5ac3ca};}async function resolveJourneyTarget(_0x17f8fb,_0x1a432d,_0x3c6bd9){const _0x505ba2=a27_0x2150;if(isYamlFilePath(_0x17f8fb))try{const _0x455614=await resolveYamlFilePath(_0x17f8fb);return _0x3c6bd9&&(console[_0x505ba2(0x14b)](_0x505ba2(0x1fc)+_0x17f8fb),console[_0x505ba2(0x14b)](_0x505ba2(0x198)+_0x455614[_0x505ba2(0x1ec)]),console[_0x505ba2(0x14b)](_0x505ba2(0x176)+_0x455614[_0x505ba2(0x205)]),console['error']('\x20\x20Folder\x20path:\x20'+(_0x455614[_0x505ba2(0x104)]||_0x505ba2(0x137)))),{'journeyName':_0x455614[_0x505ba2(0x205)],'parentSegment':_0x455614['parentSegment'],'resolved':_0x455614};}catch(_0x4d220d){throw new SDKError(ErrorCode[_0x505ba2(0x1db)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x4d220d[_0x505ba2(0x1a6)]);}if(!_0x1a432d)throw new SDKError(ErrorCode[_0x505ba2(0x1db)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return{'journeyName':_0x17f8fb,'parentSegment':_0x1a432d};}function a27_0x117b(){const _0x534858=['96022xMFrXa','journey:traffic','Getting\x20column\x20mapping...','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','Cancelled','\x20\x20Preserving\x20local\x20segment\x20name:\x20','format','6590976RzjGSM','stageNameMap','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','args','jsonl','Database:\x20','relative','error','\x5c$&','Show\x20journey\x20table\x20column\x20mapping','Error:\x20Journey\x20\x27','file','map','stringify','then','10ALVIwU','220lRxOel','no_parent','resolveSegment','yes','session','values','utf-8','Parent\x20segment:\x20','journey','Warning:\x20Could\x20not\x20resolve\x20segment\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','journeyStages','kind','Resuming\x20journey...','Could\x20not\x20resolve\x20parent\x20segment.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','find','4778523afuWIe','\x22.\x20Must\x20be\x20\x22conversion\x22\x20or\x20\x22activation\x22.','archived','createdAt','Error:\x20','hasChanges','journey:version:create','getJourney','buildIdToEmailMap','✔\x20Journey\x20\x22','\x0aError:','cwd','\x20(ID:\x20','draft','/app/ps/','get','version','set','\x20\x20Name:\x20','Usage:\x20journey\x20version\x20view\x20<name-or-path>\x20--version\x20N','listJourneysFromParentSegment','folderId','\x20Opening\x20','7212667DSZldB','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)','journeyBundleName','93344frLlDp','✔\x20Found\x20','Error:\x20Version\x20','Input:\x20','Creating\x20new\x20version...','Found\x20','base','buildIdToNameMap','localeCompare','description','launched','journeyName','No\x20journeys\x20found','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','yellow','Error:\x20Stage\x20\x22','pause','1734168hRiFSW','web','size','/j/da/je','activation','journey:version:view','\x27\x20not\x20found\x20in\x20','getTrafficData','Pattern:\x20','\x20\x20Parent\x20segment:\x20','Fetching\x20journeys\x20and\x20folders...','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','resume','Available\x20stages:\x20','journey:pause','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','Write\x20','(completed)','\x22\x20resumed','conversion','targetDir','completionRate','2149335kPIqKz','message','journey:columns','limit','rule','segment','reentryMode','site','journey:push','listActivationsFlat','24TxuEnS','includeHistory','resourceName','✔\x20Pulled\x20','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','database','\x20=\x20','content','json','Traffic\x20data\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','options','paused','Show\x20journey\x20details','(draft)','all','\x20version','/e/','\x20versions)','journey:activations','\x20Created\x20v','Resolving\x20journey...','journeyId','push','attributes','cyan','tdx.json','segments','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','\x20not\x20found.\x20Available:\x20','rootFolderId','has','Show\x20journey\x20statistics','enteredSize','sort','helpText','Folder\x20path:\x20','Getting\x20journey\x20details...','7sToDMa','Warning:\x20--include-history\x20without\x20--from/--to\x20may\x20return\x20all-time\x20history','listJourneysWithFolders','segmentPushCommand','List\x20journeys\x20in\x20current\x20context','repeat','versionNumber','INVALID_ARGUMENT','No\x20traffic\x20data\x20available\x20for\x20journey:\x20','red','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','relativePath','journey:versions','from','Resolving\x20parent\x20segment...','verbose','folders','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','goalSize','entries','\x20details...','\x20journeys','\x0aChanges\x20to\x20\x27','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','parentSegment','List\x20activations\x20for\x20a\x20journey','renderStats','Fetching\x20','state','updatedAt','If\x20the\x20journey\x20is\x20active,\x20the\x20date\x20range\x20may\x20be\x20too\x20wide.\x20Try\x20a\x20shorter\x20period\x20(max\x20~90\x20days).','getActivation',',\x20version:\x20','green','bold','Warning:\x20Could\x20not\x20resolve\x20activation\x20','Listing\x20journey\x20activations...','journey:view','/j/da','stages','Resolved\x20YAML\x20file:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','createVersion','listFolders','Error:\x20Invalid\x20version\x20number:\x20','goal','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','Target\x20directory:\x20','journeyBundleId','segmentName','Options:','Getting\x20journey\x20traffic\x20data...','\x20\x20Consolidating\x20duplicate\x20segment:\x20','name','columns','links','milestoneSize','Error:\x20Invalid\x20--type\x20\x22','getSegment','type','execute','history','folderPath','-\x20no\x20files\x20written','resolveJourneyId','\x20\x20Target:\x20','tsv','(paused)','absolutePath','\x20activation','dim','exitOrJumpRate','dryRun','isNew','Getting\x20journey\x20statistics...','🗺️\x20','parent_segment','getLatestJourneyId','Resume\x20a\x20paused\x20journey','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Pause\x20a\x20running\x20journey','toLowerCase','Error:\x20Journey\x20not\x20found:\x20','data','filter','journey:resume','connection','\x20(draft)\x20—\x20\x22','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Target\x20file:\x20','Get\x20journey\x20traffic\x20data\x20(Sankey\x20charts)','\x20(rule\x20match)','Fetching\x20parent\x20segment...','✔\x20Context\x20set:\x20','user','includeStats','connector_config','table','add','root\x20folder','length','test','listVersions','No\x20statistics\x20available\x20for\x20journey:\x20','.yml','\x20\x20-\x20','log','journeys','Create\x20a\x20new\x20draft\x20version\x20of\x20a\x20journey','View\x20a\x20specific\x20version\x20of\x20a\x20journey','join','\x22\x20not\x20found','Journey\x20name:\x20','(root)','getColumnMapping','getStatistics','resolveParentId','completed','hasPeriod'];a27_0x117b=function(){return _0x534858;};return a27_0x117b();}export class JourneyListCommand extends BaseCommand{[a27_0x3d26ae(0xfb)]='journey:list';[a27_0x3d26ae(0x187)]=a27_0x3d26ae(0x1d8);async['execute'](_0x54a925){const _0xb4119c=a27_0x3d26ae,{options:_0x5d8dfa,args:_0xaf4adb,tdx:_0x2c3e23}=_0x54a925,_0x3d2ae7=_0xaf4adb[0x0],_0x5beb08=_0x5d8dfa[_0xb4119c(0x1ec)];if(!_0x5beb08)return console[_0xb4119c(0x14b)]('Error:\x20Parent\x20segment\x20context\x20required'),console['error']('Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22'),0x1;const _0x3a4fd3=await withSpinner(_0xb4119c(0x1e2),()=>_0x2c3e23[_0xb4119c(0x1aa)][_0xb4119c(0x13a)](_0x5beb08),{'verbose':_0x5d8dfa[_0xb4119c(0x1e3)]}),_0x48376c=_0x3a4fd3[_0xb4119c(0x119)];_0x5d8dfa[_0xb4119c(0x1e3)]&&(console[_0xb4119c(0x14b)](_0xb4119c(0x15b)+_0x5beb08+_0xb4119c(0x170)+_0x48376c+')'),_0x3d2ae7&&console[_0xb4119c(0x14b)](_0xb4119c(0x197)+_0x3d2ae7));const _0x816aa0=await withSpinner(_0xb4119c(0x122),()=>_0x2c3e23[_0xb4119c(0x1aa)]['getParentFull'](_0x48376c),{'verbose':_0x5d8dfa['verbose']}),_0x121518=_0x816aa0[_0xb4119c(0x119)],_0x5a80a5=_0x121518[_0xb4119c(0x1cc)],_0x4adcf4=await withSpinner('Listing\x20journeys...',()=>_0x2c3e23[_0xb4119c(0x15c)][_0xb4119c(0x1d6)](_0x48376c,_0x5a80a5),{'verbose':_0x5d8dfa[_0xb4119c(0x1e3)]});let _0x3c745e=_0x4adcf4[_0xb4119c(0x119)][_0xb4119c(0x131)];const _0x16882b=_0x4adcf4['data'][_0xb4119c(0x1e4)],_0x50808b=new Map();for(const _0x278723 of _0x16882b){_0x50808b[_0xb4119c(0x175)](_0x278723['id'],_0x278723[_0xb4119c(0xfb)]);}if(_0x3d2ae7){const _0x59dd67=globToRegex(_0x3d2ae7);_0x3c745e=_0x3c745e[_0xb4119c(0x11a)](_0x543638=>_0x59dd67[_0xb4119c(0x12b)](_0x543638['journeyBundleName']));}console['error'](_0xb4119c(0x17f)+_0x3c745e['length']+'\x20journey'+(_0x3c745e['length']!==0x1?'s':''));const _0x2f9d08=_0x1182f1=>{const _0x4ea209=_0xb4119c;return getConsoleNextUrl(_0x5d8dfa['site'],'/app/ps/'+_0x48376c+_0x4ea209(0x1bf)+_0x1182f1+_0x4ea209(0x1fa));};if(_0x5d8dfa['format']===_0xb4119c(0x127))await handleSDKOutput(_0x3c745e,_0x5d8dfa);else{if(_0x5d8dfa[_0xb4119c(0x143)]===_0xb4119c(0x1b7)){const _0x3dc36c=_0x3c745e['map'](_0x409eff=>({..._0x409eff,'url':_0x2f9d08(_0x409eff['id'])}));await handleSDKOutput(_0x3dc36c,_0x5d8dfa);}else{console[_0xb4119c(0x130)]('['+_0x5beb08+']');const _0x4e8cc6=new Map(),_0x41598b=[];for(const _0x4a4b99 of _0x3c745e){if(!_0x4a4b99['folderId']||_0x4a4b99['folderId']===_0x5a80a5)_0x41598b[_0xb4119c(0x1c5)](_0x4a4b99);else{const _0x324cda=_0x4e8cc6['get'](_0x4a4b99['folderId'])||[];_0x324cda[_0xb4119c(0x1c5)](_0x4a4b99),_0x4e8cc6[_0xb4119c(0x175)](_0x4a4b99['folderId'],_0x324cda);}}const _0x31d707=(_0x5edf5e,_0x6aafb8)=>_0x5edf5e['journeyBundleName']['localeCompare'](_0x6aafb8[_0xb4119c(0x17d)],undefined,{'sensitivity':_0xb4119c(0x184)});_0x41598b[_0xb4119c(0x1d0)](_0x31d707);for(const _0x42159a of _0x41598b){console[_0xb4119c(0x130)](formatJourneyItem(_0x42159a,'',_0x2f9d08(_0x42159a['id'])));}const _0x223a05=[..._0x4e8cc6[_0xb4119c(0x1e7)]()][_0xb4119c(0x1d0)]((_0x9458f7,_0x1c2bf0)=>{const _0x198f93=_0xb4119c,_0x35f641=_0x50808b['get'](_0x9458f7[0x0])||_0x9458f7[0x0],_0x44378e=_0x50808b[_0x198f93(0x173)](_0x1c2bf0[0x0])||_0x1c2bf0[0x0];return _0x35f641[_0x198f93(0x186)](_0x44378e,undefined,{'sensitivity':_0x198f93(0x184)});});for(const [_0x35f46a,_0x1e87f5]of _0x223a05){const _0x53614f=_0x50808b[_0xb4119c(0x173)](_0x35f46a)||_0x35f46a;console[_0xb4119c(0x130)]('📁\x20'+_0x53614f),_0x1e87f5[_0xb4119c(0x1d0)](_0x31d707);for(const _0x3b3a02 of _0x1e87f5){console['log'](formatJourneyItem(_0x3b3a02,'\x20\x20',_0x2f9d08(_0x3b3a02['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a27_0x3d26ae(0xfb)]=a27_0x3d26ae(0x1f9);['description']=a27_0x3d26ae(0x1bb);async[a27_0x3d26ae(0x102)](_0x30b336){const _0x6350a2=a27_0x3d26ae,{options:_0x129434,args:_0x26658b,tdx:_0x73e9cb}=_0x30b336,_0x6b77c8=_0x26658b[0x0];if(!_0x6b77c8)return console[_0x6350a2(0x14b)](_0x6350a2(0x19e)),console['error'](_0x6350a2(0x146)),console[_0x6350a2(0x14b)](_0x6350a2(0x206)),console[_0x6350a2(0x14b)](_0x6350a2(0x1eb)),0x1;_0x129434[_0x6350a2(0x1e3)]&&console[_0x6350a2(0x14b)](_0x6350a2(0x181)+_0x6b77c8);const {journeyId:_0x55c476,parentSegmentId:_0xac8857}=await resolveJourneyIdFromInput(_0x6b77c8,_0x129434,_0x73e9cb);if(_0x129434[_0x6350a2(0x190)]){const _0x1906e7=getConsoleNextUrl(_0x129434['site'],_0x6350a2(0x172)+_0xac8857+_0x6350a2(0x1bf)+_0x55c476+'/j/da/je');return console[_0x6350a2(0x14b)](a27_0x36bf62['green']('✔')+_0x6350a2(0x17a)+a27_0x36bf62[_0x6350a2(0x1c7)](_0x1906e7)),openBrowser(_0x1906e7),0x0;}const _0x3fd26d=await withSpinner(_0x6350a2(0x1d3),()=>_0x73e9cb[_0x6350a2(0x15c)][_0x6350a2(0x16b)](_0x55c476),{'verbose':_0x129434['verbose']}),_0x19ec39=_0x3fd26d[_0x6350a2(0x119)],_0x75071=_0x129434[_0x6350a2(0x125)];let _0x209027;if(_0x75071)try{const _0x5b0449=await withSpinner(_0x6350a2(0x110),()=>_0x73e9cb['journey']['getStatistics'](_0x55c476),{'verbose':_0x129434[_0x6350a2(0x1e3)]});_0x209027=_0x5b0449[_0x6350a2(0x119)];}catch{_0x129434['verbose']&&console[_0x6350a2(0x14b)]('\x20\x20Statistics\x20not\x20available');}const _0x15620b=getConsoleNextUrl(_0x129434[_0x6350a2(0x1ac)],_0x6350a2(0x172)+_0xac8857+_0x6350a2(0x1bf)+_0x55c476+_0x6350a2(0x192)),_0x503585={'id':_0x19ec39['id'],'name':_0x19ec39[_0x6350a2(0x1c6)][_0x6350a2(0xfb)],'description':_0x19ec39[_0x6350a2(0x1c6)][_0x6350a2(0x187)],'state':_0x19ec39['attributes'][_0x6350a2(0x1f0)],'paused':_0x19ec39[_0x6350a2(0x1c6)][_0x6350a2(0x1ba)],'reentry_mode':_0x19ec39['attributes'][_0x6350a2(0x1ab)],'stages':_0x19ec39[_0x6350a2(0x1c6)][_0x6350a2(0x15f)]?.[_0x6350a2(0x12a)]||0x0,..._0x19ec39[_0x6350a2(0x1c6)][_0x6350a2(0x201)]&&{'goal':_0x19ec39['attributes'][_0x6350a2(0x201)]['name']},..._0x209027&&{'statistics':{'size':_0x209027[_0x6350a2(0x191)],'entered':_0x209027[_0x6350a2(0x1cf)],'goal_achieved':_0x209027[_0x6350a2(0x1e6)],'completion_rate':_0x209027[_0x6350a2(0x1a4)],'exit_or_jump':_0x209027['exitOrJumpSize'],'exit_or_jump_rate':_0x209027[_0x6350a2(0x10d)],'stages':_0x209027['stages']}},'url':_0x15620b};return await handleSingleObjectOutput(_0x503585,_0x129434),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a27_0x3d26ae(0xfb)]='journey:stats';['description']=a27_0x3d26ae(0x1ce);async[a27_0x3d26ae(0x102)](_0x31a7f9){const _0x16ed56=a27_0x3d26ae,{options:_0x1fd87b,args:_0x28bc6b,tdx:_0x2d9afe}=_0x31a7f9,_0x2ec8c1=_0x28bc6b[0x0];if(!requireNameOrPath(_0x2ec8c1))return 0x1;_0x1fd87b[_0x16ed56(0x1e3)]&&console['error'](_0x16ed56(0x181)+_0x2ec8c1);const _0x43187e=_0x1fd87b,_0x3d6120=_0x43187e[_0x16ed56(0x1e1)],_0x5d5f7d=_0x43187e['to'],_0x46c04e=_0x43187e[_0x16ed56(0x1b0)],_0x4debfb=_0x43187e['stage'];_0x46c04e&&!_0x3d6120&&!_0x5d5f7d&&console[_0x16ed56(0x14b)](_0x16ed56(0x1d5));const _0x326bd3=_0x46c04e?withJsonFormat(_0x1fd87b):_0x1fd87b,{journeyId:_0x2a1007,journeyName:_0x3263e1}=await resolveJourneyIdFromInput(_0x2ec8c1,_0x326bd3,_0x2d9afe),_0x47a473=_0x3d6120||_0x5d5f7d?{'from':_0x3d6120,'to':_0x5d5f7d}:undefined,_0x5df003=await withSpinner(_0x16ed56(0x110),()=>Promise[_0x16ed56(0x1bd)]([_0x2d9afe[_0x16ed56(0x15c)][_0x16ed56(0x16b)](_0x2a1007),_0x2d9afe['journey'][_0x16ed56(0x139)](_0x2a1007,_0x47a473)]),{'verbose':_0x326bd3['verbose']}),[_0x49ac73,_0x20d9a1]=_0x5df003[_0x16ed56(0x119)];if(!_0x20d9a1||_0x20d9a1[_0x16ed56(0x1c4)]===null)return console[_0x16ed56(0x14b)](_0x16ed56(0x12d)+_0x3263e1),console[_0x16ed56(0x14b)](_0x16ed56(0x140)),0x0;const _0x4bf2f9=buildStageNameMap(_0x49ac73),_0x3a4f94=!!(_0x47a473&&_0x20d9a1['history']?.[_0x16ed56(0x12a)]),_0x461d80={'stageNameMap':_0x4bf2f9,'hasPeriod':_0x3a4f94,'includeHistory':!!_0x46c04e};if(_0x4debfb&&_0x20d9a1['stages']){const _0x1e65d2=_0x20d9a1['stages'][_0x16ed56(0x163)](_0x41f8cd=>{const _0x2d67fc=_0x16ed56,_0x11239d=_0x4bf2f9['get'](_0x41f8cd['id'])??'';return _0x11239d[_0x2d67fc(0x117)]()===_0x4debfb[_0x2d67fc(0x117)]();});if(_0x1e65d2)return await handleSingleObjectOutput(formatStageStats(_0x1e65d2,_0x461d80),_0x326bd3),0x0;const _0x2aa95d=_0x20d9a1[_0x16ed56(0x1fb)][_0x16ed56(0x150)](_0x3033d7=>_0x4bf2f9['get'](_0x3033d7['id'])??_0x3033d7['id']);return console[_0x16ed56(0x14b)](_0x16ed56(0x18d)+_0x4debfb+_0x16ed56(0x135)),console[_0x16ed56(0x14b)](_0x16ed56(0x19c)+_0x2aa95d[_0x16ed56(0x134)](',\x20')),0x1;}const _0x53b581=_0x20d9a1[_0x16ed56(0x1fb)]?.[_0x16ed56(0x150)](_0x170ea2=>formatStageStats(_0x170ea2,_0x461d80)),_0x46fa3a=assembleJourneyStats(_0x20d9a1,{'from':_0x3d6120,'to':_0x5d5f7d,'includeHistory':_0x46c04e});return await this[_0x16ed56(0x1ee)](_0x46fa3a,_0x53b581??[],_0x326bd3),0x0;}async[a27_0x3d26ae(0x1ee)](_0x532c58,_0x5168e1,_0x5c5f81){const _0x2de5b2=a27_0x3d26ae,_0x15abb6=_0x5c5f81[_0x2de5b2(0x143)]===_0x2de5b2(0x1b7)||_0x5c5f81[_0x2de5b2(0x143)]===_0x2de5b2(0x148)||_0x5c5f81[_0x2de5b2(0x1b7)]||_0x5c5f81[_0x2de5b2(0x148)];if(_0x15abb6){_0x532c58[_0x2de5b2(0x1fb)]=_0x5168e1,await handleSingleObjectOutput(_0x532c58,_0x5c5f81);return;}await handleSingleObjectOutput(_0x532c58,_0x5c5f81);for(const _0x53f0de of _0x5168e1){console['log'](''),console[_0x2de5b2(0x130)](String(a27_0x36bf62[_0x2de5b2(0x1c7)][_0x2de5b2(0x1f6)]('['+_0x53f0de['name']+']'))+a27_0x36bf62[_0x2de5b2(0x10c)]('\x20'+_0x53f0de['id']));const {id:_0x281ea9,name:_0x276b94,..._0x49d5df}=_0x53f0de;await handleSingleObjectOutput(_0x49d5df,_0x5c5f81);}}}export class JourneyTrafficCommand extends BaseCommand{[a27_0x3d26ae(0xfb)]=a27_0x3d26ae(0x13e);['description']=a27_0x3d26ae(0x120);async['execute'](_0x34ec9f){const _0x10a549=a27_0x3d26ae,{options:_0xfe6344,args:_0x40abf7,tdx:_0x310f69}=_0x34ec9f,_0x2b3110=_0x40abf7[0x0];if(!requireNameOrPath(_0x2b3110))return 0x1;_0xfe6344['verbose']&&console[_0x10a549(0x14b)](_0x10a549(0x181)+_0x2b3110);const _0x49dc6f=_0xfe6344,_0x320e65=_0x49dc6f['type'],_0x315ef6=_0x49dc6f[_0x10a549(0x1e1)],_0x26d548=_0x49dc6f['to'],_0x55d7ce=_0x49dc6f[_0x10a549(0x1a8)];if(_0x320e65&&_0x320e65!==_0x10a549(0x1a2)&&_0x320e65!==_0x10a549(0x193))return console[_0x10a549(0x14b)](_0x10a549(0xff)+_0x320e65+_0x10a549(0x165)),0x1;const _0x4e5f22=withJsonFormat(_0xfe6344),{journeyId:_0x45676d,journeyName:_0x147b5f}=await resolveJourneyIdFromInput(_0x2b3110,_0x4e5f22,_0x310f69),_0x9f702d={'type':_0x320e65,'from':_0x315ef6,'to':_0x26d548,'limit':_0x55d7ce},_0x32c187=await withSpinner(_0x10a549(0x207),()=>_0x310f69[_0x10a549(0x15c)][_0x10a549(0x196)](_0x45676d,_0x9f702d),{'verbose':_0x4e5f22['verbose']}),_0x5316f2=_0x32c187[_0x10a549(0x119)],_0x542e56=_0x5316f2[_0x10a549(0x1a2)]&&(_0x5316f2[_0x10a549(0x1a2)]['nodes'][_0x10a549(0x12a)]>0x0||_0x5316f2[_0x10a549(0x1a2)][_0x10a549(0xfd)][_0x10a549(0x12a)]>0x0),_0x4183e5=_0x5316f2[_0x10a549(0x193)]&&_0x5316f2[_0x10a549(0x193)][_0x10a549(0x12a)]>0x0;if(!_0x542e56&&!_0x4183e5)return console[_0x10a549(0x14b)](_0x10a549(0x1dc)+_0x147b5f),console[_0x10a549(0x14b)](_0x10a549(0x1b8)),_0x315ef6&&_0x26d548&&console[_0x10a549(0x14b)](_0x10a549(0x1f2)),0x0;return await handleSingleObjectOutput(_0x5316f2,_0x4e5f22),0x0;}}function formatStageStats(_0x5df9f2,_0x1adda5){const _0x19e205=a27_0x3d26ae,_0x5db753=_0x1adda5[_0x19e205(0x13c)]&&_0x5df9f2[_0x19e205(0x103)]?.[_0x19e205(0x12a)]?aggregateStageHistory(_0x5df9f2['history']):{'size':_0x5df9f2['size'],'entered':_0x5df9f2[_0x19e205(0x1cf)],'milestone':_0x5df9f2[_0x19e205(0xfe)],'milestone_rate':_0x5df9f2['completeMilestoneRate'],'exit_or_jump':_0x5df9f2['exitOrJumpSize'],'exit_or_jump_rate':_0x5df9f2[_0x19e205(0x10d)]},_0x33f5e0={'id':_0x5df9f2['id'],'name':_0x1adda5[_0x19e205(0x145)][_0x19e205(0x173)](_0x5df9f2['id'])??_0x5df9f2['id'],..._0x5db753};return _0x1adda5['hasPeriod']&&_0x1adda5[_0x19e205(0x1b0)]&&_0x5df9f2[_0x19e205(0x103)]&&(_0x33f5e0[_0x19e205(0x103)]=_0x5df9f2['history']),_0x33f5e0;}export class JourneyPauseCommand extends BaseCommand{[a27_0x3d26ae(0xfb)]=a27_0x3d26ae(0x19d);[a27_0x3d26ae(0x187)]=a27_0x3d26ae(0x116);async[a27_0x3d26ae(0x102)](_0xecf025){const _0x75872b=a27_0x3d26ae,{options:_0x1f8202,args:_0x53d939,tdx:_0x241383}=_0xecf025,_0x438777=_0x53d939[0x0];if(!requireNameOrPath(_0x438777))return 0x1;_0x1f8202['verbose']&&console[_0x75872b(0x14b)]('Input:\x20'+_0x438777);const {journeyId:_0xd2e6fc,journeyName:_0x2cce55}=await resolveJourneyIdFromInput(_0x438777,_0x1f8202,_0x241383);if(!_0x1f8202[_0x75872b(0x157)]){const _0x22793d=await confirm(_0x75872b(0x1fd)+_0x2cce55+'\x22?');if(!_0x22793d)return console[_0x75872b(0x14b)](_0x75872b(0x141)),0x0;}const _0x172fa6=await withSpinner('Pausing\x20journey...',()=>_0x241383[_0x75872b(0x15c)][_0x75872b(0x18e)](_0xd2e6fc),{'verbose':_0x1f8202['verbose']}),_0x197667=_0x172fa6[_0x75872b(0x119)];return console[_0x75872b(0x14b)]('✔\x20Journey\x20\x22'+_0x197667[_0x75872b(0x1c6)][_0x75872b(0xfb)]+'\x22\x20paused'),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a27_0x3d26ae(0xfb)]=a27_0x3d26ae(0x11b);[a27_0x3d26ae(0x187)]=a27_0x3d26ae(0x114);async[a27_0x3d26ae(0x102)](_0x383b1a){const _0x226b44=a27_0x3d26ae,{options:_0x267535,args:_0x59f9c1,tdx:_0x25fa27}=_0x383b1a,_0x4a2c23=_0x59f9c1[0x0];if(!requireNameOrPath(_0x4a2c23))return 0x1;_0x267535['verbose']&&console[_0x226b44(0x14b)](_0x226b44(0x181)+_0x4a2c23);const {journeyId:_0x18d4e6,journeyName:_0x5d9447}=await resolveJourneyIdFromInput(_0x4a2c23,_0x267535,_0x25fa27);if(!_0x267535[_0x226b44(0x157)]){const _0x1787af=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22'+_0x5d9447+'\x22?');if(!_0x1787af)return console[_0x226b44(0x14b)](_0x226b44(0x141)),0x0;}const _0x79a60f=await withSpinner(_0x226b44(0x161),()=>_0x25fa27[_0x226b44(0x15c)][_0x226b44(0x19b)](_0x18d4e6),{'verbose':_0x267535[_0x226b44(0x1e3)]}),_0x51366b=_0x79a60f[_0x226b44(0x119)];return console[_0x226b44(0x14b)](_0x226b44(0x16d)+_0x51366b[_0x226b44(0x1c6)][_0x226b44(0xfb)]+_0x226b44(0x1a1)),0x0;}}export class JourneyPullCommand extends BaseCommand{['name']='journey:pull';['description']='Export\x20journey(s)\x20as\x20YAML\x20files';async[a27_0x3d26ae(0x102)](_0x171988){const _0x202a22=a27_0x3d26ae,{options:_0x44d3f9,args:_0x3306c7,tdx:_0x493a32}=_0x171988,_0x5388fd=_0x44d3f9,_0x56e4da=_0x3306c7[0x0],_0x383751=_0x56e4da&&isYamlFilePath(_0x56e4da),_0x317bbc=await resolveTarget({'arg':_0x383751?_0x56e4da:undefined,'contextParent':_0x44d3f9[_0x202a22(0x1ec)],'cwd':process[_0x202a22(0x16f)]()});if(!isSuccessfulResolution(_0x317bbc))return _0x317bbc['errorCode']===_0x202a22(0x155)?(console[_0x202a22(0x14b)](a27_0x36bf62[_0x202a22(0x18c)](_0x202a22(0x1e5))),console[_0x202a22(0x14b)](_0x202a22(0x17c)),console['error'](_0x202a22(0x15e)),console[_0x202a22(0x14b)](_0x202a22(0x19a)),console['error']('\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')):(console[_0x202a22(0x14b)](a27_0x36bf62[_0x202a22(0x1dd)](_0x202a22(0x168)+_0x317bbc[_0x202a22(0x1a6)]+'\x0a')),_0x317bbc['helpText']&&console[_0x202a22(0x14b)](a27_0x36bf62[_0x202a22(0x1c7)](_0x317bbc[_0x202a22(0x1d1)]))),0x1;let _0x542ebf=_0x383751?undefined:_0x56e4da,_0x215eaa,_0x239464;_0x317bbc['type']===_0x202a22(0x14f)&&(_0x542ebf=_0x317bbc[_0x202a22(0x1b1)],_0x215eaa=_0x317bbc['filePath'],_0x239464=_0x317bbc[_0x202a22(0x104)]);const _0x54d989=_0x317bbc['parentName'],_0x58ee80=_0x317bbc[_0x202a22(0x1a3)];_0x5388fd[_0x202a22(0x1e3)]&&(console[_0x202a22(0x14b)](_0x202a22(0x15b)+_0x54d989),console[_0x202a22(0x14b)](_0x202a22(0x203)+_0x58ee80),_0x542ebf&&console[_0x202a22(0x14b)](_0x202a22(0x136)+_0x542ebf),_0x215eaa&&console[_0x202a22(0x14b)](_0x202a22(0x11f)+_0x215eaa),_0x239464&&console['error'](_0x202a22(0x1d2)+_0x239464));const _0xc0a784=await withSpinner(_0x202a22(0x1e2),()=>_0x493a32[_0x202a22(0x1aa)][_0x202a22(0x13a)](_0x54d989),{'verbose':_0x44d3f9[_0x202a22(0x1e3)]}),_0x9eb97e=_0xc0a784['data'],{journeys:_0x2313bb,folders:_0x58322d}=await withSpinner(_0x202a22(0x199),async()=>{const _0xc53e7f=_0x202a22,[_0x5d9bdd,_0x21b8c6]=await Promise[_0xc53e7f(0x1bd)]([_0x493a32[_0xc53e7f(0x15c)][_0xc53e7f(0x178)](_0x9eb97e,undefined,{'includeAllVersions':!![]}),_0x493a32[_0xc53e7f(0x1aa)][_0xc53e7f(0x1ff)](_0x9eb97e)]);return{'journeys':_0x5d9bdd,'folders':_0x21b8c6};},{'verbose':_0x44d3f9['verbose']})[_0x202a22(0x152)](_0x57a5ac=>_0x57a5ac['data']);let _0x6ff93d=_0x2313bb;const _0x4f85e7=buildFolderIdToPathMap(_0x58322d);if(_0x542ebf){const _0x662f9d=_0x6ff93d[_0x202a22(0x11a)](_0x353ea6=>_0x353ea6[_0x202a22(0x17d)][_0x202a22(0x117)]()===_0x542ebf['toLowerCase']());if(_0x662f9d[_0x202a22(0x12a)]===0x0)return console['error'](_0x202a22(0x118)+_0x542ebf),console['error'](_0x202a22(0x1de)),0x1;_0x6ff93d=_0x662f9d;}if(_0x239464!==undefined){const _0xfd0be6=_0x6ff93d[_0x202a22(0x11a)](_0x5576c3=>{const _0x35a68e=_0x202a22,_0x439617=_0x5576c3['folderId']?_0x4f85e7[_0x35a68e(0x173)](_0x5576c3['folderId'])||'':'';return _0x439617===_0x239464;});if(_0xfd0be6[_0x202a22(0x12a)]===0x0&&_0x6ff93d['length']>0x0){console['error'](_0x202a22(0x14e)+_0x542ebf+_0x202a22(0x195)+(_0x239464||_0x202a22(0x129))),console[_0x202a22(0x14b)](_0x202a22(0x202));for(const _0x114d9e of _0x6ff93d){const _0x36751b=_0x114d9e[_0x202a22(0x179)]?_0x4f85e7['get'](_0x114d9e[_0x202a22(0x179)])||'':'';console[_0x202a22(0x14b)](_0x202a22(0x12f)+(_0x36751b||_0x202a22(0x137))+'/'+_0x114d9e[_0x202a22(0x17d)]);}return 0x1;}_0x6ff93d=_0xfd0be6;}if(_0x6ff93d[_0x202a22(0x12a)]===0x0)return console['error'](_0x202a22(0x18a)),0x0;const _0x1b588e=new Map();for(const _0x2f090d of _0x6ff93d){const _0x304d98=_0x2f090d['journeyBundleId'];!_0x1b588e[_0x202a22(0x1cd)](_0x304d98)&&_0x1b588e['set'](_0x304d98,[]),_0x1b588e[_0x202a22(0x173)](_0x304d98)[_0x202a22(0x1c5)](_0x2f090d);}for(const _0x3adc2b of _0x1b588e[_0x202a22(0x159)]()){_0x3adc2b['sort']((_0x3fae87,_0x528c39)=>(_0x3fae87[_0x202a22(0x1da)]||0x0)-(_0x528c39[_0x202a22(0x1da)]||0x0));}const _0x4fe3a7=[],{idToEmailMap:_0x222b45,connectionIdToNameMap:_0x14267b}=await withSpinner('Fetching\x20users\x20and\x20connections...',async()=>{const _0x1eb7a4=_0x202a22,[_0x3794ae,_0x3df635]=await Promise['all']([_0x493a32[_0x1eb7a4(0x124)][_0x1eb7a4(0x16c)](),_0x493a32['connection'][_0x1eb7a4(0x185)]()]);return{'idToEmailMap':_0x3794ae,'connectionIdToNameMap':_0x3df635};},{'verbose':_0x44d3f9[_0x202a22(0x1e3)]})['then'](_0x2d8020=>_0x2d8020[_0x202a22(0x119)]);for(const _0x4617bc of _0x1b588e[_0x202a22(0x159)]()){const _0x5ce9bb=_0x4617bc[0x0][_0x202a22(0x17d)],_0x346a5a=_0x4617bc[0x0][_0x202a22(0x179)],_0x1a48b1=_0x346a5a?_0x4f85e7[_0x202a22(0x173)](_0x346a5a)||'':'',_0x3694f8=_0x1a48b1?a27_0x745048[_0x202a22(0x134)](_0x58ee80,_0x1a48b1):_0x58ee80,_0x52fc24=_0x215eaa||a27_0x745048[_0x202a22(0x134)](_0x3694f8,sanitizeFileName(_0x5ce9bb)+_0x202a22(0x12e));let _0x35f346,_0x3caeec;if(existsSync(_0x52fc24))try{const _0x224651=readFileSync(_0x52fc24,_0x202a22(0x15a)),_0x1a2b38=parseYamlString(_0x224651);_0x3caeec=_0x1a2b38,_0x35f346=buildRuleToNameMapping(_0x1a2b38),_0x5388fd[_0x202a22(0x1e3)]&&_0x35f346[_0x202a22(0x191)]>0x0&&console[_0x202a22(0x14b)](_0x202a22(0x183)+_0x35f346[_0x202a22(0x191)]+_0x202a22(0x1b3)+_0x5ce9bb);}catch(_0x568b10){_0x5388fd[_0x202a22(0x1e3)]&&console[_0x202a22(0x14b)](_0x202a22(0x18b)+_0x568b10['message']);}const _0x2ec686=[],_0x5ec7dd=new Set(),_0x28ef57=new Map(),_0x9ed35f=new Map(),_0x32678d=new Set(),_0x2f0a3a=new Map(),_0x309a3c=new Map(),_0x21e78a=createJumpTargetCache();await withProgressSpinner(_0x202a22(0x1ef)+_0x5ce9bb+'...',async _0x100eac=>{const _0x477e1e=_0x202a22;for(const _0x368817 of _0x4617bc){const _0x182465=_0x4617bc[_0x477e1e(0x12a)]>0x1?_0x368817[_0x477e1e(0x17d)]+'\x20v'+(_0x368817[_0x477e1e(0x1da)]||0x1):_0x368817['journeyBundleName'];_0x100eac['setPhase']('Fetching\x20'+_0x182465);const _0x39b67b=await _0x493a32[_0x477e1e(0x15c)][_0x477e1e(0x16b)](_0x368817['id']),_0x1d6954=_0x39b67b[_0x477e1e(0x1c6)]?.['audienceId'],_0x53942={'resolveSegment':async _0x27758c=>{const _0x2b4136=_0x477e1e;if(!_0x1d6954)return{'name':_0x27758c,'isJourneyLocal':![]};const _0x5785bf=_0x28ef57[_0x2b4136(0x173)](_0x27758c);if(_0x5785bf)return _0x5785bf;try{const _0xa13c2b=await _0x493a32['segment'][_0x2b4136(0x100)](_0x1d6954,_0x27758c),_0x2495c1=_0xa13c2b[_0x2b4136(0x160)]===SEGMENT_KIND_JOURNEY;let _0x5ceeb9,_0x7a208f=_0xa13c2b['name'];if(_0x2495c1&&_0xa13c2b[_0x2b4136(0x1a9)]){const _0x748c84=await segmentResponseToDef(_0xa13c2b,{'resolveSegmentName':async _0x1b6030=>{const _0x2e0b7f=_0x2b4136,_0x4a6398=_0x28ef57['get'](_0x1b6030);if(_0x4a6398)return _0x4a6398['name'];const _0x34b275=await _0x53942[_0x2e0b7f(0x156)](_0x1b6030);return _0x34b275[_0x2e0b7f(0xfb)];}}),_0x51abfe=_0x748c84[_0x2b4136(0x1a9)];_0x5ceeb9={'description':_0xa13c2b[_0x2b4136(0x187)],'rule':_0x51abfe};const _0x14f686=serializeRule(_0x51abfe),_0x403e27=_0x9ed35f['get'](_0x14f686);if(_0x403e27)_0x7a208f=_0x403e27,_0x5ceeb9=undefined,_0x5388fd['verbose']&&console[_0x2b4136(0x14b)](_0x2b4136(0x208)+_0xa13c2b['name']+'\x20->\x20'+_0x403e27);else{let _0x2d0ae7=![];if(_0x35f346){const _0x341905=_0x35f346[_0x2b4136(0x173)](_0x14f686);if(_0x341905){const _0xe2544a=_0x341905[_0x2b4136(0x163)](_0x41d7e2=>!_0x5ec7dd[_0x2b4136(0x1cd)](_0x41d7e2));_0xe2544a&&(_0x7a208f=_0xe2544a,_0x5ec7dd[_0x2b4136(0x128)](_0xe2544a),_0x9ed35f[_0x2b4136(0x175)](_0x14f686,_0xe2544a),_0x2d0ae7=!![],_0x5388fd[_0x2b4136(0x1e3)]&&console['error'](_0x2b4136(0x142)+_0xe2544a+_0x2b4136(0x121)));}}if(!_0x2d0ae7){const _0x18a73e=generateJourneyLocalName(_0xa13c2b[_0x2b4136(0xfb)]);_0x18a73e&&(_0x7a208f=_0x18a73e);let _0x8f02a5=_0x7a208f,_0x49d1bb=0x2;while(_0x5ec7dd[_0x2b4136(0x1cd)](_0x8f02a5)){_0x8f02a5=_0x7a208f+'_'+_0x49d1bb,_0x49d1bb++;}_0x5ec7dd[_0x2b4136(0x128)](_0x8f02a5),_0x9ed35f['set'](_0x14f686,_0x8f02a5),_0x7a208f=_0x8f02a5;}}}const _0x3c5ef8={'name':_0x7a208f,'isJourneyLocal':_0x2495c1,'definition':_0x5ceeb9};return _0x28ef57[_0x2b4136(0x175)](_0x27758c,_0x3c5ef8),_0x3c5ef8;}catch(_0x184f10){return _0x44d3f9['verbose']&&console[_0x2b4136(0x14b)](_0x2b4136(0x15d)+_0x27758c+':\x20'+_0x184f10[_0x2b4136(0x1a6)]),{'name':_0x27758c,'isJourneyLocal':![]};}},'resolveActivation':async _0x268bb3=>{const _0x3eb2f4=_0x477e1e,_0xef0042=_0x2f0a3a[_0x3eb2f4(0x173)](_0x268bb3);if(_0xef0042)return _0xef0042;try{const _0x319133=await _0x493a32[_0x3eb2f4(0x15c)][_0x3eb2f4(0x1f3)](_0x368817['id'],_0x268bb3),_0x1c5dd3=journeyActivationStepToYaml(_0x319133,_0x222b45,_0x14267b),_0x103c45=JSON[_0x3eb2f4(0x151)]({'name':_0x1c5dd3['name'],'connection':_0x1c5dd3[_0x3eb2f4(0x11c)],'connector_config':_0x1c5dd3[_0x3eb2f4(0x126)]}),_0xfa73c3=_0x309a3c[_0x3eb2f4(0x173)](_0x103c45);if(_0xfa73c3){const _0x1e2db2={'name':_0xfa73c3,'isJourneyLocal':!![],'definition':_0x1c5dd3};return _0x2f0a3a['set'](_0x268bb3,_0x1e2db2),_0x1e2db2;}const _0x24b252=_0x319133[_0x3eb2f4(0x1c6)]['activationParams']['name']||_0x268bb3,_0x1426af=sanitizeYamlKey(_0x24b252)||'activation_'+_0x268bb3;let _0x2c58bd=_0x1426af,_0x568fd6=0x2;while(_0x32678d[_0x3eb2f4(0x1cd)](_0x2c58bd)){_0x2c58bd=_0x1426af+'_'+_0x568fd6,_0x568fd6++;}_0x32678d['add'](_0x2c58bd),_0x309a3c[_0x3eb2f4(0x175)](_0x103c45,_0x2c58bd);const _0x33b93e={'name':_0x2c58bd,'isJourneyLocal':!![],'definition':_0x1c5dd3};return _0x2f0a3a[_0x3eb2f4(0x175)](_0x268bb3,_0x33b93e),_0x33b93e;}catch(_0x5c5c97){return _0x44d3f9['verbose']&&console[_0x3eb2f4(0x14b)](_0x3eb2f4(0x1f7)+_0x268bb3+':\x20'+_0x5c5c97[_0x3eb2f4(0x1a6)]),{'name':_0x268bb3,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x58d386,_0x3ddfcd)=>{const _0x4b3b7d=_0x477e1e;return resolveJumpTarget(_0x58d386,_0x3ddfcd,_0x21e78a,_0x344ed1=>_0x493a32[_0x4b3b7d(0x15c)][_0x4b3b7d(0x16b)](_0x344ed1));}},_0x455806=await journeyResponseToDef(_0x39b67b,_0x53942);_0x2ec686['push']({'item':_0x368817,'yaml':_0x455806});}},{'verbose':_0x44d3f9[_0x202a22(0x1e3)]});const _0x505a63=await _0x493a32[_0x202a22(0x15c)][_0x202a22(0x113)](_0x4617bc[0x0][_0x202a22(0x204)]),_0x312380=buildMergedJourneyDef(_0x2ec686,_0x35f346,_0x505a63),_0x32dd16=normalizeJourneyDef(_0x312380,_0x3caeec),_0x51a7de=toYamlString(_0x32dd16),_0x17e8b5=_0x215eaa||a27_0x745048[_0x202a22(0x134)](_0x3694f8,sanitizeFileName(_0x5ce9bb)+_0x202a22(0x12e));!_0x215eaa&&_0x1a48b1&&!existsSync(_0x3694f8)&&mkdirSync(_0x3694f8,{'recursive':!![]});const _0x5ec409=a27_0x745048[_0x202a22(0x14a)](process[_0x202a22(0x16f)](),_0x17e8b5);if(existsSync(_0x17e8b5)){const _0x4bf217=readFileSync(_0x17e8b5,'utf-8'),_0x141ef0=generateDiff(_0x4bf217,_0x51a7de),_0x18e41e=hasChanges(_0x141ef0);_0x4fe3a7[_0x202a22(0x1c5)]({'relativePath':_0x5ec409,'absolutePath':_0x17e8b5,'content':_0x51a7de,'isNew':![],'hasChanges':_0x18e41e,'diff':_0x18e41e?formatDiffWithColors(_0x141ef0):undefined});}else _0x4fe3a7[_0x202a22(0x1c5)]({'relativePath':_0x5ec409,'absolutePath':_0x17e8b5,'content':_0x51a7de,'isNew':!![],'hasChanges':![]});}const _0x582f9f=_0x4fe3a7[_0x202a22(0x11a)](_0x26d7d2=>_0x26d7d2['isNew']),_0x21dc21=_0x4fe3a7[_0x202a22(0x11a)](_0x2cd640=>!_0x2cd640[_0x202a22(0x10f)]&&_0x2cd640[_0x202a22(0x169)]),_0x4d3b43=_0x4fe3a7[_0x202a22(0x11a)](_0x59e8aa=>!_0x59e8aa[_0x202a22(0x10f)]&&!_0x59e8aa[_0x202a22(0x169)]),_0x318b27=_0x6ff93d[_0x202a22(0x12a)],_0x4e31c3=_0x1b588e[_0x202a22(0x191)],_0x1a92f8=_0x318b27>_0x4e31c3?'\x20('+_0x318b27+_0x202a22(0x1c0):'';console[_0x202a22(0x14b)]('\x0aPull\x20summary:'),console[_0x202a22(0x14b)]('\x20\x20'+a27_0x36bf62[_0x202a22(0x1c7)](_0x4e31c3+_0x202a22(0x1e9))+a27_0x36bf62[_0x202a22(0x10c)](_0x1a92f8)),console[_0x202a22(0x14b)]('\x20\x20'+a27_0x36bf62[_0x202a22(0x1f5)]('+\x20'+_0x582f9f['length']+'\x20new\x20files')),console[_0x202a22(0x14b)]('\x20\x20'+a27_0x36bf62[_0x202a22(0x18c)]('~\x20'+_0x21dc21[_0x202a22(0x12a)]+'\x20changed\x20files')),console[_0x202a22(0x14b)]('\x20\x20'+a27_0x36bf62['dim']('=\x20'+_0x4d3b43[_0x202a22(0x12a)]+'\x20unchanged\x20files')),console[_0x202a22(0x14b)](_0x202a22(0x107)+a27_0x36bf62[_0x202a22(0x1c7)](_0x58ee80)+'\x0a');if(_0x21dc21['length']>0x0)for(const _0x11ece4 of _0x21dc21){console[_0x202a22(0x14b)](_0x202a22(0x1ea)+_0x11ece4[_0x202a22(0x1df)]+'\x27:'),console[_0x202a22(0x14b)]('─'[_0x202a22(0x1d9)](0x3c)),console['error'](_0x11ece4['diff']),console[_0x202a22(0x14b)]('─'[_0x202a22(0x1d9)](0x3c));}if(_0x5388fd[_0x202a22(0x10e)])return console[_0x202a22(0x14b)](a27_0x36bf62['yellow'](_0x202a22(0x11e))),0x0;if(_0x582f9f['length']===0x0&&_0x21dc21['length']===0x0)return console[_0x202a22(0x14b)](a27_0x36bf62['green']('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x54d989},_0x5388fd[_0x202a22(0x158)]),console[_0x202a22(0x14b)](a27_0x36bf62[_0x202a22(0x1f5)]('✔\x20Context\x20set:\x20'+a27_0x36bf62[_0x202a22(0x10c)](_0x202a22(0x112))+_0x202a22(0x1b5)+a27_0x36bf62[_0x202a22(0x1c7)](_0x54d989))),0x0;if(!_0x5388fd[_0x202a22(0x157)]&&(_0x582f9f[_0x202a22(0x12a)]>0x0||_0x21dc21[_0x202a22(0x12a)]>0x0)){if(!isInteractive())return console[_0x202a22(0x14b)](a27_0x36bf62[_0x202a22(0x1dd)](_0x202a22(0x16e)),_0x202a22(0x115)),console[_0x202a22(0x14b)](a27_0x36bf62[_0x202a22(0x10c)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x13d86e=await confirmKey(_0x202a22(0x19f)+(_0x582f9f[_0x202a22(0x12a)]+_0x21dc21[_0x202a22(0x12a)])+'\x20files?');if(!_0x13d86e)return console['error'](a27_0x36bf62[_0x202a22(0x18c)]('Aborted.'),_0x202a22(0x105)),0x1;}!existsSync(_0x58ee80)&&mkdirSync(_0x58ee80,{'recursive':!![]});const _0x15a2b9=a27_0x745048[_0x202a22(0x134)](_0x58ee80,_0x202a22(0x1c8));writeFileSync(_0x15a2b9,createTdxConfigContent(_0x54d989),_0x202a22(0x15a));for(const _0x5b67aa of _0x4fe3a7){(_0x5b67aa[_0x202a22(0x10f)]||_0x5b67aa[_0x202a22(0x169)])&&writeFileSync(_0x5b67aa[_0x202a22(0x10a)],_0x5b67aa[_0x202a22(0x1b6)],_0x202a22(0x15a));}return console['error'](a27_0x36bf62[_0x202a22(0x1f5)](_0x202a22(0x1b2)+(_0x582f9f[_0x202a22(0x12a)]+_0x21dc21['length'])+'\x20journey\x20files\x20to\x20'+_0x58ee80)),saveSessionContext({'parent_segment':_0x54d989},_0x5388fd[_0x202a22(0x158)]),console[_0x202a22(0x14b)](a27_0x36bf62[_0x202a22(0x1f5)](_0x202a22(0x123)+a27_0x36bf62['dim']('parent_segment')+_0x202a22(0x1b5)+a27_0x36bf62[_0x202a22(0x1c7)](_0x54d989))),0x0;}}export class JourneyColumnsCommand extends BaseCommand{['name']=a27_0x3d26ae(0x1a7);[a27_0x3d26ae(0x187)]=a27_0x3d26ae(0x14d);async[a27_0x3d26ae(0x102)](_0x2d93ca){const _0x5b0790=a27_0x3d26ae,{options:_0x4837bd,args:_0x50582f,tdx:_0x3dcd2c}=_0x2d93ca,_0x3e02fa=_0x50582f[0x0];if(!requireNameOrPath(_0x3e02fa))return 0x1;_0x4837bd[_0x5b0790(0x1e3)]&&console[_0x5b0790(0x14b)](_0x5b0790(0x181)+_0x3e02fa);const {journeyId:_0x5dfa38}=await resolveJourneyIdFromInput(_0x3e02fa,_0x4837bd,_0x3dcd2c),_0x48bdd1=await withSpinner(_0x5b0790(0x13f),()=>_0x3dcd2c[_0x5b0790(0x15c)][_0x5b0790(0x138)](_0x5dfa38),{'verbose':_0x4837bd[_0x5b0790(0x1e3)]}),_0x4e4911=_0x48bdd1[_0x5b0790(0x119)];return console[_0x5b0790(0x130)](_0x5b0790(0x149)+_0x4e4911[_0x5b0790(0x1b4)]),console[_0x5b0790(0x130)]('Table:\x20'+_0x4e4911[_0x5b0790(0x127)]),await handleSDKOutput(_0x4e4911[_0x5b0790(0xfc)],_0x4837bd),0x0;}}export class JourneyActivationsCommand extends BaseCommand{[a27_0x3d26ae(0xfb)]=a27_0x3d26ae(0x1c1);[a27_0x3d26ae(0x187)]=a27_0x3d26ae(0x1ed);async[a27_0x3d26ae(0x102)](_0x567c98){const _0x438b00=a27_0x3d26ae,{options:_0x3ab812,args:_0x2469b2,tdx:_0x243abf}=_0x567c98,_0x3ebec2=_0x2469b2[0x0];if(!requireNameOrPath(_0x3ebec2))return 0x1;_0x3ab812[_0x438b00(0x1e3)]&&console[_0x438b00(0x14b)]('Input:\x20'+_0x3ebec2);const {journeyId:_0x360b0f}=await resolveJourneyIdFromInput(_0x3ebec2,_0x3ab812,_0x243abf),_0x5abd7c=await withSpinner(_0x438b00(0x1f8),()=>_0x243abf[_0x438b00(0x15c)][_0x438b00(0x1ae)](_0x360b0f),{'verbose':_0x3ab812['verbose']}),_0xfcd1ce=_0x5abd7c[_0x438b00(0x119)];return console[_0x438b00(0x14b)]('Found\x20'+_0xfcd1ce[_0x438b00(0x12a)]+_0x438b00(0x10b)+(_0xfcd1ce[_0x438b00(0x12a)]!==0x1?'s':'')),await handleSDKOutput(_0xfcd1ce,_0x3ab812),0x0;}}export class JourneyPushCommand extends BaseCommand{['name']=a27_0x3d26ae(0x1ad);[a27_0x3d26ae(0x187)]=a27_0x3d26ae(0x1ca);[a27_0x3d26ae(0x1d7)]=new SegmentPushCommand();async[a27_0x3d26ae(0x102)](_0x3b087f){const _0x5d080d=a27_0x3d26ae,_0x5af19d=_0x3b087f[_0x5d080d(0x147)][0x0];let _0x1419e9;if(_0x5af19d){const _0x1c1bbb=await resolveTarget({'arg':_0x5af19d,'contextParent':_0x3b087f[_0x5d080d(0x1b9)]['parentSegment'],'cwd':process[_0x5d080d(0x16f)]()});isSuccessfulResolution(_0x1c1bbb)&&_0x1c1bbb[_0x5d080d(0x101)]===_0x5d080d(0x14f)&&(_0x1419e9=_0x1c1bbb['filePath']);}const _0x2f31a2={..._0x3b087f,'options':{..._0x3b087f[_0x5d080d(0x1b9)],'journeysOnly':!![],..._0x1419e9&&{'singleFilePath':_0x1419e9}}};return this[_0x5d080d(0x1d7)][_0x5d080d(0x102)](_0x2f31a2);}}export class JourneyVersionsCommand extends BaseCommand{[a27_0x3d26ae(0xfb)]=a27_0x3d26ae(0x1e0);[a27_0x3d26ae(0x187)]='List\x20all\x20versions\x20of\x20a\x20journey';async[a27_0x3d26ae(0x102)](_0x1372e8){const _0x272940=a27_0x3d26ae,{options:_0x49fe25,args:_0x10c2c2,tdx:_0xabeb00}=_0x1372e8,_0xc8f7a3=_0x10c2c2[0x0];if(!requireNameOrPath(_0xc8f7a3))return 0x1;if(_0x49fe25['verbose'])console[_0x272940(0x14b)](_0x272940(0x181)+_0xc8f7a3);const {journeyId:_0x54f819}=await resolveJourneyIdFromInput(_0xc8f7a3,_0x49fe25,_0xabeb00),_0x457a7b=await withSpinner('Listing\x20journey\x20versions...',()=>_0xabeb00[_0x272940(0x15c)][_0x272940(0x12c)](_0x54f819),{'verbose':_0x49fe25[_0x272940(0x1e3)]}),{bundleName:_0x58f1af,versions:_0x15f742,latestJourneyId:_0x590a2f}=_0x457a7b['data'];console[_0x272940(0x14b)](_0x58f1af+':\x20'+_0x15f742[_0x272940(0x12a)]+_0x272940(0x1be)+(_0x15f742[_0x272940(0x12a)]!==0x1?'s':''));const _0x1918d7=_0x15f742[_0x272940(0x150)](_0xe1f991=>({'version':_0xe1f991[_0x272940(0x1da)],'journey_id':_0xe1f991['journeyId'],'name':_0xe1f991['name'],'state':_0xe1f991[_0x272940(0x1f0)],'paused':_0xe1f991['paused'],'latest':_0xe1f991[_0x272940(0x1c4)]===_0x590a2f,'created_at':_0xe1f991[_0x272940(0x167)]}));return await handleSDKOutput(_0x1918d7,_0x49fe25),0x0;}}export class JourneyVersionCreateCommand extends BaseCommand{['name']=a27_0x3d26ae(0x16a);[a27_0x3d26ae(0x187)]=a27_0x3d26ae(0x132);async[a27_0x3d26ae(0x102)](_0x3af4fc){const _0x33ecd1=a27_0x3d26ae,{options:_0xb071d0,args:_0x42d78d,tdx:_0x13c57c}=_0x3af4fc,_0x44057e=_0x42d78d[0x0];if(!requireNameOrPath(_0x44057e))return 0x1;if(_0xb071d0[_0x33ecd1(0x1e3)])console[_0x33ecd1(0x14b)](_0x33ecd1(0x181)+_0x44057e);const {journeyId:_0x1bc1b5,journeyName:_0x11c946}=await resolveJourneyIdFromInput(_0x44057e,_0xb071d0,_0x13c57c);if(!_0xb071d0[_0x33ecd1(0x157)]){const _0x27af06=await confirm('Create\x20a\x20new\x20draft\x20version\x20of\x20journey\x20\x22'+_0x11c946+'\x22?');if(!_0x27af06)return console[_0x33ecd1(0x14b)](_0x33ecd1(0x141)),0x0;}const _0x597021=await withSpinner(_0x33ecd1(0x182),()=>_0x13c57c[_0x33ecd1(0x15c)][_0x33ecd1(0x1fe)](_0x1bc1b5),{'verbose':_0xb071d0[_0x33ecd1(0x1e3)]}),_0x30ddf9=_0x597021['data'];return console[_0x33ecd1(0x14b)](a27_0x36bf62[_0x33ecd1(0x1f5)]('✔')+_0x33ecd1(0x1c2)+_0x30ddf9['attributes'][_0x33ecd1(0x1da)]+_0x33ecd1(0x11d)+_0x30ddf9[_0x33ecd1(0x1c6)][_0x33ecd1(0xfb)]+'\x22'),console[_0x33ecd1(0x14b)]('\x20\x20Journey\x20ID:\x20'+_0x30ddf9['id']),await handleSingleObjectOutput({'id':_0x30ddf9['id'],'name':_0x30ddf9[_0x33ecd1(0x1c6)][_0x33ecd1(0xfb)],'version':_0x30ddf9['attributes'][_0x33ecd1(0x1da)],'state':_0x30ddf9[_0x33ecd1(0x1c6)][_0x33ecd1(0x1f0)],'bundle_id':_0x30ddf9['attributes']['journeyBundleId'],'created_at':_0x30ddf9[_0x33ecd1(0x1c6)][_0x33ecd1(0x167)]},_0xb071d0),0x0;}}export class JourneyVersionViewCommand extends BaseCommand{[a27_0x3d26ae(0xfb)]=a27_0x3d26ae(0x194);['description']=a27_0x3d26ae(0x133);async[a27_0x3d26ae(0x102)](_0x469b24){const _0x5f0894=a27_0x3d26ae,{options:_0x563b67,args:_0x16954b,tdx:_0xd02701}=_0x469b24,_0x213827=_0x16954b[0x0];if(!requireNameOrPath(_0x213827))return 0x1;const _0x4182e7=_0x563b67[_0x5f0894(0x174)];if(!_0x4182e7)return console['error']('Error:\x20--version\x20option\x20is\x20required'),console[_0x5f0894(0x14b)](_0x5f0894(0x177)),0x1;const _0x129636=parseInt(_0x4182e7,0xa);if(isNaN(_0x129636)||_0x129636<0x1)return console[_0x5f0894(0x14b)](_0x5f0894(0x200)+_0x4182e7),0x1;if(_0x563b67['verbose'])console[_0x5f0894(0x14b)]('Input:\x20'+_0x213827+_0x5f0894(0x1f4)+_0x129636);const {journeyId:_0x238217,parentSegmentId:_0x4d5fd8}=await resolveJourneyIdFromInput(_0x213827,_0x563b67,_0xd02701),_0x6a14ee=await withSpinner('Resolving\x20version...',()=>_0xd02701[_0x5f0894(0x15c)][_0x5f0894(0x12c)](_0x238217),{'verbose':_0x563b67[_0x5f0894(0x1e3)]}),{versions:_0x37faa3,latestJourneyId:_0x5a0ad4}=_0x6a14ee['data'],_0x1a2c0a=_0x37faa3[_0x5f0894(0x163)](_0x5c366f=>_0x5c366f[_0x5f0894(0x1da)]===_0x129636);if(!_0x1a2c0a){const _0x2646eb=_0x37faa3[_0x5f0894(0x150)](_0x10b49b=>'v'+_0x10b49b['versionNumber'])[_0x5f0894(0x134)](',\x20');return console[_0x5f0894(0x14b)](_0x5f0894(0x180)+_0x129636+_0x5f0894(0x1cb)+_0x2646eb),0x1;}const _0x454b1a=await withSpinner('Getting\x20version\x20'+_0x129636+_0x5f0894(0x1e8),()=>_0xd02701[_0x5f0894(0x15c)][_0x5f0894(0x16b)](_0x1a2c0a[_0x5f0894(0x1c4)]),{'verbose':_0x563b67[_0x5f0894(0x1e3)]}),_0xdfc86=_0x454b1a[_0x5f0894(0x119)],_0x1b974d=getConsoleNextUrl(_0x563b67['site'],_0x5f0894(0x172)+_0x4d5fd8+'/e/'+_0x1a2c0a[_0x5f0894(0x1c4)]+'/j/da/je');return await handleSingleObjectOutput({'id':_0xdfc86['id'],'name':_0xdfc86[_0x5f0894(0x1c6)][_0x5f0894(0xfb)],'version':_0xdfc86['attributes'][_0x5f0894(0x1da)],'description':_0xdfc86[_0x5f0894(0x1c6)][_0x5f0894(0x187)],'state':_0xdfc86[_0x5f0894(0x1c6)][_0x5f0894(0x1f0)],'paused':_0xdfc86[_0x5f0894(0x1c6)]['paused'],'reentry_mode':_0xdfc86[_0x5f0894(0x1c6)][_0x5f0894(0x1ab)],'stages':_0xdfc86[_0x5f0894(0x1c6)][_0x5f0894(0x15f)]?.[_0x5f0894(0x12a)]||0x0,..._0xdfc86[_0x5f0894(0x1c6)][_0x5f0894(0x201)]&&{'goal':_0xdfc86[_0x5f0894(0x1c6)][_0x5f0894(0x201)]['name']},'latest':_0x1a2c0a[_0x5f0894(0x1c4)]===_0x5a0ad4,'created_at':_0xdfc86[_0x5f0894(0x1c6)]['createdAt'],'updated_at':_0xdfc86[_0x5f0894(0x1c6)][_0x5f0894(0x1f1)],'url':_0x1b974d},_0x563b67),0x0;}}
1
+ const a27_0x256e1e=a27_0x4aef;(function(_0x4c68a7,_0x1723ea){const _0x2f6a13=a27_0x4aef,_0x1ff3dd=_0x4c68a7();while(!![]){try{const _0x324cce=parseInt(_0x2f6a13(0xef))/0x1+parseInt(_0x2f6a13(0x1b1))/0x2*(-parseInt(_0x2f6a13(0xf1))/0x3)+-parseInt(_0x2f6a13(0x1d7))/0x4*(parseInt(_0x2f6a13(0x152))/0x5)+-parseInt(_0x2f6a13(0x176))/0x6+-parseInt(_0x2f6a13(0xf3))/0x7*(parseInt(_0x2f6a13(0x10d))/0x8)+-parseInt(_0x2f6a13(0x198))/0x9*(parseInt(_0x2f6a13(0x19c))/0xa)+-parseInt(_0x2f6a13(0x1e0))/0xb*(-parseInt(_0x2f6a13(0x11b))/0xc);if(_0x324cce===_0x1723ea)break;else _0x1ff3dd['push'](_0x1ff3dd['shift']());}catch(_0x45e9b4){_0x1ff3dd['push'](_0x1ff3dd['shift']());}}}(a27_0x589b,0x878d1));import a27_0x13d74a from'chalk';import a27_0x555498 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';function a27_0x4aef(_0x482725,_0xeb1396){_0x482725=_0x482725-0xea;const _0x589bb9=a27_0x589b();let _0x4aef5a=_0x589bb9[_0x482725];return _0x4aef5a;}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(_0x465c3c){const _0x1c9d60=a27_0x4aef;return!_0x465c3c&&(console[_0x1c9d60(0x1b3)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x1c9d60(0x1b3)](_0x1c9d60(0x138))),!!_0x465c3c;}function withJsonFormat(_0x581bc9){const _0xaaa127=a27_0x4aef;if(!_0x581bc9[_0xaaa127(0x1c7)]&&!_0x581bc9[_0xaaa127(0x1cc)]&&!_0x581bc9[_0xaaa127(0xf8)]&&!_0x581bc9[_0xaaa127(0x16d)])return{..._0x581bc9,'format':_0xaaa127(0x1cc),'json':!![]};return _0x581bc9;}function formatJourneyState(_0x54f275){const _0x63893b=a27_0x4aef;switch(_0x54f275){case _0x63893b(0x1ae):return a27_0x13d74a[_0x63893b(0x11a)](_0x63893b(0x1a7));case _0x63893b(0x146):return a27_0x13d74a['dim'](_0x63893b(0x1e6));case _0x63893b(0x1c0):return a27_0x13d74a['yellow'](_0x63893b(0x1ee));case'completed':return a27_0x13d74a['blue'](_0x63893b(0x1d3));case _0x63893b(0x10e):return a27_0x13d74a['dim']('(archived)');default:return'('+_0x54f275+')';}}function formatJourneyItem(_0x21304b,_0x316530='',_0x572268){const _0x3e1132=a27_0x4aef,_0x1bf68e=formatJourneyState(_0x21304b[_0x3e1132(0x188)]),_0x2c53aa=_0x572268?hyperlink(_0x21304b[_0x3e1132(0x183)],_0x572268):_0x21304b[_0x3e1132(0x183)];return _0x316530+'🗺️\x20'+_0x2c53aa+'\x20'+_0x1bf68e;}function a27_0x589b(){const _0x1961dd=['Error:\x20--version\x20option\x20is\x20required','tdx.json','enteredSize','hasPeriod','8tqhrpA','archived','\x20Opening\x20','goal','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','Error:\x20Invalid\x20--type\x20\x22','Show\x20journey\x20statistics',',\x20version:\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','limit','journey:version:view','yellow','green','12JjeBoY','isNew','cyan','journey:traffic','/e/','Database:\x20','\x22\x20paused','join','journeyId','history','journey:pull','parent_segment','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','type','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','nodes','\x20journey','stages','cwd','verbose','yes','Error:\x20Journey\x20\x27','diff','Pattern:\x20','getSegment','Fetching\x20users\x20and\x20connections...','listFolders','Warning:\x20--include-history\x20without\x20--from/--to\x20may\x20return\x20all-time\x20history','Fetching\x20','Usage:\x20journey\x20<subcommand>\x20<name-or-path>','resume','getStatistics','journey','/j/da','getColumnMapping','Show\x20journey\x20table\x20column\x20mapping','...','segmentPushCommand','listJourneysFromParentSegment','journey:version:create','activation','audienceId','dim','draft','replace','folderId','getTrafficData','Cancelled','\x20\x20Parent\x20segment:\x20','absolutePath','journey:versions','connection','List\x20all\x20versions\x20of\x20a\x20journey','parentSegment','Creating\x20new\x20version...','5XMuDfm','all','INVALID_ARGUMENT','dryRun','activationParams','log','data','Error:\x20Parent\x20segment\x20context\x20required','If\x20the\x20journey\x20is\x20active,\x20the\x20date\x20range\x20may\x20be\x20too\x20wide.\x20Try\x20a\x20shorter\x20period\x20(max\x20~90\x20days).','/app/ps/','journeyBundleId','exitOrJumpSize','renderStats','push','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','Resume\x20a\x20paused\x20journey','from','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','getJourney','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','Warning:\x20Could\x20not\x20resolve\x20segment\x20','no_parent','Found\x20','goalSize','createdAt','folderPath','Error:\x20','tsv','map','\x20\x20-\x20','filter','\x20(rule\x20match)','\x20=\x20','\x20\x20Statistics\x20not\x20available','\x0aChanges\x20to\x20\x27','\x5c$&','6488130cbDWBD','milestoneSize','parentName','updatedAt','database','add','relativePath','folders','Options:','Traffic\x20data\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','segments','Parent\x20segment:\x20','\x20\x20Target:\x20','journeyBundleName','journey:resume','entries','includeStats','/j/da/je','state','utf-8','Show\x20journey\x20details','pause','execute','options','\x27\x20not\x20found\x20in\x20','connector_config','View\x20a\x20specific\x20version\x20of\x20a\x20journey','Pause\x20a\x20running\x20journey','Get\x20journey\x20traffic\x20data\x20(Sankey\x20charts)','values','hasChanges','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','resolveParentId','Error:\x20Invalid\x20version\x20number:\x20','270xuGYQy','Table:\x20','(root)','📁\x20','258220OiFkMB','Getting\x20journey\x20details...','journey:stats','rule','localeCompare','resolveSegment','\x0aError:','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','Folder\x20path:\x20','\x20Created\x20v','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','(running)','\x20not\x20found.\x20Available:\x20','\x20unchanged\x20files','includeHistory','journeyStages','Input:\x20','sort','launched','✔\x20Journey\x20\x22','relative','886gOghwM','Resolving\x20journey...','error','listVersions','Getting\x20column\x20mapping...','\x20\x20Name:\x20','resolveJourneyId','segment','\x20version','Error:\x20Stage\x20\x22','filePath','✔\x20All\x20files\x20are\x20up\x20to\x20date','stageNameMap','\x20new\x20files','Getting\x20journey\x20traffic\x20data...','paused','split','site','\x20->\x20','\x22.\x20Must\x20be\x20\x22conversion\x22\x20or\x20\x22activation\x22.','table','Aborted.','format','✔\x20Context\x20set:\x20','List\x20journeys\x20in\x20current\x20context','Resolved\x20YAML\x20file:\x20','buildIdToEmailMap','json','Resolving\x20parent\x20segment...','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)','journeyName','getLatestJourneyId','Listing\x20journey\x20activations...','red','(completed)','exitOrJumpRate','segmentName','repeat','2354180mpGWfq','getParentFull','base','helpText','args','No\x20statistics\x20available\x20for\x20journey:\x20','Resuming\x20journey...','session','test','39984604JWxriD','\x20\x20Folder\x20path:\x20','name','No\x20traffic\x20data\x20available\x20for\x20journey:\x20','-\x20no\x20files\x20written','journey:list','(draft)','columns','.yml','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','journey:push','Resolving\x20version...','Create\x20a\x20new\x20draft\x20version\x20of\x20a\x20journey','completionRate','(paused)','Getting\x20version\x20','Could\x20not\x20resolve\x20parent\x20segment.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','\x20\x20Preserving\x20local\x20segment\x20name:\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','file','Create\x20a\x20new\x20draft\x20version\x20of\x20journey\x20\x22','description','length','errorCode','get','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Warning:\x20Could\x20not\x20resolve\x20activation\x20','Usage:\x20journey\x20version\x20view\x20<name-or-path>\x20--version\x20N','Write\x20','reentryMode','285838dTjtPp','size','2229NFUOhV','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','4143132jytfTC','\x20changed\x20files','then','find','\x20\x20Journey\x20ID:\x20','jsonl','web','versionNumber','attributes','toLowerCase','listJourneysWithFolders','activation_','message','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','rootFolderId','user','has','targetDir','set','\x0aPull\x20summary:','listActivationsFlat','conversion'];a27_0x589b=function(){return _0x1961dd;};return a27_0x589b();}function escapeRegex(_0x4d55b4){const _0x37ed31=a27_0x4aef;return _0x4d55b4[_0x37ed31(0x147)](/[.*+?^${}()|[\]\\]/g,_0x37ed31(0x175));}function globToRegex(_0x1f1e73){const _0x5b41d3=a27_0x4aef,_0x13f1a7=_0x1f1e73[_0x5b41d3(0x1c1)]('*')[_0x5b41d3(0x16e)](escapeRegex);return new RegExp(_0x13f1a7['join']('.*'),'i');}function buildRuleToNameMapping(_0x7bab84){const _0x202842=a27_0x4aef,_0x110bd8=new Map();if(_0x7bab84[_0x202842(0x180)])for(const [_0xdca981,_0x50b50a]of Object[_0x202842(0x185)](_0x7bab84['segments'])){if(_0x50b50a['rule']){const _0x49a46d=serializeRule(_0x50b50a[_0x202842(0x19f)]),_0x2b2e7d=_0x110bd8[_0x202842(0x1f8)](_0x49a46d);_0x2b2e7d?_0x2b2e7d[_0x202842(0x15f)](_0xdca981):_0x110bd8[_0x202842(0x105)](_0x49a46d,[_0xdca981]);}}return _0x110bd8;}async function resolveJourneyIdFromInput(_0x1dc860,_0x2f366b,_0x50dd28){const _0x9bf588=a27_0x4aef,_0xc1cbd=await resolveJourneyTarget(_0x1dc860,_0x2f366b[_0x9bf588(0x150)],_0x2f366b[_0x9bf588(0x12e)]),_0x37800e=_0xc1cbd[_0x9bf588(0x150)];if(!_0x37800e)throw new SDKError(ErrorCode[_0x9bf588(0x154)],_0x9bf588(0x1f0));const _0x2b286a=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x50dd28[_0x9bf588(0x1b8)][_0x9bf588(0x196)](_0x37800e),{'verbose':_0x2f366b[_0x9bf588(0x12e)]}),_0x5e2158=_0x2b286a[_0x9bf588(0x158)],_0x38298a=await withSpinner(_0x9bf588(0x1b2),()=>_0x50dd28[_0x9bf588(0x13b)][_0x9bf588(0x1b7)](_0x5e2158,_0xc1cbd[_0x9bf588(0x1cf)]),{'verbose':_0x2f366b[_0x9bf588(0x12e)]});return{'journeyId':_0x38298a['data'],'journeyName':_0xc1cbd[_0x9bf588(0x1cf)],'parentSegmentId':_0x5e2158};}async function resolveJourneyTarget(_0x3004ca,_0x488471,_0x39af02){const _0x5d06f0=a27_0x4aef;if(isYamlFilePath(_0x3004ca))try{const _0x54be56=await resolveYamlFilePath(_0x3004ca);return _0x39af02&&(console[_0x5d06f0(0x1b3)](_0x5d06f0(0x1ca)+_0x3004ca),console[_0x5d06f0(0x1b3)](_0x5d06f0(0x14b)+_0x54be56[_0x5d06f0(0x150)]),console[_0x5d06f0(0x1b3)](_0x5d06f0(0x1b6)+_0x54be56[_0x5d06f0(0x1d5)]),console[_0x5d06f0(0x1b3)](_0x5d06f0(0x1e1)+(_0x54be56[_0x5d06f0(0x16b)]||'(root)'))),{'journeyName':_0x54be56[_0x5d06f0(0x1d5)],'parentSegment':_0x54be56['parentSegment'],'resolved':_0x54be56};}catch(_0x478570){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x5d06f0(0x195)+_0x478570[_0x5d06f0(0xff)]);}if(!_0x488471)throw new SDKError(ErrorCode[_0x5d06f0(0x154)],_0x5d06f0(0x1e9));return{'journeyName':_0x3004ca,'parentSegment':_0x488471};}export class JourneyListCommand extends BaseCommand{[a27_0x256e1e(0x1e2)]=a27_0x256e1e(0x1e5);[a27_0x256e1e(0x1f5)]=a27_0x256e1e(0x1c9);async['execute'](_0x2337c0){const _0x397283=a27_0x256e1e,{options:_0x23ac4d,args:_0x2d7135,tdx:_0x43b953}=_0x2337c0,_0x2156a7=_0x2d7135[0x0],_0x4b9af2=_0x23ac4d[_0x397283(0x150)];if(!_0x4b9af2)return console['error'](_0x397283(0x159)),console[_0x397283(0x1b3)](_0x397283(0x160)),0x1;const _0x38abbd=await withSpinner(_0x397283(0x1cd),()=>_0x43b953[_0x397283(0x1b8)][_0x397283(0x196)](_0x4b9af2),{'verbose':_0x23ac4d[_0x397283(0x12e)]}),_0x160804=_0x38abbd['data'];_0x23ac4d['verbose']&&(console[_0x397283(0x1b3)](_0x397283(0x181)+_0x4b9af2+'\x20(ID:\x20'+_0x160804+')'),_0x2156a7&&console[_0x397283(0x1b3)](_0x397283(0x132)+_0x2156a7));const _0x36cbd7=await withSpinner('Fetching\x20parent\x20segment...',()=>_0x43b953[_0x397283(0x1b8)][_0x397283(0x1d8)](_0x160804),{'verbose':_0x23ac4d[_0x397283(0x12e)]}),_0x423686=_0x36cbd7['data'],_0x4512a6=_0x423686[_0x397283(0x101)],_0x44e809=await withSpinner('Listing\x20journeys...',()=>_0x43b953[_0x397283(0x13b)][_0x397283(0xfd)](_0x160804,_0x4512a6),{'verbose':_0x23ac4d[_0x397283(0x12e)]});let _0x3adb02=_0x44e809[_0x397283(0x158)]['journeys'];const _0x46e591=_0x44e809['data'][_0x397283(0x17d)],_0xad5fdb=new Map();for(const _0x43908d of _0x46e591){_0xad5fdb[_0x397283(0x105)](_0x43908d['id'],_0x43908d['name']);}if(_0x2156a7){const _0x1667f2=globToRegex(_0x2156a7);_0x3adb02=_0x3adb02[_0x397283(0x170)](_0x1668ea=>_0x1667f2[_0x397283(0x1df)](_0x1668ea[_0x397283(0x183)]));}console['error']('✔\x20Found\x20'+_0x3adb02[_0x397283(0x1f6)]+_0x397283(0x12b)+(_0x3adb02['length']!==0x1?'s':''));const _0x90035d=_0x22069a=>{const _0x36a37d=_0x397283;return getConsoleNextUrl(_0x23ac4d[_0x36a37d(0x1c2)],_0x36a37d(0x15b)+_0x160804+_0x36a37d(0x11f)+_0x22069a+_0x36a37d(0x13c));};if(_0x23ac4d[_0x397283(0x1c7)]===_0x397283(0x1c5))await handleSDKOutput(_0x3adb02,_0x23ac4d);else{if(_0x23ac4d[_0x397283(0x1c7)]===_0x397283(0x1cc)){const _0x23909a=_0x3adb02[_0x397283(0x16e)](_0x568711=>({..._0x568711,'url':_0x90035d(_0x568711['id'])}));await handleSDKOutput(_0x23909a,_0x23ac4d);}else{console[_0x397283(0x157)]('['+_0x4b9af2+']');const _0x24bb89=new Map(),_0x5aa7a1=[];for(const _0x2505fc of _0x3adb02){if(!_0x2505fc[_0x397283(0x148)]||_0x2505fc[_0x397283(0x148)]===_0x4512a6)_0x5aa7a1[_0x397283(0x15f)](_0x2505fc);else{const _0x4496b1=_0x24bb89[_0x397283(0x1f8)](_0x2505fc[_0x397283(0x148)])||[];_0x4496b1[_0x397283(0x15f)](_0x2505fc),_0x24bb89[_0x397283(0x105)](_0x2505fc['folderId'],_0x4496b1);}}const _0x2faaf1=(_0xcbe65b,_0xea9eab)=>_0xcbe65b[_0x397283(0x183)]['localeCompare'](_0xea9eab['journeyBundleName'],undefined,{'sensitivity':_0x397283(0x1d9)});_0x5aa7a1[_0x397283(0x1ad)](_0x2faaf1);for(const _0x15b3d4 of _0x5aa7a1){console[_0x397283(0x157)](formatJourneyItem(_0x15b3d4,'',_0x90035d(_0x15b3d4['id'])));}const _0x39415a=[..._0x24bb89[_0x397283(0x185)]()]['sort']((_0xe8610d,_0x5c7167)=>{const _0x1cc74c=_0x397283,_0x8aec7b=_0xad5fdb[_0x1cc74c(0x1f8)](_0xe8610d[0x0])||_0xe8610d[0x0],_0x460a23=_0xad5fdb[_0x1cc74c(0x1f8)](_0x5c7167[0x0])||_0x5c7167[0x0];return _0x8aec7b[_0x1cc74c(0x1a0)](_0x460a23,undefined,{'sensitivity':_0x1cc74c(0x1d9)});});for(const [_0x4490e4,_0x564bee]of _0x39415a){const _0x4bc10f=_0xad5fdb[_0x397283(0x1f8)](_0x4490e4)||_0x4490e4;console[_0x397283(0x157)](_0x397283(0x19b)+_0x4bc10f),_0x564bee['sort'](_0x2faaf1);for(const _0xd0cc87 of _0x564bee){console[_0x397283(0x157)](formatJourneyItem(_0xd0cc87,'\x20\x20',_0x90035d(_0xd0cc87['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a27_0x256e1e(0x1e2)]='journey:view';[a27_0x256e1e(0x1f5)]=a27_0x256e1e(0x18a);async[a27_0x256e1e(0x18c)](_0x5bf5f0){const _0x4a22c1=a27_0x256e1e,{options:_0x424f84,args:_0x4b98c3,tdx:_0x5f0124}=_0x5bf5f0,_0x2ea55d=_0x4b98c3[0x0];if(!_0x2ea55d)return console[_0x4a22c1(0x1b3)](_0x4a22c1(0xf2)),console[_0x4a22c1(0x1b3)]('Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]'),console[_0x4a22c1(0x1b3)](_0x4a22c1(0x17e)),console[_0x4a22c1(0x1b3)](_0x4a22c1(0x165)),0x1;_0x424f84[_0x4a22c1(0x12e)]&&console[_0x4a22c1(0x1b3)](_0x4a22c1(0x1ac)+_0x2ea55d);const {journeyId:_0x1b55dd,parentSegmentId:_0x32bdc3}=await resolveJourneyIdFromInput(_0x2ea55d,_0x424f84,_0x5f0124);if(_0x424f84[_0x4a22c1(0xf9)]){const _0x596db9=getConsoleNextUrl(_0x424f84[_0x4a22c1(0x1c2)],'/app/ps/'+_0x32bdc3+_0x4a22c1(0x11f)+_0x1b55dd+_0x4a22c1(0x187));return console[_0x4a22c1(0x1b3)](a27_0x13d74a[_0x4a22c1(0x11a)]('✔')+_0x4a22c1(0x10f)+a27_0x13d74a['cyan'](_0x596db9)),openBrowser(_0x596db9),0x0;}const _0x4fed1b=await withSpinner(_0x4a22c1(0x19d),()=>_0x5f0124['journey']['getJourney'](_0x1b55dd),{'verbose':_0x424f84['verbose']}),_0x2fce78=_0x4fed1b[_0x4a22c1(0x158)],_0x13d047=_0x424f84[_0x4a22c1(0x186)];let _0x6b77d0;if(_0x13d047)try{const _0x2ae02a=await withSpinner('Getting\x20journey\x20statistics...',()=>_0x5f0124['journey'][_0x4a22c1(0x13a)](_0x1b55dd),{'verbose':_0x424f84['verbose']});_0x6b77d0=_0x2ae02a[_0x4a22c1(0x158)];}catch{_0x424f84[_0x4a22c1(0x12e)]&&console['error'](_0x4a22c1(0x173));}const _0x437ae=getConsoleNextUrl(_0x424f84[_0x4a22c1(0x1c2)],_0x4a22c1(0x15b)+_0x32bdc3+_0x4a22c1(0x11f)+_0x1b55dd+_0x4a22c1(0x187)),_0x390654={'id':_0x2fce78['id'],'name':_0x2fce78['attributes'][_0x4a22c1(0x1e2)],'description':_0x2fce78[_0x4a22c1(0xfb)][_0x4a22c1(0x1f5)],'state':_0x2fce78[_0x4a22c1(0xfb)][_0x4a22c1(0x188)],'paused':_0x2fce78[_0x4a22c1(0xfb)][_0x4a22c1(0x1c0)],'reentry_mode':_0x2fce78['attributes'][_0x4a22c1(0xee)],'stages':_0x2fce78['attributes'][_0x4a22c1(0x1ab)]?.[_0x4a22c1(0x1f6)]||0x0,..._0x2fce78['attributes'][_0x4a22c1(0x110)]&&{'goal':_0x2fce78['attributes'][_0x4a22c1(0x110)][_0x4a22c1(0x1e2)]},..._0x6b77d0&&{'statistics':{'size':_0x6b77d0[_0x4a22c1(0xf0)],'entered':_0x6b77d0[_0x4a22c1(0x10b)],'goal_achieved':_0x6b77d0[_0x4a22c1(0x169)],'completion_rate':_0x6b77d0[_0x4a22c1(0x1ed)],'exit_or_jump':_0x6b77d0[_0x4a22c1(0x15d)],'exit_or_jump_rate':_0x6b77d0[_0x4a22c1(0x1d4)],'stages':_0x6b77d0[_0x4a22c1(0x12c)]}},'url':_0x437ae};return await handleSingleObjectOutput(_0x390654,_0x424f84),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a27_0x256e1e(0x1e2)]=a27_0x256e1e(0x19e);[a27_0x256e1e(0x1f5)]=a27_0x256e1e(0x114);async['execute'](_0x2e423a){const _0x5ddf02=a27_0x256e1e,{options:_0x2cc0fb,args:_0x1c2af8,tdx:_0x4286e2}=_0x2e423a,_0x3eeff7=_0x1c2af8[0x0];if(!requireNameOrPath(_0x3eeff7))return 0x1;_0x2cc0fb[_0x5ddf02(0x12e)]&&console[_0x5ddf02(0x1b3)](_0x5ddf02(0x1ac)+_0x3eeff7);const _0x1a95d4=_0x2cc0fb,_0x403eb2=_0x1a95d4[_0x5ddf02(0x162)],_0x404d53=_0x1a95d4['to'],_0x15014d=_0x1a95d4['includeHistory'],_0x8cc70e=_0x1a95d4['stage'];_0x15014d&&!_0x403eb2&&!_0x404d53&&console[_0x5ddf02(0x1b3)](_0x5ddf02(0x136));const _0x411056=_0x15014d?withJsonFormat(_0x2cc0fb):_0x2cc0fb,{journeyId:_0x7d460e,journeyName:_0x58bda5}=await resolveJourneyIdFromInput(_0x3eeff7,_0x411056,_0x4286e2),_0x50bc11=_0x403eb2||_0x404d53?{'from':_0x403eb2,'to':_0x404d53}:undefined,_0x153f1e=await withSpinner('Getting\x20journey\x20statistics...',()=>Promise[_0x5ddf02(0x153)]([_0x4286e2['journey'][_0x5ddf02(0x164)](_0x7d460e),_0x4286e2[_0x5ddf02(0x13b)]['getStatistics'](_0x7d460e,_0x50bc11)]),{'verbose':_0x411056['verbose']}),[_0x2abbc7,_0x16dd8f]=_0x153f1e[_0x5ddf02(0x158)];if(!_0x16dd8f||_0x16dd8f[_0x5ddf02(0x123)]===null)return console[_0x5ddf02(0x1b3)](_0x5ddf02(0x1dc)+_0x58bda5),console[_0x5ddf02(0x1b3)](_0x5ddf02(0x1a6)),0x0;const _0x31ff62=buildStageNameMap(_0x2abbc7),_0xfc5286=!!(_0x50bc11&&_0x16dd8f[_0x5ddf02(0x124)]?.[_0x5ddf02(0x1f6)]),_0x3f3e3f={'stageNameMap':_0x31ff62,'hasPeriod':_0xfc5286,'includeHistory':!!_0x15014d};if(_0x8cc70e&&_0x16dd8f[_0x5ddf02(0x12c)]){const _0x47b85e=_0x16dd8f[_0x5ddf02(0x12c)][_0x5ddf02(0xf6)](_0x93fa01=>{const _0x32bbbb=_0x5ddf02,_0x1be7ab=_0x31ff62[_0x32bbbb(0x1f8)](_0x93fa01['id'])??'';return _0x1be7ab['toLowerCase']()===_0x8cc70e[_0x32bbbb(0xfc)]();});if(_0x47b85e)return await handleSingleObjectOutput(formatStageStats(_0x47b85e,_0x3f3e3f),_0x411056),0x0;const _0x312bc0=_0x16dd8f[_0x5ddf02(0x12c)][_0x5ddf02(0x16e)](_0x307fbe=>_0x31ff62[_0x5ddf02(0x1f8)](_0x307fbe['id'])??_0x307fbe['id']);return console[_0x5ddf02(0x1b3)](_0x5ddf02(0x1ba)+_0x8cc70e+'\x22\x20not\x20found'),console[_0x5ddf02(0x1b3)]('Available\x20stages:\x20'+_0x312bc0[_0x5ddf02(0x122)](',\x20')),0x1;}const _0x41e3ef=_0x16dd8f[_0x5ddf02(0x12c)]?.['map'](_0x50393a=>formatStageStats(_0x50393a,_0x3f3e3f)),_0x3651c4=assembleJourneyStats(_0x16dd8f,{'from':_0x403eb2,'to':_0x404d53,'includeHistory':_0x15014d});return await this['renderStats'](_0x3651c4,_0x41e3ef??[],_0x411056),0x0;}async[a27_0x256e1e(0x15e)](_0x333cb7,_0x2f3cdc,_0x22a9ad){const _0x2ef83f=a27_0x256e1e,_0x247e39=_0x22a9ad[_0x2ef83f(0x1c7)]===_0x2ef83f(0x1cc)||_0x22a9ad[_0x2ef83f(0x1c7)]==='jsonl'||_0x22a9ad['json']||_0x22a9ad['jsonl'];if(_0x247e39){_0x333cb7[_0x2ef83f(0x12c)]=_0x2f3cdc,await handleSingleObjectOutput(_0x333cb7,_0x22a9ad);return;}await handleSingleObjectOutput(_0x333cb7,_0x22a9ad);for(const _0x4a20cd of _0x2f3cdc){console[_0x2ef83f(0x157)](''),console['log'](String(a27_0x13d74a[_0x2ef83f(0x11d)]['bold']('['+_0x4a20cd['name']+']'))+a27_0x13d74a[_0x2ef83f(0x145)]('\x20'+_0x4a20cd['id']));const {id:_0x442135,name:_0x49b80c,..._0x1ad3ba}=_0x4a20cd;await handleSingleObjectOutput(_0x1ad3ba,_0x22a9ad);}}}export class JourneyTrafficCommand extends BaseCommand{[a27_0x256e1e(0x1e2)]=a27_0x256e1e(0x11e);[a27_0x256e1e(0x1f5)]=a27_0x256e1e(0x192);async[a27_0x256e1e(0x18c)](_0x185918){const _0x4d1fc8=a27_0x256e1e,{options:_0x551a03,args:_0x275af4,tdx:_0x403b33}=_0x185918,_0x4ce32e=_0x275af4[0x0];if(!requireNameOrPath(_0x4ce32e))return 0x1;_0x551a03['verbose']&&console[_0x4d1fc8(0x1b3)]('Input:\x20'+_0x4ce32e);const _0x260ba7=_0x551a03,_0x50bb4d=_0x260ba7[_0x4d1fc8(0x128)],_0x2abc0f=_0x260ba7[_0x4d1fc8(0x162)],_0x362e87=_0x260ba7['to'],_0x2b5ded=_0x260ba7[_0x4d1fc8(0x117)];if(_0x50bb4d&&_0x50bb4d!==_0x4d1fc8(0x108)&&_0x50bb4d!==_0x4d1fc8(0x143))return console[_0x4d1fc8(0x1b3)](_0x4d1fc8(0x113)+_0x50bb4d+_0x4d1fc8(0x1c4)),0x1;const _0x5e5ff4=withJsonFormat(_0x551a03),{journeyId:_0x356fbb,journeyName:_0x8edc3e}=await resolveJourneyIdFromInput(_0x4ce32e,_0x5e5ff4,_0x403b33),_0x4a5c88={'type':_0x50bb4d,'from':_0x2abc0f,'to':_0x362e87,'limit':_0x2b5ded},_0x498b71=await withSpinner(_0x4d1fc8(0x1bf),()=>_0x403b33[_0x4d1fc8(0x13b)][_0x4d1fc8(0x149)](_0x356fbb,_0x4a5c88),{'verbose':_0x5e5ff4[_0x4d1fc8(0x12e)]}),_0x4bcb38=_0x498b71['data'],_0x19edb7=_0x4bcb38[_0x4d1fc8(0x108)]&&(_0x4bcb38[_0x4d1fc8(0x108)][_0x4d1fc8(0x12a)][_0x4d1fc8(0x1f6)]>0x0||_0x4bcb38[_0x4d1fc8(0x108)]['links'][_0x4d1fc8(0x1f6)]>0x0),_0x2418bf=_0x4bcb38[_0x4d1fc8(0x143)]&&_0x4bcb38[_0x4d1fc8(0x143)][_0x4d1fc8(0x1f6)]>0x0;if(!_0x19edb7&&!_0x2418bf)return console[_0x4d1fc8(0x1b3)](_0x4d1fc8(0x1e3)+_0x8edc3e),console[_0x4d1fc8(0x1b3)](_0x4d1fc8(0x17f)),_0x2abc0f&&_0x362e87&&console['error'](_0x4d1fc8(0x15a)),0x0;return await handleSingleObjectOutput(_0x4bcb38,_0x5e5ff4),0x0;}}function formatStageStats(_0x501a80,_0x58a9e2){const _0x1b5fad=a27_0x256e1e,_0x55ecbf=_0x58a9e2[_0x1b5fad(0x10c)]&&_0x501a80[_0x1b5fad(0x124)]?.[_0x1b5fad(0x1f6)]?aggregateStageHistory(_0x501a80[_0x1b5fad(0x124)]):{'size':_0x501a80[_0x1b5fad(0xf0)],'entered':_0x501a80[_0x1b5fad(0x10b)],'milestone':_0x501a80[_0x1b5fad(0x177)],'milestone_rate':_0x501a80['completeMilestoneRate'],'exit_or_jump':_0x501a80[_0x1b5fad(0x15d)],'exit_or_jump_rate':_0x501a80[_0x1b5fad(0x1d4)]},_0x436ba9={'id':_0x501a80['id'],'name':_0x58a9e2[_0x1b5fad(0x1bd)][_0x1b5fad(0x1f8)](_0x501a80['id'])??_0x501a80['id'],..._0x55ecbf};return _0x58a9e2[_0x1b5fad(0x10c)]&&_0x58a9e2[_0x1b5fad(0x1aa)]&&_0x501a80['history']&&(_0x436ba9[_0x1b5fad(0x124)]=_0x501a80[_0x1b5fad(0x124)]),_0x436ba9;}export class JourneyPauseCommand extends BaseCommand{['name']='journey:pause';[a27_0x256e1e(0x1f5)]=a27_0x256e1e(0x191);async['execute'](_0x553b8e){const _0x11f950=a27_0x256e1e,{options:_0x46734a,args:_0x46b72d,tdx:_0x18aa95}=_0x553b8e,_0x3f2230=_0x46b72d[0x0];if(!requireNameOrPath(_0x3f2230))return 0x1;_0x46734a[_0x11f950(0x12e)]&&console['error']('Input:\x20'+_0x3f2230);const {journeyId:_0x2f422a,journeyName:_0x41d638}=await resolveJourneyIdFromInput(_0x3f2230,_0x46734a,_0x18aa95);if(!_0x46734a[_0x11f950(0x12f)]){const _0x16baf5=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22'+_0x41d638+'\x22?');if(!_0x16baf5)return console[_0x11f950(0x1b3)](_0x11f950(0x14a)),0x0;}const _0x4ac89a=await withSpinner('Pausing\x20journey...',()=>_0x18aa95[_0x11f950(0x13b)][_0x11f950(0x18b)](_0x2f422a),{'verbose':_0x46734a[_0x11f950(0x12e)]}),_0x1d05c7=_0x4ac89a[_0x11f950(0x158)];return console[_0x11f950(0x1b3)]('✔\x20Journey\x20\x22'+_0x1d05c7['attributes'][_0x11f950(0x1e2)]+_0x11f950(0x121)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a27_0x256e1e(0x1e2)]=a27_0x256e1e(0x184);[a27_0x256e1e(0x1f5)]=a27_0x256e1e(0x161);async[a27_0x256e1e(0x18c)](_0x506a86){const _0x1c3bb1=a27_0x256e1e,{options:_0x1127d8,args:_0x586297,tdx:_0x201ebc}=_0x506a86,_0x9886f4=_0x586297[0x0];if(!requireNameOrPath(_0x9886f4))return 0x1;_0x1127d8[_0x1c3bb1(0x12e)]&&console[_0x1c3bb1(0x1b3)]('Input:\x20'+_0x9886f4);const {journeyId:_0x34c7ff,journeyName:_0x3de335}=await resolveJourneyIdFromInput(_0x9886f4,_0x1127d8,_0x201ebc);if(!_0x1127d8[_0x1c3bb1(0x12f)]){const _0x182ab8=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22'+_0x3de335+'\x22?');if(!_0x182ab8)return console['error'](_0x1c3bb1(0x14a)),0x0;}const _0x1631f8=await withSpinner(_0x1c3bb1(0x1dd),()=>_0x201ebc[_0x1c3bb1(0x13b)][_0x1c3bb1(0x139)](_0x34c7ff),{'verbose':_0x1127d8[_0x1c3bb1(0x12e)]}),_0x3ec6be=_0x1631f8['data'];return console[_0x1c3bb1(0x1b3)](_0x1c3bb1(0x1af)+_0x3ec6be['attributes'][_0x1c3bb1(0x1e2)]+'\x22\x20resumed'),0x0;}}export class JourneyPullCommand extends BaseCommand{['name']=a27_0x256e1e(0x125);[a27_0x256e1e(0x1f5)]='Export\x20journey(s)\x20as\x20YAML\x20files';async['execute'](_0x2f0b85){const _0x29baf6=a27_0x256e1e,{options:_0xcbff53,args:_0x9a9aa0,tdx:_0x24f114}=_0x2f0b85,_0x4313c3=_0xcbff53,_0xc06bf5=_0x9a9aa0[0x0],_0x5a025a=_0xc06bf5&&isYamlFilePath(_0xc06bf5),_0x25b650=await resolveTarget({'arg':_0x5a025a?_0xc06bf5:undefined,'contextParent':_0xcbff53[_0x29baf6(0x150)],'cwd':process[_0x29baf6(0x12d)]()});if(!isSuccessfulResolution(_0x25b650))return _0x25b650[_0x29baf6(0x1f7)]===_0x29baf6(0x167)?(console['error'](a27_0x13d74a[_0x29baf6(0x119)](_0x29baf6(0x116))),console[_0x29baf6(0x1b3)](_0x29baf6(0x1ce)),console[_0x29baf6(0x1b3)](_0x29baf6(0x111)),console[_0x29baf6(0x1b3)](_0x29baf6(0x100)),console[_0x29baf6(0x1b3)]('\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')):(console['error'](a27_0x13d74a[_0x29baf6(0x1d2)](_0x29baf6(0x16c)+_0x25b650[_0x29baf6(0xff)]+'\x0a')),_0x25b650[_0x29baf6(0x1da)]&&console[_0x29baf6(0x1b3)](a27_0x13d74a['cyan'](_0x25b650[_0x29baf6(0x1da)]))),0x1;let _0x4f59b5=_0x5a025a?undefined:_0xc06bf5,_0x14c3db,_0x1ab195;_0x25b650[_0x29baf6(0x128)]===_0x29baf6(0x1f3)&&(_0x4f59b5=_0x25b650['resourceName'],_0x14c3db=_0x25b650[_0x29baf6(0x1bb)],_0x1ab195=_0x25b650['folderPath']);const _0x38017a=_0x25b650[_0x29baf6(0x178)],_0x3bff0f=_0x25b650[_0x29baf6(0x104)];_0x4313c3[_0x29baf6(0x12e)]&&(console['error'](_0x29baf6(0x181)+_0x38017a),console[_0x29baf6(0x1b3)]('Target\x20directory:\x20'+_0x3bff0f),_0x4f59b5&&console['error']('Journey\x20name:\x20'+_0x4f59b5),_0x14c3db&&console[_0x29baf6(0x1b3)]('Target\x20file:\x20'+_0x14c3db),_0x1ab195&&console[_0x29baf6(0x1b3)](_0x29baf6(0x1a4)+_0x1ab195));const _0xe005a4=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x24f114[_0x29baf6(0x1b8)][_0x29baf6(0x196)](_0x38017a),{'verbose':_0xcbff53['verbose']}),_0x1d1ffb=_0xe005a4[_0x29baf6(0x158)],{journeys:_0x450cfc,folders:_0x7394fa}=await withSpinner('Fetching\x20journeys\x20and\x20folders...',async()=>{const _0x12555c=_0x29baf6,[_0x19c308,_0x4f71e0]=await Promise[_0x12555c(0x153)]([_0x24f114[_0x12555c(0x13b)][_0x12555c(0x141)](_0x1d1ffb,undefined,{'includeAllVersions':!![]}),_0x24f114['segment'][_0x12555c(0x135)](_0x1d1ffb)]);return{'journeys':_0x19c308,'folders':_0x4f71e0};},{'verbose':_0xcbff53['verbose']})['then'](_0x4a66a7=>_0x4a66a7['data']);let _0x1a8aae=_0x450cfc;const _0x15756c=buildFolderIdToPathMap(_0x7394fa);if(_0x4f59b5){const _0xe13e6c=_0x1a8aae['filter'](_0x185284=>_0x185284[_0x29baf6(0x183)][_0x29baf6(0xfc)]()===_0x4f59b5['toLowerCase']());if(_0xe13e6c[_0x29baf6(0x1f6)]===0x0)return console[_0x29baf6(0x1b3)]('Error:\x20Journey\x20not\x20found:\x20'+_0x4f59b5),console[_0x29baf6(0x1b3)](_0x29baf6(0x163)),0x1;_0x1a8aae=_0xe13e6c;}if(_0x1ab195!==undefined){const _0x42e675=_0x1a8aae[_0x29baf6(0x170)](_0x3f0651=>{const _0x42d955=_0x29baf6,_0x421769=_0x3f0651[_0x42d955(0x148)]?_0x15756c[_0x42d955(0x1f8)](_0x3f0651['folderId'])||'':'';return _0x421769===_0x1ab195;});if(_0x42e675[_0x29baf6(0x1f6)]===0x0&&_0x1a8aae['length']>0x0){console[_0x29baf6(0x1b3)](_0x29baf6(0x130)+_0x4f59b5+_0x29baf6(0x18e)+(_0x1ab195||'root\x20folder')),console[_0x29baf6(0x1b3)](_0x29baf6(0x112));for(const _0x2696c9 of _0x1a8aae){const _0x100788=_0x2696c9[_0x29baf6(0x148)]?_0x15756c['get'](_0x2696c9[_0x29baf6(0x148)])||'':'';console[_0x29baf6(0x1b3)](_0x29baf6(0x16f)+(_0x100788||_0x29baf6(0x19a))+'/'+_0x2696c9[_0x29baf6(0x183)]);}return 0x1;}_0x1a8aae=_0x42e675;}if(_0x1a8aae[_0x29baf6(0x1f6)]===0x0)return console[_0x29baf6(0x1b3)]('No\x20journeys\x20found'),0x0;const _0x2e82a1=new Map();for(const _0x2ab94f of _0x1a8aae){const _0x30f358=_0x2ab94f[_0x29baf6(0x15c)];!_0x2e82a1['has'](_0x30f358)&&_0x2e82a1[_0x29baf6(0x105)](_0x30f358,[]),_0x2e82a1[_0x29baf6(0x1f8)](_0x30f358)[_0x29baf6(0x15f)](_0x2ab94f);}for(const _0x30402d of _0x2e82a1[_0x29baf6(0x193)]()){_0x30402d[_0x29baf6(0x1ad)]((_0x30fba1,_0x2026d1)=>(_0x30fba1['versionNumber']||0x0)-(_0x2026d1[_0x29baf6(0xfa)]||0x0));}const _0x285d05=[],{idToEmailMap:_0x21ee33,connectionIdToNameMap:_0x3adf3a}=await withSpinner(_0x29baf6(0x134),async()=>{const _0x159a54=_0x29baf6,[_0xf45ad7,_0x1dec96]=await Promise['all']([_0x24f114[_0x159a54(0x102)][_0x159a54(0x1cb)](),_0x24f114[_0x159a54(0x14e)]['buildIdToNameMap']()]);return{'idToEmailMap':_0xf45ad7,'connectionIdToNameMap':_0x1dec96};},{'verbose':_0xcbff53[_0x29baf6(0x12e)]})[_0x29baf6(0xf5)](_0x191eca=>_0x191eca[_0x29baf6(0x158)]);for(const _0x1b0827 of _0x2e82a1['values']()){const _0x1bb655=_0x1b0827[0x0][_0x29baf6(0x183)],_0x4ac73d=_0x1b0827[0x0][_0x29baf6(0x148)],_0x2dc094=_0x4ac73d?_0x15756c[_0x29baf6(0x1f8)](_0x4ac73d)||'':'',_0x2e71d7=_0x2dc094?a27_0x555498[_0x29baf6(0x122)](_0x3bff0f,_0x2dc094):_0x3bff0f,_0x554bec=_0x14c3db||a27_0x555498[_0x29baf6(0x122)](_0x2e71d7,sanitizeFileName(_0x1bb655)+_0x29baf6(0x1e8));let _0x63ce0b,_0x58439c;if(existsSync(_0x554bec))try{const _0x230781=readFileSync(_0x554bec,_0x29baf6(0x189)),_0x27f27e=parseYamlString(_0x230781);_0x58439c=_0x27f27e,_0x63ce0b=buildRuleToNameMapping(_0x27f27e),_0x4313c3[_0x29baf6(0x12e)]&&_0x63ce0b[_0x29baf6(0xf0)]>0x0&&console[_0x29baf6(0x1b3)](_0x29baf6(0x168)+_0x63ce0b[_0x29baf6(0xf0)]+_0x29baf6(0x1a3)+_0x1bb655);}catch(_0x4af506){_0x4313c3[_0x29baf6(0x12e)]&&console[_0x29baf6(0x1b3)](_0x29baf6(0x127)+_0x4af506[_0x29baf6(0xff)]);}const _0xedc798=[],_0x3b22e5=new Set(),_0xb7bffb=new Map(),_0x1e4641=new Map(),_0x3775f4=new Set(),_0x59d3e8=new Map(),_0x3baaa6=new Map(),_0x1b19b5=createJumpTargetCache();await withProgressSpinner(_0x29baf6(0x137)+_0x1bb655+_0x29baf6(0x13f),async _0x335406=>{const _0x15abfb=_0x29baf6;for(const _0x3655c5 of _0x1b0827){const _0x1a169b=_0x1b0827[_0x15abfb(0x1f6)]>0x1?_0x3655c5['journeyBundleName']+'\x20v'+(_0x3655c5['versionNumber']||0x1):_0x3655c5[_0x15abfb(0x183)];_0x335406['setPhase'](_0x15abfb(0x137)+_0x1a169b);const _0x22c29f=await _0x24f114[_0x15abfb(0x13b)][_0x15abfb(0x164)](_0x3655c5['id']),_0x58bda1=_0x22c29f[_0x15abfb(0xfb)]?.[_0x15abfb(0x144)],_0x4d78b1={'resolveSegment':async _0x190f6f=>{const _0x359aca=_0x15abfb;if(!_0x58bda1)return{'name':_0x190f6f,'isJourneyLocal':![]};const _0x5113ee=_0xb7bffb[_0x359aca(0x1f8)](_0x190f6f);if(_0x5113ee)return _0x5113ee;try{const _0x57e269=await _0x24f114['segment'][_0x359aca(0x133)](_0x58bda1,_0x190f6f),_0x15b291=_0x57e269['kind']===SEGMENT_KIND_JOURNEY;let _0x513987,_0x504f90=_0x57e269[_0x359aca(0x1e2)];if(_0x15b291&&_0x57e269[_0x359aca(0x19f)]){const _0x4c6f68=await segmentResponseToDef(_0x57e269,{'resolveSegmentName':async _0x3a6ab0=>{const _0x2a2315=_0x359aca,_0x1b045d=_0xb7bffb['get'](_0x3a6ab0);if(_0x1b045d)return _0x1b045d[_0x2a2315(0x1e2)];const _0x20e8d1=await _0x4d78b1[_0x2a2315(0x1a1)](_0x3a6ab0);return _0x20e8d1['name'];}}),_0x4c9791=_0x4c6f68[_0x359aca(0x19f)];_0x513987={'description':_0x57e269[_0x359aca(0x1f5)],'rule':_0x4c9791};const _0x890c3c=serializeRule(_0x4c9791),_0x1dcfd4=_0x1e4641[_0x359aca(0x1f8)](_0x890c3c);if(_0x1dcfd4)_0x504f90=_0x1dcfd4,_0x513987=undefined,_0x4313c3['verbose']&&console[_0x359aca(0x1b3)]('\x20\x20Consolidating\x20duplicate\x20segment:\x20'+_0x57e269[_0x359aca(0x1e2)]+_0x359aca(0x1c3)+_0x1dcfd4);else{let _0x189c34=![];if(_0x63ce0b){const _0x5341bc=_0x63ce0b[_0x359aca(0x1f8)](_0x890c3c);if(_0x5341bc){const _0x4b816c=_0x5341bc[_0x359aca(0xf6)](_0x1e5556=>!_0x3b22e5[_0x359aca(0x103)](_0x1e5556));_0x4b816c&&(_0x504f90=_0x4b816c,_0x3b22e5[_0x359aca(0x17b)](_0x4b816c),_0x1e4641[_0x359aca(0x105)](_0x890c3c,_0x4b816c),_0x189c34=!![],_0x4313c3[_0x359aca(0x12e)]&&console[_0x359aca(0x1b3)](_0x359aca(0x1f1)+_0x4b816c+_0x359aca(0x171)));}}if(!_0x189c34){const _0xf4661f=generateJourneyLocalName(_0x57e269[_0x359aca(0x1e2)]);_0xf4661f&&(_0x504f90=_0xf4661f);let _0x26f22f=_0x504f90,_0x24000c=0x2;while(_0x3b22e5[_0x359aca(0x103)](_0x26f22f)){_0x26f22f=_0x504f90+'_'+_0x24000c,_0x24000c++;}_0x3b22e5[_0x359aca(0x17b)](_0x26f22f),_0x1e4641[_0x359aca(0x105)](_0x890c3c,_0x26f22f),_0x504f90=_0x26f22f;}}}const _0x571dac={'name':_0x504f90,'isJourneyLocal':_0x15b291,'definition':_0x513987};return _0xb7bffb[_0x359aca(0x105)](_0x190f6f,_0x571dac),_0x571dac;}catch(_0x343346){return _0xcbff53[_0x359aca(0x12e)]&&console['error'](_0x359aca(0x166)+_0x190f6f+':\x20'+_0x343346['message']),{'name':_0x190f6f,'isJourneyLocal':![]};}},'resolveActivation':async _0x31cbbe=>{const _0xcfbe24=_0x15abfb,_0x2ec4b2=_0x59d3e8[_0xcfbe24(0x1f8)](_0x31cbbe);if(_0x2ec4b2)return _0x2ec4b2;try{const _0x4c5668=await _0x24f114[_0xcfbe24(0x13b)]['getActivation'](_0x3655c5['id'],_0x31cbbe),_0x3d9c25=journeyActivationStepToYaml(_0x4c5668,_0x21ee33,_0x3adf3a),_0x3744f7=JSON['stringify']({'name':_0x3d9c25[_0xcfbe24(0x1e2)],'connection':_0x3d9c25['connection'],'connector_config':_0x3d9c25[_0xcfbe24(0x18f)]}),_0xb01039=_0x3baaa6[_0xcfbe24(0x1f8)](_0x3744f7);if(_0xb01039){const _0x3b6ae1={'name':_0xb01039,'isJourneyLocal':!![],'definition':_0x3d9c25};return _0x59d3e8['set'](_0x31cbbe,_0x3b6ae1),_0x3b6ae1;}const _0x4a4b26=_0x4c5668[_0xcfbe24(0xfb)][_0xcfbe24(0x156)]['name']||_0x31cbbe,_0x1f46e1=sanitizeYamlKey(_0x4a4b26)||_0xcfbe24(0xfe)+_0x31cbbe;let _0x2e69fc=_0x1f46e1,_0x84187b=0x2;while(_0x3775f4[_0xcfbe24(0x103)](_0x2e69fc)){_0x2e69fc=_0x1f46e1+'_'+_0x84187b,_0x84187b++;}_0x3775f4[_0xcfbe24(0x17b)](_0x2e69fc),_0x3baaa6[_0xcfbe24(0x105)](_0x3744f7,_0x2e69fc);const _0x42fe9d={'name':_0x2e69fc,'isJourneyLocal':!![],'definition':_0x3d9c25};return _0x59d3e8[_0xcfbe24(0x105)](_0x31cbbe,_0x42fe9d),_0x42fe9d;}catch(_0x228e36){return _0xcbff53['verbose']&&console[_0xcfbe24(0x1b3)](_0xcfbe24(0xeb)+_0x31cbbe+':\x20'+_0x228e36[_0xcfbe24(0xff)]),{'name':_0x31cbbe,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x43119b,_0x415598)=>{const _0x101b07=_0x15abfb;return resolveJumpTarget(_0x43119b,_0x415598,_0x1b19b5,_0x3ec689=>_0x24f114[_0x101b07(0x13b)][_0x101b07(0x164)](_0x3ec689));}},_0x3a1526=await journeyResponseToDef(_0x22c29f,_0x4d78b1);_0xedc798[_0x15abfb(0x15f)]({'item':_0x3655c5,'yaml':_0x3a1526});}},{'verbose':_0xcbff53[_0x29baf6(0x12e)]});const _0x15eeea=await _0x24f114[_0x29baf6(0x13b)][_0x29baf6(0x1d0)](_0x1b0827[0x0][_0x29baf6(0x15c)]),_0x1ef79c=buildMergedJourneyDef(_0xedc798,_0x63ce0b,_0x15eeea),_0x5aed30=normalizeJourneyDef(_0x1ef79c,_0x58439c),_0x437d89=toYamlString(_0x5aed30),_0xbe085f=_0x14c3db||a27_0x555498[_0x29baf6(0x122)](_0x2e71d7,sanitizeFileName(_0x1bb655)+_0x29baf6(0x1e8));!_0x14c3db&&_0x2dc094&&!existsSync(_0x2e71d7)&&mkdirSync(_0x2e71d7,{'recursive':!![]});const _0xb40f9f=a27_0x555498[_0x29baf6(0x1b0)](process[_0x29baf6(0x12d)](),_0xbe085f);if(existsSync(_0xbe085f)){const _0x25cb51=readFileSync(_0xbe085f,_0x29baf6(0x189)),_0x1ace50=generateDiff(_0x25cb51,_0x437d89),_0x3a6e69=hasChanges(_0x1ace50);_0x285d05[_0x29baf6(0x15f)]({'relativePath':_0xb40f9f,'absolutePath':_0xbe085f,'content':_0x437d89,'isNew':![],'hasChanges':_0x3a6e69,'diff':_0x3a6e69?formatDiffWithColors(_0x1ace50):undefined});}else _0x285d05[_0x29baf6(0x15f)]({'relativePath':_0xb40f9f,'absolutePath':_0xbe085f,'content':_0x437d89,'isNew':!![],'hasChanges':![]});}const _0xaa376d=_0x285d05[_0x29baf6(0x170)](_0x14c51b=>_0x14c51b[_0x29baf6(0x11c)]),_0x18a951=_0x285d05[_0x29baf6(0x170)](_0x36a8ec=>!_0x36a8ec['isNew']&&_0x36a8ec[_0x29baf6(0x194)]),_0x221175=_0x285d05[_0x29baf6(0x170)](_0x1cf6e4=>!_0x1cf6e4[_0x29baf6(0x11c)]&&!_0x1cf6e4[_0x29baf6(0x194)]),_0x5b9115=_0x1a8aae['length'],_0x140068=_0x2e82a1['size'],_0x2d1737=_0x5b9115>_0x140068?'\x20('+_0x5b9115+'\x20versions)':'';console[_0x29baf6(0x1b3)](_0x29baf6(0x106)),console['error']('\x20\x20'+a27_0x13d74a[_0x29baf6(0x11d)](_0x140068+'\x20journeys')+a27_0x13d74a[_0x29baf6(0x145)](_0x2d1737)),console['error']('\x20\x20'+a27_0x13d74a[_0x29baf6(0x11a)]('+\x20'+_0xaa376d[_0x29baf6(0x1f6)]+_0x29baf6(0x1be))),console['error']('\x20\x20'+a27_0x13d74a[_0x29baf6(0x119)]('~\x20'+_0x18a951[_0x29baf6(0x1f6)]+_0x29baf6(0xf4))),console[_0x29baf6(0x1b3)]('\x20\x20'+a27_0x13d74a[_0x29baf6(0x145)]('=\x20'+_0x221175[_0x29baf6(0x1f6)]+_0x29baf6(0x1a9))),console[_0x29baf6(0x1b3)](_0x29baf6(0x182)+a27_0x13d74a['cyan'](_0x3bff0f)+'\x0a');if(_0x18a951['length']>0x0)for(const _0x5333ad of _0x18a951){console['error'](_0x29baf6(0x174)+_0x5333ad[_0x29baf6(0x17c)]+'\x27:'),console[_0x29baf6(0x1b3)]('─'['repeat'](0x3c)),console['error'](_0x5333ad[_0x29baf6(0x131)]),console[_0x29baf6(0x1b3)]('─'[_0x29baf6(0x1d6)](0x3c));}if(_0x4313c3[_0x29baf6(0x155)])return console[_0x29baf6(0x1b3)](a27_0x13d74a['yellow'](_0x29baf6(0xea))),0x0;if(_0xaa376d[_0x29baf6(0x1f6)]===0x0&&_0x18a951[_0x29baf6(0x1f6)]===0x0)return console[_0x29baf6(0x1b3)](a27_0x13d74a['green'](_0x29baf6(0x1bc))),saveSessionContext({'parent_segment':_0x38017a},_0x4313c3[_0x29baf6(0x1de)]),console[_0x29baf6(0x1b3)](a27_0x13d74a[_0x29baf6(0x11a)](_0x29baf6(0x1c8)+a27_0x13d74a[_0x29baf6(0x145)](_0x29baf6(0x126))+_0x29baf6(0x172)+a27_0x13d74a[_0x29baf6(0x11d)](_0x38017a))),0x0;if(!_0x4313c3[_0x29baf6(0x12f)]&&(_0xaa376d[_0x29baf6(0x1f6)]>0x0||_0x18a951['length']>0x0)){if(!isInteractive())return console[_0x29baf6(0x1b3)](a27_0x13d74a['red'](_0x29baf6(0x1a2)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x29baf6(0x1b3)](a27_0x13d74a['dim'](_0x29baf6(0x1f2))),0x1;const _0x358d6a=await confirmKey(_0x29baf6(0xed)+(_0xaa376d['length']+_0x18a951[_0x29baf6(0x1f6)])+'\x20files?');if(!_0x358d6a)return console['error'](a27_0x13d74a[_0x29baf6(0x119)](_0x29baf6(0x1c6)),_0x29baf6(0x1e4)),0x1;}!existsSync(_0x3bff0f)&&mkdirSync(_0x3bff0f,{'recursive':!![]});const _0x92a08d=a27_0x555498[_0x29baf6(0x122)](_0x3bff0f,_0x29baf6(0x10a));writeFileSync(_0x92a08d,createTdxConfigContent(_0x38017a),_0x29baf6(0x189));for(const _0x4cadea of _0x285d05){(_0x4cadea['isNew']||_0x4cadea[_0x29baf6(0x194)])&&writeFileSync(_0x4cadea[_0x29baf6(0x14c)],_0x4cadea['content'],_0x29baf6(0x189));}return console[_0x29baf6(0x1b3)](a27_0x13d74a[_0x29baf6(0x11a)]('✔\x20Pulled\x20'+(_0xaa376d[_0x29baf6(0x1f6)]+_0x18a951[_0x29baf6(0x1f6)])+'\x20journey\x20files\x20to\x20'+_0x3bff0f)),saveSessionContext({'parent_segment':_0x38017a},_0x4313c3[_0x29baf6(0x1de)]),console[_0x29baf6(0x1b3)](a27_0x13d74a[_0x29baf6(0x11a)](_0x29baf6(0x1c8)+a27_0x13d74a['dim'](_0x29baf6(0x126))+_0x29baf6(0x172)+a27_0x13d74a[_0x29baf6(0x11d)](_0x38017a))),0x0;}}export class JourneyColumnsCommand extends BaseCommand{['name']='journey:columns';[a27_0x256e1e(0x1f5)]=a27_0x256e1e(0x13e);async['execute'](_0x277d85){const _0x67f6d5=a27_0x256e1e,{options:_0x58580c,args:_0x2fe3cf,tdx:_0x4efcba}=_0x277d85,_0x37a9c3=_0x2fe3cf[0x0];if(!requireNameOrPath(_0x37a9c3))return 0x1;_0x58580c[_0x67f6d5(0x12e)]&&console['error'](_0x67f6d5(0x1ac)+_0x37a9c3);const {journeyId:_0x2f7d1f}=await resolveJourneyIdFromInput(_0x37a9c3,_0x58580c,_0x4efcba),_0x34669d=await withSpinner(_0x67f6d5(0x1b5),()=>_0x4efcba['journey'][_0x67f6d5(0x13d)](_0x2f7d1f),{'verbose':_0x58580c[_0x67f6d5(0x12e)]}),_0x3bcfc0=_0x34669d[_0x67f6d5(0x158)];return console[_0x67f6d5(0x157)](_0x67f6d5(0x120)+_0x3bcfc0[_0x67f6d5(0x17a)]),console[_0x67f6d5(0x157)](_0x67f6d5(0x199)+_0x3bcfc0[_0x67f6d5(0x1c5)]),await handleSDKOutput(_0x3bcfc0[_0x67f6d5(0x1e7)],_0x58580c),0x0;}}export class JourneyActivationsCommand extends BaseCommand{[a27_0x256e1e(0x1e2)]='journey:activations';[a27_0x256e1e(0x1f5)]='List\x20activations\x20for\x20a\x20journey';async[a27_0x256e1e(0x18c)](_0x479a6f){const _0x400b2c=a27_0x256e1e,{options:_0x17a890,args:_0x216298,tdx:_0x580abb}=_0x479a6f,_0x79ef2b=_0x216298[0x0];if(!requireNameOrPath(_0x79ef2b))return 0x1;_0x17a890['verbose']&&console[_0x400b2c(0x1b3)](_0x400b2c(0x1ac)+_0x79ef2b);const {journeyId:_0x2fe89f}=await resolveJourneyIdFromInput(_0x79ef2b,_0x17a890,_0x580abb),_0x4266f5=await withSpinner(_0x400b2c(0x1d1),()=>_0x580abb[_0x400b2c(0x13b)][_0x400b2c(0x107)](_0x2fe89f),{'verbose':_0x17a890[_0x400b2c(0x12e)]}),_0xeaed83=_0x4266f5[_0x400b2c(0x158)];return console[_0x400b2c(0x1b3)](_0x400b2c(0x168)+_0xeaed83['length']+'\x20activation'+(_0xeaed83['length']!==0x1?'s':'')),await handleSDKOutput(_0xeaed83,_0x17a890),0x0;}}export class JourneyPushCommand extends BaseCommand{[a27_0x256e1e(0x1e2)]=a27_0x256e1e(0x1ea);[a27_0x256e1e(0x1f5)]=a27_0x256e1e(0x129);[a27_0x256e1e(0x140)]=new SegmentPushCommand();async[a27_0x256e1e(0x18c)](_0x1da25c){const _0x4dc741=a27_0x256e1e,_0x157b40=_0x1da25c[_0x4dc741(0x1db)][0x0];let _0x38d498;if(_0x157b40){const _0xa79de9=await resolveTarget({'arg':_0x157b40,'contextParent':_0x1da25c['options']['parentSegment'],'cwd':process[_0x4dc741(0x12d)]()});isSuccessfulResolution(_0xa79de9)&&_0xa79de9['type']===_0x4dc741(0x1f3)&&(_0x38d498=_0xa79de9[_0x4dc741(0x1bb)]);}const _0x3f2878={..._0x1da25c,'options':{..._0x1da25c[_0x4dc741(0x18d)],'journeysOnly':!![],..._0x38d498&&{'singleFilePath':_0x38d498}}};return this[_0x4dc741(0x140)][_0x4dc741(0x18c)](_0x3f2878);}}export class JourneyVersionsCommand extends BaseCommand{[a27_0x256e1e(0x1e2)]=a27_0x256e1e(0x14d);['description']=a27_0x256e1e(0x14f);async[a27_0x256e1e(0x18c)](_0x580ea2){const _0x5418b0=a27_0x256e1e,{options:_0x4b3a8b,args:_0x53ef8c,tdx:_0x2730dc}=_0x580ea2,_0x171eb8=_0x53ef8c[0x0];if(!requireNameOrPath(_0x171eb8))return 0x1;if(_0x4b3a8b[_0x5418b0(0x12e)])console[_0x5418b0(0x1b3)](_0x5418b0(0x1ac)+_0x171eb8);const {journeyId:_0xf97d11}=await resolveJourneyIdFromInput(_0x171eb8,_0x4b3a8b,_0x2730dc),_0x49418c=await withSpinner('Listing\x20journey\x20versions...',()=>_0x2730dc[_0x5418b0(0x13b)][_0x5418b0(0x1b4)](_0xf97d11),{'verbose':_0x4b3a8b['verbose']}),{bundleName:_0x18af15,versions:_0x288581,latestJourneyId:_0x51b8c8}=_0x49418c['data'];console[_0x5418b0(0x1b3)](_0x18af15+':\x20'+_0x288581[_0x5418b0(0x1f6)]+_0x5418b0(0x1b9)+(_0x288581['length']!==0x1?'s':''));const _0x4a3cdc=_0x288581[_0x5418b0(0x16e)](_0x4201be=>({'version':_0x4201be['versionNumber'],'journey_id':_0x4201be[_0x5418b0(0x123)],'name':_0x4201be[_0x5418b0(0x1e2)],'state':_0x4201be[_0x5418b0(0x188)],'paused':_0x4201be[_0x5418b0(0x1c0)],'latest':_0x4201be[_0x5418b0(0x123)]===_0x51b8c8,'created_at':_0x4201be[_0x5418b0(0x16a)]}));return await handleSDKOutput(_0x4a3cdc,_0x4b3a8b),0x0;}}export class JourneyVersionCreateCommand extends BaseCommand{[a27_0x256e1e(0x1e2)]=a27_0x256e1e(0x142);[a27_0x256e1e(0x1f5)]=a27_0x256e1e(0x1ec);async['execute'](_0x31a132){const _0x9334f0=a27_0x256e1e,{options:_0x3cfd96,args:_0x53d543,tdx:_0x57243}=_0x31a132,_0x1345e6=_0x53d543[0x0];if(!requireNameOrPath(_0x1345e6))return 0x1;if(_0x3cfd96[_0x9334f0(0x12e)])console[_0x9334f0(0x1b3)](_0x9334f0(0x1ac)+_0x1345e6);const {journeyId:_0x205371,journeyName:_0xe4263a}=await resolveJourneyIdFromInput(_0x1345e6,_0x3cfd96,_0x57243);if(!_0x3cfd96['yes']){const _0x319c1f=await confirm(_0x9334f0(0x1f4)+_0xe4263a+'\x22?');if(!_0x319c1f)return console[_0x9334f0(0x1b3)](_0x9334f0(0x14a)),0x0;}const _0x5e0422=await withSpinner(_0x9334f0(0x151),()=>_0x57243[_0x9334f0(0x13b)]['createVersion'](_0x205371),{'verbose':_0x3cfd96['verbose']}),_0x597216=_0x5e0422[_0x9334f0(0x158)];return console['error'](a27_0x13d74a[_0x9334f0(0x11a)]('✔')+_0x9334f0(0x1a5)+_0x597216[_0x9334f0(0xfb)][_0x9334f0(0xfa)]+'\x20(draft)\x20—\x20\x22'+_0x597216['attributes'][_0x9334f0(0x1e2)]+'\x22'),console[_0x9334f0(0x1b3)](_0x9334f0(0xf7)+_0x597216['id']),await handleSingleObjectOutput({'id':_0x597216['id'],'name':_0x597216[_0x9334f0(0xfb)][_0x9334f0(0x1e2)],'version':_0x597216['attributes'][_0x9334f0(0xfa)],'state':_0x597216[_0x9334f0(0xfb)][_0x9334f0(0x188)],'bundle_id':_0x597216['attributes'][_0x9334f0(0x15c)],'created_at':_0x597216[_0x9334f0(0xfb)]['createdAt']},_0x3cfd96),0x0;}}export class JourneyVersionViewCommand extends BaseCommand{[a27_0x256e1e(0x1e2)]=a27_0x256e1e(0x118);[a27_0x256e1e(0x1f5)]=a27_0x256e1e(0x190);async[a27_0x256e1e(0x18c)](_0x330730){const _0x5b31a0=a27_0x256e1e,{options:_0x1f1c10,args:_0x589cea,tdx:_0x56b6b6}=_0x330730,_0x4d6200=_0x589cea[0x0];if(!requireNameOrPath(_0x4d6200))return 0x1;const _0x520a32=_0x1f1c10['version'];if(!_0x520a32)return console['error'](_0x5b31a0(0x109)),console['error'](_0x5b31a0(0xec)),0x1;const _0x31d75c=parseInt(_0x520a32,0xa);if(isNaN(_0x31d75c)||_0x31d75c<0x1)return console[_0x5b31a0(0x1b3)](_0x5b31a0(0x197)+_0x520a32),0x1;if(_0x1f1c10[_0x5b31a0(0x12e)])console['error'](_0x5b31a0(0x1ac)+_0x4d6200+_0x5b31a0(0x115)+_0x31d75c);const {journeyId:_0xb63c72,parentSegmentId:_0x5c846f}=await resolveJourneyIdFromInput(_0x4d6200,_0x1f1c10,_0x56b6b6),_0x2eac85=await withSpinner(_0x5b31a0(0x1eb),()=>_0x56b6b6[_0x5b31a0(0x13b)][_0x5b31a0(0x1b4)](_0xb63c72),{'verbose':_0x1f1c10['verbose']}),{versions:_0x4d6cf0,latestJourneyId:_0x3d4f7a}=_0x2eac85['data'],_0x574667=_0x4d6cf0[_0x5b31a0(0xf6)](_0x3adbe5=>_0x3adbe5[_0x5b31a0(0xfa)]===_0x31d75c);if(!_0x574667){const _0x56cd13=_0x4d6cf0[_0x5b31a0(0x16e)](_0x3edd90=>'v'+_0x3edd90['versionNumber'])[_0x5b31a0(0x122)](',\x20');return console['error']('Error:\x20Version\x20'+_0x31d75c+_0x5b31a0(0x1a8)+_0x56cd13),0x1;}const _0x17b0e6=await withSpinner(_0x5b31a0(0x1ef)+_0x31d75c+'\x20details...',()=>_0x56b6b6['journey'][_0x5b31a0(0x164)](_0x574667[_0x5b31a0(0x123)]),{'verbose':_0x1f1c10['verbose']}),_0x28c22f=_0x17b0e6[_0x5b31a0(0x158)],_0x3d85dd=getConsoleNextUrl(_0x1f1c10[_0x5b31a0(0x1c2)],_0x5b31a0(0x15b)+_0x5c846f+'/e/'+_0x574667[_0x5b31a0(0x123)]+_0x5b31a0(0x187));return await handleSingleObjectOutput({'id':_0x28c22f['id'],'name':_0x28c22f[_0x5b31a0(0xfb)]['name'],'version':_0x28c22f[_0x5b31a0(0xfb)][_0x5b31a0(0xfa)],'description':_0x28c22f[_0x5b31a0(0xfb)][_0x5b31a0(0x1f5)],'state':_0x28c22f['attributes'][_0x5b31a0(0x188)],'paused':_0x28c22f[_0x5b31a0(0xfb)][_0x5b31a0(0x1c0)],'reentry_mode':_0x28c22f[_0x5b31a0(0xfb)][_0x5b31a0(0xee)],'stages':_0x28c22f[_0x5b31a0(0xfb)][_0x5b31a0(0x1ab)]?.['length']||0x0,..._0x28c22f['attributes'][_0x5b31a0(0x110)]&&{'goal':_0x28c22f[_0x5b31a0(0xfb)][_0x5b31a0(0x110)][_0x5b31a0(0x1e2)]},'latest':_0x574667[_0x5b31a0(0x123)]===_0x3d4f7a,'created_at':_0x28c22f[_0x5b31a0(0xfb)][_0x5b31a0(0x16a)],'updated_at':_0x28c22f[_0x5b31a0(0xfb)][_0x5b31a0(0x179)],'url':_0x3d85dd},_0x1f1c10),0x0;}}
@@ -1 +1 @@
1
- function a28_0x39a4(_0xe3671d,_0x22e0c6){_0xe3671d=_0xe3671d-0x76;const _0x4a84fb=a28_0x4a84();let _0x39a469=_0x4a84fb[_0xe3671d];return _0x39a469;}function a28_0x4a84(){const _0x5991e2=['2682WKwxCT','Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','3320MBuhWt','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','\x20(skipped:\x20','\x20segment\x20file(s)\x20skipped)','warningCount','skippedCount','2190gFHCCd','18oewlHp','\x20segment\x20file(s)\x20skipped','targetDir','parentSegment','red','length','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','hasErrors','1382695DmeaaQ','error','filter','No\x20journey\x20YAML\x20files\x20found\x20in\x20','dim','invalidCount','\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','validCount','log','53505ALhJBP','journey','execute','warnings','53027SLfJiN','yellow','errors','helpText','Error:\x20','Validation\x20failed:\x20','journey:validate','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','\x20warning(s)\x20found','.yml','861kwWoso','file','\x20warning(s)','name','\x20error(s)','1416MkYxtA','reason','12972663zdchql','\x20journey(s)\x20with\x20errors,\x20','green','cwd','cyan','\x20valid','4092PUMiMb','verbose','3303UHnbjy','filePath','Validate\x20journey\x20YAML\x20files','9170jTCqiR','\x20journey(s)\x20valid','errorCode'];a28_0x4a84=function(){return _0x5991e2;};return a28_0x4a84();}const a28_0x1bc89a=a28_0x39a4;(function(_0x3f6a51,_0x79e127){const _0x9983c8=a28_0x39a4,_0x214695=_0x3f6a51();while(!![]){try{const _0x34d51c=parseInt(_0x9983c8(0xa4))/0x1*(parseInt(_0x9983c8(0x7c))/0x2)+-parseInt(_0x9983c8(0x76))/0x3*(-parseInt(_0x9983c8(0xb1))/0x4)+parseInt(_0x9983c8(0x8d))/0x5*(parseInt(_0x9983c8(0x85))/0x6)+-parseInt(_0x9983c8(0x79))/0x7*(-parseInt(_0x9983c8(0x7e))/0x8)+-parseInt(_0x9983c8(0x96))/0x9*(parseInt(_0x9983c8(0x84))/0xa)+-parseInt(_0x9983c8(0xab))/0xb+-parseInt(_0x9983c8(0xa9))/0xc*(parseInt(_0x9983c8(0x9a))/0xd);if(_0x34d51c===_0x79e127)break;else _0x214695['push'](_0x214695['shift']());}catch(_0x17d715){_0x214695['push'](_0x214695['shift']());}}}(a28_0x4a84,0xa8d7d));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 a28_0x263e70 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{[a28_0x1bc89a(0xa7)]=a28_0x1bc89a(0xa0);['description']=a28_0x1bc89a(0x78);async[a28_0x1bc89a(0x98)](_0x193bd6){const _0x3ae007=a28_0x1bc89a,{options:_0x5d54cc,args:_0x9214ae}=_0x193bd6,_0x3cd71e=_0x5d54cc,_0x2e317e=await resolveTarget({'arg':_0x9214ae[0x0],'contextParent':_0x5d54cc[_0x3ae007(0x88)],'cwd':process[_0x3ae007(0xae)]()});if(!isSuccessfulResolution(_0x2e317e))return _0x2e317e[_0x3ae007(0x7b)]==='no_parent'?(console[_0x3ae007(0x8e)](a28_0x263e70['yellow'](_0x3ae007(0x8b))),console[_0x3ae007(0x8e)](_0x3ae007(0x7d)),console[_0x3ae007(0x8e)](_0x3ae007(0x93)),console['error'](_0x3ae007(0x7f))):(console[_0x3ae007(0x8e)](a28_0x263e70[_0x3ae007(0x89)](_0x3ae007(0x9e)+_0x2e317e['message']+'\x0a')),_0x2e317e[_0x3ae007(0x9d)]&&console['error'](a28_0x263e70[_0x3ae007(0xaf)](_0x2e317e['helpText']))),0x1;const _0x85b5bc=_0x2e317e[_0x3ae007(0x87)],_0x6b3c76=_0x2e317e['type']===_0x3ae007(0xa5)?_0x2e317e[_0x3ae007(0x77)]:undefined;if(!_0x6b3c76&&!existsSync(_0x85b5bc))return console[_0x3ae007(0x8e)](a28_0x263e70[_0x3ae007(0x89)]('Error:\x20Directory\x20not\x20found:\x20'+_0x85b5bc+'\x0a')),0x1;let _0x4f8d9;if(_0x6b3c76){if(!_0x6b3c76['endsWith'](_0x3ae007(0xa3))&&!_0x6b3c76['endsWith']('.yaml'))return console['error'](a28_0x263e70[_0x3ae007(0x89)](_0x3ae007(0xa1)+_0x6b3c76+'\x0a')),0x1;_0x4f8d9=[_0x6b3c76];}else _0x4f8d9=findYamlFiles(_0x85b5bc);if(_0x4f8d9[_0x3ae007(0x8a)]===0x0)return console['error'](a28_0x263e70[_0x3ae007(0x89)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x85b5bc+'\x0a')),0x1;const _0x58d48d=validateYamlFiles(_0x4f8d9,_0x85b5bc,{'filterType':_0x3ae007(0x97)}),_0x8f8291=calculateSummary(_0x58d48d),_0x79e420=_0x58d48d[_0x3ae007(0x8f)](isValidationResult);if(_0x79e420[_0x3ae007(0x8a)]===0x0)return console['error'](a28_0x263e70[_0x3ae007(0x9b)](_0x3ae007(0x90)+_0x85b5bc+'\x0a')),_0x8f8291[_0x3ae007(0x83)]>0x0&&console[_0x3ae007(0x8e)](a28_0x263e70[_0x3ae007(0x91)]('('+_0x8f8291[_0x3ae007(0x83)]+_0x3ae007(0x81))),0x0;for(const _0x46593f of _0x58d48d){if(!isValidationResult(_0x46593f)){_0x3cd71e[_0x3ae007(0xb2)]&&console[_0x3ae007(0x95)](a28_0x263e70[_0x3ae007(0x91)]('-\x20'+_0x46593f['relativePath']+_0x3ae007(0x80)+_0x46593f[_0x3ae007(0xaa)]+')'));continue;}const {relativePath:_0x395415,source:_0x2c369c,result:_0x541950}=_0x46593f;if(_0x541950['valid']&&_0x541950['warnings']['length']===0x0)_0x3cd71e['verbose']&&console[_0x3ae007(0x95)](a28_0x263e70[_0x3ae007(0xad)]('✔\x20'+_0x395415));else _0x541950['valid']?(console[_0x3ae007(0x95)](a28_0x263e70[_0x3ae007(0x9b)]('⚠\x20'+_0x395415+':\x20'+_0x541950[_0x3ae007(0x99)][_0x3ae007(0x8a)]+_0x3ae007(0xa6))),console[_0x3ae007(0x95)](formatValidationResult(_0x541950,_0x2c369c,_0x395415))):(console[_0x3ae007(0x95)](a28_0x263e70[_0x3ae007(0x89)]('✖\x20'+_0x395415+':\x20'+_0x541950[_0x3ae007(0x9c)][_0x3ae007(0x8a)]+_0x3ae007(0xa8))),console['log'](formatValidationResult(_0x541950,_0x2c369c,_0x395415)));}return console[_0x3ae007(0x95)](''),_0x8f8291[_0x3ae007(0x8c)]?(console[_0x3ae007(0x95)](a28_0x263e70[_0x3ae007(0x89)](_0x3ae007(0x9f)+_0x8f8291[_0x3ae007(0x92)]+_0x3ae007(0xac)+_0x8f8291[_0x3ae007(0x94)]+_0x3ae007(0xb0))),_0x8f8291[_0x3ae007(0x82)]>0x0&&console['log'](a28_0x263e70[_0x3ae007(0x9b)](_0x8f8291['warningCount']+_0x3ae007(0xa2))),_0x8f8291[_0x3ae007(0x83)]>0x0&&console[_0x3ae007(0x95)](a28_0x263e70[_0x3ae007(0x91)](_0x8f8291[_0x3ae007(0x83)]+_0x3ae007(0x86))),0x1):(console['log'](a28_0x263e70['green']('✔\x20All\x20'+_0x8f8291['validCount']+_0x3ae007(0x7a))),_0x8f8291[_0x3ae007(0x82)]>0x0&&console['log'](a28_0x263e70[_0x3ae007(0x9b)](_0x8f8291[_0x3ae007(0x82)]+_0x3ae007(0xa2))),_0x8f8291[_0x3ae007(0x83)]>0x0&&console[_0x3ae007(0x95)](a28_0x263e70[_0x3ae007(0x91)](_0x8f8291[_0x3ae007(0x83)]+_0x3ae007(0x86))),0x0);}}
1
+ const a28_0x572800=a28_0x14c7;(function(_0x94ea37,_0x3105e9){const _0x5690cd=a28_0x14c7,_0x41ec2=_0x94ea37();while(!![]){try{const _0x16927e=-parseInt(_0x5690cd(0x172))/0x1*(-parseInt(_0x5690cd(0x168))/0x2)+parseInt(_0x5690cd(0x142))/0x3+parseInt(_0x5690cd(0x15c))/0x4+parseInt(_0x5690cd(0x169))/0x5*(parseInt(_0x5690cd(0x14e))/0x6)+-parseInt(_0x5690cd(0x141))/0x7+-parseInt(_0x5690cd(0x173))/0x8*(parseInt(_0x5690cd(0x14b))/0x9)+-parseInt(_0x5690cd(0x156))/0xa*(parseInt(_0x5690cd(0x14f))/0xb);if(_0x16927e===_0x3105e9)break;else _0x41ec2['push'](_0x41ec2['shift']());}catch(_0x3f0dea){_0x41ec2['push'](_0x41ec2['shift']());}}}(a28_0x3db0,0xecb13));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';function a28_0x3db0(){const _0x32afdd=['reason','errorCode','5920530cyIYeR','1497618wsxIZV','validCount','Error:\x20','parentSegment','\x20journey(s)\x20with\x20errors,\x20','verbose','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','\x20segment\x20file(s)\x20skipped','yellow','5985cKkJiK','helpText','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','57234btnLUB','393635UVERhk','.yaml','no_parent','errors','\x20valid','invalidCount','execute','380BEPpSM','valid','dim','cyan','description','\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','3778140UXgeNT','Validation\x20failed:\x20','skippedCount','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','endsWith','.yml','name','length','log','warningCount','relativePath','message','194162PCkPkk','70YeUiOu','\x20segment\x20file(s)\x20skipped)','journey:validate','green','\x20warning(s)\x20found','red','\x20warning(s)','\x20(skipped:\x20','\x20journey(s)\x20valid','19RoGGHZ','2968BRAOAx','Validate\x20journey\x20YAML\x20files','error','hasErrors'];a28_0x3db0=function(){return _0x32afdd;};return a28_0x3db0();}function a28_0x14c7(_0x4552d4,_0x224f25){_0x4552d4=_0x4552d4-0x140;const _0x3db0aa=a28_0x3db0();let _0x14c70c=_0x3db0aa[_0x4552d4];return _0x14c70c;}import a28_0x5d46ac 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{[a28_0x572800(0x162)]=a28_0x572800(0x16b);[a28_0x572800(0x15a)]=a28_0x572800(0x174);async[a28_0x572800(0x155)](_0x281705){const _0x42d217=a28_0x572800,{options:_0x38488d,args:_0x17d7ad}=_0x281705,_0x2fe754=_0x38488d,_0x57041f=await resolveTarget({'arg':_0x17d7ad[0x0],'contextParent':_0x38488d[_0x42d217(0x145)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x57041f))return _0x57041f[_0x42d217(0x140)]===_0x42d217(0x151)?(console[_0x42d217(0x175)](a28_0x5d46ac[_0x42d217(0x14a)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x42d217(0x175)]('Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)'),console['error'](_0x42d217(0x15b)),console[_0x42d217(0x175)](_0x42d217(0x148))):(console[_0x42d217(0x175)](a28_0x5d46ac[_0x42d217(0x16e)](_0x42d217(0x144)+_0x57041f[_0x42d217(0x167)]+'\x0a')),_0x57041f[_0x42d217(0x14c)]&&console[_0x42d217(0x175)](a28_0x5d46ac[_0x42d217(0x159)](_0x57041f[_0x42d217(0x14c)]))),0x1;const _0x1af4a8=_0x57041f['targetDir'],_0xf12747=_0x57041f['type']==='file'?_0x57041f['filePath']:undefined;if(!_0xf12747&&!existsSync(_0x1af4a8))return console['error'](a28_0x5d46ac[_0x42d217(0x16e)]('Error:\x20Directory\x20not\x20found:\x20'+_0x1af4a8+'\x0a')),0x1;let _0x5d8f85;if(_0xf12747){if(!_0xf12747[_0x42d217(0x160)](_0x42d217(0x161))&&!_0xf12747[_0x42d217(0x160)](_0x42d217(0x150)))return console[_0x42d217(0x175)](a28_0x5d46ac[_0x42d217(0x16e)](_0x42d217(0x15f)+_0xf12747+'\x0a')),0x1;_0x5d8f85=[_0xf12747];}else _0x5d8f85=findYamlFiles(_0x1af4a8);if(_0x5d8f85[_0x42d217(0x163)]===0x0)return console[_0x42d217(0x175)](a28_0x5d46ac['red'](_0x42d217(0x14d)+_0x1af4a8+'\x0a')),0x1;const _0x43475d=validateYamlFiles(_0x5d8f85,_0x1af4a8,{'filterType':'journey'}),_0x1ced2b=calculateSummary(_0x43475d),_0x3b603f=_0x43475d['filter'](isValidationResult);if(_0x3b603f[_0x42d217(0x163)]===0x0)return console['error'](a28_0x5d46ac['yellow']('No\x20journey\x20YAML\x20files\x20found\x20in\x20'+_0x1af4a8+'\x0a')),_0x1ced2b[_0x42d217(0x15e)]>0x0&&console[_0x42d217(0x175)](a28_0x5d46ac[_0x42d217(0x158)]('('+_0x1ced2b[_0x42d217(0x15e)]+_0x42d217(0x16a))),0x0;for(const _0x3b78e3 of _0x43475d){if(!isValidationResult(_0x3b78e3)){_0x2fe754['verbose']&&console[_0x42d217(0x164)](a28_0x5d46ac['dim']('-\x20'+_0x3b78e3[_0x42d217(0x166)]+_0x42d217(0x170)+_0x3b78e3[_0x42d217(0x177)]+')'));continue;}const {relativePath:_0x589e05,source:_0xf3ca9a,result:_0x4da0ac}=_0x3b78e3;if(_0x4da0ac[_0x42d217(0x157)]&&_0x4da0ac['warnings'][_0x42d217(0x163)]===0x0)_0x2fe754[_0x42d217(0x147)]&&console[_0x42d217(0x164)](a28_0x5d46ac[_0x42d217(0x16c)]('✔\x20'+_0x589e05));else _0x4da0ac['valid']?(console[_0x42d217(0x164)](a28_0x5d46ac[_0x42d217(0x14a)]('⚠\x20'+_0x589e05+':\x20'+_0x4da0ac['warnings'][_0x42d217(0x163)]+_0x42d217(0x16f))),console[_0x42d217(0x164)](formatValidationResult(_0x4da0ac,_0xf3ca9a,_0x589e05))):(console[_0x42d217(0x164)](a28_0x5d46ac[_0x42d217(0x16e)]('✖\x20'+_0x589e05+':\x20'+_0x4da0ac[_0x42d217(0x152)][_0x42d217(0x163)]+'\x20error(s)')),console['log'](formatValidationResult(_0x4da0ac,_0xf3ca9a,_0x589e05)));}return console['log'](''),_0x1ced2b[_0x42d217(0x176)]?(console[_0x42d217(0x164)](a28_0x5d46ac[_0x42d217(0x16e)](_0x42d217(0x15d)+_0x1ced2b[_0x42d217(0x154)]+_0x42d217(0x146)+_0x1ced2b[_0x42d217(0x143)]+_0x42d217(0x153))),_0x1ced2b[_0x42d217(0x165)]>0x0&&console['log'](a28_0x5d46ac[_0x42d217(0x14a)](_0x1ced2b[_0x42d217(0x165)]+_0x42d217(0x16d))),_0x1ced2b[_0x42d217(0x15e)]>0x0&&console[_0x42d217(0x164)](a28_0x5d46ac[_0x42d217(0x158)](_0x1ced2b['skippedCount']+'\x20segment\x20file(s)\x20skipped')),0x1):(console['log'](a28_0x5d46ac[_0x42d217(0x16c)]('✔\x20All\x20'+_0x1ced2b['validCount']+_0x42d217(0x171))),_0x1ced2b[_0x42d217(0x165)]>0x0&&console[_0x42d217(0x164)](a28_0x5d46ac[_0x42d217(0x14a)](_0x1ced2b[_0x42d217(0x165)]+_0x42d217(0x16d))),_0x1ced2b[_0x42d217(0x15e)]>0x0&&console[_0x42d217(0x164)](a28_0x5d46ac[_0x42d217(0x158)](_0x1ced2b[_0x42d217(0x15e)]+_0x42d217(0x149))),0x0);}}