@treasuredata/tdx 2026.3.36 → 2026.3.38

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 (243) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/auth-login-command.js +1 -1
  13. package/dist/commands/cas-command.js +1 -1
  14. package/dist/commands/cas-segment-command.js +1 -1
  15. package/dist/commands/chat-command.js +1 -1
  16. package/dist/commands/claude-command.js +1 -1
  17. package/dist/commands/claude-statusline-command.js +1 -1
  18. package/dist/commands/claude-usage-command.js +1 -1
  19. package/dist/commands/command.js +1 -1
  20. package/dist/commands/connection-command.js +1 -1
  21. package/dist/commands/databases.js +1 -1
  22. package/dist/commands/delivery-command.js +1 -1
  23. package/dist/commands/describe.js +1 -1
  24. package/dist/commands/engage-campaign-pull-command.js +1 -1
  25. package/dist/commands/engage-campaign-push-command.js +1 -1
  26. package/dist/commands/engage-campaign-validate-command.js +1 -1
  27. package/dist/commands/engage-command.js +1 -1
  28. package/dist/commands/engage-template-pull-command.js +1 -1
  29. package/dist/commands/engage-template-push-command.js +1 -1
  30. package/dist/commands/engage-template-validate-command.js +1 -1
  31. package/dist/commands/job-command.js +1 -1
  32. package/dist/commands/journey-command.js +1 -1
  33. package/dist/commands/journey-validate-command.js +1 -1
  34. package/dist/commands/llm-command.js +1 -1
  35. package/dist/commands/mcp-command.js +1 -1
  36. package/dist/commands/parent-segment-command.js +1 -1
  37. package/dist/commands/policy-command.js +1 -1
  38. package/dist/commands/profile-command.js +1 -1
  39. package/dist/commands/profiles-command.js +1 -1
  40. package/dist/commands/query-command.js +1 -1
  41. package/dist/commands/schedule-command.js +1 -1
  42. package/dist/commands/segment-command.js +1 -1
  43. package/dist/commands/segment-create-command.js +1 -1
  44. package/dist/commands/segment-fields-command.js +1 -1
  45. package/dist/commands/segment-pull-command.js +1 -1
  46. package/dist/commands/segment-push-command.js +1 -1
  47. package/dist/commands/segment-update-command.js +1 -1
  48. package/dist/commands/segment-use-command.js +1 -1
  49. package/dist/commands/segment-validate-command.js +1 -1
  50. package/dist/commands/segments.js +1 -1
  51. package/dist/commands/show.js +1 -1
  52. package/dist/commands/status-command.js +1 -1
  53. package/dist/commands/tables.js +1 -1
  54. package/dist/commands/unset-command.js +1 -1
  55. package/dist/commands/upgrade-command.js +1 -1
  56. package/dist/commands/use-command.js +1 -1
  57. package/dist/commands/user-command.js +1 -1
  58. package/dist/commands/work-command.d.ts +8 -2
  59. package/dist/commands/work-command.d.ts.map +1 -1
  60. package/dist/commands/work-command.js +1 -1
  61. package/dist/commands/work-command.js.map +1 -1
  62. package/dist/commands/workflow-command.js +1 -1
  63. package/dist/core/auth.js +1 -1
  64. package/dist/core/command-output.js +1 -1
  65. package/dist/core/config.js +1 -1
  66. package/dist/core/connection-cache.js +1 -1
  67. package/dist/core/constants.js +1 -1
  68. package/dist/core/credential-cache.js +1 -1
  69. package/dist/core/global-context.js +1 -1
  70. package/dist/core/keychain.js +1 -1
  71. package/dist/core/oauth-keychain.js +1 -1
  72. package/dist/core/oauth.js +1 -1
  73. package/dist/core/profile.js +1 -1
  74. package/dist/core/project-config.js +1 -1
  75. package/dist/core/session.js +1 -1
  76. package/dist/core/user-cache.js +1 -1
  77. package/dist/core/version.js +1 -1
  78. package/dist/index.js +1 -1
  79. package/dist/mcp/server.js +1 -1
  80. package/dist/mcp/tools/index.js +1 -1
  81. package/dist/mcp/tools/tdx-run.js +1 -1
  82. package/dist/mcp/tools/tdx-search.js +1 -1
  83. package/dist/mcp/utils.js +1 -1
  84. package/dist/proxy/claude-usage-tracker.js +1 -1
  85. package/dist/proxy/passthrough-server.js +1 -1
  86. package/dist/proxy/sse-usage-parser.js +1 -1
  87. package/dist/sdk/agent/agent-config.js +1 -1
  88. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  89. package/dist/sdk/agent/agent-yaml.js +1 -1
  90. package/dist/sdk/agent/test/evaluator.js +1 -1
  91. package/dist/sdk/agent/test/executor.js +1 -1
  92. package/dist/sdk/agent/test/index.js +1 -1
  93. package/dist/sdk/agent/test/output.js +1 -1
  94. package/dist/sdk/agent/test/parser.js +1 -1
  95. package/dist/sdk/agent/tool-target-registry.js +1 -1
  96. package/dist/sdk/api.js +1 -1
  97. package/dist/sdk/cas/cas-api-client.js +1 -1
  98. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  99. package/dist/sdk/cas/cas-segment-yaml.d.ts.map +1 -1
  100. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  101. package/dist/sdk/cas/cas-segment-yaml.js.map +1 -1
  102. package/dist/sdk/cas/index.js +1 -1
  103. package/dist/sdk/cas/pull-workflow.js +1 -1
  104. package/dist/sdk/cas/push-workflow.js +1 -1
  105. package/dist/sdk/client/cdp-api-client.js +1 -1
  106. package/dist/sdk/client/delivery-api-client.js +1 -1
  107. package/dist/sdk/client/endpoints.js +1 -1
  108. package/dist/sdk/client/engage-api-client.js +1 -1
  109. package/dist/sdk/client/http-client.js +1 -1
  110. package/dist/sdk/client/llm-api-client.js +1 -1
  111. package/dist/sdk/client/oauth-refresh.js +1 -1
  112. package/dist/sdk/client/rate-limiter.js +1 -1
  113. package/dist/sdk/client/td-api-client.js +1 -1
  114. package/dist/sdk/client/trino-api-client.js +1 -1
  115. package/dist/sdk/client/workflow-client.js +1 -1
  116. package/dist/sdk/connection-validator.js +1 -1
  117. package/dist/sdk/connection.js +1 -1
  118. package/dist/sdk/delivery.js +1 -1
  119. package/dist/sdk/engage/campaign-pull.js +1 -1
  120. package/dist/sdk/engage/campaign-push.js +1 -1
  121. package/dist/sdk/engage/campaign-validator.js +1 -1
  122. package/dist/sdk/engage/campaign-yaml.js +1 -1
  123. package/dist/sdk/engage/template-pull.js +1 -1
  124. package/dist/sdk/engage/template-push.js +1 -1
  125. package/dist/sdk/engage/template-validator.js +1 -1
  126. package/dist/sdk/engage/template-yaml.js +1 -1
  127. package/dist/sdk/engage/types/campaign-def.js +1 -1
  128. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  129. package/dist/sdk/engage/types/template-schema.js +1 -1
  130. package/dist/sdk/engage.js +1 -1
  131. package/dist/sdk/errors.js +1 -1
  132. package/dist/sdk/index.js +1 -1
  133. package/dist/sdk/io/index.js +1 -1
  134. package/dist/sdk/io/node-filesystem.js +1 -1
  135. package/dist/sdk/job.js +1 -1
  136. package/dist/sdk/journey.js +1 -1
  137. package/dist/sdk/llm/chat-cache.js +1 -1
  138. package/dist/sdk/llm/index.js +1 -1
  139. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  140. package/dist/sdk/llm/model-factors.js +1 -1
  141. package/dist/sdk/personalization.js +1 -1
  142. package/dist/sdk/policy.js +1 -1
  143. package/dist/sdk/query/index.js +1 -1
  144. package/dist/sdk/query/sql-parser.js +1 -1
  145. package/dist/sdk/realtime.js +1 -1
  146. package/dist/sdk/schedule.js +1 -1
  147. package/dist/sdk/segment/child-segment-yaml.d.ts +9 -7
  148. package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
  149. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  150. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  151. package/dist/sdk/segment/fields-display.js +1 -1
  152. package/dist/sdk/segment/file-discovery.js +1 -1
  153. package/dist/sdk/segment/journey-utils.js +1 -1
  154. package/dist/sdk/segment/journey-validator.js +1 -1
  155. package/dist/sdk/segment/journey-yaml.js +1 -1
  156. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  157. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  158. package/dist/sdk/segment/pull-workflow.js +1 -1
  159. package/dist/sdk/segment/push-recovery.js +1 -1
  160. package/dist/sdk/segment/push-workflow.js +1 -1
  161. package/dist/sdk/segment/push-workflow.js.map +1 -1
  162. package/dist/sdk/segment/resolution-context.js +1 -1
  163. package/dist/sdk/segment/segment-path-parser.js +1 -1
  164. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  165. package/dist/sdk/segment/segment-validator.js +1 -1
  166. package/dist/sdk/segment/target-resolution.js +1 -1
  167. package/dist/sdk/segment/tdx-config.js +1 -1
  168. package/dist/sdk/segment/types/activation-schema.d.ts +3 -0
  169. package/dist/sdk/segment/types/activation-schema.d.ts.map +1 -1
  170. package/dist/sdk/segment/types/activation-schema.js +1 -1
  171. package/dist/sdk/segment/types/activation-schema.js.map +1 -1
  172. package/dist/sdk/segment/types/journey-def.js +1 -1
  173. package/dist/sdk/segment/types/journey-schema.js +1 -1
  174. package/dist/sdk/segment/types/segment-def.js +1 -1
  175. package/dist/sdk/segment/types/segment-schema.js +1 -1
  176. package/dist/sdk/segment/validate-files.js +1 -1
  177. package/dist/sdk/segment/yaml-validator.js +1 -1
  178. package/dist/sdk/segment.js +1 -1
  179. package/dist/sdk/types/cas.d.ts +2 -1
  180. package/dist/sdk/types/cas.d.ts.map +1 -1
  181. package/dist/sdk/types/cdp.d.ts +16 -1
  182. package/dist/sdk/types/cdp.d.ts.map +1 -1
  183. package/dist/sdk/types/index.js +1 -1
  184. package/dist/sdk/types/progress.js +1 -1
  185. package/dist/sdk/types/workspace.d.ts +19 -0
  186. package/dist/sdk/types/workspace.d.ts.map +1 -1
  187. package/dist/sdk/types/workspace.js +1 -1
  188. package/dist/sdk/types/workspace.js.map +1 -1
  189. package/dist/sdk/user.js +1 -1
  190. package/dist/sdk/util/format-detector.js +1 -1
  191. package/dist/sdk/util/formatters.js +1 -1
  192. package/dist/sdk/util/index.js +1 -1
  193. package/dist/sdk/util/paginate.js +1 -1
  194. package/dist/sdk/util/tree-formatter.js +1 -1
  195. package/dist/sdk/workflow/archive-validation.js +1 -1
  196. package/dist/sdk/workflow/clone-workflow.js +1 -1
  197. package/dist/sdk/workflow/index.js +1 -1
  198. package/dist/sdk/workflow/pull-workflow.js +1 -1
  199. package/dist/sdk/workflow/push-workflow.js +1 -1
  200. package/dist/sdk/workflow/tdx-config.js +1 -1
  201. package/dist/sdk/workflow/workflow-utils.js +1 -1
  202. package/dist/sdk/workspace/frontmatter.js +1 -1
  203. package/dist/sdk/workspace/git.js +1 -1
  204. package/dist/sdk/workspace/index.d.ts +12 -4
  205. package/dist/sdk/workspace/index.d.ts.map +1 -1
  206. package/dist/sdk/workspace/index.js +1 -1
  207. package/dist/sdk/workspace/index.js.map +1 -1
  208. package/dist/sdk/workspace/templates.js +1 -1
  209. package/dist/sdk/workspace/weekly.js +1 -1
  210. package/dist/sdk/workspace/wikilinks.js +1 -1
  211. package/dist/test-utils/command-runner.js +1 -1
  212. package/dist/test-utils/factories.js +1 -1
  213. package/dist/test-utils/fixtures.js +1 -1
  214. package/dist/test-utils/http-mock.js +1 -1
  215. package/dist/test-utils/index.js +1 -1
  216. package/dist/utils/async.js +1 -1
  217. package/dist/utils/colors.js +1 -1
  218. package/dist/utils/diff.js +1 -1
  219. package/dist/utils/file-permissions.js +1 -1
  220. package/dist/utils/file-reader.js +1 -1
  221. package/dist/utils/github-releases.js +1 -1
  222. package/dist/utils/global-cache.js +1 -1
  223. package/dist/utils/json-loader.js +1 -1
  224. package/dist/utils/local-cache.js +1 -1
  225. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  226. package/dist/utils/logger/formatters/index.js +1 -1
  227. package/dist/utils/logger/handlers/console-handler.js +1 -1
  228. package/dist/utils/logger/handlers/file-handler.js +1 -1
  229. package/dist/utils/logger/handlers/index.js +1 -1
  230. package/dist/utils/logger/handlers/null-handler.js +1 -1
  231. package/dist/utils/logger/index.js +1 -1
  232. package/dist/utils/logger/logger.js +1 -1
  233. package/dist/utils/logger/types.js +1 -1
  234. package/dist/utils/option-validation.js +1 -1
  235. package/dist/utils/process.js +1 -1
  236. package/dist/utils/prompt.js +1 -1
  237. package/dist/utils/spinner.js +1 -1
  238. package/dist/utils/sse-parser.js +1 -1
  239. package/dist/utils/string-utils.js +1 -1
  240. package/dist/utils/table-ref-parser.js +1 -1
  241. package/dist/utils/tdx-logger.js +1 -1
  242. package/dist/utils/version-check.js +1 -1
  243. package/package.json +1 -1
