@treasuredata/tdx 2026.3.54 → 2026.4.55

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 (254) 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.d.ts.map +1 -1
  9. package/dist/commands/agent-command.js +1 -1
  10. package/dist/commands/agent-command.js.map +1 -1
  11. package/dist/commands/agent-test-command.js +1 -1
  12. package/dist/commands/api-command.js +1 -1
  13. package/dist/commands/auth-command.js +1 -1
  14. package/dist/commands/cas-command.js +1 -1
  15. package/dist/commands/cas-segment-command.js +1 -1
  16. package/dist/commands/chat-command.js +1 -1
  17. package/dist/commands/claude-command.js +1 -1
  18. package/dist/commands/claude-statusline-command.js +1 -1
  19. package/dist/commands/claude-usage-command.js +1 -1
  20. package/dist/commands/command.js +1 -1
  21. package/dist/commands/connection-command.js +1 -1
  22. package/dist/commands/databases.js +1 -1
  23. package/dist/commands/delivery-command.js +1 -1
  24. package/dist/commands/describe.js +1 -1
  25. package/dist/commands/engage-campaign-pull-command.js +1 -1
  26. package/dist/commands/engage-campaign-push-command.js +1 -1
  27. package/dist/commands/engage-campaign-validate-command.js +1 -1
  28. package/dist/commands/engage-command.js +1 -1
  29. package/dist/commands/engage-template-pull-command.js +1 -1
  30. package/dist/commands/engage-template-push-command.js +1 -1
  31. package/dist/commands/engage-template-validate-command.js +1 -1
  32. package/dist/commands/job-command.js +1 -1
  33. package/dist/commands/journey-command.js +1 -1
  34. package/dist/commands/journey-validate-command.js +1 -1
  35. package/dist/commands/llm-command.js +1 -1
  36. package/dist/commands/mcp-command.js +1 -1
  37. package/dist/commands/parent-segment-command.js +1 -1
  38. package/dist/commands/policy-command.js +1 -1
  39. package/dist/commands/profile-command.js +1 -1
  40. package/dist/commands/profiles-command.js +1 -1
  41. package/dist/commands/query-command.js +1 -1
  42. package/dist/commands/schedule-command.js +1 -1
  43. package/dist/commands/segment-command.js +1 -1
  44. package/dist/commands/segment-create-command.js +1 -1
  45. package/dist/commands/segment-fields-command.js +1 -1
  46. package/dist/commands/segment-pull-command.js +1 -1
  47. package/dist/commands/segment-push-command.js +1 -1
  48. package/dist/commands/segment-update-command.js +1 -1
  49. package/dist/commands/segment-use-command.js +1 -1
  50. package/dist/commands/segment-validate-command.js +1 -1
  51. package/dist/commands/segments.js +1 -1
  52. package/dist/commands/show.js +1 -1
  53. package/dist/commands/status-command.js +1 -1
  54. package/dist/commands/tables.js +1 -1
  55. package/dist/commands/unset-command.js +1 -1
  56. package/dist/commands/upgrade-command.js +1 -1
  57. package/dist/commands/use-command.js +1 -1
  58. package/dist/commands/user-command.js +1 -1
  59. package/dist/commands/work-command.js +1 -1
  60. package/dist/commands/workflow-command.d.ts +27 -0
  61. package/dist/commands/workflow-command.d.ts.map +1 -1
  62. package/dist/commands/workflow-command.js +1 -1
  63. package/dist/commands/workflow-command.js.map +1 -1
  64. package/dist/core/auth.js +1 -1
  65. package/dist/core/command-output.js +1 -1
  66. package/dist/core/config.js +1 -1
  67. package/dist/core/connection-cache.js +1 -1
  68. package/dist/core/constants.js +1 -1
  69. package/dist/core/credential-cache.js +1 -1
  70. package/dist/core/global-context.js +1 -1
  71. package/dist/core/keychain.js +1 -1
  72. package/dist/core/oauth-keychain.js +1 -1
  73. package/dist/core/oauth.js +1 -1
  74. package/dist/core/profile.js +1 -1
  75. package/dist/core/project-config.js +1 -1
  76. package/dist/core/session.js +1 -1
  77. package/dist/core/user-cache.js +1 -1
  78. package/dist/core/version.js +1 -1
  79. package/dist/index.js +1 -1
  80. package/dist/mcp/server.js +1 -1
  81. package/dist/mcp/tools/index.js +1 -1
  82. package/dist/mcp/tools/tdx-run.js +1 -1
  83. package/dist/mcp/tools/tdx-search.js +1 -1
  84. package/dist/mcp/tools/work-create-item.js +1 -1
  85. package/dist/mcp/utils.js +1 -1
  86. package/dist/proxy/claude-usage-tracker.js +1 -1
  87. package/dist/proxy/passthrough-server.js +1 -1
  88. package/dist/proxy/sse-usage-parser.js +1 -1
  89. package/dist/sdk/agent/agent-config.d.ts +10 -0
  90. package/dist/sdk/agent/agent-config.d.ts.map +1 -1
  91. package/dist/sdk/agent/agent-config.js +1 -1
  92. package/dist/sdk/agent/agent-config.js.map +1 -1
  93. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  94. package/dist/sdk/agent/agent-yaml.d.ts +61 -3
  95. package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
  96. package/dist/sdk/agent/agent-yaml.js +1 -1
  97. package/dist/sdk/agent/agent-yaml.js.map +1 -1
  98. package/dist/sdk/agent/test/evaluator.js +1 -1
  99. package/dist/sdk/agent/test/executor.js +1 -1
  100. package/dist/sdk/agent/test/index.js +1 -1
  101. package/dist/sdk/agent/test/output.js +1 -1
  102. package/dist/sdk/agent/test/parser.js +1 -1
  103. package/dist/sdk/agent/tool-target-registry.js +1 -1
  104. package/dist/sdk/agent/types/agent-def.d.ts +43 -0
  105. package/dist/sdk/agent/types/agent-def.d.ts.map +1 -1
  106. package/dist/sdk/api.js +1 -1
  107. package/dist/sdk/cas/cas-api-client.js +1 -1
  108. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  109. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  110. package/dist/sdk/cas/index.js +1 -1
  111. package/dist/sdk/cas/pull-workflow.js +1 -1
  112. package/dist/sdk/cas/push-workflow.js +1 -1
  113. package/dist/sdk/client/cdp-api-client.js +1 -1
  114. package/dist/sdk/client/delivery-api-client.js +1 -1
  115. package/dist/sdk/client/endpoints.js +1 -1
  116. package/dist/sdk/client/engage-api-client.js +1 -1
  117. package/dist/sdk/client/http-client.js +1 -1
  118. package/dist/sdk/client/llm-api-client.d.ts +73 -1
  119. package/dist/sdk/client/llm-api-client.d.ts.map +1 -1
  120. package/dist/sdk/client/llm-api-client.js +1 -1
  121. package/dist/sdk/client/llm-api-client.js.map +1 -1
  122. package/dist/sdk/client/oauth-refresh.js +1 -1
  123. package/dist/sdk/client/rate-limiter.js +1 -1
  124. package/dist/sdk/client/td-api-client.js +1 -1
  125. package/dist/sdk/client/trino-api-client.js +1 -1
  126. package/dist/sdk/client/workflow-client.d.ts +28 -1
  127. package/dist/sdk/client/workflow-client.d.ts.map +1 -1
  128. package/dist/sdk/client/workflow-client.js +1 -1
  129. package/dist/sdk/client/workflow-client.js.map +1 -1
  130. package/dist/sdk/connection-validator.js +1 -1
  131. package/dist/sdk/connection.js +1 -1
  132. package/dist/sdk/delivery.js +1 -1
  133. package/dist/sdk/engage/campaign-pull.js +1 -1
  134. package/dist/sdk/engage/campaign-push.js +1 -1
  135. package/dist/sdk/engage/campaign-validator.js +1 -1
  136. package/dist/sdk/engage/campaign-yaml.js +1 -1
  137. package/dist/sdk/engage/template-pull.js +1 -1
  138. package/dist/sdk/engage/template-push.js +1 -1
  139. package/dist/sdk/engage/template-validator.js +1 -1
  140. package/dist/sdk/engage/template-yaml.js +1 -1
  141. package/dist/sdk/engage/types/campaign-def.js +1 -1
  142. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  143. package/dist/sdk/engage/types/template-schema.js +1 -1
  144. package/dist/sdk/engage.js +1 -1
  145. package/dist/sdk/errors.js +1 -1
  146. package/dist/sdk/index.js +1 -1
  147. package/dist/sdk/io/index.js +1 -1
  148. package/dist/sdk/io/node-filesystem.js +1 -1
  149. package/dist/sdk/job.js +1 -1
  150. package/dist/sdk/journey.js +1 -1
  151. package/dist/sdk/llm/chat-cache.js +1 -1
  152. package/dist/sdk/llm/index.d.ts.map +1 -1
  153. package/dist/sdk/llm/index.js +1 -1
  154. package/dist/sdk/llm/index.js.map +1 -1
  155. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  156. package/dist/sdk/llm/model-factors.js +1 -1
  157. package/dist/sdk/personalization.js +1 -1
  158. package/dist/sdk/policy.js +1 -1
  159. package/dist/sdk/query/index.js +1 -1
  160. package/dist/sdk/query/sql-parser.js +1 -1
  161. package/dist/sdk/realtime.js +1 -1
  162. package/dist/sdk/schedule.js +1 -1
  163. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  164. package/dist/sdk/segment/fields-display.js +1 -1
  165. package/dist/sdk/segment/file-discovery.js +1 -1
  166. package/dist/sdk/segment/journey-utils.js +1 -1
  167. package/dist/sdk/segment/journey-validator.js +1 -1
  168. package/dist/sdk/segment/journey-yaml.js +1 -1
  169. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  170. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  171. package/dist/sdk/segment/pull-workflow.js +1 -1
  172. package/dist/sdk/segment/push-recovery.js +1 -1
  173. package/dist/sdk/segment/push-workflow.js +1 -1
  174. package/dist/sdk/segment/resolution-context.js +1 -1
  175. package/dist/sdk/segment/segment-path-parser.js +1 -1
  176. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  177. package/dist/sdk/segment/segment-validator.js +1 -1
  178. package/dist/sdk/segment/target-resolution.js +1 -1
  179. package/dist/sdk/segment/tdx-config.js +1 -1
  180. package/dist/sdk/segment/types/activation-schema.js +1 -1
  181. package/dist/sdk/segment/types/journey-def.js +1 -1
  182. package/dist/sdk/segment/types/journey-schema.js +1 -1
  183. package/dist/sdk/segment/types/segment-def.js +1 -1
  184. package/dist/sdk/segment/types/segment-schema.js +1 -1
  185. package/dist/sdk/segment/validate-files.js +1 -1
  186. package/dist/sdk/segment/yaml-validator.js +1 -1
  187. package/dist/sdk/segment.js +1 -1
  188. package/dist/sdk/types/index.d.ts +2 -2
  189. package/dist/sdk/types/index.d.ts.map +1 -1
  190. package/dist/sdk/types/index.js +1 -1
  191. package/dist/sdk/types/index.js.map +1 -1
  192. package/dist/sdk/types/llm.d.ts +158 -0
  193. package/dist/sdk/types/llm.d.ts.map +1 -1
  194. package/dist/sdk/types/progress.js +1 -1
  195. package/dist/sdk/types/workflow.d.ts +26 -0
  196. package/dist/sdk/types/workflow.d.ts.map +1 -1
  197. package/dist/sdk/types/workspace.js +1 -1
  198. package/dist/sdk/user.js +1 -1
  199. package/dist/sdk/util/format-detector.js +1 -1
  200. package/dist/sdk/util/formatters.js +1 -1
  201. package/dist/sdk/util/index.js +1 -1
  202. package/dist/sdk/util/paginate.js +1 -1
  203. package/dist/sdk/util/tree-formatter.js +1 -1
  204. package/dist/sdk/workflow/archive-validation.js +1 -1
  205. package/dist/sdk/workflow/clone-workflow.js +1 -1
  206. package/dist/sdk/workflow/index.d.ts +22 -0
  207. package/dist/sdk/workflow/index.d.ts.map +1 -1
  208. package/dist/sdk/workflow/index.js +1 -1
  209. package/dist/sdk/workflow/index.js.map +1 -1
  210. package/dist/sdk/workflow/pull-workflow.js +1 -1
  211. package/dist/sdk/workflow/push-workflow.js +1 -1
  212. package/dist/sdk/workflow/tdx-config.js +1 -1
  213. package/dist/sdk/workflow/workflow-utils.js +1 -1
  214. package/dist/sdk/workspace/frontmatter.js +1 -1
  215. package/dist/sdk/workspace/git.js +1 -1
  216. package/dist/sdk/workspace/index.js +1 -1
  217. package/dist/sdk/workspace/templates.js +1 -1
  218. package/dist/sdk/workspace/weekly.js +1 -1
  219. package/dist/sdk/workspace/wikilinks.js +1 -1
  220. package/dist/test-utils/command-runner.js +1 -1
  221. package/dist/test-utils/factories.js +1 -1
  222. package/dist/test-utils/fixtures.js +1 -1
  223. package/dist/test-utils/http-mock.js +1 -1
  224. package/dist/test-utils/index.js +1 -1
  225. package/dist/utils/async.js +1 -1
  226. package/dist/utils/colors.js +1 -1
  227. package/dist/utils/diff.js +1 -1
  228. package/dist/utils/file-permissions.js +1 -1
  229. package/dist/utils/file-reader.js +1 -1
  230. package/dist/utils/github-releases.js +1 -1
  231. package/dist/utils/global-cache.js +1 -1
  232. package/dist/utils/json-loader.js +1 -1
  233. package/dist/utils/local-cache.js +1 -1
  234. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  235. package/dist/utils/logger/formatters/index.js +1 -1
  236. package/dist/utils/logger/handlers/console-handler.js +1 -1
  237. package/dist/utils/logger/handlers/file-handler.js +1 -1
  238. package/dist/utils/logger/handlers/index.js +1 -1
  239. package/dist/utils/logger/handlers/null-handler.js +1 -1
  240. package/dist/utils/logger/index.js +1 -1
  241. package/dist/utils/logger/logger.js +1 -1
  242. package/dist/utils/logger/types.js +1 -1
  243. package/dist/utils/option-validation.js +1 -1
  244. package/dist/utils/process.d.ts.map +1 -1
  245. package/dist/utils/process.js +1 -1
  246. package/dist/utils/process.js.map +1 -1
  247. package/dist/utils/prompt.js +1 -1
  248. package/dist/utils/spinner.js +1 -1
  249. package/dist/utils/sse-parser.js +1 -1
  250. package/dist/utils/string-utils.js +1 -1
  251. package/dist/utils/table-ref-parser.js +1 -1
  252. package/dist/utils/tdx-logger.js +1 -1
  253. package/dist/utils/version-check.js +1 -1
  254. package/package.json +2 -2
