@treasuredata/tdx 2026.9.3 → 2026.10.0

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 (311) 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/ai-usage-command-base.js +1 -1
  11. package/dist/commands/api-command.js +1 -1
  12. package/dist/commands/auth-command.d.ts.map +1 -1
  13. package/dist/commands/auth-command.js +1 -1
  14. package/dist/commands/auth-command.js.map +1 -1
  15. package/dist/commands/cas-command.js +1 -1
  16. package/dist/commands/cas-journey-command.d.ts +34 -0
  17. package/dist/commands/cas-journey-command.d.ts.map +1 -0
  18. package/dist/commands/cas-journey-command.js +1 -0
  19. package/dist/commands/cas-journey-command.js.map +1 -0
  20. package/dist/commands/cas-segment-command.js +1 -1
  21. package/dist/commands/chat-command.js +1 -1
  22. package/dist/commands/claude-command.d.ts.map +1 -1
  23. package/dist/commands/claude-command.js +1 -1
  24. package/dist/commands/claude-command.js.map +1 -1
  25. package/dist/commands/claude-statusline-command.js +1 -1
  26. package/dist/commands/claude-usage-command.js +1 -1
  27. package/dist/commands/codex-command.d.ts.map +1 -1
  28. package/dist/commands/codex-command.js +1 -1
  29. package/dist/commands/codex-command.js.map +1 -1
  30. package/dist/commands/command.js +1 -1
  31. package/dist/commands/connection-command.js +1 -1
  32. package/dist/commands/databases.js +1 -1
  33. package/dist/commands/delivery-command.js +1 -1
  34. package/dist/commands/describe.js +1 -1
  35. package/dist/commands/engage-always-on-campaign-pull-command.js +1 -1
  36. package/dist/commands/engage-always-on-campaign-push-command.js +1 -1
  37. package/dist/commands/engage-always-on-campaign-validate-command.js +1 -1
  38. package/dist/commands/engage-campaign-pull-command.js +1 -1
  39. package/dist/commands/engage-campaign-push-command.js +1 -1
  40. package/dist/commands/engage-campaign-readiness-command.js +1 -1
  41. package/dist/commands/engage-campaign-validate-command.js +1 -1
  42. package/dist/commands/engage-command.js +1 -1
  43. package/dist/commands/engage-in-browser-message-command.js +1 -1
  44. package/dist/commands/engage-landing-page-command.js +1 -1
  45. package/dist/commands/engage-template-pull-command.js +1 -1
  46. package/dist/commands/engage-template-push-command.js +1 -1
  47. package/dist/commands/engage-template-validate-command.js +1 -1
  48. package/dist/commands/engage-workspace-assignment-command.js +1 -1
  49. package/dist/commands/job-command.js +1 -1
  50. package/dist/commands/journey-command.d.ts +46 -0
  51. package/dist/commands/journey-command.d.ts.map +1 -1
  52. package/dist/commands/journey-command.js +1 -1
  53. package/dist/commands/journey-command.js.map +1 -1
  54. package/dist/commands/journey-validate-command.js +1 -1
  55. package/dist/commands/llm-command.js +1 -1
  56. package/dist/commands/mcp-command.js +1 -1
  57. package/dist/commands/opencode-command.d.ts +25 -0
  58. package/dist/commands/opencode-command.d.ts.map +1 -1
  59. package/dist/commands/opencode-command.js +1 -1
  60. package/dist/commands/opencode-command.js.map +1 -1
  61. package/dist/commands/opencode-usage-command.js +1 -1
  62. package/dist/commands/p13n-command.js +1 -1
  63. package/dist/commands/parent-segment-command.js +1 -1
  64. package/dist/commands/policy-command.js +1 -1
  65. package/dist/commands/profile-command.js +1 -1
  66. package/dist/commands/profiles-command.js +1 -1
  67. package/dist/commands/query-command.js +1 -1
  68. package/dist/commands/schedule-command.js +1 -1
  69. package/dist/commands/segment-command.js +1 -1
  70. package/dist/commands/segment-create-command.js +1 -1
  71. package/dist/commands/segment-fields-command.js +1 -1
  72. package/dist/commands/segment-move-command.js +1 -1
  73. package/dist/commands/segment-pull-command.js +1 -1
  74. package/dist/commands/segment-push-command.js +1 -1
  75. package/dist/commands/segment-update-command.js +1 -1
  76. package/dist/commands/segment-use-command.js +1 -1
  77. package/dist/commands/segment-validate-command.js +1 -1
  78. package/dist/commands/segments.js +1 -1
  79. package/dist/commands/show.js +1 -1
  80. package/dist/commands/status-command.js +1 -1
  81. package/dist/commands/table-deleted.js +1 -1
  82. package/dist/commands/tables.js +1 -1
  83. package/dist/commands/unset-command.js +1 -1
  84. package/dist/commands/upgrade-command.js +1 -1
  85. package/dist/commands/use-command.js +1 -1
  86. package/dist/commands/user-command.js +1 -1
  87. package/dist/commands/work-command.js +1 -1
  88. package/dist/commands/workflow-command.js +1 -1
  89. package/dist/core/auth.d.ts +10 -1
  90. package/dist/core/auth.d.ts.map +1 -1
  91. package/dist/core/auth.js +1 -1
  92. package/dist/core/auth.js.map +1 -1
  93. package/dist/core/command-output.js +1 -1
  94. package/dist/core/config.js +1 -1
  95. package/dist/core/connection-cache.js +1 -1
  96. package/dist/core/constants.js +1 -1
  97. package/dist/core/credential-cache.js +1 -1
  98. package/dist/core/global-context.js +1 -1
  99. package/dist/core/keychain.js +1 -1
  100. package/dist/core/oauth-keychain.js +1 -1
  101. package/dist/core/oauth.js +1 -1
  102. package/dist/core/profile.js +1 -1
  103. package/dist/core/project-config.js +1 -1
  104. package/dist/core/session.js +1 -1
  105. package/dist/core/site-mismatch.js +1 -1
  106. package/dist/core/user-cache.js +1 -1
  107. package/dist/core/version.js +1 -1
  108. package/dist/index.js +1 -1
  109. package/dist/mcp/server.js +1 -1
  110. package/dist/mcp/tools/index.js +1 -1
  111. package/dist/mcp/tools/tdx-run.js +1 -1
  112. package/dist/mcp/tools/tdx-search.js +1 -1
  113. package/dist/mcp/tools/work-create-item.js +1 -1
  114. package/dist/mcp/utils.js +1 -1
  115. package/dist/proxy/claude-usage-tracker.js +1 -1
  116. package/dist/proxy/passthrough-server.d.ts +2 -0
  117. package/dist/proxy/passthrough-server.d.ts.map +1 -1
  118. package/dist/proxy/passthrough-server.js +1 -1
  119. package/dist/proxy/passthrough-server.js.map +1 -1
  120. package/dist/proxy/sse-usage-parser.js +1 -1
  121. package/dist/sdk/agent/agent-config.js +1 -1
  122. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  123. package/dist/sdk/agent/agent-yaml.js +1 -1
  124. package/dist/sdk/agent/test/evaluator.js +1 -1
  125. package/dist/sdk/agent/test/executor.js +1 -1
  126. package/dist/sdk/agent/test/index.js +1 -1
  127. package/dist/sdk/agent/test/output.js +1 -1
  128. package/dist/sdk/agent/test/parser.js +1 -1
  129. package/dist/sdk/agent/tool-target-registry.js +1 -1
  130. package/dist/sdk/api.js +1 -1
  131. package/dist/sdk/auth-token.js +1 -1
  132. package/dist/sdk/cas/audience-context.d.ts +33 -0
  133. package/dist/sdk/cas/audience-context.d.ts.map +1 -0
  134. package/dist/sdk/cas/audience-context.js +1 -0
  135. package/dist/sdk/cas/audience-context.js.map +1 -0
  136. package/dist/sdk/cas/cas-api-client.js +1 -1
  137. package/dist/sdk/cas/cas-audience-schema.js +1 -1
  138. package/dist/sdk/cas/cas-audience-validator.js +1 -1
  139. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  140. package/dist/sdk/cas/cas-segment-schema.js +1 -1
  141. package/dist/sdk/cas/cas-segment-validator.js +1 -1
  142. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  143. package/dist/sdk/cas/index.d.ts +8 -0
  144. package/dist/sdk/cas/index.d.ts.map +1 -1
  145. package/dist/sdk/cas/index.js +1 -1
  146. package/dist/sdk/cas/index.js.map +1 -1
  147. package/dist/sdk/cas/pull-workflow.js +1 -1
  148. package/dist/sdk/cas/push-workflow.js +1 -1
  149. package/dist/sdk/cas/validate-files.js +1 -1
  150. package/dist/sdk/client/cdp-api-client.js +1 -1
  151. package/dist/sdk/client/delivery-api-client.js +1 -1
  152. package/dist/sdk/client/endpoints.js +1 -1
  153. package/dist/sdk/client/engage-api-client.js +1 -1
  154. package/dist/sdk/client/http-client.js +1 -1
  155. package/dist/sdk/client/llm-api-client.js +1 -1
  156. package/dist/sdk/client/oauth-refresh.js +1 -1
  157. package/dist/sdk/client/p13n-studio-api-client.js +1 -1
  158. package/dist/sdk/client/rate-limiter.js +1 -1
  159. package/dist/sdk/client/td-api-client.js +1 -1
  160. package/dist/sdk/client/trino-api-client.js +1 -1
  161. package/dist/sdk/client/workflow-client.js +1 -1
  162. package/dist/sdk/connection-validator.js +1 -1
  163. package/dist/sdk/connection.js +1 -1
  164. package/dist/sdk/delivery.js +1 -1
  165. package/dist/sdk/engage/always-on-campaign-pull.js +1 -1
  166. package/dist/sdk/engage/always-on-campaign-push.js +1 -1
  167. package/dist/sdk/engage/always-on-campaign-validator.js +1 -1
  168. package/dist/sdk/engage/always-on-campaign-yaml.js +1 -1
  169. package/dist/sdk/engage/campaign-pull.js +1 -1
  170. package/dist/sdk/engage/campaign-push.js +1 -1
  171. package/dist/sdk/engage/campaign-readiness-workflow.js +1 -1
  172. package/dist/sdk/engage/campaign-readiness.js +1 -1
  173. package/dist/sdk/engage/campaign-validator.js +1 -1
  174. package/dist/sdk/engage/campaign-yaml.js +1 -1
  175. package/dist/sdk/engage/in-browser-message-pull.js +1 -1
  176. package/dist/sdk/engage/in-browser-message-push.js +1 -1
  177. package/dist/sdk/engage/in-browser-message-validator.js +1 -1
  178. package/dist/sdk/engage/in-browser-message-yaml.js +1 -1
  179. package/dist/sdk/engage/landing-page-init.js +1 -1
  180. package/dist/sdk/engage/landing-page-public-asset.js +1 -1
  181. package/dist/sdk/engage/landing-page-pull.js +1 -1
  182. package/dist/sdk/engage/landing-page-push.js +1 -1
  183. package/dist/sdk/engage/landing-page-static-site.js +1 -1
  184. package/dist/sdk/engage/landing-page-validator.js +1 -1
  185. package/dist/sdk/engage/landing-page-workspace.js +1 -1
  186. package/dist/sdk/engage/landing-page-yaml.js +1 -1
  187. package/dist/sdk/engage/list-campaign-schema.js +1 -1
  188. package/dist/sdk/engage/list-campaign-yaml.js +1 -1
  189. package/dist/sdk/engage/template-pull.js +1 -1
  190. package/dist/sdk/engage/template-push.js +1 -1
  191. package/dist/sdk/engage/template-validator.js +1 -1
  192. package/dist/sdk/engage/template-yaml.js +1 -1
  193. package/dist/sdk/engage/types/always-on-campaign-schema.js +1 -1
  194. package/dist/sdk/engage/types/campaign-def.js +1 -1
  195. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  196. package/dist/sdk/engage/types/in-browser-message-schema.js +1 -1
  197. package/dist/sdk/engage/types/landing-page-schema.js +1 -1
  198. package/dist/sdk/engage/types/template-schema.js +1 -1
  199. package/dist/sdk/engage/workspace-assignments.js +1 -1
  200. package/dist/sdk/engage.js +1 -1
  201. package/dist/sdk/errors.js +1 -1
  202. package/dist/sdk/index.js +1 -1
  203. package/dist/sdk/io/index.js +1 -1
  204. package/dist/sdk/io/node-filesystem.js +1 -1
  205. package/dist/sdk/job.js +1 -1
  206. package/dist/sdk/journey.d.ts +4 -1
  207. package/dist/sdk/journey.d.ts.map +1 -1
  208. package/dist/sdk/journey.js +1 -1
  209. package/dist/sdk/journey.js.map +1 -1
  210. package/dist/sdk/llm/chat-cache.js +1 -1
  211. package/dist/sdk/llm/index.js +1 -1
  212. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  213. package/dist/sdk/llm/model-factors.d.ts.map +1 -1
  214. package/dist/sdk/llm/model-factors.js +1 -1
  215. package/dist/sdk/llm/model-factors.js.map +1 -1
  216. package/dist/sdk/llm/user-settings.js +1 -1
  217. package/dist/sdk/p13n-studio-errors.js +1 -1
  218. package/dist/sdk/p13n-studio.js +1 -1
  219. package/dist/sdk/personalization.js +1 -1
  220. package/dist/sdk/policy.js +1 -1
  221. package/dist/sdk/query/deleted-table-validation.js +1 -1
  222. package/dist/sdk/query/index.js +1 -1
  223. package/dist/sdk/query/sql-parser.js +1 -1
  224. package/dist/sdk/realtime.js +1 -1
  225. package/dist/sdk/schedule.js +1 -1
  226. package/dist/sdk/segment/audience-context.js +1 -1
  227. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  228. package/dist/sdk/segment/fields-display.js +1 -1
  229. package/dist/sdk/segment/file-discovery.js +1 -1
  230. package/dist/sdk/segment/journey-utils.js +1 -1
  231. package/dist/sdk/segment/journey-validator.js +1 -1
  232. package/dist/sdk/segment/journey-yaml.js +1 -1
  233. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  234. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  235. package/dist/sdk/segment/pull-workflow.js +1 -1
  236. package/dist/sdk/segment/push-recovery.js +1 -1
  237. package/dist/sdk/segment/push-workflow.js +1 -1
  238. package/dist/sdk/segment/resolution-context.js +1 -1
  239. package/dist/sdk/segment/segment-path-parser.js +1 -1
  240. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  241. package/dist/sdk/segment/segment-validator.js +1 -1
  242. package/dist/sdk/segment/target-resolution.js +1 -1
  243. package/dist/sdk/segment/tdx-config.js +1 -1
  244. package/dist/sdk/segment/types/activation-schema.js +1 -1
  245. package/dist/sdk/segment/types/journey-def.js +1 -1
  246. package/dist/sdk/segment/types/journey-schema.js +1 -1
  247. package/dist/sdk/segment/types/segment-def.js +1 -1
  248. package/dist/sdk/segment/types/segment-schema.js +1 -1
  249. package/dist/sdk/segment/validate-files.js +1 -1
  250. package/dist/sdk/segment/yaml-validator.js +1 -1
  251. package/dist/sdk/segment.js +1 -1
  252. package/dist/sdk/types/index.js +1 -1
  253. package/dist/sdk/types/progress.js +1 -1
  254. package/dist/sdk/types/workspace.js +1 -1
  255. package/dist/sdk/user.js +1 -1
  256. package/dist/sdk/util/format-detector.js +1 -1
  257. package/dist/sdk/util/formatters.js +1 -1
  258. package/dist/sdk/util/index.js +1 -1
  259. package/dist/sdk/util/paginate.js +1 -1
  260. package/dist/sdk/util/tree-formatter.js +1 -1
  261. package/dist/sdk/util/tree-search.js +1 -1
  262. package/dist/sdk/workflow/archive-validation.js +1 -1
  263. package/dist/sdk/workflow/clone-workflow.js +1 -1
  264. package/dist/sdk/workflow/index.js +1 -1
  265. package/dist/sdk/workflow/pull-workflow.js +1 -1
  266. package/dist/sdk/workflow/push-workflow.js +1 -1
  267. package/dist/sdk/workflow/task-graph.js +1 -1
  268. package/dist/sdk/workflow/tdx-config.js +1 -1
  269. package/dist/sdk/workflow/workflow-utils.js +1 -1
  270. package/dist/sdk/workspace/access-tracker.js +1 -1
  271. package/dist/sdk/workspace/frontmatter.js +1 -1
  272. package/dist/sdk/workspace/git.js +1 -1
  273. package/dist/sdk/workspace/index.js +1 -1
  274. package/dist/sdk/workspace/templates.js +1 -1
  275. package/dist/sdk/workspace/weekly.js +1 -1
  276. package/dist/sdk/workspace/wikilinks.js +1 -1
  277. package/dist/test-utils/command-runner.js +1 -1
  278. package/dist/test-utils/factories.js +1 -1
  279. package/dist/test-utils/fixtures.js +1 -1
  280. package/dist/test-utils/http-mock.js +1 -1
  281. package/dist/test-utils/index.js +1 -1
  282. package/dist/utils/async.js +1 -1
  283. package/dist/utils/claude-code-state.js +1 -1
  284. package/dist/utils/colors.js +1 -1
  285. package/dist/utils/diff.js +1 -1
  286. package/dist/utils/file-permissions.js +1 -1
  287. package/dist/utils/file-reader.js +1 -1
  288. package/dist/utils/github-releases.js +1 -1
  289. package/dist/utils/global-cache.js +1 -1
  290. package/dist/utils/json-loader.js +1 -1
  291. package/dist/utils/local-cache.js +1 -1
  292. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  293. package/dist/utils/logger/formatters/index.js +1 -1
  294. package/dist/utils/logger/handlers/console-handler.js +1 -1
  295. package/dist/utils/logger/handlers/file-handler.js +1 -1
  296. package/dist/utils/logger/handlers/index.js +1 -1
  297. package/dist/utils/logger/handlers/null-handler.js +1 -1
  298. package/dist/utils/logger/index.js +1 -1
  299. package/dist/utils/logger/logger.js +1 -1
  300. package/dist/utils/logger/types.js +1 -1
  301. package/dist/utils/option-validation.js +1 -1
  302. package/dist/utils/process.js +1 -1
  303. package/dist/utils/prompt.js +1 -1
  304. package/dist/utils/proxy-fetch.js +1 -1
  305. package/dist/utils/spinner.js +1 -1
  306. package/dist/utils/sse-parser.js +1 -1
  307. package/dist/utils/string-utils.js +1 -1
  308. package/dist/utils/table-ref-parser.js +1 -1
  309. package/dist/utils/tdx-logger.js +1 -1
  310. package/dist/utils/version-check.js +1 -1
  311. package/package.json +2 -1
