@treasuredata/tdx 2026.8.3 → 2026.8.4

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 (285) 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.js +1 -1
  12. package/dist/commands/cas-command.js +1 -1
  13. package/dist/commands/cas-segment-command.js +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.js +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/connection-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-always-on-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-always-on-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-always-on-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-campaign-pull-command.js +1 -1
  27. package/dist/commands/engage-campaign-push-command.js +1 -1
  28. package/dist/commands/engage-campaign-validate-command.js +1 -1
  29. package/dist/commands/engage-command.js +1 -1
  30. package/dist/commands/engage-template-pull-command.js +1 -1
  31. package/dist/commands/engage-template-push-command.js +1 -1
  32. package/dist/commands/engage-template-validate-command.js +1 -1
  33. package/dist/commands/job-command.js +1 -1
  34. package/dist/commands/journey-command.js +1 -1
  35. package/dist/commands/journey-validate-command.js +1 -1
  36. package/dist/commands/llm-command.js +1 -1
  37. package/dist/commands/mcp-command.js +1 -1
  38. package/dist/commands/p13n-command.d.ts +11 -0
  39. package/dist/commands/p13n-command.d.ts.map +1 -0
  40. package/dist/commands/p13n-command.js +1 -0
  41. package/dist/commands/p13n-command.js.map +1 -0
  42. package/dist/commands/parent-segment-command.js +1 -1
  43. package/dist/commands/policy-command.js +1 -1
  44. package/dist/commands/profile-command.js +1 -1
  45. package/dist/commands/profiles-command.js +1 -1
  46. package/dist/commands/query-command.js +1 -1
  47. package/dist/commands/schedule-command.js +1 -1
  48. package/dist/commands/segment-command.js +1 -1
  49. package/dist/commands/segment-create-command.js +1 -1
  50. package/dist/commands/segment-fields-command.js +1 -1
  51. package/dist/commands/segment-move-command.js +1 -1
  52. package/dist/commands/segment-pull-command.js +1 -1
  53. package/dist/commands/segment-push-command.js +1 -1
  54. package/dist/commands/segment-update-command.js +1 -1
  55. package/dist/commands/segment-use-command.js +1 -1
  56. package/dist/commands/segment-validate-command.js +1 -1
  57. package/dist/commands/segments.js +1 -1
  58. package/dist/commands/show.js +1 -1
  59. package/dist/commands/status-command.js +1 -1
  60. package/dist/commands/table-deleted.js +1 -1
  61. package/dist/commands/tables.js +1 -1
  62. package/dist/commands/unset-command.js +1 -1
  63. package/dist/commands/upgrade-command.js +1 -1
  64. package/dist/commands/use-command.js +1 -1
  65. package/dist/commands/user-command.js +1 -1
  66. package/dist/commands/work-command.js +1 -1
  67. package/dist/commands/workflow-command.js +1 -1
  68. package/dist/core/auth.js +1 -1
  69. package/dist/core/command-output.js +1 -1
  70. package/dist/core/config.js +1 -1
  71. package/dist/core/connection-cache.js +1 -1
  72. package/dist/core/constants.js +1 -1
  73. package/dist/core/credential-cache.js +1 -1
  74. package/dist/core/global-context.d.ts.map +1 -1
  75. package/dist/core/global-context.js +1 -1
  76. package/dist/core/global-context.js.map +1 -1
  77. package/dist/core/keychain.js +1 -1
  78. package/dist/core/oauth-keychain.js +1 -1
  79. package/dist/core/oauth.d.ts +9 -1
  80. package/dist/core/oauth.d.ts.map +1 -1
  81. package/dist/core/oauth.js +1 -1
  82. package/dist/core/oauth.js.map +1 -1
  83. package/dist/core/profile.js +1 -1
  84. package/dist/core/project-config.js +1 -1
  85. package/dist/core/session.js +1 -1
  86. package/dist/core/site-mismatch.js +1 -1
  87. package/dist/core/user-cache.js +1 -1
  88. package/dist/core/version.js +1 -1
  89. package/dist/index.js +1 -1
  90. package/dist/mcp/server.js +1 -1
  91. package/dist/mcp/tools/index.js +1 -1
  92. package/dist/mcp/tools/tdx-run.js +1 -1
  93. package/dist/mcp/tools/tdx-search.js +1 -1
  94. package/dist/mcp/tools/work-create-item.js +1 -1
  95. package/dist/mcp/utils.js +1 -1
  96. package/dist/proxy/claude-usage-tracker.js +1 -1
  97. package/dist/proxy/passthrough-server.d.ts.map +1 -1
  98. package/dist/proxy/passthrough-server.js +1 -1
  99. package/dist/proxy/passthrough-server.js.map +1 -1
  100. package/dist/proxy/sse-usage-parser.js +1 -1
  101. package/dist/sdk/agent/agent-config.js +1 -1
  102. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  103. package/dist/sdk/agent/agent-yaml.js +1 -1
  104. package/dist/sdk/agent/test/evaluator.js +1 -1
  105. package/dist/sdk/agent/test/executor.js +1 -1
  106. package/dist/sdk/agent/test/index.js +1 -1
  107. package/dist/sdk/agent/test/output.js +1 -1
  108. package/dist/sdk/agent/test/parser.js +1 -1
  109. package/dist/sdk/agent/tool-target-registry.js +1 -1
  110. package/dist/sdk/api.js +1 -1
  111. package/dist/sdk/auth-token.d.ts +42 -6
  112. package/dist/sdk/auth-token.d.ts.map +1 -1
  113. package/dist/sdk/auth-token.js +1 -1
  114. package/dist/sdk/auth-token.js.map +1 -1
  115. package/dist/sdk/cas/cas-api-client.js +1 -1
  116. package/dist/sdk/cas/cas-audience-schema.js +1 -1
  117. package/dist/sdk/cas/cas-audience-validator.js +1 -1
  118. package/dist/sdk/cas/cas-audience-yaml.js +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.js +1 -1
  123. package/dist/sdk/cas/validate-files.js +1 -1
  124. package/dist/sdk/client/cdp-api-client.js +1 -1
  125. package/dist/sdk/client/delivery-api-client.js +1 -1
  126. package/dist/sdk/client/endpoints.d.ts +6 -0
  127. package/dist/sdk/client/endpoints.d.ts.map +1 -1
  128. package/dist/sdk/client/endpoints.js +1 -1
  129. package/dist/sdk/client/endpoints.js.map +1 -1
  130. package/dist/sdk/client/engage-api-client.js +1 -1
  131. package/dist/sdk/client/http-client.js +1 -1
  132. package/dist/sdk/client/llm-api-client.js +1 -1
  133. package/dist/sdk/client/oauth-refresh.d.ts +11 -2
  134. package/dist/sdk/client/oauth-refresh.d.ts.map +1 -1
  135. package/dist/sdk/client/oauth-refresh.js +1 -1
  136. package/dist/sdk/client/oauth-refresh.js.map +1 -1
  137. package/dist/sdk/client/p13n-studio-api-client.d.ts +19 -0
  138. package/dist/sdk/client/p13n-studio-api-client.d.ts.map +1 -0
  139. package/dist/sdk/client/p13n-studio-api-client.js +1 -0
  140. package/dist/sdk/client/p13n-studio-api-client.js.map +1 -0
  141. package/dist/sdk/client/rate-limiter.js +1 -1
  142. package/dist/sdk/client/td-api-client.js +1 -1
  143. package/dist/sdk/client/trino-api-client.js +1 -1
  144. package/dist/sdk/client/workflow-client.js +1 -1
  145. package/dist/sdk/connection-validator.js +1 -1
  146. package/dist/sdk/connection.js +1 -1
  147. package/dist/sdk/delivery.js +1 -1
  148. package/dist/sdk/engage/always-on-campaign-pull.js +1 -1
  149. package/dist/sdk/engage/always-on-campaign-push.js +1 -1
  150. package/dist/sdk/engage/always-on-campaign-validator.js +1 -1
  151. package/dist/sdk/engage/always-on-campaign-yaml.js +1 -1
  152. package/dist/sdk/engage/campaign-pull.js +1 -1
  153. package/dist/sdk/engage/campaign-push.js +1 -1
  154. package/dist/sdk/engage/campaign-validator.js +1 -1
  155. package/dist/sdk/engage/campaign-yaml.js +1 -1
  156. package/dist/sdk/engage/template-pull.js +1 -1
  157. package/dist/sdk/engage/template-push.js +1 -1
  158. package/dist/sdk/engage/template-validator.js +1 -1
  159. package/dist/sdk/engage/template-yaml.js +1 -1
  160. package/dist/sdk/engage/types/always-on-campaign-schema.js +1 -1
  161. package/dist/sdk/engage/types/campaign-def.js +1 -1
  162. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  163. package/dist/sdk/engage/types/template-schema.js +1 -1
  164. package/dist/sdk/engage.js +1 -1
  165. package/dist/sdk/errors.js +1 -1
  166. package/dist/sdk/index.d.ts +6 -0
  167. package/dist/sdk/index.d.ts.map +1 -1
  168. package/dist/sdk/index.js +1 -1
  169. package/dist/sdk/index.js.map +1 -1
  170. package/dist/sdk/io/index.js +1 -1
  171. package/dist/sdk/io/node-filesystem.js +1 -1
  172. package/dist/sdk/job.js +1 -1
  173. package/dist/sdk/journey.js +1 -1
  174. package/dist/sdk/llm/chat-cache.js +1 -1
  175. package/dist/sdk/llm/index.js +1 -1
  176. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  177. package/dist/sdk/llm/model-factors.js +1 -1
  178. package/dist/sdk/llm/user-settings.js +1 -1
  179. package/dist/sdk/p13n-studio.d.ts +13 -0
  180. package/dist/sdk/p13n-studio.d.ts.map +1 -0
  181. package/dist/sdk/p13n-studio.js +1 -0
  182. package/dist/sdk/p13n-studio.js.map +1 -0
  183. package/dist/sdk/personalization.js +1 -1
  184. package/dist/sdk/policy.js +1 -1
  185. package/dist/sdk/query/deleted-table-validation.js +1 -1
  186. package/dist/sdk/query/index.js +1 -1
  187. package/dist/sdk/query/sql-parser.js +1 -1
  188. package/dist/sdk/realtime.js +1 -1
  189. package/dist/sdk/schedule.js +1 -1
  190. package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
  191. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  192. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  193. package/dist/sdk/segment/fields-display.js +1 -1
  194. package/dist/sdk/segment/file-discovery.js +1 -1
  195. package/dist/sdk/segment/journey-utils.js +1 -1
  196. package/dist/sdk/segment/journey-validator.js +1 -1
  197. package/dist/sdk/segment/journey-yaml.js +1 -1
  198. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  199. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  200. package/dist/sdk/segment/pull-workflow.js +1 -1
  201. package/dist/sdk/segment/push-recovery.js +1 -1
  202. package/dist/sdk/segment/push-workflow.js +1 -1
  203. package/dist/sdk/segment/resolution-context.js +1 -1
  204. package/dist/sdk/segment/segment-path-parser.js +1 -1
  205. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  206. package/dist/sdk/segment/segment-validator.js +1 -1
  207. package/dist/sdk/segment/target-resolution.js +1 -1
  208. package/dist/sdk/segment/tdx-config.js +1 -1
  209. package/dist/sdk/segment/types/activation-schema.js +1 -1
  210. package/dist/sdk/segment/types/journey-def.js +1 -1
  211. package/dist/sdk/segment/types/journey-schema.js +1 -1
  212. package/dist/sdk/segment/types/segment-def.js +1 -1
  213. package/dist/sdk/segment/types/segment-schema.d.ts.map +1 -1
  214. package/dist/sdk/segment/types/segment-schema.js +1 -1
  215. package/dist/sdk/segment/types/segment-schema.js.map +1 -1
  216. package/dist/sdk/segment/validate-files.js +1 -1
  217. package/dist/sdk/segment/yaml-validator.js +1 -1
  218. package/dist/sdk/segment.js +1 -1
  219. package/dist/sdk/types/index.d.ts +2 -1
  220. package/dist/sdk/types/index.d.ts.map +1 -1
  221. package/dist/sdk/types/index.js +1 -1
  222. package/dist/sdk/types/index.js.map +1 -1
  223. package/dist/sdk/types/p13n-studio.d.ts +18 -0
  224. package/dist/sdk/types/p13n-studio.d.ts.map +1 -0
  225. package/dist/sdk/types/p13n-studio.js +1 -0
  226. package/dist/sdk/types/p13n-studio.js.map +1 -0
  227. package/dist/sdk/types/progress.js +1 -1
  228. package/dist/sdk/types/workspace.js +1 -1
  229. package/dist/sdk/user.js +1 -1
  230. package/dist/sdk/util/format-detector.js +1 -1
  231. package/dist/sdk/util/formatters.js +1 -1
  232. package/dist/sdk/util/index.js +1 -1
  233. package/dist/sdk/util/paginate.js +1 -1
  234. package/dist/sdk/util/tree-formatter.js +1 -1
  235. package/dist/sdk/util/tree-search.js +1 -1
  236. package/dist/sdk/workflow/archive-validation.js +1 -1
  237. package/dist/sdk/workflow/clone-workflow.js +1 -1
  238. package/dist/sdk/workflow/index.js +1 -1
  239. package/dist/sdk/workflow/pull-workflow.js +1 -1
  240. package/dist/sdk/workflow/push-workflow.js +1 -1
  241. package/dist/sdk/workflow/task-graph.js +1 -1
  242. package/dist/sdk/workflow/tdx-config.js +1 -1
  243. package/dist/sdk/workflow/workflow-utils.js +1 -1
  244. package/dist/sdk/workspace/access-tracker.js +1 -1
  245. package/dist/sdk/workspace/frontmatter.js +1 -1
  246. package/dist/sdk/workspace/git.js +1 -1
  247. package/dist/sdk/workspace/index.js +1 -1
  248. package/dist/sdk/workspace/templates.js +1 -1
  249. package/dist/sdk/workspace/weekly.js +1 -1
  250. package/dist/sdk/workspace/wikilinks.js +1 -1
  251. package/dist/test-utils/command-runner.js +1 -1
  252. package/dist/test-utils/factories.js +1 -1
  253. package/dist/test-utils/fixtures.js +1 -1
  254. package/dist/test-utils/http-mock.js +1 -1
  255. package/dist/test-utils/index.js +1 -1
  256. package/dist/utils/async.js +1 -1
  257. package/dist/utils/claude-code-state.js +1 -1
  258. package/dist/utils/colors.js +1 -1
  259. package/dist/utils/diff.js +1 -1
  260. package/dist/utils/file-permissions.js +1 -1
  261. package/dist/utils/file-reader.js +1 -1
  262. package/dist/utils/github-releases.js +1 -1
  263. package/dist/utils/global-cache.js +1 -1
  264. package/dist/utils/json-loader.js +1 -1
  265. package/dist/utils/local-cache.js +1 -1
  266. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  267. package/dist/utils/logger/formatters/index.js +1 -1
  268. package/dist/utils/logger/handlers/console-handler.js +1 -1
  269. package/dist/utils/logger/handlers/file-handler.js +1 -1
  270. package/dist/utils/logger/handlers/index.js +1 -1
  271. package/dist/utils/logger/handlers/null-handler.js +1 -1
  272. package/dist/utils/logger/index.js +1 -1
  273. package/dist/utils/logger/logger.js +1 -1
  274. package/dist/utils/logger/types.js +1 -1
  275. package/dist/utils/option-validation.js +1 -1
  276. package/dist/utils/process.js +1 -1
  277. package/dist/utils/prompt.js +1 -1
  278. package/dist/utils/proxy-fetch.js +1 -1
  279. package/dist/utils/spinner.js +1 -1
  280. package/dist/utils/sse-parser.js +1 -1
  281. package/dist/utils/string-utils.js +1 -1
  282. package/dist/utils/table-ref-parser.js +1 -1
  283. package/dist/utils/tdx-logger.js +1 -1
  284. package/dist/utils/version-check.js +1 -1
  285. package/package.json +1 -1