@@ -1 +1 @@
1
- const a152_0x18f4ba=a152_0x3e6f;(function(_0x5cff17,_0x2bf05a){const _0x218dfd=a152_0x3e6f,_0x4b7240=_0x5cff17();while(!![]){try{const _0x530de1=parseInt(_0x218dfd(0xdd))/0x1*(-parseInt(_0x218dfd(0x156))/0x2)+parseInt(_0x218dfd(0x175))/0x3*(-parseInt(_0x218dfd(0x162))/0x4)+-parseInt(_0x218dfd(0x108))/0x5*(-parseInt(_0x218dfd(0xf9))/0x6)+parseInt(_0x218dfd(0x161))/0x7+parseInt(_0x218dfd(0x14c))/0x8+parseInt(_0x218dfd(0x17f))/0x9*(parseInt(_0x218dfd(0xf8))/0xa)+parseInt(_0x218dfd(0x165))/0xb*(-parseInt(_0x218dfd(0x116))/0xc);if(_0x530de1===_0x2bf05a)break;else _0x4b7240['push'](_0x4b7240['shift']());}catch(_0x3e5eae){_0x4b7240['push'](_0x4b7240['shift']());}}}(a152_0x43f1,0xcf7be));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x18f4ba(0xa4));export const PENDING_SEGMENT_PREFIX=a152_0x18f4ba(0x112);export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0x1f8175){return''+PENDING_SEGMENT_PREFIX+_0x1f8175+'__';}export function isPendingSegmentId(_0x20edb4){const _0x312ed4=a152_0x18f4ba;return _0x20edb4[_0x312ed4(0xe4)](PENDING_SEGMENT_PREFIX)&&!_0x20edb4[_0x312ed4(0xe4)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x2f1ebe){return _0x2f1ebe['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0xb16872){return''+PENDING_ACTIVATION_PREFIX+_0xb16872+'__';}export function isPendingActivationId(_0x29923e){return _0x29923e['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x19ce92){const _0x2e0d0b=a152_0x18f4ba;return _0x19ce92[_0x2e0d0b(0x17d)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0xbc6c9a,_0x2ba0ef){const _0x3a7140=a152_0x18f4ba,_0x10c76d=_0xbc6c9a+'::'+(_0x2ba0ef[_0x3a7140(0x138)]()||_0x3a7140(0x184)),_0x5e5c70=createHash(_0x3a7140(0xcb))['update'](_0x10c76d)[_0x3a7140(0x105)](_0x3a7140(0xfb))[_0x3a7140(0x120)](0x0,0xc);return'journey_entry_criteria_'+_0x5e5c70;}export function ensureJourneyDefaults(_0x26c91e){const _0x257b27=a152_0x18f4ba;!_0x26c91e[_0x257b27(0x129)]&&(_0x26c91e[_0x257b27(0x129)]=''),!_0x26c91e[_0x257b27(0xee)]&&(_0x26c91e[_0x257b27(0xee)]=_0x257b27(0x186));}export function injectExistingStageIds(_0xa1024a,_0x5f0c73){const _0x2a598a=a152_0x18f4ba,_0x236887=new Map(_0x5f0c73[_0x2a598a(0x19f)](_0x481948=>[_0x481948[_0x2a598a(0x166)],_0x481948['id']]));for(const _0x291c94 of _0xa1024a){if(!_0x291c94['id']){const _0x453722=_0x236887[_0x2a598a(0x19d)](_0x291c94[_0x2a598a(0x166)]);_0x453722&&(_0x291c94['id']=_0x453722);}}}export function resolveTDFolderPath(_0x279dff,_0x1e5016,_0x47a0dc){const _0x8098b9=a152_0x18f4ba;if(!_0x1e5016)return _0x279dff;if(_0x279dff===_0x47a0dc||_0x279dff[_0x8098b9(0xe4)](_0x47a0dc+'/'))return _0x279dff;return _0x279dff?_0x47a0dc+'/'+_0x279dff:_0x47a0dc;}export function addFoldersToCreate(_0x20ee70,_0x55d8a5,_0x596d38){const _0xff38af=a152_0x18f4ba;if(!_0x20ee70)return;if(_0x55d8a5['has'](_0x20ee70))return;const _0x2531ab=_0x20ee70[_0xff38af(0x141)]('/');let _0x285dcf='';for(const _0x47f115 of _0x2531ab){_0x285dcf=_0x285dcf?_0x285dcf+'/'+_0x47f115:_0x47f115,!_0x55d8a5[_0xff38af(0x1a4)](_0x285dcf)&&_0x596d38[_0xff38af(0x106)](_0x285dcf);}}export function sortFoldersByDepth(_0x55264d){const _0x122226=a152_0x18f4ba;return[..._0x55264d][_0x122226(0x137)]((_0x14eb3a,_0x3019ff)=>{const _0x36e300=_0x122226,_0x5762f2=(_0x14eb3a[_0x36e300(0xb2)](/\//g)||[])[_0x36e300(0x17e)],_0x45d073=(_0x3019ff[_0x36e300(0xb2)](/\//g)||[])['length'];return _0x5762f2-_0x45d073;});}import*as a152_0x3adb27 from'yaml';import{readFileSync}from'fs';import a152_0x19fc04 from'path';import{isJourneyDef,parseYamlString as a152_0x45d0de,toYamlString as a152_0xe132d5,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(_0x133066){const _0x616d71=a152_0x18f4ba;if(Array[_0x616d71(0x100)](_0x133066))return'['+_0x133066['map'](_0x2e7e5e=>stableStringify(_0x2e7e5e))[_0x616d71(0x19e)](',')+']';if(_0x133066&&typeof _0x133066===_0x616d71(0xd0)){const _0x3f7900=_0x133066,_0x2a2dd8=Object[_0x616d71(0x10e)](_0x3f7900)[_0x616d71(0x137)](),_0xc7fe8=_0x2a2dd8[_0x616d71(0x19f)](_0x152505=>'\x22'+_0x152505+'\x22:'+stableStringify(_0x3f7900[_0x152505]));return'{'+_0xc7fe8[_0x616d71(0x19e)](',')+'}';}const _0x4e8974=JSON[_0x616d71(0x11d)](_0x133066);return _0x4e8974===undefined?'null':_0x4e8974;}function activationSignature(_0x459506){const _0x2b5bc0=a152_0x18f4ba,_0x2a847a={'connection':_0x459506[_0x2b5bc0(0x164)],..._0x459506[_0x2b5bc0(0x143)]!==undefined&&{'all_columns':_0x459506[_0x2b5bc0(0x143)]},..._0x459506[_0x2b5bc0(0x169)]!==undefined&&{'columns':_0x459506[_0x2b5bc0(0x169)]},..._0x459506[_0x2b5bc0(0x144)]!==undefined&&{'behavior':_0x459506[_0x2b5bc0(0x144)]},..._0x459506['schedule']!==undefined&&{'schedule':_0x459506['schedule']},..._0x459506['notification']!==undefined&&{'notification':_0x459506[_0x2b5bc0(0x1a0)]},..._0x459506[_0x2b5bc0(0x191)]!==undefined&&{'connector_config':_0x459506[_0x2b5bc0(0x191)]},..._0x459506[_0x2b5bc0(0xbc)]!==undefined&&{'activation_template_id':_0x459506[_0x2b5bc0(0xbc)]}};return stableStringify(_0x2a847a);}async function fetchSegment(_0x2deccf,_0x52bce0,_0x1c89f1,_0x21e519){const _0x12ebbe=a152_0x18f4ba,_0x3e59f0=_0x21e519?.['find'](_0x3db5c8=>_0x3db5c8['id']===_0x1c89f1);if(_0x3e59f0)return _0x3e59f0;try{return await _0x2deccf[_0x12ebbe(0x184)][_0x12ebbe(0x148)](_0x52bce0,_0x1c89f1);}catch(_0x59865c){logger[_0x12ebbe(0xed)](_0x12ebbe(0xa8)+_0x1c89f1+',\x20falling\x20back\x20to\x20getSegmentEntity:\x20'+_0x59865c);try{return await _0x2deccf[_0x12ebbe(0x184)]['getSegmentEntity'](_0x1c89f1);}catch(_0xe0f781){return logger[_0x12ebbe(0xed)]('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x1c89f1+':\x20'+_0xe0f781),null;}}}function recoverSegmentIdsFromPushRecovery(_0x196bc5,_0x277cd2,_0x53c7ee){const _0x20ccf8=a152_0x18f4ba,_0x17a94c=readPushRecovery(_0x196bc5[_0x20ccf8(0x111)]);if(_0x17a94c?.[_0x20ccf8(0x170)]===_0x196bc5[_0x20ccf8(0xf1)][_0x20ccf8(0x166)])for(const [_0x302991,_0x37aec8]of Object['entries'](_0x17a94c[_0x20ccf8(0x19a)])){const _0x508880=generateDeterministicJourneySegmentName(_0x196bc5['yamlConfig']['name'],_0x302991);_0x37aec8[_0x20ccf8(0x149)]===_0x508880&&(_0x277cd2[_0x20ccf8(0x174)](_0x302991,_0x37aec8[_0x20ccf8(0xef)]),_0x53c7ee[_0x20ccf8(0x174)](_0x302991,_0x37aec8[_0x20ccf8(0xef)]));}}async function createOrRecoverEmbeddedSegment(_0x552802,_0x52948c,_0x4c9803,_0x1f204b){const _0x2135c3=a152_0x18f4ba;let _0xff040d;try{_0xff040d=await _0x552802['segment'][_0x2135c3(0xf6)]({'name':_0x4c9803[_0x2135c3(0x128)],'description':_0x4c9803[_0x2135c3(0x129)],'journeyId':_0x4c9803[_0x2135c3(0x15b)],'rule':_0x1f204b(_0x4c9803[_0x2135c3(0x1b6)],!![]),'countPopulation':!![],'parentFolderId':_0x4c9803[_0x2135c3(0x10c)],'audienceId':_0x4c9803[_0x2135c3(0x19c)]});}catch(_0x4bf207){const _0x366ac3=_0x4bf207 instanceof Error&&_0x4bf207[_0x2135c3(0xe3)][_0x2135c3(0x180)](_0x2135c3(0x19b));if(_0x366ac3){const _0x4a8fdd=readPushRecovery(_0x52948c[_0x2135c3(0x111)]),_0x3aad4f=_0x4a8fdd?.[_0x2135c3(0x170)]===_0x52948c[_0x2135c3(0xf1)][_0x2135c3(0x166)]?_0x4a8fdd[_0x2135c3(0x19a)][_0x4c9803[_0x2135c3(0x157)]]:undefined;if(_0x3aad4f?.[_0x2135c3(0x149)]===_0x4c9803['uniqueSegmentName'])await _0x552802[_0x2135c3(0x184)][_0x2135c3(0xcf)](_0x4c9803[_0x2135c3(0x19c)],_0x3aad4f[_0x2135c3(0xef)],{'description':_0x4c9803[_0x2135c3(0x129)],'rule':_0x1f204b(_0x4c9803[_0x2135c3(0x1b6)],!![]),'countPopulation':!![]}),_0xff040d=_0x3aad4f[_0x2135c3(0xef)];else throw new SDKError(ErrorCode[_0x2135c3(0x1b1)],_0x2135c3(0x173)+_0x4c9803[_0x2135c3(0x157)]+_0x2135c3(0x11c)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x52948c[_0x2135c3(0x111)][_0x2135c3(0x17d)](/([^/]+)$/,_0x2135c3(0x1b3))+')\x20')+_0x2135c3(0x145),_0x4bf207);}else throw _0x4bf207;}return saveSegmentToPushRecovery(_0x52948c['absolutePath'],_0x52948c[_0x2135c3(0xf1)][_0x2135c3(0x166)],_0x4c9803[_0x2135c3(0x157)],{'segmentId':_0xff040d,'uniqueServerName':_0x4c9803[_0x2135c3(0x128)],'createdAt':new Date()[_0x2135c3(0x171)]()}),_0xff040d;}function a152_0x3e6f(_0x15d590,_0xc05da){_0x15d590=_0x15d590-0xa4;const _0x43f148=a152_0x43f1();let _0x3e6f1f=_0x43f148[_0x15d590];return _0x3e6f1f;}export async function prepareSegmentFiles(_0x4849bc,_0x1b6375,_0x168ac4,_0x27db9f,_0x414b2f){const _0x32ee6a=a152_0x18f4ba,{activationDefToCreateRequest:_0x4075a3}=await import(_0x32ee6a(0xc3)),_0x4d03bc=[],_0x1c6ec2=new Set();for(const {yamlConfig:_0x4c33de,folderPath:_0x295e5e,sourcePath:_0x2272f2}of _0x4849bc){const _0x50e252=resolveTDFolderPath(_0x295e5e,_0x27db9f,_0x414b2f),_0x31a2f7=_0x50e252+':'+_0x4c33de[_0x32ee6a(0x166)],_0x4a1b62=_0x1b6375[_0x32ee6a(0x172)][_0x32ee6a(0x19d)](_0x31a2f7),_0x1edae9=_0x4a1b62?_0x1b6375[_0x32ee6a(0x12c)][_0x32ee6a(0x19d)](_0x4a1b62['id'])||[]:[];addFoldersToCreate(_0x50e252,_0x1b6375['folderPathToId'],_0x1c6ec2);const _0x2e97b8=calculateActivationActions(_0x4c33de[_0x32ee6a(0x189)]||[],_0x1edae9,_0x1b6375['idToEmailMap'],_0x1b6375[_0x32ee6a(0xdb)]);for(const _0x41dbd1 of _0x2e97b8){(_0x41dbd1['type']===_0x32ee6a(0xe5)||_0x41dbd1['type']===_0x32ee6a(0x12e))&&_0x41dbd1[_0x32ee6a(0x14a)]&&(_0x41dbd1['validatedRequest']=await _0x4075a3(_0x41dbd1[_0x32ee6a(0x14a)],_0x168ac4));}const _0x36111d=calculateSegmentDiff(_0x4c33de,_0x4a1b62,_0x1edae9,_0x1b6375[_0x32ee6a(0x1aa)],_0x1b6375['connectionIdToNameMap']);_0x4d03bc[_0x32ee6a(0xb8)]({'relativePath':_0x4c33de['name'],'absolutePath':_0x2272f2,'yamlConfig':_0x4c33de,'folderPath':_0x50e252,'existingSegment':_0x4a1b62,'existingActivations':_0x1edae9,'isNew':_0x36111d[_0x32ee6a(0x181)],'hasChanges':_0x36111d['hasChanges'],'diff':_0x36111d[_0x32ee6a(0x179)],'activationActions':_0x2e97b8});}return{'segmentFiles':_0x4d03bc,'foldersToCreate':_0x1c6ec2};}export async function prepareJourneyFiles(_0x4df113,_0x48aa6a,_0x5307f3,_0x20a531){const _0x2b8b12=a152_0x18f4ba,_0x148530=[],_0x536101=new Set();for(const {yamlConfig:_0x245f3a,folderPath:_0x1cdcf3,sourcePath:_0x48ae45}of _0x4df113){const _0x42cbbd=resolveTDFolderPath(_0x1cdcf3,_0x5307f3,_0x20a531),_0x553d11=_0x42cbbd+':'+_0x245f3a['name'],_0x4bde91=_0x48aa6a['journeyBundlesByFolderAndName']['get'](_0x553d11);let _0x309c68,_0x169c47;if(_0x4bde91&&_0x4bde91[_0x2b8b12(0x17e)]>0x0){const _0x37616c=buildLocalExpandedRuleMappings(_0x245f3a),{createYamlContext:_0x1a5943,prefetchJourneySegments:_0x408c07}=createPushYamlContextForBundle(_0x48aa6a[_0x2b8b12(0x154)],_0x48aa6a[_0x2b8b12(0x19c)],_0x48aa6a[_0x2b8b12(0xf5)],_0x37616c,_0x48aa6a['idToEmailMap'],_0x48aa6a[_0x2b8b12(0xdb)],_0x48aa6a[_0x2b8b12(0x14e)],_0x48aa6a['journeyById']);await _0x408c07(_0x4bde91[_0x2b8b12(0x19f)](_0xcd0270=>_0xcd0270['id']));const _0x26c026=await _0x48aa6a[_0x2b8b12(0x154)][_0x2b8b12(0x1a2)][_0x2b8b12(0x14b)](_0x4bde91[0x0][_0x2b8b12(0xd7)]),_0xb75997=hasMultipleVersions(_0x245f3a),_0x8b0fb5=async _0x226a9a=>{const _0x50c410=_0x2b8b12,_0x50ac3f=_0x48aa6a[_0x50c410(0xe6)]?.['get'](_0x226a9a);if(_0x50ac3f)return _0x50ac3f;return _0x48aa6a[_0x50c410(0xd9)]({'journeyId':_0x226a9a,'journeyName':_0x245f3a[_0x50c410(0x166)],'isMultiVersion':_0x4bde91[_0x50c410(0x17e)]>0x1});};if(_0xb75997&&_0x4bde91['length']>0x1){const _0x74bc33=[];for(const _0x1f3a85 of _0x4bde91){const _0xccb567=_0x1f3a85[_0x2b8b12(0xca)]||0x1;_0x48aa6a[_0x2b8b12(0xa5)]?.['update'](_0x2b8b12(0x198)+_0x245f3a[_0x2b8b12(0x166)]+'\x20v'+_0xccb567);const _0x32f462=await _0x8b0fb5(_0x1f3a85['id']),_0x40d780=_0x1a5943(_0x1f3a85['id']),_0xd0655=await journeyResponseToDef(_0x32f462,_0x40d780);_0x74bc33[_0x2b8b12(0xb8)]({'item':_0x1f3a85,'yaml':_0xd0655});}const _0x11d3ed=buildLocalRuleToNameMappingFromJourney(_0x245f3a);_0x169c47=buildMergedJourneyDef(_0x74bc33,_0x11d3ed,_0x26c026);const _0x1786fe=Math['max'](..._0x74bc33[_0x2b8b12(0x19f)](_0x202c58=>_0x202c58[_0x2b8b12(0xa6)][_0x2b8b12(0xca)]||0x0)),_0x497e38=_0x4bde91[_0x2b8b12(0x10b)](_0x1161c2=>(_0x1161c2['versionNumber']||0x0)===_0x1786fe);_0x497e38&&(_0x48aa6a[_0x2b8b12(0xa5)]?.[_0x2b8b12(0x12e)](_0x2b8b12(0x198)+_0x245f3a[_0x2b8b12(0x166)]+'\x20v'+_0x1786fe),_0x309c68=await _0x8b0fb5(_0x497e38['id']));}else{const _0xac9bcb=_0x4bde91[_0x4bde91['length']-0x1];_0x48aa6a[_0x2b8b12(0xa5)]?.[_0x2b8b12(0x12e)](_0x2b8b12(0x198)+_0x245f3a['name']),_0x309c68=await _0x8b0fb5(_0xac9bcb['id']);const _0x766feb=_0x1a5943(_0xac9bcb['id']),_0x273104=await journeyResponseToDef(_0x309c68,_0x766feb),_0x3ee144=buildLocalRuleToNameMappingFromJourney(_0x245f3a);_0x169c47=buildMergedJourneyDef([{'item':_0xac9bcb,'yaml':_0x273104}],_0x3ee144,_0x26c026);}}addFoldersToCreate(_0x42cbbd,_0x48aa6a[_0x2b8b12(0x130)],_0x536101);const _0x515f33=calculateJourneyDiff(_0x245f3a,_0x169c47);_0x148530['push']({'relativePath':_0x245f3a['name'],'absolutePath':_0x48ae45,'yamlConfig':_0x245f3a,'folderPath':_0x42cbbd,'existingJourney':_0x309c68,'isNew':_0x515f33[_0x2b8b12(0x181)],'hasChanges':_0x515f33[_0x2b8b12(0xeb)],'diff':_0x515f33[_0x2b8b12(0x179)]});}return{'journeyFiles':_0x148530,'foldersToCreate':_0x536101};}export function calculateActivationActions(_0x16ae4a,_0x298780,_0x50d9da,_0x49b2f6){const _0x33eb2c=a152_0x18f4ba,_0x1bcf4b=[],_0x136719=new Map();for(const _0x4c69a8 of _0x298780){_0x136719[_0x33eb2c(0x174)](_0x4c69a8[_0x33eb2c(0x166)],_0x4c69a8);}const _0x456a10=new Map();for(const _0x36a04a of _0x16ae4a){_0x456a10['set'](_0x36a04a[_0x33eb2c(0x166)],_0x36a04a);}for(const _0x119882 of _0x16ae4a){const _0x4811bc=_0x136719[_0x33eb2c(0x19d)](_0x119882[_0x33eb2c(0x166)]);if(!_0x4811bc)_0x1bcf4b[_0x33eb2c(0xb8)]({'type':'create','name':_0x119882['name'],'yamlActivation':_0x119882});else{const _0x54cc78=activationResponseToDef(_0x4811bc,_0x50d9da,_0x49b2f6),_0x117328=a152_0x3adb27['stringify'](_0x54cc78),_0x58773c=a152_0x3adb27[_0x33eb2c(0x11d)](_0x119882);_0x117328!==_0x58773c&&_0x1bcf4b[_0x33eb2c(0xb8)]({'type':_0x33eb2c(0x12e),'name':_0x119882[_0x33eb2c(0x166)],'yamlActivation':_0x119882,'existingActivation':_0x4811bc});}}for(const _0x533960 of _0x298780){!_0x456a10[_0x33eb2c(0x1a4)](_0x533960[_0x33eb2c(0x166)])&&_0x1bcf4b[_0x33eb2c(0xb8)]({'type':_0x33eb2c(0x196),'name':_0x533960[_0x33eb2c(0x166)],'existingActivation':_0x533960});}return _0x1bcf4b;}function calculateYamlDiff(_0x384922,_0x194557){if(_0x194557){const _0x4badc9=generateDiff(_0x194557,_0x384922),_0x22b05c=hasChanges(_0x4badc9);return{'isNew':![],'hasChanges':_0x22b05c,'diff':_0x22b05c?formatDiffWithColors(_0x4badc9):undefined};}const _0x12cc96=generateDiff('',_0x384922);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x12cc96)};}export function calculateSegmentDiff(_0x2ddc3a,_0x5747f5,_0x164103,_0x10326e,_0x58e6e4){const _0x4e2eb1=segmentToYamlString(_0x2ddc3a),_0x3192b7=_0x5747f5?segmentToYamlString(segmentWithActivationsToYaml(_0x5747f5,_0x164103,undefined,_0x10326e,_0x58e6e4)):undefined;return calculateYamlDiff(_0x4e2eb1,_0x3192b7);}export function calculateJourneyDiff(_0x13e972,_0x1bbe0d){const _0x16bdb3=normalizeJourneyDef(_0x13e972,_0x13e972),_0xd29895=a152_0xe132d5(_0x16bdb3),_0x844174=_0x1bbe0d?a152_0xe132d5(normalizeJourneyDef(_0x1bbe0d,_0x13e972)):undefined;return calculateYamlDiff(_0xd29895,_0x844174);}export function findSegmentsToDelete(_0x40df90,_0xcadfb1,_0x4dc2cc,_0x3ebb46,_0x552ac6){const _0x19b9fc=a152_0x18f4ba,_0x2ec6b3=new Set();for(const {yamlConfig:_0x5ce754,folderPath:_0x4e0e7c}of _0xcadfb1){_0x2ec6b3[_0x19b9fc(0x106)](_0x4e0e7c+':'+_0x5ce754[_0x19b9fc(0x166)]);}return _0x40df90['filter'](_0xda6ad2=>{const _0x497d1a=_0x19b9fc,_0x587663=_0xda6ad2['segmentFolderId']?_0x4dc2cc[_0x497d1a(0x19d)](_0xda6ad2[_0x497d1a(0xa9)][_0x497d1a(0x1ab)]())||'':'',_0x2d9657=_0x587663+':'+_0xda6ad2[_0x497d1a(0x166)];if(_0x2ec6b3[_0x497d1a(0x1a4)](_0x2d9657))return![];if(_0x552ac6)return _0x587663===_0x3ebb46||_0x587663[_0x497d1a(0xe4)](_0x3ebb46+'/');return!![];});}export function findJourneysToDelete(_0x1e237c,_0x39836c,_0x1c1610,_0x1a6b2b,_0x52387d){const _0xa6a485=a152_0x18f4ba,_0x4217a1=new Set();for(const {yamlConfig:_0xe4281c,folderPath:_0xde3342}of _0x39836c){_0x4217a1['add'](_0xde3342+':'+_0xe4281c['name']);}return _0x1e237c[_0xa6a485(0x121)](_0x2312d4=>{const _0x3ffe6f=_0xa6a485,_0x351616=_0x2312d4[_0x3ffe6f(0x10c)]?_0x1c1610['get'](_0x2312d4[_0x3ffe6f(0x10c)])||'':'',_0x2d63be=_0x351616+':'+_0x2312d4[_0x3ffe6f(0x194)];if(_0x4217a1['has'](_0x2d63be))return![];if(_0x52387d)return _0x351616===_0x1a6b2b||_0x351616['startsWith'](_0x1a6b2b+'/');return!![];});}export function buildSegmentLookupMap(_0x22301c,_0x3e6f34){const _0x39e168=a152_0x18f4ba,_0x69b928=new Map();for(const _0x25faab of _0x22301c){const _0x44b1d9=_0x25faab[_0x39e168(0xa9)]?_0x3e6f34[_0x39e168(0x19d)](_0x25faab['segmentFolderId'][_0x39e168(0x1ab)]())||'':'',_0x2b92cf=_0x44b1d9+':'+_0x25faab[_0x39e168(0x166)];_0x69b928[_0x39e168(0x174)](_0x2b92cf,_0x25faab);}return _0x69b928;}export function buildSegmentNameToIdMap(_0x235012){const _0x441828=a152_0x18f4ba,_0x204a0e=new Map();for(const _0x85755a of _0x235012){_0x204a0e[_0x441828(0x174)](_0x85755a[_0x441828(0x166)],_0x85755a['id']);}return _0x204a0e;}export function buildJourneyBundleLookupMap(_0x56d392,_0x38364e){const _0x564c8f=a152_0x18f4ba,_0x138f1e=new Map();for(const _0x28aa71 of _0x56d392){const _0x1ddef7=_0x28aa71[_0x564c8f(0x10c)]?_0x38364e[_0x564c8f(0x19d)](_0x28aa71[_0x564c8f(0x10c)])||'':'',_0x32ae4b=_0x1ddef7+':'+_0x28aa71[_0x564c8f(0x194)];!_0x138f1e['has'](_0x32ae4b)&&_0x138f1e[_0x564c8f(0x174)](_0x32ae4b,[]),_0x138f1e[_0x564c8f(0x19d)](_0x32ae4b)[_0x564c8f(0xb8)](_0x28aa71);}for(const _0x12cdeb of _0x138f1e[_0x564c8f(0x11a)]()){_0x12cdeb[_0x564c8f(0x137)]((_0x21a6d3,_0x2f659d)=>(_0x21a6d3[_0x564c8f(0xca)]||0x0)-(_0x2f659d[_0x564c8f(0xca)]||0x0));}return _0x138f1e;}export function collectFoldersToCreate(_0x7e9624,_0x2bfaf9){const _0x5d5fb5=a152_0x18f4ba,_0x37f6df=new Set();for(const _0x49ac4d of _0x7e9624){if(!_0x49ac4d)continue;if(_0x2bfaf9['has'](_0x49ac4d))continue;const _0x5319c0=_0x49ac4d['split']('/');let _0x293e04='';for(const _0x268020 of _0x5319c0){_0x293e04=_0x293e04?_0x293e04+'/'+_0x268020:_0x268020,!_0x2bfaf9[_0x5d5fb5(0x1a4)](_0x293e04)&&_0x37f6df[_0x5d5fb5(0x106)](_0x293e04);}}return _0x37f6df;}function a152_0x43f1(){const _0xa33b57=['\x27\x20decision\x20point\x20branch\x20\x27','message','startsWith','create','journeyById','validatedRequest','JOURNEY_UPDATE_ERROR','Updated\x20activation\x20\x27','resolveSegment','hasChanges','activation_deleted','debug','state','segmentId','\x20(referenced\x20in\x20journey\x20','yamlConfig','nameToType','attributes','\x27\x20milestone','existingSegments','createJourneySegment','idToName','1269460zCrvYU','3225996xGFHDT','Activation\x20not\x20found:\x20','hex','\x27\x20exit\x20criteria','createSegment','Entry\x20criteria:\x20','embedded_activation_creating','isArray','with','existingSegment','journey_created','existingActivation','digest','add','\x27...','10npOnzX','verbose','Deleted\x20segment\x20\x27','find','folderId','Segment\x20not\x20found','keys','DecisionPoint','activation_deleting','absolutePath','__pending_','relationships','errors','embedded_segment_creating','6708804wJvmry','onProgress','Updating\x20segment\x20\x27','\x27\x20from\x20file:\x20','values','exitCriterias','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','stringify','conditionSegmentId','SEGMENT_NOT_FOUND','slice','filter','rootFolderId','withProgress','Created\x20folder\x20\x27','journeys','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','Deleting\x20activation\x20\x27','uniqueSegmentName','description','\x27\x20to\x20local\x20\x27','deleteSegment','activationsBySegmentId','logSuccess','update','size','folderPathToId','\x0a\x20\x20','Created\x20segment\x20\x27','segment_created','index','Updating\x20activation\x20\x27','entry_criteria','sort','trim','parse','Creating\x20activation\x20\x27','kind','goal','steps','embeddedSegmentNameToId','activation_created','utf-8','split','max','all_columns','behavior','and\x20the\x20server\x20segment,\x20then\x20retry.','type','stages','getSegment','uniqueServerName','yamlActivation','getLatestJourneyId','6456048etjdqz','reduce','activationStepsById','waitStep','segment_creating','rule','effectiveFolderId','Creating\x20segment\x20\x27','deps','conditions','2796402MJyQsH','localName','waitStepType','deleted','Deleted\x20activation\x20\x27','journeyId','valid','toLowerCase','Activation','NOT_FOUND','getActivation','1700202UMHWaN','4GkHLkO','Updated\x20journey\x20\x27','connection','22WqLuDh','name','createdSegmentId','folder','columns','entry','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','activation_','resolveJourneyId','Failed\x20to\x20resolve\x20activation\x20','segmentNameToId','journeyName','toISOString','segmentByFolderAndName','Embedded\x20segment\x20\x27','set','1227999HctDpq','getJourney','milestone','activation_creating','diff','Failed\x20to\x20fetch\x20referenced\x20segment\x20','parentSegmentFolder','\x27\x20by\x20rule\x20content','replace','length','117ZeGutM','includes','isNew','INTERNAL','createdSegmentIds','segment',').\x20','draft','Condition','logWarning','activations','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','\x20activation\x20\x27','createActivation','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','entries','listActivations','created','connector_config','conditionTimeoutDuration','conditionTimeoutUnit','journeyBundleName','parseDocument','delete','logDeleted','Fetching\x20','segment_updating','segments','Name\x20has\x20already\x20been\x20taken','parentId','get','join','map','notification','ACTIVATION_UPDATE_ERROR','journey','all','has','../../utils/async.js','from','\x27\x20entry\x20criteria','Created\x20journey\x20\x27','waitStepUnit','idToEmailMap','toString','Matched\x20server\x20segment\x20\x27','Failed\x20to\x20','action','branches','flatMap','SEGMENT_UPDATE_ERROR','updated','.$1.push-recovery.json','segment_updated','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','resolvedRule','tdx.sdk.push-workflow','progress','item','JOURNEY_SYNTAX_ERROR','getSegment\x20failed\x20for\x20','segmentFolderId','journey_creating','some','folderPath','journeyActivationNameToId','decision_point','Creating\x20folder\x20\x27','run_after_journey_refresh','unchanged','match','existingJourney','\x20error(s)','\x20journey\x20from\x20file:\x20','journeyActivationStepId','day','push','journeyStages','list','WaitStep','activation_template_id','Stage\x20\x27','data','Segment\x20not\x20found:\x20','activationParams','\x27\x20wait\x20condition','deleteActivation','./child-segment-yaml.js','Created\x20activation\x20\x27','buildUserMaps','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','createFolder','folder_creating','segment_deleted','versionNumber','sha1','embedded_segment_created','./journey-yaml.js','activationActions','updateSegmentById','object','embedded_activation_created','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','\x20segment\x20from\x20file:\x20','Failed\x20to\x20resolve\x20segment\x20','parentFolder','dirname','journeyBundleId','activation_updating','fetchJourney','stage\x20\x27','connectionIdToNameMap','):\x20','1pVQVkf','entryCriteria','logInfo','journey_updated','journey_updating'];a152_0x43f1=function(){return _0xa33b57;};return a152_0x43f1();}export function parseAndClassifyYamlFiles(_0x19de8e,_0x4c9b43,_0x1dd799){const _0xf4016f=a152_0x18f4ba,_0x48a851=[],_0x24a774=[];for(const _0x5b9f29 of _0x19de8e){const _0x1b757c=a152_0x19fc04['relative'](_0x4c9b43,a152_0x19fc04[_0xf4016f(0xd6)](_0x5b9f29)),_0x5af87d=_0x1b757c==='.'?'':_0x1b757c,_0x69de31=readFileSync(_0x5b9f29,_0xf4016f(0x140)),_0x539683=a152_0x3adb27[_0xf4016f(0x139)](_0x69de31);if(isJourneyDef(_0x539683)){const _0x2862d4=a152_0x45d0de(_0x69de31);_0x24a774[_0xf4016f(0xb8)]({'yamlConfig':_0x2862d4,'folderPath':_0x5af87d,'sourcePath':_0x5b9f29});}else{if(!_0x1dd799?.['skipSegments']){const _0x2daafa=parseSegmentYamlFile(_0x69de31),_0x3d2fa9=normalizeChildSegmentYaml(_0x2daafa);_0x48a851['push']({'yamlConfig':_0x3d2fa9,'folderPath':_0x5af87d,'sourcePath':_0x5b9f29});}}}return{'segments':_0x48a851,'journeys':_0x24a774};}export function validateParsedFiles(_0x4d6788,_0xc717b6){const _0x5deb31=a152_0x18f4ba,_0xf3264a=[];for(const {yamlConfig:_0x24dbf8,sourcePath:_0x217ae7}of _0x4d6788[_0x5deb31(0x19a)]){const _0x585de1=readFileSync(_0x217ae7,_0x5deb31(0x140)),_0x9f6cfd=a152_0x3adb27[_0x5deb31(0x195)](_0x585de1),_0x40ba36=validateSegmentDef(_0x24dbf8,{'source':_0x585de1,'document':_0x9f6cfd},{'skipSchema':!![]});if(!_0x40ba36[_0x5deb31(0x15c)]){const _0x39e357=a152_0x19fc04['relative'](_0xc717b6,_0x217ae7);_0xf3264a[_0x5deb31(0xb8)]({'filePath':_0x39e357,'source':_0x585de1,'result':_0x40ba36,'isJourney':![]});}}for(const {yamlConfig:_0x320004,sourcePath:_0x2f5689}of _0x4d6788[_0x5deb31(0x125)]){const _0x2fb581=readFileSync(_0x2f5689,_0x5deb31(0x140)),_0x267203=a152_0x3adb27['parseDocument'](_0x2fb581),_0xa76f3=validateJourneyDef(_0x320004,{'source':_0x2fb581,'document':_0x267203},{'skipSchema':!![]});if(!_0xa76f3[_0x5deb31(0x15c)]){const _0x54d90b=a152_0x19fc04['relative'](_0xc717b6,_0x2f5689);_0xf3264a[_0x5deb31(0xb8)]({'filePath':_0x54d90b,'source':_0x2fb581,'result':_0xa76f3,'isJourney':!![]});}}return _0xf3264a;}export function formatValidationErrors(_0x22e06b){const _0x26589e=a152_0x18f4ba,_0x29198f=[];for(const {filePath:_0x560dd6,source:_0x2ed903,result:_0x36cc2c,isJourney:_0x5cce2f}of _0x22e06b){const _0xaad821=_0x5cce2f?_0x26589e(0x1a2):_0x26589e(0x184);_0x29198f['push']('\x0a'+_0x560dd6+'\x20('+_0xaad821+_0x26589e(0xdc)+_0x36cc2c[_0x26589e(0x114)]['length']+_0x26589e(0xb4)),_0x29198f[_0x26589e(0xb8)](formatValidationResult(_0x36cc2c,_0x2ed903,_0x560dd6));}return _0x29198f[_0x26589e(0x19e)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x51db77){const _0x51c4a3=a152_0x18f4ba,_0x149234=new Set(),_0x2f63a8=new Map(),_0x54719a=collectSegmentUsageCounts(_0x51db77);if(_0x51db77[_0x51c4a3(0x19a)])for(const [_0x21c041,_0x2f0b2b]of Object[_0x51c4a3(0x18e)](_0x51db77[_0x51c4a3(0x19a)])){_0x149234[_0x51c4a3(0x106)](_0x21c041);if(_0x2f0b2b['rule']){const _0x52c076=yamlRuleToApi(_0x2f0b2b[_0x51c4a3(0x151)]),_0x59aa3c=apiRuleToYaml(_0x52c076);_0x2f63a8['set'](_0x21c041,_0x59aa3c);}}const _0x118d72=new Map();let _0x8b2c9d=0x0;for(const [_0x5c0eb2,_0x2fc555]of _0x2f63a8){const _0x1d682c=serializeExpandedRule(_0x2fc555,_0x2f63a8),_0xe4abd3=_0x118d72['get'](_0x1d682c)||[];_0xe4abd3['push']({'name':_0x5c0eb2,'index':_0x8b2c9d}),_0x118d72[_0x51c4a3(0x174)](_0x1d682c,_0xe4abd3),_0x8b2c9d++;}const _0x4f72ab=new Map();for(const [_0x15b3bd,_0x2a73c3]of _0x118d72){const _0x51740c=_0x2a73c3[_0x51c4a3(0x120)]()['sort']((_0x15292e,_0x55f7d8)=>{const _0x1cc224=_0x51c4a3,_0x2b310e=_0x54719a['get'](_0x15292e[_0x1cc224(0x166)])||0x0,_0x1c897b=_0x54719a[_0x1cc224(0x19d)](_0x55f7d8[_0x1cc224(0x166)])||0x0;if(_0x2b310e!==_0x1c897b)return _0x1c897b-_0x2b310e;return _0x15292e[_0x1cc224(0x134)]-_0x55f7d8[_0x1cc224(0x134)];})[_0x51c4a3(0x19f)](_0x331553=>_0x331553[_0x51c4a3(0x166)]),_0x4824ed=[];for(const _0x155ff9 of _0x51740c){const _0x51a147=_0x54719a['get'](_0x155ff9)||0x0,_0x224868=Math[_0x51c4a3(0x142)](_0x51a147,0x1);for(let _0x29262a=0x0;_0x29262a<_0x224868;_0x29262a++){_0x4824ed[_0x51c4a3(0xb8)](_0x155ff9);}}_0x4f72ab[_0x51c4a3(0x174)](_0x15b3bd,_0x4824ed);}return{'existingLocalSegmentNames':_0x149234,'localSegmentRules':_0x2f63a8,'localExpandedRuleToNames':_0x4f72ab};}export function createSegmentIdResolver(_0x4a49eb,_0xbc427c){return async _0x18cc6a=>{const _0xd7611f=a152_0x3e6f,_0x4a62ca=_0x4a49eb[_0xd7611f(0x19d)](_0x18cc6a);if(!_0x4a62ca)throw new SDKError(ErrorCode[_0xd7611f(0x11f)],'Segment\x20not\x20found:\x20'+_0x18cc6a+_0xd7611f(0x1b5)+_0xbc427c+'\x27)');return _0x4a62ca;};}export function extractRootFolderId(_0x396007){const _0x1aec13=a152_0x18f4ba;return _0x396007[_0x1aec13(0x113)]?.[_0x1aec13(0x17b)]?.[_0x1aec13(0xbe)]?.['id']||_0x396007['relationships']?.[_0x1aec13(0xd5)]?.['data']?.['id'];}export function buildConnectionMaps(_0x60ae06){const _0x847bca=a152_0x18f4ba,_0x4206ff=new Map(),_0x539a68=new Map(),_0x59296b=new Map();for(const _0x340880 of _0x60ae06){_0x4206ff['set'](_0x340880[_0x847bca(0x166)],parseInt(_0x340880['id'],0xa)),_0x539a68[_0x847bca(0x174)](_0x340880['id'],_0x340880[_0x847bca(0x166)]),_0x59296b[_0x847bca(0x174)](_0x340880[_0x847bca(0x166)],_0x340880[_0x847bca(0x146)]);}return{'nameToId':_0x4206ff,'idToName':_0x539a68,'nameToType':_0x59296b};}export function calculatePushStats(_0x22e9a6,_0x521466,_0x3100e2,_0x54c56d,_0x3e9b76,_0x3ad581,_0x2b5081){const _0x5b0dd9=a152_0x18f4ba,_0x1dc284=_0x22e9a6[_0x5b0dd9(0x121)](_0x4f430d=>_0x4f430d[_0x5b0dd9(0x181)]),_0x3f3c6c=_0x22e9a6['filter'](_0x5b7fb1=>!_0x5b7fb1[_0x5b0dd9(0x181)]&&_0x5b7fb1[_0x5b0dd9(0xeb)]),_0x5d53dd=_0x22e9a6[_0x5b0dd9(0x121)](_0x76f1ad=>!_0x76f1ad[_0x5b0dd9(0x181)]&&!_0x76f1ad[_0x5b0dd9(0xeb)]),_0x189398=_0x3ad581?_0x54c56d:[],_0x1b3861=_0x521466[_0x5b0dd9(0x121)](_0x4e5410=>_0x4e5410[_0x5b0dd9(0x181)]),_0xfa4080=_0x521466[_0x5b0dd9(0x121)](_0x328dbb=>!_0x328dbb[_0x5b0dd9(0x181)]&&_0x328dbb[_0x5b0dd9(0xeb)]),_0xae7495=_0x521466['filter'](_0x391535=>!_0x391535[_0x5b0dd9(0x181)]&&!_0x391535['hasChanges']),_0x8bc84b=_0x3ad581?_0x3e9b76:[],_0x137d8d=_0x22e9a6[_0x5b0dd9(0x1b0)](_0x16beaa=>_0x16beaa['activationActions']),_0x2aebe4=_0x137d8d[_0x5b0dd9(0x121)](_0x19f94e=>_0x19f94e[_0x5b0dd9(0x146)]===_0x5b0dd9(0xe5)),_0x3d94f6=_0x137d8d[_0x5b0dd9(0x121)](_0x3a80fb=>_0x3a80fb[_0x5b0dd9(0x146)]===_0x5b0dd9(0x12e)),_0x471814=_0x137d8d[_0x5b0dd9(0x121)](_0x5506e2=>_0x5506e2[_0x5b0dd9(0x146)]==='delete'),_0x43367a=Array['from'](_0x3100e2)[_0x5b0dd9(0x137)](),_0x68f144=_0x2b5081?![]:_0x1dc284[_0x5b0dd9(0x17e)]>0x0||_0x3f3c6c[_0x5b0dd9(0x17e)]>0x0||_0x189398['length']>0x0,_0x1b012a=_0x1b3861[_0x5b0dd9(0x17e)]>0x0||_0xfa4080['length']>0x0||_0x8bc84b[_0x5b0dd9(0x17e)]>0x0,_0x32742d=_0x2b5081?![]:_0x137d8d['length']>0x0,_0x4e17dc=_0x43367a['length']>0x0;return{'segments':{'new':_0x1dc284,'changed':_0x3f3c6c,'unchanged':_0x5d53dd,'toDelete':_0x189398},'journeys':{'new':_0x1b3861,'changed':_0xfa4080,'unchanged':_0xae7495,'toDelete':_0x8bc84b},'activations':{'all':_0x137d8d,'toCreate':_0x2aebe4,'toUpdate':_0x3d94f6,'toDelete':_0x471814},'folders':{'toCreate':_0x43367a},'counts':{'segments':{'new':_0x1dc284[_0x5b0dd9(0x17e)],'changed':_0x3f3c6c['length'],'unchanged':_0x5d53dd[_0x5b0dd9(0x17e)],'toDelete':_0x189398[_0x5b0dd9(0x17e)]},'journeys':{'new':_0x1b3861[_0x5b0dd9(0x17e)],'changed':_0xfa4080[_0x5b0dd9(0x17e)],'unchanged':_0xae7495['length'],'toDelete':_0x8bc84b[_0x5b0dd9(0x17e)]},'activations':{'create':_0x2aebe4[_0x5b0dd9(0x17e)],'update':_0x3d94f6[_0x5b0dd9(0x17e)],'delete':_0x471814[_0x5b0dd9(0x17e)]},'folders':_0x43367a['length']},'hasChanges':_0x68f144||_0x1b012a||_0x32742d||_0x4e17dc};}export async function buildPushExecutionContext(_0x3c1fe9,_0x5e1f5f,_0x5752fa,_0xddb0e0,_0x4d82e1,_0x522d29){const _0x1c1bc9=a152_0x18f4ba,_0x20cb8d=extractRootFolderId(_0x5752fa),{pathToId:_0x5c3d14,idToPath:_0x263fe4}=buildFolderMaps(_0x4d82e1),_0x3ab951=buildSegmentNameToIdMap(_0xddb0e0),_0x1c788e=new Map(),{batchAsync:_0x11eaad}=await import(_0x1c1bc9(0x1a5)),[_0x17e5de,_0x2f5dd0]=await Promise[_0x1c1bc9(0x1a3)]([_0x3c1fe9['user'][_0x1c1bc9(0xc5)](),_0x3c1fe9[_0x1c1bc9(0x164)][_0x1c1bc9(0xba)](),((async()=>{const _0x442403=_0x1c1bc9;!_0x522d29&&_0xddb0e0[_0x442403(0x17e)]>0x0&&await _0x11eaad(_0xddb0e0,async _0x33914a=>{const _0x2e41d3=_0x442403,_0x4bb910=await _0x3c1fe9[_0x2e41d3(0x184)][_0x2e41d3(0x18f)](_0x5e1f5f,_0x33914a['id']);_0x1c788e[_0x2e41d3(0x174)](_0x33914a['id'],_0x4bb910);});})())]),{emailToId:_0x2b06af,idToEmail:_0x202a32}=_0x17e5de,_0x10a1ae=buildConnectionMaps(_0x2f5dd0);return{'rootFolderId':_0x20cb8d,'folderPathToId':_0x5c3d14,'folderIdToPath':_0x263fe4,'segmentNameToId':_0x3ab951,'activationsBySegmentId':_0x1c788e,'emailToIdMap':_0x2b06af,'idToEmailMap':_0x202a32,'connectionNameToIdMap':_0x10a1ae['nameToId'],'connectionIdToNameMap':_0x10a1ae[_0x1c1bc9(0xf7)],'connectionNameToTypeMap':_0x10a1ae[_0x1c1bc9(0xf2)]};}export function createPushYamlContextForBundle(_0x2fed62,_0x1a1c0e,_0x5d4912,_0x3fb091,_0x59ccf4,_0x192dab,_0x3b4a33,_0x755c94){const {existingLocalSegmentNames:_0x59609a,localExpandedRuleToNames:_0x114e6d}=_0x3fb091,_0x462557=new Set(),_0x5e51f3=new Map(),_0x379301=new Map(),_0x349683=new Map(),_0x164f54=createJumpTargetCache(),_0x376075=new Map(),_0x358036=new Map(),_0x13f335=new Set();let _0x470e92;const _0x57b8d4=_0x29582e=>{const _0x12ecf9={'resolveSegment':async _0x5acff3=>{const _0x3e7423=a152_0x3e6f,_0x1b6234=_0x349683[_0x3e7423(0x19d)](_0x5acff3);if(_0x1b6234!==undefined)return{'name':_0x1b6234,'isJourneyLocal':!![]};try{const _0x1fe2b0=await fetchSegment(_0x2fed62,_0x1a1c0e,_0x5acff3,_0x5d4912);if(!_0x1fe2b0)throw new Error(_0x3e7423(0x10d));const _0x1ecd1e=generateJourneyLocalName(_0x1fe2b0[_0x3e7423(0x166)]),_0x3d20b7=_0x1fe2b0[_0x3e7423(0x13b)]===SEGMENT_KIND_JOURNEY&&_0x1ecd1e!==undefined;let _0x1644ce=_0x1fe2b0[_0x3e7423(0x166)],_0x506ebc;if(_0x3d20b7&&_0x1fe2b0[_0x3e7423(0x151)]){const _0xcf5d8=apiRuleToYaml(_0x1fe2b0[_0x3e7423(0x151)]);_0x358036[_0x3e7423(0x174)](_0x5acff3,_0xcf5d8);const _0x553f2d=async _0x4b086a=>{const _0x5c81da=_0x3e7423,_0x103a0f=collectSegmentRefsFromRule(_0x4b086a);for(const _0x4c3496 of _0x103a0f){if(!_0x358036['has'](_0x4c3496))try{const _0x130590=await fetchSegment(_0x2fed62,_0x1a1c0e,_0x4c3496,_0x5d4912);if(_0x130590?.['rule']){const _0x4f360b=apiRuleToYaml(_0x130590['rule']);_0x358036[_0x5c81da(0x174)](_0x4c3496,_0x4f360b),await _0x553f2d(_0x4f360b);}}catch(_0x367f05){logger[_0x5c81da(0xed)](_0x5c81da(0x17a)+_0x4c3496+':\x20'+_0x367f05);}}};await _0x553f2d(_0xcf5d8);const _0x27d9fe=serializeExpandedRule(_0xcf5d8,_0x358036),_0x21a31d=_0x114e6d[_0x3e7423(0x19d)](_0x27d9fe);if(_0x21a31d&&_0x21a31d['length']>0x0){const _0x109c1a=_0x5e51f3[_0x3e7423(0x19d)](_0x27d9fe)||0x0,_0x36c951=_0x21a31d[_0x109c1a]||_0x21a31d[_0x21a31d[_0x3e7423(0x17e)]-0x1];_0x5e51f3[_0x3e7423(0x174)](_0x27d9fe,_0x109c1a+0x1),_0x1644ce=_0x36c951,_0x462557[_0x3e7423(0x106)](_0x1644ce),_0x349683[_0x3e7423(0x174)](_0x5acff3,_0x1644ce);const _0x2e6d52=await resolveRuleSegmentRefs(_0xcf5d8,async _0x530511=>{const _0x1e0f8c=_0x3e7423,_0x4f778c=_0x349683[_0x1e0f8c(0x19d)](_0x530511);if(_0x4f778c)return _0x4f778c;const _0x45f9fb=await _0x470e92[_0x1e0f8c(0xea)](_0x530511);return _0x45f9fb[_0x1e0f8c(0x166)];});_0x506ebc={'description':_0x1fe2b0['description'],'rule':_0x2e6d52};}else{const _0x7ec601=_0x376075[_0x3e7423(0x19d)](_0x27d9fe);if(_0x7ec601)_0x1644ce=_0x7ec601,_0x349683[_0x3e7423(0x174)](_0x5acff3,_0x1644ce);else{if(_0x1ecd1e){let _0x1be89a=_0x1ecd1e,_0x454e3d=0x2;while(_0x462557[_0x3e7423(0x1a4)](_0x1be89a)||_0x59609a[_0x3e7423(0x1a4)](_0x1be89a)){_0x1be89a=_0x1ecd1e+'_'+_0x454e3d,_0x454e3d++;}_0x462557['add'](_0x1be89a),_0x1644ce=_0x1be89a;}_0x349683[_0x3e7423(0x174)](_0x5acff3,_0x1644ce),_0x376075[_0x3e7423(0x174)](_0x27d9fe,_0x1644ce);const _0x20011a=await resolveRuleSegmentRefs(_0xcf5d8,async _0x24b86d=>{const _0x28b31d=_0x3e7423,_0x56f31d=_0x349683[_0x28b31d(0x19d)](_0x24b86d);if(_0x56f31d)return _0x56f31d;const _0x6058e4=await _0x470e92['resolveSegment'](_0x24b86d);return _0x6058e4[_0x28b31d(0x166)];});_0x506ebc={'description':_0x1fe2b0['description'],'rule':_0x20011a};}}}return{'name':_0x1644ce,'isJourneyLocal':_0x3d20b7,'definition':_0x506ebc};}catch(_0x6066f9){return logger['debug'](_0x3e7423(0xd4)+_0x5acff3+':\x20'+_0x6066f9),{'name':_0x5acff3,'isJourneyLocal':![]};}},'resolveActivation':async _0xf07c2=>{const _0x5298ac=a152_0x3e6f,_0x239d3e=_0x379301[_0x5298ac(0x19d)](_0xf07c2);if(_0x239d3e!==undefined)return{'name':_0x239d3e,'isJourneyLocal':!![]};try{let _0x1f232d=_0x3b4a33?.[_0x5298ac(0x19d)](_0xf07c2);!_0x1f232d&&(_0x1f232d=await _0x2fed62[_0x5298ac(0x1a2)][_0x5298ac(0x160)](_0x29582e,_0xf07c2));const _0x31ae26=_0x1f232d[_0x5298ac(0xf3)][_0x5298ac(0xc0)]['name']||_0xf07c2,_0x5a7fbc=sanitizeYamlKey(_0x31ae26)||_0x5298ac(0x16c)+_0xf07c2,_0x5bcca5=_0x5a7fbc;_0x379301[_0x5298ac(0x174)](_0xf07c2,_0x5bcca5);const _0x32d937=journeyActivationStepToYaml(_0x1f232d,_0x59ccf4,_0x192dab);return{'name':_0x5bcca5,'isJourneyLocal':!![],'definition':_0x32d937};}catch(_0x1c0511){return logger[_0x5298ac(0xed)](_0x5298ac(0x16e)+_0xf07c2+':\x20'+_0x1c0511),{'name':_0xf07c2,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0xc787a6,_0x32f862)=>resolveJumpTarget(_0xc787a6,_0x32f862,_0x164f54,async _0x1445b8=>{const _0x4887a3=a152_0x3e6f,_0x52fe03=_0x755c94?.[_0x4887a3(0x19d)](_0x1445b8);if(_0x52fe03)return _0x52fe03;return _0x2fed62[_0x4887a3(0x1a2)][_0x4887a3(0x176)](_0x1445b8);})};return _0x470e92=_0x12ecf9,_0x12ecf9;},_0x35af1e=async _0x513ee8=>{const _0x146b8d=a152_0x3e6f,{collectSegmentIdsFromJourneyApi:_0x37b276}=await import('./journey-yaml.js'),{batchAsync:_0x1fcf6d}=await import(_0x146b8d(0x1a5)),_0x1efdf5=new Set();for(const _0xbc2eb3 of _0x513ee8){let _0x39ba16=_0x755c94?.[_0x146b8d(0x19d)](_0xbc2eb3);!_0x39ba16&&(_0x39ba16=await _0x2fed62[_0x146b8d(0x1a2)][_0x146b8d(0x176)](_0xbc2eb3));const _0x52811b=_0x37b276(_0x39ba16);for(const _0x1ec817 of _0x52811b){_0x1efdf5[_0x146b8d(0x106)](_0x1ec817);}}let _0x289b25=Array[_0x146b8d(0x1a6)](_0x1efdf5);while(_0x289b25[_0x146b8d(0x17e)]>0x0){const _0x28b865=_0x289b25[_0x146b8d(0x121)](_0x41dd9b=>!_0x13f335['has'](_0x41dd9b));if(_0x28b865[_0x146b8d(0x17e)]===0x0)break;const _0x2eb17b=await _0x1fcf6d(_0x28b865,async _0x5b57ff=>{const _0x266233=_0x146b8d;_0x13f335[_0x266233(0x106)](_0x5b57ff);const _0x1130b3=await fetchSegment(_0x2fed62,_0x1a1c0e,_0x5b57ff,_0x5d4912);if(!_0x1130b3)return null;return{'segmentId':_0x5b57ff,'segment':_0x1130b3};},0xa),_0x52f6a5=new Set();for(const _0x378e3d of _0x2eb17b){if(!_0x378e3d?.[_0x146b8d(0x184)]?.[_0x146b8d(0x151)])continue;const _0x521325=apiRuleToYaml(_0x378e3d['segment'][_0x146b8d(0x151)]);_0x358036[_0x146b8d(0x174)](_0x378e3d[_0x146b8d(0xef)],_0x521325);const _0x13fa3e=collectSegmentRefsFromRule(_0x521325);for(const _0x431439 of _0x13fa3e){!_0x13f335[_0x146b8d(0x1a4)](_0x431439)&&_0x52f6a5[_0x146b8d(0x106)](_0x431439);}}_0x289b25=Array[_0x146b8d(0x1a6)](_0x52f6a5);}};return{'createYamlContext':_0x57b8d4,'prefetchJourneySegments':_0x35af1e};}export async function executePushSegments(_0x3fd853,_0x29cf52,_0x1edc01,_0x4ce9c9,_0xff2889){const _0x5a49dd=a152_0x18f4ba,{segmentDefToCreateRequest:_0x5d7ed6,segmentDefToUpdateRequest:_0x12e777}=await import(_0x5a49dd(0xc3)),_0x1856b0=_0x1edc01[_0x5a49dd(0x130)],_0x26aa84=0x5,_0x58d4e3=async _0x221e08=>{const _0x3dca04=_0x5a49dd,_0x525f37=_0x221e08[_0x3dca04(0xac)]?_0x1856b0[_0x3dca04(0x19d)](_0x221e08['folderPath']):undefined;let _0x5aa066;const _0xb0a0a2={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x50d992=_0x221e08[_0x3dca04(0xf1)];if(_0x221e08[_0x3dca04(0xf1)]['rule']){const _0x5f0940=createSegmentIdResolver(_0x1edc01['segmentNameToId'],_0x221e08[_0x3dca04(0xf1)][_0x3dca04(0x166)]),_0x17309e=await resolveRuleSegmentIds(_0x221e08[_0x3dca04(0xf1)][_0x3dca04(0x151)],_0x5f0940);_0x50d992={..._0x221e08['yamlConfig'],'rule':_0x17309e};}try{if(_0x221e08[_0x3dca04(0x181)]){_0xff2889[_0x3dca04(0x117)]?.({'type':_0x3dca04(0x150),'name':_0x221e08[_0x3dca04(0xf1)][_0x3dca04(0x166)]});const _0x3325fe=_0x5d7ed6(_0x50d992,_0x525f37),_0x377566=await _0xff2889[_0x3dca04(0x123)](_0x3dca04(0x153)+_0x221e08[_0x3dca04(0xf1)]['name']+_0x3dca04(0x107),()=>_0x3fd853['segment'][_0x3dca04(0xfd)](_0x4ce9c9[_0x3dca04(0x19c)],_0x3325fe));_0x5aa066=_0x377566[_0x3dca04(0xbe)]['id'],_0x1edc01[_0x3dca04(0x16f)][_0x3dca04(0x174)](_0x221e08[_0x3dca04(0xf1)]['name'],_0x5aa066),_0xb0a0a2[_0x3dca04(0x167)]={'name':_0x221e08['yamlConfig'][_0x3dca04(0x166)],'id':_0x5aa066},_0xff2889['onProgress']?.({'type':_0x3dca04(0x133),'name':_0x221e08[_0x3dca04(0xf1)]['name'],'segmentId':_0x5aa066}),_0xff2889[_0x3dca04(0x12d)]?.(_0x3dca04(0x132)+_0x221e08['yamlConfig'][_0x3dca04(0x166)]+'\x27'),_0xb0a0a2[_0x3dca04(0x190)]=0x1;}else{if(_0x221e08['hasChanges']){_0xff2889[_0x3dca04(0x117)]?.({'type':_0x3dca04(0x199),'name':_0x221e08[_0x3dca04(0xf1)][_0x3dca04(0x166)]});const _0x4d8c6b=_0x12e777(_0x50d992);_0x525f37!==_0x221e08['existingSegment']?.[_0x3dca04(0xa9)]&&(_0x4d8c6b[_0x3dca04(0xa9)]=_0x525f37?parseInt(_0x525f37,0xa):undefined),await _0xff2889['withProgress'](_0x3dca04(0x118)+_0x221e08[_0x3dca04(0xf1)][_0x3dca04(0x166)]+'\x27...',()=>_0x3fd853['segment'][_0x3dca04(0xcf)](_0x4ce9c9[_0x3dca04(0x19c)],_0x221e08[_0x3dca04(0x102)]['id'],_0x4d8c6b)),_0x5aa066=_0x221e08[_0x3dca04(0x102)]['id'],_0xff2889[_0x3dca04(0x117)]?.({'type':_0x3dca04(0x1b4),'name':_0x221e08[_0x3dca04(0xf1)][_0x3dca04(0x166)]}),_0xff2889['logSuccess']?.('Updated\x20segment\x20\x27'+_0x221e08[_0x3dca04(0xf1)][_0x3dca04(0x166)]+'\x27'),_0xb0a0a2['updated']=0x1;}else _0x5aa066=_0x221e08['existingSegment']['id'];}}catch(_0x50dbed){const _0x2ed613=isHttp400Error(_0x50dbed),_0x2c8e0f=_0x2ed613?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode[_0x3dca04(0x1b1)],_0x45fd5a=getErrorMessage(_0x50dbed);throw new SDKError(_0x2c8e0f,_0x3dca04(0x1ad)+(_0x221e08[_0x3dca04(0x181)]?'create':_0x3dca04(0x12e))+_0x3dca04(0xd3)+_0x221e08[_0x3dca04(0x111)]+_0x3dca04(0x131)+_0x45fd5a,_0x50dbed);}try{const _0x5bd02a=await syncActivationsForSegment(_0x3fd853,_0x4ce9c9[_0x3dca04(0x19c)],_0x5aa066,_0x221e08['yamlConfig'][_0x3dca04(0x166)],_0x221e08[_0x3dca04(0xce)],_0xff2889,_0x221e08[_0x3dca04(0x111)]);_0xb0a0a2['activations']=_0x5bd02a;}catch(_0x178cef){if(_0x178cef instanceof SDKError)throw _0x178cef;throw new SDKError(ErrorCode[_0x3dca04(0x1a1)],_0x3dca04(0x126)+_0x221e08[_0x3dca04(0xf1)]['name']+_0x3dca04(0x119)+_0x221e08[_0x3dca04(0x111)]+'\x0a\x20\x20'+getErrorMessage(_0x178cef),_0x178cef);}return _0xb0a0a2;},_0x9d30bc=await batchAsync(_0x29cf52,_0x58d4e3,_0x26aa84),_0x210dd9={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x1fc5b4 of _0x9d30bc){_0x210dd9['created']+=_0x1fc5b4[_0x5a49dd(0x190)],_0x210dd9[_0x5a49dd(0x1b2)]+=_0x1fc5b4[_0x5a49dd(0x1b2)],_0x1fc5b4['createdSegmentId']&&_0x210dd9[_0x5a49dd(0x183)][_0x5a49dd(0x174)](_0x1fc5b4['createdSegmentId'][_0x5a49dd(0x166)],_0x1fc5b4[_0x5a49dd(0x167)]['id']),_0x210dd9[_0x5a49dd(0x189)]['created']+=_0x1fc5b4['activations'][_0x5a49dd(0x190)],_0x210dd9[_0x5a49dd(0x189)]['updated']+=_0x1fc5b4['activations'][_0x5a49dd(0x1b2)],_0x210dd9[_0x5a49dd(0x189)][_0x5a49dd(0x159)]+=_0x1fc5b4[_0x5a49dd(0x189)]['deleted'];}return _0x210dd9;}async function syncActivationsForSegment(_0x3aae2a,_0x5d54db,_0x48e8bc,_0x216c63,_0x308f8e,_0x285a5d,_0x59c2f0){const _0x1aac62=a152_0x18f4ba,_0x51cdae={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x5c9837 of _0x308f8e){try{if(_0x5c9837['type']==='create'&&_0x5c9837[_0x1aac62(0xe7)])_0x285a5d['onProgress']?.({'type':_0x1aac62(0x178),'segmentName':_0x216c63,'activationName':_0x5c9837[_0x1aac62(0x166)]}),await _0x285a5d[_0x1aac62(0x123)](_0x1aac62(0x13a)+_0x5c9837[_0x1aac62(0x166)]+_0x1aac62(0x107),()=>_0x3aae2a[_0x1aac62(0x184)][_0x1aac62(0x18c)](_0x5d54db,_0x48e8bc,_0x5c9837[_0x1aac62(0xe7)])),_0x285a5d['onProgress']?.({'type':_0x1aac62(0x13f),'segmentName':_0x216c63,'activationName':_0x5c9837[_0x1aac62(0x166)]}),_0x285a5d['logSuccess']?.(_0x1aac62(0xc4)+_0x5c9837['name']+'\x27'),_0x51cdae['created']++;else{if(_0x5c9837[_0x1aac62(0x146)]===_0x1aac62(0x12e)&&_0x5c9837[_0x1aac62(0xe7)]&&_0x5c9837[_0x1aac62(0x104)])_0x285a5d[_0x1aac62(0x117)]?.({'type':_0x1aac62(0xd8),'segmentName':_0x216c63,'activationName':_0x5c9837[_0x1aac62(0x166)]}),await _0x285a5d['withProgress'](_0x1aac62(0x135)+_0x5c9837[_0x1aac62(0x166)]+_0x1aac62(0x107),()=>_0x3aae2a['segment']['updateActivation'](_0x5d54db,_0x48e8bc,_0x5c9837['existingActivation']['id'],_0x5c9837[_0x1aac62(0xe7)])),_0x285a5d[_0x1aac62(0x117)]?.({'type':'activation_updated','segmentName':_0x216c63,'activationName':_0x5c9837[_0x1aac62(0x166)]}),_0x285a5d[_0x1aac62(0x12d)]?.(_0x1aac62(0xe9)+_0x5c9837[_0x1aac62(0x166)]+'\x27'),_0x51cdae[_0x1aac62(0x1b2)]++;else _0x5c9837[_0x1aac62(0x146)]===_0x1aac62(0x196)&&_0x5c9837[_0x1aac62(0x104)]&&(_0x285a5d[_0x1aac62(0x117)]?.({'type':_0x1aac62(0x110),'segmentName':_0x216c63,'activationName':_0x5c9837['name']}),await _0x285a5d[_0x1aac62(0x123)](_0x1aac62(0x127)+_0x5c9837['name']+_0x1aac62(0x107),()=>_0x3aae2a['segment'][_0x1aac62(0xc2)](_0x5d54db,_0x48e8bc,_0x5c9837[_0x1aac62(0x104)]['id'])),_0x285a5d[_0x1aac62(0x117)]?.({'type':_0x1aac62(0xec),'segmentName':_0x216c63,'activationName':_0x5c9837[_0x1aac62(0x166)]}),_0x285a5d[_0x1aac62(0x197)]?.(_0x1aac62(0x15a)+_0x5c9837[_0x1aac62(0x166)]+'\x27'),_0x51cdae[_0x1aac62(0x159)]++);}}catch(_0x10f3d3){const _0x2ea403=isHttp400Error(_0x10f3d3),_0x38ac4f=_0x2ea403?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0x1aac62(0x1a1)],_0x27a3a5=getErrorMessage(_0x10f3d3);throw new SDKError(_0x38ac4f,'Failed\x20to\x20'+_0x5c9837[_0x1aac62(0x146)]+_0x1aac62(0x18b)+_0x5c9837[_0x1aac62(0x166)]+_0x1aac62(0x119)+_0x59c2f0+'\x0a\x20\x20'+_0x27a3a5,_0x10f3d3);}}return _0x51cdae;}export async function executePushFolders(_0x55b9ed,_0xb84399,_0x47c2f9,_0x5a958e,_0x2ea658){const _0xbc5ec6=a152_0x18f4ba,_0xf33bd3=new Map(_0x47c2f9),_0x1a62ac=sortFoldersByDepth(_0xb84399);for(const _0x2068e2 of _0x1a62ac){const _0x4af5ea=_0x2068e2[_0xbc5ec6(0x141)]('/'),_0x37f390=_0x4af5ea[_0x4af5ea[_0xbc5ec6(0x17e)]-0x1],_0x2b6e6c=_0x4af5ea[_0xbc5ec6(0x120)](0x0,-0x1)[_0xbc5ec6(0x19e)]('/'),_0x4610f0=_0xf33bd3[_0xbc5ec6(0x19d)](_0x2b6e6c);_0x2ea658[_0xbc5ec6(0x117)]?.({'type':_0xbc5ec6(0xc8),'folder':_0x2068e2});const _0x391bd8={'name':_0x37f390,'parentFolderId':_0x4610f0},_0x2ecf10=await _0x2ea658[_0xbc5ec6(0x123)](_0xbc5ec6(0xaf)+_0x2068e2+_0xbc5ec6(0x107),()=>_0x55b9ed[_0xbc5ec6(0x184)][_0xbc5ec6(0xc7)](_0x5a958e[_0xbc5ec6(0x19c)],_0x391bd8));_0xf33bd3[_0xbc5ec6(0x174)](_0x2068e2,_0x2ecf10['data']['id']),_0x2ea658[_0xbc5ec6(0x117)]?.({'type':'folder_created','folder':_0x2068e2,'folderId':_0x2ecf10[_0xbc5ec6(0xbe)]['id']}),_0x2ea658[_0xbc5ec6(0xdf)]?.(_0xbc5ec6(0x124)+_0x2068e2+'\x27');}return _0xf33bd3;}export async function executePushSegmentDeletions(_0x3feba1,_0x45076f,_0x448921){const _0x3b31ea=a152_0x18f4ba;if(_0x45076f[_0x3b31ea(0x17e)]===0x0)return 0x0;const {batchAsync:_0x28950d}=await import(_0x3b31ea(0x1a5)),_0x221f34=0x5,_0x3200b7=await _0x28950d(_0x45076f,async _0x17dfc9=>{const _0x190ca1=_0x3b31ea;return _0x448921[_0x190ca1(0x117)]?.({'type':'segment_deleting','name':_0x17dfc9[_0x190ca1(0x166)]}),await _0x3feba1[_0x190ca1(0x184)][_0x190ca1(0x12b)](_0x17dfc9['id']),_0x448921[_0x190ca1(0x117)]?.({'type':_0x190ca1(0xc9),'name':_0x17dfc9[_0x190ca1(0x166)]}),_0x448921[_0x190ca1(0x197)]?.(_0x190ca1(0x10a)+_0x17dfc9[_0x190ca1(0x166)]+'\x27'),0x1;},_0x221f34);return _0x3200b7[_0x3b31ea(0x14d)]((_0xff17f8,_0x531789)=>_0xff17f8+_0x531789,0x0);}export async function executePushJourneys(_0xa9061a,_0x99b1e8,_0x569b19,_0x378d99,_0x30d5f7){const _0x28cfee=a152_0x18f4ba,{journeyDefToRequest:_0x8db824}=await import(_0x28cfee(0xcd)),{activationDefToCreateRequest:_0x1bc49a,yamlRuleToApi:_0x3a4290,validateSegmentRule:_0x511494}=await import(_0x28cfee(0xc3)),_0x3efce0={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x4517c9=new Map(_0x569b19[_0x28cfee(0x16f)]),_0x34a9b9=0x5;for(let _0x4b96af=0x0;_0x4b96af<_0x99b1e8[_0x28cfee(0x17e)];_0x4b96af+=_0x34a9b9){const _0x925b58=_0x99b1e8[_0x28cfee(0x120)](_0x4b96af,_0x4b96af+_0x34a9b9),_0x463f28=await Promise[_0x28cfee(0x1a3)](_0x925b58['map'](async _0x4c5056=>{const _0x522a04=_0x28cfee;if(!_0x4c5056[_0x522a04(0x181)]&&!_0x4c5056['hasChanges'])return{'action':_0x522a04(0xb1),'name':_0x4c5056['yamlConfig'][_0x522a04(0x166)],'journeyId':_0x4c5056[_0x522a04(0xb3)]?.['id']};const _0x1f7d86=_0x4c5056[_0x522a04(0xac)]?_0x569b19[_0x522a04(0x130)]['get'](_0x4c5056[_0x522a04(0xac)]):undefined;_0x30d5f7[_0x522a04(0x117)]?.({'type':_0x4c5056[_0x522a04(0x181)]?_0x522a04(0xaa):_0x522a04(0xe1),'name':_0x4c5056['yamlConfig'][_0x522a04(0x166)]});try{const _0x276d07=await executeSingleJourneyPush(_0xa9061a,_0x4c5056,{..._0x569b19,'segmentNameToId':_0x4517c9},{'parentId':_0x378d99[_0x522a04(0x19c)],'rootFolderId':_0x378d99[_0x522a04(0x122)],'folderId':_0x1f7d86,'verbose':_0x378d99[_0x522a04(0x109)]},_0x30d5f7,{'journeyDefToRequest':_0x8db824,'activationDefToCreateRequest':_0x1bc49a,'yamlRuleToApi':_0x3a4290,'validateSegmentRule':_0x511494});for(const [_0x13cfec,_0x434e37]of _0x276d07[_0x522a04(0x13e)]){_0x4517c9[_0x522a04(0x174)](_0x13cfec,_0x434e37),_0x3efce0[_0x522a04(0x13e)][_0x522a04(0x174)](_0x13cfec,_0x434e37);}if(_0x276d07[_0x522a04(0x1ae)]===_0x522a04(0x190))_0x30d5f7[_0x522a04(0x117)]?.({'type':_0x522a04(0x103),'name':_0x4c5056[_0x522a04(0xf1)][_0x522a04(0x166)],'journeyId':_0x276d07['journeyId']}),_0x30d5f7[_0x522a04(0x12d)]?.(_0x522a04(0x1a8)+_0x4c5056[_0x522a04(0xf1)][_0x522a04(0x166)]+'\x27'),_0x3efce0[_0x522a04(0x190)]++;else _0x276d07[_0x522a04(0x1ae)]==='updated'&&(_0x30d5f7[_0x522a04(0x117)]?.({'type':_0x522a04(0xe0),'name':_0x4c5056[_0x522a04(0xf1)]['name']}),_0x30d5f7[_0x522a04(0x12d)]?.(_0x522a04(0x163)+_0x4c5056[_0x522a04(0xf1)][_0x522a04(0x166)]+'\x27'),_0x3efce0['updated']++);return{'action':_0x276d07[_0x522a04(0x1ae)],'name':_0x4c5056['yamlConfig']['name'],'journeyId':_0x276d07[_0x522a04(0x15b)]};}catch(_0x2ba1b1){const _0x157667=isHttp400Error(_0x2ba1b1),_0x309577=_0x157667?ErrorCode[_0x522a04(0xa7)]:ErrorCode[_0x522a04(0xe8)],_0x289fea=getErrorMessage(_0x2ba1b1);throw new SDKError(_0x309577,_0x522a04(0x1ad)+(_0x4c5056[_0x522a04(0x181)]?_0x522a04(0xe5):_0x522a04(0x12e))+_0x522a04(0xb5)+_0x4c5056[_0x522a04(0x111)]+_0x522a04(0x131)+_0x289fea,_0x2ba1b1);}}));_0x3efce0['results'][_0x28cfee(0xb8)](..._0x463f28);}return _0x3efce0;}async function matchExistingJourneySegments(_0x409263,_0x1c2b64,_0x50be5f,_0x40290a,_0x3c2327){const _0x2e5c53=a152_0x18f4ba;if(!_0x1c2b64[_0x2e5c53(0xb3)]||!_0x1c2b64['yamlConfig']['segments'])return;const _0xbcc94a=new Map(),_0x309fda=new Set();for(const _0x145402 of Object[_0x2e5c53(0x10e)](_0x1c2b64['yamlConfig'][_0x2e5c53(0x19a)])){const _0xf52455=generateDeterministicJourneySegmentName(_0x1c2b64[_0x2e5c53(0xf1)][_0x2e5c53(0x166)],_0x145402);_0xbcc94a[_0x2e5c53(0x174)](_0xf52455,_0x145402),_0x309fda[_0x2e5c53(0x106)](_0x145402);}const _0x3d5708=[],_0x6cea01=collectSegmentIdsFromJourneyApi(_0x1c2b64[_0x2e5c53(0xb3)]);for(const _0x441227 of _0x6cea01){const _0x15ea21=await fetchSegment(_0x409263,_0x50be5f,_0x441227,_0x40290a);if(!_0x15ea21?.[_0x2e5c53(0x166)])continue;const _0x20f5bd=_0xbcc94a['get'](_0x15ea21['name']);_0x20f5bd?(_0x3c2327[_0x2e5c53(0x174)](_0x20f5bd,_0x441227),_0x309fda[_0x2e5c53(0x196)](_0x20f5bd)):_0x3d5708[_0x2e5c53(0xb8)]({'id':_0x441227,'seg':_0x15ea21});}if(_0x309fda['size']>0x0&&_0x3d5708[_0x2e5c53(0x17e)]>0x0){const {localExpandedRuleToNames:_0x4bb33b}=buildLocalExpandedRuleMappings(_0x1c2b64['yamlConfig']),_0x5ef1e5=new Map();for(const {id:_0x450444,seg:_0x1f8396}of _0x3d5708){if(_0x1f8396['rule']){const _0x321485=apiRuleToYaml(_0x1f8396[_0x2e5c53(0x151)]);_0x5ef1e5[_0x2e5c53(0x174)](_0x450444,_0x321485);}}for(const {id:_0x531b43,seg:_0x3eb652}of _0x3d5708){if(!_0x3eb652['rule'])continue;const _0x2d5d31=_0x5ef1e5[_0x2e5c53(0x19d)](_0x531b43);if(!_0x2d5d31)continue;const _0x5bb8a9=serializeExpandedRule(_0x2d5d31,_0x5ef1e5),_0x3fb205=_0x4bb33b['get'](_0x5bb8a9);if(_0x3fb205){const _0x4439d4=_0x3fb205['find'](_0xf67484=>_0x309fda[_0x2e5c53(0x1a4)](_0xf67484));_0x4439d4&&(_0x3c2327[_0x2e5c53(0x174)](_0x4439d4,_0x531b43),_0x309fda[_0x2e5c53(0x196)](_0x4439d4),logger[_0x2e5c53(0xed)](_0x2e5c53(0x1ac)+_0x3eb652[_0x2e5c53(0x166)]+_0x2e5c53(0x12a)+_0x4439d4+_0x2e5c53(0x17c)));}}}}async function executeSingleJourneyPush(_0x4161c4,_0x466a8f,_0x1dab23,_0x3c646e,_0x242c32,_0x215efd){const _0x5db401=a152_0x18f4ba,{journeyDefToRequest:_0x28de25,activationDefToCreateRequest:_0x40a1ad,yamlRuleToApi:_0x5ee0e3,validateSegmentRule:_0x4e9a03}=_0x215efd,_0x3dceeb=new Map(),_0x2fb78b=new Map();recoverSegmentIdsFromPushRecovery(_0x466a8f,_0x3dceeb,_0x1dab23[_0x5db401(0x16f)]);const _0x533a45=new Map(),_0x25d037=new Map(),_0x39f789=new Map();let _0x1246cc;const _0x41f417=async()=>{const _0x5131ad=_0x5db401;if(_0x1246cc)return;_0x1246cc=new Map();if(!_0x466a8f[_0x5131ad(0xb3)])return;const _0x147b8a=await _0x4161c4[_0x5131ad(0x1a2)][_0x5131ad(0x18f)](_0x466a8f[_0x5131ad(0xb3)]['id']);for(const _0x50fad1 of _0x147b8a){const _0x5aea2f=journeyActivationStepToYaml(_0x50fad1,_0x1dab23[_0x5131ad(0x1aa)],_0x1dab23[_0x5131ad(0xdb)]),_0xa94fb5=activationSignature(_0x5aea2f);!_0x1246cc[_0x5131ad(0x1a4)](_0xa94fb5)&&_0x1246cc[_0x5131ad(0x174)](_0xa94fb5,_0x50fad1['id']),_0x5aea2f[_0x5131ad(0x166)]&&_0x2fb78b[_0x5131ad(0x174)](_0x5aea2f[_0x5131ad(0x166)],_0x50fad1['id']);}};await matchExistingJourneySegments(_0x4161c4,_0x466a8f,_0x3c646e['parentId'],_0x1dab23[_0x5db401(0xf5)],_0x1dab23[_0x5db401(0x16f)]);const _0x5b38f0={'resolveSegmentId':async _0x36d6ef=>{const _0xd2923f=_0x5db401,_0x2fcf2b=_0x1dab23[_0xd2923f(0x16f)][_0xd2923f(0x19d)](_0x36d6ef);if(!_0x2fcf2b)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0xd2923f(0xbf)+_0x36d6ef+_0xd2923f(0xf0)+_0x466a8f['yamlConfig'][_0xd2923f(0x166)]+')');return _0x2fcf2b;},'resolveEmbeddedSegmentId':async(_0x466604,_0x4da0ec)=>{const _0x2770e7=_0x5db401,_0xb9866e=_0x1dab23['segmentNameToId'][_0x2770e7(0x19d)](_0x466604);if(_0xb9866e)return _0xb9866e;const _0x4fbe59=_0x1dab23[_0x2770e7(0xf5)][_0x2770e7(0x10b)](_0x13bb98=>_0x13bb98[_0x2770e7(0x166)]===_0x466604);if(_0x4fbe59)return _0x1dab23['segmentNameToId']['set'](_0x466604,_0x4fbe59['id']),_0x4fbe59['id'];if(_0x466a8f['isNew']){const {stageName:_0x409e7f,criteriaName:_0x2300db}=findSegmentCriteriaLocation(_0x466a8f[_0x2770e7(0xf1)],_0x466604);return _0x4e9a03(_0x466604,_0x4da0ec['rule']),_0x25d037[_0x2770e7(0x174)](_0x466604,{'definition':_0x4da0ec,'stageName':_0x409e7f,'criteriaName':_0x2300db}),createPendingSegmentId(_0x466604);}const _0x112c20=_0x466a8f[_0x2770e7(0xb3)]?.['id'];if(!_0x112c20)throw new SDKError(ErrorCode[_0x2770e7(0x182)],_0x2770e7(0x16b));const _0x360fc0=_0x533a45[_0x2770e7(0x19d)](_0x466604);if(_0x360fc0)return _0x360fc0;const _0x321b06=((async()=>{const _0xba70e5=_0x2770e7;_0x4e9a03(_0x466604,_0x4da0ec['rule']);const _0x54da2a=generateDeterministicJourneySegmentName(_0x466a8f[_0xba70e5(0xf1)]['name'],_0x466604),_0x3de285=_0x1dab23[_0xba70e5(0xf5)][_0xba70e5(0x10b)](_0x53c0cf=>_0x53c0cf[_0xba70e5(0x166)]===_0x54da2a),_0x52600c=createSegmentIdResolver(_0x1dab23[_0xba70e5(0x16f)],_0x466604),_0x26a58d=await resolveRuleSegmentIds(_0x4da0ec[_0xba70e5(0x151)],_0x52600c);let _0x36835f;return _0x3de285?(await _0x4161c4[_0xba70e5(0x184)][_0xba70e5(0xcf)](_0x3c646e[_0xba70e5(0x19c)],_0x3de285['id'],{'description':_0x4da0ec[_0xba70e5(0x129)]||_0xba70e5(0xfe)+_0x466604,'rule':_0x5ee0e3(_0x26a58d),'countPopulation':!![]}),_0x36835f=_0x3de285['id'],saveSegmentToPushRecovery(_0x466a8f[_0xba70e5(0x111)],_0x466a8f[_0xba70e5(0xf1)]['name'],_0x466604,{'segmentId':_0x36835f,'uniqueServerName':_0x54da2a,'createdAt':new Date()[_0xba70e5(0x171)]()})):_0x36835f=await createOrRecoverEmbeddedSegment(_0x4161c4,_0x466a8f,{'localName':_0x466604,'uniqueSegmentName':_0x54da2a,'description':_0x4da0ec['description']||_0xba70e5(0xfe)+_0x466604,'journeyId':_0x112c20,'resolvedRule':_0x26a58d,'parentId':_0x3c646e[_0xba70e5(0x19c)],'folderId':_0x3c646e[_0xba70e5(0x122)]||''},_0x5ee0e3),_0x1dab23['segmentNameToId'][_0xba70e5(0x174)](_0x466604,_0x36835f),_0x3dceeb[_0xba70e5(0x174)](_0x466604,_0x36835f),_0x36835f;})());_0x533a45[_0x2770e7(0x174)](_0x466604,_0x321b06);try{return await _0x321b06;}finally{_0x533a45[_0x2770e7(0x196)](_0x466604);}},'resolveActivationId':async _0x45f96a=>{const _0x6b2259=_0x5db401,_0x49c069=_0x2fb78b[_0x6b2259(0x19d)](_0x45f96a);if(_0x49c069)return _0x49c069;if(_0x466a8f[_0x6b2259(0xb3)]){await _0x41f417();const _0x4e7a5=_0x2fb78b[_0x6b2259(0x19d)](_0x45f96a);if(_0x4e7a5)return _0x4e7a5;}throw new SDKError(ErrorCode[_0x6b2259(0x15f)],_0x6b2259(0xfa)+_0x45f96a+'\x20(referenced\x20in\x20journey\x20'+_0x466a8f[_0x6b2259(0xf1)][_0x6b2259(0x166)]+_0x6b2259(0x185)+_0x6b2259(0x18a));},'resolveEmbeddedActivationId':async(_0x4c7768,_0xc04151)=>{const _0x75aca4=_0x5db401,_0x3f685c=_0x2fb78b[_0x75aca4(0x19d)](_0x4c7768);if(_0x3f685c)return _0x3f685c;if(_0x466a8f[_0x75aca4(0x181)])return _0x39f789['set'](_0x4c7768,_0xc04151),createPendingActivationId(_0x4c7768);if(_0x466a8f[_0x75aca4(0xb3)]){await _0x41f417();const _0x509915=_0x2fb78b['get'](_0xc04151[_0x75aca4(0x166)]);if(_0x509915)return _0x2fb78b['set'](_0x4c7768,_0x509915),_0x509915;const _0x11f5d1=activationSignature(_0xc04151),_0x8b432e=_0x1246cc?.[_0x75aca4(0x19d)](_0x11f5d1);if(_0x8b432e)return _0x2fb78b[_0x75aca4(0x174)](_0x4c7768,_0x8b432e),_0x8b432e;const _0x53a6a0=await _0x40a1ad(_0xc04151,_0x1dab23['activationContext']),_0x19787d={..._0x53a6a0,..._0xc04151['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0xc04151['run_after_journey_refresh']}},_0x3c93a3=await _0x4161c4[_0x75aca4(0x1a2)][_0x75aca4(0x18c)](_0x466a8f[_0x75aca4(0xb3)]['id'],_0x19787d);return _0x2fb78b[_0x75aca4(0x174)](_0x4c7768,_0x3c93a3['id']),_0x3c93a3['id'];}throw new SDKError(ErrorCode[_0x75aca4(0x182)],_0x75aca4(0xc6));},'resolveJourneyId':async _0x3554fa=>{const _0x825587=_0x5db401;try{return await _0x4161c4[_0x825587(0x1a2)][_0x825587(0x16d)](_0x3c646e[_0x825587(0x19c)],_0x3554fa);}catch(_0x4013c3){throw new SDKError(ErrorCode[_0x825587(0x15f)],'Journey\x20\x27'+_0x3554fa+_0x825587(0x18d)+_0x466a8f[_0x825587(0xf1)][_0x825587(0x166)]+'\x27)',_0x4013c3);}},'resolveStageId':async(_0x2f3628,_0x43d275)=>{const _0x2d9e25=_0x5db401,_0x40d0ed=await _0x4161c4[_0x2d9e25(0x1a2)]['getJourney'](_0x2f3628),_0x292024=_0x40d0ed[_0x2d9e25(0xf3)][_0x2d9e25(0xb9)]['find'](_0x53ce5c=>_0x53ce5c[_0x2d9e25(0x166)][_0x2d9e25(0x15d)]()===_0x43d275['toLowerCase']());if(!_0x292024?.['id'])throw new SDKError(ErrorCode[_0x2d9e25(0x15f)],_0x2d9e25(0xbd)+_0x43d275+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x40d0ed[_0x2d9e25(0xf3)][_0x2d9e25(0x194)]||_0x40d0ed[_0x2d9e25(0xf3)][_0x2d9e25(0x166)])+'\x27');return _0x292024['id'];}},_0x2867ad=await _0x28de25(_0x466a8f[_0x5db401(0xf1)],_0x3c646e[_0x5db401(0x19c)],_0x5b38f0),_0x42d9fc=_0x3c646e['folderId']||_0x3c646e[_0x5db401(0x122)];_0x42d9fc&&(_0x2867ad[_0x5db401(0x113)]={'parentFolder':{'data':{'id':_0x42d9fc,'type':_0x5db401(0x168)}}});if(_0x466a8f['isNew']){if(_0x25d037['size']>0x0||_0x39f789[_0x5db401(0x12f)]>0x0)return await executeThreeStepJourneyCreate(_0x4161c4,_0x466a8f,_0x2867ad,{'pendingEmbeddedSegments':_0x25d037,'pendingEmbeddedActivations':_0x39f789,'embeddedSegmentNameToId':_0x3dceeb,'journeyActivationNameToId':_0x2fb78b},{..._0x3c646e,'effectiveFolderId':_0x42d9fc},_0x1dab23,_0x242c32,_0x215efd);else{ensureJourneyDefaults(_0x2867ad[_0x5db401(0xf3)]);const _0x130108=await _0x4161c4[_0x5db401(0x1a2)][_0x5db401(0xe5)](_0x2867ad);return deletePushRecovery(_0x466a8f['absolutePath']),{'action':_0x5db401(0x190),'journeyId':_0x130108['id'],'embeddedSegmentNameToId':_0x3dceeb};}}else{if(_0x466a8f[_0x5db401(0xeb)]&&_0x466a8f['existingJourney']){_0x2867ad['id']=_0x466a8f[_0x5db401(0xb3)]['id'];const _0x5434f2=_0x2867ad[_0x5db401(0xf3)];_0x466a8f['existingJourney'][_0x5db401(0xf3)]?.[_0x5db401(0x194)]&&(_0x5434f2[_0x5db401(0x194)]=_0x466a8f['existingJourney']['attributes']['journeyBundleName']);const _0x18ff78=_0x466a8f[_0x5db401(0xb3)][_0x5db401(0xf3)]?.['journeyStages'];return _0x18ff78&&_0x2867ad[_0x5db401(0xf3)]['journeyStages']&&injectExistingStageIds(_0x2867ad[_0x5db401(0xf3)][_0x5db401(0xb9)],_0x18ff78),ensureJourneyDefaults(_0x5434f2),await _0x4161c4[_0x5db401(0x1a2)][_0x5db401(0x12e)](_0x466a8f[_0x5db401(0xb3)]['id'],_0x2867ad),deletePushRecovery(_0x466a8f[_0x5db401(0x111)]),{'action':'updated','journeyId':_0x466a8f['existingJourney']['id'],'embeddedSegmentNameToId':_0x3dceeb};}}return deletePushRecovery(_0x466a8f[_0x5db401(0x111)]),{'action':_0x5db401(0xb1),'journeyId':_0x466a8f[_0x5db401(0xb3)]?.['id'],'embeddedSegmentNameToId':_0x3dceeb};}function findSegmentCriteriaLocation(_0x53c9af,_0x5eea34){const _0x4c21ff=a152_0x18f4ba,_0x2d2ef3=_0x53c9af[_0x4c21ff(0x147)]||_0x53c9af[_0x4c21ff(0x125)]?.[0x0]?.['stages']||[];let _0x1e1b1e=_0x4c21ff(0x16a),_0x835bd7=_0x5eea34;const _0x4eed25=_0x53c9af[_0x4c21ff(0x13c)]||_0x53c9af[_0x4c21ff(0x125)]?.[0x0]?.[_0x4c21ff(0x13c)];if(_0x4eed25?.['segment']===_0x5eea34)return{'stageName':_0x4c21ff(0x13c),'criteriaName':_0x4eed25[_0x4c21ff(0x166)]||_0x5eea34};_0x5d108d:for(const _0x281a5b of _0x2d2ef3){if(_0x281a5b[_0x4c21ff(0x136)]?.[_0x4c21ff(0x184)]===_0x5eea34){_0x1e1b1e=_0x281a5b[_0x4c21ff(0x166)],_0x835bd7=_0x281a5b[_0x4c21ff(0x136)][_0x4c21ff(0x166)]||_0x5eea34;break;}if(_0x281a5b['steps'])for(const _0x2fb03b of _0x281a5b['steps']){if(_0x2fb03b[_0x4c21ff(0x146)]===_0x4c21ff(0xae)&&_0x2fb03b[_0x4c21ff(0x101)]?.[_0x4c21ff(0x1af)])for(const _0x5caf2d of _0x2fb03b[_0x4c21ff(0x101)][_0x4c21ff(0x1af)]){if(_0x5caf2d[_0x4c21ff(0x184)]===_0x5eea34){_0x1e1b1e=_0x281a5b['name'],_0x835bd7=_0x5caf2d[_0x4c21ff(0x166)]||_0x5eea34;break _0x5d108d;}}}}return{'stageName':_0x1e1b1e,'criteriaName':_0x835bd7};}async function executeThreeStepJourneyCreate(_0x5bb65f,_0x11df20,_0x81217d,_0xeb037,_0x3331a5,_0x234826,_0x38134e,_0x1bc551){const _0x5f4975=a152_0x18f4ba,{activationDefToCreateRequest:_0x5b04fa,yamlRuleToApi:_0x77c42f}=_0x1bc551,{pendingEmbeddedSegments:_0x22c697,pendingEmbeddedActivations:_0x1a004c,embeddedSegmentNameToId:_0x315fb0}=_0xeb037,_0x39fcd6=JSON[_0x5f4975(0x139)](JSON['stringify'](_0x81217d));ensureJourneyDefaults(_0x39fcd6[_0x5f4975(0xf3)]),stripPendingIds(_0x39fcd6);const _0x269a00=await _0x5bb65f[_0x5f4975(0x1a2)][_0x5f4975(0xe5)](_0x39fcd6),_0x385499=_0x269a00['id'],_0xbd26fd=new Map();for(const _0x1fadea of _0x269a00['attributes']['journeyStages']){_0xbd26fd['set'](_0x1fadea[_0x5f4975(0x166)]['toLowerCase'](),_0x1fadea['id']);}recoverSegmentIdsFromPushRecovery(_0x11df20,_0x315fb0,_0x234826['segmentNameToId']);for(const [_0x3d68d5,{definition:_0x5ba49b}]of _0x22c697){if(_0x315fb0[_0x5f4975(0x1a4)](_0x3d68d5)){_0x38134e[_0x5f4975(0x117)]?.({'type':_0x5f4975(0xcc),'journeyName':_0x11df20[_0x5f4975(0xf1)]['name'],'segmentName':_0x3d68d5});continue;}const _0x524e02=generateDeterministicJourneySegmentName(_0x11df20[_0x5f4975(0xf1)][_0x5f4975(0x166)],_0x3d68d5);_0x38134e['onProgress']?.({'type':_0x5f4975(0x115),'journeyName':_0x11df20['yamlConfig'][_0x5f4975(0x166)],'segmentName':_0x3d68d5});const _0x49c1bb=createSegmentIdResolver(_0x234826[_0x5f4975(0x16f)],_0x3d68d5),_0xd319ca=await resolveRuleSegmentIds(_0x5ba49b['rule'],_0x49c1bb),_0x1f3676=await createOrRecoverEmbeddedSegment(_0x5bb65f,_0x11df20,{'localName':_0x3d68d5,'uniqueSegmentName':_0x524e02,'description':_0x5ba49b['description']||_0x5f4975(0xfe)+_0x3d68d5,'journeyId':_0x385499,'resolvedRule':_0xd319ca,'parentId':_0x3331a5[_0x5f4975(0x19c)],'folderId':_0x3331a5[_0x5f4975(0x152)]||''},_0x77c42f);_0x315fb0[_0x5f4975(0x174)](_0x3d68d5,_0x1f3676),_0x234826[_0x5f4975(0x16f)]['set'](_0x3d68d5,_0x1f3676),_0x38134e['onProgress']?.({'type':_0x5f4975(0xcc),'journeyName':_0x11df20['yamlConfig']['name'],'segmentName':_0x3d68d5});}const _0x28853d=new Map();for(const [_0x1480fd,_0x2b43b8]of _0x1a004c){_0x38134e['onProgress']?.({'type':_0x5f4975(0xff),'journeyName':_0x11df20['yamlConfig']['name'],'activationName':_0x1480fd});const _0x25142f=await _0x5b04fa(_0x2b43b8,_0x234826['activationContext']),_0x5b2d90={..._0x25142f,..._0x2b43b8['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x2b43b8[_0x5f4975(0xb0)]}},_0x198e11=await _0x5bb65f['journey'][_0x5f4975(0x18c)](_0x385499,_0x5b2d90);_0x28853d[_0x5f4975(0x174)](_0x1480fd,_0x198e11['id']),_0xeb037[_0x5f4975(0xad)][_0x5f4975(0x174)](_0x1480fd,_0x198e11['id']),_0x38134e['onProgress']?.({'type':_0x5f4975(0xd1),'journeyName':_0x11df20[_0x5f4975(0xf1)][_0x5f4975(0x166)],'activationName':_0x1480fd});}const _0xded31b=JSON[_0x5f4975(0x139)](JSON[_0x5f4975(0x11d)](_0x81217d));return _0xded31b['id']=_0x385499,ensureJourneyDefaults(_0xded31b[_0x5f4975(0xf3)]),resolvePendingIdsInRequest(_0xded31b,_0x81217d,_0xbd26fd,_0x315fb0,_0x28853d,_0x38134e),await _0x5bb65f[_0x5f4975(0x1a2)][_0x5f4975(0x12e)](_0x385499,_0xded31b),deletePushRecovery(_0x11df20['absolutePath']),{'action':_0x5f4975(0x190),'journeyId':_0x385499,'embeddedSegmentNameToId':_0x315fb0};}export function stripWaitStepPendingIds(_0x370ad5){const _0x47b909=a152_0x18f4ba,_0x36d2b0=_0x370ad5['conditionSegmentId']&&isPendingSegmentId(_0x370ad5[_0x47b909(0x11e)]),_0x32d250=_0x370ad5['conditions']?.[_0x47b909(0xab)](_0x14afa3=>_0x14afa3['segmentId']&&isPendingSegmentId(_0x14afa3[_0x47b909(0xef)]));(_0x36d2b0||_0x32d250)&&(_0x370ad5[_0x47b909(0x158)]='Duration',_0x370ad5[_0x47b909(0x14f)]=0x1,_0x370ad5[_0x47b909(0x1a9)]=_0x47b909(0xb7),delete _0x370ad5[_0x47b909(0x11e)],delete _0x370ad5[_0x47b909(0x192)],delete _0x370ad5[_0x47b909(0x193)],delete _0x370ad5[_0x47b909(0x155)]);}export function resolveWaitStepPendingIds(_0x284731,_0x2ace34,_0x293ec0,_0x46ce42){const _0x294e9e=a152_0x18f4ba;if(_0x2ace34['conditionSegmentId']&&isPendingSegmentId(_0x2ace34[_0x294e9e(0x11e)])){const _0x1d5558=_0x293ec0(_0x2ace34['conditionSegmentId'],_0x294e9e(0xda)+_0x46ce42+'\x27\x20wait\x20condition');_0x1d5558&&(_0x284731['waitStepType']=_0x294e9e(0x187),_0x284731[_0x294e9e(0x11e)]=_0x1d5558,delete _0x284731[_0x294e9e(0x14f)],delete _0x284731[_0x294e9e(0x1a9)],_0x2ace34['conditionTimeoutDuration']!==undefined&&(_0x284731['conditionTimeoutDuration']=_0x2ace34[_0x294e9e(0x192)]),_0x2ace34[_0x294e9e(0x193)]&&(_0x284731['conditionTimeoutUnit']=_0x2ace34[_0x294e9e(0x193)]));}if(_0x2ace34[_0x294e9e(0x155)]){const _0x41f00e=_0x2ace34['conditions'][_0x294e9e(0xab)](_0x40e443=>_0x40e443[_0x294e9e(0xef)]&&isPendingSegmentId(_0x40e443[_0x294e9e(0xef)]));if(_0x41f00e){const _0x4fa1e1=_0x2ace34[_0x294e9e(0x155)][_0x294e9e(0x19f)](_0x566b9f=>{const _0x4172ea=_0x294e9e;if(_0x566b9f['segmentId']&&isPendingSegmentId(_0x566b9f[_0x4172ea(0xef)])){const _0x467036=_0x293ec0(_0x566b9f[_0x4172ea(0xef)],_0x4172ea(0xda)+_0x46ce42+_0x4172ea(0xc1));return{..._0x566b9f,'segmentId':_0x467036||_0x566b9f[_0x4172ea(0xef)]};}return{..._0x566b9f};});_0x284731[_0x294e9e(0x158)]=_0x294e9e(0x187),_0x284731[_0x294e9e(0x155)]=_0x4fa1e1,delete _0x284731['waitStep'],delete _0x284731[_0x294e9e(0x1a9)],delete _0x284731['conditionSegmentId'],delete _0x284731[_0x294e9e(0x192)],delete _0x284731[_0x294e9e(0x193)];}}}function stripPendingIds(_0x41213c){const _0x5bd0df=a152_0x18f4ba;_0x41213c[_0x5bd0df(0xf3)][_0x5bd0df(0x13c)]?.[_0x5bd0df(0xef)]&&isPendingSegmentId(_0x41213c[_0x5bd0df(0xf3)][_0x5bd0df(0x13c)][_0x5bd0df(0xef)])&&delete _0x41213c[_0x5bd0df(0xf3)]['goal'];for(const _0x2a7362 of _0x41213c['attributes'][_0x5bd0df(0xb9)]||[]){_0x2a7362[_0x5bd0df(0xde)]?.['segmentId']&&isPendingSegmentId(_0x2a7362[_0x5bd0df(0xde)][_0x5bd0df(0xef)])&&delete _0x2a7362[_0x5bd0df(0xde)];_0x2a7362[_0x5bd0df(0x177)]?.['segmentId']&&isPendingSegmentId(_0x2a7362[_0x5bd0df(0x177)][_0x5bd0df(0xef)])&&delete _0x2a7362['milestone'];_0x2a7362[_0x5bd0df(0x11b)]&&(_0x2a7362['exitCriterias']=_0x2a7362[_0x5bd0df(0x11b)][_0x5bd0df(0x121)](_0x5a0da0=>!_0x5a0da0[_0x5bd0df(0xef)]||!isPendingSegmentId(_0x5a0da0[_0x5bd0df(0xef)])));if(_0x2a7362[_0x5bd0df(0x13d)])for(const _0x41f4e4 of Object[_0x5bd0df(0x10e)](_0x2a7362[_0x5bd0df(0x13d)])){const _0x9d4f6a=_0x2a7362[_0x5bd0df(0x13d)][_0x41f4e4];_0x9d4f6a[_0x5bd0df(0x146)]===_0x5bd0df(0x15e)&&_0x9d4f6a[_0x5bd0df(0xb6)]&&isPendingActivationId(_0x9d4f6a[_0x5bd0df(0xb6)])&&(_0x9d4f6a[_0x5bd0df(0xb6)]='');if(_0x9d4f6a[_0x5bd0df(0x146)]===_0x5bd0df(0x10f)&&_0x9d4f6a[_0x5bd0df(0x1af)])for(const _0x1c442d of _0x9d4f6a[_0x5bd0df(0x1af)]){_0x1c442d[_0x5bd0df(0xef)]&&isPendingSegmentId(_0x1c442d[_0x5bd0df(0xef)])&&(_0x1c442d[_0x5bd0df(0xef)]='');}_0x9d4f6a[_0x5bd0df(0x146)]===_0x5bd0df(0xbb)&&stripWaitStepPendingIds(_0x9d4f6a);}}}function resolvePendingIdsInRequest(_0x5b1bc1,_0x512e9a,_0x109500,_0x2a3cbc,_0x81d38f,_0x371a10){const _0x5481dc=a152_0x18f4ba,_0x527b3b=(_0x1234a2,_0x292b78)=>{const _0x350318=a152_0x3e6f;if(!isPendingSegmentId(_0x1234a2))return _0x1234a2;const _0x2affdf=extractPendingSegmentName(_0x1234a2),_0x474367=_0x2a3cbc['get'](_0x2affdf);return!_0x474367&&_0x371a10[_0x350318(0x188)]?.(_0x350318(0xd2)+_0x2affdf+'\x27\x20for\x20'+_0x292b78),_0x474367;};if(_0x5b1bc1[_0x5481dc(0xf3)]['goal']?.['segmentId']&&isPendingSegmentId(_0x5b1bc1[_0x5481dc(0xf3)][_0x5481dc(0x13c)]['segmentId'])){const _0x3569c9=_0x527b3b(_0x5b1bc1[_0x5481dc(0xf3)]['goal'][_0x5481dc(0xef)],'goal\x20criteria');_0x3569c9&&(_0x5b1bc1['attributes']['goal'][_0x5481dc(0xef)]=_0x3569c9);}for(const _0x3edc80 of _0x5b1bc1[_0x5481dc(0xf3)][_0x5481dc(0xb9)]||[]){const _0x243db5=_0x109500['get'](_0x3edc80[_0x5481dc(0x166)][_0x5481dc(0x15d)]());_0x243db5&&(_0x3edc80['id']=_0x243db5);if(_0x3edc80['entryCriteria']?.[_0x5481dc(0xef)]&&isPendingSegmentId(_0x3edc80['entryCriteria'][_0x5481dc(0xef)])){const _0x2d0dd6=_0x527b3b(_0x3edc80[_0x5481dc(0xde)][_0x5481dc(0xef)],_0x5481dc(0xda)+_0x3edc80[_0x5481dc(0x166)]+_0x5481dc(0x1a7));_0x2d0dd6&&(_0x3edc80[_0x5481dc(0xde)][_0x5481dc(0xef)]=_0x2d0dd6);}if(_0x3edc80[_0x5481dc(0x11b)])for(const _0x3d2d72 of _0x3edc80[_0x5481dc(0x11b)]){if(_0x3d2d72['segmentId']&&isPendingSegmentId(_0x3d2d72[_0x5481dc(0xef)])){const _0x503832=_0x527b3b(_0x3d2d72[_0x5481dc(0xef)],_0x5481dc(0xda)+_0x3edc80[_0x5481dc(0x166)]+_0x5481dc(0xfc));_0x503832&&(_0x3d2d72[_0x5481dc(0xef)]=_0x503832);}}if(_0x3edc80['milestone']?.[_0x5481dc(0xef)]&&isPendingSegmentId(_0x3edc80[_0x5481dc(0x177)][_0x5481dc(0xef)])){const _0x4013a3=_0x527b3b(_0x3edc80[_0x5481dc(0x177)][_0x5481dc(0xef)],_0x5481dc(0xda)+_0x3edc80[_0x5481dc(0x166)]+_0x5481dc(0xf4));_0x4013a3&&(_0x3edc80[_0x5481dc(0x177)][_0x5481dc(0xef)]=_0x4013a3);}if(_0x3edc80['steps']){const _0x55d972=_0x318e0f=>_0x512e9a['attributes']['journeyStages']?.['find'](_0x40b4c0=>_0x40b4c0[_0x5481dc(0x166)][_0x5481dc(0x15d)]()===_0x3edc80[_0x5481dc(0x166)]['toLowerCase']())?.[_0x5481dc(0x13d)]?.[_0x318e0f];for(const _0x21a260 of Object[_0x5481dc(0x10e)](_0x3edc80[_0x5481dc(0x13d)])){const _0x58fbf6=_0x3edc80[_0x5481dc(0x13d)][_0x21a260],_0x3daf99=_0x55d972(_0x21a260);if(_0x58fbf6[_0x5481dc(0x146)]==='Activation'&&_0x58fbf6[_0x5481dc(0xb6)]&&(isPendingActivationId(_0x58fbf6['journeyActivationStepId'])||_0x58fbf6['journeyActivationStepId']==='')){if(_0x3daf99?.[_0x5481dc(0xb6)]&&isPendingActivationId(_0x3daf99[_0x5481dc(0xb6)])){const _0xad0338=extractPendingActivationName(_0x3daf99[_0x5481dc(0xb6)]),_0x15d15d=_0x81d38f[_0x5481dc(0x19d)](_0xad0338);_0x15d15d&&(_0x58fbf6[_0x5481dc(0xb6)]=_0x15d15d);}}if(_0x58fbf6[_0x5481dc(0x146)]==='DecisionPoint'&&_0x58fbf6['branches']&&_0x3daf99?.[_0x5481dc(0x1af)])for(let _0x76e17b=0x0;_0x76e17b<_0x58fbf6[_0x5481dc(0x1af)]['length'];_0x76e17b++){const _0x22d46f=_0x58fbf6[_0x5481dc(0x1af)][_0x76e17b],_0x568e6c=_0x3daf99['branches'][_0x76e17b];if(_0x568e6c?.[_0x5481dc(0xef)]&&isPendingSegmentId(_0x568e6c[_0x5481dc(0xef)])){const _0x1e2900=_0x527b3b(_0x568e6c[_0x5481dc(0xef)],_0x5481dc(0xda)+_0x3edc80[_0x5481dc(0x166)]+_0x5481dc(0xe2)+(_0x22d46f['name']||_0x76e17b)+'\x27');_0x1e2900&&(_0x22d46f['segmentId']=_0x1e2900);}}_0x58fbf6[_0x5481dc(0x146)]===_0x5481dc(0xbb)&&_0x3daf99?.[_0x5481dc(0x146)]===_0x5481dc(0xbb)&&resolveWaitStepPendingIds(_0x58fbf6,_0x3daf99,_0x527b3b,_0x3edc80[_0x5481dc(0x166)]);}}}}
1
+ const a152_0x46b3ac=a152_0x5983;(function(_0x5baffd,_0x55c4ce){const _0x555f85=a152_0x5983,_0x50c7fe=_0x5baffd();while(!![]){try{const _0x529b13=parseInt(_0x555f85(0x10f))/0x1*(parseInt(_0x555f85(0xc1))/0x2)+parseInt(_0x555f85(0x92))/0x3*(-parseInt(_0x555f85(0xa8))/0x4)+-parseInt(_0x555f85(0xfb))/0x5*(parseInt(_0x555f85(0xc7))/0x6)+parseInt(_0x555f85(0x93))/0x7+parseInt(_0x555f85(0xd3))/0x8*(-parseInt(_0x555f85(0xf7))/0x9)+-parseInt(_0x555f85(0x166))/0xa+-parseInt(_0x555f85(0x131))/0xb*(-parseInt(_0x555f85(0x109))/0xc);if(_0x529b13===_0x55c4ce)break;else _0x50c7fe['push'](_0x50c7fe['shift']());}catch(_0x1fe689){_0x50c7fe['push'](_0x50c7fe['shift']());}}}(a152_0x38b9,0x74f23));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x46b3ac(0x151));export const PENDING_SEGMENT_PREFIX='__pending_';export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0x2e24f7){return''+PENDING_SEGMENT_PREFIX+_0x2e24f7+'__';}export function isPendingSegmentId(_0xe573f7){const _0xef0806=a152_0x46b3ac;return _0xe573f7[_0xef0806(0x9f)](PENDING_SEGMENT_PREFIX)&&!_0xe573f7[_0xef0806(0x9f)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x46cf3e){return _0x46cf3e['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x4b9b41){return''+PENDING_ACTIVATION_PREFIX+_0x4b9b41+'__';}export function isPendingActivationId(_0x30614b){return _0x30614b['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x141071){const _0x30ca86=a152_0x46b3ac;return _0x141071[_0x30ca86(0xfd)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x4642d7,_0x178cdb){const _0x1c87c2=a152_0x46b3ac,_0x322b42=_0x4642d7+'::'+(_0x178cdb[_0x1c87c2(0xba)]()||'segment'),_0x4b17ef=createHash(_0x1c87c2(0xec))[_0x1c87c2(0x103)](_0x322b42)[_0x1c87c2(0x175)](_0x1c87c2(0xc4))[_0x1c87c2(0x138)](0x0,0xc);return _0x1c87c2(0xca)+_0x4b17ef;}export function ensureJourneyDefaults(_0x2afd74){const _0x4cb9c8=a152_0x46b3ac;!_0x2afd74[_0x4cb9c8(0xb6)]&&(_0x2afd74[_0x4cb9c8(0xb6)]=''),!_0x2afd74[_0x4cb9c8(0xc9)]&&(_0x2afd74['state']=_0x4cb9c8(0x135));}export function injectExistingStageIds(_0x10448a,_0x1a78d1){const _0x2bc2a9=a152_0x46b3ac,_0x14d688=new Map(_0x1a78d1['map'](_0x4c3bcf=>[_0x4c3bcf[_0x2bc2a9(0xb7)],_0x4c3bcf['id']]));for(const _0x4258c6 of _0x10448a){if(!_0x4258c6['id']){const _0x2bf8bd=_0x14d688[_0x2bc2a9(0x13c)](_0x4258c6[_0x2bc2a9(0xb7)]);_0x2bf8bd&&(_0x4258c6['id']=_0x2bf8bd);}}}export function resolveTDFolderPath(_0xce0eaa,_0x3a1ce3,_0x240a82){const _0x557ea9=a152_0x46b3ac;if(!_0x3a1ce3)return _0xce0eaa;if(_0xce0eaa===_0x240a82||_0xce0eaa[_0x557ea9(0x9f)](_0x240a82+'/'))return _0xce0eaa;return _0xce0eaa?_0x240a82+'/'+_0xce0eaa:_0x240a82;}export function addFoldersToCreate(_0x15f554,_0x5e71ae,_0x5085f9){const _0x4e8e03=a152_0x46b3ac;if(!_0x15f554)return;if(_0x5e71ae[_0x4e8e03(0xdf)](_0x15f554))return;const _0xdd6360=_0x15f554['split']('/');let _0x24ba80='';for(const _0x23e918 of _0xdd6360){_0x24ba80=_0x24ba80?_0x24ba80+'/'+_0x23e918:_0x23e918,!_0x5e71ae[_0x4e8e03(0xdf)](_0x24ba80)&&_0x5085f9[_0x4e8e03(0xb3)](_0x24ba80);}}export function sortFoldersByDepth(_0x4f9887){const _0x145841=a152_0x46b3ac;return[..._0x4f9887][_0x145841(0x15b)]((_0x13896,_0x2912bf)=>{const _0x114bfd=_0x145841,_0x2eeae0=(_0x13896[_0x114bfd(0xff)](/\//g)||[])[_0x114bfd(0xcb)],_0x4f6ee6=(_0x2912bf['match'](/\//g)||[])[_0x114bfd(0xcb)];return _0x2eeae0-_0x4f6ee6;});}import*as a152_0x5ceb99 from'yaml';import{readFileSync}from'fs';import a152_0x5f585d from'path';import{isJourneyDef,parseYamlString as a152_0x3b83a8,toYamlString as a152_0x5cd7f7,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';function a152_0x38b9(){const _0xfd1035=['resolvedRule','description','name','conditionSegmentId','activation_creating','trim','Failed\x20to\x20resolve\x20activation\x20','Activation','localName','rootFolderId','null','journey_updating','8GYUfMX','Matched\x20server\x20segment\x20\x27','goal','hex','onProgress','getSegment','10554aFTPoB','fetchJourney','state','journey_entry_criteria_','length','\x27\x20by\x20rule\x20content','Failed\x20to\x20','conditionTimeoutDuration','toLowerCase','folder_created','deleted','kind','660616apHwmQ','WaitStep','progress','decision_point','parentId','\x20journey\x20from\x20file:\x20','attributes','created','parseDocument','connectionIdToNameMap','results','Created\x20journey\x20\x27','has','Activation\x20not\x20found:\x20','segment_deleting','push','getJourney','../../utils/async.js','logDeleted','segmentFolderId','deleteActivation','flatMap','split','some','journey_updated','sha1','segment','journeys','):\x20','Created\x20folder\x20\x27','Failed\x20to\x20resolve\x20segment\x20','segmentByFolderAndName','journeyActivationStepId','milestone','debug','steps','81RxRLRa','join','type','\x27...','1505kCQJKn','schedule','replace','Creating\x20segment\x20\x27','match','rule','size','\x27\x20wait\x20condition','update','deps','stages','values','\x27\x20from\x20file:\x20','embedded_segment_created','8111304OEhrLd','Updating\x20segment\x20\x27','action','entry_criteria','nameToId','parse','50909EeZwIS','journeyBundleName','toISOString','logSuccess','journeyName','\x20error(s)','existingJourney','journey','activation_template_id','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','JOURNEY_UPDATE_ERROR','Condition','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','connection','createdSegmentIds','object','embedded_segment_creating','createdSegmentId','activationContext','uniqueSegmentName','conditions','ACTIVATION_UPDATE_ERROR','JOURNEY_SYNTAX_ERROR','\x27\x20exit\x20criteria','toString','with','resolveSegment','Duration','Name\x20has\x20already\x20been\x20taken','activationParams','createFolder','goal\x20criteria','INTERNAL','Deleted\x20segment\x20\x27','33rTgPbz','keys','createSegment','ACTIVATION_SYNTAX_ERROR','draft','existingSegments','hasChanges','slice','reduce','withProgress','exitCriterias','get','folderPath','updateSegmentById','map','all','stage\x20\x27','waitStep','relative','journey_creating','notification','activationStepsById','DecisionPoint','absolutePath','getActivation','updated','isNew','all_columns','index','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','uniqueServerName','getSegmentEntity','tdx.sdk.push-workflow','Creating\x20activation\x20\x27','branches','segments','item','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','Embedded\x20segment\x20\x27','columns','.$1.push-recovery.json','idToEmailMap','sort','entryCriteria','deleteSegment','segment_created','buildUserMaps','\x27\x20not\x20found\x20in\x20journey\x20\x27','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','waitStepType','journeyId','embeddedSegmentNameToId','delete','1253400wCNFfB','run_after_journey_refresh','relationships','includes','\x20activation\x20\x27','segmentNameToId','and\x20the\x20server\x20segment,\x20then\x20retry.','yamlConfig','\x0a\x20\x20','Updated\x20activation\x20\x27','journeyStages','Journey\x20\x27','./child-segment-yaml.js','diff',').\x20','digest','validatedRequest','\x27\x20for\x20','entry','skipSegments','activations','SEGMENT_SYNTAX_ERROR','max','NOT_FOUND','journeyBundlesByFolderAndName','journey_created','getLatestJourneyId','Created\x20activation\x20\x27','filter','conditionTimeoutUnit','parentSegmentFolder','folderPathToId','yamlActivation','\x20segment\x20from\x20file:\x20','\x27\x20decision\x20point\x20branch\x20\x27','entries','Created\x20segment\x20\x27','user','versionNumber','\x27\x20to\x20local\x20\x27','list','Fetching\x20','embedded_activation_created',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','Failed\x20to\x20fetch\x20referenced\x20segment\x20','segment_updating','embedded_activation_creating','journeyActivationNameToId','existingActivation','stringify','journeyById','getSegmentEntity\x20also\x20failed\x20for\x20','find','activationsBySegmentId','Delete\x20the\x20push\x20recovery\x20file\x20(','segment_deleted','SEGMENT_UPDATE_ERROR','connector_config','24cUGYgm','2342179LaYheT','segment_updated','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','activationActions','activation_deleted','valid','segmentId','\x20(referenced\x20in\x20journey\x20','data','Creating\x20folder\x20\x27','day','utf-8','startsWith','updateActivation','SEGMENT_NOT_FOUND','Deleted\x20activation\x20\x27','folderId','createJourneySegment','existingSegment','\x27\x20milestone','set','344528RfeKWO','listActivations','createActivation','isArray','create','from','message','logWarning','\x27\x20entry\x20criteria','verbose','waitStepUnit','add','unchanged'];a152_0x38b9=function(){return _0xfd1035;};return a152_0x38b9();}function a152_0x5983(_0x1cb76a,_0x3640e9){_0x1cb76a=_0x1cb76a-0x70;const _0x38b96=a152_0x38b9();let _0x598347=_0x38b96[_0x1cb76a];return _0x598347;}import{validateSegmentDef,formatValidationResult}from'./yaml-validator.js';import{validateJourneyDef}from'./journey-validator.js';function stableStringify(_0x294028){const _0x1d905b=a152_0x46b3ac;if(Array[_0x1d905b(0xab)](_0x294028))return'['+_0x294028[_0x1d905b(0x13f)](_0x1fcb90=>stableStringify(_0x1fcb90))['join'](',')+']';if(_0x294028&&typeof _0x294028===_0x1d905b(0x11e)){const _0x457af3=_0x294028,_0x1055b1=Object['keys'](_0x457af3)[_0x1d905b(0x15b)](),_0x31daee=_0x1055b1[_0x1d905b(0x13f)](_0x531b7b=>'\x22'+_0x531b7b+'\x22:'+stableStringify(_0x457af3[_0x531b7b]));return'{'+_0x31daee[_0x1d905b(0xf8)](',')+'}';}const _0x57307a=JSON[_0x1d905b(0x89)](_0x294028);return _0x57307a===undefined?_0x1d905b(0xbf):_0x57307a;}function activationSignature(_0x78aef6){const _0x3addc9=a152_0x46b3ac,_0x54b921={'connection':_0x78aef6[_0x3addc9(0x11c)],..._0x78aef6[_0x3addc9(0x14c)]!==undefined&&{'all_columns':_0x78aef6['all_columns']},..._0x78aef6[_0x3addc9(0x158)]!==undefined&&{'columns':_0x78aef6[_0x3addc9(0x158)]},..._0x78aef6['behavior']!==undefined&&{'behavior':_0x78aef6['behavior']},..._0x78aef6[_0x3addc9(0xfc)]!==undefined&&{'schedule':_0x78aef6[_0x3addc9(0xfc)]},..._0x78aef6['notification']!==undefined&&{'notification':_0x78aef6[_0x3addc9(0x145)]},..._0x78aef6[_0x3addc9(0x91)]!==undefined&&{'connector_config':_0x78aef6[_0x3addc9(0x91)]},..._0x78aef6['activation_template_id']!==undefined&&{'activation_template_id':_0x78aef6[_0x3addc9(0x117)]}};return stableStringify(_0x54b921);}async function fetchSegment(_0x5b22bd,_0xe3f738,_0x27e5e6,_0x11dc2b){const _0x3d1b29=a152_0x46b3ac,_0x323933=_0x11dc2b?.[_0x3d1b29(0x8c)](_0x8c2bda=>_0x8c2bda['id']===_0x27e5e6);if(_0x323933)return _0x323933;try{return await _0x5b22bd[_0x3d1b29(0xed)][_0x3d1b29(0xc6)](_0xe3f738,_0x27e5e6);}catch(_0x3f9a43){logger[_0x3d1b29(0xf5)]('getSegment\x20failed\x20for\x20'+_0x27e5e6+_0x3d1b29(0x83)+_0x3f9a43);try{return await _0x5b22bd[_0x3d1b29(0xed)][_0x3d1b29(0x150)](_0x27e5e6);}catch(_0x4f4541){return logger[_0x3d1b29(0xf5)](_0x3d1b29(0x8b)+_0x27e5e6+':\x20'+_0x4f4541),null;}}}function recoverSegmentIdsFromPushRecovery(_0x1c6ec8,_0x1a3576,_0x4d3552){const _0x581e67=a152_0x46b3ac,_0x509c71=readPushRecovery(_0x1c6ec8[_0x581e67(0x148)]);if(_0x509c71?.[_0x581e67(0x113)]===_0x1c6ec8[_0x581e67(0x16d)][_0x581e67(0xb7)])for(const [_0xd668d4,_0x471bfe]of Object[_0x581e67(0x7b)](_0x509c71[_0x581e67(0x154)])){const _0x513dcb=generateDeterministicJourneySegmentName(_0x1c6ec8[_0x581e67(0x16d)][_0x581e67(0xb7)],_0xd668d4);_0x471bfe['uniqueServerName']===_0x513dcb&&(_0x1a3576[_0x581e67(0xa7)](_0xd668d4,_0x471bfe[_0x581e67(0x99)]),_0x4d3552['set'](_0xd668d4,_0x471bfe['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x390a26,_0x4a636d,_0x4b0825,_0x3af0eb){const _0x1eb5dc=a152_0x46b3ac;let _0x17fc2b;try{_0x17fc2b=await _0x390a26[_0x1eb5dc(0xed)][_0x1eb5dc(0xa4)]({'name':_0x4b0825[_0x1eb5dc(0x122)],'description':_0x4b0825[_0x1eb5dc(0xb6)],'journeyId':_0x4b0825[_0x1eb5dc(0x163)],'rule':_0x3af0eb(_0x4b0825[_0x1eb5dc(0xb5)],!![]),'countPopulation':!![],'parentFolderId':_0x4b0825[_0x1eb5dc(0xa3)],'audienceId':_0x4b0825[_0x1eb5dc(0xd7)]});}catch(_0x229b76){const _0x7d21c=_0x229b76 instanceof Error&&_0x229b76[_0x1eb5dc(0xae)][_0x1eb5dc(0x169)](_0x1eb5dc(0x12b));if(_0x7d21c){const _0x6891ac=readPushRecovery(_0x4a636d['absolutePath']),_0x1b2fb8=_0x6891ac?.['journeyName']===_0x4a636d[_0x1eb5dc(0x16d)][_0x1eb5dc(0xb7)]?_0x6891ac[_0x1eb5dc(0x154)][_0x4b0825[_0x1eb5dc(0xbd)]]:undefined;if(_0x1b2fb8?.[_0x1eb5dc(0x14f)]===_0x4b0825[_0x1eb5dc(0x122)])await _0x390a26['segment'][_0x1eb5dc(0x13e)](_0x4b0825[_0x1eb5dc(0xd7)],_0x1b2fb8['segmentId'],{'description':_0x4b0825[_0x1eb5dc(0xb6)],'rule':_0x3af0eb(_0x4b0825['resolvedRule'],!![]),'countPopulation':!![]}),_0x17fc2b=_0x1b2fb8[_0x1eb5dc(0x99)];else throw new SDKError(ErrorCode[_0x1eb5dc(0x90)],_0x1eb5dc(0x157)+_0x4b0825['localName']+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+(_0x1eb5dc(0x8e)+_0x4a636d[_0x1eb5dc(0x148)]['replace'](/([^/]+)$/,_0x1eb5dc(0x159))+')\x20')+_0x1eb5dc(0x16c),_0x229b76);}else throw _0x229b76;}return saveSegmentToPushRecovery(_0x4a636d[_0x1eb5dc(0x148)],_0x4a636d[_0x1eb5dc(0x16d)]['name'],_0x4b0825[_0x1eb5dc(0xbd)],{'segmentId':_0x17fc2b,'uniqueServerName':_0x4b0825[_0x1eb5dc(0x122)],'createdAt':new Date()[_0x1eb5dc(0x111)]()}),_0x17fc2b;}export async function prepareSegmentFiles(_0x25a031,_0x915dd1,_0x1f5f1e,_0x53bb5f,_0x447227){const _0x1d6ea3=a152_0x46b3ac,{activationDefToCreateRequest:_0x588ab9}=await import(_0x1d6ea3(0x172)),_0x3cb753=[],_0x54dc7e=new Set();for(const {yamlConfig:_0x25cb7f,folderPath:_0x5526ab,sourcePath:_0x9daa8d}of _0x25a031){const _0x20aa64=resolveTDFolderPath(_0x5526ab,_0x53bb5f,_0x447227),_0x13dbd8=_0x20aa64+':'+_0x25cb7f[_0x1d6ea3(0xb7)],_0x1a1c8e=_0x915dd1[_0x1d6ea3(0xf2)]['get'](_0x13dbd8),_0x221d6d=_0x1a1c8e?_0x915dd1[_0x1d6ea3(0x8d)]['get'](_0x1a1c8e['id'])||[]:[];addFoldersToCreate(_0x20aa64,_0x915dd1[_0x1d6ea3(0x77)],_0x54dc7e);const _0x32c650=calculateActivationActions(_0x25cb7f[_0x1d6ea3(0x17a)]||[],_0x221d6d,_0x915dd1[_0x1d6ea3(0x15a)],_0x915dd1[_0x1d6ea3(0xdc)]);for(const _0x5339c3 of _0x32c650){(_0x5339c3['type']===_0x1d6ea3(0xac)||_0x5339c3[_0x1d6ea3(0xf9)]==='update')&&_0x5339c3['yamlActivation']&&(_0x5339c3[_0x1d6ea3(0x176)]=await _0x588ab9(_0x5339c3[_0x1d6ea3(0x78)],_0x1f5f1e));}const _0x341b65=calculateSegmentDiff(_0x25cb7f,_0x1a1c8e,_0x221d6d,_0x915dd1[_0x1d6ea3(0x15a)],_0x915dd1['connectionIdToNameMap']);_0x3cb753['push']({'relativePath':_0x25cb7f[_0x1d6ea3(0xb7)],'absolutePath':_0x9daa8d,'yamlConfig':_0x25cb7f,'folderPath':_0x20aa64,'existingSegment':_0x1a1c8e,'existingActivations':_0x221d6d,'isNew':_0x341b65[_0x1d6ea3(0x14b)],'hasChanges':_0x341b65[_0x1d6ea3(0x137)],'diff':_0x341b65['diff'],'activationActions':_0x32c650});}return{'segmentFiles':_0x3cb753,'foldersToCreate':_0x54dc7e};}export async function prepareJourneyFiles(_0x5997fd,_0xbaa44d,_0x2c8f7,_0x5ee180){const _0x2d69c0=a152_0x46b3ac,_0x57beb2=[],_0x291aee=new Set();for(const {yamlConfig:_0x23dda7,folderPath:_0x5ebd5f,sourcePath:_0x34d8a9}of _0x5997fd){const _0x1ab4cd=resolveTDFolderPath(_0x5ebd5f,_0x2c8f7,_0x5ee180),_0x583a86=_0x1ab4cd+':'+_0x23dda7[_0x2d69c0(0xb7)],_0x580dea=_0xbaa44d[_0x2d69c0(0x70)][_0x2d69c0(0x13c)](_0x583a86);let _0x4e609c,_0x18a20f;if(_0x580dea&&_0x580dea['length']>0x0){const _0x33be12=buildLocalExpandedRuleMappings(_0x23dda7),{createYamlContext:_0xe052df,prefetchJourneySegments:_0x4346e8}=createPushYamlContextForBundle(_0xbaa44d[_0x2d69c0(0x104)],_0xbaa44d[_0x2d69c0(0xd7)],_0xbaa44d[_0x2d69c0(0x136)],_0x33be12,_0xbaa44d['idToEmailMap'],_0xbaa44d[_0x2d69c0(0xdc)],_0xbaa44d[_0x2d69c0(0x146)],_0xbaa44d[_0x2d69c0(0x8a)]);await _0x4346e8(_0x580dea[_0x2d69c0(0x13f)](_0x51e485=>_0x51e485['id']));const _0x4a4e97=await _0xbaa44d[_0x2d69c0(0x104)]['journey'][_0x2d69c0(0x72)](_0x580dea[0x0]['journeyBundleId']),_0x9a7602=hasMultipleVersions(_0x23dda7),_0x221f48=async _0x1baee7=>{const _0x53d132=_0x2d69c0,_0x54dccd=_0xbaa44d[_0x53d132(0x8a)]?.['get'](_0x1baee7);if(_0x54dccd)return _0x54dccd;return _0xbaa44d[_0x53d132(0xc8)]({'journeyId':_0x1baee7,'journeyName':_0x23dda7[_0x53d132(0xb7)],'isMultiVersion':_0x580dea['length']>0x1});};if(_0x9a7602&&_0x580dea['length']>0x1){const _0x1b69f2=[];for(const _0x2434fb of _0x580dea){const _0x2719b9=_0x2434fb[_0x2d69c0(0x7e)]||0x1;_0xbaa44d[_0x2d69c0(0xd5)]?.[_0x2d69c0(0x103)]('Fetching\x20'+_0x23dda7[_0x2d69c0(0xb7)]+'\x20v'+_0x2719b9);const _0x3b39eb=await _0x221f48(_0x2434fb['id']),_0x3abc71=_0xe052df(_0x2434fb['id']),_0x3979b3=await journeyResponseToDef(_0x3b39eb,_0x3abc71);_0x1b69f2[_0x2d69c0(0xe2)]({'item':_0x2434fb,'yaml':_0x3979b3});}const _0x4ffb33=buildLocalRuleToNameMappingFromJourney(_0x23dda7);_0x18a20f=buildMergedJourneyDef(_0x1b69f2,_0x4ffb33,_0x4a4e97);const _0x432130=Math[_0x2d69c0(0x17c)](..._0x1b69f2[_0x2d69c0(0x13f)](_0x3c5dc7=>_0x3c5dc7[_0x2d69c0(0x155)][_0x2d69c0(0x7e)]||0x0)),_0x4b755c=_0x580dea['find'](_0x3606d6=>(_0x3606d6[_0x2d69c0(0x7e)]||0x0)===_0x432130);_0x4b755c&&(_0xbaa44d[_0x2d69c0(0xd5)]?.['update']('Fetching\x20'+_0x23dda7[_0x2d69c0(0xb7)]+'\x20v'+_0x432130),_0x4e609c=await _0x221f48(_0x4b755c['id']));}else{const _0x597906=_0x580dea[_0x580dea[_0x2d69c0(0xcb)]-0x1];_0xbaa44d[_0x2d69c0(0xd5)]?.['update'](_0x2d69c0(0x81)+_0x23dda7[_0x2d69c0(0xb7)]),_0x4e609c=await _0x221f48(_0x597906['id']);const _0x191de9=_0xe052df(_0x597906['id']),_0x1097e3=await journeyResponseToDef(_0x4e609c,_0x191de9),_0x5514fb=buildLocalRuleToNameMappingFromJourney(_0x23dda7);_0x18a20f=buildMergedJourneyDef([{'item':_0x597906,'yaml':_0x1097e3}],_0x5514fb,_0x4a4e97);}}addFoldersToCreate(_0x1ab4cd,_0xbaa44d[_0x2d69c0(0x77)],_0x291aee);const _0xc04d86=calculateJourneyDiff(_0x23dda7,_0x18a20f);_0x57beb2[_0x2d69c0(0xe2)]({'relativePath':_0x23dda7[_0x2d69c0(0xb7)],'absolutePath':_0x34d8a9,'yamlConfig':_0x23dda7,'folderPath':_0x1ab4cd,'existingJourney':_0x4e609c,'isNew':_0xc04d86['isNew'],'hasChanges':_0xc04d86[_0x2d69c0(0x137)],'diff':_0xc04d86[_0x2d69c0(0x173)]});}return{'journeyFiles':_0x57beb2,'foldersToCreate':_0x291aee};}export function calculateActivationActions(_0x687ae3,_0x105777,_0x14739b,_0x3c4ec6){const _0x32c29c=a152_0x46b3ac,_0x156e6a=[],_0x32e53e=new Map();for(const _0x5566c5 of _0x105777){_0x32e53e[_0x32c29c(0xa7)](_0x5566c5['name'],_0x5566c5);}const _0x174544=new Map();for(const _0x4e9fe2 of _0x687ae3){_0x174544['set'](_0x4e9fe2[_0x32c29c(0xb7)],_0x4e9fe2);}for(const _0x3bb398 of _0x687ae3){const _0x3018d0=_0x32e53e[_0x32c29c(0x13c)](_0x3bb398[_0x32c29c(0xb7)]);if(!_0x3018d0)_0x156e6a[_0x32c29c(0xe2)]({'type':'create','name':_0x3bb398[_0x32c29c(0xb7)],'yamlActivation':_0x3bb398});else{const _0x12f10f=activationResponseToDef(_0x3018d0,_0x14739b,_0x3c4ec6),_0x567767=a152_0x5ceb99[_0x32c29c(0x89)](_0x12f10f),_0x159d2c=a152_0x5ceb99['stringify'](_0x3bb398);_0x567767!==_0x159d2c&&_0x156e6a['push']({'type':_0x32c29c(0x103),'name':_0x3bb398['name'],'yamlActivation':_0x3bb398,'existingActivation':_0x3018d0});}}for(const _0x5c5aad of _0x105777){!_0x174544[_0x32c29c(0xdf)](_0x5c5aad[_0x32c29c(0xb7)])&&_0x156e6a[_0x32c29c(0xe2)]({'type':_0x32c29c(0x165),'name':_0x5c5aad[_0x32c29c(0xb7)],'existingActivation':_0x5c5aad});}return _0x156e6a;}function calculateYamlDiff(_0x50c5be,_0xde754b){if(_0xde754b){const _0xa8f14c=generateDiff(_0xde754b,_0x50c5be),_0x17745a=hasChanges(_0xa8f14c);return{'isNew':![],'hasChanges':_0x17745a,'diff':_0x17745a?formatDiffWithColors(_0xa8f14c):undefined};}const _0x47b25e=generateDiff('',_0x50c5be);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x47b25e)};}export function calculateSegmentDiff(_0x2d1ad4,_0x3176ae,_0x19bfa9,_0x5a3a1c,_0x3d0a41){const _0x50e2c2=segmentToYamlString(_0x2d1ad4),_0x41b556=_0x3176ae?segmentToYamlString(segmentWithActivationsToYaml(_0x3176ae,_0x19bfa9,undefined,_0x5a3a1c,_0x3d0a41)):undefined;return calculateYamlDiff(_0x50e2c2,_0x41b556);}export function calculateJourneyDiff(_0x11f691,_0x542f12){const _0x18bb0d=normalizeJourneyDef(_0x11f691,_0x11f691),_0x3b2555=a152_0x5cd7f7(_0x18bb0d),_0x1f2cb4=_0x542f12?a152_0x5cd7f7(normalizeJourneyDef(_0x542f12,_0x11f691)):undefined;return calculateYamlDiff(_0x3b2555,_0x1f2cb4);}export function findSegmentsToDelete(_0x666222,_0x42a313,_0x3ccdef,_0x47ff64,_0x326504){const _0x507bab=a152_0x46b3ac,_0x4fb8d9=new Set();for(const {yamlConfig:_0x21857f,folderPath:_0x56f3d0}of _0x42a313){_0x4fb8d9[_0x507bab(0xb3)](_0x56f3d0+':'+_0x21857f['name']);}return _0x666222[_0x507bab(0x74)](_0x28f3a3=>{const _0x2ff8c2=_0x507bab,_0x1b0646=_0x28f3a3[_0x2ff8c2(0xe6)]?_0x3ccdef[_0x2ff8c2(0x13c)](_0x28f3a3[_0x2ff8c2(0xe6)][_0x2ff8c2(0x127)]())||'':'',_0x32f86d=_0x1b0646+':'+_0x28f3a3[_0x2ff8c2(0xb7)];if(_0x4fb8d9[_0x2ff8c2(0xdf)](_0x32f86d))return![];if(_0x326504)return _0x1b0646===_0x47ff64||_0x1b0646[_0x2ff8c2(0x9f)](_0x47ff64+'/');return!![];});}export function findJourneysToDelete(_0x54d2f4,_0x42ecb8,_0x1138e6,_0x311782,_0x45ebed){const _0x486dd1=a152_0x46b3ac,_0x10f99e=new Set();for(const {yamlConfig:_0x5768b1,folderPath:_0x1ac6eb}of _0x42ecb8){_0x10f99e[_0x486dd1(0xb3)](_0x1ac6eb+':'+_0x5768b1[_0x486dd1(0xb7)]);}return _0x54d2f4['filter'](_0x37747b=>{const _0x1def96=_0x486dd1,_0x25c4c4=_0x37747b[_0x1def96(0xa3)]?_0x1138e6['get'](_0x37747b[_0x1def96(0xa3)])||'':'',_0x5a74e2=_0x25c4c4+':'+_0x37747b[_0x1def96(0x110)];if(_0x10f99e['has'](_0x5a74e2))return![];if(_0x45ebed)return _0x25c4c4===_0x311782||_0x25c4c4[_0x1def96(0x9f)](_0x311782+'/');return!![];});}export function buildSegmentLookupMap(_0x1fd9f7,_0xe59b45){const _0x20e28b=a152_0x46b3ac,_0x53b9a3=new Map();for(const _0x5af4bd of _0x1fd9f7){const _0x31d423=_0x5af4bd['segmentFolderId']?_0xe59b45[_0x20e28b(0x13c)](_0x5af4bd[_0x20e28b(0xe6)]['toString']())||'':'',_0xe017ae=_0x31d423+':'+_0x5af4bd['name'];_0x53b9a3[_0x20e28b(0xa7)](_0xe017ae,_0x5af4bd);}return _0x53b9a3;}export function buildSegmentNameToIdMap(_0x17a12c){const _0x2be511=a152_0x46b3ac,_0x1c954e=new Map();for(const _0x1f6040 of _0x17a12c){_0x1c954e[_0x2be511(0xa7)](_0x1f6040[_0x2be511(0xb7)],_0x1f6040['id']);}return _0x1c954e;}export function buildJourneyBundleLookupMap(_0x4cc3db,_0x117fac){const _0x349725=a152_0x46b3ac,_0x10d048=new Map();for(const _0x246f89 of _0x4cc3db){const _0x3d0153=_0x246f89['folderId']?_0x117fac[_0x349725(0x13c)](_0x246f89[_0x349725(0xa3)])||'':'',_0x37ba88=_0x3d0153+':'+_0x246f89[_0x349725(0x110)];!_0x10d048['has'](_0x37ba88)&&_0x10d048['set'](_0x37ba88,[]),_0x10d048['get'](_0x37ba88)[_0x349725(0xe2)](_0x246f89);}for(const _0x5a9bce of _0x10d048[_0x349725(0x106)]()){_0x5a9bce['sort']((_0x54a9d1,_0x3bfcd6)=>(_0x54a9d1[_0x349725(0x7e)]||0x0)-(_0x3bfcd6[_0x349725(0x7e)]||0x0));}return _0x10d048;}export function collectFoldersToCreate(_0x15d2d4,_0x227283){const _0x13313e=a152_0x46b3ac,_0x3ff570=new Set();for(const _0x430ac4 of _0x15d2d4){if(!_0x430ac4)continue;if(_0x227283['has'](_0x430ac4))continue;const _0x31abde=_0x430ac4['split']('/');let _0xdb4f13='';for(const _0x2f078b of _0x31abde){_0xdb4f13=_0xdb4f13?_0xdb4f13+'/'+_0x2f078b:_0x2f078b,!_0x227283[_0x13313e(0xdf)](_0xdb4f13)&&_0x3ff570[_0x13313e(0xb3)](_0xdb4f13);}}return _0x3ff570;}export function parseAndClassifyYamlFiles(_0xd5fa0,_0x1d0b92,_0x5a4b70){const _0x187028=a152_0x46b3ac,_0x116dc4=[],_0x4bd226=[];for(const _0xb54a07 of _0xd5fa0){const _0x2d7b54=a152_0x5f585d[_0x187028(0x143)](_0x1d0b92,a152_0x5f585d['dirname'](_0xb54a07)),_0x3acce7=_0x2d7b54==='.'?'':_0x2d7b54,_0x2c0bdb=readFileSync(_0xb54a07,'utf-8'),_0x1c73f4=a152_0x5ceb99[_0x187028(0x10e)](_0x2c0bdb);if(isJourneyDef(_0x1c73f4)){const _0xcc57c8=a152_0x3b83a8(_0x2c0bdb);_0x4bd226['push']({'yamlConfig':_0xcc57c8,'folderPath':_0x3acce7,'sourcePath':_0xb54a07});}else{if(!_0x5a4b70?.[_0x187028(0x179)]){const _0x22ef4c=parseSegmentYamlFile(_0x2c0bdb),_0x36dc00=normalizeChildSegmentYaml(_0x22ef4c);_0x116dc4[_0x187028(0xe2)]({'yamlConfig':_0x36dc00,'folderPath':_0x3acce7,'sourcePath':_0xb54a07});}}}return{'segments':_0x116dc4,'journeys':_0x4bd226};}export function validateParsedFiles(_0x35f4fb,_0x11cc65){const _0x5ae169=a152_0x46b3ac,_0xffaa55=[];for(const {yamlConfig:_0x21a463,sourcePath:_0x552c94}of _0x35f4fb[_0x5ae169(0x154)]){const _0x5f1d24=readFileSync(_0x552c94,_0x5ae169(0x9e)),_0x2e70e3=a152_0x5ceb99[_0x5ae169(0xdb)](_0x5f1d24),_0x5da625=validateSegmentDef(_0x21a463,{'source':_0x5f1d24,'document':_0x2e70e3},{'skipSchema':!![]});if(!_0x5da625[_0x5ae169(0x98)]){const _0x28e01c=a152_0x5f585d[_0x5ae169(0x143)](_0x11cc65,_0x552c94);_0xffaa55['push']({'filePath':_0x28e01c,'source':_0x5f1d24,'result':_0x5da625,'isJourney':![]});}}for(const {yamlConfig:_0x3dd42d,sourcePath:_0x1b519c}of _0x35f4fb[_0x5ae169(0xee)]){const _0x1315bf=readFileSync(_0x1b519c,_0x5ae169(0x9e)),_0x477556=a152_0x5ceb99[_0x5ae169(0xdb)](_0x1315bf),_0x3a23ee=validateJourneyDef(_0x3dd42d,{'source':_0x1315bf,'document':_0x477556},{'skipSchema':!![]});if(!_0x3a23ee[_0x5ae169(0x98)]){const _0x5308bd=a152_0x5f585d[_0x5ae169(0x143)](_0x11cc65,_0x1b519c);_0xffaa55[_0x5ae169(0xe2)]({'filePath':_0x5308bd,'source':_0x1315bf,'result':_0x3a23ee,'isJourney':!![]});}}return _0xffaa55;}export function formatValidationErrors(_0x9a54f3){const _0x20dab4=a152_0x46b3ac,_0x2650f6=[];for(const {filePath:_0x4fd0f2,source:_0x4e181a,result:_0x31bfce,isJourney:_0x4d312c}of _0x9a54f3){const _0x8c71f2=_0x4d312c?_0x20dab4(0x116):_0x20dab4(0xed);_0x2650f6[_0x20dab4(0xe2)]('\x0a'+_0x4fd0f2+'\x20('+_0x8c71f2+_0x20dab4(0xef)+_0x31bfce['errors'][_0x20dab4(0xcb)]+_0x20dab4(0x114)),_0x2650f6[_0x20dab4(0xe2)](formatValidationResult(_0x31bfce,_0x4e181a,_0x4fd0f2));}return _0x2650f6[_0x20dab4(0xf8)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x224a87){const _0x483ca2=a152_0x46b3ac,_0x3e9d9b=new Set(),_0x31b8dc=new Map(),_0xc90af8=collectSegmentUsageCounts(_0x224a87);if(_0x224a87[_0x483ca2(0x154)])for(const [_0x260cae,_0x3711c9]of Object[_0x483ca2(0x7b)](_0x224a87['segments'])){_0x3e9d9b[_0x483ca2(0xb3)](_0x260cae);if(_0x3711c9[_0x483ca2(0x100)]){const _0x1fad22=yamlRuleToApi(_0x3711c9[_0x483ca2(0x100)]),_0x57c2f6=apiRuleToYaml(_0x1fad22);_0x31b8dc['set'](_0x260cae,_0x57c2f6);}}const _0x4362e1=new Map();let _0x7c0231=0x0;for(const [_0x35a361,_0x52f787]of _0x31b8dc){const _0x160ad9=serializeExpandedRule(_0x52f787,_0x31b8dc),_0x284e1c=_0x4362e1[_0x483ca2(0x13c)](_0x160ad9)||[];_0x284e1c[_0x483ca2(0xe2)]({'name':_0x35a361,'index':_0x7c0231}),_0x4362e1['set'](_0x160ad9,_0x284e1c),_0x7c0231++;}const _0x32ec1d=new Map();for(const [_0x3b1c35,_0x47404b]of _0x4362e1){const _0x409763=_0x47404b[_0x483ca2(0x138)]()[_0x483ca2(0x15b)]((_0x339ecf,_0x4112d2)=>{const _0x28d053=_0x483ca2,_0x57cf8d=_0xc90af8[_0x28d053(0x13c)](_0x339ecf['name'])||0x0,_0x55e810=_0xc90af8[_0x28d053(0x13c)](_0x4112d2[_0x28d053(0xb7)])||0x0;if(_0x57cf8d!==_0x55e810)return _0x55e810-_0x57cf8d;return _0x339ecf['index']-_0x4112d2[_0x28d053(0x14d)];})[_0x483ca2(0x13f)](_0x108488=>_0x108488[_0x483ca2(0xb7)]),_0x7b323a=[];for(const _0x31e3ad of _0x409763){const _0x173bf0=_0xc90af8[_0x483ca2(0x13c)](_0x31e3ad)||0x0,_0x12904b=Math[_0x483ca2(0x17c)](_0x173bf0,0x1);for(let _0x470a89=0x0;_0x470a89<_0x12904b;_0x470a89++){_0x7b323a[_0x483ca2(0xe2)](_0x31e3ad);}}_0x32ec1d[_0x483ca2(0xa7)](_0x3b1c35,_0x7b323a);}return{'existingLocalSegmentNames':_0x3e9d9b,'localSegmentRules':_0x31b8dc,'localExpandedRuleToNames':_0x32ec1d};}export function createSegmentIdResolver(_0x3cbbcd,_0x4d5d62){return async _0x4d872a=>{const _0x4de166=a152_0x5983,_0x6a5815=_0x3cbbcd['get'](_0x4d872a);if(!_0x6a5815)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20not\x20found:\x20'+_0x4d872a+_0x4de166(0x11b)+_0x4d5d62+'\x27)');return _0x6a5815;};}export function extractRootFolderId(_0x3ccc38){const _0x2ae108=a152_0x46b3ac;return _0x3ccc38['relationships']?.[_0x2ae108(0x76)]?.[_0x2ae108(0x9b)]?.['id']||_0x3ccc38[_0x2ae108(0x168)]?.['parentFolder']?.[_0x2ae108(0x9b)]?.['id'];}export function buildConnectionMaps(_0x11e9a8){const _0x14562d=a152_0x46b3ac,_0x58e6fc=new Map(),_0x8fd1f5=new Map(),_0x322160=new Map();for(const _0x47a5ce of _0x11e9a8){_0x58e6fc[_0x14562d(0xa7)](_0x47a5ce[_0x14562d(0xb7)],parseInt(_0x47a5ce['id'],0xa)),_0x8fd1f5[_0x14562d(0xa7)](_0x47a5ce['id'],_0x47a5ce['name']),_0x322160['set'](_0x47a5ce[_0x14562d(0xb7)],_0x47a5ce['type']);}return{'nameToId':_0x58e6fc,'idToName':_0x8fd1f5,'nameToType':_0x322160};}export function calculatePushStats(_0x1dc51f,_0x5f4ecd,_0x811d3d,_0x4893f5,_0x46f26a,_0x30b662,_0x316e30){const _0x1956b4=a152_0x46b3ac,_0x5b83e3=_0x1dc51f[_0x1956b4(0x74)](_0x58b592=>_0x58b592[_0x1956b4(0x14b)]),_0x206fa4=_0x1dc51f[_0x1956b4(0x74)](_0x1230c0=>!_0x1230c0[_0x1956b4(0x14b)]&&_0x1230c0['hasChanges']),_0x2d07a1=_0x1dc51f[_0x1956b4(0x74)](_0x40ec73=>!_0x40ec73[_0x1956b4(0x14b)]&&!_0x40ec73[_0x1956b4(0x137)]),_0x387cfb=_0x30b662?_0x4893f5:[],_0x330f8f=_0x5f4ecd[_0x1956b4(0x74)](_0x502423=>_0x502423[_0x1956b4(0x14b)]),_0x49d84f=_0x5f4ecd[_0x1956b4(0x74)](_0x1f18d0=>!_0x1f18d0[_0x1956b4(0x14b)]&&_0x1f18d0['hasChanges']),_0x5ba7c2=_0x5f4ecd[_0x1956b4(0x74)](_0x14f6db=>!_0x14f6db[_0x1956b4(0x14b)]&&!_0x14f6db['hasChanges']),_0x11626f=_0x30b662?_0x46f26a:[],_0xf77ce=_0x1dc51f[_0x1956b4(0xe8)](_0x3b1835=>_0x3b1835[_0x1956b4(0x96)]),_0x1affd9=_0xf77ce['filter'](_0x355377=>_0x355377[_0x1956b4(0xf9)]==='create'),_0x5315b1=_0xf77ce['filter'](_0x443f7b=>_0x443f7b[_0x1956b4(0xf9)]===_0x1956b4(0x103)),_0x2037c7=_0xf77ce[_0x1956b4(0x74)](_0x273ac6=>_0x273ac6[_0x1956b4(0xf9)]==='delete'),_0x56b9ea=Array[_0x1956b4(0xad)](_0x811d3d)[_0x1956b4(0x15b)](),_0x42af78=_0x316e30?![]:_0x5b83e3['length']>0x0||_0x206fa4[_0x1956b4(0xcb)]>0x0||_0x387cfb[_0x1956b4(0xcb)]>0x0,_0x2f6661=_0x330f8f[_0x1956b4(0xcb)]>0x0||_0x49d84f[_0x1956b4(0xcb)]>0x0||_0x11626f[_0x1956b4(0xcb)]>0x0,_0x4e4e5b=_0x316e30?![]:_0xf77ce['length']>0x0,_0x4bc9c4=_0x56b9ea[_0x1956b4(0xcb)]>0x0;return{'segments':{'new':_0x5b83e3,'changed':_0x206fa4,'unchanged':_0x2d07a1,'toDelete':_0x387cfb},'journeys':{'new':_0x330f8f,'changed':_0x49d84f,'unchanged':_0x5ba7c2,'toDelete':_0x11626f},'activations':{'all':_0xf77ce,'toCreate':_0x1affd9,'toUpdate':_0x5315b1,'toDelete':_0x2037c7},'folders':{'toCreate':_0x56b9ea},'counts':{'segments':{'new':_0x5b83e3['length'],'changed':_0x206fa4[_0x1956b4(0xcb)],'unchanged':_0x2d07a1[_0x1956b4(0xcb)],'toDelete':_0x387cfb['length']},'journeys':{'new':_0x330f8f[_0x1956b4(0xcb)],'changed':_0x49d84f[_0x1956b4(0xcb)],'unchanged':_0x5ba7c2[_0x1956b4(0xcb)],'toDelete':_0x11626f[_0x1956b4(0xcb)]},'activations':{'create':_0x1affd9[_0x1956b4(0xcb)],'update':_0x5315b1['length'],'delete':_0x2037c7[_0x1956b4(0xcb)]},'folders':_0x56b9ea['length']},'hasChanges':_0x42af78||_0x2f6661||_0x4e4e5b||_0x4bc9c4};}export async function buildPushExecutionContext(_0x2a90f7,_0x4272b4,_0x341da4,_0x6150f4,_0x298333,_0x30971c){const _0x2e465a=a152_0x46b3ac,_0x4b5805=extractRootFolderId(_0x341da4),{pathToId:_0x26cf44,idToPath:_0x15e5b0}=buildFolderMaps(_0x298333),_0xb182d7=buildSegmentNameToIdMap(_0x6150f4),_0x413e54=new Map(),{batchAsync:_0x4771d2}=await import('../../utils/async.js'),[_0x192625,_0x2ab90e]=await Promise[_0x2e465a(0x140)]([_0x2a90f7[_0x2e465a(0x7d)][_0x2e465a(0x15f)](),_0x2a90f7[_0x2e465a(0x11c)][_0x2e465a(0x80)](),((async()=>{const _0x162a80=_0x2e465a;!_0x30971c&&_0x6150f4[_0x162a80(0xcb)]>0x0&&await _0x4771d2(_0x6150f4,async _0x268dd8=>{const _0x38942e=_0x162a80,_0x1b496f=await _0x2a90f7[_0x38942e(0xed)][_0x38942e(0xa9)](_0x4272b4,_0x268dd8['id']);_0x413e54[_0x38942e(0xa7)](_0x268dd8['id'],_0x1b496f);});})())]),{emailToId:_0x22f77f,idToEmail:_0x40134e}=_0x192625,_0x2c3408=buildConnectionMaps(_0x2ab90e);return{'rootFolderId':_0x4b5805,'folderPathToId':_0x26cf44,'folderIdToPath':_0x15e5b0,'segmentNameToId':_0xb182d7,'activationsBySegmentId':_0x413e54,'emailToIdMap':_0x22f77f,'idToEmailMap':_0x40134e,'connectionNameToIdMap':_0x2c3408[_0x2e465a(0x10d)],'connectionIdToNameMap':_0x2c3408['idToName'],'connectionNameToTypeMap':_0x2c3408['nameToType']};}export function createPushYamlContextForBundle(_0x5271a7,_0x4c2aa8,_0x235722,_0xd33d27,_0x1bf163,_0x5af3fc,_0x3bcc6d,_0x3e6fc7){const {existingLocalSegmentNames:_0x4fb17d,localExpandedRuleToNames:_0x566823}=_0xd33d27,_0x436b1d=new Set(),_0x4b7f0b=new Map(),_0x23c33f=new Map(),_0xe8a921=new Map(),_0x401d71=createJumpTargetCache(),_0x472de7=new Map(),_0x39abfd=new Map(),_0x5c8c76=new Set();let _0x515dd6;const _0x397b56=_0x2976a0=>{const _0x32de97={'resolveSegment':async _0x19a27f=>{const _0x42cd52=a152_0x5983,_0x1e99af=_0xe8a921['get'](_0x19a27f);if(_0x1e99af!==undefined)return{'name':_0x1e99af,'isJourneyLocal':!![]};try{const _0x12ed26=await fetchSegment(_0x5271a7,_0x4c2aa8,_0x19a27f,_0x235722);if(!_0x12ed26)throw new Error('Segment\x20not\x20found');const _0x4a4177=generateJourneyLocalName(_0x12ed26[_0x42cd52(0xb7)]),_0xe59e63=_0x12ed26[_0x42cd52(0xd2)]===SEGMENT_KIND_JOURNEY&&_0x4a4177!==undefined;let _0x509500=_0x12ed26['name'],_0x6fb6b7;if(_0xe59e63&&_0x12ed26[_0x42cd52(0x100)]){const _0x547ffc=apiRuleToYaml(_0x12ed26[_0x42cd52(0x100)]);_0x39abfd[_0x42cd52(0xa7)](_0x19a27f,_0x547ffc);const _0x297458=async _0x395fe6=>{const _0x12e8d8=_0x42cd52,_0x4fff83=collectSegmentRefsFromRule(_0x395fe6);for(const _0x763e32 of _0x4fff83){if(!_0x39abfd[_0x12e8d8(0xdf)](_0x763e32))try{const _0x45cb46=await fetchSegment(_0x5271a7,_0x4c2aa8,_0x763e32,_0x235722);if(_0x45cb46?.['rule']){const _0xe5fd04=apiRuleToYaml(_0x45cb46[_0x12e8d8(0x100)]);_0x39abfd[_0x12e8d8(0xa7)](_0x763e32,_0xe5fd04),await _0x297458(_0xe5fd04);}}catch(_0x466a8f){logger[_0x12e8d8(0xf5)](_0x12e8d8(0x84)+_0x763e32+':\x20'+_0x466a8f);}}};await _0x297458(_0x547ffc);const _0x4c341c=serializeExpandedRule(_0x547ffc,_0x39abfd),_0x5426f8=_0x566823[_0x42cd52(0x13c)](_0x4c341c);if(_0x5426f8&&_0x5426f8['length']>0x0){const _0x3fad29=_0x4b7f0b['get'](_0x4c341c)||0x0,_0x601e70=_0x5426f8[_0x3fad29]||_0x5426f8[_0x5426f8[_0x42cd52(0xcb)]-0x1];_0x4b7f0b[_0x42cd52(0xa7)](_0x4c341c,_0x3fad29+0x1),_0x509500=_0x601e70,_0x436b1d[_0x42cd52(0xb3)](_0x509500),_0xe8a921[_0x42cd52(0xa7)](_0x19a27f,_0x509500);const _0x2e60f7=await resolveRuleSegmentRefs(_0x547ffc,async _0x59aab2=>{const _0x3a9c02=_0x42cd52,_0x257688=_0xe8a921['get'](_0x59aab2);if(_0x257688)return _0x257688;const _0x1123d1=await _0x515dd6[_0x3a9c02(0x129)](_0x59aab2);return _0x1123d1[_0x3a9c02(0xb7)];});_0x6fb6b7={'description':_0x12ed26[_0x42cd52(0xb6)],'rule':_0x2e60f7};}else{const _0x10ac34=_0x472de7[_0x42cd52(0x13c)](_0x4c341c);if(_0x10ac34)_0x509500=_0x10ac34,_0xe8a921[_0x42cd52(0xa7)](_0x19a27f,_0x509500);else{if(_0x4a4177){let _0x121bb7=_0x4a4177,_0x387140=0x2;while(_0x436b1d[_0x42cd52(0xdf)](_0x121bb7)||_0x4fb17d['has'](_0x121bb7)){_0x121bb7=_0x4a4177+'_'+_0x387140,_0x387140++;}_0x436b1d['add'](_0x121bb7),_0x509500=_0x121bb7;}_0xe8a921[_0x42cd52(0xa7)](_0x19a27f,_0x509500),_0x472de7[_0x42cd52(0xa7)](_0x4c341c,_0x509500);const _0x221de7=await resolveRuleSegmentRefs(_0x547ffc,async _0xec8334=>{const _0xdf6f2e=_0x42cd52,_0x3d84d4=_0xe8a921[_0xdf6f2e(0x13c)](_0xec8334);if(_0x3d84d4)return _0x3d84d4;const _0x1df438=await _0x515dd6[_0xdf6f2e(0x129)](_0xec8334);return _0x1df438['name'];});_0x6fb6b7={'description':_0x12ed26[_0x42cd52(0xb6)],'rule':_0x221de7};}}}return{'name':_0x509500,'isJourneyLocal':_0xe59e63,'definition':_0x6fb6b7};}catch(_0x16805e){return logger['debug'](_0x42cd52(0xf1)+_0x19a27f+':\x20'+_0x16805e),{'name':_0x19a27f,'isJourneyLocal':![]};}},'resolveActivation':async _0x2c7841=>{const _0x1c2c9c=a152_0x5983,_0x3b31b0=_0x23c33f[_0x1c2c9c(0x13c)](_0x2c7841);if(_0x3b31b0!==undefined)return{'name':_0x3b31b0,'isJourneyLocal':!![]};try{let _0x10d4fc=_0x3bcc6d?.[_0x1c2c9c(0x13c)](_0x2c7841);!_0x10d4fc&&(_0x10d4fc=await _0x5271a7[_0x1c2c9c(0x116)][_0x1c2c9c(0x149)](_0x2976a0,_0x2c7841));const _0x1cabb5=_0x10d4fc['attributes'][_0x1c2c9c(0x12c)]['name']||_0x2c7841,_0x4e10dd=sanitizeYamlKey(_0x1cabb5)||'activation_'+_0x2c7841,_0x128980=_0x4e10dd;_0x23c33f[_0x1c2c9c(0xa7)](_0x2c7841,_0x128980);const _0x5282c1=journeyActivationStepToYaml(_0x10d4fc,_0x1bf163,_0x5af3fc);return{'name':_0x128980,'isJourneyLocal':!![],'definition':_0x5282c1};}catch(_0x565490){return logger[_0x1c2c9c(0xf5)](_0x1c2c9c(0xbb)+_0x2c7841+':\x20'+_0x565490),{'name':_0x2c7841,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x4bceba,_0x475807)=>resolveJumpTarget(_0x4bceba,_0x475807,_0x401d71,async _0x3be4f6=>{const _0xdbc83f=a152_0x5983,_0x620dbf=_0x3e6fc7?.[_0xdbc83f(0x13c)](_0x3be4f6);if(_0x620dbf)return _0x620dbf;return _0x5271a7[_0xdbc83f(0x116)][_0xdbc83f(0xe3)](_0x3be4f6);})};return _0x515dd6=_0x32de97,_0x32de97;},_0x3d4f79=async _0x305b5c=>{const _0x212079=a152_0x5983,{collectSegmentIdsFromJourneyApi:_0x73c6f}=await import('./journey-yaml.js'),{batchAsync:_0x4dd739}=await import(_0x212079(0xe4)),_0x5af8bb=new Set();for(const _0x2c251b of _0x305b5c){let _0x1bb2e8=_0x3e6fc7?.[_0x212079(0x13c)](_0x2c251b);!_0x1bb2e8&&(_0x1bb2e8=await _0x5271a7[_0x212079(0x116)][_0x212079(0xe3)](_0x2c251b));const _0x5c277e=_0x73c6f(_0x1bb2e8);for(const _0x1120b0 of _0x5c277e){_0x5af8bb[_0x212079(0xb3)](_0x1120b0);}}let _0x37956f=Array[_0x212079(0xad)](_0x5af8bb);while(_0x37956f[_0x212079(0xcb)]>0x0){const _0x14d453=_0x37956f[_0x212079(0x74)](_0x3e73ab=>!_0x5c8c76[_0x212079(0xdf)](_0x3e73ab));if(_0x14d453[_0x212079(0xcb)]===0x0)break;const _0x4762b3=await _0x4dd739(_0x14d453,async _0x2a4050=>{_0x5c8c76['add'](_0x2a4050);const _0x24675e=await fetchSegment(_0x5271a7,_0x4c2aa8,_0x2a4050,_0x235722);if(!_0x24675e)return null;return{'segmentId':_0x2a4050,'segment':_0x24675e};},0xa),_0x407a85=new Set();for(const _0x5da5c8 of _0x4762b3){if(!_0x5da5c8?.[_0x212079(0xed)]?.['rule'])continue;const _0x5c4ef9=apiRuleToYaml(_0x5da5c8[_0x212079(0xed)]['rule']);_0x39abfd[_0x212079(0xa7)](_0x5da5c8[_0x212079(0x99)],_0x5c4ef9);const _0x3c4a98=collectSegmentRefsFromRule(_0x5c4ef9);for(const _0x5a7458 of _0x3c4a98){!_0x5c8c76[_0x212079(0xdf)](_0x5a7458)&&_0x407a85[_0x212079(0xb3)](_0x5a7458);}}_0x37956f=Array[_0x212079(0xad)](_0x407a85);}};return{'createYamlContext':_0x397b56,'prefetchJourneySegments':_0x3d4f79};}export async function executePushSegments(_0x42bf00,_0x32b4ac,_0x19353d,_0x70d0e3,_0x26c288){const _0xcc0335=a152_0x46b3ac,{segmentDefToCreateRequest:_0x5aba41,segmentDefToUpdateRequest:_0x47f4d8}=await import(_0xcc0335(0x172)),_0x1c8c19=_0x19353d[_0xcc0335(0x77)],_0xcf9b14=0x5,_0x322ddb=async _0x533865=>{const _0x26d6bb=_0xcc0335,_0x415a83=_0x533865['folderPath']?_0x1c8c19['get'](_0x533865[_0x26d6bb(0x13d)]):undefined;let _0x313fdd;const _0x5416a1={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x5173ad=_0x533865[_0x26d6bb(0x16d)];if(_0x533865[_0x26d6bb(0x16d)][_0x26d6bb(0x100)]){const _0x2206b2=createSegmentIdResolver(_0x19353d[_0x26d6bb(0x16b)],_0x533865[_0x26d6bb(0x16d)]['name']),_0x97aa76=await resolveRuleSegmentIds(_0x533865['yamlConfig'][_0x26d6bb(0x100)],_0x2206b2);_0x5173ad={..._0x533865[_0x26d6bb(0x16d)],'rule':_0x97aa76};}try{if(_0x533865['isNew']){_0x26c288[_0x26d6bb(0xc5)]?.({'type':'segment_creating','name':_0x533865[_0x26d6bb(0x16d)]['name']});const _0x163fae=_0x5aba41(_0x5173ad,_0x415a83),_0x2fcc19=await _0x26c288[_0x26d6bb(0x13a)](_0x26d6bb(0xfe)+_0x533865[_0x26d6bb(0x16d)][_0x26d6bb(0xb7)]+_0x26d6bb(0xfa),()=>_0x42bf00['segment'][_0x26d6bb(0x133)](_0x70d0e3[_0x26d6bb(0xd7)],_0x163fae));_0x313fdd=_0x2fcc19[_0x26d6bb(0x9b)]['id'],_0x19353d[_0x26d6bb(0x16b)][_0x26d6bb(0xa7)](_0x533865[_0x26d6bb(0x16d)][_0x26d6bb(0xb7)],_0x313fdd),_0x5416a1[_0x26d6bb(0x120)]={'name':_0x533865[_0x26d6bb(0x16d)][_0x26d6bb(0xb7)],'id':_0x313fdd},_0x26c288[_0x26d6bb(0xc5)]?.({'type':_0x26d6bb(0x15e),'name':_0x533865[_0x26d6bb(0x16d)][_0x26d6bb(0xb7)],'segmentId':_0x313fdd}),_0x26c288[_0x26d6bb(0x112)]?.(_0x26d6bb(0x7c)+_0x533865[_0x26d6bb(0x16d)][_0x26d6bb(0xb7)]+'\x27'),_0x5416a1[_0x26d6bb(0xda)]=0x1;}else{if(_0x533865[_0x26d6bb(0x137)]){_0x26c288[_0x26d6bb(0xc5)]?.({'type':_0x26d6bb(0x85),'name':_0x533865['yamlConfig']['name']});const _0x306eda=_0x47f4d8(_0x5173ad);_0x415a83!==_0x533865[_0x26d6bb(0xa5)]?.[_0x26d6bb(0xe6)]&&(_0x306eda[_0x26d6bb(0xe6)]=_0x415a83?parseInt(_0x415a83,0xa):undefined),await _0x26c288[_0x26d6bb(0x13a)](_0x26d6bb(0x10a)+_0x533865['yamlConfig']['name']+_0x26d6bb(0xfa),()=>_0x42bf00[_0x26d6bb(0xed)][_0x26d6bb(0x13e)](_0x70d0e3[_0x26d6bb(0xd7)],_0x533865[_0x26d6bb(0xa5)]['id'],_0x306eda)),_0x313fdd=_0x533865[_0x26d6bb(0xa5)]['id'],_0x26c288['onProgress']?.({'type':_0x26d6bb(0x94),'name':_0x533865[_0x26d6bb(0x16d)]['name']}),_0x26c288[_0x26d6bb(0x112)]?.('Updated\x20segment\x20\x27'+_0x533865[_0x26d6bb(0x16d)][_0x26d6bb(0xb7)]+'\x27'),_0x5416a1[_0x26d6bb(0x14a)]=0x1;}else _0x313fdd=_0x533865[_0x26d6bb(0xa5)]['id'];}}catch(_0x1d3bc9){const _0x3ab263=isHttp400Error(_0x1d3bc9),_0x27b5e8=_0x3ab263?ErrorCode[_0x26d6bb(0x17b)]:ErrorCode[_0x26d6bb(0x90)],_0x32d2b3=getErrorMessage(_0x1d3bc9);throw new SDKError(_0x27b5e8,_0x26d6bb(0xcd)+(_0x533865[_0x26d6bb(0x14b)]?'create':_0x26d6bb(0x103))+_0x26d6bb(0x79)+_0x533865['absolutePath']+_0x26d6bb(0x16e)+_0x32d2b3,_0x1d3bc9);}try{const _0xcddbec=await syncActivationsForSegment(_0x42bf00,_0x70d0e3[_0x26d6bb(0xd7)],_0x313fdd,_0x533865[_0x26d6bb(0x16d)][_0x26d6bb(0xb7)],_0x533865[_0x26d6bb(0x96)],_0x26c288,_0x533865['absolutePath']);_0x5416a1[_0x26d6bb(0x17a)]=_0xcddbec;}catch(_0x4f02e3){if(_0x4f02e3 instanceof SDKError)throw _0x4f02e3;throw new SDKError(ErrorCode[_0x26d6bb(0x124)],_0x26d6bb(0x156)+_0x533865[_0x26d6bb(0x16d)][_0x26d6bb(0xb7)]+_0x26d6bb(0x107)+_0x533865[_0x26d6bb(0x148)]+_0x26d6bb(0x16e)+getErrorMessage(_0x4f02e3),_0x4f02e3);}return _0x5416a1;},_0x5c3e7e=await batchAsync(_0x32b4ac,_0x322ddb,_0xcf9b14),_0x6ec1e9={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0xb0dcc8 of _0x5c3e7e){_0x6ec1e9[_0xcc0335(0xda)]+=_0xb0dcc8[_0xcc0335(0xda)],_0x6ec1e9['updated']+=_0xb0dcc8[_0xcc0335(0x14a)],_0xb0dcc8[_0xcc0335(0x120)]&&_0x6ec1e9[_0xcc0335(0x11d)][_0xcc0335(0xa7)](_0xb0dcc8[_0xcc0335(0x120)][_0xcc0335(0xb7)],_0xb0dcc8[_0xcc0335(0x120)]['id']),_0x6ec1e9['activations'][_0xcc0335(0xda)]+=_0xb0dcc8['activations'][_0xcc0335(0xda)],_0x6ec1e9[_0xcc0335(0x17a)][_0xcc0335(0x14a)]+=_0xb0dcc8['activations'][_0xcc0335(0x14a)],_0x6ec1e9[_0xcc0335(0x17a)][_0xcc0335(0xd1)]+=_0xb0dcc8[_0xcc0335(0x17a)]['deleted'];}return _0x6ec1e9;}async function syncActivationsForSegment(_0x1ca7b8,_0x4623a9,_0x5ef163,_0x388cf5,_0x3359ec,_0x15bbd8,_0xbf22e6){const _0x2c8c78=a152_0x46b3ac,_0x410c49={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x4894b2 of _0x3359ec){try{if(_0x4894b2[_0x2c8c78(0xf9)]==='create'&&_0x4894b2[_0x2c8c78(0x176)])_0x15bbd8['onProgress']?.({'type':_0x2c8c78(0xb9),'segmentName':_0x388cf5,'activationName':_0x4894b2['name']}),await _0x15bbd8[_0x2c8c78(0x13a)](_0x2c8c78(0x152)+_0x4894b2[_0x2c8c78(0xb7)]+_0x2c8c78(0xfa),()=>_0x1ca7b8[_0x2c8c78(0xed)][_0x2c8c78(0xaa)](_0x4623a9,_0x5ef163,_0x4894b2[_0x2c8c78(0x176)])),_0x15bbd8[_0x2c8c78(0xc5)]?.({'type':'activation_created','segmentName':_0x388cf5,'activationName':_0x4894b2[_0x2c8c78(0xb7)]}),_0x15bbd8[_0x2c8c78(0x112)]?.(_0x2c8c78(0x73)+_0x4894b2[_0x2c8c78(0xb7)]+'\x27'),_0x410c49['created']++;else{if(_0x4894b2[_0x2c8c78(0xf9)]===_0x2c8c78(0x103)&&_0x4894b2['validatedRequest']&&_0x4894b2[_0x2c8c78(0x88)])_0x15bbd8[_0x2c8c78(0xc5)]?.({'type':'activation_updating','segmentName':_0x388cf5,'activationName':_0x4894b2[_0x2c8c78(0xb7)]}),await _0x15bbd8[_0x2c8c78(0x13a)]('Updating\x20activation\x20\x27'+_0x4894b2[_0x2c8c78(0xb7)]+_0x2c8c78(0xfa),()=>_0x1ca7b8['segment'][_0x2c8c78(0xa0)](_0x4623a9,_0x5ef163,_0x4894b2[_0x2c8c78(0x88)]['id'],_0x4894b2[_0x2c8c78(0x176)])),_0x15bbd8[_0x2c8c78(0xc5)]?.({'type':'activation_updated','segmentName':_0x388cf5,'activationName':_0x4894b2[_0x2c8c78(0xb7)]}),_0x15bbd8[_0x2c8c78(0x112)]?.(_0x2c8c78(0x16f)+_0x4894b2[_0x2c8c78(0xb7)]+'\x27'),_0x410c49[_0x2c8c78(0x14a)]++;else _0x4894b2['type']==='delete'&&_0x4894b2[_0x2c8c78(0x88)]&&(_0x15bbd8[_0x2c8c78(0xc5)]?.({'type':'activation_deleting','segmentName':_0x388cf5,'activationName':_0x4894b2[_0x2c8c78(0xb7)]}),await _0x15bbd8[_0x2c8c78(0x13a)]('Deleting\x20activation\x20\x27'+_0x4894b2['name']+_0x2c8c78(0xfa),()=>_0x1ca7b8[_0x2c8c78(0xed)][_0x2c8c78(0xe7)](_0x4623a9,_0x5ef163,_0x4894b2[_0x2c8c78(0x88)]['id'])),_0x15bbd8[_0x2c8c78(0xc5)]?.({'type':_0x2c8c78(0x97),'segmentName':_0x388cf5,'activationName':_0x4894b2[_0x2c8c78(0xb7)]}),_0x15bbd8[_0x2c8c78(0xe5)]?.(_0x2c8c78(0xa2)+_0x4894b2['name']+'\x27'),_0x410c49[_0x2c8c78(0xd1)]++);}}catch(_0x34ca1b){const _0x538cac=isHttp400Error(_0x34ca1b),_0x1521c0=_0x538cac?ErrorCode[_0x2c8c78(0x134)]:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x25603d=getErrorMessage(_0x34ca1b);throw new SDKError(_0x1521c0,_0x2c8c78(0xcd)+_0x4894b2[_0x2c8c78(0xf9)]+_0x2c8c78(0x16a)+_0x4894b2[_0x2c8c78(0xb7)]+_0x2c8c78(0x107)+_0xbf22e6+_0x2c8c78(0x16e)+_0x25603d,_0x34ca1b);}}return _0x410c49;}export async function executePushFolders(_0x18bc32,_0x1610fc,_0x4542d7,_0x42a164,_0x411ea3){const _0x344168=a152_0x46b3ac,_0x27082d=new Map(_0x4542d7),_0x496629=sortFoldersByDepth(_0x1610fc);for(const _0x37f1b9 of _0x496629){const _0xf6e302=_0x37f1b9[_0x344168(0xe9)]('/'),_0x356810=_0xf6e302[_0xf6e302[_0x344168(0xcb)]-0x1],_0x1395a5=_0xf6e302[_0x344168(0x138)](0x0,-0x1)['join']('/'),_0x27f6a1=_0x27082d[_0x344168(0x13c)](_0x1395a5);_0x411ea3[_0x344168(0xc5)]?.({'type':'folder_creating','folder':_0x37f1b9});const _0x36bc66={'name':_0x356810,'parentFolderId':_0x27f6a1},_0x433506=await _0x411ea3[_0x344168(0x13a)](_0x344168(0x9c)+_0x37f1b9+'\x27...',()=>_0x18bc32['segment'][_0x344168(0x12d)](_0x42a164['parentId'],_0x36bc66));_0x27082d[_0x344168(0xa7)](_0x37f1b9,_0x433506[_0x344168(0x9b)]['id']),_0x411ea3['onProgress']?.({'type':_0x344168(0xd0),'folder':_0x37f1b9,'folderId':_0x433506[_0x344168(0x9b)]['id']}),_0x411ea3['logInfo']?.(_0x344168(0xf0)+_0x37f1b9+'\x27');}return _0x27082d;}export async function executePushSegmentDeletions(_0x29c49d,_0x573d67,_0x437595){const _0x588dee=a152_0x46b3ac;if(_0x573d67['length']===0x0)return 0x0;const {batchAsync:_0x11dde1}=await import(_0x588dee(0xe4)),_0x389881=0x5,_0x3174bd=await _0x11dde1(_0x573d67,async _0x145e91=>{const _0x468b66=_0x588dee;return _0x437595[_0x468b66(0xc5)]?.({'type':_0x468b66(0xe1),'name':_0x145e91['name']}),await _0x29c49d['segment'][_0x468b66(0x15d)](_0x145e91['id']),_0x437595[_0x468b66(0xc5)]?.({'type':_0x468b66(0x8f),'name':_0x145e91[_0x468b66(0xb7)]}),_0x437595['logDeleted']?.(_0x468b66(0x130)+_0x145e91['name']+'\x27'),0x1;},_0x389881);return _0x3174bd[_0x588dee(0x139)]((_0x507b11,_0xca4acc)=>_0x507b11+_0xca4acc,0x0);}export async function executePushJourneys(_0x4bce82,_0x452f71,_0xfc7b52,_0x500911,_0x5cdf4d){const _0x5d4f50=a152_0x46b3ac,{journeyDefToRequest:_0x486878}=await import('./journey-yaml.js'),{activationDefToCreateRequest:_0x2aa843,yamlRuleToApi:_0xa0ac89,validateSegmentRule:_0x21adf3}=await import(_0x5d4f50(0x172)),_0x5d0c0d={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x21ea70=new Map(_0xfc7b52[_0x5d4f50(0x16b)]),_0x3b469e=0x5;for(let _0x45026c=0x0;_0x45026c<_0x452f71['length'];_0x45026c+=_0x3b469e){const _0x32645d=_0x452f71[_0x5d4f50(0x138)](_0x45026c,_0x45026c+_0x3b469e),_0x33fa84=await Promise[_0x5d4f50(0x140)](_0x32645d[_0x5d4f50(0x13f)](async _0x61673c=>{const _0x170867=_0x5d4f50;if(!_0x61673c['isNew']&&!_0x61673c[_0x170867(0x137)])return{'action':_0x170867(0xb4),'name':_0x61673c[_0x170867(0x16d)][_0x170867(0xb7)],'journeyId':_0x61673c['existingJourney']?.['id']};const _0x17ab7d=_0x61673c[_0x170867(0x13d)]?_0xfc7b52[_0x170867(0x77)][_0x170867(0x13c)](_0x61673c[_0x170867(0x13d)]):undefined;_0x5cdf4d['onProgress']?.({'type':_0x61673c[_0x170867(0x14b)]?_0x170867(0x144):_0x170867(0xc0),'name':_0x61673c[_0x170867(0x16d)][_0x170867(0xb7)]});try{const _0x84f1de=await executeSingleJourneyPush(_0x4bce82,_0x61673c,{..._0xfc7b52,'segmentNameToId':_0x21ea70},{'parentId':_0x500911[_0x170867(0xd7)],'rootFolderId':_0x500911['rootFolderId'],'folderId':_0x17ab7d,'verbose':_0x500911[_0x170867(0xb1)]},_0x5cdf4d,{'journeyDefToRequest':_0x486878,'activationDefToCreateRequest':_0x2aa843,'yamlRuleToApi':_0xa0ac89,'validateSegmentRule':_0x21adf3});for(const [_0x2c8453,_0x5b0157]of _0x84f1de[_0x170867(0x164)]){_0x21ea70[_0x170867(0xa7)](_0x2c8453,_0x5b0157),_0x5d0c0d['embeddedSegmentNameToId'][_0x170867(0xa7)](_0x2c8453,_0x5b0157);}if(_0x84f1de[_0x170867(0x10b)]===_0x170867(0xda))_0x5cdf4d[_0x170867(0xc5)]?.({'type':_0x170867(0x71),'name':_0x61673c['yamlConfig'][_0x170867(0xb7)],'journeyId':_0x84f1de[_0x170867(0x163)]}),_0x5cdf4d['logSuccess']?.(_0x170867(0xde)+_0x61673c[_0x170867(0x16d)][_0x170867(0xb7)]+'\x27'),_0x5d0c0d[_0x170867(0xda)]++;else _0x84f1de['action']===_0x170867(0x14a)&&(_0x5cdf4d[_0x170867(0xc5)]?.({'type':_0x170867(0xeb),'name':_0x61673c[_0x170867(0x16d)][_0x170867(0xb7)]}),_0x5cdf4d[_0x170867(0x112)]?.('Updated\x20journey\x20\x27'+_0x61673c[_0x170867(0x16d)][_0x170867(0xb7)]+'\x27'),_0x5d0c0d[_0x170867(0x14a)]++);return{'action':_0x84f1de[_0x170867(0x10b)],'name':_0x61673c[_0x170867(0x16d)][_0x170867(0xb7)],'journeyId':_0x84f1de[_0x170867(0x163)]};}catch(_0x429620){const _0x39a25d=isHttp400Error(_0x429620),_0x569a75=_0x39a25d?ErrorCode[_0x170867(0x125)]:ErrorCode[_0x170867(0x119)],_0x464cae=getErrorMessage(_0x429620);throw new SDKError(_0x569a75,_0x170867(0xcd)+(_0x61673c[_0x170867(0x14b)]?'create':_0x170867(0x103))+_0x170867(0xd8)+_0x61673c['absolutePath']+_0x170867(0x16e)+_0x464cae,_0x429620);}}));_0x5d0c0d[_0x5d4f50(0xdd)]['push'](..._0x33fa84);}return _0x5d0c0d;}async function matchExistingJourneySegments(_0x828f77,_0x1bcc89,_0x202596,_0x54198a,_0x3aeeae){const _0x4a60eb=a152_0x46b3ac;if(!_0x1bcc89['existingJourney']||!_0x1bcc89[_0x4a60eb(0x16d)][_0x4a60eb(0x154)])return;const _0x82bcaf=new Map(),_0x3e01cb=new Set();for(const _0x2fdc70 of Object['keys'](_0x1bcc89['yamlConfig'][_0x4a60eb(0x154)])){const _0x11aca6=generateDeterministicJourneySegmentName(_0x1bcc89[_0x4a60eb(0x16d)][_0x4a60eb(0xb7)],_0x2fdc70);_0x82bcaf[_0x4a60eb(0xa7)](_0x11aca6,_0x2fdc70),_0x3e01cb[_0x4a60eb(0xb3)](_0x2fdc70);}const _0xf8a2fd=[],_0x22c4a3=collectSegmentIdsFromJourneyApi(_0x1bcc89[_0x4a60eb(0x115)]);for(const _0x80cfa of _0x22c4a3){const _0x36eab2=await fetchSegment(_0x828f77,_0x202596,_0x80cfa,_0x54198a);if(!_0x36eab2?.[_0x4a60eb(0xb7)])continue;const _0x10a213=_0x82bcaf[_0x4a60eb(0x13c)](_0x36eab2[_0x4a60eb(0xb7)]);_0x10a213?(_0x3aeeae['set'](_0x10a213,_0x80cfa),_0x3e01cb['delete'](_0x10a213)):_0xf8a2fd[_0x4a60eb(0xe2)]({'id':_0x80cfa,'seg':_0x36eab2});}if(_0x3e01cb[_0x4a60eb(0x101)]>0x0&&_0xf8a2fd['length']>0x0){const {localExpandedRuleToNames:_0x52df59}=buildLocalExpandedRuleMappings(_0x1bcc89[_0x4a60eb(0x16d)]),_0x3833e9=new Map();for(const {id:_0x2d3d40,seg:_0x7b8ab1}of _0xf8a2fd){if(_0x7b8ab1['rule']){const _0x54ebb0=apiRuleToYaml(_0x7b8ab1[_0x4a60eb(0x100)]);_0x3833e9[_0x4a60eb(0xa7)](_0x2d3d40,_0x54ebb0);}}for(const {id:_0x453c10,seg:_0x4e6fd7}of _0xf8a2fd){if(!_0x4e6fd7[_0x4a60eb(0x100)])continue;const _0x2b981c=_0x3833e9[_0x4a60eb(0x13c)](_0x453c10);if(!_0x2b981c)continue;const _0xa61145=serializeExpandedRule(_0x2b981c,_0x3833e9),_0x5ab39b=_0x52df59[_0x4a60eb(0x13c)](_0xa61145);if(_0x5ab39b){const _0x4c5f4c=_0x5ab39b[_0x4a60eb(0x8c)](_0x2dfa0=>_0x3e01cb['has'](_0x2dfa0));_0x4c5f4c&&(_0x3aeeae[_0x4a60eb(0xa7)](_0x4c5f4c,_0x453c10),_0x3e01cb['delete'](_0x4c5f4c),logger['debug'](_0x4a60eb(0xc2)+_0x4e6fd7[_0x4a60eb(0xb7)]+_0x4a60eb(0x7f)+_0x4c5f4c+_0x4a60eb(0xcc)));}}}}async function executeSingleJourneyPush(_0xe9a839,_0x18fb6e,_0x1b6e94,_0x31c341,_0x5b948f,_0x12771d){const _0x5e87e6=a152_0x46b3ac,{journeyDefToRequest:_0x524001,activationDefToCreateRequest:_0x4d9e50,yamlRuleToApi:_0x300fbc,validateSegmentRule:_0x1b9820}=_0x12771d,_0x27331f=new Map(),_0x24eb4a=new Map();recoverSegmentIdsFromPushRecovery(_0x18fb6e,_0x27331f,_0x1b6e94[_0x5e87e6(0x16b)]);const _0x240d76=new Map(),_0x45d48f=new Map(),_0x52aee4=new Map();let _0x5d9c36;const _0x30a816=async()=>{const _0x13daf0=_0x5e87e6;if(_0x5d9c36)return;_0x5d9c36=new Map();if(!_0x18fb6e[_0x13daf0(0x115)])return;const _0x419734=await _0xe9a839[_0x13daf0(0x116)]['listActivations'](_0x18fb6e['existingJourney']['id']);for(const _0x404865 of _0x419734){const _0x1fbbd1=journeyActivationStepToYaml(_0x404865,_0x1b6e94[_0x13daf0(0x15a)],_0x1b6e94[_0x13daf0(0xdc)]),_0x4d2232=activationSignature(_0x1fbbd1);!_0x5d9c36[_0x13daf0(0xdf)](_0x4d2232)&&_0x5d9c36[_0x13daf0(0xa7)](_0x4d2232,_0x404865['id']),_0x1fbbd1[_0x13daf0(0xb7)]&&_0x24eb4a['set'](_0x1fbbd1['name'],_0x404865['id']);}};await matchExistingJourneySegments(_0xe9a839,_0x18fb6e,_0x31c341[_0x5e87e6(0xd7)],_0x1b6e94[_0x5e87e6(0x136)],_0x1b6e94['segmentNameToId']);const _0x1b10ce={'resolveSegmentId':async _0x3d73db=>{const _0x5b2292=_0x5e87e6,_0x4d6b88=_0x1b6e94['segmentNameToId'][_0x5b2292(0x13c)](_0x3d73db);if(!_0x4d6b88)throw new SDKError(ErrorCode[_0x5b2292(0xa1)],'Segment\x20not\x20found:\x20'+_0x3d73db+_0x5b2292(0x9a)+_0x18fb6e[_0x5b2292(0x16d)][_0x5b2292(0xb7)]+')');return _0x4d6b88;},'resolveEmbeddedSegmentId':async(_0x475014,_0x156234)=>{const _0x7b7639=_0x5e87e6,_0x342b2d=_0x1b6e94[_0x7b7639(0x16b)]['get'](_0x475014);if(_0x342b2d)return _0x342b2d;const _0x2ee7ac=_0x1b6e94['existingSegments'][_0x7b7639(0x8c)](_0x34d10f=>_0x34d10f['name']===_0x475014);if(_0x2ee7ac)return _0x1b6e94[_0x7b7639(0x16b)]['set'](_0x475014,_0x2ee7ac['id']),_0x2ee7ac['id'];if(_0x18fb6e[_0x7b7639(0x14b)]){const {stageName:_0x38cf6b,criteriaName:_0x4f023b}=findSegmentCriteriaLocation(_0x18fb6e[_0x7b7639(0x16d)],_0x475014);return _0x1b9820(_0x475014,_0x156234[_0x7b7639(0x100)]),_0x45d48f['set'](_0x475014,{'definition':_0x156234,'stageName':_0x38cf6b,'criteriaName':_0x4f023b}),createPendingSegmentId(_0x475014);}const _0x5a71c5=_0x18fb6e[_0x7b7639(0x115)]?.['id'];if(!_0x5a71c5)throw new SDKError(ErrorCode[_0x7b7639(0x12f)],_0x7b7639(0x95));const _0x5d0a1f=_0x240d76['get'](_0x475014);if(_0x5d0a1f)return _0x5d0a1f;const _0x5b3869=((async()=>{const _0x1a0ac1=_0x7b7639;_0x1b9820(_0x475014,_0x156234[_0x1a0ac1(0x100)]);const _0x5cb1b2=generateDeterministicJourneySegmentName(_0x18fb6e['yamlConfig'][_0x1a0ac1(0xb7)],_0x475014),_0x2de05d=_0x1b6e94[_0x1a0ac1(0x136)][_0x1a0ac1(0x8c)](_0x1deccd=>_0x1deccd[_0x1a0ac1(0xb7)]===_0x5cb1b2),_0x53bd6e=createSegmentIdResolver(_0x1b6e94[_0x1a0ac1(0x16b)],_0x475014),_0x5b0050=await resolveRuleSegmentIds(_0x156234['rule'],_0x53bd6e);let _0x3b45d2;return _0x2de05d?(await _0xe9a839[_0x1a0ac1(0xed)][_0x1a0ac1(0x13e)](_0x31c341[_0x1a0ac1(0xd7)],_0x2de05d['id'],{'description':_0x156234['description']||'Entry\x20criteria:\x20'+_0x475014,'rule':_0x300fbc(_0x5b0050),'countPopulation':!![]}),_0x3b45d2=_0x2de05d['id'],saveSegmentToPushRecovery(_0x18fb6e[_0x1a0ac1(0x148)],_0x18fb6e[_0x1a0ac1(0x16d)]['name'],_0x475014,{'segmentId':_0x3b45d2,'uniqueServerName':_0x5cb1b2,'createdAt':new Date()[_0x1a0ac1(0x111)]()})):_0x3b45d2=await createOrRecoverEmbeddedSegment(_0xe9a839,_0x18fb6e,{'localName':_0x475014,'uniqueSegmentName':_0x5cb1b2,'description':_0x156234[_0x1a0ac1(0xb6)]||'Entry\x20criteria:\x20'+_0x475014,'journeyId':_0x5a71c5,'resolvedRule':_0x5b0050,'parentId':_0x31c341[_0x1a0ac1(0xd7)],'folderId':_0x31c341[_0x1a0ac1(0xbe)]||''},_0x300fbc),_0x1b6e94['segmentNameToId'][_0x1a0ac1(0xa7)](_0x475014,_0x3b45d2),_0x27331f['set'](_0x475014,_0x3b45d2),_0x3b45d2;})());_0x240d76[_0x7b7639(0xa7)](_0x475014,_0x5b3869);try{return await _0x5b3869;}finally{_0x240d76[_0x7b7639(0x165)](_0x475014);}},'resolveActivationId':async _0xba70f1=>{const _0x45c4e9=_0x5e87e6,_0x4e8936=_0x24eb4a[_0x45c4e9(0x13c)](_0xba70f1);if(_0x4e8936)return _0x4e8936;if(_0x18fb6e[_0x45c4e9(0x115)]){await _0x30a816();const _0x205719=_0x24eb4a[_0x45c4e9(0x13c)](_0xba70f1);if(_0x205719)return _0x205719;}throw new SDKError(ErrorCode[_0x45c4e9(0x17d)],_0x45c4e9(0xe0)+_0xba70f1+_0x45c4e9(0x9a)+_0x18fb6e[_0x45c4e9(0x16d)][_0x45c4e9(0xb7)]+_0x45c4e9(0x174)+'Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.');},'resolveEmbeddedActivationId':async(_0x3db752,_0x17a8e1)=>{const _0x32ffc7=_0x5e87e6,_0x59960c=_0x24eb4a[_0x32ffc7(0x13c)](_0x3db752);if(_0x59960c)return _0x59960c;if(_0x18fb6e[_0x32ffc7(0x14b)])return _0x52aee4['set'](_0x3db752,_0x17a8e1),createPendingActivationId(_0x3db752);if(_0x18fb6e['existingJourney']){await _0x30a816();const _0x445d47=_0x24eb4a[_0x32ffc7(0x13c)](_0x17a8e1['name']);if(_0x445d47)return _0x24eb4a[_0x32ffc7(0xa7)](_0x3db752,_0x445d47),_0x445d47;const _0x233851=activationSignature(_0x17a8e1),_0x266dfd=_0x5d9c36?.[_0x32ffc7(0x13c)](_0x233851);if(_0x266dfd)return _0x24eb4a[_0x32ffc7(0xa7)](_0x3db752,_0x266dfd),_0x266dfd;const _0x1b1276=await _0x4d9e50(_0x17a8e1,_0x1b6e94[_0x32ffc7(0x121)]),_0x4fbdfe={..._0x1b1276,..._0x17a8e1['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x17a8e1['run_after_journey_refresh']}},_0x527889=await _0xe9a839[_0x32ffc7(0x116)][_0x32ffc7(0xaa)](_0x18fb6e[_0x32ffc7(0x115)]['id'],_0x4fbdfe);return _0x24eb4a[_0x32ffc7(0xa7)](_0x3db752,_0x527889['id']),_0x527889['id'];}throw new SDKError(ErrorCode['INTERNAL'],_0x32ffc7(0x161));},'resolveJourneyId':async _0x288a8f=>{const _0x15d84c=_0x5e87e6;try{return await _0xe9a839[_0x15d84c(0x116)]['resolveJourneyId'](_0x31c341['parentId'],_0x288a8f);}catch(_0x1cc499){throw new SDKError(ErrorCode[_0x15d84c(0x17d)],_0x15d84c(0x171)+_0x288a8f+_0x15d84c(0x14e)+_0x18fb6e['yamlConfig'][_0x15d84c(0xb7)]+'\x27)',_0x1cc499);}},'resolveStageId':async(_0x3ae1d9,_0xcb674d)=>{const _0x356d12=_0x5e87e6,_0x1727eb=await _0xe9a839['journey'][_0x356d12(0xe3)](_0x3ae1d9),_0x4a439e=_0x1727eb[_0x356d12(0xd9)][_0x356d12(0x170)][_0x356d12(0x8c)](_0x311d4c=>_0x311d4c[_0x356d12(0xb7)]['toLowerCase']()===_0xcb674d[_0x356d12(0xcf)]());if(!_0x4a439e?.['id'])throw new SDKError(ErrorCode[_0x356d12(0x17d)],'Stage\x20\x27'+_0xcb674d+_0x356d12(0x160)+(_0x1727eb[_0x356d12(0xd9)][_0x356d12(0x110)]||_0x1727eb[_0x356d12(0xd9)]['name'])+'\x27');return _0x4a439e['id'];}},_0x4c0d9d=await _0x524001(_0x18fb6e[_0x5e87e6(0x16d)],_0x31c341['parentId'],_0x1b10ce),_0x34d567=_0x31c341[_0x5e87e6(0xa3)]||_0x31c341[_0x5e87e6(0xbe)];_0x34d567&&(_0x4c0d9d[_0x5e87e6(0x168)]={'parentFolder':{'data':{'id':_0x34d567,'type':'folder'}}});if(_0x18fb6e[_0x5e87e6(0x14b)]){if(_0x45d48f[_0x5e87e6(0x101)]>0x0||_0x52aee4[_0x5e87e6(0x101)]>0x0)return await executeThreeStepJourneyCreate(_0xe9a839,_0x18fb6e,_0x4c0d9d,{'pendingEmbeddedSegments':_0x45d48f,'pendingEmbeddedActivations':_0x52aee4,'embeddedSegmentNameToId':_0x27331f,'journeyActivationNameToId':_0x24eb4a},{..._0x31c341,'effectiveFolderId':_0x34d567},_0x1b6e94,_0x5b948f,_0x12771d);else{ensureJourneyDefaults(_0x4c0d9d[_0x5e87e6(0xd9)]);const _0x4e0e01=await _0xe9a839[_0x5e87e6(0x116)][_0x5e87e6(0xac)](_0x4c0d9d);return deletePushRecovery(_0x18fb6e[_0x5e87e6(0x148)]),{'action':'created','journeyId':_0x4e0e01['id'],'embeddedSegmentNameToId':_0x27331f};}}else{if(_0x18fb6e[_0x5e87e6(0x137)]&&_0x18fb6e[_0x5e87e6(0x115)]){_0x4c0d9d['id']=_0x18fb6e['existingJourney']['id'];const _0x48bf34=_0x4c0d9d['attributes'];_0x18fb6e[_0x5e87e6(0x115)][_0x5e87e6(0xd9)]?.['journeyBundleName']&&(_0x48bf34[_0x5e87e6(0x110)]=_0x18fb6e[_0x5e87e6(0x115)]['attributes'][_0x5e87e6(0x110)]);const _0x13cf37=_0x18fb6e[_0x5e87e6(0x115)][_0x5e87e6(0xd9)]?.[_0x5e87e6(0x170)];return _0x13cf37&&_0x4c0d9d[_0x5e87e6(0xd9)][_0x5e87e6(0x170)]&&injectExistingStageIds(_0x4c0d9d[_0x5e87e6(0xd9)]['journeyStages'],_0x13cf37),ensureJourneyDefaults(_0x48bf34),await _0xe9a839[_0x5e87e6(0x116)][_0x5e87e6(0x103)](_0x18fb6e[_0x5e87e6(0x115)]['id'],_0x4c0d9d),deletePushRecovery(_0x18fb6e[_0x5e87e6(0x148)]),{'action':_0x5e87e6(0x14a),'journeyId':_0x18fb6e['existingJourney']['id'],'embeddedSegmentNameToId':_0x27331f};}}return deletePushRecovery(_0x18fb6e['absolutePath']),{'action':_0x5e87e6(0xb4),'journeyId':_0x18fb6e[_0x5e87e6(0x115)]?.['id'],'embeddedSegmentNameToId':_0x27331f};}function findSegmentCriteriaLocation(_0x55695f,_0x4edca5){const _0xa5459f=a152_0x46b3ac,_0x35fd7b=_0x55695f['stages']||_0x55695f[_0xa5459f(0xee)]?.[0x0]?.[_0xa5459f(0x105)]||[];let _0x1b6c0a=_0xa5459f(0x178),_0x55e511=_0x4edca5;const _0x128619=_0x55695f['goal']||_0x55695f[_0xa5459f(0xee)]?.[0x0]?.['goal'];if(_0x128619?.[_0xa5459f(0xed)]===_0x4edca5)return{'stageName':_0xa5459f(0xc3),'criteriaName':_0x128619[_0xa5459f(0xb7)]||_0x4edca5};_0x3c959f:for(const _0xe4bcea of _0x35fd7b){if(_0xe4bcea[_0xa5459f(0x10c)]?.[_0xa5459f(0xed)]===_0x4edca5){_0x1b6c0a=_0xe4bcea[_0xa5459f(0xb7)],_0x55e511=_0xe4bcea[_0xa5459f(0x10c)][_0xa5459f(0xb7)]||_0x4edca5;break;}if(_0xe4bcea[_0xa5459f(0xf6)])for(const _0x42f74c of _0xe4bcea[_0xa5459f(0xf6)]){if(_0x42f74c['type']===_0xa5459f(0xd6)&&_0x42f74c[_0xa5459f(0x128)]?.[_0xa5459f(0x153)])for(const _0x572490 of _0x42f74c[_0xa5459f(0x128)]['branches']){if(_0x572490[_0xa5459f(0xed)]===_0x4edca5){_0x1b6c0a=_0xe4bcea[_0xa5459f(0xb7)],_0x55e511=_0x572490[_0xa5459f(0xb7)]||_0x4edca5;break _0x3c959f;}}}}return{'stageName':_0x1b6c0a,'criteriaName':_0x55e511};}async function executeThreeStepJourneyCreate(_0x4b04b7,_0x154266,_0x1b04d6,_0x83501,_0x48ee9d,_0x116824,_0x48c5ae,_0x12339d){const _0x1053a0=a152_0x46b3ac,{activationDefToCreateRequest:_0x4f8221,yamlRuleToApi:_0xc1f17e}=_0x12339d,{pendingEmbeddedSegments:_0x4e8d29,pendingEmbeddedActivations:_0x163199,embeddedSegmentNameToId:_0x59ce21}=_0x83501,_0x5a9e10=JSON[_0x1053a0(0x10e)](JSON[_0x1053a0(0x89)](_0x1b04d6));ensureJourneyDefaults(_0x5a9e10[_0x1053a0(0xd9)]),stripPendingIds(_0x5a9e10);const _0x33cc6a=await _0x4b04b7[_0x1053a0(0x116)][_0x1053a0(0xac)](_0x5a9e10),_0x9c71ff=_0x33cc6a['id'],_0x38c07c=new Map();for(const _0x1e435d of _0x33cc6a[_0x1053a0(0xd9)][_0x1053a0(0x170)]){_0x38c07c[_0x1053a0(0xa7)](_0x1e435d[_0x1053a0(0xb7)][_0x1053a0(0xcf)](),_0x1e435d['id']);}recoverSegmentIdsFromPushRecovery(_0x154266,_0x59ce21,_0x116824[_0x1053a0(0x16b)]);for(const [_0x40ebfd,{definition:_0x2eb812}]of _0x4e8d29){if(_0x59ce21['has'](_0x40ebfd)){_0x48c5ae[_0x1053a0(0xc5)]?.({'type':_0x1053a0(0x108),'journeyName':_0x154266[_0x1053a0(0x16d)][_0x1053a0(0xb7)],'segmentName':_0x40ebfd});continue;}const _0x5d14a5=generateDeterministicJourneySegmentName(_0x154266[_0x1053a0(0x16d)]['name'],_0x40ebfd);_0x48c5ae['onProgress']?.({'type':_0x1053a0(0x11f),'journeyName':_0x154266['yamlConfig'][_0x1053a0(0xb7)],'segmentName':_0x40ebfd});const _0x447f71=createSegmentIdResolver(_0x116824[_0x1053a0(0x16b)],_0x40ebfd),_0x4d069e=await resolveRuleSegmentIds(_0x2eb812[_0x1053a0(0x100)],_0x447f71),_0x46b376=await createOrRecoverEmbeddedSegment(_0x4b04b7,_0x154266,{'localName':_0x40ebfd,'uniqueSegmentName':_0x5d14a5,'description':_0x2eb812['description']||'Entry\x20criteria:\x20'+_0x40ebfd,'journeyId':_0x9c71ff,'resolvedRule':_0x4d069e,'parentId':_0x48ee9d[_0x1053a0(0xd7)],'folderId':_0x48ee9d['effectiveFolderId']||''},_0xc1f17e);_0x59ce21[_0x1053a0(0xa7)](_0x40ebfd,_0x46b376),_0x116824[_0x1053a0(0x16b)][_0x1053a0(0xa7)](_0x40ebfd,_0x46b376),_0x48c5ae[_0x1053a0(0xc5)]?.({'type':_0x1053a0(0x108),'journeyName':_0x154266[_0x1053a0(0x16d)]['name'],'segmentName':_0x40ebfd});}const _0x1a1d79=new Map();for(const [_0x1cc7e0,_0xb81f5b]of _0x163199){_0x48c5ae['onProgress']?.({'type':_0x1053a0(0x86),'journeyName':_0x154266['yamlConfig'][_0x1053a0(0xb7)],'activationName':_0x1cc7e0});const _0x7f19de=await _0x4f8221(_0xb81f5b,_0x116824['activationContext']),_0x37ab0b={..._0x7f19de,..._0xb81f5b[_0x1053a0(0x167)]!==undefined&&{'runAfterJourneyRefresh':_0xb81f5b[_0x1053a0(0x167)]}},_0x2387e2=await _0x4b04b7[_0x1053a0(0x116)][_0x1053a0(0xaa)](_0x9c71ff,_0x37ab0b);_0x1a1d79[_0x1053a0(0xa7)](_0x1cc7e0,_0x2387e2['id']),_0x83501[_0x1053a0(0x87)][_0x1053a0(0xa7)](_0x1cc7e0,_0x2387e2['id']),_0x48c5ae[_0x1053a0(0xc5)]?.({'type':_0x1053a0(0x82),'journeyName':_0x154266[_0x1053a0(0x16d)][_0x1053a0(0xb7)],'activationName':_0x1cc7e0});}const _0x1cd798=JSON['parse'](JSON[_0x1053a0(0x89)](_0x1b04d6));return _0x1cd798['id']=_0x9c71ff,ensureJourneyDefaults(_0x1cd798[_0x1053a0(0xd9)]),resolvePendingIdsInRequest(_0x1cd798,_0x1b04d6,_0x38c07c,_0x59ce21,_0x1a1d79,_0x48c5ae),await _0x4b04b7['journey'][_0x1053a0(0x103)](_0x9c71ff,_0x1cd798),deletePushRecovery(_0x154266['absolutePath']),{'action':'created','journeyId':_0x9c71ff,'embeddedSegmentNameToId':_0x59ce21};}export function stripWaitStepPendingIds(_0x39fc82){const _0x7a8053=a152_0x46b3ac,_0x50ad2f=_0x39fc82[_0x7a8053(0xb8)]&&isPendingSegmentId(_0x39fc82[_0x7a8053(0xb8)]),_0x5a08d8=_0x39fc82['conditions']?.[_0x7a8053(0xea)](_0x8321cd=>_0x8321cd[_0x7a8053(0x99)]&&isPendingSegmentId(_0x8321cd[_0x7a8053(0x99)]));(_0x50ad2f||_0x5a08d8)&&(_0x39fc82['waitStepType']=_0x7a8053(0x12a),_0x39fc82[_0x7a8053(0x142)]=0x1,_0x39fc82[_0x7a8053(0xb2)]=_0x7a8053(0x9d),delete _0x39fc82[_0x7a8053(0xb8)],delete _0x39fc82[_0x7a8053(0xce)],delete _0x39fc82[_0x7a8053(0x75)],delete _0x39fc82[_0x7a8053(0x123)]);}export function resolveWaitStepPendingIds(_0x71ff29,_0x18605f,_0x367a79,_0x34ba33){const _0x4be7aa=a152_0x46b3ac;if(_0x18605f['conditionSegmentId']&&isPendingSegmentId(_0x18605f[_0x4be7aa(0xb8)])){const _0x324c76=_0x367a79(_0x18605f[_0x4be7aa(0xb8)],_0x4be7aa(0x141)+_0x34ba33+'\x27\x20wait\x20condition');_0x324c76&&(_0x71ff29[_0x4be7aa(0x162)]='Condition',_0x71ff29[_0x4be7aa(0xb8)]=_0x324c76,delete _0x71ff29[_0x4be7aa(0x142)],delete _0x71ff29[_0x4be7aa(0xb2)],_0x18605f[_0x4be7aa(0xce)]!==undefined&&(_0x71ff29[_0x4be7aa(0xce)]=_0x18605f['conditionTimeoutDuration']),_0x18605f[_0x4be7aa(0x75)]&&(_0x71ff29[_0x4be7aa(0x75)]=_0x18605f[_0x4be7aa(0x75)]));}if(_0x18605f[_0x4be7aa(0x123)]){const _0x27858c=_0x18605f[_0x4be7aa(0x123)][_0x4be7aa(0xea)](_0x5b705d=>_0x5b705d[_0x4be7aa(0x99)]&&isPendingSegmentId(_0x5b705d[_0x4be7aa(0x99)]));if(_0x27858c){const _0x3a9656=_0x18605f[_0x4be7aa(0x123)]['map'](_0xce9d52=>{const _0x513b00=_0x4be7aa;if(_0xce9d52['segmentId']&&isPendingSegmentId(_0xce9d52[_0x513b00(0x99)])){const _0x536ba2=_0x367a79(_0xce9d52[_0x513b00(0x99)],_0x513b00(0x141)+_0x34ba33+_0x513b00(0x102));return{..._0xce9d52,'segmentId':_0x536ba2||_0xce9d52[_0x513b00(0x99)]};}return{..._0xce9d52};});_0x71ff29[_0x4be7aa(0x162)]=_0x4be7aa(0x11a),_0x71ff29['conditions']=_0x3a9656,delete _0x71ff29[_0x4be7aa(0x142)],delete _0x71ff29[_0x4be7aa(0xb2)],delete _0x71ff29[_0x4be7aa(0xb8)],delete _0x71ff29[_0x4be7aa(0xce)],delete _0x71ff29[_0x4be7aa(0x75)];}}}function stripPendingIds(_0x2899d3){const _0x362203=a152_0x46b3ac;_0x2899d3[_0x362203(0xd9)][_0x362203(0xc3)]?.['segmentId']&&isPendingSegmentId(_0x2899d3[_0x362203(0xd9)][_0x362203(0xc3)][_0x362203(0x99)])&&delete _0x2899d3[_0x362203(0xd9)][_0x362203(0xc3)];for(const _0x2cdf16 of _0x2899d3[_0x362203(0xd9)][_0x362203(0x170)]||[]){_0x2cdf16[_0x362203(0x15c)]?.['segmentId']&&isPendingSegmentId(_0x2cdf16[_0x362203(0x15c)]['segmentId'])&&delete _0x2cdf16[_0x362203(0x15c)];_0x2cdf16[_0x362203(0xf4)]?.[_0x362203(0x99)]&&isPendingSegmentId(_0x2cdf16[_0x362203(0xf4)][_0x362203(0x99)])&&delete _0x2cdf16[_0x362203(0xf4)];_0x2cdf16[_0x362203(0x13b)]&&(_0x2cdf16['exitCriterias']=_0x2cdf16[_0x362203(0x13b)]['filter'](_0x2797bf=>!_0x2797bf['segmentId']||!isPendingSegmentId(_0x2797bf[_0x362203(0x99)])));if(_0x2cdf16[_0x362203(0xf6)])for(const _0x2a12c6 of Object[_0x362203(0x132)](_0x2cdf16['steps'])){const _0x1f6180=_0x2cdf16['steps'][_0x2a12c6];_0x1f6180[_0x362203(0xf9)]==='Activation'&&_0x1f6180[_0x362203(0xf3)]&&isPendingActivationId(_0x1f6180[_0x362203(0xf3)])&&(_0x1f6180[_0x362203(0xf3)]='');if(_0x1f6180['type']===_0x362203(0x147)&&_0x1f6180[_0x362203(0x153)])for(const _0x6eac59 of _0x1f6180[_0x362203(0x153)]){_0x6eac59[_0x362203(0x99)]&&isPendingSegmentId(_0x6eac59[_0x362203(0x99)])&&(_0x6eac59[_0x362203(0x99)]='');}_0x1f6180[_0x362203(0xf9)]===_0x362203(0xd4)&&stripWaitStepPendingIds(_0x1f6180);}}}function resolvePendingIdsInRequest(_0xd02e1f,_0x4ccbb8,_0x57e691,_0xed199e,_0x37f389,_0x33a040){const _0x384c2d=a152_0x46b3ac,_0x292c17=(_0x33532c,_0x5cd190)=>{const _0x49f47c=a152_0x5983;if(!isPendingSegmentId(_0x33532c))return _0x33532c;const _0x43b5ab=extractPendingSegmentName(_0x33532c),_0x21ecd2=_0xed199e[_0x49f47c(0x13c)](_0x43b5ab);return!_0x21ecd2&&_0x33a040[_0x49f47c(0xaf)]?.(_0x49f47c(0x118)+_0x43b5ab+_0x49f47c(0x177)+_0x5cd190),_0x21ecd2;};if(_0xd02e1f[_0x384c2d(0xd9)][_0x384c2d(0xc3)]?.[_0x384c2d(0x99)]&&isPendingSegmentId(_0xd02e1f[_0x384c2d(0xd9)][_0x384c2d(0xc3)][_0x384c2d(0x99)])){const _0x2b3bff=_0x292c17(_0xd02e1f[_0x384c2d(0xd9)][_0x384c2d(0xc3)]['segmentId'],_0x384c2d(0x12e));_0x2b3bff&&(_0xd02e1f[_0x384c2d(0xd9)]['goal'][_0x384c2d(0x99)]=_0x2b3bff);}for(const _0x25a672 of _0xd02e1f[_0x384c2d(0xd9)][_0x384c2d(0x170)]||[]){const _0x19fa10=_0x57e691[_0x384c2d(0x13c)](_0x25a672['name'][_0x384c2d(0xcf)]());_0x19fa10&&(_0x25a672['id']=_0x19fa10);if(_0x25a672['entryCriteria']?.['segmentId']&&isPendingSegmentId(_0x25a672['entryCriteria'][_0x384c2d(0x99)])){const _0x2688e5=_0x292c17(_0x25a672['entryCriteria'][_0x384c2d(0x99)],_0x384c2d(0x141)+_0x25a672[_0x384c2d(0xb7)]+_0x384c2d(0xb0));_0x2688e5&&(_0x25a672[_0x384c2d(0x15c)][_0x384c2d(0x99)]=_0x2688e5);}if(_0x25a672[_0x384c2d(0x13b)])for(const _0x6345ea of _0x25a672['exitCriterias']){if(_0x6345ea['segmentId']&&isPendingSegmentId(_0x6345ea[_0x384c2d(0x99)])){const _0x5c52b8=_0x292c17(_0x6345ea[_0x384c2d(0x99)],_0x384c2d(0x141)+_0x25a672[_0x384c2d(0xb7)]+_0x384c2d(0x126));_0x5c52b8&&(_0x6345ea[_0x384c2d(0x99)]=_0x5c52b8);}}if(_0x25a672[_0x384c2d(0xf4)]?.[_0x384c2d(0x99)]&&isPendingSegmentId(_0x25a672[_0x384c2d(0xf4)]['segmentId'])){const _0x54db77=_0x292c17(_0x25a672[_0x384c2d(0xf4)][_0x384c2d(0x99)],'stage\x20\x27'+_0x25a672[_0x384c2d(0xb7)]+_0x384c2d(0xa6));_0x54db77&&(_0x25a672['milestone'][_0x384c2d(0x99)]=_0x54db77);}if(_0x25a672[_0x384c2d(0xf6)]){const _0x35026e=_0x744e7=>_0x4ccbb8['attributes'][_0x384c2d(0x170)]?.[_0x384c2d(0x8c)](_0x43eee1=>_0x43eee1[_0x384c2d(0xb7)]['toLowerCase']()===_0x25a672[_0x384c2d(0xb7)][_0x384c2d(0xcf)]())?.['steps']?.[_0x744e7];for(const _0x4bf182 of Object[_0x384c2d(0x132)](_0x25a672[_0x384c2d(0xf6)])){const _0xe61a23=_0x25a672[_0x384c2d(0xf6)][_0x4bf182],_0xa1d337=_0x35026e(_0x4bf182);if(_0xe61a23[_0x384c2d(0xf9)]===_0x384c2d(0xbc)&&_0xe61a23['journeyActivationStepId']&&(isPendingActivationId(_0xe61a23[_0x384c2d(0xf3)])||_0xe61a23[_0x384c2d(0xf3)]==='')){if(_0xa1d337?.[_0x384c2d(0xf3)]&&isPendingActivationId(_0xa1d337[_0x384c2d(0xf3)])){const _0x26ea5a=extractPendingActivationName(_0xa1d337[_0x384c2d(0xf3)]),_0x2b8ac4=_0x37f389[_0x384c2d(0x13c)](_0x26ea5a);_0x2b8ac4&&(_0xe61a23[_0x384c2d(0xf3)]=_0x2b8ac4);}}if(_0xe61a23[_0x384c2d(0xf9)]==='DecisionPoint'&&_0xe61a23[_0x384c2d(0x153)]&&_0xa1d337?.[_0x384c2d(0x153)])for(let _0x87c6f5=0x0;_0x87c6f5<_0xe61a23[_0x384c2d(0x153)]['length'];_0x87c6f5++){const _0x4e74fa=_0xe61a23[_0x384c2d(0x153)][_0x87c6f5],_0x3619dc=_0xa1d337['branches'][_0x87c6f5];if(_0x3619dc?.[_0x384c2d(0x99)]&&isPendingSegmentId(_0x3619dc[_0x384c2d(0x99)])){const _0xac87fd=_0x292c17(_0x3619dc[_0x384c2d(0x99)],_0x384c2d(0x141)+_0x25a672[_0x384c2d(0xb7)]+_0x384c2d(0x7a)+(_0x4e74fa['name']||_0x87c6f5)+'\x27');_0xac87fd&&(_0x4e74fa['segmentId']=_0xac87fd);}}_0xe61a23[_0x384c2d(0xf9)]==='WaitStep'&&_0xa1d337?.[_0x384c2d(0xf9)]==='WaitStep'&&resolveWaitStepPendingIds(_0xe61a23,_0xa1d337,_0x292c17,_0x25a672[_0x384c2d(0xb7)]);}}}}
@@ -1 +1 @@
1
- function a153_0x1f4a(_0x54ae2d,_0x31b01d){_0x54ae2d=_0x54ae2d-0x120;const _0x313373=a153_0x3133();let _0x1f4a83=_0x313373[_0x54ae2d];return _0x1f4a83;}(function(_0x28e841,_0xdbd75c){const _0x2d5e06=a153_0x1f4a,_0x1f5bd1=_0x28e841();while(!![]){try{const _0x9c5a1=-parseInt(_0x2d5e06(0x12a))/0x1*(parseInt(_0x2d5e06(0x124))/0x2)+-parseInt(_0x2d5e06(0x123))/0x3*(-parseInt(_0x2d5e06(0x12e))/0x4)+parseInt(_0x2d5e06(0x125))/0x5+parseInt(_0x2d5e06(0x122))/0x6*(parseInt(_0x2d5e06(0x129))/0x7)+-parseInt(_0x2d5e06(0x130))/0x8+-parseInt(_0x2d5e06(0x128))/0x9*(parseInt(_0x2d5e06(0x120))/0xa)+parseInt(_0x2d5e06(0x127))/0xb;if(_0x9c5a1===_0xdbd75c)break;else _0x1f5bd1['push'](_0x1f5bd1['shift']());}catch(_0x35b142){_0x1f5bd1['push'](_0x1f5bd1['shift']());}}}(a153_0x3133,0x9bb09));export function buildFolderIdToPathMap(_0x33d1e0){const _0xc00a70=a153_0x1f4a,_0x11af81=new Map(),_0x5ca50d=new Map();for(const _0x52db75 of _0x33d1e0){_0x5ca50d[_0xc00a70(0x126)](_0x52db75['id'],_0x52db75);}const _0x5506e5=new Set();for(const _0x37da15 of _0x33d1e0){!_0x37da15[_0xc00a70(0x12d)]&&_0x5506e5[_0xc00a70(0x12b)](_0x37da15['id']);}function _0x1080d7(_0x52dfa2){const _0x50cb47=_0xc00a70;if(_0x11af81[_0x50cb47(0x121)](_0x52dfa2['id']))return _0x11af81[_0x50cb47(0x12f)](_0x52dfa2['id']);if(_0x5506e5['has'](_0x52dfa2['id']))return _0x11af81[_0x50cb47(0x126)](_0x52dfa2['id'],''),'';if(_0x52dfa2[_0x50cb47(0x12d)]){const _0x210d71=_0x5ca50d[_0x50cb47(0x12f)](_0x52dfa2[_0x50cb47(0x12d)]);if(_0x210d71){const _0x24b074=_0x1080d7(_0x210d71),_0x12c64a=_0x24b074?_0x24b074+'/'+_0x52dfa2[_0x50cb47(0x12c)]:_0x52dfa2[_0x50cb47(0x12c)];return _0x11af81[_0x50cb47(0x126)](_0x52dfa2['id'],_0x12c64a),_0x12c64a;}}const _0x4caa6c=_0x52dfa2['name'];return _0x11af81[_0x50cb47(0x126)](_0x52dfa2['id'],_0x4caa6c),_0x4caa6c;}for(const _0x456131 of _0x33d1e0){_0x1080d7(_0x456131);}return _0x11af81;}export function buildFolderPathToIdMap(_0x52ef68){const _0x524b7a=a153_0x1f4a,_0x1c816e=new Map(),_0x117964=new Map();for(const _0x33184c of _0x52ef68){_0x117964[_0x524b7a(0x126)](_0x33184c['id'],_0x33184c);}const _0x2d9039=new Set();for(const _0x5eee54 of _0x52ef68){!_0x5eee54[_0x524b7a(0x12d)]&&_0x2d9039[_0x524b7a(0x12b)](_0x5eee54['id']);}function _0x3b5623(_0x3de36c){const _0x52624f=_0x524b7a;if(_0x2d9039['has'](_0x3de36c['id']))return'';if(_0x3de36c['parentFolderId']){const _0xa826d2=_0x117964[_0x52624f(0x12f)](_0x3de36c[_0x52624f(0x12d)]);if(_0xa826d2){const _0x441331=_0x3b5623(_0xa826d2);return _0x441331?_0x441331+'/'+_0x3de36c[_0x52624f(0x12c)]:_0x3de36c[_0x52624f(0x12c)];}}return _0x3de36c['name'];}for(const _0x32b48f of _0x52ef68){const _0x5c248b=_0x3b5623(_0x32b48f);_0x1c816e['set'](_0x5c248b,_0x32b48f['id']);}return _0x1c816e;}function a153_0x3133(){const _0x2e21f9=['9930160NGdFCk','has','18ehgxiN','5982mzkNtL','1231570hMeQDr','3897215eAKXmD','set','5991161hogNHe','9wCpJlc','2080904PpvmVA','2dUXlDh','add','name','parentFolderId','1736QierBB','get','1752120QtEjRM'];a153_0x3133=function(){return _0x2e21f9;};return a153_0x3133();}export function buildFolderMaps(_0x15c5ab){const _0x530575=buildFolderIdToPathMap(_0x15c5ab),_0xc89e38=new Map();for(const [_0x2fc3fc,_0x399a2e]of _0x530575){_0xc89e38['set'](_0x399a2e,_0x2fc3fc);}return{'idToPath':_0x530575,'pathToId':_0xc89e38};}export function getFolderPath(_0x49fefb,_0x20ef6b){const _0x167e5a=a153_0x1f4a;if(!_0x49fefb)return'';return _0x20ef6b[_0x167e5a(0x12f)](_0x49fefb)??'';}
1
+ (function(_0x5e9817,_0x1585d3){const _0x5da41c=a153_0x3c29,_0x431184=_0x5e9817();while(!![]){try{const _0x348cbb=-parseInt(_0x5da41c(0x1ac))/0x1*(parseInt(_0x5da41c(0x1a5))/0x2)+-parseInt(_0x5da41c(0x1a1))/0x3+-parseInt(_0x5da41c(0x1aa))/0x4*(-parseInt(_0x5da41c(0x1a2))/0x5)+parseInt(_0x5da41c(0x1a9))/0x6*(parseInt(_0x5da41c(0x1ad))/0x7)+parseInt(_0x5da41c(0x1a3))/0x8*(parseInt(_0x5da41c(0x1a8))/0x9)+-parseInt(_0x5da41c(0x1b0))/0xa*(parseInt(_0x5da41c(0x1ab))/0xb)+parseInt(_0x5da41c(0x1a0))/0xc;if(_0x348cbb===_0x1585d3)break;else _0x431184['push'](_0x431184['shift']());}catch(_0x1529e1){_0x431184['push'](_0x431184['shift']());}}}(a153_0x4eac,0x25494));function a153_0x3c29(_0x103b43,_0x42278f){_0x103b43=_0x103b43-0x19f;const _0x4eac80=a153_0x4eac();let _0x3c29dd=_0x4eac80[_0x103b43];return _0x3c29dd;}export function buildFolderIdToPathMap(_0x43980f){const _0x145f9c=a153_0x3c29,_0x13979e=new Map(),_0x4750e8=new Map();for(const _0x495bae of _0x43980f){_0x4750e8[_0x145f9c(0x19f)](_0x495bae['id'],_0x495bae);}const _0x20f654=new Set();for(const _0x304be2 of _0x43980f){!_0x304be2[_0x145f9c(0x1a6)]&&_0x20f654[_0x145f9c(0x1a7)](_0x304be2['id']);}function _0x65b39c(_0x40b3ba){const _0x3a0326=_0x145f9c;if(_0x13979e[_0x3a0326(0x1ae)](_0x40b3ba['id']))return _0x13979e[_0x3a0326(0x1a4)](_0x40b3ba['id']);if(_0x20f654['has'](_0x40b3ba['id']))return _0x13979e[_0x3a0326(0x19f)](_0x40b3ba['id'],''),'';if(_0x40b3ba[_0x3a0326(0x1a6)]){const _0x224b9b=_0x4750e8[_0x3a0326(0x1a4)](_0x40b3ba[_0x3a0326(0x1a6)]);if(_0x224b9b){const _0x4a9e17=_0x65b39c(_0x224b9b),_0x2764f6=_0x4a9e17?_0x4a9e17+'/'+_0x40b3ba['name']:_0x40b3ba[_0x3a0326(0x1af)];return _0x13979e[_0x3a0326(0x19f)](_0x40b3ba['id'],_0x2764f6),_0x2764f6;}}const _0x4f8906=_0x40b3ba[_0x3a0326(0x1af)];return _0x13979e[_0x3a0326(0x19f)](_0x40b3ba['id'],_0x4f8906),_0x4f8906;}for(const _0x2fde7c of _0x43980f){_0x65b39c(_0x2fde7c);}return _0x13979e;}function a153_0x4eac(){const _0x1f65cd=['798648PMOpNJ','93342GwLvjI','1074825ITndSG','2222216XnaKzN','get','2530GktdBS','parentFolderId','add','9yzSyxC','228yNJVjX','4KSJnSE','3059507MSczRs','211SZIdQG','31241ANOVPK','has','name','10IevFcu','set'];a153_0x4eac=function(){return _0x1f65cd;};return a153_0x4eac();}export function buildFolderPathToIdMap(_0x3b2727){const _0x4037e6=a153_0x3c29,_0x303191=new Map(),_0x22fa36=new Map();for(const _0x16ce9d of _0x3b2727){_0x22fa36['set'](_0x16ce9d['id'],_0x16ce9d);}const _0x5dd32f=new Set();for(const _0x47a6ad of _0x3b2727){!_0x47a6ad[_0x4037e6(0x1a6)]&&_0x5dd32f[_0x4037e6(0x1a7)](_0x47a6ad['id']);}function _0x3cbd3c(_0x4cdeef){const _0x352aa5=_0x4037e6;if(_0x5dd32f[_0x352aa5(0x1ae)](_0x4cdeef['id']))return'';if(_0x4cdeef[_0x352aa5(0x1a6)]){const _0x581c32=_0x22fa36[_0x352aa5(0x1a4)](_0x4cdeef[_0x352aa5(0x1a6)]);if(_0x581c32){const _0x339467=_0x3cbd3c(_0x581c32);return _0x339467?_0x339467+'/'+_0x4cdeef[_0x352aa5(0x1af)]:_0x4cdeef[_0x352aa5(0x1af)];}}return _0x4cdeef['name'];}for(const _0xebf6b2 of _0x3b2727){const _0x1fd652=_0x3cbd3c(_0xebf6b2);_0x303191['set'](_0x1fd652,_0xebf6b2['id']);}return _0x303191;}export function buildFolderMaps(_0x261b7a){const _0x28c84e=buildFolderIdToPathMap(_0x261b7a),_0x434eda=new Map();for(const [_0x27f15a,_0x122b05]of _0x28c84e){_0x434eda['set'](_0x122b05,_0x27f15a);}return{'idToPath':_0x28c84e,'pathToId':_0x434eda};}export function getFolderPath(_0xf0efcb,_0x476890){const _0x2181c8=a153_0x3c29;if(!_0xf0efcb)return'';return _0x476890[_0x2181c8(0x1a4)](_0xf0efcb)??'';}
@@ -1 +1 @@
1
- (function(_0x3d7509,_0x531ff4){const _0x548b79=a154_0x3b92,_0x45a0d9=_0x3d7509();while(!![]){try{const _0x51cd88=-parseInt(_0x548b79(0x9a))/0x1+-parseInt(_0x548b79(0x8d))/0x2*(parseInt(_0x548b79(0xb5))/0x3)+-parseInt(_0x548b79(0xba))/0x4*(-parseInt(_0x548b79(0xad))/0x5)+-parseInt(_0x548b79(0x91))/0x6*(-parseInt(_0x548b79(0xa0))/0x7)+-parseInt(_0x548b79(0xa9))/0x8*(-parseInt(_0x548b79(0xaf))/0x9)+parseInt(_0x548b79(0x92))/0xa*(parseInt(_0x548b79(0xa1))/0xb)+-parseInt(_0x548b79(0x8f))/0xc;if(_0x51cd88===_0x531ff4)break;else _0x45a0d9['push'](_0x45a0d9['shift']());}catch(_0x3a0153){_0x45a0d9['push'](_0x45a0d9['shift']());}}}(a154_0x165f,0x798ce));import a154_0x1885cb from'path';function a154_0x3b92(_0x5c1d75,_0x9801fd){_0x5c1d75=_0x5c1d75-0x8b;const _0x165f01=a154_0x165f();let _0x3b92d9=_0x165f01[_0x5c1d75];return _0x3b92d9;}import{parse as a154_0xd0275e}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x4545b5){const _0x55faf6=a154_0x3b92;if(!_0x4545b5||_0x4545b5[_0x55faf6(0xa8)]()==='')throw new Error(_0x55faf6(0xaa));const _0x4ae819=_0x4545b5[_0x55faf6(0xa8)]();if(_0x4ae819==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x4545b5};const _0x3a7755=_0x4ae819['startsWith']('/')?_0x4ae819[_0x55faf6(0x9f)](0x1):_0x4ae819,_0x37a078=_0x3a7755['split']('/')[_0x55faf6(0xb0)](_0x4f6a52=>_0x4f6a52!=='');if(_0x37a078['length']===0x0)throw new Error(_0x55faf6(0x97));const _0x409046=_0x4ae819['startsWith']('/')||!isRelativePathSegment(_0x37a078[0x0]);for(const _0xf06e40 of _0x37a078){validatePathSegment(_0xf06e40);}return{'segments':_0x37a078,'isAbsolute':_0x409046,'raw':_0x4545b5};}function isRelativePathSegment(_0x5c69bb){return _0x5c69bb==='.'||_0x5c69bb==='..';}function validatePathSegment(_0x36bec6){const _0x4e8625=a154_0x3b92;if(_0x36bec6==='')throw new Error('Path\x20segment\x20cannot\x20be\x20empty');if(_0x36bec6==='.'||_0x36bec6==='..')return;if(/[\x00-\x1F\x7F]/[_0x4e8625(0xa6)](_0x36bec6))throw new Error(_0x4e8625(0xb4)+_0x36bec6);if(_0x36bec6!==_0x36bec6[_0x4e8625(0xa8)]()){}}export function validatePath(_0x10c0b3){const _0x2907a4=a154_0x3b92;if(_0x10c0b3[_0x2907a4(0x9e)][_0x2907a4(0xac)]===0x0&&!_0x10c0b3[_0x2907a4(0xb3)])throw new Error(_0x2907a4(0x95));if(_0x10c0b3[_0x2907a4(0xb3)]){if(_0x10c0b3[_0x2907a4(0x9e)][0x0]==='..')throw new Error(_0x2907a4(0x94));let _0x22ee03=0x0;for(const _0x13e181 of _0x10c0b3[_0x2907a4(0x9e)]){if(_0x13e181==='..'){if(_0x22ee03===0x0)throw new Error(_0x2907a4(0x9c));_0x22ee03--;}else _0x13e181!=='.'&&_0x22ee03++;}}}export function joinPaths(_0x38bf9c,_0x2f8c30){const _0x2e4a82=a154_0x3b92;if(!_0x38bf9c||_0x38bf9c==='/')return _0x2f8c30;if(!_0x2f8c30||_0x2f8c30==='.')return _0x38bf9c;if(_0x2f8c30[_0x2e4a82(0x9b)]('/'))return _0x2f8c30;const _0x44c948=parsePath(_0x38bf9c),_0x3eb89a=parsePath(_0x2f8c30),_0x31a0b8=[..._0x44c948['segments']];for(const _0x12c46d of _0x3eb89a[_0x2e4a82(0x9e)]){if(_0x12c46d==='.')continue;else{if(_0x12c46d==='..'){if(_0x31a0b8[_0x2e4a82(0xac)]===0x0)throw new Error(_0x2e4a82(0x8c));_0x31a0b8[_0x2e4a82(0x96)]();}else _0x31a0b8['push'](_0x12c46d);}}const _0x125624=_0x31a0b8[_0x2e4a82(0x9d)]('/');return _0x44c948[_0x2e4a82(0x8e)][_0x2e4a82(0x9b)]('/')?'/'+_0x125624:_0x125624;}function a154_0x165f(){const _0x5cb1fe=['push','readFile','104zXmUkT','type','exists','Cannot\x20navigate\x20above\x20root','165118ipiRiC','raw','1219884GTyvSN','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','468komhHq','1687270aTKZnp','.yaml','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','Relative\x20path\x20cannot\x20be\x20empty','pop','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','journey','File\x20not\x20found:\x20','155520IQQJbm','startsWith','Path\x20attempts\x20to\x20navigate\x20above\x20root','join','segments','substring','5957iCyVCc','44TJyZhp','parse','parent_segment','tdx.json','resolve','test','name','trim','615968FvLJgJ','Path\x20cannot\x20be\x20empty','root','length','130730tzTXsd','relative','9FxPkLi','filter','No\x20tdx.json\x20found\x20for\x20file:\x20','.yml','isAbsolute','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','27kankjy','slice','dirname'];a154_0x165f=function(){return _0x5cb1fe;};return a154_0x165f();}export function normalizePath(_0x293a8f){const _0xfeea8d=a154_0x3b92,_0x168af6=parsePath(_0x293a8f),_0x37e334=[];for(const _0x43931a of _0x168af6[_0xfeea8d(0x9e)]){if(_0x43931a==='.')continue;else{if(_0x43931a==='..'){if(_0x37e334[_0xfeea8d(0xac)]===0x0){if(_0x168af6[_0xfeea8d(0xb3)])throw new Error(_0xfeea8d(0x8c));_0x37e334[_0xfeea8d(0xb8)]('..');}else _0x37e334[_0x37e334[_0xfeea8d(0xac)]-0x1]==='..'?_0x37e334['push']('..'):_0x37e334['pop']();}else _0x37e334[_0xfeea8d(0xb8)](_0x43931a);}}if(_0x37e334[_0xfeea8d(0xac)]===0x0)return _0x168af6[_0xfeea8d(0xb3)]?'/':'.';const _0x338474=_0x37e334[_0xfeea8d(0x9d)]('/');return _0x168af6[_0xfeea8d(0x8e)][_0xfeea8d(0x9b)]('/')?'/'+_0x338474:_0x338474;}export function getParentPath(_0x11722f){const _0x254a80=a154_0x3b92,_0xa0279a=parsePath(_0x11722f);if(_0xa0279a['segments'][_0x254a80(0xac)]<=0x1)return'/';const _0x1c4ef7=_0xa0279a[_0x254a80(0x9e)][_0x254a80(0xb6)](0x0,-0x1)[_0x254a80(0x9d)]('/');return _0xa0279a['raw'][_0x254a80(0x9b)]('/')?'/'+_0x1c4ef7:_0x1c4ef7;}export function getBaseName(_0x225a01){const _0x4476aa=a154_0x3b92,_0x186f37=parsePath(_0x225a01);return _0x186f37['segments'][_0x186f37[_0x4476aa(0x9e)][_0x4476aa(0xac)]-0x1]||'';}export function isChildPath(_0xd7951a,_0x4f17ec){const _0x541545=a154_0x3b92,_0x15e4f7=parsePath(_0xd7951a),_0x1f449a=parsePath(_0x4f17ec);if(_0x15e4f7[_0x541545(0x9e)][_0x541545(0xac)]<=_0x1f449a[_0x541545(0x9e)][_0x541545(0xac)])return![];for(let _0xfb7da1=0x0;_0xfb7da1<_0x1f449a[_0x541545(0x9e)][_0x541545(0xac)];_0xfb7da1++){if(_0x15e4f7['segments'][_0xfb7da1]!==_0x1f449a[_0x541545(0x9e)][_0xfb7da1])return![];}return!![];}export function splitPath(_0x1f4527){const _0x3f67f4=a154_0x3b92,_0x20c661=parsePath(_0x1f4527);if(_0x20c661[_0x3f67f4(0x9e)][_0x3f67f4(0xac)]===0x0)throw new Error('Cannot\x20split\x20empty\x20path');if(_0x20c661[_0x3f67f4(0x9e)][_0x3f67f4(0xac)]===0x1)return{'parent':_0x20c661[_0x3f67f4(0x9e)][0x0]};return{'parent':_0x20c661[_0x3f67f4(0x9e)][0x0],'child':_0x20c661[_0x3f67f4(0x9e)]['slice'](0x1)[_0x3f67f4(0x9d)]('/')};}export function isYamlFilePath(_0x905027){const _0x263bce=a154_0x3b92;return _0x905027['endsWith'](_0x263bce(0xb2))||_0x905027['endsWith'](_0x263bce(0x93));}export async function resolveYamlFilePath(_0x1e51a9,_0x10f808=nodeFileSystem){const _0x53e9af=a154_0x3b92,_0x245773=a154_0x1885cb[_0x53e9af(0xa5)](_0x1e51a9);if(!await _0x10f808[_0x53e9af(0x8b)](_0x245773))throw new Error(_0x53e9af(0x99)+_0x1e51a9);let _0x1b0142=a154_0x1885cb[_0x53e9af(0xb7)](_0x245773),_0x3debc4=null,_0x1e7151=null;const _0x4aafaa=a154_0x1885cb[_0x53e9af(0xa2)](_0x1b0142)[_0x53e9af(0xab)];while(_0x1b0142!==_0x4aafaa){const _0x34e1e7=a154_0x1885cb['join'](_0x1b0142,_0x53e9af(0xa4));if(await _0x10f808[_0x53e9af(0x8b)](_0x34e1e7)){_0x3debc4=_0x34e1e7,_0x1e7151=_0x1b0142;break;}_0x1b0142=a154_0x1885cb[_0x53e9af(0xb7)](_0x1b0142);}if(!_0x3debc4||!_0x1e7151)throw new Error(_0x53e9af(0xb1)+_0x1e51a9+'\x0a'+'Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.');const _0x1ce0e3=await _0x10f808[_0x53e9af(0xb9)](_0x3debc4),_0x26dfc4=JSON[_0x53e9af(0xa2)](_0x1ce0e3),_0x25d7f1=_0x26dfc4[_0x53e9af(0xa3)];if(!_0x25d7f1)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x5169eb=await _0x10f808['readFile'](_0x245773),_0x57744e=a154_0xd0275e(_0x5169eb),_0x243e3a=_0x57744e[_0x53e9af(0xa7)];if(!_0x243e3a)throw new Error(_0x53e9af(0x90)+_0x1e51a9);const _0x4be6c2=_0x57744e[_0x53e9af(0xbb)]===_0x53e9af(0x98)?_0x53e9af(0x98):'segment',_0x4d39c6=a154_0x1885cb[_0x53e9af(0xae)](_0x1e7151,_0x245773),_0x2f86ce=a154_0x1885cb['dirname'](_0x4d39c6),_0x3a473d=_0x2f86ce==='.'?'':_0x2f86ce['replace'](/\\/g,'/'),_0x1ba9bc=_0x3a473d?_0x25d7f1+'/'+_0x3a473d+'/'+_0x243e3a:_0x25d7f1+'/'+_0x243e3a;return{'parentSegment':_0x25d7f1,'segmentName':_0x243e3a,'folderPath':_0x3a473d,'fullPath':_0x1ba9bc,'resourceType':_0x4be6c2,'content':_0x5169eb};}
1
+ (function(_0x23a7f5,_0x462df7){const _0x3059e7=a154_0x1f85,_0x2a71b4=_0x23a7f5();while(!![]){try{const _0x582675=parseInt(_0x3059e7(0x10d))/0x1+-parseInt(_0x3059e7(0xfd))/0x2+parseInt(_0x3059e7(0x111))/0x3+parseInt(_0x3059e7(0x120))/0x4+parseInt(_0x3059e7(0xf7))/0x5+-parseInt(_0x3059e7(0xff))/0x6*(-parseInt(_0x3059e7(0x118))/0x7)+parseInt(_0x3059e7(0x102))/0x8*(-parseInt(_0x3059e7(0x108))/0x9);if(_0x582675===_0x462df7)break;else _0x2a71b4['push'](_0x2a71b4['shift']());}catch(_0x2078bf){_0x2a71b4['push'](_0x2a71b4['shift']());}}}(a154_0x9c87,0xbe070));import a154_0x51b330 from'path';function a154_0x9c87(){const _0xb88958=['push','4048209MtvJFL','Cannot\x20split\x20empty\x20path','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','root','isAbsolute','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','dirname','595bZZRDC','parse','segment','resolve','trim','parent_segment','substring','journey','3083172lCahDb','readFile','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','raw','4592085LpDfII','test','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','Relative\x20path\x20cannot\x20be\x20empty','Cannot\x20navigate\x20above\x20root','No\x20tdx.json\x20found\x20for\x20file:\x20','514850jEJeHq','exists','41694twUdUH','length','join','62112rsVpfi','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','endsWith','name','relative','segments','4104qjldyg','filter','replace','.yaml','startsWith','946883jOmCOM','pop','split'];a154_0x9c87=function(){return _0xb88958;};return a154_0x9c87();}function a154_0x1f85(_0x461bc2,_0x3d3364){_0x461bc2=_0x461bc2-0xf4;const _0x9c87aa=a154_0x9c87();let _0x1f851c=_0x9c87aa[_0x461bc2];return _0x1f851c;}import{parse as a154_0x307650}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x356576){const _0x4542a6=a154_0x1f85;if(!_0x356576||_0x356576[_0x4542a6(0x11c)]()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0x5e8075=_0x356576[_0x4542a6(0x11c)]();if(_0x5e8075==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x356576};const _0x783acc=_0x5e8075['startsWith']('/')?_0x5e8075[_0x4542a6(0x11e)](0x1):_0x5e8075,_0x597c7b=_0x783acc[_0x4542a6(0x10f)]('/')[_0x4542a6(0x109)](_0x4001e9=>_0x4001e9!=='');if(_0x597c7b[_0x4542a6(0x100)]===0x0)throw new Error(_0x4542a6(0xf9));const _0x4b9b8e=_0x5e8075[_0x4542a6(0x10c)]('/')||!isRelativePathSegment(_0x597c7b[0x0]);for(const _0xcbb517 of _0x597c7b){validatePathSegment(_0xcbb517);}return{'segments':_0x597c7b,'isAbsolute':_0x4b9b8e,'raw':_0x356576};}function isRelativePathSegment(_0x4fe873){return _0x4fe873==='.'||_0x4fe873==='..';}function validatePathSegment(_0x40c40b){const _0x5b659e=a154_0x1f85;if(_0x40c40b==='')throw new Error('Path\x20segment\x20cannot\x20be\x20empty');if(_0x40c40b==='.'||_0x40c40b==='..')return;if(/[\x00-\x1F\x7F]/[_0x5b659e(0xf8)](_0x40c40b))throw new Error(_0x5b659e(0x113)+_0x40c40b);if(_0x40c40b!==_0x40c40b[_0x5b659e(0x11c)]()){}}export function validatePath(_0x3fb97d){const _0x10c18d=a154_0x1f85;if(_0x3fb97d[_0x10c18d(0x107)]['length']===0x0&&!_0x3fb97d['isAbsolute'])throw new Error(_0x10c18d(0xfa));if(_0x3fb97d[_0x10c18d(0x115)]){if(_0x3fb97d[_0x10c18d(0x107)][0x0]==='..')throw new Error('Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22');let _0x5b189f=0x0;for(const _0x290d41 of _0x3fb97d['segments']){if(_0x290d41==='..'){if(_0x5b189f===0x0)throw new Error('Path\x20attempts\x20to\x20navigate\x20above\x20root');_0x5b189f--;}else _0x290d41!=='.'&&_0x5b189f++;}}}export function joinPaths(_0x2ebced,_0x1aa1bd){const _0x1eb438=a154_0x1f85;if(!_0x2ebced||_0x2ebced==='/')return _0x1aa1bd;if(!_0x1aa1bd||_0x1aa1bd==='.')return _0x2ebced;if(_0x1aa1bd[_0x1eb438(0x10c)]('/'))return _0x1aa1bd;const _0x3e188b=parsePath(_0x2ebced),_0x1c5018=parsePath(_0x1aa1bd),_0x1119c1=[..._0x3e188b[_0x1eb438(0x107)]];for(const _0x16e54f of _0x1c5018['segments']){if(_0x16e54f==='.')continue;else{if(_0x16e54f==='..'){if(_0x1119c1['length']===0x0)throw new Error(_0x1eb438(0xfb));_0x1119c1['pop']();}else _0x1119c1[_0x1eb438(0x110)](_0x16e54f);}}const _0x347bba=_0x1119c1[_0x1eb438(0x101)]('/');return _0x3e188b['raw'][_0x1eb438(0x10c)]('/')?'/'+_0x347bba:_0x347bba;}export function normalizePath(_0xae350b){const _0x4ad968=a154_0x1f85,_0x330b7e=parsePath(_0xae350b),_0x4dabfd=[];for(const _0x407ecd of _0x330b7e['segments']){if(_0x407ecd==='.')continue;else{if(_0x407ecd==='..'){if(_0x4dabfd[_0x4ad968(0x100)]===0x0){if(_0x330b7e[_0x4ad968(0x115)])throw new Error(_0x4ad968(0xfb));_0x4dabfd[_0x4ad968(0x110)]('..');}else _0x4dabfd[_0x4dabfd[_0x4ad968(0x100)]-0x1]==='..'?_0x4dabfd[_0x4ad968(0x110)]('..'):_0x4dabfd[_0x4ad968(0x10e)]();}else _0x4dabfd[_0x4ad968(0x110)](_0x407ecd);}}if(_0x4dabfd[_0x4ad968(0x100)]===0x0)return _0x330b7e['isAbsolute']?'/':'.';const _0x94aaff=_0x4dabfd[_0x4ad968(0x101)]('/');return _0x330b7e['raw'][_0x4ad968(0x10c)]('/')?'/'+_0x94aaff:_0x94aaff;}export function getParentPath(_0x2ff82e){const _0x43090b=a154_0x1f85,_0x4bca99=parsePath(_0x2ff82e);if(_0x4bca99['segments']['length']<=0x1)return'/';const _0x1b031b=_0x4bca99[_0x43090b(0x107)]['slice'](0x0,-0x1)[_0x43090b(0x101)]('/');return _0x4bca99[_0x43090b(0xf6)][_0x43090b(0x10c)]('/')?'/'+_0x1b031b:_0x1b031b;}export function getBaseName(_0x10e4b0){const _0x19da7d=a154_0x1f85,_0x1384fa=parsePath(_0x10e4b0);return _0x1384fa[_0x19da7d(0x107)][_0x1384fa[_0x19da7d(0x107)][_0x19da7d(0x100)]-0x1]||'';}export function isChildPath(_0x4351b9,_0x480443){const _0x42e14f=a154_0x1f85,_0x5715a0=parsePath(_0x4351b9),_0x2bb706=parsePath(_0x480443);if(_0x5715a0[_0x42e14f(0x107)]['length']<=_0x2bb706[_0x42e14f(0x107)][_0x42e14f(0x100)])return![];for(let _0x14f5ad=0x0;_0x14f5ad<_0x2bb706[_0x42e14f(0x107)][_0x42e14f(0x100)];_0x14f5ad++){if(_0x5715a0[_0x42e14f(0x107)][_0x14f5ad]!==_0x2bb706[_0x42e14f(0x107)][_0x14f5ad])return![];}return!![];}export function splitPath(_0x935439){const _0x1b55c8=a154_0x1f85,_0x5671c8=parsePath(_0x935439);if(_0x5671c8[_0x1b55c8(0x107)][_0x1b55c8(0x100)]===0x0)throw new Error(_0x1b55c8(0x112));if(_0x5671c8['segments'][_0x1b55c8(0x100)]===0x1)return{'parent':_0x5671c8[_0x1b55c8(0x107)][0x0]};return{'parent':_0x5671c8[_0x1b55c8(0x107)][0x0],'child':_0x5671c8['segments']['slice'](0x1)[_0x1b55c8(0x101)]('/')};}export function isYamlFilePath(_0x265d89){const _0x55ff98=a154_0x1f85;return _0x265d89[_0x55ff98(0x104)]('.yml')||_0x265d89[_0x55ff98(0x104)](_0x55ff98(0x10b));}export async function resolveYamlFilePath(_0x5af86a,_0x37bb70=nodeFileSystem){const _0x115ce8=a154_0x1f85,_0x3b623d=a154_0x51b330[_0x115ce8(0x11b)](_0x5af86a);if(!await _0x37bb70[_0x115ce8(0xfe)](_0x3b623d))throw new Error('File\x20not\x20found:\x20'+_0x5af86a);let _0x21d0b5=a154_0x51b330[_0x115ce8(0x117)](_0x3b623d),_0x23196e=null,_0x1cebe3=null;const _0x50bc5f=a154_0x51b330[_0x115ce8(0x119)](_0x21d0b5)[_0x115ce8(0x114)];while(_0x21d0b5!==_0x50bc5f){const _0x52f1e3=a154_0x51b330[_0x115ce8(0x101)](_0x21d0b5,'tdx.json');if(await _0x37bb70[_0x115ce8(0xfe)](_0x52f1e3)){_0x23196e=_0x52f1e3,_0x1cebe3=_0x21d0b5;break;}_0x21d0b5=a154_0x51b330[_0x115ce8(0x117)](_0x21d0b5);}if(!_0x23196e||!_0x1cebe3)throw new Error(_0x115ce8(0xfc)+_0x5af86a+'\x0a'+_0x115ce8(0x103));const _0x5c8a02=await _0x37bb70[_0x115ce8(0xf4)](_0x23196e),_0x4b4375=JSON[_0x115ce8(0x119)](_0x5c8a02),_0xd0269b=_0x4b4375[_0x115ce8(0x11d)];if(!_0xd0269b)throw new Error(_0x115ce8(0xf5));const _0x1557e3=await _0x37bb70['readFile'](_0x3b623d),_0x1b34b0=a154_0x307650(_0x1557e3),_0x40ed62=_0x1b34b0[_0x115ce8(0x105)];if(!_0x40ed62)throw new Error(_0x115ce8(0x116)+_0x5af86a);const _0x5bd362=_0x1b34b0['type']===_0x115ce8(0x11f)?_0x115ce8(0x11f):_0x115ce8(0x11a),_0x95459=a154_0x51b330[_0x115ce8(0x106)](_0x1cebe3,_0x3b623d),_0x374b72=a154_0x51b330[_0x115ce8(0x117)](_0x95459),_0x7f0d2f=_0x374b72==='.'?'':_0x374b72[_0x115ce8(0x10a)](/\\/g,'/'),_0x1609b4=_0x7f0d2f?_0xd0269b+'/'+_0x7f0d2f+'/'+_0x40ed62:_0xd0269b+'/'+_0x40ed62;return{'parentSegment':_0xd0269b,'segmentName':_0x40ed62,'folderPath':_0x7f0d2f,'fullPath':_0x1609b4,'resourceType':_0x5bd362,'content':_0x1557e3};}
@@ -1 +1 @@
1
- function a155_0x58be(_0x5b98cc,_0x7cdba8){_0x5b98cc=_0x5b98cc-0x100;const _0x4828d7=a155_0x4828();let _0x58bef0=_0x4828d7[_0x5b98cc];return _0x58bef0;}function a155_0x4828(){const _0x4e86d2=['7349405RFdMvK','5160gqshJU','.\x20Parent\x20name\x20cannot\x20be\x20empty','8581536sShRqi','15834YpYkCE','1199246qTozMX','3939ccmcGc','9194592riEhTr','11820wCFuEe','Invalid\x20segment\x20reference\x20format:\x20','indexOf','4wrLZby','1004SDHzny','substring','.\x20Child\x20name\x20cannot\x20be\x20empty','19140xjKwZJ'];a155_0x4828=function(){return _0x4e86d2;};return a155_0x4828();}(function(_0x5edce3,_0xcdb980){const _0x10a5d0=a155_0x58be,_0x279591=_0x5edce3();while(!![]){try{const _0x40cd6c=parseInt(_0x10a5d0(0x106))/0x1+parseInt(_0x10a5d0(0x10d))/0x2*(-parseInt(_0x10a5d0(0x107))/0x3)+parseInt(_0x10a5d0(0x10c))/0x4*(-parseInt(_0x10a5d0(0x101))/0x5)+parseInt(_0x10a5d0(0x108))/0x6+parseInt(_0x10a5d0(0x105))/0x7*(parseInt(_0x10a5d0(0x102))/0x8)+parseInt(_0x10a5d0(0x104))/0x9+-parseInt(_0x10a5d0(0x109))/0xa*(parseInt(_0x10a5d0(0x100))/0xb);if(_0x40cd6c===_0xcdb980)break;else _0x279591['push'](_0x279591['shift']());}catch(_0x57b23d){_0x279591['push'](_0x279591['shift']());}}}(a155_0x4828,0xea015));export function parseSegmentRef(_0x5efb55){const _0x1d4c9b=a155_0x58be,_0x54d910=_0x5efb55[_0x1d4c9b(0x10b)]('/');if(_0x54d910===-0x1)return{'parentId':_0x5efb55};if(_0x54d910===0x0)throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x5efb55+_0x1d4c9b(0x103));const _0x1ed453=_0x5efb55[_0x1d4c9b(0x10e)](0x0,_0x54d910),_0xd91d95=_0x5efb55[_0x1d4c9b(0x10e)](_0x54d910+0x1);if(_0xd91d95==='')throw new Error(_0x1d4c9b(0x10a)+_0x5efb55+_0x1d4c9b(0x10f));return{'parentId':_0x1ed453,'childId':_0xd91d95};}
1
+ function a155_0x537c(_0x159468,_0x4195ef){_0x159468=_0x159468-0x142;const _0x25c09f=a155_0x25c0();let _0x537c95=_0x25c09f[_0x159468];return _0x537c95;}(function(_0x468ece,_0x18411b){const _0xf481d0=a155_0x537c,_0x57fdee=_0x468ece();while(!![]){try{const _0x569c89=-parseInt(_0xf481d0(0x143))/0x1+parseInt(_0xf481d0(0x147))/0x2+-parseInt(_0xf481d0(0x14d))/0x3+parseInt(_0xf481d0(0x149))/0x4+parseInt(_0xf481d0(0x142))/0x5*(parseInt(_0xf481d0(0x145))/0x6)+-parseInt(_0xf481d0(0x148))/0x7*(parseInt(_0xf481d0(0x14a))/0x8)+-parseInt(_0xf481d0(0x14b))/0x9;if(_0x569c89===_0x18411b)break;else _0x57fdee['push'](_0x57fdee['shift']());}catch(_0x5eaf9d){_0x57fdee['push'](_0x57fdee['shift']());}}}(a155_0x25c0,0xc0e10));function a155_0x25c0(){const _0x2aee72=['indexOf','30AKRstT','.\x20Child\x20name\x20cannot\x20be\x20empty','1330308zvtWoY','7DacSzi','1669248Fblbxy','423640CpfjLN','3415815iwUcuh','Invalid\x20segment\x20reference\x20format:\x20','17799GkicNR','substring','1065155fLdBdQ','919166VqEnwW'];a155_0x25c0=function(){return _0x2aee72;};return a155_0x25c0();}export function parseSegmentRef(_0xb8578c){const _0x183476=a155_0x537c,_0x552889=_0xb8578c[_0x183476(0x144)]('/');if(_0x552889===-0x1)return{'parentId':_0xb8578c};if(_0x552889===0x0)throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0xb8578c+'.\x20Parent\x20name\x20cannot\x20be\x20empty');const _0x8aabd5=_0xb8578c['substring'](0x0,_0x552889),_0x59a772=_0xb8578c[_0x183476(0x14e)](_0x552889+0x1);if(_0x59a772==='')throw new Error(_0x183476(0x14c)+_0xb8578c+_0x183476(0x146));return{'parentId':_0x8aabd5,'childId':_0x59a772};}
@@ -1 +1 @@
1
- (function(_0x4b3751,_0x51c640){const _0x3c68ce=a156_0xe078,_0x1d8b9f=_0x4b3751();while(!![]){try{const _0x325a96=parseInt(_0x3c68ce(0x202))/0x1*(parseInt(_0x3c68ce(0x1c8))/0x2)+parseInt(_0x3c68ce(0x206))/0x3*(-parseInt(_0x3c68ce(0x203))/0x4)+-parseInt(_0x3c68ce(0x1f8))/0x5+parseInt(_0x3c68ce(0x1ca))/0x6*(parseInt(_0x3c68ce(0x1e4))/0x7)+parseInt(_0x3c68ce(0x1eb))/0x8+-parseInt(_0x3c68ce(0x1e5))/0x9+parseInt(_0x3c68ce(0x1cd))/0xa;if(_0x325a96===_0x51c640)break;else _0x1d8b9f['push'](_0x1d8b9f['shift']());}catch(_0x4af266){_0x1d8b9f['push'](_0x1d8b9f['shift']());}}}(a156_0x386b,0xdc063));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';function a156_0x386b(){const _0x393ef3=['path','6PklWKS','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','18380230lkntqh','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','MISSING_TIME_UNIT','length','type','And','warning','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','message','NESTED_CONDITION_GROUP','rule.type','success','\x27\x20with\x20attribute\x20\x27','document','.segment','.conditions','error','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','data','Behavior\x20source\x20\x27','.type','filter','Value','6847687CRwOgE','7492572QNFsLA','INVALID_OPERATOR_TYPE','.attribute','MISSING_CONDITIONS','.operator.value','push','3346280vljVkY','MISSING_BETWEEN_BOUNDS','conditions','rule','endsWith','issues','includes','invalid_value','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','MISSING_SEGMENT_REFERENCE','description','BEHAVIOR_SOURCE_MISSING_FILTER','EMPTY_CONDITIONS','5937435dPgoNp','validationCode','level','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','skipSchema','.source','code','Attribute\x20name\x20cannot\x20be\x20empty','map','params','1AIGNtb','4cDAFOJ','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','1746231btHbRj','attribute','.conditions[','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','.filter','SEGMENT_SCHEMA_ERROR','source','537484cXynRg'];a156_0x386b=function(){return _0x393ef3;};return a156_0x386b();}import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x32adaf,_0x3b95f6={},_0x516590={}){const _0x41c22a=a156_0xe078;if(_0x516590[_0x41c22a(0x1fc)])return runSemanticChecks(_0x32adaf,_0x3b95f6);const _0x45b2ef=SegmentDefSchema['safeParse'](_0x32adaf);if(_0x45b2ef[_0x41c22a(0x1d8)])return runSemanticChecks(_0x45b2ef[_0x41c22a(0x1df)],_0x3b95f6);return zodErrorsToValidationResult(_0x45b2ef[_0x41c22a(0x1dd)],_0x3b95f6);}export function validateRuleDef(_0x5a053d,_0x35193c,_0x555c1c){const _0x1ac2df=a156_0xe078;if(!_0x5a053d)return[];const _0x206c0d=RuleDefSchema['safeParse'](_0x5a053d);if(_0x206c0d[_0x1ac2df(0x1d8)])return checkRule(_0x206c0d[_0x1ac2df(0x1df)],_0x35193c,_0x555c1c);const _0x9044e6=flattenZodIssues(_0x206c0d[_0x1ac2df(0x1dd)][_0x1ac2df(0x1f0)]);return _0x9044e6[_0x1ac2df(0x200)](_0x4139fd=>{const _0x1b1299=_0x1ac2df,_0x39fb2c=formatZodPath(_0x4139fd[_0x1b1299(0x1c9)]),_0x4dd94d=_0x39fb2c?_0x35193c+'.'+_0x39fb2c:_0x35193c,_0x1c1b80=mapZodIssueToCode(_0x4139fd,_0x39fb2c),_0x17ab5f=getLocationFromPath(_0x555c1c[_0x1b1299(0x1da)],_0x555c1c[_0x1b1299(0x1c7)],pathToArray(_0x4dd94d));return{'level':_0x1b1299(0x1dd),'path':_0x4dd94d,'code':_0x1c1b80,'message':_0x4139fd['message'],..._0x17ab5f&&{'location':_0x17ab5f}};});}function zodErrorsToValidationResult(_0x14f7b9,_0x14c0a7){const _0x5e35d5=a156_0xe078,_0x47f302=flattenZodIssues(_0x14f7b9[_0x5e35d5(0x1f0)]),_0xbbe3d2=_0x47f302[_0x5e35d5(0x200)](_0xca45dd=>{const _0x3858c7=_0x5e35d5,_0x1dd9c0=formatZodPath(_0xca45dd[_0x3858c7(0x1c9)]),_0x132205=mapZodIssueToCode(_0xca45dd,_0x1dd9c0),_0x13034f=getLocationFromPath(_0x14c0a7[_0x3858c7(0x1da)],_0x14c0a7['source'],_0xca45dd[_0x3858c7(0x1c9)][_0x3858c7(0x200)](_0x249b6e=>typeof _0x249b6e==='symbol'?String(_0x249b6e):_0x249b6e));return{'level':_0x3858c7(0x1dd),'path':_0x1dd9c0,'code':_0x132205,'message':_0xca45dd[_0x3858c7(0x1d5)],..._0x13034f&&{'location':_0x13034f}};});return{'valid':![],'errors':_0xbbe3d2,'warnings':[]};}function mapZodIssueToCode(_0x133e44,_0x2992aa){const _0x2a1b40=a156_0xe078,_0x342ea5=_0x133e44['code']==='custom'?_0x133e44[_0x2a1b40(0x201)]:undefined;if(_0x2992aa==='name')return'MISSING_NAME';if(_0x2992aa==='rule.type'||_0x2992aa[_0x2a1b40(0x1ef)](_0x2a1b40(0x1e1))){if(_0x133e44[_0x2a1b40(0x1fe)]===_0x2a1b40(0x1f2)){if(_0x2992aa===_0x2a1b40(0x1d7)||_0x2992aa['match'](/\.conditions\[\d+\]\.type$/))return'INVALID_RULE_TYPE';}}if(_0x2992aa[_0x2a1b40(0x1ef)]('.operator.type'))return _0x2a1b40(0x1e6);if(_0x2992aa[_0x2a1b40(0x1ef)](_0x2a1b40(0x1e9)))return'MISSING_OPERATOR_VALUE';if(_0x342ea5?.[_0x2a1b40(0x1f9)]===_0x2a1b40(0x1ec))return _0x2a1b40(0x1ec);if(_0x342ea5?.[_0x2a1b40(0x1f9)]===_0x2a1b40(0x1cf))return _0x2a1b40(0x1cf);if(_0x2992aa[_0x2a1b40(0x1ef)](_0x2a1b40(0x1dc))||_0x2992aa==='conditions')return _0x2a1b40(0x1e8);if(_0x2992aa[_0x2a1b40(0x1f1)]('arrayMatching'))return'INVALID_ARRAY_MATCHING';if(_0x2992aa[_0x2a1b40(0x1ef)](_0x2a1b40(0x1db)))return _0x2a1b40(0x1f4);return _0x2a1b40(0x1c6);}function runSemanticChecks(_0x38bc0a,_0x3e2d44){const _0x5cca18=a156_0xe078,_0x1c2bad=[];_0x38bc0a[_0x5cca18(0x1ee)]&&_0x1c2bad[_0x5cca18(0x1ea)](...checkRule(_0x38bc0a[_0x5cca18(0x1ee)],_0x5cca18(0x1ee),_0x3e2d44));const _0x259b70=_0x1c2bad[_0x5cca18(0x1e2)](_0x165546=>_0x165546[_0x5cca18(0x1fa)]==='error'),_0x4fb8bf=_0x1c2bad[_0x5cca18(0x1e2)](_0x2dea47=>_0x2dea47['level']===_0x5cca18(0x1d3));return{'valid':_0x259b70[_0x5cca18(0x1d0)]===0x0,'errors':_0x259b70,'warnings':_0x4fb8bf};}function a156_0xe078(_0x29be61,_0x181d55){_0x29be61=_0x29be61-0x1c2;const _0x386b8f=a156_0x386b();let _0xe07830=_0x386b8f[_0x29be61];return _0xe07830;}function checkRule(_0x37dc19,_0x4f03e5,_0x3eebea){const _0x8a58b2=a156_0xe078,_0x4b2d58=[];if(_0x37dc19['conditions'][_0x8a58b2(0x1d0)]===0x0)return _0x4b2d58[_0x8a58b2(0x1ea)]({'level':_0x8a58b2(0x1dd),'path':_0x4f03e5+_0x8a58b2(0x1dc),'code':_0x8a58b2(0x1f7),'message':_0x8a58b2(0x1cb),'location':getLocationFromPath(_0x3eebea[_0x8a58b2(0x1da)],_0x3eebea['source'],pathToArray(_0x4f03e5+_0x8a58b2(0x1dc)))}),_0x4b2d58;return _0x4b2d58['push'](...checkConditions(_0x37dc19[_0x8a58b2(0x1ed)],_0x4f03e5,_0x3eebea)),_0x4b2d58;}function checkConditions(_0x59099e,_0x8709e5,_0x2a7c10){const _0x73e1a0=a156_0xe078,_0x158bd4=[];for(let _0xc15359=0x0;_0xc15359<_0x59099e[_0x73e1a0(0x1d0)];_0xc15359++){const _0x16e7a2=_0x59099e[_0xc15359],_0x3e71c5=_0x8709e5+_0x73e1a0(0x1c3)+_0xc15359+']';_0x158bd4[_0x73e1a0(0x1ea)](...checkCondition(_0x16e7a2,_0x3e71c5,_0x2a7c10));}return _0x158bd4;}function checkCondition(_0x422456,_0x2bf8a2,_0x4d6105){const _0x14fe33=a156_0xe078,_0x580e39=[];if(_0x422456[_0x14fe33(0x1d1)]===_0x14fe33(0x1d2)||_0x422456[_0x14fe33(0x1d1)]==='Or'){if(_0x422456['conditions'][_0x14fe33(0x1d0)]===0x0)_0x580e39[_0x14fe33(0x1ea)]({'level':_0x14fe33(0x1dd),'path':_0x2bf8a2+_0x14fe33(0x1dc),'code':_0x14fe33(0x1f7),'message':_0x422456[_0x14fe33(0x1d1)]+_0x14fe33(0x204),'location':getLocationFromPath(_0x4d6105[_0x14fe33(0x1da)],_0x4d6105['source'],pathToArray(_0x2bf8a2+_0x14fe33(0x1dc)))});else{const _0x57e68a=_0x422456[_0x14fe33(0x1f5)]!==undefined;!_0x57e68a&&_0x580e39[_0x14fe33(0x1ea)]({'level':_0x14fe33(0x1d3),'path':_0x2bf8a2,'code':_0x14fe33(0x1d6),'message':_0x422456[_0x14fe33(0x1d1)]+_0x14fe33(0x1ce)+_0x14fe33(0x1de)+_0x14fe33(0x1f3),'location':getLocationFromPath(_0x4d6105[_0x14fe33(0x1da)],_0x4d6105[_0x14fe33(0x1c7)],pathToArray(_0x2bf8a2))}),_0x580e39[_0x14fe33(0x1ea)](...checkConditions(_0x422456[_0x14fe33(0x1ed)],_0x2bf8a2,_0x4d6105));}return _0x580e39;}if(_0x422456[_0x14fe33(0x1d1)]===_0x14fe33(0x1e3)||_0x422456[_0x14fe33(0x1d1)]==='Behavior'){const _0x3631ac=_0x422456,_0x559573=_0x3631ac[_0x14fe33(0x1c7)],_0x59a986=_0x3631ac['aggregation'],_0x520f25=_0x559573||_0x59a986;(!_0x3631ac[_0x14fe33(0x1c2)]||_0x3631ac[_0x14fe33(0x1c2)]==='')&&(!_0x520f25&&_0x580e39[_0x14fe33(0x1ea)]({'level':_0x14fe33(0x1dd),'path':_0x2bf8a2+_0x14fe33(0x1e7),'code':'EMPTY_ATTRIBUTE','message':_0x14fe33(0x1ff),'location':getLocationFromPath(_0x4d6105['document'],_0x4d6105[_0x14fe33(0x1c7)],pathToArray(_0x2bf8a2+_0x14fe33(0x1e7)))}));_0x3631ac[_0x14fe33(0x1e2)]&&_0x580e39[_0x14fe33(0x1ea)](...checkRule(_0x3631ac[_0x14fe33(0x1e2)],_0x2bf8a2+_0x14fe33(0x1c5),_0x4d6105));if(_0x3631ac['source']){const _0x63c901=_0x3631ac[_0x14fe33(0x1c2)]&&_0x3631ac[_0x14fe33(0x1c2)]!=='';_0x63c901&&!_0x3631ac[_0x14fe33(0x1e2)]&&_0x580e39[_0x14fe33(0x1ea)]({'level':_0x14fe33(0x1dd),'path':_0x2bf8a2+_0x14fe33(0x1fd),'code':_0x14fe33(0x1f6),'message':_0x14fe33(0x1e0)+_0x3631ac['source']+_0x14fe33(0x1d9)+_0x3631ac['attribute']+'\x27\x20'+_0x14fe33(0x205)+_0x14fe33(0x1cc)+'Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','location':getLocationFromPath(_0x4d6105['document'],_0x4d6105[_0x14fe33(0x1c7)],pathToArray(_0x2bf8a2+_0x14fe33(0x1fd)))}),_0x63c901&&_0x3631ac[_0x14fe33(0x1e2)]&&_0x580e39[_0x14fe33(0x1ea)]({'level':_0x14fe33(0x1d3),'path':_0x2bf8a2+_0x14fe33(0x1e7),'code':_0x14fe33(0x1fb),'message':'Attribute\x20\x27'+_0x3631ac['attribute']+_0x14fe33(0x1d4)+_0x14fe33(0x1c4),'location':getLocationFromPath(_0x4d6105['document'],_0x4d6105[_0x14fe33(0x1c7)],pathToArray(_0x2bf8a2+_0x14fe33(0x1e7)))});}}return _0x580e39;}
1
+ (function(_0x6fde4c,_0x2b59db){const _0x4e4447=a156_0x32e7,_0x4eec9e=_0x6fde4c();while(!![]){try{const _0x4ef7bf=-parseInt(_0x4e4447(0x1e2))/0x1*(-parseInt(_0x4e4447(0x215))/0x2)+-parseInt(_0x4e4447(0x1ce))/0x3*(parseInt(_0x4e4447(0x1f4))/0x4)+parseInt(_0x4e4447(0x212))/0x5*(parseInt(_0x4e4447(0x1db))/0x6)+-parseInt(_0x4e4447(0x1da))/0x7*(-parseInt(_0x4e4447(0x1d3))/0x8)+parseInt(_0x4e4447(0x206))/0x9*(parseInt(_0x4e4447(0x203))/0xa)+-parseInt(_0x4e4447(0x1eb))/0xb*(parseInt(_0x4e4447(0x202))/0xc)+-parseInt(_0x4e4447(0x1de))/0xd;if(_0x4ef7bf===_0x2b59db)break;else _0x4eec9e['push'](_0x4eec9e['shift']());}catch(_0xb7d603){_0x4eec9e['push'](_0x4eec9e['shift']());}}}(a156_0x1235,0x248bd));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x7eae28,_0x54ea18={},_0x11a36e={}){const _0x520080=a156_0x32e7;if(_0x11a36e[_0x520080(0x208)])return runSemanticChecks(_0x7eae28,_0x54ea18);const _0x3ca08c=SegmentDefSchema[_0x520080(0x1e1)](_0x7eae28);if(_0x3ca08c[_0x520080(0x1ca)])return runSemanticChecks(_0x3ca08c[_0x520080(0x1cd)],_0x54ea18);return zodErrorsToValidationResult(_0x3ca08c['error'],_0x54ea18);}export function validateRuleDef(_0x483b00,_0x4c5e03,_0x5788fc){const _0x545720=a156_0x32e7;if(!_0x483b00)return[];const _0x124565=RuleDefSchema[_0x545720(0x1e1)](_0x483b00);if(_0x124565[_0x545720(0x1ca)])return checkRule(_0x124565[_0x545720(0x1cd)],_0x4c5e03,_0x5788fc);const _0x28f90e=flattenZodIssues(_0x124565[_0x545720(0x1f7)][_0x545720(0x1fa)]);return _0x28f90e[_0x545720(0x1f2)](_0x10f094=>{const _0x554c11=_0x545720,_0x5e4066=formatZodPath(_0x10f094[_0x554c11(0x1d5)]),_0x22d0f2=_0x5e4066?_0x4c5e03+'.'+_0x5e4066:_0x4c5e03,_0x1e3551=mapZodIssueToCode(_0x10f094,_0x5e4066),_0x3e1ce0=getLocationFromPath(_0x5788fc[_0x554c11(0x20c)],_0x5788fc[_0x554c11(0x1fb)],pathToArray(_0x22d0f2));return{'level':_0x554c11(0x1f7),'path':_0x22d0f2,'code':_0x1e3551,'message':_0x10f094['message'],..._0x3e1ce0&&{'location':_0x3e1ce0}};});}function zodErrorsToValidationResult(_0x4e7b45,_0x1b1022){const _0x454241=a156_0x32e7,_0x2c0792=flattenZodIssues(_0x4e7b45[_0x454241(0x1fa)]),_0xdc15d7=_0x2c0792['map'](_0x1e85b5=>{const _0x2ec3d2=_0x454241,_0x518216=formatZodPath(_0x1e85b5[_0x2ec3d2(0x1d5)]),_0x5b8b8f=mapZodIssueToCode(_0x1e85b5,_0x518216),_0x14e3ef=getLocationFromPath(_0x1b1022['document'],_0x1b1022[_0x2ec3d2(0x1fb)],_0x1e85b5['path']['map'](_0x235efb=>typeof _0x235efb===_0x2ec3d2(0x1d9)?String(_0x235efb):_0x235efb));return{'level':_0x2ec3d2(0x1f7),'path':_0x518216,'code':_0x5b8b8f,'message':_0x1e85b5['message'],..._0x14e3ef&&{'location':_0x14e3ef}};});return{'valid':![],'errors':_0xdc15d7,'warnings':[]};}function a156_0x32e7(_0xf7d75c,_0x6f3ce9){_0xf7d75c=_0xf7d75c-0x1c8;const _0x12351b=a156_0x1235();let _0x32e7a9=_0x12351b[_0xf7d75c];return _0x32e7a9;}function mapZodIssueToCode(_0x4c8180,_0x3da4af){const _0x5da28b=a156_0x32e7,_0x496b91=_0x4c8180[_0x5da28b(0x1d6)]===_0x5da28b(0x218)?_0x4c8180[_0x5da28b(0x1f9)]:undefined;if(_0x3da4af===_0x5da28b(0x217))return _0x5da28b(0x1e6);if(_0x3da4af==='rule.type'||_0x3da4af[_0x5da28b(0x1d7)](_0x5da28b(0x1e3))){if(_0x4c8180[_0x5da28b(0x1d6)]===_0x5da28b(0x1ed)){if(_0x3da4af==='rule.type'||_0x3da4af[_0x5da28b(0x210)](/\.conditions\[\d+\]\.type$/))return _0x5da28b(0x1e9);}}if(_0x3da4af[_0x5da28b(0x1d7)](_0x5da28b(0x20e)))return _0x5da28b(0x1e4);if(_0x3da4af[_0x5da28b(0x1d7)](_0x5da28b(0x20b)))return _0x5da28b(0x1ee);if(_0x496b91?.[_0x5da28b(0x1fe)]===_0x5da28b(0x211))return'MISSING_BETWEEN_BOUNDS';if(_0x496b91?.['validationCode']===_0x5da28b(0x1e0))return _0x5da28b(0x1e0);if(_0x3da4af[_0x5da28b(0x1d7)]('.conditions')||_0x3da4af===_0x5da28b(0x1f5))return _0x5da28b(0x1ea);if(_0x3da4af[_0x5da28b(0x216)](_0x5da28b(0x204)))return _0x5da28b(0x205);if(_0x3da4af[_0x5da28b(0x1d7)](_0x5da28b(0x1cb)))return _0x5da28b(0x1f3);return _0x5da28b(0x20d);}function runSemanticChecks(_0x5f582b,_0x17f4db){const _0x14b134=a156_0x32e7,_0x4cd9cb=[];_0x5f582b['rule']&&_0x4cd9cb[_0x14b134(0x1c8)](...checkRule(_0x5f582b['rule'],_0x14b134(0x1fd),_0x17f4db));const _0x44af59=_0x4cd9cb[_0x14b134(0x1f1)](_0x26aec6=>_0x26aec6[_0x14b134(0x201)]===_0x14b134(0x1f7)),_0x1e82c7=_0x4cd9cb[_0x14b134(0x1f1)](_0x43ed27=>_0x43ed27[_0x14b134(0x201)]==='warning');return{'valid':_0x44af59[_0x14b134(0x1dc)]===0x0,'errors':_0x44af59,'warnings':_0x1e82c7};}function checkRule(_0x3d30d0,_0xa03aa0,_0x112c37){const _0x14440d=a156_0x32e7,_0x590dea=[];if(_0x3d30d0[_0x14440d(0x1f5)][_0x14440d(0x1dc)]===0x0)return _0x590dea[_0x14440d(0x1c8)]({'level':_0x14440d(0x1f7),'path':_0xa03aa0+_0x14440d(0x1e5),'code':_0x14440d(0x1d4),'message':'Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','location':getLocationFromPath(_0x112c37[_0x14440d(0x20c)],_0x112c37[_0x14440d(0x1fb)],pathToArray(_0xa03aa0+_0x14440d(0x1e5)))}),_0x590dea;return _0x590dea[_0x14440d(0x1c8)](...checkConditions(_0x3d30d0[_0x14440d(0x1f5)],_0xa03aa0,_0x112c37)),_0x590dea;}function checkConditions(_0x19d8e8,_0x458bda,_0x36783c){const _0x4c099a=a156_0x32e7,_0x210659=[];for(let _0x13232e=0x0;_0x13232e<_0x19d8e8['length'];_0x13232e++){const _0x39c069=_0x19d8e8[_0x13232e],_0x327a9a=_0x458bda+'.conditions['+_0x13232e+']';_0x210659[_0x4c099a(0x1c8)](...checkCondition(_0x39c069,_0x327a9a,_0x36783c));}return _0x210659;}function checkCondition(_0x354818,_0x13e702,_0x3bc8d8){const _0xa0ad34=a156_0x32e7,_0x4d93f4=[];if(_0x354818[_0xa0ad34(0x1d8)]===_0xa0ad34(0x200)||_0x354818[_0xa0ad34(0x1d8)]==='Or'){if(_0x354818[_0xa0ad34(0x1f5)][_0xa0ad34(0x1dc)]===0x0)_0x4d93f4[_0xa0ad34(0x1c8)]({'level':_0xa0ad34(0x1f7),'path':_0x13e702+_0xa0ad34(0x1e5),'code':'EMPTY_CONDITIONS','message':_0x354818['type']+_0xa0ad34(0x1ec),'location':getLocationFromPath(_0x3bc8d8[_0xa0ad34(0x20c)],_0x3bc8d8[_0xa0ad34(0x1fb)],pathToArray(_0x13e702+_0xa0ad34(0x1e5)))});else{const _0x1ff62c=_0x354818[_0xa0ad34(0x1cc)]!==undefined;!_0x1ff62c&&_0x4d93f4[_0xa0ad34(0x1c8)]({'level':_0xa0ad34(0x1e8),'path':_0x13e702,'code':_0xa0ad34(0x1e7),'message':_0x354818[_0xa0ad34(0x1d8)]+_0xa0ad34(0x214)+_0xa0ad34(0x1f8)+_0xa0ad34(0x1ff),'location':getLocationFromPath(_0x3bc8d8[_0xa0ad34(0x20c)],_0x3bc8d8[_0xa0ad34(0x1fb)],pathToArray(_0x13e702))}),_0x4d93f4[_0xa0ad34(0x1c8)](...checkConditions(_0x354818['conditions'],_0x13e702,_0x3bc8d8));}return _0x4d93f4;}if(_0x354818[_0xa0ad34(0x1d8)]===_0xa0ad34(0x209)||_0x354818[_0xa0ad34(0x1d8)]===_0xa0ad34(0x213)){const _0x3388fe=_0x354818,_0x1f5335=_0x3388fe[_0xa0ad34(0x1fb)],_0xbbb84a=_0x3388fe['aggregation'],_0x523583=_0x1f5335||_0xbbb84a;(!_0x3388fe[_0xa0ad34(0x1df)]||_0x3388fe['attribute']==='')&&(!_0x523583&&_0x4d93f4[_0xa0ad34(0x1c8)]({'level':_0xa0ad34(0x1f7),'path':_0x13e702+_0xa0ad34(0x1d1),'code':_0xa0ad34(0x219),'message':_0xa0ad34(0x1cf),'location':getLocationFromPath(_0x3bc8d8[_0xa0ad34(0x20c)],_0x3bc8d8[_0xa0ad34(0x1fb)],pathToArray(_0x13e702+'.attribute'))}));_0x3388fe[_0xa0ad34(0x1f1)]&&_0x4d93f4[_0xa0ad34(0x1c8)](...checkRule(_0x3388fe['filter'],_0x13e702+_0xa0ad34(0x1c9),_0x3bc8d8));if(_0x3388fe[_0xa0ad34(0x1fb)]){const _0x4c9272=_0x3388fe[_0xa0ad34(0x1df)]&&_0x3388fe[_0xa0ad34(0x1df)]!=='';_0x4c9272&&!_0x3388fe[_0xa0ad34(0x1f1)]&&_0x4d93f4[_0xa0ad34(0x1c8)]({'level':_0xa0ad34(0x1f7),'path':_0x13e702+_0xa0ad34(0x1f0),'code':_0xa0ad34(0x20f),'message':_0xa0ad34(0x1d2)+_0x3388fe[_0xa0ad34(0x1fb)]+_0xa0ad34(0x207)+_0x3388fe[_0xa0ad34(0x1df)]+'\x27\x20'+'requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20'+_0xa0ad34(0x1f6)+_0xa0ad34(0x1fc),'location':getLocationFromPath(_0x3bc8d8[_0xa0ad34(0x20c)],_0x3bc8d8[_0xa0ad34(0x1fb)],pathToArray(_0x13e702+_0xa0ad34(0x1f0)))}),_0x4c9272&&_0x3388fe['filter']&&_0x4d93f4['push']({'level':_0xa0ad34(0x1e8),'path':_0x13e702+_0xa0ad34(0x1d1),'code':_0xa0ad34(0x1d0),'message':_0xa0ad34(0x20a)+_0x3388fe[_0xa0ad34(0x1df)]+_0xa0ad34(0x1dd)+_0xa0ad34(0x1ef),'location':getLocationFromPath(_0x3bc8d8[_0xa0ad34(0x20c)],_0x3bc8d8[_0xa0ad34(0x1fb)],pathToArray(_0x13e702+'.attribute'))});}}return _0x4d93f4;}function a156_0x1235(){const _0x467b20=['description','data','756WRVzFA','Attribute\x20name\x20cannot\x20be\x20empty','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','.attribute','Behavior\x20source\x20\x27','16iSjZUi','EMPTY_CONDITIONS','path','code','endsWith','type','symbol','52087bnyRzj','1459266ZdoSHA','length','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','94510AwoRVf','attribute','MISSING_TIME_UNIT','safeParse','66198opwVby','.type','INVALID_OPERATOR_TYPE','.conditions','MISSING_NAME','NESTED_CONDITION_GROUP','warning','INVALID_RULE_TYPE','MISSING_CONDITIONS','517RSQyep','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','invalid_value','MISSING_OPERATOR_VALUE','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','.source','filter','map','MISSING_SEGMENT_REFERENCE','1708ImRGyi','conditions','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','error','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','params','issues','source','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','rule','validationCode','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','And','level','65196hQLsEM','143810RSBIow','arrayMatching','INVALID_ARRAY_MATCHING','81OQWdgm','\x27\x20with\x20attribute\x20\x27','skipSchema','Value','Attribute\x20\x27','.operator.value','document','SEGMENT_SCHEMA_ERROR','.operator.type','BEHAVIOR_SOURCE_MISSING_FILTER','match','MISSING_BETWEEN_BOUNDS','5EfYvRx','Behavior','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','4jYFrtG','includes','name','custom','EMPTY_ATTRIBUTE','push','.filter','success','.segment'];a156_0x1235=function(){return _0x467b20;};return a156_0x1235();}