@treasuredata/tdx 2026.7.0 → 2026.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) 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.d.ts +20 -0
  13. package/dist/commands/cas-command.d.ts.map +1 -1
  14. package/dist/commands/cas-command.js +1 -1
  15. package/dist/commands/cas-command.js.map +1 -1
  16. package/dist/commands/cas-segment-command.d.ts +24 -0
  17. package/dist/commands/cas-segment-command.d.ts.map +1 -1
  18. package/dist/commands/cas-segment-command.js +1 -1
  19. package/dist/commands/cas-segment-command.js.map +1 -1
  20. package/dist/commands/chat-command.js +1 -1
  21. package/dist/commands/claude-command.js +1 -1
  22. package/dist/commands/claude-statusline-command.js +1 -1
  23. package/dist/commands/claude-usage-command.js +1 -1
  24. package/dist/commands/command.js +1 -1
  25. package/dist/commands/connection-command.js +1 -1
  26. package/dist/commands/databases.js +1 -1
  27. package/dist/commands/delivery-command.js +1 -1
  28. package/dist/commands/describe.js +1 -1
  29. package/dist/commands/engage-campaign-pull-command.js +1 -1
  30. package/dist/commands/engage-campaign-push-command.js +1 -1
  31. package/dist/commands/engage-campaign-validate-command.js +1 -1
  32. package/dist/commands/engage-command.js +1 -1
  33. package/dist/commands/engage-template-pull-command.js +1 -1
  34. package/dist/commands/engage-template-push-command.js +1 -1
  35. package/dist/commands/engage-template-validate-command.js +1 -1
  36. package/dist/commands/job-command.js +1 -1
  37. package/dist/commands/journey-command.js +1 -1
  38. package/dist/commands/journey-validate-command.js +1 -1
  39. package/dist/commands/llm-command.js +1 -1
  40. package/dist/commands/mcp-command.js +1 -1
  41. package/dist/commands/parent-segment-command.js +1 -1
  42. package/dist/commands/policy-command.js +1 -1
  43. package/dist/commands/profile-command.js +1 -1
  44. package/dist/commands/profiles-command.js +1 -1
  45. package/dist/commands/query-command.js +1 -1
  46. package/dist/commands/schedule-command.js +1 -1
  47. package/dist/commands/segment-command.js +1 -1
  48. package/dist/commands/segment-create-command.js +1 -1
  49. package/dist/commands/segment-fields-command.js +1 -1
  50. package/dist/commands/segment-move-command.js +1 -1
  51. package/dist/commands/segment-pull-command.js +1 -1
  52. package/dist/commands/segment-push-command.js +1 -1
  53. package/dist/commands/segment-update-command.js +1 -1
  54. package/dist/commands/segment-use-command.js +1 -1
  55. package/dist/commands/segment-validate-command.js +1 -1
  56. package/dist/commands/segments.js +1 -1
  57. package/dist/commands/show.js +1 -1
  58. package/dist/commands/status-command.js +1 -1
  59. package/dist/commands/table-deleted.js +1 -1
  60. package/dist/commands/tables.js +1 -1
  61. package/dist/commands/unset-command.js +1 -1
  62. package/dist/commands/upgrade-command.js +1 -1
  63. package/dist/commands/use-command.js +1 -1
  64. package/dist/commands/user-command.js +1 -1
  65. package/dist/commands/work-command.js +1 -1
  66. package/dist/commands/workflow-command.js +1 -1
  67. package/dist/core/auth.js +1 -1
  68. package/dist/core/command-output.js +1 -1
  69. package/dist/core/config.js +1 -1
  70. package/dist/core/connection-cache.js +1 -1
  71. package/dist/core/constants.js +1 -1
  72. package/dist/core/credential-cache.js +1 -1
  73. package/dist/core/global-context.js +1 -1
  74. package/dist/core/keychain.js +1 -1
  75. package/dist/core/oauth-keychain.js +1 -1
  76. package/dist/core/oauth.js +1 -1
  77. package/dist/core/profile.js +1 -1
  78. package/dist/core/project-config.js +1 -1
  79. package/dist/core/session.js +1 -1
  80. package/dist/core/user-cache.js +1 -1
  81. package/dist/core/version.js +1 -1
  82. package/dist/index.js +1 -1
  83. package/dist/mcp/server.js +1 -1
  84. package/dist/mcp/tools/index.js +1 -1
  85. package/dist/mcp/tools/tdx-run.js +1 -1
  86. package/dist/mcp/tools/tdx-search.js +1 -1
  87. package/dist/mcp/tools/work-create-item.js +1 -1
  88. package/dist/mcp/utils.js +1 -1
  89. package/dist/proxy/claude-usage-tracker.js +1 -1
  90. package/dist/proxy/passthrough-server.js +1 -1
  91. package/dist/proxy/sse-usage-parser.js +1 -1
  92. package/dist/sdk/agent/agent-config.js +1 -1
  93. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  94. package/dist/sdk/agent/agent-yaml.js +1 -1
  95. package/dist/sdk/agent/test/evaluator.js +1 -1
  96. package/dist/sdk/agent/test/executor.js +1 -1
  97. package/dist/sdk/agent/test/index.js +1 -1
  98. package/dist/sdk/agent/test/output.js +1 -1
  99. package/dist/sdk/agent/test/parser.js +1 -1
  100. package/dist/sdk/agent/tool-target-registry.js +1 -1
  101. package/dist/sdk/api.js +1 -1
  102. package/dist/sdk/cas/cas-api-client.d.ts +83 -3
  103. package/dist/sdk/cas/cas-api-client.d.ts.map +1 -1
  104. package/dist/sdk/cas/cas-api-client.js +1 -1
  105. package/dist/sdk/cas/cas-api-client.js.map +1 -1
  106. package/dist/sdk/cas/cas-audience-schema.d.ts +149 -0
  107. package/dist/sdk/cas/cas-audience-schema.d.ts.map +1 -0
  108. package/dist/sdk/cas/cas-audience-schema.js +1 -0
  109. package/dist/sdk/cas/cas-audience-schema.js.map +1 -0
  110. package/dist/sdk/cas/cas-audience-validator.d.ts +57 -0
  111. package/dist/sdk/cas/cas-audience-validator.d.ts.map +1 -0
  112. package/dist/sdk/cas/cas-audience-validator.js +1 -0
  113. package/dist/sdk/cas/cas-audience-validator.js.map +1 -0
  114. package/dist/sdk/cas/cas-audience-yaml.d.ts +32 -1
  115. package/dist/sdk/cas/cas-audience-yaml.d.ts.map +1 -1
  116. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  117. package/dist/sdk/cas/cas-audience-yaml.js.map +1 -1
  118. package/dist/sdk/cas/cas-segment-yaml.d.ts +30 -2
  119. package/dist/sdk/cas/cas-segment-yaml.d.ts.map +1 -1
  120. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  121. package/dist/sdk/cas/cas-segment-yaml.js.map +1 -1
  122. package/dist/sdk/cas/index.d.ts +21 -0
  123. package/dist/sdk/cas/index.d.ts.map +1 -1
  124. package/dist/sdk/cas/index.js +1 -1
  125. package/dist/sdk/cas/index.js.map +1 -1
  126. package/dist/sdk/cas/pull-workflow.js +1 -1
  127. package/dist/sdk/cas/push-workflow.d.ts +131 -0
  128. package/dist/sdk/cas/push-workflow.d.ts.map +1 -1
  129. package/dist/sdk/cas/push-workflow.js +1 -1
  130. package/dist/sdk/cas/push-workflow.js.map +1 -1
  131. package/dist/sdk/cas/types.d.ts +33 -4
  132. package/dist/sdk/cas/types.d.ts.map +1 -1
  133. package/dist/sdk/cas/validate-files.d.ts +64 -0
  134. package/dist/sdk/cas/validate-files.d.ts.map +1 -0
  135. package/dist/sdk/cas/validate-files.js +1 -0
  136. package/dist/sdk/cas/validate-files.js.map +1 -0
  137. package/dist/sdk/client/cdp-api-client.js +1 -1
  138. package/dist/sdk/client/delivery-api-client.js +1 -1
  139. package/dist/sdk/client/endpoints.d.ts +11 -1
  140. package/dist/sdk/client/endpoints.d.ts.map +1 -1
  141. package/dist/sdk/client/endpoints.js +1 -1
  142. package/dist/sdk/client/endpoints.js.map +1 -1
  143. package/dist/sdk/client/engage-api-client.js +1 -1
  144. package/dist/sdk/client/http-client.d.ts +1 -0
  145. package/dist/sdk/client/http-client.d.ts.map +1 -1
  146. package/dist/sdk/client/http-client.js +1 -1
  147. package/dist/sdk/client/http-client.js.map +1 -1
  148. package/dist/sdk/client/llm-api-client.js +1 -1
  149. package/dist/sdk/client/oauth-refresh.js +1 -1
  150. package/dist/sdk/client/rate-limiter.js +1 -1
  151. package/dist/sdk/client/td-api-client.js +1 -1
  152. package/dist/sdk/client/trino-api-client.js +1 -1
  153. package/dist/sdk/client/workflow-client.js +1 -1
  154. package/dist/sdk/connection-validator.js +1 -1
  155. package/dist/sdk/connection.js +1 -1
  156. package/dist/sdk/delivery.js +1 -1
  157. package/dist/sdk/engage/campaign-pull.js +1 -1
  158. package/dist/sdk/engage/campaign-push.js +1 -1
  159. package/dist/sdk/engage/campaign-validator.js +1 -1
  160. package/dist/sdk/engage/campaign-yaml.js +1 -1
  161. package/dist/sdk/engage/template-pull.js +1 -1
  162. package/dist/sdk/engage/template-push.js +1 -1
  163. package/dist/sdk/engage/template-validator.js +1 -1
  164. package/dist/sdk/engage/template-yaml.js +1 -1
  165. package/dist/sdk/engage/types/campaign-def.js +1 -1
  166. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  167. package/dist/sdk/engage/types/template-schema.js +1 -1
  168. package/dist/sdk/engage.js +1 -1
  169. package/dist/sdk/errors.d.ts +20 -0
  170. package/dist/sdk/errors.d.ts.map +1 -1
  171. package/dist/sdk/errors.js +1 -1
  172. package/dist/sdk/errors.js.map +1 -1
  173. package/dist/sdk/index.js +1 -1
  174. package/dist/sdk/io/index.js +1 -1
  175. package/dist/sdk/io/node-filesystem.js +1 -1
  176. package/dist/sdk/job.js +1 -1
  177. package/dist/sdk/journey.js +1 -1
  178. package/dist/sdk/llm/chat-cache.js +1 -1
  179. package/dist/sdk/llm/index.js +1 -1
  180. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  181. package/dist/sdk/llm/model-factors.js +1 -1
  182. package/dist/sdk/llm/user-settings.js +1 -1
  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.js +1 -1
  191. package/dist/sdk/segment/fields-display.js +1 -1
  192. package/dist/sdk/segment/file-discovery.js +1 -1
  193. package/dist/sdk/segment/journey-utils.js +1 -1
  194. package/dist/sdk/segment/journey-validator.js +1 -1
  195. package/dist/sdk/segment/journey-yaml.js +1 -1
  196. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  197. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  198. package/dist/sdk/segment/pull-workflow.js +1 -1
  199. package/dist/sdk/segment/push-recovery.js +1 -1
  200. package/dist/sdk/segment/push-workflow.js +1 -1
  201. package/dist/sdk/segment/resolution-context.d.ts +16 -7
  202. package/dist/sdk/segment/resolution-context.d.ts.map +1 -1
  203. package/dist/sdk/segment/resolution-context.js +1 -1
  204. package/dist/sdk/segment/resolution-context.js.map +1 -1
  205. package/dist/sdk/segment/segment-path-parser.js +1 -1
  206. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  207. package/dist/sdk/segment/segment-validator.js +1 -1
  208. package/dist/sdk/segment/target-resolution.js +1 -1
  209. package/dist/sdk/segment/tdx-config.js +1 -1
  210. package/dist/sdk/segment/types/activation-schema.js +1 -1
  211. package/dist/sdk/segment/types/journey-def.js +1 -1
  212. package/dist/sdk/segment/types/journey-schema.js +1 -1
  213. package/dist/sdk/segment/types/segment-def.js +1 -1
  214. package/dist/sdk/segment/types/segment-schema.js +1 -1
  215. package/dist/sdk/segment/validate-files.js +1 -1
  216. package/dist/sdk/segment/yaml-validator.d.ts +1 -1
  217. package/dist/sdk/segment/yaml-validator.d.ts.map +1 -1
  218. package/dist/sdk/segment/yaml-validator.js +1 -1
  219. package/dist/sdk/segment/yaml-validator.js.map +1 -1
  220. package/dist/sdk/segment.js +1 -1
  221. package/dist/sdk/types/cas.d.ts +99 -26
  222. package/dist/sdk/types/cas.d.ts.map +1 -1
  223. package/dist/sdk/types/index.d.ts +1 -1
  224. package/dist/sdk/types/index.d.ts.map +1 -1
  225. package/dist/sdk/types/index.js +1 -1
  226. package/dist/sdk/types/index.js.map +1 -1
  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/colors.js +1 -1
  258. package/dist/utils/diff.js +1 -1
  259. package/dist/utils/file-permissions.js +1 -1
  260. package/dist/utils/file-reader.js +1 -1
  261. package/dist/utils/github-releases.js +1 -1
  262. package/dist/utils/global-cache.js +1 -1
  263. package/dist/utils/json-loader.js +1 -1
  264. package/dist/utils/local-cache.js +1 -1
  265. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  266. package/dist/utils/logger/formatters/index.js +1 -1
  267. package/dist/utils/logger/handlers/console-handler.js +1 -1
  268. package/dist/utils/logger/handlers/file-handler.js +1 -1
  269. package/dist/utils/logger/handlers/index.js +1 -1
  270. package/dist/utils/logger/handlers/null-handler.js +1 -1
  271. package/dist/utils/logger/index.js +1 -1
  272. package/dist/utils/logger/logger.js +1 -1
  273. package/dist/utils/logger/types.js +1 -1
  274. package/dist/utils/option-validation.js +1 -1
  275. package/dist/utils/process.js +1 -1
  276. package/dist/utils/prompt.js +1 -1
  277. package/dist/utils/spinner.js +1 -1
  278. package/dist/utils/sse-parser.js +1 -1
  279. package/dist/utils/string-utils.js +1 -1
  280. package/dist/utils/table-ref-parser.js +1 -1
  281. package/dist/utils/tdx-logger.js +1 -1
  282. package/dist/utils/version-check.js +1 -1
  283. package/package.json +1 -1
