@treasuredata/tdx 2026.3.50 β†’ 2026.3.51

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 (228) 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.d.ts.map +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-command.js.map +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/connection-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-command.js +1 -1
  27. package/dist/commands/engage-template-pull-command.js +1 -1
  28. package/dist/commands/engage-template-push-command.js +1 -1
  29. package/dist/commands/engage-template-validate-command.js +1 -1
  30. package/dist/commands/job-command.js +1 -1
  31. package/dist/commands/journey-command.js +1 -1
  32. package/dist/commands/journey-validate-command.js +1 -1
  33. package/dist/commands/llm-command.js +1 -1
  34. package/dist/commands/mcp-command.js +1 -1
  35. package/dist/commands/parent-segment-command.js +1 -1
  36. package/dist/commands/policy-command.js +1 -1
  37. package/dist/commands/profile-command.js +1 -1
  38. package/dist/commands/profiles-command.js +1 -1
  39. package/dist/commands/query-command.js +1 -1
  40. package/dist/commands/schedule-command.js +1 -1
  41. package/dist/commands/segment-command.js +1 -1
  42. package/dist/commands/segment-create-command.js +1 -1
  43. package/dist/commands/segment-fields-command.js +1 -1
  44. package/dist/commands/segment-pull-command.js +1 -1
  45. package/dist/commands/segment-push-command.js +1 -1
  46. package/dist/commands/segment-update-command.js +1 -1
  47. package/dist/commands/segment-use-command.js +1 -1
  48. package/dist/commands/segment-validate-command.js +1 -1
  49. package/dist/commands/segments.js +1 -1
  50. package/dist/commands/show.js +1 -1
  51. package/dist/commands/status-command.js +1 -1
  52. package/dist/commands/tables.js +1 -1
  53. package/dist/commands/unset-command.js +1 -1
  54. package/dist/commands/upgrade-command.js +1 -1
  55. package/dist/commands/use-command.js +1 -1
  56. package/dist/commands/user-command.js +1 -1
  57. package/dist/commands/work-command.js +1 -1
  58. package/dist/commands/workflow-command.js +1 -1
  59. package/dist/core/auth.js +1 -1
  60. package/dist/core/command-output.js +1 -1
  61. package/dist/core/config.js +1 -1
  62. package/dist/core/connection-cache.js +1 -1
  63. package/dist/core/constants.js +1 -1
  64. package/dist/core/credential-cache.js +1 -1
  65. package/dist/core/global-context.d.ts.map +1 -1
  66. package/dist/core/global-context.js +1 -1
  67. package/dist/core/global-context.js.map +1 -1
  68. package/dist/core/keychain.js +1 -1
  69. package/dist/core/oauth-keychain.js +1 -1
  70. package/dist/core/oauth.d.ts +1 -0
  71. package/dist/core/oauth.d.ts.map +1 -1
  72. package/dist/core/oauth.js +1 -1
  73. package/dist/core/oauth.js.map +1 -1
  74. package/dist/core/profile.js +1 -1
  75. package/dist/core/project-config.js +1 -1
  76. package/dist/core/session.js +1 -1
  77. package/dist/core/user-cache.js +1 -1
  78. package/dist/core/version.js +1 -1
  79. package/dist/index.js +1 -1
  80. package/dist/mcp/server.js +1 -1
  81. package/dist/mcp/tools/index.js +1 -1
  82. package/dist/mcp/tools/tdx-run.js +1 -1
  83. package/dist/mcp/tools/tdx-search.js +1 -1
  84. package/dist/mcp/utils.js +1 -1
  85. package/dist/proxy/claude-usage-tracker.js +1 -1
  86. package/dist/proxy/passthrough-server.d.ts +21 -4
  87. package/dist/proxy/passthrough-server.d.ts.map +1 -1
  88. package/dist/proxy/passthrough-server.js +1 -1
  89. package/dist/proxy/passthrough-server.js.map +1 -1
  90. package/dist/proxy/sse-usage-parser.js +1 -1
  91. package/dist/sdk/agent/agent-config.js +1 -1
  92. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  93. package/dist/sdk/agent/agent-yaml.js +1 -1
  94. package/dist/sdk/agent/test/evaluator.js +1 -1
  95. package/dist/sdk/agent/test/executor.js +1 -1
  96. package/dist/sdk/agent/test/index.js +1 -1
  97. package/dist/sdk/agent/test/output.js +1 -1
  98. package/dist/sdk/agent/test/parser.js +1 -1
  99. package/dist/sdk/agent/tool-target-registry.js +1 -1
  100. package/dist/sdk/api.js +1 -1
  101. package/dist/sdk/cas/cas-api-client.js +1 -1
  102. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  103. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  104. package/dist/sdk/cas/index.js +1 -1
  105. package/dist/sdk/cas/pull-workflow.js +1 -1
  106. package/dist/sdk/cas/push-workflow.js +1 -1
  107. package/dist/sdk/client/cdp-api-client.js +1 -1
  108. package/dist/sdk/client/delivery-api-client.js +1 -1
  109. package/dist/sdk/client/endpoints.js +1 -1
  110. package/dist/sdk/client/engage-api-client.js +1 -1
  111. package/dist/sdk/client/http-client.js +1 -1
  112. package/dist/sdk/client/llm-api-client.js +1 -1
  113. package/dist/sdk/client/oauth-refresh.js +1 -1
  114. package/dist/sdk/client/rate-limiter.js +1 -1
  115. package/dist/sdk/client/td-api-client.js +1 -1
  116. package/dist/sdk/client/trino-api-client.js +1 -1
  117. package/dist/sdk/client/workflow-client.js +1 -1
  118. package/dist/sdk/connection-validator.js +1 -1
  119. package/dist/sdk/connection.js +1 -1
  120. package/dist/sdk/delivery.js +1 -1
  121. package/dist/sdk/engage/campaign-pull.js +1 -1
  122. package/dist/sdk/engage/campaign-push.js +1 -1
  123. package/dist/sdk/engage/campaign-validator.js +1 -1
  124. package/dist/sdk/engage/campaign-yaml.js +1 -1
  125. package/dist/sdk/engage/template-pull.js +1 -1
  126. package/dist/sdk/engage/template-push.js +1 -1
  127. package/dist/sdk/engage/template-validator.js +1 -1
  128. package/dist/sdk/engage/template-yaml.js +1 -1
  129. package/dist/sdk/engage/types/campaign-def.js +1 -1
  130. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  131. package/dist/sdk/engage/types/template-schema.js +1 -1
  132. package/dist/sdk/engage.js +1 -1
  133. package/dist/sdk/errors.js +1 -1
  134. package/dist/sdk/index.js +1 -1
  135. package/dist/sdk/io/index.js +1 -1
  136. package/dist/sdk/io/node-filesystem.js +1 -1
  137. package/dist/sdk/job.js +1 -1
  138. package/dist/sdk/journey.js +1 -1
  139. package/dist/sdk/llm/chat-cache.js +1 -1
  140. package/dist/sdk/llm/index.js +1 -1
  141. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  142. package/dist/sdk/llm/model-factors.js +1 -1
  143. package/dist/sdk/personalization.js +1 -1
  144. package/dist/sdk/policy.js +1 -1
  145. package/dist/sdk/query/index.js +1 -1
  146. package/dist/sdk/query/sql-parser.js +1 -1
  147. package/dist/sdk/realtime.js +1 -1
  148. package/dist/sdk/schedule.js +1 -1
  149. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  150. package/dist/sdk/segment/fields-display.js +1 -1
  151. package/dist/sdk/segment/file-discovery.js +1 -1
  152. package/dist/sdk/segment/journey-utils.js +1 -1
  153. package/dist/sdk/segment/journey-validator.js +1 -1
  154. package/dist/sdk/segment/journey-yaml.js +1 -1
  155. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  156. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  157. package/dist/sdk/segment/pull-workflow.js +1 -1
  158. package/dist/sdk/segment/push-recovery.js +1 -1
  159. package/dist/sdk/segment/push-workflow.js +1 -1
  160. package/dist/sdk/segment/resolution-context.js +1 -1
  161. package/dist/sdk/segment/segment-path-parser.js +1 -1
  162. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  163. package/dist/sdk/segment/segment-validator.js +1 -1
  164. package/dist/sdk/segment/target-resolution.js +1 -1
  165. package/dist/sdk/segment/tdx-config.js +1 -1
  166. package/dist/sdk/segment/types/activation-schema.js +1 -1
  167. package/dist/sdk/segment/types/journey-def.js +1 -1
  168. package/dist/sdk/segment/types/journey-schema.js +1 -1
  169. package/dist/sdk/segment/types/segment-def.js +1 -1
  170. package/dist/sdk/segment/types/segment-schema.js +1 -1
  171. package/dist/sdk/segment/validate-files.js +1 -1
  172. package/dist/sdk/segment/yaml-validator.js +1 -1
  173. package/dist/sdk/segment.js +1 -1
  174. package/dist/sdk/types/index.js +1 -1
  175. package/dist/sdk/types/progress.js +1 -1
  176. package/dist/sdk/types/workspace.js +1 -1
  177. package/dist/sdk/user.js +1 -1
  178. package/dist/sdk/util/format-detector.js +1 -1
  179. package/dist/sdk/util/formatters.js +1 -1
  180. package/dist/sdk/util/index.js +1 -1
  181. package/dist/sdk/util/paginate.js +1 -1
  182. package/dist/sdk/util/tree-formatter.js +1 -1
  183. package/dist/sdk/workflow/archive-validation.js +1 -1
  184. package/dist/sdk/workflow/clone-workflow.js +1 -1
  185. package/dist/sdk/workflow/index.js +1 -1
  186. package/dist/sdk/workflow/pull-workflow.js +1 -1
  187. package/dist/sdk/workflow/push-workflow.js +1 -1
  188. package/dist/sdk/workflow/tdx-config.js +1 -1
  189. package/dist/sdk/workflow/workflow-utils.js +1 -1
  190. package/dist/sdk/workspace/frontmatter.js +1 -1
  191. package/dist/sdk/workspace/git.js +1 -1
  192. package/dist/sdk/workspace/index.js +1 -1
  193. package/dist/sdk/workspace/templates.js +1 -1
  194. package/dist/sdk/workspace/weekly.js +1 -1
  195. package/dist/sdk/workspace/wikilinks.js +1 -1
  196. package/dist/test-utils/command-runner.js +1 -1
  197. package/dist/test-utils/factories.js +1 -1
  198. package/dist/test-utils/fixtures.js +1 -1
  199. package/dist/test-utils/http-mock.js +1 -1
  200. package/dist/test-utils/index.js +1 -1
  201. package/dist/utils/async.js +1 -1
  202. package/dist/utils/colors.js +1 -1
  203. package/dist/utils/diff.js +1 -1
  204. package/dist/utils/file-permissions.js +1 -1
  205. package/dist/utils/file-reader.js +1 -1
  206. package/dist/utils/github-releases.js +1 -1
  207. package/dist/utils/global-cache.js +1 -1
  208. package/dist/utils/json-loader.js +1 -1
  209. package/dist/utils/local-cache.js +1 -1
  210. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  211. package/dist/utils/logger/formatters/index.js +1 -1
  212. package/dist/utils/logger/handlers/console-handler.js +1 -1
  213. package/dist/utils/logger/handlers/file-handler.js +1 -1
  214. package/dist/utils/logger/handlers/index.js +1 -1
  215. package/dist/utils/logger/handlers/null-handler.js +1 -1
  216. package/dist/utils/logger/index.js +1 -1
  217. package/dist/utils/logger/logger.js +1 -1
  218. package/dist/utils/logger/types.js +1 -1
  219. package/dist/utils/option-validation.js +1 -1
  220. package/dist/utils/process.js +1 -1
  221. package/dist/utils/prompt.js +1 -1
  222. package/dist/utils/spinner.js +1 -1
  223. package/dist/utils/sse-parser.js +1 -1
  224. package/dist/utils/string-utils.js +1 -1
  225. package/dist/utils/table-ref-parser.js +1 -1
  226. package/dist/utils/tdx-logger.js +1 -1
  227. package/dist/utils/version-check.js +1 -1
  228. package/package.json +1 -1
