@treasuredata/tdx 2026.8.0 → 2026.8.2

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 (263) 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.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.d.ts +9 -0
  12. package/dist/commands/auth-command.d.ts.map +1 -1
  13. package/dist/commands/auth-command.js +1 -1
  14. package/dist/commands/auth-command.js.map +1 -1
  15. package/dist/commands/cas-command.js +1 -1
  16. package/dist/commands/cas-segment-command.js +1 -1
  17. package/dist/commands/chat-command.js +1 -1
  18. package/dist/commands/claude-command.d.ts +10 -1
  19. package/dist/commands/claude-command.d.ts.map +1 -1
  20. package/dist/commands/claude-command.js +1 -1
  21. package/dist/commands/claude-command.js.map +1 -1
  22. package/dist/commands/claude-statusline-command.js +1 -1
  23. package/dist/commands/claude-usage-command.js +1 -1
  24. package/dist/commands/command.js +1 -1
  25. package/dist/commands/connection-command.js +1 -1
  26. package/dist/commands/databases.js +1 -1
  27. package/dist/commands/delivery-command.js +1 -1
  28. package/dist/commands/describe.js +1 -1
  29. package/dist/commands/engage-always-on-campaign-pull-command.js +1 -1
  30. package/dist/commands/engage-always-on-campaign-push-command.js +1 -1
  31. package/dist/commands/engage-always-on-campaign-validate-command.js +1 -1
  32. package/dist/commands/engage-campaign-pull-command.js +1 -1
  33. package/dist/commands/engage-campaign-push-command.js +1 -1
  34. package/dist/commands/engage-campaign-validate-command.js +1 -1
  35. package/dist/commands/engage-command.js +1 -1
  36. package/dist/commands/engage-template-pull-command.js +1 -1
  37. package/dist/commands/engage-template-push-command.js +1 -1
  38. package/dist/commands/engage-template-validate-command.js +1 -1
  39. package/dist/commands/job-command.js +1 -1
  40. package/dist/commands/journey-command.js +1 -1
  41. package/dist/commands/journey-validate-command.js +1 -1
  42. package/dist/commands/llm-command.js +1 -1
  43. package/dist/commands/mcp-command.js +1 -1
  44. package/dist/commands/parent-segment-command.js +1 -1
  45. package/dist/commands/policy-command.js +1 -1
  46. package/dist/commands/profile-command.js +1 -1
  47. package/dist/commands/profiles-command.js +1 -1
  48. package/dist/commands/query-command.js +1 -1
  49. package/dist/commands/schedule-command.js +1 -1
  50. package/dist/commands/segment-command.js +1 -1
  51. package/dist/commands/segment-create-command.js +1 -1
  52. package/dist/commands/segment-fields-command.js +1 -1
  53. package/dist/commands/segment-move-command.js +1 -1
  54. package/dist/commands/segment-pull-command.js +1 -1
  55. package/dist/commands/segment-push-command.js +1 -1
  56. package/dist/commands/segment-update-command.js +1 -1
  57. package/dist/commands/segment-use-command.js +1 -1
  58. package/dist/commands/segment-validate-command.js +1 -1
  59. package/dist/commands/segments.js +1 -1
  60. package/dist/commands/show.js +1 -1
  61. package/dist/commands/status-command.js +1 -1
  62. package/dist/commands/table-deleted.js +1 -1
  63. package/dist/commands/tables.js +1 -1
  64. package/dist/commands/unset-command.js +1 -1
  65. package/dist/commands/upgrade-command.js +1 -1
  66. package/dist/commands/use-command.js +1 -1
  67. package/dist/commands/user-command.js +1 -1
  68. package/dist/commands/work-command.js +1 -1
  69. package/dist/commands/workflow-command.js +1 -1
  70. package/dist/core/auth.js +1 -1
  71. package/dist/core/command-output.js +1 -1
  72. package/dist/core/config.js +1 -1
  73. package/dist/core/connection-cache.js +1 -1
  74. package/dist/core/constants.js +1 -1
  75. package/dist/core/credential-cache.js +1 -1
  76. package/dist/core/global-context.js +1 -1
  77. package/dist/core/keychain.js +1 -1
  78. package/dist/core/oauth-keychain.js +1 -1
  79. package/dist/core/oauth.js +1 -1
  80. package/dist/core/profile.js +1 -1
  81. package/dist/core/project-config.js +1 -1
  82. package/dist/core/session.js +1 -1
  83. package/dist/core/site-mismatch.js +1 -1
  84. package/dist/core/user-cache.js +1 -1
  85. package/dist/core/version.js +1 -1
  86. package/dist/index.js +1 -1
  87. package/dist/mcp/server.js +1 -1
  88. package/dist/mcp/tools/index.js +1 -1
  89. package/dist/mcp/tools/tdx-run.js +1 -1
  90. package/dist/mcp/tools/tdx-search.js +1 -1
  91. package/dist/mcp/tools/work-create-item.js +1 -1
  92. package/dist/mcp/utils.js +1 -1
  93. package/dist/proxy/claude-usage-tracker.js +1 -1
  94. package/dist/proxy/passthrough-server.js +1 -1
  95. package/dist/proxy/sse-usage-parser.js +1 -1
  96. package/dist/sdk/agent/agent-config.js +1 -1
  97. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  98. package/dist/sdk/agent/agent-yaml.js +1 -1
  99. package/dist/sdk/agent/test/evaluator.js +1 -1
  100. package/dist/sdk/agent/test/executor.js +1 -1
  101. package/dist/sdk/agent/test/index.js +1 -1
  102. package/dist/sdk/agent/test/output.js +1 -1
  103. package/dist/sdk/agent/test/parser.js +1 -1
  104. package/dist/sdk/agent/tool-target-registry.js +1 -1
  105. package/dist/sdk/api.js +1 -1
  106. package/dist/sdk/auth-token.d.ts +23 -0
  107. package/dist/sdk/auth-token.d.ts.map +1 -0
  108. package/dist/sdk/auth-token.js +1 -0
  109. package/dist/sdk/auth-token.js.map +1 -0
  110. package/dist/sdk/cas/cas-api-client.js +1 -1
  111. package/dist/sdk/cas/cas-audience-schema.d.ts +2 -0
  112. package/dist/sdk/cas/cas-audience-schema.d.ts.map +1 -1
  113. package/dist/sdk/cas/cas-audience-schema.js +1 -1
  114. package/dist/sdk/cas/cas-audience-schema.js.map +1 -1
  115. package/dist/sdk/cas/cas-audience-validator.js +1 -1
  116. package/dist/sdk/cas/cas-audience-yaml.d.ts.map +1 -1
  117. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  118. package/dist/sdk/cas/cas-audience-yaml.js.map +1 -1
  119. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  120. package/dist/sdk/cas/index.js +1 -1
  121. package/dist/sdk/cas/pull-workflow.js +1 -1
  122. package/dist/sdk/cas/push-workflow.d.ts.map +1 -1
  123. package/dist/sdk/cas/push-workflow.js +1 -1
  124. package/dist/sdk/cas/push-workflow.js.map +1 -1
  125. package/dist/sdk/cas/types.d.ts +2 -0
  126. package/dist/sdk/cas/types.d.ts.map +1 -1
  127. package/dist/sdk/cas/validate-files.js +1 -1
  128. package/dist/sdk/client/cdp-api-client.js +1 -1
  129. package/dist/sdk/client/delivery-api-client.js +1 -1
  130. package/dist/sdk/client/endpoints.js +1 -1
  131. package/dist/sdk/client/engage-api-client.js +1 -1
  132. package/dist/sdk/client/http-client.js +1 -1
  133. package/dist/sdk/client/llm-api-client.js +1 -1
  134. package/dist/sdk/client/oauth-refresh.js +1 -1
  135. package/dist/sdk/client/rate-limiter.js +1 -1
  136. package/dist/sdk/client/td-api-client.js +1 -1
  137. package/dist/sdk/client/trino-api-client.js +1 -1
  138. package/dist/sdk/client/workflow-client.js +1 -1
  139. package/dist/sdk/connection-validator.js +1 -1
  140. package/dist/sdk/connection.js +1 -1
  141. package/dist/sdk/delivery.js +1 -1
  142. package/dist/sdk/engage/always-on-campaign-pull.js +1 -1
  143. package/dist/sdk/engage/always-on-campaign-push.js +1 -1
  144. package/dist/sdk/engage/always-on-campaign-validator.js +1 -1
  145. package/dist/sdk/engage/always-on-campaign-yaml.js +1 -1
  146. package/dist/sdk/engage/campaign-pull.js +1 -1
  147. package/dist/sdk/engage/campaign-push.js +1 -1
  148. package/dist/sdk/engage/campaign-validator.js +1 -1
  149. package/dist/sdk/engage/campaign-yaml.js +1 -1
  150. package/dist/sdk/engage/template-pull.js +1 -1
  151. package/dist/sdk/engage/template-push.js +1 -1
  152. package/dist/sdk/engage/template-validator.js +1 -1
  153. package/dist/sdk/engage/template-yaml.js +1 -1
  154. package/dist/sdk/engage/types/always-on-campaign-schema.js +1 -1
  155. package/dist/sdk/engage/types/campaign-def.js +1 -1
  156. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  157. package/dist/sdk/engage/types/template-schema.js +1 -1
  158. package/dist/sdk/engage.js +1 -1
  159. package/dist/sdk/errors.js +1 -1
  160. package/dist/sdk/index.js +1 -1
  161. package/dist/sdk/io/index.js +1 -1
  162. package/dist/sdk/io/node-filesystem.js +1 -1
  163. package/dist/sdk/job.js +1 -1
  164. package/dist/sdk/journey.js +1 -1
  165. package/dist/sdk/llm/chat-cache.js +1 -1
  166. package/dist/sdk/llm/index.js +1 -1
  167. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  168. package/dist/sdk/llm/model-factors.js +1 -1
  169. package/dist/sdk/llm/user-settings.js +1 -1
  170. package/dist/sdk/personalization.js +1 -1
  171. package/dist/sdk/policy.js +1 -1
  172. package/dist/sdk/query/deleted-table-validation.js +1 -1
  173. package/dist/sdk/query/index.js +1 -1
  174. package/dist/sdk/query/sql-parser.js +1 -1
  175. package/dist/sdk/realtime.js +1 -1
  176. package/dist/sdk/schedule.js +1 -1
  177. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  178. package/dist/sdk/segment/fields-display.js +1 -1
  179. package/dist/sdk/segment/file-discovery.js +1 -1
  180. package/dist/sdk/segment/journey-utils.js +1 -1
  181. package/dist/sdk/segment/journey-validator.js +1 -1
  182. package/dist/sdk/segment/journey-yaml.js +1 -1
  183. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  184. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  185. package/dist/sdk/segment/pull-workflow.js +1 -1
  186. package/dist/sdk/segment/push-recovery.js +1 -1
  187. package/dist/sdk/segment/push-workflow.js +1 -1
  188. package/dist/sdk/segment/resolution-context.js +1 -1
  189. package/dist/sdk/segment/segment-path-parser.js +1 -1
  190. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  191. package/dist/sdk/segment/segment-validator.js +1 -1
  192. package/dist/sdk/segment/target-resolution.js +1 -1
  193. package/dist/sdk/segment/tdx-config.js +1 -1
  194. package/dist/sdk/segment/types/activation-schema.js +1 -1
  195. package/dist/sdk/segment/types/journey-def.js +1 -1
  196. package/dist/sdk/segment/types/journey-schema.js +1 -1
  197. package/dist/sdk/segment/types/segment-def.js +1 -1
  198. package/dist/sdk/segment/types/segment-schema.js +1 -1
  199. package/dist/sdk/segment/validate-files.js +1 -1
  200. package/dist/sdk/segment/yaml-validator.js +1 -1
  201. package/dist/sdk/segment.js +1 -1
  202. package/dist/sdk/types/cas.d.ts +4 -0
  203. package/dist/sdk/types/cas.d.ts.map +1 -1
  204. package/dist/sdk/types/index.js +1 -1
  205. package/dist/sdk/types/progress.js +1 -1
  206. package/dist/sdk/types/workspace.js +1 -1
  207. package/dist/sdk/user.js +1 -1
  208. package/dist/sdk/util/format-detector.js +1 -1
  209. package/dist/sdk/util/formatters.js +1 -1
  210. package/dist/sdk/util/index.js +1 -1
  211. package/dist/sdk/util/paginate.js +1 -1
  212. package/dist/sdk/util/tree-formatter.js +1 -1
  213. package/dist/sdk/util/tree-search.js +1 -1
  214. package/dist/sdk/workflow/archive-validation.js +1 -1
  215. package/dist/sdk/workflow/clone-workflow.js +1 -1
  216. package/dist/sdk/workflow/index.js +1 -1
  217. package/dist/sdk/workflow/pull-workflow.js +1 -1
  218. package/dist/sdk/workflow/push-workflow.js +1 -1
  219. package/dist/sdk/workflow/task-graph.js +1 -1
  220. package/dist/sdk/workflow/tdx-config.js +1 -1
  221. package/dist/sdk/workflow/workflow-utils.js +1 -1
  222. package/dist/sdk/workspace/access-tracker.js +1 -1
  223. package/dist/sdk/workspace/frontmatter.js +1 -1
  224. package/dist/sdk/workspace/git.js +1 -1
  225. package/dist/sdk/workspace/index.js +1 -1
  226. package/dist/sdk/workspace/templates.js +1 -1
  227. package/dist/sdk/workspace/weekly.js +1 -1
  228. package/dist/sdk/workspace/wikilinks.js +1 -1
  229. package/dist/test-utils/command-runner.js +1 -1
  230. package/dist/test-utils/factories.js +1 -1
  231. package/dist/test-utils/fixtures.js +1 -1
  232. package/dist/test-utils/http-mock.js +1 -1
  233. package/dist/test-utils/index.js +1 -1
  234. package/dist/utils/async.js +1 -1
  235. package/dist/utils/claude-code-state.js +1 -1
  236. package/dist/utils/colors.js +1 -1
  237. package/dist/utils/diff.js +1 -1
  238. package/dist/utils/file-permissions.js +1 -1
  239. package/dist/utils/file-reader.js +1 -1
  240. package/dist/utils/github-releases.js +1 -1
  241. package/dist/utils/global-cache.js +1 -1
  242. package/dist/utils/json-loader.js +1 -1
  243. package/dist/utils/local-cache.js +1 -1
  244. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  245. package/dist/utils/logger/formatters/index.js +1 -1
  246. package/dist/utils/logger/handlers/console-handler.js +1 -1
  247. package/dist/utils/logger/handlers/file-handler.js +1 -1
  248. package/dist/utils/logger/handlers/index.js +1 -1
  249. package/dist/utils/logger/handlers/null-handler.js +1 -1
  250. package/dist/utils/logger/index.js +1 -1
  251. package/dist/utils/logger/logger.js +1 -1
  252. package/dist/utils/logger/types.js +1 -1
  253. package/dist/utils/option-validation.js +1 -1
  254. package/dist/utils/process.js +1 -1
  255. package/dist/utils/prompt.js +1 -1
  256. package/dist/utils/proxy-fetch.js +1 -1
  257. package/dist/utils/spinner.js +1 -1
  258. package/dist/utils/sse-parser.js +1 -1
  259. package/dist/utils/string-utils.js +1 -1
  260. package/dist/utils/table-ref-parser.js +1 -1
  261. package/dist/utils/tdx-logger.js +1 -1
  262. package/dist/utils/version-check.js +1 -1
  263. package/package.json +1 -1
