@treasuredata/tdx 0.28.2 → 0.28.3

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 (179) 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/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/delivery-command.js +1 -1
  18. package/dist/commands/describe.js +1 -1
  19. package/dist/commands/engage-campaign-pull-command.js +1 -1
  20. package/dist/commands/engage-campaign-push-command.js +1 -1
  21. package/dist/commands/engage-campaign-validate-command.js +1 -1
  22. package/dist/commands/engage-command.js +1 -1
  23. package/dist/commands/job-command.js +1 -1
  24. package/dist/commands/journey-command.js +1 -1
  25. package/dist/commands/journey-validate-command.js +1 -1
  26. package/dist/commands/llm-command.js +1 -1
  27. package/dist/commands/mcp-command.js +1 -1
  28. package/dist/commands/parent-segment-command.js +1 -1
  29. package/dist/commands/profile-command.js +1 -1
  30. package/dist/commands/profiles-command.js +1 -1
  31. package/dist/commands/query-command.js +1 -1
  32. package/dist/commands/schedule-command.js +1 -1
  33. package/dist/commands/segment-command.js +1 -1
  34. package/dist/commands/segment-create-command.js +1 -1
  35. package/dist/commands/segment-fields-command.js +1 -1
  36. package/dist/commands/segment-pull-command.js +1 -1
  37. package/dist/commands/segment-push-command.js +1 -1
  38. package/dist/commands/segment-update-command.js +1 -1
  39. package/dist/commands/segment-use-command.js +1 -1
  40. package/dist/commands/segment-validate-command.js +1 -1
  41. package/dist/commands/segments.js +1 -1
  42. package/dist/commands/show.js +1 -1
  43. package/dist/commands/status-command.js +1 -1
  44. package/dist/commands/tables.js +1 -1
  45. package/dist/commands/unset-command.js +1 -1
  46. package/dist/commands/use-command.js +1 -1
  47. package/dist/commands/user-command.js +1 -1
  48. package/dist/commands/workflow-command.js +1 -1
  49. package/dist/core/auth.js +1 -1
  50. package/dist/core/command-output.js +1 -1
  51. package/dist/core/config.js +1 -1
  52. package/dist/core/connection-cache.js +1 -1
  53. package/dist/core/constants.js +1 -1
  54. package/dist/core/credential-cache.js +1 -1
  55. package/dist/core/global-context.js +1 -1
  56. package/dist/core/keychain.js +1 -1
  57. package/dist/core/profile.js +1 -1
  58. package/dist/core/project-config.js +1 -1
  59. package/dist/core/session.js +1 -1
  60. package/dist/core/user-cache.js +1 -1
  61. package/dist/core/version.js +1 -1
  62. package/dist/index.js +1 -1
  63. package/dist/mcp/server.js +1 -1
  64. package/dist/mcp/tools/index.js +1 -1
  65. package/dist/mcp/tools/tdx-run.js +1 -1
  66. package/dist/mcp/tools/tdx-search.js +1 -1
  67. package/dist/mcp/utils.js +1 -1
  68. package/dist/proxy/claude-usage-tracker.js +1 -1
  69. package/dist/proxy/passthrough-server.js +1 -1
  70. package/dist/proxy/sse-usage-parser.js +1 -1
  71. package/dist/sdk/agent/agent-config.js +1 -1
  72. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  73. package/dist/sdk/agent/agent-yaml.js +1 -1
  74. package/dist/sdk/agent/test/evaluator.js +1 -1
  75. package/dist/sdk/agent/test/executor.js +1 -1
  76. package/dist/sdk/agent/test/index.js +1 -1
  77. package/dist/sdk/agent/test/output.js +1 -1
  78. package/dist/sdk/agent/test/parser.js +1 -1
  79. package/dist/sdk/agent/tool-target-registry.js +1 -1
  80. package/dist/sdk/api.js +1 -1
  81. package/dist/sdk/client/cdp-api-client.js +1 -1
  82. package/dist/sdk/client/delivery-api-client.js +1 -1
  83. package/dist/sdk/client/endpoints.js +1 -1
  84. package/dist/sdk/client/engage-api-client.js +1 -1
  85. package/dist/sdk/client/http-client.js +1 -1
  86. package/dist/sdk/client/llm-api-client.js +1 -1
  87. package/dist/sdk/client/rate-limiter.js +1 -1
  88. package/dist/sdk/client/td-api-client.js +1 -1
  89. package/dist/sdk/client/trino-api-client.js +1 -1
  90. package/dist/sdk/client/workflow-client.js +1 -1
  91. package/dist/sdk/connection-validator.js +1 -1
  92. package/dist/sdk/connection.js +1 -1
  93. package/dist/sdk/delivery.js +1 -1
  94. package/dist/sdk/engage/campaign-pull.js +1 -1
  95. package/dist/sdk/engage/campaign-push.js +1 -1
  96. package/dist/sdk/engage/campaign-validator.js +1 -1
  97. package/dist/sdk/engage/campaign-yaml.js +1 -1
  98. package/dist/sdk/engage/types/campaign-def.js +1 -1
  99. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  100. package/dist/sdk/engage.js +1 -1
  101. package/dist/sdk/errors.js +1 -1
  102. package/dist/sdk/index.js +1 -1
  103. package/dist/sdk/io/index.js +1 -1
  104. package/dist/sdk/io/node-filesystem.js +1 -1
  105. package/dist/sdk/job.js +1 -1
  106. package/dist/sdk/journey.js +1 -1
  107. package/dist/sdk/llm/chat-cache.js +1 -1
  108. package/dist/sdk/llm/index.js +1 -1
  109. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  110. package/dist/sdk/llm/model-factors.js +1 -1
  111. package/dist/sdk/personalization.js +1 -1
  112. package/dist/sdk/query/index.js +1 -1
  113. package/dist/sdk/query/sql-parser.js +1 -1
  114. package/dist/sdk/realtime.js +1 -1
  115. package/dist/sdk/schedule.js +1 -1
  116. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  117. package/dist/sdk/segment/fields-display.js +1 -1
  118. package/dist/sdk/segment/file-discovery.js +1 -1
  119. package/dist/sdk/segment/journey-utils.js +1 -1
  120. package/dist/sdk/segment/journey-validator.js +1 -1
  121. package/dist/sdk/segment/journey-yaml.js +1 -1
  122. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  123. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  124. package/dist/sdk/segment/pull-workflow.js +1 -1
  125. package/dist/sdk/segment/push-recovery.js +1 -1
  126. package/dist/sdk/segment/push-workflow.js +1 -1
  127. package/dist/sdk/segment/resolution-context.js +1 -1
  128. package/dist/sdk/segment/segment-path-parser.js +1 -1
  129. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  130. package/dist/sdk/segment/target-resolution.js +1 -1
  131. package/dist/sdk/segment/tdx-config.js +1 -1
  132. package/dist/sdk/segment/validate-files.js +1 -1
  133. package/dist/sdk/segment/yaml-validator.js +1 -1
  134. package/dist/sdk/segment.js +1 -1
  135. package/dist/sdk/types/index.js +1 -1
  136. package/dist/sdk/types/progress.js +1 -1
  137. package/dist/sdk/user.js +1 -1
  138. package/dist/sdk/util/format-detector.js +1 -1
  139. package/dist/sdk/util/formatters.js +1 -1
  140. package/dist/sdk/util/index.js +1 -1
  141. package/dist/sdk/util/tree-formatter.js +1 -1
  142. package/dist/sdk/workflow/archive-validation.js +1 -1
  143. package/dist/sdk/workflow/clone-workflow.js +1 -1
  144. package/dist/sdk/workflow/index.js +1 -1
  145. package/dist/sdk/workflow/pull-workflow.js +1 -1
  146. package/dist/sdk/workflow/push-workflow.js +1 -1
  147. package/dist/sdk/workflow/tdx-config.js +1 -1
  148. package/dist/sdk/workflow/workflow-utils.js +1 -1
  149. package/dist/test-utils/command-runner.js +1 -1
  150. package/dist/test-utils/factories.js +1 -1
  151. package/dist/test-utils/fixtures.js +1 -1
  152. package/dist/test-utils/http-mock.js +1 -1
  153. package/dist/test-utils/index.js +1 -1
  154. package/dist/utils/async.js +1 -1
  155. package/dist/utils/colors.js +1 -1
  156. package/dist/utils/diff.js +1 -1
  157. package/dist/utils/file-permissions.js +1 -1
  158. package/dist/utils/global-cache.js +1 -1
  159. package/dist/utils/json-loader.js +1 -1
  160. package/dist/utils/local-cache.js +1 -1
  161. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  162. package/dist/utils/logger/formatters/index.js +1 -1
  163. package/dist/utils/logger/handlers/console-handler.js +1 -1
  164. package/dist/utils/logger/handlers/file-handler.js +1 -1
  165. package/dist/utils/logger/handlers/index.js +1 -1
  166. package/dist/utils/logger/handlers/null-handler.js +1 -1
  167. package/dist/utils/logger/index.js +1 -1
  168. package/dist/utils/logger/logger.js +1 -1
  169. package/dist/utils/logger/types.js +1 -1
  170. package/dist/utils/option-validation.js +1 -1
  171. package/dist/utils/process.js +1 -1
  172. package/dist/utils/prompt.js +1 -1
  173. package/dist/utils/spinner.js +1 -1
  174. package/dist/utils/sse-parser.js +1 -1
  175. package/dist/utils/string-utils.js +1 -1
  176. package/dist/utils/table-ref-parser.js +1 -1
  177. package/dist/utils/tdx-logger.js +1 -1
  178. package/dist/utils/version-check.js +1 -1
  179. package/package.json +1 -1