@@ -1 +1 @@
1
- const a43_0x370d5b=a43_0x3ce9;(function(_0x1cc474,_0x3021b9){const _0x33d6b0=a43_0x3ce9,_0x52ecc6=_0x1cc474();while(!![]){try{const _0x26b073=-parseInt(_0x33d6b0(0x106))/0x1*(parseInt(_0x33d6b0(0xf5))/0x2)+parseInt(_0x33d6b0(0x135))/0x3*(-parseInt(_0x33d6b0(0x127))/0x4)+-parseInt(_0x33d6b0(0x11a))/0x5+parseInt(_0x33d6b0(0x11c))/0x6+-parseInt(_0x33d6b0(0x119))/0x7*(-parseInt(_0x33d6b0(0xf9))/0x8)+-parseInt(_0x33d6b0(0x11e))/0x9+parseInt(_0x33d6b0(0xf7))/0xa*(parseInt(_0x33d6b0(0x12e))/0xb);if(_0x26b073===_0x3021b9)break;else _0x52ecc6['push'](_0x52ecc6['shift']());}catch(_0x41758f){_0x52ecc6['push'](_0x52ecc6['shift']());}}}(a43_0x820f,0xc3d02));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_0x3ce9(_0x597edd,_0x478840){_0x597edd=_0x597edd-0xf2;const _0x820f80=a43_0x820f();let _0x3ce951=_0x820f80[_0x597edd];return _0x3ce951;}import{searchTreeByName}from'../sdk/util/tree-search.js';import a43_0xd6fc9c from'chalk';export class SegmentMoveCommand extends BaseCommand{[a43_0x370d5b(0x137)]=a43_0x370d5b(0xfd);[a43_0x370d5b(0xfa)]=a43_0x370d5b(0xff);async[a43_0x370d5b(0x110)](_0xc10053){const _0x17822b=a43_0x370d5b,{options:_0xa9ea7a,args:_0x1bd874,tdx:_0x3cc8f6}=_0xc10053,_0x59b139=_0x1bd874,_0x34a429=_0xa9ea7a[_0x17822b(0x108)];if(_0x59b139[_0x17822b(0x134)]===0x0||!_0x34a429)return console[_0x17822b(0x113)](a43_0xd6fc9c[_0x17822b(0x11b)]('Error:\x20at\x20least\x20one\x20<segment>\x20and\x20--folder\x20<folder>\x20are\x20required\x0a')),console[_0x17822b(0x113)](_0x17822b(0x11d)),console[_0x17822b(0x113)](_0x17822b(0x121)),console[_0x17822b(0x113)](_0x17822b(0x104)),console['error'](_0x17822b(0x145)),console['error'](_0x17822b(0x136)),console[_0x17822b(0x113)](_0x17822b(0x140)),0x1;_0xa9ea7a[_0x17822b(0xfc)]&&(console[_0x17822b(0x113)](_0x17822b(0xf2)+_0x59b139[_0x17822b(0x10c)](',\x20')),console[_0x17822b(0x113)](_0x17822b(0x141)+_0x34a429));const _0x2b2506=[...new Set(_0x59b139)];_0x2b2506[_0x17822b(0x134)]<_0x59b139[_0x17822b(0x134)]&&console[_0x17822b(0x113)](a43_0xd6fc9c[_0x17822b(0x13b)](_0x17822b(0x103)+_0x59b139[_0x17822b(0x134)]+'\x20→\x20'+_0x2b2506[_0x17822b(0x134)]+').'));const _0x381d9e=/^\d+$/,_0x34ff44=_0xa9ea7a['parentSegment'],_0x1e47e7=[..._0x2b2506,_0x34a429][_0x17822b(0x102)](_0x55a247=>!_0x381d9e['test'](_0x55a247));if(_0x1e47e7&&!_0x34ff44)return console[_0x17822b(0x113)](a43_0xd6fc9c['red'](_0x17822b(0x139))),console['error'](_0x17822b(0x13c)),console[_0x17822b(0x113)](_0x17822b(0x105)),console[_0x17822b(0x113)](_0x17822b(0x10a)),0x1;const _0xeff7b4=_0x2b2506['length'],_0x4b73d4=_0xa9ea7a['dryRun']===!![];let _0x49765f;try{const _0x89e801=await withSpinner((_0x4b73d4?_0x17822b(0x117):_0x17822b(0x112))+'\x20'+_0xeff7b4+_0x17822b(0x126)+(_0xeff7b4===0x1?'':'s')+'\x20'+((_0x4b73d4?_0x17822b(0x129):'to')+_0x17822b(0x142)+_0x34a429+'\x27...'),async()=>{const _0x3e4846=_0x17822b,_0x27cc72=[];_0x2b2506[_0x3e4846(0x12b)]((_0x2f6131,_0x5b8f81)=>{const _0x498421=_0x3e4846;if(!_0x381d9e[_0x498421(0x148)](_0x2f6131))_0x27cc72[_0x498421(0x133)]({'name':_0x2f6131,'expectType':'segment','slot':_0x5b8f81});});if(!_0x381d9e['test'](_0x34a429))_0x27cc72[_0x3e4846(0x133)]({'name':_0x34a429,'expectType':_0x3e4846(0x108),'slot':-0x1});const _0x51c524=new Map();if(_0x27cc72[_0x3e4846(0x134)]>0x0){const _0x449d12=await _0x3cc8f6['segment'][_0x3e4846(0x13a)](_0x34ff44,_0x27cc72['map'](({name:_0x2d4127,expectType:_0x45228b})=>({'name':_0x2d4127,'expectType':_0x45228b})));_0x449d12['forEach']((_0x117000,_0x11f712)=>_0x51c524[_0x3e4846(0x11f)](_0x27cc72[_0x11f712][_0x3e4846(0x12d)],_0x117000['id']));}const _0x3f587e=_0x2b2506['map']((_0x5c7139,_0x4fe206)=>_0x381d9e[_0x3e4846(0x148)](_0x5c7139)?_0x5c7139:_0x51c524[_0x3e4846(0x12a)](_0x4fe206)),_0x3b9e36=_0x381d9e['test'](_0x34a429)?_0x34a429:_0x51c524[_0x3e4846(0x12a)](-0x1);return _0x3cc8f6[_0x3e4846(0x10b)][_0x3e4846(0x109)](_0x3f587e,_0x3b9e36,_0x4b73d4);},{'verbose':_0xa9ea7a[_0x17822b(0xfc)]});_0x49765f=_0x89e801['data'];}catch(_0x4962b0){if(_0x4962b0 instanceof SDKError&&_0x4962b0[_0x17822b(0x147)]===ErrorCode[_0x17822b(0x120)]&&_0x34ff44)try{if(await this['explainAmbiguousName'](_0x3cc8f6,_0x34ff44,_0x2b2506,_0xa9ea7a))return 0x1;}catch{}throw _0x4962b0;}for(const _0x1f81b9 of _0x49765f){const _0x21edd9=_0x1f81b9[_0x17822b(0x138)],_0x357718=_0x17822b(0x115)+(_0x4b73d4?_0x17822b(0x125):_0x17822b(0x13d))+'\x20'+_0x21edd9+_0x17822b(0x143)+(_0x21edd9===0x1?'':'s');console['error'](_0x4b73d4?a43_0xd6fc9c[_0x17822b(0xfe)]('•\x20[dry-run]\x20Would\x20move\x20segment\x20\x27'+_0x1f81b9['id']+'\x27\x20to\x20folder\x20\x27'+_0x1f81b9[_0x17822b(0x116)]+'\x27\x20—\x20'+_0x357718):a43_0xd6fc9c['green'](_0x17822b(0x144)+_0x1f81b9['id']+_0x17822b(0x130)+_0x1f81b9[_0x17822b(0x116)]+_0x17822b(0x10d)+_0x357718+_0x17822b(0x10f)));}if(_0x4b73d4)console['error'](a43_0xd6fc9c['cyan'](_0x17822b(0x111)+_0xeff7b4+_0x17822b(0xf3)));else _0x49765f[_0x17822b(0x134)]>0x1&&console['error'](a43_0xd6fc9c[_0x17822b(0x123)]('✔\x20'+_0x49765f[_0x17822b(0x134)]+_0x17822b(0x122)));return await handleSDKOutput(_0x49765f,_0xa9ea7a),0x0;}async[a43_0x370d5b(0x149)](_0x3003e2,_0xa39177,_0x2c6bec,_0x50b566){const _0x1c4187=a43_0x370d5b,_0x3cdc78=_0x2c6bec[_0x1c4187(0x131)](_0xe94b6=>!/^\d+$/['test'](_0xe94b6)&&!_0xe94b6[_0x1c4187(0x118)]('/'));if(_0x3cdc78[_0x1c4187(0x134)]===0x0)return![];const _0x54a984=await withSpinner(_0x1c4187(0x101)+_0x3cdc78[_0x1c4187(0x10c)](_0x1c4187(0x124))+_0x1c4187(0xfb),()=>_0x3003e2[_0x1c4187(0x10b)][_0x1c4187(0x132)](_0xa39177),{'verbose':_0x50b566['verbose']}),_0x2c6cec=(await withSpinner(_0x1c4187(0x114),()=>_0x3003e2['segment'][_0x1c4187(0x100)](_0x54a984[_0x1c4187(0x12c)][_0x1c4187(0x107)],_0x54a984[_0x1c4187(0x12c)][_0x1c4187(0x10e)],0x0,0xa),{'verbose':_0x50b566[_0x1c4187(0xfc)]}))[_0x1c4187(0x12c)];let _0x580283=![];for(const _0x492ac9 of _0x3cdc78){const _0x208902=searchTreeByName(_0x2c6cec,_0x492ac9)[_0x1c4187(0x131)](_0x26d3dd=>_0x26d3dd[_0x1c4187(0x128)]===_0x1c4187(0x10b)&&_0x26d3dd[_0x1c4187(0x137)][_0x1c4187(0x12f)]()===_0x492ac9['toLowerCase']());if(_0x208902[_0x1c4187(0x134)]>0x1){_0x580283=!![],console[_0x1c4187(0x113)](a43_0xd6fc9c[_0x1c4187(0x11b)]('Error:\x20\x27'+_0x492ac9+_0x1c4187(0x13e)+_0x208902[_0x1c4187(0x134)]+'\x20segments\x20—\x20refusing\x20to\x20guess.\x20Pass\x20the\x20full\x20path\x20(or\x20id)\x20of\x20the\x20one\x20you\x20mean:'));for(const _0x178e23 of _0x208902)console[_0x1c4187(0x113)](_0x1c4187(0xf4)+_0x178e23[_0x1c4187(0xf6)]+_0x1c4187(0x13f)+_0x178e23['id']+')');}else _0x208902[_0x1c4187(0x134)]===0x1&&(_0x580283=!![],console[_0x1c4187(0x113)](a43_0xd6fc9c['red'](_0x1c4187(0x146)+_0x492ac9+'\x27\x20isn\x27t\x20at\x20the\x20top\x20level\x20—\x20it\x27s\x20nested\x20at:')),console[_0x1c4187(0x113)]('\x20\x20'+_0x208902[0x0]['path']+_0x1c4187(0x13f)+_0x208902[0x0]['id']+')'),console[_0x1c4187(0x113)](_0x1c4187(0xf8)));}return _0x580283;}}function a43_0x820f(){const _0x462a3f=['type','for\x20move\x20to','get','forEach','data','slot','11qnyvpy','toLowerCase','\x27\x20to\x20folder\x20\x27','filter','resolvePathToResource','push','length','2026950KvIkeK','\x20\x20tdx\x20segment\x20move\x20\x22VIP\x20Customers\x22\x20--folder\x20\x22Archive\x22\x20\x20\x20#\x20by\x20name\x20(needs\x20parent\x20context)','name','ruleConditionCount','Error:\x20no\x20parent\x20segment\x20context\x20—\x20moving\x20by\x20name\x20needs\x20one.\x0a','resolveEntitiesInParent','yellow','Set\x20context:\x20\x20\x20tdx\x20use\x20parent_segment\x20\x22<name>\x22','preserved:','\x27\x20matches\x20','\x20\x20(id\x20','\x0aTip:\x20run\x20`tdx\x20segment\x20list\x20-r`\x20to\x20find\x20segment\x20and\x20folder\x20names/IDs.','Target\x20folder:\x20','\x20folder\x20\x27','\x20condition','✔\x20Moved\x20segment\x20\x27','\x20\x20tdx\x20segment\x20move\x201603887\x201603888\x201603889\x20--folder\x208299501','Error:\x20\x27','code','test','explainAmbiguousName','Segments:\x20','\x20segment(s)\x20would\x20be\x20moved.','\x20\x20•\x20','13724zmxloa','path','21397270fepXmV','Re-run\x20`tdx\x20sg\x20move`\x20with\x20that\x20full\x20path\x20(or\x20the\x20id).','561856gTRnRP','description','\x27...','verbose','segment:move','cyan','Move\x20one\x20or\x20more\x20segments\x20to\x20a\x20different\x20folder','listRecursive','Searching\x20folders\x20for\x20\x27','some','Duplicate\x20segments\x20removed\x20(','\x20\x20tdx\x20segment\x20move\x201603887\x20--folder\x208299501','Or\x20pass\x20flag:\x20\x20--parent-segment\x20\x22<name>\x22','104xhDmbk','parentId','folder','moveSegments','Or\x20use\x20IDs:\x20\x20\x20\x20tdx\x20sg\x20list\x20-r\x20--json\x20\x20(then\x20pass\x20the\x20numeric\x20ids)','segment','join','\x27\x20—\x20','folderId','\x20(verified\x20by\x20re-read)','execute','[dry-run]\x20No\x20changes\x20made.\x20','Moving','error','Searching\x20the\x20tree...','rule\x20','segmentFolderId','Checking','includes','56nWcwEj','980140ILirJb','red','3479868UnUSQI','Usage:\x20tdx\x20segment\x20move\x20<segment...>\x20--folder\x20<folder>','8047665rYUNNU','set','SEGMENT_NOT_FOUND','Examples:','\x20segments\x20moved,\x20all\x20rules\x20verified\x20intact','green','\x27,\x20\x27','has','\x20segment','4QGKvtf'];a43_0x820f=function(){return _0x462a3f;};return a43_0x820f();}
1
+ const a44_0xb2ff94=a44_0x19ca;(function(_0x5c3659,_0x43dac5){const _0x1b7dd9=a44_0x19ca,_0x503760=_0x5c3659();while(!![]){try{const _0x3b8767=parseInt(_0x1b7dd9(0x11e))/0x1+parseInt(_0x1b7dd9(0x159))/0x2*(parseInt(_0x1b7dd9(0x131))/0x3)+parseInt(_0x1b7dd9(0x121))/0x4+parseInt(_0x1b7dd9(0x132))/0x5+-parseInt(_0x1b7dd9(0x145))/0x6*(parseInt(_0x1b7dd9(0x144))/0x7)+parseInt(_0x1b7dd9(0x14c))/0x8*(-parseInt(_0x1b7dd9(0x151))/0x9)+parseInt(_0x1b7dd9(0x157))/0xa*(parseInt(_0x1b7dd9(0x114))/0xb);if(_0x3b8767===_0x43dac5)break;else _0x503760['push'](_0x503760['shift']());}catch(_0x1f6f0e){_0x503760['push'](_0x503760['shift']());}}}(a44_0x22db,0xbe48d));function a44_0x19ca(_0x26e062,_0x4230d6){_0x26e062=_0x26e062-0x114;const _0x22db5d=a44_0x22db();let _0x19cab8=_0x22db5d[_0x26e062];return _0x19cab8;}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a44_0x22db(){const _0x2e2435=['parentId','1959mOEAXQ','4708155LsCwZx','execute','Target\x20folder:\x20','SEGMENT_NOT_FOUND','Or\x20use\x20IDs:\x20\x20\x20\x20tdx\x20sg\x20list\x20-r\x20--json\x20\x20(then\x20pass\x20the\x20numeric\x20ids)','segmentFolderId','forEach','length','Checking','folderId','data','push','ruleConditionCount','slot','includes','Error:\x20no\x20parent\x20segment\x20context\x20—\x20moving\x20by\x20name\x20needs\x20one.\x0a','[dry-run]\x20No\x20changes\x20made.\x20','path','3395CVCLKA','16644rwvDJX','resolveEntitiesInParent','\x27...','get','\x20\x20tdx\x20segment\x20move\x20\x22VIP\x20Customers\x22\x20--folder\x20\x22Archive\x22\x20\x20\x20#\x20by\x20name\x20(needs\x20parent\x20context)','\x20→\x20','yellow','7175376XTEfxK','✔\x20Moved\x20segment\x20\x27','Segments:\x20','Set\x20context:\x20\x20\x20tdx\x20use\x20parent_segment\x20\x22<name>\x22','folder','9JJZdSz','Error:\x20\x27','dryRun','cyan','join','Or\x20pass\x20flag:\x20\x20--parent-segment\x20\x22<name>\x22','20LqErPd','type','514EDRqYw','\x27\x20to\x20folder\x20\x27','Usage:\x20tdx\x20segment\x20move\x20<segment...>\x20--folder\x20<folder>','map','•\x20[dry-run]\x20Would\x20move\x20segment\x20\x27','segment:move','test','error','\x20\x20(id\x20','5295939jnMxKn','has','rule\x20','red','segment','moveSegments','preserved:','parentSegment','Duplicate\x20segments\x20removed\x20(','verbose','305230KXcjAc','for\x20move\x20to','\x27\x20—\x20','2576548lFiAEF','\x20condition','description','\x27\x20isn\x27t\x20at\x20the\x20top\x20level\x20—\x20it\x27s\x20nested\x20at:','Searching\x20the\x20tree...','Move\x20one\x20or\x20more\x20segments\x20to\x20a\x20different\x20folder','Searching\x20folders\x20for\x20\x27','\x0aTip:\x20run\x20`tdx\x20segment\x20list\x20-r`\x20to\x20find\x20segment\x20and\x20folder\x20names/IDs.','green','Error:\x20at\x20least\x20one\x20<segment>\x20and\x20--folder\x20<folder>\x20are\x20required\x0a','\x20(verified\x20by\x20re-read)','\x20\x20tdx\x20segment\x20move\x201603887\x20--folder\x208299501','toLowerCase','explainAmbiguousName','name'];a44_0x22db=function(){return _0x2e2435;};return a44_0x22db();}import{SDKError,ErrorCode}from'../sdk/index.js';import{searchTreeByName}from'../sdk/util/tree-search.js';import a44_0x582f2e from'chalk';export class SegmentMoveCommand extends BaseCommand{['name']=a44_0xb2ff94(0x15e);[a44_0xb2ff94(0x123)]=a44_0xb2ff94(0x126);async[a44_0xb2ff94(0x133)](_0x3e0b1e){const _0x2e3945=a44_0xb2ff94,{options:_0x201602,args:_0x530db0,tdx:_0x4e58e0}=_0x3e0b1e,_0x4b3424=_0x530db0,_0x49e2ea=_0x201602[_0x2e3945(0x150)];if(_0x4b3424['length']===0x0||!_0x49e2ea)return console[_0x2e3945(0x160)](a44_0x582f2e[_0x2e3945(0x117)](_0x2e3945(0x12a))),console[_0x2e3945(0x160)](_0x2e3945(0x15b)),console[_0x2e3945(0x160)]('Examples:'),console[_0x2e3945(0x160)](_0x2e3945(0x12c)),console[_0x2e3945(0x160)]('\x20\x20tdx\x20segment\x20move\x201603887\x201603888\x201603889\x20--folder\x208299501'),console[_0x2e3945(0x160)](_0x2e3945(0x149)),console[_0x2e3945(0x160)](_0x2e3945(0x128)),0x1;_0x201602[_0x2e3945(0x11d)]&&(console[_0x2e3945(0x160)](_0x2e3945(0x14e)+_0x4b3424[_0x2e3945(0x155)](',\x20')),console[_0x2e3945(0x160)](_0x2e3945(0x134)+_0x49e2ea));const _0x47b02a=[...new Set(_0x4b3424)];_0x47b02a[_0x2e3945(0x139)]<_0x4b3424[_0x2e3945(0x139)]&&console[_0x2e3945(0x160)](a44_0x582f2e[_0x2e3945(0x14b)](_0x2e3945(0x11c)+_0x4b3424['length']+_0x2e3945(0x14a)+_0x47b02a['length']+').'));const _0x25bee8=/^\d+$/,_0x50c35c=_0x201602[_0x2e3945(0x11b)],_0x57ffe6=[..._0x47b02a,_0x49e2ea]['some'](_0x540d9e=>!_0x25bee8['test'](_0x540d9e));if(_0x57ffe6&&!_0x50c35c)return console[_0x2e3945(0x160)](a44_0x582f2e['red'](_0x2e3945(0x141))),console[_0x2e3945(0x160)](_0x2e3945(0x14f)),console['error'](_0x2e3945(0x156)),console[_0x2e3945(0x160)](_0x2e3945(0x136)),0x1;const _0x478d09=_0x47b02a[_0x2e3945(0x139)],_0x1a67f2=_0x201602[_0x2e3945(0x153)]===!![];let _0x5e157d;try{const _0x5e0e81=await withSpinner((_0x1a67f2?_0x2e3945(0x13a):'Moving')+'\x20'+_0x478d09+'\x20segment'+(_0x478d09===0x1?'':'s')+'\x20'+((_0x1a67f2?_0x2e3945(0x11f):'to')+'\x20folder\x20\x27'+_0x49e2ea+_0x2e3945(0x147)),async()=>{const _0xde4b51=_0x2e3945,_0x1bbd6b=[];_0x47b02a[_0xde4b51(0x138)]((_0x7da963,_0x1b32df)=>{const _0x4c9eb9=_0xde4b51;if(!_0x25bee8[_0x4c9eb9(0x15f)](_0x7da963))_0x1bbd6b[_0x4c9eb9(0x13d)]({'name':_0x7da963,'expectType':_0x4c9eb9(0x118),'slot':_0x1b32df});});if(!_0x25bee8[_0xde4b51(0x15f)](_0x49e2ea))_0x1bbd6b['push']({'name':_0x49e2ea,'expectType':'folder','slot':-0x1});const _0x419bb6=new Map();if(_0x1bbd6b['length']>0x0){const _0x146596=await _0x4e58e0['segment'][_0xde4b51(0x146)](_0x50c35c,_0x1bbd6b[_0xde4b51(0x15c)](({name:_0x5d3bd,expectType:_0x53ae51})=>({'name':_0x5d3bd,'expectType':_0x53ae51})));_0x146596['forEach']((_0x4db4ca,_0x1b29c0)=>_0x419bb6['set'](_0x1bbd6b[_0x1b29c0][_0xde4b51(0x13f)],_0x4db4ca['id']));}const _0x1f268f=_0x47b02a[_0xde4b51(0x15c)]((_0x2fba89,_0x2195b1)=>_0x25bee8[_0xde4b51(0x15f)](_0x2fba89)?_0x2fba89:_0x419bb6[_0xde4b51(0x148)](_0x2195b1)),_0x1f7fb3=_0x25bee8['test'](_0x49e2ea)?_0x49e2ea:_0x419bb6[_0xde4b51(0x148)](-0x1);return _0x4e58e0[_0xde4b51(0x118)][_0xde4b51(0x119)](_0x1f268f,_0x1f7fb3,_0x1a67f2);},{'verbose':_0x201602[_0x2e3945(0x11d)]});_0x5e157d=_0x5e0e81[_0x2e3945(0x13c)];}catch(_0x5eda87){if(_0x5eda87 instanceof SDKError&&_0x5eda87['code']===ErrorCode[_0x2e3945(0x135)]&&_0x50c35c)try{if(await this[_0x2e3945(0x12e)](_0x4e58e0,_0x50c35c,_0x47b02a,_0x201602))return 0x1;}catch{}throw _0x5eda87;}for(const _0x2ef47d of _0x5e157d){const _0x33d64e=_0x2ef47d[_0x2e3945(0x13e)],_0x50b511=_0x2e3945(0x116)+(_0x1a67f2?_0x2e3945(0x115):_0x2e3945(0x11a))+'\x20'+_0x33d64e+_0x2e3945(0x122)+(_0x33d64e===0x1?'':'s');console[_0x2e3945(0x160)](_0x1a67f2?a44_0x582f2e[_0x2e3945(0x154)](_0x2e3945(0x15d)+_0x2ef47d['id']+_0x2e3945(0x15a)+_0x2ef47d[_0x2e3945(0x137)]+_0x2e3945(0x120)+_0x50b511):a44_0x582f2e[_0x2e3945(0x129)](_0x2e3945(0x14d)+_0x2ef47d['id']+'\x27\x20to\x20folder\x20\x27'+_0x2ef47d[_0x2e3945(0x137)]+_0x2e3945(0x120)+_0x50b511+_0x2e3945(0x12b)));}if(_0x1a67f2)console[_0x2e3945(0x160)](a44_0x582f2e[_0x2e3945(0x154)](_0x2e3945(0x142)+_0x478d09+'\x20segment(s)\x20would\x20be\x20moved.'));else _0x5e157d[_0x2e3945(0x139)]>0x1&&console[_0x2e3945(0x160)](a44_0x582f2e[_0x2e3945(0x129)]('✔\x20'+_0x5e157d[_0x2e3945(0x139)]+'\x20segments\x20moved,\x20all\x20rules\x20verified\x20intact'));return await handleSDKOutput(_0x5e157d,_0x201602),0x0;}async['explainAmbiguousName'](_0x1fe52f,_0x2d8559,_0x5dec3e,_0x27dca4){const _0x2ec1b6=a44_0xb2ff94,_0x91eb00=_0x5dec3e['filter'](_0x4149ba=>!/^\d+$/[_0x2ec1b6(0x15f)](_0x4149ba)&&!_0x4149ba[_0x2ec1b6(0x140)]('/'));if(_0x91eb00[_0x2ec1b6(0x139)]===0x0)return![];const _0x302203=await withSpinner(_0x2ec1b6(0x127)+_0x91eb00[_0x2ec1b6(0x155)]('\x27,\x20\x27')+'\x27...',()=>_0x1fe52f['segment']['resolvePathToResource'](_0x2d8559),{'verbose':_0x27dca4[_0x2ec1b6(0x11d)]}),_0x5af473=(await withSpinner(_0x2ec1b6(0x125),()=>_0x1fe52f[_0x2ec1b6(0x118)]['listRecursive'](_0x302203[_0x2ec1b6(0x13c)][_0x2ec1b6(0x130)],_0x302203[_0x2ec1b6(0x13c)][_0x2ec1b6(0x13b)],0x0,0xa),{'verbose':_0x27dca4[_0x2ec1b6(0x11d)]}))[_0x2ec1b6(0x13c)];let _0x8f809b=![];for(const _0x40ceaf of _0x91eb00){const _0x15a424=searchTreeByName(_0x5af473,_0x40ceaf)['filter'](_0x31cd17=>_0x31cd17[_0x2ec1b6(0x158)]==='segment'&&_0x31cd17[_0x2ec1b6(0x12f)][_0x2ec1b6(0x12d)]()===_0x40ceaf[_0x2ec1b6(0x12d)]());if(_0x15a424[_0x2ec1b6(0x139)]>0x1){_0x8f809b=!![],console[_0x2ec1b6(0x160)](a44_0x582f2e[_0x2ec1b6(0x117)](_0x2ec1b6(0x152)+_0x40ceaf+'\x27\x20matches\x20'+_0x15a424[_0x2ec1b6(0x139)]+'\x20segments\x20—\x20refusing\x20to\x20guess.\x20Pass\x20the\x20full\x20path\x20(or\x20id)\x20of\x20the\x20one\x20you\x20mean:'));for(const _0x12d3db of _0x15a424)console[_0x2ec1b6(0x160)]('\x20\x20•\x20'+_0x12d3db[_0x2ec1b6(0x143)]+_0x2ec1b6(0x161)+_0x12d3db['id']+')');}else _0x15a424['length']===0x1&&(_0x8f809b=!![],console[_0x2ec1b6(0x160)](a44_0x582f2e[_0x2ec1b6(0x117)]('Error:\x20\x27'+_0x40ceaf+_0x2ec1b6(0x124))),console[_0x2ec1b6(0x160)]('\x20\x20'+_0x15a424[0x0]['path']+'\x20\x20(id\x20'+_0x15a424[0x0]['id']+')'),console['error']('Re-run\x20`tdx\x20sg\x20move`\x20with\x20that\x20full\x20path\x20(or\x20the\x20id).'));}return _0x8f809b;}}
@@ -1 +1 @@
1
- const a44_0x54884c=a44_0x2f62;(function(_0x29c260,_0x15f2c8){const _0xa9b764=a44_0x2f62,_0x36ea04=_0x29c260();while(!![]){try{const _0x2aedf6=-parseInt(_0xa9b764(0x1c7))/0x1*(parseInt(_0xa9b764(0x209))/0x2)+parseInt(_0xa9b764(0x1f9))/0x3*(parseInt(_0xa9b764(0x1fa))/0x4)+parseInt(_0xa9b764(0x207))/0x5*(parseInt(_0xa9b764(0x1c9))/0x6)+-parseInt(_0xa9b764(0x1f4))/0x7+parseInt(_0xa9b764(0x1f0))/0x8+-parseInt(_0xa9b764(0x202))/0x9*(parseInt(_0xa9b764(0x1ff))/0xa)+-parseInt(_0xa9b764(0x1be))/0xb;if(_0x2aedf6===_0x15f2c8)break;else _0x36ea04['push'](_0x36ea04['shift']());}catch(_0x1ae15c){_0x36ea04['push'](_0x36ea04['shift']());}}}(a44_0xf33c,0x1b09c));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_0xe1d4a6 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a44_0x38fb89 from'path';function a44_0xf33c(){const _0x20d90b=['3lxGbKA','length','6mJWrGl','-\x20no\x20files\x20written','site','description','\x20segments','\x20versions)','hasChanges','✔\x20All\x20files\x20are\x20up\x20to\x20date','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','\x20unchanged\x20files','\x20with\x20','helpText','green','setPhase','\x20\x20Target:\x20','data','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)','cyan','journeys','parent_segment','utf-8','red','\x20=\x20','resourceName','counts','Target\x20resource:\x20','segments','error','segment','verbose','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','diff','Error:\x20','filter','\x20new\x20files','pullSegments','yellow','✔\x20Context\x20set:\x20','content','307176YBwkqm','session','cwd','isNew','1262800EIGfyU','repeat','✔\x20Pulled\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','journeyVersions','1842CzVnVf','1268efZoYM','parentSegment','\x20activations','yes','files','280hbtnQd','Write\x20','segment:pull','5409AMNlsx','dryRun','activations','Parent\x20segment:\x20','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','653935PRrTJl','relativePath','25034IHPlCq','dirname','\x20\x20🗺️\x20\x20','201245tjguWY','file','parentName','targetDir','\x0aError:','Pulling\x20segments\x20from\x20\x27','absolutePath','type','dim'];a44_0xf33c=function(){return _0x20d90b;};return a44_0xf33c();}import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';function a44_0x2f62(_0x418699,_0x2d090b){_0x418699=_0x418699-0x1bc;const _0xf33c0=a44_0xf33c();let _0x2f6234=_0xf33c0[_0x418699];return _0x2f6234;}export class SegmentPullCommand extends BaseCommand{['name']=a44_0x54884c(0x201);[a44_0x54884c(0x1cc)]=a44_0x54884c(0x206);async['execute'](_0x34a907){const _0x30137f=a44_0x54884c,{options:_0x35a229,args:_0xec4755,tdx:_0x5c4185}=_0x34a907,_0x39bc87=_0x35a229,_0x188a23=await resolveTarget({'arg':_0xec4755[0x0],'contextParent':_0x35a229[_0x30137f(0x1fb)],'cwd':process[_0x30137f(0x1f2)]()});if(!isSuccessfulResolution(_0x188a23))return _0x188a23['errorCode']==='no_parent'?(console[_0x30137f(0x1e4)](a44_0xe1d4a6[_0x30137f(0x1ed)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console['error'](_0x30137f(0x1d9)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'),console[_0x30137f(0x1e4)](_0x30137f(0x1d1))):(console['error'](a44_0xe1d4a6['red'](_0x30137f(0x1e9)+_0x188a23['message']+'\x0a')),_0x188a23[_0x30137f(0x1d4)]&&console[_0x30137f(0x1e4)](a44_0xe1d4a6[_0x30137f(0x1da)](_0x188a23[_0x30137f(0x1d4)]))),0x1;const _0x4de3e2=_0x188a23[_0x30137f(0x1c0)],_0x2a816f=_0x188a23['targetDir'],_0x468fab=_0x188a23[_0x30137f(0x1c5)]===_0x30137f(0x1bf)?_0x188a23[_0x30137f(0x1e0)]:undefined;_0x39bc87[_0x30137f(0x1e6)]&&(console[_0x30137f(0x1e4)]('Site:\x20'+_0x39bc87[_0x30137f(0x1cb)]),console[_0x30137f(0x1e4)](_0x30137f(0x205)+_0x4de3e2),_0x468fab&&console['error'](_0x30137f(0x1e2)+_0x468fab));const _0x787ef0=await withProgressSpinner(_0x30137f(0x1c3)+_0x4de3e2+'\x27...',_0x26aca4=>_0x5c4185[_0x30137f(0x1e5)][_0x30137f(0x1ec)](_0x4de3e2,{'targetDir':_0x2a816f,'targetResourceName':_0x468fab,'verbose':_0x39bc87[_0x30137f(0x1e6)],'progress':{'update':_0xf0e822=>{const _0x1aa80d=_0x30137f;_0x26aca4[_0x1aa80d(0x1d6)](_0xf0e822),_0x39bc87[_0x1aa80d(0x1e6)]&&console[_0x1aa80d(0x1e4)]('\x20\x20'+_0xf0e822);}}}),{'verbose':_0x39bc87['verbose']}),_0x3dc5f0=_0x787ef0[_0x30137f(0x1d8)];if(_0x3dc5f0[_0x30137f(0x1e1)][_0x30137f(0x1e3)]===0x0&&_0x3dc5f0[_0x30137f(0x1e1)][_0x30137f(0x1db)]===0x0)return console[_0x30137f(0x1e4)](a44_0xe1d4a6[_0x30137f(0x1ed)]('No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27'+_0x3dc5f0[_0x30137f(0x1c0)]+'\x27')),0x0;const _0x40c45c=_0x3dc5f0[_0x30137f(0x1fe)][_0x30137f(0x1ea)](_0x3fe271=>_0x3fe271[_0x30137f(0x1f3)]),_0x2d6d4b=_0x3dc5f0['files'][_0x30137f(0x1ea)](_0x5d0baa=>!_0x5d0baa[_0x30137f(0x1f3)]&&_0x5d0baa[_0x30137f(0x1cf)]),_0xae33c7=_0x3dc5f0[_0x30137f(0x1fe)][_0x30137f(0x1ea)](_0x3d1567=>!_0x3d1567[_0x30137f(0x1f3)]&&!_0x3d1567[_0x30137f(0x1cf)]);console[_0x30137f(0x1e4)]('\x0aPull\x20summary\x20for\x20\x27'+_0x3dc5f0[_0x30137f(0x1c0)]+'\x27:'),console['error']('\x20\x20🎯\x20'+a44_0xe1d4a6[_0x30137f(0x1da)](_0x3dc5f0['counts'][_0x30137f(0x1e3)]+_0x30137f(0x1cd))+_0x30137f(0x1d3)+a44_0xe1d4a6['cyan'](_0x3dc5f0[_0x30137f(0x1e1)][_0x30137f(0x204)]+_0x30137f(0x1fc)));if(_0x3dc5f0[_0x30137f(0x1e1)]['journeys']>0x0){const _0x5c4eaa=_0x3dc5f0['counts']['journeyVersions']>_0x3dc5f0[_0x30137f(0x1e1)][_0x30137f(0x1db)]?'\x20('+_0x3dc5f0[_0x30137f(0x1e1)][_0x30137f(0x1f8)]+_0x30137f(0x1ce):'';console[_0x30137f(0x1e4)](_0x30137f(0x1bd)+a44_0xe1d4a6[_0x30137f(0x1da)](_0x3dc5f0['counts']['journeys']+'\x20journeys')+a44_0xe1d4a6[_0x30137f(0x1c6)](_0x5c4eaa));}console[_0x30137f(0x1e4)]('\x20\x20'+a44_0xe1d4a6['green']('+\x20'+_0x40c45c[_0x30137f(0x1c8)]+_0x30137f(0x1eb))),console[_0x30137f(0x1e4)]('\x20\x20'+a44_0xe1d4a6[_0x30137f(0x1ed)]('~\x20'+_0x2d6d4b[_0x30137f(0x1c8)]+'\x20changed\x20files')),console[_0x30137f(0x1e4)]('\x20\x20'+a44_0xe1d4a6[_0x30137f(0x1c6)]('=\x20'+_0xae33c7[_0x30137f(0x1c8)]+_0x30137f(0x1d2))),console['error'](_0x30137f(0x1d7)+a44_0xe1d4a6[_0x30137f(0x1da)](_0x3dc5f0['targetDir'])+'\x0a');if(_0x2d6d4b[_0x30137f(0x1c8)]>0x0)for(const _0x117d97 of _0x2d6d4b){console[_0x30137f(0x1e4)]('\x0aChanges\x20to\x20\x27'+_0x117d97[_0x30137f(0x208)]+'\x27:'),console[_0x30137f(0x1e4)]('─'['repeat'](0x3c)),console[_0x30137f(0x1e4)](_0x117d97[_0x30137f(0x1e8)]),console['error']('─'[_0x30137f(0x1f5)](0x3c));}if(_0x39bc87[_0x30137f(0x203)])return console[_0x30137f(0x1e4)](a44_0xe1d4a6['yellow'](_0x30137f(0x1e7))),0x0;if(_0x40c45c[_0x30137f(0x1c8)]===0x0&&_0x2d6d4b['length']===0x0)return console[_0x30137f(0x1e4)](a44_0xe1d4a6[_0x30137f(0x1d5)](_0x30137f(0x1d0))),saveSessionContext({'parent_segment':_0x3dc5f0[_0x30137f(0x1c0)]},_0x39bc87[_0x30137f(0x1f1)]),console[_0x30137f(0x1e4)](a44_0xe1d4a6['green'](_0x30137f(0x1ee)+a44_0xe1d4a6[_0x30137f(0x1c6)]('parent_segment')+_0x30137f(0x1df)+a44_0xe1d4a6[_0x30137f(0x1da)](_0x3dc5f0['parentName']))),0x0;if(!_0x39bc87[_0x30137f(0x1fd)]){if(!isInteractive())return console['error'](a44_0xe1d4a6[_0x30137f(0x1de)](_0x30137f(0x1c2)),_0x30137f(0x1f7)),console[_0x30137f(0x1e4)](a44_0xe1d4a6[_0x30137f(0x1c6)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x224250=await confirmKey(_0x30137f(0x200)+(_0x40c45c[_0x30137f(0x1c8)]+_0x2d6d4b['length'])+'\x20files?');if(!_0x224250)return console[_0x30137f(0x1e4)](a44_0xe1d4a6[_0x30137f(0x1ed)]('Aborted.'),_0x30137f(0x1ca)),0x1;}for(const _0x530d8a of _0x3dc5f0[_0x30137f(0x1fe)]){if(_0x530d8a['isNew']||_0x530d8a['hasChanges']){const _0x30ed19=a44_0x38fb89[_0x30137f(0x1bc)](_0x530d8a[_0x30137f(0x1c4)]);!existsSync(_0x30ed19)&&mkdirSync(_0x30ed19,{'recursive':!![]}),writeFileSync(_0x530d8a[_0x30137f(0x1c4)],_0x530d8a[_0x30137f(0x1ef)],_0x30137f(0x1dd));}}return console[_0x30137f(0x1e4)](a44_0xe1d4a6[_0x30137f(0x1d5)](_0x30137f(0x1f6)+(_0x40c45c[_0x30137f(0x1c8)]+_0x2d6d4b['length'])+'\x20files\x20to\x20'+_0x3dc5f0[_0x30137f(0x1c1)])),saveSessionContext({'parent_segment':_0x3dc5f0[_0x30137f(0x1c0)]},_0x39bc87['session']),console['error'](a44_0xe1d4a6['green'](_0x30137f(0x1ee)+a44_0xe1d4a6[_0x30137f(0x1c6)](_0x30137f(0x1dc))+_0x30137f(0x1df)+a44_0xe1d4a6[_0x30137f(0x1da)](_0x3dc5f0[_0x30137f(0x1c0)]))),0x0;}}
1
+ function a45_0x3b44(_0x490c48,_0x2a2aa1){_0x490c48=_0x490c48-0x133;const _0x2f9194=a45_0x2f91();let _0x3b4415=_0x2f9194[_0x490c48];return _0x3b4415;}const a45_0x5a3d2d=a45_0x3b44;(function(_0x55803c,_0x453514){const _0x34b1d5=a45_0x3b44,_0x5db697=_0x55803c();while(!![]){try{const _0x16de9e=parseInt(_0x34b1d5(0x178))/0x1*(-parseInt(_0x34b1d5(0x140))/0x2)+-parseInt(_0x34b1d5(0x15b))/0x3*(parseInt(_0x34b1d5(0x15d))/0x4)+parseInt(_0x34b1d5(0x139))/0x5+-parseInt(_0x34b1d5(0x177))/0x6+parseInt(_0x34b1d5(0x13b))/0x7+-parseInt(_0x34b1d5(0x175))/0x8+parseInt(_0x34b1d5(0x141))/0x9;if(_0x16de9e===_0x453514)break;else _0x5db697['push'](_0x5db697['shift']());}catch(_0x2cbfc2){_0x5db697['push'](_0x5db697['shift']());}}}(a45_0x2f91,0x78d2f));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 a45_0xb863a4 from'chalk';function a45_0x2f91(){const _0xc5db99=['Error:\x20','green','data','Target\x20resource:\x20','\x20\x20🎯\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','red','4005168ZuDqkC','targetDir','1467360HmwFlX','681BgjaXt','\x20files\x20to\x20','files','dim','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','length','file','✔\x20All\x20files\x20are\x20up\x20to\x20date','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)','repeat','relativePath','activations','error','\x27...','864070cXglUb','journeyVersions','4546290OuYDii','segments','\x0aPull\x20summary\x20for\x20\x27','\x20=\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','338dxKnYk','5805639hOikhL','\x20new\x20files','Site:\x20','execute','counts','\x20unchanged\x20files','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','session','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','verbose','segment:pull','\x20versions)','no_parent','\x20with\x20','journeys','segment','filter','site','name','parentName','\x20changed\x20files','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','✔\x20Context\x20set:\x20','Parent\x20segment:\x20','parentSegment','errorCode','15fKGHnp','description','89732gbtMqj','absolutePath','cwd','utf-8','cyan','isNew','setPhase','\x20\x20Target:\x20','type','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','parent_segment','Aborted.','dirname','-\x20no\x20files\x20written','diff','hasChanges','yellow'];a45_0x2f91=function(){return _0xc5db99;};return a45_0x2f91();}import{existsSync,mkdirSync,writeFileSync}from'fs';import a45_0x26f078 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{[a45_0x5a3d2d(0x153)]=a45_0x5a3d2d(0x14b);[a45_0x5a3d2d(0x15c)]=a45_0x5a3d2d(0x166);async[a45_0x5a3d2d(0x144)](_0x483638){const _0xd9928f=a45_0x5a3d2d,{options:_0x24543d,args:_0x157d4a,tdx:_0x2339d9}=_0x483638,_0x504e3c=_0x24543d,_0x5db577=await resolveTarget({'arg':_0x157d4a[0x0],'contextParent':_0x24543d[_0xd9928f(0x159)],'cwd':process[_0xd9928f(0x15f)]()});if(!isSuccessfulResolution(_0x5db577))return _0x5db577[_0xd9928f(0x15a)]===_0xd9928f(0x14d)?(console[_0xd9928f(0x137)](a45_0xb863a4['yellow'](_0xd9928f(0x173))),console['error'](_0xd9928f(0x133)),console[_0xd9928f(0x137)](_0xd9928f(0x13f)),console['error'](_0xd9928f(0x156))):(console[_0xd9928f(0x137)](a45_0xb863a4[_0xd9928f(0x174)](_0xd9928f(0x16e)+_0x5db577['message']+'\x0a')),_0x5db577['helpText']&&console[_0xd9928f(0x137)](a45_0xb863a4[_0xd9928f(0x161)](_0x5db577['helpText']))),0x1;const _0x3b2836=_0x5db577[_0xd9928f(0x154)],_0x32ce89=_0x5db577[_0xd9928f(0x176)],_0x3a5658=_0x5db577[_0xd9928f(0x165)]===_0xd9928f(0x17e)?_0x5db577['resourceName']:undefined;_0x504e3c[_0xd9928f(0x14a)]&&(console['error'](_0xd9928f(0x143)+_0x504e3c[_0xd9928f(0x152)]),console[_0xd9928f(0x137)](_0xd9928f(0x158)+_0x3b2836),_0x3a5658&&console[_0xd9928f(0x137)](_0xd9928f(0x171)+_0x3a5658));const _0x2bb55e=await withProgressSpinner('Pulling\x20segments\x20from\x20\x27'+_0x3b2836+_0xd9928f(0x138),_0x159e4b=>_0x2339d9[_0xd9928f(0x150)]['pullSegments'](_0x3b2836,{'targetDir':_0x32ce89,'targetResourceName':_0x3a5658,'verbose':_0x504e3c[_0xd9928f(0x14a)],'progress':{'update':_0x51c06b=>{const _0x10e86e=_0xd9928f;_0x159e4b[_0x10e86e(0x163)](_0x51c06b),_0x504e3c[_0x10e86e(0x14a)]&&console[_0x10e86e(0x137)]('\x20\x20'+_0x51c06b);}}}),{'verbose':_0x504e3c[_0xd9928f(0x14a)]}),_0x39c041=_0x2bb55e[_0xd9928f(0x170)];if(_0x39c041[_0xd9928f(0x145)][_0xd9928f(0x13c)]===0x0&&_0x39c041[_0xd9928f(0x145)][_0xd9928f(0x14f)]===0x0)return console[_0xd9928f(0x137)](a45_0xb863a4[_0xd9928f(0x16d)](_0xd9928f(0x147)+_0x39c041[_0xd9928f(0x154)]+'\x27')),0x0;const _0x5d549b=_0x39c041[_0xd9928f(0x17a)]['filter'](_0x2a39ac=>_0x2a39ac[_0xd9928f(0x162)]),_0x50a3bb=_0x39c041[_0xd9928f(0x17a)][_0xd9928f(0x151)](_0x22c3c2=>!_0x22c3c2['isNew']&&_0x22c3c2[_0xd9928f(0x16c)]),_0x49919d=_0x39c041[_0xd9928f(0x17a)]['filter'](_0x2d92d5=>!_0x2d92d5[_0xd9928f(0x162)]&&!_0x2d92d5['hasChanges']);console['error'](_0xd9928f(0x13d)+_0x39c041[_0xd9928f(0x154)]+'\x27:'),console['error'](_0xd9928f(0x172)+a45_0xb863a4[_0xd9928f(0x161)](_0x39c041[_0xd9928f(0x145)]['segments']+'\x20segments')+_0xd9928f(0x14e)+a45_0xb863a4[_0xd9928f(0x161)](_0x39c041[_0xd9928f(0x145)][_0xd9928f(0x136)]+'\x20activations'));if(_0x39c041[_0xd9928f(0x145)][_0xd9928f(0x14f)]>0x0){const _0x33e7ac=_0x39c041[_0xd9928f(0x145)]['journeyVersions']>_0x39c041[_0xd9928f(0x145)]['journeys']?'\x20('+_0x39c041[_0xd9928f(0x145)][_0xd9928f(0x13a)]+_0xd9928f(0x14c):'';console[_0xd9928f(0x137)]('\x20\x20🗺️\x20\x20'+a45_0xb863a4[_0xd9928f(0x161)](_0x39c041['counts'][_0xd9928f(0x14f)]+'\x20journeys')+a45_0xb863a4['dim'](_0x33e7ac));}console[_0xd9928f(0x137)]('\x20\x20'+a45_0xb863a4['green']('+\x20'+_0x5d549b[_0xd9928f(0x17d)]+_0xd9928f(0x142))),console[_0xd9928f(0x137)]('\x20\x20'+a45_0xb863a4[_0xd9928f(0x16d)]('~\x20'+_0x50a3bb[_0xd9928f(0x17d)]+_0xd9928f(0x155))),console[_0xd9928f(0x137)]('\x20\x20'+a45_0xb863a4[_0xd9928f(0x17b)]('=\x20'+_0x49919d[_0xd9928f(0x17d)]+_0xd9928f(0x146))),console[_0xd9928f(0x137)](_0xd9928f(0x164)+a45_0xb863a4[_0xd9928f(0x161)](_0x39c041['targetDir'])+'\x0a');if(_0x50a3bb['length']>0x0)for(const _0x2b0ec0 of _0x50a3bb){console['error']('\x0aChanges\x20to\x20\x27'+_0x2b0ec0[_0xd9928f(0x135)]+'\x27:'),console[_0xd9928f(0x137)]('─'[_0xd9928f(0x134)](0x3c)),console[_0xd9928f(0x137)](_0x2b0ec0[_0xd9928f(0x16b)]),console[_0xd9928f(0x137)]('─'[_0xd9928f(0x134)](0x3c));}if(_0x504e3c['dryRun'])return console[_0xd9928f(0x137)](a45_0xb863a4[_0xd9928f(0x16d)](_0xd9928f(0x17c))),0x0;if(_0x5d549b[_0xd9928f(0x17d)]===0x0&&_0x50a3bb[_0xd9928f(0x17d)]===0x0)return console[_0xd9928f(0x137)](a45_0xb863a4[_0xd9928f(0x16f)](_0xd9928f(0x17f))),saveSessionContext({'parent_segment':_0x39c041['parentName']},_0x504e3c[_0xd9928f(0x148)]),console['error'](a45_0xb863a4[_0xd9928f(0x16f)](_0xd9928f(0x157)+a45_0xb863a4[_0xd9928f(0x17b)](_0xd9928f(0x167))+'\x20=\x20'+a45_0xb863a4[_0xd9928f(0x161)](_0x39c041[_0xd9928f(0x154)]))),0x0;if(!_0x504e3c['yes']){if(!isInteractive())return console['error'](a45_0xb863a4[_0xd9928f(0x174)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a45_0xb863a4[_0xd9928f(0x17b)](_0xd9928f(0x149))),0x1;const _0x297842=await confirmKey('Write\x20'+(_0x5d549b[_0xd9928f(0x17d)]+_0x50a3bb[_0xd9928f(0x17d)])+'\x20files?');if(!_0x297842)return console[_0xd9928f(0x137)](a45_0xb863a4['yellow'](_0xd9928f(0x168)),_0xd9928f(0x16a)),0x1;}for(const _0x26f5a5 of _0x39c041[_0xd9928f(0x17a)]){if(_0x26f5a5['isNew']||_0x26f5a5[_0xd9928f(0x16c)]){const _0x135aed=a45_0x26f078[_0xd9928f(0x169)](_0x26f5a5['absolutePath']);!existsSync(_0x135aed)&&mkdirSync(_0x135aed,{'recursive':!![]}),writeFileSync(_0x26f5a5[_0xd9928f(0x15e)],_0x26f5a5['content'],_0xd9928f(0x160));}}return console[_0xd9928f(0x137)](a45_0xb863a4[_0xd9928f(0x16f)]('✔\x20Pulled\x20'+(_0x5d549b['length']+_0x50a3bb['length'])+_0xd9928f(0x179)+_0x39c041[_0xd9928f(0x176)])),saveSessionContext({'parent_segment':_0x39c041[_0xd9928f(0x154)]},_0x504e3c['session']),console[_0xd9928f(0x137)](a45_0xb863a4[_0xd9928f(0x16f)]('✔\x20Context\x20set:\x20'+a45_0xb863a4[_0xd9928f(0x17b)](_0xd9928f(0x167))+_0xd9928f(0x13e)+a45_0xb863a4[_0xd9928f(0x161)](_0x39c041[_0xd9928f(0x154)]))),0x0;}}
@@ -1 +1 @@
1
- const a45_0x20a7e3=a45_0x3ae4;(function(_0x11113b,_0x2f3750){const _0x52e222=a45_0x3ae4,_0x59e482=_0x11113b();while(!![]){try{const _0x20b192=parseInt(_0x52e222(0x19e))/0x1*(-parseInt(_0x52e222(0x189))/0x2)+-parseInt(_0x52e222(0x180))/0x3+-parseInt(_0x52e222(0x1ba))/0x4*(parseInt(_0x52e222(0x169))/0x5)+parseInt(_0x52e222(0x173))/0x6*(parseInt(_0x52e222(0x179))/0x7)+-parseInt(_0x52e222(0x1b0))/0x8*(parseInt(_0x52e222(0x1a0))/0x9)+-parseInt(_0x52e222(0x17d))/0xa*(parseInt(_0x52e222(0x1a4))/0xb)+parseInt(_0x52e222(0x1eb))/0xc;if(_0x20b192===_0x2f3750)break;else _0x59e482['push'](_0x59e482['shift']());}catch(_0x4518b1){_0x59e482['push'](_0x59e482['shift']());}}}(a45_0x1b1d,0x2ef7c));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';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a45_0x20a13d from'chalk';function a45_0x1b1d(){const _0x1d6e9e=['user','\x0aValidation\x20failed:','getJourney','no_parent','versionNumber','/app/ps/','1867890XhJCyW','helpText','\x20changes?','listJourneysWithDetailsFromParentSegment','nameToType','journeysOnly','7qweEHD','\x20to\x20delete','Error\x20parsing\x20YAML:\x20','type','6020YMldja','execute','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','1071966mYbXGU','activations','all','unchanged','folders','segments','\x0aPush\x20summary\x20for\x20\x27','\x20\x20\x20\x20','\x20deleted','10lrCGZk','journey','get','endsWith','message','yellow','data','/e/','getParent','listFolders','toDelete','error','\x20updated','Parent\x20segment:\x20','relationships','description','.yml','map','filePath','(Journey\x20will\x20be\x20deleted)','created','199JpsZMO','Error:\x20Directory\x20not\x20found:\x20','1629XSDFly','\x20unchanged','createdSegmentIds','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','451jdymrz','Delete\x20journey:','folderId','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','file','journeyBundleId','name','cyan','idToName','parentName','isNew','\x20created','4568mMzrdE','paused','\x20\x20Source:\x20','createdAt','getOutputSchemaWithCache','\x20\x20🗺️\x20\x20Journeys:','audienceId','diff','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','toCreate','1293932IDjfpc','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','join','\x20new','Source\x20directory:\x20','nameToId','results','\x20to\x20create','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','set','\x20\x20Segments:\x20','\x20activations]','\x0a✔\x20Push\x20complete','\x20YAML\x20files\x20found','connection','Scoped\x20to\x20folder:\x20','Aborted.','verbose','segment:push','new','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','filter','\x0aError:','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','isScoped','toUpdate','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','journeyBundleName','add','site','green','folderPath','then','existingSegment','segment','No\x20','repeat','Changes\x20to:','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','\x27...','listActivations','Delete\x20segment:','dim','errorCode','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','red','\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20','deleted','existingJourney','8290776xEeYsO','\x20changed','\x20\x20Journeys:\x20','journeyId','Preparing\x20journeys...','/sb/da/esr','segment\x20or\x20journey','yes','journeys','segmentFolderId','changed','blue','updated','attributes','push','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','Error:\x20','state','length','5OHWfhY','/j/da/je','delete','yamlConfig'];a45_0x1b1d=function(){return _0x1d6e9e;};return a45_0x1b1d();}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';function a45_0x3ae4(_0x3bfbd6,_0x45cda0){_0x3bfbd6=_0x3bfbd6-0x15e;const _0x1b1deb=a45_0x1b1d();let _0x3ae4e8=_0x1b1deb[_0x3bfbd6];return _0x3ae4e8;}export class SegmentPushCommand extends BaseCommand{[a45_0x20a7e3(0x1aa)]=a45_0x20a7e3(0x1cc);[a45_0x20a7e3(0x198)]='Push\x20YAML\x20files\x20to\x20Treasure\x20AI\x20as\x20child\x20segments';async[a45_0x20a7e3(0x17e)](_0xc58cd0){const _0x1c5b16=a45_0x20a7e3,{options:_0x1eb3a5,args:_0x482758,tdx:_0x239a42}=_0xc58cd0,_0x4b36fa=_0x1eb3a5,_0x4541a1=await resolveTarget({'arg':_0x482758[0x0],'contextParent':_0x1eb3a5['parentSegment'],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x4541a1))return _0x4541a1[_0x1c5b16(0x1e5)]===_0x1c5b16(0x170)?(console[_0x1c5b16(0x194)](a45_0x20a13d[_0x1c5b16(0x18e)](_0x1c5b16(0x1b8))),console[_0x1c5b16(0x194)]('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)'),console[_0x1c5b16(0x194)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent'),console[_0x1c5b16(0x194)](_0x1c5b16(0x1a3))):(console[_0x1c5b16(0x194)](a45_0x20a13d[_0x1c5b16(0x1e7)](_0x1c5b16(0x166)+_0x4541a1['message']+'\x0a')),_0x4541a1['helpText']&&console['error'](a45_0x20a13d[_0x1c5b16(0x1ab)](_0x4541a1[_0x1c5b16(0x174)]))),0x1;if(_0x4541a1[_0x1c5b16(0x17c)]==='parent_name')return console['error'](a45_0x20a13d['red'](_0x1c5b16(0x19f)+_0x4541a1['targetDir']+'\x0a')),console['error'](a45_0x20a13d['cyan'](_0x1c5b16(0x1ce))),0x1;const _0x3643f9=_0x4541a1[_0x1c5b16(0x1ad)],_0x139558=_0x4541a1['targetDir'],_0x315ccb=_0x4541a1[_0x1c5b16(0x17c)]===_0x1c5b16(0x1a8)?_0x4541a1[_0x1c5b16(0x19b)]:undefined,_0x93fb43=getScopedDetails(_0x4541a1),_0x1a7433=_0x93fb43?.[_0x1c5b16(0x1d2)]??![],_0x555c2b=_0x93fb43?.['scopedFolderPath']??'';if(!existsSync(_0x139558))return console[_0x1c5b16(0x194)](a45_0x20a13d[_0x1c5b16(0x1e7)](_0x1c5b16(0x19f)+_0x139558+'\x0a')),console[_0x1c5b16(0x194)](a45_0x20a13d['cyan'](_0x1c5b16(0x1ce))),0x1;_0x4b36fa[_0x1c5b16(0x1cb)]&&(console['error']('Site:\x20'+_0x4b36fa['site']),console['error'](_0x1c5b16(0x196)+_0x3643f9),console['error'](_0x1c5b16(0x1be)+_0x139558),_0x1a7433&&console[_0x1c5b16(0x194)](_0x1c5b16(0x1c9)+_0x555c2b));const _0x2f1418=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3643f9+_0x1c5b16(0x1e1),()=>_0x239a42['segment']['resolveParentId'](_0x3643f9),{'verbose':_0x4b36fa[_0x1c5b16(0x1cb)]}),_0x1c1075=_0x2f1418[_0x1c5b16(0x18f)],{parentSegmentResult:_0x273477,segmentsResult:_0x1fc5be,foldersResult:_0x28be23,journeysWithDetailsResult:_0xd456b3,userMaps:_0x26cfe7}=await withSpinner('Fetching\x20existing\x20data...',async()=>{const _0x1b8c6c=_0x1c5b16,[_0x2c5eea,_0xdc5a5a,_0x42b5be,_0x2a2561,_0x2db53d]=await Promise[_0x1b8c6c(0x182)]([_0x239a42['segment'][_0x1b8c6c(0x191)](_0x1c1075),_0x239a42[_0x1b8c6c(0x1dc)]['listSegments'](_0x1c1075),_0x239a42[_0x1b8c6c(0x1dc)][_0x1b8c6c(0x192)](_0x1c1075),_0x239a42[_0x1b8c6c(0x18a)][_0x1b8c6c(0x176)](_0x1c1075,{'includeAllVersions':!![]}),_0x239a42[_0x1b8c6c(0x16d)]['buildUserMaps']()]);return{'parentSegmentResult':_0x2c5eea,'segmentsResult':_0xdc5a5a,'foldersResult':_0x42b5be,'journeysWithDetailsResult':_0x2a2561,'userMaps':_0x2db53d};},{'verbose':_0x4b36fa[_0x1c5b16(0x1cb)]})[_0x1c5b16(0x1da)](_0x13070a=>_0x13070a[_0x1c5b16(0x18f)]),_0x43b683=_0x273477,_0x504f72=extractRootFolderId(_0x43b683),_0x4aa1ba=_0x1fc5be,_0x35cfec=_0x28be23,{journeys:_0x1785cd,activationStepsById:_0x588692}=_0xd456b3,_0x1363fb=new Map(_0x1785cd[_0x1c5b16(0x19a)](_0x2ce1e3=>[_0x2ce1e3['id'],_0x2ce1e3])),_0x248bf1=_0x1785cd[_0x1c5b16(0x19a)](_0x3d485b=>({'id':_0x3d485b['id'],'name':_0x3d485b['attributes'][_0x1c5b16(0x1aa)],'journeyBundleName':_0x3d485b['attributes']['journeyBundleName']||'','journeyBundleId':_0x3d485b[_0x1c5b16(0x163)][_0x1c5b16(0x1a9)]||'','versionNumber':_0x3d485b[_0x1c5b16(0x163)][_0x1c5b16(0x171)],'description':_0x3d485b['attributes']['description'],'state':_0x3d485b[_0x1c5b16(0x163)][_0x1c5b16(0x167)],'paused':_0x3d485b['attributes'][_0x1c5b16(0x1b1)],'audienceId':_0x3d485b[_0x1c5b16(0x163)][_0x1c5b16(0x1b6)],'folderId':_0x3d485b[_0x1c5b16(0x197)]?.['parentFolder']?.[_0x1c5b16(0x18f)]?.['id'],'createdAt':_0x3d485b[_0x1c5b16(0x163)][_0x1c5b16(0x1b3)],'updatedAt':_0x3d485b[_0x1c5b16(0x163)]['updatedAt']})),{emailToId:_0x2a43b4,idToEmail:_0x24be97}=_0x26cfe7,_0x238824=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',async()=>{const _0x532ad4=_0x1c5b16,_0x47c95b=await _0x239a42[_0x532ad4(0x1c8)]['list']();return buildConnectionMaps(_0x47c95b);},{'verbose':_0x4b36fa[_0x1c5b16(0x1cb)]})[_0x1c5b16(0x1da)](_0x13f170=>_0x13f170[_0x1c5b16(0x18f)]),_0xe2a789=_0x238824[_0x1c5b16(0x1bf)],_0x2481a2=_0x238824[_0x1c5b16(0x1ac)],_0x1ea72b=_0x238824[_0x1c5b16(0x177)],_0x116408={'emailToIdMap':_0x2a43b4,'connectionNameToIdMap':_0xe2a789,'connectionNameToTypeMap':_0x1ea72b,'getSchema':_0x39932c=>_0x239a42['connection'][_0x1c5b16(0x1b4)](_0x39932c),'getMetadata':_0x1b815e=>_0x239a42[_0x1c5b16(0x1c8)]['getMetadataWithCache'](_0x1b815e)};let {pathToId:_0x47cbdb,idToPath:_0x30bae2}=buildFolderMaps(_0x35cfec);const _0x46253b=buildSegmentLookupMap(_0x4aa1ba,_0x30bae2),_0x45f7e7=buildSegmentNameToIdMap(_0x4aa1ba),_0x154313=buildJourneyBundleLookupMap(_0x248bf1,_0x30bae2);let _0x26a88e;if(_0x315ccb){if(!_0x315ccb[_0x1c5b16(0x18c)](_0x1c5b16(0x199))&&!_0x315ccb[_0x1c5b16(0x18c)]('.yaml'))return console[_0x1c5b16(0x194)](a45_0x20a13d['red'](_0x1c5b16(0x1bb)+_0x315ccb+'\x0a')),0x1;_0x26a88e=[_0x315ccb];}else _0x26a88e=findYamlFiles(_0x139558);if(_0x26a88e['length']===0x0)return console['error'](a45_0x20a13d['red'](_0x1c5b16(0x1c2)+_0x139558+'\x0a')),console[_0x1c5b16(0x194)](a45_0x20a13d[_0x1c5b16(0x1ab)](_0x1c5b16(0x1d4))),0x1;let _0x3dbdeb,_0x9e43;try{const _0x2614eb=parseAndClassifyYamlFiles(_0x26a88e,_0x139558,{'skipSegments':_0x4b36fa['journeysOnly']});_0x3dbdeb=_0x2614eb[_0x1c5b16(0x185)],_0x9e43=_0x2614eb[_0x1c5b16(0x15e)];const _0x57e783=validateParsedFiles(_0x2614eb,_0x139558);if(_0x57e783[_0x1c5b16(0x168)]>0x0)return console[_0x1c5b16(0x194)](a45_0x20a13d[_0x1c5b16(0x1e7)](_0x1c5b16(0x16e))),console[_0x1c5b16(0x194)](formatValidationErrors(_0x57e783)),console['error'](a45_0x20a13d[_0x1c5b16(0x18e)](_0x1c5b16(0x165))),0x1;}catch(_0x4ef017){return console[_0x1c5b16(0x194)](a45_0x20a13d[_0x1c5b16(0x1e7)](_0x1c5b16(0x17b)+(_0x4ef017 instanceof Error?_0x4ef017[_0x1c5b16(0x18d)]:_0x4ef017))),0x1;}if(_0x3dbdeb['length']===0x0&&_0x9e43[_0x1c5b16(0x168)]===0x0){const _0x4cf3ad=_0x4b36fa[_0x1c5b16(0x178)]?_0x1c5b16(0x18a):_0x1c5b16(0x1f1);return console[_0x1c5b16(0x194)](a45_0x20a13d[_0x1c5b16(0x18e)](_0x1c5b16(0x1dd)+_0x4cf3ad+_0x1c5b16(0x1c7))),0x0;}const _0x328a18=new Map();_0x4aa1ba[_0x1c5b16(0x168)]>0x0&&!_0x4b36fa[_0x1c5b16(0x178)]&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x4aa1ba,async _0xc98d2e=>{const _0xcc5b0e=a45_0x3ae4,_0x43ede0=await _0x239a42[_0xcc5b0e(0x1dc)][_0xcc5b0e(0x1e2)](_0x1c1075,_0xc98d2e['id']);_0x328a18[_0xcc5b0e(0x1c3)](_0xc98d2e['id'],_0x43ede0);});},{'verbose':_0x4b36fa['verbose']});const {segmentFiles:_0x313825,foldersToCreate:_0x37ed10}=await prepareSegmentFiles(_0x3dbdeb,{'segmentByFolderAndName':_0x46253b,'activationsBySegmentId':_0x328a18,'folderPathToId':_0x47cbdb,'idToEmailMap':_0x24be97,'connectionIdToNameMap':_0x2481a2},_0x116408,_0x1a7433,_0x555c2b),_0x6bc6d9=_0x315ccb?[]:findSegmentsToDelete(_0x4aa1ba,_0x3dbdeb[_0x1c5b16(0x19a)](({yamlConfig:_0x5b2a82,folderPath:_0x2b9ce8})=>({'yamlConfig':_0x5b2a82,'folderPath':resolveTDFolderPath(_0x2b9ce8,_0x1a7433,_0x555c2b)})),_0x30bae2,_0x555c2b,_0x1a7433),{journeyFiles:_0x799d06,foldersToCreate:_0x2844a6}=await withProgressSpinner(_0x1c5b16(0x1ef),async _0x495499=>prepareJourneyFiles(_0x9e43,{'fetchJourney':async _0x7b5661=>_0x239a42[_0x1c5b16(0x18a)][_0x1c5b16(0x16f)](_0x7b5661['journeyId']),'journeyBundlesByFolderAndName':_0x154313,'folderPathToId':_0x47cbdb,'idToEmailMap':_0x24be97,'connectionIdToNameMap':_0x2481a2,'existingSegments':_0x4aa1ba,'parentId':_0x1c1075,'deps':_0x239a42,'progress':{'update':_0x2b15a4=>{const _0x339654=_0x1c5b16;_0x495499['setPhase'](_0x2b15a4),_0x4b36fa[_0x339654(0x1cb)]&&console[_0x339654(0x194)]('\x20\x20'+_0x2b15a4);}},'journeyById':_0x1363fb,'activationStepsById':_0x588692},_0x1a7433,_0x555c2b),{'verbose':_0x4b36fa[_0x1c5b16(0x1cb)]})[_0x1c5b16(0x1da)](_0x53c20d=>_0x53c20d['data']);for(const _0x3e6715 of _0x2844a6){_0x37ed10[_0x1c5b16(0x1d6)](_0x3e6715);}const _0x1a0c3f=_0x315ccb?[]:findJourneysToDelete(_0x248bf1,_0x9e43[_0x1c5b16(0x19a)](({yamlConfig:_0x173ff6,folderPath:_0x4a627d})=>({'yamlConfig':_0x173ff6,'folderPath':resolveTDFolderPath(_0x4a627d,_0x1a7433,_0x555c2b)})),_0x30bae2,_0x555c2b,_0x1a7433),_0x143b16=calculatePushStats(_0x313825,_0x799d06,_0x37ed10,_0x6bc6d9,_0x1a0c3f,!!_0x4b36fa['delete'],!!_0x4b36fa['journeysOnly']),_0x1116b7=_0x143b16[_0x1c5b16(0x185)][_0x1c5b16(0x1cd)],_0x709e26=_0x143b16[_0x1c5b16(0x185)]['changed'],_0x4829f1=_0x143b16['segments']['unchanged'],_0x50c40e=_0x143b16[_0x1c5b16(0x185)]['toDelete'],_0x1100ef=_0x143b16[_0x1c5b16(0x184)][_0x1c5b16(0x1b9)],_0x521a41=_0x143b16[_0x1c5b16(0x15e)][_0x1c5b16(0x1cd)],_0x5450d7=_0x143b16[_0x1c5b16(0x15e)][_0x1c5b16(0x160)],_0x5b97d2=_0x143b16[_0x1c5b16(0x15e)][_0x1c5b16(0x183)],_0x510068=_0x143b16['journeys'][_0x1c5b16(0x193)],_0x2aad2a=_0x143b16[_0x1c5b16(0x181)][_0x1c5b16(0x182)],_0x3fb9e4=_0x143b16['activations'][_0x1c5b16(0x1b9)],_0x25f52a=_0x143b16['activations'][_0x1c5b16(0x1d3)],_0x3f8521=_0x143b16[_0x1c5b16(0x181)]['toDelete'];console['error'](_0x1c5b16(0x186)+_0x3643f9+'\x27:');_0x1100ef[_0x1c5b16(0x168)]>0x0&&console[_0x1c5b16(0x194)]('\x20\x20'+a45_0x20a13d[_0x1c5b16(0x161)]('📁\x20'+_0x1100ef['length']+'\x20folders\x20to\x20create'));if(!_0x4b36fa[_0x1c5b16(0x178)]){console['error']('\x20\x20📊\x20Segments:'),console[_0x1c5b16(0x194)]('\x20\x20\x20\x20'+a45_0x20a13d[_0x1c5b16(0x1d8)]('+\x20'+_0x1116b7[_0x1c5b16(0x168)]+_0x1c5b16(0x1bd))),console[_0x1c5b16(0x194)](_0x1c5b16(0x187)+a45_0x20a13d['yellow']('~\x20'+_0x709e26[_0x1c5b16(0x168)]+'\x20changed'));if(_0x50c40e['length']>0x0)console[_0x1c5b16(0x194)](_0x1c5b16(0x187)+a45_0x20a13d['red']('-\x20'+_0x50c40e['length']+_0x1c5b16(0x17a)));else _0x6bc6d9[_0x1c5b16(0x168)]>0x0&&!_0x4b36fa[_0x1c5b16(0x16b)]&&console['error']('\x20\x20\x20\x20'+a45_0x20a13d[_0x1c5b16(0x1e4)](_0x6bc6d9['length']+_0x1c5b16(0x17f)));console['error'](_0x1c5b16(0x187)+a45_0x20a13d[_0x1c5b16(0x1e4)]('=\x20'+_0x4829f1['length']+_0x1c5b16(0x1a1)));}if(_0x799d06['length']>0x0||_0x1a0c3f['length']>0x0){console[_0x1c5b16(0x194)](_0x1c5b16(0x1b5)),console['error']('\x20\x20\x20\x20'+a45_0x20a13d[_0x1c5b16(0x1d8)]('+\x20'+_0x521a41[_0x1c5b16(0x168)]+_0x1c5b16(0x1bd))),console[_0x1c5b16(0x194)](_0x1c5b16(0x187)+a45_0x20a13d[_0x1c5b16(0x18e)]('~\x20'+_0x5450d7[_0x1c5b16(0x168)]+_0x1c5b16(0x1ec)));if(_0x510068['length']>0x0)console[_0x1c5b16(0x194)](_0x1c5b16(0x187)+a45_0x20a13d[_0x1c5b16(0x1e7)]('-\x20'+_0x510068[_0x1c5b16(0x168)]+_0x1c5b16(0x17a)));else _0x1a0c3f['length']>0x0&&!_0x4b36fa[_0x1c5b16(0x16b)]&&console[_0x1c5b16(0x194)]('\x20\x20\x20\x20'+a45_0x20a13d[_0x1c5b16(0x1e4)](_0x1a0c3f['length']+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x1c5b16(0x194)](_0x1c5b16(0x187)+a45_0x20a13d['dim']('=\x20'+_0x5b97d2[_0x1c5b16(0x168)]+_0x1c5b16(0x1a1)));}_0x2aad2a[_0x1c5b16(0x168)]>0x0&&!_0x4b36fa[_0x1c5b16(0x178)]&&(console['error'](''),console[_0x1c5b16(0x194)]('\x20\x20Activations:'),_0x3fb9e4[_0x1c5b16(0x168)]>0x0&&console[_0x1c5b16(0x194)](_0x1c5b16(0x187)+a45_0x20a13d[_0x1c5b16(0x1d8)]('+\x20'+_0x3fb9e4[_0x1c5b16(0x168)]+_0x1c5b16(0x1c1))),_0x25f52a[_0x1c5b16(0x168)]>0x0&&console[_0x1c5b16(0x194)](_0x1c5b16(0x187)+a45_0x20a13d[_0x1c5b16(0x18e)]('~\x20'+_0x25f52a[_0x1c5b16(0x168)]+'\x20to\x20update')),_0x3f8521[_0x1c5b16(0x168)]>0x0&&console['error'](_0x1c5b16(0x187)+a45_0x20a13d[_0x1c5b16(0x1e7)]('-\x20'+_0x3f8521[_0x1c5b16(0x168)]+_0x1c5b16(0x17a))));console['error'](_0x1c5b16(0x1b2)+a45_0x20a13d[_0x1c5b16(0x1ab)](_0x139558)+'\x0a');if(_0x1100ef[_0x1c5b16(0x168)]>0x0){console[_0x1c5b16(0x194)]('Folders\x20to\x20create:');for(const _0x5a8f17 of _0x1100ef){console[_0x1c5b16(0x194)]('\x20\x20'+a45_0x20a13d[_0x1c5b16(0x161)]('+')+'\x20'+_0x5a8f17);}console[_0x1c5b16(0x194)]('');}if(_0x1116b7[_0x1c5b16(0x168)]>0x0&&!_0x4b36fa[_0x1c5b16(0x178)])for(const _0x4fa519 of _0x1116b7){const _0x1d0f10=_0x4fa519[_0x1c5b16(0x1d9)]?_0x4fa519[_0x1c5b16(0x1d9)]+'/'+_0x4fa519['yamlConfig'][_0x1c5b16(0x1aa)]:_0x4fa519[_0x1c5b16(0x16c)][_0x1c5b16(0x1aa)],_0x2a393f=_0x4fa519[_0x1c5b16(0x16c)][_0x1c5b16(0x181)]?.[_0x1c5b16(0x168)]||0x0,_0x31e7f6=_0x2a393f>0x0?a45_0x20a13d[_0x1c5b16(0x1e4)]('\x20['+_0x2a393f+'\x20activations]'):'';console[_0x1c5b16(0x194)]('\x0a'+a45_0x20a13d[_0x1c5b16(0x1d8)]('New\x20segment:')+'\x20'+_0x1d0f10+_0x31e7f6),console[_0x1c5b16(0x194)]('─'[_0x1c5b16(0x1de)](0x3c)),_0x4fa519['diff']&&console[_0x1c5b16(0x194)](_0x4fa519['diff']),console['error']('─'[_0x1c5b16(0x1de)](0x3c));}if(_0x50c40e[_0x1c5b16(0x168)]>0x0&&!_0x4b36fa['journeysOnly'])for(const _0x400db3 of _0x50c40e){const _0x37e614=_0x400db3[_0x1c5b16(0x15f)]?_0x30bae2[_0x1c5b16(0x18b)](_0x400db3['segmentFolderId']['toString']())||'':'',_0x28b1cd=_0x37e614?_0x37e614+'/'+_0x400db3[_0x1c5b16(0x1aa)]:_0x400db3[_0x1c5b16(0x1aa)],_0x3d6208=_0x328a18['get'](_0x400db3['id'])||[],_0x27c041=_0x3d6208['length']>0x0?a45_0x20a13d[_0x1c5b16(0x1e4)]('\x20['+_0x3d6208[_0x1c5b16(0x168)]+_0x1c5b16(0x1c5)):'';console[_0x1c5b16(0x194)]('\x0a'+a45_0x20a13d[_0x1c5b16(0x1e7)](_0x1c5b16(0x1e3))+'\x20'+_0x28b1cd+_0x27c041),console[_0x1c5b16(0x194)]('─'['repeat'](0x3c));const _0x978236=segmentWithActivationsToYaml(_0x400db3,_0x3d6208,undefined,_0x24be97,_0x2481a2),_0x45dc11=segmentToYamlString(_0x978236),_0x484fd5=generateDiff(_0x45dc11,'');console[_0x1c5b16(0x194)](formatDiffWithColors(_0x484fd5)),console[_0x1c5b16(0x194)]('─'['repeat'](0x3c));}const _0x22eb73=_0x313825[_0x1c5b16(0x1cf)](_0x2c3c5b=>!_0x2c3c5b[_0x1c5b16(0x1ae)]&&_0x2c3c5b['diff']);if(_0x22eb73['length']>0x0&&!_0x4b36fa[_0x1c5b16(0x178)])for(const _0x472099 of _0x22eb73){const _0x2a5107=_0x472099[_0x1c5b16(0x1d9)]?_0x472099[_0x1c5b16(0x1d9)]+'/'+_0x472099[_0x1c5b16(0x16c)][_0x1c5b16(0x1aa)]:_0x472099[_0x1c5b16(0x16c)]['name'];console[_0x1c5b16(0x194)]('\x0a'+a45_0x20a13d['yellow'](_0x1c5b16(0x1df))+'\x20'+_0x2a5107),console[_0x1c5b16(0x194)]('─'[_0x1c5b16(0x1de)](0x3c)),console[_0x1c5b16(0x194)](_0x472099['diff']),console[_0x1c5b16(0x194)]('─'[_0x1c5b16(0x1de)](0x3c));}if(_0x521a41['length']>0x0)for(const _0x1c6ef7 of _0x521a41){const _0x23b105=_0x1c6ef7[_0x1c5b16(0x1d9)]?_0x1c6ef7['folderPath']+'/'+_0x1c6ef7[_0x1c5b16(0x16c)][_0x1c5b16(0x1aa)]:_0x1c6ef7[_0x1c5b16(0x16c)]['name'];console[_0x1c5b16(0x194)]('\x0a'+a45_0x20a13d[_0x1c5b16(0x1d8)]('New\x20journey:')+'\x20'+_0x23b105),console[_0x1c5b16(0x194)]('─'[_0x1c5b16(0x1de)](0x3c)),_0x1c6ef7[_0x1c5b16(0x1b7)]&&console[_0x1c5b16(0x194)](_0x1c6ef7['diff']),console['error']('─'[_0x1c5b16(0x1de)](0x3c));}const _0x1281ed=_0x799d06[_0x1c5b16(0x1cf)](_0x4c9ac5=>!_0x4c9ac5[_0x1c5b16(0x1ae)]&&_0x4c9ac5[_0x1c5b16(0x1b7)]);if(_0x1281ed['length']>0x0)for(const _0x2135a8 of _0x1281ed){const _0x336df6=_0x2135a8['folderPath']?_0x2135a8[_0x1c5b16(0x1d9)]+'/'+_0x2135a8[_0x1c5b16(0x16c)][_0x1c5b16(0x1aa)]:_0x2135a8[_0x1c5b16(0x16c)][_0x1c5b16(0x1aa)];console['error']('\x0a'+a45_0x20a13d['yellow']('Changes\x20to\x20journey:')+'\x20'+_0x336df6),console['error']('─'['repeat'](0x3c)),console['error'](_0x2135a8[_0x1c5b16(0x1b7)]),console[_0x1c5b16(0x194)]('─'[_0x1c5b16(0x1de)](0x3c));}if(_0x510068[_0x1c5b16(0x168)]>0x0)for(const _0x444c07 of _0x510068){const _0x5e3844=_0x444c07['folderId']?_0x30bae2[_0x1c5b16(0x18b)](_0x444c07[_0x1c5b16(0x1a6)])||'':'',_0x4ec3c3=_0x5e3844?_0x5e3844+'/'+_0x444c07[_0x1c5b16(0x1d5)]:_0x444c07[_0x1c5b16(0x1d5)];console[_0x1c5b16(0x194)]('\x0a'+a45_0x20a13d[_0x1c5b16(0x1e7)](_0x1c5b16(0x1a5))+'\x20'+_0x4ec3c3),console['error']('─'[_0x1c5b16(0x1de)](0x3c)),console['error'](a45_0x20a13d[_0x1c5b16(0x1e7)](_0x1c5b16(0x19c))),console[_0x1c5b16(0x194)]('─'[_0x1c5b16(0x1de)](0x3c));}if(_0x4b36fa['dryRun'])return console['error'](a45_0x20a13d[_0x1c5b16(0x18e)](_0x1c5b16(0x1a7))),0x0;const _0x33e2ed=_0x4b36fa['journeysOnly']?![]:_0x1116b7[_0x1c5b16(0x168)]>0x0||_0x709e26[_0x1c5b16(0x168)]>0x0||_0x50c40e[_0x1c5b16(0x168)]>0x0,_0x4ca739=_0x521a41[_0x1c5b16(0x168)]>0x0||_0x5450d7[_0x1c5b16(0x168)]>0x0||_0x510068[_0x1c5b16(0x168)]>0x0,_0x1f1079=_0x4b36fa['journeysOnly']?![]:_0x2aad2a[_0x1c5b16(0x168)]>0x0,_0x4c045f=_0x1100ef[_0x1c5b16(0x168)]>0x0;if(!_0x33e2ed&&!_0x4ca739&&!_0x1f1079&&!_0x4c045f){const _0x1ec7bf=_0x4b36fa[_0x1c5b16(0x178)]?_0x1c5b16(0x1e0):'✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date';console['error'](a45_0x20a13d[_0x1c5b16(0x1d8)](_0x1ec7bf));if(_0x315ccb&&_0x4829f1[_0x1c5b16(0x168)]===0x1){const _0x4baa78=_0x4829f1[0x0];if(_0x4baa78[_0x1c5b16(0x1db)]?.['id']){const _0x50b5e2=getConsoleNextUrl(_0x4b36fa['site'],_0x1c5b16(0x172)+_0x1c1075+_0x1c5b16(0x190)+_0x4baa78[_0x1c5b16(0x1db)]['id']+_0x1c5b16(0x1f0));console[_0x1c5b16(0x194)](_0x1c5b16(0x1e8)+a45_0x20a13d[_0x1c5b16(0x1ab)](_0x50b5e2));}}if(_0x315ccb&&_0x5b97d2[_0x1c5b16(0x168)]===0x1){const _0x39e74f=_0x5b97d2[0x0];if(_0x39e74f[_0x1c5b16(0x1ea)]?.['id']){const _0x43ea96=getConsoleNextUrl(_0x4b36fa[_0x1c5b16(0x1d7)],_0x1c5b16(0x172)+_0x1c1075+_0x1c5b16(0x190)+_0x39e74f[_0x1c5b16(0x1ea)]['id']+'/j/da/je');console[_0x1c5b16(0x194)]('\x20\x20'+a45_0x20a13d[_0x1c5b16(0x1ab)](_0x43ea96));}}return 0x0;}const _0x1b888f=_0x4b36fa[_0x1c5b16(0x178)]?_0x521a41[_0x1c5b16(0x168)]+_0x5450d7['length']+_0x510068[_0x1c5b16(0x168)]+_0x1100ef[_0x1c5b16(0x168)]:_0x1116b7[_0x1c5b16(0x168)]+_0x709e26[_0x1c5b16(0x168)]+_0x50c40e['length']+_0x521a41[_0x1c5b16(0x168)]+_0x5450d7[_0x1c5b16(0x168)]+_0x510068['length']+_0x1100ef['length']+_0x2aad2a['length'];if(!_0x4b36fa[_0x1c5b16(0x1f2)]&&_0x1b888f>0x0){if(!isInteractive())return console[_0x1c5b16(0x194)](a45_0x20a13d['red'](_0x1c5b16(0x1d0)),_0x1c5b16(0x1d1)),console['error'](a45_0x20a13d[_0x1c5b16(0x1e4)](_0x1c5b16(0x1e6))),0x1;const _0x82c33=await confirmKey('Push\x20'+_0x1b888f+_0x1c5b16(0x175));if(!_0x82c33)return console[_0x1c5b16(0x194)](a45_0x20a13d['yellow'](_0x1c5b16(0x1ca))),0x1;}const _0x2e1984={'withProgress':async(_0x39ff4a,_0x429b85)=>{const _0x5d46bc=_0x1c5b16,_0x9f9779=await withSpinner(_0x39ff4a,_0x429b85,{'verbose':_0x4b36fa[_0x5d46bc(0x1cb)]});return{'data':_0x9f9779[_0x5d46bc(0x18f)]};},'logInfo':_0x2696de=>console['error'](a45_0x20a13d[_0x1c5b16(0x161)]('✔\x20'+_0x2696de)),'logSuccess':_0xfdac2f=>console[_0x1c5b16(0x194)](a45_0x20a13d[_0x1c5b16(0x1d8)]('✔\x20'+_0xfdac2f)),'logWarning':_0x392532=>console[_0x1c5b16(0x194)](a45_0x20a13d['yellow']('⚠\x20'+_0x392532)),'logDeleted':_0x4f2766=>console[_0x1c5b16(0x194)](a45_0x20a13d[_0x1c5b16(0x1e7)]('✔\x20'+_0x4f2766))},_0x386090={'segment':_0x239a42[_0x1c5b16(0x1dc)],'journey':_0x239a42[_0x1c5b16(0x18a)],'user':_0x239a42['user'],'connection':_0x239a42['connection']};_0x1100ef[_0x1c5b16(0x168)]>0x0&&(_0x47cbdb=await executePushFolders(_0x386090,_0x1100ef,_0x47cbdb,{'parentId':_0x1c1075},_0x2e1984));const _0x349ae0={'rootFolderId':_0x504f72,'folderPathToId':_0x47cbdb,'folderIdToPath':_0x30bae2,'segmentNameToId':_0x45f7e7,'activationsBySegmentId':_0x328a18,'emailToIdMap':_0x2a43b4,'idToEmailMap':_0x24be97,'connectionNameToIdMap':_0x238824[_0x1c5b16(0x1bf)],'connectionIdToNameMap':_0x238824[_0x1c5b16(0x1ac)],'connectionNameToTypeMap':_0x1ea72b},_0x515897=await executePushSegments(_0x386090,_0x4b36fa[_0x1c5b16(0x178)]?[]:_0x313825,_0x349ae0,{'parentId':_0x1c1075},_0x2e1984),_0x3a4bdf=_0x515897[_0x1c5b16(0x19d)],_0x24e912=_0x515897['updated'],_0x34cf07=_0x515897[_0x1c5b16(0x181)][_0x1c5b16(0x19d)],_0x4c7259=_0x515897['activations'][_0x1c5b16(0x162)],_0x4fbe05=_0x515897[_0x1c5b16(0x181)][_0x1c5b16(0x1e9)];let _0x2a8706;if(_0x315ccb&&_0x313825[_0x1c5b16(0x168)]===0x1){const _0x28cfde=_0x313825[0x0];_0x2a8706=_0x28cfde['existingSegment']?.['id']??_0x515897[_0x1c5b16(0x1a2)][_0x1c5b16(0x18b)](_0x28cfde[_0x1c5b16(0x16c)][_0x1c5b16(0x1aa)]);}const _0x2759ff=await executePushSegmentDeletions(_0x386090,_0x4b36fa[_0x1c5b16(0x178)]?[]:_0x50c40e,_0x2e1984);let _0x522cb8=0x0,_0x1ed119=0x0,_0x556956=0x0;const _0x40339f=new Map(_0x45f7e7);for(const [_0x221bcd,_0x25bd34]of _0x515897[_0x1c5b16(0x1a2)]){_0x40339f['set'](_0x221bcd,_0x25bd34);}if(_0x799d06[_0x1c5b16(0x168)]>0x0){const _0x2165e0={..._0x349ae0,'segmentNameToId':_0x40339f,'existingSegments':_0x4aa1ba,'activationContext':_0x116408},_0x29dc85=await executePushJourneys(_0x386090,_0x799d06,_0x2165e0,{'parentId':_0x1c1075,'rootFolderId':_0x504f72,'verbose':_0x4b36fa[_0x1c5b16(0x1cb)]},_0x2e1984);_0x522cb8=_0x29dc85[_0x1c5b16(0x19d)],_0x1ed119=_0x29dc85['updated'];if(_0x315ccb&&_0x29dc85[_0x1c5b16(0x1c0)][_0x1c5b16(0x168)]===0x1){const _0x28cfd3=_0x29dc85[_0x1c5b16(0x1c0)][0x0];if(_0x28cfd3['journeyId']){const _0x85c467=getConsoleNextUrl(_0x4b36fa[_0x1c5b16(0x1d7)],_0x1c5b16(0x172)+_0x1c1075+_0x1c5b16(0x190)+_0x28cfd3[_0x1c5b16(0x1ee)]+_0x1c5b16(0x16a));console[_0x1c5b16(0x194)]('\x20\x20'+a45_0x20a13d[_0x1c5b16(0x1ab)](_0x85c467));}}}for(const _0x22eeb6 of _0x510068){console[_0x1c5b16(0x194)](a45_0x20a13d['yellow']('⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20'+_0x22eeb6[_0x1c5b16(0x1d5)])),_0x556956++;}const _0x4631b1=[];if(_0x3a4bdf>0x0)_0x4631b1[_0x1c5b16(0x164)](_0x3a4bdf+_0x1c5b16(0x1af));if(_0x24e912>0x0)_0x4631b1[_0x1c5b16(0x164)](_0x24e912+_0x1c5b16(0x195));if(_0x2759ff>0x0)_0x4631b1[_0x1c5b16(0x164)](_0x2759ff+_0x1c5b16(0x188));const _0xec2c1e=[];if(_0x522cb8>0x0)_0xec2c1e['push'](_0x522cb8+_0x1c5b16(0x1af));if(_0x1ed119>0x0)_0xec2c1e[_0x1c5b16(0x164)](_0x1ed119+_0x1c5b16(0x195));if(_0x556956>0x0)_0xec2c1e[_0x1c5b16(0x164)](_0x556956+_0x1c5b16(0x188));const _0x4a551d=[];if(_0x34cf07>0x0)_0x4a551d[_0x1c5b16(0x164)](_0x34cf07+_0x1c5b16(0x1af));if(_0x4c7259>0x0)_0x4a551d['push'](_0x4c7259+_0x1c5b16(0x195));if(_0x4fbe05>0x0)_0x4a551d['push'](_0x4fbe05+_0x1c5b16(0x188));console[_0x1c5b16(0x194)](a45_0x20a13d['green'](_0x1c5b16(0x1c6)));_0x4631b1[_0x1c5b16(0x168)]>0x0&&!_0x4b36fa[_0x1c5b16(0x178)]&&console[_0x1c5b16(0x194)](_0x1c5b16(0x1c4)+_0x4631b1[_0x1c5b16(0x1bc)](',\x20'));_0xec2c1e[_0x1c5b16(0x168)]>0x0&&console[_0x1c5b16(0x194)](_0x1c5b16(0x1ed)+_0xec2c1e[_0x1c5b16(0x1bc)](',\x20'));_0x4a551d[_0x1c5b16(0x168)]>0x0&&!_0x4b36fa[_0x1c5b16(0x178)]&&console[_0x1c5b16(0x194)]('\x20\x20Activations:\x20'+_0x4a551d['join'](',\x20'));if(_0x2a8706){const _0x1448c1=getConsoleNextUrl(_0x4b36fa[_0x1c5b16(0x1d7)],_0x1c5b16(0x172)+_0x1c1075+_0x1c5b16(0x190)+_0x2a8706+'/sb/da/esr');console[_0x1c5b16(0x194)](_0x1c5b16(0x1e8)+a45_0x20a13d[_0x1c5b16(0x1ab)](_0x1448c1));}return 0x0;}}
1
+ const a46_0x129918=a46_0x3dc1;(function(_0x48ed7f,_0x29a7a2){const _0xc7e2c4=a46_0x3dc1,_0x50cbba=_0x48ed7f();while(!![]){try{const _0x7ef8b0=-parseInt(_0xc7e2c4(0x215))/0x1*(-parseInt(_0xc7e2c4(0x1c6))/0x2)+parseInt(_0xc7e2c4(0x196))/0x3+parseInt(_0xc7e2c4(0x1ac))/0x4*(-parseInt(_0xc7e2c4(0x191))/0x5)+parseInt(_0xc7e2c4(0x1c3))/0x6*(parseInt(_0xc7e2c4(0x18e))/0x7)+-parseInt(_0xc7e2c4(0x1fb))/0x8+parseInt(_0xc7e2c4(0x216))/0x9*(-parseInt(_0xc7e2c4(0x1c2))/0xa)+parseInt(_0xc7e2c4(0x1c9))/0xb*(parseInt(_0xc7e2c4(0x19b))/0xc);if(_0x7ef8b0===_0x29a7a2)break;else _0x50cbba['push'](_0x50cbba['shift']());}catch(_0x2829be){_0x50cbba['push'](_0x50cbba['shift']());}}}(a46_0xfcc6,0xad5a9));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';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a46_0x1a549a from'chalk';import{existsSync}from'fs';function a46_0xfcc6(){const _0x58d0d4=['Fetching\x20existing\x20activations...','toCreate','\x20\x20Activations:','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','dim','segment\x20or\x20journey','unchanged','segments','getParent','setPhase','delete','cyan','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','Aborted.','error','site','10kNhgkS','192uCxivs','\x20\x20\x20\x20','Changes\x20to:','194CqdaVx','new','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','11HiLWIg','diff','\x20unchanged','created','nameToId','journeys','buildUserMaps','Parent\x20segment:\x20','toDelete','push','\x0a✔\x20Push\x20complete','paused','isScoped','\x20activations]','journey','description','segmentFolderId','file','helpText','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','\x20\x20Source:\x20','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','listJourneysWithDetailsFromParentSegment','\x20\x20Segments:\x20','\x20deleted','createdAt','list','\x20\x20📊\x20Segments:','journeyBundleName','yamlConfig','updated','Source\x20directory:\x20','dryRun','New\x20journey:','\x20YAML\x20files\x20found','Resolving\x20parent\x20segment\x20\x27','\x20updated','user','Push\x20YAML\x20files\x20to\x20Treasure\x20AI\x20as\x20child\x20segments','targetDir','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','map','segment:push','isNew','segment','blue','audienceId','filePath','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','8166200VHepCq','activations','Folders\x20to\x20create:','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','\x0aPush\x20summary\x20for\x20\x27','data','attributes','\x20changes?','nameToType','length','folderPath','name','then','repeat','\x20to\x20create','parentSegment','Fetching\x20connections\x20for\x20name\x20resolution...','Error:\x20','filter','folderId','errorCode','green','execute','/j/da/je','\x0aValidation\x20failed:','/sb/da/esr','12334SrnoxH','715185PgoNNI','state','parentFolder','existingJourney','add','\x20new','existingSegment','createdSegmentIds','/app/ps/','message','Scoped\x20to\x20folder:\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','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)','Site:\x20','\x20to\x20delete','.yaml','Push\x20','type','journeyId','set','journeysOnly','300559NPzgTn','results','getMetadataWithCache','4985SrKSSO','red','Error:\x20Directory\x20not\x20found:\x20','scopedFolderPath','relationships','583275nwoQqu','all','verbose','parentName','\x20created','2412156jgHruL','yes','changed','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','idToName','endsWith','get','\x20\x20🗺️\x20\x20Journeys:','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','versionNumber','\x20\x20Journeys:\x20','\x20changed','\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20','/e/','New\x20segment:','connection','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','4636iRosRN','Delete\x20segment:','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','yellow','cwd','\x27...'];a46_0xfcc6=function(){return _0x58d0d4;};return a46_0xfcc6();}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';function a46_0x3dc1(_0x482c32,_0x173971){_0x482c32=_0x482c32-0x185;const _0xfcc6e5=a46_0xfcc6();let _0x3dc1be=_0xfcc6e5[_0x482c32];return _0x3dc1be;}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']=a46_0x129918(0x1f4);[a46_0x129918(0x1d8)]=a46_0x129918(0x1ef);async[a46_0x129918(0x211)](_0xd2eaf){const _0x1d7cc7=a46_0x129918,{options:_0x530dce,args:_0x18fdfe,tdx:_0x29b008}=_0xd2eaf,_0x43d300=_0x530dce,_0x1e4031=await resolveTarget({'arg':_0x18fdfe[0x0],'contextParent':_0x530dce[_0x1d7cc7(0x20a)],'cwd':process[_0x1d7cc7(0x1b0)]()});if(!isSuccessfulResolution(_0x1e4031))return _0x1e4031[_0x1d7cc7(0x20f)]==='no_parent'?(console[_0x1d7cc7(0x1c0)](a46_0x1a549a[_0x1d7cc7(0x1af)](_0x1d7cc7(0x221))),console['error'](_0x1d7cc7(0x185)),console[_0x1d7cc7(0x1c0)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent'),console[_0x1d7cc7(0x1c0)](_0x1d7cc7(0x19e))):(console[_0x1d7cc7(0x1c0)](a46_0x1a549a[_0x1d7cc7(0x192)](_0x1d7cc7(0x20c)+_0x1e4031[_0x1d7cc7(0x21f)]+'\x0a')),_0x1e4031[_0x1d7cc7(0x1db)]&&console[_0x1d7cc7(0x1c0)](a46_0x1a549a[_0x1d7cc7(0x1bd)](_0x1e4031[_0x1d7cc7(0x1db)]))),0x1;if(_0x1e4031[_0x1d7cc7(0x18a)]==='parent_name')return console[_0x1d7cc7(0x1c0)](a46_0x1a549a[_0x1d7cc7(0x192)](_0x1d7cc7(0x193)+_0x1e4031[_0x1d7cc7(0x1f0)]+'\x0a')),console['error'](a46_0x1a549a[_0x1d7cc7(0x1bd)](_0x1d7cc7(0x1a3))),0x1;const _0x1a42d0=_0x1e4031[_0x1d7cc7(0x199)],_0x305b39=_0x1e4031[_0x1d7cc7(0x1f0)],_0x17b4ee=_0x1e4031['type']===_0x1d7cc7(0x1da)?_0x1e4031[_0x1d7cc7(0x1f9)]:undefined,_0x58eaf2=getScopedDetails(_0x1e4031),_0x377030=_0x58eaf2?.[_0x1d7cc7(0x1d5)]??![],_0x57cbd5=_0x58eaf2?.[_0x1d7cc7(0x194)]??'';if(!existsSync(_0x305b39))return console[_0x1d7cc7(0x1c0)](a46_0x1a549a[_0x1d7cc7(0x192)]('Error:\x20Directory\x20not\x20found:\x20'+_0x305b39+'\x0a')),console[_0x1d7cc7(0x1c0)](a46_0x1a549a[_0x1d7cc7(0x1bd)](_0x1d7cc7(0x1a3))),0x1;_0x43d300[_0x1d7cc7(0x198)]&&(console[_0x1d7cc7(0x1c0)](_0x1d7cc7(0x186)+_0x43d300['site']),console[_0x1d7cc7(0x1c0)](_0x1d7cc7(0x1d0)+_0x1a42d0),console[_0x1d7cc7(0x1c0)](_0x1d7cc7(0x1e8)+_0x305b39),_0x377030&&console[_0x1d7cc7(0x1c0)](_0x1d7cc7(0x220)+_0x57cbd5));const _0x1a9df7=await withSpinner(_0x1d7cc7(0x1ec)+_0x1a42d0+_0x1d7cc7(0x1b1),()=>_0x29b008['segment']['resolveParentId'](_0x1a42d0),{'verbose':_0x43d300[_0x1d7cc7(0x198)]}),_0xae3ec2=_0x1a9df7[_0x1d7cc7(0x200)],{parentSegmentResult:_0x4c34ee,segmentsResult:_0x4b0c5e,foldersResult:_0x5bdac6,journeysWithDetailsResult:_0x43629a,userMaps:_0x3ade31}=await withSpinner('Fetching\x20existing\x20data...',async()=>{const _0x5e72db=_0x1d7cc7,[_0x260e71,_0x3815b7,_0x50e8b8,_0x1cecdd,_0x2a03b0]=await Promise[_0x5e72db(0x197)]([_0x29b008[_0x5e72db(0x1f6)][_0x5e72db(0x1ba)](_0xae3ec2),_0x29b008[_0x5e72db(0x1f6)]['listSegments'](_0xae3ec2),_0x29b008[_0x5e72db(0x1f6)]['listFolders'](_0xae3ec2),_0x29b008[_0x5e72db(0x1d7)][_0x5e72db(0x1df)](_0xae3ec2,{'includeAllVersions':!![]}),_0x29b008[_0x5e72db(0x1ee)][_0x5e72db(0x1cf)]()]);return{'parentSegmentResult':_0x260e71,'segmentsResult':_0x3815b7,'foldersResult':_0x50e8b8,'journeysWithDetailsResult':_0x1cecdd,'userMaps':_0x2a03b0};},{'verbose':_0x43d300[_0x1d7cc7(0x198)]})['then'](_0x5a44c9=>_0x5a44c9[_0x1d7cc7(0x200)]),_0x4c75b0=_0x4c34ee,_0x1e50f2=extractRootFolderId(_0x4c75b0),_0x743972=_0x4b0c5e,_0x18fa99=_0x5bdac6,{journeys:_0x52b8db,activationStepsById:_0x1d3357}=_0x43629a,_0x19cc34=new Map(_0x52b8db[_0x1d7cc7(0x1f3)](_0x5a4c89=>[_0x5a4c89['id'],_0x5a4c89])),_0x76a691=_0x52b8db[_0x1d7cc7(0x1f3)](_0x41895d=>({'id':_0x41895d['id'],'name':_0x41895d['attributes'][_0x1d7cc7(0x206)],'journeyBundleName':_0x41895d[_0x1d7cc7(0x201)][_0x1d7cc7(0x1e5)]||'','journeyBundleId':_0x41895d[_0x1d7cc7(0x201)]['journeyBundleId']||'','versionNumber':_0x41895d[_0x1d7cc7(0x201)][_0x1d7cc7(0x1a4)],'description':_0x41895d[_0x1d7cc7(0x201)][_0x1d7cc7(0x1d8)],'state':_0x41895d['attributes'][_0x1d7cc7(0x217)],'paused':_0x41895d['attributes'][_0x1d7cc7(0x1d4)],'audienceId':_0x41895d[_0x1d7cc7(0x201)][_0x1d7cc7(0x1f8)],'folderId':_0x41895d[_0x1d7cc7(0x195)]?.[_0x1d7cc7(0x218)]?.[_0x1d7cc7(0x200)]?.['id'],'createdAt':_0x41895d['attributes'][_0x1d7cc7(0x1e2)],'updatedAt':_0x41895d[_0x1d7cc7(0x201)]['updatedAt']})),{emailToId:_0x4380b1,idToEmail:_0x389279}=_0x3ade31,_0x1ac189=await withSpinner(_0x1d7cc7(0x20b),async()=>{const _0x31afd9=_0x1d7cc7,_0x1b1af2=await _0x29b008[_0x31afd9(0x1aa)][_0x31afd9(0x1e3)]();return buildConnectionMaps(_0x1b1af2);},{'verbose':_0x43d300[_0x1d7cc7(0x198)]})[_0x1d7cc7(0x207)](_0x2dca4d=>_0x2dca4d['data']),_0xad8d20=_0x1ac189[_0x1d7cc7(0x1cd)],_0x95e3b7=_0x1ac189['idToName'],_0x19a473=_0x1ac189[_0x1d7cc7(0x203)],_0x26c187={'emailToIdMap':_0x4380b1,'connectionNameToIdMap':_0xad8d20,'connectionNameToTypeMap':_0x19a473,'getSchema':_0x4f3aa2=>_0x29b008[_0x1d7cc7(0x1aa)]['getOutputSchemaWithCache'](_0x4f3aa2),'getMetadata':_0x35fe3e=>_0x29b008[_0x1d7cc7(0x1aa)][_0x1d7cc7(0x190)](_0x35fe3e)};let {pathToId:_0x552fde,idToPath:_0x122293}=buildFolderMaps(_0x18fa99);const _0x1ccd10=buildSegmentLookupMap(_0x743972,_0x122293),_0x98661c=buildSegmentNameToIdMap(_0x743972),_0x523466=buildJourneyBundleLookupMap(_0x76a691,_0x122293);let _0x76d782;if(_0x17b4ee){if(!_0x17b4ee[_0x1d7cc7(0x1a0)]('.yml')&&!_0x17b4ee['endsWith'](_0x1d7cc7(0x188)))return console[_0x1d7cc7(0x1c0)](a46_0x1a549a[_0x1d7cc7(0x192)](_0x1d7cc7(0x1fa)+_0x17b4ee+'\x0a')),0x1;_0x76d782=[_0x17b4ee];}else _0x76d782=findYamlFiles(_0x305b39);if(_0x76d782[_0x1d7cc7(0x204)]===0x0)return console[_0x1d7cc7(0x1c0)](a46_0x1a549a[_0x1d7cc7(0x192)](_0x1d7cc7(0x1ae)+_0x305b39+'\x0a')),console[_0x1d7cc7(0x1c0)](a46_0x1a549a[_0x1d7cc7(0x1bd)](_0x1d7cc7(0x1dc))),0x1;let _0x45ff9b,_0x16c96b;try{const _0x3a3fb0=parseAndClassifyYamlFiles(_0x76d782,_0x305b39,{'skipSegments':_0x43d300[_0x1d7cc7(0x18d)]});_0x45ff9b=_0x3a3fb0[_0x1d7cc7(0x1b9)],_0x16c96b=_0x3a3fb0['journeys'];const _0x12b66d=validateParsedFiles(_0x3a3fb0,_0x305b39);if(_0x12b66d['length']>0x0)return console[_0x1d7cc7(0x1c0)](a46_0x1a549a[_0x1d7cc7(0x192)](_0x1d7cc7(0x213))),console['error'](formatValidationErrors(_0x12b66d)),console[_0x1d7cc7(0x1c0)](a46_0x1a549a[_0x1d7cc7(0x1af)](_0x1d7cc7(0x1fe))),0x1;}catch(_0x4e909d){return console[_0x1d7cc7(0x1c0)](a46_0x1a549a['red']('Error\x20parsing\x20YAML:\x20'+(_0x4e909d instanceof Error?_0x4e909d['message']:_0x4e909d))),0x1;}if(_0x45ff9b[_0x1d7cc7(0x204)]===0x0&&_0x16c96b[_0x1d7cc7(0x204)]===0x0){const _0x1bd481=_0x43d300[_0x1d7cc7(0x18d)]?_0x1d7cc7(0x1d7):_0x1d7cc7(0x1b7);return console[_0x1d7cc7(0x1c0)](a46_0x1a549a['yellow']('No\x20'+_0x1bd481+_0x1d7cc7(0x1eb))),0x0;}const _0x198b00=new Map();_0x743972[_0x1d7cc7(0x204)]>0x0&&!_0x43d300[_0x1d7cc7(0x18d)]&&await withSpinner(_0x1d7cc7(0x1b2),async()=>{await batchAsync(_0x743972,async _0x34e691=>{const _0x47bb91=a46_0x3dc1,_0x31c19f=await _0x29b008[_0x47bb91(0x1f6)]['listActivations'](_0xae3ec2,_0x34e691['id']);_0x198b00[_0x47bb91(0x18c)](_0x34e691['id'],_0x31c19f);});},{'verbose':_0x43d300['verbose']});const {segmentFiles:_0x2ac7d0,foldersToCreate:_0x47baa8}=await prepareSegmentFiles(_0x45ff9b,{'segmentByFolderAndName':_0x1ccd10,'activationsBySegmentId':_0x198b00,'folderPathToId':_0x552fde,'idToEmailMap':_0x389279,'connectionIdToNameMap':_0x95e3b7},_0x26c187,_0x377030,_0x57cbd5),_0xbb641c=_0x17b4ee?[]:findSegmentsToDelete(_0x743972,_0x45ff9b[_0x1d7cc7(0x1f3)](({yamlConfig:_0x35253f,folderPath:_0x21e7c0})=>({'yamlConfig':_0x35253f,'folderPath':resolveTDFolderPath(_0x21e7c0,_0x377030,_0x57cbd5)})),_0x122293,_0x57cbd5,_0x377030),{journeyFiles:_0x718b30,foldersToCreate:_0x2a71cf}=await withProgressSpinner('Preparing\x20journeys...',async _0x3e701f=>prepareJourneyFiles(_0x16c96b,{'fetchJourney':async _0xe65d5e=>_0x29b008[_0x1d7cc7(0x1d7)]['getJourney'](_0xe65d5e[_0x1d7cc7(0x18b)]),'journeyBundlesByFolderAndName':_0x523466,'folderPathToId':_0x552fde,'idToEmailMap':_0x389279,'connectionIdToNameMap':_0x95e3b7,'existingSegments':_0x743972,'parentId':_0xae3ec2,'deps':_0x29b008,'progress':{'update':_0x4c45c7=>{const _0xfa405f=_0x1d7cc7;_0x3e701f[_0xfa405f(0x1bb)](_0x4c45c7),_0x43d300['verbose']&&console[_0xfa405f(0x1c0)]('\x20\x20'+_0x4c45c7);}},'journeyById':_0x19cc34,'activationStepsById':_0x1d3357},_0x377030,_0x57cbd5),{'verbose':_0x43d300[_0x1d7cc7(0x198)]})[_0x1d7cc7(0x207)](_0x2850f7=>_0x2850f7[_0x1d7cc7(0x200)]);for(const _0x2220bd of _0x2a71cf){_0x47baa8[_0x1d7cc7(0x21a)](_0x2220bd);}const _0x5ad7a2=_0x17b4ee?[]:findJourneysToDelete(_0x76a691,_0x16c96b[_0x1d7cc7(0x1f3)](({yamlConfig:_0x186abd,folderPath:_0x56fcd7})=>({'yamlConfig':_0x186abd,'folderPath':resolveTDFolderPath(_0x56fcd7,_0x377030,_0x57cbd5)})),_0x122293,_0x57cbd5,_0x377030),_0x40a234=calculatePushStats(_0x2ac7d0,_0x718b30,_0x47baa8,_0xbb641c,_0x5ad7a2,!!_0x43d300[_0x1d7cc7(0x1bc)],!!_0x43d300[_0x1d7cc7(0x18d)]),_0x15db8d=_0x40a234[_0x1d7cc7(0x1b9)][_0x1d7cc7(0x1c7)],_0x53bc8b=_0x40a234[_0x1d7cc7(0x1b9)][_0x1d7cc7(0x19d)],_0x2230c8=_0x40a234[_0x1d7cc7(0x1b9)][_0x1d7cc7(0x1b8)],_0x10e6ef=_0x40a234[_0x1d7cc7(0x1b9)][_0x1d7cc7(0x1d1)],_0xaf6978=_0x40a234['folders'][_0x1d7cc7(0x1b3)],_0x515fc9=_0x40a234[_0x1d7cc7(0x1ce)][_0x1d7cc7(0x1c7)],_0x18e829=_0x40a234[_0x1d7cc7(0x1ce)][_0x1d7cc7(0x19d)],_0x5e52f6=_0x40a234['journeys']['unchanged'],_0x17a954=_0x40a234[_0x1d7cc7(0x1ce)][_0x1d7cc7(0x1d1)],_0x2d285b=_0x40a234['activations']['all'],_0x44e517=_0x40a234[_0x1d7cc7(0x1fc)][_0x1d7cc7(0x1b3)],_0xf3749=_0x40a234['activations']['toUpdate'],_0x3bd48c=_0x40a234['activations'][_0x1d7cc7(0x1d1)];console[_0x1d7cc7(0x1c0)](_0x1d7cc7(0x1ff)+_0x1a42d0+'\x27:');_0xaf6978['length']>0x0&&console['error']('\x20\x20'+a46_0x1a549a[_0x1d7cc7(0x1f7)]('📁\x20'+_0xaf6978['length']+'\x20folders\x20to\x20create'));if(!_0x43d300[_0x1d7cc7(0x18d)]){console[_0x1d7cc7(0x1c0)](_0x1d7cc7(0x1e4)),console['error']('\x20\x20\x20\x20'+a46_0x1a549a[_0x1d7cc7(0x210)]('+\x20'+_0x15db8d[_0x1d7cc7(0x204)]+'\x20new')),console['error'](_0x1d7cc7(0x1c4)+a46_0x1a549a['yellow']('~\x20'+_0x53bc8b[_0x1d7cc7(0x204)]+_0x1d7cc7(0x1a6)));if(_0x10e6ef[_0x1d7cc7(0x204)]>0x0)console[_0x1d7cc7(0x1c0)](_0x1d7cc7(0x1c4)+a46_0x1a549a[_0x1d7cc7(0x192)]('-\x20'+_0x10e6ef['length']+_0x1d7cc7(0x187)));else _0xbb641c[_0x1d7cc7(0x204)]>0x0&&!_0x43d300[_0x1d7cc7(0x1bc)]&&console[_0x1d7cc7(0x1c0)]('\x20\x20\x20\x20'+a46_0x1a549a[_0x1d7cc7(0x1b6)](_0xbb641c[_0x1d7cc7(0x204)]+_0x1d7cc7(0x1f2)));console[_0x1d7cc7(0x1c0)](_0x1d7cc7(0x1c4)+a46_0x1a549a[_0x1d7cc7(0x1b6)]('=\x20'+_0x2230c8[_0x1d7cc7(0x204)]+_0x1d7cc7(0x1cb)));}if(_0x718b30[_0x1d7cc7(0x204)]>0x0||_0x5ad7a2[_0x1d7cc7(0x204)]>0x0){console['error'](_0x1d7cc7(0x1a2)),console[_0x1d7cc7(0x1c0)]('\x20\x20\x20\x20'+a46_0x1a549a[_0x1d7cc7(0x210)]('+\x20'+_0x515fc9[_0x1d7cc7(0x204)]+_0x1d7cc7(0x21b))),console['error'](_0x1d7cc7(0x1c4)+a46_0x1a549a[_0x1d7cc7(0x1af)]('~\x20'+_0x18e829[_0x1d7cc7(0x204)]+_0x1d7cc7(0x1a6)));if(_0x17a954[_0x1d7cc7(0x204)]>0x0)console[_0x1d7cc7(0x1c0)]('\x20\x20\x20\x20'+a46_0x1a549a[_0x1d7cc7(0x192)]('-\x20'+_0x17a954[_0x1d7cc7(0x204)]+_0x1d7cc7(0x187)));else _0x5ad7a2[_0x1d7cc7(0x204)]>0x0&&!_0x43d300['delete']&&console[_0x1d7cc7(0x1c0)](_0x1d7cc7(0x1c4)+a46_0x1a549a[_0x1d7cc7(0x1b6)](_0x5ad7a2[_0x1d7cc7(0x204)]+_0x1d7cc7(0x1f2)));console[_0x1d7cc7(0x1c0)](_0x1d7cc7(0x1c4)+a46_0x1a549a[_0x1d7cc7(0x1b6)]('=\x20'+_0x5e52f6['length']+_0x1d7cc7(0x1cb)));}_0x2d285b[_0x1d7cc7(0x204)]>0x0&&!_0x43d300[_0x1d7cc7(0x18d)]&&(console[_0x1d7cc7(0x1c0)](''),console['error'](_0x1d7cc7(0x1b4)),_0x44e517[_0x1d7cc7(0x204)]>0x0&&console[_0x1d7cc7(0x1c0)](_0x1d7cc7(0x1c4)+a46_0x1a549a['green']('+\x20'+_0x44e517[_0x1d7cc7(0x204)]+_0x1d7cc7(0x209))),_0xf3749[_0x1d7cc7(0x204)]>0x0&&console[_0x1d7cc7(0x1c0)](_0x1d7cc7(0x1c4)+a46_0x1a549a[_0x1d7cc7(0x1af)]('~\x20'+_0xf3749[_0x1d7cc7(0x204)]+'\x20to\x20update')),_0x3bd48c['length']>0x0&&console[_0x1d7cc7(0x1c0)](_0x1d7cc7(0x1c4)+a46_0x1a549a[_0x1d7cc7(0x192)]('-\x20'+_0x3bd48c['length']+_0x1d7cc7(0x187))));console[_0x1d7cc7(0x1c0)](_0x1d7cc7(0x1dd)+a46_0x1a549a[_0x1d7cc7(0x1bd)](_0x305b39)+'\x0a');if(_0xaf6978['length']>0x0){console[_0x1d7cc7(0x1c0)](_0x1d7cc7(0x1fd));for(const _0x9c0e28 of _0xaf6978){console[_0x1d7cc7(0x1c0)]('\x20\x20'+a46_0x1a549a['blue']('+')+'\x20'+_0x9c0e28);}console['error']('');}if(_0x15db8d[_0x1d7cc7(0x204)]>0x0&&!_0x43d300[_0x1d7cc7(0x18d)])for(const _0x2b20fe of _0x15db8d){const _0x3c0668=_0x2b20fe[_0x1d7cc7(0x205)]?_0x2b20fe[_0x1d7cc7(0x205)]+'/'+_0x2b20fe[_0x1d7cc7(0x1e6)][_0x1d7cc7(0x206)]:_0x2b20fe[_0x1d7cc7(0x1e6)][_0x1d7cc7(0x206)],_0x1c17d9=_0x2b20fe[_0x1d7cc7(0x1e6)][_0x1d7cc7(0x1fc)]?.[_0x1d7cc7(0x204)]||0x0,_0x2eeb07=_0x1c17d9>0x0?a46_0x1a549a[_0x1d7cc7(0x1b6)]('\x20['+_0x1c17d9+'\x20activations]'):'';console[_0x1d7cc7(0x1c0)]('\x0a'+a46_0x1a549a[_0x1d7cc7(0x210)](_0x1d7cc7(0x1a9))+'\x20'+_0x3c0668+_0x2eeb07),console[_0x1d7cc7(0x1c0)]('─'[_0x1d7cc7(0x208)](0x3c)),_0x2b20fe[_0x1d7cc7(0x1ca)]&&console[_0x1d7cc7(0x1c0)](_0x2b20fe[_0x1d7cc7(0x1ca)]),console[_0x1d7cc7(0x1c0)]('─'[_0x1d7cc7(0x208)](0x3c));}if(_0x10e6ef[_0x1d7cc7(0x204)]>0x0&&!_0x43d300['journeysOnly'])for(const _0x5a8fa4 of _0x10e6ef){const _0x30ef2b=_0x5a8fa4['segmentFolderId']?_0x122293[_0x1d7cc7(0x1a1)](_0x5a8fa4[_0x1d7cc7(0x1d9)]['toString']())||'':'',_0x4d26d8=_0x30ef2b?_0x30ef2b+'/'+_0x5a8fa4[_0x1d7cc7(0x206)]:_0x5a8fa4[_0x1d7cc7(0x206)],_0x5444ec=_0x198b00[_0x1d7cc7(0x1a1)](_0x5a8fa4['id'])||[],_0x490724=_0x5444ec[_0x1d7cc7(0x204)]>0x0?a46_0x1a549a[_0x1d7cc7(0x1b6)]('\x20['+_0x5444ec[_0x1d7cc7(0x204)]+_0x1d7cc7(0x1d6)):'';console[_0x1d7cc7(0x1c0)]('\x0a'+a46_0x1a549a[_0x1d7cc7(0x192)](_0x1d7cc7(0x1ad))+'\x20'+_0x4d26d8+_0x490724),console[_0x1d7cc7(0x1c0)]('─'[_0x1d7cc7(0x208)](0x3c));const _0x3beab2=segmentWithActivationsToYaml(_0x5a8fa4,_0x5444ec,undefined,_0x389279,_0x95e3b7),_0x22aff8=segmentToYamlString(_0x3beab2),_0x5386d4=generateDiff(_0x22aff8,'');console[_0x1d7cc7(0x1c0)](formatDiffWithColors(_0x5386d4)),console['error']('─'[_0x1d7cc7(0x208)](0x3c));}const _0x4d76b0=_0x2ac7d0[_0x1d7cc7(0x20d)](_0x8fe0b3=>!_0x8fe0b3[_0x1d7cc7(0x1f5)]&&_0x8fe0b3['diff']);if(_0x4d76b0[_0x1d7cc7(0x204)]>0x0&&!_0x43d300['journeysOnly'])for(const _0x1d7c12 of _0x4d76b0){const _0x2becab=_0x1d7c12[_0x1d7cc7(0x205)]?_0x1d7c12[_0x1d7cc7(0x205)]+'/'+_0x1d7c12[_0x1d7cc7(0x1e6)][_0x1d7cc7(0x206)]:_0x1d7c12[_0x1d7cc7(0x1e6)][_0x1d7cc7(0x206)];console[_0x1d7cc7(0x1c0)]('\x0a'+a46_0x1a549a[_0x1d7cc7(0x1af)](_0x1d7cc7(0x1c5))+'\x20'+_0x2becab),console[_0x1d7cc7(0x1c0)]('─'['repeat'](0x3c)),console[_0x1d7cc7(0x1c0)](_0x1d7c12[_0x1d7cc7(0x1ca)]),console['error']('─'[_0x1d7cc7(0x208)](0x3c));}if(_0x515fc9[_0x1d7cc7(0x204)]>0x0)for(const _0x28c76a of _0x515fc9){const _0x371ab8=_0x28c76a[_0x1d7cc7(0x205)]?_0x28c76a[_0x1d7cc7(0x205)]+'/'+_0x28c76a['yamlConfig']['name']:_0x28c76a[_0x1d7cc7(0x1e6)][_0x1d7cc7(0x206)];console[_0x1d7cc7(0x1c0)]('\x0a'+a46_0x1a549a[_0x1d7cc7(0x210)](_0x1d7cc7(0x1ea))+'\x20'+_0x371ab8),console[_0x1d7cc7(0x1c0)]('─'[_0x1d7cc7(0x208)](0x3c)),_0x28c76a[_0x1d7cc7(0x1ca)]&&console[_0x1d7cc7(0x1c0)](_0x28c76a['diff']),console[_0x1d7cc7(0x1c0)]('─'['repeat'](0x3c));}const _0x3b7450=_0x718b30[_0x1d7cc7(0x20d)](_0x540be1=>!_0x540be1[_0x1d7cc7(0x1f5)]&&_0x540be1[_0x1d7cc7(0x1ca)]);if(_0x3b7450['length']>0x0)for(const _0x44b7ed of _0x3b7450){const _0x2cd68c=_0x44b7ed[_0x1d7cc7(0x205)]?_0x44b7ed[_0x1d7cc7(0x205)]+'/'+_0x44b7ed['yamlConfig'][_0x1d7cc7(0x206)]:_0x44b7ed[_0x1d7cc7(0x1e6)]['name'];console[_0x1d7cc7(0x1c0)]('\x0a'+a46_0x1a549a['yellow']('Changes\x20to\x20journey:')+'\x20'+_0x2cd68c),console[_0x1d7cc7(0x1c0)]('─'[_0x1d7cc7(0x208)](0x3c)),console[_0x1d7cc7(0x1c0)](_0x44b7ed[_0x1d7cc7(0x1ca)]),console[_0x1d7cc7(0x1c0)]('─'[_0x1d7cc7(0x208)](0x3c));}if(_0x17a954[_0x1d7cc7(0x204)]>0x0)for(const _0x830e1e of _0x17a954){const _0x54f52f=_0x830e1e[_0x1d7cc7(0x20e)]?_0x122293['get'](_0x830e1e['folderId'])||'':'',_0x4a2006=_0x54f52f?_0x54f52f+'/'+_0x830e1e[_0x1d7cc7(0x1e5)]:_0x830e1e['journeyBundleName'];console['error']('\x0a'+a46_0x1a549a[_0x1d7cc7(0x192)]('Delete\x20journey:')+'\x20'+_0x4a2006),console[_0x1d7cc7(0x1c0)]('─'['repeat'](0x3c)),console['error'](a46_0x1a549a['red']('(Journey\x20will\x20be\x20deleted)')),console['error']('─'[_0x1d7cc7(0x208)](0x3c));}if(_0x43d300[_0x1d7cc7(0x1e9)])return console[_0x1d7cc7(0x1c0)](a46_0x1a549a[_0x1d7cc7(0x1af)](_0x1d7cc7(0x1b5))),0x0;const _0xe884e4=_0x43d300['journeysOnly']?![]:_0x15db8d[_0x1d7cc7(0x204)]>0x0||_0x53bc8b[_0x1d7cc7(0x204)]>0x0||_0x10e6ef['length']>0x0,_0x8e1ec3=_0x515fc9[_0x1d7cc7(0x204)]>0x0||_0x18e829[_0x1d7cc7(0x204)]>0x0||_0x17a954['length']>0x0,_0xd68c7c=_0x43d300['journeysOnly']?![]:_0x2d285b['length']>0x0,_0x3c1444=_0xaf6978[_0x1d7cc7(0x204)]>0x0;if(!_0xe884e4&&!_0x8e1ec3&&!_0xd68c7c&&!_0x3c1444){const _0x10b865=_0x43d300[_0x1d7cc7(0x18d)]?_0x1d7cc7(0x1be):_0x1d7cc7(0x1de);console['error'](a46_0x1a549a[_0x1d7cc7(0x210)](_0x10b865));if(_0x17b4ee&&_0x2230c8['length']===0x1){const _0x308a9f=_0x2230c8[0x0];if(_0x308a9f[_0x1d7cc7(0x21c)]?.['id']){const _0x40efc3=getConsoleNextUrl(_0x43d300[_0x1d7cc7(0x1c1)],_0x1d7cc7(0x21e)+_0xae3ec2+_0x1d7cc7(0x1a8)+_0x308a9f['existingSegment']['id']+_0x1d7cc7(0x214));console['error'](_0x1d7cc7(0x1a7)+a46_0x1a549a[_0x1d7cc7(0x1bd)](_0x40efc3));}}if(_0x17b4ee&&_0x5e52f6['length']===0x1){const _0x2aa40c=_0x5e52f6[0x0];if(_0x2aa40c[_0x1d7cc7(0x219)]?.['id']){const _0x22cbbe=getConsoleNextUrl(_0x43d300[_0x1d7cc7(0x1c1)],'/app/ps/'+_0xae3ec2+_0x1d7cc7(0x1a8)+_0x2aa40c[_0x1d7cc7(0x219)]['id']+_0x1d7cc7(0x212));console[_0x1d7cc7(0x1c0)]('\x20\x20'+a46_0x1a549a[_0x1d7cc7(0x1bd)](_0x22cbbe));}}return 0x0;}const _0x2d39c4=_0x43d300[_0x1d7cc7(0x18d)]?_0x515fc9[_0x1d7cc7(0x204)]+_0x18e829[_0x1d7cc7(0x204)]+_0x17a954[_0x1d7cc7(0x204)]+_0xaf6978[_0x1d7cc7(0x204)]:_0x15db8d[_0x1d7cc7(0x204)]+_0x53bc8b[_0x1d7cc7(0x204)]+_0x10e6ef['length']+_0x515fc9['length']+_0x18e829[_0x1d7cc7(0x204)]+_0x17a954['length']+_0xaf6978[_0x1d7cc7(0x204)]+_0x2d285b[_0x1d7cc7(0x204)];if(!_0x43d300[_0x1d7cc7(0x19c)]&&_0x2d39c4>0x0){if(!isInteractive())return console['error'](a46_0x1a549a[_0x1d7cc7(0x192)]('\x0aError:'),_0x1d7cc7(0x1f1)),console[_0x1d7cc7(0x1c0)](a46_0x1a549a[_0x1d7cc7(0x1b6)](_0x1d7cc7(0x1ab))),0x1;const _0x3cdad4=await confirmKey(_0x1d7cc7(0x189)+_0x2d39c4+_0x1d7cc7(0x202));if(!_0x3cdad4)return console[_0x1d7cc7(0x1c0)](a46_0x1a549a['yellow'](_0x1d7cc7(0x1bf))),0x1;}const _0x1498fb={'withProgress':async(_0x1037ea,_0x8b0ab6)=>{const _0x53215d=_0x1d7cc7,_0x639237=await withSpinner(_0x1037ea,_0x8b0ab6,{'verbose':_0x43d300[_0x53215d(0x198)]});return{'data':_0x639237[_0x53215d(0x200)]};},'logInfo':_0x43e46d=>console['error'](a46_0x1a549a[_0x1d7cc7(0x1f7)]('✔\x20'+_0x43e46d)),'logSuccess':_0x2a1a51=>console[_0x1d7cc7(0x1c0)](a46_0x1a549a['green']('✔\x20'+_0x2a1a51)),'logWarning':_0x119013=>console[_0x1d7cc7(0x1c0)](a46_0x1a549a['yellow']('⚠\x20'+_0x119013)),'logDeleted':_0x3bf61e=>console['error'](a46_0x1a549a[_0x1d7cc7(0x192)]('✔\x20'+_0x3bf61e))},_0x3416f4={'segment':_0x29b008['segment'],'journey':_0x29b008[_0x1d7cc7(0x1d7)],'user':_0x29b008[_0x1d7cc7(0x1ee)],'connection':_0x29b008[_0x1d7cc7(0x1aa)]};_0xaf6978[_0x1d7cc7(0x204)]>0x0&&(_0x552fde=await executePushFolders(_0x3416f4,_0xaf6978,_0x552fde,{'parentId':_0xae3ec2},_0x1498fb));const _0x39c517={'rootFolderId':_0x1e50f2,'folderPathToId':_0x552fde,'folderIdToPath':_0x122293,'segmentNameToId':_0x98661c,'activationsBySegmentId':_0x198b00,'emailToIdMap':_0x4380b1,'idToEmailMap':_0x389279,'connectionNameToIdMap':_0x1ac189[_0x1d7cc7(0x1cd)],'connectionIdToNameMap':_0x1ac189[_0x1d7cc7(0x19f)],'connectionNameToTypeMap':_0x19a473},_0x80e5ea=await executePushSegments(_0x3416f4,_0x43d300['journeysOnly']?[]:_0x2ac7d0,_0x39c517,{'parentId':_0xae3ec2},_0x1498fb),_0x19a78f=_0x80e5ea[_0x1d7cc7(0x1cc)],_0x50c1be=_0x80e5ea['updated'],_0x2604ff=_0x80e5ea[_0x1d7cc7(0x1fc)][_0x1d7cc7(0x1cc)],_0x352133=_0x80e5ea[_0x1d7cc7(0x1fc)][_0x1d7cc7(0x1e7)],_0x22fb02=_0x80e5ea[_0x1d7cc7(0x1fc)]['deleted'];let _0x9fdf2e;if(_0x17b4ee&&_0x2ac7d0[_0x1d7cc7(0x204)]===0x1){const _0x3333ef=_0x2ac7d0[0x0];_0x9fdf2e=_0x3333ef[_0x1d7cc7(0x21c)]?.['id']??_0x80e5ea[_0x1d7cc7(0x21d)]['get'](_0x3333ef[_0x1d7cc7(0x1e6)][_0x1d7cc7(0x206)]);}const _0x470eae=await executePushSegmentDeletions(_0x3416f4,_0x43d300[_0x1d7cc7(0x18d)]?[]:_0x10e6ef,_0x1498fb);let _0x5e1010=0x0,_0x336378=0x0,_0xacd2d7=0x0;const _0xffec78=new Map(_0x98661c);for(const [_0x4b227f,_0x4f48de]of _0x80e5ea[_0x1d7cc7(0x21d)]){_0xffec78[_0x1d7cc7(0x18c)](_0x4b227f,_0x4f48de);}if(_0x718b30['length']>0x0){const _0x145714={..._0x39c517,'segmentNameToId':_0xffec78,'existingSegments':_0x743972,'activationContext':_0x26c187},_0x3486f2=await executePushJourneys(_0x3416f4,_0x718b30,_0x145714,{'parentId':_0xae3ec2,'rootFolderId':_0x1e50f2,'verbose':_0x43d300[_0x1d7cc7(0x198)]},_0x1498fb);_0x5e1010=_0x3486f2[_0x1d7cc7(0x1cc)],_0x336378=_0x3486f2[_0x1d7cc7(0x1e7)];if(_0x17b4ee&&_0x3486f2[_0x1d7cc7(0x18f)][_0x1d7cc7(0x204)]===0x1){const _0x7ee017=_0x3486f2[_0x1d7cc7(0x18f)][0x0];if(_0x7ee017[_0x1d7cc7(0x18b)]){const _0xe605bc=getConsoleNextUrl(_0x43d300['site'],_0x1d7cc7(0x21e)+_0xae3ec2+_0x1d7cc7(0x1a8)+_0x7ee017[_0x1d7cc7(0x18b)]+_0x1d7cc7(0x212));console[_0x1d7cc7(0x1c0)]('\x20\x20'+a46_0x1a549a[_0x1d7cc7(0x1bd)](_0xe605bc));}}}for(const _0x1b70af of _0x17a954){console[_0x1d7cc7(0x1c0)](a46_0x1a549a[_0x1d7cc7(0x1af)](_0x1d7cc7(0x1c8)+_0x1b70af[_0x1d7cc7(0x1e5)])),_0xacd2d7++;}const _0x3067d6=[];if(_0x19a78f>0x0)_0x3067d6[_0x1d7cc7(0x1d2)](_0x19a78f+_0x1d7cc7(0x19a));if(_0x50c1be>0x0)_0x3067d6[_0x1d7cc7(0x1d2)](_0x50c1be+_0x1d7cc7(0x1ed));if(_0x470eae>0x0)_0x3067d6[_0x1d7cc7(0x1d2)](_0x470eae+_0x1d7cc7(0x1e1));const _0x3515cf=[];if(_0x5e1010>0x0)_0x3515cf[_0x1d7cc7(0x1d2)](_0x5e1010+'\x20created');if(_0x336378>0x0)_0x3515cf[_0x1d7cc7(0x1d2)](_0x336378+_0x1d7cc7(0x1ed));if(_0xacd2d7>0x0)_0x3515cf['push'](_0xacd2d7+_0x1d7cc7(0x1e1));const _0xb5467f=[];if(_0x2604ff>0x0)_0xb5467f['push'](_0x2604ff+_0x1d7cc7(0x19a));if(_0x352133>0x0)_0xb5467f[_0x1d7cc7(0x1d2)](_0x352133+'\x20updated');if(_0x22fb02>0x0)_0xb5467f['push'](_0x22fb02+_0x1d7cc7(0x1e1));console['error'](a46_0x1a549a[_0x1d7cc7(0x210)](_0x1d7cc7(0x1d3)));_0x3067d6[_0x1d7cc7(0x204)]>0x0&&!_0x43d300[_0x1d7cc7(0x18d)]&&console[_0x1d7cc7(0x1c0)](_0x1d7cc7(0x1e0)+_0x3067d6['join'](',\x20'));_0x3515cf[_0x1d7cc7(0x204)]>0x0&&console[_0x1d7cc7(0x1c0)](_0x1d7cc7(0x1a5)+_0x3515cf['join'](',\x20'));_0xb5467f['length']>0x0&&!_0x43d300[_0x1d7cc7(0x18d)]&&console[_0x1d7cc7(0x1c0)]('\x20\x20Activations:\x20'+_0xb5467f['join'](',\x20'));if(_0x9fdf2e){const _0x20cfaa=getConsoleNextUrl(_0x43d300['site'],'/app/ps/'+_0xae3ec2+_0x1d7cc7(0x1a8)+_0x9fdf2e+_0x1d7cc7(0x214));console[_0x1d7cc7(0x1c0)](_0x1d7cc7(0x1a7)+a46_0x1a549a['cyan'](_0x20cfaa));}return 0x0;}}
@@ -1 +1 @@
1
- const a46_0x1e642f=a46_0x14df;(function(_0x555137,_0x1b3075){const _0x1d4e37=a46_0x14df,_0x59a155=_0x555137();while(!![]){try{const _0x16c698=parseInt(_0x1d4e37(0xca))/0x1+-parseInt(_0x1d4e37(0xcf))/0x2*(parseInt(_0x1d4e37(0xd8))/0x3)+parseInt(_0x1d4e37(0xc1))/0x4*(-parseInt(_0x1d4e37(0xbc))/0x5)+parseInt(_0x1d4e37(0xb5))/0x6+-parseInt(_0x1d4e37(0xd3))/0x7*(parseInt(_0x1d4e37(0xb4))/0x8)+parseInt(_0x1d4e37(0xbf))/0x9*(-parseInt(_0x1d4e37(0xc6))/0xa)+parseInt(_0x1d4e37(0xd6))/0xb;if(_0x16c698===_0x1b3075)break;else _0x59a155['push'](_0x59a155['shift']());}catch(_0xfb6983){_0x59a155['push'](_0x59a155['shift']());}}}(a46_0x15a5,0x71f26));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a46_0x14df(_0x4ed70a,_0x2279b2){_0x4ed70a=_0x4ed70a-0xae;const _0x15a53d=a46_0x15a5();let _0x14dfc0=_0x15a53d[_0x4ed70a];return _0x14dfc0;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a46_0x57cd7b from'chalk';function a46_0x15a5(){const _0x165aa8=['884666MLWwgi','Parent\x20ID:\x20','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','segmentId','description','1210174bRkxyX','segmentPath','\x27...','Resolving\x20folder\x20\x27','133LXCTCk','Error:\x20Cannot\x20update\x20','name','8855517KYORku','ruleFile','3ujHSXR','Examples:','type','kind','segment','parentId','Resolved\x20type:\x20','segmentName','verbose','Resolved\x20folder\x20ID:\x20','104816kwzOOF','1137516qysTjh','data','\x20\x20\x20Path:\x20','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','length','Update\x20existing\x20child\x20segment','execute','215vXgcWe','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','Resolving\x20path\x20\x27','519417YOwAvA','Segment\x20ID:\x20','35852oPkaPm','rule','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','updateSegmentById','Segment\x20ID\x20missing\x20from\x20resolved\x20path','30GrRNkv','folder','yellow','error'];a46_0x15a5=function(){return _0x165aa8;};return a46_0x15a5();}export class SegmentUpdateCommand extends BaseCommand{[a46_0x1e642f(0xd5)]='segment:update';[a46_0x1e642f(0xce)]=a46_0x1e642f(0xba);async[a46_0x1e642f(0xbb)](_0x54ed89){const _0x4aa6f2=a46_0x1e642f;console[_0x4aa6f2(0xc9)](a46_0x57cd7b[_0x4aa6f2(0xc8)](_0x4aa6f2(0xb8))),console[_0x4aa6f2(0xc9)](a46_0x57cd7b[_0x4aa6f2(0xc8)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0xe50dd0,args:_0x2c91e1,tdx:_0xc4b218}=_0x54ed89,_0x3a3e67=_0xe50dd0;if(_0x2c91e1[_0x4aa6f2(0xb9)]===0x0)return console['error'](_0x4aa6f2(0xcc)),console[_0x4aa6f2(0xc9)]('Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]'),console[_0x4aa6f2(0xc9)](_0x4aa6f2(0xd9)),console['error'](_0x4aa6f2(0xbd)),console[_0x4aa6f2(0xc9)](_0x4aa6f2(0xc3)),0x1;const _0xb55c8f=_0x2c91e1[0x0],_0x55a30e=_0xe50dd0[_0x4aa6f2(0xd0)];let _0x125829=_0xb55c8f;_0x55a30e&&!_0xb55c8f['includes']('/')&&(_0x125829=_0x55a30e+'/'+_0xb55c8f,_0x3a3e67['verbose']&&console[_0x4aa6f2(0xc9)]('Resolved\x20relative\x20path\x20to:\x20'+_0x125829));const _0x3f2c44=await withSpinner(_0x4aa6f2(0xbe)+_0x125829+'\x27...',()=>_0xc4b218[_0x4aa6f2(0xae)]['resolvePathToResource'](_0x125829),{'verbose':_0x3a3e67['verbose']}),_0xce1b51=_0x3f2c44['data'];_0x3a3e67[_0x4aa6f2(0xb2)]&&console['error'](_0x4aa6f2(0xb0)+_0xce1b51[_0x4aa6f2(0xda)]);if(_0xce1b51[_0x4aa6f2(0xda)]!==_0x4aa6f2(0xae))return console[_0x4aa6f2(0xc9)](_0x4aa6f2(0xd4)+_0xce1b51[_0x4aa6f2(0xda)]+'.\x20Only\x20child\x20segments\x20can\x20be\x20updated.'),console['error']('Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]'),0x1;if(!_0xce1b51['segmentId'])throw new SDKError(ErrorCode['INTERNAL'],_0x4aa6f2(0xc5));const _0x3d86db=_0xce1b51[_0x4aa6f2(0xaf)],_0x17e14b=_0xce1b51[_0x4aa6f2(0xcd)];_0x3a3e67[_0x4aa6f2(0xb2)]&&(console[_0x4aa6f2(0xc9)](_0x4aa6f2(0xcb)+_0x3d86db),console[_0x4aa6f2(0xc9)](_0x4aa6f2(0xc0)+_0x17e14b));let _0x19dfd5;if(_0x3a3e67[_0x4aa6f2(0xc7)]){const _0x2163df=_0x3a3e67[_0x4aa6f2(0xc7)],_0x141f18=await withSpinner(_0x4aa6f2(0xd2)+_0x2163df+_0x4aa6f2(0xd1),()=>_0xc4b218[_0x4aa6f2(0xae)]['resolveFolderId'](_0x3d86db,_0x2163df),{'verbose':_0x3a3e67[_0x4aa6f2(0xb2)]});_0x19dfd5=parseInt(_0x141f18[_0x4aa6f2(0xb6)],0xa),_0x3a3e67[_0x4aa6f2(0xb2)]&&console[_0x4aa6f2(0xc9)](_0x4aa6f2(0xb3)+_0x19dfd5);}const _0x5f3134=await loadJSONFromOptions(_0x3a3e67[_0x4aa6f2(0xc2)],_0x3a3e67[_0x4aa6f2(0xd7)]),_0x3a2916={'name':_0x3a3e67[_0x4aa6f2(0xd5)],'description':_0x3a3e67[_0x4aa6f2(0xce)],'rule':_0x5f3134,'kind':_0x3a3e67['kind']!==undefined?parseInt(_0x3a3e67[_0x4aa6f2(0xdb)],0xa):undefined,'segmentFolderId':_0x19dfd5},_0x5eca6e=await withSpinner('Updating\x20segment\x20\x27'+_0xce1b51[_0x4aa6f2(0xb1)]+_0x4aa6f2(0xd1),()=>_0xc4b218[_0x4aa6f2(0xae)][_0x4aa6f2(0xc4)](_0x3d86db,_0x17e14b,_0x3a2916),{'verbose':_0x3a3e67[_0x4aa6f2(0xb2)]}),_0x3f71f3=_0x5eca6e[_0x4aa6f2(0xb6)];return console[_0x4aa6f2(0xc9)]('✔\x20Updated\x20segment\x20\x27'+_0x3f71f3[_0x4aa6f2(0xd5)]+'\x27'),_0x125829!==_0xb55c8f&&console['error'](_0x4aa6f2(0xb7)+_0x125829),await handleSDKOutput([_0x3f71f3],_0x3a3e67),0x0;}}
1
+ const a47_0x30d5f0=a47_0x1fa9;(function(_0x17db25,_0x28deaa){const _0x92ddf6=a47_0x1fa9,_0x4d55c7=_0x17db25();while(!![]){try{const _0x199e11=parseInt(_0x92ddf6(0x16c))/0x1+-parseInt(_0x92ddf6(0x15d))/0x2*(parseInt(_0x92ddf6(0x154))/0x3)+parseInt(_0x92ddf6(0x171))/0x4*(parseInt(_0x92ddf6(0x165))/0x5)+-parseInt(_0x92ddf6(0x157))/0x6*(parseInt(_0x92ddf6(0x16e))/0x7)+parseInt(_0x92ddf6(0x17f))/0x8+parseInt(_0x92ddf6(0x17a))/0x9*(parseInt(_0x92ddf6(0x14f))/0xa)+-parseInt(_0x92ddf6(0x161))/0xb;if(_0x199e11===_0x28deaa)break;else _0x4d55c7['push'](_0x4d55c7['shift']());}catch(_0x3f7f7e){_0x4d55c7['push'](_0x4d55c7['shift']());}}}(a47_0x3797,0x9cd33));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 a47_0x29603a from'chalk';function a47_0x3797(){const _0x3bbe90=['Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','segmentName','235752ESIlap','segment:update','data','error','\x20\x20\x20Path:\x20','rule','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','yellow','Segment\x20ID\x20missing\x20from\x20resolved\x20path','1455165ImNEKH','folder','kind','segmentPath','includes','4553752ulvNsi','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','20YoZMpG','Updating\x20segment\x20\x27','Resolved\x20type:\x20','✔\x20Updated\x20segment\x20\x27','\x27...','3246dkgUIL','Examples:','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','12hFiyyq','segmentId','length','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','type','INTERNAL','326XGUDMV','resolvePathToResource','name','Segment\x20ID:\x20','4884594FoEmqC','ruleFile','execute','verbose','25STrSzq','updateSegmentById','Resolved\x20relative\x20path\x20to:\x20','Update\x20existing\x20child\x20segment','Error:\x20Cannot\x20update\x20','segment','description','492580aCGROf','Parent\x20ID:\x20','1459794cyqeKx'];a47_0x3797=function(){return _0x3bbe90;};return a47_0x3797();}function a47_0x1fa9(_0x3b7d06,_0x4fe285){_0x3b7d06=_0x3b7d06-0x14d;const _0x379732=a47_0x3797();let _0x1fa90a=_0x379732[_0x3b7d06];return _0x1fa90a;}export class SegmentUpdateCommand extends BaseCommand{['name']=a47_0x30d5f0(0x172);[a47_0x30d5f0(0x16b)]=a47_0x30d5f0(0x168);async[a47_0x30d5f0(0x163)](_0x4fcddf){const _0x4e3628=a47_0x30d5f0;console[_0x4e3628(0x174)](a47_0x29603a[_0x4e3628(0x178)](_0x4e3628(0x14d))),console['error'](a47_0x29603a['yellow'](_0x4e3628(0x14e)));const {options:_0x11cb82,args:_0x283d3d,tdx:_0x1f1154}=_0x4fcddf,_0x374b65=_0x11cb82;if(_0x283d3d[_0x4e3628(0x159)]===0x0)return console['error'](_0x4e3628(0x16f)),console[_0x4e3628(0x174)](_0x4e3628(0x156)),console['error'](_0x4e3628(0x155)),console['error']('\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22'),console[_0x4e3628(0x174)]('\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x560672=_0x283d3d[0x0],_0xadfa3e=_0x11cb82[_0x4e3628(0x17d)];let _0x442f48=_0x560672;_0xadfa3e&&!_0x560672[_0x4e3628(0x17e)]('/')&&(_0x442f48=_0xadfa3e+'/'+_0x560672,_0x374b65[_0x4e3628(0x164)]&&console[_0x4e3628(0x174)](_0x4e3628(0x167)+_0x442f48));const _0x4b70ea=await withSpinner('Resolving\x20path\x20\x27'+_0x442f48+_0x4e3628(0x153),()=>_0x1f1154[_0x4e3628(0x16a)][_0x4e3628(0x15e)](_0x442f48),{'verbose':_0x374b65[_0x4e3628(0x164)]}),_0x1d9160=_0x4b70ea[_0x4e3628(0x173)];_0x374b65[_0x4e3628(0x164)]&&console['error'](_0x4e3628(0x151)+_0x1d9160[_0x4e3628(0x15b)]);if(_0x1d9160['type']!==_0x4e3628(0x16a))return console[_0x4e3628(0x174)](_0x4e3628(0x169)+_0x1d9160['type']+_0x4e3628(0x15a)),console[_0x4e3628(0x174)](_0x4e3628(0x177)),0x1;if(!_0x1d9160[_0x4e3628(0x158)])throw new SDKError(ErrorCode[_0x4e3628(0x15c)],_0x4e3628(0x179));const _0x10f203=_0x1d9160['parentId'],_0x31478d=_0x1d9160['segmentId'];_0x374b65['verbose']&&(console[_0x4e3628(0x174)](_0x4e3628(0x16d)+_0x10f203),console[_0x4e3628(0x174)](_0x4e3628(0x160)+_0x31478d));let _0x31ad0;if(_0x374b65[_0x4e3628(0x17b)]){const _0x152a91=_0x374b65['folder'],_0x2387e1=await withSpinner('Resolving\x20folder\x20\x27'+_0x152a91+_0x4e3628(0x153),()=>_0x1f1154[_0x4e3628(0x16a)]['resolveFolderId'](_0x10f203,_0x152a91),{'verbose':_0x374b65['verbose']});_0x31ad0=parseInt(_0x2387e1['data'],0xa),_0x374b65['verbose']&&console[_0x4e3628(0x174)]('Resolved\x20folder\x20ID:\x20'+_0x31ad0);}const _0x4356d3=await loadJSONFromOptions(_0x374b65[_0x4e3628(0x176)],_0x374b65[_0x4e3628(0x162)]),_0x334e3a={'name':_0x374b65[_0x4e3628(0x15f)],'description':_0x374b65[_0x4e3628(0x16b)],'rule':_0x4356d3,'kind':_0x374b65[_0x4e3628(0x17c)]!==undefined?parseInt(_0x374b65[_0x4e3628(0x17c)],0xa):undefined,'segmentFolderId':_0x31ad0},_0x3476cd=await withSpinner(_0x4e3628(0x150)+_0x1d9160[_0x4e3628(0x170)]+_0x4e3628(0x153),()=>_0x1f1154['segment'][_0x4e3628(0x166)](_0x10f203,_0x31478d,_0x334e3a),{'verbose':_0x374b65[_0x4e3628(0x164)]}),_0x32a940=_0x3476cd['data'];return console[_0x4e3628(0x174)](_0x4e3628(0x152)+_0x32a940['name']+'\x27'),_0x442f48!==_0x560672&&console[_0x4e3628(0x174)](_0x4e3628(0x175)+_0x442f48),await handleSDKOutput([_0x32a940],_0x374b65),0x0;}}
@@ -1 +1 @@
1
- const a47_0x31ed10=a47_0x4c28;(function(_0x25840a,_0xbb014f){const _0x45eff2=a47_0x4c28,_0x5e8976=_0x25840a();while(!![]){try{const _0x1b0e66=parseInt(_0x45eff2(0x228))/0x1+parseInt(_0x45eff2(0x220))/0x2+parseInt(_0x45eff2(0x206))/0x3*(parseInt(_0x45eff2(0x221))/0x4)+-parseInt(_0x45eff2(0x208))/0x5+parseInt(_0x45eff2(0x21e))/0x6+parseInt(_0x45eff2(0x1fa))/0x7+-parseInt(_0x45eff2(0x212))/0x8;if(_0x1b0e66===_0xbb014f)break;else _0x5e8976['push'](_0x5e8976['shift']());}catch(_0x31161c){_0x5e8976['push'](_0x5e8976['shift']());}}}(a47_0x3f30,0x19184));import{existsSync,statSync}from'fs';function a47_0x4c28(_0x367687,_0x168daf){_0x367687=_0x367687-0x1f4;const _0x3f308a=a47_0x3f30();let _0x4c28be=_0x3f308a[_0x367687];return _0x4c28be;}import a47_0x3f28bd from'chalk';import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';function a47_0x3f30(){const _0xea878f=['\x27...','slice','Parent\x20ID:\x20','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','error','green','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','folderPath','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','segmentPath','280146uRLhcB','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','309998WKQnEg','296RDpSbr','folderId','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','length','segment:use','✔\x20Context\x20set\x20to:\x20','53221fMJOaT','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Resolved\x20path\x20type:\x20','session','red','parent_segment','parentName','segments','100555bUtnQW','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','isAbsolute','resolvePathToResource','description','Error:\x20Path\x20is\x20required\x0a','data','join','cyan','dim','Usage:\x20tdx\x20segment\x20use\x20<path>','log','6552jikMyV','execute','602730CIRPhu','site','fullPath','parentId','Site:\x20','Resolved\x20relative\x20path\x20to:\x20','Folder\x20ID:\x20','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','verbose','type','1660464bESbyU'];a47_0x3f30=function(){return _0xea878f;};return a47_0x3f30();}import{parsePath,normalizePath}from'../sdk/segment/segment-path-parser.js';import{findTdxConfig}from'../sdk/segment/tdx-config.js';export class SegmentUseCommand extends BaseCommand{['name']=a47_0x31ed10(0x226);[a47_0x31ed10(0x1fe)]=a47_0x31ed10(0x21b);async[a47_0x31ed10(0x207)](_0x67702a){const _0x4ba5a9=a47_0x31ed10,{options:_0x1625ab,args:_0x523147,tdx:_0x12dcec}=_0x67702a;if(_0x523147[_0x4ba5a9(0x225)]===0x0)return console[_0x4ba5a9(0x217)](a47_0x3f28bd[_0x4ba5a9(0x1f6)](_0x4ba5a9(0x1ff))),console[_0x4ba5a9(0x217)](_0x4ba5a9(0x204)),console[_0x4ba5a9(0x217)]('Examples:'),console[_0x4ba5a9(0x217)]('\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22'),console[_0x4ba5a9(0x217)](_0x4ba5a9(0x1fb)),console[_0x4ba5a9(0x217)](_0x4ba5a9(0x21f)),console[_0x4ba5a9(0x217)]('\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent'),0x1;const _0x3b41d3=_0x523147[0x0],_0x165e38=_0x1625ab[_0x4ba5a9(0x1f5)];try{if(_0x3b41d3==='/')return saveSessionContext({'segment_path':undefined},_0x165e38),console['log'](a47_0x3f28bd[_0x4ba5a9(0x218)](_0x4ba5a9(0x223))),0x0;if(existsSync(_0x3b41d3)&&statSync(_0x3b41d3)['isDirectory']()){let _0x5ca294;try{_0x5ca294=findTdxConfig(_0x3b41d3);}catch{return console[_0x4ba5a9(0x217)](a47_0x3f28bd[_0x4ba5a9(0x1f6)](_0x4ba5a9(0x224)+_0x3b41d3)),console[_0x4ba5a9(0x217)](a47_0x3f28bd[_0x4ba5a9(0x202)](_0x4ba5a9(0x229))),0x1;}const _0x1807a1=_0x5ca294['config'][_0x4ba5a9(0x1f7)];return saveSessionContext({'segment_path':_0x1807a1,'parent_segment':_0x1807a1},_0x165e38),console['log'](a47_0x3f28bd[_0x4ba5a9(0x218)](_0x4ba5a9(0x227)+a47_0x3f28bd[_0x4ba5a9(0x202)](_0x1807a1))),0x0;}const _0x498594=_0x1625ab[_0x4ba5a9(0x21d)];let _0x2cbbd2=_0x3b41d3;const _0x33f440=parsePath(_0x3b41d3);if(!_0x33f440[_0x4ba5a9(0x1fc)]){if(!_0x498594)return console[_0x4ba5a9(0x217)](a47_0x3f28bd[_0x4ba5a9(0x1f6)](_0x4ba5a9(0x20f))),console[_0x4ba5a9(0x217)](a47_0x3f28bd['cyan'](_0x4ba5a9(0x216))),0x1;if(_0x3b41d3==='..'){const _0x259491=_0x498594['split']('/')[_0x4ba5a9(0x214)](0x0,-0x1)[_0x4ba5a9(0x201)]('/');_0x2cbbd2=_0x259491||'/';}else _0x3b41d3==='.'?_0x2cbbd2=_0x498594:_0x2cbbd2=_0x498594+'/'+_0x3b41d3;_0x1625ab[_0x4ba5a9(0x210)]&&console[_0x4ba5a9(0x217)](_0x4ba5a9(0x20d)+_0x2cbbd2);}if(_0x2cbbd2==='/'||_0x2cbbd2==='')return saveSessionContext({'segment_path':undefined},_0x165e38),console[_0x4ba5a9(0x205)](a47_0x3f28bd[_0x4ba5a9(0x218)](_0x4ba5a9(0x223))),0x0;_0x2cbbd2=normalizePath(_0x2cbbd2);const _0x1ef801=parsePath(_0x2cbbd2)[_0x4ba5a9(0x1f9)];if(_0x1ef801[_0x4ba5a9(0x225)]===0x0)return saveSessionContext({'segment_path':undefined},_0x165e38),console[_0x4ba5a9(0x205)](a47_0x3f28bd[_0x4ba5a9(0x218)]('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;_0x1625ab[_0x4ba5a9(0x210)]&&(console[_0x4ba5a9(0x217)](_0x4ba5a9(0x20c)+_0x1625ab[_0x4ba5a9(0x209)]),console[_0x4ba5a9(0x217)]('Target\x20path:\x20'+_0x2cbbd2));const _0x1402ef=await withSpinner('Resolving\x20path\x20\x27'+_0x2cbbd2+_0x4ba5a9(0x213),()=>_0x12dcec['segment'][_0x4ba5a9(0x1fd)](_0x2cbbd2),{'verbose':_0x1625ab[_0x4ba5a9(0x210)]}),_0x3bbb0c=_0x1402ef[_0x4ba5a9(0x200)];_0x1625ab[_0x4ba5a9(0x210)]&&(console[_0x4ba5a9(0x217)](_0x4ba5a9(0x1f4)+_0x3bbb0c[_0x4ba5a9(0x211)]),console[_0x4ba5a9(0x217)](_0x4ba5a9(0x215)+_0x3bbb0c[_0x4ba5a9(0x20b)]),_0x3bbb0c['folderId']&&console[_0x4ba5a9(0x217)](_0x4ba5a9(0x20e)+_0x3bbb0c[_0x4ba5a9(0x222)]));if(_0x3bbb0c[_0x4ba5a9(0x211)]==='segment')return console[_0x4ba5a9(0x217)](a47_0x3f28bd['red']('Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.')),console[_0x4ba5a9(0x217)](_0x4ba5a9(0x219)),console['error'](a47_0x3f28bd[_0x4ba5a9(0x202)]('Use:\x20tdx\x20segment\x20use\x20'+_0x3bbb0c[_0x4ba5a9(0x1f8)]+(_0x3bbb0c[_0x4ba5a9(0x21a)]?'/'+_0x3bbb0c[_0x4ba5a9(0x21a)][_0x4ba5a9(0x201)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x3bbb0c[_0x4ba5a9(0x20a)],'parent_segment':_0x3bbb0c[_0x4ba5a9(0x1f8)]},_0x165e38),console[_0x4ba5a9(0x205)](a47_0x3f28bd[_0x4ba5a9(0x218)](_0x4ba5a9(0x227)+a47_0x3f28bd[_0x4ba5a9(0x202)](_0x3bbb0c[_0x4ba5a9(0x20a)]))),_0x1625ab['verbose']&&(console[_0x4ba5a9(0x217)](a47_0x3f28bd[_0x4ba5a9(0x203)]('Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context')),console[_0x4ba5a9(0x217)](a47_0x3f28bd[_0x4ba5a9(0x203)](_0x4ba5a9(0x21c)))),0x0;}catch(_0x18735e){throw _0x18735e;}}}
1
+ function a48_0x4dca(_0x3b5199,_0x2197e1){_0x3b5199=_0x3b5199-0x1e0;const _0x47d394=a48_0x47d3();let _0x4dcaf9=_0x47d394[_0x3b5199];return _0x4dcaf9;}const a48_0x8c633a=a48_0x4dca;(function(_0x17269a,_0x577aa9){const _0x57ef61=a48_0x4dca,_0x3157b9=_0x17269a();while(!![]){try{const _0x301263=-parseInt(_0x57ef61(0x214))/0x1*(parseInt(_0x57ef61(0x1fe))/0x2)+-parseInt(_0x57ef61(0x215))/0x3*(-parseInt(_0x57ef61(0x1e1))/0x4)+-parseInt(_0x57ef61(0x207))/0x5+-parseInt(_0x57ef61(0x200))/0x6+-parseInt(_0x57ef61(0x1ff))/0x7+-parseInt(_0x57ef61(0x1f7))/0x8*(-parseInt(_0x57ef61(0x1e4))/0x9)+-parseInt(_0x57ef61(0x1fc))/0xa*(-parseInt(_0x57ef61(0x1e5))/0xb);if(_0x301263===_0x577aa9)break;else _0x3157b9['push'](_0x3157b9['shift']());}catch(_0x211c21){_0x3157b9['push'](_0x3157b9['shift']());}}}(a48_0x47d3,0x6d176));import{existsSync,statSync}from'fs';import a48_0x3532a3 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{['name']=a48_0x8c633a(0x1e7);['description']=a48_0x8c633a(0x1fd);async[a48_0x8c633a(0x1e8)](_0x4abb6d){const _0xe7e183=a48_0x8c633a,{options:_0x2e6648,args:_0x3fbd8d,tdx:_0x443816}=_0x4abb6d;if(_0x3fbd8d[_0xe7e183(0x1f4)]===0x0)return console[_0xe7e183(0x206)](a48_0x3532a3[_0xe7e183(0x205)](_0xe7e183(0x20e))),console[_0xe7e183(0x206)](_0xe7e183(0x216)),console[_0xe7e183(0x206)](_0xe7e183(0x211)),console[_0xe7e183(0x206)](_0xe7e183(0x1ea)),console[_0xe7e183(0x206)]('\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22'),console[_0xe7e183(0x206)](_0xe7e183(0x217)),console[_0xe7e183(0x206)](_0xe7e183(0x20d)),0x1;const _0x1ef556=_0x3fbd8d[0x0],_0x1c68f0=_0x2e6648[_0xe7e183(0x1e9)];try{if(_0x1ef556==='/')return saveSessionContext({'segment_path':undefined},_0x1c68f0),console['log'](a48_0x3532a3['green'](_0xe7e183(0x1e0))),0x0;if(existsSync(_0x1ef556)&&statSync(_0x1ef556)['isDirectory']()){let _0x52c261;try{_0x52c261=findTdxConfig(_0x1ef556);}catch{return console[_0xe7e183(0x206)](a48_0x3532a3[_0xe7e183(0x205)](_0xe7e183(0x208)+_0x1ef556)),console[_0xe7e183(0x206)](a48_0x3532a3[_0xe7e183(0x209)](_0xe7e183(0x201))),0x1;}const _0x41f3b3=_0x52c261['config']['parent_segment'];return saveSessionContext({'segment_path':_0x41f3b3,'parent_segment':_0x41f3b3},_0x1c68f0),console[_0xe7e183(0x1fa)](a48_0x3532a3['green'](_0xe7e183(0x1f6)+a48_0x3532a3[_0xe7e183(0x209)](_0x41f3b3))),0x0;}const _0x371848=_0x2e6648['segmentPath'];let _0x332d85=_0x1ef556;const _0x5cd810=parsePath(_0x1ef556);if(!_0x5cd810[_0xe7e183(0x1f9)]){if(!_0x371848)return console[_0xe7e183(0x206)](a48_0x3532a3[_0xe7e183(0x205)](_0xe7e183(0x212))),console[_0xe7e183(0x206)](a48_0x3532a3[_0xe7e183(0x209)](_0xe7e183(0x1ed))),0x1;if(_0x1ef556==='..'){const _0x325b8f=_0x371848[_0xe7e183(0x1e6)]('/')[_0xe7e183(0x1f8)](0x0,-0x1)[_0xe7e183(0x1f0)]('/');_0x332d85=_0x325b8f||'/';}else _0x1ef556==='.'?_0x332d85=_0x371848:_0x332d85=_0x371848+'/'+_0x1ef556;_0x2e6648['verbose']&&console['error'](_0xe7e183(0x1e2)+_0x332d85);}if(_0x332d85==='/'||_0x332d85==='')return saveSessionContext({'segment_path':undefined},_0x1c68f0),console['log'](a48_0x3532a3[_0xe7e183(0x210)](_0xe7e183(0x1e0))),0x0;_0x332d85=normalizePath(_0x332d85);const _0x50945f=parsePath(_0x332d85)[_0xe7e183(0x1f5)];if(_0x50945f[_0xe7e183(0x1f4)]===0x0)return saveSessionContext({'segment_path':undefined},_0x1c68f0),console[_0xe7e183(0x1fa)](a48_0x3532a3[_0xe7e183(0x210)](_0xe7e183(0x1e0))),0x0;_0x2e6648[_0xe7e183(0x20f)]&&(console[_0xe7e183(0x206)](_0xe7e183(0x213)+_0x2e6648[_0xe7e183(0x1fb)]),console[_0xe7e183(0x206)](_0xe7e183(0x1eb)+_0x332d85));const _0x39ab04=await withSpinner(_0xe7e183(0x1f3)+_0x332d85+_0xe7e183(0x1e3),()=>_0x443816[_0xe7e183(0x202)]['resolvePathToResource'](_0x332d85),{'verbose':_0x2e6648['verbose']}),_0x298b65=_0x39ab04['data'];_0x2e6648[_0xe7e183(0x20f)]&&(console['error'](_0xe7e183(0x203)+_0x298b65[_0xe7e183(0x1ef)]),console[_0xe7e183(0x206)]('Parent\x20ID:\x20'+_0x298b65[_0xe7e183(0x20b)]),_0x298b65[_0xe7e183(0x20a)]&&console[_0xe7e183(0x206)]('Folder\x20ID:\x20'+_0x298b65['folderId']));if(_0x298b65['type']==='segment')return console[_0xe7e183(0x206)](a48_0x3532a3[_0xe7e183(0x205)]('Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.')),console['error'](_0xe7e183(0x204)),console['error'](a48_0x3532a3[_0xe7e183(0x209)]('Use:\x20tdx\x20segment\x20use\x20'+_0x298b65[_0xe7e183(0x1f1)]+(_0x298b65[_0xe7e183(0x20c)]?'/'+_0x298b65[_0xe7e183(0x20c)]['join']('/'):''))),0x1;return saveSessionContext({'segment_path':_0x298b65[_0xe7e183(0x1ec)],'parent_segment':_0x298b65[_0xe7e183(0x1f1)]},_0x1c68f0),console[_0xe7e183(0x1fa)](a48_0x3532a3[_0xe7e183(0x210)](_0xe7e183(0x1f6)+a48_0x3532a3[_0xe7e183(0x209)](_0x298b65['fullPath']))),_0x2e6648[_0xe7e183(0x20f)]&&(console[_0xe7e183(0x206)](a48_0x3532a3[_0xe7e183(0x1f2)]('Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context')),console[_0xe7e183(0x206)](a48_0x3532a3[_0xe7e183(0x1f2)](_0xe7e183(0x1ee)))),0x0;}catch(_0xf35ccb){throw _0xf35ccb;}}}function a48_0x47d3(){const _0x2b780a=['join','parentName','dim','Resolving\x20path\x20\x27','length','segments','✔\x20Context\x20set\x20to:\x20','18208jBjyJK','slice','isAbsolute','log','site','3970WoiDWw','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','4146fTDQSt','480340ScCjRV','5098800THKQHd','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','segment','Resolved\x20path\x20type:\x20','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','red','error','4168005rHWcMo','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','cyan','folderId','parentId','folderPath','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','Error:\x20Path\x20is\x20required\x0a','verbose','green','Examples:','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','Site:\x20','191KMirOq','1212801MjLjdE','Usage:\x20tdx\x20segment\x20use\x20<path>','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','4SXixqH','Resolved\x20relative\x20path\x20to:\x20','\x27...','2133lzrwpv','45749jhzfom','split','segment:use','execute','session','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','Target\x20path:\x20','fullPath','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','type'];a48_0x47d3=function(){return _0x2b780a;};return a48_0x47d3();}
@@ -1 +1 @@
1
- const a48_0x57ef85=a48_0x5a06;(function(_0x450dd9,_0x155677){const _0x49b835=a48_0x5a06,_0xbd6232=_0x450dd9();while(!![]){try{const _0x20cd41=parseInt(_0x49b835(0x157))/0x1+parseInt(_0x49b835(0x13d))/0x2+-parseInt(_0x49b835(0x16b))/0x3+-parseInt(_0x49b835(0x166))/0x4*(parseInt(_0x49b835(0x15d))/0x5)+-parseInt(_0x49b835(0x14f))/0x6*(-parseInt(_0x49b835(0x142))/0x7)+parseInt(_0x49b835(0x13c))/0x8+-parseInt(_0x49b835(0x16a))/0x9*(parseInt(_0x49b835(0x165))/0xa);if(_0x20cd41===_0x155677)break;else _0xbd6232['push'](_0xbd6232['shift']());}catch(_0x5e34eb){_0xbd6232['push'](_0xbd6232['shift']());}}}(a48_0x45ba,0xe1cbb));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a48_0x61ca39 from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';function a48_0x45ba(){const _0x40ff22=['green','):\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','Usage:\x20tdx\x20sg\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','helpText','invalidCount','\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','red','verbose','endsWith','error','1340838tQWJFg','filePath','✔\x20All\x20','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','name','valid','Validation\x20failed:\x20','errorCode','565632jaeQnO','yellow','message','targetDir','hasErrors','type','645FAMAym','parentSegment','Error:\x20Directory\x20not\x20found:\x20','warnings','\x20file(s)\x20valid','\x20warning(s)\x20found','.yaml','no_parent','1010mRQTAC','30796jDdyDr','.yml','validCount','log','73413lPcAra','120054szrSsZ','\x20file(s)\x20with\x20errors,\x20','dim','description','warningCount','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','execute','length','Error:\x20','310416lblSrP','1673266GgSBvU','cyan','errors','cwd','Validate\x20segment\x20and\x20journey\x20YAML\x20files','42FAnVuj','segment:validate'];a48_0x45ba=function(){return _0x40ff22;};return a48_0x45ba();}function a48_0x5a06(_0x8fb07,_0x142900){_0x8fb07=_0x8fb07-0x139;const _0x45ba46=a48_0x45ba();let _0x5a065a=_0x45ba46[_0x8fb07];return _0x5a065a;}export class SegmentValidateCommand extends BaseCommand{[a48_0x57ef85(0x153)]=a48_0x57ef85(0x143);[a48_0x57ef85(0x16e)]=a48_0x57ef85(0x141);async[a48_0x57ef85(0x139)](_0x45a594){const _0x4cd213=a48_0x57ef85,{options:_0x77e99d,args:_0x19b66e}=_0x45a594,_0x52d141=_0x77e99d,_0x43c420=await resolveTarget({'arg':_0x19b66e[0x0],'contextParent':_0x77e99d[_0x4cd213(0x15e)],'cwd':process[_0x4cd213(0x140)]()});if(!isSuccessfulResolution(_0x43c420))return _0x43c420[_0x4cd213(0x156)]===_0x4cd213(0x164)?(console[_0x4cd213(0x14e)](a48_0x61ca39['yellow'](_0x4cd213(0x170))),console[_0x4cd213(0x14e)](_0x4cd213(0x147)),console[_0x4cd213(0x14e)](_0x4cd213(0x14a)),console['error'](_0x4cd213(0x146))):(console[_0x4cd213(0x14e)](a48_0x61ca39[_0x4cd213(0x14b)](_0x4cd213(0x13b)+_0x43c420[_0x4cd213(0x159)]+'\x0a')),_0x43c420[_0x4cd213(0x148)]&&console['error'](a48_0x61ca39[_0x4cd213(0x13e)](_0x43c420[_0x4cd213(0x148)]))),0x1;const _0x483e7e=_0x43c420[_0x4cd213(0x15a)],_0x52eb82=_0x43c420[_0x4cd213(0x15c)]==='file'?_0x43c420[_0x4cd213(0x150)]:undefined;if(!_0x52eb82&&!existsSync(_0x483e7e))return console[_0x4cd213(0x14e)](a48_0x61ca39[_0x4cd213(0x14b)](_0x4cd213(0x15f)+_0x483e7e+'\x0a')),0x1;let _0xee825a;if(_0x52eb82){if(!_0x52eb82['endsWith'](_0x4cd213(0x167))&&!_0x52eb82[_0x4cd213(0x14d)](_0x4cd213(0x163)))return console[_0x4cd213(0x14e)](a48_0x61ca39[_0x4cd213(0x14b)](_0x4cd213(0x152)+_0x52eb82+'\x0a')),0x1;_0xee825a=[_0x52eb82];}else _0xee825a=findYamlFiles(_0x483e7e);if(_0xee825a[_0x4cd213(0x13a)]===0x0)return console['error'](a48_0x61ca39[_0x4cd213(0x14b)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x483e7e+'\x0a')),0x1;const _0x1e37ad=validateYamlFiles(_0xee825a,_0x483e7e),_0x964031=calculateSummary(_0x1e37ad);for(const _0xe4b931 of _0x1e37ad){if(!isValidationResult(_0xe4b931))continue;const {relativePath:_0x55c8ef,source:_0xb5c47c,result:_0x443227,fileType:_0x10b198}=_0xe4b931,_0x52bbeb=_0x10b198;if(_0x443227[_0x4cd213(0x154)]&&_0x443227[_0x4cd213(0x160)]['length']===0x0)_0x52d141[_0x4cd213(0x14c)]&&console[_0x4cd213(0x169)](a48_0x61ca39[_0x4cd213(0x144)]('✔\x20'+_0x55c8ef)+a48_0x61ca39[_0x4cd213(0x16d)]('\x20('+_0x52bbeb+')'));else _0x443227['valid']?(console[_0x4cd213(0x169)](a48_0x61ca39['yellow']('⚠\x20'+_0x55c8ef)+a48_0x61ca39[_0x4cd213(0x16d)]('\x20('+_0x52bbeb+_0x4cd213(0x145)+_0x443227[_0x4cd213(0x160)][_0x4cd213(0x13a)]+'\x20warning(s)')),console[_0x4cd213(0x169)](formatValidationResult(_0x443227,_0xb5c47c,_0x55c8ef))):(console[_0x4cd213(0x169)](a48_0x61ca39['red']('✖\x20'+_0x55c8ef)+a48_0x61ca39['dim']('\x20('+_0x52bbeb+_0x4cd213(0x145)+_0x443227[_0x4cd213(0x13f)]['length']+'\x20error(s)')),console['log'](formatValidationResult(_0x443227,_0xb5c47c,_0x55c8ef)));}return console[_0x4cd213(0x169)](''),_0x964031[_0x4cd213(0x15b)]?(console[_0x4cd213(0x169)](a48_0x61ca39[_0x4cd213(0x14b)](_0x4cd213(0x155)+_0x964031[_0x4cd213(0x149)]+_0x4cd213(0x16c)+_0x964031[_0x4cd213(0x168)]+'\x20valid')),_0x964031['warningCount']>0x0&&console[_0x4cd213(0x169)](a48_0x61ca39[_0x4cd213(0x158)](_0x964031[_0x4cd213(0x16f)]+'\x20warning(s)\x20found')),0x1):(console[_0x4cd213(0x169)](a48_0x61ca39[_0x4cd213(0x144)](_0x4cd213(0x151)+_0x964031[_0x4cd213(0x168)]+_0x4cd213(0x161))),_0x964031[_0x4cd213(0x16f)]>0x0&&console[_0x4cd213(0x169)](a48_0x61ca39[_0x4cd213(0x158)](_0x964031[_0x4cd213(0x16f)]+_0x4cd213(0x162))),0x0);}}
1
+ const a49_0x39fb5f=a49_0xde61;(function(_0x2f529e,_0x1b0ff7){const _0x2daff5=a49_0xde61,_0x10cd2d=_0x2f529e();while(!![]){try{const _0x452d9e=-parseInt(_0x2daff5(0x84))/0x1*(-parseInt(_0x2daff5(0xa6))/0x2)+parseInt(_0x2daff5(0x7e))/0x3+parseInt(_0x2daff5(0x88))/0x4*(-parseInt(_0x2daff5(0x7a))/0x5)+-parseInt(_0x2daff5(0xa5))/0x6*(-parseInt(_0x2daff5(0x9d))/0x7)+parseInt(_0x2daff5(0x8b))/0x8*(parseInt(_0x2daff5(0x9a))/0x9)+parseInt(_0x2daff5(0x80))/0xa*(-parseInt(_0x2daff5(0x90))/0xb)+-parseInt(_0x2daff5(0x99))/0xc;if(_0x452d9e===_0x1b0ff7)break;else _0x10cd2d['push'](_0x10cd2d['shift']());}catch(_0x498105){_0x10cd2d['push'](_0x10cd2d['shift']());}}}(a49_0x704f,0x2c020));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';function a49_0xde61(_0x3ff100,_0x159f2d){_0x3ff100=_0x3ff100-0x7a;const _0x704f16=a49_0x704f();let _0xde61cd=_0x704f16[_0x3ff100];return _0xde61cd;}import{existsSync}from'fs';import a49_0x4a5d7c from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';function a49_0x704f(){const _0x8fd8fd=['6867wjrAAQ','log','endsWith','162323kIrIRN','Usage:\x20tdx\x20sg\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','filePath','\x20valid','errors','\x20file(s)\x20with\x20errors,\x20','warningCount','type','48DvYYyo','4AniuYF','.yaml','error','helpText','verbose','name','description','1093180VggWCp','warnings','cwd','segment:validate','399102MSMwzW','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','1042220NSfeTW','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','hasErrors','\x20warning(s)','58655NzxfrD','✔\x20All\x20','yellow','Error:\x20Directory\x20not\x20found:\x20','4GjBbvg','length','\x20file(s)\x20valid','2840dbegSG','Error:\x20','dim','cyan','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','11WljuMH','red','Validation\x20failed:\x20','message','\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','):\x20','validCount','invalidCount','file','2443284KVDpoU'];a49_0x704f=function(){return _0x8fd8fd;};return a49_0x704f();}import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class SegmentValidateCommand extends BaseCommand{[a49_0x39fb5f(0xab)]=a49_0x39fb5f(0x7d);[a49_0x39fb5f(0xac)]='Validate\x20segment\x20and\x20journey\x20YAML\x20files';async['execute'](_0x2f522d){const _0x123816=a49_0x39fb5f,{options:_0x3d12f8,args:_0x1e34b6}=_0x2f522d,_0x4777af=_0x3d12f8,_0x42d2b1=await resolveTarget({'arg':_0x1e34b6[0x0],'contextParent':_0x3d12f8['parentSegment'],'cwd':process[_0x123816(0x7c)]()});if(!isSuccessfulResolution(_0x42d2b1))return _0x42d2b1['errorCode']==='no_parent'?(console[_0x123816(0xa8)](a49_0x4a5d7c[_0x123816(0x86)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x123816(0xa8)](_0x123816(0x9e)),console[_0x123816(0xa8)](_0x123816(0x94)),console[_0x123816(0xa8)](_0x123816(0x81))):(console[_0x123816(0xa8)](a49_0x4a5d7c[_0x123816(0x91)](_0x123816(0x8c)+_0x42d2b1[_0x123816(0x93)]+'\x0a')),_0x42d2b1[_0x123816(0xa9)]&&console[_0x123816(0xa8)](a49_0x4a5d7c[_0x123816(0x8e)](_0x42d2b1[_0x123816(0xa9)]))),0x1;const _0x44f3a5=_0x42d2b1['targetDir'],_0x41601c=_0x42d2b1[_0x123816(0xa4)]===_0x123816(0x98)?_0x42d2b1[_0x123816(0x9f)]:undefined;if(!_0x41601c&&!existsSync(_0x44f3a5))return console[_0x123816(0xa8)](a49_0x4a5d7c['red'](_0x123816(0x87)+_0x44f3a5+'\x0a')),0x1;let _0x3df5e5;if(_0x41601c){if(!_0x41601c[_0x123816(0x9c)]('.yml')&&!_0x41601c[_0x123816(0x9c)](_0x123816(0xa7)))return console[_0x123816(0xa8)](a49_0x4a5d7c[_0x123816(0x91)](_0x123816(0x7f)+_0x41601c+'\x0a')),0x1;_0x3df5e5=[_0x41601c];}else _0x3df5e5=findYamlFiles(_0x44f3a5);if(_0x3df5e5[_0x123816(0x89)]===0x0)return console[_0x123816(0xa8)](a49_0x4a5d7c[_0x123816(0x91)](_0x123816(0x8f)+_0x44f3a5+'\x0a')),0x1;const _0x53c4e4=validateYamlFiles(_0x3df5e5,_0x44f3a5),_0x12efb9=calculateSummary(_0x53c4e4);for(const _0x1ee224 of _0x53c4e4){if(!isValidationResult(_0x1ee224))continue;const {relativePath:_0x299bdc,source:_0x223db7,result:_0xcdaa16,fileType:_0x11c521}=_0x1ee224,_0x5afd46=_0x11c521;if(_0xcdaa16['valid']&&_0xcdaa16[_0x123816(0x7b)][_0x123816(0x89)]===0x0)_0x4777af[_0x123816(0xaa)]&&console['log'](a49_0x4a5d7c['green']('✔\x20'+_0x299bdc)+a49_0x4a5d7c[_0x123816(0x8d)]('\x20('+_0x5afd46+')'));else _0xcdaa16['valid']?(console[_0x123816(0x9b)](a49_0x4a5d7c[_0x123816(0x86)]('⚠\x20'+_0x299bdc)+a49_0x4a5d7c[_0x123816(0x8d)]('\x20('+_0x5afd46+_0x123816(0x95)+_0xcdaa16[_0x123816(0x7b)][_0x123816(0x89)]+_0x123816(0x83))),console['log'](formatValidationResult(_0xcdaa16,_0x223db7,_0x299bdc))):(console['log'](a49_0x4a5d7c[_0x123816(0x91)]('✖\x20'+_0x299bdc)+a49_0x4a5d7c[_0x123816(0x8d)]('\x20('+_0x5afd46+_0x123816(0x95)+_0xcdaa16[_0x123816(0xa1)]['length']+'\x20error(s)')),console[_0x123816(0x9b)](formatValidationResult(_0xcdaa16,_0x223db7,_0x299bdc)));}return console[_0x123816(0x9b)](''),_0x12efb9[_0x123816(0x82)]?(console[_0x123816(0x9b)](a49_0x4a5d7c[_0x123816(0x91)](_0x123816(0x92)+_0x12efb9[_0x123816(0x97)]+_0x123816(0xa2)+_0x12efb9['validCount']+_0x123816(0xa0))),_0x12efb9[_0x123816(0xa3)]>0x0&&console[_0x123816(0x9b)](a49_0x4a5d7c[_0x123816(0x86)](_0x12efb9[_0x123816(0xa3)]+'\x20warning(s)\x20found')),0x1):(console[_0x123816(0x9b)](a49_0x4a5d7c['green'](_0x123816(0x85)+_0x12efb9[_0x123816(0x96)]+_0x123816(0x8a))),_0x12efb9[_0x123816(0xa3)]>0x0&&console[_0x123816(0x9b)](a49_0x4a5d7c[_0x123816(0x86)](_0x12efb9[_0x123816(0xa3)]+'\x20warning(s)\x20found')),0x0);}}
@@ -1 +1 @@
1
- const a49_0x1ff8ab=a49_0x3a4c;(function(_0x2da6cf,_0x34364d){const _0x1dec6d=a49_0x3a4c,_0x14e166=_0x2da6cf();while(!![]){try{const _0x51349c=-parseInt(_0x1dec6d(0xd3))/0x1*(parseInt(_0x1dec6d(0xde))/0x2)+parseInt(_0x1dec6d(0xaf))/0x3*(parseInt(_0x1dec6d(0xdf))/0x4)+-parseInt(_0x1dec6d(0xa6))/0x5+-parseInt(_0x1dec6d(0xc8))/0x6+parseInt(_0x1dec6d(0xe6))/0x7*(-parseInt(_0x1dec6d(0xc4))/0x8)+-parseInt(_0x1dec6d(0xee))/0x9+parseInt(_0x1dec6d(0xab))/0xa;if(_0x51349c===_0x34364d)break;else _0x14e166['push'](_0x14e166['shift']());}catch(_0x5dce5b){_0x14e166['push'](_0x14e166['shift']());}}}(a49_0x4a67,0x416b0));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a49_0x4a67(){const _0x1a1557=['48652CEYhdg','✔\x20Built\x20tree\x20with\x20','journeys','replace','(empty)','path','\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22','168uFbBlf','Recursive\x20mode:\x20enabled','name','/j/da','listUnified','site','verbose','No\x20items\x20match\x20pattern:\x20','1649097HpJdzQ','\x5c$&','cause','listWithPattern','folder','folderId','\x27...','Listing\x20folders,\x20segments,\x20and\x20journeys...','Error:\x20No\x20parent\x20segment\x20context\x20set.','✔\x20Found\x20','Folder\x20ID:\x20',']\x20matching\x20\x27','execute','test','parentSegment','children','\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.','1437785ygcygU','Resolving\x20path\x20\x27','Resolving\x20parent\x20segment\x20\x27','recursive',',\x20and\x20','11832310zYiYgr','segment','json','maxDepth','57KvTmcN','Searching\x20the\x20tree\x20for\x20names\x20matching\x20','\x20journey','size','(id\x20','parentId','\x20segment','List\x20folders\x20and\x20child\x20segments','Site:\x20','length','dim','description','\x20match','\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22','Error:\x20','message','filter','localeCompare','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','journeyBundleName','type','144456LOyvNi','journey','/e/','Found\x20','894012dTnSoM','/app/ps/','sort','\x20segments\x20share\x20this\x20name\x20—\x20pass\x20the\x20full\x20path\x20(or\x20id)\x20to\x20`tdx\x20sg\x20move`;\x20do\x20not\x20assume\x20the\x20first.','map','resolvePathToResource','toLowerCase','format','...','error','Parent\x20ID:\x20','6ZXnrbT','log','searchByName','Parent\x20segment\x20context:\x20','includes','No\x20folders\x20or\x20segments\x20match\x20','\x20folder','listRecursive','jsonl','segments','data','31072NAdHGf'];a49_0x4a67=function(){return _0x1a1557;};return a49_0x4a67();}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a49_0x3a4c(_0xc79704,_0x13b6f9){_0xc79704=_0xc79704-0x9d;const _0x4a67df=a49_0x4a67();let _0x3a4c2c=_0x4a67df[_0xc79704];return _0x3a4c2c;}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_0x2e7396 from'chalk';export class SegmentsCommand extends BaseCommand{[a49_0x1ff8ab(0xe8)]=a49_0x1ff8ab(0xdc);[a49_0x1ff8ab(0xba)]=a49_0x1ff8ab(0xb6);async[a49_0x1ff8ab(0xa1)](_0x1ad89e){const _0x530aa8=a49_0x1ff8ab,{options:_0x6324a4,args:_0x464bb9}=_0x1ad89e,_0x196ed9=_0x6324a4[_0x530aa8(0xa9)],_0x35f032=_0x464bb9[0x0];try{const _0x4035b2=_0x6324a4[_0x530aa8(0xa3)];_0x6324a4[_0x530aa8(0xec)]&&(console[_0x530aa8(0xd1)](_0x530aa8(0xb7)+_0x6324a4[_0x530aa8(0xeb)]),console[_0x530aa8(0xd1)](_0x530aa8(0xd6)+(_0x4035b2||'(not\x20set)')),_0x35f032&&console[_0x530aa8(0xd1)]('Folder/pattern\x20arg:\x20'+_0x35f032),_0x196ed9&&console['error'](_0x530aa8(0xe7)));if(!_0x4035b2)return console['error'](_0x530aa8(0x9d)),console[_0x530aa8(0xd1)](''),console[_0x530aa8(0xd1)]('Set\x20a\x20parent\x20segment\x20context\x20first:'),console[_0x530aa8(0xd1)](_0x530aa8(0xbc)),console[_0x530aa8(0xd1)](_0x530aa8(0xe5)),console['error'](''),console['error'](_0x530aa8(0xc1)),0x1;if(_0x35f032&&_0x196ed9)return await this[_0x530aa8(0xd5)](_0x1ad89e,_0x4035b2,_0x35f032);const _0x4f13e5=_0x35f032&&(_0x35f032['includes']('*')||_0x35f032[_0x530aa8(0xd7)]('?'));if(_0x4f13e5)return await this[_0x530aa8(0xf1)](_0x1ad89e,_0x4035b2,_0x35f032);const _0x5367ad=_0x35f032?_0x4035b2+'/'+_0x35f032:_0x4035b2;return _0x196ed9?await this[_0x530aa8(0xda)](_0x1ad89e,_0x5367ad):await this[_0x530aa8(0xea)](_0x1ad89e,_0x5367ad);}catch(_0x8dc87f){if(_0x8dc87f instanceof SDKError)return console[_0x530aa8(0xd1)](_0x530aa8(0xbd)+_0x8dc87f[_0x530aa8(0xbe)]),_0x8dc87f[_0x530aa8(0xf0)]&&console[_0x530aa8(0xd1)]('\x20\x20Cause:\x20'+_0x8dc87f[_0x530aa8(0xf0)]),0x1;throw _0x8dc87f;}}async[a49_0x1ff8ab(0xd5)](_0x513045,_0x296c0d,_0x579c5c){const _0x40a39b=a49_0x1ff8ab,{options:_0x3082e4,tdx:_0x4f1f34}=_0x513045,_0x169360='\x22'+_0x579c5c+'\x22',_0x62e227=await withSpinner(_0x40a39b(0xa7)+_0x296c0d+_0x40a39b(0xf4),()=>_0x4f1f34[_0x40a39b(0xac)]['resolvePathToResource'](_0x296c0d),{'verbose':_0x3082e4[_0x40a39b(0xec)]}),_0x4ab896=_0x62e227[_0x40a39b(0xdd)],_0x3b9bcc=_0x3082e4[_0x40a39b(0xae)]||0xa,_0x5187d5=await withSpinner(_0x40a39b(0xb0)+_0x169360+_0x40a39b(0xd0),()=>_0x4f1f34['segment'][_0x40a39b(0xda)](_0x4ab896[_0x40a39b(0xb4)],_0x4ab896['folderId'],0x0,_0x3b9bcc),{'verbose':_0x3082e4[_0x40a39b(0xec)]}),_0x5a69be=searchTreeByName(_0x5187d5['data'],_0x579c5c),_0xd3d350=_0x8e93f5=>getConsoleNextUrl(_0x3082e4['site'],_0x40a39b(0xc9)+_0x4ab896['parentId']+_0x40a39b(0xc6)+_0x8e93f5),_0x28f4ed=[..._0x5a69be][_0x40a39b(0xca)]((_0x34151a,_0x5a8c09)=>_0x34151a[_0x40a39b(0xe4)][_0x40a39b(0xc0)](_0x5a8c09['path'])),_0x3c67ee=0x32,_0x5da515=_0x40a39b(0xc7)+_0x5a69be['length']+_0x40a39b(0xbb)+(_0x5a69be[_0x40a39b(0xb8)]!==0x1?'es':'');console[_0x40a39b(0xd1)](_0x5a69be[_0x40a39b(0xb8)]>_0x3c67ee?'✔\x20'+_0x5da515+_0x40a39b(0xa5):'✔\x20'+_0x5da515);if(_0x3082e4[_0x40a39b(0xcf)]===_0x40a39b(0xad)||_0x3082e4['format']===_0x40a39b(0xdb)){const _0x183f47=_0x28f4ed[_0x40a39b(0xcc)](_0x15b242=>({..._0x15b242,..._0x15b242[_0x40a39b(0xc3)]===_0x40a39b(0xac)?{'url':_0xd3d350(_0x15b242['id'])}:{}}));return await handleSDKOutput(_0x183f47,_0x3082e4),0x0;}if(_0x5a69be[_0x40a39b(0xb8)]===0x0)return console[_0x40a39b(0xd4)](_0x40a39b(0xd8)+_0x169360),0x0;for(const _0xa2a2a9 of _0x28f4ed){console['log'](_0xa2a2a9[_0x40a39b(0xc3)]['padEnd'](0x8)+'\x20'+_0xa2a2a9[_0x40a39b(0xe4)]+'\x20\x20'+a49_0x2e7396['dim'](_0x40a39b(0xb3)+_0xa2a2a9['id']+')'));}const _0x5a8713=_0x5a69be[_0x40a39b(0xbf)](_0x43e9ae=>_0x43e9ae[_0x40a39b(0xc3)]==='segment'),_0xa45537=new Set(_0x5a8713[_0x40a39b(0xcc)](_0x3319f6=>_0x3319f6[_0x40a39b(0xe8)][_0x40a39b(0xce)]()))[_0x40a39b(0xb2)]===0x1;return _0x5a8713[_0x40a39b(0xb8)]>0x1&&_0xa45537&&console[_0x40a39b(0xd4)](a49_0x2e7396[_0x40a39b(0xb9)]('\x0a'+_0x5a8713[_0x40a39b(0xb8)]+_0x40a39b(0xcb))),0x0;}async[a49_0x1ff8ab(0xf1)](_0x462486,_0x272a0b,_0x2de1aa){const _0x5e25f1=a49_0x1ff8ab,{options:_0x262dd5,tdx:_0x1531c5}=_0x462486,_0x427f54=await withSpinner(_0x5e25f1(0xa8)+_0x272a0b+'\x27...',()=>_0x1531c5['segment'][_0x5e25f1(0xcd)](_0x272a0b),{'verbose':_0x262dd5[_0x5e25f1(0xec)]}),_0x10bc2a=_0x427f54[_0x5e25f1(0xdd)],_0xda58b8=await withSpinner(_0x5e25f1(0xf5),()=>_0x1531c5[_0x5e25f1(0xac)]['listUnifiedWithJourneys'](_0x10bc2a[_0x5e25f1(0xb4)],_0x10bc2a[_0x5e25f1(0xf3)]),{'verbose':_0x262dd5[_0x5e25f1(0xec)]}),{folders:_0x41afd5,segments:_0x263cf2,journeys:_0x45879e}=_0xda58b8[_0x5e25f1(0xdd)],_0xf774ea=_0x2de1aa[_0x5e25f1(0xe2)](/[.+^${}()|[\]\\]/g,_0x5e25f1(0xef))[_0x5e25f1(0xe2)](/\*/g,'.*')[_0x5e25f1(0xe2)](/\?/g,'.'),_0x4da924=new RegExp('^'+_0xf774ea+'$','i'),_0x56a668=_0x41afd5['filter'](_0x4cefcd=>_0x4da924['test'](_0x4cefcd[_0x5e25f1(0xe8)])),_0x5f1f2e=_0x263cf2[_0x5e25f1(0xbf)](_0xf78b17=>_0x4da924[_0x5e25f1(0xa2)](_0xf78b17['name'])),_0x4e84cf=_0x45879e[_0x5e25f1(0xbf)](_0x5ca1a9=>_0x4da924[_0x5e25f1(0xa2)](_0x5ca1a9[_0x5e25f1(0xc2)])),_0x5906d0=_0x56a668[_0x5e25f1(0xb8)]+_0x5f1f2e[_0x5e25f1(0xb8)]+_0x4e84cf[_0x5e25f1(0xb8)];console['error'](_0x5e25f1(0x9e)+_0x56a668['length']+'\x20folder'+(_0x56a668[_0x5e25f1(0xb8)]!==0x1?'s':'')+',\x20'+_0x5f1f2e[_0x5e25f1(0xb8)]+'\x20segment'+(_0x5f1f2e['length']!==0x1?'s':'')+_0x5e25f1(0xaa)+_0x4e84cf['length']+_0x5e25f1(0xb1)+(_0x4e84cf[_0x5e25f1(0xb8)]!==0x1?'s':'')+'\x20matching\x20\x27'+_0x2de1aa+'\x27');const _0x186d68=_0x4bd11e=>{const _0x375714=_0x5e25f1;return getConsoleNextUrl(_0x262dd5[_0x375714(0xeb)],'/app/ps/'+_0x10bc2a[_0x375714(0xb4)]+_0x375714(0xc6)+_0x4bd11e);},_0x223062=_0x262dd5[_0x5e25f1(0xcf)]===_0x5e25f1(0xad)||_0x262dd5[_0x5e25f1(0xcf)]===_0x5e25f1(0xdb);if(_0x223062){const _0x3b1d78=[..._0x56a668[_0x5e25f1(0xcc)](_0x5e1062=>({..._0x5e1062,'type':_0x5e25f1(0xf2)})),..._0x5f1f2e['map'](_0x4d47c8=>({..._0x4d47c8,'type':_0x5e25f1(0xac),'url':_0x186d68(_0x4d47c8['id'])})),..._0x4e84cf[_0x5e25f1(0xcc)](_0x4d1237=>({..._0x4d1237,'name':_0x4d1237[_0x5e25f1(0xc2)],'type':_0x5e25f1(0xc5)}))]['sort']((_0x368cd1,_0x242458)=>_0x368cd1[_0x5e25f1(0xe8)]['localeCompare'](_0x242458[_0x5e25f1(0xe8)]));await handleSDKOutput(_0x3b1d78,_0x262dd5);}else{if(_0x5906d0===0x0)console[_0x5e25f1(0xd4)](_0x5e25f1(0xed)+_0x2de1aa);else{console['log'](a49_0x2e7396[_0x5e25f1(0xb9)]('['+_0x272a0b+_0x5e25f1(0xa0)+_0x2de1aa+'\x27'));const _0x1584cd=formatFlatList(_0x56a668,_0x5f1f2e,{'showMetadata':!![],'getSegmentUrl':_0x186d68},_0x4e84cf);console['log'](_0x1584cd);}}return 0x0;}async[a49_0x1ff8ab(0xea)](_0x248b47,_0x4e499f){const _0xdd7a57=a49_0x1ff8ab,{options:_0xaadb41,tdx:_0x1eeb58}=_0x248b47,_0x21f1bf=await withSpinner(_0xdd7a57(0xa7)+_0x4e499f+_0xdd7a57(0xf4),()=>_0x1eeb58[_0xdd7a57(0xac)]['resolvePathToResource'](_0x4e499f),{'verbose':_0xaadb41[_0xdd7a57(0xec)]}),_0x1ea01d=_0x21f1bf[_0xdd7a57(0xdd)];_0xaadb41[_0xdd7a57(0xec)]&&(console[_0xdd7a57(0xd1)](_0xdd7a57(0xd2)+_0x1ea01d[_0xdd7a57(0xb4)]),_0x1ea01d[_0xdd7a57(0xf3)]&&console[_0xdd7a57(0xd1)](_0xdd7a57(0x9f)+_0x1ea01d[_0xdd7a57(0xf3)]));const _0x3975a7=await withSpinner(_0xdd7a57(0xf5),()=>_0x1eeb58[_0xdd7a57(0xac)]['listUnifiedWithJourneys'](_0x1ea01d['parentId'],_0x1ea01d[_0xdd7a57(0xf3)]),{'verbose':_0xaadb41['verbose']}),{folders:_0x2d17b4,segments:_0x2ba19d,journeys:_0x119895}=_0x3975a7['data'],_0x4a0b5a=_0x2d17b4[_0xdd7a57(0xb8)]+_0x2ba19d['length']+_0x119895[_0xdd7a57(0xb8)];console[_0xdd7a57(0xd1)](_0xdd7a57(0x9e)+_0x2d17b4['length']+'\x20folder'+(_0x2d17b4[_0xdd7a57(0xb8)]!==0x1?'s':'')+',\x20'+_0x2ba19d[_0xdd7a57(0xb8)]+_0xdd7a57(0xb5)+(_0x2ba19d[_0xdd7a57(0xb8)]!==0x1?'s':'')+_0xdd7a57(0xaa)+_0x119895['length']+_0xdd7a57(0xb1)+(_0x119895[_0xdd7a57(0xb8)]!==0x1?'s':''));const _0x4bef3e=_0x42c7a2=>{const _0x5ed9bf=_0xdd7a57;return getConsoleNextUrl(_0xaadb41['site'],_0x5ed9bf(0xc9)+_0x1ea01d[_0x5ed9bf(0xb4)]+_0x5ed9bf(0xc6)+_0x42c7a2);},_0x545de2=_0x2919a2=>{const _0x42526c=_0xdd7a57;return getConsoleNextUrl(_0xaadb41[_0x42526c(0xeb)],_0x42526c(0xc9)+_0x1ea01d[_0x42526c(0xb4)]+_0x42526c(0xc6)+_0x2919a2+_0x42526c(0xe9));},_0x25aa4a=_0xaadb41[_0xdd7a57(0xcf)]===_0xdd7a57(0xad)||_0xaadb41[_0xdd7a57(0xcf)]===_0xdd7a57(0xdb);if(_0x25aa4a){const _0x75e3cd=[..._0x2d17b4[_0xdd7a57(0xcc)](_0x595756=>({..._0x595756,'type':_0xdd7a57(0xf2)})),..._0x2ba19d[_0xdd7a57(0xcc)](_0x410725=>({..._0x410725,'type':_0xdd7a57(0xac),'url':_0x4bef3e(_0x410725['id'])})),..._0x119895[_0xdd7a57(0xcc)](_0x12bcea=>({..._0x12bcea,'name':_0x12bcea[_0xdd7a57(0xc2)],'type':'journey','url':_0x545de2(_0x12bcea['id'])}))]['sort']((_0x4eba51,_0x54f93b)=>_0x4eba51[_0xdd7a57(0xe8)][_0xdd7a57(0xc0)](_0x54f93b[_0xdd7a57(0xe8)]));await handleSDKOutput(_0x75e3cd,_0xaadb41);}else{if(_0x4a0b5a===0x0)console[_0xdd7a57(0xd4)](a49_0x2e7396['dim']('['+_0x4e499f+']')),console[_0xdd7a57(0xd4)](_0xdd7a57(0xe3));else{console['log'](a49_0x2e7396[_0xdd7a57(0xb9)]('['+_0x4e499f+']'));const _0x33077d=formatFlatList(_0x2d17b4,_0x2ba19d,{'showMetadata':!![],'getSegmentUrl':_0x4bef3e,'getJourneyUrl':_0x545de2},_0x119895);console[_0xdd7a57(0xd4)](_0x33077d);}}return 0x0;}async['listRecursive'](_0x32e90c,_0x1e7e33){const _0x176737=a49_0x1ff8ab,{options:_0x17e244,tdx:_0x55d563}=_0x32e90c,_0x42192d=await withSpinner(_0x176737(0xa7)+_0x1e7e33+_0x176737(0xf4),()=>_0x55d563['segment'][_0x176737(0xcd)](_0x1e7e33),{'verbose':_0x17e244[_0x176737(0xec)]}),_0xae2c79=_0x42192d['data'];_0x17e244[_0x176737(0xec)]&&(console[_0x176737(0xd1)](_0x176737(0xd2)+_0xae2c79[_0x176737(0xb4)]),_0xae2c79[_0x176737(0xf3)]&&console[_0x176737(0xd1)]('Folder\x20ID:\x20'+_0xae2c79[_0x176737(0xf3)]));const _0x3bf58b=_0x17e244[_0x176737(0xae)]||0xa,_0x4844ef=await withSpinner('Building\x20hierarchy\x20tree...',()=>_0x55d563[_0x176737(0xac)][_0x176737(0xda)](_0xae2c79[_0x176737(0xb4)],_0xae2c79['folderId'],0x0,_0x3bf58b),{'verbose':_0x17e244[_0x176737(0xec)]}),_0x38efef=_0x4844ef[_0x176737(0xdd)],_0x241c99=_0x113580=>{const _0x6d0f8d=_0x176737;let _0x1b25d8=0x0,_0x3ded16=0x0,_0x2a575e=0x0;for(const _0x55add1 of _0x113580){if(_0x55add1['type']==='folder')_0x1b25d8++;else{if(_0x55add1[_0x6d0f8d(0xc3)]===_0x6d0f8d(0xac))_0x3ded16++;else{if(_0x55add1['type']==='journey')_0x2a575e++;}}if(_0x55add1[_0x6d0f8d(0xa4)]){const _0x37c88a=_0x241c99(_0x55add1[_0x6d0f8d(0xa4)]);_0x1b25d8+=_0x37c88a['folders'],_0x3ded16+=_0x37c88a[_0x6d0f8d(0xdc)],_0x2a575e+=_0x37c88a[_0x6d0f8d(0xe1)];}}return{'folders':_0x1b25d8,'segments':_0x3ded16,'journeys':_0x2a575e};},_0x2cd3f0=_0x241c99(_0x38efef);console[_0x176737(0xd1)](_0x176737(0xe0)+_0x2cd3f0['folders']+_0x176737(0xd9)+(_0x2cd3f0['folders']!==0x1?'s':'')+',\x20'+_0x2cd3f0[_0x176737(0xdc)]+_0x176737(0xb5)+(_0x2cd3f0['segments']!==0x1?'s':'')+_0x176737(0xaa)+_0x2cd3f0[_0x176737(0xe1)]+_0x176737(0xb1)+(_0x2cd3f0['journeys']!==0x1?'s':''));const _0x466cd8=_0x397923=>{const _0x349719=_0x176737;return getConsoleNextUrl(_0x17e244[_0x349719(0xeb)],_0x349719(0xc9)+_0xae2c79[_0x349719(0xb4)]+_0x349719(0xc6)+_0x397923);},_0x3caba4=_0x408c12=>{const _0x14868d=_0x176737;return getConsoleNextUrl(_0x17e244['site'],_0x14868d(0xc9)+_0xae2c79[_0x14868d(0xb4)]+_0x14868d(0xc6)+_0x408c12+'/j/da');};if(_0x17e244[_0x176737(0xcf)]===_0x176737(0xad)||_0x17e244[_0x176737(0xcf)]===_0x176737(0xdb))await handleSDKOutput(_0x38efef,_0x17e244);else{console['log'](a49_0x2e7396[_0x176737(0xb9)]('['+_0x1e7e33+']'));const _0x18683f=formatTree(_0x38efef,{'showMetadata':!![],'getSegmentUrl':_0x466cd8,'getJourneyUrl':_0x3caba4});console[_0x176737(0xd4)](_0x18683f);}return 0x0;}}
1
+ function a50_0x4991(_0x3b42a1,_0x45d4ec){_0x3b42a1=_0x3b42a1-0x68;const _0x2fd881=a50_0x2fd8();let _0x499108=_0x2fd881[_0x3b42a1];return _0x499108;}const a50_0x5d2c7f=a50_0x4991;(function(_0x92669a,_0x533f91){const _0x368a68=a50_0x4991,_0x45e081=_0x92669a();while(!![]){try{const _0xf5ec27=-parseInt(_0x368a68(0x6e))/0x1*(parseInt(_0x368a68(0xa3))/0x2)+parseInt(_0x368a68(0xb8))/0x3+parseInt(_0x368a68(0xa7))/0x4*(parseInt(_0x368a68(0xa6))/0x5)+parseInt(_0x368a68(0xbb))/0x6+parseInt(_0x368a68(0x8e))/0x7*(parseInt(_0x368a68(0x6d))/0x8)+parseInt(_0x368a68(0x84))/0x9+parseInt(_0x368a68(0xb5))/0xa*(-parseInt(_0x368a68(0x9c))/0xb);if(_0xf5ec27===_0x533f91)break;else _0x45e081['push'](_0x45e081['shift']());}catch(_0x31e1b0){_0x45e081['push'](_0x45e081['shift']());}}}(a50_0x2fd8,0x5c9de));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 a50_0x42b8ec from'chalk';export class SegmentsCommand extends BaseCommand{[a50_0x5d2c7f(0x8a)]=a50_0x5d2c7f(0x92);[a50_0x5d2c7f(0x70)]=a50_0x5d2c7f(0xa1);async[a50_0x5d2c7f(0x81)](_0x339078){const _0x1d280c=a50_0x5d2c7f,{options:_0x17e69a,args:_0x4ee489}=_0x339078,_0x2751f5=_0x17e69a[_0x1d280c(0x76)],_0x577bf7=_0x4ee489[0x0];try{const _0x58abc6=_0x17e69a[_0x1d280c(0x9d)];_0x17e69a[_0x1d280c(0x68)]&&(console['error']('Site:\x20'+_0x17e69a[_0x1d280c(0xb6)]),console['error'](_0x1d280c(0xbd)+(_0x58abc6||_0x1d280c(0x96))),_0x577bf7&&console[_0x1d280c(0xa2)](_0x1d280c(0x9e)+_0x577bf7),_0x2751f5&&console['error'](_0x1d280c(0xac)));if(!_0x58abc6)return console['error'](_0x1d280c(0xb1)),console['error'](''),console[_0x1d280c(0xa2)](_0x1d280c(0x85)),console[_0x1d280c(0xa2)]('\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22'),console['error'](_0x1d280c(0xaf)),console['error'](''),console['error']('Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.'),0x1;if(_0x577bf7&&_0x2751f5)return await this['searchByName'](_0x339078,_0x58abc6,_0x577bf7);const _0x28623b=_0x577bf7&&(_0x577bf7['includes']('*')||_0x577bf7[_0x1d280c(0x9b)]('?'));if(_0x28623b)return await this['listWithPattern'](_0x339078,_0x58abc6,_0x577bf7);const _0x4360d1=_0x577bf7?_0x58abc6+'/'+_0x577bf7:_0x58abc6;return _0x2751f5?await this['listRecursive'](_0x339078,_0x4360d1):await this[_0x1d280c(0xb0)](_0x339078,_0x4360d1);}catch(_0xe72a08){if(_0xe72a08 instanceof SDKError)return console[_0x1d280c(0xa2)](_0x1d280c(0x71)+_0xe72a08[_0x1d280c(0x88)]),_0xe72a08[_0x1d280c(0xa5)]&&console[_0x1d280c(0xa2)](_0x1d280c(0xaa)+_0xe72a08[_0x1d280c(0xa5)]),0x1;throw _0xe72a08;}}async[a50_0x5d2c7f(0x7e)](_0x62cd3b,_0x1997bb,_0x5a39fd){const _0x3edc2a=a50_0x5d2c7f,{options:_0x4d8ffe,tdx:_0x49a142}=_0x62cd3b,_0x15625d='\x22'+_0x5a39fd+'\x22',_0x401e74=await withSpinner('Resolving\x20path\x20\x27'+_0x1997bb+_0x3edc2a(0x74),()=>_0x49a142[_0x3edc2a(0x8f)][_0x3edc2a(0xb4)](_0x1997bb),{'verbose':_0x4d8ffe[_0x3edc2a(0x68)]}),_0x40487f=_0x401e74[_0x3edc2a(0x7b)],_0x1d5682=_0x4d8ffe[_0x3edc2a(0x8c)]||0xa,_0xc493a1=await withSpinner('Searching\x20the\x20tree\x20for\x20names\x20matching\x20'+_0x15625d+_0x3edc2a(0x91),()=>_0x49a142['segment'][_0x3edc2a(0xbe)](_0x40487f['parentId'],_0x40487f['folderId'],0x0,_0x1d5682),{'verbose':_0x4d8ffe['verbose']}),_0x298145=searchTreeByName(_0xc493a1[_0x3edc2a(0x7b)],_0x5a39fd),_0x39586f=_0x2a1bc1=>getConsoleNextUrl(_0x4d8ffe[_0x3edc2a(0xb6)],_0x3edc2a(0x77)+_0x40487f[_0x3edc2a(0x8b)]+_0x3edc2a(0xa4)+_0x2a1bc1),_0x388748=[..._0x298145]['sort']((_0x3fcc07,_0xa47d87)=>_0x3fcc07[_0x3edc2a(0x7a)][_0x3edc2a(0x86)](_0xa47d87[_0x3edc2a(0x7a)])),_0x413741=0x32,_0x52c179=_0x3edc2a(0x6b)+_0x298145[_0x3edc2a(0x69)]+'\x20match'+(_0x298145['length']!==0x1?'es':'');console['error'](_0x298145[_0x3edc2a(0x69)]>_0x413741?'✔\x20'+_0x52c179+'\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.':'✔\x20'+_0x52c179);if(_0x4d8ffe[_0x3edc2a(0x9f)]===_0x3edc2a(0x83)||_0x4d8ffe['format']===_0x3edc2a(0xad)){const _0x17c2cc=_0x388748[_0x3edc2a(0x6c)](_0x343f1b=>({..._0x343f1b,..._0x343f1b[_0x3edc2a(0x97)]===_0x3edc2a(0x8f)?{'url':_0x39586f(_0x343f1b['id'])}:{}}));return await handleSDKOutput(_0x17c2cc,_0x4d8ffe),0x0;}if(_0x298145[_0x3edc2a(0x69)]===0x0)return console['log'](_0x3edc2a(0x78)+_0x15625d),0x0;for(const _0x467096 of _0x388748){console['log'](_0x467096['type'][_0x3edc2a(0xb3)](0x8)+'\x20'+_0x467096[_0x3edc2a(0x7a)]+'\x20\x20'+a50_0x42b8ec[_0x3edc2a(0xab)](_0x3edc2a(0x72)+_0x467096['id']+')'));}const _0x215bcc=_0x298145[_0x3edc2a(0x73)](_0x4dd5fc=>_0x4dd5fc[_0x3edc2a(0x97)]==='segment'),_0x4f4bb1=new Set(_0x215bcc[_0x3edc2a(0x6c)](_0x223e1c=>_0x223e1c[_0x3edc2a(0x8a)][_0x3edc2a(0x6f)]()))['size']===0x1;return _0x215bcc[_0x3edc2a(0x69)]>0x1&&_0x4f4bb1&&console[_0x3edc2a(0x79)](a50_0x42b8ec[_0x3edc2a(0xab)]('\x0a'+_0x215bcc[_0x3edc2a(0x69)]+_0x3edc2a(0x75))),0x0;}async['listWithPattern'](_0x1847b3,_0x4d498a,_0x2279f1){const _0x3c94fb=a50_0x5d2c7f,{options:_0x2bca54,tdx:_0x428f88}=_0x1847b3,_0x26ef45=await withSpinner(_0x3c94fb(0x82)+_0x4d498a+_0x3c94fb(0x74),()=>_0x428f88[_0x3c94fb(0x8f)][_0x3c94fb(0xb4)](_0x4d498a),{'verbose':_0x2bca54[_0x3c94fb(0x68)]}),_0x5670d2=_0x26ef45[_0x3c94fb(0x7b)],_0x2cd421=await withSpinner(_0x3c94fb(0xa0),()=>_0x428f88[_0x3c94fb(0x8f)][_0x3c94fb(0x90)](_0x5670d2[_0x3c94fb(0x8b)],_0x5670d2[_0x3c94fb(0x99)]),{'verbose':_0x2bca54[_0x3c94fb(0x68)]}),{folders:_0x198ce8,segments:_0x24f357,journeys:_0x228e72}=_0x2cd421[_0x3c94fb(0x7b)],_0x31357b=_0x2279f1[_0x3c94fb(0x7f)](/[.+^${}()|[\]\\]/g,_0x3c94fb(0xba))[_0x3c94fb(0x7f)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x414056=new RegExp('^'+_0x31357b+'$','i'),_0x51d8e8=_0x198ce8[_0x3c94fb(0x73)](_0x312a1b=>_0x414056['test'](_0x312a1b[_0x3c94fb(0x8a)])),_0x5afe9c=_0x24f357[_0x3c94fb(0x73)](_0xe9eb4b=>_0x414056[_0x3c94fb(0x8d)](_0xe9eb4b['name'])),_0x3e864d=_0x228e72[_0x3c94fb(0x73)](_0x2af4b9=>_0x414056[_0x3c94fb(0x8d)](_0x2af4b9['journeyBundleName'])),_0x5c97c1=_0x51d8e8['length']+_0x5afe9c['length']+_0x3e864d[_0x3c94fb(0x69)];console[_0x3c94fb(0xa2)]('✔\x20Found\x20'+_0x51d8e8['length']+_0x3c94fb(0xae)+(_0x51d8e8[_0x3c94fb(0x69)]!==0x1?'s':'')+',\x20'+_0x5afe9c[_0x3c94fb(0x69)]+_0x3c94fb(0x94)+(_0x5afe9c[_0x3c94fb(0x69)]!==0x1?'s':'')+_0x3c94fb(0xbc)+_0x3e864d[_0x3c94fb(0x69)]+_0x3c94fb(0xbf)+(_0x3e864d[_0x3c94fb(0x69)]!==0x1?'s':'')+_0x3c94fb(0x95)+_0x2279f1+'\x27');const _0x13eeb4=_0x3e6aaa=>{const _0x42370f=_0x3c94fb;return getConsoleNextUrl(_0x2bca54[_0x42370f(0xb6)],'/app/ps/'+_0x5670d2[_0x42370f(0x8b)]+_0x42370f(0xa4)+_0x3e6aaa);},_0x5ca0d5=_0x2bca54[_0x3c94fb(0x9f)]===_0x3c94fb(0x83)||_0x2bca54[_0x3c94fb(0x9f)]===_0x3c94fb(0xad);if(_0x5ca0d5){const _0x3f875b=[..._0x51d8e8[_0x3c94fb(0x6c)](_0xa3c676=>({..._0xa3c676,'type':_0x3c94fb(0x89)})),..._0x5afe9c[_0x3c94fb(0x6c)](_0x34dbed=>({..._0x34dbed,'type':'segment','url':_0x13eeb4(_0x34dbed['id'])})),..._0x3e864d['map'](_0x1b8510=>({..._0x1b8510,'name':_0x1b8510['journeyBundleName'],'type':_0x3c94fb(0xb7)}))]['sort']((_0x2b0df0,_0x538478)=>_0x2b0df0[_0x3c94fb(0x8a)][_0x3c94fb(0x86)](_0x538478[_0x3c94fb(0x8a)]));await handleSDKOutput(_0x3f875b,_0x2bca54);}else{if(_0x5c97c1===0x0)console[_0x3c94fb(0x79)](_0x3c94fb(0x80)+_0x2279f1);else{console['log'](a50_0x42b8ec['dim']('['+_0x4d498a+_0x3c94fb(0x7d)+_0x2279f1+'\x27'));const _0x3f30cb=formatFlatList(_0x51d8e8,_0x5afe9c,{'showMetadata':!![],'getSegmentUrl':_0x13eeb4},_0x3e864d);console[_0x3c94fb(0x79)](_0x3f30cb);}}return 0x0;}async[a50_0x5d2c7f(0xb0)](_0x5209e5,_0x162236){const _0x48f8a1=a50_0x5d2c7f,{options:_0x4bd1db,tdx:_0x3f1ef6}=_0x5209e5,_0x25e5c8=await withSpinner(_0x48f8a1(0xa9)+_0x162236+_0x48f8a1(0x74),()=>_0x3f1ef6['segment'][_0x48f8a1(0xb4)](_0x162236),{'verbose':_0x4bd1db[_0x48f8a1(0x68)]}),_0x18f8d9=_0x25e5c8[_0x48f8a1(0x7b)];_0x4bd1db[_0x48f8a1(0x68)]&&(console[_0x48f8a1(0xa2)](_0x48f8a1(0x98)+_0x18f8d9[_0x48f8a1(0x8b)]),_0x18f8d9['folderId']&&console[_0x48f8a1(0xa2)]('Folder\x20ID:\x20'+_0x18f8d9[_0x48f8a1(0x99)]));const _0x519936=await withSpinner(_0x48f8a1(0xa0),()=>_0x3f1ef6['segment'][_0x48f8a1(0x90)](_0x18f8d9[_0x48f8a1(0x8b)],_0x18f8d9[_0x48f8a1(0x99)]),{'verbose':_0x4bd1db[_0x48f8a1(0x68)]}),{folders:_0x59cd97,segments:_0x3bda7b,journeys:_0x36ee66}=_0x519936[_0x48f8a1(0x7b)],_0x560aaf=_0x59cd97[_0x48f8a1(0x69)]+_0x3bda7b[_0x48f8a1(0x69)]+_0x36ee66[_0x48f8a1(0x69)];console[_0x48f8a1(0xa2)](_0x48f8a1(0x9a)+_0x59cd97[_0x48f8a1(0x69)]+_0x48f8a1(0xae)+(_0x59cd97[_0x48f8a1(0x69)]!==0x1?'s':'')+',\x20'+_0x3bda7b[_0x48f8a1(0x69)]+_0x48f8a1(0x94)+(_0x3bda7b[_0x48f8a1(0x69)]!==0x1?'s':'')+_0x48f8a1(0xbc)+_0x36ee66['length']+_0x48f8a1(0xbf)+(_0x36ee66[_0x48f8a1(0x69)]!==0x1?'s':''));const _0x128cbf=_0x327d0c=>{const _0x3f14d5=_0x48f8a1;return getConsoleNextUrl(_0x4bd1db[_0x3f14d5(0xb6)],_0x3f14d5(0x77)+_0x18f8d9[_0x3f14d5(0x8b)]+'/e/'+_0x327d0c);},_0xf4a499=_0x1e55a4=>{const _0x1f158e=_0x48f8a1;return getConsoleNextUrl(_0x4bd1db[_0x1f158e(0xb6)],_0x1f158e(0x77)+_0x18f8d9[_0x1f158e(0x8b)]+'/e/'+_0x1e55a4+_0x1f158e(0xb9));},_0x3b87ae=_0x4bd1db[_0x48f8a1(0x9f)]===_0x48f8a1(0x83)||_0x4bd1db[_0x48f8a1(0x9f)]===_0x48f8a1(0xad);if(_0x3b87ae){const _0x84f234=[..._0x59cd97[_0x48f8a1(0x6c)](_0x4a2394=>({..._0x4a2394,'type':_0x48f8a1(0x89)})),..._0x3bda7b['map'](_0xeed100=>({..._0xeed100,'type':_0x48f8a1(0x8f),'url':_0x128cbf(_0xeed100['id'])})),..._0x36ee66[_0x48f8a1(0x6c)](_0x598ca4=>({..._0x598ca4,'name':_0x598ca4[_0x48f8a1(0xb2)],'type':_0x48f8a1(0xb7),'url':_0xf4a499(_0x598ca4['id'])}))]['sort']((_0x3ceb0d,_0x42c1b5)=>_0x3ceb0d[_0x48f8a1(0x8a)][_0x48f8a1(0x86)](_0x42c1b5[_0x48f8a1(0x8a)]));await handleSDKOutput(_0x84f234,_0x4bd1db);}else{if(_0x560aaf===0x0)console['log'](a50_0x42b8ec[_0x48f8a1(0xab)]('['+_0x162236+']')),console[_0x48f8a1(0x79)](_0x48f8a1(0x7c));else{console[_0x48f8a1(0x79)](a50_0x42b8ec['dim']('['+_0x162236+']'));const _0x5ad6dc=formatFlatList(_0x59cd97,_0x3bda7b,{'showMetadata':!![],'getSegmentUrl':_0x128cbf,'getJourneyUrl':_0xf4a499},_0x36ee66);console['log'](_0x5ad6dc);}}return 0x0;}async[a50_0x5d2c7f(0xbe)](_0x529a38,_0x4bf849){const _0x2ca186=a50_0x5d2c7f,{options:_0x5bf1bd,tdx:_0x4f0d74}=_0x529a38,_0x4f2aa3=await withSpinner(_0x2ca186(0xa9)+_0x4bf849+'\x27...',()=>_0x4f0d74[_0x2ca186(0x8f)][_0x2ca186(0xb4)](_0x4bf849),{'verbose':_0x5bf1bd['verbose']}),_0x2ba023=_0x4f2aa3[_0x2ca186(0x7b)];_0x5bf1bd[_0x2ca186(0x68)]&&(console[_0x2ca186(0xa2)](_0x2ca186(0x98)+_0x2ba023['parentId']),_0x2ba023[_0x2ca186(0x99)]&&console['error']('Folder\x20ID:\x20'+_0x2ba023['folderId']));const _0x499c91=_0x5bf1bd[_0x2ca186(0x8c)]||0xa,_0x2796ee=await withSpinner('Building\x20hierarchy\x20tree...',()=>_0x4f0d74[_0x2ca186(0x8f)][_0x2ca186(0xbe)](_0x2ba023[_0x2ca186(0x8b)],_0x2ba023['folderId'],0x0,_0x499c91),{'verbose':_0x5bf1bd['verbose']}),_0x190d53=_0x2796ee['data'],_0x3e9801=_0x557012=>{const _0x5ee365=_0x2ca186;let _0x5c4ca7=0x0,_0x49b824=0x0,_0x87ac3c=0x0;for(const _0x48fd80 of _0x557012){if(_0x48fd80[_0x5ee365(0x97)]===_0x5ee365(0x89))_0x5c4ca7++;else{if(_0x48fd80['type']==='segment')_0x49b824++;else{if(_0x48fd80[_0x5ee365(0x97)]===_0x5ee365(0xb7))_0x87ac3c++;}}if(_0x48fd80[_0x5ee365(0x87)]){const _0x3b5d58=_0x3e9801(_0x48fd80[_0x5ee365(0x87)]);_0x5c4ca7+=_0x3b5d58[_0x5ee365(0x93)],_0x49b824+=_0x3b5d58['segments'],_0x87ac3c+=_0x3b5d58['journeys'];}}return{'folders':_0x5c4ca7,'segments':_0x49b824,'journeys':_0x87ac3c};},_0x128c49=_0x3e9801(_0x190d53);console[_0x2ca186(0xa2)](_0x2ca186(0xa8)+_0x128c49['folders']+_0x2ca186(0xae)+(_0x128c49[_0x2ca186(0x93)]!==0x1?'s':'')+',\x20'+_0x128c49[_0x2ca186(0x92)]+'\x20segment'+(_0x128c49[_0x2ca186(0x92)]!==0x1?'s':'')+_0x2ca186(0xbc)+_0x128c49[_0x2ca186(0x6a)]+_0x2ca186(0xbf)+(_0x128c49['journeys']!==0x1?'s':''));const _0x102b9c=_0x3d413f=>{const _0x1218b7=_0x2ca186;return getConsoleNextUrl(_0x5bf1bd[_0x1218b7(0xb6)],_0x1218b7(0x77)+_0x2ba023[_0x1218b7(0x8b)]+'/e/'+_0x3d413f);},_0x44399b=_0x52e072=>{const _0x1b160f=_0x2ca186;return getConsoleNextUrl(_0x5bf1bd[_0x1b160f(0xb6)],_0x1b160f(0x77)+_0x2ba023[_0x1b160f(0x8b)]+_0x1b160f(0xa4)+_0x52e072+'/j/da');};if(_0x5bf1bd[_0x2ca186(0x9f)]===_0x2ca186(0x83)||_0x5bf1bd[_0x2ca186(0x9f)]===_0x2ca186(0xad))await handleSDKOutput(_0x190d53,_0x5bf1bd);else{console[_0x2ca186(0x79)](a50_0x42b8ec[_0x2ca186(0xab)]('['+_0x4bf849+']'));const _0x260bee=formatTree(_0x190d53,{'showMetadata':!![],'getSegmentUrl':_0x102b9c,'getJourneyUrl':_0x44399b});console[_0x2ca186(0x79)](_0x260bee);}return 0x0;}}function a50_0x2fd8(){const _0x80ae1a=['2ZBRtEA','/e/','cause','5YgKWmN','927804HlPjMS','✔\x20Built\x20tree\x20with\x20','Resolving\x20path\x20\x27','\x20\x20Cause:\x20','dim','Recursive\x20mode:\x20enabled','jsonl','\x20folder','\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22','listUnified','Error:\x20No\x20parent\x20segment\x20context\x20set.','journeyBundleName','padEnd','resolvePathToResource','1340wVAIuI','site','journey','1314465ARyxFb','/j/da','\x5c$&','2700450poQPMH',',\x20and\x20','Parent\x20segment\x20context:\x20','listRecursive','\x20journey','verbose','length','journeys','Found\x20','map','460936zWHjHb','568677BDPbMe','toLowerCase','description','Error:\x20','(id\x20','filter','\x27...','\x20segments\x20share\x20this\x20name\x20—\x20pass\x20the\x20full\x20path\x20(or\x20id)\x20to\x20`tdx\x20sg\x20move`;\x20do\x20not\x20assume\x20the\x20first.','recursive','/app/ps/','No\x20folders\x20or\x20segments\x20match\x20','log','path','data','(empty)',']\x20matching\x20\x27','searchByName','replace','No\x20items\x20match\x20pattern:\x20','execute','Resolving\x20parent\x20segment\x20\x27','json','2007207bGoECb','Set\x20a\x20parent\x20segment\x20context\x20first:','localeCompare','children','message','folder','name','parentId','maxDepth','test','7PkjVmh','segment','listUnifiedWithJourneys','...','segments','folders','\x20segment','\x20matching\x20\x27','(not\x20set)','type','Parent\x20ID:\x20','folderId','✔\x20Found\x20','includes','37169QSdzyT','parentSegment','Folder/pattern\x20arg:\x20','format','Listing\x20folders,\x20segments,\x20and\x20journeys...','List\x20folders\x20and\x20child\x20segments','error'];a50_0x2fd8=function(){return _0x80ae1a;};return a50_0x2fd8();}