@@ -1 +1 @@
1
- const a40_0x27c324=a40_0x3931;function a40_0x384e(){const _0x551251=['\x20\x20tdx\x20segment\x20move\x20\x22VIP\x20Customers\x22\x20--folder\x20\x22Archive\x22\x20\x20\x20#\x20by\x20name\x20(needs\x20parent\x20context)','\x20→\x20','\x27\x20matches\x20','1128wPmSrG','folderId','\x27...','21yxyvfi','dryRun','for\x20move\x20to','\x27\x20to\x20folder\x20\x27','join','Searching\x20folders\x20for\x20\x27','map','\x20\x20tdx\x20segment\x20move\x201603887\x20--folder\x208299501','includes','Or\x20pass\x20flag:\x20\x20--parent-segment\x20\x22<name>\x22','SEGMENT_NOT_FOUND','slot','resolveEntitiesInParent','Error:\x20no\x20parent\x20segment\x20context\x20—\x20moving\x20by\x20name\x20needs\x20one.\x0a','Re-run\x20`tdx\x20sg\x20move`\x20with\x20that\x20full\x20path\x20(or\x20the\x20id).','2941708Mdbqep','277774PfZKkr','red','[dry-run]\x20No\x20changes\x20made.\x20','description','some','Or\x20use\x20IDs:\x20\x20\x20\x20tdx\x20sg\x20list\x20-r\x20--json\x20\x20(then\x20pass\x20the\x20numeric\x20ids)','explainAmbiguousName','1059684yoRglH','preserved:','\x20segment','\x20\x20(id\x20','verbose','Moving','forEach','74493IEFYlQ','moveSegments','cyan','segment:move','length','test','Segments:\x20','parentId','9132hgfjgN','push','Error:\x20\x27','Examples:','data','Searching\x20the\x20tree...','\x27,\x20\x27','\x20\x20•\x20','get','•\x20[dry-run]\x20Would\x20move\x20segment\x20\x27','3713580dNerBj','\x27\x20—\x20','Usage:\x20tdx\x20segment\x20move\x20<segment...>\x20--folder\x20<folder>','\x20\x20tdx\x20segment\x20move\x201603887\x201603888\x201603889\x20--folder\x208299501','Checking','yellow','path','code','segment','segmentFolderId','Duplicate\x20segments\x20removed\x20(','name','rule\x20','601844EnHLGK','\x27\x20isn\x27t\x20at\x20the\x20top\x20level\x20—\x20it\x27s\x20nested\x20at:','Move\x20one\x20or\x20more\x20segments\x20to\x20a\x20different\x20folder','filter','Set\x20context:\x20\x20\x20tdx\x20use\x20parent_segment\x20\x22<name>\x22','error','\x20condition','has','\x20segment(s)\x20would\x20be\x20moved.','865StsWgS','toLowerCase'];a40_0x384e=function(){return _0x551251;};return a40_0x384e();}(function(_0x5b513a,_0xfc71da){const _0x57ada3=a40_0x3931,_0x51d8c4=_0x5b513a();while(!![]){try{const _0x3b58ce=-parseInt(_0x57ada3(0xaa))/0x1+-parseInt(_0x57ada3(0xcb))/0x2*(-parseInt(_0x57ada3(0xbb))/0x3)+parseInt(_0x57ada3(0x93))/0x4*(-parseInt(_0x57ada3(0xb3))/0x5)+-parseInt(_0x57ada3(0xd2))/0x6+-parseInt(_0x57ada3(0xca))/0x7+-parseInt(_0x57ada3(0xb8))/0x8*(-parseInt(_0x57ada3(0x8b))/0x9)+parseInt(_0x57ada3(0x9d))/0xa;if(_0x3b58ce===_0xfc71da)break;else _0x51d8c4['push'](_0x51d8c4['shift']());}catch(_0xddfdf5){_0x51d8c4['push'](_0x51d8c4['shift']());}}}(a40_0x384e,0xdfde3));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a40_0x3931(_0x311bda,_0x4dd50c){_0x311bda=_0x311bda-0x85;const _0x384e84=a40_0x384e();let _0x3931e9=_0x384e84[_0x311bda];return _0x3931e9;}import{withSpinner}from'../utils/spinner.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{searchTreeByName}from'../sdk/util/tree-search.js';import a40_0x53a960 from'chalk';export class SegmentMoveCommand extends BaseCommand{[a40_0x27c324(0xa8)]=a40_0x27c324(0x8e);[a40_0x27c324(0xce)]=a40_0x27c324(0xac);async['execute'](_0x4be43d){const _0x3db098=a40_0x27c324,{options:_0x4322cb,args:_0x15151c,tdx:_0x518a2e}=_0x4be43d,_0x3a1a71=_0x15151c,_0x5078e5=_0x4322cb['folder'];if(_0x3a1a71[_0x3db098(0x8f)]===0x0||!_0x5078e5)return console['error'](a40_0x53a960['red']('Error:\x20at\x20least\x20one\x20<segment>\x20and\x20--folder\x20<folder>\x20are\x20required\x0a')),console[_0x3db098(0xaf)](_0x3db098(0x9f)),console[_0x3db098(0xaf)](_0x3db098(0x96)),console['error'](_0x3db098(0xc2)),console[_0x3db098(0xaf)](_0x3db098(0xa0)),console[_0x3db098(0xaf)](_0x3db098(0xb5)),console[_0x3db098(0xaf)]('\x0aTip:\x20run\x20`tdx\x20segment\x20list\x20-r`\x20to\x20find\x20segment\x20and\x20folder\x20names/IDs.'),0x1;_0x4322cb[_0x3db098(0x88)]&&(console[_0x3db098(0xaf)](_0x3db098(0x91)+_0x3a1a71[_0x3db098(0xbf)](',\x20')),console['error']('Target\x20folder:\x20'+_0x5078e5));const _0x342cc4=[...new Set(_0x3a1a71)];_0x342cc4['length']<_0x3a1a71[_0x3db098(0x8f)]&&console['error'](a40_0x53a960[_0x3db098(0xa2)](_0x3db098(0xa7)+_0x3a1a71[_0x3db098(0x8f)]+_0x3db098(0xb6)+_0x342cc4[_0x3db098(0x8f)]+').'));const _0x1ddc89=/^\d+$/,_0x17be82=_0x4322cb['parentSegment'],_0x6a9f=[..._0x342cc4,_0x5078e5][_0x3db098(0xcf)](_0x2c7f9d=>!_0x1ddc89[_0x3db098(0x90)](_0x2c7f9d));if(_0x6a9f&&!_0x17be82)return console[_0x3db098(0xaf)](a40_0x53a960[_0x3db098(0xcc)](_0x3db098(0xc8))),console['error'](_0x3db098(0xae)),console['error'](_0x3db098(0xc4)),console[_0x3db098(0xaf)](_0x3db098(0xd0)),0x1;const _0x6ccc1=_0x342cc4[_0x3db098(0x8f)],_0x7f780b=_0x4322cb[_0x3db098(0xbc)]===!![];let _0x30ea06;try{const _0x1d886d=await withSpinner((_0x7f780b?_0x3db098(0xa1):_0x3db098(0x89))+'\x20'+_0x6ccc1+_0x3db098(0x86)+(_0x6ccc1===0x1?'':'s')+'\x20'+((_0x7f780b?_0x3db098(0xbd):'to')+'\x20folder\x20\x27'+_0x5078e5+_0x3db098(0xba)),async()=>{const _0x556fc6=_0x3db098,_0x4b45d7=[];_0x342cc4[_0x556fc6(0x8a)]((_0x259145,_0x342ad8)=>{const _0x5636d1=_0x556fc6;if(!_0x1ddc89['test'](_0x259145))_0x4b45d7[_0x5636d1(0x94)]({'name':_0x259145,'expectType':_0x5636d1(0xa5),'slot':_0x342ad8});});if(!_0x1ddc89['test'](_0x5078e5))_0x4b45d7[_0x556fc6(0x94)]({'name':_0x5078e5,'expectType':'folder','slot':-0x1});const _0xfb4003=new Map();if(_0x4b45d7[_0x556fc6(0x8f)]>0x0){const _0xc7c5f2=await _0x518a2e[_0x556fc6(0xa5)][_0x556fc6(0xc7)](_0x17be82,_0x4b45d7[_0x556fc6(0xc1)](({name:_0x2c50d1,expectType:_0x48c092})=>({'name':_0x2c50d1,'expectType':_0x48c092})));_0xc7c5f2['forEach']((_0x19f65e,_0x3878d4)=>_0xfb4003['set'](_0x4b45d7[_0x3878d4][_0x556fc6(0xc6)],_0x19f65e['id']));}const _0x158e2e=_0x342cc4[_0x556fc6(0xc1)]((_0x3909f0,_0x8e0fd9)=>_0x1ddc89['test'](_0x3909f0)?_0x3909f0:_0xfb4003[_0x556fc6(0x9b)](_0x8e0fd9)),_0x3ed5c2=_0x1ddc89[_0x556fc6(0x90)](_0x5078e5)?_0x5078e5:_0xfb4003[_0x556fc6(0x9b)](-0x1);return _0x518a2e['segment'][_0x556fc6(0x8c)](_0x158e2e,_0x3ed5c2,_0x7f780b);},{'verbose':_0x4322cb[_0x3db098(0x88)]});_0x30ea06=_0x1d886d[_0x3db098(0x97)];}catch(_0x3e71ce){if(_0x3e71ce instanceof SDKError&&_0x3e71ce[_0x3db098(0xa4)]===ErrorCode[_0x3db098(0xc5)]&&_0x17be82)try{if(await this[_0x3db098(0xd1)](_0x518a2e,_0x17be82,_0x342cc4,_0x4322cb))return 0x1;}catch{}throw _0x3e71ce;}for(const _0x2d5cbc of _0x30ea06){const _0x2cc63f=_0x2d5cbc['ruleConditionCount'],_0x1094eb=_0x3db098(0xa9)+(_0x7f780b?_0x3db098(0xb1):_0x3db098(0x85))+'\x20'+_0x2cc63f+_0x3db098(0xb0)+(_0x2cc63f===0x1?'':'s');console[_0x3db098(0xaf)](_0x7f780b?a40_0x53a960['cyan'](_0x3db098(0x9c)+_0x2d5cbc['id']+'\x27\x20to\x20folder\x20\x27'+_0x2d5cbc[_0x3db098(0xa6)]+_0x3db098(0x9e)+_0x1094eb):a40_0x53a960['green']('✔\x20Moved\x20segment\x20\x27'+_0x2d5cbc['id']+_0x3db098(0xbe)+_0x2d5cbc[_0x3db098(0xa6)]+_0x3db098(0x9e)+_0x1094eb+'\x20(verified\x20by\x20re-read)'));}if(_0x7f780b)console[_0x3db098(0xaf)](a40_0x53a960[_0x3db098(0x8d)](_0x3db098(0xcd)+_0x6ccc1+_0x3db098(0xb2)));else _0x30ea06[_0x3db098(0x8f)]>0x1&&console[_0x3db098(0xaf)](a40_0x53a960['green']('✔\x20'+_0x30ea06[_0x3db098(0x8f)]+'\x20segments\x20moved,\x20all\x20rules\x20verified\x20intact'));return await handleSDKOutput(_0x30ea06,_0x4322cb),0x0;}async[a40_0x27c324(0xd1)](_0x3a85c4,_0x458654,_0x5f48e6,_0x10709e){const _0x1fb36c=a40_0x27c324,_0x453beb=_0x5f48e6[_0x1fb36c(0xad)](_0x32b4be=>!/^\d+$/[_0x1fb36c(0x90)](_0x32b4be)&&!_0x32b4be[_0x1fb36c(0xc3)]('/'));if(_0x453beb['length']===0x0)return![];const _0x413da3=await withSpinner(_0x1fb36c(0xc0)+_0x453beb['join'](_0x1fb36c(0x99))+'\x27...',()=>_0x3a85c4[_0x1fb36c(0xa5)]['resolvePathToResource'](_0x458654),{'verbose':_0x10709e[_0x1fb36c(0x88)]}),_0x30d59e=(await withSpinner(_0x1fb36c(0x98),()=>_0x3a85c4['segment']['listRecursive'](_0x413da3[_0x1fb36c(0x97)][_0x1fb36c(0x92)],_0x413da3[_0x1fb36c(0x97)][_0x1fb36c(0xb9)],0x0,0xa),{'verbose':_0x10709e[_0x1fb36c(0x88)]}))[_0x1fb36c(0x97)];let _0x611d1e=![];for(const _0x35a081 of _0x453beb){const _0x2e9123=searchTreeByName(_0x30d59e,_0x35a081)[_0x1fb36c(0xad)](_0x180465=>_0x180465['type']===_0x1fb36c(0xa5)&&_0x180465[_0x1fb36c(0xa8)][_0x1fb36c(0xb4)]()===_0x35a081[_0x1fb36c(0xb4)]());if(_0x2e9123[_0x1fb36c(0x8f)]>0x1){_0x611d1e=!![],console['error'](a40_0x53a960['red'](_0x1fb36c(0x95)+_0x35a081+_0x1fb36c(0xb7)+_0x2e9123[_0x1fb36c(0x8f)]+'\x20segments\x20—\x20refusing\x20to\x20guess.\x20Pass\x20the\x20full\x20path\x20(or\x20id)\x20of\x20the\x20one\x20you\x20mean:'));for(const _0x553112 of _0x2e9123)console['error'](_0x1fb36c(0x9a)+_0x553112['path']+_0x1fb36c(0x87)+_0x553112['id']+')');}else _0x2e9123[_0x1fb36c(0x8f)]===0x1&&(_0x611d1e=!![],console[_0x1fb36c(0xaf)](a40_0x53a960[_0x1fb36c(0xcc)](_0x1fb36c(0x95)+_0x35a081+_0x1fb36c(0xab))),console[_0x1fb36c(0xaf)]('\x20\x20'+_0x2e9123[0x0][_0x1fb36c(0xa3)]+_0x1fb36c(0x87)+_0x2e9123[0x0]['id']+')'),console['error'](_0x1fb36c(0xc9)));}return _0x611d1e;}}
1
+ const a40_0x4152f5=a40_0x3de3;function a40_0x4020(){const _0x48bf54=['\x20\x20tdx\x20segment\x20move\x201603887\x201603888\x201603889\x20--folder\x208299501','length','\x20segments\x20—\x20refusing\x20to\x20guess.\x20Pass\x20the\x20full\x20path\x20(or\x20id)\x20of\x20the\x20one\x20you\x20mean:','Searching\x20folders\x20for\x20\x27','[dry-run]\x20No\x20changes\x20made.\x20','data','✔\x20Moved\x20segment\x20\x27','toLowerCase','forEach','explainAmbiguousName','\x20segments\x20moved,\x20all\x20rules\x20verified\x20intact','name','Searching\x20the\x20tree...','Examples:','566016dfYGIZ','Move\x20one\x20or\x20more\x20segments\x20to\x20a\x20different\x20folder','\x0aTip:\x20run\x20`tdx\x20segment\x20list\x20-r`\x20to\x20find\x20segment\x20and\x20folder\x20names/IDs.','235388qSYWwG','Moving','cyan','20170FWAXXa','join','968740ZhsuUa','\x20\x20tdx\x20segment\x20move\x201603887\x20--folder\x208299501','ruleConditionCount','code','segmentFolderId','red','\x20(verified\x20by\x20re-read)','push','Set\x20context:\x20\x20\x20tdx\x20use\x20parent_segment\x20\x22<name>\x22','path','\x27\x20to\x20folder\x20\x27','folderId','slot','1027840FCkegU','set','\x20\x20•\x20','Error:\x20no\x20parent\x20segment\x20context\x20—\x20moving\x20by\x20name\x20needs\x20one.\x0a','\x20\x20tdx\x20segment\x20move\x20\x22VIP\x20Customers\x22\x20--folder\x20\x22Archive\x22\x20\x20\x20#\x20by\x20name\x20(needs\x20parent\x20context)','4086RQdiEV','segment:move','dryRun','12900ZLLmUe','rule\x20','\x20\x20(id\x20','\x20segment(s)\x20would\x20be\x20moved.','\x27\x20—\x20','Checking','folder','Error:\x20at\x20least\x20one\x20<segment>\x20and\x20--folder\x20<folder>\x20are\x20required\x0a','filter','preserved:','1169XyzcGM','segment','error','get','221187MqInlh','\x27,\x20\x27','test','yellow','•\x20[dry-run]\x20Would\x20move\x20segment\x20\x27','Duplicate\x20segments\x20removed\x20(','\x27...','parentId','\x20→\x20','Or\x20pass\x20flag:\x20\x20--parent-segment\x20\x22<name>\x22','Usage:\x20tdx\x20segment\x20move\x20<segment...>\x20--folder\x20<folder>','21DuUlNB','\x27\x20matches\x20','listRecursive','green','Error:\x20\x27','Target\x20folder:\x20','SEGMENT_NOT_FOUND','Re-run\x20`tdx\x20sg\x20move`\x20with\x20that\x20full\x20path\x20(or\x20the\x20id).','map','verbose','parentSegment','some','description'];a40_0x4020=function(){return _0x48bf54;};return a40_0x4020();}function a40_0x3de3(_0x2b440e,_0x127276){_0x2b440e=_0x2b440e-0x116;const _0x402037=a40_0x4020();let _0x3de318=_0x402037[_0x2b440e];return _0x3de318;}(function(_0xfaa855,_0x250b01){const _0x7b1a9f=a40_0x3de3,_0x2b1afd=_0xfaa855();while(!![]){try{const _0x4c01f1=-parseInt(_0x7b1a9f(0x158))/0x1+parseInt(_0x7b1a9f(0x142))/0x2+parseInt(_0x7b1a9f(0x163))/0x3*(parseInt(_0x7b1a9f(0x130))/0x4)+parseInt(_0x7b1a9f(0x135))/0x5+parseInt(_0x7b1a9f(0x14a))/0x6*(parseInt(_0x7b1a9f(0x154))/0x7)+-parseInt(_0x7b1a9f(0x12d))/0x8+-parseInt(_0x7b1a9f(0x147))/0x9*(parseInt(_0x7b1a9f(0x133))/0xa);if(_0x4c01f1===_0x250b01)break;else _0x2b1afd['push'](_0x2b1afd['shift']());}catch(_0x1f4bc3){_0x2b1afd['push'](_0x2b1afd['shift']());}}}(a40_0x4020,0x4228e));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{searchTreeByName}from'../sdk/util/tree-search.js';import a40_0xace9ba from'chalk';export class SegmentMoveCommand extends BaseCommand{[a40_0x4152f5(0x12a)]=a40_0x4152f5(0x148);[a40_0x4152f5(0x11e)]=a40_0x4152f5(0x12e);async['execute'](_0x2f75f6){const _0x16e36e=a40_0x4152f5,{options:_0x4a0995,args:_0x4006ef,tdx:_0x559121}=_0x2f75f6,_0x3fd1ea=_0x4006ef,_0x552da6=_0x4a0995['folder'];if(_0x3fd1ea['length']===0x0||!_0x552da6)return console['error'](a40_0xace9ba['red'](_0x16e36e(0x151))),console[_0x16e36e(0x156)](_0x16e36e(0x162)),console[_0x16e36e(0x156)](_0x16e36e(0x12c)),console[_0x16e36e(0x156)](_0x16e36e(0x136)),console[_0x16e36e(0x156)](_0x16e36e(0x11f)),console[_0x16e36e(0x156)](_0x16e36e(0x146)),console[_0x16e36e(0x156)](_0x16e36e(0x12f)),0x1;_0x4a0995[_0x16e36e(0x11b)]&&(console[_0x16e36e(0x156)]('Segments:\x20'+_0x3fd1ea[_0x16e36e(0x134)](',\x20')),console[_0x16e36e(0x156)](_0x16e36e(0x117)+_0x552da6));const _0x272459=[...new Set(_0x3fd1ea)];_0x272459[_0x16e36e(0x120)]<_0x3fd1ea['length']&&console['error'](a40_0xace9ba[_0x16e36e(0x15b)](_0x16e36e(0x15d)+_0x3fd1ea['length']+_0x16e36e(0x160)+_0x272459[_0x16e36e(0x120)]+').'));const _0x135c29=/^\d+$/,_0x58c5a1=_0x4a0995[_0x16e36e(0x11c)],_0x1672bc=[..._0x272459,_0x552da6][_0x16e36e(0x11d)](_0x590e9c=>!_0x135c29['test'](_0x590e9c));if(_0x1672bc&&!_0x58c5a1)return console[_0x16e36e(0x156)](a40_0xace9ba[_0x16e36e(0x13a)](_0x16e36e(0x145))),console['error'](_0x16e36e(0x13d)),console['error'](_0x16e36e(0x161)),console['error']('Or\x20use\x20IDs:\x20\x20\x20\x20tdx\x20sg\x20list\x20-r\x20--json\x20\x20(then\x20pass\x20the\x20numeric\x20ids)'),0x1;const _0x11bd9e=_0x272459[_0x16e36e(0x120)],_0x2c2554=_0x4a0995[_0x16e36e(0x149)]===!![];let _0xb13761;try{const _0x14676b=await withSpinner((_0x2c2554?_0x16e36e(0x14f):_0x16e36e(0x131))+'\x20'+_0x11bd9e+'\x20segment'+(_0x11bd9e===0x1?'':'s')+'\x20'+((_0x2c2554?'for\x20move\x20to':'to')+'\x20folder\x20\x27'+_0x552da6+_0x16e36e(0x15e)),async()=>{const _0x1b9907=_0x16e36e,_0x5777ba=[];_0x272459[_0x1b9907(0x127)]((_0x537ac6,_0x3333e1)=>{const _0x3a7e4f=_0x1b9907;if(!_0x135c29[_0x3a7e4f(0x15a)](_0x537ac6))_0x5777ba[_0x3a7e4f(0x13c)]({'name':_0x537ac6,'expectType':'segment','slot':_0x3333e1});});if(!_0x135c29[_0x1b9907(0x15a)](_0x552da6))_0x5777ba['push']({'name':_0x552da6,'expectType':_0x1b9907(0x150),'slot':-0x1});const _0x1bdb1c=new Map();if(_0x5777ba[_0x1b9907(0x120)]>0x0){const _0x3e8157=await _0x559121[_0x1b9907(0x155)]['resolveEntitiesInParent'](_0x58c5a1,_0x5777ba['map'](({name:_0x33f73e,expectType:_0x1cbacc})=>({'name':_0x33f73e,'expectType':_0x1cbacc})));_0x3e8157[_0x1b9907(0x127)]((_0x1be969,_0x22685d)=>_0x1bdb1c[_0x1b9907(0x143)](_0x5777ba[_0x22685d][_0x1b9907(0x141)],_0x1be969['id']));}const _0x3f7e96=_0x272459[_0x1b9907(0x11a)]((_0x54b616,_0x1d8868)=>_0x135c29[_0x1b9907(0x15a)](_0x54b616)?_0x54b616:_0x1bdb1c[_0x1b9907(0x157)](_0x1d8868)),_0x42e4eb=_0x135c29['test'](_0x552da6)?_0x552da6:_0x1bdb1c[_0x1b9907(0x157)](-0x1);return _0x559121[_0x1b9907(0x155)]['moveSegments'](_0x3f7e96,_0x42e4eb,_0x2c2554);},{'verbose':_0x4a0995[_0x16e36e(0x11b)]});_0xb13761=_0x14676b[_0x16e36e(0x124)];}catch(_0x37521c){if(_0x37521c instanceof SDKError&&_0x37521c[_0x16e36e(0x138)]===ErrorCode[_0x16e36e(0x118)]&&_0x58c5a1)try{if(await this['explainAmbiguousName'](_0x559121,_0x58c5a1,_0x272459,_0x4a0995))return 0x1;}catch{}throw _0x37521c;}for(const _0x525ab2 of _0xb13761){const _0x14cd49=_0x525ab2[_0x16e36e(0x137)],_0x466884=_0x16e36e(0x14b)+(_0x2c2554?'has':_0x16e36e(0x153))+'\x20'+_0x14cd49+'\x20condition'+(_0x14cd49===0x1?'':'s');console[_0x16e36e(0x156)](_0x2c2554?a40_0xace9ba['cyan'](_0x16e36e(0x15c)+_0x525ab2['id']+'\x27\x20to\x20folder\x20\x27'+_0x525ab2['segmentFolderId']+'\x27\x20—\x20'+_0x466884):a40_0xace9ba[_0x16e36e(0x166)](_0x16e36e(0x125)+_0x525ab2['id']+_0x16e36e(0x13f)+_0x525ab2[_0x16e36e(0x139)]+_0x16e36e(0x14e)+_0x466884+_0x16e36e(0x13b)));}if(_0x2c2554)console[_0x16e36e(0x156)](a40_0xace9ba[_0x16e36e(0x132)](_0x16e36e(0x123)+_0x11bd9e+_0x16e36e(0x14d)));else _0xb13761['length']>0x1&&console[_0x16e36e(0x156)](a40_0xace9ba['green']('✔\x20'+_0xb13761[_0x16e36e(0x120)]+_0x16e36e(0x129)));return await handleSDKOutput(_0xb13761,_0x4a0995),0x0;}async[a40_0x4152f5(0x128)](_0x55a9e8,_0x56c378,_0x419d5c,_0x1745d7){const _0x18e3e8=a40_0x4152f5,_0xfa8c0a=_0x419d5c[_0x18e3e8(0x152)](_0x48d40b=>!/^\d+$/[_0x18e3e8(0x15a)](_0x48d40b)&&!_0x48d40b['includes']('/'));if(_0xfa8c0a['length']===0x0)return![];const _0x3b29d7=await withSpinner(_0x18e3e8(0x122)+_0xfa8c0a[_0x18e3e8(0x134)](_0x18e3e8(0x159))+_0x18e3e8(0x15e),()=>_0x55a9e8[_0x18e3e8(0x155)]['resolvePathToResource'](_0x56c378),{'verbose':_0x1745d7[_0x18e3e8(0x11b)]}),_0x38a156=(await withSpinner(_0x18e3e8(0x12b),()=>_0x55a9e8['segment'][_0x18e3e8(0x165)](_0x3b29d7[_0x18e3e8(0x124)][_0x18e3e8(0x15f)],_0x3b29d7[_0x18e3e8(0x124)][_0x18e3e8(0x140)],0x0,0xa),{'verbose':_0x1745d7[_0x18e3e8(0x11b)]}))[_0x18e3e8(0x124)];let _0x372317=![];for(const _0xafa335 of _0xfa8c0a){const _0x203f72=searchTreeByName(_0x38a156,_0xafa335)['filter'](_0x2bb9d9=>_0x2bb9d9['type']===_0x18e3e8(0x155)&&_0x2bb9d9[_0x18e3e8(0x12a)][_0x18e3e8(0x126)]()===_0xafa335[_0x18e3e8(0x126)]());if(_0x203f72[_0x18e3e8(0x120)]>0x1){_0x372317=!![],console[_0x18e3e8(0x156)](a40_0xace9ba['red'](_0x18e3e8(0x116)+_0xafa335+_0x18e3e8(0x164)+_0x203f72[_0x18e3e8(0x120)]+_0x18e3e8(0x121)));for(const _0x24ec35 of _0x203f72)console[_0x18e3e8(0x156)](_0x18e3e8(0x144)+_0x24ec35[_0x18e3e8(0x13e)]+_0x18e3e8(0x14c)+_0x24ec35['id']+')');}else _0x203f72['length']===0x1&&(_0x372317=!![],console[_0x18e3e8(0x156)](a40_0xace9ba['red'](_0x18e3e8(0x116)+_0xafa335+'\x27\x20isn\x27t\x20at\x20the\x20top\x20level\x20—\x20it\x27s\x20nested\x20at:')),console[_0x18e3e8(0x156)]('\x20\x20'+_0x203f72[0x0]['path']+'\x20\x20(id\x20'+_0x203f72[0x0]['id']+')'),console[_0x18e3e8(0x156)](_0x18e3e8(0x119)));}return _0x372317;}}
@@ -1 +1 @@
1
- const a41_0x2e2a6a=a41_0x5e28;(function(_0x2a89a5,_0x1fb443){const _0x498f38=a41_0x5e28,_0x34925d=_0x2a89a5();while(!![]){try{const _0x3fa593=-parseInt(_0x498f38(0x9e))/0x1*(-parseInt(_0x498f38(0xba))/0x2)+parseInt(_0x498f38(0xc5))/0x3+parseInt(_0x498f38(0xb2))/0x4+parseInt(_0x498f38(0xb5))/0x5+-parseInt(_0x498f38(0x9d))/0x6+-parseInt(_0x498f38(0xc2))/0x7*(parseInt(_0x498f38(0xa0))/0x8)+-parseInt(_0x498f38(0x92))/0x9;if(_0x3fa593===_0x1fb443)break;else _0x34925d['push'](_0x34925d['shift']());}catch(_0x1fa718){_0x34925d['push'](_0x34925d['shift']());}}}(a41_0x2b90,0xd1421));function a41_0x2b90(){const _0x520f4d=['counts','name','description','message','\x0aPull\x20summary\x20for\x20\x27','parentName','no_parent','✔\x20Context\x20set:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','session','type','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','segment:pull','resourceName','filter','length','red','files','content','-\x20no\x20files\x20written','16577901enHXJo','journeyVersions','relativePath','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','execute','\x20segments','absolutePath','dirname','dim','\x20\x20Target:\x20','file','5965218PSDkQq','503bRyYOg','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)','5328cSUmIT','error','\x20changed\x20files','\x0aError:','verbose','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','\x20\x20🎯\x20','cwd','Pulling\x20segments\x20from\x20\x27','Parent\x20segment:\x20','\x0aChanges\x20to\x20\x27','segments','data','pullSegments','green','\x20journeys','yellow','Error:\x20','5955604jKfDyL','setPhase','journeys','2319350sXOYNJ','✔\x20Pulled\x20','parent_segment','site','yes','1874bWXSIg','\x27...','parentSegment','hasChanges','Aborted.','\x20new\x20files','activations','cyan','546HJavNZ','helpText','targetDir','3963537UERILJ','\x20activations','Site:\x20'];a41_0x2b90=function(){return _0x520f4d;};return a41_0x2b90();}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 a41_0x5894c6 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';function a41_0x5e28(_0x3e4d24,_0x54baa2){_0x3e4d24=_0x3e4d24-0x81;const _0x2b90b4=a41_0x2b90();let _0x5e28c9=_0x2b90b4[_0x3e4d24];return _0x5e28c9;}import a41_0x55dce 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{[a41_0x2e2a6a(0xc9)]=a41_0x2e2a6a(0x8a);[a41_0x2e2a6a(0xca)]=a41_0x2e2a6a(0x89);async[a41_0x2e2a6a(0x96)](_0x288048){const _0x4d540a=a41_0x2e2a6a,{options:_0x83ef8d,args:_0x419f85,tdx:_0x1ab800}=_0x288048,_0x49ab7f=_0x83ef8d,_0x3ce2a6=await resolveTarget({'arg':_0x419f85[0x0],'contextParent':_0x83ef8d[_0x4d540a(0xbc)],'cwd':process[_0x4d540a(0xa7)]()});if(!isSuccessfulResolution(_0x3ce2a6))return _0x3ce2a6['errorCode']===_0x4d540a(0x84)?(console['error'](a41_0x5894c6['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console['error'](_0x4d540a(0x9f)),console['error'](_0x4d540a(0x86)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file')):(console[_0x4d540a(0xa1)](a41_0x5894c6['red'](_0x4d540a(0xb1)+_0x3ce2a6[_0x4d540a(0x81)]+'\x0a')),_0x3ce2a6[_0x4d540a(0xc3)]&&console[_0x4d540a(0xa1)](a41_0x5894c6[_0x4d540a(0xc1)](_0x3ce2a6[_0x4d540a(0xc3)]))),0x1;const _0x1f032b=_0x3ce2a6[_0x4d540a(0x83)],_0x34caff=_0x3ce2a6[_0x4d540a(0xc4)],_0x45b75b=_0x3ce2a6[_0x4d540a(0x88)]===_0x4d540a(0x9c)?_0x3ce2a6[_0x4d540a(0x8b)]:undefined;_0x49ab7f[_0x4d540a(0xa4)]&&(console[_0x4d540a(0xa1)](_0x4d540a(0xc7)+_0x49ab7f[_0x4d540a(0xb8)]),console[_0x4d540a(0xa1)](_0x4d540a(0xa9)+_0x1f032b),_0x45b75b&&console[_0x4d540a(0xa1)]('Target\x20resource:\x20'+_0x45b75b));const _0x496015=await withProgressSpinner(_0x4d540a(0xa8)+_0x1f032b+_0x4d540a(0xbb),_0x149c87=>_0x1ab800['segment'][_0x4d540a(0xad)](_0x1f032b,{'targetDir':_0x34caff,'targetResourceName':_0x45b75b,'verbose':_0x49ab7f[_0x4d540a(0xa4)],'progress':{'update':_0x309abc=>{const _0x1797c7=_0x4d540a;_0x149c87[_0x1797c7(0xb3)](_0x309abc),_0x49ab7f['verbose']&&console[_0x1797c7(0xa1)]('\x20\x20'+_0x309abc);}}}),{'verbose':_0x49ab7f[_0x4d540a(0xa4)]}),_0x2c8e97=_0x496015[_0x4d540a(0xac)];if(_0x2c8e97['counts'][_0x4d540a(0xab)]===0x0&&_0x2c8e97['counts'][_0x4d540a(0xb4)]===0x0)return console[_0x4d540a(0xa1)](a41_0x5894c6[_0x4d540a(0xb0)](_0x4d540a(0xa5)+_0x2c8e97['parentName']+'\x27')),0x0;const _0xb8638e=_0x2c8e97[_0x4d540a(0x8f)]['filter'](_0x4423cc=>_0x4423cc['isNew']),_0x4fb2f8=_0x2c8e97[_0x4d540a(0x8f)][_0x4d540a(0x8c)](_0x340c7c=>!_0x340c7c['isNew']&&_0x340c7c['hasChanges']),_0x224106=_0x2c8e97[_0x4d540a(0x8f)][_0x4d540a(0x8c)](_0x4908c2=>!_0x4908c2['isNew']&&!_0x4908c2[_0x4d540a(0xbd)]);console[_0x4d540a(0xa1)](_0x4d540a(0x82)+_0x2c8e97['parentName']+'\x27:'),console[_0x4d540a(0xa1)](_0x4d540a(0xa6)+a41_0x5894c6[_0x4d540a(0xc1)](_0x2c8e97[_0x4d540a(0xc8)][_0x4d540a(0xab)]+_0x4d540a(0x97))+'\x20with\x20'+a41_0x5894c6['cyan'](_0x2c8e97[_0x4d540a(0xc8)][_0x4d540a(0xc0)]+_0x4d540a(0xc6)));if(_0x2c8e97['counts'][_0x4d540a(0xb4)]>0x0){const _0x420f0f=_0x2c8e97[_0x4d540a(0xc8)][_0x4d540a(0x93)]>_0x2c8e97[_0x4d540a(0xc8)][_0x4d540a(0xb4)]?'\x20('+_0x2c8e97[_0x4d540a(0xc8)][_0x4d540a(0x93)]+'\x20versions)':'';console[_0x4d540a(0xa1)]('\x20\x20🗺️\x20\x20'+a41_0x5894c6['cyan'](_0x2c8e97[_0x4d540a(0xc8)]['journeys']+_0x4d540a(0xaf))+a41_0x5894c6[_0x4d540a(0x9a)](_0x420f0f));}console[_0x4d540a(0xa1)]('\x20\x20'+a41_0x5894c6[_0x4d540a(0xae)]('+\x20'+_0xb8638e['length']+_0x4d540a(0xbf))),console[_0x4d540a(0xa1)]('\x20\x20'+a41_0x5894c6['yellow']('~\x20'+_0x4fb2f8['length']+_0x4d540a(0xa2))),console[_0x4d540a(0xa1)]('\x20\x20'+a41_0x5894c6['dim']('=\x20'+_0x224106['length']+'\x20unchanged\x20files')),console['error'](_0x4d540a(0x9b)+a41_0x5894c6[_0x4d540a(0xc1)](_0x2c8e97['targetDir'])+'\x0a');if(_0x4fb2f8[_0x4d540a(0x8d)]>0x0)for(const _0x1cbd56 of _0x4fb2f8){console[_0x4d540a(0xa1)](_0x4d540a(0xaa)+_0x1cbd56[_0x4d540a(0x94)]+'\x27:'),console['error']('─'['repeat'](0x3c)),console['error'](_0x1cbd56['diff']),console[_0x4d540a(0xa1)]('─'['repeat'](0x3c));}if(_0x49ab7f['dryRun'])return console[_0x4d540a(0xa1)](a41_0x5894c6[_0x4d540a(0xb0)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0xb8638e[_0x4d540a(0x8d)]===0x0&&_0x4fb2f8[_0x4d540a(0x8d)]===0x0)return console[_0x4d540a(0xa1)](a41_0x5894c6[_0x4d540a(0xae)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x2c8e97[_0x4d540a(0x83)]},_0x49ab7f[_0x4d540a(0x87)]),console['error'](a41_0x5894c6[_0x4d540a(0xae)](_0x4d540a(0x85)+a41_0x5894c6[_0x4d540a(0x9a)](_0x4d540a(0xb7))+'\x20=\x20'+a41_0x5894c6[_0x4d540a(0xc1)](_0x2c8e97['parentName']))),0x0;if(!_0x49ab7f[_0x4d540a(0xb9)]){if(!isInteractive())return console['error'](a41_0x5894c6[_0x4d540a(0x8e)](_0x4d540a(0xa3)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x4d540a(0xa1)](a41_0x5894c6[_0x4d540a(0x9a)](_0x4d540a(0x95))),0x1;const _0x474ddc=await confirmKey('Write\x20'+(_0xb8638e[_0x4d540a(0x8d)]+_0x4fb2f8[_0x4d540a(0x8d)])+'\x20files?');if(!_0x474ddc)return console[_0x4d540a(0xa1)](a41_0x5894c6[_0x4d540a(0xb0)](_0x4d540a(0xbe)),_0x4d540a(0x91)),0x1;}for(const _0x582b73 of _0x2c8e97[_0x4d540a(0x8f)]){if(_0x582b73['isNew']||_0x582b73[_0x4d540a(0xbd)]){const _0x8d351c=a41_0x55dce[_0x4d540a(0x99)](_0x582b73[_0x4d540a(0x98)]);!existsSync(_0x8d351c)&&mkdirSync(_0x8d351c,{'recursive':!![]}),writeFileSync(_0x582b73['absolutePath'],_0x582b73[_0x4d540a(0x90)],'utf-8');}}return console[_0x4d540a(0xa1)](a41_0x5894c6[_0x4d540a(0xae)](_0x4d540a(0xb6)+(_0xb8638e['length']+_0x4fb2f8[_0x4d540a(0x8d)])+'\x20files\x20to\x20'+_0x2c8e97[_0x4d540a(0xc4)])),saveSessionContext({'parent_segment':_0x2c8e97['parentName']},_0x49ab7f[_0x4d540a(0x87)]),console['error'](a41_0x5894c6[_0x4d540a(0xae)](_0x4d540a(0x85)+a41_0x5894c6['dim'](_0x4d540a(0xb7))+'\x20=\x20'+a41_0x5894c6[_0x4d540a(0xc1)](_0x2c8e97['parentName']))),0x0;}}
1
+ const a41_0x18c960=a41_0x443f;(function(_0x423fcc,_0x535aaa){const _0x5eefd7=a41_0x443f,_0x4b9fdc=_0x423fcc();while(!![]){try{const _0x4a1249=parseInt(_0x5eefd7(0xfb))/0x1*(-parseInt(_0x5eefd7(0xed))/0x2)+-parseInt(_0x5eefd7(0x105))/0x3+-parseInt(_0x5eefd7(0xf9))/0x4+parseInt(_0x5eefd7(0xec))/0x5+-parseInt(_0x5eefd7(0x11a))/0x6*(parseInt(_0x5eefd7(0xe2))/0x7)+parseInt(_0x5eefd7(0x12c))/0x8*(parseInt(_0x5eefd7(0x128))/0x9)+parseInt(_0x5eefd7(0xfa))/0xa;if(_0x4a1249===_0x535aaa)break;else _0x4b9fdc['push'](_0x4b9fdc['shift']());}catch(_0x33a679){_0x4b9fdc['push'](_0x4b9fdc['shift']());}}}(a41_0x2de6,0x37c6e));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 a41_0x1606e5 from'chalk';function a41_0x2de6(){const _0x3c26ca=['content','session','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','9srpReg','\x27...','Site:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','925992GMfsEG','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','files','parent_segment','parentName','segment','repeat','green','7YCcLsf','absolutePath','\x20journeys','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','resourceName','activations','\x20activations','dim','cwd','errorCode','1772400CXLQQI','9436ouuYZU','\x20=\x20','\x0aError:','red','file','\x20versions)','\x20\x20🎯\x20','\x20with\x20','\x0aPull\x20summary\x20for\x20\x27','diff','relativePath','isNew','405324LnviJF','3531890iFjHoI','49Pvccoj','-\x20no\x20files\x20written','filter','cyan','journeys','yellow','targetDir','description','\x0aChanges\x20to\x20\x27','\x20files\x20to\x20','12561eJWmgz','execute','parentSegment','length','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)','\x20files?','type','name','setPhase','helpText','segments','\x20unchanged\x20files','pullSegments','\x20\x20🗺️\x20\x20','Pulling\x20segments\x20from\x20\x27','\x20new\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','Aborted.','dryRun','error','\x20segments','1549536aRpgpG','\x20\x20Target:\x20','utf-8','hasChanges','verbose','Parent\x20segment:\x20','journeyVersions','segment:pull','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','data','counts'];a41_0x2de6=function(){return _0x3c26ca;};return a41_0x2de6();}import{existsSync,mkdirSync,writeFileSync}from'fs';import a41_0x352fae from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';function a41_0x443f(_0x1af13d,_0x42dd30){_0x1af13d=_0x1af13d-0xe0;const _0x2de6c8=a41_0x2de6();let _0x443f66=_0x2de6c8[_0x1af13d];return _0x443f66;}export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{[a41_0x18c960(0x10c)]=a41_0x18c960(0x121);[a41_0x18c960(0x102)]='Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files';async[a41_0x18c960(0x106)](_0x148478){const _0x37adb5=a41_0x18c960,{options:_0x495bbe,args:_0x47371a,tdx:_0x4b1926}=_0x148478,_0x369f30=_0x495bbe,_0x4073b4=await resolveTarget({'arg':_0x47371a[0x0],'contextParent':_0x495bbe[_0x37adb5(0x107)],'cwd':process[_0x37adb5(0xea)]()});if(!isSuccessfulResolution(_0x4073b4))return _0x4073b4[_0x37adb5(0xeb)]==='no_parent'?(console[_0x37adb5(0x118)](a41_0x1606e5['yellow'](_0x37adb5(0x122))),console[_0x37adb5(0x118)](_0x37adb5(0x109)),console[_0x37adb5(0x118)](_0x37adb5(0x12b)),console['error'](_0x37adb5(0x115))):(console[_0x37adb5(0x118)](a41_0x1606e5[_0x37adb5(0xf0)]('Error:\x20'+_0x4073b4['message']+'\x0a')),_0x4073b4[_0x37adb5(0x10e)]&&console[_0x37adb5(0x118)](a41_0x1606e5[_0x37adb5(0xfe)](_0x4073b4[_0x37adb5(0x10e)]))),0x1;const _0x1a8581=_0x4073b4[_0x37adb5(0x130)],_0xa7af0b=_0x4073b4[_0x37adb5(0x101)],_0x298b73=_0x4073b4[_0x37adb5(0x10b)]===_0x37adb5(0xf1)?_0x4073b4[_0x37adb5(0xe6)]:undefined;_0x369f30[_0x37adb5(0x11e)]&&(console[_0x37adb5(0x118)](_0x37adb5(0x12a)+_0x369f30['site']),console[_0x37adb5(0x118)](_0x37adb5(0x11f)+_0x1a8581),_0x298b73&&console[_0x37adb5(0x118)]('Target\x20resource:\x20'+_0x298b73));const _0x70f312=await withProgressSpinner(_0x37adb5(0x113)+_0x1a8581+_0x37adb5(0x129),_0x70af30=>_0x4b1926[_0x37adb5(0x131)][_0x37adb5(0x111)](_0x1a8581,{'targetDir':_0xa7af0b,'targetResourceName':_0x298b73,'verbose':_0x369f30[_0x37adb5(0x11e)],'progress':{'update':_0xfcf42d=>{const _0x4cfb23=_0x37adb5;_0x70af30[_0x4cfb23(0x10d)](_0xfcf42d),_0x369f30[_0x4cfb23(0x11e)]&&console['error']('\x20\x20'+_0xfcf42d);}}}),{'verbose':_0x369f30['verbose']}),_0x18b66f=_0x70f312[_0x37adb5(0x123)];if(_0x18b66f[_0x37adb5(0x124)][_0x37adb5(0x10f)]===0x0&&_0x18b66f['counts']['journeys']===0x0)return console[_0x37adb5(0x118)](a41_0x1606e5[_0x37adb5(0x100)](_0x37adb5(0x127)+_0x18b66f[_0x37adb5(0x130)]+'\x27')),0x0;const _0x59d4d4=_0x18b66f[_0x37adb5(0x12e)][_0x37adb5(0xfd)](_0x1fb66e=>_0x1fb66e[_0x37adb5(0xf8)]),_0x19b811=_0x18b66f['files']['filter'](_0x86b94c=>!_0x86b94c['isNew']&&_0x86b94c[_0x37adb5(0x11d)]),_0x1ea093=_0x18b66f['files'][_0x37adb5(0xfd)](_0x2aaaa6=>!_0x2aaaa6[_0x37adb5(0xf8)]&&!_0x2aaaa6[_0x37adb5(0x11d)]);console[_0x37adb5(0x118)](_0x37adb5(0xf5)+_0x18b66f[_0x37adb5(0x130)]+'\x27:'),console[_0x37adb5(0x118)](_0x37adb5(0xf3)+a41_0x1606e5[_0x37adb5(0xfe)](_0x18b66f[_0x37adb5(0x124)][_0x37adb5(0x10f)]+_0x37adb5(0x119))+_0x37adb5(0xf4)+a41_0x1606e5[_0x37adb5(0xfe)](_0x18b66f[_0x37adb5(0x124)][_0x37adb5(0xe7)]+_0x37adb5(0xe8)));if(_0x18b66f[_0x37adb5(0x124)][_0x37adb5(0xff)]>0x0){const _0x14912b=_0x18b66f[_0x37adb5(0x124)]['journeyVersions']>_0x18b66f['counts'][_0x37adb5(0xff)]?'\x20('+_0x18b66f['counts'][_0x37adb5(0x120)]+_0x37adb5(0xf2):'';console[_0x37adb5(0x118)](_0x37adb5(0x112)+a41_0x1606e5[_0x37adb5(0xfe)](_0x18b66f[_0x37adb5(0x124)][_0x37adb5(0xff)]+_0x37adb5(0xe4))+a41_0x1606e5[_0x37adb5(0xe9)](_0x14912b));}console[_0x37adb5(0x118)]('\x20\x20'+a41_0x1606e5[_0x37adb5(0xe1)]('+\x20'+_0x59d4d4[_0x37adb5(0x108)]+_0x37adb5(0x114))),console['error']('\x20\x20'+a41_0x1606e5[_0x37adb5(0x100)]('~\x20'+_0x19b811[_0x37adb5(0x108)]+'\x20changed\x20files')),console['error']('\x20\x20'+a41_0x1606e5[_0x37adb5(0xe9)]('=\x20'+_0x1ea093['length']+_0x37adb5(0x110))),console[_0x37adb5(0x118)](_0x37adb5(0x11b)+a41_0x1606e5['cyan'](_0x18b66f['targetDir'])+'\x0a');if(_0x19b811[_0x37adb5(0x108)]>0x0)for(const _0x414626 of _0x19b811){console[_0x37adb5(0x118)](_0x37adb5(0x103)+_0x414626[_0x37adb5(0xf7)]+'\x27:'),console[_0x37adb5(0x118)]('─'[_0x37adb5(0xe0)](0x3c)),console[_0x37adb5(0x118)](_0x414626[_0x37adb5(0xf6)]),console[_0x37adb5(0x118)]('─'[_0x37adb5(0xe0)](0x3c));}if(_0x369f30[_0x37adb5(0x117)])return console[_0x37adb5(0x118)](a41_0x1606e5[_0x37adb5(0x100)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x59d4d4[_0x37adb5(0x108)]===0x0&&_0x19b811['length']===0x0)return console[_0x37adb5(0x118)](a41_0x1606e5['green']('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x18b66f['parentName']},_0x369f30[_0x37adb5(0x126)]),console['error'](a41_0x1606e5[_0x37adb5(0xe1)]('✔\x20Context\x20set:\x20'+a41_0x1606e5[_0x37adb5(0xe9)](_0x37adb5(0x12f))+_0x37adb5(0xee)+a41_0x1606e5[_0x37adb5(0xfe)](_0x18b66f['parentName']))),0x0;if(!_0x369f30['yes']){if(!isInteractive())return console['error'](a41_0x1606e5[_0x37adb5(0xf0)](_0x37adb5(0xef)),_0x37adb5(0x12d)),console[_0x37adb5(0x118)](a41_0x1606e5['dim'](_0x37adb5(0xe5))),0x1;const _0x544d2b=await confirmKey('Write\x20'+(_0x59d4d4[_0x37adb5(0x108)]+_0x19b811[_0x37adb5(0x108)])+_0x37adb5(0x10a));if(!_0x544d2b)return console[_0x37adb5(0x118)](a41_0x1606e5[_0x37adb5(0x100)](_0x37adb5(0x116)),_0x37adb5(0xfc)),0x1;}for(const _0x11894c of _0x18b66f['files']){if(_0x11894c['isNew']||_0x11894c[_0x37adb5(0x11d)]){const _0x2d8240=a41_0x352fae['dirname'](_0x11894c[_0x37adb5(0xe3)]);!existsSync(_0x2d8240)&&mkdirSync(_0x2d8240,{'recursive':!![]}),writeFileSync(_0x11894c[_0x37adb5(0xe3)],_0x11894c[_0x37adb5(0x125)],_0x37adb5(0x11c));}}return console[_0x37adb5(0x118)](a41_0x1606e5[_0x37adb5(0xe1)]('✔\x20Pulled\x20'+(_0x59d4d4[_0x37adb5(0x108)]+_0x19b811[_0x37adb5(0x108)])+_0x37adb5(0x104)+_0x18b66f[_0x37adb5(0x101)])),saveSessionContext({'parent_segment':_0x18b66f['parentName']},_0x369f30['session']),console['error'](a41_0x1606e5[_0x37adb5(0xe1)]('✔\x20Context\x20set:\x20'+a41_0x1606e5[_0x37adb5(0xe9)](_0x37adb5(0x12f))+_0x37adb5(0xee)+a41_0x1606e5[_0x37adb5(0xfe)](_0x18b66f[_0x37adb5(0x130)]))),0x0;}}
@@ -1 +1 @@
1
- const a42_0x5e85f8=a42_0x103e;(function(_0x2d578c,_0x485dad){const _0x579843=a42_0x103e,_0x3ad5ef=_0x2d578c();while(!![]){try{const _0x22b3c2=parseInt(_0x579843(0x16c))/0x1+parseInt(_0x579843(0x162))/0x2+parseInt(_0x579843(0x1b3))/0x3*(parseInt(_0x579843(0x147))/0x4)+parseInt(_0x579843(0x146))/0x5*(-parseInt(_0x579843(0x13c))/0x6)+-parseInt(_0x579843(0x131))/0x7*(parseInt(_0x579843(0x185))/0x8)+-parseInt(_0x579843(0x19c))/0x9*(-parseInt(_0x579843(0x12b))/0xa)+-parseInt(_0x579843(0x17b))/0xb;if(_0x22b3c2===_0x485dad)break;else _0x3ad5ef['push'](_0x3ad5ef['shift']());}catch(_0xe0e2bf){_0x3ad5ef['push'](_0x3ad5ef['shift']());}}}(a42_0x3291,0x45d42));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 a42_0x98978d from'chalk';function a42_0x3291(){const _0x29c70d=['\x20new','10nHStdu','new','cyan','file','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','toDelete','28JIrnoc','Push\x20YAML\x20files\x20to\x20Treasure\x20AI\x20as\x20child\x20segments','diff','isNew','existingJourney','/e/','parentFolder','results','created','message','buildUserMaps','504042BKwnMm','\x20to\x20delete','Changes\x20to:','getOutputSchemaWithCache','user','connection','red','📁\x20','listJourneysWithDetailsFromParentSegment','dryRun','5STtPvG','92MQZdSf','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','segmentFolderId','toUpdate','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','yamlConfig','cwd','\x20created','\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20','yellow','Folders\x20to\x20create:','getParent','blue','Preparing\x20journeys...','Parent\x20segment:\x20','New\x20segment:','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','green','Fetching\x20existing\x20activations...','\x20activations]','segment','paused','activations','\x0aValidation\x20failed:','get','map','826952ARtQew','\x0a✔\x20Push\x20complete','resolveParentId','audienceId','listActivations','add','journey','push','\x0aPush\x20summary\x20for\x20\x27','\x20\x20Activations:','34859vSRTIF','.yaml','isScoped','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)','listFolders','attributes','endsWith','parentName','\x20\x20\x20\x20','setPhase','errorCode','\x20\x20Journeys:\x20','\x20updated','verbose','changed','9361528UTLTdB','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','\x20unchanged','\x20\x20Activations:\x20','state','Source\x20directory:\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','relationships','dim','all','469512kiCNvc','createdSegmentIds','Fetching\x20existing\x20data...','length','/sb/da/esr','description','error','name','targetDir','\x27...','Error:\x20Directory\x20not\x20found:\x20','\x0aError:','repeat','toString','createdAt','helpText','nameToId','\x20deleted','journeysOnly','filter','then','getJourney','/app/ps/','4938003EuVEuk','idToName','versionNumber','Fetching\x20connections\x20for\x20name\x20resolution...','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','Delete\x20segment:','\x20\x20📊\x20Segments:','New\x20journey:','nameToType','journeyBundleName','join','data','set','delete','\x20\x20Segments:\x20','updatedAt','Changes\x20to\x20journey:','unchanged','segment:push','deleted','toCreate','journeyId','updated','59847EfQkDb','\x20\x20🗺️\x20\x20Journeys:','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','(Journey\x20will\x20be\x20deleted)','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','journeys','segments','listSegments','list','segment\x20or\x20journey','folderPath','existingSegment','site','parent_name','\x20to\x20update'];a42_0x3291=function(){return _0x29c70d;};return a42_0x3291();}import{existsSync}from'fs';function a42_0x103e(_0x4e2a1a,_0x47df87){_0x4e2a1a=_0x4e2a1a-0x127;const _0x329150=a42_0x3291();let _0x103efa=_0x329150[_0x4e2a1a];return _0x103efa;}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{[a42_0x5e85f8(0x18c)]=a42_0x5e85f8(0x1ae);[a42_0x5e85f8(0x18a)]=a42_0x5e85f8(0x132);async['execute'](_0x4deade){const _0x268cbc=a42_0x5e85f8,{options:_0x24ff83,args:_0x571ee9,tdx:_0x313f02}=_0x4deade,_0x3d4fd5=_0x24ff83,_0x586a12=await resolveTarget({'arg':_0x571ee9[0x0],'contextParent':_0x24ff83['parentSegment'],'cwd':process[_0x268cbc(0x14e)]()});if(!isSuccessfulResolution(_0x586a12))return _0x586a12[_0x268cbc(0x176)]==='no_parent'?(console[_0x268cbc(0x18b)](a42_0x98978d['yellow'](_0x268cbc(0x181))),console['error'](_0x268cbc(0x16f)),console['error'](_0x268cbc(0x158)),console[_0x268cbc(0x18b)](_0x268cbc(0x14b))):(console[_0x268cbc(0x18b)](a42_0x98978d[_0x268cbc(0x142)]('Error:\x20'+_0x586a12[_0x268cbc(0x13a)]+'\x0a')),_0x586a12[_0x268cbc(0x194)]&&console[_0x268cbc(0x18b)](a42_0x98978d[_0x268cbc(0x12d)](_0x586a12[_0x268cbc(0x194)]))),0x1;if(_0x586a12['type']===_0x268cbc(0x128))return console[_0x268cbc(0x18b)](a42_0x98978d[_0x268cbc(0x142)](_0x268cbc(0x18f)+_0x586a12[_0x268cbc(0x18d)]+'\x0a')),console['error'](a42_0x98978d['cyan'](_0x268cbc(0x1b8))),0x1;const _0x226f47=_0x586a12[_0x268cbc(0x173)],_0x5ec452=_0x586a12[_0x268cbc(0x18d)],_0x58c4a5=_0x586a12['type']===_0x268cbc(0x12e)?_0x586a12['filePath']:undefined,_0xfcf9fe=getScopedDetails(_0x586a12),_0x37de41=_0xfcf9fe?.[_0x268cbc(0x16e)]??![],_0x4cee26=_0xfcf9fe?.['scopedFolderPath']??'';if(!existsSync(_0x5ec452))return console[_0x268cbc(0x18b)](a42_0x98978d['red'](_0x268cbc(0x18f)+_0x5ec452+'\x0a')),console[_0x268cbc(0x18b)](a42_0x98978d['cyan'](_0x268cbc(0x1b8))),0x1;_0x3d4fd5[_0x268cbc(0x179)]&&(console[_0x268cbc(0x18b)]('Site:\x20'+_0x3d4fd5[_0x268cbc(0x127)]),console[_0x268cbc(0x18b)](_0x268cbc(0x156)+_0x226f47),console['error'](_0x268cbc(0x180)+_0x5ec452),_0x37de41&&console[_0x268cbc(0x18b)]('Scoped\x20to\x20folder:\x20'+_0x4cee26));const _0x4ca17c=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x226f47+_0x268cbc(0x18e),()=>_0x313f02[_0x268cbc(0x15c)][_0x268cbc(0x164)](_0x226f47),{'verbose':_0x3d4fd5[_0x268cbc(0x179)]}),_0x2c0cd0=_0x4ca17c[_0x268cbc(0x1a7)],{parentSegmentResult:_0x504315,segmentsResult:_0xf64517,foldersResult:_0x23b6c1,journeysWithDetailsResult:_0x4c5cbb,userMaps:_0x445776}=await withSpinner(_0x268cbc(0x187),async()=>{const _0x605495=_0x268cbc,[_0x98088,_0x16dd8c,_0x166735,_0x5af19f,_0x2332fe]=await Promise['all']([_0x313f02[_0x605495(0x15c)][_0x605495(0x153)](_0x2c0cd0),_0x313f02[_0x605495(0x15c)][_0x605495(0x1bb)](_0x2c0cd0),_0x313f02[_0x605495(0x15c)][_0x605495(0x170)](_0x2c0cd0),_0x313f02['journey'][_0x605495(0x144)](_0x2c0cd0,{'includeAllVersions':!![]}),_0x313f02[_0x605495(0x140)][_0x605495(0x13b)]()]);return{'parentSegmentResult':_0x98088,'segmentsResult':_0x16dd8c,'foldersResult':_0x166735,'journeysWithDetailsResult':_0x5af19f,'userMaps':_0x2332fe};},{'verbose':_0x3d4fd5['verbose']})[_0x268cbc(0x199)](_0x42d004=>_0x42d004[_0x268cbc(0x1a7)]),_0x428175=_0x504315,_0x353564=extractRootFolderId(_0x428175),_0x170acd=_0xf64517,_0x148823=_0x23b6c1,{journeys:_0x545537,activationStepsById:_0x2c2cc6}=_0x4c5cbb,_0x3cd371=new Map(_0x545537[_0x268cbc(0x161)](_0x3e4d3e=>[_0x3e4d3e['id'],_0x3e4d3e])),_0x428e95=_0x545537[_0x268cbc(0x161)](_0x5e5654=>({'id':_0x5e5654['id'],'name':_0x5e5654[_0x268cbc(0x171)]['name'],'journeyBundleName':_0x5e5654[_0x268cbc(0x171)][_0x268cbc(0x1a5)]||'','journeyBundleId':_0x5e5654[_0x268cbc(0x171)]['journeyBundleId']||'','versionNumber':_0x5e5654[_0x268cbc(0x171)][_0x268cbc(0x19e)],'description':_0x5e5654[_0x268cbc(0x171)][_0x268cbc(0x18a)],'state':_0x5e5654[_0x268cbc(0x171)][_0x268cbc(0x17f)],'paused':_0x5e5654[_0x268cbc(0x171)][_0x268cbc(0x15d)],'audienceId':_0x5e5654[_0x268cbc(0x171)][_0x268cbc(0x165)],'folderId':_0x5e5654[_0x268cbc(0x182)]?.[_0x268cbc(0x137)]?.['data']?.['id'],'createdAt':_0x5e5654[_0x268cbc(0x171)][_0x268cbc(0x193)],'updatedAt':_0x5e5654[_0x268cbc(0x171)][_0x268cbc(0x1ab)]})),{emailToId:_0x171354,idToEmail:_0x187f1e}=_0x445776,_0x31af7b=await withSpinner(_0x268cbc(0x19f),async()=>{const _0x1a6c6c=_0x268cbc,_0x578d3f=await _0x313f02[_0x1a6c6c(0x141)][_0x1a6c6c(0x1bc)]();return buildConnectionMaps(_0x578d3f);},{'verbose':_0x3d4fd5[_0x268cbc(0x179)]})[_0x268cbc(0x199)](_0x36eab0=>_0x36eab0[_0x268cbc(0x1a7)]),_0x93b050=_0x31af7b[_0x268cbc(0x195)],_0x4f740f=_0x31af7b['idToName'],_0x4e85f0=_0x31af7b[_0x268cbc(0x1a4)],_0x1779fb={'emailToIdMap':_0x171354,'connectionNameToIdMap':_0x93b050,'connectionNameToTypeMap':_0x4e85f0,'getSchema':_0x1ea934=>_0x313f02['connection'][_0x268cbc(0x13f)](_0x1ea934)};let {pathToId:_0x37d68e,idToPath:_0x199a5c}=buildFolderMaps(_0x148823);const _0x1c8f69=buildSegmentLookupMap(_0x170acd,_0x199a5c),_0x102843=buildSegmentNameToIdMap(_0x170acd),_0x556ea7=buildJourneyBundleLookupMap(_0x428e95,_0x199a5c);let _0x4eeed1;if(_0x58c4a5){if(!_0x58c4a5[_0x268cbc(0x172)]('.yml')&&!_0x58c4a5[_0x268cbc(0x172)](_0x268cbc(0x16d)))return console[_0x268cbc(0x18b)](a42_0x98978d[_0x268cbc(0x142)](_0x268cbc(0x1a0)+_0x58c4a5+'\x0a')),0x1;_0x4eeed1=[_0x58c4a5];}else _0x4eeed1=findYamlFiles(_0x5ec452);if(_0x4eeed1[_0x268cbc(0x188)]===0x0)return console[_0x268cbc(0x18b)](a42_0x98978d[_0x268cbc(0x142)](_0x268cbc(0x17c)+_0x5ec452+'\x0a')),console[_0x268cbc(0x18b)](a42_0x98978d[_0x268cbc(0x12d)]('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files')),0x1;let _0x340158,_0x164f75;try{const _0xdab769=parseAndClassifyYamlFiles(_0x4eeed1,_0x5ec452,{'skipSegments':_0x3d4fd5[_0x268cbc(0x197)]});_0x340158=_0xdab769[_0x268cbc(0x1ba)],_0x164f75=_0xdab769[_0x268cbc(0x1b9)];const _0xb98db7=validateParsedFiles(_0xdab769,_0x5ec452);if(_0xb98db7[_0x268cbc(0x188)]>0x0)return console[_0x268cbc(0x18b)](a42_0x98978d['red'](_0x268cbc(0x15f))),console[_0x268cbc(0x18b)](formatValidationErrors(_0xb98db7)),console[_0x268cbc(0x18b)](a42_0x98978d[_0x268cbc(0x151)](_0x268cbc(0x148))),0x1;}catch(_0x2cd1f3){return console[_0x268cbc(0x18b)](a42_0x98978d[_0x268cbc(0x142)]('Error\x20parsing\x20YAML:\x20'+(_0x2cd1f3 instanceof Error?_0x2cd1f3['message']:_0x2cd1f3))),0x1;}if(_0x340158[_0x268cbc(0x188)]===0x0&&_0x164f75[_0x268cbc(0x188)]===0x0){const _0x414b82=_0x3d4fd5[_0x268cbc(0x197)]?_0x268cbc(0x168):_0x268cbc(0x1bd);return console[_0x268cbc(0x18b)](a42_0x98978d[_0x268cbc(0x151)]('No\x20'+_0x414b82+'\x20YAML\x20files\x20found')),0x0;}const _0x1930f0=new Map();_0x170acd[_0x268cbc(0x188)]>0x0&&!_0x3d4fd5[_0x268cbc(0x197)]&&await withSpinner(_0x268cbc(0x15a),async()=>{await batchAsync(_0x170acd,async _0x10dcf1=>{const _0x1287d9=a42_0x103e,_0x3a778d=await _0x313f02[_0x1287d9(0x15c)][_0x1287d9(0x166)](_0x2c0cd0,_0x10dcf1['id']);_0x1930f0[_0x1287d9(0x1a8)](_0x10dcf1['id'],_0x3a778d);});},{'verbose':_0x3d4fd5[_0x268cbc(0x179)]});const {segmentFiles:_0x5877e3,foldersToCreate:_0x4865ee}=await prepareSegmentFiles(_0x340158,{'segmentByFolderAndName':_0x1c8f69,'activationsBySegmentId':_0x1930f0,'folderPathToId':_0x37d68e,'idToEmailMap':_0x187f1e,'connectionIdToNameMap':_0x4f740f},_0x1779fb,_0x37de41,_0x4cee26),_0x3a1acd=_0x58c4a5?[]:findSegmentsToDelete(_0x170acd,_0x340158['map'](({yamlConfig:_0x3bbe37,folderPath:_0x33373f})=>({'yamlConfig':_0x3bbe37,'folderPath':resolveTDFolderPath(_0x33373f,_0x37de41,_0x4cee26)})),_0x199a5c,_0x4cee26,_0x37de41),{journeyFiles:_0x5d1001,foldersToCreate:_0x4f977c}=await withProgressSpinner(_0x268cbc(0x155),async _0x26ea7a=>prepareJourneyFiles(_0x164f75,{'fetchJourney':async _0xaa97a2=>_0x313f02[_0x268cbc(0x168)][_0x268cbc(0x19a)](_0xaa97a2[_0x268cbc(0x1b1)]),'journeyBundlesByFolderAndName':_0x556ea7,'folderPathToId':_0x37d68e,'idToEmailMap':_0x187f1e,'connectionIdToNameMap':_0x4f740f,'existingSegments':_0x170acd,'parentId':_0x2c0cd0,'deps':_0x313f02,'progress':{'update':_0x2a295d=>{const _0xe1e634=_0x268cbc;_0x26ea7a[_0xe1e634(0x175)](_0x2a295d),_0x3d4fd5[_0xe1e634(0x179)]&&console[_0xe1e634(0x18b)]('\x20\x20'+_0x2a295d);}},'journeyById':_0x3cd371,'activationStepsById':_0x2c2cc6},_0x37de41,_0x4cee26),{'verbose':_0x3d4fd5[_0x268cbc(0x179)]})[_0x268cbc(0x199)](_0x43a38c=>_0x43a38c[_0x268cbc(0x1a7)]);for(const _0x482eb0 of _0x4f977c){_0x4865ee[_0x268cbc(0x167)](_0x482eb0);}const _0xd8acb9=_0x58c4a5?[]:findJourneysToDelete(_0x428e95,_0x164f75[_0x268cbc(0x161)](({yamlConfig:_0x2e79c2,folderPath:_0x5095dd})=>({'yamlConfig':_0x2e79c2,'folderPath':resolveTDFolderPath(_0x5095dd,_0x37de41,_0x4cee26)})),_0x199a5c,_0x4cee26,_0x37de41),_0x4d4a10=calculatePushStats(_0x5877e3,_0x5d1001,_0x4865ee,_0x3a1acd,_0xd8acb9,!!_0x3d4fd5[_0x268cbc(0x1a9)],!!_0x3d4fd5['journeysOnly']),_0x533e05=_0x4d4a10[_0x268cbc(0x1ba)][_0x268cbc(0x12c)],_0x3c21a1=_0x4d4a10[_0x268cbc(0x1ba)][_0x268cbc(0x17a)],_0x5a6235=_0x4d4a10['segments']['unchanged'],_0x10f8c8=_0x4d4a10['segments'][_0x268cbc(0x130)],_0x3e5969=_0x4d4a10['folders'][_0x268cbc(0x1b0)],_0x117f24=_0x4d4a10[_0x268cbc(0x1b9)][_0x268cbc(0x12c)],_0x358b21=_0x4d4a10[_0x268cbc(0x1b9)][_0x268cbc(0x17a)],_0x1e6e2b=_0x4d4a10[_0x268cbc(0x1b9)][_0x268cbc(0x1ad)],_0x25416b=_0x4d4a10['journeys'][_0x268cbc(0x130)],_0x493787=_0x4d4a10['activations'][_0x268cbc(0x184)],_0xf5244f=_0x4d4a10[_0x268cbc(0x15e)][_0x268cbc(0x1b0)],_0x5c4119=_0x4d4a10[_0x268cbc(0x15e)][_0x268cbc(0x14a)],_0x368920=_0x4d4a10[_0x268cbc(0x15e)]['toDelete'];console[_0x268cbc(0x18b)](_0x268cbc(0x16a)+_0x226f47+'\x27:');_0x3e5969['length']>0x0&&console[_0x268cbc(0x18b)]('\x20\x20'+a42_0x98978d[_0x268cbc(0x154)](_0x268cbc(0x143)+_0x3e5969[_0x268cbc(0x188)]+'\x20folders\x20to\x20create'));if(!_0x3d4fd5[_0x268cbc(0x197)]){console[_0x268cbc(0x18b)](_0x268cbc(0x1a2)),console[_0x268cbc(0x18b)](_0x268cbc(0x174)+a42_0x98978d[_0x268cbc(0x159)]('+\x20'+_0x533e05[_0x268cbc(0x188)]+_0x268cbc(0x12a))),console['error']('\x20\x20\x20\x20'+a42_0x98978d[_0x268cbc(0x151)]('~\x20'+_0x3c21a1[_0x268cbc(0x188)]+'\x20changed'));if(_0x10f8c8[_0x268cbc(0x188)]>0x0)console[_0x268cbc(0x18b)](_0x268cbc(0x174)+a42_0x98978d['red']('-\x20'+_0x10f8c8['length']+_0x268cbc(0x13d)));else _0x3a1acd[_0x268cbc(0x188)]>0x0&&!_0x3d4fd5[_0x268cbc(0x1a9)]&&console[_0x268cbc(0x18b)]('\x20\x20\x20\x20'+a42_0x98978d[_0x268cbc(0x183)](_0x3a1acd[_0x268cbc(0x188)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x268cbc(0x18b)](_0x268cbc(0x174)+a42_0x98978d[_0x268cbc(0x183)]('=\x20'+_0x5a6235[_0x268cbc(0x188)]+_0x268cbc(0x17d)));}if(_0x5d1001[_0x268cbc(0x188)]>0x0||_0xd8acb9['length']>0x0){console[_0x268cbc(0x18b)](_0x268cbc(0x1b4)),console[_0x268cbc(0x18b)]('\x20\x20\x20\x20'+a42_0x98978d[_0x268cbc(0x159)]('+\x20'+_0x117f24[_0x268cbc(0x188)]+_0x268cbc(0x12a))),console[_0x268cbc(0x18b)](_0x268cbc(0x174)+a42_0x98978d[_0x268cbc(0x151)]('~\x20'+_0x358b21[_0x268cbc(0x188)]+'\x20changed'));if(_0x25416b['length']>0x0)console[_0x268cbc(0x18b)](_0x268cbc(0x174)+a42_0x98978d[_0x268cbc(0x142)]('-\x20'+_0x25416b[_0x268cbc(0x188)]+'\x20to\x20delete'));else _0xd8acb9[_0x268cbc(0x188)]>0x0&&!_0x3d4fd5[_0x268cbc(0x1a9)]&&console[_0x268cbc(0x18b)](_0x268cbc(0x174)+a42_0x98978d['dim'](_0xd8acb9[_0x268cbc(0x188)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x268cbc(0x18b)](_0x268cbc(0x174)+a42_0x98978d[_0x268cbc(0x183)]('=\x20'+_0x1e6e2b[_0x268cbc(0x188)]+_0x268cbc(0x17d)));}_0x493787[_0x268cbc(0x188)]>0x0&&!_0x3d4fd5[_0x268cbc(0x197)]&&(console['error'](''),console[_0x268cbc(0x18b)](_0x268cbc(0x16b)),_0xf5244f[_0x268cbc(0x188)]>0x0&&console[_0x268cbc(0x18b)](_0x268cbc(0x174)+a42_0x98978d[_0x268cbc(0x159)]('+\x20'+_0xf5244f[_0x268cbc(0x188)]+'\x20to\x20create')),_0x5c4119['length']>0x0&&console[_0x268cbc(0x18b)](_0x268cbc(0x174)+a42_0x98978d[_0x268cbc(0x151)]('~\x20'+_0x5c4119['length']+_0x268cbc(0x129))),_0x368920[_0x268cbc(0x188)]>0x0&&console[_0x268cbc(0x18b)](_0x268cbc(0x174)+a42_0x98978d[_0x268cbc(0x142)]('-\x20'+_0x368920[_0x268cbc(0x188)]+'\x20to\x20delete')));console[_0x268cbc(0x18b)]('\x20\x20Source:\x20'+a42_0x98978d['cyan'](_0x5ec452)+'\x0a');if(_0x3e5969[_0x268cbc(0x188)]>0x0){console['error'](_0x268cbc(0x152));for(const _0x12d0d0 of _0x3e5969){console['error']('\x20\x20'+a42_0x98978d[_0x268cbc(0x154)]('+')+'\x20'+_0x12d0d0);}console[_0x268cbc(0x18b)]('');}if(_0x533e05['length']>0x0&&!_0x3d4fd5[_0x268cbc(0x197)])for(const _0x5ee132 of _0x533e05){const _0x316bdf=_0x5ee132[_0x268cbc(0x1be)]?_0x5ee132[_0x268cbc(0x1be)]+'/'+_0x5ee132[_0x268cbc(0x14d)][_0x268cbc(0x18c)]:_0x5ee132[_0x268cbc(0x14d)][_0x268cbc(0x18c)],_0x7ca4d1=_0x5ee132[_0x268cbc(0x14d)]['activations']?.[_0x268cbc(0x188)]||0x0,_0x1542d1=_0x7ca4d1>0x0?a42_0x98978d[_0x268cbc(0x183)]('\x20['+_0x7ca4d1+_0x268cbc(0x15b)):'';console[_0x268cbc(0x18b)]('\x0a'+a42_0x98978d[_0x268cbc(0x159)](_0x268cbc(0x157))+'\x20'+_0x316bdf+_0x1542d1),console['error']('─'['repeat'](0x3c)),_0x5ee132[_0x268cbc(0x133)]&&console[_0x268cbc(0x18b)](_0x5ee132[_0x268cbc(0x133)]),console[_0x268cbc(0x18b)]('─'['repeat'](0x3c));}if(_0x10f8c8[_0x268cbc(0x188)]>0x0&&!_0x3d4fd5[_0x268cbc(0x197)])for(const _0x3d317a of _0x10f8c8){const _0x37eb00=_0x3d317a['segmentFolderId']?_0x199a5c[_0x268cbc(0x160)](_0x3d317a[_0x268cbc(0x149)][_0x268cbc(0x192)]())||'':'',_0x4d9f29=_0x37eb00?_0x37eb00+'/'+_0x3d317a[_0x268cbc(0x18c)]:_0x3d317a[_0x268cbc(0x18c)],_0x5ece97=_0x1930f0[_0x268cbc(0x160)](_0x3d317a['id'])||[],_0x36e760=_0x5ece97[_0x268cbc(0x188)]>0x0?a42_0x98978d['dim']('\x20['+_0x5ece97['length']+_0x268cbc(0x15b)):'';console[_0x268cbc(0x18b)]('\x0a'+a42_0x98978d[_0x268cbc(0x142)](_0x268cbc(0x1a1))+'\x20'+_0x4d9f29+_0x36e760),console[_0x268cbc(0x18b)]('─'['repeat'](0x3c));const _0x1d3948=segmentWithActivationsToYaml(_0x3d317a,_0x5ece97,undefined,_0x187f1e,_0x4f740f),_0x53cb6c=segmentToYamlString(_0x1d3948),_0x1a6274=generateDiff(_0x53cb6c,'');console['error'](formatDiffWithColors(_0x1a6274)),console[_0x268cbc(0x18b)]('─'[_0x268cbc(0x191)](0x3c));}const _0x270d27=_0x5877e3[_0x268cbc(0x198)](_0x3c69fd=>!_0x3c69fd[_0x268cbc(0x134)]&&_0x3c69fd[_0x268cbc(0x133)]);if(_0x270d27[_0x268cbc(0x188)]>0x0&&!_0x3d4fd5[_0x268cbc(0x197)])for(const _0x26942f of _0x270d27){const _0x4d7813=_0x26942f[_0x268cbc(0x1be)]?_0x26942f[_0x268cbc(0x1be)]+'/'+_0x26942f['yamlConfig'][_0x268cbc(0x18c)]:_0x26942f[_0x268cbc(0x14d)]['name'];console['error']('\x0a'+a42_0x98978d[_0x268cbc(0x151)](_0x268cbc(0x13e))+'\x20'+_0x4d7813),console[_0x268cbc(0x18b)]('─'[_0x268cbc(0x191)](0x3c)),console['error'](_0x26942f[_0x268cbc(0x133)]),console[_0x268cbc(0x18b)]('─'[_0x268cbc(0x191)](0x3c));}if(_0x117f24['length']>0x0)for(const _0xdcb31a of _0x117f24){const _0x1d071d=_0xdcb31a[_0x268cbc(0x1be)]?_0xdcb31a[_0x268cbc(0x1be)]+'/'+_0xdcb31a[_0x268cbc(0x14d)][_0x268cbc(0x18c)]:_0xdcb31a['yamlConfig'][_0x268cbc(0x18c)];console[_0x268cbc(0x18b)]('\x0a'+a42_0x98978d['green'](_0x268cbc(0x1a3))+'\x20'+_0x1d071d),console['error']('─'[_0x268cbc(0x191)](0x3c)),_0xdcb31a['diff']&&console['error'](_0xdcb31a['diff']),console[_0x268cbc(0x18b)]('─'['repeat'](0x3c));}const _0x3b0567=_0x5d1001[_0x268cbc(0x198)](_0xe24d35=>!_0xe24d35[_0x268cbc(0x134)]&&_0xe24d35[_0x268cbc(0x133)]);if(_0x3b0567[_0x268cbc(0x188)]>0x0)for(const _0x3f95a8 of _0x3b0567){const _0x157db6=_0x3f95a8[_0x268cbc(0x1be)]?_0x3f95a8[_0x268cbc(0x1be)]+'/'+_0x3f95a8[_0x268cbc(0x14d)][_0x268cbc(0x18c)]:_0x3f95a8[_0x268cbc(0x14d)]['name'];console['error']('\x0a'+a42_0x98978d[_0x268cbc(0x151)](_0x268cbc(0x1ac))+'\x20'+_0x157db6),console[_0x268cbc(0x18b)]('─'[_0x268cbc(0x191)](0x3c)),console['error'](_0x3f95a8[_0x268cbc(0x133)]),console[_0x268cbc(0x18b)]('─'[_0x268cbc(0x191)](0x3c));}if(_0x25416b[_0x268cbc(0x188)]>0x0)for(const _0x234fbd of _0x25416b){const _0x20a913=_0x234fbd['folderId']?_0x199a5c[_0x268cbc(0x160)](_0x234fbd['folderId'])||'':'',_0x65265b=_0x20a913?_0x20a913+'/'+_0x234fbd[_0x268cbc(0x1a5)]:_0x234fbd[_0x268cbc(0x1a5)];console[_0x268cbc(0x18b)]('\x0a'+a42_0x98978d[_0x268cbc(0x142)]('Delete\x20journey:')+'\x20'+_0x65265b),console[_0x268cbc(0x18b)]('─'[_0x268cbc(0x191)](0x3c)),console[_0x268cbc(0x18b)](a42_0x98978d[_0x268cbc(0x142)](_0x268cbc(0x1b7))),console[_0x268cbc(0x18b)]('─'[_0x268cbc(0x191)](0x3c));}if(_0x3d4fd5[_0x268cbc(0x145)])return console[_0x268cbc(0x18b)](a42_0x98978d[_0x268cbc(0x151)](_0x268cbc(0x14c))),0x0;const _0x3da1b5=_0x3d4fd5[_0x268cbc(0x197)]?![]:_0x533e05[_0x268cbc(0x188)]>0x0||_0x3c21a1[_0x268cbc(0x188)]>0x0||_0x10f8c8[_0x268cbc(0x188)]>0x0,_0x4cbbcd=_0x117f24['length']>0x0||_0x358b21['length']>0x0||_0x25416b[_0x268cbc(0x188)]>0x0,_0x38df97=_0x3d4fd5['journeysOnly']?![]:_0x493787[_0x268cbc(0x188)]>0x0,_0x2452b4=_0x3e5969['length']>0x0;if(!_0x3da1b5&&!_0x4cbbcd&&!_0x38df97&&!_0x2452b4){const _0x30a1c8=_0x3d4fd5[_0x268cbc(0x197)]?_0x268cbc(0x1b5):'✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date';console[_0x268cbc(0x18b)](a42_0x98978d[_0x268cbc(0x159)](_0x30a1c8));if(_0x58c4a5&&_0x5a6235[_0x268cbc(0x188)]===0x1){const _0x3a6b2e=_0x5a6235[0x0];if(_0x3a6b2e[_0x268cbc(0x1bf)]?.['id']){const _0x176ece=getConsoleNextUrl(_0x3d4fd5[_0x268cbc(0x127)],'/app/ps/'+_0x2c0cd0+_0x268cbc(0x136)+_0x3a6b2e[_0x268cbc(0x1bf)]['id']+_0x268cbc(0x189));console['error']('\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20'+a42_0x98978d[_0x268cbc(0x12d)](_0x176ece));}}if(_0x58c4a5&&_0x1e6e2b[_0x268cbc(0x188)]===0x1){const _0x3e44a9=_0x1e6e2b[0x0];if(_0x3e44a9['existingJourney']?.['id']){const _0x16c443=getConsoleNextUrl(_0x3d4fd5[_0x268cbc(0x127)],_0x268cbc(0x19b)+_0x2c0cd0+_0x268cbc(0x136)+_0x3e44a9[_0x268cbc(0x135)]['id']+'/j/da/je');console[_0x268cbc(0x18b)]('\x20\x20'+a42_0x98978d[_0x268cbc(0x12d)](_0x16c443));}}return 0x0;}const _0x5b2e20=_0x3d4fd5[_0x268cbc(0x197)]?_0x117f24[_0x268cbc(0x188)]+_0x358b21['length']+_0x25416b[_0x268cbc(0x188)]+_0x3e5969[_0x268cbc(0x188)]:_0x533e05[_0x268cbc(0x188)]+_0x3c21a1[_0x268cbc(0x188)]+_0x10f8c8[_0x268cbc(0x188)]+_0x117f24[_0x268cbc(0x188)]+_0x358b21['length']+_0x25416b[_0x268cbc(0x188)]+_0x3e5969[_0x268cbc(0x188)]+_0x493787[_0x268cbc(0x188)];if(!_0x3d4fd5['yes']&&_0x5b2e20>0x0){if(!isInteractive())return console[_0x268cbc(0x18b)](a42_0x98978d[_0x268cbc(0x142)](_0x268cbc(0x190)),_0x268cbc(0x1b6)),console['error'](a42_0x98978d[_0x268cbc(0x183)](_0x268cbc(0x12f))),0x1;const _0x3cb15d=await confirmKey('Push\x20'+_0x5b2e20+'\x20changes?');if(!_0x3cb15d)return console[_0x268cbc(0x18b)](a42_0x98978d[_0x268cbc(0x151)]('Aborted.')),0x1;}const _0x5ac25e={'withProgress':async(_0x154ab8,_0x407f07)=>{const _0x107baa=_0x268cbc,_0x221cb9=await withSpinner(_0x154ab8,_0x407f07,{'verbose':_0x3d4fd5[_0x107baa(0x179)]});return{'data':_0x221cb9[_0x107baa(0x1a7)]};},'logInfo':_0x3e283a=>console['error'](a42_0x98978d[_0x268cbc(0x154)]('✔\x20'+_0x3e283a)),'logSuccess':_0x2c4fce=>console[_0x268cbc(0x18b)](a42_0x98978d[_0x268cbc(0x159)]('✔\x20'+_0x2c4fce)),'logWarning':_0x49393a=>console[_0x268cbc(0x18b)](a42_0x98978d[_0x268cbc(0x151)]('⚠\x20'+_0x49393a)),'logDeleted':_0x33bc45=>console[_0x268cbc(0x18b)](a42_0x98978d['red']('✔\x20'+_0x33bc45))},_0x5be672={'segment':_0x313f02['segment'],'journey':_0x313f02[_0x268cbc(0x168)],'user':_0x313f02[_0x268cbc(0x140)],'connection':_0x313f02[_0x268cbc(0x141)]};_0x3e5969[_0x268cbc(0x188)]>0x0&&(_0x37d68e=await executePushFolders(_0x5be672,_0x3e5969,_0x37d68e,{'parentId':_0x2c0cd0},_0x5ac25e));const _0x37fd90={'rootFolderId':_0x353564,'folderPathToId':_0x37d68e,'folderIdToPath':_0x199a5c,'segmentNameToId':_0x102843,'activationsBySegmentId':_0x1930f0,'emailToIdMap':_0x171354,'idToEmailMap':_0x187f1e,'connectionNameToIdMap':_0x31af7b[_0x268cbc(0x195)],'connectionIdToNameMap':_0x31af7b[_0x268cbc(0x19d)],'connectionNameToTypeMap':_0x4e85f0},_0xb2300d=await executePushSegments(_0x5be672,_0x3d4fd5[_0x268cbc(0x197)]?[]:_0x5877e3,_0x37fd90,{'parentId':_0x2c0cd0},_0x5ac25e),_0x5c2259=_0xb2300d[_0x268cbc(0x139)],_0x451a52=_0xb2300d[_0x268cbc(0x1b2)],_0x47d3ca=_0xb2300d[_0x268cbc(0x15e)][_0x268cbc(0x139)],_0x29729a=_0xb2300d[_0x268cbc(0x15e)][_0x268cbc(0x1b2)],_0x24ed4c=_0xb2300d[_0x268cbc(0x15e)][_0x268cbc(0x1af)];let _0x5b2c26;if(_0x58c4a5&&_0x5877e3[_0x268cbc(0x188)]===0x1){const _0x26ee57=_0x5877e3[0x0];_0x5b2c26=_0x26ee57[_0x268cbc(0x1bf)]?.['id']??_0xb2300d[_0x268cbc(0x186)]['get'](_0x26ee57[_0x268cbc(0x14d)][_0x268cbc(0x18c)]);}const _0x1d2cb8=await executePushSegmentDeletions(_0x5be672,_0x3d4fd5[_0x268cbc(0x197)]?[]:_0x10f8c8,_0x5ac25e);let _0x3315d2=0x0,_0x5b8867=0x0,_0x37d4b9=0x0;const _0x43e1d8=new Map(_0x102843);for(const [_0xa4d422,_0x47fc46]of _0xb2300d['createdSegmentIds']){_0x43e1d8['set'](_0xa4d422,_0x47fc46);}if(_0x5d1001[_0x268cbc(0x188)]>0x0){const _0x3107d7={..._0x37fd90,'segmentNameToId':_0x43e1d8,'existingSegments':_0x170acd,'activationContext':_0x1779fb},_0x2fb00e=await executePushJourneys(_0x5be672,_0x5d1001,_0x3107d7,{'parentId':_0x2c0cd0,'rootFolderId':_0x353564,'verbose':_0x3d4fd5[_0x268cbc(0x179)]},_0x5ac25e);_0x3315d2=_0x2fb00e[_0x268cbc(0x139)],_0x5b8867=_0x2fb00e[_0x268cbc(0x1b2)];if(_0x58c4a5&&_0x2fb00e[_0x268cbc(0x138)][_0x268cbc(0x188)]===0x1){const _0x5ebb5d=_0x2fb00e[_0x268cbc(0x138)][0x0];if(_0x5ebb5d[_0x268cbc(0x1b1)]){const _0xae4d8e=getConsoleNextUrl(_0x3d4fd5[_0x268cbc(0x127)],_0x268cbc(0x19b)+_0x2c0cd0+_0x268cbc(0x136)+_0x5ebb5d[_0x268cbc(0x1b1)]+'/j/da/je');console[_0x268cbc(0x18b)]('\x20\x20'+a42_0x98978d['cyan'](_0xae4d8e));}}}for(const _0x2dad93 of _0x25416b){console['error'](a42_0x98978d[_0x268cbc(0x151)]('⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20'+_0x2dad93[_0x268cbc(0x1a5)])),_0x37d4b9++;}const _0x799218=[];if(_0x5c2259>0x0)_0x799218[_0x268cbc(0x169)](_0x5c2259+_0x268cbc(0x14f));if(_0x451a52>0x0)_0x799218[_0x268cbc(0x169)](_0x451a52+_0x268cbc(0x178));if(_0x1d2cb8>0x0)_0x799218['push'](_0x1d2cb8+'\x20deleted');const _0x3c816c=[];if(_0x3315d2>0x0)_0x3c816c[_0x268cbc(0x169)](_0x3315d2+_0x268cbc(0x14f));if(_0x5b8867>0x0)_0x3c816c[_0x268cbc(0x169)](_0x5b8867+'\x20updated');if(_0x37d4b9>0x0)_0x3c816c[_0x268cbc(0x169)](_0x37d4b9+_0x268cbc(0x196));const _0xbf8092=[];if(_0x47d3ca>0x0)_0xbf8092['push'](_0x47d3ca+_0x268cbc(0x14f));if(_0x29729a>0x0)_0xbf8092['push'](_0x29729a+'\x20updated');if(_0x24ed4c>0x0)_0xbf8092[_0x268cbc(0x169)](_0x24ed4c+_0x268cbc(0x196));console[_0x268cbc(0x18b)](a42_0x98978d[_0x268cbc(0x159)](_0x268cbc(0x163)));_0x799218['length']>0x0&&!_0x3d4fd5[_0x268cbc(0x197)]&&console[_0x268cbc(0x18b)](_0x268cbc(0x1aa)+_0x799218['join'](',\x20'));_0x3c816c[_0x268cbc(0x188)]>0x0&&console[_0x268cbc(0x18b)](_0x268cbc(0x177)+_0x3c816c[_0x268cbc(0x1a6)](',\x20'));_0xbf8092[_0x268cbc(0x188)]>0x0&&!_0x3d4fd5[_0x268cbc(0x197)]&&console['error'](_0x268cbc(0x17e)+_0xbf8092[_0x268cbc(0x1a6)](',\x20'));if(_0x5b2c26){const _0x557f6e=getConsoleNextUrl(_0x3d4fd5['site'],_0x268cbc(0x19b)+_0x2c0cd0+'/e/'+_0x5b2c26+_0x268cbc(0x189));console[_0x268cbc(0x18b)](_0x268cbc(0x150)+a42_0x98978d[_0x268cbc(0x12d)](_0x557f6e));}return 0x0;}}
1
+ function a42_0x3804(_0x4f6aff,_0x17e471){_0x4f6aff=_0x4f6aff-0x11b;const _0xce061=a42_0xce06();let _0x380473=_0xce061[_0x4f6aff];return _0x380473;}const a42_0x4b1d58=a42_0x3804;(function(_0x3ec958,_0x59eef0){const _0x3c1a62=a42_0x3804,_0x36b11d=_0x3ec958();while(!![]){try{const _0x2cc2fd=parseInt(_0x3c1a62(0x126))/0x1+parseInt(_0x3c1a62(0x167))/0x2*(parseInt(_0x3c1a62(0x198))/0x3)+parseInt(_0x3c1a62(0x159))/0x4+-parseInt(_0x3c1a62(0x16c))/0x5*(-parseInt(_0x3c1a62(0x15d))/0x6)+parseInt(_0x3c1a62(0x1a5))/0x7+parseInt(_0x3c1a62(0x195))/0x8*(-parseInt(_0x3c1a62(0x168))/0x9)+parseInt(_0x3c1a62(0x11b))/0xa*(-parseInt(_0x3c1a62(0x13a))/0xb);if(_0x2cc2fd===_0x59eef0)break;else _0x36b11d['push'](_0x36b11d['shift']());}catch(_0x35ff2a){_0x36b11d['push'](_0x36b11d['shift']());}}}(a42_0xce06,0x30026));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 a42_0x3126ae from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';function a42_0xce06(){const _0x41d57f=['/sb/da/esr','then','cyan','\x20YAML\x20files\x20found','yellow','all','resolveParentId','journeysOnly','attributes','idToName','1089132NTdxzj','createdAt','site','verbose','492szAEst','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','toDelete','green','red','segmentFolderId','Scoped\x20to\x20folder:\x20','versionNumber','folderId','relationships','98yHHxgy','2022381KYxKKK','\x20to\x20update','new','journeyId','23205zPjysg','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','getJourney','\x20changed','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Push\x20YAML\x20files\x20to\x20Treasure\x20AI\x20as\x20child\x20segments','targetDir','folders','journeys','Preparing\x20journeys...','getOutputSchemaWithCache','segment','\x20\x20Activations:\x20','\x20\x20Journeys:\x20','set','listJourneysWithDetailsFromParentSegment','state','Folders\x20to\x20create:','filter','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','yamlConfig','diff','Fetching\x20existing\x20activations...','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','Error\x20parsing\x20YAML:\x20','map','changed','\x27...','listFolders','\x20\x20Segments:\x20','.yml','segments','\x20created','toCreate','existingSegment','helpText','/app/ps/','user','Changes\x20to\x20journey:','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','\x20new','8YQFrDj','push','join','23367KoRUdH','description','\x20changes?','isNew','segment\x20or\x20journey','\x20\x20📊\x20Segments:','journey','createdSegmentIds','\x20folders\x20to\x20create','.yaml','Error:\x20','\x0aError:','updatedAt','1290296ZIZxEa','Changes\x20to:','New\x20journey:','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','Push\x20','\x20\x20🗺️\x20\x20Journeys:','getParent','nameToType','\x0aValidation\x20failed:','data','updated','filePath','Resolving\x20parent\x20segment\x20\x27','length','\x20updated','journeyBundleName','listSegments','\x0a✔\x20Push\x20complete','execute','Fetching\x20existing\x20data...','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','repeat','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x20deleted','error','connection','3884820LrCgJu','\x20to\x20create','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','listActivations','created','parentFolder','/j/da/je','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','Aborted.','New\x20segment:','\x20\x20Activations:','367967hXTzuy','toUpdate','parent_name','isScoped','\x20unchanged','scopedFolderPath','yes','activations','\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20','unchanged','setPhase','delete','\x20\x20\x20\x20','file','dim','\x20activations]','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','message','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','\x20to\x20delete','33CFGVeX','deleted','audienceId','segment:push','toString','Error:\x20Directory\x20not\x20found:\x20','/e/','existingJourney','parentName','name','add','type','blue','results','Fetching\x20connections\x20for\x20name\x20resolution...','nameToId','folderPath','\x20\x20Source:\x20','Delete\x20segment:','get','\x0aPush\x20summary\x20for\x20\x27'];a42_0xce06=function(){return _0x41d57f;};return a42_0xce06();}import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{[a42_0x4b1d58(0x143)]=a42_0x4b1d58(0x13d);['description']=a42_0x4b1d58(0x171);async[a42_0x4b1d58(0x1b7)](_0x5bbab1){const _0x533c1b=a42_0x4b1d58,{options:_0x29d31f,args:_0x4bd742,tdx:_0x26f6b9}=_0x5bbab1,_0x283a33=_0x29d31f,_0x554519=await resolveTarget({'arg':_0x4bd742[0x0],'contextParent':_0x29d31f['parentSegment'],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x554519))return _0x554519['errorCode']==='no_parent'?(console[_0x533c1b(0x1bd)](a42_0x3126ae[_0x533c1b(0x153)](_0x533c1b(0x11d))),console['error']('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['error'](_0x533c1b(0x138)),console[_0x533c1b(0x1bd)](_0x533c1b(0x122))):(console[_0x533c1b(0x1bd)](a42_0x3126ae[_0x533c1b(0x161)](_0x533c1b(0x1a2)+_0x554519[_0x533c1b(0x137)]+'\x0a')),_0x554519[_0x533c1b(0x18f)]&&console[_0x533c1b(0x1bd)](a42_0x3126ae[_0x533c1b(0x151)](_0x554519[_0x533c1b(0x18f)]))),0x1;if(_0x554519[_0x533c1b(0x145)]===_0x533c1b(0x128))return console['error'](a42_0x3126ae[_0x533c1b(0x161)](_0x533c1b(0x13f)+_0x554519[_0x533c1b(0x172)]+'\x0a')),console[_0x533c1b(0x1bd)](a42_0x3126ae['cyan'](_0x533c1b(0x17f))),0x1;const _0x187631=_0x554519[_0x533c1b(0x142)],_0xcb6eac=_0x554519[_0x533c1b(0x172)],_0x51db73=_0x554519['type']===_0x533c1b(0x133)?_0x554519[_0x533c1b(0x1b0)]:undefined,_0x71fecb=getScopedDetails(_0x554519),_0x3eaa4=_0x71fecb?.[_0x533c1b(0x129)]??![],_0x49d871=_0x71fecb?.[_0x533c1b(0x12b)]??'';if(!existsSync(_0xcb6eac))return console['error'](a42_0x3126ae[_0x533c1b(0x161)](_0x533c1b(0x13f)+_0xcb6eac+'\x0a')),console[_0x533c1b(0x1bd)](a42_0x3126ae[_0x533c1b(0x151)](_0x533c1b(0x17f))),0x1;_0x283a33[_0x533c1b(0x15c)]&&(console[_0x533c1b(0x1bd)]('Site:\x20'+_0x283a33['site']),console[_0x533c1b(0x1bd)]('Parent\x20segment:\x20'+_0x187631),console[_0x533c1b(0x1bd)]('Source\x20directory:\x20'+_0xcb6eac),_0x3eaa4&&console[_0x533c1b(0x1bd)](_0x533c1b(0x163)+_0x49d871));const _0x4c0161=await withSpinner(_0x533c1b(0x1b1)+_0x187631+_0x533c1b(0x187),()=>_0x26f6b9[_0x533c1b(0x177)][_0x533c1b(0x155)](_0x187631),{'verbose':_0x283a33[_0x533c1b(0x15c)]}),_0x5721b9=_0x4c0161[_0x533c1b(0x1ae)],{parentSegmentResult:_0x1dcad1,segmentsResult:_0x2ffb3f,foldersResult:_0x2f20eb,journeysWithDetailsResult:_0x2e3817,userMaps:_0x4049cf}=await withSpinner(_0x533c1b(0x1b8),async()=>{const _0x10e1eb=_0x533c1b,[_0x3a96d6,_0x21b85a,_0x57f829,_0x5deb62,_0x43707c]=await Promise[_0x10e1eb(0x154)]([_0x26f6b9[_0x10e1eb(0x177)][_0x10e1eb(0x1ab)](_0x5721b9),_0x26f6b9[_0x10e1eb(0x177)][_0x10e1eb(0x1b5)](_0x5721b9),_0x26f6b9[_0x10e1eb(0x177)][_0x10e1eb(0x188)](_0x5721b9),_0x26f6b9[_0x10e1eb(0x19e)][_0x10e1eb(0x17b)](_0x5721b9,{'includeAllVersions':!![]}),_0x26f6b9[_0x10e1eb(0x191)]['buildUserMaps']()]);return{'parentSegmentResult':_0x3a96d6,'segmentsResult':_0x21b85a,'foldersResult':_0x57f829,'journeysWithDetailsResult':_0x5deb62,'userMaps':_0x43707c};},{'verbose':_0x283a33[_0x533c1b(0x15c)]})[_0x533c1b(0x150)](_0x4988a1=>_0x4988a1[_0x533c1b(0x1ae)]),_0x59d28b=_0x1dcad1,_0x2c32ff=extractRootFolderId(_0x59d28b),_0x24b4f1=_0x2ffb3f,_0x830012=_0x2f20eb,{journeys:_0x414496,activationStepsById:_0x234b42}=_0x2e3817,_0x4494c2=new Map(_0x414496[_0x533c1b(0x185)](_0xd0fe14=>[_0xd0fe14['id'],_0xd0fe14])),_0x416057=_0x414496['map'](_0xac4be3=>({'id':_0xac4be3['id'],'name':_0xac4be3[_0x533c1b(0x157)][_0x533c1b(0x143)],'journeyBundleName':_0xac4be3[_0x533c1b(0x157)][_0x533c1b(0x1b4)]||'','journeyBundleId':_0xac4be3[_0x533c1b(0x157)]['journeyBundleId']||'','versionNumber':_0xac4be3[_0x533c1b(0x157)][_0x533c1b(0x164)],'description':_0xac4be3[_0x533c1b(0x157)][_0x533c1b(0x199)],'state':_0xac4be3[_0x533c1b(0x157)][_0x533c1b(0x17c)],'paused':_0xac4be3[_0x533c1b(0x157)]['paused'],'audienceId':_0xac4be3['attributes'][_0x533c1b(0x13c)],'folderId':_0xac4be3[_0x533c1b(0x166)]?.[_0x533c1b(0x120)]?.[_0x533c1b(0x1ae)]?.['id'],'createdAt':_0xac4be3[_0x533c1b(0x157)][_0x533c1b(0x15a)],'updatedAt':_0xac4be3[_0x533c1b(0x157)][_0x533c1b(0x1a4)]})),{emailToId:_0x32e3be,idToEmail:_0x1c1cb7}=_0x4049cf,_0x29b9d8=await withSpinner(_0x533c1b(0x148),async()=>{const _0x2dbaed=_0x533c1b,_0x1e68b6=await _0x26f6b9[_0x2dbaed(0x1be)]['list']();return buildConnectionMaps(_0x1e68b6);},{'verbose':_0x283a33['verbose']})['then'](_0x3e138b=>_0x3e138b[_0x533c1b(0x1ae)]),_0x2bb458=_0x29b9d8[_0x533c1b(0x149)],_0xbf89c2=_0x29b9d8[_0x533c1b(0x158)],_0x3bf2fd=_0x29b9d8[_0x533c1b(0x1ac)],_0x2e30a2={'emailToIdMap':_0x32e3be,'connectionNameToIdMap':_0x2bb458,'connectionNameToTypeMap':_0x3bf2fd,'getSchema':_0x356f49=>_0x26f6b9['connection'][_0x533c1b(0x176)](_0x356f49)};let {pathToId:_0x4d1532,idToPath:_0xc765a4}=buildFolderMaps(_0x830012);const _0x21f8bb=buildSegmentLookupMap(_0x24b4f1,_0xc765a4),_0x2164b0=buildSegmentNameToIdMap(_0x24b4f1),_0x233409=buildJourneyBundleLookupMap(_0x416057,_0xc765a4);let _0x48ecd5;if(_0x51db73){if(!_0x51db73['endsWith'](_0x533c1b(0x18a))&&!_0x51db73['endsWith'](_0x533c1b(0x1a1)))return console[_0x533c1b(0x1bd)](a42_0x3126ae[_0x533c1b(0x161)](_0x533c1b(0x183)+_0x51db73+'\x0a')),0x1;_0x48ecd5=[_0x51db73];}else _0x48ecd5=findYamlFiles(_0xcb6eac);if(_0x48ecd5[_0x533c1b(0x1b2)]===0x0)return console[_0x533c1b(0x1bd)](a42_0x3126ae[_0x533c1b(0x161)](_0x533c1b(0x1b9)+_0xcb6eac+'\x0a')),console[_0x533c1b(0x1bd)](a42_0x3126ae[_0x533c1b(0x151)]('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files')),0x1;let _0x4d242b,_0x182b31;try{const _0x35a986=parseAndClassifyYamlFiles(_0x48ecd5,_0xcb6eac,{'skipSegments':_0x283a33[_0x533c1b(0x156)]});_0x4d242b=_0x35a986[_0x533c1b(0x18b)],_0x182b31=_0x35a986[_0x533c1b(0x174)];const _0x3ba1f9=validateParsedFiles(_0x35a986,_0xcb6eac);if(_0x3ba1f9[_0x533c1b(0x1b2)]>0x0)return console[_0x533c1b(0x1bd)](a42_0x3126ae[_0x533c1b(0x161)](_0x533c1b(0x1ad))),console['error'](formatValidationErrors(_0x3ba1f9)),console[_0x533c1b(0x1bd)](a42_0x3126ae['yellow'](_0x533c1b(0x193))),0x1;}catch(_0x1646de){return console['error'](a42_0x3126ae[_0x533c1b(0x161)](_0x533c1b(0x184)+(_0x1646de instanceof Error?_0x1646de['message']:_0x1646de))),0x1;}if(_0x4d242b[_0x533c1b(0x1b2)]===0x0&&_0x182b31[_0x533c1b(0x1b2)]===0x0){const _0x41d92f=_0x283a33['journeysOnly']?_0x533c1b(0x19e):_0x533c1b(0x19c);return console[_0x533c1b(0x1bd)](a42_0x3126ae['yellow']('No\x20'+_0x41d92f+_0x533c1b(0x152))),0x0;}const _0x2f4af4=new Map();_0x24b4f1[_0x533c1b(0x1b2)]>0x0&&!_0x283a33[_0x533c1b(0x156)]&&await withSpinner(_0x533c1b(0x182),async()=>{await batchAsync(_0x24b4f1,async _0x2dcbb3=>{const _0x370b4e=a42_0x3804,_0x1352b1=await _0x26f6b9[_0x370b4e(0x177)][_0x370b4e(0x11e)](_0x5721b9,_0x2dcbb3['id']);_0x2f4af4[_0x370b4e(0x17a)](_0x2dcbb3['id'],_0x1352b1);});},{'verbose':_0x283a33[_0x533c1b(0x15c)]});const {segmentFiles:_0x10c64f,foldersToCreate:_0x381680}=await prepareSegmentFiles(_0x4d242b,{'segmentByFolderAndName':_0x21f8bb,'activationsBySegmentId':_0x2f4af4,'folderPathToId':_0x4d1532,'idToEmailMap':_0x1c1cb7,'connectionIdToNameMap':_0xbf89c2},_0x2e30a2,_0x3eaa4,_0x49d871),_0xb61b20=_0x51db73?[]:findSegmentsToDelete(_0x24b4f1,_0x4d242b[_0x533c1b(0x185)](({yamlConfig:_0x5922f0,folderPath:_0x52d415})=>({'yamlConfig':_0x5922f0,'folderPath':resolveTDFolderPath(_0x52d415,_0x3eaa4,_0x49d871)})),_0xc765a4,_0x49d871,_0x3eaa4),{journeyFiles:_0x3edf6f,foldersToCreate:_0x31d544}=await withProgressSpinner(_0x533c1b(0x175),async _0x2531f9=>prepareJourneyFiles(_0x182b31,{'fetchJourney':async _0x4e62d5=>_0x26f6b9[_0x533c1b(0x19e)][_0x533c1b(0x16e)](_0x4e62d5[_0x533c1b(0x16b)]),'journeyBundlesByFolderAndName':_0x233409,'folderPathToId':_0x4d1532,'idToEmailMap':_0x1c1cb7,'connectionIdToNameMap':_0xbf89c2,'existingSegments':_0x24b4f1,'parentId':_0x5721b9,'deps':_0x26f6b9,'progress':{'update':_0x24cfcc=>{const _0x2234fe=_0x533c1b;_0x2531f9[_0x2234fe(0x130)](_0x24cfcc),_0x283a33[_0x2234fe(0x15c)]&&console[_0x2234fe(0x1bd)]('\x20\x20'+_0x24cfcc);}},'journeyById':_0x4494c2,'activationStepsById':_0x234b42},_0x3eaa4,_0x49d871),{'verbose':_0x283a33[_0x533c1b(0x15c)]})[_0x533c1b(0x150)](_0xfc825=>_0xfc825['data']);for(const _0x14ad78 of _0x31d544){_0x381680[_0x533c1b(0x144)](_0x14ad78);}const _0x5188fb=_0x51db73?[]:findJourneysToDelete(_0x416057,_0x182b31[_0x533c1b(0x185)](({yamlConfig:_0x59c705,folderPath:_0x367678})=>({'yamlConfig':_0x59c705,'folderPath':resolveTDFolderPath(_0x367678,_0x3eaa4,_0x49d871)})),_0xc765a4,_0x49d871,_0x3eaa4),_0x1e0f78=calculatePushStats(_0x10c64f,_0x3edf6f,_0x381680,_0xb61b20,_0x5188fb,!!_0x283a33['delete'],!!_0x283a33[_0x533c1b(0x156)]),_0x4f6758=_0x1e0f78[_0x533c1b(0x18b)][_0x533c1b(0x16a)],_0x4540c4=_0x1e0f78[_0x533c1b(0x18b)][_0x533c1b(0x186)],_0x14d790=_0x1e0f78[_0x533c1b(0x18b)][_0x533c1b(0x12f)],_0x124aea=_0x1e0f78[_0x533c1b(0x18b)][_0x533c1b(0x15f)],_0x1dedcd=_0x1e0f78[_0x533c1b(0x173)][_0x533c1b(0x18d)],_0x426b35=_0x1e0f78[_0x533c1b(0x174)][_0x533c1b(0x16a)],_0x2dea13=_0x1e0f78[_0x533c1b(0x174)][_0x533c1b(0x186)],_0x738bb9=_0x1e0f78[_0x533c1b(0x174)][_0x533c1b(0x12f)],_0x408d42=_0x1e0f78[_0x533c1b(0x174)][_0x533c1b(0x15f)],_0x168fb7=_0x1e0f78[_0x533c1b(0x12d)][_0x533c1b(0x154)],_0x1f948c=_0x1e0f78[_0x533c1b(0x12d)][_0x533c1b(0x18d)],_0x120d45=_0x1e0f78[_0x533c1b(0x12d)][_0x533c1b(0x127)],_0x110de1=_0x1e0f78['activations']['toDelete'];console['error'](_0x533c1b(0x14e)+_0x187631+'\x27:');_0x1dedcd['length']>0x0&&console[_0x533c1b(0x1bd)]('\x20\x20'+a42_0x3126ae[_0x533c1b(0x146)]('📁\x20'+_0x1dedcd[_0x533c1b(0x1b2)]+_0x533c1b(0x1a0)));if(!_0x283a33['journeysOnly']){console['error'](_0x533c1b(0x19d)),console[_0x533c1b(0x1bd)](_0x533c1b(0x132)+a42_0x3126ae['green']('+\x20'+_0x4f6758['length']+_0x533c1b(0x194))),console[_0x533c1b(0x1bd)](_0x533c1b(0x132)+a42_0x3126ae[_0x533c1b(0x153)]('~\x20'+_0x4540c4[_0x533c1b(0x1b2)]+_0x533c1b(0x16f)));if(_0x124aea[_0x533c1b(0x1b2)]>0x0)console['error']('\x20\x20\x20\x20'+a42_0x3126ae[_0x533c1b(0x161)]('-\x20'+_0x124aea[_0x533c1b(0x1b2)]+_0x533c1b(0x139)));else _0xb61b20['length']>0x0&&!_0x283a33[_0x533c1b(0x131)]&&console['error'](_0x533c1b(0x132)+a42_0x3126ae[_0x533c1b(0x134)](_0xb61b20[_0x533c1b(0x1b2)]+_0x533c1b(0x15e)));console[_0x533c1b(0x1bd)](_0x533c1b(0x132)+a42_0x3126ae[_0x533c1b(0x134)]('=\x20'+_0x14d790[_0x533c1b(0x1b2)]+_0x533c1b(0x12a)));}if(_0x3edf6f[_0x533c1b(0x1b2)]>0x0||_0x5188fb[_0x533c1b(0x1b2)]>0x0){console[_0x533c1b(0x1bd)](_0x533c1b(0x1aa)),console[_0x533c1b(0x1bd)]('\x20\x20\x20\x20'+a42_0x3126ae[_0x533c1b(0x160)]('+\x20'+_0x426b35[_0x533c1b(0x1b2)]+'\x20new')),console[_0x533c1b(0x1bd)]('\x20\x20\x20\x20'+a42_0x3126ae[_0x533c1b(0x153)]('~\x20'+_0x2dea13['length']+_0x533c1b(0x16f)));if(_0x408d42['length']>0x0)console[_0x533c1b(0x1bd)]('\x20\x20\x20\x20'+a42_0x3126ae[_0x533c1b(0x161)]('-\x20'+_0x408d42[_0x533c1b(0x1b2)]+_0x533c1b(0x139)));else _0x5188fb[_0x533c1b(0x1b2)]>0x0&&!_0x283a33['delete']&&console[_0x533c1b(0x1bd)](_0x533c1b(0x132)+a42_0x3126ae['dim'](_0x5188fb['length']+_0x533c1b(0x15e)));console[_0x533c1b(0x1bd)](_0x533c1b(0x132)+a42_0x3126ae['dim']('=\x20'+_0x738bb9['length']+_0x533c1b(0x12a)));}_0x168fb7[_0x533c1b(0x1b2)]>0x0&&!_0x283a33[_0x533c1b(0x156)]&&(console['error'](''),console[_0x533c1b(0x1bd)](_0x533c1b(0x125)),_0x1f948c['length']>0x0&&console[_0x533c1b(0x1bd)](_0x533c1b(0x132)+a42_0x3126ae[_0x533c1b(0x160)]('+\x20'+_0x1f948c[_0x533c1b(0x1b2)]+_0x533c1b(0x11c))),_0x120d45[_0x533c1b(0x1b2)]>0x0&&console[_0x533c1b(0x1bd)](_0x533c1b(0x132)+a42_0x3126ae['yellow']('~\x20'+_0x120d45[_0x533c1b(0x1b2)]+_0x533c1b(0x169))),_0x110de1['length']>0x0&&console[_0x533c1b(0x1bd)](_0x533c1b(0x132)+a42_0x3126ae[_0x533c1b(0x161)]('-\x20'+_0x110de1[_0x533c1b(0x1b2)]+_0x533c1b(0x139))));console[_0x533c1b(0x1bd)](_0x533c1b(0x14b)+a42_0x3126ae[_0x533c1b(0x151)](_0xcb6eac)+'\x0a');if(_0x1dedcd['length']>0x0){console[_0x533c1b(0x1bd)](_0x533c1b(0x17d));for(const _0xcffaa9 of _0x1dedcd){console[_0x533c1b(0x1bd)]('\x20\x20'+a42_0x3126ae[_0x533c1b(0x146)]('+')+'\x20'+_0xcffaa9);}console['error']('');}if(_0x4f6758[_0x533c1b(0x1b2)]>0x0&&!_0x283a33[_0x533c1b(0x156)])for(const _0x58ff84 of _0x4f6758){const _0x56d004=_0x58ff84[_0x533c1b(0x14a)]?_0x58ff84[_0x533c1b(0x14a)]+'/'+_0x58ff84['yamlConfig'][_0x533c1b(0x143)]:_0x58ff84[_0x533c1b(0x180)][_0x533c1b(0x143)],_0x2b5680=_0x58ff84[_0x533c1b(0x180)]['activations']?.['length']||0x0,_0x208fe0=_0x2b5680>0x0?a42_0x3126ae[_0x533c1b(0x134)]('\x20['+_0x2b5680+_0x533c1b(0x135)):'';console['error']('\x0a'+a42_0x3126ae['green'](_0x533c1b(0x124))+'\x20'+_0x56d004+_0x208fe0),console[_0x533c1b(0x1bd)]('─'['repeat'](0x3c)),_0x58ff84[_0x533c1b(0x181)]&&console[_0x533c1b(0x1bd)](_0x58ff84[_0x533c1b(0x181)]),console[_0x533c1b(0x1bd)]('─'[_0x533c1b(0x1ba)](0x3c));}if(_0x124aea[_0x533c1b(0x1b2)]>0x0&&!_0x283a33[_0x533c1b(0x156)])for(const _0x2cc152 of _0x124aea){const _0x21abea=_0x2cc152[_0x533c1b(0x162)]?_0xc765a4[_0x533c1b(0x14d)](_0x2cc152['segmentFolderId'][_0x533c1b(0x13e)]())||'':'',_0x234b69=_0x21abea?_0x21abea+'/'+_0x2cc152[_0x533c1b(0x143)]:_0x2cc152['name'],_0x18fd10=_0x2f4af4['get'](_0x2cc152['id'])||[],_0x3e1c91=_0x18fd10[_0x533c1b(0x1b2)]>0x0?a42_0x3126ae['dim']('\x20['+_0x18fd10['length']+_0x533c1b(0x135)):'';console['error']('\x0a'+a42_0x3126ae[_0x533c1b(0x161)](_0x533c1b(0x14c))+'\x20'+_0x234b69+_0x3e1c91),console['error']('─'[_0x533c1b(0x1ba)](0x3c));const _0x4a7e50=segmentWithActivationsToYaml(_0x2cc152,_0x18fd10,undefined,_0x1c1cb7,_0xbf89c2),_0x20fcfc=segmentToYamlString(_0x4a7e50),_0x59dd9b=generateDiff(_0x20fcfc,'');console['error'](formatDiffWithColors(_0x59dd9b)),console[_0x533c1b(0x1bd)]('─'[_0x533c1b(0x1ba)](0x3c));}const _0x55b25d=_0x10c64f[_0x533c1b(0x17e)](_0x4a1a53=>!_0x4a1a53[_0x533c1b(0x19b)]&&_0x4a1a53['diff']);if(_0x55b25d[_0x533c1b(0x1b2)]>0x0&&!_0x283a33[_0x533c1b(0x156)])for(const _0x5cbc12 of _0x55b25d){const _0x43f7e2=_0x5cbc12['folderPath']?_0x5cbc12[_0x533c1b(0x14a)]+'/'+_0x5cbc12[_0x533c1b(0x180)][_0x533c1b(0x143)]:_0x5cbc12[_0x533c1b(0x180)][_0x533c1b(0x143)];console[_0x533c1b(0x1bd)]('\x0a'+a42_0x3126ae[_0x533c1b(0x153)](_0x533c1b(0x1a6))+'\x20'+_0x43f7e2),console[_0x533c1b(0x1bd)]('─'[_0x533c1b(0x1ba)](0x3c)),console['error'](_0x5cbc12[_0x533c1b(0x181)]),console[_0x533c1b(0x1bd)]('─'['repeat'](0x3c));}if(_0x426b35[_0x533c1b(0x1b2)]>0x0)for(const _0x53b30c of _0x426b35){const _0x2559d7=_0x53b30c[_0x533c1b(0x14a)]?_0x53b30c[_0x533c1b(0x14a)]+'/'+_0x53b30c[_0x533c1b(0x180)][_0x533c1b(0x143)]:_0x53b30c['yamlConfig'][_0x533c1b(0x143)];console[_0x533c1b(0x1bd)]('\x0a'+a42_0x3126ae['green'](_0x533c1b(0x1a7))+'\x20'+_0x2559d7),console['error']('─'['repeat'](0x3c)),_0x53b30c[_0x533c1b(0x181)]&&console[_0x533c1b(0x1bd)](_0x53b30c[_0x533c1b(0x181)]),console[_0x533c1b(0x1bd)]('─'['repeat'](0x3c));}const _0x3f356b=_0x3edf6f[_0x533c1b(0x17e)](_0x224935=>!_0x224935[_0x533c1b(0x19b)]&&_0x224935[_0x533c1b(0x181)]);if(_0x3f356b['length']>0x0)for(const _0x25b6ec of _0x3f356b){const _0x5f1cff=_0x25b6ec[_0x533c1b(0x14a)]?_0x25b6ec[_0x533c1b(0x14a)]+'/'+_0x25b6ec[_0x533c1b(0x180)][_0x533c1b(0x143)]:_0x25b6ec['yamlConfig'][_0x533c1b(0x143)];console[_0x533c1b(0x1bd)]('\x0a'+a42_0x3126ae[_0x533c1b(0x153)](_0x533c1b(0x192))+'\x20'+_0x5f1cff),console[_0x533c1b(0x1bd)]('─'[_0x533c1b(0x1ba)](0x3c)),console[_0x533c1b(0x1bd)](_0x25b6ec[_0x533c1b(0x181)]),console[_0x533c1b(0x1bd)]('─'[_0x533c1b(0x1ba)](0x3c));}if(_0x408d42[_0x533c1b(0x1b2)]>0x0)for(const _0x29d30b of _0x408d42){const _0x433137=_0x29d30b[_0x533c1b(0x165)]?_0xc765a4[_0x533c1b(0x14d)](_0x29d30b[_0x533c1b(0x165)])||'':'',_0x115ac9=_0x433137?_0x433137+'/'+_0x29d30b[_0x533c1b(0x1b4)]:_0x29d30b['journeyBundleName'];console[_0x533c1b(0x1bd)]('\x0a'+a42_0x3126ae[_0x533c1b(0x161)]('Delete\x20journey:')+'\x20'+_0x115ac9),console[_0x533c1b(0x1bd)]('─'[_0x533c1b(0x1ba)](0x3c)),console[_0x533c1b(0x1bd)](a42_0x3126ae[_0x533c1b(0x161)]('(Journey\x20will\x20be\x20deleted)')),console['error']('─'[_0x533c1b(0x1ba)](0x3c));}if(_0x283a33['dryRun'])return console[_0x533c1b(0x1bd)](a42_0x3126ae[_0x533c1b(0x153)](_0x533c1b(0x136))),0x0;const _0x21b2aa=_0x283a33[_0x533c1b(0x156)]?![]:_0x4f6758['length']>0x0||_0x4540c4['length']>0x0||_0x124aea[_0x533c1b(0x1b2)]>0x0,_0x49491d=_0x426b35['length']>0x0||_0x2dea13['length']>0x0||_0x408d42['length']>0x0,_0x54a42a=_0x283a33[_0x533c1b(0x156)]?![]:_0x168fb7[_0x533c1b(0x1b2)]>0x0,_0x1d9df2=_0x1dedcd['length']>0x0;if(!_0x21b2aa&&!_0x49491d&&!_0x54a42a&&!_0x1d9df2){const _0x498558=_0x283a33[_0x533c1b(0x156)]?_0x533c1b(0x16d):_0x533c1b(0x1a8);console[_0x533c1b(0x1bd)](a42_0x3126ae['green'](_0x498558));if(_0x51db73&&_0x14d790[_0x533c1b(0x1b2)]===0x1){const _0x209172=_0x14d790[0x0];if(_0x209172['existingSegment']?.['id']){const _0x4d8127=getConsoleNextUrl(_0x283a33[_0x533c1b(0x15b)],_0x533c1b(0x190)+_0x5721b9+_0x533c1b(0x140)+_0x209172[_0x533c1b(0x18e)]['id']+'/sb/da/esr');console[_0x533c1b(0x1bd)]('\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20'+a42_0x3126ae[_0x533c1b(0x151)](_0x4d8127));}}if(_0x51db73&&_0x738bb9['length']===0x1){const _0x16d08c=_0x738bb9[0x0];if(_0x16d08c[_0x533c1b(0x141)]?.['id']){const _0x2e85f4=getConsoleNextUrl(_0x283a33[_0x533c1b(0x15b)],_0x533c1b(0x190)+_0x5721b9+_0x533c1b(0x140)+_0x16d08c[_0x533c1b(0x141)]['id']+_0x533c1b(0x121));console['error']('\x20\x20'+a42_0x3126ae['cyan'](_0x2e85f4));}}return 0x0;}const _0x2fa80e=_0x283a33[_0x533c1b(0x156)]?_0x426b35[_0x533c1b(0x1b2)]+_0x2dea13[_0x533c1b(0x1b2)]+_0x408d42['length']+_0x1dedcd[_0x533c1b(0x1b2)]:_0x4f6758[_0x533c1b(0x1b2)]+_0x4540c4[_0x533c1b(0x1b2)]+_0x124aea['length']+_0x426b35[_0x533c1b(0x1b2)]+_0x2dea13['length']+_0x408d42['length']+_0x1dedcd[_0x533c1b(0x1b2)]+_0x168fb7['length'];if(!_0x283a33[_0x533c1b(0x12c)]&&_0x2fa80e>0x0){if(!isInteractive())return console[_0x533c1b(0x1bd)](a42_0x3126ae[_0x533c1b(0x161)](_0x533c1b(0x1a3)),_0x533c1b(0x1bb)),console[_0x533c1b(0x1bd)](a42_0x3126ae[_0x533c1b(0x134)](_0x533c1b(0x170))),0x1;const _0x4ad247=await confirmKey(_0x533c1b(0x1a9)+_0x2fa80e+_0x533c1b(0x19a));if(!_0x4ad247)return console[_0x533c1b(0x1bd)](a42_0x3126ae['yellow'](_0x533c1b(0x123))),0x1;}const _0x4fb35b={'withProgress':async(_0x53b490,_0x56880e)=>{const _0x501fa5=_0x533c1b,_0x41b5db=await withSpinner(_0x53b490,_0x56880e,{'verbose':_0x283a33[_0x501fa5(0x15c)]});return{'data':_0x41b5db[_0x501fa5(0x1ae)]};},'logInfo':_0x495f7c=>console[_0x533c1b(0x1bd)](a42_0x3126ae[_0x533c1b(0x146)]('✔\x20'+_0x495f7c)),'logSuccess':_0x23beab=>console['error'](a42_0x3126ae[_0x533c1b(0x160)]('✔\x20'+_0x23beab)),'logWarning':_0x43fda6=>console['error'](a42_0x3126ae[_0x533c1b(0x153)]('⚠\x20'+_0x43fda6)),'logDeleted':_0x46ff10=>console[_0x533c1b(0x1bd)](a42_0x3126ae[_0x533c1b(0x161)]('✔\x20'+_0x46ff10))},_0x297fb0={'segment':_0x26f6b9[_0x533c1b(0x177)],'journey':_0x26f6b9[_0x533c1b(0x19e)],'user':_0x26f6b9[_0x533c1b(0x191)],'connection':_0x26f6b9[_0x533c1b(0x1be)]};_0x1dedcd[_0x533c1b(0x1b2)]>0x0&&(_0x4d1532=await executePushFolders(_0x297fb0,_0x1dedcd,_0x4d1532,{'parentId':_0x5721b9},_0x4fb35b));const _0x15599b={'rootFolderId':_0x2c32ff,'folderPathToId':_0x4d1532,'folderIdToPath':_0xc765a4,'segmentNameToId':_0x2164b0,'activationsBySegmentId':_0x2f4af4,'emailToIdMap':_0x32e3be,'idToEmailMap':_0x1c1cb7,'connectionNameToIdMap':_0x29b9d8['nameToId'],'connectionIdToNameMap':_0x29b9d8['idToName'],'connectionNameToTypeMap':_0x3bf2fd},_0x553661=await executePushSegments(_0x297fb0,_0x283a33[_0x533c1b(0x156)]?[]:_0x10c64f,_0x15599b,{'parentId':_0x5721b9},_0x4fb35b),_0x38b479=_0x553661[_0x533c1b(0x11f)],_0x22a97c=_0x553661[_0x533c1b(0x1af)],_0xeae200=_0x553661['activations'][_0x533c1b(0x11f)],_0xbf3f43=_0x553661[_0x533c1b(0x12d)][_0x533c1b(0x1af)],_0x50a90b=_0x553661[_0x533c1b(0x12d)][_0x533c1b(0x13b)];let _0x31ec9a;if(_0x51db73&&_0x10c64f['length']===0x1){const _0x330a0d=_0x10c64f[0x0];_0x31ec9a=_0x330a0d['existingSegment']?.['id']??_0x553661[_0x533c1b(0x19f)][_0x533c1b(0x14d)](_0x330a0d['yamlConfig'][_0x533c1b(0x143)]);}const _0x3befdc=await executePushSegmentDeletions(_0x297fb0,_0x283a33[_0x533c1b(0x156)]?[]:_0x124aea,_0x4fb35b);let _0x1ce6e7=0x0,_0x31fd7e=0x0,_0xb2820f=0x0;const _0xf771fa=new Map(_0x2164b0);for(const [_0x41b69a,_0x3bdb75]of _0x553661[_0x533c1b(0x19f)]){_0xf771fa[_0x533c1b(0x17a)](_0x41b69a,_0x3bdb75);}if(_0x3edf6f[_0x533c1b(0x1b2)]>0x0){const _0x168ceb={..._0x15599b,'segmentNameToId':_0xf771fa,'existingSegments':_0x24b4f1,'activationContext':_0x2e30a2},_0x659acf=await executePushJourneys(_0x297fb0,_0x3edf6f,_0x168ceb,{'parentId':_0x5721b9,'rootFolderId':_0x2c32ff,'verbose':_0x283a33[_0x533c1b(0x15c)]},_0x4fb35b);_0x1ce6e7=_0x659acf[_0x533c1b(0x11f)],_0x31fd7e=_0x659acf[_0x533c1b(0x1af)];if(_0x51db73&&_0x659acf[_0x533c1b(0x147)][_0x533c1b(0x1b2)]===0x1){const _0x3e98af=_0x659acf['results'][0x0];if(_0x3e98af['journeyId']){const _0x3566ac=getConsoleNextUrl(_0x283a33[_0x533c1b(0x15b)],_0x533c1b(0x190)+_0x5721b9+_0x533c1b(0x140)+_0x3e98af[_0x533c1b(0x16b)]+_0x533c1b(0x121));console[_0x533c1b(0x1bd)]('\x20\x20'+a42_0x3126ae[_0x533c1b(0x151)](_0x3566ac));}}}for(const _0x3e2923 of _0x408d42){console['error'](a42_0x3126ae[_0x533c1b(0x153)]('⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20'+_0x3e2923['journeyBundleName'])),_0xb2820f++;}const _0x82075b=[];if(_0x38b479>0x0)_0x82075b[_0x533c1b(0x196)](_0x38b479+_0x533c1b(0x18c));if(_0x22a97c>0x0)_0x82075b['push'](_0x22a97c+_0x533c1b(0x1b3));if(_0x3befdc>0x0)_0x82075b['push'](_0x3befdc+_0x533c1b(0x1bc));const _0x4fbacd=[];if(_0x1ce6e7>0x0)_0x4fbacd[_0x533c1b(0x196)](_0x1ce6e7+_0x533c1b(0x18c));if(_0x31fd7e>0x0)_0x4fbacd[_0x533c1b(0x196)](_0x31fd7e+'\x20updated');if(_0xb2820f>0x0)_0x4fbacd[_0x533c1b(0x196)](_0xb2820f+_0x533c1b(0x1bc));const _0xd01f44=[];if(_0xeae200>0x0)_0xd01f44[_0x533c1b(0x196)](_0xeae200+_0x533c1b(0x18c));if(_0xbf3f43>0x0)_0xd01f44[_0x533c1b(0x196)](_0xbf3f43+_0x533c1b(0x1b3));if(_0x50a90b>0x0)_0xd01f44[_0x533c1b(0x196)](_0x50a90b+_0x533c1b(0x1bc));console[_0x533c1b(0x1bd)](a42_0x3126ae[_0x533c1b(0x160)](_0x533c1b(0x1b6)));_0x82075b['length']>0x0&&!_0x283a33[_0x533c1b(0x156)]&&console[_0x533c1b(0x1bd)](_0x533c1b(0x189)+_0x82075b[_0x533c1b(0x197)](',\x20'));_0x4fbacd[_0x533c1b(0x1b2)]>0x0&&console[_0x533c1b(0x1bd)](_0x533c1b(0x179)+_0x4fbacd[_0x533c1b(0x197)](',\x20'));_0xd01f44[_0x533c1b(0x1b2)]>0x0&&!_0x283a33[_0x533c1b(0x156)]&&console['error'](_0x533c1b(0x178)+_0xd01f44['join'](',\x20'));if(_0x31ec9a){const _0x3bb93b=getConsoleNextUrl(_0x283a33[_0x533c1b(0x15b)],_0x533c1b(0x190)+_0x5721b9+_0x533c1b(0x140)+_0x31ec9a+_0x533c1b(0x14f));console[_0x533c1b(0x1bd)](_0x533c1b(0x12e)+a42_0x3126ae[_0x533c1b(0x151)](_0x3bb93b));}return 0x0;}}
@@ -1 +1 @@
1
- const a43_0x2a1065=a43_0x4c05;(function(_0x12033d,_0x9b0479){const _0x4b3fab=a43_0x4c05,_0x52b5af=_0x12033d();while(!![]){try{const _0x7e661f=parseInt(_0x4b3fab(0x1db))/0x1+-parseInt(_0x4b3fab(0x1f6))/0x2*(-parseInt(_0x4b3fab(0x1ef))/0x3)+parseInt(_0x4b3fab(0x1f5))/0x4*(-parseInt(_0x4b3fab(0x1e8))/0x5)+parseInt(_0x4b3fab(0x1e4))/0x6+-parseInt(_0x4b3fab(0x1ea))/0x7+parseInt(_0x4b3fab(0x1d2))/0x8*(parseInt(_0x4b3fab(0x1d1))/0x9)+-parseInt(_0x4b3fab(0x1dd))/0xa;if(_0x7e661f===_0x9b0479)break;else _0x52b5af['push'](_0x52b5af['shift']());}catch(_0x540370){_0x52b5af['push'](_0x52b5af['shift']());}}}(a43_0xaa84,0x21271));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a43_0xaa84(){const _0x154f7a=['Resolving\x20folder\x20\x27','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Resolving\x20path\x20\x27','segmentPath','updateSegmentById','9RaVLKq','776976TUndLL','Resolved\x20relative\x20path\x20to:\x20','parentId','INTERNAL','Updating\x20segment\x20\x27','segment','folder','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','✔\x20Updated\x20segment\x20\x27','225012dFistd','kind','638330SIzOHO','segmentName','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','name','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','description','1603860UympjI','rule','includes','Examples:','1210610XuxlQW','resolvePathToResource','1165332ApfIas','Segment\x20ID\x20missing\x20from\x20resolved\x20path','resolveFolderId','Segment\x20ID:\x20','verbose','12MWrqhU','segment:update','yellow','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','error','Parent\x20ID:\x20','4lKZhLW','9390UZMsaQ','execute','\x20\x20\x20Path:\x20','Resolved\x20folder\x20ID:\x20','\x27...'];a43_0xaa84=function(){return _0x154f7a;};return a43_0xaa84();}import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a43_0x4c05(_0x13cbb8,_0x4e2091){_0x13cbb8=_0x13cbb8-0x1d0;const _0xaa8456=a43_0xaa84();let _0x4c0520=_0xaa8456[_0x13cbb8];return _0x4c0520;}import a43_0x8834b4 from'chalk';export class SegmentUpdateCommand extends BaseCommand{[a43_0x2a1065(0x1e0)]=a43_0x2a1065(0x1f0);[a43_0x2a1065(0x1e3)]='Update\x20existing\x20child\x20segment';async[a43_0x2a1065(0x1f7)](_0x20452e){const _0x176e1a=a43_0x2a1065;console[_0x176e1a(0x1f3)](a43_0x8834b4[_0x176e1a(0x1f1)](_0x176e1a(0x1d9))),console['error'](a43_0x8834b4[_0x176e1a(0x1f1)](_0x176e1a(0x1fc)));const {options:_0x568287,args:_0xd08945,tdx:_0x498ea0}=_0x20452e,_0x450b1d=_0x568287;if(_0xd08945['length']===0x0)return console[_0x176e1a(0x1f3)](_0x176e1a(0x1df)),console[_0x176e1a(0x1f3)](_0x176e1a(0x1e2)),console[_0x176e1a(0x1f3)](_0x176e1a(0x1e7)),console[_0x176e1a(0x1f3)](_0x176e1a(0x1f2)),console[_0x176e1a(0x1f3)](_0x176e1a(0x1e1)),0x1;const _0x3a49fa=_0xd08945[0x0],_0x34f2e0=_0x568287[_0x176e1a(0x1fe)];let _0x5c73eb=_0x3a49fa;_0x34f2e0&&!_0x3a49fa[_0x176e1a(0x1e6)]('/')&&(_0x5c73eb=_0x34f2e0+'/'+_0x3a49fa,_0x450b1d[_0x176e1a(0x1ee)]&&console[_0x176e1a(0x1f3)](_0x176e1a(0x1d3)+_0x5c73eb));const _0x199659=await withSpinner(_0x176e1a(0x1fd)+_0x5c73eb+_0x176e1a(0x1fa),()=>_0x498ea0[_0x176e1a(0x1d7)][_0x176e1a(0x1e9)](_0x5c73eb),{'verbose':_0x450b1d[_0x176e1a(0x1ee)]}),_0x1e677e=_0x199659['data'];_0x450b1d[_0x176e1a(0x1ee)]&&console[_0x176e1a(0x1f3)]('Resolved\x20type:\x20'+_0x1e677e['type']);if(_0x1e677e['type']!==_0x176e1a(0x1d7))return console['error']('Error:\x20Cannot\x20update\x20'+_0x1e677e['type']+'.\x20Only\x20child\x20segments\x20can\x20be\x20updated.'),console[_0x176e1a(0x1f3)]('Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]'),0x1;if(!_0x1e677e['segmentId'])throw new SDKError(ErrorCode[_0x176e1a(0x1d5)],_0x176e1a(0x1eb));const _0x15ff01=_0x1e677e[_0x176e1a(0x1d4)],_0xed06ff=_0x1e677e['segmentId'];_0x450b1d[_0x176e1a(0x1ee)]&&(console[_0x176e1a(0x1f3)](_0x176e1a(0x1f4)+_0x15ff01),console[_0x176e1a(0x1f3)](_0x176e1a(0x1ed)+_0xed06ff));let _0x242ab0;if(_0x450b1d[_0x176e1a(0x1d8)]){const _0x3fb6fe=_0x450b1d[_0x176e1a(0x1d8)],_0x2b7fb4=await withSpinner(_0x176e1a(0x1fb)+_0x3fb6fe+_0x176e1a(0x1fa),()=>_0x498ea0[_0x176e1a(0x1d7)][_0x176e1a(0x1ec)](_0x15ff01,_0x3fb6fe),{'verbose':_0x450b1d[_0x176e1a(0x1ee)]});_0x242ab0=parseInt(_0x2b7fb4['data'],0xa),_0x450b1d[_0x176e1a(0x1ee)]&&console[_0x176e1a(0x1f3)](_0x176e1a(0x1f9)+_0x242ab0);}const _0x5ea652=await loadJSONFromOptions(_0x450b1d[_0x176e1a(0x1e5)],_0x450b1d['ruleFile']),_0x44b7f6={'name':_0x450b1d[_0x176e1a(0x1e0)],'description':_0x450b1d[_0x176e1a(0x1e3)],'rule':_0x5ea652,'kind':_0x450b1d[_0x176e1a(0x1dc)]!==undefined?parseInt(_0x450b1d[_0x176e1a(0x1dc)],0xa):undefined,'segmentFolderId':_0x242ab0},_0x111a95=await withSpinner(_0x176e1a(0x1d6)+_0x1e677e[_0x176e1a(0x1de)]+_0x176e1a(0x1fa),()=>_0x498ea0[_0x176e1a(0x1d7)][_0x176e1a(0x1d0)](_0x15ff01,_0xed06ff,_0x44b7f6),{'verbose':_0x450b1d[_0x176e1a(0x1ee)]}),_0x32f894=_0x111a95['data'];return console['error'](_0x176e1a(0x1da)+_0x32f894[_0x176e1a(0x1e0)]+'\x27'),_0x5c73eb!==_0x3a49fa&&console[_0x176e1a(0x1f3)](_0x176e1a(0x1f8)+_0x5c73eb),await handleSDKOutput([_0x32f894],_0x450b1d),0x0;}}
1
+ const a43_0x5b54e3=a43_0x5785;(function(_0x296445,_0x4f8132){const _0x39ddf9=a43_0x5785,_0x37d535=_0x296445();while(!![]){try{const _0x51aee3=parseInt(_0x39ddf9(0xae))/0x1+parseInt(_0x39ddf9(0x94))/0x2+-parseInt(_0x39ddf9(0xa3))/0x3+-parseInt(_0x39ddf9(0xac))/0x4+-parseInt(_0x39ddf9(0x98))/0x5+parseInt(_0x39ddf9(0x97))/0x6+parseInt(_0x39ddf9(0x95))/0x7;if(_0x51aee3===_0x4f8132)break;else _0x37d535['push'](_0x37d535['shift']());}catch(_0x305892){_0x37d535['push'](_0x37d535['shift']());}}}(a43_0x9793,0x3932c));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';function a43_0x5785(_0x1c0cc6,_0x324861){_0x1c0cc6=_0x1c0cc6-0x94;const _0x97933b=a43_0x9793();let _0x578542=_0x97933b[_0x1c0cc6];return _0x578542;}import a43_0xac2b13 from'chalk';export class SegmentUpdateCommand extends BaseCommand{[a43_0x5b54e3(0xb2)]=a43_0x5b54e3(0x9e);['description']=a43_0x5b54e3(0x9f);async[a43_0x5b54e3(0xbf)](_0x55f95f){const _0x18ecf5=a43_0x5b54e3;console[_0x18ecf5(0xaf)](a43_0xac2b13[_0x18ecf5(0xa9)](_0x18ecf5(0xa6))),console[_0x18ecf5(0xaf)](a43_0xac2b13[_0x18ecf5(0xa9)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x91ed31,args:_0x13dac5,tdx:_0x318e0e}=_0x55f95f,_0x5be97e=_0x91ed31;if(_0x13dac5['length']===0x0)return console[_0x18ecf5(0xaf)](_0x18ecf5(0xbb)),console[_0x18ecf5(0xaf)](_0x18ecf5(0xa0)),console[_0x18ecf5(0xaf)](_0x18ecf5(0xb4)),console['error'](_0x18ecf5(0xb7)),console['error'](_0x18ecf5(0xa7)),0x1;const _0x2dbd18=_0x13dac5[0x0],_0x4e79b4=_0x91ed31[_0x18ecf5(0xa1)];let _0x44b399=_0x2dbd18;_0x4e79b4&&!_0x2dbd18[_0x18ecf5(0xb8)]('/')&&(_0x44b399=_0x4e79b4+'/'+_0x2dbd18,_0x5be97e[_0x18ecf5(0xb1)]&&console[_0x18ecf5(0xaf)](_0x18ecf5(0xad)+_0x44b399));const _0x73f445=await withSpinner(_0x18ecf5(0xa5)+_0x44b399+'\x27...',()=>_0x318e0e[_0x18ecf5(0xbc)]['resolvePathToResource'](_0x44b399),{'verbose':_0x5be97e[_0x18ecf5(0xb1)]}),_0x1dbbc8=_0x73f445[_0x18ecf5(0xb9)];_0x5be97e[_0x18ecf5(0xb1)]&&console['error'](_0x18ecf5(0xa8)+_0x1dbbc8[_0x18ecf5(0x9b)]);if(_0x1dbbc8[_0x18ecf5(0x9b)]!==_0x18ecf5(0xbc))return console[_0x18ecf5(0xaf)]('Error:\x20Cannot\x20update\x20'+_0x1dbbc8[_0x18ecf5(0x9b)]+_0x18ecf5(0xa2)),console[_0x18ecf5(0xaf)]('Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]'),0x1;if(!_0x1dbbc8[_0x18ecf5(0xaa)])throw new SDKError(ErrorCode[_0x18ecf5(0xba)],_0x18ecf5(0x9a));const _0x5bef7b=_0x1dbbc8[_0x18ecf5(0xb6)],_0x5c5216=_0x1dbbc8[_0x18ecf5(0xaa)];_0x5be97e[_0x18ecf5(0xb1)]&&(console[_0x18ecf5(0xaf)](_0x18ecf5(0x9c)+_0x5bef7b),console[_0x18ecf5(0xaf)](_0x18ecf5(0xb0)+_0x5c5216));let _0x4c1c97;if(_0x5be97e['folder']){const _0x26b019=_0x5be97e[_0x18ecf5(0xa4)],_0x509088=await withSpinner(_0x18ecf5(0xab)+_0x26b019+'\x27...',()=>_0x318e0e[_0x18ecf5(0xbc)][_0x18ecf5(0x9d)](_0x5bef7b,_0x26b019),{'verbose':_0x5be97e[_0x18ecf5(0xb1)]});_0x4c1c97=parseInt(_0x509088['data'],0xa),_0x5be97e[_0x18ecf5(0xb1)]&&console[_0x18ecf5(0xaf)](_0x18ecf5(0xb5)+_0x4c1c97);}const _0x3c609b=await loadJSONFromOptions(_0x5be97e[_0x18ecf5(0xbe)],_0x5be97e['ruleFile']),_0xe321c8={'name':_0x5be97e[_0x18ecf5(0xb2)],'description':_0x5be97e['description'],'rule':_0x3c609b,'kind':_0x5be97e[_0x18ecf5(0x99)]!==undefined?parseInt(_0x5be97e[_0x18ecf5(0x99)],0xa):undefined,'segmentFolderId':_0x4c1c97},_0x19a294=await withSpinner('Updating\x20segment\x20\x27'+_0x1dbbc8[_0x18ecf5(0x96)]+'\x27...',()=>_0x318e0e[_0x18ecf5(0xbc)]['updateSegmentById'](_0x5bef7b,_0x5c5216,_0xe321c8),{'verbose':_0x5be97e['verbose']}),_0x3fc9ad=_0x19a294[_0x18ecf5(0xb9)];return console['error'](_0x18ecf5(0xbd)+_0x3fc9ad[_0x18ecf5(0xb2)]+'\x27'),_0x44b399!==_0x2dbd18&&console['error'](_0x18ecf5(0xb3)+_0x44b399),await handleSDKOutput([_0x3fc9ad],_0x5be97e),0x0;}}function a43_0x9793(){const _0x3049e7=['Segment\x20ID:\x20','verbose','name','\x20\x20\x20Path:\x20','Examples:','Resolved\x20folder\x20ID:\x20','parentId','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','includes','data','INTERNAL','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','segment','✔\x20Updated\x20segment\x20\x27','rule','execute','57914zueLsV','815164fPigvB','segmentName','2198688KTAikz','2157000VwVqsM','kind','Segment\x20ID\x20missing\x20from\x20resolved\x20path','type','Parent\x20ID:\x20','resolveFolderId','segment:update','Update\x20existing\x20child\x20segment','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','segmentPath','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','438720MzqVhC','folder','Resolving\x20path\x20\x27','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Resolved\x20type:\x20','yellow','segmentId','Resolving\x20folder\x20\x27','468048qzAIhA','Resolved\x20relative\x20path\x20to:\x20','417079BtrMLC','error'];a43_0x9793=function(){return _0x3049e7;};return a43_0x9793();}
@@ -1 +1 @@
1
- const a44_0x5b8f8c=a44_0x55c5;function a44_0x55c5(_0x2a27c2,_0x1a163d){_0x2a27c2=_0x2a27c2-0xde;const _0x517480=a44_0x5174();let _0x55c543=_0x517480[_0x2a27c2];return _0x55c543;}(function(_0x577127,_0x42d629){const _0x457e99=a44_0x55c5,_0x58ec9a=_0x577127();while(!![]){try{const _0x52e619=-parseInt(_0x457e99(0xfd))/0x1+-parseInt(_0x457e99(0x116))/0x2*(-parseInt(_0x457e99(0xf1))/0x3)+-parseInt(_0x457e99(0x10c))/0x4*(parseInt(_0x457e99(0xfa))/0x5)+-parseInt(_0x457e99(0x102))/0x6+parseInt(_0x457e99(0xea))/0x7*(parseInt(_0x457e99(0x118))/0x8)+parseInt(_0x457e99(0x114))/0x9+parseInt(_0x457e99(0x106))/0xa*(-parseInt(_0x457e99(0x100))/0xb);if(_0x52e619===_0x42d629)break;else _0x58ec9a['push'](_0x58ec9a['shift']());}catch(_0x443351){_0x58ec9a['push'](_0x58ec9a['shift']());}}}(a44_0x5174,0x308d0));import{existsSync,statSync}from'fs';import a44_0x50065f 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{[a44_0x5b8f8c(0xf8)]=a44_0x5b8f8c(0x10e);['description']='Set\x20current\x20segment/folder\x20context\x20for\x20navigation';async[a44_0x5b8f8c(0xf7)](_0x5acc44){const _0x29ab5e=a44_0x5b8f8c,{options:_0x15689d,args:_0x510b6a,tdx:_0x1640b9}=_0x5acc44;if(_0x510b6a[_0x29ab5e(0xf9)]===0x0)return console['error'](a44_0x50065f[_0x29ab5e(0xe9)](_0x29ab5e(0x117))),console['error']('Usage:\x20tdx\x20segment\x20use\x20<path>'),console[_0x29ab5e(0xe1)](_0x29ab5e(0xee)),console[_0x29ab5e(0xe1)](_0x29ab5e(0xf4)),console[_0x29ab5e(0xe1)]('\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22'),console[_0x29ab5e(0xe1)](_0x29ab5e(0xe0)),console[_0x29ab5e(0xe1)](_0x29ab5e(0xe5)),0x1;const _0x3c2b0f=_0x510b6a[0x0],_0x230025=_0x15689d['session'];try{if(_0x3c2b0f==='/')return saveSessionContext({'segment_path':undefined},_0x230025),console['log'](a44_0x50065f[_0x29ab5e(0x10f)](_0x29ab5e(0xec))),0x0;if(existsSync(_0x3c2b0f)&&statSync(_0x3c2b0f)[_0x29ab5e(0x103)]()){let _0x5b9e64;try{_0x5b9e64=findTdxConfig(_0x3c2b0f);}catch{return console[_0x29ab5e(0xe1)](a44_0x50065f[_0x29ab5e(0xe9)](_0x29ab5e(0x109)+_0x3c2b0f)),console[_0x29ab5e(0xe1)](a44_0x50065f[_0x29ab5e(0xfb)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;}const _0x3758f7=_0x5b9e64[_0x29ab5e(0xfc)]['parent_segment'];return saveSessionContext({'segment_path':_0x3758f7,'parent_segment':_0x3758f7},_0x230025),console[_0x29ab5e(0xeb)](a44_0x50065f[_0x29ab5e(0x10f)](_0x29ab5e(0x115)+a44_0x50065f[_0x29ab5e(0xfb)](_0x3758f7))),0x0;}const _0x485e93=_0x15689d['segmentPath'];let _0x267012=_0x3c2b0f;const _0x75edf0=parsePath(_0x3c2b0f);if(!_0x75edf0[_0x29ab5e(0x108)]){if(!_0x485e93)return console[_0x29ab5e(0xe1)](a44_0x50065f[_0x29ab5e(0xe9)](_0x29ab5e(0x107))),console[_0x29ab5e(0xe1)](a44_0x50065f[_0x29ab5e(0xfb)](_0x29ab5e(0x10a))),0x1;if(_0x3c2b0f==='..'){const _0x583fd0=_0x485e93[_0x29ab5e(0xf3)]('/')[_0x29ab5e(0xe6)](0x0,-0x1)[_0x29ab5e(0xe7)]('/');_0x267012=_0x583fd0||'/';}else _0x3c2b0f==='.'?_0x267012=_0x485e93:_0x267012=_0x485e93+'/'+_0x3c2b0f;_0x15689d[_0x29ab5e(0x111)]&&console['error'](_0x29ab5e(0xff)+_0x267012);}if(_0x267012==='/'||_0x267012==='')return saveSessionContext({'segment_path':undefined},_0x230025),console[_0x29ab5e(0xeb)](a44_0x50065f['green']('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;_0x267012=normalizePath(_0x267012);const _0x571fe1=parsePath(_0x267012)[_0x29ab5e(0xe2)];if(_0x571fe1[_0x29ab5e(0xf9)]===0x0)return saveSessionContext({'segment_path':undefined},_0x230025),console['log'](a44_0x50065f[_0x29ab5e(0x10f)](_0x29ab5e(0xec))),0x0;_0x15689d[_0x29ab5e(0x111)]&&(console[_0x29ab5e(0xe1)](_0x29ab5e(0xf5)+_0x15689d[_0x29ab5e(0xf0)]),console[_0x29ab5e(0xe1)]('Target\x20path:\x20'+_0x267012));const _0x42f0ba=await withSpinner(_0x29ab5e(0xed)+_0x267012+_0x29ab5e(0x113),()=>_0x1640b9[_0x29ab5e(0xe4)][_0x29ab5e(0xef)](_0x267012),{'verbose':_0x15689d[_0x29ab5e(0x111)]}),_0x3c6cc9=_0x42f0ba[_0x29ab5e(0x105)];_0x15689d[_0x29ab5e(0x111)]&&(console['error'](_0x29ab5e(0xde)+_0x3c6cc9[_0x29ab5e(0x112)]),console[_0x29ab5e(0xe1)](_0x29ab5e(0x10d)+_0x3c6cc9[_0x29ab5e(0xdf)]),_0x3c6cc9[_0x29ab5e(0x104)]&&console[_0x29ab5e(0xe1)](_0x29ab5e(0xf2)+_0x3c6cc9[_0x29ab5e(0x104)]));if(_0x3c6cc9[_0x29ab5e(0x112)]==='segment')return console[_0x29ab5e(0xe1)](a44_0x50065f[_0x29ab5e(0xe9)](_0x29ab5e(0xfe))),console[_0x29ab5e(0xe1)](_0x29ab5e(0x10b)),console[_0x29ab5e(0xe1)](a44_0x50065f[_0x29ab5e(0xfb)]('Use:\x20tdx\x20segment\x20use\x20'+_0x3c6cc9[_0x29ab5e(0xe3)]+(_0x3c6cc9[_0x29ab5e(0xf6)]?'/'+_0x3c6cc9['folderPath'][_0x29ab5e(0xe7)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x3c6cc9['fullPath'],'parent_segment':_0x3c6cc9['parentName']},_0x230025),console[_0x29ab5e(0xeb)](a44_0x50065f[_0x29ab5e(0x10f)](_0x29ab5e(0x115)+a44_0x50065f['cyan'](_0x3c6cc9['fullPath']))),_0x15689d['verbose']&&(console[_0x29ab5e(0xe1)](a44_0x50065f[_0x29ab5e(0xe8)](_0x29ab5e(0x110))),console[_0x29ab5e(0xe1)](a44_0x50065f[_0x29ab5e(0xe8)](_0x29ab5e(0x101)))),0x0;}catch(_0x1098f3){throw _0x1098f3;}}}function a44_0x5174(){const _0x24f1b3=['666YrXZXR','Folder\x20ID:\x20','split','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','Site:\x20','folderPath','execute','name','length','15KNcMAH','cyan','config','51658oJTcLz','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','Resolved\x20relative\x20path\x20to:\x20','11geyONd','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','828474uWakjY','isDirectory','folderId','data','4093670iHcceZ','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','isAbsolute','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','173452CgxvXb','Parent\x20ID:\x20','segment:use','green','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','verbose','type','\x27...','2513376KgcqwT','✔\x20Context\x20set\x20to:\x20','2306ypmLYO','Error:\x20Path\x20is\x20required\x0a','8JcdZnl','Resolved\x20path\x20type:\x20','parentId','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','error','segments','parentName','segment','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','slice','join','dim','red','2749789AVHyxx','log','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','Resolving\x20path\x20\x27','Examples:','resolvePathToResource','site'];a44_0x5174=function(){return _0x24f1b3;};return a44_0x5174();}
1
+ const a44_0x652065=a44_0x5b75;function a44_0x5b75(_0x141187,_0x3f6d50){_0x141187=_0x141187-0x1bf;const _0x4c5f37=a44_0x4c5f();let _0x5b75d7=_0x4c5f37[_0x141187];return _0x5b75d7;}(function(_0x256233,_0x5207be){const _0x4802a0=a44_0x5b75,_0x27fe57=_0x256233();while(!![]){try{const _0x470312=-parseInt(_0x4802a0(0x1f2))/0x1*(parseInt(_0x4802a0(0x1e4))/0x2)+-parseInt(_0x4802a0(0x1ee))/0x3*(-parseInt(_0x4802a0(0x1d4))/0x4)+parseInt(_0x4802a0(0x1f5))/0x5+parseInt(_0x4802a0(0x1da))/0x6*(parseInt(_0x4802a0(0x1c3))/0x7)+parseInt(_0x4802a0(0x1cd))/0x8+parseInt(_0x4802a0(0x1dc))/0x9+-parseInt(_0x4802a0(0x1c7))/0xa*(parseInt(_0x4802a0(0x1f6))/0xb);if(_0x470312===_0x5207be)break;else _0x27fe57['push'](_0x27fe57['shift']());}catch(_0x33c40a){_0x27fe57['push'](_0x27fe57['shift']());}}}(a44_0x4c5f,0x5dd07));import{existsSync,statSync}from'fs';import a44_0x2309f0 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';function a44_0x4c5f(){const _0x504964=['session','6612670rxFbiT','isAbsolute','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','data','segment:use','Use:\x20tdx\x20segment\x20use\x20','2698264NeCIyl','green','length','Usage:\x20tdx\x20segment\x20use\x20<path>','✔\x20Context\x20set\x20to:\x20','folderId','description','8QJbKxF','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Resolving\x20path\x20\x27','error','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','Site:\x20','487164lXUAks','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','1204956PWNKlG','segment','Parent\x20ID:\x20','segments','execute','\x27...','parent_segment','isDirectory','22nzbhix','join','config','Error:\x20Path\x20is\x20required\x0a','Resolved\x20relative\x20path\x20to:\x20','dim','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','site','fullPath','red','204261PJNMgF','Examples:','name','verbose','63569ckHrgQ','log','folderPath','2439480nNTeIq','11HJdDVX','type','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','cyan','parentName','Resolved\x20path\x20type:\x20','Folder\x20ID:\x20','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','split','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','segmentPath','parentId','56PfAxzr','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','Target\x20path:\x20'];a44_0x4c5f=function(){return _0x504964;};return a44_0x4c5f();}export class SegmentUseCommand extends BaseCommand{[a44_0x652065(0x1f0)]=a44_0x652065(0x1cb);[a44_0x652065(0x1d3)]=a44_0x652065(0x1c4);async[a44_0x652065(0x1e0)](_0x54f3fb){const _0xfcd42d=a44_0x652065,{options:_0x4a85cb,args:_0x46ade1,tdx:_0x2225da}=_0x54f3fb;if(_0x46ade1[_0xfcd42d(0x1cf)]===0x0)return console[_0xfcd42d(0x1d7)](a44_0x2309f0[_0xfcd42d(0x1ed)](_0xfcd42d(0x1e7))),console[_0xfcd42d(0x1d7)](_0xfcd42d(0x1d0)),console[_0xfcd42d(0x1d7)](_0xfcd42d(0x1ef)),console[_0xfcd42d(0x1d7)](_0xfcd42d(0x1d8)),console[_0xfcd42d(0x1d7)]('\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22'),console[_0xfcd42d(0x1d7)](_0xfcd42d(0x1db)),console[_0xfcd42d(0x1d7)]('\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 _0x264db9=_0x46ade1[0x0],_0x3c58c3=_0x4a85cb[_0xfcd42d(0x1c6)];try{if(_0x264db9==='/')return saveSessionContext({'segment_path':undefined},_0x3c58c3),console[_0xfcd42d(0x1f3)](a44_0x2309f0['green'](_0xfcd42d(0x1c0))),0x0;if(existsSync(_0x264db9)&&statSync(_0x264db9)[_0xfcd42d(0x1e3)]()){let _0x37ef89;try{_0x37ef89=findTdxConfig(_0x264db9);}catch{return console[_0xfcd42d(0x1d7)](a44_0x2309f0['red']('Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20'+_0x264db9)),console['error'](a44_0x2309f0[_0xfcd42d(0x1f9)](_0xfcd42d(0x1d5))),0x1;}const _0x551d70=_0x37ef89[_0xfcd42d(0x1e6)][_0xfcd42d(0x1e2)];return saveSessionContext({'segment_path':_0x551d70,'parent_segment':_0x551d70},_0x3c58c3),console[_0xfcd42d(0x1f3)](a44_0x2309f0[_0xfcd42d(0x1ce)](_0xfcd42d(0x1d1)+a44_0x2309f0[_0xfcd42d(0x1f9)](_0x551d70))),0x0;}const _0x24c27f=_0x4a85cb[_0xfcd42d(0x1c1)];let _0x495726=_0x264db9;const _0x1ec3c2=parsePath(_0x264db9);if(!_0x1ec3c2[_0xfcd42d(0x1c8)]){if(!_0x24c27f)return console[_0xfcd42d(0x1d7)](a44_0x2309f0['red'](_0xfcd42d(0x1f8))),console[_0xfcd42d(0x1d7)](a44_0x2309f0['cyan']('Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>')),0x1;if(_0x264db9==='..'){const _0x13fb62=_0x24c27f[_0xfcd42d(0x1bf)]('/')['slice'](0x0,-0x1)['join']('/');_0x495726=_0x13fb62||'/';}else _0x264db9==='.'?_0x495726=_0x24c27f:_0x495726=_0x24c27f+'/'+_0x264db9;_0x4a85cb[_0xfcd42d(0x1f1)]&&console[_0xfcd42d(0x1d7)](_0xfcd42d(0x1e8)+_0x495726);}if(_0x495726==='/'||_0x495726==='')return saveSessionContext({'segment_path':undefined},_0x3c58c3),console[_0xfcd42d(0x1f3)](a44_0x2309f0[_0xfcd42d(0x1ce)](_0xfcd42d(0x1c0))),0x0;_0x495726=normalizePath(_0x495726);const _0x1c0ff1=parsePath(_0x495726)[_0xfcd42d(0x1df)];if(_0x1c0ff1['length']===0x0)return saveSessionContext({'segment_path':undefined},_0x3c58c3),console['log'](a44_0x2309f0['green']('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;_0x4a85cb[_0xfcd42d(0x1f1)]&&(console[_0xfcd42d(0x1d7)](_0xfcd42d(0x1d9)+_0x4a85cb[_0xfcd42d(0x1eb)]),console[_0xfcd42d(0x1d7)](_0xfcd42d(0x1c5)+_0x495726));const _0x40e513=await withSpinner(_0xfcd42d(0x1d6)+_0x495726+_0xfcd42d(0x1e1),()=>_0x2225da[_0xfcd42d(0x1dd)]['resolvePathToResource'](_0x495726),{'verbose':_0x4a85cb['verbose']}),_0xaec8be=_0x40e513[_0xfcd42d(0x1ca)];_0x4a85cb[_0xfcd42d(0x1f1)]&&(console[_0xfcd42d(0x1d7)](_0xfcd42d(0x1fb)+_0xaec8be['type']),console['error'](_0xfcd42d(0x1de)+_0xaec8be[_0xfcd42d(0x1c2)]),_0xaec8be['folderId']&&console[_0xfcd42d(0x1d7)](_0xfcd42d(0x1fc)+_0xaec8be[_0xfcd42d(0x1d2)]));if(_0xaec8be[_0xfcd42d(0x1f7)]===_0xfcd42d(0x1dd))return console[_0xfcd42d(0x1d7)](a44_0x2309f0[_0xfcd42d(0x1ed)](_0xfcd42d(0x1c9))),console[_0xfcd42d(0x1d7)](_0xfcd42d(0x1ea)),console['error'](a44_0x2309f0[_0xfcd42d(0x1f9)](_0xfcd42d(0x1cc)+_0xaec8be[_0xfcd42d(0x1fa)]+(_0xaec8be[_0xfcd42d(0x1f4)]?'/'+_0xaec8be[_0xfcd42d(0x1f4)][_0xfcd42d(0x1e5)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0xaec8be[_0xfcd42d(0x1ec)],'parent_segment':_0xaec8be[_0xfcd42d(0x1fa)]},_0x3c58c3),console[_0xfcd42d(0x1f3)](a44_0x2309f0[_0xfcd42d(0x1ce)](_0xfcd42d(0x1d1)+a44_0x2309f0[_0xfcd42d(0x1f9)](_0xaec8be['fullPath']))),_0x4a85cb[_0xfcd42d(0x1f1)]&&(console[_0xfcd42d(0x1d7)](a44_0x2309f0[_0xfcd42d(0x1e9)]('Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context')),console['error'](a44_0x2309f0[_0xfcd42d(0x1e9)](_0xfcd42d(0x1fd)))),0x0;}catch(_0x220198){throw _0x220198;}}}
@@ -1 +1 @@
1
- function a45_0x5361(){const _0x5841b8=['Usage:\x20tdx\x20sg\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','filePath','green','valid','12kMTmXG','red','message','cwd','warningCount','file','5064GpCqsd','):\x20','error','✔\x20All\x20','\x20error(s)','33ieVTvB','\x20warning(s)\x20found','\x20file(s)\x20valid','Error:\x20Directory\x20not\x20found:\x20','2079288xnxLke','log','\x20valid','length','no_parent','yellow','\x20warning(s)','targetDir','138335HAZoCg','2317385fsUJmB','segment:validate','\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','endsWith','verbose','hasErrors','helpText','\x20file(s)\x20with\x20errors,\x20','Validate\x20segment\x20and\x20journey\x20YAML\x20files','857080FzDEsD','execute','name','validCount','1413Drltwd','111SiGDbN','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','dim','Error:\x20','description','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','12568SXHlXC','warnings','203871sfVSMi','cyan'];a45_0x5361=function(){return _0x5841b8;};return a45_0x5361();}const a45_0x31463f=a45_0x4323;(function(_0x13b18f,_0x3caa08){const _0x5b2ec2=a45_0x4323,_0x52cd03=_0x13b18f();while(!![]){try{const _0x3d3f7a=parseInt(_0x5b2ec2(0x148))/0x1+parseInt(_0x5b2ec2(0x146))/0x2*(parseInt(_0x5b2ec2(0x13f))/0x3)+parseInt(_0x5b2ec2(0x128))/0x4+parseInt(_0x5b2ec2(0x130))/0x5*(parseInt(_0x5b2ec2(0x14e))/0x6)+-parseInt(_0x5b2ec2(0x131))/0x7+-parseInt(_0x5b2ec2(0x11f))/0x8*(parseInt(_0x5b2ec2(0x13e))/0x9)+parseInt(_0x5b2ec2(0x13a))/0xa*(-parseInt(_0x5b2ec2(0x124))/0xb);if(_0x3d3f7a===_0x3caa08)break;else _0x52cd03['push'](_0x52cd03['shift']());}catch(_0x70079e){_0x52cd03['push'](_0x52cd03['shift']());}}}(a45_0x5361,0x4f187));import{BaseCommand}from'./command.js';function a45_0x4323(_0x132608,_0x3ede6d){_0x132608=_0x132608-0x11b;const _0x536185=a45_0x5361();let _0x43233e=_0x536185[_0x132608];return _0x43233e;}import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a45_0x53e069 from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class SegmentValidateCommand extends BaseCommand{[a45_0x31463f(0x13c)]=a45_0x31463f(0x132);[a45_0x31463f(0x143)]=a45_0x31463f(0x139);async[a45_0x31463f(0x13b)](_0x529907){const _0x2108f1=a45_0x31463f,{options:_0x592427,args:_0xc90676}=_0x529907,_0xe4c390=_0x592427,_0x33e0fd=await resolveTarget({'arg':_0xc90676[0x0],'contextParent':_0x592427['parentSegment'],'cwd':process[_0x2108f1(0x11c)]()});if(!isSuccessfulResolution(_0x33e0fd))return _0x33e0fd['errorCode']===_0x2108f1(0x12c)?(console[_0x2108f1(0x121)](a45_0x53e069['yellow'](_0x2108f1(0x145))),console[_0x2108f1(0x121)](_0x2108f1(0x14a)),console[_0x2108f1(0x121)](_0x2108f1(0x133)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file')):(console[_0x2108f1(0x121)](a45_0x53e069['red'](_0x2108f1(0x142)+_0x33e0fd[_0x2108f1(0x11b)]+'\x0a')),_0x33e0fd[_0x2108f1(0x137)]&&console[_0x2108f1(0x121)](a45_0x53e069[_0x2108f1(0x149)](_0x33e0fd[_0x2108f1(0x137)]))),0x1;const _0x2a345a=_0x33e0fd[_0x2108f1(0x12f)],_0x1fe8e5=_0x33e0fd['type']===_0x2108f1(0x11e)?_0x33e0fd[_0x2108f1(0x14b)]:undefined;if(!_0x1fe8e5&&!existsSync(_0x2a345a))return console[_0x2108f1(0x121)](a45_0x53e069[_0x2108f1(0x14f)](_0x2108f1(0x127)+_0x2a345a+'\x0a')),0x1;let _0x2eb777;if(_0x1fe8e5){if(!_0x1fe8e5[_0x2108f1(0x134)]('.yml')&&!_0x1fe8e5['endsWith']('.yaml'))return console['error'](a45_0x53e069[_0x2108f1(0x14f)](_0x2108f1(0x140)+_0x1fe8e5+'\x0a')),0x1;_0x2eb777=[_0x1fe8e5];}else _0x2eb777=findYamlFiles(_0x2a345a);if(_0x2eb777[_0x2108f1(0x12b)]===0x0)return console['error'](a45_0x53e069[_0x2108f1(0x14f)](_0x2108f1(0x144)+_0x2a345a+'\x0a')),0x1;const _0x39ed8f=validateYamlFiles(_0x2eb777,_0x2a345a),_0x50e99e=calculateSummary(_0x39ed8f);for(const _0x593f23 of _0x39ed8f){if(!isValidationResult(_0x593f23))continue;const {relativePath:_0x3ff4bb,source:_0x28bddf,result:_0x48e9bd,fileType:_0x23d6db}=_0x593f23,_0x3d9403=_0x23d6db;if(_0x48e9bd[_0x2108f1(0x14d)]&&_0x48e9bd[_0x2108f1(0x147)]['length']===0x0)_0xe4c390[_0x2108f1(0x135)]&&console[_0x2108f1(0x129)](a45_0x53e069[_0x2108f1(0x14c)]('✔\x20'+_0x3ff4bb)+a45_0x53e069[_0x2108f1(0x141)]('\x20('+_0x3d9403+')'));else _0x48e9bd[_0x2108f1(0x14d)]?(console[_0x2108f1(0x129)](a45_0x53e069[_0x2108f1(0x12d)]('⚠\x20'+_0x3ff4bb)+a45_0x53e069[_0x2108f1(0x141)]('\x20('+_0x3d9403+_0x2108f1(0x120)+_0x48e9bd[_0x2108f1(0x147)][_0x2108f1(0x12b)]+_0x2108f1(0x12e))),console['log'](formatValidationResult(_0x48e9bd,_0x28bddf,_0x3ff4bb))):(console[_0x2108f1(0x129)](a45_0x53e069[_0x2108f1(0x14f)]('✖\x20'+_0x3ff4bb)+a45_0x53e069[_0x2108f1(0x141)]('\x20('+_0x3d9403+_0x2108f1(0x120)+_0x48e9bd['errors'][_0x2108f1(0x12b)]+_0x2108f1(0x123))),console[_0x2108f1(0x129)](formatValidationResult(_0x48e9bd,_0x28bddf,_0x3ff4bb)));}return console[_0x2108f1(0x129)](''),_0x50e99e[_0x2108f1(0x136)]?(console[_0x2108f1(0x129)](a45_0x53e069[_0x2108f1(0x14f)]('Validation\x20failed:\x20'+_0x50e99e['invalidCount']+_0x2108f1(0x138)+_0x50e99e[_0x2108f1(0x13d)]+_0x2108f1(0x12a))),_0x50e99e['warningCount']>0x0&&console[_0x2108f1(0x129)](a45_0x53e069[_0x2108f1(0x12d)](_0x50e99e['warningCount']+_0x2108f1(0x125))),0x1):(console[_0x2108f1(0x129)](a45_0x53e069[_0x2108f1(0x14c)](_0x2108f1(0x122)+_0x50e99e[_0x2108f1(0x13d)]+_0x2108f1(0x126))),_0x50e99e[_0x2108f1(0x11d)]>0x0&&console['log'](a45_0x53e069[_0x2108f1(0x12d)](_0x50e99e[_0x2108f1(0x11d)]+'\x20warning(s)\x20found')),0x0);}}
1
+ const a45_0x47adf9=a45_0x4986;(function(_0x2c8dc4,_0x5c0499){const _0x5af909=a45_0x4986,_0x1805ff=_0x2c8dc4();while(!![]){try{const _0xfcbb35=-parseInt(_0x5af909(0x14e))/0x1+parseInt(_0x5af909(0x170))/0x2*(-parseInt(_0x5af909(0x15c))/0x3)+parseInt(_0x5af909(0x14c))/0x4*(-parseInt(_0x5af909(0x163))/0x5)+-parseInt(_0x5af909(0x177))/0x6*(parseInt(_0x5af909(0x180))/0x7)+parseInt(_0x5af909(0x14b))/0x8+-parseInt(_0x5af909(0x16b))/0x9*(parseInt(_0x5af909(0x179))/0xa)+parseInt(_0x5af909(0x150))/0xb;if(_0xfcbb35===_0x5c0499)break;else _0x1805ff['push'](_0x1805ff['shift']());}catch(_0x3d2852){_0x1805ff['push'](_0x1805ff['shift']());}}}(a45_0x43c2,0xcaed7));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';function a45_0x43c2(){const _0x1b7a9a=['helpText','8298351kAVCiq','):\x20','type','valid','errors','2gvzgMg','\x20file(s)\x20valid','targetDir','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','warningCount','invalidCount','✔\x20All\x20','1266wDTpze','Validate\x20segment\x20and\x20journey\x20YAML\x20files','10ERMWua','Error:\x20','\x20valid','log','file','validCount','\x20file(s)\x20with\x20errors,\x20','8841MoKyGq','3553592OJwNmM','4ifJQjw','hasErrors','1460364gDmRfv','cyan','61789288plklkz','dim','Usage:\x20tdx\x20sg\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','Error:\x20Directory\x20not\x20found:\x20','green','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','filePath','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','yellow','warnings','.yaml','\x20warning(s)','2889861wnqXUy','no_parent','length','execute','description','error','parentSegment','8090165VWGWnS','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','endsWith','message','segment:validate','red','name'];a45_0x43c2=function(){return _0x1b7a9a;};return a45_0x43c2();}import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a45_0x474811 from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';function a45_0x4986(_0x5489ce,_0x667897){_0x5489ce=_0x5489ce-0x14b;const _0x43c289=a45_0x43c2();let _0x49863e=_0x43c289[_0x5489ce];return _0x49863e;}export class SegmentValidateCommand extends BaseCommand{[a45_0x47adf9(0x169)]=a45_0x47adf9(0x167);[a45_0x47adf9(0x160)]=a45_0x47adf9(0x178);async[a45_0x47adf9(0x15f)](_0x4a9db7){const _0x1fdcc3=a45_0x47adf9,{options:_0x49f221,args:_0x3d83be}=_0x4a9db7,_0x40ca43=_0x49f221,_0x31c900=await resolveTarget({'arg':_0x3d83be[0x0],'contextParent':_0x49f221[_0x1fdcc3(0x162)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x31c900))return _0x31c900['errorCode']===_0x1fdcc3(0x15d)?(console[_0x1fdcc3(0x161)](a45_0x474811[_0x1fdcc3(0x158)](_0x1fdcc3(0x155))),console['error'](_0x1fdcc3(0x152)),console[_0x1fdcc3(0x161)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20validate\x20.\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20current\x20directory'),console[_0x1fdcc3(0x161)](_0x1fdcc3(0x157))):(console[_0x1fdcc3(0x161)](a45_0x474811[_0x1fdcc3(0x168)](_0x1fdcc3(0x17a)+_0x31c900[_0x1fdcc3(0x166)]+'\x0a')),_0x31c900[_0x1fdcc3(0x16a)]&&console['error'](a45_0x474811[_0x1fdcc3(0x14f)](_0x31c900[_0x1fdcc3(0x16a)]))),0x1;const _0x1e61c4=_0x31c900[_0x1fdcc3(0x172)],_0x2ed099=_0x31c900[_0x1fdcc3(0x16d)]===_0x1fdcc3(0x17d)?_0x31c900[_0x1fdcc3(0x156)]:undefined;if(!_0x2ed099&&!existsSync(_0x1e61c4))return console[_0x1fdcc3(0x161)](a45_0x474811[_0x1fdcc3(0x168)](_0x1fdcc3(0x153)+_0x1e61c4+'\x0a')),0x1;let _0x570d3d;if(_0x2ed099){if(!_0x2ed099['endsWith']('.yml')&&!_0x2ed099[_0x1fdcc3(0x165)](_0x1fdcc3(0x15a)))return console['error'](a45_0x474811[_0x1fdcc3(0x168)](_0x1fdcc3(0x164)+_0x2ed099+'\x0a')),0x1;_0x570d3d=[_0x2ed099];}else _0x570d3d=findYamlFiles(_0x1e61c4);if(_0x570d3d[_0x1fdcc3(0x15e)]===0x0)return console['error'](a45_0x474811[_0x1fdcc3(0x168)](_0x1fdcc3(0x173)+_0x1e61c4+'\x0a')),0x1;const _0x1875e6=validateYamlFiles(_0x570d3d,_0x1e61c4),_0x59ebcc=calculateSummary(_0x1875e6);for(const _0x4e8d7c of _0x1875e6){if(!isValidationResult(_0x4e8d7c))continue;const {relativePath:_0x2ef898,source:_0x30712e,result:_0x5bfbab,fileType:_0x516a21}=_0x4e8d7c,_0x30a9e0=_0x516a21;if(_0x5bfbab[_0x1fdcc3(0x16e)]&&_0x5bfbab[_0x1fdcc3(0x159)]['length']===0x0)_0x40ca43['verbose']&&console[_0x1fdcc3(0x17c)](a45_0x474811['green']('✔\x20'+_0x2ef898)+a45_0x474811['dim']('\x20('+_0x30a9e0+')'));else _0x5bfbab[_0x1fdcc3(0x16e)]?(console[_0x1fdcc3(0x17c)](a45_0x474811[_0x1fdcc3(0x158)]('⚠\x20'+_0x2ef898)+a45_0x474811['dim']('\x20('+_0x30a9e0+'):\x20'+_0x5bfbab['warnings'][_0x1fdcc3(0x15e)]+_0x1fdcc3(0x15b))),console['log'](formatValidationResult(_0x5bfbab,_0x30712e,_0x2ef898))):(console['log'](a45_0x474811[_0x1fdcc3(0x168)]('✖\x20'+_0x2ef898)+a45_0x474811[_0x1fdcc3(0x151)]('\x20('+_0x30a9e0+_0x1fdcc3(0x16c)+_0x5bfbab[_0x1fdcc3(0x16f)]['length']+'\x20error(s)')),console[_0x1fdcc3(0x17c)](formatValidationResult(_0x5bfbab,_0x30712e,_0x2ef898)));}return console[_0x1fdcc3(0x17c)](''),_0x59ebcc[_0x1fdcc3(0x14d)]?(console[_0x1fdcc3(0x17c)](a45_0x474811[_0x1fdcc3(0x168)]('Validation\x20failed:\x20'+_0x59ebcc[_0x1fdcc3(0x175)]+_0x1fdcc3(0x17f)+_0x59ebcc[_0x1fdcc3(0x17e)]+_0x1fdcc3(0x17b))),_0x59ebcc[_0x1fdcc3(0x174)]>0x0&&console[_0x1fdcc3(0x17c)](a45_0x474811[_0x1fdcc3(0x158)](_0x59ebcc[_0x1fdcc3(0x174)]+'\x20warning(s)\x20found')),0x1):(console[_0x1fdcc3(0x17c)](a45_0x474811[_0x1fdcc3(0x154)](_0x1fdcc3(0x176)+_0x59ebcc[_0x1fdcc3(0x17e)]+_0x1fdcc3(0x171))),_0x59ebcc[_0x1fdcc3(0x174)]>0x0&&console[_0x1fdcc3(0x17c)](a45_0x474811[_0x1fdcc3(0x158)](_0x59ebcc['warningCount']+'\x20warning(s)\x20found')),0x0);}}
@@ -1 +1 @@
1
- const a46_0x52f5ee=a46_0x5266;(function(_0x4f55ab,_0x340f14){const _0x473214=a46_0x5266,_0x2ae634=_0x4f55ab();while(!![]){try{const _0x3449f1=-parseInt(_0x473214(0x142))/0x1*(-parseInt(_0x473214(0x12a))/0x2)+parseInt(_0x473214(0x14e))/0x3+parseInt(_0x473214(0x15f))/0x4*(-parseInt(_0x473214(0x125))/0x5)+parseInt(_0x473214(0x151))/0x6+parseInt(_0x473214(0x13d))/0x7+-parseInt(_0x473214(0x140))/0x8+-parseInt(_0x473214(0x167))/0x9;if(_0x3449f1===_0x340f14)break;else _0x2ae634['push'](_0x2ae634['shift']());}catch(_0x29c26b){_0x2ae634['push'](_0x2ae634['shift']());}}}(a46_0x9dea,0xe0e9c));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a46_0x5266(_0x169999,_0x5c6d66){_0x169999=_0x169999-0x116;const _0x9dea8a=a46_0x9dea();let _0x526665=_0x9dea8a[_0x169999];return _0x526665;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a46_0x9dea(){const _0x335c13=['20306385cCkepe','/j/da','\x5c$&','\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22','localeCompare','description','Resolving\x20path\x20\x27','folders','\x20match','log','Building\x20hierarchy\x20tree...','(not\x20set)','jsonl','Error:\x20No\x20parent\x20segment\x20context\x20set.','execute','parentId','journeys','/app/ps/','\x27...','2593105lnVfQP','journey','\x20segments\x20share\x20this\x20name\x20—\x20pass\x20the\x20full\x20path\x20(or\x20id)\x20to\x20`tdx\x20sg\x20move`;\x20do\x20not\x20assume\x20the\x20first.','filter','padEnd','863418OlYzae','toLowerCase','Set\x20a\x20parent\x20segment\x20context\x20first:','Resolving\x20parent\x20segment\x20\x27','\x20segment','...','name','cause','\x20folder','segment',',\x20and\x20',']\x20matching\x20\x27','Folder\x20ID:\x20','✔\x20Found\x20','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','recursive','/e/','Site:\x20','format','9382415sbZNDa','map','Searching\x20the\x20tree\x20for\x20names\x20matching\x20','5422072ooYogT','\x20\x20Cause:\x20','2qVANJG','Listing\x20folders,\x20segments,\x20and\x20journeys...','listRecursive','List\x20folders\x20and\x20child\x20segments','length','Error:\x20','includes','No\x20folders\x20or\x20segments\x20match\x20','verbose','listUnified','\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.','test','4194075XZVzCW','data','(id\x20','7744332kXqyRY','\x20matching\x20\x27','error','size','type','journeyBundleName','site','Parent\x20ID:\x20','resolvePathToResource','json','✔\x20Built\x20tree\x20with\x20','sort','maxDepth','segments','8PWKgUd','dim','folder','replace','folderId','path','searchByName','\x20journey'];a46_0x9dea=function(){return _0x335c13;};return a46_0x9dea();}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 a46_0x1ad9db from'chalk';export class SegmentsCommand extends BaseCommand{[a46_0x52f5ee(0x130)]='segments';[a46_0x52f5ee(0x117)]=a46_0x52f5ee(0x145);async[a46_0x52f5ee(0x120)](_0x51d7c4){const _0x36ab19=a46_0x52f5ee,{options:_0x2964d5,args:_0x455e8a}=_0x51d7c4,_0x10e9dc=_0x2964d5[_0x36ab19(0x139)],_0x44e385=_0x455e8a[0x0];try{const _0x3af6da=_0x2964d5['parentSegment'];_0x2964d5[_0x36ab19(0x14a)]&&(console[_0x36ab19(0x153)](_0x36ab19(0x13b)+_0x2964d5[_0x36ab19(0x157)]),console['error']('Parent\x20segment\x20context:\x20'+(_0x3af6da||_0x36ab19(0x11d))),_0x44e385&&console[_0x36ab19(0x153)]('Folder/pattern\x20arg:\x20'+_0x44e385),_0x10e9dc&&console[_0x36ab19(0x153)]('Recursive\x20mode:\x20enabled'));if(!_0x3af6da)return console['error'](_0x36ab19(0x11f)),console['error'](''),console[_0x36ab19(0x153)](_0x36ab19(0x12c)),console[_0x36ab19(0x153)](_0x36ab19(0x16a)),console[_0x36ab19(0x153)]('\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22'),console[_0x36ab19(0x153)](''),console['error'](_0x36ab19(0x138)),0x1;if(_0x44e385&&_0x10e9dc)return await this[_0x36ab19(0x165)](_0x51d7c4,_0x3af6da,_0x44e385);const _0x20df3b=_0x44e385&&(_0x44e385[_0x36ab19(0x148)]('*')||_0x44e385['includes']('?'));if(_0x20df3b)return await this['listWithPattern'](_0x51d7c4,_0x3af6da,_0x44e385);const _0x4bb748=_0x44e385?_0x3af6da+'/'+_0x44e385:_0x3af6da;return _0x10e9dc?await this[_0x36ab19(0x144)](_0x51d7c4,_0x4bb748):await this[_0x36ab19(0x14b)](_0x51d7c4,_0x4bb748);}catch(_0x556c43){if(_0x556c43 instanceof SDKError)return console[_0x36ab19(0x153)](_0x36ab19(0x147)+_0x556c43['message']),_0x556c43[_0x36ab19(0x131)]&&console[_0x36ab19(0x153)](_0x36ab19(0x141)+_0x556c43[_0x36ab19(0x131)]),0x1;throw _0x556c43;}}async['searchByName'](_0x4402e8,_0x260945,_0x3f5c11){const _0x37928f=a46_0x52f5ee,{options:_0xde9cc2,tdx:_0x50945a}=_0x4402e8,_0x131408='\x22'+_0x3f5c11+'\x22',_0x384acf=await withSpinner('Resolving\x20path\x20\x27'+_0x260945+_0x37928f(0x124),()=>_0x50945a[_0x37928f(0x133)]['resolvePathToResource'](_0x260945),{'verbose':_0xde9cc2[_0x37928f(0x14a)]}),_0x3e9146=_0x384acf[_0x37928f(0x14f)],_0x36d057=_0xde9cc2[_0x37928f(0x15d)]||0xa,_0x4432ab=await withSpinner(_0x37928f(0x13f)+_0x131408+_0x37928f(0x12f),()=>_0x50945a[_0x37928f(0x133)][_0x37928f(0x144)](_0x3e9146[_0x37928f(0x121)],_0x3e9146[_0x37928f(0x163)],0x0,_0x36d057),{'verbose':_0xde9cc2[_0x37928f(0x14a)]}),_0x5c3826=searchTreeByName(_0x4432ab[_0x37928f(0x14f)],_0x3f5c11),_0x286777=_0x2262e5=>getConsoleNextUrl(_0xde9cc2[_0x37928f(0x157)],_0x37928f(0x123)+_0x3e9146[_0x37928f(0x121)]+_0x37928f(0x13a)+_0x2262e5),_0x423874=[..._0x5c3826]['sort']((_0x2df1d8,_0x3ab8a5)=>_0x2df1d8[_0x37928f(0x164)]['localeCompare'](_0x3ab8a5['path'])),_0x466f28=0x32,_0x2b3546='Found\x20'+_0x5c3826[_0x37928f(0x146)]+_0x37928f(0x11a)+(_0x5c3826[_0x37928f(0x146)]!==0x1?'es':'');console[_0x37928f(0x153)](_0x5c3826[_0x37928f(0x146)]>_0x466f28?'✔\x20'+_0x2b3546+_0x37928f(0x14c):'✔\x20'+_0x2b3546);if(_0xde9cc2[_0x37928f(0x13c)]===_0x37928f(0x15a)||_0xde9cc2['format']===_0x37928f(0x11e)){const _0xc9ae68=_0x423874[_0x37928f(0x13e)](_0x521a39=>({..._0x521a39,..._0x521a39[_0x37928f(0x155)]===_0x37928f(0x133)?{'url':_0x286777(_0x521a39['id'])}:{}}));return await handleSDKOutput(_0xc9ae68,_0xde9cc2),0x0;}if(_0x5c3826[_0x37928f(0x146)]===0x0)return console[_0x37928f(0x11b)](_0x37928f(0x149)+_0x131408),0x0;for(const _0x158941 of _0x423874){console[_0x37928f(0x11b)](_0x158941[_0x37928f(0x155)][_0x37928f(0x129)](0x8)+'\x20'+_0x158941[_0x37928f(0x164)]+'\x20\x20'+a46_0x1ad9db[_0x37928f(0x160)](_0x37928f(0x150)+_0x158941['id']+')'));}const _0x79de40=_0x5c3826['filter'](_0x3a0dbf=>_0x3a0dbf[_0x37928f(0x155)]===_0x37928f(0x133)),_0x13cdc0=new Set(_0x79de40['map'](_0x49bb18=>_0x49bb18[_0x37928f(0x130)][_0x37928f(0x12b)]()))[_0x37928f(0x154)]===0x1;return _0x79de40['length']>0x1&&_0x13cdc0&&console[_0x37928f(0x11b)](a46_0x1ad9db[_0x37928f(0x160)]('\x0a'+_0x79de40['length']+_0x37928f(0x127))),0x0;}async['listWithPattern'](_0x1f3dfe,_0x1cf9cf,_0xd4e0f0){const _0x4c6d3c=a46_0x52f5ee,{options:_0x292378,tdx:_0x4219ce}=_0x1f3dfe,_0x410418=await withSpinner(_0x4c6d3c(0x12d)+_0x1cf9cf+_0x4c6d3c(0x124),()=>_0x4219ce[_0x4c6d3c(0x133)][_0x4c6d3c(0x159)](_0x1cf9cf),{'verbose':_0x292378[_0x4c6d3c(0x14a)]}),_0xf7e04b=_0x410418[_0x4c6d3c(0x14f)],_0x5419e7=await withSpinner(_0x4c6d3c(0x143),()=>_0x4219ce['segment']['listUnifiedWithJourneys'](_0xf7e04b[_0x4c6d3c(0x121)],_0xf7e04b[_0x4c6d3c(0x163)]),{'verbose':_0x292378[_0x4c6d3c(0x14a)]}),{folders:_0x31c5ce,segments:_0x4a494d,journeys:_0xfaa724}=_0x5419e7[_0x4c6d3c(0x14f)],_0x49b37a=_0xd4e0f0[_0x4c6d3c(0x162)](/[.+^${}()|[\]\\]/g,_0x4c6d3c(0x169))[_0x4c6d3c(0x162)](/\*/g,'.*')[_0x4c6d3c(0x162)](/\?/g,'.'),_0x5edbf5=new RegExp('^'+_0x49b37a+'$','i'),_0x1d4de2=_0x31c5ce['filter'](_0x1cf8aa=>_0x5edbf5[_0x4c6d3c(0x14d)](_0x1cf8aa[_0x4c6d3c(0x130)])),_0x430d5e=_0x4a494d[_0x4c6d3c(0x128)](_0x21854e=>_0x5edbf5[_0x4c6d3c(0x14d)](_0x21854e[_0x4c6d3c(0x130)])),_0x4ac214=_0xfaa724[_0x4c6d3c(0x128)](_0x4057c5=>_0x5edbf5[_0x4c6d3c(0x14d)](_0x4057c5[_0x4c6d3c(0x156)])),_0x22c1cd=_0x1d4de2[_0x4c6d3c(0x146)]+_0x430d5e['length']+_0x4ac214[_0x4c6d3c(0x146)];console[_0x4c6d3c(0x153)]('✔\x20Found\x20'+_0x1d4de2[_0x4c6d3c(0x146)]+_0x4c6d3c(0x132)+(_0x1d4de2['length']!==0x1?'s':'')+',\x20'+_0x430d5e[_0x4c6d3c(0x146)]+'\x20segment'+(_0x430d5e[_0x4c6d3c(0x146)]!==0x1?'s':'')+_0x4c6d3c(0x134)+_0x4ac214[_0x4c6d3c(0x146)]+_0x4c6d3c(0x166)+(_0x4ac214[_0x4c6d3c(0x146)]!==0x1?'s':'')+_0x4c6d3c(0x152)+_0xd4e0f0+'\x27');const _0xa30699=_0x1a1bb9=>{const _0x1ae92a=_0x4c6d3c;return getConsoleNextUrl(_0x292378['site'],_0x1ae92a(0x123)+_0xf7e04b['parentId']+_0x1ae92a(0x13a)+_0x1a1bb9);},_0x3e1403=_0x292378[_0x4c6d3c(0x13c)]===_0x4c6d3c(0x15a)||_0x292378[_0x4c6d3c(0x13c)]===_0x4c6d3c(0x11e);if(_0x3e1403){const _0x5ad439=[..._0x1d4de2[_0x4c6d3c(0x13e)](_0x2aed09=>({..._0x2aed09,'type':_0x4c6d3c(0x161)})),..._0x430d5e[_0x4c6d3c(0x13e)](_0x224321=>({..._0x224321,'type':_0x4c6d3c(0x133),'url':_0xa30699(_0x224321['id'])})),..._0x4ac214['map'](_0x1afe6f=>({..._0x1afe6f,'name':_0x1afe6f[_0x4c6d3c(0x156)],'type':_0x4c6d3c(0x126)}))][_0x4c6d3c(0x15c)]((_0x180b99,_0x97de14)=>_0x180b99[_0x4c6d3c(0x130)][_0x4c6d3c(0x116)](_0x97de14['name']));await handleSDKOutput(_0x5ad439,_0x292378);}else{if(_0x22c1cd===0x0)console[_0x4c6d3c(0x11b)]('No\x20items\x20match\x20pattern:\x20'+_0xd4e0f0);else{console[_0x4c6d3c(0x11b)](a46_0x1ad9db['dim']('['+_0x1cf9cf+_0x4c6d3c(0x135)+_0xd4e0f0+'\x27'));const _0x402886=formatFlatList(_0x1d4de2,_0x430d5e,{'showMetadata':!![],'getSegmentUrl':_0xa30699},_0x4ac214);console[_0x4c6d3c(0x11b)](_0x402886);}}return 0x0;}async['listUnified'](_0x4f441b,_0x2d812c){const _0x34f4f9=a46_0x52f5ee,{options:_0x41266f,tdx:_0x1507c5}=_0x4f441b,_0x588903=await withSpinner(_0x34f4f9(0x118)+_0x2d812c+'\x27...',()=>_0x1507c5['segment'][_0x34f4f9(0x159)](_0x2d812c),{'verbose':_0x41266f[_0x34f4f9(0x14a)]}),_0x1b6c73=_0x588903[_0x34f4f9(0x14f)];_0x41266f[_0x34f4f9(0x14a)]&&(console[_0x34f4f9(0x153)](_0x34f4f9(0x158)+_0x1b6c73[_0x34f4f9(0x121)]),_0x1b6c73[_0x34f4f9(0x163)]&&console[_0x34f4f9(0x153)](_0x34f4f9(0x136)+_0x1b6c73[_0x34f4f9(0x163)]));const _0x7b97b4=await withSpinner(_0x34f4f9(0x143),()=>_0x1507c5['segment']['listUnifiedWithJourneys'](_0x1b6c73[_0x34f4f9(0x121)],_0x1b6c73[_0x34f4f9(0x163)]),{'verbose':_0x41266f['verbose']}),{folders:_0x4d3fb4,segments:_0x2e1952,journeys:_0x1fcd50}=_0x7b97b4['data'],_0x295387=_0x4d3fb4['length']+_0x2e1952[_0x34f4f9(0x146)]+_0x1fcd50[_0x34f4f9(0x146)];console[_0x34f4f9(0x153)](_0x34f4f9(0x137)+_0x4d3fb4[_0x34f4f9(0x146)]+_0x34f4f9(0x132)+(_0x4d3fb4[_0x34f4f9(0x146)]!==0x1?'s':'')+',\x20'+_0x2e1952['length']+_0x34f4f9(0x12e)+(_0x2e1952[_0x34f4f9(0x146)]!==0x1?'s':'')+',\x20and\x20'+_0x1fcd50['length']+_0x34f4f9(0x166)+(_0x1fcd50[_0x34f4f9(0x146)]!==0x1?'s':''));const _0x3810cd=_0x1a80e1=>{const _0x2e5240=_0x34f4f9;return getConsoleNextUrl(_0x41266f[_0x2e5240(0x157)],_0x2e5240(0x123)+_0x1b6c73['parentId']+'/e/'+_0x1a80e1);},_0x272b6f=_0x3d48d3=>{const _0x4fd096=_0x34f4f9;return getConsoleNextUrl(_0x41266f[_0x4fd096(0x157)],_0x4fd096(0x123)+_0x1b6c73[_0x4fd096(0x121)]+_0x4fd096(0x13a)+_0x3d48d3+'/j/da');},_0x1daeed=_0x41266f[_0x34f4f9(0x13c)]===_0x34f4f9(0x15a)||_0x41266f['format']===_0x34f4f9(0x11e);if(_0x1daeed){const _0x18ad5b=[..._0x4d3fb4[_0x34f4f9(0x13e)](_0x380b42=>({..._0x380b42,'type':_0x34f4f9(0x161)})),..._0x2e1952[_0x34f4f9(0x13e)](_0x10d405=>({..._0x10d405,'type':_0x34f4f9(0x133),'url':_0x3810cd(_0x10d405['id'])})),..._0x1fcd50[_0x34f4f9(0x13e)](_0x43f6ec=>({..._0x43f6ec,'name':_0x43f6ec[_0x34f4f9(0x156)],'type':'journey','url':_0x272b6f(_0x43f6ec['id'])}))][_0x34f4f9(0x15c)]((_0x19a1c2,_0x24a437)=>_0x19a1c2['name'][_0x34f4f9(0x116)](_0x24a437[_0x34f4f9(0x130)]));await handleSDKOutput(_0x18ad5b,_0x41266f);}else{if(_0x295387===0x0)console[_0x34f4f9(0x11b)](a46_0x1ad9db['dim']('['+_0x2d812c+']')),console[_0x34f4f9(0x11b)]('(empty)');else{console[_0x34f4f9(0x11b)](a46_0x1ad9db[_0x34f4f9(0x160)]('['+_0x2d812c+']'));const _0x195993=formatFlatList(_0x4d3fb4,_0x2e1952,{'showMetadata':!![],'getSegmentUrl':_0x3810cd,'getJourneyUrl':_0x272b6f},_0x1fcd50);console[_0x34f4f9(0x11b)](_0x195993);}}return 0x0;}async[a46_0x52f5ee(0x144)](_0x37c12b,_0x22652b){const _0xa74c9c=a46_0x52f5ee,{options:_0x5bd214,tdx:_0x2877cd}=_0x37c12b,_0x1e9253=await withSpinner(_0xa74c9c(0x118)+_0x22652b+'\x27...',()=>_0x2877cd[_0xa74c9c(0x133)][_0xa74c9c(0x159)](_0x22652b),{'verbose':_0x5bd214[_0xa74c9c(0x14a)]}),_0x3449ce=_0x1e9253[_0xa74c9c(0x14f)];_0x5bd214[_0xa74c9c(0x14a)]&&(console['error'](_0xa74c9c(0x158)+_0x3449ce[_0xa74c9c(0x121)]),_0x3449ce[_0xa74c9c(0x163)]&&console[_0xa74c9c(0x153)](_0xa74c9c(0x136)+_0x3449ce[_0xa74c9c(0x163)]));const _0x4edf17=_0x5bd214['maxDepth']||0xa,_0x5515cb=await withSpinner(_0xa74c9c(0x11c),()=>_0x2877cd[_0xa74c9c(0x133)][_0xa74c9c(0x144)](_0x3449ce[_0xa74c9c(0x121)],_0x3449ce[_0xa74c9c(0x163)],0x0,_0x4edf17),{'verbose':_0x5bd214[_0xa74c9c(0x14a)]}),_0x31bcf3=_0x5515cb[_0xa74c9c(0x14f)],_0x43f504=_0x185955=>{const _0x5a9e3f=_0xa74c9c;let _0x40b0b4=0x0,_0x174d26=0x0,_0x3149c0=0x0;for(const _0x4bc138 of _0x185955){if(_0x4bc138[_0x5a9e3f(0x155)]===_0x5a9e3f(0x161))_0x40b0b4++;else{if(_0x4bc138[_0x5a9e3f(0x155)]===_0x5a9e3f(0x133))_0x174d26++;else{if(_0x4bc138[_0x5a9e3f(0x155)]===_0x5a9e3f(0x126))_0x3149c0++;}}if(_0x4bc138['children']){const _0x4f9765=_0x43f504(_0x4bc138['children']);_0x40b0b4+=_0x4f9765[_0x5a9e3f(0x119)],_0x174d26+=_0x4f9765[_0x5a9e3f(0x15e)],_0x3149c0+=_0x4f9765[_0x5a9e3f(0x122)];}}return{'folders':_0x40b0b4,'segments':_0x174d26,'journeys':_0x3149c0};},_0x4719fe=_0x43f504(_0x31bcf3);console[_0xa74c9c(0x153)](_0xa74c9c(0x15b)+_0x4719fe['folders']+_0xa74c9c(0x132)+(_0x4719fe[_0xa74c9c(0x119)]!==0x1?'s':'')+',\x20'+_0x4719fe[_0xa74c9c(0x15e)]+_0xa74c9c(0x12e)+(_0x4719fe['segments']!==0x1?'s':'')+',\x20and\x20'+_0x4719fe[_0xa74c9c(0x122)]+_0xa74c9c(0x166)+(_0x4719fe['journeys']!==0x1?'s':''));const _0x40ab91=_0x1d6908=>{const _0x8aba41=_0xa74c9c;return getConsoleNextUrl(_0x5bd214[_0x8aba41(0x157)],_0x8aba41(0x123)+_0x3449ce['parentId']+_0x8aba41(0x13a)+_0x1d6908);},_0x2325ee=_0xf513e1=>{const _0x5f0fdc=_0xa74c9c;return getConsoleNextUrl(_0x5bd214[_0x5f0fdc(0x157)],_0x5f0fdc(0x123)+_0x3449ce['parentId']+_0x5f0fdc(0x13a)+_0xf513e1+_0x5f0fdc(0x168));};if(_0x5bd214[_0xa74c9c(0x13c)]===_0xa74c9c(0x15a)||_0x5bd214[_0xa74c9c(0x13c)]===_0xa74c9c(0x11e))await handleSDKOutput(_0x31bcf3,_0x5bd214);else{console[_0xa74c9c(0x11b)](a46_0x1ad9db[_0xa74c9c(0x160)]('['+_0x22652b+']'));const _0x5ea156=formatTree(_0x31bcf3,{'showMetadata':!![],'getSegmentUrl':_0x40ab91,'getJourneyUrl':_0x2325ee});console['log'](_0x5ea156);}return 0x0;}}
1
+ const a46_0x823a47=a46_0x33fa;(function(_0x4690d4,_0x2ffab1){const _0xf7eb12=a46_0x33fa,_0x43c560=_0x4690d4();while(!![]){try{const _0x1031b2=-parseInt(_0xf7eb12(0x178))/0x1+-parseInt(_0xf7eb12(0x176))/0x2+parseInt(_0xf7eb12(0x162))/0x3+-parseInt(_0xf7eb12(0x13c))/0x4*(parseInt(_0xf7eb12(0x160))/0x5)+parseInt(_0xf7eb12(0x168))/0x6*(-parseInt(_0xf7eb12(0x180))/0x7)+-parseInt(_0xf7eb12(0x17c))/0x8*(parseInt(_0xf7eb12(0x151))/0x9)+parseInt(_0xf7eb12(0x15f))/0xa;if(_0x1031b2===_0x2ffab1)break;else _0x43c560['push'](_0x43c560['shift']());}catch(_0x5e4fd7){_0x43c560['push'](_0x43c560['shift']());}}}(a46_0x58b9,0x3295b));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 a46_0x39fe00 from'chalk';function a46_0x58b9(){const _0x1871fb=['List\x20folders\x20and\x20child\x20segments','localeCompare','\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22','parentId','length','children','journeys','filter','listRecursive','jsonl','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','\x27...','/j/da','✔\x20Built\x20tree\x20with\x20','type','maxDepth','sort','Parent\x20segment\x20context:\x20','...','/app/ps/','1420864vIerKc','Listing\x20folders,\x20segments,\x20and\x20journeys...',']\x20matching\x20\x27','Error:\x20','replace','log','padEnd','name','\x5c$&','cause','Folder/pattern\x20arg:\x20','\x20matching\x20\x27','listWithPattern','journeyBundleName','verbose','Resolving\x20parent\x20segment\x20\x27','map','segments','Searching\x20the\x20tree\x20for\x20names\x20matching\x20','Set\x20a\x20parent\x20segment\x20context\x20first:','Site:\x20','252hhEroW','journey','(not\x20set)','folders','format','dim','parentSegment','(id\x20','listUnifiedWithJourneys','Found\x20','path','\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.','folderId','size','13556120FNqoXP','5sPAaXz','includes','517746assfZP','No\x20items\x20match\x20pattern:\x20','toLowerCase','\x20folder','message','description','42CzBhGm',',\x20and\x20','error','execute','site','folder','resolvePathToResource','searchByName','Folder\x20ID:\x20','json','test','/e/','\x20journey','\x20segment','770568tbueQg','segment','212992GMmPxg','\x20match','✔\x20Found\x20','Error:\x20No\x20parent\x20segment\x20context\x20set.','32624RmXUbR','listUnified','data','No\x20folders\x20or\x20segments\x20match\x20','253323oHegMM'];a46_0x58b9=function(){return _0x1871fb;};return a46_0x58b9();}function a46_0x33fa(_0x4f2f7b,_0x3e9015){_0x4f2f7b=_0x4f2f7b-0x139;const _0x58b98b=a46_0x58b9();let _0x33fa13=_0x58b98b[_0x4f2f7b];return _0x33fa13;}export class SegmentsCommand extends BaseCommand{['name']=a46_0x823a47(0x14d);[a46_0x823a47(0x167)]=a46_0x823a47(0x181);async[a46_0x823a47(0x16b)](_0x555e44){const _0x2e0a18=a46_0x823a47,{options:_0x15a0ad,args:_0x3e2e25}=_0x555e44,_0x18ac9a=_0x15a0ad['recursive'],_0x1ba2ae=_0x3e2e25[0x0];try{const _0x43baf8=_0x15a0ad[_0x2e0a18(0x157)];_0x15a0ad[_0x2e0a18(0x14a)]&&(console[_0x2e0a18(0x16a)](_0x2e0a18(0x150)+_0x15a0ad[_0x2e0a18(0x16c)]),console['error'](_0x2e0a18(0x139)+(_0x43baf8||_0x2e0a18(0x153))),_0x1ba2ae&&console[_0x2e0a18(0x16a)](_0x2e0a18(0x146)+_0x1ba2ae),_0x18ac9a&&console[_0x2e0a18(0x16a)]('Recursive\x20mode:\x20enabled'));if(!_0x43baf8)return console[_0x2e0a18(0x16a)](_0x2e0a18(0x17b)),console[_0x2e0a18(0x16a)](''),console['error'](_0x2e0a18(0x14f)),console[_0x2e0a18(0x16a)]('\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22'),console['error'](_0x2e0a18(0x183)),console[_0x2e0a18(0x16a)](''),console[_0x2e0a18(0x16a)](_0x2e0a18(0x18b)),0x1;if(_0x1ba2ae&&_0x18ac9a)return await this[_0x2e0a18(0x16f)](_0x555e44,_0x43baf8,_0x1ba2ae);const _0x2edaee=_0x1ba2ae&&(_0x1ba2ae[_0x2e0a18(0x161)]('*')||_0x1ba2ae[_0x2e0a18(0x161)]('?'));if(_0x2edaee)return await this[_0x2e0a18(0x148)](_0x555e44,_0x43baf8,_0x1ba2ae);const _0x1ffad7=_0x1ba2ae?_0x43baf8+'/'+_0x1ba2ae:_0x43baf8;return _0x18ac9a?await this['listRecursive'](_0x555e44,_0x1ffad7):await this[_0x2e0a18(0x17d)](_0x555e44,_0x1ffad7);}catch(_0x2d79e7){if(_0x2d79e7 instanceof SDKError)return console[_0x2e0a18(0x16a)](_0x2e0a18(0x13f)+_0x2d79e7[_0x2e0a18(0x166)]),_0x2d79e7[_0x2e0a18(0x145)]&&console[_0x2e0a18(0x16a)]('\x20\x20Cause:\x20'+_0x2d79e7[_0x2e0a18(0x145)]),0x1;throw _0x2d79e7;}}async[a46_0x823a47(0x16f)](_0x1585fb,_0x174175,_0x28adde){const _0xc40cf3=a46_0x823a47,{options:_0x13784e,tdx:_0xcf467f}=_0x1585fb,_0x5eae09='\x22'+_0x28adde+'\x22',_0x17b38e=await withSpinner('Resolving\x20path\x20\x27'+_0x174175+'\x27...',()=>_0xcf467f[_0xc40cf3(0x177)][_0xc40cf3(0x16e)](_0x174175),{'verbose':_0x13784e[_0xc40cf3(0x14a)]}),_0x523f9b=_0x17b38e[_0xc40cf3(0x17e)],_0x2a355c=_0x13784e[_0xc40cf3(0x190)]||0xa,_0x179ae5=await withSpinner(_0xc40cf3(0x14e)+_0x5eae09+_0xc40cf3(0x13a),()=>_0xcf467f[_0xc40cf3(0x177)]['listRecursive'](_0x523f9b[_0xc40cf3(0x184)],_0x523f9b[_0xc40cf3(0x15d)],0x0,_0x2a355c),{'verbose':_0x13784e[_0xc40cf3(0x14a)]}),_0x2702ce=searchTreeByName(_0x179ae5[_0xc40cf3(0x17e)],_0x28adde),_0x1ab100=_0x26b2a0=>getConsoleNextUrl(_0x13784e[_0xc40cf3(0x16c)],'/app/ps/'+_0x523f9b[_0xc40cf3(0x184)]+_0xc40cf3(0x173)+_0x26b2a0),_0x5cb5bd=[..._0x2702ce]['sort']((_0x2481ee,_0x1d9d82)=>_0x2481ee[_0xc40cf3(0x15b)][_0xc40cf3(0x182)](_0x1d9d82[_0xc40cf3(0x15b)])),_0x5b681e=0x32,_0x4df880=_0xc40cf3(0x15a)+_0x2702ce[_0xc40cf3(0x185)]+_0xc40cf3(0x179)+(_0x2702ce[_0xc40cf3(0x185)]!==0x1?'es':'');console[_0xc40cf3(0x16a)](_0x2702ce[_0xc40cf3(0x185)]>_0x5b681e?'✔\x20'+_0x4df880+_0xc40cf3(0x15c):'✔\x20'+_0x4df880);if(_0x13784e[_0xc40cf3(0x155)]===_0xc40cf3(0x171)||_0x13784e[_0xc40cf3(0x155)]===_0xc40cf3(0x18a)){const _0x1b158d=_0x5cb5bd[_0xc40cf3(0x14c)](_0xc4ff86=>({..._0xc4ff86,..._0xc4ff86['type']===_0xc40cf3(0x177)?{'url':_0x1ab100(_0xc4ff86['id'])}:{}}));return await handleSDKOutput(_0x1b158d,_0x13784e),0x0;}if(_0x2702ce[_0xc40cf3(0x185)]===0x0)return console[_0xc40cf3(0x141)](_0xc40cf3(0x17f)+_0x5eae09),0x0;for(const _0x31d811 of _0x5cb5bd){console['log'](_0x31d811[_0xc40cf3(0x18f)][_0xc40cf3(0x142)](0x8)+'\x20'+_0x31d811[_0xc40cf3(0x15b)]+'\x20\x20'+a46_0x39fe00[_0xc40cf3(0x156)](_0xc40cf3(0x158)+_0x31d811['id']+')'));}const _0xf0e9cc=_0x2702ce[_0xc40cf3(0x188)](_0x5408a1=>_0x5408a1[_0xc40cf3(0x18f)]===_0xc40cf3(0x177)),_0x599ce6=new Set(_0xf0e9cc[_0xc40cf3(0x14c)](_0xd04cd8=>_0xd04cd8['name'][_0xc40cf3(0x164)]()))[_0xc40cf3(0x15e)]===0x1;return _0xf0e9cc[_0xc40cf3(0x185)]>0x1&&_0x599ce6&&console[_0xc40cf3(0x141)](a46_0x39fe00[_0xc40cf3(0x156)]('\x0a'+_0xf0e9cc[_0xc40cf3(0x185)]+'\x20segments\x20share\x20this\x20name\x20—\x20pass\x20the\x20full\x20path\x20(or\x20id)\x20to\x20`tdx\x20sg\x20move`;\x20do\x20not\x20assume\x20the\x20first.')),0x0;}async[a46_0x823a47(0x148)](_0x6a58c,_0xeb9c03,_0x2a67ff){const _0x4c848a=a46_0x823a47,{options:_0x5d3fe0,tdx:_0x23f490}=_0x6a58c,_0x1b045c=await withSpinner(_0x4c848a(0x14b)+_0xeb9c03+_0x4c848a(0x18c),()=>_0x23f490[_0x4c848a(0x177)][_0x4c848a(0x16e)](_0xeb9c03),{'verbose':_0x5d3fe0[_0x4c848a(0x14a)]}),_0x30dded=_0x1b045c[_0x4c848a(0x17e)],_0x8807b0=await withSpinner(_0x4c848a(0x13d),()=>_0x23f490[_0x4c848a(0x177)][_0x4c848a(0x159)](_0x30dded[_0x4c848a(0x184)],_0x30dded['folderId']),{'verbose':_0x5d3fe0[_0x4c848a(0x14a)]}),{folders:_0x6ccc08,segments:_0x427e69,journeys:_0x4928f0}=_0x8807b0[_0x4c848a(0x17e)],_0x6c422b=_0x2a67ff[_0x4c848a(0x140)](/[.+^${}()|[\]\\]/g,_0x4c848a(0x144))['replace'](/\*/g,'.*')[_0x4c848a(0x140)](/\?/g,'.'),_0x3279eb=new RegExp('^'+_0x6c422b+'$','i'),_0x405cec=_0x6ccc08[_0x4c848a(0x188)](_0x1bd619=>_0x3279eb[_0x4c848a(0x172)](_0x1bd619[_0x4c848a(0x143)])),_0x16eb96=_0x427e69['filter'](_0x5eb8ef=>_0x3279eb[_0x4c848a(0x172)](_0x5eb8ef[_0x4c848a(0x143)])),_0xf3eee9=_0x4928f0[_0x4c848a(0x188)](_0x3dd953=>_0x3279eb[_0x4c848a(0x172)](_0x3dd953[_0x4c848a(0x149)])),_0xb04b=_0x405cec[_0x4c848a(0x185)]+_0x16eb96['length']+_0xf3eee9[_0x4c848a(0x185)];console[_0x4c848a(0x16a)](_0x4c848a(0x17a)+_0x405cec['length']+_0x4c848a(0x165)+(_0x405cec[_0x4c848a(0x185)]!==0x1?'s':'')+',\x20'+_0x16eb96['length']+_0x4c848a(0x175)+(_0x16eb96[_0x4c848a(0x185)]!==0x1?'s':'')+_0x4c848a(0x169)+_0xf3eee9[_0x4c848a(0x185)]+_0x4c848a(0x174)+(_0xf3eee9[_0x4c848a(0x185)]!==0x1?'s':'')+_0x4c848a(0x147)+_0x2a67ff+'\x27');const _0x28a721=_0x4d95a7=>{const _0x127fe6=_0x4c848a;return getConsoleNextUrl(_0x5d3fe0[_0x127fe6(0x16c)],'/app/ps/'+_0x30dded['parentId']+'/e/'+_0x4d95a7);},_0x5a6cd6=_0x5d3fe0[_0x4c848a(0x155)]==='json'||_0x5d3fe0[_0x4c848a(0x155)]==='jsonl';if(_0x5a6cd6){const _0x2177d3=[..._0x405cec[_0x4c848a(0x14c)](_0x351e94=>({..._0x351e94,'type':'folder'})),..._0x16eb96[_0x4c848a(0x14c)](_0x1f8112=>({..._0x1f8112,'type':'segment','url':_0x28a721(_0x1f8112['id'])})),..._0xf3eee9[_0x4c848a(0x14c)](_0x4670a3=>({..._0x4670a3,'name':_0x4670a3['journeyBundleName'],'type':'journey'}))][_0x4c848a(0x191)]((_0x21d510,_0xdc2ac3)=>_0x21d510[_0x4c848a(0x143)][_0x4c848a(0x182)](_0xdc2ac3['name']));await handleSDKOutput(_0x2177d3,_0x5d3fe0);}else{if(_0xb04b===0x0)console[_0x4c848a(0x141)](_0x4c848a(0x163)+_0x2a67ff);else{console[_0x4c848a(0x141)](a46_0x39fe00[_0x4c848a(0x156)]('['+_0xeb9c03+_0x4c848a(0x13e)+_0x2a67ff+'\x27'));const _0x5f457f=formatFlatList(_0x405cec,_0x16eb96,{'showMetadata':!![],'getSegmentUrl':_0x28a721},_0xf3eee9);console[_0x4c848a(0x141)](_0x5f457f);}}return 0x0;}async['listUnified'](_0xd5e940,_0x39662a){const _0x20974d=a46_0x823a47,{options:_0x8050c7,tdx:_0x281f24}=_0xd5e940,_0x5be64e=await withSpinner('Resolving\x20path\x20\x27'+_0x39662a+_0x20974d(0x18c),()=>_0x281f24[_0x20974d(0x177)][_0x20974d(0x16e)](_0x39662a),{'verbose':_0x8050c7['verbose']}),_0x231e6b=_0x5be64e[_0x20974d(0x17e)];_0x8050c7[_0x20974d(0x14a)]&&(console['error']('Parent\x20ID:\x20'+_0x231e6b[_0x20974d(0x184)]),_0x231e6b[_0x20974d(0x15d)]&&console[_0x20974d(0x16a)](_0x20974d(0x170)+_0x231e6b[_0x20974d(0x15d)]));const _0x611aee=await withSpinner(_0x20974d(0x13d),()=>_0x281f24[_0x20974d(0x177)][_0x20974d(0x159)](_0x231e6b[_0x20974d(0x184)],_0x231e6b['folderId']),{'verbose':_0x8050c7['verbose']}),{folders:_0x470e54,segments:_0x584e28,journeys:_0x1b1951}=_0x611aee['data'],_0x54679e=_0x470e54[_0x20974d(0x185)]+_0x584e28[_0x20974d(0x185)]+_0x1b1951[_0x20974d(0x185)];console[_0x20974d(0x16a)](_0x20974d(0x17a)+_0x470e54[_0x20974d(0x185)]+'\x20folder'+(_0x470e54[_0x20974d(0x185)]!==0x1?'s':'')+',\x20'+_0x584e28[_0x20974d(0x185)]+_0x20974d(0x175)+(_0x584e28[_0x20974d(0x185)]!==0x1?'s':'')+_0x20974d(0x169)+_0x1b1951[_0x20974d(0x185)]+'\x20journey'+(_0x1b1951[_0x20974d(0x185)]!==0x1?'s':''));const _0x2f08e2=_0x3ccaca=>{const _0x5b3331=_0x20974d;return getConsoleNextUrl(_0x8050c7['site'],_0x5b3331(0x13b)+_0x231e6b[_0x5b3331(0x184)]+'/e/'+_0x3ccaca);},_0x10ac36=_0x3c4f10=>{const _0x2222f0=_0x20974d;return getConsoleNextUrl(_0x8050c7[_0x2222f0(0x16c)],'/app/ps/'+_0x231e6b[_0x2222f0(0x184)]+'/e/'+_0x3c4f10+'/j/da');},_0x6ae3d5=_0x8050c7[_0x20974d(0x155)]===_0x20974d(0x171)||_0x8050c7[_0x20974d(0x155)]==='jsonl';if(_0x6ae3d5){const _0x1d1c62=[..._0x470e54[_0x20974d(0x14c)](_0x5f0088=>({..._0x5f0088,'type':_0x20974d(0x16d)})),..._0x584e28[_0x20974d(0x14c)](_0xb5646d=>({..._0xb5646d,'type':_0x20974d(0x177),'url':_0x2f08e2(_0xb5646d['id'])})),..._0x1b1951['map'](_0x309bfb=>({..._0x309bfb,'name':_0x309bfb[_0x20974d(0x149)],'type':_0x20974d(0x152),'url':_0x10ac36(_0x309bfb['id'])}))][_0x20974d(0x191)]((_0x47eb30,_0x2fa4f5)=>_0x47eb30[_0x20974d(0x143)][_0x20974d(0x182)](_0x2fa4f5[_0x20974d(0x143)]));await handleSDKOutput(_0x1d1c62,_0x8050c7);}else{if(_0x54679e===0x0)console['log'](a46_0x39fe00[_0x20974d(0x156)]('['+_0x39662a+']')),console[_0x20974d(0x141)]('(empty)');else{console[_0x20974d(0x141)](a46_0x39fe00[_0x20974d(0x156)]('['+_0x39662a+']'));const _0x2caae4=formatFlatList(_0x470e54,_0x584e28,{'showMetadata':!![],'getSegmentUrl':_0x2f08e2,'getJourneyUrl':_0x10ac36},_0x1b1951);console[_0x20974d(0x141)](_0x2caae4);}}return 0x0;}async[a46_0x823a47(0x189)](_0x41a3dc,_0x5a9ab8){const _0x190b80=a46_0x823a47,{options:_0x38f192,tdx:_0x282cdd}=_0x41a3dc,_0x486303=await withSpinner('Resolving\x20path\x20\x27'+_0x5a9ab8+_0x190b80(0x18c),()=>_0x282cdd[_0x190b80(0x177)][_0x190b80(0x16e)](_0x5a9ab8),{'verbose':_0x38f192['verbose']}),_0x191be8=_0x486303[_0x190b80(0x17e)];_0x38f192[_0x190b80(0x14a)]&&(console['error']('Parent\x20ID:\x20'+_0x191be8[_0x190b80(0x184)]),_0x191be8[_0x190b80(0x15d)]&&console[_0x190b80(0x16a)](_0x190b80(0x170)+_0x191be8['folderId']));const _0x2c29c4=_0x38f192['maxDepth']||0xa,_0x5a4668=await withSpinner('Building\x20hierarchy\x20tree...',()=>_0x282cdd[_0x190b80(0x177)][_0x190b80(0x189)](_0x191be8['parentId'],_0x191be8[_0x190b80(0x15d)],0x0,_0x2c29c4),{'verbose':_0x38f192['verbose']}),_0x1a4a0a=_0x5a4668[_0x190b80(0x17e)],_0x293f4e=_0x3cef88=>{const _0x15c3bc=_0x190b80;let _0x54db2e=0x0,_0x378037=0x0,_0x1a9a9e=0x0;for(const _0x25d2de of _0x3cef88){if(_0x25d2de[_0x15c3bc(0x18f)]===_0x15c3bc(0x16d))_0x54db2e++;else{if(_0x25d2de['type']===_0x15c3bc(0x177))_0x378037++;else{if(_0x25d2de[_0x15c3bc(0x18f)]===_0x15c3bc(0x152))_0x1a9a9e++;}}if(_0x25d2de['children']){const _0x131c88=_0x293f4e(_0x25d2de[_0x15c3bc(0x186)]);_0x54db2e+=_0x131c88[_0x15c3bc(0x154)],_0x378037+=_0x131c88[_0x15c3bc(0x14d)],_0x1a9a9e+=_0x131c88[_0x15c3bc(0x187)];}}return{'folders':_0x54db2e,'segments':_0x378037,'journeys':_0x1a9a9e};},_0x313ed2=_0x293f4e(_0x1a4a0a);console['error'](_0x190b80(0x18e)+_0x313ed2[_0x190b80(0x154)]+_0x190b80(0x165)+(_0x313ed2[_0x190b80(0x154)]!==0x1?'s':'')+',\x20'+_0x313ed2[_0x190b80(0x14d)]+_0x190b80(0x175)+(_0x313ed2[_0x190b80(0x14d)]!==0x1?'s':'')+_0x190b80(0x169)+_0x313ed2['journeys']+'\x20journey'+(_0x313ed2[_0x190b80(0x187)]!==0x1?'s':''));const _0x332803=_0x28e3d2=>{const _0x32e44c=_0x190b80;return getConsoleNextUrl(_0x38f192[_0x32e44c(0x16c)],'/app/ps/'+_0x191be8[_0x32e44c(0x184)]+_0x32e44c(0x173)+_0x28e3d2);},_0x4eeb79=_0x565b43=>{const _0x90b2c0=_0x190b80;return getConsoleNextUrl(_0x38f192[_0x90b2c0(0x16c)],_0x90b2c0(0x13b)+_0x191be8[_0x90b2c0(0x184)]+_0x90b2c0(0x173)+_0x565b43+_0x90b2c0(0x18d));};if(_0x38f192[_0x190b80(0x155)]===_0x190b80(0x171)||_0x38f192[_0x190b80(0x155)]===_0x190b80(0x18a))await handleSDKOutput(_0x1a4a0a,_0x38f192);else{console['log'](a46_0x39fe00[_0x190b80(0x156)]('['+_0x5a9ab8+']'));const _0x554c1f=formatTree(_0x1a4a0a,{'showMetadata':!![],'getSegmentUrl':_0x332803,'getJourneyUrl':_0x4eeb79});console[_0x190b80(0x141)](_0x554c1f);}return 0x0;}}