@treasuredata/tdx 2026.3.3 → 2026.3.5

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 (197) 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/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/delivery-command.js +1 -1
  18. package/dist/commands/describe.js +1 -1
  19. package/dist/commands/engage-campaign-pull-command.js +1 -1
  20. package/dist/commands/engage-campaign-push-command.js +1 -1
  21. package/dist/commands/engage-campaign-validate-command.js +1 -1
  22. package/dist/commands/engage-command.js +1 -1
  23. package/dist/commands/engage-template-pull-command.js +1 -1
  24. package/dist/commands/engage-template-push-command.js +1 -1
  25. package/dist/commands/engage-template-validate-command.js +1 -1
  26. package/dist/commands/job-command.js +1 -1
  27. package/dist/commands/journey-command.js +1 -1
  28. package/dist/commands/journey-validate-command.js +1 -1
  29. package/dist/commands/llm-command.js +1 -1
  30. package/dist/commands/mcp-command.js +1 -1
  31. package/dist/commands/parent-segment-command.js +1 -1
  32. package/dist/commands/profile-command.js +1 -1
  33. package/dist/commands/profiles-command.js +1 -1
  34. package/dist/commands/query-command.js +1 -1
  35. package/dist/commands/schedule-command.js +1 -1
  36. package/dist/commands/segment-command.js +1 -1
  37. package/dist/commands/segment-create-command.js +1 -1
  38. package/dist/commands/segment-fields-command.js +1 -1
  39. package/dist/commands/segment-pull-command.js +1 -1
  40. package/dist/commands/segment-push-command.js +1 -1
  41. package/dist/commands/segment-update-command.js +1 -1
  42. package/dist/commands/segment-use-command.js +1 -1
  43. package/dist/commands/segment-validate-command.js +1 -1
  44. package/dist/commands/segments.js +1 -1
  45. package/dist/commands/show.js +1 -1
  46. package/dist/commands/status-command.js +1 -1
  47. package/dist/commands/tables.js +1 -1
  48. package/dist/commands/unset-command.js +1 -1
  49. package/dist/commands/upgrade-command.js +1 -1
  50. package/dist/commands/use-command.js +1 -1
  51. package/dist/commands/user-command.js +1 -1
  52. package/dist/commands/workflow-command.js +1 -1
  53. package/dist/core/auth.js +1 -1
  54. package/dist/core/command-output.js +1 -1
  55. package/dist/core/config.js +1 -1
  56. package/dist/core/connection-cache.js +1 -1
  57. package/dist/core/constants.js +1 -1
  58. package/dist/core/credential-cache.js +1 -1
  59. package/dist/core/global-context.js +1 -1
  60. package/dist/core/keychain.js +1 -1
  61. package/dist/core/profile.js +1 -1
  62. package/dist/core/project-config.js +1 -1
  63. package/dist/core/session.js +1 -1
  64. package/dist/core/user-cache.js +1 -1
  65. package/dist/core/version.js +1 -1
  66. package/dist/index.js +1 -1
  67. package/dist/mcp/server.js +1 -1
  68. package/dist/mcp/tools/index.js +1 -1
  69. package/dist/mcp/tools/tdx-run.js +1 -1
  70. package/dist/mcp/tools/tdx-search.js +1 -1
  71. package/dist/mcp/utils.js +1 -1
  72. package/dist/proxy/claude-usage-tracker.js +1 -1
  73. package/dist/proxy/passthrough-server.js +1 -1
  74. package/dist/proxy/sse-usage-parser.js +1 -1
  75. package/dist/sdk/agent/agent-config.js +1 -1
  76. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  77. package/dist/sdk/agent/agent-yaml.js +1 -1
  78. package/dist/sdk/agent/test/evaluator.js +1 -1
  79. package/dist/sdk/agent/test/executor.js +1 -1
  80. package/dist/sdk/agent/test/index.js +1 -1
  81. package/dist/sdk/agent/test/output.js +1 -1
  82. package/dist/sdk/agent/test/parser.js +1 -1
  83. package/dist/sdk/agent/tool-target-registry.js +1 -1
  84. package/dist/sdk/api.js +1 -1
  85. package/dist/sdk/client/cdp-api-client.js +1 -1
  86. package/dist/sdk/client/delivery-api-client.js +1 -1
  87. package/dist/sdk/client/endpoints.js +1 -1
  88. package/dist/sdk/client/engage-api-client.js +1 -1
  89. package/dist/sdk/client/http-client.js +1 -1
  90. package/dist/sdk/client/llm-api-client.js +1 -1
  91. package/dist/sdk/client/rate-limiter.js +1 -1
  92. package/dist/sdk/client/td-api-client.js +1 -1
  93. package/dist/sdk/client/trino-api-client.js +1 -1
  94. package/dist/sdk/client/workflow-client.js +1 -1
  95. package/dist/sdk/connection-validator.js +1 -1
  96. package/dist/sdk/connection.js +1 -1
  97. package/dist/sdk/delivery.js +1 -1
  98. package/dist/sdk/engage/campaign-pull.js +1 -1
  99. package/dist/sdk/engage/campaign-push.js +1 -1
  100. package/dist/sdk/engage/campaign-validator.js +1 -1
  101. package/dist/sdk/engage/campaign-yaml.js +1 -1
  102. package/dist/sdk/engage/template-pull.js +1 -1
  103. package/dist/sdk/engage/template-push.js +1 -1
  104. package/dist/sdk/engage/template-validator.js +1 -1
  105. package/dist/sdk/engage/template-yaml.js +1 -1
  106. package/dist/sdk/engage/types/campaign-def.js +1 -1
  107. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  108. package/dist/sdk/engage/types/template-schema.js +1 -1
  109. package/dist/sdk/engage.js +1 -1
  110. package/dist/sdk/errors.js +1 -1
  111. package/dist/sdk/index.js +1 -1
  112. package/dist/sdk/io/index.js +1 -1
  113. package/dist/sdk/io/node-filesystem.js +1 -1
  114. package/dist/sdk/job.js +1 -1
  115. package/dist/sdk/journey.js +1 -1
  116. package/dist/sdk/llm/chat-cache.js +1 -1
  117. package/dist/sdk/llm/index.js +1 -1
  118. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  119. package/dist/sdk/llm/model-factors.js +1 -1
  120. package/dist/sdk/personalization.js +1 -1
  121. package/dist/sdk/query/index.js +1 -1
  122. package/dist/sdk/query/sql-parser.js +1 -1
  123. package/dist/sdk/realtime.js +1 -1
  124. package/dist/sdk/schedule.js +1 -1
  125. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  126. package/dist/sdk/segment/fields-display.js +1 -1
  127. package/dist/sdk/segment/file-discovery.js +1 -1
  128. package/dist/sdk/segment/journey-utils.js +1 -1
  129. package/dist/sdk/segment/journey-validator.js +1 -1
  130. package/dist/sdk/segment/journey-yaml.js +1 -1
  131. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  132. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  133. package/dist/sdk/segment/pull-workflow.js +1 -1
  134. package/dist/sdk/segment/push-recovery.js +1 -1
  135. package/dist/sdk/segment/push-workflow.js +1 -1
  136. package/dist/sdk/segment/resolution-context.js +1 -1
  137. package/dist/sdk/segment/segment-path-parser.js +1 -1
  138. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  139. package/dist/sdk/segment/segment-validator.js +1 -1
  140. package/dist/sdk/segment/target-resolution.js +1 -1
  141. package/dist/sdk/segment/tdx-config.js +1 -1
  142. package/dist/sdk/segment/types/activation-schema.js +1 -1
  143. package/dist/sdk/segment/types/journey-def.js +1 -1
  144. package/dist/sdk/segment/types/journey-schema.js +1 -1
  145. package/dist/sdk/segment/types/segment-def.js +1 -1
  146. package/dist/sdk/segment/types/segment-schema.js +1 -1
  147. package/dist/sdk/segment/validate-files.js +1 -1
  148. package/dist/sdk/segment/yaml-validator.js +1 -1
  149. package/dist/sdk/segment.js +1 -1
  150. package/dist/sdk/types/index.js +1 -1
  151. package/dist/sdk/types/progress.js +1 -1
  152. package/dist/sdk/user.js +1 -1
  153. package/dist/sdk/util/format-detector.js +1 -1
  154. package/dist/sdk/util/formatters.js +1 -1
  155. package/dist/sdk/util/index.js +1 -1
  156. package/dist/sdk/util/paginate.js +1 -1
  157. package/dist/sdk/util/tree-formatter.js +1 -1
  158. package/dist/sdk/workflow/archive-validation.js +1 -1
  159. package/dist/sdk/workflow/clone-workflow.js +1 -1
  160. package/dist/sdk/workflow/index.js +1 -1
  161. package/dist/sdk/workflow/pull-workflow.js +1 -1
  162. package/dist/sdk/workflow/push-workflow.js +1 -1
  163. package/dist/sdk/workflow/tdx-config.js +1 -1
  164. package/dist/sdk/workflow/workflow-utils.js +1 -1
  165. package/dist/test-utils/command-runner.js +1 -1
  166. package/dist/test-utils/factories.js +1 -1
  167. package/dist/test-utils/fixtures.js +1 -1
  168. package/dist/test-utils/http-mock.js +1 -1
  169. package/dist/test-utils/index.js +1 -1
  170. package/dist/utils/async.js +1 -1
  171. package/dist/utils/colors.js +1 -1
  172. package/dist/utils/diff.js +1 -1
  173. package/dist/utils/file-permissions.js +1 -1
  174. package/dist/utils/file-reader.js +1 -1
  175. package/dist/utils/github-releases.js +1 -1
  176. package/dist/utils/global-cache.js +1 -1
  177. package/dist/utils/json-loader.js +1 -1
  178. package/dist/utils/local-cache.js +1 -1
  179. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  180. package/dist/utils/logger/formatters/index.js +1 -1
  181. package/dist/utils/logger/handlers/console-handler.js +1 -1
  182. package/dist/utils/logger/handlers/file-handler.js +1 -1
  183. package/dist/utils/logger/handlers/index.js +1 -1
  184. package/dist/utils/logger/handlers/null-handler.js +1 -1
  185. package/dist/utils/logger/index.js +1 -1
  186. package/dist/utils/logger/logger.js +1 -1
  187. package/dist/utils/logger/types.js +1 -1
  188. package/dist/utils/option-validation.js +1 -1
  189. package/dist/utils/process.js +1 -1
  190. package/dist/utils/prompt.js +1 -1
  191. package/dist/utils/spinner.js +1 -1
  192. package/dist/utils/sse-parser.js +1 -1
  193. package/dist/utils/string-utils.js +1 -1
  194. package/dist/utils/table-ref-parser.js +1 -1
  195. package/dist/utils/tdx-logger.js +1 -1
  196. package/dist/utils/version-check.js +1 -1
  197. package/package.json +1 -1
