@treasuredata/tdx 2026.3.24 → 2026.3.25

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 (203) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/auth-login-command.js +1 -1
  11. package/dist/commands/chat-command.js +1 -1
  12. package/dist/commands/claude-command.js +1 -1
  13. package/dist/commands/claude-statusline-command.js +1 -1
  14. package/dist/commands/claude-usage-command.js +1 -1
  15. package/dist/commands/command.js +1 -1
  16. package/dist/commands/connection-command.js +1 -1
  17. package/dist/commands/databases.js +1 -1
  18. package/dist/commands/delivery-command.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-campaign-pull-command.js +1 -1
  21. package/dist/commands/engage-campaign-push-command.js +1 -1
  22. package/dist/commands/engage-campaign-validate-command.js +1 -1
  23. package/dist/commands/engage-command.js +1 -1
  24. package/dist/commands/engage-template-pull-command.js +1 -1
  25. package/dist/commands/engage-template-push-command.js +1 -1
  26. package/dist/commands/engage-template-validate-command.js +1 -1
  27. package/dist/commands/job-command.js +1 -1
  28. package/dist/commands/journey-command.js +1 -1
  29. package/dist/commands/journey-validate-command.js +1 -1
  30. package/dist/commands/llm-command.js +1 -1
  31. package/dist/commands/mcp-command.js +1 -1
  32. package/dist/commands/parent-segment-command.js +1 -1
  33. package/dist/commands/policy-command.js +1 -1
  34. package/dist/commands/profile-command.js +1 -1
  35. package/dist/commands/profiles-command.js +1 -1
  36. package/dist/commands/query-command.js +1 -1
  37. package/dist/commands/schedule-command.js +1 -1
  38. package/dist/commands/segment-command.js +1 -1
  39. package/dist/commands/segment-create-command.js +1 -1
  40. package/dist/commands/segment-fields-command.js +1 -1
  41. package/dist/commands/segment-pull-command.js +1 -1
  42. package/dist/commands/segment-push-command.js +1 -1
  43. package/dist/commands/segment-update-command.js +1 -1
  44. package/dist/commands/segment-use-command.js +1 -1
  45. package/dist/commands/segment-validate-command.js +1 -1
  46. package/dist/commands/segments.js +1 -1
  47. package/dist/commands/show.js +1 -1
  48. package/dist/commands/status-command.js +1 -1
  49. package/dist/commands/tables.js +1 -1
  50. package/dist/commands/unset-command.js +1 -1
  51. package/dist/commands/upgrade-command.js +1 -1
  52. package/dist/commands/use-command.js +1 -1
  53. package/dist/commands/user-command.js +1 -1
  54. package/dist/commands/workflow-command.js +1 -1
  55. package/dist/core/auth.js +1 -1
  56. package/dist/core/command-output.js +1 -1
  57. package/dist/core/config.js +1 -1
  58. package/dist/core/connection-cache.js +1 -1
  59. package/dist/core/constants.js +1 -1
  60. package/dist/core/credential-cache.js +1 -1
  61. package/dist/core/global-context.js +1 -1
  62. package/dist/core/keychain.js +1 -1
  63. package/dist/core/oauth-keychain.js +1 -1
  64. package/dist/core/oauth.js +1 -1
  65. package/dist/core/profile.js +1 -1
  66. package/dist/core/project-config.js +1 -1
  67. package/dist/core/session.js +1 -1
  68. package/dist/core/user-cache.js +1 -1
  69. package/dist/core/version.js +1 -1
  70. package/dist/index.js +1 -1
  71. package/dist/mcp/server.js +1 -1
  72. package/dist/mcp/tools/index.js +1 -1
  73. package/dist/mcp/tools/tdx-run.js +1 -1
  74. package/dist/mcp/tools/tdx-search.js +1 -1
  75. package/dist/mcp/utils.js +1 -1
  76. package/dist/proxy/claude-usage-tracker.js +1 -1
  77. package/dist/proxy/passthrough-server.js +1 -1
  78. package/dist/proxy/sse-usage-parser.js +1 -1
  79. package/dist/sdk/agent/agent-config.js +1 -1
  80. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  81. package/dist/sdk/agent/agent-yaml.js +1 -1
  82. package/dist/sdk/agent/test/evaluator.js +1 -1
  83. package/dist/sdk/agent/test/executor.js +1 -1
  84. package/dist/sdk/agent/test/index.js +1 -1
  85. package/dist/sdk/agent/test/output.js +1 -1
  86. package/dist/sdk/agent/test/parser.js +1 -1
  87. package/dist/sdk/agent/tool-target-registry.js +1 -1
  88. package/dist/sdk/api.js +1 -1
  89. package/dist/sdk/client/cdp-api-client.js +1 -1
  90. package/dist/sdk/client/delivery-api-client.js +1 -1
  91. package/dist/sdk/client/endpoints.js +1 -1
  92. package/dist/sdk/client/engage-api-client.js +1 -1
  93. package/dist/sdk/client/http-client.js +1 -1
  94. package/dist/sdk/client/llm-api-client.js +1 -1
  95. package/dist/sdk/client/oauth-refresh.js +1 -1
  96. package/dist/sdk/client/rate-limiter.js +1 -1
  97. package/dist/sdk/client/td-api-client.js +1 -1
  98. package/dist/sdk/client/trino-api-client.js +1 -1
  99. package/dist/sdk/client/workflow-client.js +1 -1
  100. package/dist/sdk/connection-validator.js +1 -1
  101. package/dist/sdk/connection.js +1 -1
  102. package/dist/sdk/delivery.js +1 -1
  103. package/dist/sdk/engage/campaign-pull.js +1 -1
  104. package/dist/sdk/engage/campaign-push.js +1 -1
  105. package/dist/sdk/engage/campaign-validator.js +1 -1
  106. package/dist/sdk/engage/campaign-yaml.js +1 -1
  107. package/dist/sdk/engage/template-pull.js +1 -1
  108. package/dist/sdk/engage/template-push.js +1 -1
  109. package/dist/sdk/engage/template-validator.js +1 -1
  110. package/dist/sdk/engage/template-yaml.js +1 -1
  111. package/dist/sdk/engage/types/campaign-def.js +1 -1
  112. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  113. package/dist/sdk/engage/types/template-schema.js +1 -1
  114. package/dist/sdk/engage.js +1 -1
  115. package/dist/sdk/errors.js +1 -1
  116. package/dist/sdk/index.js +1 -1
  117. package/dist/sdk/io/index.js +1 -1
  118. package/dist/sdk/io/node-filesystem.js +1 -1
  119. package/dist/sdk/job.js +1 -1
  120. package/dist/sdk/journey.js +1 -1
  121. package/dist/sdk/llm/chat-cache.js +1 -1
  122. package/dist/sdk/llm/index.js +1 -1
  123. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  124. package/dist/sdk/llm/model-factors.js +1 -1
  125. package/dist/sdk/personalization.js +1 -1
  126. package/dist/sdk/policy.js +1 -1
  127. package/dist/sdk/query/index.js +1 -1
  128. package/dist/sdk/query/sql-parser.js +1 -1
  129. package/dist/sdk/realtime.js +1 -1
  130. package/dist/sdk/schedule.js +1 -1
  131. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  132. package/dist/sdk/segment/fields-display.js +1 -1
  133. package/dist/sdk/segment/file-discovery.js +1 -1
  134. package/dist/sdk/segment/journey-utils.js +1 -1
  135. package/dist/sdk/segment/journey-validator.js +1 -1
  136. package/dist/sdk/segment/journey-yaml.js +1 -1
  137. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  138. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  139. package/dist/sdk/segment/pull-workflow.js +1 -1
  140. package/dist/sdk/segment/push-recovery.js +1 -1
  141. package/dist/sdk/segment/push-workflow.js +1 -1
  142. package/dist/sdk/segment/resolution-context.js +1 -1
  143. package/dist/sdk/segment/segment-path-parser.js +1 -1
  144. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  145. package/dist/sdk/segment/segment-validator.js +1 -1
  146. package/dist/sdk/segment/target-resolution.js +1 -1
  147. package/dist/sdk/segment/tdx-config.js +1 -1
  148. package/dist/sdk/segment/types/activation-schema.js +1 -1
  149. package/dist/sdk/segment/types/journey-def.js +1 -1
  150. package/dist/sdk/segment/types/journey-schema.js +1 -1
  151. package/dist/sdk/segment/types/segment-def.js +1 -1
  152. package/dist/sdk/segment/types/segment-schema.js +1 -1
  153. package/dist/sdk/segment/validate-files.js +1 -1
  154. package/dist/sdk/segment/yaml-validator.js +1 -1
  155. package/dist/sdk/segment.js +1 -1
  156. package/dist/sdk/types/index.js +1 -1
  157. package/dist/sdk/types/progress.js +1 -1
  158. package/dist/sdk/user.js +1 -1
  159. package/dist/sdk/util/format-detector.js +1 -1
  160. package/dist/sdk/util/formatters.js +1 -1
  161. package/dist/sdk/util/index.js +1 -1
  162. package/dist/sdk/util/paginate.js +1 -1
  163. package/dist/sdk/util/tree-formatter.js +1 -1
  164. package/dist/sdk/workflow/archive-validation.js +1 -1
  165. package/dist/sdk/workflow/clone-workflow.js +1 -1
  166. package/dist/sdk/workflow/index.js +1 -1
  167. package/dist/sdk/workflow/pull-workflow.js +1 -1
  168. package/dist/sdk/workflow/push-workflow.js +1 -1
  169. package/dist/sdk/workflow/tdx-config.js +1 -1
  170. package/dist/sdk/workflow/workflow-utils.js +1 -1
  171. package/dist/test-utils/command-runner.js +1 -1
  172. package/dist/test-utils/factories.js +1 -1
  173. package/dist/test-utils/fixtures.js +1 -1
  174. package/dist/test-utils/http-mock.js +1 -1
  175. package/dist/test-utils/index.js +1 -1
  176. package/dist/utils/async.js +1 -1
  177. package/dist/utils/colors.js +1 -1
  178. package/dist/utils/diff.js +1 -1
  179. package/dist/utils/file-permissions.js +1 -1
  180. package/dist/utils/file-reader.js +1 -1
  181. package/dist/utils/github-releases.js +1 -1
  182. package/dist/utils/global-cache.js +1 -1
  183. package/dist/utils/json-loader.js +1 -1
  184. package/dist/utils/local-cache.js +1 -1
  185. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  186. package/dist/utils/logger/formatters/index.js +1 -1
  187. package/dist/utils/logger/handlers/console-handler.js +1 -1
  188. package/dist/utils/logger/handlers/file-handler.js +1 -1
  189. package/dist/utils/logger/handlers/index.js +1 -1
  190. package/dist/utils/logger/handlers/null-handler.js +1 -1
  191. package/dist/utils/logger/index.js +1 -1
  192. package/dist/utils/logger/logger.js +1 -1
  193. package/dist/utils/logger/types.js +1 -1
  194. package/dist/utils/option-validation.js +1 -1
  195. package/dist/utils/process.js +1 -1
  196. package/dist/utils/prompt.js +1 -1
  197. package/dist/utils/spinner.js +1 -1
  198. package/dist/utils/sse-parser.js +1 -1
  199. package/dist/utils/string-utils.js +1 -1
  200. package/dist/utils/table-ref-parser.js +1 -1
  201. package/dist/utils/tdx-logger.js +1 -1
  202. package/dist/utils/version-check.js +1 -1
  203. package/package.json +1 -1