@@ -1 +1 @@
1
- const a23_0x2a0f98=a23_0x246e;(function(_0x12055b,_0x4e03ae){const _0x3680e1=a23_0x246e,_0x2dd722=_0x12055b();while(!![]){try{const _0x3a937d=-parseInt(_0x3680e1(0x80))/0x1+-parseInt(_0x3680e1(0x9b))/0x2+parseInt(_0x3680e1(0xc4))/0x3+parseInt(_0x3680e1(0xb6))/0x4*(-parseInt(_0x3680e1(0xb2))/0x5)+parseInt(_0x3680e1(0xa2))/0x6*(parseInt(_0x3680e1(0x8d))/0x7)+parseInt(_0x3680e1(0xbe))/0x8*(-parseInt(_0x3680e1(0xc1))/0x9)+-parseInt(_0x3680e1(0x7f))/0xa*(-parseInt(_0x3680e1(0x90))/0xb);if(_0x3a937d===_0x4e03ae)break;else _0x2dd722['push'](_0x2dd722['shift']());}catch(_0x52216f){_0x2dd722['push'](_0x2dd722['shift']());}}}(a23_0x1a7c,0x92784));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';function a23_0x246e(_0x4d9ed3,_0x356f5e){_0x4d9ed3=_0x4d9ed3-0x7f;const _0x1a7c27=a23_0x1a7c();let _0x246ed0=_0x1a7c27[_0x4d9ed3];return _0x246ed0;}import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext,loadSessionContext}from'../core/session.js';function a23_0x1a7c(){const _0x56bb50=['length','128422XNDfSD','βœ”\x20Context\x20set:\x20','\x0aPull\x20summary\x20for\x20workspace\x20\x27','44561eBognK','isNew','config','\x20\x20Target:\x20','\x0aOr\x20set\x20workspace\x20context\x20with:\x20tdx\x20use\x20engage_workspace\x20<name>','green','βœ”\x20Pulled\x20','filter','utf-8','yellow','templates','830726QFaUfL','description','hasChanges','content','Workspace\x20is\x20required.','Pulling\x20templates\x20from\x20\x27','Pull\x20templates\x20to\x20YAML\x20files','294LWQiYg','cyan','counts','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20files?','absolutePath','No\x20templates\x20found\x20in\x20workspace\x20\x27','verbose','Write\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','yes','dryRun','\x20new\x20files','\x0aChanges\x20to\x20\x27','error','session','806085IIqWcm','\x20templates','-\x20no\x20files\x20written','name','20etUlIw','red','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Aborted.','targetDir','execute','\x20=\x20','relativePath','72pqUwJd','engage:template:pull','dim','711486sUcavf','\x20files\x20to\x20','\x20changed\x20files','485031TsNmOf','3970VRKBEC','136004xMnsgy','repeat','cwd','dirname','data','workspaceName','workspace','engage_workspace','\x20unchanged\x20files','\x27...','files','engage'];a23_0x1a7c=function(){return _0x56bb50;};return a23_0x1a7c();}import{tryFindTdxConfig}from'../sdk/segment/tdx-config.js';import a23_0x27f829 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a23_0x41f3d7 from'path';import{pullTemplates}from'../sdk/engage/template-pull.js';export class EngageTemplatePullCommand extends BaseCommand{[a23_0x2a0f98(0xb5)]=a23_0x2a0f98(0xbf);[a23_0x2a0f98(0x9c)]=a23_0x2a0f98(0xa1);async[a23_0x2a0f98(0xbb)](_0x5917b5){const _0x2b9de1=a23_0x2a0f98,{options:_0x359d6d,args:_0x17c920,tdx:_0x10f8b8}=_0x5917b5,_0x553650=_0x359d6d,_0x211b36=await resolveWorkspaceName(_0x17c920[0x0],_0x553650);if(!_0x211b36)return console['error'](a23_0x27f829['yellow'](_0x2b9de1(0x9f))),console[_0x2b9de1(0xb0)]('\x0aUsage:\x20tdx\x20engage\x20template\x20pull\x20<workspace-name>'),console[_0x2b9de1(0xb0)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20engage\x20template\x20pull\x20--workspace\x20<name>'),console[_0x2b9de1(0xb0)](_0x2b9de1(0x94)),0x1;const _0x3f82e5=await withProgressSpinner(_0x2b9de1(0xa0)+_0x211b36+_0x2b9de1(0x89),_0x5b8e36=>pullTemplates({'engage':_0x10f8b8[_0x2b9de1(0x8b)]},_0x211b36,{'templateName':_0x553650['name'],'progress':{'update':_0x23443d=>{_0x5b8e36['setPhase'](_0x23443d);}}}),{'verbose':_0x553650[_0x2b9de1(0xa9)]}),_0x4a6f6a=_0x3f82e5[_0x2b9de1(0x84)];if(_0x4a6f6a[_0x2b9de1(0xa4)]['templates']===0x0)return console[_0x2b9de1(0xb0)](a23_0x27f829[_0x2b9de1(0x99)](_0x2b9de1(0xa8)+_0x4a6f6a[_0x2b9de1(0x85)]+'\x27')),0x0;const _0x13e302=_0x4a6f6a['files'][_0x2b9de1(0x97)](_0x4d9c55=>_0x4d9c55[_0x2b9de1(0x91)]),_0x50e490=_0x4a6f6a[_0x2b9de1(0x8a)][_0x2b9de1(0x97)](_0x51b152=>!_0x51b152['isNew']&&_0x51b152['hasChanges']),_0xb99d77=_0x4a6f6a['files'][_0x2b9de1(0x97)](_0x4ecf9d=>!_0x4ecf9d[_0x2b9de1(0x91)]&&!_0x4ecf9d['hasChanges']);console[_0x2b9de1(0xb0)](_0x2b9de1(0x8f)+_0x4a6f6a[_0x2b9de1(0x85)]+'\x27:'),console['error']('\x20\x20'+a23_0x27f829[_0x2b9de1(0xa3)](_0x4a6f6a[_0x2b9de1(0xa4)][_0x2b9de1(0x9a)]+_0x2b9de1(0xb3))),console[_0x2b9de1(0xb0)]('\x20\x20'+a23_0x27f829[_0x2b9de1(0x95)]('+\x20'+_0x13e302[_0x2b9de1(0x8c)]+_0x2b9de1(0xae))),console[_0x2b9de1(0xb0)]('\x20\x20'+a23_0x27f829['yellow']('~\x20'+_0x50e490[_0x2b9de1(0x8c)]+_0x2b9de1(0xc3))),console[_0x2b9de1(0xb0)]('\x20\x20'+a23_0x27f829[_0x2b9de1(0xc0)]('=\x20'+_0xb99d77[_0x2b9de1(0x8c)]+_0x2b9de1(0x88))),console[_0x2b9de1(0xb0)](_0x2b9de1(0x93)+a23_0x27f829['cyan'](_0x4a6f6a['targetDir'])+'\x0a');if(_0x50e490['length']>0x0)for(const _0x279d44 of _0x50e490){console[_0x2b9de1(0xb0)](_0x2b9de1(0xaf)+_0x279d44[_0x2b9de1(0xbd)]+'\x27:'),console[_0x2b9de1(0xb0)]('─'[_0x2b9de1(0x81)](0x3c)),console[_0x2b9de1(0xb0)](_0x279d44['diff']),console['error']('─'[_0x2b9de1(0x81)](0x3c));}if(_0x553650[_0x2b9de1(0xad)])return console[_0x2b9de1(0xb0)](a23_0x27f829[_0x2b9de1(0x99)](_0x2b9de1(0xb8))),0x0;if(_0x13e302[_0x2b9de1(0x8c)]===0x0&&_0x50e490[_0x2b9de1(0x8c)]===0x0)return console[_0x2b9de1(0xb0)](a23_0x27f829[_0x2b9de1(0x95)]('βœ”\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'engage_workspace':_0x4a6f6a['workspaceName']},_0x553650['session']),0x0;if(!_0x553650[_0x2b9de1(0xac)]){if(!isInteractive())return console[_0x2b9de1(0xb0)](a23_0x27f829[_0x2b9de1(0xb7)]('\x0aError:'),_0x2b9de1(0xab)),console['error'](a23_0x27f829['dim'](_0x2b9de1(0xa5))),0x1;const _0x4b269d=await confirmKey(_0x2b9de1(0xaa)+(_0x13e302[_0x2b9de1(0x8c)]+_0x50e490[_0x2b9de1(0x8c)])+_0x2b9de1(0xa6));if(!_0x4b269d)return console[_0x2b9de1(0xb0)](a23_0x27f829['yellow'](_0x2b9de1(0xb9)),_0x2b9de1(0xb4)),0x1;}for(const _0x14e8e9 of _0x4a6f6a['files']){if(_0x14e8e9['isNew']||_0x14e8e9[_0x2b9de1(0x9d)]){const _0x3fbd83=a23_0x41f3d7[_0x2b9de1(0x83)](_0x14e8e9[_0x2b9de1(0xa7)]);!existsSync(_0x3fbd83)&&mkdirSync(_0x3fbd83,{'recursive':!![]}),writeFileSync(_0x14e8e9['absolutePath'],_0x14e8e9[_0x2b9de1(0x9e)],_0x2b9de1(0x98));}}return console['error'](a23_0x27f829[_0x2b9de1(0x95)](_0x2b9de1(0x96)+(_0x13e302[_0x2b9de1(0x8c)]+_0x50e490[_0x2b9de1(0x8c)])+_0x2b9de1(0xc2)+_0x4a6f6a[_0x2b9de1(0xba)])),saveSessionContext({'engage_workspace':_0x4a6f6a[_0x2b9de1(0x85)]},_0x553650[_0x2b9de1(0xb1)]),console[_0x2b9de1(0xb0)](a23_0x27f829[_0x2b9de1(0x95)](_0x2b9de1(0x8e)+a23_0x27f829[_0x2b9de1(0xc0)](_0x2b9de1(0x87))+_0x2b9de1(0xbc)+a23_0x27f829[_0x2b9de1(0xa3)](_0x4a6f6a[_0x2b9de1(0x85)]))),0x0;}}async function resolveWorkspaceName(_0x472d97,_0x32e66e){const _0x442ffb=a23_0x2a0f98;if(_0x472d97)return _0x472d97;if(_0x32e66e[_0x442ffb(0x86)])return _0x32e66e['workspace'];const _0x373b5f=tryFindTdxConfig(process[_0x442ffb(0x82)]());if(_0x373b5f?.[_0x442ffb(0x92)]['engage_workspace'])return _0x373b5f[_0x442ffb(0x92)]['engage_workspace'];const _0x3d9002=loadSessionContext(_0x32e66e[_0x442ffb(0xb1)]);if(_0x3d9002?.[_0x442ffb(0x87)])return _0x3d9002['engage_workspace'];return undefined;}
1
+ const a23_0x22ec4f=a23_0x440e;(function(_0x15e3b2,_0x4df343){const _0x282589=a23_0x440e,_0x5bc3c1=_0x15e3b2();while(!![]){try{const _0x4cb56d=parseInt(_0x282589(0xdf))/0x1+parseInt(_0x282589(0xf5))/0x2*(parseInt(_0x282589(0x103))/0x3)+parseInt(_0x282589(0xe2))/0x4*(-parseInt(_0x282589(0x101))/0x5)+parseInt(_0x282589(0x116))/0x6+parseInt(_0x282589(0x112))/0x7+parseInt(_0x282589(0x104))/0x8*(parseInt(_0x282589(0xdb))/0x9)+-parseInt(_0x282589(0xe5))/0xa;if(_0x4cb56d===_0x4df343)break;else _0x5bc3c1['push'](_0x5bc3c1['shift']());}catch(_0x5b381d){_0x5bc3c1['push'](_0x5bc3c1['shift']());}}}(a23_0x5172,0x77931));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';function a23_0x5172(){const _0x3314d1=['targetDir','diff','16GiLUMB','cwd','Write\x20','4788640JZvDVg','\x20templates','counts','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Workspace\x20is\x20required.','workspaceName','\x20\x20\x20\x20\x20\x20\x20tdx\x20engage\x20template\x20pull\x20--workspace\x20<name>','yes','βœ”\x20Context\x20set:\x20','config','isNew','verbose','absolutePath','\x0aUsage:\x20tdx\x20engage\x20template\x20pull\x20<workspace-name>','Aborted.','hasChanges','266jBfpcj','green','files','Pulling\x20templates\x20from\x20\x27','name','cyan','templates','filter','\x0aOr\x20set\x20workspace\x20context\x20with:\x20tdx\x20use\x20engage_workspace\x20<name>','error','red','yellow','972590gwwYcx','setPhase','12252PSMQrY','24RKWYnD','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','session','\x20changed\x20files','length','\x20files?','βœ”\x20Pulled\x20','workspace','dim','data','dirname','dryRun','\x0aChanges\x20to\x20\x27','engage_workspace','2067471xUKmJw','\x20=\x20','content','utf-8','1943844rwYugE','\x20unchanged\x20files','relativePath','No\x20templates\x20found\x20in\x20workspace\x20\x27','66141YxBAYf','\x27...','repeat','\x0aError:','562167apwgVM'];a23_0x5172=function(){return _0x3314d1;};return a23_0x5172();}import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext,loadSessionContext}from'../core/session.js';function a23_0x440e(_0x3c6add,_0x166eb8){_0x3c6add=_0x3c6add-0xdb;const _0x5172e1=a23_0x5172();let _0x440e3e=_0x5172e1[_0x3c6add];return _0x440e3e;}import{tryFindTdxConfig}from'../sdk/segment/tdx-config.js';import a23_0x272c72 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a23_0x24e230 from'path';import{pullTemplates}from'../sdk/engage/template-pull.js';export class EngageTemplatePullCommand extends BaseCommand{[a23_0x22ec4f(0xf9)]='engage:template:pull';['description']='Pull\x20templates\x20to\x20YAML\x20files';async['execute'](_0x225b50){const _0xac47af=a23_0x22ec4f,{options:_0x21a328,args:_0x2dc700,tdx:_0x75e79f}=_0x225b50,_0x1623ae=_0x21a328,_0x64bde6=await resolveWorkspaceName(_0x2dc700[0x0],_0x1623ae);if(!_0x64bde6)return console['error'](a23_0x272c72[_0xac47af(0x100)](_0xac47af(0xe9))),console[_0xac47af(0xfe)](_0xac47af(0xf2)),console['error'](_0xac47af(0xeb)),console[_0xac47af(0xfe)](_0xac47af(0xfd)),0x1;const _0x4e211d=await withProgressSpinner(_0xac47af(0xf8)+_0x64bde6+_0xac47af(0xdc),_0x2d703c=>pullTemplates({'engage':_0x75e79f['engage']},_0x64bde6,{'templateName':_0x1623ae[_0xac47af(0xf9)],'progress':{'update':_0x270bbc=>{const _0x528c27=_0xac47af;_0x2d703c[_0x528c27(0x102)](_0x270bbc);}}}),{'verbose':_0x1623ae[_0xac47af(0xf0)]}),_0x12e75f=_0x4e211d[_0xac47af(0x10d)];if(_0x12e75f[_0xac47af(0xe7)]['templates']===0x0)return console[_0xac47af(0xfe)](a23_0x272c72[_0xac47af(0x100)](_0xac47af(0x119)+_0x12e75f['workspaceName']+'\x27')),0x0;const _0x3ef653=_0x12e75f[_0xac47af(0xf7)][_0xac47af(0xfc)](_0x5b5335=>_0x5b5335[_0xac47af(0xef)]),_0x1d88df=_0x12e75f[_0xac47af(0xf7)][_0xac47af(0xfc)](_0x123707=>!_0x123707['isNew']&&_0x123707[_0xac47af(0xf4)]),_0x10c090=_0x12e75f['files'][_0xac47af(0xfc)](_0x3a390d=>!_0x3a390d[_0xac47af(0xef)]&&!_0x3a390d[_0xac47af(0xf4)]);console['error']('\x0aPull\x20summary\x20for\x20workspace\x20\x27'+_0x12e75f[_0xac47af(0xea)]+'\x27:'),console[_0xac47af(0xfe)]('\x20\x20'+a23_0x272c72[_0xac47af(0xfa)](_0x12e75f['counts'][_0xac47af(0xfb)]+_0xac47af(0xe6))),console['error']('\x20\x20'+a23_0x272c72[_0xac47af(0xf6)]('+\x20'+_0x3ef653[_0xac47af(0x108)]+'\x20new\x20files')),console[_0xac47af(0xfe)]('\x20\x20'+a23_0x272c72[_0xac47af(0x100)]('~\x20'+_0x1d88df[_0xac47af(0x108)]+_0xac47af(0x107))),console[_0xac47af(0xfe)]('\x20\x20'+a23_0x272c72[_0xac47af(0x10c)]('=\x20'+_0x10c090[_0xac47af(0x108)]+_0xac47af(0x117))),console[_0xac47af(0xfe)]('\x20\x20Target:\x20'+a23_0x272c72[_0xac47af(0xfa)](_0x12e75f[_0xac47af(0xe0)])+'\x0a');if(_0x1d88df[_0xac47af(0x108)]>0x0)for(const _0x170dd4 of _0x1d88df){console[_0xac47af(0xfe)](_0xac47af(0x110)+_0x170dd4[_0xac47af(0x118)]+'\x27:'),console[_0xac47af(0xfe)]('─'[_0xac47af(0xdd)](0x3c)),console[_0xac47af(0xfe)](_0x170dd4[_0xac47af(0xe1)]),console[_0xac47af(0xfe)]('─'[_0xac47af(0xdd)](0x3c));}if(_0x1623ae[_0xac47af(0x10f)])return console['error'](a23_0x272c72[_0xac47af(0x100)](_0xac47af(0x105))),0x0;if(_0x3ef653[_0xac47af(0x108)]===0x0&&_0x1d88df[_0xac47af(0x108)]===0x0)return console[_0xac47af(0xfe)](a23_0x272c72['green']('βœ”\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'engage_workspace':_0x12e75f[_0xac47af(0xea)]},_0x1623ae[_0xac47af(0x106)]),0x0;if(!_0x1623ae[_0xac47af(0xec)]){if(!isInteractive())return console[_0xac47af(0xfe)](a23_0x272c72[_0xac47af(0xff)](_0xac47af(0xde)),_0xac47af(0xe8)),console[_0xac47af(0xfe)](a23_0x272c72[_0xac47af(0x10c)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x5dc4bb=await confirmKey(_0xac47af(0xe4)+(_0x3ef653[_0xac47af(0x108)]+_0x1d88df[_0xac47af(0x108)])+_0xac47af(0x109));if(!_0x5dc4bb)return console[_0xac47af(0xfe)](a23_0x272c72['yellow'](_0xac47af(0xf3)),'-\x20no\x20files\x20written'),0x1;}for(const _0x3a35d0 of _0x12e75f[_0xac47af(0xf7)]){if(_0x3a35d0[_0xac47af(0xef)]||_0x3a35d0[_0xac47af(0xf4)]){const _0x1de510=a23_0x24e230[_0xac47af(0x10e)](_0x3a35d0[_0xac47af(0xf1)]);!existsSync(_0x1de510)&&mkdirSync(_0x1de510,{'recursive':!![]}),writeFileSync(_0x3a35d0[_0xac47af(0xf1)],_0x3a35d0[_0xac47af(0x114)],_0xac47af(0x115));}}return console[_0xac47af(0xfe)](a23_0x272c72['green'](_0xac47af(0x10a)+(_0x3ef653[_0xac47af(0x108)]+_0x1d88df['length'])+'\x20files\x20to\x20'+_0x12e75f['targetDir'])),saveSessionContext({'engage_workspace':_0x12e75f[_0xac47af(0xea)]},_0x1623ae['session']),console[_0xac47af(0xfe)](a23_0x272c72[_0xac47af(0xf6)](_0xac47af(0xed)+a23_0x272c72[_0xac47af(0x10c)](_0xac47af(0x111))+_0xac47af(0x113)+a23_0x272c72[_0xac47af(0xfa)](_0x12e75f[_0xac47af(0xea)]))),0x0;}}async function resolveWorkspaceName(_0x47a673,_0x20bbbb){const _0x1f400f=a23_0x22ec4f;if(_0x47a673)return _0x47a673;if(_0x20bbbb[_0x1f400f(0x10b)])return _0x20bbbb[_0x1f400f(0x10b)];const _0x5c393d=tryFindTdxConfig(process[_0x1f400f(0xe3)]());if(_0x5c393d?.[_0x1f400f(0xee)][_0x1f400f(0x111)])return _0x5c393d[_0x1f400f(0xee)][_0x1f400f(0x111)];const _0x9ef9b5=loadSessionContext(_0x20bbbb[_0x1f400f(0x106)]);if(_0x9ef9b5?.[_0x1f400f(0x111)])return _0x9ef9b5[_0x1f400f(0x111)];return undefined;}
@@ -1 +1 @@
1
- const a24_0x17519a=a24_0x1a77;(function(_0x5a4245,_0x234d55){const _0x5e8d6c=a24_0x1a77,_0x1d59f6=_0x5a4245();while(!![]){try{const _0x3c0fc6=-parseInt(_0x5e8d6c(0xde))/0x1+parseInt(_0x5e8d6c(0xd1))/0x2+-parseInt(_0x5e8d6c(0xf7))/0x3*(parseInt(_0x5e8d6c(0xf3))/0x4)+-parseInt(_0x5e8d6c(0xbe))/0x5*(parseInt(_0x5e8d6c(0xeb))/0x6)+parseInt(_0x5e8d6c(0xda))/0x7+parseInt(_0x5e8d6c(0xd7))/0x8+-parseInt(_0x5e8d6c(0xe1))/0x9;if(_0x3c0fc6===_0x234d55)break;else _0x1d59f6['push'](_0x1d59f6['shift']());}catch(_0x4f8dd4){_0x1d59f6['push'](_0x1d59f6['shift']());}}}(a24_0x39f4,0xc0603));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';function a24_0x1a77(_0x5726a6,_0x447537){_0x5726a6=_0x5726a6-0xbe;const _0x39f40f=a24_0x39f4();let _0x1a77d2=_0x39f40f[_0x5726a6];return _0x1a77d2;}import{confirmKey,isInteractive}from'../utils/prompt.js';function a24_0x39f4(){const _0x3a44e7=['created','Workspace\x20is\x20required.','1239470eZUfvE','\x20templates?','\x0aValidation\x20errors\x20in\x20','update','\x20\x20\x20\x20\x20\x20\x20tdx\x20engage\x20template\x20push\x20--workspace\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20with\x20explicit\x20workspace','βœ”\x20All\x20templates\x20are\x20up\x20to\x20date','11497760BHuEaM','errors','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','10822735gdbaFR','Preparing\x20push\x20to\x20workspace\x20\x27','warnings','\x27...','515246UAlKWr','site','def','17604657BDsqTC','verbose','dim','Aborted.','resolve','action','config','create','\x20\x20\x20\x20','βœ”\x20Created\x20','342khVWly','updated','dirname','length','engage_workspace','Push\x20YAML\x20files\x20to\x20Engage\x20API\x20as\x20templates','name','\x20new\x20templates:','12LnqdAa','\x20\x20\x20\x20\x20\x20\x20tdx\x20engage\x20template\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20(requires\x20tdx.json)','Push\x20','red','303357XeJJUX','setPhase','Template\x20YAML\x20files\x20must\x20have\x20type:\x20template\x20in\x20their\x20definition.','session','Resolving\x20references...','βœ”\x20Updated\x20','1\x20template\x20file:\x20','execute','resolveWorkspaceId','engage:template:push','message','yellow','cyan','data','\x0aPush\x20summary\x20for\x20workspace\x20\x27','3545IxgIhW','configDir','green','workspace','error','dryRun','\x0aOr\x20set\x20workspace\x20context\x20with:\x20tdx\x20use\x20engage_workspace\x20<name>','-\x20no\x20changes\x20applied','\x0aError:','Pushing\x20templates...','path','Found\x20','\x0aUsage:\x20tdx\x20engage\x20template\x20push\x20<file.yaml>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20single\x20file','engage','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20applied','filter','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'];a24_0x39f4=function(){return _0x3a44e7;};return a24_0x39f4();}import{saveSessionContext,loadSessionContext}from'../core/session.js';import{tryFindTdxConfig}from'../sdk/segment/tdx-config.js';import{isYamlFile}from'../sdk/segment/file-discovery.js';import a24_0x4878b3 from'chalk';import a24_0xcdd1a1 from'path';import{discoverAndParseTemplateFiles,parseTemplateFile,preparePush,resolveAndBuildInputs,executePush}from'../sdk/engage/template-push.js';import{validateTemplateDef}from'../sdk/engage/template-validator.js';import{getTemplateUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';export class EngageTemplatePushCommand extends BaseCommand{['name']=a24_0x17519a(0x100);['description']=a24_0x17519a(0xf0);async[a24_0x17519a(0xfe)](_0x2697e9){const _0x42089b=a24_0x17519a,{options:_0x462f9c,args:_0x418bd5,tdx:_0x36d816}=_0x2697e9,_0x85d44=_0x462f9c,_0x3bd31b=_0x418bd5[0x0],_0x22be78=_0x3bd31b?a24_0xcdd1a1[_0x42089b(0xe5)](_0x3bd31b):undefined,_0x32e87b=_0x22be78?isYamlFile(_0x22be78):![];let _0x5451af;if(_0x32e87b&&_0x22be78)_0x5451af=a24_0xcdd1a1[_0x42089b(0xed)](_0x22be78);else _0x22be78?_0x5451af=_0x22be78:_0x5451af=process['cwd']();let _0x2219db;const _0x14c54d=tryFindTdxConfig(_0x5451af);_0x14c54d?.['config'][_0x42089b(0xef)]&&(_0x2219db=_0x14c54d[_0x42089b(0xe7)][_0x42089b(0xef)],!_0x32e87b&&(_0x5451af=_0x14c54d[_0x42089b(0xbf)]));_0x85d44['workspace']&&(_0x2219db=_0x85d44[_0x42089b(0xc1)]);if(!_0x2219db){const _0x50d4f7=loadSessionContext(_0x85d44[_0x42089b(0xfa)]);_0x50d4f7?.[_0x42089b(0xef)]&&(_0x2219db=_0x50d4f7['engage_workspace']);}if(!_0x2219db)return console['error'](a24_0x4878b3[_0x42089b(0x102)](_0x42089b(0xd0))),console['error'](_0x42089b(0xca)),console['error'](_0x42089b(0xf4)),console[_0x42089b(0xc2)](_0x42089b(0xd5)),console['error'](_0x42089b(0xc4)),0x1;let _0x287465;_0x32e87b&&_0x22be78?_0x287465=[parseTemplateFile(_0x22be78,a24_0xcdd1a1[_0x42089b(0xed)](_0x22be78))]:_0x287465=discoverAndParseTemplateFiles(_0x5451af);if(_0x287465[_0x42089b(0xee)]===0x0)return console[_0x42089b(0xc2)](a24_0x4878b3[_0x42089b(0x102)]('No\x20template\x20YAML\x20files\x20found\x20in\x20'+_0x5451af)),console[_0x42089b(0xc2)](a24_0x4878b3[_0x42089b(0xe3)](_0x42089b(0xf9))),0x1;const _0xbbdb9f=_0x287465['length']===0x1?_0x42089b(0xfd)+_0x287465[0x0][_0x42089b(0xe0)][_0x42089b(0xf1)]:_0x287465[_0x42089b(0xee)]+'\x20template\x20files';console['error'](_0x42089b(0xc9)+a24_0x4878b3[_0x42089b(0x103)](_0xbbdb9f));let _0x3eb2fd=![];for(const _0x1547bd of _0x287465){const _0x1f03f8=validateTemplateDef(_0x1547bd[_0x42089b(0xe0)]);if(!_0x1f03f8['valid']){_0x3eb2fd=!![],console['error'](a24_0x4878b3[_0x42089b(0xf6)](_0x42089b(0xd3)+_0x1547bd['relativePath']+':'));for(const _0x22575a of _0x1f03f8[_0x42089b(0xd8)]){console[_0x42089b(0xc2)]('\x20\x20'+a24_0x4878b3['red']('βœ—')+'\x20'+_0x22575a[_0x42089b(0xc8)]+':\x20'+_0x22575a[_0x42089b(0x101)]);}}for(const _0x18ce18 of _0x1f03f8[_0x42089b(0xdc)]){console[_0x42089b(0xc2)]('\x20\x20'+a24_0x4878b3[_0x42089b(0x102)]('⚠')+'\x20'+_0x18ce18[_0x42089b(0xc8)]+':\x20'+_0x18ce18[_0x42089b(0x101)]);}}if(_0x3eb2fd)return console[_0x42089b(0xc2)](a24_0x4878b3[_0x42089b(0xf6)]('\x0aValidation\x20failed.\x20Fix\x20the\x20errors\x20above\x20before\x20pushing.')),0x1;const _0x19cbc4=await _0x36d816[_0x42089b(0xcb)][_0x42089b(0xff)](_0x2219db),_0x15ac14=await withProgressSpinner(_0x42089b(0xdb)+_0x2219db+_0x42089b(0xdd),_0x4b25c5=>preparePush({'engage':_0x36d816[_0x42089b(0xcb)]},_0x287465,_0x19cbc4,{'progress':{'update':_0x547e7c=>_0x4b25c5[_0x42089b(0xf8)](_0x547e7c)}}),{'verbose':_0x85d44['verbose']}),_0x30cbbf=_0x15ac14['data'];await withProgressSpinner(_0x42089b(0xfb),_0x4d4756=>resolveAndBuildInputs({'engage':_0x36d816[_0x42089b(0xcb)]},_0x30cbbf,_0x19cbc4,{'progress':{'update':_0x5c2496=>_0x4d4756[_0x42089b(0xf8)](_0x5c2496)}}),{'verbose':_0x85d44[_0x42089b(0xe2)]});const _0x523d11=_0x30cbbf[_0x42089b(0xcd)](_0x27b6cd=>_0x27b6cd[_0x42089b(0xe6)]===_0x42089b(0xe8)),_0x4c5327=_0x30cbbf[_0x42089b(0xcd)](_0x2605b0=>_0x2605b0[_0x42089b(0xe6)]===_0x42089b(0xd4));console['error'](_0x42089b(0x105)+_0x2219db+'\x27:');if(_0x523d11[_0x42089b(0xee)]>0x0){console[_0x42089b(0xc2)]('\x20\x20'+a24_0x4878b3[_0x42089b(0xc0)]('+\x20'+_0x523d11[_0x42089b(0xee)]+_0x42089b(0xf2)));for(const _0x8043c1 of _0x523d11){console[_0x42089b(0xc2)]('\x20\x20\x20\x20'+a24_0x4878b3['green']('+')+'\x20'+_0x8043c1['def']['name']);}}if(_0x4c5327[_0x42089b(0xee)]>0x0){console[_0x42089b(0xc2)]('\x20\x20'+a24_0x4878b3[_0x42089b(0x102)]('~\x20'+_0x4c5327['length']+'\x20templates\x20to\x20update:'));for(const _0x1ab358 of _0x4c5327){console[_0x42089b(0xc2)](_0x42089b(0xe9)+a24_0x4878b3[_0x42089b(0x102)]('~')+'\x20'+_0x1ab358[_0x42089b(0xe0)][_0x42089b(0xf1)]);}}if(_0x523d11[_0x42089b(0xee)]===0x0&&_0x4c5327[_0x42089b(0xee)]===0x0)return console[_0x42089b(0xc2)](a24_0x4878b3[_0x42089b(0xc0)](_0x42089b(0xd6))),0x0;if(_0x85d44[_0x42089b(0xc3)])return console[_0x42089b(0xc2)](a24_0x4878b3[_0x42089b(0x102)](_0x42089b(0xcc))),0x0;if(!_0x85d44['yes']){if(!isInteractive())return console[_0x42089b(0xc2)](a24_0x4878b3[_0x42089b(0xf6)](_0x42089b(0xc6)),_0x42089b(0xce)),console[_0x42089b(0xc2)](a24_0x4878b3['dim'](_0x42089b(0xd9))),0x1;const _0x38cd46=await confirmKey(_0x42089b(0xf5)+(_0x523d11[_0x42089b(0xee)]+_0x4c5327[_0x42089b(0xee)])+_0x42089b(0xd2));if(!_0x38cd46)return console['error'](a24_0x4878b3[_0x42089b(0x102)](_0x42089b(0xe4)),_0x42089b(0xc5)),0x1;}const _0x4fbe8f=await withProgressSpinner(_0x42089b(0xc7),_0x30f7d8=>executePush({'engage':_0x36d816['engage']},_0x30cbbf,{'progress':{'update':_0x7562bf=>_0x30f7d8[_0x42089b(0xf8)](_0x7562bf)}}),{'verbose':_0x85d44[_0x42089b(0xe2)]}),_0x2c7b9d=_0x4fbe8f[_0x42089b(0x104)];for(const _0x42cb03 of _0x2c7b9d['results']){if(_0x42cb03['templateId']&&(_0x42cb03[_0x42089b(0xe6)]===_0x42089b(0xcf)||_0x42cb03[_0x42089b(0xe6)]===_0x42089b(0xec))){const _0x106e44=getTemplateUrl(_0x85d44[_0x42089b(0xdf)],_0x19cbc4,_0x42cb03['templateId']),_0xbec0cf=_0x42cb03[_0x42089b(0xe6)]==='created'?'+':'~',_0x9dfb42=_0x42cb03[_0x42089b(0xe6)]===_0x42089b(0xcf)?a24_0x4878b3['green'](_0xbec0cf):a24_0x4878b3[_0x42089b(0x102)](_0xbec0cf);console[_0x42089b(0xc2)]('\x20\x20'+_0x9dfb42+'\x20'+hyperlink(_0x42cb03[_0x42089b(0xf1)],_0x106e44)+'\x20'+a24_0x4878b3[_0x42089b(0xe3)](_0x106e44));}}_0x2c7b9d[_0x42089b(0xcf)]>0x0&&console[_0x42089b(0xc2)](a24_0x4878b3[_0x42089b(0xc0)](_0x42089b(0xea)+_0x2c7b9d[_0x42089b(0xcf)]+'\x20templates'));_0x2c7b9d['updated']>0x0&&console[_0x42089b(0xc2)](a24_0x4878b3[_0x42089b(0xc0)](_0x42089b(0xfc)+_0x2c7b9d['updated']+'\x20templates'));if(_0x2c7b9d[_0x42089b(0xd8)]['length']>0x0){console[_0x42089b(0xc2)](a24_0x4878b3['red']('✘\x20'+_0x2c7b9d['errors']['length']+'\x20errors:'));for(const _0x10e117 of _0x2c7b9d[_0x42089b(0xd8)]){console[_0x42089b(0xc2)]('\x20\x20'+a24_0x4878b3[_0x42089b(0xf6)](_0x10e117[_0x42089b(0xf1)])+':\x20'+_0x10e117[_0x42089b(0xc2)]);}}return saveSessionContext({'engage_workspace':_0x2219db},_0x85d44[_0x42089b(0xfa)]),_0x2c7b9d[_0x42089b(0xd8)]['length']>0x0?0x1:0x0;}}
1
+ const a24_0x5e4b69=a24_0x84c4;(function(_0x37e067,_0xfd79ef){const _0x16787d=a24_0x84c4,_0x20fd5f=_0x37e067();while(!![]){try{const _0x506eae=parseInt(_0x16787d(0x1ee))/0x1*(-parseInt(_0x16787d(0x1fc))/0x2)+-parseInt(_0x16787d(0x203))/0x3+parseInt(_0x16787d(0x21a))/0x4+-parseInt(_0x16787d(0x224))/0x5+-parseInt(_0x16787d(0x212))/0x6+-parseInt(_0x16787d(0x222))/0x7+parseInt(_0x16787d(0x1e9))/0x8*(parseInt(_0x16787d(0x214))/0x9);if(_0x506eae===_0xfd79ef)break;else _0x20fd5f['push'](_0x20fd5f['shift']());}catch(_0x45182e){_0x20fd5f['push'](_0x20fd5f['shift']());}}}(a24_0x2848,0xe0808));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext,loadSessionContext}from'../core/session.js';import{tryFindTdxConfig}from'../sdk/segment/tdx-config.js';import{isYamlFile}from'../sdk/segment/file-discovery.js';function a24_0x2848(){const _0x480b02=['dirname','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20applied','warnings','56517336JCqXhF','Found\x20','resolveWorkspaceId','Template\x20YAML\x20files\x20must\x20have\x20type:\x20template\x20in\x20their\x20definition.','resolve','1252259MMtCXt','def','config','\x0aError:','\x0aOr\x20set\x20workspace\x20context\x20with:\x20tdx\x20use\x20engage_workspace\x20<name>','workspace','\x20template\x20files','green','length','verbose','description','updated','\x20templates?','action','2EJebcZ','-\x20no\x20changes\x20applied','No\x20template\x20YAML\x20files\x20found\x20in\x20','Push\x20','\x0aValidation\x20errors\x20in\x20','1\x20template\x20file:\x20','create','694491ufrHqp','βœ”\x20All\x20templates\x20are\x20up\x20to\x20date','valid','\x0aValidation\x20failed.\x20Fix\x20the\x20errors\x20above\x20before\x20pushing.','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','name','templateId','path','site','Push\x20YAML\x20files\x20to\x20Engage\x20API\x20as\x20templates','setPhase','Resolving\x20references...','dryRun','cwd','error','9005274rkYozT','engage','9kqUPcL','Preparing\x20push\x20to\x20workspace\x20\x27','created','dim','filter','Workspace\x20is\x20required.','616628sjNpLV','errors','\x20templates\x20to\x20update:','red','\x20templates','yellow','yes','engage_workspace','10773798djpNbZ','session','8877575QreNKj','message'];a24_0x2848=function(){return _0x480b02;};return a24_0x2848();}import a24_0x449d3e from'chalk';import a24_0x1e2a38 from'path';import{discoverAndParseTemplateFiles,parseTemplateFile,preparePush,resolveAndBuildInputs,executePush}from'../sdk/engage/template-push.js';import{validateTemplateDef}from'../sdk/engage/template-validator.js';import{getTemplateUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';function a24_0x84c4(_0x3e46ab,_0x3ba094){_0x3e46ab=_0x3e46ab-0x1e9;const _0x2848c4=a24_0x2848();let _0x84c4d2=_0x2848c4[_0x3e46ab];return _0x84c4d2;}export class EngageTemplatePushCommand extends BaseCommand{['name']='engage:template:push';[a24_0x5e4b69(0x1f8)]=a24_0x5e4b69(0x20c);async['execute'](_0x3949e9){const _0x323950=a24_0x5e4b69,{options:_0x278d39,args:_0x49e28d,tdx:_0x3871f9}=_0x3949e9,_0x389fb6=_0x278d39,_0x3a5406=_0x49e28d[0x0],_0x55feb5=_0x3a5406?a24_0x1e2a38[_0x323950(0x1ed)](_0x3a5406):undefined,_0x3ed3a6=_0x55feb5?isYamlFile(_0x55feb5):![];let _0x327bd4;if(_0x3ed3a6&&_0x55feb5)_0x327bd4=a24_0x1e2a38[_0x323950(0x226)](_0x55feb5);else _0x55feb5?_0x327bd4=_0x55feb5:_0x327bd4=process[_0x323950(0x210)]();let _0x3a4645;const _0x35673c=tryFindTdxConfig(_0x327bd4);_0x35673c?.[_0x323950(0x1f0)][_0x323950(0x221)]&&(_0x3a4645=_0x35673c[_0x323950(0x1f0)][_0x323950(0x221)],!_0x3ed3a6&&(_0x327bd4=_0x35673c['configDir']));_0x389fb6[_0x323950(0x1f3)]&&(_0x3a4645=_0x389fb6['workspace']);if(!_0x3a4645){const _0x1c5c0e=loadSessionContext(_0x389fb6[_0x323950(0x223)]);_0x1c5c0e?.[_0x323950(0x221)]&&(_0x3a4645=_0x1c5c0e[_0x323950(0x221)]);}if(!_0x3a4645)return console['error'](a24_0x449d3e[_0x323950(0x21f)](_0x323950(0x219))),console[_0x323950(0x211)]('\x0aUsage:\x20tdx\x20engage\x20template\x20push\x20<file.yaml>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20single\x20file'),console[_0x323950(0x211)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20engage\x20template\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20(requires\x20tdx.json)'),console[_0x323950(0x211)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20engage\x20template\x20push\x20--workspace\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20with\x20explicit\x20workspace'),console['error'](_0x323950(0x1f2)),0x1;let _0x4fb31a;_0x3ed3a6&&_0x55feb5?_0x4fb31a=[parseTemplateFile(_0x55feb5,a24_0x1e2a38[_0x323950(0x226)](_0x55feb5))]:_0x4fb31a=discoverAndParseTemplateFiles(_0x327bd4);if(_0x4fb31a[_0x323950(0x1f6)]===0x0)return console['error'](a24_0x449d3e[_0x323950(0x21f)](_0x323950(0x1fe)+_0x327bd4)),console[_0x323950(0x211)](a24_0x449d3e[_0x323950(0x217)](_0x323950(0x1ec))),0x1;const _0x3aff05=_0x4fb31a[_0x323950(0x1f6)]===0x1?_0x323950(0x201)+_0x4fb31a[0x0][_0x323950(0x1ef)][_0x323950(0x208)]:_0x4fb31a['length']+_0x323950(0x1f4);console[_0x323950(0x211)](_0x323950(0x1ea)+a24_0x449d3e['cyan'](_0x3aff05));let _0x50e4d7=![];for(const _0x484675 of _0x4fb31a){const _0x1ebf74=validateTemplateDef(_0x484675[_0x323950(0x1ef)]);if(!_0x1ebf74[_0x323950(0x205)]){_0x50e4d7=!![],console['error'](a24_0x449d3e[_0x323950(0x21d)](_0x323950(0x200)+_0x484675['relativePath']+':'));for(const _0x131d49 of _0x1ebf74['errors']){console['error']('\x20\x20'+a24_0x449d3e['red']('βœ—')+'\x20'+_0x131d49[_0x323950(0x20a)]+':\x20'+_0x131d49[_0x323950(0x225)]);}}for(const _0x247f0b of _0x1ebf74[_0x323950(0x228)]){console['error']('\x20\x20'+a24_0x449d3e[_0x323950(0x21f)]('⚠')+'\x20'+_0x247f0b[_0x323950(0x20a)]+':\x20'+_0x247f0b['message']);}}if(_0x50e4d7)return console[_0x323950(0x211)](a24_0x449d3e[_0x323950(0x21d)](_0x323950(0x206))),0x1;const _0x1433eb=await _0x3871f9[_0x323950(0x213)][_0x323950(0x1eb)](_0x3a4645),_0x4757e6=await withProgressSpinner(_0x323950(0x215)+_0x3a4645+'\x27...',_0x4fae82=>preparePush({'engage':_0x3871f9['engage']},_0x4fb31a,_0x1433eb,{'progress':{'update':_0x18360f=>_0x4fae82[_0x323950(0x20d)](_0x18360f)}}),{'verbose':_0x389fb6[_0x323950(0x1f7)]}),_0x4e565c=_0x4757e6['data'];await withProgressSpinner(_0x323950(0x20e),_0x1fadee=>resolveAndBuildInputs({'engage':_0x3871f9[_0x323950(0x213)]},_0x4e565c,_0x1433eb,{'progress':{'update':_0x117bc8=>_0x1fadee[_0x323950(0x20d)](_0x117bc8)}}),{'verbose':_0x389fb6[_0x323950(0x1f7)]});const _0x19c822=_0x4e565c[_0x323950(0x218)](_0x4c3a7c=>_0x4c3a7c[_0x323950(0x1fb)]===_0x323950(0x202)),_0x2b5d61=_0x4e565c['filter'](_0x4324ae=>_0x4324ae[_0x323950(0x1fb)]==='update');console[_0x323950(0x211)]('\x0aPush\x20summary\x20for\x20workspace\x20\x27'+_0x3a4645+'\x27:');if(_0x19c822[_0x323950(0x1f6)]>0x0){console['error']('\x20\x20'+a24_0x449d3e[_0x323950(0x1f5)]('+\x20'+_0x19c822[_0x323950(0x1f6)]+'\x20new\x20templates:'));for(const _0x487afa of _0x19c822){console['error']('\x20\x20\x20\x20'+a24_0x449d3e[_0x323950(0x1f5)]('+')+'\x20'+_0x487afa[_0x323950(0x1ef)][_0x323950(0x208)]);}}if(_0x2b5d61['length']>0x0){console[_0x323950(0x211)]('\x20\x20'+a24_0x449d3e['yellow']('~\x20'+_0x2b5d61[_0x323950(0x1f6)]+_0x323950(0x21c)));for(const _0x116ed8 of _0x2b5d61){console[_0x323950(0x211)]('\x20\x20\x20\x20'+a24_0x449d3e[_0x323950(0x21f)]('~')+'\x20'+_0x116ed8[_0x323950(0x1ef)][_0x323950(0x208)]);}}if(_0x19c822['length']===0x0&&_0x2b5d61[_0x323950(0x1f6)]===0x0)return console[_0x323950(0x211)](a24_0x449d3e[_0x323950(0x1f5)](_0x323950(0x204))),0x0;if(_0x389fb6[_0x323950(0x20f)])return console[_0x323950(0x211)](a24_0x449d3e['yellow'](_0x323950(0x227))),0x0;if(!_0x389fb6[_0x323950(0x220)]){if(!isInteractive())return console['error'](a24_0x449d3e['red'](_0x323950(0x1f1)),_0x323950(0x207)),console[_0x323950(0x211)](a24_0x449d3e['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x1cf449=await confirmKey(_0x323950(0x1ff)+(_0x19c822[_0x323950(0x1f6)]+_0x2b5d61[_0x323950(0x1f6)])+_0x323950(0x1fa));if(!_0x1cf449)return console['error'](a24_0x449d3e['yellow']('Aborted.'),_0x323950(0x1fd)),0x1;}const _0x4656bb=await withProgressSpinner('Pushing\x20templates...',_0x28c970=>executePush({'engage':_0x3871f9[_0x323950(0x213)]},_0x4e565c,{'progress':{'update':_0x1ddd38=>_0x28c970[_0x323950(0x20d)](_0x1ddd38)}}),{'verbose':_0x389fb6[_0x323950(0x1f7)]}),_0xe1e520=_0x4656bb['data'];for(const _0x2de510 of _0xe1e520['results']){if(_0x2de510[_0x323950(0x209)]&&(_0x2de510[_0x323950(0x1fb)]==='created'||_0x2de510['action']===_0x323950(0x1f9))){const _0x496b34=getTemplateUrl(_0x389fb6[_0x323950(0x20b)],_0x1433eb,_0x2de510[_0x323950(0x209)]),_0x1f985b=_0x2de510[_0x323950(0x1fb)]===_0x323950(0x216)?'+':'~',_0x54c0aa=_0x2de510[_0x323950(0x1fb)]===_0x323950(0x216)?a24_0x449d3e[_0x323950(0x1f5)](_0x1f985b):a24_0x449d3e[_0x323950(0x21f)](_0x1f985b);console[_0x323950(0x211)]('\x20\x20'+_0x54c0aa+'\x20'+hyperlink(_0x2de510[_0x323950(0x208)],_0x496b34)+'\x20'+a24_0x449d3e['dim'](_0x496b34));}}_0xe1e520[_0x323950(0x216)]>0x0&&console[_0x323950(0x211)](a24_0x449d3e[_0x323950(0x1f5)]('βœ”\x20Created\x20'+_0xe1e520[_0x323950(0x216)]+_0x323950(0x21e)));_0xe1e520['updated']>0x0&&console['error'](a24_0x449d3e[_0x323950(0x1f5)]('βœ”\x20Updated\x20'+_0xe1e520[_0x323950(0x1f9)]+_0x323950(0x21e)));if(_0xe1e520[_0x323950(0x21b)]['length']>0x0){console[_0x323950(0x211)](a24_0x449d3e['red']('✘\x20'+_0xe1e520[_0x323950(0x21b)][_0x323950(0x1f6)]+'\x20errors:'));for(const _0x2978e2 of _0xe1e520[_0x323950(0x21b)]){console['error']('\x20\x20'+a24_0x449d3e['red'](_0x2978e2[_0x323950(0x208)])+':\x20'+_0x2978e2[_0x323950(0x211)]);}}return saveSessionContext({'engage_workspace':_0x3a4645},_0x389fb6[_0x323950(0x223)]),_0xe1e520[_0x323950(0x21b)][_0x323950(0x1f6)]>0x0?0x1:0x0;}}
@@ -1 +1 @@
1
- const a25_0x21cc05=a25_0x25a1;(function(_0x4dcbfb,_0x265ced){const _0x5ec406=a25_0x25a1,_0x349187=_0x4dcbfb();while(!![]){try{const _0x1c143c=-parseInt(_0x5ec406(0xcc))/0x1+-parseInt(_0x5ec406(0xbd))/0x2+-parseInt(_0x5ec406(0xd0))/0x3+parseInt(_0x5ec406(0xbc))/0x4*(parseInt(_0x5ec406(0xcf))/0x5)+parseInt(_0x5ec406(0xac))/0x6+parseInt(_0x5ec406(0xce))/0x7+parseInt(_0x5ec406(0xbf))/0x8*(-parseInt(_0x5ec406(0xb5))/0x9);if(_0x1c143c===_0x265ced)break;else _0x349187['push'](_0x349187['shift']());}catch(_0x47ce3f){_0x349187['push'](_0x349187['shift']());}}}(a25_0x819c,0x75f36));import{BaseCommand}from'./command.js';import{findYamlFiles,isYamlFile}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a25_0x991f4 from'chalk';function a25_0x25a1(_0x44f8a0,_0x360b48){_0x44f8a0=_0x44f8a0-0xa4;const _0x819cda=a25_0x819c();let _0x25a1c8=_0x819cda[_0x44f8a0];return _0x25a1c8;}function a25_0x819c(){const _0x3b705e=['\x20(skipped:\x20','βœ”\x20All\x20','Validate\x20template\x20YAML\x20files','Error:\x20Directory\x20not\x20found:\x20','red','reason','3447222ZwyjhA','\x20non-template\x20file(s)\x20skipped','\x20valid','dim','warningCount','.yml','endsWith','green','\x20template(s)\x20valid','9UggrFx','log','\x20warning(s)\x20found','error','\x20non-template\x20file(s)\x20skipped)','warnings','description','1912848BBwCBM','339948OGRHaP','length','3624232AlaFZs','yellow','relativePath','verbose','No\x20template\x20YAML\x20files\x20found\x20in\x20','name','skippedCount','validCount','\x20template(s)\x20with\x20errors,\x20','invalidCount','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','execute','\x20error(s)','298592RmlWWC','template','4336654qSVucw','5dQjnKb','802650XBIchy','.yaml','\x20warning(s)','valid'];a25_0x819c=function(){return _0x3b705e;};return a25_0x819c();}import a25_0x4ab48e 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_0x21cc05(0xc4)]='engage:template:validate';[a25_0x21cc05(0xbb)]=a25_0x21cc05(0xa8);async[a25_0x21cc05(0xca)](_0x5579ec){const _0xb51add=a25_0x21cc05,{options:_0x152cec,args:_0x348522}=_0x5579ec,_0xdd1bd6=_0x152cec,_0xfd857d=_0x348522[0x0],_0x1cc318=_0xfd857d?a25_0x4ab48e['resolve'](_0xfd857d):undefined,_0x1abe5c=_0x1cc318?isYamlFile(_0x1cc318):![];let _0x436d08,_0x366ddf;if(_0x1abe5c&&_0x1cc318)_0x436d08=a25_0x4ab48e['dirname'](_0x1cc318),_0x366ddf=_0x1cc318;else _0x1cc318?_0x436d08=_0x1cc318:_0x436d08=process['cwd']();if(!_0x366ddf&&!existsSync(_0x436d08))return console['error'](a25_0x991f4[_0xb51add(0xaa)](_0xb51add(0xa9)+_0x436d08+'\x0a')),0x1;let _0x1a8296;if(_0x366ddf){if(!_0x366ddf[_0xb51add(0xb2)](_0xb51add(0xb1))&&!_0x366ddf[_0xb51add(0xb2)](_0xb51add(0xd1)))return console['error'](a25_0x991f4[_0xb51add(0xaa)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x366ddf+'\x0a')),0x1;_0x1a8296=[_0x366ddf];}else _0x1a8296=findYamlFiles(_0x436d08);if(_0x1a8296[_0xb51add(0xbe)]===0x0)return console[_0xb51add(0xb8)](a25_0x991f4[_0xb51add(0xaa)](_0xb51add(0xc9)+_0x436d08+'\x0a')),0x1;const _0x46d740=validateYamlFiles(_0x1a8296,_0x436d08,{'filterType':_0xb51add(0xcd)}),_0x27b32e=calculateSummary(_0x46d740),_0x2bb549=_0x46d740['filter'](isValidationResult);if(_0x2bb549[_0xb51add(0xbe)]===0x0)return console['error'](a25_0x991f4[_0xb51add(0xc0)](_0xb51add(0xc3)+_0x436d08+'\x0a')),_0x27b32e[_0xb51add(0xc5)]>0x0&&console[_0xb51add(0xb8)](a25_0x991f4[_0xb51add(0xaf)]('('+_0x27b32e[_0xb51add(0xc5)]+_0xb51add(0xb9))),0x0;for(const _0x414a1c of _0x46d740){if(!isValidationResult(_0x414a1c)){_0xdd1bd6[_0xb51add(0xc2)]&&console[_0xb51add(0xb6)](a25_0x991f4[_0xb51add(0xaf)]('-\x20'+_0x414a1c[_0xb51add(0xc1)]+_0xb51add(0xa6)+_0x414a1c[_0xb51add(0xab)]+')'));continue;}const {relativePath:_0x1d3349,source:_0x63e8b2,result:_0x5b0327}=_0x414a1c;if(_0x5b0327['valid']&&_0x5b0327[_0xb51add(0xba)]['length']===0x0)_0xdd1bd6['verbose']&&console['log'](a25_0x991f4[_0xb51add(0xb3)]('βœ”\x20'+_0x1d3349));else _0x5b0327[_0xb51add(0xa5)]?(console[_0xb51add(0xb6)](a25_0x991f4[_0xb51add(0xc0)]('⚠\x20'+_0x1d3349+':\x20'+_0x5b0327[_0xb51add(0xba)][_0xb51add(0xbe)]+_0xb51add(0xa4))),console[_0xb51add(0xb6)](formatValidationResult(_0x5b0327,_0x63e8b2,_0x1d3349))):(console[_0xb51add(0xb6)](a25_0x991f4[_0xb51add(0xaa)]('βœ–\x20'+_0x1d3349+':\x20'+_0x5b0327['errors'][_0xb51add(0xbe)]+_0xb51add(0xcb))),console[_0xb51add(0xb6)](formatValidationResult(_0x5b0327,_0x63e8b2,_0x1d3349)));}return console[_0xb51add(0xb6)](''),_0x27b32e['hasErrors']?(console[_0xb51add(0xb6)](a25_0x991f4[_0xb51add(0xaa)]('Validation\x20failed:\x20'+_0x27b32e[_0xb51add(0xc8)]+_0xb51add(0xc7)+_0x27b32e[_0xb51add(0xc6)]+_0xb51add(0xae))),_0x27b32e['warningCount']>0x0&&console[_0xb51add(0xb6)](a25_0x991f4[_0xb51add(0xc0)](_0x27b32e[_0xb51add(0xb0)]+'\x20warning(s)\x20found')),_0x27b32e['skippedCount']>0x0&&console[_0xb51add(0xb6)](a25_0x991f4['dim'](_0x27b32e[_0xb51add(0xc5)]+_0xb51add(0xad))),0x1):(console[_0xb51add(0xb6)](a25_0x991f4[_0xb51add(0xb3)](_0xb51add(0xa7)+_0x27b32e[_0xb51add(0xc6)]+_0xb51add(0xb4))),_0x27b32e['warningCount']>0x0&&console[_0xb51add(0xb6)](a25_0x991f4['yellow'](_0x27b32e[_0xb51add(0xb0)]+_0xb51add(0xb7))),_0x27b32e[_0xb51add(0xc5)]>0x0&&console['log'](a25_0x991f4['dim'](_0x27b32e[_0xb51add(0xc5)]+_0xb51add(0xad))),0x0);}}
1
+ const a25_0x25fdb0=a25_0x1867;function a25_0x347a(){const _0x1b67e8=['180874XxYKzR','validCount','\x20valid','cwd','reason','green','No\x20template\x20YAML\x20files\x20found\x20in\x20','12SEUQVb','\x20non-template\x20file(s)\x20skipped','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','25RkKWGl','.yaml','\x20warning(s)\x20found','red','202600PXCiuV','\x20template(s)\x20with\x20errors,\x20','419020UYkvto','βœ”\x20All\x20','description','562340aeJqZU','resolve','error','warningCount','dirname','template','Error:\x20Directory\x20not\x20found:\x20','relativePath','Validate\x20template\x20YAML\x20files','log','name','9810kMTtfh','warnings','1882990zqvTsg','filter','engage:template:validate','yellow','skippedCount','hasErrors','errors','99040IggbLj','\x20non-template\x20file(s)\x20skipped)','length','valid','\x20template(s)\x20valid','9lCnMFQ','dim','33iITuNr'];a25_0x347a=function(){return _0x1b67e8;};return a25_0x347a();}(function(_0x77bb65,_0x4c42e0){const _0x5b9441=a25_0x1867,_0x395124=_0x77bb65();while(!![]){try{const _0x315270=-parseInt(_0x5b9441(0x96))/0x1+parseInt(_0x5b9441(0x9e))/0x2*(-parseInt(_0x5b9441(0xa5))/0x3)+parseInt(_0x5b9441(0x82))/0x4+parseInt(_0x5b9441(0xa8))/0x5*(-parseInt(_0x5b9441(0x8d))/0x6)+parseInt(_0x5b9441(0xae))/0x7+parseInt(_0x5b9441(0xac))/0x8*(-parseInt(_0x5b9441(0x9b))/0x9)+parseInt(_0x5b9441(0x8f))/0xa*(parseInt(_0x5b9441(0x9d))/0xb);if(_0x315270===_0x4c42e0)break;else _0x395124['push'](_0x395124['shift']());}catch(_0x130579){_0x395124['push'](_0x395124['shift']());}}}(a25_0x347a,0x422ce));import{BaseCommand}from'./command.js';import{findYamlFiles,isYamlFile}from'../sdk/segment/file-discovery.js';function a25_0x1867(_0x2949f9,_0x40e303){_0x2949f9=_0x2949f9-0x82;const _0x347aac=a25_0x347a();let _0x18678c=_0x347aac[_0x2949f9];return _0x18678c;}import{existsSync}from'fs';import a25_0x3e59a5 from'chalk';import a25_0x296dac 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_0x25fdb0(0x8c)]=a25_0x25fdb0(0x91);[a25_0x25fdb0(0xb0)]=a25_0x25fdb0(0x8a);async['execute'](_0x4d06ba){const _0xed2064=a25_0x25fdb0,{options:_0x24c9ec,args:_0x5da8c3}=_0x4d06ba,_0x47b020=_0x24c9ec,_0x9a897=_0x5da8c3[0x0],_0x2d15f0=_0x9a897?a25_0x296dac[_0xed2064(0x83)](_0x9a897):undefined,_0x29d4a3=_0x2d15f0?isYamlFile(_0x2d15f0):![];let _0x3c150a,_0x17fc13;if(_0x29d4a3&&_0x2d15f0)_0x3c150a=a25_0x296dac[_0xed2064(0x86)](_0x2d15f0),_0x17fc13=_0x2d15f0;else _0x2d15f0?_0x3c150a=_0x2d15f0:_0x3c150a=process[_0xed2064(0xa1)]();if(!_0x17fc13&&!existsSync(_0x3c150a))return console[_0xed2064(0x84)](a25_0x3e59a5['red'](_0xed2064(0x88)+_0x3c150a+'\x0a')),0x1;let _0xd167f3;if(_0x17fc13){if(!_0x17fc13['endsWith']('.yml')&&!_0x17fc13['endsWith'](_0xed2064(0xa9)))return console['error'](a25_0x3e59a5[_0xed2064(0xab)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x17fc13+'\x0a')),0x1;_0xd167f3=[_0x17fc13];}else _0xd167f3=findYamlFiles(_0x3c150a);if(_0xd167f3['length']===0x0)return console[_0xed2064(0x84)](a25_0x3e59a5[_0xed2064(0xab)](_0xed2064(0xa7)+_0x3c150a+'\x0a')),0x1;const _0x3bfc7f=validateYamlFiles(_0xd167f3,_0x3c150a,{'filterType':_0xed2064(0x87)}),_0x5f0cbe=calculateSummary(_0x3bfc7f),_0x5b2ebc=_0x3bfc7f[_0xed2064(0x90)](isValidationResult);if(_0x5b2ebc[_0xed2064(0x98)]===0x0)return console['error'](a25_0x3e59a5[_0xed2064(0x92)](_0xed2064(0xa4)+_0x3c150a+'\x0a')),_0x5f0cbe[_0xed2064(0x93)]>0x0&&console[_0xed2064(0x84)](a25_0x3e59a5[_0xed2064(0x9c)]('('+_0x5f0cbe[_0xed2064(0x93)]+_0xed2064(0x97))),0x0;for(const _0x3934c7 of _0x3bfc7f){if(!isValidationResult(_0x3934c7)){_0x47b020['verbose']&&console[_0xed2064(0x8b)](a25_0x3e59a5[_0xed2064(0x9c)]('-\x20'+_0x3934c7[_0xed2064(0x89)]+'\x20(skipped:\x20'+_0x3934c7[_0xed2064(0xa2)]+')'));continue;}const {relativePath:_0x4e9d78,source:_0x212466,result:_0x7a4dbb}=_0x3934c7;if(_0x7a4dbb[_0xed2064(0x99)]&&_0x7a4dbb['warnings'][_0xed2064(0x98)]===0x0)_0x47b020['verbose']&&console[_0xed2064(0x8b)](a25_0x3e59a5[_0xed2064(0xa3)]('βœ”\x20'+_0x4e9d78));else _0x7a4dbb[_0xed2064(0x99)]?(console[_0xed2064(0x8b)](a25_0x3e59a5[_0xed2064(0x92)]('⚠\x20'+_0x4e9d78+':\x20'+_0x7a4dbb[_0xed2064(0x8e)][_0xed2064(0x98)]+'\x20warning(s)')),console['log'](formatValidationResult(_0x7a4dbb,_0x212466,_0x4e9d78))):(console[_0xed2064(0x8b)](a25_0x3e59a5[_0xed2064(0xab)]('βœ–\x20'+_0x4e9d78+':\x20'+_0x7a4dbb[_0xed2064(0x95)]['length']+'\x20error(s)')),console[_0xed2064(0x8b)](formatValidationResult(_0x7a4dbb,_0x212466,_0x4e9d78)));}return console['log'](''),_0x5f0cbe[_0xed2064(0x94)]?(console[_0xed2064(0x8b)](a25_0x3e59a5[_0xed2064(0xab)]('Validation\x20failed:\x20'+_0x5f0cbe['invalidCount']+_0xed2064(0xad)+_0x5f0cbe[_0xed2064(0x9f)]+_0xed2064(0xa0))),_0x5f0cbe[_0xed2064(0x85)]>0x0&&console['log'](a25_0x3e59a5['yellow'](_0x5f0cbe[_0xed2064(0x85)]+_0xed2064(0xaa))),_0x5f0cbe[_0xed2064(0x93)]>0x0&&console[_0xed2064(0x8b)](a25_0x3e59a5[_0xed2064(0x9c)](_0x5f0cbe[_0xed2064(0x93)]+'\x20non-template\x20file(s)\x20skipped')),0x1):(console['log'](a25_0x3e59a5[_0xed2064(0xa3)](_0xed2064(0xaf)+_0x5f0cbe['validCount']+_0xed2064(0x9a))),_0x5f0cbe[_0xed2064(0x85)]>0x0&&console['log'](a25_0x3e59a5['yellow'](_0x5f0cbe[_0xed2064(0x85)]+_0xed2064(0xaa))),_0x5f0cbe[_0xed2064(0x93)]>0x0&&console[_0xed2064(0x8b)](a25_0x3e59a5[_0xed2064(0x9c)](_0x5f0cbe[_0xed2064(0x93)]+_0xed2064(0xa6))),0x0);}}
@@ -1 +1 @@
1
- const a26_0xfd6530=a26_0x4f30;(function(_0x5782d6,_0x34a635){const _0xd5ec08=a26_0x4f30,_0x506880=_0x5782d6();while(!![]){try{const _0x3a6947=parseInt(_0xd5ec08(0xba))/0x1+parseInt(_0xd5ec08(0xf1))/0x2+parseInt(_0xd5ec08(0xe5))/0x3*(-parseInt(_0xd5ec08(0xf2))/0x4)+-parseInt(_0xd5ec08(0xf3))/0x5*(parseInt(_0xd5ec08(0xca))/0x6)+parseInt(_0xd5ec08(0x110))/0x7+-parseInt(_0xd5ec08(0xc3))/0x8+parseInt(_0xd5ec08(0xda))/0x9;if(_0x3a6947===_0x34a635)break;else _0x506880['push'](_0x506880['shift']());}catch(_0x1b4fb8){_0x506880['push'](_0x506880['shift']());}}}(a26_0x3c31,0xd3469));function a26_0x4f30(_0x36b707,_0x14b112){_0x36b707=_0x36b707-0xb7;const _0x3c3116=a26_0x3c31();let _0x4f3008=_0x3c3116[_0x36b707];return _0x4f3008;}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_0x48eed4 from'chalk';function formatDuration(_0x9b2736){const _0x5b168e=a26_0x4f30;if(_0x9b2736<0x3c)return _0x9b2736+'s';if(_0x9b2736<0xe10)return Math[_0x5b168e(0x10f)](_0x9b2736/0x3c)+'m\x20'+_0x9b2736%0x3c+'s';const _0x368f32=Math[_0x5b168e(0x10f)](_0x9b2736/0xe10),_0x9eeb14=Math[_0x5b168e(0x10f)](_0x9b2736%0xe10/0x3c);return _0x9eeb14>0x0?_0x368f32+'h\x20'+_0x9eeb14+'m':_0x368f32+'h';}function formatRelativeTime(_0x5ac7ed){const _0x516be8=a26_0x4f30,_0x1ebefc=Date[_0x516be8(0x100)]()-_0x5ac7ed[_0x516be8(0xf0)](),_0x4cbfc1=Math['floor'](Math[_0x516be8(0x105)](_0x1ebefc)/0x3e8);if(_0x4cbfc1<0x3c)return _0x516be8(0x104);const _0x19c1c4=Math[_0x516be8(0x10f)](_0x4cbfc1/0x3c);if(_0x19c1c4<0x3c)return _0x19c1c4+_0x516be8(0xe8);const _0x2454d8=Math[_0x516be8(0x10f)](_0x19c1c4/0x3c);if(_0x2454d8<0x18)return _0x2454d8+_0x516be8(0xbe);const _0x3ad262=Math['floor'](_0x2454d8/0x18);if(_0x3ad262<0x1e)return _0x3ad262+'d\x20ago';return Math[_0x516be8(0x10f)](_0x3ad262/0x1e)+_0x516be8(0x107);}export class JobListCommand extends BaseCommand{[a26_0xfd6530(0xc2)]='jobs';['description']=a26_0xfd6530(0xfb);async[a26_0xfd6530(0xde)](_0x1ad5fd){const _0x8f683b=a26_0xfd6530,{options:_0x5bd447,tdx:_0x4c8eef}=_0x1ad5fd,_0x333b09=resolveLimit(_0x5bd447[_0x8f683b(0xb9)],DEFAULT_DISPLAY_LIMIT),_0x47e60c=_0x5bd447['status'];_0x5bd447[_0x8f683b(0xd4)]&&(console[_0x8f683b(0xf7)](_0x8f683b(0xbb)+_0x333b09+_0x8f683b(0xd6)),_0x47e60c&&console['error'](_0x8f683b(0xd2)+_0x47e60c));const _0x5cbc5a=await withSpinner(_0x8f683b(0x101),()=>_0x4c8eef['jobs'][_0x8f683b(0xc1)]({'from':0x0,'to':_0x333b09-0x1,'status':_0x47e60c}),{'verbose':_0x5bd447[_0x8f683b(0xd4)]}),_0xa32d79=_0x5cbc5a[_0x8f683b(0x10d)];console['error']('βœ”\x20Found\x20'+_0xa32d79['length']+'\x20job'+(_0xa32d79['length']!==0x1?'s':''));const _0x54d61c=_0x5bd447[_0x8f683b(0xdf)];if(isStructuredFormat(_0x5bd447)){const _0x8b7c3=_0xa32d79[_0x8f683b(0xdb)](_0x12aefa=>{const _0x107de2=_0x8f683b;let _0x233e8d;if(_0x12aefa[_0x107de2(0x10c)]&&_0x12aefa[_0x107de2(0xf5)]){const _0x2368d3=new Date(_0x12aefa['start_at'])[_0x107de2(0xf0)](),_0x1a9a68=new Date(_0x12aefa['end_at'])['getTime']();_0x233e8d=Math[_0x107de2(0xe3)]((_0x1a9a68-_0x2368d3)/0x3e8);}return{'job_id':_0x12aefa[_0x107de2(0xed)],'type':_0x12aefa[_0x107de2(0xe6)]===_0x107de2(0xc6)?_0x107de2(0xf4):_0x12aefa[_0x107de2(0xe6)],'status':_0x12aefa[_0x107de2(0xbc)],'user_name':_0x12aefa[_0x107de2(0xe1)],'duration_sec':_0x233e8d,'created_at':_0x12aefa[_0x107de2(0x10b)],'started_at':_0x12aefa['start_at'],'end_at':_0x12aefa[_0x107de2(0xf5)]};});await handleSDKOutput(_0x8b7c3,_0x5bd447);}else for(const _0x1a2816 of _0xa32d79){const _0x219a2f=_0x1a2816[_0x8f683b(0xbc)]===_0x8f683b(0xd0)?a26_0x48eed4['green']:_0x1a2816[_0x8f683b(0xbc)]==='error'?a26_0x48eed4[_0x8f683b(0xfd)]:a26_0x48eed4[_0x8f683b(0xc4)],_0x1aa982=_0x219a2f(_0x1a2816[_0x8f683b(0xbc)]),_0x511013=getJobUrl(_0x54d61c,_0x1a2816['job_id']),_0x1e5538=hyperlink(_0x1a2816[_0x8f683b(0xed)],_0x511013),_0x19518e=a26_0x48eed4[_0x8f683b(0xc4)](_0x1a2816[_0x8f683b(0xe6)]===_0x8f683b(0xc6)?_0x8f683b(0xf4):_0x1a2816['type']),_0x420e57=[];if(_0x1a2816[_0x8f683b(0x10c)]&&_0x1a2816['end_at']){const _0x2ca8ff=Math['round']((new Date(_0x1a2816[_0x8f683b(0xf5)])['getTime']()-new Date(_0x1a2816[_0x8f683b(0x10c)])[_0x8f683b(0xf0)]())/0x3e8);_0x420e57[_0x8f683b(0x102)](formatDuration(_0x2ca8ff));}if(_0x1a2816[_0x8f683b(0xf5)])_0x420e57[_0x8f683b(0x102)](formatRelativeTime(new Date(_0x1a2816[_0x8f683b(0xf5)])));else _0x1a2816['start_at']&&_0x420e57[_0x8f683b(0x102)](formatRelativeTime(new Date(_0x1a2816[_0x8f683b(0x10c)])));const _0x4680ec=_0x420e57[_0x8f683b(0xd3)]>0x0?a26_0x48eed4['dim']('\x20'+_0x420e57['join'](',\x20')):'';console['log']('⚑\x20'+_0x1e5538+'\x20'+_0x19518e+'\x20'+_0x1aa982+_0x4680ec);}return 0x0;}}export class JobShowCommand extends BaseCommand{[a26_0xfd6530(0xc2)]=a26_0xfd6530(0xcc);[a26_0xfd6530(0xd7)]=a26_0xfd6530(0xf9);['validate'](_0x334a69){const _0x807646=_0x334a69['args'][0x0];if(!_0x807646)return'Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20show\x20<job-id>';return undefined;}async[a26_0xfd6530(0xde)](_0x31283a){const _0x2ac926=a26_0xfd6530,{options:_0x13f703,args:_0x58ae09,tdx:_0x154f5d}=_0x31283a,_0x2e2d02=_0x58ae09[0x0],_0x4e476b=await withSpinner(_0x2ac926(0xcf),()=>_0x154f5d[_0x2ac926(0xc7)][_0x2ac926(0x10a)](_0x2e2d02),{'verbose':_0x13f703[_0x2ac926(0xd4)]}),_0x3d5aa6=_0x4e476b[_0x2ac926(0x10d)];let _0x190c1c;if(_0x3d5aa6[_0x2ac926(0x10c)]&&_0x3d5aa6[_0x2ac926(0xf5)]){const _0x475e96=new Date(_0x3d5aa6[_0x2ac926(0x10c)])[_0x2ac926(0xf0)](),_0x24fd64=new Date(_0x3d5aa6[_0x2ac926(0xf5)])[_0x2ac926(0xf0)]();_0x190c1c=Math[_0x2ac926(0xe3)]((_0x24fd64-_0x475e96)/0x3e8);}const _0x13ebb4={'job_id':_0x3d5aa6[_0x2ac926(0xed)],'type':_0x3d5aa6[_0x2ac926(0xe6)],'status':_0x3d5aa6['status'],..._0x3d5aa6[_0x2ac926(0xe1)]&&{'user_name':_0x3d5aa6['user_name']},..._0x190c1c!==undefined&&{'duration_sec':_0x190c1c},..._0x3d5aa6['created_at']&&{'created_at':_0x3d5aa6[_0x2ac926(0x10b)]},..._0x3d5aa6['start_at']&&{'started_at':_0x3d5aa6[_0x2ac926(0x10c)]},..._0x3d5aa6[_0x2ac926(0xf5)]&&{'end_at':_0x3d5aa6[_0x2ac926(0xf5)]},..._0x3d5aa6['database']&&{'database':_0x3d5aa6[_0x2ac926(0xdd)]},..._0x3d5aa6[_0x2ac926(0xd8)]!==undefined&&{'priority':_0x3d5aa6[_0x2ac926(0xd8)]},..._0x3d5aa6[_0x2ac926(0xfa)]&&{'url':_0x3d5aa6['url']},..._0x3d5aa6[_0x2ac926(0xcb)]&&{'query':_0x3d5aa6[_0x2ac926(0xcb)]},..._0x3d5aa6['debug']&&{'debug':_0x3d5aa6[_0x2ac926(0xc0)]}};return await handleSingleObjectOutput(_0x13ebb4,_0x13f703),0x0;}}export class JobKillCommand extends BaseCommand{[a26_0xfd6530(0xc2)]=a26_0xfd6530(0xe7);[a26_0xfd6530(0xd7)]=a26_0xfd6530(0xef);[a26_0xfd6530(0xbf)](_0x1d7713){const _0x26d013=a26_0xfd6530,_0xa248c4=_0x1d7713[_0x26d013(0xf8)][0x0];if(!_0xa248c4)return'Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20kill\x20<job-id>';return undefined;}async[a26_0xfd6530(0xde)](_0x3b364e){const _0xb4a0d4=a26_0xfd6530,{options:_0x45d2da,args:_0x1dd2c0,tdx:_0x514aa4}=_0x3b364e,_0x58de36=_0x1dd2c0[0x0];if(!_0x45d2da[_0xb4a0d4(0xb8)]){const _0x58697d=await confirm(_0xb4a0d4(0xcd)+_0x58de36+'?');if(!_0x58697d)return console[_0xb4a0d4(0xf7)](_0xb4a0d4(0xd9)),0x0;}return await withSpinner(_0xb4a0d4(0xc8),()=>_0x514aa4[_0xb4a0d4(0xc7)]['kill'](_0x58de36),{'verbose':_0x45d2da[_0xb4a0d4(0xd4)]}),console[_0xb4a0d4(0xf7)](_0xb4a0d4(0xd5)+_0x58de36),console['error']('\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20'+_0x58de36+'\x27\x20to\x20verify\x20the\x20job\x20status'),0x0;}}export class JobSubmitCommand extends BaseCommand{[a26_0xfd6530(0xc2)]=a26_0xfd6530(0xea);[a26_0xfd6530(0xd7)]=a26_0xfd6530(0x108);async['execute'](_0x585734){const _0x5017e0=a26_0xfd6530,{options:_0x5c0015,args:_0x5d66f2,tdx:_0x4bf261}=_0x585734,_0x3044f9=_0x5c0015[_0x5017e0(0xc9)]||_0x5017e0(0xf4),_0x451fa2=_0x5c0015[_0x5017e0(0xbd)],_0x3eb99f=_0x5c0015[_0x5017e0(0xdd)]||'information_schema',_0x3897c4=_0x5c0015[_0x5017e0(0xec)];if(_0x3044f9!==_0x5017e0(0xf4)&&_0x3044f9!==_0x5017e0(0xb7))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x5017e0(0xee));let _0x47bd99;if(_0x451fa2){if(_0x5d66f2[0x0])throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x5017e0(0xc5));const _0x399954=readSqlStatementsFromFile(_0x451fa2);if(_0x399954[_0x5017e0(0xd3)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x5017e0(0xdc));if(_0x399954[_0x5017e0(0xd3)]>0x1)throw new SDKError(ErrorCode[_0x5017e0(0xfe)],_0x5017e0(0x103));_0x47bd99=_0x399954[0x0];}else{if(!_0x5d66f2[0x0])throw new SDKError(ErrorCode[_0x5017e0(0xfe)],_0x5017e0(0x10e));_0x47bd99=_0x5d66f2[0x0];}_0x5c0015[_0x5017e0(0xd4)]&&(console[_0x5017e0(0xf7)](_0x5017e0(0x106)+_0x3044f9),console['error'](_0x5017e0(0xfc)+_0x3eb99f),console['error'](_0x5017e0(0x109)+_0x47bd99['substring'](0x0,0x64)+(_0x47bd99[_0x5017e0(0xd3)]>0x64?_0x5017e0(0xe0):'')));const _0x8f772f=await withSpinner(_0x5017e0(0xeb),()=>_0x4bf261[_0x5017e0(0xc7)][_0x5017e0(0xe2)](_0x3eb99f,_0x47bd99,_0x3044f9,_0x3897c4),{'verbose':_0x5c0015['verbose']}),_0xde28af=_0x8f772f[_0x5017e0(0x10d)];return console['error'](_0x5017e0(0xff)),console[_0x5017e0(0xf7)]('\x20\x20Job\x20ID:\x20'+_0xde28af[_0x5017e0(0xed)]),await handleSDKOutput([_0xde28af],_0x5c0015),0x0;}}function a26_0x3c31(){const _0x3a8777=['h\x20ago','validate','debug','list','name','10905520JrTMLV','dim','Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','presto','jobs','Submitting\x20kill\x20request...','jobType','12PYoSFx','query','job:show','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','Get\x20job\x20results','Getting\x20job\x20details...','success','job:result','Status\x20filter:\x20','length','verbose','βœ”\x20Kill\x20request\x20submitted\x20for\x20job\x20','\x20jobs','description','priority','Cancelled','20998116CEvZxG','map','No\x20SQL\x20statements\x20found\x20in\x20file','database','execute','site','...','user_name','submit','round','βœ”\x20Retrieved\x20','3982008JxAQzn','type','job:kill','m\x20ago','\x20row','job:submit','Submitting\x20job...','result','job_id','--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','Kill\x20a\x20job','getTime','2543866bYhCEN','4kmioOe','3859105TUqOnr','trino','end_at','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20result\x20<job-id>','error','args','Show\x20job\x20details','url','List\x20jobs','Database:\x20','red','INVALID_ARGUMENT','βœ”\x20Job\x20submitted','now','Listing\x20jobs...','push','Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','just\x20now','abs','Job\x20type:\x20','mo\x20ago','Submit\x20a\x20job','Query:\x20','show','created_at','start_at','data','Query\x20is\x20required\x0aUsage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','floor','9543030vLaZVH','hive','yes','limit','131206Hkcczk','Limit:\x20','status','file'];a26_0x3c31=function(){return _0x3a8777;};return a26_0x3c31();}export class JobResultCommand extends BaseCommand{[a26_0xfd6530(0xc2)]=a26_0xfd6530(0xd1);['description']=a26_0xfd6530(0xce);[a26_0xfd6530(0xbf)](_0x37b155){const _0x4d7b0b=a26_0xfd6530,_0x411fcc=_0x37b155['args'][0x0];if(!_0x411fcc)return _0x4d7b0b(0xf6);return undefined;}async['execute'](_0x1d5a35){const _0x36618b=a26_0xfd6530,{options:_0x3a99a3,args:_0x547c27,tdx:_0x47b068}=_0x1d5a35,_0x1fb310=_0x547c27[0x0],_0xd3abe4=await withSpinner('Getting\x20job\x20results...',()=>_0x47b068[_0x36618b(0xc7)][_0x36618b(0xec)](_0x1fb310),{'verbose':_0x3a99a3['verbose']}),_0x40b8b2=_0xd3abe4[_0x36618b(0x10d)];return console[_0x36618b(0xf7)](_0x36618b(0xe4)+_0x40b8b2['length']+_0x36618b(0xe9)+(_0x40b8b2[_0x36618b(0xd3)]!==0x1?'s':'')),await handleSDKOutput(_0x40b8b2,_0x3a99a3),0x0;}}
1
+ function a26_0x3b4d(_0x28ed04,_0x4fce9f){_0x28ed04=_0x28ed04-0x1d3;const _0x55b909=a26_0x55b9();let _0x3b4de7=_0x55b909[_0x28ed04];return _0x3b4de7;}const a26_0xf2cfb3=a26_0x3b4d;(function(_0x39a297,_0x448084){const _0x18725f=a26_0x3b4d,_0x3aea4d=_0x39a297();while(!![]){try{const _0x153a8a=-parseInt(_0x18725f(0x20c))/0x1*(parseInt(_0x18725f(0x20d))/0x2)+-parseInt(_0x18725f(0x21f))/0x3+-parseInt(_0x18725f(0x1d8))/0x4+parseInt(_0x18725f(0x1d6))/0x5+parseInt(_0x18725f(0x1fe))/0x6*(-parseInt(_0x18725f(0x1df))/0x7)+-parseInt(_0x18725f(0x215))/0x8+parseInt(_0x18725f(0x216))/0x9;if(_0x153a8a===_0x448084)break;else _0x3aea4d['push'](_0x3aea4d['shift']());}catch(_0x186e1d){_0x3aea4d['push'](_0x3aea4d['shift']());}}}(a26_0x55b9,0x8c07e));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_0x3ffb54 from'chalk';function a26_0x55b9(){const _0x55def5=['length','yes','jobs','Status\x20filter:\x20','\x20row','query','round','7601poSkFe','244lwTbQb','Submitting\x20kill\x20request...','getTime','just\x20now','job:kill','Cancelled','h\x20ago','information_schema','3664968rVmYkr','26697411SFATwp','βœ”\x20Found\x20','Show\x20job\x20details','status','INVALID_ARGUMENT','type','Job\x20type:\x20','\x20\x20Job\x20ID:\x20','description','3179259VkALTe','submit','trino','green','Query:\x20','Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','result','Get\x20job\x20results','file','Listing\x20jobs...','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20result\x20<job-id>','debug','join','Database:\x20','3000170HsTKYn','\x27\x20to\x20verify\x20the\x20job\x20status','963188RGwAzV','execute','job_id','database','Query\x20is\x20required\x0aUsage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','presto','Getting\x20job\x20results...','1073989jAYjDP','end_at','Submit\x20a\x20job','floor','data','validate','...','βœ”\x20Kill\x20request\x20submitted\x20for\x20job\x20','Getting\x20job\x20details...','--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','priority','βœ”\x20Retrieved\x20','args','jobType','list','show','Kill\x20a\x20job','url','m\x20ago','hive','push','now','error','kill','Limit:\x20','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20show\x20<job-id>','success','verbose','created_at','\x20job','start_at','12AMPxEN','log','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','job:submit','map','name','Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.'];a26_0x55b9=function(){return _0x55def5;};return a26_0x55b9();}function formatDuration(_0x2ed21a){const _0x2e5b77=a26_0x3b4d;if(_0x2ed21a<0x3c)return _0x2ed21a+'s';if(_0x2ed21a<0xe10)return Math[_0x2e5b77(0x1e2)](_0x2ed21a/0x3c)+'m\x20'+_0x2ed21a%0x3c+'s';const _0x5f04e0=Math[_0x2e5b77(0x1e2)](_0x2ed21a/0xe10),_0x21f1e9=Math[_0x2e5b77(0x1e2)](_0x2ed21a%0xe10/0x3c);return _0x21f1e9>0x0?_0x5f04e0+'h\x20'+_0x21f1e9+'m':_0x5f04e0+'h';}function formatRelativeTime(_0x1a7aa0){const _0x57217d=a26_0x3b4d,_0x5cf8b0=Date[_0x57217d(0x1f4)]()-_0x1a7aa0[_0x57217d(0x20f)](),_0x3a7ee9=Math[_0x57217d(0x1e2)](Math['abs'](_0x5cf8b0)/0x3e8);if(_0x3a7ee9<0x3c)return _0x57217d(0x210);const _0x44eea5=Math[_0x57217d(0x1e2)](_0x3a7ee9/0x3c);if(_0x44eea5<0x3c)return _0x44eea5+_0x57217d(0x1f1);const _0x20d792=Math['floor'](_0x44eea5/0x3c);if(_0x20d792<0x18)return _0x20d792+_0x57217d(0x213);const _0x287283=Math[_0x57217d(0x1e2)](_0x20d792/0x18);if(_0x287283<0x1e)return _0x287283+'d\x20ago';return Math['floor'](_0x287283/0x1e)+'mo\x20ago';}export class JobListCommand extends BaseCommand{['name']=a26_0xf2cfb3(0x207);[a26_0xf2cfb3(0x21e)]='List\x20jobs';async[a26_0xf2cfb3(0x1d9)](_0x2cb41d){const _0x259ea4=a26_0xf2cfb3,{options:_0x5399e0,tdx:_0x3b8d27}=_0x2cb41d,_0x50c206=resolveLimit(_0x5399e0['limit'],DEFAULT_DISPLAY_LIMIT),_0x3a6145=_0x5399e0['status'];_0x5399e0['verbose']&&(console[_0x259ea4(0x1f5)](_0x259ea4(0x1f7)+_0x50c206+'\x20jobs'),_0x3a6145&&console[_0x259ea4(0x1f5)](_0x259ea4(0x208)+_0x3a6145));const _0x514179=await withSpinner(_0x259ea4(0x228),()=>_0x3b8d27[_0x259ea4(0x207)][_0x259ea4(0x1ed)]({'from':0x0,'to':_0x50c206-0x1,'status':_0x3a6145}),{'verbose':_0x5399e0[_0x259ea4(0x1fa)]}),_0x4856aa=_0x514179[_0x259ea4(0x1e3)];console[_0x259ea4(0x1f5)](_0x259ea4(0x217)+_0x4856aa[_0x259ea4(0x205)]+_0x259ea4(0x1fc)+(_0x4856aa[_0x259ea4(0x205)]!==0x1?'s':''));const _0x57b9b7=_0x5399e0['site'];if(isStructuredFormat(_0x5399e0)){const _0x5cd084=_0x4856aa[_0x259ea4(0x202)](_0x1f77df=>{const _0x1b92b3=_0x259ea4;let _0x37bfc3;if(_0x1f77df[_0x1b92b3(0x1fd)]&&_0x1f77df[_0x1b92b3(0x1e0)]){const _0x57e542=new Date(_0x1f77df[_0x1b92b3(0x1fd)])[_0x1b92b3(0x20f)](),_0x234673=new Date(_0x1f77df[_0x1b92b3(0x1e0)])[_0x1b92b3(0x20f)]();_0x37bfc3=Math['round']((_0x234673-_0x57e542)/0x3e8);}return{'job_id':_0x1f77df[_0x1b92b3(0x1da)],'type':_0x1f77df[_0x1b92b3(0x21b)]==='presto'?_0x1b92b3(0x221):_0x1f77df['type'],'status':_0x1f77df['status'],'user_name':_0x1f77df['user_name'],'duration_sec':_0x37bfc3,'created_at':_0x1f77df['created_at'],'started_at':_0x1f77df[_0x1b92b3(0x1fd)],'end_at':_0x1f77df[_0x1b92b3(0x1e0)]};});await handleSDKOutput(_0x5cd084,_0x5399e0);}else for(const _0x944217 of _0x4856aa){const _0x5fc391=_0x944217[_0x259ea4(0x219)]===_0x259ea4(0x1f9)?a26_0x3ffb54[_0x259ea4(0x222)]:_0x944217[_0x259ea4(0x219)]===_0x259ea4(0x1f5)?a26_0x3ffb54['red']:a26_0x3ffb54['dim'],_0x5e7a46=_0x5fc391(_0x944217[_0x259ea4(0x219)]),_0x4535df=getJobUrl(_0x57b9b7,_0x944217[_0x259ea4(0x1da)]),_0xdb6f25=hyperlink(_0x944217[_0x259ea4(0x1da)],_0x4535df),_0x319d63=a26_0x3ffb54['dim'](_0x944217[_0x259ea4(0x21b)]===_0x259ea4(0x1dd)?_0x259ea4(0x221):_0x944217[_0x259ea4(0x21b)]),_0x25b3ef=[];if(_0x944217['start_at']&&_0x944217['end_at']){const _0x3c9473=Math[_0x259ea4(0x20b)]((new Date(_0x944217['end_at'])[_0x259ea4(0x20f)]()-new Date(_0x944217[_0x259ea4(0x1fd)])[_0x259ea4(0x20f)]())/0x3e8);_0x25b3ef[_0x259ea4(0x1f3)](formatDuration(_0x3c9473));}if(_0x944217['end_at'])_0x25b3ef[_0x259ea4(0x1f3)](formatRelativeTime(new Date(_0x944217[_0x259ea4(0x1e0)])));else _0x944217['start_at']&&_0x25b3ef[_0x259ea4(0x1f3)](formatRelativeTime(new Date(_0x944217[_0x259ea4(0x1fd)])));const _0x49295d=_0x25b3ef[_0x259ea4(0x205)]>0x0?a26_0x3ffb54['dim']('\x20'+_0x25b3ef[_0x259ea4(0x1d4)](',\x20')):'';console[_0x259ea4(0x1ff)]('⚑\x20'+_0xdb6f25+'\x20'+_0x319d63+'\x20'+_0x5e7a46+_0x49295d);}return 0x0;}}export class JobShowCommand extends BaseCommand{['name']='job:show';[a26_0xf2cfb3(0x21e)]=a26_0xf2cfb3(0x218);[a26_0xf2cfb3(0x1e4)](_0x5383d6){const _0x112bb1=a26_0xf2cfb3,_0x2fcc24=_0x5383d6[_0x112bb1(0x1eb)][0x0];if(!_0x2fcc24)return _0x112bb1(0x1f8);return undefined;}async['execute'](_0x1d0bab){const _0x71c996=a26_0xf2cfb3,{options:_0x46c000,args:_0x3e5f50,tdx:_0x202fb3}=_0x1d0bab,_0x56b8b5=_0x3e5f50[0x0],_0x79261c=await withSpinner(_0x71c996(0x1e7),()=>_0x202fb3[_0x71c996(0x207)][_0x71c996(0x1ee)](_0x56b8b5),{'verbose':_0x46c000[_0x71c996(0x1fa)]}),_0x26f74f=_0x79261c['data'];let _0x1d19f5;if(_0x26f74f[_0x71c996(0x1fd)]&&_0x26f74f[_0x71c996(0x1e0)]){const _0x189ced=new Date(_0x26f74f[_0x71c996(0x1fd)])[_0x71c996(0x20f)](),_0x31cb85=new Date(_0x26f74f['end_at'])[_0x71c996(0x20f)]();_0x1d19f5=Math[_0x71c996(0x20b)]((_0x31cb85-_0x189ced)/0x3e8);}const _0x44b5f6={'job_id':_0x26f74f[_0x71c996(0x1da)],'type':_0x26f74f[_0x71c996(0x21b)],'status':_0x26f74f[_0x71c996(0x219)],..._0x26f74f['user_name']&&{'user_name':_0x26f74f['user_name']},..._0x1d19f5!==undefined&&{'duration_sec':_0x1d19f5},..._0x26f74f[_0x71c996(0x1fb)]&&{'created_at':_0x26f74f[_0x71c996(0x1fb)]},..._0x26f74f[_0x71c996(0x1fd)]&&{'started_at':_0x26f74f[_0x71c996(0x1fd)]},..._0x26f74f[_0x71c996(0x1e0)]&&{'end_at':_0x26f74f['end_at']},..._0x26f74f[_0x71c996(0x1db)]&&{'database':_0x26f74f[_0x71c996(0x1db)]},..._0x26f74f[_0x71c996(0x1e9)]!==undefined&&{'priority':_0x26f74f[_0x71c996(0x1e9)]},..._0x26f74f['url']&&{'url':_0x26f74f[_0x71c996(0x1f0)]},..._0x26f74f[_0x71c996(0x20a)]&&{'query':_0x26f74f['query']},..._0x26f74f[_0x71c996(0x1d3)]&&{'debug':_0x26f74f[_0x71c996(0x1d3)]}};return await handleSingleObjectOutput(_0x44b5f6,_0x46c000),0x0;}}export class JobKillCommand extends BaseCommand{['name']=a26_0xf2cfb3(0x211);['description']=a26_0xf2cfb3(0x1ef);[a26_0xf2cfb3(0x1e4)](_0x42c3e3){const _0x4a1dc0=a26_0xf2cfb3,_0xef7c41=_0x42c3e3[_0x4a1dc0(0x1eb)][0x0];if(!_0xef7c41)return'Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20kill\x20<job-id>';return undefined;}async[a26_0xf2cfb3(0x1d9)](_0x155336){const _0x56b8b4=a26_0xf2cfb3,{options:_0x88d405,args:_0x475b30,tdx:_0x56b250}=_0x155336,_0x2dba41=_0x475b30[0x0];if(!_0x88d405[_0x56b8b4(0x206)]){const _0x52bf63=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20'+_0x2dba41+'?');if(!_0x52bf63)return console[_0x56b8b4(0x1f5)](_0x56b8b4(0x212)),0x0;}return await withSpinner(_0x56b8b4(0x20e),()=>_0x56b250['jobs'][_0x56b8b4(0x1f6)](_0x2dba41),{'verbose':_0x88d405['verbose']}),console[_0x56b8b4(0x1f5)](_0x56b8b4(0x1e6)+_0x2dba41),console[_0x56b8b4(0x1f5)](_0x56b8b4(0x200)+_0x2dba41+_0x56b8b4(0x1d7)),0x0;}}export class JobSubmitCommand extends BaseCommand{[a26_0xf2cfb3(0x203)]=a26_0xf2cfb3(0x201);['description']=a26_0xf2cfb3(0x1e1);async[a26_0xf2cfb3(0x1d9)](_0x5d71a0){const _0x17832d=a26_0xf2cfb3,{options:_0x18ad55,args:_0x1dd451,tdx:_0x578266}=_0x5d71a0,_0x26ce97=_0x18ad55[_0x17832d(0x1ec)]||_0x17832d(0x221),_0x492291=_0x18ad55[_0x17832d(0x227)],_0x28f1ce=_0x18ad55[_0x17832d(0x1db)]||_0x17832d(0x214),_0x6a578b=_0x18ad55[_0x17832d(0x225)];if(_0x26ce97!==_0x17832d(0x221)&&_0x26ce97!==_0x17832d(0x1f2))throw new SDKError(ErrorCode[_0x17832d(0x21a)],_0x17832d(0x1e8));let _0x3c968d;if(_0x492291){if(_0x1dd451[0x0])throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x17832d(0x224));const _0x21c5c9=readSqlStatementsFromFile(_0x492291);if(_0x21c5c9[_0x17832d(0x205)]===0x0)throw new SDKError(ErrorCode[_0x17832d(0x21a)],'No\x20SQL\x20statements\x20found\x20in\x20file');if(_0x21c5c9['length']>0x1)throw new SDKError(ErrorCode[_0x17832d(0x21a)],_0x17832d(0x204));_0x3c968d=_0x21c5c9[0x0];}else{if(!_0x1dd451[0x0])throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x17832d(0x1dc));_0x3c968d=_0x1dd451[0x0];}_0x18ad55[_0x17832d(0x1fa)]&&(console[_0x17832d(0x1f5)](_0x17832d(0x21c)+_0x26ce97),console[_0x17832d(0x1f5)](_0x17832d(0x1d5)+_0x28f1ce),console['error'](_0x17832d(0x223)+_0x3c968d['substring'](0x0,0x64)+(_0x3c968d[_0x17832d(0x205)]>0x64?_0x17832d(0x1e5):'')));const _0x476af8=await withSpinner('Submitting\x20job...',()=>_0x578266[_0x17832d(0x207)][_0x17832d(0x220)](_0x28f1ce,_0x3c968d,_0x26ce97,_0x6a578b),{'verbose':_0x18ad55[_0x17832d(0x1fa)]}),_0x3abeaf=_0x476af8[_0x17832d(0x1e3)];return console[_0x17832d(0x1f5)]('βœ”\x20Job\x20submitted'),console['error'](_0x17832d(0x21d)+_0x3abeaf['job_id']),await handleSDKOutput([_0x3abeaf],_0x18ad55),0x0;}}export class JobResultCommand extends BaseCommand{[a26_0xf2cfb3(0x203)]='job:result';[a26_0xf2cfb3(0x21e)]=a26_0xf2cfb3(0x226);[a26_0xf2cfb3(0x1e4)](_0x18ca5d){const _0xf64dbe=a26_0xf2cfb3,_0x3d7a5b=_0x18ca5d[_0xf64dbe(0x1eb)][0x0];if(!_0x3d7a5b)return _0xf64dbe(0x229);return undefined;}async[a26_0xf2cfb3(0x1d9)](_0x215103){const _0x45f867=a26_0xf2cfb3,{options:_0x42ebc3,args:_0x38bffd,tdx:_0x2ad94f}=_0x215103,_0x1ce3df=_0x38bffd[0x0],_0x23f2a2=await withSpinner(_0x45f867(0x1de),()=>_0x2ad94f['jobs'][_0x45f867(0x225)](_0x1ce3df),{'verbose':_0x42ebc3[_0x45f867(0x1fa)]}),_0x579136=_0x23f2a2[_0x45f867(0x1e3)];return console[_0x45f867(0x1f5)](_0x45f867(0x1ea)+_0x579136[_0x45f867(0x205)]+_0x45f867(0x209)+(_0x579136['length']!==0x1?'s':'')),await handleSDKOutput(_0x579136,_0x42ebc3),0x0;}}
@@ -1 +1 @@
1
- const a27_0x1ccf16=a27_0x2962;(function(_0x12b7bd,_0x546a2a){const _0x54589e=a27_0x2962,_0x238c39=_0x12b7bd();while(!![]){try{const _0xa8e116=-parseInt(_0x54589e(0x25e))/0x1*(-parseInt(_0x54589e(0x265))/0x2)+-parseInt(_0x54589e(0x1c7))/0x3+-parseInt(_0x54589e(0x1bb))/0x4*(-parseInt(_0x54589e(0x1fd))/0x5)+parseInt(_0x54589e(0x16b))/0x6*(-parseInt(_0x54589e(0x20c))/0x7)+-parseInt(_0x54589e(0x1d2))/0x8+-parseInt(_0x54589e(0x17b))/0x9*(-parseInt(_0x54589e(0x1f2))/0xa)+-parseInt(_0x54589e(0x1b9))/0xb*(-parseInt(_0x54589e(0x21d))/0xc);if(_0xa8e116===_0x546a2a)break;else _0x238c39['push'](_0x238c39['shift']());}catch(_0x5e0158){_0x238c39['push'](_0x238c39['shift']());}}}(a27_0x2192,0x4b5c0));import a27_0x3af12a from'chalk';import a27_0xce06a6 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';function a27_0x2192(){const _0x134e07=['conversion','find','.yml','listFolders','No\x20statistics\x20available\x20for\x20journey:\x20','hasChanges','Fetching\x20parent\x20segment...','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','listJourneysFromParentSegment','INVALID_ARGUMENT','βœ”\x20Pulled\x20','-\x20no\x20files\x20written','file','3090HMiVKd','connector_config','\x20journey','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','site','segment','getParentFull','type','history','Resuming\x20journey...','buildIdToNameMap','...','folderPath','/app/ps/','map','Getting\x20version\x20','1084833zvIsDx','relative','Write\x20','includeStats','limit','database','all','completionRate','journeyName','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','resolveJourneyId','length','\x20\x20Preserving\x20local\x20segment\x20name:\x20','state','getActivation','\x22\x20paused','Resolved\x20YAML\x20file:\x20','json','Resolving\x20parent\x20segment...','versionNumber','List\x20activations\x20for\x20a\x20journey','\x22\x20resumed','(draft)','πŸ“\x20','values','journey:list','Cancelled','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','\x20not\x20found.\x20Available:\x20','journey:view','getSegment','isNew','execute','session','Journey\x20name:\x20','rule','repeat','\x20\x20Statistics\x20not\x20available','archived','/e/','hasPeriod','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Error:\x20Version\x20','getTrafficData','helpText','Parent\x20segment:\x20','connection','(running)','\x20version','split','utf-8','table','paused','\x20\x20Journey\x20ID:\x20','\x20\x20Name:\x20','args','red','journeyBundleId','\x20files?','Error:\x20Journey\x20not\x20found:\x20','(root)','\x5c$&','11NyNykZ','push','1046396dRcsRU','format','parentSegment','Warning:\x20Could\x20not\x20resolve\x20segment\x20','size','\x20Created\x20v','log','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','draft','\x22\x20not\x20found','\x20journey\x20files\x20to\x20','570198WRAwyW','message','listVersions','get','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','Export\x20journey(s)\x20as\x20YAML\x20files','bold','(archived)','root\x20folder','βœ”\x20Context\x20set:\x20','\x20\x20-\x20','3296448brgzqF','\x27\x20not\x20found\x20in\x20','Warning:\x20--include-history\x20without\x20--from/--to\x20may\x20return\x20all-time\x20history','\x20\x20Target:\x20','segmentPushCommand','toLowerCase','options','listJourneysWithFolders','reentryMode','journeys','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','links','goal','goalSize','Get\x20journey\x20traffic\x20data\x20(Sankey\x20charts)','Resolving\x20journey...','localeCompare','\x20activation','Target\x20directory:\x20','exitOrJumpRate','journeyId','data','/j/da/je','relativePath','Resolving\x20version...','stages','includeHistory','has','Pattern:\x20','pause','updatedAt','getJourney','10nYacbk','renderStats','Fetching\x20journeys\x20and\x20folders...','then','journey:stats','\x22.\x20Must\x20be\x20\x22conversion\x22\x20or\x20\x22activation\x22.','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','/j/da','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','buildIdToEmailMap','green','5UtebjW','Pause\x20a\x20running\x20journey','\x20Opening\x20','Error:\x20Journey\x20\x27','getStatistics','List\x20journeys\x20in\x20current\x20context','Error:\x20Stage\x20\x22','\x20new\x20files','filter','Pausing\x20journey...','journeyStages','audienceId','Create\x20a\x20new\x20draft\x20version\x20of\x20a\x20journey','Aborted.','error','3143qMKiDM','completeMilestoneRate','Listing\x20journeys...','resourceName','rootFolderId','\x20\x20Folder\x20path:\x20','filePath','absolutePath','kind','createVersion','\x20\x20Consolidating\x20duplicate\x20segment:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','journey','join','attributes','Listing\x20journey\x20versions...','βœ”\x20Journey\x20\x22','8290428aagmMu','web','yellow','resolveSegment','\x20versions)','List\x20all\x20versions\x20of\x20a\x20journey','resolveParentId','\x20\x20Parent\x20segment:\x20','exitOrJumpSize','Found\x20','version','\x20(ID:\x20','Show\x20journey\x20details','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','\x20changed\x20files','user','Database:\x20','jsonl','Traffic\x20data\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','activation_','Getting\x20journey\x20traffic\x20data...','base','\x20(draft)\x20β€”\x20\x22','journey:version:view','Getting\x20journey\x20statistics...','replace','Show\x20journey\x20table\x20column\x20mapping','yes','stringify','tdx.json','nodes','description','enteredSize','activationParams','stage','journeyBundleName','cwd','dryRun','cyan','dim','completed','\x20->\x20','Show\x20journey\x20statistics','Getting\x20column\x20mapping...','folderId','Target\x20file:\x20','getLatestJourneyId','journey:versions','Error:\x20Invalid\x20version\x20number:\x20','set','createdAt','\x0aChanges\x20to\x20\x27','resume','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','journey:columns','tsv','Listing\x20journey\x20activations...','sort','listActivationsFlat','If\x20the\x20journey\x20is\x20active,\x20the\x20date\x20range\x20may\x20be\x20too\x20wide.\x20Try\x20a\x20shorter\x20period\x20(max\x20~90\x20days).','journey:pull','add','\x20journeys','Input:\x20','milestoneSize','3gAajRm','Error:\x20--version\x20option\x20is\x20required','Options:','βœ”\x20All\x20files\x20are\x20up\x20to\x20date','diff','\x20(rule\x20match)','test','46016wRnANY','name','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','verbose','(completed)','activation','journey:version:create','Fetching\x20','content','\x0aPull\x20summary:','parent_segment'];a27_0x2192=function(){return _0x134e07;};return a27_0x2192();}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 a27_0x2962(_0x43642b,_0x6a7baf){_0x43642b=_0x43642b-0x163;const _0x21925=a27_0x2192();let _0x296223=_0x21925[_0x43642b];return _0x296223;}function requireNameOrPath(_0x136887){const _0xf40ea8=a27_0x2962;return!_0x136887&&(console[_0xf40ea8(0x20b)](_0xf40ea8(0x1cb)),console[_0xf40ea8(0x20b)]('Usage:\x20journey\x20<subcommand>\x20<name-or-path>')),!!_0x136887;}function withJsonFormat(_0x45cfbb){const _0x3779e7=a27_0x2962;if(!_0x45cfbb['format']&&!_0x45cfbb[_0x3779e7(0x18c)]&&!_0x45cfbb[_0x3779e7(0x22e)]&&!_0x45cfbb[_0x3779e7(0x254)])return{..._0x45cfbb,'format':'json','json':!![]};return _0x45cfbb;}function formatJourneyState(_0x3688a3){const _0x2a4e7d=a27_0x2962;switch(_0x3688a3){case'launched':return a27_0x3af12a['green'](_0x2a4e7d(0x1aa));case _0x2a4e7d(0x1c4):return a27_0x3af12a[_0x2a4e7d(0x244)](_0x2a4e7d(0x191));case _0x2a4e7d(0x1af):return a27_0x3af12a[_0x2a4e7d(0x21f)]('(paused)');case _0x2a4e7d(0x245):return a27_0x3af12a['blue'](_0x2a4e7d(0x269));case _0x2a4e7d(0x1a1):return a27_0x3af12a['dim'](_0x2a4e7d(0x1ce));default:return'('+_0x3688a3+')';}}function formatJourneyItem(_0x5c10bb,_0x3c8324='',_0xc43f9){const _0x13b4df=a27_0x2962,_0x3085aa=formatJourneyState(_0x5c10bb[_0x13b4df(0x188)]),_0x175564=_0xc43f9?hyperlink(_0x5c10bb[_0x13b4df(0x240)],_0xc43f9):_0x5c10bb[_0x13b4df(0x240)];return _0x3c8324+'πŸ—ΊοΈ\x20'+_0x175564+'\x20'+_0x3085aa;}function escapeRegex(_0x1faebb){const _0x481ee1=a27_0x2962;return _0x1faebb[_0x481ee1(0x236)](/[.*+?^${}()|[\]\\]/g,_0x481ee1(0x1b8));}function globToRegex(_0x3d09eb){const _0x504724=a27_0x2962,_0x12e44c=_0x3d09eb[_0x504724(0x1ac)]('*')[_0x504724(0x179)](escapeRegex);return new RegExp(_0x12e44c[_0x504724(0x219)]('.*'),'i');}function buildRuleToNameMapping(_0x1dc046){const _0x597968=a27_0x2962,_0x2697c6=new Map();if(_0x1dc046['segments'])for(const [_0x57f7af,_0x57ec19]of Object['entries'](_0x1dc046['segments'])){if(_0x57ec19[_0x597968(0x19e)]){const _0x5cf85d=serializeRule(_0x57ec19['rule']),_0xab8c1b=_0x2697c6['get'](_0x5cf85d);_0xab8c1b?_0xab8c1b[_0x597968(0x1ba)](_0x57f7af):_0x2697c6[_0x597968(0x24e)](_0x5cf85d,[_0x57f7af]);}}return _0x2697c6;}async function resolveJourneyIdFromInput(_0x13230a,_0x5e23ce,_0xfa87b5){const _0xd7e3f3=a27_0x2962,_0x2e0e99=await resolveJourneyTarget(_0x13230a,_0x5e23ce[_0xd7e3f3(0x1bd)],_0x5e23ce['verbose']),_0x46b2c8=_0x2e0e99[_0xd7e3f3(0x1bd)];if(!_0x46b2c8)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Could\x20not\x20resolve\x20parent\x20segment.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');const _0x58ddd9=await withSpinner(_0xd7e3f3(0x18d),()=>_0xfa87b5[_0xd7e3f3(0x170)][_0xd7e3f3(0x223)](_0x46b2c8),{'verbose':_0x5e23ce[_0xd7e3f3(0x268)]}),_0x26a0d1=_0x58ddd9[_0xd7e3f3(0x1e7)],_0x4e3c71=await withSpinner(_0xd7e3f3(0x1e1),()=>_0xfa87b5[_0xd7e3f3(0x218)][_0xd7e3f3(0x185)](_0x26a0d1,_0x2e0e99['journeyName']),{'verbose':_0x5e23ce[_0xd7e3f3(0x268)]});return{'journeyId':_0x4e3c71[_0xd7e3f3(0x1e7)],'journeyName':_0x2e0e99[_0xd7e3f3(0x183)],'parentSegmentId':_0x26a0d1};}async function resolveJourneyTarget(_0x187fa7,_0x44259b,_0x49f575){const _0x17d064=a27_0x2962;if(isYamlFilePath(_0x187fa7))try{const _0x22bb28=await resolveYamlFilePath(_0x187fa7);return _0x49f575&&(console[_0x17d064(0x20b)](_0x17d064(0x18b)+_0x187fa7),console[_0x17d064(0x20b)](_0x17d064(0x224)+_0x22bb28[_0x17d064(0x1bd)]),console['error'](_0x17d064(0x1b1)+_0x22bb28['segmentName']),console[_0x17d064(0x20b)](_0x17d064(0x211)+(_0x22bb28['folderPath']||_0x17d064(0x1b7)))),{'journeyName':_0x22bb28['segmentName'],'parentSegment':_0x22bb28['parentSegment'],'resolved':_0x22bb28};}catch(_0x1f2301){throw new SDKError(ErrorCode[_0x17d064(0x167)],_0x17d064(0x1a4)+_0x1f2301['message']);}if(!_0x44259b)throw new SDKError(ErrorCode[_0x17d064(0x167)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return{'journeyName':_0x187fa7,'parentSegment':_0x44259b};}export class JourneyListCommand extends BaseCommand{[a27_0x1ccf16(0x266)]=a27_0x1ccf16(0x194);[a27_0x1ccf16(0x23c)]=a27_0x1ccf16(0x202);async[a27_0x1ccf16(0x19b)](_0x3f5543){const _0x1b56fc=a27_0x1ccf16,{options:_0x5ec603,args:_0x555bf9,tdx:_0x518729}=_0x3f5543,_0x55f44f=_0x555bf9[0x0],_0x1dd0ef=_0x5ec603[_0x1b56fc(0x1bd)];if(!_0x1dd0ef)return console[_0x1b56fc(0x20b)]('Error:\x20Parent\x20segment\x20context\x20required'),console[_0x1b56fc(0x20b)](_0x1b56fc(0x196)),0x1;const _0x10caaa=await withSpinner(_0x1b56fc(0x18d),()=>_0x518729[_0x1b56fc(0x170)][_0x1b56fc(0x223)](_0x1dd0ef),{'verbose':_0x5ec603[_0x1b56fc(0x268)]}),_0x1cb0ac=_0x10caaa[_0x1b56fc(0x1e7)];_0x5ec603[_0x1b56fc(0x268)]&&(console['error'](_0x1b56fc(0x1a8)+_0x1dd0ef+_0x1b56fc(0x228)+_0x1cb0ac+')'),_0x55f44f&&console[_0x1b56fc(0x20b)](_0x1b56fc(0x1ee)+_0x55f44f));const _0x424443=await withSpinner(_0x1b56fc(0x164),()=>_0x518729['segment'][_0x1b56fc(0x171)](_0x1cb0ac),{'verbose':_0x5ec603[_0x1b56fc(0x268)]}),_0xd8d71c=_0x424443[_0x1b56fc(0x1e7)],_0x509ce1=_0xd8d71c[_0x1b56fc(0x210)],_0x521aa4=await withSpinner(_0x1b56fc(0x20e),()=>_0x518729['journey'][_0x1b56fc(0x1d9)](_0x1cb0ac,_0x509ce1),{'verbose':_0x5ec603['verbose']});let _0x199500=_0x521aa4[_0x1b56fc(0x1e7)][_0x1b56fc(0x1db)];const _0x9acd1a=_0x521aa4['data']['folders'],_0x3857e2=new Map();for(const _0xf121ec of _0x9acd1a){_0x3857e2['set'](_0xf121ec['id'],_0xf121ec['name']);}if(_0x55f44f){const _0x40595a=globToRegex(_0x55f44f);_0x199500=_0x199500[_0x1b56fc(0x205)](_0x1af7b2=>_0x40595a[_0x1b56fc(0x264)](_0x1af7b2[_0x1b56fc(0x240)]));}console[_0x1b56fc(0x20b)]('βœ”\x20Found\x20'+_0x199500[_0x1b56fc(0x186)]+_0x1b56fc(0x16d)+(_0x199500[_0x1b56fc(0x186)]!==0x1?'s':''));const _0x5847a6=_0xedc9a7=>{const _0x4aa18e=_0x1b56fc;return getConsoleNextUrl(_0x5ec603['site'],_0x4aa18e(0x178)+_0x1cb0ac+'/e/'+_0xedc9a7+_0x4aa18e(0x1f9));};if(_0x5ec603['format']===_0x1b56fc(0x1ae))await handleSDKOutput(_0x199500,_0x5ec603);else{if(_0x5ec603[_0x1b56fc(0x1bc)]==='json'){const _0x237d27=_0x199500['map'](_0x342e96=>({..._0x342e96,'url':_0x5847a6(_0x342e96['id'])}));await handleSDKOutput(_0x237d27,_0x5ec603);}else{console[_0x1b56fc(0x1c1)]('['+_0x1dd0ef+']');const _0x187e51=new Map(),_0x3a0bef=[];for(const _0x2c2f65 of _0x199500){if(!_0x2c2f65[_0x1b56fc(0x249)]||_0x2c2f65[_0x1b56fc(0x249)]===_0x509ce1)_0x3a0bef[_0x1b56fc(0x1ba)](_0x2c2f65);else{const _0x58c058=_0x187e51[_0x1b56fc(0x1ca)](_0x2c2f65[_0x1b56fc(0x249)])||[];_0x58c058[_0x1b56fc(0x1ba)](_0x2c2f65),_0x187e51['set'](_0x2c2f65[_0x1b56fc(0x249)],_0x58c058);}}const _0xe5e82a=(_0x1275cf,_0x215803)=>_0x1275cf[_0x1b56fc(0x240)][_0x1b56fc(0x1e2)](_0x215803[_0x1b56fc(0x240)],undefined,{'sensitivity':_0x1b56fc(0x232)});_0x3a0bef[_0x1b56fc(0x256)](_0xe5e82a);for(const _0x3f0a18 of _0x3a0bef){console[_0x1b56fc(0x1c1)](formatJourneyItem(_0x3f0a18,'',_0x5847a6(_0x3f0a18['id'])));}const _0x43cb6a=[..._0x187e51['entries']()][_0x1b56fc(0x256)]((_0x2122ad,_0x56dace)=>{const _0x2df5cd=_0x1b56fc,_0x3a2a19=_0x3857e2[_0x2df5cd(0x1ca)](_0x2122ad[0x0])||_0x2122ad[0x0],_0x4e9f42=_0x3857e2['get'](_0x56dace[0x0])||_0x56dace[0x0];return _0x3a2a19['localeCompare'](_0x4e9f42,undefined,{'sensitivity':_0x2df5cd(0x232)});});for(const [_0x51d493,_0x2185be]of _0x43cb6a){const _0x42dab2=_0x3857e2[_0x1b56fc(0x1ca)](_0x51d493)||_0x51d493;console[_0x1b56fc(0x1c1)](_0x1b56fc(0x192)+_0x42dab2),_0x2185be[_0x1b56fc(0x256)](_0xe5e82a);for(const _0x359f09 of _0x2185be){console[_0x1b56fc(0x1c1)](formatJourneyItem(_0x359f09,'\x20\x20',_0x5847a6(_0x359f09['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a27_0x1ccf16(0x266)]=a27_0x1ccf16(0x198);[a27_0x1ccf16(0x23c)]=a27_0x1ccf16(0x229);async['execute'](_0x2e229c){const _0x42704c=a27_0x1ccf16,{options:_0x4588bf,args:_0x55badf,tdx:_0x581457}=_0x2e229c,_0x3dd03d=_0x55badf[0x0];if(!_0x3dd03d)return console[_0x42704c(0x20b)](_0x42704c(0x1cb)),console['error']('Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]'),console['error'](_0x42704c(0x260)),console[_0x42704c(0x20b)]('\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser'),0x1;_0x4588bf[_0x42704c(0x268)]&&console['error'](_0x42704c(0x25c)+_0x3dd03d);const {journeyId:_0x1cb613,parentSegmentId:_0x2f3852}=await resolveJourneyIdFromInput(_0x3dd03d,_0x4588bf,_0x581457);if(_0x4588bf[_0x42704c(0x21e)]){const _0x1dc79b=getConsoleNextUrl(_0x4588bf[_0x42704c(0x16f)],_0x42704c(0x178)+_0x2f3852+_0x42704c(0x1a2)+_0x1cb613+_0x42704c(0x1e8));return console[_0x42704c(0x20b)](a27_0x3af12a[_0x42704c(0x1fc)]('βœ”')+_0x42704c(0x1ff)+a27_0x3af12a[_0x42704c(0x243)](_0x1dc79b)),openBrowser(_0x1dc79b),0x0;}const _0x1770e2=await withSpinner('Getting\x20journey\x20details...',()=>_0x581457[_0x42704c(0x218)][_0x42704c(0x1f1)](_0x1cb613),{'verbose':_0x4588bf[_0x42704c(0x268)]}),_0x1d5912=_0x1770e2['data'],_0x3fe569=_0x4588bf[_0x42704c(0x17e)];let _0x33885e;if(_0x3fe569)try{const _0x5f1e8e=await withSpinner('Getting\x20journey\x20statistics...',()=>_0x581457[_0x42704c(0x218)][_0x42704c(0x201)](_0x1cb613),{'verbose':_0x4588bf[_0x42704c(0x268)]});_0x33885e=_0x5f1e8e['data'];}catch{_0x4588bf[_0x42704c(0x268)]&&console[_0x42704c(0x20b)](_0x42704c(0x1a0));}const _0x45f2b7=getConsoleNextUrl(_0x4588bf[_0x42704c(0x16f)],_0x42704c(0x178)+_0x2f3852+_0x42704c(0x1a2)+_0x1cb613+_0x42704c(0x1e8)),_0xffe0f2={'id':_0x1d5912['id'],'name':_0x1d5912[_0x42704c(0x21a)][_0x42704c(0x266)],'description':_0x1d5912[_0x42704c(0x21a)]['description'],'state':_0x1d5912[_0x42704c(0x21a)][_0x42704c(0x188)],'paused':_0x1d5912[_0x42704c(0x21a)]['paused'],'reentry_mode':_0x1d5912[_0x42704c(0x21a)][_0x42704c(0x1da)],'stages':_0x1d5912['attributes'][_0x42704c(0x207)]?.[_0x42704c(0x186)]||0x0,..._0x1d5912['attributes'][_0x42704c(0x1de)]&&{'goal':_0x1d5912[_0x42704c(0x21a)][_0x42704c(0x1de)][_0x42704c(0x266)]},..._0x33885e&&{'statistics':{'size':_0x33885e[_0x42704c(0x1bf)],'entered':_0x33885e['enteredSize'],'goal_achieved':_0x33885e[_0x42704c(0x1df)],'completion_rate':_0x33885e[_0x42704c(0x182)],'exit_or_jump':_0x33885e[_0x42704c(0x225)],'exit_or_jump_rate':_0x33885e[_0x42704c(0x1e5)],'stages':_0x33885e['stages']}},'url':_0x45f2b7};return await handleSingleObjectOutput(_0xffe0f2,_0x4588bf),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a27_0x1ccf16(0x266)]=a27_0x1ccf16(0x1f6);[a27_0x1ccf16(0x23c)]=a27_0x1ccf16(0x247);async[a27_0x1ccf16(0x19b)](_0x1099c9){const _0x4c0475=a27_0x1ccf16,{options:_0x292ab9,args:_0x5c07d3,tdx:_0x3af272}=_0x1099c9,_0x57c7e4=_0x5c07d3[0x0];if(!requireNameOrPath(_0x57c7e4))return 0x1;_0x292ab9[_0x4c0475(0x268)]&&console[_0x4c0475(0x20b)](_0x4c0475(0x25c)+_0x57c7e4);const _0x30735e=_0x292ab9,_0x451f6a=_0x30735e['from'],_0x147da8=_0x30735e['to'],_0xc6937b=_0x30735e['includeHistory'],_0x20ccdf=_0x30735e[_0x4c0475(0x23f)];_0xc6937b&&!_0x451f6a&&!_0x147da8&&console[_0x4c0475(0x20b)](_0x4c0475(0x1d4));const _0x3ea899=_0xc6937b?withJsonFormat(_0x292ab9):_0x292ab9,{journeyId:_0x317344,journeyName:_0x974b46}=await resolveJourneyIdFromInput(_0x57c7e4,_0x3ea899,_0x3af272),_0x2ae7bf=_0x451f6a||_0x147da8?{'from':_0x451f6a,'to':_0x147da8}:undefined,_0x2ab1a8=await withSpinner(_0x4c0475(0x235),()=>Promise[_0x4c0475(0x181)]([_0x3af272[_0x4c0475(0x218)][_0x4c0475(0x1f1)](_0x317344),_0x3af272[_0x4c0475(0x218)][_0x4c0475(0x201)](_0x317344,_0x2ae7bf)]),{'verbose':_0x3ea899[_0x4c0475(0x268)]}),[_0x4a58b7,_0x1787fc]=_0x2ab1a8[_0x4c0475(0x1e7)];if(!_0x1787fc||_0x1787fc[_0x4c0475(0x1e6)]===null)return console[_0x4c0475(0x20b)](_0x4c0475(0x274)+_0x974b46),console[_0x4c0475(0x20b)](_0x4c0475(0x252)),0x0;const _0x194cbb=buildStageNameMap(_0x4a58b7),_0x17d1a5=!!(_0x2ae7bf&&_0x1787fc[_0x4c0475(0x173)]?.[_0x4c0475(0x186)]),_0xd6cb84={'stageNameMap':_0x194cbb,'hasPeriod':_0x17d1a5,'includeHistory':!!_0xc6937b};if(_0x20ccdf&&_0x1787fc[_0x4c0475(0x1eb)]){const _0x4a4376=_0x1787fc[_0x4c0475(0x1eb)][_0x4c0475(0x271)](_0x3c7f57=>{const _0x39fec1=_0x4c0475,_0x2f7058=_0x194cbb['get'](_0x3c7f57['id'])??'';return _0x2f7058[_0x39fec1(0x1d7)]()===_0x20ccdf[_0x39fec1(0x1d7)]();});if(_0x4a4376)return await handleSingleObjectOutput(formatStageStats(_0x4a4376,_0xd6cb84),_0x3ea899),0x0;const _0x315540=_0x1787fc[_0x4c0475(0x1eb)][_0x4c0475(0x179)](_0x479b16=>_0x194cbb[_0x4c0475(0x1ca)](_0x479b16['id'])??_0x479b16['id']);return console[_0x4c0475(0x20b)](_0x4c0475(0x203)+_0x20ccdf+_0x4c0475(0x1c5)),console[_0x4c0475(0x20b)]('Available\x20stages:\x20'+_0x315540['join'](',\x20')),0x1;}const _0x4a6cff=_0x1787fc[_0x4c0475(0x1eb)]?.[_0x4c0475(0x179)](_0x24b5d7=>formatStageStats(_0x24b5d7,_0xd6cb84)),_0x372a68=assembleJourneyStats(_0x1787fc,{'from':_0x451f6a,'to':_0x147da8,'includeHistory':_0xc6937b});return await this[_0x4c0475(0x1f3)](_0x372a68,_0x4a6cff??[],_0x3ea899),0x0;}async[a27_0x1ccf16(0x1f3)](_0x7e3278,_0x1cf6f0,_0x311af3){const _0x5447b7=a27_0x1ccf16,_0x5e071f=_0x311af3[_0x5447b7(0x1bc)]==='json'||_0x311af3[_0x5447b7(0x1bc)]===_0x5447b7(0x22e)||_0x311af3['json']||_0x311af3[_0x5447b7(0x22e)];if(_0x5e071f){_0x7e3278[_0x5447b7(0x1eb)]=_0x1cf6f0,await handleSingleObjectOutput(_0x7e3278,_0x311af3);return;}await handleSingleObjectOutput(_0x7e3278,_0x311af3);for(const _0x204586 of _0x1cf6f0){console[_0x5447b7(0x1c1)](''),console[_0x5447b7(0x1c1)](String(a27_0x3af12a['cyan'][_0x5447b7(0x1cd)]('['+_0x204586[_0x5447b7(0x266)]+']'))+a27_0x3af12a[_0x5447b7(0x244)]('\x20'+_0x204586['id']));const {id:_0x40decd,name:_0x4726c5,..._0x5a45d8}=_0x204586;await handleSingleObjectOutput(_0x5a45d8,_0x311af3);}}}export class JourneyTrafficCommand extends BaseCommand{[a27_0x1ccf16(0x266)]='journey:traffic';[a27_0x1ccf16(0x23c)]=a27_0x1ccf16(0x1e0);async[a27_0x1ccf16(0x19b)](_0x3054e1){const _0x583db7=a27_0x1ccf16,{options:_0x5b9583,args:_0x4f1e82,tdx:_0x841391}=_0x3054e1,_0x13cb27=_0x4f1e82[0x0];if(!requireNameOrPath(_0x13cb27))return 0x1;_0x5b9583[_0x583db7(0x268)]&&console[_0x583db7(0x20b)](_0x583db7(0x25c)+_0x13cb27);const _0x1a09d5=_0x5b9583,_0x446bc=_0x1a09d5[_0x583db7(0x172)],_0x587e23=_0x1a09d5['from'],_0x29edd9=_0x1a09d5['to'],_0x4d730b=_0x1a09d5[_0x583db7(0x17f)];if(_0x446bc&&_0x446bc!=='conversion'&&_0x446bc!==_0x583db7(0x26a))return console['error']('Error:\x20Invalid\x20--type\x20\x22'+_0x446bc+_0x583db7(0x1f7)),0x1;const _0x1beafc=withJsonFormat(_0x5b9583),{journeyId:_0x48ab43,journeyName:_0x2dfa19}=await resolveJourneyIdFromInput(_0x13cb27,_0x1beafc,_0x841391),_0x5d90c8={'type':_0x446bc,'from':_0x587e23,'to':_0x29edd9,'limit':_0x4d730b},_0x3d011b=await withSpinner(_0x583db7(0x231),()=>_0x841391['journey'][_0x583db7(0x1a6)](_0x48ab43,_0x5d90c8),{'verbose':_0x1beafc[_0x583db7(0x268)]}),_0x395efa=_0x3d011b[_0x583db7(0x1e7)],_0xf17a36=_0x395efa['conversion']&&(_0x395efa[_0x583db7(0x270)][_0x583db7(0x23b)]['length']>0x0||_0x395efa[_0x583db7(0x270)][_0x583db7(0x1dd)][_0x583db7(0x186)]>0x0),_0x40cb73=_0x395efa['activation']&&_0x395efa[_0x583db7(0x26a)][_0x583db7(0x186)]>0x0;if(!_0xf17a36&&!_0x40cb73)return console[_0x583db7(0x20b)]('No\x20traffic\x20data\x20available\x20for\x20journey:\x20'+_0x2dfa19),console[_0x583db7(0x20b)](_0x583db7(0x22f)),_0x587e23&&_0x29edd9&&console[_0x583db7(0x20b)](_0x583db7(0x258)),0x0;return await handleSingleObjectOutput(_0x395efa,_0x1beafc),0x0;}}function formatStageStats(_0x3cc5e5,_0x2cb2ab){const _0x6ee351=a27_0x1ccf16,_0x5041bf=_0x2cb2ab[_0x6ee351(0x1a3)]&&_0x3cc5e5[_0x6ee351(0x173)]?.['length']?aggregateStageHistory(_0x3cc5e5[_0x6ee351(0x173)]):{'size':_0x3cc5e5[_0x6ee351(0x1bf)],'entered':_0x3cc5e5[_0x6ee351(0x23d)],'milestone':_0x3cc5e5[_0x6ee351(0x25d)],'milestone_rate':_0x3cc5e5[_0x6ee351(0x20d)],'exit_or_jump':_0x3cc5e5[_0x6ee351(0x225)],'exit_or_jump_rate':_0x3cc5e5[_0x6ee351(0x1e5)]},_0x5b2932={'id':_0x3cc5e5['id'],'name':_0x2cb2ab['stageNameMap']['get'](_0x3cc5e5['id'])??_0x3cc5e5['id'],..._0x5041bf};return _0x2cb2ab[_0x6ee351(0x1a3)]&&_0x2cb2ab[_0x6ee351(0x1ec)]&&_0x3cc5e5[_0x6ee351(0x173)]&&(_0x5b2932[_0x6ee351(0x173)]=_0x3cc5e5[_0x6ee351(0x173)]),_0x5b2932;}export class JourneyPauseCommand extends BaseCommand{[a27_0x1ccf16(0x266)]='journey:pause';[a27_0x1ccf16(0x23c)]=a27_0x1ccf16(0x1fe);async['execute'](_0x2cf13e){const _0x53e8c3=a27_0x1ccf16,{options:_0x542a5a,args:_0x2d8b36,tdx:_0x268e8f}=_0x2cf13e,_0x24fa2f=_0x2d8b36[0x0];if(!requireNameOrPath(_0x24fa2f))return 0x1;_0x542a5a[_0x53e8c3(0x268)]&&console[_0x53e8c3(0x20b)](_0x53e8c3(0x25c)+_0x24fa2f);const {journeyId:_0x542161,journeyName:_0x23a5b1}=await resolveJourneyIdFromInput(_0x24fa2f,_0x542a5a,_0x268e8f);if(!_0x542a5a['yes']){const _0x23fd03=await confirm(_0x53e8c3(0x165)+_0x23a5b1+'\x22?');if(!_0x23fd03)return console['error'](_0x53e8c3(0x195)),0x0;}const _0x52450c=await withSpinner(_0x53e8c3(0x206),()=>_0x268e8f['journey'][_0x53e8c3(0x1ef)](_0x542161),{'verbose':_0x542a5a['verbose']}),_0x796eaf=_0x52450c[_0x53e8c3(0x1e7)];return console[_0x53e8c3(0x20b)]('βœ”\x20Journey\x20\x22'+_0x796eaf[_0x53e8c3(0x21a)]['name']+_0x53e8c3(0x18a)),0x0;}}export class JourneyResumeCommand extends BaseCommand{['name']='journey:resume';[a27_0x1ccf16(0x23c)]='Resume\x20a\x20paused\x20journey';async[a27_0x1ccf16(0x19b)](_0x273e7c){const _0xda1118=a27_0x1ccf16,{options:_0x34e368,args:_0x3e5b4e,tdx:_0x4b2317}=_0x273e7c,_0x48d903=_0x3e5b4e[0x0];if(!requireNameOrPath(_0x48d903))return 0x1;_0x34e368[_0xda1118(0x268)]&&console['error'](_0xda1118(0x25c)+_0x48d903);const {journeyId:_0x2a76d0,journeyName:_0x4ab31b}=await resolveJourneyIdFromInput(_0x48d903,_0x34e368,_0x4b2317);if(!_0x34e368['yes']){const _0xd581c3=await confirm(_0xda1118(0x16e)+_0x4ab31b+'\x22?');if(!_0xd581c3)return console[_0xda1118(0x20b)](_0xda1118(0x195)),0x0;}const _0x282db1=await withSpinner(_0xda1118(0x174),()=>_0x4b2317['journey'][_0xda1118(0x251)](_0x2a76d0),{'verbose':_0x34e368[_0xda1118(0x268)]}),_0x3a5912=_0x282db1[_0xda1118(0x1e7)];return console[_0xda1118(0x20b)](_0xda1118(0x21c)+_0x3a5912[_0xda1118(0x21a)][_0xda1118(0x266)]+_0xda1118(0x190)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a27_0x1ccf16(0x266)]=a27_0x1ccf16(0x259);[a27_0x1ccf16(0x23c)]=a27_0x1ccf16(0x1cc);async[a27_0x1ccf16(0x19b)](_0x1b0d51){const _0x2cec1b=a27_0x1ccf16,{options:_0x40b81a,args:_0x4260be,tdx:_0x18a23f}=_0x1b0d51,_0x3bc085=_0x40b81a,_0x525b7c=_0x4260be[0x0],_0x111d36=_0x525b7c&&isYamlFilePath(_0x525b7c),_0x4e37c2=await resolveTarget({'arg':_0x111d36?_0x525b7c:undefined,'contextParent':_0x40b81a[_0x2cec1b(0x1bd)],'cwd':process[_0x2cec1b(0x241)]()});if(!isSuccessfulResolution(_0x4e37c2))return _0x4e37c2['errorCode']==='no_parent'?(console[_0x2cec1b(0x20b)](a27_0x3af12a[_0x2cec1b(0x21f)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x2cec1b(0x20b)]('Usage:\x20tdx\x20journey\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Inside\x20a\x20segment\x20folder\x20(with\x20tdx.json)'),console[_0x2cec1b(0x20b)](_0x2cec1b(0x217)),console[_0x2cec1b(0x20b)](_0x2cec1b(0x184)),console[_0x2cec1b(0x20b)](_0x2cec1b(0x22a))):(console[_0x2cec1b(0x20b)](a27_0x3af12a[_0x2cec1b(0x1b3)]('Error:\x20'+_0x4e37c2[_0x2cec1b(0x1c8)]+'\x0a')),_0x4e37c2[_0x2cec1b(0x1a7)]&&console[_0x2cec1b(0x20b)](a27_0x3af12a[_0x2cec1b(0x243)](_0x4e37c2[_0x2cec1b(0x1a7)]))),0x1;let _0x5ce94f=_0x111d36?undefined:_0x525b7c,_0x5c680e,_0x128294;_0x4e37c2[_0x2cec1b(0x172)]===_0x2cec1b(0x16a)&&(_0x5ce94f=_0x4e37c2[_0x2cec1b(0x20f)],_0x5c680e=_0x4e37c2[_0x2cec1b(0x212)],_0x128294=_0x4e37c2[_0x2cec1b(0x177)]);const _0x4f89a7=_0x4e37c2['parentName'],_0x244bd1=_0x4e37c2['targetDir'];_0x3bc085[_0x2cec1b(0x268)]&&(console['error']('Parent\x20segment:\x20'+_0x4f89a7),console[_0x2cec1b(0x20b)](_0x2cec1b(0x1e4)+_0x244bd1),_0x5ce94f&&console[_0x2cec1b(0x20b)](_0x2cec1b(0x19d)+_0x5ce94f),_0x5c680e&&console[_0x2cec1b(0x20b)](_0x2cec1b(0x24a)+_0x5c680e),_0x128294&&console['error']('Folder\x20path:\x20'+_0x128294));const _0x31bbe0=await withSpinner(_0x2cec1b(0x18d),()=>_0x18a23f[_0x2cec1b(0x170)][_0x2cec1b(0x223)](_0x4f89a7),{'verbose':_0x40b81a[_0x2cec1b(0x268)]}),_0x21cb82=_0x31bbe0[_0x2cec1b(0x1e7)],{journeys:_0x57b2fc,folders:_0x3c528f}=await withSpinner(_0x2cec1b(0x1f4),async()=>{const _0x490cba=_0x2cec1b,[_0x21f263,_0x393be5]=await Promise[_0x490cba(0x181)]([_0x18a23f[_0x490cba(0x218)][_0x490cba(0x166)](_0x21cb82,undefined,{'includeAllVersions':!![]}),_0x18a23f[_0x490cba(0x170)][_0x490cba(0x273)](_0x21cb82)]);return{'journeys':_0x21f263,'folders':_0x393be5};},{'verbose':_0x40b81a['verbose']})[_0x2cec1b(0x1f5)](_0x1fd049=>_0x1fd049[_0x2cec1b(0x1e7)]);let _0x2299ed=_0x57b2fc;const _0x5dc01a=buildFolderIdToPathMap(_0x3c528f);if(_0x5ce94f){const _0x3fd073=_0x2299ed[_0x2cec1b(0x205)](_0x4a65a4=>_0x4a65a4[_0x2cec1b(0x240)]['toLowerCase']()===_0x5ce94f[_0x2cec1b(0x1d7)]());if(_0x3fd073[_0x2cec1b(0x186)]===0x0)return console['error'](_0x2cec1b(0x1b6)+_0x5ce94f),console['error']('Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys'),0x1;_0x2299ed=_0x3fd073;}if(_0x128294!==undefined){const _0x417d9f=_0x2299ed[_0x2cec1b(0x205)](_0x4813c7=>{const _0x2b0210=_0x2cec1b,_0x34a3ce=_0x4813c7[_0x2b0210(0x249)]?_0x5dc01a[_0x2b0210(0x1ca)](_0x4813c7[_0x2b0210(0x249)])||'':'';return _0x34a3ce===_0x128294;});if(_0x417d9f['length']===0x0&&_0x2299ed[_0x2cec1b(0x186)]>0x0){console[_0x2cec1b(0x20b)](_0x2cec1b(0x200)+_0x5ce94f+_0x2cec1b(0x1d3)+(_0x128294||_0x2cec1b(0x1cf))),console['error']('Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:');for(const _0x5e2e78 of _0x2299ed){const _0x21b547=_0x5e2e78['folderId']?_0x5dc01a[_0x2cec1b(0x1ca)](_0x5e2e78[_0x2cec1b(0x249)])||'':'';console['error'](_0x2cec1b(0x1d1)+(_0x21b547||_0x2cec1b(0x1b7))+'/'+_0x5e2e78[_0x2cec1b(0x240)]);}return 0x1;}_0x2299ed=_0x417d9f;}if(_0x2299ed['length']===0x0)return console[_0x2cec1b(0x20b)]('No\x20journeys\x20found'),0x0;const _0x517166=new Map();for(const _0x3c467b of _0x2299ed){const _0x4b145f=_0x3c467b[_0x2cec1b(0x1b4)];!_0x517166[_0x2cec1b(0x1ed)](_0x4b145f)&&_0x517166['set'](_0x4b145f,[]),_0x517166['get'](_0x4b145f)[_0x2cec1b(0x1ba)](_0x3c467b);}for(const _0x56b5db of _0x517166[_0x2cec1b(0x193)]()){_0x56b5db['sort']((_0x38f03f,_0x5a3fff)=>(_0x38f03f[_0x2cec1b(0x18e)]||0x0)-(_0x5a3fff[_0x2cec1b(0x18e)]||0x0));}const _0x7dd3dc=[],{idToEmailMap:_0x4fbb9c,connectionIdToNameMap:_0x366725}=await withSpinner('Fetching\x20users\x20and\x20connections...',async()=>{const _0x17e9bd=_0x2cec1b,[_0x340fe8,_0x21fd49]=await Promise[_0x17e9bd(0x181)]([_0x18a23f[_0x17e9bd(0x22c)][_0x17e9bd(0x1fb)](),_0x18a23f[_0x17e9bd(0x1a9)][_0x17e9bd(0x175)]()]);return{'idToEmailMap':_0x340fe8,'connectionIdToNameMap':_0x21fd49};},{'verbose':_0x40b81a[_0x2cec1b(0x268)]})['then'](_0x2fa4e0=>_0x2fa4e0['data']);for(const _0x106c73 of _0x517166[_0x2cec1b(0x193)]()){const _0x3584ee=_0x106c73[0x0][_0x2cec1b(0x240)],_0x451b74=_0x106c73[0x0][_0x2cec1b(0x249)],_0x65c59d=_0x451b74?_0x5dc01a[_0x2cec1b(0x1ca)](_0x451b74)||'':'',_0x3b52d3=_0x65c59d?a27_0xce06a6[_0x2cec1b(0x219)](_0x244bd1,_0x65c59d):_0x244bd1,_0x4093b4=_0x5c680e||a27_0xce06a6['join'](_0x3b52d3,sanitizeFileName(_0x3584ee)+_0x2cec1b(0x272));let _0x2486cf,_0x35e479;if(existsSync(_0x4093b4))try{const _0x373220=readFileSync(_0x4093b4,'utf-8'),_0x5024d8=parseYamlString(_0x373220);_0x35e479=_0x5024d8,_0x2486cf=buildRuleToNameMapping(_0x5024d8),_0x3bc085[_0x2cec1b(0x268)]&&_0x2486cf[_0x2cec1b(0x1bf)]>0x0&&console[_0x2cec1b(0x20b)]('Found\x20'+_0x2486cf[_0x2cec1b(0x1bf)]+_0x2cec1b(0x1dc)+_0x3584ee);}catch(_0x374622){_0x3bc085['verbose']&&console['error'](_0x2cec1b(0x1fa)+_0x374622[_0x2cec1b(0x1c8)]);}const _0x243929=[],_0x47ff4e=new Set(),_0xf0f2b7=new Map(),_0x4ee185=new Map(),_0x2734e3=new Set(),_0x3d9794=new Map(),_0x59f730=new Map(),_0x16f5a8=createJumpTargetCache();await withProgressSpinner(_0x2cec1b(0x26c)+_0x3584ee+_0x2cec1b(0x176),async _0x2f981a=>{const _0x543df1=_0x2cec1b;for(const _0x50939e of _0x106c73){const _0x1bb2f3=_0x106c73[_0x543df1(0x186)]>0x1?_0x50939e[_0x543df1(0x240)]+'\x20v'+(_0x50939e[_0x543df1(0x18e)]||0x1):_0x50939e[_0x543df1(0x240)];_0x2f981a['setPhase'](_0x543df1(0x26c)+_0x1bb2f3);const _0xc1e69b=await _0x18a23f['journey'][_0x543df1(0x1f1)](_0x50939e['id']),_0x1c7eee=_0xc1e69b[_0x543df1(0x21a)]?.[_0x543df1(0x208)],_0x53bb26={'resolveSegment':async _0x3f6d45=>{const _0x470815=_0x543df1;if(!_0x1c7eee)return{'name':_0x3f6d45,'isJourneyLocal':![]};const _0x1850c1=_0xf0f2b7[_0x470815(0x1ca)](_0x3f6d45);if(_0x1850c1)return _0x1850c1;try{const _0x9867e=await _0x18a23f[_0x470815(0x170)][_0x470815(0x199)](_0x1c7eee,_0x3f6d45),_0x53c0ec=_0x9867e[_0x470815(0x214)]===SEGMENT_KIND_JOURNEY;let _0x32222d,_0x307a6d=_0x9867e[_0x470815(0x266)];if(_0x53c0ec&&_0x9867e['rule']){const _0x4197c6=await segmentResponseToDef(_0x9867e,{'resolveSegmentName':async _0x26b749=>{const _0x39c8d3=_0x470815,_0x10c12d=_0xf0f2b7[_0x39c8d3(0x1ca)](_0x26b749);if(_0x10c12d)return _0x10c12d[_0x39c8d3(0x266)];const _0x18866e=await _0x53bb26[_0x39c8d3(0x220)](_0x26b749);return _0x18866e[_0x39c8d3(0x266)];}}),_0x59b7cd=_0x4197c6[_0x470815(0x19e)];_0x32222d={'description':_0x9867e[_0x470815(0x23c)],'rule':_0x59b7cd};const _0x13cabd=serializeRule(_0x59b7cd),_0x443254=_0x4ee185[_0x470815(0x1ca)](_0x13cabd);if(_0x443254)_0x307a6d=_0x443254,_0x32222d=undefined,_0x3bc085['verbose']&&console['error'](_0x470815(0x216)+_0x9867e[_0x470815(0x266)]+_0x470815(0x246)+_0x443254);else{let _0x349896=![];if(_0x2486cf){const _0x515e34=_0x2486cf[_0x470815(0x1ca)](_0x13cabd);if(_0x515e34){const _0x1eb8fa=_0x515e34[_0x470815(0x271)](_0x2cc8b6=>!_0x47ff4e[_0x470815(0x1ed)](_0x2cc8b6));_0x1eb8fa&&(_0x307a6d=_0x1eb8fa,_0x47ff4e[_0x470815(0x25a)](_0x1eb8fa),_0x4ee185[_0x470815(0x24e)](_0x13cabd,_0x1eb8fa),_0x349896=!![],_0x3bc085[_0x470815(0x268)]&&console['error'](_0x470815(0x187)+_0x1eb8fa+_0x470815(0x263)));}}if(!_0x349896){const _0x3c5eb2=generateJourneyLocalName(_0x9867e[_0x470815(0x266)]);_0x3c5eb2&&(_0x307a6d=_0x3c5eb2);let _0x50ec88=_0x307a6d,_0x45345a=0x2;while(_0x47ff4e[_0x470815(0x1ed)](_0x50ec88)){_0x50ec88=_0x307a6d+'_'+_0x45345a,_0x45345a++;}_0x47ff4e[_0x470815(0x25a)](_0x50ec88),_0x4ee185[_0x470815(0x24e)](_0x13cabd,_0x50ec88),_0x307a6d=_0x50ec88;}}}const _0x46ff63={'name':_0x307a6d,'isJourneyLocal':_0x53c0ec,'definition':_0x32222d};return _0xf0f2b7[_0x470815(0x24e)](_0x3f6d45,_0x46ff63),_0x46ff63;}catch(_0x119cbe){return _0x40b81a[_0x470815(0x268)]&&console[_0x470815(0x20b)](_0x470815(0x1be)+_0x3f6d45+':\x20'+_0x119cbe['message']),{'name':_0x3f6d45,'isJourneyLocal':![]};}},'resolveActivation':async _0x2c350c=>{const _0x26ba79=_0x543df1,_0x11daf7=_0x3d9794[_0x26ba79(0x1ca)](_0x2c350c);if(_0x11daf7)return _0x11daf7;try{const _0x525559=await _0x18a23f[_0x26ba79(0x218)][_0x26ba79(0x189)](_0x50939e['id'],_0x2c350c),_0x171121=journeyActivationStepToYaml(_0x525559,_0x4fbb9c,_0x366725),_0xf049a=JSON[_0x26ba79(0x239)]({'name':_0x171121[_0x26ba79(0x266)],'connection':_0x171121[_0x26ba79(0x1a9)],'connector_config':_0x171121[_0x26ba79(0x16c)]}),_0x3f4cab=_0x59f730['get'](_0xf049a);if(_0x3f4cab){const _0x409bbc={'name':_0x3f4cab,'isJourneyLocal':!![],'definition':_0x171121};return _0x3d9794[_0x26ba79(0x24e)](_0x2c350c,_0x409bbc),_0x409bbc;}const _0xd2a45f=_0x525559[_0x26ba79(0x21a)][_0x26ba79(0x23e)][_0x26ba79(0x266)]||_0x2c350c,_0x1a7fad=sanitizeYamlKey(_0xd2a45f)||_0x26ba79(0x230)+_0x2c350c;let _0xc746e3=_0x1a7fad,_0xfbaa5f=0x2;while(_0x2734e3[_0x26ba79(0x1ed)](_0xc746e3)){_0xc746e3=_0x1a7fad+'_'+_0xfbaa5f,_0xfbaa5f++;}_0x2734e3['add'](_0xc746e3),_0x59f730[_0x26ba79(0x24e)](_0xf049a,_0xc746e3);const _0x3b8761={'name':_0xc746e3,'isJourneyLocal':!![],'definition':_0x171121};return _0x3d9794['set'](_0x2c350c,_0x3b8761),_0x3b8761;}catch(_0x2523d8){return _0x40b81a[_0x26ba79(0x268)]&&console[_0x26ba79(0x20b)]('Warning:\x20Could\x20not\x20resolve\x20activation\x20'+_0x2c350c+':\x20'+_0x2523d8['message']),{'name':_0x2c350c,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x1be8d6,_0x181fa9)=>{const _0x376518=_0x543df1;return resolveJumpTarget(_0x1be8d6,_0x181fa9,_0x16f5a8,_0xc77bad=>_0x18a23f[_0x376518(0x218)][_0x376518(0x1f1)](_0xc77bad));}},_0x5a4380=await journeyResponseToDef(_0xc1e69b,_0x53bb26);_0x243929[_0x543df1(0x1ba)]({'item':_0x50939e,'yaml':_0x5a4380});}},{'verbose':_0x40b81a['verbose']});const _0x29d030=await _0x18a23f['journey'][_0x2cec1b(0x24b)](_0x106c73[0x0][_0x2cec1b(0x1b4)]),_0xace144=buildMergedJourneyDef(_0x243929,_0x2486cf,_0x29d030),_0xfc2783=normalizeJourneyDef(_0xace144,_0x35e479),_0x35ecb7=toYamlString(_0xfc2783),_0x20f798=_0x5c680e||a27_0xce06a6[_0x2cec1b(0x219)](_0x3b52d3,sanitizeFileName(_0x3584ee)+'.yml');!_0x5c680e&&_0x65c59d&&!existsSync(_0x3b52d3)&&mkdirSync(_0x3b52d3,{'recursive':!![]});const _0x379f49=a27_0xce06a6[_0x2cec1b(0x17c)](process[_0x2cec1b(0x241)](),_0x20f798);if(existsSync(_0x20f798)){const _0x11aaeb=readFileSync(_0x20f798,_0x2cec1b(0x1ad)),_0x4c7a31=generateDiff(_0x11aaeb,_0x35ecb7),_0x3a1cc0=hasChanges(_0x4c7a31);_0x7dd3dc[_0x2cec1b(0x1ba)]({'relativePath':_0x379f49,'absolutePath':_0x20f798,'content':_0x35ecb7,'isNew':![],'hasChanges':_0x3a1cc0,'diff':_0x3a1cc0?formatDiffWithColors(_0x4c7a31):undefined});}else _0x7dd3dc[_0x2cec1b(0x1ba)]({'relativePath':_0x379f49,'absolutePath':_0x20f798,'content':_0x35ecb7,'isNew':!![],'hasChanges':![]});}const _0x7eeb18=_0x7dd3dc['filter'](_0x322ab8=>_0x322ab8[_0x2cec1b(0x19a)]),_0x17d771=_0x7dd3dc[_0x2cec1b(0x205)](_0x48133d=>!_0x48133d['isNew']&&_0x48133d[_0x2cec1b(0x163)]),_0x158f6e=_0x7dd3dc[_0x2cec1b(0x205)](_0x500430=>!_0x500430[_0x2cec1b(0x19a)]&&!_0x500430[_0x2cec1b(0x163)]),_0x3ed5ff=_0x2299ed[_0x2cec1b(0x186)],_0x16e130=_0x517166[_0x2cec1b(0x1bf)],_0x128151=_0x3ed5ff>_0x16e130?'\x20('+_0x3ed5ff+_0x2cec1b(0x221):'';console['error'](_0x2cec1b(0x26e)),console['error']('\x20\x20'+a27_0x3af12a[_0x2cec1b(0x243)](_0x16e130+_0x2cec1b(0x25b))+a27_0x3af12a[_0x2cec1b(0x244)](_0x128151)),console[_0x2cec1b(0x20b)]('\x20\x20'+a27_0x3af12a[_0x2cec1b(0x1fc)]('+\x20'+_0x7eeb18[_0x2cec1b(0x186)]+_0x2cec1b(0x204))),console[_0x2cec1b(0x20b)]('\x20\x20'+a27_0x3af12a[_0x2cec1b(0x21f)]('~\x20'+_0x17d771[_0x2cec1b(0x186)]+_0x2cec1b(0x22b))),console[_0x2cec1b(0x20b)]('\x20\x20'+a27_0x3af12a[_0x2cec1b(0x244)]('=\x20'+_0x158f6e[_0x2cec1b(0x186)]+'\x20unchanged\x20files')),console[_0x2cec1b(0x20b)](_0x2cec1b(0x1d5)+a27_0x3af12a['cyan'](_0x244bd1)+'\x0a');if(_0x17d771[_0x2cec1b(0x186)]>0x0)for(const _0x51a6c6 of _0x17d771){console[_0x2cec1b(0x20b)](_0x2cec1b(0x250)+_0x51a6c6[_0x2cec1b(0x1e9)]+'\x27:'),console[_0x2cec1b(0x20b)]('─'[_0x2cec1b(0x19f)](0x3c)),console['error'](_0x51a6c6[_0x2cec1b(0x262)]),console[_0x2cec1b(0x20b)]('─'[_0x2cec1b(0x19f)](0x3c));}if(_0x3bc085[_0x2cec1b(0x242)])return console[_0x2cec1b(0x20b)](a27_0x3af12a[_0x2cec1b(0x21f)](_0x2cec1b(0x1f8))),0x0;if(_0x7eeb18['length']===0x0&&_0x17d771[_0x2cec1b(0x186)]===0x0)return console[_0x2cec1b(0x20b)](a27_0x3af12a[_0x2cec1b(0x1fc)](_0x2cec1b(0x261))),saveSessionContext({'parent_segment':_0x4f89a7},_0x3bc085[_0x2cec1b(0x19c)]),console['error'](a27_0x3af12a[_0x2cec1b(0x1fc)](_0x2cec1b(0x1d0)+a27_0x3af12a[_0x2cec1b(0x244)](_0x2cec1b(0x26f))+'\x20=\x20'+a27_0x3af12a[_0x2cec1b(0x243)](_0x4f89a7))),0x0;if(!_0x3bc085[_0x2cec1b(0x238)]&&(_0x7eeb18[_0x2cec1b(0x186)]>0x0||_0x17d771[_0x2cec1b(0x186)]>0x0)){if(!isInteractive())return console[_0x2cec1b(0x20b)](a27_0x3af12a[_0x2cec1b(0x1b3)]('\x0aError:'),_0x2cec1b(0x1c3)),console['error'](a27_0x3af12a[_0x2cec1b(0x244)](_0x2cec1b(0x267))),0x1;const _0x4ef287=await confirmKey(_0x2cec1b(0x17d)+(_0x7eeb18[_0x2cec1b(0x186)]+_0x17d771[_0x2cec1b(0x186)])+_0x2cec1b(0x1b5));if(!_0x4ef287)return console['error'](a27_0x3af12a[_0x2cec1b(0x21f)](_0x2cec1b(0x20a)),_0x2cec1b(0x169)),0x1;}!existsSync(_0x244bd1)&&mkdirSync(_0x244bd1,{'recursive':!![]});const _0x6f744f=a27_0xce06a6[_0x2cec1b(0x219)](_0x244bd1,_0x2cec1b(0x23a));writeFileSync(_0x6f744f,createTdxConfigContent(_0x4f89a7),'utf-8');for(const _0x49bc79 of _0x7dd3dc){(_0x49bc79['isNew']||_0x49bc79['hasChanges'])&&writeFileSync(_0x49bc79[_0x2cec1b(0x213)],_0x49bc79[_0x2cec1b(0x26d)],'utf-8');}return console[_0x2cec1b(0x20b)](a27_0x3af12a[_0x2cec1b(0x1fc)](_0x2cec1b(0x168)+(_0x7eeb18['length']+_0x17d771[_0x2cec1b(0x186)])+_0x2cec1b(0x1c6)+_0x244bd1)),saveSessionContext({'parent_segment':_0x4f89a7},_0x3bc085[_0x2cec1b(0x19c)]),console[_0x2cec1b(0x20b)](a27_0x3af12a[_0x2cec1b(0x1fc)](_0x2cec1b(0x1d0)+a27_0x3af12a[_0x2cec1b(0x244)](_0x2cec1b(0x26f))+'\x20=\x20'+a27_0x3af12a[_0x2cec1b(0x243)](_0x4f89a7))),0x0;}}export class JourneyColumnsCommand extends BaseCommand{[a27_0x1ccf16(0x266)]=a27_0x1ccf16(0x253);['description']=a27_0x1ccf16(0x237);async['execute'](_0x199e68){const _0x34a8fb=a27_0x1ccf16,{options:_0x46e4fc,args:_0xbc6adf,tdx:_0xff338a}=_0x199e68,_0x5d6669=_0xbc6adf[0x0];if(!requireNameOrPath(_0x5d6669))return 0x1;_0x46e4fc[_0x34a8fb(0x268)]&&console[_0x34a8fb(0x20b)](_0x34a8fb(0x25c)+_0x5d6669);const {journeyId:_0x45ee17}=await resolveJourneyIdFromInput(_0x5d6669,_0x46e4fc,_0xff338a),_0x216de1=await withSpinner(_0x34a8fb(0x248),()=>_0xff338a[_0x34a8fb(0x218)]['getColumnMapping'](_0x45ee17),{'verbose':_0x46e4fc[_0x34a8fb(0x268)]}),_0x53d33b=_0x216de1[_0x34a8fb(0x1e7)];return console[_0x34a8fb(0x1c1)](_0x34a8fb(0x22d)+_0x53d33b[_0x34a8fb(0x180)]),console[_0x34a8fb(0x1c1)]('Table:\x20'+_0x53d33b['table']),await handleSDKOutput(_0x53d33b['columns'],_0x46e4fc),0x0;}}export class JourneyActivationsCommand extends BaseCommand{[a27_0x1ccf16(0x266)]='journey:activations';['description']=a27_0x1ccf16(0x18f);async[a27_0x1ccf16(0x19b)](_0x62fc1d){const _0x548375=a27_0x1ccf16,{options:_0x26f4b0,args:_0x3a08b6,tdx:_0x4631b4}=_0x62fc1d,_0x331680=_0x3a08b6[0x0];if(!requireNameOrPath(_0x331680))return 0x1;_0x26f4b0[_0x548375(0x268)]&&console[_0x548375(0x20b)](_0x548375(0x25c)+_0x331680);const {journeyId:_0x1b3ae4}=await resolveJourneyIdFromInput(_0x331680,_0x26f4b0,_0x4631b4),_0x5c2bd2=await withSpinner(_0x548375(0x255),()=>_0x4631b4[_0x548375(0x218)][_0x548375(0x257)](_0x1b3ae4),{'verbose':_0x26f4b0['verbose']}),_0x537b8f=_0x5c2bd2[_0x548375(0x1e7)];return console[_0x548375(0x20b)](_0x548375(0x226)+_0x537b8f[_0x548375(0x186)]+_0x548375(0x1e3)+(_0x537b8f['length']!==0x1?'s':'')),await handleSDKOutput(_0x537b8f,_0x26f4b0),0x0;}}export class JourneyPushCommand extends BaseCommand{[a27_0x1ccf16(0x266)]='journey:push';[a27_0x1ccf16(0x23c)]=a27_0x1ccf16(0x1c2);[a27_0x1ccf16(0x1d6)]=new SegmentPushCommand();async[a27_0x1ccf16(0x19b)](_0x3ab978){const _0x1c1ecf=a27_0x1ccf16,_0x57f02e=_0x3ab978[_0x1c1ecf(0x1b2)][0x0];let _0x526f97;if(_0x57f02e){const _0xd25d91=await resolveTarget({'arg':_0x57f02e,'contextParent':_0x3ab978['options'][_0x1c1ecf(0x1bd)],'cwd':process[_0x1c1ecf(0x241)]()});isSuccessfulResolution(_0xd25d91)&&_0xd25d91['type']==='file'&&(_0x526f97=_0xd25d91['filePath']);}const _0x252a1e={..._0x3ab978,'options':{..._0x3ab978[_0x1c1ecf(0x1d8)],'journeysOnly':!![],..._0x526f97&&{'singleFilePath':_0x526f97}}};return this[_0x1c1ecf(0x1d6)]['execute'](_0x252a1e);}}export class JourneyVersionsCommand extends BaseCommand{[a27_0x1ccf16(0x266)]=a27_0x1ccf16(0x24c);[a27_0x1ccf16(0x23c)]=a27_0x1ccf16(0x222);async[a27_0x1ccf16(0x19b)](_0xcd8057){const _0x5b4cc1=a27_0x1ccf16,{options:_0x3279c1,args:_0x308aaf,tdx:_0x47ee44}=_0xcd8057,_0x51a1ce=_0x308aaf[0x0];if(!requireNameOrPath(_0x51a1ce))return 0x1;if(_0x3279c1['verbose'])console[_0x5b4cc1(0x20b)]('Input:\x20'+_0x51a1ce);const {journeyId:_0x1aa475}=await resolveJourneyIdFromInput(_0x51a1ce,_0x3279c1,_0x47ee44),_0x586651=await withSpinner(_0x5b4cc1(0x21b),()=>_0x47ee44[_0x5b4cc1(0x218)][_0x5b4cc1(0x1c9)](_0x1aa475),{'verbose':_0x3279c1[_0x5b4cc1(0x268)]}),{bundleName:_0xdff4cc,versions:_0x26a0a3,latestJourneyId:_0x430f13}=_0x586651['data'];console['error'](_0xdff4cc+':\x20'+_0x26a0a3[_0x5b4cc1(0x186)]+_0x5b4cc1(0x1ab)+(_0x26a0a3[_0x5b4cc1(0x186)]!==0x1?'s':''));const _0x1e87fd=_0x26a0a3[_0x5b4cc1(0x179)](_0x521541=>({'version':_0x521541['versionNumber'],'journey_id':_0x521541[_0x5b4cc1(0x1e6)],'name':_0x521541[_0x5b4cc1(0x266)],'state':_0x521541[_0x5b4cc1(0x188)],'paused':_0x521541[_0x5b4cc1(0x1af)],'latest':_0x521541[_0x5b4cc1(0x1e6)]===_0x430f13,'created_at':_0x521541[_0x5b4cc1(0x24f)]}));return await handleSDKOutput(_0x1e87fd,_0x3279c1),0x0;}}export class JourneyVersionCreateCommand extends BaseCommand{[a27_0x1ccf16(0x266)]=a27_0x1ccf16(0x26b);[a27_0x1ccf16(0x23c)]=a27_0x1ccf16(0x209);async[a27_0x1ccf16(0x19b)](_0x39dcb0){const _0x5236b3=a27_0x1ccf16,{options:_0x48cf9a,args:_0x22646b,tdx:_0x12e9c3}=_0x39dcb0,_0x14a655=_0x22646b[0x0];if(!requireNameOrPath(_0x14a655))return 0x1;if(_0x48cf9a[_0x5236b3(0x268)])console[_0x5236b3(0x20b)](_0x5236b3(0x25c)+_0x14a655);const {journeyId:_0x2513f9,journeyName:_0x317d12}=await resolveJourneyIdFromInput(_0x14a655,_0x48cf9a,_0x12e9c3);if(!_0x48cf9a[_0x5236b3(0x238)]){const _0x5ca3e8=await confirm('Create\x20a\x20new\x20draft\x20version\x20of\x20journey\x20\x22'+_0x317d12+'\x22?');if(!_0x5ca3e8)return console[_0x5236b3(0x20b)](_0x5236b3(0x195)),0x0;}const _0x47b542=await withSpinner('Creating\x20new\x20version...',()=>_0x12e9c3[_0x5236b3(0x218)][_0x5236b3(0x215)](_0x2513f9),{'verbose':_0x48cf9a[_0x5236b3(0x268)]}),_0x41858f=_0x47b542['data'];return console[_0x5236b3(0x20b)](a27_0x3af12a['green']('βœ”')+_0x5236b3(0x1c0)+_0x41858f[_0x5236b3(0x21a)][_0x5236b3(0x18e)]+_0x5236b3(0x233)+_0x41858f['attributes']['name']+'\x22'),console[_0x5236b3(0x20b)](_0x5236b3(0x1b0)+_0x41858f['id']),await handleSingleObjectOutput({'id':_0x41858f['id'],'name':_0x41858f[_0x5236b3(0x21a)][_0x5236b3(0x266)],'version':_0x41858f['attributes'][_0x5236b3(0x18e)],'state':_0x41858f['attributes']['state'],'bundle_id':_0x41858f[_0x5236b3(0x21a)][_0x5236b3(0x1b4)],'created_at':_0x41858f[_0x5236b3(0x21a)][_0x5236b3(0x24f)]},_0x48cf9a),0x0;}}export class JourneyVersionViewCommand extends BaseCommand{[a27_0x1ccf16(0x266)]=a27_0x1ccf16(0x234);[a27_0x1ccf16(0x23c)]='View\x20a\x20specific\x20version\x20of\x20a\x20journey';async[a27_0x1ccf16(0x19b)](_0x504d28){const _0xacfd05=a27_0x1ccf16,{options:_0x218434,args:_0x5549b0,tdx:_0x358b65}=_0x504d28,_0x40c271=_0x5549b0[0x0];if(!requireNameOrPath(_0x40c271))return 0x1;const _0x133b82=_0x218434[_0xacfd05(0x227)];if(!_0x133b82)return console[_0xacfd05(0x20b)](_0xacfd05(0x25f)),console[_0xacfd05(0x20b)]('Usage:\x20journey\x20version\x20view\x20<name-or-path>\x20--version\x20N'),0x1;const _0xc0834e=parseInt(_0x133b82,0xa);if(isNaN(_0xc0834e)||_0xc0834e<0x1)return console['error'](_0xacfd05(0x24d)+_0x133b82),0x1;if(_0x218434['verbose'])console[_0xacfd05(0x20b)]('Input:\x20'+_0x40c271+',\x20version:\x20'+_0xc0834e);const {journeyId:_0x1224cc,parentSegmentId:_0x1ed227}=await resolveJourneyIdFromInput(_0x40c271,_0x218434,_0x358b65),_0x37068a=await withSpinner(_0xacfd05(0x1ea),()=>_0x358b65['journey'][_0xacfd05(0x1c9)](_0x1224cc),{'verbose':_0x218434[_0xacfd05(0x268)]}),{versions:_0x403c5d,latestJourneyId:_0x48bef6}=_0x37068a[_0xacfd05(0x1e7)],_0x865b72=_0x403c5d['find'](_0x5587d2=>_0x5587d2[_0xacfd05(0x18e)]===_0xc0834e);if(!_0x865b72){const _0x4d4b09=_0x403c5d[_0xacfd05(0x179)](_0x48c4f6=>'v'+_0x48c4f6[_0xacfd05(0x18e)])[_0xacfd05(0x219)](',\x20');return console[_0xacfd05(0x20b)](_0xacfd05(0x1a5)+_0xc0834e+_0xacfd05(0x197)+_0x4d4b09),0x1;}const _0x14e00f=await withSpinner(_0xacfd05(0x17a)+_0xc0834e+'\x20details...',()=>_0x358b65[_0xacfd05(0x218)][_0xacfd05(0x1f1)](_0x865b72[_0xacfd05(0x1e6)]),{'verbose':_0x218434[_0xacfd05(0x268)]}),_0x24e900=_0x14e00f[_0xacfd05(0x1e7)],_0x40a517=getConsoleNextUrl(_0x218434['site'],_0xacfd05(0x178)+_0x1ed227+_0xacfd05(0x1a2)+_0x865b72[_0xacfd05(0x1e6)]+_0xacfd05(0x1e8));return await handleSingleObjectOutput({'id':_0x24e900['id'],'name':_0x24e900[_0xacfd05(0x21a)][_0xacfd05(0x266)],'version':_0x24e900[_0xacfd05(0x21a)][_0xacfd05(0x18e)],'description':_0x24e900[_0xacfd05(0x21a)][_0xacfd05(0x23c)],'state':_0x24e900['attributes'][_0xacfd05(0x188)],'paused':_0x24e900['attributes'][_0xacfd05(0x1af)],'reentry_mode':_0x24e900[_0xacfd05(0x21a)]['reentryMode'],'stages':_0x24e900['attributes'][_0xacfd05(0x207)]?.[_0xacfd05(0x186)]||0x0,..._0x24e900[_0xacfd05(0x21a)]['goal']&&{'goal':_0x24e900['attributes'][_0xacfd05(0x1de)][_0xacfd05(0x266)]},'latest':_0x865b72[_0xacfd05(0x1e6)]===_0x48bef6,'created_at':_0x24e900[_0xacfd05(0x21a)][_0xacfd05(0x24f)],'updated_at':_0x24e900[_0xacfd05(0x21a)][_0xacfd05(0x1f0)],'url':_0x40a517},_0x218434),0x0;}}
1
+ const a27_0x4a917e=a27_0xe10d;(function(_0xb73dc8,_0x12dea0){const _0x33385f=a27_0xe10d,_0x4df6a0=_0xb73dc8();while(!![]){try{const _0x2760dd=-parseInt(_0x33385f(0x10f))/0x1*(parseInt(_0x33385f(0x1cf))/0x2)+parseInt(_0x33385f(0x1a1))/0x3*(parseInt(_0x33385f(0x1c5))/0x4)+-parseInt(_0x33385f(0x1a7))/0x5*(parseInt(_0x33385f(0x140))/0x6)+parseInt(_0x33385f(0x15c))/0x7*(parseInt(_0x33385f(0xe5))/0x8)+parseInt(_0x33385f(0x141))/0x9+-parseInt(_0x33385f(0x108))/0xa*(-parseInt(_0x33385f(0x17b))/0xb)+-parseInt(_0x33385f(0x13a))/0xc*(parseInt(_0x33385f(0x1ba))/0xd);if(_0x2760dd===_0x12dea0)break;else _0x4df6a0['push'](_0x4df6a0['shift']());}catch(_0x23c4a9){_0x4df6a0['push'](_0x4df6a0['shift']());}}}(a27_0x3ff4,0x7fefc));import a27_0xf82e6a from'chalk';import a27_0x51581f from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{aggregateStageHistory,assembleJourneyStats,buildStageNameMap}from'../sdk/journey.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey,isInteractive}from'../utils/prompt.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{journeyResponseToDef,toYamlString,parseYamlString,normalizeJourneyDef}from'../sdk/segment/journey-yaml.js';import{segmentResponseToDef,journeyActivationStepToYaml,serializeRule}from'../sdk/segment/child-segment-yaml.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';import{SegmentPushCommand}from'./segment-push-command.js';import{buildFolderIdToPathMap}from'../sdk/segment/resolution-context.js';import{createTdxConfigContent}from'../sdk/segment/tdx-config.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,createJumpTargetCache,resolveJumpTarget}from'../sdk/segment/journey-utils.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import{hyperlink}from'../sdk/util/formatters.js';function requireNameOrPath(_0x3e06b1){const _0x5c0498=a27_0xe10d;return!_0x3e06b1&&(console['error'](_0x5c0498(0xe7)),console[_0x5c0498(0x1a5)](_0x5c0498(0x103))),!!_0x3e06b1;}function withJsonFormat(_0x2d7767){const _0x2cd2fd=a27_0xe10d;if(!_0x2d7767[_0x2cd2fd(0x162)]&&!_0x2d7767[_0x2cd2fd(0x121)]&&!_0x2d7767[_0x2cd2fd(0xc4)]&&!_0x2d7767[_0x2cd2fd(0x196)])return{..._0x2d7767,'format':_0x2cd2fd(0x121),'json':!![]};return _0x2d7767;}function a27_0xe10d(_0xb28b97,_0xbc8be7){_0xb28b97=_0xb28b97-0xc3;const _0x3ff4d4=a27_0x3ff4();let _0xe10dcf=_0x3ff4d4[_0xb28b97];return _0xe10dcf;}function formatJourneyState(_0x278cde){const _0x494ac0=a27_0xe10d;switch(_0x278cde){case _0x494ac0(0x101):return a27_0xf82e6a[_0x494ac0(0x19e)](_0x494ac0(0x114));case _0x494ac0(0xcd):return a27_0xf82e6a[_0x494ac0(0x1b1)]('(draft)');case _0x494ac0(0x12c):return a27_0xf82e6a[_0x494ac0(0x17a)](_0x494ac0(0x112));case'completed':return a27_0xf82e6a[_0x494ac0(0x14f)]('(completed)');case _0x494ac0(0x18a):return a27_0xf82e6a[_0x494ac0(0x1b1)]('(archived)');default:return'('+_0x278cde+')';}}function formatJourneyItem(_0x458a56,_0x50d6e7='',_0x312be6){const _0x20d19a=a27_0xe10d,_0xb740d7=formatJourneyState(_0x458a56[_0x20d19a(0x13b)]),_0x131790=_0x312be6?hyperlink(_0x458a56['journeyBundleName'],_0x312be6):_0x458a56[_0x20d19a(0xdb)];return _0x50d6e7+'πŸ—ΊοΈ\x20'+_0x131790+'\x20'+_0xb740d7;}function escapeRegex(_0x305e09){const _0x43072e=a27_0xe10d;return _0x305e09[_0x43072e(0x17f)](/[.*+?^${}()|[\]\\]/g,_0x43072e(0x14c));}function globToRegex(_0x1075a3){const _0x5025e7=a27_0xe10d,_0x4b11ae=_0x1075a3[_0x5025e7(0x174)]('*')[_0x5025e7(0xd1)](escapeRegex);return new RegExp(_0x4b11ae['join']('.*'),'i');}function buildRuleToNameMapping(_0x583c17){const _0x30b622=a27_0xe10d,_0x5f5da8=new Map();if(_0x583c17['segments'])for(const [_0xe10e62,_0xa335a]of Object[_0x30b622(0xca)](_0x583c17['segments'])){if(_0xa335a[_0x30b622(0xdd)]){const _0x519081=serializeRule(_0xa335a[_0x30b622(0xdd)]),_0x5a3c48=_0x5f5da8[_0x30b622(0x1c7)](_0x519081);_0x5a3c48?_0x5a3c48[_0x30b622(0x165)](_0xe10e62):_0x5f5da8[_0x30b622(0x159)](_0x519081,[_0xe10e62]);}}return _0x5f5da8;}async function resolveJourneyIdFromInput(_0x352004,_0x4d4b67,_0x1260be){const _0x214de6=a27_0xe10d,_0x4eaac6=await resolveJourneyTarget(_0x352004,_0x4d4b67[_0x214de6(0xe8)],_0x4d4b67[_0x214de6(0x124)]),_0x5229f6=_0x4eaac6[_0x214de6(0xe8)];if(!_0x5229f6)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x214de6(0x115));const _0x26f886=await withSpinner(_0x214de6(0xeb),()=>_0x1260be['segment'][_0x214de6(0x1cb)](_0x5229f6),{'verbose':_0x4d4b67[_0x214de6(0x124)]}),_0x5c74ec=_0x26f886['data'],_0x44fa84=await withSpinner('Resolving\x20journey...',()=>_0x1260be[_0x214de6(0x14a)]['resolveJourneyId'](_0x5c74ec,_0x4eaac6[_0x214de6(0xc5)]),{'verbose':_0x4d4b67[_0x214de6(0x124)]});return{'journeyId':_0x44fa84[_0x214de6(0x1ce)],'journeyName':_0x4eaac6[_0x214de6(0xc5)],'parentSegmentId':_0x5c74ec};}async function resolveJourneyTarget(_0x53925d,_0xf2e75b,_0x2aa94f){const _0x554ff9=a27_0xe10d;if(isYamlFilePath(_0x53925d))try{const _0x13295d=await resolveYamlFilePath(_0x53925d);return _0x2aa94f&&(console['error'](_0x554ff9(0x1b3)+_0x53925d),console[_0x554ff9(0x1a5)](_0x554ff9(0x154)+_0x13295d[_0x554ff9(0xe8)]),console['error']('\x20\x20Name:\x20'+_0x13295d[_0x554ff9(0x16e)]),console[_0x554ff9(0x1a5)](_0x554ff9(0xfb)+(_0x13295d[_0x554ff9(0x113)]||_0x554ff9(0x129)))),{'journeyName':_0x13295d[_0x554ff9(0x16e)],'parentSegment':_0x13295d['parentSegment'],'resolved':_0x13295d};}catch(_0x45b6e0){throw new SDKError(ErrorCode[_0x554ff9(0x1b5)],_0x554ff9(0x195)+_0x45b6e0[_0x554ff9(0x153)]);}if(!_0xf2e75b)throw new SDKError(ErrorCode[_0x554ff9(0x1b5)],_0x554ff9(0x156));return{'journeyName':_0x53925d,'parentSegment':_0xf2e75b};}export class JourneyListCommand extends BaseCommand{[a27_0x4a917e(0x126)]=a27_0x4a917e(0x179);['description']=a27_0x4a917e(0xe4);async[a27_0x4a917e(0x144)](_0xa0c88f){const _0x38c9e8=a27_0x4a917e,{options:_0x3585c5,args:_0x30d382,tdx:_0x40861c}=_0xa0c88f,_0x1bc4c0=_0x30d382[0x0],_0x6f9ea0=_0x3585c5[_0x38c9e8(0xe8)];if(!_0x6f9ea0)return console[_0x38c9e8(0x1a5)]('Error:\x20Parent\x20segment\x20context\x20required'),console[_0x38c9e8(0x1a5)](_0x38c9e8(0xf8)),0x1;const _0x1b38a2=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x40861c[_0x38c9e8(0x110)][_0x38c9e8(0x1cb)](_0x6f9ea0),{'verbose':_0x3585c5[_0x38c9e8(0x124)]}),_0x2a134=_0x1b38a2[_0x38c9e8(0x1ce)];_0x3585c5[_0x38c9e8(0x124)]&&(console[_0x38c9e8(0x1a5)](_0x38c9e8(0x145)+_0x6f9ea0+_0x38c9e8(0xde)+_0x2a134+')'),_0x1bc4c0&&console['error']('Pattern:\x20'+_0x1bc4c0));const _0x1c215a=await withSpinner(_0x38c9e8(0x122),()=>_0x40861c[_0x38c9e8(0x110)][_0x38c9e8(0x143)](_0x2a134),{'verbose':_0x3585c5[_0x38c9e8(0x124)]}),_0xd03f20=_0x1c215a['data'],_0x27609f=_0xd03f20['rootFolderId'],_0x325a21=await withSpinner(_0x38c9e8(0x164),()=>_0x40861c[_0x38c9e8(0x14a)][_0x38c9e8(0x16c)](_0x2a134,_0x27609f),{'verbose':_0x3585c5['verbose']});let _0xc8fe63=_0x325a21[_0x38c9e8(0x1ce)][_0x38c9e8(0x155)];const _0x523137=_0x325a21[_0x38c9e8(0x1ce)][_0x38c9e8(0x172)],_0x33043a=new Map();for(const _0x1ff4f4 of _0x523137){_0x33043a[_0x38c9e8(0x159)](_0x1ff4f4['id'],_0x1ff4f4[_0x38c9e8(0x126)]);}if(_0x1bc4c0){const _0x1a0536=globToRegex(_0x1bc4c0);_0xc8fe63=_0xc8fe63[_0x38c9e8(0x18b)](_0x159024=>_0x1a0536[_0x38c9e8(0x105)](_0x159024[_0x38c9e8(0xdb)]));}console[_0x38c9e8(0x1a5)](_0x38c9e8(0x11b)+_0xc8fe63[_0x38c9e8(0x13c)]+_0x38c9e8(0x131)+(_0xc8fe63[_0x38c9e8(0x13c)]!==0x1?'s':''));const _0x10e533=_0x1f75a5=>{const _0x54b67b=_0x38c9e8;return getConsoleNextUrl(_0x3585c5[_0x54b67b(0x191)],_0x54b67b(0x12b)+_0x2a134+_0x54b67b(0x178)+_0x1f75a5+_0x54b67b(0x127));};if(_0x3585c5['format']===_0x38c9e8(0x128))await handleSDKOutput(_0xc8fe63,_0x3585c5);else{if(_0x3585c5[_0x38c9e8(0x162)]===_0x38c9e8(0x121)){const _0x4d77b9=_0xc8fe63['map'](_0x31608e=>({..._0x31608e,'url':_0x10e533(_0x31608e['id'])}));await handleSDKOutput(_0x4d77b9,_0x3585c5);}else{console[_0x38c9e8(0xf7)]('['+_0x6f9ea0+']');const _0x3aeef7=new Map(),_0x5c101c=[];for(const _0x3a2f1b of _0xc8fe63){if(!_0x3a2f1b[_0x38c9e8(0xf3)]||_0x3a2f1b[_0x38c9e8(0xf3)]===_0x27609f)_0x5c101c['push'](_0x3a2f1b);else{const _0x3713b8=_0x3aeef7[_0x38c9e8(0x1c7)](_0x3a2f1b[_0x38c9e8(0xf3)])||[];_0x3713b8['push'](_0x3a2f1b),_0x3aeef7[_0x38c9e8(0x159)](_0x3a2f1b[_0x38c9e8(0xf3)],_0x3713b8);}}const _0x5f3ef7=(_0x4c2fe7,_0x2020e0)=>_0x4c2fe7[_0x38c9e8(0xdb)][_0x38c9e8(0xfc)](_0x2020e0[_0x38c9e8(0xdb)],undefined,{'sensitivity':_0x38c9e8(0xcb)});_0x5c101c[_0x38c9e8(0xf4)](_0x5f3ef7);for(const _0x4988d6 of _0x5c101c){console[_0x38c9e8(0xf7)](formatJourneyItem(_0x4988d6,'',_0x10e533(_0x4988d6['id'])));}const _0x52b2b7=[..._0x3aeef7[_0x38c9e8(0xca)]()][_0x38c9e8(0xf4)]((_0x3eec24,_0x5f2505)=>{const _0x44d712=_0x38c9e8,_0x5f42cc=_0x33043a['get'](_0x3eec24[0x0])||_0x3eec24[0x0],_0x5005ec=_0x33043a['get'](_0x5f2505[0x0])||_0x5f2505[0x0];return _0x5f42cc[_0x44d712(0xfc)](_0x5005ec,undefined,{'sensitivity':_0x44d712(0xcb)});});for(const [_0x3d4e23,_0x49f523]of _0x52b2b7){const _0x50e4c8=_0x33043a[_0x38c9e8(0x1c7)](_0x3d4e23)||_0x3d4e23;console[_0x38c9e8(0xf7)](_0x38c9e8(0x123)+_0x50e4c8),_0x49f523[_0x38c9e8(0xf4)](_0x5f3ef7);for(const _0x52112a of _0x49f523){console['log'](formatJourneyItem(_0x52112a,'\x20\x20',_0x10e533(_0x52112a['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a27_0x4a917e(0x126)]=a27_0x4a917e(0x134);[a27_0x4a917e(0x1b7)]='Show\x20journey\x20details';async[a27_0x4a917e(0x144)](_0x514604){const _0x294f02=a27_0x4a917e,{options:_0x26f832,args:_0x5e9b30,tdx:_0x53214c}=_0x514604,_0x2558ff=_0x5e9b30[0x0];if(!_0x2558ff)return console['error'](_0x294f02(0xe7)),console[_0x294f02(0x1a5)]('Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]'),console[_0x294f02(0x1a5)]('Options:'),console['error'](_0x294f02(0x152)),0x1;_0x26f832['verbose']&&console[_0x294f02(0x1a5)](_0x294f02(0x1a6)+_0x2558ff);const {journeyId:_0x54d3fe,parentSegmentId:_0x47a3b0}=await resolveJourneyIdFromInput(_0x2558ff,_0x26f832,_0x53214c);if(_0x26f832['web']){const _0x440459=getConsoleNextUrl(_0x26f832[_0x294f02(0x191)],_0x294f02(0x12b)+_0x47a3b0+_0x294f02(0x178)+_0x54d3fe+_0x294f02(0x1a4));return console[_0x294f02(0x1a5)](a27_0xf82e6a[_0x294f02(0x19e)]('βœ”')+_0x294f02(0x186)+a27_0xf82e6a[_0x294f02(0x1b2)](_0x440459)),openBrowser(_0x440459),0x0;}const _0x388292=await withSpinner(_0x294f02(0x1a2),()=>_0x53214c['journey']['getJourney'](_0x54d3fe),{'verbose':_0x26f832['verbose']}),_0x18749a=_0x388292['data'],_0xeec376=_0x26f832[_0x294f02(0x125)];let _0x3b702b;if(_0xeec376)try{const _0x40b1a6=await withSpinner(_0x294f02(0x1cc),()=>_0x53214c[_0x294f02(0x14a)][_0x294f02(0xed)](_0x54d3fe),{'verbose':_0x26f832['verbose']});_0x3b702b=_0x40b1a6['data'];}catch{_0x26f832['verbose']&&console['error'](_0x294f02(0x181));}const _0x3e0c4b=getConsoleNextUrl(_0x26f832[_0x294f02(0x191)],_0x294f02(0x12b)+_0x47a3b0+_0x294f02(0x178)+_0x54d3fe+_0x294f02(0x1a4)),_0x33fb5b={'id':_0x18749a['id'],'name':_0x18749a[_0x294f02(0xc7)][_0x294f02(0x126)],'description':_0x18749a['attributes'][_0x294f02(0x1b7)],'state':_0x18749a[_0x294f02(0xc7)][_0x294f02(0x13b)],'paused':_0x18749a['attributes'][_0x294f02(0x12c)],'reentry_mode':_0x18749a[_0x294f02(0xc7)]['reentryMode'],'stages':_0x18749a[_0x294f02(0xc7)][_0x294f02(0xd3)]?.['length']||0x0,..._0x18749a[_0x294f02(0xc7)][_0x294f02(0xe6)]&&{'goal':_0x18749a[_0x294f02(0xc7)][_0x294f02(0xe6)]['name']},..._0x3b702b&&{'statistics':{'size':_0x3b702b['size'],'entered':_0x3b702b['enteredSize'],'goal_achieved':_0x3b702b[_0x294f02(0x17c)],'completion_rate':_0x3b702b[_0x294f02(0x14b)],'exit_or_jump':_0x3b702b[_0x294f02(0x11a)],'exit_or_jump_rate':_0x3b702b[_0x294f02(0x189)],'stages':_0x3b702b[_0x294f02(0x149)]}},'url':_0x3e0c4b};return await handleSingleObjectOutput(_0x33fb5b,_0x26f832),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a27_0x4a917e(0x126)]=a27_0x4a917e(0x11c);[a27_0x4a917e(0x1b7)]=a27_0x4a917e(0xfe);async[a27_0x4a917e(0x144)](_0x43298d){const _0x22a634=a27_0x4a917e,{options:_0x2f499d,args:_0x1e9350,tdx:_0x258cad}=_0x43298d,_0x4bc299=_0x1e9350[0x0];if(!requireNameOrPath(_0x4bc299))return 0x1;_0x2f499d[_0x22a634(0x124)]&&console['error'](_0x22a634(0x1a6)+_0x4bc299);const _0x194ede=_0x2f499d,_0x4a6a60=_0x194ede['from'],_0x4d3761=_0x194ede['to'],_0x2a43ee=_0x194ede[_0x22a634(0x168)],_0x1cbd38=_0x194ede[_0x22a634(0x167)];_0x2a43ee&&!_0x4a6a60&&!_0x4d3761&&console[_0x22a634(0x1a5)](_0x22a634(0x16a));const _0x550049=_0x2a43ee?withJsonFormat(_0x2f499d):_0x2f499d,{journeyId:_0x2c9361,journeyName:_0x3774c6}=await resolveJourneyIdFromInput(_0x4bc299,_0x550049,_0x258cad),_0xa3c32=_0x4a6a60||_0x4d3761?{'from':_0x4a6a60,'to':_0x4d3761}:undefined,_0x2d4830=await withSpinner(_0x22a634(0x1cc),()=>Promise['all']([_0x258cad[_0x22a634(0x14a)][_0x22a634(0xec)](_0x2c9361),_0x258cad['journey'][_0x22a634(0xed)](_0x2c9361,_0xa3c32)]),{'verbose':_0x550049[_0x22a634(0x124)]}),[_0x115976,_0x5aae74]=_0x2d4830[_0x22a634(0x1ce)];if(!_0x5aae74||_0x5aae74['journeyId']===null)return console[_0x22a634(0x1a5)](_0x22a634(0xf1)+_0x3774c6),console[_0x22a634(0x1a5)](_0x22a634(0x171)),0x0;const _0x4ba968=buildStageNameMap(_0x115976),_0x5af7b5=!!(_0xa3c32&&_0x5aae74[_0x22a634(0x19f)]?.[_0x22a634(0x13c)]),_0x12eef3={'stageNameMap':_0x4ba968,'hasPeriod':_0x5af7b5,'includeHistory':!!_0x2a43ee};if(_0x1cbd38&&_0x5aae74['stages']){const _0x2267ff=_0x5aae74['stages'][_0x22a634(0x142)](_0x21a19e=>{const _0x90e42b=_0x22a634,_0xb73ee0=_0x4ba968[_0x90e42b(0x1c7)](_0x21a19e['id'])??'';return _0xb73ee0[_0x90e42b(0x18e)]()===_0x1cbd38[_0x90e42b(0x18e)]();});if(_0x2267ff)return await handleSingleObjectOutput(formatStageStats(_0x2267ff,_0x12eef3),_0x550049),0x0;const _0xa795f2=_0x5aae74[_0x22a634(0x149)][_0x22a634(0xd1)](_0x573613=>_0x4ba968[_0x22a634(0x1c7)](_0x573613['id'])??_0x573613['id']);return console[_0x22a634(0x1a5)]('Error:\x20Stage\x20\x22'+_0x1cbd38+'\x22\x20not\x20found'),console['error']('Available\x20stages:\x20'+_0xa795f2[_0x22a634(0xd9)](',\x20')),0x1;}const _0x33fe10=_0x5aae74['stages']?.['map'](_0x556b04=>formatStageStats(_0x556b04,_0x12eef3)),_0x1deb5b=assembleJourneyStats(_0x5aae74,{'from':_0x4a6a60,'to':_0x4d3761,'includeHistory':_0x2a43ee});return await this[_0x22a634(0xc8)](_0x1deb5b,_0x33fe10??[],_0x550049),0x0;}async[a27_0x4a917e(0xc8)](_0x4bb28,_0x1cd248,_0x5586a2){const _0x4f5da9=a27_0x4a917e,_0x5dcfa1=_0x5586a2[_0x4f5da9(0x162)]==='json'||_0x5586a2[_0x4f5da9(0x162)]===_0x4f5da9(0xc4)||_0x5586a2[_0x4f5da9(0x121)]||_0x5586a2[_0x4f5da9(0xc4)];if(_0x5dcfa1){_0x4bb28[_0x4f5da9(0x149)]=_0x1cd248,await handleSingleObjectOutput(_0x4bb28,_0x5586a2);return;}await handleSingleObjectOutput(_0x4bb28,_0x5586a2);for(const _0x426fe4 of _0x1cd248){console[_0x4f5da9(0xf7)](''),console[_0x4f5da9(0xf7)](String(a27_0xf82e6a[_0x4f5da9(0x1b2)][_0x4f5da9(0xc3)]('['+_0x426fe4[_0x4f5da9(0x126)]+']'))+a27_0xf82e6a['dim']('\x20'+_0x426fe4['id']));const {id:_0x17c4bc,name:_0x4582df,..._0x3de02a}=_0x426fe4;await handleSingleObjectOutput(_0x3de02a,_0x5586a2);}}}export class JourneyTrafficCommand extends BaseCommand{['name']=a27_0x4a917e(0x132);[a27_0x4a917e(0x1b7)]=a27_0x4a917e(0x104);async[a27_0x4a917e(0x144)](_0x5b49be){const _0x4a0c6c=a27_0x4a917e,{options:_0x1544d2,args:_0x3bab93,tdx:_0x5e98a4}=_0x5b49be,_0x2de219=_0x3bab93[0x0];if(!requireNameOrPath(_0x2de219))return 0x1;_0x1544d2[_0x4a0c6c(0x124)]&&console[_0x4a0c6c(0x1a5)](_0x4a0c6c(0x1a6)+_0x2de219);const _0x285c6b=_0x1544d2,_0x187047=_0x285c6b['type'],_0x19d943=_0x285c6b['from'],_0x4a1ad7=_0x285c6b['to'],_0x28e40f=_0x285c6b['limit'];if(_0x187047&&_0x187047!==_0x4a0c6c(0x16f)&&_0x187047!==_0x4a0c6c(0x16b))return console[_0x4a0c6c(0x1a5)](_0x4a0c6c(0xd0)+_0x187047+_0x4a0c6c(0x1bc)),0x1;const _0x2ab869=withJsonFormat(_0x1544d2),{journeyId:_0xecb5ec,journeyName:_0x37c816}=await resolveJourneyIdFromInput(_0x2de219,_0x2ab869,_0x5e98a4),_0x33d04a={'type':_0x187047,'from':_0x19d943,'to':_0x4a1ad7,'limit':_0x28e40f},_0x3d666d=await withSpinner(_0x4a0c6c(0xe2),()=>_0x5e98a4[_0x4a0c6c(0x14a)]['getTrafficData'](_0xecb5ec,_0x33d04a),{'verbose':_0x2ab869[_0x4a0c6c(0x124)]}),_0x10b029=_0x3d666d[_0x4a0c6c(0x1ce)],_0x3efbe9=_0x10b029['conversion']&&(_0x10b029[_0x4a0c6c(0x16f)][_0x4a0c6c(0x19c)]['length']>0x0||_0x10b029['conversion'][_0x4a0c6c(0x1a9)][_0x4a0c6c(0x13c)]>0x0),_0x59fe43=_0x10b029[_0x4a0c6c(0x16b)]&&_0x10b029[_0x4a0c6c(0x16b)][_0x4a0c6c(0x13c)]>0x0;if(!_0x3efbe9&&!_0x59fe43)return console[_0x4a0c6c(0x1a5)](_0x4a0c6c(0xcf)+_0x37c816),console[_0x4a0c6c(0x1a5)](_0x4a0c6c(0x10d)),_0x19d943&&_0x4a1ad7&&console[_0x4a0c6c(0x1a5)](_0x4a0c6c(0x1ac)),0x0;return await handleSingleObjectOutput(_0x10b029,_0x2ab869),0x0;}}function formatStageStats(_0x2b7660,_0x387479){const _0x1c212b=a27_0x4a917e,_0x10fdd6=_0x387479[_0x1c212b(0x177)]&&_0x2b7660[_0x1c212b(0x19f)]?.[_0x1c212b(0x13c)]?aggregateStageHistory(_0x2b7660[_0x1c212b(0x19f)]):{'size':_0x2b7660[_0x1c212b(0x175)],'entered':_0x2b7660[_0x1c212b(0xe3)],'milestone':_0x2b7660[_0x1c212b(0x185)],'milestone_rate':_0x2b7660[_0x1c212b(0x13e)],'exit_or_jump':_0x2b7660['exitOrJumpSize'],'exit_or_jump_rate':_0x2b7660[_0x1c212b(0x189)]},_0x54e308={'id':_0x2b7660['id'],'name':_0x387479['stageNameMap']['get'](_0x2b7660['id'])??_0x2b7660['id'],..._0x10fdd6};return _0x387479[_0x1c212b(0x177)]&&_0x387479[_0x1c212b(0x168)]&&_0x2b7660['history']&&(_0x54e308[_0x1c212b(0x19f)]=_0x2b7660[_0x1c212b(0x19f)]),_0x54e308;}function a27_0x3ff4(){const _0x451558=['Could\x20not\x20resolve\x20parent\x20segment.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','dryRun','listFolders','\x22\x20resumed','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','exitOrJumpSize','βœ”\x20Found\x20','journey:stats','connector_config','errorCode','Show\x20journey\x20table\x20column\x20mapping','reentryMode','json','Fetching\x20parent\x20segment...','πŸ“\x20','verbose','includeStats','name','/j/da','table','(root)','\x20->\x20','/app/ps/','paused','Getting\x20column\x20mapping...','absolutePath','resolveSegment','segmentPushCommand','\x20journey','journey:traffic','options','journey:view','\x20journey\x20files\x20to\x20','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','buildIdToNameMap','Error:\x20--version\x20option\x20is\x20required','\x20version','5803608rYmqKW','state','length',',\x20version:\x20','completeMilestoneRate','listActivationsFlat','128046udEiTX','5665248TXkzWt','find','getParentFull','execute','Parent\x20segment:\x20','Create\x20a\x20new\x20draft\x20version\x20of\x20a\x20journey','utf-8','resume','stages','journey','completionRate','\x5c$&','Listing\x20journey\x20versions...','getLatestJourneyId','blue','Folder\x20path:\x20','database','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','message','\x20\x20Parent\x20segment:\x20','journeys','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','\x20new\x20files','journey:versions','set','Getting\x20version\x20','file','1337wvSbXr','parent_segment','βœ”\x20Pulled\x20','relativePath','\x20journeys','getActivation','format','then','Listing\x20journeys...','push','pause','stage','includeHistory','createVersion','Warning:\x20--include-history\x20without\x20--from/--to\x20may\x20return\x20all-time\x20history','activation','listJourneysWithFolders','Journey\x20name:\x20','segmentName','conversion','Usage:\x20journey\x20version\x20view\x20<name-or-path>\x20--version\x20N','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','folders','journey:pull','split','size','\x20unchanged\x20files','hasPeriod','/e/','journey:list','yellow','1936cjvleU','goalSize','\x20=\x20','Error:\x20Journey\x20not\x20found:\x20','replace','βœ”\x20All\x20files\x20are\x20up\x20to\x20date','\x20\x20Statistics\x20not\x20available','Found\x20','\x20details...','connection','milestoneSize','\x20Opening\x20','type','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','exitOrJumpRate','archived','filter','\x20not\x20found.\x20Available:\x20','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','toLowerCase','values','user','site','Warning:\x20Could\x20not\x20resolve\x20segment\x20','Cancelled','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','tsv','\x20files?','listVersions','Target\x20directory:\x20','journey:version:create','setPhase','nodes','View\x20a\x20specific\x20version\x20of\x20a\x20journey','green','history','\x20activation','77433tmjDxc','Getting\x20journey\x20details...','Error:\x20Journey\x20\x27','/j/da/je','error','Input:\x20','160wjiQLj','add','links','no_parent','red','If\x20the\x20journey\x20is\x20active,\x20the\x20date\x20range\x20may\x20be\x20too\x20wide.\x20Try\x20a\x20shorter\x20period\x20(max\x20~90\x20days).','session','...','\x20\x20Journey\x20ID:\x20','cwd','dim','cyan','Resolved\x20YAML\x20file:\x20','versionNumber','INVALID_ARGUMENT','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','description','Database:\x20','filePath','26rOIqvj','journeyBundleId','\x22.\x20Must\x20be\x20\x22conversion\x22\x20or\x20\x22activation\x22.','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','Aborted.','hasChanges','\x20\x20-\x20','List\x20activations\x20for\x20a\x20journey','Error:\x20','activationParams','βœ”\x20Journey\x20\x22','104QdugGN','Warning:\x20Could\x20not\x20resolve\x20activation\x20','get','version','all','getSegment','resolveParentId','Getting\x20journey\x20statistics...','yes','data','2MDEjUT','bold','jsonl','journeyName','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','attributes','renderStats','\x20(draft)\x20β€”\x20\x22','entries','base','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','draft','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','No\x20traffic\x20data\x20available\x20for\x20journey:\x20','Error:\x20Invalid\x20--type\x20\x22','map','has','journeyStages','No\x20journeys\x20found','targetDir','listJourneysFromParentSegment','Creating\x20new\x20version...','relative','join','tdx.json','journeyBundleName','Error:\x20Version\x20','rule','\x20(ID:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','\x27\x20not\x20found\x20in\x20','helpText','Getting\x20journey\x20traffic\x20data...','enteredSize','List\x20journeys\x20in\x20current\x20context','29168teimHl','goal','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','parentSegment','journey:version:view','βœ”\x20Context\x20set:\x20','Resolving\x20parent\x20segment...','getJourney','getStatistics','journey:pause','\x20\x20Target:\x20','journeyId','No\x20statistics\x20available\x20for\x20journey:\x20','\x20\x20Consolidating\x20duplicate\x20segment:\x20','folderId','sort','\x0aPull\x20summary:','repeat','log','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','journey:activations','\x20(rule\x20match)','\x20\x20Folder\x20path:\x20','localeCompare','Error:\x20Invalid\x20version\x20number:\x20','Show\x20journey\x20statistics','Listing\x20journey\x20activations...','.yml','launched','\x20\x20Preserving\x20local\x20segment\x20name:\x20','Usage:\x20journey\x20<subcommand>\x20<name-or-path>','Get\x20journey\x20traffic\x20data\x20(Sankey\x20charts)','test','resourceName','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)','42410lLGPgH','buildIdToEmailMap','\x20versions)','\x0aChanges\x20to\x20\x27','journey:columns','Traffic\x20data\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','isNew','569152FPHUSK','segment','createdAt','(paused)','folderPath','(running)'];a27_0x3ff4=function(){return _0x451558;};return a27_0x3ff4();}export class JourneyPauseCommand extends BaseCommand{[a27_0x4a917e(0x126)]=a27_0x4a917e(0xee);[a27_0x4a917e(0x1b7)]='Pause\x20a\x20running\x20journey';async[a27_0x4a917e(0x144)](_0x4494a4){const _0x2f65c7=a27_0x4a917e,{options:_0x4c9f97,args:_0x1f3c74,tdx:_0x40cb63}=_0x4494a4,_0x4d6ff9=_0x1f3c74[0x0];if(!requireNameOrPath(_0x4d6ff9))return 0x1;_0x4c9f97['verbose']&&console['error'](_0x2f65c7(0x1a6)+_0x4d6ff9);const {journeyId:_0x403f15,journeyName:_0xd28ffe}=await resolveJourneyIdFromInput(_0x4d6ff9,_0x4c9f97,_0x40cb63);if(!_0x4c9f97[_0x2f65c7(0x1cd)]){const _0x463a0a=await confirm(_0x2f65c7(0x194)+_0xd28ffe+'\x22?');if(!_0x463a0a)return console[_0x2f65c7(0x1a5)](_0x2f65c7(0x193)),0x0;}const _0x32297d=await withSpinner('Pausing\x20journey...',()=>_0x40cb63[_0x2f65c7(0x14a)][_0x2f65c7(0x166)](_0x403f15),{'verbose':_0x4c9f97[_0x2f65c7(0x124)]}),_0x524c56=_0x32297d[_0x2f65c7(0x1ce)];return console[_0x2f65c7(0x1a5)](_0x2f65c7(0x1c4)+_0x524c56[_0x2f65c7(0xc7)]['name']+'\x22\x20paused'),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a27_0x4a917e(0x126)]='journey:resume';[a27_0x4a917e(0x1b7)]='Resume\x20a\x20paused\x20journey';async['execute'](_0xfc9acf){const _0x4581e2=a27_0x4a917e,{options:_0x17582e,args:_0x38367e,tdx:_0x1844d2}=_0xfc9acf,_0x47bd0a=_0x38367e[0x0];if(!requireNameOrPath(_0x47bd0a))return 0x1;_0x17582e['verbose']&&console[_0x4581e2(0x1a5)](_0x4581e2(0x1a6)+_0x47bd0a);const {journeyId:_0x3e9ccd,journeyName:_0x50c533}=await resolveJourneyIdFromInput(_0x47bd0a,_0x17582e,_0x1844d2);if(!_0x17582e[_0x4581e2(0x1cd)]){const _0x461b3f=await confirm(_0x4581e2(0xdf)+_0x50c533+'\x22?');if(!_0x461b3f)return console[_0x4581e2(0x1a5)](_0x4581e2(0x193)),0x0;}const _0xfa9fe6=await withSpinner('Resuming\x20journey...',()=>_0x1844d2[_0x4581e2(0x14a)][_0x4581e2(0x148)](_0x3e9ccd),{'verbose':_0x17582e[_0x4581e2(0x124)]}),_0x2fa3a3=_0xfa9fe6[_0x4581e2(0x1ce)];return console[_0x4581e2(0x1a5)](_0x4581e2(0x1c4)+_0x2fa3a3[_0x4581e2(0xc7)][_0x4581e2(0x126)]+_0x4581e2(0x118)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a27_0x4a917e(0x126)]=a27_0x4a917e(0x173);[a27_0x4a917e(0x1b7)]='Export\x20journey(s)\x20as\x20YAML\x20files';async[a27_0x4a917e(0x144)](_0x246782){const _0x433b1a=a27_0x4a917e,{options:_0x3ddaa7,args:_0x20fa4e,tdx:_0x4de32e}=_0x246782,_0x156c83=_0x3ddaa7,_0x26d521=_0x20fa4e[0x0],_0x309b4b=_0x26d521&&isYamlFilePath(_0x26d521),_0x2a1514=await resolveTarget({'arg':_0x309b4b?_0x26d521:undefined,'contextParent':_0x3ddaa7['parentSegment'],'cwd':process[_0x433b1a(0x1b0)]()});if(!isSuccessfulResolution(_0x2a1514))return _0x2a1514[_0x433b1a(0x11e)]===_0x433b1a(0x1aa)?(console['error'](a27_0xf82e6a[_0x433b1a(0x17a)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x433b1a(0x1a5)](_0x433b1a(0x107)),console['error'](_0x433b1a(0x188)),console[_0x433b1a(0x1a5)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file'),console[_0x433b1a(0x1a5)](_0x433b1a(0x18d))):(console[_0x433b1a(0x1a5)](a27_0xf82e6a['red'](_0x433b1a(0x1c2)+_0x2a1514[_0x433b1a(0x153)]+'\x0a')),_0x2a1514[_0x433b1a(0xe1)]&&console[_0x433b1a(0x1a5)](a27_0xf82e6a[_0x433b1a(0x1b2)](_0x2a1514[_0x433b1a(0xe1)]))),0x1;let _0x5ce0d7=_0x309b4b?undefined:_0x26d521,_0x41d11b,_0x589d7c;_0x2a1514[_0x433b1a(0x187)]===_0x433b1a(0x15b)&&(_0x5ce0d7=_0x2a1514[_0x433b1a(0x106)],_0x41d11b=_0x2a1514[_0x433b1a(0x1b9)],_0x589d7c=_0x2a1514[_0x433b1a(0x113)]);const _0xa59edb=_0x2a1514['parentName'],_0x2b8227=_0x2a1514[_0x433b1a(0xd5)];_0x156c83[_0x433b1a(0x124)]&&(console[_0x433b1a(0x1a5)](_0x433b1a(0x145)+_0xa59edb),console[_0x433b1a(0x1a5)](_0x433b1a(0x199)+_0x2b8227),_0x5ce0d7&&console['error'](_0x433b1a(0x16d)+_0x5ce0d7),_0x41d11b&&console[_0x433b1a(0x1a5)]('Target\x20file:\x20'+_0x41d11b),_0x589d7c&&console['error'](_0x433b1a(0x150)+_0x589d7c));const _0x2285ca=await withSpinner(_0x433b1a(0xeb),()=>_0x4de32e[_0x433b1a(0x110)]['resolveParentId'](_0xa59edb),{'verbose':_0x3ddaa7['verbose']}),_0x20617d=_0x2285ca['data'],{journeys:_0x4e2838,folders:_0x6919d0}=await withSpinner('Fetching\x20journeys\x20and\x20folders...',async()=>{const _0x47af03=_0x433b1a,[_0xbbc23a,_0x21ec38]=await Promise[_0x47af03(0x1c9)]([_0x4de32e['journey'][_0x47af03(0xd6)](_0x20617d,undefined,{'includeAllVersions':!![]}),_0x4de32e[_0x47af03(0x110)][_0x47af03(0x117)](_0x20617d)]);return{'journeys':_0xbbc23a,'folders':_0x21ec38};},{'verbose':_0x3ddaa7[_0x433b1a(0x124)]})[_0x433b1a(0x163)](_0x3e68d2=>_0x3e68d2['data']);let _0x4ec61a=_0x4e2838;const _0xe5fb1b=buildFolderIdToPathMap(_0x6919d0);if(_0x5ce0d7){const _0x5ec08f=_0x4ec61a[_0x433b1a(0x18b)](_0x1e2ba5=>_0x1e2ba5[_0x433b1a(0xdb)][_0x433b1a(0x18e)]()===_0x5ce0d7[_0x433b1a(0x18e)]());if(_0x5ec08f[_0x433b1a(0x13c)]===0x0)return console['error'](_0x433b1a(0x17e)+_0x5ce0d7),console[_0x433b1a(0x1a5)](_0x433b1a(0x119)),0x1;_0x4ec61a=_0x5ec08f;}if(_0x589d7c!==undefined){const _0x2f2f61=_0x4ec61a[_0x433b1a(0x18b)](_0x22197f=>{const _0x240113=_0x433b1a,_0x93f5fd=_0x22197f[_0x240113(0xf3)]?_0xe5fb1b[_0x240113(0x1c7)](_0x22197f['folderId'])||'':'';return _0x93f5fd===_0x589d7c;});if(_0x2f2f61[_0x433b1a(0x13c)]===0x0&&_0x4ec61a['length']>0x0){console[_0x433b1a(0x1a5)](_0x433b1a(0x1a3)+_0x5ce0d7+_0x433b1a(0xe0)+(_0x589d7c||'root\x20folder')),console[_0x433b1a(0x1a5)](_0x433b1a(0xcc));for(const _0x330eb4 of _0x4ec61a){const _0x2f749e=_0x330eb4[_0x433b1a(0xf3)]?_0xe5fb1b[_0x433b1a(0x1c7)](_0x330eb4[_0x433b1a(0xf3)])||'':'';console['error'](_0x433b1a(0x1c0)+(_0x2f749e||_0x433b1a(0x129))+'/'+_0x330eb4['journeyBundleName']);}return 0x1;}_0x4ec61a=_0x2f2f61;}if(_0x4ec61a['length']===0x0)return console[_0x433b1a(0x1a5)](_0x433b1a(0xd4)),0x0;const _0xc352ac=new Map();for(const _0x35ff84 of _0x4ec61a){const _0x35bcc8=_0x35ff84[_0x433b1a(0x1bb)];!_0xc352ac['has'](_0x35bcc8)&&_0xc352ac['set'](_0x35bcc8,[]),_0xc352ac['get'](_0x35bcc8)[_0x433b1a(0x165)](_0x35ff84);}for(const _0x58e1d4 of _0xc352ac[_0x433b1a(0x18f)]()){_0x58e1d4[_0x433b1a(0xf4)]((_0x33dbda,_0x64901b)=>(_0x33dbda[_0x433b1a(0x1b4)]||0x0)-(_0x64901b['versionNumber']||0x0));}const _0x2f20c6=[],{idToEmailMap:_0x14b26c,connectionIdToNameMap:_0x2c744b}=await withSpinner('Fetching\x20users\x20and\x20connections...',async()=>{const _0x5a70f6=_0x433b1a,[_0xf308be,_0x156e47]=await Promise[_0x5a70f6(0x1c9)]([_0x4de32e[_0x5a70f6(0x190)][_0x5a70f6(0x109)](),_0x4de32e[_0x5a70f6(0x184)][_0x5a70f6(0x137)]()]);return{'idToEmailMap':_0xf308be,'connectionIdToNameMap':_0x156e47};},{'verbose':_0x3ddaa7['verbose']})[_0x433b1a(0x163)](_0x577c22=>_0x577c22['data']);for(const _0x405d6f of _0xc352ac[_0x433b1a(0x18f)]()){const _0xcfea59=_0x405d6f[0x0][_0x433b1a(0xdb)],_0x5661df=_0x405d6f[0x0]['folderId'],_0x43a87c=_0x5661df?_0xe5fb1b[_0x433b1a(0x1c7)](_0x5661df)||'':'',_0x2ca75b=_0x43a87c?a27_0x51581f[_0x433b1a(0xd9)](_0x2b8227,_0x43a87c):_0x2b8227,_0x595656=_0x41d11b||a27_0x51581f[_0x433b1a(0xd9)](_0x2ca75b,sanitizeFileName(_0xcfea59)+_0x433b1a(0x100));let _0x2ae1b8,_0x5767d0;if(existsSync(_0x595656))try{const _0x625b85=readFileSync(_0x595656,_0x433b1a(0x147)),_0x202dcb=parseYamlString(_0x625b85);_0x5767d0=_0x202dcb,_0x2ae1b8=buildRuleToNameMapping(_0x202dcb),_0x156c83[_0x433b1a(0x124)]&&_0x2ae1b8[_0x433b1a(0x175)]>0x0&&console[_0x433b1a(0x1a5)](_0x433b1a(0x182)+_0x2ae1b8[_0x433b1a(0x175)]+_0x433b1a(0x1bd)+_0xcfea59);}catch(_0x56875f){_0x156c83['verbose']&&console[_0x433b1a(0x1a5)](_0x433b1a(0xc6)+_0x56875f[_0x433b1a(0x153)]);}const _0x4c9d0a=[],_0x1e8746=new Set(),_0x52f753=new Map(),_0x4f952a=new Map(),_0x5cfbce=new Set(),_0x4ca17f=new Map(),_0x2563c0=new Map(),_0x525af3=createJumpTargetCache();await withProgressSpinner('Fetching\x20'+_0xcfea59+_0x433b1a(0x1ae),async _0x28036d=>{const _0x4c57a3=_0x433b1a;for(const _0x3c14a7 of _0x405d6f){const _0x3a7e64=_0x405d6f[_0x4c57a3(0x13c)]>0x1?_0x3c14a7[_0x4c57a3(0xdb)]+'\x20v'+(_0x3c14a7[_0x4c57a3(0x1b4)]||0x1):_0x3c14a7['journeyBundleName'];_0x28036d[_0x4c57a3(0x19b)]('Fetching\x20'+_0x3a7e64);const _0x35dcf5=await _0x4de32e[_0x4c57a3(0x14a)][_0x4c57a3(0xec)](_0x3c14a7['id']),_0x35ecbb=_0x35dcf5[_0x4c57a3(0xc7)]?.['audienceId'],_0x144ef5={'resolveSegment':async _0x277e9d=>{const _0x354745=_0x4c57a3;if(!_0x35ecbb)return{'name':_0x277e9d,'isJourneyLocal':![]};const _0x583e85=_0x52f753[_0x354745(0x1c7)](_0x277e9d);if(_0x583e85)return _0x583e85;try{const _0x1f2016=await _0x4de32e[_0x354745(0x110)][_0x354745(0x1ca)](_0x35ecbb,_0x277e9d),_0x2cc7d9=_0x1f2016['kind']===SEGMENT_KIND_JOURNEY;let _0x4d75b3,_0x1fc446=_0x1f2016['name'];if(_0x2cc7d9&&_0x1f2016['rule']){const _0x4f3042=await segmentResponseToDef(_0x1f2016,{'resolveSegmentName':async _0x2be389=>{const _0x15b7da=_0x354745,_0x1504bd=_0x52f753[_0x15b7da(0x1c7)](_0x2be389);if(_0x1504bd)return _0x1504bd[_0x15b7da(0x126)];const _0x4dbf19=await _0x144ef5[_0x15b7da(0x12f)](_0x2be389);return _0x4dbf19['name'];}}),_0x1ebe9f=_0x4f3042[_0x354745(0xdd)];_0x4d75b3={'description':_0x1f2016[_0x354745(0x1b7)],'rule':_0x1ebe9f};const _0x58b337=serializeRule(_0x1ebe9f),_0x54feec=_0x4f952a[_0x354745(0x1c7)](_0x58b337);if(_0x54feec)_0x1fc446=_0x54feec,_0x4d75b3=undefined,_0x156c83[_0x354745(0x124)]&&console['error'](_0x354745(0xf2)+_0x1f2016['name']+_0x354745(0x12a)+_0x54feec);else{let _0x130494=![];if(_0x2ae1b8){const _0x27ac09=_0x2ae1b8[_0x354745(0x1c7)](_0x58b337);if(_0x27ac09){const _0x2d3318=_0x27ac09[_0x354745(0x142)](_0x2803df=>!_0x1e8746[_0x354745(0xd2)](_0x2803df));_0x2d3318&&(_0x1fc446=_0x2d3318,_0x1e8746[_0x354745(0x1a8)](_0x2d3318),_0x4f952a['set'](_0x58b337,_0x2d3318),_0x130494=!![],_0x156c83['verbose']&&console[_0x354745(0x1a5)](_0x354745(0x102)+_0x2d3318+_0x354745(0xfa)));}}if(!_0x130494){const _0x46c34b=generateJourneyLocalName(_0x1f2016[_0x354745(0x126)]);_0x46c34b&&(_0x1fc446=_0x46c34b);let _0x57c183=_0x1fc446,_0x14c485=0x2;while(_0x1e8746['has'](_0x57c183)){_0x57c183=_0x1fc446+'_'+_0x14c485,_0x14c485++;}_0x1e8746[_0x354745(0x1a8)](_0x57c183),_0x4f952a['set'](_0x58b337,_0x57c183),_0x1fc446=_0x57c183;}}}const _0x1183c4={'name':_0x1fc446,'isJourneyLocal':_0x2cc7d9,'definition':_0x4d75b3};return _0x52f753[_0x354745(0x159)](_0x277e9d,_0x1183c4),_0x1183c4;}catch(_0x4f2eb2){return _0x3ddaa7[_0x354745(0x124)]&&console[_0x354745(0x1a5)](_0x354745(0x192)+_0x277e9d+':\x20'+_0x4f2eb2[_0x354745(0x153)]),{'name':_0x277e9d,'isJourneyLocal':![]};}},'resolveActivation':async _0x3754b5=>{const _0x5d244c=_0x4c57a3,_0x112773=_0x4ca17f[_0x5d244c(0x1c7)](_0x3754b5);if(_0x112773)return _0x112773;try{const _0x7c8379=await _0x4de32e[_0x5d244c(0x14a)][_0x5d244c(0x161)](_0x3c14a7['id'],_0x3754b5),_0x3d4b04=journeyActivationStepToYaml(_0x7c8379,_0x14b26c,_0x2c744b),_0x2548fe=JSON['stringify']({'name':_0x3d4b04[_0x5d244c(0x126)],'connection':_0x3d4b04[_0x5d244c(0x184)],'connector_config':_0x3d4b04[_0x5d244c(0x11d)]}),_0x7ddf67=_0x2563c0[_0x5d244c(0x1c7)](_0x2548fe);if(_0x7ddf67){const _0x22206b={'name':_0x7ddf67,'isJourneyLocal':!![],'definition':_0x3d4b04};return _0x4ca17f['set'](_0x3754b5,_0x22206b),_0x22206b;}const _0x429206=_0x7c8379[_0x5d244c(0xc7)][_0x5d244c(0x1c3)][_0x5d244c(0x126)]||_0x3754b5,_0x30cba7=sanitizeYamlKey(_0x429206)||'activation_'+_0x3754b5;let _0x59a8e4=_0x30cba7,_0x3ed251=0x2;while(_0x5cfbce['has'](_0x59a8e4)){_0x59a8e4=_0x30cba7+'_'+_0x3ed251,_0x3ed251++;}_0x5cfbce['add'](_0x59a8e4),_0x2563c0[_0x5d244c(0x159)](_0x2548fe,_0x59a8e4);const _0x1fde46={'name':_0x59a8e4,'isJourneyLocal':!![],'definition':_0x3d4b04};return _0x4ca17f['set'](_0x3754b5,_0x1fde46),_0x1fde46;}catch(_0x1deec6){return _0x3ddaa7[_0x5d244c(0x124)]&&console[_0x5d244c(0x1a5)](_0x5d244c(0x1c6)+_0x3754b5+':\x20'+_0x1deec6[_0x5d244c(0x153)]),{'name':_0x3754b5,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x51e26f,_0x515669)=>{const _0x24f10f=_0x4c57a3;return resolveJumpTarget(_0x51e26f,_0x515669,_0x525af3,_0x40f746=>_0x4de32e[_0x24f10f(0x14a)][_0x24f10f(0xec)](_0x40f746));}},_0x177b3d=await journeyResponseToDef(_0x35dcf5,_0x144ef5);_0x4c9d0a[_0x4c57a3(0x165)]({'item':_0x3c14a7,'yaml':_0x177b3d});}},{'verbose':_0x3ddaa7['verbose']});const _0x336ec0=await _0x4de32e[_0x433b1a(0x14a)][_0x433b1a(0x14e)](_0x405d6f[0x0][_0x433b1a(0x1bb)]),_0x1bd98d=buildMergedJourneyDef(_0x4c9d0a,_0x2ae1b8,_0x336ec0),_0xc411e6=normalizeJourneyDef(_0x1bd98d,_0x5767d0),_0x39b410=toYamlString(_0xc411e6),_0x2bc3d5=_0x41d11b||a27_0x51581f['join'](_0x2ca75b,sanitizeFileName(_0xcfea59)+_0x433b1a(0x100));!_0x41d11b&&_0x43a87c&&!existsSync(_0x2ca75b)&&mkdirSync(_0x2ca75b,{'recursive':!![]});const _0x3474cc=a27_0x51581f[_0x433b1a(0xd8)](process[_0x433b1a(0x1b0)](),_0x2bc3d5);if(existsSync(_0x2bc3d5)){const _0x38622e=readFileSync(_0x2bc3d5,_0x433b1a(0x147)),_0x250f00=generateDiff(_0x38622e,_0x39b410),_0xbb6272=hasChanges(_0x250f00);_0x2f20c6['push']({'relativePath':_0x3474cc,'absolutePath':_0x2bc3d5,'content':_0x39b410,'isNew':![],'hasChanges':_0xbb6272,'diff':_0xbb6272?formatDiffWithColors(_0x250f00):undefined});}else _0x2f20c6['push']({'relativePath':_0x3474cc,'absolutePath':_0x2bc3d5,'content':_0x39b410,'isNew':!![],'hasChanges':![]});}const _0x76f1c4=_0x2f20c6['filter'](_0x411254=>_0x411254[_0x433b1a(0x10e)]),_0x3df458=_0x2f20c6['filter'](_0x28b601=>!_0x28b601[_0x433b1a(0x10e)]&&_0x28b601[_0x433b1a(0x1bf)]),_0x219418=_0x2f20c6[_0x433b1a(0x18b)](_0x35c8cc=>!_0x35c8cc[_0x433b1a(0x10e)]&&!_0x35c8cc[_0x433b1a(0x1bf)]),_0x5ab3ce=_0x4ec61a[_0x433b1a(0x13c)],_0x314ecb=_0xc352ac[_0x433b1a(0x175)],_0x618e7f=_0x5ab3ce>_0x314ecb?'\x20('+_0x5ab3ce+_0x433b1a(0x10a):'';console[_0x433b1a(0x1a5)](_0x433b1a(0xf5)),console['error']('\x20\x20'+a27_0xf82e6a['cyan'](_0x314ecb+_0x433b1a(0x160))+a27_0xf82e6a['dim'](_0x618e7f)),console['error']('\x20\x20'+a27_0xf82e6a['green']('+\x20'+_0x76f1c4['length']+_0x433b1a(0x157))),console[_0x433b1a(0x1a5)]('\x20\x20'+a27_0xf82e6a['yellow']('~\x20'+_0x3df458[_0x433b1a(0x13c)]+'\x20changed\x20files')),console[_0x433b1a(0x1a5)]('\x20\x20'+a27_0xf82e6a[_0x433b1a(0x1b1)]('=\x20'+_0x219418[_0x433b1a(0x13c)]+_0x433b1a(0x176))),console[_0x433b1a(0x1a5)](_0x433b1a(0xef)+a27_0xf82e6a[_0x433b1a(0x1b2)](_0x2b8227)+'\x0a');if(_0x3df458['length']>0x0)for(const _0x109630 of _0x3df458){console[_0x433b1a(0x1a5)](_0x433b1a(0x10b)+_0x109630[_0x433b1a(0x15f)]+'\x27:'),console[_0x433b1a(0x1a5)]('─'[_0x433b1a(0xf6)](0x3c)),console['error'](_0x109630['diff']),console['error']('─'[_0x433b1a(0xf6)](0x3c));}if(_0x156c83[_0x433b1a(0x116)])return console[_0x433b1a(0x1a5)](a27_0xf82e6a[_0x433b1a(0x17a)](_0x433b1a(0xce))),0x0;if(_0x76f1c4[_0x433b1a(0x13c)]===0x0&&_0x3df458[_0x433b1a(0x13c)]===0x0)return console['error'](a27_0xf82e6a[_0x433b1a(0x19e)](_0x433b1a(0x180))),saveSessionContext({'parent_segment':_0xa59edb},_0x156c83[_0x433b1a(0x1ad)]),console[_0x433b1a(0x1a5)](a27_0xf82e6a[_0x433b1a(0x19e)](_0x433b1a(0xea)+a27_0xf82e6a[_0x433b1a(0x1b1)](_0x433b1a(0x15d))+_0x433b1a(0x17d)+a27_0xf82e6a[_0x433b1a(0x1b2)](_0xa59edb))),0x0;if(!_0x156c83[_0x433b1a(0x1cd)]&&(_0x76f1c4[_0x433b1a(0x13c)]>0x0||_0x3df458['length']>0x0)){if(!isInteractive())return console[_0x433b1a(0x1a5)](a27_0xf82e6a[_0x433b1a(0x1ab)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x433b1a(0x1a5)](a27_0xf82e6a[_0x433b1a(0x1b1)](_0x433b1a(0x1b6))),0x1;const _0x3a3749=await confirmKey('Write\x20'+(_0x76f1c4[_0x433b1a(0x13c)]+_0x3df458[_0x433b1a(0x13c)])+_0x433b1a(0x197));if(!_0x3a3749)return console['error'](a27_0xf82e6a[_0x433b1a(0x17a)](_0x433b1a(0x1be)),'-\x20no\x20files\x20written'),0x1;}!existsSync(_0x2b8227)&&mkdirSync(_0x2b8227,{'recursive':!![]});const _0x31c33d=a27_0x51581f[_0x433b1a(0xd9)](_0x2b8227,_0x433b1a(0xda));writeFileSync(_0x31c33d,createTdxConfigContent(_0xa59edb),_0x433b1a(0x147));for(const _0x1e4c8e of _0x2f20c6){(_0x1e4c8e[_0x433b1a(0x10e)]||_0x1e4c8e[_0x433b1a(0x1bf)])&&writeFileSync(_0x1e4c8e[_0x433b1a(0x12e)],_0x1e4c8e['content'],'utf-8');}return console[_0x433b1a(0x1a5)](a27_0xf82e6a[_0x433b1a(0x19e)](_0x433b1a(0x15e)+(_0x76f1c4[_0x433b1a(0x13c)]+_0x3df458[_0x433b1a(0x13c)])+_0x433b1a(0x135)+_0x2b8227)),saveSessionContext({'parent_segment':_0xa59edb},_0x156c83[_0x433b1a(0x1ad)]),console['error'](a27_0xf82e6a['green'](_0x433b1a(0xea)+a27_0xf82e6a['dim'](_0x433b1a(0x15d))+_0x433b1a(0x17d)+a27_0xf82e6a[_0x433b1a(0x1b2)](_0xa59edb))),0x0;}}export class JourneyColumnsCommand extends BaseCommand{['name']=a27_0x4a917e(0x10c);['description']=a27_0x4a917e(0x11f);async['execute'](_0x37e3e2){const _0x5abdb4=a27_0x4a917e,{options:_0x268697,args:_0x8d94fe,tdx:_0x4a832e}=_0x37e3e2,_0x3af4d4=_0x8d94fe[0x0];if(!requireNameOrPath(_0x3af4d4))return 0x1;_0x268697[_0x5abdb4(0x124)]&&console['error'](_0x5abdb4(0x1a6)+_0x3af4d4);const {journeyId:_0x46f9e6}=await resolveJourneyIdFromInput(_0x3af4d4,_0x268697,_0x4a832e),_0x5ee8a8=await withSpinner(_0x5abdb4(0x12d),()=>_0x4a832e[_0x5abdb4(0x14a)]['getColumnMapping'](_0x46f9e6),{'verbose':_0x268697['verbose']}),_0x1363a9=_0x5ee8a8[_0x5abdb4(0x1ce)];return console[_0x5abdb4(0xf7)](_0x5abdb4(0x1b8)+_0x1363a9[_0x5abdb4(0x151)]),console['log']('Table:\x20'+_0x1363a9[_0x5abdb4(0x128)]),await handleSDKOutput(_0x1363a9['columns'],_0x268697),0x0;}}export class JourneyActivationsCommand extends BaseCommand{[a27_0x4a917e(0x126)]=a27_0x4a917e(0xf9);[a27_0x4a917e(0x1b7)]=a27_0x4a917e(0x1c1);async[a27_0x4a917e(0x144)](_0x53ea8f){const _0x5260c1=a27_0x4a917e,{options:_0x4d5786,args:_0x4b297b,tdx:_0x8214e9}=_0x53ea8f,_0x40cc25=_0x4b297b[0x0];if(!requireNameOrPath(_0x40cc25))return 0x1;_0x4d5786[_0x5260c1(0x124)]&&console[_0x5260c1(0x1a5)]('Input:\x20'+_0x40cc25);const {journeyId:_0x3924a5}=await resolveJourneyIdFromInput(_0x40cc25,_0x4d5786,_0x8214e9),_0x30822a=await withSpinner(_0x5260c1(0xff),()=>_0x8214e9[_0x5260c1(0x14a)][_0x5260c1(0x13f)](_0x3924a5),{'verbose':_0x4d5786[_0x5260c1(0x124)]}),_0x2c4b78=_0x30822a[_0x5260c1(0x1ce)];return console[_0x5260c1(0x1a5)](_0x5260c1(0x182)+_0x2c4b78[_0x5260c1(0x13c)]+_0x5260c1(0x1a0)+(_0x2c4b78['length']!==0x1?'s':'')),await handleSDKOutput(_0x2c4b78,_0x4d5786),0x0;}}export class JourneyPushCommand extends BaseCommand{['name']='journey:push';[a27_0x4a917e(0x1b7)]=a27_0x4a917e(0x136);['segmentPushCommand']=new SegmentPushCommand();async['execute'](_0x61d1c7){const _0x21ca91=a27_0x4a917e,_0x37379e=_0x61d1c7['args'][0x0];let _0x1e5c8b;if(_0x37379e){const _0x177455=await resolveTarget({'arg':_0x37379e,'contextParent':_0x61d1c7[_0x21ca91(0x133)]['parentSegment'],'cwd':process[_0x21ca91(0x1b0)]()});isSuccessfulResolution(_0x177455)&&_0x177455['type']==='file'&&(_0x1e5c8b=_0x177455['filePath']);}const _0x28151e={..._0x61d1c7,'options':{..._0x61d1c7[_0x21ca91(0x133)],'journeysOnly':!![],..._0x1e5c8b&&{'singleFilePath':_0x1e5c8b}}};return this[_0x21ca91(0x130)][_0x21ca91(0x144)](_0x28151e);}}export class JourneyVersionsCommand extends BaseCommand{[a27_0x4a917e(0x126)]=a27_0x4a917e(0x158);['description']='List\x20all\x20versions\x20of\x20a\x20journey';async[a27_0x4a917e(0x144)](_0xb1fecc){const _0x57cb10=a27_0x4a917e,{options:_0x23ea96,args:_0x9a4bfd,tdx:_0x14dc58}=_0xb1fecc,_0x4ed2af=_0x9a4bfd[0x0];if(!requireNameOrPath(_0x4ed2af))return 0x1;if(_0x23ea96['verbose'])console[_0x57cb10(0x1a5)](_0x57cb10(0x1a6)+_0x4ed2af);const {journeyId:_0x45098e}=await resolveJourneyIdFromInput(_0x4ed2af,_0x23ea96,_0x14dc58),_0x311acc=await withSpinner(_0x57cb10(0x14d),()=>_0x14dc58[_0x57cb10(0x14a)][_0x57cb10(0x198)](_0x45098e),{'verbose':_0x23ea96[_0x57cb10(0x124)]}),{bundleName:_0x2db2fe,versions:_0x537bfd,latestJourneyId:_0x1c4ae6}=_0x311acc[_0x57cb10(0x1ce)];console[_0x57cb10(0x1a5)](_0x2db2fe+':\x20'+_0x537bfd[_0x57cb10(0x13c)]+_0x57cb10(0x139)+(_0x537bfd[_0x57cb10(0x13c)]!==0x1?'s':''));const _0x2272bf=_0x537bfd['map'](_0x258e18=>({'version':_0x258e18['versionNumber'],'journey_id':_0x258e18[_0x57cb10(0xf0)],'name':_0x258e18[_0x57cb10(0x126)],'state':_0x258e18[_0x57cb10(0x13b)],'paused':_0x258e18[_0x57cb10(0x12c)],'latest':_0x258e18[_0x57cb10(0xf0)]===_0x1c4ae6,'created_at':_0x258e18[_0x57cb10(0x111)]}));return await handleSDKOutput(_0x2272bf,_0x23ea96),0x0;}}export class JourneyVersionCreateCommand extends BaseCommand{[a27_0x4a917e(0x126)]=a27_0x4a917e(0x19a);[a27_0x4a917e(0x1b7)]=a27_0x4a917e(0x146);async[a27_0x4a917e(0x144)](_0x1d901a){const _0x59d19b=a27_0x4a917e,{options:_0x184141,args:_0x439ad5,tdx:_0x5f2df7}=_0x1d901a,_0x3db706=_0x439ad5[0x0];if(!requireNameOrPath(_0x3db706))return 0x1;if(_0x184141['verbose'])console['error']('Input:\x20'+_0x3db706);const {journeyId:_0x1b1ae6,journeyName:_0x383faf}=await resolveJourneyIdFromInput(_0x3db706,_0x184141,_0x5f2df7);if(!_0x184141[_0x59d19b(0x1cd)]){const _0x1f9aab=await confirm('Create\x20a\x20new\x20draft\x20version\x20of\x20journey\x20\x22'+_0x383faf+'\x22?');if(!_0x1f9aab)return console['error'](_0x59d19b(0x193)),0x0;}const _0x3d65c6=await withSpinner(_0x59d19b(0xd7),()=>_0x5f2df7[_0x59d19b(0x14a)][_0x59d19b(0x169)](_0x1b1ae6),{'verbose':_0x184141['verbose']}),_0x4047be=_0x3d65c6['data'];return console['error'](a27_0xf82e6a[_0x59d19b(0x19e)]('βœ”')+'\x20Created\x20v'+_0x4047be[_0x59d19b(0xc7)]['versionNumber']+_0x59d19b(0xc9)+_0x4047be[_0x59d19b(0xc7)]['name']+'\x22'),console[_0x59d19b(0x1a5)](_0x59d19b(0x1af)+_0x4047be['id']),await handleSingleObjectOutput({'id':_0x4047be['id'],'name':_0x4047be[_0x59d19b(0xc7)][_0x59d19b(0x126)],'version':_0x4047be['attributes'][_0x59d19b(0x1b4)],'state':_0x4047be[_0x59d19b(0xc7)][_0x59d19b(0x13b)],'bundle_id':_0x4047be[_0x59d19b(0xc7)][_0x59d19b(0x1bb)],'created_at':_0x4047be[_0x59d19b(0xc7)][_0x59d19b(0x111)]},_0x184141),0x0;}}export class JourneyVersionViewCommand extends BaseCommand{[a27_0x4a917e(0x126)]=a27_0x4a917e(0xe9);[a27_0x4a917e(0x1b7)]=a27_0x4a917e(0x19d);async['execute'](_0xc8f829){const _0x5a1b3e=a27_0x4a917e,{options:_0x260cd9,args:_0x7cb0ae,tdx:_0x279940}=_0xc8f829,_0x5ec2e4=_0x7cb0ae[0x0];if(!requireNameOrPath(_0x5ec2e4))return 0x1;const _0x317d40=_0x260cd9[_0x5a1b3e(0x1c8)];if(!_0x317d40)return console['error'](_0x5a1b3e(0x138)),console['error'](_0x5a1b3e(0x170)),0x1;const _0x2bb1df=parseInt(_0x317d40,0xa);if(isNaN(_0x2bb1df)||_0x2bb1df<0x1)return console['error'](_0x5a1b3e(0xfd)+_0x317d40),0x1;if(_0x260cd9['verbose'])console['error'](_0x5a1b3e(0x1a6)+_0x5ec2e4+_0x5a1b3e(0x13d)+_0x2bb1df);const {journeyId:_0x828609,parentSegmentId:_0x41f02e}=await resolveJourneyIdFromInput(_0x5ec2e4,_0x260cd9,_0x279940),_0x4f0c8c=await withSpinner('Resolving\x20version...',()=>_0x279940[_0x5a1b3e(0x14a)][_0x5a1b3e(0x198)](_0x828609),{'verbose':_0x260cd9[_0x5a1b3e(0x124)]}),{versions:_0x14fc51,latestJourneyId:_0x514632}=_0x4f0c8c[_0x5a1b3e(0x1ce)],_0x15650a=_0x14fc51['find'](_0x5d46f5=>_0x5d46f5[_0x5a1b3e(0x1b4)]===_0x2bb1df);if(!_0x15650a){const _0x15f9f4=_0x14fc51['map'](_0x58ba32=>'v'+_0x58ba32[_0x5a1b3e(0x1b4)])[_0x5a1b3e(0xd9)](',\x20');return console[_0x5a1b3e(0x1a5)](_0x5a1b3e(0xdc)+_0x2bb1df+_0x5a1b3e(0x18c)+_0x15f9f4),0x1;}const _0x4001c1=await withSpinner(_0x5a1b3e(0x15a)+_0x2bb1df+_0x5a1b3e(0x183),()=>_0x279940['journey'][_0x5a1b3e(0xec)](_0x15650a['journeyId']),{'verbose':_0x260cd9[_0x5a1b3e(0x124)]}),_0x221fe7=_0x4001c1[_0x5a1b3e(0x1ce)],_0x3b2153=getConsoleNextUrl(_0x260cd9['site'],_0x5a1b3e(0x12b)+_0x41f02e+_0x5a1b3e(0x178)+_0x15650a[_0x5a1b3e(0xf0)]+_0x5a1b3e(0x1a4));return await handleSingleObjectOutput({'id':_0x221fe7['id'],'name':_0x221fe7['attributes'][_0x5a1b3e(0x126)],'version':_0x221fe7[_0x5a1b3e(0xc7)][_0x5a1b3e(0x1b4)],'description':_0x221fe7[_0x5a1b3e(0xc7)][_0x5a1b3e(0x1b7)],'state':_0x221fe7[_0x5a1b3e(0xc7)][_0x5a1b3e(0x13b)],'paused':_0x221fe7['attributes']['paused'],'reentry_mode':_0x221fe7[_0x5a1b3e(0xc7)][_0x5a1b3e(0x120)],'stages':_0x221fe7[_0x5a1b3e(0xc7)]['journeyStages']?.[_0x5a1b3e(0x13c)]||0x0,..._0x221fe7[_0x5a1b3e(0xc7)][_0x5a1b3e(0xe6)]&&{'goal':_0x221fe7[_0x5a1b3e(0xc7)]['goal'][_0x5a1b3e(0x126)]},'latest':_0x15650a[_0x5a1b3e(0xf0)]===_0x514632,'created_at':_0x221fe7[_0x5a1b3e(0xc7)][_0x5a1b3e(0x111)],'updated_at':_0x221fe7[_0x5a1b3e(0xc7)]['updatedAt'],'url':_0x3b2153},_0x260cd9),0x0;}}