@@ -1 +1 @@
1
- const a135_0x1a29d9=a135_0xc94d;function a135_0xc94d(_0x2cedc1,_0xc698ad){_0x2cedc1=_0x2cedc1-0x1f1;const _0x128ba8=a135_0x128b();let _0xc94d7e=_0x128ba8[_0x2cedc1];return _0xc94d7e;}(function(_0x5cb875,_0x5821a5){const _0x481252=a135_0xc94d,_0x39588b=_0x5cb875();while(!![]){try{const _0x91d1f3=-parseInt(_0x481252(0x209))/0x1*(-parseInt(_0x481252(0x1f2))/0x2)+parseInt(_0x481252(0x1ff))/0x3+-parseInt(_0x481252(0x1fc))/0x4+parseInt(_0x481252(0x1f3))/0x5+-parseInt(_0x481252(0x1f6))/0x6+-parseInt(_0x481252(0x200))/0x7*(parseInt(_0x481252(0x1f5))/0x8)+parseInt(_0x481252(0x208))/0x9;if(_0x91d1f3===_0x5821a5)break;else _0x39588b['push'](_0x39588b['shift']());}catch(_0x321ba8){_0x39588b['push'](_0x39588b['shift']());}}}(a135_0x128b,0x69de7));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';import a135_0x36918b from'path';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a135_0x1a29d9(0x202));export function getPushRecoveryPath(_0x4054e8){const _0x2bb812=a135_0x1a29d9,_0x4e10ba=a135_0x36918b[_0x2bb812(0x1f9)](_0x4054e8),_0x44783c=a135_0x36918b[_0x2bb812(0x1f8)](_0x4054e8);return a135_0x36918b[_0x2bb812(0x205)](_0x4e10ba,'.'+_0x44783c+_0x2bb812(0x204));}export function readPushRecovery(_0xdd4712){const _0x12da1c=a135_0x1a29d9,_0xa2e0cd=getPushRecoveryPath(_0xdd4712);if(!existsSync(_0xa2e0cd))return undefined;try{const _0x3ce92b=readFileSync(_0xa2e0cd,_0x12da1c(0x1fe)),_0x23226c=JSON[_0x12da1c(0x1f1)](_0x3ce92b);if(_0x23226c?.[_0x12da1c(0x1f4)]!==0x1||typeof _0x23226c[_0x12da1c(0x206)]!==_0x12da1c(0x201))return undefined;return _0x23226c;}catch(_0x2b58cd){return _0x2b58cd instanceof SyntaxError?logger[_0x12da1c(0x203)]('Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20'+_0x2b58cd):logger['warn'](_0x12da1c(0x207)+_0x2b58cd),undefined;}}export function writePushRecovery(_0x28bc99,_0x5925bd){const _0x38c87a=a135_0x1a29d9,_0x2a7d28=getPushRecoveryPath(_0x28bc99),_0x27f5a5=_0x2a7d28+_0x38c87a(0x1fd);writeFileSync(_0x27f5a5,JSON['stringify'](_0x5925bd,null,0x2)+'\x0a',_0x38c87a(0x1fe)),renameSync(_0x27f5a5,_0x2a7d28);}export function deletePushRecovery(_0xff04a5){const _0x48661a=a135_0x1a29d9,_0x133b64=getPushRecoveryPath(_0xff04a5);try{unlinkSync(_0x133b64);}catch(_0x35d72d){_0x35d72d[_0x48661a(0x1fa)]!=='ENOENT'&&logger['debug']('Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20'+_0x35d72d);}}function a135_0x128b(){const _0x534ddd=['tdx.sdk.push-recovery','debug','.push-recovery.json','join','journeyName','Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','16813368kYiZZv','7yJXmjc','parse','92386VlhGnA','1092660yeBiGY','version','24088VVtdSR','2958780dRffwL','toISOString','basename','dirname','code','segments','3447844hSNxlX','.tmp','utf-8','719523SgqKuP','2002kCgiGE','string'];a135_0x128b=function(){return _0x534ddd;};return a135_0x128b();}export function saveSegmentToPushRecovery(_0x4f5ea7,_0x2ed72f,_0x221cc2,_0x3a6f1f){const _0xfc6f7f=a135_0x1a29d9,_0x3a7733=readPushRecovery(_0x4f5ea7),_0x5ea6e3=_0x3a7733?.[_0xfc6f7f(0x206)]===_0x2ed72f?{..._0x3a7733,'updatedAt':new Date()[_0xfc6f7f(0x1f7)]()}:{'version':0x1,'journeyName':_0x2ed72f,'updatedAt':new Date()[_0xfc6f7f(0x1f7)](),'segments':{}};_0x5ea6e3[_0xfc6f7f(0x1fb)][_0x221cc2]=_0x3a6f1f,writePushRecovery(_0x4f5ea7,_0x5ea6e3);}
1
+ const a135_0x3c0fc2=a135_0x3303;function a135_0x3303(_0x252988,_0x367751){_0x252988=_0x252988-0xf8;const _0x2daea9=a135_0x2dae();let _0x3303a4=_0x2daea9[_0x252988];return _0x3303a4;}(function(_0x55287c,_0x449644){const _0x4fbdb7=a135_0x3303,_0x2840e6=_0x55287c();while(!![]){try{const _0x3205f1=-parseInt(_0x4fbdb7(0x101))/0x1*(-parseInt(_0x4fbdb7(0x110))/0x2)+-parseInt(_0x4fbdb7(0x10f))/0x3+parseInt(_0x4fbdb7(0x100))/0x4+parseInt(_0x4fbdb7(0xff))/0x5*(-parseInt(_0x4fbdb7(0xfe))/0x6)+-parseInt(_0x4fbdb7(0x105))/0x7*(parseInt(_0x4fbdb7(0xf8))/0x8)+-parseInt(_0x4fbdb7(0xfc))/0x9*(-parseInt(_0x4fbdb7(0x108))/0xa)+parseInt(_0x4fbdb7(0x10a))/0xb;if(_0x3205f1===_0x449644)break;else _0x2840e6['push'](_0x2840e6['shift']());}catch(_0x2ce17e){_0x2840e6['push'](_0x2840e6['shift']());}}}(a135_0x2dae,0xd0d2e));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';import a135_0x5236ab from'path';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a135_0x3c0fc2(0x102));export function getPushRecoveryPath(_0x3b9f1c){const _0x28ae98=a135_0x3c0fc2,_0x3202f2=a135_0x5236ab[_0x28ae98(0x109)](_0x3b9f1c),_0x118c64=a135_0x5236ab['basename'](_0x3b9f1c);return a135_0x5236ab['join'](_0x3202f2,'.'+_0x118c64+_0x28ae98(0x10e));}export function readPushRecovery(_0x56f451){const _0x31b9fc=a135_0x3c0fc2,_0x43dbe3=getPushRecoveryPath(_0x56f451);if(!existsSync(_0x43dbe3))return undefined;try{const _0x3fb3b7=readFileSync(_0x43dbe3,_0x31b9fc(0x103)),_0x53a01c=JSON[_0x31b9fc(0x10c)](_0x3fb3b7);if(_0x53a01c?.[_0x31b9fc(0x10d)]!==0x1||typeof _0x53a01c[_0x31b9fc(0xf9)]!==_0x31b9fc(0xfa))return undefined;return _0x53a01c;}catch(_0x3e5a96){return _0x3e5a96 instanceof SyntaxError?logger['debug'](_0x31b9fc(0x104)+_0x3e5a96):logger['warn'](_0x31b9fc(0xfb)+_0x3e5a96),undefined;}}export function writePushRecovery(_0x5109b1,_0x54a79d){const _0x1e5486=a135_0x3c0fc2,_0x567869=getPushRecoveryPath(_0x5109b1),_0x58c2d7=_0x567869+'.tmp';writeFileSync(_0x58c2d7,JSON[_0x1e5486(0x10b)](_0x54a79d,null,0x2)+'\x0a','utf-8'),renameSync(_0x58c2d7,_0x567869);}function a135_0x2dae(){const _0x3bdc18=['Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','558FAZknc','Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20','1122nVzdhX','23205LItVyH','3342000lvSwUW','268VaqASw','tdx.sdk.push-recovery','utf-8','Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20','112teqnpa','ENOENT','toISOString','4990UTNWae','dirname','10699788XqFfIu','stringify','parse','version','.push-recovery.json','555867EWvwEp','1884awVwEw','91552vMdLDC','journeyName','string'];a135_0x2dae=function(){return _0x3bdc18;};return a135_0x2dae();}export function deletePushRecovery(_0x1b0a34){const _0x391881=a135_0x3c0fc2,_0x1cf894=getPushRecoveryPath(_0x1b0a34);try{unlinkSync(_0x1cf894);}catch(_0x2c85bb){_0x2c85bb['code']!==_0x391881(0x106)&&logger['debug'](_0x391881(0xfd)+_0x2c85bb);}}export function saveSegmentToPushRecovery(_0x2913da,_0x420957,_0x251e63,_0x39a591){const _0x5dfe46=a135_0x3c0fc2,_0x257aa7=readPushRecovery(_0x2913da),_0x19bf11=_0x257aa7?.[_0x5dfe46(0xf9)]===_0x420957?{..._0x257aa7,'updatedAt':new Date()[_0x5dfe46(0x107)]()}:{'version':0x1,'journeyName':_0x420957,'updatedAt':new Date()[_0x5dfe46(0x107)](),'segments':{}};_0x19bf11['segments'][_0x251e63]=_0x39a591,writePushRecovery(_0x2913da,_0x19bf11);}
@@ -1 +1 @@
1
- const a136_0x5a0a93=a136_0x3302;(function(_0x1069fb,_0x22c750){const _0xe3857e=a136_0x3302,_0x11cb0b=_0x1069fb();while(!![]){try{const _0x6ec935=parseInt(_0xe3857e(0x14d))/0x1+-parseInt(_0xe3857e(0x1e3))/0x2*(parseInt(_0xe3857e(0x191))/0x3)+parseInt(_0xe3857e(0x24e))/0x4*(-parseInt(_0xe3857e(0x1f7))/0x5)+parseInt(_0xe3857e(0x23b))/0x6*(-parseInt(_0xe3857e(0x1fa))/0x7)+-parseInt(_0xe3857e(0x237))/0x8+-parseInt(_0xe3857e(0x21b))/0x9*(-parseInt(_0xe3857e(0x20e))/0xa)+parseInt(_0xe3857e(0x227))/0xb*(parseInt(_0xe3857e(0x194))/0xc);if(_0x6ec935===_0x22c750)break;else _0x11cb0b['push'](_0x11cb0b['shift']());}catch(_0x32090d){_0x11cb0b['push'](_0x11cb0b['shift']());}}}(a136_0x2ca5,0x2f0f4));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of']('tdx.sdk.push-workflow');export const PENDING_SEGMENT_PREFIX='__pending_';export const PENDING_ACTIVATION_PREFIX=a136_0x5a0a93(0x1c7);export function createPendingSegmentId(_0x282c32){return''+PENDING_SEGMENT_PREFIX+_0x282c32+'__';}export function isPendingSegmentId(_0xd7c243){const _0x52d4fb=a136_0x5a0a93;return _0xd7c243[_0x52d4fb(0x200)](PENDING_SEGMENT_PREFIX)&&!_0xd7c243[_0x52d4fb(0x200)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x53f805){return _0x53f805['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x4333e2){return''+PENDING_ACTIVATION_PREFIX+_0x4333e2+'__';}export function isPendingActivationId(_0x1886d8){const _0xebefbe=a136_0x5a0a93;return _0x1886d8[_0xebefbe(0x200)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x1d50c3){return _0x1d50c3['replace'](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x517911,_0x49ed41){const _0xd706ae=a136_0x5a0a93,_0x16ad2a=_0x517911+'::'+(_0x49ed41[_0xd706ae(0x197)]()||_0xd706ae(0x225)),_0x242d1c=createHash(_0xd706ae(0x1a7))[_0xd706ae(0x165)](_0x16ad2a)['digest'](_0xd706ae(0x214))[_0xd706ae(0x1d4)](0x0,0xc);return'journey_entry_criteria_'+_0x242d1c;}export function ensureJourneyDefaults(_0x1dc785){const _0x11aadb=a136_0x5a0a93;!_0x1dc785['description']&&(_0x1dc785[_0x11aadb(0x1ff)]=''),!_0x1dc785[_0x11aadb(0x22e)]&&(_0x1dc785[_0x11aadb(0x22e)]=_0x11aadb(0x1e1));}export function injectExistingStageIds(_0x592e8f,_0x48d5bb){const _0x4a72e8=a136_0x5a0a93,_0x3588bb=new Map(_0x48d5bb['map'](_0x584520=>[_0x584520[_0x4a72e8(0x174)],_0x584520['id']]));for(const _0x1d0d84 of _0x592e8f){if(!_0x1d0d84['id']){const _0x244851=_0x3588bb[_0x4a72e8(0x18a)](_0x1d0d84[_0x4a72e8(0x174)]);_0x244851&&(_0x1d0d84['id']=_0x244851);}}}export function resolveTDFolderPath(_0x4b7139,_0x2c1d84,_0x4a1238){if(!_0x2c1d84)return _0x4b7139;if(_0x4b7139===_0x4a1238||_0x4b7139['startsWith'](_0x4a1238+'/'))return _0x4b7139;return _0x4b7139?_0x4a1238+'/'+_0x4b7139:_0x4a1238;}export function addFoldersToCreate(_0xbca54d,_0x27ff9e,_0x55e0c1){const _0x4f75b7=a136_0x5a0a93;if(!_0xbca54d)return;if(_0x27ff9e[_0x4f75b7(0x245)](_0xbca54d))return;const _0x43af46=_0xbca54d[_0x4f75b7(0x220)]('/');let _0x186281='';for(const _0x171847 of _0x43af46){_0x186281=_0x186281?_0x186281+'/'+_0x171847:_0x171847,!_0x27ff9e['has'](_0x186281)&&_0x55e0c1[_0x4f75b7(0x1b5)](_0x186281);}}export function sortFoldersByDepth(_0x2f62ea){const _0x383080=a136_0x5a0a93;return[..._0x2f62ea][_0x383080(0x1f6)]((_0x2a507b,_0x41c5d2)=>{const _0x11ad96=_0x383080,_0x26929b=(_0x2a507b['match'](/\//g)||[])[_0x11ad96(0x1a5)],_0x58c531=(_0x41c5d2[_0x11ad96(0x21e)](/\//g)||[])[_0x11ad96(0x1a5)];return _0x26929b-_0x58c531;});}import*as a136_0x2c0f26 from'yaml';import{readFileSync}from'fs';import a136_0x3b9c1d from'path';import{isJourneyDef,parseYamlString as a136_0xd5b269,toYamlString as a136_0x5f2d71,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(_0x3636d5){const _0x579c6c=a136_0x5a0a93;if(Array[_0x579c6c(0x229)](_0x3636d5))return'['+_0x3636d5[_0x579c6c(0x216)](_0x3f6446=>stableStringify(_0x3f6446))[_0x579c6c(0x195)](',')+']';if(_0x3636d5&&typeof _0x3636d5===_0x579c6c(0x19a)){const _0x5b3b8c=_0x3636d5,_0x4494c7=Object['keys'](_0x5b3b8c)[_0x579c6c(0x1f6)](),_0x49c810=_0x4494c7[_0x579c6c(0x216)](_0x3d0ea6=>'\x22'+_0x3d0ea6+'\x22:'+stableStringify(_0x5b3b8c[_0x3d0ea6]));return'{'+_0x49c810[_0x579c6c(0x195)](',')+'}';}const _0x38c0dd=JSON['stringify'](_0x3636d5);return _0x38c0dd===undefined?'null':_0x38c0dd;}function activationSignature(_0x42cec5){const _0x698f1f=a136_0x5a0a93,_0xcfa5a6={'connection':_0x42cec5[_0x698f1f(0x1f4)],..._0x42cec5[_0x698f1f(0x19f)]!==undefined&&{'all_columns':_0x42cec5[_0x698f1f(0x19f)]},..._0x42cec5[_0x698f1f(0x1cc)]!==undefined&&{'columns':_0x42cec5[_0x698f1f(0x1cc)]},..._0x42cec5[_0x698f1f(0x22b)]!==undefined&&{'behavior':_0x42cec5[_0x698f1f(0x22b)]},..._0x42cec5[_0x698f1f(0x1dc)]!==undefined&&{'schedule':_0x42cec5[_0x698f1f(0x1dc)]},..._0x42cec5[_0x698f1f(0x1f8)]!==undefined&&{'notification':_0x42cec5['notification']},..._0x42cec5[_0x698f1f(0x1d9)]!==undefined&&{'connector_config':_0x42cec5[_0x698f1f(0x1d9)]},..._0x42cec5[_0x698f1f(0x176)]!==undefined&&{'activation_template_id':_0x42cec5['activation_template_id']}};return stableStringify(_0xcfa5a6);}async function fetchSegment(_0x11efdf,_0x257df4,_0xaa9336,_0x2649a4){const _0x47ed3e=a136_0x5a0a93,_0x22679b=_0x2649a4?.[_0x47ed3e(0x206)](_0x63d2f=>_0x63d2f['id']===_0xaa9336);if(_0x22679b)return _0x22679b;try{return await _0x11efdf[_0x47ed3e(0x225)]['getSegment'](_0x257df4,_0xaa9336);}catch(_0x4cc856){logger['debug'](_0x47ed3e(0x178)+_0xaa9336+_0x47ed3e(0x21a)+_0x4cc856);try{return await _0x11efdf['segment'][_0x47ed3e(0x1f9)](_0xaa9336);}catch(_0x4497ed){return logger[_0x47ed3e(0x20b)](_0x47ed3e(0x17e)+_0xaa9336+':\x20'+_0x4497ed),null;}}}function recoverSegmentIdsFromPushRecovery(_0x2c50a0,_0x337c65,_0xe4e4eb){const _0x223855=a136_0x5a0a93,_0x43bb1b=readPushRecovery(_0x2c50a0[_0x223855(0x1e2)]);if(_0x43bb1b?.[_0x223855(0x170)]===_0x2c50a0[_0x223855(0x1e6)]['name'])for(const [_0x217292,_0x5b8085]of Object['entries'](_0x43bb1b[_0x223855(0x1b3)])){const _0x53c4c1=generateDeterministicJourneySegmentName(_0x2c50a0[_0x223855(0x1e6)]['name'],_0x217292);_0x5b8085[_0x223855(0x19b)]===_0x53c4c1&&(_0x337c65['set'](_0x217292,_0x5b8085[_0x223855(0x21d)]),_0xe4e4eb[_0x223855(0x193)](_0x217292,_0x5b8085[_0x223855(0x21d)]));}}async function createOrRecoverEmbeddedSegment(_0x4990d4,_0x45a55a,_0x177c4d,_0x4f269f){const _0x4d4a04=a136_0x5a0a93;let _0x5666f6;try{_0x5666f6=await _0x4990d4[_0x4d4a04(0x225)][_0x4d4a04(0x1e7)]({'name':_0x177c4d[_0x4d4a04(0x207)],'description':_0x177c4d[_0x4d4a04(0x1ff)],'journeyId':_0x177c4d[_0x4d4a04(0x23c)],'rule':_0x4f269f(_0x177c4d[_0x4d4a04(0x1bf)],!![]),'countPopulation':!![],'parentFolderId':_0x177c4d[_0x4d4a04(0x18e)],'audienceId':_0x177c4d[_0x4d4a04(0x201)]});}catch(_0xeeeb92){const _0x268420=_0xeeeb92 instanceof Error&&_0xeeeb92[_0x4d4a04(0x1ef)]['includes'](_0x4d4a04(0x1d2));if(_0x268420){const _0x3b1b66=readPushRecovery(_0x45a55a[_0x4d4a04(0x1e2)]),_0x291b1a=_0x3b1b66?.[_0x4d4a04(0x170)]===_0x45a55a[_0x4d4a04(0x1e6)]['name']?_0x3b1b66[_0x4d4a04(0x1b3)][_0x177c4d[_0x4d4a04(0x240)]]:undefined;if(_0x291b1a?.[_0x4d4a04(0x19b)]===_0x177c4d[_0x4d4a04(0x207)])await _0x4990d4[_0x4d4a04(0x225)][_0x4d4a04(0x18f)](_0x177c4d[_0x4d4a04(0x201)],_0x291b1a[_0x4d4a04(0x21d)],{'description':_0x177c4d[_0x4d4a04(0x1ff)],'rule':_0x4f269f(_0x177c4d[_0x4d4a04(0x1bf)],!![]),'countPopulation':!![]}),_0x5666f6=_0x291b1a[_0x4d4a04(0x21d)];else throw new SDKError(ErrorCode[_0x4d4a04(0x184)],_0x4d4a04(0x15a)+_0x177c4d[_0x4d4a04(0x240)]+_0x4d4a04(0x1f0)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x45a55a['absolutePath'][_0x4d4a04(0x1a1)](/([^/]+)$/,_0x4d4a04(0x183))+')\x20')+_0x4d4a04(0x172),_0xeeeb92);}else throw _0xeeeb92;}return saveSegmentToPushRecovery(_0x45a55a['absolutePath'],_0x45a55a[_0x4d4a04(0x1e6)][_0x4d4a04(0x174)],_0x177c4d['localName'],{'segmentId':_0x5666f6,'uniqueServerName':_0x177c4d[_0x4d4a04(0x207)],'createdAt':new Date()[_0x4d4a04(0x218)]()}),_0x5666f6;}export async function prepareSegmentFiles(_0x958ca2,_0x22ebda,_0x4e337b,_0x28b76a,_0x3791a0){const _0x3fefd0=a136_0x5a0a93,{activationDefToCreateRequest:_0x7414b2}=await import(_0x3fefd0(0x24c)),_0x18b550=[],_0x5740c3=new Set();for(const {yamlConfig:_0x26c36b,folderPath:_0x32aab8,sourcePath:_0x38e186}of _0x958ca2){const _0x59dcfb=resolveTDFolderPath(_0x32aab8,_0x28b76a,_0x3791a0),_0x49d60b=_0x59dcfb+':'+_0x26c36b[_0x3fefd0(0x174)],_0x3e5848=_0x22ebda[_0x3fefd0(0x222)][_0x3fefd0(0x18a)](_0x49d60b),_0x53e861=_0x3e5848?_0x22ebda[_0x3fefd0(0x23d)][_0x3fefd0(0x18a)](_0x3e5848['id'])||[]:[];addFoldersToCreate(_0x59dcfb,_0x22ebda[_0x3fefd0(0x1cb)],_0x5740c3);const _0x119c15=calculateActivationActions(_0x26c36b[_0x3fefd0(0x1ae)]||[],_0x53e861,_0x22ebda[_0x3fefd0(0x1e0)],_0x22ebda[_0x3fefd0(0x23f)]);for(const _0x9b306b of _0x119c15){(_0x9b306b[_0x3fefd0(0x1ab)]===_0x3fefd0(0x1ac)||_0x9b306b[_0x3fefd0(0x1ab)]===_0x3fefd0(0x165))&&_0x9b306b['yamlActivation']&&(_0x9b306b[_0x3fefd0(0x1b7)]=await _0x7414b2(_0x9b306b[_0x3fefd0(0x1cf)],_0x4e337b));}const _0x455765=calculateSegmentDiff(_0x26c36b,_0x3e5848,_0x53e861,_0x22ebda[_0x3fefd0(0x1e0)],_0x22ebda[_0x3fefd0(0x23f)]);_0x18b550[_0x3fefd0(0x164)]({'relativePath':_0x26c36b[_0x3fefd0(0x174)],'absolutePath':_0x38e186,'yamlConfig':_0x26c36b,'folderPath':_0x59dcfb,'existingSegment':_0x3e5848,'existingActivations':_0x53e861,'isNew':_0x455765[_0x3fefd0(0x224)],'hasChanges':_0x455765[_0x3fefd0(0x210)],'diff':_0x455765['diff'],'activationActions':_0x119c15});}return{'segmentFiles':_0x18b550,'foldersToCreate':_0x5740c3};}export async function prepareJourneyFiles(_0x31841c,_0x48e0bd,_0x3e66ee,_0x2ea0c9){const _0x153dc7=a136_0x5a0a93,_0x57504c=[],_0x255f19=new Set();for(const {yamlConfig:_0x5f073f,folderPath:_0x99a833,sourcePath:_0x74be7c}of _0x31841c){const _0x1382dc=resolveTDFolderPath(_0x99a833,_0x3e66ee,_0x2ea0c9),_0x5b2d2e=_0x1382dc+':'+_0x5f073f['name'],_0x1d5fb6=_0x48e0bd[_0x153dc7(0x1d3)][_0x153dc7(0x18a)](_0x5b2d2e);let _0x3d9da8,_0x58daa1;if(_0x1d5fb6&&_0x1d5fb6['length']>0x0){const _0x34a74b=buildLocalExpandedRuleMappings(_0x5f073f),{createYamlContext:_0x53ae96,prefetchJourneySegments:_0x1599bf}=createPushYamlContextForBundle(_0x48e0bd[_0x153dc7(0x175)],_0x48e0bd[_0x153dc7(0x201)],_0x48e0bd['existingSegments'],_0x34a74b,_0x48e0bd['idToEmailMap'],_0x48e0bd[_0x153dc7(0x23f)],_0x48e0bd[_0x153dc7(0x1d8)],_0x48e0bd[_0x153dc7(0x22f)]);await _0x1599bf(_0x1d5fb6[_0x153dc7(0x216)](_0x4eb3a2=>_0x4eb3a2['id']));const _0x71eb6b=await _0x48e0bd[_0x153dc7(0x175)][_0x153dc7(0x177)][_0x153dc7(0x1b6)](_0x1d5fb6[0x0][_0x153dc7(0x1e5)]),_0x4a42ce=hasMultipleVersions(_0x5f073f),_0xb33da6=async _0x2f0b10=>{const _0x32a048=_0x153dc7,_0x12b58d=_0x48e0bd[_0x32a048(0x22f)]?.[_0x32a048(0x18a)](_0x2f0b10);if(_0x12b58d)return _0x12b58d;return _0x48e0bd[_0x32a048(0x1af)]({'journeyId':_0x2f0b10,'journeyName':_0x5f073f[_0x32a048(0x174)],'isMultiVersion':_0x1d5fb6[_0x32a048(0x1a5)]>0x1});};if(_0x4a42ce&&_0x1d5fb6[_0x153dc7(0x1a5)]>0x1){const _0x166f33=[];for(const _0x2025ae of _0x1d5fb6){const _0x2762b8=_0x2025ae[_0x153dc7(0x1d1)]||0x1;_0x48e0bd[_0x153dc7(0x1eb)]?.[_0x153dc7(0x165)]('Fetching\x20'+_0x5f073f[_0x153dc7(0x174)]+'\x20v'+_0x2762b8);const _0x1bb989=await _0xb33da6(_0x2025ae['id']),_0x410034=_0x53ae96(_0x2025ae['id']),_0x5c8625=await journeyResponseToDef(_0x1bb989,_0x410034);_0x166f33[_0x153dc7(0x164)]({'item':_0x2025ae,'yaml':_0x5c8625});}const _0x12dc17=buildLocalRuleToNameMappingFromJourney(_0x5f073f);_0x58daa1=buildMergedJourneyDef(_0x166f33,_0x12dc17,_0x71eb6b);const _0x4562a3=Math['max'](..._0x166f33['map'](_0xf8ee09=>_0xf8ee09['item'][_0x153dc7(0x1d1)]||0x0)),_0x5f381f=_0x1d5fb6[_0x153dc7(0x206)](_0x5794ed=>(_0x5794ed[_0x153dc7(0x1d1)]||0x0)===_0x4562a3);_0x5f381f&&(_0x48e0bd[_0x153dc7(0x1eb)]?.[_0x153dc7(0x165)](_0x153dc7(0x16b)+_0x5f073f[_0x153dc7(0x174)]+'\x20v'+_0x4562a3),_0x3d9da8=await _0xb33da6(_0x5f381f['id']));}else{const _0x34120e=_0x1d5fb6[_0x1d5fb6[_0x153dc7(0x1a5)]-0x1];_0x48e0bd[_0x153dc7(0x1eb)]?.['update'](_0x153dc7(0x16b)+_0x5f073f[_0x153dc7(0x174)]),_0x3d9da8=await _0xb33da6(_0x34120e['id']);const _0x21e249=_0x53ae96(_0x34120e['id']),_0x1fb749=await journeyResponseToDef(_0x3d9da8,_0x21e249),_0x498a7e=buildLocalRuleToNameMappingFromJourney(_0x5f073f);_0x58daa1=buildMergedJourneyDef([{'item':_0x34120e,'yaml':_0x1fb749}],_0x498a7e,_0x71eb6b);}}addFoldersToCreate(_0x1382dc,_0x48e0bd[_0x153dc7(0x1cb)],_0x255f19);const _0x14bc6d=calculateJourneyDiff(_0x5f073f,_0x58daa1);_0x57504c[_0x153dc7(0x164)]({'relativePath':_0x5f073f[_0x153dc7(0x174)],'absolutePath':_0x74be7c,'yamlConfig':_0x5f073f,'folderPath':_0x1382dc,'existingJourney':_0x3d9da8,'isNew':_0x14bc6d['isNew'],'hasChanges':_0x14bc6d['hasChanges'],'diff':_0x14bc6d['diff']});}return{'journeyFiles':_0x57504c,'foldersToCreate':_0x255f19};}export function calculateActivationActions(_0x38ce02,_0x4e4f6b,_0x3887b8,_0x4b89c9){const _0x2e1e60=a136_0x5a0a93,_0x3001f4=[],_0x348b57=new Map();for(const _0x515c3c of _0x4e4f6b){_0x348b57[_0x2e1e60(0x193)](_0x515c3c[_0x2e1e60(0x174)],_0x515c3c);}const _0x2f9478=new Map();for(const _0x35abb1 of _0x38ce02){_0x2f9478[_0x2e1e60(0x193)](_0x35abb1[_0x2e1e60(0x174)],_0x35abb1);}for(const _0x4ec7b4 of _0x38ce02){const _0x579bae=_0x348b57[_0x2e1e60(0x18a)](_0x4ec7b4[_0x2e1e60(0x174)]);if(!_0x579bae)_0x3001f4[_0x2e1e60(0x164)]({'type':_0x2e1e60(0x1ac),'name':_0x4ec7b4[_0x2e1e60(0x174)],'yamlActivation':_0x4ec7b4});else{const _0x13ea5e=activationResponseToDef(_0x579bae,_0x3887b8,_0x4b89c9),_0x4c7388=a136_0x2c0f26[_0x2e1e60(0x157)](_0x13ea5e),_0x51e7da=a136_0x2c0f26[_0x2e1e60(0x157)](_0x4ec7b4);_0x4c7388!==_0x51e7da&&_0x3001f4[_0x2e1e60(0x164)]({'type':_0x2e1e60(0x165),'name':_0x4ec7b4[_0x2e1e60(0x174)],'yamlActivation':_0x4ec7b4,'existingActivation':_0x579bae});}}for(const _0x1599e4 of _0x4e4f6b){!_0x2f9478[_0x2e1e60(0x245)](_0x1599e4['name'])&&_0x3001f4[_0x2e1e60(0x164)]({'type':_0x2e1e60(0x1b2),'name':_0x1599e4[_0x2e1e60(0x174)],'existingActivation':_0x1599e4});}return _0x3001f4;}function calculateYamlDiff(_0x4df667,_0x3b1135){if(_0x3b1135){const _0x3e197f=generateDiff(_0x3b1135,_0x4df667),_0x2f22b0=hasChanges(_0x3e197f);return{'isNew':![],'hasChanges':_0x2f22b0,'diff':_0x2f22b0?formatDiffWithColors(_0x3e197f):undefined};}const _0x56f1b8=generateDiff('',_0x4df667);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x56f1b8)};}export function calculateSegmentDiff(_0x431e16,_0x1f806f,_0x41ef81,_0x303d25,_0x55c7aa){const _0x3fb128=segmentToYamlString(_0x431e16),_0x3ec52b=_0x1f806f?segmentToYamlString(segmentWithActivationsToYaml(_0x1f806f,_0x41ef81,undefined,_0x303d25,_0x55c7aa)):undefined;return calculateYamlDiff(_0x3fb128,_0x3ec52b);}export function calculateJourneyDiff(_0x1224c5,_0x5ad5dd){const _0x1c9248=normalizeJourneyDef(_0x1224c5,_0x1224c5),_0x5f3d15=a136_0x5f2d71(_0x1c9248),_0x59a6ef=_0x5ad5dd?a136_0x5f2d71(normalizeJourneyDef(_0x5ad5dd,_0x1224c5)):undefined;return calculateYamlDiff(_0x5f3d15,_0x59a6ef);}export function findSegmentsToDelete(_0x57c29c,_0x581bd6,_0x453292,_0x13c1e7,_0x326d36){const _0x38effb=a136_0x5a0a93,_0x5317d2=new Set();for(const {yamlConfig:_0x78db52,folderPath:_0x29464c}of _0x581bd6){_0x5317d2[_0x38effb(0x1b5)](_0x29464c+':'+_0x78db52[_0x38effb(0x174)]);}return _0x57c29c[_0x38effb(0x15b)](_0x365bd0=>{const _0x54c30c=_0x38effb,_0x3789a5=_0x365bd0['segmentFolderId']?_0x453292[_0x54c30c(0x18a)](_0x365bd0[_0x54c30c(0x1a4)]['toString']())||'':'',_0x26e9b5=_0x3789a5+':'+_0x365bd0[_0x54c30c(0x174)];if(_0x5317d2['has'](_0x26e9b5))return![];if(_0x326d36)return _0x3789a5===_0x13c1e7||_0x3789a5['startsWith'](_0x13c1e7+'/');return!![];});}export function findJourneysToDelete(_0x2611fc,_0x399ab5,_0x5be5c6,_0x24517,_0x45164b){const _0x3c2882=a136_0x5a0a93,_0x135492=new Set();for(const {yamlConfig:_0x49a43a,folderPath:_0x3d1bf4}of _0x399ab5){_0x135492[_0x3c2882(0x1b5)](_0x3d1bf4+':'+_0x49a43a[_0x3c2882(0x174)]);}return _0x2611fc[_0x3c2882(0x15b)](_0x225ea3=>{const _0xe3f834=_0x3c2882,_0x4b4f30=_0x225ea3['folderId']?_0x5be5c6[_0xe3f834(0x18a)](_0x225ea3[_0xe3f834(0x18e)])||'':'',_0x5416e1=_0x4b4f30+':'+_0x225ea3['journeyBundleName'];if(_0x135492['has'](_0x5416e1))return![];if(_0x45164b)return _0x4b4f30===_0x24517||_0x4b4f30[_0xe3f834(0x200)](_0x24517+'/');return!![];});}export function buildSegmentLookupMap(_0x4ca3ee,_0x5c03e7){const _0x21577f=a136_0x5a0a93,_0x5a701f=new Map();for(const _0x35d1ba of _0x4ca3ee){const _0x90e6f5=_0x35d1ba[_0x21577f(0x1a4)]?_0x5c03e7[_0x21577f(0x18a)](_0x35d1ba['segmentFolderId']['toString']())||'':'',_0x341f5d=_0x90e6f5+':'+_0x35d1ba[_0x21577f(0x174)];_0x5a701f['set'](_0x341f5d,_0x35d1ba);}return _0x5a701f;}export function buildSegmentNameToIdMap(_0x3edc6c){const _0x218dfd=a136_0x5a0a93,_0xd16058=new Map();for(const _0x19932b of _0x3edc6c){_0xd16058[_0x218dfd(0x193)](_0x19932b['name'],_0x19932b['id']);}return _0xd16058;}export function buildJourneyBundleLookupMap(_0x34ed07,_0xb2c7e0){const _0x3302ae=a136_0x5a0a93,_0x5093eb=new Map();for(const _0x1a8df9 of _0x34ed07){const _0x551030=_0x1a8df9['folderId']?_0xb2c7e0['get'](_0x1a8df9[_0x3302ae(0x18e)])||'':'',_0x5b1e71=_0x551030+':'+_0x1a8df9[_0x3302ae(0x1ad)];!_0x5093eb[_0x3302ae(0x245)](_0x5b1e71)&&_0x5093eb[_0x3302ae(0x193)](_0x5b1e71,[]),_0x5093eb['get'](_0x5b1e71)[_0x3302ae(0x164)](_0x1a8df9);}for(const _0xcdf489 of _0x5093eb[_0x3302ae(0x1dd)]()){_0xcdf489[_0x3302ae(0x1f6)]((_0x227f3d,_0x4d03e0)=>(_0x227f3d['versionNumber']||0x0)-(_0x4d03e0[_0x3302ae(0x1d1)]||0x0));}return _0x5093eb;}export function collectFoldersToCreate(_0x2fea44,_0x24db58){const _0xbf14b1=a136_0x5a0a93,_0x27ce8d=new Set();for(const _0x4d7a6a of _0x2fea44){if(!_0x4d7a6a)continue;if(_0x24db58[_0xbf14b1(0x245)](_0x4d7a6a))continue;const _0x2c05c3=_0x4d7a6a[_0xbf14b1(0x220)]('/');let _0x3c2008='';for(const _0x489a03 of _0x2c05c3){_0x3c2008=_0x3c2008?_0x3c2008+'/'+_0x489a03:_0x489a03,!_0x24db58[_0xbf14b1(0x245)](_0x3c2008)&&_0x27ce8d[_0xbf14b1(0x1b5)](_0x3c2008);}}return _0x27ce8d;}export function parseAndClassifyYamlFiles(_0x52c9f2,_0x48d710,_0x1c4dfb){const _0x292af6=a136_0x5a0a93,_0x26d6aa=[],_0x449189=[];for(const _0xe9be7e of _0x52c9f2){const _0x386abf=a136_0x3b9c1d[_0x292af6(0x22a)](_0x48d710,a136_0x3b9c1d[_0x292af6(0x1b1)](_0xe9be7e)),_0x1fc09f=_0x386abf==='.'?'':_0x386abf,_0x1c7e6d=readFileSync(_0xe9be7e,_0x292af6(0x1c0)),_0x12595e=a136_0x2c0f26['parse'](_0x1c7e6d);if(isJourneyDef(_0x12595e)){const _0x572c57=a136_0xd5b269(_0x1c7e6d);_0x449189['push']({'yamlConfig':_0x572c57,'folderPath':_0x1fc09f,'sourcePath':_0xe9be7e});}else{if(!_0x1c4dfb?.[_0x292af6(0x228)]){const _0x141e7b=parseSegmentYamlFile(_0x1c7e6d),_0x5104f5=normalizeChildSegmentYaml(_0x141e7b);_0x26d6aa[_0x292af6(0x164)]({'yamlConfig':_0x5104f5,'folderPath':_0x1fc09f,'sourcePath':_0xe9be7e});}}}return{'segments':_0x26d6aa,'journeys':_0x449189};}export function validateParsedFiles(_0x2cd759,_0xb7ab67){const _0x389e34=a136_0x5a0a93,_0xed663a=[];for(const {yamlConfig:_0x1d5534,sourcePath:_0x141915}of _0x2cd759['segments']){const _0x34f4ee=readFileSync(_0x141915,_0x389e34(0x1c0)),_0x4d8498=a136_0x2c0f26[_0x389e34(0x1a9)](_0x34f4ee),_0x5e5623=validateSegmentDef(_0x1d5534,{'source':_0x34f4ee,'document':_0x4d8498},{'skipSchema':!![]});if(!_0x5e5623[_0x389e34(0x15d)]){const _0x57ccca=a136_0x3b9c1d[_0x389e34(0x22a)](_0xb7ab67,_0x141915);_0xed663a[_0x389e34(0x164)]({'filePath':_0x57ccca,'source':_0x34f4ee,'result':_0x5e5623,'isJourney':![]});}}for(const {yamlConfig:_0x28fbba,sourcePath:_0x5653ad}of _0x2cd759[_0x389e34(0x244)]){const _0x2a6892=readFileSync(_0x5653ad,'utf-8'),_0x13d47c=a136_0x2c0f26[_0x389e34(0x1a9)](_0x2a6892),_0x409332=validateJourneyDef(_0x28fbba,{'source':_0x2a6892,'document':_0x13d47c},{'skipSchema':!![]});if(!_0x409332[_0x389e34(0x15d)]){const _0x142fb7=a136_0x3b9c1d[_0x389e34(0x22a)](_0xb7ab67,_0x5653ad);_0xed663a[_0x389e34(0x164)]({'filePath':_0x142fb7,'source':_0x2a6892,'result':_0x409332,'isJourney':!![]});}}return _0xed663a;}export function formatValidationErrors(_0x2bed6b){const _0x2f5bda=a136_0x5a0a93,_0x5e5ed2=[];for(const {filePath:_0xcdfb4,source:_0x150b3d,result:_0x1bceb8,isJourney:_0x8fc7fd}of _0x2bed6b){const _0x38bd30=_0x8fc7fd?_0x2f5bda(0x177):_0x2f5bda(0x225);_0x5e5ed2['push']('\x0a'+_0xcdfb4+'\x20('+_0x38bd30+_0x2f5bda(0x185)+_0x1bceb8[_0x2f5bda(0x168)][_0x2f5bda(0x1a5)]+_0x2f5bda(0x1aa)),_0x5e5ed2[_0x2f5bda(0x164)](formatValidationResult(_0x1bceb8,_0x150b3d,_0xcdfb4));}return _0x5e5ed2[_0x2f5bda(0x195)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x1a660e){const _0x323f2d=a136_0x5a0a93,_0x358c57=new Set(),_0x29585f=new Map(),_0x389090=collectSegmentUsageCounts(_0x1a660e);if(_0x1a660e['segments'])for(const [_0x1fd2d8,_0x42d154]of Object[_0x323f2d(0x226)](_0x1a660e[_0x323f2d(0x1b3)])){_0x358c57[_0x323f2d(0x1b5)](_0x1fd2d8);if(_0x42d154['rule']){const _0x3b0554=yamlRuleToApi(_0x42d154[_0x323f2d(0x182)]),_0x4f3d13=apiRuleToYaml(_0x3b0554);_0x29585f[_0x323f2d(0x193)](_0x1fd2d8,_0x4f3d13);}}const _0x12aa5a=new Map();let _0x29fa8c=0x0;for(const [_0x3290c6,_0x1f32a2]of _0x29585f){const _0x3952ab=serializeExpandedRule(_0x1f32a2,_0x29585f),_0xfc8d1f=_0x12aa5a[_0x323f2d(0x18a)](_0x3952ab)||[];_0xfc8d1f[_0x323f2d(0x164)]({'name':_0x3290c6,'index':_0x29fa8c}),_0x12aa5a[_0x323f2d(0x193)](_0x3952ab,_0xfc8d1f),_0x29fa8c++;}const _0x2408e2=new Map();for(const [_0x2e339c,_0x414eb3]of _0x12aa5a){const _0x286019=_0x414eb3['slice']()[_0x323f2d(0x1f6)]((_0x3d46ee,_0x4a2d1e)=>{const _0x514d05=_0x323f2d,_0x178e32=_0x389090[_0x514d05(0x18a)](_0x3d46ee[_0x514d05(0x174)])||0x0,_0x571676=_0x389090[_0x514d05(0x18a)](_0x4a2d1e[_0x514d05(0x174)])||0x0;if(_0x178e32!==_0x571676)return _0x571676-_0x178e32;return _0x3d46ee[_0x514d05(0x1c6)]-_0x4a2d1e[_0x514d05(0x1c6)];})[_0x323f2d(0x216)](_0x2f7942=>_0x2f7942['name']),_0x163d6f=[];for(const _0x18da09 of _0x286019){const _0x2eb035=_0x389090[_0x323f2d(0x18a)](_0x18da09)||0x0,_0x41420d=Math[_0x323f2d(0x215)](_0x2eb035,0x1);for(let _0x33e366=0x0;_0x33e366<_0x41420d;_0x33e366++){_0x163d6f[_0x323f2d(0x164)](_0x18da09);}}_0x2408e2['set'](_0x2e339c,_0x163d6f);}return{'existingLocalSegmentNames':_0x358c57,'localSegmentRules':_0x29585f,'localExpandedRuleToNames':_0x2408e2};}export function createSegmentIdResolver(_0x362eb4,_0x957774){return async _0xd4f07d=>{const _0x28ef10=a136_0x3302,_0x2c1cb3=_0x362eb4[_0x28ef10(0x18a)](_0xd4f07d);if(!_0x2c1cb3)throw new SDKError(ErrorCode[_0x28ef10(0x212)],_0x28ef10(0x1cd)+_0xd4f07d+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x957774+'\x27)');return _0x2c1cb3;};}export function extractRootFolderId(_0x3d0f87){const _0x16f5d6=a136_0x5a0a93;return _0x3d0f87['relationships']?.['parentSegmentFolder']?.[_0x16f5d6(0x1f5)]?.['id']||_0x3d0f87[_0x16f5d6(0x20f)]?.[_0x16f5d6(0x1c8)]?.[_0x16f5d6(0x1f5)]?.['id'];}export function buildConnectionMaps(_0x34e5c1){const _0x476262=a136_0x5a0a93,_0x18ab16=new Map(),_0x5b8633=new Map(),_0x51f139=new Map();for(const _0x1cdd8c of _0x34e5c1){_0x18ab16[_0x476262(0x193)](_0x1cdd8c[_0x476262(0x174)],parseInt(_0x1cdd8c['id'],0xa)),_0x5b8633[_0x476262(0x193)](_0x1cdd8c['id'],_0x1cdd8c['name']),_0x51f139[_0x476262(0x193)](_0x1cdd8c['name'],_0x1cdd8c['type']);}return{'nameToId':_0x18ab16,'idToName':_0x5b8633,'nameToType':_0x51f139};}export function calculatePushStats(_0x4fd060,_0x222444,_0x5cbb48,_0x296c6c,_0x5a089f,_0x4cd3f3,_0x4175ec){const _0x144a64=a136_0x5a0a93,_0x530dff=_0x4fd060['filter'](_0x38c4fa=>_0x38c4fa[_0x144a64(0x224)]),_0x34199d=_0x4fd060[_0x144a64(0x15b)](_0x364d64=>!_0x364d64['isNew']&&_0x364d64['hasChanges']),_0x55f5b4=_0x4fd060[_0x144a64(0x15b)](_0x26e6e1=>!_0x26e6e1['isNew']&&!_0x26e6e1['hasChanges']),_0x5d7467=_0x4cd3f3?_0x296c6c:[],_0x12b3f7=_0x222444[_0x144a64(0x15b)](_0x334f6=>_0x334f6['isNew']),_0x34967e=_0x222444[_0x144a64(0x15b)](_0x416244=>!_0x416244[_0x144a64(0x224)]&&_0x416244[_0x144a64(0x210)]),_0x531170=_0x222444['filter'](_0xc6c0db=>!_0xc6c0db[_0x144a64(0x224)]&&!_0xc6c0db['hasChanges']),_0xd18304=_0x4cd3f3?_0x5a089f:[],_0x3b355e=_0x4fd060[_0x144a64(0x166)](_0x23555e=>_0x23555e[_0x144a64(0x190)]),_0x4a84d8=_0x3b355e[_0x144a64(0x15b)](_0x22b289=>_0x22b289[_0x144a64(0x1ab)]===_0x144a64(0x1ac)),_0x29bf0a=_0x3b355e['filter'](_0x3e2827=>_0x3e2827[_0x144a64(0x1ab)]===_0x144a64(0x165)),_0x3f6d34=_0x3b355e[_0x144a64(0x15b)](_0x5cdaee=>_0x5cdaee[_0x144a64(0x1ab)]===_0x144a64(0x1b2)),_0x405ff1=Array[_0x144a64(0x161)](_0x5cbb48)['sort'](),_0x4b47a8=_0x4175ec?![]:_0x530dff[_0x144a64(0x1a5)]>0x0||_0x34199d[_0x144a64(0x1a5)]>0x0||_0x5d7467['length']>0x0,_0xb04c6a=_0x12b3f7[_0x144a64(0x1a5)]>0x0||_0x34967e['length']>0x0||_0xd18304['length']>0x0,_0x128227=_0x4175ec?![]:_0x3b355e[_0x144a64(0x1a5)]>0x0,_0x282dc8=_0x405ff1[_0x144a64(0x1a5)]>0x0;return{'segments':{'new':_0x530dff,'changed':_0x34199d,'unchanged':_0x55f5b4,'toDelete':_0x5d7467},'journeys':{'new':_0x12b3f7,'changed':_0x34967e,'unchanged':_0x531170,'toDelete':_0xd18304},'activations':{'all':_0x3b355e,'toCreate':_0x4a84d8,'toUpdate':_0x29bf0a,'toDelete':_0x3f6d34},'folders':{'toCreate':_0x405ff1},'counts':{'segments':{'new':_0x530dff[_0x144a64(0x1a5)],'changed':_0x34199d[_0x144a64(0x1a5)],'unchanged':_0x55f5b4['length'],'toDelete':_0x5d7467[_0x144a64(0x1a5)]},'journeys':{'new':_0x12b3f7[_0x144a64(0x1a5)],'changed':_0x34967e['length'],'unchanged':_0x531170[_0x144a64(0x1a5)],'toDelete':_0xd18304['length']},'activations':{'create':_0x4a84d8[_0x144a64(0x1a5)],'update':_0x29bf0a[_0x144a64(0x1a5)],'delete':_0x3f6d34[_0x144a64(0x1a5)]},'folders':_0x405ff1['length']},'hasChanges':_0x4b47a8||_0xb04c6a||_0x128227||_0x282dc8};}export async function buildPushExecutionContext(_0x43ea9a,_0x10b206,_0x405d99,_0x148c5e,_0x4abd3b,_0x380330){const _0x374c55=a136_0x5a0a93,_0x5e4aa9=extractRootFolderId(_0x405d99),{pathToId:_0x47f2c3,idToPath:_0x5b2747}=buildFolderMaps(_0x4abd3b),_0x3848eb=buildSegmentNameToIdMap(_0x148c5e),_0xbcaa9f=new Map(),{batchAsync:_0x382272}=await import(_0x374c55(0x1ed)),[_0x1892b3,_0x333310]=await Promise['all']([_0x43ea9a['user'][_0x374c55(0x234)](),_0x43ea9a['connection'][_0x374c55(0x18b)](),((async()=>{!_0x380330&&_0x148c5e['length']>0x0&&await _0x382272(_0x148c5e,async _0x6381f1=>{const _0x5e6cdb=a136_0x3302,_0x5f74ef=await _0x43ea9a['segment'][_0x5e6cdb(0x15f)](_0x10b206,_0x6381f1['id']);_0xbcaa9f[_0x5e6cdb(0x193)](_0x6381f1['id'],_0x5f74ef);});})())]),{emailToId:_0x2c4c6a,idToEmail:_0x4d02ba}=_0x1892b3,_0x13fb6f=buildConnectionMaps(_0x333310);return{'rootFolderId':_0x5e4aa9,'folderPathToId':_0x47f2c3,'folderIdToPath':_0x5b2747,'segmentNameToId':_0x3848eb,'activationsBySegmentId':_0xbcaa9f,'emailToIdMap':_0x2c4c6a,'idToEmailMap':_0x4d02ba,'connectionNameToIdMap':_0x13fb6f[_0x374c55(0x233)],'connectionIdToNameMap':_0x13fb6f['idToName'],'connectionNameToTypeMap':_0x13fb6f[_0x374c55(0x246)]};}export function createPushYamlContextForBundle(_0x37936b,_0x4d8517,_0x5cdeae,_0x437725,_0x25cac3,_0x3a9cf5,_0x38244f,_0x41d595){const {existingLocalSegmentNames:_0x46973e,localExpandedRuleToNames:_0x155913}=_0x437725,_0x27e4d7=new Set(),_0x280406=new Map(),_0x29c0a1=new Map(),_0x4921db=new Map(),_0x1a633c=createJumpTargetCache(),_0x28633=new Map(),_0x56e561=new Map(),_0x400096=new Set();let _0x58e592;const _0x47ff4b=_0x134942=>{const _0x5e0959={'resolveSegment':async _0x3d3113=>{const _0x2ff3a4=a136_0x3302,_0x5a3ab3=_0x4921db[_0x2ff3a4(0x18a)](_0x3d3113);if(_0x5a3ab3!==undefined)return{'name':_0x5a3ab3,'isJourneyLocal':!![]};try{const _0x54d45d=await fetchSegment(_0x37936b,_0x4d8517,_0x3d3113,_0x5cdeae);if(!_0x54d45d)throw new Error('Segment\x20not\x20found');const _0x93cd5a=generateJourneyLocalName(_0x54d45d[_0x2ff3a4(0x174)]),_0x2cfafa=_0x54d45d['kind']===SEGMENT_KIND_JOURNEY&&_0x93cd5a!==undefined;let _0x43f6d9=_0x54d45d[_0x2ff3a4(0x174)],_0xcd0bab;if(_0x2cfafa&&_0x54d45d[_0x2ff3a4(0x182)]){const _0x32a74a=apiRuleToYaml(_0x54d45d[_0x2ff3a4(0x182)]);_0x56e561['set'](_0x3d3113,_0x32a74a);const _0x51c70b=async _0x178cf1=>{const _0x2522bb=_0x2ff3a4,_0x4cf954=collectSegmentRefsFromRule(_0x178cf1);for(const _0x5646fa of _0x4cf954){if(!_0x56e561[_0x2522bb(0x245)](_0x5646fa))try{const _0x2e4808=await fetchSegment(_0x37936b,_0x4d8517,_0x5646fa,_0x5cdeae);if(_0x2e4808?.[_0x2522bb(0x182)]){const _0x3952ac=apiRuleToYaml(_0x2e4808[_0x2522bb(0x182)]);_0x56e561[_0x2522bb(0x193)](_0x5646fa,_0x3952ac),await _0x51c70b(_0x3952ac);}}catch(_0x3c3749){logger[_0x2522bb(0x20b)](_0x2522bb(0x236)+_0x5646fa+':\x20'+_0x3c3749);}}};await _0x51c70b(_0x32a74a);const _0xb9e080=serializeExpandedRule(_0x32a74a,_0x56e561),_0x2dba10=_0x155913[_0x2ff3a4(0x18a)](_0xb9e080);if(_0x2dba10&&_0x2dba10[_0x2ff3a4(0x1a5)]>0x0){const _0x34d307=_0x280406[_0x2ff3a4(0x18a)](_0xb9e080)||0x0,_0x3fe84a=_0x2dba10[_0x34d307]||_0x2dba10[_0x2dba10[_0x2ff3a4(0x1a5)]-0x1];_0x280406[_0x2ff3a4(0x193)](_0xb9e080,_0x34d307+0x1),_0x43f6d9=_0x3fe84a,_0x27e4d7['add'](_0x43f6d9),_0x4921db[_0x2ff3a4(0x193)](_0x3d3113,_0x43f6d9);const _0x7b6968=await resolveRuleSegmentRefs(_0x32a74a,async _0x650d57=>{const _0x6b4eb8=_0x2ff3a4,_0x171130=_0x4921db[_0x6b4eb8(0x18a)](_0x650d57);if(_0x171130)return _0x171130;const _0x52ab89=await _0x58e592[_0x6b4eb8(0x1be)](_0x650d57);return _0x52ab89[_0x6b4eb8(0x174)];});_0xcd0bab={'description':_0x54d45d[_0x2ff3a4(0x1ff)],'rule':_0x7b6968};}else{const _0x56f9c3=_0x28633[_0x2ff3a4(0x18a)](_0xb9e080);if(_0x56f9c3)_0x43f6d9=_0x56f9c3,_0x4921db[_0x2ff3a4(0x193)](_0x3d3113,_0x43f6d9);else{if(_0x93cd5a){let _0x1a9ce4=_0x93cd5a,_0x426916=0x2;while(_0x27e4d7[_0x2ff3a4(0x245)](_0x1a9ce4)||_0x46973e[_0x2ff3a4(0x245)](_0x1a9ce4)){_0x1a9ce4=_0x93cd5a+'_'+_0x426916,_0x426916++;}_0x27e4d7[_0x2ff3a4(0x1b5)](_0x1a9ce4),_0x43f6d9=_0x1a9ce4;}_0x4921db['set'](_0x3d3113,_0x43f6d9),_0x28633[_0x2ff3a4(0x193)](_0xb9e080,_0x43f6d9);const _0x425448=await resolveRuleSegmentRefs(_0x32a74a,async _0xc8687c=>{const _0xe63a5b=_0x2ff3a4,_0x1cea60=_0x4921db[_0xe63a5b(0x18a)](_0xc8687c);if(_0x1cea60)return _0x1cea60;const _0x4a8fa6=await _0x58e592[_0xe63a5b(0x1be)](_0xc8687c);return _0x4a8fa6[_0xe63a5b(0x174)];});_0xcd0bab={'description':_0x54d45d['description'],'rule':_0x425448};}}}return{'name':_0x43f6d9,'isJourneyLocal':_0x2cfafa,'definition':_0xcd0bab};}catch(_0x58ed40){return logger[_0x2ff3a4(0x20b)](_0x2ff3a4(0x154)+_0x3d3113+':\x20'+_0x58ed40),{'name':_0x3d3113,'isJourneyLocal':![]};}},'resolveActivation':async _0x573fb3=>{const _0x52750f=a136_0x3302,_0x1d5c71=_0x29c0a1['get'](_0x573fb3);if(_0x1d5c71!==undefined)return{'name':_0x1d5c71,'isJourneyLocal':!![]};try{let _0x32c2c4=_0x38244f?.[_0x52750f(0x18a)](_0x573fb3);!_0x32c2c4&&(_0x32c2c4=await _0x37936b['journey'][_0x52750f(0x1e4)](_0x134942,_0x573fb3));const _0x27e4d8=_0x32c2c4[_0x52750f(0x16e)]['activationParams'][_0x52750f(0x174)]||_0x573fb3,_0x46e368=sanitizeYamlKey(_0x27e4d8)||_0x52750f(0x208)+_0x573fb3,_0x285367=_0x46e368;_0x29c0a1[_0x52750f(0x193)](_0x573fb3,_0x285367);const _0x49d4ea=journeyActivationStepToYaml(_0x32c2c4,_0x25cac3,_0x3a9cf5);return{'name':_0x285367,'isJourneyLocal':!![],'definition':_0x49d4ea};}catch(_0x43f0c4){return logger[_0x52750f(0x20b)](_0x52750f(0x230)+_0x573fb3+':\x20'+_0x43f0c4),{'name':_0x573fb3,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x164b05,_0x5950aa)=>resolveJumpTarget(_0x164b05,_0x5950aa,_0x1a633c,async _0x3c4693=>{const _0x32feab=a136_0x3302,_0x3cc931=_0x41d595?.[_0x32feab(0x18a)](_0x3c4693);if(_0x3cc931)return _0x3cc931;return _0x37936b[_0x32feab(0x177)][_0x32feab(0x1f2)](_0x3c4693);})};return _0x58e592=_0x5e0959,_0x5e0959;},_0x102166=async _0x2ae65f=>{const _0x1fc968=a136_0x3302,{collectSegmentIdsFromJourneyApi:_0xc7accd}=await import(_0x1fc968(0x15e)),{batchAsync:_0x4e1d92}=await import('../../utils/async.js'),_0x9ce424=new Set();for(const _0x158706 of _0x2ae65f){let _0x555dfe=_0x41d595?.[_0x1fc968(0x18a)](_0x158706);!_0x555dfe&&(_0x555dfe=await _0x37936b[_0x1fc968(0x177)][_0x1fc968(0x1f2)](_0x158706));const _0x4457ba=_0xc7accd(_0x555dfe);for(const _0x26f522 of _0x4457ba){_0x9ce424[_0x1fc968(0x1b5)](_0x26f522);}}let _0x48eaf8=Array[_0x1fc968(0x161)](_0x9ce424);while(_0x48eaf8[_0x1fc968(0x1a5)]>0x0){const _0xbbc503=_0x48eaf8[_0x1fc968(0x15b)](_0x5ca794=>!_0x400096[_0x1fc968(0x245)](_0x5ca794));if(_0xbbc503[_0x1fc968(0x1a5)]===0x0)break;const _0x41ea9c=await _0x4e1d92(_0xbbc503,async _0x319d6d=>{const _0x300c4f=_0x1fc968;_0x400096[_0x300c4f(0x1b5)](_0x319d6d);const _0x612982=await fetchSegment(_0x37936b,_0x4d8517,_0x319d6d,_0x5cdeae);if(!_0x612982)return null;return{'segmentId':_0x319d6d,'segment':_0x612982};},0xa),_0x3726f5=new Set();for(const _0x55071b of _0x41ea9c){if(!_0x55071b?.[_0x1fc968(0x225)]?.[_0x1fc968(0x182)])continue;const _0x9d38d1=apiRuleToYaml(_0x55071b[_0x1fc968(0x225)][_0x1fc968(0x182)]);_0x56e561[_0x1fc968(0x193)](_0x55071b[_0x1fc968(0x21d)],_0x9d38d1);const _0x50cbd3=collectSegmentRefsFromRule(_0x9d38d1);for(const _0x827d4 of _0x50cbd3){!_0x400096[_0x1fc968(0x245)](_0x827d4)&&_0x3726f5[_0x1fc968(0x1b5)](_0x827d4);}}_0x48eaf8=Array[_0x1fc968(0x161)](_0x3726f5);}};return{'createYamlContext':_0x47ff4b,'prefetchJourneySegments':_0x102166};}export async function executePushSegments(_0x1914cf,_0x49a71f,_0x139b3b,_0x2f473d,_0xdf4e17){const _0x43117e=a136_0x5a0a93,{segmentDefToCreateRequest:_0x3a6881,segmentDefToUpdateRequest:_0x2e2764}=await import(_0x43117e(0x24c)),_0x153ab9=_0x139b3b[_0x43117e(0x1cb)],_0x390dd6=0x5,_0x561fa4=async _0x248d1f=>{const _0x5ecbb0=_0x43117e,_0x2306a2=_0x248d1f[_0x5ecbb0(0x18c)]?_0x153ab9[_0x5ecbb0(0x18a)](_0x248d1f[_0x5ecbb0(0x18c)]):undefined;let _0x2ce387;const _0x1ed2f3={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x2c61fd=_0x248d1f[_0x5ecbb0(0x1e6)];if(_0x248d1f[_0x5ecbb0(0x1e6)][_0x5ecbb0(0x182)]){const _0x4f5c92=createSegmentIdResolver(_0x139b3b['segmentNameToId'],_0x248d1f[_0x5ecbb0(0x1e6)][_0x5ecbb0(0x174)]),_0x43e1c5=await resolveRuleSegmentIds(_0x248d1f[_0x5ecbb0(0x1e6)]['rule'],_0x4f5c92);_0x2c61fd={..._0x248d1f[_0x5ecbb0(0x1e6)],'rule':_0x43e1c5};}try{if(_0x248d1f[_0x5ecbb0(0x224)]){_0xdf4e17[_0x5ecbb0(0x1ba)]?.({'type':_0x5ecbb0(0x1e9),'name':_0x248d1f[_0x5ecbb0(0x1e6)][_0x5ecbb0(0x174)]});const _0x40ad2a=_0x3a6881(_0x2c61fd,_0x2306a2),_0x59ccb9=await _0xdf4e17[_0x5ecbb0(0x19d)](_0x5ecbb0(0x1d6)+_0x248d1f[_0x5ecbb0(0x1e6)][_0x5ecbb0(0x174)]+_0x5ecbb0(0x187),()=>_0x1914cf[_0x5ecbb0(0x225)][_0x5ecbb0(0x20d)](_0x2f473d[_0x5ecbb0(0x201)],_0x40ad2a));_0x2ce387=_0x59ccb9[_0x5ecbb0(0x1f5)]['id'],_0x139b3b[_0x5ecbb0(0x1fe)][_0x5ecbb0(0x193)](_0x248d1f[_0x5ecbb0(0x1e6)][_0x5ecbb0(0x174)],_0x2ce387),_0x1ed2f3['createdSegmentId']={'name':_0x248d1f['yamlConfig'][_0x5ecbb0(0x174)],'id':_0x2ce387},_0xdf4e17[_0x5ecbb0(0x1ba)]?.({'type':'segment_created','name':_0x248d1f[_0x5ecbb0(0x1e6)][_0x5ecbb0(0x174)],'segmentId':_0x2ce387}),_0xdf4e17['logSuccess']?.(_0x5ecbb0(0x1a6)+_0x248d1f[_0x5ecbb0(0x1e6)][_0x5ecbb0(0x174)]+'\x27'),_0x1ed2f3[_0x5ecbb0(0x21c)]=0x1;}else{if(_0x248d1f[_0x5ecbb0(0x210)]){_0xdf4e17[_0x5ecbb0(0x1ba)]?.({'type':_0x5ecbb0(0x24a),'name':_0x248d1f[_0x5ecbb0(0x1e6)]['name']});const _0x129712=_0x2e2764(_0x2c61fd);_0x2306a2!==_0x248d1f[_0x5ecbb0(0x1f1)]?.[_0x5ecbb0(0x1a4)]&&(_0x129712[_0x5ecbb0(0x1a4)]=_0x2306a2?parseInt(_0x2306a2,0xa):undefined),await _0xdf4e17[_0x5ecbb0(0x19d)](_0x5ecbb0(0x17c)+_0x248d1f[_0x5ecbb0(0x1e6)][_0x5ecbb0(0x174)]+_0x5ecbb0(0x187),()=>_0x1914cf[_0x5ecbb0(0x225)][_0x5ecbb0(0x18f)](_0x2f473d[_0x5ecbb0(0x201)],_0x248d1f[_0x5ecbb0(0x1f1)]['id'],_0x129712)),_0x2ce387=_0x248d1f[_0x5ecbb0(0x1f1)]['id'],_0xdf4e17[_0x5ecbb0(0x1ba)]?.({'type':_0x5ecbb0(0x159),'name':_0x248d1f[_0x5ecbb0(0x1e6)][_0x5ecbb0(0x174)]}),_0xdf4e17[_0x5ecbb0(0x198)]?.(_0x5ecbb0(0x188)+_0x248d1f[_0x5ecbb0(0x1e6)][_0x5ecbb0(0x174)]+'\x27'),_0x1ed2f3[_0x5ecbb0(0x171)]=0x1;}else _0x2ce387=_0x248d1f[_0x5ecbb0(0x1f1)]['id'];}}catch(_0x1c21f8){const _0x4da797=isHttp400Error(_0x1c21f8),_0x59e938=_0x4da797?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode[_0x5ecbb0(0x184)],_0xfccfbc=getErrorMessage(_0x1c21f8);throw new SDKError(_0x59e938,'Failed\x20to\x20'+(_0x248d1f[_0x5ecbb0(0x224)]?_0x5ecbb0(0x1ac):_0x5ecbb0(0x165))+_0x5ecbb0(0x20a)+_0x248d1f[_0x5ecbb0(0x1e2)]+'\x0a\x20\x20'+_0xfccfbc,_0x1c21f8);}try{const _0x12dc4e=await syncActivationsForSegment(_0x1914cf,_0x2f473d[_0x5ecbb0(0x201)],_0x2ce387,_0x248d1f[_0x5ecbb0(0x1e6)][_0x5ecbb0(0x174)],_0x248d1f[_0x5ecbb0(0x190)],_0xdf4e17,_0x248d1f[_0x5ecbb0(0x1e2)]);_0x1ed2f3['activations']=_0x12dc4e;}catch(_0x43ef4c){if(_0x43ef4c instanceof SDKError)throw _0x43ef4c;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x5ecbb0(0x203)+_0x248d1f[_0x5ecbb0(0x1e6)][_0x5ecbb0(0x174)]+_0x5ecbb0(0x23a)+_0x248d1f[_0x5ecbb0(0x1e2)]+_0x5ecbb0(0x1c1)+getErrorMessage(_0x43ef4c),_0x43ef4c);}return _0x1ed2f3;},_0x272145=await batchAsync(_0x49a71f,_0x561fa4,_0x390dd6),_0x3d2d1f={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x30c099 of _0x272145){_0x3d2d1f[_0x43117e(0x21c)]+=_0x30c099[_0x43117e(0x21c)],_0x3d2d1f[_0x43117e(0x171)]+=_0x30c099[_0x43117e(0x171)],_0x30c099[_0x43117e(0x1bc)]&&_0x3d2d1f[_0x43117e(0x148)]['set'](_0x30c099[_0x43117e(0x1bc)]['name'],_0x30c099[_0x43117e(0x1bc)]['id']),_0x3d2d1f[_0x43117e(0x1ae)][_0x43117e(0x21c)]+=_0x30c099[_0x43117e(0x1ae)][_0x43117e(0x21c)],_0x3d2d1f[_0x43117e(0x1ae)]['updated']+=_0x30c099[_0x43117e(0x1ae)][_0x43117e(0x171)],_0x3d2d1f[_0x43117e(0x1ae)]['deleted']+=_0x30c099[_0x43117e(0x1ae)][_0x43117e(0x150)];}return _0x3d2d1f;}async function syncActivationsForSegment(_0x2aa41b,_0xb64454,_0x39d421,_0x43ee12,_0xed3193,_0x5e3d06,_0x49e1cd){const _0x45a905=a136_0x5a0a93,_0x38354b={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0xdf584e of _0xed3193){try{if(_0xdf584e['type']===_0x45a905(0x1ac)&&_0xdf584e['validatedRequest'])_0x5e3d06[_0x45a905(0x1ba)]?.({'type':_0x45a905(0x1ce),'segmentName':_0x43ee12,'activationName':_0xdf584e[_0x45a905(0x174)]}),await _0x5e3d06[_0x45a905(0x19d)](_0x45a905(0x14a)+_0xdf584e[_0x45a905(0x174)]+_0x45a905(0x187),()=>_0x2aa41b['segment']['createActivation'](_0xb64454,_0x39d421,_0xdf584e[_0x45a905(0x1b7)])),_0x5e3d06[_0x45a905(0x1ba)]?.({'type':'activation_created','segmentName':_0x43ee12,'activationName':_0xdf584e[_0x45a905(0x174)]}),_0x5e3d06['logSuccess']?.(_0x45a905(0x14c)+_0xdf584e['name']+'\x27'),_0x38354b['created']++;else{if(_0xdf584e[_0x45a905(0x1ab)]===_0x45a905(0x165)&&_0xdf584e[_0x45a905(0x1b7)]&&_0xdf584e['existingActivation'])_0x5e3d06[_0x45a905(0x1ba)]?.({'type':_0x45a905(0x1d0),'segmentName':_0x43ee12,'activationName':_0xdf584e[_0x45a905(0x174)]}),await _0x5e3d06['withProgress']('Updating\x20activation\x20\x27'+_0xdf584e[_0x45a905(0x174)]+_0x45a905(0x187),()=>_0x2aa41b[_0x45a905(0x225)][_0x45a905(0x1bb)](_0xb64454,_0x39d421,_0xdf584e[_0x45a905(0x249)]['id'],_0xdf584e[_0x45a905(0x1b7)])),_0x5e3d06['onProgress']?.({'type':_0x45a905(0x232),'segmentName':_0x43ee12,'activationName':_0xdf584e[_0x45a905(0x174)]}),_0x5e3d06[_0x45a905(0x198)]?.(_0x45a905(0x1b8)+_0xdf584e[_0x45a905(0x174)]+'\x27'),_0x38354b[_0x45a905(0x171)]++;else _0xdf584e[_0x45a905(0x1ab)]===_0x45a905(0x1b2)&&_0xdf584e['existingActivation']&&(_0x5e3d06[_0x45a905(0x1ba)]?.({'type':_0x45a905(0x202),'segmentName':_0x43ee12,'activationName':_0xdf584e['name']}),await _0x5e3d06[_0x45a905(0x19d)]('Deleting\x20activation\x20\x27'+_0xdf584e[_0x45a905(0x174)]+'\x27...',()=>_0x2aa41b[_0x45a905(0x225)][_0x45a905(0x242)](_0xb64454,_0x39d421,_0xdf584e[_0x45a905(0x249)]['id'])),_0x5e3d06[_0x45a905(0x1ba)]?.({'type':_0x45a905(0x1c2),'segmentName':_0x43ee12,'activationName':_0xdf584e['name']}),_0x5e3d06[_0x45a905(0x241)]?.(_0x45a905(0x211)+_0xdf584e[_0x45a905(0x174)]+'\x27'),_0x38354b[_0x45a905(0x150)]++);}}catch(_0x2537d8){const _0x2c71c5=isHttp400Error(_0x2537d8),_0x51c730=_0x2c71c5?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0x45a905(0x1ee)],_0x9da724=getErrorMessage(_0x2537d8);throw new SDKError(_0x51c730,'Failed\x20to\x20'+_0xdf584e[_0x45a905(0x1ab)]+_0x45a905(0x17a)+_0xdf584e['name']+_0x45a905(0x23a)+_0x49e1cd+_0x45a905(0x1c1)+_0x9da724,_0x2537d8);}}return _0x38354b;}export async function executePushFolders(_0x439755,_0x5e3a1e,_0x73e82a,_0x3ee411,_0x4e822a){const _0x3ad388=a136_0x5a0a93,_0x3e07e7=new Map(_0x73e82a),_0x3b7c94=sortFoldersByDepth(_0x5e3a1e);for(const _0x13d832 of _0x3b7c94){const _0x284c9b=_0x13d832[_0x3ad388(0x220)]('/'),_0x45f223=_0x284c9b[_0x284c9b[_0x3ad388(0x1a5)]-0x1],_0x59ef6a=_0x284c9b[_0x3ad388(0x1d4)](0x0,-0x1)[_0x3ad388(0x195)]('/'),_0x217fc6=_0x3e07e7[_0x3ad388(0x18a)](_0x59ef6a);_0x4e822a['onProgress']?.({'type':_0x3ad388(0x14e),'folder':_0x13d832});const _0x1bfd7e={'name':_0x45f223,'parentFolderId':_0x217fc6},_0x28d5e3=await _0x4e822a[_0x3ad388(0x19d)]('Creating\x20folder\x20\x27'+_0x13d832+_0x3ad388(0x187),()=>_0x439755[_0x3ad388(0x225)][_0x3ad388(0x1a0)](_0x3ee411[_0x3ad388(0x201)],_0x1bfd7e));_0x3e07e7[_0x3ad388(0x193)](_0x13d832,_0x28d5e3[_0x3ad388(0x1f5)]['id']),_0x4e822a[_0x3ad388(0x1ba)]?.({'type':_0x3ad388(0x23e),'folder':_0x13d832,'folderId':_0x28d5e3[_0x3ad388(0x1f5)]['id']}),_0x4e822a['logInfo']?.(_0x3ad388(0x1d5)+_0x13d832+'\x27');}return _0x3e07e7;}function a136_0x3302(_0x5c6f55,_0x1d4f40){_0x5c6f55=_0x5c6f55-0x148;const _0x2ca53b=a136_0x2ca5();let _0x3302a8=_0x2ca53b[_0x5c6f55];return _0x3302a8;}export async function executePushSegmentDeletions(_0x13b946,_0x3f857e,_0x386e14){const _0x15d28e=a136_0x5a0a93;if(_0x3f857e[_0x15d28e(0x1a5)]===0x0)return 0x0;const {batchAsync:_0x290e2d}=await import(_0x15d28e(0x1ed)),_0x5549b8=0x5,_0x10c8e6=await _0x290e2d(_0x3f857e,async _0x2d6afd=>{const _0x124546=_0x15d28e;return _0x386e14[_0x124546(0x1ba)]?.({'type':_0x124546(0x238),'name':_0x2d6afd['name']}),await _0x13b946[_0x124546(0x225)][_0x124546(0x1ca)](_0x2d6afd['id']),_0x386e14[_0x124546(0x1ba)]?.({'type':'segment_deleted','name':_0x2d6afd[_0x124546(0x174)]}),_0x386e14['logDeleted']?.(_0x124546(0x24f)+_0x2d6afd[_0x124546(0x174)]+'\x27'),0x1;},_0x5549b8);return _0x10c8e6[_0x15d28e(0x1b0)]((_0x51306b,_0x1ffbe4)=>_0x51306b+_0x1ffbe4,0x0);}export async function executePushJourneys(_0x2d2010,_0x5ce884,_0x24c388,_0xc3dda4,_0x45dfae){const _0x428967=a136_0x5a0a93,{journeyDefToRequest:_0x19913c}=await import(_0x428967(0x15e)),{activationDefToCreateRequest:_0x10235d,yamlRuleToApi:_0x101f6e,validateSegmentRule:_0x497692}=await import(_0x428967(0x24c)),_0x2503fc={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x50fc04=new Map(_0x24c388[_0x428967(0x1fe)]),_0x3c73f7=0x5;for(let _0x1cbb4c=0x0;_0x1cbb4c<_0x5ce884[_0x428967(0x1a5)];_0x1cbb4c+=_0x3c73f7){const _0x575f97=_0x5ce884['slice'](_0x1cbb4c,_0x1cbb4c+_0x3c73f7),_0x5b2f89=await Promise[_0x428967(0x179)](_0x575f97['map'](async _0x475828=>{const _0x2b8862=_0x428967;if(!_0x475828['isNew']&&!_0x475828['hasChanges'])return{'action':_0x2b8862(0x248),'name':_0x475828[_0x2b8862(0x1e6)][_0x2b8862(0x174)],'journeyId':_0x475828['existingJourney']?.['id']};const _0x35ef3d=_0x475828['folderPath']?_0x24c388[_0x2b8862(0x1cb)][_0x2b8862(0x18a)](_0x475828['folderPath']):undefined;_0x45dfae[_0x2b8862(0x1ba)]?.({'type':_0x475828['isNew']?_0x2b8862(0x163):'journey_updating','name':_0x475828['yamlConfig']['name']});try{const _0x1bafbd=await executeSingleJourneyPush(_0x2d2010,_0x475828,{..._0x24c388,'segmentNameToId':_0x50fc04},{'parentId':_0xc3dda4[_0x2b8862(0x201)],'rootFolderId':_0xc3dda4[_0x2b8862(0x199)],'folderId':_0x35ef3d,'verbose':_0xc3dda4[_0x2b8862(0x1c3)]},_0x45dfae,{'journeyDefToRequest':_0x19913c,'activationDefToCreateRequest':_0x10235d,'yamlRuleToApi':_0x101f6e,'validateSegmentRule':_0x497692});for(const [_0x5adb73,_0x3339aa]of _0x1bafbd[_0x2b8862(0x156)]){_0x50fc04['set'](_0x5adb73,_0x3339aa),_0x2503fc[_0x2b8862(0x156)][_0x2b8862(0x193)](_0x5adb73,_0x3339aa);}if(_0x1bafbd[_0x2b8862(0x1a2)]===_0x2b8862(0x21c))_0x45dfae['onProgress']?.({'type':_0x2b8862(0x1df),'name':_0x475828[_0x2b8862(0x1e6)]['name'],'journeyId':_0x1bafbd['journeyId']}),_0x45dfae[_0x2b8862(0x198)]?.(_0x2b8862(0x16c)+_0x475828[_0x2b8862(0x1e6)]['name']+'\x27'),_0x2503fc['created']++;else _0x1bafbd[_0x2b8862(0x1a2)]===_0x2b8862(0x171)&&(_0x45dfae['onProgress']?.({'type':_0x2b8862(0x239),'name':_0x475828['yamlConfig'][_0x2b8862(0x174)]}),_0x45dfae[_0x2b8862(0x198)]?.(_0x2b8862(0x1fc)+_0x475828[_0x2b8862(0x1e6)]['name']+'\x27'),_0x2503fc['updated']++);return{'action':_0x1bafbd[_0x2b8862(0x1a2)],'name':_0x475828[_0x2b8862(0x1e6)][_0x2b8862(0x174)],'journeyId':_0x1bafbd['journeyId']};}catch(_0x35cf1a){const _0x9f9e55=isHttp400Error(_0x35cf1a),_0xdafb6f=_0x9f9e55?ErrorCode[_0x2b8862(0x1fd)]:ErrorCode[_0x2b8862(0x180)],_0x218c56=getErrorMessage(_0x35cf1a);throw new SDKError(_0xdafb6f,_0x2b8862(0x181)+(_0x475828[_0x2b8862(0x224)]?_0x2b8862(0x1ac):_0x2b8862(0x165))+_0x2b8862(0x1bd)+_0x475828['absolutePath']+_0x2b8862(0x1c1)+_0x218c56,_0x35cf1a);}}));_0x2503fc[_0x428967(0x1e8)][_0x428967(0x164)](..._0x5b2f89);}return _0x2503fc;}async function matchExistingJourneySegments(_0x5636a1,_0x35acfd,_0x5eed03,_0x571ca4,_0x4b298f){const _0x3f3494=a136_0x5a0a93;if(!_0x35acfd[_0x3f3494(0x16d)]||!_0x35acfd[_0x3f3494(0x1e6)][_0x3f3494(0x1b3)])return;const _0x25a25c=new Map(),_0x3fe40e=new Set();for(const _0x4b9def of Object[_0x3f3494(0x21f)](_0x35acfd[_0x3f3494(0x1e6)]['segments'])){const _0x1e7922=generateDeterministicJourneySegmentName(_0x35acfd[_0x3f3494(0x1e6)][_0x3f3494(0x174)],_0x4b9def);_0x25a25c[_0x3f3494(0x193)](_0x1e7922,_0x4b9def),_0x3fe40e['add'](_0x4b9def);}const _0x309f39=[],_0x26af46=collectSegmentIdsFromJourneyApi(_0x35acfd['existingJourney']);for(const _0x10ff53 of _0x26af46){const _0x4aa40a=await fetchSegment(_0x5636a1,_0x5eed03,_0x10ff53,_0x571ca4);if(!_0x4aa40a?.['name'])continue;const _0x55683d=_0x25a25c[_0x3f3494(0x18a)](_0x4aa40a[_0x3f3494(0x174)]);_0x55683d?(_0x4b298f['set'](_0x55683d,_0x10ff53),_0x3fe40e[_0x3f3494(0x1b2)](_0x55683d)):_0x309f39['push']({'id':_0x10ff53,'seg':_0x4aa40a});}if(_0x3fe40e[_0x3f3494(0x19c)]>0x0&&_0x309f39[_0x3f3494(0x1a5)]>0x0){const {localExpandedRuleToNames:_0x3b976b}=buildLocalExpandedRuleMappings(_0x35acfd[_0x3f3494(0x1e6)]),_0x30c5b7=new Map();for(const {id:_0x8a0bc5,seg:_0x1a379d}of _0x309f39){if(_0x1a379d[_0x3f3494(0x182)]){const _0x1282d7=apiRuleToYaml(_0x1a379d['rule']);_0x30c5b7['set'](_0x8a0bc5,_0x1282d7);}}for(const {id:_0x567242,seg:_0x230684}of _0x309f39){if(!_0x230684['rule'])continue;const _0x42290a=_0x30c5b7[_0x3f3494(0x18a)](_0x567242);if(!_0x42290a)continue;const _0x5866a7=serializeExpandedRule(_0x42290a,_0x30c5b7),_0x4efc1e=_0x3b976b[_0x3f3494(0x18a)](_0x5866a7);if(_0x4efc1e){const _0x36a6da=_0x4efc1e['find'](_0x15febc=>_0x3fe40e['has'](_0x15febc));_0x36a6da&&(_0x4b298f[_0x3f3494(0x193)](_0x36a6da,_0x567242),_0x3fe40e[_0x3f3494(0x1b2)](_0x36a6da),logger[_0x3f3494(0x20b)](_0x3f3494(0x167)+_0x230684[_0x3f3494(0x174)]+_0x3f3494(0x14f)+_0x36a6da+_0x3f3494(0x192)));}}}}async function executeSingleJourneyPush(_0x211a9c,_0x41bd37,_0x29f74a,_0x22879f,_0x3eb28e,_0x5cd9da){const _0x2129c2=a136_0x5a0a93,{journeyDefToRequest:_0x52c6ea,activationDefToCreateRequest:_0x123196,yamlRuleToApi:_0x45eb39,validateSegmentRule:_0x44f569}=_0x5cd9da,_0x2f3898=new Map(),_0x36aac2=new Map();recoverSegmentIdsFromPushRecovery(_0x41bd37,_0x2f3898,_0x29f74a[_0x2129c2(0x1fe)]);const _0x225433=new Map(),_0x31d414=new Map(),_0x1eaf72=new Map();let _0x46505f;const _0x26997f=async()=>{const _0x49f89e=_0x2129c2;if(_0x46505f)return;_0x46505f=new Map();if(!_0x41bd37[_0x49f89e(0x16d)])return;const _0x5c9d5a=await _0x211a9c[_0x49f89e(0x177)][_0x49f89e(0x15f)](_0x41bd37[_0x49f89e(0x16d)]['id']);for(const _0x28b946 of _0x5c9d5a){const _0x1a7ad6=journeyActivationStepToYaml(_0x28b946,_0x29f74a[_0x49f89e(0x1e0)],_0x29f74a[_0x49f89e(0x23f)]),_0x186920=activationSignature(_0x1a7ad6);!_0x46505f[_0x49f89e(0x245)](_0x186920)&&_0x46505f[_0x49f89e(0x193)](_0x186920,_0x28b946['id']),_0x1a7ad6[_0x49f89e(0x174)]&&_0x36aac2[_0x49f89e(0x193)](_0x1a7ad6['name'],_0x28b946['id']);}};await matchExistingJourneySegments(_0x211a9c,_0x41bd37,_0x22879f[_0x2129c2(0x201)],_0x29f74a[_0x2129c2(0x1fb)],_0x29f74a[_0x2129c2(0x1fe)]);const _0x343f33={'resolveSegmentId':async _0x29b837=>{const _0x55e402=_0x2129c2,_0xb3053=_0x29f74a[_0x55e402(0x1fe)]['get'](_0x29b837);if(!_0xb3053)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x55e402(0x1cd)+_0x29b837+_0x55e402(0x1db)+_0x41bd37[_0x55e402(0x1e6)][_0x55e402(0x174)]+')');return _0xb3053;},'resolveEmbeddedSegmentId':async(_0x1ff06b,_0x311a70)=>{const _0x117e16=_0x2129c2,_0x1a50a3=_0x29f74a[_0x117e16(0x1fe)]['get'](_0x1ff06b);if(_0x1a50a3)return _0x1a50a3;const _0x4e6a1=_0x29f74a[_0x117e16(0x1fb)][_0x117e16(0x206)](_0x309998=>_0x309998[_0x117e16(0x174)]===_0x1ff06b);if(_0x4e6a1)return _0x29f74a['segmentNameToId']['set'](_0x1ff06b,_0x4e6a1['id']),_0x4e6a1['id'];if(_0x41bd37[_0x117e16(0x224)]){const {stageName:_0x271d51,criteriaName:_0x56968b}=findSegmentCriteriaLocation(_0x41bd37[_0x117e16(0x1e6)],_0x1ff06b);return _0x44f569(_0x1ff06b,_0x311a70[_0x117e16(0x182)]),_0x31d414[_0x117e16(0x193)](_0x1ff06b,{'definition':_0x311a70,'stageName':_0x271d51,'criteriaName':_0x56968b}),createPendingSegmentId(_0x1ff06b);}const _0x4e4570=_0x41bd37[_0x117e16(0x16d)]?.['id'];if(!_0x4e4570)throw new SDKError(ErrorCode[_0x117e16(0x1a8)],_0x117e16(0x24d));const _0xa55ae6=_0x225433[_0x117e16(0x18a)](_0x1ff06b);if(_0xa55ae6)return _0xa55ae6;const _0x567f8e=((async()=>{const _0x17615b=_0x117e16;_0x44f569(_0x1ff06b,_0x311a70[_0x17615b(0x182)]);const _0x16510e=generateDeterministicJourneySegmentName(_0x41bd37[_0x17615b(0x1e6)][_0x17615b(0x174)],_0x1ff06b),_0x1a35e1=_0x29f74a[_0x17615b(0x1fb)][_0x17615b(0x206)](_0x2418b6=>_0x2418b6['name']===_0x16510e),_0x3ab6f2=createSegmentIdResolver(_0x29f74a[_0x17615b(0x1fe)],_0x1ff06b),_0x90c19d=await resolveRuleSegmentIds(_0x311a70[_0x17615b(0x182)],_0x3ab6f2);let _0x4f6ce4;return _0x1a35e1?(await _0x211a9c['segment'][_0x17615b(0x18f)](_0x22879f['parentId'],_0x1a35e1['id'],{'description':_0x311a70['description']||_0x17615b(0x243)+_0x1ff06b,'rule':_0x45eb39(_0x90c19d,!![]),'countPopulation':!![]}),_0x4f6ce4=_0x1a35e1['id'],saveSegmentToPushRecovery(_0x41bd37[_0x17615b(0x1e2)],_0x41bd37['yamlConfig'][_0x17615b(0x174)],_0x1ff06b,{'segmentId':_0x4f6ce4,'uniqueServerName':_0x16510e,'createdAt':new Date()[_0x17615b(0x218)]()})):_0x4f6ce4=await createOrRecoverEmbeddedSegment(_0x211a9c,_0x41bd37,{'localName':_0x1ff06b,'uniqueSegmentName':_0x16510e,'description':_0x311a70[_0x17615b(0x1ff)]||_0x17615b(0x243)+_0x1ff06b,'journeyId':_0x4e4570,'resolvedRule':_0x90c19d,'parentId':_0x22879f[_0x17615b(0x201)],'folderId':_0x22879f['rootFolderId']||''},_0x45eb39),_0x29f74a[_0x17615b(0x1fe)][_0x17615b(0x193)](_0x1ff06b,_0x4f6ce4),_0x2f3898[_0x17615b(0x193)](_0x1ff06b,_0x4f6ce4),_0x4f6ce4;})());_0x225433[_0x117e16(0x193)](_0x1ff06b,_0x567f8e);try{return await _0x567f8e;}finally{_0x225433[_0x117e16(0x1b2)](_0x1ff06b);}},'resolveActivationId':async _0x27b899=>{const _0x5d8784=_0x2129c2,_0x2a7274=_0x36aac2[_0x5d8784(0x18a)](_0x27b899);if(_0x2a7274)return _0x2a7274;if(_0x41bd37[_0x5d8784(0x16d)]){await _0x26997f();const _0x54faff=_0x36aac2[_0x5d8784(0x18a)](_0x27b899);if(_0x54faff)return _0x54faff;}throw new SDKError(ErrorCode[_0x5d8784(0x189)],'Activation\x20not\x20found:\x20'+_0x27b899+_0x5d8784(0x1db)+_0x41bd37[_0x5d8784(0x1e6)]['name']+_0x5d8784(0x19e)+_0x5d8784(0x1b4));},'resolveEmbeddedActivationId':async(_0x4d7ee4,_0x438e2b)=>{const _0x303082=_0x2129c2,_0x2dcd84=_0x36aac2[_0x303082(0x18a)](_0x4d7ee4);if(_0x2dcd84)return _0x2dcd84;if(_0x41bd37['isNew'])return _0x1eaf72[_0x303082(0x193)](_0x4d7ee4,_0x438e2b),createPendingActivationId(_0x4d7ee4);if(_0x41bd37[_0x303082(0x16d)]){await _0x26997f();const _0x6e111e=_0x36aac2[_0x303082(0x18a)](_0x438e2b[_0x303082(0x174)]);if(_0x6e111e)return _0x36aac2[_0x303082(0x193)](_0x4d7ee4,_0x6e111e),_0x6e111e;const _0xd5b8e=activationSignature(_0x438e2b),_0x43ac4b=_0x46505f?.[_0x303082(0x18a)](_0xd5b8e);if(_0x43ac4b)return _0x36aac2[_0x303082(0x193)](_0x4d7ee4,_0x43ac4b),_0x43ac4b;const _0x37ef24=await _0x123196(_0x438e2b,_0x29f74a[_0x303082(0x16a)]),_0x389fa8={..._0x37ef24,..._0x438e2b[_0x303082(0x155)]!==undefined&&{'runAfterJourneyRefresh':_0x438e2b[_0x303082(0x155)]}},_0x7d3a86=await _0x211a9c[_0x303082(0x177)][_0x303082(0x151)](_0x41bd37[_0x303082(0x16d)]['id'],_0x389fa8);return _0x36aac2[_0x303082(0x193)](_0x4d7ee4,_0x7d3a86['id']),_0x7d3a86['id'];}throw new SDKError(ErrorCode[_0x303082(0x1a8)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x38b9fc=>{const _0xcabeb7=_0x2129c2;try{return await _0x211a9c[_0xcabeb7(0x177)][_0xcabeb7(0x186)](_0x22879f[_0xcabeb7(0x201)],_0x38b9fc);}catch(_0x467f51){throw new SDKError(ErrorCode[_0xcabeb7(0x189)],'Journey\x20\x27'+_0x38b9fc+_0xcabeb7(0x1f3)+_0x41bd37['yamlConfig'][_0xcabeb7(0x174)]+'\x27)',_0x467f51);}},'resolveStageId':async(_0x58d0b3,_0x3fbf94)=>{const _0x3fc9eb=_0x2129c2,_0x55d4e0=await _0x211a9c[_0x3fc9eb(0x177)][_0x3fc9eb(0x1f2)](_0x58d0b3),_0x3bf7c8=_0x55d4e0[_0x3fc9eb(0x16e)][_0x3fc9eb(0x24b)][_0x3fc9eb(0x206)](_0x381a1e=>_0x381a1e[_0x3fc9eb(0x174)][_0x3fc9eb(0x213)]()===_0x3fbf94[_0x3fc9eb(0x213)]());if(!_0x3bf7c8?.['id'])throw new SDKError(ErrorCode[_0x3fc9eb(0x189)],_0x3fc9eb(0x1c4)+_0x3fbf94+_0x3fc9eb(0x217)+(_0x55d4e0[_0x3fc9eb(0x16e)]['journeyBundleName']||_0x55d4e0['attributes'][_0x3fc9eb(0x174)])+'\x27');return _0x3bf7c8['id'];}},_0x5bd7a5=await _0x52c6ea(_0x41bd37[_0x2129c2(0x1e6)],_0x22879f[_0x2129c2(0x201)],_0x343f33),_0x4b05f0=_0x22879f[_0x2129c2(0x18e)]||_0x22879f[_0x2129c2(0x199)];_0x4b05f0&&(_0x5bd7a5['relationships']={'parentFolder':{'data':{'id':_0x4b05f0,'type':'folder'}}});if(_0x41bd37['isNew']){if(_0x31d414[_0x2129c2(0x19c)]>0x0||_0x1eaf72['size']>0x0)return await executeThreeStepJourneyCreate(_0x211a9c,_0x41bd37,_0x5bd7a5,{'pendingEmbeddedSegments':_0x31d414,'pendingEmbeddedActivations':_0x1eaf72,'embeddedSegmentNameToId':_0x2f3898,'journeyActivationNameToId':_0x36aac2},{..._0x22879f,'effectiveFolderId':_0x4b05f0},_0x29f74a,_0x3eb28e,_0x5cd9da);else{ensureJourneyDefaults(_0x5bd7a5[_0x2129c2(0x16e)]);const _0x1a5aa3=await _0x211a9c[_0x2129c2(0x177)][_0x2129c2(0x1ac)](_0x5bd7a5);return deletePushRecovery(_0x41bd37['absolutePath']),{'action':_0x2129c2(0x21c),'journeyId':_0x1a5aa3['id'],'embeddedSegmentNameToId':_0x2f3898};}}else{if(_0x41bd37[_0x2129c2(0x210)]&&_0x41bd37[_0x2129c2(0x16d)]){_0x5bd7a5['id']=_0x41bd37[_0x2129c2(0x16d)]['id'];const _0x1305ee=_0x5bd7a5['attributes'];_0x41bd37[_0x2129c2(0x16d)][_0x2129c2(0x16e)]?.[_0x2129c2(0x1ad)]&&(_0x1305ee['journeyBundleName']=_0x41bd37['existingJourney'][_0x2129c2(0x16e)][_0x2129c2(0x1ad)]);const _0x48c5ce=_0x41bd37[_0x2129c2(0x16d)][_0x2129c2(0x16e)]?.[_0x2129c2(0x24b)];return _0x48c5ce&&_0x5bd7a5[_0x2129c2(0x16e)][_0x2129c2(0x24b)]&&injectExistingStageIds(_0x5bd7a5[_0x2129c2(0x16e)][_0x2129c2(0x24b)],_0x48c5ce),ensureJourneyDefaults(_0x1305ee),await _0x211a9c[_0x2129c2(0x177)][_0x2129c2(0x165)](_0x41bd37[_0x2129c2(0x16d)]['id'],_0x5bd7a5),deletePushRecovery(_0x41bd37[_0x2129c2(0x1e2)]),{'action':_0x2129c2(0x171),'journeyId':_0x41bd37[_0x2129c2(0x16d)]['id'],'embeddedSegmentNameToId':_0x2f3898};}}return deletePushRecovery(_0x41bd37['absolutePath']),{'action':'unchanged','journeyId':_0x41bd37[_0x2129c2(0x16d)]?.['id'],'embeddedSegmentNameToId':_0x2f3898};}function findSegmentCriteriaLocation(_0x4a91f8,_0x136f3c){const _0x30096d=a136_0x5a0a93,_0x50ff30=_0x4a91f8['stages']||_0x4a91f8['journeys']?.[0x0]?.[_0x30096d(0x1ec)]||[];let _0x5aad01=_0x30096d(0x17b),_0x234728=_0x136f3c;const _0x4c10ad=_0x4a91f8[_0x30096d(0x162)]||_0x4a91f8[_0x30096d(0x244)]?.[0x0]?.[_0x30096d(0x162)];if(_0x4c10ad?.[_0x30096d(0x225)]===_0x136f3c)return{'stageName':_0x30096d(0x162),'criteriaName':_0x4c10ad[_0x30096d(0x174)]||_0x136f3c};_0x323a83:for(const _0x509a3a of _0x50ff30){if(_0x509a3a[_0x30096d(0x1c9)]?.[_0x30096d(0x225)]===_0x136f3c){_0x5aad01=_0x509a3a[_0x30096d(0x174)],_0x234728=_0x509a3a['entry_criteria'][_0x30096d(0x174)]||_0x136f3c;break;}if(_0x509a3a[_0x30096d(0x1c5)])for(const _0x2b48b6 of _0x509a3a[_0x30096d(0x1c5)]){if(_0x2b48b6['type']===_0x30096d(0x231)&&_0x2b48b6[_0x30096d(0x1b9)]?.[_0x30096d(0x1d7)])for(const _0xcf4c7e of _0x2b48b6[_0x30096d(0x1b9)]['branches']){if(_0xcf4c7e[_0x30096d(0x225)]===_0x136f3c){_0x5aad01=_0x509a3a['name'],_0x234728=_0xcf4c7e[_0x30096d(0x174)]||_0x136f3c;break _0x323a83;}}}}return{'stageName':_0x5aad01,'criteriaName':_0x234728};}async function executeThreeStepJourneyCreate(_0xd4c9a7,_0x5318c2,_0x54ccfc,_0x1d26a8,_0x9174cc,_0x2d89cc,_0x5d14b6,_0x2c0379){const _0x2d03c7=a136_0x5a0a93,{activationDefToCreateRequest:_0x9d3562,yamlRuleToApi:_0x4e7864}=_0x2c0379,{pendingEmbeddedSegments:_0x40f5e2,pendingEmbeddedActivations:_0x28b8cc,embeddedSegmentNameToId:_0x1ee091}=_0x1d26a8,_0x139a83=JSON['parse'](JSON[_0x2d03c7(0x157)](_0x54ccfc));ensureJourneyDefaults(_0x139a83[_0x2d03c7(0x16e)]),stripPendingIds(_0x139a83);const _0x4c26d0=await _0xd4c9a7[_0x2d03c7(0x177)][_0x2d03c7(0x1ac)](_0x139a83),_0x4f719d=_0x4c26d0['id'],_0x37c05f=new Map();for(const _0x36e623 of _0x4c26d0[_0x2d03c7(0x16e)][_0x2d03c7(0x24b)]){_0x37c05f[_0x2d03c7(0x193)](_0x36e623[_0x2d03c7(0x174)][_0x2d03c7(0x213)](),_0x36e623['id']);}recoverSegmentIdsFromPushRecovery(_0x5318c2,_0x1ee091,_0x2d89cc[_0x2d03c7(0x1fe)]);for(const [_0x41c471,{definition:_0x2fd0e5}]of _0x40f5e2){if(_0x1ee091[_0x2d03c7(0x245)](_0x41c471)){_0x5d14b6['onProgress']?.({'type':'embedded_segment_created','journeyName':_0x5318c2[_0x2d03c7(0x1e6)][_0x2d03c7(0x174)],'segmentName':_0x41c471});continue;}const _0x1aca67=generateDeterministicJourneySegmentName(_0x5318c2[_0x2d03c7(0x1e6)][_0x2d03c7(0x174)],_0x41c471);_0x5d14b6[_0x2d03c7(0x1ba)]?.({'type':_0x2d03c7(0x223),'journeyName':_0x5318c2[_0x2d03c7(0x1e6)][_0x2d03c7(0x174)],'segmentName':_0x41c471});const _0xf4764e=createSegmentIdResolver(_0x2d89cc['segmentNameToId'],_0x41c471),_0x42630d=await resolveRuleSegmentIds(_0x2fd0e5[_0x2d03c7(0x182)],_0xf4764e),_0x5632bc=await createOrRecoverEmbeddedSegment(_0xd4c9a7,_0x5318c2,{'localName':_0x41c471,'uniqueSegmentName':_0x1aca67,'description':_0x2fd0e5['description']||_0x2d03c7(0x243)+_0x41c471,'journeyId':_0x4f719d,'resolvedRule':_0x42630d,'parentId':_0x9174cc['parentId'],'folderId':_0x9174cc[_0x2d03c7(0x149)]||''},_0x4e7864);_0x1ee091[_0x2d03c7(0x193)](_0x41c471,_0x5632bc),_0x2d89cc[_0x2d03c7(0x1fe)][_0x2d03c7(0x193)](_0x41c471,_0x5632bc),_0x5d14b6[_0x2d03c7(0x1ba)]?.({'type':'embedded_segment_created','journeyName':_0x5318c2[_0x2d03c7(0x1e6)]['name'],'segmentName':_0x41c471});}const _0x382f09=new Map();for(const [_0x3ffafe,_0x41b4ce]of _0x28b8cc){_0x5d14b6[_0x2d03c7(0x1ba)]?.({'type':'embedded_activation_creating','journeyName':_0x5318c2['yamlConfig'][_0x2d03c7(0x174)],'activationName':_0x3ffafe});const _0x3aca4c=await _0x9d3562(_0x41b4ce,_0x2d89cc['activationContext']),_0x172967={..._0x3aca4c,..._0x41b4ce[_0x2d03c7(0x155)]!==undefined&&{'runAfterJourneyRefresh':_0x41b4ce['run_after_journey_refresh']}},_0x73ad2c=await _0xd4c9a7['journey'][_0x2d03c7(0x151)](_0x4f719d,_0x172967);_0x382f09[_0x2d03c7(0x193)](_0x3ffafe,_0x73ad2c['id']),_0x1d26a8[_0x2d03c7(0x14b)][_0x2d03c7(0x193)](_0x3ffafe,_0x73ad2c['id']),_0x5d14b6['onProgress']?.({'type':_0x2d03c7(0x18d),'journeyName':_0x5318c2[_0x2d03c7(0x1e6)][_0x2d03c7(0x174)],'activationName':_0x3ffafe});}const _0x4716ee=JSON[_0x2d03c7(0x153)](JSON[_0x2d03c7(0x157)](_0x54ccfc));return _0x4716ee['id']=_0x4f719d,ensureJourneyDefaults(_0x4716ee[_0x2d03c7(0x16e)]),resolvePendingIdsInRequest(_0x4716ee,_0x54ccfc,_0x37c05f,_0x1ee091,_0x382f09,_0x5d14b6),await _0xd4c9a7['journey'][_0x2d03c7(0x165)](_0x4f719d,_0x4716ee),deletePushRecovery(_0x5318c2['absolutePath']),{'action':_0x2d03c7(0x21c),'journeyId':_0x4f719d,'embeddedSegmentNameToId':_0x1ee091};}export function stripWaitStepPendingIds(_0x5bd121){const _0x3be743=a136_0x5a0a93,_0x5bc8ce=_0x5bd121[_0x3be743(0x1a3)]&&isPendingSegmentId(_0x5bd121['conditionSegmentId']),_0x49ae50=_0x5bd121[_0x3be743(0x16f)]?.[_0x3be743(0x1da)](_0x1895a8=>_0x1895a8['segmentId']&&isPendingSegmentId(_0x1895a8[_0x3be743(0x21d)]));(_0x5bc8ce||_0x49ae50)&&(_0x5bd121[_0x3be743(0x205)]=_0x3be743(0x209),_0x5bd121[_0x3be743(0x1de)]=0x1,_0x5bd121[_0x3be743(0x17d)]='day',delete _0x5bd121['conditionSegmentId'],delete _0x5bd121[_0x3be743(0x152)],delete _0x5bd121[_0x3be743(0x15c)],delete _0x5bd121[_0x3be743(0x16f)]);}export function resolveWaitStepPendingIds(_0x274cf7,_0x40f999,_0x34c298,_0x1c4768){const _0x169fc1=a136_0x5a0a93;if(_0x40f999['conditionSegmentId']&&isPendingSegmentId(_0x40f999['conditionSegmentId'])){const _0x5bdb89=_0x34c298(_0x40f999[_0x169fc1(0x1a3)],'stage\x20\x27'+_0x1c4768+_0x169fc1(0x235));_0x5bdb89&&(_0x274cf7[_0x169fc1(0x205)]=_0x169fc1(0x247),_0x274cf7[_0x169fc1(0x1a3)]=_0x5bdb89,delete _0x274cf7[_0x169fc1(0x1de)],delete _0x274cf7[_0x169fc1(0x17d)],_0x40f999[_0x169fc1(0x152)]!==undefined&&(_0x274cf7['conditionTimeoutDuration']=_0x40f999[_0x169fc1(0x152)]),_0x40f999[_0x169fc1(0x15c)]&&(_0x274cf7[_0x169fc1(0x15c)]=_0x40f999['conditionTimeoutUnit']));}if(_0x40f999[_0x169fc1(0x16f)]){const _0x3409b6=_0x40f999[_0x169fc1(0x16f)][_0x169fc1(0x1da)](_0x240caa=>_0x240caa['segmentId']&&isPendingSegmentId(_0x240caa[_0x169fc1(0x21d)]));if(_0x3409b6){const _0x59cd44=_0x40f999[_0x169fc1(0x16f)][_0x169fc1(0x216)](_0x1082a1=>{const _0x40d8b5=_0x169fc1;if(_0x1082a1[_0x40d8b5(0x21d)]&&isPendingSegmentId(_0x1082a1[_0x40d8b5(0x21d)])){const _0x4aa50a=_0x34c298(_0x1082a1[_0x40d8b5(0x21d)],'stage\x20\x27'+_0x1c4768+_0x40d8b5(0x235));return{..._0x1082a1,'segmentId':_0x4aa50a||_0x1082a1[_0x40d8b5(0x21d)]};}return{..._0x1082a1};});_0x274cf7[_0x169fc1(0x205)]='Condition',_0x274cf7[_0x169fc1(0x16f)]=_0x59cd44,delete _0x274cf7[_0x169fc1(0x1de)],delete _0x274cf7[_0x169fc1(0x17d)],delete _0x274cf7[_0x169fc1(0x1a3)],delete _0x274cf7[_0x169fc1(0x152)],delete _0x274cf7[_0x169fc1(0x15c)];}}}function stripPendingIds(_0x54d611){const _0x59ebd4=a136_0x5a0a93;_0x54d611[_0x59ebd4(0x16e)][_0x59ebd4(0x162)]?.[_0x59ebd4(0x21d)]&&isPendingSegmentId(_0x54d611[_0x59ebd4(0x16e)][_0x59ebd4(0x162)][_0x59ebd4(0x21d)])&&delete _0x54d611[_0x59ebd4(0x16e)][_0x59ebd4(0x162)];for(const _0x214bd2 of _0x54d611[_0x59ebd4(0x16e)][_0x59ebd4(0x24b)]||[]){_0x214bd2[_0x59ebd4(0x196)]?.[_0x59ebd4(0x21d)]&&isPendingSegmentId(_0x214bd2[_0x59ebd4(0x196)][_0x59ebd4(0x21d)])&&delete _0x214bd2[_0x59ebd4(0x196)];_0x214bd2[_0x59ebd4(0x17f)]?.[_0x59ebd4(0x21d)]&&isPendingSegmentId(_0x214bd2[_0x59ebd4(0x17f)][_0x59ebd4(0x21d)])&&delete _0x214bd2['milestone'];_0x214bd2[_0x59ebd4(0x22c)]&&(_0x214bd2['exitCriterias']=_0x214bd2[_0x59ebd4(0x22c)][_0x59ebd4(0x15b)](_0x108017=>!_0x108017[_0x59ebd4(0x21d)]||!isPendingSegmentId(_0x108017[_0x59ebd4(0x21d)])));if(_0x214bd2[_0x59ebd4(0x1c5)])for(const _0x4cba1c of Object[_0x59ebd4(0x21f)](_0x214bd2[_0x59ebd4(0x1c5)])){const _0x462cd6=_0x214bd2[_0x59ebd4(0x1c5)][_0x4cba1c];_0x462cd6[_0x59ebd4(0x1ab)]==='Activation'&&_0x462cd6['journeyActivationStepId']&&isPendingActivationId(_0x462cd6['journeyActivationStepId'])&&(_0x462cd6['journeyActivationStepId']='');if(_0x462cd6['type']===_0x59ebd4(0x20c)&&_0x462cd6['branches'])for(const _0x3db593 of _0x462cd6[_0x59ebd4(0x1d7)]){_0x3db593['segmentId']&&isPendingSegmentId(_0x3db593[_0x59ebd4(0x21d)])&&(_0x3db593[_0x59ebd4(0x21d)]='');}_0x462cd6[_0x59ebd4(0x1ab)]==='WaitStep'&&stripWaitStepPendingIds(_0x462cd6);}}}function resolvePendingIdsInRequest(_0x168d39,_0x334293,_0x2f8861,_0x1596a7,_0x2098ca,_0x3afe98){const _0xa9cf8e=a136_0x5a0a93,_0x47e076=(_0x2835a0,_0x19e348)=>{const _0x58ecda=a136_0x3302;if(!isPendingSegmentId(_0x2835a0))return _0x2835a0;const _0x5af90c=extractPendingSegmentName(_0x2835a0),_0xa273fb=_0x1596a7[_0x58ecda(0x18a)](_0x5af90c);return!_0xa273fb&&_0x3afe98[_0x58ecda(0x169)]?.(_0x58ecda(0x173)+_0x5af90c+_0x58ecda(0x1ea)+_0x19e348),_0xa273fb;};if(_0x168d39[_0xa9cf8e(0x16e)][_0xa9cf8e(0x162)]?.[_0xa9cf8e(0x21d)]&&isPendingSegmentId(_0x168d39[_0xa9cf8e(0x16e)][_0xa9cf8e(0x162)][_0xa9cf8e(0x21d)])){const _0x59e40b=_0x47e076(_0x168d39[_0xa9cf8e(0x16e)][_0xa9cf8e(0x162)][_0xa9cf8e(0x21d)],_0xa9cf8e(0x221));_0x59e40b&&(_0x168d39[_0xa9cf8e(0x16e)]['goal'][_0xa9cf8e(0x21d)]=_0x59e40b);}for(const _0x10d972 of _0x168d39['attributes'][_0xa9cf8e(0x24b)]||[]){const _0x50acb2=_0x2f8861[_0xa9cf8e(0x18a)](_0x10d972[_0xa9cf8e(0x174)][_0xa9cf8e(0x213)]());_0x50acb2&&(_0x10d972['id']=_0x50acb2);if(_0x10d972[_0xa9cf8e(0x196)]?.['segmentId']&&isPendingSegmentId(_0x10d972[_0xa9cf8e(0x196)][_0xa9cf8e(0x21d)])){const _0x193339=_0x47e076(_0x10d972[_0xa9cf8e(0x196)][_0xa9cf8e(0x21d)],'stage\x20\x27'+_0x10d972[_0xa9cf8e(0x174)]+_0xa9cf8e(0x22d));_0x193339&&(_0x10d972['entryCriteria']['segmentId']=_0x193339);}if(_0x10d972[_0xa9cf8e(0x22c)])for(const _0x2e7d63 of _0x10d972[_0xa9cf8e(0x22c)]){if(_0x2e7d63[_0xa9cf8e(0x21d)]&&isPendingSegmentId(_0x2e7d63[_0xa9cf8e(0x21d)])){const _0x1e6f02=_0x47e076(_0x2e7d63['segmentId'],_0xa9cf8e(0x160)+_0x10d972['name']+_0xa9cf8e(0x158));_0x1e6f02&&(_0x2e7d63[_0xa9cf8e(0x21d)]=_0x1e6f02);}}if(_0x10d972[_0xa9cf8e(0x17f)]?.[_0xa9cf8e(0x21d)]&&isPendingSegmentId(_0x10d972['milestone'][_0xa9cf8e(0x21d)])){const _0x62715a=_0x47e076(_0x10d972[_0xa9cf8e(0x17f)]['segmentId'],'stage\x20\x27'+_0x10d972[_0xa9cf8e(0x174)]+'\x27\x20milestone');_0x62715a&&(_0x10d972[_0xa9cf8e(0x17f)][_0xa9cf8e(0x21d)]=_0x62715a);}if(_0x10d972['steps']){const _0x2e9f55=_0x53b692=>_0x334293[_0xa9cf8e(0x16e)]['journeyStages']?.[_0xa9cf8e(0x206)](_0x4f7858=>_0x4f7858['name']['toLowerCase']()===_0x10d972[_0xa9cf8e(0x174)][_0xa9cf8e(0x213)]())?.[_0xa9cf8e(0x1c5)]?.[_0x53b692];for(const _0x179bc8 of Object['keys'](_0x10d972[_0xa9cf8e(0x1c5)])){const _0x52afad=_0x10d972[_0xa9cf8e(0x1c5)][_0x179bc8],_0x1067af=_0x2e9f55(_0x179bc8);if(_0x52afad[_0xa9cf8e(0x1ab)]==='Activation'&&_0x52afad['journeyActivationStepId']&&(isPendingActivationId(_0x52afad['journeyActivationStepId'])||_0x52afad[_0xa9cf8e(0x204)]==='')){if(_0x1067af?.[_0xa9cf8e(0x204)]&&isPendingActivationId(_0x1067af[_0xa9cf8e(0x204)])){const _0x46a1d5=extractPendingActivationName(_0x1067af[_0xa9cf8e(0x204)]),_0x2595a7=_0x2098ca[_0xa9cf8e(0x18a)](_0x46a1d5);_0x2595a7&&(_0x52afad[_0xa9cf8e(0x204)]=_0x2595a7);}}if(_0x52afad[_0xa9cf8e(0x1ab)]===_0xa9cf8e(0x20c)&&_0x52afad[_0xa9cf8e(0x1d7)]&&_0x1067af?.[_0xa9cf8e(0x1d7)])for(let _0xc67821=0x0;_0xc67821<_0x52afad[_0xa9cf8e(0x1d7)][_0xa9cf8e(0x1a5)];_0xc67821++){const _0x2dee0e=_0x52afad[_0xa9cf8e(0x1d7)][_0xc67821],_0x72f67e=_0x1067af['branches'][_0xc67821];if(_0x72f67e?.['segmentId']&&isPendingSegmentId(_0x72f67e[_0xa9cf8e(0x21d)])){const _0x384576=_0x47e076(_0x72f67e[_0xa9cf8e(0x21d)],_0xa9cf8e(0x160)+_0x10d972[_0xa9cf8e(0x174)]+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x2dee0e[_0xa9cf8e(0x174)]||_0xc67821)+'\x27');_0x384576&&(_0x2dee0e[_0xa9cf8e(0x21d)]=_0x384576);}}_0x52afad[_0xa9cf8e(0x1ab)]===_0xa9cf8e(0x219)&&_0x1067af?.[_0xa9cf8e(0x1ab)]===_0xa9cf8e(0x219)&&resolveWaitStepPendingIds(_0x52afad,_0x1067af,_0x47e076,_0x10d972[_0xa9cf8e(0x174)]);}}}}function a136_0x2ca5(){const _0x5bb32a=['getJourney','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','connection','data','sort','589340fYabda','notification','getSegmentEntity','14tDhZzR','existingSegments','Updated\x20journey\x20\x27','JOURNEY_SYNTAX_ERROR','segmentNameToId','description','startsWith','parentId','activation_deleting','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','journeyActivationStepId','waitStepType','find','uniqueSegmentName','activation_','Duration','\x20segment\x20from\x20file:\x20','debug','DecisionPoint','createSegment','270netrCg','relationships','hasChanges','Deleted\x20activation\x20\x27','SEGMENT_NOT_FOUND','toLowerCase','hex','max','map','\x27\x20not\x20found\x20in\x20journey\x20\x27','toISOString','WaitStep',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','100782wPXMjv','created','segmentId','match','keys','split','goal\x20criteria','segmentByFolderAndName','embedded_segment_creating','isNew','segment','entries','77BRzcbc','skipSegments','isArray','relative','behavior','exitCriterias','\x27\x20entry\x20criteria','state','journeyById','Failed\x20to\x20resolve\x20activation\x20','decision_point','activation_updated','nameToId','buildUserMaps','\x27\x20wait\x20condition','Failed\x20to\x20fetch\x20referenced\x20segment\x20','1851992nxLinh','segment_deleting','journey_updated','\x27\x20from\x20file:\x20','620700tBKXot','journeyId','activationsBySegmentId','folder_created','connectionIdToNameMap','localName','logDeleted','deleteActivation','Entry\x20criteria:\x20','journeys','has','nameToType','Condition','unchanged','existingActivation','segment_updating','journeyStages','./child-segment-yaml.js','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','8BIfyNH','Deleted\x20segment\x20\x27','createdSegmentIds','effectiveFolderId','Creating\x20activation\x20\x27','journeyActivationNameToId','Created\x20activation\x20\x27','54838icZsRP','folder_creating','\x27\x20to\x20local\x20\x27','deleted','createActivation','conditionTimeoutDuration','parse','Failed\x20to\x20resolve\x20segment\x20','run_after_journey_refresh','embeddedSegmentNameToId','stringify','\x27\x20exit\x20criteria','segment_updated','Embedded\x20segment\x20\x27','filter','conditionTimeoutUnit','valid','./journey-yaml.js','listActivations','stage\x20\x27','from','goal','journey_creating','push','update','flatMap','Matched\x20server\x20segment\x20\x27','errors','logWarning','activationContext','Fetching\x20','Created\x20journey\x20\x27','existingJourney','attributes','conditions','journeyName','updated','and\x20the\x20server\x20segment,\x20then\x20retry.','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','name','deps','activation_template_id','journey','getSegment\x20failed\x20for\x20','all','\x20activation\x20\x27','entry','Updating\x20segment\x20\x27','waitStepUnit','getSegmentEntity\x20also\x20failed\x20for\x20','milestone','JOURNEY_UPDATE_ERROR','Failed\x20to\x20','rule','.$1.push-recovery.json','SEGMENT_UPDATE_ERROR','):\x20','resolveJourneyId','\x27...','Updated\x20segment\x20\x27','NOT_FOUND','get','list','folderPath','embedded_activation_created','folderId','updateSegmentById','activationActions','24AUkcGl','\x27\x20by\x20rule\x20content','set','1156284wmvEVw','join','entryCriteria','trim','logSuccess','rootFolderId','object','uniqueServerName','size','withProgress',').\x20','all_columns','createFolder','replace','action','conditionSegmentId','segmentFolderId','length','Created\x20segment\x20\x27','sha1','INTERNAL','parseDocument','\x20error(s)','type','create','journeyBundleName','activations','fetchJourney','reduce','dirname','delete','segments','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','add','getLatestJourneyId','validatedRequest','Updated\x20activation\x20\x27','with','onProgress','updateActivation','createdSegmentId','\x20journey\x20from\x20file:\x20','resolveSegment','resolvedRule','utf-8','\x0a\x20\x20','activation_deleted','verbose','Stage\x20\x27','steps','index','__pending_act_','parentFolder','entry_criteria','deleteSegment','folderPathToId','columns','Segment\x20not\x20found:\x20','activation_creating','yamlActivation','activation_updating','versionNumber','Name\x20has\x20already\x20been\x20taken','journeyBundlesByFolderAndName','slice','Created\x20folder\x20\x27','Creating\x20segment\x20\x27','branches','activationStepsById','connector_config','some','\x20(referenced\x20in\x20journey\x20','schedule','values','waitStep','journey_created','idToEmailMap','draft','absolutePath','41198IOhESb','getActivation','journeyBundleId','yamlConfig','createJourneySegment','results','segment_creating','\x27\x20for\x20','progress','stages','../../utils/async.js','ACTIVATION_UPDATE_ERROR','message','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','existingSegment'];a136_0x2ca5=function(){return _0x5bb32a;};return a136_0x2ca5();}
1
+ const a136_0x3aef17=a136_0x39b7;(function(_0x18f438,_0x58e13d){const _0x2542e9=a136_0x39b7,_0x5317a6=_0x18f438();while(!![]){try{const _0x1c1cbe=parseInt(_0x2542e9(0x14b))/0x1+parseInt(_0x2542e9(0xee))/0x2*(parseInt(_0x2542e9(0x139))/0x3)+-parseInt(_0x2542e9(0xc4))/0x4+parseInt(_0x2542e9(0x16c))/0x5*(parseInt(_0x2542e9(0x162))/0x6)+parseInt(_0x2542e9(0xc8))/0x7*(-parseInt(_0x2542e9(0xfa))/0x8)+-parseInt(_0x2542e9(0x11e))/0x9*(-parseInt(_0x2542e9(0x10a))/0xa)+parseInt(_0x2542e9(0x131))/0xb*(parseInt(_0x2542e9(0x12e))/0xc);if(_0x1c1cbe===_0x58e13d)break;else _0x5317a6['push'](_0x5317a6['shift']());}catch(_0x2e6440){_0x5317a6['push'](_0x5317a6['shift']());}}}(a136_0x111c,0x69e05));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a136_0x3aef17(0x16d));export const PENDING_SEGMENT_PREFIX=a136_0x3aef17(0x11a);export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0x47c0ef){return''+PENDING_SEGMENT_PREFIX+_0x47c0ef+'__';}export function isPendingSegmentId(_0x2c04db){const _0xfe9b24=a136_0x3aef17;return _0x2c04db['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x2c04db[_0xfe9b24(0x140)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x174439){const _0x29c890=a136_0x3aef17;return _0x174439[_0x29c890(0xe0)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x3c18c0){return''+PENDING_ACTIVATION_PREFIX+_0x3c18c0+'__';}export function isPendingActivationId(_0x1e11a7){const _0x538bbb=a136_0x3aef17;return _0x1e11a7[_0x538bbb(0x140)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x3e5c48){const _0x3ddcec=a136_0x3aef17;return _0x3e5c48[_0x3ddcec(0xe0)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x1eb2c2,_0x233790){const _0x26866e=a136_0x3aef17,_0x484105=_0x1eb2c2+'::'+(_0x233790[_0x26866e(0x181)]()||_0x26866e(0xa3)),_0x4d7946=createHash('sha1')[_0x26866e(0x137)](_0x484105)['digest'](_0x26866e(0x118))['slice'](0x0,0xc);return _0x26866e(0x174)+_0x4d7946;}export function ensureJourneyDefaults(_0x35af9b){const _0x50c4e5=a136_0x3aef17;!_0x35af9b[_0x50c4e5(0x16b)]&&(_0x35af9b[_0x50c4e5(0x16b)]=''),!_0x35af9b['state']&&(_0x35af9b[_0x50c4e5(0x142)]=_0x50c4e5(0x105));}export function injectExistingStageIds(_0x2fa5f1,_0x530438){const _0x2bc768=a136_0x3aef17,_0x6feabb=new Map(_0x530438['map'](_0x4429db=>[_0x4429db['name'],_0x4429db['id']]));for(const _0x3667e2 of _0x2fa5f1){if(!_0x3667e2['id']){const _0x2e68b2=_0x6feabb[_0x2bc768(0xe9)](_0x3667e2[_0x2bc768(0xfc)]);_0x2e68b2&&(_0x3667e2['id']=_0x2e68b2);}}}export function resolveTDFolderPath(_0x4885d1,_0x1b9e8d,_0x579f99){const _0x589412=a136_0x3aef17;if(!_0x1b9e8d)return _0x4885d1;if(_0x4885d1===_0x579f99||_0x4885d1[_0x589412(0x140)](_0x579f99+'/'))return _0x4885d1;return _0x4885d1?_0x579f99+'/'+_0x4885d1:_0x579f99;}export function addFoldersToCreate(_0x2629ad,_0x4b5f84,_0x3c948a){const _0x240d59=a136_0x3aef17;if(!_0x2629ad)return;if(_0x4b5f84[_0x240d59(0x132)](_0x2629ad))return;const _0x532453=_0x2629ad[_0x240d59(0xec)]('/');let _0x2e7972='';for(const _0x3c427c of _0x532453){_0x2e7972=_0x2e7972?_0x2e7972+'/'+_0x3c427c:_0x3c427c,!_0x4b5f84[_0x240d59(0x132)](_0x2e7972)&&_0x3c948a[_0x240d59(0x99)](_0x2e7972);}}export function sortFoldersByDepth(_0x4f8d50){const _0x1f69b2=a136_0x3aef17;return[..._0x4f8d50][_0x1f69b2(0x157)]((_0x90ab5,_0x3758f3)=>{const _0x13e5eb=_0x1f69b2,_0x325433=(_0x90ab5[_0x13e5eb(0x148)](/\//g)||[])['length'],_0x2b4858=(_0x3758f3['match'](/\//g)||[])[_0x13e5eb(0x93)];return _0x325433-_0x2b4858;});}import*as a136_0x42129b from'yaml';import{readFileSync}from'fs';import a136_0x2cf61d from'path';import{isJourneyDef,parseYamlString as a136_0x52b19f,toYamlString as a136_0x3b10e7,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 a136_0x39b7(_0x16f507,_0x5a0a80){_0x16f507=_0x16f507-0x90;const _0x111cd0=a136_0x111c();let _0x39b734=_0x111cd0[_0x16f507];return _0x39b734;}import{batchAsync}from'../../utils/async.js';function a136_0x111c(){const _0x389c9c=['journeyActivationStepId','getSegment','goal','\x20journey\x20from\x20file:\x20','hex','\x20error(s)','__pending_','reduce','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','):\x20','108ytZHuZ','relationships','max','run_after_journey_refresh','folderPath','waitStepType','listActivations','activation_updated','parentId','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','branches','activationActions','toLowerCase','existingSegments','segmentId','logSuccess','4406808giedol','entryCriteria','size','22HDevgT','has','created','decision_point','find','notification','update','entries','1317arMcqb','embedded_segment_created','JOURNEY_SYNTAX_ERROR','fetchJourney','\x27\x20exit\x20criteria','conditionTimeoutDuration','getJourney','startsWith','diff','state','activationStepsById','map','./child-segment-yaml.js','isNew','Deleted\x20segment\x20\x27','match','segmentFolderId','withProgress','738763WCXJhe','\x27\x20milestone','existingJourney','segment_deleted','verbose','values','data','getSegmentEntity','WaitStep','Embedded\x20segment\x20\x27','segmentNameToId','SEGMENT_NOT_FOUND','sort','\x20activation\x20\x27','createJourneySegment','embedded_activation_creating','\x27\x20from\x20file:\x20','Matched\x20server\x20segment\x20\x27','createFolder','journeyBundleName','deleted','parseDocument','Creating\x20folder\x20\x27','593874BloQTc','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','existingActivation','action','delete','keys','conditionSegmentId','attributes',').\x20','description','5RHMccA','tdx.sdk.push-workflow','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','with','user','valid','day','Creating\x20segment\x20\x27','journey_entry_criteria_','Condition','isArray','connection','logDeleted','journey_updated','journeys','Delete\x20the\x20push\x20recovery\x20file\x20(','embedded_segment_creating','Updating\x20activation\x20\x27','ACTIVATION_UPDATE_ERROR','list','\x20(referenced\x20in\x20journey\x20','trim','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','existingSegment','activation_deleting','stringify','goal\x20criteria','createdSegmentId','effectiveFolderId','deps','index','activationParams','exitCriterias','idToName','push','onProgress','resolvedRule','deleteSegment','nameToId','segments','Updating\x20segment\x20\x27','\x27...','\x27\x20decision\x20point\x20branch\x20\x27','rootFolderId','folder','errors','\x27\x20entry\x20criteria','activationsBySegmentId','uniqueServerName','Failed\x20to\x20fetch\x20referenced\x20segment\x20','getSegmentEntity\x20also\x20failed\x20for\x20','length','versionNumber','entry_criteria','connector_config','stages','all','add','object','\x0a\x20\x20','getSegment\x20failed\x20for\x20','results','Segment\x20not\x20found','Duration','Entry\x20criteria:\x20','activations','\x27\x20wait\x20condition','segment','steps','activationContext','createdSegmentIds','Journey\x20\x27','Created\x20activation\x20\x27','conditionTimeoutUnit','stage\x20\x27','journeyStages','parentSegmentFolder','journeyById','activation_template_id','segment_created','journey_created','journeyBundlesByFolderAndName','idToEmailMap','and\x20the\x20server\x20segment,\x20then\x20retry.','Deleted\x20activation\x20\x27','Stage\x20\x27','Name\x20has\x20already\x20been\x20taken','yamlConfig','milestone','Failed\x20to\x20','Segment\x20not\x20found:\x20','dirname','waitStep','Updated\x20journey\x20\x27','type','createActivation','\x27\x20not\x20found\x20in\x20journey\x20\x27','set','create','toISOString','3266152JxwssK','updateSegmentById','journey_creating','segment_deleting','1631RYqyGq','DecisionPoint','updated','toString','schedule','nameToType','Failed\x20to\x20resolve\x20segment\x20','.$1.push-recovery.json','slice','journey','Activation\x20not\x20found:\x20','segment_creating','connectionIdToNameMap','embeddedSegmentNameToId','journeyId','folderPathToId','NOT_FOUND','SEGMENT_SYNTAX_ERROR','hasChanges','INTERNAL',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','resolveJourneyId','\x20segment\x20from\x20file:\x20','localName','replace','unchanged','folder_creating','behavior','columns','journeyName','uniqueSegmentName','Creating\x20activation\x20\x27','message','get','yamlActivation','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','split','from','1068alqfMd','conditions','rule','../../utils/async.js','some','parse','absolutePath','SEGMENT_UPDATE_ERROR','relative','journey_updating','\x27\x20to\x20local\x20\x27','skipSegments','19144NsOHWv','all_columns','name','\x27\x20for\x20','item','Deleting\x20activation\x20\x27','getActivation','debug','Created\x20journey\x20\x27','entry','./journey-yaml.js','draft','includes','progress','segmentByFolderAndName','waitStepUnit','950KVldoB','folderId','activation_deleted','join','filter','validatedRequest','activation_creating','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','Fetching\x20','utf-8'];a136_0x111c=function(){return _0x389c9c;};return a136_0x111c();}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(_0xe81b00){const _0x54fb53=a136_0x3aef17;if(Array[_0x54fb53(0x176)](_0xe81b00))return'['+_0xe81b00[_0x54fb53(0x144)](_0x3ee7e7=>stableStringify(_0x3ee7e7))[_0x54fb53(0x10d)](',')+']';if(_0xe81b00&&typeof _0xe81b00===_0x54fb53(0x9a)){const _0x3cb061=_0xe81b00,_0x5b56ca=Object['keys'](_0x3cb061)[_0x54fb53(0x157)](),_0x7a6a34=_0x5b56ca[_0x54fb53(0x144)](_0x13016f=>'\x22'+_0x13016f+'\x22:'+stableStringify(_0x3cb061[_0x13016f]));return'{'+_0x7a6a34['join'](',')+'}';}const _0x12c603=JSON[_0x54fb53(0x185)](_0xe81b00);return _0x12c603===undefined?'null':_0x12c603;}function activationSignature(_0x46ef42){const _0x6ecb1e=a136_0x3aef17,_0x55f4f5={'connection':_0x46ef42[_0x6ecb1e(0x177)],..._0x46ef42[_0x6ecb1e(0xfb)]!==undefined&&{'all_columns':_0x46ef42[_0x6ecb1e(0xfb)]},..._0x46ef42[_0x6ecb1e(0xe4)]!==undefined&&{'columns':_0x46ef42['columns']},..._0x46ef42[_0x6ecb1e(0xe3)]!==undefined&&{'behavior':_0x46ef42[_0x6ecb1e(0xe3)]},..._0x46ef42['schedule']!==undefined&&{'schedule':_0x46ef42[_0x6ecb1e(0xcc)]},..._0x46ef42[_0x6ecb1e(0x136)]!==undefined&&{'notification':_0x46ef42['notification']},..._0x46ef42[_0x6ecb1e(0x96)]!==undefined&&{'connector_config':_0x46ef42['connector_config']},..._0x46ef42[_0x6ecb1e(0xae)]!==undefined&&{'activation_template_id':_0x46ef42[_0x6ecb1e(0xae)]}};return stableStringify(_0x55f4f5);}async function fetchSegment(_0x1aaabc,_0x38e1b7,_0x5583cc,_0x23b6de){const _0x194c56=a136_0x3aef17,_0x47fed7=_0x23b6de?.[_0x194c56(0x135)](_0x4fe3a0=>_0x4fe3a0['id']===_0x5583cc);if(_0x47fed7)return _0x47fed7;try{return await _0x1aaabc['segment'][_0x194c56(0x115)](_0x38e1b7,_0x5583cc);}catch(_0x220b51){logger[_0x194c56(0x101)](_0x194c56(0x9c)+_0x5583cc+_0x194c56(0xdc)+_0x220b51);try{return await _0x1aaabc[_0x194c56(0xa3)][_0x194c56(0x152)](_0x5583cc);}catch(_0x341e2f){return logger[_0x194c56(0x101)](_0x194c56(0x92)+_0x5583cc+':\x20'+_0x341e2f),null;}}}function recoverSegmentIdsFromPushRecovery(_0x44ea52,_0x36fa9d,_0x4b2154){const _0x4a746b=a136_0x3aef17,_0x44af6d=readPushRecovery(_0x44ea52[_0x4a746b(0xf4)]);if(_0x44af6d?.[_0x4a746b(0xe5)]===_0x44ea52[_0x4a746b(0xb7)]['name'])for(const [_0x360246,_0x59bffd]of Object[_0x4a746b(0x138)](_0x44af6d[_0x4a746b(0x193)])){const _0x1d57df=generateDeterministicJourneySegmentName(_0x44ea52[_0x4a746b(0xb7)][_0x4a746b(0xfc)],_0x360246);_0x59bffd[_0x4a746b(0x90)]===_0x1d57df&&(_0x36fa9d[_0x4a746b(0xc1)](_0x360246,_0x59bffd['segmentId']),_0x4b2154[_0x4a746b(0xc1)](_0x360246,_0x59bffd[_0x4a746b(0x12c)]));}}async function createOrRecoverEmbeddedSegment(_0x45acd0,_0x28066b,_0xde8a32,_0x50221d){const _0xa9d105=a136_0x3aef17;let _0x4f7a41;try{_0x4f7a41=await _0x45acd0[_0xa9d105(0xa3)][_0xa9d105(0x159)]({'name':_0xde8a32[_0xa9d105(0xe6)],'description':_0xde8a32[_0xa9d105(0x16b)],'journeyId':_0xde8a32[_0xa9d105(0xd6)],'rule':_0x50221d(_0xde8a32['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0xde8a32[_0xa9d105(0x10b)],'audienceId':_0xde8a32[_0xa9d105(0x126)]});}catch(_0x340fe6){const _0x566578=_0x340fe6 instanceof Error&&_0x340fe6[_0xa9d105(0xe8)][_0xa9d105(0x106)](_0xa9d105(0xb6));if(_0x566578){const _0x39d4d5=readPushRecovery(_0x28066b['absolutePath']),_0x3b8db1=_0x39d4d5?.[_0xa9d105(0xe5)]===_0x28066b['yamlConfig'][_0xa9d105(0xfc)]?_0x39d4d5[_0xa9d105(0x193)][_0xde8a32[_0xa9d105(0xdf)]]:undefined;if(_0x3b8db1?.[_0xa9d105(0x90)]===_0xde8a32[_0xa9d105(0xe6)])await _0x45acd0[_0xa9d105(0xa3)][_0xa9d105(0xc5)](_0xde8a32[_0xa9d105(0x126)],_0x3b8db1[_0xa9d105(0x12c)],{'description':_0xde8a32[_0xa9d105(0x16b)],'rule':_0x50221d(_0xde8a32[_0xa9d105(0x190)],!![]),'countPopulation':!![]}),_0x4f7a41=_0x3b8db1[_0xa9d105(0x12c)];else throw new SDKError(ErrorCode[_0xa9d105(0xf5)],_0xa9d105(0x154)+_0xde8a32[_0xa9d105(0xdf)]+_0xa9d105(0x11c)+(_0xa9d105(0x17b)+_0x28066b[_0xa9d105(0xf4)]['replace'](/([^/]+)$/,_0xa9d105(0xcf))+')\x20')+_0xa9d105(0xb3),_0x340fe6);}else throw _0x340fe6;}return saveSegmentToPushRecovery(_0x28066b[_0xa9d105(0xf4)],_0x28066b['yamlConfig'][_0xa9d105(0xfc)],_0xde8a32['localName'],{'segmentId':_0x4f7a41,'uniqueServerName':_0xde8a32[_0xa9d105(0xe6)],'createdAt':new Date()[_0xa9d105(0xc3)]()}),_0x4f7a41;}export async function prepareSegmentFiles(_0x209ad3,_0x30ca51,_0x1b993b,_0x27ec8a,_0x59b679){const _0xb20738=a136_0x3aef17,{activationDefToCreateRequest:_0x488d1f}=await import(_0xb20738(0x145)),_0x18a1f5=[],_0x2f809a=new Set();for(const {yamlConfig:_0x3122fa,folderPath:_0x20558f,sourcePath:_0x43f49e}of _0x209ad3){const _0x4da65e=resolveTDFolderPath(_0x20558f,_0x27ec8a,_0x59b679),_0x47b8c4=_0x4da65e+':'+_0x3122fa[_0xb20738(0xfc)],_0x53807e=_0x30ca51[_0xb20738(0x108)][_0xb20738(0xe9)](_0x47b8c4),_0x36f8be=_0x53807e?_0x30ca51[_0xb20738(0x19b)][_0xb20738(0xe9)](_0x53807e['id'])||[]:[];addFoldersToCreate(_0x4da65e,_0x30ca51['folderPathToId'],_0x2f809a);const _0x2e931d=calculateActivationActions(_0x3122fa[_0xb20738(0xa1)]||[],_0x36f8be,_0x30ca51[_0xb20738(0xb2)],_0x30ca51['connectionIdToNameMap']);for(const _0x588d83 of _0x2e931d){(_0x588d83['type']==='create'||_0x588d83['type']===_0xb20738(0x137))&&_0x588d83['yamlActivation']&&(_0x588d83[_0xb20738(0x10f)]=await _0x488d1f(_0x588d83[_0xb20738(0xea)],_0x1b993b));}const _0x5db702=calculateSegmentDiff(_0x3122fa,_0x53807e,_0x36f8be,_0x30ca51[_0xb20738(0xb2)],_0x30ca51[_0xb20738(0xd4)]);_0x18a1f5[_0xb20738(0x18e)]({'relativePath':_0x3122fa[_0xb20738(0xfc)],'absolutePath':_0x43f49e,'yamlConfig':_0x3122fa,'folderPath':_0x4da65e,'existingSegment':_0x53807e,'existingActivations':_0x36f8be,'isNew':_0x5db702[_0xb20738(0x146)],'hasChanges':_0x5db702[_0xb20738(0xda)],'diff':_0x5db702[_0xb20738(0x141)],'activationActions':_0x2e931d});}return{'segmentFiles':_0x18a1f5,'foldersToCreate':_0x2f809a};}export async function prepareJourneyFiles(_0x450a5c,_0xbf8388,_0x52bfb7,_0x31cef4){const _0x208f1a=a136_0x3aef17,_0x4c6891=[],_0x13e226=new Set();for(const {yamlConfig:_0x161e69,folderPath:_0x4cf788,sourcePath:_0x243ede}of _0x450a5c){const _0x5efb4b=resolveTDFolderPath(_0x4cf788,_0x52bfb7,_0x31cef4),_0x23cd8b=_0x5efb4b+':'+_0x161e69[_0x208f1a(0xfc)],_0x4e08ea=_0xbf8388[_0x208f1a(0xb1)][_0x208f1a(0xe9)](_0x23cd8b);let _0x5a75fe,_0x16c653;if(_0x4e08ea&&_0x4e08ea['length']>0x0){const _0x1228be=buildLocalExpandedRuleMappings(_0x161e69),{createYamlContext:_0x3a705d,prefetchJourneySegments:_0x11191d}=createPushYamlContextForBundle(_0xbf8388[_0x208f1a(0x189)],_0xbf8388[_0x208f1a(0x126)],_0xbf8388[_0x208f1a(0x12b)],_0x1228be,_0xbf8388[_0x208f1a(0xb2)],_0xbf8388[_0x208f1a(0xd4)],_0xbf8388[_0x208f1a(0x143)],_0xbf8388[_0x208f1a(0xad)]);await _0x11191d(_0x4e08ea['map'](_0x4e4897=>_0x4e4897['id']));const _0x5e4961=await _0xbf8388[_0x208f1a(0x189)][_0x208f1a(0xd1)]['getLatestJourneyId'](_0x4e08ea[0x0]['journeyBundleId']),_0x4f579c=hasMultipleVersions(_0x161e69),_0x23b7c6=async _0x110d8c=>{const _0x12a1cd=_0x208f1a,_0x3a1e30=_0xbf8388[_0x12a1cd(0xad)]?.[_0x12a1cd(0xe9)](_0x110d8c);if(_0x3a1e30)return _0x3a1e30;return _0xbf8388[_0x12a1cd(0x13c)]({'journeyId':_0x110d8c,'journeyName':_0x161e69['name'],'isMultiVersion':_0x4e08ea[_0x12a1cd(0x93)]>0x1});};if(_0x4f579c&&_0x4e08ea[_0x208f1a(0x93)]>0x1){const _0x52c97c=[];for(const _0x499401 of _0x4e08ea){const _0x238edc=_0x499401[_0x208f1a(0x94)]||0x1;_0xbf8388[_0x208f1a(0x107)]?.[_0x208f1a(0x137)]('Fetching\x20'+_0x161e69[_0x208f1a(0xfc)]+'\x20v'+_0x238edc);const _0x309160=await _0x23b7c6(_0x499401['id']),_0x58eb75=_0x3a705d(_0x499401['id']),_0x4e6629=await journeyResponseToDef(_0x309160,_0x58eb75);_0x52c97c[_0x208f1a(0x18e)]({'item':_0x499401,'yaml':_0x4e6629});}const _0x552c6d=buildLocalRuleToNameMappingFromJourney(_0x161e69);_0x16c653=buildMergedJourneyDef(_0x52c97c,_0x552c6d,_0x5e4961);const _0x58b4db=Math[_0x208f1a(0x120)](..._0x52c97c[_0x208f1a(0x144)](_0x47bc0c=>_0x47bc0c[_0x208f1a(0xfe)][_0x208f1a(0x94)]||0x0)),_0xb51c54=_0x4e08ea[_0x208f1a(0x135)](_0x1260a7=>(_0x1260a7[_0x208f1a(0x94)]||0x0)===_0x58b4db);_0xb51c54&&(_0xbf8388['progress']?.[_0x208f1a(0x137)](_0x208f1a(0x112)+_0x161e69[_0x208f1a(0xfc)]+'\x20v'+_0x58b4db),_0x5a75fe=await _0x23b7c6(_0xb51c54['id']));}else{const _0x15218c=_0x4e08ea[_0x4e08ea[_0x208f1a(0x93)]-0x1];_0xbf8388['progress']?.[_0x208f1a(0x137)](_0x208f1a(0x112)+_0x161e69['name']),_0x5a75fe=await _0x23b7c6(_0x15218c['id']);const _0x1a7271=_0x3a705d(_0x15218c['id']),_0x5d8b73=await journeyResponseToDef(_0x5a75fe,_0x1a7271),_0x3454ac=buildLocalRuleToNameMappingFromJourney(_0x161e69);_0x16c653=buildMergedJourneyDef([{'item':_0x15218c,'yaml':_0x5d8b73}],_0x3454ac,_0x5e4961);}}addFoldersToCreate(_0x5efb4b,_0xbf8388[_0x208f1a(0xd7)],_0x13e226);const _0x31e85f=calculateJourneyDiff(_0x161e69,_0x16c653);_0x4c6891[_0x208f1a(0x18e)]({'relativePath':_0x161e69[_0x208f1a(0xfc)],'absolutePath':_0x243ede,'yamlConfig':_0x161e69,'folderPath':_0x5efb4b,'existingJourney':_0x5a75fe,'isNew':_0x31e85f[_0x208f1a(0x146)],'hasChanges':_0x31e85f[_0x208f1a(0xda)],'diff':_0x31e85f[_0x208f1a(0x141)]});}return{'journeyFiles':_0x4c6891,'foldersToCreate':_0x13e226};}export function calculateActivationActions(_0xe72ddf,_0x11585c,_0x2a0533,_0x34a585){const _0x47c10f=a136_0x3aef17,_0x48e79a=[],_0x38733c=new Map();for(const _0x24d2b0 of _0x11585c){_0x38733c[_0x47c10f(0xc1)](_0x24d2b0['name'],_0x24d2b0);}const _0x4fbe86=new Map();for(const _0x7f4b23 of _0xe72ddf){_0x4fbe86['set'](_0x7f4b23[_0x47c10f(0xfc)],_0x7f4b23);}for(const _0x392dbe of _0xe72ddf){const _0x30ed21=_0x38733c[_0x47c10f(0xe9)](_0x392dbe[_0x47c10f(0xfc)]);if(!_0x30ed21)_0x48e79a[_0x47c10f(0x18e)]({'type':_0x47c10f(0xc2),'name':_0x392dbe[_0x47c10f(0xfc)],'yamlActivation':_0x392dbe});else{const _0x30a281=activationResponseToDef(_0x30ed21,_0x2a0533,_0x34a585),_0x373c5a=a136_0x42129b[_0x47c10f(0x185)](_0x30a281),_0x5d214c=a136_0x42129b[_0x47c10f(0x185)](_0x392dbe);_0x373c5a!==_0x5d214c&&_0x48e79a['push']({'type':_0x47c10f(0x137),'name':_0x392dbe['name'],'yamlActivation':_0x392dbe,'existingActivation':_0x30ed21});}}for(const _0x33cad9 of _0x11585c){!_0x4fbe86['has'](_0x33cad9[_0x47c10f(0xfc)])&&_0x48e79a[_0x47c10f(0x18e)]({'type':_0x47c10f(0x166),'name':_0x33cad9[_0x47c10f(0xfc)],'existingActivation':_0x33cad9});}return _0x48e79a;}function calculateYamlDiff(_0x1ca7cb,_0x292d72){if(_0x292d72){const _0x2fd871=generateDiff(_0x292d72,_0x1ca7cb),_0x5f2620=hasChanges(_0x2fd871);return{'isNew':![],'hasChanges':_0x5f2620,'diff':_0x5f2620?formatDiffWithColors(_0x2fd871):undefined};}const _0x3b75e3=generateDiff('',_0x1ca7cb);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x3b75e3)};}export function calculateSegmentDiff(_0x5a8851,_0x21a1d8,_0x3858fd,_0xa121,_0x2dd560){const _0xcc8dc3=segmentToYamlString(_0x5a8851),_0x58af2c=_0x21a1d8?segmentToYamlString(segmentWithActivationsToYaml(_0x21a1d8,_0x3858fd,undefined,_0xa121,_0x2dd560)):undefined;return calculateYamlDiff(_0xcc8dc3,_0x58af2c);}export function calculateJourneyDiff(_0x16cde6,_0xdf8ad2){const _0xa71038=normalizeJourneyDef(_0x16cde6,_0x16cde6),_0x53db2b=a136_0x3b10e7(_0xa71038),_0x188d82=_0xdf8ad2?a136_0x3b10e7(normalizeJourneyDef(_0xdf8ad2,_0x16cde6)):undefined;return calculateYamlDiff(_0x53db2b,_0x188d82);}export function findSegmentsToDelete(_0x4b9c50,_0x2b9794,_0x13b0d4,_0x3dcbed,_0x38f1a0){const _0x1b9d1d=a136_0x3aef17,_0x41c794=new Set();for(const {yamlConfig:_0x56e456,folderPath:_0xd64a88}of _0x2b9794){_0x41c794[_0x1b9d1d(0x99)](_0xd64a88+':'+_0x56e456[_0x1b9d1d(0xfc)]);}return _0x4b9c50['filter'](_0x1bec88=>{const _0x6fd184=_0x1b9d1d,_0x512324=_0x1bec88['segmentFolderId']?_0x13b0d4['get'](_0x1bec88[_0x6fd184(0x149)][_0x6fd184(0xcb)]())||'':'',_0x1fbdb7=_0x512324+':'+_0x1bec88[_0x6fd184(0xfc)];if(_0x41c794['has'](_0x1fbdb7))return![];if(_0x38f1a0)return _0x512324===_0x3dcbed||_0x512324[_0x6fd184(0x140)](_0x3dcbed+'/');return!![];});}export function findJourneysToDelete(_0x1a8572,_0x16cc7e,_0xed97b5,_0x42100c,_0x51153f){const _0x4af5fe=a136_0x3aef17,_0x226e89=new Set();for(const {yamlConfig:_0x422771,folderPath:_0x3734f9}of _0x16cc7e){_0x226e89[_0x4af5fe(0x99)](_0x3734f9+':'+_0x422771['name']);}return _0x1a8572['filter'](_0x33d0e2=>{const _0x3637f7=_0x4af5fe,_0x3526af=_0x33d0e2[_0x3637f7(0x10b)]?_0xed97b5[_0x3637f7(0xe9)](_0x33d0e2[_0x3637f7(0x10b)])||'':'',_0xd8a93b=_0x3526af+':'+_0x33d0e2[_0x3637f7(0x15e)];if(_0x226e89[_0x3637f7(0x132)](_0xd8a93b))return![];if(_0x51153f)return _0x3526af===_0x42100c||_0x3526af[_0x3637f7(0x140)](_0x42100c+'/');return!![];});}export function buildSegmentLookupMap(_0xfdba68,_0x519546){const _0x69760=a136_0x3aef17,_0x4827e0=new Map();for(const _0x543367 of _0xfdba68){const _0x4557b7=_0x543367[_0x69760(0x149)]?_0x519546[_0x69760(0xe9)](_0x543367['segmentFolderId'][_0x69760(0xcb)]())||'':'',_0x50598e=_0x4557b7+':'+_0x543367[_0x69760(0xfc)];_0x4827e0[_0x69760(0xc1)](_0x50598e,_0x543367);}return _0x4827e0;}export function buildSegmentNameToIdMap(_0x44b73f){const _0x224149=new Map();for(const _0x439c28 of _0x44b73f){_0x224149['set'](_0x439c28['name'],_0x439c28['id']);}return _0x224149;}export function buildJourneyBundleLookupMap(_0x1a1de9,_0x496dd8){const _0x3d8fd8=a136_0x3aef17,_0x3c00aa=new Map();for(const _0x22bf2c of _0x1a1de9){const _0x27a956=_0x22bf2c[_0x3d8fd8(0x10b)]?_0x496dd8[_0x3d8fd8(0xe9)](_0x22bf2c[_0x3d8fd8(0x10b)])||'':'',_0xf92a5d=_0x27a956+':'+_0x22bf2c[_0x3d8fd8(0x15e)];!_0x3c00aa[_0x3d8fd8(0x132)](_0xf92a5d)&&_0x3c00aa[_0x3d8fd8(0xc1)](_0xf92a5d,[]),_0x3c00aa[_0x3d8fd8(0xe9)](_0xf92a5d)['push'](_0x22bf2c);}for(const _0x274610 of _0x3c00aa[_0x3d8fd8(0x150)]()){_0x274610[_0x3d8fd8(0x157)]((_0x5739fe,_0x14853f)=>(_0x5739fe['versionNumber']||0x0)-(_0x14853f[_0x3d8fd8(0x94)]||0x0));}return _0x3c00aa;}export function collectFoldersToCreate(_0xe35593,_0x1726e9){const _0x96a53b=a136_0x3aef17,_0x2366c2=new Set();for(const _0x10ebd6 of _0xe35593){if(!_0x10ebd6)continue;if(_0x1726e9['has'](_0x10ebd6))continue;const _0x4e6308=_0x10ebd6[_0x96a53b(0xec)]('/');let _0xab51e6='';for(const _0x5e4b30 of _0x4e6308){_0xab51e6=_0xab51e6?_0xab51e6+'/'+_0x5e4b30:_0x5e4b30,!_0x1726e9[_0x96a53b(0x132)](_0xab51e6)&&_0x2366c2[_0x96a53b(0x99)](_0xab51e6);}}return _0x2366c2;}export function parseAndClassifyYamlFiles(_0x425130,_0x2e23b3,_0x2cf8c2){const _0x3f6edf=a136_0x3aef17,_0x4dff42=[],_0x5798c9=[];for(const _0x1131af of _0x425130){const _0x3c6fc4=a136_0x2cf61d[_0x3f6edf(0xf6)](_0x2e23b3,a136_0x2cf61d[_0x3f6edf(0xbb)](_0x1131af)),_0x444dea=_0x3c6fc4==='.'?'':_0x3c6fc4,_0x5ddf1f=readFileSync(_0x1131af,_0x3f6edf(0x113)),_0x12f185=a136_0x42129b[_0x3f6edf(0xf3)](_0x5ddf1f);if(isJourneyDef(_0x12f185)){const _0x1fdbf8=a136_0x52b19f(_0x5ddf1f);_0x5798c9[_0x3f6edf(0x18e)]({'yamlConfig':_0x1fdbf8,'folderPath':_0x444dea,'sourcePath':_0x1131af});}else{if(!_0x2cf8c2?.[_0x3f6edf(0xf9)]){const _0x148d64=parseSegmentYamlFile(_0x5ddf1f),_0x13bf62=normalizeChildSegmentYaml(_0x148d64);_0x4dff42['push']({'yamlConfig':_0x13bf62,'folderPath':_0x444dea,'sourcePath':_0x1131af});}}}return{'segments':_0x4dff42,'journeys':_0x5798c9};}export function validateParsedFiles(_0x4e7d62,_0x25101b){const _0x8aa6ac=a136_0x3aef17,_0x3b900e=[];for(const {yamlConfig:_0x210722,sourcePath:_0x19810a}of _0x4e7d62[_0x8aa6ac(0x193)]){const _0x585c7a=readFileSync(_0x19810a,_0x8aa6ac(0x113)),_0x531c19=a136_0x42129b[_0x8aa6ac(0x160)](_0x585c7a),_0x16b479=validateSegmentDef(_0x210722,{'source':_0x585c7a,'document':_0x531c19},{'skipSchema':!![]});if(!_0x16b479[_0x8aa6ac(0x171)]){const _0x45eaf6=a136_0x2cf61d[_0x8aa6ac(0xf6)](_0x25101b,_0x19810a);_0x3b900e[_0x8aa6ac(0x18e)]({'filePath':_0x45eaf6,'source':_0x585c7a,'result':_0x16b479,'isJourney':![]});}}for(const {yamlConfig:_0x54339d,sourcePath:_0x2590d3}of _0x4e7d62[_0x8aa6ac(0x17a)]){const _0x2ab71b=readFileSync(_0x2590d3,'utf-8'),_0x1b7960=a136_0x42129b[_0x8aa6ac(0x160)](_0x2ab71b),_0x1fc705=validateJourneyDef(_0x54339d,{'source':_0x2ab71b,'document':_0x1b7960},{'skipSchema':!![]});if(!_0x1fc705[_0x8aa6ac(0x171)]){const _0x1fb4da=a136_0x2cf61d[_0x8aa6ac(0xf6)](_0x25101b,_0x2590d3);_0x3b900e[_0x8aa6ac(0x18e)]({'filePath':_0x1fb4da,'source':_0x2ab71b,'result':_0x1fc705,'isJourney':!![]});}}return _0x3b900e;}export function formatValidationErrors(_0x1cfb71){const _0x33d4c0=a136_0x3aef17,_0x5a9f20=[];for(const {filePath:_0x158262,source:_0x42829b,result:_0x49f0aa,isJourney:_0x25671e}of _0x1cfb71){const _0x1df9d7=_0x25671e?_0x33d4c0(0xd1):_0x33d4c0(0xa3);_0x5a9f20[_0x33d4c0(0x18e)]('\x0a'+_0x158262+'\x20('+_0x1df9d7+_0x33d4c0(0x11d)+_0x49f0aa[_0x33d4c0(0x199)]['length']+_0x33d4c0(0x119)),_0x5a9f20['push'](formatValidationResult(_0x49f0aa,_0x42829b,_0x158262));}return _0x5a9f20[_0x33d4c0(0x10d)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x201706){const _0x5e2a36=a136_0x3aef17,_0x5651e3=new Set(),_0x5648c8=new Map(),_0x20a0c1=collectSegmentUsageCounts(_0x201706);if(_0x201706[_0x5e2a36(0x193)])for(const [_0x333c82,_0x5c5a42]of Object[_0x5e2a36(0x138)](_0x201706[_0x5e2a36(0x193)])){_0x5651e3[_0x5e2a36(0x99)](_0x333c82);if(_0x5c5a42[_0x5e2a36(0xf0)]){const _0x5fdcd1=yamlRuleToApi(_0x5c5a42[_0x5e2a36(0xf0)]),_0x3b8ec3=apiRuleToYaml(_0x5fdcd1);_0x5648c8[_0x5e2a36(0xc1)](_0x333c82,_0x3b8ec3);}}const _0x1e56ec=new Map();let _0x4479e7=0x0;for(const [_0x1381b1,_0x44b669]of _0x5648c8){const _0x54e5e9=serializeExpandedRule(_0x44b669,_0x5648c8),_0x3f9a0d=_0x1e56ec['get'](_0x54e5e9)||[];_0x3f9a0d[_0x5e2a36(0x18e)]({'name':_0x1381b1,'index':_0x4479e7}),_0x1e56ec[_0x5e2a36(0xc1)](_0x54e5e9,_0x3f9a0d),_0x4479e7++;}const _0x23031a=new Map();for(const [_0x20ef60,_0x5c8018]of _0x1e56ec){const _0x3b5d9c=_0x5c8018[_0x5e2a36(0xd0)]()[_0x5e2a36(0x157)]((_0x2e5b48,_0x49a43c)=>{const _0x27f5f1=_0x5e2a36,_0x42a9b2=_0x20a0c1[_0x27f5f1(0xe9)](_0x2e5b48[_0x27f5f1(0xfc)])||0x0,_0x273912=_0x20a0c1['get'](_0x49a43c[_0x27f5f1(0xfc)])||0x0;if(_0x42a9b2!==_0x273912)return _0x273912-_0x42a9b2;return _0x2e5b48[_0x27f5f1(0x18a)]-_0x49a43c[_0x27f5f1(0x18a)];})[_0x5e2a36(0x144)](_0x44066a=>_0x44066a[_0x5e2a36(0xfc)]),_0xf6834f=[];for(const _0x351061 of _0x3b5d9c){const _0x53bcbe=_0x20a0c1[_0x5e2a36(0xe9)](_0x351061)||0x0,_0x10e392=Math[_0x5e2a36(0x120)](_0x53bcbe,0x1);for(let _0x439882=0x0;_0x439882<_0x10e392;_0x439882++){_0xf6834f[_0x5e2a36(0x18e)](_0x351061);}}_0x23031a[_0x5e2a36(0xc1)](_0x20ef60,_0xf6834f);}return{'existingLocalSegmentNames':_0x5651e3,'localSegmentRules':_0x5648c8,'localExpandedRuleToNames':_0x23031a};}export function createSegmentIdResolver(_0x5aaa6d,_0xff64a9){return async _0x447dfd=>{const _0x36e1aa=a136_0x39b7,_0x108230=_0x5aaa6d[_0x36e1aa(0xe9)](_0x447dfd);if(!_0x108230)throw new SDKError(ErrorCode[_0x36e1aa(0x156)],'Segment\x20not\x20found:\x20'+_0x447dfd+_0x36e1aa(0x111)+_0xff64a9+'\x27)');return _0x108230;};}export function extractRootFolderId(_0x313a96){const _0x391292=a136_0x3aef17;return _0x313a96['relationships']?.[_0x391292(0xac)]?.[_0x391292(0x151)]?.['id']||_0x313a96['relationships']?.['parentFolder']?.[_0x391292(0x151)]?.['id'];}export function buildConnectionMaps(_0x836b62){const _0x2bfa00=a136_0x3aef17,_0x2e4ce8=new Map(),_0x97b11e=new Map(),_0x821cd4=new Map();for(const _0x19c461 of _0x836b62){_0x2e4ce8[_0x2bfa00(0xc1)](_0x19c461['name'],parseInt(_0x19c461['id'],0xa)),_0x97b11e['set'](_0x19c461['id'],_0x19c461[_0x2bfa00(0xfc)]),_0x821cd4[_0x2bfa00(0xc1)](_0x19c461[_0x2bfa00(0xfc)],_0x19c461[_0x2bfa00(0xbe)]);}return{'nameToId':_0x2e4ce8,'idToName':_0x97b11e,'nameToType':_0x821cd4};}export function calculatePushStats(_0x2031f3,_0x415eac,_0x3fe616,_0x280244,_0x1dd6dc,_0x5bcca7,_0x596da0){const _0x474823=a136_0x3aef17,_0x182960=_0x2031f3[_0x474823(0x10e)](_0x340b59=>_0x340b59[_0x474823(0x146)]),_0x5c86d3=_0x2031f3['filter'](_0x133e17=>!_0x133e17['isNew']&&_0x133e17['hasChanges']),_0x3b8069=_0x2031f3[_0x474823(0x10e)](_0x34ed9e=>!_0x34ed9e['isNew']&&!_0x34ed9e['hasChanges']),_0x19bd33=_0x5bcca7?_0x280244:[],_0x620c57=_0x415eac[_0x474823(0x10e)](_0x3a4c61=>_0x3a4c61[_0x474823(0x146)]),_0x3de342=_0x415eac[_0x474823(0x10e)](_0x27be0d=>!_0x27be0d[_0x474823(0x146)]&&_0x27be0d[_0x474823(0xda)]),_0x3db485=_0x415eac[_0x474823(0x10e)](_0x2f5feb=>!_0x2f5feb[_0x474823(0x146)]&&!_0x2f5feb[_0x474823(0xda)]),_0x73f72=_0x5bcca7?_0x1dd6dc:[],_0x1726c3=_0x2031f3['flatMap'](_0x541fb7=>_0x541fb7[_0x474823(0x129)]),_0x3e6bfa=_0x1726c3[_0x474823(0x10e)](_0xb20a14=>_0xb20a14[_0x474823(0xbe)]===_0x474823(0xc2)),_0x102e95=_0x1726c3[_0x474823(0x10e)](_0xd229a5=>_0xd229a5[_0x474823(0xbe)]===_0x474823(0x137)),_0xb86735=_0x1726c3['filter'](_0x13de6a=>_0x13de6a[_0x474823(0xbe)]===_0x474823(0x166)),_0x570aed=Array['from'](_0x3fe616)['sort'](),_0x2f127f=_0x596da0?![]:_0x182960[_0x474823(0x93)]>0x0||_0x5c86d3[_0x474823(0x93)]>0x0||_0x19bd33[_0x474823(0x93)]>0x0,_0x4bbcb6=_0x620c57[_0x474823(0x93)]>0x0||_0x3de342[_0x474823(0x93)]>0x0||_0x73f72[_0x474823(0x93)]>0x0,_0x4a8bd6=_0x596da0?![]:_0x1726c3[_0x474823(0x93)]>0x0,_0x29360b=_0x570aed['length']>0x0;return{'segments':{'new':_0x182960,'changed':_0x5c86d3,'unchanged':_0x3b8069,'toDelete':_0x19bd33},'journeys':{'new':_0x620c57,'changed':_0x3de342,'unchanged':_0x3db485,'toDelete':_0x73f72},'activations':{'all':_0x1726c3,'toCreate':_0x3e6bfa,'toUpdate':_0x102e95,'toDelete':_0xb86735},'folders':{'toCreate':_0x570aed},'counts':{'segments':{'new':_0x182960[_0x474823(0x93)],'changed':_0x5c86d3[_0x474823(0x93)],'unchanged':_0x3b8069[_0x474823(0x93)],'toDelete':_0x19bd33[_0x474823(0x93)]},'journeys':{'new':_0x620c57[_0x474823(0x93)],'changed':_0x3de342[_0x474823(0x93)],'unchanged':_0x3db485[_0x474823(0x93)],'toDelete':_0x73f72['length']},'activations':{'create':_0x3e6bfa[_0x474823(0x93)],'update':_0x102e95[_0x474823(0x93)],'delete':_0xb86735[_0x474823(0x93)]},'folders':_0x570aed[_0x474823(0x93)]},'hasChanges':_0x2f127f||_0x4bbcb6||_0x4a8bd6||_0x29360b};}export async function buildPushExecutionContext(_0x1d5138,_0x3bf6af,_0x1ab10a,_0x43af1d,_0x40ab54,_0x4c1079){const _0x17a9c9=a136_0x3aef17,_0x5c0fd6=extractRootFolderId(_0x1ab10a),{pathToId:_0x207c42,idToPath:_0x3b823d}=buildFolderMaps(_0x40ab54),_0x2674a7=buildSegmentNameToIdMap(_0x43af1d),_0x1ac936=new Map(),{batchAsync:_0x539291}=await import(_0x17a9c9(0xf1)),[_0x3fecb7,_0x1a09ad]=await Promise[_0x17a9c9(0x98)]([_0x1d5138[_0x17a9c9(0x170)]['buildUserMaps'](),_0x1d5138['connection'][_0x17a9c9(0x17f)](),((async()=>{const _0x55afdf=_0x17a9c9;!_0x4c1079&&_0x43af1d[_0x55afdf(0x93)]>0x0&&await _0x539291(_0x43af1d,async _0x312cfc=>{const _0x1ff942=_0x55afdf,_0xc8e223=await _0x1d5138['segment'][_0x1ff942(0x124)](_0x3bf6af,_0x312cfc['id']);_0x1ac936['set'](_0x312cfc['id'],_0xc8e223);});})())]),{emailToId:_0x4bc963,idToEmail:_0x4916f6}=_0x3fecb7,_0xe12ba9=buildConnectionMaps(_0x1a09ad);return{'rootFolderId':_0x5c0fd6,'folderPathToId':_0x207c42,'folderIdToPath':_0x3b823d,'segmentNameToId':_0x2674a7,'activationsBySegmentId':_0x1ac936,'emailToIdMap':_0x4bc963,'idToEmailMap':_0x4916f6,'connectionNameToIdMap':_0xe12ba9[_0x17a9c9(0x192)],'connectionIdToNameMap':_0xe12ba9[_0x17a9c9(0x18d)],'connectionNameToTypeMap':_0xe12ba9[_0x17a9c9(0xcd)]};}export function createPushYamlContextForBundle(_0x26a3e7,_0x733b5d,_0x240240,_0x27bb0f,_0x281d2b,_0x104c0d,_0x421a18,_0x5a795d){const {existingLocalSegmentNames:_0x9857c2,localExpandedRuleToNames:_0x20a1a3}=_0x27bb0f,_0x511da4=new Set(),_0x3e8b03=new Map(),_0x161ded=new Map(),_0x83c44a=new Map(),_0x2b93d8=createJumpTargetCache(),_0x14aba5=new Map(),_0x6a3172=new Map(),_0x29f194=new Set();let _0x1d1da1;const _0x3e84d2=_0x2ce74b=>{const _0x217d86={'resolveSegment':async _0x41e041=>{const _0x4c85e4=a136_0x39b7,_0x114671=_0x83c44a['get'](_0x41e041);if(_0x114671!==undefined)return{'name':_0x114671,'isJourneyLocal':!![]};try{const _0x1ea903=await fetchSegment(_0x26a3e7,_0x733b5d,_0x41e041,_0x240240);if(!_0x1ea903)throw new Error(_0x4c85e4(0x9e));const _0x354e60=generateJourneyLocalName(_0x1ea903[_0x4c85e4(0xfc)]),_0x4a0f98=_0x1ea903['kind']===SEGMENT_KIND_JOURNEY&&_0x354e60!==undefined;let _0x1a6242=_0x1ea903[_0x4c85e4(0xfc)],_0x407e65;if(_0x4a0f98&&_0x1ea903[_0x4c85e4(0xf0)]){const _0x109431=apiRuleToYaml(_0x1ea903[_0x4c85e4(0xf0)]);_0x6a3172['set'](_0x41e041,_0x109431);const _0x2e5a04=async _0x3c7d31=>{const _0x29f189=_0x4c85e4,_0x2ec105=collectSegmentRefsFromRule(_0x3c7d31);for(const _0x3c3493 of _0x2ec105){if(!_0x6a3172[_0x29f189(0x132)](_0x3c3493))try{const _0x285880=await fetchSegment(_0x26a3e7,_0x733b5d,_0x3c3493,_0x240240);if(_0x285880?.[_0x29f189(0xf0)]){const _0x5171fb=apiRuleToYaml(_0x285880['rule']);_0x6a3172[_0x29f189(0xc1)](_0x3c3493,_0x5171fb),await _0x2e5a04(_0x5171fb);}}catch(_0x41294f){logger[_0x29f189(0x101)](_0x29f189(0x91)+_0x3c3493+':\x20'+_0x41294f);}}};await _0x2e5a04(_0x109431);const _0x5a87fd=serializeExpandedRule(_0x109431,_0x6a3172),_0x13cec6=_0x20a1a3[_0x4c85e4(0xe9)](_0x5a87fd);if(_0x13cec6&&_0x13cec6[_0x4c85e4(0x93)]>0x0){const _0x2185b2=_0x3e8b03['get'](_0x5a87fd)||0x0,_0x5dc677=_0x13cec6[_0x2185b2]||_0x13cec6[_0x13cec6[_0x4c85e4(0x93)]-0x1];_0x3e8b03[_0x4c85e4(0xc1)](_0x5a87fd,_0x2185b2+0x1),_0x1a6242=_0x5dc677,_0x511da4[_0x4c85e4(0x99)](_0x1a6242),_0x83c44a['set'](_0x41e041,_0x1a6242);const _0x2421cb=await resolveRuleSegmentRefs(_0x109431,async _0x415507=>{const _0x5ced94=_0x4c85e4,_0x4e7ce2=_0x83c44a[_0x5ced94(0xe9)](_0x415507);if(_0x4e7ce2)return _0x4e7ce2;const _0x49ed1e=await _0x1d1da1['resolveSegment'](_0x415507);return _0x49ed1e[_0x5ced94(0xfc)];});_0x407e65={'description':_0x1ea903[_0x4c85e4(0x16b)],'rule':_0x2421cb};}else{const _0x508cc0=_0x14aba5[_0x4c85e4(0xe9)](_0x5a87fd);if(_0x508cc0)_0x1a6242=_0x508cc0,_0x83c44a[_0x4c85e4(0xc1)](_0x41e041,_0x1a6242);else{if(_0x354e60){let _0x569572=_0x354e60,_0x14b4d4=0x2;while(_0x511da4[_0x4c85e4(0x132)](_0x569572)||_0x9857c2[_0x4c85e4(0x132)](_0x569572)){_0x569572=_0x354e60+'_'+_0x14b4d4,_0x14b4d4++;}_0x511da4['add'](_0x569572),_0x1a6242=_0x569572;}_0x83c44a[_0x4c85e4(0xc1)](_0x41e041,_0x1a6242),_0x14aba5[_0x4c85e4(0xc1)](_0x5a87fd,_0x1a6242);const _0x408772=await resolveRuleSegmentRefs(_0x109431,async _0x508c09=>{const _0x5c2d82=_0x4c85e4,_0x4d6b6e=_0x83c44a[_0x5c2d82(0xe9)](_0x508c09);if(_0x4d6b6e)return _0x4d6b6e;const _0x3d7144=await _0x1d1da1['resolveSegment'](_0x508c09);return _0x3d7144[_0x5c2d82(0xfc)];});_0x407e65={'description':_0x1ea903[_0x4c85e4(0x16b)],'rule':_0x408772};}}}return{'name':_0x1a6242,'isJourneyLocal':_0x4a0f98,'definition':_0x407e65};}catch(_0x137a26){return logger[_0x4c85e4(0x101)](_0x4c85e4(0xce)+_0x41e041+':\x20'+_0x137a26),{'name':_0x41e041,'isJourneyLocal':![]};}},'resolveActivation':async _0x41622a=>{const _0x250713=a136_0x39b7,_0x165d05=_0x161ded[_0x250713(0xe9)](_0x41622a);if(_0x165d05!==undefined)return{'name':_0x165d05,'isJourneyLocal':!![]};try{let _0x2298e7=_0x421a18?.[_0x250713(0xe9)](_0x41622a);!_0x2298e7&&(_0x2298e7=await _0x26a3e7[_0x250713(0xd1)][_0x250713(0x100)](_0x2ce74b,_0x41622a));const _0x29a358=_0x2298e7[_0x250713(0x169)][_0x250713(0x18b)][_0x250713(0xfc)]||_0x41622a,_0x568d8b=sanitizeYamlKey(_0x29a358)||'activation_'+_0x41622a,_0x191938=_0x568d8b;_0x161ded['set'](_0x41622a,_0x191938);const _0x1b32c6=journeyActivationStepToYaml(_0x2298e7,_0x281d2b,_0x104c0d);return{'name':_0x191938,'isJourneyLocal':!![],'definition':_0x1b32c6};}catch(_0x2baa2b){return logger[_0x250713(0x101)]('Failed\x20to\x20resolve\x20activation\x20'+_0x41622a+':\x20'+_0x2baa2b),{'name':_0x41622a,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x476b7a,_0x54e8ad)=>resolveJumpTarget(_0x476b7a,_0x54e8ad,_0x2b93d8,async _0x5e75af=>{const _0x52adbe=a136_0x39b7,_0x1d4102=_0x5a795d?.['get'](_0x5e75af);if(_0x1d4102)return _0x1d4102;return _0x26a3e7[_0x52adbe(0xd1)]['getJourney'](_0x5e75af);})};return _0x1d1da1=_0x217d86,_0x217d86;},_0x20891b=async _0x53b4ef=>{const _0x2a23f8=a136_0x39b7,{collectSegmentIdsFromJourneyApi:_0x3e9b0f}=await import(_0x2a23f8(0x104)),{batchAsync:_0x413113}=await import('../../utils/async.js'),_0x39c801=new Set();for(const _0x3a831e of _0x53b4ef){let _0x29a586=_0x5a795d?.[_0x2a23f8(0xe9)](_0x3a831e);!_0x29a586&&(_0x29a586=await _0x26a3e7['journey'][_0x2a23f8(0x13f)](_0x3a831e));const _0x86bbb1=_0x3e9b0f(_0x29a586);for(const _0x20e7ef of _0x86bbb1){_0x39c801[_0x2a23f8(0x99)](_0x20e7ef);}}let _0x26dac4=Array[_0x2a23f8(0xed)](_0x39c801);while(_0x26dac4[_0x2a23f8(0x93)]>0x0){const _0x730cbf=_0x26dac4[_0x2a23f8(0x10e)](_0x5548ba=>!_0x29f194[_0x2a23f8(0x132)](_0x5548ba));if(_0x730cbf[_0x2a23f8(0x93)]===0x0)break;const _0x15e1ae=await _0x413113(_0x730cbf,async _0x2eb899=>{const _0x29b85f=_0x2a23f8;_0x29f194[_0x29b85f(0x99)](_0x2eb899);const _0x1e424e=await fetchSegment(_0x26a3e7,_0x733b5d,_0x2eb899,_0x240240);if(!_0x1e424e)return null;return{'segmentId':_0x2eb899,'segment':_0x1e424e};},0xa),_0x161ac3=new Set();for(const _0x166bfe of _0x15e1ae){if(!_0x166bfe?.[_0x2a23f8(0xa3)]?.[_0x2a23f8(0xf0)])continue;const _0x422c0c=apiRuleToYaml(_0x166bfe[_0x2a23f8(0xa3)][_0x2a23f8(0xf0)]);_0x6a3172[_0x2a23f8(0xc1)](_0x166bfe[_0x2a23f8(0x12c)],_0x422c0c);const _0x366493=collectSegmentRefsFromRule(_0x422c0c);for(const _0x1345ef of _0x366493){!_0x29f194[_0x2a23f8(0x132)](_0x1345ef)&&_0x161ac3[_0x2a23f8(0x99)](_0x1345ef);}}_0x26dac4=Array[_0x2a23f8(0xed)](_0x161ac3);}};return{'createYamlContext':_0x3e84d2,'prefetchJourneySegments':_0x20891b};}export async function executePushSegments(_0x56b03b,_0x43ad8c,_0x430813,_0x12b931,_0xae6e51){const _0x2b433a=a136_0x3aef17,{segmentDefToCreateRequest:_0xeac0a3,segmentDefToUpdateRequest:_0x3b2c34}=await import(_0x2b433a(0x145)),_0x10b75d=_0x430813[_0x2b433a(0xd7)],_0x1a0dd1=0x5,_0x394fa3=async _0x2141e9=>{const _0x2f6b08=_0x2b433a,_0x36179d=_0x2141e9['folderPath']?_0x10b75d[_0x2f6b08(0xe9)](_0x2141e9[_0x2f6b08(0x122)]):undefined;let _0x6ef5c1;const _0x309f5e={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x4ccad5=_0x2141e9[_0x2f6b08(0xb7)];if(_0x2141e9[_0x2f6b08(0xb7)]['rule']){const _0x310104=createSegmentIdResolver(_0x430813[_0x2f6b08(0x155)],_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)]),_0x45e8a4=await resolveRuleSegmentIds(_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xf0)],_0x310104);_0x4ccad5={..._0x2141e9[_0x2f6b08(0xb7)],'rule':_0x45e8a4};}try{if(_0x2141e9[_0x2f6b08(0x146)]){_0xae6e51[_0x2f6b08(0x18f)]?.({'type':_0x2f6b08(0xd3),'name':_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)]});const _0xeace0a=_0xeac0a3(_0x4ccad5,_0x36179d),_0x2a572c=await _0xae6e51[_0x2f6b08(0x14a)](_0x2f6b08(0x173)+_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)]+_0x2f6b08(0x195),()=>_0x56b03b['segment']['createSegment'](_0x12b931[_0x2f6b08(0x126)],_0xeace0a));_0x6ef5c1=_0x2a572c['data']['id'],_0x430813[_0x2f6b08(0x155)][_0x2f6b08(0xc1)](_0x2141e9['yamlConfig'][_0x2f6b08(0xfc)],_0x6ef5c1),_0x309f5e[_0x2f6b08(0x187)]={'name':_0x2141e9['yamlConfig'][_0x2f6b08(0xfc)],'id':_0x6ef5c1},_0xae6e51[_0x2f6b08(0x18f)]?.({'type':_0x2f6b08(0xaf),'name':_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)],'segmentId':_0x6ef5c1}),_0xae6e51[_0x2f6b08(0x12d)]?.('Created\x20segment\x20\x27'+_0x2141e9['yamlConfig'][_0x2f6b08(0xfc)]+'\x27'),_0x309f5e[_0x2f6b08(0x133)]=0x1;}else{if(_0x2141e9[_0x2f6b08(0xda)]){_0xae6e51[_0x2f6b08(0x18f)]?.({'type':'segment_updating','name':_0x2141e9[_0x2f6b08(0xb7)]['name']});const _0x9a8803=_0x3b2c34(_0x4ccad5);_0x36179d!==_0x2141e9[_0x2f6b08(0x183)]?.[_0x2f6b08(0x149)]&&(_0x9a8803[_0x2f6b08(0x149)]=_0x36179d?parseInt(_0x36179d,0xa):undefined),await _0xae6e51[_0x2f6b08(0x14a)](_0x2f6b08(0x194)+_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)]+'\x27...',()=>_0x56b03b[_0x2f6b08(0xa3)][_0x2f6b08(0xc5)](_0x12b931['parentId'],_0x2141e9[_0x2f6b08(0x183)]['id'],_0x9a8803)),_0x6ef5c1=_0x2141e9[_0x2f6b08(0x183)]['id'],_0xae6e51[_0x2f6b08(0x18f)]?.({'type':'segment_updated','name':_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)]}),_0xae6e51['logSuccess']?.('Updated\x20segment\x20\x27'+_0x2141e9['yamlConfig'][_0x2f6b08(0xfc)]+'\x27'),_0x309f5e['updated']=0x1;}else _0x6ef5c1=_0x2141e9[_0x2f6b08(0x183)]['id'];}}catch(_0x4f4321){const _0x3ee230=isHttp400Error(_0x4f4321),_0x2800ee=_0x3ee230?ErrorCode[_0x2f6b08(0xd9)]:ErrorCode[_0x2f6b08(0xf5)],_0x3141f8=getErrorMessage(_0x4f4321);throw new SDKError(_0x2800ee,_0x2f6b08(0xb9)+(_0x2141e9['isNew']?_0x2f6b08(0xc2):_0x2f6b08(0x137))+_0x2f6b08(0xde)+_0x2141e9[_0x2f6b08(0xf4)]+'\x0a\x20\x20'+_0x3141f8,_0x4f4321);}try{const _0x1e729d=await syncActivationsForSegment(_0x56b03b,_0x12b931['parentId'],_0x6ef5c1,_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)],_0x2141e9[_0x2f6b08(0x129)],_0xae6e51,_0x2141e9['absolutePath']);_0x309f5e[_0x2f6b08(0xa1)]=_0x1e729d;}catch(_0x252161){if(_0x252161 instanceof SDKError)throw _0x252161;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x2f6b08(0xeb)+_0x2141e9[_0x2f6b08(0xb7)]['name']+_0x2f6b08(0x15b)+_0x2141e9['absolutePath']+_0x2f6b08(0x9b)+getErrorMessage(_0x252161),_0x252161);}return _0x309f5e;},_0x5500b9=await batchAsync(_0x43ad8c,_0x394fa3,_0x1a0dd1),_0x551f4a={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x5aed5d of _0x5500b9){_0x551f4a[_0x2b433a(0x133)]+=_0x5aed5d['created'],_0x551f4a['updated']+=_0x5aed5d['updated'],_0x5aed5d[_0x2b433a(0x187)]&&_0x551f4a[_0x2b433a(0xa6)]['set'](_0x5aed5d[_0x2b433a(0x187)][_0x2b433a(0xfc)],_0x5aed5d[_0x2b433a(0x187)]['id']),_0x551f4a[_0x2b433a(0xa1)][_0x2b433a(0x133)]+=_0x5aed5d[_0x2b433a(0xa1)][_0x2b433a(0x133)],_0x551f4a[_0x2b433a(0xa1)][_0x2b433a(0xca)]+=_0x5aed5d[_0x2b433a(0xa1)]['updated'],_0x551f4a[_0x2b433a(0xa1)][_0x2b433a(0x15f)]+=_0x5aed5d[_0x2b433a(0xa1)][_0x2b433a(0x15f)];}return _0x551f4a;}async function syncActivationsForSegment(_0xe64274,_0x33e7fb,_0x548dba,_0x47cd7e,_0x235ea2,_0x5ae290,_0x196785){const _0xf7547=a136_0x3aef17,_0x4c96f={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x3d56a6 of _0x235ea2){try{if(_0x3d56a6['type']===_0xf7547(0xc2)&&_0x3d56a6[_0xf7547(0x10f)])_0x5ae290[_0xf7547(0x18f)]?.({'type':_0xf7547(0x110),'segmentName':_0x47cd7e,'activationName':_0x3d56a6[_0xf7547(0xfc)]}),await _0x5ae290[_0xf7547(0x14a)](_0xf7547(0xe7)+_0x3d56a6[_0xf7547(0xfc)]+'\x27...',()=>_0xe64274['segment'][_0xf7547(0xbf)](_0x33e7fb,_0x548dba,_0x3d56a6['validatedRequest'])),_0x5ae290[_0xf7547(0x18f)]?.({'type':'activation_created','segmentName':_0x47cd7e,'activationName':_0x3d56a6[_0xf7547(0xfc)]}),_0x5ae290[_0xf7547(0x12d)]?.(_0xf7547(0xa8)+_0x3d56a6['name']+'\x27'),_0x4c96f['created']++;else{if(_0x3d56a6[_0xf7547(0xbe)]===_0xf7547(0x137)&&_0x3d56a6[_0xf7547(0x10f)]&&_0x3d56a6[_0xf7547(0x164)])_0x5ae290[_0xf7547(0x18f)]?.({'type':'activation_updating','segmentName':_0x47cd7e,'activationName':_0x3d56a6[_0xf7547(0xfc)]}),await _0x5ae290[_0xf7547(0x14a)](_0xf7547(0x17d)+_0x3d56a6['name']+_0xf7547(0x195),()=>_0xe64274[_0xf7547(0xa3)]['updateActivation'](_0x33e7fb,_0x548dba,_0x3d56a6[_0xf7547(0x164)]['id'],_0x3d56a6[_0xf7547(0x10f)])),_0x5ae290[_0xf7547(0x18f)]?.({'type':_0xf7547(0x125),'segmentName':_0x47cd7e,'activationName':_0x3d56a6[_0xf7547(0xfc)]}),_0x5ae290[_0xf7547(0x12d)]?.('Updated\x20activation\x20\x27'+_0x3d56a6['name']+'\x27'),_0x4c96f[_0xf7547(0xca)]++;else _0x3d56a6['type']===_0xf7547(0x166)&&_0x3d56a6[_0xf7547(0x164)]&&(_0x5ae290[_0xf7547(0x18f)]?.({'type':_0xf7547(0x184),'segmentName':_0x47cd7e,'activationName':_0x3d56a6['name']}),await _0x5ae290[_0xf7547(0x14a)](_0xf7547(0xff)+_0x3d56a6[_0xf7547(0xfc)]+'\x27...',()=>_0xe64274[_0xf7547(0xa3)]['deleteActivation'](_0x33e7fb,_0x548dba,_0x3d56a6[_0xf7547(0x164)]['id'])),_0x5ae290['onProgress']?.({'type':_0xf7547(0x10c),'segmentName':_0x47cd7e,'activationName':_0x3d56a6[_0xf7547(0xfc)]}),_0x5ae290[_0xf7547(0x178)]?.(_0xf7547(0xb4)+_0x3d56a6['name']+'\x27'),_0x4c96f[_0xf7547(0x15f)]++);}}catch(_0x3d0f3a){const _0x4e1c59=isHttp400Error(_0x3d0f3a),_0x2605f7=_0x4e1c59?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0xf7547(0x17e)],_0x3bc20c=getErrorMessage(_0x3d0f3a);throw new SDKError(_0x2605f7,_0xf7547(0xb9)+_0x3d56a6[_0xf7547(0xbe)]+_0xf7547(0x158)+_0x3d56a6[_0xf7547(0xfc)]+'\x27\x20from\x20file:\x20'+_0x196785+'\x0a\x20\x20'+_0x3bc20c,_0x3d0f3a);}}return _0x4c96f;}export async function executePushFolders(_0x37a9ef,_0x41804c,_0x3f20f6,_0x5ed847,_0x2b9bd4){const _0x5187b1=a136_0x3aef17,_0x26ccac=new Map(_0x3f20f6),_0x5ae514=sortFoldersByDepth(_0x41804c);for(const _0xc22000 of _0x5ae514){const _0x53beea=_0xc22000['split']('/'),_0x2e7ad0=_0x53beea[_0x53beea[_0x5187b1(0x93)]-0x1],_0x2d07a7=_0x53beea['slice'](0x0,-0x1)[_0x5187b1(0x10d)]('/'),_0x398b26=_0x26ccac[_0x5187b1(0xe9)](_0x2d07a7);_0x2b9bd4['onProgress']?.({'type':_0x5187b1(0xe2),'folder':_0xc22000});const _0x1f1375={'name':_0x2e7ad0,'parentFolderId':_0x398b26},_0x1ee934=await _0x2b9bd4[_0x5187b1(0x14a)](_0x5187b1(0x161)+_0xc22000+_0x5187b1(0x195),()=>_0x37a9ef['segment'][_0x5187b1(0x15d)](_0x5ed847[_0x5187b1(0x126)],_0x1f1375));_0x26ccac['set'](_0xc22000,_0x1ee934[_0x5187b1(0x151)]['id']),_0x2b9bd4[_0x5187b1(0x18f)]?.({'type':'folder_created','folder':_0xc22000,'folderId':_0x1ee934[_0x5187b1(0x151)]['id']}),_0x2b9bd4['logInfo']?.('Created\x20folder\x20\x27'+_0xc22000+'\x27');}return _0x26ccac;}export async function executePushSegmentDeletions(_0x21f847,_0x3e04fa,_0x382ec4){const _0x490b6c=a136_0x3aef17;if(_0x3e04fa[_0x490b6c(0x93)]===0x0)return 0x0;const {batchAsync:_0x48aac2}=await import(_0x490b6c(0xf1)),_0x7625a4=0x5,_0x297cdb=await _0x48aac2(_0x3e04fa,async _0x3bd0d2=>{const _0x48f733=_0x490b6c;return _0x382ec4[_0x48f733(0x18f)]?.({'type':_0x48f733(0xc7),'name':_0x3bd0d2[_0x48f733(0xfc)]}),await _0x21f847['segment'][_0x48f733(0x191)](_0x3bd0d2['id']),_0x382ec4[_0x48f733(0x18f)]?.({'type':_0x48f733(0x14e),'name':_0x3bd0d2[_0x48f733(0xfc)]}),_0x382ec4['logDeleted']?.(_0x48f733(0x147)+_0x3bd0d2[_0x48f733(0xfc)]+'\x27'),0x1;},_0x7625a4);return _0x297cdb[_0x490b6c(0x11b)]((_0x4d5bb8,_0x4ca3f8)=>_0x4d5bb8+_0x4ca3f8,0x0);}export async function executePushJourneys(_0x581a02,_0x495535,_0x407c5f,_0x16f38b,_0x207705){const _0x33b8d0=a136_0x3aef17,{journeyDefToRequest:_0x1cb273}=await import(_0x33b8d0(0x104)),{activationDefToCreateRequest:_0x54668e,yamlRuleToApi:_0x2e68df,validateSegmentRule:_0x2e9c0a}=await import(_0x33b8d0(0x145)),_0x186083={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x383aae=new Map(_0x407c5f['segmentNameToId']),_0x429a0e=0x5;for(let _0x438a5f=0x0;_0x438a5f<_0x495535[_0x33b8d0(0x93)];_0x438a5f+=_0x429a0e){const _0x34488c=_0x495535[_0x33b8d0(0xd0)](_0x438a5f,_0x438a5f+_0x429a0e),_0x57611c=await Promise[_0x33b8d0(0x98)](_0x34488c[_0x33b8d0(0x144)](async _0x167b47=>{const _0x274e0b=_0x33b8d0;if(!_0x167b47[_0x274e0b(0x146)]&&!_0x167b47['hasChanges'])return{'action':_0x274e0b(0xe1),'name':_0x167b47[_0x274e0b(0xb7)][_0x274e0b(0xfc)],'journeyId':_0x167b47[_0x274e0b(0x14d)]?.['id']};const _0x33d8cb=_0x167b47[_0x274e0b(0x122)]?_0x407c5f[_0x274e0b(0xd7)]['get'](_0x167b47[_0x274e0b(0x122)]):undefined;_0x207705['onProgress']?.({'type':_0x167b47[_0x274e0b(0x146)]?_0x274e0b(0xc6):_0x274e0b(0xf7),'name':_0x167b47[_0x274e0b(0xb7)][_0x274e0b(0xfc)]});try{const _0x52f1ff=await executeSingleJourneyPush(_0x581a02,_0x167b47,{..._0x407c5f,'segmentNameToId':_0x383aae},{'parentId':_0x16f38b[_0x274e0b(0x126)],'rootFolderId':_0x16f38b[_0x274e0b(0x197)],'folderId':_0x33d8cb,'verbose':_0x16f38b[_0x274e0b(0x14f)]},_0x207705,{'journeyDefToRequest':_0x1cb273,'activationDefToCreateRequest':_0x54668e,'yamlRuleToApi':_0x2e68df,'validateSegmentRule':_0x2e9c0a});for(const [_0x57a1aa,_0x5b97b1]of _0x52f1ff[_0x274e0b(0xd5)]){_0x383aae['set'](_0x57a1aa,_0x5b97b1),_0x186083[_0x274e0b(0xd5)][_0x274e0b(0xc1)](_0x57a1aa,_0x5b97b1);}if(_0x52f1ff[_0x274e0b(0x165)]===_0x274e0b(0x133))_0x207705[_0x274e0b(0x18f)]?.({'type':_0x274e0b(0xb0),'name':_0x167b47['yamlConfig']['name'],'journeyId':_0x52f1ff[_0x274e0b(0xd6)]}),_0x207705[_0x274e0b(0x12d)]?.(_0x274e0b(0x102)+_0x167b47[_0x274e0b(0xb7)]['name']+'\x27'),_0x186083[_0x274e0b(0x133)]++;else _0x52f1ff['action']===_0x274e0b(0xca)&&(_0x207705[_0x274e0b(0x18f)]?.({'type':_0x274e0b(0x179),'name':_0x167b47[_0x274e0b(0xb7)][_0x274e0b(0xfc)]}),_0x207705[_0x274e0b(0x12d)]?.(_0x274e0b(0xbd)+_0x167b47[_0x274e0b(0xb7)][_0x274e0b(0xfc)]+'\x27'),_0x186083[_0x274e0b(0xca)]++);return{'action':_0x52f1ff[_0x274e0b(0x165)],'name':_0x167b47[_0x274e0b(0xb7)]['name'],'journeyId':_0x52f1ff['journeyId']};}catch(_0x2e7051){const _0xe5e043=isHttp400Error(_0x2e7051),_0x4ec547=_0xe5e043?ErrorCode[_0x274e0b(0x13b)]:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x23af95=getErrorMessage(_0x2e7051);throw new SDKError(_0x4ec547,_0x274e0b(0xb9)+(_0x167b47[_0x274e0b(0x146)]?_0x274e0b(0xc2):_0x274e0b(0x137))+_0x274e0b(0x117)+_0x167b47[_0x274e0b(0xf4)]+'\x0a\x20\x20'+_0x23af95,_0x2e7051);}}));_0x186083[_0x33b8d0(0x9d)][_0x33b8d0(0x18e)](..._0x57611c);}return _0x186083;}async function matchExistingJourneySegments(_0x500d69,_0x3a23e3,_0x478fee,_0x44ab42,_0x1f6159){const _0x2674d8=a136_0x3aef17;if(!_0x3a23e3[_0x2674d8(0x14d)]||!_0x3a23e3[_0x2674d8(0xb7)]['segments'])return;const _0x484502=new Map(),_0x204ac9=new Set();for(const _0x4126c8 of Object[_0x2674d8(0x167)](_0x3a23e3[_0x2674d8(0xb7)][_0x2674d8(0x193)])){const _0x34f9e1=generateDeterministicJourneySegmentName(_0x3a23e3[_0x2674d8(0xb7)]['name'],_0x4126c8);_0x484502[_0x2674d8(0xc1)](_0x34f9e1,_0x4126c8),_0x204ac9['add'](_0x4126c8);}const _0x16b81d=[],_0x3bfff8=collectSegmentIdsFromJourneyApi(_0x3a23e3['existingJourney']);for(const _0x443fbd of _0x3bfff8){const _0x1118c4=await fetchSegment(_0x500d69,_0x478fee,_0x443fbd,_0x44ab42);if(!_0x1118c4?.[_0x2674d8(0xfc)])continue;const _0x4a33de=_0x484502['get'](_0x1118c4['name']);_0x4a33de?(_0x1f6159[_0x2674d8(0xc1)](_0x4a33de,_0x443fbd),_0x204ac9[_0x2674d8(0x166)](_0x4a33de)):_0x16b81d[_0x2674d8(0x18e)]({'id':_0x443fbd,'seg':_0x1118c4});}if(_0x204ac9[_0x2674d8(0x130)]>0x0&&_0x16b81d['length']>0x0){const {localExpandedRuleToNames:_0x136076}=buildLocalExpandedRuleMappings(_0x3a23e3[_0x2674d8(0xb7)]),_0x3d982a=new Map();for(const {id:_0x46528c,seg:_0x2cb712}of _0x16b81d){if(_0x2cb712[_0x2674d8(0xf0)]){const _0x218298=apiRuleToYaml(_0x2cb712['rule']);_0x3d982a[_0x2674d8(0xc1)](_0x46528c,_0x218298);}}for(const {id:_0x2816a3,seg:_0x49374e}of _0x16b81d){if(!_0x49374e['rule'])continue;const _0x20ac6c=_0x3d982a[_0x2674d8(0xe9)](_0x2816a3);if(!_0x20ac6c)continue;const _0x17323f=serializeExpandedRule(_0x20ac6c,_0x3d982a),_0x17499e=_0x136076[_0x2674d8(0xe9)](_0x17323f);if(_0x17499e){const _0x2e2d33=_0x17499e['find'](_0x4870b3=>_0x204ac9[_0x2674d8(0x132)](_0x4870b3));_0x2e2d33&&(_0x1f6159[_0x2674d8(0xc1)](_0x2e2d33,_0x2816a3),_0x204ac9[_0x2674d8(0x166)](_0x2e2d33),logger[_0x2674d8(0x101)](_0x2674d8(0x15c)+_0x49374e[_0x2674d8(0xfc)]+_0x2674d8(0xf8)+_0x2e2d33+'\x27\x20by\x20rule\x20content'));}}}}async function executeSingleJourneyPush(_0x37cc08,_0x1f191e,_0x324b05,_0x29f4c3,_0x3e4b26,_0x3e050f){const _0x4bccec=a136_0x3aef17,{journeyDefToRequest:_0x56d866,activationDefToCreateRequest:_0x442255,yamlRuleToApi:_0x30da48,validateSegmentRule:_0x4e16b3}=_0x3e050f,_0x37eb69=new Map(),_0x18f31d=new Map();recoverSegmentIdsFromPushRecovery(_0x1f191e,_0x37eb69,_0x324b05['segmentNameToId']);const _0x5ce731=new Map(),_0x6d7011=new Map(),_0x20dbab=new Map();let _0x2b1730;const _0x4967ea=async()=>{const _0xf0ab15=a136_0x39b7;if(_0x2b1730)return;_0x2b1730=new Map();if(!_0x1f191e[_0xf0ab15(0x14d)])return;const _0x451a02=await _0x37cc08[_0xf0ab15(0xd1)]['listActivations'](_0x1f191e['existingJourney']['id']);for(const _0x3f2c7d of _0x451a02){const _0x5201f7=journeyActivationStepToYaml(_0x3f2c7d,_0x324b05[_0xf0ab15(0xb2)],_0x324b05['connectionIdToNameMap']),_0x497e52=activationSignature(_0x5201f7);!_0x2b1730['has'](_0x497e52)&&_0x2b1730['set'](_0x497e52,_0x3f2c7d['id']),_0x5201f7[_0xf0ab15(0xfc)]&&_0x18f31d['set'](_0x5201f7[_0xf0ab15(0xfc)],_0x3f2c7d['id']);}};await matchExistingJourneySegments(_0x37cc08,_0x1f191e,_0x29f4c3[_0x4bccec(0x126)],_0x324b05[_0x4bccec(0x12b)],_0x324b05[_0x4bccec(0x155)]);const _0x5c588b={'resolveSegmentId':async _0x1eeec4=>{const _0x440c6a=_0x4bccec,_0x54c7ef=_0x324b05[_0x440c6a(0x155)][_0x440c6a(0xe9)](_0x1eeec4);if(!_0x54c7ef)throw new SDKError(ErrorCode[_0x440c6a(0x156)],_0x440c6a(0xba)+_0x1eeec4+_0x440c6a(0x180)+_0x1f191e[_0x440c6a(0xb7)]['name']+')');return _0x54c7ef;},'resolveEmbeddedSegmentId':async(_0x4c683a,_0x220b45)=>{const _0x2331f7=_0x4bccec,_0x5af733=_0x324b05[_0x2331f7(0x155)]['get'](_0x4c683a);if(_0x5af733)return _0x5af733;const _0x54f891=_0x324b05[_0x2331f7(0x12b)][_0x2331f7(0x135)](_0x3ae1e2=>_0x3ae1e2[_0x2331f7(0xfc)]===_0x4c683a);if(_0x54f891)return _0x324b05[_0x2331f7(0x155)]['set'](_0x4c683a,_0x54f891['id']),_0x54f891['id'];if(_0x1f191e[_0x2331f7(0x146)]){const {stageName:_0x4a048e,criteriaName:_0x2540b}=findSegmentCriteriaLocation(_0x1f191e[_0x2331f7(0xb7)],_0x4c683a);return _0x4e16b3(_0x4c683a,_0x220b45[_0x2331f7(0xf0)]),_0x6d7011['set'](_0x4c683a,{'definition':_0x220b45,'stageName':_0x4a048e,'criteriaName':_0x2540b}),createPendingSegmentId(_0x4c683a);}const _0x3b737a=_0x1f191e['existingJourney']?.['id'];if(!_0x3b737a)throw new SDKError(ErrorCode['INTERNAL'],_0x2331f7(0x16e));const _0x545431=_0x5ce731[_0x2331f7(0xe9)](_0x4c683a);if(_0x545431)return _0x545431;const _0x56e113=((async()=>{const _0x253958=_0x2331f7;_0x4e16b3(_0x4c683a,_0x220b45['rule']);const _0x24c0bf=generateDeterministicJourneySegmentName(_0x1f191e[_0x253958(0xb7)][_0x253958(0xfc)],_0x4c683a),_0x2ad4b0=_0x324b05['existingSegments']['find'](_0x36118b=>_0x36118b[_0x253958(0xfc)]===_0x24c0bf),_0x2da448=createSegmentIdResolver(_0x324b05['segmentNameToId'],_0x4c683a),_0x2bc6e7=await resolveRuleSegmentIds(_0x220b45[_0x253958(0xf0)],_0x2da448);let _0x3aad13;return _0x2ad4b0?(await _0x37cc08[_0x253958(0xa3)][_0x253958(0xc5)](_0x29f4c3[_0x253958(0x126)],_0x2ad4b0['id'],{'description':_0x220b45[_0x253958(0x16b)]||_0x253958(0xa0)+_0x4c683a,'rule':_0x30da48(_0x2bc6e7,!![]),'countPopulation':!![]}),_0x3aad13=_0x2ad4b0['id'],saveSegmentToPushRecovery(_0x1f191e[_0x253958(0xf4)],_0x1f191e['yamlConfig'][_0x253958(0xfc)],_0x4c683a,{'segmentId':_0x3aad13,'uniqueServerName':_0x24c0bf,'createdAt':new Date()['toISOString']()})):_0x3aad13=await createOrRecoverEmbeddedSegment(_0x37cc08,_0x1f191e,{'localName':_0x4c683a,'uniqueSegmentName':_0x24c0bf,'description':_0x220b45[_0x253958(0x16b)]||'Entry\x20criteria:\x20'+_0x4c683a,'journeyId':_0x3b737a,'resolvedRule':_0x2bc6e7,'parentId':_0x29f4c3[_0x253958(0x126)],'folderId':_0x29f4c3['rootFolderId']||''},_0x30da48),_0x324b05[_0x253958(0x155)][_0x253958(0xc1)](_0x4c683a,_0x3aad13),_0x37eb69['set'](_0x4c683a,_0x3aad13),_0x3aad13;})());_0x5ce731[_0x2331f7(0xc1)](_0x4c683a,_0x56e113);try{return await _0x56e113;}finally{_0x5ce731[_0x2331f7(0x166)](_0x4c683a);}},'resolveActivationId':async _0x5c04a2=>{const _0x5973dc=_0x4bccec,_0x71942b=_0x18f31d['get'](_0x5c04a2);if(_0x71942b)return _0x71942b;if(_0x1f191e[_0x5973dc(0x14d)]){await _0x4967ea();const _0x560747=_0x18f31d[_0x5973dc(0xe9)](_0x5c04a2);if(_0x560747)return _0x560747;}throw new SDKError(ErrorCode[_0x5973dc(0xd8)],_0x5973dc(0xd2)+_0x5c04a2+_0x5973dc(0x180)+_0x1f191e[_0x5973dc(0xb7)][_0x5973dc(0xfc)]+_0x5973dc(0x16a)+_0x5973dc(0x182));},'resolveEmbeddedActivationId':async(_0x5c2663,_0x33af14)=>{const _0x314b88=_0x4bccec,_0x50b792=_0x18f31d[_0x314b88(0xe9)](_0x5c2663);if(_0x50b792)return _0x50b792;if(_0x1f191e[_0x314b88(0x146)])return _0x20dbab['set'](_0x5c2663,_0x33af14),createPendingActivationId(_0x5c2663);if(_0x1f191e[_0x314b88(0x14d)]){await _0x4967ea();const _0xcf727a=_0x18f31d['get'](_0x33af14['name']);if(_0xcf727a)return _0x18f31d[_0x314b88(0xc1)](_0x5c2663,_0xcf727a),_0xcf727a;const _0x5ac48f=activationSignature(_0x33af14),_0x425294=_0x2b1730?.[_0x314b88(0xe9)](_0x5ac48f);if(_0x425294)return _0x18f31d[_0x314b88(0xc1)](_0x5c2663,_0x425294),_0x425294;const _0x40c106=await _0x442255(_0x33af14,_0x324b05[_0x314b88(0xa5)]),_0x2d17ae={..._0x40c106,..._0x33af14[_0x314b88(0x121)]!==undefined&&{'runAfterJourneyRefresh':_0x33af14[_0x314b88(0x121)]}},_0x40bd14=await _0x37cc08[_0x314b88(0xd1)][_0x314b88(0xbf)](_0x1f191e[_0x314b88(0x14d)]['id'],_0x2d17ae);return _0x18f31d['set'](_0x5c2663,_0x40bd14['id']),_0x40bd14['id'];}throw new SDKError(ErrorCode[_0x314b88(0xdb)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x4d9a2d=>{const _0x20eb03=_0x4bccec;try{return await _0x37cc08['journey'][_0x20eb03(0xdd)](_0x29f4c3[_0x20eb03(0x126)],_0x4d9a2d);}catch(_0xa4ff84){throw new SDKError(ErrorCode[_0x20eb03(0xd8)],_0x20eb03(0xa7)+_0x4d9a2d+_0x20eb03(0x127)+_0x1f191e[_0x20eb03(0xb7)][_0x20eb03(0xfc)]+'\x27)',_0xa4ff84);}},'resolveStageId':async(_0x5934fe,_0x7b04f9)=>{const _0x192496=_0x4bccec,_0xbc6bda=await _0x37cc08[_0x192496(0xd1)][_0x192496(0x13f)](_0x5934fe),_0x49ba9a=_0xbc6bda['attributes']['journeyStages'][_0x192496(0x135)](_0x5b2ae5=>_0x5b2ae5[_0x192496(0xfc)][_0x192496(0x12a)]()===_0x7b04f9[_0x192496(0x12a)]());if(!_0x49ba9a?.['id'])throw new SDKError(ErrorCode[_0x192496(0xd8)],_0x192496(0xb5)+_0x7b04f9+_0x192496(0xc0)+(_0xbc6bda[_0x192496(0x169)][_0x192496(0x15e)]||_0xbc6bda['attributes'][_0x192496(0xfc)])+'\x27');return _0x49ba9a['id'];}},_0x1f6b6a=await _0x56d866(_0x1f191e[_0x4bccec(0xb7)],_0x29f4c3[_0x4bccec(0x126)],_0x5c588b),_0x28a153=_0x29f4c3[_0x4bccec(0x10b)]||_0x29f4c3[_0x4bccec(0x197)];_0x28a153&&(_0x1f6b6a[_0x4bccec(0x11f)]={'parentFolder':{'data':{'id':_0x28a153,'type':_0x4bccec(0x198)}}});if(_0x1f191e[_0x4bccec(0x146)]){if(_0x6d7011[_0x4bccec(0x130)]>0x0||_0x20dbab[_0x4bccec(0x130)]>0x0)return await executeThreeStepJourneyCreate(_0x37cc08,_0x1f191e,_0x1f6b6a,{'pendingEmbeddedSegments':_0x6d7011,'pendingEmbeddedActivations':_0x20dbab,'embeddedSegmentNameToId':_0x37eb69,'journeyActivationNameToId':_0x18f31d},{..._0x29f4c3,'effectiveFolderId':_0x28a153},_0x324b05,_0x3e4b26,_0x3e050f);else{ensureJourneyDefaults(_0x1f6b6a[_0x4bccec(0x169)]);const _0x348165=await _0x37cc08[_0x4bccec(0xd1)]['create'](_0x1f6b6a);return deletePushRecovery(_0x1f191e[_0x4bccec(0xf4)]),{'action':_0x4bccec(0x133),'journeyId':_0x348165['id'],'embeddedSegmentNameToId':_0x37eb69};}}else{if(_0x1f191e[_0x4bccec(0xda)]&&_0x1f191e[_0x4bccec(0x14d)]){_0x1f6b6a['id']=_0x1f191e['existingJourney']['id'];const _0x2ff8c6=_0x1f6b6a[_0x4bccec(0x169)];_0x1f191e['existingJourney'][_0x4bccec(0x169)]?.[_0x4bccec(0x15e)]&&(_0x2ff8c6[_0x4bccec(0x15e)]=_0x1f191e[_0x4bccec(0x14d)][_0x4bccec(0x169)]['journeyBundleName']);const _0x46604b=_0x1f191e[_0x4bccec(0x14d)]['attributes']?.[_0x4bccec(0xab)];return _0x46604b&&_0x1f6b6a[_0x4bccec(0x169)][_0x4bccec(0xab)]&&injectExistingStageIds(_0x1f6b6a['attributes']['journeyStages'],_0x46604b),ensureJourneyDefaults(_0x2ff8c6),await _0x37cc08['journey']['update'](_0x1f191e[_0x4bccec(0x14d)]['id'],_0x1f6b6a),deletePushRecovery(_0x1f191e[_0x4bccec(0xf4)]),{'action':'updated','journeyId':_0x1f191e[_0x4bccec(0x14d)]['id'],'embeddedSegmentNameToId':_0x37eb69};}}return deletePushRecovery(_0x1f191e[_0x4bccec(0xf4)]),{'action':_0x4bccec(0xe1),'journeyId':_0x1f191e['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x37eb69};}function findSegmentCriteriaLocation(_0x443701,_0x307101){const _0x511ef4=a136_0x3aef17,_0x539799=_0x443701['stages']||_0x443701[_0x511ef4(0x17a)]?.[0x0]?.[_0x511ef4(0x97)]||[];let _0x4ade6b=_0x511ef4(0x103),_0x332062=_0x307101;const _0x56f544=_0x443701[_0x511ef4(0x116)]||_0x443701[_0x511ef4(0x17a)]?.[0x0]?.[_0x511ef4(0x116)];if(_0x56f544?.[_0x511ef4(0xa3)]===_0x307101)return{'stageName':_0x511ef4(0x116),'criteriaName':_0x56f544['name']||_0x307101};_0xdfa760:for(const _0x42a937 of _0x539799){if(_0x42a937[_0x511ef4(0x95)]?.[_0x511ef4(0xa3)]===_0x307101){_0x4ade6b=_0x42a937['name'],_0x332062=_0x42a937[_0x511ef4(0x95)][_0x511ef4(0xfc)]||_0x307101;break;}if(_0x42a937[_0x511ef4(0xa4)])for(const _0x3b0089 of _0x42a937['steps']){if(_0x3b0089[_0x511ef4(0xbe)]===_0x511ef4(0x134)&&_0x3b0089[_0x511ef4(0x16f)]?.[_0x511ef4(0x128)])for(const _0x1480cc of _0x3b0089['with']['branches']){if(_0x1480cc['segment']===_0x307101){_0x4ade6b=_0x42a937[_0x511ef4(0xfc)],_0x332062=_0x1480cc[_0x511ef4(0xfc)]||_0x307101;break _0xdfa760;}}}}return{'stageName':_0x4ade6b,'criteriaName':_0x332062};}async function executeThreeStepJourneyCreate(_0x52a2dd,_0x23444d,_0x1ed42c,_0x27afe8,_0x14ba59,_0x263708,_0x150a51,_0x4183c9){const _0x2ba583=a136_0x3aef17,{activationDefToCreateRequest:_0x5bddc8,yamlRuleToApi:_0x2334e6}=_0x4183c9,{pendingEmbeddedSegments:_0x54c776,pendingEmbeddedActivations:_0x337baa,embeddedSegmentNameToId:_0x882e6d}=_0x27afe8,_0x526760=JSON[_0x2ba583(0xf3)](JSON[_0x2ba583(0x185)](_0x1ed42c));ensureJourneyDefaults(_0x526760[_0x2ba583(0x169)]),stripPendingIds(_0x526760);const _0x2d3508=await _0x52a2dd[_0x2ba583(0xd1)][_0x2ba583(0xc2)](_0x526760),_0x5bd3ec=_0x2d3508['id'],_0x3fab16=new Map();for(const _0x58b89d of _0x2d3508['attributes'][_0x2ba583(0xab)]){_0x3fab16[_0x2ba583(0xc1)](_0x58b89d[_0x2ba583(0xfc)]['toLowerCase'](),_0x58b89d['id']);}recoverSegmentIdsFromPushRecovery(_0x23444d,_0x882e6d,_0x263708[_0x2ba583(0x155)]);for(const [_0x59ab25,{definition:_0x35377d}]of _0x54c776){if(_0x882e6d['has'](_0x59ab25)){_0x150a51['onProgress']?.({'type':_0x2ba583(0x13a),'journeyName':_0x23444d['yamlConfig'][_0x2ba583(0xfc)],'segmentName':_0x59ab25});continue;}const _0x39227d=generateDeterministicJourneySegmentName(_0x23444d[_0x2ba583(0xb7)][_0x2ba583(0xfc)],_0x59ab25);_0x150a51[_0x2ba583(0x18f)]?.({'type':_0x2ba583(0x17c),'journeyName':_0x23444d[_0x2ba583(0xb7)][_0x2ba583(0xfc)],'segmentName':_0x59ab25});const _0x65a3f9=createSegmentIdResolver(_0x263708[_0x2ba583(0x155)],_0x59ab25),_0x314341=await resolveRuleSegmentIds(_0x35377d[_0x2ba583(0xf0)],_0x65a3f9),_0xc14a93=await createOrRecoverEmbeddedSegment(_0x52a2dd,_0x23444d,{'localName':_0x59ab25,'uniqueSegmentName':_0x39227d,'description':_0x35377d[_0x2ba583(0x16b)]||_0x2ba583(0xa0)+_0x59ab25,'journeyId':_0x5bd3ec,'resolvedRule':_0x314341,'parentId':_0x14ba59[_0x2ba583(0x126)],'folderId':_0x14ba59[_0x2ba583(0x188)]||''},_0x2334e6);_0x882e6d[_0x2ba583(0xc1)](_0x59ab25,_0xc14a93),_0x263708['segmentNameToId']['set'](_0x59ab25,_0xc14a93),_0x150a51['onProgress']?.({'type':_0x2ba583(0x13a),'journeyName':_0x23444d[_0x2ba583(0xb7)][_0x2ba583(0xfc)],'segmentName':_0x59ab25});}const _0x26dc9b=new Map();for(const [_0x2d3905,_0x112f51]of _0x337baa){_0x150a51['onProgress']?.({'type':_0x2ba583(0x15a),'journeyName':_0x23444d[_0x2ba583(0xb7)][_0x2ba583(0xfc)],'activationName':_0x2d3905});const _0x21931d=await _0x5bddc8(_0x112f51,_0x263708[_0x2ba583(0xa5)]),_0x3e8707={..._0x21931d,..._0x112f51[_0x2ba583(0x121)]!==undefined&&{'runAfterJourneyRefresh':_0x112f51['run_after_journey_refresh']}},_0x4e11ce=await _0x52a2dd[_0x2ba583(0xd1)][_0x2ba583(0xbf)](_0x5bd3ec,_0x3e8707);_0x26dc9b['set'](_0x2d3905,_0x4e11ce['id']),_0x27afe8['journeyActivationNameToId'][_0x2ba583(0xc1)](_0x2d3905,_0x4e11ce['id']),_0x150a51['onProgress']?.({'type':'embedded_activation_created','journeyName':_0x23444d[_0x2ba583(0xb7)][_0x2ba583(0xfc)],'activationName':_0x2d3905});}const _0x522e36=JSON[_0x2ba583(0xf3)](JSON[_0x2ba583(0x185)](_0x1ed42c));return _0x522e36['id']=_0x5bd3ec,ensureJourneyDefaults(_0x522e36[_0x2ba583(0x169)]),resolvePendingIdsInRequest(_0x522e36,_0x1ed42c,_0x3fab16,_0x882e6d,_0x26dc9b,_0x150a51),await _0x52a2dd[_0x2ba583(0xd1)]['update'](_0x5bd3ec,_0x522e36),deletePushRecovery(_0x23444d[_0x2ba583(0xf4)]),{'action':_0x2ba583(0x133),'journeyId':_0x5bd3ec,'embeddedSegmentNameToId':_0x882e6d};}export function stripWaitStepPendingIds(_0x1e30ce){const _0x27dc66=a136_0x3aef17,_0x295f81=_0x1e30ce['conditionSegmentId']&&isPendingSegmentId(_0x1e30ce[_0x27dc66(0x168)]),_0x531708=_0x1e30ce[_0x27dc66(0xef)]?.[_0x27dc66(0xf2)](_0x4cc585=>_0x4cc585[_0x27dc66(0x12c)]&&isPendingSegmentId(_0x4cc585[_0x27dc66(0x12c)]));(_0x295f81||_0x531708)&&(_0x1e30ce['waitStepType']=_0x27dc66(0x9f),_0x1e30ce[_0x27dc66(0xbc)]=0x1,_0x1e30ce[_0x27dc66(0x109)]=_0x27dc66(0x172),delete _0x1e30ce[_0x27dc66(0x168)],delete _0x1e30ce[_0x27dc66(0x13e)],delete _0x1e30ce[_0x27dc66(0xa9)],delete _0x1e30ce[_0x27dc66(0xef)]);}export function resolveWaitStepPendingIds(_0x2bd6c3,_0x217391,_0x14aca5,_0x35f493){const _0x5bf910=a136_0x3aef17;if(_0x217391[_0x5bf910(0x168)]&&isPendingSegmentId(_0x217391[_0x5bf910(0x168)])){const _0x184dd3=_0x14aca5(_0x217391['conditionSegmentId'],_0x5bf910(0xaa)+_0x35f493+_0x5bf910(0xa2));_0x184dd3&&(_0x2bd6c3[_0x5bf910(0x123)]='Condition',_0x2bd6c3[_0x5bf910(0x168)]=_0x184dd3,delete _0x2bd6c3[_0x5bf910(0xbc)],delete _0x2bd6c3[_0x5bf910(0x109)],_0x217391['conditionTimeoutDuration']!==undefined&&(_0x2bd6c3[_0x5bf910(0x13e)]=_0x217391[_0x5bf910(0x13e)]),_0x217391[_0x5bf910(0xa9)]&&(_0x2bd6c3['conditionTimeoutUnit']=_0x217391[_0x5bf910(0xa9)]));}if(_0x217391['conditions']){const _0xf774af=_0x217391[_0x5bf910(0xef)]['some'](_0x466b7f=>_0x466b7f[_0x5bf910(0x12c)]&&isPendingSegmentId(_0x466b7f[_0x5bf910(0x12c)]));if(_0xf774af){const _0x1f1a71=_0x217391['conditions'][_0x5bf910(0x144)](_0x152672=>{const _0x586847=_0x5bf910;if(_0x152672['segmentId']&&isPendingSegmentId(_0x152672['segmentId'])){const _0x28a21f=_0x14aca5(_0x152672[_0x586847(0x12c)],'stage\x20\x27'+_0x35f493+'\x27\x20wait\x20condition');return{..._0x152672,'segmentId':_0x28a21f||_0x152672['segmentId']};}return{..._0x152672};});_0x2bd6c3['waitStepType']=_0x5bf910(0x175),_0x2bd6c3['conditions']=_0x1f1a71,delete _0x2bd6c3[_0x5bf910(0xbc)],delete _0x2bd6c3[_0x5bf910(0x109)],delete _0x2bd6c3[_0x5bf910(0x168)],delete _0x2bd6c3[_0x5bf910(0x13e)],delete _0x2bd6c3[_0x5bf910(0xa9)];}}}function stripPendingIds(_0x4219b4){const _0x3b33c3=a136_0x3aef17;_0x4219b4[_0x3b33c3(0x169)][_0x3b33c3(0x116)]?.[_0x3b33c3(0x12c)]&&isPendingSegmentId(_0x4219b4[_0x3b33c3(0x169)][_0x3b33c3(0x116)][_0x3b33c3(0x12c)])&&delete _0x4219b4['attributes'][_0x3b33c3(0x116)];for(const _0x5f0e78 of _0x4219b4['attributes'][_0x3b33c3(0xab)]||[]){_0x5f0e78[_0x3b33c3(0x12f)]?.[_0x3b33c3(0x12c)]&&isPendingSegmentId(_0x5f0e78[_0x3b33c3(0x12f)][_0x3b33c3(0x12c)])&&delete _0x5f0e78[_0x3b33c3(0x12f)];_0x5f0e78['milestone']?.[_0x3b33c3(0x12c)]&&isPendingSegmentId(_0x5f0e78[_0x3b33c3(0xb8)][_0x3b33c3(0x12c)])&&delete _0x5f0e78[_0x3b33c3(0xb8)];_0x5f0e78['exitCriterias']&&(_0x5f0e78[_0x3b33c3(0x18c)]=_0x5f0e78[_0x3b33c3(0x18c)][_0x3b33c3(0x10e)](_0x1914a2=>!_0x1914a2[_0x3b33c3(0x12c)]||!isPendingSegmentId(_0x1914a2[_0x3b33c3(0x12c)])));if(_0x5f0e78[_0x3b33c3(0xa4)])for(const _0xfab7ac of Object[_0x3b33c3(0x167)](_0x5f0e78['steps'])){const _0x3c93ae=_0x5f0e78[_0x3b33c3(0xa4)][_0xfab7ac];_0x3c93ae[_0x3b33c3(0xbe)]==='Activation'&&_0x3c93ae[_0x3b33c3(0x114)]&&isPendingActivationId(_0x3c93ae[_0x3b33c3(0x114)])&&(_0x3c93ae[_0x3b33c3(0x114)]='');if(_0x3c93ae[_0x3b33c3(0xbe)]===_0x3b33c3(0xc9)&&_0x3c93ae[_0x3b33c3(0x128)])for(const _0x375aff of _0x3c93ae['branches']){_0x375aff[_0x3b33c3(0x12c)]&&isPendingSegmentId(_0x375aff[_0x3b33c3(0x12c)])&&(_0x375aff[_0x3b33c3(0x12c)]='');}_0x3c93ae[_0x3b33c3(0xbe)]===_0x3b33c3(0x153)&&stripWaitStepPendingIds(_0x3c93ae);}}}function resolvePendingIdsInRequest(_0xfc6742,_0x67dab5,_0x31bfa7,_0x43e74e,_0x36ae09,_0x3fdf02){const _0x5bf514=a136_0x3aef17,_0x924e91=(_0x1629f5,_0x1b5785)=>{const _0x2d336d=a136_0x39b7;if(!isPendingSegmentId(_0x1629f5))return _0x1629f5;const _0x5b5dec=extractPendingSegmentName(_0x1629f5),_0x1cc50c=_0x43e74e[_0x2d336d(0xe9)](_0x5b5dec);return!_0x1cc50c&&_0x3fdf02['logWarning']?.(_0x2d336d(0x163)+_0x5b5dec+_0x2d336d(0xfd)+_0x1b5785),_0x1cc50c;};if(_0xfc6742['attributes'][_0x5bf514(0x116)]?.[_0x5bf514(0x12c)]&&isPendingSegmentId(_0xfc6742[_0x5bf514(0x169)][_0x5bf514(0x116)]['segmentId'])){const _0x237bb6=_0x924e91(_0xfc6742['attributes'][_0x5bf514(0x116)][_0x5bf514(0x12c)],_0x5bf514(0x186));_0x237bb6&&(_0xfc6742['attributes'][_0x5bf514(0x116)][_0x5bf514(0x12c)]=_0x237bb6);}for(const _0x393097 of _0xfc6742[_0x5bf514(0x169)]['journeyStages']||[]){const _0x5cdec4=_0x31bfa7[_0x5bf514(0xe9)](_0x393097[_0x5bf514(0xfc)][_0x5bf514(0x12a)]());_0x5cdec4&&(_0x393097['id']=_0x5cdec4);if(_0x393097['entryCriteria']?.[_0x5bf514(0x12c)]&&isPendingSegmentId(_0x393097[_0x5bf514(0x12f)][_0x5bf514(0x12c)])){const _0x2e8097=_0x924e91(_0x393097['entryCriteria'][_0x5bf514(0x12c)],_0x5bf514(0xaa)+_0x393097['name']+_0x5bf514(0x19a));_0x2e8097&&(_0x393097[_0x5bf514(0x12f)]['segmentId']=_0x2e8097);}if(_0x393097[_0x5bf514(0x18c)])for(const _0x4bd0ec of _0x393097['exitCriterias']){if(_0x4bd0ec[_0x5bf514(0x12c)]&&isPendingSegmentId(_0x4bd0ec[_0x5bf514(0x12c)])){const _0x11f839=_0x924e91(_0x4bd0ec[_0x5bf514(0x12c)],_0x5bf514(0xaa)+_0x393097[_0x5bf514(0xfc)]+_0x5bf514(0x13d));_0x11f839&&(_0x4bd0ec[_0x5bf514(0x12c)]=_0x11f839);}}if(_0x393097[_0x5bf514(0xb8)]?.[_0x5bf514(0x12c)]&&isPendingSegmentId(_0x393097['milestone']['segmentId'])){const _0x3d4d71=_0x924e91(_0x393097['milestone']['segmentId'],'stage\x20\x27'+_0x393097[_0x5bf514(0xfc)]+_0x5bf514(0x14c));_0x3d4d71&&(_0x393097[_0x5bf514(0xb8)][_0x5bf514(0x12c)]=_0x3d4d71);}if(_0x393097[_0x5bf514(0xa4)]){const _0x9dcb3a=_0x544d14=>_0x67dab5[_0x5bf514(0x169)][_0x5bf514(0xab)]?.[_0x5bf514(0x135)](_0x26e589=>_0x26e589[_0x5bf514(0xfc)]['toLowerCase']()===_0x393097['name'][_0x5bf514(0x12a)]())?.[_0x5bf514(0xa4)]?.[_0x544d14];for(const _0x4bb680 of Object[_0x5bf514(0x167)](_0x393097['steps'])){const _0xef151a=_0x393097['steps'][_0x4bb680],_0x3d0ee4=_0x9dcb3a(_0x4bb680);if(_0xef151a[_0x5bf514(0xbe)]==='Activation'&&_0xef151a['journeyActivationStepId']&&(isPendingActivationId(_0xef151a['journeyActivationStepId'])||_0xef151a[_0x5bf514(0x114)]==='')){if(_0x3d0ee4?.['journeyActivationStepId']&&isPendingActivationId(_0x3d0ee4[_0x5bf514(0x114)])){const _0x332c5f=extractPendingActivationName(_0x3d0ee4[_0x5bf514(0x114)]),_0x5c0155=_0x36ae09[_0x5bf514(0xe9)](_0x332c5f);_0x5c0155&&(_0xef151a[_0x5bf514(0x114)]=_0x5c0155);}}if(_0xef151a['type']===_0x5bf514(0xc9)&&_0xef151a['branches']&&_0x3d0ee4?.[_0x5bf514(0x128)])for(let _0x28698a=0x0;_0x28698a<_0xef151a['branches'][_0x5bf514(0x93)];_0x28698a++){const _0x3110ad=_0xef151a[_0x5bf514(0x128)][_0x28698a],_0x223c40=_0x3d0ee4[_0x5bf514(0x128)][_0x28698a];if(_0x223c40?.['segmentId']&&isPendingSegmentId(_0x223c40[_0x5bf514(0x12c)])){const _0x547db7=_0x924e91(_0x223c40[_0x5bf514(0x12c)],_0x5bf514(0xaa)+_0x393097[_0x5bf514(0xfc)]+_0x5bf514(0x196)+(_0x3110ad[_0x5bf514(0xfc)]||_0x28698a)+'\x27');_0x547db7&&(_0x3110ad[_0x5bf514(0x12c)]=_0x547db7);}}_0xef151a['type']===_0x5bf514(0x153)&&_0x3d0ee4?.[_0x5bf514(0xbe)]===_0x5bf514(0x153)&&resolveWaitStepPendingIds(_0xef151a,_0x3d0ee4,_0x924e91,_0x393097[_0x5bf514(0xfc)]);}}}}
@@ -1 +1 @@
1
- function a137_0x3152(_0x262525,_0x4e92d2){_0x262525=_0x262525-0xdd;const _0x57e705=a137_0x57e7();let _0x31527=_0x57e705[_0x262525];return _0x31527;}function a137_0x57e7(){const _0x5cc47d=['1021126eSDnCl','7059176rTqROW','88GwPBTb','has','add','77xNpKOB','3515110IOoQzx','set','name','1049022ZNjryM','parentFolderId','5365557XOvRfS','get','3360507EPbGIU','9098280wfUjBM'];a137_0x57e7=function(){return _0x5cc47d;};return a137_0x57e7();}(function(_0x17c67c,_0x332838){const _0x133d3c=a137_0x3152,_0x10cc7b=_0x17c67c();while(!![]){try{const _0x42f2e0=-parseInt(_0x133d3c(0xe9))/0x1+-parseInt(_0x133d3c(0xe0))/0x2+-parseInt(_0x133d3c(0xe7))/0x3+-parseInt(_0x133d3c(0xea))/0x4+-parseInt(_0x133d3c(0xe8))/0x5+parseInt(_0x133d3c(0xe3))/0x6*(parseInt(_0x133d3c(0xdf))/0x7)+-parseInt(_0x133d3c(0xeb))/0x8*(-parseInt(_0x133d3c(0xe5))/0x9);if(_0x42f2e0===_0x332838)break;else _0x10cc7b['push'](_0x10cc7b['shift']());}catch(_0x495ab3){_0x10cc7b['push'](_0x10cc7b['shift']());}}}(a137_0x57e7,0xf39b2));export function buildFolderIdToPathMap(_0x7f4778){const _0x3fffd4=a137_0x3152,_0x40248d=new Map(),_0x4daf6b=new Map();for(const _0x3f59b2 of _0x7f4778){_0x4daf6b['set'](_0x3f59b2['id'],_0x3f59b2);}const _0x1d20a3=new Set();for(const _0x12e930 of _0x7f4778){!_0x12e930[_0x3fffd4(0xe4)]&&_0x1d20a3['add'](_0x12e930['id']);}function _0xb050cb(_0x1b927b){const _0x2962e8=_0x3fffd4;if(_0x40248d['has'](_0x1b927b['id']))return _0x40248d[_0x2962e8(0xe6)](_0x1b927b['id']);if(_0x1d20a3[_0x2962e8(0xdd)](_0x1b927b['id']))return _0x40248d[_0x2962e8(0xe1)](_0x1b927b['id'],''),'';if(_0x1b927b[_0x2962e8(0xe4)]){const _0x35f2d4=_0x4daf6b['get'](_0x1b927b[_0x2962e8(0xe4)]);if(_0x35f2d4){const _0x1c484b=_0xb050cb(_0x35f2d4),_0x3dd05c=_0x1c484b?_0x1c484b+'/'+_0x1b927b['name']:_0x1b927b['name'];return _0x40248d[_0x2962e8(0xe1)](_0x1b927b['id'],_0x3dd05c),_0x3dd05c;}}const _0xba7943=_0x1b927b[_0x2962e8(0xe2)];return _0x40248d[_0x2962e8(0xe1)](_0x1b927b['id'],_0xba7943),_0xba7943;}for(const _0x33cb8b of _0x7f4778){_0xb050cb(_0x33cb8b);}return _0x40248d;}export function buildFolderPathToIdMap(_0x2732b5){const _0x30337=a137_0x3152,_0x2de105=new Map(),_0x466844=new Map();for(const _0xf080fc of _0x2732b5){_0x466844[_0x30337(0xe1)](_0xf080fc['id'],_0xf080fc);}const _0x30a856=new Set();for(const _0x3ee3af of _0x2732b5){!_0x3ee3af[_0x30337(0xe4)]&&_0x30a856[_0x30337(0xde)](_0x3ee3af['id']);}function _0x2c25ec(_0x4aac61){const _0x3cb7b5=_0x30337;if(_0x30a856['has'](_0x4aac61['id']))return'';if(_0x4aac61[_0x3cb7b5(0xe4)]){const _0x4f63b7=_0x466844[_0x3cb7b5(0xe6)](_0x4aac61[_0x3cb7b5(0xe4)]);if(_0x4f63b7){const _0x3e6883=_0x2c25ec(_0x4f63b7);return _0x3e6883?_0x3e6883+'/'+_0x4aac61[_0x3cb7b5(0xe2)]:_0x4aac61['name'];}}return _0x4aac61[_0x3cb7b5(0xe2)];}for(const _0x47f139 of _0x2732b5){const _0x5de637=_0x2c25ec(_0x47f139);_0x2de105['set'](_0x5de637,_0x47f139['id']);}return _0x2de105;}export function buildFolderMaps(_0x4012bc){const _0x24d4e1=buildFolderIdToPathMap(_0x4012bc),_0x570d2e=new Map();for(const [_0x4704f0,_0xb276da]of _0x24d4e1){_0x570d2e['set'](_0xb276da,_0x4704f0);}return{'idToPath':_0x24d4e1,'pathToId':_0x570d2e};}export function getFolderPath(_0xe01739,_0x3a3d68){const _0xbf8592=a137_0x3152;if(!_0xe01739)return'';return _0x3a3d68[_0xbf8592(0xe6)](_0xe01739)??'';}
1
+ function a137_0x235f(_0xd2bdb6,_0x162aaf){_0xd2bdb6=_0xd2bdb6-0xd7;const _0x425dbb=a137_0x425d();let _0x235f04=_0x425dbb[_0xd2bdb6];return _0x235f04;}function a137_0x425d(){const _0x55f7d7=['180312nbmYPV','12Nncmxc','282255nLXxVn','set','331109wmuXRK','2191662JDNmVO','name','add','get','has','522991vsyBfu','1207220KNxWjZ','32xsmYNi','parentFolderId','944316OuullX'];a137_0x425d=function(){return _0x55f7d7;};return a137_0x425d();}(function(_0x34169c,_0x594f72){const _0x58d92f=a137_0x235f,_0x32ce70=_0x34169c();while(!![]){try{const _0x3f9b77=parseInt(_0x58d92f(0xe3))/0x1+parseInt(_0x58d92f(0xdf))/0x2+parseInt(_0x58d92f(0xe1))/0x3+parseInt(_0x58d92f(0xde))/0x4+parseInt(_0x58d92f(0xdb))/0x5+-parseInt(_0x58d92f(0xe0))/0x6*(-parseInt(_0x58d92f(0xda))/0x7)+parseInt(_0x58d92f(0xdc))/0x8*(-parseInt(_0x58d92f(0xe4))/0x9);if(_0x3f9b77===_0x594f72)break;else _0x32ce70['push'](_0x32ce70['shift']());}catch(_0x26d0d4){_0x32ce70['push'](_0x32ce70['shift']());}}}(a137_0x425d,0x29123));export function buildFolderIdToPathMap(_0x37c8de){const _0xd41608=a137_0x235f,_0x740157=new Map(),_0x54e6cc=new Map();for(const _0x4e12b3 of _0x37c8de){_0x54e6cc['set'](_0x4e12b3['id'],_0x4e12b3);}const _0x5e1fae=new Set();for(const _0x4bfc21 of _0x37c8de){!_0x4bfc21[_0xd41608(0xdd)]&&_0x5e1fae['add'](_0x4bfc21['id']);}function _0x58175c(_0x50fcc9){const _0xa50f76=_0xd41608;if(_0x740157[_0xa50f76(0xd9)](_0x50fcc9['id']))return _0x740157[_0xa50f76(0xd8)](_0x50fcc9['id']);if(_0x5e1fae[_0xa50f76(0xd9)](_0x50fcc9['id']))return _0x740157['set'](_0x50fcc9['id'],''),'';if(_0x50fcc9[_0xa50f76(0xdd)]){const _0x52fe19=_0x54e6cc[_0xa50f76(0xd8)](_0x50fcc9[_0xa50f76(0xdd)]);if(_0x52fe19){const _0x13653d=_0x58175c(_0x52fe19),_0x1855ca=_0x13653d?_0x13653d+'/'+_0x50fcc9['name']:_0x50fcc9[_0xa50f76(0xe5)];return _0x740157[_0xa50f76(0xe2)](_0x50fcc9['id'],_0x1855ca),_0x1855ca;}}const _0x4a8bfd=_0x50fcc9[_0xa50f76(0xe5)];return _0x740157[_0xa50f76(0xe2)](_0x50fcc9['id'],_0x4a8bfd),_0x4a8bfd;}for(const _0x263e83 of _0x37c8de){_0x58175c(_0x263e83);}return _0x740157;}export function buildFolderPathToIdMap(_0x24a2d0){const _0x35d697=a137_0x235f,_0x5e88cb=new Map(),_0x46635e=new Map();for(const _0x52331b of _0x24a2d0){_0x46635e[_0x35d697(0xe2)](_0x52331b['id'],_0x52331b);}const _0x107c16=new Set();for(const _0xca067b of _0x24a2d0){!_0xca067b['parentFolderId']&&_0x107c16[_0x35d697(0xd7)](_0xca067b['id']);}function _0x1a1917(_0xd440e1){const _0x33642f=_0x35d697;if(_0x107c16[_0x33642f(0xd9)](_0xd440e1['id']))return'';if(_0xd440e1[_0x33642f(0xdd)]){const _0x15873d=_0x46635e['get'](_0xd440e1['parentFolderId']);if(_0x15873d){const _0x3d8bcd=_0x1a1917(_0x15873d);return _0x3d8bcd?_0x3d8bcd+'/'+_0xd440e1[_0x33642f(0xe5)]:_0xd440e1['name'];}}return _0xd440e1[_0x33642f(0xe5)];}for(const _0x48b4ba of _0x24a2d0){const _0x58ffa5=_0x1a1917(_0x48b4ba);_0x5e88cb[_0x35d697(0xe2)](_0x58ffa5,_0x48b4ba['id']);}return _0x5e88cb;}export function buildFolderMaps(_0xed5013){const _0x55b809=a137_0x235f,_0x3ceb94=buildFolderIdToPathMap(_0xed5013),_0x150be6=new Map();for(const [_0x546b70,_0x2e2cd6]of _0x3ceb94){_0x150be6[_0x55b809(0xe2)](_0x2e2cd6,_0x546b70);}return{'idToPath':_0x3ceb94,'pathToId':_0x150be6};}export function getFolderPath(_0x3bbd04,_0x36e11a){const _0x3d0e13=a137_0x235f;if(!_0x3bbd04)return'';return _0x36e11a[_0x3d0e13(0xd8)](_0x3bbd04)??'';}
@@ -1 +1 @@
1
- (function(_0x4b8468,_0x1a6b2e){const _0x2699eb=a138_0x5f49,_0x34d05f=_0x4b8468();while(!![]){try{const _0x352675=parseInt(_0x2699eb(0x152))/0x1*(-parseInt(_0x2699eb(0x149))/0x2)+-parseInt(_0x2699eb(0x151))/0x3+parseInt(_0x2699eb(0x14d))/0x4+parseInt(_0x2699eb(0x132))/0x5*(parseInt(_0x2699eb(0x14c))/0x6)+parseInt(_0x2699eb(0x12c))/0x7+parseInt(_0x2699eb(0x148))/0x8*(-parseInt(_0x2699eb(0x14b))/0x9)+-parseInt(_0x2699eb(0x144))/0xa;if(_0x352675===_0x1a6b2e)break;else _0x34d05f['push'](_0x34d05f['shift']());}catch(_0x3f6c8c){_0x34d05f['push'](_0x34d05f['shift']());}}}(a138_0x42ed,0x1875c));import a138_0x10e72b from'path';import{parse as a138_0x5a4e8c}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x2522ec){const _0x1a0f48=a138_0x5f49;if(!_0x2522ec||_0x2522ec[_0x1a0f48(0x131)]()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0x507a40=_0x2522ec[_0x1a0f48(0x131)]();if(_0x507a40==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x2522ec};const _0x56b61d=_0x507a40[_0x1a0f48(0x13c)]('/')?_0x507a40[_0x1a0f48(0x143)](0x1):_0x507a40,_0x377e64=_0x56b61d[_0x1a0f48(0x142)]('/')[_0x1a0f48(0x12e)](_0x55cc2a=>_0x55cc2a!=='');if(_0x377e64['length']===0x0)throw new Error(_0x1a0f48(0x13b));const _0x281968=_0x507a40[_0x1a0f48(0x13c)]('/')||!isRelativePathSegment(_0x377e64[0x0]);for(const _0x4b2da4 of _0x377e64){validatePathSegment(_0x4b2da4);}return{'segments':_0x377e64,'isAbsolute':_0x281968,'raw':_0x2522ec};}function a138_0x5f49(_0x419754,_0x5bee34){_0x419754=_0x419754-0x12a;const _0x42ed81=a138_0x42ed();let _0x5f4966=_0x42ed81[_0x419754];return _0x5f4966;}function isRelativePathSegment(_0x12da78){return _0x12da78==='.'||_0x12da78==='..';}function validatePathSegment(_0x24227d){const _0x593a3e=a138_0x5f49;if(_0x24227d==='')throw new Error('Path\x20segment\x20cannot\x20be\x20empty');if(_0x24227d==='.'||_0x24227d==='..')return;if(/[\x00-\x1F\x7F]/[_0x593a3e(0x157)](_0x24227d))throw new Error('Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20'+_0x24227d);if(_0x24227d!==_0x24227d[_0x593a3e(0x131)]()){}}export function validatePath(_0x24782c){const _0x221932=a138_0x5f49;if(_0x24782c[_0x221932(0x147)][_0x221932(0x14e)]===0x0&&!_0x24782c[_0x221932(0x156)])throw new Error(_0x221932(0x13e));if(_0x24782c[_0x221932(0x156)]){if(_0x24782c['segments'][0x0]==='..')throw new Error(_0x221932(0x12a));let _0x4cc054=0x0;for(const _0x1ea884 of _0x24782c[_0x221932(0x147)]){if(_0x1ea884==='..'){if(_0x4cc054===0x0)throw new Error('Path\x20attempts\x20to\x20navigate\x20above\x20root');_0x4cc054--;}else _0x1ea884!=='.'&&_0x4cc054++;}}}export function joinPaths(_0x27e71f,_0x47c2a1){const _0x3d2154=a138_0x5f49;if(!_0x27e71f||_0x27e71f==='/')return _0x47c2a1;if(!_0x47c2a1||_0x47c2a1==='.')return _0x27e71f;if(_0x47c2a1['startsWith']('/'))return _0x47c2a1;const _0x2b3ada=parsePath(_0x27e71f),_0x37b3b8=parsePath(_0x47c2a1),_0x102150=[..._0x2b3ada['segments']];for(const _0x1897bb of _0x37b3b8[_0x3d2154(0x147)]){if(_0x1897bb==='.')continue;else{if(_0x1897bb==='..'){if(_0x102150[_0x3d2154(0x14e)]===0x0)throw new Error(_0x3d2154(0x153));_0x102150[_0x3d2154(0x138)]();}else _0x102150['push'](_0x1897bb);}}const _0x4a1fe1=_0x102150[_0x3d2154(0x154)]('/');return _0x2b3ada[_0x3d2154(0x14f)]['startsWith']('/')?'/'+_0x4a1fe1:_0x4a1fe1;}export function normalizePath(_0x48ad7d){const _0x57752c=a138_0x5f49,_0x56ccc0=parsePath(_0x48ad7d),_0x6706d=[];for(const _0x130f96 of _0x56ccc0[_0x57752c(0x147)]){if(_0x130f96==='.')continue;else{if(_0x130f96==='..'){if(_0x6706d['length']===0x0){if(_0x56ccc0[_0x57752c(0x156)])throw new Error(_0x57752c(0x153));_0x6706d[_0x57752c(0x133)]('..');}else _0x6706d[_0x6706d['length']-0x1]==='..'?_0x6706d[_0x57752c(0x133)]('..'):_0x6706d[_0x57752c(0x138)]();}else _0x6706d[_0x57752c(0x133)](_0x130f96);}}if(_0x6706d[_0x57752c(0x14e)]===0x0)return _0x56ccc0[_0x57752c(0x156)]?'/':'.';const _0x49d5ec=_0x6706d['join']('/');return _0x56ccc0[_0x57752c(0x14f)]['startsWith']('/')?'/'+_0x49d5ec:_0x49d5ec;}export function getParentPath(_0x1bcbfc){const _0x54d6f9=a138_0x5f49,_0x5e4f63=parsePath(_0x1bcbfc);if(_0x5e4f63[_0x54d6f9(0x147)][_0x54d6f9(0x14e)]<=0x1)return'/';const _0x2569fc=_0x5e4f63[_0x54d6f9(0x147)][_0x54d6f9(0x136)](0x0,-0x1)[_0x54d6f9(0x154)]('/');return _0x5e4f63[_0x54d6f9(0x14f)][_0x54d6f9(0x13c)]('/')?'/'+_0x2569fc:_0x2569fc;}export function getBaseName(_0x200cf1){const _0x5d9186=a138_0x5f49,_0xe9b9e0=parsePath(_0x200cf1);return _0xe9b9e0[_0x5d9186(0x147)][_0xe9b9e0[_0x5d9186(0x147)][_0x5d9186(0x14e)]-0x1]||'';}export function isChildPath(_0x5e8310,_0x4914de){const _0x5eb897=a138_0x5f49,_0x13901d=parsePath(_0x5e8310),_0x44a32c=parsePath(_0x4914de);if(_0x13901d['segments'][_0x5eb897(0x14e)]<=_0x44a32c['segments'][_0x5eb897(0x14e)])return![];for(let _0x458729=0x0;_0x458729<_0x44a32c[_0x5eb897(0x147)][_0x5eb897(0x14e)];_0x458729++){if(_0x13901d[_0x5eb897(0x147)][_0x458729]!==_0x44a32c[_0x5eb897(0x147)][_0x458729])return![];}return!![];}export function splitPath(_0x4d60c5){const _0x2332cc=a138_0x5f49,_0x426021=parsePath(_0x4d60c5);if(_0x426021['segments'][_0x2332cc(0x14e)]===0x0)throw new Error(_0x2332cc(0x141));if(_0x426021[_0x2332cc(0x147)]['length']===0x1)return{'parent':_0x426021[_0x2332cc(0x147)][0x0]};return{'parent':_0x426021[_0x2332cc(0x147)][0x0],'child':_0x426021['segments'][_0x2332cc(0x136)](0x1)[_0x2332cc(0x154)]('/')};}function a138_0x42ed(){const _0x1cbb0c=['raw','type','362187byONNj','1232SXjrBP','Cannot\x20navigate\x20above\x20root','join','.yaml','isAbsolute','test','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','tdx.json','652967blwAHb','parse','filter','endsWith','dirname','trim','960550tndXoI','push','File\x20not\x20found:\x20','segment','slice','journey','pop','No\x20tdx.json\x20found\x20for\x20file:\x20','root','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','startsWith','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','Relative\x20path\x20cannot\x20be\x20empty','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','exists','Cannot\x20split\x20empty\x20path','split','substring','600210yZhITs','name','readFile','segments','276168IEKEnE','92YJfycQ','resolve','27SuozKk','6mkXSua','623128CkSfhl','length'];a138_0x42ed=function(){return _0x1cbb0c;};return a138_0x42ed();}export function isYamlFilePath(_0x523de9){const _0x2cf410=a138_0x5f49;return _0x523de9[_0x2cf410(0x12f)]('.yml')||_0x523de9[_0x2cf410(0x12f)](_0x2cf410(0x155));}export async function resolveYamlFilePath(_0x23fb5e,_0x8a40d3=nodeFileSystem){const _0x4da409=a138_0x5f49,_0x9226cf=a138_0x10e72b[_0x4da409(0x14a)](_0x23fb5e);if(!await _0x8a40d3[_0x4da409(0x140)](_0x9226cf))throw new Error(_0x4da409(0x134)+_0x23fb5e);let _0x48305f=a138_0x10e72b[_0x4da409(0x130)](_0x9226cf),_0x3659fd=null,_0x2207fa=null;const _0x36f032=a138_0x10e72b[_0x4da409(0x12d)](_0x48305f)[_0x4da409(0x13a)];while(_0x48305f!==_0x36f032){const _0x294bd3=a138_0x10e72b[_0x4da409(0x154)](_0x48305f,_0x4da409(0x12b));if(await _0x8a40d3['exists'](_0x294bd3)){_0x3659fd=_0x294bd3,_0x2207fa=_0x48305f;break;}_0x48305f=a138_0x10e72b[_0x4da409(0x130)](_0x48305f);}if(!_0x3659fd||!_0x2207fa)throw new Error(_0x4da409(0x139)+_0x23fb5e+'\x0a'+_0x4da409(0x13f));const _0x373618=await _0x8a40d3[_0x4da409(0x146)](_0x3659fd),_0x28d6cb=JSON[_0x4da409(0x12d)](_0x373618),_0x16348c=_0x28d6cb['parent_segment'];if(!_0x16348c)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x4fac02=await _0x8a40d3[_0x4da409(0x146)](_0x9226cf),_0x4b8883=a138_0x5a4e8c(_0x4fac02),_0x5d9fa8=_0x4b8883[_0x4da409(0x145)];if(!_0x5d9fa8)throw new Error(_0x4da409(0x13d)+_0x23fb5e);const _0x409ba2=_0x4b8883[_0x4da409(0x150)]===_0x4da409(0x137)?_0x4da409(0x137):_0x4da409(0x135),_0xb5bc81=a138_0x10e72b['relative'](_0x2207fa,_0x9226cf),_0x5ad75a=a138_0x10e72b[_0x4da409(0x130)](_0xb5bc81),_0x1435aa=_0x5ad75a==='.'?'':_0x5ad75a['replace'](/\\/g,'/'),_0x4adadb=_0x1435aa?_0x16348c+'/'+_0x1435aa+'/'+_0x5d9fa8:_0x16348c+'/'+_0x5d9fa8;return{'parentSegment':_0x16348c,'segmentName':_0x5d9fa8,'folderPath':_0x1435aa,'fullPath':_0x4adadb,'resourceType':_0x409ba2,'content':_0x4fac02};}
1
+ (function(_0x216153,_0x3ac2a0){const _0x25e573=a138_0x5c38,_0x3ea021=_0x216153();while(!![]){try{const _0x256c51=-parseInt(_0x25e573(0xa7))/0x1+parseInt(_0x25e573(0xa9))/0x2*(parseInt(_0x25e573(0x9f))/0x3)+parseInt(_0x25e573(0x87))/0x4*(parseInt(_0x25e573(0x88))/0x5)+parseInt(_0x25e573(0x8e))/0x6*(-parseInt(_0x25e573(0xa4))/0x7)+parseInt(_0x25e573(0xad))/0x8+-parseInt(_0x25e573(0x7e))/0x9*(parseInt(_0x25e573(0xa6))/0xa)+parseInt(_0x25e573(0x85))/0xb*(-parseInt(_0x25e573(0x9d))/0xc);if(_0x256c51===_0x3ac2a0)break;else _0x3ea021['push'](_0x3ea021['shift']());}catch(_0x2cd5a7){_0x3ea021['push'](_0x3ea021['shift']());}}}(a138_0x15ce,0x536da));import a138_0x43ca0a from'path';import{parse as a138_0x324d2d}from'yaml';function a138_0x5c38(_0x1338df,_0x2f5015){_0x1338df=_0x1338df-0x7e;const _0x15cec8=a138_0x15ce();let _0x5c38e4=_0x15cec8[_0x1338df];return _0x5c38e4;}import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x5b8f77){const _0x1bfe4a=a138_0x5c38;if(!_0x5b8f77||_0x5b8f77[_0x1bfe4a(0x8d)]()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0x33ddac=_0x5b8f77[_0x1bfe4a(0x8d)]();if(_0x33ddac==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x5b8f77};const _0x4352de=_0x33ddac[_0x1bfe4a(0xa2)]('/')?_0x33ddac[_0x1bfe4a(0xa3)](0x1):_0x33ddac,_0x206b89=_0x4352de[_0x1bfe4a(0x92)]('/')['filter'](_0x107fab=>_0x107fab!=='');if(_0x206b89['length']===0x0)throw new Error(_0x1bfe4a(0x89));const _0x4525a7=_0x33ddac[_0x1bfe4a(0xa2)]('/')||!isRelativePathSegment(_0x206b89[0x0]);for(const _0x413c8b of _0x206b89){validatePathSegment(_0x413c8b);}return{'segments':_0x206b89,'isAbsolute':_0x4525a7,'raw':_0x5b8f77};}function isRelativePathSegment(_0x5aaabf){return _0x5aaabf==='.'||_0x5aaabf==='..';}function validatePathSegment(_0x51751d){const _0x35627c=a138_0x5c38;if(_0x51751d==='')throw new Error('Path\x20segment\x20cannot\x20be\x20empty');if(_0x51751d==='.'||_0x51751d==='..')return;if(/[\x00-\x1F\x7F]/[_0x35627c(0x96)](_0x51751d))throw new Error(_0x35627c(0x83)+_0x51751d);if(_0x51751d!==_0x51751d[_0x35627c(0x8d)]()){}}function a138_0x15ce(){const _0x126304=['isAbsolute','469048FuFvyJ','journey','join','type','5223784kqaAcC','185616CjtMGN','tdx.json','.yaml','root','No\x20tdx.json\x20found\x20for\x20file:\x20','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','Cannot\x20split\x20empty\x20path','764786vSYOmP','Path\x20attempts\x20to\x20navigate\x20above\x20root','4meCpIX','2953350OGXkkn','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','parent_segment','dirname','parse','trim','641790ySLJrQ','push','segment','length','split','relative','readFile','Relative\x20path\x20cannot\x20be\x20empty','test','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','endsWith','File\x20not\x20found:\x20','name','Cannot\x20navigate\x20above\x20root','replace','36szvQts','segments','3WUHGUJ','exists','slice','startsWith','substring','21FWLCtq','raw','160AvYuLd','276988HxIIKS'];a138_0x15ce=function(){return _0x126304;};return a138_0x15ce();}export function validatePath(_0x500579){const _0x1b6793=a138_0x5c38;if(_0x500579[_0x1b6793(0x9e)]['length']===0x0&&!_0x500579[_0x1b6793(0xa8)])throw new Error(_0x1b6793(0x95));if(_0x500579[_0x1b6793(0xa8)]){if(_0x500579[_0x1b6793(0x9e)][0x0]==='..')throw new Error('Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22');let _0x1003c5=0x0;for(const _0x1cd151 of _0x500579[_0x1b6793(0x9e)]){if(_0x1cd151==='..'){if(_0x1003c5===0x0)throw new Error(_0x1b6793(0x86));_0x1003c5--;}else _0x1cd151!=='.'&&_0x1003c5++;}}}export function joinPaths(_0x1015ea,_0x134ea0){const _0x17b3a1=a138_0x5c38;if(!_0x1015ea||_0x1015ea==='/')return _0x134ea0;if(!_0x134ea0||_0x134ea0==='.')return _0x1015ea;if(_0x134ea0['startsWith']('/'))return _0x134ea0;const _0x488585=parsePath(_0x1015ea),_0x336107=parsePath(_0x134ea0),_0x334ed9=[..._0x488585['segments']];for(const _0x36675b of _0x336107[_0x17b3a1(0x9e)]){if(_0x36675b==='.')continue;else{if(_0x36675b==='..'){if(_0x334ed9['length']===0x0)throw new Error(_0x17b3a1(0x9b));_0x334ed9['pop']();}else _0x334ed9[_0x17b3a1(0x8f)](_0x36675b);}}const _0x5ba196=_0x334ed9[_0x17b3a1(0xab)]('/');return _0x488585[_0x17b3a1(0xa5)]['startsWith']('/')?'/'+_0x5ba196:_0x5ba196;}export function normalizePath(_0x596899){const _0xd42d44=a138_0x5c38,_0x2af4ef=parsePath(_0x596899),_0xe5dc39=[];for(const _0xfcd9e2 of _0x2af4ef[_0xd42d44(0x9e)]){if(_0xfcd9e2==='.')continue;else{if(_0xfcd9e2==='..'){if(_0xe5dc39['length']===0x0){if(_0x2af4ef[_0xd42d44(0xa8)])throw new Error(_0xd42d44(0x9b));_0xe5dc39[_0xd42d44(0x8f)]('..');}else _0xe5dc39[_0xe5dc39['length']-0x1]==='..'?_0xe5dc39[_0xd42d44(0x8f)]('..'):_0xe5dc39['pop']();}else _0xe5dc39[_0xd42d44(0x8f)](_0xfcd9e2);}}if(_0xe5dc39[_0xd42d44(0x91)]===0x0)return _0x2af4ef[_0xd42d44(0xa8)]?'/':'.';const _0x537f8d=_0xe5dc39[_0xd42d44(0xab)]('/');return _0x2af4ef[_0xd42d44(0xa5)]['startsWith']('/')?'/'+_0x537f8d:_0x537f8d;}export function getParentPath(_0x5f193d){const _0x570c93=a138_0x5c38,_0x31fde7=parsePath(_0x5f193d);if(_0x31fde7['segments'][_0x570c93(0x91)]<=0x1)return'/';const _0x2486f8=_0x31fde7['segments'][_0x570c93(0xa1)](0x0,-0x1)['join']('/');return _0x31fde7[_0x570c93(0xa5)]['startsWith']('/')?'/'+_0x2486f8:_0x2486f8;}export function getBaseName(_0x1b0a05){const _0x13b728=a138_0x5c38,_0x117f15=parsePath(_0x1b0a05);return _0x117f15['segments'][_0x117f15[_0x13b728(0x9e)][_0x13b728(0x91)]-0x1]||'';}export function isChildPath(_0x1754b4,_0x124fb6){const _0x231aaa=a138_0x5c38,_0x44d61d=parsePath(_0x1754b4),_0x183490=parsePath(_0x124fb6);if(_0x44d61d[_0x231aaa(0x9e)]['length']<=_0x183490[_0x231aaa(0x9e)][_0x231aaa(0x91)])return![];for(let _0x20c569=0x0;_0x20c569<_0x183490['segments'][_0x231aaa(0x91)];_0x20c569++){if(_0x44d61d[_0x231aaa(0x9e)][_0x20c569]!==_0x183490['segments'][_0x20c569])return![];}return!![];}export function splitPath(_0x58f2e8){const _0x31b67a=a138_0x5c38,_0x2ed653=parsePath(_0x58f2e8);if(_0x2ed653[_0x31b67a(0x9e)][_0x31b67a(0x91)]===0x0)throw new Error(_0x31b67a(0x84));if(_0x2ed653[_0x31b67a(0x9e)][_0x31b67a(0x91)]===0x1)return{'parent':_0x2ed653[_0x31b67a(0x9e)][0x0]};return{'parent':_0x2ed653[_0x31b67a(0x9e)][0x0],'child':_0x2ed653['segments']['slice'](0x1)[_0x31b67a(0xab)]('/')};}export function isYamlFilePath(_0x4197c3){const _0x396eb1=a138_0x5c38;return _0x4197c3[_0x396eb1(0x98)]('.yml')||_0x4197c3[_0x396eb1(0x98)](_0x396eb1(0x80));}export async function resolveYamlFilePath(_0x1b80eb,_0x4d5fa5=nodeFileSystem){const _0x42bcc6=a138_0x5c38,_0x341a3e=a138_0x43ca0a['resolve'](_0x1b80eb);if(!await _0x4d5fa5[_0x42bcc6(0xa0)](_0x341a3e))throw new Error(_0x42bcc6(0x99)+_0x1b80eb);let _0x284a17=a138_0x43ca0a[_0x42bcc6(0x8b)](_0x341a3e),_0x44498b=null,_0x3bb483=null;const _0x31527a=a138_0x43ca0a['parse'](_0x284a17)[_0x42bcc6(0x81)];while(_0x284a17!==_0x31527a){const _0xccd242=a138_0x43ca0a[_0x42bcc6(0xab)](_0x284a17,_0x42bcc6(0x7f));if(await _0x4d5fa5[_0x42bcc6(0xa0)](_0xccd242)){_0x44498b=_0xccd242,_0x3bb483=_0x284a17;break;}_0x284a17=a138_0x43ca0a['dirname'](_0x284a17);}if(!_0x44498b||!_0x3bb483)throw new Error(_0x42bcc6(0x82)+_0x1b80eb+'\x0a'+'Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.');const _0x4fcb1f=await _0x4d5fa5['readFile'](_0x44498b),_0x266cf2=JSON[_0x42bcc6(0x8c)](_0x4fcb1f),_0x195ec1=_0x266cf2[_0x42bcc6(0x8a)];if(!_0x195ec1)throw new Error(_0x42bcc6(0x97));const _0x51edce=await _0x4d5fa5[_0x42bcc6(0x94)](_0x341a3e),_0x1b618a=a138_0x324d2d(_0x51edce),_0x2a8285=_0x1b618a[_0x42bcc6(0x9a)];if(!_0x2a8285)throw new Error('Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'+_0x1b80eb);const _0xef1b69=_0x1b618a[_0x42bcc6(0xac)]==='journey'?_0x42bcc6(0xaa):_0x42bcc6(0x90),_0x4197ad=a138_0x43ca0a[_0x42bcc6(0x93)](_0x3bb483,_0x341a3e),_0x48bdf0=a138_0x43ca0a['dirname'](_0x4197ad),_0x2a76fb=_0x48bdf0==='.'?'':_0x48bdf0[_0x42bcc6(0x9c)](/\\/g,'/'),_0x1e63f5=_0x2a76fb?_0x195ec1+'/'+_0x2a76fb+'/'+_0x2a8285:_0x195ec1+'/'+_0x2a8285;return{'parentSegment':_0x195ec1,'segmentName':_0x2a8285,'folderPath':_0x2a76fb,'fullPath':_0x1e63f5,'resourceType':_0xef1b69,'content':_0x51edce};}
@@ -1 +1 @@
1
- (function(_0x33051c,_0x2cefbc){const _0x4c3a97=a139_0x29cf,_0x2b359f=_0x33051c();while(!![]){try{const _0x133444=-parseInt(_0x4c3a97(0x1d2))/0x1+parseInt(_0x4c3a97(0x1d5))/0x2+parseInt(_0x4c3a97(0x1d7))/0x3*(-parseInt(_0x4c3a97(0x1d0))/0x4)+parseInt(_0x4c3a97(0x1ce))/0x5*(-parseInt(_0x4c3a97(0x1da))/0x6)+-parseInt(_0x4c3a97(0x1d4))/0x7+parseInt(_0x4c3a97(0x1d3))/0x8+parseInt(_0x4c3a97(0x1d6))/0x9;if(_0x133444===_0x2cefbc)break;else _0x2b359f['push'](_0x2b359f['shift']());}catch(_0x12c92e){_0x2b359f['push'](_0x2b359f['shift']());}}}(a139_0x1307,0x4116b));function a139_0x1307(){const _0x3be9f7=['.\x20Child\x20name\x20cannot\x20be\x20empty','20jXfFCt','.\x20Parent\x20name\x20cannot\x20be\x20empty','84307QZhGyj','1874528osbGBw','3129959jSvPmH','755746BtNWWk','3577374JNrQzx','55569TkXgKN','Invalid\x20segment\x20reference\x20format:\x20','substring','238026sYAFnQ','indexOf','15BCTMNH'];a139_0x1307=function(){return _0x3be9f7;};return a139_0x1307();}function a139_0x29cf(_0x5efd22,_0x5b9106){_0x5efd22=_0x5efd22-0x1ce;const _0x130799=a139_0x1307();let _0x29cf07=_0x130799[_0x5efd22];return _0x29cf07;}export function parseSegmentRef(_0x998034){const _0xf76e7d=a139_0x29cf,_0x46c84d=_0x998034[_0xf76e7d(0x1db)]('/');if(_0x46c84d===-0x1)return{'parentId':_0x998034};if(_0x46c84d===0x0)throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x998034+_0xf76e7d(0x1d1));const _0x381d0c=_0x998034[_0xf76e7d(0x1d9)](0x0,_0x46c84d),_0x4502ee=_0x998034['substring'](_0x46c84d+0x1);if(_0x4502ee==='')throw new Error(_0xf76e7d(0x1d8)+_0x998034+_0xf76e7d(0x1cf));return{'parentId':_0x381d0c,'childId':_0x4502ee};}
1
+ function a139_0x54ad(){const _0x4f32e6=['indexOf','769836SmlroS','176sdxnPv','261OeHApW','Invalid\x20segment\x20reference\x20format:\x20','.\x20Child\x20name\x20cannot\x20be\x20empty','588bimNds','37928vtFMgk','2292978vPURRK','519002lTVpdN','8DehKmL','substring','4810Rjtrig','573986EnmtZX','734979lZXiqe','5NtMeuQ'];a139_0x54ad=function(){return _0x4f32e6;};return a139_0x54ad();}(function(_0x522686,_0x1d44ef){const _0x4d8bd3=a139_0x219b,_0xdf793b=_0x522686();while(!![]){try{const _0x365c77=parseInt(_0x4d8bd3(0xf0))/0x1+parseInt(_0x4d8bd3(0xec))/0x2+-parseInt(_0x4d8bd3(0xe1))/0x3*(-parseInt(_0x4d8bd3(0xed))/0x4)+parseInt(_0x4d8bd3(0xe2))/0x5*(-parseInt(_0x4d8bd3(0xeb))/0x6)+parseInt(_0x4d8bd3(0xe9))/0x7*(parseInt(_0x4d8bd3(0xea))/0x8)+-parseInt(_0x4d8bd3(0xe6))/0x9*(-parseInt(_0x4d8bd3(0xef))/0xa)+parseInt(_0x4d8bd3(0xe5))/0xb*(-parseInt(_0x4d8bd3(0xe4))/0xc);if(_0x365c77===_0x1d44ef)break;else _0xdf793b['push'](_0xdf793b['shift']());}catch(_0x3d9962){_0xdf793b['push'](_0xdf793b['shift']());}}}(a139_0x54ad,0x4fd8f));function a139_0x219b(_0x2c8540,_0x162889){_0x2c8540=_0x2c8540-0xe1;const _0x54ad4c=a139_0x54ad();let _0x219bef=_0x54ad4c[_0x2c8540];return _0x219bef;}export function parseSegmentRef(_0x1e0e6f){const _0x33970e=a139_0x219b,_0x3a33c6=_0x1e0e6f[_0x33970e(0xe3)]('/');if(_0x3a33c6===-0x1)return{'parentId':_0x1e0e6f};if(_0x3a33c6===0x0)throw new Error(_0x33970e(0xe7)+_0x1e0e6f+'.\x20Parent\x20name\x20cannot\x20be\x20empty');const _0x45809f=_0x1e0e6f[_0x33970e(0xee)](0x0,_0x3a33c6),_0x78efd0=_0x1e0e6f[_0x33970e(0xee)](_0x3a33c6+0x1);if(_0x78efd0==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x1e0e6f+_0x33970e(0xe8));return{'parentId':_0x45809f,'childId':_0x78efd0};}