@@ -1 +1 @@
1
- const a141_0x2cafae=a141_0x372a;(function(_0x304033,_0x41a26b){const _0xaa6287=a141_0x372a,_0x3946a3=_0x304033();while(!![]){try{const _0x524b2f=-parseInt(_0xaa6287(0x1da))/0x1*(-parseInt(_0xaa6287(0x1e5))/0x2)+-parseInt(_0xaa6287(0x1d2))/0x3+parseInt(_0xaa6287(0x1dd))/0x4*(-parseInt(_0xaa6287(0x1d0))/0x5)+-parseInt(_0xaa6287(0x1dc))/0x6*(-parseInt(_0xaa6287(0x1d6))/0x7)+parseInt(_0xaa6287(0x1e3))/0x8+parseInt(_0xaa6287(0x1db))/0x9+parseInt(_0xaa6287(0x1cb))/0xa;if(_0x524b2f===_0x41a26b)break;else _0x3946a3['push'](_0x3946a3['shift']());}catch(_0x305729){_0x3946a3['push'](_0x3946a3['shift']());}}}(a141_0x124b,0xc8e6a));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';import a141_0x12b1d8 from'path';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a141_0x2cafae(0x1d1));export function getPushRecoveryPath(_0x1d3066){const _0x34c623=a141_0x2cafae,_0x38b6af=a141_0x12b1d8[_0x34c623(0x1df)](_0x1d3066),_0x1cf306=a141_0x12b1d8[_0x34c623(0x1d7)](_0x1d3066);return a141_0x12b1d8[_0x34c623(0x1e4)](_0x38b6af,'.'+_0x1cf306+_0x34c623(0x1d3));}export function readPushRecovery(_0x31f2e4){const _0x545a3a=a141_0x2cafae,_0x4849b8=getPushRecoveryPath(_0x31f2e4);if(!existsSync(_0x4849b8))return undefined;try{const _0x338a2f=readFileSync(_0x4849b8,_0x545a3a(0x1d8)),_0x54feb7=JSON[_0x545a3a(0x1e2)](_0x338a2f);if(_0x54feb7?.[_0x545a3a(0x1d4)]!==0x1||typeof _0x54feb7[_0x545a3a(0x1d9)]!=='string')return undefined;return _0x54feb7;}catch(_0xaa68d8){return _0xaa68d8 instanceof SyntaxError?logger[_0x545a3a(0x1cf)](_0x545a3a(0x1de)+_0xaa68d8):logger[_0x545a3a(0x1d5)](_0x545a3a(0x1cd)+_0xaa68d8),undefined;}}function a141_0x372a(_0x5d8463,_0xf9aab6){_0x5d8463=_0x5d8463-0x1c9;const _0x124b20=a141_0x124b();let _0x372a08=_0x124b20[_0x5d8463];return _0x372a08;}export function writePushRecovery(_0x1af673,_0x38ddeb){const _0x13dfc7=a141_0x2cafae,_0x319832=getPushRecoveryPath(_0x1af673),_0x4d8393=_0x319832+_0x13dfc7(0x1e0);writeFileSync(_0x4d8393,JSON[_0x13dfc7(0x1ca)](_0x38ddeb,null,0x2)+'\x0a',_0x13dfc7(0x1d8)),renameSync(_0x4d8393,_0x319832);}export function deletePushRecovery(_0x14f963){const _0x225abf=a141_0x2cafae,_0x4a1ee5=getPushRecoveryPath(_0x14f963);try{unlinkSync(_0x4a1ee5);}catch(_0x511eb5){_0x511eb5[_0x225abf(0x1e1)]!==_0x225abf(0x1c9)&&logger[_0x225abf(0x1cf)](_0x225abf(0x1cc)+_0x511eb5);}}function a141_0x124b(){const _0x2098d0=['10138992tKvYXl','join','220750fvNlwQ','ENOENT','stringify','736280VmHOtB','Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20','Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','toISOString','debug','3786655piZoae','tdx.sdk.push-recovery','2903412QFwnly','.push-recovery.json','version','warn','203rReZEZ','basename','utf-8','journeyName','9SjDwOC','5161023DhRNzP','82248JcFsiQ','8gRuMCl','Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20','dirname','.tmp','code','parse'];a141_0x124b=function(){return _0x2098d0;};return a141_0x124b();}export function saveSegmentToPushRecovery(_0xae16e8,_0x1670aa,_0x23ffb3,_0x436733){const _0x44f00a=a141_0x2cafae,_0x2c859e=readPushRecovery(_0xae16e8),_0x5cc49a=_0x2c859e?.[_0x44f00a(0x1d9)]===_0x1670aa?{..._0x2c859e,'updatedAt':new Date()[_0x44f00a(0x1ce)]()}:{'version':0x1,'journeyName':_0x1670aa,'updatedAt':new Date()[_0x44f00a(0x1ce)](),'segments':{}};_0x5cc49a['segments'][_0x23ffb3]=_0x436733,writePushRecovery(_0xae16e8,_0x5cc49a);}
1
+ const a141_0x564c60=a141_0x164a;(function(_0x590ddd,_0x370c00){const _0x2f6d1c=a141_0x164a,_0x2ea20d=_0x590ddd();while(!![]){try{const _0xe835aa=-parseInt(_0x2f6d1c(0x145))/0x1*(parseInt(_0x2f6d1c(0x14a))/0x2)+parseInt(_0x2f6d1c(0x143))/0x3*(parseInt(_0x2f6d1c(0x150))/0x4)+-parseInt(_0x2f6d1c(0x140))/0x5+parseInt(_0x2f6d1c(0x14b))/0x6*(parseInt(_0x2f6d1c(0x14c))/0x7)+parseInt(_0x2f6d1c(0x139))/0x8+-parseInt(_0x2f6d1c(0x14d))/0x9+parseInt(_0x2f6d1c(0x13d))/0xa;if(_0xe835aa===_0x370c00)break;else _0x2ea20d['push'](_0x2ea20d['shift']());}catch(_0x5e26e6){_0x2ea20d['push'](_0x2ea20d['shift']());}}}(a141_0x50ad,0x3c540));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';import a141_0x51b228 from'path';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a141_0x564c60(0x148));export function getPushRecoveryPath(_0x1651dd){const _0x196740=a141_0x564c60,_0x32b462=a141_0x51b228[_0x196740(0x13f)](_0x1651dd),_0xa30768=a141_0x51b228[_0x196740(0x13e)](_0x1651dd);return a141_0x51b228[_0x196740(0x152)](_0x32b462,'.'+_0xa30768+'.push-recovery.json');}function a141_0x164a(_0x42be80,_0x2f591f){_0x42be80=_0x42be80-0x138;const _0x50ad43=a141_0x50ad();let _0x164a66=_0x50ad43[_0x42be80];return _0x164a66;}function a141_0x50ad(){const _0x560179=['tdx.sdk.push-recovery','utf-8','6gwFbrs','1782474mllUWa','7DDivac','1077300fzsjng','version','Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','1772nzLbIy','debug','join','stringify','1370584nLRpPd','segments','Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20','toISOString','3742350YNNkzB','basename','dirname','1080385iQdAlm','ENOENT','Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20','723cMsHeb','parse','122173YVVuCu','string','.tmp'];a141_0x50ad=function(){return _0x560179;};return a141_0x50ad();}export function readPushRecovery(_0x15d22b){const _0x98cef3=a141_0x564c60,_0x59163d=getPushRecoveryPath(_0x15d22b);if(!existsSync(_0x59163d))return undefined;try{const _0x2f4dba=readFileSync(_0x59163d,'utf-8'),_0x18ea72=JSON[_0x98cef3(0x144)](_0x2f4dba);if(_0x18ea72?.[_0x98cef3(0x14e)]!==0x1||typeof _0x18ea72['journeyName']!==_0x98cef3(0x146))return undefined;return _0x18ea72;}catch(_0x55e570){return _0x55e570 instanceof SyntaxError?logger[_0x98cef3(0x151)](_0x98cef3(0x142)+_0x55e570):logger['warn'](_0x98cef3(0x14f)+_0x55e570),undefined;}}export function writePushRecovery(_0x5da4cb,_0x4d4992){const _0x340b70=a141_0x564c60,_0x3d1cf8=getPushRecoveryPath(_0x5da4cb),_0x179371=_0x3d1cf8+_0x340b70(0x147);writeFileSync(_0x179371,JSON[_0x340b70(0x138)](_0x4d4992,null,0x2)+'\x0a',_0x340b70(0x149)),renameSync(_0x179371,_0x3d1cf8);}export function deletePushRecovery(_0x57cf34){const _0x3d5ac4=a141_0x564c60,_0x108e03=getPushRecoveryPath(_0x57cf34);try{unlinkSync(_0x108e03);}catch(_0x354d7c){_0x354d7c['code']!==_0x3d5ac4(0x141)&&logger[_0x3d5ac4(0x151)](_0x3d5ac4(0x13b)+_0x354d7c);}}export function saveSegmentToPushRecovery(_0x329b47,_0x50ccef,_0xa99a09,_0x28b56f){const _0x32fd53=a141_0x564c60,_0x2fa5f9=readPushRecovery(_0x329b47),_0x10fede=_0x2fa5f9?.['journeyName']===_0x50ccef?{..._0x2fa5f9,'updatedAt':new Date()[_0x32fd53(0x13c)]()}:{'version':0x1,'journeyName':_0x50ccef,'updatedAt':new Date()['toISOString'](),'segments':{}};_0x10fede[_0x32fd53(0x13a)][_0xa99a09]=_0x28b56f,writePushRecovery(_0x329b47,_0x10fede);}
@@ -1 +1 @@
1
- const a142_0x3ef9cf=a142_0x3bff;(function(_0x554a80,_0x3216c9){const _0x544678=a142_0x3bff,_0x2c8489=_0x554a80();while(!![]){try{const _0x55a6ae=parseInt(_0x544678(0x21d))/0x1*(-parseInt(_0x544678(0x277))/0x2)+-parseInt(_0x544678(0x1cf))/0x3+-parseInt(_0x544678(0x1e0))/0x4+-parseInt(_0x544678(0x1de))/0x5*(-parseInt(_0x544678(0x22c))/0x6)+-parseInt(_0x544678(0x1eb))/0x7*(-parseInt(_0x544678(0x233))/0x8)+parseInt(_0x544678(0x232))/0x9+parseInt(_0x544678(0x1d3))/0xa;if(_0x55a6ae===_0x3216c9)break;else _0x2c8489['push'](_0x2c8489['shift']());}catch(_0x350141){_0x2c8489['push'](_0x2c8489['shift']());}}}(a142_0x570e,0x4c840));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a142_0x3ef9cf(0x2a0));export const PENDING_SEGMENT_PREFIX=a142_0x3ef9cf(0x296);export const PENDING_ACTIVATION_PREFIX=a142_0x3ef9cf(0x22b);export function createPendingSegmentId(_0x358f42){return''+PENDING_SEGMENT_PREFIX+_0x358f42+'__';}export function isPendingSegmentId(_0x4f67f6){const _0x3d3c34=a142_0x3ef9cf;return _0x4f67f6[_0x3d3c34(0x207)](PENDING_SEGMENT_PREFIX)&&!_0x4f67f6[_0x3d3c34(0x207)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x23a6b5){const _0x444785=a142_0x3ef9cf;return _0x23a6b5[_0x444785(0x275)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x17378f){return''+PENDING_ACTIVATION_PREFIX+_0x17378f+'__';}export function isPendingActivationId(_0x1e2954){return _0x1e2954['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x5839d0){const _0xb743bb=a142_0x3ef9cf;return _0x5839d0[_0xb743bb(0x275)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x3dd469,_0x16e630){const _0xdc2d0a=a142_0x3ef9cf,_0x3ff77b=_0x3dd469+'::'+(_0x16e630[_0xdc2d0a(0x266)]()||_0xdc2d0a(0x1c7)),_0x2ca757=createHash('sha1')[_0xdc2d0a(0x26c)](_0x3ff77b)[_0xdc2d0a(0x28c)](_0xdc2d0a(0x1e4))[_0xdc2d0a(0x212)](0x0,0xc);return'journey_entry_criteria_'+_0x2ca757;}export function ensureJourneyDefaults(_0x23af51){const _0x119e00=a142_0x3ef9cf;!_0x23af51[_0x119e00(0x23e)]&&(_0x23af51[_0x119e00(0x23e)]=''),!_0x23af51[_0x119e00(0x1ca)]&&(_0x23af51[_0x119e00(0x1ca)]=_0x119e00(0x287));}export function injectExistingStageIds(_0x4c00ff,_0x44ee94){const _0xced3b7=a142_0x3ef9cf,_0x18e7bc=new Map(_0x44ee94[_0xced3b7(0x209)](_0xf6a41c=>[_0xf6a41c['name'],_0xf6a41c['id']]));for(const _0x446f92 of _0x4c00ff){if(!_0x446f92['id']){const _0x5612d1=_0x18e7bc['get'](_0x446f92[_0xced3b7(0x26e)]);_0x5612d1&&(_0x446f92['id']=_0x5612d1);}}}export function resolveTDFolderPath(_0x2ae020,_0x3612c2,_0x3fa3b6){const _0x4a1b80=a142_0x3ef9cf;if(!_0x3612c2)return _0x2ae020;if(_0x2ae020===_0x3fa3b6||_0x2ae020[_0x4a1b80(0x207)](_0x3fa3b6+'/'))return _0x2ae020;return _0x2ae020?_0x3fa3b6+'/'+_0x2ae020:_0x3fa3b6;}export function addFoldersToCreate(_0x5cea0b,_0x33fe4c,_0xb99772){const _0x124ba3=a142_0x3ef9cf;if(!_0x5cea0b)return;if(_0x33fe4c[_0x124ba3(0x1d5)](_0x5cea0b))return;const _0x4160d3=_0x5cea0b['split']('/');let _0x5f198d='';for(const _0x3b6b7e of _0x4160d3){_0x5f198d=_0x5f198d?_0x5f198d+'/'+_0x3b6b7e:_0x3b6b7e,!_0x33fe4c[_0x124ba3(0x1d5)](_0x5f198d)&&_0xb99772['add'](_0x5f198d);}}export function sortFoldersByDepth(_0x24fb24){return[..._0x24fb24]['sort']((_0x19388f,_0x17c0da)=>{const _0x265a48=a142_0x3bff,_0x21b1f4=(_0x19388f[_0x265a48(0x1ac)](/\//g)||[])['length'],_0x1b2d2e=(_0x17c0da[_0x265a48(0x1ac)](/\//g)||[])[_0x265a48(0x1f4)];return _0x21b1f4-_0x1b2d2e;});}import*as a142_0x4a29a2 from'yaml';import{readFileSync}from'fs';import a142_0x3c5b6d from'path';import{isJourneyDef,parseYamlString as a142_0x4a5f14,toYamlString as a142_0x2c1878,normalizeJourneyDef,hasMultipleVersions,journeyResponseToDef,collectSegmentIdsFromJourneyApi}from'./journey-yaml.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,createJumpTargetCache,resolveJumpTarget,buildMergedJourneyDef,buildLocalRuleToNameMappingFromJourney,collectSegmentUsageCounts}from'./journey-utils.js';import{activationResponseToDef,segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,apiRuleToYaml,yamlRuleToApi,serializeExpandedRule,collectSegmentRefsFromRule,resolveRuleSegmentRefs,resolveRuleSegmentIds,journeyActivationStepToYaml}from'./child-segment-yaml.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{batchAsync}from'../../utils/async.js';import{buildFolderMaps}from'./resolution-context.js';import{SDKError,ErrorCode,isHttp400Error,getErrorMessage}from'../errors.js';import{readPushRecovery,saveSegmentToPushRecovery,deletePushRecovery}from'./push-recovery.js';import{validateSegmentDef,formatValidationResult}from'./yaml-validator.js';import{validateJourneyDef}from'./journey-validator.js';function stableStringify(_0x371f39){const _0x37d65a=a142_0x3ef9cf;if(Array[_0x37d65a(0x272)](_0x371f39))return'['+_0x371f39[_0x37d65a(0x209)](_0x49f73d=>stableStringify(_0x49f73d))['join'](',')+']';if(_0x371f39&&typeof _0x371f39===_0x37d65a(0x248)){const _0x1feaee=_0x371f39,_0xd6dc49=Object[_0x37d65a(0x294)](_0x1feaee)[_0x37d65a(0x1d0)](),_0x557ae4=_0xd6dc49[_0x37d65a(0x209)](_0x2a7a60=>'\x22'+_0x2a7a60+'\x22:'+stableStringify(_0x1feaee[_0x2a7a60]));return'{'+_0x557ae4['join'](',')+'}';}const _0x567307=JSON[_0x37d65a(0x216)](_0x371f39);return _0x567307===undefined?'null':_0x567307;}function activationSignature(_0x5e9895){const _0x192a49=a142_0x3ef9cf,_0x342d17={'connection':_0x5e9895[_0x192a49(0x1f2)],..._0x5e9895['all_columns']!==undefined&&{'all_columns':_0x5e9895[_0x192a49(0x205)]},..._0x5e9895['columns']!==undefined&&{'columns':_0x5e9895[_0x192a49(0x21e)]},..._0x5e9895['behavior']!==undefined&&{'behavior':_0x5e9895[_0x192a49(0x1d6)]},..._0x5e9895[_0x192a49(0x242)]!==undefined&&{'schedule':_0x5e9895['schedule']},..._0x5e9895['notification']!==undefined&&{'notification':_0x5e9895[_0x192a49(0x1ab)]},..._0x5e9895[_0x192a49(0x280)]!==undefined&&{'connector_config':_0x5e9895[_0x192a49(0x280)]},..._0x5e9895[_0x192a49(0x1f7)]!==undefined&&{'activation_template_id':_0x5e9895[_0x192a49(0x1f7)]}};return stableStringify(_0x342d17);}async function fetchSegment(_0x5f02d9,_0x281f56,_0x59149d,_0x4add08){const _0x43cb94=a142_0x3ef9cf,_0x294b99=_0x4add08?.[_0x43cb94(0x1d9)](_0x31a52f=>_0x31a52f['id']===_0x59149d);if(_0x294b99)return _0x294b99;try{return await _0x5f02d9[_0x43cb94(0x1c7)]['getSegment'](_0x281f56,_0x59149d);}catch(_0xd8d4ea){logger[_0x43cb94(0x270)]('getSegment\x20failed\x20for\x20'+_0x59149d+_0x43cb94(0x241)+_0xd8d4ea);try{return await _0x5f02d9[_0x43cb94(0x1c7)][_0x43cb94(0x224)](_0x59149d);}catch(_0x1261ae){return logger[_0x43cb94(0x270)]('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x59149d+':\x20'+_0x1261ae),null;}}}function recoverSegmentIdsFromPushRecovery(_0x399c6d,_0x39e025,_0xc1ef12){const _0x2bb764=a142_0x3ef9cf,_0x4aa918=readPushRecovery(_0x399c6d[_0x2bb764(0x27a)]);if(_0x4aa918?.[_0x2bb764(0x1b3)]===_0x399c6d[_0x2bb764(0x24a)][_0x2bb764(0x26e)])for(const [_0x14e49f,_0x3762ad]of Object['entries'](_0x4aa918[_0x2bb764(0x25b)])){const _0x2f63d0=generateDeterministicJourneySegmentName(_0x399c6d[_0x2bb764(0x24a)]['name'],_0x14e49f);_0x3762ad[_0x2bb764(0x1ec)]===_0x2f63d0&&(_0x39e025[_0x2bb764(0x21b)](_0x14e49f,_0x3762ad[_0x2bb764(0x221)]),_0xc1ef12[_0x2bb764(0x21b)](_0x14e49f,_0x3762ad[_0x2bb764(0x221)]));}}async function createOrRecoverEmbeddedSegment(_0x29a66a,_0x20ac3d,_0x8efa6,_0x236fbc){const _0x45040a=a142_0x3ef9cf;let _0x5019c5;try{_0x5019c5=await _0x29a66a[_0x45040a(0x1c7)][_0x45040a(0x293)]({'name':_0x8efa6['uniqueSegmentName'],'description':_0x8efa6[_0x45040a(0x23e)],'journeyId':_0x8efa6[_0x45040a(0x215)],'rule':_0x236fbc(_0x8efa6[_0x45040a(0x1e6)],!![]),'countPopulation':!![],'parentFolderId':_0x8efa6[_0x45040a(0x25e)],'audienceId':_0x8efa6[_0x45040a(0x23b)]});}catch(_0x46e390){const _0x29a3ee=_0x46e390 instanceof Error&&_0x46e390[_0x45040a(0x1da)][_0x45040a(0x1e2)](_0x45040a(0x1ea));if(_0x29a3ee){const _0x2a6c2d=readPushRecovery(_0x20ac3d['absolutePath']),_0x40620b=_0x2a6c2d?.[_0x45040a(0x1b3)]===_0x20ac3d[_0x45040a(0x24a)][_0x45040a(0x26e)]?_0x2a6c2d[_0x45040a(0x25b)][_0x8efa6[_0x45040a(0x267)]]:undefined;if(_0x40620b?.[_0x45040a(0x1ec)]===_0x8efa6['uniqueSegmentName'])await _0x29a66a['segment']['updateSegmentById'](_0x8efa6[_0x45040a(0x23b)],_0x40620b[_0x45040a(0x221)],{'description':_0x8efa6[_0x45040a(0x23e)],'rule':_0x236fbc(_0x8efa6[_0x45040a(0x1e6)],!![]),'countPopulation':!![]}),_0x5019c5=_0x40620b[_0x45040a(0x221)];else throw new SDKError(ErrorCode[_0x45040a(0x299)],_0x45040a(0x29c)+_0x8efa6['localName']+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+(_0x45040a(0x1d1)+_0x20ac3d[_0x45040a(0x27a)][_0x45040a(0x275)](/([^/]+)$/,_0x45040a(0x25a))+')\x20')+_0x45040a(0x253),_0x46e390);}else throw _0x46e390;}return saveSegmentToPushRecovery(_0x20ac3d[_0x45040a(0x27a)],_0x20ac3d[_0x45040a(0x24a)][_0x45040a(0x26e)],_0x8efa6[_0x45040a(0x267)],{'segmentId':_0x5019c5,'uniqueServerName':_0x8efa6[_0x45040a(0x24c)],'createdAt':new Date()['toISOString']()}),_0x5019c5;}export async function prepareSegmentFiles(_0x40cf55,_0x15a4e8,_0x1e2548,_0x575919,_0x50d19f){const _0x31b50b=a142_0x3ef9cf,{activationDefToCreateRequest:_0x124188}=await import(_0x31b50b(0x201)),_0x5b4b14=[],_0x2b7fe9=new Set();for(const {yamlConfig:_0x4938c4,folderPath:_0x333b85,sourcePath:_0x178f2f}of _0x40cf55){const _0x9d79e3=resolveTDFolderPath(_0x333b85,_0x575919,_0x50d19f),_0x31571f=_0x9d79e3+':'+_0x4938c4[_0x31b50b(0x26e)],_0x671ca3=_0x15a4e8['segmentByFolderAndName']['get'](_0x31571f),_0x2f516c=_0x671ca3?_0x15a4e8[_0x31b50b(0x238)]['get'](_0x671ca3['id'])||[]:[];addFoldersToCreate(_0x9d79e3,_0x15a4e8[_0x31b50b(0x27f)],_0x2b7fe9);const _0x49fe0f=calculateActivationActions(_0x4938c4['activations']||[],_0x2f516c,_0x15a4e8[_0x31b50b(0x298)],_0x15a4e8['connectionIdToNameMap']);for(const _0x18d803 of _0x49fe0f){(_0x18d803[_0x31b50b(0x21a)]==='create'||_0x18d803['type']===_0x31b50b(0x26c))&&_0x18d803[_0x31b50b(0x24d)]&&(_0x18d803[_0x31b50b(0x22f)]=await _0x124188(_0x18d803['yamlActivation'],_0x1e2548));}const _0x29191c=calculateSegmentDiff(_0x4938c4,_0x671ca3,_0x2f516c,_0x15a4e8['idToEmailMap'],_0x15a4e8['connectionIdToNameMap']);_0x5b4b14[_0x31b50b(0x1a4)]({'relativePath':_0x4938c4[_0x31b50b(0x26e)],'absolutePath':_0x178f2f,'yamlConfig':_0x4938c4,'folderPath':_0x9d79e3,'existingSegment':_0x671ca3,'existingActivations':_0x2f516c,'isNew':_0x29191c[_0x31b50b(0x279)],'hasChanges':_0x29191c[_0x31b50b(0x1e3)],'diff':_0x29191c['diff'],'activationActions':_0x49fe0f});}return{'segmentFiles':_0x5b4b14,'foldersToCreate':_0x2b7fe9};}export async function prepareJourneyFiles(_0x3ef1b1,_0x41d667,_0x5266c3,_0x508b38){const _0x50358b=a142_0x3ef9cf,_0x36bd0c=[],_0x3574f0=new Set();for(const {yamlConfig:_0x5e05d6,folderPath:_0x21209e,sourcePath:_0x241ff7}of _0x3ef1b1){const _0x21356=resolveTDFolderPath(_0x21209e,_0x5266c3,_0x508b38),_0x3c6268=_0x21356+':'+_0x5e05d6[_0x50358b(0x26e)],_0x3c8b8c=_0x41d667[_0x50358b(0x1b7)]['get'](_0x3c6268);let _0x1aff22,_0x206d6c;if(_0x3c8b8c&&_0x3c8b8c[_0x50358b(0x1f4)]>0x0){const _0x4a1d8d=buildLocalExpandedRuleMappings(_0x5e05d6),{createYamlContext:_0x508a22,prefetchJourneySegments:_0x4cfc70}=createPushYamlContextForBundle(_0x41d667[_0x50358b(0x240)],_0x41d667[_0x50358b(0x23b)],_0x41d667[_0x50358b(0x222)],_0x4a1d8d,_0x41d667[_0x50358b(0x298)],_0x41d667['connectionIdToNameMap'],_0x41d667['activationStepsById'],_0x41d667[_0x50358b(0x1ed)]);await _0x4cfc70(_0x3c8b8c[_0x50358b(0x209)](_0x3c2555=>_0x3c2555['id']));const _0x3c34b8=await _0x41d667[_0x50358b(0x240)]['journey'][_0x50358b(0x265)](_0x3c8b8c[0x0][_0x50358b(0x23c)]),_0x48fac3=hasMultipleVersions(_0x5e05d6),_0x123aa0=async _0x3007eb=>{const _0x3ae20c=_0x50358b,_0x18a564=_0x41d667['journeyById']?.['get'](_0x3007eb);if(_0x18a564)return _0x18a564;return _0x41d667[_0x3ae20c(0x26d)]({'journeyId':_0x3007eb,'journeyName':_0x5e05d6[_0x3ae20c(0x26e)],'isMultiVersion':_0x3c8b8c['length']>0x1});};if(_0x48fac3&&_0x3c8b8c['length']>0x1){const _0x39a913=[];for(const _0x57c1d2 of _0x3c8b8c){const _0x39e3c2=_0x57c1d2[_0x50358b(0x210)]||0x1;_0x41d667['progress']?.[_0x50358b(0x26c)](_0x50358b(0x202)+_0x5e05d6[_0x50358b(0x26e)]+'\x20v'+_0x39e3c2);const _0x2e0246=await _0x123aa0(_0x57c1d2['id']),_0x26dbc6=_0x508a22(_0x57c1d2['id']),_0x17a79b=await journeyResponseToDef(_0x2e0246,_0x26dbc6);_0x39a913[_0x50358b(0x1a4)]({'item':_0x57c1d2,'yaml':_0x17a79b});}const _0x17be42=buildLocalRuleToNameMappingFromJourney(_0x5e05d6);_0x206d6c=buildMergedJourneyDef(_0x39a913,_0x17be42,_0x3c34b8);const _0xdacdfa=Math[_0x50358b(0x285)](..._0x39a913[_0x50358b(0x209)](_0x8c33fe=>_0x8c33fe[_0x50358b(0x251)][_0x50358b(0x210)]||0x0)),_0x39eb01=_0x3c8b8c[_0x50358b(0x1d9)](_0x1ef212=>(_0x1ef212['versionNumber']||0x0)===_0xdacdfa);_0x39eb01&&(_0x41d667[_0x50358b(0x1e1)]?.[_0x50358b(0x26c)]('Fetching\x20'+_0x5e05d6['name']+'\x20v'+_0xdacdfa),_0x1aff22=await _0x123aa0(_0x39eb01['id']));}else{const _0x4273fc=_0x3c8b8c[_0x3c8b8c[_0x50358b(0x1f4)]-0x1];_0x41d667['progress']?.['update'](_0x50358b(0x202)+_0x5e05d6[_0x50358b(0x26e)]),_0x1aff22=await _0x123aa0(_0x4273fc['id']);const _0x7ad1e9=_0x508a22(_0x4273fc['id']),_0x5ae31a=await journeyResponseToDef(_0x1aff22,_0x7ad1e9),_0x40c906=buildLocalRuleToNameMappingFromJourney(_0x5e05d6);_0x206d6c=buildMergedJourneyDef([{'item':_0x4273fc,'yaml':_0x5ae31a}],_0x40c906,_0x3c34b8);}}addFoldersToCreate(_0x21356,_0x41d667[_0x50358b(0x27f)],_0x3574f0);const _0x3f8a02=calculateJourneyDiff(_0x5e05d6,_0x206d6c);_0x36bd0c[_0x50358b(0x1a4)]({'relativePath':_0x5e05d6[_0x50358b(0x26e)],'absolutePath':_0x241ff7,'yamlConfig':_0x5e05d6,'folderPath':_0x21356,'existingJourney':_0x1aff22,'isNew':_0x3f8a02[_0x50358b(0x279)],'hasChanges':_0x3f8a02[_0x50358b(0x1e3)],'diff':_0x3f8a02[_0x50358b(0x1d2)]});}return{'journeyFiles':_0x36bd0c,'foldersToCreate':_0x3574f0};}export function calculateActivationActions(_0x47b983,_0x41372e,_0x31ea45,_0x12efa7){const _0x1edf35=a142_0x3ef9cf,_0x593d76=[],_0x223aa3=new Map();for(const _0xb9bb6e of _0x41372e){_0x223aa3[_0x1edf35(0x21b)](_0xb9bb6e[_0x1edf35(0x26e)],_0xb9bb6e);}const _0x9259f=new Map();for(const _0x1fbbaa of _0x47b983){_0x9259f['set'](_0x1fbbaa[_0x1edf35(0x26e)],_0x1fbbaa);}for(const _0x56855c of _0x47b983){const _0x1637b0=_0x223aa3['get'](_0x56855c[_0x1edf35(0x26e)]);if(!_0x1637b0)_0x593d76[_0x1edf35(0x1a4)]({'type':'create','name':_0x56855c[_0x1edf35(0x26e)],'yamlActivation':_0x56855c});else{const _0x27c091=activationResponseToDef(_0x1637b0,_0x31ea45,_0x12efa7),_0x2163bc=a142_0x4a29a2[_0x1edf35(0x216)](_0x27c091),_0xa2751=a142_0x4a29a2[_0x1edf35(0x216)](_0x56855c);_0x2163bc!==_0xa2751&&_0x593d76[_0x1edf35(0x1a4)]({'type':_0x1edf35(0x26c),'name':_0x56855c[_0x1edf35(0x26e)],'yamlActivation':_0x56855c,'existingActivation':_0x1637b0});}}for(const _0x166d73 of _0x41372e){!_0x9259f[_0x1edf35(0x1d5)](_0x166d73[_0x1edf35(0x26e)])&&_0x593d76[_0x1edf35(0x1a4)]({'type':_0x1edf35(0x1f9),'name':_0x166d73['name'],'existingActivation':_0x166d73});}return _0x593d76;}function calculateYamlDiff(_0x1a0237,_0x110a8e){if(_0x110a8e){const _0x5872f6=generateDiff(_0x110a8e,_0x1a0237),_0x2cf5cd=hasChanges(_0x5872f6);return{'isNew':![],'hasChanges':_0x2cf5cd,'diff':_0x2cf5cd?formatDiffWithColors(_0x5872f6):undefined};}const _0x220fa5=generateDiff('',_0x1a0237);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x220fa5)};}export function calculateSegmentDiff(_0x396c56,_0x36c1d0,_0x531544,_0xa64b62,_0x575cf7){const _0x3e11d1=segmentToYamlString(_0x396c56),_0x4f57d8=_0x36c1d0?segmentToYamlString(segmentWithActivationsToYaml(_0x36c1d0,_0x531544,undefined,_0xa64b62,_0x575cf7)):undefined;return calculateYamlDiff(_0x3e11d1,_0x4f57d8);}export function calculateJourneyDiff(_0x2614f1,_0x5cf900){const _0x389595=normalizeJourneyDef(_0x2614f1,_0x2614f1),_0x4cee39=a142_0x2c1878(_0x389595),_0x35ef69=_0x5cf900?a142_0x2c1878(normalizeJourneyDef(_0x5cf900,_0x2614f1)):undefined;return calculateYamlDiff(_0x4cee39,_0x35ef69);}function a142_0x570e(){const _0x27af4e=['debug','join','isArray','segment_updated','deleteSegment','replace','WaitStep','12jXipVF','dirname','isNew','absolutePath','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','results','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','\x20error(s)','folderPathToId','connector_config','journey_created','conditions','folder_created','folder','max','list','draft','parentSegmentFolder','activation_deleted','\x20activation\x20\x27','create','digest','activationContext','entry_criteria','listActivations','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','Creating\x20folder\x20\x27','journey','createJourneySegment','keys','Creating\x20segment\x20\x27','__pending_','run_after_journey_refresh','idToEmailMap','SEGMENT_UPDATE_ERROR','conditionSegmentId','createActivation','Embedded\x20segment\x20\x27','activation_','filter','createdSegmentId','tdx.sdk.push-workflow','activation_creating','rule','rootFolderId','activations','):\x20','journeys','waitStepUnit','push','\x20(referenced\x20in\x20journey\x20','steps','deleteActivation','journey_updating','\x27...','connectionIdToNameMap','notification','match','exitCriterias','embedded_activation_creating','Updating\x20segment\x20\x27','Updating\x20activation\x20\x27','JOURNEY_UPDATE_ERROR','reduce','journeyName','activationActions','updated','activation_updating','journeyBundlesByFolderAndName','journeyBundleName','existingSegment','folderPath','parseDocument','activation_created','toString','embedded_activation_created','journeyActivationNameToId','Created\x20journey\x20\x27','getActivation','conditionTimeoutUnit','journey_updated','Activation\x20not\x20found:\x20','unchanged','with','segment','Stage\x20\x27','logDeleted','state','createSegment','existingActivation','activation_deleting','split','297660BTEkDB','sort','Delete\x20the\x20push\x20recovery\x20file\x20(','diff','6427540burXJe','segmentFolderId','has','behavior','values','buildUserMaps','find','message','valid','parse','Updated\x20segment\x20\x27','2005645bFjLBR','relative','1854340ZnUHWD','progress','includes','hasChanges','hex','embedded_segment_created','resolvedRule','created','getJourney','Activation','Name\x20has\x20already\x20been\x20taken','15393HeUaDj','uniqueServerName','journeyById','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','\x27\x20not\x20found\x20in\x20journey\x20\x27','createFolder','existingJourney','connection','logSuccess','length','Entry\x20criteria:\x20','relationships','activation_template_id','Failed\x20to\x20resolve\x20activation\x20','delete','Deleted\x20activation\x20\x27','index','segmentNameToId','stages','attributes','\x20journey\x20from\x20file:\x20','updateSegmentById','./child-segment-yaml.js','Fetching\x20','SEGMENT_NOT_FOUND','Created\x20activation\x20\x27','all_columns','\x27\x20for\x20','startsWith','day','map','Updated\x20journey\x20\x27','Segment\x20not\x20found:\x20','stage\x20\x27','journeyActivationStepId','entryCriteria','all','versionNumber','conditionTimeoutDuration','slice','toISOString','ACTIVATION_UPDATE_ERROR','journeyId','stringify','errors','add','Deleted\x20segment\x20\x27','type','set','\x27\x20decision\x20point\x20branch\x20\x27','104018rRkkOi','columns','journeyStages','SEGMENT_SYNTAX_ERROR','segmentId','existingSegments','./journey-yaml.js','getSegmentEntity','\x0a\x20\x20','utf-8','size','onProgress','resolveSegment','deleted','__pending_act_','6fISXEG','../../utils/async.js','waitStep','validatedRequest','Failed\x20to\x20','nameToType','3177765rfyDtB','376ELBQgR','verbose','withProgress','milestone','Created\x20segment\x20\x27','activationsBySegmentId','get','nameToId','parentId','journeyBundleId','Journey\x20\x27','description','INTERNAL','deps',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','schedule','some','ACTIVATION_SYNTAX_ERROR','branches','from','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','object','createdSegmentIds','yamlConfig','toLowerCase','uniqueSegmentName','yamlActivation','entry','\x27\x20exit\x20criteria','activation_updated','item','Creating\x20activation\x20\x27','and\x20the\x20server\x20segment,\x20then\x20retry.','segment_created','action','\x27\x20from\x20file:\x20',').\x20','JOURNEY_SYNTAX_ERROR','Updated\x20activation\x20\x27','.$1.push-recovery.json','segments','Failed\x20to\x20resolve\x20segment\x20','updateActivation','folderId','activationParams','NOT_FOUND','data','waitStepType','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','\x27\x20wait\x20condition','getLatestJourneyId','trim','localName','flatMap','goal','embeddedSegmentNameToId','DecisionPoint','update','fetchJourney','name','\x20segment\x20from\x20file:\x20'];a142_0x570e=function(){return _0x27af4e;};return a142_0x570e();}export function findSegmentsToDelete(_0x33a1f5,_0x1388c2,_0x437af8,_0x4de174,_0x2b1e51){const _0x1e25e2=a142_0x3ef9cf,_0x2ff9c5=new Set();for(const {yamlConfig:_0x455b29,folderPath:_0x47a75e}of _0x1388c2){_0x2ff9c5['add'](_0x47a75e+':'+_0x455b29[_0x1e25e2(0x26e)]);}return _0x33a1f5[_0x1e25e2(0x29e)](_0x4590ed=>{const _0x48090f=_0x1e25e2,_0x52e94b=_0x4590ed['segmentFolderId']?_0x437af8['get'](_0x4590ed[_0x48090f(0x1d4)]['toString']())||'':'',_0x39f2f5=_0x52e94b+':'+_0x4590ed[_0x48090f(0x26e)];if(_0x2ff9c5[_0x48090f(0x1d5)](_0x39f2f5))return![];if(_0x2b1e51)return _0x52e94b===_0x4de174||_0x52e94b[_0x48090f(0x207)](_0x4de174+'/');return!![];});}export function findJourneysToDelete(_0xd2c845,_0x4172b8,_0x12bd70,_0x381b63,_0x210c70){const _0x4c0f02=a142_0x3ef9cf,_0x4ff9aa=new Set();for(const {yamlConfig:_0x5aab86,folderPath:_0x5a0fe6}of _0x4172b8){_0x4ff9aa[_0x4c0f02(0x218)](_0x5a0fe6+':'+_0x5aab86[_0x4c0f02(0x26e)]);}return _0xd2c845[_0x4c0f02(0x29e)](_0x7c25e2=>{const _0x1600d3=_0x4c0f02,_0x3fd7fe=_0x7c25e2['folderId']?_0x12bd70[_0x1600d3(0x239)](_0x7c25e2[_0x1600d3(0x25e)])||'':'',_0x5b70e9=_0x3fd7fe+':'+_0x7c25e2[_0x1600d3(0x1b8)];if(_0x4ff9aa[_0x1600d3(0x1d5)](_0x5b70e9))return![];if(_0x210c70)return _0x3fd7fe===_0x381b63||_0x3fd7fe[_0x1600d3(0x207)](_0x381b63+'/');return!![];});}export function buildSegmentLookupMap(_0x238649,_0x317c0c){const _0x549f85=a142_0x3ef9cf,_0x4cbd45=new Map();for(const _0x7bd865 of _0x238649){const _0x3eeeb4=_0x7bd865[_0x549f85(0x1d4)]?_0x317c0c[_0x549f85(0x239)](_0x7bd865[_0x549f85(0x1d4)][_0x549f85(0x1bd)]())||'':'',_0x1cd77e=_0x3eeeb4+':'+_0x7bd865[_0x549f85(0x26e)];_0x4cbd45[_0x549f85(0x21b)](_0x1cd77e,_0x7bd865);}return _0x4cbd45;}function a142_0x3bff(_0x1b776c,_0x143ee8){_0x1b776c=_0x1b776c-0x1a4;const _0x570e97=a142_0x570e();let _0x3bff15=_0x570e97[_0x1b776c];return _0x3bff15;}export function buildSegmentNameToIdMap(_0x139b51){const _0x4b1f62=a142_0x3ef9cf,_0x3f8afe=new Map();for(const _0x5319db of _0x139b51){_0x3f8afe[_0x4b1f62(0x21b)](_0x5319db[_0x4b1f62(0x26e)],_0x5319db['id']);}return _0x3f8afe;}export function buildJourneyBundleLookupMap(_0x178ddf,_0x53fda8){const _0x7bf2af=a142_0x3ef9cf,_0x10cfa1=new Map();for(const _0x2e2e4a of _0x178ddf){const _0x51b74e=_0x2e2e4a['folderId']?_0x53fda8['get'](_0x2e2e4a[_0x7bf2af(0x25e)])||'':'',_0x53fc05=_0x51b74e+':'+_0x2e2e4a[_0x7bf2af(0x1b8)];!_0x10cfa1[_0x7bf2af(0x1d5)](_0x53fc05)&&_0x10cfa1[_0x7bf2af(0x21b)](_0x53fc05,[]),_0x10cfa1[_0x7bf2af(0x239)](_0x53fc05)[_0x7bf2af(0x1a4)](_0x2e2e4a);}for(const _0x44857d of _0x10cfa1[_0x7bf2af(0x1d7)]()){_0x44857d[_0x7bf2af(0x1d0)]((_0x5e8e73,_0x31368e)=>(_0x5e8e73['versionNumber']||0x0)-(_0x31368e[_0x7bf2af(0x210)]||0x0));}return _0x10cfa1;}export function collectFoldersToCreate(_0x4521c7,_0x2fb469){const _0x574c94=a142_0x3ef9cf,_0x3508d5=new Set();for(const _0x80ffd4 of _0x4521c7){if(!_0x80ffd4)continue;if(_0x2fb469[_0x574c94(0x1d5)](_0x80ffd4))continue;const _0x3a6972=_0x80ffd4[_0x574c94(0x1ce)]('/');let _0x1709f6='';for(const _0x18e14d of _0x3a6972){_0x1709f6=_0x1709f6?_0x1709f6+'/'+_0x18e14d:_0x18e14d,!_0x2fb469[_0x574c94(0x1d5)](_0x1709f6)&&_0x3508d5[_0x574c94(0x218)](_0x1709f6);}}return _0x3508d5;}export function parseAndClassifyYamlFiles(_0x1702e6,_0x5a63a1,_0x332427){const _0x9c5754=a142_0x3ef9cf,_0x184e1f=[],_0x41c5bc=[];for(const _0x453e67 of _0x1702e6){const _0x576c68=a142_0x3c5b6d['relative'](_0x5a63a1,a142_0x3c5b6d[_0x9c5754(0x278)](_0x453e67)),_0x4b3159=_0x576c68==='.'?'':_0x576c68,_0xb06802=readFileSync(_0x453e67,'utf-8'),_0x32831d=a142_0x4a29a2[_0x9c5754(0x1dc)](_0xb06802);if(isJourneyDef(_0x32831d)){const _0x5f4f5b=a142_0x4a5f14(_0xb06802);_0x41c5bc['push']({'yamlConfig':_0x5f4f5b,'folderPath':_0x4b3159,'sourcePath':_0x453e67});}else{if(!_0x332427?.['skipSegments']){const _0x42622b=parseSegmentYamlFile(_0xb06802),_0x4297a2=normalizeChildSegmentYaml(_0x42622b);_0x184e1f[_0x9c5754(0x1a4)]({'yamlConfig':_0x4297a2,'folderPath':_0x4b3159,'sourcePath':_0x453e67});}}}return{'segments':_0x184e1f,'journeys':_0x41c5bc};}export function validateParsedFiles(_0x374afe,_0x376e3c){const _0x8c0e09=a142_0x3ef9cf,_0x2cd0ce=[];for(const {yamlConfig:_0x173472,sourcePath:_0x3f6d29}of _0x374afe[_0x8c0e09(0x25b)]){const _0x14c1d2=readFileSync(_0x3f6d29,_0x8c0e09(0x226)),_0x1c6d34=a142_0x4a29a2[_0x8c0e09(0x1bb)](_0x14c1d2),_0x5971d1=validateSegmentDef(_0x173472,{'source':_0x14c1d2,'document':_0x1c6d34},{'skipSchema':!![]});if(!_0x5971d1['valid']){const _0x46a348=a142_0x3c5b6d['relative'](_0x376e3c,_0x3f6d29);_0x2cd0ce['push']({'filePath':_0x46a348,'source':_0x14c1d2,'result':_0x5971d1,'isJourney':![]});}}for(const {yamlConfig:_0x18c92d,sourcePath:_0x3044c2}of _0x374afe[_0x8c0e09(0x2a6)]){const _0x5c6992=readFileSync(_0x3044c2,_0x8c0e09(0x226)),_0x37cb9b=a142_0x4a29a2[_0x8c0e09(0x1bb)](_0x5c6992),_0x466d62=validateJourneyDef(_0x18c92d,{'source':_0x5c6992,'document':_0x37cb9b},{'skipSchema':!![]});if(!_0x466d62[_0x8c0e09(0x1db)]){const _0x2fc8f3=a142_0x3c5b6d[_0x8c0e09(0x1df)](_0x376e3c,_0x3044c2);_0x2cd0ce[_0x8c0e09(0x1a4)]({'filePath':_0x2fc8f3,'source':_0x5c6992,'result':_0x466d62,'isJourney':!![]});}}return _0x2cd0ce;}export function formatValidationErrors(_0x5f2adb){const _0x214c8b=a142_0x3ef9cf,_0x2d3502=[];for(const {filePath:_0xf13c3c,source:_0x3c5e84,result:_0x489ee9,isJourney:_0x35c890}of _0x5f2adb){const _0xb3267d=_0x35c890?_0x214c8b(0x292):_0x214c8b(0x1c7);_0x2d3502[_0x214c8b(0x1a4)]('\x0a'+_0xf13c3c+'\x20('+_0xb3267d+_0x214c8b(0x2a5)+_0x489ee9[_0x214c8b(0x217)]['length']+_0x214c8b(0x27e)),_0x2d3502[_0x214c8b(0x1a4)](formatValidationResult(_0x489ee9,_0x3c5e84,_0xf13c3c));}return _0x2d3502[_0x214c8b(0x271)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x328e47){const _0x35179b=a142_0x3ef9cf,_0x336371=new Set(),_0x43a277=new Map(),_0x127949=collectSegmentUsageCounts(_0x328e47);if(_0x328e47[_0x35179b(0x25b)])for(const [_0x39b242,_0x2ebb1f]of Object['entries'](_0x328e47[_0x35179b(0x25b)])){_0x336371[_0x35179b(0x218)](_0x39b242);if(_0x2ebb1f[_0x35179b(0x2a2)]){const _0x46fca0=yamlRuleToApi(_0x2ebb1f[_0x35179b(0x2a2)]),_0x10a7f6=apiRuleToYaml(_0x46fca0);_0x43a277[_0x35179b(0x21b)](_0x39b242,_0x10a7f6);}}const _0x36cd2c=new Map();let _0x580575=0x0;for(const [_0x420f23,_0xccab7f]of _0x43a277){const _0x66a5f9=serializeExpandedRule(_0xccab7f,_0x43a277),_0x3246bf=_0x36cd2c[_0x35179b(0x239)](_0x66a5f9)||[];_0x3246bf['push']({'name':_0x420f23,'index':_0x580575}),_0x36cd2c['set'](_0x66a5f9,_0x3246bf),_0x580575++;}const _0x566104=new Map();for(const [_0x4c69c4,_0x5b3047]of _0x36cd2c){const _0x990c0f=_0x5b3047[_0x35179b(0x212)]()[_0x35179b(0x1d0)]((_0x14770a,_0x5b4461)=>{const _0x342ce7=_0x35179b,_0x126e0a=_0x127949['get'](_0x14770a[_0x342ce7(0x26e)])||0x0,_0x3febcb=_0x127949['get'](_0x5b4461[_0x342ce7(0x26e)])||0x0;if(_0x126e0a!==_0x3febcb)return _0x3febcb-_0x126e0a;return _0x14770a[_0x342ce7(0x1fb)]-_0x5b4461[_0x342ce7(0x1fb)];})['map'](_0x495280=>_0x495280[_0x35179b(0x26e)]),_0x33d07d=[];for(const _0x1e79e8 of _0x990c0f){const _0x4f96b8=_0x127949['get'](_0x1e79e8)||0x0,_0xcebba8=Math[_0x35179b(0x285)](_0x4f96b8,0x1);for(let _0x3884f2=0x0;_0x3884f2<_0xcebba8;_0x3884f2++){_0x33d07d[_0x35179b(0x1a4)](_0x1e79e8);}}_0x566104[_0x35179b(0x21b)](_0x4c69c4,_0x33d07d);}return{'existingLocalSegmentNames':_0x336371,'localSegmentRules':_0x43a277,'localExpandedRuleToNames':_0x566104};}export function createSegmentIdResolver(_0x36bd57,_0x4f4fb9){return async _0x398b42=>{const _0x4e8806=a142_0x3bff,_0x2f10d4=_0x36bd57[_0x4e8806(0x239)](_0x398b42);if(!_0x2f10d4)throw new SDKError(ErrorCode[_0x4e8806(0x203)],_0x4e8806(0x20b)+_0x398b42+_0x4e8806(0x27b)+_0x4f4fb9+'\x27)');return _0x2f10d4;};}export function extractRootFolderId(_0x1d1451){const _0x2a2679=a142_0x3ef9cf;return _0x1d1451[_0x2a2679(0x1f6)]?.[_0x2a2679(0x288)]?.[_0x2a2679(0x261)]?.['id']||_0x1d1451['relationships']?.['parentFolder']?.[_0x2a2679(0x261)]?.['id'];}export function buildConnectionMaps(_0x5290ef){const _0x67a573=a142_0x3ef9cf,_0x5dbbdd=new Map(),_0x20abd8=new Map(),_0x23086f=new Map();for(const _0x4227d4 of _0x5290ef){_0x5dbbdd[_0x67a573(0x21b)](_0x4227d4['name'],parseInt(_0x4227d4['id'],0xa)),_0x20abd8[_0x67a573(0x21b)](_0x4227d4['id'],_0x4227d4[_0x67a573(0x26e)]),_0x23086f[_0x67a573(0x21b)](_0x4227d4[_0x67a573(0x26e)],_0x4227d4['type']);}return{'nameToId':_0x5dbbdd,'idToName':_0x20abd8,'nameToType':_0x23086f};}export function calculatePushStats(_0x14ab0a,_0x2d0425,_0x4a3c3f,_0x58dcfe,_0x218877,_0x3a5860,_0x279ba0){const _0x5b2d58=a142_0x3ef9cf,_0x3a48f9=_0x14ab0a['filter'](_0x53c074=>_0x53c074['isNew']),_0x52cd3f=_0x14ab0a[_0x5b2d58(0x29e)](_0x7bca4f=>!_0x7bca4f[_0x5b2d58(0x279)]&&_0x7bca4f['hasChanges']),_0x3fde8c=_0x14ab0a['filter'](_0x304114=>!_0x304114[_0x5b2d58(0x279)]&&!_0x304114[_0x5b2d58(0x1e3)]),_0x5a39ff=_0x3a5860?_0x58dcfe:[],_0x1327ac=_0x2d0425['filter'](_0x24780e=>_0x24780e[_0x5b2d58(0x279)]),_0x335ab9=_0x2d0425[_0x5b2d58(0x29e)](_0x5d6461=>!_0x5d6461[_0x5b2d58(0x279)]&&_0x5d6461[_0x5b2d58(0x1e3)]),_0xa4de92=_0x2d0425[_0x5b2d58(0x29e)](_0x3ba9b9=>!_0x3ba9b9[_0x5b2d58(0x279)]&&!_0x3ba9b9[_0x5b2d58(0x1e3)]),_0x3228e6=_0x3a5860?_0x218877:[],_0x56776c=_0x14ab0a[_0x5b2d58(0x268)](_0x15ed34=>_0x15ed34['activationActions']),_0x28b94d=_0x56776c['filter'](_0x8fe17f=>_0x8fe17f[_0x5b2d58(0x21a)]==='create'),_0x26de2a=_0x56776c[_0x5b2d58(0x29e)](_0x426b5b=>_0x426b5b[_0x5b2d58(0x21a)]===_0x5b2d58(0x26c)),_0x161501=_0x56776c[_0x5b2d58(0x29e)](_0x44cc3c=>_0x44cc3c['type']===_0x5b2d58(0x1f9)),_0x3002ca=Array[_0x5b2d58(0x246)](_0x4a3c3f)['sort'](),_0x5a4c29=_0x279ba0?![]:_0x3a48f9[_0x5b2d58(0x1f4)]>0x0||_0x52cd3f['length']>0x0||_0x5a39ff[_0x5b2d58(0x1f4)]>0x0,_0x566b35=_0x1327ac[_0x5b2d58(0x1f4)]>0x0||_0x335ab9[_0x5b2d58(0x1f4)]>0x0||_0x3228e6['length']>0x0,_0x51c454=_0x279ba0?![]:_0x56776c['length']>0x0,_0x2f030b=_0x3002ca[_0x5b2d58(0x1f4)]>0x0;return{'segments':{'new':_0x3a48f9,'changed':_0x52cd3f,'unchanged':_0x3fde8c,'toDelete':_0x5a39ff},'journeys':{'new':_0x1327ac,'changed':_0x335ab9,'unchanged':_0xa4de92,'toDelete':_0x3228e6},'activations':{'all':_0x56776c,'toCreate':_0x28b94d,'toUpdate':_0x26de2a,'toDelete':_0x161501},'folders':{'toCreate':_0x3002ca},'counts':{'segments':{'new':_0x3a48f9[_0x5b2d58(0x1f4)],'changed':_0x52cd3f[_0x5b2d58(0x1f4)],'unchanged':_0x3fde8c['length'],'toDelete':_0x5a39ff[_0x5b2d58(0x1f4)]},'journeys':{'new':_0x1327ac[_0x5b2d58(0x1f4)],'changed':_0x335ab9['length'],'unchanged':_0xa4de92[_0x5b2d58(0x1f4)],'toDelete':_0x3228e6['length']},'activations':{'create':_0x28b94d[_0x5b2d58(0x1f4)],'update':_0x26de2a[_0x5b2d58(0x1f4)],'delete':_0x161501['length']},'folders':_0x3002ca[_0x5b2d58(0x1f4)]},'hasChanges':_0x5a4c29||_0x566b35||_0x51c454||_0x2f030b};}export async function buildPushExecutionContext(_0xa56521,_0x1d95bf,_0x29d094,_0x5e43b3,_0x5364bb,_0x1a86e0){const _0xe1b4ce=a142_0x3ef9cf,_0x2bee9a=extractRootFolderId(_0x29d094),{pathToId:_0x337dca,idToPath:_0x4d0c4c}=buildFolderMaps(_0x5364bb),_0x3cde21=buildSegmentNameToIdMap(_0x5e43b3),_0x2066f6=new Map(),{batchAsync:_0x36bb4d}=await import(_0xe1b4ce(0x22d)),[_0x25fc6f,_0x4aaeff]=await Promise[_0xe1b4ce(0x20f)]([_0xa56521['user'][_0xe1b4ce(0x1d8)](),_0xa56521['connection'][_0xe1b4ce(0x286)](),((async()=>{const _0x3f84ad=_0xe1b4ce;!_0x1a86e0&&_0x5e43b3[_0x3f84ad(0x1f4)]>0x0&&await _0x36bb4d(_0x5e43b3,async _0x8cbc31=>{const _0xa8a093=_0x3f84ad,_0x437486=await _0xa56521['segment'][_0xa8a093(0x28f)](_0x1d95bf,_0x8cbc31['id']);_0x2066f6[_0xa8a093(0x21b)](_0x8cbc31['id'],_0x437486);});})())]),{emailToId:_0x4dafc9,idToEmail:_0x162c44}=_0x25fc6f,_0x5de609=buildConnectionMaps(_0x4aaeff);return{'rootFolderId':_0x2bee9a,'folderPathToId':_0x337dca,'folderIdToPath':_0x4d0c4c,'segmentNameToId':_0x3cde21,'activationsBySegmentId':_0x2066f6,'emailToIdMap':_0x4dafc9,'idToEmailMap':_0x162c44,'connectionNameToIdMap':_0x5de609[_0xe1b4ce(0x23a)],'connectionIdToNameMap':_0x5de609['idToName'],'connectionNameToTypeMap':_0x5de609[_0xe1b4ce(0x231)]};}export function createPushYamlContextForBundle(_0x3a9e98,_0x29f84a,_0x387cab,_0x3e8933,_0xa22d7b,_0x32bf2d,_0x107666,_0x2568e4){const {existingLocalSegmentNames:_0x4bbae4,localExpandedRuleToNames:_0x3c6b7f}=_0x3e8933,_0x13de0d=new Set(),_0x327203=new Map(),_0x1cc531=new Map(),_0x565804=new Map(),_0x42312d=createJumpTargetCache(),_0x45cbae=new Map(),_0x4cc3b9=new Map(),_0x270b2e=new Set();let _0x5484d9;const _0x568907=_0x181843=>{const _0x33368c={'resolveSegment':async _0x2b5984=>{const _0x39df6e=a142_0x3bff,_0x5b9db9=_0x565804[_0x39df6e(0x239)](_0x2b5984);if(_0x5b9db9!==undefined)return{'name':_0x5b9db9,'isJourneyLocal':!![]};try{const _0x3bee38=await fetchSegment(_0x3a9e98,_0x29f84a,_0x2b5984,_0x387cab);if(!_0x3bee38)throw new Error('Segment\x20not\x20found');const _0x112aa1=generateJourneyLocalName(_0x3bee38['name']),_0x1d7f9c=_0x3bee38['kind']===SEGMENT_KIND_JOURNEY&&_0x112aa1!==undefined;let _0x1900c5=_0x3bee38[_0x39df6e(0x26e)],_0x1f1590;if(_0x1d7f9c&&_0x3bee38[_0x39df6e(0x2a2)]){const _0x5194e9=apiRuleToYaml(_0x3bee38[_0x39df6e(0x2a2)]);_0x4cc3b9['set'](_0x2b5984,_0x5194e9);const _0x27abb7=async _0x79eaed=>{const _0x3ed4e8=_0x39df6e,_0x49f498=collectSegmentRefsFromRule(_0x79eaed);for(const _0x5f2dc6 of _0x49f498){if(!_0x4cc3b9[_0x3ed4e8(0x1d5)](_0x5f2dc6))try{const _0x3dd3c2=await fetchSegment(_0x3a9e98,_0x29f84a,_0x5f2dc6,_0x387cab);if(_0x3dd3c2?.[_0x3ed4e8(0x2a2)]){const _0x3ef4cf=apiRuleToYaml(_0x3dd3c2[_0x3ed4e8(0x2a2)]);_0x4cc3b9['set'](_0x5f2dc6,_0x3ef4cf),await _0x27abb7(_0x3ef4cf);}}catch(_0x5eded8){logger[_0x3ed4e8(0x270)]('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0x5f2dc6+':\x20'+_0x5eded8);}}};await _0x27abb7(_0x5194e9);const _0x29bbef=serializeExpandedRule(_0x5194e9,_0x4cc3b9),_0x54413c=_0x3c6b7f['get'](_0x29bbef);if(_0x54413c&&_0x54413c['length']>0x0){const _0x21c96e=_0x327203[_0x39df6e(0x239)](_0x29bbef)||0x0,_0x4ff1ea=_0x54413c[_0x21c96e]||_0x54413c[_0x54413c[_0x39df6e(0x1f4)]-0x1];_0x327203[_0x39df6e(0x21b)](_0x29bbef,_0x21c96e+0x1),_0x1900c5=_0x4ff1ea,_0x13de0d[_0x39df6e(0x218)](_0x1900c5),_0x565804[_0x39df6e(0x21b)](_0x2b5984,_0x1900c5);const _0x1fb98b=await resolveRuleSegmentRefs(_0x5194e9,async _0x41dc25=>{const _0x5d603c=_0x39df6e,_0x1c9694=_0x565804['get'](_0x41dc25);if(_0x1c9694)return _0x1c9694;const _0x366d86=await _0x5484d9['resolveSegment'](_0x41dc25);return _0x366d86[_0x5d603c(0x26e)];});_0x1f1590={'description':_0x3bee38[_0x39df6e(0x23e)],'rule':_0x1fb98b};}else{const _0x82a6eb=_0x45cbae[_0x39df6e(0x239)](_0x29bbef);if(_0x82a6eb)_0x1900c5=_0x82a6eb,_0x565804[_0x39df6e(0x21b)](_0x2b5984,_0x1900c5);else{if(_0x112aa1){let _0x283185=_0x112aa1,_0x21bf8b=0x2;while(_0x13de0d[_0x39df6e(0x1d5)](_0x283185)||_0x4bbae4[_0x39df6e(0x1d5)](_0x283185)){_0x283185=_0x112aa1+'_'+_0x21bf8b,_0x21bf8b++;}_0x13de0d[_0x39df6e(0x218)](_0x283185),_0x1900c5=_0x283185;}_0x565804['set'](_0x2b5984,_0x1900c5),_0x45cbae['set'](_0x29bbef,_0x1900c5);const _0x22ec3e=await resolveRuleSegmentRefs(_0x5194e9,async _0x172a59=>{const _0x448abf=_0x39df6e,_0x58b92b=_0x565804[_0x448abf(0x239)](_0x172a59);if(_0x58b92b)return _0x58b92b;const _0x867c25=await _0x5484d9[_0x448abf(0x229)](_0x172a59);return _0x867c25['name'];});_0x1f1590={'description':_0x3bee38[_0x39df6e(0x23e)],'rule':_0x22ec3e};}}}return{'name':_0x1900c5,'isJourneyLocal':_0x1d7f9c,'definition':_0x1f1590};}catch(_0x37062a){return logger['debug'](_0x39df6e(0x25c)+_0x2b5984+':\x20'+_0x37062a),{'name':_0x2b5984,'isJourneyLocal':![]};}},'resolveActivation':async _0x57ab07=>{const _0x257636=a142_0x3bff,_0x59ca3f=_0x1cc531[_0x257636(0x239)](_0x57ab07);if(_0x59ca3f!==undefined)return{'name':_0x59ca3f,'isJourneyLocal':!![]};try{let _0x2d44d0=_0x107666?.[_0x257636(0x239)](_0x57ab07);!_0x2d44d0&&(_0x2d44d0=await _0x3a9e98['journey'][_0x257636(0x1c1)](_0x181843,_0x57ab07));const _0x3c7539=_0x2d44d0['attributes'][_0x257636(0x25f)]['name']||_0x57ab07,_0x2c3129=sanitizeYamlKey(_0x3c7539)||_0x257636(0x29d)+_0x57ab07,_0x235c17=_0x2c3129;_0x1cc531[_0x257636(0x21b)](_0x57ab07,_0x235c17);const _0x30002e=journeyActivationStepToYaml(_0x2d44d0,_0xa22d7b,_0x32bf2d);return{'name':_0x235c17,'isJourneyLocal':!![],'definition':_0x30002e};}catch(_0x53d189){return logger['debug'](_0x257636(0x1f8)+_0x57ab07+':\x20'+_0x53d189),{'name':_0x57ab07,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x34df31,_0x19d8ef)=>resolveJumpTarget(_0x34df31,_0x19d8ef,_0x42312d,async _0x5b0b31=>{const _0x416ae0=a142_0x3bff,_0x1e9cd7=_0x2568e4?.[_0x416ae0(0x239)](_0x5b0b31);if(_0x1e9cd7)return _0x1e9cd7;return _0x3a9e98[_0x416ae0(0x292)][_0x416ae0(0x1e8)](_0x5b0b31);})};return _0x5484d9=_0x33368c,_0x33368c;},_0x2f3876=async _0x347a81=>{const _0x4a186f=a142_0x3bff,{collectSegmentIdsFromJourneyApi:_0x691994}=await import(_0x4a186f(0x223)),{batchAsync:_0x3df0a2}=await import('../../utils/async.js'),_0x499c51=new Set();for(const _0x174f64 of _0x347a81){let _0xa4dddc=_0x2568e4?.['get'](_0x174f64);!_0xa4dddc&&(_0xa4dddc=await _0x3a9e98['journey'][_0x4a186f(0x1e8)](_0x174f64));const _0x18fc1f=_0x691994(_0xa4dddc);for(const _0x1c5d2b of _0x18fc1f){_0x499c51[_0x4a186f(0x218)](_0x1c5d2b);}}let _0x2f39dd=Array[_0x4a186f(0x246)](_0x499c51);while(_0x2f39dd[_0x4a186f(0x1f4)]>0x0){const _0x479fa2=_0x2f39dd[_0x4a186f(0x29e)](_0x40c743=>!_0x270b2e[_0x4a186f(0x1d5)](_0x40c743));if(_0x479fa2[_0x4a186f(0x1f4)]===0x0)break;const _0x553a1e=await _0x3df0a2(_0x479fa2,async _0xcacf25=>{const _0x264aac=_0x4a186f;_0x270b2e[_0x264aac(0x218)](_0xcacf25);const _0x5c05eb=await fetchSegment(_0x3a9e98,_0x29f84a,_0xcacf25,_0x387cab);if(!_0x5c05eb)return null;return{'segmentId':_0xcacf25,'segment':_0x5c05eb};},0xa),_0x4c29bd=new Set();for(const _0x5d2b3f of _0x553a1e){if(!_0x5d2b3f?.[_0x4a186f(0x1c7)]?.[_0x4a186f(0x2a2)])continue;const _0x3e1296=apiRuleToYaml(_0x5d2b3f[_0x4a186f(0x1c7)]['rule']);_0x4cc3b9[_0x4a186f(0x21b)](_0x5d2b3f[_0x4a186f(0x221)],_0x3e1296);const _0x4467bc=collectSegmentRefsFromRule(_0x3e1296);for(const _0x1c00d3 of _0x4467bc){!_0x270b2e['has'](_0x1c00d3)&&_0x4c29bd[_0x4a186f(0x218)](_0x1c00d3);}}_0x2f39dd=Array[_0x4a186f(0x246)](_0x4c29bd);}};return{'createYamlContext':_0x568907,'prefetchJourneySegments':_0x2f3876};}export async function executePushSegments(_0x515cf4,_0x85c758,_0x3178e4,_0x264d2e,_0x3aa130){const _0xeb6e8f=a142_0x3ef9cf,{segmentDefToCreateRequest:_0x5a61e0,segmentDefToUpdateRequest:_0x37b3a8}=await import(_0xeb6e8f(0x201)),_0x4fb077=_0x3178e4[_0xeb6e8f(0x27f)],_0x94706f=0x5,_0xfa4156=async _0x34e0f1=>{const _0x38c83d=_0xeb6e8f,_0x1c3d45=_0x34e0f1[_0x38c83d(0x1ba)]?_0x4fb077['get'](_0x34e0f1[_0x38c83d(0x1ba)]):undefined;let _0x5e0f50;const _0x45559f={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x1edce6=_0x34e0f1[_0x38c83d(0x24a)];if(_0x34e0f1['yamlConfig'][_0x38c83d(0x2a2)]){const _0x5e4513=createSegmentIdResolver(_0x3178e4['segmentNameToId'],_0x34e0f1[_0x38c83d(0x24a)][_0x38c83d(0x26e)]),_0x4dabe3=await resolveRuleSegmentIds(_0x34e0f1['yamlConfig'][_0x38c83d(0x2a2)],_0x5e4513);_0x1edce6={..._0x34e0f1['yamlConfig'],'rule':_0x4dabe3};}try{if(_0x34e0f1[_0x38c83d(0x279)]){_0x3aa130[_0x38c83d(0x228)]?.({'type':'segment_creating','name':_0x34e0f1['yamlConfig'][_0x38c83d(0x26e)]});const _0x53edf4=_0x5a61e0(_0x1edce6,_0x1c3d45),_0x3f7a25=await _0x3aa130[_0x38c83d(0x235)](_0x38c83d(0x295)+_0x34e0f1[_0x38c83d(0x24a)]['name']+_0x38c83d(0x1a9),()=>_0x515cf4[_0x38c83d(0x1c7)][_0x38c83d(0x1cb)](_0x264d2e[_0x38c83d(0x23b)],_0x53edf4));_0x5e0f50=_0x3f7a25[_0x38c83d(0x261)]['id'],_0x3178e4['segmentNameToId'][_0x38c83d(0x21b)](_0x34e0f1['yamlConfig']['name'],_0x5e0f50),_0x45559f[_0x38c83d(0x29f)]={'name':_0x34e0f1[_0x38c83d(0x24a)][_0x38c83d(0x26e)],'id':_0x5e0f50},_0x3aa130[_0x38c83d(0x228)]?.({'type':_0x38c83d(0x254),'name':_0x34e0f1[_0x38c83d(0x24a)][_0x38c83d(0x26e)],'segmentId':_0x5e0f50}),_0x3aa130[_0x38c83d(0x1f3)]?.(_0x38c83d(0x237)+_0x34e0f1[_0x38c83d(0x24a)][_0x38c83d(0x26e)]+'\x27'),_0x45559f[_0x38c83d(0x1e7)]=0x1;}else{if(_0x34e0f1[_0x38c83d(0x1e3)]){_0x3aa130['onProgress']?.({'type':'segment_updating','name':_0x34e0f1[_0x38c83d(0x24a)][_0x38c83d(0x26e)]});const _0xc0bcc=_0x37b3a8(_0x1edce6);_0x1c3d45!==_0x34e0f1[_0x38c83d(0x1b9)]?.[_0x38c83d(0x1d4)]&&(_0xc0bcc[_0x38c83d(0x1d4)]=_0x1c3d45?parseInt(_0x1c3d45,0xa):undefined),await _0x3aa130[_0x38c83d(0x235)](_0x38c83d(0x1af)+_0x34e0f1[_0x38c83d(0x24a)][_0x38c83d(0x26e)]+_0x38c83d(0x1a9),()=>_0x515cf4[_0x38c83d(0x1c7)][_0x38c83d(0x200)](_0x264d2e[_0x38c83d(0x23b)],_0x34e0f1[_0x38c83d(0x1b9)]['id'],_0xc0bcc)),_0x5e0f50=_0x34e0f1[_0x38c83d(0x1b9)]['id'],_0x3aa130[_0x38c83d(0x228)]?.({'type':_0x38c83d(0x273),'name':_0x34e0f1[_0x38c83d(0x24a)][_0x38c83d(0x26e)]}),_0x3aa130['logSuccess']?.(_0x38c83d(0x1dd)+_0x34e0f1[_0x38c83d(0x24a)][_0x38c83d(0x26e)]+'\x27'),_0x45559f[_0x38c83d(0x1b5)]=0x1;}else _0x5e0f50=_0x34e0f1[_0x38c83d(0x1b9)]['id'];}}catch(_0x13fc7a){const _0x25479d=isHttp400Error(_0x13fc7a),_0x223b43=_0x25479d?ErrorCode[_0x38c83d(0x220)]:ErrorCode[_0x38c83d(0x299)],_0x86cb0b=getErrorMessage(_0x13fc7a);throw new SDKError(_0x223b43,_0x38c83d(0x230)+(_0x34e0f1['isNew']?_0x38c83d(0x28b):_0x38c83d(0x26c))+_0x38c83d(0x26f)+_0x34e0f1[_0x38c83d(0x27a)]+_0x38c83d(0x225)+_0x86cb0b,_0x13fc7a);}try{const _0x38767a=await syncActivationsForSegment(_0x515cf4,_0x264d2e[_0x38c83d(0x23b)],_0x5e0f50,_0x34e0f1[_0x38c83d(0x24a)][_0x38c83d(0x26e)],_0x34e0f1[_0x38c83d(0x1b4)],_0x3aa130,_0x34e0f1['absolutePath']);_0x45559f[_0x38c83d(0x2a4)]=_0x38767a;}catch(_0x453449){if(_0x453449 instanceof SDKError)throw _0x453449;throw new SDKError(ErrorCode[_0x38c83d(0x214)],_0x38c83d(0x290)+_0x34e0f1[_0x38c83d(0x24a)][_0x38c83d(0x26e)]+_0x38c83d(0x256)+_0x34e0f1[_0x38c83d(0x27a)]+_0x38c83d(0x225)+getErrorMessage(_0x453449),_0x453449);}return _0x45559f;},_0x101e57=await batchAsync(_0x85c758,_0xfa4156,_0x94706f),_0x282c8d={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x5c20dc of _0x101e57){_0x282c8d['created']+=_0x5c20dc[_0xeb6e8f(0x1e7)],_0x282c8d[_0xeb6e8f(0x1b5)]+=_0x5c20dc[_0xeb6e8f(0x1b5)],_0x5c20dc[_0xeb6e8f(0x29f)]&&_0x282c8d[_0xeb6e8f(0x249)][_0xeb6e8f(0x21b)](_0x5c20dc['createdSegmentId'][_0xeb6e8f(0x26e)],_0x5c20dc[_0xeb6e8f(0x29f)]['id']),_0x282c8d[_0xeb6e8f(0x2a4)][_0xeb6e8f(0x1e7)]+=_0x5c20dc[_0xeb6e8f(0x2a4)][_0xeb6e8f(0x1e7)],_0x282c8d['activations'][_0xeb6e8f(0x1b5)]+=_0x5c20dc[_0xeb6e8f(0x2a4)]['updated'],_0x282c8d['activations'][_0xeb6e8f(0x22a)]+=_0x5c20dc[_0xeb6e8f(0x2a4)][_0xeb6e8f(0x22a)];}return _0x282c8d;}async function syncActivationsForSegment(_0x5d3f3d,_0x19e6eb,_0x3f6b7b,_0xa4f5bd,_0x59d10d,_0x10e1d9,_0x3ceb17){const _0x259b75=a142_0x3ef9cf,_0x29be11={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x361c6a of _0x59d10d){try{if(_0x361c6a[_0x259b75(0x21a)]===_0x259b75(0x28b)&&_0x361c6a[_0x259b75(0x22f)])_0x10e1d9[_0x259b75(0x228)]?.({'type':_0x259b75(0x2a1),'segmentName':_0xa4f5bd,'activationName':_0x361c6a['name']}),await _0x10e1d9[_0x259b75(0x235)](_0x259b75(0x252)+_0x361c6a[_0x259b75(0x26e)]+_0x259b75(0x1a9),()=>_0x5d3f3d['segment']['createActivation'](_0x19e6eb,_0x3f6b7b,_0x361c6a[_0x259b75(0x22f)])),_0x10e1d9[_0x259b75(0x228)]?.({'type':_0x259b75(0x1bc),'segmentName':_0xa4f5bd,'activationName':_0x361c6a[_0x259b75(0x26e)]}),_0x10e1d9[_0x259b75(0x1f3)]?.(_0x259b75(0x204)+_0x361c6a[_0x259b75(0x26e)]+'\x27'),_0x29be11[_0x259b75(0x1e7)]++;else{if(_0x361c6a['type']===_0x259b75(0x26c)&&_0x361c6a[_0x259b75(0x22f)]&&_0x361c6a[_0x259b75(0x1cc)])_0x10e1d9[_0x259b75(0x228)]?.({'type':_0x259b75(0x1b6),'segmentName':_0xa4f5bd,'activationName':_0x361c6a[_0x259b75(0x26e)]}),await _0x10e1d9['withProgress'](_0x259b75(0x1b0)+_0x361c6a[_0x259b75(0x26e)]+_0x259b75(0x1a9),()=>_0x5d3f3d[_0x259b75(0x1c7)][_0x259b75(0x25d)](_0x19e6eb,_0x3f6b7b,_0x361c6a[_0x259b75(0x1cc)]['id'],_0x361c6a[_0x259b75(0x22f)])),_0x10e1d9[_0x259b75(0x228)]?.({'type':_0x259b75(0x250),'segmentName':_0xa4f5bd,'activationName':_0x361c6a[_0x259b75(0x26e)]}),_0x10e1d9[_0x259b75(0x1f3)]?.(_0x259b75(0x259)+_0x361c6a[_0x259b75(0x26e)]+'\x27'),_0x29be11['updated']++;else _0x361c6a[_0x259b75(0x21a)]==='delete'&&_0x361c6a[_0x259b75(0x1cc)]&&(_0x10e1d9['onProgress']?.({'type':_0x259b75(0x1cd),'segmentName':_0xa4f5bd,'activationName':_0x361c6a[_0x259b75(0x26e)]}),await _0x10e1d9[_0x259b75(0x235)]('Deleting\x20activation\x20\x27'+_0x361c6a['name']+'\x27...',()=>_0x5d3f3d[_0x259b75(0x1c7)][_0x259b75(0x1a7)](_0x19e6eb,_0x3f6b7b,_0x361c6a[_0x259b75(0x1cc)]['id'])),_0x10e1d9[_0x259b75(0x228)]?.({'type':_0x259b75(0x289),'segmentName':_0xa4f5bd,'activationName':_0x361c6a['name']}),_0x10e1d9[_0x259b75(0x1c9)]?.(_0x259b75(0x1fa)+_0x361c6a[_0x259b75(0x26e)]+'\x27'),_0x29be11[_0x259b75(0x22a)]++);}}catch(_0x45391b){const _0x1b4077=isHttp400Error(_0x45391b),_0x360f5e=_0x1b4077?ErrorCode[_0x259b75(0x244)]:ErrorCode[_0x259b75(0x214)],_0xd2b069=getErrorMessage(_0x45391b);throw new SDKError(_0x360f5e,'Failed\x20to\x20'+_0x361c6a[_0x259b75(0x21a)]+_0x259b75(0x28a)+_0x361c6a[_0x259b75(0x26e)]+'\x27\x20from\x20file:\x20'+_0x3ceb17+_0x259b75(0x225)+_0xd2b069,_0x45391b);}}return _0x29be11;}export async function executePushFolders(_0x3dc75c,_0x1c4e58,_0x724a67,_0x1c7c56,_0xef1eb0){const _0x4a80c1=a142_0x3ef9cf,_0x2137d8=new Map(_0x724a67),_0x37e1f6=sortFoldersByDepth(_0x1c4e58);for(const _0x28c332 of _0x37e1f6){const _0x37eea9=_0x28c332[_0x4a80c1(0x1ce)]('/'),_0x4d7014=_0x37eea9[_0x37eea9[_0x4a80c1(0x1f4)]-0x1],_0x8fe0b9=_0x37eea9[_0x4a80c1(0x212)](0x0,-0x1)[_0x4a80c1(0x271)]('/'),_0x24fd31=_0x2137d8[_0x4a80c1(0x239)](_0x8fe0b9);_0xef1eb0[_0x4a80c1(0x228)]?.({'type':'folder_creating','folder':_0x28c332});const _0x2eca18={'name':_0x4d7014,'parentFolderId':_0x24fd31},_0x39be64=await _0xef1eb0[_0x4a80c1(0x235)](_0x4a80c1(0x291)+_0x28c332+'\x27...',()=>_0x3dc75c[_0x4a80c1(0x1c7)][_0x4a80c1(0x1f0)](_0x1c7c56[_0x4a80c1(0x23b)],_0x2eca18));_0x2137d8['set'](_0x28c332,_0x39be64[_0x4a80c1(0x261)]['id']),_0xef1eb0['onProgress']?.({'type':_0x4a80c1(0x283),'folder':_0x28c332,'folderId':_0x39be64[_0x4a80c1(0x261)]['id']}),_0xef1eb0['logInfo']?.('Created\x20folder\x20\x27'+_0x28c332+'\x27');}return _0x2137d8;}export async function executePushSegmentDeletions(_0x5abd9e,_0x371803,_0x130695){const _0x326e08=a142_0x3ef9cf;if(_0x371803[_0x326e08(0x1f4)]===0x0)return 0x0;const {batchAsync:_0x3f6c82}=await import(_0x326e08(0x22d)),_0xb7b576=0x5,_0xa3c567=await _0x3f6c82(_0x371803,async _0x8dafe5=>{const _0x446ace=_0x326e08;return _0x130695['onProgress']?.({'type':'segment_deleting','name':_0x8dafe5[_0x446ace(0x26e)]}),await _0x5abd9e[_0x446ace(0x1c7)][_0x446ace(0x274)](_0x8dafe5['id']),_0x130695[_0x446ace(0x228)]?.({'type':'segment_deleted','name':_0x8dafe5['name']}),_0x130695[_0x446ace(0x1c9)]?.(_0x446ace(0x219)+_0x8dafe5['name']+'\x27'),0x1;},_0xb7b576);return _0xa3c567[_0x326e08(0x1b2)]((_0x13a7d0,_0x12cf1f)=>_0x13a7d0+_0x12cf1f,0x0);}export async function executePushJourneys(_0x39c8cf,_0x411c9f,_0x3e4b9e,_0x157f70,_0x10d8fc){const _0x1561fa=a142_0x3ef9cf,{journeyDefToRequest:_0x4ed490}=await import(_0x1561fa(0x223)),{activationDefToCreateRequest:_0x2dca40,yamlRuleToApi:_0x2723c6,validateSegmentRule:_0x470ef6}=await import(_0x1561fa(0x201)),_0x5209c9={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x5ee96e=new Map(_0x3e4b9e[_0x1561fa(0x1fc)]),_0x269afd=0x5;for(let _0x1274b2=0x0;_0x1274b2<_0x411c9f[_0x1561fa(0x1f4)];_0x1274b2+=_0x269afd){const _0x2e70eb=_0x411c9f['slice'](_0x1274b2,_0x1274b2+_0x269afd),_0x46c3ac=await Promise[_0x1561fa(0x20f)](_0x2e70eb[_0x1561fa(0x209)](async _0xba54b6=>{const _0x19ed66=_0x1561fa;if(!_0xba54b6[_0x19ed66(0x279)]&&!_0xba54b6[_0x19ed66(0x1e3)])return{'action':_0x19ed66(0x1c5),'name':_0xba54b6[_0x19ed66(0x24a)][_0x19ed66(0x26e)],'journeyId':_0xba54b6['existingJourney']?.['id']};const _0x30af03=_0xba54b6[_0x19ed66(0x1ba)]?_0x3e4b9e['folderPathToId'][_0x19ed66(0x239)](_0xba54b6[_0x19ed66(0x1ba)]):undefined;_0x10d8fc[_0x19ed66(0x228)]?.({'type':_0xba54b6[_0x19ed66(0x279)]?'journey_creating':_0x19ed66(0x1a8),'name':_0xba54b6[_0x19ed66(0x24a)]['name']});try{const _0x56a322=await executeSingleJourneyPush(_0x39c8cf,_0xba54b6,{..._0x3e4b9e,'segmentNameToId':_0x5ee96e},{'parentId':_0x157f70[_0x19ed66(0x23b)],'rootFolderId':_0x157f70[_0x19ed66(0x2a3)],'folderId':_0x30af03,'verbose':_0x157f70[_0x19ed66(0x234)]},_0x10d8fc,{'journeyDefToRequest':_0x4ed490,'activationDefToCreateRequest':_0x2dca40,'yamlRuleToApi':_0x2723c6,'validateSegmentRule':_0x470ef6});for(const [_0x25f90e,_0x5e540b]of _0x56a322['embeddedSegmentNameToId']){_0x5ee96e[_0x19ed66(0x21b)](_0x25f90e,_0x5e540b),_0x5209c9[_0x19ed66(0x26a)][_0x19ed66(0x21b)](_0x25f90e,_0x5e540b);}if(_0x56a322[_0x19ed66(0x255)]==='created')_0x10d8fc['onProgress']?.({'type':_0x19ed66(0x281),'name':_0xba54b6[_0x19ed66(0x24a)]['name'],'journeyId':_0x56a322[_0x19ed66(0x215)]}),_0x10d8fc[_0x19ed66(0x1f3)]?.(_0x19ed66(0x1c0)+_0xba54b6['yamlConfig'][_0x19ed66(0x26e)]+'\x27'),_0x5209c9[_0x19ed66(0x1e7)]++;else _0x56a322[_0x19ed66(0x255)]===_0x19ed66(0x1b5)&&(_0x10d8fc[_0x19ed66(0x228)]?.({'type':_0x19ed66(0x1c3),'name':_0xba54b6[_0x19ed66(0x24a)][_0x19ed66(0x26e)]}),_0x10d8fc[_0x19ed66(0x1f3)]?.(_0x19ed66(0x20a)+_0xba54b6[_0x19ed66(0x24a)][_0x19ed66(0x26e)]+'\x27'),_0x5209c9[_0x19ed66(0x1b5)]++);return{'action':_0x56a322[_0x19ed66(0x255)],'name':_0xba54b6[_0x19ed66(0x24a)]['name'],'journeyId':_0x56a322[_0x19ed66(0x215)]};}catch(_0x50b348){const _0x42fd14=isHttp400Error(_0x50b348),_0x1bd7fe=_0x42fd14?ErrorCode[_0x19ed66(0x258)]:ErrorCode[_0x19ed66(0x1b1)],_0x32da06=getErrorMessage(_0x50b348);throw new SDKError(_0x1bd7fe,_0x19ed66(0x230)+(_0xba54b6['isNew']?_0x19ed66(0x28b):_0x19ed66(0x26c))+_0x19ed66(0x1ff)+_0xba54b6['absolutePath']+_0x19ed66(0x225)+_0x32da06,_0x50b348);}}));_0x5209c9[_0x1561fa(0x27c)][_0x1561fa(0x1a4)](..._0x46c3ac);}return _0x5209c9;}async function matchExistingJourneySegments(_0x48d0cd,_0x29d426,_0x455e1d,_0x1944d9,_0x5d923e){const _0x86a001=a142_0x3ef9cf;if(!_0x29d426[_0x86a001(0x1f1)]||!_0x29d426[_0x86a001(0x24a)][_0x86a001(0x25b)])return;const _0x4cedb0=new Map(),_0x8c0ad4=new Set();for(const _0x1f4500 of Object[_0x86a001(0x294)](_0x29d426[_0x86a001(0x24a)]['segments'])){const _0x4bc281=generateDeterministicJourneySegmentName(_0x29d426[_0x86a001(0x24a)][_0x86a001(0x26e)],_0x1f4500);_0x4cedb0['set'](_0x4bc281,_0x1f4500),_0x8c0ad4[_0x86a001(0x218)](_0x1f4500);}const _0x2d66fa=[],_0x3dabfe=collectSegmentIdsFromJourneyApi(_0x29d426[_0x86a001(0x1f1)]);for(const _0x32bf43 of _0x3dabfe){const _0x512019=await fetchSegment(_0x48d0cd,_0x455e1d,_0x32bf43,_0x1944d9);if(!_0x512019?.[_0x86a001(0x26e)])continue;const _0x474985=_0x4cedb0['get'](_0x512019['name']);_0x474985?(_0x5d923e['set'](_0x474985,_0x32bf43),_0x8c0ad4[_0x86a001(0x1f9)](_0x474985)):_0x2d66fa[_0x86a001(0x1a4)]({'id':_0x32bf43,'seg':_0x512019});}if(_0x8c0ad4[_0x86a001(0x227)]>0x0&&_0x2d66fa[_0x86a001(0x1f4)]>0x0){const {localExpandedRuleToNames:_0x5ee4bf}=buildLocalExpandedRuleMappings(_0x29d426['yamlConfig']),_0x3158ca=new Map();for(const {id:_0x5ee772,seg:_0x1df42b}of _0x2d66fa){if(_0x1df42b[_0x86a001(0x2a2)]){const _0x366d75=apiRuleToYaml(_0x1df42b[_0x86a001(0x2a2)]);_0x3158ca[_0x86a001(0x21b)](_0x5ee772,_0x366d75);}}for(const {id:_0x3bce3c,seg:_0xf47c5f}of _0x2d66fa){if(!_0xf47c5f[_0x86a001(0x2a2)])continue;const _0x5892a1=_0x3158ca[_0x86a001(0x239)](_0x3bce3c);if(!_0x5892a1)continue;const _0x327850=serializeExpandedRule(_0x5892a1,_0x3158ca),_0xfdd2=_0x5ee4bf['get'](_0x327850);if(_0xfdd2){const _0x31a12a=_0xfdd2['find'](_0x520372=>_0x8c0ad4['has'](_0x520372));_0x31a12a&&(_0x5d923e['set'](_0x31a12a,_0x3bce3c),_0x8c0ad4[_0x86a001(0x1f9)](_0x31a12a),logger[_0x86a001(0x270)]('Matched\x20server\x20segment\x20\x27'+_0xf47c5f[_0x86a001(0x26e)]+'\x27\x20to\x20local\x20\x27'+_0x31a12a+'\x27\x20by\x20rule\x20content'));}}}}async function executeSingleJourneyPush(_0x2cabea,_0x26a4e7,_0x16c207,_0x3127b6,_0x5c90a6,_0x1c341a){const _0x41c72f=a142_0x3ef9cf,{journeyDefToRequest:_0x1bb1d9,activationDefToCreateRequest:_0x454e50,yamlRuleToApi:_0x4893e3,validateSegmentRule:_0x24b7c5}=_0x1c341a,_0x314f02=new Map(),_0x20f161=new Map();recoverSegmentIdsFromPushRecovery(_0x26a4e7,_0x314f02,_0x16c207[_0x41c72f(0x1fc)]);const _0xc7d9c8=new Map(),_0x24c57a=new Map(),_0x41c48e=new Map();let _0x46abb7;const _0x5bdaa1=async()=>{const _0x295e91=_0x41c72f;if(_0x46abb7)return;_0x46abb7=new Map();if(!_0x26a4e7['existingJourney'])return;const _0x58779e=await _0x2cabea[_0x295e91(0x292)][_0x295e91(0x28f)](_0x26a4e7['existingJourney']['id']);for(const _0x1763a5 of _0x58779e){const _0x484f32=journeyActivationStepToYaml(_0x1763a5,_0x16c207[_0x295e91(0x298)],_0x16c207[_0x295e91(0x1aa)]),_0x8dab28=activationSignature(_0x484f32);!_0x46abb7['has'](_0x8dab28)&&_0x46abb7['set'](_0x8dab28,_0x1763a5['id']),_0x484f32['name']&&_0x20f161['set'](_0x484f32[_0x295e91(0x26e)],_0x1763a5['id']);}};await matchExistingJourneySegments(_0x2cabea,_0x26a4e7,_0x3127b6['parentId'],_0x16c207[_0x41c72f(0x222)],_0x16c207['segmentNameToId']);const _0x331143={'resolveSegmentId':async _0x27242b=>{const _0x31e0a4=_0x41c72f,_0x5e5bb8=_0x16c207[_0x31e0a4(0x1fc)][_0x31e0a4(0x239)](_0x27242b);if(!_0x5e5bb8)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20not\x20found:\x20'+_0x27242b+_0x31e0a4(0x1a5)+_0x26a4e7['yamlConfig'][_0x31e0a4(0x26e)]+')');return _0x5e5bb8;},'resolveEmbeddedSegmentId':async(_0x30363c,_0x1ec0be)=>{const _0xabfca8=_0x41c72f,_0x24c569=_0x16c207['segmentNameToId'][_0xabfca8(0x239)](_0x30363c);if(_0x24c569)return _0x24c569;const _0x592181=_0x16c207[_0xabfca8(0x222)][_0xabfca8(0x1d9)](_0x46abea=>_0x46abea[_0xabfca8(0x26e)]===_0x30363c);if(_0x592181)return _0x16c207['segmentNameToId']['set'](_0x30363c,_0x592181['id']),_0x592181['id'];if(_0x26a4e7[_0xabfca8(0x279)]){const {stageName:_0x26c2f5,criteriaName:_0x5cba0f}=findSegmentCriteriaLocation(_0x26a4e7[_0xabfca8(0x24a)],_0x30363c);return _0x24b7c5(_0x30363c,_0x1ec0be[_0xabfca8(0x2a2)]),_0x24c57a[_0xabfca8(0x21b)](_0x30363c,{'definition':_0x1ec0be,'stageName':_0x26c2f5,'criteriaName':_0x5cba0f}),createPendingSegmentId(_0x30363c);}const _0x5d9804=_0x26a4e7[_0xabfca8(0x1f1)]?.['id'];if(!_0x5d9804)throw new SDKError(ErrorCode[_0xabfca8(0x23f)],_0xabfca8(0x1ee));const _0x1b1400=_0xc7d9c8[_0xabfca8(0x239)](_0x30363c);if(_0x1b1400)return _0x1b1400;const _0x43c190=((async()=>{const _0xcd0e0b=_0xabfca8;_0x24b7c5(_0x30363c,_0x1ec0be[_0xcd0e0b(0x2a2)]);const _0x202343=generateDeterministicJourneySegmentName(_0x26a4e7['yamlConfig']['name'],_0x30363c),_0x46d78c=_0x16c207[_0xcd0e0b(0x222)]['find'](_0xf6b213=>_0xf6b213[_0xcd0e0b(0x26e)]===_0x202343),_0x509757=createSegmentIdResolver(_0x16c207['segmentNameToId'],_0x30363c),_0xf1b700=await resolveRuleSegmentIds(_0x1ec0be[_0xcd0e0b(0x2a2)],_0x509757);let _0x3b09a4;return _0x46d78c?(await _0x2cabea[_0xcd0e0b(0x1c7)][_0xcd0e0b(0x200)](_0x3127b6[_0xcd0e0b(0x23b)],_0x46d78c['id'],{'description':_0x1ec0be[_0xcd0e0b(0x23e)]||_0xcd0e0b(0x1f5)+_0x30363c,'rule':_0x4893e3(_0xf1b700,!![]),'countPopulation':!![]}),_0x3b09a4=_0x46d78c['id'],saveSegmentToPushRecovery(_0x26a4e7[_0xcd0e0b(0x27a)],_0x26a4e7[_0xcd0e0b(0x24a)][_0xcd0e0b(0x26e)],_0x30363c,{'segmentId':_0x3b09a4,'uniqueServerName':_0x202343,'createdAt':new Date()[_0xcd0e0b(0x213)]()})):_0x3b09a4=await createOrRecoverEmbeddedSegment(_0x2cabea,_0x26a4e7,{'localName':_0x30363c,'uniqueSegmentName':_0x202343,'description':_0x1ec0be[_0xcd0e0b(0x23e)]||_0xcd0e0b(0x1f5)+_0x30363c,'journeyId':_0x5d9804,'resolvedRule':_0xf1b700,'parentId':_0x3127b6[_0xcd0e0b(0x23b)],'folderId':_0x3127b6[_0xcd0e0b(0x2a3)]||''},_0x4893e3),_0x16c207['segmentNameToId'][_0xcd0e0b(0x21b)](_0x30363c,_0x3b09a4),_0x314f02[_0xcd0e0b(0x21b)](_0x30363c,_0x3b09a4),_0x3b09a4;})());_0xc7d9c8['set'](_0x30363c,_0x43c190);try{return await _0x43c190;}finally{_0xc7d9c8[_0xabfca8(0x1f9)](_0x30363c);}},'resolveActivationId':async _0x1e6c4e=>{const _0x16fded=_0x41c72f,_0x517921=_0x20f161['get'](_0x1e6c4e);if(_0x517921)return _0x517921;if(_0x26a4e7[_0x16fded(0x1f1)]){await _0x5bdaa1();const _0x39817c=_0x20f161['get'](_0x1e6c4e);if(_0x39817c)return _0x39817c;}throw new SDKError(ErrorCode[_0x16fded(0x260)],_0x16fded(0x1c4)+_0x1e6c4e+'\x20(referenced\x20in\x20journey\x20'+_0x26a4e7[_0x16fded(0x24a)][_0x16fded(0x26e)]+_0x16fded(0x257)+_0x16fded(0x263));},'resolveEmbeddedActivationId':async(_0x4ec618,_0x2bde49)=>{const _0x1fe719=_0x41c72f,_0x287781=_0x20f161[_0x1fe719(0x239)](_0x4ec618);if(_0x287781)return _0x287781;if(_0x26a4e7[_0x1fe719(0x279)])return _0x41c48e[_0x1fe719(0x21b)](_0x4ec618,_0x2bde49),createPendingActivationId(_0x4ec618);if(_0x26a4e7['existingJourney']){await _0x5bdaa1();const _0x34f922=_0x20f161[_0x1fe719(0x239)](_0x2bde49['name']);if(_0x34f922)return _0x20f161[_0x1fe719(0x21b)](_0x4ec618,_0x34f922),_0x34f922;const _0x47513d=activationSignature(_0x2bde49),_0x3b3246=_0x46abb7?.[_0x1fe719(0x239)](_0x47513d);if(_0x3b3246)return _0x20f161[_0x1fe719(0x21b)](_0x4ec618,_0x3b3246),_0x3b3246;const _0x374d7b=await _0x454e50(_0x2bde49,_0x16c207[_0x1fe719(0x28d)]),_0x5615da={..._0x374d7b,..._0x2bde49[_0x1fe719(0x297)]!==undefined&&{'runAfterJourneyRefresh':_0x2bde49[_0x1fe719(0x297)]}},_0x2ad5da=await _0x2cabea[_0x1fe719(0x292)][_0x1fe719(0x29b)](_0x26a4e7[_0x1fe719(0x1f1)]['id'],_0x5615da);return _0x20f161[_0x1fe719(0x21b)](_0x4ec618,_0x2ad5da['id']),_0x2ad5da['id'];}throw new SDKError(ErrorCode[_0x1fe719(0x23f)],_0x1fe719(0x27d));},'resolveJourneyId':async _0x5ee2df=>{const _0x5cd087=_0x41c72f;try{return await _0x2cabea[_0x5cd087(0x292)]['resolveJourneyId'](_0x3127b6[_0x5cd087(0x23b)],_0x5ee2df);}catch(_0x443ca2){throw new SDKError(ErrorCode['NOT_FOUND'],_0x5cd087(0x23d)+_0x5ee2df+_0x5cd087(0x247)+_0x26a4e7[_0x5cd087(0x24a)][_0x5cd087(0x26e)]+'\x27)',_0x443ca2);}},'resolveStageId':async(_0x198bf1,_0x3a13e1)=>{const _0x2b7e37=_0x41c72f,_0x2cebf4=await _0x2cabea[_0x2b7e37(0x292)][_0x2b7e37(0x1e8)](_0x198bf1),_0x3d4f89=_0x2cebf4[_0x2b7e37(0x1fe)][_0x2b7e37(0x21f)][_0x2b7e37(0x1d9)](_0x46d7db=>_0x46d7db[_0x2b7e37(0x26e)][_0x2b7e37(0x24b)]()===_0x3a13e1[_0x2b7e37(0x24b)]());if(!_0x3d4f89?.['id'])throw new SDKError(ErrorCode[_0x2b7e37(0x260)],_0x2b7e37(0x1c8)+_0x3a13e1+_0x2b7e37(0x1ef)+(_0x2cebf4[_0x2b7e37(0x1fe)][_0x2b7e37(0x1b8)]||_0x2cebf4[_0x2b7e37(0x1fe)][_0x2b7e37(0x26e)])+'\x27');return _0x3d4f89['id'];}},_0x2b3b34=await _0x1bb1d9(_0x26a4e7[_0x41c72f(0x24a)],_0x3127b6[_0x41c72f(0x23b)],_0x331143),_0x21a3d0=_0x3127b6[_0x41c72f(0x25e)]||_0x3127b6[_0x41c72f(0x2a3)];_0x21a3d0&&(_0x2b3b34[_0x41c72f(0x1f6)]={'parentFolder':{'data':{'id':_0x21a3d0,'type':_0x41c72f(0x284)}}});if(_0x26a4e7['isNew']){if(_0x24c57a[_0x41c72f(0x227)]>0x0||_0x41c48e[_0x41c72f(0x227)]>0x0)return await executeThreeStepJourneyCreate(_0x2cabea,_0x26a4e7,_0x2b3b34,{'pendingEmbeddedSegments':_0x24c57a,'pendingEmbeddedActivations':_0x41c48e,'embeddedSegmentNameToId':_0x314f02,'journeyActivationNameToId':_0x20f161},{..._0x3127b6,'effectiveFolderId':_0x21a3d0},_0x16c207,_0x5c90a6,_0x1c341a);else{ensureJourneyDefaults(_0x2b3b34[_0x41c72f(0x1fe)]);const _0x564046=await _0x2cabea[_0x41c72f(0x292)]['create'](_0x2b3b34);return deletePushRecovery(_0x26a4e7['absolutePath']),{'action':'created','journeyId':_0x564046['id'],'embeddedSegmentNameToId':_0x314f02};}}else{if(_0x26a4e7[_0x41c72f(0x1e3)]&&_0x26a4e7['existingJourney']){_0x2b3b34['id']=_0x26a4e7['existingJourney']['id'];const _0x1b6571=_0x2b3b34[_0x41c72f(0x1fe)];_0x26a4e7[_0x41c72f(0x1f1)][_0x41c72f(0x1fe)]?.['journeyBundleName']&&(_0x1b6571[_0x41c72f(0x1b8)]=_0x26a4e7['existingJourney'][_0x41c72f(0x1fe)][_0x41c72f(0x1b8)]);const _0x2cfb2b=_0x26a4e7['existingJourney'][_0x41c72f(0x1fe)]?.['journeyStages'];return _0x2cfb2b&&_0x2b3b34[_0x41c72f(0x1fe)][_0x41c72f(0x21f)]&&injectExistingStageIds(_0x2b3b34['attributes'][_0x41c72f(0x21f)],_0x2cfb2b),ensureJourneyDefaults(_0x1b6571),await _0x2cabea['journey']['update'](_0x26a4e7[_0x41c72f(0x1f1)]['id'],_0x2b3b34),deletePushRecovery(_0x26a4e7['absolutePath']),{'action':_0x41c72f(0x1b5),'journeyId':_0x26a4e7[_0x41c72f(0x1f1)]['id'],'embeddedSegmentNameToId':_0x314f02};}}return deletePushRecovery(_0x26a4e7[_0x41c72f(0x27a)]),{'action':_0x41c72f(0x1c5),'journeyId':_0x26a4e7[_0x41c72f(0x1f1)]?.['id'],'embeddedSegmentNameToId':_0x314f02};}function findSegmentCriteriaLocation(_0x8e14f8,_0x4d815){const _0x1b6966=a142_0x3ef9cf,_0x4eb3b1=_0x8e14f8['stages']||_0x8e14f8[_0x1b6966(0x2a6)]?.[0x0]?.[_0x1b6966(0x1fd)]||[];let _0x2dfdc8=_0x1b6966(0x24e),_0x94c08f=_0x4d815;const _0x33350a=_0x8e14f8[_0x1b6966(0x269)]||_0x8e14f8[_0x1b6966(0x2a6)]?.[0x0]?.['goal'];if(_0x33350a?.[_0x1b6966(0x1c7)]===_0x4d815)return{'stageName':_0x1b6966(0x269),'criteriaName':_0x33350a[_0x1b6966(0x26e)]||_0x4d815};_0x28eae6:for(const _0x5c06d5 of _0x4eb3b1){if(_0x5c06d5[_0x1b6966(0x28e)]?.[_0x1b6966(0x1c7)]===_0x4d815){_0x2dfdc8=_0x5c06d5[_0x1b6966(0x26e)],_0x94c08f=_0x5c06d5['entry_criteria'][_0x1b6966(0x26e)]||_0x4d815;break;}if(_0x5c06d5[_0x1b6966(0x1a6)])for(const _0x22eef7 of _0x5c06d5['steps']){if(_0x22eef7[_0x1b6966(0x21a)]==='decision_point'&&_0x22eef7[_0x1b6966(0x1c6)]?.[_0x1b6966(0x245)])for(const _0x46c1e5 of _0x22eef7[_0x1b6966(0x1c6)][_0x1b6966(0x245)]){if(_0x46c1e5['segment']===_0x4d815){_0x2dfdc8=_0x5c06d5['name'],_0x94c08f=_0x46c1e5['name']||_0x4d815;break _0x28eae6;}}}}return{'stageName':_0x2dfdc8,'criteriaName':_0x94c08f};}async function executeThreeStepJourneyCreate(_0x1f968d,_0x16419c,_0x2db39b,_0x45ecc5,_0x350a61,_0x1d7529,_0x3598cf,_0x3c4ece){const _0x8d9cc1=a142_0x3ef9cf,{activationDefToCreateRequest:_0x471e03,yamlRuleToApi:_0x336715}=_0x3c4ece,{pendingEmbeddedSegments:_0xc2fb0d,pendingEmbeddedActivations:_0x1ab618,embeddedSegmentNameToId:_0x34af2c}=_0x45ecc5,_0x1c5b81=JSON[_0x8d9cc1(0x1dc)](JSON['stringify'](_0x2db39b));ensureJourneyDefaults(_0x1c5b81[_0x8d9cc1(0x1fe)]),stripPendingIds(_0x1c5b81);const _0x4c4ba7=await _0x1f968d[_0x8d9cc1(0x292)][_0x8d9cc1(0x28b)](_0x1c5b81),_0x33abf7=_0x4c4ba7['id'],_0x3286e4=new Map();for(const _0x4a73ce of _0x4c4ba7[_0x8d9cc1(0x1fe)][_0x8d9cc1(0x21f)]){_0x3286e4[_0x8d9cc1(0x21b)](_0x4a73ce['name'][_0x8d9cc1(0x24b)](),_0x4a73ce['id']);}recoverSegmentIdsFromPushRecovery(_0x16419c,_0x34af2c,_0x1d7529[_0x8d9cc1(0x1fc)]);for(const [_0x22dbaa,{definition:_0x253027}]of _0xc2fb0d){if(_0x34af2c[_0x8d9cc1(0x1d5)](_0x22dbaa)){_0x3598cf[_0x8d9cc1(0x228)]?.({'type':_0x8d9cc1(0x1e5),'journeyName':_0x16419c[_0x8d9cc1(0x24a)][_0x8d9cc1(0x26e)],'segmentName':_0x22dbaa});continue;}const _0x199a39=generateDeterministicJourneySegmentName(_0x16419c[_0x8d9cc1(0x24a)][_0x8d9cc1(0x26e)],_0x22dbaa);_0x3598cf[_0x8d9cc1(0x228)]?.({'type':'embedded_segment_creating','journeyName':_0x16419c['yamlConfig'][_0x8d9cc1(0x26e)],'segmentName':_0x22dbaa});const _0x3e7307=createSegmentIdResolver(_0x1d7529['segmentNameToId'],_0x22dbaa),_0x3c4098=await resolveRuleSegmentIds(_0x253027[_0x8d9cc1(0x2a2)],_0x3e7307),_0x4f784c=await createOrRecoverEmbeddedSegment(_0x1f968d,_0x16419c,{'localName':_0x22dbaa,'uniqueSegmentName':_0x199a39,'description':_0x253027[_0x8d9cc1(0x23e)]||_0x8d9cc1(0x1f5)+_0x22dbaa,'journeyId':_0x33abf7,'resolvedRule':_0x3c4098,'parentId':_0x350a61['parentId'],'folderId':_0x350a61['effectiveFolderId']||''},_0x336715);_0x34af2c[_0x8d9cc1(0x21b)](_0x22dbaa,_0x4f784c),_0x1d7529[_0x8d9cc1(0x1fc)][_0x8d9cc1(0x21b)](_0x22dbaa,_0x4f784c),_0x3598cf[_0x8d9cc1(0x228)]?.({'type':'embedded_segment_created','journeyName':_0x16419c[_0x8d9cc1(0x24a)][_0x8d9cc1(0x26e)],'segmentName':_0x22dbaa});}const _0x3221f4=new Map();for(const [_0x222694,_0x32302b]of _0x1ab618){_0x3598cf[_0x8d9cc1(0x228)]?.({'type':_0x8d9cc1(0x1ae),'journeyName':_0x16419c['yamlConfig'][_0x8d9cc1(0x26e)],'activationName':_0x222694});const _0x465c69=await _0x471e03(_0x32302b,_0x1d7529[_0x8d9cc1(0x28d)]),_0x38ed47={..._0x465c69,..._0x32302b[_0x8d9cc1(0x297)]!==undefined&&{'runAfterJourneyRefresh':_0x32302b['run_after_journey_refresh']}},_0x44be69=await _0x1f968d[_0x8d9cc1(0x292)][_0x8d9cc1(0x29b)](_0x33abf7,_0x38ed47);_0x3221f4[_0x8d9cc1(0x21b)](_0x222694,_0x44be69['id']),_0x45ecc5[_0x8d9cc1(0x1bf)]['set'](_0x222694,_0x44be69['id']),_0x3598cf[_0x8d9cc1(0x228)]?.({'type':_0x8d9cc1(0x1be),'journeyName':_0x16419c[_0x8d9cc1(0x24a)]['name'],'activationName':_0x222694});}const _0x590b19=JSON[_0x8d9cc1(0x1dc)](JSON[_0x8d9cc1(0x216)](_0x2db39b));return _0x590b19['id']=_0x33abf7,ensureJourneyDefaults(_0x590b19[_0x8d9cc1(0x1fe)]),resolvePendingIdsInRequest(_0x590b19,_0x2db39b,_0x3286e4,_0x34af2c,_0x3221f4,_0x3598cf),await _0x1f968d[_0x8d9cc1(0x292)][_0x8d9cc1(0x26c)](_0x33abf7,_0x590b19),deletePushRecovery(_0x16419c['absolutePath']),{'action':'created','journeyId':_0x33abf7,'embeddedSegmentNameToId':_0x34af2c};}export function stripWaitStepPendingIds(_0x225598){const _0x450c5d=a142_0x3ef9cf,_0x1b3b6a=_0x225598['conditionSegmentId']&&isPendingSegmentId(_0x225598[_0x450c5d(0x29a)]),_0x38c9ba=_0x225598[_0x450c5d(0x282)]?.[_0x450c5d(0x243)](_0x502d2e=>_0x502d2e[_0x450c5d(0x221)]&&isPendingSegmentId(_0x502d2e[_0x450c5d(0x221)]));(_0x1b3b6a||_0x38c9ba)&&(_0x225598[_0x450c5d(0x262)]='Duration',_0x225598[_0x450c5d(0x22e)]=0x1,_0x225598['waitStepUnit']=_0x450c5d(0x208),delete _0x225598[_0x450c5d(0x29a)],delete _0x225598[_0x450c5d(0x211)],delete _0x225598[_0x450c5d(0x1c2)],delete _0x225598[_0x450c5d(0x282)]);}export function resolveWaitStepPendingIds(_0x78135e,_0x11c531,_0x383f7f,_0xe1b83a){const _0x5e9149=a142_0x3ef9cf;if(_0x11c531[_0x5e9149(0x29a)]&&isPendingSegmentId(_0x11c531[_0x5e9149(0x29a)])){const _0x158253=_0x383f7f(_0x11c531[_0x5e9149(0x29a)],_0x5e9149(0x20c)+_0xe1b83a+_0x5e9149(0x264));_0x158253&&(_0x78135e[_0x5e9149(0x262)]='Condition',_0x78135e[_0x5e9149(0x29a)]=_0x158253,delete _0x78135e[_0x5e9149(0x22e)],delete _0x78135e[_0x5e9149(0x2a7)],_0x11c531[_0x5e9149(0x211)]!==undefined&&(_0x78135e[_0x5e9149(0x211)]=_0x11c531[_0x5e9149(0x211)]),_0x11c531[_0x5e9149(0x1c2)]&&(_0x78135e['conditionTimeoutUnit']=_0x11c531[_0x5e9149(0x1c2)]));}if(_0x11c531[_0x5e9149(0x282)]){const _0x3515ff=_0x11c531[_0x5e9149(0x282)]['some'](_0x27aa4f=>_0x27aa4f[_0x5e9149(0x221)]&&isPendingSegmentId(_0x27aa4f['segmentId']));if(_0x3515ff){const _0x4461d8=_0x11c531[_0x5e9149(0x282)][_0x5e9149(0x209)](_0x44b248=>{const _0x48abaf=_0x5e9149;if(_0x44b248['segmentId']&&isPendingSegmentId(_0x44b248[_0x48abaf(0x221)])){const _0x258c92=_0x383f7f(_0x44b248[_0x48abaf(0x221)],'stage\x20\x27'+_0xe1b83a+_0x48abaf(0x264));return{..._0x44b248,'segmentId':_0x258c92||_0x44b248[_0x48abaf(0x221)]};}return{..._0x44b248};});_0x78135e[_0x5e9149(0x262)]='Condition',_0x78135e[_0x5e9149(0x282)]=_0x4461d8,delete _0x78135e[_0x5e9149(0x22e)],delete _0x78135e['waitStepUnit'],delete _0x78135e[_0x5e9149(0x29a)],delete _0x78135e[_0x5e9149(0x211)],delete _0x78135e[_0x5e9149(0x1c2)];}}}function stripPendingIds(_0x4a925c){const _0x582a94=a142_0x3ef9cf;_0x4a925c['attributes']['goal']?.[_0x582a94(0x221)]&&isPendingSegmentId(_0x4a925c[_0x582a94(0x1fe)][_0x582a94(0x269)][_0x582a94(0x221)])&&delete _0x4a925c[_0x582a94(0x1fe)][_0x582a94(0x269)];for(const _0x19ae9f of _0x4a925c['attributes'][_0x582a94(0x21f)]||[]){_0x19ae9f['entryCriteria']?.[_0x582a94(0x221)]&&isPendingSegmentId(_0x19ae9f['entryCriteria'][_0x582a94(0x221)])&&delete _0x19ae9f[_0x582a94(0x20e)];_0x19ae9f[_0x582a94(0x236)]?.[_0x582a94(0x221)]&&isPendingSegmentId(_0x19ae9f['milestone']['segmentId'])&&delete _0x19ae9f[_0x582a94(0x236)];_0x19ae9f['exitCriterias']&&(_0x19ae9f[_0x582a94(0x1ad)]=_0x19ae9f[_0x582a94(0x1ad)][_0x582a94(0x29e)](_0x461d66=>!_0x461d66['segmentId']||!isPendingSegmentId(_0x461d66[_0x582a94(0x221)])));if(_0x19ae9f[_0x582a94(0x1a6)])for(const _0x4405e0 of Object[_0x582a94(0x294)](_0x19ae9f['steps'])){const _0x594ea1=_0x19ae9f[_0x582a94(0x1a6)][_0x4405e0];_0x594ea1[_0x582a94(0x21a)]==='Activation'&&_0x594ea1[_0x582a94(0x20d)]&&isPendingActivationId(_0x594ea1[_0x582a94(0x20d)])&&(_0x594ea1[_0x582a94(0x20d)]='');if(_0x594ea1[_0x582a94(0x21a)]==='DecisionPoint'&&_0x594ea1['branches'])for(const _0x11cb78 of _0x594ea1[_0x582a94(0x245)]){_0x11cb78[_0x582a94(0x221)]&&isPendingSegmentId(_0x11cb78[_0x582a94(0x221)])&&(_0x11cb78[_0x582a94(0x221)]='');}_0x594ea1['type']===_0x582a94(0x276)&&stripWaitStepPendingIds(_0x594ea1);}}}function resolvePendingIdsInRequest(_0x28a5b7,_0x510f82,_0x50325b,_0x49a709,_0x317a4c,_0x2ba210){const _0x3fc064=a142_0x3ef9cf,_0x13f962=(_0x521d79,_0x530d60)=>{const _0x2156b8=a142_0x3bff;if(!isPendingSegmentId(_0x521d79))return _0x521d79;const _0x4e683a=extractPendingSegmentName(_0x521d79),_0x3313db=_0x49a709['get'](_0x4e683a);return!_0x3313db&&_0x2ba210['logWarning']?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x4e683a+_0x2156b8(0x206)+_0x530d60),_0x3313db;};if(_0x28a5b7['attributes'][_0x3fc064(0x269)]?.['segmentId']&&isPendingSegmentId(_0x28a5b7[_0x3fc064(0x1fe)]['goal']['segmentId'])){const _0x2e6ab0=_0x13f962(_0x28a5b7[_0x3fc064(0x1fe)]['goal'][_0x3fc064(0x221)],'goal\x20criteria');_0x2e6ab0&&(_0x28a5b7[_0x3fc064(0x1fe)][_0x3fc064(0x269)][_0x3fc064(0x221)]=_0x2e6ab0);}for(const _0x5bd20f of _0x28a5b7[_0x3fc064(0x1fe)][_0x3fc064(0x21f)]||[]){const _0x3d0baf=_0x50325b[_0x3fc064(0x239)](_0x5bd20f[_0x3fc064(0x26e)]['toLowerCase']());_0x3d0baf&&(_0x5bd20f['id']=_0x3d0baf);if(_0x5bd20f['entryCriteria']?.[_0x3fc064(0x221)]&&isPendingSegmentId(_0x5bd20f[_0x3fc064(0x20e)]['segmentId'])){const _0x13b3a9=_0x13f962(_0x5bd20f['entryCriteria'][_0x3fc064(0x221)],'stage\x20\x27'+_0x5bd20f[_0x3fc064(0x26e)]+'\x27\x20entry\x20criteria');_0x13b3a9&&(_0x5bd20f['entryCriteria'][_0x3fc064(0x221)]=_0x13b3a9);}if(_0x5bd20f[_0x3fc064(0x1ad)])for(const _0x55f958 of _0x5bd20f[_0x3fc064(0x1ad)]){if(_0x55f958['segmentId']&&isPendingSegmentId(_0x55f958['segmentId'])){const _0x12318b=_0x13f962(_0x55f958['segmentId'],'stage\x20\x27'+_0x5bd20f['name']+_0x3fc064(0x24f));_0x12318b&&(_0x55f958[_0x3fc064(0x221)]=_0x12318b);}}if(_0x5bd20f[_0x3fc064(0x236)]?.[_0x3fc064(0x221)]&&isPendingSegmentId(_0x5bd20f[_0x3fc064(0x236)]['segmentId'])){const _0x4a8dfb=_0x13f962(_0x5bd20f[_0x3fc064(0x236)][_0x3fc064(0x221)],_0x3fc064(0x20c)+_0x5bd20f[_0x3fc064(0x26e)]+'\x27\x20milestone');_0x4a8dfb&&(_0x5bd20f['milestone'][_0x3fc064(0x221)]=_0x4a8dfb);}if(_0x5bd20f['steps']){const _0x215284=_0x13dcf7=>_0x510f82[_0x3fc064(0x1fe)][_0x3fc064(0x21f)]?.[_0x3fc064(0x1d9)](_0x3c8b48=>_0x3c8b48[_0x3fc064(0x26e)][_0x3fc064(0x24b)]()===_0x5bd20f[_0x3fc064(0x26e)]['toLowerCase']())?.[_0x3fc064(0x1a6)]?.[_0x13dcf7];for(const _0x561bee of Object[_0x3fc064(0x294)](_0x5bd20f['steps'])){const _0xf81985=_0x5bd20f[_0x3fc064(0x1a6)][_0x561bee],_0x1c5022=_0x215284(_0x561bee);if(_0xf81985[_0x3fc064(0x21a)]===_0x3fc064(0x1e9)&&_0xf81985[_0x3fc064(0x20d)]&&(isPendingActivationId(_0xf81985['journeyActivationStepId'])||_0xf81985[_0x3fc064(0x20d)]==='')){if(_0x1c5022?.['journeyActivationStepId']&&isPendingActivationId(_0x1c5022['journeyActivationStepId'])){const _0x3a6a60=extractPendingActivationName(_0x1c5022['journeyActivationStepId']),_0x451da7=_0x317a4c[_0x3fc064(0x239)](_0x3a6a60);_0x451da7&&(_0xf81985[_0x3fc064(0x20d)]=_0x451da7);}}if(_0xf81985['type']===_0x3fc064(0x26b)&&_0xf81985['branches']&&_0x1c5022?.[_0x3fc064(0x245)])for(let _0x5170b7=0x0;_0x5170b7<_0xf81985['branches'][_0x3fc064(0x1f4)];_0x5170b7++){const _0x52e6f5=_0xf81985[_0x3fc064(0x245)][_0x5170b7],_0x10e105=_0x1c5022[_0x3fc064(0x245)][_0x5170b7];if(_0x10e105?.['segmentId']&&isPendingSegmentId(_0x10e105['segmentId'])){const _0x1db6a0=_0x13f962(_0x10e105[_0x3fc064(0x221)],'stage\x20\x27'+_0x5bd20f[_0x3fc064(0x26e)]+_0x3fc064(0x21c)+(_0x52e6f5[_0x3fc064(0x26e)]||_0x5170b7)+'\x27');_0x1db6a0&&(_0x52e6f5[_0x3fc064(0x221)]=_0x1db6a0);}}_0xf81985[_0x3fc064(0x21a)]===_0x3fc064(0x276)&&_0x1c5022?.[_0x3fc064(0x21a)]===_0x3fc064(0x276)&&resolveWaitStepPendingIds(_0xf81985,_0x1c5022,_0x13f962,_0x5bd20f[_0x3fc064(0x26e)]);}}}}
1
+ const a142_0x2ccdb5=a142_0x48cb;(function(_0x279447,_0x7312cb){const _0x9e18cd=a142_0x48cb,_0x2ce644=_0x279447();while(!![]){try{const _0x242e8d=parseInt(_0x9e18cd(0x15b))/0x1*(parseInt(_0x9e18cd(0x128))/0x2)+-parseInt(_0x9e18cd(0x153))/0x3+parseInt(_0x9e18cd(0xbe))/0x4+-parseInt(_0x9e18cd(0xa8))/0x5*(-parseInt(_0x9e18cd(0x144))/0x6)+-parseInt(_0x9e18cd(0x123))/0x7+parseInt(_0x9e18cd(0x151))/0x8+-parseInt(_0x9e18cd(0xb6))/0x9;if(_0x242e8d===_0x7312cb)break;else _0x2ce644['push'](_0x2ce644['shift']());}catch(_0x42642c){_0x2ce644['push'](_0x2ce644['shift']());}}}(a142_0x1adc,0x7dd35));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of']('tdx.sdk.push-workflow');export const PENDING_SEGMENT_PREFIX=a142_0x2ccdb5(0xd4);export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0x14cbc6){return''+PENDING_SEGMENT_PREFIX+_0x14cbc6+'__';}export function isPendingSegmentId(_0x5d88cf){const _0x5de874=a142_0x2ccdb5;return _0x5d88cf['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x5d88cf[_0x5de874(0x181)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x2b8c3c){const _0x36be61=a142_0x2ccdb5;return _0x2b8c3c[_0x36be61(0x190)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x4e1930){return''+PENDING_ACTIVATION_PREFIX+_0x4e1930+'__';}export function isPendingActivationId(_0x327fab){return _0x327fab['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x324cf7){return _0x324cf7['replace'](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x37abde,_0x5181a2){const _0x212b8c=a142_0x2ccdb5,_0x452983=_0x37abde+'::'+(_0x5181a2[_0x212b8c(0x174)]()||_0x212b8c(0xaa)),_0x4cd7a7=createHash(_0x212b8c(0xda))[_0x212b8c(0xc0)](_0x452983)[_0x212b8c(0x156)](_0x212b8c(0xeb))[_0x212b8c(0xb7)](0x0,0xc);return _0x212b8c(0x125)+_0x4cd7a7;}export function ensureJourneyDefaults(_0x1bf84e){const _0x28d800=a142_0x2ccdb5;!_0x1bf84e[_0x28d800(0x10d)]&&(_0x1bf84e[_0x28d800(0x10d)]=''),!_0x1bf84e[_0x28d800(0x157)]&&(_0x1bf84e[_0x28d800(0x157)]=_0x28d800(0x134));}export function injectExistingStageIds(_0xe02864,_0x3ad764){const _0x38b4d0=a142_0x2ccdb5,_0x30c1bd=new Map(_0x3ad764[_0x38b4d0(0x122)](_0x32ba82=>[_0x32ba82[_0x38b4d0(0xed)],_0x32ba82['id']]));for(const _0x2d4ccd of _0xe02864){if(!_0x2d4ccd['id']){const _0x2459df=_0x30c1bd['get'](_0x2d4ccd[_0x38b4d0(0xed)]);_0x2459df&&(_0x2d4ccd['id']=_0x2459df);}}}export function resolveTDFolderPath(_0x276e4c,_0x338141,_0x56b94e){const _0x2969b6=a142_0x2ccdb5;if(!_0x338141)return _0x276e4c;if(_0x276e4c===_0x56b94e||_0x276e4c[_0x2969b6(0x181)](_0x56b94e+'/'))return _0x276e4c;return _0x276e4c?_0x56b94e+'/'+_0x276e4c:_0x56b94e;}export function addFoldersToCreate(_0x1a2ffe,_0x139c50,_0x19e74e){const _0x683ae2=a142_0x2ccdb5;if(!_0x1a2ffe)return;if(_0x139c50[_0x683ae2(0x105)](_0x1a2ffe))return;const _0x522c98=_0x1a2ffe[_0x683ae2(0xbd)]('/');let _0x32d0c6='';for(const _0x45c6f5 of _0x522c98){_0x32d0c6=_0x32d0c6?_0x32d0c6+'/'+_0x45c6f5:_0x45c6f5,!_0x139c50['has'](_0x32d0c6)&&_0x19e74e['add'](_0x32d0c6);}}function a142_0x1adc(){const _0x3e37c9=['15449229xCgWZd','slice','WaitStep','journey_updating','withProgress','includes','createJourneySegment','split','4113320svBffg','Failed\x20to\x20fetch\x20referenced\x20segment\x20','update','diff','flatMap','DecisionPoint','Fetching\x20','activation_deleting','\x27\x20not\x20found\x20in\x20journey\x20\x27','Created\x20activation\x20\x27','waitStep','./journey-yaml.js','segmentFolderId','from','existingJourney','index','conditionTimeoutDuration','behavior','max','\x20journey\x20from\x20file:\x20','folder','Segment\x20not\x20found:\x20','__pending_','existingSegment','goal','isNew','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','size','sha1','Segment\x20not\x20found','Failed\x20to\x20','match','segments','journeyActivationStepId','\x27\x20by\x20rule\x20content','kind','run_after_journey_refresh','debug','parse','values','\x27\x20to\x20local\x20\x27','waitStepUnit','journeyId','journeyBundleId','hasChanges','hex','getJourney','name','journeys','embedded_activation_created','\x27...','rootFolderId','journeyBundleName','dirname','ACTIVATION_UPDATE_ERROR','deleteSegment','conditions','type','journeyActivationNameToId','updated','data','parentFolder','INTERNAL','localName','parseDocument','resolveSegment','Deleted\x20activation\x20\x27','Activation\x20not\x20found:\x20','Creating\x20segment\x20\x27','getLatestJourneyId','segmentNameToId','has','\x27\x20from\x20file:\x20','folder_created','filter','deps','folder_creating','SEGMENT_UPDATE_ERROR','decision_point','description','embeddedSegmentNameToId','activationContext','activationStepsById','toISOString','segmentId','journeyBundlesByFolderAndName','delete','activationActions','entry_criteria','updateSegmentById','add','folderPath','some','reduce','Entry\x20criteria:\x20','notification','yamlConfig','createdSegmentIds','goal\x20criteria','list','map','2177826yytmrD','null','journey_entry_criteria_','created','keys','1319504qOHyoi','JOURNEY_UPDATE_ERROR','valid','journey_created','activation_deleted','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','Updated\x20journey\x20\x27','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','\x27\x20decision\x20point\x20branch\x20\x27','relative','journeyStages','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','draft','existingSegments','branches','Condition','uniqueServerName','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','Activation','attributes','journey_creating','fetchJourney','uniqueSegmentName','segment_deleting','folderPathToId','deleted','\x27\x20exit\x20criteria','getSegment','12738DTnJDf','versionNumber','activations','deleteActivation','resolveJourneyId','activation_updating','push','absolutePath','\x27\x20milestone','exitCriterias','getSegmentEntity','SEGMENT_SYNTAX_ERROR','milestone','1785864zqGizn','createActivation','747840OlWXoq','\x20activation\x20\x27','SEGMENT_NOT_FOUND','digest','state','conditionSegmentId','createdSegmentId','../../utils/async.js','1cloRAz','JOURNEY_SYNTAX_ERROR','all_columns','utf-8','journeyById','activationsBySegmentId','yamlActivation','stringify','and\x20the\x20server\x20segment,\x20then\x20retry.','activation_creating','validatedRequest','Deleting\x20activation\x20\x27','Failed\x20to\x20resolve\x20activation\x20','Deleted\x20segment\x20\x27','createFolder','idToName','updateActivation',').\x20','connector_config','logWarning','parentId','Duration','entryCriteria','onProgress','listActivations','trim','activation_updated','object','resolvedRule','schedule','journeyName','activation_','Delete\x20the\x20push\x20recovery\x20file\x20(','getSegment\x20failed\x20for\x20','find','Updated\x20segment\x20\x27','activation_created','./child-segment-yaml.js','startsWith','action','buildUserMaps','stages','get','user','activation_template_id','journey','\x0a\x20\x20','logInfo','sort','segmentByFolderAndName','columns','logSuccess','results','replace','Created\x20journey\x20\x27','idToEmailMap','rule','segment_updating','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','stage\x20\x27','existingActivation','relationships',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','createSegment','\x20error(s)','embedded_segment_created','length','entry','\x27\x20entry\x20criteria','waitStepType','Stage\x20\x27','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','toString','\x27\x20wait\x20condition','steps','folderId','conditionTimeoutUnit','2075hMBLkM','create','segment','toLowerCase','nameToType','with','.$1.push-recovery.json','connection','connectionIdToNameMap','embedded_activation_creating','NOT_FOUND','join','set','Journey\x20\x27'];a142_0x1adc=function(){return _0x3e37c9;};return a142_0x1adc();}export function sortFoldersByDepth(_0x110de6){return[..._0x110de6]['sort']((_0x34055c,_0x5b0a6e)=>{const _0x3d3899=a142_0x48cb,_0x52e258=(_0x34055c[_0x3d3899(0xdd)](/\//g)||[])[_0x3d3899(0x19d)],_0x1c9657=(_0x5b0a6e[_0x3d3899(0xdd)](/\//g)||[])['length'];return _0x52e258-_0x1c9657;});}import*as a142_0x79a98e from'yaml';import{readFileSync}from'fs';import a142_0x232f03 from'path';import{isJourneyDef,parseYamlString as a142_0x401a86,toYamlString as a142_0x94e2bd,normalizeJourneyDef,hasMultipleVersions,journeyResponseToDef,collectSegmentIdsFromJourneyApi}from'./journey-yaml.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,createJumpTargetCache,resolveJumpTarget,buildMergedJourneyDef,buildLocalRuleToNameMappingFromJourney,collectSegmentUsageCounts}from'./journey-utils.js';import{activationResponseToDef,segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,apiRuleToYaml,yamlRuleToApi,serializeExpandedRule,collectSegmentRefsFromRule,resolveRuleSegmentRefs,resolveRuleSegmentIds,journeyActivationStepToYaml}from'./child-segment-yaml.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';function a142_0x48cb(_0x3f606c,_0x274e6c){_0x3f606c=_0x3f606c-0x9e;const _0x1adcdd=a142_0x1adc();let _0x48cb92=_0x1adcdd[_0x3f606c];return _0x48cb92;}import{batchAsync}from'../../utils/async.js';import{buildFolderMaps}from'./resolution-context.js';import{SDKError,ErrorCode,isHttp400Error,getErrorMessage}from'../errors.js';import{readPushRecovery,saveSegmentToPushRecovery,deletePushRecovery}from'./push-recovery.js';import{validateSegmentDef,formatValidationResult}from'./yaml-validator.js';import{validateJourneyDef}from'./journey-validator.js';function stableStringify(_0x330caf){const _0xd9646=a142_0x2ccdb5;if(Array['isArray'](_0x330caf))return'['+_0x330caf[_0xd9646(0x122)](_0x4f4c90=>stableStringify(_0x4f4c90))['join'](',')+']';if(_0x330caf&&typeof _0x330caf===_0xd9646(0x176)){const _0x38be69=_0x330caf,_0x21ed87=Object[_0xd9646(0x127)](_0x38be69)[_0xd9646(0x18b)](),_0x603699=_0x21ed87['map'](_0x81f6fc=>'\x22'+_0x81f6fc+'\x22:'+stableStringify(_0x38be69[_0x81f6fc]));return'{'+_0x603699[_0xd9646(0xb3)](',')+'}';}const _0xe8d876=JSON[_0xd9646(0x162)](_0x330caf);return _0xe8d876===undefined?_0xd9646(0x124):_0xe8d876;}function activationSignature(_0x542416){const _0x3d4aa4=a142_0x2ccdb5,_0x4503cc={'connection':_0x542416[_0x3d4aa4(0xaf)],..._0x542416[_0x3d4aa4(0x15d)]!==undefined&&{'all_columns':_0x542416[_0x3d4aa4(0x15d)]},..._0x542416[_0x3d4aa4(0x18d)]!==undefined&&{'columns':_0x542416[_0x3d4aa4(0x18d)]},..._0x542416[_0x3d4aa4(0xcf)]!==undefined&&{'behavior':_0x542416['behavior']},..._0x542416[_0x3d4aa4(0x178)]!==undefined&&{'schedule':_0x542416[_0x3d4aa4(0x178)]},..._0x542416['notification']!==undefined&&{'notification':_0x542416[_0x3d4aa4(0x11d)]},..._0x542416[_0x3d4aa4(0x16d)]!==undefined&&{'connector_config':_0x542416[_0x3d4aa4(0x16d)]},..._0x542416['activation_template_id']!==undefined&&{'activation_template_id':_0x542416[_0x3d4aa4(0x187)]}};return stableStringify(_0x4503cc);}async function fetchSegment(_0x14a785,_0x348bc3,_0x44781c,_0x80c6e4){const _0xdefd79=a142_0x2ccdb5,_0x3a910c=_0x80c6e4?.[_0xdefd79(0x17d)](_0x63b29c=>_0x63b29c['id']===_0x44781c);if(_0x3a910c)return _0x3a910c;try{return await _0x14a785[_0xdefd79(0xaa)][_0xdefd79(0x143)](_0x348bc3,_0x44781c);}catch(_0x1f6728){logger[_0xdefd79(0xe3)](_0xdefd79(0x17c)+_0x44781c+_0xdefd79(0x199)+_0x1f6728);try{return await _0x14a785[_0xdefd79(0xaa)][_0xdefd79(0x14e)](_0x44781c);}catch(_0x250404){return logger['debug']('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x44781c+':\x20'+_0x250404),null;}}}function recoverSegmentIdsFromPushRecovery(_0x41a812,_0x3d3f21,_0x2c0b4b){const _0x42c9e9=a142_0x2ccdb5,_0x42cb49=readPushRecovery(_0x41a812['absolutePath']);if(_0x42cb49?.[_0x42c9e9(0x179)]===_0x41a812[_0x42c9e9(0x11e)][_0x42c9e9(0xed)])for(const [_0x10184c,_0x3d05dd]of Object['entries'](_0x42cb49[_0x42c9e9(0xde)])){const _0x4f7ae8=generateDeterministicJourneySegmentName(_0x41a812[_0x42c9e9(0x11e)][_0x42c9e9(0xed)],_0x10184c);_0x3d05dd[_0x42c9e9(0x138)]===_0x4f7ae8&&(_0x3d3f21[_0x42c9e9(0xb4)](_0x10184c,_0x3d05dd[_0x42c9e9(0x112)]),_0x2c0b4b[_0x42c9e9(0xb4)](_0x10184c,_0x3d05dd[_0x42c9e9(0x112)]));}}async function createOrRecoverEmbeddedSegment(_0x196dd3,_0x4e35b5,_0x374ebe,_0x5da0f7){const _0x399806=a142_0x2ccdb5;let _0x306f9e;try{_0x306f9e=await _0x196dd3[_0x399806(0xaa)][_0x399806(0xbc)]({'name':_0x374ebe[_0x399806(0x13e)],'description':_0x374ebe[_0x399806(0x10d)],'journeyId':_0x374ebe[_0x399806(0xe8)],'rule':_0x5da0f7(_0x374ebe[_0x399806(0x177)],!![]),'countPopulation':!![],'parentFolderId':_0x374ebe[_0x399806(0xa6)],'audienceId':_0x374ebe['parentId']});}catch(_0x3ef711){const _0x45ae00=_0x3ef711 instanceof Error&&_0x3ef711['message'][_0x399806(0xbb)]('Name\x20has\x20already\x20been\x20taken');if(_0x45ae00){const _0x56fb03=readPushRecovery(_0x4e35b5[_0x399806(0x14b)]),_0x49b188=_0x56fb03?.[_0x399806(0x179)]===_0x4e35b5['yamlConfig'][_0x399806(0xed)]?_0x56fb03[_0x399806(0xde)][_0x374ebe[_0x399806(0xfd)]]:undefined;if(_0x49b188?.[_0x399806(0x138)]===_0x374ebe[_0x399806(0x13e)])await _0x196dd3[_0x399806(0xaa)][_0x399806(0x117)](_0x374ebe[_0x399806(0x16f)],_0x49b188[_0x399806(0x112)],{'description':_0x374ebe[_0x399806(0x10d)],'rule':_0x5da0f7(_0x374ebe[_0x399806(0x177)],!![]),'countPopulation':!![]}),_0x306f9e=_0x49b188[_0x399806(0x112)];else throw new SDKError(ErrorCode[_0x399806(0x10b)],'Embedded\x20segment\x20\x27'+_0x374ebe[_0x399806(0xfd)]+_0x399806(0x133)+(_0x399806(0x17b)+_0x4e35b5[_0x399806(0x14b)][_0x399806(0x190)](/([^/]+)$/,_0x399806(0xae))+')\x20')+_0x399806(0x163),_0x3ef711);}else throw _0x3ef711;}return saveSegmentToPushRecovery(_0x4e35b5['absolutePath'],_0x4e35b5[_0x399806(0x11e)][_0x399806(0xed)],_0x374ebe[_0x399806(0xfd)],{'segmentId':_0x306f9e,'uniqueServerName':_0x374ebe['uniqueSegmentName'],'createdAt':new Date()[_0x399806(0x111)]()}),_0x306f9e;}export async function prepareSegmentFiles(_0x543ab6,_0x4170e1,_0x8f5bc1,_0x133240,_0x565598){const _0x18e29f=a142_0x2ccdb5,{activationDefToCreateRequest:_0x1ebbf4}=await import('./child-segment-yaml.js'),_0x15aeb4=[],_0x2864b7=new Set();for(const {yamlConfig:_0x29b541,folderPath:_0x404b59,sourcePath:_0x3ed0e9}of _0x543ab6){const _0x221dc9=resolveTDFolderPath(_0x404b59,_0x133240,_0x565598),_0x332d89=_0x221dc9+':'+_0x29b541['name'],_0x4605f6=_0x4170e1[_0x18e29f(0x18c)][_0x18e29f(0x185)](_0x332d89),_0x464cc8=_0x4605f6?_0x4170e1[_0x18e29f(0x160)][_0x18e29f(0x185)](_0x4605f6['id'])||[]:[];addFoldersToCreate(_0x221dc9,_0x4170e1[_0x18e29f(0x140)],_0x2864b7);const _0x27c816=calculateActivationActions(_0x29b541['activations']||[],_0x464cc8,_0x4170e1[_0x18e29f(0x192)],_0x4170e1['connectionIdToNameMap']);for(const _0x38acd1 of _0x27c816){(_0x38acd1[_0x18e29f(0xf7)]==='create'||_0x38acd1['type']===_0x18e29f(0xc0))&&_0x38acd1[_0x18e29f(0x161)]&&(_0x38acd1[_0x18e29f(0x165)]=await _0x1ebbf4(_0x38acd1['yamlActivation'],_0x8f5bc1));}const _0x2b1c75=calculateSegmentDiff(_0x29b541,_0x4605f6,_0x464cc8,_0x4170e1[_0x18e29f(0x192)],_0x4170e1[_0x18e29f(0xb0)]);_0x15aeb4[_0x18e29f(0x14a)]({'relativePath':_0x29b541[_0x18e29f(0xed)],'absolutePath':_0x3ed0e9,'yamlConfig':_0x29b541,'folderPath':_0x221dc9,'existingSegment':_0x4605f6,'existingActivations':_0x464cc8,'isNew':_0x2b1c75[_0x18e29f(0xd7)],'hasChanges':_0x2b1c75['hasChanges'],'diff':_0x2b1c75[_0x18e29f(0xc1)],'activationActions':_0x27c816});}return{'segmentFiles':_0x15aeb4,'foldersToCreate':_0x2864b7};}export async function prepareJourneyFiles(_0x1a45a3,_0x42e5fc,_0x2b2abb,_0x278220){const _0x223927=a142_0x2ccdb5,_0x340ec7=[],_0x1fd269=new Set();for(const {yamlConfig:_0x86d2de,folderPath:_0x35066b,sourcePath:_0x2a1222}of _0x1a45a3){const _0x4d8a98=resolveTDFolderPath(_0x35066b,_0x2b2abb,_0x278220),_0x462d69=_0x4d8a98+':'+_0x86d2de['name'],_0x3838dd=_0x42e5fc[_0x223927(0x113)]['get'](_0x462d69);let _0x16bd4a,_0x505a89;if(_0x3838dd&&_0x3838dd[_0x223927(0x19d)]>0x0){const _0x4e05bc=buildLocalExpandedRuleMappings(_0x86d2de),{createYamlContext:_0x2b6483,prefetchJourneySegments:_0x40a9fd}=createPushYamlContextForBundle(_0x42e5fc[_0x223927(0x109)],_0x42e5fc['parentId'],_0x42e5fc[_0x223927(0x135)],_0x4e05bc,_0x42e5fc[_0x223927(0x192)],_0x42e5fc[_0x223927(0xb0)],_0x42e5fc[_0x223927(0x110)],_0x42e5fc[_0x223927(0x15f)]);await _0x40a9fd(_0x3838dd[_0x223927(0x122)](_0xbea250=>_0xbea250['id']));const _0x2fb278=await _0x42e5fc[_0x223927(0x109)][_0x223927(0x188)][_0x223927(0x103)](_0x3838dd[0x0][_0x223927(0xe9)]),_0xab6ae8=hasMultipleVersions(_0x86d2de),_0x520459=async _0x2a20a5=>{const _0x2d713e=_0x223927,_0x1a2e18=_0x42e5fc['journeyById']?.[_0x2d713e(0x185)](_0x2a20a5);if(_0x1a2e18)return _0x1a2e18;return _0x42e5fc[_0x2d713e(0x13d)]({'journeyId':_0x2a20a5,'journeyName':_0x86d2de[_0x2d713e(0xed)],'isMultiVersion':_0x3838dd[_0x2d713e(0x19d)]>0x1});};if(_0xab6ae8&&_0x3838dd['length']>0x1){const _0x397350=[];for(const _0x16ff41 of _0x3838dd){const _0x11f4a2=_0x16ff41[_0x223927(0x145)]||0x1;_0x42e5fc['progress']?.[_0x223927(0xc0)](_0x223927(0xc4)+_0x86d2de[_0x223927(0xed)]+'\x20v'+_0x11f4a2);const _0x534a69=await _0x520459(_0x16ff41['id']),_0x56dbc1=_0x2b6483(_0x16ff41['id']),_0x505eb9=await journeyResponseToDef(_0x534a69,_0x56dbc1);_0x397350[_0x223927(0x14a)]({'item':_0x16ff41,'yaml':_0x505eb9});}const _0x2fc6c7=buildLocalRuleToNameMappingFromJourney(_0x86d2de);_0x505a89=buildMergedJourneyDef(_0x397350,_0x2fc6c7,_0x2fb278);const _0x111cd0=Math[_0x223927(0xd0)](..._0x397350[_0x223927(0x122)](_0x1fdeb7=>_0x1fdeb7['item'][_0x223927(0x145)]||0x0)),_0x39236e=_0x3838dd['find'](_0x50ebb1=>(_0x50ebb1[_0x223927(0x145)]||0x0)===_0x111cd0);_0x39236e&&(_0x42e5fc['progress']?.[_0x223927(0xc0)](_0x223927(0xc4)+_0x86d2de['name']+'\x20v'+_0x111cd0),_0x16bd4a=await _0x520459(_0x39236e['id']));}else{const _0x449b20=_0x3838dd[_0x3838dd[_0x223927(0x19d)]-0x1];_0x42e5fc['progress']?.[_0x223927(0xc0)](_0x223927(0xc4)+_0x86d2de['name']),_0x16bd4a=await _0x520459(_0x449b20['id']);const _0x5ace31=_0x2b6483(_0x449b20['id']),_0x208790=await journeyResponseToDef(_0x16bd4a,_0x5ace31),_0x29884a=buildLocalRuleToNameMappingFromJourney(_0x86d2de);_0x505a89=buildMergedJourneyDef([{'item':_0x449b20,'yaml':_0x208790}],_0x29884a,_0x2fb278);}}addFoldersToCreate(_0x4d8a98,_0x42e5fc[_0x223927(0x140)],_0x1fd269);const _0x3ea940=calculateJourneyDiff(_0x86d2de,_0x505a89);_0x340ec7[_0x223927(0x14a)]({'relativePath':_0x86d2de['name'],'absolutePath':_0x2a1222,'yamlConfig':_0x86d2de,'folderPath':_0x4d8a98,'existingJourney':_0x16bd4a,'isNew':_0x3ea940['isNew'],'hasChanges':_0x3ea940['hasChanges'],'diff':_0x3ea940['diff']});}return{'journeyFiles':_0x340ec7,'foldersToCreate':_0x1fd269};}export function calculateActivationActions(_0x9fb89d,_0x1df68f,_0x204d34,_0x15f2db){const _0x588d9e=a142_0x2ccdb5,_0x32a236=[],_0xd5b334=new Map();for(const _0x4c8fb8 of _0x1df68f){_0xd5b334['set'](_0x4c8fb8[_0x588d9e(0xed)],_0x4c8fb8);}const _0x2c65aa=new Map();for(const _0x530704 of _0x9fb89d){_0x2c65aa[_0x588d9e(0xb4)](_0x530704[_0x588d9e(0xed)],_0x530704);}for(const _0xe28c10 of _0x9fb89d){const _0x5bff25=_0xd5b334[_0x588d9e(0x185)](_0xe28c10['name']);if(!_0x5bff25)_0x32a236[_0x588d9e(0x14a)]({'type':_0x588d9e(0xa9),'name':_0xe28c10['name'],'yamlActivation':_0xe28c10});else{const _0x49b31f=activationResponseToDef(_0x5bff25,_0x204d34,_0x15f2db),_0x4f4326=a142_0x79a98e[_0x588d9e(0x162)](_0x49b31f),_0x4c0ef6=a142_0x79a98e[_0x588d9e(0x162)](_0xe28c10);_0x4f4326!==_0x4c0ef6&&_0x32a236[_0x588d9e(0x14a)]({'type':_0x588d9e(0xc0),'name':_0xe28c10['name'],'yamlActivation':_0xe28c10,'existingActivation':_0x5bff25});}}for(const _0x5aae8d of _0x1df68f){!_0x2c65aa[_0x588d9e(0x105)](_0x5aae8d[_0x588d9e(0xed)])&&_0x32a236[_0x588d9e(0x14a)]({'type':_0x588d9e(0x114),'name':_0x5aae8d[_0x588d9e(0xed)],'existingActivation':_0x5aae8d});}return _0x32a236;}function calculateYamlDiff(_0x345e46,_0x137abe){if(_0x137abe){const _0x47103d=generateDiff(_0x137abe,_0x345e46),_0x11678a=hasChanges(_0x47103d);return{'isNew':![],'hasChanges':_0x11678a,'diff':_0x11678a?formatDiffWithColors(_0x47103d):undefined};}const _0x76de43=generateDiff('',_0x345e46);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x76de43)};}export function calculateSegmentDiff(_0x56f14d,_0x4a4328,_0x83ac99,_0x323362,_0x5210cd){const _0x4f83f7=segmentToYamlString(_0x56f14d),_0x421964=_0x4a4328?segmentToYamlString(segmentWithActivationsToYaml(_0x4a4328,_0x83ac99,undefined,_0x323362,_0x5210cd)):undefined;return calculateYamlDiff(_0x4f83f7,_0x421964);}export function calculateJourneyDiff(_0x5bf314,_0x4e9605){const _0xd58bf8=normalizeJourneyDef(_0x5bf314,_0x5bf314),_0x17f8fb=a142_0x94e2bd(_0xd58bf8),_0x46bf19=_0x4e9605?a142_0x94e2bd(normalizeJourneyDef(_0x4e9605,_0x5bf314)):undefined;return calculateYamlDiff(_0x17f8fb,_0x46bf19);}export function findSegmentsToDelete(_0x2b7183,_0x17163f,_0x51d65c,_0x4aeac6,_0x18a373){const _0x5cf217=a142_0x2ccdb5,_0x4d7a9d=new Set();for(const {yamlConfig:_0x2e5654,folderPath:_0x332dc9}of _0x17163f){_0x4d7a9d['add'](_0x332dc9+':'+_0x2e5654[_0x5cf217(0xed)]);}return _0x2b7183[_0x5cf217(0x108)](_0x20a7a1=>{const _0x13591f=_0x5cf217,_0x2fa38e=_0x20a7a1[_0x13591f(0xca)]?_0x51d65c[_0x13591f(0x185)](_0x20a7a1[_0x13591f(0xca)]['toString']())||'':'',_0xdcf2f0=_0x2fa38e+':'+_0x20a7a1[_0x13591f(0xed)];if(_0x4d7a9d[_0x13591f(0x105)](_0xdcf2f0))return![];if(_0x18a373)return _0x2fa38e===_0x4aeac6||_0x2fa38e['startsWith'](_0x4aeac6+'/');return!![];});}export function findJourneysToDelete(_0x1cd498,_0x57a213,_0x16e7b3,_0x46abdf,_0x4f06bf){const _0x493cd5=a142_0x2ccdb5,_0x2a36b6=new Set();for(const {yamlConfig:_0x4c8d47,folderPath:_0x3f7f93}of _0x57a213){_0x2a36b6[_0x493cd5(0x118)](_0x3f7f93+':'+_0x4c8d47[_0x493cd5(0xed)]);}return _0x1cd498['filter'](_0x2e5c3b=>{const _0x20bd20=_0x493cd5,_0x1bdc7d=_0x2e5c3b[_0x20bd20(0xa6)]?_0x16e7b3[_0x20bd20(0x185)](_0x2e5c3b[_0x20bd20(0xa6)])||'':'',_0x53f897=_0x1bdc7d+':'+_0x2e5c3b['journeyBundleName'];if(_0x2a36b6[_0x20bd20(0x105)](_0x53f897))return![];if(_0x4f06bf)return _0x1bdc7d===_0x46abdf||_0x1bdc7d[_0x20bd20(0x181)](_0x46abdf+'/');return!![];});}export function buildSegmentLookupMap(_0x1e6a92,_0x5900c6){const _0x9927ee=a142_0x2ccdb5,_0x11cb25=new Map();for(const _0x4f9de3 of _0x1e6a92){const _0x24d90d=_0x4f9de3[_0x9927ee(0xca)]?_0x5900c6[_0x9927ee(0x185)](_0x4f9de3[_0x9927ee(0xca)][_0x9927ee(0xa3)]())||'':'',_0x54a8ee=_0x24d90d+':'+_0x4f9de3[_0x9927ee(0xed)];_0x11cb25[_0x9927ee(0xb4)](_0x54a8ee,_0x4f9de3);}return _0x11cb25;}export function buildSegmentNameToIdMap(_0x25b953){const _0x2ca5b1=a142_0x2ccdb5,_0x41944b=new Map();for(const _0x350772 of _0x25b953){_0x41944b[_0x2ca5b1(0xb4)](_0x350772[_0x2ca5b1(0xed)],_0x350772['id']);}return _0x41944b;}export function buildJourneyBundleLookupMap(_0x40d02c,_0x35184b){const _0x5f32ca=a142_0x2ccdb5,_0x27dc60=new Map();for(const _0x1390a1 of _0x40d02c){const _0x579f15=_0x1390a1['folderId']?_0x35184b[_0x5f32ca(0x185)](_0x1390a1[_0x5f32ca(0xa6)])||'':'',_0x26fcff=_0x579f15+':'+_0x1390a1[_0x5f32ca(0xf2)];!_0x27dc60['has'](_0x26fcff)&&_0x27dc60[_0x5f32ca(0xb4)](_0x26fcff,[]),_0x27dc60['get'](_0x26fcff)[_0x5f32ca(0x14a)](_0x1390a1);}for(const _0x411a20 of _0x27dc60[_0x5f32ca(0xe5)]()){_0x411a20[_0x5f32ca(0x18b)]((_0x5dba9c,_0x2c236b)=>(_0x5dba9c[_0x5f32ca(0x145)]||0x0)-(_0x2c236b[_0x5f32ca(0x145)]||0x0));}return _0x27dc60;}export function collectFoldersToCreate(_0xb297a6,_0x3497c8){const _0x1a41d5=a142_0x2ccdb5,_0x2813b2=new Set();for(const _0x715361 of _0xb297a6){if(!_0x715361)continue;if(_0x3497c8[_0x1a41d5(0x105)](_0x715361))continue;const _0x2fac1c=_0x715361[_0x1a41d5(0xbd)]('/');let _0x14d571='';for(const _0x151602 of _0x2fac1c){_0x14d571=_0x14d571?_0x14d571+'/'+_0x151602:_0x151602,!_0x3497c8[_0x1a41d5(0x105)](_0x14d571)&&_0x2813b2['add'](_0x14d571);}}return _0x2813b2;}export function parseAndClassifyYamlFiles(_0x1cf621,_0x29349e,_0x48b266){const _0x312154=a142_0x2ccdb5,_0x2eff16=[],_0x3e3cf1=[];for(const _0x1523e4 of _0x1cf621){const _0x38aeef=a142_0x232f03['relative'](_0x29349e,a142_0x232f03[_0x312154(0xf3)](_0x1523e4)),_0x392d84=_0x38aeef==='.'?'':_0x38aeef,_0x5358b3=readFileSync(_0x1523e4,_0x312154(0x15e)),_0x2b1020=a142_0x79a98e['parse'](_0x5358b3);if(isJourneyDef(_0x2b1020)){const _0x2bf6eb=a142_0x401a86(_0x5358b3);_0x3e3cf1[_0x312154(0x14a)]({'yamlConfig':_0x2bf6eb,'folderPath':_0x392d84,'sourcePath':_0x1523e4});}else{if(!_0x48b266?.['skipSegments']){const _0x2c8d7a=parseSegmentYamlFile(_0x5358b3),_0x50f387=normalizeChildSegmentYaml(_0x2c8d7a);_0x2eff16['push']({'yamlConfig':_0x50f387,'folderPath':_0x392d84,'sourcePath':_0x1523e4});}}}return{'segments':_0x2eff16,'journeys':_0x3e3cf1};}export function validateParsedFiles(_0x44ccd3,_0x5975e8){const _0x3a6617=a142_0x2ccdb5,_0x14b0bb=[];for(const {yamlConfig:_0x513dfa,sourcePath:_0x4d2b2b}of _0x44ccd3[_0x3a6617(0xde)]){const _0x5b19fc=readFileSync(_0x4d2b2b,_0x3a6617(0x15e)),_0x5636c9=a142_0x79a98e[_0x3a6617(0xfe)](_0x5b19fc),_0x5780a4=validateSegmentDef(_0x513dfa,{'source':_0x5b19fc,'document':_0x5636c9},{'skipSchema':!![]});if(!_0x5780a4['valid']){const _0x4022f0=a142_0x232f03['relative'](_0x5975e8,_0x4d2b2b);_0x14b0bb[_0x3a6617(0x14a)]({'filePath':_0x4022f0,'source':_0x5b19fc,'result':_0x5780a4,'isJourney':![]});}}for(const {yamlConfig:_0x1e2131,sourcePath:_0x273f80}of _0x44ccd3['journeys']){const _0x1601f=readFileSync(_0x273f80,'utf-8'),_0x5e5335=a142_0x79a98e[_0x3a6617(0xfe)](_0x1601f),_0x320b48=validateJourneyDef(_0x1e2131,{'source':_0x1601f,'document':_0x5e5335},{'skipSchema':!![]});if(!_0x320b48[_0x3a6617(0x12a)]){const _0xd2d024=a142_0x232f03[_0x3a6617(0x131)](_0x5975e8,_0x273f80);_0x14b0bb[_0x3a6617(0x14a)]({'filePath':_0xd2d024,'source':_0x1601f,'result':_0x320b48,'isJourney':!![]});}}return _0x14b0bb;}export function formatValidationErrors(_0xdfab6f){const _0x401a91=a142_0x2ccdb5,_0x57475f=[];for(const {filePath:_0x3745bc,source:_0x42f2a1,result:_0x9e683a,isJourney:_0x15d991}of _0xdfab6f){const _0x43f785=_0x15d991?_0x401a91(0x188):'segment';_0x57475f[_0x401a91(0x14a)]('\x0a'+_0x3745bc+'\x20('+_0x43f785+'):\x20'+_0x9e683a['errors'][_0x401a91(0x19d)]+_0x401a91(0x19b)),_0x57475f[_0x401a91(0x14a)](formatValidationResult(_0x9e683a,_0x42f2a1,_0x3745bc));}return _0x57475f[_0x401a91(0xb3)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x56654d){const _0x594a2d=a142_0x2ccdb5,_0x465f1c=new Set(),_0x61efff=new Map(),_0x13c3d1=collectSegmentUsageCounts(_0x56654d);if(_0x56654d[_0x594a2d(0xde)])for(const [_0x5e34c9,_0x598808]of Object['entries'](_0x56654d[_0x594a2d(0xde)])){_0x465f1c['add'](_0x5e34c9);if(_0x598808[_0x594a2d(0x193)]){const _0x46faaa=yamlRuleToApi(_0x598808[_0x594a2d(0x193)]),_0x47b5b7=apiRuleToYaml(_0x46faaa);_0x61efff[_0x594a2d(0xb4)](_0x5e34c9,_0x47b5b7);}}const _0x5f06dc=new Map();let _0x1f6311=0x0;for(const [_0x2b37ef,_0xb7fb9d]of _0x61efff){const _0x53454b=serializeExpandedRule(_0xb7fb9d,_0x61efff),_0x336b92=_0x5f06dc[_0x594a2d(0x185)](_0x53454b)||[];_0x336b92[_0x594a2d(0x14a)]({'name':_0x2b37ef,'index':_0x1f6311}),_0x5f06dc['set'](_0x53454b,_0x336b92),_0x1f6311++;}const _0x2b1fd0=new Map();for(const [_0x49c7a8,_0x3cd95c]of _0x5f06dc){const _0x1ffd74=_0x3cd95c[_0x594a2d(0xb7)]()['sort']((_0x472732,_0x5787ad)=>{const _0x37d7aa=_0x594a2d,_0x46d092=_0x13c3d1[_0x37d7aa(0x185)](_0x472732['name'])||0x0,_0x442823=_0x13c3d1[_0x37d7aa(0x185)](_0x5787ad[_0x37d7aa(0xed)])||0x0;if(_0x46d092!==_0x442823)return _0x442823-_0x46d092;return _0x472732[_0x37d7aa(0xcd)]-_0x5787ad[_0x37d7aa(0xcd)];})[_0x594a2d(0x122)](_0x44374f=>_0x44374f[_0x594a2d(0xed)]),_0x35ca66=[];for(const _0x15bfba of _0x1ffd74){const _0x28955a=_0x13c3d1['get'](_0x15bfba)||0x0,_0x1e527b=Math['max'](_0x28955a,0x1);for(let _0x2ff88b=0x0;_0x2ff88b<_0x1e527b;_0x2ff88b++){_0x35ca66['push'](_0x15bfba);}}_0x2b1fd0[_0x594a2d(0xb4)](_0x49c7a8,_0x35ca66);}return{'existingLocalSegmentNames':_0x465f1c,'localSegmentRules':_0x61efff,'localExpandedRuleToNames':_0x2b1fd0};}export function createSegmentIdResolver(_0x447db3,_0x37a570){return async _0x1a4623=>{const _0x11a085=a142_0x48cb,_0x27111a=_0x447db3[_0x11a085(0x185)](_0x1a4623);if(!_0x27111a)throw new SDKError(ErrorCode[_0x11a085(0x155)],'Segment\x20not\x20found:\x20'+_0x1a4623+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x37a570+'\x27)');return _0x27111a;};}export function extractRootFolderId(_0x146327){const _0x2fa0fe=a142_0x2ccdb5;return _0x146327[_0x2fa0fe(0x198)]?.['parentSegmentFolder']?.[_0x2fa0fe(0xfa)]?.['id']||_0x146327[_0x2fa0fe(0x198)]?.[_0x2fa0fe(0xfb)]?.['data']?.['id'];}export function buildConnectionMaps(_0x3ace90){const _0x34a080=a142_0x2ccdb5,_0x4279d2=new Map(),_0x54c913=new Map(),_0x98619f=new Map();for(const _0x4d1432 of _0x3ace90){_0x4279d2[_0x34a080(0xb4)](_0x4d1432[_0x34a080(0xed)],parseInt(_0x4d1432['id'],0xa)),_0x54c913[_0x34a080(0xb4)](_0x4d1432['id'],_0x4d1432[_0x34a080(0xed)]),_0x98619f[_0x34a080(0xb4)](_0x4d1432['name'],_0x4d1432[_0x34a080(0xf7)]);}return{'nameToId':_0x4279d2,'idToName':_0x54c913,'nameToType':_0x98619f};}export function calculatePushStats(_0x238579,_0xb8e5db,_0x548a34,_0x5d1673,_0x348c3e,_0x10bf79,_0xd428de){const _0x249431=a142_0x2ccdb5,_0x3e74af=_0x238579[_0x249431(0x108)](_0x380020=>_0x380020['isNew']),_0x312ac2=_0x238579[_0x249431(0x108)](_0x55c5c4=>!_0x55c5c4[_0x249431(0xd7)]&&_0x55c5c4[_0x249431(0xea)]),_0x483bd9=_0x238579[_0x249431(0x108)](_0x269e19=>!_0x269e19[_0x249431(0xd7)]&&!_0x269e19['hasChanges']),_0x49ebd4=_0x10bf79?_0x5d1673:[],_0x4ca0=_0xb8e5db[_0x249431(0x108)](_0x1215f8=>_0x1215f8[_0x249431(0xd7)]),_0x3b8210=_0xb8e5db[_0x249431(0x108)](_0xaf46f1=>!_0xaf46f1[_0x249431(0xd7)]&&_0xaf46f1['hasChanges']),_0x50f741=_0xb8e5db[_0x249431(0x108)](_0x5bc4c0=>!_0x5bc4c0['isNew']&&!_0x5bc4c0[_0x249431(0xea)]),_0x12ed6b=_0x10bf79?_0x348c3e:[],_0x5b7fce=_0x238579[_0x249431(0xc2)](_0x16eef7=>_0x16eef7[_0x249431(0x115)]),_0x44abaa=_0x5b7fce[_0x249431(0x108)](_0x17f334=>_0x17f334[_0x249431(0xf7)]===_0x249431(0xa9)),_0x192824=_0x5b7fce['filter'](_0x5b49a6=>_0x5b49a6[_0x249431(0xf7)]===_0x249431(0xc0)),_0x2166fe=_0x5b7fce[_0x249431(0x108)](_0x333afa=>_0x333afa[_0x249431(0xf7)]===_0x249431(0x114)),_0x36aaca=Array[_0x249431(0xcb)](_0x548a34)[_0x249431(0x18b)](),_0x45231b=_0xd428de?![]:_0x3e74af[_0x249431(0x19d)]>0x0||_0x312ac2['length']>0x0||_0x49ebd4['length']>0x0,_0x562124=_0x4ca0['length']>0x0||_0x3b8210[_0x249431(0x19d)]>0x0||_0x12ed6b[_0x249431(0x19d)]>0x0,_0x6223b5=_0xd428de?![]:_0x5b7fce[_0x249431(0x19d)]>0x0,_0x33f266=_0x36aaca['length']>0x0;return{'segments':{'new':_0x3e74af,'changed':_0x312ac2,'unchanged':_0x483bd9,'toDelete':_0x49ebd4},'journeys':{'new':_0x4ca0,'changed':_0x3b8210,'unchanged':_0x50f741,'toDelete':_0x12ed6b},'activations':{'all':_0x5b7fce,'toCreate':_0x44abaa,'toUpdate':_0x192824,'toDelete':_0x2166fe},'folders':{'toCreate':_0x36aaca},'counts':{'segments':{'new':_0x3e74af[_0x249431(0x19d)],'changed':_0x312ac2[_0x249431(0x19d)],'unchanged':_0x483bd9['length'],'toDelete':_0x49ebd4[_0x249431(0x19d)]},'journeys':{'new':_0x4ca0[_0x249431(0x19d)],'changed':_0x3b8210[_0x249431(0x19d)],'unchanged':_0x50f741[_0x249431(0x19d)],'toDelete':_0x12ed6b['length']},'activations':{'create':_0x44abaa[_0x249431(0x19d)],'update':_0x192824[_0x249431(0x19d)],'delete':_0x2166fe[_0x249431(0x19d)]},'folders':_0x36aaca[_0x249431(0x19d)]},'hasChanges':_0x45231b||_0x562124||_0x6223b5||_0x33f266};}export async function buildPushExecutionContext(_0x1406f3,_0x2a5f6a,_0x381fb1,_0x3137ba,_0x3dfb3f,_0x502505){const _0x29294a=a142_0x2ccdb5,_0xa71fc4=extractRootFolderId(_0x381fb1),{pathToId:_0x14559a,idToPath:_0x10b14e}=buildFolderMaps(_0x3dfb3f),_0x1357e8=buildSegmentNameToIdMap(_0x3137ba),_0x57a91a=new Map(),{batchAsync:_0x41e4ef}=await import(_0x29294a(0x15a)),[_0x5ed814,_0x2abb51]=await Promise['all']([_0x1406f3[_0x29294a(0x186)][_0x29294a(0x183)](),_0x1406f3[_0x29294a(0xaf)][_0x29294a(0x121)](),((async()=>{const _0x20fab9=_0x29294a;!_0x502505&&_0x3137ba[_0x20fab9(0x19d)]>0x0&&await _0x41e4ef(_0x3137ba,async _0x5c071c=>{const _0x55ac9e=_0x20fab9,_0x5a3e10=await _0x1406f3[_0x55ac9e(0xaa)][_0x55ac9e(0x173)](_0x2a5f6a,_0x5c071c['id']);_0x57a91a[_0x55ac9e(0xb4)](_0x5c071c['id'],_0x5a3e10);});})())]),{emailToId:_0xfee1cd,idToEmail:_0x3f9590}=_0x5ed814,_0x83fcc6=buildConnectionMaps(_0x2abb51);return{'rootFolderId':_0xa71fc4,'folderPathToId':_0x14559a,'folderIdToPath':_0x10b14e,'segmentNameToId':_0x1357e8,'activationsBySegmentId':_0x57a91a,'emailToIdMap':_0xfee1cd,'idToEmailMap':_0x3f9590,'connectionNameToIdMap':_0x83fcc6['nameToId'],'connectionIdToNameMap':_0x83fcc6[_0x29294a(0x16a)],'connectionNameToTypeMap':_0x83fcc6[_0x29294a(0xac)]};}export function createPushYamlContextForBundle(_0x504a3f,_0x283cc1,_0x107730,_0x548463,_0x16681f,_0x19336b,_0x30da38,_0x30e829){const {existingLocalSegmentNames:_0x1fc4d3,localExpandedRuleToNames:_0xb40a1d}=_0x548463,_0x4e0f34=new Set(),_0x2d0216=new Map(),_0x86b2cf=new Map(),_0x51cc94=new Map(),_0x5acfaa=createJumpTargetCache(),_0x1ba82b=new Map(),_0x36151=new Map(),_0x318850=new Set();let _0x5a2313;const _0x4fc202=_0xa44ac8=>{const _0x38f216={'resolveSegment':async _0x7565f2=>{const _0x13d75a=a142_0x48cb,_0x3774ff=_0x51cc94[_0x13d75a(0x185)](_0x7565f2);if(_0x3774ff!==undefined)return{'name':_0x3774ff,'isJourneyLocal':!![]};try{const _0x494212=await fetchSegment(_0x504a3f,_0x283cc1,_0x7565f2,_0x107730);if(!_0x494212)throw new Error(_0x13d75a(0xdb));const _0x18f905=generateJourneyLocalName(_0x494212[_0x13d75a(0xed)]),_0x110509=_0x494212[_0x13d75a(0xe1)]===SEGMENT_KIND_JOURNEY&&_0x18f905!==undefined;let _0x492f9f=_0x494212[_0x13d75a(0xed)],_0x2d17fb;if(_0x110509&&_0x494212[_0x13d75a(0x193)]){const _0x4bd203=apiRuleToYaml(_0x494212[_0x13d75a(0x193)]);_0x36151[_0x13d75a(0xb4)](_0x7565f2,_0x4bd203);const _0x33a96b=async _0x3d35dd=>{const _0x53333a=_0x13d75a,_0x493edc=collectSegmentRefsFromRule(_0x3d35dd);for(const _0xd929c3 of _0x493edc){if(!_0x36151[_0x53333a(0x105)](_0xd929c3))try{const _0x3ecfcb=await fetchSegment(_0x504a3f,_0x283cc1,_0xd929c3,_0x107730);if(_0x3ecfcb?.['rule']){const _0x515def=apiRuleToYaml(_0x3ecfcb[_0x53333a(0x193)]);_0x36151['set'](_0xd929c3,_0x515def),await _0x33a96b(_0x515def);}}catch(_0x1ae14b){logger[_0x53333a(0xe3)](_0x53333a(0xbf)+_0xd929c3+':\x20'+_0x1ae14b);}}};await _0x33a96b(_0x4bd203);const _0x52e463=serializeExpandedRule(_0x4bd203,_0x36151),_0x4fae48=_0xb40a1d[_0x13d75a(0x185)](_0x52e463);if(_0x4fae48&&_0x4fae48[_0x13d75a(0x19d)]>0x0){const _0x4e68e6=_0x2d0216['get'](_0x52e463)||0x0,_0x53f8fc=_0x4fae48[_0x4e68e6]||_0x4fae48[_0x4fae48['length']-0x1];_0x2d0216['set'](_0x52e463,_0x4e68e6+0x1),_0x492f9f=_0x53f8fc,_0x4e0f34[_0x13d75a(0x118)](_0x492f9f),_0x51cc94['set'](_0x7565f2,_0x492f9f);const _0x55f208=await resolveRuleSegmentRefs(_0x4bd203,async _0x319173=>{const _0x191165=_0x13d75a,_0x496873=_0x51cc94['get'](_0x319173);if(_0x496873)return _0x496873;const _0x4a47ac=await _0x5a2313[_0x191165(0xff)](_0x319173);return _0x4a47ac[_0x191165(0xed)];});_0x2d17fb={'description':_0x494212[_0x13d75a(0x10d)],'rule':_0x55f208};}else{const _0x2f4f2d=_0x1ba82b[_0x13d75a(0x185)](_0x52e463);if(_0x2f4f2d)_0x492f9f=_0x2f4f2d,_0x51cc94['set'](_0x7565f2,_0x492f9f);else{if(_0x18f905){let _0x38a79d=_0x18f905,_0x5a7113=0x2;while(_0x4e0f34['has'](_0x38a79d)||_0x1fc4d3[_0x13d75a(0x105)](_0x38a79d)){_0x38a79d=_0x18f905+'_'+_0x5a7113,_0x5a7113++;}_0x4e0f34['add'](_0x38a79d),_0x492f9f=_0x38a79d;}_0x51cc94[_0x13d75a(0xb4)](_0x7565f2,_0x492f9f),_0x1ba82b['set'](_0x52e463,_0x492f9f);const _0x4b1a26=await resolveRuleSegmentRefs(_0x4bd203,async _0xc8852a=>{const _0x35756b=_0x13d75a,_0x1b919b=_0x51cc94['get'](_0xc8852a);if(_0x1b919b)return _0x1b919b;const _0x4e520d=await _0x5a2313[_0x35756b(0xff)](_0xc8852a);return _0x4e520d[_0x35756b(0xed)];});_0x2d17fb={'description':_0x494212[_0x13d75a(0x10d)],'rule':_0x4b1a26};}}}return{'name':_0x492f9f,'isJourneyLocal':_0x110509,'definition':_0x2d17fb};}catch(_0x21cba6){return logger[_0x13d75a(0xe3)]('Failed\x20to\x20resolve\x20segment\x20'+_0x7565f2+':\x20'+_0x21cba6),{'name':_0x7565f2,'isJourneyLocal':![]};}},'resolveActivation':async _0x831fb3=>{const _0x2aec23=a142_0x48cb,_0x3abcfa=_0x86b2cf[_0x2aec23(0x185)](_0x831fb3);if(_0x3abcfa!==undefined)return{'name':_0x3abcfa,'isJourneyLocal':!![]};try{let _0x2ec141=_0x30da38?.[_0x2aec23(0x185)](_0x831fb3);!_0x2ec141&&(_0x2ec141=await _0x504a3f[_0x2aec23(0x188)]['getActivation'](_0xa44ac8,_0x831fb3));const _0x14ba8c=_0x2ec141[_0x2aec23(0x13b)]['activationParams'][_0x2aec23(0xed)]||_0x831fb3,_0x207733=sanitizeYamlKey(_0x14ba8c)||_0x2aec23(0x17a)+_0x831fb3,_0x51fa56=_0x207733;_0x86b2cf[_0x2aec23(0xb4)](_0x831fb3,_0x51fa56);const _0x226fe9=journeyActivationStepToYaml(_0x2ec141,_0x16681f,_0x19336b);return{'name':_0x51fa56,'isJourneyLocal':!![],'definition':_0x226fe9};}catch(_0x133f29){return logger['debug'](_0x2aec23(0x167)+_0x831fb3+':\x20'+_0x133f29),{'name':_0x831fb3,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x5705a2,_0x3af5c0)=>resolveJumpTarget(_0x5705a2,_0x3af5c0,_0x5acfaa,async _0x9023c8=>{const _0x3b093f=a142_0x48cb,_0x457b31=_0x30e829?.[_0x3b093f(0x185)](_0x9023c8);if(_0x457b31)return _0x457b31;return _0x504a3f[_0x3b093f(0x188)][_0x3b093f(0xec)](_0x9023c8);})};return _0x5a2313=_0x38f216,_0x38f216;},_0x3df1c1=async _0x16aee2=>{const _0x2ba5e4=a142_0x48cb,{collectSegmentIdsFromJourneyApi:_0x3a1729}=await import(_0x2ba5e4(0xc9)),{batchAsync:_0x15634f}=await import(_0x2ba5e4(0x15a)),_0x25d098=new Set();for(const _0x2f80ed of _0x16aee2){let _0x372ad9=_0x30e829?.[_0x2ba5e4(0x185)](_0x2f80ed);!_0x372ad9&&(_0x372ad9=await _0x504a3f['journey'][_0x2ba5e4(0xec)](_0x2f80ed));const _0x18af1a=_0x3a1729(_0x372ad9);for(const _0x1223e3 of _0x18af1a){_0x25d098['add'](_0x1223e3);}}let _0x34d2cb=Array['from'](_0x25d098);while(_0x34d2cb['length']>0x0){const _0x5b2748=_0x34d2cb[_0x2ba5e4(0x108)](_0x1c7911=>!_0x318850['has'](_0x1c7911));if(_0x5b2748[_0x2ba5e4(0x19d)]===0x0)break;const _0x11cfd6=await _0x15634f(_0x5b2748,async _0x1d20e0=>{const _0xd78dc6=_0x2ba5e4;_0x318850[_0xd78dc6(0x118)](_0x1d20e0);const _0x479c85=await fetchSegment(_0x504a3f,_0x283cc1,_0x1d20e0,_0x107730);if(!_0x479c85)return null;return{'segmentId':_0x1d20e0,'segment':_0x479c85};},0xa),_0x338032=new Set();for(const _0x4ce449 of _0x11cfd6){if(!_0x4ce449?.[_0x2ba5e4(0xaa)]?.[_0x2ba5e4(0x193)])continue;const _0x4b3210=apiRuleToYaml(_0x4ce449['segment'][_0x2ba5e4(0x193)]);_0x36151[_0x2ba5e4(0xb4)](_0x4ce449[_0x2ba5e4(0x112)],_0x4b3210);const _0x4b10f1=collectSegmentRefsFromRule(_0x4b3210);for(const _0x4fa6d5 of _0x4b10f1){!_0x318850[_0x2ba5e4(0x105)](_0x4fa6d5)&&_0x338032[_0x2ba5e4(0x118)](_0x4fa6d5);}}_0x34d2cb=Array[_0x2ba5e4(0xcb)](_0x338032);}};return{'createYamlContext':_0x4fc202,'prefetchJourneySegments':_0x3df1c1};}export async function executePushSegments(_0x3f752c,_0x3bc1d7,_0x14135d,_0x4c930f,_0xf19740){const _0x26d103=a142_0x2ccdb5,{segmentDefToCreateRequest:_0x552817,segmentDefToUpdateRequest:_0x3dc78b}=await import(_0x26d103(0x180)),_0x4b7f83=_0x14135d[_0x26d103(0x140)],_0x2e2737=0x5,_0x5b6eef=async _0x1d5546=>{const _0x278163=_0x26d103,_0x1c77d0=_0x1d5546[_0x278163(0x119)]?_0x4b7f83[_0x278163(0x185)](_0x1d5546[_0x278163(0x119)]):undefined;let _0x7e0a08;const _0x2b6375={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x5b0416=_0x1d5546[_0x278163(0x11e)];if(_0x1d5546['yamlConfig']['rule']){const _0x321a88=createSegmentIdResolver(_0x14135d[_0x278163(0x104)],_0x1d5546['yamlConfig']['name']),_0xd6bee8=await resolveRuleSegmentIds(_0x1d5546['yamlConfig'][_0x278163(0x193)],_0x321a88);_0x5b0416={..._0x1d5546['yamlConfig'],'rule':_0xd6bee8};}try{if(_0x1d5546['isNew']){_0xf19740[_0x278163(0x172)]?.({'type':'segment_creating','name':_0x1d5546[_0x278163(0x11e)]['name']});const _0x100d3f=_0x552817(_0x5b0416,_0x1c77d0),_0x4fc25b=await _0xf19740[_0x278163(0xba)](_0x278163(0x102)+_0x1d5546[_0x278163(0x11e)][_0x278163(0xed)]+'\x27...',()=>_0x3f752c[_0x278163(0xaa)][_0x278163(0x19a)](_0x4c930f[_0x278163(0x16f)],_0x100d3f));_0x7e0a08=_0x4fc25b['data']['id'],_0x14135d[_0x278163(0x104)]['set'](_0x1d5546['yamlConfig']['name'],_0x7e0a08),_0x2b6375[_0x278163(0x159)]={'name':_0x1d5546[_0x278163(0x11e)][_0x278163(0xed)],'id':_0x7e0a08},_0xf19740[_0x278163(0x172)]?.({'type':'segment_created','name':_0x1d5546[_0x278163(0x11e)][_0x278163(0xed)],'segmentId':_0x7e0a08}),_0xf19740[_0x278163(0x18e)]?.('Created\x20segment\x20\x27'+_0x1d5546[_0x278163(0x11e)][_0x278163(0xed)]+'\x27'),_0x2b6375[_0x278163(0x126)]=0x1;}else{if(_0x1d5546[_0x278163(0xea)]){_0xf19740[_0x278163(0x172)]?.({'type':_0x278163(0x194),'name':_0x1d5546[_0x278163(0x11e)][_0x278163(0xed)]});const _0x34423d=_0x3dc78b(_0x5b0416);_0x1c77d0!==_0x1d5546[_0x278163(0xd5)]?.[_0x278163(0xca)]&&(_0x34423d[_0x278163(0xca)]=_0x1c77d0?parseInt(_0x1c77d0,0xa):undefined),await _0xf19740[_0x278163(0xba)]('Updating\x20segment\x20\x27'+_0x1d5546[_0x278163(0x11e)][_0x278163(0xed)]+_0x278163(0xf0),()=>_0x3f752c['segment'][_0x278163(0x117)](_0x4c930f['parentId'],_0x1d5546[_0x278163(0xd5)]['id'],_0x34423d)),_0x7e0a08=_0x1d5546[_0x278163(0xd5)]['id'],_0xf19740['onProgress']?.({'type':'segment_updated','name':_0x1d5546[_0x278163(0x11e)][_0x278163(0xed)]}),_0xf19740[_0x278163(0x18e)]?.(_0x278163(0x17e)+_0x1d5546[_0x278163(0x11e)][_0x278163(0xed)]+'\x27'),_0x2b6375[_0x278163(0xf9)]=0x1;}else _0x7e0a08=_0x1d5546['existingSegment']['id'];}}catch(_0x38c4e0){const _0x4237ee=isHttp400Error(_0x38c4e0),_0x225d5e=_0x4237ee?ErrorCode[_0x278163(0x14f)]:ErrorCode['SEGMENT_UPDATE_ERROR'],_0x44b3da=getErrorMessage(_0x38c4e0);throw new SDKError(_0x225d5e,_0x278163(0xdc)+(_0x1d5546[_0x278163(0xd7)]?_0x278163(0xa9):_0x278163(0xc0))+'\x20segment\x20from\x20file:\x20'+_0x1d5546[_0x278163(0x14b)]+_0x278163(0x189)+_0x44b3da,_0x38c4e0);}try{const _0x218c6f=await syncActivationsForSegment(_0x3f752c,_0x4c930f[_0x278163(0x16f)],_0x7e0a08,_0x1d5546[_0x278163(0x11e)][_0x278163(0xed)],_0x1d5546['activationActions'],_0xf19740,_0x1d5546[_0x278163(0x14b)]);_0x2b6375[_0x278163(0x146)]=_0x218c6f;}catch(_0x1d0894){if(_0x1d0894 instanceof SDKError)throw _0x1d0894;throw new SDKError(ErrorCode[_0x278163(0xf4)],_0x278163(0xa2)+_0x1d5546[_0x278163(0x11e)][_0x278163(0xed)]+_0x278163(0x106)+_0x1d5546['absolutePath']+_0x278163(0x189)+getErrorMessage(_0x1d0894),_0x1d0894);}return _0x2b6375;},_0xc70c8c=await batchAsync(_0x3bc1d7,_0x5b6eef,_0x2e2737),_0x41eb24={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x2fa594 of _0xc70c8c){_0x41eb24[_0x26d103(0x126)]+=_0x2fa594[_0x26d103(0x126)],_0x41eb24[_0x26d103(0xf9)]+=_0x2fa594[_0x26d103(0xf9)],_0x2fa594[_0x26d103(0x159)]&&_0x41eb24[_0x26d103(0x11f)][_0x26d103(0xb4)](_0x2fa594['createdSegmentId'][_0x26d103(0xed)],_0x2fa594[_0x26d103(0x159)]['id']),_0x41eb24[_0x26d103(0x146)][_0x26d103(0x126)]+=_0x2fa594[_0x26d103(0x146)][_0x26d103(0x126)],_0x41eb24[_0x26d103(0x146)][_0x26d103(0xf9)]+=_0x2fa594['activations'][_0x26d103(0xf9)],_0x41eb24[_0x26d103(0x146)]['deleted']+=_0x2fa594[_0x26d103(0x146)][_0x26d103(0x141)];}return _0x41eb24;}async function syncActivationsForSegment(_0x3db0d3,_0x1fcc6f,_0x193a6b,_0x3035c9,_0x5421e4,_0x3298a7,_0x8e9833){const _0x37ca20=a142_0x2ccdb5,_0x18acfc={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x1a5549 of _0x5421e4){try{if(_0x1a5549[_0x37ca20(0xf7)]===_0x37ca20(0xa9)&&_0x1a5549[_0x37ca20(0x165)])_0x3298a7['onProgress']?.({'type':_0x37ca20(0x164),'segmentName':_0x3035c9,'activationName':_0x1a5549[_0x37ca20(0xed)]}),await _0x3298a7[_0x37ca20(0xba)]('Creating\x20activation\x20\x27'+_0x1a5549[_0x37ca20(0xed)]+_0x37ca20(0xf0),()=>_0x3db0d3[_0x37ca20(0xaa)]['createActivation'](_0x1fcc6f,_0x193a6b,_0x1a5549[_0x37ca20(0x165)])),_0x3298a7['onProgress']?.({'type':_0x37ca20(0x17f),'segmentName':_0x3035c9,'activationName':_0x1a5549[_0x37ca20(0xed)]}),_0x3298a7[_0x37ca20(0x18e)]?.(_0x37ca20(0xc7)+_0x1a5549[_0x37ca20(0xed)]+'\x27'),_0x18acfc[_0x37ca20(0x126)]++;else{if(_0x1a5549[_0x37ca20(0xf7)]===_0x37ca20(0xc0)&&_0x1a5549['validatedRequest']&&_0x1a5549[_0x37ca20(0x197)])_0x3298a7[_0x37ca20(0x172)]?.({'type':_0x37ca20(0x149),'segmentName':_0x3035c9,'activationName':_0x1a5549[_0x37ca20(0xed)]}),await _0x3298a7[_0x37ca20(0xba)]('Updating\x20activation\x20\x27'+_0x1a5549[_0x37ca20(0xed)]+_0x37ca20(0xf0),()=>_0x3db0d3[_0x37ca20(0xaa)][_0x37ca20(0x16b)](_0x1fcc6f,_0x193a6b,_0x1a5549[_0x37ca20(0x197)]['id'],_0x1a5549['validatedRequest'])),_0x3298a7[_0x37ca20(0x172)]?.({'type':_0x37ca20(0x175),'segmentName':_0x3035c9,'activationName':_0x1a5549[_0x37ca20(0xed)]}),_0x3298a7[_0x37ca20(0x18e)]?.('Updated\x20activation\x20\x27'+_0x1a5549[_0x37ca20(0xed)]+'\x27'),_0x18acfc[_0x37ca20(0xf9)]++;else _0x1a5549[_0x37ca20(0xf7)]===_0x37ca20(0x114)&&_0x1a5549[_0x37ca20(0x197)]&&(_0x3298a7[_0x37ca20(0x172)]?.({'type':_0x37ca20(0xc5),'segmentName':_0x3035c9,'activationName':_0x1a5549[_0x37ca20(0xed)]}),await _0x3298a7['withProgress'](_0x37ca20(0x166)+_0x1a5549['name']+_0x37ca20(0xf0),()=>_0x3db0d3['segment'][_0x37ca20(0x147)](_0x1fcc6f,_0x193a6b,_0x1a5549['existingActivation']['id'])),_0x3298a7[_0x37ca20(0x172)]?.({'type':_0x37ca20(0x12c),'segmentName':_0x3035c9,'activationName':_0x1a5549['name']}),_0x3298a7['logDeleted']?.(_0x37ca20(0x100)+_0x1a5549['name']+'\x27'),_0x18acfc[_0x37ca20(0x141)]++);}}catch(_0x99334c){const _0x22dfec=isHttp400Error(_0x99334c),_0x59a02f=_0x22dfec?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0x37ca20(0xf4)],_0x346bd1=getErrorMessage(_0x99334c);throw new SDKError(_0x59a02f,_0x37ca20(0xdc)+_0x1a5549[_0x37ca20(0xf7)]+_0x37ca20(0x154)+_0x1a5549[_0x37ca20(0xed)]+_0x37ca20(0x106)+_0x8e9833+_0x37ca20(0x189)+_0x346bd1,_0x99334c);}}return _0x18acfc;}export async function executePushFolders(_0x404dab,_0x5627fb,_0x53dcfe,_0x4d6d4c,_0x24bf13){const _0x29b362=a142_0x2ccdb5,_0x4d1a32=new Map(_0x53dcfe),_0x2ee878=sortFoldersByDepth(_0x5627fb);for(const _0x1451b3 of _0x2ee878){const _0x4332ac=_0x1451b3[_0x29b362(0xbd)]('/'),_0x2563d3=_0x4332ac[_0x4332ac[_0x29b362(0x19d)]-0x1],_0x5a4caf=_0x4332ac[_0x29b362(0xb7)](0x0,-0x1)[_0x29b362(0xb3)]('/'),_0x40fbac=_0x4d1a32['get'](_0x5a4caf);_0x24bf13['onProgress']?.({'type':_0x29b362(0x10a),'folder':_0x1451b3});const _0x2cbcf9={'name':_0x2563d3,'parentFolderId':_0x40fbac},_0x4eaea1=await _0x24bf13['withProgress']('Creating\x20folder\x20\x27'+_0x1451b3+_0x29b362(0xf0),()=>_0x404dab['segment'][_0x29b362(0x169)](_0x4d6d4c[_0x29b362(0x16f)],_0x2cbcf9));_0x4d1a32[_0x29b362(0xb4)](_0x1451b3,_0x4eaea1[_0x29b362(0xfa)]['id']),_0x24bf13[_0x29b362(0x172)]?.({'type':_0x29b362(0x107),'folder':_0x1451b3,'folderId':_0x4eaea1[_0x29b362(0xfa)]['id']}),_0x24bf13[_0x29b362(0x18a)]?.('Created\x20folder\x20\x27'+_0x1451b3+'\x27');}return _0x4d1a32;}export async function executePushSegmentDeletions(_0x51629f,_0x4273e2,_0x260ca2){const _0xe73fb=a142_0x2ccdb5;if(_0x4273e2[_0xe73fb(0x19d)]===0x0)return 0x0;const {batchAsync:_0x48612d}=await import(_0xe73fb(0x15a)),_0xaad3a0=0x5,_0x1b761f=await _0x48612d(_0x4273e2,async _0x56bfd2=>{const _0x243569=_0xe73fb;return _0x260ca2['onProgress']?.({'type':_0x243569(0x13f),'name':_0x56bfd2[_0x243569(0xed)]}),await _0x51629f[_0x243569(0xaa)][_0x243569(0xf5)](_0x56bfd2['id']),_0x260ca2[_0x243569(0x172)]?.({'type':'segment_deleted','name':_0x56bfd2[_0x243569(0xed)]}),_0x260ca2['logDeleted']?.(_0x243569(0x168)+_0x56bfd2[_0x243569(0xed)]+'\x27'),0x1;},_0xaad3a0);return _0x1b761f[_0xe73fb(0x11b)]((_0x191c42,_0x3bc66b)=>_0x191c42+_0x3bc66b,0x0);}export async function executePushJourneys(_0x134fd0,_0x199273,_0x387204,_0x5ca7f0,_0x3293cc){const _0x59f00d=a142_0x2ccdb5,{journeyDefToRequest:_0x729ea3}=await import(_0x59f00d(0xc9)),{activationDefToCreateRequest:_0x1911bd,yamlRuleToApi:_0x41ab52,validateSegmentRule:_0x4d11d2}=await import(_0x59f00d(0x180)),_0x5d491a={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x9976f=new Map(_0x387204['segmentNameToId']),_0x19d62b=0x5;for(let _0x318d6d=0x0;_0x318d6d<_0x199273[_0x59f00d(0x19d)];_0x318d6d+=_0x19d62b){const _0x250d18=_0x199273[_0x59f00d(0xb7)](_0x318d6d,_0x318d6d+_0x19d62b),_0x1e769f=await Promise['all'](_0x250d18[_0x59f00d(0x122)](async _0x1998df=>{const _0x31cbd7=_0x59f00d;if(!_0x1998df[_0x31cbd7(0xd7)]&&!_0x1998df[_0x31cbd7(0xea)])return{'action':'unchanged','name':_0x1998df[_0x31cbd7(0x11e)][_0x31cbd7(0xed)],'journeyId':_0x1998df[_0x31cbd7(0xcc)]?.['id']};const _0x5b98bf=_0x1998df['folderPath']?_0x387204[_0x31cbd7(0x140)][_0x31cbd7(0x185)](_0x1998df[_0x31cbd7(0x119)]):undefined;_0x3293cc[_0x31cbd7(0x172)]?.({'type':_0x1998df[_0x31cbd7(0xd7)]?_0x31cbd7(0x13c):_0x31cbd7(0xb9),'name':_0x1998df[_0x31cbd7(0x11e)][_0x31cbd7(0xed)]});try{const _0x2ea198=await executeSingleJourneyPush(_0x134fd0,_0x1998df,{..._0x387204,'segmentNameToId':_0x9976f},{'parentId':_0x5ca7f0[_0x31cbd7(0x16f)],'rootFolderId':_0x5ca7f0[_0x31cbd7(0xf1)],'folderId':_0x5b98bf,'verbose':_0x5ca7f0['verbose']},_0x3293cc,{'journeyDefToRequest':_0x729ea3,'activationDefToCreateRequest':_0x1911bd,'yamlRuleToApi':_0x41ab52,'validateSegmentRule':_0x4d11d2});for(const [_0x33bda7,_0x12d4f4]of _0x2ea198[_0x31cbd7(0x10e)]){_0x9976f['set'](_0x33bda7,_0x12d4f4),_0x5d491a[_0x31cbd7(0x10e)][_0x31cbd7(0xb4)](_0x33bda7,_0x12d4f4);}if(_0x2ea198[_0x31cbd7(0x182)]===_0x31cbd7(0x126))_0x3293cc[_0x31cbd7(0x172)]?.({'type':_0x31cbd7(0x12b),'name':_0x1998df[_0x31cbd7(0x11e)]['name'],'journeyId':_0x2ea198[_0x31cbd7(0xe8)]}),_0x3293cc['logSuccess']?.(_0x31cbd7(0x191)+_0x1998df[_0x31cbd7(0x11e)][_0x31cbd7(0xed)]+'\x27'),_0x5d491a[_0x31cbd7(0x126)]++;else _0x2ea198['action']===_0x31cbd7(0xf9)&&(_0x3293cc['onProgress']?.({'type':'journey_updated','name':_0x1998df[_0x31cbd7(0x11e)]['name']}),_0x3293cc[_0x31cbd7(0x18e)]?.(_0x31cbd7(0x12e)+_0x1998df[_0x31cbd7(0x11e)][_0x31cbd7(0xed)]+'\x27'),_0x5d491a[_0x31cbd7(0xf9)]++);return{'action':_0x2ea198[_0x31cbd7(0x182)],'name':_0x1998df[_0x31cbd7(0x11e)][_0x31cbd7(0xed)],'journeyId':_0x2ea198[_0x31cbd7(0xe8)]};}catch(_0xf6b755){const _0x41bf1e=isHttp400Error(_0xf6b755),_0x408776=_0x41bf1e?ErrorCode[_0x31cbd7(0x15c)]:ErrorCode[_0x31cbd7(0x129)],_0xcac4b9=getErrorMessage(_0xf6b755);throw new SDKError(_0x408776,'Failed\x20to\x20'+(_0x1998df[_0x31cbd7(0xd7)]?'create':_0x31cbd7(0xc0))+_0x31cbd7(0xd1)+_0x1998df[_0x31cbd7(0x14b)]+_0x31cbd7(0x189)+_0xcac4b9,_0xf6b755);}}));_0x5d491a[_0x59f00d(0x18f)][_0x59f00d(0x14a)](..._0x1e769f);}return _0x5d491a;}async function matchExistingJourneySegments(_0xaed2fc,_0x15130a,_0x35c169,_0x581944,_0x4f7e09){const _0x3b0998=a142_0x2ccdb5;if(!_0x15130a[_0x3b0998(0xcc)]||!_0x15130a[_0x3b0998(0x11e)][_0x3b0998(0xde)])return;const _0x59b6e5=new Map(),_0x4931cd=new Set();for(const _0x771887 of Object[_0x3b0998(0x127)](_0x15130a[_0x3b0998(0x11e)]['segments'])){const _0x28c430=generateDeterministicJourneySegmentName(_0x15130a['yamlConfig']['name'],_0x771887);_0x59b6e5[_0x3b0998(0xb4)](_0x28c430,_0x771887),_0x4931cd['add'](_0x771887);}const _0x963894=[],_0x217b33=collectSegmentIdsFromJourneyApi(_0x15130a[_0x3b0998(0xcc)]);for(const _0x20cac9 of _0x217b33){const _0x24e4b4=await fetchSegment(_0xaed2fc,_0x35c169,_0x20cac9,_0x581944);if(!_0x24e4b4?.['name'])continue;const _0x514730=_0x59b6e5[_0x3b0998(0x185)](_0x24e4b4[_0x3b0998(0xed)]);_0x514730?(_0x4f7e09['set'](_0x514730,_0x20cac9),_0x4931cd[_0x3b0998(0x114)](_0x514730)):_0x963894['push']({'id':_0x20cac9,'seg':_0x24e4b4});}if(_0x4931cd[_0x3b0998(0xd9)]>0x0&&_0x963894[_0x3b0998(0x19d)]>0x0){const {localExpandedRuleToNames:_0x17daeb}=buildLocalExpandedRuleMappings(_0x15130a[_0x3b0998(0x11e)]),_0x50beff=new Map();for(const {id:_0x556b56,seg:_0x14fbd4}of _0x963894){if(_0x14fbd4[_0x3b0998(0x193)]){const _0x1e75d5=apiRuleToYaml(_0x14fbd4[_0x3b0998(0x193)]);_0x50beff[_0x3b0998(0xb4)](_0x556b56,_0x1e75d5);}}for(const {id:_0x3a5e47,seg:_0x7ac8de}of _0x963894){if(!_0x7ac8de['rule'])continue;const _0x14c93c=_0x50beff[_0x3b0998(0x185)](_0x3a5e47);if(!_0x14c93c)continue;const _0x238b2b=serializeExpandedRule(_0x14c93c,_0x50beff),_0x4a2bfa=_0x17daeb[_0x3b0998(0x185)](_0x238b2b);if(_0x4a2bfa){const _0x17fc1f=_0x4a2bfa[_0x3b0998(0x17d)](_0x3c171e=>_0x4931cd[_0x3b0998(0x105)](_0x3c171e));_0x17fc1f&&(_0x4f7e09[_0x3b0998(0xb4)](_0x17fc1f,_0x3a5e47),_0x4931cd[_0x3b0998(0x114)](_0x17fc1f),logger[_0x3b0998(0xe3)]('Matched\x20server\x20segment\x20\x27'+_0x7ac8de[_0x3b0998(0xed)]+_0x3b0998(0xe6)+_0x17fc1f+_0x3b0998(0xe0)));}}}}async function executeSingleJourneyPush(_0x1ce689,_0x326089,_0x4eea23,_0x19e553,_0xe133b9,_0x19ff29){const _0x2372da=a142_0x2ccdb5,{journeyDefToRequest:_0xef77c4,activationDefToCreateRequest:_0x138dc4,yamlRuleToApi:_0x48f44d,validateSegmentRule:_0x560d40}=_0x19ff29,_0x35a7e9=new Map(),_0x33cff4=new Map();recoverSegmentIdsFromPushRecovery(_0x326089,_0x35a7e9,_0x4eea23[_0x2372da(0x104)]);const _0x42fcaf=new Map(),_0x264490=new Map(),_0x57e62f=new Map();let _0x38ec5b;const _0x5a6b6e=async()=>{const _0x52e56b=_0x2372da;if(_0x38ec5b)return;_0x38ec5b=new Map();if(!_0x326089[_0x52e56b(0xcc)])return;const _0x6ba8ba=await _0x1ce689[_0x52e56b(0x188)][_0x52e56b(0x173)](_0x326089[_0x52e56b(0xcc)]['id']);for(const _0x2f58a7 of _0x6ba8ba){const _0xa7c322=journeyActivationStepToYaml(_0x2f58a7,_0x4eea23[_0x52e56b(0x192)],_0x4eea23['connectionIdToNameMap']),_0x36764a=activationSignature(_0xa7c322);!_0x38ec5b[_0x52e56b(0x105)](_0x36764a)&&_0x38ec5b['set'](_0x36764a,_0x2f58a7['id']),_0xa7c322[_0x52e56b(0xed)]&&_0x33cff4[_0x52e56b(0xb4)](_0xa7c322[_0x52e56b(0xed)],_0x2f58a7['id']);}};await matchExistingJourneySegments(_0x1ce689,_0x326089,_0x19e553[_0x2372da(0x16f)],_0x4eea23['existingSegments'],_0x4eea23[_0x2372da(0x104)]);const _0x3c30ff={'resolveSegmentId':async _0x326e2b=>{const _0x5a2f4f=_0x2372da,_0x455286=_0x4eea23[_0x5a2f4f(0x104)]['get'](_0x326e2b);if(!_0x455286)throw new SDKError(ErrorCode[_0x5a2f4f(0x155)],_0x5a2f4f(0xd3)+_0x326e2b+'\x20(referenced\x20in\x20journey\x20'+_0x326089['yamlConfig'][_0x5a2f4f(0xed)]+')');return _0x455286;},'resolveEmbeddedSegmentId':async(_0x14f5a1,_0x5e1df3)=>{const _0x280260=_0x2372da,_0x1185ba=_0x4eea23[_0x280260(0x104)][_0x280260(0x185)](_0x14f5a1);if(_0x1185ba)return _0x1185ba;const _0x1e469a=_0x4eea23['existingSegments']['find'](_0x13b423=>_0x13b423[_0x280260(0xed)]===_0x14f5a1);if(_0x1e469a)return _0x4eea23[_0x280260(0x104)][_0x280260(0xb4)](_0x14f5a1,_0x1e469a['id']),_0x1e469a['id'];if(_0x326089[_0x280260(0xd7)]){const {stageName:_0x1f2339,criteriaName:_0x2a1522}=findSegmentCriteriaLocation(_0x326089['yamlConfig'],_0x14f5a1);return _0x560d40(_0x14f5a1,_0x5e1df3['rule']),_0x264490[_0x280260(0xb4)](_0x14f5a1,{'definition':_0x5e1df3,'stageName':_0x1f2339,'criteriaName':_0x2a1522}),createPendingSegmentId(_0x14f5a1);}const _0x2cb827=_0x326089[_0x280260(0xcc)]?.['id'];if(!_0x2cb827)throw new SDKError(ErrorCode[_0x280260(0xfc)],_0x280260(0xd8));const _0x6b98ae=_0x42fcaf['get'](_0x14f5a1);if(_0x6b98ae)return _0x6b98ae;const _0x1f3960=((async()=>{const _0x4eef2f=_0x280260;_0x560d40(_0x14f5a1,_0x5e1df3[_0x4eef2f(0x193)]);const _0x4c4920=generateDeterministicJourneySegmentName(_0x326089[_0x4eef2f(0x11e)]['name'],_0x14f5a1),_0x124cab=_0x4eea23[_0x4eef2f(0x135)][_0x4eef2f(0x17d)](_0x37c601=>_0x37c601[_0x4eef2f(0xed)]===_0x4c4920),_0x4c5609=createSegmentIdResolver(_0x4eea23['segmentNameToId'],_0x14f5a1),_0x218152=await resolveRuleSegmentIds(_0x5e1df3[_0x4eef2f(0x193)],_0x4c5609);let _0x5875de;return _0x124cab?(await _0x1ce689['segment'][_0x4eef2f(0x117)](_0x19e553[_0x4eef2f(0x16f)],_0x124cab['id'],{'description':_0x5e1df3['description']||_0x4eef2f(0x11c)+_0x14f5a1,'rule':_0x48f44d(_0x218152,!![]),'countPopulation':!![]}),_0x5875de=_0x124cab['id'],saveSegmentToPushRecovery(_0x326089[_0x4eef2f(0x14b)],_0x326089[_0x4eef2f(0x11e)]['name'],_0x14f5a1,{'segmentId':_0x5875de,'uniqueServerName':_0x4c4920,'createdAt':new Date()['toISOString']()})):_0x5875de=await createOrRecoverEmbeddedSegment(_0x1ce689,_0x326089,{'localName':_0x14f5a1,'uniqueSegmentName':_0x4c4920,'description':_0x5e1df3[_0x4eef2f(0x10d)]||_0x4eef2f(0x11c)+_0x14f5a1,'journeyId':_0x2cb827,'resolvedRule':_0x218152,'parentId':_0x19e553[_0x4eef2f(0x16f)],'folderId':_0x19e553[_0x4eef2f(0xf1)]||''},_0x48f44d),_0x4eea23[_0x4eef2f(0x104)][_0x4eef2f(0xb4)](_0x14f5a1,_0x5875de),_0x35a7e9['set'](_0x14f5a1,_0x5875de),_0x5875de;})());_0x42fcaf[_0x280260(0xb4)](_0x14f5a1,_0x1f3960);try{return await _0x1f3960;}finally{_0x42fcaf[_0x280260(0x114)](_0x14f5a1);}},'resolveActivationId':async _0x17ef5b=>{const _0x228715=_0x2372da,_0x554cfc=_0x33cff4[_0x228715(0x185)](_0x17ef5b);if(_0x554cfc)return _0x554cfc;if(_0x326089[_0x228715(0xcc)]){await _0x5a6b6e();const _0x38ea2b=_0x33cff4[_0x228715(0x185)](_0x17ef5b);if(_0x38ea2b)return _0x38ea2b;}throw new SDKError(ErrorCode[_0x228715(0xb2)],_0x228715(0x101)+_0x17ef5b+'\x20(referenced\x20in\x20journey\x20'+_0x326089[_0x228715(0x11e)][_0x228715(0xed)]+_0x228715(0x16c)+_0x228715(0x12d));},'resolveEmbeddedActivationId':async(_0x292818,_0x2cdaa5)=>{const _0x1a83a1=_0x2372da,_0x1487df=_0x33cff4[_0x1a83a1(0x185)](_0x292818);if(_0x1487df)return _0x1487df;if(_0x326089[_0x1a83a1(0xd7)])return _0x57e62f[_0x1a83a1(0xb4)](_0x292818,_0x2cdaa5),createPendingActivationId(_0x292818);if(_0x326089[_0x1a83a1(0xcc)]){await _0x5a6b6e();const _0x464984=_0x33cff4[_0x1a83a1(0x185)](_0x2cdaa5[_0x1a83a1(0xed)]);if(_0x464984)return _0x33cff4['set'](_0x292818,_0x464984),_0x464984;const _0x134bdd=activationSignature(_0x2cdaa5),_0x31fa6f=_0x38ec5b?.[_0x1a83a1(0x185)](_0x134bdd);if(_0x31fa6f)return _0x33cff4[_0x1a83a1(0xb4)](_0x292818,_0x31fa6f),_0x31fa6f;const _0x39336b=await _0x138dc4(_0x2cdaa5,_0x4eea23[_0x1a83a1(0x10f)]),_0x24276d={..._0x39336b,..._0x2cdaa5['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x2cdaa5[_0x1a83a1(0xe2)]}},_0x202913=await _0x1ce689[_0x1a83a1(0x188)][_0x1a83a1(0x152)](_0x326089[_0x1a83a1(0xcc)]['id'],_0x24276d);return _0x33cff4[_0x1a83a1(0xb4)](_0x292818,_0x202913['id']),_0x202913['id'];}throw new SDKError(ErrorCode[_0x1a83a1(0xfc)],_0x1a83a1(0x12f));},'resolveJourneyId':async _0x50d8aa=>{const _0x19e3b2=_0x2372da;try{return await _0x1ce689[_0x19e3b2(0x188)][_0x19e3b2(0x148)](_0x19e553[_0x19e3b2(0x16f)],_0x50d8aa);}catch(_0x5bfab1){throw new SDKError(ErrorCode['NOT_FOUND'],_0x19e3b2(0xb5)+_0x50d8aa+_0x19e3b2(0x139)+_0x326089[_0x19e3b2(0x11e)][_0x19e3b2(0xed)]+'\x27)',_0x5bfab1);}},'resolveStageId':async(_0x95b9cc,_0x4c9892)=>{const _0x3d5344=_0x2372da,_0x2b4112=await _0x1ce689[_0x3d5344(0x188)][_0x3d5344(0xec)](_0x95b9cc),_0x5adc0e=_0x2b4112[_0x3d5344(0x13b)][_0x3d5344(0x132)]['find'](_0x23b177=>_0x23b177[_0x3d5344(0xed)][_0x3d5344(0xab)]()===_0x4c9892[_0x3d5344(0xab)]());if(!_0x5adc0e?.['id'])throw new SDKError(ErrorCode[_0x3d5344(0xb2)],_0x3d5344(0xa1)+_0x4c9892+_0x3d5344(0xc6)+(_0x2b4112['attributes']['journeyBundleName']||_0x2b4112[_0x3d5344(0x13b)][_0x3d5344(0xed)])+'\x27');return _0x5adc0e['id'];}},_0x3b0d9a=await _0xef77c4(_0x326089[_0x2372da(0x11e)],_0x19e553[_0x2372da(0x16f)],_0x3c30ff),_0x13f0d5=_0x19e553[_0x2372da(0xa6)]||_0x19e553[_0x2372da(0xf1)];_0x13f0d5&&(_0x3b0d9a[_0x2372da(0x198)]={'parentFolder':{'data':{'id':_0x13f0d5,'type':_0x2372da(0xd2)}}});if(_0x326089[_0x2372da(0xd7)]){if(_0x264490['size']>0x0||_0x57e62f[_0x2372da(0xd9)]>0x0)return await executeThreeStepJourneyCreate(_0x1ce689,_0x326089,_0x3b0d9a,{'pendingEmbeddedSegments':_0x264490,'pendingEmbeddedActivations':_0x57e62f,'embeddedSegmentNameToId':_0x35a7e9,'journeyActivationNameToId':_0x33cff4},{..._0x19e553,'effectiveFolderId':_0x13f0d5},_0x4eea23,_0xe133b9,_0x19ff29);else{ensureJourneyDefaults(_0x3b0d9a['attributes']);const _0x57d860=await _0x1ce689[_0x2372da(0x188)][_0x2372da(0xa9)](_0x3b0d9a);return deletePushRecovery(_0x326089['absolutePath']),{'action':_0x2372da(0x126),'journeyId':_0x57d860['id'],'embeddedSegmentNameToId':_0x35a7e9};}}else{if(_0x326089[_0x2372da(0xea)]&&_0x326089['existingJourney']){_0x3b0d9a['id']=_0x326089['existingJourney']['id'];const _0x4abc6c=_0x3b0d9a['attributes'];_0x326089[_0x2372da(0xcc)]['attributes']?.['journeyBundleName']&&(_0x4abc6c[_0x2372da(0xf2)]=_0x326089[_0x2372da(0xcc)][_0x2372da(0x13b)][_0x2372da(0xf2)]);const _0x7f215c=_0x326089[_0x2372da(0xcc)][_0x2372da(0x13b)]?.[_0x2372da(0x132)];return _0x7f215c&&_0x3b0d9a[_0x2372da(0x13b)][_0x2372da(0x132)]&&injectExistingStageIds(_0x3b0d9a[_0x2372da(0x13b)][_0x2372da(0x132)],_0x7f215c),ensureJourneyDefaults(_0x4abc6c),await _0x1ce689['journey'][_0x2372da(0xc0)](_0x326089[_0x2372da(0xcc)]['id'],_0x3b0d9a),deletePushRecovery(_0x326089['absolutePath']),{'action':_0x2372da(0xf9),'journeyId':_0x326089[_0x2372da(0xcc)]['id'],'embeddedSegmentNameToId':_0x35a7e9};}}return deletePushRecovery(_0x326089[_0x2372da(0x14b)]),{'action':'unchanged','journeyId':_0x326089[_0x2372da(0xcc)]?.['id'],'embeddedSegmentNameToId':_0x35a7e9};}function findSegmentCriteriaLocation(_0x447467,_0x4e295f){const _0x44418b=a142_0x2ccdb5,_0x186a9b=_0x447467[_0x44418b(0x184)]||_0x447467[_0x44418b(0xee)]?.[0x0]?.[_0x44418b(0x184)]||[];let _0x4ecb01=_0x44418b(0x9e),_0x41aded=_0x4e295f;const _0x54a02b=_0x447467[_0x44418b(0xd6)]||_0x447467[_0x44418b(0xee)]?.[0x0]?.[_0x44418b(0xd6)];if(_0x54a02b?.[_0x44418b(0xaa)]===_0x4e295f)return{'stageName':_0x44418b(0xd6),'criteriaName':_0x54a02b['name']||_0x4e295f};_0x398421:for(const _0x36234b of _0x186a9b){if(_0x36234b[_0x44418b(0x116)]?.[_0x44418b(0xaa)]===_0x4e295f){_0x4ecb01=_0x36234b['name'],_0x41aded=_0x36234b[_0x44418b(0x116)][_0x44418b(0xed)]||_0x4e295f;break;}if(_0x36234b[_0x44418b(0xa5)])for(const _0x2b3eab of _0x36234b[_0x44418b(0xa5)]){if(_0x2b3eab[_0x44418b(0xf7)]===_0x44418b(0x10c)&&_0x2b3eab[_0x44418b(0xad)]?.['branches'])for(const _0x3f4d82 of _0x2b3eab[_0x44418b(0xad)][_0x44418b(0x136)]){if(_0x3f4d82[_0x44418b(0xaa)]===_0x4e295f){_0x4ecb01=_0x36234b[_0x44418b(0xed)],_0x41aded=_0x3f4d82[_0x44418b(0xed)]||_0x4e295f;break _0x398421;}}}}return{'stageName':_0x4ecb01,'criteriaName':_0x41aded};}async function executeThreeStepJourneyCreate(_0x10ab3f,_0x3fa907,_0x2b370e,_0x396acf,_0x36cdfe,_0xef70ed,_0x4fc2ab,_0x1f4eca){const _0x59c201=a142_0x2ccdb5,{activationDefToCreateRequest:_0x2e217a,yamlRuleToApi:_0xf06245}=_0x1f4eca,{pendingEmbeddedSegments:_0x381521,pendingEmbeddedActivations:_0x5831c9,embeddedSegmentNameToId:_0x35ad48}=_0x396acf,_0x373ef3=JSON[_0x59c201(0xe4)](JSON[_0x59c201(0x162)](_0x2b370e));ensureJourneyDefaults(_0x373ef3['attributes']),stripPendingIds(_0x373ef3);const _0x1f552f=await _0x10ab3f[_0x59c201(0x188)]['create'](_0x373ef3),_0x21f2d0=_0x1f552f['id'],_0x51a4e8=new Map();for(const _0x2c1451 of _0x1f552f[_0x59c201(0x13b)]['journeyStages']){_0x51a4e8[_0x59c201(0xb4)](_0x2c1451[_0x59c201(0xed)][_0x59c201(0xab)](),_0x2c1451['id']);}recoverSegmentIdsFromPushRecovery(_0x3fa907,_0x35ad48,_0xef70ed['segmentNameToId']);for(const [_0x1a51c3,{definition:_0x230156}]of _0x381521){if(_0x35ad48[_0x59c201(0x105)](_0x1a51c3)){_0x4fc2ab[_0x59c201(0x172)]?.({'type':'embedded_segment_created','journeyName':_0x3fa907[_0x59c201(0x11e)][_0x59c201(0xed)],'segmentName':_0x1a51c3});continue;}const _0x34f34f=generateDeterministicJourneySegmentName(_0x3fa907[_0x59c201(0x11e)][_0x59c201(0xed)],_0x1a51c3);_0x4fc2ab[_0x59c201(0x172)]?.({'type':'embedded_segment_creating','journeyName':_0x3fa907[_0x59c201(0x11e)][_0x59c201(0xed)],'segmentName':_0x1a51c3});const _0x51a5e1=createSegmentIdResolver(_0xef70ed[_0x59c201(0x104)],_0x1a51c3),_0x3fa508=await resolveRuleSegmentIds(_0x230156['rule'],_0x51a5e1),_0x3674a3=await createOrRecoverEmbeddedSegment(_0x10ab3f,_0x3fa907,{'localName':_0x1a51c3,'uniqueSegmentName':_0x34f34f,'description':_0x230156[_0x59c201(0x10d)]||_0x59c201(0x11c)+_0x1a51c3,'journeyId':_0x21f2d0,'resolvedRule':_0x3fa508,'parentId':_0x36cdfe[_0x59c201(0x16f)],'folderId':_0x36cdfe['effectiveFolderId']||''},_0xf06245);_0x35ad48[_0x59c201(0xb4)](_0x1a51c3,_0x3674a3),_0xef70ed[_0x59c201(0x104)][_0x59c201(0xb4)](_0x1a51c3,_0x3674a3),_0x4fc2ab[_0x59c201(0x172)]?.({'type':_0x59c201(0x19c),'journeyName':_0x3fa907[_0x59c201(0x11e)][_0x59c201(0xed)],'segmentName':_0x1a51c3});}const _0x3e5fda=new Map();for(const [_0xdd4d89,_0x4d1603]of _0x5831c9){_0x4fc2ab['onProgress']?.({'type':_0x59c201(0xb1),'journeyName':_0x3fa907[_0x59c201(0x11e)][_0x59c201(0xed)],'activationName':_0xdd4d89});const _0x4a032e=await _0x2e217a(_0x4d1603,_0xef70ed[_0x59c201(0x10f)]),_0x41fcb4={..._0x4a032e,..._0x4d1603['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x4d1603[_0x59c201(0xe2)]}},_0x1f248c=await _0x10ab3f['journey'][_0x59c201(0x152)](_0x21f2d0,_0x41fcb4);_0x3e5fda[_0x59c201(0xb4)](_0xdd4d89,_0x1f248c['id']),_0x396acf[_0x59c201(0xf8)][_0x59c201(0xb4)](_0xdd4d89,_0x1f248c['id']),_0x4fc2ab['onProgress']?.({'type':_0x59c201(0xef),'journeyName':_0x3fa907[_0x59c201(0x11e)]['name'],'activationName':_0xdd4d89});}const _0x3a299e=JSON[_0x59c201(0xe4)](JSON[_0x59c201(0x162)](_0x2b370e));return _0x3a299e['id']=_0x21f2d0,ensureJourneyDefaults(_0x3a299e[_0x59c201(0x13b)]),resolvePendingIdsInRequest(_0x3a299e,_0x2b370e,_0x51a4e8,_0x35ad48,_0x3e5fda,_0x4fc2ab),await _0x10ab3f[_0x59c201(0x188)][_0x59c201(0xc0)](_0x21f2d0,_0x3a299e),deletePushRecovery(_0x3fa907[_0x59c201(0x14b)]),{'action':_0x59c201(0x126),'journeyId':_0x21f2d0,'embeddedSegmentNameToId':_0x35ad48};}export function stripWaitStepPendingIds(_0x1a7d0c){const _0x2bbbfe=a142_0x2ccdb5,_0x144541=_0x1a7d0c[_0x2bbbfe(0x158)]&&isPendingSegmentId(_0x1a7d0c[_0x2bbbfe(0x158)]),_0x2d2854=_0x1a7d0c[_0x2bbbfe(0xf6)]?.[_0x2bbbfe(0x11a)](_0x293a1c=>_0x293a1c[_0x2bbbfe(0x112)]&&isPendingSegmentId(_0x293a1c[_0x2bbbfe(0x112)]));(_0x144541||_0x2d2854)&&(_0x1a7d0c[_0x2bbbfe(0xa0)]=_0x2bbbfe(0x170),_0x1a7d0c[_0x2bbbfe(0xc8)]=0x1,_0x1a7d0c['waitStepUnit']='day',delete _0x1a7d0c[_0x2bbbfe(0x158)],delete _0x1a7d0c[_0x2bbbfe(0xce)],delete _0x1a7d0c[_0x2bbbfe(0xa7)],delete _0x1a7d0c['conditions']);}export function resolveWaitStepPendingIds(_0xc7b3b7,_0xdae6dd,_0x132656,_0x17fe9a){const _0x217f48=a142_0x2ccdb5;if(_0xdae6dd['conditionSegmentId']&&isPendingSegmentId(_0xdae6dd[_0x217f48(0x158)])){const _0x52e870=_0x132656(_0xdae6dd[_0x217f48(0x158)],_0x217f48(0x196)+_0x17fe9a+_0x217f48(0xa4));_0x52e870&&(_0xc7b3b7[_0x217f48(0xa0)]=_0x217f48(0x137),_0xc7b3b7[_0x217f48(0x158)]=_0x52e870,delete _0xc7b3b7[_0x217f48(0xc8)],delete _0xc7b3b7['waitStepUnit'],_0xdae6dd['conditionTimeoutDuration']!==undefined&&(_0xc7b3b7[_0x217f48(0xce)]=_0xdae6dd[_0x217f48(0xce)]),_0xdae6dd[_0x217f48(0xa7)]&&(_0xc7b3b7[_0x217f48(0xa7)]=_0xdae6dd['conditionTimeoutUnit']));}if(_0xdae6dd[_0x217f48(0xf6)]){const _0x28136c=_0xdae6dd[_0x217f48(0xf6)][_0x217f48(0x11a)](_0x4921fd=>_0x4921fd[_0x217f48(0x112)]&&isPendingSegmentId(_0x4921fd[_0x217f48(0x112)]));if(_0x28136c){const _0x50e5b0=_0xdae6dd['conditions'][_0x217f48(0x122)](_0x3bf19e=>{const _0x2ae8a9=_0x217f48;if(_0x3bf19e[_0x2ae8a9(0x112)]&&isPendingSegmentId(_0x3bf19e['segmentId'])){const _0x2c6416=_0x132656(_0x3bf19e[_0x2ae8a9(0x112)],_0x2ae8a9(0x196)+_0x17fe9a+_0x2ae8a9(0xa4));return{..._0x3bf19e,'segmentId':_0x2c6416||_0x3bf19e[_0x2ae8a9(0x112)]};}return{..._0x3bf19e};});_0xc7b3b7['waitStepType']=_0x217f48(0x137),_0xc7b3b7[_0x217f48(0xf6)]=_0x50e5b0,delete _0xc7b3b7['waitStep'],delete _0xc7b3b7[_0x217f48(0xe7)],delete _0xc7b3b7[_0x217f48(0x158)],delete _0xc7b3b7[_0x217f48(0xce)],delete _0xc7b3b7[_0x217f48(0xa7)];}}}function stripPendingIds(_0x20d3e8){const _0x1aec7a=a142_0x2ccdb5;_0x20d3e8[_0x1aec7a(0x13b)][_0x1aec7a(0xd6)]?.[_0x1aec7a(0x112)]&&isPendingSegmentId(_0x20d3e8[_0x1aec7a(0x13b)][_0x1aec7a(0xd6)][_0x1aec7a(0x112)])&&delete _0x20d3e8[_0x1aec7a(0x13b)]['goal'];for(const _0x49ec9a of _0x20d3e8[_0x1aec7a(0x13b)][_0x1aec7a(0x132)]||[]){_0x49ec9a[_0x1aec7a(0x171)]?.[_0x1aec7a(0x112)]&&isPendingSegmentId(_0x49ec9a['entryCriteria'][_0x1aec7a(0x112)])&&delete _0x49ec9a[_0x1aec7a(0x171)];_0x49ec9a[_0x1aec7a(0x150)]?.[_0x1aec7a(0x112)]&&isPendingSegmentId(_0x49ec9a[_0x1aec7a(0x150)]['segmentId'])&&delete _0x49ec9a['milestone'];_0x49ec9a['exitCriterias']&&(_0x49ec9a[_0x1aec7a(0x14d)]=_0x49ec9a['exitCriterias'][_0x1aec7a(0x108)](_0x2128cc=>!_0x2128cc[_0x1aec7a(0x112)]||!isPendingSegmentId(_0x2128cc[_0x1aec7a(0x112)])));if(_0x49ec9a['steps'])for(const _0xfe088 of Object[_0x1aec7a(0x127)](_0x49ec9a['steps'])){const _0x519e22=_0x49ec9a[_0x1aec7a(0xa5)][_0xfe088];_0x519e22['type']===_0x1aec7a(0x13a)&&_0x519e22[_0x1aec7a(0xdf)]&&isPendingActivationId(_0x519e22[_0x1aec7a(0xdf)])&&(_0x519e22['journeyActivationStepId']='');if(_0x519e22[_0x1aec7a(0xf7)]===_0x1aec7a(0xc3)&&_0x519e22['branches'])for(const _0x4f737d of _0x519e22[_0x1aec7a(0x136)]){_0x4f737d[_0x1aec7a(0x112)]&&isPendingSegmentId(_0x4f737d[_0x1aec7a(0x112)])&&(_0x4f737d[_0x1aec7a(0x112)]='');}_0x519e22['type']===_0x1aec7a(0xb8)&&stripWaitStepPendingIds(_0x519e22);}}}function resolvePendingIdsInRequest(_0x5bf2c,_0x5d38f9,_0x2703a7,_0x5503f8,_0x23c4dc,_0x41357c){const _0x55cba9=a142_0x2ccdb5,_0x32f201=(_0x4adcdc,_0x4e3fc9)=>{const _0x3fbe59=a142_0x48cb;if(!isPendingSegmentId(_0x4adcdc))return _0x4adcdc;const _0x339f6e=extractPendingSegmentName(_0x4adcdc),_0x407488=_0x5503f8[_0x3fbe59(0x185)](_0x339f6e);return!_0x407488&&_0x41357c[_0x3fbe59(0x16e)]?.(_0x3fbe59(0x195)+_0x339f6e+'\x27\x20for\x20'+_0x4e3fc9),_0x407488;};if(_0x5bf2c['attributes']['goal']?.[_0x55cba9(0x112)]&&isPendingSegmentId(_0x5bf2c[_0x55cba9(0x13b)][_0x55cba9(0xd6)][_0x55cba9(0x112)])){const _0x2d4473=_0x32f201(_0x5bf2c[_0x55cba9(0x13b)][_0x55cba9(0xd6)]['segmentId'],_0x55cba9(0x120));_0x2d4473&&(_0x5bf2c['attributes'][_0x55cba9(0xd6)][_0x55cba9(0x112)]=_0x2d4473);}for(const _0x4277df of _0x5bf2c[_0x55cba9(0x13b)]['journeyStages']||[]){const _0x18817b=_0x2703a7['get'](_0x4277df[_0x55cba9(0xed)]['toLowerCase']());_0x18817b&&(_0x4277df['id']=_0x18817b);if(_0x4277df[_0x55cba9(0x171)]?.[_0x55cba9(0x112)]&&isPendingSegmentId(_0x4277df[_0x55cba9(0x171)]['segmentId'])){const _0x2ca077=_0x32f201(_0x4277df[_0x55cba9(0x171)][_0x55cba9(0x112)],_0x55cba9(0x196)+_0x4277df[_0x55cba9(0xed)]+_0x55cba9(0x9f));_0x2ca077&&(_0x4277df[_0x55cba9(0x171)]['segmentId']=_0x2ca077);}if(_0x4277df['exitCriterias'])for(const _0x3a3eff of _0x4277df[_0x55cba9(0x14d)]){if(_0x3a3eff[_0x55cba9(0x112)]&&isPendingSegmentId(_0x3a3eff[_0x55cba9(0x112)])){const _0x213969=_0x32f201(_0x3a3eff[_0x55cba9(0x112)],_0x55cba9(0x196)+_0x4277df[_0x55cba9(0xed)]+_0x55cba9(0x142));_0x213969&&(_0x3a3eff[_0x55cba9(0x112)]=_0x213969);}}if(_0x4277df[_0x55cba9(0x150)]?.[_0x55cba9(0x112)]&&isPendingSegmentId(_0x4277df['milestone']['segmentId'])){const _0x45f459=_0x32f201(_0x4277df['milestone'][_0x55cba9(0x112)],_0x55cba9(0x196)+_0x4277df['name']+_0x55cba9(0x14c));_0x45f459&&(_0x4277df[_0x55cba9(0x150)][_0x55cba9(0x112)]=_0x45f459);}if(_0x4277df[_0x55cba9(0xa5)]){const _0x19bb5a=_0x155fe9=>_0x5d38f9['attributes'][_0x55cba9(0x132)]?.['find'](_0x391d2d=>_0x391d2d[_0x55cba9(0xed)][_0x55cba9(0xab)]()===_0x4277df[_0x55cba9(0xed)]['toLowerCase']())?.['steps']?.[_0x155fe9];for(const _0x2cee54 of Object['keys'](_0x4277df['steps'])){const _0x1b62fa=_0x4277df[_0x55cba9(0xa5)][_0x2cee54],_0xec6453=_0x19bb5a(_0x2cee54);if(_0x1b62fa[_0x55cba9(0xf7)]===_0x55cba9(0x13a)&&_0x1b62fa[_0x55cba9(0xdf)]&&(isPendingActivationId(_0x1b62fa[_0x55cba9(0xdf)])||_0x1b62fa[_0x55cba9(0xdf)]==='')){if(_0xec6453?.['journeyActivationStepId']&&isPendingActivationId(_0xec6453[_0x55cba9(0xdf)])){const _0x26e0bc=extractPendingActivationName(_0xec6453[_0x55cba9(0xdf)]),_0x58fb60=_0x23c4dc[_0x55cba9(0x185)](_0x26e0bc);_0x58fb60&&(_0x1b62fa[_0x55cba9(0xdf)]=_0x58fb60);}}if(_0x1b62fa[_0x55cba9(0xf7)]===_0x55cba9(0xc3)&&_0x1b62fa[_0x55cba9(0x136)]&&_0xec6453?.[_0x55cba9(0x136)])for(let _0x371b32=0x0;_0x371b32<_0x1b62fa[_0x55cba9(0x136)][_0x55cba9(0x19d)];_0x371b32++){const _0x5409aa=_0x1b62fa[_0x55cba9(0x136)][_0x371b32],_0x119765=_0xec6453[_0x55cba9(0x136)][_0x371b32];if(_0x119765?.[_0x55cba9(0x112)]&&isPendingSegmentId(_0x119765['segmentId'])){const _0x258a23=_0x32f201(_0x119765[_0x55cba9(0x112)],'stage\x20\x27'+_0x4277df[_0x55cba9(0xed)]+_0x55cba9(0x130)+(_0x5409aa['name']||_0x371b32)+'\x27');_0x258a23&&(_0x5409aa[_0x55cba9(0x112)]=_0x258a23);}}_0x1b62fa[_0x55cba9(0xf7)]===_0x55cba9(0xb8)&&_0xec6453?.[_0x55cba9(0xf7)]===_0x55cba9(0xb8)&&resolveWaitStepPendingIds(_0x1b62fa,_0xec6453,_0x32f201,_0x4277df[_0x55cba9(0xed)]);}}}}
@@ -1 +1 @@
1
- (function(_0x58dc76,_0xf3f362){const _0x27ec8d=a143_0x2298,_0x5b12bb=_0x58dc76();while(!![]){try{const _0x31638a=-parseInt(_0x27ec8d(0xde))/0x1+parseInt(_0x27ec8d(0xd5))/0x2+-parseInt(_0x27ec8d(0xe4))/0x3+-parseInt(_0x27ec8d(0xe0))/0x4*(-parseInt(_0x27ec8d(0xdd))/0x5)+-parseInt(_0x27ec8d(0xd7))/0x6+parseInt(_0x27ec8d(0xe1))/0x7*(parseInt(_0x27ec8d(0xdc))/0x8)+-parseInt(_0x27ec8d(0xdf))/0x9*(parseInt(_0x27ec8d(0xda))/0xa);if(_0x31638a===_0xf3f362)break;else _0x5b12bb['push'](_0x5b12bb['shift']());}catch(_0x12d07e){_0x5b12bb['push'](_0x5b12bb['shift']());}}}(a143_0x555c,0x70836));export function buildFolderIdToPathMap(_0x4edab2){const _0x1684b6=new Map(),_0x30a7d6=new Map();for(const _0x4a8cbd of _0x4edab2){_0x30a7d6['set'](_0x4a8cbd['id'],_0x4a8cbd);}const _0xa7303c=new Set();for(const _0x43d883 of _0x4edab2){!_0x43d883['parentFolderId']&&_0xa7303c['add'](_0x43d883['id']);}function _0x5501c4(_0x1f92be){const _0x245960=a143_0x2298;if(_0x1684b6[_0x245960(0xd6)](_0x1f92be['id']))return _0x1684b6['get'](_0x1f92be['id']);if(_0xa7303c['has'](_0x1f92be['id']))return _0x1684b6[_0x245960(0xe3)](_0x1f92be['id'],''),'';if(_0x1f92be['parentFolderId']){const _0x63127d=_0x30a7d6['get'](_0x1f92be['parentFolderId']);if(_0x63127d){const _0x474178=_0x5501c4(_0x63127d),_0x220658=_0x474178?_0x474178+'/'+_0x1f92be[_0x245960(0xd8)]:_0x1f92be[_0x245960(0xd8)];return _0x1684b6['set'](_0x1f92be['id'],_0x220658),_0x220658;}}const _0x3fec9e=_0x1f92be[_0x245960(0xd8)];return _0x1684b6[_0x245960(0xe3)](_0x1f92be['id'],_0x3fec9e),_0x3fec9e;}for(const _0x3dab19 of _0x4edab2){_0x5501c4(_0x3dab19);}return _0x1684b6;}export function buildFolderPathToIdMap(_0x3b838c){const _0x576fb1=a143_0x2298,_0x437dbb=new Map(),_0x39aa94=new Map();for(const _0x545b86 of _0x3b838c){_0x39aa94[_0x576fb1(0xe3)](_0x545b86['id'],_0x545b86);}const _0x3c08a9=new Set();for(const _0x36b72a of _0x3b838c){!_0x36b72a[_0x576fb1(0xd9)]&&_0x3c08a9[_0x576fb1(0xe2)](_0x36b72a['id']);}function _0x2d32e5(_0x58c352){const _0x1f8e6c=_0x576fb1;if(_0x3c08a9['has'](_0x58c352['id']))return'';if(_0x58c352[_0x1f8e6c(0xd9)]){const _0xcb1d74=_0x39aa94[_0x1f8e6c(0xdb)](_0x58c352[_0x1f8e6c(0xd9)]);if(_0xcb1d74){const _0x4c6176=_0x2d32e5(_0xcb1d74);return _0x4c6176?_0x4c6176+'/'+_0x58c352[_0x1f8e6c(0xd8)]:_0x58c352[_0x1f8e6c(0xd8)];}}return _0x58c352[_0x1f8e6c(0xd8)];}for(const _0x3cb2bd of _0x3b838c){const _0x3266f3=_0x2d32e5(_0x3cb2bd);_0x437dbb[_0x576fb1(0xe3)](_0x3266f3,_0x3cb2bd['id']);}return _0x437dbb;}export function buildFolderMaps(_0x31c37a){const _0x312b5f=a143_0x2298,_0x43ae71=buildFolderIdToPathMap(_0x31c37a),_0x36e52d=new Map();for(const [_0x3e67b4,_0x3769da]of _0x43ae71){_0x36e52d[_0x312b5f(0xe3)](_0x3769da,_0x3e67b4);}return{'idToPath':_0x43ae71,'pathToId':_0x36e52d};}function a143_0x2298(_0x18733d,_0x1880f5){_0x18733d=_0x18733d-0xd5;const _0x555c78=a143_0x555c();let _0x2298a7=_0x555c78[_0x18733d];return _0x2298a7;}function a143_0x555c(){const _0x3326d8=['651425bFcLQW','45axmxNp','8FlRBUE','6003893fcMVUZ','add','set','2427999gRPAPT','1824440ERwjXD','has','1628904NLJNxB','name','parentFolderId','158410ibHsOf','get','8UEbqXL','1255955FYTHtp'];a143_0x555c=function(){return _0x3326d8;};return a143_0x555c();}export function getFolderPath(_0x47e15f,_0x17a44a){const _0x4499dc=a143_0x2298;if(!_0x47e15f)return'';return _0x17a44a[_0x4499dc(0xdb)](_0x47e15f)??'';}
1
+ (function(_0x2e74ec,_0xb16a95){const _0xaf2aa3=a143_0x38c9,_0x2ed477=_0x2e74ec();while(!![]){try{const _0x53a104=parseInt(_0xaf2aa3(0x77))/0x1+-parseInt(_0xaf2aa3(0x76))/0x2+-parseInt(_0xaf2aa3(0x74))/0x3+-parseInt(_0xaf2aa3(0x78))/0x4*(-parseInt(_0xaf2aa3(0x75))/0x5)+-parseInt(_0xaf2aa3(0x70))/0x6+-parseInt(_0xaf2aa3(0x73))/0x7+parseInt(_0xaf2aa3(0x6f))/0x8;if(_0x53a104===_0xb16a95)break;else _0x2ed477['push'](_0x2ed477['shift']());}catch(_0x245cf0){_0x2ed477['push'](_0x2ed477['shift']());}}}(a143_0x3cc9,0xd0307));export function buildFolderIdToPathMap(_0x1d1d36){const _0x1a2ad8=a143_0x38c9,_0x3663a7=new Map(),_0x153330=new Map();for(const _0xffb815 of _0x1d1d36){_0x153330[_0x1a2ad8(0x72)](_0xffb815['id'],_0xffb815);}const _0x219fdc=new Set();for(const _0x4158ed of _0x1d1d36){!_0x4158ed[_0x1a2ad8(0x71)]&&_0x219fdc[_0x1a2ad8(0x7a)](_0x4158ed['id']);}function _0x4aad0a(_0x5c6a85){const _0x41a532=_0x1a2ad8;if(_0x3663a7[_0x41a532(0x7b)](_0x5c6a85['id']))return _0x3663a7[_0x41a532(0x79)](_0x5c6a85['id']);if(_0x219fdc[_0x41a532(0x7b)](_0x5c6a85['id']))return _0x3663a7['set'](_0x5c6a85['id'],''),'';if(_0x5c6a85[_0x41a532(0x71)]){const _0x220b82=_0x153330[_0x41a532(0x79)](_0x5c6a85['parentFolderId']);if(_0x220b82){const _0x2a09ae=_0x4aad0a(_0x220b82),_0xb7c6d1=_0x2a09ae?_0x2a09ae+'/'+_0x5c6a85[_0x41a532(0x7c)]:_0x5c6a85[_0x41a532(0x7c)];return _0x3663a7[_0x41a532(0x72)](_0x5c6a85['id'],_0xb7c6d1),_0xb7c6d1;}}const _0x37f07a=_0x5c6a85[_0x41a532(0x7c)];return _0x3663a7[_0x41a532(0x72)](_0x5c6a85['id'],_0x37f07a),_0x37f07a;}for(const _0x13f14d of _0x1d1d36){_0x4aad0a(_0x13f14d);}return _0x3663a7;}export function buildFolderPathToIdMap(_0x152027){const _0x17678c=a143_0x38c9,_0x555e81=new Map(),_0x5aa9c8=new Map();for(const _0x2358a0 of _0x152027){_0x5aa9c8['set'](_0x2358a0['id'],_0x2358a0);}const _0xda0411=new Set();for(const _0x2ea97b of _0x152027){!_0x2ea97b[_0x17678c(0x71)]&&_0xda0411[_0x17678c(0x7a)](_0x2ea97b['id']);}function _0x2746d6(_0x4bf5ef){const _0x174274=_0x17678c;if(_0xda0411[_0x174274(0x7b)](_0x4bf5ef['id']))return'';if(_0x4bf5ef[_0x174274(0x71)]){const _0x4f3203=_0x5aa9c8[_0x174274(0x79)](_0x4bf5ef[_0x174274(0x71)]);if(_0x4f3203){const _0x34145a=_0x2746d6(_0x4f3203);return _0x34145a?_0x34145a+'/'+_0x4bf5ef[_0x174274(0x7c)]:_0x4bf5ef[_0x174274(0x7c)];}}return _0x4bf5ef[_0x174274(0x7c)];}for(const _0x1814b3 of _0x152027){const _0x3b7852=_0x2746d6(_0x1814b3);_0x555e81['set'](_0x3b7852,_0x1814b3['id']);}return _0x555e81;}function a143_0x38c9(_0x1c52e7,_0xcd695a){_0x1c52e7=_0x1c52e7-0x6f;const _0x3cc9fb=a143_0x3cc9();let _0x38c942=_0x3cc9fb[_0x1c52e7];return _0x38c942;}function a143_0x3cc9(){const _0xdea5=['15465968ErpPPA','5034726TWOUJH','parentFolderId','set','8414658fcZfYt','3391455DeAAij','5MYgEtT','1373330jYbjNl','1169180ADxDYL','6434728spiJSB','get','add','has','name'];a143_0x3cc9=function(){return _0xdea5;};return a143_0x3cc9();}export function buildFolderMaps(_0x2ffc1e){const _0x37946b=a143_0x38c9,_0x49cc53=buildFolderIdToPathMap(_0x2ffc1e),_0x467e58=new Map();for(const [_0x2ac615,_0x436c8]of _0x49cc53){_0x467e58[_0x37946b(0x72)](_0x436c8,_0x2ac615);}return{'idToPath':_0x49cc53,'pathToId':_0x467e58};}export function getFolderPath(_0x3e19fa,_0x3678a4){const _0x12c2f0=a143_0x38c9;if(!_0x3e19fa)return'';return _0x3678a4[_0x12c2f0(0x79)](_0x3e19fa)??'';}
@@ -1 +1 @@
1
- (function(_0x4dd94d,_0xb12f83){const _0x25b50f=a144_0x106d,_0xad60f5=_0x4dd94d();while(!![]){try{const _0xec7b9c=-parseInt(_0x25b50f(0x131))/0x1+-parseInt(_0x25b50f(0x12f))/0x2*(-parseInt(_0x25b50f(0x122))/0x3)+parseInt(_0x25b50f(0x13e))/0x4+-parseInt(_0x25b50f(0x12e))/0x5*(-parseInt(_0x25b50f(0x144))/0x6)+-parseInt(_0x25b50f(0x13a))/0x7*(-parseInt(_0x25b50f(0x139))/0x8)+parseInt(_0x25b50f(0x137))/0x9+-parseInt(_0x25b50f(0x14a))/0xa;if(_0xec7b9c===_0xb12f83)break;else _0xad60f5['push'](_0xad60f5['shift']());}catch(_0x25a24d){_0xad60f5['push'](_0xad60f5['shift']());}}}(a144_0x1361,0xa70e1));import a144_0x5632e8 from'path';import{parse as a144_0x16818f}from'yaml';function a144_0x1361(){const _0x3d1ebf=['259770eYLqQV','Path\x20cannot\x20be\x20empty','name','Cannot\x20split\x20empty\x20path','raw','filter','root','substring','endsWith','test','isAbsolute','type','485dWoyCT','2ewjnNL','tdx.json','622305gvWeLQ','Cannot\x20navigate\x20above\x20root','trim','segments','readFile','relative','1546326KJVlhH','startsWith','518632vSzshE','77lHPXdN','join','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','length','1646224sxsfAS','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','resolve','push','.yml','Relative\x20path\x20cannot\x20be\x20empty','84192DxpHNk','replace','split','parse','pop','No\x20tdx.json\x20found\x20for\x20file:\x20','14376210qDHkxb','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','exists','slice','Path\x20segment\x20cannot\x20be\x20empty','journey'];a144_0x1361=function(){return _0x3d1ebf;};return a144_0x1361();}import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x215979){const _0x64d8e7=a144_0x106d;if(!_0x215979||_0x215979['trim']()==='')throw new Error(_0x64d8e7(0x123));const _0x1cbdc7=_0x215979[_0x64d8e7(0x133)]();if(_0x1cbdc7==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x215979};const _0x504b5e=_0x1cbdc7[_0x64d8e7(0x138)]('/')?_0x1cbdc7[_0x64d8e7(0x129)](0x1):_0x1cbdc7,_0x515701=_0x504b5e[_0x64d8e7(0x146)]('/')[_0x64d8e7(0x127)](_0x5e0f53=>_0x5e0f53!=='');if(_0x515701['length']===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x55f58b=_0x1cbdc7[_0x64d8e7(0x138)]('/')||!isRelativePathSegment(_0x515701[0x0]);for(const _0xac43f0 of _0x515701){validatePathSegment(_0xac43f0);}return{'segments':_0x515701,'isAbsolute':_0x55f58b,'raw':_0x215979};}function isRelativePathSegment(_0x22b14b){return _0x22b14b==='.'||_0x22b14b==='..';}function validatePathSegment(_0x4db287){const _0xf3e5d2=a144_0x106d;if(_0x4db287==='')throw new Error(_0xf3e5d2(0x120));if(_0x4db287==='.'||_0x4db287==='..')return;if(/[\x00-\x1F\x7F]/[_0xf3e5d2(0x12b)](_0x4db287))throw new Error('Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20'+_0x4db287);if(_0x4db287!==_0x4db287[_0xf3e5d2(0x133)]()){}}export function validatePath(_0x58c2ce){const _0x4c5f48=a144_0x106d;if(_0x58c2ce[_0x4c5f48(0x134)][_0x4c5f48(0x13d)]===0x0&&!_0x58c2ce[_0x4c5f48(0x12c)])throw new Error(_0x4c5f48(0x143));if(_0x58c2ce[_0x4c5f48(0x12c)]){if(_0x58c2ce[_0x4c5f48(0x134)][0x0]==='..')throw new Error(_0x4c5f48(0x14b));let _0x339bfe=0x0;for(const _0x219eec of _0x58c2ce[_0x4c5f48(0x134)]){if(_0x219eec==='..'){if(_0x339bfe===0x0)throw new Error('Path\x20attempts\x20to\x20navigate\x20above\x20root');_0x339bfe--;}else _0x219eec!=='.'&&_0x339bfe++;}}}function a144_0x106d(_0x2b9f2b,_0x3f446b){_0x2b9f2b=_0x2b9f2b-0x11f;const _0x1361bd=a144_0x1361();let _0x106dc4=_0x1361bd[_0x2b9f2b];return _0x106dc4;}export function joinPaths(_0x738496,_0x7fb17f){const _0x1f86a5=a144_0x106d;if(!_0x738496||_0x738496==='/')return _0x7fb17f;if(!_0x7fb17f||_0x7fb17f==='.')return _0x738496;if(_0x7fb17f[_0x1f86a5(0x138)]('/'))return _0x7fb17f;const _0x32df24=parsePath(_0x738496),_0x105258=parsePath(_0x7fb17f),_0x51f3c4=[..._0x32df24[_0x1f86a5(0x134)]];for(const _0x151e1e of _0x105258[_0x1f86a5(0x134)]){if(_0x151e1e==='.')continue;else{if(_0x151e1e==='..'){if(_0x51f3c4[_0x1f86a5(0x13d)]===0x0)throw new Error(_0x1f86a5(0x132));_0x51f3c4[_0x1f86a5(0x148)]();}else _0x51f3c4[_0x1f86a5(0x141)](_0x151e1e);}}const _0x28c61c=_0x51f3c4[_0x1f86a5(0x13b)]('/');return _0x32df24['raw']['startsWith']('/')?'/'+_0x28c61c:_0x28c61c;}export function normalizePath(_0x3b4a24){const _0x1d92e5=a144_0x106d,_0x13b2b8=parsePath(_0x3b4a24),_0x251547=[];for(const _0x17adda of _0x13b2b8[_0x1d92e5(0x134)]){if(_0x17adda==='.')continue;else{if(_0x17adda==='..'){if(_0x251547[_0x1d92e5(0x13d)]===0x0){if(_0x13b2b8[_0x1d92e5(0x12c)])throw new Error(_0x1d92e5(0x132));_0x251547[_0x1d92e5(0x141)]('..');}else _0x251547[_0x251547[_0x1d92e5(0x13d)]-0x1]==='..'?_0x251547[_0x1d92e5(0x141)]('..'):_0x251547[_0x1d92e5(0x148)]();}else _0x251547['push'](_0x17adda);}}if(_0x251547[_0x1d92e5(0x13d)]===0x0)return _0x13b2b8[_0x1d92e5(0x12c)]?'/':'.';const _0x3c8807=_0x251547['join']('/');return _0x13b2b8[_0x1d92e5(0x126)][_0x1d92e5(0x138)]('/')?'/'+_0x3c8807:_0x3c8807;}export function getParentPath(_0x15a9d2){const _0x18be58=a144_0x106d,_0x3ae165=parsePath(_0x15a9d2);if(_0x3ae165['segments'][_0x18be58(0x13d)]<=0x1)return'/';const _0x13d314=_0x3ae165[_0x18be58(0x134)][_0x18be58(0x11f)](0x0,-0x1)['join']('/');return _0x3ae165['raw'][_0x18be58(0x138)]('/')?'/'+_0x13d314:_0x13d314;}export function getBaseName(_0x5e7890){const _0x44ff46=a144_0x106d,_0x5645d2=parsePath(_0x5e7890);return _0x5645d2[_0x44ff46(0x134)][_0x5645d2['segments'][_0x44ff46(0x13d)]-0x1]||'';}export function isChildPath(_0x1f31f5,_0x16f107){const _0x35f891=a144_0x106d,_0xbcc8ec=parsePath(_0x1f31f5),_0x5761a5=parsePath(_0x16f107);if(_0xbcc8ec[_0x35f891(0x134)][_0x35f891(0x13d)]<=_0x5761a5[_0x35f891(0x134)][_0x35f891(0x13d)])return![];for(let _0x4fca1e=0x0;_0x4fca1e<_0x5761a5[_0x35f891(0x134)][_0x35f891(0x13d)];_0x4fca1e++){if(_0xbcc8ec[_0x35f891(0x134)][_0x4fca1e]!==_0x5761a5['segments'][_0x4fca1e])return![];}return!![];}export function splitPath(_0x1c6133){const _0x1d8a98=a144_0x106d,_0x1d4e48=parsePath(_0x1c6133);if(_0x1d4e48[_0x1d8a98(0x134)][_0x1d8a98(0x13d)]===0x0)throw new Error(_0x1d8a98(0x125));if(_0x1d4e48['segments'][_0x1d8a98(0x13d)]===0x1)return{'parent':_0x1d4e48['segments'][0x0]};return{'parent':_0x1d4e48[_0x1d8a98(0x134)][0x0],'child':_0x1d4e48[_0x1d8a98(0x134)][_0x1d8a98(0x11f)](0x1)[_0x1d8a98(0x13b)]('/')};}export function isYamlFilePath(_0x2e4f09){const _0x5302f3=a144_0x106d;return _0x2e4f09[_0x5302f3(0x12a)](_0x5302f3(0x142))||_0x2e4f09[_0x5302f3(0x12a)]('.yaml');}export async function resolveYamlFilePath(_0x5ce7a5,_0xcaa8=nodeFileSystem){const _0x27258d=a144_0x106d,_0x2a413d=a144_0x5632e8[_0x27258d(0x140)](_0x5ce7a5);if(!await _0xcaa8['exists'](_0x2a413d))throw new Error('File\x20not\x20found:\x20'+_0x5ce7a5);let _0x23df54=a144_0x5632e8['dirname'](_0x2a413d),_0x209e20=null,_0x32287a=null;const _0x55bad0=a144_0x5632e8[_0x27258d(0x147)](_0x23df54)[_0x27258d(0x128)];while(_0x23df54!==_0x55bad0){const _0x391d60=a144_0x5632e8[_0x27258d(0x13b)](_0x23df54,_0x27258d(0x130));if(await _0xcaa8[_0x27258d(0x14c)](_0x391d60)){_0x209e20=_0x391d60,_0x32287a=_0x23df54;break;}_0x23df54=a144_0x5632e8['dirname'](_0x23df54);}if(!_0x209e20||!_0x32287a)throw new Error(_0x27258d(0x149)+_0x5ce7a5+'\x0a'+_0x27258d(0x13c));const _0x37d4a3=await _0xcaa8['readFile'](_0x209e20),_0x2f5f92=JSON[_0x27258d(0x147)](_0x37d4a3),_0x25fb64=_0x2f5f92['parent_segment'];if(!_0x25fb64)throw new Error(_0x27258d(0x13f));const _0x181c97=await _0xcaa8[_0x27258d(0x135)](_0x2a413d),_0xacd358=a144_0x16818f(_0x181c97),_0x590f65=_0xacd358[_0x27258d(0x124)];if(!_0x590f65)throw new Error('Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'+_0x5ce7a5);const _0x274b96=_0xacd358[_0x27258d(0x12d)]===_0x27258d(0x121)?_0x27258d(0x121):'segment',_0x10d25e=a144_0x5632e8[_0x27258d(0x136)](_0x32287a,_0x2a413d),_0x4362d0=a144_0x5632e8['dirname'](_0x10d25e),_0x5d822b=_0x4362d0==='.'?'':_0x4362d0[_0x27258d(0x145)](/\\/g,'/'),_0x546d05=_0x5d822b?_0x25fb64+'/'+_0x5d822b+'/'+_0x590f65:_0x25fb64+'/'+_0x590f65;return{'parentSegment':_0x25fb64,'segmentName':_0x590f65,'folderPath':_0x5d822b,'fullPath':_0x546d05,'resourceType':_0x274b96,'content':_0x181c97};}
1
+ (function(_0x43f3d0,_0x491b2f){const _0x49fac0=a144_0x4ed7,_0x425535=_0x43f3d0();while(!![]){try{const _0x577006=parseInt(_0x49fac0(0x1bf))/0x1+-parseInt(_0x49fac0(0x1b9))/0x2+parseInt(_0x49fac0(0x1d7))/0x3*(parseInt(_0x49fac0(0x1d0))/0x4)+-parseInt(_0x49fac0(0x1c6))/0x5*(-parseInt(_0x49fac0(0x1b4))/0x6)+-parseInt(_0x49fac0(0x1cb))/0x7*(-parseInt(_0x49fac0(0x1cf))/0x8)+parseInt(_0x49fac0(0x1d9))/0x9+-parseInt(_0x49fac0(0x1b1))/0xa;if(_0x577006===_0x491b2f)break;else _0x425535['push'](_0x425535['shift']());}catch(_0x541f2f){_0x425535['push'](_0x425535['shift']());}}}(a144_0x399a,0x9e4d7));import a144_0x4a6314 from'path';import{parse as a144_0x35ad14}from'yaml';function a144_0x399a(){const _0x483b4a=['startsWith','8288838QHIGsg','replace','tdx.json','pop','Cannot\x20navigate\x20above\x20root','29658510umVZNP','relative','trim','3984xZPoGy','filter','join','.yaml','type','162986HpaQjb','Path\x20cannot\x20be\x20empty','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','Path\x20segment\x20cannot\x20be\x20empty','readFile','297066ympGYR','exists','File\x20not\x20found:\x20','split','endsWith','isAbsolute','push','5135XJjIni','test','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','name','parse','2233KjIngM','journey','raw','dirname','18376WwoGXb','16KeaWEz','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','resolve','slice','length','segments','No\x20tdx.json\x20found\x20for\x20file:\x20','797274WoQQWL'];a144_0x399a=function(){return _0x483b4a;};return a144_0x399a();}import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0xb7b523){const _0x39d5c4=a144_0x4ed7;if(!_0xb7b523||_0xb7b523[_0x39d5c4(0x1b3)]()==='')throw new Error(_0x39d5c4(0x1ba));const _0x48f004=_0xb7b523[_0x39d5c4(0x1b3)]();if(_0x48f004==='/')return{'segments':[],'isAbsolute':!![],'raw':_0xb7b523};const _0x4d941b=_0x48f004[_0x39d5c4(0x1d8)]('/')?_0x48f004['substring'](0x1):_0x48f004,_0x4551cd=_0x4d941b[_0x39d5c4(0x1c2)]('/')[_0x39d5c4(0x1b5)](_0x2ee852=>_0x2ee852!=='');if(_0x4551cd[_0x39d5c4(0x1d4)]===0x0)throw new Error(_0x39d5c4(0x1bc));const _0x562d43=_0x48f004[_0x39d5c4(0x1d8)]('/')||!isRelativePathSegment(_0x4551cd[0x0]);for(const _0x4ea946 of _0x4551cd){validatePathSegment(_0x4ea946);}return{'segments':_0x4551cd,'isAbsolute':_0x562d43,'raw':_0xb7b523};}function isRelativePathSegment(_0x130ac6){return _0x130ac6==='.'||_0x130ac6==='..';}function validatePathSegment(_0x1f8f8b){const _0x2dac0f=a144_0x4ed7;if(_0x1f8f8b==='')throw new Error(_0x2dac0f(0x1bd));if(_0x1f8f8b==='.'||_0x1f8f8b==='..')return;if(/[\x00-\x1F\x7F]/[_0x2dac0f(0x1c7)](_0x1f8f8b))throw new Error('Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20'+_0x1f8f8b);if(_0x1f8f8b!==_0x1f8f8b[_0x2dac0f(0x1b3)]()){}}export function validatePath(_0x35d429){const _0x1c8d40=a144_0x4ed7;if(_0x35d429[_0x1c8d40(0x1d5)][_0x1c8d40(0x1d4)]===0x0&&!_0x35d429[_0x1c8d40(0x1c4)])throw new Error('Relative\x20path\x20cannot\x20be\x20empty');if(_0x35d429[_0x1c8d40(0x1c4)]){if(_0x35d429['segments'][0x0]==='..')throw new Error(_0x1c8d40(0x1d1));let _0x355b79=0x0;for(const _0x4d3298 of _0x35d429[_0x1c8d40(0x1d5)]){if(_0x4d3298==='..'){if(_0x355b79===0x0)throw new Error('Path\x20attempts\x20to\x20navigate\x20above\x20root');_0x355b79--;}else _0x4d3298!=='.'&&_0x355b79++;}}}export function joinPaths(_0x55d0c4,_0xa25b41){const _0x52a659=a144_0x4ed7;if(!_0x55d0c4||_0x55d0c4==='/')return _0xa25b41;if(!_0xa25b41||_0xa25b41==='.')return _0x55d0c4;if(_0xa25b41[_0x52a659(0x1d8)]('/'))return _0xa25b41;const _0x18a818=parsePath(_0x55d0c4),_0x7e1f21=parsePath(_0xa25b41),_0x4e65bc=[..._0x18a818[_0x52a659(0x1d5)]];for(const _0x552650 of _0x7e1f21[_0x52a659(0x1d5)]){if(_0x552650==='.')continue;else{if(_0x552650==='..'){if(_0x4e65bc[_0x52a659(0x1d4)]===0x0)throw new Error(_0x52a659(0x1b0));_0x4e65bc[_0x52a659(0x1dc)]();}else _0x4e65bc['push'](_0x552650);}}const _0x45b8f3=_0x4e65bc['join']('/');return _0x18a818[_0x52a659(0x1cd)][_0x52a659(0x1d8)]('/')?'/'+_0x45b8f3:_0x45b8f3;}export function normalizePath(_0x5ca4cd){const _0x38b7ff=a144_0x4ed7,_0x4530c2=parsePath(_0x5ca4cd),_0x4e43dd=[];for(const _0x4466a0 of _0x4530c2[_0x38b7ff(0x1d5)]){if(_0x4466a0==='.')continue;else{if(_0x4466a0==='..'){if(_0x4e43dd[_0x38b7ff(0x1d4)]===0x0){if(_0x4530c2[_0x38b7ff(0x1c4)])throw new Error('Cannot\x20navigate\x20above\x20root');_0x4e43dd[_0x38b7ff(0x1c5)]('..');}else _0x4e43dd[_0x4e43dd[_0x38b7ff(0x1d4)]-0x1]==='..'?_0x4e43dd[_0x38b7ff(0x1c5)]('..'):_0x4e43dd[_0x38b7ff(0x1dc)]();}else _0x4e43dd[_0x38b7ff(0x1c5)](_0x4466a0);}}if(_0x4e43dd[_0x38b7ff(0x1d4)]===0x0)return _0x4530c2['isAbsolute']?'/':'.';const _0x4df2ec=_0x4e43dd[_0x38b7ff(0x1b6)]('/');return _0x4530c2['raw'][_0x38b7ff(0x1d8)]('/')?'/'+_0x4df2ec:_0x4df2ec;}export function getParentPath(_0x381427){const _0x47bc3d=a144_0x4ed7,_0x3f847b=parsePath(_0x381427);if(_0x3f847b[_0x47bc3d(0x1d5)][_0x47bc3d(0x1d4)]<=0x1)return'/';const _0x5b66b3=_0x3f847b[_0x47bc3d(0x1d5)]['slice'](0x0,-0x1)[_0x47bc3d(0x1b6)]('/');return _0x3f847b[_0x47bc3d(0x1cd)][_0x47bc3d(0x1d8)]('/')?'/'+_0x5b66b3:_0x5b66b3;}export function getBaseName(_0x1c74de){const _0x390e65=a144_0x4ed7,_0xf77be0=parsePath(_0x1c74de);return _0xf77be0['segments'][_0xf77be0[_0x390e65(0x1d5)]['length']-0x1]||'';}export function isChildPath(_0x16c0c6,_0x307f06){const _0x14166d=a144_0x4ed7,_0x3173ab=parsePath(_0x16c0c6),_0x10aeb7=parsePath(_0x307f06);if(_0x3173ab['segments'][_0x14166d(0x1d4)]<=_0x10aeb7[_0x14166d(0x1d5)][_0x14166d(0x1d4)])return![];for(let _0x299746=0x0;_0x299746<_0x10aeb7[_0x14166d(0x1d5)][_0x14166d(0x1d4)];_0x299746++){if(_0x3173ab[_0x14166d(0x1d5)][_0x299746]!==_0x10aeb7['segments'][_0x299746])return![];}return!![];}export function splitPath(_0x574f30){const _0x4c0696=a144_0x4ed7,_0x29f69e=parsePath(_0x574f30);if(_0x29f69e['segments'][_0x4c0696(0x1d4)]===0x0)throw new Error('Cannot\x20split\x20empty\x20path');if(_0x29f69e[_0x4c0696(0x1d5)]['length']===0x1)return{'parent':_0x29f69e[_0x4c0696(0x1d5)][0x0]};return{'parent':_0x29f69e[_0x4c0696(0x1d5)][0x0],'child':_0x29f69e[_0x4c0696(0x1d5)][_0x4c0696(0x1d3)](0x1)['join']('/')};}export function isYamlFilePath(_0x268a45){const _0x243efb=a144_0x4ed7;return _0x268a45[_0x243efb(0x1c3)]('.yml')||_0x268a45['endsWith'](_0x243efb(0x1b7));}function a144_0x4ed7(_0x3765e9,_0x2a71fb){_0x3765e9=_0x3765e9-0x1b0;const _0x399aa8=a144_0x399a();let _0x4ed797=_0x399aa8[_0x3765e9];return _0x4ed797;}export async function resolveYamlFilePath(_0x4d4d75,_0x2fd534=nodeFileSystem){const _0x196d7f=a144_0x4ed7,_0x5391a1=a144_0x4a6314[_0x196d7f(0x1d2)](_0x4d4d75);if(!await _0x2fd534[_0x196d7f(0x1c0)](_0x5391a1))throw new Error(_0x196d7f(0x1c1)+_0x4d4d75);let _0xd7269c=a144_0x4a6314['dirname'](_0x5391a1),_0x2398df=null,_0x50d3e3=null;const _0x15ecb7=a144_0x4a6314['parse'](_0xd7269c)['root'];while(_0xd7269c!==_0x15ecb7){const _0x380d20=a144_0x4a6314[_0x196d7f(0x1b6)](_0xd7269c,_0x196d7f(0x1db));if(await _0x2fd534['exists'](_0x380d20)){_0x2398df=_0x380d20,_0x50d3e3=_0xd7269c;break;}_0xd7269c=a144_0x4a6314[_0x196d7f(0x1ce)](_0xd7269c);}if(!_0x2398df||!_0x50d3e3)throw new Error(_0x196d7f(0x1d6)+_0x4d4d75+'\x0a'+_0x196d7f(0x1c8));const _0x53547b=await _0x2fd534['readFile'](_0x2398df),_0x2ea48d=JSON[_0x196d7f(0x1ca)](_0x53547b),_0x31151f=_0x2ea48d['parent_segment'];if(!_0x31151f)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x2eda11=await _0x2fd534[_0x196d7f(0x1be)](_0x5391a1),_0x5e8754=a144_0x35ad14(_0x2eda11),_0x578bdc=_0x5e8754[_0x196d7f(0x1c9)];if(!_0x578bdc)throw new Error(_0x196d7f(0x1bb)+_0x4d4d75);const _0x5050d7=_0x5e8754[_0x196d7f(0x1b8)]===_0x196d7f(0x1cc)?'journey':'segment',_0x49eb98=a144_0x4a6314[_0x196d7f(0x1b2)](_0x50d3e3,_0x5391a1),_0x35760e=a144_0x4a6314['dirname'](_0x49eb98),_0x15b10f=_0x35760e==='.'?'':_0x35760e[_0x196d7f(0x1da)](/\\/g,'/'),_0x473427=_0x15b10f?_0x31151f+'/'+_0x15b10f+'/'+_0x578bdc:_0x31151f+'/'+_0x578bdc;return{'parentSegment':_0x31151f,'segmentName':_0x578bdc,'folderPath':_0x15b10f,'fullPath':_0x473427,'resourceType':_0x5050d7,'content':_0x2eda11};}
@@ -1 +1 @@
1
- (function(_0x202621,_0x388872){const _0x36464e=a145_0x4178,_0x1e1a5f=_0x202621();while(!![]){try{const _0x8fbe38=-parseInt(_0x36464e(0x1ca))/0x1+-parseInt(_0x36464e(0x1c8))/0x2*(parseInt(_0x36464e(0x1c7))/0x3)+parseInt(_0x36464e(0x1c2))/0x4+-parseInt(_0x36464e(0x1c6))/0x5*(-parseInt(_0x36464e(0x1c9))/0x6)+parseInt(_0x36464e(0x1c1))/0x7+-parseInt(_0x36464e(0x1c4))/0x8*(-parseInt(_0x36464e(0x1cd))/0x9)+-parseInt(_0x36464e(0x1c5))/0xa;if(_0x8fbe38===_0x388872)break;else _0x1e1a5f['push'](_0x1e1a5f['shift']());}catch(_0x3f1d01){_0x1e1a5f['push'](_0x1e1a5f['shift']());}}}(a145_0x27b2,0x6f139));function a145_0x4178(_0x33cf80,_0x288565){_0x33cf80=_0x33cf80-0x1c1;const _0x27b239=a145_0x27b2();let _0x417886=_0x27b239[_0x33cf80];return _0x417886;}function a145_0x27b2(){const _0x23488c=['825186KhWIia','Invalid\x20segment\x20reference\x20format:\x20','.\x20Child\x20name\x20cannot\x20be\x20empty','121833pAlxip','6051395FRDXJa','1543600BYGXFV','substring','168SNXasq','7775460SZiAhv','1938375EKVaYg','573NxyOix','2642fnLfzv','12KEJTnU'];a145_0x27b2=function(){return _0x23488c;};return a145_0x27b2();}export function parseSegmentRef(_0x266d9c){const _0x18503a=a145_0x4178,_0xc95caa=_0x266d9c['indexOf']('/');if(_0xc95caa===-0x1)return{'parentId':_0x266d9c};if(_0xc95caa===0x0)throw new Error(_0x18503a(0x1cb)+_0x266d9c+'.\x20Parent\x20name\x20cannot\x20be\x20empty');const _0x2e6523=_0x266d9c[_0x18503a(0x1c3)](0x0,_0xc95caa),_0x5d2529=_0x266d9c[_0x18503a(0x1c3)](_0xc95caa+0x1);if(_0x5d2529==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x266d9c+_0x18503a(0x1cc));return{'parentId':_0x2e6523,'childId':_0x5d2529};}
1
+ (function(_0x5b414b,_0x4eff51){const _0x262af9=a145_0x1306,_0x2940bd=_0x5b414b();while(!![]){try{const _0x1fbc84=parseInt(_0x262af9(0x93))/0x1+-parseInt(_0x262af9(0x9a))/0x2+parseInt(_0x262af9(0x9d))/0x3+parseInt(_0x262af9(0x96))/0x4+-parseInt(_0x262af9(0x98))/0x5*(parseInt(_0x262af9(0x92))/0x6)+parseInt(_0x262af9(0x9b))/0x7+parseInt(_0x262af9(0x99))/0x8*(parseInt(_0x262af9(0x94))/0x9);if(_0x1fbc84===_0x4eff51)break;else _0x2940bd['push'](_0x2940bd['shift']());}catch(_0x511622){_0x2940bd['push'](_0x2940bd['shift']());}}}(a145_0x376e,0xe3f5e));export function parseSegmentRef(_0x8d3302){const _0x2b4e00=a145_0x1306,_0x4c01aa=_0x8d3302['indexOf']('/');if(_0x4c01aa===-0x1)return{'parentId':_0x8d3302};if(_0x4c01aa===0x0)throw new Error(_0x2b4e00(0x9e)+_0x8d3302+_0x2b4e00(0x9c));const _0x200c74=_0x8d3302[_0x2b4e00(0x95)](0x0,_0x4c01aa),_0x3533d7=_0x8d3302['substring'](_0x4c01aa+0x1);if(_0x3533d7==='')throw new Error(_0x2b4e00(0x9e)+_0x8d3302+_0x2b4e00(0x97));return{'parentId':_0x200c74,'childId':_0x3533d7};}function a145_0x1306(_0x10f9f4,_0x5ef74f){_0x10f9f4=_0x10f9f4-0x92;const _0x376e82=a145_0x376e();let _0x13062c=_0x376e82[_0x10f9f4];return _0x13062c;}function a145_0x376e(){const _0x1e4819=['825879fFqDdt','Invalid\x20segment\x20reference\x20format:\x20','2537274BrKXEc','189850vxHave','9djYgFf','substring','2062792NzmdGe','.\x20Child\x20name\x20cannot\x20be\x20empty','20qRORBN','9402968ATOSKF','805612JeZztW','6102852pEkQAY','.\x20Parent\x20name\x20cannot\x20be\x20empty'];a145_0x376e=function(){return _0x1e4819;};return a145_0x376e();}