@@ -1 +1 @@
1
- const a52_0x1e1424=a52_0x254e;(function(_0xfcbb0,_0x6bed7a){const _0x36d5cc=a52_0x254e,_0x4cc64c=_0xfcbb0();while(!![]){try{const _0x2a4a18=-parseInt(_0x36d5cc(0xb7))/0x1+-parseInt(_0x36d5cc(0x86))/0x2+-parseInt(_0x36d5cc(0xc3))/0x3*(-parseInt(_0x36d5cc(0x8d))/0x4)+parseInt(_0x36d5cc(0xbc))/0x5*(parseInt(_0x36d5cc(0x88))/0x6)+parseInt(_0x36d5cc(0x9b))/0x7*(parseInt(_0x36d5cc(0x81))/0x8)+-parseInt(_0x36d5cc(0x8b))/0x9*(-parseInt(_0x36d5cc(0xc8))/0xa)+parseInt(_0x36d5cc(0xb4))/0xb*(-parseInt(_0x36d5cc(0xc5))/0xc);if(_0x2a4a18===_0x6bed7a)break;else _0x4cc64c['push'](_0x4cc64c['shift']());}catch(_0x311437){_0x4cc64c['push'](_0x4cc64c['shift']());}}}(a52_0x340b,0xc8078));function a52_0x254e(_0x410b54,_0x117bf0){_0x410b54=_0x410b54-0x7a;const _0x340b52=a52_0x340b();let _0x254e1c=_0x340b52[_0x410b54];return _0x254e1c;}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a52_0x340b(){const _0xf86e3a=['Set\x20context:\x20\x20\x20tdx\x20use\x20parent_segment\x20\x22<name>\x22','type','✔\x20Moved\x20segment\x20\x27','map','5GNHXlk','Checking','explainAmbiguousName','\x20\x20(id\x20','error','parentId','\x27,\x20\x27','213zNEyOL','segment','24VuMMsV','\x20condition','toLowerCase','12420580WDiyrM','verbose','\x20segments\x20—\x20refusing\x20to\x20guess.\x20Pass\x20the\x20full\x20path\x20(or\x20id)\x20of\x20the\x20one\x20you\x20mean:','code','some','Error:\x20\x27','filter','\x20\x20•\x20','\x20segment(s)\x20would\x20be\x20moved.','test','21848Elnkep','Searching\x20the\x20tree...','dryRun','data','cyan','904122yFGGxe','\x27\x20matches\x20','5516358xOSJTu','SEGMENT_NOT_FOUND','Usage:\x20tdx\x20segment\x20move\x20<segment...>\x20--folder\x20<folder>','9FnRrnD','Or\x20use\x20IDs:\x20\x20\x20\x20tdx\x20sg\x20list\x20-r\x20--json\x20\x20(then\x20pass\x20the\x20numeric\x20ids)','53500DjUyoH','Duplicate\x20segments\x20removed\x20(','\x27...','\x20folder\x20\x27','Target\x20folder:\x20','resolveEntitiesInParent','slot','push','[dry-run]\x20No\x20changes\x20made.\x20','execute','Error:\x20at\x20least\x20one\x20<segment>\x20and\x20--folder\x20<folder>\x20are\x20required\x0a','preserved:','for\x20move\x20to','forEach','1337LMurLb','\x20\x20tdx\x20segment\x20move\x201603887\x20--folder\x208299501','Searching\x20folders\x20for\x20\x27','green','\x20segments\x20moved,\x20all\x20rules\x20verified\x20intact','Examples:','path','\x27\x20—\x20','folderId','\x20\x20tdx\x20segment\x20move\x201603887\x201603888\x201603889\x20--folder\x208299501','Segments:\x20','join','ruleConditionCount','folder','length','rule\x20','•\x20[dry-run]\x20Would\x20move\x20segment\x20\x27','\x27\x20isn\x27t\x20at\x20the\x20top\x20level\x20—\x20it\x27s\x20nested\x20at:','red','Move\x20one\x20or\x20more\x20segments\x20to\x20a\x20different\x20folder','get','Or\x20pass\x20flag:\x20\x20--parent-segment\x20\x22<name>\x22','name','description','\x27\x20to\x20folder\x20\x27','8991763XIMkXx','set','Moving','726450nuMduS'];a52_0x340b=function(){return _0xf86e3a;};return a52_0x340b();}import{SDKError,ErrorCode}from'../sdk/index.js';import{searchTreeByName}from'../sdk/util/tree-search.js';import a52_0x4e9609 from'chalk';export class SegmentMoveCommand extends BaseCommand{[a52_0x1e1424(0xb1)]='segment:move';[a52_0x1e1424(0xb2)]=a52_0x1e1424(0xae);async[a52_0x1e1424(0x96)](_0xc4c70b){const _0x19b689=a52_0x1e1424,{options:_0x14df9e,args:_0x3a9070,tdx:_0x23175e}=_0xc4c70b,_0x3fad66=_0x3a9070,_0x5e83ac=_0x14df9e[_0x19b689(0xa8)];if(_0x3fad66[_0x19b689(0xa9)]===0x0||!_0x5e83ac)return console['error'](a52_0x4e9609[_0x19b689(0xad)](_0x19b689(0x97))),console['error'](_0x19b689(0x8a)),console['error'](_0x19b689(0xa0)),console[_0x19b689(0xc0)](_0x19b689(0x9c)),console['error'](_0x19b689(0xa4)),console['error']('\x20\x20tdx\x20segment\x20move\x20\x22VIP\x20Customers\x22\x20--folder\x20\x22Archive\x22\x20\x20\x20#\x20by\x20name\x20(needs\x20parent\x20context)'),console[_0x19b689(0xc0)]('\x0aTip:\x20run\x20`tdx\x20segment\x20list\x20-r`\x20to\x20find\x20segment\x20and\x20folder\x20names/IDs.'),0x1;_0x14df9e[_0x19b689(0xc9)]&&(console[_0x19b689(0xc0)](_0x19b689(0xa5)+_0x3fad66[_0x19b689(0xa6)](',\x20')),console['error'](_0x19b689(0x91)+_0x5e83ac));const _0x46ff2b=[...new Set(_0x3fad66)];_0x46ff2b['length']<_0x3fad66[_0x19b689(0xa9)]&&console['error'](a52_0x4e9609['yellow'](_0x19b689(0x8e)+_0x3fad66['length']+'\x20→\x20'+_0x46ff2b[_0x19b689(0xa9)]+').'));const _0x3507df=/^\d+$/,_0x3c09dc=_0x14df9e['parentSegment'],_0x15cae3=[..._0x46ff2b,_0x5e83ac][_0x19b689(0x7b)](_0x3d2e4a=>!_0x3507df['test'](_0x3d2e4a));if(_0x15cae3&&!_0x3c09dc)return console[_0x19b689(0xc0)](a52_0x4e9609['red']('Error:\x20no\x20parent\x20segment\x20context\x20—\x20moving\x20by\x20name\x20needs\x20one.\x0a')),console[_0x19b689(0xc0)](_0x19b689(0xb8)),console[_0x19b689(0xc0)](_0x19b689(0xb0)),console[_0x19b689(0xc0)](_0x19b689(0x8c)),0x1;const _0x1091a5=_0x46ff2b['length'],_0x249361=_0x14df9e[_0x19b689(0x83)]===!![];let _0x3cc6ab;try{const _0x296fa1=await withSpinner((_0x249361?_0x19b689(0xbd):_0x19b689(0xb6))+'\x20'+_0x1091a5+'\x20segment'+(_0x1091a5===0x1?'':'s')+'\x20'+((_0x249361?_0x19b689(0x99):'to')+_0x19b689(0x90)+_0x5e83ac+_0x19b689(0x8f)),async()=>{const _0x178177=_0x19b689,_0x41a532=[];_0x46ff2b[_0x178177(0x9a)]((_0x5df17a,_0x2df30e)=>{const _0x554d2b=_0x178177;if(!_0x3507df['test'](_0x5df17a))_0x41a532['push']({'name':_0x5df17a,'expectType':_0x554d2b(0xc4),'slot':_0x2df30e});});if(!_0x3507df[_0x178177(0x80)](_0x5e83ac))_0x41a532[_0x178177(0x94)]({'name':_0x5e83ac,'expectType':_0x178177(0xa8),'slot':-0x1});const _0x234c0d=new Map();if(_0x41a532[_0x178177(0xa9)]>0x0){const _0x548542=await _0x23175e[_0x178177(0xc4)][_0x178177(0x92)](_0x3c09dc,_0x41a532['map'](({name:_0x13f460,expectType:_0xea6d2c})=>({'name':_0x13f460,'expectType':_0xea6d2c})));_0x548542[_0x178177(0x9a)]((_0x4cbeab,_0x57217e)=>_0x234c0d[_0x178177(0xb5)](_0x41a532[_0x57217e][_0x178177(0x93)],_0x4cbeab['id']));}const _0x1493d7=_0x46ff2b[_0x178177(0xbb)]((_0x272dbe,_0x1be24b)=>_0x3507df['test'](_0x272dbe)?_0x272dbe:_0x234c0d['get'](_0x1be24b)),_0x5e90b7=_0x3507df[_0x178177(0x80)](_0x5e83ac)?_0x5e83ac:_0x234c0d[_0x178177(0xaf)](-0x1);return _0x23175e[_0x178177(0xc4)]['moveSegments'](_0x1493d7,_0x5e90b7,_0x249361);},{'verbose':_0x14df9e['verbose']});_0x3cc6ab=_0x296fa1[_0x19b689(0x84)];}catch(_0x40f39b){if(_0x40f39b instanceof SDKError&&_0x40f39b[_0x19b689(0x7a)]===ErrorCode[_0x19b689(0x89)]&&_0x3c09dc)try{if(await this[_0x19b689(0xbe)](_0x23175e,_0x3c09dc,_0x46ff2b,_0x14df9e))return 0x1;}catch{}throw _0x40f39b;}for(const _0x2b9cfe of _0x3cc6ab){const _0x127662=_0x2b9cfe[_0x19b689(0xa7)],_0x3a72c6=_0x19b689(0xaa)+(_0x249361?'has':_0x19b689(0x98))+'\x20'+_0x127662+_0x19b689(0xc6)+(_0x127662===0x1?'':'s');console[_0x19b689(0xc0)](_0x249361?a52_0x4e9609['cyan'](_0x19b689(0xab)+_0x2b9cfe['id']+_0x19b689(0xb3)+_0x2b9cfe['segmentFolderId']+'\x27\x20—\x20'+_0x3a72c6):a52_0x4e9609[_0x19b689(0x9e)](_0x19b689(0xba)+_0x2b9cfe['id']+_0x19b689(0xb3)+_0x2b9cfe['segmentFolderId']+_0x19b689(0xa2)+_0x3a72c6+'\x20(verified\x20by\x20re-read)'));}if(_0x249361)console[_0x19b689(0xc0)](a52_0x4e9609[_0x19b689(0x85)](_0x19b689(0x95)+_0x1091a5+_0x19b689(0x7f)));else _0x3cc6ab[_0x19b689(0xa9)]>0x1&&console[_0x19b689(0xc0)](a52_0x4e9609[_0x19b689(0x9e)]('✔\x20'+_0x3cc6ab[_0x19b689(0xa9)]+_0x19b689(0x9f)));return await handleSDKOutput(_0x3cc6ab,_0x14df9e),0x0;}async['explainAmbiguousName'](_0x262e69,_0x52b692,_0x3b08dd,_0x1f2e96){const _0x3f5987=a52_0x1e1424,_0x210740=_0x3b08dd[_0x3f5987(0x7d)](_0xd38bb8=>!/^\d+$/[_0x3f5987(0x80)](_0xd38bb8)&&!_0xd38bb8['includes']('/'));if(_0x210740[_0x3f5987(0xa9)]===0x0)return![];const _0xc0fe8=await withSpinner(_0x3f5987(0x9d)+_0x210740['join'](_0x3f5987(0xc2))+_0x3f5987(0x8f),()=>_0x262e69[_0x3f5987(0xc4)]['resolvePathToResource'](_0x52b692),{'verbose':_0x1f2e96[_0x3f5987(0xc9)]}),_0x1a8be9=(await withSpinner(_0x3f5987(0x82),()=>_0x262e69['segment']['listRecursive'](_0xc0fe8[_0x3f5987(0x84)][_0x3f5987(0xc1)],_0xc0fe8['data'][_0x3f5987(0xa3)],0x0,0xa),{'verbose':_0x1f2e96[_0x3f5987(0xc9)]}))[_0x3f5987(0x84)];let _0x42e37b=![];for(const _0xc828aa of _0x210740){const _0x44b3e0=searchTreeByName(_0x1a8be9,_0xc828aa)['filter'](_0x5a839b=>_0x5a839b[_0x3f5987(0xb9)]===_0x3f5987(0xc4)&&_0x5a839b[_0x3f5987(0xb1)][_0x3f5987(0xc7)]()===_0xc828aa[_0x3f5987(0xc7)]());if(_0x44b3e0[_0x3f5987(0xa9)]>0x1){_0x42e37b=!![],console['error'](a52_0x4e9609[_0x3f5987(0xad)](_0x3f5987(0x7c)+_0xc828aa+_0x3f5987(0x87)+_0x44b3e0[_0x3f5987(0xa9)]+_0x3f5987(0xca)));for(const _0x169ea0 of _0x44b3e0)console['error'](_0x3f5987(0x7e)+_0x169ea0['path']+'\x20\x20(id\x20'+_0x169ea0['id']+')');}else _0x44b3e0[_0x3f5987(0xa9)]===0x1&&(_0x42e37b=!![],console[_0x3f5987(0xc0)](a52_0x4e9609['red'](_0x3f5987(0x7c)+_0xc828aa+_0x3f5987(0xac))),console['error']('\x20\x20'+_0x44b3e0[0x0][_0x3f5987(0xa1)]+_0x3f5987(0xbf)+_0x44b3e0[0x0]['id']+')'),console[_0x3f5987(0xc0)]('Re-run\x20`tdx\x20sg\x20move`\x20with\x20that\x20full\x20path\x20(or\x20the\x20id).'));}return _0x42e37b;}}
1
+ const a53_0x5aa459=a53_0x5329;function a53_0x5329(_0x344b8a,_0x342e59){_0x344b8a=_0x344b8a-0xd8;const _0x175899=a53_0x1758();let _0x532964=_0x175899[_0x344b8a];return _0x532964;}(function(_0x5f2dc0,_0x8fe142){const _0x2428ab=a53_0x5329,_0xe09f17=_0x5f2dc0();while(!![]){try{const _0x5a5332=parseInt(_0x2428ab(0xf6))/0x1+-parseInt(_0x2428ab(0xfb))/0x2*(-parseInt(_0x2428ab(0xf7))/0x3)+-parseInt(_0x2428ab(0xec))/0x4+-parseInt(_0x2428ab(0xfc))/0x5*(parseInt(_0x2428ab(0xee))/0x6)+parseInt(_0x2428ab(0xf0))/0x7*(-parseInt(_0x2428ab(0xed))/0x8)+parseInt(_0x2428ab(0xe8))/0x9+parseInt(_0x2428ab(0xfe))/0xa;if(_0x5a5332===_0x8fe142)break;else _0xe09f17['push'](_0xe09f17['shift']());}catch(_0x3b6f88){_0xe09f17['push'](_0xe09f17['shift']());}}}(a53_0x1758,0x97ad8));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a53_0x1758(){const _0x19d3e4=['type','\x20\x20(id\x20','\x20folder\x20\x27','712962oqGnrY','9ShSOIw','\x27\x20—\x20','explainAmbiguousName','slot','184564DEGXHx','375AQzCZz','red','2912420DrCPqG','includes','parentSegment','length','Moving','moveSegments','Error:\x20at\x20least\x20one\x20<segment>\x20and\x20--folder\x20<folder>\x20are\x20required\x0a','for\x20move\x20to','Examples:','resolveEntitiesInParent','\x27\x20matches\x20','join','•\x20[dry-run]\x20Would\x20move\x20segment\x20\x27','code','\x20\x20tdx\x20segment\x20move\x201603887\x201603888\x201603889\x20--folder\x208299501','segment','✔\x20Moved\x20segment\x20\x27','name','\x20segment','\x27,\x20\x27','\x27...','preserved:','yellow','\x27\x20to\x20folder\x20\x27','\x20(verified\x20by\x20re-read)','error','segmentFolderId','toLowerCase','execute','\x0aTip:\x20run\x20`tdx\x20segment\x20list\x20-r`\x20to\x20find\x20segment\x20and\x20folder\x20names/IDs.','Searching\x20the\x20tree...','Target\x20folder:\x20','set','folder','filter','Checking','Or\x20use\x20IDs:\x20\x20\x20\x20tdx\x20sg\x20list\x20-r\x20--json\x20\x20(then\x20pass\x20the\x20numeric\x20ids)','[dry-run]\x20No\x20changes\x20made.\x20','push','green','data','path','test','Move\x20one\x20or\x20more\x20segments\x20to\x20a\x20different\x20folder','get','Re-run\x20`tdx\x20sg\x20move`\x20with\x20that\x20full\x20path\x20(or\x20the\x20id).','\x20condition','forEach','\x20segments\x20moved,\x20all\x20rules\x20verified\x20intact','\x20\x20•\x20','\x20→\x20','8827830dyYCNY','Usage:\x20tdx\x20segment\x20move\x20<segment...>\x20--folder\x20<folder>','Error:\x20\x27','listRecursive','3168212PQtSJk','833832erOhfC','26196cHKlud','some','35JipnZS','verbose','\x27\x20isn\x27t\x20at\x20the\x20top\x20level\x20—\x20it\x27s\x20nested\x20at:'];a53_0x1758=function(){return _0x19d3e4;};return a53_0x1758();}import{searchTreeByName}from'../sdk/util/tree-search.js';import a53_0x502345 from'chalk';export class SegmentMoveCommand extends BaseCommand{[a53_0x5aa459(0x10f)]='segment:move';['description']=a53_0x5aa459(0xe0);async[a53_0x5aa459(0x11a)](_0x5cf3a6){const _0x34e57d=a53_0x5aa459,{options:_0x17ebff,args:_0x9447b9,tdx:_0xa98b4b}=_0x5cf3a6,_0x4712dd=_0x9447b9,_0x18c0a3=_0x17ebff[_0x34e57d(0x11f)];if(_0x4712dd['length']===0x0||!_0x18c0a3)return console[_0x34e57d(0x117)](a53_0x502345[_0x34e57d(0xfd)](_0x34e57d(0x104))),console[_0x34e57d(0x117)](_0x34e57d(0xe9)),console['error'](_0x34e57d(0x106)),console[_0x34e57d(0x117)]('\x20\x20tdx\x20segment\x20move\x201603887\x20--folder\x208299501'),console[_0x34e57d(0x117)](_0x34e57d(0x10c)),console[_0x34e57d(0x117)]('\x20\x20tdx\x20segment\x20move\x20\x22VIP\x20Customers\x22\x20--folder\x20\x22Archive\x22\x20\x20\x20#\x20by\x20name\x20(needs\x20parent\x20context)'),console[_0x34e57d(0x117)](_0x34e57d(0x11b)),0x1;_0x17ebff[_0x34e57d(0xf1)]&&(console[_0x34e57d(0x117)]('Segments:\x20'+_0x4712dd[_0x34e57d(0x109)](',\x20')),console[_0x34e57d(0x117)](_0x34e57d(0x11d)+_0x18c0a3));const _0x151449=[...new Set(_0x4712dd)];_0x151449[_0x34e57d(0x101)]<_0x4712dd[_0x34e57d(0x101)]&&console['error'](a53_0x502345[_0x34e57d(0x114)]('Duplicate\x20segments\x20removed\x20('+_0x4712dd[_0x34e57d(0x101)]+_0x34e57d(0xe7)+_0x151449[_0x34e57d(0x101)]+').'));const _0x510b62=/^\d+$/,_0xff9793=_0x17ebff[_0x34e57d(0x100)],_0x28aab8=[..._0x151449,_0x18c0a3][_0x34e57d(0xef)](_0x3cc8be=>!_0x510b62['test'](_0x3cc8be));if(_0x28aab8&&!_0xff9793)return console['error'](a53_0x502345[_0x34e57d(0xfd)]('Error:\x20no\x20parent\x20segment\x20context\x20—\x20moving\x20by\x20name\x20needs\x20one.\x0a')),console['error']('Set\x20context:\x20\x20\x20tdx\x20use\x20parent_segment\x20\x22<name>\x22'),console[_0x34e57d(0x117)]('Or\x20pass\x20flag:\x20\x20--parent-segment\x20\x22<name>\x22'),console[_0x34e57d(0x117)](_0x34e57d(0xd9)),0x1;const _0x216136=_0x151449[_0x34e57d(0x101)],_0x557f3d=_0x17ebff['dryRun']===!![];let _0x5544a7;try{const _0x545f98=await withSpinner((_0x557f3d?_0x34e57d(0xd8):_0x34e57d(0x102))+'\x20'+_0x216136+_0x34e57d(0x110)+(_0x216136===0x1?'':'s')+'\x20'+((_0x557f3d?_0x34e57d(0x105):'to')+_0x34e57d(0xf5)+_0x18c0a3+_0x34e57d(0x112)),async()=>{const _0x3eb99d=_0x34e57d,_0x2324e0=[];_0x151449[_0x3eb99d(0xe4)]((_0x7a5401,_0x594e8b)=>{const _0x55a9b8=_0x3eb99d;if(!_0x510b62['test'](_0x7a5401))_0x2324e0[_0x55a9b8(0xdb)]({'name':_0x7a5401,'expectType':_0x55a9b8(0x10d),'slot':_0x594e8b});});if(!_0x510b62['test'](_0x18c0a3))_0x2324e0[_0x3eb99d(0xdb)]({'name':_0x18c0a3,'expectType':_0x3eb99d(0x11f),'slot':-0x1});const _0xcb1dd9=new Map();if(_0x2324e0[_0x3eb99d(0x101)]>0x0){const _0x2d1882=await _0xa98b4b['segment'][_0x3eb99d(0x107)](_0xff9793,_0x2324e0['map'](({name:_0x370629,expectType:_0x180944})=>({'name':_0x370629,'expectType':_0x180944})));_0x2d1882['forEach']((_0x1b9caa,_0x33cff1)=>_0xcb1dd9[_0x3eb99d(0x11e)](_0x2324e0[_0x33cff1][_0x3eb99d(0xfa)],_0x1b9caa['id']));}const _0x17bf20=_0x151449['map']((_0x370a45,_0x4019d4)=>_0x510b62[_0x3eb99d(0xdf)](_0x370a45)?_0x370a45:_0xcb1dd9[_0x3eb99d(0xe1)](_0x4019d4)),_0xd612a4=_0x510b62[_0x3eb99d(0xdf)](_0x18c0a3)?_0x18c0a3:_0xcb1dd9[_0x3eb99d(0xe1)](-0x1);return _0xa98b4b[_0x3eb99d(0x10d)][_0x3eb99d(0x103)](_0x17bf20,_0xd612a4,_0x557f3d);},{'verbose':_0x17ebff[_0x34e57d(0xf1)]});_0x5544a7=_0x545f98[_0x34e57d(0xdd)];}catch(_0x2bb840){if(_0x2bb840 instanceof SDKError&&_0x2bb840[_0x34e57d(0x10b)]===ErrorCode['SEGMENT_NOT_FOUND']&&_0xff9793)try{if(await this[_0x34e57d(0xf9)](_0xa98b4b,_0xff9793,_0x151449,_0x17ebff))return 0x1;}catch{}throw _0x2bb840;}for(const _0x1666f7 of _0x5544a7){const _0x45a7ff=_0x1666f7['ruleConditionCount'],_0x2bdd08='rule\x20'+(_0x557f3d?'has':_0x34e57d(0x113))+'\x20'+_0x45a7ff+_0x34e57d(0xe3)+(_0x45a7ff===0x1?'':'s');console[_0x34e57d(0x117)](_0x557f3d?a53_0x502345['cyan'](_0x34e57d(0x10a)+_0x1666f7['id']+_0x34e57d(0x115)+_0x1666f7[_0x34e57d(0x118)]+'\x27\x20—\x20'+_0x2bdd08):a53_0x502345[_0x34e57d(0xdc)](_0x34e57d(0x10e)+_0x1666f7['id']+_0x34e57d(0x115)+_0x1666f7['segmentFolderId']+_0x34e57d(0xf8)+_0x2bdd08+_0x34e57d(0x116)));}if(_0x557f3d)console[_0x34e57d(0x117)](a53_0x502345['cyan'](_0x34e57d(0xda)+_0x216136+'\x20segment(s)\x20would\x20be\x20moved.'));else _0x5544a7[_0x34e57d(0x101)]>0x1&&console[_0x34e57d(0x117)](a53_0x502345[_0x34e57d(0xdc)]('✔\x20'+_0x5544a7[_0x34e57d(0x101)]+_0x34e57d(0xe5)));return await handleSDKOutput(_0x5544a7,_0x17ebff),0x0;}async['explainAmbiguousName'](_0x195738,_0x45d5d1,_0x13157f,_0x1fed17){const _0x32530d=a53_0x5aa459,_0x5a273c=_0x13157f[_0x32530d(0x120)](_0x2f9199=>!/^\d+$/['test'](_0x2f9199)&&!_0x2f9199[_0x32530d(0xff)]('/'));if(_0x5a273c[_0x32530d(0x101)]===0x0)return![];const _0x309178=await withSpinner('Searching\x20folders\x20for\x20\x27'+_0x5a273c['join'](_0x32530d(0x111))+'\x27...',()=>_0x195738[_0x32530d(0x10d)]['resolvePathToResource'](_0x45d5d1),{'verbose':_0x1fed17[_0x32530d(0xf1)]}),_0x2946fa=(await withSpinner(_0x32530d(0x11c),()=>_0x195738[_0x32530d(0x10d)][_0x32530d(0xeb)](_0x309178[_0x32530d(0xdd)]['parentId'],_0x309178[_0x32530d(0xdd)]['folderId'],0x0,0xa),{'verbose':_0x1fed17[_0x32530d(0xf1)]}))[_0x32530d(0xdd)];let _0x159fe9=![];for(const _0x4c9d61 of _0x5a273c){const _0x537e3f=searchTreeByName(_0x2946fa,_0x4c9d61)[_0x32530d(0x120)](_0x5dd12c=>_0x5dd12c[_0x32530d(0xf3)]===_0x32530d(0x10d)&&_0x5dd12c[_0x32530d(0x10f)][_0x32530d(0x119)]()===_0x4c9d61['toLowerCase']());if(_0x537e3f[_0x32530d(0x101)]>0x1){_0x159fe9=!![],console[_0x32530d(0x117)](a53_0x502345['red']('Error:\x20\x27'+_0x4c9d61+_0x32530d(0x108)+_0x537e3f['length']+'\x20segments\x20—\x20refusing\x20to\x20guess.\x20Pass\x20the\x20full\x20path\x20(or\x20id)\x20of\x20the\x20one\x20you\x20mean:'));for(const _0xfa2b92 of _0x537e3f)console[_0x32530d(0x117)](_0x32530d(0xe6)+_0xfa2b92[_0x32530d(0xde)]+'\x20\x20(id\x20'+_0xfa2b92['id']+')');}else _0x537e3f['length']===0x1&&(_0x159fe9=!![],console[_0x32530d(0x117)](a53_0x502345[_0x32530d(0xfd)](_0x32530d(0xea)+_0x4c9d61+_0x32530d(0xf2))),console[_0x32530d(0x117)]('\x20\x20'+_0x537e3f[0x0]['path']+_0x32530d(0xf4)+_0x537e3f[0x0]['id']+')'),console['error'](_0x32530d(0xe2)));}return _0x159fe9;}}
@@ -1 +1 @@
1
- const a53_0x3e8a99=a53_0x221c;function a53_0x5a5f(){const _0x2fcafd=['error','dirname','8JNtBap','3430360ZMzLQb','targetDir','parent_segment','\x20files?','✔\x20Pulled\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','653008cjdDSF','\x27...','execute','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','6216273ksAMHR','length','segment','errorCode','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','content','\x20activations','\x20versions)','cyan','files','setPhase','Parent\x20segment:\x20','utf-8','site','message','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','data','708141TFaHri','hasChanges','diff','\x20=\x20','activations','yellow','Pulling\x20segments\x20from\x20\x27','Write\x20','filter','segments','pullSegments','Aborted.','description','isNew','dim','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','4530507FKpyGG','journeys','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','✔\x20Context\x20set:\x20','green','\x0aPull\x20summary\x20for\x20\x27','3362250wjMMWr','parentName','-\x20no\x20files\x20written','\x20new\x20files','\x20journeys','parentSegment','resourceName','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','yes','name','✔\x20All\x20files\x20are\x20up\x20to\x20date','\x20segments','\x20\x20Target:\x20','855VeHvXY','repeat','no_parent','session','relativePath','\x20files\x20to\x20','3752090JVrjko','counts','red','Target\x20resource:\x20','\x0aChanges\x20to\x20\x27','helpText','\x20unchanged\x20files','absolutePath'];a53_0x5a5f=function(){return _0x2fcafd;};return a53_0x5a5f();}function a53_0x221c(_0xca6786,_0x1bae30){_0xca6786=_0xca6786-0x1d7;const _0x5a5ffc=a53_0x5a5f();let _0x221c1b=_0x5a5ffc[_0xca6786];return _0x221c1b;}(function(_0xcdcf04,_0x274aca){const _0x8b6b78=a53_0x221c,_0x43d1df=_0xcdcf04();while(!![]){try{const _0x2a0eca=-parseInt(_0x8b6b78(0x21c))/0x1+-parseInt(_0x8b6b78(0x201))/0x2+-parseInt(_0x8b6b78(0x1dd))/0x3+parseInt(_0x8b6b78(0x200))/0x4*(-parseInt(_0x8b6b78(0x1f6))/0x5)+-parseInt(_0x8b6b78(0x1e3))/0x6+-parseInt(_0x8b6b78(0x20b))/0x7+parseInt(_0x8b6b78(0x207))/0x8*(parseInt(_0x8b6b78(0x1f0))/0x9);if(_0x2a0eca===_0x274aca)break;else _0x43d1df['push'](_0x43d1df['shift']());}catch(_0x4acb35){_0x43d1df['push'](_0x43d1df['shift']());}}}(a53_0x5a5f,0xd4d32));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 a53_0x197e3d from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a53_0x2fa6d5 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{[a53_0x3e8a99(0x1ec)]='segment:pull';[a53_0x3e8a99(0x1d9)]=a53_0x3e8a99(0x1df);async[a53_0x3e8a99(0x209)](_0x116543){const _0x4b99cc=a53_0x3e8a99,{options:_0x3eeefb,args:_0x58e73b,tdx:_0x5768ff}=_0x116543,_0x4873e6=_0x3eeefb,_0x251d02=await resolveTarget({'arg':_0x58e73b[0x0],'contextParent':_0x3eeefb[_0x4b99cc(0x1e8)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x251d02))return _0x251d02[_0x4b99cc(0x20e)]===_0x4b99cc(0x1f2)?(console['error'](a53_0x197e3d[_0x4b99cc(0x221)](_0x4b99cc(0x206))),console[_0x4b99cc(0x1fe)]('Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)'),console['error'](_0x4b99cc(0x20f)),console[_0x4b99cc(0x1fe)](_0x4b99cc(0x21a))):(console[_0x4b99cc(0x1fe)](a53_0x197e3d[_0x4b99cc(0x1f8)]('Error:\x20'+_0x251d02[_0x4b99cc(0x219)]+'\x0a')),_0x251d02[_0x4b99cc(0x1fb)]&&console[_0x4b99cc(0x1fe)](a53_0x197e3d[_0x4b99cc(0x213)](_0x251d02[_0x4b99cc(0x1fb)]))),0x1;const _0x44019a=_0x251d02['parentName'],_0xc823a8=_0x251d02[_0x4b99cc(0x202)],_0x147829=_0x251d02['type']==='file'?_0x251d02[_0x4b99cc(0x1e9)]:undefined;_0x4873e6['verbose']&&(console['error']('Site:\x20'+_0x4873e6[_0x4b99cc(0x218)]),console['error'](_0x4b99cc(0x216)+_0x44019a),_0x147829&&console[_0x4b99cc(0x1fe)](_0x4b99cc(0x1f9)+_0x147829));const _0x499c03=await withProgressSpinner(_0x4b99cc(0x222)+_0x44019a+_0x4b99cc(0x208),_0x4922a1=>_0x5768ff[_0x4b99cc(0x20d)][_0x4b99cc(0x1d7)](_0x44019a,{'targetDir':_0xc823a8,'targetResourceName':_0x147829,'verbose':_0x4873e6['verbose'],'progress':{'update':_0x8bfd5=>{const _0x337952=_0x4b99cc;_0x4922a1[_0x337952(0x215)](_0x8bfd5),_0x4873e6['verbose']&&console[_0x337952(0x1fe)]('\x20\x20'+_0x8bfd5);}}}),{'verbose':_0x4873e6['verbose']}),_0x28e124=_0x499c03[_0x4b99cc(0x21b)];if(_0x28e124[_0x4b99cc(0x1f7)][_0x4b99cc(0x225)]===0x0&&_0x28e124[_0x4b99cc(0x1f7)]['journeys']===0x0)return console[_0x4b99cc(0x1fe)](a53_0x197e3d[_0x4b99cc(0x221)](_0x4b99cc(0x1ea)+_0x28e124[_0x4b99cc(0x1e4)]+'\x27')),0x0;const _0x344fd2=_0x28e124[_0x4b99cc(0x214)][_0x4b99cc(0x224)](_0x3f41c0=>_0x3f41c0[_0x4b99cc(0x1da)]),_0x5aefcf=_0x28e124[_0x4b99cc(0x214)][_0x4b99cc(0x224)](_0x5334a8=>!_0x5334a8[_0x4b99cc(0x1da)]&&_0x5334a8[_0x4b99cc(0x21d)]),_0x8f29ed=_0x28e124[_0x4b99cc(0x214)][_0x4b99cc(0x224)](_0x2ed579=>!_0x2ed579[_0x4b99cc(0x1da)]&&!_0x2ed579[_0x4b99cc(0x21d)]);console[_0x4b99cc(0x1fe)](_0x4b99cc(0x1e2)+_0x28e124['parentName']+'\x27:'),console[_0x4b99cc(0x1fe)]('\x20\x20🎯\x20'+a53_0x197e3d[_0x4b99cc(0x213)](_0x28e124[_0x4b99cc(0x1f7)][_0x4b99cc(0x225)]+_0x4b99cc(0x1ee))+'\x20with\x20'+a53_0x197e3d[_0x4b99cc(0x213)](_0x28e124['counts'][_0x4b99cc(0x220)]+_0x4b99cc(0x211)));if(_0x28e124['counts'][_0x4b99cc(0x1de)]>0x0){const _0x38c00c=_0x28e124[_0x4b99cc(0x1f7)]['journeyVersions']>_0x28e124['counts'][_0x4b99cc(0x1de)]?'\x20('+_0x28e124[_0x4b99cc(0x1f7)]['journeyVersions']+_0x4b99cc(0x212):'';console['error']('\x20\x20🗺️\x20\x20'+a53_0x197e3d[_0x4b99cc(0x213)](_0x28e124[_0x4b99cc(0x1f7)]['journeys']+_0x4b99cc(0x1e7))+a53_0x197e3d[_0x4b99cc(0x1db)](_0x38c00c));}console[_0x4b99cc(0x1fe)]('\x20\x20'+a53_0x197e3d[_0x4b99cc(0x1e1)]('+\x20'+_0x344fd2[_0x4b99cc(0x20c)]+_0x4b99cc(0x1e6))),console[_0x4b99cc(0x1fe)]('\x20\x20'+a53_0x197e3d[_0x4b99cc(0x221)]('~\x20'+_0x5aefcf[_0x4b99cc(0x20c)]+'\x20changed\x20files')),console[_0x4b99cc(0x1fe)]('\x20\x20'+a53_0x197e3d[_0x4b99cc(0x1db)]('=\x20'+_0x8f29ed[_0x4b99cc(0x20c)]+_0x4b99cc(0x1fc))),console[_0x4b99cc(0x1fe)](_0x4b99cc(0x1ef)+a53_0x197e3d[_0x4b99cc(0x213)](_0x28e124[_0x4b99cc(0x202)])+'\x0a');if(_0x5aefcf[_0x4b99cc(0x20c)]>0x0)for(const _0x3031f1 of _0x5aefcf){console[_0x4b99cc(0x1fe)](_0x4b99cc(0x1fa)+_0x3031f1[_0x4b99cc(0x1f4)]+'\x27:'),console[_0x4b99cc(0x1fe)]('─'[_0x4b99cc(0x1f1)](0x3c)),console[_0x4b99cc(0x1fe)](_0x3031f1[_0x4b99cc(0x21e)]),console['error']('─'[_0x4b99cc(0x1f1)](0x3c));}if(_0x4873e6['dryRun'])return console[_0x4b99cc(0x1fe)](a53_0x197e3d[_0x4b99cc(0x221)](_0x4b99cc(0x20a))),0x0;if(_0x344fd2['length']===0x0&&_0x5aefcf[_0x4b99cc(0x20c)]===0x0)return console['error'](a53_0x197e3d[_0x4b99cc(0x1e1)](_0x4b99cc(0x1ed))),saveSessionContext({'parent_segment':_0x28e124[_0x4b99cc(0x1e4)]},_0x4873e6['session']),console['error'](a53_0x197e3d[_0x4b99cc(0x1e1)](_0x4b99cc(0x1e0)+a53_0x197e3d[_0x4b99cc(0x1db)]('parent_segment')+_0x4b99cc(0x21f)+a53_0x197e3d[_0x4b99cc(0x213)](_0x28e124[_0x4b99cc(0x1e4)]))),0x0;if(!_0x4873e6[_0x4b99cc(0x1eb)]){if(!isInteractive())return console[_0x4b99cc(0x1fe)](a53_0x197e3d['red']('\x0aError:'),_0x4b99cc(0x1dc)),console[_0x4b99cc(0x1fe)](a53_0x197e3d[_0x4b99cc(0x1db)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x53c0ed=await confirmKey(_0x4b99cc(0x223)+(_0x344fd2[_0x4b99cc(0x20c)]+_0x5aefcf[_0x4b99cc(0x20c)])+_0x4b99cc(0x204));if(!_0x53c0ed)return console[_0x4b99cc(0x1fe)](a53_0x197e3d[_0x4b99cc(0x221)](_0x4b99cc(0x1d8)),_0x4b99cc(0x1e5)),0x1;}for(const _0x49cf74 of _0x28e124['files']){if(_0x49cf74[_0x4b99cc(0x1da)]||_0x49cf74[_0x4b99cc(0x21d)]){const _0x541779=a53_0x2fa6d5[_0x4b99cc(0x1ff)](_0x49cf74[_0x4b99cc(0x1fd)]);!existsSync(_0x541779)&&mkdirSync(_0x541779,{'recursive':!![]}),writeFileSync(_0x49cf74[_0x4b99cc(0x1fd)],_0x49cf74[_0x4b99cc(0x210)],_0x4b99cc(0x217));}}return console[_0x4b99cc(0x1fe)](a53_0x197e3d[_0x4b99cc(0x1e1)](_0x4b99cc(0x205)+(_0x344fd2[_0x4b99cc(0x20c)]+_0x5aefcf['length'])+_0x4b99cc(0x1f5)+_0x28e124['targetDir'])),saveSessionContext({'parent_segment':_0x28e124[_0x4b99cc(0x1e4)]},_0x4873e6[_0x4b99cc(0x1f3)]),console[_0x4b99cc(0x1fe)](a53_0x197e3d[_0x4b99cc(0x1e1)](_0x4b99cc(0x1e0)+a53_0x197e3d['dim'](_0x4b99cc(0x203))+'\x20=\x20'+a53_0x197e3d['cyan'](_0x28e124[_0x4b99cc(0x1e4)]))),0x0;}}
1
+ const a54_0xa278a4=a54_0x89ba;(function(_0x286194,_0x3cbbe9){const _0x86d5b7=a54_0x89ba,_0x1f8f3a=_0x286194();while(!![]){try{const _0x659916=-parseInt(_0x86d5b7(0x16d))/0x1+-parseInt(_0x86d5b7(0x15b))/0x2+parseInt(_0x86d5b7(0x148))/0x3*(parseInt(_0x86d5b7(0x16e))/0x4)+parseInt(_0x86d5b7(0x168))/0x5+parseInt(_0x86d5b7(0x135))/0x6*(-parseInt(_0x86d5b7(0x15a))/0x7)+-parseInt(_0x86d5b7(0x141))/0x8+parseInt(_0x86d5b7(0x163))/0x9;if(_0x659916===_0x3cbbe9)break;else _0x1f8f3a['push'](_0x1f8f3a['shift']());}catch(_0x29ba0d){_0x1f8f3a['push'](_0x1f8f3a['shift']());}}}(a54_0x2330,0xdac70));function a54_0x2330(){const _0x4fdeaf=['filter','site','name','\x20files?','\x20files\x20to\x20','setPhase','no_parent','✔\x20Pulled\x20','segment:pull','Error:\x20','\x27...','\x20\x20🗺️\x20\x20','counts','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','targetDir','\x20=\x20','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)','732571yvPrjb','1008872VdGrQx','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','\x20\x20🎯\x20','-\x20no\x20files\x20written','diff','activations','\x20with\x20','\x0aPull\x20summary\x20for\x20\x27','7568631qaEABb','isNew','parent_segment','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','file','5630875vqWtxc','verbose','\x20changed\x20files','\x20journeys','yellow','287310qJhnVS','2324TwJiLN','repeat','journeyVersions','Write\x20','dim','description','✔\x20All\x20files\x20are\x20up\x20to\x20date','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','cwd','execute','cyan','Pulling\x20segments\x20from\x20\x27','message','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','✔\x20Context\x20set:\x20','absolutePath','relativePath','data','journeys','Aborted.','24IqQeqh','green','\x20new\x20files','parentName','length','dryRun','type','error','\x20activations','\x0aError:','Parent\x20segment:\x20','yes','10640104mBFWLT','dirname','segments','hasChanges','\x20versions)','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','session','7587jRodYq'];a54_0x2330=function(){return _0x4fdeaf;};return a54_0x2330();}import{BaseCommand}from'./command.js';function a54_0x89ba(_0x2ec288,_0xbf0b47){_0x2ec288=_0x2ec288-0x132;const _0x23301a=a54_0x2330();let _0x89baff=_0x23301a[_0x2ec288];return _0x89baff;}import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a54_0x11ea59 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a54_0x3e92e7 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{[a54_0xa278a4(0x14b)]=a54_0xa278a4(0x151);[a54_0xa278a4(0x173)]=a54_0xa278a4(0x17b);async[a54_0xa278a4(0x177)](_0x4f0824){const _0x2f5d51=a54_0xa278a4,{options:_0xade8fc,args:_0xccc4a9,tdx:_0x33f232}=_0x4f0824,_0x74299=_0xade8fc,_0x3be4c0=await resolveTarget({'arg':_0xccc4a9[0x0],'contextParent':_0xade8fc['parentSegment'],'cwd':process[_0x2f5d51(0x176)]()});if(!isSuccessfulResolution(_0x3be4c0))return _0x3be4c0['errorCode']===_0x2f5d51(0x14f)?(console[_0x2f5d51(0x13c)](a54_0x11ea59[_0x2f5d51(0x16c)](_0x2f5d51(0x146))),console[_0x2f5d51(0x13c)](_0x2f5d51(0x159)),console['error'](_0x2f5d51(0x156)),console['error'](_0x2f5d51(0x15c))):(console[_0x2f5d51(0x13c)](a54_0x11ea59['red'](_0x2f5d51(0x152)+_0x3be4c0[_0x2f5d51(0x17a)]+'\x0a')),_0x3be4c0['helpText']&&console[_0x2f5d51(0x13c)](a54_0x11ea59[_0x2f5d51(0x178)](_0x3be4c0['helpText']))),0x1;const _0x4b2a0e=_0x3be4c0['parentName'],_0x2468bc=_0x3be4c0[_0x2f5d51(0x157)],_0x1bd8cc=_0x3be4c0[_0x2f5d51(0x13b)]===_0x2f5d51(0x167)?_0x3be4c0['resourceName']:undefined;_0x74299[_0x2f5d51(0x169)]&&(console[_0x2f5d51(0x13c)]('Site:\x20'+_0x74299[_0x2f5d51(0x14a)]),console[_0x2f5d51(0x13c)](_0x2f5d51(0x13f)+_0x4b2a0e),_0x1bd8cc&&console[_0x2f5d51(0x13c)]('Target\x20resource:\x20'+_0x1bd8cc));const _0x29cc97=await withProgressSpinner(_0x2f5d51(0x179)+_0x4b2a0e+_0x2f5d51(0x153),_0x40a480=>_0x33f232['segment']['pullSegments'](_0x4b2a0e,{'targetDir':_0x2468bc,'targetResourceName':_0x1bd8cc,'verbose':_0x74299[_0x2f5d51(0x169)],'progress':{'update':_0x4b4994=>{const _0x35cd11=_0x2f5d51;_0x40a480[_0x35cd11(0x14e)](_0x4b4994),_0x74299[_0x35cd11(0x169)]&&console['error']('\x20\x20'+_0x4b4994);}}}),{'verbose':_0x74299[_0x2f5d51(0x169)]}),_0x53dc39=_0x29cc97[_0x2f5d51(0x132)];if(_0x53dc39[_0x2f5d51(0x155)]['segments']===0x0&&_0x53dc39[_0x2f5d51(0x155)][_0x2f5d51(0x133)]===0x0)return console['error'](a54_0x11ea59[_0x2f5d51(0x16c)](_0x2f5d51(0x175)+_0x53dc39[_0x2f5d51(0x138)]+'\x27')),0x0;const _0x4ec405=_0x53dc39['files']['filter'](_0x5bc380=>_0x5bc380[_0x2f5d51(0x164)]),_0x3bc756=_0x53dc39['files'][_0x2f5d51(0x149)](_0x174cd5=>!_0x174cd5[_0x2f5d51(0x164)]&&_0x174cd5[_0x2f5d51(0x144)]),_0x6feef=_0x53dc39['files']['filter'](_0xf2d4b9=>!_0xf2d4b9['isNew']&&!_0xf2d4b9['hasChanges']);console['error'](_0x2f5d51(0x162)+_0x53dc39[_0x2f5d51(0x138)]+'\x27:'),console['error'](_0x2f5d51(0x15d)+a54_0x11ea59[_0x2f5d51(0x178)](_0x53dc39['counts'][_0x2f5d51(0x143)]+'\x20segments')+_0x2f5d51(0x161)+a54_0x11ea59[_0x2f5d51(0x178)](_0x53dc39[_0x2f5d51(0x155)][_0x2f5d51(0x160)]+_0x2f5d51(0x13d)));if(_0x53dc39['counts'][_0x2f5d51(0x133)]>0x0){const _0x3fb00f=_0x53dc39[_0x2f5d51(0x155)][_0x2f5d51(0x170)]>_0x53dc39['counts'][_0x2f5d51(0x133)]?'\x20('+_0x53dc39['counts'][_0x2f5d51(0x170)]+_0x2f5d51(0x145):'';console[_0x2f5d51(0x13c)](_0x2f5d51(0x154)+a54_0x11ea59['cyan'](_0x53dc39['counts'][_0x2f5d51(0x133)]+_0x2f5d51(0x16b))+a54_0x11ea59[_0x2f5d51(0x172)](_0x3fb00f));}console['error']('\x20\x20'+a54_0x11ea59[_0x2f5d51(0x136)]('+\x20'+_0x4ec405[_0x2f5d51(0x139)]+_0x2f5d51(0x137))),console[_0x2f5d51(0x13c)]('\x20\x20'+a54_0x11ea59[_0x2f5d51(0x16c)]('~\x20'+_0x3bc756[_0x2f5d51(0x139)]+_0x2f5d51(0x16a))),console['error']('\x20\x20'+a54_0x11ea59['dim']('=\x20'+_0x6feef[_0x2f5d51(0x139)]+'\x20unchanged\x20files')),console[_0x2f5d51(0x13c)]('\x20\x20Target:\x20'+a54_0x11ea59[_0x2f5d51(0x178)](_0x53dc39[_0x2f5d51(0x157)])+'\x0a');if(_0x3bc756[_0x2f5d51(0x139)]>0x0)for(const _0x5d0905 of _0x3bc756){console['error']('\x0aChanges\x20to\x20\x27'+_0x5d0905[_0x2f5d51(0x17e)]+'\x27:'),console[_0x2f5d51(0x13c)]('─'[_0x2f5d51(0x16f)](0x3c)),console[_0x2f5d51(0x13c)](_0x5d0905[_0x2f5d51(0x15f)]),console['error']('─'[_0x2f5d51(0x16f)](0x3c));}if(_0x74299[_0x2f5d51(0x13a)])return console['error'](a54_0x11ea59[_0x2f5d51(0x16c)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x4ec405[_0x2f5d51(0x139)]===0x0&&_0x3bc756[_0x2f5d51(0x139)]===0x0)return console[_0x2f5d51(0x13c)](a54_0x11ea59[_0x2f5d51(0x136)](_0x2f5d51(0x174))),saveSessionContext({'parent_segment':_0x53dc39[_0x2f5d51(0x138)]},_0x74299[_0x2f5d51(0x147)]),console[_0x2f5d51(0x13c)](a54_0x11ea59[_0x2f5d51(0x136)](_0x2f5d51(0x17c)+a54_0x11ea59[_0x2f5d51(0x172)](_0x2f5d51(0x165))+_0x2f5d51(0x158)+a54_0x11ea59[_0x2f5d51(0x178)](_0x53dc39[_0x2f5d51(0x138)]))),0x0;if(!_0x74299[_0x2f5d51(0x140)]){if(!isInteractive())return console['error'](a54_0x11ea59['red'](_0x2f5d51(0x13e)),_0x2f5d51(0x166)),console['error'](a54_0x11ea59['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x21dc8b=await confirmKey(_0x2f5d51(0x171)+(_0x4ec405[_0x2f5d51(0x139)]+_0x3bc756['length'])+_0x2f5d51(0x14c));if(!_0x21dc8b)return console[_0x2f5d51(0x13c)](a54_0x11ea59[_0x2f5d51(0x16c)](_0x2f5d51(0x134)),_0x2f5d51(0x15e)),0x1;}for(const _0x293935 of _0x53dc39['files']){if(_0x293935[_0x2f5d51(0x164)]||_0x293935[_0x2f5d51(0x144)]){const _0x3a5d9b=a54_0x3e92e7[_0x2f5d51(0x142)](_0x293935['absolutePath']);!existsSync(_0x3a5d9b)&&mkdirSync(_0x3a5d9b,{'recursive':!![]}),writeFileSync(_0x293935[_0x2f5d51(0x17d)],_0x293935['content'],'utf-8');}}return console['error'](a54_0x11ea59['green'](_0x2f5d51(0x150)+(_0x4ec405[_0x2f5d51(0x139)]+_0x3bc756[_0x2f5d51(0x139)])+_0x2f5d51(0x14d)+_0x53dc39['targetDir'])),saveSessionContext({'parent_segment':_0x53dc39[_0x2f5d51(0x138)]},_0x74299['session']),console['error'](a54_0x11ea59['green'](_0x2f5d51(0x17c)+a54_0x11ea59[_0x2f5d51(0x172)](_0x2f5d51(0x165))+'\x20=\x20'+a54_0x11ea59['cyan'](_0x53dc39['parentName']))),0x0;}}
@@ -1 +1 @@
1
- const a54_0x3a74f0=a54_0x32a0;(function(_0x15f8f6,_0x510e53){const _0x224fe4=a54_0x32a0,_0x2f3ddf=_0x15f8f6();while(!![]){try{const _0x3986f2=-parseInt(_0x224fe4(0x23a))/0x1*(-parseInt(_0x224fe4(0x1de))/0x2)+-parseInt(_0x224fe4(0x224))/0x3*(-parseInt(_0x224fe4(0x1cd))/0x4)+parseInt(_0x224fe4(0x220))/0x5*(-parseInt(_0x224fe4(0x24e))/0x6)+parseInt(_0x224fe4(0x212))/0x7*(-parseInt(_0x224fe4(0x1e3))/0x8)+-parseInt(_0x224fe4(0x24d))/0x9+parseInt(_0x224fe4(0x21f))/0xa+-parseInt(_0x224fe4(0x202))/0xb*(-parseInt(_0x224fe4(0x22c))/0xc);if(_0x3986f2===_0x510e53)break;else _0x2f3ddf['push'](_0x2f3ddf['shift']());}catch(_0x55e80e){_0x2f3ddf['push'](_0x2f3ddf['shift']());}}}(a54_0x59cf,0x48708));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 a54_0x5bbac5 from'chalk';import{existsSync}from'fs';function a54_0x32a0(_0x1c9f82,_0x2b5bd2){_0x1c9f82=_0x1c9f82-0x1b6;const _0x59cf95=a54_0x59cf();let _0x32a0fc=_0x59cf95[_0x1c9f82];return _0x32a0fc;}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{['name']=a54_0x3a74f0(0x241);[a54_0x3a74f0(0x1c9)]=a54_0x3a74f0(0x21d);async[a54_0x3a74f0(0x1ed)](_0x15de5b){const _0x1cf13b=a54_0x3a74f0,{options:_0x44e2d2,args:_0x4d01d1,tdx:_0x37311e}=_0x15de5b,_0x8d9a33=_0x44e2d2,_0x42649b=await resolveTarget({'arg':_0x4d01d1[0x0],'contextParent':_0x44e2d2[_0x1cf13b(0x207)],'cwd':process[_0x1cf13b(0x222)]()});if(!isSuccessfulResolution(_0x42649b))return _0x42649b[_0x1cf13b(0x240)]===_0x1cf13b(0x1e0)?(console['error'](a54_0x5bbac5[_0x1cf13b(0x21b)](_0x1cf13b(0x216))),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[_0x1cf13b(0x1ec)](_0x1cf13b(0x20d)),console['error'](_0x1cf13b(0x236))):(console[_0x1cf13b(0x1ec)](a54_0x5bbac5[_0x1cf13b(0x1d0)](_0x1cf13b(0x205)+_0x42649b[_0x1cf13b(0x21c)]+'\x0a')),_0x42649b[_0x1cf13b(0x1d7)]&&console[_0x1cf13b(0x1ec)](a54_0x5bbac5[_0x1cf13b(0x1dc)](_0x42649b[_0x1cf13b(0x1d7)]))),0x1;if(_0x42649b['type']==='parent_name')return console['error'](a54_0x5bbac5['red'](_0x1cf13b(0x1c8)+_0x42649b[_0x1cf13b(0x1c5)]+'\x0a')),console['error'](a54_0x5bbac5[_0x1cf13b(0x1dc)](_0x1cf13b(0x1f6))),0x1;const _0xb7bc26=_0x42649b[_0x1cf13b(0x1d2)],_0x29073d=_0x42649b[_0x1cf13b(0x1c5)],_0x55fbdb=_0x42649b[_0x1cf13b(0x1f1)]==='file'?_0x42649b[_0x1cf13b(0x228)]:undefined,_0x46c8cd=getScopedDetails(_0x42649b),_0x38d555=_0x46c8cd?.[_0x1cf13b(0x245)]??![],_0x4977c1=_0x46c8cd?.['scopedFolderPath']??'';if(!existsSync(_0x29073d))return console[_0x1cf13b(0x1ec)](a54_0x5bbac5['red'](_0x1cf13b(0x1c8)+_0x29073d+'\x0a')),console[_0x1cf13b(0x1ec)](a54_0x5bbac5[_0x1cf13b(0x1dc)](_0x1cf13b(0x1f6))),0x1;_0x8d9a33[_0x1cf13b(0x1cb)]&&(console[_0x1cf13b(0x1ec)]('Site:\x20'+_0x8d9a33['site']),console[_0x1cf13b(0x1ec)](_0x1cf13b(0x23f)+_0xb7bc26),console['error']('Source\x20directory:\x20'+_0x29073d),_0x38d555&&console['error'](_0x1cf13b(0x1ba)+_0x4977c1));const _0x5e885f=await withSpinner(_0x1cf13b(0x247)+_0xb7bc26+_0x1cf13b(0x1c0),()=>_0x37311e[_0x1cf13b(0x248)][_0x1cf13b(0x1ea)](_0xb7bc26),{'verbose':_0x8d9a33[_0x1cf13b(0x1cb)]}),_0x5e35d1=_0x5e885f[_0x1cf13b(0x209)],{parentSegmentResult:_0x24e947,segmentsResult:_0x3deb07,foldersResult:_0x249822,journeysWithDetailsResult:_0x11a7da,userMaps:_0x3a5282}=await withSpinner(_0x1cf13b(0x255),async()=>{const _0x294ed1=_0x1cf13b,[_0x312e40,_0xb0e139,_0x460718,_0xc86334,_0x59b498]=await Promise[_0x294ed1(0x1cc)]([_0x37311e[_0x294ed1(0x248)][_0x294ed1(0x206)](_0x5e35d1),_0x37311e[_0x294ed1(0x248)][_0x294ed1(0x1e4)](_0x5e35d1),_0x37311e['segment'][_0x294ed1(0x22e)](_0x5e35d1),_0x37311e[_0x294ed1(0x210)][_0x294ed1(0x1c2)](_0x5e35d1,{'includeAllVersions':!![]}),_0x37311e['user'][_0x294ed1(0x22d)]()]);return{'parentSegmentResult':_0x312e40,'segmentsResult':_0xb0e139,'foldersResult':_0x460718,'journeysWithDetailsResult':_0xc86334,'userMaps':_0x59b498};},{'verbose':_0x8d9a33[_0x1cf13b(0x1cb)]})[_0x1cf13b(0x237)](_0x5a6574=>_0x5a6574[_0x1cf13b(0x209)]),_0x248549=_0x24e947,_0x4f8e8a=extractRootFolderId(_0x248549),_0x2c1d52=_0x3deb07,_0x548ac0=_0x249822,{journeys:_0x46c5b3,activationStepsById:_0xb64c22}=_0x11a7da,_0x3bcd87=new Map(_0x46c5b3['map'](_0x579fa9=>[_0x579fa9['id'],_0x579fa9])),_0x50804a=_0x46c5b3[_0x1cf13b(0x230)](_0x241ea8=>({'id':_0x241ea8['id'],'name':_0x241ea8[_0x1cf13b(0x246)][_0x1cf13b(0x218)],'journeyBundleName':_0x241ea8[_0x1cf13b(0x246)]['journeyBundleName']||'','journeyBundleId':_0x241ea8['attributes']['journeyBundleId']||'','versionNumber':_0x241ea8[_0x1cf13b(0x246)][_0x1cf13b(0x22a)],'description':_0x241ea8[_0x1cf13b(0x246)][_0x1cf13b(0x1c9)],'state':_0x241ea8[_0x1cf13b(0x246)][_0x1cf13b(0x250)],'paused':_0x241ea8['attributes'][_0x1cf13b(0x1ef)],'audienceId':_0x241ea8[_0x1cf13b(0x246)]['audienceId'],'folderId':_0x241ea8[_0x1cf13b(0x1e5)]?.['parentFolder']?.[_0x1cf13b(0x209)]?.['id'],'createdAt':_0x241ea8[_0x1cf13b(0x246)]['createdAt'],'updatedAt':_0x241ea8[_0x1cf13b(0x246)]['updatedAt']})),{emailToId:_0x4b3e12,idToEmail:_0x2fedf9}=_0x3a5282,_0x2b1d14=await withSpinner(_0x1cf13b(0x239),async()=>{const _0x347cc9=_0x1cf13b,_0x23fb39=await _0x37311e[_0x347cc9(0x253)][_0x347cc9(0x1b8)]();return buildConnectionMaps(_0x23fb39);},{'verbose':_0x8d9a33['verbose']})[_0x1cf13b(0x237)](_0x4fc834=>_0x4fc834['data']),_0x477a20=_0x2b1d14[_0x1cf13b(0x1b9)],_0x1262b0=_0x2b1d14[_0x1cf13b(0x1eb)],_0x569314=_0x2b1d14[_0x1cf13b(0x1d6)],_0xfecf05={'emailToIdMap':_0x4b3e12,'connectionNameToIdMap':_0x477a20,'connectionNameToTypeMap':_0x569314,'getSchema':_0x3439c3=>_0x37311e['connection'][_0x1cf13b(0x213)](_0x3439c3),'getMetadata':_0x2390c7=>_0x37311e['connection'][_0x1cf13b(0x254)](_0x2390c7)};let {pathToId:_0xd36bbc,idToPath:_0x2ee517}=buildFolderMaps(_0x548ac0);const _0x4dcf22=buildSegmentLookupMap(_0x2c1d52,_0x2ee517),_0x1e203b=buildSegmentNameToIdMap(_0x2c1d52),_0x40a75a=buildJourneyBundleLookupMap(_0x50804a,_0x2ee517);let _0x5e81b3;if(_0x55fbdb){if(!_0x55fbdb[_0x1cf13b(0x21a)](_0x1cf13b(0x1bc))&&!_0x55fbdb['endsWith']('.yaml'))return console['error'](a54_0x5bbac5[_0x1cf13b(0x1d0)](_0x1cf13b(0x242)+_0x55fbdb+'\x0a')),0x1;_0x5e81b3=[_0x55fbdb];}else _0x5e81b3=findYamlFiles(_0x29073d);if(_0x5e81b3[_0x1cf13b(0x23c)]===0x0)return console['error'](a54_0x5bbac5[_0x1cf13b(0x1d0)](_0x1cf13b(0x1b6)+_0x29073d+'\x0a')),console[_0x1cf13b(0x1ec)](a54_0x5bbac5['cyan']('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files')),0x1;let _0x14d20a,_0x324c4f;try{const _0x58363b=parseAndClassifyYamlFiles(_0x5e81b3,_0x29073d,{'skipSegments':_0x8d9a33[_0x1cf13b(0x203)]});_0x14d20a=_0x58363b[_0x1cf13b(0x229)],_0x324c4f=_0x58363b[_0x1cf13b(0x235)];const _0x45ab5c=validateParsedFiles(_0x58363b,_0x29073d);if(_0x45ab5c[_0x1cf13b(0x23c)]>0x0)return console['error'](a54_0x5bbac5[_0x1cf13b(0x1d0)](_0x1cf13b(0x219))),console[_0x1cf13b(0x1ec)](formatValidationErrors(_0x45ab5c)),console[_0x1cf13b(0x1ec)](a54_0x5bbac5[_0x1cf13b(0x21b)]('\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.')),0x1;}catch(_0x26faa3){return console['error'](a54_0x5bbac5[_0x1cf13b(0x1d0)](_0x1cf13b(0x1f4)+(_0x26faa3 instanceof Error?_0x26faa3[_0x1cf13b(0x21c)]:_0x26faa3))),0x1;}if(_0x14d20a[_0x1cf13b(0x23c)]===0x0&&_0x324c4f[_0x1cf13b(0x23c)]===0x0){const _0xe1f3f7=_0x8d9a33['journeysOnly']?_0x1cf13b(0x210):_0x1cf13b(0x20b);return console['error'](a54_0x5bbac5[_0x1cf13b(0x21b)](_0x1cf13b(0x1e8)+_0xe1f3f7+_0x1cf13b(0x1f7))),0x0;}const _0x2dc2d2=new Map();_0x2c1d52[_0x1cf13b(0x23c)]>0x0&&!_0x8d9a33[_0x1cf13b(0x203)]&&await withSpinner(_0x1cf13b(0x211),async()=>{await batchAsync(_0x2c1d52,async _0x157c44=>{const _0x53ba27=a54_0x32a0,_0x45260a=await _0x37311e[_0x53ba27(0x248)][_0x53ba27(0x20f)](_0x5e35d1,_0x157c44['id']);_0x2dc2d2['set'](_0x157c44['id'],_0x45260a);});},{'verbose':_0x8d9a33[_0x1cf13b(0x1cb)]});const {segmentFiles:_0x2c9611,foldersToCreate:_0x1bf5e8}=await prepareSegmentFiles(_0x14d20a,{'segmentByFolderAndName':_0x4dcf22,'activationsBySegmentId':_0x2dc2d2,'folderPathToId':_0xd36bbc,'idToEmailMap':_0x2fedf9,'connectionIdToNameMap':_0x1262b0},_0xfecf05,_0x38d555,_0x4977c1),_0x5df300=_0x55fbdb?[]:findSegmentsToDelete(_0x2c1d52,_0x14d20a['map'](({yamlConfig:_0x1f86a8,folderPath:_0x4aa178})=>({'yamlConfig':_0x1f86a8,'folderPath':resolveTDFolderPath(_0x4aa178,_0x38d555,_0x4977c1)})),_0x2ee517,_0x4977c1,_0x38d555),{journeyFiles:_0x4e9b85,foldersToCreate:_0x19fcd9}=await withProgressSpinner('Preparing\x20journeys...',async _0x52fc57=>prepareJourneyFiles(_0x324c4f,{'fetchJourney':async _0x947341=>_0x37311e['journey'][_0x1cf13b(0x1e6)](_0x947341['journeyId']),'journeyBundlesByFolderAndName':_0x40a75a,'folderPathToId':_0xd36bbc,'idToEmailMap':_0x2fedf9,'connectionIdToNameMap':_0x1262b0,'existingSegments':_0x2c1d52,'parentId':_0x5e35d1,'deps':_0x37311e,'progress':{'update':_0x5e388d=>{const _0x47b432=_0x1cf13b;_0x52fc57[_0x47b432(0x1c7)](_0x5e388d),_0x8d9a33[_0x47b432(0x1cb)]&&console[_0x47b432(0x1ec)]('\x20\x20'+_0x5e388d);}},'journeyById':_0x3bcd87,'activationStepsById':_0xb64c22},_0x38d555,_0x4977c1),{'verbose':_0x8d9a33[_0x1cf13b(0x1cb)]})[_0x1cf13b(0x237)](_0x14822f=>_0x14822f[_0x1cf13b(0x209)]);for(const _0x479520 of _0x19fcd9){_0x1bf5e8[_0x1cf13b(0x1f3)](_0x479520);}const _0x56bb4f=_0x55fbdb?[]:findJourneysToDelete(_0x50804a,_0x324c4f['map'](({yamlConfig:_0x4b7d84,folderPath:_0x6cddac})=>({'yamlConfig':_0x4b7d84,'folderPath':resolveTDFolderPath(_0x6cddac,_0x38d555,_0x4977c1)})),_0x2ee517,_0x4977c1,_0x38d555),_0x51d376=calculatePushStats(_0x2c9611,_0x4e9b85,_0x1bf5e8,_0x5df300,_0x56bb4f,!!_0x8d9a33['delete'],!!_0x8d9a33[_0x1cf13b(0x203)]),_0x3d5b2d=_0x51d376[_0x1cf13b(0x229)][_0x1cf13b(0x223)],_0x25a06e=_0x51d376[_0x1cf13b(0x229)][_0x1cf13b(0x1df)],_0x163812=_0x51d376[_0x1cf13b(0x229)]['unchanged'],_0x4ec406=_0x51d376['segments'][_0x1cf13b(0x1d4)],_0x741f8=_0x51d376[_0x1cf13b(0x215)][_0x1cf13b(0x1fa)],_0xcf99fd=_0x51d376[_0x1cf13b(0x235)][_0x1cf13b(0x223)],_0x420d88=_0x51d376[_0x1cf13b(0x235)][_0x1cf13b(0x1df)],_0x529afa=_0x51d376[_0x1cf13b(0x235)][_0x1cf13b(0x238)],_0x10c67b=_0x51d376['journeys'][_0x1cf13b(0x1d4)],_0x34a9ce=_0x51d376[_0x1cf13b(0x1f5)][_0x1cf13b(0x1cc)],_0x1c908c=_0x51d376[_0x1cf13b(0x1f5)]['toCreate'],_0x3046f8=_0x51d376['activations']['toUpdate'],_0x33374d=_0x51d376[_0x1cf13b(0x1f5)]['toDelete'];console[_0x1cf13b(0x1ec)](_0x1cf13b(0x1e9)+_0xb7bc26+'\x27:');_0x741f8[_0x1cf13b(0x23c)]>0x0&&console['error']('\x20\x20'+a54_0x5bbac5['blue'](_0x1cf13b(0x23d)+_0x741f8[_0x1cf13b(0x23c)]+_0x1cf13b(0x1fe)));if(!_0x8d9a33[_0x1cf13b(0x203)]){console[_0x1cf13b(0x1ec)](_0x1cf13b(0x1d5)),console[_0x1cf13b(0x1ec)](_0x1cf13b(0x1d9)+a54_0x5bbac5[_0x1cf13b(0x20e)]('+\x20'+_0x3d5b2d[_0x1cf13b(0x23c)]+'\x20new')),console[_0x1cf13b(0x1ec)]('\x20\x20\x20\x20'+a54_0x5bbac5[_0x1cf13b(0x21b)]('~\x20'+_0x25a06e[_0x1cf13b(0x23c)]+_0x1cf13b(0x22f)));if(_0x4ec406['length']>0x0)console[_0x1cf13b(0x1ec)](_0x1cf13b(0x1d9)+a54_0x5bbac5[_0x1cf13b(0x1d0)]('-\x20'+_0x4ec406[_0x1cf13b(0x23c)]+_0x1cf13b(0x20a)));else _0x5df300['length']>0x0&&!_0x8d9a33[_0x1cf13b(0x200)]&&console['error'](_0x1cf13b(0x1d9)+a54_0x5bbac5['dim'](_0x5df300[_0x1cf13b(0x23c)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x1cf13b(0x1ec)]('\x20\x20\x20\x20'+a54_0x5bbac5[_0x1cf13b(0x24a)]('=\x20'+_0x163812[_0x1cf13b(0x23c)]+'\x20unchanged'));}if(_0x4e9b85[_0x1cf13b(0x23c)]>0x0||_0x56bb4f[_0x1cf13b(0x23c)]>0x0){console[_0x1cf13b(0x1ec)](_0x1cf13b(0x24f)),console['error'](_0x1cf13b(0x1d9)+a54_0x5bbac5[_0x1cf13b(0x20e)]('+\x20'+_0xcf99fd[_0x1cf13b(0x23c)]+_0x1cf13b(0x1fd))),console['error']('\x20\x20\x20\x20'+a54_0x5bbac5[_0x1cf13b(0x21b)]('~\x20'+_0x420d88['length']+'\x20changed'));if(_0x10c67b[_0x1cf13b(0x23c)]>0x0)console[_0x1cf13b(0x1ec)](_0x1cf13b(0x1d9)+a54_0x5bbac5['red']('-\x20'+_0x10c67b[_0x1cf13b(0x23c)]+_0x1cf13b(0x20a)));else _0x56bb4f[_0x1cf13b(0x23c)]>0x0&&!_0x8d9a33['delete']&&console[_0x1cf13b(0x1ec)](_0x1cf13b(0x1d9)+a54_0x5bbac5['dim'](_0x56bb4f[_0x1cf13b(0x23c)]+_0x1cf13b(0x1dd)));console[_0x1cf13b(0x1ec)](_0x1cf13b(0x1d9)+a54_0x5bbac5[_0x1cf13b(0x24a)]('=\x20'+_0x529afa[_0x1cf13b(0x23c)]+_0x1cf13b(0x243)));}_0x34a9ce[_0x1cf13b(0x23c)]>0x0&&!_0x8d9a33[_0x1cf13b(0x203)]&&(console[_0x1cf13b(0x1ec)](''),console['error'](_0x1cf13b(0x226)),_0x1c908c['length']>0x0&&console[_0x1cf13b(0x1ec)](_0x1cf13b(0x1d9)+a54_0x5bbac5[_0x1cf13b(0x20e)]('+\x20'+_0x1c908c[_0x1cf13b(0x23c)]+_0x1cf13b(0x1e7))),_0x3046f8[_0x1cf13b(0x23c)]>0x0&&console['error'](_0x1cf13b(0x1d9)+a54_0x5bbac5[_0x1cf13b(0x21b)]('~\x20'+_0x3046f8[_0x1cf13b(0x23c)]+_0x1cf13b(0x1f0))),_0x33374d['length']>0x0&&console[_0x1cf13b(0x1ec)](_0x1cf13b(0x1d9)+a54_0x5bbac5[_0x1cf13b(0x1d0)]('-\x20'+_0x33374d[_0x1cf13b(0x23c)]+_0x1cf13b(0x20a))));console[_0x1cf13b(0x1ec)](_0x1cf13b(0x1e1)+a54_0x5bbac5[_0x1cf13b(0x1dc)](_0x29073d)+'\x0a');if(_0x741f8[_0x1cf13b(0x23c)]>0x0){console[_0x1cf13b(0x1ec)]('Folders\x20to\x20create:');for(const _0x56092c of _0x741f8){console['error']('\x20\x20'+a54_0x5bbac5['blue']('+')+'\x20'+_0x56092c);}console[_0x1cf13b(0x1ec)]('');}if(_0x3d5b2d['length']>0x0&&!_0x8d9a33[_0x1cf13b(0x203)])for(const _0x2c7f1e of _0x3d5b2d){const _0x296395=_0x2c7f1e[_0x1cf13b(0x24b)]?_0x2c7f1e[_0x1cf13b(0x24b)]+'/'+_0x2c7f1e[_0x1cf13b(0x1ff)][_0x1cf13b(0x218)]:_0x2c7f1e[_0x1cf13b(0x1ff)][_0x1cf13b(0x218)],_0x73bc33=_0x2c7f1e['yamlConfig'][_0x1cf13b(0x1f5)]?.[_0x1cf13b(0x23c)]||0x0,_0x3a941d=_0x73bc33>0x0?a54_0x5bbac5['dim']('\x20['+_0x73bc33+_0x1cf13b(0x1c4)):'';console['error']('\x0a'+a54_0x5bbac5[_0x1cf13b(0x20e)](_0x1cf13b(0x23b))+'\x20'+_0x296395+_0x3a941d),console['error']('─'[_0x1cf13b(0x1cf)](0x3c)),_0x2c7f1e[_0x1cf13b(0x251)]&&console[_0x1cf13b(0x1ec)](_0x2c7f1e[_0x1cf13b(0x251)]),console[_0x1cf13b(0x1ec)]('─'[_0x1cf13b(0x1cf)](0x3c));}if(_0x4ec406[_0x1cf13b(0x23c)]>0x0&&!_0x8d9a33[_0x1cf13b(0x203)])for(const _0x1613b9 of _0x4ec406){const _0x335298=_0x1613b9['segmentFolderId']?_0x2ee517[_0x1cf13b(0x24c)](_0x1613b9[_0x1cf13b(0x201)]['toString']())||'':'',_0x47f933=_0x335298?_0x335298+'/'+_0x1613b9[_0x1cf13b(0x218)]:_0x1613b9[_0x1cf13b(0x218)],_0x16b512=_0x2dc2d2[_0x1cf13b(0x24c)](_0x1613b9['id'])||[],_0x41b932=_0x16b512[_0x1cf13b(0x23c)]>0x0?a54_0x5bbac5[_0x1cf13b(0x24a)]('\x20['+_0x16b512[_0x1cf13b(0x23c)]+'\x20activations]'):'';console[_0x1cf13b(0x1ec)]('\x0a'+a54_0x5bbac5[_0x1cf13b(0x1d0)](_0x1cf13b(0x233))+'\x20'+_0x47f933+_0x41b932),console['error']('─'[_0x1cf13b(0x1cf)](0x3c));const _0x3f682a=segmentWithActivationsToYaml(_0x1613b9,_0x16b512,undefined,_0x2fedf9,_0x1262b0),_0x55d184=segmentToYamlString(_0x3f682a),_0xae7119=generateDiff(_0x55d184,'');console[_0x1cf13b(0x1ec)](formatDiffWithColors(_0xae7119)),console[_0x1cf13b(0x1ec)]('─'[_0x1cf13b(0x1cf)](0x3c));}const _0x4d1875=_0x2c9611[_0x1cf13b(0x21e)](_0x5c2455=>!_0x5c2455[_0x1cf13b(0x20c)]&&_0x5c2455[_0x1cf13b(0x251)]);if(_0x4d1875[_0x1cf13b(0x23c)]>0x0&&!_0x8d9a33[_0x1cf13b(0x203)])for(const _0x1c40d8 of _0x4d1875){const _0xe92eb9=_0x1c40d8[_0x1cf13b(0x24b)]?_0x1c40d8[_0x1cf13b(0x24b)]+'/'+_0x1c40d8[_0x1cf13b(0x1ff)][_0x1cf13b(0x218)]:_0x1c40d8[_0x1cf13b(0x1ff)][_0x1cf13b(0x218)];console['error']('\x0a'+a54_0x5bbac5[_0x1cf13b(0x21b)](_0x1cf13b(0x1bd))+'\x20'+_0xe92eb9),console[_0x1cf13b(0x1ec)]('─'[_0x1cf13b(0x1cf)](0x3c)),console[_0x1cf13b(0x1ec)](_0x1c40d8[_0x1cf13b(0x251)]),console[_0x1cf13b(0x1ec)]('─'['repeat'](0x3c));}if(_0xcf99fd[_0x1cf13b(0x23c)]>0x0)for(const _0x177278 of _0xcf99fd){const _0x1d02da=_0x177278['folderPath']?_0x177278[_0x1cf13b(0x24b)]+'/'+_0x177278[_0x1cf13b(0x1ff)][_0x1cf13b(0x218)]:_0x177278['yamlConfig'][_0x1cf13b(0x218)];console[_0x1cf13b(0x1ec)]('\x0a'+a54_0x5bbac5[_0x1cf13b(0x20e)](_0x1cf13b(0x214))+'\x20'+_0x1d02da),console[_0x1cf13b(0x1ec)]('─'[_0x1cf13b(0x1cf)](0x3c)),_0x177278[_0x1cf13b(0x251)]&&console[_0x1cf13b(0x1ec)](_0x177278[_0x1cf13b(0x251)]),console[_0x1cf13b(0x1ec)]('─'[_0x1cf13b(0x1cf)](0x3c));}const _0x2ec032=_0x4e9b85[_0x1cf13b(0x21e)](_0x1c1816=>!_0x1c1816[_0x1cf13b(0x20c)]&&_0x1c1816[_0x1cf13b(0x251)]);if(_0x2ec032[_0x1cf13b(0x23c)]>0x0)for(const _0x4c9a0c of _0x2ec032){const _0x54f81d=_0x4c9a0c[_0x1cf13b(0x24b)]?_0x4c9a0c[_0x1cf13b(0x24b)]+'/'+_0x4c9a0c[_0x1cf13b(0x1ff)][_0x1cf13b(0x218)]:_0x4c9a0c['yamlConfig'][_0x1cf13b(0x218)];console[_0x1cf13b(0x1ec)]('\x0a'+a54_0x5bbac5[_0x1cf13b(0x21b)](_0x1cf13b(0x1ee))+'\x20'+_0x54f81d),console[_0x1cf13b(0x1ec)]('─'['repeat'](0x3c)),console[_0x1cf13b(0x1ec)](_0x4c9a0c[_0x1cf13b(0x251)]),console[_0x1cf13b(0x1ec)]('─'['repeat'](0x3c));}if(_0x10c67b[_0x1cf13b(0x23c)]>0x0)for(const _0x3cb879 of _0x10c67b){const _0x2c8bef=_0x3cb879['folderId']?_0x2ee517[_0x1cf13b(0x24c)](_0x3cb879[_0x1cf13b(0x1d8)])||'':'',_0x23c3e0=_0x2c8bef?_0x2c8bef+'/'+_0x3cb879[_0x1cf13b(0x232)]:_0x3cb879['journeyBundleName'];console[_0x1cf13b(0x1ec)]('\x0a'+a54_0x5bbac5[_0x1cf13b(0x1d0)](_0x1cf13b(0x1f9))+'\x20'+_0x23c3e0),console[_0x1cf13b(0x1ec)]('─'[_0x1cf13b(0x1cf)](0x3c)),console['error'](a54_0x5bbac5[_0x1cf13b(0x1d0)](_0x1cf13b(0x257))),console[_0x1cf13b(0x1ec)]('─'[_0x1cf13b(0x1cf)](0x3c));}if(_0x8d9a33[_0x1cf13b(0x1d3)])return console['error'](a54_0x5bbac5[_0x1cf13b(0x21b)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made')),0x0;const _0xfea4f0=_0x8d9a33[_0x1cf13b(0x203)]?![]:_0x3d5b2d[_0x1cf13b(0x23c)]>0x0||_0x25a06e[_0x1cf13b(0x23c)]>0x0||_0x4ec406[_0x1cf13b(0x23c)]>0x0,_0x36fa94=_0xcf99fd[_0x1cf13b(0x23c)]>0x0||_0x420d88[_0x1cf13b(0x23c)]>0x0||_0x10c67b[_0x1cf13b(0x23c)]>0x0,_0x55e4cf=_0x8d9a33[_0x1cf13b(0x203)]?![]:_0x34a9ce[_0x1cf13b(0x23c)]>0x0,_0x33387c=_0x741f8[_0x1cf13b(0x23c)]>0x0;if(!_0xfea4f0&&!_0x36fa94&&!_0x55e4cf&&!_0x33387c){const _0x241f97=_0x8d9a33[_0x1cf13b(0x203)]?_0x1cf13b(0x1b7):_0x1cf13b(0x23e);console[_0x1cf13b(0x1ec)](a54_0x5bbac5[_0x1cf13b(0x20e)](_0x241f97));if(_0x55fbdb&&_0x163812[_0x1cf13b(0x23c)]===0x1){const _0x51ec82=_0x163812[0x0];if(_0x51ec82[_0x1cf13b(0x1c6)]?.['id']){const _0x4bac84=getConsoleNextUrl(_0x8d9a33[_0x1cf13b(0x1c1)],'/app/ps/'+_0x5e35d1+_0x1cf13b(0x204)+_0x51ec82['existingSegment']['id']+'/sb/da/esr');console[_0x1cf13b(0x1ec)](_0x1cf13b(0x1ca)+a54_0x5bbac5['cyan'](_0x4bac84));}}if(_0x55fbdb&&_0x529afa[_0x1cf13b(0x23c)]===0x1){const _0x2ead2a=_0x529afa[0x0];if(_0x2ead2a[_0x1cf13b(0x1e2)]?.['id']){const _0x1a9f99=getConsoleNextUrl(_0x8d9a33[_0x1cf13b(0x1c1)],_0x1cf13b(0x22b)+_0x5e35d1+_0x1cf13b(0x204)+_0x2ead2a[_0x1cf13b(0x1e2)]['id']+'/j/da/je');console['error']('\x20\x20'+a54_0x5bbac5[_0x1cf13b(0x1dc)](_0x1a9f99));}}return 0x0;}const _0x5f1cc4=_0x8d9a33[_0x1cf13b(0x203)]?_0xcf99fd[_0x1cf13b(0x23c)]+_0x420d88[_0x1cf13b(0x23c)]+_0x10c67b['length']+_0x741f8['length']:_0x3d5b2d[_0x1cf13b(0x23c)]+_0x25a06e['length']+_0x4ec406[_0x1cf13b(0x23c)]+_0xcf99fd[_0x1cf13b(0x23c)]+_0x420d88['length']+_0x10c67b[_0x1cf13b(0x23c)]+_0x741f8[_0x1cf13b(0x23c)]+_0x34a9ce[_0x1cf13b(0x23c)];if(!_0x8d9a33[_0x1cf13b(0x1fb)]&&_0x5f1cc4>0x0){if(!isInteractive())return console['error'](a54_0x5bbac5[_0x1cf13b(0x1d0)]('\x0aError:'),_0x1cf13b(0x1bb)),console['error'](a54_0x5bbac5[_0x1cf13b(0x24a)](_0x1cf13b(0x225))),0x1;const _0x4f541d=await confirmKey(_0x1cf13b(0x217)+_0x5f1cc4+_0x1cf13b(0x1be));if(!_0x4f541d)return console[_0x1cf13b(0x1ec)](a54_0x5bbac5[_0x1cf13b(0x21b)]('Aborted.')),0x1;}const _0x45d0ef={'withProgress':async(_0xe129af,_0x29fe52)=>{const _0x4e1cae=_0x1cf13b,_0x2a4ee0=await withSpinner(_0xe129af,_0x29fe52,{'verbose':_0x8d9a33[_0x4e1cae(0x1cb)]});return{'data':_0x2a4ee0['data']};},'logInfo':_0x59f0a1=>console[_0x1cf13b(0x1ec)](a54_0x5bbac5[_0x1cf13b(0x221)]('✔\x20'+_0x59f0a1)),'logSuccess':_0x1355f3=>console[_0x1cf13b(0x1ec)](a54_0x5bbac5[_0x1cf13b(0x20e)]('✔\x20'+_0x1355f3)),'logWarning':_0x1f8fe9=>console[_0x1cf13b(0x1ec)](a54_0x5bbac5[_0x1cf13b(0x21b)]('⚠\x20'+_0x1f8fe9)),'logDeleted':_0xe5addb=>console[_0x1cf13b(0x1ec)](a54_0x5bbac5['red']('✔\x20'+_0xe5addb))},_0x2e93e1={'segment':_0x37311e[_0x1cf13b(0x248)],'journey':_0x37311e[_0x1cf13b(0x210)],'user':_0x37311e[_0x1cf13b(0x256)],'connection':_0x37311e[_0x1cf13b(0x253)]};_0x741f8[_0x1cf13b(0x23c)]>0x0&&(_0xd36bbc=await executePushFolders(_0x2e93e1,_0x741f8,_0xd36bbc,{'parentId':_0x5e35d1},_0x45d0ef));const _0x3bcefa={'rootFolderId':_0x4f8e8a,'folderPathToId':_0xd36bbc,'folderIdToPath':_0x2ee517,'segmentNameToId':_0x1e203b,'activationsBySegmentId':_0x2dc2d2,'emailToIdMap':_0x4b3e12,'idToEmailMap':_0x2fedf9,'connectionNameToIdMap':_0x2b1d14[_0x1cf13b(0x1b9)],'connectionIdToNameMap':_0x2b1d14[_0x1cf13b(0x1eb)],'connectionNameToTypeMap':_0x569314},_0xd755e=await executePushSegments(_0x2e93e1,_0x8d9a33[_0x1cf13b(0x203)]?[]:_0x2c9611,_0x3bcefa,{'parentId':_0x5e35d1},_0x45d0ef),_0x227bcb=_0xd755e[_0x1cf13b(0x1c3)],_0x2d0314=_0xd755e['updated'],_0x5bd0d7=_0xd755e['activations'][_0x1cf13b(0x1c3)],_0x359343=_0xd755e[_0x1cf13b(0x1f5)][_0x1cf13b(0x244)],_0x21b4b2=_0xd755e[_0x1cf13b(0x1f5)][_0x1cf13b(0x1f8)];let _0x54d1ca;if(_0x55fbdb&&_0x2c9611[_0x1cf13b(0x23c)]===0x1){const _0x2bddca=_0x2c9611[0x0];_0x54d1ca=_0x2bddca[_0x1cf13b(0x1c6)]?.['id']??_0xd755e['createdSegmentIds'][_0x1cf13b(0x24c)](_0x2bddca[_0x1cf13b(0x1ff)][_0x1cf13b(0x218)]);}const _0x33021c=await executePushSegmentDeletions(_0x2e93e1,_0x8d9a33[_0x1cf13b(0x203)]?[]:_0x4ec406,_0x45d0ef);let _0x17d846=0x0,_0x8eecb3=0x0,_0x26d1e3=0x0;const _0x1c8fbe=new Map(_0x1e203b);for(const [_0x550566,_0x1ccc8c]of _0xd755e[_0x1cf13b(0x1d1)]){_0x1c8fbe[_0x1cf13b(0x1f2)](_0x550566,_0x1ccc8c);}if(_0x4e9b85[_0x1cf13b(0x23c)]>0x0){const _0x30b547={..._0x3bcefa,'segmentNameToId':_0x1c8fbe,'existingSegments':_0x2c1d52,'activationContext':_0xfecf05},_0x596515=await executePushJourneys(_0x2e93e1,_0x4e9b85,_0x30b547,{'parentId':_0x5e35d1,'rootFolderId':_0x4f8e8a,'verbose':_0x8d9a33['verbose']},_0x45d0ef);_0x17d846=_0x596515[_0x1cf13b(0x1c3)],_0x8eecb3=_0x596515['updated'];if(_0x55fbdb&&_0x596515[_0x1cf13b(0x1fc)][_0x1cf13b(0x23c)]===0x1){const _0x1a68e7=_0x596515[_0x1cf13b(0x1fc)][0x0];if(_0x1a68e7['journeyId']){const _0x542f32=getConsoleNextUrl(_0x8d9a33[_0x1cf13b(0x1c1)],'/app/ps/'+_0x5e35d1+'/e/'+_0x1a68e7['journeyId']+_0x1cf13b(0x1db));console['error']('\x20\x20'+a54_0x5bbac5['cyan'](_0x542f32));}}}for(const _0x4fbb7e of _0x10c67b){console[_0x1cf13b(0x1ec)](a54_0x5bbac5[_0x1cf13b(0x21b)](_0x1cf13b(0x208)+_0x4fbb7e[_0x1cf13b(0x232)])),_0x26d1e3++;}const _0x4dc736=[];if(_0x227bcb>0x0)_0x4dc736[_0x1cf13b(0x252)](_0x227bcb+_0x1cf13b(0x231));if(_0x2d0314>0x0)_0x4dc736['push'](_0x2d0314+_0x1cf13b(0x234));if(_0x33021c>0x0)_0x4dc736['push'](_0x33021c+_0x1cf13b(0x1da));const _0x21782f=[];if(_0x17d846>0x0)_0x21782f[_0x1cf13b(0x252)](_0x17d846+_0x1cf13b(0x231));if(_0x8eecb3>0x0)_0x21782f[_0x1cf13b(0x252)](_0x8eecb3+_0x1cf13b(0x234));if(_0x26d1e3>0x0)_0x21782f[_0x1cf13b(0x252)](_0x26d1e3+_0x1cf13b(0x1da));const _0x348f29=[];if(_0x5bd0d7>0x0)_0x348f29[_0x1cf13b(0x252)](_0x5bd0d7+'\x20created');if(_0x359343>0x0)_0x348f29[_0x1cf13b(0x252)](_0x359343+_0x1cf13b(0x234));if(_0x21b4b2>0x0)_0x348f29[_0x1cf13b(0x252)](_0x21b4b2+_0x1cf13b(0x1da));console['error'](a54_0x5bbac5['green']('\x0a✔\x20Push\x20complete'));_0x4dc736[_0x1cf13b(0x23c)]>0x0&&!_0x8d9a33[_0x1cf13b(0x203)]&&console[_0x1cf13b(0x1ec)](_0x1cf13b(0x1bf)+_0x4dc736[_0x1cf13b(0x227)](',\x20'));_0x21782f[_0x1cf13b(0x23c)]>0x0&&console[_0x1cf13b(0x1ec)]('\x20\x20Journeys:\x20'+_0x21782f['join'](',\x20'));_0x348f29[_0x1cf13b(0x23c)]>0x0&&!_0x8d9a33['journeysOnly']&&console['error'](_0x1cf13b(0x1ce)+_0x348f29['join'](',\x20'));if(_0x54d1ca){const _0x476470=getConsoleNextUrl(_0x8d9a33[_0x1cf13b(0x1c1)],_0x1cf13b(0x22b)+_0x5e35d1+'/e/'+_0x54d1ca+_0x1cf13b(0x249));console[_0x1cf13b(0x1ec)](_0x1cf13b(0x1ca)+a54_0x5bbac5[_0x1cf13b(0x1dc)](_0x476470));}return 0x0;}}function a54_0x59cf(){const _0x34d3a8=['map','\x20created','journeyBundleName','Delete\x20segment:','\x20updated','journeys','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','then','unchanged','Fetching\x20connections\x20for\x20name\x20resolution...','157rvDUWB','New\x20segment:','length','📁\x20','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','Parent\x20segment:\x20','errorCode','segment:push','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','\x20unchanged','updated','isScoped','attributes','Resolving\x20parent\x20segment\x20\x27','segment','/sb/da/esr','dim','folderPath','get','870057LoDPwu','2592TDJUlx','\x20\x20🗺️\x20\x20Journeys:','state','diff','push','connection','getMetadataWithCache','Fetching\x20existing\x20data...','user','(Journey\x20will\x20be\x20deleted)','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','list','nameToId','Scoped\x20to\x20folder:\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','.yml','Changes\x20to:','\x20changes?','\x20\x20Segments:\x20','\x27...','site','listJourneysWithDetailsFromParentSegment','created','\x20activations]','targetDir','existingSegment','setPhase','Error:\x20Directory\x20not\x20found:\x20','description','\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20','verbose','all','152UrCAJc','\x20\x20Activations:\x20','repeat','red','createdSegmentIds','parentName','dryRun','toDelete','\x20\x20📊\x20Segments:','nameToType','helpText','folderId','\x20\x20\x20\x20','\x20deleted','/j/da/je','cyan','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','2786YaxKrp','changed','no_parent','\x20\x20Source:\x20','existingJourney','1818888oFIubZ','listSegments','relationships','getJourney','\x20to\x20create','No\x20','\x0aPush\x20summary\x20for\x20\x27','resolveParentId','idToName','error','execute','Changes\x20to\x20journey:','paused','\x20to\x20update','type','set','add','Error\x20parsing\x20YAML:\x20','activations','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','\x20YAML\x20files\x20found','deleted','Delete\x20journey:','toCreate','yes','results','\x20new','\x20folders\x20to\x20create','yamlConfig','delete','segmentFolderId','22ALjVHN','journeysOnly','/e/','Error:\x20','getParent','parentSegment','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','data','\x20to\x20delete','segment\x20or\x20journey','isNew','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','green','listActivations','journey','Fetching\x20existing\x20activations...','7mtTmzk','getOutputSchemaWithCache','New\x20journey:','folders','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','Push\x20','name','\x0aValidation\x20failed:','endsWith','yellow','message','Push\x20YAML\x20files\x20to\x20Treasure\x20AI\x20as\x20child\x20segments','filter','2421850MgXagf','1260RwVUZF','blue','cwd','new','19191bORrZp','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20\x20Activations:','join','filePath','segments','versionNumber','/app/ps/','153828vanjEU','buildUserMaps','listFolders','\x20changed'];a54_0x59cf=function(){return _0x34d3a8;};return a54_0x59cf();}
1
+ const a55_0x7b511b=a55_0x55d1;(function(_0x1bbab1,_0x43bd4c){const _0x38e27f=a55_0x55d1,_0x59826d=_0x1bbab1();while(!![]){try{const _0x163870=parseInt(_0x38e27f(0x21b))/0x1*(parseInt(_0x38e27f(0x211))/0x2)+parseInt(_0x38e27f(0x216))/0x3+parseInt(_0x38e27f(0x265))/0x4*(-parseInt(_0x38e27f(0x1f6))/0x5)+parseInt(_0x38e27f(0x205))/0x6+parseInt(_0x38e27f(0x20a))/0x7+parseInt(_0x38e27f(0x1df))/0x8*(parseInt(_0x38e27f(0x22a))/0x9)+parseInt(_0x38e27f(0x25e))/0xa*(-parseInt(_0x38e27f(0x209))/0xb);if(_0x163870===_0x43bd4c)break;else _0x59826d['push'](_0x59826d['shift']());}catch(_0x53b23e){_0x59826d['push'](_0x59826d['shift']());}}}(a55_0x317c,0xf145c));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 a55_0x12f718 from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';function a55_0x55d1(_0xe3c7cb,_0xa44853){_0xe3c7cb=_0xe3c7cb-0x1dc;const _0x317c15=a55_0x317c();let _0x55d12a=_0x317c15[_0xe3c7cb];return _0x55d12a;}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{[a55_0x7b511b(0x271)]=a55_0x7b511b(0x253);[a55_0x7b511b(0x266)]=a55_0x7b511b(0x1e0);async['execute'](_0x5a67b8){const _0x175024=a55_0x7b511b,{options:_0x311947,args:_0x45b816,tdx:_0x5804c8}=_0x5a67b8,_0x143a9d=_0x311947,_0x2eddf4=await resolveTarget({'arg':_0x45b816[0x0],'contextParent':_0x311947[_0x175024(0x21c)],'cwd':process[_0x175024(0x21e)]()});if(!isSuccessfulResolution(_0x2eddf4))return _0x2eddf4[_0x175024(0x1f4)]===_0x175024(0x202)?(console[_0x175024(0x1e8)](a55_0x12f718[_0x175024(0x218)](_0x175024(0x22c))),console[_0x175024(0x1e8)](_0x175024(0x245)),console[_0x175024(0x1e8)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent'),console['error'](_0x175024(0x21f))):(console['error'](a55_0x12f718['red'](_0x175024(0x1e5)+_0x2eddf4[_0x175024(0x1fa)]+'\x0a')),_0x2eddf4[_0x175024(0x206)]&&console[_0x175024(0x1e8)](a55_0x12f718['cyan'](_0x2eddf4['helpText']))),0x1;if(_0x2eddf4['type']===_0x175024(0x270))return console[_0x175024(0x1e8)](a55_0x12f718[_0x175024(0x23b)]('Error:\x20Directory\x20not\x20found:\x20'+_0x2eddf4[_0x175024(0x1ef)]+'\x0a')),console[_0x175024(0x1e8)](a55_0x12f718[_0x175024(0x20b)](_0x175024(0x210))),0x1;const _0x2869be=_0x2eddf4['parentName'],_0x3b0006=_0x2eddf4[_0x175024(0x1ef)],_0x26316a=_0x2eddf4[_0x175024(0x1e1)]===_0x175024(0x260)?_0x2eddf4[_0x175024(0x26f)]:undefined,_0x409104=getScopedDetails(_0x2eddf4),_0x21102b=_0x409104?.[_0x175024(0x24a)]??![],_0x43e80c=_0x409104?.[_0x175024(0x249)]??'';if(!existsSync(_0x3b0006))return console[_0x175024(0x1e8)](a55_0x12f718[_0x175024(0x23b)]('Error:\x20Directory\x20not\x20found:\x20'+_0x3b0006+'\x0a')),console['error'](a55_0x12f718['cyan']('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;_0x143a9d[_0x175024(0x1e2)]&&(console[_0x175024(0x1e8)](_0x175024(0x1e7)+_0x143a9d['site']),console[_0x175024(0x1e8)]('Parent\x20segment:\x20'+_0x2869be),console[_0x175024(0x1e8)](_0x175024(0x238)+_0x3b0006),_0x21102b&&console[_0x175024(0x1e8)](_0x175024(0x26a)+_0x43e80c));const _0x53127a=await withSpinner(_0x175024(0x1fc)+_0x2869be+_0x175024(0x25f),()=>_0x5804c8[_0x175024(0x262)]['resolveParentId'](_0x2869be),{'verbose':_0x143a9d[_0x175024(0x1e2)]}),_0x25a2cd=_0x53127a[_0x175024(0x277)],{parentSegmentResult:_0x3c8040,segmentsResult:_0x498db8,foldersResult:_0x3c48dc,journeysWithDetailsResult:_0x4ec7c1,userMaps:_0x3173d3}=await withSpinner('Fetching\x20existing\x20data...',async()=>{const _0x286eb0=_0x175024,[_0xb82e5a,_0x82b754,_0x317f06,_0x54062d,_0x37f0ba]=await Promise[_0x286eb0(0x23f)]([_0x5804c8[_0x286eb0(0x262)][_0x286eb0(0x200)](_0x25a2cd),_0x5804c8['segment']['listSegments'](_0x25a2cd),_0x5804c8[_0x286eb0(0x262)][_0x286eb0(0x208)](_0x25a2cd),_0x5804c8[_0x286eb0(0x234)][_0x286eb0(0x214)](_0x25a2cd,{'includeAllVersions':!![]}),_0x5804c8[_0x286eb0(0x22f)][_0x286eb0(0x25d)]()]);return{'parentSegmentResult':_0xb82e5a,'segmentsResult':_0x82b754,'foldersResult':_0x317f06,'journeysWithDetailsResult':_0x54062d,'userMaps':_0x37f0ba};},{'verbose':_0x143a9d['verbose']})[_0x175024(0x272)](_0x1d0198=>_0x1d0198[_0x175024(0x277)]),_0x11d20d=_0x3c8040,_0x1c92a9=extractRootFolderId(_0x11d20d),_0x5af5bd=_0x498db8,_0x1cb598=_0x3c48dc,{journeys:_0x217888,activationStepsById:_0x14c417}=_0x4ec7c1,_0x4118f8=new Map(_0x217888['map'](_0x1ecff2=>[_0x1ecff2['id'],_0x1ecff2])),_0x2e9f11=_0x217888[_0x175024(0x212)](_0x3f3e98=>({'id':_0x3f3e98['id'],'name':_0x3f3e98['attributes']['name'],'journeyBundleName':_0x3f3e98[_0x175024(0x268)][_0x175024(0x1f3)]||'','journeyBundleId':_0x3f3e98[_0x175024(0x268)][_0x175024(0x25b)]||'','versionNumber':_0x3f3e98[_0x175024(0x268)]['versionNumber'],'description':_0x3f3e98[_0x175024(0x268)][_0x175024(0x266)],'state':_0x3f3e98[_0x175024(0x268)][_0x175024(0x1eb)],'paused':_0x3f3e98[_0x175024(0x268)][_0x175024(0x25c)],'audienceId':_0x3f3e98[_0x175024(0x268)][_0x175024(0x215)],'folderId':_0x3f3e98[_0x175024(0x246)]?.[_0x175024(0x222)]?.['data']?.['id'],'createdAt':_0x3f3e98['attributes']['createdAt'],'updatedAt':_0x3f3e98[_0x175024(0x268)][_0x175024(0x226)]})),{emailToId:_0x275c87,idToEmail:_0x131eff}=_0x3173d3,_0x50dec2=await withSpinner(_0x175024(0x225),async()=>{const _0x441a0d=_0x175024,_0x238d07=await _0x5804c8[_0x441a0d(0x23a)][_0x441a0d(0x263)]();return buildConnectionMaps(_0x238d07);},{'verbose':_0x143a9d[_0x175024(0x1e2)]})['then'](_0x38ad30=>_0x38ad30['data']),_0x479330=_0x50dec2[_0x175024(0x269)],_0x3d4431=_0x50dec2[_0x175024(0x1de)],_0x352f11=_0x50dec2[_0x175024(0x228)],_0x20ab22={'emailToIdMap':_0x275c87,'connectionNameToIdMap':_0x479330,'connectionNameToTypeMap':_0x352f11,'getSchema':_0x1bd4a9=>_0x5804c8[_0x175024(0x23a)][_0x175024(0x24b)](_0x1bd4a9),'getMetadata':_0x21f16c=>_0x5804c8['connection']['getMetadataWithCache'](_0x21f16c)};let {pathToId:_0x1d475f,idToPath:_0x2a8e8e}=buildFolderMaps(_0x1cb598);const _0x28c596=buildSegmentLookupMap(_0x5af5bd,_0x2a8e8e),_0x538d21=buildSegmentNameToIdMap(_0x5af5bd),_0x1fa2ac=buildJourneyBundleLookupMap(_0x2e9f11,_0x2a8e8e);let _0x2fb20b;if(_0x26316a){if(!_0x26316a['endsWith'](_0x175024(0x221))&&!_0x26316a[_0x175024(0x240)](_0x175024(0x213)))return console[_0x175024(0x1e8)](a55_0x12f718[_0x175024(0x23b)](_0x175024(0x248)+_0x26316a+'\x0a')),0x1;_0x2fb20b=[_0x26316a];}else _0x2fb20b=findYamlFiles(_0x3b0006);if(_0x2fb20b['length']===0x0)return console[_0x175024(0x1e8)](a55_0x12f718[_0x175024(0x23b)](_0x175024(0x267)+_0x3b0006+'\x0a')),console[_0x175024(0x1e8)](a55_0x12f718[_0x175024(0x20b)](_0x175024(0x279))),0x1;let _0x518cb6,_0x26a88c;try{const _0x3fe462=parseAndClassifyYamlFiles(_0x2fb20b,_0x3b0006,{'skipSegments':_0x143a9d[_0x175024(0x237)]});_0x518cb6=_0x3fe462[_0x175024(0x235)],_0x26a88c=_0x3fe462[_0x175024(0x1dc)];const _0x1a5311=validateParsedFiles(_0x3fe462,_0x3b0006);if(_0x1a5311[_0x175024(0x224)]>0x0)return console[_0x175024(0x1e8)](a55_0x12f718['red']('\x0aValidation\x20failed:')),console[_0x175024(0x1e8)](formatValidationErrors(_0x1a5311)),console[_0x175024(0x1e8)](a55_0x12f718['yellow'](_0x175024(0x1e9))),0x1;}catch(_0x3ebff1){return console[_0x175024(0x1e8)](a55_0x12f718[_0x175024(0x23b)](_0x175024(0x274)+(_0x3ebff1 instanceof Error?_0x3ebff1[_0x175024(0x1fa)]:_0x3ebff1))),0x1;}if(_0x518cb6['length']===0x0&&_0x26a88c[_0x175024(0x224)]===0x0){const _0x34ca38=_0x143a9d['journeysOnly']?'journey':_0x175024(0x252);return console[_0x175024(0x1e8)](a55_0x12f718['yellow'](_0x175024(0x1ed)+_0x34ca38+_0x175024(0x26d))),0x0;}const _0x36692c=new Map();_0x5af5bd[_0x175024(0x224)]>0x0&&!_0x143a9d['journeysOnly']&&await withSpinner(_0x175024(0x1fe),async()=>{await batchAsync(_0x5af5bd,async _0x1e66ca=>{const _0x305e0f=a55_0x55d1,_0x50e098=await _0x5804c8['segment'][_0x305e0f(0x22e)](_0x25a2cd,_0x1e66ca['id']);_0x36692c['set'](_0x1e66ca['id'],_0x50e098);});},{'verbose':_0x143a9d[_0x175024(0x1e2)]});const {segmentFiles:_0xea7a00,foldersToCreate:_0x2b549e}=await prepareSegmentFiles(_0x518cb6,{'segmentByFolderAndName':_0x28c596,'activationsBySegmentId':_0x36692c,'folderPathToId':_0x1d475f,'idToEmailMap':_0x131eff,'connectionIdToNameMap':_0x3d4431},_0x20ab22,_0x21102b,_0x43e80c),_0x46c021=_0x26316a?[]:findSegmentsToDelete(_0x5af5bd,_0x518cb6[_0x175024(0x212)](({yamlConfig:_0x3bcc3c,folderPath:_0x4ec712})=>({'yamlConfig':_0x3bcc3c,'folderPath':resolveTDFolderPath(_0x4ec712,_0x21102b,_0x43e80c)})),_0x2a8e8e,_0x43e80c,_0x21102b),{journeyFiles:_0x4d4d95,foldersToCreate:_0x530955}=await withProgressSpinner(_0x175024(0x26c),async _0xa92db8=>prepareJourneyFiles(_0x26a88c,{'fetchJourney':async _0x1249fe=>_0x5804c8[_0x175024(0x234)][_0x175024(0x23d)](_0x1249fe[_0x175024(0x244)]),'journeyBundlesByFolderAndName':_0x1fa2ac,'folderPathToId':_0x1d475f,'idToEmailMap':_0x131eff,'connectionIdToNameMap':_0x3d4431,'existingSegments':_0x5af5bd,'parentId':_0x25a2cd,'deps':_0x5804c8,'progress':{'update':_0x87fcbb=>{const _0x22e9db=_0x175024;_0xa92db8[_0x22e9db(0x258)](_0x87fcbb),_0x143a9d[_0x22e9db(0x1e2)]&&console[_0x22e9db(0x1e8)]('\x20\x20'+_0x87fcbb);}},'journeyById':_0x4118f8,'activationStepsById':_0x14c417},_0x21102b,_0x43e80c),{'verbose':_0x143a9d[_0x175024(0x1e2)]})[_0x175024(0x272)](_0x7cb77b=>_0x7cb77b['data']);for(const _0x522882 of _0x530955){_0x2b549e['add'](_0x522882);}const _0x512ea5=_0x26316a?[]:findJourneysToDelete(_0x2e9f11,_0x26a88c[_0x175024(0x212)](({yamlConfig:_0x596043,folderPath:_0x483271})=>({'yamlConfig':_0x596043,'folderPath':resolveTDFolderPath(_0x483271,_0x21102b,_0x43e80c)})),_0x2a8e8e,_0x43e80c,_0x21102b),_0x340315=calculatePushStats(_0xea7a00,_0x4d4d95,_0x2b549e,_0x46c021,_0x512ea5,!!_0x143a9d[_0x175024(0x257)],!!_0x143a9d[_0x175024(0x237)]),_0x33353f=_0x340315[_0x175024(0x235)][_0x175024(0x250)],_0x1ae4d4=_0x340315['segments']['changed'],_0x51e345=_0x340315[_0x175024(0x235)][_0x175024(0x223)],_0x112f69=_0x340315['segments']['toDelete'],_0x5bad2a=_0x340315[_0x175024(0x25a)][_0x175024(0x204)],_0x56a825=_0x340315[_0x175024(0x1dc)][_0x175024(0x250)],_0x3f1c9e=_0x340315[_0x175024(0x1dc)]['changed'],_0x1dfe8e=_0x340315['journeys'][_0x175024(0x223)],_0x59ec30=_0x340315[_0x175024(0x1dc)][_0x175024(0x20c)],_0x27f159=_0x340315[_0x175024(0x276)][_0x175024(0x23f)],_0x457b25=_0x340315[_0x175024(0x276)][_0x175024(0x204)],_0x3accea=_0x340315[_0x175024(0x276)][_0x175024(0x278)],_0x33fc28=_0x340315['activations']['toDelete'];console[_0x175024(0x1e8)](_0x175024(0x247)+_0x2869be+'\x27:');_0x5bad2a[_0x175024(0x224)]>0x0&&console[_0x175024(0x1e8)]('\x20\x20'+a55_0x12f718[_0x175024(0x256)](_0x175024(0x275)+_0x5bad2a[_0x175024(0x224)]+_0x175024(0x22d)));if(!_0x143a9d['journeysOnly']){console['error']('\x20\x20📊\x20Segments:'),console['error'](_0x175024(0x1f8)+a55_0x12f718[_0x175024(0x264)]('+\x20'+_0x33353f[_0x175024(0x224)]+_0x175024(0x24f))),console[_0x175024(0x1e8)](_0x175024(0x1f8)+a55_0x12f718[_0x175024(0x218)]('~\x20'+_0x1ae4d4[_0x175024(0x224)]+_0x175024(0x1f1)));if(_0x112f69[_0x175024(0x224)]>0x0)console[_0x175024(0x1e8)](_0x175024(0x1f8)+a55_0x12f718[_0x175024(0x23b)]('-\x20'+_0x112f69[_0x175024(0x224)]+_0x175024(0x24c)));else _0x46c021[_0x175024(0x224)]>0x0&&!_0x143a9d[_0x175024(0x257)]&&console['error'](_0x175024(0x1f8)+a55_0x12f718[_0x175024(0x1f5)](_0x46c021['length']+_0x175024(0x236)));console['error'](_0x175024(0x1f8)+a55_0x12f718[_0x175024(0x1f5)]('=\x20'+_0x51e345[_0x175024(0x224)]+_0x175024(0x26e)));}if(_0x4d4d95[_0x175024(0x224)]>0x0||_0x512ea5[_0x175024(0x224)]>0x0){console[_0x175024(0x1e8)](_0x175024(0x1fb)),console[_0x175024(0x1e8)](_0x175024(0x1f8)+a55_0x12f718['green']('+\x20'+_0x56a825[_0x175024(0x224)]+'\x20new')),console[_0x175024(0x1e8)](_0x175024(0x1f8)+a55_0x12f718[_0x175024(0x218)]('~\x20'+_0x3f1c9e[_0x175024(0x224)]+_0x175024(0x1f1)));if(_0x59ec30['length']>0x0)console[_0x175024(0x1e8)](_0x175024(0x1f8)+a55_0x12f718[_0x175024(0x23b)]('-\x20'+_0x59ec30['length']+_0x175024(0x24c)));else _0x512ea5[_0x175024(0x224)]>0x0&&!_0x143a9d[_0x175024(0x257)]&&console[_0x175024(0x1e8)](_0x175024(0x1f8)+a55_0x12f718[_0x175024(0x1f5)](_0x512ea5[_0x175024(0x224)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console['error'](_0x175024(0x1f8)+a55_0x12f718[_0x175024(0x1f5)]('=\x20'+_0x1dfe8e['length']+_0x175024(0x26e)));}_0x27f159[_0x175024(0x224)]>0x0&&!_0x143a9d[_0x175024(0x237)]&&(console[_0x175024(0x1e8)](''),console[_0x175024(0x1e8)]('\x20\x20Activations:'),_0x457b25[_0x175024(0x224)]>0x0&&console['error'](_0x175024(0x1f8)+a55_0x12f718[_0x175024(0x264)]('+\x20'+_0x457b25[_0x175024(0x224)]+'\x20to\x20create')),_0x3accea[_0x175024(0x224)]>0x0&&console[_0x175024(0x1e8)]('\x20\x20\x20\x20'+a55_0x12f718[_0x175024(0x218)]('~\x20'+_0x3accea[_0x175024(0x224)]+_0x175024(0x21a))),_0x33fc28[_0x175024(0x224)]>0x0&&console[_0x175024(0x1e8)](_0x175024(0x1f8)+a55_0x12f718['red']('-\x20'+_0x33fc28[_0x175024(0x224)]+_0x175024(0x24c))));console[_0x175024(0x1e8)](_0x175024(0x261)+a55_0x12f718['cyan'](_0x3b0006)+'\x0a');if(_0x5bad2a[_0x175024(0x224)]>0x0){console['error'](_0x175024(0x243));for(const _0x5262f6 of _0x5bad2a){console['error']('\x20\x20'+a55_0x12f718['blue']('+')+'\x20'+_0x5262f6);}console[_0x175024(0x1e8)]('');}if(_0x33353f[_0x175024(0x224)]>0x0&&!_0x143a9d[_0x175024(0x237)])for(const _0x29437d of _0x33353f){const _0x2f11b7=_0x29437d['folderPath']?_0x29437d[_0x175024(0x1ee)]+'/'+_0x29437d[_0x175024(0x273)][_0x175024(0x271)]:_0x29437d[_0x175024(0x273)][_0x175024(0x271)],_0x144c02=_0x29437d[_0x175024(0x273)][_0x175024(0x276)]?.[_0x175024(0x224)]||0x0,_0x208b1c=_0x144c02>0x0?a55_0x12f718[_0x175024(0x1f5)]('\x20['+_0x144c02+_0x175024(0x233)):'';console[_0x175024(0x1e8)]('\x0a'+a55_0x12f718[_0x175024(0x264)]('New\x20segment:')+'\x20'+_0x2f11b7+_0x208b1c),console[_0x175024(0x1e8)]('─'[_0x175024(0x217)](0x3c)),_0x29437d['diff']&&console[_0x175024(0x1e8)](_0x29437d[_0x175024(0x1f0)]),console['error']('─'[_0x175024(0x217)](0x3c));}if(_0x112f69[_0x175024(0x224)]>0x0&&!_0x143a9d[_0x175024(0x237)])for(const _0x69485c of _0x112f69){const _0x1acc2f=_0x69485c['segmentFolderId']?_0x2a8e8e['get'](_0x69485c['segmentFolderId'][_0x175024(0x1e6)]())||'':'',_0x444e47=_0x1acc2f?_0x1acc2f+'/'+_0x69485c['name']:_0x69485c[_0x175024(0x271)],_0x4be3a2=_0x36692c['get'](_0x69485c['id'])||[],_0x1d3fee=_0x4be3a2['length']>0x0?a55_0x12f718[_0x175024(0x1f5)]('\x20['+_0x4be3a2[_0x175024(0x224)]+_0x175024(0x233)):'';console['error']('\x0a'+a55_0x12f718[_0x175024(0x23b)](_0x175024(0x1ff))+'\x20'+_0x444e47+_0x1d3fee),console[_0x175024(0x1e8)]('─'[_0x175024(0x217)](0x3c));const _0x4ea129=segmentWithActivationsToYaml(_0x69485c,_0x4be3a2,undefined,_0x131eff,_0x3d4431),_0x422e4c=segmentToYamlString(_0x4ea129),_0x3b0fb9=generateDiff(_0x422e4c,'');console['error'](formatDiffWithColors(_0x3b0fb9)),console['error']('─'[_0x175024(0x217)](0x3c));}const _0x2502d8=_0xea7a00[_0x175024(0x1e3)](_0x1981ce=>!_0x1981ce[_0x175024(0x23c)]&&_0x1981ce[_0x175024(0x1f0)]);if(_0x2502d8['length']>0x0&&!_0x143a9d['journeysOnly'])for(const _0x4b269e of _0x2502d8){const _0x35f883=_0x4b269e[_0x175024(0x1ee)]?_0x4b269e['folderPath']+'/'+_0x4b269e[_0x175024(0x273)][_0x175024(0x271)]:_0x4b269e['yamlConfig'][_0x175024(0x271)];console['error']('\x0a'+a55_0x12f718[_0x175024(0x218)]('Changes\x20to:')+'\x20'+_0x35f883),console[_0x175024(0x1e8)]('─'['repeat'](0x3c)),console[_0x175024(0x1e8)](_0x4b269e[_0x175024(0x1f0)]),console['error']('─'['repeat'](0x3c));}if(_0x56a825[_0x175024(0x224)]>0x0)for(const _0x3ccddb of _0x56a825){const _0x553304=_0x3ccddb[_0x175024(0x1ee)]?_0x3ccddb['folderPath']+'/'+_0x3ccddb[_0x175024(0x273)][_0x175024(0x271)]:_0x3ccddb[_0x175024(0x273)][_0x175024(0x271)];console['error']('\x0a'+a55_0x12f718[_0x175024(0x264)]('New\x20journey:')+'\x20'+_0x553304),console['error']('─'[_0x175024(0x217)](0x3c)),_0x3ccddb[_0x175024(0x1f0)]&&console[_0x175024(0x1e8)](_0x3ccddb['diff']),console[_0x175024(0x1e8)]('─'[_0x175024(0x217)](0x3c));}const _0x307189=_0x4d4d95[_0x175024(0x1e3)](_0x42f744=>!_0x42f744['isNew']&&_0x42f744[_0x175024(0x1f0)]);if(_0x307189[_0x175024(0x224)]>0x0)for(const _0x3e4f9a of _0x307189){const _0x2f8dfc=_0x3e4f9a[_0x175024(0x1ee)]?_0x3e4f9a['folderPath']+'/'+_0x3e4f9a[_0x175024(0x273)][_0x175024(0x271)]:_0x3e4f9a[_0x175024(0x273)][_0x175024(0x271)];console['error']('\x0a'+a55_0x12f718['yellow']('Changes\x20to\x20journey:')+'\x20'+_0x2f8dfc),console[_0x175024(0x1e8)]('─'[_0x175024(0x217)](0x3c)),console[_0x175024(0x1e8)](_0x3e4f9a[_0x175024(0x1f0)]),console['error']('─'[_0x175024(0x217)](0x3c));}if(_0x59ec30[_0x175024(0x224)]>0x0)for(const _0x19f586 of _0x59ec30){const _0x2889ae=_0x19f586[_0x175024(0x230)]?_0x2a8e8e['get'](_0x19f586[_0x175024(0x230)])||'':'',_0x19cd28=_0x2889ae?_0x2889ae+'/'+_0x19f586[_0x175024(0x1f3)]:_0x19f586[_0x175024(0x1f3)];console[_0x175024(0x1e8)]('\x0a'+a55_0x12f718[_0x175024(0x23b)](_0x175024(0x22b))+'\x20'+_0x19cd28),console[_0x175024(0x1e8)]('─'['repeat'](0x3c)),console['error'](a55_0x12f718[_0x175024(0x23b)](_0x175024(0x239))),console[_0x175024(0x1e8)]('─'[_0x175024(0x217)](0x3c));}if(_0x143a9d['dryRun'])return console['error'](a55_0x12f718[_0x175024(0x218)](_0x175024(0x1ea))),0x0;const _0x1ad57d=_0x143a9d[_0x175024(0x237)]?![]:_0x33353f[_0x175024(0x224)]>0x0||_0x1ae4d4[_0x175024(0x224)]>0x0||_0x112f69[_0x175024(0x224)]>0x0,_0x186d27=_0x56a825[_0x175024(0x224)]>0x0||_0x3f1c9e['length']>0x0||_0x59ec30[_0x175024(0x224)]>0x0,_0x213a5a=_0x143a9d[_0x175024(0x237)]?![]:_0x27f159[_0x175024(0x224)]>0x0,_0x438dfc=_0x5bad2a[_0x175024(0x224)]>0x0;if(!_0x1ad57d&&!_0x186d27&&!_0x213a5a&&!_0x438dfc){const _0x376d22=_0x143a9d[_0x175024(0x237)]?_0x175024(0x1ec):'✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date';console[_0x175024(0x1e8)](a55_0x12f718['green'](_0x376d22));if(_0x26316a&&_0x51e345[_0x175024(0x224)]===0x1){const _0x5505da=_0x51e345[0x0];if(_0x5505da[_0x175024(0x231)]?.['id']){const _0xe7dcdb=getConsoleNextUrl(_0x143a9d['site'],_0x175024(0x207)+_0x25a2cd+'/e/'+_0x5505da[_0x175024(0x231)]['id']+'/sb/da/esr');console[_0x175024(0x1e8)](_0x175024(0x20d)+a55_0x12f718['cyan'](_0xe7dcdb));}}if(_0x26316a&&_0x1dfe8e['length']===0x1){const _0x586182=_0x1dfe8e[0x0];if(_0x586182[_0x175024(0x1dd)]?.['id']){const _0x324b02=getConsoleNextUrl(_0x143a9d[_0x175024(0x26b)],_0x175024(0x207)+_0x25a2cd+_0x175024(0x227)+_0x586182['existingJourney']['id']+'/j/da/je');console[_0x175024(0x1e8)]('\x20\x20'+a55_0x12f718[_0x175024(0x20b)](_0x324b02));}}return 0x0;}const _0x3df1c4=_0x143a9d['journeysOnly']?_0x56a825[_0x175024(0x224)]+_0x3f1c9e['length']+_0x59ec30[_0x175024(0x224)]+_0x5bad2a[_0x175024(0x224)]:_0x33353f[_0x175024(0x224)]+_0x1ae4d4[_0x175024(0x224)]+_0x112f69[_0x175024(0x224)]+_0x56a825[_0x175024(0x224)]+_0x3f1c9e[_0x175024(0x224)]+_0x59ec30['length']+_0x5bad2a['length']+_0x27f159[_0x175024(0x224)];if(!_0x143a9d[_0x175024(0x1e4)]&&_0x3df1c4>0x0){if(!isInteractive())return console['error'](a55_0x12f718['red'](_0x175024(0x1f7)),_0x175024(0x254)),console[_0x175024(0x1e8)](a55_0x12f718[_0x175024(0x1f5)](_0x175024(0x203))),0x1;const _0x4d6500=await confirmKey(_0x175024(0x255)+_0x3df1c4+_0x175024(0x20f));if(!_0x4d6500)return console[_0x175024(0x1e8)](a55_0x12f718[_0x175024(0x218)](_0x175024(0x232))),0x1;}const _0x4da282={'withProgress':async(_0x458c2e,_0x18a846)=>{const _0x438627=_0x175024,_0x1ec54a=await withSpinner(_0x458c2e,_0x18a846,{'verbose':_0x143a9d[_0x438627(0x1e2)]});return{'data':_0x1ec54a[_0x438627(0x277)]};},'logInfo':_0x5544f3=>console[_0x175024(0x1e8)](a55_0x12f718[_0x175024(0x256)]('✔\x20'+_0x5544f3)),'logSuccess':_0xdd8d3=>console[_0x175024(0x1e8)](a55_0x12f718[_0x175024(0x264)]('✔\x20'+_0xdd8d3)),'logWarning':_0x3446d4=>console[_0x175024(0x1e8)](a55_0x12f718[_0x175024(0x218)]('⚠\x20'+_0x3446d4)),'logDeleted':_0xdf8d09=>console[_0x175024(0x1e8)](a55_0x12f718[_0x175024(0x23b)]('✔\x20'+_0xdf8d09))},_0x256056={'segment':_0x5804c8[_0x175024(0x262)],'journey':_0x5804c8['journey'],'user':_0x5804c8[_0x175024(0x22f)],'connection':_0x5804c8[_0x175024(0x23a)]};_0x5bad2a[_0x175024(0x224)]>0x0&&(_0x1d475f=await executePushFolders(_0x256056,_0x5bad2a,_0x1d475f,{'parentId':_0x25a2cd},_0x4da282));const _0x102cd2={'rootFolderId':_0x1c92a9,'folderPathToId':_0x1d475f,'folderIdToPath':_0x2a8e8e,'segmentNameToId':_0x538d21,'activationsBySegmentId':_0x36692c,'emailToIdMap':_0x275c87,'idToEmailMap':_0x131eff,'connectionNameToIdMap':_0x50dec2[_0x175024(0x269)],'connectionIdToNameMap':_0x50dec2[_0x175024(0x1de)],'connectionNameToTypeMap':_0x352f11},_0x27ddd9=await executePushSegments(_0x256056,_0x143a9d[_0x175024(0x237)]?[]:_0xea7a00,_0x102cd2,{'parentId':_0x25a2cd},_0x4da282),_0x8452fb=_0x27ddd9[_0x175024(0x21d)],_0x2d5ef2=_0x27ddd9['updated'],_0x57c9f3=_0x27ddd9[_0x175024(0x276)][_0x175024(0x21d)],_0x2df9fe=_0x27ddd9[_0x175024(0x276)]['updated'],_0x32e30=_0x27ddd9[_0x175024(0x276)]['deleted'];let _0x798477;if(_0x26316a&&_0xea7a00[_0x175024(0x224)]===0x1){const _0x1c25d2=_0xea7a00[0x0];_0x798477=_0x1c25d2[_0x175024(0x231)]?.['id']??_0x27ddd9[_0x175024(0x1f9)]['get'](_0x1c25d2[_0x175024(0x273)][_0x175024(0x271)]);}const _0x277885=await executePushSegmentDeletions(_0x256056,_0x143a9d[_0x175024(0x237)]?[]:_0x112f69,_0x4da282);let _0x42cca3=0x0,_0xb7a30=0x0,_0x45a9a1=0x0;const _0x1eaf22=new Map(_0x538d21);for(const [_0x375e92,_0xb6895f]of _0x27ddd9[_0x175024(0x1f9)]){_0x1eaf22[_0x175024(0x241)](_0x375e92,_0xb6895f);}if(_0x4d4d95[_0x175024(0x224)]>0x0){const _0x396309={..._0x102cd2,'segmentNameToId':_0x1eaf22,'existingSegments':_0x5af5bd,'activationContext':_0x20ab22},_0x5bd1b2=await executePushJourneys(_0x256056,_0x4d4d95,_0x396309,{'parentId':_0x25a2cd,'rootFolderId':_0x1c92a9,'verbose':_0x143a9d['verbose']},_0x4da282);_0x42cca3=_0x5bd1b2[_0x175024(0x21d)],_0xb7a30=_0x5bd1b2[_0x175024(0x242)];if(_0x26316a&&_0x5bd1b2[_0x175024(0x229)][_0x175024(0x224)]===0x1){const _0x4c454f=_0x5bd1b2['results'][0x0];if(_0x4c454f[_0x175024(0x244)]){const _0xd867eb=getConsoleNextUrl(_0x143a9d[_0x175024(0x26b)],_0x175024(0x207)+_0x25a2cd+'/e/'+_0x4c454f[_0x175024(0x244)]+_0x175024(0x259));console[_0x175024(0x1e8)]('\x20\x20'+a55_0x12f718[_0x175024(0x20b)](_0xd867eb));}}}for(const _0x49541a of _0x59ec30){console['error'](a55_0x12f718['yellow'](_0x175024(0x251)+_0x49541a['journeyBundleName'])),_0x45a9a1++;}const _0x2d7b64=[];if(_0x8452fb>0x0)_0x2d7b64[_0x175024(0x20e)](_0x8452fb+_0x175024(0x220));if(_0x2d5ef2>0x0)_0x2d7b64[_0x175024(0x20e)](_0x2d5ef2+'\x20updated');if(_0x277885>0x0)_0x2d7b64[_0x175024(0x20e)](_0x277885+_0x175024(0x1fd));const _0x49f934=[];if(_0x42cca3>0x0)_0x49f934[_0x175024(0x20e)](_0x42cca3+'\x20created');if(_0xb7a30>0x0)_0x49f934[_0x175024(0x20e)](_0xb7a30+_0x175024(0x1f2));if(_0x45a9a1>0x0)_0x49f934['push'](_0x45a9a1+_0x175024(0x1fd));const _0x223a97=[];if(_0x57c9f3>0x0)_0x223a97[_0x175024(0x20e)](_0x57c9f3+'\x20created');if(_0x2df9fe>0x0)_0x223a97[_0x175024(0x20e)](_0x2df9fe+'\x20updated');if(_0x32e30>0x0)_0x223a97['push'](_0x32e30+_0x175024(0x1fd));console['error'](a55_0x12f718[_0x175024(0x264)](_0x175024(0x24e)));_0x2d7b64[_0x175024(0x224)]>0x0&&!_0x143a9d[_0x175024(0x237)]&&console[_0x175024(0x1e8)]('\x20\x20Segments:\x20'+_0x2d7b64[_0x175024(0x24d)](',\x20'));_0x49f934[_0x175024(0x224)]>0x0&&console[_0x175024(0x1e8)](_0x175024(0x201)+_0x49f934['join'](',\x20'));_0x223a97['length']>0x0&&!_0x143a9d[_0x175024(0x237)]&&console[_0x175024(0x1e8)](_0x175024(0x219)+_0x223a97['join'](',\x20'));if(_0x798477){const _0x2c7b10=getConsoleNextUrl(_0x143a9d[_0x175024(0x26b)],_0x175024(0x207)+_0x25a2cd+_0x175024(0x227)+_0x798477+_0x175024(0x23e));console[_0x175024(0x1e8)](_0x175024(0x20d)+a55_0x12f718[_0x175024(0x20b)](_0x2c7b10));}return 0x0;}}function a55_0x317c(){const _0x47a14f=['listJourneysWithDetailsFromParentSegment','audienceId','4497522wVrjXn','repeat','yellow','\x20\x20Activations:\x20','\x20to\x20update','3254CfYVBu','parentSegment','created','cwd','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','\x20created','.yml','parentFolder','unchanged','length','Fetching\x20connections\x20for\x20name\x20resolution...','updatedAt','/e/','nameToType','results','63wzyYhY','Delete\x20journey:','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','\x20folders\x20to\x20create','listActivations','user','folderId','existingSegment','Aborted.','\x20activations]','journey','segments','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','journeysOnly','Source\x20directory:\x20','(Journey\x20will\x20be\x20deleted)','connection','red','isNew','getJourney','/sb/da/esr','all','endsWith','set','updated','Folders\x20to\x20create:','journeyId','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)','relationships','\x0aPush\x20summary\x20for\x20\x27','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','scopedFolderPath','isScoped','getOutputSchemaWithCache','\x20to\x20delete','join','\x0a✔\x20Push\x20complete','\x20new','new','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','segment\x20or\x20journey','segment:push','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Push\x20','blue','delete','setPhase','/j/da/je','folders','journeyBundleId','paused','buildUserMaps','17482610SqubPD','\x27...','file','\x20\x20Source:\x20','segment','list','green','834512ShKHpl','description','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','attributes','nameToId','Scoped\x20to\x20folder:\x20','site','Preparing\x20journeys...','\x20YAML\x20files\x20found','\x20unchanged','filePath','parent_name','name','then','yamlConfig','Error\x20parsing\x20YAML:\x20','📁\x20','activations','data','toUpdate','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','journeys','existingJourney','idToName','1630744IGrqNi','Push\x20YAML\x20files\x20to\x20Treasure\x20AI\x20as\x20child\x20segments','type','verbose','filter','yes','Error:\x20','toString','Site:\x20','error','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','state','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','No\x20','folderPath','targetDir','diff','\x20changed','\x20updated','journeyBundleName','errorCode','dim','25fVzADu','\x0aError:','\x20\x20\x20\x20','createdSegmentIds','message','\x20\x20🗺️\x20\x20Journeys:','Resolving\x20parent\x20segment\x20\x27','\x20deleted','Fetching\x20existing\x20activations...','Delete\x20segment:','getParent','\x20\x20Journeys:\x20','no_parent','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','toCreate','4817358YstzLa','helpText','/app/ps/','listFolders','33WGixKj','13373115WUOEVu','cyan','toDelete','\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20','push','\x20changes?','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','1006gBWeaH','map','.yaml'];a55_0x317c=function(){return _0x47a14f;};return a55_0x317c();}
@@ -1 +1 @@
1
- const a55_0x440560=a55_0x169e;(function(_0x5b6eea,_0xbdbb69){const _0x57ef4a=a55_0x169e,_0x4e9f22=_0x5b6eea();while(!![]){try{const _0x5f5015=parseInt(_0x57ef4a(0x170))/0x1+parseInt(_0x57ef4a(0x190))/0x2*(-parseInt(_0x57ef4a(0x191))/0x3)+parseInt(_0x57ef4a(0x173))/0x4+-parseInt(_0x57ef4a(0x18b))/0x5+-parseInt(_0x57ef4a(0x16a))/0x6*(-parseInt(_0x57ef4a(0x18e))/0x7)+parseInt(_0x57ef4a(0x169))/0x8*(-parseInt(_0x57ef4a(0x16b))/0x9)+parseInt(_0x57ef4a(0x175))/0xa;if(_0x5f5015===_0xbdbb69)break;else _0x4e9f22['push'](_0x4e9f22['shift']());}catch(_0x49c3cb){_0x4e9f22['push'](_0x4e9f22['shift']());}}}(a55_0x783e,0xb8334));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 a55_0x169e(_0x1c9c33,_0x5f0188){_0x1c9c33=_0x1c9c33-0x169;const _0x783e3=a55_0x783e();let _0x169ee2=_0x783e3[_0x1c9c33];return _0x169ee2;}import a55_0xc27533 from'chalk';function a55_0x783e(){const _0x22e1c3=['18kHcXuD','description','name','Segment\x20ID\x20missing\x20from\x20resolved\x20path','segment','Update\x20existing\x20child\x20segment','132976vfLtVA','12iqhwLs','792aWKySl','error','✔\x20Updated\x20segment\x20\x27','Parent\x20ID:\x20','segment:update','109095IiFZny','execute','yellow','5981656uOvKal','parentId','22924580bQLryT','segmentId','Resolved\x20type:\x20','data','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','includes','rule','verbose','length','updateSegmentById','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Resolved\x20folder\x20ID:\x20','segmentPath','Updating\x20segment\x20\x27','Error:\x20Cannot\x20update\x20','folder','Resolving\x20folder\x20\x27','Resolved\x20relative\x20path\x20to:\x20','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','\x27...','3368915QcxKkM','type','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','456799TtxQbn','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','378826XhFzTO'];a55_0x783e=function(){return _0x22e1c3;};return a55_0x783e();}export class SegmentUpdateCommand extends BaseCommand{[a55_0x440560(0x193)]=a55_0x440560(0x16f);['description']=a55_0x440560(0x196);async[a55_0x440560(0x171)](_0x54bae5){const _0x4f1051=a55_0x440560;console['error'](a55_0xc27533[_0x4f1051(0x172)](_0x4f1051(0x189))),console[_0x4f1051(0x16c)](a55_0xc27533[_0x4f1051(0x172)](_0x4f1051(0x179)));const {options:_0x12a825,args:_0x4b22af,tdx:_0x4fad56}=_0x54bae5,_0x5ac6fc=_0x12a825;if(_0x4b22af[_0x4f1051(0x17e)]===0x0)return console[_0x4f1051(0x16c)](_0x4f1051(0x180)),console[_0x4f1051(0x16c)]('Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]'),console[_0x4f1051(0x16c)]('Examples:'),console[_0x4f1051(0x16c)](_0x4f1051(0x17a)),console[_0x4f1051(0x16c)](_0x4f1051(0x18f)),0x1;const _0x392987=_0x4b22af[0x0],_0x350a72=_0x12a825[_0x4f1051(0x182)];let _0x347ea1=_0x392987;_0x350a72&&!_0x392987[_0x4f1051(0x17b)]('/')&&(_0x347ea1=_0x350a72+'/'+_0x392987,_0x5ac6fc[_0x4f1051(0x17d)]&&console[_0x4f1051(0x16c)](_0x4f1051(0x187)+_0x347ea1));const _0x1038b4=await withSpinner('Resolving\x20path\x20\x27'+_0x347ea1+'\x27...',()=>_0x4fad56[_0x4f1051(0x195)]['resolvePathToResource'](_0x347ea1),{'verbose':_0x5ac6fc[_0x4f1051(0x17d)]}),_0x495d99=_0x1038b4[_0x4f1051(0x178)];_0x5ac6fc[_0x4f1051(0x17d)]&&console['error'](_0x4f1051(0x177)+_0x495d99[_0x4f1051(0x18c)]);if(_0x495d99[_0x4f1051(0x18c)]!==_0x4f1051(0x195))return console['error'](_0x4f1051(0x184)+_0x495d99[_0x4f1051(0x18c)]+_0x4f1051(0x18d)),console[_0x4f1051(0x16c)](_0x4f1051(0x188)),0x1;if(!_0x495d99['segmentId'])throw new SDKError(ErrorCode['INTERNAL'],_0x4f1051(0x194));const _0x239a38=_0x495d99[_0x4f1051(0x174)],_0x129357=_0x495d99[_0x4f1051(0x176)];_0x5ac6fc['verbose']&&(console['error'](_0x4f1051(0x16e)+_0x239a38),console[_0x4f1051(0x16c)]('Segment\x20ID:\x20'+_0x129357));let _0x9ff1b7;if(_0x5ac6fc[_0x4f1051(0x185)]){const _0x2db71a=_0x5ac6fc[_0x4f1051(0x185)],_0x534545=await withSpinner(_0x4f1051(0x186)+_0x2db71a+_0x4f1051(0x18a),()=>_0x4fad56[_0x4f1051(0x195)]['resolveFolderId'](_0x239a38,_0x2db71a),{'verbose':_0x5ac6fc[_0x4f1051(0x17d)]});_0x9ff1b7=parseInt(_0x534545[_0x4f1051(0x178)],0xa),_0x5ac6fc['verbose']&&console[_0x4f1051(0x16c)](_0x4f1051(0x181)+_0x9ff1b7);}const _0x1a6c86=await loadJSONFromOptions(_0x5ac6fc[_0x4f1051(0x17c)],_0x5ac6fc['ruleFile']),_0x54a22c={'name':_0x5ac6fc['name'],'description':_0x5ac6fc[_0x4f1051(0x192)],'rule':_0x1a6c86,'kind':_0x5ac6fc['kind']!==undefined?parseInt(_0x5ac6fc['kind'],0xa):undefined,'segmentFolderId':_0x9ff1b7},_0x300806=await withSpinner(_0x4f1051(0x183)+_0x495d99['segmentName']+'\x27...',()=>_0x4fad56[_0x4f1051(0x195)][_0x4f1051(0x17f)](_0x239a38,_0x129357,_0x54a22c),{'verbose':_0x5ac6fc[_0x4f1051(0x17d)]}),_0x3dd4b5=_0x300806['data'];return console[_0x4f1051(0x16c)](_0x4f1051(0x16d)+_0x3dd4b5[_0x4f1051(0x193)]+'\x27'),_0x347ea1!==_0x392987&&console[_0x4f1051(0x16c)]('\x20\x20\x20Path:\x20'+_0x347ea1),await handleSDKOutput([_0x3dd4b5],_0x5ac6fc),0x0;}}
1
+ (function(_0x33f997,_0x451bbe){const _0x4c0384=a56_0x522e,_0xf0c9ed=_0x33f997();while(!![]){try{const _0x247b68=-parseInt(_0x4c0384(0x1b6))/0x1+-parseInt(_0x4c0384(0x1c5))/0x2+-parseInt(_0x4c0384(0x1a7))/0x3*(parseInt(_0x4c0384(0x1c3))/0x4)+-parseInt(_0x4c0384(0x1b9))/0x5*(parseInt(_0x4c0384(0x1a4))/0x6)+-parseInt(_0x4c0384(0x1a0))/0x7*(-parseInt(_0x4c0384(0x1a1))/0x8)+-parseInt(_0x4c0384(0x1b4))/0x9*(parseInt(_0x4c0384(0x1b7))/0xa)+parseInt(_0x4c0384(0x1b2))/0xb;if(_0x247b68===_0x451bbe)break;else _0xf0c9ed['push'](_0xf0c9ed['shift']());}catch(_0x167bf8){_0xf0c9ed['push'](_0xf0c9ed['shift']());}}}(a56_0x2c99,0x5ba77));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a56_0x2c99(){const _0x98ec5c=['resolveFolderId','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','kind','15782415nYuVtm','verbose','7551YrnFLd','error','429184GNRbLB','6680iUvDgG','Error:\x20Cannot\x20update\x20','75vwUnYT','ruleFile','segmentName','data','parentId','rule','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Parent\x20ID:\x20','INTERNAL','resolvePathToResource','34284oBivWk','Resolved\x20folder\x20ID:\x20','113716zheVdI','type','Updating\x20segment\x20\x27','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','segmentId','segment','updateSegmentById','Resolved\x20relative\x20path\x20to:\x20','folder','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','Segment\x20ID:\x20','66311gSWARv','536TYFQhp','Examples:','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','97884rpIHVU','\x27...','yellow','141WRhxQq','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','name','Resolving\x20path\x20\x27','\x20\x20\x20Path:\x20','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','length'];a56_0x2c99=function(){return _0x98ec5c;};return a56_0x2c99();}import{withSpinner}from'../utils/spinner.js';function a56_0x522e(_0x5300ea,_0x10c74c){_0x5300ea=_0x5300ea-0x196;const _0x2c99ac=a56_0x2c99();let _0x522e01=_0x2c99ac[_0x5300ea];return _0x522e01;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a56_0x2f9604 from'chalk';export class SegmentUpdateCommand extends BaseCommand{['name']='segment:update';['description']='Update\x20existing\x20child\x20segment';async['execute'](_0x5f5881){const _0x59d913=a56_0x522e;console[_0x59d913(0x1b5)](a56_0x2f9604[_0x59d913(0x1a6)](_0x59d913(0x1a3))),console['error'](a56_0x2f9604[_0x59d913(0x1a6)](_0x59d913(0x198)));const {options:_0x2ab580,args:_0xee356d,tdx:_0x3d19dd}=_0x5f5881,_0x44a97d=_0x2ab580;if(_0xee356d[_0x59d913(0x1ae)]===0x0)return console[_0x59d913(0x1b5)](_0x59d913(0x1bf)),console[_0x59d913(0x1b5)](_0x59d913(0x19e)),console[_0x59d913(0x1b5)](_0x59d913(0x1a2)),console[_0x59d913(0x1b5)](_0x59d913(0x1ad)),console[_0x59d913(0x1b5)](_0x59d913(0x1b0)),0x1;const _0x312f65=_0xee356d[0x0],_0x3118e1=_0x2ab580['segmentPath'];let _0x1bc475=_0x312f65;_0x3118e1&&!_0x312f65['includes']('/')&&(_0x1bc475=_0x3118e1+'/'+_0x312f65,_0x44a97d[_0x59d913(0x1b3)]&&console[_0x59d913(0x1b5)](_0x59d913(0x19c)+_0x1bc475));const _0x498e1f=await withSpinner(_0x59d913(0x1ab)+_0x1bc475+_0x59d913(0x1a5),()=>_0x3d19dd[_0x59d913(0x19a)][_0x59d913(0x1c2)](_0x1bc475),{'verbose':_0x44a97d['verbose']}),_0x4c6195=_0x498e1f[_0x59d913(0x1bc)];_0x44a97d[_0x59d913(0x1b3)]&&console['error']('Resolved\x20type:\x20'+_0x4c6195[_0x59d913(0x196)]);if(_0x4c6195[_0x59d913(0x196)]!==_0x59d913(0x19a))return console[_0x59d913(0x1b5)](_0x59d913(0x1b8)+_0x4c6195[_0x59d913(0x196)]+_0x59d913(0x1a8)),console['error'](_0x59d913(0x1a9)),0x1;if(!_0x4c6195[_0x59d913(0x199)])throw new SDKError(ErrorCode[_0x59d913(0x1c1)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5123e1=_0x4c6195[_0x59d913(0x1bd)],_0x5b54db=_0x4c6195[_0x59d913(0x199)];_0x44a97d[_0x59d913(0x1b3)]&&(console['error'](_0x59d913(0x1c0)+_0x5123e1),console['error'](_0x59d913(0x19f)+_0x5b54db));let _0x3c3730;if(_0x44a97d['folder']){const _0x1e446a=_0x44a97d[_0x59d913(0x19d)],_0x11f7d3=await withSpinner('Resolving\x20folder\x20\x27'+_0x1e446a+'\x27...',()=>_0x3d19dd[_0x59d913(0x19a)][_0x59d913(0x1af)](_0x5123e1,_0x1e446a),{'verbose':_0x44a97d[_0x59d913(0x1b3)]});_0x3c3730=parseInt(_0x11f7d3['data'],0xa),_0x44a97d[_0x59d913(0x1b3)]&&console[_0x59d913(0x1b5)](_0x59d913(0x1c4)+_0x3c3730);}const _0x5baf19=await loadJSONFromOptions(_0x44a97d[_0x59d913(0x1be)],_0x44a97d[_0x59d913(0x1ba)]),_0x2bceab={'name':_0x44a97d[_0x59d913(0x1aa)],'description':_0x44a97d['description'],'rule':_0x5baf19,'kind':_0x44a97d['kind']!==undefined?parseInt(_0x44a97d[_0x59d913(0x1b1)],0xa):undefined,'segmentFolderId':_0x3c3730},_0xc97c83=await withSpinner(_0x59d913(0x197)+_0x4c6195[_0x59d913(0x1bb)]+_0x59d913(0x1a5),()=>_0x3d19dd['segment'][_0x59d913(0x19b)](_0x5123e1,_0x5b54db,_0x2bceab),{'verbose':_0x44a97d[_0x59d913(0x1b3)]}),_0x3d7d20=_0xc97c83[_0x59d913(0x1bc)];return console[_0x59d913(0x1b5)]('✔\x20Updated\x20segment\x20\x27'+_0x3d7d20[_0x59d913(0x1aa)]+'\x27'),_0x1bc475!==_0x312f65&&console['error'](_0x59d913(0x1ac)+_0x1bc475),await handleSDKOutput([_0x3d7d20],_0x44a97d),0x0;}}
@@ -1 +1 @@
1
- const a56_0xfc8696=a56_0x2128;(function(_0x3eaa60,_0x2a0723){const _0x998723=a56_0x2128,_0x2ba327=_0x3eaa60();while(!![]){try{const _0x326f00=parseInt(_0x998723(0xbc))/0x1*(-parseInt(_0x998723(0xc3))/0x2)+parseInt(_0x998723(0xbf))/0x3*(parseInt(_0x998723(0xb5))/0x4)+parseInt(_0x998723(0xd1))/0x5+parseInt(_0x998723(0xbe))/0x6*(parseInt(_0x998723(0xd7))/0x7)+-parseInt(_0x998723(0xb8))/0x8+parseInt(_0x998723(0xb1))/0x9*(-parseInt(_0x998723(0xc4))/0xa)+parseInt(_0x998723(0xa8))/0xb;if(_0x326f00===_0x2a0723)break;else _0x2ba327['push'](_0x2ba327['shift']());}catch(_0x2d89a7){_0x2ba327['push'](_0x2ba327['shift']());}}}(a56_0x4d5e,0xbca07));import{existsSync,statSync}from'fs';import a56_0x4f303e from'chalk';import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';function a56_0x4d5e(){const _0x4245af=['segmentPath','6793611dvRBIv','segments','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','Usage:\x20tdx\x20segment\x20use\x20<path>','folderPath','execute','length','Folder\x20ID:\x20','slice','24237PWpecV','cyan','red','isDirectory','4RgqOic','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','3693664YDOqRl','verbose','parentName','isAbsolute','31377UESbUb','data','21846ngUtpy','4325826EWYIjb','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','parentId','error','82YEKPrn','10RznAki','Resolved\x20path\x20type:\x20','Resolving\x20path\x20\x27','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','resolvePathToResource','session','fullPath','log','type','green','Resolved\x20relative\x20path\x20to:\x20','site','1518630BAigeC','dim','Examples:','Error:\x20Path\x20is\x20required\x0a','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','folderId','308HNqqet','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','Site:\x20','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','parent_segment','segment:use','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','✔\x20Context\x20set\x20to:\x20','description'];a56_0x4d5e=function(){return _0x4245af;};return a56_0x4d5e();}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 a56_0x2128(_0x1e1196,_0x351681){_0x1e1196=_0x1e1196-0x9e;const _0x4d5ea4=a56_0x4d5e();let _0x212827=_0x4d5ea4[_0x1e1196];return _0x212827;}export class SegmentUseCommand extends BaseCommand{['name']=a56_0xfc8696(0xa2);[a56_0xfc8696(0xa6)]=a56_0xfc8696(0xb7);async[a56_0xfc8696(0xad)](_0xbee1b2){const _0x46163c=a56_0xfc8696,{options:_0x12c6a4,args:_0x2c6f69,tdx:_0x189e57}=_0xbee1b2;if(_0x2c6f69['length']===0x0)return console['error'](a56_0x4f303e[_0x46163c(0xb3)](_0x46163c(0xd4))),console[_0x46163c(0xc2)](_0x46163c(0xab)),console['error'](_0x46163c(0xd3)),console[_0x46163c(0xc2)](_0x46163c(0xc0)),console[_0x46163c(0xc2)](_0x46163c(0x9e)),console[_0x46163c(0xc2)](_0x46163c(0xa3)),console['error'](_0x46163c(0xd5)),0x1;const _0x57e76f=_0x2c6f69[0x0],_0x6ba9a0=_0x12c6a4[_0x46163c(0xca)];try{if(_0x57e76f==='/')return saveSessionContext({'segment_path':undefined},_0x6ba9a0),console[_0x46163c(0xcc)](a56_0x4f303e[_0x46163c(0xce)]('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;if(existsSync(_0x57e76f)&&statSync(_0x57e76f)[_0x46163c(0xb4)]()){let _0x1dd3c7;try{_0x1dd3c7=findTdxConfig(_0x57e76f);}catch{return console[_0x46163c(0xc2)](a56_0x4f303e['red'](_0x46163c(0xc7)+_0x57e76f)),console[_0x46163c(0xc2)](a56_0x4f303e['cyan'](_0x46163c(0xb6))),0x1;}const _0x47ea70=_0x1dd3c7['config'][_0x46163c(0xa1)];return saveSessionContext({'segment_path':_0x47ea70,'parent_segment':_0x47ea70},_0x6ba9a0),console[_0x46163c(0xcc)](a56_0x4f303e[_0x46163c(0xce)](_0x46163c(0xa5)+a56_0x4f303e[_0x46163c(0xb2)](_0x47ea70))),0x0;}const _0x46f896=_0x12c6a4[_0x46163c(0xa7)];let _0x181fcd=_0x57e76f;const _0x3351cc=parsePath(_0x57e76f);if(!_0x3351cc[_0x46163c(0xbb)]){if(!_0x46f896)return console[_0x46163c(0xc2)](a56_0x4f303e[_0x46163c(0xb3)](_0x46163c(0xa4))),console[_0x46163c(0xc2)](a56_0x4f303e[_0x46163c(0xb2)](_0x46163c(0xc8))),0x1;if(_0x57e76f==='..'){const _0x2ac8de=_0x46f896['split']('/')[_0x46163c(0xb0)](0x0,-0x1)['join']('/');_0x181fcd=_0x2ac8de||'/';}else _0x57e76f==='.'?_0x181fcd=_0x46f896:_0x181fcd=_0x46f896+'/'+_0x57e76f;_0x12c6a4[_0x46163c(0xb9)]&&console['error'](_0x46163c(0xcf)+_0x181fcd);}if(_0x181fcd==='/'||_0x181fcd==='')return saveSessionContext({'segment_path':undefined},_0x6ba9a0),console['log'](a56_0x4f303e['green'](_0x46163c(0xaa))),0x0;_0x181fcd=normalizePath(_0x181fcd);const _0x3af1d0=parsePath(_0x181fcd)[_0x46163c(0xa9)];if(_0x3af1d0[_0x46163c(0xae)]===0x0)return saveSessionContext({'segment_path':undefined},_0x6ba9a0),console['log'](a56_0x4f303e[_0x46163c(0xce)]('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;_0x12c6a4[_0x46163c(0xb9)]&&(console[_0x46163c(0xc2)](_0x46163c(0x9f)+_0x12c6a4[_0x46163c(0xd0)]),console[_0x46163c(0xc2)]('Target\x20path:\x20'+_0x181fcd));const _0x5c3d7=await withSpinner(_0x46163c(0xc6)+_0x181fcd+'\x27...',()=>_0x189e57['segment'][_0x46163c(0xc9)](_0x181fcd),{'verbose':_0x12c6a4[_0x46163c(0xb9)]}),_0x291cd0=_0x5c3d7[_0x46163c(0xbd)];_0x12c6a4[_0x46163c(0xb9)]&&(console[_0x46163c(0xc2)](_0x46163c(0xc5)+_0x291cd0[_0x46163c(0xcd)]),console[_0x46163c(0xc2)]('Parent\x20ID:\x20'+_0x291cd0[_0x46163c(0xc1)]),_0x291cd0[_0x46163c(0xd6)]&&console[_0x46163c(0xc2)](_0x46163c(0xaf)+_0x291cd0[_0x46163c(0xd6)]));if(_0x291cd0['type']==='segment')return console[_0x46163c(0xc2)](a56_0x4f303e['red']('Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.')),console['error']('Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.'),console[_0x46163c(0xc2)](a56_0x4f303e[_0x46163c(0xb2)]('Use:\x20tdx\x20segment\x20use\x20'+_0x291cd0[_0x46163c(0xba)]+(_0x291cd0[_0x46163c(0xac)]?'/'+_0x291cd0[_0x46163c(0xac)]['join']('/'):''))),0x1;return saveSessionContext({'segment_path':_0x291cd0['fullPath'],'parent_segment':_0x291cd0[_0x46163c(0xba)]},_0x6ba9a0),console[_0x46163c(0xcc)](a56_0x4f303e['green'](_0x46163c(0xa5)+a56_0x4f303e[_0x46163c(0xb2)](_0x291cd0[_0x46163c(0xcb)]))),_0x12c6a4[_0x46163c(0xb9)]&&(console['error'](a56_0x4f303e[_0x46163c(0xd2)](_0x46163c(0xd8))),console['error'](a56_0x4f303e['dim'](_0x46163c(0xa0)))),0x0;}catch(_0x440cd2){throw _0x440cd2;}}}
1
+ const a57_0x35ee14=a57_0x370b;(function(_0x224bf5,_0x158fd6){const _0x3585f2=a57_0x370b,_0x212780=_0x224bf5();while(!![]){try{const _0x536ab6=-parseInt(_0x3585f2(0x15d))/0x1+-parseInt(_0x3585f2(0x136))/0x2+parseInt(_0x3585f2(0x129))/0x3+-parseInt(_0x3585f2(0x130))/0x4+parseInt(_0x3585f2(0x149))/0x5*(parseInt(_0x3585f2(0x14c))/0x6)+parseInt(_0x3585f2(0x147))/0x7+parseInt(_0x3585f2(0x12e))/0x8*(parseInt(_0x3585f2(0x148))/0x9);if(_0x536ab6===_0x158fd6)break;else _0x212780['push'](_0x212780['shift']());}catch(_0x598735){_0x212780['push'](_0x212780['shift']());}}}(a57_0x32c6,0x4fb90));function a57_0x32c6(){const _0x56a0ea=['parentId','Examples:','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','Site:\x20','isAbsolute','cyan','Resolved\x20relative\x20path\x20to:\x20','session','✔\x20Context\x20set\x20to:\x20','2495752fbRSCY','467469MFEBYI','412630JVVSwF','Use:\x20tdx\x20segment\x20use\x20','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','6lPLiZC','green','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','log','segment','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','join','error','site','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','Parent\x20ID:\x20','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','Resolving\x20path\x20\x27','folderId','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','description','581039sglpMt','name','red','738873BVfpwN','type','isDirectory','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','dim','128KgmPRx','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','1227476xGEbup','folderPath','parentName','verbose','execute','Target\x20path:\x20','603914MtnclA','fullPath','length','config','Folder\x20ID:\x20','Error:\x20Path\x20is\x20required\x0a','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','segments'];a57_0x32c6=function(){return _0x56a0ea;};return a57_0x32c6();}import{existsSync,statSync}from'fs';import a57_0x459131 from'chalk';import{BaseCommand}from'./command.js';function a57_0x370b(_0x530574,_0x57f400){_0x530574=_0x530574-0x128;const _0x32c62d=a57_0x32c6();let _0x370bec=_0x32c62d[_0x530574];return _0x370bec;}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{[a57_0x35ee14(0x15e)]='segment:use';[a57_0x35ee14(0x15c)]=a57_0x35ee14(0x15b);async[a57_0x35ee14(0x134)](_0x3a7677){const _0x2d222e=a57_0x35ee14,{options:_0x4d2c90,args:_0x2500c6,tdx:_0x845aef}=_0x3a7677;if(_0x2500c6[_0x2d222e(0x138)]===0x0)return console['error'](a57_0x459131[_0x2d222e(0x128)](_0x2d222e(0x13b))),console[_0x2d222e(0x153)]('Usage:\x20tdx\x20segment\x20use\x20<path>'),console['error'](_0x2d222e(0x13f)),console[_0x2d222e(0x153)](_0x2d222e(0x12c)),console[_0x2d222e(0x153)](_0x2d222e(0x14e)),console[_0x2d222e(0x153)](_0x2d222e(0x155)),console[_0x2d222e(0x153)]('\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 _0x10f6d2=_0x2500c6[0x0],_0xcdc774=_0x4d2c90[_0x2d222e(0x145)];try{if(_0x10f6d2==='/')return saveSessionContext({'segment_path':undefined},_0xcdc774),console[_0x2d222e(0x14f)](a57_0x459131[_0x2d222e(0x14d)](_0x2d222e(0x15a))),0x0;if(existsSync(_0x10f6d2)&&statSync(_0x10f6d2)[_0x2d222e(0x12b)]()){let _0x260bb8;try{_0x260bb8=findTdxConfig(_0x10f6d2);}catch{return console[_0x2d222e(0x153)](a57_0x459131[_0x2d222e(0x128)](_0x2d222e(0x14b)+_0x10f6d2)),console[_0x2d222e(0x153)](a57_0x459131['cyan']('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;}const _0x4bb641=_0x260bb8[_0x2d222e(0x139)]['parent_segment'];return saveSessionContext({'segment_path':_0x4bb641,'parent_segment':_0x4bb641},_0xcdc774),console[_0x2d222e(0x14f)](a57_0x459131[_0x2d222e(0x14d)](_0x2d222e(0x146)+a57_0x459131[_0x2d222e(0x143)](_0x4bb641))),0x0;}const _0x181f6c=_0x4d2c90['segmentPath'];let _0xad83ef=_0x10f6d2;const _0x401b20=parsePath(_0x10f6d2);if(!_0x401b20[_0x2d222e(0x142)]){if(!_0x181f6c)return console['error'](a57_0x459131[_0x2d222e(0x128)]('Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.')),console[_0x2d222e(0x153)](a57_0x459131[_0x2d222e(0x143)](_0x2d222e(0x151))),0x1;if(_0x10f6d2==='..'){const _0x5cdea0=_0x181f6c['split']('/')['slice'](0x0,-0x1)[_0x2d222e(0x152)]('/');_0xad83ef=_0x5cdea0||'/';}else _0x10f6d2==='.'?_0xad83ef=_0x181f6c:_0xad83ef=_0x181f6c+'/'+_0x10f6d2;_0x4d2c90['verbose']&&console[_0x2d222e(0x153)](_0x2d222e(0x144)+_0xad83ef);}if(_0xad83ef==='/'||_0xad83ef==='')return saveSessionContext({'segment_path':undefined},_0xcdc774),console['log'](a57_0x459131[_0x2d222e(0x14d)]('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;_0xad83ef=normalizePath(_0xad83ef);const _0x273688=parsePath(_0xad83ef)[_0x2d222e(0x13d)];if(_0x273688['length']===0x0)return saveSessionContext({'segment_path':undefined},_0xcdc774),console[_0x2d222e(0x14f)](a57_0x459131[_0x2d222e(0x14d)](_0x2d222e(0x15a))),0x0;_0x4d2c90[_0x2d222e(0x133)]&&(console[_0x2d222e(0x153)](_0x2d222e(0x141)+_0x4d2c90[_0x2d222e(0x154)]),console[_0x2d222e(0x153)](_0x2d222e(0x135)+_0xad83ef));const _0x176025=await withSpinner(_0x2d222e(0x158)+_0xad83ef+'\x27...',()=>_0x845aef[_0x2d222e(0x150)]['resolvePathToResource'](_0xad83ef),{'verbose':_0x4d2c90[_0x2d222e(0x133)]}),_0x177c79=_0x176025['data'];_0x4d2c90[_0x2d222e(0x133)]&&(console[_0x2d222e(0x153)]('Resolved\x20path\x20type:\x20'+_0x177c79[_0x2d222e(0x12a)]),console[_0x2d222e(0x153)](_0x2d222e(0x156)+_0x177c79[_0x2d222e(0x13e)]),_0x177c79[_0x2d222e(0x159)]&&console[_0x2d222e(0x153)](_0x2d222e(0x13a)+_0x177c79[_0x2d222e(0x159)]));if(_0x177c79['type']==='segment')return console['error'](a57_0x459131[_0x2d222e(0x128)](_0x2d222e(0x157))),console['error'](_0x2d222e(0x12f)),console['error'](a57_0x459131['cyan'](_0x2d222e(0x14a)+_0x177c79[_0x2d222e(0x132)]+(_0x177c79[_0x2d222e(0x131)]?'/'+_0x177c79[_0x2d222e(0x131)][_0x2d222e(0x152)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x177c79[_0x2d222e(0x137)],'parent_segment':_0x177c79[_0x2d222e(0x132)]},_0xcdc774),console[_0x2d222e(0x14f)](a57_0x459131[_0x2d222e(0x14d)](_0x2d222e(0x146)+a57_0x459131[_0x2d222e(0x143)](_0x177c79[_0x2d222e(0x137)]))),_0x4d2c90[_0x2d222e(0x133)]&&(console[_0x2d222e(0x153)](a57_0x459131[_0x2d222e(0x12d)](_0x2d222e(0x140))),console['error'](a57_0x459131[_0x2d222e(0x12d)](_0x2d222e(0x13c)))),0x0;}catch(_0x4b1bdf){throw _0x4b1bdf;}}}
@@ -1 +1 @@
1
- const a57_0x5e0d62=a57_0x57f3;function a57_0x57f3(_0x33220f,_0x30416f){_0x33220f=_0x33220f-0x16c;const _0x398f1d=a57_0x398f();let _0x57f3fe=_0x398f1d[_0x33220f];return _0x57f3fe;}function a57_0x398f(){const _0x5eaa45=['7383680PlEZZs','11536704tCwmhT','filePath','errors','hasErrors','valid','Usage:\x20tdx\x20sg\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','endsWith','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','574752XJFxrd','verbose','.yml','4509540junOJu','\x20warning(s)\x20found','.yaml','type','Validate\x20segment\x20and\x20journey\x20YAML\x20files','length','segment:validate','warnings','\x20warning(s)','Validation\x20failed:\x20','errorCode','36tRatcT','77772pTcrSg','yellow','no_parent','964369izCmXZ','warningCount','description','green','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','parentSegment','error','execute','30gXvXvj','\x20file(s)\x20valid','1769888tcYPsj','targetDir','validCount','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','helpText','\x20file(s)\x20with\x20errors,\x20','red','\x20valid','\x20error(s)','name','file','Error:\x20Directory\x20not\x20found:\x20','log','dim','):\x20','cyan'];a57_0x398f=function(){return _0x5eaa45;};return a57_0x398f();}(function(_0x20780e,_0x204d99){const _0x5a60d8=a57_0x57f3,_0x492a45=_0x20780e();while(!![]){try{const _0x56c751=parseInt(_0x5a60d8(0x182))/0x1+parseInt(_0x5a60d8(0x17e))/0x2*(-parseInt(_0x5a60d8(0x17f))/0x3)+parseInt(_0x5a60d8(0x18c))/0x4+-parseInt(_0x5a60d8(0x18a))/0x5*(-parseInt(_0x5a60d8(0x170))/0x6)+-parseInt(_0x5a60d8(0x173))/0x7+parseInt(_0x5a60d8(0x19c))/0x8+-parseInt(_0x5a60d8(0x19d))/0x9;if(_0x56c751===_0x204d99)break;else _0x492a45['push'](_0x492a45['shift']());}catch(_0x57ed28){_0x492a45['push'](_0x492a45['shift']());}}}(a57_0x398f,0x7cf65));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a57_0x40a29b 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{[a57_0x5e0d62(0x195)]=a57_0x5e0d62(0x179);[a57_0x5e0d62(0x184)]=a57_0x5e0d62(0x177);async[a57_0x5e0d62(0x189)](_0x575c51){const _0xb91c5f=a57_0x5e0d62,{options:_0x2039a3,args:_0x2b4445}=_0x575c51,_0x3a4096=_0x2039a3,_0x9ba725=await resolveTarget({'arg':_0x2b4445[0x0],'contextParent':_0x2039a3[_0xb91c5f(0x187)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x9ba725))return _0x9ba725[_0xb91c5f(0x17d)]===_0xb91c5f(0x181)?(console['error'](a57_0x40a29b['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0xb91c5f(0x188)](_0xb91c5f(0x16d)),console[_0xb91c5f(0x188)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20validate\x20.\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20current\x20directory'),console['error'](_0xb91c5f(0x18f))):(console[_0xb91c5f(0x188)](a57_0x40a29b[_0xb91c5f(0x192)]('Error:\x20'+_0x9ba725['message']+'\x0a')),_0x9ba725['helpText']&&console[_0xb91c5f(0x188)](a57_0x40a29b[_0xb91c5f(0x19b)](_0x9ba725[_0xb91c5f(0x190)]))),0x1;const _0x5ee96e=_0x9ba725[_0xb91c5f(0x18d)],_0x1eb861=_0x9ba725[_0xb91c5f(0x176)]===_0xb91c5f(0x196)?_0x9ba725[_0xb91c5f(0x19e)]:undefined;if(!_0x1eb861&&!existsSync(_0x5ee96e))return console[_0xb91c5f(0x188)](a57_0x40a29b[_0xb91c5f(0x192)](_0xb91c5f(0x197)+_0x5ee96e+'\x0a')),0x1;let _0x58dac8;if(_0x1eb861){if(!_0x1eb861[_0xb91c5f(0x16e)](_0xb91c5f(0x172))&&!_0x1eb861[_0xb91c5f(0x16e)](_0xb91c5f(0x175)))return console[_0xb91c5f(0x188)](a57_0x40a29b[_0xb91c5f(0x192)](_0xb91c5f(0x186)+_0x1eb861+'\x0a')),0x1;_0x58dac8=[_0x1eb861];}else _0x58dac8=findYamlFiles(_0x5ee96e);if(_0x58dac8[_0xb91c5f(0x178)]===0x0)return console[_0xb91c5f(0x188)](a57_0x40a29b['red'](_0xb91c5f(0x16f)+_0x5ee96e+'\x0a')),0x1;const _0xef53d5=validateYamlFiles(_0x58dac8,_0x5ee96e),_0x46b6e8=calculateSummary(_0xef53d5);for(const _0x51d21c of _0xef53d5){if(!isValidationResult(_0x51d21c))continue;const {relativePath:_0x4fbdbc,source:_0x88280,result:_0x33e5f1,fileType:_0x1a2bb4}=_0x51d21c,_0xc24089=_0x1a2bb4;if(_0x33e5f1[_0xb91c5f(0x16c)]&&_0x33e5f1[_0xb91c5f(0x17a)][_0xb91c5f(0x178)]===0x0)_0x3a4096[_0xb91c5f(0x171)]&&console['log'](a57_0x40a29b[_0xb91c5f(0x185)]('✔\x20'+_0x4fbdbc)+a57_0x40a29b['dim']('\x20('+_0xc24089+')'));else _0x33e5f1[_0xb91c5f(0x16c)]?(console[_0xb91c5f(0x198)](a57_0x40a29b[_0xb91c5f(0x180)]('⚠\x20'+_0x4fbdbc)+a57_0x40a29b[_0xb91c5f(0x199)]('\x20('+_0xc24089+_0xb91c5f(0x19a)+_0x33e5f1['warnings'][_0xb91c5f(0x178)]+_0xb91c5f(0x17b))),console['log'](formatValidationResult(_0x33e5f1,_0x88280,_0x4fbdbc))):(console[_0xb91c5f(0x198)](a57_0x40a29b['red']('✖\x20'+_0x4fbdbc)+a57_0x40a29b['dim']('\x20('+_0xc24089+_0xb91c5f(0x19a)+_0x33e5f1[_0xb91c5f(0x19f)][_0xb91c5f(0x178)]+_0xb91c5f(0x194))),console[_0xb91c5f(0x198)](formatValidationResult(_0x33e5f1,_0x88280,_0x4fbdbc)));}return console[_0xb91c5f(0x198)](''),_0x46b6e8[_0xb91c5f(0x1a0)]?(console[_0xb91c5f(0x198)](a57_0x40a29b[_0xb91c5f(0x192)](_0xb91c5f(0x17c)+_0x46b6e8['invalidCount']+_0xb91c5f(0x191)+_0x46b6e8[_0xb91c5f(0x18e)]+_0xb91c5f(0x193))),_0x46b6e8[_0xb91c5f(0x183)]>0x0&&console[_0xb91c5f(0x198)](a57_0x40a29b['yellow'](_0x46b6e8[_0xb91c5f(0x183)]+_0xb91c5f(0x174))),0x1):(console[_0xb91c5f(0x198)](a57_0x40a29b[_0xb91c5f(0x185)]('✔\x20All\x20'+_0x46b6e8[_0xb91c5f(0x18e)]+_0xb91c5f(0x18b))),_0x46b6e8[_0xb91c5f(0x183)]>0x0&&console[_0xb91c5f(0x198)](a57_0x40a29b[_0xb91c5f(0x180)](_0x46b6e8[_0xb91c5f(0x183)]+'\x20warning(s)\x20found')),0x0);}}
1
+ const a58_0x1d4496=a58_0x178b;(function(_0x481321,_0x595f64){const _0x29a450=a58_0x178b,_0x13863a=_0x481321();while(!![]){try{const _0x3e9b83=-parseInt(_0x29a450(0x7b))/0x1*(-parseInt(_0x29a450(0x76))/0x2)+parseInt(_0x29a450(0x77))/0x3*(-parseInt(_0x29a450(0x9b))/0x4)+-parseInt(_0x29a450(0x7f))/0x5*(-parseInt(_0x29a450(0xa3))/0x6)+parseInt(_0x29a450(0x72))/0x7+parseInt(_0x29a450(0x8f))/0x8+-parseInt(_0x29a450(0x98))/0x9*(parseInt(_0x29a450(0x9e))/0xa)+-parseInt(_0x29a450(0x73))/0xb*(parseInt(_0x29a450(0x6d))/0xc);if(_0x3e9b83===_0x595f64)break;else _0x13863a['push'](_0x13863a['shift']());}catch(_0x1e3bf5){_0x13863a['push'](_0x13863a['shift']());}}}(a58_0xb0b0,0x82987));import{BaseCommand}from'./command.js';function a58_0x178b(_0x4d0d75,_0x122151){_0x4d0d75=_0x4d0d75-0x6b;const _0xb0b074=a58_0xb0b0();let _0x178b4a=_0xb0b074[_0x4d0d75];return _0x178b4a;}import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a58_0x1fdcf8 from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';function a58_0xb0b0(){const _0xd4723d=['name','execute','\x20file(s)\x20with\x20errors,\x20','1807946OeViQE','132dIqzhi','red','length','10bvxvAo','777774dxKega','helpText','Error:\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','170908ypnHLD','.yml','Error:\x20Directory\x20not\x20found:\x20','):\x20','654565BSLwLL','\x20valid','warnings','verbose','.yaml','errorCode','yellow','type','filePath','file','cyan','endsWith','no_parent','Validate\x20segment\x20and\x20journey\x20YAML\x20files','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','parentSegment','7802824WZFXCk','Validation\x20failed:\x20','hasErrors','targetDir','warningCount','validCount','Usage:\x20tdx\x20sg\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','✔\x20All\x20','segment:validate','23202oLDETW','\x20file(s)\x20valid','valid','4CgwtUB','\x20warning(s)','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','390ixdLlM','dim','\x20error(s)','message','log','24ckGaTN','error','\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','1717104nrgzPa','green'];a58_0xb0b0=function(){return _0xd4723d;};return a58_0xb0b0();}import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class SegmentValidateCommand extends BaseCommand{[a58_0x1d4496(0x6f)]=a58_0x1d4496(0x97);['description']=a58_0x1d4496(0x8c);async[a58_0x1d4496(0x70)](_0x193c1a){const _0x33f539=a58_0x1d4496,{options:_0x182683,args:_0xee0c6b}=_0x193c1a,_0x17a208=_0x182683,_0x58d42d=await resolveTarget({'arg':_0xee0c6b[0x0],'contextParent':_0x182683[_0x33f539(0x8e)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x58d42d))return _0x58d42d[_0x33f539(0x84)]===_0x33f539(0x8b)?(console[_0x33f539(0x6b)](a58_0x1fdcf8[_0x33f539(0x85)](_0x33f539(0x7a))),console[_0x33f539(0x6b)](_0x33f539(0x95)),console[_0x33f539(0x6b)](_0x33f539(0x6c)),console[_0x33f539(0x6b)](_0x33f539(0x9d))):(console[_0x33f539(0x6b)](a58_0x1fdcf8['red'](_0x33f539(0x79)+_0x58d42d[_0x33f539(0xa1)]+'\x0a')),_0x58d42d[_0x33f539(0x78)]&&console[_0x33f539(0x6b)](a58_0x1fdcf8[_0x33f539(0x89)](_0x58d42d[_0x33f539(0x78)]))),0x1;const _0x5791fa=_0x58d42d[_0x33f539(0x92)],_0x1eb7d0=_0x58d42d[_0x33f539(0x86)]===_0x33f539(0x88)?_0x58d42d[_0x33f539(0x87)]:undefined;if(!_0x1eb7d0&&!existsSync(_0x5791fa))return console[_0x33f539(0x6b)](a58_0x1fdcf8[_0x33f539(0x74)](_0x33f539(0x7d)+_0x5791fa+'\x0a')),0x1;let _0x303314;if(_0x1eb7d0){if(!_0x1eb7d0[_0x33f539(0x8a)](_0x33f539(0x7c))&&!_0x1eb7d0[_0x33f539(0x8a)](_0x33f539(0x83)))return console[_0x33f539(0x6b)](a58_0x1fdcf8['red']('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x1eb7d0+'\x0a')),0x1;_0x303314=[_0x1eb7d0];}else _0x303314=findYamlFiles(_0x5791fa);if(_0x303314[_0x33f539(0x75)]===0x0)return console['error'](a58_0x1fdcf8[_0x33f539(0x74)](_0x33f539(0x8d)+_0x5791fa+'\x0a')),0x1;const _0x525c94=validateYamlFiles(_0x303314,_0x5791fa),_0x2f6aff=calculateSummary(_0x525c94);for(const _0x4a5156 of _0x525c94){if(!isValidationResult(_0x4a5156))continue;const {relativePath:_0x4bbd9d,source:_0x514a68,result:_0xac56d0,fileType:_0x4c8f64}=_0x4a5156,_0x49917c=_0x4c8f64;if(_0xac56d0['valid']&&_0xac56d0[_0x33f539(0x81)][_0x33f539(0x75)]===0x0)_0x17a208[_0x33f539(0x82)]&&console[_0x33f539(0xa2)](a58_0x1fdcf8[_0x33f539(0x6e)]('✔\x20'+_0x4bbd9d)+a58_0x1fdcf8['dim']('\x20('+_0x49917c+')'));else _0xac56d0[_0x33f539(0x9a)]?(console['log'](a58_0x1fdcf8[_0x33f539(0x85)]('⚠\x20'+_0x4bbd9d)+a58_0x1fdcf8[_0x33f539(0x9f)]('\x20('+_0x49917c+_0x33f539(0x7e)+_0xac56d0[_0x33f539(0x81)][_0x33f539(0x75)]+_0x33f539(0x9c))),console[_0x33f539(0xa2)](formatValidationResult(_0xac56d0,_0x514a68,_0x4bbd9d))):(console[_0x33f539(0xa2)](a58_0x1fdcf8['red']('✖\x20'+_0x4bbd9d)+a58_0x1fdcf8[_0x33f539(0x9f)]('\x20('+_0x49917c+'):\x20'+_0xac56d0['errors'][_0x33f539(0x75)]+_0x33f539(0xa0))),console[_0x33f539(0xa2)](formatValidationResult(_0xac56d0,_0x514a68,_0x4bbd9d)));}return console[_0x33f539(0xa2)](''),_0x2f6aff[_0x33f539(0x91)]?(console['log'](a58_0x1fdcf8[_0x33f539(0x74)](_0x33f539(0x90)+_0x2f6aff['invalidCount']+_0x33f539(0x71)+_0x2f6aff[_0x33f539(0x94)]+_0x33f539(0x80))),_0x2f6aff[_0x33f539(0x93)]>0x0&&console[_0x33f539(0xa2)](a58_0x1fdcf8[_0x33f539(0x85)](_0x2f6aff[_0x33f539(0x93)]+'\x20warning(s)\x20found')),0x1):(console['log'](a58_0x1fdcf8[_0x33f539(0x6e)](_0x33f539(0x96)+_0x2f6aff[_0x33f539(0x94)]+_0x33f539(0x99))),_0x2f6aff[_0x33f539(0x93)]>0x0&&console[_0x33f539(0xa2)](a58_0x1fdcf8['yellow'](_0x2f6aff['warningCount']+'\x20warning(s)\x20found')),0x0);}}
@@ -1 +1 @@
1
- const a58_0x36863c=a58_0x1708;(function(_0x39463b,_0x345428){const _0x5e2f25=a58_0x1708,_0x51a30a=_0x39463b();while(!![]){try{const _0x197863=-parseInt(_0x5e2f25(0x106))/0x1+-parseInt(_0x5e2f25(0x134))/0x2+parseInt(_0x5e2f25(0x11d))/0x3+-parseInt(_0x5e2f25(0x121))/0x4+parseInt(_0x5e2f25(0x135))/0x5+parseInt(_0x5e2f25(0x11c))/0x6+-parseInt(_0x5e2f25(0x120))/0x7;if(_0x197863===_0x345428)break;else _0x51a30a['push'](_0x51a30a['shift']());}catch(_0x149099){_0x51a30a['push'](_0x51a30a['shift']());}}}(a58_0x1d96,0x6fdf4));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a58_0x1708(_0x11e5f2,_0xa18006){_0x11e5f2=_0x11e5f2-0xf8;const _0x1d9681=a58_0x1d96();let _0x17087b=_0x1d9681[_0x11e5f2];return _0x17087b;}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 a58_0x40354f from'chalk';function a58_0x1d96(){const _0x50c1c7=['children','Recursive\x20mode:\x20enabled','1639218fTfmCX','118396ckZKag','length','json','name','\x20\x20Cause:\x20','test','listUnifiedWithJourneys','size','journeyBundleName','type','Set\x20a\x20parent\x20segment\x20context\x20first:','✔\x20Found\x20','Searching\x20the\x20tree\x20for\x20names\x20matching\x20','...','data','filter','\x20segments\x20share\x20this\x20name\x20—\x20pass\x20the\x20full\x20path\x20(or\x20id)\x20to\x20`tdx\x20sg\x20move`;\x20do\x20not\x20assume\x20the\x20first.','sort','\x20match','943558RGmetp','3099935LmNElJ','Building\x20hierarchy\x20tree...','Folder\x20ID:\x20','dim','List\x20folders\x20and\x20child\x20segments','folderId','maxDepth','listUnified','folder','error','toLowerCase','folders','replace','Parent\x20ID:\x20','\x5c$&','padEnd','execute',']\x20matching\x20\x27','recursive','segments','segment','Found\x20','(id\x20','journeys',',\x20and\x20','map','Error:\x20','\x20matching\x20\x27','(empty)','site','description','/app/ps/','parentId','✔\x20Built\x20tree\x20with\x20','localeCompare','Resolving\x20parent\x20segment\x20\x27','resolvePathToResource','jsonl','790643iRQRlG','listRecursive','includes','listWithPattern','cause','\x20folder','\x27...','verbose','/e/','journey','\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.','No\x20items\x20match\x20pattern:\x20','Parent\x20segment\x20context:\x20','path','Resolving\x20path\x20\x27','log','Site:\x20','\x20segment','\x20journey','searchByName','format','\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22','5096460kcBfYE','1545078UNyeOi'];a58_0x1d96=function(){return _0x50c1c7;};return a58_0x1d96();}export class SegmentsCommand extends BaseCommand{['name']=a58_0x36863c(0x148);[a58_0x36863c(0xfe)]=a58_0x36863c(0x139);async[a58_0x36863c(0x145)](_0x5ee13d){const _0x50ae0d=a58_0x36863c,{options:_0x59ad4e,args:_0x58da26}=_0x5ee13d,_0x58ed9d=_0x59ad4e[_0x50ae0d(0x147)],_0x19bdd5=_0x58da26[0x0];try{const _0x573903=_0x59ad4e['parentSegment'];_0x59ad4e[_0x50ae0d(0x10d)]&&(console[_0x50ae0d(0x13e)](_0x50ae0d(0x116)+_0x59ad4e[_0x50ae0d(0xfd)]),console[_0x50ae0d(0x13e)](_0x50ae0d(0x112)+(_0x573903||'(not\x20set)')),_0x19bdd5&&console[_0x50ae0d(0x13e)]('Folder/pattern\x20arg:\x20'+_0x19bdd5),_0x58ed9d&&console[_0x50ae0d(0x13e)](_0x50ae0d(0x11f)));if(!_0x573903)return console['error']('Error:\x20No\x20parent\x20segment\x20context\x20set.'),console['error'](''),console[_0x50ae0d(0x13e)](_0x50ae0d(0x12b)),console[_0x50ae0d(0x13e)]('\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22'),console[_0x50ae0d(0x13e)](_0x50ae0d(0x11b)),console[_0x50ae0d(0x13e)](''),console[_0x50ae0d(0x13e)]('Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.'),0x1;if(_0x19bdd5&&_0x58ed9d)return await this[_0x50ae0d(0x119)](_0x5ee13d,_0x573903,_0x19bdd5);const _0xe62aaf=_0x19bdd5&&(_0x19bdd5[_0x50ae0d(0x108)]('*')||_0x19bdd5['includes']('?'));if(_0xe62aaf)return await this[_0x50ae0d(0x109)](_0x5ee13d,_0x573903,_0x19bdd5);const _0x3c3841=_0x19bdd5?_0x573903+'/'+_0x19bdd5:_0x573903;return _0x58ed9d?await this[_0x50ae0d(0x107)](_0x5ee13d,_0x3c3841):await this[_0x50ae0d(0x13c)](_0x5ee13d,_0x3c3841);}catch(_0x284537){if(_0x284537 instanceof SDKError)return console[_0x50ae0d(0x13e)](_0x50ae0d(0xfa)+_0x284537['message']),_0x284537[_0x50ae0d(0x10a)]&&console['error'](_0x50ae0d(0x125)+_0x284537[_0x50ae0d(0x10a)]),0x1;throw _0x284537;}}async[a58_0x36863c(0x119)](_0x5192be,_0x3e353e,_0x5e4463){const _0x57c4ef=a58_0x36863c,{options:_0x44e69a,tdx:_0x2fa232}=_0x5192be,_0x20c72c='\x22'+_0x5e4463+'\x22',_0x21a98d=await withSpinner(_0x57c4ef(0x114)+_0x3e353e+_0x57c4ef(0x10c),()=>_0x2fa232[_0x57c4ef(0x149)][_0x57c4ef(0x104)](_0x3e353e),{'verbose':_0x44e69a['verbose']}),_0x1c9844=_0x21a98d['data'],_0x4d4485=_0x44e69a[_0x57c4ef(0x13b)]||0xa,_0x41bebe=await withSpinner(_0x57c4ef(0x12d)+_0x20c72c+_0x57c4ef(0x12e),()=>_0x2fa232[_0x57c4ef(0x149)]['listRecursive'](_0x1c9844['parentId'],_0x1c9844[_0x57c4ef(0x13a)],0x0,_0x4d4485),{'verbose':_0x44e69a['verbose']}),_0x496c18=searchTreeByName(_0x41bebe[_0x57c4ef(0x12f)],_0x5e4463),_0x2fea21=_0x1aeb11=>getConsoleNextUrl(_0x44e69a[_0x57c4ef(0xfd)],'/app/ps/'+_0x1c9844[_0x57c4ef(0x100)]+'/e/'+_0x1aeb11),_0x5c4341=[..._0x496c18][_0x57c4ef(0x132)]((_0x552f48,_0xa2fdac)=>_0x552f48[_0x57c4ef(0x113)][_0x57c4ef(0x102)](_0xa2fdac[_0x57c4ef(0x113)])),_0x1b8dc1=0x32,_0xd2c8ad=_0x57c4ef(0x14a)+_0x496c18[_0x57c4ef(0x122)]+_0x57c4ef(0x133)+(_0x496c18[_0x57c4ef(0x122)]!==0x1?'es':'');console[_0x57c4ef(0x13e)](_0x496c18[_0x57c4ef(0x122)]>_0x1b8dc1?'✔\x20'+_0xd2c8ad+_0x57c4ef(0x110):'✔\x20'+_0xd2c8ad);if(_0x44e69a[_0x57c4ef(0x11a)]===_0x57c4ef(0x123)||_0x44e69a[_0x57c4ef(0x11a)]===_0x57c4ef(0x105)){const _0x42a4b4=_0x5c4341[_0x57c4ef(0xf9)](_0x179942=>({..._0x179942,..._0x179942[_0x57c4ef(0x12a)]==='segment'?{'url':_0x2fea21(_0x179942['id'])}:{}}));return await handleSDKOutput(_0x42a4b4,_0x44e69a),0x0;}if(_0x496c18['length']===0x0)return console[_0x57c4ef(0x115)]('No\x20folders\x20or\x20segments\x20match\x20'+_0x20c72c),0x0;for(const _0x3804b4 of _0x5c4341){console['log'](_0x3804b4['type'][_0x57c4ef(0x144)](0x8)+'\x20'+_0x3804b4[_0x57c4ef(0x113)]+'\x20\x20'+a58_0x40354f[_0x57c4ef(0x138)](_0x57c4ef(0x14b)+_0x3804b4['id']+')'));}const _0x352766=_0x496c18[_0x57c4ef(0x130)](_0x551b24=>_0x551b24[_0x57c4ef(0x12a)]===_0x57c4ef(0x149)),_0x11f7e3=new Set(_0x352766[_0x57c4ef(0xf9)](_0x439d9e=>_0x439d9e['name'][_0x57c4ef(0x13f)]()))[_0x57c4ef(0x128)]===0x1;return _0x352766[_0x57c4ef(0x122)]>0x1&&_0x11f7e3&&console[_0x57c4ef(0x115)](a58_0x40354f[_0x57c4ef(0x138)]('\x0a'+_0x352766[_0x57c4ef(0x122)]+_0x57c4ef(0x131))),0x0;}async[a58_0x36863c(0x109)](_0x374428,_0x563bbd,_0x487bfc){const _0x32814d=a58_0x36863c,{options:_0xd22170,tdx:_0x5d7a67}=_0x374428,_0x1785d3=await withSpinner(_0x32814d(0x103)+_0x563bbd+_0x32814d(0x10c),()=>_0x5d7a67[_0x32814d(0x149)][_0x32814d(0x104)](_0x563bbd),{'verbose':_0xd22170[_0x32814d(0x10d)]}),_0x234729=_0x1785d3['data'],_0x51a5d0=await withSpinner('Listing\x20folders,\x20segments,\x20and\x20journeys...',()=>_0x5d7a67['segment'][_0x32814d(0x127)](_0x234729[_0x32814d(0x100)],_0x234729[_0x32814d(0x13a)]),{'verbose':_0xd22170['verbose']}),{folders:_0x5f286f,segments:_0x57798a,journeys:_0x18ee17}=_0x51a5d0[_0x32814d(0x12f)],_0x14005b=_0x487bfc[_0x32814d(0x141)](/[.+^${}()|[\]\\]/g,_0x32814d(0x143))['replace'](/\*/g,'.*')[_0x32814d(0x141)](/\?/g,'.'),_0x540ab4=new RegExp('^'+_0x14005b+'$','i'),_0xbc250a=_0x5f286f[_0x32814d(0x130)](_0x487c22=>_0x540ab4['test'](_0x487c22[_0x32814d(0x124)])),_0x592f5d=_0x57798a[_0x32814d(0x130)](_0xcec9af=>_0x540ab4[_0x32814d(0x126)](_0xcec9af[_0x32814d(0x124)])),_0x1b2ed9=_0x18ee17['filter'](_0x214dae=>_0x540ab4[_0x32814d(0x126)](_0x214dae[_0x32814d(0x129)])),_0x257ec7=_0xbc250a[_0x32814d(0x122)]+_0x592f5d['length']+_0x1b2ed9[_0x32814d(0x122)];console['error'](_0x32814d(0x12c)+_0xbc250a['length']+'\x20folder'+(_0xbc250a['length']!==0x1?'s':'')+',\x20'+_0x592f5d[_0x32814d(0x122)]+'\x20segment'+(_0x592f5d[_0x32814d(0x122)]!==0x1?'s':'')+_0x32814d(0xf8)+_0x1b2ed9['length']+_0x32814d(0x118)+(_0x1b2ed9[_0x32814d(0x122)]!==0x1?'s':'')+_0x32814d(0xfb)+_0x487bfc+'\x27');const _0x1c538c=_0x280ead=>{const _0x7fd954=_0x32814d;return getConsoleNextUrl(_0xd22170[_0x7fd954(0xfd)],_0x7fd954(0xff)+_0x234729[_0x7fd954(0x100)]+_0x7fd954(0x10e)+_0x280ead);},_0x37f74d=_0xd22170['format']===_0x32814d(0x123)||_0xd22170[_0x32814d(0x11a)]===_0x32814d(0x105);if(_0x37f74d){const _0x2c26e1=[..._0xbc250a[_0x32814d(0xf9)](_0x425c6f=>({..._0x425c6f,'type':'folder'})),..._0x592f5d[_0x32814d(0xf9)](_0x16d73d=>({..._0x16d73d,'type':'segment','url':_0x1c538c(_0x16d73d['id'])})),..._0x1b2ed9[_0x32814d(0xf9)](_0x217748=>({..._0x217748,'name':_0x217748[_0x32814d(0x129)],'type':_0x32814d(0x10f)}))][_0x32814d(0x132)]((_0x13b4cd,_0x3369b5)=>_0x13b4cd[_0x32814d(0x124)]['localeCompare'](_0x3369b5[_0x32814d(0x124)]));await handleSDKOutput(_0x2c26e1,_0xd22170);}else{if(_0x257ec7===0x0)console[_0x32814d(0x115)](_0x32814d(0x111)+_0x487bfc);else{console[_0x32814d(0x115)](a58_0x40354f[_0x32814d(0x138)]('['+_0x563bbd+_0x32814d(0x146)+_0x487bfc+'\x27'));const _0x44c56d=formatFlatList(_0xbc250a,_0x592f5d,{'showMetadata':!![],'getSegmentUrl':_0x1c538c},_0x1b2ed9);console['log'](_0x44c56d);}}return 0x0;}async[a58_0x36863c(0x13c)](_0x1f9bbc,_0x41ea90){const _0x2f007e=a58_0x36863c,{options:_0xc3e19f,tdx:_0x325545}=_0x1f9bbc,_0x7bc288=await withSpinner(_0x2f007e(0x114)+_0x41ea90+_0x2f007e(0x10c),()=>_0x325545[_0x2f007e(0x149)][_0x2f007e(0x104)](_0x41ea90),{'verbose':_0xc3e19f[_0x2f007e(0x10d)]}),_0x3613e2=_0x7bc288[_0x2f007e(0x12f)];_0xc3e19f[_0x2f007e(0x10d)]&&(console[_0x2f007e(0x13e)]('Parent\x20ID:\x20'+_0x3613e2['parentId']),_0x3613e2['folderId']&&console['error']('Folder\x20ID:\x20'+_0x3613e2[_0x2f007e(0x13a)]));const _0x31162f=await withSpinner('Listing\x20folders,\x20segments,\x20and\x20journeys...',()=>_0x325545[_0x2f007e(0x149)]['listUnifiedWithJourneys'](_0x3613e2[_0x2f007e(0x100)],_0x3613e2[_0x2f007e(0x13a)]),{'verbose':_0xc3e19f['verbose']}),{folders:_0x33eb4e,segments:_0x3870a3,journeys:_0x91b5b7}=_0x31162f[_0x2f007e(0x12f)],_0x39d986=_0x33eb4e[_0x2f007e(0x122)]+_0x3870a3[_0x2f007e(0x122)]+_0x91b5b7[_0x2f007e(0x122)];console[_0x2f007e(0x13e)](_0x2f007e(0x12c)+_0x33eb4e[_0x2f007e(0x122)]+_0x2f007e(0x10b)+(_0x33eb4e[_0x2f007e(0x122)]!==0x1?'s':'')+',\x20'+_0x3870a3[_0x2f007e(0x122)]+_0x2f007e(0x117)+(_0x3870a3[_0x2f007e(0x122)]!==0x1?'s':'')+',\x20and\x20'+_0x91b5b7['length']+'\x20journey'+(_0x91b5b7[_0x2f007e(0x122)]!==0x1?'s':''));const _0x1decae=_0x56e869=>{const _0x914806=_0x2f007e;return getConsoleNextUrl(_0xc3e19f[_0x914806(0xfd)],_0x914806(0xff)+_0x3613e2[_0x914806(0x100)]+'/e/'+_0x56e869);},_0x558f26=_0x17ce22=>{const _0x38e5e6=_0x2f007e;return getConsoleNextUrl(_0xc3e19f[_0x38e5e6(0xfd)],_0x38e5e6(0xff)+_0x3613e2['parentId']+'/e/'+_0x17ce22+'/j/da');},_0x3ab7f1=_0xc3e19f[_0x2f007e(0x11a)]==='json'||_0xc3e19f[_0x2f007e(0x11a)]===_0x2f007e(0x105);if(_0x3ab7f1){const _0x7ca601=[..._0x33eb4e['map'](_0x288f4e=>({..._0x288f4e,'type':_0x2f007e(0x13d)})),..._0x3870a3[_0x2f007e(0xf9)](_0x11d3aa=>({..._0x11d3aa,'type':_0x2f007e(0x149),'url':_0x1decae(_0x11d3aa['id'])})),..._0x91b5b7[_0x2f007e(0xf9)](_0x3cba65=>({..._0x3cba65,'name':_0x3cba65['journeyBundleName'],'type':_0x2f007e(0x10f),'url':_0x558f26(_0x3cba65['id'])}))][_0x2f007e(0x132)]((_0x2f044d,_0x35f2ff)=>_0x2f044d[_0x2f007e(0x124)][_0x2f007e(0x102)](_0x35f2ff[_0x2f007e(0x124)]));await handleSDKOutput(_0x7ca601,_0xc3e19f);}else{if(_0x39d986===0x0)console[_0x2f007e(0x115)](a58_0x40354f[_0x2f007e(0x138)]('['+_0x41ea90+']')),console[_0x2f007e(0x115)](_0x2f007e(0xfc));else{console[_0x2f007e(0x115)](a58_0x40354f[_0x2f007e(0x138)]('['+_0x41ea90+']'));const _0x9d9081=formatFlatList(_0x33eb4e,_0x3870a3,{'showMetadata':!![],'getSegmentUrl':_0x1decae,'getJourneyUrl':_0x558f26},_0x91b5b7);console[_0x2f007e(0x115)](_0x9d9081);}}return 0x0;}async[a58_0x36863c(0x107)](_0x225641,_0x43950f){const _0x50dba1=a58_0x36863c,{options:_0x6cd5ce,tdx:_0x57bc56}=_0x225641,_0x4dcbe6=await withSpinner(_0x50dba1(0x114)+_0x43950f+_0x50dba1(0x10c),()=>_0x57bc56[_0x50dba1(0x149)][_0x50dba1(0x104)](_0x43950f),{'verbose':_0x6cd5ce[_0x50dba1(0x10d)]}),_0x2b51f3=_0x4dcbe6[_0x50dba1(0x12f)];_0x6cd5ce[_0x50dba1(0x10d)]&&(console['error'](_0x50dba1(0x142)+_0x2b51f3[_0x50dba1(0x100)]),_0x2b51f3[_0x50dba1(0x13a)]&&console[_0x50dba1(0x13e)](_0x50dba1(0x137)+_0x2b51f3[_0x50dba1(0x13a)]));const _0x5cabc3=_0x6cd5ce[_0x50dba1(0x13b)]||0xa,_0x4be82b=await withSpinner(_0x50dba1(0x136),()=>_0x57bc56[_0x50dba1(0x149)]['listRecursive'](_0x2b51f3[_0x50dba1(0x100)],_0x2b51f3['folderId'],0x0,_0x5cabc3),{'verbose':_0x6cd5ce['verbose']}),_0x10fb84=_0x4be82b['data'],_0x517074=_0x5f1845=>{const _0x4aee09=_0x50dba1;let _0x23cd91=0x0,_0x210113=0x0,_0x1eaf42=0x0;for(const _0x62fb43 of _0x5f1845){if(_0x62fb43['type']===_0x4aee09(0x13d))_0x23cd91++;else{if(_0x62fb43[_0x4aee09(0x12a)]===_0x4aee09(0x149))_0x210113++;else{if(_0x62fb43['type']===_0x4aee09(0x10f))_0x1eaf42++;}}if(_0x62fb43[_0x4aee09(0x11e)]){const _0x217830=_0x517074(_0x62fb43[_0x4aee09(0x11e)]);_0x23cd91+=_0x217830[_0x4aee09(0x140)],_0x210113+=_0x217830[_0x4aee09(0x148)],_0x1eaf42+=_0x217830[_0x4aee09(0x14c)];}}return{'folders':_0x23cd91,'segments':_0x210113,'journeys':_0x1eaf42};},_0x5b80f9=_0x517074(_0x10fb84);console[_0x50dba1(0x13e)](_0x50dba1(0x101)+_0x5b80f9[_0x50dba1(0x140)]+_0x50dba1(0x10b)+(_0x5b80f9[_0x50dba1(0x140)]!==0x1?'s':'')+',\x20'+_0x5b80f9['segments']+_0x50dba1(0x117)+(_0x5b80f9[_0x50dba1(0x148)]!==0x1?'s':'')+_0x50dba1(0xf8)+_0x5b80f9[_0x50dba1(0x14c)]+_0x50dba1(0x118)+(_0x5b80f9[_0x50dba1(0x14c)]!==0x1?'s':''));const _0x2bf3c8=_0x546dae=>{const _0x56fe3c=_0x50dba1;return getConsoleNextUrl(_0x6cd5ce['site'],_0x56fe3c(0xff)+_0x2b51f3[_0x56fe3c(0x100)]+_0x56fe3c(0x10e)+_0x546dae);},_0x560501=_0x5d83cd=>{const _0x150fa4=_0x50dba1;return getConsoleNextUrl(_0x6cd5ce[_0x150fa4(0xfd)],'/app/ps/'+_0x2b51f3['parentId']+'/e/'+_0x5d83cd+'/j/da');};if(_0x6cd5ce['format']==='json'||_0x6cd5ce[_0x50dba1(0x11a)]===_0x50dba1(0x105))await handleSDKOutput(_0x10fb84,_0x6cd5ce);else{console[_0x50dba1(0x115)](a58_0x40354f[_0x50dba1(0x138)]('['+_0x43950f+']'));const _0x49f78c=formatTree(_0x10fb84,{'showMetadata':!![],'getSegmentUrl':_0x2bf3c8,'getJourneyUrl':_0x560501});console['log'](_0x49f78c);}return 0x0;}}
1
+ const a59_0x48fbc7=a59_0x4d80;(function(_0x1e64a5,_0x161215){const _0x5e0726=a59_0x4d80,_0xf28a66=_0x1e64a5();while(!![]){try{const _0x239a82=parseInt(_0x5e0726(0x20f))/0x1*(parseInt(_0x5e0726(0x22f))/0x2)+parseInt(_0x5e0726(0x21c))/0x3+parseInt(_0x5e0726(0x1de))/0x4+parseInt(_0x5e0726(0x202))/0x5+-parseInt(_0x5e0726(0x20b))/0x6+-parseInt(_0x5e0726(0x206))/0x7*(parseInt(_0x5e0726(0x1f3))/0x8)+-parseInt(_0x5e0726(0x20d))/0x9*(-parseInt(_0x5e0726(0x221))/0xa);if(_0x239a82===_0x161215)break;else _0xf28a66['push'](_0xf28a66['shift']());}catch(_0x1d84ff){_0xf28a66['push'](_0xf28a66['shift']());}}}(a59_0x373a,0x1afcf));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a59_0x4d80(_0x5cec3a,_0x28df66){_0x5cec3a=_0x5cec3a-0x1d6;const _0x373a78=a59_0x373a();let _0x4d807b=_0x373a78[_0x5cec3a];return _0x4d807b;}function a59_0x373a(){const _0x2d3bc6=['\x20matching\x20\x27',']\x20matching\x20\x27','114955rSvRSA','...','Found\x20','message','28VbcXft','resolvePathToResource','folder','path','\x27...','715728WSnxkb',',\x20and\x20','36081VuqogO','Error:\x20','50493hlVzFJ','\x20journey','journey','List\x20folders\x20and\x20child\x20segments','length','cause','type','segments','\x20folder','journeys','listUnifiedWithJourneys','log','dim','99009FrXvZp','format','jsonl','json','maxDepth','270ItxRfZ','listWithPattern','No\x20folders\x20or\x20segments\x20match\x20','parentId','Searching\x20the\x20tree\x20for\x20names\x20matching\x20','verbose','folders','listUnified','Folder\x20ID:\x20','Folder/pattern\x20arg:\x20','filter','includes','replace','name','2OiELEj','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','sort','listRecursive','Resolving\x20parent\x20segment\x20\x27','/j/da','/e/','padEnd','Error:\x20No\x20parent\x20segment\x20context\x20set.','parentSegment','847236gZXsZy','(empty)','site','localeCompare','journeyBundleName','/app/ps/','data','(id\x20','size','Parent\x20segment\x20context:\x20','\x20segments\x20share\x20this\x20name\x20—\x20pass\x20the\x20full\x20path\x20(or\x20id)\x20to\x20`tdx\x20sg\x20move`;\x20do\x20not\x20assume\x20the\x20first.','execute','description','✔\x20Found\x20','Building\x20hierarchy\x20tree...','segment','\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.','\x5c$&','Site:\x20','map','Parent\x20ID:\x20','393416qtPqzh','\x20segment','(not\x20set)','Set\x20a\x20parent\x20segment\x20context\x20first:','folderId','\x20match','Resolving\x20path\x20\x27','test','\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22','error','Listing\x20folders,\x20segments,\x20and\x20journeys...','toLowerCase','children'];a59_0x373a=function(){return _0x2d3bc6;};return a59_0x373a();}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 a59_0x28c3bd from'chalk';export class SegmentsCommand extends BaseCommand{[a59_0x48fbc7(0x22e)]='segments';[a59_0x48fbc7(0x1ea)]=a59_0x48fbc7(0x212);async[a59_0x48fbc7(0x1e9)](_0x47c31c){const _0x1961a9=a59_0x48fbc7,{options:_0x5288a0,args:_0x3c9da3}=_0x47c31c,_0x874fc7=_0x5288a0['recursive'],_0x1692e6=_0x3c9da3[0x0];try{const _0x165683=_0x5288a0[_0x1961a9(0x1dd)];_0x5288a0['verbose']&&(console['error'](_0x1961a9(0x1f0)+_0x5288a0[_0x1961a9(0x1e0)]),console[_0x1961a9(0x1fc)](_0x1961a9(0x1e7)+(_0x165683||_0x1961a9(0x1f5))),_0x1692e6&&console[_0x1961a9(0x1fc)](_0x1961a9(0x22a)+_0x1692e6),_0x874fc7&&console[_0x1961a9(0x1fc)]('Recursive\x20mode:\x20enabled'));if(!_0x165683)return console[_0x1961a9(0x1fc)](_0x1961a9(0x1dc)),console[_0x1961a9(0x1fc)](''),console[_0x1961a9(0x1fc)](_0x1961a9(0x1f6)),console[_0x1961a9(0x1fc)]('\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22'),console[_0x1961a9(0x1fc)](_0x1961a9(0x1fb)),console[_0x1961a9(0x1fc)](''),console[_0x1961a9(0x1fc)](_0x1961a9(0x230)),0x1;if(_0x1692e6&&_0x874fc7)return await this['searchByName'](_0x47c31c,_0x165683,_0x1692e6);const _0x15dbe0=_0x1692e6&&(_0x1692e6[_0x1961a9(0x22c)]('*')||_0x1692e6[_0x1961a9(0x22c)]('?'));if(_0x15dbe0)return await this[_0x1961a9(0x222)](_0x47c31c,_0x165683,_0x1692e6);const _0x2fce16=_0x1692e6?_0x165683+'/'+_0x1692e6:_0x165683;return _0x874fc7?await this[_0x1961a9(0x1d7)](_0x47c31c,_0x2fce16):await this[_0x1961a9(0x228)](_0x47c31c,_0x2fce16);}catch(_0x3347fe){if(_0x3347fe instanceof SDKError)return console[_0x1961a9(0x1fc)](_0x1961a9(0x20e)+_0x3347fe[_0x1961a9(0x205)]),_0x3347fe[_0x1961a9(0x214)]&&console[_0x1961a9(0x1fc)]('\x20\x20Cause:\x20'+_0x3347fe['cause']),0x1;throw _0x3347fe;}}async['searchByName'](_0x7d4524,_0x1b3ebe,_0x244fc4){const _0x21a148=a59_0x48fbc7,{options:_0x42af65,tdx:_0x51dd1a}=_0x7d4524,_0x2cca48='\x22'+_0x244fc4+'\x22',_0x200262=await withSpinner(_0x21a148(0x1f9)+_0x1b3ebe+'\x27...',()=>_0x51dd1a['segment'][_0x21a148(0x207)](_0x1b3ebe),{'verbose':_0x42af65['verbose']}),_0x522fb5=_0x200262[_0x21a148(0x1e4)],_0x181e8e=_0x42af65[_0x21a148(0x220)]||0xa,_0x5ca293=await withSpinner(_0x21a148(0x225)+_0x2cca48+_0x21a148(0x203),()=>_0x51dd1a[_0x21a148(0x1ed)][_0x21a148(0x1d7)](_0x522fb5[_0x21a148(0x224)],_0x522fb5['folderId'],0x0,_0x181e8e),{'verbose':_0x42af65[_0x21a148(0x226)]}),_0x98ea25=searchTreeByName(_0x5ca293[_0x21a148(0x1e4)],_0x244fc4),_0x116cc8=_0x501dd0=>getConsoleNextUrl(_0x42af65[_0x21a148(0x1e0)],_0x21a148(0x1e3)+_0x522fb5[_0x21a148(0x224)]+'/e/'+_0x501dd0),_0x1999d6=[..._0x98ea25][_0x21a148(0x1d6)]((_0x212f90,_0x33989d)=>_0x212f90['path'][_0x21a148(0x1e1)](_0x33989d[_0x21a148(0x209)])),_0x97f041=0x32,_0xb8dd3e=_0x21a148(0x204)+_0x98ea25[_0x21a148(0x213)]+_0x21a148(0x1f8)+(_0x98ea25['length']!==0x1?'es':'');console['error'](_0x98ea25[_0x21a148(0x213)]>_0x97f041?'✔\x20'+_0xb8dd3e+_0x21a148(0x1ee):'✔\x20'+_0xb8dd3e);if(_0x42af65[_0x21a148(0x21d)]===_0x21a148(0x21f)||_0x42af65[_0x21a148(0x21d)]===_0x21a148(0x21e)){const _0x466e5a=_0x1999d6[_0x21a148(0x1f1)](_0xe51a2c=>({..._0xe51a2c,..._0xe51a2c[_0x21a148(0x215)]===_0x21a148(0x1ed)?{'url':_0x116cc8(_0xe51a2c['id'])}:{}}));return await handleSDKOutput(_0x466e5a,_0x42af65),0x0;}if(_0x98ea25[_0x21a148(0x213)]===0x0)return console[_0x21a148(0x21a)](_0x21a148(0x223)+_0x2cca48),0x0;for(const _0x356e85 of _0x1999d6){console[_0x21a148(0x21a)](_0x356e85[_0x21a148(0x215)][_0x21a148(0x1db)](0x8)+'\x20'+_0x356e85[_0x21a148(0x209)]+'\x20\x20'+a59_0x28c3bd[_0x21a148(0x21b)](_0x21a148(0x1e5)+_0x356e85['id']+')'));}const _0x1e5b65=_0x98ea25[_0x21a148(0x22b)](_0x1960d6=>_0x1960d6[_0x21a148(0x215)]===_0x21a148(0x1ed)),_0x1d9d90=new Set(_0x1e5b65[_0x21a148(0x1f1)](_0x4e5d7c=>_0x4e5d7c[_0x21a148(0x22e)][_0x21a148(0x1fe)]()))[_0x21a148(0x1e6)]===0x1;return _0x1e5b65['length']>0x1&&_0x1d9d90&&console[_0x21a148(0x21a)](a59_0x28c3bd['dim']('\x0a'+_0x1e5b65[_0x21a148(0x213)]+_0x21a148(0x1e8))),0x0;}async[a59_0x48fbc7(0x222)](_0x15fdf2,_0x30f6e6,_0x5c80b0){const _0x1a9f7c=a59_0x48fbc7,{options:_0x2d6096,tdx:_0x4af338}=_0x15fdf2,_0x27874d=await withSpinner(_0x1a9f7c(0x1d8)+_0x30f6e6+'\x27...',()=>_0x4af338['segment']['resolvePathToResource'](_0x30f6e6),{'verbose':_0x2d6096[_0x1a9f7c(0x226)]}),_0x2a8834=_0x27874d[_0x1a9f7c(0x1e4)],_0x4c83c9=await withSpinner(_0x1a9f7c(0x1fd),()=>_0x4af338[_0x1a9f7c(0x1ed)][_0x1a9f7c(0x219)](_0x2a8834['parentId'],_0x2a8834[_0x1a9f7c(0x1f7)]),{'verbose':_0x2d6096[_0x1a9f7c(0x226)]}),{folders:_0x5c3f41,segments:_0x2b5707,journeys:_0x3cb12a}=_0x4c83c9[_0x1a9f7c(0x1e4)],_0x18050a=_0x5c80b0[_0x1a9f7c(0x22d)](/[.+^${}()|[\]\\]/g,_0x1a9f7c(0x1ef))[_0x1a9f7c(0x22d)](/\*/g,'.*')[_0x1a9f7c(0x22d)](/\?/g,'.'),_0x57e8eb=new RegExp('^'+_0x18050a+'$','i'),_0x3ddcc4=_0x5c3f41['filter'](_0x216a59=>_0x57e8eb[_0x1a9f7c(0x1fa)](_0x216a59[_0x1a9f7c(0x22e)])),_0x3e2c55=_0x2b5707[_0x1a9f7c(0x22b)](_0x46c327=>_0x57e8eb['test'](_0x46c327[_0x1a9f7c(0x22e)])),_0x109e19=_0x3cb12a[_0x1a9f7c(0x22b)](_0x4a2714=>_0x57e8eb[_0x1a9f7c(0x1fa)](_0x4a2714[_0x1a9f7c(0x1e2)])),_0x50274e=_0x3ddcc4[_0x1a9f7c(0x213)]+_0x3e2c55['length']+_0x109e19[_0x1a9f7c(0x213)];console[_0x1a9f7c(0x1fc)](_0x1a9f7c(0x1eb)+_0x3ddcc4[_0x1a9f7c(0x213)]+_0x1a9f7c(0x217)+(_0x3ddcc4[_0x1a9f7c(0x213)]!==0x1?'s':'')+',\x20'+_0x3e2c55[_0x1a9f7c(0x213)]+_0x1a9f7c(0x1f4)+(_0x3e2c55['length']!==0x1?'s':'')+_0x1a9f7c(0x20c)+_0x109e19['length']+'\x20journey'+(_0x109e19['length']!==0x1?'s':'')+_0x1a9f7c(0x200)+_0x5c80b0+'\x27');const _0x222718=_0x1ef6f7=>{const _0x24ba8b=_0x1a9f7c;return getConsoleNextUrl(_0x2d6096[_0x24ba8b(0x1e0)],'/app/ps/'+_0x2a8834['parentId']+_0x24ba8b(0x1da)+_0x1ef6f7);},_0x2f44c5=_0x2d6096[_0x1a9f7c(0x21d)]==='json'||_0x2d6096[_0x1a9f7c(0x21d)]==='jsonl';if(_0x2f44c5){const _0x15d139=[..._0x3ddcc4[_0x1a9f7c(0x1f1)](_0x29c6ff=>({..._0x29c6ff,'type':_0x1a9f7c(0x208)})),..._0x3e2c55[_0x1a9f7c(0x1f1)](_0x34d23f=>({..._0x34d23f,'type':_0x1a9f7c(0x1ed),'url':_0x222718(_0x34d23f['id'])})),..._0x109e19[_0x1a9f7c(0x1f1)](_0x4f95d8=>({..._0x4f95d8,'name':_0x4f95d8[_0x1a9f7c(0x1e2)],'type':_0x1a9f7c(0x211)}))]['sort']((_0x4324f0,_0x5b6090)=>_0x4324f0[_0x1a9f7c(0x22e)]['localeCompare'](_0x5b6090[_0x1a9f7c(0x22e)]));await handleSDKOutput(_0x15d139,_0x2d6096);}else{if(_0x50274e===0x0)console[_0x1a9f7c(0x21a)]('No\x20items\x20match\x20pattern:\x20'+_0x5c80b0);else{console['log'](a59_0x28c3bd[_0x1a9f7c(0x21b)]('['+_0x30f6e6+_0x1a9f7c(0x201)+_0x5c80b0+'\x27'));const _0x42abb9=formatFlatList(_0x3ddcc4,_0x3e2c55,{'showMetadata':!![],'getSegmentUrl':_0x222718},_0x109e19);console[_0x1a9f7c(0x21a)](_0x42abb9);}}return 0x0;}async[a59_0x48fbc7(0x228)](_0x14dcff,_0x4346ce){const _0x3bb8e6=a59_0x48fbc7,{options:_0x358fa8,tdx:_0x9df5fe}=_0x14dcff,_0x5dca71=await withSpinner('Resolving\x20path\x20\x27'+_0x4346ce+_0x3bb8e6(0x20a),()=>_0x9df5fe['segment']['resolvePathToResource'](_0x4346ce),{'verbose':_0x358fa8[_0x3bb8e6(0x226)]}),_0x7ba4cf=_0x5dca71[_0x3bb8e6(0x1e4)];_0x358fa8[_0x3bb8e6(0x226)]&&(console['error'](_0x3bb8e6(0x1f2)+_0x7ba4cf[_0x3bb8e6(0x224)]),_0x7ba4cf[_0x3bb8e6(0x1f7)]&&console[_0x3bb8e6(0x1fc)](_0x3bb8e6(0x229)+_0x7ba4cf[_0x3bb8e6(0x1f7)]));const _0x5ca459=await withSpinner(_0x3bb8e6(0x1fd),()=>_0x9df5fe['segment'][_0x3bb8e6(0x219)](_0x7ba4cf['parentId'],_0x7ba4cf[_0x3bb8e6(0x1f7)]),{'verbose':_0x358fa8[_0x3bb8e6(0x226)]}),{folders:_0x1f9c9c,segments:_0x558bd4,journeys:_0x1bfe64}=_0x5ca459['data'],_0x46c67b=_0x1f9c9c['length']+_0x558bd4[_0x3bb8e6(0x213)]+_0x1bfe64['length'];console[_0x3bb8e6(0x1fc)](_0x3bb8e6(0x1eb)+_0x1f9c9c['length']+_0x3bb8e6(0x217)+(_0x1f9c9c[_0x3bb8e6(0x213)]!==0x1?'s':'')+',\x20'+_0x558bd4[_0x3bb8e6(0x213)]+_0x3bb8e6(0x1f4)+(_0x558bd4[_0x3bb8e6(0x213)]!==0x1?'s':'')+_0x3bb8e6(0x20c)+_0x1bfe64['length']+_0x3bb8e6(0x210)+(_0x1bfe64[_0x3bb8e6(0x213)]!==0x1?'s':''));const _0x293318=_0x454fc3=>{const _0x463d06=_0x3bb8e6;return getConsoleNextUrl(_0x358fa8[_0x463d06(0x1e0)],_0x463d06(0x1e3)+_0x7ba4cf[_0x463d06(0x224)]+_0x463d06(0x1da)+_0x454fc3);},_0x5bbb72=_0x390779=>{const _0x6d162d=_0x3bb8e6;return getConsoleNextUrl(_0x358fa8[_0x6d162d(0x1e0)],_0x6d162d(0x1e3)+_0x7ba4cf[_0x6d162d(0x224)]+_0x6d162d(0x1da)+_0x390779+'/j/da');},_0x48cade=_0x358fa8[_0x3bb8e6(0x21d)]==='json'||_0x358fa8['format']===_0x3bb8e6(0x21e);if(_0x48cade){const _0x1cf5aa=[..._0x1f9c9c['map'](_0x43a36c=>({..._0x43a36c,'type':'folder'})),..._0x558bd4[_0x3bb8e6(0x1f1)](_0x2d63d9=>({..._0x2d63d9,'type':_0x3bb8e6(0x1ed),'url':_0x293318(_0x2d63d9['id'])})),..._0x1bfe64[_0x3bb8e6(0x1f1)](_0x4f8829=>({..._0x4f8829,'name':_0x4f8829[_0x3bb8e6(0x1e2)],'type':_0x3bb8e6(0x211),'url':_0x5bbb72(_0x4f8829['id'])}))][_0x3bb8e6(0x1d6)]((_0x5653b8,_0x4c1840)=>_0x5653b8['name'][_0x3bb8e6(0x1e1)](_0x4c1840[_0x3bb8e6(0x22e)]));await handleSDKOutput(_0x1cf5aa,_0x358fa8);}else{if(_0x46c67b===0x0)console[_0x3bb8e6(0x21a)](a59_0x28c3bd['dim']('['+_0x4346ce+']')),console[_0x3bb8e6(0x21a)](_0x3bb8e6(0x1df));else{console[_0x3bb8e6(0x21a)](a59_0x28c3bd[_0x3bb8e6(0x21b)]('['+_0x4346ce+']'));const _0x1c05f7=formatFlatList(_0x1f9c9c,_0x558bd4,{'showMetadata':!![],'getSegmentUrl':_0x293318,'getJourneyUrl':_0x5bbb72},_0x1bfe64);console[_0x3bb8e6(0x21a)](_0x1c05f7);}}return 0x0;}async['listRecursive'](_0x29bdc9,_0x26ba37){const _0x31c876=a59_0x48fbc7,{options:_0x2d2b48,tdx:_0x13a01b}=_0x29bdc9,_0x18c7b7=await withSpinner(_0x31c876(0x1f9)+_0x26ba37+'\x27...',()=>_0x13a01b['segment'][_0x31c876(0x207)](_0x26ba37),{'verbose':_0x2d2b48[_0x31c876(0x226)]}),_0x51bc31=_0x18c7b7[_0x31c876(0x1e4)];_0x2d2b48[_0x31c876(0x226)]&&(console[_0x31c876(0x1fc)](_0x31c876(0x1f2)+_0x51bc31['parentId']),_0x51bc31[_0x31c876(0x1f7)]&&console[_0x31c876(0x1fc)]('Folder\x20ID:\x20'+_0x51bc31[_0x31c876(0x1f7)]));const _0x3d1ee4=_0x2d2b48[_0x31c876(0x220)]||0xa,_0xa28237=await withSpinner(_0x31c876(0x1ec),()=>_0x13a01b[_0x31c876(0x1ed)]['listRecursive'](_0x51bc31[_0x31c876(0x224)],_0x51bc31[_0x31c876(0x1f7)],0x0,_0x3d1ee4),{'verbose':_0x2d2b48['verbose']}),_0x4d972e=_0xa28237[_0x31c876(0x1e4)],_0x354b0c=_0x2971c9=>{const _0x440c7f=_0x31c876;let _0x5e8e2e=0x0,_0xe3646e=0x0,_0x5622cb=0x0;for(const _0x4a7f00 of _0x2971c9){if(_0x4a7f00[_0x440c7f(0x215)]===_0x440c7f(0x208))_0x5e8e2e++;else{if(_0x4a7f00[_0x440c7f(0x215)]==='segment')_0xe3646e++;else{if(_0x4a7f00[_0x440c7f(0x215)]===_0x440c7f(0x211))_0x5622cb++;}}if(_0x4a7f00[_0x440c7f(0x1ff)]){const _0x5a2182=_0x354b0c(_0x4a7f00['children']);_0x5e8e2e+=_0x5a2182['folders'],_0xe3646e+=_0x5a2182['segments'],_0x5622cb+=_0x5a2182['journeys'];}}return{'folders':_0x5e8e2e,'segments':_0xe3646e,'journeys':_0x5622cb};},_0x587a33=_0x354b0c(_0x4d972e);console[_0x31c876(0x1fc)]('✔\x20Built\x20tree\x20with\x20'+_0x587a33['folders']+_0x31c876(0x217)+(_0x587a33[_0x31c876(0x227)]!==0x1?'s':'')+',\x20'+_0x587a33[_0x31c876(0x216)]+'\x20segment'+(_0x587a33[_0x31c876(0x216)]!==0x1?'s':'')+_0x31c876(0x20c)+_0x587a33[_0x31c876(0x218)]+'\x20journey'+(_0x587a33[_0x31c876(0x218)]!==0x1?'s':''));const _0x5f1f82=_0xe3ab52=>{const _0x1996c7=_0x31c876;return getConsoleNextUrl(_0x2d2b48[_0x1996c7(0x1e0)],_0x1996c7(0x1e3)+_0x51bc31[_0x1996c7(0x224)]+'/e/'+_0xe3ab52);},_0x490b46=_0x1aff58=>{const _0x2bebc6=_0x31c876;return getConsoleNextUrl(_0x2d2b48[_0x2bebc6(0x1e0)],_0x2bebc6(0x1e3)+_0x51bc31['parentId']+'/e/'+_0x1aff58+_0x2bebc6(0x1d9));};if(_0x2d2b48['format']===_0x31c876(0x21f)||_0x2d2b48[_0x31c876(0x21d)]===_0x31c876(0x21e))await handleSDKOutput(_0x4d972e,_0x2d2b48);else{console['log'](a59_0x28c3bd[_0x31c876(0x21b)]('['+_0x26ba37+']'));const _0x331843=formatTree(_0x4d972e,{'showMetadata':!![],'getSegmentUrl':_0x5f1f82,'getJourneyUrl':_0x490b46});console['log'](_0x331843);}return 0x0;}}