@@ -1 +1 @@
1
- const a43_0x5d194c=a43_0x2015;function a43_0x2015(_0x48b77a,_0x4b6d5d){_0x48b77a=_0x48b77a-0x8e;const _0x2ff93d=a43_0x2ff9();let _0x2015ce=_0x2ff93d[_0x48b77a];return _0x2015ce;}(function(_0x4a6ddb,_0x171ba8){const _0x37ae78=a43_0x2015,_0x163d5b=_0x4a6ddb();while(!![]){try{const _0x54ccee=parseInt(_0x37ae78(0xa8))/0x1*(parseInt(_0x37ae78(0xb5))/0x2)+-parseInt(_0x37ae78(0xb4))/0x3*(-parseInt(_0x37ae78(0xd0))/0x4)+parseInt(_0x37ae78(0x9a))/0x5+-parseInt(_0x37ae78(0x9e))/0x6+-parseInt(_0x37ae78(0xc9))/0x7*(-parseInt(_0x37ae78(0xcb))/0x8)+parseInt(_0x37ae78(0x98))/0x9*(parseInt(_0x37ae78(0xa1))/0xa)+-parseInt(_0x37ae78(0x92))/0xb;if(_0x54ccee===_0x171ba8)break;else _0x163d5b['push'](_0x163d5b['shift']());}catch(_0x41e616){_0x163d5b['push'](_0x163d5b['shift']());}}}(a43_0x2ff9,0xc8da3));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{searchTreeByName}from'../sdk/util/tree-search.js';function a43_0x2ff9(){const _0x1169a5=['\x20\x20(id\x20','4383888wAaipY','5566tibzXA','\x20\x20•\x20','Searching\x20the\x20tree...','moveSegments','\x27...','red','set','join','parentSegment','\x27\x20isn\x27t\x20at\x20the\x20top\x20level\x20—\x20it\x27s\x20nested\x20at:','filter','\x20segment','\x20segments\x20—\x20refusing\x20to\x20guess.\x20Pass\x20the\x20full\x20path\x20(or\x20id)\x20of\x20the\x20one\x20you\x20mean:','green','Searching\x20folders\x20for\x20\x27','\x27,\x20\x27','explainAmbiguousName','Set\x20context:\x20\x20\x20tdx\x20use\x20parent_segment\x20\x22<name>\x22','listRecursive','ruleConditionCount','9849840ixWUts','has','8GcNHof','segmentFolderId','Or\x20use\x20IDs:\x20\x20\x20\x20tdx\x20sg\x20list\x20-r\x20--json\x20\x20(then\x20pass\x20the\x20numeric\x20ids)','test','\x20\x20tdx\x20segment\x20move\x201603887\x20--folder\x208299501','4LypXGN','\x0aTip:\x20run\x20`tdx\x20segment\x20list\x20-r`\x20to\x20find\x20segment\x20and\x20folder\x20names/IDs.','cyan','resolvePathToResource','toLowerCase','error','parentId','name','verbose','yellow','slot','\x27\x20—\x20','push','length','33404965WeslrQ','\x27\x20to\x20folder\x20\x27','\x27\x20matches\x20','Checking','map','data','9LZENkU','Error:\x20at\x20least\x20one\x20<segment>\x20and\x20--folder\x20<folder>\x20are\x20required\x0a','4606965WwuIHT','Duplicate\x20segments\x20removed\x20(','\x20segments\x20moved,\x20all\x20rules\x20verified\x20intact','rule\x20','8422626nLTXKk','get','segment','8305950oomCzV','Examples:','\x20segment(s)\x20would\x20be\x20moved.','Error:\x20no\x20parent\x20segment\x20context\x20—\x20moving\x20by\x20name\x20needs\x20one.\x0a','Re-run\x20`tdx\x20sg\x20move`\x20with\x20that\x20full\x20path\x20(or\x20the\x20id).','\x20\x20tdx\x20segment\x20move\x201603887\x201603888\x201603889\x20--folder\x208299501','description','231sCgCHM','\x20folder\x20\x27','type','\x20condition','forEach','code','Or\x20pass\x20flag:\x20\x20--parent-segment\x20\x22<name>\x22','folder','resolveEntitiesInParent','includes','some'];a43_0x2ff9=function(){return _0x1169a5;};return a43_0x2ff9();}import a43_0x4afdb3 from'chalk';export class SegmentMoveCommand extends BaseCommand{['name']='segment:move';[a43_0x5d194c(0xa7)]='Move\x20one\x20or\x20more\x20segments\x20to\x20a\x20different\x20folder';async['execute'](_0x499128){const _0x1e13eb=a43_0x5d194c,{options:_0xc46113,args:_0x161541,tdx:_0x262477}=_0x499128,_0x5b630b=_0x161541,_0x1fe9e5=_0xc46113[_0x1e13eb(0xaf)];if(_0x5b630b[_0x1e13eb(0x91)]===0x0||!_0x1fe9e5)return console[_0x1e13eb(0xd5)](a43_0x4afdb3[_0x1e13eb(0xba)](_0x1e13eb(0x99))),console['error']('Usage:\x20tdx\x20segment\x20move\x20<segment...>\x20--folder\x20<folder>'),console[_0x1e13eb(0xd5)](_0x1e13eb(0xa2)),console[_0x1e13eb(0xd5)](_0x1e13eb(0xcf)),console[_0x1e13eb(0xd5)](_0x1e13eb(0xa6)),console['error']('\x20\x20tdx\x20segment\x20move\x20\x22VIP\x20Customers\x22\x20--folder\x20\x22Archive\x22\x20\x20\x20#\x20by\x20name\x20(needs\x20parent\x20context)'),console[_0x1e13eb(0xd5)](_0x1e13eb(0xd1)),0x1;_0xc46113['verbose']&&(console[_0x1e13eb(0xd5)]('Segments:\x20'+_0x5b630b['join'](',\x20')),console['error']('Target\x20folder:\x20'+_0x1fe9e5));const _0x43e35d=[...new Set(_0x5b630b)];_0x43e35d['length']<_0x5b630b[_0x1e13eb(0x91)]&&console['error'](a43_0x4afdb3[_0x1e13eb(0xd9)](_0x1e13eb(0x9b)+_0x5b630b[_0x1e13eb(0x91)]+'\x20→\x20'+_0x43e35d[_0x1e13eb(0x91)]+').'));const _0x11db16=/^\d+$/,_0x500559=_0xc46113[_0x1e13eb(0xbd)],_0x4be19d=[..._0x43e35d,_0x1fe9e5][_0x1e13eb(0xb2)](_0x29df4b=>!_0x11db16['test'](_0x29df4b));if(_0x4be19d&&!_0x500559)return console[_0x1e13eb(0xd5)](a43_0x4afdb3[_0x1e13eb(0xba)](_0x1e13eb(0xa4))),console[_0x1e13eb(0xd5)](_0x1e13eb(0xc6)),console['error'](_0x1e13eb(0xae)),console[_0x1e13eb(0xd5)](_0x1e13eb(0xcd)),0x1;const _0x1e4510=_0x43e35d['length'],_0x1b021c=_0xc46113['dryRun']===!![];let _0x1144e2;try{const _0x342152=await withSpinner((_0x1b021c?_0x1e13eb(0x95):'Moving')+'\x20'+_0x1e4510+_0x1e13eb(0xc0)+(_0x1e4510===0x1?'':'s')+'\x20'+((_0x1b021c?'for\x20move\x20to':'to')+_0x1e13eb(0xa9)+_0x1fe9e5+_0x1e13eb(0xb9)),async()=>{const _0x297bb7=_0x1e13eb,_0x53f67c=[];_0x43e35d[_0x297bb7(0xac)]((_0x6c27ec,_0x2bdf75)=>{const _0x5d7f6d=_0x297bb7;if(!_0x11db16['test'](_0x6c27ec))_0x53f67c[_0x5d7f6d(0x90)]({'name':_0x6c27ec,'expectType':_0x5d7f6d(0xa0),'slot':_0x2bdf75});});if(!_0x11db16[_0x297bb7(0xce)](_0x1fe9e5))_0x53f67c[_0x297bb7(0x90)]({'name':_0x1fe9e5,'expectType':_0x297bb7(0xaf),'slot':-0x1});const _0x51e2cb=new Map();if(_0x53f67c[_0x297bb7(0x91)]>0x0){const _0x1d0db0=await _0x262477[_0x297bb7(0xa0)][_0x297bb7(0xb0)](_0x500559,_0x53f67c[_0x297bb7(0x96)](({name:_0x47f117,expectType:_0x2eecce})=>({'name':_0x47f117,'expectType':_0x2eecce})));_0x1d0db0['forEach']((_0x12e176,_0x11bfec)=>_0x51e2cb[_0x297bb7(0xbb)](_0x53f67c[_0x11bfec][_0x297bb7(0x8e)],_0x12e176['id']));}const _0x416142=_0x43e35d['map']((_0x57ce4a,_0x29672e)=>_0x11db16[_0x297bb7(0xce)](_0x57ce4a)?_0x57ce4a:_0x51e2cb[_0x297bb7(0x9f)](_0x29672e)),_0x22dc5a=_0x11db16[_0x297bb7(0xce)](_0x1fe9e5)?_0x1fe9e5:_0x51e2cb['get'](-0x1);return _0x262477['segment'][_0x297bb7(0xb8)](_0x416142,_0x22dc5a,_0x1b021c);},{'verbose':_0xc46113[_0x1e13eb(0xd8)]});_0x1144e2=_0x342152['data'];}catch(_0x2fc209){if(_0x2fc209 instanceof SDKError&&_0x2fc209[_0x1e13eb(0xad)]===ErrorCode['SEGMENT_NOT_FOUND']&&_0x500559)try{if(await this[_0x1e13eb(0xc5)](_0x262477,_0x500559,_0x43e35d,_0xc46113))return 0x1;}catch{}throw _0x2fc209;}for(const _0x1895f8 of _0x1144e2){const _0x1a7608=_0x1895f8[_0x1e13eb(0xc8)],_0x48cbe5=_0x1e13eb(0x9d)+(_0x1b021c?_0x1e13eb(0xca):'preserved:')+'\x20'+_0x1a7608+_0x1e13eb(0xab)+(_0x1a7608===0x1?'':'s');console['error'](_0x1b021c?a43_0x4afdb3[_0x1e13eb(0xd2)]('•\x20[dry-run]\x20Would\x20move\x20segment\x20\x27'+_0x1895f8['id']+_0x1e13eb(0x93)+_0x1895f8[_0x1e13eb(0xcc)]+'\x27\x20—\x20'+_0x48cbe5):a43_0x4afdb3['green']('✔\x20Moved\x20segment\x20\x27'+_0x1895f8['id']+_0x1e13eb(0x93)+_0x1895f8[_0x1e13eb(0xcc)]+_0x1e13eb(0x8f)+_0x48cbe5+'\x20(verified\x20by\x20re-read)'));}if(_0x1b021c)console['error'](a43_0x4afdb3[_0x1e13eb(0xd2)]('[dry-run]\x20No\x20changes\x20made.\x20'+_0x1e4510+_0x1e13eb(0xa3)));else _0x1144e2[_0x1e13eb(0x91)]>0x1&&console[_0x1e13eb(0xd5)](a43_0x4afdb3[_0x1e13eb(0xc2)]('✔\x20'+_0x1144e2['length']+_0x1e13eb(0x9c)));return await handleSDKOutput(_0x1144e2,_0xc46113),0x0;}async[a43_0x5d194c(0xc5)](_0x2da4ee,_0x1bf9f2,_0x3969a7,_0x5edde8){const _0x19fdb6=a43_0x5d194c,_0x515789=_0x3969a7[_0x19fdb6(0xbf)](_0x189e1c=>!/^\d+$/['test'](_0x189e1c)&&!_0x189e1c[_0x19fdb6(0xb1)]('/'));if(_0x515789[_0x19fdb6(0x91)]===0x0)return![];const _0x5bb80e=await withSpinner(_0x19fdb6(0xc3)+_0x515789[_0x19fdb6(0xbc)](_0x19fdb6(0xc4))+_0x19fdb6(0xb9),()=>_0x2da4ee[_0x19fdb6(0xa0)][_0x19fdb6(0xd3)](_0x1bf9f2),{'verbose':_0x5edde8[_0x19fdb6(0xd8)]}),_0x11b0b2=(await withSpinner(_0x19fdb6(0xb7),()=>_0x2da4ee[_0x19fdb6(0xa0)][_0x19fdb6(0xc7)](_0x5bb80e[_0x19fdb6(0x97)][_0x19fdb6(0xd6)],_0x5bb80e[_0x19fdb6(0x97)]['folderId'],0x0,0xa),{'verbose':_0x5edde8[_0x19fdb6(0xd8)]}))['data'];let _0x21dfda=![];for(const _0x1ae521 of _0x515789){const _0x4de3f8=searchTreeByName(_0x11b0b2,_0x1ae521)[_0x19fdb6(0xbf)](_0xf01ee8=>_0xf01ee8[_0x19fdb6(0xaa)]===_0x19fdb6(0xa0)&&_0xf01ee8[_0x19fdb6(0xd7)][_0x19fdb6(0xd4)]()===_0x1ae521[_0x19fdb6(0xd4)]());if(_0x4de3f8['length']>0x1){_0x21dfda=!![],console['error'](a43_0x4afdb3['red']('Error:\x20\x27'+_0x1ae521+_0x19fdb6(0x94)+_0x4de3f8[_0x19fdb6(0x91)]+_0x19fdb6(0xc1)));for(const _0x22ca84 of _0x4de3f8)console[_0x19fdb6(0xd5)](_0x19fdb6(0xb6)+_0x22ca84['path']+_0x19fdb6(0xb3)+_0x22ca84['id']+')');}else _0x4de3f8[_0x19fdb6(0x91)]===0x1&&(_0x21dfda=!![],console[_0x19fdb6(0xd5)](a43_0x4afdb3[_0x19fdb6(0xba)]('Error:\x20\x27'+_0x1ae521+_0x19fdb6(0xbe))),console['error']('\x20\x20'+_0x4de3f8[0x0]['path']+_0x19fdb6(0xb3)+_0x4de3f8[0x0]['id']+')'),console['error'](_0x19fdb6(0xa5)));}return _0x21dfda;}}
1
+ const a43_0x97bfb9=a43_0x5e79;(function(_0x3fab21,_0x20bfd8){const _0x508a56=a43_0x5e79,_0x45daaa=_0x3fab21();while(!![]){try{const _0x151d8e=parseInt(_0x508a56(0xac))/0x1*(parseInt(_0x508a56(0xb5))/0x2)+-parseInt(_0x508a56(0x94))/0x3+-parseInt(_0x508a56(0xb1))/0x4*(-parseInt(_0x508a56(0x85))/0x5)+parseInt(_0x508a56(0x75))/0x6+-parseInt(_0x508a56(0x98))/0x7*(parseInt(_0x508a56(0xa9))/0x8)+-parseInt(_0x508a56(0x8d))/0x9*(parseInt(_0x508a56(0xb6))/0xa)+parseInt(_0x508a56(0xb2))/0xb*(parseInt(_0x508a56(0x9c))/0xc);if(_0x151d8e===_0x20bfd8)break;else _0x45daaa['push'](_0x45daaa['shift']());}catch(_0x528606){_0x45daaa['push'](_0x45daaa['shift']());}}}(a43_0x5dec,0xd6ef5));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a43_0x5dec(){const _0x5ee451=['Target\x20folder:\x20','Segments:\x20','•\x20[dry-run]\x20Would\x20move\x20segment\x20\x27','Move\x20one\x20or\x20more\x20segments\x20to\x20a\x20different\x20folder','green','\x20\x20tdx\x20segment\x20move\x20\x22VIP\x20Customers\x22\x20--folder\x20\x22Archive\x22\x20\x20\x20#\x20by\x20name\x20(needs\x20parent\x20context)','listRecursive','get','red','\x27\x20—\x20','folder','data','\x27...','5SpBIyg','slot','\x27\x20to\x20folder\x20\x27','\x0aTip:\x20run\x20`tdx\x20segment\x20list\x20-r`\x20to\x20find\x20segment\x20and\x20folder\x20names/IDs.','\x20\x20tdx\x20segment\x20move\x201603887\x20--folder\x208299501','preserved:','segment','test','36nETiNW','\x20condition','toLowerCase','some','Or\x20pass\x20flag:\x20\x20--parent-segment\x20\x22<name>\x22','Error:\x20no\x20parent\x20segment\x20context\x20—\x20moving\x20by\x20name\x20needs\x20one.\x0a','filter','3032355zqhJtU','Error:\x20\x27','push','Usage:\x20tdx\x20segment\x20move\x20<segment...>\x20--folder\x20<folder>','7RfNUaT','includes','rule\x20','error','2465112XQlJDC','ruleConditionCount','moveSegments','path','Examples:','code','\x20segments\x20—\x20refusing\x20to\x20guess.\x20Pass\x20the\x20full\x20path\x20(or\x20id)\x20of\x20the\x20one\x20you\x20mean:','\x20\x20tdx\x20segment\x20move\x201603887\x201603888\x201603889\x20--folder\x208299501','cyan','\x20segment','Moving','✔\x20Moved\x20segment\x20\x27','explainAmbiguousName','6484384cyDUnU','has','length','3BHeZcv','Or\x20use\x20IDs:\x20\x20\x20\x20tdx\x20sg\x20list\x20-r\x20--json\x20\x20(then\x20pass\x20the\x20numeric\x20ids)','resolvePathToResource','Checking','join','5937660DUjfbq','121nFZHML','Set\x20context:\x20\x20\x20tdx\x20use\x20parent_segment\x20\x22<name>\x22','map','122712pFkSgF','3483080rFvwbO','segment:move','description','SEGMENT_NOT_FOUND','\x27\x20matches\x20','\x20folder\x20\x27','type','segmentFolderId','\x20(verified\x20by\x20re-read)','name','set','parentSegment','\x20\x20•\x20','Searching\x20the\x20tree...','Searching\x20folders\x20for\x20\x27','1000614YOmzHs','folderId','forEach'];a43_0x5dec=function(){return _0x5ee451;};return a43_0x5dec();}function a43_0x5e79(_0x315742,_0x4bb8e0){_0x315742=_0x315742-0x70;const _0x5decae=a43_0x5dec();let _0x5e79b1=_0x5decae[_0x315742];return _0x5e79b1;}import{searchTreeByName}from'../sdk/util/tree-search.js';import a43_0x2eec09 from'chalk';export class SegmentMoveCommand extends BaseCommand{[a43_0x97bfb9(0xbf)]=a43_0x97bfb9(0xb7);[a43_0x97bfb9(0xb8)]=a43_0x97bfb9(0x7b);async['execute'](_0x124d3e){const _0x102e67=a43_0x97bfb9,{options:_0xaf8fb7,args:_0x240a88,tdx:_0x267ab3}=_0x124d3e,_0x238c97=_0x240a88,_0x5d0e02=_0xaf8fb7[_0x102e67(0x82)];if(_0x238c97[_0x102e67(0xab)]===0x0||!_0x5d0e02)return console[_0x102e67(0x9b)](a43_0x2eec09[_0x102e67(0x80)]('Error:\x20at\x20least\x20one\x20<segment>\x20and\x20--folder\x20<folder>\x20are\x20required\x0a')),console[_0x102e67(0x9b)](_0x102e67(0x97)),console[_0x102e67(0x9b)](_0x102e67(0xa0)),console[_0x102e67(0x9b)](_0x102e67(0x89)),console[_0x102e67(0x9b)](_0x102e67(0xa3)),console[_0x102e67(0x9b)](_0x102e67(0x7d)),console['error'](_0x102e67(0x88)),0x1;_0xaf8fb7['verbose']&&(console[_0x102e67(0x9b)](_0x102e67(0x79)+_0x238c97[_0x102e67(0xb0)](',\x20')),console[_0x102e67(0x9b)](_0x102e67(0x78)+_0x5d0e02));const _0xd3c19=[...new Set(_0x238c97)];_0xd3c19[_0x102e67(0xab)]<_0x238c97[_0x102e67(0xab)]&&console[_0x102e67(0x9b)](a43_0x2eec09['yellow']('Duplicate\x20segments\x20removed\x20('+_0x238c97['length']+'\x20→\x20'+_0xd3c19[_0x102e67(0xab)]+').'));const _0x37db5a=/^\d+$/,_0x3e9c53=_0xaf8fb7[_0x102e67(0x71)],_0x4680ad=[..._0xd3c19,_0x5d0e02][_0x102e67(0x90)](_0x2851f4=>!_0x37db5a[_0x102e67(0x8c)](_0x2851f4));if(_0x4680ad&&!_0x3e9c53)return console[_0x102e67(0x9b)](a43_0x2eec09['red'](_0x102e67(0x92))),console[_0x102e67(0x9b)](_0x102e67(0xb3)),console[_0x102e67(0x9b)](_0x102e67(0x91)),console[_0x102e67(0x9b)](_0x102e67(0xad)),0x1;const _0x35d808=_0xd3c19['length'],_0x479c08=_0xaf8fb7['dryRun']===!![];let _0x35c1de;try{const _0x4418e8=await withSpinner((_0x479c08?_0x102e67(0xaf):_0x102e67(0xa6))+'\x20'+_0x35d808+_0x102e67(0xa5)+(_0x35d808===0x1?'':'s')+'\x20'+((_0x479c08?'for\x20move\x20to':'to')+_0x102e67(0xbb)+_0x5d0e02+'\x27...'),async()=>{const _0x30c2cf=_0x102e67,_0x395df9=[];_0xd3c19[_0x30c2cf(0x77)]((_0x3245a9,_0x270536)=>{const _0x1199ab=_0x30c2cf;if(!_0x37db5a['test'](_0x3245a9))_0x395df9[_0x1199ab(0x96)]({'name':_0x3245a9,'expectType':_0x1199ab(0x8b),'slot':_0x270536});});if(!_0x37db5a[_0x30c2cf(0x8c)](_0x5d0e02))_0x395df9['push']({'name':_0x5d0e02,'expectType':_0x30c2cf(0x82),'slot':-0x1});const _0x14a6bc=new Map();if(_0x395df9['length']>0x0){const _0x41dd22=await _0x267ab3[_0x30c2cf(0x8b)]['resolveEntitiesInParent'](_0x3e9c53,_0x395df9[_0x30c2cf(0xb4)](({name:_0x4d72aa,expectType:_0x53827d})=>({'name':_0x4d72aa,'expectType':_0x53827d})));_0x41dd22[_0x30c2cf(0x77)]((_0x457aed,_0x4b0640)=>_0x14a6bc[_0x30c2cf(0x70)](_0x395df9[_0x4b0640][_0x30c2cf(0x86)],_0x457aed['id']));}const _0xe7a93a=_0xd3c19[_0x30c2cf(0xb4)]((_0x5a3f02,_0x41dfd7)=>_0x37db5a[_0x30c2cf(0x8c)](_0x5a3f02)?_0x5a3f02:_0x14a6bc[_0x30c2cf(0x7f)](_0x41dfd7)),_0x36a083=_0x37db5a[_0x30c2cf(0x8c)](_0x5d0e02)?_0x5d0e02:_0x14a6bc['get'](-0x1);return _0x267ab3[_0x30c2cf(0x8b)][_0x30c2cf(0x9e)](_0xe7a93a,_0x36a083,_0x479c08);},{'verbose':_0xaf8fb7['verbose']});_0x35c1de=_0x4418e8[_0x102e67(0x83)];}catch(_0x251198){if(_0x251198 instanceof SDKError&&_0x251198[_0x102e67(0xa1)]===ErrorCode[_0x102e67(0xb9)]&&_0x3e9c53)try{if(await this[_0x102e67(0xa8)](_0x267ab3,_0x3e9c53,_0xd3c19,_0xaf8fb7))return 0x1;}catch{}throw _0x251198;}for(const _0x1ff194 of _0x35c1de){const _0x1abc64=_0x1ff194[_0x102e67(0x9d)],_0x45a178=_0x102e67(0x9a)+(_0x479c08?_0x102e67(0xaa):_0x102e67(0x8a))+'\x20'+_0x1abc64+_0x102e67(0x8e)+(_0x1abc64===0x1?'':'s');console['error'](_0x479c08?a43_0x2eec09[_0x102e67(0xa4)](_0x102e67(0x7a)+_0x1ff194['id']+_0x102e67(0x87)+_0x1ff194[_0x102e67(0xbd)]+_0x102e67(0x81)+_0x45a178):a43_0x2eec09[_0x102e67(0x7c)](_0x102e67(0xa7)+_0x1ff194['id']+'\x27\x20to\x20folder\x20\x27'+_0x1ff194[_0x102e67(0xbd)]+_0x102e67(0x81)+_0x45a178+_0x102e67(0xbe)));}if(_0x479c08)console[_0x102e67(0x9b)](a43_0x2eec09[_0x102e67(0xa4)]('[dry-run]\x20No\x20changes\x20made.\x20'+_0x35d808+'\x20segment(s)\x20would\x20be\x20moved.'));else _0x35c1de[_0x102e67(0xab)]>0x1&&console[_0x102e67(0x9b)](a43_0x2eec09[_0x102e67(0x7c)]('✔\x20'+_0x35c1de[_0x102e67(0xab)]+'\x20segments\x20moved,\x20all\x20rules\x20verified\x20intact'));return await handleSDKOutput(_0x35c1de,_0xaf8fb7),0x0;}async[a43_0x97bfb9(0xa8)](_0x261d9e,_0x381073,_0x28e894,_0x108b9a){const _0x428fbb=a43_0x97bfb9,_0x511a41=_0x28e894[_0x428fbb(0x93)](_0x56129a=>!/^\d+$/['test'](_0x56129a)&&!_0x56129a[_0x428fbb(0x99)]('/'));if(_0x511a41[_0x428fbb(0xab)]===0x0)return![];const _0x44b989=await withSpinner(_0x428fbb(0x74)+_0x511a41[_0x428fbb(0xb0)]('\x27,\x20\x27')+_0x428fbb(0x84),()=>_0x261d9e[_0x428fbb(0x8b)][_0x428fbb(0xae)](_0x381073),{'verbose':_0x108b9a['verbose']}),_0x15f60d=(await withSpinner(_0x428fbb(0x73),()=>_0x261d9e['segment'][_0x428fbb(0x7e)](_0x44b989[_0x428fbb(0x83)]['parentId'],_0x44b989[_0x428fbb(0x83)][_0x428fbb(0x76)],0x0,0xa),{'verbose':_0x108b9a['verbose']}))['data'];let _0x431094=![];for(const _0x41f05d of _0x511a41){const _0x1aad06=searchTreeByName(_0x15f60d,_0x41f05d)[_0x428fbb(0x93)](_0x454f6f=>_0x454f6f[_0x428fbb(0xbc)]===_0x428fbb(0x8b)&&_0x454f6f[_0x428fbb(0xbf)]['toLowerCase']()===_0x41f05d[_0x428fbb(0x8f)]());if(_0x1aad06['length']>0x1){_0x431094=!![],console[_0x428fbb(0x9b)](a43_0x2eec09[_0x428fbb(0x80)](_0x428fbb(0x95)+_0x41f05d+_0x428fbb(0xba)+_0x1aad06[_0x428fbb(0xab)]+_0x428fbb(0xa2)));for(const _0x498f23 of _0x1aad06)console[_0x428fbb(0x9b)](_0x428fbb(0x72)+_0x498f23[_0x428fbb(0x9f)]+'\x20\x20(id\x20'+_0x498f23['id']+')');}else _0x1aad06[_0x428fbb(0xab)]===0x1&&(_0x431094=!![],console['error'](a43_0x2eec09[_0x428fbb(0x80)]('Error:\x20\x27'+_0x41f05d+'\x27\x20isn\x27t\x20at\x20the\x20top\x20level\x20—\x20it\x27s\x20nested\x20at:')),console['error']('\x20\x20'+_0x1aad06[0x0][_0x428fbb(0x9f)]+'\x20\x20(id\x20'+_0x1aad06[0x0]['id']+')'),console[_0x428fbb(0x9b)]('Re-run\x20`tdx\x20sg\x20move`\x20with\x20that\x20full\x20path\x20(or\x20the\x20id).'));}return _0x431094;}}
@@ -1 +1 @@
1
- const a44_0x4dbc3b=a44_0x3b92;(function(_0x244470,_0x3e2185){const _0x3a9f9a=a44_0x3b92,_0x316af4=_0x244470();while(!![]){try{const _0x5f0e1=-parseInt(_0x3a9f9a(0xbd))/0x1+parseInt(_0x3a9f9a(0xa9))/0x2*(parseInt(_0x3a9f9a(0xce))/0x3)+parseInt(_0x3a9f9a(0xbe))/0x4*(parseInt(_0x3a9f9a(0xec))/0x5)+-parseInt(_0x3a9f9a(0xc8))/0x6*(parseInt(_0x3a9f9a(0xd6))/0x7)+parseInt(_0x3a9f9a(0xac))/0x8+parseInt(_0x3a9f9a(0xd1))/0x9+-parseInt(_0x3a9f9a(0xe3))/0xa;if(_0x5f0e1===_0x3e2185)break;else _0x316af4['push'](_0x316af4['shift']());}catch(_0x1b50f1){_0x316af4['push'](_0x316af4['shift']());}}}(a44_0x4290,0xbf4bb));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a44_0x2c45eb from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';function a44_0x3b92(_0x24fc84,_0x4873fd){_0x24fc84=_0x24fc84-0xa6;const _0x42903e=a44_0x4290();let _0x3b9277=_0x42903e[_0x24fc84];return _0x3b9277;}import a44_0x42929b from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';function a44_0x4290(){const _0x63a81d=['journeys','\x0aChanges\x20to\x20\x27','session','pullSegments','\x0aPull\x20summary\x20for\x20\x27','dim','\x20\x20🎯\x20','4914290QsygDZ','Target\x20resource:\x20','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','✔\x20All\x20files\x20are\x20up\x20to\x20date','description','segment:pull','data','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','site','285620PsSuBa','yellow','\x0aError:','\x20changed\x20files','Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','isNew','length','green','files','\x20files?','\x20files\x20to\x20','counts','Error:\x20','Aborted.','repeat','394ZsFwjs','type','no_parent','4689384cInKPM','execute','cwd','hasChanges','filter','activations','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','\x20segments','-\x20no\x20files\x20written','\x20unchanged\x20files','segments','absolutePath','Pulling\x20segments\x20from\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','red','Site:\x20','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','867636trVrSh','68MKCgSu','\x27...','verbose','✔\x20Context\x20set:\x20','✔\x20Pulled\x20','\x20=\x20','\x20new\x20files','segment','targetDir','\x20versions)','256866DOqMlc','parentName','content','Write\x20','resourceName','cyan','4269CLXAzL','journeyVersions','\x20journeys','6212691yJhfGu','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Parent\x20segment:\x20','dirname','helpText','63GkmpQX','diff','errorCode','dryRun','error','parentSegment'];a44_0x4290=function(){return _0x63a81d;};return a44_0x4290();}export class SegmentPullCommand extends BaseCommand{['name']=a44_0x4dbc3b(0xe8);[a44_0x4dbc3b(0xe7)]=a44_0x4dbc3b(0xea);async[a44_0x4dbc3b(0xad)](_0x3e0a66){const _0x24aee8=a44_0x4dbc3b,{options:_0x3ac46c,args:_0x5bccd6,tdx:_0x14992c}=_0x3e0a66,_0x2fcf10=_0x3ac46c,_0x1bbacf=await resolveTarget({'arg':_0x5bccd6[0x0],'contextParent':_0x3ac46c[_0x24aee8(0xdb)],'cwd':process[_0x24aee8(0xae)]()});if(!isSuccessfulResolution(_0x1bbacf))return _0x1bbacf[_0x24aee8(0xd8)]===_0x24aee8(0xab)?(console[_0x24aee8(0xda)](a44_0x2c45eb[_0x24aee8(0xed)](_0x24aee8(0xb2))),console[_0x24aee8(0xda)](_0x24aee8(0xf0)),console[_0x24aee8(0xda)](_0x24aee8(0xb9)),console[_0x24aee8(0xda)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file')):(console[_0x24aee8(0xda)](a44_0x2c45eb[_0x24aee8(0xba)](_0x24aee8(0xa6)+_0x1bbacf['message']+'\x0a')),_0x1bbacf['helpText']&&console['error'](a44_0x2c45eb[_0x24aee8(0xcd)](_0x1bbacf[_0x24aee8(0xd5)]))),0x1;const _0x496f53=_0x1bbacf[_0x24aee8(0xc9)],_0x45e255=_0x1bbacf[_0x24aee8(0xc6)],_0x2c9761=_0x1bbacf[_0x24aee8(0xaa)]==='file'?_0x1bbacf[_0x24aee8(0xcc)]:undefined;_0x2fcf10['verbose']&&(console[_0x24aee8(0xda)](_0x24aee8(0xbb)+_0x2fcf10[_0x24aee8(0xeb)]),console[_0x24aee8(0xda)](_0x24aee8(0xd3)+_0x496f53),_0x2c9761&&console['error'](_0x24aee8(0xe4)+_0x2c9761));const _0x417685=await withProgressSpinner(_0x24aee8(0xb8)+_0x496f53+_0x24aee8(0xbf),_0x4ff3d0=>_0x14992c[_0x24aee8(0xc5)][_0x24aee8(0xdf)](_0x496f53,{'targetDir':_0x45e255,'targetResourceName':_0x2c9761,'verbose':_0x2fcf10[_0x24aee8(0xc0)],'progress':{'update':_0x2207b1=>{const _0x5d29b1=_0x24aee8;_0x4ff3d0['setPhase'](_0x2207b1),_0x2fcf10[_0x5d29b1(0xc0)]&&console[_0x5d29b1(0xda)]('\x20\x20'+_0x2207b1);}}}),{'verbose':_0x2fcf10[_0x24aee8(0xc0)]}),_0x30e4ef=_0x417685[_0x24aee8(0xe9)];if(_0x30e4ef[_0x24aee8(0xf8)][_0x24aee8(0xb6)]===0x0&&_0x30e4ef['counts'][_0x24aee8(0xdc)]===0x0)return console[_0x24aee8(0xda)](a44_0x2c45eb['yellow'](_0x24aee8(0xbc)+_0x30e4ef['parentName']+'\x27')),0x0;const _0x3da29c=_0x30e4ef[_0x24aee8(0xf5)]['filter'](_0xee2ddc=>_0xee2ddc[_0x24aee8(0xf2)]),_0x381410=_0x30e4ef[_0x24aee8(0xf5)][_0x24aee8(0xb0)](_0x2c6332=>!_0x2c6332[_0x24aee8(0xf2)]&&_0x2c6332[_0x24aee8(0xaf)]),_0x5b3cb8=_0x30e4ef[_0x24aee8(0xf5)][_0x24aee8(0xb0)](_0x4e5dea=>!_0x4e5dea[_0x24aee8(0xf2)]&&!_0x4e5dea[_0x24aee8(0xaf)]);console[_0x24aee8(0xda)](_0x24aee8(0xe0)+_0x30e4ef[_0x24aee8(0xc9)]+'\x27:'),console[_0x24aee8(0xda)](_0x24aee8(0xe2)+a44_0x2c45eb[_0x24aee8(0xcd)](_0x30e4ef[_0x24aee8(0xf8)][_0x24aee8(0xb6)]+_0x24aee8(0xb3))+'\x20with\x20'+a44_0x2c45eb[_0x24aee8(0xcd)](_0x30e4ef[_0x24aee8(0xf8)][_0x24aee8(0xb1)]+'\x20activations'));if(_0x30e4ef[_0x24aee8(0xf8)][_0x24aee8(0xdc)]>0x0){const _0x510dce=_0x30e4ef[_0x24aee8(0xf8)][_0x24aee8(0xcf)]>_0x30e4ef[_0x24aee8(0xf8)][_0x24aee8(0xdc)]?'\x20('+_0x30e4ef[_0x24aee8(0xf8)][_0x24aee8(0xcf)]+_0x24aee8(0xc7):'';console[_0x24aee8(0xda)]('\x20\x20🗺️\x20\x20'+a44_0x2c45eb[_0x24aee8(0xcd)](_0x30e4ef[_0x24aee8(0xf8)][_0x24aee8(0xdc)]+_0x24aee8(0xd0))+a44_0x2c45eb[_0x24aee8(0xe1)](_0x510dce));}console[_0x24aee8(0xda)]('\x20\x20'+a44_0x2c45eb[_0x24aee8(0xf4)]('+\x20'+_0x3da29c['length']+_0x24aee8(0xc4))),console[_0x24aee8(0xda)]('\x20\x20'+a44_0x2c45eb[_0x24aee8(0xed)]('~\x20'+_0x381410[_0x24aee8(0xf3)]+_0x24aee8(0xef))),console['error']('\x20\x20'+a44_0x2c45eb[_0x24aee8(0xe1)]('=\x20'+_0x5b3cb8['length']+_0x24aee8(0xb5))),console[_0x24aee8(0xda)]('\x20\x20Target:\x20'+a44_0x2c45eb[_0x24aee8(0xcd)](_0x30e4ef[_0x24aee8(0xc6)])+'\x0a');if(_0x381410[_0x24aee8(0xf3)]>0x0)for(const _0x186160 of _0x381410){console[_0x24aee8(0xda)](_0x24aee8(0xdd)+_0x186160['relativePath']+'\x27:'),console[_0x24aee8(0xda)]('─'[_0x24aee8(0xa8)](0x3c)),console[_0x24aee8(0xda)](_0x186160[_0x24aee8(0xd7)]),console[_0x24aee8(0xda)]('─'[_0x24aee8(0xa8)](0x3c));}if(_0x2fcf10[_0x24aee8(0xd9)])return console[_0x24aee8(0xda)](a44_0x2c45eb[_0x24aee8(0xed)](_0x24aee8(0xe5))),0x0;if(_0x3da29c[_0x24aee8(0xf3)]===0x0&&_0x381410[_0x24aee8(0xf3)]===0x0)return console['error'](a44_0x2c45eb[_0x24aee8(0xf4)](_0x24aee8(0xe6))),saveSessionContext({'parent_segment':_0x30e4ef['parentName']},_0x2fcf10[_0x24aee8(0xde)]),console[_0x24aee8(0xda)](a44_0x2c45eb[_0x24aee8(0xf4)](_0x24aee8(0xc1)+a44_0x2c45eb[_0x24aee8(0xe1)]('parent_segment')+_0x24aee8(0xc3)+a44_0x2c45eb[_0x24aee8(0xcd)](_0x30e4ef['parentName']))),0x0;if(!_0x2fcf10['yes']){if(!isInteractive())return console[_0x24aee8(0xda)](a44_0x2c45eb[_0x24aee8(0xba)](_0x24aee8(0xee)),_0x24aee8(0xf1)),console[_0x24aee8(0xda)](a44_0x2c45eb[_0x24aee8(0xe1)](_0x24aee8(0xd2))),0x1;const _0x4ff4d4=await confirmKey(_0x24aee8(0xcb)+(_0x3da29c['length']+_0x381410[_0x24aee8(0xf3)])+_0x24aee8(0xf6));if(!_0x4ff4d4)return console[_0x24aee8(0xda)](a44_0x2c45eb[_0x24aee8(0xed)](_0x24aee8(0xa7)),_0x24aee8(0xb4)),0x1;}for(const _0x15c75a of _0x30e4ef['files']){if(_0x15c75a[_0x24aee8(0xf2)]||_0x15c75a[_0x24aee8(0xaf)]){const _0x4d9fa7=a44_0x42929b[_0x24aee8(0xd4)](_0x15c75a[_0x24aee8(0xb7)]);!existsSync(_0x4d9fa7)&&mkdirSync(_0x4d9fa7,{'recursive':!![]}),writeFileSync(_0x15c75a[_0x24aee8(0xb7)],_0x15c75a[_0x24aee8(0xca)],'utf-8');}}return console[_0x24aee8(0xda)](a44_0x2c45eb[_0x24aee8(0xf4)](_0x24aee8(0xc2)+(_0x3da29c[_0x24aee8(0xf3)]+_0x381410['length'])+_0x24aee8(0xf7)+_0x30e4ef[_0x24aee8(0xc6)])),saveSessionContext({'parent_segment':_0x30e4ef[_0x24aee8(0xc9)]},_0x2fcf10[_0x24aee8(0xde)]),console['error'](a44_0x2c45eb['green'](_0x24aee8(0xc1)+a44_0x2c45eb[_0x24aee8(0xe1)]('parent_segment')+_0x24aee8(0xc3)+a44_0x2c45eb['cyan'](_0x30e4ef[_0x24aee8(0xc9)]))),0x0;}}
1
+ const a44_0x214b20=a44_0x2bf8;function a44_0x1bfe(){const _0x19a584=['error','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','utf-8','type','\x20segments','hasChanges','pullSegments','✔\x20Context\x20set:\x20','\x20versions)','\x20\x20🎯\x20','journeys','no_parent','errorCode','content','\x20unchanged\x20files','\x20files\x20to\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','helpText','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','2488IXIDfB','\x20with\x20','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','message','repeat','6996fcNHLq','dim','yes','dirname','Parent\x20segment:\x20','red','910kezNYT','segments','Write\x20','verbose','setPhase','counts','2727HyDYuy','\x0aPull\x20summary\x20for\x20\x27','parentName','Pulling\x20segments\x20from\x20\x27','3305060dXAzAn','files','-\x20no\x20files\x20written','Aborted.','\x20=\x20','file','✔\x20All\x20files\x20are\x20up\x20to\x20date','length','segment','✔\x20Pulled\x20','\x20\x20Target:\x20','2455860UUOxFR','Target\x20resource:\x20','\x20activations','yellow','\x20changed\x20files','filter','cyan','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','\x20files?','session','isNew','Error:\x20','dryRun','\x20new\x20files','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','\x0aChanges\x20to\x20\x27','targetDir','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','parent_segment','execute','Site:\x20','journeyVersions','\x20\x20🗺️\x20\x20','484675XFbPIa','208746hLObVP','36232oDSGTF','1000110hTmRzO','green','cwd','absolutePath','diff'];a44_0x1bfe=function(){return _0x19a584;};return a44_0x1bfe();}(function(_0x524807,_0x232ae3){const _0x48739a=a44_0x2bf8,_0x2f93ef=_0x524807();while(!![]){try{const _0x41134a=parseInt(_0x48739a(0xda))/0x1+-parseInt(_0x48739a(0xc3))/0x2+parseInt(_0x48739a(0x106))/0x3*(-parseInt(_0x48739a(0xfa))/0x4)+-parseInt(_0x48739a(0xb8))/0x5+parseInt(_0x48739a(0xdd))/0x6+parseInt(_0x48739a(0xdc))/0x7*(parseInt(_0x48739a(0xf5))/0x8)+-parseInt(_0x48739a(0xdb))/0x9*(-parseInt(_0x48739a(0x100))/0xa);if(_0x41134a===_0x232ae3)break;else _0x2f93ef['push'](_0x2f93ef['shift']());}catch(_0x5ad2f6){_0x2f93ef['push'](_0x2f93ef['shift']());}}}(a44_0x1bfe,0xda027));function a44_0x2bf8(_0x5c4f7f,_0x1b0368){_0x5c4f7f=_0x5c4f7f-0xb5;const _0x1bfee5=a44_0x1bfe();let _0x2bf8d6=_0x1bfee5[_0x5c4f7f];return _0x2bf8d6;}import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a44_0x103940 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a44_0x2633e9 from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{['name']='segment:pull';['description']=a44_0x214b20(0xd1);async[a44_0x214b20(0xd6)](_0x31b06e){const _0x121919=a44_0x214b20,{options:_0x37b6bc,args:_0x55a9ea,tdx:_0x125864}=_0x31b06e,_0x2db23d=_0x37b6bc,_0x461b07=await resolveTarget({'arg':_0x55a9ea[0x0],'contextParent':_0x37b6bc['parentSegment'],'cwd':process[_0x121919(0xdf)]()});if(!isSuccessfulResolution(_0x461b07))return _0x461b07[_0x121919(0xee)]===_0x121919(0xed)?(console['error'](a44_0x103940[_0x121919(0xc6)](_0x121919(0xf2))),console[_0x121919(0xe2)]('Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)'),console['error'](_0x121919(0xd4)),console[_0x121919(0xe2)](_0x121919(0xca))):(console['error'](a44_0x103940[_0x121919(0xff)](_0x121919(0xce)+_0x461b07[_0x121919(0xf8)]+'\x0a')),_0x461b07[_0x121919(0xf3)]&&console['error'](a44_0x103940[_0x121919(0xc9)](_0x461b07[_0x121919(0xf3)]))),0x1;const _0x3fada8=_0x461b07['parentName'],_0x15c01c=_0x461b07['targetDir'],_0x2c16cd=_0x461b07[_0x121919(0xe5)]===_0x121919(0xbd)?_0x461b07['resourceName']:undefined;_0x2db23d['verbose']&&(console[_0x121919(0xe2)](_0x121919(0xd7)+_0x2db23d['site']),console[_0x121919(0xe2)](_0x121919(0xfe)+_0x3fada8),_0x2c16cd&&console['error'](_0x121919(0xc4)+_0x2c16cd));const _0x2aabc4=await withProgressSpinner(_0x121919(0xb7)+_0x3fada8+'\x27...',_0xc83846=>_0x125864[_0x121919(0xc0)][_0x121919(0xe8)](_0x3fada8,{'targetDir':_0x15c01c,'targetResourceName':_0x2c16cd,'verbose':_0x2db23d[_0x121919(0x103)],'progress':{'update':_0x4823a5=>{const _0x991191=_0x121919;_0xc83846[_0x991191(0x104)](_0x4823a5),_0x2db23d['verbose']&&console['error']('\x20\x20'+_0x4823a5);}}}),{'verbose':_0x2db23d[_0x121919(0x103)]}),_0x1eaeb7=_0x2aabc4['data'];if(_0x1eaeb7['counts'][_0x121919(0x101)]===0x0&&_0x1eaeb7[_0x121919(0x105)][_0x121919(0xec)]===0x0)return console[_0x121919(0xe2)](a44_0x103940[_0x121919(0xc6)](_0x121919(0xf7)+_0x1eaeb7[_0x121919(0xb6)]+'\x27')),0x0;const _0x5f18c9=_0x1eaeb7[_0x121919(0xb9)][_0x121919(0xc8)](_0x271426=>_0x271426[_0x121919(0xcd)]),_0x829f8f=_0x1eaeb7[_0x121919(0xb9)][_0x121919(0xc8)](_0x40a1a0=>!_0x40a1a0[_0x121919(0xcd)]&&_0x40a1a0[_0x121919(0xe7)]),_0x3984b0=_0x1eaeb7['files'][_0x121919(0xc8)](_0xbdd265=>!_0xbdd265[_0x121919(0xcd)]&&!_0xbdd265[_0x121919(0xe7)]);console[_0x121919(0xe2)](_0x121919(0xb5)+_0x1eaeb7[_0x121919(0xb6)]+'\x27:'),console[_0x121919(0xe2)](_0x121919(0xeb)+a44_0x103940[_0x121919(0xc9)](_0x1eaeb7[_0x121919(0x105)]['segments']+_0x121919(0xe6))+_0x121919(0xf6)+a44_0x103940[_0x121919(0xc9)](_0x1eaeb7[_0x121919(0x105)]['activations']+_0x121919(0xc5)));if(_0x1eaeb7[_0x121919(0x105)]['journeys']>0x0){const _0x259c3=_0x1eaeb7[_0x121919(0x105)][_0x121919(0xd8)]>_0x1eaeb7[_0x121919(0x105)][_0x121919(0xec)]?'\x20('+_0x1eaeb7['counts'][_0x121919(0xd8)]+_0x121919(0xea):'';console[_0x121919(0xe2)](_0x121919(0xd9)+a44_0x103940[_0x121919(0xc9)](_0x1eaeb7[_0x121919(0x105)][_0x121919(0xec)]+'\x20journeys')+a44_0x103940[_0x121919(0xfb)](_0x259c3));}console[_0x121919(0xe2)]('\x20\x20'+a44_0x103940[_0x121919(0xde)]('+\x20'+_0x5f18c9[_0x121919(0xbf)]+_0x121919(0xd0))),console[_0x121919(0xe2)]('\x20\x20'+a44_0x103940[_0x121919(0xc6)]('~\x20'+_0x829f8f['length']+_0x121919(0xc7))),console['error']('\x20\x20'+a44_0x103940[_0x121919(0xfb)]('=\x20'+_0x3984b0['length']+_0x121919(0xf0))),console['error'](_0x121919(0xc2)+a44_0x103940[_0x121919(0xc9)](_0x1eaeb7[_0x121919(0xd3)])+'\x0a');if(_0x829f8f[_0x121919(0xbf)]>0x0)for(const _0x2ab321 of _0x829f8f){console['error'](_0x121919(0xd2)+_0x2ab321['relativePath']+'\x27:'),console[_0x121919(0xe2)]('─'[_0x121919(0xf9)](0x3c)),console['error'](_0x2ab321[_0x121919(0xe1)]),console['error']('─'['repeat'](0x3c));}if(_0x2db23d[_0x121919(0xcf)])return console[_0x121919(0xe2)](a44_0x103940[_0x121919(0xc6)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x5f18c9[_0x121919(0xbf)]===0x0&&_0x829f8f[_0x121919(0xbf)]===0x0)return console[_0x121919(0xe2)](a44_0x103940['green'](_0x121919(0xbe))),saveSessionContext({'parent_segment':_0x1eaeb7[_0x121919(0xb6)]},_0x2db23d[_0x121919(0xcc)]),console['error'](a44_0x103940[_0x121919(0xde)]('✔\x20Context\x20set:\x20'+a44_0x103940[_0x121919(0xfb)](_0x121919(0xd5))+_0x121919(0xbc)+a44_0x103940[_0x121919(0xc9)](_0x1eaeb7[_0x121919(0xb6)]))),0x0;if(!_0x2db23d[_0x121919(0xfc)]){if(!isInteractive())return console[_0x121919(0xe2)](a44_0x103940[_0x121919(0xff)]('\x0aError:'),_0x121919(0xf4)),console['error'](a44_0x103940[_0x121919(0xfb)](_0x121919(0xe3))),0x1;const _0x2adee5=await confirmKey(_0x121919(0x102)+(_0x5f18c9[_0x121919(0xbf)]+_0x829f8f[_0x121919(0xbf)])+_0x121919(0xcb));if(!_0x2adee5)return console[_0x121919(0xe2)](a44_0x103940[_0x121919(0xc6)](_0x121919(0xbb)),_0x121919(0xba)),0x1;}for(const _0x18a02d of _0x1eaeb7[_0x121919(0xb9)]){if(_0x18a02d[_0x121919(0xcd)]||_0x18a02d['hasChanges']){const _0x592ea1=a44_0x2633e9[_0x121919(0xfd)](_0x18a02d[_0x121919(0xe0)]);!existsSync(_0x592ea1)&&mkdirSync(_0x592ea1,{'recursive':!![]}),writeFileSync(_0x18a02d[_0x121919(0xe0)],_0x18a02d[_0x121919(0xef)],_0x121919(0xe4));}}return console[_0x121919(0xe2)](a44_0x103940[_0x121919(0xde)](_0x121919(0xc1)+(_0x5f18c9['length']+_0x829f8f[_0x121919(0xbf)])+_0x121919(0xf1)+_0x1eaeb7['targetDir'])),saveSessionContext({'parent_segment':_0x1eaeb7[_0x121919(0xb6)]},_0x2db23d[_0x121919(0xcc)]),console['error'](a44_0x103940[_0x121919(0xde)](_0x121919(0xe9)+a44_0x103940[_0x121919(0xfb)](_0x121919(0xd5))+_0x121919(0xbc)+a44_0x103940[_0x121919(0xc9)](_0x1eaeb7['parentName']))),0x0;}}
@@ -1 +1 @@
1
- const a45_0x5c55e0=a45_0x27cb;function a45_0x7fcb(){const _0x403434=['\x20\x20📊\x20Segments:','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Error:\x20Directory\x20not\x20found:\x20','updated','Folders\x20to\x20create:','\x20created','\x20new','file','\x20\x20Source:\x20','216825SYuoGP','buildUserMaps','data','\x20to\x20delete','\x20unchanged','\x20YAML\x20files\x20found','8dzWCJI','push','journeyId','green','976832tNuzMM','cyan','Error\x20parsing\x20YAML:\x20','length','join','filePath','paused','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','get','(Journey\x20will\x20be\x20deleted)','name','Error:\x20','targetDir','journeyBundleName','/app/ps/','.yaml','New\x20journey:','yellow','setPhase','Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','type','verbose','6WOAyTv','add','unchanged','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','\x20activations]','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','folderId','folderPath','no_parent','parentFolder','existingJourney','Push\x20','No\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','existingSegment','createdSegmentIds','\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20','Preparing\x20journeys...','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','isNew','📁\x20','toDelete','set','\x20\x20Activations:','\x0aPush\x20summary\x20for\x20\x27','Delete\x20segment:','segment','filter','nameToId','Changes\x20to\x20journey:','\x20\x20Journeys:\x20','list','getParent','delete','folders','.yml','262920YjsCmc','segment\x20or\x20journey','then','1124560RnTIeT','updatedAt','Delete\x20journey:','user','createdAt','listActivations','392410yhNylu','getOutputSchemaWithCache','cwd','all','/e/','results','\x0a✔\x20Push\x20complete','5527971YFHDix','red','diff','/j/da/je','idToName','segments','journeysOnly','parentName','journeys','new','getMetadataWithCache','activations','Parent\x20segment:\x20','dryRun','connection','Fetching\x20connections\x20for\x20name\x20resolution...','\x27...','versionNumber','\x20\x20Segments:\x20','isScoped','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','toCreate','state','blue','\x20to\x20update','message','Aborted.','helpText','description','\x20updated','created','nameToType','map','parent_name','repeat','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','attributes','changed','\x0aError:','resolveParentId','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','dim','\x20\x20\x20\x20','errorCode','Changes\x20to:','scopedFolderPath','117942Fjwkip','/sb/da/esr','journey','Push\x20YAML\x20files\x20to\x20Treasure\x20AI\x20as\x20child\x20segments','site','Scoped\x20to\x20folder:\x20','segmentFolderId','yamlConfig','\x20\x20Activations:\x20','getJourney','listJourneysWithDetailsFromParentSegment','\x20deleted','endsWith','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','toString','error'];a45_0x7fcb=function(){return _0x403434;};return a45_0x7fcb();}(function(_0x141eb7,_0x5e09d4){const _0x55b10e=a45_0x27cb,_0x3f6466=_0x141eb7();while(!![]){try{const _0x2eae2a=parseInt(_0x55b10e(0x1e8))/0x1+-parseInt(_0x55b10e(0x231))/0x2+-parseInt(_0x55b10e(0x26c))/0x3*(-parseInt(_0x55b10e(0x1ee))/0x4)+parseInt(_0x55b10e(0x237))/0x5*(-parseInt(_0x55b10e(0x209))/0x6)+-parseInt(_0x55b10e(0x22e))/0x7+parseInt(_0x55b10e(0x1f2))/0x8+parseInt(_0x55b10e(0x23e))/0x9;if(_0x2eae2a===_0x5e09d4)break;else _0x3f6466['push'](_0x3f6466['shift']());}catch(_0x5b0f2d){_0x3f6466['push'](_0x3f6466['shift']());}}}(a45_0x7fcb,0x564ae));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';function a45_0x27cb(_0x23d1dd,_0x2b571b){_0x23d1dd=_0x23d1dd-0x1e8;const _0x7fcb81=a45_0x7fcb();let _0x27cb39=_0x7fcb81[_0x23d1dd];return _0x27cb39;}import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a45_0x3078e4 from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{['name']='segment:push';[a45_0x5c55e0(0x25a)]=a45_0x5c55e0(0x26f);async['execute'](_0x560948){const _0x28fbbe=a45_0x5c55e0,{options:_0x7825ae,args:_0x46ad74,tdx:_0x160d53}=_0x560948,_0x5af398=_0x7825ae,_0x420f99=await resolveTarget({'arg':_0x46ad74[0x0],'contextParent':_0x7825ae['parentSegment'],'cwd':process[_0x28fbbe(0x239)]()});if(!isSuccessfulResolution(_0x420f99))return _0x420f99[_0x28fbbe(0x269)]===_0x28fbbe(0x212)?(console['error'](a45_0x3078e4[_0x28fbbe(0x203)](_0x28fbbe(0x217))),console[_0x28fbbe(0x27b)](_0x28fbbe(0x205)),console[_0x28fbbe(0x27b)](_0x28fbbe(0x261)),console[_0x28fbbe(0x27b)](_0x28fbbe(0x1f9))):(console[_0x28fbbe(0x27b)](a45_0x3078e4[_0x28fbbe(0x23f)](_0x28fbbe(0x1fd)+_0x420f99[_0x28fbbe(0x257)]+'\x0a')),_0x420f99['helpText']&&console[_0x28fbbe(0x27b)](a45_0x3078e4[_0x28fbbe(0x1f3)](_0x420f99[_0x28fbbe(0x259)]))),0x1;if(_0x420f99['type']===_0x28fbbe(0x25f))return console['error'](a45_0x3078e4[_0x28fbbe(0x23f)](_0x28fbbe(0x27e)+_0x420f99[_0x28fbbe(0x1fe)]+'\x0a')),console['error'](a45_0x3078e4['cyan'](_0x28fbbe(0x279))),0x1;const _0x432fef=_0x420f99[_0x28fbbe(0x245)],_0x1cd512=_0x420f99[_0x28fbbe(0x1fe)],_0x3ac655=_0x420f99[_0x28fbbe(0x207)]===_0x28fbbe(0x283)?_0x420f99[_0x28fbbe(0x1f7)]:undefined,_0x5a562c=getScopedDetails(_0x420f99),_0x1fd040=_0x5a562c?.[_0x28fbbe(0x251)]??![],_0x4c5a82=_0x5a562c?.[_0x28fbbe(0x26b)]??'';if(!existsSync(_0x1cd512))return console[_0x28fbbe(0x27b)](a45_0x3078e4[_0x28fbbe(0x23f)](_0x28fbbe(0x27e)+_0x1cd512+'\x0a')),console[_0x28fbbe(0x27b)](a45_0x3078e4[_0x28fbbe(0x1f3)](_0x28fbbe(0x279))),0x1;_0x5af398['verbose']&&(console[_0x28fbbe(0x27b)]('Site:\x20'+_0x5af398[_0x28fbbe(0x270)]),console[_0x28fbbe(0x27b)](_0x28fbbe(0x24a)+_0x432fef),console['error']('Source\x20directory:\x20'+_0x1cd512),_0x1fd040&&console[_0x28fbbe(0x27b)](_0x28fbbe(0x271)+_0x4c5a82));const _0x331d03=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x432fef+_0x28fbbe(0x24e),()=>_0x160d53['segment'][_0x28fbbe(0x265)](_0x432fef),{'verbose':_0x5af398[_0x28fbbe(0x208)]}),_0x50c43f=_0x331d03[_0x28fbbe(0x1ea)],{parentSegmentResult:_0x158a40,segmentsResult:_0x5d3c43,foldersResult:_0x205f8c,journeysWithDetailsResult:_0x3f3e1a,userMaps:_0x4ea5db}=await withSpinner('Fetching\x20existing\x20data...',async()=>{const _0x3b28f6=_0x28fbbe,[_0x5d3146,_0x4d0c0d,_0x133d42,_0x222b69,_0x3b77e8]=await Promise['all']([_0x160d53[_0x3b28f6(0x224)][_0x3b28f6(0x22a)](_0x50c43f),_0x160d53[_0x3b28f6(0x224)]['listSegments'](_0x50c43f),_0x160d53[_0x3b28f6(0x224)]['listFolders'](_0x50c43f),_0x160d53['journey'][_0x3b28f6(0x276)](_0x50c43f,{'includeAllVersions':!![]}),_0x160d53[_0x3b28f6(0x234)][_0x3b28f6(0x1e9)]()]);return{'parentSegmentResult':_0x5d3146,'segmentsResult':_0x4d0c0d,'foldersResult':_0x133d42,'journeysWithDetailsResult':_0x222b69,'userMaps':_0x3b77e8};},{'verbose':_0x5af398[_0x28fbbe(0x208)]})['then'](_0x3d3877=>_0x3d3877['data']),_0x26ae55=_0x158a40,_0x593ab1=extractRootFolderId(_0x26ae55),_0x5315a3=_0x5d3c43,_0x2386ea=_0x205f8c,{journeys:_0x1019a1,activationStepsById:_0x46f929}=_0x3f3e1a,_0x316828=new Map(_0x1019a1[_0x28fbbe(0x25e)](_0x11af64=>[_0x11af64['id'],_0x11af64])),_0x1746b5=_0x1019a1[_0x28fbbe(0x25e)](_0x4888b6=>({'id':_0x4888b6['id'],'name':_0x4888b6[_0x28fbbe(0x262)]['name'],'journeyBundleName':_0x4888b6[_0x28fbbe(0x262)][_0x28fbbe(0x1ff)]||'','journeyBundleId':_0x4888b6[_0x28fbbe(0x262)]['journeyBundleId']||'','versionNumber':_0x4888b6[_0x28fbbe(0x262)][_0x28fbbe(0x24f)],'description':_0x4888b6['attributes'][_0x28fbbe(0x25a)],'state':_0x4888b6[_0x28fbbe(0x262)][_0x28fbbe(0x254)],'paused':_0x4888b6['attributes'][_0x28fbbe(0x1f8)],'audienceId':_0x4888b6[_0x28fbbe(0x262)]['audienceId'],'folderId':_0x4888b6['relationships']?.[_0x28fbbe(0x213)]?.['data']?.['id'],'createdAt':_0x4888b6[_0x28fbbe(0x262)][_0x28fbbe(0x235)],'updatedAt':_0x4888b6[_0x28fbbe(0x262)][_0x28fbbe(0x232)]})),{emailToId:_0x17aa80,idToEmail:_0x5f537a}=_0x4ea5db,_0x73349f=await withSpinner(_0x28fbbe(0x24d),async()=>{const _0x26f484=_0x28fbbe,_0x3b9d5d=await _0x160d53[_0x26f484(0x24c)][_0x26f484(0x229)]();return buildConnectionMaps(_0x3b9d5d);},{'verbose':_0x5af398[_0x28fbbe(0x208)]})[_0x28fbbe(0x230)](_0x342d72=>_0x342d72['data']),_0x2b89f4=_0x73349f[_0x28fbbe(0x226)],_0x3f7c19=_0x73349f[_0x28fbbe(0x242)],_0x3a35e3=_0x73349f[_0x28fbbe(0x25d)],_0x4e361c={'emailToIdMap':_0x17aa80,'connectionNameToIdMap':_0x2b89f4,'connectionNameToTypeMap':_0x3a35e3,'getSchema':_0x4d6bdd=>_0x160d53['connection'][_0x28fbbe(0x238)](_0x4d6bdd),'getMetadata':_0x566a9b=>_0x160d53[_0x28fbbe(0x24c)][_0x28fbbe(0x248)](_0x566a9b)};let {pathToId:_0x5b903c,idToPath:_0x217163}=buildFolderMaps(_0x2386ea);const _0x3a6a4e=buildSegmentLookupMap(_0x5315a3,_0x217163),_0x2b6217=buildSegmentNameToIdMap(_0x5315a3),_0x49cbe5=buildJourneyBundleLookupMap(_0x1746b5,_0x217163);let _0x2f0899;if(_0x3ac655){if(!_0x3ac655[_0x28fbbe(0x278)](_0x28fbbe(0x22d))&&!_0x3ac655['endsWith'](_0x28fbbe(0x201)))return console[_0x28fbbe(0x27b)](a45_0x3078e4[_0x28fbbe(0x23f)](_0x28fbbe(0x20f)+_0x3ac655+'\x0a')),0x1;_0x2f0899=[_0x3ac655];}else _0x2f0899=findYamlFiles(_0x1cd512);if(_0x2f0899[_0x28fbbe(0x1f5)]===0x0)return console[_0x28fbbe(0x27b)](a45_0x3078e4['red']('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x1cd512+'\x0a')),console[_0x28fbbe(0x27b)](a45_0x3078e4[_0x28fbbe(0x1f3)]('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files')),0x1;let _0x43e2d0,_0x344554;try{const _0x4942db=parseAndClassifyYamlFiles(_0x2f0899,_0x1cd512,{'skipSegments':_0x5af398[_0x28fbbe(0x244)]});_0x43e2d0=_0x4942db[_0x28fbbe(0x243)],_0x344554=_0x4942db['journeys'];const _0x1575a0=validateParsedFiles(_0x4942db,_0x1cd512);if(_0x1575a0[_0x28fbbe(0x1f5)]>0x0)return console[_0x28fbbe(0x27b)](a45_0x3078e4['red']('\x0aValidation\x20failed:')),console[_0x28fbbe(0x27b)](formatValidationErrors(_0x1575a0)),console[_0x28fbbe(0x27b)](a45_0x3078e4['yellow'](_0x28fbbe(0x20c))),0x1;}catch(_0x8e2ef){return console[_0x28fbbe(0x27b)](a45_0x3078e4[_0x28fbbe(0x23f)](_0x28fbbe(0x1f4)+(_0x8e2ef instanceof Error?_0x8e2ef[_0x28fbbe(0x257)]:_0x8e2ef))),0x1;}if(_0x43e2d0[_0x28fbbe(0x1f5)]===0x0&&_0x344554[_0x28fbbe(0x1f5)]===0x0){const _0x2fae3b=_0x5af398[_0x28fbbe(0x244)]?_0x28fbbe(0x26e):_0x28fbbe(0x22f);return console[_0x28fbbe(0x27b)](a45_0x3078e4['yellow'](_0x28fbbe(0x216)+_0x2fae3b+_0x28fbbe(0x1ed))),0x0;}const _0x34229d=new Map();_0x5315a3[_0x28fbbe(0x1f5)]>0x0&&!_0x5af398[_0x28fbbe(0x244)]&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x5315a3,async _0x280db6=>{const _0x186584=a45_0x27cb,_0x2eec85=await _0x160d53[_0x186584(0x224)][_0x186584(0x236)](_0x50c43f,_0x280db6['id']);_0x34229d[_0x186584(0x220)](_0x280db6['id'],_0x2eec85);});},{'verbose':_0x5af398[_0x28fbbe(0x208)]});const {segmentFiles:_0x29193a,foldersToCreate:_0x52ba56}=await prepareSegmentFiles(_0x43e2d0,{'segmentByFolderAndName':_0x3a6a4e,'activationsBySegmentId':_0x34229d,'folderPathToId':_0x5b903c,'idToEmailMap':_0x5f537a,'connectionIdToNameMap':_0x3f7c19},_0x4e361c,_0x1fd040,_0x4c5a82),_0x3d8f9c=_0x3ac655?[]:findSegmentsToDelete(_0x5315a3,_0x43e2d0['map'](({yamlConfig:_0x4e85cd,folderPath:_0x2bda74})=>({'yamlConfig':_0x4e85cd,'folderPath':resolveTDFolderPath(_0x2bda74,_0x1fd040,_0x4c5a82)})),_0x217163,_0x4c5a82,_0x1fd040),{journeyFiles:_0x57b842,foldersToCreate:_0x5d8e1c}=await withProgressSpinner(_0x28fbbe(0x21b),async _0x4a21f7=>prepareJourneyFiles(_0x344554,{'fetchJourney':async _0x4bc299=>_0x160d53['journey'][_0x28fbbe(0x275)](_0x4bc299[_0x28fbbe(0x1f0)]),'journeyBundlesByFolderAndName':_0x49cbe5,'folderPathToId':_0x5b903c,'idToEmailMap':_0x5f537a,'connectionIdToNameMap':_0x3f7c19,'existingSegments':_0x5315a3,'parentId':_0x50c43f,'deps':_0x160d53,'progress':{'update':_0x75f56=>{const _0x16d4d0=_0x28fbbe;_0x4a21f7[_0x16d4d0(0x204)](_0x75f56),_0x5af398['verbose']&&console[_0x16d4d0(0x27b)]('\x20\x20'+_0x75f56);}},'journeyById':_0x316828,'activationStepsById':_0x46f929},_0x1fd040,_0x4c5a82),{'verbose':_0x5af398[_0x28fbbe(0x208)]})[_0x28fbbe(0x230)](_0xa5f694=>_0xa5f694[_0x28fbbe(0x1ea)]);for(const _0x3c3aee of _0x5d8e1c){_0x52ba56[_0x28fbbe(0x20a)](_0x3c3aee);}const _0x5eb035=_0x3ac655?[]:findJourneysToDelete(_0x1746b5,_0x344554[_0x28fbbe(0x25e)](({yamlConfig:_0x515933,folderPath:_0x1547a3})=>({'yamlConfig':_0x515933,'folderPath':resolveTDFolderPath(_0x1547a3,_0x1fd040,_0x4c5a82)})),_0x217163,_0x4c5a82,_0x1fd040),_0x27b35f=calculatePushStats(_0x29193a,_0x57b842,_0x52ba56,_0x3d8f9c,_0x5eb035,!!_0x5af398[_0x28fbbe(0x22b)],!!_0x5af398['journeysOnly']),_0x20b786=_0x27b35f['segments'][_0x28fbbe(0x247)],_0x241d59=_0x27b35f['segments'][_0x28fbbe(0x263)],_0x1727cf=_0x27b35f['segments'][_0x28fbbe(0x20b)],_0x58eabe=_0x27b35f['segments'][_0x28fbbe(0x21f)],_0x5f5177=_0x27b35f[_0x28fbbe(0x22c)][_0x28fbbe(0x253)],_0x584456=_0x27b35f[_0x28fbbe(0x246)][_0x28fbbe(0x247)],_0x448675=_0x27b35f[_0x28fbbe(0x246)][_0x28fbbe(0x263)],_0x121350=_0x27b35f[_0x28fbbe(0x246)]['unchanged'],_0x28ee67=_0x27b35f[_0x28fbbe(0x246)]['toDelete'],_0x1658fd=_0x27b35f['activations'][_0x28fbbe(0x23a)],_0x21f4b8=_0x27b35f['activations'][_0x28fbbe(0x253)],_0x241418=_0x27b35f[_0x28fbbe(0x249)]['toUpdate'],_0x30fb5c=_0x27b35f[_0x28fbbe(0x249)][_0x28fbbe(0x21f)];console[_0x28fbbe(0x27b)](_0x28fbbe(0x222)+_0x432fef+'\x27:');_0x5f5177[_0x28fbbe(0x1f5)]>0x0&&console[_0x28fbbe(0x27b)]('\x20\x20'+a45_0x3078e4[_0x28fbbe(0x255)](_0x28fbbe(0x21e)+_0x5f5177[_0x28fbbe(0x1f5)]+'\x20folders\x20to\x20create'));if(!_0x5af398[_0x28fbbe(0x244)]){console[_0x28fbbe(0x27b)](_0x28fbbe(0x27c)),console['error']('\x20\x20\x20\x20'+a45_0x3078e4[_0x28fbbe(0x1f1)]('+\x20'+_0x20b786[_0x28fbbe(0x1f5)]+'\x20new')),console[_0x28fbbe(0x27b)](_0x28fbbe(0x268)+a45_0x3078e4[_0x28fbbe(0x203)]('~\x20'+_0x241d59[_0x28fbbe(0x1f5)]+'\x20changed'));if(_0x58eabe[_0x28fbbe(0x1f5)]>0x0)console[_0x28fbbe(0x27b)](_0x28fbbe(0x268)+a45_0x3078e4[_0x28fbbe(0x23f)]('-\x20'+_0x58eabe[_0x28fbbe(0x1f5)]+_0x28fbbe(0x1eb)));else _0x3d8f9c[_0x28fbbe(0x1f5)]>0x0&&!_0x5af398[_0x28fbbe(0x22b)]&&console[_0x28fbbe(0x27b)](_0x28fbbe(0x268)+a45_0x3078e4[_0x28fbbe(0x267)](_0x3d8f9c[_0x28fbbe(0x1f5)]+_0x28fbbe(0x21c)));console['error'](_0x28fbbe(0x268)+a45_0x3078e4[_0x28fbbe(0x267)]('=\x20'+_0x1727cf[_0x28fbbe(0x1f5)]+_0x28fbbe(0x1ec)));}if(_0x57b842[_0x28fbbe(0x1f5)]>0x0||_0x5eb035[_0x28fbbe(0x1f5)]>0x0){console[_0x28fbbe(0x27b)]('\x20\x20🗺️\x20\x20Journeys:'),console['error']('\x20\x20\x20\x20'+a45_0x3078e4[_0x28fbbe(0x1f1)]('+\x20'+_0x584456['length']+_0x28fbbe(0x282))),console[_0x28fbbe(0x27b)](_0x28fbbe(0x268)+a45_0x3078e4[_0x28fbbe(0x203)]('~\x20'+_0x448675[_0x28fbbe(0x1f5)]+'\x20changed'));if(_0x28ee67[_0x28fbbe(0x1f5)]>0x0)console[_0x28fbbe(0x27b)](_0x28fbbe(0x268)+a45_0x3078e4[_0x28fbbe(0x23f)]('-\x20'+_0x28ee67[_0x28fbbe(0x1f5)]+'\x20to\x20delete'));else _0x5eb035[_0x28fbbe(0x1f5)]>0x0&&!_0x5af398[_0x28fbbe(0x22b)]&&console[_0x28fbbe(0x27b)](_0x28fbbe(0x268)+a45_0x3078e4[_0x28fbbe(0x267)](_0x5eb035['length']+_0x28fbbe(0x21c)));console['error']('\x20\x20\x20\x20'+a45_0x3078e4[_0x28fbbe(0x267)]('=\x20'+_0x121350['length']+_0x28fbbe(0x1ec)));}_0x1658fd['length']>0x0&&!_0x5af398['journeysOnly']&&(console[_0x28fbbe(0x27b)](''),console[_0x28fbbe(0x27b)](_0x28fbbe(0x221)),_0x21f4b8[_0x28fbbe(0x1f5)]>0x0&&console[_0x28fbbe(0x27b)](_0x28fbbe(0x268)+a45_0x3078e4[_0x28fbbe(0x1f1)]('+\x20'+_0x21f4b8['length']+'\x20to\x20create')),_0x241418[_0x28fbbe(0x1f5)]>0x0&&console[_0x28fbbe(0x27b)](_0x28fbbe(0x268)+a45_0x3078e4[_0x28fbbe(0x203)]('~\x20'+_0x241418[_0x28fbbe(0x1f5)]+_0x28fbbe(0x256))),_0x30fb5c[_0x28fbbe(0x1f5)]>0x0&&console[_0x28fbbe(0x27b)]('\x20\x20\x20\x20'+a45_0x3078e4[_0x28fbbe(0x23f)]('-\x20'+_0x30fb5c['length']+_0x28fbbe(0x1eb))));console[_0x28fbbe(0x27b)](_0x28fbbe(0x284)+a45_0x3078e4['cyan'](_0x1cd512)+'\x0a');if(_0x5f5177[_0x28fbbe(0x1f5)]>0x0){console[_0x28fbbe(0x27b)](_0x28fbbe(0x280));for(const _0x10bd20 of _0x5f5177){console[_0x28fbbe(0x27b)]('\x20\x20'+a45_0x3078e4[_0x28fbbe(0x255)]('+')+'\x20'+_0x10bd20);}console[_0x28fbbe(0x27b)]('');}if(_0x20b786[_0x28fbbe(0x1f5)]>0x0&&!_0x5af398[_0x28fbbe(0x244)])for(const _0x16ad90 of _0x20b786){const _0x470946=_0x16ad90[_0x28fbbe(0x211)]?_0x16ad90[_0x28fbbe(0x211)]+'/'+_0x16ad90[_0x28fbbe(0x273)][_0x28fbbe(0x1fc)]:_0x16ad90['yamlConfig'][_0x28fbbe(0x1fc)],_0x3a74e1=_0x16ad90['yamlConfig'][_0x28fbbe(0x249)]?.['length']||0x0,_0x4bfe76=_0x3a74e1>0x0?a45_0x3078e4['dim']('\x20['+_0x3a74e1+_0x28fbbe(0x20d)):'';console[_0x28fbbe(0x27b)]('\x0a'+a45_0x3078e4[_0x28fbbe(0x1f1)]('New\x20segment:')+'\x20'+_0x470946+_0x4bfe76),console[_0x28fbbe(0x27b)]('─'[_0x28fbbe(0x260)](0x3c)),_0x16ad90[_0x28fbbe(0x240)]&&console['error'](_0x16ad90[_0x28fbbe(0x240)]),console['error']('─'[_0x28fbbe(0x260)](0x3c));}if(_0x58eabe['length']>0x0&&!_0x5af398[_0x28fbbe(0x244)])for(const _0x27ba1b of _0x58eabe){const _0x33c1e8=_0x27ba1b[_0x28fbbe(0x272)]?_0x217163[_0x28fbbe(0x1fa)](_0x27ba1b['segmentFolderId'][_0x28fbbe(0x27a)]())||'':'',_0x41f3cb=_0x33c1e8?_0x33c1e8+'/'+_0x27ba1b[_0x28fbbe(0x1fc)]:_0x27ba1b['name'],_0x42bcf2=_0x34229d[_0x28fbbe(0x1fa)](_0x27ba1b['id'])||[],_0x2d2cef=_0x42bcf2['length']>0x0?a45_0x3078e4[_0x28fbbe(0x267)]('\x20['+_0x42bcf2[_0x28fbbe(0x1f5)]+_0x28fbbe(0x20d)):'';console[_0x28fbbe(0x27b)]('\x0a'+a45_0x3078e4[_0x28fbbe(0x23f)](_0x28fbbe(0x223))+'\x20'+_0x41f3cb+_0x2d2cef),console['error']('─'['repeat'](0x3c));const _0x1623bb=segmentWithActivationsToYaml(_0x27ba1b,_0x42bcf2,undefined,_0x5f537a,_0x3f7c19),_0x4fb5b0=segmentToYamlString(_0x1623bb),_0x262390=generateDiff(_0x4fb5b0,'');console[_0x28fbbe(0x27b)](formatDiffWithColors(_0x262390)),console[_0x28fbbe(0x27b)]('─'['repeat'](0x3c));}const _0x23acd4=_0x29193a[_0x28fbbe(0x225)](_0x96cba2=>!_0x96cba2[_0x28fbbe(0x21d)]&&_0x96cba2[_0x28fbbe(0x240)]);if(_0x23acd4[_0x28fbbe(0x1f5)]>0x0&&!_0x5af398[_0x28fbbe(0x244)])for(const _0x2cf29f of _0x23acd4){const _0x1cb2fa=_0x2cf29f[_0x28fbbe(0x211)]?_0x2cf29f[_0x28fbbe(0x211)]+'/'+_0x2cf29f['yamlConfig'][_0x28fbbe(0x1fc)]:_0x2cf29f[_0x28fbbe(0x273)][_0x28fbbe(0x1fc)];console['error']('\x0a'+a45_0x3078e4[_0x28fbbe(0x203)](_0x28fbbe(0x26a))+'\x20'+_0x1cb2fa),console[_0x28fbbe(0x27b)]('─'[_0x28fbbe(0x260)](0x3c)),console['error'](_0x2cf29f[_0x28fbbe(0x240)]),console['error']('─'[_0x28fbbe(0x260)](0x3c));}if(_0x584456[_0x28fbbe(0x1f5)]>0x0)for(const _0x5944de of _0x584456){const _0x57548c=_0x5944de[_0x28fbbe(0x211)]?_0x5944de[_0x28fbbe(0x211)]+'/'+_0x5944de['yamlConfig'][_0x28fbbe(0x1fc)]:_0x5944de['yamlConfig'][_0x28fbbe(0x1fc)];console[_0x28fbbe(0x27b)]('\x0a'+a45_0x3078e4['green'](_0x28fbbe(0x202))+'\x20'+_0x57548c),console[_0x28fbbe(0x27b)]('─'[_0x28fbbe(0x260)](0x3c)),_0x5944de[_0x28fbbe(0x240)]&&console[_0x28fbbe(0x27b)](_0x5944de[_0x28fbbe(0x240)]),console[_0x28fbbe(0x27b)]('─'[_0x28fbbe(0x260)](0x3c));}const _0xf69cc5=_0x57b842[_0x28fbbe(0x225)](_0x48eca4=>!_0x48eca4[_0x28fbbe(0x21d)]&&_0x48eca4[_0x28fbbe(0x240)]);if(_0xf69cc5[_0x28fbbe(0x1f5)]>0x0)for(const _0xee2bfd of _0xf69cc5){const _0x43ecbf=_0xee2bfd[_0x28fbbe(0x211)]?_0xee2bfd['folderPath']+'/'+_0xee2bfd['yamlConfig']['name']:_0xee2bfd[_0x28fbbe(0x273)][_0x28fbbe(0x1fc)];console[_0x28fbbe(0x27b)]('\x0a'+a45_0x3078e4[_0x28fbbe(0x203)](_0x28fbbe(0x227))+'\x20'+_0x43ecbf),console['error']('─'[_0x28fbbe(0x260)](0x3c)),console[_0x28fbbe(0x27b)](_0xee2bfd[_0x28fbbe(0x240)]),console[_0x28fbbe(0x27b)]('─'[_0x28fbbe(0x260)](0x3c));}if(_0x28ee67['length']>0x0)for(const _0x4abbd2 of _0x28ee67){const _0x452bdd=_0x4abbd2['folderId']?_0x217163[_0x28fbbe(0x1fa)](_0x4abbd2[_0x28fbbe(0x210)])||'':'',_0x4f4479=_0x452bdd?_0x452bdd+'/'+_0x4abbd2['journeyBundleName']:_0x4abbd2[_0x28fbbe(0x1ff)];console[_0x28fbbe(0x27b)]('\x0a'+a45_0x3078e4[_0x28fbbe(0x23f)](_0x28fbbe(0x233))+'\x20'+_0x4f4479),console[_0x28fbbe(0x27b)]('─'['repeat'](0x3c)),console[_0x28fbbe(0x27b)](a45_0x3078e4[_0x28fbbe(0x23f)](_0x28fbbe(0x1fb))),console[_0x28fbbe(0x27b)]('─'['repeat'](0x3c));}if(_0x5af398[_0x28fbbe(0x24b)])return console[_0x28fbbe(0x27b)](a45_0x3078e4['yellow'](_0x28fbbe(0x252))),0x0;const _0x2e9d50=_0x5af398['journeysOnly']?![]:_0x20b786[_0x28fbbe(0x1f5)]>0x0||_0x241d59[_0x28fbbe(0x1f5)]>0x0||_0x58eabe[_0x28fbbe(0x1f5)]>0x0,_0x4a6091=_0x584456[_0x28fbbe(0x1f5)]>0x0||_0x448675[_0x28fbbe(0x1f5)]>0x0||_0x28ee67[_0x28fbbe(0x1f5)]>0x0,_0x1e15fc=_0x5af398[_0x28fbbe(0x244)]?![]:_0x1658fd['length']>0x0,_0x46f3c2=_0x5f5177[_0x28fbbe(0x1f5)]>0x0;if(!_0x2e9d50&&!_0x4a6091&&!_0x1e15fc&&!_0x46f3c2){const _0x324c2f=_0x5af398[_0x28fbbe(0x244)]?_0x28fbbe(0x20e):_0x28fbbe(0x206);console[_0x28fbbe(0x27b)](a45_0x3078e4['green'](_0x324c2f));if(_0x3ac655&&_0x1727cf[_0x28fbbe(0x1f5)]===0x1){const _0x1890bb=_0x1727cf[0x0];if(_0x1890bb[_0x28fbbe(0x218)]?.['id']){const _0x4176c0=getConsoleNextUrl(_0x5af398['site'],_0x28fbbe(0x200)+_0x50c43f+_0x28fbbe(0x23b)+_0x1890bb[_0x28fbbe(0x218)]['id']+_0x28fbbe(0x26d));console[_0x28fbbe(0x27b)]('\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20'+a45_0x3078e4[_0x28fbbe(0x1f3)](_0x4176c0));}}if(_0x3ac655&&_0x121350[_0x28fbbe(0x1f5)]===0x1){const _0x2294d0=_0x121350[0x0];if(_0x2294d0[_0x28fbbe(0x214)]?.['id']){const _0xf0c984=getConsoleNextUrl(_0x5af398[_0x28fbbe(0x270)],_0x28fbbe(0x200)+_0x50c43f+'/e/'+_0x2294d0[_0x28fbbe(0x214)]['id']+'/j/da/je');console[_0x28fbbe(0x27b)]('\x20\x20'+a45_0x3078e4[_0x28fbbe(0x1f3)](_0xf0c984));}}return 0x0;}const _0x210117=_0x5af398[_0x28fbbe(0x244)]?_0x584456[_0x28fbbe(0x1f5)]+_0x448675['length']+_0x28ee67['length']+_0x5f5177[_0x28fbbe(0x1f5)]:_0x20b786[_0x28fbbe(0x1f5)]+_0x241d59[_0x28fbbe(0x1f5)]+_0x58eabe['length']+_0x584456['length']+_0x448675[_0x28fbbe(0x1f5)]+_0x28ee67[_0x28fbbe(0x1f5)]+_0x5f5177[_0x28fbbe(0x1f5)]+_0x1658fd['length'];if(!_0x5af398['yes']&&_0x210117>0x0){if(!isInteractive())return console[_0x28fbbe(0x27b)](a45_0x3078e4[_0x28fbbe(0x23f)](_0x28fbbe(0x264)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x28fbbe(0x27b)](a45_0x3078e4[_0x28fbbe(0x267)](_0x28fbbe(0x27d))),0x1;const _0x3b1d46=await confirmKey(_0x28fbbe(0x215)+_0x210117+'\x20changes?');if(!_0x3b1d46)return console[_0x28fbbe(0x27b)](a45_0x3078e4['yellow'](_0x28fbbe(0x258))),0x1;}const _0x5c8fc7={'withProgress':async(_0x401e16,_0x3c5979)=>{const _0x6a9b5f=_0x28fbbe,_0xda5432=await withSpinner(_0x401e16,_0x3c5979,{'verbose':_0x5af398[_0x6a9b5f(0x208)]});return{'data':_0xda5432[_0x6a9b5f(0x1ea)]};},'logInfo':_0x2516b5=>console[_0x28fbbe(0x27b)](a45_0x3078e4[_0x28fbbe(0x255)]('✔\x20'+_0x2516b5)),'logSuccess':_0xb689a=>console[_0x28fbbe(0x27b)](a45_0x3078e4[_0x28fbbe(0x1f1)]('✔\x20'+_0xb689a)),'logWarning':_0x3553ae=>console['error'](a45_0x3078e4[_0x28fbbe(0x203)]('⚠\x20'+_0x3553ae)),'logDeleted':_0x55c669=>console['error'](a45_0x3078e4[_0x28fbbe(0x23f)]('✔\x20'+_0x55c669))},_0x3c0428={'segment':_0x160d53['segment'],'journey':_0x160d53[_0x28fbbe(0x26e)],'user':_0x160d53[_0x28fbbe(0x234)],'connection':_0x160d53['connection']};_0x5f5177[_0x28fbbe(0x1f5)]>0x0&&(_0x5b903c=await executePushFolders(_0x3c0428,_0x5f5177,_0x5b903c,{'parentId':_0x50c43f},_0x5c8fc7));const _0x29417f={'rootFolderId':_0x593ab1,'folderPathToId':_0x5b903c,'folderIdToPath':_0x217163,'segmentNameToId':_0x2b6217,'activationsBySegmentId':_0x34229d,'emailToIdMap':_0x17aa80,'idToEmailMap':_0x5f537a,'connectionNameToIdMap':_0x73349f[_0x28fbbe(0x226)],'connectionIdToNameMap':_0x73349f[_0x28fbbe(0x242)],'connectionNameToTypeMap':_0x3a35e3},_0x1b81ca=await executePushSegments(_0x3c0428,_0x5af398[_0x28fbbe(0x244)]?[]:_0x29193a,_0x29417f,{'parentId':_0x50c43f},_0x5c8fc7),_0x282a68=_0x1b81ca[_0x28fbbe(0x25c)],_0xa7cdb8=_0x1b81ca[_0x28fbbe(0x27f)],_0x561463=_0x1b81ca[_0x28fbbe(0x249)][_0x28fbbe(0x25c)],_0x3734e4=_0x1b81ca[_0x28fbbe(0x249)][_0x28fbbe(0x27f)],_0x4810cf=_0x1b81ca[_0x28fbbe(0x249)]['deleted'];let _0x525260;if(_0x3ac655&&_0x29193a[_0x28fbbe(0x1f5)]===0x1){const _0x4527fc=_0x29193a[0x0];_0x525260=_0x4527fc[_0x28fbbe(0x218)]?.['id']??_0x1b81ca[_0x28fbbe(0x219)][_0x28fbbe(0x1fa)](_0x4527fc[_0x28fbbe(0x273)][_0x28fbbe(0x1fc)]);}const _0x1efd16=await executePushSegmentDeletions(_0x3c0428,_0x5af398[_0x28fbbe(0x244)]?[]:_0x58eabe,_0x5c8fc7);let _0xae4084=0x0,_0xb8565e=0x0,_0x6bd693=0x0;const _0x1e406d=new Map(_0x2b6217);for(const [_0x3766a1,_0x386c16]of _0x1b81ca['createdSegmentIds']){_0x1e406d[_0x28fbbe(0x220)](_0x3766a1,_0x386c16);}if(_0x57b842['length']>0x0){const _0x5a5f01={..._0x29417f,'segmentNameToId':_0x1e406d,'existingSegments':_0x5315a3,'activationContext':_0x4e361c},_0x53d3b0=await executePushJourneys(_0x3c0428,_0x57b842,_0x5a5f01,{'parentId':_0x50c43f,'rootFolderId':_0x593ab1,'verbose':_0x5af398['verbose']},_0x5c8fc7);_0xae4084=_0x53d3b0[_0x28fbbe(0x25c)],_0xb8565e=_0x53d3b0[_0x28fbbe(0x27f)];if(_0x3ac655&&_0x53d3b0[_0x28fbbe(0x23c)]['length']===0x1){const _0x143fe2=_0x53d3b0[_0x28fbbe(0x23c)][0x0];if(_0x143fe2[_0x28fbbe(0x1f0)]){const _0x24f65f=getConsoleNextUrl(_0x5af398[_0x28fbbe(0x270)],'/app/ps/'+_0x50c43f+_0x28fbbe(0x23b)+_0x143fe2[_0x28fbbe(0x1f0)]+_0x28fbbe(0x241));console[_0x28fbbe(0x27b)]('\x20\x20'+a45_0x3078e4[_0x28fbbe(0x1f3)](_0x24f65f));}}}for(const _0x572e68 of _0x28ee67){console[_0x28fbbe(0x27b)](a45_0x3078e4[_0x28fbbe(0x203)](_0x28fbbe(0x266)+_0x572e68[_0x28fbbe(0x1ff)])),_0x6bd693++;}const _0x4214f6=[];if(_0x282a68>0x0)_0x4214f6['push'](_0x282a68+'\x20created');if(_0xa7cdb8>0x0)_0x4214f6[_0x28fbbe(0x1ef)](_0xa7cdb8+'\x20updated');if(_0x1efd16>0x0)_0x4214f6[_0x28fbbe(0x1ef)](_0x1efd16+_0x28fbbe(0x277));const _0x2b689c=[];if(_0xae4084>0x0)_0x2b689c['push'](_0xae4084+_0x28fbbe(0x281));if(_0xb8565e>0x0)_0x2b689c[_0x28fbbe(0x1ef)](_0xb8565e+_0x28fbbe(0x25b));if(_0x6bd693>0x0)_0x2b689c[_0x28fbbe(0x1ef)](_0x6bd693+_0x28fbbe(0x277));const _0x3074a2=[];if(_0x561463>0x0)_0x3074a2[_0x28fbbe(0x1ef)](_0x561463+'\x20created');if(_0x3734e4>0x0)_0x3074a2[_0x28fbbe(0x1ef)](_0x3734e4+_0x28fbbe(0x25b));if(_0x4810cf>0x0)_0x3074a2[_0x28fbbe(0x1ef)](_0x4810cf+_0x28fbbe(0x277));console[_0x28fbbe(0x27b)](a45_0x3078e4['green'](_0x28fbbe(0x23d)));_0x4214f6[_0x28fbbe(0x1f5)]>0x0&&!_0x5af398[_0x28fbbe(0x244)]&&console[_0x28fbbe(0x27b)](_0x28fbbe(0x250)+_0x4214f6[_0x28fbbe(0x1f6)](',\x20'));_0x2b689c['length']>0x0&&console[_0x28fbbe(0x27b)](_0x28fbbe(0x228)+_0x2b689c[_0x28fbbe(0x1f6)](',\x20'));_0x3074a2[_0x28fbbe(0x1f5)]>0x0&&!_0x5af398[_0x28fbbe(0x244)]&&console[_0x28fbbe(0x27b)](_0x28fbbe(0x274)+_0x3074a2[_0x28fbbe(0x1f6)](',\x20'));if(_0x525260){const _0x4446db=getConsoleNextUrl(_0x5af398['site'],'/app/ps/'+_0x50c43f+_0x28fbbe(0x23b)+_0x525260+_0x28fbbe(0x26d));console['error'](_0x28fbbe(0x21a)+a45_0x3078e4[_0x28fbbe(0x1f3)](_0x4446db));}return 0x0;}}
1
+ const a45_0x4f6313=a45_0x52ae;(function(_0xcefd0b,_0x3ebb62){const _0x20c622=a45_0x52ae,_0x475ce6=_0xcefd0b();while(!![]){try{const _0x45b1ef=parseInt(_0x20c622(0xb0))/0x1*(parseInt(_0x20c622(0x10e))/0x2)+parseInt(_0x20c622(0x132))/0x3+parseInt(_0x20c622(0x103))/0x4*(-parseInt(_0x20c622(0x127))/0x5)+-parseInt(_0x20c622(0xdc))/0x6*(-parseInt(_0x20c622(0xff))/0x7)+parseInt(_0x20c622(0x108))/0x8*(parseInt(_0x20c622(0x106))/0x9)+parseInt(_0x20c622(0xd8))/0xa+parseInt(_0x20c622(0xbd))/0xb*(-parseInt(_0x20c622(0xe4))/0xc);if(_0x45b1ef===_0x3ebb62)break;else _0x475ce6['push'](_0x475ce6['shift']());}catch(_0x2d03bf){_0x475ce6['push'](_0x475ce6['shift']());}}}(a45_0x30ec,0xad3b5));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey,isInteractive}from'../utils/prompt.js';function a45_0x52ae(_0x347060,_0x3436d7){_0x347060=_0x347060-0xae;const _0x30ecc7=a45_0x30ec();let _0x52aec8=_0x30ecc7[_0x347060];return _0x52aec8;}import{batchAsync}from'../utils/async.js';function a45_0x30ec(){const _0x3df3c3=['(Journey\x20will\x20be\x20deleted)','journeyBundleName','endsWith','6110150bHIXFD','parentFolder','\x20created','\x20\x20Activations:\x20','970308sOJdnb','toUpdate','helpText','setPhase','repeat','data','errorCode','segmentFolderId','1495992ToKKTq','createdSegmentIds','Changes\x20to\x20journey:','name','buildUserMaps','updatedAt','/e/','site','get','attributes','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','error','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','length','segment:push','New\x20segment:','/app/ps/','dim','nameToId','targetDir','createdAt','filter','\x20changes?','folderPath','message','type','created','14dqrKWE','\x20new','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','Push\x20YAML\x20files\x20to\x20Treasure\x20AI\x20as\x20child\x20segments','280180OqxVQR','journey','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','3781233tuKpik','Aborted.','16ysGTOP','red','Source\x20directory:\x20','green','journeyBundleId','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','68xLYjkK','toDelete','isScoped','Error:\x20Directory\x20not\x20found:\x20','listJourneysWithDetailsFromParentSegment','all','nameToType','user','getParent','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','blue','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','push','.yaml','existingSegment','results','journeyId','cyan','/sb/da/esr','Scoped\x20to\x20folder:\x20','listSegments','yes','yamlConfig','Folders\x20to\x20create:','15WrJTsq','\x0aValidation\x20failed:','paused','\x20to\x20create','filePath','resolveParentId','folderId','\x20changed','Resolving\x20parent\x20segment\x20\x27','\x20\x20Journeys:\x20','toCreate','807837YxhBzH','\x20YAML\x20files\x20found','description','Push\x20','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','\x20\x20Activations:','delete','Fetching\x20existing\x20activations...','segment','Fetching\x20existing\x20data...','no_parent','parentName','diff','\x20\x20🗺️\x20\x20Journeys:','Parent\x20segment:\x20','map','unchanged','file','\x20deleted','getOutputSchemaWithCache','getJourney','\x20\x20\x20\x20','\x20updated','new','\x0aPush\x20summary\x20for\x20\x27','updated','📁\x20','listActivations','\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20','Site:\x20','dryRun','segment\x20or\x20journey','set','isNew','29265eMLvXp','audienceId','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','\x0a✔\x20Push\x20complete','relationships','segments','Delete\x20segment:','\x20folders\x20to\x20create','/j/da/je','list','\x0aError:','activations','Preparing\x20journeys...','187jKTrcx','Error:\x20','join','state','journeys','Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)','journeysOnly','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','verbose','\x20activations]','Error\x20parsing\x20YAML:\x20','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','\x20to\x20delete','deleted','connection','existingJourney','yellow','idToName','\x20to\x20update','\x20unchanged','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','then','Fetching\x20connections\x20for\x20name\x20resolution...','No\x20'];a45_0x30ec=function(){return _0x3df3c3;};return a45_0x30ec();}import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a45_0x1eded9 from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{[a45_0x4f6313(0xe7)]=a45_0x4f6313(0xf2);[a45_0x4f6313(0x134)]=a45_0x4f6313(0x102);async['execute'](_0x1abfd5){const _0x107756=a45_0x4f6313,{options:_0x2e8066,args:_0x328d1f,tdx:_0x53dfba}=_0x1abfd5,_0x11dc74=_0x2e8066,_0x335f6c=await resolveTarget({'arg':_0x328d1f[0x0],'contextParent':_0x2e8066['parentSegment'],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x335f6c))return _0x335f6c[_0x107756(0xe2)]===_0x107756(0x13c)?(console['error'](a45_0x1eded9[_0x107756(0xcd)](_0x107756(0xee))),console[_0x107756(0xef)](_0x107756(0xc2)),console['error'](_0x107756(0x10d)),console[_0x107756(0xef)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file')):(console['error'](a45_0x1eded9[_0x107756(0x109)](_0x107756(0xbe)+_0x335f6c[_0x107756(0xfc)]+'\x0a')),_0x335f6c[_0x107756(0xde)]&&console[_0x107756(0xef)](a45_0x1eded9[_0x107756(0x120)](_0x335f6c[_0x107756(0xde)]))),0x1;if(_0x335f6c[_0x107756(0xfd)]==='parent_name')return console[_0x107756(0xef)](a45_0x1eded9['red'](_0x107756(0x111)+_0x335f6c['targetDir']+'\x0a')),console[_0x107756(0xef)](a45_0x1eded9[_0x107756(0x120)](_0x107756(0xb2))),0x1;const _0x2327a5=_0x335f6c[_0x107756(0x13d)],_0x4af70e=_0x335f6c[_0x107756(0xf7)],_0x55319c=_0x335f6c['type']===_0x107756(0x143)?_0x335f6c[_0x107756(0x12b)]:undefined,_0x28b955=getScopedDetails(_0x335f6c),_0x3fb8e8=_0x28b955?.[_0x107756(0x110)]??![],_0x3235e4=_0x28b955?.['scopedFolderPath']??'';if(!existsSync(_0x4af70e))return console[_0x107756(0xef)](a45_0x1eded9[_0x107756(0x109)](_0x107756(0x111)+_0x4af70e+'\x0a')),console[_0x107756(0xef)](a45_0x1eded9[_0x107756(0x120)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;_0x11dc74[_0x107756(0xc5)]&&(console[_0x107756(0xef)](_0x107756(0x14f)+_0x11dc74[_0x107756(0xeb)]),console[_0x107756(0xef)](_0x107756(0x140)+_0x2327a5),console[_0x107756(0xef)](_0x107756(0x10a)+_0x4af70e),_0x3fb8e8&&console[_0x107756(0xef)](_0x107756(0x122)+_0x3235e4));const _0x5d1c42=await withSpinner(_0x107756(0x12f)+_0x2327a5+'\x27...',()=>_0x53dfba[_0x107756(0x13a)][_0x107756(0x12c)](_0x2327a5),{'verbose':_0x11dc74[_0x107756(0xc5)]}),_0x36af7a=_0x5d1c42['data'],{parentSegmentResult:_0x2c111b,segmentsResult:_0x3fcf5e,foldersResult:_0x55ec75,journeysWithDetailsResult:_0x1bb868,userMaps:_0x5bc422}=await withSpinner(_0x107756(0x13b),async()=>{const _0x27927c=_0x107756,[_0x304f88,_0xb91c4c,_0x660bd8,_0x119235,_0x4ee792]=await Promise['all']([_0x53dfba[_0x27927c(0x13a)][_0x27927c(0x116)](_0x36af7a),_0x53dfba['segment'][_0x27927c(0x123)](_0x36af7a),_0x53dfba[_0x27927c(0x13a)]['listFolders'](_0x36af7a),_0x53dfba[_0x27927c(0x104)][_0x27927c(0x112)](_0x36af7a,{'includeAllVersions':!![]}),_0x53dfba[_0x27927c(0x115)][_0x27927c(0xe8)]()]);return{'parentSegmentResult':_0x304f88,'segmentsResult':_0xb91c4c,'foldersResult':_0x660bd8,'journeysWithDetailsResult':_0x119235,'userMaps':_0x4ee792};},{'verbose':_0x11dc74[_0x107756(0xc5)]})['then'](_0x2bdccc=>_0x2bdccc['data']),_0x2a04ef=_0x2c111b,_0x3998c9=extractRootFolderId(_0x2a04ef),_0x42fecd=_0x3fcf5e,_0x58d7b7=_0x55ec75,{journeys:_0x504247,activationStepsById:_0xc7d5f4}=_0x1bb868,_0x50aab0=new Map(_0x504247[_0x107756(0x141)](_0x409efc=>[_0x409efc['id'],_0x409efc])),_0x274955=_0x504247[_0x107756(0x141)](_0x2a5639=>({'id':_0x2a5639['id'],'name':_0x2a5639['attributes'][_0x107756(0xe7)],'journeyBundleName':_0x2a5639[_0x107756(0xed)]['journeyBundleName']||'','journeyBundleId':_0x2a5639[_0x107756(0xed)][_0x107756(0x10c)]||'','versionNumber':_0x2a5639[_0x107756(0xed)]['versionNumber'],'description':_0x2a5639[_0x107756(0xed)]['description'],'state':_0x2a5639[_0x107756(0xed)][_0x107756(0xc0)],'paused':_0x2a5639[_0x107756(0xed)][_0x107756(0x129)],'audienceId':_0x2a5639['attributes'][_0x107756(0xb1)],'folderId':_0x2a5639[_0x107756(0xb4)]?.[_0x107756(0xd9)]?.[_0x107756(0xe1)]?.['id'],'createdAt':_0x2a5639[_0x107756(0xed)][_0x107756(0xf8)],'updatedAt':_0x2a5639['attributes'][_0x107756(0xe9)]})),{emailToId:_0x267a48,idToEmail:_0x5e3e1f}=_0x5bc422,_0x18f95f=await withSpinner(_0x107756(0xd3),async()=>{const _0x1841f1=_0x107756,_0x2dd062=await _0x53dfba[_0x1841f1(0xcb)][_0x1841f1(0xb9)]();return buildConnectionMaps(_0x2dd062);},{'verbose':_0x11dc74['verbose']})[_0x107756(0xd2)](_0x4d61ff=>_0x4d61ff[_0x107756(0xe1)]),_0x4cc297=_0x18f95f['nameToId'],_0x117416=_0x18f95f['idToName'],_0x49cf40=_0x18f95f[_0x107756(0x114)],_0x351f95={'emailToIdMap':_0x267a48,'connectionNameToIdMap':_0x4cc297,'connectionNameToTypeMap':_0x49cf40,'getSchema':_0x3b7faa=>_0x53dfba[_0x107756(0xcb)][_0x107756(0x145)](_0x3b7faa),'getMetadata':_0x142ed8=>_0x53dfba[_0x107756(0xcb)]['getMetadataWithCache'](_0x142ed8)};let {pathToId:_0x1f2e77,idToPath:_0x260a43}=buildFolderMaps(_0x58d7b7);const _0x1a8008=buildSegmentLookupMap(_0x42fecd,_0x260a43),_0x2f53a4=buildSegmentNameToIdMap(_0x42fecd),_0x1574b4=buildJourneyBundleLookupMap(_0x274955,_0x260a43);let _0x4efa83;if(_0x55319c){if(!_0x55319c['endsWith']('.yml')&&!_0x55319c[_0x107756(0xd7)](_0x107756(0x11c)))return console[_0x107756(0xef)](a45_0x1eded9[_0x107756(0x109)](_0x107756(0x136)+_0x55319c+'\x0a')),0x1;_0x4efa83=[_0x55319c];}else _0x4efa83=findYamlFiles(_0x4af70e);if(_0x4efa83['length']===0x0)return console[_0x107756(0xef)](a45_0x1eded9['red'](_0x107756(0xc4)+_0x4af70e+'\x0a')),console[_0x107756(0xef)](a45_0x1eded9['cyan'](_0x107756(0x101))),0x1;let _0x43f9a7,_0x44bd96;try{const _0x13618d=parseAndClassifyYamlFiles(_0x4efa83,_0x4af70e,{'skipSegments':_0x11dc74[_0x107756(0xc3)]});_0x43f9a7=_0x13618d['segments'],_0x44bd96=_0x13618d[_0x107756(0xc1)];const _0x4b4397=validateParsedFiles(_0x13618d,_0x4af70e);if(_0x4b4397[_0x107756(0xf1)]>0x0)return console[_0x107756(0xef)](a45_0x1eded9[_0x107756(0x109)](_0x107756(0x128))),console[_0x107756(0xef)](formatValidationErrors(_0x4b4397)),console[_0x107756(0xef)](a45_0x1eded9[_0x107756(0xcd)](_0x107756(0xd1))),0x1;}catch(_0x106ac2){return console[_0x107756(0xef)](a45_0x1eded9[_0x107756(0x109)](_0x107756(0xc7)+(_0x106ac2 instanceof Error?_0x106ac2['message']:_0x106ac2))),0x1;}if(_0x43f9a7['length']===0x0&&_0x44bd96[_0x107756(0xf1)]===0x0){const _0x16b2f7=_0x11dc74[_0x107756(0xc3)]?_0x107756(0x104):_0x107756(0x151);return console[_0x107756(0xef)](a45_0x1eded9[_0x107756(0xcd)](_0x107756(0xd4)+_0x16b2f7+_0x107756(0x133))),0x0;}const _0x460720=new Map();_0x42fecd['length']>0x0&&!_0x11dc74[_0x107756(0xc3)]&&await withSpinner(_0x107756(0x139),async()=>{await batchAsync(_0x42fecd,async _0x323f6e=>{const _0x59025f=a45_0x52ae,_0x18178e=await _0x53dfba[_0x59025f(0x13a)][_0x59025f(0x14d)](_0x36af7a,_0x323f6e['id']);_0x460720[_0x59025f(0xae)](_0x323f6e['id'],_0x18178e);});},{'verbose':_0x11dc74[_0x107756(0xc5)]});const {segmentFiles:_0xaf2227,foldersToCreate:_0x55a8a6}=await prepareSegmentFiles(_0x43f9a7,{'segmentByFolderAndName':_0x1a8008,'activationsBySegmentId':_0x460720,'folderPathToId':_0x1f2e77,'idToEmailMap':_0x5e3e1f,'connectionIdToNameMap':_0x117416},_0x351f95,_0x3fb8e8,_0x3235e4),_0x1fed61=_0x55319c?[]:findSegmentsToDelete(_0x42fecd,_0x43f9a7[_0x107756(0x141)](({yamlConfig:_0x3c5e6a,folderPath:_0x836167})=>({'yamlConfig':_0x3c5e6a,'folderPath':resolveTDFolderPath(_0x836167,_0x3fb8e8,_0x3235e4)})),_0x260a43,_0x3235e4,_0x3fb8e8),{journeyFiles:_0x529c6b,foldersToCreate:_0x30004d}=await withProgressSpinner(_0x107756(0xbc),async _0x59db99=>prepareJourneyFiles(_0x44bd96,{'fetchJourney':async _0x524ef5=>_0x53dfba['journey'][_0x107756(0x146)](_0x524ef5['journeyId']),'journeyBundlesByFolderAndName':_0x1574b4,'folderPathToId':_0x1f2e77,'idToEmailMap':_0x5e3e1f,'connectionIdToNameMap':_0x117416,'existingSegments':_0x42fecd,'parentId':_0x36af7a,'deps':_0x53dfba,'progress':{'update':_0x356bd7=>{const _0x2b3740=_0x107756;_0x59db99[_0x2b3740(0xdf)](_0x356bd7),_0x11dc74[_0x2b3740(0xc5)]&&console[_0x2b3740(0xef)]('\x20\x20'+_0x356bd7);}},'journeyById':_0x50aab0,'activationStepsById':_0xc7d5f4},_0x3fb8e8,_0x3235e4),{'verbose':_0x11dc74[_0x107756(0xc5)]})[_0x107756(0xd2)](_0x46e4d6=>_0x46e4d6[_0x107756(0xe1)]);for(const _0x1dd3ab of _0x30004d){_0x55a8a6['add'](_0x1dd3ab);}const _0x54f11=_0x55319c?[]:findJourneysToDelete(_0x274955,_0x44bd96[_0x107756(0x141)](({yamlConfig:_0x5aaca5,folderPath:_0xfee43f})=>({'yamlConfig':_0x5aaca5,'folderPath':resolveTDFolderPath(_0xfee43f,_0x3fb8e8,_0x3235e4)})),_0x260a43,_0x3235e4,_0x3fb8e8),_0x5937f7=calculatePushStats(_0xaf2227,_0x529c6b,_0x55a8a6,_0x1fed61,_0x54f11,!!_0x11dc74[_0x107756(0x138)],!!_0x11dc74[_0x107756(0xc3)]),_0xe93d36=_0x5937f7[_0x107756(0xb5)][_0x107756(0x149)],_0x2865de=_0x5937f7[_0x107756(0xb5)]['changed'],_0x4bed3a=_0x5937f7[_0x107756(0xb5)][_0x107756(0x142)],_0x4f8b25=_0x5937f7[_0x107756(0xb5)][_0x107756(0x10f)],_0x478d8d=_0x5937f7['folders'][_0x107756(0x131)],_0x15e779=_0x5937f7['journeys'][_0x107756(0x149)],_0x54059d=_0x5937f7[_0x107756(0xc1)]['changed'],_0xb12119=_0x5937f7[_0x107756(0xc1)][_0x107756(0x142)],_0x3eeff2=_0x5937f7[_0x107756(0xc1)][_0x107756(0x10f)],_0x2325d9=_0x5937f7['activations'][_0x107756(0x113)],_0x5625c6=_0x5937f7['activations']['toCreate'],_0x222be0=_0x5937f7[_0x107756(0xbb)][_0x107756(0xdd)],_0x55ddde=_0x5937f7['activations'][_0x107756(0x10f)];console[_0x107756(0xef)](_0x107756(0x14a)+_0x2327a5+'\x27:');_0x478d8d[_0x107756(0xf1)]>0x0&&console[_0x107756(0xef)]('\x20\x20'+a45_0x1eded9[_0x107756(0x118)](_0x107756(0x14c)+_0x478d8d['length']+_0x107756(0xb7)));if(!_0x11dc74[_0x107756(0xc3)]){console['error']('\x20\x20📊\x20Segments:'),console[_0x107756(0xef)](_0x107756(0x147)+a45_0x1eded9['green']('+\x20'+_0xe93d36[_0x107756(0xf1)]+_0x107756(0x100))),console[_0x107756(0xef)](_0x107756(0x147)+a45_0x1eded9[_0x107756(0xcd)]('~\x20'+_0x2865de[_0x107756(0xf1)]+_0x107756(0x12e)));if(_0x4f8b25['length']>0x0)console[_0x107756(0xef)](_0x107756(0x147)+a45_0x1eded9[_0x107756(0x109)]('-\x20'+_0x4f8b25[_0x107756(0xf1)]+_0x107756(0xc9)));else _0x1fed61['length']>0x0&&!_0x11dc74[_0x107756(0x138)]&&console[_0x107756(0xef)](_0x107756(0x147)+a45_0x1eded9[_0x107756(0xf5)](_0x1fed61['length']+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x107756(0xef)](_0x107756(0x147)+a45_0x1eded9['dim']('=\x20'+_0x4bed3a[_0x107756(0xf1)]+_0x107756(0xd0)));}if(_0x529c6b[_0x107756(0xf1)]>0x0||_0x54f11[_0x107756(0xf1)]>0x0){console['error'](_0x107756(0x13f)),console[_0x107756(0xef)](_0x107756(0x147)+a45_0x1eded9[_0x107756(0x10b)]('+\x20'+_0x15e779['length']+_0x107756(0x100))),console[_0x107756(0xef)]('\x20\x20\x20\x20'+a45_0x1eded9[_0x107756(0xcd)]('~\x20'+_0x54059d[_0x107756(0xf1)]+_0x107756(0x12e)));if(_0x3eeff2[_0x107756(0xf1)]>0x0)console['error']('\x20\x20\x20\x20'+a45_0x1eded9[_0x107756(0x109)]('-\x20'+_0x3eeff2[_0x107756(0xf1)]+_0x107756(0xc9)));else _0x54f11[_0x107756(0xf1)]>0x0&&!_0x11dc74['delete']&&console[_0x107756(0xef)](_0x107756(0x147)+a45_0x1eded9[_0x107756(0xf5)](_0x54f11['length']+_0x107756(0x105)));console[_0x107756(0xef)]('\x20\x20\x20\x20'+a45_0x1eded9['dim']('=\x20'+_0xb12119[_0x107756(0xf1)]+_0x107756(0xd0)));}_0x2325d9[_0x107756(0xf1)]>0x0&&!_0x11dc74['journeysOnly']&&(console[_0x107756(0xef)](''),console[_0x107756(0xef)](_0x107756(0x137)),_0x5625c6['length']>0x0&&console['error']('\x20\x20\x20\x20'+a45_0x1eded9[_0x107756(0x10b)]('+\x20'+_0x5625c6['length']+_0x107756(0x12a))),_0x222be0[_0x107756(0xf1)]>0x0&&console['error'](_0x107756(0x147)+a45_0x1eded9[_0x107756(0xcd)]('~\x20'+_0x222be0['length']+_0x107756(0xcf))),_0x55ddde[_0x107756(0xf1)]>0x0&&console[_0x107756(0xef)](_0x107756(0x147)+a45_0x1eded9['red']('-\x20'+_0x55ddde['length']+'\x20to\x20delete')));console['error']('\x20\x20Source:\x20'+a45_0x1eded9[_0x107756(0x120)](_0x4af70e)+'\x0a');if(_0x478d8d[_0x107756(0xf1)]>0x0){console[_0x107756(0xef)](_0x107756(0x126));for(const _0x5e16e7 of _0x478d8d){console[_0x107756(0xef)]('\x20\x20'+a45_0x1eded9[_0x107756(0x118)]('+')+'\x20'+_0x5e16e7);}console[_0x107756(0xef)]('');}if(_0xe93d36['length']>0x0&&!_0x11dc74['journeysOnly'])for(const _0x204569 of _0xe93d36){const _0x3919c2=_0x204569['folderPath']?_0x204569[_0x107756(0xfb)]+'/'+_0x204569['yamlConfig']['name']:_0x204569['yamlConfig'][_0x107756(0xe7)],_0x19b220=_0x204569['yamlConfig'][_0x107756(0xbb)]?.[_0x107756(0xf1)]||0x0,_0x289050=_0x19b220>0x0?a45_0x1eded9[_0x107756(0xf5)]('\x20['+_0x19b220+'\x20activations]'):'';console[_0x107756(0xef)]('\x0a'+a45_0x1eded9[_0x107756(0x10b)](_0x107756(0xf3))+'\x20'+_0x3919c2+_0x289050),console[_0x107756(0xef)]('─'['repeat'](0x3c)),_0x204569[_0x107756(0x13e)]&&console[_0x107756(0xef)](_0x204569[_0x107756(0x13e)]),console[_0x107756(0xef)]('─'[_0x107756(0xe0)](0x3c));}if(_0x4f8b25[_0x107756(0xf1)]>0x0&&!_0x11dc74['journeysOnly'])for(const _0x3c38ab of _0x4f8b25){const _0x1fdc5d=_0x3c38ab[_0x107756(0xe3)]?_0x260a43[_0x107756(0xec)](_0x3c38ab[_0x107756(0xe3)]['toString']())||'':'',_0x722934=_0x1fdc5d?_0x1fdc5d+'/'+_0x3c38ab['name']:_0x3c38ab['name'],_0x2f5448=_0x460720[_0x107756(0xec)](_0x3c38ab['id'])||[],_0x176519=_0x2f5448[_0x107756(0xf1)]>0x0?a45_0x1eded9[_0x107756(0xf5)]('\x20['+_0x2f5448[_0x107756(0xf1)]+_0x107756(0xc6)):'';console[_0x107756(0xef)]('\x0a'+a45_0x1eded9['red'](_0x107756(0xb6))+'\x20'+_0x722934+_0x176519),console[_0x107756(0xef)]('─'[_0x107756(0xe0)](0x3c));const _0x2bf221=segmentWithActivationsToYaml(_0x3c38ab,_0x2f5448,undefined,_0x5e3e1f,_0x117416),_0x46fae6=segmentToYamlString(_0x2bf221),_0x34b25d=generateDiff(_0x46fae6,'');console['error'](formatDiffWithColors(_0x34b25d)),console[_0x107756(0xef)]('─'[_0x107756(0xe0)](0x3c));}const _0x71053b=_0xaf2227[_0x107756(0xf9)](_0xbe8668=>!_0xbe8668[_0x107756(0xaf)]&&_0xbe8668['diff']);if(_0x71053b[_0x107756(0xf1)]>0x0&&!_0x11dc74['journeysOnly'])for(const _0x8599b9 of _0x71053b){const _0x3655dd=_0x8599b9[_0x107756(0xfb)]?_0x8599b9[_0x107756(0xfb)]+'/'+_0x8599b9[_0x107756(0x125)][_0x107756(0xe7)]:_0x8599b9['yamlConfig'][_0x107756(0xe7)];console[_0x107756(0xef)]('\x0a'+a45_0x1eded9['yellow']('Changes\x20to:')+'\x20'+_0x3655dd),console[_0x107756(0xef)]('─'['repeat'](0x3c)),console[_0x107756(0xef)](_0x8599b9[_0x107756(0x13e)]),console[_0x107756(0xef)]('─'[_0x107756(0xe0)](0x3c));}if(_0x15e779[_0x107756(0xf1)]>0x0)for(const _0x3394d6 of _0x15e779){const _0x5898b8=_0x3394d6[_0x107756(0xfb)]?_0x3394d6[_0x107756(0xfb)]+'/'+_0x3394d6[_0x107756(0x125)][_0x107756(0xe7)]:_0x3394d6[_0x107756(0x125)][_0x107756(0xe7)];console[_0x107756(0xef)]('\x0a'+a45_0x1eded9[_0x107756(0x10b)]('New\x20journey:')+'\x20'+_0x5898b8),console[_0x107756(0xef)]('─'['repeat'](0x3c)),_0x3394d6['diff']&&console[_0x107756(0xef)](_0x3394d6[_0x107756(0x13e)]),console['error']('─'[_0x107756(0xe0)](0x3c));}const _0xd804ae=_0x529c6b[_0x107756(0xf9)](_0x359f21=>!_0x359f21[_0x107756(0xaf)]&&_0x359f21[_0x107756(0x13e)]);if(_0xd804ae[_0x107756(0xf1)]>0x0)for(const _0x1a7fec of _0xd804ae){const _0x2727d1=_0x1a7fec['folderPath']?_0x1a7fec['folderPath']+'/'+_0x1a7fec[_0x107756(0x125)]['name']:_0x1a7fec['yamlConfig'][_0x107756(0xe7)];console[_0x107756(0xef)]('\x0a'+a45_0x1eded9[_0x107756(0xcd)](_0x107756(0xe6))+'\x20'+_0x2727d1),console[_0x107756(0xef)]('─'[_0x107756(0xe0)](0x3c)),console['error'](_0x1a7fec[_0x107756(0x13e)]),console[_0x107756(0xef)]('─'[_0x107756(0xe0)](0x3c));}if(_0x3eeff2[_0x107756(0xf1)]>0x0)for(const _0x5bc85a of _0x3eeff2){const _0x5b167c=_0x5bc85a[_0x107756(0x12d)]?_0x260a43[_0x107756(0xec)](_0x5bc85a[_0x107756(0x12d)])||'':'',_0x12dfd0=_0x5b167c?_0x5b167c+'/'+_0x5bc85a[_0x107756(0xd6)]:_0x5bc85a['journeyBundleName'];console['error']('\x0a'+a45_0x1eded9[_0x107756(0x109)]('Delete\x20journey:')+'\x20'+_0x12dfd0),console[_0x107756(0xef)]('─'[_0x107756(0xe0)](0x3c)),console[_0x107756(0xef)](a45_0x1eded9[_0x107756(0x109)](_0x107756(0xd5))),console[_0x107756(0xef)]('─'['repeat'](0x3c));}if(_0x11dc74[_0x107756(0x150)])return console[_0x107756(0xef)](a45_0x1eded9[_0x107756(0xcd)](_0x107756(0x119))),0x0;const _0x580a48=_0x11dc74['journeysOnly']?![]:_0xe93d36['length']>0x0||_0x2865de['length']>0x0||_0x4f8b25[_0x107756(0xf1)]>0x0,_0x3e4bb7=_0x15e779[_0x107756(0xf1)]>0x0||_0x54059d['length']>0x0||_0x3eeff2[_0x107756(0xf1)]>0x0,_0x5710e5=_0x11dc74[_0x107756(0xc3)]?![]:_0x2325d9[_0x107756(0xf1)]>0x0,_0x5ecb38=_0x478d8d['length']>0x0;if(!_0x580a48&&!_0x3e4bb7&&!_0x5710e5&&!_0x5ecb38){const _0x290551=_0x11dc74['journeysOnly']?_0x107756(0x117):_0x107756(0xf0);console[_0x107756(0xef)](a45_0x1eded9[_0x107756(0x10b)](_0x290551));if(_0x55319c&&_0x4bed3a[_0x107756(0xf1)]===0x1){const _0x4c30bf=_0x4bed3a[0x0];if(_0x4c30bf[_0x107756(0x11d)]?.['id']){const _0x158f75=getConsoleNextUrl(_0x11dc74[_0x107756(0xeb)],_0x107756(0xf4)+_0x36af7a+_0x107756(0xea)+_0x4c30bf[_0x107756(0x11d)]['id']+_0x107756(0x121));console[_0x107756(0xef)](_0x107756(0x14e)+a45_0x1eded9[_0x107756(0x120)](_0x158f75));}}if(_0x55319c&&_0xb12119[_0x107756(0xf1)]===0x1){const _0x3d4dd1=_0xb12119[0x0];if(_0x3d4dd1[_0x107756(0xcc)]?.['id']){const _0x5ac1bd=getConsoleNextUrl(_0x11dc74[_0x107756(0xeb)],_0x107756(0xf4)+_0x36af7a+_0x107756(0xea)+_0x3d4dd1[_0x107756(0xcc)]['id']+'/j/da/je');console[_0x107756(0xef)]('\x20\x20'+a45_0x1eded9[_0x107756(0x120)](_0x5ac1bd));}}return 0x0;}const _0x2bfdb8=_0x11dc74[_0x107756(0xc3)]?_0x15e779[_0x107756(0xf1)]+_0x54059d[_0x107756(0xf1)]+_0x3eeff2['length']+_0x478d8d[_0x107756(0xf1)]:_0xe93d36[_0x107756(0xf1)]+_0x2865de[_0x107756(0xf1)]+_0x4f8b25['length']+_0x15e779[_0x107756(0xf1)]+_0x54059d[_0x107756(0xf1)]+_0x3eeff2['length']+_0x478d8d[_0x107756(0xf1)]+_0x2325d9[_0x107756(0xf1)];if(!_0x11dc74[_0x107756(0x124)]&&_0x2bfdb8>0x0){if(!isInteractive())return console['error'](a45_0x1eded9[_0x107756(0x109)](_0x107756(0xba)),_0x107756(0x11a)),console[_0x107756(0xef)](a45_0x1eded9[_0x107756(0xf5)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x1dbc5d=await confirmKey(_0x107756(0x135)+_0x2bfdb8+_0x107756(0xfa));if(!_0x1dbc5d)return console[_0x107756(0xef)](a45_0x1eded9['yellow'](_0x107756(0x107))),0x1;}const _0x11c9b4={'withProgress':async(_0x381e89,_0x1354d4)=>{const _0x276151=_0x107756,_0xf5cc45=await withSpinner(_0x381e89,_0x1354d4,{'verbose':_0x11dc74['verbose']});return{'data':_0xf5cc45[_0x276151(0xe1)]};},'logInfo':_0x2ad0cd=>console[_0x107756(0xef)](a45_0x1eded9[_0x107756(0x118)]('✔\x20'+_0x2ad0cd)),'logSuccess':_0xd37dfb=>console[_0x107756(0xef)](a45_0x1eded9[_0x107756(0x10b)]('✔\x20'+_0xd37dfb)),'logWarning':_0x531189=>console[_0x107756(0xef)](a45_0x1eded9['yellow']('⚠\x20'+_0x531189)),'logDeleted':_0x10d249=>console[_0x107756(0xef)](a45_0x1eded9[_0x107756(0x109)]('✔\x20'+_0x10d249))},_0x900491={'segment':_0x53dfba['segment'],'journey':_0x53dfba[_0x107756(0x104)],'user':_0x53dfba[_0x107756(0x115)],'connection':_0x53dfba[_0x107756(0xcb)]};_0x478d8d[_0x107756(0xf1)]>0x0&&(_0x1f2e77=await executePushFolders(_0x900491,_0x478d8d,_0x1f2e77,{'parentId':_0x36af7a},_0x11c9b4));const _0x1d8c2c={'rootFolderId':_0x3998c9,'folderPathToId':_0x1f2e77,'folderIdToPath':_0x260a43,'segmentNameToId':_0x2f53a4,'activationsBySegmentId':_0x460720,'emailToIdMap':_0x267a48,'idToEmailMap':_0x5e3e1f,'connectionNameToIdMap':_0x18f95f[_0x107756(0xf6)],'connectionIdToNameMap':_0x18f95f[_0x107756(0xce)],'connectionNameToTypeMap':_0x49cf40},_0x5925e7=await executePushSegments(_0x900491,_0x11dc74['journeysOnly']?[]:_0xaf2227,_0x1d8c2c,{'parentId':_0x36af7a},_0x11c9b4),_0x2b533f=_0x5925e7[_0x107756(0xfe)],_0x500f62=_0x5925e7[_0x107756(0x14b)],_0x3fbbfd=_0x5925e7[_0x107756(0xbb)][_0x107756(0xfe)],_0x72d53b=_0x5925e7[_0x107756(0xbb)]['updated'],_0x8866c0=_0x5925e7[_0x107756(0xbb)][_0x107756(0xca)];let _0x546cc2;if(_0x55319c&&_0xaf2227['length']===0x1){const _0x22f1bc=_0xaf2227[0x0];_0x546cc2=_0x22f1bc['existingSegment']?.['id']??_0x5925e7[_0x107756(0xe5)][_0x107756(0xec)](_0x22f1bc['yamlConfig'][_0x107756(0xe7)]);}const _0x9012c6=await executePushSegmentDeletions(_0x900491,_0x11dc74[_0x107756(0xc3)]?[]:_0x4f8b25,_0x11c9b4);let _0x49651b=0x0,_0x59db37=0x0,_0x49a20d=0x0;const _0x7520da=new Map(_0x2f53a4);for(const [_0x20c41e,_0x37b1fe]of _0x5925e7['createdSegmentIds']){_0x7520da[_0x107756(0xae)](_0x20c41e,_0x37b1fe);}if(_0x529c6b[_0x107756(0xf1)]>0x0){const _0x21185b={..._0x1d8c2c,'segmentNameToId':_0x7520da,'existingSegments':_0x42fecd,'activationContext':_0x351f95},_0x5097cf=await executePushJourneys(_0x900491,_0x529c6b,_0x21185b,{'parentId':_0x36af7a,'rootFolderId':_0x3998c9,'verbose':_0x11dc74[_0x107756(0xc5)]},_0x11c9b4);_0x49651b=_0x5097cf[_0x107756(0xfe)],_0x59db37=_0x5097cf[_0x107756(0x14b)];if(_0x55319c&&_0x5097cf[_0x107756(0x11e)][_0x107756(0xf1)]===0x1){const _0x3c1f90=_0x5097cf['results'][0x0];if(_0x3c1f90[_0x107756(0x11f)]){const _0x505458=getConsoleNextUrl(_0x11dc74[_0x107756(0xeb)],_0x107756(0xf4)+_0x36af7a+_0x107756(0xea)+_0x3c1f90['journeyId']+_0x107756(0xb8));console[_0x107756(0xef)]('\x20\x20'+a45_0x1eded9[_0x107756(0x120)](_0x505458));}}}for(const _0x5d4d03 of _0x3eeff2){console[_0x107756(0xef)](a45_0x1eded9[_0x107756(0xcd)](_0x107756(0xc8)+_0x5d4d03['journeyBundleName'])),_0x49a20d++;}const _0x60c051=[];if(_0x2b533f>0x0)_0x60c051[_0x107756(0x11b)](_0x2b533f+_0x107756(0xda));if(_0x500f62>0x0)_0x60c051[_0x107756(0x11b)](_0x500f62+_0x107756(0x148));if(_0x9012c6>0x0)_0x60c051[_0x107756(0x11b)](_0x9012c6+_0x107756(0x144));const _0x4fd7c6=[];if(_0x49651b>0x0)_0x4fd7c6[_0x107756(0x11b)](_0x49651b+_0x107756(0xda));if(_0x59db37>0x0)_0x4fd7c6[_0x107756(0x11b)](_0x59db37+'\x20updated');if(_0x49a20d>0x0)_0x4fd7c6[_0x107756(0x11b)](_0x49a20d+_0x107756(0x144));const _0x14e522=[];if(_0x3fbbfd>0x0)_0x14e522[_0x107756(0x11b)](_0x3fbbfd+_0x107756(0xda));if(_0x72d53b>0x0)_0x14e522[_0x107756(0x11b)](_0x72d53b+_0x107756(0x148));if(_0x8866c0>0x0)_0x14e522[_0x107756(0x11b)](_0x8866c0+_0x107756(0x144));console[_0x107756(0xef)](a45_0x1eded9[_0x107756(0x10b)](_0x107756(0xb3)));_0x60c051[_0x107756(0xf1)]>0x0&&!_0x11dc74[_0x107756(0xc3)]&&console[_0x107756(0xef)]('\x20\x20Segments:\x20'+_0x60c051[_0x107756(0xbf)](',\x20'));_0x4fd7c6[_0x107756(0xf1)]>0x0&&console['error'](_0x107756(0x130)+_0x4fd7c6[_0x107756(0xbf)](',\x20'));_0x14e522[_0x107756(0xf1)]>0x0&&!_0x11dc74[_0x107756(0xc3)]&&console[_0x107756(0xef)](_0x107756(0xdb)+_0x14e522[_0x107756(0xbf)](',\x20'));if(_0x546cc2){const _0x3aa133=getConsoleNextUrl(_0x11dc74[_0x107756(0xeb)],_0x107756(0xf4)+_0x36af7a+'/e/'+_0x546cc2+'/sb/da/esr');console['error']('\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20'+a45_0x1eded9[_0x107756(0x120)](_0x3aa133));}return 0x0;}}
@@ -1 +1 @@
1
- function a46_0x2ddd(_0xa4a9b6,_0x21f506){_0xa4a9b6=_0xa4a9b6-0xc9;const _0x1260c0=a46_0x1260();let _0x2ddd26=_0x1260c0[_0xa4a9b6];return _0x2ddd26;}const a46_0x1e91e5=a46_0x2ddd;(function(_0x4784b8,_0x58e203){const _0x129b27=a46_0x2ddd,_0x48a032=_0x4784b8();while(!![]){try{const _0x787ed1=-parseInt(_0x129b27(0xe6))/0x1+parseInt(_0x129b27(0xfa))/0x2+-parseInt(_0x129b27(0xd0))/0x3*(-parseInt(_0x129b27(0xf9))/0x4)+parseInt(_0x129b27(0xf3))/0x5*(parseInt(_0x129b27(0xde))/0x6)+-parseInt(_0x129b27(0xd9))/0x7*(parseInt(_0x129b27(0xfd))/0x8)+parseInt(_0x129b27(0xdd))/0x9+-parseInt(_0x129b27(0xf0))/0xa*(parseInt(_0x129b27(0xf8))/0xb);if(_0x787ed1===_0x58e203)break;else _0x48a032['push'](_0x48a032['shift']());}catch(_0x2df605){_0x48a032['push'](_0x48a032['shift']());}}}(a46_0x1260,0xa566d));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a46_0x16adf7 from'chalk';export class SegmentUpdateCommand extends BaseCommand{[a46_0x1e91e5(0xd3)]=a46_0x1e91e5(0xdc);[a46_0x1e91e5(0xfe)]=a46_0x1e91e5(0xe3);async[a46_0x1e91e5(0xe2)](_0x1bb7b7){const _0xfc1cc7=a46_0x1e91e5;console[_0xfc1cc7(0xe1)](a46_0x16adf7[_0xfc1cc7(0xfc)](_0xfc1cc7(0xfb))),console[_0xfc1cc7(0xe1)](a46_0x16adf7[_0xfc1cc7(0xfc)](_0xfc1cc7(0xd6)));const {options:_0x58a6e1,args:_0x306392,tdx:_0x32d70b}=_0x1bb7b7,_0x5c50ca=_0x58a6e1;if(_0x306392[_0xfc1cc7(0xed)]===0x0)return console['error'](_0xfc1cc7(0xe0)),console['error'](_0xfc1cc7(0xe5)),console[_0xfc1cc7(0xe1)](_0xfc1cc7(0xd5)),console[_0xfc1cc7(0xe1)](_0xfc1cc7(0xd2)),console[_0xfc1cc7(0xe1)](_0xfc1cc7(0xeb)),0x1;const _0x5deb53=_0x306392[0x0],_0x57689c=_0x58a6e1[_0xfc1cc7(0xf2)];let _0x438040=_0x5deb53;_0x57689c&&!_0x5deb53[_0xfc1cc7(0xf6)]('/')&&(_0x438040=_0x57689c+'/'+_0x5deb53,_0x5c50ca['verbose']&&console[_0xfc1cc7(0xe1)]('Resolved\x20relative\x20path\x20to:\x20'+_0x438040));const _0x5070d7=await withSpinner(_0xfc1cc7(0xf7)+_0x438040+_0xfc1cc7(0xf1),()=>_0x32d70b[_0xfc1cc7(0xea)][_0xfc1cc7(0xec)](_0x438040),{'verbose':_0x5c50ca[_0xfc1cc7(0xda)]}),_0x1b1ca4=_0x5070d7[_0xfc1cc7(0xf5)];_0x5c50ca[_0xfc1cc7(0xda)]&&console[_0xfc1cc7(0xe1)]('Resolved\x20type:\x20'+_0x1b1ca4['type']);if(_0x1b1ca4[_0xfc1cc7(0xce)]!==_0xfc1cc7(0xea))return console[_0xfc1cc7(0xe1)]('Error:\x20Cannot\x20update\x20'+_0x1b1ca4[_0xfc1cc7(0xce)]+_0xfc1cc7(0xc9)),console['error'](_0xfc1cc7(0xdf)),0x1;if(!_0x1b1ca4[_0xfc1cc7(0xee)])throw new SDKError(ErrorCode[_0xfc1cc7(0xe7)],_0xfc1cc7(0xe4));const _0x13b298=_0x1b1ca4[_0xfc1cc7(0xd1)],_0xc63aae=_0x1b1ca4[_0xfc1cc7(0xee)];_0x5c50ca[_0xfc1cc7(0xda)]&&(console[_0xfc1cc7(0xe1)](_0xfc1cc7(0xe8)+_0x13b298),console[_0xfc1cc7(0xe1)]('Segment\x20ID:\x20'+_0xc63aae));let _0x10d8ab;if(_0x5c50ca[_0xfc1cc7(0xd8)]){const _0xac1701=_0x5c50ca[_0xfc1cc7(0xd8)],_0x4b98d9=await withSpinner(_0xfc1cc7(0xdb)+_0xac1701+_0xfc1cc7(0xf1),()=>_0x32d70b[_0xfc1cc7(0xea)][_0xfc1cc7(0xf4)](_0x13b298,_0xac1701),{'verbose':_0x5c50ca['verbose']});_0x10d8ab=parseInt(_0x4b98d9[_0xfc1cc7(0xf5)],0xa),_0x5c50ca[_0xfc1cc7(0xda)]&&console[_0xfc1cc7(0xe1)](_0xfc1cc7(0xd7)+_0x10d8ab);}const _0x3862c7=await loadJSONFromOptions(_0x5c50ca[_0xfc1cc7(0xcc)],_0x5c50ca[_0xfc1cc7(0xcd)]),_0x462980={'name':_0x5c50ca[_0xfc1cc7(0xd3)],'description':_0x5c50ca[_0xfc1cc7(0xfe)],'rule':_0x3862c7,'kind':_0x5c50ca[_0xfc1cc7(0xe9)]!==undefined?parseInt(_0x5c50ca[_0xfc1cc7(0xe9)],0xa):undefined,'segmentFolderId':_0x10d8ab},_0x41ec63=await withSpinner(_0xfc1cc7(0xef)+_0x1b1ca4[_0xfc1cc7(0xca)]+_0xfc1cc7(0xf1),()=>_0x32d70b[_0xfc1cc7(0xea)][_0xfc1cc7(0xd4)](_0x13b298,_0xc63aae,_0x462980),{'verbose':_0x5c50ca[_0xfc1cc7(0xda)]}),_0x24fabf=_0x41ec63[_0xfc1cc7(0xf5)];return console[_0xfc1cc7(0xe1)](_0xfc1cc7(0xcb)+_0x24fabf[_0xfc1cc7(0xd3)]+'\x27'),_0x438040!==_0x5deb53&&console[_0xfc1cc7(0xe1)](_0xfc1cc7(0xcf)+_0x438040),await handleSDKOutput([_0x24fabf],_0x5c50ca),0x0;}}function a46_0x1260(){const _0x576105=['121nfzJlo','12PoETcp','2513332tJeaPO','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','yellow','8EUqAdk','description','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','segmentName','✔\x20Updated\x20segment\x20\x27','rule','ruleFile','type','\x20\x20\x20Path:\x20','791871AyZCDl','parentId','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','name','updateSegmentById','Examples:','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Resolved\x20folder\x20ID:\x20','folder','7277893thMtar','verbose','Resolving\x20folder\x20\x27','segment:update','226350Dzevdp','6TEqxnZ','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','error','execute','Update\x20existing\x20child\x20segment','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','30878oDBErg','INTERNAL','Parent\x20ID:\x20','kind','segment','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','resolvePathToResource','length','segmentId','Updating\x20segment\x20\x27','615250EjLIzX','\x27...','segmentPath','1755750UAlXhB','resolveFolderId','data','includes','Resolving\x20path\x20\x27'];a46_0x1260=function(){return _0x576105;};return a46_0x1260();}
1
+ const a46_0x58c222=a46_0x3916;function a46_0x3916(_0x1cd526,_0x2b734c){_0x1cd526=_0x1cd526-0xa7;const _0xd24f5a=a46_0xd24f();let _0x391645=_0xd24f5a[_0x1cd526];return _0x391645;}(function(_0x447fdc,_0x5187b7){const _0x3a47da=a46_0x3916,_0x125ca7=_0x447fdc();while(!![]){try{const _0x5f1628=-parseInt(_0x3a47da(0xb4))/0x1+-parseInt(_0x3a47da(0xa8))/0x2+-parseInt(_0x3a47da(0xc4))/0x3+-parseInt(_0x3a47da(0xc9))/0x4+parseInt(_0x3a47da(0xc6))/0x5+-parseInt(_0x3a47da(0xb3))/0x6*(parseInt(_0x3a47da(0xcd))/0x7)+-parseInt(_0x3a47da(0xa9))/0x8*(-parseInt(_0x3a47da(0xac))/0x9);if(_0x5f1628===_0x5187b7)break;else _0x125ca7['push'](_0x125ca7['shift']());}catch(_0xb14ec4){_0x125ca7['push'](_0x125ca7['shift']());}}}(a46_0xd24f,0x3c4d5));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a46_0xd24f(){const _0x4a2ddb=['folder','segmentName','segment:update','832119jcSkIo','type','1770850EGNOYa','kind','error','83556LSpUGq','Resolved\x20folder\x20ID:\x20','yellow','Resolved\x20type:\x20','7yKgplS','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','description','name','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','Segment\x20ID:\x20','402716YtvjwT','9468712bSdEsE','Resolved\x20relative\x20path\x20to:\x20','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','9xhxBEo','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','resolveFolderId','segmentId','Resolving\x20folder\x20\x27','Segment\x20ID\x20missing\x20from\x20resolved\x20path','includes','2014398nrzcbd','455409cuuRqV','data','Parent\x20ID:\x20','verbose','updateSegmentById','Updating\x20segment\x20\x27','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','\x27...','length','INTERNAL','segment','Resolving\x20path\x20\x27','✔\x20Updated\x20segment\x20\x27'];a46_0xd24f=function(){return _0x4a2ddb;};return a46_0xd24f();}import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a46_0x2e6664 from'chalk';export class SegmentUpdateCommand extends BaseCommand{[a46_0x58c222(0xd0)]=a46_0x58c222(0xc3);[a46_0x58c222(0xcf)]='Update\x20existing\x20child\x20segment';async['execute'](_0x268dff){const _0x31a063=a46_0x58c222;console[_0x31a063(0xc8)](a46_0x2e6664[_0x31a063(0xcb)]('⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.')),console[_0x31a063(0xc8)](a46_0x2e6664[_0x31a063(0xcb)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x2f0946,args:_0x2bf875,tdx:_0x2f3df3}=_0x268dff,_0x2a94f1=_0x2f0946;if(_0x2bf875[_0x31a063(0xbc)]===0x0)return console['error']('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x31a063(0xc8)](_0x31a063(0xad)),console[_0x31a063(0xc8)]('Examples:'),console[_0x31a063(0xc8)](_0x31a063(0xab)),console[_0x31a063(0xc8)](_0x31a063(0xce)),0x1;const _0x1497f7=_0x2bf875[0x0],_0x14d33b=_0x2f0946['segmentPath'];let _0x3e6564=_0x1497f7;_0x14d33b&&!_0x1497f7[_0x31a063(0xb2)]('/')&&(_0x3e6564=_0x14d33b+'/'+_0x1497f7,_0x2a94f1[_0x31a063(0xb7)]&&console[_0x31a063(0xc8)](_0x31a063(0xaa)+_0x3e6564));const _0x32728b=await withSpinner(_0x31a063(0xbf)+_0x3e6564+'\x27...',()=>_0x2f3df3[_0x31a063(0xbe)]['resolvePathToResource'](_0x3e6564),{'verbose':_0x2a94f1[_0x31a063(0xb7)]}),_0x52a0eb=_0x32728b[_0x31a063(0xb5)];_0x2a94f1[_0x31a063(0xb7)]&&console['error'](_0x31a063(0xcc)+_0x52a0eb[_0x31a063(0xc5)]);if(_0x52a0eb['type']!==_0x31a063(0xbe))return console[_0x31a063(0xc8)]('Error:\x20Cannot\x20update\x20'+_0x52a0eb[_0x31a063(0xc5)]+_0x31a063(0xba)),console[_0x31a063(0xc8)](_0x31a063(0xd1)),0x1;if(!_0x52a0eb[_0x31a063(0xaf)])throw new SDKError(ErrorCode[_0x31a063(0xbd)],_0x31a063(0xb1));const _0x3bd298=_0x52a0eb['parentId'],_0x193eb1=_0x52a0eb[_0x31a063(0xaf)];_0x2a94f1['verbose']&&(console['error'](_0x31a063(0xb6)+_0x3bd298),console['error'](_0x31a063(0xa7)+_0x193eb1));let _0x3e835c;if(_0x2a94f1[_0x31a063(0xc1)]){const _0x417d24=_0x2a94f1[_0x31a063(0xc1)],_0x574bbd=await withSpinner(_0x31a063(0xb0)+_0x417d24+_0x31a063(0xbb),()=>_0x2f3df3[_0x31a063(0xbe)][_0x31a063(0xae)](_0x3bd298,_0x417d24),{'verbose':_0x2a94f1['verbose']});_0x3e835c=parseInt(_0x574bbd[_0x31a063(0xb5)],0xa),_0x2a94f1[_0x31a063(0xb7)]&&console['error'](_0x31a063(0xca)+_0x3e835c);}const _0x390182=await loadJSONFromOptions(_0x2a94f1['rule'],_0x2a94f1['ruleFile']),_0xd55b81={'name':_0x2a94f1['name'],'description':_0x2a94f1[_0x31a063(0xcf)],'rule':_0x390182,'kind':_0x2a94f1[_0x31a063(0xc7)]!==undefined?parseInt(_0x2a94f1[_0x31a063(0xc7)],0xa):undefined,'segmentFolderId':_0x3e835c},_0x3fb6c3=await withSpinner(_0x31a063(0xb9)+_0x52a0eb[_0x31a063(0xc2)]+_0x31a063(0xbb),()=>_0x2f3df3[_0x31a063(0xbe)][_0x31a063(0xb8)](_0x3bd298,_0x193eb1,_0xd55b81),{'verbose':_0x2a94f1[_0x31a063(0xb7)]}),_0x519ba6=_0x3fb6c3['data'];return console[_0x31a063(0xc8)](_0x31a063(0xc0)+_0x519ba6[_0x31a063(0xd0)]+'\x27'),_0x3e6564!==_0x1497f7&&console[_0x31a063(0xc8)]('\x20\x20\x20Path:\x20'+_0x3e6564),await handleSDKOutput([_0x519ba6],_0x2a94f1),0x0;}}
@@ -1 +1 @@
1
- const a47_0x5a6d3c=a47_0x3406;(function(_0x1427a2,_0x2c1da3){const _0x478cb9=a47_0x3406,_0x17c9ca=_0x1427a2();while(!![]){try{const _0x4ff373=-parseInt(_0x478cb9(0x17c))/0x1+parseInt(_0x478cb9(0x177))/0x2+parseInt(_0x478cb9(0x173))/0x3*(-parseInt(_0x478cb9(0x160))/0x4)+-parseInt(_0x478cb9(0x17d))/0x5*(-parseInt(_0x478cb9(0x174))/0x6)+parseInt(_0x478cb9(0x18f))/0x7+parseInt(_0x478cb9(0x165))/0x8+-parseInt(_0x478cb9(0x167))/0x9;if(_0x4ff373===_0x2c1da3)break;else _0x17c9ca['push'](_0x17c9ca['shift']());}catch(_0x88eda9){_0x17c9ca['push'](_0x17c9ca['shift']());}}}(a47_0x95ce,0xc92db));function a47_0x3406(_0x4c66d2,_0x33a881){_0x4c66d2=_0x4c66d2-0x15d;const _0x95ce2=a47_0x95ce();let _0x3406d0=_0x95ce2[_0x4c66d2];return _0x3406d0;}import{existsSync,statSync}from'fs';import a47_0x3a7b94 from'chalk';import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../sdk/segment/segment-path-parser.js';import{findTdxConfig}from'../sdk/segment/tdx-config.js';export class SegmentUseCommand extends BaseCommand{[a47_0x5a6d3c(0x179)]=a47_0x5a6d3c(0x17e);[a47_0x5a6d3c(0x16a)]='Set\x20current\x20segment/folder\x20context\x20for\x20navigation';async['execute'](_0x313258){const _0x4bc01b=a47_0x5a6d3c,{options:_0x270976,args:_0x545c8d,tdx:_0x231bcc}=_0x313258;if(_0x545c8d['length']===0x0)return console[_0x4bc01b(0x18e)](a47_0x3a7b94['red'](_0x4bc01b(0x17a))),console['error'](_0x4bc01b(0x18b)),console[_0x4bc01b(0x18e)](_0x4bc01b(0x187)),console[_0x4bc01b(0x18e)](_0x4bc01b(0x185)),console[_0x4bc01b(0x18e)](_0x4bc01b(0x15e)),console['error'](_0x4bc01b(0x18d)),console['error'](_0x4bc01b(0x171)),0x1;const _0x35bc45=_0x545c8d[0x0],_0x2ddfc4=_0x270976[_0x4bc01b(0x18c)];try{if(_0x35bc45==='/')return saveSessionContext({'segment_path':undefined},_0x2ddfc4),console[_0x4bc01b(0x15d)](a47_0x3a7b94[_0x4bc01b(0x180)](_0x4bc01b(0x178))),0x0;if(existsSync(_0x35bc45)&&statSync(_0x35bc45)['isDirectory']()){let _0x45c1a7;try{_0x45c1a7=findTdxConfig(_0x35bc45);}catch{return console[_0x4bc01b(0x18e)](a47_0x3a7b94[_0x4bc01b(0x164)]('Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20'+_0x35bc45)),console['error'](a47_0x3a7b94['cyan'](_0x4bc01b(0x188))),0x1;}const _0x4818c4=_0x45c1a7['config'][_0x4bc01b(0x170)];return saveSessionContext({'segment_path':_0x4818c4,'parent_segment':_0x4818c4},_0x2ddfc4),console[_0x4bc01b(0x15d)](a47_0x3a7b94[_0x4bc01b(0x180)]('✔\x20Context\x20set\x20to:\x20'+a47_0x3a7b94[_0x4bc01b(0x17f)](_0x4818c4))),0x0;}const _0x527106=_0x270976[_0x4bc01b(0x194)];let _0x52cd93=_0x35bc45;const _0x88c23c=parsePath(_0x35bc45);if(!_0x88c23c[_0x4bc01b(0x169)]){if(!_0x527106)return console['error'](a47_0x3a7b94['red'](_0x4bc01b(0x17b))),console[_0x4bc01b(0x18e)](a47_0x3a7b94[_0x4bc01b(0x17f)](_0x4bc01b(0x186))),0x1;if(_0x35bc45==='..'){const _0x4b5a80=_0x527106['split']('/')[_0x4bc01b(0x176)](0x0,-0x1)['join']('/');_0x52cd93=_0x4b5a80||'/';}else _0x35bc45==='.'?_0x52cd93=_0x527106:_0x52cd93=_0x527106+'/'+_0x35bc45;_0x270976[_0x4bc01b(0x16b)]&&console[_0x4bc01b(0x18e)](_0x4bc01b(0x193)+_0x52cd93);}if(_0x52cd93==='/'||_0x52cd93==='')return saveSessionContext({'segment_path':undefined},_0x2ddfc4),console[_0x4bc01b(0x15d)](a47_0x3a7b94[_0x4bc01b(0x180)](_0x4bc01b(0x178))),0x0;_0x52cd93=normalizePath(_0x52cd93);const _0x4e8d70=parsePath(_0x52cd93)[_0x4bc01b(0x16f)];if(_0x4e8d70[_0x4bc01b(0x163)]===0x0)return saveSessionContext({'segment_path':undefined},_0x2ddfc4),console[_0x4bc01b(0x15d)](a47_0x3a7b94[_0x4bc01b(0x180)](_0x4bc01b(0x178))),0x0;_0x270976[_0x4bc01b(0x16b)]&&(console[_0x4bc01b(0x18e)](_0x4bc01b(0x175)+_0x270976[_0x4bc01b(0x168)]),console[_0x4bc01b(0x18e)](_0x4bc01b(0x191)+_0x52cd93));const _0x20eac2=await withSpinner(_0x4bc01b(0x182)+_0x52cd93+_0x4bc01b(0x161),()=>_0x231bcc[_0x4bc01b(0x197)][_0x4bc01b(0x189)](_0x52cd93),{'verbose':_0x270976[_0x4bc01b(0x16b)]}),_0x576ab2=_0x20eac2[_0x4bc01b(0x192)];_0x270976['verbose']&&(console['error'](_0x4bc01b(0x183)+_0x576ab2['type']),console[_0x4bc01b(0x18e)](_0x4bc01b(0x195)+_0x576ab2[_0x4bc01b(0x162)]),_0x576ab2[_0x4bc01b(0x16c)]&&console[_0x4bc01b(0x18e)](_0x4bc01b(0x181)+_0x576ab2[_0x4bc01b(0x16c)]));if(_0x576ab2['type']==='segment')return console[_0x4bc01b(0x18e)](a47_0x3a7b94[_0x4bc01b(0x164)](_0x4bc01b(0x16d))),console[_0x4bc01b(0x18e)](_0x4bc01b(0x190)),console[_0x4bc01b(0x18e)](a47_0x3a7b94[_0x4bc01b(0x17f)](_0x4bc01b(0x16e)+_0x576ab2[_0x4bc01b(0x172)]+(_0x576ab2['folderPath']?'/'+_0x576ab2[_0x4bc01b(0x15f)]['join']('/'):''))),0x1;return saveSessionContext({'segment_path':_0x576ab2[_0x4bc01b(0x166)],'parent_segment':_0x576ab2['parentName']},_0x2ddfc4),console[_0x4bc01b(0x15d)](a47_0x3a7b94[_0x4bc01b(0x180)](_0x4bc01b(0x18a)+a47_0x3a7b94[_0x4bc01b(0x17f)](_0x576ab2[_0x4bc01b(0x166)]))),_0x270976[_0x4bc01b(0x16b)]&&(console[_0x4bc01b(0x18e)](a47_0x3a7b94[_0x4bc01b(0x184)]('Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context')),console[_0x4bc01b(0x18e)](a47_0x3a7b94[_0x4bc01b(0x184)](_0x4bc01b(0x196)))),0x0;}catch(_0x43cebd){throw _0x43cebd;}}}function a47_0x95ce(){const _0x391423=['description','verbose','folderId','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','Use:\x20tdx\x20segment\x20use\x20','segments','parent_segment','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','parentName','2559051CUAWwT','6nhwtdl','Site:\x20','slice','673446LsFUtX','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','name','Error:\x20Path\x20is\x20required\x0a','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','265425ZsJVXn','8208615dlZWgM','segment:use','cyan','green','Folder\x20ID:\x20','Resolving\x20path\x20\x27','Resolved\x20path\x20type:\x20','dim','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','Examples:','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','resolvePathToResource','✔\x20Context\x20set\x20to:\x20','Usage:\x20tdx\x20segment\x20use\x20<path>','session','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','error','2566480kWyIDq','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','Target\x20path:\x20','data','Resolved\x20relative\x20path\x20to:\x20','segmentPath','Parent\x20ID:\x20','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','segment','log','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','folderPath','4XPTMAS','\x27...','parentId','length','red','3308320qMAtEj','fullPath','7345413XpPCIR','site','isAbsolute'];a47_0x95ce=function(){return _0x391423;};return a47_0x95ce();}
1
+ const a47_0xbbae85=a47_0x1bf1;function a47_0x1bf1(_0x2e684d,_0x223050){_0x2e684d=_0x2e684d-0x19e;const _0x4d009e=a47_0x4d00();let _0x1bf1cc=_0x4d009e[_0x2e684d];return _0x1bf1cc;}function a47_0x4d00(){const _0x26c6a2=['12ySPqyr','type','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','segments','Folder\x20ID:\x20','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','735070dZbOkw','Resolving\x20path\x20\x27','log','845196lJDsSp','3613745ZsPzSs','red','split','18661580uIfEBC','\x27...','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','fullPath','session','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','config','execute','Resolved\x20relative\x20path\x20to:\x20','Target\x20path:\x20','Error:\x20Path\x20is\x20required\x0a','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','parent_segment','Use:\x20tdx\x20segment\x20use\x20','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','segmentPath','length','parentName','error','Examples:','8fYmywQ','site','800991fhKPhV','description','Site:\x20','350754GRcWEJ','parentId','green','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','segment','isAbsolute','folderPath','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','✔\x20Context\x20set\x20to:\x20','segment:use','verbose','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','join','cyan','Parent\x20ID:\x20','dim','Usage:\x20tdx\x20segment\x20use\x20<path>','name','633976boABib','12CQdwVC','slice'];a47_0x4d00=function(){return _0x26c6a2;};return a47_0x4d00();}(function(_0xac515,_0x3ce06e){const _0x242f4d=a47_0x1bf1,_0x4b877b=_0xac515();while(!![]){try{const _0x22289d=parseInt(_0x242f4d(0x1be))/0x1+parseInt(_0x242f4d(0x1a0))/0x2+parseInt(_0x242f4d(0x1d4))/0x3*(parseInt(_0x242f4d(0x1d1))/0x4)+parseInt(_0x242f4d(0x1a1))/0x5+-parseInt(_0x242f4d(0x1d2))/0x6*(-parseInt(_0x242f4d(0x1da))/0x7)+parseInt(_0x242f4d(0x1b9))/0x8*(parseInt(_0x242f4d(0x1bb))/0x9)+-parseInt(_0x242f4d(0x1a4))/0xa;if(_0x22289d===_0x3ce06e)break;else _0x4b877b['push'](_0x4b877b['shift']());}catch(_0x4a8579){_0x4b877b['push'](_0x4b877b['shift']());}}}(a47_0x4d00,0x896fa));import{existsSync,statSync}from'fs';import a47_0x5006d9 from'chalk';import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../sdk/segment/segment-path-parser.js';import{findTdxConfig}from'../sdk/segment/tdx-config.js';export class SegmentUseCommand extends BaseCommand{[a47_0xbbae85(0x1d0)]=a47_0xbbae85(0x1c8);[a47_0xbbae85(0x1bc)]=a47_0xbbae85(0x1aa);async[a47_0xbbae85(0x1ac)](_0x4bb7ca){const _0x87f2f0=a47_0xbbae85,{options:_0x37c0f5,args:_0x4071ff,tdx:_0x4685f5}=_0x4bb7ca;if(_0x4071ff[_0x87f2f0(0x1b5)]===0x0)return console[_0x87f2f0(0x1b7)](a47_0x5006d9[_0x87f2f0(0x1a2)](_0x87f2f0(0x1af))),console[_0x87f2f0(0x1b7)](_0x87f2f0(0x1cf)),console[_0x87f2f0(0x1b7)](_0x87f2f0(0x1b8)),console[_0x87f2f0(0x1b7)](_0x87f2f0(0x1a6)),console[_0x87f2f0(0x1b7)]('\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22'),console[_0x87f2f0(0x1b7)](_0x87f2f0(0x1d9)),console['error'](_0x87f2f0(0x1b0)),0x1;const _0x482137=_0x4071ff[0x0],_0x4a612b=_0x37c0f5[_0x87f2f0(0x1a8)];try{if(_0x482137==='/')return saveSessionContext({'segment_path':undefined},_0x4a612b),console[_0x87f2f0(0x19f)](a47_0x5006d9['green'](_0x87f2f0(0x1c1))),0x0;if(existsSync(_0x482137)&&statSync(_0x482137)['isDirectory']()){let _0x3f8a94;try{_0x3f8a94=findTdxConfig(_0x482137);}catch{return console['error'](a47_0x5006d9[_0x87f2f0(0x1a2)](_0x87f2f0(0x1a9)+_0x482137)),console[_0x87f2f0(0x1b7)](a47_0x5006d9[_0x87f2f0(0x1cc)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;}const _0x4fcccc=_0x3f8a94[_0x87f2f0(0x1ab)][_0x87f2f0(0x1b1)];return saveSessionContext({'segment_path':_0x4fcccc,'parent_segment':_0x4fcccc},_0x4a612b),console[_0x87f2f0(0x19f)](a47_0x5006d9[_0x87f2f0(0x1c0)](_0x87f2f0(0x1c7)+a47_0x5006d9[_0x87f2f0(0x1cc)](_0x4fcccc))),0x0;}const _0x59a2d5=_0x37c0f5[_0x87f2f0(0x1b4)];let _0x2544ec=_0x482137;const _0x63488c=parsePath(_0x482137);if(!_0x63488c[_0x87f2f0(0x1c4)]){if(!_0x59a2d5)return console[_0x87f2f0(0x1b7)](a47_0x5006d9[_0x87f2f0(0x1a2)]('Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.')),console[_0x87f2f0(0x1b7)](a47_0x5006d9[_0x87f2f0(0x1cc)](_0x87f2f0(0x1ca))),0x1;if(_0x482137==='..'){const _0x75df85=_0x59a2d5[_0x87f2f0(0x1a3)]('/')[_0x87f2f0(0x1d3)](0x0,-0x1)[_0x87f2f0(0x1cb)]('/');_0x2544ec=_0x75df85||'/';}else _0x482137==='.'?_0x2544ec=_0x59a2d5:_0x2544ec=_0x59a2d5+'/'+_0x482137;_0x37c0f5[_0x87f2f0(0x1c9)]&&console['error'](_0x87f2f0(0x1ad)+_0x2544ec);}if(_0x2544ec==='/'||_0x2544ec==='')return saveSessionContext({'segment_path':undefined},_0x4a612b),console[_0x87f2f0(0x19f)](a47_0x5006d9[_0x87f2f0(0x1c0)](_0x87f2f0(0x1c1))),0x0;_0x2544ec=normalizePath(_0x2544ec);const _0x4cf677=parsePath(_0x2544ec)[_0x87f2f0(0x1d7)];if(_0x4cf677[_0x87f2f0(0x1b5)]===0x0)return saveSessionContext({'segment_path':undefined},_0x4a612b),console['log'](a47_0x5006d9[_0x87f2f0(0x1c0)]('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;_0x37c0f5[_0x87f2f0(0x1c9)]&&(console['error'](_0x87f2f0(0x1bd)+_0x37c0f5[_0x87f2f0(0x1ba)]),console[_0x87f2f0(0x1b7)](_0x87f2f0(0x1ae)+_0x2544ec));const _0x366da7=await withSpinner(_0x87f2f0(0x19e)+_0x2544ec+_0x87f2f0(0x1a5),()=>_0x4685f5[_0x87f2f0(0x1c3)]['resolvePathToResource'](_0x2544ec),{'verbose':_0x37c0f5[_0x87f2f0(0x1c9)]}),_0x1041dc=_0x366da7['data'];_0x37c0f5[_0x87f2f0(0x1c9)]&&(console[_0x87f2f0(0x1b7)]('Resolved\x20path\x20type:\x20'+_0x1041dc[_0x87f2f0(0x1d5)]),console[_0x87f2f0(0x1b7)](_0x87f2f0(0x1cd)+_0x1041dc[_0x87f2f0(0x1bf)]),_0x1041dc['folderId']&&console['error'](_0x87f2f0(0x1d8)+_0x1041dc['folderId']));if(_0x1041dc[_0x87f2f0(0x1d5)]==='segment')return console[_0x87f2f0(0x1b7)](a47_0x5006d9[_0x87f2f0(0x1a2)](_0x87f2f0(0x1c6))),console['error'](_0x87f2f0(0x1b3)),console[_0x87f2f0(0x1b7)](a47_0x5006d9[_0x87f2f0(0x1cc)](_0x87f2f0(0x1b2)+_0x1041dc[_0x87f2f0(0x1b6)]+(_0x1041dc[_0x87f2f0(0x1c5)]?'/'+_0x1041dc['folderPath'][_0x87f2f0(0x1cb)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x1041dc[_0x87f2f0(0x1a7)],'parent_segment':_0x1041dc['parentName']},_0x4a612b),console['log'](a47_0x5006d9[_0x87f2f0(0x1c0)](_0x87f2f0(0x1c7)+a47_0x5006d9[_0x87f2f0(0x1cc)](_0x1041dc['fullPath']))),_0x37c0f5[_0x87f2f0(0x1c9)]&&(console[_0x87f2f0(0x1b7)](a47_0x5006d9[_0x87f2f0(0x1ce)](_0x87f2f0(0x1c2))),console[_0x87f2f0(0x1b7)](a47_0x5006d9['dim'](_0x87f2f0(0x1d6)))),0x0;}catch(_0x215bc0){throw _0x215bc0;}}}
@@ -1 +1 @@
1
- const a48_0x20aea=a48_0x5771;(function(_0x5df9ee,_0x65386c){const _0x4a7ead=a48_0x5771,_0x21dea0=_0x5df9ee();while(!![]){try{const _0x49c298=parseInt(_0x4a7ead(0x171))/0x1*(parseInt(_0x4a7ead(0x180))/0x2)+-parseInt(_0x4a7ead(0x186))/0x3+-parseInt(_0x4a7ead(0x189))/0x4*(parseInt(_0x4a7ead(0x162))/0x5)+parseInt(_0x4a7ead(0x17e))/0x6*(parseInt(_0x4a7ead(0x16c))/0x7)+-parseInt(_0x4a7ead(0x18d))/0x8+parseInt(_0x4a7ead(0x165))/0x9+parseInt(_0x4a7ead(0x188))/0xa*(parseInt(_0x4a7ead(0x160))/0xb);if(_0x49c298===_0x65386c)break;else _0x21dea0['push'](_0x21dea0['shift']());}catch(_0x5c580f){_0x21dea0['push'](_0x21dea0['shift']());}}}(a48_0xa5b7,0x53bd4));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';function a48_0xa5b7(){const _0x1b4e3c=['errors','\x20warning(s)\x20found','Validation\x20failed:\x20','log','186oimuwV','\x20error(s)','506658FGSnDc','invalidCount','.yml','parentSegment','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','yellow','1578450RdSLSq','cyan','13010fbhUYB','556rslaFa','warnings','verbose','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','1020696OvFayX','errorCode','length','\x20valid','error','Error:\x20Directory\x20not\x20found:\x20','description','red','validCount','2651TutZcf','Validate\x20segment\x20and\x20journey\x20YAML\x20files','4865skCOTV','file','\x20file(s)\x20valid','3434589UAbcLo','hasErrors','filePath','endsWith','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','warningCount','dim','41433ilthtE','valid','cwd','message','):\x20','1aEdCUN','helpText','green','execute','Usage:\x20tdx\x20sg\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','targetDir','\x20warning(s)','\x20file(s)\x20with\x20errors,\x20','type'];a48_0xa5b7=function(){return _0x1b4e3c;};return a48_0xa5b7();}function a48_0x5771(_0x4b830e,_0x1fbf7d){_0x4b830e=_0x4b830e-0x15a;const _0xa5b79c=a48_0xa5b7();let _0x577159=_0xa5b79c[_0x4b830e];return _0x577159;}import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a48_0xd7ab59 from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class SegmentValidateCommand extends BaseCommand{['name']='segment:validate';[a48_0x20aea(0x15d)]=a48_0x20aea(0x161);async[a48_0x20aea(0x174)](_0x3dcde0){const _0xf18543=a48_0x20aea,{options:_0x4b8ad8,args:_0x43f106}=_0x3dcde0,_0xfbf78f=_0x4b8ad8,_0x1e465e=await resolveTarget({'arg':_0x43f106[0x0],'contextParent':_0x4b8ad8[_0xf18543(0x183)],'cwd':process[_0xf18543(0x16e)]()});if(!isSuccessfulResolution(_0x1e465e))return _0x1e465e[_0xf18543(0x18e)]==='no_parent'?(console[_0xf18543(0x15b)](a48_0xd7ab59[_0xf18543(0x185)](_0xf18543(0x18c))),console[_0xf18543(0x15b)](_0xf18543(0x175)),console[_0xf18543(0x15b)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20validate\x20.\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20current\x20directory'),console['error'](_0xf18543(0x184))):(console[_0xf18543(0x15b)](a48_0xd7ab59[_0xf18543(0x15e)]('Error:\x20'+_0x1e465e[_0xf18543(0x16f)]+'\x0a')),_0x1e465e[_0xf18543(0x172)]&&console[_0xf18543(0x15b)](a48_0xd7ab59[_0xf18543(0x187)](_0x1e465e[_0xf18543(0x172)]))),0x1;const _0x3c92f4=_0x1e465e[_0xf18543(0x176)],_0x3467fa=_0x1e465e[_0xf18543(0x179)]===_0xf18543(0x163)?_0x1e465e[_0xf18543(0x167)]:undefined;if(!_0x3467fa&&!existsSync(_0x3c92f4))return console[_0xf18543(0x15b)](a48_0xd7ab59['red'](_0xf18543(0x15c)+_0x3c92f4+'\x0a')),0x1;let _0x31f495;if(_0x3467fa){if(!_0x3467fa[_0xf18543(0x168)](_0xf18543(0x182))&&!_0x3467fa[_0xf18543(0x168)]('.yaml'))return console[_0xf18543(0x15b)](a48_0xd7ab59[_0xf18543(0x15e)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x3467fa+'\x0a')),0x1;_0x31f495=[_0x3467fa];}else _0x31f495=findYamlFiles(_0x3c92f4);if(_0x31f495[_0xf18543(0x18f)]===0x0)return console[_0xf18543(0x15b)](a48_0xd7ab59[_0xf18543(0x15e)](_0xf18543(0x169)+_0x3c92f4+'\x0a')),0x1;const _0x2fa0bd=validateYamlFiles(_0x31f495,_0x3c92f4),_0x170fea=calculateSummary(_0x2fa0bd);for(const _0x56cd38 of _0x2fa0bd){if(!isValidationResult(_0x56cd38))continue;const {relativePath:_0x5def6e,source:_0x439b01,result:_0x425da2,fileType:_0x5c48de}=_0x56cd38,_0x40d607=_0x5c48de;if(_0x425da2[_0xf18543(0x16d)]&&_0x425da2[_0xf18543(0x18a)]['length']===0x0)_0xfbf78f[_0xf18543(0x18b)]&&console[_0xf18543(0x17d)](a48_0xd7ab59['green']('✔\x20'+_0x5def6e)+a48_0xd7ab59['dim']('\x20('+_0x40d607+')'));else _0x425da2[_0xf18543(0x16d)]?(console['log'](a48_0xd7ab59[_0xf18543(0x185)]('⚠\x20'+_0x5def6e)+a48_0xd7ab59[_0xf18543(0x16b)]('\x20('+_0x40d607+_0xf18543(0x170)+_0x425da2[_0xf18543(0x18a)]['length']+_0xf18543(0x177))),console['log'](formatValidationResult(_0x425da2,_0x439b01,_0x5def6e))):(console[_0xf18543(0x17d)](a48_0xd7ab59[_0xf18543(0x15e)]('✖\x20'+_0x5def6e)+a48_0xd7ab59[_0xf18543(0x16b)]('\x20('+_0x40d607+_0xf18543(0x170)+_0x425da2[_0xf18543(0x17a)]['length']+_0xf18543(0x17f))),console[_0xf18543(0x17d)](formatValidationResult(_0x425da2,_0x439b01,_0x5def6e)));}return console[_0xf18543(0x17d)](''),_0x170fea[_0xf18543(0x166)]?(console['log'](a48_0xd7ab59[_0xf18543(0x15e)](_0xf18543(0x17c)+_0x170fea[_0xf18543(0x181)]+_0xf18543(0x178)+_0x170fea[_0xf18543(0x15f)]+_0xf18543(0x15a))),_0x170fea[_0xf18543(0x16a)]>0x0&&console[_0xf18543(0x17d)](a48_0xd7ab59['yellow'](_0x170fea[_0xf18543(0x16a)]+_0xf18543(0x17b))),0x1):(console[_0xf18543(0x17d)](a48_0xd7ab59[_0xf18543(0x173)]('✔\x20All\x20'+_0x170fea[_0xf18543(0x15f)]+_0xf18543(0x164))),_0x170fea['warningCount']>0x0&&console[_0xf18543(0x17d)](a48_0xd7ab59[_0xf18543(0x185)](_0x170fea[_0xf18543(0x16a)]+_0xf18543(0x17b))),0x0);}}
1
+ const a48_0x1e718c=a48_0x4573;(function(_0x52f37c,_0x13cbde){const _0x448c48=a48_0x4573,_0x3ae61a=_0x52f37c();while(!![]){try{const _0x422662=-parseInt(_0x448c48(0x1b1))/0x1+-parseInt(_0x448c48(0x1b4))/0x2+parseInt(_0x448c48(0x1a8))/0x3*(-parseInt(_0x448c48(0x1ac))/0x4)+-parseInt(_0x448c48(0x18f))/0x5+parseInt(_0x448c48(0x187))/0x6+-parseInt(_0x448c48(0x1a9))/0x7*(-parseInt(_0x448c48(0x198))/0x8)+parseInt(_0x448c48(0x192))/0x9*(parseInt(_0x448c48(0x197))/0xa);if(_0x422662===_0x13cbde)break;else _0x3ae61a['push'](_0x3ae61a['shift']());}catch(_0x554447){_0x3ae61a['push'](_0x3ae61a['shift']());}}}(a48_0x5c11,0x53d7f));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';function a48_0x5c11(){const _0x11aa97=['✔\x20All\x20','3019548bqGhvI','\x20warning(s)\x20found','description','\x20warning(s)','\x20file(s)\x20valid','validCount','type','cyan','2822085bQSDdb','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','.yaml','1487601UaFjSt','log','hasErrors','valid','dim','40qIEszl','160jdMPob','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','invalidCount','yellow','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20validate\x20.\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20current\x20directory','green','red','targetDir','filePath','segment:validate','Validate\x20segment\x20and\x20journey\x20YAML\x20files','endsWith','message','no_parent','error','\x20file(s)\x20with\x20errors,\x20','12SHHDdW','119056xSmMpY','warnings','length','297292reqePi','\x20valid','):\x20','warningCount','errors','38790tvkBNM','verbose','Usage:\x20tdx\x20sg\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','521304sondhY','parentSegment','helpText'];a48_0x5c11=function(){return _0x11aa97;};return a48_0x5c11();}import{existsSync}from'fs';import a48_0x275747 from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';function a48_0x4573(_0x43b86a,_0x25cd31){_0x43b86a=_0x43b86a-0x185;const _0x5c1123=a48_0x5c11();let _0x457389=_0x5c1123[_0x43b86a];return _0x457389;}export class SegmentValidateCommand extends BaseCommand{['name']=a48_0x1e718c(0x1a1);[a48_0x1e718c(0x189)]=a48_0x1e718c(0x1a2);async['execute'](_0x566394){const _0x2ee10b=a48_0x1e718c,{options:_0x1bd8fa,args:_0x1eb1bf}=_0x566394,_0x2127fc=_0x1bd8fa,_0x27244a=await resolveTarget({'arg':_0x1eb1bf[0x0],'contextParent':_0x1bd8fa[_0x2ee10b(0x1b5)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x27244a))return _0x27244a['errorCode']===_0x2ee10b(0x1a5)?(console['error'](a48_0x275747[_0x2ee10b(0x19b)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x2ee10b(0x1a6)](_0x2ee10b(0x1b3)),console[_0x2ee10b(0x1a6)](_0x2ee10b(0x19c)),console[_0x2ee10b(0x1a6)](_0x2ee10b(0x190))):(console[_0x2ee10b(0x1a6)](a48_0x275747['red']('Error:\x20'+_0x27244a[_0x2ee10b(0x1a4)]+'\x0a')),_0x27244a[_0x2ee10b(0x185)]&&console[_0x2ee10b(0x1a6)](a48_0x275747[_0x2ee10b(0x18e)](_0x27244a[_0x2ee10b(0x185)]))),0x1;const _0x153254=_0x27244a[_0x2ee10b(0x19f)],_0x918e2b=_0x27244a[_0x2ee10b(0x18d)]==='file'?_0x27244a[_0x2ee10b(0x1a0)]:undefined;if(!_0x918e2b&&!existsSync(_0x153254))return console['error'](a48_0x275747[_0x2ee10b(0x19e)]('Error:\x20Directory\x20not\x20found:\x20'+_0x153254+'\x0a')),0x1;let _0x57742c;if(_0x918e2b){if(!_0x918e2b[_0x2ee10b(0x1a3)]('.yml')&&!_0x918e2b['endsWith'](_0x2ee10b(0x191)))return console[_0x2ee10b(0x1a6)](a48_0x275747[_0x2ee10b(0x19e)](_0x2ee10b(0x199)+_0x918e2b+'\x0a')),0x1;_0x57742c=[_0x918e2b];}else _0x57742c=findYamlFiles(_0x153254);if(_0x57742c[_0x2ee10b(0x1ab)]===0x0)return console[_0x2ee10b(0x1a6)](a48_0x275747[_0x2ee10b(0x19e)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x153254+'\x0a')),0x1;const _0x133a7b=validateYamlFiles(_0x57742c,_0x153254),_0x8eb908=calculateSummary(_0x133a7b);for(const _0x484aa6 of _0x133a7b){if(!isValidationResult(_0x484aa6))continue;const {relativePath:_0x282626,source:_0x51465f,result:_0xed0012,fileType:_0x2d5781}=_0x484aa6,_0x584bf0=_0x2d5781;if(_0xed0012[_0x2ee10b(0x195)]&&_0xed0012[_0x2ee10b(0x1aa)][_0x2ee10b(0x1ab)]===0x0)_0x2127fc[_0x2ee10b(0x1b2)]&&console['log'](a48_0x275747[_0x2ee10b(0x19d)]('✔\x20'+_0x282626)+a48_0x275747[_0x2ee10b(0x196)]('\x20('+_0x584bf0+')'));else _0xed0012['valid']?(console[_0x2ee10b(0x193)](a48_0x275747[_0x2ee10b(0x19b)]('⚠\x20'+_0x282626)+a48_0x275747['dim']('\x20('+_0x584bf0+_0x2ee10b(0x1ae)+_0xed0012['warnings'][_0x2ee10b(0x1ab)]+_0x2ee10b(0x18a))),console['log'](formatValidationResult(_0xed0012,_0x51465f,_0x282626))):(console[_0x2ee10b(0x193)](a48_0x275747[_0x2ee10b(0x19e)]('✖\x20'+_0x282626)+a48_0x275747[_0x2ee10b(0x196)]('\x20('+_0x584bf0+'):\x20'+_0xed0012[_0x2ee10b(0x1b0)]['length']+'\x20error(s)')),console[_0x2ee10b(0x193)](formatValidationResult(_0xed0012,_0x51465f,_0x282626)));}return console[_0x2ee10b(0x193)](''),_0x8eb908[_0x2ee10b(0x194)]?(console[_0x2ee10b(0x193)](a48_0x275747['red']('Validation\x20failed:\x20'+_0x8eb908[_0x2ee10b(0x19a)]+_0x2ee10b(0x1a7)+_0x8eb908[_0x2ee10b(0x18c)]+_0x2ee10b(0x1ad))),_0x8eb908[_0x2ee10b(0x1af)]>0x0&&console[_0x2ee10b(0x193)](a48_0x275747['yellow'](_0x8eb908[_0x2ee10b(0x1af)]+_0x2ee10b(0x188))),0x1):(console['log'](a48_0x275747[_0x2ee10b(0x19d)](_0x2ee10b(0x186)+_0x8eb908[_0x2ee10b(0x18c)]+_0x2ee10b(0x18b))),_0x8eb908[_0x2ee10b(0x1af)]>0x0&&console[_0x2ee10b(0x193)](a48_0x275747[_0x2ee10b(0x19b)](_0x8eb908[_0x2ee10b(0x1af)]+_0x2ee10b(0x188))),0x0);}}
@@ -1 +1 @@
1
- function a49_0x41ad(){const _0x3cb3c5=['folder','Error:\x20No\x20parent\x20segment\x20context\x20set.','error','searchByName','Folder\x20ID:\x20','1971IZyMGG','segments','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','(empty)','journey','\x20\x20Cause:\x20','2480195tbLWuB','\x20segment','jsonl','✔\x20Found\x20','parentId','Set\x20a\x20parent\x20segment\x20context\x20first:','\x20matching\x20\x27','format','66854FEvAOl','segment','listUnifiedWithJourneys','map','json',',\x20and\x20','/app/ps/','resolvePathToResource','name','execute','maxDepth','Parent\x20ID:\x20','(not\x20set)','site','\x27...','recursive','folders','/j/da','18232203vyJOdV','dim','type','listRecursive','padEnd','data','Found\x20','localeCompare','\x20match','(id\x20','2620470TNxyiF','\x20journey','journeyBundleName','42928aapuSu','length','...','listUnified','9574439JcWYIq','size','filter','2244tCuRwM','path','\x20segments\x20share\x20this\x20name\x20—\x20pass\x20the\x20full\x20path\x20(or\x20id)\x20to\x20`tdx\x20sg\x20move`;\x20do\x20not\x20assume\x20the\x20first.','folderId','description','listWithPattern','test','parentSegment','5007HZWaMk','28TiIrmN','Recursive\x20mode:\x20enabled','verbose','journeys','Building\x20hierarchy\x20tree...','/e/','6iAatQS','Parent\x20segment\x20context:\x20','✔\x20Built\x20tree\x20with\x20','Resolving\x20path\x20\x27','\x20folder','includes','children','replace','\x20—\x20that\x27s\x20a\x20lot\x20to\x20eyeball.\x20Narrow\x20the\x20pattern\x20(add\x20more\x20of\x20the\x20name,\x20or\x20use\x20*\x20/\x20?),\x20or\x20use\x20--format\x20json\x20and\x20filter\x20with\x20jq/grep.','log','cause','Resolving\x20parent\x20segment\x20\x27','Listing\x20folders,\x20segments,\x20and\x20journeys...'];a49_0x41ad=function(){return _0x3cb3c5;};return a49_0x41ad();}const a49_0x28d3c0=a49_0x35cf;(function(_0x1ee575,_0x26dde0){const _0x55f8b3=a49_0x35cf,_0x3c2141=_0x1ee575();while(!![]){try{const _0x1a24d4=-parseInt(_0x55f8b3(0x116))/0x1*(-parseInt(_0x55f8b3(0x13c))/0x2)+-parseInt(_0x55f8b3(0x115))/0x3*(-parseInt(_0x55f8b3(0x10d))/0x4)+parseInt(_0x55f8b3(0x134))/0x5+parseInt(_0x55f8b3(0x11c))/0x6*(-parseInt(_0x55f8b3(0x10a))/0x7)+parseInt(_0x55f8b3(0x106))/0x8*(parseInt(_0x55f8b3(0x12e))/0x9)+parseInt(_0x55f8b3(0x103))/0xa+-parseInt(_0x55f8b3(0x14e))/0xb;if(_0x1a24d4===_0x26dde0)break;else _0x3c2141['push'](_0x3c2141['shift']());}catch(_0x420f11){_0x3c2141['push'](_0x3c2141['shift']());}}}(a49_0x41ad,0xbe7df));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{formatFlatList,formatTree}from'../sdk/util/tree-formatter.js';import{searchTreeByName}from'../sdk/util/tree-search.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import a49_0x49f307 from'chalk';function a49_0x35cf(_0x26d30e,_0x1cf0d1){_0x26d30e=_0x26d30e-0x100;const _0x41ada9=a49_0x41ad();let _0x35cfef=_0x41ada9[_0x26d30e];return _0x35cfef;}export class SegmentsCommand extends BaseCommand{[a49_0x28d3c0(0x144)]=a49_0x28d3c0(0x12f);[a49_0x28d3c0(0x111)]='List\x20folders\x20and\x20child\x20segments';async[a49_0x28d3c0(0x145)](_0x27a1d7){const _0x59ff68=a49_0x28d3c0,{options:_0x2b5874,args:_0x4beed1}=_0x27a1d7,_0x3ba986=_0x2b5874[_0x59ff68(0x14b)],_0x183cbf=_0x4beed1[0x0];try{const _0x137459=_0x2b5874[_0x59ff68(0x114)];_0x2b5874['verbose']&&(console[_0x59ff68(0x12b)]('Site:\x20'+_0x2b5874[_0x59ff68(0x149)]),console['error'](_0x59ff68(0x11d)+(_0x137459||_0x59ff68(0x148))),_0x183cbf&&console[_0x59ff68(0x12b)]('Folder/pattern\x20arg:\x20'+_0x183cbf),_0x3ba986&&console[_0x59ff68(0x12b)](_0x59ff68(0x117)));if(!_0x137459)return console[_0x59ff68(0x12b)](_0x59ff68(0x12a)),console[_0x59ff68(0x12b)](''),console[_0x59ff68(0x12b)](_0x59ff68(0x139)),console[_0x59ff68(0x12b)]('\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22'),console[_0x59ff68(0x12b)]('\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22'),console['error'](''),console['error'](_0x59ff68(0x130)),0x1;if(_0x183cbf&&_0x3ba986)return await this[_0x59ff68(0x12c)](_0x27a1d7,_0x137459,_0x183cbf);const _0xd69108=_0x183cbf&&(_0x183cbf[_0x59ff68(0x121)]('*')||_0x183cbf[_0x59ff68(0x121)]('?'));if(_0xd69108)return await this['listWithPattern'](_0x27a1d7,_0x137459,_0x183cbf);const _0x50a17b=_0x183cbf?_0x137459+'/'+_0x183cbf:_0x137459;return _0x3ba986?await this['listRecursive'](_0x27a1d7,_0x50a17b):await this[_0x59ff68(0x109)](_0x27a1d7,_0x50a17b);}catch(_0x8aa52c){if(_0x8aa52c instanceof SDKError)return console[_0x59ff68(0x12b)]('Error:\x20'+_0x8aa52c['message']),_0x8aa52c[_0x59ff68(0x126)]&&console['error'](_0x59ff68(0x133)+_0x8aa52c[_0x59ff68(0x126)]),0x1;throw _0x8aa52c;}}async['searchByName'](_0x1a3cf8,_0x26e1e2,_0x154d96){const _0x55c27b=a49_0x28d3c0,{options:_0x405d93,tdx:_0x4d92c7}=_0x1a3cf8,_0x157615='\x22'+_0x154d96+'\x22',_0xb2fe3b=await withSpinner(_0x55c27b(0x11f)+_0x26e1e2+_0x55c27b(0x14a),()=>_0x4d92c7[_0x55c27b(0x13d)]['resolvePathToResource'](_0x26e1e2),{'verbose':_0x405d93['verbose']}),_0x54351a=_0xb2fe3b['data'],_0xac3d28=_0x405d93[_0x55c27b(0x146)]||0xa,_0x5ef9e0=await withSpinner('Searching\x20the\x20tree\x20for\x20names\x20matching\x20'+_0x157615+_0x55c27b(0x108),()=>_0x4d92c7[_0x55c27b(0x13d)][_0x55c27b(0x151)](_0x54351a[_0x55c27b(0x138)],_0x54351a['folderId'],0x0,_0xac3d28),{'verbose':_0x405d93[_0x55c27b(0x118)]}),_0x27fa8a=searchTreeByName(_0x5ef9e0['data'],_0x154d96),_0xe71728=_0x510622=>getConsoleNextUrl(_0x405d93[_0x55c27b(0x149)],_0x55c27b(0x142)+_0x54351a[_0x55c27b(0x138)]+_0x55c27b(0x11b)+_0x510622),_0x14f372=[..._0x27fa8a]['sort']((_0x176fdd,_0x83a228)=>_0x176fdd[_0x55c27b(0x10e)]['localeCompare'](_0x83a228[_0x55c27b(0x10e)])),_0x497d73=0x32,_0x193f25=_0x55c27b(0x154)+_0x27fa8a[_0x55c27b(0x107)]+_0x55c27b(0x101)+(_0x27fa8a[_0x55c27b(0x107)]!==0x1?'es':'');console[_0x55c27b(0x12b)](_0x27fa8a['length']>_0x497d73?'✔\x20'+_0x193f25+_0x55c27b(0x124):'✔\x20'+_0x193f25);if(_0x405d93[_0x55c27b(0x13b)]===_0x55c27b(0x140)||_0x405d93[_0x55c27b(0x13b)]===_0x55c27b(0x136)){const _0x2ac5bc=_0x14f372[_0x55c27b(0x13f)](_0x373c1d=>({..._0x373c1d,..._0x373c1d[_0x55c27b(0x150)]==='segment'?{'url':_0xe71728(_0x373c1d['id'])}:{}}));return await handleSDKOutput(_0x2ac5bc,_0x405d93),0x0;}if(_0x27fa8a[_0x55c27b(0x107)]===0x0)return console[_0x55c27b(0x125)]('No\x20folders\x20or\x20segments\x20match\x20'+_0x157615),0x0;for(const _0x3dd84b of _0x14f372){console[_0x55c27b(0x125)](_0x3dd84b[_0x55c27b(0x150)][_0x55c27b(0x152)](0x8)+'\x20'+_0x3dd84b['path']+'\x20\x20'+a49_0x49f307[_0x55c27b(0x14f)](_0x55c27b(0x102)+_0x3dd84b['id']+')'));}const _0x2f5ef8=_0x27fa8a[_0x55c27b(0x10c)](_0x39a811=>_0x39a811[_0x55c27b(0x150)]==='segment'),_0x27aa3f=new Set(_0x2f5ef8['map'](_0x2da169=>_0x2da169[_0x55c27b(0x144)]['toLowerCase']()))[_0x55c27b(0x10b)]===0x1;return _0x2f5ef8[_0x55c27b(0x107)]>0x1&&_0x27aa3f&&console['log'](a49_0x49f307['dim']('\x0a'+_0x2f5ef8[_0x55c27b(0x107)]+_0x55c27b(0x10f))),0x0;}async[a49_0x28d3c0(0x112)](_0x5d6287,_0x30f457,_0x352d72){const _0x3f56de=a49_0x28d3c0,{options:_0x55a5ad,tdx:_0x56e826}=_0x5d6287,_0x460046=await withSpinner(_0x3f56de(0x127)+_0x30f457+_0x3f56de(0x14a),()=>_0x56e826[_0x3f56de(0x13d)][_0x3f56de(0x143)](_0x30f457),{'verbose':_0x55a5ad['verbose']}),_0x244694=_0x460046[_0x3f56de(0x153)],_0x37fbee=await withSpinner(_0x3f56de(0x128),()=>_0x56e826[_0x3f56de(0x13d)][_0x3f56de(0x13e)](_0x244694[_0x3f56de(0x138)],_0x244694[_0x3f56de(0x110)]),{'verbose':_0x55a5ad['verbose']}),{folders:_0x333082,segments:_0x55e8f0,journeys:_0x5a0c4d}=_0x37fbee[_0x3f56de(0x153)],_0xc64f1=_0x352d72[_0x3f56de(0x123)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x3f56de(0x123)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x2ef9a9=new RegExp('^'+_0xc64f1+'$','i'),_0x23ae06=_0x333082[_0x3f56de(0x10c)](_0x117e39=>_0x2ef9a9[_0x3f56de(0x113)](_0x117e39[_0x3f56de(0x144)])),_0x58e55c=_0x55e8f0[_0x3f56de(0x10c)](_0x265d2a=>_0x2ef9a9['test'](_0x265d2a[_0x3f56de(0x144)])),_0x3b8626=_0x5a0c4d[_0x3f56de(0x10c)](_0x71d95a=>_0x2ef9a9[_0x3f56de(0x113)](_0x71d95a[_0x3f56de(0x105)])),_0x1cbb56=_0x23ae06[_0x3f56de(0x107)]+_0x58e55c[_0x3f56de(0x107)]+_0x3b8626[_0x3f56de(0x107)];console[_0x3f56de(0x12b)](_0x3f56de(0x137)+_0x23ae06[_0x3f56de(0x107)]+_0x3f56de(0x120)+(_0x23ae06[_0x3f56de(0x107)]!==0x1?'s':'')+',\x20'+_0x58e55c['length']+_0x3f56de(0x135)+(_0x58e55c['length']!==0x1?'s':'')+',\x20and\x20'+_0x3b8626[_0x3f56de(0x107)]+_0x3f56de(0x104)+(_0x3b8626[_0x3f56de(0x107)]!==0x1?'s':'')+_0x3f56de(0x13a)+_0x352d72+'\x27');const _0x42cb17=_0x1ad0ba=>{const _0x14cdeb=_0x3f56de;return getConsoleNextUrl(_0x55a5ad[_0x14cdeb(0x149)],_0x14cdeb(0x142)+_0x244694['parentId']+_0x14cdeb(0x11b)+_0x1ad0ba);},_0x2eeae5=_0x55a5ad['format']==='json'||_0x55a5ad['format']===_0x3f56de(0x136);if(_0x2eeae5){const _0x2dfd90=[..._0x23ae06[_0x3f56de(0x13f)](_0xbae74f=>({..._0xbae74f,'type':_0x3f56de(0x129)})),..._0x58e55c[_0x3f56de(0x13f)](_0x582cca=>({..._0x582cca,'type':_0x3f56de(0x13d),'url':_0x42cb17(_0x582cca['id'])})),..._0x3b8626['map'](_0x3af578=>({..._0x3af578,'name':_0x3af578['journeyBundleName'],'type':_0x3f56de(0x132)}))]['sort']((_0x3d99aa,_0x3d6584)=>_0x3d99aa[_0x3f56de(0x144)][_0x3f56de(0x100)](_0x3d6584[_0x3f56de(0x144)]));await handleSDKOutput(_0x2dfd90,_0x55a5ad);}else{if(_0x1cbb56===0x0)console[_0x3f56de(0x125)]('No\x20items\x20match\x20pattern:\x20'+_0x352d72);else{console[_0x3f56de(0x125)](a49_0x49f307['dim']('['+_0x30f457+']\x20matching\x20\x27'+_0x352d72+'\x27'));const _0x3513ee=formatFlatList(_0x23ae06,_0x58e55c,{'showMetadata':!![],'getSegmentUrl':_0x42cb17},_0x3b8626);console[_0x3f56de(0x125)](_0x3513ee);}}return 0x0;}async[a49_0x28d3c0(0x109)](_0x231ec0,_0x4e094e){const _0x3cf799=a49_0x28d3c0,{options:_0x45436e,tdx:_0x3b6166}=_0x231ec0,_0x28e92c=await withSpinner('Resolving\x20path\x20\x27'+_0x4e094e+_0x3cf799(0x14a),()=>_0x3b6166[_0x3cf799(0x13d)][_0x3cf799(0x143)](_0x4e094e),{'verbose':_0x45436e[_0x3cf799(0x118)]}),_0xf92943=_0x28e92c[_0x3cf799(0x153)];_0x45436e[_0x3cf799(0x118)]&&(console['error'](_0x3cf799(0x147)+_0xf92943[_0x3cf799(0x138)]),_0xf92943[_0x3cf799(0x110)]&&console[_0x3cf799(0x12b)](_0x3cf799(0x12d)+_0xf92943[_0x3cf799(0x110)]));const _0x13adca=await withSpinner(_0x3cf799(0x128),()=>_0x3b6166['segment'][_0x3cf799(0x13e)](_0xf92943[_0x3cf799(0x138)],_0xf92943[_0x3cf799(0x110)]),{'verbose':_0x45436e[_0x3cf799(0x118)]}),{folders:_0x3bd4e2,segments:_0x3c5ba2,journeys:_0x262bb6}=_0x13adca['data'],_0xbcbe78=_0x3bd4e2[_0x3cf799(0x107)]+_0x3c5ba2[_0x3cf799(0x107)]+_0x262bb6[_0x3cf799(0x107)];console[_0x3cf799(0x12b)]('✔\x20Found\x20'+_0x3bd4e2[_0x3cf799(0x107)]+_0x3cf799(0x120)+(_0x3bd4e2[_0x3cf799(0x107)]!==0x1?'s':'')+',\x20'+_0x3c5ba2[_0x3cf799(0x107)]+_0x3cf799(0x135)+(_0x3c5ba2[_0x3cf799(0x107)]!==0x1?'s':'')+_0x3cf799(0x141)+_0x262bb6[_0x3cf799(0x107)]+_0x3cf799(0x104)+(_0x262bb6['length']!==0x1?'s':''));const _0x5be8b2=_0x18b4d4=>{const _0x3cfa07=_0x3cf799;return getConsoleNextUrl(_0x45436e['site'],'/app/ps/'+_0xf92943[_0x3cfa07(0x138)]+_0x3cfa07(0x11b)+_0x18b4d4);},_0xfea575=_0x3750e7=>{const _0x4085d6=_0x3cf799;return getConsoleNextUrl(_0x45436e[_0x4085d6(0x149)],_0x4085d6(0x142)+_0xf92943[_0x4085d6(0x138)]+_0x4085d6(0x11b)+_0x3750e7+_0x4085d6(0x14d));},_0x3b1192=_0x45436e[_0x3cf799(0x13b)]===_0x3cf799(0x140)||_0x45436e['format']===_0x3cf799(0x136);if(_0x3b1192){const _0x24f83f=[..._0x3bd4e2['map'](_0x387f29=>({..._0x387f29,'type':_0x3cf799(0x129)})),..._0x3c5ba2['map'](_0x4c621c=>({..._0x4c621c,'type':'segment','url':_0x5be8b2(_0x4c621c['id'])})),..._0x262bb6[_0x3cf799(0x13f)](_0x3087b5=>({..._0x3087b5,'name':_0x3087b5['journeyBundleName'],'type':_0x3cf799(0x132),'url':_0xfea575(_0x3087b5['id'])}))]['sort']((_0x4be7e5,_0x4d907e)=>_0x4be7e5[_0x3cf799(0x144)]['localeCompare'](_0x4d907e['name']));await handleSDKOutput(_0x24f83f,_0x45436e);}else{if(_0xbcbe78===0x0)console[_0x3cf799(0x125)](a49_0x49f307['dim']('['+_0x4e094e+']')),console[_0x3cf799(0x125)](_0x3cf799(0x131));else{console[_0x3cf799(0x125)](a49_0x49f307[_0x3cf799(0x14f)]('['+_0x4e094e+']'));const _0x576e37=formatFlatList(_0x3bd4e2,_0x3c5ba2,{'showMetadata':!![],'getSegmentUrl':_0x5be8b2,'getJourneyUrl':_0xfea575},_0x262bb6);console[_0x3cf799(0x125)](_0x576e37);}}return 0x0;}async['listRecursive'](_0x4c7af1,_0x3d0c9c){const _0xf54740=a49_0x28d3c0,{options:_0x2cfd4f,tdx:_0x416504}=_0x4c7af1,_0x181e7e=await withSpinner(_0xf54740(0x11f)+_0x3d0c9c+_0xf54740(0x14a),()=>_0x416504[_0xf54740(0x13d)]['resolvePathToResource'](_0x3d0c9c),{'verbose':_0x2cfd4f[_0xf54740(0x118)]}),_0x585021=_0x181e7e[_0xf54740(0x153)];_0x2cfd4f[_0xf54740(0x118)]&&(console[_0xf54740(0x12b)](_0xf54740(0x147)+_0x585021[_0xf54740(0x138)]),_0x585021[_0xf54740(0x110)]&&console[_0xf54740(0x12b)]('Folder\x20ID:\x20'+_0x585021[_0xf54740(0x110)]));const _0x207b13=_0x2cfd4f[_0xf54740(0x146)]||0xa,_0x195914=await withSpinner(_0xf54740(0x11a),()=>_0x416504[_0xf54740(0x13d)]['listRecursive'](_0x585021[_0xf54740(0x138)],_0x585021[_0xf54740(0x110)],0x0,_0x207b13),{'verbose':_0x2cfd4f[_0xf54740(0x118)]}),_0x4d7253=_0x195914['data'],_0x8475ee=_0x940092=>{const _0x328d1f=_0xf54740;let _0x180283=0x0,_0x89335e=0x0,_0x36ac74=0x0;for(const _0x2b7459 of _0x940092){if(_0x2b7459['type']===_0x328d1f(0x129))_0x180283++;else{if(_0x2b7459['type']===_0x328d1f(0x13d))_0x89335e++;else{if(_0x2b7459['type']==='journey')_0x36ac74++;}}if(_0x2b7459[_0x328d1f(0x122)]){const _0xda5f27=_0x8475ee(_0x2b7459[_0x328d1f(0x122)]);_0x180283+=_0xda5f27[_0x328d1f(0x14c)],_0x89335e+=_0xda5f27[_0x328d1f(0x12f)],_0x36ac74+=_0xda5f27[_0x328d1f(0x119)];}}return{'folders':_0x180283,'segments':_0x89335e,'journeys':_0x36ac74};},_0x206fca=_0x8475ee(_0x4d7253);console[_0xf54740(0x12b)](_0xf54740(0x11e)+_0x206fca[_0xf54740(0x14c)]+'\x20folder'+(_0x206fca[_0xf54740(0x14c)]!==0x1?'s':'')+',\x20'+_0x206fca[_0xf54740(0x12f)]+_0xf54740(0x135)+(_0x206fca['segments']!==0x1?'s':'')+_0xf54740(0x141)+_0x206fca[_0xf54740(0x119)]+_0xf54740(0x104)+(_0x206fca['journeys']!==0x1?'s':''));const _0xcd2d30=_0x12bfdc=>{const _0x1dde9c=_0xf54740;return getConsoleNextUrl(_0x2cfd4f[_0x1dde9c(0x149)],_0x1dde9c(0x142)+_0x585021[_0x1dde9c(0x138)]+'/e/'+_0x12bfdc);},_0x2cd057=_0x5e4d28=>{const _0xb1ebd1=_0xf54740;return getConsoleNextUrl(_0x2cfd4f['site'],_0xb1ebd1(0x142)+_0x585021[_0xb1ebd1(0x138)]+_0xb1ebd1(0x11b)+_0x5e4d28+_0xb1ebd1(0x14d));};if(_0x2cfd4f[_0xf54740(0x13b)]==='json'||_0x2cfd4f['format']===_0xf54740(0x136))await handleSDKOutput(_0x4d7253,_0x2cfd4f);else{console[_0xf54740(0x125)](a49_0x49f307['dim']('['+_0x3d0c9c+']'));const _0x39a7f6=formatTree(_0x4d7253,{'showMetadata':!![],'getSegmentUrl':_0xcd2d30,'getJourneyUrl':_0x2cd057});console[_0xf54740(0x125)](_0x39a7f6);}return 0x0;}}
1
+ const a49_0xc61f39=a49_0x27a9;(function(_0x3095a6,_0x5ecfce){const _0x24d7fd=a49_0x27a9,_0x5ba2a3=_0x3095a6();while(!![]){try{const _0x862a8e=-parseInt(_0x24d7fd(0x17b))/0x1+-parseInt(_0x24d7fd(0x156))/0x2*(-parseInt(_0x24d7fd(0x177))/0x3)+parseInt(_0x24d7fd(0x18a))/0x4*(parseInt(_0x24d7fd(0x16c))/0x5)+parseInt(_0x24d7fd(0x15a))/0x6+parseInt(_0x24d7fd(0x16d))/0x7*(-parseInt(_0x24d7fd(0x164))/0x8)+-parseInt(_0x24d7fd(0x172))/0x9*(parseInt(_0x24d7fd(0x147))/0xa)+parseInt(_0x24d7fd(0x17a))/0xb;if(_0x862a8e===_0x5ecfce)break;else _0x5ba2a3['push'](_0x5ba2a3['shift']());}catch(_0x413cbe){_0x5ba2a3['push'](_0x5ba2a3['shift']());}}}(a49_0x5e52,0x8a96d));function a49_0x27a9(_0x23305d,_0x5172db){_0x23305d=_0x23305d-0x13b;const _0x5e5223=a49_0x5e52();let _0x27a9ac=_0x5e5223[_0x23305d];return _0x27a9ac;}function a49_0x5e52(){const _0x4b7bcb=['/e/','filter','length','Folder\x20ID:\x20','journeyBundleName','No\x20items\x20match\x20pattern:\x20','8OVIekG','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','List\x20folders\x20and\x20child\x20segments','execute','test','format','parentId','resolvePathToResource','728665PetueY','5567079WWuyZP',',\x20and\x20','\x20\x20Cause:\x20','listWithPattern','No\x20folders\x20or\x20segments\x20match\x20','1260bGnvSr','✔\x20Built\x20tree\x20with\x20','searchByName','maxDepth','✔\x20Found\x20','11496qjZFfO','dim','/app/ps/','8008473VtUygt','884590fXXRMO','\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22','journeys','\x20matching\x20\x27','description','map','Folder/pattern\x20arg:\x20','padEnd','jsonl','listUnified','\x20folder','Error:\x20No\x20parent\x20segment\x20context\x20set.','Parent\x20ID:\x20','\x20—\x20that\x27s\x20a\x20lot\x20to\x20eyeball.\x20Narrow\x20the\x20pattern\x20(add\x20more\x20of\x20the\x20name,\x20or\x20use\x20*\x20/\x20?),\x20or\x20use\x20--format\x20json\x20and\x20filter\x20with\x20jq/grep.','data','16yylwuB','folder','(id\x20','listUnifiedWithJourneys','\x27...','localeCompare','error','folders','Building\x20hierarchy\x20tree...','journey','toLowerCase','segments','parentSegment','folderId','\x20segment','log','segment','listRecursive',']\x20matching\x20\x27','recursive','cause','site','sort','31730speUtX','Resolving\x20path\x20\x27','Listing\x20folders,\x20segments,\x20and\x20journeys...','(empty)','type','\x20segments\x20share\x20this\x20name\x20—\x20pass\x20the\x20full\x20path\x20(or\x20id)\x20to\x20`tdx\x20sg\x20move`;\x20do\x20not\x20assume\x20the\x20first.','Resolving\x20parent\x20segment\x20\x27','\x5c$&','Set\x20a\x20parent\x20segment\x20context\x20first:','verbose','name','\x20journey','/j/da','replace','Error:\x20','290ENxhDQ','path','Site:\x20','(not\x20set)','4950918URPvbO','children','Parent\x20segment\x20context:\x20','json'];a49_0x5e52=function(){return _0x4b7bcb;};return a49_0x5e52();}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{formatFlatList,formatTree}from'../sdk/util/tree-formatter.js';import{searchTreeByName}from'../sdk/util/tree-search.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import a49_0x598b61 from'chalk';export class SegmentsCommand extends BaseCommand{[a49_0xc61f39(0x151)]='segments';[a49_0xc61f39(0x17f)]=a49_0xc61f39(0x166);async[a49_0xc61f39(0x167)](_0x4d8f8a){const _0x49060c=a49_0xc61f39,{options:_0x50d804,args:_0xe58b04}=_0x4d8f8a,_0x12c0e3=_0x50d804[_0x49060c(0x143)],_0xe1390d=_0xe58b04[0x0];try{const _0x21fde5=_0x50d804[_0x49060c(0x13c)];_0x50d804['verbose']&&(console[_0x49060c(0x190)](_0x49060c(0x158)+_0x50d804['site']),console[_0x49060c(0x190)](_0x49060c(0x15c)+(_0x21fde5||_0x49060c(0x159))),_0xe1390d&&console[_0x49060c(0x190)](_0x49060c(0x181)+_0xe1390d),_0x12c0e3&&console[_0x49060c(0x190)]('Recursive\x20mode:\x20enabled'));if(!_0x21fde5)return console[_0x49060c(0x190)](_0x49060c(0x186)),console['error'](''),console[_0x49060c(0x190)](_0x49060c(0x14f)),console[_0x49060c(0x190)]('\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22'),console[_0x49060c(0x190)](_0x49060c(0x17c)),console[_0x49060c(0x190)](''),console[_0x49060c(0x190)](_0x49060c(0x165)),0x1;if(_0xe1390d&&_0x12c0e3)return await this[_0x49060c(0x174)](_0x4d8f8a,_0x21fde5,_0xe1390d);const _0x5ab7ba=_0xe1390d&&(_0xe1390d['includes']('*')||_0xe1390d['includes']('?'));if(_0x5ab7ba)return await this[_0x49060c(0x170)](_0x4d8f8a,_0x21fde5,_0xe1390d);const _0x36f969=_0xe1390d?_0x21fde5+'/'+_0xe1390d:_0x21fde5;return _0x12c0e3?await this[_0x49060c(0x141)](_0x4d8f8a,_0x36f969):await this[_0x49060c(0x184)](_0x4d8f8a,_0x36f969);}catch(_0x5de797){if(_0x5de797 instanceof SDKError)return console[_0x49060c(0x190)](_0x49060c(0x155)+_0x5de797['message']),_0x5de797[_0x49060c(0x144)]&&console[_0x49060c(0x190)](_0x49060c(0x16f)+_0x5de797['cause']),0x1;throw _0x5de797;}}async[a49_0xc61f39(0x174)](_0x2fbc00,_0x417f72,_0x601922){const _0x50d4ec=a49_0xc61f39,{options:_0x5bf308,tdx:_0x22ad61}=_0x2fbc00,_0x39d95e='\x22'+_0x601922+'\x22',_0x28778b=await withSpinner(_0x50d4ec(0x148)+_0x417f72+_0x50d4ec(0x18e),()=>_0x22ad61['segment']['resolvePathToResource'](_0x417f72),{'verbose':_0x5bf308['verbose']}),_0xfb5633=_0x28778b[_0x50d4ec(0x189)],_0x3c6277=_0x5bf308['maxDepth']||0xa,_0x17be8d=await withSpinner('Searching\x20the\x20tree\x20for\x20names\x20matching\x20'+_0x39d95e+'...',()=>_0x22ad61[_0x50d4ec(0x140)][_0x50d4ec(0x141)](_0xfb5633['parentId'],_0xfb5633[_0x50d4ec(0x13d)],0x0,_0x3c6277),{'verbose':_0x5bf308[_0x50d4ec(0x150)]}),_0x1a53d8=searchTreeByName(_0x17be8d[_0x50d4ec(0x189)],_0x601922),_0x2c3a8f=_0x2a00a5=>getConsoleNextUrl(_0x5bf308[_0x50d4ec(0x145)],_0x50d4ec(0x179)+_0xfb5633[_0x50d4ec(0x16a)]+_0x50d4ec(0x15e)+_0x2a00a5),_0x5d67be=[..._0x1a53d8][_0x50d4ec(0x146)]((_0x9692c7,_0x46e81a)=>_0x9692c7[_0x50d4ec(0x157)][_0x50d4ec(0x18f)](_0x46e81a['path'])),_0x5091cc=0x32,_0x529302='Found\x20'+_0x1a53d8[_0x50d4ec(0x160)]+'\x20match'+(_0x1a53d8[_0x50d4ec(0x160)]!==0x1?'es':'');console[_0x50d4ec(0x190)](_0x1a53d8[_0x50d4ec(0x160)]>_0x5091cc?'✔\x20'+_0x529302+_0x50d4ec(0x188):'✔\x20'+_0x529302);if(_0x5bf308[_0x50d4ec(0x169)]===_0x50d4ec(0x15d)||_0x5bf308[_0x50d4ec(0x169)]==='jsonl'){const _0x5f885a=_0x5d67be[_0x50d4ec(0x180)](_0x4f9c1e=>({..._0x4f9c1e,..._0x4f9c1e[_0x50d4ec(0x14b)]===_0x50d4ec(0x140)?{'url':_0x2c3a8f(_0x4f9c1e['id'])}:{}}));return await handleSDKOutput(_0x5f885a,_0x5bf308),0x0;}if(_0x1a53d8[_0x50d4ec(0x160)]===0x0)return console['log'](_0x50d4ec(0x171)+_0x39d95e),0x0;for(const _0x368e21 of _0x5d67be){console[_0x50d4ec(0x13f)](_0x368e21[_0x50d4ec(0x14b)][_0x50d4ec(0x182)](0x8)+'\x20'+_0x368e21[_0x50d4ec(0x157)]+'\x20\x20'+a49_0x598b61[_0x50d4ec(0x178)](_0x50d4ec(0x18c)+_0x368e21['id']+')'));}const _0x5f541=_0x1a53d8[_0x50d4ec(0x15f)](_0x3cde88=>_0x3cde88[_0x50d4ec(0x14b)]===_0x50d4ec(0x140)),_0x3712cf=new Set(_0x5f541[_0x50d4ec(0x180)](_0x1f7d81=>_0x1f7d81['name'][_0x50d4ec(0x194)]()))['size']===0x1;return _0x5f541[_0x50d4ec(0x160)]>0x1&&_0x3712cf&&console[_0x50d4ec(0x13f)](a49_0x598b61[_0x50d4ec(0x178)]('\x0a'+_0x5f541['length']+_0x50d4ec(0x14c))),0x0;}async[a49_0xc61f39(0x170)](_0x162895,_0x22a91d,_0x26c270){const _0x628420=a49_0xc61f39,{options:_0x29c901,tdx:_0x54c6ea}=_0x162895,_0xf70014=await withSpinner(_0x628420(0x14d)+_0x22a91d+_0x628420(0x18e),()=>_0x54c6ea[_0x628420(0x140)][_0x628420(0x16b)](_0x22a91d),{'verbose':_0x29c901[_0x628420(0x150)]}),_0x27c241=_0xf70014[_0x628420(0x189)],_0x52a272=await withSpinner(_0x628420(0x149),()=>_0x54c6ea['segment'][_0x628420(0x18d)](_0x27c241[_0x628420(0x16a)],_0x27c241[_0x628420(0x13d)]),{'verbose':_0x29c901[_0x628420(0x150)]}),{folders:_0x4c26b3,segments:_0xf5779a,journeys:_0x531b12}=_0x52a272[_0x628420(0x189)],_0x439d63=_0x26c270['replace'](/[.+^${}()|[\]\\]/g,_0x628420(0x14e))['replace'](/\*/g,'.*')[_0x628420(0x154)](/\?/g,'.'),_0x4037be=new RegExp('^'+_0x439d63+'$','i'),_0x1ba585=_0x4c26b3[_0x628420(0x15f)](_0x8431af=>_0x4037be[_0x628420(0x168)](_0x8431af[_0x628420(0x151)])),_0x368d03=_0xf5779a[_0x628420(0x15f)](_0x18696e=>_0x4037be[_0x628420(0x168)](_0x18696e[_0x628420(0x151)])),_0xf4cd1=_0x531b12[_0x628420(0x15f)](_0x2d0d49=>_0x4037be[_0x628420(0x168)](_0x2d0d49[_0x628420(0x162)])),_0x64a9a1=_0x1ba585[_0x628420(0x160)]+_0x368d03[_0x628420(0x160)]+_0xf4cd1[_0x628420(0x160)];console[_0x628420(0x190)](_0x628420(0x176)+_0x1ba585[_0x628420(0x160)]+_0x628420(0x185)+(_0x1ba585['length']!==0x1?'s':'')+',\x20'+_0x368d03[_0x628420(0x160)]+_0x628420(0x13e)+(_0x368d03[_0x628420(0x160)]!==0x1?'s':'')+_0x628420(0x16e)+_0xf4cd1['length']+'\x20journey'+(_0xf4cd1['length']!==0x1?'s':'')+_0x628420(0x17e)+_0x26c270+'\x27');const _0x4430cf=_0x4ca7f2=>{const _0x2da369=_0x628420;return getConsoleNextUrl(_0x29c901[_0x2da369(0x145)],'/app/ps/'+_0x27c241[_0x2da369(0x16a)]+_0x2da369(0x15e)+_0x4ca7f2);},_0xba1853=_0x29c901[_0x628420(0x169)]===_0x628420(0x15d)||_0x29c901['format']===_0x628420(0x183);if(_0xba1853){const _0x287aa6=[..._0x1ba585[_0x628420(0x180)](_0x46ee2d=>({..._0x46ee2d,'type':_0x628420(0x18b)})),..._0x368d03[_0x628420(0x180)](_0x219994=>({..._0x219994,'type':_0x628420(0x140),'url':_0x4430cf(_0x219994['id'])})),..._0xf4cd1[_0x628420(0x180)](_0x473144=>({..._0x473144,'name':_0x473144[_0x628420(0x162)],'type':'journey'}))][_0x628420(0x146)]((_0x3d59d9,_0x337425)=>_0x3d59d9['name'][_0x628420(0x18f)](_0x337425[_0x628420(0x151)]));await handleSDKOutput(_0x287aa6,_0x29c901);}else{if(_0x64a9a1===0x0)console['log'](_0x628420(0x163)+_0x26c270);else{console[_0x628420(0x13f)](a49_0x598b61[_0x628420(0x178)]('['+_0x22a91d+_0x628420(0x142)+_0x26c270+'\x27'));const _0x3cc864=formatFlatList(_0x1ba585,_0x368d03,{'showMetadata':!![],'getSegmentUrl':_0x4430cf},_0xf4cd1);console['log'](_0x3cc864);}}return 0x0;}async['listUnified'](_0x37e69f,_0xc10b4b){const _0x2d9811=a49_0xc61f39,{options:_0x4b6972,tdx:_0x5b8b4c}=_0x37e69f,_0x561075=await withSpinner('Resolving\x20path\x20\x27'+_0xc10b4b+_0x2d9811(0x18e),()=>_0x5b8b4c[_0x2d9811(0x140)]['resolvePathToResource'](_0xc10b4b),{'verbose':_0x4b6972[_0x2d9811(0x150)]}),_0x31c429=_0x561075[_0x2d9811(0x189)];_0x4b6972[_0x2d9811(0x150)]&&(console['error'](_0x2d9811(0x187)+_0x31c429[_0x2d9811(0x16a)]),_0x31c429[_0x2d9811(0x13d)]&&console[_0x2d9811(0x190)](_0x2d9811(0x161)+_0x31c429[_0x2d9811(0x13d)]));const _0x2152b1=await withSpinner(_0x2d9811(0x149),()=>_0x5b8b4c[_0x2d9811(0x140)][_0x2d9811(0x18d)](_0x31c429[_0x2d9811(0x16a)],_0x31c429['folderId']),{'verbose':_0x4b6972['verbose']}),{folders:_0x32e1e3,segments:_0x30e76b,journeys:_0x11598d}=_0x2152b1['data'],_0x24c8e0=_0x32e1e3['length']+_0x30e76b[_0x2d9811(0x160)]+_0x11598d['length'];console[_0x2d9811(0x190)](_0x2d9811(0x176)+_0x32e1e3['length']+_0x2d9811(0x185)+(_0x32e1e3['length']!==0x1?'s':'')+',\x20'+_0x30e76b[_0x2d9811(0x160)]+_0x2d9811(0x13e)+(_0x30e76b[_0x2d9811(0x160)]!==0x1?'s':'')+_0x2d9811(0x16e)+_0x11598d[_0x2d9811(0x160)]+_0x2d9811(0x152)+(_0x11598d[_0x2d9811(0x160)]!==0x1?'s':''));const _0x361634=_0xd63cd3=>{const _0x733dce=_0x2d9811;return getConsoleNextUrl(_0x4b6972[_0x733dce(0x145)],_0x733dce(0x179)+_0x31c429[_0x733dce(0x16a)]+_0x733dce(0x15e)+_0xd63cd3);},_0x2f9b31=_0x57d91c=>{const _0x5b74c8=_0x2d9811;return getConsoleNextUrl(_0x4b6972[_0x5b74c8(0x145)],_0x5b74c8(0x179)+_0x31c429[_0x5b74c8(0x16a)]+_0x5b74c8(0x15e)+_0x57d91c+_0x5b74c8(0x153));},_0x2e0f08=_0x4b6972['format']==='json'||_0x4b6972[_0x2d9811(0x169)]==='jsonl';if(_0x2e0f08){const _0x359666=[..._0x32e1e3[_0x2d9811(0x180)](_0x537ef8=>({..._0x537ef8,'type':_0x2d9811(0x18b)})),..._0x30e76b[_0x2d9811(0x180)](_0x47ac1c=>({..._0x47ac1c,'type':'segment','url':_0x361634(_0x47ac1c['id'])})),..._0x11598d[_0x2d9811(0x180)](_0x4ac331=>({..._0x4ac331,'name':_0x4ac331[_0x2d9811(0x162)],'type':_0x2d9811(0x193),'url':_0x2f9b31(_0x4ac331['id'])}))][_0x2d9811(0x146)]((_0x5d6704,_0x392868)=>_0x5d6704[_0x2d9811(0x151)][_0x2d9811(0x18f)](_0x392868[_0x2d9811(0x151)]));await handleSDKOutput(_0x359666,_0x4b6972);}else{if(_0x24c8e0===0x0)console[_0x2d9811(0x13f)](a49_0x598b61['dim']('['+_0xc10b4b+']')),console[_0x2d9811(0x13f)](_0x2d9811(0x14a));else{console[_0x2d9811(0x13f)](a49_0x598b61['dim']('['+_0xc10b4b+']'));const _0x2af4c5=formatFlatList(_0x32e1e3,_0x30e76b,{'showMetadata':!![],'getSegmentUrl':_0x361634,'getJourneyUrl':_0x2f9b31},_0x11598d);console[_0x2d9811(0x13f)](_0x2af4c5);}}return 0x0;}async[a49_0xc61f39(0x141)](_0x443579,_0x782046){const _0x3b1d7b=a49_0xc61f39,{options:_0x5f485a,tdx:_0xd8e6ab}=_0x443579,_0x35cd01=await withSpinner(_0x3b1d7b(0x148)+_0x782046+_0x3b1d7b(0x18e),()=>_0xd8e6ab['segment'][_0x3b1d7b(0x16b)](_0x782046),{'verbose':_0x5f485a[_0x3b1d7b(0x150)]}),_0x32ae03=_0x35cd01[_0x3b1d7b(0x189)];_0x5f485a['verbose']&&(console[_0x3b1d7b(0x190)](_0x3b1d7b(0x187)+_0x32ae03[_0x3b1d7b(0x16a)]),_0x32ae03[_0x3b1d7b(0x13d)]&&console[_0x3b1d7b(0x190)]('Folder\x20ID:\x20'+_0x32ae03[_0x3b1d7b(0x13d)]));const _0x3b8a7e=_0x5f485a[_0x3b1d7b(0x175)]||0xa,_0x25d5c4=await withSpinner(_0x3b1d7b(0x192),()=>_0xd8e6ab[_0x3b1d7b(0x140)][_0x3b1d7b(0x141)](_0x32ae03[_0x3b1d7b(0x16a)],_0x32ae03[_0x3b1d7b(0x13d)],0x0,_0x3b8a7e),{'verbose':_0x5f485a[_0x3b1d7b(0x150)]}),_0x27be15=_0x25d5c4[_0x3b1d7b(0x189)],_0xb80e37=_0xb6b20a=>{const _0x379a00=_0x3b1d7b;let _0x259b57=0x0,_0x5afdb1=0x0,_0x147b3=0x0;for(const _0x27be7a of _0xb6b20a){if(_0x27be7a[_0x379a00(0x14b)]===_0x379a00(0x18b))_0x259b57++;else{if(_0x27be7a['type']===_0x379a00(0x140))_0x5afdb1++;else{if(_0x27be7a[_0x379a00(0x14b)]===_0x379a00(0x193))_0x147b3++;}}if(_0x27be7a[_0x379a00(0x15b)]){const _0x512421=_0xb80e37(_0x27be7a[_0x379a00(0x15b)]);_0x259b57+=_0x512421[_0x379a00(0x191)],_0x5afdb1+=_0x512421[_0x379a00(0x13b)],_0x147b3+=_0x512421[_0x379a00(0x17d)];}}return{'folders':_0x259b57,'segments':_0x5afdb1,'journeys':_0x147b3};},_0x155bd1=_0xb80e37(_0x27be15);console[_0x3b1d7b(0x190)](_0x3b1d7b(0x173)+_0x155bd1['folders']+_0x3b1d7b(0x185)+(_0x155bd1['folders']!==0x1?'s':'')+',\x20'+_0x155bd1['segments']+_0x3b1d7b(0x13e)+(_0x155bd1[_0x3b1d7b(0x13b)]!==0x1?'s':'')+_0x3b1d7b(0x16e)+_0x155bd1[_0x3b1d7b(0x17d)]+_0x3b1d7b(0x152)+(_0x155bd1[_0x3b1d7b(0x17d)]!==0x1?'s':''));const _0x38e317=_0xd3914a=>{const _0x936cfa=_0x3b1d7b;return getConsoleNextUrl(_0x5f485a[_0x936cfa(0x145)],_0x936cfa(0x179)+_0x32ae03[_0x936cfa(0x16a)]+_0x936cfa(0x15e)+_0xd3914a);},_0x568e1e=_0x47ae99=>{const _0x229242=_0x3b1d7b;return getConsoleNextUrl(_0x5f485a[_0x229242(0x145)],_0x229242(0x179)+_0x32ae03['parentId']+_0x229242(0x15e)+_0x47ae99+_0x229242(0x153));};if(_0x5f485a[_0x3b1d7b(0x169)]===_0x3b1d7b(0x15d)||_0x5f485a['format']===_0x3b1d7b(0x183))await handleSDKOutput(_0x27be15,_0x5f485a);else{console[_0x3b1d7b(0x13f)](a49_0x598b61[_0x3b1d7b(0x178)]('['+_0x782046+']'));const _0x4190f0=formatTree(_0x27be15,{'showMetadata':!![],'getSegmentUrl':_0x38e317,'getJourneyUrl':_0x568e1e});console['log'](_0x4190f0);}return 0x0;}}