@@ -1 +1 @@
1
- const a152_0x59916b=a152_0x54b0;(function(_0x10bf40,_0x5bfdda){const _0x17cb40=a152_0x54b0,_0x2d5e3f=_0x10bf40();while(!![]){try{const _0x1044b0=-parseInt(_0x17cb40(0x212))/0x1*(parseInt(_0x17cb40(0x194))/0x2)+parseInt(_0x17cb40(0x1e3))/0x3+-parseInt(_0x17cb40(0x140))/0x4+-parseInt(_0x17cb40(0x148))/0x5*(-parseInt(_0x17cb40(0x147))/0x6)+-parseInt(_0x17cb40(0x225))/0x7*(-parseInt(_0x17cb40(0x1cb))/0x8)+-parseInt(_0x17cb40(0x15e))/0x9+-parseInt(_0x17cb40(0x1fe))/0xa*(-parseInt(_0x17cb40(0x235))/0xb);if(_0x1044b0===_0x5bfdda)break;else _0x2d5e3f['push'](_0x2d5e3f['shift']());}catch(_0x470ff5){_0x2d5e3f['push'](_0x2d5e3f['shift']());}}}(a152_0x481a,0xc984c));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';function a152_0x54b0(_0x296254,_0x5a0f4d){_0x296254=_0x296254-0x13d;const _0x481afa=a152_0x481a();let _0x54b076=_0x481afa[_0x296254];return _0x54b076;}const logger=Logger['of'](a152_0x59916b(0x1f3));export const PENDING_SEGMENT_PREFIX=a152_0x59916b(0x187);export const PENDING_ACTIVATION_PREFIX=a152_0x59916b(0x207);export function createPendingSegmentId(_0x963781){return''+PENDING_SEGMENT_PREFIX+_0x963781+'__';}export function isPendingSegmentId(_0x3f82cd){const _0x4806ba=a152_0x59916b;return _0x3f82cd[_0x4806ba(0x1d7)](PENDING_SEGMENT_PREFIX)&&!_0x3f82cd[_0x4806ba(0x1d7)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x4a6636){const _0x1a4a84=a152_0x59916b;return _0x4a6636[_0x1a4a84(0x221)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x455824){return''+PENDING_ACTIVATION_PREFIX+_0x455824+'__';}export function isPendingActivationId(_0x317624){const _0x467439=a152_0x59916b;return _0x317624[_0x467439(0x1d7)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x4de3e1){return _0x4de3e1['replace'](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x357e78,_0x3d16be){const _0x3aafb7=a152_0x59916b,_0x5449ab=_0x357e78+'::'+(_0x3d16be['trim']()||_0x3aafb7(0x240)),_0xd4ab46=createHash(_0x3aafb7(0x189))[_0x3aafb7(0x1b1)](_0x5449ab)['digest'](_0x3aafb7(0x14a))['slice'](0x0,0xc);return _0x3aafb7(0x238)+_0xd4ab46;}export function ensureJourneyDefaults(_0x459315){const _0x34772d=a152_0x59916b;!_0x459315[_0x34772d(0x1a3)]&&(_0x459315[_0x34772d(0x1a3)]=''),!_0x459315['state']&&(_0x459315[_0x34772d(0x20f)]=_0x34772d(0x14b));}export function injectExistingStageIds(_0x5d830a,_0x37d077){const _0x4d6f57=a152_0x59916b,_0x5ee23b=new Map(_0x37d077['map'](_0x3b3bb7=>[_0x3b3bb7[_0x4d6f57(0x1ce)],_0x3b3bb7['id']]));for(const _0x413767 of _0x5d830a){if(!_0x413767['id']){const _0x458c4c=_0x5ee23b[_0x4d6f57(0x21c)](_0x413767[_0x4d6f57(0x1ce)]);_0x458c4c&&(_0x413767['id']=_0x458c4c);}}}export function resolveTDFolderPath(_0x4fcad8,_0x4c90b8,_0x5e65ab){const _0xa9eccd=a152_0x59916b;if(!_0x4c90b8)return _0x4fcad8;if(_0x4fcad8===_0x5e65ab||_0x4fcad8[_0xa9eccd(0x1d7)](_0x5e65ab+'/'))return _0x4fcad8;return _0x4fcad8?_0x5e65ab+'/'+_0x4fcad8:_0x5e65ab;}export function addFoldersToCreate(_0xa3c18a,_0x3d8fe1,_0x12d163){const _0x149d5c=a152_0x59916b;if(!_0xa3c18a)return;if(_0x3d8fe1[_0x149d5c(0x145)](_0xa3c18a))return;const _0xf14c94=_0xa3c18a[_0x149d5c(0x1e8)]('/');let _0x4b0215='';for(const _0x4023ba of _0xf14c94){_0x4b0215=_0x4b0215?_0x4b0215+'/'+_0x4023ba:_0x4023ba,!_0x3d8fe1[_0x149d5c(0x145)](_0x4b0215)&&_0x12d163[_0x149d5c(0x180)](_0x4b0215);}}export function sortFoldersByDepth(_0x2dcad3){const _0x5dfd5a=a152_0x59916b;return[..._0x2dcad3][_0x5dfd5a(0x1a1)]((_0x29b06f,_0x277b72)=>{const _0xf1eba0=_0x5dfd5a,_0x54c009=(_0x29b06f['match'](/\//g)||[])[_0xf1eba0(0x1fd)],_0xf9fb25=(_0x277b72[_0xf1eba0(0x1fc)](/\//g)||[])[_0xf1eba0(0x1fd)];return _0x54c009-_0xf9fb25;});}import*as a152_0x329c1f from'yaml';import{readFileSync}from'fs';import a152_0x822047 from'path';import{isJourneyDef,parseYamlString as a152_0x73dd06,toYamlString as a152_0x4934de,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(_0x236e6f){const _0x51f1e4=a152_0x59916b;if(Array[_0x51f1e4(0x188)](_0x236e6f))return'['+_0x236e6f[_0x51f1e4(0x1da)](_0x2c108e=>stableStringify(_0x2c108e))['join'](',')+']';if(_0x236e6f&&typeof _0x236e6f===_0x51f1e4(0x20a)){const _0x5ec5d1=_0x236e6f,_0x220b42=Object[_0x51f1e4(0x141)](_0x5ec5d1)[_0x51f1e4(0x1a1)](),_0x1ae193=_0x220b42[_0x51f1e4(0x1da)](_0x554dce=>'\x22'+_0x554dce+'\x22:'+stableStringify(_0x5ec5d1[_0x554dce]));return'{'+_0x1ae193[_0x51f1e4(0x1d3)](',')+'}';}const _0x23d083=JSON[_0x51f1e4(0x18a)](_0x236e6f);return _0x23d083===undefined?_0x51f1e4(0x23c):_0x23d083;}function activationSignature(_0x33266d){const _0x45b8ff=a152_0x59916b,_0x3ecd1c={'connection':_0x33266d['connection'],..._0x33266d[_0x45b8ff(0x144)]!==undefined&&{'all_columns':_0x33266d[_0x45b8ff(0x144)]},..._0x33266d[_0x45b8ff(0x1c4)]!==undefined&&{'columns':_0x33266d[_0x45b8ff(0x1c4)]},..._0x33266d['behavior']!==undefined&&{'behavior':_0x33266d[_0x45b8ff(0x206)]},..._0x33266d[_0x45b8ff(0x14f)]!==undefined&&{'schedule':_0x33266d['schedule']},..._0x33266d['notification']!==undefined&&{'notification':_0x33266d[_0x45b8ff(0x17b)]},..._0x33266d[_0x45b8ff(0x1e1)]!==undefined&&{'connector_config':_0x33266d[_0x45b8ff(0x1e1)]},..._0x33266d[_0x45b8ff(0x1f2)]!==undefined&&{'activation_template_id':_0x33266d['activation_template_id']}};return stableStringify(_0x3ecd1c);}async function fetchSegment(_0xeb70e7,_0x4cbcc0,_0x281e31,_0x5e1659){const _0x107fab=a152_0x59916b,_0x105f19=_0x5e1659?.[_0x107fab(0x16c)](_0xc19c48=>_0xc19c48['id']===_0x281e31);if(_0x105f19)return _0x105f19;try{return await _0xeb70e7[_0x107fab(0x240)][_0x107fab(0x162)](_0x4cbcc0,_0x281e31);}catch(_0x17a173){logger['debug'](_0x107fab(0x218)+_0x281e31+_0x107fab(0x22b)+_0x17a173);try{return await _0xeb70e7[_0x107fab(0x240)][_0x107fab(0x1a8)](_0x281e31);}catch(_0x1f8d88){return logger['debug'](_0x107fab(0x1c9)+_0x281e31+':\x20'+_0x1f8d88),null;}}}function recoverSegmentIdsFromPushRecovery(_0x3d0926,_0x589c5b,_0x182064){const _0x95ec20=a152_0x59916b,_0x4c8d7c=readPushRecovery(_0x3d0926['absolutePath']);if(_0x4c8d7c?.['journeyName']===_0x3d0926[_0x95ec20(0x245)][_0x95ec20(0x1ce)])for(const [_0x56721d,_0x44d65b]of Object[_0x95ec20(0x199)](_0x4c8d7c[_0x95ec20(0x23d)])){const _0x353e56=generateDeterministicJourneySegmentName(_0x3d0926[_0x95ec20(0x245)][_0x95ec20(0x1ce)],_0x56721d);_0x44d65b['uniqueServerName']===_0x353e56&&(_0x589c5b[_0x95ec20(0x172)](_0x56721d,_0x44d65b[_0x95ec20(0x16d)]),_0x182064[_0x95ec20(0x172)](_0x56721d,_0x44d65b[_0x95ec20(0x16d)]));}}async function createOrRecoverEmbeddedSegment(_0x54f43d,_0x313a32,_0x237c26,_0x34e906){const _0x95549=a152_0x59916b;let _0x5dd774;try{_0x5dd774=await _0x54f43d[_0x95549(0x240)][_0x95549(0x1e7)]({'name':_0x237c26[_0x95549(0x1f5)],'description':_0x237c26[_0x95549(0x1a3)],'journeyId':_0x237c26[_0x95549(0x223)],'rule':_0x34e906(_0x237c26[_0x95549(0x1d4)],!![]),'countPopulation':!![],'parentFolderId':_0x237c26[_0x95549(0x169)],'audienceId':_0x237c26[_0x95549(0x1c5)]});}catch(_0x5eedc3){const _0x12b469=_0x5eedc3 instanceof Error&&_0x5eedc3[_0x95549(0x230)][_0x95549(0x1ec)]('Name\x20has\x20already\x20been\x20taken');if(_0x12b469){const _0x39c126=readPushRecovery(_0x313a32[_0x95549(0x202)]),_0x36a52a=_0x39c126?.[_0x95549(0x1fa)]===_0x313a32[_0x95549(0x245)][_0x95549(0x1ce)]?_0x39c126[_0x95549(0x23d)][_0x237c26[_0x95549(0x1c6)]]:undefined;if(_0x36a52a?.[_0x95549(0x15d)]===_0x237c26['uniqueSegmentName'])await _0x54f43d[_0x95549(0x240)]['updateSegmentById'](_0x237c26[_0x95549(0x1c5)],_0x36a52a[_0x95549(0x16d)],{'description':_0x237c26[_0x95549(0x1a3)],'rule':_0x34e906(_0x237c26[_0x95549(0x1d4)],!![]),'countPopulation':!![]}),_0x5dd774=_0x36a52a[_0x95549(0x16d)];else throw new SDKError(ErrorCode[_0x95549(0x1c3)],_0x95549(0x1a9)+_0x237c26[_0x95549(0x1c6)]+_0x95549(0x1a6)+(_0x95549(0x1be)+_0x313a32[_0x95549(0x202)][_0x95549(0x221)](/([^/]+)$/,_0x95549(0x1cd))+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x5eedc3);}else throw _0x5eedc3;}return saveSegmentToPushRecovery(_0x313a32[_0x95549(0x202)],_0x313a32[_0x95549(0x245)][_0x95549(0x1ce)],_0x237c26[_0x95549(0x1c6)],{'segmentId':_0x5dd774,'uniqueServerName':_0x237c26['uniqueSegmentName'],'createdAt':new Date()[_0x95549(0x22d)]()}),_0x5dd774;}export async function prepareSegmentFiles(_0x1e6f2e,_0x479c51,_0x1b1c0e,_0x1120d7,_0x3f78d5){const _0x51cd1c=a152_0x59916b,{activationDefToCreateRequest:_0x5957fa}=await import(_0x51cd1c(0x20c)),_0xfbf0a9=[],_0x1184a6=new Set();for(const {yamlConfig:_0x493108,folderPath:_0x1ce061,sourcePath:_0x4d14c3}of _0x1e6f2e){const _0xe33ee6=resolveTDFolderPath(_0x1ce061,_0x1120d7,_0x3f78d5),_0x1abf0f=_0xe33ee6+':'+_0x493108[_0x51cd1c(0x1ce)],_0x433b5a=_0x479c51[_0x51cd1c(0x1a0)][_0x51cd1c(0x21c)](_0x1abf0f),_0x4a47ea=_0x433b5a?_0x479c51[_0x51cd1c(0x1db)][_0x51cd1c(0x21c)](_0x433b5a['id'])||[]:[];addFoldersToCreate(_0xe33ee6,_0x479c51[_0x51cd1c(0x1b0)],_0x1184a6);const _0x9b81a=calculateActivationActions(_0x493108[_0x51cd1c(0x1df)]||[],_0x4a47ea,_0x479c51['idToEmailMap'],_0x479c51[_0x51cd1c(0x247)]);for(const _0x538d18 of _0x9b81a){(_0x538d18['type']==='create'||_0x538d18['type']===_0x51cd1c(0x1b1))&&_0x538d18[_0x51cd1c(0x1b4)]&&(_0x538d18[_0x51cd1c(0x152)]=await _0x5957fa(_0x538d18[_0x51cd1c(0x1b4)],_0x1b1c0e));}const _0x48e44e=calculateSegmentDiff(_0x493108,_0x433b5a,_0x4a47ea,_0x479c51['idToEmailMap'],_0x479c51[_0x51cd1c(0x247)]);_0xfbf0a9[_0x51cd1c(0x1ae)]({'relativePath':_0x493108[_0x51cd1c(0x1ce)],'absolutePath':_0x4d14c3,'yamlConfig':_0x493108,'folderPath':_0xe33ee6,'existingSegment':_0x433b5a,'existingActivations':_0x4a47ea,'isNew':_0x48e44e[_0x51cd1c(0x190)],'hasChanges':_0x48e44e[_0x51cd1c(0x1f7)],'diff':_0x48e44e[_0x51cd1c(0x231)],'activationActions':_0x9b81a});}return{'segmentFiles':_0xfbf0a9,'foldersToCreate':_0x1184a6};}export async function prepareJourneyFiles(_0x25738e,_0x2e471d,_0x4245b8,_0xd0790f){const _0xc080cc=a152_0x59916b,_0x5a0999=[],_0x529873=new Set();for(const {yamlConfig:_0x5c9937,folderPath:_0x461e16,sourcePath:_0x443e42}of _0x25738e){const _0x3b8166=resolveTDFolderPath(_0x461e16,_0x4245b8,_0xd0790f),_0x3affbd=_0x3b8166+':'+_0x5c9937['name'],_0x4fa639=_0x2e471d[_0xc080cc(0x219)]['get'](_0x3affbd);let _0x2e82b4,_0x4e3219;if(_0x4fa639&&_0x4fa639[_0xc080cc(0x1fd)]>0x0){const _0x26a312=buildLocalExpandedRuleMappings(_0x5c9937),{createYamlContext:_0x42f116,prefetchJourneySegments:_0x3adc39}=createPushYamlContextForBundle(_0x2e471d[_0xc080cc(0x13d)],_0x2e471d['parentId'],_0x2e471d[_0xc080cc(0x1bf)],_0x26a312,_0x2e471d[_0xc080cc(0x1f1)],_0x2e471d['connectionIdToNameMap'],_0x2e471d[_0xc080cc(0x173)],_0x2e471d[_0xc080cc(0x236)]);await _0x3adc39(_0x4fa639['map'](_0x3611f7=>_0x3611f7['id']));const _0x24d278=await _0x2e471d[_0xc080cc(0x13d)]['journey'][_0xc080cc(0x1b5)](_0x4fa639[0x0]['journeyBundleId']),_0x549b1a=hasMultipleVersions(_0x5c9937),_0x52ac59=async _0x4e907d=>{const _0x6dc397=_0xc080cc,_0x34c1f2=_0x2e471d[_0x6dc397(0x236)]?.[_0x6dc397(0x21c)](_0x4e907d);if(_0x34c1f2)return _0x34c1f2;return _0x2e471d[_0x6dc397(0x217)]({'journeyId':_0x4e907d,'journeyName':_0x5c9937['name'],'isMultiVersion':_0x4fa639['length']>0x1});};if(_0x549b1a&&_0x4fa639[_0xc080cc(0x1fd)]>0x1){const _0x23e502=[];for(const _0x4d4233 of _0x4fa639){const _0x323cad=_0x4d4233[_0xc080cc(0x164)]||0x1;_0x2e471d[_0xc080cc(0x167)]?.[_0xc080cc(0x1b1)](_0xc080cc(0x1b3)+_0x5c9937[_0xc080cc(0x1ce)]+'\x20v'+_0x323cad);const _0x57c3fe=await _0x52ac59(_0x4d4233['id']),_0x138c7b=_0x42f116(_0x4d4233['id']),_0x406397=await journeyResponseToDef(_0x57c3fe,_0x138c7b);_0x23e502[_0xc080cc(0x1ae)]({'item':_0x4d4233,'yaml':_0x406397});}const _0x34be0b=buildLocalRuleToNameMappingFromJourney(_0x5c9937);_0x4e3219=buildMergedJourneyDef(_0x23e502,_0x34be0b,_0x24d278);const _0x33fb31=Math['max'](..._0x23e502[_0xc080cc(0x1da)](_0x299b5a=>_0x299b5a[_0xc080cc(0x1d5)][_0xc080cc(0x164)]||0x0)),_0x1e49b7=_0x4fa639['find'](_0x5dba9f=>(_0x5dba9f['versionNumber']||0x0)===_0x33fb31);_0x1e49b7&&(_0x2e471d['progress']?.[_0xc080cc(0x1b1)](_0xc080cc(0x1b3)+_0x5c9937[_0xc080cc(0x1ce)]+'\x20v'+_0x33fb31),_0x2e82b4=await _0x52ac59(_0x1e49b7['id']));}else{const _0x2532dd=_0x4fa639[_0x4fa639[_0xc080cc(0x1fd)]-0x1];_0x2e471d['progress']?.[_0xc080cc(0x1b1)](_0xc080cc(0x1b3)+_0x5c9937[_0xc080cc(0x1ce)]),_0x2e82b4=await _0x52ac59(_0x2532dd['id']);const _0x89808c=_0x42f116(_0x2532dd['id']),_0x4bc96b=await journeyResponseToDef(_0x2e82b4,_0x89808c),_0x6cff5c=buildLocalRuleToNameMappingFromJourney(_0x5c9937);_0x4e3219=buildMergedJourneyDef([{'item':_0x2532dd,'yaml':_0x4bc96b}],_0x6cff5c,_0x24d278);}}addFoldersToCreate(_0x3b8166,_0x2e471d[_0xc080cc(0x1b0)],_0x529873);const _0x3f1155=calculateJourneyDiff(_0x5c9937,_0x4e3219);_0x5a0999[_0xc080cc(0x1ae)]({'relativePath':_0x5c9937['name'],'absolutePath':_0x443e42,'yamlConfig':_0x5c9937,'folderPath':_0x3b8166,'existingJourney':_0x2e82b4,'isNew':_0x3f1155[_0xc080cc(0x190)],'hasChanges':_0x3f1155['hasChanges'],'diff':_0x3f1155[_0xc080cc(0x231)]});}return{'journeyFiles':_0x5a0999,'foldersToCreate':_0x529873};}export function calculateActivationActions(_0x1ecfd0,_0x2dde2a,_0x435a58,_0x31d94c){const _0x5ddca7=a152_0x59916b,_0x3592f9=[],_0x2437a8=new Map();for(const _0x19fe37 of _0x2dde2a){_0x2437a8[_0x5ddca7(0x172)](_0x19fe37[_0x5ddca7(0x1ce)],_0x19fe37);}const _0x2142bb=new Map();for(const _0x48ce1b of _0x1ecfd0){_0x2142bb['set'](_0x48ce1b[_0x5ddca7(0x1ce)],_0x48ce1b);}for(const _0x4e7e4a of _0x1ecfd0){const _0x696f50=_0x2437a8[_0x5ddca7(0x21c)](_0x4e7e4a['name']);if(!_0x696f50)_0x3592f9['push']({'type':'create','name':_0x4e7e4a[_0x5ddca7(0x1ce)],'yamlActivation':_0x4e7e4a});else{const _0x2c7c98=activationResponseToDef(_0x696f50,_0x435a58,_0x31d94c),_0x201451=a152_0x329c1f[_0x5ddca7(0x18a)](_0x2c7c98),_0x41a8f7=a152_0x329c1f['stringify'](_0x4e7e4a);_0x201451!==_0x41a8f7&&_0x3592f9[_0x5ddca7(0x1ae)]({'type':_0x5ddca7(0x1b1),'name':_0x4e7e4a['name'],'yamlActivation':_0x4e7e4a,'existingActivation':_0x696f50});}}for(const _0x399795 of _0x2dde2a){!_0x2142bb['has'](_0x399795[_0x5ddca7(0x1ce)])&&_0x3592f9[_0x5ddca7(0x1ae)]({'type':_0x5ddca7(0x193),'name':_0x399795[_0x5ddca7(0x1ce)],'existingActivation':_0x399795});}return _0x3592f9;}function calculateYamlDiff(_0x594cd9,_0x168954){if(_0x168954){const _0x5ea57a=generateDiff(_0x168954,_0x594cd9),_0x567ad2=hasChanges(_0x5ea57a);return{'isNew':![],'hasChanges':_0x567ad2,'diff':_0x567ad2?formatDiffWithColors(_0x5ea57a):undefined};}const _0x597aab=generateDiff('',_0x594cd9);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x597aab)};}export function calculateSegmentDiff(_0x276817,_0x3b1331,_0x336db0,_0x3b5eba,_0x40ab1b){const _0x4fa3f7=segmentToYamlString(_0x276817),_0x44e4cb=_0x3b1331?segmentToYamlString(segmentWithActivationsToYaml(_0x3b1331,_0x336db0,undefined,_0x3b5eba,_0x40ab1b)):undefined;return calculateYamlDiff(_0x4fa3f7,_0x44e4cb);}export function calculateJourneyDiff(_0x1933d3,_0x8694b9){const _0x4c86b8=normalizeJourneyDef(_0x1933d3,_0x1933d3),_0x4c8f26=a152_0x4934de(_0x4c86b8),_0x57e608=_0x8694b9?a152_0x4934de(normalizeJourneyDef(_0x8694b9,_0x1933d3)):undefined;return calculateYamlDiff(_0x4c8f26,_0x57e608);}export function findSegmentsToDelete(_0x557888,_0x3bfdcb,_0x156c30,_0xe710fd,_0x55cac8){const _0x1e609e=a152_0x59916b,_0x561717=new Set();for(const {yamlConfig:_0x5a5978,folderPath:_0x5c4061}of _0x3bfdcb){_0x561717[_0x1e609e(0x180)](_0x5c4061+':'+_0x5a5978[_0x1e609e(0x1ce)]);}return _0x557888['filter'](_0x1fd4c3=>{const _0x5b2c54=_0x1e609e,_0xfbf8cd=_0x1fd4c3['segmentFolderId']?_0x156c30['get'](_0x1fd4c3[_0x5b2c54(0x228)]['toString']())||'':'',_0x179d21=_0xfbf8cd+':'+_0x1fd4c3[_0x5b2c54(0x1ce)];if(_0x561717[_0x5b2c54(0x145)](_0x179d21))return![];if(_0x55cac8)return _0xfbf8cd===_0xe710fd||_0xfbf8cd[_0x5b2c54(0x1d7)](_0xe710fd+'/');return!![];});}function a152_0x481a(){const _0x1d54de=['valid','Updated\x20journey\x20\x27','Delete\x20the\x20push\x20recovery\x20file\x20(','existingSegments','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','parseDocument','embedded_segment_creating','SEGMENT_UPDATE_ERROR','columns','parentId','localName','deleted','values','getSegmentEntity\x20also\x20failed\x20for\x20','journeyStages','568jfGZHd','ACTIVATION_UPDATE_ERROR','.$1.push-recovery.json','name','Duration','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','toLowerCase','Failed\x20to\x20fetch\x20referenced\x20segment\x20','join','resolvedRule','item','\x27\x20wait\x20condition','startsWith','updateActivation','slice','map','activationsBySegmentId','created','segment_creating','WaitStep','activations','\x27\x20to\x20local\x20\x27','connector_config','INTERNAL','2300838YiZiHY','rootFolderId','journeyActivationStepId','logSuccess','createJourneySegment','split','waitStepType','createFolder','embeddedSegmentNameToId','includes','conditions','listActivations','relationships','existingJourney','idToEmailMap','activation_template_id','tdx.sdk.push-workflow','deleteActivation','uniqueSegmentName','existingSegment','hasChanges','Entry\x20criteria:\x20','stage\x20\x27','journeyName','segment_created','match','length','326310FIuOwH','size','createdSegmentIds','journey_creating','absolutePath','conditionTimeoutUnit','max','waitStepUnit','behavior','__pending_act_','connection','Segment\x20not\x20found','object','entry_criteria','./child-segment-yaml.js','segmentNameToId','\x20segment\x20from\x20file:\x20','state','branches','attributes','1510009TnKhov','Segment\x20not\x20found:\x20','activation_deleting','journeyActivationNameToId','type','fetchJourney','getSegment\x20failed\x20for\x20','journeyBundlesByFolderAndName','effectiveFolderId','activation_updated','get','conditionSegmentId','reduce',').\x20','idToName','replace','Created\x20activation\x20\x27','journeyId','onProgress','59395dAudvf','):\x20','goal','segmentFolderId','getJourney','journey_created',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','\x27\x20milestone','toISOString','deleteSegment','parentSegmentFolder','message','diff','journeys','entryCriteria','journey_updating','902hgrLpx','journeyById','embedded_activation_created','journey_entry_criteria_','\x27\x20not\x20found\x20in\x20journey\x20\x27','Activation','toString','null','segments','withProgress','resolveJourneyId','segment','create','activationActions','Condition','activation_updating','yamlConfig','list','connectionIdToNameMap','deps','journey','./journey-yaml.js','3055188PYayqo','keys','\x27\x20from\x20file:\x20','createActivation','all_columns','has','from','18HhrqJY','1035805NRELxS','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','hex','draft','parse','activation_','folderPath','schedule','Updated\x20activation\x20\x27','folder_created','validatedRequest','all','Failed\x20to\x20resolve\x20segment\x20','with','getActivation','\x27\x20decision\x20point\x20branch\x20\x27','../../utils/async.js','buildUserMaps','relative','DecisionPoint','journeyBundleName','uniqueServerName','14106420JnbmCO','NOT_FOUND','journey_updated','createdSegmentId','getSegment','Updating\x20segment\x20\x27','versionNumber','ACTIVATION_SYNTAX_ERROR','resolveSegment','progress','dirname','folderId','logWarning','logDeleted','find','segmentId','entry','day','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','exitCriterias','set','activationStepsById','folder_creating','\x27\x20exit\x20criteria','rule','\x20(referenced\x20in\x20journey\x20','segment_deleting','run_after_journey_refresh','\x27\x20by\x20rule\x20content','notification','updated','waitStep','segment_updating','\x20activation\x20\x27','add','unchanged','Deleting\x20activation\x20\x27','Matched\x20server\x20segment\x20\x27','Failed\x20to\x20','logInfo','debug','__pending_','isArray','sha1','stringify','Journey\x20\x27','Created\x20segment\x20\x27','steps','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','decision_point','isNew','kind','some','delete','2QTRNoq','verbose','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','filter','Activation\x20not\x20found:\x20','entries','folder','JOURNEY_SYNTAX_ERROR','milestone','conditionTimeoutDuration','Stage\x20\x27','utf-8','segmentByFolderAndName','sort','\x27\x20entry\x20criteria','description','index','segment_updated','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','embedded_segment_created','getSegmentEntity','Embedded\x20segment\x20\x27','\x27...','\x0a\x20\x20','\x27\x20for\x20','updateSegmentById','push','existingActivation','folderPathToId','update','skipSegments','Fetching\x20','yamlActivation','getLatestJourneyId','data','action','activationContext','segment_deleted','stages','Deleted\x20activation\x20\x27'];a152_0x481a=function(){return _0x1d54de;};return a152_0x481a();}export function findJourneysToDelete(_0x2e5aa4,_0x18b731,_0x5e2379,_0x10dc21,_0x5c433c){const _0xf9fcaa=a152_0x59916b,_0x415253=new Set();for(const {yamlConfig:_0x1d612a,folderPath:_0x3dc2b6}of _0x18b731){_0x415253[_0xf9fcaa(0x180)](_0x3dc2b6+':'+_0x1d612a[_0xf9fcaa(0x1ce)]);}return _0x2e5aa4[_0xf9fcaa(0x197)](_0xeaceff=>{const _0x3e877a=_0xf9fcaa,_0x5a6098=_0xeaceff[_0x3e877a(0x169)]?_0x5e2379['get'](_0xeaceff[_0x3e877a(0x169)])||'':'',_0x115910=_0x5a6098+':'+_0xeaceff['journeyBundleName'];if(_0x415253[_0x3e877a(0x145)](_0x115910))return![];if(_0x5c433c)return _0x5a6098===_0x10dc21||_0x5a6098[_0x3e877a(0x1d7)](_0x10dc21+'/');return!![];});}export function buildSegmentLookupMap(_0x355c1e,_0x4bade7){const _0x5a3789=a152_0x59916b,_0x3d9099=new Map();for(const _0x1ebad8 of _0x355c1e){const _0x583d72=_0x1ebad8['segmentFolderId']?_0x4bade7['get'](_0x1ebad8[_0x5a3789(0x228)][_0x5a3789(0x23b)]())||'':'',_0x49e53d=_0x583d72+':'+_0x1ebad8[_0x5a3789(0x1ce)];_0x3d9099['set'](_0x49e53d,_0x1ebad8);}return _0x3d9099;}export function buildSegmentNameToIdMap(_0x36328a){const _0xe175e4=a152_0x59916b,_0x1fc74b=new Map();for(const _0x251cbe of _0x36328a){_0x1fc74b['set'](_0x251cbe[_0xe175e4(0x1ce)],_0x251cbe['id']);}return _0x1fc74b;}export function buildJourneyBundleLookupMap(_0x46ed9e,_0x483f55){const _0x5043bb=a152_0x59916b,_0x31523a=new Map();for(const _0x1bbe73 of _0x46ed9e){const _0x558b9a=_0x1bbe73[_0x5043bb(0x169)]?_0x483f55['get'](_0x1bbe73[_0x5043bb(0x169)])||'':'',_0x28965d=_0x558b9a+':'+_0x1bbe73[_0x5043bb(0x15c)];!_0x31523a[_0x5043bb(0x145)](_0x28965d)&&_0x31523a[_0x5043bb(0x172)](_0x28965d,[]),_0x31523a[_0x5043bb(0x21c)](_0x28965d)[_0x5043bb(0x1ae)](_0x1bbe73);}for(const _0x2d7c98 of _0x31523a[_0x5043bb(0x1c8)]()){_0x2d7c98[_0x5043bb(0x1a1)]((_0xcf814,_0x48c53c)=>(_0xcf814[_0x5043bb(0x164)]||0x0)-(_0x48c53c[_0x5043bb(0x164)]||0x0));}return _0x31523a;}export function collectFoldersToCreate(_0x21e01b,_0x273089){const _0x403d6e=a152_0x59916b,_0x347999=new Set();for(const _0x5e704b of _0x21e01b){if(!_0x5e704b)continue;if(_0x273089['has'](_0x5e704b))continue;const _0x29b81d=_0x5e704b[_0x403d6e(0x1e8)]('/');let _0x556726='';for(const _0x13883f of _0x29b81d){_0x556726=_0x556726?_0x556726+'/'+_0x13883f:_0x13883f,!_0x273089[_0x403d6e(0x145)](_0x556726)&&_0x347999[_0x403d6e(0x180)](_0x556726);}}return _0x347999;}export function parseAndClassifyYamlFiles(_0x5621ab,_0xa6b5d5,_0x789ab0){const _0x1ccd8f=a152_0x59916b,_0x2280b8=[],_0x38e218=[];for(const _0x4443e8 of _0x5621ab){const _0x5ca330=a152_0x822047['relative'](_0xa6b5d5,a152_0x822047[_0x1ccd8f(0x168)](_0x4443e8)),_0x18ea99=_0x5ca330==='.'?'':_0x5ca330,_0x4b9e96=readFileSync(_0x4443e8,_0x1ccd8f(0x19f)),_0x314467=a152_0x329c1f[_0x1ccd8f(0x14c)](_0x4b9e96);if(isJourneyDef(_0x314467)){const _0x22b732=a152_0x73dd06(_0x4b9e96);_0x38e218[_0x1ccd8f(0x1ae)]({'yamlConfig':_0x22b732,'folderPath':_0x18ea99,'sourcePath':_0x4443e8});}else{if(!_0x789ab0?.[_0x1ccd8f(0x1b2)]){const _0x18003f=parseSegmentYamlFile(_0x4b9e96),_0x24b919=normalizeChildSegmentYaml(_0x18003f);_0x2280b8[_0x1ccd8f(0x1ae)]({'yamlConfig':_0x24b919,'folderPath':_0x18ea99,'sourcePath':_0x4443e8});}}}return{'segments':_0x2280b8,'journeys':_0x38e218};}export function validateParsedFiles(_0x35c275,_0x2953af){const _0x376375=a152_0x59916b,_0x4e388b=[];for(const {yamlConfig:_0x50cb93,sourcePath:_0x275881}of _0x35c275[_0x376375(0x23d)]){const _0x296cb3=readFileSync(_0x275881,_0x376375(0x19f)),_0x258995=a152_0x329c1f['parseDocument'](_0x296cb3),_0x526ca5=validateSegmentDef(_0x50cb93,{'source':_0x296cb3,'document':_0x258995},{'skipSchema':!![]});if(!_0x526ca5[_0x376375(0x1bc)]){const _0x5b183e=a152_0x822047[_0x376375(0x15a)](_0x2953af,_0x275881);_0x4e388b[_0x376375(0x1ae)]({'filePath':_0x5b183e,'source':_0x296cb3,'result':_0x526ca5,'isJourney':![]});}}for(const {yamlConfig:_0x2404f5,sourcePath:_0x2b9893}of _0x35c275[_0x376375(0x232)]){const _0x355dce=readFileSync(_0x2b9893,_0x376375(0x19f)),_0x28b886=a152_0x329c1f[_0x376375(0x1c1)](_0x355dce),_0x2a3bc3=validateJourneyDef(_0x2404f5,{'source':_0x355dce,'document':_0x28b886},{'skipSchema':!![]});if(!_0x2a3bc3[_0x376375(0x1bc)]){const _0x2dc417=a152_0x822047[_0x376375(0x15a)](_0x2953af,_0x2b9893);_0x4e388b[_0x376375(0x1ae)]({'filePath':_0x2dc417,'source':_0x355dce,'result':_0x2a3bc3,'isJourney':!![]});}}return _0x4e388b;}export function formatValidationErrors(_0x57ea24){const _0x1607f4=a152_0x59916b,_0x1f35e9=[];for(const {filePath:_0x1efe27,source:_0x40d57c,result:_0x136d68,isJourney:_0x54bd2c}of _0x57ea24){const _0x2fb4f2=_0x54bd2c?'journey':_0x1607f4(0x240);_0x1f35e9[_0x1607f4(0x1ae)]('\x0a'+_0x1efe27+'\x20('+_0x2fb4f2+_0x1607f4(0x226)+_0x136d68['errors'][_0x1607f4(0x1fd)]+'\x20error(s)'),_0x1f35e9[_0x1607f4(0x1ae)](formatValidationResult(_0x136d68,_0x40d57c,_0x1efe27));}return _0x1f35e9[_0x1607f4(0x1d3)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x4fa36d){const _0x2212b8=a152_0x59916b,_0x222537=new Set(),_0x305b93=new Map(),_0x5dbd86=collectSegmentUsageCounts(_0x4fa36d);if(_0x4fa36d[_0x2212b8(0x23d)])for(const [_0x29e06d,_0x27430e]of Object[_0x2212b8(0x199)](_0x4fa36d[_0x2212b8(0x23d)])){_0x222537['add'](_0x29e06d);if(_0x27430e[_0x2212b8(0x176)]){const _0x1a4229=yamlRuleToApi(_0x27430e[_0x2212b8(0x176)]),_0x2a5b38=apiRuleToYaml(_0x1a4229);_0x305b93[_0x2212b8(0x172)](_0x29e06d,_0x2a5b38);}}const _0x70eef4=new Map();let _0x53af23=0x0;for(const [_0x27305a,_0x39c0ed]of _0x305b93){const _0x4372a2=serializeExpandedRule(_0x39c0ed,_0x305b93),_0x2671d7=_0x70eef4[_0x2212b8(0x21c)](_0x4372a2)||[];_0x2671d7[_0x2212b8(0x1ae)]({'name':_0x27305a,'index':_0x53af23}),_0x70eef4[_0x2212b8(0x172)](_0x4372a2,_0x2671d7),_0x53af23++;}const _0x5ba125=new Map();for(const [_0xea3cd4,_0x7b70ac]of _0x70eef4){const _0x115c08=_0x7b70ac[_0x2212b8(0x1d9)]()[_0x2212b8(0x1a1)]((_0x278699,_0x3e893b)=>{const _0x15912f=_0x2212b8,_0x1d32c4=_0x5dbd86['get'](_0x278699[_0x15912f(0x1ce)])||0x0,_0x3b6f31=_0x5dbd86[_0x15912f(0x21c)](_0x3e893b[_0x15912f(0x1ce)])||0x0;if(_0x1d32c4!==_0x3b6f31)return _0x3b6f31-_0x1d32c4;return _0x278699[_0x15912f(0x1a4)]-_0x3e893b[_0x15912f(0x1a4)];})[_0x2212b8(0x1da)](_0x442572=>_0x442572[_0x2212b8(0x1ce)]),_0x2b04db=[];for(const _0xda22d5 of _0x115c08){const _0x95ea08=_0x5dbd86['get'](_0xda22d5)||0x0,_0x4d2e86=Math[_0x2212b8(0x204)](_0x95ea08,0x1);for(let _0x55ed5e=0x0;_0x55ed5e<_0x4d2e86;_0x55ed5e++){_0x2b04db[_0x2212b8(0x1ae)](_0xda22d5);}}_0x5ba125[_0x2212b8(0x172)](_0xea3cd4,_0x2b04db);}return{'existingLocalSegmentNames':_0x222537,'localSegmentRules':_0x305b93,'localExpandedRuleToNames':_0x5ba125};}export function createSegmentIdResolver(_0x3e6707,_0x407dbd){return async _0xfa3dc8=>{const _0x16bf08=a152_0x54b0,_0x125bb4=_0x3e6707[_0x16bf08(0x21c)](_0xfa3dc8);if(!_0x125bb4)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x16bf08(0x213)+_0xfa3dc8+_0x16bf08(0x149)+_0x407dbd+'\x27)');return _0x125bb4;};}export function extractRootFolderId(_0xeec8f3){const _0x2a71ba=a152_0x59916b;return _0xeec8f3[_0x2a71ba(0x1ef)]?.[_0x2a71ba(0x22f)]?.[_0x2a71ba(0x1b6)]?.['id']||_0xeec8f3[_0x2a71ba(0x1ef)]?.['parentFolder']?.[_0x2a71ba(0x1b6)]?.['id'];}export function buildConnectionMaps(_0x492530){const _0x49377d=a152_0x59916b,_0x2a3b25=new Map(),_0x1880e7=new Map(),_0x5da601=new Map();for(const _0x27426f of _0x492530){_0x2a3b25[_0x49377d(0x172)](_0x27426f[_0x49377d(0x1ce)],parseInt(_0x27426f['id'],0xa)),_0x1880e7[_0x49377d(0x172)](_0x27426f['id'],_0x27426f['name']),_0x5da601['set'](_0x27426f['name'],_0x27426f[_0x49377d(0x216)]);}return{'nameToId':_0x2a3b25,'idToName':_0x1880e7,'nameToType':_0x5da601};}export function calculatePushStats(_0x40feca,_0x1b94a3,_0x2b8fbd,_0x57a439,_0x33374c,_0x44cfd7,_0x20b05e){const _0x3f7a34=a152_0x59916b,_0x164c3c=_0x40feca[_0x3f7a34(0x197)](_0xcd86e5=>_0xcd86e5['isNew']),_0x5cd377=_0x40feca[_0x3f7a34(0x197)](_0x340123=>!_0x340123[_0x3f7a34(0x190)]&&_0x340123[_0x3f7a34(0x1f7)]),_0x18b76d=_0x40feca[_0x3f7a34(0x197)](_0x46dc6d=>!_0x46dc6d[_0x3f7a34(0x190)]&&!_0x46dc6d['hasChanges']),_0x454394=_0x44cfd7?_0x57a439:[],_0x1f0ef2=_0x1b94a3['filter'](_0x2238b4=>_0x2238b4[_0x3f7a34(0x190)]),_0x592e26=_0x1b94a3[_0x3f7a34(0x197)](_0x13b137=>!_0x13b137[_0x3f7a34(0x190)]&&_0x13b137[_0x3f7a34(0x1f7)]),_0x1b1539=_0x1b94a3[_0x3f7a34(0x197)](_0x5f4333=>!_0x5f4333['isNew']&&!_0x5f4333[_0x3f7a34(0x1f7)]),_0x2bb857=_0x44cfd7?_0x33374c:[],_0x48771f=_0x40feca['flatMap'](_0xf4c441=>_0xf4c441[_0x3f7a34(0x242)]),_0x4210af=_0x48771f[_0x3f7a34(0x197)](_0x459745=>_0x459745[_0x3f7a34(0x216)]===_0x3f7a34(0x241)),_0xc6fc33=_0x48771f[_0x3f7a34(0x197)](_0x605ee5=>_0x605ee5[_0x3f7a34(0x216)]===_0x3f7a34(0x1b1)),_0x335604=_0x48771f['filter'](_0x52f8cc=>_0x52f8cc[_0x3f7a34(0x216)]===_0x3f7a34(0x193)),_0x543561=Array[_0x3f7a34(0x146)](_0x2b8fbd)[_0x3f7a34(0x1a1)](),_0x1b40db=_0x20b05e?![]:_0x164c3c[_0x3f7a34(0x1fd)]>0x0||_0x5cd377[_0x3f7a34(0x1fd)]>0x0||_0x454394[_0x3f7a34(0x1fd)]>0x0,_0x356425=_0x1f0ef2['length']>0x0||_0x592e26['length']>0x0||_0x2bb857[_0x3f7a34(0x1fd)]>0x0,_0x4f7b99=_0x20b05e?![]:_0x48771f['length']>0x0,_0x2350f1=_0x543561[_0x3f7a34(0x1fd)]>0x0;return{'segments':{'new':_0x164c3c,'changed':_0x5cd377,'unchanged':_0x18b76d,'toDelete':_0x454394},'journeys':{'new':_0x1f0ef2,'changed':_0x592e26,'unchanged':_0x1b1539,'toDelete':_0x2bb857},'activations':{'all':_0x48771f,'toCreate':_0x4210af,'toUpdate':_0xc6fc33,'toDelete':_0x335604},'folders':{'toCreate':_0x543561},'counts':{'segments':{'new':_0x164c3c[_0x3f7a34(0x1fd)],'changed':_0x5cd377[_0x3f7a34(0x1fd)],'unchanged':_0x18b76d[_0x3f7a34(0x1fd)],'toDelete':_0x454394['length']},'journeys':{'new':_0x1f0ef2[_0x3f7a34(0x1fd)],'changed':_0x592e26[_0x3f7a34(0x1fd)],'unchanged':_0x1b1539[_0x3f7a34(0x1fd)],'toDelete':_0x2bb857[_0x3f7a34(0x1fd)]},'activations':{'create':_0x4210af[_0x3f7a34(0x1fd)],'update':_0xc6fc33['length'],'delete':_0x335604[_0x3f7a34(0x1fd)]},'folders':_0x543561['length']},'hasChanges':_0x1b40db||_0x356425||_0x4f7b99||_0x2350f1};}export async function buildPushExecutionContext(_0x157c19,_0x407489,_0x1dfdcd,_0x58d0ac,_0x52a8cc,_0x50e85d){const _0x4b9d6a=a152_0x59916b,_0x72b821=extractRootFolderId(_0x1dfdcd),{pathToId:_0x274587,idToPath:_0x2f4168}=buildFolderMaps(_0x52a8cc),_0x121a62=buildSegmentNameToIdMap(_0x58d0ac),_0x52255f=new Map(),{batchAsync:_0x3f2276}=await import('../../utils/async.js'),[_0x5d8cad,_0x200f81]=await Promise[_0x4b9d6a(0x153)]([_0x157c19['user'][_0x4b9d6a(0x159)](),_0x157c19[_0x4b9d6a(0x208)][_0x4b9d6a(0x246)](),((async()=>{const _0x404c26=_0x4b9d6a;!_0x50e85d&&_0x58d0ac[_0x404c26(0x1fd)]>0x0&&await _0x3f2276(_0x58d0ac,async _0x2ee4a5=>{const _0x5c5f0c=_0x404c26,_0x4af888=await _0x157c19['segment'][_0x5c5f0c(0x1ee)](_0x407489,_0x2ee4a5['id']);_0x52255f[_0x5c5f0c(0x172)](_0x2ee4a5['id'],_0x4af888);});})())]),{emailToId:_0x53bb70,idToEmail:_0x3aac9d}=_0x5d8cad,_0x2ad7ab=buildConnectionMaps(_0x200f81);return{'rootFolderId':_0x72b821,'folderPathToId':_0x274587,'folderIdToPath':_0x2f4168,'segmentNameToId':_0x121a62,'activationsBySegmentId':_0x52255f,'emailToIdMap':_0x53bb70,'idToEmailMap':_0x3aac9d,'connectionNameToIdMap':_0x2ad7ab['nameToId'],'connectionIdToNameMap':_0x2ad7ab[_0x4b9d6a(0x220)],'connectionNameToTypeMap':_0x2ad7ab['nameToType']};}export function createPushYamlContextForBundle(_0x583450,_0x3206f3,_0xaf91ad,_0x2f188c,_0x444363,_0x797514,_0x419ca5,_0x36c585){const {existingLocalSegmentNames:_0x1cb67f,localExpandedRuleToNames:_0x34b9e8}=_0x2f188c,_0x383f34=new Set(),_0x5c6d44=new Map(),_0x5044fc=new Map(),_0x308c94=new Map(),_0x292d6e=createJumpTargetCache(),_0x2986a4=new Map(),_0x2eea8a=new Map(),_0x386c9b=new Set();let _0x302c75;const _0xd63835=_0x150acf=>{const _0x2fddc7={'resolveSegment':async _0xbf337c=>{const _0x5e90fc=a152_0x54b0,_0x5b7d62=_0x308c94[_0x5e90fc(0x21c)](_0xbf337c);if(_0x5b7d62!==undefined)return{'name':_0x5b7d62,'isJourneyLocal':!![]};try{const _0x5bb411=await fetchSegment(_0x583450,_0x3206f3,_0xbf337c,_0xaf91ad);if(!_0x5bb411)throw new Error(_0x5e90fc(0x209));const _0x4ae411=generateJourneyLocalName(_0x5bb411[_0x5e90fc(0x1ce)]),_0x5e432e=_0x5bb411[_0x5e90fc(0x191)]===SEGMENT_KIND_JOURNEY&&_0x4ae411!==undefined;let _0x2ae1c7=_0x5bb411[_0x5e90fc(0x1ce)],_0x3af4dc;if(_0x5e432e&&_0x5bb411['rule']){const _0x1202b1=apiRuleToYaml(_0x5bb411[_0x5e90fc(0x176)]);_0x2eea8a[_0x5e90fc(0x172)](_0xbf337c,_0x1202b1);const _0x12abf8=async _0x57501c=>{const _0x3f467d=_0x5e90fc,_0x2d7ad9=collectSegmentRefsFromRule(_0x57501c);for(const _0x4ccd92 of _0x2d7ad9){if(!_0x2eea8a[_0x3f467d(0x145)](_0x4ccd92))try{const _0x23cacf=await fetchSegment(_0x583450,_0x3206f3,_0x4ccd92,_0xaf91ad);if(_0x23cacf?.[_0x3f467d(0x176)]){const _0x40d47e=apiRuleToYaml(_0x23cacf[_0x3f467d(0x176)]);_0x2eea8a[_0x3f467d(0x172)](_0x4ccd92,_0x40d47e),await _0x12abf8(_0x40d47e);}}catch(_0x132beb){logger['debug'](_0x3f467d(0x1d2)+_0x4ccd92+':\x20'+_0x132beb);}}};await _0x12abf8(_0x1202b1);const _0x4e2f70=serializeExpandedRule(_0x1202b1,_0x2eea8a),_0x5e32e5=_0x34b9e8[_0x5e90fc(0x21c)](_0x4e2f70);if(_0x5e32e5&&_0x5e32e5[_0x5e90fc(0x1fd)]>0x0){const _0x49178b=_0x5c6d44[_0x5e90fc(0x21c)](_0x4e2f70)||0x0,_0x975881=_0x5e32e5[_0x49178b]||_0x5e32e5[_0x5e32e5['length']-0x1];_0x5c6d44[_0x5e90fc(0x172)](_0x4e2f70,_0x49178b+0x1),_0x2ae1c7=_0x975881,_0x383f34[_0x5e90fc(0x180)](_0x2ae1c7),_0x308c94['set'](_0xbf337c,_0x2ae1c7);const _0x11fa67=await resolveRuleSegmentRefs(_0x1202b1,async _0xfa465d=>{const _0x47b46b=_0x5e90fc,_0x239748=_0x308c94[_0x47b46b(0x21c)](_0xfa465d);if(_0x239748)return _0x239748;const _0x337ae5=await _0x302c75[_0x47b46b(0x166)](_0xfa465d);return _0x337ae5[_0x47b46b(0x1ce)];});_0x3af4dc={'description':_0x5bb411[_0x5e90fc(0x1a3)],'rule':_0x11fa67};}else{const _0x167a7f=_0x2986a4[_0x5e90fc(0x21c)](_0x4e2f70);if(_0x167a7f)_0x2ae1c7=_0x167a7f,_0x308c94[_0x5e90fc(0x172)](_0xbf337c,_0x2ae1c7);else{if(_0x4ae411){let _0x44305b=_0x4ae411,_0x231134=0x2;while(_0x383f34['has'](_0x44305b)||_0x1cb67f['has'](_0x44305b)){_0x44305b=_0x4ae411+'_'+_0x231134,_0x231134++;}_0x383f34[_0x5e90fc(0x180)](_0x44305b),_0x2ae1c7=_0x44305b;}_0x308c94['set'](_0xbf337c,_0x2ae1c7),_0x2986a4[_0x5e90fc(0x172)](_0x4e2f70,_0x2ae1c7);const _0x2b642c=await resolveRuleSegmentRefs(_0x1202b1,async _0x3cd97f=>{const _0x19c6e5=_0x308c94['get'](_0x3cd97f);if(_0x19c6e5)return _0x19c6e5;const _0x472fbf=await _0x302c75['resolveSegment'](_0x3cd97f);return _0x472fbf['name'];});_0x3af4dc={'description':_0x5bb411[_0x5e90fc(0x1a3)],'rule':_0x2b642c};}}}return{'name':_0x2ae1c7,'isJourneyLocal':_0x5e432e,'definition':_0x3af4dc};}catch(_0x1e1d2b){return logger[_0x5e90fc(0x186)](_0x5e90fc(0x154)+_0xbf337c+':\x20'+_0x1e1d2b),{'name':_0xbf337c,'isJourneyLocal':![]};}},'resolveActivation':async _0x407c11=>{const _0x366db3=a152_0x54b0,_0x559c19=_0x5044fc[_0x366db3(0x21c)](_0x407c11);if(_0x559c19!==undefined)return{'name':_0x559c19,'isJourneyLocal':!![]};try{let _0x65358=_0x419ca5?.['get'](_0x407c11);!_0x65358&&(_0x65358=await _0x583450[_0x366db3(0x13e)][_0x366db3(0x156)](_0x150acf,_0x407c11));const _0x32b44a=_0x65358[_0x366db3(0x211)]['activationParams']['name']||_0x407c11,_0x3172be=sanitizeYamlKey(_0x32b44a)||_0x366db3(0x14d)+_0x407c11,_0x5dd6d1=_0x3172be;_0x5044fc[_0x366db3(0x172)](_0x407c11,_0x5dd6d1);const _0x53028c=journeyActivationStepToYaml(_0x65358,_0x444363,_0x797514);return{'name':_0x5dd6d1,'isJourneyLocal':!![],'definition':_0x53028c};}catch(_0x16be4b){return logger[_0x366db3(0x186)]('Failed\x20to\x20resolve\x20activation\x20'+_0x407c11+':\x20'+_0x16be4b),{'name':_0x407c11,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x43015b,_0x48211d)=>resolveJumpTarget(_0x43015b,_0x48211d,_0x292d6e,async _0x1957b5=>{const _0x22720a=a152_0x54b0,_0x4eec75=_0x36c585?.[_0x22720a(0x21c)](_0x1957b5);if(_0x4eec75)return _0x4eec75;return _0x583450[_0x22720a(0x13e)][_0x22720a(0x229)](_0x1957b5);})};return _0x302c75=_0x2fddc7,_0x2fddc7;},_0x1c7190=async _0x4ec62d=>{const _0x4c3ee8=a152_0x54b0,{collectSegmentIdsFromJourneyApi:_0x18b53f}=await import(_0x4c3ee8(0x13f)),{batchAsync:_0x466468}=await import('../../utils/async.js'),_0x217a66=new Set();for(const _0x3bfe7d of _0x4ec62d){let _0x260845=_0x36c585?.[_0x4c3ee8(0x21c)](_0x3bfe7d);!_0x260845&&(_0x260845=await _0x583450[_0x4c3ee8(0x13e)][_0x4c3ee8(0x229)](_0x3bfe7d));const _0x19dd94=_0x18b53f(_0x260845);for(const _0x4a6afb of _0x19dd94){_0x217a66[_0x4c3ee8(0x180)](_0x4a6afb);}}let _0x2cffa1=Array[_0x4c3ee8(0x146)](_0x217a66);while(_0x2cffa1[_0x4c3ee8(0x1fd)]>0x0){const _0xecc5dc=_0x2cffa1['filter'](_0x3b2b15=>!_0x386c9b['has'](_0x3b2b15));if(_0xecc5dc[_0x4c3ee8(0x1fd)]===0x0)break;const _0x2a1471=await _0x466468(_0xecc5dc,async _0x419902=>{const _0x5330c1=_0x4c3ee8;_0x386c9b[_0x5330c1(0x180)](_0x419902);const _0x2c112b=await fetchSegment(_0x583450,_0x3206f3,_0x419902,_0xaf91ad);if(!_0x2c112b)return null;return{'segmentId':_0x419902,'segment':_0x2c112b};},0xa),_0x46cb6c=new Set();for(const _0x4ccdf2 of _0x2a1471){if(!_0x4ccdf2?.[_0x4c3ee8(0x240)]?.[_0x4c3ee8(0x176)])continue;const _0x2dbf11=apiRuleToYaml(_0x4ccdf2['segment'][_0x4c3ee8(0x176)]);_0x2eea8a[_0x4c3ee8(0x172)](_0x4ccdf2[_0x4c3ee8(0x16d)],_0x2dbf11);const _0x5e4ea0=collectSegmentRefsFromRule(_0x2dbf11);for(const _0x67f442 of _0x5e4ea0){!_0x386c9b[_0x4c3ee8(0x145)](_0x67f442)&&_0x46cb6c[_0x4c3ee8(0x180)](_0x67f442);}}_0x2cffa1=Array[_0x4c3ee8(0x146)](_0x46cb6c);}};return{'createYamlContext':_0xd63835,'prefetchJourneySegments':_0x1c7190};}export async function executePushSegments(_0x63d245,_0x4e74dc,_0x17ef44,_0x439987,_0x445ab7){const _0x2f9ad0=a152_0x59916b,{segmentDefToCreateRequest:_0x52ff48,segmentDefToUpdateRequest:_0x4b69d5}=await import('./child-segment-yaml.js'),_0x2bf66b=_0x17ef44['folderPathToId'],_0x416ec5=0x5,_0x43996b=async _0x88eccf=>{const _0x2f6c5d=a152_0x54b0,_0x2156aa=_0x88eccf[_0x2f6c5d(0x14e)]?_0x2bf66b[_0x2f6c5d(0x21c)](_0x88eccf[_0x2f6c5d(0x14e)]):undefined;let _0x4ca952;const _0xc9607d={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x11d7c4=_0x88eccf[_0x2f6c5d(0x245)];if(_0x88eccf['yamlConfig']['rule']){const _0x447dd6=createSegmentIdResolver(_0x17ef44[_0x2f6c5d(0x20d)],_0x88eccf['yamlConfig'][_0x2f6c5d(0x1ce)]),_0x2687ac=await resolveRuleSegmentIds(_0x88eccf['yamlConfig'][_0x2f6c5d(0x176)],_0x447dd6);_0x11d7c4={..._0x88eccf[_0x2f6c5d(0x245)],'rule':_0x2687ac};}try{if(_0x88eccf['isNew']){_0x445ab7[_0x2f6c5d(0x224)]?.({'type':_0x2f6c5d(0x1dd),'name':_0x88eccf['yamlConfig'][_0x2f6c5d(0x1ce)]});const _0x485fa1=_0x52ff48(_0x11d7c4,_0x2156aa),_0x4c3abf=await _0x445ab7[_0x2f6c5d(0x23e)]('Creating\x20segment\x20\x27'+_0x88eccf['yamlConfig']['name']+_0x2f6c5d(0x1aa),()=>_0x63d245[_0x2f6c5d(0x240)]['createSegment'](_0x439987[_0x2f6c5d(0x1c5)],_0x485fa1));_0x4ca952=_0x4c3abf['data']['id'],_0x17ef44[_0x2f6c5d(0x20d)]['set'](_0x88eccf[_0x2f6c5d(0x245)][_0x2f6c5d(0x1ce)],_0x4ca952),_0xc9607d[_0x2f6c5d(0x161)]={'name':_0x88eccf[_0x2f6c5d(0x245)][_0x2f6c5d(0x1ce)],'id':_0x4ca952},_0x445ab7[_0x2f6c5d(0x224)]?.({'type':_0x2f6c5d(0x1fb),'name':_0x88eccf[_0x2f6c5d(0x245)][_0x2f6c5d(0x1ce)],'segmentId':_0x4ca952}),_0x445ab7[_0x2f6c5d(0x1e6)]?.(_0x2f6c5d(0x18c)+_0x88eccf[_0x2f6c5d(0x245)][_0x2f6c5d(0x1ce)]+'\x27'),_0xc9607d['created']=0x1;}else{if(_0x88eccf[_0x2f6c5d(0x1f7)]){_0x445ab7[_0x2f6c5d(0x224)]?.({'type':_0x2f6c5d(0x17e),'name':_0x88eccf[_0x2f6c5d(0x245)]['name']});const _0x1ab5b4=_0x4b69d5(_0x11d7c4);_0x2156aa!==_0x88eccf[_0x2f6c5d(0x1f6)]?.[_0x2f6c5d(0x228)]&&(_0x1ab5b4['segmentFolderId']=_0x2156aa?parseInt(_0x2156aa,0xa):undefined),await _0x445ab7[_0x2f6c5d(0x23e)](_0x2f6c5d(0x163)+_0x88eccf[_0x2f6c5d(0x245)][_0x2f6c5d(0x1ce)]+_0x2f6c5d(0x1aa),()=>_0x63d245[_0x2f6c5d(0x240)]['updateSegmentById'](_0x439987[_0x2f6c5d(0x1c5)],_0x88eccf[_0x2f6c5d(0x1f6)]['id'],_0x1ab5b4)),_0x4ca952=_0x88eccf[_0x2f6c5d(0x1f6)]['id'],_0x445ab7[_0x2f6c5d(0x224)]?.({'type':_0x2f6c5d(0x1a5),'name':_0x88eccf[_0x2f6c5d(0x245)][_0x2f6c5d(0x1ce)]}),_0x445ab7[_0x2f6c5d(0x1e6)]?.('Updated\x20segment\x20\x27'+_0x88eccf['yamlConfig'][_0x2f6c5d(0x1ce)]+'\x27'),_0xc9607d[_0x2f6c5d(0x17c)]=0x1;}else _0x4ca952=_0x88eccf['existingSegment']['id'];}}catch(_0x2f8165){const _0x406cec=isHttp400Error(_0x2f8165),_0x128ae9=_0x406cec?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode[_0x2f6c5d(0x1c3)],_0x15cfc1=getErrorMessage(_0x2f8165);throw new SDKError(_0x128ae9,'Failed\x20to\x20'+(_0x88eccf[_0x2f6c5d(0x190)]?_0x2f6c5d(0x241):_0x2f6c5d(0x1b1))+_0x2f6c5d(0x20e)+_0x88eccf[_0x2f6c5d(0x202)]+_0x2f6c5d(0x1ab)+_0x15cfc1,_0x2f8165);}try{const _0x557955=await syncActivationsForSegment(_0x63d245,_0x439987[_0x2f6c5d(0x1c5)],_0x4ca952,_0x88eccf['yamlConfig'][_0x2f6c5d(0x1ce)],_0x88eccf[_0x2f6c5d(0x242)],_0x445ab7,_0x88eccf[_0x2f6c5d(0x202)]);_0xc9607d[_0x2f6c5d(0x1df)]=_0x557955;}catch(_0xc5f7d4){if(_0xc5f7d4 instanceof SDKError)throw _0xc5f7d4;throw new SDKError(ErrorCode[_0x2f6c5d(0x1cc)],_0x2f6c5d(0x196)+_0x88eccf[_0x2f6c5d(0x245)][_0x2f6c5d(0x1ce)]+_0x2f6c5d(0x142)+_0x88eccf[_0x2f6c5d(0x202)]+'\x0a\x20\x20'+getErrorMessage(_0xc5f7d4),_0xc5f7d4);}return _0xc9607d;},_0x5d9334=await batchAsync(_0x4e74dc,_0x43996b,_0x416ec5),_0x5f4bc3={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x1a0582 of _0x5d9334){_0x5f4bc3['created']+=_0x1a0582[_0x2f9ad0(0x1dc)],_0x5f4bc3[_0x2f9ad0(0x17c)]+=_0x1a0582[_0x2f9ad0(0x17c)],_0x1a0582[_0x2f9ad0(0x161)]&&_0x5f4bc3[_0x2f9ad0(0x200)][_0x2f9ad0(0x172)](_0x1a0582[_0x2f9ad0(0x161)]['name'],_0x1a0582[_0x2f9ad0(0x161)]['id']),_0x5f4bc3[_0x2f9ad0(0x1df)][_0x2f9ad0(0x1dc)]+=_0x1a0582[_0x2f9ad0(0x1df)][_0x2f9ad0(0x1dc)],_0x5f4bc3[_0x2f9ad0(0x1df)][_0x2f9ad0(0x17c)]+=_0x1a0582[_0x2f9ad0(0x1df)][_0x2f9ad0(0x17c)],_0x5f4bc3[_0x2f9ad0(0x1df)][_0x2f9ad0(0x1c7)]+=_0x1a0582['activations'][_0x2f9ad0(0x1c7)];}return _0x5f4bc3;}async function syncActivationsForSegment(_0x2cefd8,_0xe1c161,_0x4cd661,_0x39ca84,_0x369e83,_0x25a881,_0x359c99){const _0x3562e2=a152_0x59916b,_0xcb1fd8={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0xbc1bc4 of _0x369e83){try{if(_0xbc1bc4[_0x3562e2(0x216)]==='create'&&_0xbc1bc4['validatedRequest'])_0x25a881[_0x3562e2(0x224)]?.({'type':'activation_creating','segmentName':_0x39ca84,'activationName':_0xbc1bc4[_0x3562e2(0x1ce)]}),await _0x25a881[_0x3562e2(0x23e)]('Creating\x20activation\x20\x27'+_0xbc1bc4[_0x3562e2(0x1ce)]+_0x3562e2(0x1aa),()=>_0x2cefd8[_0x3562e2(0x240)][_0x3562e2(0x143)](_0xe1c161,_0x4cd661,_0xbc1bc4[_0x3562e2(0x152)])),_0x25a881['onProgress']?.({'type':'activation_created','segmentName':_0x39ca84,'activationName':_0xbc1bc4['name']}),_0x25a881['logSuccess']?.(_0x3562e2(0x222)+_0xbc1bc4['name']+'\x27'),_0xcb1fd8[_0x3562e2(0x1dc)]++;else{if(_0xbc1bc4[_0x3562e2(0x216)]===_0x3562e2(0x1b1)&&_0xbc1bc4[_0x3562e2(0x152)]&&_0xbc1bc4['existingActivation'])_0x25a881[_0x3562e2(0x224)]?.({'type':_0x3562e2(0x244),'segmentName':_0x39ca84,'activationName':_0xbc1bc4[_0x3562e2(0x1ce)]}),await _0x25a881['withProgress']('Updating\x20activation\x20\x27'+_0xbc1bc4[_0x3562e2(0x1ce)]+_0x3562e2(0x1aa),()=>_0x2cefd8['segment'][_0x3562e2(0x1d8)](_0xe1c161,_0x4cd661,_0xbc1bc4[_0x3562e2(0x1af)]['id'],_0xbc1bc4[_0x3562e2(0x152)])),_0x25a881[_0x3562e2(0x224)]?.({'type':_0x3562e2(0x21b),'segmentName':_0x39ca84,'activationName':_0xbc1bc4[_0x3562e2(0x1ce)]}),_0x25a881['logSuccess']?.(_0x3562e2(0x150)+_0xbc1bc4['name']+'\x27'),_0xcb1fd8['updated']++;else _0xbc1bc4['type']===_0x3562e2(0x193)&&_0xbc1bc4[_0x3562e2(0x1af)]&&(_0x25a881[_0x3562e2(0x224)]?.({'type':_0x3562e2(0x214),'segmentName':_0x39ca84,'activationName':_0xbc1bc4[_0x3562e2(0x1ce)]}),await _0x25a881[_0x3562e2(0x23e)](_0x3562e2(0x182)+_0xbc1bc4[_0x3562e2(0x1ce)]+_0x3562e2(0x1aa),()=>_0x2cefd8[_0x3562e2(0x240)][_0x3562e2(0x1f4)](_0xe1c161,_0x4cd661,_0xbc1bc4[_0x3562e2(0x1af)]['id'])),_0x25a881[_0x3562e2(0x224)]?.({'type':'activation_deleted','segmentName':_0x39ca84,'activationName':_0xbc1bc4[_0x3562e2(0x1ce)]}),_0x25a881[_0x3562e2(0x16b)]?.(_0x3562e2(0x1bb)+_0xbc1bc4[_0x3562e2(0x1ce)]+'\x27'),_0xcb1fd8[_0x3562e2(0x1c7)]++);}}catch(_0x4010af){const _0x15bf09=isHttp400Error(_0x4010af),_0xafbbe5=_0x15bf09?ErrorCode[_0x3562e2(0x165)]:ErrorCode[_0x3562e2(0x1cc)],_0x121a92=getErrorMessage(_0x4010af);throw new SDKError(_0xafbbe5,_0x3562e2(0x184)+_0xbc1bc4[_0x3562e2(0x216)]+_0x3562e2(0x17f)+_0xbc1bc4[_0x3562e2(0x1ce)]+_0x3562e2(0x142)+_0x359c99+_0x3562e2(0x1ab)+_0x121a92,_0x4010af);}}return _0xcb1fd8;}export async function executePushFolders(_0x3d07a5,_0x327f0d,_0x189ecd,_0xeb48c1,_0x440b1a){const _0x50514a=a152_0x59916b,_0x205fe7=new Map(_0x189ecd),_0x3933b0=sortFoldersByDepth(_0x327f0d);for(const _0x33c87a of _0x3933b0){const _0x508381=_0x33c87a[_0x50514a(0x1e8)]('/'),_0x533c20=_0x508381[_0x508381[_0x50514a(0x1fd)]-0x1],_0x22548f=_0x508381['slice'](0x0,-0x1)['join']('/'),_0x194fd3=_0x205fe7['get'](_0x22548f);_0x440b1a[_0x50514a(0x224)]?.({'type':_0x50514a(0x174),'folder':_0x33c87a});const _0x24283f={'name':_0x533c20,'parentFolderId':_0x194fd3},_0x2aa1c1=await _0x440b1a[_0x50514a(0x23e)]('Creating\x20folder\x20\x27'+_0x33c87a+_0x50514a(0x1aa),()=>_0x3d07a5[_0x50514a(0x240)][_0x50514a(0x1ea)](_0xeb48c1[_0x50514a(0x1c5)],_0x24283f));_0x205fe7[_0x50514a(0x172)](_0x33c87a,_0x2aa1c1['data']['id']),_0x440b1a[_0x50514a(0x224)]?.({'type':_0x50514a(0x151),'folder':_0x33c87a,'folderId':_0x2aa1c1[_0x50514a(0x1b6)]['id']}),_0x440b1a[_0x50514a(0x185)]?.('Created\x20folder\x20\x27'+_0x33c87a+'\x27');}return _0x205fe7;}export async function executePushSegmentDeletions(_0x1068cc,_0x859a7,_0x13ad19){const _0x22f52d=a152_0x59916b;if(_0x859a7[_0x22f52d(0x1fd)]===0x0)return 0x0;const {batchAsync:_0x3f3164}=await import(_0x22f52d(0x158)),_0x2436a4=0x5,_0x39f5d8=await _0x3f3164(_0x859a7,async _0x472953=>{const _0x442197=_0x22f52d;return _0x13ad19[_0x442197(0x224)]?.({'type':_0x442197(0x178),'name':_0x472953[_0x442197(0x1ce)]}),await _0x1068cc['segment'][_0x442197(0x22e)](_0x472953['id']),_0x13ad19['onProgress']?.({'type':_0x442197(0x1b9),'name':_0x472953[_0x442197(0x1ce)]}),_0x13ad19[_0x442197(0x16b)]?.('Deleted\x20segment\x20\x27'+_0x472953[_0x442197(0x1ce)]+'\x27'),0x1;},_0x2436a4);return _0x39f5d8[_0x22f52d(0x21e)]((_0x332287,_0x2b2ea8)=>_0x332287+_0x2b2ea8,0x0);}export async function executePushJourneys(_0x5f1422,_0x2b7610,_0x21aa85,_0x3d4280,_0x49444e){const _0x4c3656=a152_0x59916b,{journeyDefToRequest:_0x462a49}=await import(_0x4c3656(0x13f)),{activationDefToCreateRequest:_0x17d97b,yamlRuleToApi:_0x1856f0,validateSegmentRule:_0x1af0f4}=await import(_0x4c3656(0x20c)),_0x58b820={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x4c42bf=new Map(_0x21aa85['segmentNameToId']),_0x3f0173=0x5;for(let _0x3a2eea=0x0;_0x3a2eea<_0x2b7610[_0x4c3656(0x1fd)];_0x3a2eea+=_0x3f0173){const _0x51817a=_0x2b7610['slice'](_0x3a2eea,_0x3a2eea+_0x3f0173),_0x6f670=await Promise['all'](_0x51817a[_0x4c3656(0x1da)](async _0x4b0f62=>{const _0x33c20e=_0x4c3656;if(!_0x4b0f62[_0x33c20e(0x190)]&&!_0x4b0f62[_0x33c20e(0x1f7)])return{'action':_0x33c20e(0x181),'name':_0x4b0f62[_0x33c20e(0x245)][_0x33c20e(0x1ce)],'journeyId':_0x4b0f62[_0x33c20e(0x1f0)]?.['id']};const _0x45acad=_0x4b0f62[_0x33c20e(0x14e)]?_0x21aa85[_0x33c20e(0x1b0)][_0x33c20e(0x21c)](_0x4b0f62[_0x33c20e(0x14e)]):undefined;_0x49444e[_0x33c20e(0x224)]?.({'type':_0x4b0f62[_0x33c20e(0x190)]?_0x33c20e(0x201):_0x33c20e(0x234),'name':_0x4b0f62['yamlConfig'][_0x33c20e(0x1ce)]});try{const _0xbfae44=await executeSingleJourneyPush(_0x5f1422,_0x4b0f62,{..._0x21aa85,'segmentNameToId':_0x4c42bf},{'parentId':_0x3d4280[_0x33c20e(0x1c5)],'rootFolderId':_0x3d4280[_0x33c20e(0x1e4)],'folderId':_0x45acad,'verbose':_0x3d4280[_0x33c20e(0x195)]},_0x49444e,{'journeyDefToRequest':_0x462a49,'activationDefToCreateRequest':_0x17d97b,'yamlRuleToApi':_0x1856f0,'validateSegmentRule':_0x1af0f4});for(const [_0x55b2c3,_0x50713a]of _0xbfae44[_0x33c20e(0x1eb)]){_0x4c42bf[_0x33c20e(0x172)](_0x55b2c3,_0x50713a),_0x58b820[_0x33c20e(0x1eb)][_0x33c20e(0x172)](_0x55b2c3,_0x50713a);}if(_0xbfae44['action']===_0x33c20e(0x1dc))_0x49444e[_0x33c20e(0x224)]?.({'type':_0x33c20e(0x22a),'name':_0x4b0f62[_0x33c20e(0x245)][_0x33c20e(0x1ce)],'journeyId':_0xbfae44[_0x33c20e(0x223)]}),_0x49444e['logSuccess']?.('Created\x20journey\x20\x27'+_0x4b0f62[_0x33c20e(0x245)]['name']+'\x27'),_0x58b820[_0x33c20e(0x1dc)]++;else _0xbfae44[_0x33c20e(0x1b7)]==='updated'&&(_0x49444e[_0x33c20e(0x224)]?.({'type':_0x33c20e(0x160),'name':_0x4b0f62[_0x33c20e(0x245)][_0x33c20e(0x1ce)]}),_0x49444e[_0x33c20e(0x1e6)]?.(_0x33c20e(0x1bd)+_0x4b0f62[_0x33c20e(0x245)]['name']+'\x27'),_0x58b820[_0x33c20e(0x17c)]++);return{'action':_0xbfae44[_0x33c20e(0x1b7)],'name':_0x4b0f62[_0x33c20e(0x245)][_0x33c20e(0x1ce)],'journeyId':_0xbfae44[_0x33c20e(0x223)]};}catch(_0x152caa){const _0x13fdb9=isHttp400Error(_0x152caa),_0xc51b96=_0x13fdb9?ErrorCode[_0x33c20e(0x19b)]:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x22fa48=getErrorMessage(_0x152caa);throw new SDKError(_0xc51b96,_0x33c20e(0x184)+(_0x4b0f62['isNew']?_0x33c20e(0x241):_0x33c20e(0x1b1))+'\x20journey\x20from\x20file:\x20'+_0x4b0f62[_0x33c20e(0x202)]+'\x0a\x20\x20'+_0x22fa48,_0x152caa);}}));_0x58b820['results'][_0x4c3656(0x1ae)](..._0x6f670);}return _0x58b820;}async function matchExistingJourneySegments(_0x4115e2,_0x47cb7e,_0x36dbb8,_0x552acf,_0x3d6f91){const _0x59e8a1=a152_0x59916b;if(!_0x47cb7e[_0x59e8a1(0x1f0)]||!_0x47cb7e[_0x59e8a1(0x245)][_0x59e8a1(0x23d)])return;const _0x24b240=new Map(),_0x41d105=new Set();for(const _0x1496d2 of Object[_0x59e8a1(0x141)](_0x47cb7e['yamlConfig']['segments'])){const _0x1f6e85=generateDeterministicJourneySegmentName(_0x47cb7e[_0x59e8a1(0x245)][_0x59e8a1(0x1ce)],_0x1496d2);_0x24b240[_0x59e8a1(0x172)](_0x1f6e85,_0x1496d2),_0x41d105[_0x59e8a1(0x180)](_0x1496d2);}const _0x4d0f07=[],_0x4969ed=collectSegmentIdsFromJourneyApi(_0x47cb7e[_0x59e8a1(0x1f0)]);for(const _0x3fba49 of _0x4969ed){const _0x49b58e=await fetchSegment(_0x4115e2,_0x36dbb8,_0x3fba49,_0x552acf);if(!_0x49b58e?.[_0x59e8a1(0x1ce)])continue;const _0x50139c=_0x24b240[_0x59e8a1(0x21c)](_0x49b58e[_0x59e8a1(0x1ce)]);_0x50139c?(_0x3d6f91['set'](_0x50139c,_0x3fba49),_0x41d105[_0x59e8a1(0x193)](_0x50139c)):_0x4d0f07[_0x59e8a1(0x1ae)]({'id':_0x3fba49,'seg':_0x49b58e});}if(_0x41d105[_0x59e8a1(0x1ff)]>0x0&&_0x4d0f07[_0x59e8a1(0x1fd)]>0x0){const {localExpandedRuleToNames:_0x4589ca}=buildLocalExpandedRuleMappings(_0x47cb7e['yamlConfig']),_0x3ec683=new Map();for(const {id:_0x2d0d39,seg:_0x373dc2}of _0x4d0f07){if(_0x373dc2[_0x59e8a1(0x176)]){const _0x119a43=apiRuleToYaml(_0x373dc2[_0x59e8a1(0x176)]);_0x3ec683[_0x59e8a1(0x172)](_0x2d0d39,_0x119a43);}}for(const {id:_0xde403,seg:_0xc6b2f2}of _0x4d0f07){if(!_0xc6b2f2[_0x59e8a1(0x176)])continue;const _0x14e6d3=_0x3ec683[_0x59e8a1(0x21c)](_0xde403);if(!_0x14e6d3)continue;const _0x5e9316=serializeExpandedRule(_0x14e6d3,_0x3ec683),_0x52e184=_0x4589ca[_0x59e8a1(0x21c)](_0x5e9316);if(_0x52e184){const _0x50a840=_0x52e184[_0x59e8a1(0x16c)](_0x3fb4ec=>_0x41d105[_0x59e8a1(0x145)](_0x3fb4ec));_0x50a840&&(_0x3d6f91['set'](_0x50a840,_0xde403),_0x41d105[_0x59e8a1(0x193)](_0x50a840),logger[_0x59e8a1(0x186)](_0x59e8a1(0x183)+_0xc6b2f2[_0x59e8a1(0x1ce)]+_0x59e8a1(0x1e0)+_0x50a840+_0x59e8a1(0x17a)));}}}}async function executeSingleJourneyPush(_0x43f726,_0x2e525e,_0x26386d,_0x4e74da,_0x2c2f8f,_0x56b4d1){const _0xe4749c=a152_0x59916b,{journeyDefToRequest:_0x1452d3,activationDefToCreateRequest:_0x4c826a,yamlRuleToApi:_0x5a9b64,validateSegmentRule:_0x2965f7}=_0x56b4d1,_0x4286e6=new Map(),_0x1143c9=new Map();recoverSegmentIdsFromPushRecovery(_0x2e525e,_0x4286e6,_0x26386d['segmentNameToId']);const _0x2e4dd0=new Map(),_0x1da4b0=new Map(),_0x7af2ad=new Map();let _0x1d58b1;const _0x81162=async()=>{const _0x220232=a152_0x54b0;if(_0x1d58b1)return;_0x1d58b1=new Map();if(!_0x2e525e['existingJourney'])return;const _0x35f6fd=await _0x43f726[_0x220232(0x13e)][_0x220232(0x1ee)](_0x2e525e[_0x220232(0x1f0)]['id']);for(const _0x36163b of _0x35f6fd){const _0x1b7ae1=journeyActivationStepToYaml(_0x36163b,_0x26386d['idToEmailMap'],_0x26386d[_0x220232(0x247)]),_0x3a7046=activationSignature(_0x1b7ae1);!_0x1d58b1[_0x220232(0x145)](_0x3a7046)&&_0x1d58b1[_0x220232(0x172)](_0x3a7046,_0x36163b['id']),_0x1b7ae1[_0x220232(0x1ce)]&&_0x1143c9[_0x220232(0x172)](_0x1b7ae1[_0x220232(0x1ce)],_0x36163b['id']);}};await matchExistingJourneySegments(_0x43f726,_0x2e525e,_0x4e74da['parentId'],_0x26386d[_0xe4749c(0x1bf)],_0x26386d['segmentNameToId']);const _0x53bd51={'resolveSegmentId':async _0x5c1858=>{const _0x4e1fd7=_0xe4749c,_0x2d0fe0=_0x26386d[_0x4e1fd7(0x20d)][_0x4e1fd7(0x21c)](_0x5c1858);if(!_0x2d0fe0)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4e1fd7(0x213)+_0x5c1858+_0x4e1fd7(0x177)+_0x2e525e[_0x4e1fd7(0x245)]['name']+')');return _0x2d0fe0;},'resolveEmbeddedSegmentId':async(_0x130ec0,_0x173808)=>{const _0x3073ce=_0xe4749c,_0x13669f=_0x26386d[_0x3073ce(0x20d)]['get'](_0x130ec0);if(_0x13669f)return _0x13669f;const _0x154669=_0x26386d[_0x3073ce(0x1bf)][_0x3073ce(0x16c)](_0xd8f6e=>_0xd8f6e[_0x3073ce(0x1ce)]===_0x130ec0);if(_0x154669)return _0x26386d['segmentNameToId'][_0x3073ce(0x172)](_0x130ec0,_0x154669['id']),_0x154669['id'];if(_0x2e525e[_0x3073ce(0x190)]){const {stageName:_0x1c037a,criteriaName:_0x47f62e}=findSegmentCriteriaLocation(_0x2e525e[_0x3073ce(0x245)],_0x130ec0);return _0x2965f7(_0x130ec0,_0x173808[_0x3073ce(0x176)]),_0x1da4b0[_0x3073ce(0x172)](_0x130ec0,{'definition':_0x173808,'stageName':_0x1c037a,'criteriaName':_0x47f62e}),createPendingSegmentId(_0x130ec0);}const _0x320b60=_0x2e525e[_0x3073ce(0x1f0)]?.['id'];if(!_0x320b60)throw new SDKError(ErrorCode[_0x3073ce(0x1e2)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x4dbf6e=_0x2e4dd0['get'](_0x130ec0);if(_0x4dbf6e)return _0x4dbf6e;const _0x323695=((async()=>{const _0xa929bb=_0x3073ce;_0x2965f7(_0x130ec0,_0x173808[_0xa929bb(0x176)]);const _0x100520=generateDeterministicJourneySegmentName(_0x2e525e[_0xa929bb(0x245)][_0xa929bb(0x1ce)],_0x130ec0),_0x2f15e7=_0x26386d[_0xa929bb(0x1bf)][_0xa929bb(0x16c)](_0x2f6398=>_0x2f6398[_0xa929bb(0x1ce)]===_0x100520),_0x33c6e0=createSegmentIdResolver(_0x26386d[_0xa929bb(0x20d)],_0x130ec0),_0x3c3cf8=await resolveRuleSegmentIds(_0x173808[_0xa929bb(0x176)],_0x33c6e0);let _0x30ccc8;return _0x2f15e7?(await _0x43f726[_0xa929bb(0x240)][_0xa929bb(0x1ad)](_0x4e74da[_0xa929bb(0x1c5)],_0x2f15e7['id'],{'description':_0x173808[_0xa929bb(0x1a3)]||_0xa929bb(0x1f8)+_0x130ec0,'rule':_0x5a9b64(_0x3c3cf8,!![]),'countPopulation':!![]}),_0x30ccc8=_0x2f15e7['id'],saveSegmentToPushRecovery(_0x2e525e[_0xa929bb(0x202)],_0x2e525e[_0xa929bb(0x245)][_0xa929bb(0x1ce)],_0x130ec0,{'segmentId':_0x30ccc8,'uniqueServerName':_0x100520,'createdAt':new Date()[_0xa929bb(0x22d)]()})):_0x30ccc8=await createOrRecoverEmbeddedSegment(_0x43f726,_0x2e525e,{'localName':_0x130ec0,'uniqueSegmentName':_0x100520,'description':_0x173808[_0xa929bb(0x1a3)]||'Entry\x20criteria:\x20'+_0x130ec0,'journeyId':_0x320b60,'resolvedRule':_0x3c3cf8,'parentId':_0x4e74da['parentId'],'folderId':_0x4e74da[_0xa929bb(0x1e4)]||''},_0x5a9b64),_0x26386d[_0xa929bb(0x20d)]['set'](_0x130ec0,_0x30ccc8),_0x4286e6[_0xa929bb(0x172)](_0x130ec0,_0x30ccc8),_0x30ccc8;})());_0x2e4dd0[_0x3073ce(0x172)](_0x130ec0,_0x323695);try{return await _0x323695;}finally{_0x2e4dd0[_0x3073ce(0x193)](_0x130ec0);}},'resolveActivationId':async _0x412dfd=>{const _0x3d5e01=_0xe4749c,_0x14306a=_0x1143c9[_0x3d5e01(0x21c)](_0x412dfd);if(_0x14306a)return _0x14306a;if(_0x2e525e[_0x3d5e01(0x1f0)]){await _0x81162();const _0x3f9e8f=_0x1143c9[_0x3d5e01(0x21c)](_0x412dfd);if(_0x3f9e8f)return _0x3f9e8f;}throw new SDKError(ErrorCode[_0x3d5e01(0x15f)],_0x3d5e01(0x198)+_0x412dfd+_0x3d5e01(0x177)+_0x2e525e[_0x3d5e01(0x245)][_0x3d5e01(0x1ce)]+_0x3d5e01(0x21f)+_0x3d5e01(0x170));},'resolveEmbeddedActivationId':async(_0x5de786,_0x3f0c2d)=>{const _0x15b1c9=_0xe4749c,_0x18be07=_0x1143c9[_0x15b1c9(0x21c)](_0x5de786);if(_0x18be07)return _0x18be07;if(_0x2e525e['isNew'])return _0x7af2ad['set'](_0x5de786,_0x3f0c2d),createPendingActivationId(_0x5de786);if(_0x2e525e[_0x15b1c9(0x1f0)]){await _0x81162();const _0x5354df=_0x1143c9[_0x15b1c9(0x21c)](_0x3f0c2d[_0x15b1c9(0x1ce)]);if(_0x5354df)return _0x1143c9['set'](_0x5de786,_0x5354df),_0x5354df;const _0x41df67=activationSignature(_0x3f0c2d),_0x3c9f7d=_0x1d58b1?.['get'](_0x41df67);if(_0x3c9f7d)return _0x1143c9['set'](_0x5de786,_0x3c9f7d),_0x3c9f7d;const _0x20c667=await _0x4c826a(_0x3f0c2d,_0x26386d[_0x15b1c9(0x1b8)]),_0x1aadce={..._0x20c667,..._0x3f0c2d[_0x15b1c9(0x179)]!==undefined&&{'runAfterJourneyRefresh':_0x3f0c2d[_0x15b1c9(0x179)]}},_0x565582=await _0x43f726['journey'][_0x15b1c9(0x143)](_0x2e525e[_0x15b1c9(0x1f0)]['id'],_0x1aadce);return _0x1143c9[_0x15b1c9(0x172)](_0x5de786,_0x565582['id']),_0x565582['id'];}throw new SDKError(ErrorCode[_0x15b1c9(0x1e2)],_0x15b1c9(0x18e));},'resolveJourneyId':async _0x3f3a18=>{const _0x10651e=_0xe4749c;try{return await _0x43f726[_0x10651e(0x13e)][_0x10651e(0x23f)](_0x4e74da[_0x10651e(0x1c5)],_0x3f3a18);}catch(_0x4d3ad1){throw new SDKError(ErrorCode['NOT_FOUND'],_0x10651e(0x18b)+_0x3f3a18+_0x10651e(0x1d0)+_0x2e525e[_0x10651e(0x245)][_0x10651e(0x1ce)]+'\x27)',_0x4d3ad1);}},'resolveStageId':async(_0x355a56,_0xdd0803)=>{const _0x29c347=_0xe4749c,_0x5bf2f6=await _0x43f726[_0x29c347(0x13e)][_0x29c347(0x229)](_0x355a56),_0x24f640=_0x5bf2f6[_0x29c347(0x211)][_0x29c347(0x1ca)]['find'](_0x5af390=>_0x5af390['name'][_0x29c347(0x1d1)]()===_0xdd0803[_0x29c347(0x1d1)]());if(!_0x24f640?.['id'])throw new SDKError(ErrorCode[_0x29c347(0x15f)],_0x29c347(0x19e)+_0xdd0803+_0x29c347(0x239)+(_0x5bf2f6['attributes'][_0x29c347(0x15c)]||_0x5bf2f6[_0x29c347(0x211)][_0x29c347(0x1ce)])+'\x27');return _0x24f640['id'];}},_0x2b1519=await _0x1452d3(_0x2e525e[_0xe4749c(0x245)],_0x4e74da[_0xe4749c(0x1c5)],_0x53bd51),_0x46d0bf=_0x4e74da[_0xe4749c(0x169)]||_0x4e74da[_0xe4749c(0x1e4)];_0x46d0bf&&(_0x2b1519[_0xe4749c(0x1ef)]={'parentFolder':{'data':{'id':_0x46d0bf,'type':_0xe4749c(0x19a)}}});if(_0x2e525e[_0xe4749c(0x190)]){if(_0x1da4b0[_0xe4749c(0x1ff)]>0x0||_0x7af2ad[_0xe4749c(0x1ff)]>0x0)return await executeThreeStepJourneyCreate(_0x43f726,_0x2e525e,_0x2b1519,{'pendingEmbeddedSegments':_0x1da4b0,'pendingEmbeddedActivations':_0x7af2ad,'embeddedSegmentNameToId':_0x4286e6,'journeyActivationNameToId':_0x1143c9},{..._0x4e74da,'effectiveFolderId':_0x46d0bf},_0x26386d,_0x2c2f8f,_0x56b4d1);else{ensureJourneyDefaults(_0x2b1519[_0xe4749c(0x211)]);const _0x3590f8=await _0x43f726[_0xe4749c(0x13e)][_0xe4749c(0x241)](_0x2b1519);return deletePushRecovery(_0x2e525e[_0xe4749c(0x202)]),{'action':'created','journeyId':_0x3590f8['id'],'embeddedSegmentNameToId':_0x4286e6};}}else{if(_0x2e525e[_0xe4749c(0x1f7)]&&_0x2e525e[_0xe4749c(0x1f0)]){_0x2b1519['id']=_0x2e525e[_0xe4749c(0x1f0)]['id'];const _0x3da5bf=_0x2b1519[_0xe4749c(0x211)];_0x2e525e['existingJourney'][_0xe4749c(0x211)]?.[_0xe4749c(0x15c)]&&(_0x3da5bf['journeyBundleName']=_0x2e525e['existingJourney'][_0xe4749c(0x211)][_0xe4749c(0x15c)]);const _0x3769fe=_0x2e525e['existingJourney'][_0xe4749c(0x211)]?.[_0xe4749c(0x1ca)];return _0x3769fe&&_0x2b1519[_0xe4749c(0x211)][_0xe4749c(0x1ca)]&&injectExistingStageIds(_0x2b1519[_0xe4749c(0x211)][_0xe4749c(0x1ca)],_0x3769fe),ensureJourneyDefaults(_0x3da5bf),await _0x43f726['journey'][_0xe4749c(0x1b1)](_0x2e525e[_0xe4749c(0x1f0)]['id'],_0x2b1519),deletePushRecovery(_0x2e525e[_0xe4749c(0x202)]),{'action':_0xe4749c(0x17c),'journeyId':_0x2e525e[_0xe4749c(0x1f0)]['id'],'embeddedSegmentNameToId':_0x4286e6};}}return deletePushRecovery(_0x2e525e['absolutePath']),{'action':_0xe4749c(0x181),'journeyId':_0x2e525e[_0xe4749c(0x1f0)]?.['id'],'embeddedSegmentNameToId':_0x4286e6};}function findSegmentCriteriaLocation(_0x16fe36,_0x5ea9d3){const _0x18b84d=a152_0x59916b,_0x11c30f=_0x16fe36[_0x18b84d(0x1ba)]||_0x16fe36[_0x18b84d(0x232)]?.[0x0]?.[_0x18b84d(0x1ba)]||[];let _0x5528e8=_0x18b84d(0x16e),_0x5a646f=_0x5ea9d3;const _0x269714=_0x16fe36[_0x18b84d(0x227)]||_0x16fe36[_0x18b84d(0x232)]?.[0x0]?.[_0x18b84d(0x227)];if(_0x269714?.[_0x18b84d(0x240)]===_0x5ea9d3)return{'stageName':'goal','criteriaName':_0x269714[_0x18b84d(0x1ce)]||_0x5ea9d3};_0x215a08:for(const _0x97b1b4 of _0x11c30f){if(_0x97b1b4[_0x18b84d(0x20b)]?.['segment']===_0x5ea9d3){_0x5528e8=_0x97b1b4[_0x18b84d(0x1ce)],_0x5a646f=_0x97b1b4[_0x18b84d(0x20b)]['name']||_0x5ea9d3;break;}if(_0x97b1b4[_0x18b84d(0x18d)])for(const _0x594ad1 of _0x97b1b4[_0x18b84d(0x18d)]){if(_0x594ad1[_0x18b84d(0x216)]===_0x18b84d(0x18f)&&_0x594ad1[_0x18b84d(0x155)]?.['branches'])for(const _0x45913a of _0x594ad1[_0x18b84d(0x155)][_0x18b84d(0x210)]){if(_0x45913a['segment']===_0x5ea9d3){_0x5528e8=_0x97b1b4[_0x18b84d(0x1ce)],_0x5a646f=_0x45913a[_0x18b84d(0x1ce)]||_0x5ea9d3;break _0x215a08;}}}}return{'stageName':_0x5528e8,'criteriaName':_0x5a646f};}async function executeThreeStepJourneyCreate(_0x111b10,_0x4e323a,_0x16e2f4,_0x181b0b,_0x36211d,_0x35b752,_0x42d6f7,_0x1e6dd8){const _0x40f436=a152_0x59916b,{activationDefToCreateRequest:_0x5b23ef,yamlRuleToApi:_0x1ac70c}=_0x1e6dd8,{pendingEmbeddedSegments:_0x32f862,pendingEmbeddedActivations:_0x42847f,embeddedSegmentNameToId:_0x6739cd}=_0x181b0b,_0x1f00f8=JSON[_0x40f436(0x14c)](JSON[_0x40f436(0x18a)](_0x16e2f4));ensureJourneyDefaults(_0x1f00f8[_0x40f436(0x211)]),stripPendingIds(_0x1f00f8);const _0x15779c=await _0x111b10[_0x40f436(0x13e)]['create'](_0x1f00f8),_0x1bc42d=_0x15779c['id'],_0x5be842=new Map();for(const _0xbd7fad of _0x15779c[_0x40f436(0x211)][_0x40f436(0x1ca)]){_0x5be842[_0x40f436(0x172)](_0xbd7fad[_0x40f436(0x1ce)][_0x40f436(0x1d1)](),_0xbd7fad['id']);}recoverSegmentIdsFromPushRecovery(_0x4e323a,_0x6739cd,_0x35b752[_0x40f436(0x20d)]);for(const [_0x56eef1,{definition:_0x31e2f2}]of _0x32f862){if(_0x6739cd[_0x40f436(0x145)](_0x56eef1)){_0x42d6f7[_0x40f436(0x224)]?.({'type':_0x40f436(0x1a7),'journeyName':_0x4e323a[_0x40f436(0x245)][_0x40f436(0x1ce)],'segmentName':_0x56eef1});continue;}const _0x3fe8ef=generateDeterministicJourneySegmentName(_0x4e323a[_0x40f436(0x245)][_0x40f436(0x1ce)],_0x56eef1);_0x42d6f7[_0x40f436(0x224)]?.({'type':_0x40f436(0x1c2),'journeyName':_0x4e323a['yamlConfig'][_0x40f436(0x1ce)],'segmentName':_0x56eef1});const _0x4fe8aa=createSegmentIdResolver(_0x35b752['segmentNameToId'],_0x56eef1),_0x111c9c=await resolveRuleSegmentIds(_0x31e2f2[_0x40f436(0x176)],_0x4fe8aa),_0x209a2b=await createOrRecoverEmbeddedSegment(_0x111b10,_0x4e323a,{'localName':_0x56eef1,'uniqueSegmentName':_0x3fe8ef,'description':_0x31e2f2['description']||_0x40f436(0x1f8)+_0x56eef1,'journeyId':_0x1bc42d,'resolvedRule':_0x111c9c,'parentId':_0x36211d[_0x40f436(0x1c5)],'folderId':_0x36211d[_0x40f436(0x21a)]||''},_0x1ac70c);_0x6739cd[_0x40f436(0x172)](_0x56eef1,_0x209a2b),_0x35b752[_0x40f436(0x20d)][_0x40f436(0x172)](_0x56eef1,_0x209a2b),_0x42d6f7[_0x40f436(0x224)]?.({'type':_0x40f436(0x1a7),'journeyName':_0x4e323a[_0x40f436(0x245)][_0x40f436(0x1ce)],'segmentName':_0x56eef1});}const _0x32ccec=new Map();for(const [_0x2f8476,_0x2fd152]of _0x42847f){_0x42d6f7['onProgress']?.({'type':'embedded_activation_creating','journeyName':_0x4e323a[_0x40f436(0x245)]['name'],'activationName':_0x2f8476});const _0x523776=await _0x5b23ef(_0x2fd152,_0x35b752[_0x40f436(0x1b8)]),_0x52a627={..._0x523776,..._0x2fd152[_0x40f436(0x179)]!==undefined&&{'runAfterJourneyRefresh':_0x2fd152[_0x40f436(0x179)]}},_0x4bbae5=await _0x111b10['journey'][_0x40f436(0x143)](_0x1bc42d,_0x52a627);_0x32ccec[_0x40f436(0x172)](_0x2f8476,_0x4bbae5['id']),_0x181b0b[_0x40f436(0x215)][_0x40f436(0x172)](_0x2f8476,_0x4bbae5['id']),_0x42d6f7[_0x40f436(0x224)]?.({'type':_0x40f436(0x237),'journeyName':_0x4e323a['yamlConfig'][_0x40f436(0x1ce)],'activationName':_0x2f8476});}const _0x2cbc37=JSON['parse'](JSON['stringify'](_0x16e2f4));return _0x2cbc37['id']=_0x1bc42d,ensureJourneyDefaults(_0x2cbc37[_0x40f436(0x211)]),resolvePendingIdsInRequest(_0x2cbc37,_0x16e2f4,_0x5be842,_0x6739cd,_0x32ccec,_0x42d6f7),await _0x111b10[_0x40f436(0x13e)]['update'](_0x1bc42d,_0x2cbc37),deletePushRecovery(_0x4e323a[_0x40f436(0x202)]),{'action':'created','journeyId':_0x1bc42d,'embeddedSegmentNameToId':_0x6739cd};}export function stripWaitStepPendingIds(_0x20a5ac){const _0x3de059=a152_0x59916b,_0x22955b=_0x20a5ac[_0x3de059(0x21d)]&&isPendingSegmentId(_0x20a5ac[_0x3de059(0x21d)]),_0x2ceb84=_0x20a5ac['conditions']?.[_0x3de059(0x192)](_0x37411d=>_0x37411d[_0x3de059(0x16d)]&&isPendingSegmentId(_0x37411d[_0x3de059(0x16d)]));(_0x22955b||_0x2ceb84)&&(_0x20a5ac[_0x3de059(0x1e9)]=_0x3de059(0x1cf),_0x20a5ac[_0x3de059(0x17d)]=0x1,_0x20a5ac['waitStepUnit']=_0x3de059(0x16f),delete _0x20a5ac[_0x3de059(0x21d)],delete _0x20a5ac[_0x3de059(0x19d)],delete _0x20a5ac[_0x3de059(0x203)],delete _0x20a5ac[_0x3de059(0x1ed)]);}export function resolveWaitStepPendingIds(_0x56cfac,_0x1105eb,_0x4bad2b,_0x232a44){const _0x5cd8da=a152_0x59916b;if(_0x1105eb[_0x5cd8da(0x21d)]&&isPendingSegmentId(_0x1105eb[_0x5cd8da(0x21d)])){const _0x18267e=_0x4bad2b(_0x1105eb[_0x5cd8da(0x21d)],_0x5cd8da(0x1f9)+_0x232a44+'\x27\x20wait\x20condition');_0x18267e&&(_0x56cfac[_0x5cd8da(0x1e9)]=_0x5cd8da(0x243),_0x56cfac[_0x5cd8da(0x21d)]=_0x18267e,delete _0x56cfac['waitStep'],delete _0x56cfac[_0x5cd8da(0x205)],_0x1105eb[_0x5cd8da(0x19d)]!==undefined&&(_0x56cfac[_0x5cd8da(0x19d)]=_0x1105eb[_0x5cd8da(0x19d)]),_0x1105eb[_0x5cd8da(0x203)]&&(_0x56cfac['conditionTimeoutUnit']=_0x1105eb[_0x5cd8da(0x203)]));}if(_0x1105eb['conditions']){const _0x57d41e=_0x1105eb['conditions'][_0x5cd8da(0x192)](_0x447c52=>_0x447c52[_0x5cd8da(0x16d)]&&isPendingSegmentId(_0x447c52[_0x5cd8da(0x16d)]));if(_0x57d41e){const _0x1f484e=_0x1105eb[_0x5cd8da(0x1ed)][_0x5cd8da(0x1da)](_0x534963=>{const _0x66588f=_0x5cd8da;if(_0x534963['segmentId']&&isPendingSegmentId(_0x534963[_0x66588f(0x16d)])){const _0x2002fd=_0x4bad2b(_0x534963['segmentId'],_0x66588f(0x1f9)+_0x232a44+_0x66588f(0x1d6));return{..._0x534963,'segmentId':_0x2002fd||_0x534963[_0x66588f(0x16d)]};}return{..._0x534963};});_0x56cfac[_0x5cd8da(0x1e9)]=_0x5cd8da(0x243),_0x56cfac[_0x5cd8da(0x1ed)]=_0x1f484e,delete _0x56cfac[_0x5cd8da(0x17d)],delete _0x56cfac[_0x5cd8da(0x205)],delete _0x56cfac[_0x5cd8da(0x21d)],delete _0x56cfac[_0x5cd8da(0x19d)],delete _0x56cfac['conditionTimeoutUnit'];}}}function stripPendingIds(_0x506259){const _0x340f7a=a152_0x59916b;_0x506259['attributes'][_0x340f7a(0x227)]?.[_0x340f7a(0x16d)]&&isPendingSegmentId(_0x506259['attributes'][_0x340f7a(0x227)][_0x340f7a(0x16d)])&&delete _0x506259[_0x340f7a(0x211)][_0x340f7a(0x227)];for(const _0x2bc24f of _0x506259[_0x340f7a(0x211)][_0x340f7a(0x1ca)]||[]){_0x2bc24f[_0x340f7a(0x233)]?.[_0x340f7a(0x16d)]&&isPendingSegmentId(_0x2bc24f[_0x340f7a(0x233)][_0x340f7a(0x16d)])&&delete _0x2bc24f[_0x340f7a(0x233)];_0x2bc24f[_0x340f7a(0x19c)]?.[_0x340f7a(0x16d)]&&isPendingSegmentId(_0x2bc24f['milestone'][_0x340f7a(0x16d)])&&delete _0x2bc24f[_0x340f7a(0x19c)];_0x2bc24f[_0x340f7a(0x171)]&&(_0x2bc24f[_0x340f7a(0x171)]=_0x2bc24f[_0x340f7a(0x171)][_0x340f7a(0x197)](_0x289704=>!_0x289704[_0x340f7a(0x16d)]||!isPendingSegmentId(_0x289704[_0x340f7a(0x16d)])));if(_0x2bc24f[_0x340f7a(0x18d)])for(const _0xec5ad6 of Object['keys'](_0x2bc24f[_0x340f7a(0x18d)])){const _0x3cd292=_0x2bc24f['steps'][_0xec5ad6];_0x3cd292[_0x340f7a(0x216)]===_0x340f7a(0x23a)&&_0x3cd292['journeyActivationStepId']&&isPendingActivationId(_0x3cd292[_0x340f7a(0x1e5)])&&(_0x3cd292[_0x340f7a(0x1e5)]='');if(_0x3cd292['type']===_0x340f7a(0x15b)&&_0x3cd292[_0x340f7a(0x210)])for(const _0x488d93 of _0x3cd292[_0x340f7a(0x210)]){_0x488d93[_0x340f7a(0x16d)]&&isPendingSegmentId(_0x488d93[_0x340f7a(0x16d)])&&(_0x488d93[_0x340f7a(0x16d)]='');}_0x3cd292[_0x340f7a(0x216)]===_0x340f7a(0x1de)&&stripWaitStepPendingIds(_0x3cd292);}}}function resolvePendingIdsInRequest(_0x286472,_0x294d7d,_0x4287d6,_0x5180d8,_0x564360,_0x3b0d48){const _0xf752eb=a152_0x59916b,_0x3c47ca=(_0x2af67c,_0x4f6875)=>{const _0x5e8cb6=a152_0x54b0;if(!isPendingSegmentId(_0x2af67c))return _0x2af67c;const _0x2c91c3=extractPendingSegmentName(_0x2af67c),_0x547db1=_0x5180d8[_0x5e8cb6(0x21c)](_0x2c91c3);return!_0x547db1&&_0x3b0d48[_0x5e8cb6(0x16a)]?.(_0x5e8cb6(0x1c0)+_0x2c91c3+_0x5e8cb6(0x1ac)+_0x4f6875),_0x547db1;};if(_0x286472[_0xf752eb(0x211)]['goal']?.['segmentId']&&isPendingSegmentId(_0x286472['attributes'][_0xf752eb(0x227)]['segmentId'])){const _0x419e48=_0x3c47ca(_0x286472['attributes'][_0xf752eb(0x227)]['segmentId'],'goal\x20criteria');_0x419e48&&(_0x286472[_0xf752eb(0x211)][_0xf752eb(0x227)][_0xf752eb(0x16d)]=_0x419e48);}for(const _0x529792 of _0x286472[_0xf752eb(0x211)][_0xf752eb(0x1ca)]||[]){const _0x1dcc53=_0x4287d6[_0xf752eb(0x21c)](_0x529792[_0xf752eb(0x1ce)][_0xf752eb(0x1d1)]());_0x1dcc53&&(_0x529792['id']=_0x1dcc53);if(_0x529792['entryCriteria']?.['segmentId']&&isPendingSegmentId(_0x529792['entryCriteria'][_0xf752eb(0x16d)])){const _0x210df3=_0x3c47ca(_0x529792['entryCriteria'][_0xf752eb(0x16d)],_0xf752eb(0x1f9)+_0x529792[_0xf752eb(0x1ce)]+_0xf752eb(0x1a2));_0x210df3&&(_0x529792['entryCriteria'][_0xf752eb(0x16d)]=_0x210df3);}if(_0x529792['exitCriterias'])for(const _0x44a75b of _0x529792[_0xf752eb(0x171)]){if(_0x44a75b[_0xf752eb(0x16d)]&&isPendingSegmentId(_0x44a75b[_0xf752eb(0x16d)])){const _0x3ed467=_0x3c47ca(_0x44a75b[_0xf752eb(0x16d)],_0xf752eb(0x1f9)+_0x529792['name']+_0xf752eb(0x175));_0x3ed467&&(_0x44a75b[_0xf752eb(0x16d)]=_0x3ed467);}}if(_0x529792[_0xf752eb(0x19c)]?.[_0xf752eb(0x16d)]&&isPendingSegmentId(_0x529792[_0xf752eb(0x19c)][_0xf752eb(0x16d)])){const _0xb7d907=_0x3c47ca(_0x529792[_0xf752eb(0x19c)][_0xf752eb(0x16d)],_0xf752eb(0x1f9)+_0x529792[_0xf752eb(0x1ce)]+_0xf752eb(0x22c));_0xb7d907&&(_0x529792['milestone'][_0xf752eb(0x16d)]=_0xb7d907);}if(_0x529792['steps']){const _0x38b293=_0x8a3230=>_0x294d7d[_0xf752eb(0x211)][_0xf752eb(0x1ca)]?.[_0xf752eb(0x16c)](_0x5be044=>_0x5be044[_0xf752eb(0x1ce)][_0xf752eb(0x1d1)]()===_0x529792[_0xf752eb(0x1ce)][_0xf752eb(0x1d1)]())?.[_0xf752eb(0x18d)]?.[_0x8a3230];for(const _0x354582 of Object[_0xf752eb(0x141)](_0x529792[_0xf752eb(0x18d)])){const _0x1d5bd9=_0x529792[_0xf752eb(0x18d)][_0x354582],_0x5167bb=_0x38b293(_0x354582);if(_0x1d5bd9[_0xf752eb(0x216)]==='Activation'&&_0x1d5bd9[_0xf752eb(0x1e5)]&&(isPendingActivationId(_0x1d5bd9[_0xf752eb(0x1e5)])||_0x1d5bd9[_0xf752eb(0x1e5)]==='')){if(_0x5167bb?.[_0xf752eb(0x1e5)]&&isPendingActivationId(_0x5167bb['journeyActivationStepId'])){const _0x1082eb=extractPendingActivationName(_0x5167bb[_0xf752eb(0x1e5)]),_0x18f862=_0x564360['get'](_0x1082eb);_0x18f862&&(_0x1d5bd9[_0xf752eb(0x1e5)]=_0x18f862);}}if(_0x1d5bd9[_0xf752eb(0x216)]===_0xf752eb(0x15b)&&_0x1d5bd9['branches']&&_0x5167bb?.[_0xf752eb(0x210)])for(let _0x57a4ab=0x0;_0x57a4ab<_0x1d5bd9[_0xf752eb(0x210)]['length'];_0x57a4ab++){const _0x357b16=_0x1d5bd9[_0xf752eb(0x210)][_0x57a4ab],_0x4a39a3=_0x5167bb[_0xf752eb(0x210)][_0x57a4ab];if(_0x4a39a3?.[_0xf752eb(0x16d)]&&isPendingSegmentId(_0x4a39a3[_0xf752eb(0x16d)])){const _0x16fd61=_0x3c47ca(_0x4a39a3[_0xf752eb(0x16d)],_0xf752eb(0x1f9)+_0x529792[_0xf752eb(0x1ce)]+_0xf752eb(0x157)+(_0x357b16[_0xf752eb(0x1ce)]||_0x57a4ab)+'\x27');_0x16fd61&&(_0x357b16['segmentId']=_0x16fd61);}}_0x1d5bd9[_0xf752eb(0x216)]==='WaitStep'&&_0x5167bb?.[_0xf752eb(0x216)]===_0xf752eb(0x1de)&&resolveWaitStepPendingIds(_0x1d5bd9,_0x5167bb,_0x3c47ca,_0x529792['name']);}}}}
1
+ const a152_0x2925d8=a152_0x3d99;(function(_0x1f4e30,_0x368807){const _0x44f402=a152_0x3d99,_0x3ac03f=_0x1f4e30();while(!![]){try{const _0xa1ec76=parseInt(_0x44f402(0x1ff))/0x1+parseInt(_0x44f402(0x163))/0x2*(-parseInt(_0x44f402(0x197))/0x3)+parseInt(_0x44f402(0x157))/0x4*(-parseInt(_0x44f402(0x171))/0x5)+-parseInt(_0x44f402(0x200))/0x6*(-parseInt(_0x44f402(0x129))/0x7)+parseInt(_0x44f402(0x176))/0x8+-parseInt(_0x44f402(0x126))/0x9*(-parseInt(_0x44f402(0x17e))/0xa)+parseInt(_0x44f402(0x193))/0xb*(-parseInt(_0x44f402(0x192))/0xc);if(_0xa1ec76===_0x368807)break;else _0x3ac03f['push'](_0x3ac03f['shift']());}catch(_0x41c3ed){_0x3ac03f['push'](_0x3ac03f['shift']());}}}(a152_0x2db6,0x37319));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x2925d8(0x1af));export const PENDING_SEGMENT_PREFIX=a152_0x2925d8(0x1ce);export const PENDING_ACTIVATION_PREFIX=a152_0x2925d8(0x11c);export function createPendingSegmentId(_0x578305){return''+PENDING_SEGMENT_PREFIX+_0x578305+'__';}export function isPendingSegmentId(_0x16aad0){const _0x5e0a16=a152_0x2925d8;return _0x16aad0[_0x5e0a16(0x1a3)](PENDING_SEGMENT_PREFIX)&&!_0x16aad0['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x27a561){const _0x2a427a=a152_0x2925d8;return _0x27a561[_0x2a427a(0x12f)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x125a77){return''+PENDING_ACTIVATION_PREFIX+_0x125a77+'__';}export function isPendingActivationId(_0x52bae2){const _0x3dc757=a152_0x2925d8;return _0x52bae2[_0x3dc757(0x1a3)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x78b3a1){const _0x57533d=a152_0x2925d8;return _0x78b3a1[_0x57533d(0x12f)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x41c71b,_0x1de518){const _0x21e08a=a152_0x2925d8,_0x28ec9d=_0x41c71b+'::'+(_0x1de518[_0x21e08a(0x110)]()||_0x21e08a(0x179)),_0x121bb7=createHash('sha1')[_0x21e08a(0x123)](_0x28ec9d)[_0x21e08a(0x1a6)](_0x21e08a(0x1ca))[_0x21e08a(0x1bd)](0x0,0xc);return'journey_entry_criteria_'+_0x121bb7;}export function ensureJourneyDefaults(_0x27e95b){const _0x62043=a152_0x2925d8;!_0x27e95b[_0x62043(0x1f0)]&&(_0x27e95b[_0x62043(0x1f0)]=''),!_0x27e95b[_0x62043(0x1cc)]&&(_0x27e95b[_0x62043(0x1cc)]='draft');}export function injectExistingStageIds(_0x58a43a,_0x5d1258){const _0x636182=a152_0x2925d8,_0x386b67=new Map(_0x5d1258[_0x636182(0x1b9)](_0x3d0718=>[_0x3d0718[_0x636182(0x1ae)],_0x3d0718['id']]));for(const _0x3cfdb0 of _0x58a43a){if(!_0x3cfdb0['id']){const _0x1b4db9=_0x386b67[_0x636182(0x1f9)](_0x3cfdb0[_0x636182(0x1ae)]);_0x1b4db9&&(_0x3cfdb0['id']=_0x1b4db9);}}}export function resolveTDFolderPath(_0x44cca3,_0x28e765,_0x380fd4){const _0x19c367=a152_0x2925d8;if(!_0x28e765)return _0x44cca3;if(_0x44cca3===_0x380fd4||_0x44cca3[_0x19c367(0x1a3)](_0x380fd4+'/'))return _0x44cca3;return _0x44cca3?_0x380fd4+'/'+_0x44cca3:_0x380fd4;}export function addFoldersToCreate(_0x872f30,_0x2b0dc9,_0xbe5ea9){const _0x4b7a9d=a152_0x2925d8;if(!_0x872f30)return;if(_0x2b0dc9[_0x4b7a9d(0x15b)](_0x872f30))return;const _0x9bf0d7=_0x872f30[_0x4b7a9d(0x102)]('/');let _0x1dce67='';for(const _0x2c1d15 of _0x9bf0d7){_0x1dce67=_0x1dce67?_0x1dce67+'/'+_0x2c1d15:_0x2c1d15,!_0x2b0dc9[_0x4b7a9d(0x15b)](_0x1dce67)&&_0xbe5ea9[_0x4b7a9d(0x17d)](_0x1dce67);}}export function sortFoldersByDepth(_0x3b89e4){return[..._0x3b89e4]['sort']((_0x5c1f62,_0x1e8087)=>{const _0x459d32=a152_0x3d99,_0x35ef68=(_0x5c1f62['match'](/\//g)||[])[_0x459d32(0x154)],_0x4eebf8=(_0x1e8087[_0x459d32(0x1f4)](/\//g)||[])[_0x459d32(0x154)];return _0x35ef68-_0x4eebf8;});}import*as a152_0x271f92 from'yaml';import{readFileSync}from'fs';import a152_0xb55ede from'path';import{isJourneyDef,parseYamlString as a152_0x384d66,toYamlString as a152_0x256796,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';function a152_0x2db6(){const _0x2e857a=['\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','message','embedded_segment_creating','createdSegmentId','keys','Segment\x20not\x20found','Updated\x20activation\x20\x27','folderId','versionNumber','uniqueServerName','withProgress','object','5eHbIPT','SEGMENT_SYNTAX_ERROR','existingSegment','created','segmentNameToId','1748680CYiuzq','updated','rule','segment','entry_criteria','updateSegmentById','SEGMENT_UPDATE_ERROR','add','486230TOSjoQ','journeyBundlesByFolderAndName','dirname','values','logSuccess','journey_creating','action','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','parentFolder','Creating\x20folder\x20\x27','attributes','getSegment\x20failed\x20for\x20','NOT_FOUND','rootFolderId','resolveJourneyId','INTERNAL','onProgress','journeyById','goal','list','5712xFPlHt','5093gOxRFc','progress','deleteSegment','Created\x20journey\x20\x27','9gccKDy','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','yamlConfig','createActivation','resolveSegment','relationships','stage\x20\x27','journeyId','exitCriterias','segmentByFolderAndName','segment_deleted','\x27\x20to\x20local\x20\x27','startsWith','./child-segment-yaml.js','yamlActivation','digest','journey_updating','\x27\x20entry\x20criteria','updateActivation','all_columns','segmentFolderId','listActivations','stringify','name','tdx.sdk.push-workflow','Name\x20has\x20already\x20been\x20taken','journey_created','segment_updated','connectionIdToNameMap','../../utils/async.js','from','size','./journey-yaml.js','nameToType','map','activation_template_id','Creating\x20segment\x20\x27','Updated\x20segment\x20\x27','slice','DecisionPoint','folderPath','deleteActivation','activations','toISOString','\x27...','effectiveFolderId','data','conditions','null','Activation\x20not\x20found:\x20','getJourney','hex','parseDocument','state','folder_creating','__pending_','validatedRequest','Deleted\x20activation\x20\x27','all','Matched\x20server\x20segment\x20\x27','utf-8','Entry\x20criteria:\x20','max','activationsBySegmentId','Stage\x20\x27','join','Failed\x20to\x20resolve\x20activation\x20','Deleted\x20segment\x20\x27','isNew','sort','\x0a\x20\x20','\x27\x20exit\x20criteria','existingActivation','.$1.push-recovery.json','\x20journey\x20from\x20file:\x20','segments','decision_point','\x20(referenced\x20in\x20journey\x20','activation_updated','activation_deleting','results','milestone','conditionTimeoutUnit','steps','toLowerCase','activation_','run_after_journey_refresh','waitStepUnit','resolvedRule','description','getSegmentEntity\x20also\x20failed\x20for\x20','journey','parse','match','journeys','nameToId','diff','parentId','get','toString','Segment\x20not\x20found:\x20','entry','debug','item','268040dmSrBu','882sCNJHB','createdSegmentIds','logDeleted','idToName','embeddedSegmentNameToId','\x20activation\x20\x27','journeyStages','create','JOURNEY_UPDATE_ERROR','hasChanges','waitStep','split','waitStepType','stages','ACTIVATION_SYNTAX_ERROR','\x20error(s)','\x27\x20by\x20rule\x20content','and\x20the\x20server\x20segment,\x20then\x20retry.','activationContext','columns','Created\x20segment\x20\x27','connector_config','journeyBundleName','deleted','entries','trim','journeyActivationStepId','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','day','absolutePath','skipSegments','\x27\x20milestone','getSegmentEntity','Condition','Failed\x20to\x20','Created\x20activation\x20\x27','Updated\x20journey\x20\x27','__pending_act_','):\x20','relative','segment_created','embedded_activation_creating','ACTIVATION_UPDATE_ERROR','filter','update','flatMap','segment_updating','9kznQjD','segmentId','\x27\x20for\x20','12663RRTxFz','set','valid','createSegment','createJourneySegment','with','replace','Activation','some','find','deps','\x27\x20decision\x20point\x20branch\x20\x27','delete','uniqueSegmentName','\x27\x20wait\x20condition','notification','verbose','WaitStep','folder','schedule','\x27\x20from\x20file:\x20','activation_updating','Creating\x20activation\x20\x27','existingSegments','embedded_segment_created','getLatestJourneyId','SEGMENT_NOT_FOUND','Failed\x20to\x20resolve\x20segment\x20','connection','entryCriteria','folderPathToId','push','idToEmailMap','createFolder','\x27\x20not\x20found\x20in\x20journey\x20\x27','journeyName','journey_updated','branches','isArray','conditionTimeoutDuration','user','activationActions','type','length','existingJourney','Created\x20folder\x20\x27','202172KrpqDb','behavior','Delete\x20the\x20push\x20recovery\x20file\x20(','reduce','has','Fetching\x20','Updating\x20segment\x20\x27','localName','folder_created','unchanged','Duration','conditionSegmentId','202778ejpUVT','Embedded\x20segment\x20\x27'];a152_0x2db6=function(){return _0x2e857a;};return a152_0x2db6();}import{readPushRecovery,saveSegmentToPushRecovery,deletePushRecovery}from'./push-recovery.js';import{validateSegmentDef,formatValidationResult}from'./yaml-validator.js';import{validateJourneyDef}from'./journey-validator.js';function stableStringify(_0x273d15){const _0x49ffd7=a152_0x2925d8;if(Array[_0x49ffd7(0x14f)](_0x273d15))return'['+_0x273d15[_0x49ffd7(0x1b9)](_0x5d8c46=>stableStringify(_0x5d8c46))['join'](',')+']';if(_0x273d15&&typeof _0x273d15===_0x49ffd7(0x170)){const _0x1010df=_0x273d15,_0x4ef2e8=Object[_0x49ffd7(0x169)](_0x1010df)[_0x49ffd7(0x1dc)](),_0x338830=_0x4ef2e8[_0x49ffd7(0x1b9)](_0xc3c8eb=>'\x22'+_0xc3c8eb+'\x22:'+stableStringify(_0x1010df[_0xc3c8eb]));return'{'+_0x338830[_0x49ffd7(0x1d8)](',')+'}';}const _0x3f6471=JSON[_0x49ffd7(0x1ad)](_0x273d15);return _0x3f6471===undefined?_0x49ffd7(0x1c7):_0x3f6471;}function activationSignature(_0x5e674c){const _0x40929c=a152_0x2925d8,_0x337380={'connection':_0x5e674c[_0x40929c(0x145)],..._0x5e674c['all_columns']!==undefined&&{'all_columns':_0x5e674c[_0x40929c(0x1aa)]},..._0x5e674c[_0x40929c(0x10a)]!==undefined&&{'columns':_0x5e674c['columns']},..._0x5e674c['behavior']!==undefined&&{'behavior':_0x5e674c[_0x40929c(0x158)]},..._0x5e674c[_0x40929c(0x13c)]!==undefined&&{'schedule':_0x5e674c['schedule']},..._0x5e674c[_0x40929c(0x138)]!==undefined&&{'notification':_0x5e674c[_0x40929c(0x138)]},..._0x5e674c[_0x40929c(0x10c)]!==undefined&&{'connector_config':_0x5e674c[_0x40929c(0x10c)]},..._0x5e674c[_0x40929c(0x1ba)]!==undefined&&{'activation_template_id':_0x5e674c['activation_template_id']}};return stableStringify(_0x337380);}async function fetchSegment(_0x348176,_0xc16d18,_0x996f8c,_0x1b8440){const _0x365fbb=a152_0x2925d8,_0x5556e4=_0x1b8440?.['find'](_0x231699=>_0x231699['id']===_0x996f8c);if(_0x5556e4)return _0x5556e4;try{return await _0x348176['segment']['getSegment'](_0xc16d18,_0x996f8c);}catch(_0x533fba){logger[_0x365fbb(0x1fd)](_0x365fbb(0x189)+_0x996f8c+',\x20falling\x20back\x20to\x20getSegmentEntity:\x20'+_0x533fba);try{return await _0x348176['segment'][_0x365fbb(0x117)](_0x996f8c);}catch(_0x4cd9f0){return logger[_0x365fbb(0x1fd)](_0x365fbb(0x1f1)+_0x996f8c+':\x20'+_0x4cd9f0),null;}}}function recoverSegmentIdsFromPushRecovery(_0x563f70,_0x1bda66,_0x4f4976){const _0x4fe2ca=a152_0x2925d8,_0x2e30a6=readPushRecovery(_0x563f70[_0x4fe2ca(0x114)]);if(_0x2e30a6?.['journeyName']===_0x563f70[_0x4fe2ca(0x199)]['name'])for(const [_0x112102,_0x5e29dd]of Object[_0x4fe2ca(0x10f)](_0x2e30a6[_0x4fe2ca(0x1e2)])){const _0x12db5f=generateDeterministicJourneySegmentName(_0x563f70[_0x4fe2ca(0x199)][_0x4fe2ca(0x1ae)],_0x112102);_0x5e29dd['uniqueServerName']===_0x12db5f&&(_0x1bda66['set'](_0x112102,_0x5e29dd[_0x4fe2ca(0x127)]),_0x4f4976[_0x4fe2ca(0x12a)](_0x112102,_0x5e29dd['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x5d515c,_0x67a452,_0x26c5be,_0x3f62b4){const _0x41e7b8=a152_0x2925d8;let _0x5384ab;try{_0x5384ab=await _0x5d515c[_0x41e7b8(0x179)][_0x41e7b8(0x12d)]({'name':_0x26c5be[_0x41e7b8(0x136)],'description':_0x26c5be[_0x41e7b8(0x1f0)],'journeyId':_0x26c5be[_0x41e7b8(0x19e)],'rule':_0x3f62b4(_0x26c5be[_0x41e7b8(0x1ef)],!![]),'countPopulation':!![],'parentFolderId':_0x26c5be[_0x41e7b8(0x16c)],'audienceId':_0x26c5be['parentId']});}catch(_0x43dcef){const _0x956af6=_0x43dcef instanceof Error&&_0x43dcef[_0x41e7b8(0x166)]['includes'](_0x41e7b8(0x1b0));if(_0x956af6){const _0x45c98f=readPushRecovery(_0x67a452['absolutePath']),_0x2fe7e0=_0x45c98f?.[_0x41e7b8(0x14c)]===_0x67a452[_0x41e7b8(0x199)]['name']?_0x45c98f[_0x41e7b8(0x1e2)][_0x26c5be[_0x41e7b8(0x15e)]]:undefined;if(_0x2fe7e0?.[_0x41e7b8(0x16e)]===_0x26c5be[_0x41e7b8(0x136)])await _0x5d515c['segment'][_0x41e7b8(0x17b)](_0x26c5be[_0x41e7b8(0x1f8)],_0x2fe7e0[_0x41e7b8(0x127)],{'description':_0x26c5be[_0x41e7b8(0x1f0)],'rule':_0x3f62b4(_0x26c5be[_0x41e7b8(0x1ef)],!![]),'countPopulation':!![]}),_0x5384ab=_0x2fe7e0[_0x41e7b8(0x127)];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],_0x41e7b8(0x164)+_0x26c5be[_0x41e7b8(0x15e)]+_0x41e7b8(0x165)+(_0x41e7b8(0x159)+_0x67a452[_0x41e7b8(0x114)][_0x41e7b8(0x12f)](/([^/]+)$/,_0x41e7b8(0x1e0))+')\x20')+_0x41e7b8(0x108),_0x43dcef);}else throw _0x43dcef;}return saveSegmentToPushRecovery(_0x67a452[_0x41e7b8(0x114)],_0x67a452[_0x41e7b8(0x199)][_0x41e7b8(0x1ae)],_0x26c5be['localName'],{'segmentId':_0x5384ab,'uniqueServerName':_0x26c5be[_0x41e7b8(0x136)],'createdAt':new Date()[_0x41e7b8(0x1c2)]()}),_0x5384ab;}export async function prepareSegmentFiles(_0x3248bd,_0x1152bf,_0xb0f74,_0x2b9ae1,_0x46a317){const _0x38eaa5=a152_0x2925d8,{activationDefToCreateRequest:_0x359e15}=await import(_0x38eaa5(0x1a4)),_0x212a40=[],_0xa5347a=new Set();for(const {yamlConfig:_0x6b6d7f,folderPath:_0x5ced10,sourcePath:_0x4bb99f}of _0x3248bd){const _0x5724a2=resolveTDFolderPath(_0x5ced10,_0x2b9ae1,_0x46a317),_0x2220c4=_0x5724a2+':'+_0x6b6d7f[_0x38eaa5(0x1ae)],_0x315853=_0x1152bf[_0x38eaa5(0x1a0)]['get'](_0x2220c4),_0x529601=_0x315853?_0x1152bf[_0x38eaa5(0x1d6)][_0x38eaa5(0x1f9)](_0x315853['id'])||[]:[];addFoldersToCreate(_0x5724a2,_0x1152bf[_0x38eaa5(0x147)],_0xa5347a);const _0x279458=calculateActivationActions(_0x6b6d7f[_0x38eaa5(0x1c1)]||[],_0x529601,_0x1152bf[_0x38eaa5(0x149)],_0x1152bf[_0x38eaa5(0x1b3)]);for(const _0x5323c9 of _0x279458){(_0x5323c9['type']===_0x38eaa5(0x207)||_0x5323c9[_0x38eaa5(0x153)]===_0x38eaa5(0x123))&&_0x5323c9[_0x38eaa5(0x1a5)]&&(_0x5323c9[_0x38eaa5(0x1cf)]=await _0x359e15(_0x5323c9[_0x38eaa5(0x1a5)],_0xb0f74));}const _0x1b56ab=calculateSegmentDiff(_0x6b6d7f,_0x315853,_0x529601,_0x1152bf[_0x38eaa5(0x149)],_0x1152bf[_0x38eaa5(0x1b3)]);_0x212a40[_0x38eaa5(0x148)]({'relativePath':_0x6b6d7f[_0x38eaa5(0x1ae)],'absolutePath':_0x4bb99f,'yamlConfig':_0x6b6d7f,'folderPath':_0x5724a2,'existingSegment':_0x315853,'existingActivations':_0x529601,'isNew':_0x1b56ab[_0x38eaa5(0x1db)],'hasChanges':_0x1b56ab[_0x38eaa5(0x209)],'diff':_0x1b56ab['diff'],'activationActions':_0x279458});}return{'segmentFiles':_0x212a40,'foldersToCreate':_0xa5347a};}export async function prepareJourneyFiles(_0x486f02,_0x4f11ad,_0x47ba48,_0x47ce42){const _0x1ce56e=a152_0x2925d8,_0xbdf055=[],_0x10703c=new Set();for(const {yamlConfig:_0x4e9e2f,folderPath:_0x58c4eb,sourcePath:_0x3a12f7}of _0x486f02){const _0x183cdb=resolveTDFolderPath(_0x58c4eb,_0x47ba48,_0x47ce42),_0x266dd5=_0x183cdb+':'+_0x4e9e2f['name'],_0x552f53=_0x4f11ad[_0x1ce56e(0x17f)][_0x1ce56e(0x1f9)](_0x266dd5);let _0xe7c9cb,_0x4669ab;if(_0x552f53&&_0x552f53[_0x1ce56e(0x154)]>0x0){const _0x41fb54=buildLocalExpandedRuleMappings(_0x4e9e2f),{createYamlContext:_0x1a0ec8,prefetchJourneySegments:_0x42ee2b}=createPushYamlContextForBundle(_0x4f11ad['deps'],_0x4f11ad['parentId'],_0x4f11ad['existingSegments'],_0x41fb54,_0x4f11ad[_0x1ce56e(0x149)],_0x4f11ad[_0x1ce56e(0x1b3)],_0x4f11ad['activationStepsById'],_0x4f11ad[_0x1ce56e(0x18f)]);await _0x42ee2b(_0x552f53[_0x1ce56e(0x1b9)](_0x3d1f4e=>_0x3d1f4e['id']));const _0x1857cf=await _0x4f11ad[_0x1ce56e(0x133)][_0x1ce56e(0x1f2)][_0x1ce56e(0x142)](_0x552f53[0x0]['journeyBundleId']),_0x50effc=hasMultipleVersions(_0x4e9e2f),_0x217905=async _0x3bed3e=>{const _0x1ca3ea=_0x1ce56e,_0x32e449=_0x4f11ad[_0x1ca3ea(0x18f)]?.[_0x1ca3ea(0x1f9)](_0x3bed3e);if(_0x32e449)return _0x32e449;return _0x4f11ad['fetchJourney']({'journeyId':_0x3bed3e,'journeyName':_0x4e9e2f[_0x1ca3ea(0x1ae)],'isMultiVersion':_0x552f53[_0x1ca3ea(0x154)]>0x1});};if(_0x50effc&&_0x552f53[_0x1ce56e(0x154)]>0x1){const _0x4d8882=[];for(const _0xc7877 of _0x552f53){const _0x31933e=_0xc7877[_0x1ce56e(0x16d)]||0x1;_0x4f11ad['progress']?.[_0x1ce56e(0x123)](_0x1ce56e(0x15c)+_0x4e9e2f[_0x1ce56e(0x1ae)]+'\x20v'+_0x31933e);const _0x58abb6=await _0x217905(_0xc7877['id']),_0x2beab1=_0x1a0ec8(_0xc7877['id']),_0x139328=await journeyResponseToDef(_0x58abb6,_0x2beab1);_0x4d8882[_0x1ce56e(0x148)]({'item':_0xc7877,'yaml':_0x139328});}const _0x25d158=buildLocalRuleToNameMappingFromJourney(_0x4e9e2f);_0x4669ab=buildMergedJourneyDef(_0x4d8882,_0x25d158,_0x1857cf);const _0x4d43a4=Math[_0x1ce56e(0x1d5)](..._0x4d8882[_0x1ce56e(0x1b9)](_0x54cb05=>_0x54cb05[_0x1ce56e(0x1fe)]['versionNumber']||0x0)),_0x5e7abe=_0x552f53['find'](_0x56c863=>(_0x56c863[_0x1ce56e(0x16d)]||0x0)===_0x4d43a4);_0x5e7abe&&(_0x4f11ad[_0x1ce56e(0x194)]?.[_0x1ce56e(0x123)](_0x1ce56e(0x15c)+_0x4e9e2f[_0x1ce56e(0x1ae)]+'\x20v'+_0x4d43a4),_0xe7c9cb=await _0x217905(_0x5e7abe['id']));}else{const _0x1a9dac=_0x552f53[_0x552f53[_0x1ce56e(0x154)]-0x1];_0x4f11ad[_0x1ce56e(0x194)]?.[_0x1ce56e(0x123)]('Fetching\x20'+_0x4e9e2f[_0x1ce56e(0x1ae)]),_0xe7c9cb=await _0x217905(_0x1a9dac['id']);const _0x2a62a8=_0x1a0ec8(_0x1a9dac['id']),_0x517707=await journeyResponseToDef(_0xe7c9cb,_0x2a62a8),_0x53a9c3=buildLocalRuleToNameMappingFromJourney(_0x4e9e2f);_0x4669ab=buildMergedJourneyDef([{'item':_0x1a9dac,'yaml':_0x517707}],_0x53a9c3,_0x1857cf);}}addFoldersToCreate(_0x183cdb,_0x4f11ad['folderPathToId'],_0x10703c);const _0x5c3ba2=calculateJourneyDiff(_0x4e9e2f,_0x4669ab);_0xbdf055[_0x1ce56e(0x148)]({'relativePath':_0x4e9e2f['name'],'absolutePath':_0x3a12f7,'yamlConfig':_0x4e9e2f,'folderPath':_0x183cdb,'existingJourney':_0xe7c9cb,'isNew':_0x5c3ba2[_0x1ce56e(0x1db)],'hasChanges':_0x5c3ba2[_0x1ce56e(0x209)],'diff':_0x5c3ba2[_0x1ce56e(0x1f7)]});}return{'journeyFiles':_0xbdf055,'foldersToCreate':_0x10703c};}export function calculateActivationActions(_0x5db7df,_0x36d464,_0x5a8b82,_0x39106b){const _0x10bd38=a152_0x2925d8,_0x2e20cb=[],_0x4d88b5=new Map();for(const _0x388b73 of _0x36d464){_0x4d88b5[_0x10bd38(0x12a)](_0x388b73['name'],_0x388b73);}const _0x4cf789=new Map();for(const _0x211f33 of _0x5db7df){_0x4cf789[_0x10bd38(0x12a)](_0x211f33[_0x10bd38(0x1ae)],_0x211f33);}for(const _0xf7b8bf of _0x5db7df){const _0xa663ab=_0x4d88b5[_0x10bd38(0x1f9)](_0xf7b8bf['name']);if(!_0xa663ab)_0x2e20cb[_0x10bd38(0x148)]({'type':_0x10bd38(0x207),'name':_0xf7b8bf[_0x10bd38(0x1ae)],'yamlActivation':_0xf7b8bf});else{const _0x722869=activationResponseToDef(_0xa663ab,_0x5a8b82,_0x39106b),_0x5abc40=a152_0x271f92['stringify'](_0x722869),_0x268cc7=a152_0x271f92[_0x10bd38(0x1ad)](_0xf7b8bf);_0x5abc40!==_0x268cc7&&_0x2e20cb[_0x10bd38(0x148)]({'type':_0x10bd38(0x123),'name':_0xf7b8bf[_0x10bd38(0x1ae)],'yamlActivation':_0xf7b8bf,'existingActivation':_0xa663ab});}}for(const _0x4b95ec of _0x36d464){!_0x4cf789[_0x10bd38(0x15b)](_0x4b95ec[_0x10bd38(0x1ae)])&&_0x2e20cb[_0x10bd38(0x148)]({'type':_0x10bd38(0x135),'name':_0x4b95ec[_0x10bd38(0x1ae)],'existingActivation':_0x4b95ec});}return _0x2e20cb;}function calculateYamlDiff(_0x3efbf7,_0x3b215e){if(_0x3b215e){const _0x1ed25c=generateDiff(_0x3b215e,_0x3efbf7),_0x1f4843=hasChanges(_0x1ed25c);return{'isNew':![],'hasChanges':_0x1f4843,'diff':_0x1f4843?formatDiffWithColors(_0x1ed25c):undefined};}const _0x35083c=generateDiff('',_0x3efbf7);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x35083c)};}export function calculateSegmentDiff(_0x1cb244,_0x5d0f9f,_0x76464f,_0x5388ca,_0x319587){const _0x31de61=segmentToYamlString(_0x1cb244),_0x5414a0=_0x5d0f9f?segmentToYamlString(segmentWithActivationsToYaml(_0x5d0f9f,_0x76464f,undefined,_0x5388ca,_0x319587)):undefined;return calculateYamlDiff(_0x31de61,_0x5414a0);}export function calculateJourneyDiff(_0x356fa7,_0x21a45d){const _0x5260d0=normalizeJourneyDef(_0x356fa7,_0x356fa7),_0x51c701=a152_0x256796(_0x5260d0),_0x4e054d=_0x21a45d?a152_0x256796(normalizeJourneyDef(_0x21a45d,_0x356fa7)):undefined;return calculateYamlDiff(_0x51c701,_0x4e054d);}export function findSegmentsToDelete(_0xf49e1,_0x4a8260,_0x367da2,_0x5cae6a,_0x503c80){const _0x3837b1=a152_0x2925d8,_0x5ac3a3=new Set();for(const {yamlConfig:_0x2040ab,folderPath:_0x43ef55}of _0x4a8260){_0x5ac3a3[_0x3837b1(0x17d)](_0x43ef55+':'+_0x2040ab[_0x3837b1(0x1ae)]);}return _0xf49e1[_0x3837b1(0x122)](_0x54fb5c=>{const _0x20bdbf=_0x3837b1,_0x1db9e0=_0x54fb5c[_0x20bdbf(0x1ab)]?_0x367da2['get'](_0x54fb5c[_0x20bdbf(0x1ab)][_0x20bdbf(0x1fa)]())||'':'',_0x7f6039=_0x1db9e0+':'+_0x54fb5c[_0x20bdbf(0x1ae)];if(_0x5ac3a3[_0x20bdbf(0x15b)](_0x7f6039))return![];if(_0x503c80)return _0x1db9e0===_0x5cae6a||_0x1db9e0[_0x20bdbf(0x1a3)](_0x5cae6a+'/');return!![];});}export function findJourneysToDelete(_0x2cdb65,_0x4bfb02,_0x26d96b,_0x423e0a,_0x4f2059){const _0x30ce82=a152_0x2925d8,_0x4dd5a4=new Set();for(const {yamlConfig:_0x1f8d40,folderPath:_0x586a34}of _0x4bfb02){_0x4dd5a4['add'](_0x586a34+':'+_0x1f8d40[_0x30ce82(0x1ae)]);}return _0x2cdb65['filter'](_0xe95cb1=>{const _0x449114=_0x30ce82,_0x201c66=_0xe95cb1[_0x449114(0x16c)]?_0x26d96b[_0x449114(0x1f9)](_0xe95cb1['folderId'])||'':'',_0xca592f=_0x201c66+':'+_0xe95cb1[_0x449114(0x10d)];if(_0x4dd5a4['has'](_0xca592f))return![];if(_0x4f2059)return _0x201c66===_0x423e0a||_0x201c66[_0x449114(0x1a3)](_0x423e0a+'/');return!![];});}export function buildSegmentLookupMap(_0x193d78,_0x2e5c72){const _0xeff1db=a152_0x2925d8,_0x376f2c=new Map();for(const _0x365221 of _0x193d78){const _0x585ad7=_0x365221[_0xeff1db(0x1ab)]?_0x2e5c72[_0xeff1db(0x1f9)](_0x365221[_0xeff1db(0x1ab)][_0xeff1db(0x1fa)]())||'':'',_0x8aba52=_0x585ad7+':'+_0x365221[_0xeff1db(0x1ae)];_0x376f2c[_0xeff1db(0x12a)](_0x8aba52,_0x365221);}return _0x376f2c;}export function buildSegmentNameToIdMap(_0x2841f9){const _0x4c823e=a152_0x2925d8,_0x17730f=new Map();for(const _0x55b103 of _0x2841f9){_0x17730f[_0x4c823e(0x12a)](_0x55b103['name'],_0x55b103['id']);}return _0x17730f;}export function buildJourneyBundleLookupMap(_0x4f7969,_0xd1a2c9){const _0xea07b5=a152_0x2925d8,_0x3b2a08=new Map();for(const _0x2f60a7 of _0x4f7969){const _0x1bec0a=_0x2f60a7['folderId']?_0xd1a2c9[_0xea07b5(0x1f9)](_0x2f60a7['folderId'])||'':'',_0x35a9ab=_0x1bec0a+':'+_0x2f60a7[_0xea07b5(0x10d)];!_0x3b2a08[_0xea07b5(0x15b)](_0x35a9ab)&&_0x3b2a08[_0xea07b5(0x12a)](_0x35a9ab,[]),_0x3b2a08[_0xea07b5(0x1f9)](_0x35a9ab)[_0xea07b5(0x148)](_0x2f60a7);}for(const _0xb0e58 of _0x3b2a08[_0xea07b5(0x181)]()){_0xb0e58['sort']((_0x376016,_0x26a2ad)=>(_0x376016[_0xea07b5(0x16d)]||0x0)-(_0x26a2ad[_0xea07b5(0x16d)]||0x0));}return _0x3b2a08;}export function collectFoldersToCreate(_0x5898a3,_0x4cd561){const _0x1295da=a152_0x2925d8,_0x24ab3a=new Set();for(const _0x3c2ac6 of _0x5898a3){if(!_0x3c2ac6)continue;if(_0x4cd561[_0x1295da(0x15b)](_0x3c2ac6))continue;const _0xb112bb=_0x3c2ac6[_0x1295da(0x102)]('/');let _0x5f1f4d='';for(const _0x1f2dfc of _0xb112bb){_0x5f1f4d=_0x5f1f4d?_0x5f1f4d+'/'+_0x1f2dfc:_0x1f2dfc,!_0x4cd561[_0x1295da(0x15b)](_0x5f1f4d)&&_0x24ab3a[_0x1295da(0x17d)](_0x5f1f4d);}}return _0x24ab3a;}export function parseAndClassifyYamlFiles(_0x1d40d5,_0x32316f,_0x421ea2){const _0xa2a47f=a152_0x2925d8,_0x23bc51=[],_0x31ca68=[];for(const _0x2559a9 of _0x1d40d5){const _0x5d0f9b=a152_0xb55ede[_0xa2a47f(0x11e)](_0x32316f,a152_0xb55ede[_0xa2a47f(0x180)](_0x2559a9)),_0x3a906c=_0x5d0f9b==='.'?'':_0x5d0f9b,_0x1ab624=readFileSync(_0x2559a9,_0xa2a47f(0x1d3)),_0x1849fe=a152_0x271f92[_0xa2a47f(0x1f3)](_0x1ab624);if(isJourneyDef(_0x1849fe)){const _0x131853=a152_0x384d66(_0x1ab624);_0x31ca68['push']({'yamlConfig':_0x131853,'folderPath':_0x3a906c,'sourcePath':_0x2559a9});}else{if(!_0x421ea2?.[_0xa2a47f(0x115)]){const _0x18b6e5=parseSegmentYamlFile(_0x1ab624),_0xb58aef=normalizeChildSegmentYaml(_0x18b6e5);_0x23bc51[_0xa2a47f(0x148)]({'yamlConfig':_0xb58aef,'folderPath':_0x3a906c,'sourcePath':_0x2559a9});}}}return{'segments':_0x23bc51,'journeys':_0x31ca68};}function a152_0x3d99(_0x3d791f,_0x482f26){_0x3d791f=_0x3d791f-0x101;const _0x2db62d=a152_0x2db6();let _0x3d99a6=_0x2db62d[_0x3d791f];return _0x3d99a6;}export function validateParsedFiles(_0x1c6577,_0x2a8516){const _0x1a1ee7=a152_0x2925d8,_0x115467=[];for(const {yamlConfig:_0x3d4b40,sourcePath:_0x4c6200}of _0x1c6577['segments']){const _0x4f9288=readFileSync(_0x4c6200,_0x1a1ee7(0x1d3)),_0x5a19f9=a152_0x271f92[_0x1a1ee7(0x1cb)](_0x4f9288),_0x47e2bf=validateSegmentDef(_0x3d4b40,{'source':_0x4f9288,'document':_0x5a19f9},{'skipSchema':!![]});if(!_0x47e2bf['valid']){const _0x3aedb8=a152_0xb55ede[_0x1a1ee7(0x11e)](_0x2a8516,_0x4c6200);_0x115467[_0x1a1ee7(0x148)]({'filePath':_0x3aedb8,'source':_0x4f9288,'result':_0x47e2bf,'isJourney':![]});}}for(const {yamlConfig:_0x38c17f,sourcePath:_0x2b4c70}of _0x1c6577[_0x1a1ee7(0x1f5)]){const _0x5c1082=readFileSync(_0x2b4c70,_0x1a1ee7(0x1d3)),_0x382dc1=a152_0x271f92[_0x1a1ee7(0x1cb)](_0x5c1082),_0x4241ce=validateJourneyDef(_0x38c17f,{'source':_0x5c1082,'document':_0x382dc1},{'skipSchema':!![]});if(!_0x4241ce[_0x1a1ee7(0x12b)]){const _0x2a6cf6=a152_0xb55ede[_0x1a1ee7(0x11e)](_0x2a8516,_0x2b4c70);_0x115467[_0x1a1ee7(0x148)]({'filePath':_0x2a6cf6,'source':_0x5c1082,'result':_0x4241ce,'isJourney':!![]});}}return _0x115467;}export function formatValidationErrors(_0x2085c5){const _0x436490=a152_0x2925d8,_0x1dec3c=[];for(const {filePath:_0x209cbc,source:_0x377341,result:_0x2bb4eb,isJourney:_0x23ead4}of _0x2085c5){const _0x22c73d=_0x23ead4?_0x436490(0x1f2):'segment';_0x1dec3c[_0x436490(0x148)]('\x0a'+_0x209cbc+'\x20('+_0x22c73d+_0x436490(0x11d)+_0x2bb4eb['errors'][_0x436490(0x154)]+_0x436490(0x106)),_0x1dec3c[_0x436490(0x148)](formatValidationResult(_0x2bb4eb,_0x377341,_0x209cbc));}return _0x1dec3c[_0x436490(0x1d8)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x5d3ac7){const _0x4b77b5=a152_0x2925d8,_0x418960=new Set(),_0x5b73b3=new Map(),_0x639e83=collectSegmentUsageCounts(_0x5d3ac7);if(_0x5d3ac7['segments'])for(const [_0x17cf03,_0x3e9977]of Object['entries'](_0x5d3ac7[_0x4b77b5(0x1e2)])){_0x418960['add'](_0x17cf03);if(_0x3e9977['rule']){const _0x30b158=yamlRuleToApi(_0x3e9977['rule']),_0x131835=apiRuleToYaml(_0x30b158);_0x5b73b3[_0x4b77b5(0x12a)](_0x17cf03,_0x131835);}}const _0x249973=new Map();let _0xe9e859=0x0;for(const [_0x4f7132,_0x18c213]of _0x5b73b3){const _0x526d96=serializeExpandedRule(_0x18c213,_0x5b73b3),_0x2432c0=_0x249973[_0x4b77b5(0x1f9)](_0x526d96)||[];_0x2432c0[_0x4b77b5(0x148)]({'name':_0x4f7132,'index':_0xe9e859}),_0x249973[_0x4b77b5(0x12a)](_0x526d96,_0x2432c0),_0xe9e859++;}const _0x5428bb=new Map();for(const [_0x1e7acf,_0xe4766]of _0x249973){const _0x457291=_0xe4766[_0x4b77b5(0x1bd)]()['sort']((_0x5a52a7,_0x3fa29d)=>{const _0x39f4a3=_0x4b77b5,_0x116ea=_0x639e83[_0x39f4a3(0x1f9)](_0x5a52a7[_0x39f4a3(0x1ae)])||0x0,_0x389599=_0x639e83['get'](_0x3fa29d[_0x39f4a3(0x1ae)])||0x0;if(_0x116ea!==_0x389599)return _0x389599-_0x116ea;return _0x5a52a7['index']-_0x3fa29d['index'];})['map'](_0x4f0f7d=>_0x4f0f7d[_0x4b77b5(0x1ae)]),_0x3add6a=[];for(const _0x30886a of _0x457291){const _0x28ca43=_0x639e83[_0x4b77b5(0x1f9)](_0x30886a)||0x0,_0x2c839a=Math[_0x4b77b5(0x1d5)](_0x28ca43,0x1);for(let _0x31dac0=0x0;_0x31dac0<_0x2c839a;_0x31dac0++){_0x3add6a[_0x4b77b5(0x148)](_0x30886a);}}_0x5428bb['set'](_0x1e7acf,_0x3add6a);}return{'existingLocalSegmentNames':_0x418960,'localSegmentRules':_0x5b73b3,'localExpandedRuleToNames':_0x5428bb};}export function createSegmentIdResolver(_0x5e31b2,_0x2cf056){return async _0x3374e4=>{const _0x41d825=a152_0x3d99,_0x26da0e=_0x5e31b2[_0x41d825(0x1f9)](_0x3374e4);if(!_0x26da0e)throw new SDKError(ErrorCode[_0x41d825(0x143)],_0x41d825(0x1fb)+_0x3374e4+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x2cf056+'\x27)');return _0x26da0e;};}export function extractRootFolderId(_0x10264e){const _0x204a8c=a152_0x2925d8;return _0x10264e[_0x204a8c(0x19c)]?.['parentSegmentFolder']?.[_0x204a8c(0x1c5)]?.['id']||_0x10264e[_0x204a8c(0x19c)]?.[_0x204a8c(0x186)]?.[_0x204a8c(0x1c5)]?.['id'];}export function buildConnectionMaps(_0x477bcd){const _0x1a4b0f=a152_0x2925d8,_0x25c34d=new Map(),_0xc6a64=new Map(),_0x3b8ca5=new Map();for(const _0x4994ec of _0x477bcd){_0x25c34d[_0x1a4b0f(0x12a)](_0x4994ec[_0x1a4b0f(0x1ae)],parseInt(_0x4994ec['id'],0xa)),_0xc6a64[_0x1a4b0f(0x12a)](_0x4994ec['id'],_0x4994ec[_0x1a4b0f(0x1ae)]),_0x3b8ca5['set'](_0x4994ec[_0x1a4b0f(0x1ae)],_0x4994ec['type']);}return{'nameToId':_0x25c34d,'idToName':_0xc6a64,'nameToType':_0x3b8ca5};}export function calculatePushStats(_0x41cea1,_0x33283f,_0x76e2f7,_0x33de75,_0x50aa48,_0x55afd8,_0x49af55){const _0xeab446=a152_0x2925d8,_0x16e22f=_0x41cea1[_0xeab446(0x122)](_0x366d73=>_0x366d73['isNew']),_0x208003=_0x41cea1[_0xeab446(0x122)](_0x525962=>!_0x525962[_0xeab446(0x1db)]&&_0x525962[_0xeab446(0x209)]),_0x4bc962=_0x41cea1[_0xeab446(0x122)](_0x5097a=>!_0x5097a['isNew']&&!_0x5097a['hasChanges']),_0x362d35=_0x55afd8?_0x33de75:[],_0x72e986=_0x33283f[_0xeab446(0x122)](_0x1bd316=>_0x1bd316[_0xeab446(0x1db)]),_0x6f3e03=_0x33283f[_0xeab446(0x122)](_0x1754f4=>!_0x1754f4['isNew']&&_0x1754f4['hasChanges']),_0x3be72f=_0x33283f[_0xeab446(0x122)](_0x462706=>!_0x462706[_0xeab446(0x1db)]&&!_0x462706[_0xeab446(0x209)]),_0x1e9301=_0x55afd8?_0x50aa48:[],_0x2c794e=_0x41cea1[_0xeab446(0x124)](_0x262d04=>_0x262d04[_0xeab446(0x152)]),_0x588afd=_0x2c794e[_0xeab446(0x122)](_0xceae77=>_0xceae77[_0xeab446(0x153)]===_0xeab446(0x207)),_0x584c36=_0x2c794e[_0xeab446(0x122)](_0x25be8b=>_0x25be8b['type']===_0xeab446(0x123)),_0x2984ef=_0x2c794e[_0xeab446(0x122)](_0x15c6eb=>_0x15c6eb[_0xeab446(0x153)]===_0xeab446(0x135)),_0x2bb8a1=Array[_0xeab446(0x1b5)](_0x76e2f7)[_0xeab446(0x1dc)](),_0x8df7ff=_0x49af55?![]:_0x16e22f[_0xeab446(0x154)]>0x0||_0x208003[_0xeab446(0x154)]>0x0||_0x362d35[_0xeab446(0x154)]>0x0,_0x76b4da=_0x72e986[_0xeab446(0x154)]>0x0||_0x6f3e03[_0xeab446(0x154)]>0x0||_0x1e9301[_0xeab446(0x154)]>0x0,_0x380dce=_0x49af55?![]:_0x2c794e[_0xeab446(0x154)]>0x0,_0x53ec98=_0x2bb8a1[_0xeab446(0x154)]>0x0;return{'segments':{'new':_0x16e22f,'changed':_0x208003,'unchanged':_0x4bc962,'toDelete':_0x362d35},'journeys':{'new':_0x72e986,'changed':_0x6f3e03,'unchanged':_0x3be72f,'toDelete':_0x1e9301},'activations':{'all':_0x2c794e,'toCreate':_0x588afd,'toUpdate':_0x584c36,'toDelete':_0x2984ef},'folders':{'toCreate':_0x2bb8a1},'counts':{'segments':{'new':_0x16e22f[_0xeab446(0x154)],'changed':_0x208003[_0xeab446(0x154)],'unchanged':_0x4bc962[_0xeab446(0x154)],'toDelete':_0x362d35[_0xeab446(0x154)]},'journeys':{'new':_0x72e986[_0xeab446(0x154)],'changed':_0x6f3e03[_0xeab446(0x154)],'unchanged':_0x3be72f['length'],'toDelete':_0x1e9301[_0xeab446(0x154)]},'activations':{'create':_0x588afd['length'],'update':_0x584c36['length'],'delete':_0x2984ef[_0xeab446(0x154)]},'folders':_0x2bb8a1[_0xeab446(0x154)]},'hasChanges':_0x8df7ff||_0x76b4da||_0x380dce||_0x53ec98};}export async function buildPushExecutionContext(_0x484b64,_0x5e082d,_0x3951ec,_0x36a87d,_0x2cbab2,_0x242570){const _0x4deeb8=a152_0x2925d8,_0x195b96=extractRootFolderId(_0x3951ec),{pathToId:_0x446730,idToPath:_0x280016}=buildFolderMaps(_0x2cbab2),_0x11fda1=buildSegmentNameToIdMap(_0x36a87d),_0x23f89f=new Map(),{batchAsync:_0x34d446}=await import(_0x4deeb8(0x1b4)),[_0xbf0a57,_0x3b4fbe]=await Promise[_0x4deeb8(0x1d1)]([_0x484b64[_0x4deeb8(0x151)]['buildUserMaps'](),_0x484b64[_0x4deeb8(0x145)][_0x4deeb8(0x191)](),((async()=>{const _0x3344be=_0x4deeb8;!_0x242570&&_0x36a87d[_0x3344be(0x154)]>0x0&&await _0x34d446(_0x36a87d,async _0x1fdc53=>{const _0x123510=_0x3344be,_0xac819a=await _0x484b64['segment'][_0x123510(0x1ac)](_0x5e082d,_0x1fdc53['id']);_0x23f89f[_0x123510(0x12a)](_0x1fdc53['id'],_0xac819a);});})())]),{emailToId:_0xab6a80,idToEmail:_0x1e6c70}=_0xbf0a57,_0x48a305=buildConnectionMaps(_0x3b4fbe);return{'rootFolderId':_0x195b96,'folderPathToId':_0x446730,'folderIdToPath':_0x280016,'segmentNameToId':_0x11fda1,'activationsBySegmentId':_0x23f89f,'emailToIdMap':_0xab6a80,'idToEmailMap':_0x1e6c70,'connectionNameToIdMap':_0x48a305[_0x4deeb8(0x1f6)],'connectionIdToNameMap':_0x48a305[_0x4deeb8(0x203)],'connectionNameToTypeMap':_0x48a305[_0x4deeb8(0x1b8)]};}export function createPushYamlContextForBundle(_0x4f9f77,_0xff2ec9,_0xd4833e,_0x25311b,_0x173146,_0x37edf7,_0x515779,_0x350a45){const {existingLocalSegmentNames:_0x3cf134,localExpandedRuleToNames:_0x484ef3}=_0x25311b,_0x41713f=new Set(),_0x1f85af=new Map(),_0xa225ef=new Map(),_0x516e43=new Map(),_0x9d278e=createJumpTargetCache(),_0x19c040=new Map(),_0x5178eb=new Map(),_0x2597c0=new Set();let _0x127e94;const _0x216a9f=_0x4b1312=>{const _0x38c004={'resolveSegment':async _0x4a04bb=>{const _0x15a829=a152_0x3d99,_0x2b4e63=_0x516e43[_0x15a829(0x1f9)](_0x4a04bb);if(_0x2b4e63!==undefined)return{'name':_0x2b4e63,'isJourneyLocal':!![]};try{const _0x32324b=await fetchSegment(_0x4f9f77,_0xff2ec9,_0x4a04bb,_0xd4833e);if(!_0x32324b)throw new Error(_0x15a829(0x16a));const _0xd1b6e4=generateJourneyLocalName(_0x32324b['name']),_0x5a9908=_0x32324b['kind']===SEGMENT_KIND_JOURNEY&&_0xd1b6e4!==undefined;let _0xbe9cfb=_0x32324b[_0x15a829(0x1ae)],_0x53a533;if(_0x5a9908&&_0x32324b['rule']){const _0x272961=apiRuleToYaml(_0x32324b[_0x15a829(0x178)]);_0x5178eb[_0x15a829(0x12a)](_0x4a04bb,_0x272961);const _0x12d8f7=async _0x2dd43d=>{const _0x3a833a=_0x15a829,_0x42eb91=collectSegmentRefsFromRule(_0x2dd43d);for(const _0x323895 of _0x42eb91){if(!_0x5178eb[_0x3a833a(0x15b)](_0x323895))try{const _0x39f6cb=await fetchSegment(_0x4f9f77,_0xff2ec9,_0x323895,_0xd4833e);if(_0x39f6cb?.[_0x3a833a(0x178)]){const _0x4c2ce2=apiRuleToYaml(_0x39f6cb[_0x3a833a(0x178)]);_0x5178eb[_0x3a833a(0x12a)](_0x323895,_0x4c2ce2),await _0x12d8f7(_0x4c2ce2);}}catch(_0x4d3997){logger[_0x3a833a(0x1fd)]('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0x323895+':\x20'+_0x4d3997);}}};await _0x12d8f7(_0x272961);const _0x2c588f=serializeExpandedRule(_0x272961,_0x5178eb),_0x54a3fa=_0x484ef3[_0x15a829(0x1f9)](_0x2c588f);if(_0x54a3fa&&_0x54a3fa[_0x15a829(0x154)]>0x0){const _0x5af227=_0x1f85af[_0x15a829(0x1f9)](_0x2c588f)||0x0,_0x153511=_0x54a3fa[_0x5af227]||_0x54a3fa[_0x54a3fa[_0x15a829(0x154)]-0x1];_0x1f85af[_0x15a829(0x12a)](_0x2c588f,_0x5af227+0x1),_0xbe9cfb=_0x153511,_0x41713f[_0x15a829(0x17d)](_0xbe9cfb),_0x516e43[_0x15a829(0x12a)](_0x4a04bb,_0xbe9cfb);const _0x57232d=await resolveRuleSegmentRefs(_0x272961,async _0x590ff5=>{const _0x2cb096=_0x15a829,_0x13030e=_0x516e43['get'](_0x590ff5);if(_0x13030e)return _0x13030e;const _0x216905=await _0x127e94[_0x2cb096(0x19b)](_0x590ff5);return _0x216905['name'];});_0x53a533={'description':_0x32324b[_0x15a829(0x1f0)],'rule':_0x57232d};}else{const _0x17ccad=_0x19c040[_0x15a829(0x1f9)](_0x2c588f);if(_0x17ccad)_0xbe9cfb=_0x17ccad,_0x516e43[_0x15a829(0x12a)](_0x4a04bb,_0xbe9cfb);else{if(_0xd1b6e4){let _0x219ec3=_0xd1b6e4,_0x11f373=0x2;while(_0x41713f[_0x15a829(0x15b)](_0x219ec3)||_0x3cf134[_0x15a829(0x15b)](_0x219ec3)){_0x219ec3=_0xd1b6e4+'_'+_0x11f373,_0x11f373++;}_0x41713f[_0x15a829(0x17d)](_0x219ec3),_0xbe9cfb=_0x219ec3;}_0x516e43['set'](_0x4a04bb,_0xbe9cfb),_0x19c040[_0x15a829(0x12a)](_0x2c588f,_0xbe9cfb);const _0x221670=await resolveRuleSegmentRefs(_0x272961,async _0x2fb742=>{const _0x2bb160=_0x15a829,_0x3bfb20=_0x516e43[_0x2bb160(0x1f9)](_0x2fb742);if(_0x3bfb20)return _0x3bfb20;const _0x58ca3a=await _0x127e94['resolveSegment'](_0x2fb742);return _0x58ca3a[_0x2bb160(0x1ae)];});_0x53a533={'description':_0x32324b[_0x15a829(0x1f0)],'rule':_0x221670};}}}return{'name':_0xbe9cfb,'isJourneyLocal':_0x5a9908,'definition':_0x53a533};}catch(_0x1362f5){return logger[_0x15a829(0x1fd)](_0x15a829(0x144)+_0x4a04bb+':\x20'+_0x1362f5),{'name':_0x4a04bb,'isJourneyLocal':![]};}},'resolveActivation':async _0x144c79=>{const _0x3f24e3=a152_0x3d99,_0x1c360e=_0xa225ef[_0x3f24e3(0x1f9)](_0x144c79);if(_0x1c360e!==undefined)return{'name':_0x1c360e,'isJourneyLocal':!![]};try{let _0x4f43a7=_0x515779?.[_0x3f24e3(0x1f9)](_0x144c79);!_0x4f43a7&&(_0x4f43a7=await _0x4f9f77['journey']['getActivation'](_0x4b1312,_0x144c79));const _0x750841=_0x4f43a7[_0x3f24e3(0x188)]['activationParams'][_0x3f24e3(0x1ae)]||_0x144c79,_0x5f5191=sanitizeYamlKey(_0x750841)||_0x3f24e3(0x1ec)+_0x144c79,_0x5e9736=_0x5f5191;_0xa225ef['set'](_0x144c79,_0x5e9736);const _0x347592=journeyActivationStepToYaml(_0x4f43a7,_0x173146,_0x37edf7);return{'name':_0x5e9736,'isJourneyLocal':!![],'definition':_0x347592};}catch(_0x3a0687){return logger[_0x3f24e3(0x1fd)](_0x3f24e3(0x1d9)+_0x144c79+':\x20'+_0x3a0687),{'name':_0x144c79,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x40c2b1,_0x41b484)=>resolveJumpTarget(_0x40c2b1,_0x41b484,_0x9d278e,async _0x3739ea=>{const _0xcec0a8=a152_0x3d99,_0x41f946=_0x350a45?.['get'](_0x3739ea);if(_0x41f946)return _0x41f946;return _0x4f9f77[_0xcec0a8(0x1f2)][_0xcec0a8(0x1c9)](_0x3739ea);})};return _0x127e94=_0x38c004,_0x38c004;},_0xed5bc5=async _0xa71ab4=>{const _0x143e73=a152_0x3d99,{collectSegmentIdsFromJourneyApi:_0x577be5}=await import(_0x143e73(0x1b7)),{batchAsync:_0x5bdf42}=await import(_0x143e73(0x1b4)),_0x2af46b=new Set();for(const _0x591741 of _0xa71ab4){let _0x2631f9=_0x350a45?.[_0x143e73(0x1f9)](_0x591741);!_0x2631f9&&(_0x2631f9=await _0x4f9f77['journey'][_0x143e73(0x1c9)](_0x591741));const _0x56777d=_0x577be5(_0x2631f9);for(const _0x2375f9 of _0x56777d){_0x2af46b[_0x143e73(0x17d)](_0x2375f9);}}let _0x3ff91f=Array[_0x143e73(0x1b5)](_0x2af46b);while(_0x3ff91f[_0x143e73(0x154)]>0x0){const _0x56715c=_0x3ff91f[_0x143e73(0x122)](_0x5b1790=>!_0x2597c0[_0x143e73(0x15b)](_0x5b1790));if(_0x56715c[_0x143e73(0x154)]===0x0)break;const _0x432517=await _0x5bdf42(_0x56715c,async _0x326b78=>{const _0x530396=_0x143e73;_0x2597c0[_0x530396(0x17d)](_0x326b78);const _0x4a0a68=await fetchSegment(_0x4f9f77,_0xff2ec9,_0x326b78,_0xd4833e);if(!_0x4a0a68)return null;return{'segmentId':_0x326b78,'segment':_0x4a0a68};},0xa),_0x24aee2=new Set();for(const _0x5c428a of _0x432517){if(!_0x5c428a?.[_0x143e73(0x179)]?.[_0x143e73(0x178)])continue;const _0x3a5fd1=apiRuleToYaml(_0x5c428a['segment'][_0x143e73(0x178)]);_0x5178eb['set'](_0x5c428a[_0x143e73(0x127)],_0x3a5fd1);const _0x44d042=collectSegmentRefsFromRule(_0x3a5fd1);for(const _0x280962 of _0x44d042){!_0x2597c0[_0x143e73(0x15b)](_0x280962)&&_0x24aee2[_0x143e73(0x17d)](_0x280962);}}_0x3ff91f=Array[_0x143e73(0x1b5)](_0x24aee2);}};return{'createYamlContext':_0x216a9f,'prefetchJourneySegments':_0xed5bc5};}export async function executePushSegments(_0x1d27e2,_0x49acf7,_0x2fb24e,_0x1b8074,_0x4d0d5c){const _0x27208e=a152_0x2925d8,{segmentDefToCreateRequest:_0x432a7c,segmentDefToUpdateRequest:_0x2e1d2a}=await import('./child-segment-yaml.js'),_0x30cf0f=_0x2fb24e['folderPathToId'],_0x3c901d=0x5,_0x6a52df=async _0x57e4e3=>{const _0x4e6501=a152_0x3d99,_0x2e4882=_0x57e4e3[_0x4e6501(0x1bf)]?_0x30cf0f[_0x4e6501(0x1f9)](_0x57e4e3[_0x4e6501(0x1bf)]):undefined;let _0x41f2dc;const _0x2bb63a={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x13648f=_0x57e4e3[_0x4e6501(0x199)];if(_0x57e4e3[_0x4e6501(0x199)]['rule']){const _0x5b7b2e=createSegmentIdResolver(_0x2fb24e[_0x4e6501(0x175)],_0x57e4e3[_0x4e6501(0x199)][_0x4e6501(0x1ae)]),_0x3667ee=await resolveRuleSegmentIds(_0x57e4e3[_0x4e6501(0x199)][_0x4e6501(0x178)],_0x5b7b2e);_0x13648f={..._0x57e4e3[_0x4e6501(0x199)],'rule':_0x3667ee};}try{if(_0x57e4e3[_0x4e6501(0x1db)]){_0x4d0d5c[_0x4e6501(0x18e)]?.({'type':'segment_creating','name':_0x57e4e3['yamlConfig']['name']});const _0x26f5e2=_0x432a7c(_0x13648f,_0x2e4882),_0x40dd1a=await _0x4d0d5c['withProgress'](_0x4e6501(0x1bb)+_0x57e4e3[_0x4e6501(0x199)][_0x4e6501(0x1ae)]+_0x4e6501(0x1c3),()=>_0x1d27e2[_0x4e6501(0x179)][_0x4e6501(0x12c)](_0x1b8074[_0x4e6501(0x1f8)],_0x26f5e2));_0x41f2dc=_0x40dd1a[_0x4e6501(0x1c5)]['id'],_0x2fb24e['segmentNameToId'][_0x4e6501(0x12a)](_0x57e4e3[_0x4e6501(0x199)][_0x4e6501(0x1ae)],_0x41f2dc),_0x2bb63a[_0x4e6501(0x168)]={'name':_0x57e4e3[_0x4e6501(0x199)][_0x4e6501(0x1ae)],'id':_0x41f2dc},_0x4d0d5c['onProgress']?.({'type':_0x4e6501(0x11f),'name':_0x57e4e3[_0x4e6501(0x199)][_0x4e6501(0x1ae)],'segmentId':_0x41f2dc}),_0x4d0d5c[_0x4e6501(0x182)]?.(_0x4e6501(0x10b)+_0x57e4e3[_0x4e6501(0x199)]['name']+'\x27'),_0x2bb63a[_0x4e6501(0x174)]=0x1;}else{if(_0x57e4e3[_0x4e6501(0x209)]){_0x4d0d5c['onProgress']?.({'type':_0x4e6501(0x125),'name':_0x57e4e3[_0x4e6501(0x199)][_0x4e6501(0x1ae)]});const _0x508944=_0x2e1d2a(_0x13648f);_0x2e4882!==_0x57e4e3[_0x4e6501(0x173)]?.[_0x4e6501(0x1ab)]&&(_0x508944[_0x4e6501(0x1ab)]=_0x2e4882?parseInt(_0x2e4882,0xa):undefined),await _0x4d0d5c[_0x4e6501(0x16f)](_0x4e6501(0x15d)+_0x57e4e3[_0x4e6501(0x199)][_0x4e6501(0x1ae)]+_0x4e6501(0x1c3),()=>_0x1d27e2[_0x4e6501(0x179)][_0x4e6501(0x17b)](_0x1b8074[_0x4e6501(0x1f8)],_0x57e4e3['existingSegment']['id'],_0x508944)),_0x41f2dc=_0x57e4e3[_0x4e6501(0x173)]['id'],_0x4d0d5c['onProgress']?.({'type':_0x4e6501(0x1b2),'name':_0x57e4e3[_0x4e6501(0x199)][_0x4e6501(0x1ae)]}),_0x4d0d5c[_0x4e6501(0x182)]?.(_0x4e6501(0x1bc)+_0x57e4e3[_0x4e6501(0x199)][_0x4e6501(0x1ae)]+'\x27'),_0x2bb63a[_0x4e6501(0x177)]=0x1;}else _0x41f2dc=_0x57e4e3[_0x4e6501(0x173)]['id'];}}catch(_0x2ee7c7){const _0x862319=isHttp400Error(_0x2ee7c7),_0x4c2ea4=_0x862319?ErrorCode[_0x4e6501(0x172)]:ErrorCode[_0x4e6501(0x17c)],_0x5a2806=getErrorMessage(_0x2ee7c7);throw new SDKError(_0x4c2ea4,_0x4e6501(0x119)+(_0x57e4e3[_0x4e6501(0x1db)]?_0x4e6501(0x207):_0x4e6501(0x123))+'\x20segment\x20from\x20file:\x20'+_0x57e4e3['absolutePath']+_0x4e6501(0x1dd)+_0x5a2806,_0x2ee7c7);}try{const _0x40de00=await syncActivationsForSegment(_0x1d27e2,_0x1b8074[_0x4e6501(0x1f8)],_0x41f2dc,_0x57e4e3[_0x4e6501(0x199)][_0x4e6501(0x1ae)],_0x57e4e3[_0x4e6501(0x152)],_0x4d0d5c,_0x57e4e3[_0x4e6501(0x114)]);_0x2bb63a[_0x4e6501(0x1c1)]=_0x40de00;}catch(_0x3c0d70){if(_0x3c0d70 instanceof SDKError)throw _0x3c0d70;throw new SDKError(ErrorCode[_0x4e6501(0x121)],_0x4e6501(0x185)+_0x57e4e3['yamlConfig'][_0x4e6501(0x1ae)]+_0x4e6501(0x13d)+_0x57e4e3[_0x4e6501(0x114)]+_0x4e6501(0x1dd)+getErrorMessage(_0x3c0d70),_0x3c0d70);}return _0x2bb63a;},_0x553818=await batchAsync(_0x49acf7,_0x6a52df,_0x3c901d),_0x3fec44={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0xdb42f4 of _0x553818){_0x3fec44[_0x27208e(0x174)]+=_0xdb42f4[_0x27208e(0x174)],_0x3fec44[_0x27208e(0x177)]+=_0xdb42f4[_0x27208e(0x177)],_0xdb42f4['createdSegmentId']&&_0x3fec44[_0x27208e(0x201)][_0x27208e(0x12a)](_0xdb42f4[_0x27208e(0x168)][_0x27208e(0x1ae)],_0xdb42f4[_0x27208e(0x168)]['id']),_0x3fec44['activations'][_0x27208e(0x174)]+=_0xdb42f4[_0x27208e(0x1c1)][_0x27208e(0x174)],_0x3fec44[_0x27208e(0x1c1)][_0x27208e(0x177)]+=_0xdb42f4['activations'][_0x27208e(0x177)],_0x3fec44['activations'][_0x27208e(0x10e)]+=_0xdb42f4[_0x27208e(0x1c1)][_0x27208e(0x10e)];}return _0x3fec44;}async function syncActivationsForSegment(_0x4081fb,_0x1541d7,_0x328f15,_0x16498b,_0x58392a,_0x5d00b0,_0x1383b7){const _0x3eea7a=a152_0x2925d8,_0x200a09={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x3dbcfa of _0x58392a){try{if(_0x3dbcfa[_0x3eea7a(0x153)]===_0x3eea7a(0x207)&&_0x3dbcfa[_0x3eea7a(0x1cf)])_0x5d00b0[_0x3eea7a(0x18e)]?.({'type':'activation_creating','segmentName':_0x16498b,'activationName':_0x3dbcfa[_0x3eea7a(0x1ae)]}),await _0x5d00b0[_0x3eea7a(0x16f)](_0x3eea7a(0x13f)+_0x3dbcfa[_0x3eea7a(0x1ae)]+_0x3eea7a(0x1c3),()=>_0x4081fb[_0x3eea7a(0x179)][_0x3eea7a(0x19a)](_0x1541d7,_0x328f15,_0x3dbcfa[_0x3eea7a(0x1cf)])),_0x5d00b0[_0x3eea7a(0x18e)]?.({'type':'activation_created','segmentName':_0x16498b,'activationName':_0x3dbcfa['name']}),_0x5d00b0[_0x3eea7a(0x182)]?.(_0x3eea7a(0x11a)+_0x3dbcfa[_0x3eea7a(0x1ae)]+'\x27'),_0x200a09[_0x3eea7a(0x174)]++;else{if(_0x3dbcfa['type']===_0x3eea7a(0x123)&&_0x3dbcfa[_0x3eea7a(0x1cf)]&&_0x3dbcfa[_0x3eea7a(0x1df)])_0x5d00b0[_0x3eea7a(0x18e)]?.({'type':_0x3eea7a(0x13e),'segmentName':_0x16498b,'activationName':_0x3dbcfa[_0x3eea7a(0x1ae)]}),await _0x5d00b0[_0x3eea7a(0x16f)]('Updating\x20activation\x20\x27'+_0x3dbcfa[_0x3eea7a(0x1ae)]+'\x27...',()=>_0x4081fb[_0x3eea7a(0x179)][_0x3eea7a(0x1a9)](_0x1541d7,_0x328f15,_0x3dbcfa['existingActivation']['id'],_0x3dbcfa[_0x3eea7a(0x1cf)])),_0x5d00b0['onProgress']?.({'type':_0x3eea7a(0x1e5),'segmentName':_0x16498b,'activationName':_0x3dbcfa[_0x3eea7a(0x1ae)]}),_0x5d00b0[_0x3eea7a(0x182)]?.(_0x3eea7a(0x16b)+_0x3dbcfa['name']+'\x27'),_0x200a09[_0x3eea7a(0x177)]++;else _0x3dbcfa['type']===_0x3eea7a(0x135)&&_0x3dbcfa[_0x3eea7a(0x1df)]&&(_0x5d00b0['onProgress']?.({'type':_0x3eea7a(0x1e6),'segmentName':_0x16498b,'activationName':_0x3dbcfa[_0x3eea7a(0x1ae)]}),await _0x5d00b0['withProgress']('Deleting\x20activation\x20\x27'+_0x3dbcfa[_0x3eea7a(0x1ae)]+'\x27...',()=>_0x4081fb[_0x3eea7a(0x179)][_0x3eea7a(0x1c0)](_0x1541d7,_0x328f15,_0x3dbcfa['existingActivation']['id'])),_0x5d00b0[_0x3eea7a(0x18e)]?.({'type':'activation_deleted','segmentName':_0x16498b,'activationName':_0x3dbcfa[_0x3eea7a(0x1ae)]}),_0x5d00b0['logDeleted']?.(_0x3eea7a(0x1d0)+_0x3dbcfa[_0x3eea7a(0x1ae)]+'\x27'),_0x200a09[_0x3eea7a(0x10e)]++);}}catch(_0x268ac8){const _0x127c61=isHttp400Error(_0x268ac8),_0x905523=_0x127c61?ErrorCode[_0x3eea7a(0x105)]:ErrorCode[_0x3eea7a(0x121)],_0x175758=getErrorMessage(_0x268ac8);throw new SDKError(_0x905523,_0x3eea7a(0x119)+_0x3dbcfa[_0x3eea7a(0x153)]+_0x3eea7a(0x205)+_0x3dbcfa['name']+_0x3eea7a(0x13d)+_0x1383b7+_0x3eea7a(0x1dd)+_0x175758,_0x268ac8);}}return _0x200a09;}export async function executePushFolders(_0x207b6d,_0x2de7e6,_0x8bbb91,_0x1ac593,_0x39110b){const _0x55da78=a152_0x2925d8,_0x4ed3d5=new Map(_0x8bbb91),_0x29a2a2=sortFoldersByDepth(_0x2de7e6);for(const _0xb5a7a5 of _0x29a2a2){const _0x401963=_0xb5a7a5[_0x55da78(0x102)]('/'),_0x46e745=_0x401963[_0x401963['length']-0x1],_0x5afc31=_0x401963[_0x55da78(0x1bd)](0x0,-0x1)[_0x55da78(0x1d8)]('/'),_0x3ea963=_0x4ed3d5[_0x55da78(0x1f9)](_0x5afc31);_0x39110b[_0x55da78(0x18e)]?.({'type':_0x55da78(0x1cd),'folder':_0xb5a7a5});const _0x3ec781={'name':_0x46e745,'parentFolderId':_0x3ea963},_0x3f6031=await _0x39110b[_0x55da78(0x16f)](_0x55da78(0x187)+_0xb5a7a5+_0x55da78(0x1c3),()=>_0x207b6d[_0x55da78(0x179)][_0x55da78(0x14a)](_0x1ac593['parentId'],_0x3ec781));_0x4ed3d5['set'](_0xb5a7a5,_0x3f6031[_0x55da78(0x1c5)]['id']),_0x39110b[_0x55da78(0x18e)]?.({'type':_0x55da78(0x15f),'folder':_0xb5a7a5,'folderId':_0x3f6031['data']['id']}),_0x39110b['logInfo']?.(_0x55da78(0x156)+_0xb5a7a5+'\x27');}return _0x4ed3d5;}export async function executePushSegmentDeletions(_0x13723f,_0xb1f4a8,_0x222ef2){const _0x139efa=a152_0x2925d8;if(_0xb1f4a8[_0x139efa(0x154)]===0x0)return 0x0;const {batchAsync:_0x467d7e}=await import(_0x139efa(0x1b4)),_0xf1f8d4=0x5,_0x1dac53=await _0x467d7e(_0xb1f4a8,async _0x5b3d43=>{const _0x29e0f1=_0x139efa;return _0x222ef2[_0x29e0f1(0x18e)]?.({'type':'segment_deleting','name':_0x5b3d43[_0x29e0f1(0x1ae)]}),await _0x13723f['segment'][_0x29e0f1(0x195)](_0x5b3d43['id']),_0x222ef2[_0x29e0f1(0x18e)]?.({'type':_0x29e0f1(0x1a1),'name':_0x5b3d43['name']}),_0x222ef2[_0x29e0f1(0x202)]?.(_0x29e0f1(0x1da)+_0x5b3d43['name']+'\x27'),0x1;},_0xf1f8d4);return _0x1dac53[_0x139efa(0x15a)]((_0x2f315a,_0x5a4b38)=>_0x2f315a+_0x5a4b38,0x0);}export async function executePushJourneys(_0x3c8dcc,_0x35e69c,_0xd076d9,_0x12a695,_0x354ac4){const _0x5056cb=a152_0x2925d8,{journeyDefToRequest:_0x2ee147}=await import(_0x5056cb(0x1b7)),{activationDefToCreateRequest:_0x47c27c,yamlRuleToApi:_0x3644e4,validateSegmentRule:_0x434186}=await import(_0x5056cb(0x1a4)),_0x4d0cc5={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x1ba8cd=new Map(_0xd076d9[_0x5056cb(0x175)]),_0x38935e=0x5;for(let _0x2a183f=0x0;_0x2a183f<_0x35e69c[_0x5056cb(0x154)];_0x2a183f+=_0x38935e){const _0x4e1f3f=_0x35e69c[_0x5056cb(0x1bd)](_0x2a183f,_0x2a183f+_0x38935e),_0x43c2e2=await Promise[_0x5056cb(0x1d1)](_0x4e1f3f[_0x5056cb(0x1b9)](async _0x159b89=>{const _0x2de7a1=_0x5056cb;if(!_0x159b89['isNew']&&!_0x159b89[_0x2de7a1(0x209)])return{'action':_0x2de7a1(0x160),'name':_0x159b89['yamlConfig'][_0x2de7a1(0x1ae)],'journeyId':_0x159b89[_0x2de7a1(0x155)]?.['id']};const _0x5efef5=_0x159b89[_0x2de7a1(0x1bf)]?_0xd076d9[_0x2de7a1(0x147)][_0x2de7a1(0x1f9)](_0x159b89[_0x2de7a1(0x1bf)]):undefined;_0x354ac4[_0x2de7a1(0x18e)]?.({'type':_0x159b89[_0x2de7a1(0x1db)]?_0x2de7a1(0x183):_0x2de7a1(0x1a7),'name':_0x159b89[_0x2de7a1(0x199)][_0x2de7a1(0x1ae)]});try{const _0x2c39b3=await executeSingleJourneyPush(_0x3c8dcc,_0x159b89,{..._0xd076d9,'segmentNameToId':_0x1ba8cd},{'parentId':_0x12a695['parentId'],'rootFolderId':_0x12a695[_0x2de7a1(0x18b)],'folderId':_0x5efef5,'verbose':_0x12a695[_0x2de7a1(0x139)]},_0x354ac4,{'journeyDefToRequest':_0x2ee147,'activationDefToCreateRequest':_0x47c27c,'yamlRuleToApi':_0x3644e4,'validateSegmentRule':_0x434186});for(const [_0x4ef328,_0x264e01]of _0x2c39b3[_0x2de7a1(0x204)]){_0x1ba8cd['set'](_0x4ef328,_0x264e01),_0x4d0cc5[_0x2de7a1(0x204)]['set'](_0x4ef328,_0x264e01);}if(_0x2c39b3[_0x2de7a1(0x184)]==='created')_0x354ac4[_0x2de7a1(0x18e)]?.({'type':_0x2de7a1(0x1b1),'name':_0x159b89[_0x2de7a1(0x199)][_0x2de7a1(0x1ae)],'journeyId':_0x2c39b3['journeyId']}),_0x354ac4['logSuccess']?.(_0x2de7a1(0x196)+_0x159b89['yamlConfig'][_0x2de7a1(0x1ae)]+'\x27'),_0x4d0cc5['created']++;else _0x2c39b3[_0x2de7a1(0x184)]==='updated'&&(_0x354ac4[_0x2de7a1(0x18e)]?.({'type':_0x2de7a1(0x14d),'name':_0x159b89[_0x2de7a1(0x199)][_0x2de7a1(0x1ae)]}),_0x354ac4[_0x2de7a1(0x182)]?.(_0x2de7a1(0x11b)+_0x159b89[_0x2de7a1(0x199)]['name']+'\x27'),_0x4d0cc5[_0x2de7a1(0x177)]++);return{'action':_0x2c39b3[_0x2de7a1(0x184)],'name':_0x159b89['yamlConfig'][_0x2de7a1(0x1ae)],'journeyId':_0x2c39b3[_0x2de7a1(0x19e)]};}catch(_0x27302f){const _0x4856db=isHttp400Error(_0x27302f),_0x158dd6=_0x4856db?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode[_0x2de7a1(0x208)],_0x150004=getErrorMessage(_0x27302f);throw new SDKError(_0x158dd6,'Failed\x20to\x20'+(_0x159b89[_0x2de7a1(0x1db)]?_0x2de7a1(0x207):'update')+_0x2de7a1(0x1e1)+_0x159b89[_0x2de7a1(0x114)]+_0x2de7a1(0x1dd)+_0x150004,_0x27302f);}}));_0x4d0cc5[_0x5056cb(0x1e7)][_0x5056cb(0x148)](..._0x43c2e2);}return _0x4d0cc5;}async function matchExistingJourneySegments(_0x22f0ef,_0x4b17e9,_0x3625a5,_0x45f59b,_0x10415d){const _0x5823ad=a152_0x2925d8;if(!_0x4b17e9[_0x5823ad(0x155)]||!_0x4b17e9['yamlConfig'][_0x5823ad(0x1e2)])return;const _0x22d02e=new Map(),_0xb86d9b=new Set();for(const _0x964b5b of Object[_0x5823ad(0x169)](_0x4b17e9[_0x5823ad(0x199)][_0x5823ad(0x1e2)])){const _0x14bf85=generateDeterministicJourneySegmentName(_0x4b17e9[_0x5823ad(0x199)][_0x5823ad(0x1ae)],_0x964b5b);_0x22d02e[_0x5823ad(0x12a)](_0x14bf85,_0x964b5b),_0xb86d9b[_0x5823ad(0x17d)](_0x964b5b);}const _0x281db5=[],_0x1b91f6=collectSegmentIdsFromJourneyApi(_0x4b17e9[_0x5823ad(0x155)]);for(const _0x425195 of _0x1b91f6){const _0x383c4a=await fetchSegment(_0x22f0ef,_0x3625a5,_0x425195,_0x45f59b);if(!_0x383c4a?.[_0x5823ad(0x1ae)])continue;const _0x4a7d0c=_0x22d02e[_0x5823ad(0x1f9)](_0x383c4a[_0x5823ad(0x1ae)]);_0x4a7d0c?(_0x10415d['set'](_0x4a7d0c,_0x425195),_0xb86d9b[_0x5823ad(0x135)](_0x4a7d0c)):_0x281db5['push']({'id':_0x425195,'seg':_0x383c4a});}if(_0xb86d9b['size']>0x0&&_0x281db5[_0x5823ad(0x154)]>0x0){const {localExpandedRuleToNames:_0x4a64e5}=buildLocalExpandedRuleMappings(_0x4b17e9['yamlConfig']),_0x469a08=new Map();for(const {id:_0x323e88,seg:_0x30006b}of _0x281db5){if(_0x30006b[_0x5823ad(0x178)]){const _0x144d2e=apiRuleToYaml(_0x30006b[_0x5823ad(0x178)]);_0x469a08['set'](_0x323e88,_0x144d2e);}}for(const {id:_0x499bc9,seg:_0xc0d07}of _0x281db5){if(!_0xc0d07[_0x5823ad(0x178)])continue;const _0x34317f=_0x469a08['get'](_0x499bc9);if(!_0x34317f)continue;const _0x37ebb1=serializeExpandedRule(_0x34317f,_0x469a08),_0x19b799=_0x4a64e5['get'](_0x37ebb1);if(_0x19b799){const _0xdcc7b2=_0x19b799[_0x5823ad(0x132)](_0xc821b0=>_0xb86d9b[_0x5823ad(0x15b)](_0xc821b0));_0xdcc7b2&&(_0x10415d[_0x5823ad(0x12a)](_0xdcc7b2,_0x499bc9),_0xb86d9b[_0x5823ad(0x135)](_0xdcc7b2),logger[_0x5823ad(0x1fd)](_0x5823ad(0x1d2)+_0xc0d07[_0x5823ad(0x1ae)]+_0x5823ad(0x1a2)+_0xdcc7b2+_0x5823ad(0x107)));}}}}async function executeSingleJourneyPush(_0x359df8,_0x49f81c,_0x4126bd,_0x1fedbd,_0x3f9354,_0x55eda7){const _0x2daf64=a152_0x2925d8,{journeyDefToRequest:_0x30934a,activationDefToCreateRequest:_0x4340ce,yamlRuleToApi:_0x17d4b8,validateSegmentRule:_0x4d088d}=_0x55eda7,_0x3171f4=new Map(),_0x17b885=new Map();recoverSegmentIdsFromPushRecovery(_0x49f81c,_0x3171f4,_0x4126bd['segmentNameToId']);const _0x57ed59=new Map(),_0x381b7b=new Map(),_0x598695=new Map();let _0x869d01;const _0x4d2341=async()=>{const _0x526903=a152_0x3d99;if(_0x869d01)return;_0x869d01=new Map();if(!_0x49f81c['existingJourney'])return;const _0x26e25a=await _0x359df8['journey'][_0x526903(0x1ac)](_0x49f81c[_0x526903(0x155)]['id']);for(const _0x4d131f of _0x26e25a){const _0x8bde99=journeyActivationStepToYaml(_0x4d131f,_0x4126bd[_0x526903(0x149)],_0x4126bd['connectionIdToNameMap']),_0x4081a9=activationSignature(_0x8bde99);!_0x869d01[_0x526903(0x15b)](_0x4081a9)&&_0x869d01[_0x526903(0x12a)](_0x4081a9,_0x4d131f['id']),_0x8bde99['name']&&_0x17b885[_0x526903(0x12a)](_0x8bde99[_0x526903(0x1ae)],_0x4d131f['id']);}};await matchExistingJourneySegments(_0x359df8,_0x49f81c,_0x1fedbd['parentId'],_0x4126bd['existingSegments'],_0x4126bd[_0x2daf64(0x175)]);const _0x4a2c90={'resolveSegmentId':async _0xa10cbd=>{const _0xd7a78d=_0x2daf64,_0x110b6b=_0x4126bd['segmentNameToId'][_0xd7a78d(0x1f9)](_0xa10cbd);if(!_0x110b6b)throw new SDKError(ErrorCode[_0xd7a78d(0x143)],_0xd7a78d(0x1fb)+_0xa10cbd+'\x20(referenced\x20in\x20journey\x20'+_0x49f81c[_0xd7a78d(0x199)]['name']+')');return _0x110b6b;},'resolveEmbeddedSegmentId':async(_0x4ee8fe,_0x4f90b5)=>{const _0x563d0b=_0x2daf64,_0x1a1b18=_0x4126bd['segmentNameToId']['get'](_0x4ee8fe);if(_0x1a1b18)return _0x1a1b18;const _0x334d1b=_0x4126bd['existingSegments'][_0x563d0b(0x132)](_0x169f3e=>_0x169f3e[_0x563d0b(0x1ae)]===_0x4ee8fe);if(_0x334d1b)return _0x4126bd['segmentNameToId'][_0x563d0b(0x12a)](_0x4ee8fe,_0x334d1b['id']),_0x334d1b['id'];if(_0x49f81c[_0x563d0b(0x1db)]){const {stageName:_0x12db4f,criteriaName:_0x536687}=findSegmentCriteriaLocation(_0x49f81c[_0x563d0b(0x199)],_0x4ee8fe);return _0x4d088d(_0x4ee8fe,_0x4f90b5[_0x563d0b(0x178)]),_0x381b7b[_0x563d0b(0x12a)](_0x4ee8fe,{'definition':_0x4f90b5,'stageName':_0x12db4f,'criteriaName':_0x536687}),createPendingSegmentId(_0x4ee8fe);}const _0x17372c=_0x49f81c[_0x563d0b(0x155)]?.['id'];if(!_0x17372c)throw new SDKError(ErrorCode['INTERNAL'],_0x563d0b(0x198));const _0x1d87d0=_0x57ed59[_0x563d0b(0x1f9)](_0x4ee8fe);if(_0x1d87d0)return _0x1d87d0;const _0x224641=((async()=>{const _0x2399f1=_0x563d0b;_0x4d088d(_0x4ee8fe,_0x4f90b5[_0x2399f1(0x178)]);const _0x36ea78=generateDeterministicJourneySegmentName(_0x49f81c[_0x2399f1(0x199)]['name'],_0x4ee8fe),_0x27f918=_0x4126bd[_0x2399f1(0x140)][_0x2399f1(0x132)](_0x3daf74=>_0x3daf74[_0x2399f1(0x1ae)]===_0x36ea78),_0x2d960d=createSegmentIdResolver(_0x4126bd[_0x2399f1(0x175)],_0x4ee8fe),_0x16a85c=await resolveRuleSegmentIds(_0x4f90b5['rule'],_0x2d960d);let _0x33863a;return _0x27f918?(await _0x359df8[_0x2399f1(0x179)]['updateSegmentById'](_0x1fedbd[_0x2399f1(0x1f8)],_0x27f918['id'],{'description':_0x4f90b5[_0x2399f1(0x1f0)]||_0x2399f1(0x1d4)+_0x4ee8fe,'rule':_0x17d4b8(_0x16a85c),'countPopulation':!![]}),_0x33863a=_0x27f918['id'],saveSegmentToPushRecovery(_0x49f81c[_0x2399f1(0x114)],_0x49f81c[_0x2399f1(0x199)][_0x2399f1(0x1ae)],_0x4ee8fe,{'segmentId':_0x33863a,'uniqueServerName':_0x36ea78,'createdAt':new Date()[_0x2399f1(0x1c2)]()})):_0x33863a=await createOrRecoverEmbeddedSegment(_0x359df8,_0x49f81c,{'localName':_0x4ee8fe,'uniqueSegmentName':_0x36ea78,'description':_0x4f90b5[_0x2399f1(0x1f0)]||_0x2399f1(0x1d4)+_0x4ee8fe,'journeyId':_0x17372c,'resolvedRule':_0x16a85c,'parentId':_0x1fedbd['parentId'],'folderId':_0x1fedbd[_0x2399f1(0x18b)]||''},_0x17d4b8),_0x4126bd[_0x2399f1(0x175)][_0x2399f1(0x12a)](_0x4ee8fe,_0x33863a),_0x3171f4[_0x2399f1(0x12a)](_0x4ee8fe,_0x33863a),_0x33863a;})());_0x57ed59['set'](_0x4ee8fe,_0x224641);try{return await _0x224641;}finally{_0x57ed59[_0x563d0b(0x135)](_0x4ee8fe);}},'resolveActivationId':async _0x58d111=>{const _0xe98a16=_0x2daf64,_0x10797d=_0x17b885[_0xe98a16(0x1f9)](_0x58d111);if(_0x10797d)return _0x10797d;if(_0x49f81c['existingJourney']){await _0x4d2341();const _0x3f84ce=_0x17b885['get'](_0x58d111);if(_0x3f84ce)return _0x3f84ce;}throw new SDKError(ErrorCode[_0xe98a16(0x18a)],_0xe98a16(0x1c8)+_0x58d111+_0xe98a16(0x1e4)+_0x49f81c[_0xe98a16(0x199)][_0xe98a16(0x1ae)]+').\x20'+'Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.');},'resolveEmbeddedActivationId':async(_0x5d289c,_0x3613ee)=>{const _0x26a70d=_0x2daf64,_0x219f91=_0x17b885[_0x26a70d(0x1f9)](_0x5d289c);if(_0x219f91)return _0x219f91;if(_0x49f81c[_0x26a70d(0x1db)])return _0x598695[_0x26a70d(0x12a)](_0x5d289c,_0x3613ee),createPendingActivationId(_0x5d289c);if(_0x49f81c[_0x26a70d(0x155)]){await _0x4d2341();const _0x43290d=_0x17b885['get'](_0x3613ee['name']);if(_0x43290d)return _0x17b885[_0x26a70d(0x12a)](_0x5d289c,_0x43290d),_0x43290d;const _0x3c0fbf=activationSignature(_0x3613ee),_0x342b26=_0x869d01?.[_0x26a70d(0x1f9)](_0x3c0fbf);if(_0x342b26)return _0x17b885[_0x26a70d(0x12a)](_0x5d289c,_0x342b26),_0x342b26;const _0x4f33ae=await _0x4340ce(_0x3613ee,_0x4126bd[_0x26a70d(0x109)]),_0x4c5083={..._0x4f33ae,..._0x3613ee[_0x26a70d(0x1ed)]!==undefined&&{'runAfterJourneyRefresh':_0x3613ee[_0x26a70d(0x1ed)]}},_0xc550bf=await _0x359df8['journey'][_0x26a70d(0x19a)](_0x49f81c[_0x26a70d(0x155)]['id'],_0x4c5083);return _0x17b885[_0x26a70d(0x12a)](_0x5d289c,_0xc550bf['id']),_0xc550bf['id'];}throw new SDKError(ErrorCode[_0x26a70d(0x18d)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x414289=>{const _0x42fcf4=_0x2daf64;try{return await _0x359df8[_0x42fcf4(0x1f2)][_0x42fcf4(0x18c)](_0x1fedbd[_0x42fcf4(0x1f8)],_0x414289);}catch(_0x57eb1b){throw new SDKError(ErrorCode[_0x42fcf4(0x18a)],'Journey\x20\x27'+_0x414289+_0x42fcf4(0x112)+_0x49f81c[_0x42fcf4(0x199)][_0x42fcf4(0x1ae)]+'\x27)',_0x57eb1b);}},'resolveStageId':async(_0x1509b0,_0x1dc007)=>{const _0x1c496d=_0x2daf64,_0xb2a32d=await _0x359df8[_0x1c496d(0x1f2)][_0x1c496d(0x1c9)](_0x1509b0),_0x376840=_0xb2a32d['attributes'][_0x1c496d(0x206)][_0x1c496d(0x132)](_0x349662=>_0x349662['name']['toLowerCase']()===_0x1dc007[_0x1c496d(0x1eb)]());if(!_0x376840?.['id'])throw new SDKError(ErrorCode[_0x1c496d(0x18a)],_0x1c496d(0x1d7)+_0x1dc007+_0x1c496d(0x14b)+(_0xb2a32d[_0x1c496d(0x188)][_0x1c496d(0x10d)]||_0xb2a32d[_0x1c496d(0x188)]['name'])+'\x27');return _0x376840['id'];}},_0x4766ce=await _0x30934a(_0x49f81c[_0x2daf64(0x199)],_0x1fedbd[_0x2daf64(0x1f8)],_0x4a2c90),_0x472d0a=_0x1fedbd[_0x2daf64(0x16c)]||_0x1fedbd['rootFolderId'];_0x472d0a&&(_0x4766ce['relationships']={'parentFolder':{'data':{'id':_0x472d0a,'type':_0x2daf64(0x13b)}}});if(_0x49f81c[_0x2daf64(0x1db)]){if(_0x381b7b[_0x2daf64(0x1b6)]>0x0||_0x598695[_0x2daf64(0x1b6)]>0x0)return await executeThreeStepJourneyCreate(_0x359df8,_0x49f81c,_0x4766ce,{'pendingEmbeddedSegments':_0x381b7b,'pendingEmbeddedActivations':_0x598695,'embeddedSegmentNameToId':_0x3171f4,'journeyActivationNameToId':_0x17b885},{..._0x1fedbd,'effectiveFolderId':_0x472d0a},_0x4126bd,_0x3f9354,_0x55eda7);else{ensureJourneyDefaults(_0x4766ce[_0x2daf64(0x188)]);const _0x587bba=await _0x359df8['journey']['create'](_0x4766ce);return deletePushRecovery(_0x49f81c[_0x2daf64(0x114)]),{'action':_0x2daf64(0x174),'journeyId':_0x587bba['id'],'embeddedSegmentNameToId':_0x3171f4};}}else{if(_0x49f81c[_0x2daf64(0x209)]&&_0x49f81c[_0x2daf64(0x155)]){_0x4766ce['id']=_0x49f81c[_0x2daf64(0x155)]['id'];const _0x31fbb1=_0x4766ce[_0x2daf64(0x188)];_0x49f81c['existingJourney'][_0x2daf64(0x188)]?.[_0x2daf64(0x10d)]&&(_0x31fbb1['journeyBundleName']=_0x49f81c[_0x2daf64(0x155)]['attributes']['journeyBundleName']);const _0x1328ae=_0x49f81c[_0x2daf64(0x155)]['attributes']?.['journeyStages'];return _0x1328ae&&_0x4766ce[_0x2daf64(0x188)][_0x2daf64(0x206)]&&injectExistingStageIds(_0x4766ce[_0x2daf64(0x188)]['journeyStages'],_0x1328ae),ensureJourneyDefaults(_0x31fbb1),await _0x359df8['journey'][_0x2daf64(0x123)](_0x49f81c[_0x2daf64(0x155)]['id'],_0x4766ce),deletePushRecovery(_0x49f81c['absolutePath']),{'action':_0x2daf64(0x177),'journeyId':_0x49f81c[_0x2daf64(0x155)]['id'],'embeddedSegmentNameToId':_0x3171f4};}}return deletePushRecovery(_0x49f81c['absolutePath']),{'action':_0x2daf64(0x160),'journeyId':_0x49f81c['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x3171f4};}function findSegmentCriteriaLocation(_0x341b42,_0x41092a){const _0x4f15bd=a152_0x2925d8,_0x9118bf=_0x341b42[_0x4f15bd(0x104)]||_0x341b42[_0x4f15bd(0x1f5)]?.[0x0]?.['stages']||[];let _0x3c4d78=_0x4f15bd(0x1fc),_0x5abb5d=_0x41092a;const _0x987d93=_0x341b42['goal']||_0x341b42[_0x4f15bd(0x1f5)]?.[0x0]?.[_0x4f15bd(0x190)];if(_0x987d93?.[_0x4f15bd(0x179)]===_0x41092a)return{'stageName':'goal','criteriaName':_0x987d93[_0x4f15bd(0x1ae)]||_0x41092a};_0xc0b61e:for(const _0x5d8938 of _0x9118bf){if(_0x5d8938[_0x4f15bd(0x17a)]?.[_0x4f15bd(0x179)]===_0x41092a){_0x3c4d78=_0x5d8938['name'],_0x5abb5d=_0x5d8938[_0x4f15bd(0x17a)][_0x4f15bd(0x1ae)]||_0x41092a;break;}if(_0x5d8938[_0x4f15bd(0x1ea)])for(const _0x153cc3 of _0x5d8938[_0x4f15bd(0x1ea)]){if(_0x153cc3[_0x4f15bd(0x153)]===_0x4f15bd(0x1e3)&&_0x153cc3[_0x4f15bd(0x12e)]?.[_0x4f15bd(0x14e)])for(const _0x43fd5b of _0x153cc3[_0x4f15bd(0x12e)]['branches']){if(_0x43fd5b[_0x4f15bd(0x179)]===_0x41092a){_0x3c4d78=_0x5d8938[_0x4f15bd(0x1ae)],_0x5abb5d=_0x43fd5b[_0x4f15bd(0x1ae)]||_0x41092a;break _0xc0b61e;}}}}return{'stageName':_0x3c4d78,'criteriaName':_0x5abb5d};}async function executeThreeStepJourneyCreate(_0x54e370,_0xe4f8f,_0xbb71a1,_0x257f74,_0x5eb182,_0x292e08,_0x192d86,_0x3ad1e7){const _0x5dad4f=a152_0x2925d8,{activationDefToCreateRequest:_0x1b9e66,yamlRuleToApi:_0x2f87b4}=_0x3ad1e7,{pendingEmbeddedSegments:_0x3a8289,pendingEmbeddedActivations:_0x46ec64,embeddedSegmentNameToId:_0x56890a}=_0x257f74,_0x2c3dd2=JSON[_0x5dad4f(0x1f3)](JSON[_0x5dad4f(0x1ad)](_0xbb71a1));ensureJourneyDefaults(_0x2c3dd2[_0x5dad4f(0x188)]),stripPendingIds(_0x2c3dd2);const _0x421097=await _0x54e370[_0x5dad4f(0x1f2)][_0x5dad4f(0x207)](_0x2c3dd2),_0x4c56c1=_0x421097['id'],_0x65876d=new Map();for(const _0x435ad8 of _0x421097[_0x5dad4f(0x188)][_0x5dad4f(0x206)]){_0x65876d['set'](_0x435ad8['name']['toLowerCase'](),_0x435ad8['id']);}recoverSegmentIdsFromPushRecovery(_0xe4f8f,_0x56890a,_0x292e08[_0x5dad4f(0x175)]);for(const [_0x1cba76,{definition:_0x3040a6}]of _0x3a8289){if(_0x56890a['has'](_0x1cba76)){_0x192d86[_0x5dad4f(0x18e)]?.({'type':_0x5dad4f(0x141),'journeyName':_0xe4f8f[_0x5dad4f(0x199)][_0x5dad4f(0x1ae)],'segmentName':_0x1cba76});continue;}const _0x3d9a41=generateDeterministicJourneySegmentName(_0xe4f8f[_0x5dad4f(0x199)][_0x5dad4f(0x1ae)],_0x1cba76);_0x192d86[_0x5dad4f(0x18e)]?.({'type':_0x5dad4f(0x167),'journeyName':_0xe4f8f[_0x5dad4f(0x199)][_0x5dad4f(0x1ae)],'segmentName':_0x1cba76});const _0x8f0cbc=createSegmentIdResolver(_0x292e08[_0x5dad4f(0x175)],_0x1cba76),_0x6bd908=await resolveRuleSegmentIds(_0x3040a6[_0x5dad4f(0x178)],_0x8f0cbc),_0x3adea4=await createOrRecoverEmbeddedSegment(_0x54e370,_0xe4f8f,{'localName':_0x1cba76,'uniqueSegmentName':_0x3d9a41,'description':_0x3040a6[_0x5dad4f(0x1f0)]||_0x5dad4f(0x1d4)+_0x1cba76,'journeyId':_0x4c56c1,'resolvedRule':_0x6bd908,'parentId':_0x5eb182[_0x5dad4f(0x1f8)],'folderId':_0x5eb182[_0x5dad4f(0x1c4)]||''},_0x2f87b4);_0x56890a[_0x5dad4f(0x12a)](_0x1cba76,_0x3adea4),_0x292e08[_0x5dad4f(0x175)][_0x5dad4f(0x12a)](_0x1cba76,_0x3adea4),_0x192d86[_0x5dad4f(0x18e)]?.({'type':_0x5dad4f(0x141),'journeyName':_0xe4f8f['yamlConfig'][_0x5dad4f(0x1ae)],'segmentName':_0x1cba76});}const _0x3e9840=new Map();for(const [_0x167f4d,_0x49f56c]of _0x46ec64){_0x192d86[_0x5dad4f(0x18e)]?.({'type':_0x5dad4f(0x120),'journeyName':_0xe4f8f[_0x5dad4f(0x199)][_0x5dad4f(0x1ae)],'activationName':_0x167f4d});const _0x34fa89=await _0x1b9e66(_0x49f56c,_0x292e08[_0x5dad4f(0x109)]),_0x18a6c9={..._0x34fa89,..._0x49f56c[_0x5dad4f(0x1ed)]!==undefined&&{'runAfterJourneyRefresh':_0x49f56c[_0x5dad4f(0x1ed)]}},_0x236fd2=await _0x54e370[_0x5dad4f(0x1f2)][_0x5dad4f(0x19a)](_0x4c56c1,_0x18a6c9);_0x3e9840[_0x5dad4f(0x12a)](_0x167f4d,_0x236fd2['id']),_0x257f74['journeyActivationNameToId'][_0x5dad4f(0x12a)](_0x167f4d,_0x236fd2['id']),_0x192d86['onProgress']?.({'type':'embedded_activation_created','journeyName':_0xe4f8f[_0x5dad4f(0x199)]['name'],'activationName':_0x167f4d});}const _0x3f0dc0=JSON[_0x5dad4f(0x1f3)](JSON[_0x5dad4f(0x1ad)](_0xbb71a1));return _0x3f0dc0['id']=_0x4c56c1,ensureJourneyDefaults(_0x3f0dc0[_0x5dad4f(0x188)]),resolvePendingIdsInRequest(_0x3f0dc0,_0xbb71a1,_0x65876d,_0x56890a,_0x3e9840,_0x192d86),await _0x54e370[_0x5dad4f(0x1f2)][_0x5dad4f(0x123)](_0x4c56c1,_0x3f0dc0),deletePushRecovery(_0xe4f8f[_0x5dad4f(0x114)]),{'action':_0x5dad4f(0x174),'journeyId':_0x4c56c1,'embeddedSegmentNameToId':_0x56890a};}export function stripWaitStepPendingIds(_0x554f4a){const _0x48984f=a152_0x2925d8,_0x3b581e=_0x554f4a[_0x48984f(0x162)]&&isPendingSegmentId(_0x554f4a[_0x48984f(0x162)]),_0x27aa3b=_0x554f4a[_0x48984f(0x1c6)]?.[_0x48984f(0x131)](_0x3918a5=>_0x3918a5[_0x48984f(0x127)]&&isPendingSegmentId(_0x3918a5[_0x48984f(0x127)]));(_0x3b581e||_0x27aa3b)&&(_0x554f4a[_0x48984f(0x103)]=_0x48984f(0x161),_0x554f4a[_0x48984f(0x101)]=0x1,_0x554f4a['waitStepUnit']=_0x48984f(0x113),delete _0x554f4a[_0x48984f(0x162)],delete _0x554f4a[_0x48984f(0x150)],delete _0x554f4a[_0x48984f(0x1e9)],delete _0x554f4a[_0x48984f(0x1c6)]);}export function resolveWaitStepPendingIds(_0x56ca5e,_0x479f61,_0x41f558,_0x201dc0){const _0x145347=a152_0x2925d8;if(_0x479f61[_0x145347(0x162)]&&isPendingSegmentId(_0x479f61[_0x145347(0x162)])){const _0x22abfc=_0x41f558(_0x479f61[_0x145347(0x162)],_0x145347(0x19d)+_0x201dc0+_0x145347(0x137));_0x22abfc&&(_0x56ca5e[_0x145347(0x103)]=_0x145347(0x118),_0x56ca5e[_0x145347(0x162)]=_0x22abfc,delete _0x56ca5e[_0x145347(0x101)],delete _0x56ca5e['waitStepUnit'],_0x479f61['conditionTimeoutDuration']!==undefined&&(_0x56ca5e[_0x145347(0x150)]=_0x479f61[_0x145347(0x150)]),_0x479f61[_0x145347(0x1e9)]&&(_0x56ca5e['conditionTimeoutUnit']=_0x479f61[_0x145347(0x1e9)]));}if(_0x479f61['conditions']){const _0x19ffa9=_0x479f61[_0x145347(0x1c6)][_0x145347(0x131)](_0x17c77c=>_0x17c77c[_0x145347(0x127)]&&isPendingSegmentId(_0x17c77c[_0x145347(0x127)]));if(_0x19ffa9){const _0x3abbea=_0x479f61['conditions'][_0x145347(0x1b9)](_0x3f80c4=>{const _0x3f3bf4=_0x145347;if(_0x3f80c4[_0x3f3bf4(0x127)]&&isPendingSegmentId(_0x3f80c4[_0x3f3bf4(0x127)])){const _0x314257=_0x41f558(_0x3f80c4[_0x3f3bf4(0x127)],_0x3f3bf4(0x19d)+_0x201dc0+_0x3f3bf4(0x137));return{..._0x3f80c4,'segmentId':_0x314257||_0x3f80c4[_0x3f3bf4(0x127)]};}return{..._0x3f80c4};});_0x56ca5e[_0x145347(0x103)]=_0x145347(0x118),_0x56ca5e[_0x145347(0x1c6)]=_0x3abbea,delete _0x56ca5e['waitStep'],delete _0x56ca5e[_0x145347(0x1ee)],delete _0x56ca5e[_0x145347(0x162)],delete _0x56ca5e[_0x145347(0x150)],delete _0x56ca5e[_0x145347(0x1e9)];}}}function stripPendingIds(_0x537094){const _0x4d99ed=a152_0x2925d8;_0x537094[_0x4d99ed(0x188)][_0x4d99ed(0x190)]?.[_0x4d99ed(0x127)]&&isPendingSegmentId(_0x537094[_0x4d99ed(0x188)][_0x4d99ed(0x190)][_0x4d99ed(0x127)])&&delete _0x537094[_0x4d99ed(0x188)]['goal'];for(const _0x145e13 of _0x537094[_0x4d99ed(0x188)][_0x4d99ed(0x206)]||[]){_0x145e13['entryCriteria']?.[_0x4d99ed(0x127)]&&isPendingSegmentId(_0x145e13[_0x4d99ed(0x146)][_0x4d99ed(0x127)])&&delete _0x145e13[_0x4d99ed(0x146)];_0x145e13[_0x4d99ed(0x1e8)]?.[_0x4d99ed(0x127)]&&isPendingSegmentId(_0x145e13[_0x4d99ed(0x1e8)][_0x4d99ed(0x127)])&&delete _0x145e13['milestone'];_0x145e13[_0x4d99ed(0x19f)]&&(_0x145e13[_0x4d99ed(0x19f)]=_0x145e13[_0x4d99ed(0x19f)][_0x4d99ed(0x122)](_0xc7cea5=>!_0xc7cea5[_0x4d99ed(0x127)]||!isPendingSegmentId(_0xc7cea5[_0x4d99ed(0x127)])));if(_0x145e13[_0x4d99ed(0x1ea)])for(const _0x5b7d23 of Object['keys'](_0x145e13[_0x4d99ed(0x1ea)])){const _0x417ca8=_0x145e13['steps'][_0x5b7d23];_0x417ca8[_0x4d99ed(0x153)]===_0x4d99ed(0x130)&&_0x417ca8[_0x4d99ed(0x111)]&&isPendingActivationId(_0x417ca8[_0x4d99ed(0x111)])&&(_0x417ca8['journeyActivationStepId']='');if(_0x417ca8['type']===_0x4d99ed(0x1be)&&_0x417ca8['branches'])for(const _0x265b01 of _0x417ca8['branches']){_0x265b01[_0x4d99ed(0x127)]&&isPendingSegmentId(_0x265b01[_0x4d99ed(0x127)])&&(_0x265b01[_0x4d99ed(0x127)]='');}_0x417ca8[_0x4d99ed(0x153)]===_0x4d99ed(0x13a)&&stripWaitStepPendingIds(_0x417ca8);}}}function resolvePendingIdsInRequest(_0x4d5cd4,_0x45d05a,_0x4664d3,_0x5c65a5,_0x1e7844,_0x2764c8){const _0x12fca6=a152_0x2925d8,_0x543616=(_0x146eaf,_0x571557)=>{const _0xa2b45f=a152_0x3d99;if(!isPendingSegmentId(_0x146eaf))return _0x146eaf;const _0x12259e=extractPendingSegmentName(_0x146eaf),_0x4688e1=_0x5c65a5[_0xa2b45f(0x1f9)](_0x12259e);return!_0x4688e1&&_0x2764c8['logWarning']?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x12259e+_0xa2b45f(0x128)+_0x571557),_0x4688e1;};if(_0x4d5cd4[_0x12fca6(0x188)][_0x12fca6(0x190)]?.[_0x12fca6(0x127)]&&isPendingSegmentId(_0x4d5cd4[_0x12fca6(0x188)][_0x12fca6(0x190)]['segmentId'])){const _0x57d362=_0x543616(_0x4d5cd4['attributes']['goal'][_0x12fca6(0x127)],'goal\x20criteria');_0x57d362&&(_0x4d5cd4[_0x12fca6(0x188)][_0x12fca6(0x190)]['segmentId']=_0x57d362);}for(const _0x22ff4f of _0x4d5cd4[_0x12fca6(0x188)][_0x12fca6(0x206)]||[]){const _0x18bd06=_0x4664d3[_0x12fca6(0x1f9)](_0x22ff4f[_0x12fca6(0x1ae)][_0x12fca6(0x1eb)]());_0x18bd06&&(_0x22ff4f['id']=_0x18bd06);if(_0x22ff4f[_0x12fca6(0x146)]?.[_0x12fca6(0x127)]&&isPendingSegmentId(_0x22ff4f[_0x12fca6(0x146)][_0x12fca6(0x127)])){const _0x22574c=_0x543616(_0x22ff4f['entryCriteria'][_0x12fca6(0x127)],_0x12fca6(0x19d)+_0x22ff4f[_0x12fca6(0x1ae)]+_0x12fca6(0x1a8));_0x22574c&&(_0x22ff4f[_0x12fca6(0x146)][_0x12fca6(0x127)]=_0x22574c);}if(_0x22ff4f['exitCriterias'])for(const _0x356502 of _0x22ff4f[_0x12fca6(0x19f)]){if(_0x356502[_0x12fca6(0x127)]&&isPendingSegmentId(_0x356502[_0x12fca6(0x127)])){const _0x2516b2=_0x543616(_0x356502[_0x12fca6(0x127)],'stage\x20\x27'+_0x22ff4f[_0x12fca6(0x1ae)]+_0x12fca6(0x1de));_0x2516b2&&(_0x356502[_0x12fca6(0x127)]=_0x2516b2);}}if(_0x22ff4f['milestone']?.[_0x12fca6(0x127)]&&isPendingSegmentId(_0x22ff4f[_0x12fca6(0x1e8)][_0x12fca6(0x127)])){const _0x592dc1=_0x543616(_0x22ff4f[_0x12fca6(0x1e8)]['segmentId'],_0x12fca6(0x19d)+_0x22ff4f[_0x12fca6(0x1ae)]+_0x12fca6(0x116));_0x592dc1&&(_0x22ff4f[_0x12fca6(0x1e8)][_0x12fca6(0x127)]=_0x592dc1);}if(_0x22ff4f['steps']){const _0x1ca943=_0x407129=>_0x45d05a[_0x12fca6(0x188)][_0x12fca6(0x206)]?.[_0x12fca6(0x132)](_0x542b0e=>_0x542b0e[_0x12fca6(0x1ae)][_0x12fca6(0x1eb)]()===_0x22ff4f['name'][_0x12fca6(0x1eb)]())?.[_0x12fca6(0x1ea)]?.[_0x407129];for(const _0x1e3bb6 of Object[_0x12fca6(0x169)](_0x22ff4f[_0x12fca6(0x1ea)])){const _0x1455cd=_0x22ff4f[_0x12fca6(0x1ea)][_0x1e3bb6],_0x1e90bb=_0x1ca943(_0x1e3bb6);if(_0x1455cd['type']===_0x12fca6(0x130)&&_0x1455cd['journeyActivationStepId']&&(isPendingActivationId(_0x1455cd[_0x12fca6(0x111)])||_0x1455cd[_0x12fca6(0x111)]==='')){if(_0x1e90bb?.[_0x12fca6(0x111)]&&isPendingActivationId(_0x1e90bb[_0x12fca6(0x111)])){const _0x41a439=extractPendingActivationName(_0x1e90bb['journeyActivationStepId']),_0x319f17=_0x1e7844[_0x12fca6(0x1f9)](_0x41a439);_0x319f17&&(_0x1455cd[_0x12fca6(0x111)]=_0x319f17);}}if(_0x1455cd[_0x12fca6(0x153)]==='DecisionPoint'&&_0x1455cd[_0x12fca6(0x14e)]&&_0x1e90bb?.[_0x12fca6(0x14e)])for(let _0x4a3032=0x0;_0x4a3032<_0x1455cd[_0x12fca6(0x14e)]['length'];_0x4a3032++){const _0x59862d=_0x1455cd[_0x12fca6(0x14e)][_0x4a3032],_0x563242=_0x1e90bb['branches'][_0x4a3032];if(_0x563242?.[_0x12fca6(0x127)]&&isPendingSegmentId(_0x563242[_0x12fca6(0x127)])){const _0x4f999d=_0x543616(_0x563242[_0x12fca6(0x127)],_0x12fca6(0x19d)+_0x22ff4f[_0x12fca6(0x1ae)]+_0x12fca6(0x134)+(_0x59862d['name']||_0x4a3032)+'\x27');_0x4f999d&&(_0x59862d[_0x12fca6(0x127)]=_0x4f999d);}}_0x1455cd[_0x12fca6(0x153)]===_0x12fca6(0x13a)&&_0x1e90bb?.['type']===_0x12fca6(0x13a)&&resolveWaitStepPendingIds(_0x1455cd,_0x1e90bb,_0x543616,_0x22ff4f[_0x12fca6(0x1ae)]);}}}}