@treasuredata/tdx 2026.3.9 → 2026.3.11

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 (210) 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/cli.js.map +1 -1
  6. package/dist/commands/activations.js +1 -1
  7. package/dist/commands/agent-command.js +1 -1
  8. package/dist/commands/agent-test-command.js +1 -1
  9. package/dist/commands/api-command.js +1 -1
  10. package/dist/commands/auth-command.js +1 -1
  11. package/dist/commands/auth-login-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/profile-command.js +1 -1
  35. package/dist/commands/profiles-command.js +1 -1
  36. package/dist/commands/query-command.js +1 -1
  37. package/dist/commands/schedule-command.js +1 -1
  38. package/dist/commands/segment-command.js +1 -1
  39. package/dist/commands/segment-create-command.js +1 -1
  40. package/dist/commands/segment-fields-command.js +1 -1
  41. package/dist/commands/segment-pull-command.js +1 -1
  42. package/dist/commands/segment-push-command.js +1 -1
  43. package/dist/commands/segment-update-command.js +1 -1
  44. package/dist/commands/segment-use-command.js +1 -1
  45. package/dist/commands/segment-validate-command.js +1 -1
  46. package/dist/commands/segments.js +1 -1
  47. package/dist/commands/show.js +1 -1
  48. package/dist/commands/status-command.js +1 -1
  49. package/dist/commands/tables.js +1 -1
  50. package/dist/commands/unset-command.js +1 -1
  51. package/dist/commands/upgrade-command.js +1 -1
  52. package/dist/commands/use-command.js +1 -1
  53. package/dist/commands/user-command.js +1 -1
  54. package/dist/commands/workflow-command.d.ts.map +1 -1
  55. package/dist/commands/workflow-command.js +1 -1
  56. package/dist/commands/workflow-command.js.map +1 -1
  57. package/dist/core/auth.js +1 -1
  58. package/dist/core/command-output.js +1 -1
  59. package/dist/core/config.js +1 -1
  60. package/dist/core/connection-cache.js +1 -1
  61. package/dist/core/constants.js +1 -1
  62. package/dist/core/credential-cache.js +1 -1
  63. package/dist/core/global-context.js +1 -1
  64. package/dist/core/keychain.js +1 -1
  65. package/dist/core/oauth-keychain.js +1 -1
  66. package/dist/core/oauth.js +1 -1
  67. package/dist/core/profile.js +1 -1
  68. package/dist/core/project-config.js +1 -1
  69. package/dist/core/session.js +1 -1
  70. package/dist/core/user-cache.js +1 -1
  71. package/dist/core/version.js +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/mcp/server.js +1 -1
  74. package/dist/mcp/tools/index.js +1 -1
  75. package/dist/mcp/tools/tdx-run.js +1 -1
  76. package/dist/mcp/tools/tdx-search.js +1 -1
  77. package/dist/mcp/utils.js +1 -1
  78. package/dist/proxy/claude-usage-tracker.js +1 -1
  79. package/dist/proxy/passthrough-server.js +1 -1
  80. package/dist/proxy/sse-usage-parser.js +1 -1
  81. package/dist/sdk/agent/agent-config.js +1 -1
  82. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  83. package/dist/sdk/agent/agent-yaml.js +1 -1
  84. package/dist/sdk/agent/test/evaluator.js +1 -1
  85. package/dist/sdk/agent/test/executor.js +1 -1
  86. package/dist/sdk/agent/test/index.js +1 -1
  87. package/dist/sdk/agent/test/output.js +1 -1
  88. package/dist/sdk/agent/test/parser.js +1 -1
  89. package/dist/sdk/agent/tool-target-registry.js +1 -1
  90. package/dist/sdk/api.js +1 -1
  91. package/dist/sdk/client/cdp-api-client.js +1 -1
  92. package/dist/sdk/client/delivery-api-client.js +1 -1
  93. package/dist/sdk/client/endpoints.js +1 -1
  94. package/dist/sdk/client/engage-api-client.js +1 -1
  95. package/dist/sdk/client/http-client.js +1 -1
  96. package/dist/sdk/client/llm-api-client.js +1 -1
  97. package/dist/sdk/client/oauth-refresh.js +1 -1
  98. package/dist/sdk/client/rate-limiter.js +1 -1
  99. package/dist/sdk/client/td-api-client.js +1 -1
  100. package/dist/sdk/client/trino-api-client.js +1 -1
  101. package/dist/sdk/client/workflow-client.js +1 -1
  102. package/dist/sdk/connection-validator.js +1 -1
  103. package/dist/sdk/connection.js +1 -1
  104. package/dist/sdk/delivery.js +1 -1
  105. package/dist/sdk/engage/campaign-pull.js +1 -1
  106. package/dist/sdk/engage/campaign-push.js +1 -1
  107. package/dist/sdk/engage/campaign-validator.js +1 -1
  108. package/dist/sdk/engage/campaign-yaml.js +1 -1
  109. package/dist/sdk/engage/template-pull.js +1 -1
  110. package/dist/sdk/engage/template-push.js +1 -1
  111. package/dist/sdk/engage/template-validator.js +1 -1
  112. package/dist/sdk/engage/template-yaml.js +1 -1
  113. package/dist/sdk/engage/types/campaign-def.js +1 -1
  114. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  115. package/dist/sdk/engage/types/template-schema.js +1 -1
  116. package/dist/sdk/engage.js +1 -1
  117. package/dist/sdk/errors.d.ts +2 -0
  118. package/dist/sdk/errors.d.ts.map +1 -1
  119. package/dist/sdk/errors.js +1 -1
  120. package/dist/sdk/errors.js.map +1 -1
  121. package/dist/sdk/index.js +1 -1
  122. package/dist/sdk/io/index.js +1 -1
  123. package/dist/sdk/io/node-filesystem.js +1 -1
  124. package/dist/sdk/job.js +1 -1
  125. package/dist/sdk/journey.js +1 -1
  126. package/dist/sdk/llm/chat-cache.js +1 -1
  127. package/dist/sdk/llm/index.js +1 -1
  128. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  129. package/dist/sdk/llm/model-factors.js +1 -1
  130. package/dist/sdk/personalization.js +1 -1
  131. package/dist/sdk/query/index.js +1 -1
  132. package/dist/sdk/query/sql-parser.js +1 -1
  133. package/dist/sdk/realtime.js +1 -1
  134. package/dist/sdk/schedule.js +1 -1
  135. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  136. package/dist/sdk/segment/fields-display.js +1 -1
  137. package/dist/sdk/segment/file-discovery.js +1 -1
  138. package/dist/sdk/segment/journey-utils.js +1 -1
  139. package/dist/sdk/segment/journey-validator.js +1 -1
  140. package/dist/sdk/segment/journey-yaml.js +1 -1
  141. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  142. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  143. package/dist/sdk/segment/pull-workflow.js +1 -1
  144. package/dist/sdk/segment/push-recovery.js +1 -1
  145. package/dist/sdk/segment/push-workflow.js +1 -1
  146. package/dist/sdk/segment/resolution-context.js +1 -1
  147. package/dist/sdk/segment/segment-path-parser.js +1 -1
  148. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  149. package/dist/sdk/segment/segment-validator.js +1 -1
  150. package/dist/sdk/segment/target-resolution.js +1 -1
  151. package/dist/sdk/segment/tdx-config.js +1 -1
  152. package/dist/sdk/segment/types/activation-schema.js +1 -1
  153. package/dist/sdk/segment/types/journey-def.js +1 -1
  154. package/dist/sdk/segment/types/journey-schema.js +1 -1
  155. package/dist/sdk/segment/types/segment-def.js +1 -1
  156. package/dist/sdk/segment/types/segment-schema.js +1 -1
  157. package/dist/sdk/segment/validate-files.js +1 -1
  158. package/dist/sdk/segment/yaml-validator.js +1 -1
  159. package/dist/sdk/segment.js +1 -1
  160. package/dist/sdk/types/index.js +1 -1
  161. package/dist/sdk/types/progress.js +1 -1
  162. package/dist/sdk/user.js +1 -1
  163. package/dist/sdk/util/format-detector.js +1 -1
  164. package/dist/sdk/util/formatters.js +1 -1
  165. package/dist/sdk/util/index.js +1 -1
  166. package/dist/sdk/util/paginate.js +1 -1
  167. package/dist/sdk/util/tree-formatter.js +1 -1
  168. package/dist/sdk/workflow/archive-validation.js +1 -1
  169. package/dist/sdk/workflow/clone-workflow.js +1 -1
  170. package/dist/sdk/workflow/index.d.ts +12 -0
  171. package/dist/sdk/workflow/index.d.ts.map +1 -1
  172. package/dist/sdk/workflow/index.js +1 -1
  173. package/dist/sdk/workflow/index.js.map +1 -1
  174. package/dist/sdk/workflow/pull-workflow.js +1 -1
  175. package/dist/sdk/workflow/push-workflow.js +1 -1
  176. package/dist/sdk/workflow/tdx-config.js +1 -1
  177. package/dist/sdk/workflow/workflow-utils.js +1 -1
  178. package/dist/test-utils/command-runner.js +1 -1
  179. package/dist/test-utils/factories.js +1 -1
  180. package/dist/test-utils/fixtures.js +1 -1
  181. package/dist/test-utils/http-mock.js +1 -1
  182. package/dist/test-utils/index.js +1 -1
  183. package/dist/utils/async.js +1 -1
  184. package/dist/utils/colors.js +1 -1
  185. package/dist/utils/diff.js +1 -1
  186. package/dist/utils/file-permissions.js +1 -1
  187. package/dist/utils/file-reader.js +1 -1
  188. package/dist/utils/github-releases.js +1 -1
  189. package/dist/utils/global-cache.js +1 -1
  190. package/dist/utils/json-loader.js +1 -1
  191. package/dist/utils/local-cache.js +1 -1
  192. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  193. package/dist/utils/logger/formatters/index.js +1 -1
  194. package/dist/utils/logger/handlers/console-handler.js +1 -1
  195. package/dist/utils/logger/handlers/file-handler.js +1 -1
  196. package/dist/utils/logger/handlers/index.js +1 -1
  197. package/dist/utils/logger/handlers/null-handler.js +1 -1
  198. package/dist/utils/logger/index.js +1 -1
  199. package/dist/utils/logger/logger.js +1 -1
  200. package/dist/utils/logger/types.js +1 -1
  201. package/dist/utils/option-validation.js +1 -1
  202. package/dist/utils/process.js +1 -1
  203. package/dist/utils/prompt.js +1 -1
  204. package/dist/utils/spinner.js +1 -1
  205. package/dist/utils/sse-parser.js +1 -1
  206. package/dist/utils/string-utils.js +1 -1
  207. package/dist/utils/table-ref-parser.js +1 -1
  208. package/dist/utils/tdx-logger.js +1 -1
  209. package/dist/utils/version-check.js +1 -1
  210. package/package.json +1 -1