@@ -1 +1 @@
1
- const a19_0x2ec8d9=a19_0x4e78;(function(_0x26b017,_0x4a1b99){const _0x48768d=a19_0x4e78,_0x7f2bbe=_0x26b017();while(!![]){try{const _0x400e09=parseInt(_0x48768d(0x1b1))/0x1*(-parseInt(_0x48768d(0x1bd))/0x2)+parseInt(_0x48768d(0x1c1))/0x3*(parseInt(_0x48768d(0x1d0))/0x4)+-parseInt(_0x48768d(0x1b2))/0x5+-parseInt(_0x48768d(0x1b7))/0x6+parseInt(_0x48768d(0x1cd))/0x7+parseInt(_0x48768d(0x1ad))/0x8+-parseInt(_0x48768d(0x1b3))/0x9*(-parseInt(_0x48768d(0x1c0))/0xa);if(_0x400e09===_0x4a1b99)break;else _0x7f2bbe['push'](_0x7f2bbe['shift']());}catch(_0x336e2f){_0x7f2bbe['push'](_0x7f2bbe['shift']());}}}(a19_0x20b9,0xb7be4));import{BaseCommand}from'./command.js';import{findYamlFiles,isYamlFile}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';function a19_0x4e78(_0x3c8448,_0x584581){_0x3c8448=_0x3c8448-0x1a4;const _0x20b9ed=a19_0x20b9();let _0x4e7808=_0x20b9ed[_0x3c8448];return _0x4e7808;}import a19_0x3dca2f from'chalk';import a19_0x1f7219 from'path';function a19_0x20b9(){const _0x363e11=['Validation\x20failed:\x20','filter','4ZYguTE','4895105nTTKZJ','80460RhSUcl','warnings','\x20warning(s)\x20found','yellow','8409408OwxKIW','verbose','.yaml','\x20non-campaign\x20file(s)\x20skipped','validCount','log','174260BZSOrg','green','\x20error(s)','1220dNtVvK','3aQnPCE','red','Validate\x20campaign\x20YAML\x20files','execute','dim','\x20valid','error','✔\x20All\x20','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','\x20campaign(s)\x20valid','\x20non-campaign\x20file(s)\x20skipped)','resolve','3383709ErfByA','\x20campaign(s)\x20with\x20errors,\x20','campaign','3244588ASLXYG','skippedCount','endsWith','valid','cwd','name','length','description','Error:\x20Directory\x20not\x20found:\x20','dirname','.yml','errors','8772056nPEHeZ','warningCount'];a19_0x20b9=function(){return _0x363e11;};return a19_0x20b9();}import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class EngageCampaignValidateCommand extends BaseCommand{[a19_0x2ec8d9(0x1a6)]='engage:campaign:validate';[a19_0x2ec8d9(0x1a8)]=a19_0x2ec8d9(0x1c3);async[a19_0x2ec8d9(0x1c4)](_0x5b1f4b){const _0x1f2d64=a19_0x2ec8d9,{options:_0x57980a,args:_0x1e2269}=_0x5b1f4b,_0x1147da=_0x57980a,_0x118e2a=_0x1e2269[0x0],_0x24dda3=_0x118e2a?a19_0x1f7219[_0x1f2d64(0x1cc)](_0x118e2a):undefined,_0x414cf2=_0x24dda3?isYamlFile(_0x24dda3):![];let _0x4652f5,_0x1be171;if(_0x414cf2&&_0x24dda3)_0x4652f5=a19_0x1f7219[_0x1f2d64(0x1aa)](_0x24dda3),_0x1be171=_0x24dda3;else _0x24dda3?_0x4652f5=_0x24dda3:_0x4652f5=process[_0x1f2d64(0x1a5)]();if(!_0x1be171&&!existsSync(_0x4652f5))return console[_0x1f2d64(0x1c7)](a19_0x3dca2f[_0x1f2d64(0x1c2)](_0x1f2d64(0x1a9)+_0x4652f5+'\x0a')),0x1;let _0x4c8040;if(_0x1be171){if(!_0x1be171[_0x1f2d64(0x1d2)](_0x1f2d64(0x1ab))&&!_0x1be171[_0x1f2d64(0x1d2)](_0x1f2d64(0x1b9)))return console['error'](a19_0x3dca2f[_0x1f2d64(0x1c2)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x1be171+'\x0a')),0x1;_0x4c8040=[_0x1be171];}else _0x4c8040=findYamlFiles(_0x4652f5);if(_0x4c8040[_0x1f2d64(0x1a7)]===0x0)return console[_0x1f2d64(0x1c7)](a19_0x3dca2f['red'](_0x1f2d64(0x1c9)+_0x4652f5+'\x0a')),0x1;const _0x199bc2=validateYamlFiles(_0x4c8040,_0x4652f5,{'filterType':_0x1f2d64(0x1cf)}),_0x49139d=calculateSummary(_0x199bc2),_0x111852=_0x199bc2[_0x1f2d64(0x1b0)](isValidationResult);if(_0x111852['length']===0x0)return console['error'](a19_0x3dca2f[_0x1f2d64(0x1b6)]('No\x20campaign\x20YAML\x20files\x20found\x20in\x20'+_0x4652f5+'\x0a')),_0x49139d[_0x1f2d64(0x1d1)]>0x0&&console[_0x1f2d64(0x1c7)](a19_0x3dca2f[_0x1f2d64(0x1c5)]('('+_0x49139d['skippedCount']+_0x1f2d64(0x1cb))),0x0;for(const _0x11bbaf of _0x199bc2){if(!isValidationResult(_0x11bbaf)){_0x1147da[_0x1f2d64(0x1b8)]&&console['log'](a19_0x3dca2f[_0x1f2d64(0x1c5)]('-\x20'+_0x11bbaf['relativePath']+'\x20(skipped:\x20'+_0x11bbaf['reason']+')'));continue;}const {relativePath:_0x3dd6a9,source:_0x23f301,result:_0x30397a}=_0x11bbaf;if(_0x30397a[_0x1f2d64(0x1a4)]&&_0x30397a[_0x1f2d64(0x1b4)][_0x1f2d64(0x1a7)]===0x0)_0x1147da['verbose']&&console[_0x1f2d64(0x1bc)](a19_0x3dca2f[_0x1f2d64(0x1be)]('✔\x20'+_0x3dd6a9));else _0x30397a[_0x1f2d64(0x1a4)]?(console[_0x1f2d64(0x1bc)](a19_0x3dca2f[_0x1f2d64(0x1b6)]('⚠\x20'+_0x3dd6a9+':\x20'+_0x30397a[_0x1f2d64(0x1b4)][_0x1f2d64(0x1a7)]+'\x20warning(s)')),console['log'](formatValidationResult(_0x30397a,_0x23f301,_0x3dd6a9))):(console[_0x1f2d64(0x1bc)](a19_0x3dca2f[_0x1f2d64(0x1c2)]('✖\x20'+_0x3dd6a9+':\x20'+_0x30397a[_0x1f2d64(0x1ac)][_0x1f2d64(0x1a7)]+_0x1f2d64(0x1bf))),console[_0x1f2d64(0x1bc)](formatValidationResult(_0x30397a,_0x23f301,_0x3dd6a9)));}return console[_0x1f2d64(0x1bc)](''),_0x49139d['hasErrors']?(console[_0x1f2d64(0x1bc)](a19_0x3dca2f[_0x1f2d64(0x1c2)](_0x1f2d64(0x1af)+_0x49139d['invalidCount']+_0x1f2d64(0x1ce)+_0x49139d[_0x1f2d64(0x1bb)]+_0x1f2d64(0x1c6))),_0x49139d[_0x1f2d64(0x1ae)]>0x0&&console[_0x1f2d64(0x1bc)](a19_0x3dca2f[_0x1f2d64(0x1b6)](_0x49139d[_0x1f2d64(0x1ae)]+_0x1f2d64(0x1b5))),_0x49139d['skippedCount']>0x0&&console[_0x1f2d64(0x1bc)](a19_0x3dca2f[_0x1f2d64(0x1c5)](_0x49139d[_0x1f2d64(0x1d1)]+_0x1f2d64(0x1ba))),0x1):(console[_0x1f2d64(0x1bc)](a19_0x3dca2f[_0x1f2d64(0x1be)](_0x1f2d64(0x1c8)+_0x49139d[_0x1f2d64(0x1bb)]+_0x1f2d64(0x1ca))),_0x49139d[_0x1f2d64(0x1ae)]>0x0&&console[_0x1f2d64(0x1bc)](a19_0x3dca2f[_0x1f2d64(0x1b6)](_0x49139d[_0x1f2d64(0x1ae)]+_0x1f2d64(0x1b5))),_0x49139d['skippedCount']>0x0&&console[_0x1f2d64(0x1bc)](a19_0x3dca2f['dim'](_0x49139d[_0x1f2d64(0x1d1)]+_0x1f2d64(0x1ba))),0x0);}}
1
+ const a19_0x20b9f5=a19_0x13a0;(function(_0x346e32,_0x25943e){const _0x1f13fb=a19_0x13a0,_0x3b3dc3=_0x346e32();while(!![]){try{const _0x171e75=-parseInt(_0x1f13fb(0x120))/0x1+parseInt(_0x1f13fb(0x121))/0x2*(parseInt(_0x1f13fb(0x137))/0x3)+parseInt(_0x1f13fb(0x133))/0x4*(parseInt(_0x1f13fb(0x11a))/0x5)+-parseInt(_0x1f13fb(0x13f))/0x6+-parseInt(_0x1f13fb(0x149))/0x7*(-parseInt(_0x1f13fb(0x136))/0x8)+-parseInt(_0x1f13fb(0x125))/0x9*(parseInt(_0x1f13fb(0x143))/0xa)+-parseInt(_0x1f13fb(0x13b))/0xb;if(_0x171e75===_0x25943e)break;else _0x3b3dc3['push'](_0x3b3dc3['shift']());}catch(_0x2562d0){_0x3b3dc3['push'](_0x3b3dc3['shift']());}}}(a19_0x136f,0x5cb64));import{BaseCommand}from'./command.js';import{findYamlFiles,isYamlFile}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';function a19_0x13a0(_0x45e33c,_0x54103d){_0x45e33c=_0x45e33c-0x117;const _0x136f5d=a19_0x136f();let _0x13a009=_0x136f5d[_0x45e33c];return _0x13a009;}import a19_0x5acf6b from'chalk';function a19_0x136f(){const _0x3557f9=['errors','resolve','5915415ohTOOf','validCount','\x20non-campaign\x20file(s)\x20skipped)','Validation\x20failed:\x20','219786crlqGc','\x20non-campaign\x20file(s)\x20skipped','Validate\x20campaign\x20YAML\x20files','valid','1070ibuKLi','\x20error(s)','red','yellow','\x20warning(s)\x20found','filter','14VLJAQQ','cwd','.yml','dim','196340pOjOxK','dirname','execute','warningCount','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','campaign','489817YKNrqc','8fRNzMw','log','relativePath','\x20campaign(s)\x20with\x20errors,\x20','32985fpAUQi','\x20(skipped:\x20','reason','description','invalidCount','✔\x20All\x20','.yaml','engage:campaign:validate','error','hasErrors','skippedCount','green','\x20valid','warnings','52fLDBuI','endsWith','length','2904544onxyrw','449622kMiPSy','verbose'];a19_0x136f=function(){return _0x3557f9;};return a19_0x136f();}import a19_0xd49eed from'path';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class EngageCampaignValidateCommand extends BaseCommand{['name']=a19_0x20b9f5(0x12c);[a19_0x20b9f5(0x128)]=a19_0x20b9f5(0x141);async[a19_0x20b9f5(0x11c)](_0x225c9a){const _0x4fe46f=a19_0x20b9f5,{options:_0xc59756,args:_0x3826f8}=_0x225c9a,_0x1d625c=_0xc59756,_0x1f9e80=_0x3826f8[0x0],_0x336eb2=_0x1f9e80?a19_0xd49eed[_0x4fe46f(0x13a)](_0x1f9e80):undefined,_0x3eac59=_0x336eb2?isYamlFile(_0x336eb2):![];let _0x203c53,_0x39e6b2;if(_0x3eac59&&_0x336eb2)_0x203c53=a19_0xd49eed[_0x4fe46f(0x11b)](_0x336eb2),_0x39e6b2=_0x336eb2;else _0x336eb2?_0x203c53=_0x336eb2:_0x203c53=process[_0x4fe46f(0x117)]();if(!_0x39e6b2&&!existsSync(_0x203c53))return console[_0x4fe46f(0x12d)](a19_0x5acf6b[_0x4fe46f(0x145)]('Error:\x20Directory\x20not\x20found:\x20'+_0x203c53+'\x0a')),0x1;let _0x50056c;if(_0x39e6b2){if(!_0x39e6b2[_0x4fe46f(0x134)](_0x4fe46f(0x118))&&!_0x39e6b2['endsWith'](_0x4fe46f(0x12b)))return console[_0x4fe46f(0x12d)](a19_0x5acf6b['red'](_0x4fe46f(0x11e)+_0x39e6b2+'\x0a')),0x1;_0x50056c=[_0x39e6b2];}else _0x50056c=findYamlFiles(_0x203c53);if(_0x50056c[_0x4fe46f(0x135)]===0x0)return console[_0x4fe46f(0x12d)](a19_0x5acf6b[_0x4fe46f(0x145)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x203c53+'\x0a')),0x1;const _0x43174c=validateYamlFiles(_0x50056c,_0x203c53,{'filterType':_0x4fe46f(0x11f)}),_0x2abdad=calculateSummary(_0x43174c),_0xc7ed37=_0x43174c[_0x4fe46f(0x148)](isValidationResult);if(_0xc7ed37[_0x4fe46f(0x135)]===0x0)return console['error'](a19_0x5acf6b['yellow']('No\x20campaign\x20YAML\x20files\x20found\x20in\x20'+_0x203c53+'\x0a')),_0x2abdad[_0x4fe46f(0x12f)]>0x0&&console['error'](a19_0x5acf6b[_0x4fe46f(0x119)]('('+_0x2abdad[_0x4fe46f(0x12f)]+_0x4fe46f(0x13d))),0x0;for(const _0x2742b2 of _0x43174c){if(!isValidationResult(_0x2742b2)){_0x1d625c[_0x4fe46f(0x138)]&&console['log'](a19_0x5acf6b[_0x4fe46f(0x119)]('-\x20'+_0x2742b2[_0x4fe46f(0x123)]+_0x4fe46f(0x126)+_0x2742b2[_0x4fe46f(0x127)]+')'));continue;}const {relativePath:_0x5f056e,source:_0x45d7a0,result:_0x56c2c1}=_0x2742b2;if(_0x56c2c1[_0x4fe46f(0x142)]&&_0x56c2c1['warnings'][_0x4fe46f(0x135)]===0x0)_0x1d625c[_0x4fe46f(0x138)]&&console[_0x4fe46f(0x122)](a19_0x5acf6b[_0x4fe46f(0x130)]('✔\x20'+_0x5f056e));else _0x56c2c1[_0x4fe46f(0x142)]?(console['log'](a19_0x5acf6b[_0x4fe46f(0x146)]('⚠\x20'+_0x5f056e+':\x20'+_0x56c2c1[_0x4fe46f(0x132)][_0x4fe46f(0x135)]+'\x20warning(s)')),console[_0x4fe46f(0x122)](formatValidationResult(_0x56c2c1,_0x45d7a0,_0x5f056e))):(console[_0x4fe46f(0x122)](a19_0x5acf6b[_0x4fe46f(0x145)]('✖\x20'+_0x5f056e+':\x20'+_0x56c2c1[_0x4fe46f(0x139)][_0x4fe46f(0x135)]+_0x4fe46f(0x144))),console[_0x4fe46f(0x122)](formatValidationResult(_0x56c2c1,_0x45d7a0,_0x5f056e)));}return console[_0x4fe46f(0x122)](''),_0x2abdad[_0x4fe46f(0x12e)]?(console['log'](a19_0x5acf6b[_0x4fe46f(0x145)](_0x4fe46f(0x13e)+_0x2abdad[_0x4fe46f(0x129)]+_0x4fe46f(0x124)+_0x2abdad[_0x4fe46f(0x13c)]+_0x4fe46f(0x131))),_0x2abdad[_0x4fe46f(0x11d)]>0x0&&console[_0x4fe46f(0x122)](a19_0x5acf6b[_0x4fe46f(0x146)](_0x2abdad['warningCount']+_0x4fe46f(0x147))),_0x2abdad['skippedCount']>0x0&&console['log'](a19_0x5acf6b[_0x4fe46f(0x119)](_0x2abdad[_0x4fe46f(0x12f)]+_0x4fe46f(0x140))),0x1):(console[_0x4fe46f(0x122)](a19_0x5acf6b[_0x4fe46f(0x130)](_0x4fe46f(0x12a)+_0x2abdad[_0x4fe46f(0x13c)]+'\x20campaign(s)\x20valid')),_0x2abdad['warningCount']>0x0&&console['log'](a19_0x5acf6b[_0x4fe46f(0x146)](_0x2abdad['warningCount']+'\x20warning(s)\x20found')),_0x2abdad['skippedCount']>0x0&&console[_0x4fe46f(0x122)](a19_0x5acf6b['dim'](_0x2abdad[_0x4fe46f(0x12f)]+_0x4fe46f(0x140))),0x0);}}
@@ -1 +1 @@
1
- const a20_0x1d3a8b=a20_0x45e1;(function(_0xea41bc,_0x432792){const _0x599993=a20_0x45e1,_0x38d99e=_0xea41bc();while(!![]){try{const _0x415f5e=-parseInt(_0x599993(0x9e))/0x1*(-parseInt(_0x599993(0x105))/0x2)+-parseInt(_0x599993(0xc0))/0x3+-parseInt(_0x599993(0xbe))/0x4+parseInt(_0x599993(0x103))/0x5+-parseInt(_0x599993(0xd2))/0x6+parseInt(_0x599993(0x104))/0x7*(parseInt(_0x599993(0x96))/0x8)+-parseInt(_0x599993(0xf7))/0x9*(-parseInt(_0x599993(0xf0))/0xa);if(_0x415f5e===_0x432792)break;else _0x38d99e['push'](_0x38d99e['shift']());}catch(_0x2d0826){_0x38d99e['push'](_0x38d99e['shift']());}}}(a20_0x2579,0x28249));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{confirm}from'../utils/prompt.js';import{loadSessionContext,saveSessionContext}from'../core/session.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../core/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getCampaignUrl}from'../sdk/client/endpoints.js';export async function resolveWorkspaceIdFromOptions(_0xf03766,_0x58c92c,_0x32a86e=![]){const _0x3450e2=a20_0x45e1;if(_0xf03766[_0x3450e2(0xa5)])return await _0x58c92c[_0x3450e2(0xa6)][_0x3450e2(0x123)](_0xf03766[_0x3450e2(0xa5)]);const _0x2e82e2=loadSessionContext(_0xf03766[_0x3450e2(0xd3)]);if(_0x2e82e2?.[_0x3450e2(0xd0)])return await _0x58c92c[_0x3450e2(0xa6)][_0x3450e2(0x123)](_0x2e82e2[_0x3450e2(0xd0)]);if(_0x32a86e)throw new SDKError(ErrorCode['MISSING_ARGUMENT'],_0x3450e2(0x9a),undefined,{'helpText':'Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22'});return undefined;}async function resolveSegmentFromOptions(_0x166c24,_0x280fc0){const _0x1569de=a20_0x45e1;if(!_0x166c24['segment'])return{};const _0x558de5=_0x166c24['segment'],_0x588d97=await _0x280fc0[_0x1569de(0x110)][_0x1569de(0xe6)](_0x558de5);return{'audienceId':_0x588d97[_0x1569de(0x118)],'audienceName':_0x588d97[_0x1569de(0xdb)],..._0x588d97[_0x1569de(0xc9)]&&{'segmentId':_0x588d97[_0x1569de(0xc9)],'segmentName':_0x588d97['segmentName']}};}function buildConnectorConfig(_0x3796e2){const _0x5a266b=a20_0x45e1,_0x17174d=_0x3796e2['emailSenderId'],_0x3e38e4=_0x3796e2[_0x5a266b(0xfe)];if(!_0x17174d&&!_0x3e38e4)return undefined;return{..._0x17174d&&{'emailSenderId':_0x17174d},..._0x3e38e4&&{'jsonColumns':_0x3e38e4}};}export class EngageCampaignsCommand extends BaseCommand{['name']='engage:campaigns';[a20_0x1d3a8b(0x119)]=a20_0x1d3a8b(0xcc);async['execute'](_0x2c78bf){const _0x3ffe16=a20_0x1d3a8b,{options:_0x2a9568,args:_0x565e49,tdx:_0x1603bc}=_0x2c78bf,_0x3cda2d=_0x565e49[0x0],_0x109d80=resolveLimit(_0x2a9568['limit'],DEFAULT_LLM_LIMIT),_0x3546c6=_0x2a9568,_0x29fb4b=_0x3546c6[_0x3ffe16(0x92)],_0x13b91d=_0x3546c6['status'],_0x232f92=await resolveWorkspaceIdFromOptions(_0x3546c6,_0x1603bc),_0x4afeab=await withSpinner(_0x3ffe16(0x9c),()=>_0x1603bc[_0x3ffe16(0xa6)]['listCampaigns']({'type':_0x29fb4b,'status':_0x13b91d,'workspaceId':_0x232f92,'limit':_0x109d80}),{'verbose':_0x2a9568[_0x3ffe16(0x10b)]});let _0x28cbe4=_0x4afeab[_0x3ffe16(0x91)];_0x3cda2d&&(_0x28cbe4=_0x4afeab['data'][_0x3ffe16(0xb8)](_0x3a7954=>matchGlobPattern(_0x3a7954['name'],_0x3cda2d)));const _0x1a8b6f=_0x2a9568[_0x3ffe16(0x10c)];if(_0x2a9568['format']===_0x3ffe16(0xea)||_0x2a9568[_0x3ffe16(0x100)]===_0x3ffe16(0x97)){const _0x245b60=_0x28cbe4[_0x3ffe16(0xe9)](_0x4e504d=>({..._0x4e504d,'url':_0x4e504d['workspaceId']?getCampaignUrl(_0x1a8b6f,_0x4e504d['workspaceId'],_0x4e504d['id']):undefined}));await handleSDKOutput(_0x245b60,_0x2a9568);}else await handleSDKOutput(_0x28cbe4,_0x2a9568);return 0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a20_0x1d3a8b(0xe3)]='engage:campaign:show';[a20_0x1d3a8b(0x119)]='Show\x20campaign\x20details';async['execute'](_0x4d4054){const _0x1587c1=a20_0x1d3a8b,{options:_0x16ba29,args:_0x215374,tdx:_0x4c1f50}=_0x4d4054;if(_0x215374[_0x1587c1(0xa4)]===0x0)return console[_0x1587c1(0x98)](_0x1587c1(0x121)),console[_0x1587c1(0x98)](_0x1587c1(0xb9)),0x1;const _0x3a18a2=_0x215374[0x0],_0x1d2687=_0x16ba29,_0x4d0a93=await resolveWorkspaceIdFromOptions(_0x1d2687,_0x4c1f50),_0x505e38=_0x1d2687[_0x1587c1(0xdd)],_0x141f82=_0x16ba29[_0x1587c1(0x10c)];if(_0x505e38){const _0x42d39f=await withSpinner(_0x1587c1(0xb6)+_0x3a18a2+_0x1587c1(0xf1),()=>_0x4c1f50['engage'][_0x1587c1(0xf6)](_0x3a18a2,_0x4d0a93),{'verbose':_0x16ba29['verbose']}),_0x417225=_0x42d39f['data'],_0x333f2c=_0x417225[_0x1587c1(0xbb)][_0x1587c1(0x111)]?getCampaignUrl(_0x141f82,_0x417225[_0x1587c1(0xbb)][_0x1587c1(0x111)],_0x417225['id']):undefined;await handleSDKOutput([{..._0x417225,..._0x333f2c&&{'url':_0x333f2c}}],_0x16ba29);}else{const _0x8a10cb=await withSpinner(_0x1587c1(0xb6)+_0x3a18a2+_0x1587c1(0xf1),()=>_0x4c1f50[_0x1587c1(0xa6)][_0x1587c1(0xf8)](_0x3a18a2,_0x4d0a93),{'verbose':_0x16ba29[_0x1587c1(0x10b)]}),_0x55bdde=_0x8a10cb[_0x1587c1(0x91)],_0x5ce931=_0x55bdde['workspaceId']?getCampaignUrl(_0x141f82,_0x55bdde[_0x1587c1(0x111)],_0x55bdde['id']):undefined;await handleSingleObjectOutput({..._0x55bdde,..._0x5ce931&&{'url':_0x5ce931}},_0x16ba29);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{[a20_0x1d3a8b(0xe3)]='engage:campaign:create';['description']=a20_0x1d3a8b(0x120);async['execute'](_0x29748b){const _0x5a2c01=a20_0x1d3a8b,{options:_0x52de9e,tdx:_0x426cd0}=_0x29748b,_0x5d947e=_0x52de9e,_0x3efdf6=_0x5d947e['name'],_0x1cbc3a=_0x5d947e[_0x5a2c01(0x92)];if(!_0x3efdf6)return console['error'](_0x5a2c01(0xbc)),console['error'](_0x5a2c01(0xaa)),0x1;if(!_0x1cbc3a)return console['error'](_0x5a2c01(0x9f)),console['error'](_0x5a2c01(0xaa)),0x1;const _0xb94b1a=await resolveWorkspaceIdFromOptions(_0x5d947e,_0x426cd0,!![]),_0x387ca2=await resolveSegmentFromOptions(_0x5d947e,_0x426cd0),_0x357b9c=buildConnectorConfig(_0x5d947e),_0x5437a7={'name':_0x3efdf6,'campaignType':_0x1cbc3a,'workspaceId':_0xb94b1a,'description':_0x5d947e[_0x5a2c01(0x119)],..._0x387ca2,'connectorConfig':_0x357b9c,'startAt':_0x5d947e[_0x5a2c01(0xfd)],'timezone':_0x5d947e['timezone']},_0x5a6162=await withSpinner(_0x5a2c01(0xda)+_0x3efdf6+_0x5a2c01(0xf1),()=>_0x426cd0[_0x5a2c01(0xa6)][_0x5a2c01(0xed)](_0x5437a7));return await handleSDKOutput([_0x5a6162[_0x5a2c01(0x91)]],_0x52de9e),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a20_0x1d3a8b(0xe3)]='engage:campaign:update';['description']='Update\x20a\x20campaign';async[a20_0x1d3a8b(0xcb)](_0x5cb3b6){const _0x10cc83=a20_0x1d3a8b,{options:_0x6805fe,args:_0x18ed39,tdx:_0x4175d8}=_0x5cb3b6;if(_0x18ed39['length']===0x0)return console[_0x10cc83(0x98)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x10cc83(0x98)]('Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x5870c2=_0x18ed39[0x0],_0x5b76c2=_0x6805fe,_0x3f6a38=await resolveWorkspaceIdFromOptions(_0x5b76c2,_0x4175d8),_0x130c29=await resolveSegmentFromOptions(_0x5b76c2,_0x4175d8),_0x32fe03=buildConnectorConfig(_0x5b76c2),_0x4255f0={'name':_0x5b76c2[_0x10cc83(0xe3)],'description':_0x5b76c2['description'],..._0x130c29,'connectorConfig':_0x32fe03,'startAt':_0x5b76c2[_0x10cc83(0xfd)],'timezone':_0x5b76c2[_0x10cc83(0xa7)]},_0xe42ad4=Object[_0x10cc83(0xcf)](Object[_0x10cc83(0xa8)](_0x4255f0)[_0x10cc83(0xb8)](([,_0x354aae])=>_0x354aae!==undefined));if(Object[_0x10cc83(0x11f)](_0xe42ad4)[_0x10cc83(0xa4)]===0x0)return console[_0x10cc83(0x98)](_0x10cc83(0xf5)),console[_0x10cc83(0x98)]('Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone'),0x1;const _0x4689f5=await withSpinner(_0x10cc83(0xe7)+_0x5870c2+_0x10cc83(0xf1),()=>_0x4175d8['engage']['updateCampaign'](_0x5870c2,_0xe42ad4,_0x3f6a38),{'verbose':_0x6805fe[_0x10cc83(0x10b)]});return await handleSDKOutput([_0x4689f5[_0x10cc83(0x91)]],_0x6805fe),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{[a20_0x1d3a8b(0xe3)]=a20_0x1d3a8b(0xad);[a20_0x1d3a8b(0x119)]='Delete\x20a\x20campaign';async[a20_0x1d3a8b(0xcb)](_0x311732){const _0x2d6464=a20_0x1d3a8b,{options:_0x3cb157,args:_0x22d44d,tdx:_0x1fa995}=_0x311732;if(_0x22d44d[_0x2d6464(0xa4)]===0x0)return console['error'](_0x2d6464(0x121)),console['error'](_0x2d6464(0xdf)),0x1;const _0x50b2a4=_0x22d44d[0x0],_0x565c1c=_0x3cb157,_0x1b827f=await resolveWorkspaceIdFromOptions(_0x565c1c,_0x1fa995);if(!_0x3cb157['yes']){const _0x3415a5=await confirm(_0x2d6464(0x11c)+_0x50b2a4+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x3415a5)return console[_0x2d6464(0x113)](_0x2d6464(0xc2)),0x0;}return await withSpinner(_0x2d6464(0x11b)+_0x50b2a4+_0x2d6464(0xf1),()=>_0x1fa995['engage'][_0x2d6464(0xa3)](_0x50b2a4,_0x1b827f),{'verbose':_0x3cb157[_0x2d6464(0x10b)]}),console[_0x2d6464(0x113)](_0x2d6464(0xa9)+_0x50b2a4+_0x2d6464(0xba)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{['name']=a20_0x1d3a8b(0xb2);[a20_0x1d3a8b(0x119)]=a20_0x1d3a8b(0xd8);async[a20_0x1d3a8b(0xcb)](_0x2c4b68){const _0x1ba3db=a20_0x1d3a8b,{options:_0x5a3c21,args:_0x38fda5,tdx:_0x136891}=_0x2c4b68;if(_0x38fda5['length']===0x0)return console[_0x1ba3db(0x98)](_0x1ba3db(0x121)),console[_0x1ba3db(0x98)](_0x1ba3db(0x9d)),0x1;const _0x103959=_0x38fda5[0x0],_0x5d8535=_0x5a3c21,_0x208e95=await resolveWorkspaceIdFromOptions(_0x5d8535,_0x136891);return await withSpinner('Launching\x20campaign\x20\x27'+_0x103959+_0x1ba3db(0xf1),()=>_0x136891[_0x1ba3db(0xa6)]['launchCampaign'](_0x103959,_0x208e95),{'verbose':_0x5a3c21[_0x1ba3db(0x10b)]}),console[_0x1ba3db(0x113)]('Campaign\x20\x27'+_0x103959+_0x1ba3db(0xd6)),0x0;}}function a20_0x45e1(_0x47aa73,_0x30d549){_0x47aa73=_0x47aa73-0x90;const _0x25792f=a20_0x2579();let _0x45e102=_0x25792f[_0x47aa73];return _0x45e102;}export class EngageCampaignPauseCommand extends BaseCommand{[a20_0x1d3a8b(0xe3)]=a20_0x1d3a8b(0xef);['description']=a20_0x1d3a8b(0xa2);async[a20_0x1d3a8b(0xcb)](_0xf5eb37){const _0xe9d02d=a20_0x1d3a8b,{options:_0x128fc2,args:_0xbd7918,tdx:_0x5797a9}=_0xf5eb37;if(_0xbd7918[_0xe9d02d(0xa4)]===0x0)return console[_0xe9d02d(0x98)](_0xe9d02d(0x121)),console[_0xe9d02d(0x98)](_0xe9d02d(0x11d)),0x1;const _0x501b1f=_0xbd7918[0x0],_0x517ece=_0x128fc2,_0x47e13c=await resolveWorkspaceIdFromOptions(_0x517ece,_0x5797a9);return await withSpinner(_0xe9d02d(0xf9)+_0x501b1f+'\x27...',()=>_0x5797a9['engage'][_0xe9d02d(0x10a)](_0x501b1f,_0x47e13c),{'verbose':_0x128fc2[_0xe9d02d(0x10b)]}),console[_0xe9d02d(0x113)](_0xe9d02d(0xa9)+_0x501b1f+_0xe9d02d(0xb3)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{[a20_0x1d3a8b(0xe3)]=a20_0x1d3a8b(0x10e);[a20_0x1d3a8b(0x119)]=a20_0x1d3a8b(0xe5);async[a20_0x1d3a8b(0xcb)](_0x55cbe2){const _0x1a763a=a20_0x1d3a8b,{options:_0x1b3e34,args:_0xabda97,tdx:_0x52a8a6}=_0x55cbe2;if(_0xabda97[_0x1a763a(0xa4)]===0x0)return console['error']('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x1a763a(0x98)](_0x1a763a(0xb1)),0x1;const _0x5436fd=_0xabda97[0x0],_0x5f2224=_0x1b3e34,_0x4947aa=await resolveWorkspaceIdFromOptions(_0x5f2224,_0x52a8a6);return await withSpinner(_0x1a763a(0x101)+_0x5436fd+_0x1a763a(0xf1),()=>_0x52a8a6[_0x1a763a(0xa6)][_0x1a763a(0x9b)](_0x5436fd,_0x4947aa),{'verbose':_0x1b3e34[_0x1a763a(0x10b)]}),console[_0x1a763a(0x113)](_0x1a763a(0xa9)+_0x5436fd+_0x1a763a(0xc6)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{[a20_0x1d3a8b(0xe3)]=a20_0x1d3a8b(0x102);[a20_0x1d3a8b(0x119)]=a20_0x1d3a8b(0xf2);async[a20_0x1d3a8b(0xcb)](_0x1c39d1){const _0x601b94=a20_0x1d3a8b,{options:_0x43fd17,args:_0x40fb1b,tdx:_0x1d26b5}=_0x1c39d1;if(_0x40fb1b[_0x601b94(0xa4)]===0x0)return console[_0x601b94(0x98)](_0x601b94(0x121)),console[_0x601b94(0x98)](_0x601b94(0xde)),0x1;const _0x242231=_0x40fb1b[0x0],_0x478318=_0x43fd17,_0x39d7b6=await resolveWorkspaceIdFromOptions(_0x478318,_0x1d26b5),_0x57da86=await withSpinner(_0x601b94(0xff)+_0x242231+'\x27...',()=>_0x1d26b5[_0x601b94(0xa6)][_0x601b94(0xca)](_0x242231,_0x39d7b6),{'verbose':_0x43fd17[_0x601b94(0x10b)]});return await handleSDKOutput([_0x57da86['data']],_0x43fd17),0x0;}}export class EngageTemplatesCommand extends BaseCommand{['name']=a20_0x1d3a8b(0x122);[a20_0x1d3a8b(0x119)]=a20_0x1d3a8b(0xcd);async[a20_0x1d3a8b(0xcb)](_0x61628b){const _0x230ff6=a20_0x1d3a8b,{options:_0xe89078,args:_0x5dac08,tdx:_0x4529aa}=_0x61628b,_0x13a737=_0x5dac08[0x0],_0x4973b6=resolveLimit(_0xe89078[_0x230ff6(0xd5)],DEFAULT_LLM_LIMIT),_0x16c5b1=_0xe89078,_0x32a450=await resolveWorkspaceIdFromOptions(_0x16c5b1,_0x4529aa),_0x447341=await withSpinner(_0x230ff6(0xe8),()=>_0x4529aa[_0x230ff6(0xa6)][_0x230ff6(0x108)]({'workspaceId':_0x32a450,'limit':_0x4973b6}),{'verbose':_0xe89078[_0x230ff6(0x10b)]});let _0x1e978b=_0x447341['data'];return _0x13a737&&(_0x1e978b=_0x447341[_0x230ff6(0x91)][_0x230ff6(0xb8)](_0x45bcda=>matchGlobPattern(_0x45bcda[_0x230ff6(0xe3)],_0x13a737))),await handleSDKOutput(_0x1e978b,_0xe89078),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a20_0x1d3a8b(0xe3)]=a20_0x1d3a8b(0x99);[a20_0x1d3a8b(0x119)]=a20_0x1d3a8b(0xbf);async[a20_0x1d3a8b(0xcb)](_0x4a2ff7){const _0x58a013=a20_0x1d3a8b,{options:_0x598b08,args:_0xeadf55,tdx:_0x1e4949}=_0x4a2ff7;if(_0xeadf55[_0x58a013(0xa4)]===0x0)return console['error']('Error:\x20Template\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0x58a013(0x115)),0x1;const _0x458ae4=_0xeadf55[0x0],_0x5bc6ea=_0x598b08,_0x2fd597=await resolveWorkspaceIdFromOptions(_0x5bc6ea,_0x1e4949),_0x566023=_0x5bc6ea[_0x58a013(0xdd)];if(_0x566023){const _0x29e51a=await withSpinner(_0x58a013(0xe2)+_0x458ae4+_0x58a013(0xf1),()=>_0x1e4949[_0x58a013(0xa6)]['getTemplateFull'](_0x458ae4,_0x2fd597),{'verbose':_0x598b08[_0x58a013(0x10b)]});await handleSDKOutput([_0x29e51a],_0x598b08);}else{const _0x38e281=await withSpinner(_0x58a013(0xe2)+_0x458ae4+_0x58a013(0xf1),()=>_0x1e4949['engage'][_0x58a013(0xd4)](_0x458ae4,_0x2fd597),{'verbose':_0x598b08['verbose']});await handleSDKOutput([_0x38e281],_0x598b08);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{['name']='engage:template:create';['description']='Create\x20an\x20email\x20template';async[a20_0x1d3a8b(0xcb)](_0x4b1849){const _0x13a925=a20_0x1d3a8b,{options:_0x26a0e5,tdx:_0xfac02b}=_0x4b1849,_0x1309fa=_0x26a0e5,_0x218518=_0x1309fa[_0x13a925(0xe3)],_0x4a84f2=_0x1309fa[_0x13a925(0xeb)],_0x1872e9=_0x1309fa[_0x13a925(0xd7)];if(!_0x218518)return console['error'](_0x13a925(0xbc)),console[_0x13a925(0x98)]('Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>'),0x1;if(!_0x4a84f2)return console[_0x13a925(0x98)](_0x13a925(0xa1)),0x1;if(!_0x1872e9)return console[_0x13a925(0x98)]('Error:\x20--html\x20is\x20required'),0x1;const _0x1c204d=await resolveWorkspaceIdFromOptions(_0x1309fa,_0xfac02b,!![]),_0x1c225c={'name':_0x218518,'subjectTemplate':_0x4a84f2,'htmlTemplate':_0x1872e9,'workspaceId':_0x1c204d,'plaintextTemplate':_0x1309fa[_0x13a925(0x114)],'editorType':_0x1309fa[_0x13a925(0xdc)]},_0xc6ab1a=await withSpinner(_0x13a925(0xd1)+_0x218518+'\x27...',()=>_0xfac02b[_0x13a925(0xa6)][_0x13a925(0xb7)](_0x1c225c));return await handleSDKOutput([_0xc6ab1a['data']],_0x26a0e5),0x0;}}function a20_0x2579(){const _0x396611=['createCampaign','Set\x20workspace\x20context\x20for\x20Engage\x20commands','engage:campaign:pause','100920phPApv','\x27...','Duplicate\x20a\x20campaign','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','updateTemplate','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','getCampaignFull','207mJVizy','getCampaign','Pausing\x20campaign\x20\x27','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','deleteTemplate','engage:workspace:show','startAt','jsonColumns','Duplicating\x20campaign\x20\x27','format','Resuming\x20campaign\x20\x27','engage:campaign:duplicate','276660oqRnnz','22449qWqWhQ','3458aJujKj','Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>','Deleting\x20workspace\x20\x27','listTemplates','Delete\x20an\x20email\x20template','pauseCampaign','verbose','site','Creating\x20workspace\x20\x27','engage:campaign:resume','yes','segment','workspaceId','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','log','plaintext','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','Options:\x20--name,\x20--description','Delete\x20a\x20workspace','parentId','description','updateWorkspace','Deleting\x20campaign\x20\x27','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>','Update\x20an\x20email\x20template','keys','Create\x20a\x20new\x20campaign','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','engage:templates','resolveWorkspaceId','Error:\x20Workspace\x20name\x20is\x20required','data','type','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','getWorkspaceFull','\x27?\x20This\x20cannot\x20be\x20undone.','488ICqEEO','jsonl','error','engage:template:show','Workspace\x20is\x20required\x20for\x20this\x20operation','resumeCampaign','Fetching\x20campaigns...','Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>','175rqzvvr','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','engage:template:update','Error:\x20--subject\x20is\x20required','Pause\x20a\x20campaign','deleteCampaign','length','workspace','engage','timezone','entries','Campaign\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','Updating\x20template\x20\x27','Deleting\x20template\x20\x27','engage:campaign:delete','Engage\x20workspace\x20set\x20to:\x20','engage:template:delete','getWorkspace','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','engage:campaign:launch','\x27\x20paused\x20successfully','Fetching\x20workspace\x20\x27','Fetching\x20workspaces...','Fetching\x20campaign\x20\x27','createTemplate','filter','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','\x27\x20deleted\x20successfully','attributes','Error:\x20--name\x20is\x20required','Template\x20\x27','245788vypEcV','Show\x20email\x20template\x20details','799611AHBCGX','Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>','Operation\x20cancelled','Create\x20a\x20workspace','engage:workspace:create','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','\x27\x20resumed\x20successfully','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','deleteWorkspace','segmentId','duplicateCampaign','execute','List\x20campaigns','List\x20email\x20templates','engage:workspaces','fromEntries','engage_workspace','Creating\x20template\x20\x27','1759446zwAXUK','session','getTemplate','limit','\x27\x20launched\x20successfully','html','Launch\x20a\x20campaign','Update\x20a\x20workspace','Creating\x20campaign\x20\x27','parentName','editorType','full','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','List\x20workspaces','Verifying\x20workspace\x20\x27','Fetching\x20template\x20\x27','name','engage:workspace:delete','Resume\x20a\x20paused\x20campaign','resolvePathToResource','Updating\x20campaign\x20\x27','Fetching\x20templates...','map','json','subject','engage:workspace:use'];a20_0x2579=function(){return _0x396611;};return a20_0x2579();}export class EngageTemplateUpdateCommand extends BaseCommand{['name']=a20_0x1d3a8b(0xa0);[a20_0x1d3a8b(0x119)]=a20_0x1d3a8b(0x11e);async['execute'](_0x41b2a7){const _0x55d312=a20_0x1d3a8b,{options:_0x26c307,args:_0x4c4d75,tdx:_0x5e191a}=_0x41b2a7;if(_0x4c4d75['length']===0x0)return console['error']('Error:\x20Template\x20name\x20or\x20ID\x20is\x20required'),console[_0x55d312(0x98)]('Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x30caaf=_0x4c4d75[0x0],_0x10b380=_0x26c307,_0x2db5df=await resolveWorkspaceIdFromOptions(_0x10b380,_0x5e191a),_0x4f8b11={'name':_0x10b380[_0x55d312(0xe3)],'subjectTemplate':_0x10b380[_0x55d312(0xeb)],'htmlTemplate':_0x10b380[_0x55d312(0xd7)],'plaintextTemplate':_0x10b380[_0x55d312(0x114)]},_0x232827=Object[_0x55d312(0xcf)](Object[_0x55d312(0xa8)](_0x4f8b11)[_0x55d312(0xb8)](([,_0x206e23])=>_0x206e23!==undefined));if(Object[_0x55d312(0x11f)](_0x232827)['length']===0x0)return console[_0x55d312(0x98)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x55d312(0x98)](_0x55d312(0xc5)),0x1;const _0x3230d8=await withSpinner(_0x55d312(0xab)+_0x30caaf+_0x55d312(0xf1),()=>_0x5e191a[_0x55d312(0xa6)][_0x55d312(0xf4)](_0x30caaf,_0x232827,_0x2db5df),{'verbose':_0x26c307[_0x55d312(0x10b)]});return await handleSDKOutput([_0x3230d8[_0x55d312(0x91)]],_0x26c307),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{[a20_0x1d3a8b(0xe3)]=a20_0x1d3a8b(0xaf);[a20_0x1d3a8b(0x119)]=a20_0x1d3a8b(0x109);async[a20_0x1d3a8b(0xcb)](_0x199407){const _0x1c5276=a20_0x1d3a8b,{options:_0x10dd38,args:_0xc6706e,tdx:_0x10ce5b}=_0x199407;if(_0xc6706e['length']===0x0)return console[_0x1c5276(0x98)](_0x1c5276(0xc7)),console[_0x1c5276(0x98)](_0x1c5276(0xc1)),0x1;const _0x304e3e=_0xc6706e[0x0],_0x28398d=_0x10dd38,_0x29e7e2=await resolveWorkspaceIdFromOptions(_0x28398d,_0x10ce5b);if(!_0x10dd38[_0x1c5276(0x10f)]){const _0x5a52b4=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27'+_0x304e3e+_0x1c5276(0x95));if(!_0x5a52b4)return console[_0x1c5276(0x113)](_0x1c5276(0xc2)),0x0;}return await withSpinner(_0x1c5276(0xac)+_0x304e3e+'\x27...',()=>_0x10ce5b[_0x1c5276(0xa6)][_0x1c5276(0xfb)](_0x304e3e,_0x29e7e2),{'verbose':_0x10dd38['verbose']}),console[_0x1c5276(0x113)](_0x1c5276(0xbd)+_0x304e3e+_0x1c5276(0xba)),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{[a20_0x1d3a8b(0xe3)]=a20_0x1d3a8b(0xce);[a20_0x1d3a8b(0x119)]=a20_0x1d3a8b(0xe0);async[a20_0x1d3a8b(0xcb)](_0x47e050){const _0x50c99f=a20_0x1d3a8b,{options:_0xcdf62f,args:_0x40c087,tdx:_0x1bfb5a}=_0x47e050,_0x42a149=_0x40c087[0x0],_0x64fc50=resolveLimit(_0xcdf62f[_0x50c99f(0xd5)],DEFAULT_LLM_LIMIT),_0x1c464e=await withSpinner(_0x50c99f(0xb5),()=>_0x1bfb5a[_0x50c99f(0xa6)]['listWorkspaces']({'limit':_0x64fc50}),{'verbose':_0xcdf62f[_0x50c99f(0x10b)]});let _0x5591d3=_0x1c464e[_0x50c99f(0x91)];return _0x42a149&&(_0x5591d3=_0x1c464e[_0x50c99f(0x91)][_0x50c99f(0xb8)](_0x37307e=>matchGlobPattern(_0x37307e[_0x50c99f(0xe3)],_0x42a149))),await handleSDKOutput(_0x5591d3,_0xcdf62f),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{['name']=a20_0x1d3a8b(0xfc);[a20_0x1d3a8b(0x119)]='Show\x20workspace\x20details';async['execute'](_0x8942ff){const _0x581eb3=a20_0x1d3a8b,{options:_0x580810,args:_0x3a1b92,tdx:_0x4b28d0}=_0x8942ff;if(_0x3a1b92[_0x581eb3(0xa4)]===0x0)return console[_0x581eb3(0x98)](_0x581eb3(0x93)),console['error'](_0x581eb3(0x106)),0x1;const _0x2802bf=_0x3a1b92[0x0],_0x116f26=_0x580810,_0xbb2351=_0x116f26[_0x581eb3(0xdd)];if(_0xbb2351){const _0x235358=await withSpinner(_0x581eb3(0xb4)+_0x2802bf+_0x581eb3(0xf1),()=>_0x4b28d0['engage'][_0x581eb3(0x94)](_0x2802bf),{'verbose':_0x580810[_0x581eb3(0x10b)]});await handleSDKOutput([_0x235358],_0x580810);}else{const _0x28492a=await withSpinner('Fetching\x20workspace\x20\x27'+_0x2802bf+_0x581eb3(0xf1),()=>_0x4b28d0[_0x581eb3(0xa6)][_0x581eb3(0xb0)](_0x2802bf),{'verbose':_0x580810[_0x581eb3(0x10b)]});await handleSDKOutput([_0x28492a],_0x580810);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{[a20_0x1d3a8b(0xe3)]=a20_0x1d3a8b(0xc4);[a20_0x1d3a8b(0x119)]=a20_0x1d3a8b(0xc3);async[a20_0x1d3a8b(0xcb)](_0x1becdc){const _0x2eca84=a20_0x1d3a8b,{options:_0x20d53c,tdx:_0x57aea8}=_0x1becdc,_0xd0f209=_0x20d53c,_0x1c29bb=_0xd0f209['name'];if(!_0x1c29bb)return console['error'](_0x2eca84(0xbc)),console[_0x2eca84(0x98)]('Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]'),0x1;const _0x105b72={'name':_0x1c29bb,'description':_0xd0f209[_0x2eca84(0x119)]},_0xe03cd7=await withSpinner(_0x2eca84(0x10d)+_0x1c29bb+_0x2eca84(0xf1),()=>_0x57aea8['engage']['createWorkspace'](_0x105b72));return await handleSDKOutput([_0xe03cd7['data']],_0x20d53c),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{['name']='engage:workspace:update';[a20_0x1d3a8b(0x119)]=a20_0x1d3a8b(0xd9);async[a20_0x1d3a8b(0xcb)](_0x5126e9){const _0x51b133=a20_0x1d3a8b,{options:_0x189820,args:_0x54a097,tdx:_0xf43983}=_0x5126e9;if(_0x54a097['length']===0x0)return console[_0x51b133(0x98)](_0x51b133(0x93)),console['error'](_0x51b133(0xf3)),0x1;const _0x4cd64d=_0x54a097[0x0],_0x43c954=_0x189820,_0x206950={'name':_0x43c954[_0x51b133(0xe3)],'description':_0x43c954[_0x51b133(0x119)]},_0x710edc=Object[_0x51b133(0xcf)](Object['entries'](_0x206950)[_0x51b133(0xb8)](([,_0x1d078d])=>_0x1d078d!==undefined));if(Object[_0x51b133(0x11f)](_0x710edc)[_0x51b133(0xa4)]===0x0)return console[_0x51b133(0x98)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x51b133(0x98)](_0x51b133(0x116)),0x1;const _0x5dc7d2=await withSpinner('Updating\x20workspace\x20\x27'+_0x4cd64d+_0x51b133(0xf1),()=>_0xf43983['engage'][_0x51b133(0x11a)](_0x4cd64d,_0x710edc),{'verbose':_0x189820[_0x51b133(0x10b)]});return await handleSDKOutput([_0x5dc7d2['data']],_0x189820),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a20_0x1d3a8b(0xe3)]=a20_0x1d3a8b(0xe4);[a20_0x1d3a8b(0x119)]=a20_0x1d3a8b(0x117);async['execute'](_0x27f670){const _0x2b80a5=a20_0x1d3a8b,{options:_0x2e4b09,args:_0x746566,tdx:_0x44e837}=_0x27f670;if(_0x746566[_0x2b80a5(0xa4)]===0x0)return console['error'](_0x2b80a5(0x93)),console[_0x2b80a5(0x98)]('Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>'),0x1;const _0x27a3b4=_0x746566[0x0];if(!_0x2e4b09[_0x2b80a5(0x10f)]){const _0x2c3872=await confirm(_0x2b80a5(0x112)+_0x27a3b4+_0x2b80a5(0x95));if(!_0x2c3872)return console[_0x2b80a5(0x113)](_0x2b80a5(0xc2)),0x0;}return await withSpinner(_0x2b80a5(0x107)+_0x27a3b4+_0x2b80a5(0xf1),()=>_0x44e837['engage'][_0x2b80a5(0xc8)](_0x27a3b4),{'verbose':_0x2e4b09['verbose']}),console[_0x2b80a5(0x113)]('Workspace\x20\x27'+_0x27a3b4+_0x2b80a5(0xba)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a20_0x1d3a8b(0xe3)]=a20_0x1d3a8b(0xec);['description']=a20_0x1d3a8b(0xee);async[a20_0x1d3a8b(0xcb)](_0x4c645b){const _0x46b03a=a20_0x1d3a8b,{options:_0x3cc3f8,args:_0x5498a1,tdx:_0x1b467a}=_0x4c645b;if(_0x5498a1['length']===0x0)return console[_0x46b03a(0x98)](_0x46b03a(0x90)),console['error']('Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>'),0x1;const _0x51550c=_0x5498a1[0x0];await withSpinner(_0x46b03a(0xe1)+_0x51550c+_0x46b03a(0xf1),()=>_0x1b467a['engage'][_0x46b03a(0x123)](_0x51550c));const _0x42024f=_0x3cc3f8['session']||undefined;return saveSessionContext({'engage_workspace':_0x51550c},_0x42024f),console[_0x46b03a(0x113)](_0x46b03a(0xae)+_0x51550c),console[_0x46b03a(0x113)](_0x46b03a(0xfa)),0x0;}}
1
+ const a20_0x368bbe=a20_0x2b99;(function(_0xe6d9e5,_0x133546){const _0x250b42=a20_0x2b99,_0x12c440=_0xe6d9e5();while(!![]){try{const _0x2fb363=-parseInt(_0x250b42(0x14d))/0x1*(parseInt(_0x250b42(0x130))/0x2)+parseInt(_0x250b42(0xff))/0x3+parseInt(_0x250b42(0xe2))/0x4+-parseInt(_0x250b42(0x101))/0x5*(parseInt(_0x250b42(0xde))/0x6)+parseInt(_0x250b42(0xe1))/0x7+-parseInt(_0x250b42(0xf7))/0x8+parseInt(_0x250b42(0xd3))/0x9*(-parseInt(_0x250b42(0x150))/0xa);if(_0x2fb363===_0x133546)break;else _0x12c440['push'](_0x12c440['shift']());}catch(_0x56e44a){_0x12c440['push'](_0x12c440['shift']());}}}(a20_0x4e6c,0xcf1a1));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{confirm}from'../utils/prompt.js';import{loadSessionContext,saveSessionContext}from'../core/session.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../core/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{getCampaignUrl}from'../sdk/client/endpoints.js';export async function resolveWorkspaceIdFromOptions(_0xebdd7f,_0x208b5d,_0x4dd15e=![]){const _0x2eb719=a20_0x2b99;if(_0xebdd7f[_0x2eb719(0x13b)])return await _0x208b5d[_0x2eb719(0x124)][_0x2eb719(0xf1)](_0xebdd7f['workspace']);const _0x1cfe47=loadSessionContext(_0xebdd7f['session']);if(_0x1cfe47?.[_0x2eb719(0x146)])return await _0x208b5d['engage'][_0x2eb719(0xf1)](_0x1cfe47['engage_workspace']);if(_0x4dd15e)throw new SDKError(ErrorCode[_0x2eb719(0xe9)],_0x2eb719(0x126),undefined,{'helpText':_0x2eb719(0x128)});return undefined;}async function resolveSegmentFromOptions(_0x50ea79,_0x3563e0){const _0xbaff83=a20_0x2b99;if(!_0x50ea79[_0xbaff83(0xd0)])return{};const _0x5f21a2=_0x50ea79[_0xbaff83(0xd0)],_0x4605b2=await _0x3563e0[_0xbaff83(0xd0)][_0xbaff83(0xef)](_0x5f21a2);return{'audienceId':_0x4605b2[_0xbaff83(0xe8)],'audienceName':_0x4605b2[_0xbaff83(0xfb)],..._0x4605b2[_0xbaff83(0xf5)]&&{'segmentId':_0x4605b2[_0xbaff83(0xf5)],'segmentName':_0x4605b2['segmentName']}};}function buildConnectorConfig(_0x5d7cf2){const _0x42e61a=a20_0x2b99,_0xdcb708=_0x5d7cf2[_0x42e61a(0xeb)],_0x37b4cf=_0x5d7cf2[_0x42e61a(0x149)];if(!_0xdcb708&&!_0x37b4cf)return undefined;return{..._0xdcb708&&{'emailSenderId':_0xdcb708},..._0x37b4cf&&{'jsonColumns':_0x37b4cf}};}export class EngageCampaignsCommand extends BaseCommand{[a20_0x368bbe(0xc5)]=a20_0x368bbe(0xc8);[a20_0x368bbe(0x10c)]=a20_0x368bbe(0x147);async['execute'](_0xc2b8a5){const _0x25a590=a20_0x368bbe,{options:_0x567831,args:_0x15e26c,tdx:_0x3eb7db}=_0xc2b8a5,_0x462831=_0x15e26c[0x0],_0x207452=resolveLimit(_0x567831[_0x25a590(0x11d)],DEFAULT_LLM_LIMIT),_0x2f5420=_0x567831,_0x11331b=_0x2f5420[_0x25a590(0x14e)],_0x5102a9=_0x2f5420[_0x25a590(0x13e)],_0x3f12b5=await resolveWorkspaceIdFromOptions(_0x2f5420,_0x3eb7db),_0x23fde5=await withSpinner(_0x25a590(0x152),()=>_0x3eb7db['engage']['listCampaigns']({'type':_0x11331b,'status':_0x5102a9,'workspaceId':_0x3f12b5,'limit':_0x207452}),{'verbose':_0x567831['verbose']});let _0x5f0c4e=_0x23fde5[_0x25a590(0xc6)];_0x462831&&(_0x5f0c4e=_0x23fde5[_0x25a590(0xc6)][_0x25a590(0x10a)](_0x49d092=>matchGlobPattern(_0x49d092[_0x25a590(0xc5)],_0x462831)));const _0x31d076=_0x567831[_0x25a590(0x10b)];if(_0x567831[_0x25a590(0x11c)]===_0x25a590(0x155)||_0x567831[_0x25a590(0x11c)]===_0x25a590(0xc9)){const _0x1624cc=_0x5f0c4e['map'](_0x3cffeb=>({..._0x3cffeb,'url':_0x3cffeb[_0x25a590(0xe6)]?getCampaignUrl(_0x31d076,_0x3cffeb['workspaceId'],_0x3cffeb['id']):undefined}));await handleSDKOutput(_0x1624cc,_0x567831);}else await handleSDKOutput(_0x5f0c4e,_0x567831);return 0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a20_0x368bbe(0xc5)]=a20_0x368bbe(0xcf);[a20_0x368bbe(0x10c)]=a20_0x368bbe(0x12f);async['execute'](_0x4a986f){const _0x52d67f=a20_0x368bbe,{options:_0x1b12e2,args:_0x3412a0,tdx:_0xe12227}=_0x4a986f;if(_0x3412a0['length']===0x0)return console[_0x52d67f(0xd8)](_0x52d67f(0x113)),console[_0x52d67f(0xd8)](_0x52d67f(0x119)),0x1;const _0x11080b=_0x3412a0[0x0],_0x4df106=_0x1b12e2,_0x49fd4d=await resolveWorkspaceIdFromOptions(_0x4df106,_0xe12227),_0x4e2287=_0x4df106[_0x52d67f(0x131)],_0x497715=_0x1b12e2[_0x52d67f(0x10b)];if(_0x4e2287){const _0x160259=await withSpinner(_0x52d67f(0xe0)+_0x11080b+_0x52d67f(0xf4),()=>_0xe12227[_0x52d67f(0x124)][_0x52d67f(0xca)](_0x11080b,_0x49fd4d),{'verbose':_0x1b12e2['verbose']}),_0xf2ff9a=_0x160259[_0x52d67f(0xc6)],_0x2eb6ef=_0xf2ff9a[_0x52d67f(0xd2)][_0x52d67f(0xe6)]?getCampaignUrl(_0x497715,_0xf2ff9a[_0x52d67f(0xd2)][_0x52d67f(0xe6)],_0xf2ff9a['id']):undefined;await handleSDKOutput([{..._0xf2ff9a,..._0x2eb6ef&&{'url':_0x2eb6ef}}],_0x1b12e2);}else{const _0x164358=await withSpinner('Fetching\x20campaign\x20\x27'+_0x11080b+_0x52d67f(0xf4),()=>_0xe12227['engage']['getCampaign'](_0x11080b,_0x49fd4d),{'verbose':_0x1b12e2[_0x52d67f(0x127)]}),_0x437c93=_0x164358[_0x52d67f(0xc6)],_0x466197=_0x437c93[_0x52d67f(0xe6)]?getCampaignUrl(_0x497715,_0x437c93[_0x52d67f(0xe6)],_0x437c93['id']):undefined;await handleSingleObjectOutput({..._0x437c93,..._0x466197&&{'url':_0x466197}},_0x1b12e2);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{['name']=a20_0x368bbe(0x106);[a20_0x368bbe(0x10c)]=a20_0x368bbe(0xbf);async[a20_0x368bbe(0xce)](_0x1408e0){const _0x7a7a79=a20_0x368bbe,{options:_0x17241c,tdx:_0x107776}=_0x1408e0,_0x357069=_0x17241c,_0xd84a06=_0x357069[_0x7a7a79(0xc5)],_0x53552a=_0x357069[_0x7a7a79(0x14e)];if(!_0xd84a06)return console[_0x7a7a79(0xd8)]('Error:\x20--name\x20is\x20required'),console[_0x7a7a79(0xd8)]('Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>'),0x1;if(!_0x53552a)return console['error'](_0x7a7a79(0xec)),console[_0x7a7a79(0xd8)]('Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>'),0x1;const _0x1ce423=await resolveWorkspaceIdFromOptions(_0x357069,_0x107776,!![]),_0x34186a=await resolveSegmentFromOptions(_0x357069,_0x107776),_0x4f6439=buildConnectorConfig(_0x357069),_0x31e6fa={'name':_0xd84a06,'campaignType':_0x53552a,'workspaceId':_0x1ce423,'description':_0x357069[_0x7a7a79(0x10c)],..._0x34186a,'connectorConfig':_0x4f6439,'startAt':_0x357069[_0x7a7a79(0x125)],'timezone':_0x357069[_0x7a7a79(0xfe)]},_0x45ac3b=await withSpinner(_0x7a7a79(0x10f)+_0xd84a06+_0x7a7a79(0xf4),()=>_0x107776[_0x7a7a79(0x124)][_0x7a7a79(0xdf)](_0x31e6fa));return await handleSDKOutput([_0x45ac3b[_0x7a7a79(0xc6)]],_0x17241c),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{['name']=a20_0x368bbe(0x151);[a20_0x368bbe(0x10c)]=a20_0x368bbe(0x12c);async[a20_0x368bbe(0xce)](_0x406f03){const _0x25b4a7=a20_0x368bbe,{options:_0x157e42,args:_0x34b1f9,tdx:_0x318668}=_0x406f03;if(_0x34b1f9['length']===0x0)return console[_0x25b4a7(0xd8)](_0x25b4a7(0x113)),console[_0x25b4a7(0xd8)](_0x25b4a7(0x132)),0x1;const _0x2661ae=_0x34b1f9[0x0],_0x3e60df=_0x157e42,_0x50147c=await resolveWorkspaceIdFromOptions(_0x3e60df,_0x318668),_0x493aae=await resolveSegmentFromOptions(_0x3e60df,_0x318668),_0x389f19=buildConnectorConfig(_0x3e60df),_0x406031={'name':_0x3e60df[_0x25b4a7(0xc5)],'description':_0x3e60df['description'],..._0x493aae,'connectorConfig':_0x389f19,'startAt':_0x3e60df['startAt'],'timezone':_0x3e60df[_0x25b4a7(0xfe)]},_0xfb6fc8=Object[_0x25b4a7(0x148)](Object[_0x25b4a7(0x140)](_0x406031)[_0x25b4a7(0x10a)](([,_0x213f96])=>_0x213f96!==undefined));if(Object[_0x25b4a7(0xfa)](_0xfb6fc8)['length']===0x0)return console[_0x25b4a7(0xd8)](_0x25b4a7(0x12d)),console[_0x25b4a7(0xd8)]('Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone'),0x1;const _0x598f7c=await withSpinner(_0x25b4a7(0xf9)+_0x2661ae+_0x25b4a7(0xf4),()=>_0x318668['engage'][_0x25b4a7(0x120)](_0x2661ae,_0xfb6fc8,_0x50147c),{'verbose':_0x157e42[_0x25b4a7(0x127)]});return await handleSDKOutput([_0x598f7c[_0x25b4a7(0xc6)]],_0x157e42),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{['name']=a20_0x368bbe(0x11f);[a20_0x368bbe(0x10c)]=a20_0x368bbe(0x156);async[a20_0x368bbe(0xce)](_0x560eb7){const _0x44ff6d=a20_0x368bbe,{options:_0x4c2bb3,args:_0x2a2682,tdx:_0x36c966}=_0x560eb7;if(_0x2a2682[_0x44ff6d(0x12b)]===0x0)return console['error'](_0x44ff6d(0x113)),console[_0x44ff6d(0xd8)](_0x44ff6d(0x138)),0x1;const _0x2394c8=_0x2a2682[0x0],_0x48fd06=_0x4c2bb3,_0x42fe5d=await resolveWorkspaceIdFromOptions(_0x48fd06,_0x36c966);if(!_0x4c2bb3[_0x44ff6d(0x116)]){const _0x2fd027=await confirm(_0x44ff6d(0x118)+_0x2394c8+_0x44ff6d(0x123));if(!_0x2fd027)return console[_0x44ff6d(0xe5)](_0x44ff6d(0xda)),0x0;}return await withSpinner('Deleting\x20campaign\x20\x27'+_0x2394c8+_0x44ff6d(0xf4),()=>_0x36c966[_0x44ff6d(0x124)][_0x44ff6d(0xf6)](_0x2394c8,_0x42fe5d),{'verbose':_0x4c2bb3['verbose']}),console[_0x44ff6d(0xe5)](_0x44ff6d(0x12e)+_0x2394c8+_0x44ff6d(0x110)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a20_0x368bbe(0xc5)]=a20_0x368bbe(0x115);['description']=a20_0x368bbe(0x153);async['execute'](_0x547f65){const _0x255e86=a20_0x368bbe,{options:_0xa0fcae,args:_0x449b39,tdx:_0x26b00f}=_0x547f65;if(_0x449b39['length']===0x0)return console[_0x255e86(0xd8)](_0x255e86(0x113)),console[_0x255e86(0xd8)](_0x255e86(0x109)),0x1;const _0x2b965f=_0x449b39[0x0],_0x31d1f4=_0xa0fcae,_0xfa079=await resolveWorkspaceIdFromOptions(_0x31d1f4,_0x26b00f);return await withSpinner('Launching\x20campaign\x20\x27'+_0x2b965f+_0x255e86(0xf4),()=>_0x26b00f['engage'][_0x255e86(0xf3)](_0x2b965f,_0xfa079),{'verbose':_0xa0fcae['verbose']}),console[_0x255e86(0xe5)](_0x255e86(0x12e)+_0x2b965f+_0x255e86(0x13a)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{['name']=a20_0x368bbe(0xe4);[a20_0x368bbe(0x10c)]=a20_0x368bbe(0xc1);async[a20_0x368bbe(0xce)](_0x55d38d){const _0x93b732=a20_0x368bbe,{options:_0x52f2b6,args:_0x5e213a,tdx:_0x1594b3}=_0x55d38d;if(_0x5e213a[_0x93b732(0x12b)]===0x0)return console[_0x93b732(0xd8)](_0x93b732(0x113)),console['error'](_0x93b732(0x104)),0x1;const _0x1bf408=_0x5e213a[0x0],_0x1318cd=_0x52f2b6,_0xf3fc21=await resolveWorkspaceIdFromOptions(_0x1318cd,_0x1594b3);return await withSpinner(_0x93b732(0xd4)+_0x1bf408+'\x27...',()=>_0x1594b3[_0x93b732(0x124)]['pauseCampaign'](_0x1bf408,_0xf3fc21),{'verbose':_0x52f2b6[_0x93b732(0x127)]}),console[_0x93b732(0xe5)](_0x93b732(0x12e)+_0x1bf408+_0x93b732(0xd1)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{['name']=a20_0x368bbe(0x14c);['description']=a20_0x368bbe(0x14b);async['execute'](_0x41725e){const _0x59aec0=a20_0x368bbe,{options:_0x32cdfa,args:_0xba9773,tdx:_0x2ae967}=_0x41725e;if(_0xba9773[_0x59aec0(0x12b)]===0x0)return console[_0x59aec0(0xd8)](_0x59aec0(0x113)),console[_0x59aec0(0xd8)](_0x59aec0(0x114)),0x1;const _0x3a315e=_0xba9773[0x0],_0x497ad3=_0x32cdfa,_0x3b106c=await resolveWorkspaceIdFromOptions(_0x497ad3,_0x2ae967);return await withSpinner(_0x59aec0(0x103)+_0x3a315e+_0x59aec0(0xf4),()=>_0x2ae967['engage'][_0x59aec0(0x133)](_0x3a315e,_0x3b106c),{'verbose':_0x32cdfa['verbose']}),console[_0x59aec0(0xe5)]('Campaign\x20\x27'+_0x3a315e+_0x59aec0(0xd7)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{[a20_0x368bbe(0xc5)]=a20_0x368bbe(0x14a);[a20_0x368bbe(0x10c)]=a20_0x368bbe(0x154);async[a20_0x368bbe(0xce)](_0x49c8ad){const _0x299281=a20_0x368bbe,{options:_0x133d1c,args:_0x3c721d,tdx:_0x100176}=_0x49c8ad;if(_0x3c721d[_0x299281(0x12b)]===0x0)return console['error'](_0x299281(0x113)),console[_0x299281(0xd8)](_0x299281(0xf0)),0x1;const _0x35842b=_0x3c721d[0x0],_0x3c271f=_0x133d1c,_0x5e83f5=await resolveWorkspaceIdFromOptions(_0x3c271f,_0x100176),_0x29b962=await withSpinner('Duplicating\x20campaign\x20\x27'+_0x35842b+'\x27...',()=>_0x100176[_0x299281(0x124)][_0x299281(0x102)](_0x35842b,_0x5e83f5),{'verbose':_0x133d1c[_0x299281(0x127)]});return await handleSDKOutput([_0x29b962['data']],_0x133d1c),0x0;}}function a20_0x2b99(_0x1be0ff,_0x30fb9c){_0x1be0ff=_0x1be0ff-0xbf;const _0x4e6ca7=a20_0x4e6c();let _0x2b99cd=_0x4e6ca7[_0x1be0ff];return _0x2b99cd;}export class EngageTemplatesCommand extends BaseCommand{[a20_0x368bbe(0xc5)]=a20_0x368bbe(0xd6);['description']=a20_0x368bbe(0xf8);async[a20_0x368bbe(0xce)](_0x5e1fce){const _0x48e4ae=a20_0x368bbe,{options:_0x3a216d,args:_0x24eb90,tdx:_0x2e77d5}=_0x5e1fce,_0x1ac1fc=_0x24eb90[0x0],_0x42dbbc=resolveLimit(_0x3a216d['limit'],DEFAULT_LLM_LIMIT),_0x3c40a9=_0x3a216d,_0x3c37f7=await resolveWorkspaceIdFromOptions(_0x3c40a9,_0x2e77d5),_0x4fbe2f=await withSpinner(_0x48e4ae(0x107),()=>_0x2e77d5[_0x48e4ae(0x124)][_0x48e4ae(0xdb)]({'workspaceId':_0x3c37f7,'limit':_0x42dbbc}),{'verbose':_0x3a216d[_0x48e4ae(0x127)]});let _0x6648bb=_0x4fbe2f[_0x48e4ae(0xc6)];return _0x1ac1fc&&(_0x6648bb=_0x4fbe2f[_0x48e4ae(0xc6)]['filter'](_0x961386=>matchGlobPattern(_0x961386[_0x48e4ae(0xc5)],_0x1ac1fc))),await handleSDKOutput(_0x6648bb,_0x3a216d),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a20_0x368bbe(0xc5)]=a20_0x368bbe(0x129);[a20_0x368bbe(0x10c)]=a20_0x368bbe(0x105);async[a20_0x368bbe(0xce)](_0x5ba885){const _0x4180ab=a20_0x368bbe,{options:_0x5ec23e,args:_0x4f6347,tdx:_0x4a0da3}=_0x5ba885;if(_0x4f6347[_0x4180ab(0x12b)]===0x0)return console['error'](_0x4180ab(0xc3)),console[_0x4180ab(0xd8)](_0x4180ab(0x13d)),0x1;const _0x49c9d4=_0x4f6347[0x0],_0x14eadf=_0x5ec23e,_0x329e89=await resolveWorkspaceIdFromOptions(_0x14eadf,_0x4a0da3),_0xedb74=_0x14eadf['full'];if(_0xedb74){const _0x3a9047=await withSpinner('Fetching\x20template\x20\x27'+_0x49c9d4+_0x4180ab(0xf4),()=>_0x4a0da3[_0x4180ab(0x124)]['getTemplateFull'](_0x49c9d4,_0x329e89),{'verbose':_0x5ec23e['verbose']});await handleSDKOutput([_0x3a9047],_0x5ec23e);}else{const _0x456e91=await withSpinner(_0x4180ab(0xea)+_0x49c9d4+'\x27...',()=>_0x4a0da3[_0x4180ab(0x124)][_0x4180ab(0x144)](_0x49c9d4,_0x329e89),{'verbose':_0x5ec23e[_0x4180ab(0x127)]});await handleSDKOutput([_0x456e91],_0x5ec23e);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{['name']=a20_0x368bbe(0x111);[a20_0x368bbe(0x10c)]=a20_0x368bbe(0x117);async[a20_0x368bbe(0xce)](_0x4237a5){const _0x48deb5=a20_0x368bbe,{options:_0x561540,tdx:_0x283c07}=_0x4237a5,_0x231a98=_0x561540,_0x4ebeb7=_0x231a98[_0x48deb5(0xc5)],_0x553af5=_0x231a98[_0x48deb5(0x10d)],_0x5ae26f=_0x231a98[_0x48deb5(0x135)];if(!_0x4ebeb7)return console[_0x48deb5(0xd8)]('Error:\x20--name\x20is\x20required'),console[_0x48deb5(0xd8)](_0x48deb5(0xed)),0x1;if(!_0x553af5)return console[_0x48deb5(0xd8)](_0x48deb5(0x12a)),0x1;if(!_0x5ae26f)return console['error'](_0x48deb5(0xcd)),0x1;const _0x4304c5=await resolveWorkspaceIdFromOptions(_0x231a98,_0x283c07,!![]),_0x2b72e0={'name':_0x4ebeb7,'subjectTemplate':_0x553af5,'htmlTemplate':_0x5ae26f,'workspaceId':_0x4304c5,'plaintextTemplate':_0x231a98[_0x48deb5(0xc0)],'editorType':_0x231a98[_0x48deb5(0x10e)]},_0x50075e=await withSpinner(_0x48deb5(0x112)+_0x4ebeb7+_0x48deb5(0xf4),()=>_0x283c07[_0x48deb5(0x124)]['createTemplate'](_0x2b72e0));return await handleSDKOutput([_0x50075e[_0x48deb5(0xc6)]],_0x561540),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{[a20_0x368bbe(0xc5)]=a20_0x368bbe(0x145);[a20_0x368bbe(0x10c)]='Update\x20an\x20email\x20template';async[a20_0x368bbe(0xce)](_0x5df20c){const _0x509a4d=a20_0x368bbe,{options:_0x2e0476,args:_0x10e124,tdx:_0xa2dbe7}=_0x5df20c;if(_0x10e124[_0x509a4d(0x12b)]===0x0)return console[_0x509a4d(0xd8)](_0x509a4d(0xc3)),console['error'](_0x509a4d(0xc4)),0x1;const _0x48ab4c=_0x10e124[0x0],_0xeaf8db=_0x2e0476,_0x21f93c=await resolveWorkspaceIdFromOptions(_0xeaf8db,_0xa2dbe7),_0xf81394={'name':_0xeaf8db['name'],'subjectTemplate':_0xeaf8db[_0x509a4d(0x10d)],'htmlTemplate':_0xeaf8db['html'],'plaintextTemplate':_0xeaf8db[_0x509a4d(0xc0)]},_0x3e7f2a=Object[_0x509a4d(0x148)](Object['entries'](_0xf81394)['filter'](([,_0x2a5687])=>_0x2a5687!==undefined));if(Object[_0x509a4d(0xfa)](_0x3e7f2a)['length']===0x0)return console[_0x509a4d(0xd8)](_0x509a4d(0x12d)),console[_0x509a4d(0xd8)]('Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext'),0x1;const _0x1f5c9b=await withSpinner('Updating\x20template\x20\x27'+_0x48ab4c+_0x509a4d(0xf4),()=>_0xa2dbe7[_0x509a4d(0x124)][_0x509a4d(0x108)](_0x48ab4c,_0x3e7f2a,_0x21f93c),{'verbose':_0x2e0476[_0x509a4d(0x127)]});return await handleSDKOutput([_0x1f5c9b[_0x509a4d(0xc6)]],_0x2e0476),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{[a20_0x368bbe(0xc5)]='engage:template:delete';[a20_0x368bbe(0x10c)]=a20_0x368bbe(0xcc);async[a20_0x368bbe(0xce)](_0x2ad697){const _0x43455=a20_0x368bbe,{options:_0x21c831,args:_0x46cb88,tdx:_0x4ddb6b}=_0x2ad697;if(_0x46cb88[_0x43455(0x12b)]===0x0)return console[_0x43455(0xd8)]('Error:\x20Template\x20name\x20or\x20ID\x20is\x20required'),console[_0x43455(0xd8)](_0x43455(0x139)),0x1;const _0x15c7bf=_0x46cb88[0x0],_0x376ec0=_0x21c831,_0x398c4e=await resolveWorkspaceIdFromOptions(_0x376ec0,_0x4ddb6b);if(!_0x21c831[_0x43455(0x116)]){const _0x39f1eb=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27'+_0x15c7bf+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x39f1eb)return console[_0x43455(0xe5)](_0x43455(0xda)),0x0;}return await withSpinner(_0x43455(0x122)+_0x15c7bf+_0x43455(0xf4),()=>_0x4ddb6b[_0x43455(0x124)]['deleteTemplate'](_0x15c7bf,_0x398c4e),{'verbose':_0x21c831[_0x43455(0x127)]}),console['log'](_0x43455(0xe7)+_0x15c7bf+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{['name']='engage:workspaces';[a20_0x368bbe(0x10c)]='List\x20workspaces';async[a20_0x368bbe(0xce)](_0x394dec){const _0x3a98eb=a20_0x368bbe,{options:_0x4deffb,args:_0x2f2e4e,tdx:_0x2baee5}=_0x394dec,_0xd4bc6d=_0x2f2e4e[0x0],_0x4db144=resolveLimit(_0x4deffb['limit'],DEFAULT_LLM_LIMIT),_0x222baf=await withSpinner('Fetching\x20workspaces...',()=>_0x2baee5[_0x3a98eb(0x124)]['listWorkspaces']({'limit':_0x4db144}),{'verbose':_0x4deffb[_0x3a98eb(0x127)]});let _0x4d1789=_0x222baf[_0x3a98eb(0xc6)];return _0xd4bc6d&&(_0x4d1789=_0x222baf[_0x3a98eb(0xc6)][_0x3a98eb(0x10a)](_0xc9befa=>matchGlobPattern(_0xc9befa[_0x3a98eb(0xc5)],_0xd4bc6d))),await handleSDKOutput(_0x4d1789,_0x4deffb),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{['name']=a20_0x368bbe(0x141);[a20_0x368bbe(0x10c)]=a20_0x368bbe(0xfd);async[a20_0x368bbe(0xce)](_0x528d76){const _0x5054f1=a20_0x368bbe,{options:_0x2756a2,args:_0x5928b7,tdx:_0x25e365}=_0x528d76;if(_0x5928b7['length']===0x0)return console[_0x5054f1(0xd8)](_0x5054f1(0xd9)),console[_0x5054f1(0xd8)](_0x5054f1(0x143)),0x1;const _0x31b5a6=_0x5928b7[0x0],_0x408b42=_0x2756a2,_0x2f54d6=_0x408b42[_0x5054f1(0x131)];if(_0x2f54d6){const _0x25f69a=await withSpinner(_0x5054f1(0xf2)+_0x31b5a6+_0x5054f1(0xf4),()=>_0x25e365[_0x5054f1(0x124)]['getWorkspaceFull'](_0x31b5a6),{'verbose':_0x2756a2[_0x5054f1(0x127)]});await handleSDKOutput([_0x25f69a],_0x2756a2);}else{const _0x39971=await withSpinner('Fetching\x20workspace\x20\x27'+_0x31b5a6+_0x5054f1(0xf4),()=>_0x25e365[_0x5054f1(0x124)]['getWorkspace'](_0x31b5a6),{'verbose':_0x2756a2['verbose']});await handleSDKOutput([_0x39971],_0x2756a2);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{['name']=a20_0x368bbe(0xd5);[a20_0x368bbe(0x10c)]=a20_0x368bbe(0x13c);async['execute'](_0x5f3a2a){const _0x4c01af=a20_0x368bbe,{options:_0x501e0c,tdx:_0x4e1505}=_0x5f3a2a,_0x17cd6f=_0x501e0c,_0x3c2ee3=_0x17cd6f[_0x4c01af(0xc5)];if(!_0x3c2ee3)return console['error'](_0x4c01af(0x11a)),console['error'](_0x4c01af(0x142)),0x1;const _0x4630ea={'name':_0x3c2ee3,'description':_0x17cd6f[_0x4c01af(0x10c)]},_0x228f5c=await withSpinner(_0x4c01af(0xdd)+_0x3c2ee3+_0x4c01af(0xf4),()=>_0x4e1505['engage'][_0x4c01af(0x136)](_0x4630ea));return await handleSDKOutput([_0x228f5c[_0x4c01af(0xc6)]],_0x501e0c),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a20_0x368bbe(0xc5)]=a20_0x368bbe(0x13f);['description']=a20_0x368bbe(0x11b);async[a20_0x368bbe(0xce)](_0x501dc9){const _0x56382d=a20_0x368bbe,{options:_0x8b0937,args:_0x2daead,tdx:_0x23c95f}=_0x501dc9;if(_0x2daead[_0x56382d(0x12b)]===0x0)return console['error'](_0x56382d(0xd9)),console[_0x56382d(0xd8)]('Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x33a0be=_0x2daead[0x0],_0xfb562f=_0x8b0937,_0x4ab80d={'name':_0xfb562f[_0x56382d(0xc5)],'description':_0xfb562f[_0x56382d(0x10c)]},_0x337236=Object[_0x56382d(0x148)](Object['entries'](_0x4ab80d)[_0x56382d(0x10a)](([,_0x32ef22])=>_0x32ef22!==undefined));if(Object['keys'](_0x337236)[_0x56382d(0x12b)]===0x0)return console[_0x56382d(0xd8)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x56382d(0xd8)](_0x56382d(0x11e)),0x1;const _0x380f4c=await withSpinner(_0x56382d(0x100)+_0x33a0be+_0x56382d(0xf4),()=>_0x23c95f['engage'][_0x56382d(0xc7)](_0x33a0be,_0x337236),{'verbose':_0x8b0937['verbose']});return await handleSDKOutput([_0x380f4c[_0x56382d(0xc6)]],_0x8b0937),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a20_0x368bbe(0xc5)]=a20_0x368bbe(0xc2);[a20_0x368bbe(0x10c)]=a20_0x368bbe(0x14f);async[a20_0x368bbe(0xce)](_0x2e2012){const _0x46d847=a20_0x368bbe,{options:_0x54ff0e,args:_0x847d7f,tdx:_0x5a44b9}=_0x2e2012;if(_0x847d7f['length']===0x0)return console[_0x46d847(0xd8)](_0x46d847(0xd9)),console[_0x46d847(0xd8)](_0x46d847(0x121)),0x1;const _0x5df6b4=_0x847d7f[0x0];if(!_0x54ff0e['yes']){const _0x4a168b=await confirm(_0x46d847(0xfc)+_0x5df6b4+_0x46d847(0x123));if(!_0x4a168b)return console[_0x46d847(0xe5)](_0x46d847(0xda)),0x0;}return await withSpinner('Deleting\x20workspace\x20\x27'+_0x5df6b4+_0x46d847(0xf4),()=>_0x5a44b9[_0x46d847(0x124)][_0x46d847(0xcb)](_0x5df6b4),{'verbose':_0x54ff0e[_0x46d847(0x127)]}),console[_0x46d847(0xe5)]('Workspace\x20\x27'+_0x5df6b4+_0x46d847(0x110)),0x0;}}function a20_0x4e6c(){const _0x221a2b=['\x27\x20launched\x20successfully','workspace','Create\x20a\x20workspace','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','status','engage:workspace:update','entries','engage:workspace:show','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>','getTemplate','engage:template:update','engage_workspace','List\x20campaigns','fromEntries','jsonColumns','engage:campaign:duplicate','Resume\x20a\x20paused\x20campaign','engage:campaign:resume','1uHWcig','type','Delete\x20a\x20workspace','2272180hrLBCx','engage:campaign:update','Fetching\x20campaigns...','Launch\x20a\x20campaign','Duplicate\x20a\x20campaign','json','Delete\x20a\x20campaign','Create\x20a\x20new\x20campaign','plaintext','Pause\x20a\x20campaign','engage:workspace:delete','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','name','data','updateWorkspace','engage:campaigns','jsonl','getCampaignFull','deleteWorkspace','Delete\x20an\x20email\x20template','Error:\x20--html\x20is\x20required','execute','engage:campaign:show','segment','\x27\x20paused\x20successfully','attributes','27WsxOeB','Pausing\x20campaign\x20\x27','engage:workspace:create','engage:templates','\x27\x20resumed\x20successfully','error','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','Operation\x20cancelled','listTemplates','session','Creating\x20workspace\x20\x27','4006842rWJUIK','createCampaign','Fetching\x20campaign\x20\x27','7516523GorTWm','4769752NWjllF','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','engage:campaign:pause','log','workspaceId','Template\x20\x27','parentId','MISSING_ARGUMENT','Fetching\x20template\x20\x27','emailSenderId','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>','Verifying\x20workspace\x20\x27','resolvePathToResource','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','resolveWorkspaceId','Fetching\x20workspace\x20\x27','launchCampaign','\x27...','segmentId','deleteCampaign','8697656yoxonw','List\x20email\x20templates','Updating\x20campaign\x20\x27','keys','parentName','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','Show\x20workspace\x20details','timezone','4167999SeHRxM','Updating\x20workspace\x20\x27','5EjJqJd','duplicateCampaign','Resuming\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>','Show\x20email\x20template\x20details','engage:campaign:create','Fetching\x20templates...','updateTemplate','Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>','filter','site','description','subject','editorType','Creating\x20campaign\x20\x27','\x27\x20deleted\x20successfully','engage:template:create','Creating\x20template\x20\x27','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','engage:campaign:launch','yes','Create\x20an\x20email\x20template','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','Error:\x20--name\x20is\x20required','Update\x20a\x20workspace','format','limit','Options:\x20--name,\x20--description','engage:campaign:delete','updateCampaign','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','Deleting\x20template\x20\x27','\x27?\x20This\x20cannot\x20be\x20undone.','engage','startAt','Workspace\x20is\x20required\x20for\x20this\x20operation','verbose','Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22','engage:template:show','Error:\x20--subject\x20is\x20required','length','Update\x20a\x20campaign','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','Campaign\x20\x27','Show\x20campaign\x20details','741206gHkeBX','full','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','resumeCampaign','Engage\x20workspace\x20set\x20to:\x20','html','createWorkspace','Set\x20workspace\x20context\x20for\x20Engage\x20commands','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>'];a20_0x4e6c=function(){return _0x221a2b;};return a20_0x4e6c();}export class EngageWorkspaceUseCommand extends BaseCommand{[a20_0x368bbe(0xc5)]='engage:workspace:use';['description']=a20_0x368bbe(0x137);async[a20_0x368bbe(0xce)](_0x35415b){const _0x326afe=a20_0x368bbe,{options:_0x3a1674,args:_0x4a1939,tdx:_0x3997e4}=_0x35415b;if(_0x4a1939[_0x326afe(0x12b)]===0x0)return console['error']('Error:\x20Workspace\x20name\x20is\x20required'),console[_0x326afe(0xd8)]('Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>'),0x1;const _0x2b190e=_0x4a1939[0x0];await withSpinner(_0x326afe(0xee)+_0x2b190e+_0x326afe(0xf4),()=>_0x3997e4[_0x326afe(0x124)][_0x326afe(0xf1)](_0x2b190e));const _0x104894=_0x3a1674[_0x326afe(0xdc)]||undefined;return saveSessionContext({'engage_workspace':_0x2b190e},_0x104894),console[_0x326afe(0xe5)](_0x326afe(0x134)+_0x2b190e),console[_0x326afe(0xe5)](_0x326afe(0xe3)),0x0;}}
@@ -1 +1 @@
1
- const a21_0x8609f0=a21_0x22d6;(function(_0x450296,_0xa1368f){const _0x136ced=a21_0x22d6,_0x289ba1=_0x450296();while(!![]){try{const _0x59a691=parseInt(_0x136ced(0x1b1))/0x1+-parseInt(_0x136ced(0x19e))/0x2*(parseInt(_0x136ced(0x1a2))/0x3)+parseInt(_0x136ced(0x19d))/0x4+parseInt(_0x136ced(0x19b))/0x5*(parseInt(_0x136ced(0x1ae))/0x6)+-parseInt(_0x136ced(0x18b))/0x7+-parseInt(_0x136ced(0x1ab))/0x8+parseInt(_0x136ced(0x178))/0x9*(parseInt(_0x136ced(0x1bd))/0xa);if(_0x59a691===_0xa1368f)break;else _0x289ba1['push'](_0x289ba1['shift']());}catch(_0x3711c7){_0x289ba1['push'](_0x289ba1['shift']());}}}(a21_0x9dde,0x33848));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a21_0x9dde(){const _0x1f8892=['\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','start_at','execute','Limit:\x20','\x20\x20Job\x20ID:\x20','round','debug','name','473238BrhLot','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20show\x20<job-id>','job:result','✔\x20Retrieved\x20','kill','job:submit','job:show','✔\x20Job\x20submitted','Submitting\x20kill\x20request...','status','Query:\x20','Kill\x20a\x20job','data','Job\x20type:\x20','Show\x20job\x20details','substring','user_name','information_schema','No\x20SQL\x20statements\x20found\x20in\x20file','1029238ScZzeq','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20kill\x20<job-id>','✔\x20Found\x20','getTime','Query\x20is\x20required\x0aUsage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','yes','priority','type','Submit\x20a\x20job','INVALID_ARGUMENT','file','created_at','--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','Getting\x20job\x20results...','error','url','5WftVSg','description','782100xiLcuG','36298BuyBTQ','database','\x20jobs','Listing\x20jobs...','39ZJfPQi','length','submit','verbose','Cancelled','...','show','trino','end_at','1820872eoRyPD','args','hive','2129766ibNcuL','jobs','query','60782zWmzDA','list','Getting\x20job\x20details...','\x27\x20to\x20verify\x20the\x20job\x20status','job_id','Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','validate','\x20job','job:kill','map','Get\x20job\x20results','limit','40KbULJN'];a21_0x9dde=function(){return _0x1f8892;};return a21_0x9dde();}import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../sdk/query/sql-parser.js';import{confirm}from'../utils/prompt.js';function a21_0x22d6(_0x263ada,_0x563753){_0x263ada=_0x263ada-0x177;const _0x9ddee5=a21_0x9dde();let _0x22d613=_0x9ddee5[_0x263ada];return _0x22d613;}import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';export class JobListCommand extends BaseCommand{[a21_0x8609f0(0x177)]='jobs';[a21_0x8609f0(0x19c)]='List\x20jobs';async['execute'](_0x33c3ed){const _0x9c4b5d=a21_0x8609f0,{options:_0x15012e,tdx:_0x53dfdb}=_0x33c3ed,_0x387aba=resolveLimit(_0x15012e[_0x9c4b5d(0x1bc)],DEFAULT_DISPLAY_LIMIT),_0x62a605=_0x15012e['status'];_0x15012e[_0x9c4b5d(0x1a5)]&&(console[_0x9c4b5d(0x199)](_0x9c4b5d(0x1c1)+_0x387aba+_0x9c4b5d(0x1a0)),_0x62a605&&console[_0x9c4b5d(0x199)]('Status\x20filter:\x20'+_0x62a605));const _0x1ccb64=await withSpinner(_0x9c4b5d(0x1a1),()=>_0x53dfdb[_0x9c4b5d(0x1af)][_0x9c4b5d(0x1b2)]({'from':0x0,'to':_0x387aba-0x1,'status':_0x62a605}),{'verbose':_0x15012e['verbose']}),_0x197286=_0x1ccb64[_0x9c4b5d(0x184)];console[_0x9c4b5d(0x199)](_0x9c4b5d(0x18d)+_0x197286[_0x9c4b5d(0x1a3)]+_0x9c4b5d(0x1b8)+(_0x197286[_0x9c4b5d(0x1a3)]!==0x1?'s':''));const _0x47aee6=_0x197286[_0x9c4b5d(0x1ba)](_0x3b403e=>{const _0x36510b=_0x9c4b5d;let _0x807a8b;if(_0x3b403e[_0x36510b(0x1bf)]&&_0x3b403e[_0x36510b(0x1aa)]){const _0x40f9dc=new Date(_0x3b403e[_0x36510b(0x1bf)])[_0x36510b(0x18e)](),_0x36d3ee=new Date(_0x3b403e[_0x36510b(0x1aa)])[_0x36510b(0x18e)]();_0x807a8b=Math['round']((_0x36d3ee-_0x40f9dc)/0x3e8);}return{'job_id':_0x3b403e[_0x36510b(0x1b5)],'type':_0x3b403e[_0x36510b(0x192)],'status':_0x3b403e['status'],'user_name':_0x3b403e[_0x36510b(0x188)],'duration_sec':_0x807a8b,'created_at':_0x3b403e[_0x36510b(0x196)],'started_at':_0x3b403e[_0x36510b(0x1bf)],'end_at':_0x3b403e[_0x36510b(0x1aa)]};});return await handleSDKOutput(_0x47aee6,_0x15012e),0x0;}}export class JobShowCommand extends BaseCommand{[a21_0x8609f0(0x177)]=a21_0x8609f0(0x17e);[a21_0x8609f0(0x19c)]=a21_0x8609f0(0x186);[a21_0x8609f0(0x1b7)](_0x495c8a){const _0x2999ef=a21_0x8609f0,_0x1f83b9=_0x495c8a[_0x2999ef(0x1ac)][0x0];if(!_0x1f83b9)return _0x2999ef(0x179);return undefined;}async[a21_0x8609f0(0x1c0)](_0xa940c7){const _0x32e24e=a21_0x8609f0,{options:_0x309426,args:_0x2a196a,tdx:_0x31d234}=_0xa940c7,_0x2894b7=_0x2a196a[0x0],_0x3110c0=await withSpinner(_0x32e24e(0x1b3),()=>_0x31d234[_0x32e24e(0x1af)][_0x32e24e(0x1a8)](_0x2894b7),{'verbose':_0x309426['verbose']}),_0x2764e5=_0x3110c0[_0x32e24e(0x184)];let _0x4551aa;if(_0x2764e5[_0x32e24e(0x1bf)]&&_0x2764e5[_0x32e24e(0x1aa)]){const _0x380d8a=new Date(_0x2764e5[_0x32e24e(0x1bf)])[_0x32e24e(0x18e)](),_0x44fb4f=new Date(_0x2764e5[_0x32e24e(0x1aa)])[_0x32e24e(0x18e)]();_0x4551aa=Math[_0x32e24e(0x1c3)]((_0x44fb4f-_0x380d8a)/0x3e8);}const _0x41c9c4={'job_id':_0x2764e5[_0x32e24e(0x1b5)],'type':_0x2764e5['type'],'status':_0x2764e5[_0x32e24e(0x181)],..._0x2764e5[_0x32e24e(0x188)]&&{'user_name':_0x2764e5['user_name']},..._0x4551aa!==undefined&&{'duration_sec':_0x4551aa},..._0x2764e5['created_at']&&{'created_at':_0x2764e5[_0x32e24e(0x196)]},..._0x2764e5['start_at']&&{'started_at':_0x2764e5[_0x32e24e(0x1bf)]},..._0x2764e5[_0x32e24e(0x1aa)]&&{'end_at':_0x2764e5['end_at']},..._0x2764e5[_0x32e24e(0x19f)]&&{'database':_0x2764e5[_0x32e24e(0x19f)]},..._0x2764e5[_0x32e24e(0x191)]!==undefined&&{'priority':_0x2764e5[_0x32e24e(0x191)]},..._0x2764e5[_0x32e24e(0x19a)]&&{'url':_0x2764e5[_0x32e24e(0x19a)]},..._0x2764e5[_0x32e24e(0x1b0)]&&{'query':_0x2764e5[_0x32e24e(0x1b0)]},..._0x2764e5[_0x32e24e(0x1c4)]&&{'debug':_0x2764e5[_0x32e24e(0x1c4)]}};return await handleSingleObjectOutput(_0x41c9c4,_0x309426),0x0;}}export class JobKillCommand extends BaseCommand{['name']=a21_0x8609f0(0x1b9);[a21_0x8609f0(0x19c)]=a21_0x8609f0(0x183);[a21_0x8609f0(0x1b7)](_0x5640bf){const _0x2c5365=a21_0x8609f0,_0x30a3a4=_0x5640bf[_0x2c5365(0x1ac)][0x0];if(!_0x30a3a4)return _0x2c5365(0x18c);return undefined;}async[a21_0x8609f0(0x1c0)](_0x456fc3){const _0x33462d=a21_0x8609f0,{options:_0x13c681,args:_0x185b10,tdx:_0x4ff56e}=_0x456fc3,_0xe8e669=_0x185b10[0x0];if(!_0x13c681[_0x33462d(0x190)]){const _0x211004=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20'+_0xe8e669+'?');if(!_0x211004)return console[_0x33462d(0x199)](_0x33462d(0x1a6)),0x0;}return await withSpinner(_0x33462d(0x180),()=>_0x4ff56e[_0x33462d(0x1af)][_0x33462d(0x17c)](_0xe8e669),{'verbose':_0x13c681[_0x33462d(0x1a5)]}),console[_0x33462d(0x199)]('✔\x20Kill\x20request\x20submitted\x20for\x20job\x20'+_0xe8e669),console[_0x33462d(0x199)](_0x33462d(0x1be)+_0xe8e669+_0x33462d(0x1b4)),0x0;}}export class JobSubmitCommand extends BaseCommand{[a21_0x8609f0(0x177)]=a21_0x8609f0(0x17d);[a21_0x8609f0(0x19c)]=a21_0x8609f0(0x193);async[a21_0x8609f0(0x1c0)](_0x202e2b){const _0xf0dbcd=a21_0x8609f0,{options:_0x28fcf4,args:_0x3a96b8,tdx:_0x261986}=_0x202e2b,_0x19dff8=_0x28fcf4['jobType']||'trino',_0x67bc73=_0x28fcf4[_0xf0dbcd(0x195)],_0x602b1c=_0x28fcf4[_0xf0dbcd(0x19f)]||_0xf0dbcd(0x189),_0x42548f=_0x28fcf4['result'];if(_0x19dff8!==_0xf0dbcd(0x1a9)&&_0x19dff8!==_0xf0dbcd(0x1ad))throw new SDKError(ErrorCode[_0xf0dbcd(0x194)],_0xf0dbcd(0x197));let _0x270613;if(_0x67bc73){if(_0x3a96b8[0x0])throw new SDKError(ErrorCode[_0xf0dbcd(0x194)],_0xf0dbcd(0x1b6));const _0x17ed7b=readSqlStatementsFromFile(_0x67bc73);if(_0x17ed7b[_0xf0dbcd(0x1a3)]===0x0)throw new SDKError(ErrorCode[_0xf0dbcd(0x194)],_0xf0dbcd(0x18a));if(_0x17ed7b['length']>0x1)throw new SDKError(ErrorCode[_0xf0dbcd(0x194)],'Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.');_0x270613=_0x17ed7b[0x0];}else{if(!_0x3a96b8[0x0])throw new SDKError(ErrorCode[_0xf0dbcd(0x194)],_0xf0dbcd(0x18f));_0x270613=_0x3a96b8[0x0];}_0x28fcf4[_0xf0dbcd(0x1a5)]&&(console[_0xf0dbcd(0x199)](_0xf0dbcd(0x185)+_0x19dff8),console['error']('Database:\x20'+_0x602b1c),console['error'](_0xf0dbcd(0x182)+_0x270613[_0xf0dbcd(0x187)](0x0,0x64)+(_0x270613[_0xf0dbcd(0x1a3)]>0x64?_0xf0dbcd(0x1a7):'')));const _0x2a8e4f=await withSpinner('Submitting\x20job...',()=>_0x261986[_0xf0dbcd(0x1af)][_0xf0dbcd(0x1a4)](_0x602b1c,_0x270613,_0x19dff8,_0x42548f),{'verbose':_0x28fcf4['verbose']}),_0x114179=_0x2a8e4f['data'];return console[_0xf0dbcd(0x199)](_0xf0dbcd(0x17f)),console[_0xf0dbcd(0x199)](_0xf0dbcd(0x1c2)+_0x114179['job_id']),await handleSDKOutput([_0x114179],_0x28fcf4),0x0;}}export class JobResultCommand extends BaseCommand{[a21_0x8609f0(0x177)]=a21_0x8609f0(0x17a);['description']=a21_0x8609f0(0x1bb);[a21_0x8609f0(0x1b7)](_0x70895d){const _0x54fa3c=a21_0x8609f0,_0x327b49=_0x70895d[_0x54fa3c(0x1ac)][0x0];if(!_0x327b49)return'Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20result\x20<job-id>';return undefined;}async[a21_0x8609f0(0x1c0)](_0xf70026){const _0x292430=a21_0x8609f0,{options:_0x211914,args:_0x4eb2af,tdx:_0x326813}=_0xf70026,_0x4192b8=_0x4eb2af[0x0],_0xd52e30=await withSpinner(_0x292430(0x198),()=>_0x326813[_0x292430(0x1af)]['result'](_0x4192b8),{'verbose':_0x211914[_0x292430(0x1a5)]}),_0x12268f=_0xd52e30[_0x292430(0x184)];return console[_0x292430(0x199)](_0x292430(0x17b)+_0x12268f['length']+'\x20row'+(_0x12268f[_0x292430(0x1a3)]!==0x1?'s':'')),await handleSDKOutput(_0x12268f,_0x211914),0x0;}}
1
+ const a21_0x48426d=a21_0x7148;(function(_0x3c17c6,_0x34a0ac){const _0x5a1b37=a21_0x7148,_0x461606=_0x3c17c6();while(!![]){try{const _0x14d758=-parseInt(_0x5a1b37(0x8f))/0x1*(-parseInt(_0x5a1b37(0x8d))/0x2)+parseInt(_0x5a1b37(0x81))/0x3*(-parseInt(_0x5a1b37(0x7a))/0x4)+parseInt(_0x5a1b37(0x97))/0x5+-parseInt(_0x5a1b37(0xa1))/0x6*(parseInt(_0x5a1b37(0xaf))/0x7)+-parseInt(_0x5a1b37(0x82))/0x8*(parseInt(_0x5a1b37(0x9a))/0x9)+-parseInt(_0x5a1b37(0x95))/0xa+parseInt(_0x5a1b37(0x72))/0xb*(parseInt(_0x5a1b37(0xa8))/0xc);if(_0x14d758===_0x34a0ac)break;else _0x461606['push'](_0x461606['shift']());}catch(_0x2c7b71){_0x461606['push'](_0x461606['shift']());}}}(a21_0x4c20,0xb5a82));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a21_0x7148(_0x470a2c,_0x1d30a6){_0x470a2c=_0x470a2c-0x6f;const _0x4c204a=a21_0x4c20();let _0x714880=_0x4c204a[_0x470a2c];return _0x714880;}import{readSqlStatementsFromFile}from'../sdk/query/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';export class JobListCommand extends BaseCommand{[a21_0x48426d(0x91)]='jobs';['description']='List\x20jobs';async[a21_0x48426d(0x8c)](_0x479eb4){const _0x559f1e=a21_0x48426d,{options:_0x167d69,tdx:_0x14a696}=_0x479eb4,_0xec1f84=resolveLimit(_0x167d69[_0x559f1e(0x7e)],DEFAULT_DISPLAY_LIMIT),_0x143f6c=_0x167d69[_0x559f1e(0x80)];_0x167d69[_0x559f1e(0x98)]&&(console[_0x559f1e(0xa0)](_0x559f1e(0x74)+_0xec1f84+_0x559f1e(0x87)),_0x143f6c&&console[_0x559f1e(0xa0)](_0x559f1e(0x7f)+_0x143f6c));const _0x5aea47=await withSpinner(_0x559f1e(0x9f),()=>_0x14a696[_0x559f1e(0xad)][_0x559f1e(0x9b)]({'from':0x0,'to':_0xec1f84-0x1,'status':_0x143f6c}),{'verbose':_0x167d69[_0x559f1e(0x98)]}),_0x1da400=_0x5aea47['data'];console[_0x559f1e(0xa0)]('✔\x20Found\x20'+_0x1da400[_0x559f1e(0x7b)]+'\x20job'+(_0x1da400[_0x559f1e(0x7b)]!==0x1?'s':''));const _0x23e140=_0x1da400['map'](_0x554f54=>{const _0x293271=_0x559f1e;let _0x319f04;if(_0x554f54[_0x293271(0xa9)]&&_0x554f54['end_at']){const _0xcafff2=new Date(_0x554f54['start_at'])[_0x293271(0x7d)](),_0x39044d=new Date(_0x554f54[_0x293271(0x78)])[_0x293271(0x7d)]();_0x319f04=Math[_0x293271(0xb2)]((_0x39044d-_0xcafff2)/0x3e8);}return{'job_id':_0x554f54['job_id'],'type':_0x554f54[_0x293271(0x92)],'status':_0x554f54[_0x293271(0x80)],'user_name':_0x554f54['user_name'],'duration_sec':_0x319f04,'created_at':_0x554f54['created_at'],'started_at':_0x554f54[_0x293271(0xa9)],'end_at':_0x554f54[_0x293271(0x78)]};});return await handleSDKOutput(_0x23e140,_0x167d69),0x0;}}export class JobShowCommand extends BaseCommand{[a21_0x48426d(0x91)]='job:show';[a21_0x48426d(0xa2)]=a21_0x48426d(0x9e);[a21_0x48426d(0x77)](_0x5355c4){const _0x4b8ad9=a21_0x48426d,_0x3547fd=_0x5355c4[_0x4b8ad9(0x85)][0x0];if(!_0x3547fd)return _0x4b8ad9(0x89);return undefined;}async[a21_0x48426d(0x8c)](_0x55b0da){const _0xd48a32=a21_0x48426d,{options:_0x14d6b,args:_0xf6458a,tdx:_0x329045}=_0x55b0da,_0x274359=_0xf6458a[0x0],_0xe818ac=await withSpinner(_0xd48a32(0x70),()=>_0x329045[_0xd48a32(0xad)]['show'](_0x274359),{'verbose':_0x14d6b[_0xd48a32(0x98)]}),_0x3899fb=_0xe818ac[_0xd48a32(0xb3)];let _0x5839e9;if(_0x3899fb[_0xd48a32(0xa9)]&&_0x3899fb[_0xd48a32(0x78)]){const _0x210bc1=new Date(_0x3899fb[_0xd48a32(0xa9)])['getTime'](),_0x3b694c=new Date(_0x3899fb[_0xd48a32(0x78)])[_0xd48a32(0x7d)]();_0x5839e9=Math['round']((_0x3b694c-_0x210bc1)/0x3e8);}const _0x309e51={'job_id':_0x3899fb[_0xd48a32(0xaa)],'type':_0x3899fb[_0xd48a32(0x92)],'status':_0x3899fb['status'],..._0x3899fb[_0xd48a32(0x6f)]&&{'user_name':_0x3899fb[_0xd48a32(0x6f)]},..._0x5839e9!==undefined&&{'duration_sec':_0x5839e9},..._0x3899fb['created_at']&&{'created_at':_0x3899fb[_0xd48a32(0x79)]},..._0x3899fb[_0xd48a32(0xa9)]&&{'started_at':_0x3899fb['start_at']},..._0x3899fb[_0xd48a32(0x78)]&&{'end_at':_0x3899fb['end_at']},..._0x3899fb['database']&&{'database':_0x3899fb[_0xd48a32(0x84)]},..._0x3899fb[_0xd48a32(0x73)]!==undefined&&{'priority':_0x3899fb[_0xd48a32(0x73)]},..._0x3899fb[_0xd48a32(0xa7)]&&{'url':_0x3899fb[_0xd48a32(0xa7)]},..._0x3899fb[_0xd48a32(0xa3)]&&{'query':_0x3899fb[_0xd48a32(0xa3)]},..._0x3899fb['debug']&&{'debug':_0x3899fb['debug']}};return await handleSingleObjectOutput(_0x309e51,_0x14d6b),0x0;}}function a21_0x4c20(){const _0x179c71=['job_id','yes','job:result','jobs','Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','1918ZsTZww','...','Kill\x20a\x20job','round','data','user_name','Getting\x20job\x20details...','jobType','1697014BGJqBl','priority','Limit:\x20','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20kill\x20<job-id>','validate','end_at','created_at','3096292LDlPOl','length','result','getTime','limit','Status\x20filter:\x20','status','3hrcoHc','72UoyQPk','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','database','args','file','\x20jobs','trino','Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20show\x20<job-id>','\x20\x20Job\x20ID:\x20','Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','execute','644646vwMHdZ','substring','1QzPiuc','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','name','type','submit','--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','7293240DcDCYL','INVALID_ARGUMENT','5289995KRvCxT','verbose','Submitting\x20kill\x20request...','773739allSjQ','list','job:submit','No\x20SQL\x20statements\x20found\x20in\x20file','Show\x20job\x20details','Listing\x20jobs...','error','11364KbzGMZ','description','query','Database:\x20','Get\x20job\x20results','\x27\x20to\x20verify\x20the\x20job\x20status','url','168SONofv','start_at'];a21_0x4c20=function(){return _0x179c71;};return a21_0x4c20();}export class JobKillCommand extends BaseCommand{[a21_0x48426d(0x91)]='job:kill';[a21_0x48426d(0xa2)]=a21_0x48426d(0xb1);[a21_0x48426d(0x77)](_0x4fe81a){const _0x3e9787=a21_0x48426d,_0x5ca623=_0x4fe81a[_0x3e9787(0x85)][0x0];if(!_0x5ca623)return _0x3e9787(0x76);return undefined;}async[a21_0x48426d(0x8c)](_0x21b498){const _0x18de6d=a21_0x48426d,{options:_0xe49613,args:_0x1f031a,tdx:_0x5de78c}=_0x21b498,_0x3b08c3=_0x1f031a[0x0];if(!_0xe49613[_0x18de6d(0xab)]){const _0x3f8878=await confirm(_0x18de6d(0x83)+_0x3b08c3+'?');if(!_0x3f8878)return console[_0x18de6d(0xa0)]('Cancelled'),0x0;}return await withSpinner(_0x18de6d(0x99),()=>_0x5de78c[_0x18de6d(0xad)]['kill'](_0x3b08c3),{'verbose':_0xe49613[_0x18de6d(0x98)]}),console[_0x18de6d(0xa0)](_0x18de6d(0x75)+_0x3b08c3),console[_0x18de6d(0xa0)](_0x18de6d(0x90)+_0x3b08c3+_0x18de6d(0xa6)),0x0;}}export class JobSubmitCommand extends BaseCommand{['name']=a21_0x48426d(0x9c);[a21_0x48426d(0xa2)]='Submit\x20a\x20job';async['execute'](_0x1d50b0){const _0x3a86be=a21_0x48426d,{options:_0x396c40,args:_0x3b1c19,tdx:_0x3d6034}=_0x1d50b0,_0x365789=_0x396c40[_0x3a86be(0x71)]||_0x3a86be(0x88),_0x7671e8=_0x396c40[_0x3a86be(0x86)],_0x1d0c73=_0x396c40[_0x3a86be(0x84)]||'information_schema',_0x2678cb=_0x396c40['result'];if(_0x365789!==_0x3a86be(0x88)&&_0x365789!=='hive')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x3a86be(0x94));let _0x3928a3;if(_0x7671e8){if(_0x3b1c19[0x0])throw new SDKError(ErrorCode[_0x3a86be(0x96)],_0x3a86be(0xae));const _0x58d461=readSqlStatementsFromFile(_0x7671e8);if(_0x58d461[_0x3a86be(0x7b)]===0x0)throw new SDKError(ErrorCode[_0x3a86be(0x96)],_0x3a86be(0x9d));if(_0x58d461[_0x3a86be(0x7b)]>0x1)throw new SDKError(ErrorCode[_0x3a86be(0x96)],_0x3a86be(0x8b));_0x3928a3=_0x58d461[0x0];}else{if(!_0x3b1c19[0x0])throw new SDKError(ErrorCode[_0x3a86be(0x96)],'Query\x20is\x20required\x0aUsage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>');_0x3928a3=_0x3b1c19[0x0];}_0x396c40[_0x3a86be(0x98)]&&(console[_0x3a86be(0xa0)]('Job\x20type:\x20'+_0x365789),console[_0x3a86be(0xa0)](_0x3a86be(0xa4)+_0x1d0c73),console[_0x3a86be(0xa0)]('Query:\x20'+_0x3928a3[_0x3a86be(0x8e)](0x0,0x64)+(_0x3928a3[_0x3a86be(0x7b)]>0x64?_0x3a86be(0xb0):'')));const _0x4c886b=await withSpinner('Submitting\x20job...',()=>_0x3d6034[_0x3a86be(0xad)][_0x3a86be(0x93)](_0x1d0c73,_0x3928a3,_0x365789,_0x2678cb),{'verbose':_0x396c40['verbose']}),_0x26caba=_0x4c886b[_0x3a86be(0xb3)];return console['error']('✔\x20Job\x20submitted'),console[_0x3a86be(0xa0)](_0x3a86be(0x8a)+_0x26caba[_0x3a86be(0xaa)]),await handleSDKOutput([_0x26caba],_0x396c40),0x0;}}export class JobResultCommand extends BaseCommand{['name']=a21_0x48426d(0xac);['description']=a21_0x48426d(0xa5);[a21_0x48426d(0x77)](_0x1165a9){const _0x2b487c=a21_0x48426d,_0x2b8496=_0x1165a9[_0x2b487c(0x85)][0x0];if(!_0x2b8496)return'Job\x20ID\x20is\x20required\x0aUsage:\x20job\x20result\x20<job-id>';return undefined;}async['execute'](_0x512460){const _0x6713f2=a21_0x48426d,{options:_0x3eabdc,args:_0x320880,tdx:_0x222b80}=_0x512460,_0x5ba64e=_0x320880[0x0],_0xfee81c=await withSpinner('Getting\x20job\x20results...',()=>_0x222b80[_0x6713f2(0xad)][_0x6713f2(0x7c)](_0x5ba64e),{'verbose':_0x3eabdc[_0x6713f2(0x98)]}),_0x37a2af=_0xfee81c['data'];return console[_0x6713f2(0xa0)]('✔\x20Retrieved\x20'+_0x37a2af[_0x6713f2(0x7b)]+'\x20row'+(_0x37a2af[_0x6713f2(0x7b)]!==0x1?'s':'')),await handleSDKOutput(_0x37a2af,_0x3eabdc),0x0;}}
@@ -1 +1 @@
1
- const a22_0x54fb49=a22_0x5170;function a22_0x442e(){const _0x5eefdb=['\x20\x20Consolidating\x20duplicate\x20segment:\x20','(root)','jsonl','/app/ps/','nodes','limit','Pattern:\x20','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Fetching\x20journeys\x20and\x20folders...','\x20(rule\x20match)','Aborted.','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','Getting\x20column\x20mapping...','verbose','all','yes','createdAt','content','3010776NRZAam','journey:versions','length','folderPath','folderId','getJourney','push','red','journey:stats','localeCompare','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','411qmbsBD','updatedAt','Listing\x20journeys...','✔\x20Journey\x20\x22','3649176zLBSbY','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','\x20unchanged\x20files','Cancelled','/j/da/je','test','renderStats','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','exitOrJumpSize','session','\x20journey\x20files\x20to\x20','map','paused','blue','\x0aError:','\x20\x20Preserving\x20local\x20segment\x20name:\x20','Warning:\x20Could\x20not\x20resolve\x20activation\x20','2677833DnVARF','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','buildIdToNameMap','database','listJourneysFromParentSegment','If\x20the\x20journey\x20is\x20active,\x20the\x20date\x20range\x20may\x20be\x20too\x20wide.\x20Try\x20a\x20shorter\x20period\x20(max\x20~90\x20days).','exitOrJumpRate','✔\x20All\x20files\x20are\x20up\x20to\x20date','diff','hasChanges','Could\x20not\x20resolve\x20parent\x20segment.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','65vaKtcK','Folder\x20path:\x20','stringify','\x20version','\x0aChanges\x20to\x20\x27','cyan','set','Error:\x20Journey\x20not\x20found:\x20','Getting\x20journey\x20traffic\x20data...','...','View\x20a\x20specific\x20version\x20of\x20a\x20journey','stageNameMap','data','Resume\x20a\x20paused\x20journey','Export\x20journey(s)\x20as\x20YAML\x20files','\x20(draft)\x20—\x20\x22','getTrafficData','journeyBundleId','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','segmentPushCommand','history','Getting\x20version\x20','Pause\x20a\x20running\x20journey','journey:pull','Error:\x20Stage\x20\x22','join','includeHistory','connection','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','Warning:\x20--include-history\x20without\x20--from/--to\x20may\x20return\x20all-time\x20history','get','\x20journey','utf-8','size','tdx.json','isNew','INVALID_ARGUMENT','\x20details...','type','cwd','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','add','153940lHMpze','entries','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','parent_segment','relativePath','Journey\x20name:\x20','format','\x20not\x20found.\x20Available:\x20','name','message','Show\x20journey\x20details','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20->\x20','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','then','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','✔\x20Found\x20','parentSegment','\x5c$&','\x20\x20Folder\x20path:\x20','find','journeyBundleName','journey:view','setPhase','conversion','green','repeat','\x27\x20not\x20found\x20in\x20','has','Database:\x20','journey:list','.yml','rootFolderId','\x22\x20not\x20found','journey:version:create','\x20changed\x20files','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','execute','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','journey','segments','journey:traffic','values','(completed)','6642jeBMzn','8qsNaAZ','archived','✔\x20Pulled\x20','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','description','\x20\x20Parent\x20segment:\x20','Error:\x20Version\x20','Getting\x20journey\x20statistics...','\x20=\x20','/j/da','resolveSegment','Parent\x20segment:\x20','Error:\x20','listActivationsFlat','Resolving\x20parent\x20segment...','journey:columns','enteredSize','Input:\x20','pause','Fetching\x20users\x20and\x20connections...','listFolders','\x20\x20Journey\x20ID:\x20','sort','listJourneysWithFolders','getActivation','journeyStages','Resolving\x20journey...','json','table','state','Getting\x20journey\x20details...','file','resume','base','attributes','resolveParentId','No\x20journeys\x20found','Listing\x20journey\x20activations...','split','replace','getStatistics','11yHLPZU','Show\x20journey\x20statistics','args','journey:pause','Usage:\x20journey\x20<subcommand>\x20<name-or-path>','Target\x20file:\x20','5042990HSpASx','/e/','Fetching\x20parent\x20segment...','listVersions','goal','Fetching\x20','no_parent','(running)','segment','helpText','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','from','journey:activations','segmentName','Warning:\x20Could\x20not\x20resolve\x20segment\x20','activationParams','getColumnMapping','\x20\x20Name:\x20','stages','Write\x20','-\x20no\x20files\x20written','yellow','Resolved\x20YAML\x20file:\x20','user','toLowerCase','Options:','Available\x20stages:\x20','site','Show\x20journey\x20table\x20column\x20mapping','✔\x20Context\x20set:\x20','targetDir','goalSize','journeyId','List\x20activations\x20for\x20a\x20journey','dim','includeStats','createVersion','error','versionNumber','5344724OeAOcE','\x20(ID:\x20','buildIdToEmailMap','completed','journey:push','draft','milestoneSize','launched','filter','\x20new\x20files','Resolving\x20version...','folders','Target\x20directory:\x20','errorCode','resourceName','\x22.\x20Must\x20be\x20\x22conversion\x22\x20or\x20\x22activation\x22.','hasPeriod','Pausing\x20journey...','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','reentryMode','parentName','log','\x20\x20Statistics\x20not\x20available','\x20activation','journey:version:view','completionRate','rule','activation'];a22_0x442e=function(){return _0x5eefdb;};return a22_0x442e();}(function(_0x213c45,_0x1604f2){const _0x5d5958=a22_0x5170,_0x3bffd6=_0x213c45();while(!![]){try{const _0x15e1d6=-parseInt(_0x5d5958(0x262))/0x1*(-parseInt(_0x5d5958(0x1d2))/0x2)+-parseInt(_0x5d5958(0x266))/0x3+parseInt(_0x5d5958(0x2ad))/0x4*(parseInt(_0x5d5958(0x282))/0x5)+-parseInt(_0x5d5958(0x257))/0x6+parseInt(_0x5d5958(0x229))/0x7+-parseInt(_0x5d5958(0x1d3))/0x8*(-parseInt(_0x5d5958(0x277))/0x9)+parseInt(_0x5d5958(0x202))/0xa*(-parseInt(_0x5d5958(0x1fc))/0xb);if(_0x15e1d6===_0x1604f2)break;else _0x3bffd6['push'](_0x3bffd6['shift']());}catch(_0x5b32f2){_0x3bffd6['push'](_0x3bffd6['shift']());}}}(a22_0x442e,0xabd4a));import a22_0x22ee6a from'chalk';import a22_0x1a2b3d 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(_0x9664e){const _0x105b5a=a22_0x5170;return!_0x9664e&&(console[_0x105b5a(0x227)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x105b5a(0x227)](_0x105b5a(0x200))),!!_0x9664e;}function withJsonFormat(_0x7f34d8){const _0x5e43df=a22_0x5170;if(!_0x7f34d8[_0x5e43df(0x2b3)]&&!_0x7f34d8[_0x5e43df(0x1ee)]&&!_0x7f34d8['jsonl']&&!_0x7f34d8['tsv'])return{..._0x7f34d8,'format':_0x5e43df(0x1ee),'json':!![]};return _0x7f34d8;}function formatJourneyState(_0x3dd88c){const _0xc532e=a22_0x5170;switch(_0x3dd88c){case _0xc532e(0x230):return a22_0x22ee6a[_0xc532e(0x1bf)](_0xc532e(0x209));case _0xc532e(0x22e):return a22_0x22ee6a[_0xc532e(0x224)]('(draft)');case _0xc532e(0x272):return a22_0x22ee6a[_0xc532e(0x217)]('(paused)');case _0xc532e(0x22c):return a22_0x22ee6a[_0xc532e(0x273)](_0xc532e(0x1d1));case _0xc532e(0x1d4):return a22_0x22ee6a[_0xc532e(0x224)]('(archived)');default:return'('+_0x3dd88c+')';}}function formatJourneyItem(_0x1bae68,_0x5b800f='',_0x254fe7){const _0xa40704=a22_0x5170,_0x1161aa=formatJourneyState(_0x1bae68[_0xa40704(0x1f0)]),_0x4447ce=_0x254fe7?hyperlink(_0x1bae68['journeyBundleName'],_0x254fe7):_0x1bae68[_0xa40704(0x1bb)];return _0x5b800f+'🗺️\x20'+_0x4447ce+'\x20'+_0x1161aa;}function escapeRegex(_0x3393b4){const _0x498829=a22_0x5170;return _0x3393b4[_0x498829(0x1fa)](/[.*+?^${}()|[\]\\]/g,_0x498829(0x1b8));}function globToRegex(_0x80e001){const _0x3f5905=a22_0x5170,_0x2820b7=_0x80e001[_0x3f5905(0x1f9)]('*')['map'](escapeRegex);return new RegExp(_0x2820b7['join']('.*'),'i');}function buildRuleToNameMapping(_0x38e449){const _0x401f5f=a22_0x5170,_0x451f99=new Map();if(_0x38e449[_0x401f5f(0x1ce)])for(const [_0x42d717,_0x1de041]of Object[_0x401f5f(0x2ae)](_0x38e449[_0x401f5f(0x1ce)])){if(_0x1de041[_0x401f5f(0x243)]){const _0x2ad6c6=serializeRule(_0x1de041[_0x401f5f(0x243)]),_0x214f6a=_0x451f99[_0x401f5f(0x2a0)](_0x2ad6c6);_0x214f6a?_0x214f6a[_0x401f5f(0x25d)](_0x42d717):_0x451f99['set'](_0x2ad6c6,[_0x42d717]);}}return _0x451f99;}async function resolveJourneyIdFromInput(_0x424c6d,_0x39ac9c,_0x12f0df){const _0x499b20=a22_0x5170,_0x5367e4=await resolveJourneyTarget(_0x424c6d,_0x39ac9c[_0x499b20(0x1b7)],_0x39ac9c[_0x499b20(0x252)]),_0x3fc16b=_0x5367e4[_0x499b20(0x1b7)];if(!_0x3fc16b)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x499b20(0x281));const _0x4eb0bc=await withSpinner(_0x499b20(0x1e1),()=>_0x12f0df[_0x499b20(0x20a)]['resolveParentId'](_0x3fc16b),{'verbose':_0x39ac9c['verbose']}),_0x130c9f=_0x4eb0bc[_0x499b20(0x28e)],_0x38773b=await withSpinner(_0x499b20(0x1ed),()=>_0x12f0df[_0x499b20(0x1cd)]['resolveJourneyId'](_0x130c9f,_0x5367e4['journeyName']),{'verbose':_0x39ac9c[_0x499b20(0x252)]});return{'journeyId':_0x38773b['data'],'journeyName':_0x5367e4['journeyName'],'parentSegmentId':_0x130c9f};}async function resolveJourneyTarget(_0x50de11,_0x335fd3,_0x1de458){const _0x5b7a4a=a22_0x5170;if(isYamlFilePath(_0x50de11))try{const _0x477cc7=await resolveYamlFilePath(_0x50de11);return _0x1de458&&(console['error'](_0x5b7a4a(0x218)+_0x50de11),console['error'](_0x5b7a4a(0x1d8)+_0x477cc7[_0x5b7a4a(0x1b7)]),console[_0x5b7a4a(0x227)](_0x5b7a4a(0x213)+_0x477cc7[_0x5b7a4a(0x20f)]),console[_0x5b7a4a(0x227)](_0x5b7a4a(0x1b9)+(_0x477cc7[_0x5b7a4a(0x25a)]||_0x5b7a4a(0x246)))),{'journeyName':_0x477cc7[_0x5b7a4a(0x20f)],'parentSegment':_0x477cc7['parentSegment'],'resolved':_0x477cc7};}catch(_0xabe2d6){throw new SDKError(ErrorCode[_0x5b7a4a(0x2a6)],_0x5b7a4a(0x1cc)+_0xabe2d6[_0x5b7a4a(0x2b6)]);}if(!_0x335fd3)throw new SDKError(ErrorCode[_0x5b7a4a(0x2a6)],_0x5b7a4a(0x24c));return{'journeyName':_0x50de11,'parentSegment':_0x335fd3};}export class JourneyListCommand extends BaseCommand{['name']=a22_0x54fb49(0x1c4);[a22_0x54fb49(0x1d7)]='List\x20journeys\x20in\x20current\x20context';async['execute'](_0x5e001d){const _0x2b74f5=a22_0x54fb49,{options:_0xacf7af,args:_0x37cccd,tdx:_0x3f0a00}=_0x5e001d,_0x54fb0e=_0x37cccd[0x0],_0x4623d8=_0xacf7af[_0x2b74f5(0x1b7)];if(!_0x4623d8)return console[_0x2b74f5(0x227)]('Error:\x20Parent\x20segment\x20context\x20required'),console[_0x2b74f5(0x227)](_0x2b74f5(0x267)),0x1;const _0x50058b=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x3f0a00[_0x2b74f5(0x20a)][_0x2b74f5(0x1f6)](_0x4623d8),{'verbose':_0xacf7af['verbose']}),_0x3636e7=_0x50058b[_0x2b74f5(0x28e)];_0xacf7af[_0x2b74f5(0x252)]&&(console[_0x2b74f5(0x227)]('Parent\x20segment:\x20'+_0x4623d8+_0x2b74f5(0x22a)+_0x3636e7+')'),_0x54fb0e&&console[_0x2b74f5(0x227)](_0x2b74f5(0x24b)+_0x54fb0e));const _0x24c3c4=await withSpinner(_0x2b74f5(0x204),()=>_0x3f0a00[_0x2b74f5(0x20a)]['getParentFull'](_0x3636e7),{'verbose':_0xacf7af[_0x2b74f5(0x252)]}),_0x4f7375=_0x24c3c4[_0x2b74f5(0x28e)],_0x31bf02=_0x4f7375[_0x2b74f5(0x1c6)],_0x51e0e9=await withSpinner(_0x2b74f5(0x264),()=>_0x3f0a00[_0x2b74f5(0x1cd)][_0x2b74f5(0x1ea)](_0x3636e7,_0x31bf02),{'verbose':_0xacf7af['verbose']});let _0x4e0ca0=_0x51e0e9[_0x2b74f5(0x28e)]['journeys'];const _0x5384d8=_0x51e0e9[_0x2b74f5(0x28e)][_0x2b74f5(0x234)],_0x556fb5=new Map();for(const _0x241882 of _0x5384d8){_0x556fb5[_0x2b74f5(0x288)](_0x241882['id'],_0x241882[_0x2b74f5(0x2b5)]);}if(_0x54fb0e){const _0x38932a=globToRegex(_0x54fb0e);_0x4e0ca0=_0x4e0ca0[_0x2b74f5(0x231)](_0x42c94c=>_0x38932a[_0x2b74f5(0x26b)](_0x42c94c[_0x2b74f5(0x1bb)]));}console[_0x2b74f5(0x227)](_0x2b74f5(0x1b6)+_0x4e0ca0['length']+_0x2b74f5(0x2a1)+(_0x4e0ca0[_0x2b74f5(0x259)]!==0x1?'s':''));const _0x4ba440=_0x16dede=>{const _0x592108=_0x2b74f5;return getConsoleNextUrl(_0xacf7af[_0x592108(0x21d)],_0x592108(0x248)+_0x3636e7+'/e/'+_0x16dede+_0x592108(0x1dc));};if(_0xacf7af[_0x2b74f5(0x2b3)]===_0x2b74f5(0x1ef))await handleSDKOutput(_0x4e0ca0,_0xacf7af);else{if(_0xacf7af[_0x2b74f5(0x2b3)]==='json'){const _0x23a9a6=_0x4e0ca0[_0x2b74f5(0x271)](_0x3a1467=>({..._0x3a1467,'url':_0x4ba440(_0x3a1467['id'])}));await handleSDKOutput(_0x23a9a6,_0xacf7af);}else{console[_0x2b74f5(0x23e)]('['+_0x4623d8+']');const _0x4be70d=new Map(),_0x348578=[];for(const _0x38ccb3 of _0x4e0ca0){if(!_0x38ccb3['folderId']||_0x38ccb3['folderId']===_0x31bf02)_0x348578[_0x2b74f5(0x25d)](_0x38ccb3);else{const _0x15b947=_0x4be70d[_0x2b74f5(0x2a0)](_0x38ccb3[_0x2b74f5(0x25b)])||[];_0x15b947[_0x2b74f5(0x25d)](_0x38ccb3),_0x4be70d[_0x2b74f5(0x288)](_0x38ccb3[_0x2b74f5(0x25b)],_0x15b947);}}const _0x50b333=(_0x304616,_0x29f29f)=>_0x304616['journeyBundleName']['localeCompare'](_0x29f29f['journeyBundleName'],undefined,{'sensitivity':_0x2b74f5(0x1f4)});_0x348578[_0x2b74f5(0x1e9)](_0x50b333);for(const _0x4458f7 of _0x348578){console[_0x2b74f5(0x23e)](formatJourneyItem(_0x4458f7,'',_0x4ba440(_0x4458f7['id'])));}const _0x495bbe=[..._0x4be70d['entries']()][_0x2b74f5(0x1e9)]((_0x4c0d3d,_0x4934c8)=>{const _0x47ec48=_0x2b74f5,_0x4a7b07=_0x556fb5['get'](_0x4c0d3d[0x0])||_0x4c0d3d[0x0],_0x12f7a2=_0x556fb5[_0x47ec48(0x2a0)](_0x4934c8[0x0])||_0x4934c8[0x0];return _0x4a7b07[_0x47ec48(0x260)](_0x12f7a2,undefined,{'sensitivity':_0x47ec48(0x1f4)});});for(const [_0x2bbff2,_0x11e895]of _0x495bbe){const _0x10777c=_0x556fb5[_0x2b74f5(0x2a0)](_0x2bbff2)||_0x2bbff2;console[_0x2b74f5(0x23e)]('📁\x20'+_0x10777c),_0x11e895[_0x2b74f5(0x1e9)](_0x50b333);for(const _0x22d667 of _0x11e895){console[_0x2b74f5(0x23e)](formatJourneyItem(_0x22d667,'\x20\x20',_0x4ba440(_0x22d667['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a22_0x54fb49(0x2b5)]=a22_0x54fb49(0x1bc);[a22_0x54fb49(0x1d7)]=a22_0x54fb49(0x2b7);async['execute'](_0x2cb409){const _0x5d0dfa=a22_0x54fb49,{options:_0x3259db,args:_0x4bd742,tdx:_0x490545}=_0x2cb409,_0xcf6795=_0x4bd742[0x0];if(!_0xcf6795)return console[_0x5d0dfa(0x227)](_0x5d0dfa(0x1b5)),console[_0x5d0dfa(0x227)](_0x5d0dfa(0x2af)),console[_0x5d0dfa(0x227)](_0x5d0dfa(0x21b)),console[_0x5d0dfa(0x227)](_0x5d0dfa(0x23b)),0x1;_0x3259db[_0x5d0dfa(0x252)]&&console[_0x5d0dfa(0x227)](_0x5d0dfa(0x1e4)+_0xcf6795);const {journeyId:_0x4b06bb,parentSegmentId:_0x15e6cd}=await resolveJourneyIdFromInput(_0xcf6795,_0x3259db,_0x490545);if(_0x3259db['web']){const _0x290b13=getConsoleNextUrl(_0x3259db[_0x5d0dfa(0x21d)],'/app/ps/'+_0x15e6cd+_0x5d0dfa(0x203)+_0x4b06bb+_0x5d0dfa(0x26a));return console['error'](a22_0x22ee6a['green']('✔')+'\x20Opening\x20'+a22_0x22ee6a['cyan'](_0x290b13)),openBrowser(_0x290b13),0x0;}const _0x8ced44=await withSpinner(_0x5d0dfa(0x1f1),()=>_0x490545[_0x5d0dfa(0x1cd)][_0x5d0dfa(0x25c)](_0x4b06bb),{'verbose':_0x3259db[_0x5d0dfa(0x252)]}),_0x5ad0b1=_0x8ced44['data'],_0x323efd=_0x3259db[_0x5d0dfa(0x225)];let _0x259192;if(_0x323efd)try{const _0x84e03=await withSpinner(_0x5d0dfa(0x1da),()=>_0x490545[_0x5d0dfa(0x1cd)][_0x5d0dfa(0x1fb)](_0x4b06bb),{'verbose':_0x3259db[_0x5d0dfa(0x252)]});_0x259192=_0x84e03[_0x5d0dfa(0x28e)];}catch{_0x3259db['verbose']&&console[_0x5d0dfa(0x227)](_0x5d0dfa(0x23f));}const _0x2ecb02=getConsoleNextUrl(_0x3259db[_0x5d0dfa(0x21d)],_0x5d0dfa(0x248)+_0x15e6cd+_0x5d0dfa(0x203)+_0x4b06bb+_0x5d0dfa(0x26a)),_0x5d1320={'id':_0x5ad0b1['id'],'name':_0x5ad0b1[_0x5d0dfa(0x1f5)][_0x5d0dfa(0x2b5)],'description':_0x5ad0b1['attributes']['description'],'state':_0x5ad0b1[_0x5d0dfa(0x1f5)][_0x5d0dfa(0x1f0)],'paused':_0x5ad0b1[_0x5d0dfa(0x1f5)][_0x5d0dfa(0x272)],'reentry_mode':_0x5ad0b1[_0x5d0dfa(0x1f5)]['reentryMode'],'stages':_0x5ad0b1['attributes'][_0x5d0dfa(0x1ec)]?.[_0x5d0dfa(0x259)]||0x0,..._0x5ad0b1[_0x5d0dfa(0x1f5)][_0x5d0dfa(0x206)]&&{'goal':_0x5ad0b1['attributes'][_0x5d0dfa(0x206)][_0x5d0dfa(0x2b5)]},..._0x259192&&{'statistics':{'size':_0x259192[_0x5d0dfa(0x2a3)],'entered':_0x259192[_0x5d0dfa(0x1e3)],'goal_achieved':_0x259192[_0x5d0dfa(0x221)],'completion_rate':_0x259192[_0x5d0dfa(0x242)],'exit_or_jump':_0x259192[_0x5d0dfa(0x26e)],'exit_or_jump_rate':_0x259192['exitOrJumpRate'],'stages':_0x259192[_0x5d0dfa(0x214)]}},'url':_0x2ecb02};return await handleSingleObjectOutput(_0x5d1320,_0x3259db),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a22_0x54fb49(0x2b5)]=a22_0x54fb49(0x25f);[a22_0x54fb49(0x1d7)]=a22_0x54fb49(0x1fd);async[a22_0x54fb49(0x1cb)](_0x525423){const _0x4c5645=a22_0x54fb49,{options:_0x1959ba,args:_0x5b1c85,tdx:_0x27e173}=_0x525423,_0x1c89f2=_0x5b1c85[0x0];if(!requireNameOrPath(_0x1c89f2))return 0x1;_0x1959ba[_0x4c5645(0x252)]&&console['error'](_0x4c5645(0x1e4)+_0x1c89f2);const _0x18e78a=_0x1959ba,_0x31164a=_0x18e78a[_0x4c5645(0x20d)],_0x46f93b=_0x18e78a['to'],_0x3b853e=_0x18e78a[_0x4c5645(0x29c)],_0x17f64c=_0x18e78a['stage'];_0x3b853e&&!_0x31164a&&!_0x46f93b&&console[_0x4c5645(0x227)](_0x4c5645(0x29f));const _0x3ad23f=_0x3b853e?withJsonFormat(_0x1959ba):_0x1959ba,{journeyId:_0x33ba1f,journeyName:_0x1f2cdc}=await resolveJourneyIdFromInput(_0x1c89f2,_0x3ad23f,_0x27e173),_0x2fb89f=_0x31164a||_0x46f93b?{'from':_0x31164a,'to':_0x46f93b}:undefined,_0x40ba4d=await withSpinner(_0x4c5645(0x1da),()=>Promise[_0x4c5645(0x253)]([_0x27e173[_0x4c5645(0x1cd)][_0x4c5645(0x25c)](_0x33ba1f),_0x27e173[_0x4c5645(0x1cd)][_0x4c5645(0x1fb)](_0x33ba1f,_0x2fb89f)]),{'verbose':_0x3ad23f[_0x4c5645(0x252)]}),[_0x290a2b,_0x2813c2]=_0x40ba4d[_0x4c5645(0x28e)];if(!_0x2813c2||_0x2813c2[_0x4c5645(0x222)]===null)return console[_0x4c5645(0x227)]('No\x20statistics\x20available\x20for\x20journey:\x20'+_0x1f2cdc),console[_0x4c5645(0x227)](_0x4c5645(0x29e)),0x0;const _0x2416bd=buildStageNameMap(_0x290a2b),_0x45af28=!!(_0x2fb89f&&_0x2813c2[_0x4c5645(0x296)]?.[_0x4c5645(0x259)]),_0x4cc930={'stageNameMap':_0x2416bd,'hasPeriod':_0x45af28,'includeHistory':!!_0x3b853e};if(_0x17f64c&&_0x2813c2[_0x4c5645(0x214)]){const _0x2edc78=_0x2813c2[_0x4c5645(0x214)][_0x4c5645(0x1ba)](_0x1f23cf=>{const _0x436e98=_0x4c5645,_0x4e4ff7=_0x2416bd[_0x436e98(0x2a0)](_0x1f23cf['id'])??'';return _0x4e4ff7[_0x436e98(0x21a)]()===_0x17f64c['toLowerCase']();});if(_0x2edc78)return await handleSingleObjectOutput(formatStageStats(_0x2edc78,_0x4cc930),_0x3ad23f),0x0;const _0x4e92d0=_0x2813c2[_0x4c5645(0x214)]['map'](_0x3e916a=>_0x2416bd[_0x4c5645(0x2a0)](_0x3e916a['id'])??_0x3e916a['id']);return console['error'](_0x4c5645(0x29a)+_0x17f64c+_0x4c5645(0x1c7)),console['error'](_0x4c5645(0x21c)+_0x4e92d0['join'](',\x20')),0x1;}const _0x73d534=_0x2813c2['stages']?.[_0x4c5645(0x271)](_0x209708=>formatStageStats(_0x209708,_0x4cc930)),_0xb63a28=assembleJourneyStats(_0x2813c2,{'from':_0x31164a,'to':_0x46f93b,'includeHistory':_0x3b853e});return await this[_0x4c5645(0x26c)](_0xb63a28,_0x73d534??[],_0x3ad23f),0x0;}async[a22_0x54fb49(0x26c)](_0x41b65e,_0x22e3ff,_0x3c30bc){const _0x291994=a22_0x54fb49,_0xa6467d=_0x3c30bc[_0x291994(0x2b3)]===_0x291994(0x1ee)||_0x3c30bc[_0x291994(0x2b3)]===_0x291994(0x247)||_0x3c30bc[_0x291994(0x1ee)]||_0x3c30bc['jsonl'];if(_0xa6467d){_0x41b65e[_0x291994(0x214)]=_0x22e3ff,await handleSingleObjectOutput(_0x41b65e,_0x3c30bc);return;}await handleSingleObjectOutput(_0x41b65e,_0x3c30bc);for(const _0x2199a3 of _0x22e3ff){console[_0x291994(0x23e)](''),console[_0x291994(0x23e)](String(a22_0x22ee6a[_0x291994(0x287)]['bold']('['+_0x2199a3[_0x291994(0x2b5)]+']'))+a22_0x22ee6a[_0x291994(0x224)]('\x20'+_0x2199a3['id']));const {id:_0x28ed9b,name:_0x3071f3,..._0x136833}=_0x2199a3;await handleSingleObjectOutput(_0x136833,_0x3c30bc);}}}export class JourneyTrafficCommand extends BaseCommand{[a22_0x54fb49(0x2b5)]=a22_0x54fb49(0x1cf);[a22_0x54fb49(0x1d7)]='Get\x20journey\x20traffic\x20data\x20(Sankey\x20charts)';async[a22_0x54fb49(0x1cb)](_0x295116){const _0x4b57ab=a22_0x54fb49,{options:_0x5c3f9f,args:_0x322dd1,tdx:_0x2b6a92}=_0x295116,_0x1f0d10=_0x322dd1[0x0];if(!requireNameOrPath(_0x1f0d10))return 0x1;_0x5c3f9f[_0x4b57ab(0x252)]&&console[_0x4b57ab(0x227)](_0x4b57ab(0x1e4)+_0x1f0d10);const _0x3c406b=_0x5c3f9f,_0x284475=_0x3c406b['type'],_0x1c3347=_0x3c406b[_0x4b57ab(0x20d)],_0xdf2e11=_0x3c406b['to'],_0x5a92a8=_0x3c406b[_0x4b57ab(0x24a)];if(_0x284475&&_0x284475!==_0x4b57ab(0x1be)&&_0x284475!==_0x4b57ab(0x244))return console[_0x4b57ab(0x227)]('Error:\x20Invalid\x20--type\x20\x22'+_0x284475+_0x4b57ab(0x238)),0x1;const _0x45dd66=withJsonFormat(_0x5c3f9f),{journeyId:_0x27c8ac,journeyName:_0x42d37a}=await resolveJourneyIdFromInput(_0x1f0d10,_0x45dd66,_0x2b6a92),_0x3a86af={'type':_0x284475,'from':_0x1c3347,'to':_0xdf2e11,'limit':_0x5a92a8},_0x49540a=await withSpinner(_0x4b57ab(0x28a),()=>_0x2b6a92[_0x4b57ab(0x1cd)][_0x4b57ab(0x292)](_0x27c8ac,_0x3a86af),{'verbose':_0x45dd66[_0x4b57ab(0x252)]}),_0x3edae9=_0x49540a['data'],_0x261864=_0x3edae9['conversion']&&(_0x3edae9['conversion'][_0x4b57ab(0x249)][_0x4b57ab(0x259)]>0x0||_0x3edae9[_0x4b57ab(0x1be)]['links'][_0x4b57ab(0x259)]>0x0),_0x16c8af=_0x3edae9[_0x4b57ab(0x244)]&&_0x3edae9[_0x4b57ab(0x244)]['length']>0x0;if(!_0x261864&&!_0x16c8af)return console[_0x4b57ab(0x227)]('No\x20traffic\x20data\x20available\x20for\x20journey:\x20'+_0x42d37a),console['error']('Traffic\x20data\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.'),_0x1c3347&&_0xdf2e11&&console[_0x4b57ab(0x227)](_0x4b57ab(0x27c)),0x0;return await handleSingleObjectOutput(_0x3edae9,_0x45dd66),0x0;}}function formatStageStats(_0x5b7dd6,_0x2480bb){const _0x3c65f0=a22_0x54fb49,_0x585d22=_0x2480bb[_0x3c65f0(0x239)]&&_0x5b7dd6['history']?.['length']?aggregateStageHistory(_0x5b7dd6[_0x3c65f0(0x296)]):{'size':_0x5b7dd6[_0x3c65f0(0x2a3)],'entered':_0x5b7dd6[_0x3c65f0(0x1e3)],'milestone':_0x5b7dd6[_0x3c65f0(0x22f)],'milestone_rate':_0x5b7dd6['completeMilestoneRate'],'exit_or_jump':_0x5b7dd6[_0x3c65f0(0x26e)],'exit_or_jump_rate':_0x5b7dd6[_0x3c65f0(0x27d)]},_0x2fa20a={'id':_0x5b7dd6['id'],'name':_0x2480bb[_0x3c65f0(0x28d)][_0x3c65f0(0x2a0)](_0x5b7dd6['id'])??_0x5b7dd6['id'],..._0x585d22};return _0x2480bb['hasPeriod']&&_0x2480bb[_0x3c65f0(0x29c)]&&_0x5b7dd6[_0x3c65f0(0x296)]&&(_0x2fa20a[_0x3c65f0(0x296)]=_0x5b7dd6[_0x3c65f0(0x296)]),_0x2fa20a;}export class JourneyPauseCommand extends BaseCommand{[a22_0x54fb49(0x2b5)]=a22_0x54fb49(0x1ff);[a22_0x54fb49(0x1d7)]=a22_0x54fb49(0x298);async[a22_0x54fb49(0x1cb)](_0x3e6c98){const _0x41dbb9=a22_0x54fb49,{options:_0x570c12,args:_0x4b6dd4,tdx:_0x3ff64e}=_0x3e6c98,_0x52cf30=_0x4b6dd4[0x0];if(!requireNameOrPath(_0x52cf30))return 0x1;_0x570c12[_0x41dbb9(0x252)]&&console[_0x41dbb9(0x227)](_0x41dbb9(0x1e4)+_0x52cf30);const {journeyId:_0x40fa27,journeyName:_0xf1cb84}=await resolveJourneyIdFromInput(_0x52cf30,_0x570c12,_0x3ff64e);if(!_0x570c12['yes']){const _0x2eeafb=await confirm(_0x41dbb9(0x278)+_0xf1cb84+'\x22?');if(!_0x2eeafb)return console['error'](_0x41dbb9(0x269)),0x0;}const _0x3d8e28=await withSpinner(_0x41dbb9(0x23a),()=>_0x3ff64e[_0x41dbb9(0x1cd)][_0x41dbb9(0x1e5)](_0x40fa27),{'verbose':_0x570c12[_0x41dbb9(0x252)]}),_0x5a2666=_0x3d8e28['data'];return console[_0x41dbb9(0x227)](_0x41dbb9(0x265)+_0x5a2666['attributes']['name']+'\x22\x20paused'),0x0;}}function a22_0x5170(_0x885f31,_0x2a5ce7){_0x885f31=_0x885f31-0x1b3;const _0x442ea9=a22_0x442e();let _0x517086=_0x442ea9[_0x885f31];return _0x517086;}export class JourneyResumeCommand extends BaseCommand{[a22_0x54fb49(0x2b5)]='journey:resume';[a22_0x54fb49(0x1d7)]=a22_0x54fb49(0x28f);async[a22_0x54fb49(0x1cb)](_0x177087){const _0x484fd9=a22_0x54fb49,{options:_0x1c7f57,args:_0x10250c,tdx:_0x107c0b}=_0x177087,_0x2f49de=_0x10250c[0x0];if(!requireNameOrPath(_0x2f49de))return 0x1;_0x1c7f57['verbose']&&console[_0x484fd9(0x227)](_0x484fd9(0x1e4)+_0x2f49de);const {journeyId:_0x2a3093,journeyName:_0x2edde6}=await resolveJourneyIdFromInput(_0x2f49de,_0x1c7f57,_0x107c0b);if(!_0x1c7f57[_0x484fd9(0x254)]){const _0x4df230=await confirm(_0x484fd9(0x20c)+_0x2edde6+'\x22?');if(!_0x4df230)return console[_0x484fd9(0x227)](_0x484fd9(0x269)),0x0;}const _0x1318aa=await withSpinner('Resuming\x20journey...',()=>_0x107c0b[_0x484fd9(0x1cd)][_0x484fd9(0x1f3)](_0x2a3093),{'verbose':_0x1c7f57[_0x484fd9(0x252)]}),_0x374d8f=_0x1318aa[_0x484fd9(0x28e)];return console[_0x484fd9(0x227)](_0x484fd9(0x265)+_0x374d8f[_0x484fd9(0x1f5)][_0x484fd9(0x2b5)]+'\x22\x20resumed'),0x0;}}export class JourneyPullCommand extends BaseCommand{['name']=a22_0x54fb49(0x299);[a22_0x54fb49(0x1d7)]=a22_0x54fb49(0x290);async[a22_0x54fb49(0x1cb)](_0x364f37){const _0x45e3b2=a22_0x54fb49,{options:_0x274e6e,args:_0x578d1f,tdx:_0x3327e3}=_0x364f37,_0x2eeef3=_0x274e6e,_0x42dff3=_0x578d1f[0x0],_0x2f8a2c=_0x42dff3&&isYamlFilePath(_0x42dff3),_0x5b926e=await resolveTarget({'arg':_0x2f8a2c?_0x42dff3:undefined,'contextParent':_0x274e6e[_0x45e3b2(0x1b7)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x5b926e))return _0x5b926e[_0x45e3b2(0x236)]===_0x45e3b2(0x208)?(console[_0x45e3b2(0x227)](a22_0x22ee6a['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x45e3b2(0x227)]('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[_0x45e3b2(0x227)](_0x45e3b2(0x250)),console[_0x45e3b2(0x227)](_0x45e3b2(0x261)),console[_0x45e3b2(0x227)](_0x45e3b2(0x26d))):(console[_0x45e3b2(0x227)](a22_0x22ee6a['red'](_0x45e3b2(0x1df)+_0x5b926e[_0x45e3b2(0x2b6)]+'\x0a')),_0x5b926e[_0x45e3b2(0x20b)]&&console[_0x45e3b2(0x227)](a22_0x22ee6a[_0x45e3b2(0x287)](_0x5b926e['helpText']))),0x1;let _0x290d8c=_0x2f8a2c?undefined:_0x42dff3,_0xc92995,_0x4c2cf2;_0x5b926e[_0x45e3b2(0x2a8)]===_0x45e3b2(0x1f2)&&(_0x290d8c=_0x5b926e[_0x45e3b2(0x237)],_0xc92995=_0x5b926e['filePath'],_0x4c2cf2=_0x5b926e['folderPath']);const _0x1a9c2d=_0x5b926e[_0x45e3b2(0x23d)],_0x44241e=_0x5b926e[_0x45e3b2(0x220)];_0x2eeef3[_0x45e3b2(0x252)]&&(console[_0x45e3b2(0x227)](_0x45e3b2(0x1de)+_0x1a9c2d),console[_0x45e3b2(0x227)](_0x45e3b2(0x235)+_0x44241e),_0x290d8c&&console['error'](_0x45e3b2(0x2b2)+_0x290d8c),_0xc92995&&console['error'](_0x45e3b2(0x201)+_0xc92995),_0x4c2cf2&&console[_0x45e3b2(0x227)](_0x45e3b2(0x283)+_0x4c2cf2));const _0x3a4d14=await withSpinner(_0x45e3b2(0x1e1),()=>_0x3327e3['segment'][_0x45e3b2(0x1f6)](_0x1a9c2d),{'verbose':_0x274e6e[_0x45e3b2(0x252)]}),_0xf2b909=_0x3a4d14[_0x45e3b2(0x28e)],{journeys:_0x268a31,folders:_0x5189de}=await withSpinner(_0x45e3b2(0x24d),async()=>{const _0x2119d6=_0x45e3b2,[_0x3d53b1,_0x32f446]=await Promise['all']([_0x3327e3[_0x2119d6(0x1cd)][_0x2119d6(0x27b)](_0xf2b909,undefined,{'includeAllVersions':!![]}),_0x3327e3['segment'][_0x2119d6(0x1e7)](_0xf2b909)]);return{'journeys':_0x3d53b1,'folders':_0x32f446};},{'verbose':_0x274e6e[_0x45e3b2(0x252)]})[_0x45e3b2(0x1b4)](_0x21e62a=>_0x21e62a[_0x45e3b2(0x28e)]);let _0x41674f=_0x268a31;const _0x5d4402=buildFolderIdToPathMap(_0x5189de);if(_0x290d8c){const _0x53c533=_0x41674f[_0x45e3b2(0x231)](_0x11d73a=>_0x11d73a[_0x45e3b2(0x1bb)]['toLowerCase']()===_0x290d8c[_0x45e3b2(0x21a)]());if(_0x53c533['length']===0x0)return console[_0x45e3b2(0x227)](_0x45e3b2(0x289)+_0x290d8c),console[_0x45e3b2(0x227)](_0x45e3b2(0x2aa)),0x1;_0x41674f=_0x53c533;}if(_0x4c2cf2!==undefined){const _0x38781d=_0x41674f['filter'](_0x4f7f70=>{const _0x5947b9=_0x45e3b2,_0x18e0e1=_0x4f7f70[_0x5947b9(0x25b)]?_0x5d4402[_0x5947b9(0x2a0)](_0x4f7f70[_0x5947b9(0x25b)])||'':'';return _0x18e0e1===_0x4c2cf2;});if(_0x38781d[_0x45e3b2(0x259)]===0x0&&_0x41674f[_0x45e3b2(0x259)]>0x0){console[_0x45e3b2(0x227)]('Error:\x20Journey\x20\x27'+_0x290d8c+_0x45e3b2(0x1c1)+(_0x4c2cf2||'root\x20folder')),console[_0x45e3b2(0x227)](_0x45e3b2(0x1b3));for(const _0x39bd7d of _0x41674f){const _0x167281=_0x39bd7d[_0x45e3b2(0x25b)]?_0x5d4402[_0x45e3b2(0x2a0)](_0x39bd7d[_0x45e3b2(0x25b)])||'':'';console[_0x45e3b2(0x227)]('\x20\x20-\x20'+(_0x167281||_0x45e3b2(0x246))+'/'+_0x39bd7d[_0x45e3b2(0x1bb)]);}return 0x1;}_0x41674f=_0x38781d;}if(_0x41674f[_0x45e3b2(0x259)]===0x0)return console['error'](_0x45e3b2(0x1f7)),0x0;const _0x5663ef=new Map();for(const _0x5511c6 of _0x41674f){const _0x169cc3=_0x5511c6[_0x45e3b2(0x293)];!_0x5663ef[_0x45e3b2(0x1c2)](_0x169cc3)&&_0x5663ef[_0x45e3b2(0x288)](_0x169cc3,[]),_0x5663ef[_0x45e3b2(0x2a0)](_0x169cc3)[_0x45e3b2(0x25d)](_0x5511c6);}for(const _0xcf7d74 of _0x5663ef[_0x45e3b2(0x1d0)]()){_0xcf7d74[_0x45e3b2(0x1e9)]((_0x2d060f,_0x2ef3f3)=>(_0x2d060f[_0x45e3b2(0x228)]||0x0)-(_0x2ef3f3[_0x45e3b2(0x228)]||0x0));}const _0x417348=[],{idToEmailMap:_0x64bf01,connectionIdToNameMap:_0x5c95bc}=await withSpinner(_0x45e3b2(0x1e6),async()=>{const _0x5856ea=_0x45e3b2,[_0x33ac0a,_0x33a594]=await Promise[_0x5856ea(0x253)]([_0x3327e3[_0x5856ea(0x219)][_0x5856ea(0x22b)](),_0x3327e3[_0x5856ea(0x29d)][_0x5856ea(0x279)]()]);return{'idToEmailMap':_0x33ac0a,'connectionIdToNameMap':_0x33a594};},{'verbose':_0x274e6e[_0x45e3b2(0x252)]})[_0x45e3b2(0x1b4)](_0xedd3d6=>_0xedd3d6['data']);for(const _0x55383b of _0x5663ef['values']()){const _0x1632ed=_0x55383b[0x0][_0x45e3b2(0x1bb)],_0x30e33c=_0x55383b[0x0][_0x45e3b2(0x25b)],_0x1bf1da=_0x30e33c?_0x5d4402[_0x45e3b2(0x2a0)](_0x30e33c)||'':'',_0x114ced=_0x1bf1da?a22_0x1a2b3d[_0x45e3b2(0x29b)](_0x44241e,_0x1bf1da):_0x44241e,_0x4ad232=_0xc92995||a22_0x1a2b3d[_0x45e3b2(0x29b)](_0x114ced,sanitizeFileName(_0x1632ed)+_0x45e3b2(0x1c5));let _0xaa782d,_0x361b2e;if(existsSync(_0x4ad232))try{const _0x40a926=readFileSync(_0x4ad232,'utf-8'),_0x305ffe=parseYamlString(_0x40a926);_0x361b2e=_0x305ffe,_0xaa782d=buildRuleToNameMapping(_0x305ffe),_0x2eeef3[_0x45e3b2(0x252)]&&_0xaa782d[_0x45e3b2(0x2a3)]>0x0&&console['error']('Found\x20'+_0xaa782d[_0x45e3b2(0x2a3)]+_0x45e3b2(0x294)+_0x1632ed);}catch(_0x284a22){_0x2eeef3[_0x45e3b2(0x252)]&&console[_0x45e3b2(0x227)](_0x45e3b2(0x1ca)+_0x284a22[_0x45e3b2(0x2b6)]);}const _0xc1c42=[],_0x1ae2cd=new Set(),_0x1cf9b8=new Map(),_0x24bb86=new Map(),_0x210f10=new Set(),_0x50d761=new Map(),_0x4a86d4=new Map(),_0x2f4f5c=createJumpTargetCache();await withProgressSpinner('Fetching\x20'+_0x1632ed+_0x45e3b2(0x28b),async _0x56dcab=>{const _0x5c4bd1=_0x45e3b2;for(const _0x27b06d of _0x55383b){const _0x1e3f46=_0x55383b[_0x5c4bd1(0x259)]>0x1?_0x27b06d[_0x5c4bd1(0x1bb)]+'\x20v'+(_0x27b06d[_0x5c4bd1(0x228)]||0x1):_0x27b06d['journeyBundleName'];_0x56dcab[_0x5c4bd1(0x1bd)](_0x5c4bd1(0x207)+_0x1e3f46);const _0x52938f=await _0x3327e3[_0x5c4bd1(0x1cd)][_0x5c4bd1(0x25c)](_0x27b06d['id']),_0x2822e6=_0x52938f[_0x5c4bd1(0x1f5)]?.['audienceId'],_0x54cbd0={'resolveSegment':async _0xbac87e=>{const _0x1ec70a=_0x5c4bd1;if(!_0x2822e6)return{'name':_0xbac87e,'isJourneyLocal':![]};const _0x22395d=_0x1cf9b8[_0x1ec70a(0x2a0)](_0xbac87e);if(_0x22395d)return _0x22395d;try{const _0x3a60dc=await _0x3327e3[_0x1ec70a(0x20a)]['getSegment'](_0x2822e6,_0xbac87e),_0x1ea063=_0x3a60dc['kind']===SEGMENT_KIND_JOURNEY;let _0xb08e24,_0x2d1d84=_0x3a60dc[_0x1ec70a(0x2b5)];if(_0x1ea063&&_0x3a60dc[_0x1ec70a(0x243)]){const _0x7628f3=await segmentResponseToDef(_0x3a60dc,{'resolveSegmentName':async _0x471388=>{const _0x128f31=_0x1ec70a,_0x53a113=_0x1cf9b8[_0x128f31(0x2a0)](_0x471388);if(_0x53a113)return _0x53a113['name'];const _0x13e8d7=await _0x54cbd0[_0x128f31(0x1dd)](_0x471388);return _0x13e8d7[_0x128f31(0x2b5)];}}),_0xeb76d2=_0x7628f3[_0x1ec70a(0x243)];_0xb08e24={'description':_0x3a60dc[_0x1ec70a(0x1d7)],'rule':_0xeb76d2};const _0x278581=serializeRule(_0xeb76d2),_0x471e6e=_0x24bb86[_0x1ec70a(0x2a0)](_0x278581);if(_0x471e6e)_0x2d1d84=_0x471e6e,_0xb08e24=undefined,_0x2eeef3['verbose']&&console[_0x1ec70a(0x227)](_0x1ec70a(0x245)+_0x3a60dc['name']+_0x1ec70a(0x2b9)+_0x471e6e);else{let _0x6ffb64=![];if(_0xaa782d){const _0x5baaf4=_0xaa782d['get'](_0x278581);if(_0x5baaf4){const _0x168306=_0x5baaf4[_0x1ec70a(0x1ba)](_0x4987be=>!_0x1ae2cd[_0x1ec70a(0x1c2)](_0x4987be));_0x168306&&(_0x2d1d84=_0x168306,_0x1ae2cd[_0x1ec70a(0x2ac)](_0x168306),_0x24bb86[_0x1ec70a(0x288)](_0x278581,_0x168306),_0x6ffb64=!![],_0x2eeef3[_0x1ec70a(0x252)]&&console[_0x1ec70a(0x227)](_0x1ec70a(0x275)+_0x168306+_0x1ec70a(0x24e)));}}if(!_0x6ffb64){const _0x32d318=generateJourneyLocalName(_0x3a60dc['name']);_0x32d318&&(_0x2d1d84=_0x32d318);let _0x52e1ca=_0x2d1d84,_0xdd7abf=0x2;while(_0x1ae2cd['has'](_0x52e1ca)){_0x52e1ca=_0x2d1d84+'_'+_0xdd7abf,_0xdd7abf++;}_0x1ae2cd[_0x1ec70a(0x2ac)](_0x52e1ca),_0x24bb86[_0x1ec70a(0x288)](_0x278581,_0x52e1ca),_0x2d1d84=_0x52e1ca;}}}const _0x396fef={'name':_0x2d1d84,'isJourneyLocal':_0x1ea063,'definition':_0xb08e24};return _0x1cf9b8[_0x1ec70a(0x288)](_0xbac87e,_0x396fef),_0x396fef;}catch(_0x2ce76d){return _0x274e6e[_0x1ec70a(0x252)]&&console[_0x1ec70a(0x227)](_0x1ec70a(0x210)+_0xbac87e+':\x20'+_0x2ce76d[_0x1ec70a(0x2b6)]),{'name':_0xbac87e,'isJourneyLocal':![]};}},'resolveActivation':async _0x11b3c8=>{const _0x5a37ae=_0x5c4bd1,_0x363178=_0x50d761[_0x5a37ae(0x2a0)](_0x11b3c8);if(_0x363178)return _0x363178;try{const _0x2de21f=await _0x3327e3[_0x5a37ae(0x1cd)][_0x5a37ae(0x1eb)](_0x27b06d['id'],_0x11b3c8),_0x494ab7=journeyActivationStepToYaml(_0x2de21f,_0x64bf01,_0x5c95bc),_0x3821bf=JSON[_0x5a37ae(0x284)]({'name':_0x494ab7[_0x5a37ae(0x2b5)],'connection':_0x494ab7[_0x5a37ae(0x29d)],'connector_config':_0x494ab7['connector_config']}),_0x24bed8=_0x4a86d4[_0x5a37ae(0x2a0)](_0x3821bf);if(_0x24bed8){const _0x104d8f={'name':_0x24bed8,'isJourneyLocal':!![],'definition':_0x494ab7};return _0x50d761[_0x5a37ae(0x288)](_0x11b3c8,_0x104d8f),_0x104d8f;}const _0x7fdb94=_0x2de21f['attributes'][_0x5a37ae(0x211)]['name']||_0x11b3c8,_0xc0ee52=sanitizeYamlKey(_0x7fdb94)||'activation_'+_0x11b3c8;let _0x4f76ad=_0xc0ee52,_0x46ac8c=0x2;while(_0x210f10[_0x5a37ae(0x1c2)](_0x4f76ad)){_0x4f76ad=_0xc0ee52+'_'+_0x46ac8c,_0x46ac8c++;}_0x210f10[_0x5a37ae(0x2ac)](_0x4f76ad),_0x4a86d4[_0x5a37ae(0x288)](_0x3821bf,_0x4f76ad);const _0x40eede={'name':_0x4f76ad,'isJourneyLocal':!![],'definition':_0x494ab7};return _0x50d761['set'](_0x11b3c8,_0x40eede),_0x40eede;}catch(_0x4a05bb){return _0x274e6e[_0x5a37ae(0x252)]&&console[_0x5a37ae(0x227)](_0x5a37ae(0x276)+_0x11b3c8+':\x20'+_0x4a05bb[_0x5a37ae(0x2b6)]),{'name':_0x11b3c8,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x311d6f,_0x40a5f8)=>{const _0x135818=_0x5c4bd1;return resolveJumpTarget(_0x311d6f,_0x40a5f8,_0x2f4f5c,_0x30f6eb=>_0x3327e3['journey'][_0x135818(0x25c)](_0x30f6eb));}},_0x5343d0=await journeyResponseToDef(_0x52938f,_0x54cbd0);_0xc1c42[_0x5c4bd1(0x25d)]({'item':_0x27b06d,'yaml':_0x5343d0});}},{'verbose':_0x274e6e[_0x45e3b2(0x252)]});const _0x15d51d=buildMergedJourneyDef(_0xc1c42,_0xaa782d),_0x4bc0d4=normalizeJourneyDef(_0x15d51d,_0x361b2e),_0x4ec9ce=toYamlString(_0x4bc0d4),_0x2fa659=_0xc92995||a22_0x1a2b3d[_0x45e3b2(0x29b)](_0x114ced,sanitizeFileName(_0x1632ed)+'.yml');!_0xc92995&&_0x1bf1da&&!existsSync(_0x114ced)&&mkdirSync(_0x114ced,{'recursive':!![]});const _0x5c3869=a22_0x1a2b3d['relative'](process[_0x45e3b2(0x2a9)](),_0x2fa659);if(existsSync(_0x2fa659)){const _0x5917b3=readFileSync(_0x2fa659,_0x45e3b2(0x2a2)),_0x25a736=generateDiff(_0x5917b3,_0x4ec9ce),_0x5edbe0=hasChanges(_0x25a736);_0x417348[_0x45e3b2(0x25d)]({'relativePath':_0x5c3869,'absolutePath':_0x2fa659,'content':_0x4ec9ce,'isNew':![],'hasChanges':_0x5edbe0,'diff':_0x5edbe0?formatDiffWithColors(_0x25a736):undefined});}else _0x417348[_0x45e3b2(0x25d)]({'relativePath':_0x5c3869,'absolutePath':_0x2fa659,'content':_0x4ec9ce,'isNew':!![],'hasChanges':![]});}const _0x739bb8=_0x417348[_0x45e3b2(0x231)](_0x592a85=>_0x592a85[_0x45e3b2(0x2a5)]),_0x3c2094=_0x417348[_0x45e3b2(0x231)](_0xf92a7f=>!_0xf92a7f[_0x45e3b2(0x2a5)]&&_0xf92a7f['hasChanges']),_0x5eb9a5=_0x417348['filter'](_0x1c5dce=>!_0x1c5dce[_0x45e3b2(0x2a5)]&&!_0x1c5dce[_0x45e3b2(0x280)]),_0x30b6d5=_0x41674f[_0x45e3b2(0x259)],_0x228840=_0x5663ef[_0x45e3b2(0x2a3)],_0x31c5e6=_0x30b6d5>_0x228840?'\x20('+_0x30b6d5+'\x20versions)':'';console[_0x45e3b2(0x227)]('\x0aPull\x20summary:'),console['error']('\x20\x20'+a22_0x22ee6a[_0x45e3b2(0x287)](_0x228840+'\x20journeys')+a22_0x22ee6a['dim'](_0x31c5e6)),console['error']('\x20\x20'+a22_0x22ee6a['green']('+\x20'+_0x739bb8['length']+_0x45e3b2(0x232))),console[_0x45e3b2(0x227)]('\x20\x20'+a22_0x22ee6a['yellow']('~\x20'+_0x3c2094[_0x45e3b2(0x259)]+_0x45e3b2(0x1c9))),console[_0x45e3b2(0x227)]('\x20\x20'+a22_0x22ee6a[_0x45e3b2(0x224)]('=\x20'+_0x5eb9a5[_0x45e3b2(0x259)]+_0x45e3b2(0x268))),console['error']('\x20\x20Target:\x20'+a22_0x22ee6a[_0x45e3b2(0x287)](_0x44241e)+'\x0a');if(_0x3c2094['length']>0x0)for(const _0x162ab7 of _0x3c2094){console[_0x45e3b2(0x227)](_0x45e3b2(0x286)+_0x162ab7[_0x45e3b2(0x2b1)]+'\x27:'),console['error']('─'[_0x45e3b2(0x1c0)](0x3c)),console['error'](_0x162ab7[_0x45e3b2(0x27f)]),console[_0x45e3b2(0x227)]('─'[_0x45e3b2(0x1c0)](0x3c));}if(_0x2eeef3['dryRun'])return console[_0x45e3b2(0x227)](a22_0x22ee6a[_0x45e3b2(0x217)](_0x45e3b2(0x1d6))),0x0;if(_0x739bb8[_0x45e3b2(0x259)]===0x0&&_0x3c2094[_0x45e3b2(0x259)]===0x0)return console[_0x45e3b2(0x227)](a22_0x22ee6a['green'](_0x45e3b2(0x27e))),saveSessionContext({'parent_segment':_0x1a9c2d},_0x2eeef3[_0x45e3b2(0x26f)]),console[_0x45e3b2(0x227)](a22_0x22ee6a[_0x45e3b2(0x1bf)](_0x45e3b2(0x21f)+a22_0x22ee6a['dim'](_0x45e3b2(0x2b0))+_0x45e3b2(0x1db)+a22_0x22ee6a['cyan'](_0x1a9c2d))),0x0;if(!_0x2eeef3[_0x45e3b2(0x254)]&&(_0x739bb8[_0x45e3b2(0x259)]>0x0||_0x3c2094[_0x45e3b2(0x259)]>0x0)){if(!isInteractive())return console[_0x45e3b2(0x227)](a22_0x22ee6a[_0x45e3b2(0x25e)](_0x45e3b2(0x274)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x45e3b2(0x227)](a22_0x22ee6a[_0x45e3b2(0x224)](_0x45e3b2(0x2b8))),0x1;const _0x244a49=await confirmKey(_0x45e3b2(0x215)+(_0x739bb8[_0x45e3b2(0x259)]+_0x3c2094['length'])+'\x20files?');if(!_0x244a49)return console[_0x45e3b2(0x227)](a22_0x22ee6a['yellow'](_0x45e3b2(0x24f)),_0x45e3b2(0x216)),0x1;}!existsSync(_0x44241e)&&mkdirSync(_0x44241e,{'recursive':!![]});const _0x1e0e77=a22_0x1a2b3d[_0x45e3b2(0x29b)](_0x44241e,_0x45e3b2(0x2a4));writeFileSync(_0x1e0e77,createTdxConfigContent(_0x1a9c2d),'utf-8');for(const _0x258b7e of _0x417348){(_0x258b7e[_0x45e3b2(0x2a5)]||_0x258b7e[_0x45e3b2(0x280)])&&writeFileSync(_0x258b7e['absolutePath'],_0x258b7e[_0x45e3b2(0x256)],_0x45e3b2(0x2a2));}return console[_0x45e3b2(0x227)](a22_0x22ee6a['green'](_0x45e3b2(0x1d5)+(_0x739bb8[_0x45e3b2(0x259)]+_0x3c2094[_0x45e3b2(0x259)])+_0x45e3b2(0x270)+_0x44241e)),saveSessionContext({'parent_segment':_0x1a9c2d},_0x2eeef3['session']),console[_0x45e3b2(0x227)](a22_0x22ee6a[_0x45e3b2(0x1bf)](_0x45e3b2(0x21f)+a22_0x22ee6a[_0x45e3b2(0x224)](_0x45e3b2(0x2b0))+'\x20=\x20'+a22_0x22ee6a[_0x45e3b2(0x287)](_0x1a9c2d))),0x0;}}export class JourneyColumnsCommand extends BaseCommand{['name']=a22_0x54fb49(0x1e2);[a22_0x54fb49(0x1d7)]=a22_0x54fb49(0x21e);async[a22_0x54fb49(0x1cb)](_0x40d615){const _0x310402=a22_0x54fb49,{options:_0x22c0cf,args:_0x52d26e,tdx:_0x1033c2}=_0x40d615,_0x585add=_0x52d26e[0x0];if(!requireNameOrPath(_0x585add))return 0x1;_0x22c0cf['verbose']&&console['error'](_0x310402(0x1e4)+_0x585add);const {journeyId:_0x372680}=await resolveJourneyIdFromInput(_0x585add,_0x22c0cf,_0x1033c2),_0x5462a2=await withSpinner(_0x310402(0x251),()=>_0x1033c2['journey'][_0x310402(0x212)](_0x372680),{'verbose':_0x22c0cf[_0x310402(0x252)]}),_0x14c2a4=_0x5462a2[_0x310402(0x28e)];return console[_0x310402(0x23e)](_0x310402(0x1c3)+_0x14c2a4[_0x310402(0x27a)]),console[_0x310402(0x23e)]('Table:\x20'+_0x14c2a4['table']),await handleSDKOutput(_0x14c2a4['columns'],_0x22c0cf),0x0;}}export class JourneyActivationsCommand extends BaseCommand{[a22_0x54fb49(0x2b5)]=a22_0x54fb49(0x20e);[a22_0x54fb49(0x1d7)]=a22_0x54fb49(0x223);async[a22_0x54fb49(0x1cb)](_0x4fcc18){const _0x55e615=a22_0x54fb49,{options:_0x2ee13e,args:_0x161eab,tdx:_0x4b9de6}=_0x4fcc18,_0x53664d=_0x161eab[0x0];if(!requireNameOrPath(_0x53664d))return 0x1;_0x2ee13e[_0x55e615(0x252)]&&console[_0x55e615(0x227)](_0x55e615(0x1e4)+_0x53664d);const {journeyId:_0x339d76}=await resolveJourneyIdFromInput(_0x53664d,_0x2ee13e,_0x4b9de6),_0x443e36=await withSpinner(_0x55e615(0x1f8),()=>_0x4b9de6[_0x55e615(0x1cd)][_0x55e615(0x1e0)](_0x339d76),{'verbose':_0x2ee13e[_0x55e615(0x252)]}),_0x5e62c2=_0x443e36[_0x55e615(0x28e)];return console[_0x55e615(0x227)]('Found\x20'+_0x5e62c2[_0x55e615(0x259)]+_0x55e615(0x240)+(_0x5e62c2[_0x55e615(0x259)]!==0x1?'s':'')),await handleSDKOutput(_0x5e62c2,_0x2ee13e),0x0;}}export class JourneyPushCommand extends BaseCommand{[a22_0x54fb49(0x2b5)]=a22_0x54fb49(0x22d);[a22_0x54fb49(0x1d7)]=a22_0x54fb49(0x2ab);[a22_0x54fb49(0x295)]=new SegmentPushCommand();async['execute'](_0x24f131){const _0x3b32af=a22_0x54fb49,_0x2ae73c=_0x24f131[_0x3b32af(0x1fe)][0x0];let _0x1ecf17;if(_0x2ae73c){const _0x4f9b96=await resolveTarget({'arg':_0x2ae73c,'contextParent':_0x24f131['options']['parentSegment'],'cwd':process[_0x3b32af(0x2a9)]()});isSuccessfulResolution(_0x4f9b96)&&_0x4f9b96['type']===_0x3b32af(0x1f2)&&(_0x1ecf17=_0x4f9b96['filePath']);}const _0x15f925={..._0x24f131,'options':{..._0x24f131['options'],'journeysOnly':!![],..._0x1ecf17&&{'singleFilePath':_0x1ecf17}}};return this[_0x3b32af(0x295)][_0x3b32af(0x1cb)](_0x15f925);}}export class JourneyVersionsCommand extends BaseCommand{[a22_0x54fb49(0x2b5)]=a22_0x54fb49(0x258);[a22_0x54fb49(0x1d7)]='List\x20all\x20versions\x20of\x20a\x20journey';async['execute'](_0x3066a1){const _0x3e63d5=a22_0x54fb49,{options:_0x4026dd,args:_0x1f77cc,tdx:_0x390bce}=_0x3066a1,_0x52703b=_0x1f77cc[0x0];if(!requireNameOrPath(_0x52703b))return 0x1;if(_0x4026dd[_0x3e63d5(0x252)])console['error'](_0x3e63d5(0x1e4)+_0x52703b);const {journeyId:_0x556be5}=await resolveJourneyIdFromInput(_0x52703b,_0x4026dd,_0x390bce),_0x161138=await withSpinner('Listing\x20journey\x20versions...',()=>_0x390bce[_0x3e63d5(0x1cd)][_0x3e63d5(0x205)](_0x556be5),{'verbose':_0x4026dd[_0x3e63d5(0x252)]}),{bundleName:_0x393dac,versions:_0x421fa3,latestJourneyId:_0x60e5fc}=_0x161138[_0x3e63d5(0x28e)];console[_0x3e63d5(0x227)](_0x393dac+':\x20'+_0x421fa3[_0x3e63d5(0x259)]+_0x3e63d5(0x285)+(_0x421fa3[_0x3e63d5(0x259)]!==0x1?'s':''));const _0x49a444=_0x421fa3[_0x3e63d5(0x271)](_0x5de1c0=>({'version':_0x5de1c0[_0x3e63d5(0x228)],'journey_id':_0x5de1c0[_0x3e63d5(0x222)],'name':_0x5de1c0['name'],'state':_0x5de1c0['state'],'paused':_0x5de1c0[_0x3e63d5(0x272)],'latest':_0x5de1c0[_0x3e63d5(0x222)]===_0x60e5fc,'created_at':_0x5de1c0['createdAt']}));return await handleSDKOutput(_0x49a444,_0x4026dd),0x0;}}export class JourneyVersionCreateCommand extends BaseCommand{['name']=a22_0x54fb49(0x1c8);[a22_0x54fb49(0x1d7)]='Create\x20a\x20new\x20draft\x20version\x20of\x20a\x20journey';async[a22_0x54fb49(0x1cb)](_0x42db52){const _0x29dd21=a22_0x54fb49,{options:_0x5acc55,args:_0x4e81cc,tdx:_0x5b3b20}=_0x42db52,_0x45be32=_0x4e81cc[0x0];if(!requireNameOrPath(_0x45be32))return 0x1;if(_0x5acc55[_0x29dd21(0x252)])console[_0x29dd21(0x227)]('Input:\x20'+_0x45be32);const {journeyId:_0x4c7a96,journeyName:_0x12a0e5}=await resolveJourneyIdFromInput(_0x45be32,_0x5acc55,_0x5b3b20);if(!_0x5acc55[_0x29dd21(0x254)]){const _0x85696c=await confirm('Create\x20a\x20new\x20draft\x20version\x20of\x20journey\x20\x22'+_0x12a0e5+'\x22?');if(!_0x85696c)return console['error'](_0x29dd21(0x269)),0x0;}const _0x68d675=await withSpinner('Creating\x20new\x20version...',()=>_0x5b3b20[_0x29dd21(0x1cd)][_0x29dd21(0x226)](_0x4c7a96),{'verbose':_0x5acc55[_0x29dd21(0x252)]}),_0x12b762=_0x68d675[_0x29dd21(0x28e)];return console[_0x29dd21(0x227)](a22_0x22ee6a['green']('✔')+'\x20Created\x20v'+_0x12b762['attributes'][_0x29dd21(0x228)]+_0x29dd21(0x291)+_0x12b762[_0x29dd21(0x1f5)]['name']+'\x22'),console[_0x29dd21(0x227)](_0x29dd21(0x1e8)+_0x12b762['id']),await handleSingleObjectOutput({'id':_0x12b762['id'],'name':_0x12b762['attributes'][_0x29dd21(0x2b5)],'version':_0x12b762[_0x29dd21(0x1f5)]['versionNumber'],'state':_0x12b762['attributes']['state'],'bundle_id':_0x12b762[_0x29dd21(0x1f5)][_0x29dd21(0x293)],'created_at':_0x12b762[_0x29dd21(0x1f5)]['createdAt']},_0x5acc55),0x0;}}export class JourneyVersionViewCommand extends BaseCommand{[a22_0x54fb49(0x2b5)]=a22_0x54fb49(0x241);[a22_0x54fb49(0x1d7)]=a22_0x54fb49(0x28c);async[a22_0x54fb49(0x1cb)](_0x186816){const _0x449a64=a22_0x54fb49,{options:_0xa70e4f,args:_0x18cac4,tdx:_0x460f32}=_0x186816,_0x18bb3a=_0x18cac4[0x0];if(!requireNameOrPath(_0x18bb3a))return 0x1;const _0x2ebcee=_0xa70e4f['version'];if(!_0x2ebcee)return console[_0x449a64(0x227)]('Error:\x20--version\x20option\x20is\x20required'),console['error']('Usage:\x20journey\x20version\x20view\x20<name-or-path>\x20--version\x20N'),0x1;const _0x29a867=parseInt(_0x2ebcee,0xa);if(isNaN(_0x29a867)||_0x29a867<0x1)return console[_0x449a64(0x227)]('Error:\x20Invalid\x20version\x20number:\x20'+_0x2ebcee),0x1;if(_0xa70e4f[_0x449a64(0x252)])console[_0x449a64(0x227)]('Input:\x20'+_0x18bb3a+',\x20version:\x20'+_0x29a867);const {journeyId:_0x5df0e3,parentSegmentId:_0x11ed7e}=await resolveJourneyIdFromInput(_0x18bb3a,_0xa70e4f,_0x460f32),_0x2af8a1=await withSpinner(_0x449a64(0x233),()=>_0x460f32[_0x449a64(0x1cd)]['listVersions'](_0x5df0e3),{'verbose':_0xa70e4f[_0x449a64(0x252)]}),{versions:_0x4cd7cd,latestJourneyId:_0x452e22}=_0x2af8a1[_0x449a64(0x28e)],_0x12c2b0=_0x4cd7cd[_0x449a64(0x1ba)](_0x21f133=>_0x21f133['versionNumber']===_0x29a867);if(!_0x12c2b0){const _0x312d30=_0x4cd7cd['map'](_0x2e4a8f=>'v'+_0x2e4a8f[_0x449a64(0x228)])[_0x449a64(0x29b)](',\x20');return console[_0x449a64(0x227)](_0x449a64(0x1d9)+_0x29a867+_0x449a64(0x2b4)+_0x312d30),0x1;}const _0x370af0=await withSpinner(_0x449a64(0x297)+_0x29a867+_0x449a64(0x2a7),()=>_0x460f32[_0x449a64(0x1cd)]['getJourney'](_0x12c2b0['journeyId']),{'verbose':_0xa70e4f[_0x449a64(0x252)]}),_0x2a6466=_0x370af0[_0x449a64(0x28e)],_0x1a8f4c=getConsoleNextUrl(_0xa70e4f[_0x449a64(0x21d)],_0x449a64(0x248)+_0x11ed7e+_0x449a64(0x203)+_0x12c2b0['journeyId']+'/j/da/je');return await handleSingleObjectOutput({'id':_0x2a6466['id'],'name':_0x2a6466[_0x449a64(0x1f5)][_0x449a64(0x2b5)],'version':_0x2a6466[_0x449a64(0x1f5)][_0x449a64(0x228)],'description':_0x2a6466['attributes'][_0x449a64(0x1d7)],'state':_0x2a6466['attributes'][_0x449a64(0x1f0)],'paused':_0x2a6466[_0x449a64(0x1f5)]['paused'],'reentry_mode':_0x2a6466[_0x449a64(0x1f5)][_0x449a64(0x23c)],'stages':_0x2a6466[_0x449a64(0x1f5)][_0x449a64(0x1ec)]?.[_0x449a64(0x259)]||0x0,..._0x2a6466[_0x449a64(0x1f5)][_0x449a64(0x206)]&&{'goal':_0x2a6466[_0x449a64(0x1f5)][_0x449a64(0x206)][_0x449a64(0x2b5)]},'latest':_0x12c2b0[_0x449a64(0x222)]===_0x452e22,'created_at':_0x2a6466[_0x449a64(0x1f5)][_0x449a64(0x255)],'updated_at':_0x2a6466[_0x449a64(0x1f5)][_0x449a64(0x263)],'url':_0x1a8f4c},_0xa70e4f),0x0;}}
1
+ const a22_0x9ba4d0=a22_0x8643;(function(_0x27cc67,_0x17dba3){const _0x288539=a22_0x8643,_0x55526e=_0x27cc67();while(!![]){try{const _0x49af8c=parseInt(_0x288539(0x12b))/0x1+parseInt(_0x288539(0x1a7))/0x2+parseInt(_0x288539(0x1be))/0x3+parseInt(_0x288539(0x108))/0x4+parseInt(_0x288539(0x16b))/0x5+parseInt(_0x288539(0xf2))/0x6*(-parseInt(_0x288539(0x109))/0x7)+parseInt(_0x288539(0x1c2))/0x8*(-parseInt(_0x288539(0x144))/0x9);if(_0x49af8c===_0x17dba3)break;else _0x55526e['push'](_0x55526e['shift']());}catch(_0x692404){_0x55526e['push'](_0x55526e['shift']());}}}(a22_0x1bc7,0xcfe43));function a22_0x8643(_0x4725cc,_0x4bcbdc){_0x4725cc=_0x4725cc-0xc2;const _0x1bc764=a22_0x1bc7();let _0x8643ee=_0x1bc764[_0x4725cc];return _0x8643ee;}import a22_0x4d1c63 from'chalk';import a22_0x4530a1 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';function a22_0x1bc7(){const _0x224295=['type','tdx.json','attributes','37050606khOqkx','version','\x20=\x20','journey:stats','Fetching\x20parent\x20segment...','listJourneysWithFolders','folderId','\x20version','Getting\x20column\x20mapping...','✔\x20Journey\x20\x22','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','getParentFull','Error:\x20Parent\x20segment\x20context\x20required','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','dryRun','.yml','Error:\x20Invalid\x20--type\x20\x22','Resolved\x20YAML\x20file:\x20','/e/','hasChanges','Getting\x20journey\x20statistics...','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','error','Error:\x20Stage\x20\x22','Folder\x20path:\x20','If\x20the\x20journey\x20is\x20active,\x20the\x20date\x20range\x20may\x20be\x20too\x20wide.\x20Try\x20a\x20shorter\x20period\x20(max\x20~90\x20days).','rootFolderId','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','journeyBundleName','Input:\x20','session','activation','cyan','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)','\x20->\x20','isNew','stageNameMap','diff','5931015fmjrzm','📁\x20','\x0aPull\x20summary:','includeStats','journey:versions','jsonl','Could\x20not\x20resolve\x20parent\x20segment.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','journey','dim','json','length','completed','getTrafficData','\x20\x20Statistics\x20not\x20available','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Resolving\x20journey...','createdAt','then','journey:traffic','values','size','execute','user','List\x20activations\x20for\x20a\x20journey','join','connector_config','utf-8','journey:columns','(running)','green','Resolving\x20version...','✔\x20Context\x20set:\x20','stage','goal','content','\x20\x20Name:\x20','tsv','Creating\x20new\x20version...','journey:version:view','\x20journey\x20files\x20to\x20','journey:list','No\x20traffic\x20data\x20available\x20for\x20journey:\x20','Write\x20','listJourneysFromParentSegment','Listing\x20journey\x20activations...','Parent\x20segment:\x20','Resume\x20a\x20paused\x20journey','push','getColumnMapping','renderStats','verbose','\x20changed\x20files','journey:activations','absolutePath','relative','List\x20journeys\x20in\x20current\x20context','...','map','targetDir','No\x20journeys\x20found','3236610KSDlVy','Target\x20file:\x20','format','Usage:\x20journey\x20<subcommand>\x20<name-or-path>','\x20\x20Target:\x20','\x0aChanges\x20to\x20\x27','hasPeriod','View\x20a\x20specific\x20version\x20of\x20a\x20journey','\x20journeys','site','message','web','exitOrJumpSize','goalSize','nodes','resolveParentId','parentSegment','filePath','/j/da/je','\x20journey','segment','limit','(paused)','2596218YSURPh','history','Warning:\x20Could\x20not\x20resolve\x20segment\x20','resourceName','8UMOyLu','pause','base','entries','resolveJourneyId','Show\x20journey\x20table\x20column\x20mapping','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Get\x20journey\x20traffic\x20data\x20(Sankey\x20charts)','journey:push','journey:resume','\x20(draft)\x20—\x20\x22','resolveSegment','draft','journey:pull','journeyBundleId','exitOrJumpRate','all','listActivationsFlat','Warning:\x20Could\x20not\x20resolve\x20activation\x20','sort','Error:\x20Version\x20','\x20\x20Journey\x20ID:\x20','helpText','getStatistics','from','set','Found\x20','Warning:\x20--include-history\x20without\x20--from/--to\x20may\x20return\x20all-time\x20history','listFolders','state','split','\x20versions)','segmentName','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','get','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','repeat','data','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','\x27\x20not\x20found\x20in\x20','versionNumber','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','yellow','createVersion','\x22\x20not\x20found','List\x20all\x20versions\x20of\x20a\x20journey','name','conversion','Cancelled','table','yes','segmentPushCommand','connection','\x20(rule\x20match)','journey:pause','red','-\x20no\x20files\x20written','journey:version:create','rule','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','Resolving\x20parent\x20segment...','listVersions','\x20\x20-\x20','Error:\x20','834gfSAOc','Create\x20a\x20new\x20draft\x20version\x20of\x20journey\x20\x22','Show\x20journey\x20details','reentryMode','\x20unchanged\x20files','Options:','parent_segment','Error:\x20Invalid\x20version\x20number:\x20','log','kind','✔\x20Found\x20','localeCompare','buildIdToEmailMap','(archived)','completionRate','\x20Created\x20v','INVALID_ARGUMENT','has','journeyName','Getting\x20journey\x20details...','toLowerCase','journeyStages','5070076oBoNFa','71267FwLzyM','Fetching\x20users\x20and\x20connections...','/app/ps/','\x20new\x20files','No\x20statistics\x20available\x20for\x20journey:\x20','stages','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','includeHistory','launched','folderPath','add','activationParams','Pattern:\x20','archived','blue','description','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','paused','Available\x20stages:\x20','enteredSize','journeys','Show\x20journey\x20statistics','getJourney','no_parent','Table:\x20','Aborted.','Error:\x20Journey\x20not\x20found:\x20','\x22\x20resumed','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','activation_','completeMilestoneRate','errorCode','Usage:\x20journey\x20version\x20view\x20<name-or-path>\x20--version\x20N','\x20\x20Parent\x20segment:\x20','1445983lxTbgX','file','\x20activation','args','cwd','updatedAt','Fetching\x20',',\x20version:\x20','filter','\x22\x20paused','\x20details...','journeyId','Target\x20directory:\x20','\x20Opening\x20','\x20\x20Folder\x20path:\x20','\x20files?','parentName','(root)','folders','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','segments','find'];a22_0x1bc7=function(){return _0x224295;};return a22_0x1bc7();}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(_0xb2f116){const _0x123fc9=a22_0x8643;return!_0xb2f116&&(console[_0x123fc9(0x15b)](_0x123fc9(0xd3)),console[_0x123fc9(0x15b)](_0x123fc9(0x1aa))),!!_0xb2f116;}function withJsonFormat(_0x140677){const _0x5adf9f=a22_0x8643;if(!_0x140677['format']&&!_0x140677[_0x5adf9f(0x174)]&&!_0x140677['jsonl']&&!_0x140677[_0x5adf9f(0x18f)])return{..._0x140677,'format':_0x5adf9f(0x174),'json':!![]};return _0x140677;}function formatJourneyState(_0x5b6a63){const _0x5f5552=a22_0x8643;switch(_0x5b6a63){case _0x5f5552(0x111):return a22_0x4d1c63[_0x5f5552(0x188)](_0x5f5552(0x187));case _0x5f5552(0x1ce):return a22_0x4d1c63[_0x5f5552(0x173)]('(draft)');case _0x5f5552(0x11a):return a22_0x4d1c63[_0x5f5552(0xdc)](_0x5f5552(0x1bd));case _0x5f5552(0x176):return a22_0x4d1c63[_0x5f5552(0x117)]('(completed)');case _0x5f5552(0x116):return a22_0x4d1c63[_0x5f5552(0x173)](_0x5f5552(0xff));default:return'('+_0x5b6a63+')';}}function formatJourneyItem(_0x19ab6a,_0x59dd2e='',_0xa776d6){const _0x554c2f=a22_0x8643,_0x7640bf=formatJourneyState(_0x19ab6a[_0x554c2f(0xcf)]),_0x23878d=_0xa776d6?hyperlink(_0x19ab6a[_0x554c2f(0x161)],_0xa776d6):_0x19ab6a[_0x554c2f(0x161)];return _0x59dd2e+'🗺️\x20'+_0x23878d+'\x20'+_0x7640bf;}function escapeRegex(_0x399947){return _0x399947['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&');}function globToRegex(_0x49d9cb){const _0x283b41=a22_0x8643,_0xa87ea9=_0x49d9cb[_0x283b41(0xd0)]('*')[_0x283b41(0x1a4)](escapeRegex);return new RegExp(_0xa87ea9[_0x283b41(0x183)]('.*'),'i');}function buildRuleToNameMapping(_0x5abe1a){const _0x299450=a22_0x8643,_0x12a1a9=new Map();if(_0x5abe1a[_0x299450(0x13f)])for(const [_0x38a15f,_0x2412ba]of Object[_0x299450(0x1c5)](_0x5abe1a[_0x299450(0x13f)])){if(_0x2412ba['rule']){const _0x1cb753=serializeRule(_0x2412ba[_0x299450(0xec)]),_0x57a146=_0x12a1a9['get'](_0x1cb753);_0x57a146?_0x57a146[_0x299450(0x19a)](_0x38a15f):_0x12a1a9[_0x299450(0xcb)](_0x1cb753,[_0x38a15f]);}}return _0x12a1a9;}async function resolveJourneyIdFromInput(_0x1c1513,_0x3ac6c8,_0x10d0d7){const _0x3f4782=a22_0x8643,_0xb13ba0=await resolveJourneyTarget(_0x1c1513,_0x3ac6c8[_0x3f4782(0x1b7)],_0x3ac6c8[_0x3f4782(0x19d)]),_0x227a7e=_0xb13ba0[_0x3f4782(0x1b7)];if(!_0x227a7e)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x3f4782(0x171));const _0x3c7d5a=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x10d0d7[_0x3f4782(0x1bb)][_0x3f4782(0x1b6)](_0x227a7e),{'verbose':_0x3ac6c8[_0x3f4782(0x19d)]}),_0x4d5a49=_0x3c7d5a[_0x3f4782(0xd7)],_0x4841e4=await withSpinner(_0x3f4782(0x17a),()=>_0x10d0d7[_0x3f4782(0x172)][_0x3f4782(0x1c6)](_0x4d5a49,_0xb13ba0[_0x3f4782(0x104)]),{'verbose':_0x3ac6c8[_0x3f4782(0x19d)]});return{'journeyId':_0x4841e4[_0x3f4782(0xd7)],'journeyName':_0xb13ba0[_0x3f4782(0x104)],'parentSegmentId':_0x4d5a49};}async function resolveJourneyTarget(_0x57b076,_0xa986c6,_0x58e740){const _0x519020=a22_0x8643;if(isYamlFilePath(_0x57b076))try{const _0x162aee=await resolveYamlFilePath(_0x57b076);return _0x58e740&&(console['error'](_0x519020(0x156)+_0x57b076),console[_0x519020(0x15b)](_0x519020(0x12a)+_0x162aee[_0x519020(0x1b7)]),console[_0x519020(0x15b)](_0x519020(0x18e)+_0x162aee[_0x519020(0xd2)]),console[_0x519020(0x15b)](_0x519020(0x139)+(_0x162aee[_0x519020(0x112)]||_0x519020(0x13c)))),{'journeyName':_0x162aee[_0x519020(0xd2)],'parentSegment':_0x162aee[_0x519020(0x1b7)],'resolved':_0x162aee};}catch(_0x1a89dc){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x519020(0x1c8)+_0x1a89dc[_0x519020(0x1b1)]);}if(!_0xa986c6)throw new SDKError(ErrorCode[_0x519020(0x102)],_0x519020(0x179));return{'journeyName':_0x57b076,'parentSegment':_0xa986c6};}export class JourneyListCommand extends BaseCommand{[a22_0x9ba4d0(0xe0)]=a22_0x9ba4d0(0x193);['description']=a22_0x9ba4d0(0x1a2);async[a22_0x9ba4d0(0x180)](_0x42eb41){const _0x1c2026=a22_0x9ba4d0,{options:_0x8b22df,args:_0x4ae475,tdx:_0x37ca12}=_0x42eb41,_0x52059b=_0x4ae475[0x0],_0x5890b7=_0x8b22df[_0x1c2026(0x1b7)];if(!_0x5890b7)return console[_0x1c2026(0x15b)](_0x1c2026(0x151)),console['error'](_0x1c2026(0x152)),0x1;const _0x364523=await withSpinner(_0x1c2026(0xee),()=>_0x37ca12[_0x1c2026(0x1bb)][_0x1c2026(0x1b6)](_0x5890b7),{'verbose':_0x8b22df['verbose']}),_0x1857d0=_0x364523[_0x1c2026(0xd7)];_0x8b22df[_0x1c2026(0x19d)]&&(console['error'](_0x1c2026(0x198)+_0x5890b7+'\x20(ID:\x20'+_0x1857d0+')'),_0x52059b&&console['error'](_0x1c2026(0x115)+_0x52059b));const _0x4a8f38=await withSpinner(_0x1c2026(0x148),()=>_0x37ca12['segment'][_0x1c2026(0x150)](_0x1857d0),{'verbose':_0x8b22df[_0x1c2026(0x19d)]}),_0x18cfc2=_0x4a8f38[_0x1c2026(0xd7)],_0x590389=_0x18cfc2[_0x1c2026(0x15f)],_0x32e34f=await withSpinner('Listing\x20journeys...',()=>_0x37ca12[_0x1c2026(0x172)][_0x1c2026(0x149)](_0x1857d0,_0x590389),{'verbose':_0x8b22df[_0x1c2026(0x19d)]});let _0x2ba9aa=_0x32e34f[_0x1c2026(0xd7)][_0x1c2026(0x11d)];const _0x292fe1=_0x32e34f[_0x1c2026(0xd7)][_0x1c2026(0x13d)],_0x5251e5=new Map();for(const _0x144b72 of _0x292fe1){_0x5251e5[_0x1c2026(0xcb)](_0x144b72['id'],_0x144b72[_0x1c2026(0xe0)]);}if(_0x52059b){const _0x49c5d5=globToRegex(_0x52059b);_0x2ba9aa=_0x2ba9aa[_0x1c2026(0x133)](_0x31c3e8=>_0x49c5d5['test'](_0x31c3e8[_0x1c2026(0x161)]));}console[_0x1c2026(0x15b)](_0x1c2026(0xfc)+_0x2ba9aa[_0x1c2026(0x175)]+_0x1c2026(0x1ba)+(_0x2ba9aa[_0x1c2026(0x175)]!==0x1?'s':''));const _0xc429ae=_0x2ceb7f=>{const _0x47fb83=_0x1c2026;return getConsoleNextUrl(_0x8b22df['site'],'/app/ps/'+_0x1857d0+_0x47fb83(0x157)+_0x2ceb7f+'/j/da');};if(_0x8b22df['format']===_0x1c2026(0xe3))await handleSDKOutput(_0x2ba9aa,_0x8b22df);else{if(_0x8b22df[_0x1c2026(0x1a9)]==='json'){const _0x2e5adc=_0x2ba9aa['map'](_0x27d6f5=>({..._0x27d6f5,'url':_0xc429ae(_0x27d6f5['id'])}));await handleSDKOutput(_0x2e5adc,_0x8b22df);}else{console[_0x1c2026(0xfa)]('['+_0x5890b7+']');const _0x1cdc7b=new Map(),_0x2f0b9e=[];for(const _0xdb48ab of _0x2ba9aa){if(!_0xdb48ab[_0x1c2026(0x14a)]||_0xdb48ab[_0x1c2026(0x14a)]===_0x590389)_0x2f0b9e['push'](_0xdb48ab);else{const _0x3b750b=_0x1cdc7b['get'](_0xdb48ab[_0x1c2026(0x14a)])||[];_0x3b750b['push'](_0xdb48ab),_0x1cdc7b[_0x1c2026(0xcb)](_0xdb48ab[_0x1c2026(0x14a)],_0x3b750b);}}const _0x253834=(_0x479268,_0x1d1112)=>_0x479268[_0x1c2026(0x161)][_0x1c2026(0xfd)](_0x1d1112[_0x1c2026(0x161)],undefined,{'sensitivity':'base'});_0x2f0b9e['sort'](_0x253834);for(const _0x2881d6 of _0x2f0b9e){console[_0x1c2026(0xfa)](formatJourneyItem(_0x2881d6,'',_0xc429ae(_0x2881d6['id'])));}const _0x1ce78b=[..._0x1cdc7b[_0x1c2026(0x1c5)]()][_0x1c2026(0xc5)]((_0xba490e,_0x55416c)=>{const _0x28942e=_0x1c2026,_0x471980=_0x5251e5[_0x28942e(0xd4)](_0xba490e[0x0])||_0xba490e[0x0],_0x1c9803=_0x5251e5['get'](_0x55416c[0x0])||_0x55416c[0x0];return _0x471980['localeCompare'](_0x1c9803,undefined,{'sensitivity':_0x28942e(0x1c4)});});for(const [_0x1e1fe4,_0x2d3ad4]of _0x1ce78b){const _0x1e2e5f=_0x5251e5['get'](_0x1e1fe4)||_0x1e1fe4;console[_0x1c2026(0xfa)](_0x1c2026(0x16c)+_0x1e2e5f),_0x2d3ad4[_0x1c2026(0xc5)](_0x253834);for(const _0x228673 of _0x2d3ad4){console[_0x1c2026(0xfa)](formatJourneyItem(_0x228673,'\x20\x20',_0xc429ae(_0x228673['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a22_0x9ba4d0(0xe0)]='journey:view';[a22_0x9ba4d0(0x118)]=a22_0x9ba4d0(0xf4);async[a22_0x9ba4d0(0x180)](_0x43baef){const _0xe4ec01=a22_0x9ba4d0,{options:_0x1fcc30,args:_0x16857e,tdx:_0x200c62}=_0x43baef,_0x53bb0d=_0x16857e[0x0];if(!_0x53bb0d)return console[_0xe4ec01(0x15b)](_0xe4ec01(0xd3)),console[_0xe4ec01(0x15b)](_0xe4ec01(0x14f)),console[_0xe4ec01(0x15b)](_0xe4ec01(0xf7)),console[_0xe4ec01(0x15b)]('\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser'),0x1;_0x1fcc30[_0xe4ec01(0x19d)]&&console[_0xe4ec01(0x15b)](_0xe4ec01(0x162)+_0x53bb0d);const {journeyId:_0x4a5d82,parentSegmentId:_0x31cc71}=await resolveJourneyIdFromInput(_0x53bb0d,_0x1fcc30,_0x200c62);if(_0x1fcc30[_0xe4ec01(0x1b2)]){const _0x1b5203=getConsoleNextUrl(_0x1fcc30[_0xe4ec01(0x1b0)],'/app/ps/'+_0x31cc71+'/e/'+_0x4a5d82+_0xe4ec01(0x1b9));return console[_0xe4ec01(0x15b)](a22_0x4d1c63['green']('✔')+_0xe4ec01(0x138)+a22_0x4d1c63['cyan'](_0x1b5203)),openBrowser(_0x1b5203),0x0;}const _0x2c7b90=await withSpinner(_0xe4ec01(0x105),()=>_0x200c62[_0xe4ec01(0x172)]['getJourney'](_0x4a5d82),{'verbose':_0x1fcc30['verbose']}),_0x3db243=_0x2c7b90['data'],_0x50b406=_0x1fcc30[_0xe4ec01(0x16e)];let _0x4cc947;if(_0x50b406)try{const _0x27a36c=await withSpinner(_0xe4ec01(0x159),()=>_0x200c62[_0xe4ec01(0x172)][_0xe4ec01(0xc9)](_0x4a5d82),{'verbose':_0x1fcc30[_0xe4ec01(0x19d)]});_0x4cc947=_0x27a36c[_0xe4ec01(0xd7)];}catch{_0x1fcc30[_0xe4ec01(0x19d)]&&console[_0xe4ec01(0x15b)](_0xe4ec01(0x178));}const _0x4a976a=getConsoleNextUrl(_0x1fcc30[_0xe4ec01(0x1b0)],_0xe4ec01(0x10b)+_0x31cc71+_0xe4ec01(0x157)+_0x4a5d82+'/j/da/je'),_0x37f5f9={'id':_0x3db243['id'],'name':_0x3db243['attributes'][_0xe4ec01(0xe0)],'description':_0x3db243[_0xe4ec01(0x143)][_0xe4ec01(0x118)],'state':_0x3db243[_0xe4ec01(0x143)][_0xe4ec01(0xcf)],'paused':_0x3db243['attributes']['paused'],'reentry_mode':_0x3db243['attributes'][_0xe4ec01(0xf5)],'stages':_0x3db243[_0xe4ec01(0x143)]['journeyStages']?.[_0xe4ec01(0x175)]||0x0,..._0x3db243[_0xe4ec01(0x143)][_0xe4ec01(0x18c)]&&{'goal':_0x3db243[_0xe4ec01(0x143)][_0xe4ec01(0x18c)]['name']},..._0x4cc947&&{'statistics':{'size':_0x4cc947[_0xe4ec01(0x17f)],'entered':_0x4cc947[_0xe4ec01(0x11c)],'goal_achieved':_0x4cc947[_0xe4ec01(0x1b4)],'completion_rate':_0x4cc947[_0xe4ec01(0x100)],'exit_or_jump':_0x4cc947[_0xe4ec01(0x1b3)],'exit_or_jump_rate':_0x4cc947['exitOrJumpRate'],'stages':_0x4cc947[_0xe4ec01(0x10e)]}},'url':_0x4a976a};return await handleSingleObjectOutput(_0x37f5f9,_0x1fcc30),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a22_0x9ba4d0(0xe0)]=a22_0x9ba4d0(0x147);[a22_0x9ba4d0(0x118)]=a22_0x9ba4d0(0x11e);async['execute'](_0x2d5d0b){const _0x4a1fd9=a22_0x9ba4d0,{options:_0x5881c5,args:_0x23a5d6,tdx:_0x26be78}=_0x2d5d0b,_0x1b37e4=_0x23a5d6[0x0];if(!requireNameOrPath(_0x1b37e4))return 0x1;_0x5881c5['verbose']&&console['error']('Input:\x20'+_0x1b37e4);const _0x2d21cf=_0x5881c5,_0x324681=_0x2d21cf[_0x4a1fd9(0xca)],_0x48b296=_0x2d21cf['to'],_0x18b9b1=_0x2d21cf['includeHistory'],_0xe41d6d=_0x2d21cf[_0x4a1fd9(0x18b)];_0x18b9b1&&!_0x324681&&!_0x48b296&&console[_0x4a1fd9(0x15b)](_0x4a1fd9(0xcd));const _0xd4b92c=_0x18b9b1?withJsonFormat(_0x5881c5):_0x5881c5,{journeyId:_0x542aac,journeyName:_0x486a3f}=await resolveJourneyIdFromInput(_0x1b37e4,_0xd4b92c,_0x26be78),_0x4709f3=_0x324681||_0x48b296?{'from':_0x324681,'to':_0x48b296}:undefined,_0x37e40c=await withSpinner(_0x4a1fd9(0x159),()=>Promise[_0x4a1fd9(0xc2)]([_0x26be78['journey'][_0x4a1fd9(0x11f)](_0x542aac),_0x26be78[_0x4a1fd9(0x172)]['getStatistics'](_0x542aac,_0x4709f3)]),{'verbose':_0xd4b92c[_0x4a1fd9(0x19d)]}),[_0x137f0c,_0x2772de]=_0x37e40c[_0x4a1fd9(0xd7)];if(!_0x2772de||_0x2772de['journeyId']===null)return console[_0x4a1fd9(0x15b)](_0x4a1fd9(0x10d)+_0x486a3f),console[_0x4a1fd9(0x15b)](_0x4a1fd9(0x160)),0x0;const _0x589af9=buildStageNameMap(_0x137f0c),_0x4b7e7d=!!(_0x4709f3&&_0x2772de[_0x4a1fd9(0x1bf)]?.['length']),_0x181ced={'stageNameMap':_0x589af9,'hasPeriod':_0x4b7e7d,'includeHistory':!!_0x18b9b1};if(_0xe41d6d&&_0x2772de[_0x4a1fd9(0x10e)]){const _0x4467b1=_0x2772de[_0x4a1fd9(0x10e)][_0x4a1fd9(0x140)](_0x1a0542=>{const _0xfa266a=_0x4a1fd9,_0x44ecce=_0x589af9[_0xfa266a(0xd4)](_0x1a0542['id'])??'';return _0x44ecce[_0xfa266a(0x106)]()===_0xe41d6d['toLowerCase']();});if(_0x4467b1)return await handleSingleObjectOutput(formatStageStats(_0x4467b1,_0x181ced),_0xd4b92c),0x0;const _0x1181fa=_0x2772de[_0x4a1fd9(0x10e)][_0x4a1fd9(0x1a4)](_0x4d2580=>_0x589af9[_0x4a1fd9(0xd4)](_0x4d2580['id'])??_0x4d2580['id']);return console[_0x4a1fd9(0x15b)](_0x4a1fd9(0x15c)+_0xe41d6d+_0x4a1fd9(0xde)),console[_0x4a1fd9(0x15b)](_0x4a1fd9(0x11b)+_0x1181fa[_0x4a1fd9(0x183)](',\x20')),0x1;}const _0x8ad64a=_0x2772de['stages']?.[_0x4a1fd9(0x1a4)](_0x1b61e9=>formatStageStats(_0x1b61e9,_0x181ced)),_0x530b04=assembleJourneyStats(_0x2772de,{'from':_0x324681,'to':_0x48b296,'includeHistory':_0x18b9b1});return await this[_0x4a1fd9(0x19c)](_0x530b04,_0x8ad64a??[],_0xd4b92c),0x0;}async[a22_0x9ba4d0(0x19c)](_0x440501,_0x58fb76,_0x26b018){const _0x43390b=a22_0x9ba4d0,_0x1c583e=_0x26b018['format']==='json'||_0x26b018[_0x43390b(0x1a9)]===_0x43390b(0x170)||_0x26b018[_0x43390b(0x174)]||_0x26b018[_0x43390b(0x170)];if(_0x1c583e){_0x440501[_0x43390b(0x10e)]=_0x58fb76,await handleSingleObjectOutput(_0x440501,_0x26b018);return;}await handleSingleObjectOutput(_0x440501,_0x26b018);for(const _0x13c3e1 of _0x58fb76){console[_0x43390b(0xfa)](''),console['log'](String(a22_0x4d1c63[_0x43390b(0x165)]['bold']('['+_0x13c3e1['name']+']'))+a22_0x4d1c63['dim']('\x20'+_0x13c3e1['id']));const {id:_0x24e108,name:_0x2eacbf,..._0x1736d0}=_0x13c3e1;await handleSingleObjectOutput(_0x1736d0,_0x26b018);}}}export class JourneyTrafficCommand extends BaseCommand{[a22_0x9ba4d0(0xe0)]=a22_0x9ba4d0(0x17d);[a22_0x9ba4d0(0x118)]=a22_0x9ba4d0(0x1c9);async[a22_0x9ba4d0(0x180)](_0x307d70){const _0x3c796e=a22_0x9ba4d0,{options:_0x1d0b75,args:_0xf16852,tdx:_0x491a06}=_0x307d70,_0x2d312f=_0xf16852[0x0];if(!requireNameOrPath(_0x2d312f))return 0x1;_0x1d0b75[_0x3c796e(0x19d)]&&console[_0x3c796e(0x15b)](_0x3c796e(0x162)+_0x2d312f);const _0xe392aa=_0x1d0b75,_0x128ece=_0xe392aa[_0x3c796e(0x141)],_0xd87992=_0xe392aa[_0x3c796e(0xca)],_0x20732f=_0xe392aa['to'],_0x29de9c=_0xe392aa[_0x3c796e(0x1bc)];if(_0x128ece&&_0x128ece!=='conversion'&&_0x128ece!==_0x3c796e(0x164))return console[_0x3c796e(0x15b)](_0x3c796e(0x155)+_0x128ece+'\x22.\x20Must\x20be\x20\x22conversion\x22\x20or\x20\x22activation\x22.'),0x1;const _0x29aecf=withJsonFormat(_0x1d0b75),{journeyId:_0x2fcd66,journeyName:_0x91e4fe}=await resolveJourneyIdFromInput(_0x2d312f,_0x29aecf,_0x491a06),_0x4cae0f={'type':_0x128ece,'from':_0xd87992,'to':_0x20732f,'limit':_0x29de9c},_0x50300c=await withSpinner('Getting\x20journey\x20traffic\x20data...',()=>_0x491a06[_0x3c796e(0x172)][_0x3c796e(0x177)](_0x2fcd66,_0x4cae0f),{'verbose':_0x29aecf['verbose']}),_0xc0ee82=_0x50300c[_0x3c796e(0xd7)],_0xc9280c=_0xc0ee82[_0x3c796e(0xe1)]&&(_0xc0ee82[_0x3c796e(0xe1)][_0x3c796e(0x1b5)]['length']>0x0||_0xc0ee82[_0x3c796e(0xe1)]['links'][_0x3c796e(0x175)]>0x0),_0x390e4c=_0xc0ee82['activation']&&_0xc0ee82[_0x3c796e(0x164)][_0x3c796e(0x175)]>0x0;if(!_0xc9280c&&!_0x390e4c)return console[_0x3c796e(0x15b)](_0x3c796e(0x194)+_0x91e4fe),console[_0x3c796e(0x15b)]('Traffic\x20data\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.'),_0xd87992&&_0x20732f&&console[_0x3c796e(0x15b)](_0x3c796e(0x15e)),0x0;return await handleSingleObjectOutput(_0xc0ee82,_0x29aecf),0x0;}}function formatStageStats(_0x400d74,_0x14db56){const _0x1dc341=a22_0x9ba4d0,_0x162d40=_0x14db56[_0x1dc341(0x1ad)]&&_0x400d74[_0x1dc341(0x1bf)]?.['length']?aggregateStageHistory(_0x400d74['history']):{'size':_0x400d74[_0x1dc341(0x17f)],'entered':_0x400d74[_0x1dc341(0x11c)],'milestone':_0x400d74['milestoneSize'],'milestone_rate':_0x400d74[_0x1dc341(0x127)],'exit_or_jump':_0x400d74[_0x1dc341(0x1b3)],'exit_or_jump_rate':_0x400d74[_0x1dc341(0x1d1)]},_0x599572={'id':_0x400d74['id'],'name':_0x14db56[_0x1dc341(0x169)]['get'](_0x400d74['id'])??_0x400d74['id'],..._0x162d40};return _0x14db56['hasPeriod']&&_0x14db56[_0x1dc341(0x110)]&&_0x400d74['history']&&(_0x599572[_0x1dc341(0x1bf)]=_0x400d74[_0x1dc341(0x1bf)]),_0x599572;}export class JourneyPauseCommand extends BaseCommand{[a22_0x9ba4d0(0xe0)]=a22_0x9ba4d0(0xe8);[a22_0x9ba4d0(0x118)]='Pause\x20a\x20running\x20journey';async[a22_0x9ba4d0(0x180)](_0x3225e5){const _0x141f4f=a22_0x9ba4d0,{options:_0x3c11c1,args:_0x2d5c5b,tdx:_0x3faca0}=_0x3225e5,_0x4fdaa0=_0x2d5c5b[0x0];if(!requireNameOrPath(_0x4fdaa0))return 0x1;_0x3c11c1[_0x141f4f(0x19d)]&&console[_0x141f4f(0x15b)](_0x141f4f(0x162)+_0x4fdaa0);const {journeyId:_0x285df1,journeyName:_0xb3dd4e}=await resolveJourneyIdFromInput(_0x4fdaa0,_0x3c11c1,_0x3faca0);if(!_0x3c11c1[_0x141f4f(0xe4)]){const _0x2413e2=await confirm(_0x141f4f(0x14e)+_0xb3dd4e+'\x22?');if(!_0x2413e2)return console[_0x141f4f(0x15b)]('Cancelled'),0x0;}const _0x315488=await withSpinner('Pausing\x20journey...',()=>_0x3faca0[_0x141f4f(0x172)][_0x141f4f(0x1c3)](_0x285df1),{'verbose':_0x3c11c1[_0x141f4f(0x19d)]}),_0x59b380=_0x315488[_0x141f4f(0xd7)];return console['error'](_0x141f4f(0x14d)+_0x59b380[_0x141f4f(0x143)][_0x141f4f(0xe0)]+_0x141f4f(0x134)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a22_0x9ba4d0(0xe0)]=a22_0x9ba4d0(0x1cb);[a22_0x9ba4d0(0x118)]=a22_0x9ba4d0(0x199);async[a22_0x9ba4d0(0x180)](_0x410693){const _0x2c75dc=a22_0x9ba4d0,{options:_0x5e3dcb,args:_0x38eb24,tdx:_0x453dd4}=_0x410693,_0x6d82e8=_0x38eb24[0x0];if(!requireNameOrPath(_0x6d82e8))return 0x1;_0x5e3dcb['verbose']&&console[_0x2c75dc(0x15b)]('Input:\x20'+_0x6d82e8);const {journeyId:_0x20e140,journeyName:_0x360992}=await resolveJourneyIdFromInput(_0x6d82e8,_0x5e3dcb,_0x453dd4);if(!_0x5e3dcb[_0x2c75dc(0xe4)]){const _0x31daaf=await confirm(_0x2c75dc(0xed)+_0x360992+'\x22?');if(!_0x31daaf)return console['error'](_0x2c75dc(0xe2)),0x0;}const _0x36b795=await withSpinner('Resuming\x20journey...',()=>_0x453dd4[_0x2c75dc(0x172)]['resume'](_0x20e140),{'verbose':_0x5e3dcb['verbose']}),_0x2c5681=_0x36b795[_0x2c75dc(0xd7)];return console['error'](_0x2c75dc(0x14d)+_0x2c5681['attributes'][_0x2c75dc(0xe0)]+_0x2c75dc(0x124)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a22_0x9ba4d0(0xe0)]=a22_0x9ba4d0(0x1cf);['description']='Export\x20journey(s)\x20as\x20YAML\x20files';async[a22_0x9ba4d0(0x180)](_0x5269b0){const _0x107913=a22_0x9ba4d0,{options:_0x1d1fbe,args:_0x1b2366,tdx:_0x4404ea}=_0x5269b0,_0x1be407=_0x1d1fbe,_0x16c4c2=_0x1b2366[0x0],_0x2dca09=_0x16c4c2&&isYamlFilePath(_0x16c4c2),_0x2fa945=await resolveTarget({'arg':_0x2dca09?_0x16c4c2:undefined,'contextParent':_0x1d1fbe[_0x107913(0x1b7)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x2fa945))return _0x2fa945[_0x107913(0x128)]===_0x107913(0x120)?(console[_0x107913(0x15b)](a22_0x4d1c63[_0x107913(0xdc)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x107913(0x15b)](_0x107913(0x166)),console[_0x107913(0x15b)](_0x107913(0x15a)),console[_0x107913(0x15b)](_0x107913(0xd8)),console['error']('\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')):(console[_0x107913(0x15b)](a22_0x4d1c63[_0x107913(0xe9)](_0x107913(0xf1)+_0x2fa945[_0x107913(0x1b1)]+'\x0a')),_0x2fa945[_0x107913(0xc8)]&&console['error'](a22_0x4d1c63[_0x107913(0x165)](_0x2fa945[_0x107913(0xc8)]))),0x1;let _0x378197=_0x2dca09?undefined:_0x16c4c2,_0x5d5c15,_0x368248;_0x2fa945[_0x107913(0x141)]===_0x107913(0x12c)&&(_0x378197=_0x2fa945[_0x107913(0x1c1)],_0x5d5c15=_0x2fa945[_0x107913(0x1b8)],_0x368248=_0x2fa945[_0x107913(0x112)]);const _0x3e8adb=_0x2fa945[_0x107913(0x13b)],_0x3a4fd3=_0x2fa945[_0x107913(0x1a5)];_0x1be407[_0x107913(0x19d)]&&(console['error'](_0x107913(0x198)+_0x3e8adb),console[_0x107913(0x15b)](_0x107913(0x137)+_0x3a4fd3),_0x378197&&console[_0x107913(0x15b)]('Journey\x20name:\x20'+_0x378197),_0x5d5c15&&console[_0x107913(0x15b)](_0x107913(0x1a8)+_0x5d5c15),_0x368248&&console[_0x107913(0x15b)](_0x107913(0x15d)+_0x368248));const _0x3f144c=await withSpinner(_0x107913(0xee),()=>_0x4404ea['segment'][_0x107913(0x1b6)](_0x3e8adb),{'verbose':_0x1d1fbe[_0x107913(0x19d)]}),_0x111812=_0x3f144c[_0x107913(0xd7)],{journeys:_0x5c5c72,folders:_0x4e25a2}=await withSpinner('Fetching\x20journeys\x20and\x20folders...',async()=>{const _0xecd14a=_0x107913,[_0x484896,_0x389e23]=await Promise[_0xecd14a(0xc2)]([_0x4404ea['journey'][_0xecd14a(0x196)](_0x111812,undefined,{'includeAllVersions':!![]}),_0x4404ea[_0xecd14a(0x1bb)][_0xecd14a(0xce)](_0x111812)]);return{'journeys':_0x484896,'folders':_0x389e23};},{'verbose':_0x1d1fbe['verbose']})[_0x107913(0x17c)](_0x4a5276=>_0x4a5276[_0x107913(0xd7)]);let _0x684862=_0x5c5c72;const _0x47d455=buildFolderIdToPathMap(_0x4e25a2);if(_0x378197){const _0x5274bd=_0x684862['filter'](_0x1c214f=>_0x1c214f[_0x107913(0x161)][_0x107913(0x106)]()===_0x378197[_0x107913(0x106)]());if(_0x5274bd[_0x107913(0x175)]===0x0)return console[_0x107913(0x15b)](_0x107913(0x123)+_0x378197),console[_0x107913(0x15b)](_0x107913(0x13e)),0x1;_0x684862=_0x5274bd;}if(_0x368248!==undefined){const _0x215ad6=_0x684862[_0x107913(0x133)](_0xfae33f=>{const _0xaed4a6=_0x107913,_0xece2d9=_0xfae33f['folderId']?_0x47d455[_0xaed4a6(0xd4)](_0xfae33f[_0xaed4a6(0x14a)])||'':'';return _0xece2d9===_0x368248;});if(_0x215ad6[_0x107913(0x175)]===0x0&&_0x684862[_0x107913(0x175)]>0x0){console['error']('Error:\x20Journey\x20\x27'+_0x378197+_0x107913(0xd9)+(_0x368248||'root\x20folder')),console[_0x107913(0x15b)](_0x107913(0x10f));for(const _0x53d356 of _0x684862){const _0x8a1338=_0x53d356[_0x107913(0x14a)]?_0x47d455[_0x107913(0xd4)](_0x53d356['folderId'])||'':'';console[_0x107913(0x15b)](_0x107913(0xf0)+(_0x8a1338||_0x107913(0x13c))+'/'+_0x53d356['journeyBundleName']);}return 0x1;}_0x684862=_0x215ad6;}if(_0x684862[_0x107913(0x175)]===0x0)return console['error'](_0x107913(0x1a6)),0x0;const _0xf0438e=new Map();for(const _0x3705f6 of _0x684862){const _0x13fcda=_0x3705f6[_0x107913(0x1d0)];!_0xf0438e[_0x107913(0x103)](_0x13fcda)&&_0xf0438e[_0x107913(0xcb)](_0x13fcda,[]),_0xf0438e['get'](_0x13fcda)['push'](_0x3705f6);}for(const _0x583b0a of _0xf0438e[_0x107913(0x17e)]()){_0x583b0a[_0x107913(0xc5)]((_0x112602,_0x196192)=>(_0x112602[_0x107913(0xda)]||0x0)-(_0x196192['versionNumber']||0x0));}const _0x50b2c1=[],{idToEmailMap:_0x501ebf,connectionIdToNameMap:_0x5c03a9}=await withSpinner(_0x107913(0x10a),async()=>{const _0x10789b=_0x107913,[_0x50c0c9,_0x2dc866]=await Promise[_0x10789b(0xc2)]([_0x4404ea[_0x10789b(0x181)][_0x10789b(0xfe)](),_0x4404ea[_0x10789b(0xe6)]['buildIdToNameMap']()]);return{'idToEmailMap':_0x50c0c9,'connectionIdToNameMap':_0x2dc866};},{'verbose':_0x1d1fbe[_0x107913(0x19d)]})[_0x107913(0x17c)](_0x48357f=>_0x48357f[_0x107913(0xd7)]);for(const _0x2ace4a of _0xf0438e['values']()){const _0x57b09e=_0x2ace4a[0x0][_0x107913(0x161)],_0x4ab967=_0x2ace4a[0x0][_0x107913(0x14a)],_0x10dc70=_0x4ab967?_0x47d455[_0x107913(0xd4)](_0x4ab967)||'':'',_0x59fe2e=_0x10dc70?a22_0x4530a1[_0x107913(0x183)](_0x3a4fd3,_0x10dc70):_0x3a4fd3,_0x3edeec=_0x5d5c15||a22_0x4530a1['join'](_0x59fe2e,sanitizeFileName(_0x57b09e)+_0x107913(0x154));let _0x51eff5,_0x215366;if(existsSync(_0x3edeec))try{const _0x43cd01=readFileSync(_0x3edeec,_0x107913(0x185)),_0x2a0145=parseYamlString(_0x43cd01);_0x215366=_0x2a0145,_0x51eff5=buildRuleToNameMapping(_0x2a0145),_0x1be407[_0x107913(0x19d)]&&_0x51eff5[_0x107913(0x17f)]>0x0&&console['error'](_0x107913(0xcc)+_0x51eff5[_0x107913(0x17f)]+_0x107913(0xd5)+_0x57b09e);}catch(_0x284ab0){_0x1be407[_0x107913(0x19d)]&&console[_0x107913(0x15b)](_0x107913(0x119)+_0x284ab0[_0x107913(0x1b1)]);}const _0xbb107b=[],_0x537539=new Set(),_0x3b5299=new Map(),_0x5c1104=new Map(),_0x374d7b=new Set(),_0x327979=new Map(),_0x39aba9=new Map(),_0x2b3eb9=createJumpTargetCache();await withProgressSpinner(_0x107913(0x131)+_0x57b09e+_0x107913(0x1a3),async _0x43b47f=>{const _0xd9eb1b=_0x107913;for(const _0x4a35f6 of _0x2ace4a){const _0x41c342=_0x2ace4a['length']>0x1?_0x4a35f6[_0xd9eb1b(0x161)]+'\x20v'+(_0x4a35f6[_0xd9eb1b(0xda)]||0x1):_0x4a35f6[_0xd9eb1b(0x161)];_0x43b47f['setPhase']('Fetching\x20'+_0x41c342);const _0x36b6a5=await _0x4404ea[_0xd9eb1b(0x172)][_0xd9eb1b(0x11f)](_0x4a35f6['id']),_0x40f6c6=_0x36b6a5['attributes']?.['audienceId'],_0x4c8358={'resolveSegment':async _0x271a2e=>{const _0x2a0815=_0xd9eb1b;if(!_0x40f6c6)return{'name':_0x271a2e,'isJourneyLocal':![]};const _0x3f6667=_0x3b5299['get'](_0x271a2e);if(_0x3f6667)return _0x3f6667;try{const _0xeaa315=await _0x4404ea[_0x2a0815(0x1bb)]['getSegment'](_0x40f6c6,_0x271a2e),_0x5efd0a=_0xeaa315[_0x2a0815(0xfb)]===SEGMENT_KIND_JOURNEY;let _0x11b034,_0x29134b=_0xeaa315[_0x2a0815(0xe0)];if(_0x5efd0a&&_0xeaa315[_0x2a0815(0xec)]){const _0xf7c075=await segmentResponseToDef(_0xeaa315,{'resolveSegmentName':async _0x28ad45=>{const _0x32c241=_0x2a0815,_0x5905ed=_0x3b5299['get'](_0x28ad45);if(_0x5905ed)return _0x5905ed[_0x32c241(0xe0)];const _0x18af30=await _0x4c8358[_0x32c241(0x1cd)](_0x28ad45);return _0x18af30[_0x32c241(0xe0)];}}),_0x5413fa=_0xf7c075['rule'];_0x11b034={'description':_0xeaa315[_0x2a0815(0x118)],'rule':_0x5413fa};const _0x52edc0=serializeRule(_0x5413fa),_0x5d5d1a=_0x5c1104[_0x2a0815(0xd4)](_0x52edc0);if(_0x5d5d1a)_0x29134b=_0x5d5d1a,_0x11b034=undefined,_0x1be407['verbose']&&console[_0x2a0815(0x15b)]('\x20\x20Consolidating\x20duplicate\x20segment:\x20'+_0xeaa315[_0x2a0815(0xe0)]+_0x2a0815(0x167)+_0x5d5d1a);else{let _0x410f49=![];if(_0x51eff5){const _0x3f9dd8=_0x51eff5[_0x2a0815(0xd4)](_0x52edc0);if(_0x3f9dd8){const _0x1cce7b=_0x3f9dd8['find'](_0x238b19=>!_0x537539['has'](_0x238b19));_0x1cce7b&&(_0x29134b=_0x1cce7b,_0x537539['add'](_0x1cce7b),_0x5c1104[_0x2a0815(0xcb)](_0x52edc0,_0x1cce7b),_0x410f49=!![],_0x1be407[_0x2a0815(0x19d)]&&console[_0x2a0815(0x15b)]('\x20\x20Preserving\x20local\x20segment\x20name:\x20'+_0x1cce7b+_0x2a0815(0xe7)));}}if(!_0x410f49){const _0x76b9d0=generateJourneyLocalName(_0xeaa315[_0x2a0815(0xe0)]);_0x76b9d0&&(_0x29134b=_0x76b9d0);let _0x1553ad=_0x29134b,_0x33f90c=0x2;while(_0x537539[_0x2a0815(0x103)](_0x1553ad)){_0x1553ad=_0x29134b+'_'+_0x33f90c,_0x33f90c++;}_0x537539[_0x2a0815(0x113)](_0x1553ad),_0x5c1104['set'](_0x52edc0,_0x1553ad),_0x29134b=_0x1553ad;}}}const _0x4cc39d={'name':_0x29134b,'isJourneyLocal':_0x5efd0a,'definition':_0x11b034};return _0x3b5299[_0x2a0815(0xcb)](_0x271a2e,_0x4cc39d),_0x4cc39d;}catch(_0x3b19d1){return _0x1d1fbe[_0x2a0815(0x19d)]&&console[_0x2a0815(0x15b)](_0x2a0815(0x1c0)+_0x271a2e+':\x20'+_0x3b19d1[_0x2a0815(0x1b1)]),{'name':_0x271a2e,'isJourneyLocal':![]};}},'resolveActivation':async _0xbb2da3=>{const _0x114698=_0xd9eb1b,_0x3872a3=_0x327979[_0x114698(0xd4)](_0xbb2da3);if(_0x3872a3)return _0x3872a3;try{const _0x2e372e=await _0x4404ea[_0x114698(0x172)]['getActivation'](_0x4a35f6['id'],_0xbb2da3),_0x1df800=journeyActivationStepToYaml(_0x2e372e,_0x501ebf,_0x5c03a9),_0x47114a=JSON['stringify']({'name':_0x1df800[_0x114698(0xe0)],'connection':_0x1df800[_0x114698(0xe6)],'connector_config':_0x1df800[_0x114698(0x184)]}),_0x4b2ae8=_0x39aba9[_0x114698(0xd4)](_0x47114a);if(_0x4b2ae8){const _0x49c4e5={'name':_0x4b2ae8,'isJourneyLocal':!![],'definition':_0x1df800};return _0x327979[_0x114698(0xcb)](_0xbb2da3,_0x49c4e5),_0x49c4e5;}const _0x308ad3=_0x2e372e['attributes'][_0x114698(0x114)][_0x114698(0xe0)]||_0xbb2da3,_0x11cfc1=sanitizeYamlKey(_0x308ad3)||_0x114698(0x126)+_0xbb2da3;let _0x1a258b=_0x11cfc1,_0xfd6ded=0x2;while(_0x374d7b['has'](_0x1a258b)){_0x1a258b=_0x11cfc1+'_'+_0xfd6ded,_0xfd6ded++;}_0x374d7b[_0x114698(0x113)](_0x1a258b),_0x39aba9[_0x114698(0xcb)](_0x47114a,_0x1a258b);const _0x39ae83={'name':_0x1a258b,'isJourneyLocal':!![],'definition':_0x1df800};return _0x327979[_0x114698(0xcb)](_0xbb2da3,_0x39ae83),_0x39ae83;}catch(_0x521a5d){return _0x1d1fbe[_0x114698(0x19d)]&&console[_0x114698(0x15b)](_0x114698(0xc4)+_0xbb2da3+':\x20'+_0x521a5d[_0x114698(0x1b1)]),{'name':_0xbb2da3,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x4b1667,_0x54d481)=>{const _0x3788ed=_0xd9eb1b;return resolveJumpTarget(_0x4b1667,_0x54d481,_0x2b3eb9,_0x218265=>_0x4404ea[_0x3788ed(0x172)][_0x3788ed(0x11f)](_0x218265));}},_0x2933f2=await journeyResponseToDef(_0x36b6a5,_0x4c8358);_0xbb107b[_0xd9eb1b(0x19a)]({'item':_0x4a35f6,'yaml':_0x2933f2});}},{'verbose':_0x1d1fbe[_0x107913(0x19d)]});const _0x1065fb=buildMergedJourneyDef(_0xbb107b,_0x51eff5),_0xfe172d=normalizeJourneyDef(_0x1065fb,_0x215366),_0x2b39b7=toYamlString(_0xfe172d),_0x4f30d1=_0x5d5c15||a22_0x4530a1[_0x107913(0x183)](_0x59fe2e,sanitizeFileName(_0x57b09e)+'.yml');!_0x5d5c15&&_0x10dc70&&!existsSync(_0x59fe2e)&&mkdirSync(_0x59fe2e,{'recursive':!![]});const _0x503cf8=a22_0x4530a1[_0x107913(0x1a1)](process['cwd'](),_0x4f30d1);if(existsSync(_0x4f30d1)){const _0x1a903c=readFileSync(_0x4f30d1,_0x107913(0x185)),_0x1ea152=generateDiff(_0x1a903c,_0x2b39b7),_0x1a7751=hasChanges(_0x1ea152);_0x50b2c1[_0x107913(0x19a)]({'relativePath':_0x503cf8,'absolutePath':_0x4f30d1,'content':_0x2b39b7,'isNew':![],'hasChanges':_0x1a7751,'diff':_0x1a7751?formatDiffWithColors(_0x1ea152):undefined});}else _0x50b2c1[_0x107913(0x19a)]({'relativePath':_0x503cf8,'absolutePath':_0x4f30d1,'content':_0x2b39b7,'isNew':!![],'hasChanges':![]});}const _0x1669a6=_0x50b2c1['filter'](_0xeecc2b=>_0xeecc2b[_0x107913(0x168)]),_0x2dbec6=_0x50b2c1['filter'](_0x124570=>!_0x124570[_0x107913(0x168)]&&_0x124570[_0x107913(0x158)]),_0x18d985=_0x50b2c1[_0x107913(0x133)](_0x5c88e2=>!_0x5c88e2['isNew']&&!_0x5c88e2[_0x107913(0x158)]),_0xab0415=_0x684862['length'],_0x520d04=_0xf0438e[_0x107913(0x17f)],_0x1443f7=_0xab0415>_0x520d04?'\x20('+_0xab0415+_0x107913(0xd1):'';console[_0x107913(0x15b)](_0x107913(0x16d)),console['error']('\x20\x20'+a22_0x4d1c63[_0x107913(0x165)](_0x520d04+_0x107913(0x1af))+a22_0x4d1c63[_0x107913(0x173)](_0x1443f7)),console['error']('\x20\x20'+a22_0x4d1c63[_0x107913(0x188)]('+\x20'+_0x1669a6['length']+_0x107913(0x10c))),console[_0x107913(0x15b)]('\x20\x20'+a22_0x4d1c63['yellow']('~\x20'+_0x2dbec6[_0x107913(0x175)]+_0x107913(0x19e))),console[_0x107913(0x15b)]('\x20\x20'+a22_0x4d1c63['dim']('=\x20'+_0x18d985[_0x107913(0x175)]+_0x107913(0xf6))),console[_0x107913(0x15b)](_0x107913(0x1ab)+a22_0x4d1c63[_0x107913(0x165)](_0x3a4fd3)+'\x0a');if(_0x2dbec6['length']>0x0)for(const _0x4e86f2 of _0x2dbec6){console[_0x107913(0x15b)](_0x107913(0x1ac)+_0x4e86f2['relativePath']+'\x27:'),console[_0x107913(0x15b)]('─'[_0x107913(0xd6)](0x3c)),console[_0x107913(0x15b)](_0x4e86f2[_0x107913(0x16a)]),console[_0x107913(0x15b)]('─'['repeat'](0x3c));}if(_0x1be407[_0x107913(0x153)])return console[_0x107913(0x15b)](a22_0x4d1c63[_0x107913(0xdc)](_0x107913(0xdb))),0x0;if(_0x1669a6['length']===0x0&&_0x2dbec6[_0x107913(0x175)]===0x0)return console['error'](a22_0x4d1c63['green']('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x3e8adb},_0x1be407[_0x107913(0x163)]),console[_0x107913(0x15b)](a22_0x4d1c63[_0x107913(0x188)](_0x107913(0x18a)+a22_0x4d1c63[_0x107913(0x173)]('parent_segment')+_0x107913(0x146)+a22_0x4d1c63['cyan'](_0x3e8adb))),0x0;if(!_0x1be407[_0x107913(0xe4)]&&(_0x1669a6[_0x107913(0x175)]>0x0||_0x2dbec6['length']>0x0)){if(!isInteractive())return console[_0x107913(0x15b)](a22_0x4d1c63[_0x107913(0xe9)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a22_0x4d1c63[_0x107913(0x173)](_0x107913(0x125))),0x1;const _0x17a6c3=await confirmKey(_0x107913(0x195)+(_0x1669a6['length']+_0x2dbec6[_0x107913(0x175)])+_0x107913(0x13a));if(!_0x17a6c3)return console[_0x107913(0x15b)](a22_0x4d1c63[_0x107913(0xdc)](_0x107913(0x122)),_0x107913(0xea)),0x1;}!existsSync(_0x3a4fd3)&&mkdirSync(_0x3a4fd3,{'recursive':!![]});const _0x500095=a22_0x4530a1['join'](_0x3a4fd3,_0x107913(0x142));writeFileSync(_0x500095,createTdxConfigContent(_0x3e8adb),_0x107913(0x185));for(const _0x249261 of _0x50b2c1){(_0x249261['isNew']||_0x249261['hasChanges'])&&writeFileSync(_0x249261[_0x107913(0x1a0)],_0x249261[_0x107913(0x18d)],_0x107913(0x185));}return console[_0x107913(0x15b)](a22_0x4d1c63[_0x107913(0x188)]('✔\x20Pulled\x20'+(_0x1669a6[_0x107913(0x175)]+_0x2dbec6[_0x107913(0x175)])+_0x107913(0x192)+_0x3a4fd3)),saveSessionContext({'parent_segment':_0x3e8adb},_0x1be407['session']),console[_0x107913(0x15b)](a22_0x4d1c63[_0x107913(0x188)]('✔\x20Context\x20set:\x20'+a22_0x4d1c63[_0x107913(0x173)](_0x107913(0xf8))+'\x20=\x20'+a22_0x4d1c63[_0x107913(0x165)](_0x3e8adb))),0x0;}}export class JourneyColumnsCommand extends BaseCommand{[a22_0x9ba4d0(0xe0)]=a22_0x9ba4d0(0x186);[a22_0x9ba4d0(0x118)]=a22_0x9ba4d0(0x1c7);async['execute'](_0x2a1c7b){const _0x356fdb=a22_0x9ba4d0,{options:_0x32b0d7,args:_0x215ed7,tdx:_0x3c4bc2}=_0x2a1c7b,_0xfa242e=_0x215ed7[0x0];if(!requireNameOrPath(_0xfa242e))return 0x1;_0x32b0d7['verbose']&&console['error'](_0x356fdb(0x162)+_0xfa242e);const {journeyId:_0x4cb9ff}=await resolveJourneyIdFromInput(_0xfa242e,_0x32b0d7,_0x3c4bc2),_0x14e90b=await withSpinner(_0x356fdb(0x14c),()=>_0x3c4bc2[_0x356fdb(0x172)][_0x356fdb(0x19b)](_0x4cb9ff),{'verbose':_0x32b0d7['verbose']}),_0x356284=_0x14e90b[_0x356fdb(0xd7)];return console['log']('Database:\x20'+_0x356284['database']),console[_0x356fdb(0xfa)](_0x356fdb(0x121)+_0x356284[_0x356fdb(0xe3)]),await handleSDKOutput(_0x356284['columns'],_0x32b0d7),0x0;}}export class JourneyActivationsCommand extends BaseCommand{['name']=a22_0x9ba4d0(0x19f);[a22_0x9ba4d0(0x118)]=a22_0x9ba4d0(0x182);async[a22_0x9ba4d0(0x180)](_0x19c1d8){const _0x5c2c1d=a22_0x9ba4d0,{options:_0x22a056,args:_0x114623,tdx:_0x38056a}=_0x19c1d8,_0x482d0b=_0x114623[0x0];if(!requireNameOrPath(_0x482d0b))return 0x1;_0x22a056[_0x5c2c1d(0x19d)]&&console[_0x5c2c1d(0x15b)](_0x5c2c1d(0x162)+_0x482d0b);const {journeyId:_0x37b024}=await resolveJourneyIdFromInput(_0x482d0b,_0x22a056,_0x38056a),_0x1c5a2b=await withSpinner(_0x5c2c1d(0x197),()=>_0x38056a[_0x5c2c1d(0x172)][_0x5c2c1d(0xc3)](_0x37b024),{'verbose':_0x22a056['verbose']}),_0x1cf1d0=_0x1c5a2b['data'];return console[_0x5c2c1d(0x15b)](_0x5c2c1d(0xcc)+_0x1cf1d0['length']+_0x5c2c1d(0x12d)+(_0x1cf1d0[_0x5c2c1d(0x175)]!==0x1?'s':'')),await handleSDKOutput(_0x1cf1d0,_0x22a056),0x0;}}export class JourneyPushCommand extends BaseCommand{['name']=a22_0x9ba4d0(0x1ca);[a22_0x9ba4d0(0x118)]='Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data';[a22_0x9ba4d0(0xe5)]=new SegmentPushCommand();async['execute'](_0x5721a3){const _0x32e0cb=a22_0x9ba4d0,_0x79ab70=_0x5721a3[_0x32e0cb(0x12e)][0x0];let _0x357d9d;if(_0x79ab70){const _0x1b08a2=await resolveTarget({'arg':_0x79ab70,'contextParent':_0x5721a3['options'][_0x32e0cb(0x1b7)],'cwd':process[_0x32e0cb(0x12f)]()});isSuccessfulResolution(_0x1b08a2)&&_0x1b08a2[_0x32e0cb(0x141)]===_0x32e0cb(0x12c)&&(_0x357d9d=_0x1b08a2[_0x32e0cb(0x1b8)]);}const _0x94f7db={..._0x5721a3,'options':{..._0x5721a3['options'],'journeysOnly':!![],..._0x357d9d&&{'singleFilePath':_0x357d9d}}};return this[_0x32e0cb(0xe5)]['execute'](_0x94f7db);}}export class JourneyVersionsCommand extends BaseCommand{[a22_0x9ba4d0(0xe0)]=a22_0x9ba4d0(0x16f);['description']=a22_0x9ba4d0(0xdf);async[a22_0x9ba4d0(0x180)](_0x249fe2){const _0x34ce1b=a22_0x9ba4d0,{options:_0x21fb90,args:_0x4526b0,tdx:_0x278a7e}=_0x249fe2,_0x21fa04=_0x4526b0[0x0];if(!requireNameOrPath(_0x21fa04))return 0x1;if(_0x21fb90[_0x34ce1b(0x19d)])console[_0x34ce1b(0x15b)](_0x34ce1b(0x162)+_0x21fa04);const {journeyId:_0x1ef7d7}=await resolveJourneyIdFromInput(_0x21fa04,_0x21fb90,_0x278a7e),_0x274195=await withSpinner('Listing\x20journey\x20versions...',()=>_0x278a7e[_0x34ce1b(0x172)][_0x34ce1b(0xef)](_0x1ef7d7),{'verbose':_0x21fb90[_0x34ce1b(0x19d)]}),{bundleName:_0x2e2710,versions:_0x54c2cb,latestJourneyId:_0x17a628}=_0x274195[_0x34ce1b(0xd7)];console[_0x34ce1b(0x15b)](_0x2e2710+':\x20'+_0x54c2cb[_0x34ce1b(0x175)]+_0x34ce1b(0x14b)+(_0x54c2cb['length']!==0x1?'s':''));const _0x18a28c=_0x54c2cb[_0x34ce1b(0x1a4)](_0x2dc9a9=>({'version':_0x2dc9a9['versionNumber'],'journey_id':_0x2dc9a9[_0x34ce1b(0x136)],'name':_0x2dc9a9[_0x34ce1b(0xe0)],'state':_0x2dc9a9['state'],'paused':_0x2dc9a9[_0x34ce1b(0x11a)],'latest':_0x2dc9a9['journeyId']===_0x17a628,'created_at':_0x2dc9a9[_0x34ce1b(0x17b)]}));return await handleSDKOutput(_0x18a28c,_0x21fb90),0x0;}}export class JourneyVersionCreateCommand extends BaseCommand{[a22_0x9ba4d0(0xe0)]=a22_0x9ba4d0(0xeb);['description']='Create\x20a\x20new\x20draft\x20version\x20of\x20a\x20journey';async[a22_0x9ba4d0(0x180)](_0x53b280){const _0xe3fd37=a22_0x9ba4d0,{options:_0x20eb22,args:_0x308184,tdx:_0x25fdaa}=_0x53b280,_0x419cf7=_0x308184[0x0];if(!requireNameOrPath(_0x419cf7))return 0x1;if(_0x20eb22[_0xe3fd37(0x19d)])console['error'](_0xe3fd37(0x162)+_0x419cf7);const {journeyId:_0x35d93f,journeyName:_0x3a52d6}=await resolveJourneyIdFromInput(_0x419cf7,_0x20eb22,_0x25fdaa);if(!_0x20eb22['yes']){const _0x2fd1ca=await confirm(_0xe3fd37(0xf3)+_0x3a52d6+'\x22?');if(!_0x2fd1ca)return console[_0xe3fd37(0x15b)](_0xe3fd37(0xe2)),0x0;}const _0x28852a=await withSpinner(_0xe3fd37(0x190),()=>_0x25fdaa['journey'][_0xe3fd37(0xdd)](_0x35d93f),{'verbose':_0x20eb22[_0xe3fd37(0x19d)]}),_0x3cc6da=_0x28852a[_0xe3fd37(0xd7)];return console[_0xe3fd37(0x15b)](a22_0x4d1c63['green']('✔')+_0xe3fd37(0x101)+_0x3cc6da[_0xe3fd37(0x143)][_0xe3fd37(0xda)]+_0xe3fd37(0x1cc)+_0x3cc6da[_0xe3fd37(0x143)]['name']+'\x22'),console['error'](_0xe3fd37(0xc7)+_0x3cc6da['id']),await handleSingleObjectOutput({'id':_0x3cc6da['id'],'name':_0x3cc6da[_0xe3fd37(0x143)][_0xe3fd37(0xe0)],'version':_0x3cc6da[_0xe3fd37(0x143)][_0xe3fd37(0xda)],'state':_0x3cc6da[_0xe3fd37(0x143)][_0xe3fd37(0xcf)],'bundle_id':_0x3cc6da[_0xe3fd37(0x143)][_0xe3fd37(0x1d0)],'created_at':_0x3cc6da[_0xe3fd37(0x143)][_0xe3fd37(0x17b)]},_0x20eb22),0x0;}}export class JourneyVersionViewCommand extends BaseCommand{[a22_0x9ba4d0(0xe0)]=a22_0x9ba4d0(0x191);[a22_0x9ba4d0(0x118)]=a22_0x9ba4d0(0x1ae);async[a22_0x9ba4d0(0x180)](_0x249801){const _0x276559=a22_0x9ba4d0,{options:_0x3c9cde,args:_0x150f44,tdx:_0x1748e0}=_0x249801,_0x1ffc59=_0x150f44[0x0];if(!requireNameOrPath(_0x1ffc59))return 0x1;const _0x4ed2b=_0x3c9cde[_0x276559(0x145)];if(!_0x4ed2b)return console[_0x276559(0x15b)]('Error:\x20--version\x20option\x20is\x20required'),console[_0x276559(0x15b)](_0x276559(0x129)),0x1;const _0x251f43=parseInt(_0x4ed2b,0xa);if(isNaN(_0x251f43)||_0x251f43<0x1)return console[_0x276559(0x15b)](_0x276559(0xf9)+_0x4ed2b),0x1;if(_0x3c9cde[_0x276559(0x19d)])console[_0x276559(0x15b)](_0x276559(0x162)+_0x1ffc59+_0x276559(0x132)+_0x251f43);const {journeyId:_0x4f43b2,parentSegmentId:_0x3b19fe}=await resolveJourneyIdFromInput(_0x1ffc59,_0x3c9cde,_0x1748e0),_0x536c41=await withSpinner(_0x276559(0x189),()=>_0x1748e0[_0x276559(0x172)]['listVersions'](_0x4f43b2),{'verbose':_0x3c9cde['verbose']}),{versions:_0xa99021,latestJourneyId:_0x257c0b}=_0x536c41[_0x276559(0xd7)],_0x150a33=_0xa99021[_0x276559(0x140)](_0x2c2dd2=>_0x2c2dd2['versionNumber']===_0x251f43);if(!_0x150a33){const _0x1e6c5d=_0xa99021['map'](_0x1637f8=>'v'+_0x1637f8[_0x276559(0xda)])[_0x276559(0x183)](',\x20');return console[_0x276559(0x15b)](_0x276559(0xc6)+_0x251f43+'\x20not\x20found.\x20Available:\x20'+_0x1e6c5d),0x1;}const _0x154838=await withSpinner('Getting\x20version\x20'+_0x251f43+_0x276559(0x135),()=>_0x1748e0[_0x276559(0x172)][_0x276559(0x11f)](_0x150a33[_0x276559(0x136)]),{'verbose':_0x3c9cde[_0x276559(0x19d)]}),_0x5a4d14=_0x154838[_0x276559(0xd7)],_0x14dba3=getConsoleNextUrl(_0x3c9cde[_0x276559(0x1b0)],_0x276559(0x10b)+_0x3b19fe+_0x276559(0x157)+_0x150a33['journeyId']+_0x276559(0x1b9));return await handleSingleObjectOutput({'id':_0x5a4d14['id'],'name':_0x5a4d14[_0x276559(0x143)][_0x276559(0xe0)],'version':_0x5a4d14[_0x276559(0x143)][_0x276559(0xda)],'description':_0x5a4d14['attributes'][_0x276559(0x118)],'state':_0x5a4d14[_0x276559(0x143)][_0x276559(0xcf)],'paused':_0x5a4d14[_0x276559(0x143)][_0x276559(0x11a)],'reentry_mode':_0x5a4d14[_0x276559(0x143)][_0x276559(0xf5)],'stages':_0x5a4d14[_0x276559(0x143)][_0x276559(0x107)]?.[_0x276559(0x175)]||0x0,..._0x5a4d14[_0x276559(0x143)][_0x276559(0x18c)]&&{'goal':_0x5a4d14[_0x276559(0x143)][_0x276559(0x18c)][_0x276559(0xe0)]},'latest':_0x150a33[_0x276559(0x136)]===_0x257c0b,'created_at':_0x5a4d14[_0x276559(0x143)]['createdAt'],'updated_at':_0x5a4d14[_0x276559(0x143)][_0x276559(0x130)],'url':_0x14dba3},_0x3c9cde),0x0;}}