@@ -1 +1 @@
1
- const a139_0x696151=a139_0xa0e6;(function(_0x58c28b,_0x4df182){const _0x37a8ee=a139_0xa0e6,_0x2aa1d8=_0x58c28b();while(!![]){try{const _0x1c03f2=-parseInt(_0x37a8ee(0x11e))/0x1*(-parseInt(_0x37a8ee(0x116))/0x2)+-parseInt(_0x37a8ee(0x117))/0x3*(parseInt(_0x37a8ee(0x113))/0x4)+-parseInt(_0x37a8ee(0x10a))/0x5*(-parseInt(_0x37a8ee(0x114))/0x6)+-parseInt(_0x37a8ee(0x106))/0x7+-parseInt(_0x37a8ee(0x11c))/0x8*(-parseInt(_0x37a8ee(0x112))/0x9)+parseInt(_0x37a8ee(0x107))/0xa+parseInt(_0x37a8ee(0x10c))/0xb;if(_0x1c03f2===_0x4df182)break;else _0x2aa1d8['push'](_0x2aa1d8['shift']());}catch(_0x945e65){_0x2aa1d8['push'](_0x2aa1d8['shift']());}}}(a139_0x27e8,0xe0b3d));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';function a139_0xa0e6(_0x1d7c11,_0xb981f0){_0x1d7c11=_0x1d7c11-0x106;const _0x27e8e9=a139_0x27e8();let _0xa0e60e=_0x27e8e9[_0x1d7c11];return _0xa0e60e;}function a139_0x27e8(){const _0x319de9=['debug','2467OFwpde','9102352XljoEA','15592830eZjJyc','utf-8','segments','20sJzNsO','warn','9526891FRgyjm','Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20','Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20','ENOENT','tdx.sdk.push-recovery','code','38889JuBEGy','6491528erGCMs','74604lioXQe','toISOString','598KhqmTd','3UiFrQh','journeyName','version','join','stringify','1168ZdZjfE'];a139_0x27e8=function(){return _0x319de9;};return a139_0x27e8();}import a139_0x49017a from'path';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a139_0x696151(0x110));export function getPushRecoveryPath(_0x37f714){const _0x47c541=a139_0x696151,_0x379dfd=a139_0x49017a['dirname'](_0x37f714),_0x5e3785=a139_0x49017a['basename'](_0x37f714);return a139_0x49017a[_0x47c541(0x11a)](_0x379dfd,'.'+_0x5e3785+'.push-recovery.json');}export function readPushRecovery(_0x433cae){const _0x2f213e=a139_0x696151,_0x325fc6=getPushRecoveryPath(_0x433cae);if(!existsSync(_0x325fc6))return undefined;try{const _0x151190=readFileSync(_0x325fc6,_0x2f213e(0x108)),_0x59f8cc=JSON['parse'](_0x151190);if(_0x59f8cc?.[_0x2f213e(0x119)]!==0x1||typeof _0x59f8cc[_0x2f213e(0x118)]!=='string')return undefined;return _0x59f8cc;}catch(_0x49497c){return _0x49497c instanceof SyntaxError?logger[_0x2f213e(0x11d)](_0x2f213e(0x10e)+_0x49497c):logger[_0x2f213e(0x10b)]('Failed\x20to\x20read\x20push\x20recovery\x20file:\x20'+_0x49497c),undefined;}}export function writePushRecovery(_0x5b21b3,_0xb4e5db){const _0x1e5c00=a139_0x696151,_0x7a483a=getPushRecoveryPath(_0x5b21b3),_0x3e65fd=_0x7a483a+'.tmp';writeFileSync(_0x3e65fd,JSON[_0x1e5c00(0x11b)](_0xb4e5db,null,0x2)+'\x0a','utf-8'),renameSync(_0x3e65fd,_0x7a483a);}export function deletePushRecovery(_0x4f401b){const _0x2da0fa=a139_0x696151,_0x326e7a=getPushRecoveryPath(_0x4f401b);try{unlinkSync(_0x326e7a);}catch(_0x283172){_0x283172[_0x2da0fa(0x111)]!==_0x2da0fa(0x10f)&&logger['debug'](_0x2da0fa(0x10d)+_0x283172);}}export function saveSegmentToPushRecovery(_0x28ee61,_0x42db5c,_0x5df984,_0x9c4585){const _0x47f950=a139_0x696151,_0x16a561=readPushRecovery(_0x28ee61),_0x416826=_0x16a561?.[_0x47f950(0x118)]===_0x42db5c?{..._0x16a561,'updatedAt':new Date()['toISOString']()}:{'version':0x1,'journeyName':_0x42db5c,'updatedAt':new Date()[_0x47f950(0x115)](),'segments':{}};_0x416826[_0x47f950(0x109)][_0x5df984]=_0x9c4585,writePushRecovery(_0x28ee61,_0x416826);}
1
+ (function(_0x177495,_0x59cc23){const _0x4b554c=a139_0x9189,_0x5aad8a=_0x177495();while(!![]){try{const _0x4ee197=-parseInt(_0x4b554c(0x114))/0x1+parseInt(_0x4b554c(0x106))/0x2*(parseInt(_0x4b554c(0x115))/0x3)+parseInt(_0x4b554c(0x108))/0x4+-parseInt(_0x4b554c(0x118))/0x5*(parseInt(_0x4b554c(0x10d))/0x6)+parseInt(_0x4b554c(0x11a))/0x7*(parseInt(_0x4b554c(0x105))/0x8)+-parseInt(_0x4b554c(0x102))/0x9*(-parseInt(_0x4b554c(0x107))/0xa)+parseInt(_0x4b554c(0x100))/0xb;if(_0x4ee197===_0x59cc23)break;else _0x5aad8a['push'](_0x5aad8a['shift']());}catch(_0x1ba1fa){_0x5aad8a['push'](_0x5aad8a['shift']());}}}(a139_0x14e6,0xe5261));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';function a139_0x9189(_0x3c5872,_0x39800b){_0x3c5872=_0x3c5872-0x100;const _0x14e6ad=a139_0x14e6();let _0x9189b9=_0x14e6ad[_0x3c5872];return _0x9189b9;}import a139_0x5c9241 from'path';import{Logger}from'../../utils/logger/index.js';function a139_0x14e6(){const _0x474678=['join','72YlQKje','string','segments','6046136EjrgIV','642UCbTRN','783070KmMHuy','2812488qrYYKU','version','journeyName','debug','.push-recovery.json','93594MAEDMB','stringify','basename','toISOString','utf-8','warn','ENOENT','1678287rPxuaS','2892RHdnJv','dirname','Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','545mNLljC','parse','7frqoRO','21146202pSKcuJ'];a139_0x14e6=function(){return _0x474678;};return a139_0x14e6();}const logger=Logger['of']('tdx.sdk.push-recovery');export function getPushRecoveryPath(_0x11029f){const _0x2e3d02=a139_0x9189,_0x2ba676=a139_0x5c9241[_0x2e3d02(0x116)](_0x11029f),_0x1ff9be=a139_0x5c9241[_0x2e3d02(0x10f)](_0x11029f);return a139_0x5c9241[_0x2e3d02(0x101)](_0x2ba676,'.'+_0x1ff9be+_0x2e3d02(0x10c));}export function readPushRecovery(_0x360689){const _0x5171d6=a139_0x9189,_0x129977=getPushRecoveryPath(_0x360689);if(!existsSync(_0x129977))return undefined;try{const _0x31c049=readFileSync(_0x129977,_0x5171d6(0x111)),_0x3a67f2=JSON[_0x5171d6(0x119)](_0x31c049);if(_0x3a67f2?.[_0x5171d6(0x109)]!==0x1||typeof _0x3a67f2['journeyName']!==_0x5171d6(0x103))return undefined;return _0x3a67f2;}catch(_0x1b7e6f){return _0x1b7e6f instanceof SyntaxError?logger[_0x5171d6(0x10b)]('Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20'+_0x1b7e6f):logger[_0x5171d6(0x112)](_0x5171d6(0x117)+_0x1b7e6f),undefined;}}export function writePushRecovery(_0x47c2cb,_0x4ef0f9){const _0x3aa10f=a139_0x9189,_0x1cbe44=getPushRecoveryPath(_0x47c2cb),_0x1bdb64=_0x1cbe44+'.tmp';writeFileSync(_0x1bdb64,JSON[_0x3aa10f(0x10e)](_0x4ef0f9,null,0x2)+'\x0a',_0x3aa10f(0x111)),renameSync(_0x1bdb64,_0x1cbe44);}export function deletePushRecovery(_0x248916){const _0x3dd797=a139_0x9189,_0xa6360b=getPushRecoveryPath(_0x248916);try{unlinkSync(_0xa6360b);}catch(_0x4a7940){_0x4a7940['code']!==_0x3dd797(0x113)&&logger['debug']('Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20'+_0x4a7940);}}export function saveSegmentToPushRecovery(_0xfbf368,_0x5cc06c,_0x2af028,_0x2b7102){const _0x7a40cf=a139_0x9189,_0x416099=readPushRecovery(_0xfbf368),_0x30b3a5=_0x416099?.[_0x7a40cf(0x10a)]===_0x5cc06c?{..._0x416099,'updatedAt':new Date()[_0x7a40cf(0x110)]()}:{'version':0x1,'journeyName':_0x5cc06c,'updatedAt':new Date()['toISOString'](),'segments':{}};_0x30b3a5[_0x7a40cf(0x104)][_0x2af028]=_0x2b7102,writePushRecovery(_0xfbf368,_0x30b3a5);}
@@ -1 +1 @@
1
- const a140_0x408869=a140_0x340f;(function(_0x22850a,_0x560072){const _0x59e4dd=a140_0x340f,_0x1a0736=_0x22850a();while(!![]){try{const _0x100e9f=-parseInt(_0x59e4dd(0x1ca))/0x1*(-parseInt(_0x59e4dd(0x1d7))/0x2)+parseInt(_0x59e4dd(0x22b))/0x3*(-parseInt(_0x59e4dd(0x224))/0x4)+-parseInt(_0x59e4dd(0x23a))/0x5*(-parseInt(_0x59e4dd(0x1a8))/0x6)+parseInt(_0x59e4dd(0x284))/0x7+parseInt(_0x59e4dd(0x1c5))/0x8+-parseInt(_0x59e4dd(0x260))/0x9*(-parseInt(_0x59e4dd(0x1ed))/0xa)+-parseInt(_0x59e4dd(0x25d))/0xb*(parseInt(_0x59e4dd(0x220))/0xc);if(_0x100e9f===_0x560072)break;else _0x1a0736['push'](_0x1a0736['shift']());}catch(_0x2271a0){_0x1a0736['push'](_0x1a0736['shift']());}}}(a140_0x54fe,0x6a819));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a140_0x408869(0x216));export const PENDING_SEGMENT_PREFIX=a140_0x408869(0x231);export const PENDING_ACTIVATION_PREFIX=a140_0x408869(0x273);export function createPendingSegmentId(_0x324fc8){return''+PENDING_SEGMENT_PREFIX+_0x324fc8+'__';}export function isPendingSegmentId(_0x5e4b8e){const _0x2eb419=a140_0x408869;return _0x5e4b8e[_0x2eb419(0x1d2)](PENDING_SEGMENT_PREFIX)&&!_0x5e4b8e[_0x2eb419(0x1d2)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x5a9854){const _0x1c67a5=a140_0x408869;return _0x5a9854[_0x1c67a5(0x1bf)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x7b2d47){return''+PENDING_ACTIVATION_PREFIX+_0x7b2d47+'__';}export function isPendingActivationId(_0x2f1ea1){return _0x2f1ea1['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x3c34f4){const _0x5873d0=a140_0x408869;return _0x3c34f4[_0x5873d0(0x1bf)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x46fcdd,_0x3f83a3){const _0x29dd70=a140_0x408869,_0x28a981=_0x46fcdd+'::'+(_0x3f83a3[_0x29dd70(0x195)]()||_0x29dd70(0x22d)),_0x556631=createHash('sha1')[_0x29dd70(0x250)](_0x28a981)[_0x29dd70(0x27b)](_0x29dd70(0x1a5))[_0x29dd70(0x282)](0x0,0xc);return'journey_entry_criteria_'+_0x556631;}export function ensureJourneyDefaults(_0x35a1fd){const _0x4eeaa0=a140_0x408869;!_0x35a1fd[_0x4eeaa0(0x1c0)]&&(_0x35a1fd[_0x4eeaa0(0x1c0)]=''),!_0x35a1fd[_0x4eeaa0(0x27c)]&&(_0x35a1fd['state']=_0x4eeaa0(0x1bc));}export function injectExistingStageIds(_0xafa801,_0x3660f6){const _0x31e8b1=a140_0x408869,_0x895946=new Map(_0x3660f6[_0x31e8b1(0x268)](_0x3a159b=>[_0x3a159b[_0x31e8b1(0x265)],_0x3a159b['id']]));for(const _0x3a4b83 of _0xafa801){if(!_0x3a4b83['id']){const _0x3cbfec=_0x895946[_0x31e8b1(0x1f1)](_0x3a4b83[_0x31e8b1(0x265)]);_0x3cbfec&&(_0x3a4b83['id']=_0x3cbfec);}}}export function resolveTDFolderPath(_0x428110,_0x59af8b,_0x5c726d){const _0xffd8f2=a140_0x408869;if(!_0x59af8b)return _0x428110;if(_0x428110===_0x5c726d||_0x428110[_0xffd8f2(0x1d2)](_0x5c726d+'/'))return _0x428110;return _0x428110?_0x5c726d+'/'+_0x428110:_0x5c726d;}export function addFoldersToCreate(_0x5239d5,_0x19cbd2,_0x8b5380){const _0x44a576=a140_0x408869;if(!_0x5239d5)return;if(_0x19cbd2[_0x44a576(0x1ea)](_0x5239d5))return;const _0x18860a=_0x5239d5['split']('/');let _0x1a8cc6='';for(const _0x2c0565 of _0x18860a){_0x1a8cc6=_0x1a8cc6?_0x1a8cc6+'/'+_0x2c0565:_0x2c0565,!_0x19cbd2['has'](_0x1a8cc6)&&_0x8b5380[_0x44a576(0x199)](_0x1a8cc6);}}export function sortFoldersByDepth(_0x501124){return[..._0x501124]['sort']((_0x5a4a87,_0xbbc2a6)=>{const _0x1ce752=a140_0x340f,_0x593d3a=(_0x5a4a87[_0x1ce752(0x21b)](/\//g)||[])[_0x1ce752(0x280)],_0x53153f=(_0xbbc2a6[_0x1ce752(0x21b)](/\//g)||[])[_0x1ce752(0x280)];return _0x593d3a-_0x53153f;});}import*as a140_0x461fde from'yaml';import{readFileSync}from'fs';function a140_0x340f(_0x171eae,_0x406706){_0x171eae=_0x171eae-0x188;const _0x54fe78=a140_0x54fe();let _0x340ff0=_0x54fe78[_0x171eae];return _0x340ff0;}import a140_0x44127b from'path';import{isJourneyDef,parseYamlString as a140_0x190f74,toYamlString as a140_0x3add77,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(_0x5e6c73){const _0xa967d=a140_0x408869;if(Array[_0xa967d(0x1d1)](_0x5e6c73))return'['+_0x5e6c73['map'](_0x1a66bf=>stableStringify(_0x1a66bf))[_0xa967d(0x1cc)](',')+']';if(_0x5e6c73&&typeof _0x5e6c73==='object'){const _0xd3744a=_0x5e6c73,_0x55da75=Object['keys'](_0xd3744a)['sort'](),_0x2ab27c=_0x55da75[_0xa967d(0x268)](_0xaf9eba=>'\x22'+_0xaf9eba+'\x22:'+stableStringify(_0xd3744a[_0xaf9eba]));return'{'+_0x2ab27c[_0xa967d(0x1cc)](',')+'}';}const _0x19f396=JSON[_0xa967d(0x22c)](_0x5e6c73);return _0x19f396===undefined?'null':_0x19f396;}function activationSignature(_0x4d2131){const _0x395f4c=a140_0x408869,_0x30d7d7={'connection':_0x4d2131[_0x395f4c(0x279)],..._0x4d2131[_0x395f4c(0x1b5)]!==undefined&&{'all_columns':_0x4d2131[_0x395f4c(0x1b5)]},..._0x4d2131['columns']!==undefined&&{'columns':_0x4d2131['columns']},..._0x4d2131['behavior']!==undefined&&{'behavior':_0x4d2131[_0x395f4c(0x1b9)]},..._0x4d2131['schedule']!==undefined&&{'schedule':_0x4d2131[_0x395f4c(0x21c)]},..._0x4d2131[_0x395f4c(0x20c)]!==undefined&&{'notification':_0x4d2131[_0x395f4c(0x20c)]},..._0x4d2131[_0x395f4c(0x1fc)]!==undefined&&{'connector_config':_0x4d2131[_0x395f4c(0x1fc)]},..._0x4d2131[_0x395f4c(0x24f)]!==undefined&&{'activation_template_id':_0x4d2131[_0x395f4c(0x24f)]}};return stableStringify(_0x30d7d7);}async function fetchSegment(_0x125494,_0x4b99ba,_0x59fa5b,_0x50df49){const _0xdb145=a140_0x408869,_0x478f92=_0x50df49?.[_0xdb145(0x270)](_0x1183b4=>_0x1183b4['id']===_0x59fa5b);if(_0x478f92)return _0x478f92;try{return await _0x125494[_0xdb145(0x22d)][_0xdb145(0x1ef)](_0x4b99ba,_0x59fa5b);}catch(_0x20a6ce){logger[_0xdb145(0x1bd)]('getSegment\x20failed\x20for\x20'+_0x59fa5b+_0xdb145(0x239)+_0x20a6ce);try{return await _0x125494[_0xdb145(0x22d)]['getSegmentEntity'](_0x59fa5b);}catch(_0x2d0ec6){return logger['debug'](_0xdb145(0x1ae)+_0x59fa5b+':\x20'+_0x2d0ec6),null;}}}function recoverSegmentIdsFromPushRecovery(_0x12fc54,_0x2dc972,_0x3c7b91){const _0x364346=a140_0x408869,_0x3c27dd=readPushRecovery(_0x12fc54[_0x364346(0x21d)]);if(_0x3c27dd?.[_0x364346(0x20b)]===_0x12fc54[_0x364346(0x18a)]['name'])for(const [_0x3a1682,_0x5c3ec4]of Object['entries'](_0x3c27dd[_0x364346(0x241)])){const _0x43411b=generateDeterministicJourneySegmentName(_0x12fc54[_0x364346(0x18a)][_0x364346(0x265)],_0x3a1682);_0x5c3ec4[_0x364346(0x25e)]===_0x43411b&&(_0x2dc972[_0x364346(0x1f8)](_0x3a1682,_0x5c3ec4['segmentId']),_0x3c7b91[_0x364346(0x1f8)](_0x3a1682,_0x5c3ec4['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0xf06427,_0x53c712,_0x1c1a9b,_0xa5834a){const _0x141bfd=a140_0x408869;let _0x2c413f;try{_0x2c413f=await _0xf06427['segment'][_0x141bfd(0x1a1)]({'name':_0x1c1a9b[_0x141bfd(0x26b)],'description':_0x1c1a9b[_0x141bfd(0x1c0)],'journeyId':_0x1c1a9b['journeyId'],'rule':_0xa5834a(_0x1c1a9b[_0x141bfd(0x275)],!![]),'countPopulation':!![],'parentFolderId':_0x1c1a9b[_0x141bfd(0x258)],'audienceId':_0x1c1a9b[_0x141bfd(0x18e)]});}catch(_0x443abb){const _0x287145=_0x443abb instanceof Error&&_0x443abb[_0x141bfd(0x192)]['includes'](_0x141bfd(0x1d3));if(_0x287145){const _0x79fac7=readPushRecovery(_0x53c712['absolutePath']),_0x42b156=_0x79fac7?.['journeyName']===_0x53c712[_0x141bfd(0x18a)][_0x141bfd(0x265)]?_0x79fac7[_0x141bfd(0x241)][_0x1c1a9b['localName']]:undefined;if(_0x42b156?.[_0x141bfd(0x25e)]===_0x1c1a9b[_0x141bfd(0x26b)])await _0xf06427[_0x141bfd(0x22d)][_0x141bfd(0x1b7)](_0x1c1a9b['parentId'],_0x42b156[_0x141bfd(0x1d4)],{'description':_0x1c1a9b[_0x141bfd(0x1c0)],'rule':_0xa5834a(_0x1c1a9b[_0x141bfd(0x275)],!![]),'countPopulation':!![]}),_0x2c413f=_0x42b156[_0x141bfd(0x1d4)];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],'Embedded\x20segment\x20\x27'+_0x1c1a9b[_0x141bfd(0x194)]+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+(_0x141bfd(0x237)+_0x53c712[_0x141bfd(0x21d)][_0x141bfd(0x1bf)](/([^/]+)$/,_0x141bfd(0x246))+')\x20')+_0x141bfd(0x229),_0x443abb);}else throw _0x443abb;}return saveSegmentToPushRecovery(_0x53c712[_0x141bfd(0x21d)],_0x53c712[_0x141bfd(0x18a)][_0x141bfd(0x265)],_0x1c1a9b['localName'],{'segmentId':_0x2c413f,'uniqueServerName':_0x1c1a9b[_0x141bfd(0x26b)],'createdAt':new Date()[_0x141bfd(0x1ec)]()}),_0x2c413f;}export async function prepareSegmentFiles(_0x2ddc8f,_0x169937,_0x4225b1,_0x4b80ef,_0x1115c6){const _0x382f15=a140_0x408869,{activationDefToCreateRequest:_0x35ca9c}=await import(_0x382f15(0x207)),_0x5b1d17=[],_0x4695cb=new Set();for(const {yamlConfig:_0x463111,folderPath:_0x595b0b,sourcePath:_0xc43a9e}of _0x2ddc8f){const _0x7d7151=resolveTDFolderPath(_0x595b0b,_0x4b80ef,_0x1115c6),_0xc8b524=_0x7d7151+':'+_0x463111['name'],_0x40c8cf=_0x169937[_0x382f15(0x200)][_0x382f15(0x1f1)](_0xc8b524),_0x2dd943=_0x40c8cf?_0x169937['activationsBySegmentId'][_0x382f15(0x1f1)](_0x40c8cf['id'])||[]:[];addFoldersToCreate(_0x7d7151,_0x169937['folderPathToId'],_0x4695cb);const _0x532156=calculateActivationActions(_0x463111[_0x382f15(0x20a)]||[],_0x2dd943,_0x169937[_0x382f15(0x1d8)],_0x169937['connectionIdToNameMap']);for(const _0x39a1ec of _0x532156){(_0x39a1ec[_0x382f15(0x1ce)]===_0x382f15(0x1e9)||_0x39a1ec['type']===_0x382f15(0x250))&&_0x39a1ec[_0x382f15(0x213)]&&(_0x39a1ec[_0x382f15(0x211)]=await _0x35ca9c(_0x39a1ec[_0x382f15(0x213)],_0x4225b1));}const _0xcfd9c0=calculateSegmentDiff(_0x463111,_0x40c8cf,_0x2dd943,_0x169937[_0x382f15(0x1d8)],_0x169937[_0x382f15(0x1e7)]);_0x5b1d17[_0x382f15(0x1aa)]({'relativePath':_0x463111[_0x382f15(0x265)],'absolutePath':_0xc43a9e,'yamlConfig':_0x463111,'folderPath':_0x7d7151,'existingSegment':_0x40c8cf,'existingActivations':_0x2dd943,'isNew':_0xcfd9c0[_0x382f15(0x248)],'hasChanges':_0xcfd9c0[_0x382f15(0x26a)],'diff':_0xcfd9c0['diff'],'activationActions':_0x532156});}return{'segmentFiles':_0x5b1d17,'foldersToCreate':_0x4695cb};}export async function prepareJourneyFiles(_0x2169a5,_0x4caca9,_0x5530e8,_0x24fb2e){const _0x40b92b=a140_0x408869,_0x6a65ca=[],_0x5dfba6=new Set();for(const {yamlConfig:_0x2fee0d,folderPath:_0x4881b9,sourcePath:_0x7dd2aa}of _0x2169a5){const _0x1b9831=resolveTDFolderPath(_0x4881b9,_0x5530e8,_0x24fb2e),_0x145425=_0x1b9831+':'+_0x2fee0d['name'],_0x5e8f81=_0x4caca9['journeyBundlesByFolderAndName'][_0x40b92b(0x1f1)](_0x145425);let _0x17bebc,_0x22857f;if(_0x5e8f81&&_0x5e8f81[_0x40b92b(0x280)]>0x0){const _0x5d3a5d=buildLocalExpandedRuleMappings(_0x2fee0d),{createYamlContext:_0x4228ac,prefetchJourneySegments:_0x40b233}=createPushYamlContextForBundle(_0x4caca9[_0x40b92b(0x20e)],_0x4caca9['parentId'],_0x4caca9[_0x40b92b(0x206)],_0x5d3a5d,_0x4caca9[_0x40b92b(0x1d8)],_0x4caca9[_0x40b92b(0x1e7)],_0x4caca9['activationStepsById'],_0x4caca9[_0x40b92b(0x1d5)]);await _0x40b233(_0x5e8f81[_0x40b92b(0x268)](_0x38eab3=>_0x38eab3['id']));const _0x9cf118=await _0x4caca9[_0x40b92b(0x20e)][_0x40b92b(0x25f)]['getLatestJourneyId'](_0x5e8f81[0x0][_0x40b92b(0x18b)]),_0x435e48=hasMultipleVersions(_0x2fee0d),_0x4074c7=async _0x402841=>{const _0x3dc4c2=_0x40b92b,_0x5fa100=_0x4caca9['journeyById']?.['get'](_0x402841);if(_0x5fa100)return _0x5fa100;return _0x4caca9[_0x3dc4c2(0x204)]({'journeyId':_0x402841,'journeyName':_0x2fee0d[_0x3dc4c2(0x265)],'isMultiVersion':_0x5e8f81[_0x3dc4c2(0x280)]>0x1});};if(_0x435e48&&_0x5e8f81[_0x40b92b(0x280)]>0x1){const _0x1457c8=[];for(const _0x57d5b4 of _0x5e8f81){const _0x81ee13=_0x57d5b4[_0x40b92b(0x1e4)]||0x1;_0x4caca9[_0x40b92b(0x272)]?.['update']('Fetching\x20'+_0x2fee0d[_0x40b92b(0x265)]+'\x20v'+_0x81ee13);const _0x133aaf=await _0x4074c7(_0x57d5b4['id']),_0x84c6e9=_0x4228ac(_0x57d5b4['id']),_0x2436bc=await journeyResponseToDef(_0x133aaf,_0x84c6e9);_0x1457c8[_0x40b92b(0x1aa)]({'item':_0x57d5b4,'yaml':_0x2436bc});}const _0x49013e=buildLocalRuleToNameMappingFromJourney(_0x2fee0d);_0x22857f=buildMergedJourneyDef(_0x1457c8,_0x49013e,_0x9cf118);const _0x40b2e6=Math[_0x40b92b(0x1db)](..._0x1457c8['map'](_0x2134e9=>_0x2134e9[_0x40b92b(0x26d)][_0x40b92b(0x1e4)]||0x0)),_0x123f93=_0x5e8f81['find'](_0x2fd038=>(_0x2fd038['versionNumber']||0x0)===_0x40b2e6);_0x123f93&&(_0x4caca9[_0x40b92b(0x272)]?.[_0x40b92b(0x250)](_0x40b92b(0x23b)+_0x2fee0d[_0x40b92b(0x265)]+'\x20v'+_0x40b2e6),_0x17bebc=await _0x4074c7(_0x123f93['id']));}else{const _0x527beb=_0x5e8f81[_0x5e8f81[_0x40b92b(0x280)]-0x1];_0x4caca9[_0x40b92b(0x272)]?.[_0x40b92b(0x250)](_0x40b92b(0x23b)+_0x2fee0d['name']),_0x17bebc=await _0x4074c7(_0x527beb['id']);const _0x216b66=_0x4228ac(_0x527beb['id']),_0x47c23c=await journeyResponseToDef(_0x17bebc,_0x216b66),_0xb443ed=buildLocalRuleToNameMappingFromJourney(_0x2fee0d);_0x22857f=buildMergedJourneyDef([{'item':_0x527beb,'yaml':_0x47c23c}],_0xb443ed,_0x9cf118);}}addFoldersToCreate(_0x1b9831,_0x4caca9[_0x40b92b(0x1ba)],_0x5dfba6);const _0x553bd8=calculateJourneyDiff(_0x2fee0d,_0x22857f);_0x6a65ca[_0x40b92b(0x1aa)]({'relativePath':_0x2fee0d['name'],'absolutePath':_0x7dd2aa,'yamlConfig':_0x2fee0d,'folderPath':_0x1b9831,'existingJourney':_0x17bebc,'isNew':_0x553bd8[_0x40b92b(0x248)],'hasChanges':_0x553bd8[_0x40b92b(0x26a)],'diff':_0x553bd8[_0x40b92b(0x18c)]});}return{'journeyFiles':_0x6a65ca,'foldersToCreate':_0x5dfba6};}export function calculateActivationActions(_0x5c29fb,_0x1aef03,_0x4554f9,_0x6a0ee1){const _0x3f7a0d=a140_0x408869,_0x4cc7a3=[],_0x2c40da=new Map();for(const _0x4cd2c0 of _0x1aef03){_0x2c40da['set'](_0x4cd2c0['name'],_0x4cd2c0);}const _0x1bb9c3=new Map();for(const _0x300a28 of _0x5c29fb){_0x1bb9c3[_0x3f7a0d(0x1f8)](_0x300a28[_0x3f7a0d(0x265)],_0x300a28);}for(const _0x4776fd of _0x5c29fb){const _0x1c2362=_0x2c40da[_0x3f7a0d(0x1f1)](_0x4776fd[_0x3f7a0d(0x265)]);if(!_0x1c2362)_0x4cc7a3['push']({'type':_0x3f7a0d(0x1e9),'name':_0x4776fd['name'],'yamlActivation':_0x4776fd});else{const _0x16a505=activationResponseToDef(_0x1c2362,_0x4554f9,_0x6a0ee1),_0x2a79e1=a140_0x461fde[_0x3f7a0d(0x22c)](_0x16a505),_0x1fbd6e=a140_0x461fde['stringify'](_0x4776fd);_0x2a79e1!==_0x1fbd6e&&_0x4cc7a3[_0x3f7a0d(0x1aa)]({'type':_0x3f7a0d(0x250),'name':_0x4776fd['name'],'yamlActivation':_0x4776fd,'existingActivation':_0x1c2362});}}for(const _0x1ee8fd of _0x1aef03){!_0x1bb9c3['has'](_0x1ee8fd['name'])&&_0x4cc7a3[_0x3f7a0d(0x1aa)]({'type':_0x3f7a0d(0x1b6),'name':_0x1ee8fd[_0x3f7a0d(0x265)],'existingActivation':_0x1ee8fd});}return _0x4cc7a3;}function calculateYamlDiff(_0x35045a,_0x47f825){if(_0x47f825){const _0x5254f9=generateDiff(_0x47f825,_0x35045a),_0x56af0f=hasChanges(_0x5254f9);return{'isNew':![],'hasChanges':_0x56af0f,'diff':_0x56af0f?formatDiffWithColors(_0x5254f9):undefined};}const _0x53ba7f=generateDiff('',_0x35045a);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x53ba7f)};}export function calculateSegmentDiff(_0x418259,_0x12008d,_0x7c64c6,_0x195c5a,_0x43fedb){const _0x57fd0b=segmentToYamlString(_0x418259),_0xc56ecf=_0x12008d?segmentToYamlString(segmentWithActivationsToYaml(_0x12008d,_0x7c64c6,undefined,_0x195c5a,_0x43fedb)):undefined;return calculateYamlDiff(_0x57fd0b,_0xc56ecf);}export function calculateJourneyDiff(_0x7d83ec,_0x4799c6){const _0x134131=normalizeJourneyDef(_0x7d83ec,_0x7d83ec),_0x452e32=a140_0x3add77(_0x134131),_0x5e8d43=_0x4799c6?a140_0x3add77(normalizeJourneyDef(_0x4799c6,_0x7d83ec)):undefined;return calculateYamlDiff(_0x452e32,_0x5e8d43);}export function findSegmentsToDelete(_0x79ab88,_0x4e5206,_0x3c68d2,_0x233aef,_0x38ad64){const _0x5b3aea=a140_0x408869,_0x5efc92=new Set();for(const {yamlConfig:_0x40ce24,folderPath:_0x3fcb0d}of _0x4e5206){_0x5efc92[_0x5b3aea(0x199)](_0x3fcb0d+':'+_0x40ce24['name']);}return _0x79ab88[_0x5b3aea(0x24c)](_0x431e4b=>{const _0x5c69d7=_0x5b3aea,_0x56e81a=_0x431e4b[_0x5c69d7(0x259)]?_0x3c68d2[_0x5c69d7(0x1f1)](_0x431e4b[_0x5c69d7(0x259)][_0x5c69d7(0x205)]())||'':'',_0x5b58e7=_0x56e81a+':'+_0x431e4b[_0x5c69d7(0x265)];if(_0x5efc92[_0x5c69d7(0x1ea)](_0x5b58e7))return![];if(_0x38ad64)return _0x56e81a===_0x233aef||_0x56e81a[_0x5c69d7(0x1d2)](_0x233aef+'/');return!![];});}export function findJourneysToDelete(_0x1dca75,_0x5d338d,_0x3270b1,_0x217cf1,_0x4883ce){const _0x22ad62=a140_0x408869,_0x2ef3d6=new Set();for(const {yamlConfig:_0x23dcbd,folderPath:_0x288634}of _0x5d338d){_0x2ef3d6[_0x22ad62(0x199)](_0x288634+':'+_0x23dcbd[_0x22ad62(0x265)]);}return _0x1dca75[_0x22ad62(0x24c)](_0x52762e=>{const _0x400469=_0x22ad62,_0x2ca7a7=_0x52762e[_0x400469(0x258)]?_0x3270b1[_0x400469(0x1f1)](_0x52762e['folderId'])||'':'',_0x5af57b=_0x2ca7a7+':'+_0x52762e['journeyBundleName'];if(_0x2ef3d6[_0x400469(0x1ea)](_0x5af57b))return![];if(_0x4883ce)return _0x2ca7a7===_0x217cf1||_0x2ca7a7[_0x400469(0x1d2)](_0x217cf1+'/');return!![];});}export function buildSegmentLookupMap(_0x54909b,_0x1a954c){const _0x3be367=a140_0x408869,_0x83739d=new Map();for(const _0x2bd7c0 of _0x54909b){const _0x5e9772=_0x2bd7c0[_0x3be367(0x259)]?_0x1a954c[_0x3be367(0x1f1)](_0x2bd7c0[_0x3be367(0x259)]['toString']())||'':'',_0x149c65=_0x5e9772+':'+_0x2bd7c0[_0x3be367(0x265)];_0x83739d[_0x3be367(0x1f8)](_0x149c65,_0x2bd7c0);}return _0x83739d;}export function buildSegmentNameToIdMap(_0x43a48a){const _0x535ff1=a140_0x408869,_0x253351=new Map();for(const _0x700df8 of _0x43a48a){_0x253351[_0x535ff1(0x1f8)](_0x700df8[_0x535ff1(0x265)],_0x700df8['id']);}return _0x253351;}export function buildJourneyBundleLookupMap(_0x3dcd6a,_0x211277){const _0x4214b1=a140_0x408869,_0x319bd6=new Map();for(const _0x475de9 of _0x3dcd6a){const _0x2c77ce=_0x475de9[_0x4214b1(0x258)]?_0x211277[_0x4214b1(0x1f1)](_0x475de9[_0x4214b1(0x258)])||'':'',_0x100ed5=_0x2c77ce+':'+_0x475de9[_0x4214b1(0x261)];!_0x319bd6[_0x4214b1(0x1ea)](_0x100ed5)&&_0x319bd6[_0x4214b1(0x1f8)](_0x100ed5,[]),_0x319bd6[_0x4214b1(0x1f1)](_0x100ed5)[_0x4214b1(0x1aa)](_0x475de9);}for(const _0x367c4a of _0x319bd6['values']()){_0x367c4a[_0x4214b1(0x191)]((_0x3d00c5,_0x42cfb3)=>(_0x3d00c5[_0x4214b1(0x1e4)]||0x0)-(_0x42cfb3[_0x4214b1(0x1e4)]||0x0));}return _0x319bd6;}export function collectFoldersToCreate(_0x3c06fa,_0x1966b1){const _0x5e7963=a140_0x408869,_0x3e65e8=new Set();for(const _0x5d5ec4 of _0x3c06fa){if(!_0x5d5ec4)continue;if(_0x1966b1[_0x5e7963(0x1ea)](_0x5d5ec4))continue;const _0x2af7d0=_0x5d5ec4[_0x5e7963(0x1dd)]('/');let _0x2a5a98='';for(const _0x57a2b0 of _0x2af7d0){_0x2a5a98=_0x2a5a98?_0x2a5a98+'/'+_0x57a2b0:_0x57a2b0,!_0x1966b1[_0x5e7963(0x1ea)](_0x2a5a98)&&_0x3e65e8[_0x5e7963(0x199)](_0x2a5a98);}}return _0x3e65e8;}export function parseAndClassifyYamlFiles(_0x54b0d9,_0x8b9f5b,_0x4f5432){const _0x4db2f6=a140_0x408869,_0x44f86e=[],_0x175be3=[];for(const _0x128fb9 of _0x54b0d9){const _0x4432f7=a140_0x44127b[_0x4db2f6(0x1e5)](_0x8b9f5b,a140_0x44127b[_0x4db2f6(0x223)](_0x128fb9)),_0x18edb9=_0x4432f7==='.'?'':_0x4432f7,_0x2b4163=readFileSync(_0x128fb9,'utf-8'),_0xad17f6=a140_0x461fde[_0x4db2f6(0x193)](_0x2b4163);if(isJourneyDef(_0xad17f6)){const _0xdf2c44=a140_0x190f74(_0x2b4163);_0x175be3[_0x4db2f6(0x1aa)]({'yamlConfig':_0xdf2c44,'folderPath':_0x18edb9,'sourcePath':_0x128fb9});}else{if(!_0x4f5432?.['skipSegments']){const _0x315f90=parseSegmentYamlFile(_0x2b4163),_0x20bcab=normalizeChildSegmentYaml(_0x315f90);_0x44f86e[_0x4db2f6(0x1aa)]({'yamlConfig':_0x20bcab,'folderPath':_0x18edb9,'sourcePath':_0x128fb9});}}}return{'segments':_0x44f86e,'journeys':_0x175be3};}export function validateParsedFiles(_0x2b4ecb,_0x16e1aa){const _0x27f35e=a140_0x408869,_0x53d608=[];for(const {yamlConfig:_0x47ddde,sourcePath:_0x2f06a3}of _0x2b4ecb[_0x27f35e(0x241)]){const _0xc36b00=readFileSync(_0x2f06a3,_0x27f35e(0x1fd)),_0x105b44=a140_0x461fde['parseDocument'](_0xc36b00),_0x3e05e5=validateSegmentDef(_0x47ddde,{'source':_0xc36b00,'document':_0x105b44},{'skipSchema':!![]});if(!_0x3e05e5['valid']){const _0x44851a=a140_0x44127b[_0x27f35e(0x1e5)](_0x16e1aa,_0x2f06a3);_0x53d608[_0x27f35e(0x1aa)]({'filePath':_0x44851a,'source':_0xc36b00,'result':_0x3e05e5,'isJourney':![]});}}for(const {yamlConfig:_0x16b271,sourcePath:_0x2bfe37}of _0x2b4ecb[_0x27f35e(0x1f9)]){const _0x4670ae=readFileSync(_0x2bfe37,_0x27f35e(0x1fd)),_0x38d39a=a140_0x461fde['parseDocument'](_0x4670ae),_0x13fc84=validateJourneyDef(_0x16b271,{'source':_0x4670ae,'document':_0x38d39a},{'skipSchema':!![]});if(!_0x13fc84[_0x27f35e(0x1b2)]){const _0x49f057=a140_0x44127b[_0x27f35e(0x1e5)](_0x16e1aa,_0x2bfe37);_0x53d608['push']({'filePath':_0x49f057,'source':_0x4670ae,'result':_0x13fc84,'isJourney':!![]});}}return _0x53d608;}export function formatValidationErrors(_0x21ca1e){const _0xd92b1b=a140_0x408869,_0x142b69=[];for(const {filePath:_0x483395,source:_0x462df8,result:_0x36ce96,isJourney:_0x2b945a}of _0x21ca1e){const _0x4a4d17=_0x2b945a?_0xd92b1b(0x25f):_0xd92b1b(0x22d);_0x142b69[_0xd92b1b(0x1aa)]('\x0a'+_0x483395+'\x20('+_0x4a4d17+_0xd92b1b(0x203)+_0x36ce96[_0xd92b1b(0x1a6)]['length']+_0xd92b1b(0x25b)),_0x142b69[_0xd92b1b(0x1aa)](formatValidationResult(_0x36ce96,_0x462df8,_0x483395));}return _0x142b69[_0xd92b1b(0x1cc)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x370202){const _0x385f8a=a140_0x408869,_0x597ff7=new Set(),_0x429f2c=new Map(),_0x872cd6=collectSegmentUsageCounts(_0x370202);if(_0x370202['segments'])for(const [_0x59a085,_0x1b0c01]of Object[_0x385f8a(0x18f)](_0x370202[_0x385f8a(0x241)])){_0x597ff7[_0x385f8a(0x199)](_0x59a085);if(_0x1b0c01[_0x385f8a(0x219)]){const _0x3dec84=yamlRuleToApi(_0x1b0c01[_0x385f8a(0x219)]),_0x47ebd8=apiRuleToYaml(_0x3dec84);_0x429f2c[_0x385f8a(0x1f8)](_0x59a085,_0x47ebd8);}}const _0x15280e=new Map();let _0x5818bb=0x0;for(const [_0x10be46,_0x5b8537]of _0x429f2c){const _0x5ced2b=serializeExpandedRule(_0x5b8537,_0x429f2c),_0x24bbee=_0x15280e[_0x385f8a(0x1f1)](_0x5ced2b)||[];_0x24bbee[_0x385f8a(0x1aa)]({'name':_0x10be46,'index':_0x5818bb}),_0x15280e[_0x385f8a(0x1f8)](_0x5ced2b,_0x24bbee),_0x5818bb++;}const _0x3676c5=new Map();for(const [_0x3fb60f,_0x12f6bb]of _0x15280e){const _0xc041d6=_0x12f6bb[_0x385f8a(0x282)]()[_0x385f8a(0x191)]((_0x13cb74,_0x255ccf)=>{const _0x3f25f7=_0x385f8a,_0x732471=_0x872cd6[_0x3f25f7(0x1f1)](_0x13cb74['name'])||0x0,_0x4a0d38=_0x872cd6[_0x3f25f7(0x1f1)](_0x255ccf[_0x3f25f7(0x265)])||0x0;if(_0x732471!==_0x4a0d38)return _0x4a0d38-_0x732471;return _0x13cb74['index']-_0x255ccf[_0x3f25f7(0x202)];})['map'](_0x28b0ba=>_0x28b0ba[_0x385f8a(0x265)]),_0xa95e19=[];for(const _0x938472 of _0xc041d6){const _0x1b6836=_0x872cd6[_0x385f8a(0x1f1)](_0x938472)||0x0,_0x1225aa=Math[_0x385f8a(0x1db)](_0x1b6836,0x1);for(let _0x13466e=0x0;_0x13466e<_0x1225aa;_0x13466e++){_0xa95e19['push'](_0x938472);}}_0x3676c5[_0x385f8a(0x1f8)](_0x3fb60f,_0xa95e19);}return{'existingLocalSegmentNames':_0x597ff7,'localSegmentRules':_0x429f2c,'localExpandedRuleToNames':_0x3676c5};}export function createSegmentIdResolver(_0xc1b9fa,_0x261ebb){return async _0x2d2dca=>{const _0x431e95=a140_0x340f,_0x162e85=_0xc1b9fa[_0x431e95(0x1f1)](_0x2d2dca);if(!_0x162e85)throw new SDKError(ErrorCode[_0x431e95(0x214)],_0x431e95(0x27e)+_0x2d2dca+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x261ebb+'\x27)');return _0x162e85;};}function a140_0x54fe(){const _0x160728=['embedded_segment_created','find','activation_deleting','progress','__pending_act_','Activation\x20not\x20found:\x20','resolvedRule','Failed\x20to\x20fetch\x20referenced\x20segment\x20','nameToType','./journey-yaml.js','connection','createdSegmentId','digest','state','waitStep','Segment\x20not\x20found:\x20','journey_updating','length','activationParams','slice','listActivations','124194iMOnfQ','\x27\x20exit\x20criteria','action','keys','activation_updating','waitStepType','stages','yamlConfig','journeyBundleId','diff','JOURNEY_UPDATE_ERROR','parentId','entries','activationContext','sort','message','parse','localName','trim','journey_created','Stage\x20\x27','Entry\x20criteria:\x20','add','\x27\x20for\x20','embeddedSegmentNameToId','JOURNEY_SYNTAX_ERROR','SEGMENT_SYNTAX_ERROR','ACTIVATION_UPDATE_ERROR','kind','from','createJourneySegment','rootFolderId','flatMap','conditionSegmentId','hex','errors','verbose','1498440PMMyyT','logSuccess','push','segment_updated','size','Deleted\x20activation\x20\x27','getSegmentEntity\x20also\x20failed\x20for\x20','logInfo','Activation','folderPath','valid','effectiveFolderId','activation_','all_columns','delete','updateSegmentById','Creating\x20folder\x20\x27','behavior','folderPathToId','embedded_activation_created','draft','debug','attributes','replace','description','journeyActivationNameToId','decision_point','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','entry_criteria','2354648mCXpJJ','folder_creating','\x27\x20from\x20file:\x20','INTERNAL','goal','104987CeYqQy','user','join','\x0a\x20\x20','type','activation_deleted','Updated\x20activation\x20\x27','isArray','startsWith','Name\x20has\x20already\x20been\x20taken','segmentId','journeyById','journey_updated','14EJunFb','idToEmailMap','parentSegmentFolder','../../utils/async.js','max','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','split','\x20journey\x20from\x20file:\x20','createActivation','journeyId','goal\x20criteria','conditions','Created\x20folder\x20\x27','versionNumber','relative','parentFolder','connectionIdToNameMap','Updated\x20segment\x20\x27','create','has','onProgress','toISOString','130VnTTnN','deleted','getSegment','embedded_activation_creating','get','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','conditionTimeoutUnit','Created\x20activation\x20\x27','embedded_segment_creating','WaitStep','Failed\x20to\x20resolve\x20activation\x20','set','journeys','segment_deleting','Failed\x20to\x20','connector_config','utf-8','run_after_journey_refresh','with','segmentByFolderAndName','logWarning','index','):\x20','fetchJourney','toString','existingSegments','./child-segment-yaml.js','activation_creating','\x27\x20to\x20local\x20\x27','activations','journeyName','notification','journeyActivationStepId','deps','waitStepUnit','buildUserMaps','validatedRequest','createdSegmentIds','yamlActivation','SEGMENT_NOT_FOUND','NOT_FOUND','tdx.sdk.push-workflow','results','toLowerCase','rule','Duration','match','schedule','absolutePath','existingActivation','\x20segment\x20from\x20file:\x20','1329888QbhJuk','Deleting\x20activation\x20\x27','existingJourney','dirname','1559724CuWbhJ','segment_created','segment_updating','data','Condition','and\x20the\x20server\x20segment,\x20then\x20retry.','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','3Nfaxaa','stringify','segment','steps','entry','reduce','__pending_','\x27...','activationActions','updated','Deleted\x20segment\x20\x27','entryCriteria','Delete\x20the\x20push\x20recovery\x20file\x20(','segmentNameToId',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','10wpcYqA','Fetching\x20','idToName','list','ACTIVATION_SYNTAX_ERROR','journeyStages','\x27\x20by\x20rule\x20content','segments','getJourney','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','DecisionPoint','relationships','.$1.push-recovery.json','all','isNew','Matched\x20server\x20segment\x20\x27','logDeleted','unchanged','filter','Journey\x20\x27',').\x20','activation_template_id','update','conditionTimeoutDuration','stage\x20\x27','existingSegment','created','getActivation','\x20(referenced\x20in\x20journey\x20','resolveJourneyId','folderId','segmentFolderId','Updating\x20activation\x20\x27','\x20error(s)','some','99QKACnd','uniqueServerName','journey','191862KhbwGT','journeyBundleName','branches','Creating\x20segment\x20\x27','exitCriterias','name','withProgress','deleteSegment','map','createSegment','hasChanges','uniqueSegmentName','milestone','item','SEGMENT_UPDATE_ERROR'];a140_0x54fe=function(){return _0x160728;};return a140_0x54fe();}export function extractRootFolderId(_0x4f22e3){const _0x47a9c5=a140_0x408869;return _0x4f22e3[_0x47a9c5(0x245)]?.[_0x47a9c5(0x1d9)]?.['data']?.['id']||_0x4f22e3[_0x47a9c5(0x245)]?.[_0x47a9c5(0x1e6)]?.[_0x47a9c5(0x227)]?.['id'];}export function buildConnectionMaps(_0x5bd74d){const _0x5c9903=a140_0x408869,_0x553d89=new Map(),_0x67023d=new Map(),_0x3ec7a3=new Map();for(const _0x59ba8e of _0x5bd74d){_0x553d89['set'](_0x59ba8e[_0x5c9903(0x265)],parseInt(_0x59ba8e['id'],0xa)),_0x67023d[_0x5c9903(0x1f8)](_0x59ba8e['id'],_0x59ba8e['name']),_0x3ec7a3[_0x5c9903(0x1f8)](_0x59ba8e[_0x5c9903(0x265)],_0x59ba8e[_0x5c9903(0x1ce)]);}return{'nameToId':_0x553d89,'idToName':_0x67023d,'nameToType':_0x3ec7a3};}export function calculatePushStats(_0x4a23a6,_0x122cb1,_0x45df88,_0x2e8de1,_0x19707d,_0x5b9420,_0x3d9843){const _0x133d99=a140_0x408869,_0x4b12c0=_0x4a23a6[_0x133d99(0x24c)](_0x36370c=>_0x36370c[_0x133d99(0x248)]),_0x236323=_0x4a23a6[_0x133d99(0x24c)](_0x7d55b3=>!_0x7d55b3[_0x133d99(0x248)]&&_0x7d55b3['hasChanges']),_0x440a0a=_0x4a23a6[_0x133d99(0x24c)](_0xaf2fbc=>!_0xaf2fbc[_0x133d99(0x248)]&&!_0xaf2fbc['hasChanges']),_0x23c715=_0x5b9420?_0x2e8de1:[],_0x48c00b=_0x122cb1[_0x133d99(0x24c)](_0x3fcd43=>_0x3fcd43['isNew']),_0xbcd41a=_0x122cb1[_0x133d99(0x24c)](_0x33846d=>!_0x33846d[_0x133d99(0x248)]&&_0x33846d[_0x133d99(0x26a)]),_0x38599=_0x122cb1['filter'](_0x337ed5=>!_0x337ed5[_0x133d99(0x248)]&&!_0x337ed5[_0x133d99(0x26a)]),_0x2bce97=_0x5b9420?_0x19707d:[],_0x3232ad=_0x4a23a6[_0x133d99(0x1a3)](_0x21956b=>_0x21956b[_0x133d99(0x233)]),_0x35dab7=_0x3232ad[_0x133d99(0x24c)](_0x2de1ea=>_0x2de1ea[_0x133d99(0x1ce)]===_0x133d99(0x1e9)),_0x4603d7=_0x3232ad[_0x133d99(0x24c)](_0x428486=>_0x428486[_0x133d99(0x1ce)]==='update'),_0x48e700=_0x3232ad[_0x133d99(0x24c)](_0x5ec09c=>_0x5ec09c['type']===_0x133d99(0x1b6)),_0x26227c=Array[_0x133d99(0x1a0)](_0x45df88)[_0x133d99(0x191)](),_0xd1a20c=_0x3d9843?![]:_0x4b12c0['length']>0x0||_0x236323[_0x133d99(0x280)]>0x0||_0x23c715[_0x133d99(0x280)]>0x0,_0x362c1a=_0x48c00b[_0x133d99(0x280)]>0x0||_0xbcd41a[_0x133d99(0x280)]>0x0||_0x2bce97['length']>0x0,_0x26254d=_0x3d9843?![]:_0x3232ad['length']>0x0,_0x55a573=_0x26227c[_0x133d99(0x280)]>0x0;return{'segments':{'new':_0x4b12c0,'changed':_0x236323,'unchanged':_0x440a0a,'toDelete':_0x23c715},'journeys':{'new':_0x48c00b,'changed':_0xbcd41a,'unchanged':_0x38599,'toDelete':_0x2bce97},'activations':{'all':_0x3232ad,'toCreate':_0x35dab7,'toUpdate':_0x4603d7,'toDelete':_0x48e700},'folders':{'toCreate':_0x26227c},'counts':{'segments':{'new':_0x4b12c0[_0x133d99(0x280)],'changed':_0x236323['length'],'unchanged':_0x440a0a[_0x133d99(0x280)],'toDelete':_0x23c715[_0x133d99(0x280)]},'journeys':{'new':_0x48c00b[_0x133d99(0x280)],'changed':_0xbcd41a[_0x133d99(0x280)],'unchanged':_0x38599[_0x133d99(0x280)],'toDelete':_0x2bce97['length']},'activations':{'create':_0x35dab7[_0x133d99(0x280)],'update':_0x4603d7[_0x133d99(0x280)],'delete':_0x48e700[_0x133d99(0x280)]},'folders':_0x26227c['length']},'hasChanges':_0xd1a20c||_0x362c1a||_0x26254d||_0x55a573};}export async function buildPushExecutionContext(_0x13350d,_0x370804,_0x1550e7,_0x2cf5e0,_0x21581a,_0x33424c){const _0x467408=a140_0x408869,_0x3ba13a=extractRootFolderId(_0x1550e7),{pathToId:_0x26de1f,idToPath:_0x258e3c}=buildFolderMaps(_0x21581a),_0x24fdb9=buildSegmentNameToIdMap(_0x2cf5e0),_0x5988f6=new Map(),{batchAsync:_0x5a96a2}=await import(_0x467408(0x1da)),[_0x2fafc2,_0x8f6585]=await Promise[_0x467408(0x247)]([_0x13350d[_0x467408(0x1cb)][_0x467408(0x210)](),_0x13350d[_0x467408(0x279)][_0x467408(0x23d)](),((async()=>{const _0x2b21ef=_0x467408;!_0x33424c&&_0x2cf5e0[_0x2b21ef(0x280)]>0x0&&await _0x5a96a2(_0x2cf5e0,async _0x588564=>{const _0x16428f=_0x2b21ef,_0x58a967=await _0x13350d['segment'][_0x16428f(0x283)](_0x370804,_0x588564['id']);_0x5988f6[_0x16428f(0x1f8)](_0x588564['id'],_0x58a967);});})())]),{emailToId:_0x2e766b,idToEmail:_0x43df6a}=_0x2fafc2,_0x37b1de=buildConnectionMaps(_0x8f6585);return{'rootFolderId':_0x3ba13a,'folderPathToId':_0x26de1f,'folderIdToPath':_0x258e3c,'segmentNameToId':_0x24fdb9,'activationsBySegmentId':_0x5988f6,'emailToIdMap':_0x2e766b,'idToEmailMap':_0x43df6a,'connectionNameToIdMap':_0x37b1de['nameToId'],'connectionIdToNameMap':_0x37b1de[_0x467408(0x23c)],'connectionNameToTypeMap':_0x37b1de[_0x467408(0x277)]};}export function createPushYamlContextForBundle(_0x47dd27,_0x377fd5,_0x1b4711,_0x1aba2c,_0x39785b,_0x2fe1ad,_0x47d169,_0x30831a){const {existingLocalSegmentNames:_0x2e104c,localExpandedRuleToNames:_0x1484b7}=_0x1aba2c,_0x364e67=new Set(),_0x24171e=new Map(),_0x46f883=new Map(),_0x1d11a7=new Map(),_0x4c3fd5=createJumpTargetCache(),_0xe92fa=new Map(),_0x4c3d4b=new Map(),_0x13ce04=new Set();let _0x15ad85;const _0x12eb6c=_0x44fdb8=>{const _0xf865e9={'resolveSegment':async _0x375e9a=>{const _0x4df532=a140_0x340f,_0x253289=_0x1d11a7[_0x4df532(0x1f1)](_0x375e9a);if(_0x253289!==undefined)return{'name':_0x253289,'isJourneyLocal':!![]};try{const _0x37e0a0=await fetchSegment(_0x47dd27,_0x377fd5,_0x375e9a,_0x1b4711);if(!_0x37e0a0)throw new Error('Segment\x20not\x20found');const _0x13f8f6=generateJourneyLocalName(_0x37e0a0[_0x4df532(0x265)]),_0x5e166d=_0x37e0a0[_0x4df532(0x19f)]===SEGMENT_KIND_JOURNEY&&_0x13f8f6!==undefined;let _0x21f8fe=_0x37e0a0[_0x4df532(0x265)],_0x31845a;if(_0x5e166d&&_0x37e0a0[_0x4df532(0x219)]){const _0xafe54c=apiRuleToYaml(_0x37e0a0[_0x4df532(0x219)]);_0x4c3d4b['set'](_0x375e9a,_0xafe54c);const _0x2212c4=async _0xf2fcc1=>{const _0x3aa59b=_0x4df532,_0x2092a5=collectSegmentRefsFromRule(_0xf2fcc1);for(const _0x4167ca of _0x2092a5){if(!_0x4c3d4b[_0x3aa59b(0x1ea)](_0x4167ca))try{const _0x55f1f2=await fetchSegment(_0x47dd27,_0x377fd5,_0x4167ca,_0x1b4711);if(_0x55f1f2?.[_0x3aa59b(0x219)]){const _0x3a7e83=apiRuleToYaml(_0x55f1f2[_0x3aa59b(0x219)]);_0x4c3d4b[_0x3aa59b(0x1f8)](_0x4167ca,_0x3a7e83),await _0x2212c4(_0x3a7e83);}}catch(_0x19dc1e){logger['debug'](_0x3aa59b(0x276)+_0x4167ca+':\x20'+_0x19dc1e);}}};await _0x2212c4(_0xafe54c);const _0x3db902=serializeExpandedRule(_0xafe54c,_0x4c3d4b),_0x4a83a2=_0x1484b7[_0x4df532(0x1f1)](_0x3db902);if(_0x4a83a2&&_0x4a83a2['length']>0x0){const _0x163f4e=_0x24171e[_0x4df532(0x1f1)](_0x3db902)||0x0,_0x41f741=_0x4a83a2[_0x163f4e]||_0x4a83a2[_0x4a83a2[_0x4df532(0x280)]-0x1];_0x24171e['set'](_0x3db902,_0x163f4e+0x1),_0x21f8fe=_0x41f741,_0x364e67[_0x4df532(0x199)](_0x21f8fe),_0x1d11a7[_0x4df532(0x1f8)](_0x375e9a,_0x21f8fe);const _0x23fe60=await resolveRuleSegmentRefs(_0xafe54c,async _0x17287d=>{const _0x493ea8=_0x4df532,_0x2063af=_0x1d11a7[_0x493ea8(0x1f1)](_0x17287d);if(_0x2063af)return _0x2063af;const _0x3737a8=await _0x15ad85['resolveSegment'](_0x17287d);return _0x3737a8[_0x493ea8(0x265)];});_0x31845a={'description':_0x37e0a0[_0x4df532(0x1c0)],'rule':_0x23fe60};}else{const _0x345271=_0xe92fa[_0x4df532(0x1f1)](_0x3db902);if(_0x345271)_0x21f8fe=_0x345271,_0x1d11a7[_0x4df532(0x1f8)](_0x375e9a,_0x21f8fe);else{if(_0x13f8f6){let _0x9db22c=_0x13f8f6,_0x4f1bd6=0x2;while(_0x364e67[_0x4df532(0x1ea)](_0x9db22c)||_0x2e104c[_0x4df532(0x1ea)](_0x9db22c)){_0x9db22c=_0x13f8f6+'_'+_0x4f1bd6,_0x4f1bd6++;}_0x364e67['add'](_0x9db22c),_0x21f8fe=_0x9db22c;}_0x1d11a7[_0x4df532(0x1f8)](_0x375e9a,_0x21f8fe),_0xe92fa['set'](_0x3db902,_0x21f8fe);const _0x2525d5=await resolveRuleSegmentRefs(_0xafe54c,async _0x6be67e=>{const _0xc0cde6=_0x4df532,_0x366823=_0x1d11a7[_0xc0cde6(0x1f1)](_0x6be67e);if(_0x366823)return _0x366823;const _0x2bb36b=await _0x15ad85['resolveSegment'](_0x6be67e);return _0x2bb36b[_0xc0cde6(0x265)];});_0x31845a={'description':_0x37e0a0['description'],'rule':_0x2525d5};}}}return{'name':_0x21f8fe,'isJourneyLocal':_0x5e166d,'definition':_0x31845a};}catch(_0xdc4d5e){return logger[_0x4df532(0x1bd)]('Failed\x20to\x20resolve\x20segment\x20'+_0x375e9a+':\x20'+_0xdc4d5e),{'name':_0x375e9a,'isJourneyLocal':![]};}},'resolveActivation':async _0x52487d=>{const _0x2aeb05=a140_0x340f,_0x6f6974=_0x46f883['get'](_0x52487d);if(_0x6f6974!==undefined)return{'name':_0x6f6974,'isJourneyLocal':!![]};try{let _0x5c0234=_0x47d169?.[_0x2aeb05(0x1f1)](_0x52487d);!_0x5c0234&&(_0x5c0234=await _0x47dd27[_0x2aeb05(0x25f)][_0x2aeb05(0x255)](_0x44fdb8,_0x52487d));const _0x7ceac6=_0x5c0234[_0x2aeb05(0x1be)][_0x2aeb05(0x281)][_0x2aeb05(0x265)]||_0x52487d,_0x319e66=sanitizeYamlKey(_0x7ceac6)||_0x2aeb05(0x1b4)+_0x52487d,_0x98f7dd=_0x319e66;_0x46f883[_0x2aeb05(0x1f8)](_0x52487d,_0x98f7dd);const _0x3365bc=journeyActivationStepToYaml(_0x5c0234,_0x39785b,_0x2fe1ad);return{'name':_0x98f7dd,'isJourneyLocal':!![],'definition':_0x3365bc};}catch(_0xe666af){return logger['debug'](_0x2aeb05(0x1f7)+_0x52487d+':\x20'+_0xe666af),{'name':_0x52487d,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x2575b2,_0x5ebbd7)=>resolveJumpTarget(_0x2575b2,_0x5ebbd7,_0x4c3fd5,async _0x4de4a2=>{const _0x25c8af=a140_0x340f,_0x2ecca1=_0x30831a?.['get'](_0x4de4a2);if(_0x2ecca1)return _0x2ecca1;return _0x47dd27[_0x25c8af(0x25f)][_0x25c8af(0x242)](_0x4de4a2);})};return _0x15ad85=_0xf865e9,_0xf865e9;},_0x3cd1fb=async _0xb32686=>{const _0x1f9131=a140_0x340f,{collectSegmentIdsFromJourneyApi:_0xb09066}=await import(_0x1f9131(0x278)),{batchAsync:_0x42f35f}=await import(_0x1f9131(0x1da)),_0x7ba163=new Set();for(const _0x58619f of _0xb32686){let _0x5daddc=_0x30831a?.[_0x1f9131(0x1f1)](_0x58619f);!_0x5daddc&&(_0x5daddc=await _0x47dd27[_0x1f9131(0x25f)][_0x1f9131(0x242)](_0x58619f));const _0x2bd285=_0xb09066(_0x5daddc);for(const _0x3a0574 of _0x2bd285){_0x7ba163[_0x1f9131(0x199)](_0x3a0574);}}let _0x20fd80=Array[_0x1f9131(0x1a0)](_0x7ba163);while(_0x20fd80[_0x1f9131(0x280)]>0x0){const _0x3970d0=_0x20fd80[_0x1f9131(0x24c)](_0x22da42=>!_0x13ce04['has'](_0x22da42));if(_0x3970d0['length']===0x0)break;const _0x188f14=await _0x42f35f(_0x3970d0,async _0x131e45=>{const _0x57ba8d=_0x1f9131;_0x13ce04[_0x57ba8d(0x199)](_0x131e45);const _0x5770c0=await fetchSegment(_0x47dd27,_0x377fd5,_0x131e45,_0x1b4711);if(!_0x5770c0)return null;return{'segmentId':_0x131e45,'segment':_0x5770c0};},0xa),_0x2657bd=new Set();for(const _0x256dc1 of _0x188f14){if(!_0x256dc1?.[_0x1f9131(0x22d)]?.['rule'])continue;const _0x1ff6eb=apiRuleToYaml(_0x256dc1[_0x1f9131(0x22d)][_0x1f9131(0x219)]);_0x4c3d4b[_0x1f9131(0x1f8)](_0x256dc1[_0x1f9131(0x1d4)],_0x1ff6eb);const _0x557af2=collectSegmentRefsFromRule(_0x1ff6eb);for(const _0x3be995 of _0x557af2){!_0x13ce04[_0x1f9131(0x1ea)](_0x3be995)&&_0x2657bd[_0x1f9131(0x199)](_0x3be995);}}_0x20fd80=Array[_0x1f9131(0x1a0)](_0x2657bd);}};return{'createYamlContext':_0x12eb6c,'prefetchJourneySegments':_0x3cd1fb};}export async function executePushSegments(_0x1f6af0,_0x40888d,_0xfecb41,_0x31cbe1,_0x40bd2e){const _0x1341ab=a140_0x408869,{segmentDefToCreateRequest:_0x2826f9,segmentDefToUpdateRequest:_0x1c9ff7}=await import(_0x1341ab(0x207)),_0x15692c=_0xfecb41[_0x1341ab(0x1ba)],_0x3b32ab=0x5,_0x587ba4=async _0x1d02a3=>{const _0x3f4437=_0x1341ab,_0x57b804=_0x1d02a3['folderPath']?_0x15692c[_0x3f4437(0x1f1)](_0x1d02a3[_0x3f4437(0x1b1)]):undefined;let _0x562e94;const _0x296e9c={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x681bf5=_0x1d02a3['yamlConfig'];if(_0x1d02a3[_0x3f4437(0x18a)]['rule']){const _0x133690=createSegmentIdResolver(_0xfecb41[_0x3f4437(0x238)],_0x1d02a3['yamlConfig'][_0x3f4437(0x265)]),_0x4b43af=await resolveRuleSegmentIds(_0x1d02a3['yamlConfig']['rule'],_0x133690);_0x681bf5={..._0x1d02a3[_0x3f4437(0x18a)],'rule':_0x4b43af};}try{if(_0x1d02a3['isNew']){_0x40bd2e[_0x3f4437(0x1eb)]?.({'type':'segment_creating','name':_0x1d02a3[_0x3f4437(0x18a)][_0x3f4437(0x265)]});const _0x2b927e=_0x2826f9(_0x681bf5,_0x57b804),_0x54b829=await _0x40bd2e[_0x3f4437(0x266)](_0x3f4437(0x263)+_0x1d02a3[_0x3f4437(0x18a)]['name']+_0x3f4437(0x232),()=>_0x1f6af0[_0x3f4437(0x22d)][_0x3f4437(0x269)](_0x31cbe1['parentId'],_0x2b927e));_0x562e94=_0x54b829[_0x3f4437(0x227)]['id'],_0xfecb41[_0x3f4437(0x238)][_0x3f4437(0x1f8)](_0x1d02a3['yamlConfig'][_0x3f4437(0x265)],_0x562e94),_0x296e9c['createdSegmentId']={'name':_0x1d02a3[_0x3f4437(0x18a)]['name'],'id':_0x562e94},_0x40bd2e['onProgress']?.({'type':_0x3f4437(0x225),'name':_0x1d02a3[_0x3f4437(0x18a)][_0x3f4437(0x265)],'segmentId':_0x562e94}),_0x40bd2e[_0x3f4437(0x1a9)]?.('Created\x20segment\x20\x27'+_0x1d02a3[_0x3f4437(0x18a)][_0x3f4437(0x265)]+'\x27'),_0x296e9c['created']=0x1;}else{if(_0x1d02a3[_0x3f4437(0x26a)]){_0x40bd2e[_0x3f4437(0x1eb)]?.({'type':_0x3f4437(0x226),'name':_0x1d02a3[_0x3f4437(0x18a)]['name']});const _0x59f4b2=_0x1c9ff7(_0x681bf5);_0x57b804!==_0x1d02a3['existingSegment']?.['segmentFolderId']&&(_0x59f4b2[_0x3f4437(0x259)]=_0x57b804?parseInt(_0x57b804,0xa):undefined),await _0x40bd2e['withProgress']('Updating\x20segment\x20\x27'+_0x1d02a3[_0x3f4437(0x18a)][_0x3f4437(0x265)]+'\x27...',()=>_0x1f6af0[_0x3f4437(0x22d)][_0x3f4437(0x1b7)](_0x31cbe1[_0x3f4437(0x18e)],_0x1d02a3[_0x3f4437(0x253)]['id'],_0x59f4b2)),_0x562e94=_0x1d02a3[_0x3f4437(0x253)]['id'],_0x40bd2e['onProgress']?.({'type':_0x3f4437(0x1ab),'name':_0x1d02a3[_0x3f4437(0x18a)][_0x3f4437(0x265)]}),_0x40bd2e[_0x3f4437(0x1a9)]?.(_0x3f4437(0x1e8)+_0x1d02a3[_0x3f4437(0x18a)]['name']+'\x27'),_0x296e9c['updated']=0x1;}else _0x562e94=_0x1d02a3[_0x3f4437(0x253)]['id'];}}catch(_0x5cbbe6){const _0x27abc8=isHttp400Error(_0x5cbbe6),_0x35669c=_0x27abc8?ErrorCode[_0x3f4437(0x19d)]:ErrorCode[_0x3f4437(0x26e)],_0x45a969=getErrorMessage(_0x5cbbe6);throw new SDKError(_0x35669c,_0x3f4437(0x1fb)+(_0x1d02a3[_0x3f4437(0x248)]?_0x3f4437(0x1e9):_0x3f4437(0x250))+_0x3f4437(0x21f)+_0x1d02a3[_0x3f4437(0x21d)]+'\x0a\x20\x20'+_0x45a969,_0x5cbbe6);}try{const _0x2ceca6=await syncActivationsForSegment(_0x1f6af0,_0x31cbe1[_0x3f4437(0x18e)],_0x562e94,_0x1d02a3['yamlConfig'][_0x3f4437(0x265)],_0x1d02a3[_0x3f4437(0x233)],_0x40bd2e,_0x1d02a3[_0x3f4437(0x21d)]);_0x296e9c['activations']=_0x2ceca6;}catch(_0x27a017){if(_0x27a017 instanceof SDKError)throw _0x27a017;throw new SDKError(ErrorCode[_0x3f4437(0x19e)],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x1d02a3[_0x3f4437(0x18a)][_0x3f4437(0x265)]+_0x3f4437(0x1c7)+_0x1d02a3['absolutePath']+_0x3f4437(0x1cd)+getErrorMessage(_0x27a017),_0x27a017);}return _0x296e9c;},_0x95e10=await batchAsync(_0x40888d,_0x587ba4,_0x3b32ab),_0x5bed67={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x70a8f2 of _0x95e10){_0x5bed67[_0x1341ab(0x254)]+=_0x70a8f2['created'],_0x5bed67[_0x1341ab(0x234)]+=_0x70a8f2[_0x1341ab(0x234)],_0x70a8f2[_0x1341ab(0x27a)]&&_0x5bed67[_0x1341ab(0x212)]['set'](_0x70a8f2[_0x1341ab(0x27a)]['name'],_0x70a8f2[_0x1341ab(0x27a)]['id']),_0x5bed67[_0x1341ab(0x20a)][_0x1341ab(0x254)]+=_0x70a8f2[_0x1341ab(0x20a)][_0x1341ab(0x254)],_0x5bed67[_0x1341ab(0x20a)]['updated']+=_0x70a8f2['activations'][_0x1341ab(0x234)],_0x5bed67[_0x1341ab(0x20a)][_0x1341ab(0x1ee)]+=_0x70a8f2[_0x1341ab(0x20a)][_0x1341ab(0x1ee)];}return _0x5bed67;}async function syncActivationsForSegment(_0x563221,_0x4d6ca5,_0x2822c7,_0x40dd26,_0x38fd40,_0x5a4c29,_0x286021){const _0x1f0bf6=a140_0x408869,_0x118579={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x1858cc of _0x38fd40){try{if(_0x1858cc[_0x1f0bf6(0x1ce)]===_0x1f0bf6(0x1e9)&&_0x1858cc[_0x1f0bf6(0x211)])_0x5a4c29[_0x1f0bf6(0x1eb)]?.({'type':_0x1f0bf6(0x208),'segmentName':_0x40dd26,'activationName':_0x1858cc[_0x1f0bf6(0x265)]}),await _0x5a4c29[_0x1f0bf6(0x266)]('Creating\x20activation\x20\x27'+_0x1858cc[_0x1f0bf6(0x265)]+_0x1f0bf6(0x232),()=>_0x563221[_0x1f0bf6(0x22d)][_0x1f0bf6(0x1df)](_0x4d6ca5,_0x2822c7,_0x1858cc[_0x1f0bf6(0x211)])),_0x5a4c29[_0x1f0bf6(0x1eb)]?.({'type':'activation_created','segmentName':_0x40dd26,'activationName':_0x1858cc[_0x1f0bf6(0x265)]}),_0x5a4c29[_0x1f0bf6(0x1a9)]?.(_0x1f0bf6(0x1f4)+_0x1858cc[_0x1f0bf6(0x265)]+'\x27'),_0x118579[_0x1f0bf6(0x254)]++;else{if(_0x1858cc['type']===_0x1f0bf6(0x250)&&_0x1858cc['validatedRequest']&&_0x1858cc[_0x1f0bf6(0x21e)])_0x5a4c29[_0x1f0bf6(0x1eb)]?.({'type':_0x1f0bf6(0x288),'segmentName':_0x40dd26,'activationName':_0x1858cc[_0x1f0bf6(0x265)]}),await _0x5a4c29[_0x1f0bf6(0x266)](_0x1f0bf6(0x25a)+_0x1858cc[_0x1f0bf6(0x265)]+_0x1f0bf6(0x232),()=>_0x563221[_0x1f0bf6(0x22d)]['updateActivation'](_0x4d6ca5,_0x2822c7,_0x1858cc[_0x1f0bf6(0x21e)]['id'],_0x1858cc[_0x1f0bf6(0x211)])),_0x5a4c29[_0x1f0bf6(0x1eb)]?.({'type':'activation_updated','segmentName':_0x40dd26,'activationName':_0x1858cc[_0x1f0bf6(0x265)]}),_0x5a4c29[_0x1f0bf6(0x1a9)]?.(_0x1f0bf6(0x1d0)+_0x1858cc[_0x1f0bf6(0x265)]+'\x27'),_0x118579['updated']++;else _0x1858cc[_0x1f0bf6(0x1ce)]===_0x1f0bf6(0x1b6)&&_0x1858cc[_0x1f0bf6(0x21e)]&&(_0x5a4c29['onProgress']?.({'type':_0x1f0bf6(0x271),'segmentName':_0x40dd26,'activationName':_0x1858cc[_0x1f0bf6(0x265)]}),await _0x5a4c29[_0x1f0bf6(0x266)](_0x1f0bf6(0x221)+_0x1858cc['name']+_0x1f0bf6(0x232),()=>_0x563221[_0x1f0bf6(0x22d)]['deleteActivation'](_0x4d6ca5,_0x2822c7,_0x1858cc[_0x1f0bf6(0x21e)]['id'])),_0x5a4c29['onProgress']?.({'type':_0x1f0bf6(0x1cf),'segmentName':_0x40dd26,'activationName':_0x1858cc[_0x1f0bf6(0x265)]}),_0x5a4c29[_0x1f0bf6(0x24a)]?.(_0x1f0bf6(0x1ad)+_0x1858cc['name']+'\x27'),_0x118579[_0x1f0bf6(0x1ee)]++);}}catch(_0xb256e8){const _0x483a83=isHttp400Error(_0xb256e8),_0x3afd7e=_0x483a83?ErrorCode[_0x1f0bf6(0x23e)]:ErrorCode[_0x1f0bf6(0x19e)],_0x2f5b07=getErrorMessage(_0xb256e8);throw new SDKError(_0x3afd7e,_0x1f0bf6(0x1fb)+_0x1858cc[_0x1f0bf6(0x1ce)]+'\x20activation\x20\x27'+_0x1858cc[_0x1f0bf6(0x265)]+'\x27\x20from\x20file:\x20'+_0x286021+_0x1f0bf6(0x1cd)+_0x2f5b07,_0xb256e8);}}return _0x118579;}export async function executePushFolders(_0x1dbb2e,_0x356c40,_0x39ec12,_0x23fbe8,_0x1aea2e){const _0x23e19a=a140_0x408869,_0x39644a=new Map(_0x39ec12),_0x206623=sortFoldersByDepth(_0x356c40);for(const _0x913e35 of _0x206623){const _0x1d6b37=_0x913e35['split']('/'),_0x4ad058=_0x1d6b37[_0x1d6b37[_0x23e19a(0x280)]-0x1],_0x188028=_0x1d6b37[_0x23e19a(0x282)](0x0,-0x1)[_0x23e19a(0x1cc)]('/'),_0x38ffda=_0x39644a[_0x23e19a(0x1f1)](_0x188028);_0x1aea2e[_0x23e19a(0x1eb)]?.({'type':_0x23e19a(0x1c6),'folder':_0x913e35});const _0xd09ef7={'name':_0x4ad058,'parentFolderId':_0x38ffda},_0x3b6e5f=await _0x1aea2e[_0x23e19a(0x266)](_0x23e19a(0x1b8)+_0x913e35+'\x27...',()=>_0x1dbb2e[_0x23e19a(0x22d)]['createFolder'](_0x23fbe8[_0x23e19a(0x18e)],_0xd09ef7));_0x39644a[_0x23e19a(0x1f8)](_0x913e35,_0x3b6e5f[_0x23e19a(0x227)]['id']),_0x1aea2e[_0x23e19a(0x1eb)]?.({'type':'folder_created','folder':_0x913e35,'folderId':_0x3b6e5f[_0x23e19a(0x227)]['id']}),_0x1aea2e[_0x23e19a(0x1af)]?.(_0x23e19a(0x1e3)+_0x913e35+'\x27');}return _0x39644a;}export async function executePushSegmentDeletions(_0x11e9a1,_0x4469ab,_0x587784){const _0x491345=a140_0x408869;if(_0x4469ab['length']===0x0)return 0x0;const {batchAsync:_0x7ae665}=await import(_0x491345(0x1da)),_0x5cf9c4=0x5,_0x300fd8=await _0x7ae665(_0x4469ab,async _0x45f676=>{const _0x1b344d=_0x491345;return _0x587784[_0x1b344d(0x1eb)]?.({'type':_0x1b344d(0x1fa),'name':_0x45f676[_0x1b344d(0x265)]}),await _0x11e9a1[_0x1b344d(0x22d)][_0x1b344d(0x267)](_0x45f676['id']),_0x587784[_0x1b344d(0x1eb)]?.({'type':'segment_deleted','name':_0x45f676[_0x1b344d(0x265)]}),_0x587784[_0x1b344d(0x24a)]?.(_0x1b344d(0x235)+_0x45f676[_0x1b344d(0x265)]+'\x27'),0x1;},_0x5cf9c4);return _0x300fd8[_0x491345(0x230)]((_0x4ee36a,_0x24139f)=>_0x4ee36a+_0x24139f,0x0);}export async function executePushJourneys(_0x53f96f,_0x98857,_0x7bfe4b,_0xe60785,_0x1d3570){const _0x4bcce7=a140_0x408869,{journeyDefToRequest:_0x406a68}=await import(_0x4bcce7(0x278)),{activationDefToCreateRequest:_0x2a8deb,yamlRuleToApi:_0x201a79,validateSegmentRule:_0x978db0}=await import('./child-segment-yaml.js'),_0x37c19f={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x1788fc=new Map(_0x7bfe4b[_0x4bcce7(0x238)]),_0x5adce3=0x5;for(let _0x1c2e5f=0x0;_0x1c2e5f<_0x98857['length'];_0x1c2e5f+=_0x5adce3){const _0x248d67=_0x98857[_0x4bcce7(0x282)](_0x1c2e5f,_0x1c2e5f+_0x5adce3),_0x3f2010=await Promise[_0x4bcce7(0x247)](_0x248d67['map'](async _0x4df9be=>{const _0x2892df=_0x4bcce7;if(!_0x4df9be[_0x2892df(0x248)]&&!_0x4df9be['hasChanges'])return{'action':_0x2892df(0x24b),'name':_0x4df9be['yamlConfig']['name'],'journeyId':_0x4df9be['existingJourney']?.['id']};const _0x111101=_0x4df9be[_0x2892df(0x1b1)]?_0x7bfe4b[_0x2892df(0x1ba)][_0x2892df(0x1f1)](_0x4df9be[_0x2892df(0x1b1)]):undefined;_0x1d3570[_0x2892df(0x1eb)]?.({'type':_0x4df9be[_0x2892df(0x248)]?'journey_creating':_0x2892df(0x27f),'name':_0x4df9be[_0x2892df(0x18a)]['name']});try{const _0x51b2b0=await executeSingleJourneyPush(_0x53f96f,_0x4df9be,{..._0x7bfe4b,'segmentNameToId':_0x1788fc},{'parentId':_0xe60785[_0x2892df(0x18e)],'rootFolderId':_0xe60785[_0x2892df(0x1a2)],'folderId':_0x111101,'verbose':_0xe60785[_0x2892df(0x1a7)]},_0x1d3570,{'journeyDefToRequest':_0x406a68,'activationDefToCreateRequest':_0x2a8deb,'yamlRuleToApi':_0x201a79,'validateSegmentRule':_0x978db0});for(const [_0x4ee8ca,_0x42421d]of _0x51b2b0[_0x2892df(0x19b)]){_0x1788fc[_0x2892df(0x1f8)](_0x4ee8ca,_0x42421d),_0x37c19f[_0x2892df(0x19b)][_0x2892df(0x1f8)](_0x4ee8ca,_0x42421d);}if(_0x51b2b0[_0x2892df(0x286)]===_0x2892df(0x254))_0x1d3570[_0x2892df(0x1eb)]?.({'type':_0x2892df(0x196),'name':_0x4df9be[_0x2892df(0x18a)][_0x2892df(0x265)],'journeyId':_0x51b2b0[_0x2892df(0x1e0)]}),_0x1d3570['logSuccess']?.('Created\x20journey\x20\x27'+_0x4df9be[_0x2892df(0x18a)][_0x2892df(0x265)]+'\x27'),_0x37c19f[_0x2892df(0x254)]++;else _0x51b2b0[_0x2892df(0x286)]==='updated'&&(_0x1d3570['onProgress']?.({'type':_0x2892df(0x1d6),'name':_0x4df9be[_0x2892df(0x18a)][_0x2892df(0x265)]}),_0x1d3570['logSuccess']?.('Updated\x20journey\x20\x27'+_0x4df9be[_0x2892df(0x18a)][_0x2892df(0x265)]+'\x27'),_0x37c19f[_0x2892df(0x234)]++);return{'action':_0x51b2b0[_0x2892df(0x286)],'name':_0x4df9be[_0x2892df(0x18a)][_0x2892df(0x265)],'journeyId':_0x51b2b0['journeyId']};}catch(_0x1fa63f){const _0x720db9=isHttp400Error(_0x1fa63f),_0x59998e=_0x720db9?ErrorCode[_0x2892df(0x19c)]:ErrorCode[_0x2892df(0x18d)],_0x482df9=getErrorMessage(_0x1fa63f);throw new SDKError(_0x59998e,_0x2892df(0x1fb)+(_0x4df9be['isNew']?_0x2892df(0x1e9):_0x2892df(0x250))+_0x2892df(0x1de)+_0x4df9be[_0x2892df(0x21d)]+'\x0a\x20\x20'+_0x482df9,_0x1fa63f);}}));_0x37c19f[_0x4bcce7(0x217)][_0x4bcce7(0x1aa)](..._0x3f2010);}return _0x37c19f;}async function matchExistingJourneySegments(_0x178bb2,_0x203c17,_0x63c686,_0x204d13,_0x30e0d1){const _0x385cd0=a140_0x408869;if(!_0x203c17[_0x385cd0(0x222)]||!_0x203c17[_0x385cd0(0x18a)][_0x385cd0(0x241)])return;const _0x168f36=new Map(),_0xe12648=new Set();for(const _0x258762 of Object[_0x385cd0(0x287)](_0x203c17[_0x385cd0(0x18a)]['segments'])){const _0x21dec9=generateDeterministicJourneySegmentName(_0x203c17[_0x385cd0(0x18a)]['name'],_0x258762);_0x168f36['set'](_0x21dec9,_0x258762),_0xe12648['add'](_0x258762);}const _0x3de9de=[],_0xb3226f=collectSegmentIdsFromJourneyApi(_0x203c17[_0x385cd0(0x222)]);for(const _0x96f902 of _0xb3226f){const _0x386731=await fetchSegment(_0x178bb2,_0x63c686,_0x96f902,_0x204d13);if(!_0x386731?.[_0x385cd0(0x265)])continue;const _0x52a452=_0x168f36[_0x385cd0(0x1f1)](_0x386731[_0x385cd0(0x265)]);_0x52a452?(_0x30e0d1[_0x385cd0(0x1f8)](_0x52a452,_0x96f902),_0xe12648['delete'](_0x52a452)):_0x3de9de[_0x385cd0(0x1aa)]({'id':_0x96f902,'seg':_0x386731});}if(_0xe12648['size']>0x0&&_0x3de9de[_0x385cd0(0x280)]>0x0){const {localExpandedRuleToNames:_0x3ee8cb}=buildLocalExpandedRuleMappings(_0x203c17[_0x385cd0(0x18a)]),_0x3fcec5=new Map();for(const {id:_0x4ff6ed,seg:_0x376fad}of _0x3de9de){if(_0x376fad[_0x385cd0(0x219)]){const _0x2427b4=apiRuleToYaml(_0x376fad['rule']);_0x3fcec5[_0x385cd0(0x1f8)](_0x4ff6ed,_0x2427b4);}}for(const {id:_0x2562f8,seg:_0x1cb87}of _0x3de9de){if(!_0x1cb87[_0x385cd0(0x219)])continue;const _0x1c9dfe=_0x3fcec5[_0x385cd0(0x1f1)](_0x2562f8);if(!_0x1c9dfe)continue;const _0xf88970=serializeExpandedRule(_0x1c9dfe,_0x3fcec5),_0x391291=_0x3ee8cb[_0x385cd0(0x1f1)](_0xf88970);if(_0x391291){const _0x18939a=_0x391291[_0x385cd0(0x270)](_0x18ddb2=>_0xe12648[_0x385cd0(0x1ea)](_0x18ddb2));_0x18939a&&(_0x30e0d1[_0x385cd0(0x1f8)](_0x18939a,_0x2562f8),_0xe12648[_0x385cd0(0x1b6)](_0x18939a),logger[_0x385cd0(0x1bd)](_0x385cd0(0x249)+_0x1cb87[_0x385cd0(0x265)]+_0x385cd0(0x209)+_0x18939a+_0x385cd0(0x240)));}}}}async function executeSingleJourneyPush(_0x6c2d50,_0x356a50,_0x22625,_0x37ef34,_0x11d977,_0x492d71){const _0x3beeb2=a140_0x408869,{journeyDefToRequest:_0xcccd3f,activationDefToCreateRequest:_0x1195d0,yamlRuleToApi:_0xd1193,validateSegmentRule:_0x567ef5}=_0x492d71,_0x30d5b0=new Map(),_0x329c25=new Map();recoverSegmentIdsFromPushRecovery(_0x356a50,_0x30d5b0,_0x22625['segmentNameToId']);const _0x51be36=new Map(),_0x1e78c8=new Map(),_0x20954d=new Map();let _0x180623;const _0x44e03f=async()=>{const _0x50be51=a140_0x340f;if(_0x180623)return;_0x180623=new Map();if(!_0x356a50['existingJourney'])return;const _0x371896=await _0x6c2d50['journey'][_0x50be51(0x283)](_0x356a50[_0x50be51(0x222)]['id']);for(const _0x14887f of _0x371896){const _0x2c2937=journeyActivationStepToYaml(_0x14887f,_0x22625[_0x50be51(0x1d8)],_0x22625[_0x50be51(0x1e7)]),_0x3aa355=activationSignature(_0x2c2937);!_0x180623[_0x50be51(0x1ea)](_0x3aa355)&&_0x180623[_0x50be51(0x1f8)](_0x3aa355,_0x14887f['id']),_0x2c2937[_0x50be51(0x265)]&&_0x329c25[_0x50be51(0x1f8)](_0x2c2937[_0x50be51(0x265)],_0x14887f['id']);}};await matchExistingJourneySegments(_0x6c2d50,_0x356a50,_0x37ef34[_0x3beeb2(0x18e)],_0x22625['existingSegments'],_0x22625[_0x3beeb2(0x238)]);const _0x3719b8={'resolveSegmentId':async _0xbc2e44=>{const _0x5c39e6=_0x3beeb2,_0x5ab49f=_0x22625[_0x5c39e6(0x238)]['get'](_0xbc2e44);if(!_0x5ab49f)throw new SDKError(ErrorCode[_0x5c39e6(0x214)],_0x5c39e6(0x27e)+_0xbc2e44+_0x5c39e6(0x256)+_0x356a50[_0x5c39e6(0x18a)][_0x5c39e6(0x265)]+')');return _0x5ab49f;},'resolveEmbeddedSegmentId':async(_0x5b39de,_0x1ac163)=>{const _0x40b815=_0x3beeb2,_0x32d1e3=_0x22625[_0x40b815(0x238)]['get'](_0x5b39de);if(_0x32d1e3)return _0x32d1e3;const _0x147761=_0x22625[_0x40b815(0x206)][_0x40b815(0x270)](_0x1580f3=>_0x1580f3[_0x40b815(0x265)]===_0x5b39de);if(_0x147761)return _0x22625['segmentNameToId'][_0x40b815(0x1f8)](_0x5b39de,_0x147761['id']),_0x147761['id'];if(_0x356a50['isNew']){const {stageName:_0x1ddf74,criteriaName:_0x28f2db}=findSegmentCriteriaLocation(_0x356a50[_0x40b815(0x18a)],_0x5b39de);return _0x567ef5(_0x5b39de,_0x1ac163[_0x40b815(0x219)]),_0x1e78c8[_0x40b815(0x1f8)](_0x5b39de,{'definition':_0x1ac163,'stageName':_0x1ddf74,'criteriaName':_0x28f2db}),createPendingSegmentId(_0x5b39de);}const _0x262dde=_0x356a50['existingJourney']?.['id'];if(!_0x262dde)throw new SDKError(ErrorCode[_0x40b815(0x1c8)],_0x40b815(0x22a));const _0x4cbc99=_0x51be36['get'](_0x5b39de);if(_0x4cbc99)return _0x4cbc99;const _0xaa1a60=((async()=>{const _0x4695d0=_0x40b815;_0x567ef5(_0x5b39de,_0x1ac163[_0x4695d0(0x219)]);const _0x2251eb=generateDeterministicJourneySegmentName(_0x356a50[_0x4695d0(0x18a)][_0x4695d0(0x265)],_0x5b39de),_0x520ef7=_0x22625['existingSegments'][_0x4695d0(0x270)](_0x2a677d=>_0x2a677d[_0x4695d0(0x265)]===_0x2251eb),_0x6a7594=createSegmentIdResolver(_0x22625['segmentNameToId'],_0x5b39de),_0x5cc1a5=await resolveRuleSegmentIds(_0x1ac163[_0x4695d0(0x219)],_0x6a7594);let _0x1d266c;return _0x520ef7?(await _0x6c2d50[_0x4695d0(0x22d)][_0x4695d0(0x1b7)](_0x37ef34['parentId'],_0x520ef7['id'],{'description':_0x1ac163[_0x4695d0(0x1c0)]||_0x4695d0(0x198)+_0x5b39de,'rule':_0xd1193(_0x5cc1a5,!![]),'countPopulation':!![]}),_0x1d266c=_0x520ef7['id'],saveSegmentToPushRecovery(_0x356a50['absolutePath'],_0x356a50[_0x4695d0(0x18a)][_0x4695d0(0x265)],_0x5b39de,{'segmentId':_0x1d266c,'uniqueServerName':_0x2251eb,'createdAt':new Date()[_0x4695d0(0x1ec)]()})):_0x1d266c=await createOrRecoverEmbeddedSegment(_0x6c2d50,_0x356a50,{'localName':_0x5b39de,'uniqueSegmentName':_0x2251eb,'description':_0x1ac163[_0x4695d0(0x1c0)]||_0x4695d0(0x198)+_0x5b39de,'journeyId':_0x262dde,'resolvedRule':_0x5cc1a5,'parentId':_0x37ef34[_0x4695d0(0x18e)],'folderId':_0x37ef34[_0x4695d0(0x1a2)]||''},_0xd1193),_0x22625[_0x4695d0(0x238)][_0x4695d0(0x1f8)](_0x5b39de,_0x1d266c),_0x30d5b0['set'](_0x5b39de,_0x1d266c),_0x1d266c;})());_0x51be36['set'](_0x5b39de,_0xaa1a60);try{return await _0xaa1a60;}finally{_0x51be36[_0x40b815(0x1b6)](_0x5b39de);}},'resolveActivationId':async _0x480e88=>{const _0x3af41b=_0x3beeb2,_0x17784a=_0x329c25[_0x3af41b(0x1f1)](_0x480e88);if(_0x17784a)return _0x17784a;if(_0x356a50[_0x3af41b(0x222)]){await _0x44e03f();const _0x4d4e4c=_0x329c25['get'](_0x480e88);if(_0x4d4e4c)return _0x4d4e4c;}throw new SDKError(ErrorCode[_0x3af41b(0x215)],_0x3af41b(0x274)+_0x480e88+_0x3af41b(0x256)+_0x356a50[_0x3af41b(0x18a)][_0x3af41b(0x265)]+_0x3af41b(0x24e)+_0x3af41b(0x1c3));},'resolveEmbeddedActivationId':async(_0x2df774,_0x4700e5)=>{const _0x2e4edd=_0x3beeb2,_0x44cda1=_0x329c25[_0x2e4edd(0x1f1)](_0x2df774);if(_0x44cda1)return _0x44cda1;if(_0x356a50['isNew'])return _0x20954d[_0x2e4edd(0x1f8)](_0x2df774,_0x4700e5),createPendingActivationId(_0x2df774);if(_0x356a50[_0x2e4edd(0x222)]){await _0x44e03f();const _0x5c3d09=_0x329c25[_0x2e4edd(0x1f1)](_0x4700e5[_0x2e4edd(0x265)]);if(_0x5c3d09)return _0x329c25[_0x2e4edd(0x1f8)](_0x2df774,_0x5c3d09),_0x5c3d09;const _0x5ad202=activationSignature(_0x4700e5),_0x32b66d=_0x180623?.[_0x2e4edd(0x1f1)](_0x5ad202);if(_0x32b66d)return _0x329c25[_0x2e4edd(0x1f8)](_0x2df774,_0x32b66d),_0x32b66d;const _0x4a3dda=await _0x1195d0(_0x4700e5,_0x22625[_0x2e4edd(0x190)]),_0x102be5={..._0x4a3dda,..._0x4700e5['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x4700e5[_0x2e4edd(0x1fe)]}},_0x580e03=await _0x6c2d50['journey'][_0x2e4edd(0x1df)](_0x356a50['existingJourney']['id'],_0x102be5);return _0x329c25[_0x2e4edd(0x1f8)](_0x2df774,_0x580e03['id']),_0x580e03['id'];}throw new SDKError(ErrorCode[_0x2e4edd(0x1c8)],_0x2e4edd(0x243));},'resolveJourneyId':async _0x42a532=>{const _0x5c6ba7=_0x3beeb2;try{return await _0x6c2d50[_0x5c6ba7(0x25f)][_0x5c6ba7(0x257)](_0x37ef34[_0x5c6ba7(0x18e)],_0x42a532);}catch(_0x35a065){throw new SDKError(ErrorCode[_0x5c6ba7(0x215)],_0x5c6ba7(0x24d)+_0x42a532+_0x5c6ba7(0x1f2)+_0x356a50[_0x5c6ba7(0x18a)][_0x5c6ba7(0x265)]+'\x27)',_0x35a065);}},'resolveStageId':async(_0x3bac24,_0x4934fa)=>{const _0x24b0ec=_0x3beeb2,_0x55d206=await _0x6c2d50[_0x24b0ec(0x25f)][_0x24b0ec(0x242)](_0x3bac24),_0x1ab2dd=_0x55d206['attributes'][_0x24b0ec(0x23f)]['find'](_0x49893c=>_0x49893c['name'][_0x24b0ec(0x218)]()===_0x4934fa['toLowerCase']());if(!_0x1ab2dd?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],_0x24b0ec(0x197)+_0x4934fa+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x55d206['attributes'][_0x24b0ec(0x261)]||_0x55d206[_0x24b0ec(0x1be)][_0x24b0ec(0x265)])+'\x27');return _0x1ab2dd['id'];}},_0x19d9ec=await _0xcccd3f(_0x356a50[_0x3beeb2(0x18a)],_0x37ef34[_0x3beeb2(0x18e)],_0x3719b8),_0x90030=_0x37ef34[_0x3beeb2(0x258)]||_0x37ef34[_0x3beeb2(0x1a2)];_0x90030&&(_0x19d9ec[_0x3beeb2(0x245)]={'parentFolder':{'data':{'id':_0x90030,'type':'folder'}}});if(_0x356a50[_0x3beeb2(0x248)]){if(_0x1e78c8['size']>0x0||_0x20954d[_0x3beeb2(0x1ac)]>0x0)return await executeThreeStepJourneyCreate(_0x6c2d50,_0x356a50,_0x19d9ec,{'pendingEmbeddedSegments':_0x1e78c8,'pendingEmbeddedActivations':_0x20954d,'embeddedSegmentNameToId':_0x30d5b0,'journeyActivationNameToId':_0x329c25},{..._0x37ef34,'effectiveFolderId':_0x90030},_0x22625,_0x11d977,_0x492d71);else{ensureJourneyDefaults(_0x19d9ec[_0x3beeb2(0x1be)]);const _0x4e77c7=await _0x6c2d50[_0x3beeb2(0x25f)]['create'](_0x19d9ec);return deletePushRecovery(_0x356a50[_0x3beeb2(0x21d)]),{'action':'created','journeyId':_0x4e77c7['id'],'embeddedSegmentNameToId':_0x30d5b0};}}else{if(_0x356a50[_0x3beeb2(0x26a)]&&_0x356a50[_0x3beeb2(0x222)]){_0x19d9ec['id']=_0x356a50[_0x3beeb2(0x222)]['id'];const _0x4e14c4=_0x19d9ec[_0x3beeb2(0x1be)];_0x356a50[_0x3beeb2(0x222)][_0x3beeb2(0x1be)]?.['journeyBundleName']&&(_0x4e14c4['journeyBundleName']=_0x356a50[_0x3beeb2(0x222)]['attributes']['journeyBundleName']);const _0x38f82d=_0x356a50[_0x3beeb2(0x222)][_0x3beeb2(0x1be)]?.['journeyStages'];return _0x38f82d&&_0x19d9ec['attributes'][_0x3beeb2(0x23f)]&&injectExistingStageIds(_0x19d9ec[_0x3beeb2(0x1be)]['journeyStages'],_0x38f82d),ensureJourneyDefaults(_0x4e14c4),await _0x6c2d50[_0x3beeb2(0x25f)]['update'](_0x356a50[_0x3beeb2(0x222)]['id'],_0x19d9ec),deletePushRecovery(_0x356a50['absolutePath']),{'action':_0x3beeb2(0x234),'journeyId':_0x356a50[_0x3beeb2(0x222)]['id'],'embeddedSegmentNameToId':_0x30d5b0};}}return deletePushRecovery(_0x356a50[_0x3beeb2(0x21d)]),{'action':_0x3beeb2(0x24b),'journeyId':_0x356a50[_0x3beeb2(0x222)]?.['id'],'embeddedSegmentNameToId':_0x30d5b0};}function findSegmentCriteriaLocation(_0x32c88c,_0x597482){const _0x448f9a=a140_0x408869,_0x573101=_0x32c88c[_0x448f9a(0x189)]||_0x32c88c[_0x448f9a(0x1f9)]?.[0x0]?.['stages']||[];let _0x52e8a8=_0x448f9a(0x22f),_0x4ab4a9=_0x597482;const _0x29ee1c=_0x32c88c[_0x448f9a(0x1c9)]||_0x32c88c[_0x448f9a(0x1f9)]?.[0x0]?.[_0x448f9a(0x1c9)];if(_0x29ee1c?.[_0x448f9a(0x22d)]===_0x597482)return{'stageName':_0x448f9a(0x1c9),'criteriaName':_0x29ee1c[_0x448f9a(0x265)]||_0x597482};_0x1b6a7e:for(const _0x4ec997 of _0x573101){if(_0x4ec997[_0x448f9a(0x1c4)]?.[_0x448f9a(0x22d)]===_0x597482){_0x52e8a8=_0x4ec997['name'],_0x4ab4a9=_0x4ec997[_0x448f9a(0x1c4)]['name']||_0x597482;break;}if(_0x4ec997[_0x448f9a(0x22e)])for(const _0x350bbb of _0x4ec997[_0x448f9a(0x22e)]){if(_0x350bbb['type']===_0x448f9a(0x1c2)&&_0x350bbb[_0x448f9a(0x1ff)]?.[_0x448f9a(0x262)])for(const _0x1f14e2 of _0x350bbb[_0x448f9a(0x1ff)]['branches']){if(_0x1f14e2[_0x448f9a(0x22d)]===_0x597482){_0x52e8a8=_0x4ec997[_0x448f9a(0x265)],_0x4ab4a9=_0x1f14e2['name']||_0x597482;break _0x1b6a7e;}}}}return{'stageName':_0x52e8a8,'criteriaName':_0x4ab4a9};}async function executeThreeStepJourneyCreate(_0x516d40,_0x15ecca,_0xf4c361,_0x644561,_0x21c672,_0x3b156d,_0x509632,_0x1ba0e8){const _0x3df28d=a140_0x408869,{activationDefToCreateRequest:_0x5a0d13,yamlRuleToApi:_0x2d79a7}=_0x1ba0e8,{pendingEmbeddedSegments:_0x790465,pendingEmbeddedActivations:_0x3b5b72,embeddedSegmentNameToId:_0xe264f8}=_0x644561,_0xcc8d05=JSON['parse'](JSON[_0x3df28d(0x22c)](_0xf4c361));ensureJourneyDefaults(_0xcc8d05[_0x3df28d(0x1be)]),stripPendingIds(_0xcc8d05);const _0x8b34b3=await _0x516d40[_0x3df28d(0x25f)][_0x3df28d(0x1e9)](_0xcc8d05),_0x19f135=_0x8b34b3['id'],_0x2bd27f=new Map();for(const _0x371c6a of _0x8b34b3[_0x3df28d(0x1be)][_0x3df28d(0x23f)]){_0x2bd27f[_0x3df28d(0x1f8)](_0x371c6a[_0x3df28d(0x265)]['toLowerCase'](),_0x371c6a['id']);}recoverSegmentIdsFromPushRecovery(_0x15ecca,_0xe264f8,_0x3b156d[_0x3df28d(0x238)]);for(const [_0x51cc34,{definition:_0x51b668}]of _0x790465){if(_0xe264f8[_0x3df28d(0x1ea)](_0x51cc34)){_0x509632['onProgress']?.({'type':_0x3df28d(0x26f),'journeyName':_0x15ecca['yamlConfig'][_0x3df28d(0x265)],'segmentName':_0x51cc34});continue;}const _0x36c4eb=generateDeterministicJourneySegmentName(_0x15ecca[_0x3df28d(0x18a)][_0x3df28d(0x265)],_0x51cc34);_0x509632[_0x3df28d(0x1eb)]?.({'type':_0x3df28d(0x1f5),'journeyName':_0x15ecca[_0x3df28d(0x18a)][_0x3df28d(0x265)],'segmentName':_0x51cc34});const _0x4e75e2=createSegmentIdResolver(_0x3b156d[_0x3df28d(0x238)],_0x51cc34),_0x5db16c=await resolveRuleSegmentIds(_0x51b668['rule'],_0x4e75e2),_0x4f3a43=await createOrRecoverEmbeddedSegment(_0x516d40,_0x15ecca,{'localName':_0x51cc34,'uniqueSegmentName':_0x36c4eb,'description':_0x51b668['description']||_0x3df28d(0x198)+_0x51cc34,'journeyId':_0x19f135,'resolvedRule':_0x5db16c,'parentId':_0x21c672[_0x3df28d(0x18e)],'folderId':_0x21c672[_0x3df28d(0x1b3)]||''},_0x2d79a7);_0xe264f8[_0x3df28d(0x1f8)](_0x51cc34,_0x4f3a43),_0x3b156d[_0x3df28d(0x238)]['set'](_0x51cc34,_0x4f3a43),_0x509632[_0x3df28d(0x1eb)]?.({'type':_0x3df28d(0x26f),'journeyName':_0x15ecca[_0x3df28d(0x18a)][_0x3df28d(0x265)],'segmentName':_0x51cc34});}const _0x500cd5=new Map();for(const [_0x308730,_0x5c4737]of _0x3b5b72){_0x509632[_0x3df28d(0x1eb)]?.({'type':_0x3df28d(0x1f0),'journeyName':_0x15ecca['yamlConfig'][_0x3df28d(0x265)],'activationName':_0x308730});const _0x13cc7a=await _0x5a0d13(_0x5c4737,_0x3b156d['activationContext']),_0xe24842={..._0x13cc7a,..._0x5c4737[_0x3df28d(0x1fe)]!==undefined&&{'runAfterJourneyRefresh':_0x5c4737[_0x3df28d(0x1fe)]}},_0x414e2e=await _0x516d40[_0x3df28d(0x25f)][_0x3df28d(0x1df)](_0x19f135,_0xe24842);_0x500cd5[_0x3df28d(0x1f8)](_0x308730,_0x414e2e['id']),_0x644561[_0x3df28d(0x1c1)][_0x3df28d(0x1f8)](_0x308730,_0x414e2e['id']),_0x509632[_0x3df28d(0x1eb)]?.({'type':_0x3df28d(0x1bb),'journeyName':_0x15ecca[_0x3df28d(0x18a)][_0x3df28d(0x265)],'activationName':_0x308730});}const _0x4134d3=JSON[_0x3df28d(0x193)](JSON[_0x3df28d(0x22c)](_0xf4c361));return _0x4134d3['id']=_0x19f135,ensureJourneyDefaults(_0x4134d3[_0x3df28d(0x1be)]),resolvePendingIdsInRequest(_0x4134d3,_0xf4c361,_0x2bd27f,_0xe264f8,_0x500cd5,_0x509632),await _0x516d40[_0x3df28d(0x25f)]['update'](_0x19f135,_0x4134d3),deletePushRecovery(_0x15ecca[_0x3df28d(0x21d)]),{'action':'created','journeyId':_0x19f135,'embeddedSegmentNameToId':_0xe264f8};}export function stripWaitStepPendingIds(_0x4f2400){const _0x5f2293=a140_0x408869,_0x47fd40=_0x4f2400[_0x5f2293(0x1a4)]&&isPendingSegmentId(_0x4f2400[_0x5f2293(0x1a4)]),_0x6b8b70=_0x4f2400['conditions']?.[_0x5f2293(0x25c)](_0x5e4dd8=>_0x5e4dd8['segmentId']&&isPendingSegmentId(_0x5e4dd8[_0x5f2293(0x1d4)]));(_0x47fd40||_0x6b8b70)&&(_0x4f2400[_0x5f2293(0x188)]=_0x5f2293(0x21a),_0x4f2400[_0x5f2293(0x27d)]=0x1,_0x4f2400[_0x5f2293(0x20f)]='day',delete _0x4f2400[_0x5f2293(0x1a4)],delete _0x4f2400['conditionTimeoutDuration'],delete _0x4f2400['conditionTimeoutUnit'],delete _0x4f2400[_0x5f2293(0x1e2)]);}export function resolveWaitStepPendingIds(_0x246975,_0x2f68c9,_0x2170de,_0x1db65e){const _0x23784f=a140_0x408869;if(_0x2f68c9[_0x23784f(0x1a4)]&&isPendingSegmentId(_0x2f68c9[_0x23784f(0x1a4)])){const _0x32ae1b=_0x2170de(_0x2f68c9[_0x23784f(0x1a4)],_0x23784f(0x252)+_0x1db65e+'\x27\x20wait\x20condition');_0x32ae1b&&(_0x246975['waitStepType']=_0x23784f(0x228),_0x246975[_0x23784f(0x1a4)]=_0x32ae1b,delete _0x246975[_0x23784f(0x27d)],delete _0x246975['waitStepUnit'],_0x2f68c9[_0x23784f(0x251)]!==undefined&&(_0x246975['conditionTimeoutDuration']=_0x2f68c9[_0x23784f(0x251)]),_0x2f68c9[_0x23784f(0x1f3)]&&(_0x246975[_0x23784f(0x1f3)]=_0x2f68c9[_0x23784f(0x1f3)]));}if(_0x2f68c9[_0x23784f(0x1e2)]){const _0x40c99c=_0x2f68c9[_0x23784f(0x1e2)][_0x23784f(0x25c)](_0xbad740=>_0xbad740['segmentId']&&isPendingSegmentId(_0xbad740[_0x23784f(0x1d4)]));if(_0x40c99c){const _0x42084f=_0x2f68c9[_0x23784f(0x1e2)][_0x23784f(0x268)](_0x1d79c5=>{const _0xf8132f=_0x23784f;if(_0x1d79c5[_0xf8132f(0x1d4)]&&isPendingSegmentId(_0x1d79c5[_0xf8132f(0x1d4)])){const _0x5f0d01=_0x2170de(_0x1d79c5['segmentId'],'stage\x20\x27'+_0x1db65e+'\x27\x20wait\x20condition');return{..._0x1d79c5,'segmentId':_0x5f0d01||_0x1d79c5[_0xf8132f(0x1d4)]};}return{..._0x1d79c5};});_0x246975[_0x23784f(0x188)]=_0x23784f(0x228),_0x246975['conditions']=_0x42084f,delete _0x246975[_0x23784f(0x27d)],delete _0x246975[_0x23784f(0x20f)],delete _0x246975[_0x23784f(0x1a4)],delete _0x246975[_0x23784f(0x251)],delete _0x246975[_0x23784f(0x1f3)];}}}function stripPendingIds(_0x3ecba5){const _0xa5609d=a140_0x408869;_0x3ecba5[_0xa5609d(0x1be)][_0xa5609d(0x1c9)]?.['segmentId']&&isPendingSegmentId(_0x3ecba5[_0xa5609d(0x1be)]['goal'][_0xa5609d(0x1d4)])&&delete _0x3ecba5[_0xa5609d(0x1be)][_0xa5609d(0x1c9)];for(const _0xb096 of _0x3ecba5[_0xa5609d(0x1be)][_0xa5609d(0x23f)]||[]){_0xb096[_0xa5609d(0x236)]?.[_0xa5609d(0x1d4)]&&isPendingSegmentId(_0xb096[_0xa5609d(0x236)][_0xa5609d(0x1d4)])&&delete _0xb096[_0xa5609d(0x236)];_0xb096[_0xa5609d(0x26c)]?.[_0xa5609d(0x1d4)]&&isPendingSegmentId(_0xb096[_0xa5609d(0x26c)]['segmentId'])&&delete _0xb096[_0xa5609d(0x26c)];_0xb096[_0xa5609d(0x264)]&&(_0xb096['exitCriterias']=_0xb096[_0xa5609d(0x264)][_0xa5609d(0x24c)](_0x1b95f3=>!_0x1b95f3[_0xa5609d(0x1d4)]||!isPendingSegmentId(_0x1b95f3['segmentId'])));if(_0xb096['steps'])for(const _0x291938 of Object['keys'](_0xb096[_0xa5609d(0x22e)])){const _0xca55c4=_0xb096[_0xa5609d(0x22e)][_0x291938];_0xca55c4[_0xa5609d(0x1ce)]==='Activation'&&_0xca55c4['journeyActivationStepId']&&isPendingActivationId(_0xca55c4[_0xa5609d(0x20d)])&&(_0xca55c4[_0xa5609d(0x20d)]='');if(_0xca55c4[_0xa5609d(0x1ce)]===_0xa5609d(0x244)&&_0xca55c4[_0xa5609d(0x262)])for(const _0x51f503 of _0xca55c4['branches']){_0x51f503[_0xa5609d(0x1d4)]&&isPendingSegmentId(_0x51f503[_0xa5609d(0x1d4)])&&(_0x51f503[_0xa5609d(0x1d4)]='');}_0xca55c4[_0xa5609d(0x1ce)]==='WaitStep'&&stripWaitStepPendingIds(_0xca55c4);}}}function resolvePendingIdsInRequest(_0x96d80b,_0x156990,_0x3b22b1,_0x493c50,_0x5e4ff9,_0x2a8465){const _0xa582bb=a140_0x408869,_0x5b8938=(_0x3047da,_0x5d77d5)=>{const _0x593dd1=a140_0x340f;if(!isPendingSegmentId(_0x3047da))return _0x3047da;const _0x6b540f=extractPendingSegmentName(_0x3047da),_0x4c548c=_0x493c50[_0x593dd1(0x1f1)](_0x6b540f);return!_0x4c548c&&_0x2a8465[_0x593dd1(0x201)]?.(_0x593dd1(0x1dc)+_0x6b540f+_0x593dd1(0x19a)+_0x5d77d5),_0x4c548c;};if(_0x96d80b[_0xa582bb(0x1be)][_0xa582bb(0x1c9)]?.['segmentId']&&isPendingSegmentId(_0x96d80b[_0xa582bb(0x1be)][_0xa582bb(0x1c9)]['segmentId'])){const _0x5c1aec=_0x5b8938(_0x96d80b[_0xa582bb(0x1be)][_0xa582bb(0x1c9)][_0xa582bb(0x1d4)],_0xa582bb(0x1e1));_0x5c1aec&&(_0x96d80b[_0xa582bb(0x1be)]['goal']['segmentId']=_0x5c1aec);}for(const _0x3637a9 of _0x96d80b[_0xa582bb(0x1be)][_0xa582bb(0x23f)]||[]){const _0x15ddf6=_0x3b22b1[_0xa582bb(0x1f1)](_0x3637a9[_0xa582bb(0x265)]['toLowerCase']());_0x15ddf6&&(_0x3637a9['id']=_0x15ddf6);if(_0x3637a9[_0xa582bb(0x236)]?.['segmentId']&&isPendingSegmentId(_0x3637a9[_0xa582bb(0x236)][_0xa582bb(0x1d4)])){const _0x3eab86=_0x5b8938(_0x3637a9[_0xa582bb(0x236)][_0xa582bb(0x1d4)],_0xa582bb(0x252)+_0x3637a9[_0xa582bb(0x265)]+'\x27\x20entry\x20criteria');_0x3eab86&&(_0x3637a9[_0xa582bb(0x236)][_0xa582bb(0x1d4)]=_0x3eab86);}if(_0x3637a9['exitCriterias'])for(const _0xb9e928 of _0x3637a9[_0xa582bb(0x264)]){if(_0xb9e928[_0xa582bb(0x1d4)]&&isPendingSegmentId(_0xb9e928[_0xa582bb(0x1d4)])){const _0x18f333=_0x5b8938(_0xb9e928[_0xa582bb(0x1d4)],_0xa582bb(0x252)+_0x3637a9[_0xa582bb(0x265)]+_0xa582bb(0x285));_0x18f333&&(_0xb9e928[_0xa582bb(0x1d4)]=_0x18f333);}}if(_0x3637a9[_0xa582bb(0x26c)]?.['segmentId']&&isPendingSegmentId(_0x3637a9[_0xa582bb(0x26c)]['segmentId'])){const _0x2f8d6e=_0x5b8938(_0x3637a9['milestone'][_0xa582bb(0x1d4)],'stage\x20\x27'+_0x3637a9['name']+'\x27\x20milestone');_0x2f8d6e&&(_0x3637a9[_0xa582bb(0x26c)][_0xa582bb(0x1d4)]=_0x2f8d6e);}if(_0x3637a9[_0xa582bb(0x22e)]){const _0x53d6f9=_0x2e0c2d=>_0x156990[_0xa582bb(0x1be)]['journeyStages']?.[_0xa582bb(0x270)](_0x1c58e1=>_0x1c58e1[_0xa582bb(0x265)][_0xa582bb(0x218)]()===_0x3637a9['name']['toLowerCase']())?.[_0xa582bb(0x22e)]?.[_0x2e0c2d];for(const _0x1a407c of Object[_0xa582bb(0x287)](_0x3637a9[_0xa582bb(0x22e)])){const _0x151848=_0x3637a9['steps'][_0x1a407c],_0x3e6843=_0x53d6f9(_0x1a407c);if(_0x151848[_0xa582bb(0x1ce)]===_0xa582bb(0x1b0)&&_0x151848[_0xa582bb(0x20d)]&&(isPendingActivationId(_0x151848[_0xa582bb(0x20d)])||_0x151848[_0xa582bb(0x20d)]==='')){if(_0x3e6843?.[_0xa582bb(0x20d)]&&isPendingActivationId(_0x3e6843[_0xa582bb(0x20d)])){const _0x38def3=extractPendingActivationName(_0x3e6843[_0xa582bb(0x20d)]),_0x57c868=_0x5e4ff9[_0xa582bb(0x1f1)](_0x38def3);_0x57c868&&(_0x151848['journeyActivationStepId']=_0x57c868);}}if(_0x151848[_0xa582bb(0x1ce)]==='DecisionPoint'&&_0x151848[_0xa582bb(0x262)]&&_0x3e6843?.[_0xa582bb(0x262)])for(let _0x19d50f=0x0;_0x19d50f<_0x151848[_0xa582bb(0x262)][_0xa582bb(0x280)];_0x19d50f++){const _0x475209=_0x151848['branches'][_0x19d50f],_0x1e4f4e=_0x3e6843[_0xa582bb(0x262)][_0x19d50f];if(_0x1e4f4e?.[_0xa582bb(0x1d4)]&&isPendingSegmentId(_0x1e4f4e[_0xa582bb(0x1d4)])){const _0x4d93e6=_0x5b8938(_0x1e4f4e[_0xa582bb(0x1d4)],_0xa582bb(0x252)+_0x3637a9[_0xa582bb(0x265)]+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x475209[_0xa582bb(0x265)]||_0x19d50f)+'\x27');_0x4d93e6&&(_0x475209[_0xa582bb(0x1d4)]=_0x4d93e6);}}_0x151848[_0xa582bb(0x1ce)]===_0xa582bb(0x1f6)&&_0x3e6843?.['type']===_0xa582bb(0x1f6)&&resolveWaitStepPendingIds(_0x151848,_0x3e6843,_0x5b8938,_0x3637a9[_0xa582bb(0x265)]);}}}}
1
+ const a140_0x1e27d0=a140_0x2637;(function(_0x3b9a32,_0x3d3f02){const _0x44520d=a140_0x2637,_0x3b5dbc=_0x3b9a32();while(!![]){try{const _0x40e9d5=parseInt(_0x44520d(0x16e))/0x1*(parseInt(_0x44520d(0x13b))/0x2)+parseInt(_0x44520d(0x11f))/0x3+-parseInt(_0x44520d(0x116))/0x4+-parseInt(_0x44520d(0x149))/0x5*(-parseInt(_0x44520d(0x11a))/0x6)+-parseInt(_0x44520d(0x17c))/0x7+-parseInt(_0x44520d(0xf6))/0x8+-parseInt(_0x44520d(0x9e))/0x9*(parseInt(_0x44520d(0xd6))/0xa);if(_0x40e9d5===_0x3d3f02)break;else _0x3b5dbc['push'](_0x3b5dbc['shift']());}catch(_0x34c776){_0x3b5dbc['push'](_0x3b5dbc['shift']());}}}(a140_0x413d,0xa3f48));import{createHash}from'crypto';function a140_0x413d(){const _0x50735f=['description','SEGMENT_SYNTAX_ERROR','rule','length','journeyId','goal\x20criteria','yamlActivation','existingSegment','sort','journeyStages','progress','folderId','logSuccess','3589656SSuRsl','connectionIdToNameMap','folderPath','\x0a\x20\x20','396rBCzqw','type','Journey\x20\x27','waitStepUnit','Embedded\x20segment\x20\x27','3687438ThMubD','getActivation','activationsBySegmentId','idToName','create','waitStep','parseDocument','toISOString','dirname','day','\x20activation\x20\x27','errors','debug','\x27\x20entry\x20criteria','entry_criteria','journey_updating','attributes','journeyById','Created\x20activation\x20\x27','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','JOURNEY_SYNTAX_ERROR','startsWith','diff','entryCriteria','milestone','decision_point','relationships','list','904wsLxfW','createActivation','Duration','hasChanges','resolveJourneyId','behavior','deleteSegment','embedded_segment_created','\x20journey\x20from\x20file:\x20','isNew','createJourneySegment','filter','deleteActivation','kind','47085bAsYAq','includes','ACTIVATION_UPDATE_ERROR','notification','INTERNAL',').\x20','createdSegmentIds','slice','trim','activationContext','createFolder','absolutePath','segment','updateActivation','activationParams','name','uniqueSegmentName','folder_creating','createdSegmentId','WaitStep','withProgress','\x20error(s)',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','updateSegmentById','journey','entries','existingJourney','journeyBundleId','segmentNameToId','):\x20','journeyBundleName','update','keys','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','user','nameToId','activations','2326KZfOSV','connector_config','activation_','uniqueServerName','updated','existingActivation','sha1','yamlConfig','onProgress','with','message','embeddedSegmentNameToId','data','journeyActivationStepId','5735744yTetZB','journey_updated','activation_deleted','Segment\x20not\x20found','./journey-yaml.js','get','Deleted\x20segment\x20\x27','run_after_journey_refresh','validatedRequest','localName','map','steps','some','journeyActivationNameToId','\x20(referenced\x20in\x20journey\x20','exitCriterias','segment_deleted','\x20segment\x20from\x20file:\x20','activation_updating','journey_created','values','logDeleted','max','parse','../../utils/async.js','Condition','join','size','./child-segment-yaml.js','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','getJourney','journeyBundlesByFolderAndName','journeys','\x27...','columns','conditionSegmentId','tdx.sdk.push-workflow','9LkBQjt','goal','valid','conditionTimeoutUnit','SEGMENT_UPDATE_ERROR','versionNumber','match','listActivations','stages','Failed\x20to\x20','DecisionPoint','embedded_segment_creating','deps','getLatestJourneyId','stage\x20\x27','Updating\x20activation\x20\x27','has','activation_created','Segment\x20not\x20found:\x20','\x27\x20milestone','Created\x20folder\x20\x27','item','digest','Failed\x20to\x20resolve\x20segment\x20','existingSegments','ACTIVATION_SYNTAX_ERROR','parentFolder','created','all','rootFolderId','all_columns','Activation','Deleting\x20activation\x20\x27','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','segment_updating','push','Fetching\x20','index','from','parentSegmentFolder','stringify','isArray','getSegmentEntity\x20also\x20failed\x20for\x20','\x27\x20from\x20file:\x20','conditionTimeoutDuration','resolveSegment','split','find','\x27\x20for\x20','parentId','folderPathToId','segmentFolderId','reduce','activationActions','idToEmailMap','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','1463570RfMhmj','delete','journey_creating','unchanged','Created\x20segment\x20\x27','replace','toString','fetchJourney','\x27\x20wait\x20condition','Updated\x20segment\x20\x27','relative','Deleted\x20activation\x20\x27','journey_entry_criteria_','\x27\x20to\x20local\x20\x27','activation_creating','Creating\x20folder\x20\x27','connection','segmentId','schedule','deleted','toLowerCase','\x27\x20by\x20rule\x20content','Entry\x20criteria:\x20','waitStepType','JOURNEY_UPDATE_ERROR','embedded_activation_created','__pending_act_','Updated\x20journey\x20\x27','action','entry','conditions','state','2938376CnhfRD','add','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','activation_deleting','utf-8','branches','createSegment','logInfo','segment_created','segment_updated','getSegment','verbose','segments','Stage\x20\x27','Created\x20journey\x20\x27','set','getSegmentEntity','segment_creating','\x20(referenced\x20in\x20embedded\x20segment\x20\x27'];a140_0x413d=function(){return _0x50735f;};return a140_0x413d();}import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a140_0x1e27d0(0x9d));export const PENDING_SEGMENT_PREFIX='__pending_';export const PENDING_ACTIVATION_PREFIX=a140_0x1e27d0(0xf0);export function createPendingSegmentId(_0x11121d){return''+PENDING_SEGMENT_PREFIX+_0x11121d+'__';}export function isPendingSegmentId(_0x14c2cb){const _0x3ad540=a140_0x1e27d0;return _0x14c2cb['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x14c2cb[_0x3ad540(0x134)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0xb9e6ed){const _0x200045=a140_0x1e27d0;return _0xb9e6ed[_0x200045(0xdb)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x1afa86){return''+PENDING_ACTIVATION_PREFIX+_0x1afa86+'__';}export function isPendingActivationId(_0x3cf6d4){const _0x46484e=a140_0x1e27d0;return _0x3cf6d4[_0x46484e(0x134)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x57a5ec){const _0x2d2afb=a140_0x1e27d0;return _0x57a5ec[_0x2d2afb(0xdb)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x365782,_0x3d072d){const _0x9d788f=a140_0x1e27d0,_0x21c080=_0x365782+'::'+(_0x3d072d[_0x9d788f(0x151)]()||_0x9d788f(0x155)),_0x71af8e=createHash(_0x9d788f(0x174))['update'](_0x21c080)[_0x9d788f(0xb4)]('hex')[_0x9d788f(0x150)](0x0,0xc);return _0x9d788f(0xe2)+_0x71af8e;}export function ensureJourneyDefaults(_0x26f4e2){const _0x52e2b5=a140_0x1e27d0;!_0x26f4e2[_0x52e2b5(0x109)]&&(_0x26f4e2[_0x52e2b5(0x109)]=''),!_0x26f4e2[_0x52e2b5(0xf5)]&&(_0x26f4e2[_0x52e2b5(0xf5)]='draft');}export function injectExistingStageIds(_0xfc8dee,_0x45b346){const _0x5fdbe2=a140_0x1e27d0,_0x217e8b=new Map(_0x45b346[_0x5fdbe2(0x83)](_0x5225a4=>[_0x5225a4['name'],_0x5225a4['id']]));for(const _0x166189 of _0xfc8dee){if(!_0x166189['id']){const _0x18da06=_0x217e8b[_0x5fdbe2(0x181)](_0x166189['name']);_0x18da06&&(_0x166189['id']=_0x18da06);}}}export function resolveTDFolderPath(_0x42ec65,_0x4cfd90,_0x37e6e7){const _0x4a9bfb=a140_0x1e27d0;if(!_0x4cfd90)return _0x42ec65;if(_0x42ec65===_0x37e6e7||_0x42ec65[_0x4a9bfb(0x134)](_0x37e6e7+'/'))return _0x42ec65;return _0x42ec65?_0x37e6e7+'/'+_0x42ec65:_0x37e6e7;}export function addFoldersToCreate(_0x42d47b,_0x4d213d,_0x2d2d2a){const _0x1a2c6d=a140_0x1e27d0;if(!_0x42d47b)return;if(_0x4d213d['has'](_0x42d47b))return;const _0x2711b6=_0x42d47b[_0x1a2c6d(0xcc)]('/');let _0x247358='';for(const _0x4773c1 of _0x2711b6){_0x247358=_0x247358?_0x247358+'/'+_0x4773c1:_0x4773c1,!_0x4d213d[_0x1a2c6d(0xae)](_0x247358)&&_0x2d2d2a[_0x1a2c6d(0xf7)](_0x247358);}}export function sortFoldersByDepth(_0x3618dc){const _0x30bbe6=a140_0x1e27d0;return[..._0x3618dc][_0x30bbe6(0x111)]((_0x1efb9f,_0x1db8ab)=>{const _0x2a1935=_0x30bbe6,_0x46a3f7=(_0x1efb9f[_0x2a1935(0xa4)](/\//g)||[])['length'],_0x13f6ba=(_0x1db8ab[_0x2a1935(0xa4)](/\//g)||[])[_0x2a1935(0x10c)];return _0x46a3f7-_0x13f6ba;});}import*as a140_0x177101 from'yaml';import{readFileSync}from'fs';import a140_0xcf90c5 from'path';import{isJourneyDef,parseYamlString as a140_0x1054b9,toYamlString as a140_0x32863a,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(_0x230a43){const _0x37cfc9=a140_0x1e27d0;if(Array[_0x37cfc9(0xc7)](_0x230a43))return'['+_0x230a43[_0x37cfc9(0x83)](_0x29ec55=>stableStringify(_0x29ec55))[_0x37cfc9(0x93)](',')+']';if(_0x230a43&&typeof _0x230a43==='object'){const _0x20942c=_0x230a43,_0x514814=Object[_0x37cfc9(0x169)](_0x20942c)[_0x37cfc9(0x111)](),_0x487792=_0x514814[_0x37cfc9(0x83)](_0x691ff1=>'\x22'+_0x691ff1+'\x22:'+stableStringify(_0x20942c[_0x691ff1]));return'{'+_0x487792[_0x37cfc9(0x93)](',')+'}';}const _0x393fcf=JSON[_0x37cfc9(0xc6)](_0x230a43);return _0x393fcf===undefined?'null':_0x393fcf;}function activationSignature(_0x3fda77){const _0x2aed78=a140_0x1e27d0,_0x17707f={'connection':_0x3fda77[_0x2aed78(0xe6)],..._0x3fda77[_0x2aed78(0xbc)]!==undefined&&{'all_columns':_0x3fda77[_0x2aed78(0xbc)]},..._0x3fda77[_0x2aed78(0x9b)]!==undefined&&{'columns':_0x3fda77['columns']},..._0x3fda77[_0x2aed78(0x140)]!==undefined&&{'behavior':_0x3fda77['behavior']},..._0x3fda77['schedule']!==undefined&&{'schedule':_0x3fda77[_0x2aed78(0xe8)]},..._0x3fda77[_0x2aed78(0x14c)]!==undefined&&{'notification':_0x3fda77['notification']},..._0x3fda77['connector_config']!==undefined&&{'connector_config':_0x3fda77[_0x2aed78(0x16f)]},..._0x3fda77['activation_template_id']!==undefined&&{'activation_template_id':_0x3fda77['activation_template_id']}};return stableStringify(_0x17707f);}async function fetchSegment(_0x1d4ae3,_0xee4d40,_0x536e82,_0x3347a5){const _0x26c367=a140_0x1e27d0,_0x57352e=_0x3347a5?.[_0x26c367(0xcd)](_0x27d1aa=>_0x27d1aa['id']===_0x536e82);if(_0x57352e)return _0x57352e;try{return await _0x1d4ae3[_0x26c367(0x155)][_0x26c367(0x100)](_0xee4d40,_0x536e82);}catch(_0x252ba7){logger[_0x26c367(0x12b)]('getSegment\x20failed\x20for\x20'+_0x536e82+_0x26c367(0x15f)+_0x252ba7);try{return await _0x1d4ae3[_0x26c367(0x155)][_0x26c367(0x106)](_0x536e82);}catch(_0x3379f5){return logger[_0x26c367(0x12b)](_0x26c367(0xc8)+_0x536e82+':\x20'+_0x3379f5),null;}}}function recoverSegmentIdsFromPushRecovery(_0x18096f,_0x28c846,_0x59fce3){const _0x26883c=a140_0x1e27d0,_0x102547=readPushRecovery(_0x18096f['absolutePath']);if(_0x102547?.['journeyName']===_0x18096f[_0x26883c(0x175)][_0x26883c(0x158)])for(const [_0x509b4f,_0xcb3c03]of Object[_0x26883c(0x162)](_0x102547['segments'])){const _0x165486=generateDeterministicJourneySegmentName(_0x18096f[_0x26883c(0x175)][_0x26883c(0x158)],_0x509b4f);_0xcb3c03[_0x26883c(0x171)]===_0x165486&&(_0x28c846[_0x26883c(0x105)](_0x509b4f,_0xcb3c03['segmentId']),_0x59fce3[_0x26883c(0x105)](_0x509b4f,_0xcb3c03[_0x26883c(0xe7)]));}}function a140_0x2637(_0x506120,_0x4b2f0f){_0x506120=_0x506120-0x7f;const _0x413dfa=a140_0x413d();let _0x2637f4=_0x413dfa[_0x506120];return _0x2637f4;}async function createOrRecoverEmbeddedSegment(_0x123628,_0x5cff95,_0x1b2873,_0x49f533){const _0xe43e9c=a140_0x1e27d0;let _0x2e872d;try{_0x2e872d=await _0x123628[_0xe43e9c(0x155)][_0xe43e9c(0x145)]({'name':_0x1b2873[_0xe43e9c(0x159)],'description':_0x1b2873[_0xe43e9c(0x109)],'journeyId':_0x1b2873[_0xe43e9c(0x10d)],'rule':_0x49f533(_0x1b2873['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0x1b2873[_0xe43e9c(0x114)],'audienceId':_0x1b2873[_0xe43e9c(0xcf)]});}catch(_0xc68460){const _0x1e01fd=_0xc68460 instanceof Error&&_0xc68460[_0xe43e9c(0x178)][_0xe43e9c(0x14a)]('Name\x20has\x20already\x20been\x20taken');if(_0x1e01fd){const _0x5aeb60=readPushRecovery(_0x5cff95[_0xe43e9c(0x154)]),_0x21ee96=_0x5aeb60?.['journeyName']===_0x5cff95[_0xe43e9c(0x175)][_0xe43e9c(0x158)]?_0x5aeb60[_0xe43e9c(0x102)][_0x1b2873[_0xe43e9c(0x82)]]:undefined;if(_0x21ee96?.[_0xe43e9c(0x171)]===_0x1b2873[_0xe43e9c(0x159)])await _0x123628[_0xe43e9c(0x155)][_0xe43e9c(0x160)](_0x1b2873[_0xe43e9c(0xcf)],_0x21ee96[_0xe43e9c(0xe7)],{'description':_0x1b2873['description'],'rule':_0x49f533(_0x1b2873['resolvedRule'],!![]),'countPopulation':!![]}),_0x2e872d=_0x21ee96[_0xe43e9c(0xe7)];else throw new SDKError(ErrorCode[_0xe43e9c(0xa2)],_0xe43e9c(0x11e)+_0x1b2873[_0xe43e9c(0x82)]+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x5cff95[_0xe43e9c(0x154)]['replace'](/([^/]+)$/,'.$1.push-recovery.json')+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0xc68460);}else throw _0xc68460;}return saveSegmentToPushRecovery(_0x5cff95[_0xe43e9c(0x154)],_0x5cff95[_0xe43e9c(0x175)][_0xe43e9c(0x158)],_0x1b2873['localName'],{'segmentId':_0x2e872d,'uniqueServerName':_0x1b2873['uniqueSegmentName'],'createdAt':new Date()['toISOString']()}),_0x2e872d;}export async function prepareSegmentFiles(_0x5393e2,_0x5d2904,_0xc86399,_0x5a955e,_0x1dc63a){const _0x277b58=a140_0x1e27d0,{activationDefToCreateRequest:_0xe30ed5}=await import(_0x277b58(0x95)),_0x1cd94f=[],_0x3d6fb7=new Set();for(const {yamlConfig:_0x461b50,folderPath:_0x3a62b2,sourcePath:_0xf3b462}of _0x5393e2){const _0x4cd1f3=resolveTDFolderPath(_0x3a62b2,_0x5a955e,_0x1dc63a),_0x33754d=_0x4cd1f3+':'+_0x461b50[_0x277b58(0x158)],_0xbcbe61=_0x5d2904['segmentByFolderAndName'][_0x277b58(0x181)](_0x33754d),_0x2fa084=_0xbcbe61?_0x5d2904[_0x277b58(0x121)][_0x277b58(0x181)](_0xbcbe61['id'])||[]:[];addFoldersToCreate(_0x4cd1f3,_0x5d2904[_0x277b58(0xd0)],_0x3d6fb7);const _0x12eb09=calculateActivationActions(_0x461b50['activations']||[],_0x2fa084,_0x5d2904[_0x277b58(0xd4)],_0x5d2904[_0x277b58(0x117)]);for(const _0xce6cc6 of _0x12eb09){(_0xce6cc6[_0x277b58(0x11b)]===_0x277b58(0x123)||_0xce6cc6[_0x277b58(0x11b)]==='update')&&_0xce6cc6[_0x277b58(0x10f)]&&(_0xce6cc6[_0x277b58(0x81)]=await _0xe30ed5(_0xce6cc6[_0x277b58(0x10f)],_0xc86399));}const _0x3f5a3c=calculateSegmentDiff(_0x461b50,_0xbcbe61,_0x2fa084,_0x5d2904[_0x277b58(0xd4)],_0x5d2904[_0x277b58(0x117)]);_0x1cd94f[_0x277b58(0xc1)]({'relativePath':_0x461b50[_0x277b58(0x158)],'absolutePath':_0xf3b462,'yamlConfig':_0x461b50,'folderPath':_0x4cd1f3,'existingSegment':_0xbcbe61,'existingActivations':_0x2fa084,'isNew':_0x3f5a3c[_0x277b58(0x144)],'hasChanges':_0x3f5a3c[_0x277b58(0x13e)],'diff':_0x3f5a3c['diff'],'activationActions':_0x12eb09});}return{'segmentFiles':_0x1cd94f,'foldersToCreate':_0x3d6fb7};}export async function prepareJourneyFiles(_0x4454a5,_0x2c23e2,_0x33a0e8,_0x3e61a3){const _0x20fc15=a140_0x1e27d0,_0x48424a=[],_0x298d36=new Set();for(const {yamlConfig:_0x195803,folderPath:_0x22aa2f,sourcePath:_0x6dea33}of _0x4454a5){const _0x346aee=resolveTDFolderPath(_0x22aa2f,_0x33a0e8,_0x3e61a3),_0x11277f=_0x346aee+':'+_0x195803[_0x20fc15(0x158)],_0x3f2ba8=_0x2c23e2[_0x20fc15(0x98)]['get'](_0x11277f);let _0x491654,_0xa59414;if(_0x3f2ba8&&_0x3f2ba8['length']>0x0){const _0x3055d3=buildLocalExpandedRuleMappings(_0x195803),{createYamlContext:_0x165528,prefetchJourneySegments:_0x32da61}=createPushYamlContextForBundle(_0x2c23e2[_0x20fc15(0xaa)],_0x2c23e2[_0x20fc15(0xcf)],_0x2c23e2[_0x20fc15(0xb6)],_0x3055d3,_0x2c23e2['idToEmailMap'],_0x2c23e2[_0x20fc15(0x117)],_0x2c23e2['activationStepsById'],_0x2c23e2[_0x20fc15(0x130)]);await _0x32da61(_0x3f2ba8[_0x20fc15(0x83)](_0xb0a229=>_0xb0a229['id']));const _0x5a0a5e=await _0x2c23e2['deps']['journey'][_0x20fc15(0xab)](_0x3f2ba8[0x0][_0x20fc15(0x164)]),_0x233f32=hasMultipleVersions(_0x195803),_0x253e6a=async _0x1fa603=>{const _0x244cf5=_0x20fc15,_0x9db9ba=_0x2c23e2[_0x244cf5(0x130)]?.[_0x244cf5(0x181)](_0x1fa603);if(_0x9db9ba)return _0x9db9ba;return _0x2c23e2[_0x244cf5(0xdd)]({'journeyId':_0x1fa603,'journeyName':_0x195803[_0x244cf5(0x158)],'isMultiVersion':_0x3f2ba8[_0x244cf5(0x10c)]>0x1});};if(_0x233f32&&_0x3f2ba8['length']>0x1){const _0xda85ef=[];for(const _0x5d6009 of _0x3f2ba8){const _0x42678f=_0x5d6009['versionNumber']||0x1;_0x2c23e2[_0x20fc15(0x113)]?.[_0x20fc15(0x168)](_0x20fc15(0xc2)+_0x195803[_0x20fc15(0x158)]+'\x20v'+_0x42678f);const _0x1f702b=await _0x253e6a(_0x5d6009['id']),_0xcbbe03=_0x165528(_0x5d6009['id']),_0x2f38d1=await journeyResponseToDef(_0x1f702b,_0xcbbe03);_0xda85ef[_0x20fc15(0xc1)]({'item':_0x5d6009,'yaml':_0x2f38d1});}const _0x2f9ab2=buildLocalRuleToNameMappingFromJourney(_0x195803);_0xa59414=buildMergedJourneyDef(_0xda85ef,_0x2f9ab2,_0x5a0a5e);const _0x12211a=Math['max'](..._0xda85ef[_0x20fc15(0x83)](_0x3a48f4=>_0x3a48f4[_0x20fc15(0xb3)][_0x20fc15(0xa3)]||0x0)),_0x3b1f83=_0x3f2ba8[_0x20fc15(0xcd)](_0x4a8529=>(_0x4a8529['versionNumber']||0x0)===_0x12211a);_0x3b1f83&&(_0x2c23e2[_0x20fc15(0x113)]?.[_0x20fc15(0x168)](_0x20fc15(0xc2)+_0x195803[_0x20fc15(0x158)]+'\x20v'+_0x12211a),_0x491654=await _0x253e6a(_0x3b1f83['id']));}else{const _0x39bcc2=_0x3f2ba8[_0x3f2ba8[_0x20fc15(0x10c)]-0x1];_0x2c23e2['progress']?.['update'](_0x20fc15(0xc2)+_0x195803[_0x20fc15(0x158)]),_0x491654=await _0x253e6a(_0x39bcc2['id']);const _0x45f2bd=_0x165528(_0x39bcc2['id']),_0x57d3e0=await journeyResponseToDef(_0x491654,_0x45f2bd),_0x517745=buildLocalRuleToNameMappingFromJourney(_0x195803);_0xa59414=buildMergedJourneyDef([{'item':_0x39bcc2,'yaml':_0x57d3e0}],_0x517745,_0x5a0a5e);}}addFoldersToCreate(_0x346aee,_0x2c23e2[_0x20fc15(0xd0)],_0x298d36);const _0x2be7c6=calculateJourneyDiff(_0x195803,_0xa59414);_0x48424a[_0x20fc15(0xc1)]({'relativePath':_0x195803['name'],'absolutePath':_0x6dea33,'yamlConfig':_0x195803,'folderPath':_0x346aee,'existingJourney':_0x491654,'isNew':_0x2be7c6[_0x20fc15(0x144)],'hasChanges':_0x2be7c6['hasChanges'],'diff':_0x2be7c6[_0x20fc15(0x135)]});}return{'journeyFiles':_0x48424a,'foldersToCreate':_0x298d36};}export function calculateActivationActions(_0x136672,_0x1e08ba,_0x3de4b1,_0x3eb633){const _0x351cc9=a140_0x1e27d0,_0x7df849=[],_0x9c1deb=new Map();for(const _0x5a1e91 of _0x1e08ba){_0x9c1deb[_0x351cc9(0x105)](_0x5a1e91[_0x351cc9(0x158)],_0x5a1e91);}const _0x51826d=new Map();for(const _0x45ed0e of _0x136672){_0x51826d[_0x351cc9(0x105)](_0x45ed0e[_0x351cc9(0x158)],_0x45ed0e);}for(const _0x2afb18 of _0x136672){const _0x59cd11=_0x9c1deb[_0x351cc9(0x181)](_0x2afb18[_0x351cc9(0x158)]);if(!_0x59cd11)_0x7df849[_0x351cc9(0xc1)]({'type':'create','name':_0x2afb18['name'],'yamlActivation':_0x2afb18});else{const _0x4816f7=activationResponseToDef(_0x59cd11,_0x3de4b1,_0x3eb633),_0x28981a=a140_0x177101[_0x351cc9(0xc6)](_0x4816f7),_0x43e7b2=a140_0x177101['stringify'](_0x2afb18);_0x28981a!==_0x43e7b2&&_0x7df849[_0x351cc9(0xc1)]({'type':_0x351cc9(0x168),'name':_0x2afb18['name'],'yamlActivation':_0x2afb18,'existingActivation':_0x59cd11});}}for(const _0x246120 of _0x1e08ba){!_0x51826d[_0x351cc9(0xae)](_0x246120[_0x351cc9(0x158)])&&_0x7df849[_0x351cc9(0xc1)]({'type':_0x351cc9(0xd7),'name':_0x246120[_0x351cc9(0x158)],'existingActivation':_0x246120});}return _0x7df849;}function calculateYamlDiff(_0x58dc58,_0x17e03d){if(_0x17e03d){const _0x5a0792=generateDiff(_0x17e03d,_0x58dc58),_0x5e9cb3=hasChanges(_0x5a0792);return{'isNew':![],'hasChanges':_0x5e9cb3,'diff':_0x5e9cb3?formatDiffWithColors(_0x5a0792):undefined};}const _0x6b2e0a=generateDiff('',_0x58dc58);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x6b2e0a)};}export function calculateSegmentDiff(_0x4e6797,_0x512bea,_0x41a07b,_0x4c86ad,_0xce6e24){const _0x2ac270=segmentToYamlString(_0x4e6797),_0x5b930e=_0x512bea?segmentToYamlString(segmentWithActivationsToYaml(_0x512bea,_0x41a07b,undefined,_0x4c86ad,_0xce6e24)):undefined;return calculateYamlDiff(_0x2ac270,_0x5b930e);}export function calculateJourneyDiff(_0x1b8539,_0x24a133){const _0x4583c8=normalizeJourneyDef(_0x1b8539,_0x1b8539),_0x45bf6f=a140_0x32863a(_0x4583c8),_0x5ce190=_0x24a133?a140_0x32863a(normalizeJourneyDef(_0x24a133,_0x1b8539)):undefined;return calculateYamlDiff(_0x45bf6f,_0x5ce190);}export function findSegmentsToDelete(_0x1db03f,_0x2c8831,_0x291fd2,_0x329dac,_0x27a484){const _0x2b22ca=a140_0x1e27d0,_0x858b16=new Set();for(const {yamlConfig:_0x413d9f,folderPath:_0x12f997}of _0x2c8831){_0x858b16[_0x2b22ca(0xf7)](_0x12f997+':'+_0x413d9f[_0x2b22ca(0x158)]);}return _0x1db03f[_0x2b22ca(0x146)](_0x1afdc5=>{const _0x5dc60e=_0x2b22ca,_0x48e5b6=_0x1afdc5[_0x5dc60e(0xd1)]?_0x291fd2[_0x5dc60e(0x181)](_0x1afdc5[_0x5dc60e(0xd1)][_0x5dc60e(0xdc)]())||'':'',_0x3034c3=_0x48e5b6+':'+_0x1afdc5['name'];if(_0x858b16['has'](_0x3034c3))return![];if(_0x27a484)return _0x48e5b6===_0x329dac||_0x48e5b6[_0x5dc60e(0x134)](_0x329dac+'/');return!![];});}export function findJourneysToDelete(_0x6c8b6e,_0x1e98a7,_0x569f9d,_0x3144da,_0x362c9e){const _0xa9ffd2=a140_0x1e27d0,_0x248f12=new Set();for(const {yamlConfig:_0x2c20d1,folderPath:_0x2af109}of _0x1e98a7){_0x248f12[_0xa9ffd2(0xf7)](_0x2af109+':'+_0x2c20d1[_0xa9ffd2(0x158)]);}return _0x6c8b6e[_0xa9ffd2(0x146)](_0x5e149a=>{const _0x498099=_0xa9ffd2,_0x3f813f=_0x5e149a['folderId']?_0x569f9d[_0x498099(0x181)](_0x5e149a['folderId'])||'':'',_0x4ee2b6=_0x3f813f+':'+_0x5e149a[_0x498099(0x167)];if(_0x248f12[_0x498099(0xae)](_0x4ee2b6))return![];if(_0x362c9e)return _0x3f813f===_0x3144da||_0x3f813f[_0x498099(0x134)](_0x3144da+'/');return!![];});}export function buildSegmentLookupMap(_0xbfd15f,_0x2e0ac2){const _0x41abc4=a140_0x1e27d0,_0x128ed5=new Map();for(const _0x2c26dc of _0xbfd15f){const _0x2956c7=_0x2c26dc[_0x41abc4(0xd1)]?_0x2e0ac2[_0x41abc4(0x181)](_0x2c26dc[_0x41abc4(0xd1)][_0x41abc4(0xdc)]())||'':'',_0x2e6148=_0x2956c7+':'+_0x2c26dc[_0x41abc4(0x158)];_0x128ed5[_0x41abc4(0x105)](_0x2e6148,_0x2c26dc);}return _0x128ed5;}export function buildSegmentNameToIdMap(_0x3a2f18){const _0x364837=a140_0x1e27d0,_0x47763b=new Map();for(const _0x579e4a of _0x3a2f18){_0x47763b[_0x364837(0x105)](_0x579e4a[_0x364837(0x158)],_0x579e4a['id']);}return _0x47763b;}export function buildJourneyBundleLookupMap(_0x16bc23,_0x468a34){const _0x1f7502=a140_0x1e27d0,_0x2d9366=new Map();for(const _0x32751c of _0x16bc23){const _0x132f99=_0x32751c[_0x1f7502(0x114)]?_0x468a34[_0x1f7502(0x181)](_0x32751c[_0x1f7502(0x114)])||'':'',_0x5c2005=_0x132f99+':'+_0x32751c[_0x1f7502(0x167)];!_0x2d9366['has'](_0x5c2005)&&_0x2d9366[_0x1f7502(0x105)](_0x5c2005,[]),_0x2d9366[_0x1f7502(0x181)](_0x5c2005)[_0x1f7502(0xc1)](_0x32751c);}for(const _0x4a9d63 of _0x2d9366[_0x1f7502(0x8d)]()){_0x4a9d63[_0x1f7502(0x111)]((_0x33303d,_0x29a1d9)=>(_0x33303d[_0x1f7502(0xa3)]||0x0)-(_0x29a1d9['versionNumber']||0x0));}return _0x2d9366;}export function collectFoldersToCreate(_0x6d2660,_0x1dd2f5){const _0x39536f=a140_0x1e27d0,_0x227d9e=new Set();for(const _0x2a664e of _0x6d2660){if(!_0x2a664e)continue;if(_0x1dd2f5[_0x39536f(0xae)](_0x2a664e))continue;const _0x2be5fe=_0x2a664e[_0x39536f(0xcc)]('/');let _0x363cbc='';for(const _0x524dd5 of _0x2be5fe){_0x363cbc=_0x363cbc?_0x363cbc+'/'+_0x524dd5:_0x524dd5,!_0x1dd2f5['has'](_0x363cbc)&&_0x227d9e[_0x39536f(0xf7)](_0x363cbc);}}return _0x227d9e;}export function parseAndClassifyYamlFiles(_0x5d926f,_0x15a61b,_0x449d57){const _0x1ec630=a140_0x1e27d0,_0x26102b=[],_0x448d5c=[];for(const _0x14baea of _0x5d926f){const _0x5e77fc=a140_0xcf90c5[_0x1ec630(0xe0)](_0x15a61b,a140_0xcf90c5[_0x1ec630(0x127)](_0x14baea)),_0x164a2a=_0x5e77fc==='.'?'':_0x5e77fc,_0x2006d2=readFileSync(_0x14baea,_0x1ec630(0xfa)),_0x5132e2=a140_0x177101[_0x1ec630(0x90)](_0x2006d2);if(isJourneyDef(_0x5132e2)){const _0xc1724a=a140_0x1054b9(_0x2006d2);_0x448d5c[_0x1ec630(0xc1)]({'yamlConfig':_0xc1724a,'folderPath':_0x164a2a,'sourcePath':_0x14baea});}else{if(!_0x449d57?.['skipSegments']){const _0x12c883=parseSegmentYamlFile(_0x2006d2),_0x1aa72a=normalizeChildSegmentYaml(_0x12c883);_0x26102b[_0x1ec630(0xc1)]({'yamlConfig':_0x1aa72a,'folderPath':_0x164a2a,'sourcePath':_0x14baea});}}}return{'segments':_0x26102b,'journeys':_0x448d5c};}export function validateParsedFiles(_0x21ac70,_0x49a7fe){const _0x2e3185=a140_0x1e27d0,_0x589d88=[];for(const {yamlConfig:_0x35cc08,sourcePath:_0x3e0647}of _0x21ac70['segments']){const _0x18b877=readFileSync(_0x3e0647,_0x2e3185(0xfa)),_0x39ed93=a140_0x177101[_0x2e3185(0x125)](_0x18b877),_0xe9c4ca=validateSegmentDef(_0x35cc08,{'source':_0x18b877,'document':_0x39ed93},{'skipSchema':!![]});if(!_0xe9c4ca['valid']){const _0x2d5f1c=a140_0xcf90c5[_0x2e3185(0xe0)](_0x49a7fe,_0x3e0647);_0x589d88[_0x2e3185(0xc1)]({'filePath':_0x2d5f1c,'source':_0x18b877,'result':_0xe9c4ca,'isJourney':![]});}}for(const {yamlConfig:_0x3ab1cc,sourcePath:_0x4ab183}of _0x21ac70[_0x2e3185(0x99)]){const _0x253d42=readFileSync(_0x4ab183,_0x2e3185(0xfa)),_0x11602b=a140_0x177101[_0x2e3185(0x125)](_0x253d42),_0x5800cd=validateJourneyDef(_0x3ab1cc,{'source':_0x253d42,'document':_0x11602b},{'skipSchema':!![]});if(!_0x5800cd[_0x2e3185(0xa0)]){const _0x53696f=a140_0xcf90c5[_0x2e3185(0xe0)](_0x49a7fe,_0x4ab183);_0x589d88[_0x2e3185(0xc1)]({'filePath':_0x53696f,'source':_0x253d42,'result':_0x5800cd,'isJourney':!![]});}}return _0x589d88;}export function formatValidationErrors(_0x3dd83f){const _0x404efc=a140_0x1e27d0,_0x2d2d18=[];for(const {filePath:_0x5b56f2,source:_0x21c738,result:_0x963b95,isJourney:_0x2a2492}of _0x3dd83f){const _0x5b5e0b=_0x2a2492?_0x404efc(0x161):_0x404efc(0x155);_0x2d2d18[_0x404efc(0xc1)]('\x0a'+_0x5b56f2+'\x20('+_0x5b5e0b+_0x404efc(0x166)+_0x963b95[_0x404efc(0x12a)][_0x404efc(0x10c)]+_0x404efc(0x15e)),_0x2d2d18[_0x404efc(0xc1)](formatValidationResult(_0x963b95,_0x21c738,_0x5b56f2));}return _0x2d2d18[_0x404efc(0x93)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x1c4d66){const _0x336ae9=a140_0x1e27d0,_0x100853=new Set(),_0x2d6b37=new Map(),_0x13ab8e=collectSegmentUsageCounts(_0x1c4d66);if(_0x1c4d66['segments'])for(const [_0xd52d79,_0x4b867e]of Object[_0x336ae9(0x162)](_0x1c4d66['segments'])){_0x100853['add'](_0xd52d79);if(_0x4b867e[_0x336ae9(0x10b)]){const _0x3cde2a=yamlRuleToApi(_0x4b867e['rule']),_0x2dd6d4=apiRuleToYaml(_0x3cde2a);_0x2d6b37[_0x336ae9(0x105)](_0xd52d79,_0x2dd6d4);}}const _0x38531b=new Map();let _0x3533d0=0x0;for(const [_0x29e6ba,_0x8d8e02]of _0x2d6b37){const _0x5185a8=serializeExpandedRule(_0x8d8e02,_0x2d6b37),_0x3f3683=_0x38531b[_0x336ae9(0x181)](_0x5185a8)||[];_0x3f3683[_0x336ae9(0xc1)]({'name':_0x29e6ba,'index':_0x3533d0}),_0x38531b[_0x336ae9(0x105)](_0x5185a8,_0x3f3683),_0x3533d0++;}const _0x42f36d=new Map();for(const [_0x44f082,_0x2ca89e]of _0x38531b){const _0x1926f3=_0x2ca89e[_0x336ae9(0x150)]()[_0x336ae9(0x111)]((_0x5419a5,_0x11a153)=>{const _0x1cd9fb=_0x336ae9,_0x5c6283=_0x13ab8e[_0x1cd9fb(0x181)](_0x5419a5[_0x1cd9fb(0x158)])||0x0,_0x2f9e74=_0x13ab8e[_0x1cd9fb(0x181)](_0x11a153[_0x1cd9fb(0x158)])||0x0;if(_0x5c6283!==_0x2f9e74)return _0x2f9e74-_0x5c6283;return _0x5419a5[_0x1cd9fb(0xc3)]-_0x11a153[_0x1cd9fb(0xc3)];})[_0x336ae9(0x83)](_0x3c8713=>_0x3c8713[_0x336ae9(0x158)]),_0x5b7fb0=[];for(const _0xa1ce75 of _0x1926f3){const _0x143bf6=_0x13ab8e[_0x336ae9(0x181)](_0xa1ce75)||0x0,_0x56baa2=Math[_0x336ae9(0x8f)](_0x143bf6,0x1);for(let _0x4e4d55=0x0;_0x4e4d55<_0x56baa2;_0x4e4d55++){_0x5b7fb0[_0x336ae9(0xc1)](_0xa1ce75);}}_0x42f36d[_0x336ae9(0x105)](_0x44f082,_0x5b7fb0);}return{'existingLocalSegmentNames':_0x100853,'localSegmentRules':_0x2d6b37,'localExpandedRuleToNames':_0x42f36d};}export function createSegmentIdResolver(_0x98373c,_0x1424d6){return async _0x24491c=>{const _0x478135=a140_0x2637,_0x52b643=_0x98373c[_0x478135(0x181)](_0x24491c);if(!_0x52b643)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x478135(0xb0)+_0x24491c+_0x478135(0x108)+_0x1424d6+'\x27)');return _0x52b643;};}export function extractRootFolderId(_0x516710){const _0x4c1e64=a140_0x1e27d0;return _0x516710['relationships']?.[_0x4c1e64(0xc5)]?.['data']?.['id']||_0x516710[_0x4c1e64(0x139)]?.[_0x4c1e64(0xb8)]?.['data']?.['id'];}export function buildConnectionMaps(_0x4057b5){const _0x4c95bb=a140_0x1e27d0,_0x3c8d0f=new Map(),_0xd4565=new Map(),_0x2f7b1d=new Map();for(const _0x2e8f4d of _0x4057b5){_0x3c8d0f['set'](_0x2e8f4d[_0x4c95bb(0x158)],parseInt(_0x2e8f4d['id'],0xa)),_0xd4565[_0x4c95bb(0x105)](_0x2e8f4d['id'],_0x2e8f4d[_0x4c95bb(0x158)]),_0x2f7b1d[_0x4c95bb(0x105)](_0x2e8f4d[_0x4c95bb(0x158)],_0x2e8f4d['type']);}return{'nameToId':_0x3c8d0f,'idToName':_0xd4565,'nameToType':_0x2f7b1d};}export function calculatePushStats(_0xaf87a6,_0x148261,_0x38eaae,_0x14032a,_0x9de5c3,_0x296750,_0x21eaa9){const _0x2eef8a=a140_0x1e27d0,_0x5bbb3c=_0xaf87a6[_0x2eef8a(0x146)](_0x4cfed5=>_0x4cfed5[_0x2eef8a(0x144)]),_0x687e56=_0xaf87a6[_0x2eef8a(0x146)](_0x119f06=>!_0x119f06[_0x2eef8a(0x144)]&&_0x119f06['hasChanges']),_0x4f8acc=_0xaf87a6[_0x2eef8a(0x146)](_0x52f85b=>!_0x52f85b['isNew']&&!_0x52f85b[_0x2eef8a(0x13e)]),_0x301907=_0x296750?_0x14032a:[],_0x8621d9=_0x148261[_0x2eef8a(0x146)](_0x4b07c7=>_0x4b07c7['isNew']),_0x3fb4ef=_0x148261[_0x2eef8a(0x146)](_0x51d96d=>!_0x51d96d[_0x2eef8a(0x144)]&&_0x51d96d[_0x2eef8a(0x13e)]),_0x2b33a2=_0x148261['filter'](_0x26fc40=>!_0x26fc40[_0x2eef8a(0x144)]&&!_0x26fc40[_0x2eef8a(0x13e)]),_0x162bda=_0x296750?_0x9de5c3:[],_0xfd846=_0xaf87a6['flatMap'](_0x5d8031=>_0x5d8031[_0x2eef8a(0xd3)]),_0x347348=_0xfd846[_0x2eef8a(0x146)](_0x364d71=>_0x364d71['type']===_0x2eef8a(0x123)),_0x428c4c=_0xfd846[_0x2eef8a(0x146)](_0x2c6c3e=>_0x2c6c3e[_0x2eef8a(0x11b)]===_0x2eef8a(0x168)),_0x441914=_0xfd846[_0x2eef8a(0x146)](_0x59dcdc=>_0x59dcdc[_0x2eef8a(0x11b)]===_0x2eef8a(0xd7)),_0x5706bc=Array['from'](_0x38eaae)['sort'](),_0x2974c8=_0x21eaa9?![]:_0x5bbb3c[_0x2eef8a(0x10c)]>0x0||_0x687e56[_0x2eef8a(0x10c)]>0x0||_0x301907['length']>0x0,_0x8cdc50=_0x8621d9[_0x2eef8a(0x10c)]>0x0||_0x3fb4ef['length']>0x0||_0x162bda['length']>0x0,_0x1e67d9=_0x21eaa9?![]:_0xfd846[_0x2eef8a(0x10c)]>0x0,_0x6f24a2=_0x5706bc[_0x2eef8a(0x10c)]>0x0;return{'segments':{'new':_0x5bbb3c,'changed':_0x687e56,'unchanged':_0x4f8acc,'toDelete':_0x301907},'journeys':{'new':_0x8621d9,'changed':_0x3fb4ef,'unchanged':_0x2b33a2,'toDelete':_0x162bda},'activations':{'all':_0xfd846,'toCreate':_0x347348,'toUpdate':_0x428c4c,'toDelete':_0x441914},'folders':{'toCreate':_0x5706bc},'counts':{'segments':{'new':_0x5bbb3c[_0x2eef8a(0x10c)],'changed':_0x687e56[_0x2eef8a(0x10c)],'unchanged':_0x4f8acc['length'],'toDelete':_0x301907[_0x2eef8a(0x10c)]},'journeys':{'new':_0x8621d9[_0x2eef8a(0x10c)],'changed':_0x3fb4ef[_0x2eef8a(0x10c)],'unchanged':_0x2b33a2[_0x2eef8a(0x10c)],'toDelete':_0x162bda[_0x2eef8a(0x10c)]},'activations':{'create':_0x347348[_0x2eef8a(0x10c)],'update':_0x428c4c[_0x2eef8a(0x10c)],'delete':_0x441914[_0x2eef8a(0x10c)]},'folders':_0x5706bc['length']},'hasChanges':_0x2974c8||_0x8cdc50||_0x1e67d9||_0x6f24a2};}export async function buildPushExecutionContext(_0x4c7ee0,_0x308ce7,_0x4b92f2,_0x4a0b0e,_0x193ed0,_0x5186fe){const _0x12faa1=a140_0x1e27d0,_0x2e76ec=extractRootFolderId(_0x4b92f2),{pathToId:_0x4e98cb,idToPath:_0x4707c6}=buildFolderMaps(_0x193ed0),_0xd3331c=buildSegmentNameToIdMap(_0x4a0b0e),_0xf2f498=new Map(),{batchAsync:_0x35aeb1}=await import(_0x12faa1(0x91)),[_0x32ffc5,_0x5d5691]=await Promise[_0x12faa1(0xba)]([_0x4c7ee0[_0x12faa1(0x16b)]['buildUserMaps'](),_0x4c7ee0['connection'][_0x12faa1(0x13a)](),((async()=>{!_0x5186fe&&_0x4a0b0e['length']>0x0&&await _0x35aeb1(_0x4a0b0e,async _0x29915c=>{const _0x4db839=a140_0x2637,_0xdbcf2d=await _0x4c7ee0[_0x4db839(0x155)]['listActivations'](_0x308ce7,_0x29915c['id']);_0xf2f498[_0x4db839(0x105)](_0x29915c['id'],_0xdbcf2d);});})())]),{emailToId:_0x2cdedf,idToEmail:_0x2bd7b4}=_0x32ffc5,_0xee4e6=buildConnectionMaps(_0x5d5691);return{'rootFolderId':_0x2e76ec,'folderPathToId':_0x4e98cb,'folderIdToPath':_0x4707c6,'segmentNameToId':_0xd3331c,'activationsBySegmentId':_0xf2f498,'emailToIdMap':_0x2cdedf,'idToEmailMap':_0x2bd7b4,'connectionNameToIdMap':_0xee4e6[_0x12faa1(0x16c)],'connectionIdToNameMap':_0xee4e6[_0x12faa1(0x122)],'connectionNameToTypeMap':_0xee4e6['nameToType']};}export function createPushYamlContextForBundle(_0x19889c,_0x4cf477,_0x439ef6,_0x3e4ae8,_0x7fa0d0,_0x424d39,_0x5bc38a,_0x38d9f8){const {existingLocalSegmentNames:_0x5b91d1,localExpandedRuleToNames:_0x19ffec}=_0x3e4ae8,_0x11aa04=new Set(),_0x10e34d=new Map(),_0x52569f=new Map(),_0x326c48=new Map(),_0x2f5c45=createJumpTargetCache(),_0x1790d2=new Map(),_0x5a060c=new Map(),_0xc1fd41=new Set();let _0x24243c;const _0x295ffb=_0x148a2a=>{const _0xdcb491={'resolveSegment':async _0x4ab511=>{const _0x5166fc=a140_0x2637,_0x5b0629=_0x326c48[_0x5166fc(0x181)](_0x4ab511);if(_0x5b0629!==undefined)return{'name':_0x5b0629,'isJourneyLocal':!![]};try{const _0x557aec=await fetchSegment(_0x19889c,_0x4cf477,_0x4ab511,_0x439ef6);if(!_0x557aec)throw new Error(_0x5166fc(0x17f));const _0x34e219=generateJourneyLocalName(_0x557aec[_0x5166fc(0x158)]),_0x439704=_0x557aec[_0x5166fc(0x148)]===SEGMENT_KIND_JOURNEY&&_0x34e219!==undefined;let _0x1939fe=_0x557aec['name'],_0x2e3a7b;if(_0x439704&&_0x557aec['rule']){const _0xf54324=apiRuleToYaml(_0x557aec['rule']);_0x5a060c['set'](_0x4ab511,_0xf54324);const _0x9a99bc=async _0x25cc53=>{const _0x58eea9=_0x5166fc,_0x547d37=collectSegmentRefsFromRule(_0x25cc53);for(const _0x119d03 of _0x547d37){if(!_0x5a060c[_0x58eea9(0xae)](_0x119d03))try{const _0x472cec=await fetchSegment(_0x19889c,_0x4cf477,_0x119d03,_0x439ef6);if(_0x472cec?.['rule']){const _0x4cbcf5=apiRuleToYaml(_0x472cec[_0x58eea9(0x10b)]);_0x5a060c[_0x58eea9(0x105)](_0x119d03,_0x4cbcf5),await _0x9a99bc(_0x4cbcf5);}}catch(_0x3e74c2){logger[_0x58eea9(0x12b)]('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0x119d03+':\x20'+_0x3e74c2);}}};await _0x9a99bc(_0xf54324);const _0xffa08c=serializeExpandedRule(_0xf54324,_0x5a060c),_0xe2bcf=_0x19ffec[_0x5166fc(0x181)](_0xffa08c);if(_0xe2bcf&&_0xe2bcf[_0x5166fc(0x10c)]>0x0){const _0x3c8e21=_0x10e34d[_0x5166fc(0x181)](_0xffa08c)||0x0,_0x391abc=_0xe2bcf[_0x3c8e21]||_0xe2bcf[_0xe2bcf['length']-0x1];_0x10e34d['set'](_0xffa08c,_0x3c8e21+0x1),_0x1939fe=_0x391abc,_0x11aa04[_0x5166fc(0xf7)](_0x1939fe),_0x326c48[_0x5166fc(0x105)](_0x4ab511,_0x1939fe);const _0x4bd885=await resolveRuleSegmentRefs(_0xf54324,async _0x2512c2=>{const _0x3ac16f=_0x5166fc,_0x195eb2=_0x326c48['get'](_0x2512c2);if(_0x195eb2)return _0x195eb2;const _0x15a3c2=await _0x24243c[_0x3ac16f(0xcb)](_0x2512c2);return _0x15a3c2['name'];});_0x2e3a7b={'description':_0x557aec[_0x5166fc(0x109)],'rule':_0x4bd885};}else{const _0x37da45=_0x1790d2[_0x5166fc(0x181)](_0xffa08c);if(_0x37da45)_0x1939fe=_0x37da45,_0x326c48[_0x5166fc(0x105)](_0x4ab511,_0x1939fe);else{if(_0x34e219){let _0x4d1a5e=_0x34e219,_0x159737=0x2;while(_0x11aa04[_0x5166fc(0xae)](_0x4d1a5e)||_0x5b91d1[_0x5166fc(0xae)](_0x4d1a5e)){_0x4d1a5e=_0x34e219+'_'+_0x159737,_0x159737++;}_0x11aa04[_0x5166fc(0xf7)](_0x4d1a5e),_0x1939fe=_0x4d1a5e;}_0x326c48[_0x5166fc(0x105)](_0x4ab511,_0x1939fe),_0x1790d2[_0x5166fc(0x105)](_0xffa08c,_0x1939fe);const _0x2604a5=await resolveRuleSegmentRefs(_0xf54324,async _0x47c7b0=>{const _0x4383b4=_0x5166fc,_0xd624dd=_0x326c48[_0x4383b4(0x181)](_0x47c7b0);if(_0xd624dd)return _0xd624dd;const _0x2f24cd=await _0x24243c[_0x4383b4(0xcb)](_0x47c7b0);return _0x2f24cd[_0x4383b4(0x158)];});_0x2e3a7b={'description':_0x557aec[_0x5166fc(0x109)],'rule':_0x2604a5};}}}return{'name':_0x1939fe,'isJourneyLocal':_0x439704,'definition':_0x2e3a7b};}catch(_0x46165e){return logger[_0x5166fc(0x12b)](_0x5166fc(0xb5)+_0x4ab511+':\x20'+_0x46165e),{'name':_0x4ab511,'isJourneyLocal':![]};}},'resolveActivation':async _0x3afbd4=>{const _0x39cbe5=a140_0x2637,_0x2a2c2f=_0x52569f['get'](_0x3afbd4);if(_0x2a2c2f!==undefined)return{'name':_0x2a2c2f,'isJourneyLocal':!![]};try{let _0x16e16a=_0x5bc38a?.[_0x39cbe5(0x181)](_0x3afbd4);!_0x16e16a&&(_0x16e16a=await _0x19889c[_0x39cbe5(0x161)][_0x39cbe5(0x120)](_0x148a2a,_0x3afbd4));const _0x1e9f62=_0x16e16a[_0x39cbe5(0x12f)][_0x39cbe5(0x157)][_0x39cbe5(0x158)]||_0x3afbd4,_0x5a911d=sanitizeYamlKey(_0x1e9f62)||_0x39cbe5(0x170)+_0x3afbd4,_0x44146a=_0x5a911d;_0x52569f[_0x39cbe5(0x105)](_0x3afbd4,_0x44146a);const _0x4da1d2=journeyActivationStepToYaml(_0x16e16a,_0x7fa0d0,_0x424d39);return{'name':_0x44146a,'isJourneyLocal':!![],'definition':_0x4da1d2};}catch(_0x46b24d){return logger[_0x39cbe5(0x12b)]('Failed\x20to\x20resolve\x20activation\x20'+_0x3afbd4+':\x20'+_0x46b24d),{'name':_0x3afbd4,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x1a3530,_0x319ca3)=>resolveJumpTarget(_0x1a3530,_0x319ca3,_0x2f5c45,async _0x3d16ac=>{const _0x437fa4=a140_0x2637,_0x218f3c=_0x38d9f8?.[_0x437fa4(0x181)](_0x3d16ac);if(_0x218f3c)return _0x218f3c;return _0x19889c[_0x437fa4(0x161)]['getJourney'](_0x3d16ac);})};return _0x24243c=_0xdcb491,_0xdcb491;},_0x9b6951=async _0xe31ede=>{const _0x20a8b5=a140_0x2637,{collectSegmentIdsFromJourneyApi:_0x2f6588}=await import(_0x20a8b5(0x180)),{batchAsync:_0x34c88d}=await import(_0x20a8b5(0x91)),_0x45aa3e=new Set();for(const _0x271317 of _0xe31ede){let _0xf75be6=_0x38d9f8?.['get'](_0x271317);!_0xf75be6&&(_0xf75be6=await _0x19889c['journey'][_0x20a8b5(0x97)](_0x271317));const _0x2a3812=_0x2f6588(_0xf75be6);for(const _0x28b9d3 of _0x2a3812){_0x45aa3e[_0x20a8b5(0xf7)](_0x28b9d3);}}let _0x380c5c=Array[_0x20a8b5(0xc4)](_0x45aa3e);while(_0x380c5c['length']>0x0){const _0x41aa04=_0x380c5c[_0x20a8b5(0x146)](_0x541111=>!_0xc1fd41[_0x20a8b5(0xae)](_0x541111));if(_0x41aa04['length']===0x0)break;const _0x4f3d78=await _0x34c88d(_0x41aa04,async _0xd61224=>{const _0x2bea4f=_0x20a8b5;_0xc1fd41[_0x2bea4f(0xf7)](_0xd61224);const _0x3ffedc=await fetchSegment(_0x19889c,_0x4cf477,_0xd61224,_0x439ef6);if(!_0x3ffedc)return null;return{'segmentId':_0xd61224,'segment':_0x3ffedc};},0xa),_0x2ecf1b=new Set();for(const _0x42ddc1 of _0x4f3d78){if(!_0x42ddc1?.['segment']?.[_0x20a8b5(0x10b)])continue;const _0x3f4c3e=apiRuleToYaml(_0x42ddc1[_0x20a8b5(0x155)][_0x20a8b5(0x10b)]);_0x5a060c[_0x20a8b5(0x105)](_0x42ddc1[_0x20a8b5(0xe7)],_0x3f4c3e);const _0x59e4bf=collectSegmentRefsFromRule(_0x3f4c3e);for(const _0x8b889b of _0x59e4bf){!_0xc1fd41[_0x20a8b5(0xae)](_0x8b889b)&&_0x2ecf1b['add'](_0x8b889b);}}_0x380c5c=Array[_0x20a8b5(0xc4)](_0x2ecf1b);}};return{'createYamlContext':_0x295ffb,'prefetchJourneySegments':_0x9b6951};}export async function executePushSegments(_0x281435,_0x99a23d,_0x134d47,_0x50d40b,_0xaf1232){const _0x56d571=a140_0x1e27d0,{segmentDefToCreateRequest:_0x3b09d9,segmentDefToUpdateRequest:_0x1c5d03}=await import(_0x56d571(0x95)),_0xf1c750=_0x134d47[_0x56d571(0xd0)],_0x30b4f4=0x5,_0x3c1682=async _0x2c6ed4=>{const _0x350fc8=_0x56d571,_0x533bcd=_0x2c6ed4['folderPath']?_0xf1c750[_0x350fc8(0x181)](_0x2c6ed4[_0x350fc8(0x118)]):undefined;let _0x2020d1;const _0x5c39bf={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x782f6a=_0x2c6ed4['yamlConfig'];if(_0x2c6ed4['yamlConfig']['rule']){const _0x5d34f6=createSegmentIdResolver(_0x134d47[_0x350fc8(0x165)],_0x2c6ed4['yamlConfig'][_0x350fc8(0x158)]),_0x3f416a=await resolveRuleSegmentIds(_0x2c6ed4[_0x350fc8(0x175)][_0x350fc8(0x10b)],_0x5d34f6);_0x782f6a={..._0x2c6ed4['yamlConfig'],'rule':_0x3f416a};}try{if(_0x2c6ed4[_0x350fc8(0x144)]){_0xaf1232[_0x350fc8(0x176)]?.({'type':_0x350fc8(0x107),'name':_0x2c6ed4['yamlConfig'][_0x350fc8(0x158)]});const _0x43434f=_0x3b09d9(_0x782f6a,_0x533bcd),_0x5f080f=await _0xaf1232[_0x350fc8(0x15d)]('Creating\x20segment\x20\x27'+_0x2c6ed4[_0x350fc8(0x175)]['name']+_0x350fc8(0x9a),()=>_0x281435[_0x350fc8(0x155)][_0x350fc8(0xfc)](_0x50d40b['parentId'],_0x43434f));_0x2020d1=_0x5f080f[_0x350fc8(0x17a)]['id'],_0x134d47['segmentNameToId'][_0x350fc8(0x105)](_0x2c6ed4[_0x350fc8(0x175)][_0x350fc8(0x158)],_0x2020d1),_0x5c39bf[_0x350fc8(0x15b)]={'name':_0x2c6ed4[_0x350fc8(0x175)][_0x350fc8(0x158)],'id':_0x2020d1},_0xaf1232[_0x350fc8(0x176)]?.({'type':_0x350fc8(0xfe),'name':_0x2c6ed4['yamlConfig'][_0x350fc8(0x158)],'segmentId':_0x2020d1}),_0xaf1232[_0x350fc8(0x115)]?.(_0x350fc8(0xda)+_0x2c6ed4['yamlConfig'][_0x350fc8(0x158)]+'\x27'),_0x5c39bf[_0x350fc8(0xb9)]=0x1;}else{if(_0x2c6ed4[_0x350fc8(0x13e)]){_0xaf1232[_0x350fc8(0x176)]?.({'type':_0x350fc8(0xc0),'name':_0x2c6ed4[_0x350fc8(0x175)][_0x350fc8(0x158)]});const _0x122f23=_0x1c5d03(_0x782f6a);_0x533bcd!==_0x2c6ed4[_0x350fc8(0x110)]?.[_0x350fc8(0xd1)]&&(_0x122f23['segmentFolderId']=_0x533bcd?parseInt(_0x533bcd,0xa):undefined),await _0xaf1232[_0x350fc8(0x15d)]('Updating\x20segment\x20\x27'+_0x2c6ed4[_0x350fc8(0x175)][_0x350fc8(0x158)]+'\x27...',()=>_0x281435['segment'][_0x350fc8(0x160)](_0x50d40b[_0x350fc8(0xcf)],_0x2c6ed4[_0x350fc8(0x110)]['id'],_0x122f23)),_0x2020d1=_0x2c6ed4[_0x350fc8(0x110)]['id'],_0xaf1232[_0x350fc8(0x176)]?.({'type':_0x350fc8(0xff),'name':_0x2c6ed4[_0x350fc8(0x175)][_0x350fc8(0x158)]}),_0xaf1232[_0x350fc8(0x115)]?.(_0x350fc8(0xdf)+_0x2c6ed4['yamlConfig'][_0x350fc8(0x158)]+'\x27'),_0x5c39bf[_0x350fc8(0x172)]=0x1;}else _0x2020d1=_0x2c6ed4[_0x350fc8(0x110)]['id'];}}catch(_0x2bb339){const _0x5c5296=isHttp400Error(_0x2bb339),_0x43910e=_0x5c5296?ErrorCode[_0x350fc8(0x10a)]:ErrorCode['SEGMENT_UPDATE_ERROR'],_0x1f01e6=getErrorMessage(_0x2bb339);throw new SDKError(_0x43910e,'Failed\x20to\x20'+(_0x2c6ed4[_0x350fc8(0x144)]?_0x350fc8(0x123):'update')+_0x350fc8(0x8a)+_0x2c6ed4['absolutePath']+_0x350fc8(0x119)+_0x1f01e6,_0x2bb339);}try{const _0x21e785=await syncActivationsForSegment(_0x281435,_0x50d40b[_0x350fc8(0xcf)],_0x2020d1,_0x2c6ed4['yamlConfig'][_0x350fc8(0x158)],_0x2c6ed4[_0x350fc8(0xd3)],_0xaf1232,_0x2c6ed4['absolutePath']);_0x5c39bf['activations']=_0x21e785;}catch(_0x434548){if(_0x434548 instanceof SDKError)throw _0x434548;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x350fc8(0x96)+_0x2c6ed4[_0x350fc8(0x175)]['name']+_0x350fc8(0xc9)+_0x2c6ed4[_0x350fc8(0x154)]+_0x350fc8(0x119)+getErrorMessage(_0x434548),_0x434548);}return _0x5c39bf;},_0x4ddc8a=await batchAsync(_0x99a23d,_0x3c1682,_0x30b4f4),_0x4706ad={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x148d7a of _0x4ddc8a){_0x4706ad[_0x56d571(0xb9)]+=_0x148d7a[_0x56d571(0xb9)],_0x4706ad[_0x56d571(0x172)]+=_0x148d7a['updated'],_0x148d7a[_0x56d571(0x15b)]&&_0x4706ad[_0x56d571(0x14f)]['set'](_0x148d7a['createdSegmentId'][_0x56d571(0x158)],_0x148d7a[_0x56d571(0x15b)]['id']),_0x4706ad['activations']['created']+=_0x148d7a['activations']['created'],_0x4706ad['activations'][_0x56d571(0x172)]+=_0x148d7a['activations'][_0x56d571(0x172)],_0x4706ad[_0x56d571(0x16d)]['deleted']+=_0x148d7a['activations'][_0x56d571(0xe9)];}return _0x4706ad;}async function syncActivationsForSegment(_0x23da10,_0xbe7f5e,_0x209ef3,_0x5a8ba2,_0x30d7a5,_0x25e802,_0x5f6e8e){const _0x5ed29d=a140_0x1e27d0,_0x4e3248={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x41348a of _0x30d7a5){try{if(_0x41348a[_0x5ed29d(0x11b)]==='create'&&_0x41348a[_0x5ed29d(0x81)])_0x25e802['onProgress']?.({'type':_0x5ed29d(0xe4),'segmentName':_0x5a8ba2,'activationName':_0x41348a[_0x5ed29d(0x158)]}),await _0x25e802[_0x5ed29d(0x15d)]('Creating\x20activation\x20\x27'+_0x41348a['name']+_0x5ed29d(0x9a),()=>_0x23da10[_0x5ed29d(0x155)][_0x5ed29d(0x13c)](_0xbe7f5e,_0x209ef3,_0x41348a[_0x5ed29d(0x81)])),_0x25e802[_0x5ed29d(0x176)]?.({'type':_0x5ed29d(0xaf),'segmentName':_0x5a8ba2,'activationName':_0x41348a[_0x5ed29d(0x158)]}),_0x25e802[_0x5ed29d(0x115)]?.(_0x5ed29d(0x131)+_0x41348a['name']+'\x27'),_0x4e3248[_0x5ed29d(0xb9)]++;else{if(_0x41348a[_0x5ed29d(0x11b)]===_0x5ed29d(0x168)&&_0x41348a[_0x5ed29d(0x81)]&&_0x41348a[_0x5ed29d(0x173)])_0x25e802[_0x5ed29d(0x176)]?.({'type':_0x5ed29d(0x8b),'segmentName':_0x5a8ba2,'activationName':_0x41348a[_0x5ed29d(0x158)]}),await _0x25e802[_0x5ed29d(0x15d)](_0x5ed29d(0xad)+_0x41348a[_0x5ed29d(0x158)]+_0x5ed29d(0x9a),()=>_0x23da10[_0x5ed29d(0x155)][_0x5ed29d(0x156)](_0xbe7f5e,_0x209ef3,_0x41348a[_0x5ed29d(0x173)]['id'],_0x41348a[_0x5ed29d(0x81)])),_0x25e802[_0x5ed29d(0x176)]?.({'type':'activation_updated','segmentName':_0x5a8ba2,'activationName':_0x41348a['name']}),_0x25e802['logSuccess']?.('Updated\x20activation\x20\x27'+_0x41348a[_0x5ed29d(0x158)]+'\x27'),_0x4e3248[_0x5ed29d(0x172)]++;else _0x41348a['type']===_0x5ed29d(0xd7)&&_0x41348a['existingActivation']&&(_0x25e802[_0x5ed29d(0x176)]?.({'type':_0x5ed29d(0xf9),'segmentName':_0x5a8ba2,'activationName':_0x41348a[_0x5ed29d(0x158)]}),await _0x25e802[_0x5ed29d(0x15d)](_0x5ed29d(0xbe)+_0x41348a['name']+_0x5ed29d(0x9a),()=>_0x23da10['segment'][_0x5ed29d(0x147)](_0xbe7f5e,_0x209ef3,_0x41348a[_0x5ed29d(0x173)]['id'])),_0x25e802['onProgress']?.({'type':_0x5ed29d(0x17e),'segmentName':_0x5a8ba2,'activationName':_0x41348a[_0x5ed29d(0x158)]}),_0x25e802['logDeleted']?.(_0x5ed29d(0xe1)+_0x41348a[_0x5ed29d(0x158)]+'\x27'),_0x4e3248[_0x5ed29d(0xe9)]++);}}catch(_0x25322e){const _0x586514=isHttp400Error(_0x25322e),_0x526893=_0x586514?ErrorCode[_0x5ed29d(0xb7)]:ErrorCode[_0x5ed29d(0x14b)],_0x55d8e8=getErrorMessage(_0x25322e);throw new SDKError(_0x526893,'Failed\x20to\x20'+_0x41348a[_0x5ed29d(0x11b)]+_0x5ed29d(0x129)+_0x41348a[_0x5ed29d(0x158)]+'\x27\x20from\x20file:\x20'+_0x5f6e8e+_0x5ed29d(0x119)+_0x55d8e8,_0x25322e);}}return _0x4e3248;}export async function executePushFolders(_0x7b386,_0x50b6c3,_0xba69d,_0xcd8091,_0x27617d){const _0x415d3a=a140_0x1e27d0,_0xc6bf96=new Map(_0xba69d),_0x5ea952=sortFoldersByDepth(_0x50b6c3);for(const _0x2f0e9e of _0x5ea952){const _0x192d36=_0x2f0e9e[_0x415d3a(0xcc)]('/'),_0x5eb6cf=_0x192d36[_0x192d36[_0x415d3a(0x10c)]-0x1],_0x2a76a4=_0x192d36['slice'](0x0,-0x1)[_0x415d3a(0x93)]('/'),_0x1357e6=_0xc6bf96[_0x415d3a(0x181)](_0x2a76a4);_0x27617d['onProgress']?.({'type':_0x415d3a(0x15a),'folder':_0x2f0e9e});const _0x555995={'name':_0x5eb6cf,'parentFolderId':_0x1357e6},_0x4a8d04=await _0x27617d['withProgress'](_0x415d3a(0xe5)+_0x2f0e9e+_0x415d3a(0x9a),()=>_0x7b386['segment'][_0x415d3a(0x153)](_0xcd8091[_0x415d3a(0xcf)],_0x555995));_0xc6bf96[_0x415d3a(0x105)](_0x2f0e9e,_0x4a8d04['data']['id']),_0x27617d[_0x415d3a(0x176)]?.({'type':'folder_created','folder':_0x2f0e9e,'folderId':_0x4a8d04[_0x415d3a(0x17a)]['id']}),_0x27617d[_0x415d3a(0xfd)]?.(_0x415d3a(0xb2)+_0x2f0e9e+'\x27');}return _0xc6bf96;}export async function executePushSegmentDeletions(_0x281d17,_0x456744,_0x318cd9){const _0x43403f=a140_0x1e27d0;if(_0x456744[_0x43403f(0x10c)]===0x0)return 0x0;const {batchAsync:_0x307e55}=await import(_0x43403f(0x91)),_0x39b256=0x5,_0xc9b557=await _0x307e55(_0x456744,async _0x3fb450=>{const _0x2376a7=_0x43403f;return _0x318cd9[_0x2376a7(0x176)]?.({'type':'segment_deleting','name':_0x3fb450[_0x2376a7(0x158)]}),await _0x281d17[_0x2376a7(0x155)][_0x2376a7(0x141)](_0x3fb450['id']),_0x318cd9[_0x2376a7(0x176)]?.({'type':_0x2376a7(0x89),'name':_0x3fb450['name']}),_0x318cd9[_0x2376a7(0x8e)]?.(_0x2376a7(0x7f)+_0x3fb450[_0x2376a7(0x158)]+'\x27'),0x1;},_0x39b256);return _0xc9b557[_0x43403f(0xd2)]((_0x37b3ed,_0x2276a1)=>_0x37b3ed+_0x2276a1,0x0);}export async function executePushJourneys(_0x3f92a3,_0x47ca66,_0x1312a6,_0x5324a2,_0x1b566e){const _0x2c5dfa=a140_0x1e27d0,{journeyDefToRequest:_0x122a9c}=await import(_0x2c5dfa(0x180)),{activationDefToCreateRequest:_0xf00e77,yamlRuleToApi:_0x1c5c69,validateSegmentRule:_0x2f8428}=await import(_0x2c5dfa(0x95)),_0x381924={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x5e2b62=new Map(_0x1312a6[_0x2c5dfa(0x165)]),_0x276cb6=0x5;for(let _0x3f9e7d=0x0;_0x3f9e7d<_0x47ca66[_0x2c5dfa(0x10c)];_0x3f9e7d+=_0x276cb6){const _0x2c9e59=_0x47ca66[_0x2c5dfa(0x150)](_0x3f9e7d,_0x3f9e7d+_0x276cb6),_0x2706ed=await Promise[_0x2c5dfa(0xba)](_0x2c9e59[_0x2c5dfa(0x83)](async _0x5137e4=>{const _0x3f7dba=_0x2c5dfa;if(!_0x5137e4[_0x3f7dba(0x144)]&&!_0x5137e4['hasChanges'])return{'action':_0x3f7dba(0xd9),'name':_0x5137e4[_0x3f7dba(0x175)][_0x3f7dba(0x158)],'journeyId':_0x5137e4[_0x3f7dba(0x163)]?.['id']};const _0x22bd88=_0x5137e4['folderPath']?_0x1312a6[_0x3f7dba(0xd0)][_0x3f7dba(0x181)](_0x5137e4[_0x3f7dba(0x118)]):undefined;_0x1b566e[_0x3f7dba(0x176)]?.({'type':_0x5137e4[_0x3f7dba(0x144)]?_0x3f7dba(0xd8):_0x3f7dba(0x12e),'name':_0x5137e4[_0x3f7dba(0x175)][_0x3f7dba(0x158)]});try{const _0x179649=await executeSingleJourneyPush(_0x3f92a3,_0x5137e4,{..._0x1312a6,'segmentNameToId':_0x5e2b62},{'parentId':_0x5324a2['parentId'],'rootFolderId':_0x5324a2[_0x3f7dba(0xbb)],'folderId':_0x22bd88,'verbose':_0x5324a2[_0x3f7dba(0x101)]},_0x1b566e,{'journeyDefToRequest':_0x122a9c,'activationDefToCreateRequest':_0xf00e77,'yamlRuleToApi':_0x1c5c69,'validateSegmentRule':_0x2f8428});for(const [_0x3726de,_0x4fff6c]of _0x179649['embeddedSegmentNameToId']){_0x5e2b62[_0x3f7dba(0x105)](_0x3726de,_0x4fff6c),_0x381924[_0x3f7dba(0x179)]['set'](_0x3726de,_0x4fff6c);}if(_0x179649[_0x3f7dba(0xf2)]===_0x3f7dba(0xb9))_0x1b566e[_0x3f7dba(0x176)]?.({'type':_0x3f7dba(0x8c),'name':_0x5137e4[_0x3f7dba(0x175)]['name'],'journeyId':_0x179649['journeyId']}),_0x1b566e[_0x3f7dba(0x115)]?.(_0x3f7dba(0x104)+_0x5137e4[_0x3f7dba(0x175)][_0x3f7dba(0x158)]+'\x27'),_0x381924[_0x3f7dba(0xb9)]++;else _0x179649[_0x3f7dba(0xf2)]===_0x3f7dba(0x172)&&(_0x1b566e[_0x3f7dba(0x176)]?.({'type':_0x3f7dba(0x17d),'name':_0x5137e4[_0x3f7dba(0x175)][_0x3f7dba(0x158)]}),_0x1b566e[_0x3f7dba(0x115)]?.(_0x3f7dba(0xf1)+_0x5137e4[_0x3f7dba(0x175)][_0x3f7dba(0x158)]+'\x27'),_0x381924[_0x3f7dba(0x172)]++);return{'action':_0x179649[_0x3f7dba(0xf2)],'name':_0x5137e4['yamlConfig'][_0x3f7dba(0x158)],'journeyId':_0x179649['journeyId']};}catch(_0x5b6fb6){const _0xc5f045=isHttp400Error(_0x5b6fb6),_0x55b99d=_0xc5f045?ErrorCode[_0x3f7dba(0x133)]:ErrorCode[_0x3f7dba(0xee)],_0x7492ef=getErrorMessage(_0x5b6fb6);throw new SDKError(_0x55b99d,_0x3f7dba(0xa7)+(_0x5137e4[_0x3f7dba(0x144)]?_0x3f7dba(0x123):'update')+_0x3f7dba(0x143)+_0x5137e4[_0x3f7dba(0x154)]+_0x3f7dba(0x119)+_0x7492ef,_0x5b6fb6);}}));_0x381924['results'][_0x2c5dfa(0xc1)](..._0x2706ed);}return _0x381924;}async function matchExistingJourneySegments(_0x120b71,_0x2fbe6b,_0x210293,_0x2c9f8b,_0x404eca){const _0x4275af=a140_0x1e27d0;if(!_0x2fbe6b[_0x4275af(0x163)]||!_0x2fbe6b[_0x4275af(0x175)][_0x4275af(0x102)])return;const _0x19d684=new Map(),_0x287f18=new Set();for(const _0x33521c of Object[_0x4275af(0x169)](_0x2fbe6b[_0x4275af(0x175)][_0x4275af(0x102)])){const _0x4dc939=generateDeterministicJourneySegmentName(_0x2fbe6b['yamlConfig']['name'],_0x33521c);_0x19d684[_0x4275af(0x105)](_0x4dc939,_0x33521c),_0x287f18[_0x4275af(0xf7)](_0x33521c);}const _0x377368=[],_0xd38b73=collectSegmentIdsFromJourneyApi(_0x2fbe6b[_0x4275af(0x163)]);for(const _0x3a092b of _0xd38b73){const _0x58e329=await fetchSegment(_0x120b71,_0x210293,_0x3a092b,_0x2c9f8b);if(!_0x58e329?.[_0x4275af(0x158)])continue;const _0x5cb706=_0x19d684[_0x4275af(0x181)](_0x58e329[_0x4275af(0x158)]);_0x5cb706?(_0x404eca[_0x4275af(0x105)](_0x5cb706,_0x3a092b),_0x287f18['delete'](_0x5cb706)):_0x377368[_0x4275af(0xc1)]({'id':_0x3a092b,'seg':_0x58e329});}if(_0x287f18[_0x4275af(0x94)]>0x0&&_0x377368[_0x4275af(0x10c)]>0x0){const {localExpandedRuleToNames:_0xc286a6}=buildLocalExpandedRuleMappings(_0x2fbe6b[_0x4275af(0x175)]),_0x196a10=new Map();for(const {id:_0x304197,seg:_0x5a6319}of _0x377368){if(_0x5a6319[_0x4275af(0x10b)]){const _0x2b49ae=apiRuleToYaml(_0x5a6319['rule']);_0x196a10[_0x4275af(0x105)](_0x304197,_0x2b49ae);}}for(const {id:_0x492be7,seg:_0x8e4e18}of _0x377368){if(!_0x8e4e18[_0x4275af(0x10b)])continue;const _0x1c7987=_0x196a10['get'](_0x492be7);if(!_0x1c7987)continue;const _0x49b145=serializeExpandedRule(_0x1c7987,_0x196a10),_0x10c9e0=_0xc286a6['get'](_0x49b145);if(_0x10c9e0){const _0x278692=_0x10c9e0[_0x4275af(0xcd)](_0xb1205a=>_0x287f18[_0x4275af(0xae)](_0xb1205a));_0x278692&&(_0x404eca[_0x4275af(0x105)](_0x278692,_0x492be7),_0x287f18['delete'](_0x278692),logger[_0x4275af(0x12b)]('Matched\x20server\x20segment\x20\x27'+_0x8e4e18['name']+_0x4275af(0xe3)+_0x278692+_0x4275af(0xeb)));}}}}async function executeSingleJourneyPush(_0x456bea,_0x4060b4,_0x293cb6,_0x2b67e1,_0x11dbda,_0x20a8ea){const _0x550efd=a140_0x1e27d0,{journeyDefToRequest:_0x49a231,activationDefToCreateRequest:_0x3cf027,yamlRuleToApi:_0x35b689,validateSegmentRule:_0xb551be}=_0x20a8ea,_0x1d6afd=new Map(),_0x16dd69=new Map();recoverSegmentIdsFromPushRecovery(_0x4060b4,_0x1d6afd,_0x293cb6[_0x550efd(0x165)]);const _0x2df191=new Map(),_0x38a273=new Map(),_0x13136f=new Map();let _0x472412;const _0x4668d0=async()=>{const _0x69fa=_0x550efd;if(_0x472412)return;_0x472412=new Map();if(!_0x4060b4[_0x69fa(0x163)])return;const _0xb4c4e8=await _0x456bea[_0x69fa(0x161)][_0x69fa(0xa5)](_0x4060b4[_0x69fa(0x163)]['id']);for(const _0x576245 of _0xb4c4e8){const _0x5ac201=journeyActivationStepToYaml(_0x576245,_0x293cb6['idToEmailMap'],_0x293cb6['connectionIdToNameMap']),_0x5aa31b=activationSignature(_0x5ac201);!_0x472412[_0x69fa(0xae)](_0x5aa31b)&&_0x472412[_0x69fa(0x105)](_0x5aa31b,_0x576245['id']),_0x5ac201[_0x69fa(0x158)]&&_0x16dd69[_0x69fa(0x105)](_0x5ac201[_0x69fa(0x158)],_0x576245['id']);}};await matchExistingJourneySegments(_0x456bea,_0x4060b4,_0x2b67e1[_0x550efd(0xcf)],_0x293cb6[_0x550efd(0xb6)],_0x293cb6[_0x550efd(0x165)]);const _0x3eb5ec={'resolveSegmentId':async _0x59c7ea=>{const _0x11517b=_0x550efd,_0x7af6a5=_0x293cb6['segmentNameToId']['get'](_0x59c7ea);if(!_0x7af6a5)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x11517b(0xb0)+_0x59c7ea+_0x11517b(0x87)+_0x4060b4[_0x11517b(0x175)][_0x11517b(0x158)]+')');return _0x7af6a5;},'resolveEmbeddedSegmentId':async(_0x4f07ff,_0x109688)=>{const _0x18722c=_0x550efd,_0xd05f08=_0x293cb6[_0x18722c(0x165)][_0x18722c(0x181)](_0x4f07ff);if(_0xd05f08)return _0xd05f08;const _0x3573e5=_0x293cb6[_0x18722c(0xb6)][_0x18722c(0xcd)](_0x2b202a=>_0x2b202a[_0x18722c(0x158)]===_0x4f07ff);if(_0x3573e5)return _0x293cb6['segmentNameToId'][_0x18722c(0x105)](_0x4f07ff,_0x3573e5['id']),_0x3573e5['id'];if(_0x4060b4[_0x18722c(0x144)]){const {stageName:_0x491f16,criteriaName:_0x1bf55c}=findSegmentCriteriaLocation(_0x4060b4[_0x18722c(0x175)],_0x4f07ff);return _0xb551be(_0x4f07ff,_0x109688[_0x18722c(0x10b)]),_0x38a273[_0x18722c(0x105)](_0x4f07ff,{'definition':_0x109688,'stageName':_0x491f16,'criteriaName':_0x1bf55c}),createPendingSegmentId(_0x4f07ff);}const _0x45af11=_0x4060b4[_0x18722c(0x163)]?.['id'];if(!_0x45af11)throw new SDKError(ErrorCode['INTERNAL'],_0x18722c(0x16a));const _0x528e7b=_0x2df191[_0x18722c(0x181)](_0x4f07ff);if(_0x528e7b)return _0x528e7b;const _0xdd8bed=((async()=>{const _0x361123=_0x18722c;_0xb551be(_0x4f07ff,_0x109688[_0x361123(0x10b)]);const _0x3abf4a=generateDeterministicJourneySegmentName(_0x4060b4[_0x361123(0x175)][_0x361123(0x158)],_0x4f07ff),_0x33d761=_0x293cb6[_0x361123(0xb6)][_0x361123(0xcd)](_0x4da5af=>_0x4da5af[_0x361123(0x158)]===_0x3abf4a),_0x594d4a=createSegmentIdResolver(_0x293cb6[_0x361123(0x165)],_0x4f07ff),_0x3b85f3=await resolveRuleSegmentIds(_0x109688['rule'],_0x594d4a);let _0x5de9bd;return _0x33d761?(await _0x456bea[_0x361123(0x155)]['updateSegmentById'](_0x2b67e1[_0x361123(0xcf)],_0x33d761['id'],{'description':_0x109688[_0x361123(0x109)]||_0x361123(0xec)+_0x4f07ff,'rule':_0x35b689(_0x3b85f3,!![]),'countPopulation':!![]}),_0x5de9bd=_0x33d761['id'],saveSegmentToPushRecovery(_0x4060b4['absolutePath'],_0x4060b4[_0x361123(0x175)][_0x361123(0x158)],_0x4f07ff,{'segmentId':_0x5de9bd,'uniqueServerName':_0x3abf4a,'createdAt':new Date()[_0x361123(0x126)]()})):_0x5de9bd=await createOrRecoverEmbeddedSegment(_0x456bea,_0x4060b4,{'localName':_0x4f07ff,'uniqueSegmentName':_0x3abf4a,'description':_0x109688[_0x361123(0x109)]||_0x361123(0xec)+_0x4f07ff,'journeyId':_0x45af11,'resolvedRule':_0x3b85f3,'parentId':_0x2b67e1[_0x361123(0xcf)],'folderId':_0x2b67e1[_0x361123(0xbb)]||''},_0x35b689),_0x293cb6['segmentNameToId'][_0x361123(0x105)](_0x4f07ff,_0x5de9bd),_0x1d6afd['set'](_0x4f07ff,_0x5de9bd),_0x5de9bd;})());_0x2df191[_0x18722c(0x105)](_0x4f07ff,_0xdd8bed);try{return await _0xdd8bed;}finally{_0x2df191['delete'](_0x4f07ff);}},'resolveActivationId':async _0xa0a3dd=>{const _0x3b20f5=_0x550efd,_0x55d1ad=_0x16dd69[_0x3b20f5(0x181)](_0xa0a3dd);if(_0x55d1ad)return _0x55d1ad;if(_0x4060b4[_0x3b20f5(0x163)]){await _0x4668d0();const _0x5e7b7f=_0x16dd69[_0x3b20f5(0x181)](_0xa0a3dd);if(_0x5e7b7f)return _0x5e7b7f;}throw new SDKError(ErrorCode['NOT_FOUND'],'Activation\x20not\x20found:\x20'+_0xa0a3dd+'\x20(referenced\x20in\x20journey\x20'+_0x4060b4[_0x3b20f5(0x175)][_0x3b20f5(0x158)]+_0x3b20f5(0x14e)+_0x3b20f5(0xd5));},'resolveEmbeddedActivationId':async(_0x39cc64,_0x3dab6d)=>{const _0xf20223=_0x550efd,_0x1076cb=_0x16dd69[_0xf20223(0x181)](_0x39cc64);if(_0x1076cb)return _0x1076cb;if(_0x4060b4[_0xf20223(0x144)])return _0x13136f[_0xf20223(0x105)](_0x39cc64,_0x3dab6d),createPendingActivationId(_0x39cc64);if(_0x4060b4[_0xf20223(0x163)]){await _0x4668d0();const _0x3f8392=_0x16dd69[_0xf20223(0x181)](_0x3dab6d['name']);if(_0x3f8392)return _0x16dd69[_0xf20223(0x105)](_0x39cc64,_0x3f8392),_0x3f8392;const _0x2fe8b7=activationSignature(_0x3dab6d),_0x36c60b=_0x472412?.[_0xf20223(0x181)](_0x2fe8b7);if(_0x36c60b)return _0x16dd69['set'](_0x39cc64,_0x36c60b),_0x36c60b;const _0x1278ef=await _0x3cf027(_0x3dab6d,_0x293cb6[_0xf20223(0x152)]),_0x15eb1a={..._0x1278ef,..._0x3dab6d[_0xf20223(0x80)]!==undefined&&{'runAfterJourneyRefresh':_0x3dab6d[_0xf20223(0x80)]}},_0xb8a83a=await _0x456bea[_0xf20223(0x161)][_0xf20223(0x13c)](_0x4060b4[_0xf20223(0x163)]['id'],_0x15eb1a);return _0x16dd69['set'](_0x39cc64,_0xb8a83a['id']),_0xb8a83a['id'];}throw new SDKError(ErrorCode[_0xf20223(0x14d)],_0xf20223(0x132));},'resolveJourneyId':async _0x4bde51=>{const _0x15c2c3=_0x550efd;try{return await _0x456bea[_0x15c2c3(0x161)][_0x15c2c3(0x13f)](_0x2b67e1[_0x15c2c3(0xcf)],_0x4bde51);}catch(_0xc2f337){throw new SDKError(ErrorCode['NOT_FOUND'],_0x15c2c3(0x11c)+_0x4bde51+_0x15c2c3(0xf8)+_0x4060b4[_0x15c2c3(0x175)][_0x15c2c3(0x158)]+'\x27)',_0xc2f337);}},'resolveStageId':async(_0x29bb5b,_0x3cb21a)=>{const _0xa0ff6f=_0x550efd,_0x1a4552=await _0x456bea[_0xa0ff6f(0x161)]['getJourney'](_0x29bb5b),_0x325c14=_0x1a4552[_0xa0ff6f(0x12f)][_0xa0ff6f(0x112)]['find'](_0x102c19=>_0x102c19['name'][_0xa0ff6f(0xea)]()===_0x3cb21a[_0xa0ff6f(0xea)]());if(!_0x325c14?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],_0xa0ff6f(0x103)+_0x3cb21a+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x1a4552[_0xa0ff6f(0x12f)][_0xa0ff6f(0x167)]||_0x1a4552[_0xa0ff6f(0x12f)][_0xa0ff6f(0x158)])+'\x27');return _0x325c14['id'];}},_0x1fbc2b=await _0x49a231(_0x4060b4[_0x550efd(0x175)],_0x2b67e1[_0x550efd(0xcf)],_0x3eb5ec),_0x4dc56a=_0x2b67e1['folderId']||_0x2b67e1[_0x550efd(0xbb)];_0x4dc56a&&(_0x1fbc2b[_0x550efd(0x139)]={'parentFolder':{'data':{'id':_0x4dc56a,'type':'folder'}}});if(_0x4060b4['isNew']){if(_0x38a273[_0x550efd(0x94)]>0x0||_0x13136f[_0x550efd(0x94)]>0x0)return await executeThreeStepJourneyCreate(_0x456bea,_0x4060b4,_0x1fbc2b,{'pendingEmbeddedSegments':_0x38a273,'pendingEmbeddedActivations':_0x13136f,'embeddedSegmentNameToId':_0x1d6afd,'journeyActivationNameToId':_0x16dd69},{..._0x2b67e1,'effectiveFolderId':_0x4dc56a},_0x293cb6,_0x11dbda,_0x20a8ea);else{ensureJourneyDefaults(_0x1fbc2b['attributes']);const _0x4c735b=await _0x456bea['journey'][_0x550efd(0x123)](_0x1fbc2b);return deletePushRecovery(_0x4060b4['absolutePath']),{'action':_0x550efd(0xb9),'journeyId':_0x4c735b['id'],'embeddedSegmentNameToId':_0x1d6afd};}}else{if(_0x4060b4[_0x550efd(0x13e)]&&_0x4060b4[_0x550efd(0x163)]){_0x1fbc2b['id']=_0x4060b4[_0x550efd(0x163)]['id'];const _0x4e5b1f=_0x1fbc2b[_0x550efd(0x12f)];_0x4060b4[_0x550efd(0x163)]['attributes']?.['journeyBundleName']&&(_0x4e5b1f['journeyBundleName']=_0x4060b4[_0x550efd(0x163)][_0x550efd(0x12f)][_0x550efd(0x167)]);const _0xbcd9ff=_0x4060b4[_0x550efd(0x163)][_0x550efd(0x12f)]?.[_0x550efd(0x112)];return _0xbcd9ff&&_0x1fbc2b['attributes'][_0x550efd(0x112)]&&injectExistingStageIds(_0x1fbc2b[_0x550efd(0x12f)][_0x550efd(0x112)],_0xbcd9ff),ensureJourneyDefaults(_0x4e5b1f),await _0x456bea[_0x550efd(0x161)]['update'](_0x4060b4['existingJourney']['id'],_0x1fbc2b),deletePushRecovery(_0x4060b4['absolutePath']),{'action':_0x550efd(0x172),'journeyId':_0x4060b4['existingJourney']['id'],'embeddedSegmentNameToId':_0x1d6afd};}}return deletePushRecovery(_0x4060b4[_0x550efd(0x154)]),{'action':_0x550efd(0xd9),'journeyId':_0x4060b4[_0x550efd(0x163)]?.['id'],'embeddedSegmentNameToId':_0x1d6afd};}function findSegmentCriteriaLocation(_0x265389,_0x5ecba3){const _0x1d1eb5=a140_0x1e27d0,_0x2357bd=_0x265389['stages']||_0x265389[_0x1d1eb5(0x99)]?.[0x0]?.[_0x1d1eb5(0xa6)]||[];let _0x424fd3=_0x1d1eb5(0xf3),_0x597be1=_0x5ecba3;const _0x483ccc=_0x265389['goal']||_0x265389[_0x1d1eb5(0x99)]?.[0x0]?.[_0x1d1eb5(0x9f)];if(_0x483ccc?.['segment']===_0x5ecba3)return{'stageName':_0x1d1eb5(0x9f),'criteriaName':_0x483ccc[_0x1d1eb5(0x158)]||_0x5ecba3};_0x269b38:for(const _0x336cc2 of _0x2357bd){if(_0x336cc2[_0x1d1eb5(0x12d)]?.[_0x1d1eb5(0x155)]===_0x5ecba3){_0x424fd3=_0x336cc2[_0x1d1eb5(0x158)],_0x597be1=_0x336cc2['entry_criteria'][_0x1d1eb5(0x158)]||_0x5ecba3;break;}if(_0x336cc2['steps'])for(const _0x7e2b32 of _0x336cc2[_0x1d1eb5(0x84)]){if(_0x7e2b32[_0x1d1eb5(0x11b)]===_0x1d1eb5(0x138)&&_0x7e2b32['with']?.['branches'])for(const _0x588d95 of _0x7e2b32[_0x1d1eb5(0x177)][_0x1d1eb5(0xfb)]){if(_0x588d95[_0x1d1eb5(0x155)]===_0x5ecba3){_0x424fd3=_0x336cc2[_0x1d1eb5(0x158)],_0x597be1=_0x588d95[_0x1d1eb5(0x158)]||_0x5ecba3;break _0x269b38;}}}}return{'stageName':_0x424fd3,'criteriaName':_0x597be1};}async function executeThreeStepJourneyCreate(_0x2ed656,_0x241381,_0x5b39ea,_0x51642e,_0xb58dad,_0xbdaea5,_0x457d08,_0x852055){const _0x33683b=a140_0x1e27d0,{activationDefToCreateRequest:_0x53e247,yamlRuleToApi:_0x5e54bd}=_0x852055,{pendingEmbeddedSegments:_0x2a6db8,pendingEmbeddedActivations:_0x47511f,embeddedSegmentNameToId:_0x205e90}=_0x51642e,_0x32b6a4=JSON['parse'](JSON['stringify'](_0x5b39ea));ensureJourneyDefaults(_0x32b6a4['attributes']),stripPendingIds(_0x32b6a4);const _0x27a49e=await _0x2ed656[_0x33683b(0x161)][_0x33683b(0x123)](_0x32b6a4),_0x220d92=_0x27a49e['id'],_0x4c9644=new Map();for(const _0x10d700 of _0x27a49e[_0x33683b(0x12f)][_0x33683b(0x112)]){_0x4c9644[_0x33683b(0x105)](_0x10d700[_0x33683b(0x158)][_0x33683b(0xea)](),_0x10d700['id']);}recoverSegmentIdsFromPushRecovery(_0x241381,_0x205e90,_0xbdaea5[_0x33683b(0x165)]);for(const [_0x324610,{definition:_0x2bdc58}]of _0x2a6db8){if(_0x205e90[_0x33683b(0xae)](_0x324610)){_0x457d08[_0x33683b(0x176)]?.({'type':_0x33683b(0x142),'journeyName':_0x241381[_0x33683b(0x175)]['name'],'segmentName':_0x324610});continue;}const _0x3e35a7=generateDeterministicJourneySegmentName(_0x241381[_0x33683b(0x175)]['name'],_0x324610);_0x457d08['onProgress']?.({'type':_0x33683b(0xa9),'journeyName':_0x241381[_0x33683b(0x175)][_0x33683b(0x158)],'segmentName':_0x324610});const _0x1c5beb=createSegmentIdResolver(_0xbdaea5[_0x33683b(0x165)],_0x324610),_0x20600c=await resolveRuleSegmentIds(_0x2bdc58[_0x33683b(0x10b)],_0x1c5beb),_0x4ad689=await createOrRecoverEmbeddedSegment(_0x2ed656,_0x241381,{'localName':_0x324610,'uniqueSegmentName':_0x3e35a7,'description':_0x2bdc58[_0x33683b(0x109)]||'Entry\x20criteria:\x20'+_0x324610,'journeyId':_0x220d92,'resolvedRule':_0x20600c,'parentId':_0xb58dad[_0x33683b(0xcf)],'folderId':_0xb58dad['effectiveFolderId']||''},_0x5e54bd);_0x205e90[_0x33683b(0x105)](_0x324610,_0x4ad689),_0xbdaea5[_0x33683b(0x165)][_0x33683b(0x105)](_0x324610,_0x4ad689),_0x457d08['onProgress']?.({'type':_0x33683b(0x142),'journeyName':_0x241381[_0x33683b(0x175)]['name'],'segmentName':_0x324610});}const _0x37213e=new Map();for(const [_0x5d4eb2,_0x3a4a90]of _0x47511f){_0x457d08[_0x33683b(0x176)]?.({'type':'embedded_activation_creating','journeyName':_0x241381[_0x33683b(0x175)][_0x33683b(0x158)],'activationName':_0x5d4eb2});const _0x396608=await _0x53e247(_0x3a4a90,_0xbdaea5['activationContext']),_0xc49092={..._0x396608,..._0x3a4a90['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x3a4a90[_0x33683b(0x80)]}},_0x5d2859=await _0x2ed656[_0x33683b(0x161)][_0x33683b(0x13c)](_0x220d92,_0xc49092);_0x37213e[_0x33683b(0x105)](_0x5d4eb2,_0x5d2859['id']),_0x51642e[_0x33683b(0x86)]['set'](_0x5d4eb2,_0x5d2859['id']),_0x457d08[_0x33683b(0x176)]?.({'type':_0x33683b(0xef),'journeyName':_0x241381[_0x33683b(0x175)][_0x33683b(0x158)],'activationName':_0x5d4eb2});}const _0xc14783=JSON['parse'](JSON[_0x33683b(0xc6)](_0x5b39ea));return _0xc14783['id']=_0x220d92,ensureJourneyDefaults(_0xc14783[_0x33683b(0x12f)]),resolvePendingIdsInRequest(_0xc14783,_0x5b39ea,_0x4c9644,_0x205e90,_0x37213e,_0x457d08),await _0x2ed656[_0x33683b(0x161)][_0x33683b(0x168)](_0x220d92,_0xc14783),deletePushRecovery(_0x241381[_0x33683b(0x154)]),{'action':_0x33683b(0xb9),'journeyId':_0x220d92,'embeddedSegmentNameToId':_0x205e90};}export function stripWaitStepPendingIds(_0x2a4038){const _0x5069f3=a140_0x1e27d0,_0x3a946e=_0x2a4038[_0x5069f3(0x9c)]&&isPendingSegmentId(_0x2a4038[_0x5069f3(0x9c)]),_0x1f1362=_0x2a4038['conditions']?.[_0x5069f3(0x85)](_0xb90e43=>_0xb90e43['segmentId']&&isPendingSegmentId(_0xb90e43[_0x5069f3(0xe7)]));(_0x3a946e||_0x1f1362)&&(_0x2a4038[_0x5069f3(0xed)]=_0x5069f3(0x13d),_0x2a4038[_0x5069f3(0x124)]=0x1,_0x2a4038['waitStepUnit']=_0x5069f3(0x128),delete _0x2a4038[_0x5069f3(0x9c)],delete _0x2a4038[_0x5069f3(0xca)],delete _0x2a4038[_0x5069f3(0xa1)],delete _0x2a4038[_0x5069f3(0xf4)]);}export function resolveWaitStepPendingIds(_0x34a350,_0x519ea9,_0x1c1919,_0x3cefc0){const _0xe25d1=a140_0x1e27d0;if(_0x519ea9[_0xe25d1(0x9c)]&&isPendingSegmentId(_0x519ea9['conditionSegmentId'])){const _0x3177f1=_0x1c1919(_0x519ea9[_0xe25d1(0x9c)],_0xe25d1(0xac)+_0x3cefc0+_0xe25d1(0xde));_0x3177f1&&(_0x34a350[_0xe25d1(0xed)]=_0xe25d1(0x92),_0x34a350[_0xe25d1(0x9c)]=_0x3177f1,delete _0x34a350['waitStep'],delete _0x34a350[_0xe25d1(0x11d)],_0x519ea9[_0xe25d1(0xca)]!==undefined&&(_0x34a350[_0xe25d1(0xca)]=_0x519ea9[_0xe25d1(0xca)]),_0x519ea9[_0xe25d1(0xa1)]&&(_0x34a350[_0xe25d1(0xa1)]=_0x519ea9[_0xe25d1(0xa1)]));}if(_0x519ea9['conditions']){const _0x1f1ae2=_0x519ea9[_0xe25d1(0xf4)][_0xe25d1(0x85)](_0xdc41cb=>_0xdc41cb['segmentId']&&isPendingSegmentId(_0xdc41cb[_0xe25d1(0xe7)]));if(_0x1f1ae2){const _0x463305=_0x519ea9[_0xe25d1(0xf4)][_0xe25d1(0x83)](_0x276b60=>{const _0x2e17b8=_0xe25d1;if(_0x276b60[_0x2e17b8(0xe7)]&&isPendingSegmentId(_0x276b60[_0x2e17b8(0xe7)])){const _0x2a9e94=_0x1c1919(_0x276b60[_0x2e17b8(0xe7)],_0x2e17b8(0xac)+_0x3cefc0+_0x2e17b8(0xde));return{..._0x276b60,'segmentId':_0x2a9e94||_0x276b60['segmentId']};}return{..._0x276b60};});_0x34a350[_0xe25d1(0xed)]=_0xe25d1(0x92),_0x34a350[_0xe25d1(0xf4)]=_0x463305,delete _0x34a350[_0xe25d1(0x124)],delete _0x34a350['waitStepUnit'],delete _0x34a350[_0xe25d1(0x9c)],delete _0x34a350['conditionTimeoutDuration'],delete _0x34a350[_0xe25d1(0xa1)];}}}function stripPendingIds(_0x5da197){const _0x2cff7a=a140_0x1e27d0;_0x5da197['attributes'][_0x2cff7a(0x9f)]?.['segmentId']&&isPendingSegmentId(_0x5da197['attributes'][_0x2cff7a(0x9f)]['segmentId'])&&delete _0x5da197[_0x2cff7a(0x12f)]['goal'];for(const _0x1c4d5e of _0x5da197['attributes']['journeyStages']||[]){_0x1c4d5e[_0x2cff7a(0x136)]?.[_0x2cff7a(0xe7)]&&isPendingSegmentId(_0x1c4d5e['entryCriteria'][_0x2cff7a(0xe7)])&&delete _0x1c4d5e[_0x2cff7a(0x136)];_0x1c4d5e[_0x2cff7a(0x137)]?.[_0x2cff7a(0xe7)]&&isPendingSegmentId(_0x1c4d5e[_0x2cff7a(0x137)][_0x2cff7a(0xe7)])&&delete _0x1c4d5e[_0x2cff7a(0x137)];_0x1c4d5e[_0x2cff7a(0x88)]&&(_0x1c4d5e['exitCriterias']=_0x1c4d5e[_0x2cff7a(0x88)][_0x2cff7a(0x146)](_0x5a3b7=>!_0x5a3b7['segmentId']||!isPendingSegmentId(_0x5a3b7[_0x2cff7a(0xe7)])));if(_0x1c4d5e['steps'])for(const _0x59e19f of Object[_0x2cff7a(0x169)](_0x1c4d5e[_0x2cff7a(0x84)])){const _0x1c78d0=_0x1c4d5e[_0x2cff7a(0x84)][_0x59e19f];_0x1c78d0[_0x2cff7a(0x11b)]===_0x2cff7a(0xbd)&&_0x1c78d0[_0x2cff7a(0x17b)]&&isPendingActivationId(_0x1c78d0['journeyActivationStepId'])&&(_0x1c78d0['journeyActivationStepId']='');if(_0x1c78d0[_0x2cff7a(0x11b)]===_0x2cff7a(0xa8)&&_0x1c78d0[_0x2cff7a(0xfb)])for(const _0x565ed3 of _0x1c78d0[_0x2cff7a(0xfb)]){_0x565ed3[_0x2cff7a(0xe7)]&&isPendingSegmentId(_0x565ed3[_0x2cff7a(0xe7)])&&(_0x565ed3[_0x2cff7a(0xe7)]='');}_0x1c78d0[_0x2cff7a(0x11b)]===_0x2cff7a(0x15c)&&stripWaitStepPendingIds(_0x1c78d0);}}}function resolvePendingIdsInRequest(_0x3a26e8,_0x1e4128,_0x34b870,_0x3c4166,_0x47ad04,_0x4300b1){const _0xacb2ea=a140_0x1e27d0,_0x21814f=(_0x1b4847,_0x29a307)=>{const _0x1b3b13=a140_0x2637;if(!isPendingSegmentId(_0x1b4847))return _0x1b4847;const _0x4d4367=extractPendingSegmentName(_0x1b4847),_0x2fdcb7=_0x3c4166['get'](_0x4d4367);return!_0x2fdcb7&&_0x4300b1['logWarning']?.(_0x1b3b13(0xbf)+_0x4d4367+_0x1b3b13(0xce)+_0x29a307),_0x2fdcb7;};if(_0x3a26e8[_0xacb2ea(0x12f)]['goal']?.[_0xacb2ea(0xe7)]&&isPendingSegmentId(_0x3a26e8[_0xacb2ea(0x12f)][_0xacb2ea(0x9f)]['segmentId'])){const _0x32fcd5=_0x21814f(_0x3a26e8[_0xacb2ea(0x12f)][_0xacb2ea(0x9f)][_0xacb2ea(0xe7)],_0xacb2ea(0x10e));_0x32fcd5&&(_0x3a26e8[_0xacb2ea(0x12f)][_0xacb2ea(0x9f)][_0xacb2ea(0xe7)]=_0x32fcd5);}for(const _0x2b0d73 of _0x3a26e8[_0xacb2ea(0x12f)]['journeyStages']||[]){const _0x2de568=_0x34b870['get'](_0x2b0d73[_0xacb2ea(0x158)][_0xacb2ea(0xea)]());_0x2de568&&(_0x2b0d73['id']=_0x2de568);if(_0x2b0d73['entryCriteria']?.[_0xacb2ea(0xe7)]&&isPendingSegmentId(_0x2b0d73[_0xacb2ea(0x136)][_0xacb2ea(0xe7)])){const _0x49cd12=_0x21814f(_0x2b0d73[_0xacb2ea(0x136)][_0xacb2ea(0xe7)],_0xacb2ea(0xac)+_0x2b0d73[_0xacb2ea(0x158)]+_0xacb2ea(0x12c));_0x49cd12&&(_0x2b0d73[_0xacb2ea(0x136)][_0xacb2ea(0xe7)]=_0x49cd12);}if(_0x2b0d73['exitCriterias'])for(const _0x525d3e of _0x2b0d73[_0xacb2ea(0x88)]){if(_0x525d3e[_0xacb2ea(0xe7)]&&isPendingSegmentId(_0x525d3e[_0xacb2ea(0xe7)])){const _0x573a06=_0x21814f(_0x525d3e['segmentId'],'stage\x20\x27'+_0x2b0d73['name']+'\x27\x20exit\x20criteria');_0x573a06&&(_0x525d3e[_0xacb2ea(0xe7)]=_0x573a06);}}if(_0x2b0d73[_0xacb2ea(0x137)]?.[_0xacb2ea(0xe7)]&&isPendingSegmentId(_0x2b0d73[_0xacb2ea(0x137)]['segmentId'])){const _0x45f240=_0x21814f(_0x2b0d73[_0xacb2ea(0x137)][_0xacb2ea(0xe7)],_0xacb2ea(0xac)+_0x2b0d73[_0xacb2ea(0x158)]+_0xacb2ea(0xb1));_0x45f240&&(_0x2b0d73['milestone']['segmentId']=_0x45f240);}if(_0x2b0d73['steps']){const _0x3fafef=_0x4f32af=>_0x1e4128[_0xacb2ea(0x12f)][_0xacb2ea(0x112)]?.[_0xacb2ea(0xcd)](_0x11af1e=>_0x11af1e[_0xacb2ea(0x158)][_0xacb2ea(0xea)]()===_0x2b0d73['name']['toLowerCase']())?.[_0xacb2ea(0x84)]?.[_0x4f32af];for(const _0x52fedd of Object[_0xacb2ea(0x169)](_0x2b0d73[_0xacb2ea(0x84)])){const _0x41645e=_0x2b0d73[_0xacb2ea(0x84)][_0x52fedd],_0x4f5e91=_0x3fafef(_0x52fedd);if(_0x41645e[_0xacb2ea(0x11b)]===_0xacb2ea(0xbd)&&_0x41645e[_0xacb2ea(0x17b)]&&(isPendingActivationId(_0x41645e[_0xacb2ea(0x17b)])||_0x41645e[_0xacb2ea(0x17b)]==='')){if(_0x4f5e91?.[_0xacb2ea(0x17b)]&&isPendingActivationId(_0x4f5e91[_0xacb2ea(0x17b)])){const _0x37741b=extractPendingActivationName(_0x4f5e91[_0xacb2ea(0x17b)]),_0xbf8aea=_0x47ad04[_0xacb2ea(0x181)](_0x37741b);_0xbf8aea&&(_0x41645e[_0xacb2ea(0x17b)]=_0xbf8aea);}}if(_0x41645e[_0xacb2ea(0x11b)]===_0xacb2ea(0xa8)&&_0x41645e[_0xacb2ea(0xfb)]&&_0x4f5e91?.[_0xacb2ea(0xfb)])for(let _0x95d423=0x0;_0x95d423<_0x41645e[_0xacb2ea(0xfb)][_0xacb2ea(0x10c)];_0x95d423++){const _0x470863=_0x41645e[_0xacb2ea(0xfb)][_0x95d423],_0x14c847=_0x4f5e91[_0xacb2ea(0xfb)][_0x95d423];if(_0x14c847?.[_0xacb2ea(0xe7)]&&isPendingSegmentId(_0x14c847[_0xacb2ea(0xe7)])){const _0x48c186=_0x21814f(_0x14c847[_0xacb2ea(0xe7)],_0xacb2ea(0xac)+_0x2b0d73[_0xacb2ea(0x158)]+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x470863[_0xacb2ea(0x158)]||_0x95d423)+'\x27');_0x48c186&&(_0x470863[_0xacb2ea(0xe7)]=_0x48c186);}}_0x41645e[_0xacb2ea(0x11b)]===_0xacb2ea(0x15c)&&_0x4f5e91?.[_0xacb2ea(0x11b)]==='WaitStep'&&resolveWaitStepPendingIds(_0x41645e,_0x4f5e91,_0x21814f,_0x2b0d73[_0xacb2ea(0x158)]);}}}}
@@ -1 +1 @@
1
- (function(_0x1b8477,_0xa471b3){const _0x2340ca=a141_0x46f7,_0x1604e1=_0x1b8477();while(!![]){try{const _0x4039d4=-parseInt(_0x2340ca(0x19b))/0x1+-parseInt(_0x2340ca(0x192))/0x2*(-parseInt(_0x2340ca(0x19f))/0x3)+parseInt(_0x2340ca(0x19a))/0x4*(-parseInt(_0x2340ca(0x195))/0x5)+-parseInt(_0x2340ca(0x19c))/0x6+parseInt(_0x2340ca(0x197))/0x7*(-parseInt(_0x2340ca(0x193))/0x8)+parseInt(_0x2340ca(0x19d))/0x9+parseInt(_0x2340ca(0x199))/0xa;if(_0x4039d4===_0xa471b3)break;else _0x1604e1['push'](_0x1604e1['shift']());}catch(_0x2a029f){_0x1604e1['push'](_0x1604e1['shift']());}}}(a141_0x5058,0x397f5));export function buildFolderIdToPathMap(_0x27c392){const _0x5a2254=a141_0x46f7,_0x2859a8=new Map(),_0x49e92e=new Map();for(const _0x51d61a of _0x27c392){_0x49e92e[_0x5a2254(0x19e)](_0x51d61a['id'],_0x51d61a);}const _0xd85a62=new Set();for(const _0x2f5359 of _0x27c392){!_0x2f5359[_0x5a2254(0x196)]&&_0xd85a62[_0x5a2254(0x1a0)](_0x2f5359['id']);}function _0x47eae7(_0x594f73){const _0x529509=_0x5a2254;if(_0x2859a8[_0x529509(0x1a1)](_0x594f73['id']))return _0x2859a8['get'](_0x594f73['id']);if(_0xd85a62[_0x529509(0x1a1)](_0x594f73['id']))return _0x2859a8['set'](_0x594f73['id'],''),'';if(_0x594f73[_0x529509(0x196)]){const _0x1e81f2=_0x49e92e['get'](_0x594f73[_0x529509(0x196)]);if(_0x1e81f2){const _0x41604c=_0x47eae7(_0x1e81f2),_0x64bd01=_0x41604c?_0x41604c+'/'+_0x594f73[_0x529509(0x194)]:_0x594f73[_0x529509(0x194)];return _0x2859a8[_0x529509(0x19e)](_0x594f73['id'],_0x64bd01),_0x64bd01;}}const _0xca77c=_0x594f73[_0x529509(0x194)];return _0x2859a8[_0x529509(0x19e)](_0x594f73['id'],_0xca77c),_0xca77c;}for(const _0x483a5e of _0x27c392){_0x47eae7(_0x483a5e);}return _0x2859a8;}export function buildFolderPathToIdMap(_0x588206){const _0x382765=a141_0x46f7,_0x30d86e=new Map(),_0x94da5=new Map();for(const _0x408c3b of _0x588206){_0x94da5['set'](_0x408c3b['id'],_0x408c3b);}const _0x46513b=new Set();for(const _0x42d4e3 of _0x588206){!_0x42d4e3[_0x382765(0x196)]&&_0x46513b['add'](_0x42d4e3['id']);}function _0x3497b1(_0x1c668d){const _0x1a0d1a=_0x382765;if(_0x46513b['has'](_0x1c668d['id']))return'';if(_0x1c668d['parentFolderId']){const _0x5763d2=_0x94da5[_0x1a0d1a(0x198)](_0x1c668d[_0x1a0d1a(0x196)]);if(_0x5763d2){const _0x43f6a7=_0x3497b1(_0x5763d2);return _0x43f6a7?_0x43f6a7+'/'+_0x1c668d[_0x1a0d1a(0x194)]:_0x1c668d[_0x1a0d1a(0x194)];}}return _0x1c668d[_0x1a0d1a(0x194)];}for(const _0x145c1d of _0x588206){const _0xe4a757=_0x3497b1(_0x145c1d);_0x30d86e[_0x382765(0x19e)](_0xe4a757,_0x145c1d['id']);}return _0x30d86e;}export function buildFolderMaps(_0x52d2be){const _0x44a490=a141_0x46f7,_0x251eb0=buildFolderIdToPathMap(_0x52d2be),_0x26a60c=new Map();for(const [_0x528437,_0x55ef63]of _0x251eb0){_0x26a60c[_0x44a490(0x19e)](_0x55ef63,_0x528437);}return{'idToPath':_0x251eb0,'pathToId':_0x26a60c};}function a141_0x46f7(_0x1cb1f4,_0x23ecba){_0x1cb1f4=_0x1cb1f4-0x192;const _0x505864=a141_0x5058();let _0x46f70d=_0x505864[_0x1cb1f4];return _0x46f70d;}function a141_0x5058(){const _0x279f42=['parentFolderId','2590eGnKZI','get','1582540zhlbbr','88096imDFUu','71331mSNpGW','735144qViJFt','3331071DTNWjn','set','3MvnKEy','add','has','920834smIvoD','3048KjzQuJ','name','95lEnOwz'];a141_0x5058=function(){return _0x279f42;};return a141_0x5058();}export function getFolderPath(_0x5a384d,_0x18834e){const _0x37b15d=a141_0x46f7;if(!_0x5a384d)return'';return _0x18834e[_0x37b15d(0x198)](_0x5a384d)??'';}
1
+ function a141_0x4e17(){const _0x58beec=['867752BvrNEP','909990MeaqRS','has','set','200FdgckZ','name','281682pmpXvC','16RXmvUS','6569040FAfeUf','add','5089938ppIWMr','6IknKEW','7IoqFcU','526333KRsPOE','10874347wGlkJz','get','parentFolderId','10Houuxk'];a141_0x4e17=function(){return _0x58beec;};return a141_0x4e17();}(function(_0x4136d4,_0x3bbabe){const _0x32865c=a141_0x4778,_0x1a9dd4=_0x4136d4();while(!![]){try{const _0x60e5a3=-parseInt(_0x32865c(0x137))/0x1+-parseInt(_0x32865c(0x13c))/0x2*(parseInt(_0x32865c(0x135))/0x3)+-parseInt(_0x32865c(0x143))/0x4*(-parseInt(_0x32865c(0x13d))/0x5)+-parseInt(_0x32865c(0x134))/0x6*(-parseInt(_0x32865c(0x136))/0x7)+-parseInt(_0x32865c(0x140))/0x8*(-parseInt(_0x32865c(0x142))/0x9)+-parseInt(_0x32865c(0x13b))/0xa*(parseInt(_0x32865c(0x138))/0xb)+parseInt(_0x32865c(0x144))/0xc;if(_0x60e5a3===_0x3bbabe)break;else _0x1a9dd4['push'](_0x1a9dd4['shift']());}catch(_0x8aebfe){_0x1a9dd4['push'](_0x1a9dd4['shift']());}}}(a141_0x4e17,0x7fd03));export function buildFolderIdToPathMap(_0x2e9023){const _0x508a15=a141_0x4778,_0x40f151=new Map(),_0x55de4c=new Map();for(const _0x5bd5be of _0x2e9023){_0x55de4c[_0x508a15(0x13f)](_0x5bd5be['id'],_0x5bd5be);}const _0x2ee2ce=new Set();for(const _0x5f4b87 of _0x2e9023){!_0x5f4b87['parentFolderId']&&_0x2ee2ce[_0x508a15(0x145)](_0x5f4b87['id']);}function _0x265fec(_0x4edd5c){const _0x315d96=_0x508a15;if(_0x40f151[_0x315d96(0x13e)](_0x4edd5c['id']))return _0x40f151[_0x315d96(0x139)](_0x4edd5c['id']);if(_0x2ee2ce[_0x315d96(0x13e)](_0x4edd5c['id']))return _0x40f151[_0x315d96(0x13f)](_0x4edd5c['id'],''),'';if(_0x4edd5c[_0x315d96(0x13a)]){const _0x15cb8d=_0x55de4c['get'](_0x4edd5c[_0x315d96(0x13a)]);if(_0x15cb8d){const _0x3f1796=_0x265fec(_0x15cb8d),_0x3de607=_0x3f1796?_0x3f1796+'/'+_0x4edd5c[_0x315d96(0x141)]:_0x4edd5c['name'];return _0x40f151[_0x315d96(0x13f)](_0x4edd5c['id'],_0x3de607),_0x3de607;}}const _0x5e0276=_0x4edd5c[_0x315d96(0x141)];return _0x40f151[_0x315d96(0x13f)](_0x4edd5c['id'],_0x5e0276),_0x5e0276;}for(const _0x29bfad of _0x2e9023){_0x265fec(_0x29bfad);}return _0x40f151;}function a141_0x4778(_0x144664,_0xed588b){_0x144664=_0x144664-0x134;const _0x4e1763=a141_0x4e17();let _0x477898=_0x4e1763[_0x144664];return _0x477898;}export function buildFolderPathToIdMap(_0x339d77){const _0xb8334e=a141_0x4778,_0x240a62=new Map(),_0x297197=new Map();for(const _0x4cf597 of _0x339d77){_0x297197[_0xb8334e(0x13f)](_0x4cf597['id'],_0x4cf597);}const _0x3eb9a3=new Set();for(const _0x484003 of _0x339d77){!_0x484003[_0xb8334e(0x13a)]&&_0x3eb9a3[_0xb8334e(0x145)](_0x484003['id']);}function _0x2b86a7(_0x38442f){const _0x57d02d=_0xb8334e;if(_0x3eb9a3[_0x57d02d(0x13e)](_0x38442f['id']))return'';if(_0x38442f[_0x57d02d(0x13a)]){const _0x410e1e=_0x297197[_0x57d02d(0x139)](_0x38442f[_0x57d02d(0x13a)]);if(_0x410e1e){const _0x202c88=_0x2b86a7(_0x410e1e);return _0x202c88?_0x202c88+'/'+_0x38442f[_0x57d02d(0x141)]:_0x38442f['name'];}}return _0x38442f[_0x57d02d(0x141)];}for(const _0xab02a3 of _0x339d77){const _0x149b98=_0x2b86a7(_0xab02a3);_0x240a62['set'](_0x149b98,_0xab02a3['id']);}return _0x240a62;}export function buildFolderMaps(_0x590b6b){const _0x587788=buildFolderIdToPathMap(_0x590b6b),_0x1ac9f0=new Map();for(const [_0x4dc70a,_0x4bdbd7]of _0x587788){_0x1ac9f0['set'](_0x4bdbd7,_0x4dc70a);}return{'idToPath':_0x587788,'pathToId':_0x1ac9f0};}export function getFolderPath(_0x2be3dd,_0x30892b){const _0x34c4ff=a141_0x4778;if(!_0x2be3dd)return'';return _0x30892b[_0x34c4ff(0x139)](_0x2be3dd)??'';}
@@ -1 +1 @@
1
- (function(_0x3a9198,_0x291cef){const _0x4025fc=a142_0x1fde,_0x43de19=_0x3a9198();while(!![]){try{const _0x22c99c=parseInt(_0x4025fc(0x108))/0x1*(-parseInt(_0x4025fc(0x122))/0x2)+parseInt(_0x4025fc(0xf6))/0x3*(-parseInt(_0x4025fc(0x11b))/0x4)+parseInt(_0x4025fc(0xf2))/0x5*(parseInt(_0x4025fc(0xfd))/0x6)+-parseInt(_0x4025fc(0x112))/0x7+-parseInt(_0x4025fc(0x100))/0x8+parseInt(_0x4025fc(0xf8))/0x9*(parseInt(_0x4025fc(0x106))/0xa)+parseInt(_0x4025fc(0xf3))/0xb;if(_0x22c99c===_0x291cef)break;else _0x43de19['push'](_0x43de19['shift']());}catch(_0x127e60){_0x43de19['push'](_0x43de19['shift']());}}}(a142_0x5e8d,0x28aae));import a142_0x423373 from'path';import{parse as a142_0x249842}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x23583f){const _0x11732d=a142_0x1fde;if(!_0x23583f||_0x23583f[_0x11732d(0xfb)]()==='')throw new Error(_0x11732d(0x116));const _0x4fc9ce=_0x23583f['trim']();if(_0x4fc9ce==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x23583f};const _0x27b93f=_0x4fc9ce[_0x11732d(0x11f)]('/')?_0x4fc9ce[_0x11732d(0xfc)](0x1):_0x4fc9ce,_0x481e52=_0x27b93f['split']('/')[_0x11732d(0x118)](_0x535dec=>_0x535dec!=='');if(_0x481e52[_0x11732d(0x10d)]===0x0)throw new Error(_0x11732d(0x113));const _0xd25abb=_0x4fc9ce[_0x11732d(0x11f)]('/')||!isRelativePathSegment(_0x481e52[0x0]);for(const _0x35a734 of _0x481e52){validatePathSegment(_0x35a734);}return{'segments':_0x481e52,'isAbsolute':_0xd25abb,'raw':_0x23583f};}function isRelativePathSegment(_0x52674d){return _0x52674d==='.'||_0x52674d==='..';}function validatePathSegment(_0x3a52a0){const _0x134ad3=a142_0x1fde;if(_0x3a52a0==='')throw new Error(_0x134ad3(0x10c));if(_0x3a52a0==='.'||_0x3a52a0==='..')return;if(/[\x00-\x1F\x7F]/[_0x134ad3(0x104)](_0x3a52a0))throw new Error(_0x134ad3(0x120)+_0x3a52a0);if(_0x3a52a0!==_0x3a52a0[_0x134ad3(0xfb)]()){}}export function validatePath(_0x5a15c4){const _0x1507f8=a142_0x1fde;if(_0x5a15c4[_0x1507f8(0x11a)][_0x1507f8(0x10d)]===0x0&&!_0x5a15c4[_0x1507f8(0xf7)])throw new Error(_0x1507f8(0x10a));if(_0x5a15c4[_0x1507f8(0xf7)]){if(_0x5a15c4['segments'][0x0]==='..')throw new Error(_0x1507f8(0x11e));let _0x76c980=0x0;for(const _0x56df85 of _0x5a15c4[_0x1507f8(0x11a)]){if(_0x56df85==='..'){if(_0x76c980===0x0)throw new Error(_0x1507f8(0x111));_0x76c980--;}else _0x56df85!=='.'&&_0x76c980++;}}}export function joinPaths(_0x521efd,_0x5554e3){const _0x52d498=a142_0x1fde;if(!_0x521efd||_0x521efd==='/')return _0x5554e3;if(!_0x5554e3||_0x5554e3==='.')return _0x521efd;if(_0x5554e3[_0x52d498(0x11f)]('/'))return _0x5554e3;const _0x331b31=parsePath(_0x521efd),_0x4b96d3=parsePath(_0x5554e3),_0x5621b2=[..._0x331b31['segments']];for(const _0x249b5f of _0x4b96d3[_0x52d498(0x11a)]){if(_0x249b5f==='.')continue;else{if(_0x249b5f==='..'){if(_0x5621b2[_0x52d498(0x10d)]===0x0)throw new Error('Cannot\x20navigate\x20above\x20root');_0x5621b2['pop']();}else _0x5621b2[_0x52d498(0x121)](_0x249b5f);}}const _0x201931=_0x5621b2['join']('/');return _0x331b31[_0x52d498(0x10b)][_0x52d498(0x11f)]('/')?'/'+_0x201931:_0x201931;}export function normalizePath(_0x415d9b){const _0x530a79=a142_0x1fde,_0x4bfbca=parsePath(_0x415d9b),_0x173866=[];for(const _0x4a5315 of _0x4bfbca[_0x530a79(0x11a)]){if(_0x4a5315==='.')continue;else{if(_0x4a5315==='..'){if(_0x173866[_0x530a79(0x10d)]===0x0){if(_0x4bfbca[_0x530a79(0xf7)])throw new Error(_0x530a79(0x101));_0x173866[_0x530a79(0x121)]('..');}else _0x173866[_0x173866[_0x530a79(0x10d)]-0x1]==='..'?_0x173866[_0x530a79(0x121)]('..'):_0x173866['pop']();}else _0x173866[_0x530a79(0x121)](_0x4a5315);}}if(_0x173866['length']===0x0)return _0x4bfbca[_0x530a79(0xf7)]?'/':'.';const _0xb76903=_0x173866[_0x530a79(0xf4)]('/');return _0x4bfbca['raw']['startsWith']('/')?'/'+_0xb76903:_0xb76903;}export function getParentPath(_0x397431){const _0x46bcb7=a142_0x1fde,_0x27b758=parsePath(_0x397431);if(_0x27b758[_0x46bcb7(0x11a)][_0x46bcb7(0x10d)]<=0x1)return'/';const _0x272a73=_0x27b758['segments'][_0x46bcb7(0x115)](0x0,-0x1)['join']('/');return _0x27b758[_0x46bcb7(0x10b)]['startsWith']('/')?'/'+_0x272a73:_0x272a73;}function a142_0x5e8d(){const _0x22bff2=['90ULDXWF','parse','215062epIfza','.yml','Relative\x20path\x20cannot\x20be\x20empty','raw','Path\x20segment\x20cannot\x20be\x20empty','length','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','dirname','name','Path\x20attempts\x20to\x20navigate\x20above\x20root','2082122GlpjBG','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','root','slice','Path\x20cannot\x20be\x20empty','parent_segment','filter','replace','segments','12OvFoAm','tdx.json','Cannot\x20split\x20empty\x20path','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','startsWith','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','push','2vkZGuA','33610sdtAvY','9213919GosgAp','join','File\x20not\x20found:\x20','85713QdmNSJ','isAbsolute','94518JvJPOC','readFile','endsWith','trim','substring','108yGhVHg','.yaml','No\x20tdx.json\x20found\x20for\x20file:\x20','2306784OaGCPP','Cannot\x20navigate\x20above\x20root','segment','journey','test','exists'];a142_0x5e8d=function(){return _0x22bff2;};return a142_0x5e8d();}export function getBaseName(_0x5960c3){const _0x3e1a6d=a142_0x1fde,_0x563b6f=parsePath(_0x5960c3);return _0x563b6f[_0x3e1a6d(0x11a)][_0x563b6f[_0x3e1a6d(0x11a)][_0x3e1a6d(0x10d)]-0x1]||'';}export function isChildPath(_0x99cef3,_0x99dd05){const _0x324d0e=a142_0x1fde,_0x521aa6=parsePath(_0x99cef3),_0x565e7c=parsePath(_0x99dd05);if(_0x521aa6[_0x324d0e(0x11a)][_0x324d0e(0x10d)]<=_0x565e7c[_0x324d0e(0x11a)][_0x324d0e(0x10d)])return![];for(let _0x197e36=0x0;_0x197e36<_0x565e7c['segments'][_0x324d0e(0x10d)];_0x197e36++){if(_0x521aa6['segments'][_0x197e36]!==_0x565e7c[_0x324d0e(0x11a)][_0x197e36])return![];}return!![];}function a142_0x1fde(_0x5d94ab,_0x459785){_0x5d94ab=_0x5d94ab-0xf2;const _0x5e8d4d=a142_0x5e8d();let _0x1fde7c=_0x5e8d4d[_0x5d94ab];return _0x1fde7c;}export function splitPath(_0xff220d){const _0x12c543=a142_0x1fde,_0x146cd0=parsePath(_0xff220d);if(_0x146cd0[_0x12c543(0x11a)][_0x12c543(0x10d)]===0x0)throw new Error(_0x12c543(0x11d));if(_0x146cd0[_0x12c543(0x11a)]['length']===0x1)return{'parent':_0x146cd0['segments'][0x0]};return{'parent':_0x146cd0[_0x12c543(0x11a)][0x0],'child':_0x146cd0['segments']['slice'](0x1)[_0x12c543(0xf4)]('/')};}export function isYamlFilePath(_0x119269){const _0x187448=a142_0x1fde;return _0x119269[_0x187448(0xfa)](_0x187448(0x109))||_0x119269['endsWith'](_0x187448(0xfe));}export async function resolveYamlFilePath(_0x20e5f1,_0x3a1f5e=nodeFileSystem){const _0x165d55=a142_0x1fde,_0x2adb42=a142_0x423373['resolve'](_0x20e5f1);if(!await _0x3a1f5e[_0x165d55(0x105)](_0x2adb42))throw new Error(_0x165d55(0xf5)+_0x20e5f1);let _0x382901=a142_0x423373[_0x165d55(0x10f)](_0x2adb42),_0x52ca66=null,_0x593d32=null;const _0x434d43=a142_0x423373[_0x165d55(0x107)](_0x382901)[_0x165d55(0x114)];while(_0x382901!==_0x434d43){const _0x5db579=a142_0x423373['join'](_0x382901,_0x165d55(0x11c));if(await _0x3a1f5e['exists'](_0x5db579)){_0x52ca66=_0x5db579,_0x593d32=_0x382901;break;}_0x382901=a142_0x423373[_0x165d55(0x10f)](_0x382901);}if(!_0x52ca66||!_0x593d32)throw new Error(_0x165d55(0xff)+_0x20e5f1+'\x0a'+_0x165d55(0x10e));const _0x2e47e5=await _0x3a1f5e['readFile'](_0x52ca66),_0x4120d8=JSON[_0x165d55(0x107)](_0x2e47e5),_0xf1d6e8=_0x4120d8[_0x165d55(0x117)];if(!_0xf1d6e8)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x1c4be9=await _0x3a1f5e[_0x165d55(0xf9)](_0x2adb42),_0x34d543=a142_0x249842(_0x1c4be9),_0x5d7725=_0x34d543[_0x165d55(0x110)];if(!_0x5d7725)throw new Error('Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'+_0x20e5f1);const _0x1d98f1=_0x34d543['type']===_0x165d55(0x103)?_0x165d55(0x103):_0x165d55(0x102),_0xee7ab7=a142_0x423373['relative'](_0x593d32,_0x2adb42),_0x566e2d=a142_0x423373[_0x165d55(0x10f)](_0xee7ab7),_0x5634a8=_0x566e2d==='.'?'':_0x566e2d[_0x165d55(0x119)](/\\/g,'/'),_0x1ef39a=_0x5634a8?_0xf1d6e8+'/'+_0x5634a8+'/'+_0x5d7725:_0xf1d6e8+'/'+_0x5d7725;return{'parentSegment':_0xf1d6e8,'segmentName':_0x5d7725,'folderPath':_0x5634a8,'fullPath':_0x1ef39a,'resourceType':_0x1d98f1,'content':_0x1c4be9};}
1
+ (function(_0x1d37c1,_0x22e15a){const _0x25807f=a142_0x5756,_0x5dcfbc=_0x1d37c1();while(!![]){try{const _0x1bc1df=parseInt(_0x25807f(0x127))/0x1*(-parseInt(_0x25807f(0x140))/0x2)+-parseInt(_0x25807f(0x13e))/0x3+-parseInt(_0x25807f(0x13d))/0x4+parseInt(_0x25807f(0x121))/0x5+parseInt(_0x25807f(0x125))/0x6*(-parseInt(_0x25807f(0x11d))/0x7)+-parseInt(_0x25807f(0x144))/0x8*(-parseInt(_0x25807f(0x146))/0x9)+parseInt(_0x25807f(0x136))/0xa;if(_0x1bc1df===_0x22e15a)break;else _0x5dcfbc['push'](_0x5dcfbc['shift']());}catch(_0x451d30){_0x5dcfbc['push'](_0x5dcfbc['shift']());}}}(a142_0x3eac,0x9979c));import a142_0x46be85 from'path';import{parse as a142_0x4f4b10}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x56f6e9){const _0x4a48d3=a142_0x5756;if(!_0x56f6e9||_0x56f6e9[_0x4a48d3(0x122)]()==='')throw new Error(_0x4a48d3(0x129));const _0x420302=_0x56f6e9['trim']();if(_0x420302==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x56f6e9};const _0x4666b2=_0x420302['startsWith']('/')?_0x420302[_0x4a48d3(0x12c)](0x1):_0x420302,_0x2ad4e8=_0x4666b2['split']('/')[_0x4a48d3(0x124)](_0x2471eb=>_0x2471eb!=='');if(_0x2ad4e8['length']===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x13dbc5=_0x420302['startsWith']('/')||!isRelativePathSegment(_0x2ad4e8[0x0]);for(const _0x5af593 of _0x2ad4e8){validatePathSegment(_0x5af593);}return{'segments':_0x2ad4e8,'isAbsolute':_0x13dbc5,'raw':_0x56f6e9};}function a142_0x3eac(){const _0x371d97=['tdx.json','Path\x20cannot\x20be\x20empty','type','root','substring','Path\x20segment\x20cannot\x20be\x20empty','.yml','segments','parse','.yaml','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','startsWith','relative','raw','29430170CYJsvV','File\x20not\x20found:\x20','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','pop','journey','join','length','4547852pHSEYV','1368330ITvgga','dirname','1428494HYVwSD','exists','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','slice','8pxASXv','replace','10278207kopduK','push','readFile','resolve','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','Cannot\x20navigate\x20above\x20root','4306078XyOfnN','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','No\x20tdx.json\x20found\x20for\x20file:\x20','endsWith','406120bUcEKm','trim','isAbsolute','filter','12lVhoAb','Relative\x20path\x20cannot\x20be\x20empty','1CUoNll'];a142_0x3eac=function(){return _0x371d97;};return a142_0x3eac();}function isRelativePathSegment(_0x5cf2c8){return _0x5cf2c8==='.'||_0x5cf2c8==='..';}function validatePathSegment(_0x84ab23){const _0x5a71e7=a142_0x5756;if(_0x84ab23==='')throw new Error(_0x5a71e7(0x12d));if(_0x84ab23==='.'||_0x84ab23==='..')return;if(/[\x00-\x1F\x7F]/['test'](_0x84ab23))throw new Error(_0x5a71e7(0x11b)+_0x84ab23);if(_0x84ab23!==_0x84ab23[_0x5a71e7(0x122)]()){}}export function validatePath(_0x325f33){const _0x59ca3b=a142_0x5756;if(_0x325f33[_0x59ca3b(0x12f)][_0x59ca3b(0x13c)]===0x0&&!_0x325f33['isAbsolute'])throw new Error(_0x59ca3b(0x126));if(_0x325f33[_0x59ca3b(0x123)]){if(_0x325f33[_0x59ca3b(0x12f)][0x0]==='..')throw new Error(_0x59ca3b(0x132));let _0x1d7084=0x0;for(const _0x2c02d3 of _0x325f33['segments']){if(_0x2c02d3==='..'){if(_0x1d7084===0x0)throw new Error('Path\x20attempts\x20to\x20navigate\x20above\x20root');_0x1d7084--;}else _0x2c02d3!=='.'&&_0x1d7084++;}}}function a142_0x5756(_0x196e7e,_0x2741fd){_0x196e7e=_0x196e7e-0x118;const _0x3eac6d=a142_0x3eac();let _0x575640=_0x3eac6d[_0x196e7e];return _0x575640;}export function joinPaths(_0x17cd24,_0x151468){const _0x585267=a142_0x5756;if(!_0x17cd24||_0x17cd24==='/')return _0x151468;if(!_0x151468||_0x151468==='.')return _0x17cd24;if(_0x151468['startsWith']('/'))return _0x151468;const _0x6943b2=parsePath(_0x17cd24),_0x3ec7e3=parsePath(_0x151468),_0x3f4fb8=[..._0x6943b2[_0x585267(0x12f)]];for(const _0x44e254 of _0x3ec7e3[_0x585267(0x12f)]){if(_0x44e254==='.')continue;else{if(_0x44e254==='..'){if(_0x3f4fb8[_0x585267(0x13c)]===0x0)throw new Error('Cannot\x20navigate\x20above\x20root');_0x3f4fb8['pop']();}else _0x3f4fb8[_0x585267(0x118)](_0x44e254);}}const _0x456e04=_0x3f4fb8[_0x585267(0x13b)]('/');return _0x6943b2[_0x585267(0x135)][_0x585267(0x133)]('/')?'/'+_0x456e04:_0x456e04;}export function normalizePath(_0x4b9fb7){const _0x1738e0=a142_0x5756,_0x1a5902=parsePath(_0x4b9fb7),_0x157b3b=[];for(const _0x314d94 of _0x1a5902[_0x1738e0(0x12f)]){if(_0x314d94==='.')continue;else{if(_0x314d94==='..'){if(_0x157b3b[_0x1738e0(0x13c)]===0x0){if(_0x1a5902['isAbsolute'])throw new Error(_0x1738e0(0x11c));_0x157b3b[_0x1738e0(0x118)]('..');}else _0x157b3b[_0x157b3b[_0x1738e0(0x13c)]-0x1]==='..'?_0x157b3b[_0x1738e0(0x118)]('..'):_0x157b3b[_0x1738e0(0x139)]();}else _0x157b3b[_0x1738e0(0x118)](_0x314d94);}}if(_0x157b3b['length']===0x0)return _0x1a5902['isAbsolute']?'/':'.';const _0x167738=_0x157b3b[_0x1738e0(0x13b)]('/');return _0x1a5902[_0x1738e0(0x135)][_0x1738e0(0x133)]('/')?'/'+_0x167738:_0x167738;}export function getParentPath(_0x1092d6){const _0x4816d7=a142_0x5756,_0x3e747c=parsePath(_0x1092d6);if(_0x3e747c['segments']['length']<=0x1)return'/';const _0x10936c=_0x3e747c['segments']['slice'](0x0,-0x1)[_0x4816d7(0x13b)]('/');return _0x3e747c[_0x4816d7(0x135)][_0x4816d7(0x133)]('/')?'/'+_0x10936c:_0x10936c;}export function getBaseName(_0x37e3d0){const _0x271802=a142_0x5756,_0x553bc5=parsePath(_0x37e3d0);return _0x553bc5['segments'][_0x553bc5[_0x271802(0x12f)][_0x271802(0x13c)]-0x1]||'';}export function isChildPath(_0x3332a9,_0xc03c56){const _0x473763=a142_0x5756,_0x106274=parsePath(_0x3332a9),_0x549797=parsePath(_0xc03c56);if(_0x106274[_0x473763(0x12f)][_0x473763(0x13c)]<=_0x549797[_0x473763(0x12f)][_0x473763(0x13c)])return![];for(let _0x1fe604=0x0;_0x1fe604<_0x549797[_0x473763(0x12f)][_0x473763(0x13c)];_0x1fe604++){if(_0x106274['segments'][_0x1fe604]!==_0x549797['segments'][_0x1fe604])return![];}return!![];}export function splitPath(_0x21d71c){const _0x4601f9=a142_0x5756,_0x3f9537=parsePath(_0x21d71c);if(_0x3f9537[_0x4601f9(0x12f)]['length']===0x0)throw new Error('Cannot\x20split\x20empty\x20path');if(_0x3f9537[_0x4601f9(0x12f)][_0x4601f9(0x13c)]===0x1)return{'parent':_0x3f9537[_0x4601f9(0x12f)][0x0]};return{'parent':_0x3f9537[_0x4601f9(0x12f)][0x0],'child':_0x3f9537[_0x4601f9(0x12f)][_0x4601f9(0x143)](0x1)[_0x4601f9(0x13b)]('/')};}export function isYamlFilePath(_0x4f2b6e){const _0x4c88d3=a142_0x5756;return _0x4f2b6e[_0x4c88d3(0x120)](_0x4c88d3(0x12e))||_0x4f2b6e[_0x4c88d3(0x120)](_0x4c88d3(0x131));}export async function resolveYamlFilePath(_0x4b250b,_0x1383a7=nodeFileSystem){const _0x1e7df0=a142_0x5756,_0x5d5676=a142_0x46be85[_0x1e7df0(0x11a)](_0x4b250b);if(!await _0x1383a7[_0x1e7df0(0x141)](_0x5d5676))throw new Error(_0x1e7df0(0x137)+_0x4b250b);let _0x40f732=a142_0x46be85['dirname'](_0x5d5676),_0x3b7853=null,_0x42eceb=null;const _0x320aac=a142_0x46be85[_0x1e7df0(0x130)](_0x40f732)[_0x1e7df0(0x12b)];while(_0x40f732!==_0x320aac){const _0x5bb8a9=a142_0x46be85[_0x1e7df0(0x13b)](_0x40f732,_0x1e7df0(0x128));if(await _0x1383a7[_0x1e7df0(0x141)](_0x5bb8a9)){_0x3b7853=_0x5bb8a9,_0x42eceb=_0x40f732;break;}_0x40f732=a142_0x46be85[_0x1e7df0(0x13f)](_0x40f732);}if(!_0x3b7853||!_0x42eceb)throw new Error(_0x1e7df0(0x11f)+_0x4b250b+'\x0a'+_0x1e7df0(0x142));const _0x566e88=await _0x1383a7[_0x1e7df0(0x119)](_0x3b7853),_0x408eed=JSON[_0x1e7df0(0x130)](_0x566e88),_0x29f84c=_0x408eed['parent_segment'];if(!_0x29f84c)throw new Error(_0x1e7df0(0x138));const _0x306656=await _0x1383a7[_0x1e7df0(0x119)](_0x5d5676),_0x4aae6b=a142_0x4f4b10(_0x306656),_0x32f38f=_0x4aae6b['name'];if(!_0x32f38f)throw new Error(_0x1e7df0(0x11e)+_0x4b250b);const _0x2504a5=_0x4aae6b[_0x1e7df0(0x12a)]===_0x1e7df0(0x13a)?_0x1e7df0(0x13a):'segment',_0x2bd7d1=a142_0x46be85[_0x1e7df0(0x134)](_0x42eceb,_0x5d5676),_0x41857f=a142_0x46be85[_0x1e7df0(0x13f)](_0x2bd7d1),_0x4d2b40=_0x41857f==='.'?'':_0x41857f[_0x1e7df0(0x145)](/\\/g,'/'),_0x511c1f=_0x4d2b40?_0x29f84c+'/'+_0x4d2b40+'/'+_0x32f38f:_0x29f84c+'/'+_0x32f38f;return{'parentSegment':_0x29f84c,'segmentName':_0x32f38f,'folderPath':_0x4d2b40,'fullPath':_0x511c1f,'resourceType':_0x2504a5,'content':_0x306656};}
@@ -1 +1 @@
1
- function a143_0x5455(_0x315dfa,_0xa00340){_0x315dfa=_0x315dfa-0x196;const _0x4203fd=a143_0x4203();let _0x545595=_0x4203fd[_0x315dfa];return _0x545595;}(function(_0x498c75,_0x2df1ad){const _0x20b995=a143_0x5455,_0xa8345c=_0x498c75();while(!![]){try{const _0xa70e9a=-parseInt(_0x20b995(0x1a4))/0x1*(-parseInt(_0x20b995(0x19f))/0x2)+parseInt(_0x20b995(0x19a))/0x3*(parseInt(_0x20b995(0x198))/0x4)+-parseInt(_0x20b995(0x19b))/0x5+parseInt(_0x20b995(0x1a0))/0x6*(-parseInt(_0x20b995(0x199))/0x7)+-parseInt(_0x20b995(0x1a5))/0x8*(-parseInt(_0x20b995(0x1a1))/0x9)+parseInt(_0x20b995(0x1a3))/0xa+-parseInt(_0x20b995(0x19c))/0xb;if(_0xa70e9a===_0x2df1ad)break;else _0xa8345c['push'](_0xa8345c['shift']());}catch(_0x2d7751){_0xa8345c['push'](_0xa8345c['shift']());}}}(a143_0x4203,0xb1c62));export function parseSegmentRef(_0x295681){const _0x282d2=a143_0x5455,_0x3d1be8=_0x295681[_0x282d2(0x19e)]('/');if(_0x3d1be8===-0x1)return{'parentId':_0x295681};if(_0x3d1be8===0x0)throw new Error(_0x282d2(0x1a2)+_0x295681+_0x282d2(0x19d));const _0x37ea1f=_0x295681[_0x282d2(0x197)](0x0,_0x3d1be8),_0x3099ab=_0x295681[_0x282d2(0x197)](_0x3d1be8+0x1);if(_0x3099ab==='')throw new Error(_0x282d2(0x1a2)+_0x295681+_0x282d2(0x196));return{'parentId':_0x37ea1f,'childId':_0x3099ab};}function a143_0x4203(){const _0x536e6b=['substring','6692pqselj','21jDuWSJ','1083skwnzc','3122960GFloQr','8588085VnbGgA','.\x20Parent\x20name\x20cannot\x20be\x20empty','indexOf','1204666lJoCSV','659310ufomZT','10994463MIJoxy','Invalid\x20segment\x20reference\x20format:\x20','352510ufJkwU','1InSSKO','8MWYcSl','.\x20Child\x20name\x20cannot\x20be\x20empty'];a143_0x4203=function(){return _0x536e6b;};return a143_0x4203();}
1
+ (function(_0x136ac3,_0x18a134){const _0x531da5=a143_0x3638,_0xe52e5c=_0x136ac3();while(!![]){try{const _0x4e3d09=parseInt(_0x531da5(0xbe))/0x1*(parseInt(_0x531da5(0xc5))/0x2)+-parseInt(_0x531da5(0xc4))/0x3+parseInt(_0x531da5(0xc6))/0x4*(parseInt(_0x531da5(0xc2))/0x5)+-parseInt(_0x531da5(0xc0))/0x6+-parseInt(_0x531da5(0xc7))/0x7+parseInt(_0x531da5(0xbf))/0x8+-parseInt(_0x531da5(0xc3))/0x9;if(_0x4e3d09===_0x18a134)break;else _0xe52e5c['push'](_0xe52e5c['shift']());}catch(_0x14e233){_0xe52e5c['push'](_0xe52e5c['shift']());}}}(a143_0x56a8,0xd1239));function a143_0x3638(_0x3d82e9,_0x3a0379){_0x3d82e9=_0x3d82e9-0xbb;const _0x56a810=a143_0x56a8();let _0x3638a5=_0x56a810[_0x3d82e9];return _0x3638a5;}export function parseSegmentRef(_0x1a2794){const _0x4ff153=a143_0x3638,_0x2a42a7=_0x1a2794[_0x4ff153(0xbc)]('/');if(_0x2a42a7===-0x1)return{'parentId':_0x1a2794};if(_0x2a42a7===0x0)throw new Error(_0x4ff153(0xc8)+_0x1a2794+_0x4ff153(0xc1));const _0x2bd9fd=_0x1a2794[_0x4ff153(0xbb)](0x0,_0x2a42a7),_0xf273f3=_0x1a2794[_0x4ff153(0xbb)](_0x2a42a7+0x1);if(_0xf273f3==='')throw new Error(_0x4ff153(0xc8)+_0x1a2794+_0x4ff153(0xbd));return{'parentId':_0x2bd9fd,'childId':_0xf273f3};}function a143_0x56a8(){const _0x408d4d=['2495601ZURRjN','44894gIwNmq','4gBmUvJ','912548KsPrXT','Invalid\x20segment\x20reference\x20format:\x20','substring','indexOf','.\x20Child\x20name\x20cannot\x20be\x20empty','10gmuefq','7630512JTipec','346836QsVPWg','.\x20Parent\x20name\x20cannot\x20be\x20empty','7735545LHLGwU','7638507KYEZLs'];a143_0x56a8=function(){return _0x408d4d;};return a143_0x56a8();}