@treasuredata/tdx 2026.4.18 → 2026.4.20

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 (268) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/cas-command.js +1 -1
  13. package/dist/commands/cas-segment-command.js +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.js +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/connection-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-command.d.ts +38 -0
  27. package/dist/commands/engage-command.d.ts.map +1 -1
  28. package/dist/commands/engage-command.js +1 -1
  29. package/dist/commands/engage-command.js.map +1 -1
  30. package/dist/commands/engage-template-pull-command.js +1 -1
  31. package/dist/commands/engage-template-push-command.js +1 -1
  32. package/dist/commands/engage-template-validate-command.js +1 -1
  33. package/dist/commands/job-command.js +1 -1
  34. package/dist/commands/journey-command.d.ts +1 -0
  35. package/dist/commands/journey-command.d.ts.map +1 -1
  36. package/dist/commands/journey-command.js +1 -1
  37. package/dist/commands/journey-command.js.map +1 -1
  38. package/dist/commands/journey-validate-command.js +1 -1
  39. package/dist/commands/llm-command.js +1 -1
  40. package/dist/commands/mcp-command.js +1 -1
  41. package/dist/commands/parent-segment-command.js +1 -1
  42. package/dist/commands/policy-command.js +1 -1
  43. package/dist/commands/profile-command.js +1 -1
  44. package/dist/commands/profiles-command.js +1 -1
  45. package/dist/commands/query-command.js +1 -1
  46. package/dist/commands/schedule-command.js +1 -1
  47. package/dist/commands/segment-command.js +1 -1
  48. package/dist/commands/segment-create-command.js +1 -1
  49. package/dist/commands/segment-fields-command.js +1 -1
  50. package/dist/commands/segment-pull-command.js +1 -1
  51. package/dist/commands/segment-push-command.js +1 -1
  52. package/dist/commands/segment-update-command.js +1 -1
  53. package/dist/commands/segment-use-command.js +1 -1
  54. package/dist/commands/segment-validate-command.js +1 -1
  55. package/dist/commands/segments.js +1 -1
  56. package/dist/commands/show.js +1 -1
  57. package/dist/commands/status-command.js +1 -1
  58. package/dist/commands/tables.js +1 -1
  59. package/dist/commands/unset-command.js +1 -1
  60. package/dist/commands/upgrade-command.js +1 -1
  61. package/dist/commands/use-command.js +1 -1
  62. package/dist/commands/user-command.js +1 -1
  63. package/dist/commands/work-command.js +1 -1
  64. package/dist/commands/workflow-command.d.ts +1 -0
  65. package/dist/commands/workflow-command.d.ts.map +1 -1
  66. package/dist/commands/workflow-command.js +1 -1
  67. package/dist/commands/workflow-command.js.map +1 -1
  68. package/dist/core/auth.js +1 -1
  69. package/dist/core/command-output.js +1 -1
  70. package/dist/core/config.js +1 -1
  71. package/dist/core/connection-cache.js +1 -1
  72. package/dist/core/constants.js +1 -1
  73. package/dist/core/credential-cache.js +1 -1
  74. package/dist/core/global-context.js +1 -1
  75. package/dist/core/keychain.js +1 -1
  76. package/dist/core/oauth-keychain.js +1 -1
  77. package/dist/core/oauth.js +1 -1
  78. package/dist/core/profile.js +1 -1
  79. package/dist/core/project-config.js +1 -1
  80. package/dist/core/session.js +1 -1
  81. package/dist/core/user-cache.js +1 -1
  82. package/dist/core/version.js +1 -1
  83. package/dist/index.js +1 -1
  84. package/dist/mcp/server.js +1 -1
  85. package/dist/mcp/tools/index.js +1 -1
  86. package/dist/mcp/tools/tdx-run.js +1 -1
  87. package/dist/mcp/tools/tdx-search.js +1 -1
  88. package/dist/mcp/tools/work-create-item.js +1 -1
  89. package/dist/mcp/utils.js +1 -1
  90. package/dist/proxy/claude-usage-tracker.js +1 -1
  91. package/dist/proxy/passthrough-server.js +1 -1
  92. package/dist/proxy/sse-usage-parser.js +1 -1
  93. package/dist/sdk/agent/agent-config.js +1 -1
  94. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  95. package/dist/sdk/agent/agent-yaml.js +1 -1
  96. package/dist/sdk/agent/test/evaluator.js +1 -1
  97. package/dist/sdk/agent/test/executor.js +1 -1
  98. package/dist/sdk/agent/test/index.js +1 -1
  99. package/dist/sdk/agent/test/output.js +1 -1
  100. package/dist/sdk/agent/test/parser.js +1 -1
  101. package/dist/sdk/agent/tool-target-registry.js +1 -1
  102. package/dist/sdk/api.js +1 -1
  103. package/dist/sdk/cas/cas-api-client.js +1 -1
  104. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  105. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  106. package/dist/sdk/cas/index.js +1 -1
  107. package/dist/sdk/cas/pull-workflow.js +1 -1
  108. package/dist/sdk/cas/push-workflow.js +1 -1
  109. package/dist/sdk/client/cdp-api-client.js +1 -1
  110. package/dist/sdk/client/delivery-api-client.js +1 -1
  111. package/dist/sdk/client/endpoints.js +1 -1
  112. package/dist/sdk/client/engage-api-client.d.ts +26 -1
  113. package/dist/sdk/client/engage-api-client.d.ts.map +1 -1
  114. package/dist/sdk/client/engage-api-client.js +1 -1
  115. package/dist/sdk/client/engage-api-client.js.map +1 -1
  116. package/dist/sdk/client/http-client.d.ts +1 -1
  117. package/dist/sdk/client/http-client.d.ts.map +1 -1
  118. package/dist/sdk/client/http-client.js +1 -1
  119. package/dist/sdk/client/http-client.js.map +1 -1
  120. package/dist/sdk/client/llm-api-client.js +1 -1
  121. package/dist/sdk/client/oauth-refresh.js +1 -1
  122. package/dist/sdk/client/rate-limiter.js +1 -1
  123. package/dist/sdk/client/td-api-client.js +1 -1
  124. package/dist/sdk/client/trino-api-client.js +1 -1
  125. package/dist/sdk/client/workflow-client.d.ts +7 -0
  126. package/dist/sdk/client/workflow-client.d.ts.map +1 -1
  127. package/dist/sdk/client/workflow-client.js +1 -1
  128. package/dist/sdk/client/workflow-client.js.map +1 -1
  129. package/dist/sdk/connection-validator.js +1 -1
  130. package/dist/sdk/connection.js +1 -1
  131. package/dist/sdk/delivery.js +1 -1
  132. package/dist/sdk/engage/campaign-pull.js +1 -1
  133. package/dist/sdk/engage/campaign-push.js +1 -1
  134. package/dist/sdk/engage/campaign-validator.js +1 -1
  135. package/dist/sdk/engage/campaign-validator.js.map +1 -1
  136. package/dist/sdk/engage/campaign-yaml.d.ts +1 -1
  137. package/dist/sdk/engage/campaign-yaml.d.ts.map +1 -1
  138. package/dist/sdk/engage/campaign-yaml.js +1 -1
  139. package/dist/sdk/engage/campaign-yaml.js.map +1 -1
  140. package/dist/sdk/engage/template-pull.js +1 -1
  141. package/dist/sdk/engage/template-push.js +1 -1
  142. package/dist/sdk/engage/template-validator.js +1 -1
  143. package/dist/sdk/engage/template-yaml.js +1 -1
  144. package/dist/sdk/engage/types/campaign-def.d.ts +2 -2
  145. package/dist/sdk/engage/types/campaign-def.d.ts.map +1 -1
  146. package/dist/sdk/engage/types/campaign-def.js +1 -1
  147. package/dist/sdk/engage/types/campaign-def.js.map +1 -1
  148. package/dist/sdk/engage/types/campaign-schema.d.ts +256 -8
  149. package/dist/sdk/engage/types/campaign-schema.d.ts.map +1 -1
  150. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  151. package/dist/sdk/engage/types/campaign-schema.js.map +1 -1
  152. package/dist/sdk/engage/types/template-schema.js +1 -1
  153. package/dist/sdk/engage.d.ts +28 -1
  154. package/dist/sdk/engage.d.ts.map +1 -1
  155. package/dist/sdk/engage.js +1 -1
  156. package/dist/sdk/engage.js.map +1 -1
  157. package/dist/sdk/errors.js +1 -1
  158. package/dist/sdk/index.d.ts +1 -1
  159. package/dist/sdk/index.d.ts.map +1 -1
  160. package/dist/sdk/index.js +1 -1
  161. package/dist/sdk/index.js.map +1 -1
  162. package/dist/sdk/io/index.js +1 -1
  163. package/dist/sdk/io/node-filesystem.js +1 -1
  164. package/dist/sdk/job.js +1 -1
  165. package/dist/sdk/journey.js +1 -1
  166. package/dist/sdk/llm/chat-cache.js +1 -1
  167. package/dist/sdk/llm/index.js +1 -1
  168. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  169. package/dist/sdk/llm/model-factors.js +1 -1
  170. package/dist/sdk/personalization.js +1 -1
  171. package/dist/sdk/policy.js +1 -1
  172. package/dist/sdk/query/index.js +1 -1
  173. package/dist/sdk/query/sql-parser.js +1 -1
  174. package/dist/sdk/realtime.js +1 -1
  175. package/dist/sdk/schedule.js +1 -1
  176. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  177. package/dist/sdk/segment/fields-display.js +1 -1
  178. package/dist/sdk/segment/file-discovery.js +1 -1
  179. package/dist/sdk/segment/journey-utils.js +1 -1
  180. package/dist/sdk/segment/journey-validator.js +1 -1
  181. package/dist/sdk/segment/journey-yaml.js +1 -1
  182. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  183. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  184. package/dist/sdk/segment/pull-workflow.js +1 -1
  185. package/dist/sdk/segment/push-recovery.js +1 -1
  186. package/dist/sdk/segment/push-workflow.js +1 -1
  187. package/dist/sdk/segment/resolution-context.js +1 -1
  188. package/dist/sdk/segment/segment-path-parser.js +1 -1
  189. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  190. package/dist/sdk/segment/segment-validator.js +1 -1
  191. package/dist/sdk/segment/target-resolution.js +1 -1
  192. package/dist/sdk/segment/tdx-config.js +1 -1
  193. package/dist/sdk/segment/types/activation-schema.js +1 -1
  194. package/dist/sdk/segment/types/journey-def.js +1 -1
  195. package/dist/sdk/segment/types/journey-schema.js +1 -1
  196. package/dist/sdk/segment/types/segment-def.js +1 -1
  197. package/dist/sdk/segment/types/segment-schema.js +1 -1
  198. package/dist/sdk/segment/validate-files.js +1 -1
  199. package/dist/sdk/segment/yaml-validator.js +1 -1
  200. package/dist/sdk/segment.js +1 -1
  201. package/dist/sdk/types/engage.d.ts +125 -1
  202. package/dist/sdk/types/engage.d.ts.map +1 -1
  203. package/dist/sdk/types/index.d.ts +1 -1
  204. package/dist/sdk/types/index.d.ts.map +1 -1
  205. package/dist/sdk/types/index.js +1 -1
  206. package/dist/sdk/types/index.js.map +1 -1
  207. package/dist/sdk/types/progress.js +1 -1
  208. package/dist/sdk/types/workspace.js +1 -1
  209. package/dist/sdk/user.js +1 -1
  210. package/dist/sdk/util/format-detector.js +1 -1
  211. package/dist/sdk/util/formatters.js +1 -1
  212. package/dist/sdk/util/index.js +1 -1
  213. package/dist/sdk/util/paginate.js +1 -1
  214. package/dist/sdk/util/tree-formatter.js +1 -1
  215. package/dist/sdk/workflow/archive-validation.js +1 -1
  216. package/dist/sdk/workflow/clone-workflow.js +1 -1
  217. package/dist/sdk/workflow/index.d.ts +14 -1
  218. package/dist/sdk/workflow/index.d.ts.map +1 -1
  219. package/dist/sdk/workflow/index.js +1 -1
  220. package/dist/sdk/workflow/index.js.map +1 -1
  221. package/dist/sdk/workflow/pull-workflow.js +1 -1
  222. package/dist/sdk/workflow/push-workflow.js +1 -1
  223. package/dist/sdk/workflow/task-graph.d.ts +65 -0
  224. package/dist/sdk/workflow/task-graph.d.ts.map +1 -0
  225. package/dist/sdk/workflow/task-graph.js +1 -0
  226. package/dist/sdk/workflow/task-graph.js.map +1 -0
  227. package/dist/sdk/workflow/tdx-config.js +1 -1
  228. package/dist/sdk/workflow/workflow-utils.js +1 -1
  229. package/dist/sdk/workspace/access-tracker.js +1 -1
  230. package/dist/sdk/workspace/frontmatter.js +1 -1
  231. package/dist/sdk/workspace/git.js +1 -1
  232. package/dist/sdk/workspace/index.js +1 -1
  233. package/dist/sdk/workspace/templates.js +1 -1
  234. package/dist/sdk/workspace/weekly.js +1 -1
  235. package/dist/sdk/workspace/wikilinks.js +1 -1
  236. package/dist/test-utils/command-runner.js +1 -1
  237. package/dist/test-utils/factories.js +1 -1
  238. package/dist/test-utils/fixtures.js +1 -1
  239. package/dist/test-utils/http-mock.js +1 -1
  240. package/dist/test-utils/index.js +1 -1
  241. package/dist/utils/async.js +1 -1
  242. package/dist/utils/colors.js +1 -1
  243. package/dist/utils/diff.js +1 -1
  244. package/dist/utils/file-permissions.js +1 -1
  245. package/dist/utils/file-reader.js +1 -1
  246. package/dist/utils/github-releases.js +1 -1
  247. package/dist/utils/global-cache.js +1 -1
  248. package/dist/utils/json-loader.js +1 -1
  249. package/dist/utils/local-cache.js +1 -1
  250. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  251. package/dist/utils/logger/formatters/index.js +1 -1
  252. package/dist/utils/logger/handlers/console-handler.js +1 -1
  253. package/dist/utils/logger/handlers/file-handler.js +1 -1
  254. package/dist/utils/logger/handlers/index.js +1 -1
  255. package/dist/utils/logger/handlers/null-handler.js +1 -1
  256. package/dist/utils/logger/index.js +1 -1
  257. package/dist/utils/logger/logger.js +1 -1
  258. package/dist/utils/logger/types.js +1 -1
  259. package/dist/utils/option-validation.js +1 -1
  260. package/dist/utils/process.js +1 -1
  261. package/dist/utils/prompt.js +1 -1
  262. package/dist/utils/spinner.js +1 -1
  263. package/dist/utils/sse-parser.js +1 -1
  264. package/dist/utils/string-utils.js +1 -1
  265. package/dist/utils/table-ref-parser.js +1 -1
  266. package/dist/utils/tdx-logger.js +1 -1
  267. package/dist/utils/version-check.js +1 -1
  268. package/package.json +1 -1
@@ -1 +1 @@
1
- const a152_0x54ab40=a152_0x1cc0;(function(_0x5949d1,_0xbc39ab){const _0x7d7fa1=a152_0x1cc0,_0x85e037=_0x5949d1();while(!![]){try{const _0x5aeb3f=-parseInt(_0x7d7fa1(0xa8))/0x1*(parseInt(_0x7d7fa1(0xec))/0x2)+-parseInt(_0x7d7fa1(0x115))/0x3+parseInt(_0x7d7fa1(0x13f))/0x4*(-parseInt(_0x7d7fa1(0xa6))/0x5)+-parseInt(_0x7d7fa1(0xcc))/0x6+parseInt(_0x7d7fa1(0x119))/0x7*(parseInt(_0x7d7fa1(0x159))/0x8)+parseInt(_0x7d7fa1(0xce))/0x9*(-parseInt(_0x7d7fa1(0xab))/0xa)+parseInt(_0x7d7fa1(0xdd))/0xb*(parseInt(_0x7d7fa1(0x15f))/0xc);if(_0x5aeb3f===_0xbc39ab)break;else _0x85e037['push'](_0x85e037['shift']());}catch(_0x12bb24){_0x85e037['push'](_0x85e037['shift']());}}}(a152_0x3461,0x1de34));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x54ab40(0x162));export const PENDING_SEGMENT_PREFIX=a152_0x54ab40(0xb3);export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0x5ebc67){return''+PENDING_SEGMENT_PREFIX+_0x5ebc67+'__';}export function isPendingSegmentId(_0x2857bb){return _0x2857bb['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x2857bb['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x3794c4){const _0x422743=a152_0x54ab40;return _0x3794c4[_0x422743(0x14f)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x4eab7c){return''+PENDING_ACTIVATION_PREFIX+_0x4eab7c+'__';}export function isPendingActivationId(_0x1cc2dd){const _0x5f0231=a152_0x54ab40;return _0x1cc2dd[_0x5f0231(0xc9)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x4ca16f){const _0x2b25fe=a152_0x54ab40;return _0x4ca16f[_0x2b25fe(0x14f)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x481add,_0x3c0db1){const _0x58eb0b=a152_0x54ab40,_0x3acc3f=_0x481add+'::'+(_0x3c0db1[_0x58eb0b(0x1a0)]()||_0x58eb0b(0x1a7)),_0x92175f=createHash(_0x58eb0b(0x180))[_0x58eb0b(0x1a9)](_0x3acc3f)[_0x58eb0b(0x163)](_0x58eb0b(0x146))[_0x58eb0b(0x18b)](0x0,0xc);return _0x58eb0b(0xd5)+_0x92175f;}export function ensureJourneyDefaults(_0x2f619c){const _0x1f7049=a152_0x54ab40;!_0x2f619c[_0x1f7049(0xac)]&&(_0x2f619c[_0x1f7049(0xac)]=''),!_0x2f619c[_0x1f7049(0xc4)]&&(_0x2f619c[_0x1f7049(0xc4)]='draft');}function a152_0x3461(){const _0x4defcf=['utf-8','startsWith','folderPath','reduce','1139310XHAGrp','get','14175nVmOtg','folderId','activation_creating','list','JOURNEY_SYNTAX_ERROR','\x20segment\x20from\x20file:\x20','createSegment','journey_entry_criteria_','updateActivation','activation_deleted','buildUserMaps','push','withProgress','index','existingSegments','44uDSbst','logDeleted','data','journeyBundlesByFolderAndName','activation_','journeyName','milestone','stage\x20\x27','ACTIVATION_UPDATE_ERROR','hasChanges','entry_criteria','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','segmentNameToId','journeys','activationContext','12790tKqSbN','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','Activation','waitStepUnit','waitStep','existingActivation','all_columns','folder','isArray','\x27\x20entry\x20criteria','\x27\x20from\x20file:\x20','stringify','getSegmentEntity\x20also\x20failed\x20for\x20','Deleted\x20activation\x20\x27','resolveSegment','INTERNAL','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','rootFolderId','deleteSegment','ACTIVATION_SYNTAX_ERROR','nameToType','getJourney','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','diff','Segment\x20not\x20found:\x20','create','folder_created','segment_creating','day','yamlActivation','Creating\x20folder\x20\x27','parentId','Updating\x20segment\x20\x27','\x27\x20not\x20found\x20in\x20journey\x20\x27','\x27\x20wait\x20condition','activation_deleting','fetchJourney','folder_creating','segments','Created\x20folder\x20\x27','user','315771dDwPof','delete','Updating\x20activation\x20\x27','conditionSegmentId','182QsYgct','journeyBundleId','name','from','\x27\x20exit\x20criteria','Condition','and\x20the\x20server\x20segment,\x20then\x20retry.','parentFolder','Creating\x20segment\x20\x27','\x27\x20milestone','getSegment\x20failed\x20for\x20','journey_updated','journeyById','behavior','./journey-yaml.js','createActivation','journey','has','split','\x20journey\x20from\x20file:\x20','segmentFolderId','getSegment','conditionTimeoutDuration','embedded_activation_creating','journeyActivationNameToId','):\x20','steps','debug','run_after_journey_refresh','../../utils/async.js','max','attributes','onProgress','toString','segment_updated','./child-segment-yaml.js','WaitStep','Name\x20has\x20already\x20been\x20taken','116164BUnfIG','validatedRequest','embedded_activation_created','getLatestJourneyId','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','entry','logWarning','hex','absolutePath','journey_creating','Created\x20journey\x20\x27','Embedded\x20segment\x20\x27','resolvedRule','created','deps','flatMap','replace','journeyId','join','with','activation_template_id','branches','columns','localName','entries','createJourneySegment','41000SsQqmW','Segment\x20not\x20found','folderPathToId','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','deleted','segmentId','1797564LRkYUQ','\x20(referenced\x20in\x20journey\x20','Entry\x20criteria:\x20','tdx.sdk.push-workflow','digest','keys','schedule','idToEmailMap','Duration','activations','map','SEGMENT_SYNTAX_ERROR','Updated\x20journey\x20\x27','segment_updating','createdSegmentIds','Created\x20segment\x20\x27','createFolder','Delete\x20the\x20push\x20recovery\x20file\x20(','segment_created','journeyBundleName','journey_updating','embeddedSegmentNameToId','filter','connector_config','\x27...','conditionTimeoutUnit','logInfo','getSegmentEntity','nameToId','\x20activation\x20\x27','createdSegmentId',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','DecisionPoint','sha1','relationships','kind','updateSegmentById','uniqueSegmentName','updated','NOT_FOUND','existingJourney','toISOString','resolveJourneyId','Failed\x20to\x20fetch\x20referenced\x20segment\x20','slice','isNew','parse','length','decision_point','entryCriteria','Failed\x20to\x20resolve\x20segment\x20',').\x20','rule','stages','activationParams','getActivation','errors','progress','yamlConfig','find','connectionIdToNameMap','exitCriterias','match','parseDocument','journeyStages','trim','size','\x27\x20by\x20rule\x20content','versionNumber','activation_created','\x0a\x20\x20','waitStepType','segment','journeyActivationStepId','update','Failed\x20to\x20','goal\x20criteria','all','existingSegment','goal','set','parentSegmentFolder','logSuccess','action','5chWvGu','listActivations','8cJrnjk','relative','SEGMENT_UPDATE_ERROR','1490fJxsXG','description','valid','sort','some','type','conditions','JOURNEY_UPDATE_ERROR','__pending_','Activation\x20not\x20found:\x20','embedded_segment_created','connection','deleteActivation','notification','toLowerCase','message','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','add','Failed\x20to\x20resolve\x20activation\x20','segment_deleting','unchanged','verbose','SEGMENT_NOT_FOUND','activation_updated','segmentByFolderAndName','state','item','Fetching\x20','idToName'];a152_0x3461=function(){return _0x4defcf;};return a152_0x3461();}function a152_0x1cc0(_0x1f53b2,_0x2165d7){_0x1f53b2=_0x1f53b2-0xa4;const _0x346112=a152_0x3461();let _0x1cc045=_0x346112[_0x1f53b2];return _0x1cc045;}export function injectExistingStageIds(_0x4d8cff,_0x44e517){const _0x59aaf0=a152_0x54ab40,_0x876ab3=new Map(_0x44e517['map'](_0x385c5d=>[_0x385c5d[_0x59aaf0(0x11b)],_0x385c5d['id']]));for(const _0x3a8ec9 of _0x4d8cff){if(!_0x3a8ec9['id']){const _0x46b583=_0x876ab3[_0x59aaf0(0xcd)](_0x3a8ec9[_0x59aaf0(0x11b)]);_0x46b583&&(_0x3a8ec9['id']=_0x46b583);}}}export function resolveTDFolderPath(_0x1b80f2,_0x271068,_0xf28e5a){const _0x5c0828=a152_0x54ab40;if(!_0x271068)return _0x1b80f2;if(_0x1b80f2===_0xf28e5a||_0x1b80f2[_0x5c0828(0xc9)](_0xf28e5a+'/'))return _0x1b80f2;return _0x1b80f2?_0xf28e5a+'/'+_0x1b80f2:_0xf28e5a;}export function addFoldersToCreate(_0x3b0a86,_0x14d17a,_0x522e53){const _0x2246ba=a152_0x54ab40;if(!_0x3b0a86)return;if(_0x14d17a[_0x2246ba(0x12a)](_0x3b0a86))return;const _0x5cd417=_0x3b0a86[_0x2246ba(0x12b)]('/');let _0x351516='';for(const _0x46eaa5 of _0x5cd417){_0x351516=_0x351516?_0x351516+'/'+_0x46eaa5:_0x46eaa5,!_0x14d17a[_0x2246ba(0x12a)](_0x351516)&&_0x522e53[_0x2246ba(0xbc)](_0x351516);}}export function sortFoldersByDepth(_0x4d898b){const _0x16b5ba=a152_0x54ab40;return[..._0x4d898b][_0x16b5ba(0xae)]((_0x2ce7b7,_0x3686bc)=>{const _0xc8e777=_0x16b5ba,_0x10738a=(_0x2ce7b7[_0xc8e777(0x19d)](/\//g)||[])[_0xc8e777(0x18e)],_0xd76997=(_0x3686bc[_0xc8e777(0x19d)](/\//g)||[])[_0xc8e777(0x18e)];return _0x10738a-_0xd76997;});}import*as a152_0x3ed7a6 from'yaml';import{readFileSync}from'fs';import a152_0x3b14f6 from'path';import{isJourneyDef,parseYamlString as a152_0x1090df,toYamlString as a152_0x168e1e,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(_0x352b7a){const _0x3cf8b9=a152_0x54ab40;if(Array[_0x3cf8b9(0xf4)](_0x352b7a))return'['+_0x352b7a[_0x3cf8b9(0x169)](_0x4e895b=>stableStringify(_0x4e895b))['join'](',')+']';if(_0x352b7a&&typeof _0x352b7a==='object'){const _0x291a4c=_0x352b7a,_0x667bb1=Object['keys'](_0x291a4c)[_0x3cf8b9(0xae)](),_0x101c72=_0x667bb1['map'](_0xcdf8bf=>'\x22'+_0xcdf8bf+'\x22:'+stableStringify(_0x291a4c[_0xcdf8bf]));return'{'+_0x101c72[_0x3cf8b9(0x151)](',')+'}';}const _0x43853a=JSON[_0x3cf8b9(0xf7)](_0x352b7a);return _0x43853a===undefined?'null':_0x43853a;}function activationSignature(_0x3a2c3f){const _0x1c7efd=a152_0x54ab40,_0x2f6b07={'connection':_0x3a2c3f[_0x1c7efd(0xb6)],..._0x3a2c3f[_0x1c7efd(0xf2)]!==undefined&&{'all_columns':_0x3a2c3f[_0x1c7efd(0xf2)]},..._0x3a2c3f[_0x1c7efd(0x155)]!==undefined&&{'columns':_0x3a2c3f['columns']},..._0x3a2c3f[_0x1c7efd(0x126)]!==undefined&&{'behavior':_0x3a2c3f['behavior']},..._0x3a2c3f[_0x1c7efd(0x165)]!==undefined&&{'schedule':_0x3a2c3f[_0x1c7efd(0x165)]},..._0x3a2c3f[_0x1c7efd(0xb8)]!==undefined&&{'notification':_0x3a2c3f['notification']},..._0x3a2c3f[_0x1c7efd(0x176)]!==undefined&&{'connector_config':_0x3a2c3f[_0x1c7efd(0x176)]},..._0x3a2c3f[_0x1c7efd(0x153)]!==undefined&&{'activation_template_id':_0x3a2c3f[_0x1c7efd(0x153)]}};return stableStringify(_0x2f6b07);}async function fetchSegment(_0x59bccd,_0x533ae3,_0x222722,_0x157979){const _0x20bde1=a152_0x54ab40,_0x3c4c9c=_0x157979?.[_0x20bde1(0x19a)](_0x48d55b=>_0x48d55b['id']===_0x222722);if(_0x3c4c9c)return _0x3c4c9c;try{return await _0x59bccd[_0x20bde1(0x1a7)][_0x20bde1(0x12e)](_0x533ae3,_0x222722);}catch(_0x3f793a){logger['debug'](_0x20bde1(0x123)+_0x222722+_0x20bde1(0x17e)+_0x3f793a);try{return await _0x59bccd[_0x20bde1(0x1a7)][_0x20bde1(0x17a)](_0x222722);}catch(_0x283e60){return logger['debug'](_0x20bde1(0xf8)+_0x222722+':\x20'+_0x283e60),null;}}}function recoverSegmentIdsFromPushRecovery(_0x48d2b9,_0x143381,_0x2f4e82){const _0x209a4a=a152_0x54ab40,_0x488110=readPushRecovery(_0x48d2b9[_0x209a4a(0x147)]);if(_0x488110?.[_0x209a4a(0xe2)]===_0x48d2b9['yamlConfig'][_0x209a4a(0x11b)])for(const [_0x94f787,_0x3229ed]of Object[_0x209a4a(0x157)](_0x488110[_0x209a4a(0x112)])){const _0x2edd86=generateDeterministicJourneySegmentName(_0x48d2b9[_0x209a4a(0x199)][_0x209a4a(0x11b)],_0x94f787);_0x3229ed['uniqueServerName']===_0x2edd86&&(_0x143381[_0x209a4a(0x1af)](_0x94f787,_0x3229ed[_0x209a4a(0x15e)]),_0x2f4e82[_0x209a4a(0x1af)](_0x94f787,_0x3229ed['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x40d254,_0x94622e,_0x157115,_0x36724a){const _0x4763f7=a152_0x54ab40;let _0x56a7b7;try{_0x56a7b7=await _0x40d254[_0x4763f7(0x1a7)][_0x4763f7(0x158)]({'name':_0x157115[_0x4763f7(0x184)],'description':_0x157115[_0x4763f7(0xac)],'journeyId':_0x157115[_0x4763f7(0x150)],'rule':_0x36724a(_0x157115[_0x4763f7(0x14b)],!![]),'countPopulation':!![],'parentFolderId':_0x157115[_0x4763f7(0xcf)],'audienceId':_0x157115[_0x4763f7(0x10b)]});}catch(_0x1fc5ed){const _0x586d4d=_0x1fc5ed instanceof Error&&_0x1fc5ed[_0x4763f7(0xba)]['includes'](_0x4763f7(0x13e));if(_0x586d4d){const _0x4f53bc=readPushRecovery(_0x94622e[_0x4763f7(0x147)]),_0x5df0ec=_0x4f53bc?.[_0x4763f7(0xe2)]===_0x94622e[_0x4763f7(0x199)][_0x4763f7(0x11b)]?_0x4f53bc['segments'][_0x157115[_0x4763f7(0x156)]]:undefined;if(_0x5df0ec?.['uniqueServerName']===_0x157115[_0x4763f7(0x184)])await _0x40d254[_0x4763f7(0x1a7)][_0x4763f7(0x183)](_0x157115['parentId'],_0x5df0ec[_0x4763f7(0x15e)],{'description':_0x157115[_0x4763f7(0xac)],'rule':_0x36724a(_0x157115[_0x4763f7(0x14b)],!![]),'countPopulation':!![]}),_0x56a7b7=_0x5df0ec[_0x4763f7(0x15e)];else throw new SDKError(ErrorCode[_0x4763f7(0xaa)],_0x4763f7(0x14a)+_0x157115['localName']+_0x4763f7(0x102)+(_0x4763f7(0x170)+_0x94622e[_0x4763f7(0x147)]['replace'](/([^/]+)$/,'.$1.push-recovery.json')+')\x20')+_0x4763f7(0x11f),_0x1fc5ed);}else throw _0x1fc5ed;}return saveSegmentToPushRecovery(_0x94622e[_0x4763f7(0x147)],_0x94622e[_0x4763f7(0x199)][_0x4763f7(0x11b)],_0x157115[_0x4763f7(0x156)],{'segmentId':_0x56a7b7,'uniqueServerName':_0x157115[_0x4763f7(0x184)],'createdAt':new Date()[_0x4763f7(0x188)]()}),_0x56a7b7;}export async function prepareSegmentFiles(_0x618c1c,_0x459c6f,_0xb5cd83,_0x131963,_0x54f95d){const _0x170f49=a152_0x54ab40,{activationDefToCreateRequest:_0x529d50}=await import(_0x170f49(0x13c)),_0x7bcf82=[],_0xd66385=new Set();for(const {yamlConfig:_0x10a8de,folderPath:_0x3a69ca,sourcePath:_0x4c505f}of _0x618c1c){const _0x462b97=resolveTDFolderPath(_0x3a69ca,_0x131963,_0x54f95d),_0x3da743=_0x462b97+':'+_0x10a8de[_0x170f49(0x11b)],_0x657e5c=_0x459c6f[_0x170f49(0xc3)][_0x170f49(0xcd)](_0x3da743),_0x52bbde=_0x657e5c?_0x459c6f['activationsBySegmentId'][_0x170f49(0xcd)](_0x657e5c['id'])||[]:[];addFoldersToCreate(_0x462b97,_0x459c6f[_0x170f49(0x15b)],_0xd66385);const _0x253ab4=calculateActivationActions(_0x10a8de[_0x170f49(0x168)]||[],_0x52bbde,_0x459c6f[_0x170f49(0x166)],_0x459c6f['connectionIdToNameMap']);for(const _0x1a7736 of _0x253ab4){(_0x1a7736[_0x170f49(0xb0)]===_0x170f49(0x105)||_0x1a7736['type']===_0x170f49(0x1a9))&&_0x1a7736[_0x170f49(0x109)]&&(_0x1a7736[_0x170f49(0x140)]=await _0x529d50(_0x1a7736['yamlActivation'],_0xb5cd83));}const _0xf8fcda=calculateSegmentDiff(_0x10a8de,_0x657e5c,_0x52bbde,_0x459c6f[_0x170f49(0x166)],_0x459c6f['connectionIdToNameMap']);_0x7bcf82[_0x170f49(0xd9)]({'relativePath':_0x10a8de['name'],'absolutePath':_0x4c505f,'yamlConfig':_0x10a8de,'folderPath':_0x462b97,'existingSegment':_0x657e5c,'existingActivations':_0x52bbde,'isNew':_0xf8fcda[_0x170f49(0x18c)],'hasChanges':_0xf8fcda['hasChanges'],'diff':_0xf8fcda['diff'],'activationActions':_0x253ab4});}return{'segmentFiles':_0x7bcf82,'foldersToCreate':_0xd66385};}export async function prepareJourneyFiles(_0x1e30c7,_0x56a15f,_0xb2c468,_0x280f51){const _0x3c0a62=a152_0x54ab40,_0x38a9f6=[],_0x17a62f=new Set();for(const {yamlConfig:_0x283e00,folderPath:_0x4ddea7,sourcePath:_0xf7ce93}of _0x1e30c7){const _0x152512=resolveTDFolderPath(_0x4ddea7,_0xb2c468,_0x280f51),_0x3095ce=_0x152512+':'+_0x283e00['name'],_0x2cbbb5=_0x56a15f[_0x3c0a62(0xe0)][_0x3c0a62(0xcd)](_0x3095ce);let _0x1f22d8,_0x51e90c;if(_0x2cbbb5&&_0x2cbbb5[_0x3c0a62(0x18e)]>0x0){const _0x234826=buildLocalExpandedRuleMappings(_0x283e00),{createYamlContext:_0x593154,prefetchJourneySegments:_0x228403}=createPushYamlContextForBundle(_0x56a15f['deps'],_0x56a15f['parentId'],_0x56a15f[_0x3c0a62(0xdc)],_0x234826,_0x56a15f[_0x3c0a62(0x166)],_0x56a15f[_0x3c0a62(0x19b)],_0x56a15f['activationStepsById'],_0x56a15f[_0x3c0a62(0x125)]);await _0x228403(_0x2cbbb5[_0x3c0a62(0x169)](_0x419588=>_0x419588['id']));const _0x4929ac=await _0x56a15f[_0x3c0a62(0x14d)]['journey'][_0x3c0a62(0x142)](_0x2cbbb5[0x0][_0x3c0a62(0x11a)]),_0x5a5c60=hasMultipleVersions(_0x283e00),_0x5c52c3=async _0x1a0044=>{const _0x13a850=_0x3c0a62,_0x419ca3=_0x56a15f[_0x13a850(0x125)]?.[_0x13a850(0xcd)](_0x1a0044);if(_0x419ca3)return _0x419ca3;return _0x56a15f[_0x13a850(0x110)]({'journeyId':_0x1a0044,'journeyName':_0x283e00['name'],'isMultiVersion':_0x2cbbb5[_0x13a850(0x18e)]>0x1});};if(_0x5a5c60&&_0x2cbbb5[_0x3c0a62(0x18e)]>0x1){const _0xb1c93f=[];for(const _0x15afbd of _0x2cbbb5){const _0x5d15a9=_0x15afbd[_0x3c0a62(0x1a3)]||0x1;_0x56a15f[_0x3c0a62(0x198)]?.['update'](_0x3c0a62(0xc6)+_0x283e00[_0x3c0a62(0x11b)]+'\x20v'+_0x5d15a9);const _0x36088a=await _0x5c52c3(_0x15afbd['id']),_0x856de9=_0x593154(_0x15afbd['id']),_0x21a455=await journeyResponseToDef(_0x36088a,_0x856de9);_0xb1c93f['push']({'item':_0x15afbd,'yaml':_0x21a455});}const _0x569c8c=buildLocalRuleToNameMappingFromJourney(_0x283e00);_0x51e90c=buildMergedJourneyDef(_0xb1c93f,_0x569c8c,_0x4929ac);const _0x546955=Math[_0x3c0a62(0x137)](..._0xb1c93f[_0x3c0a62(0x169)](_0x2ed8bc=>_0x2ed8bc[_0x3c0a62(0xc5)][_0x3c0a62(0x1a3)]||0x0)),_0x557b4d=_0x2cbbb5[_0x3c0a62(0x19a)](_0x57bd17=>(_0x57bd17[_0x3c0a62(0x1a3)]||0x0)===_0x546955);_0x557b4d&&(_0x56a15f[_0x3c0a62(0x198)]?.['update']('Fetching\x20'+_0x283e00[_0x3c0a62(0x11b)]+'\x20v'+_0x546955),_0x1f22d8=await _0x5c52c3(_0x557b4d['id']));}else{const _0x53c308=_0x2cbbb5[_0x2cbbb5[_0x3c0a62(0x18e)]-0x1];_0x56a15f[_0x3c0a62(0x198)]?.['update']('Fetching\x20'+_0x283e00[_0x3c0a62(0x11b)]),_0x1f22d8=await _0x5c52c3(_0x53c308['id']);const _0x559d57=_0x593154(_0x53c308['id']),_0x373b8f=await journeyResponseToDef(_0x1f22d8,_0x559d57),_0x1cb8a6=buildLocalRuleToNameMappingFromJourney(_0x283e00);_0x51e90c=buildMergedJourneyDef([{'item':_0x53c308,'yaml':_0x373b8f}],_0x1cb8a6,_0x4929ac);}}addFoldersToCreate(_0x152512,_0x56a15f[_0x3c0a62(0x15b)],_0x17a62f);const _0x5ca7a0=calculateJourneyDiff(_0x283e00,_0x51e90c);_0x38a9f6[_0x3c0a62(0xd9)]({'relativePath':_0x283e00[_0x3c0a62(0x11b)],'absolutePath':_0xf7ce93,'yamlConfig':_0x283e00,'folderPath':_0x152512,'existingJourney':_0x1f22d8,'isNew':_0x5ca7a0[_0x3c0a62(0x18c)],'hasChanges':_0x5ca7a0[_0x3c0a62(0xe6)],'diff':_0x5ca7a0[_0x3c0a62(0x103)]});}return{'journeyFiles':_0x38a9f6,'foldersToCreate':_0x17a62f};}export function calculateActivationActions(_0x5f3dda,_0x548b43,_0x3d6cbd,_0x428a4c){const _0x318114=a152_0x54ab40,_0x3f134c=[],_0x5b30bd=new Map();for(const _0x3d86b3 of _0x548b43){_0x5b30bd[_0x318114(0x1af)](_0x3d86b3['name'],_0x3d86b3);}const _0x385f5e=new Map();for(const _0x566590 of _0x5f3dda){_0x385f5e[_0x318114(0x1af)](_0x566590['name'],_0x566590);}for(const _0x337e0b of _0x5f3dda){const _0x26e36f=_0x5b30bd[_0x318114(0xcd)](_0x337e0b[_0x318114(0x11b)]);if(!_0x26e36f)_0x3f134c['push']({'type':_0x318114(0x105),'name':_0x337e0b[_0x318114(0x11b)],'yamlActivation':_0x337e0b});else{const _0x484fef=activationResponseToDef(_0x26e36f,_0x3d6cbd,_0x428a4c),_0x4e41a9=a152_0x3ed7a6['stringify'](_0x484fef),_0x1664c2=a152_0x3ed7a6[_0x318114(0xf7)](_0x337e0b);_0x4e41a9!==_0x1664c2&&_0x3f134c[_0x318114(0xd9)]({'type':'update','name':_0x337e0b[_0x318114(0x11b)],'yamlActivation':_0x337e0b,'existingActivation':_0x26e36f});}}for(const _0x25ee71 of _0x548b43){!_0x385f5e[_0x318114(0x12a)](_0x25ee71['name'])&&_0x3f134c[_0x318114(0xd9)]({'type':_0x318114(0x116),'name':_0x25ee71[_0x318114(0x11b)],'existingActivation':_0x25ee71});}return _0x3f134c;}function calculateYamlDiff(_0xf51e8f,_0x328db2){if(_0x328db2){const _0x265147=generateDiff(_0x328db2,_0xf51e8f),_0x2a5d3d=hasChanges(_0x265147);return{'isNew':![],'hasChanges':_0x2a5d3d,'diff':_0x2a5d3d?formatDiffWithColors(_0x265147):undefined};}const _0x47978b=generateDiff('',_0xf51e8f);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x47978b)};}export function calculateSegmentDiff(_0x45f7ed,_0x32819e,_0x1ccbe4,_0x492edb,_0x1de35e){const _0x2a99f1=segmentToYamlString(_0x45f7ed),_0x10a3cf=_0x32819e?segmentToYamlString(segmentWithActivationsToYaml(_0x32819e,_0x1ccbe4,undefined,_0x492edb,_0x1de35e)):undefined;return calculateYamlDiff(_0x2a99f1,_0x10a3cf);}export function calculateJourneyDiff(_0xe61fe6,_0x4a8f10){const _0x4a5ccc=normalizeJourneyDef(_0xe61fe6,_0xe61fe6),_0xca635e=a152_0x168e1e(_0x4a5ccc),_0x520f1b=_0x4a8f10?a152_0x168e1e(normalizeJourneyDef(_0x4a8f10,_0xe61fe6)):undefined;return calculateYamlDiff(_0xca635e,_0x520f1b);}export function findSegmentsToDelete(_0xe953a,_0xec7455,_0x21fece,_0x381519,_0x33e796){const _0x2a2329=a152_0x54ab40,_0x387dbc=new Set();for(const {yamlConfig:_0x2bfc0f,folderPath:_0x14000c}of _0xec7455){_0x387dbc[_0x2a2329(0xbc)](_0x14000c+':'+_0x2bfc0f[_0x2a2329(0x11b)]);}return _0xe953a[_0x2a2329(0x175)](_0x2b5640=>{const _0x2baec3=_0x2a2329,_0xaaa391=_0x2b5640[_0x2baec3(0x12d)]?_0x21fece['get'](_0x2b5640[_0x2baec3(0x12d)][_0x2baec3(0x13a)]())||'':'',_0x267f16=_0xaaa391+':'+_0x2b5640[_0x2baec3(0x11b)];if(_0x387dbc[_0x2baec3(0x12a)](_0x267f16))return![];if(_0x33e796)return _0xaaa391===_0x381519||_0xaaa391['startsWith'](_0x381519+'/');return!![];});}export function findJourneysToDelete(_0x18884e,_0x38a43e,_0x46556e,_0x362385,_0x2908f0){const _0x1d1315=a152_0x54ab40,_0x37f0e4=new Set();for(const {yamlConfig:_0x573086,folderPath:_0x15e906}of _0x38a43e){_0x37f0e4['add'](_0x15e906+':'+_0x573086[_0x1d1315(0x11b)]);}return _0x18884e[_0x1d1315(0x175)](_0x43a136=>{const _0x29e00b=_0x1d1315,_0x15391a=_0x43a136[_0x29e00b(0xcf)]?_0x46556e[_0x29e00b(0xcd)](_0x43a136[_0x29e00b(0xcf)])||'':'',_0x574cb3=_0x15391a+':'+_0x43a136[_0x29e00b(0x172)];if(_0x37f0e4[_0x29e00b(0x12a)](_0x574cb3))return![];if(_0x2908f0)return _0x15391a===_0x362385||_0x15391a[_0x29e00b(0xc9)](_0x362385+'/');return!![];});}export function buildSegmentLookupMap(_0x180f3c,_0x54ad37){const _0x5bfb9d=a152_0x54ab40,_0x2feaa8=new Map();for(const _0x116e88 of _0x180f3c){const _0x38ea82=_0x116e88[_0x5bfb9d(0x12d)]?_0x54ad37['get'](_0x116e88['segmentFolderId'][_0x5bfb9d(0x13a)]())||'':'',_0x1de1d2=_0x38ea82+':'+_0x116e88[_0x5bfb9d(0x11b)];_0x2feaa8[_0x5bfb9d(0x1af)](_0x1de1d2,_0x116e88);}return _0x2feaa8;}export function buildSegmentNameToIdMap(_0x55027f){const _0xfb29b3=a152_0x54ab40,_0x7b25d8=new Map();for(const _0x5714fb of _0x55027f){_0x7b25d8['set'](_0x5714fb[_0xfb29b3(0x11b)],_0x5714fb['id']);}return _0x7b25d8;}export function buildJourneyBundleLookupMap(_0x1caefb,_0x1d4b82){const _0x1b1da9=a152_0x54ab40,_0x2223e0=new Map();for(const _0x43e932 of _0x1caefb){const _0xf900ba=_0x43e932[_0x1b1da9(0xcf)]?_0x1d4b82[_0x1b1da9(0xcd)](_0x43e932[_0x1b1da9(0xcf)])||'':'',_0x269ff1=_0xf900ba+':'+_0x43e932['journeyBundleName'];!_0x2223e0['has'](_0x269ff1)&&_0x2223e0[_0x1b1da9(0x1af)](_0x269ff1,[]),_0x2223e0['get'](_0x269ff1)[_0x1b1da9(0xd9)](_0x43e932);}for(const _0x4d2303 of _0x2223e0['values']()){_0x4d2303[_0x1b1da9(0xae)]((_0x2dbae7,_0x185f36)=>(_0x2dbae7['versionNumber']||0x0)-(_0x185f36[_0x1b1da9(0x1a3)]||0x0));}return _0x2223e0;}export function collectFoldersToCreate(_0x3a5931,_0xaf9763){const _0x15764e=a152_0x54ab40,_0x43943e=new Set();for(const _0x53149f of _0x3a5931){if(!_0x53149f)continue;if(_0xaf9763['has'](_0x53149f))continue;const _0x57c2b3=_0x53149f[_0x15764e(0x12b)]('/');let _0x901fd4='';for(const _0x250e0e of _0x57c2b3){_0x901fd4=_0x901fd4?_0x901fd4+'/'+_0x250e0e:_0x250e0e,!_0xaf9763[_0x15764e(0x12a)](_0x901fd4)&&_0x43943e[_0x15764e(0xbc)](_0x901fd4);}}return _0x43943e;}export function parseAndClassifyYamlFiles(_0x2b9d0b,_0x47867f,_0x3c11aa){const _0x3c7dbd=a152_0x54ab40,_0x55fdda=[],_0x6ca300=[];for(const _0x47de5a of _0x2b9d0b){const _0xaad12d=a152_0x3b14f6[_0x3c7dbd(0xa9)](_0x47867f,a152_0x3b14f6['dirname'](_0x47de5a)),_0x493225=_0xaad12d==='.'?'':_0xaad12d[_0x3c7dbd(0x14f)](/\\/g,'/'),_0x59ab27=readFileSync(_0x47de5a,_0x3c7dbd(0xc8)),_0xc2c47a=a152_0x3ed7a6[_0x3c7dbd(0x18d)](_0x59ab27);if(isJourneyDef(_0xc2c47a)){const _0x50dcb9=a152_0x1090df(_0x59ab27);_0x6ca300[_0x3c7dbd(0xd9)]({'yamlConfig':_0x50dcb9,'folderPath':_0x493225,'sourcePath':_0x47de5a});}else{if(!_0x3c11aa?.['skipSegments']){const _0x24707f=parseSegmentYamlFile(_0x59ab27),_0x4c6d9e=normalizeChildSegmentYaml(_0x24707f);_0x55fdda[_0x3c7dbd(0xd9)]({'yamlConfig':_0x4c6d9e,'folderPath':_0x493225,'sourcePath':_0x47de5a});}}}return{'segments':_0x55fdda,'journeys':_0x6ca300};}export function validateParsedFiles(_0xfa1dd2,_0x55d17e){const _0x57d3ed=a152_0x54ab40,_0x1962a2=[];for(const {yamlConfig:_0x417638,sourcePath:_0x4b0935}of _0xfa1dd2[_0x57d3ed(0x112)]){const _0x1b9735=readFileSync(_0x4b0935,_0x57d3ed(0xc8)),_0x53c424=a152_0x3ed7a6[_0x57d3ed(0x19e)](_0x1b9735),_0x4c0454=validateSegmentDef(_0x417638,{'source':_0x1b9735,'document':_0x53c424},{'skipSchema':!![]});if(!_0x4c0454[_0x57d3ed(0xad)]){const _0x43aedd=a152_0x3b14f6[_0x57d3ed(0xa9)](_0x55d17e,_0x4b0935);_0x1962a2[_0x57d3ed(0xd9)]({'filePath':_0x43aedd,'source':_0x1b9735,'result':_0x4c0454,'isJourney':![]});}}for(const {yamlConfig:_0x13c199,sourcePath:_0x2435a5}of _0xfa1dd2[_0x57d3ed(0xea)]){const _0x2e39ae=readFileSync(_0x2435a5,'utf-8'),_0x223077=a152_0x3ed7a6[_0x57d3ed(0x19e)](_0x2e39ae),_0x2a0b56=validateJourneyDef(_0x13c199,{'source':_0x2e39ae,'document':_0x223077},{'skipSchema':!![]});if(!_0x2a0b56[_0x57d3ed(0xad)]){const _0x25a8e9=a152_0x3b14f6[_0x57d3ed(0xa9)](_0x55d17e,_0x2435a5);_0x1962a2[_0x57d3ed(0xd9)]({'filePath':_0x25a8e9,'source':_0x2e39ae,'result':_0x2a0b56,'isJourney':!![]});}}return _0x1962a2;}export function formatValidationErrors(_0x2e0a41){const _0x4f7127=a152_0x54ab40,_0x344dd3=[];for(const {filePath:_0x10916f,source:_0x1fc6f5,result:_0x2ba2a4,isJourney:_0x527fef}of _0x2e0a41){const _0x1a973b=_0x527fef?_0x4f7127(0x129):_0x4f7127(0x1a7);_0x344dd3[_0x4f7127(0xd9)]('\x0a'+_0x10916f+'\x20('+_0x1a973b+_0x4f7127(0x132)+_0x2ba2a4[_0x4f7127(0x197)]['length']+'\x20error(s)'),_0x344dd3[_0x4f7127(0xd9)](formatValidationResult(_0x2ba2a4,_0x1fc6f5,_0x10916f));}return _0x344dd3[_0x4f7127(0x151)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x594c7d){const _0xa7afde=a152_0x54ab40,_0x1076bb=new Set(),_0x3b1882=new Map(),_0x552a35=collectSegmentUsageCounts(_0x594c7d);if(_0x594c7d[_0xa7afde(0x112)])for(const [_0x11edaa,_0x565c04]of Object[_0xa7afde(0x157)](_0x594c7d[_0xa7afde(0x112)])){_0x1076bb[_0xa7afde(0xbc)](_0x11edaa);if(_0x565c04[_0xa7afde(0x193)]){const _0x590c0a=yamlRuleToApi(_0x565c04['rule']),_0x22acc4=apiRuleToYaml(_0x590c0a);_0x3b1882[_0xa7afde(0x1af)](_0x11edaa,_0x22acc4);}}const _0x53473e=new Map();let _0x13cf6d=0x0;for(const [_0x5afbf0,_0x5631ac]of _0x3b1882){const _0x2462e5=serializeExpandedRule(_0x5631ac,_0x3b1882),_0xb3717=_0x53473e[_0xa7afde(0xcd)](_0x2462e5)||[];_0xb3717[_0xa7afde(0xd9)]({'name':_0x5afbf0,'index':_0x13cf6d}),_0x53473e['set'](_0x2462e5,_0xb3717),_0x13cf6d++;}const _0xa81df4=new Map();for(const [_0x30a357,_0x43c867]of _0x53473e){const _0x3bdd5b=_0x43c867[_0xa7afde(0x18b)]()[_0xa7afde(0xae)]((_0x4bf7b1,_0x5490c5)=>{const _0x300a2d=_0xa7afde,_0x3e236a=_0x552a35['get'](_0x4bf7b1[_0x300a2d(0x11b)])||0x0,_0x545a46=_0x552a35['get'](_0x5490c5[_0x300a2d(0x11b)])||0x0;if(_0x3e236a!==_0x545a46)return _0x545a46-_0x3e236a;return _0x4bf7b1[_0x300a2d(0xdb)]-_0x5490c5[_0x300a2d(0xdb)];})[_0xa7afde(0x169)](_0x5c33c5=>_0x5c33c5[_0xa7afde(0x11b)]),_0x487bf7=[];for(const _0x4f4a13 of _0x3bdd5b){const _0x176ef4=_0x552a35['get'](_0x4f4a13)||0x0,_0x16839f=Math[_0xa7afde(0x137)](_0x176ef4,0x1);for(let _0x1289e6=0x0;_0x1289e6<_0x16839f;_0x1289e6++){_0x487bf7[_0xa7afde(0xd9)](_0x4f4a13);}}_0xa81df4[_0xa7afde(0x1af)](_0x30a357,_0x487bf7);}return{'existingLocalSegmentNames':_0x1076bb,'localSegmentRules':_0x3b1882,'localExpandedRuleToNames':_0xa81df4};}export function createSegmentIdResolver(_0x862817,_0x1d6f92){return async _0x3928fd=>{const _0x428fc9=a152_0x1cc0,_0x4b65fb=_0x862817[_0x428fc9(0xcd)](_0x3928fd);if(!_0x4b65fb)throw new SDKError(ErrorCode[_0x428fc9(0xc1)],_0x428fc9(0x104)+_0x3928fd+_0x428fc9(0xfc)+_0x1d6f92+'\x27)');return _0x4b65fb;};}export function extractRootFolderId(_0x3514f5){const _0x2758e1=a152_0x54ab40;return _0x3514f5['relationships']?.[_0x2758e1(0x1b0)]?.[_0x2758e1(0xdf)]?.['id']||_0x3514f5[_0x2758e1(0x181)]?.[_0x2758e1(0x120)]?.['data']?.['id'];}export function buildConnectionMaps(_0x575c46){const _0x529490=a152_0x54ab40,_0x207c8e=new Map(),_0x4fd67d=new Map(),_0x18b435=new Map();for(const _0xa09e68 of _0x575c46){_0x207c8e[_0x529490(0x1af)](_0xa09e68[_0x529490(0x11b)],parseInt(_0xa09e68['id'],0xa)),_0x4fd67d['set'](_0xa09e68['id'],_0xa09e68[_0x529490(0x11b)]),_0x18b435[_0x529490(0x1af)](_0xa09e68['name'],_0xa09e68['type']);}return{'nameToId':_0x207c8e,'idToName':_0x4fd67d,'nameToType':_0x18b435};}export function calculatePushStats(_0x126fb7,_0x135519,_0x4c7242,_0x2ff8a0,_0x17a4e7,_0x47b74e,_0x49ea78){const _0x164b20=a152_0x54ab40,_0x38e7f0=_0x126fb7[_0x164b20(0x175)](_0x39f2b5=>_0x39f2b5[_0x164b20(0x18c)]),_0x3cbe25=_0x126fb7[_0x164b20(0x175)](_0x5d100a=>!_0x5d100a['isNew']&&_0x5d100a[_0x164b20(0xe6)]),_0x423f23=_0x126fb7[_0x164b20(0x175)](_0x35d069=>!_0x35d069[_0x164b20(0x18c)]&&!_0x35d069[_0x164b20(0xe6)]),_0x32ea73=_0x47b74e?_0x2ff8a0:[],_0x45ca62=_0x135519[_0x164b20(0x175)](_0x4dff92=>_0x4dff92['isNew']),_0x3fc297=_0x135519[_0x164b20(0x175)](_0x439114=>!_0x439114['isNew']&&_0x439114[_0x164b20(0xe6)]),_0x3cdd52=_0x135519[_0x164b20(0x175)](_0x293491=>!_0x293491['isNew']&&!_0x293491[_0x164b20(0xe6)]),_0x79bcef=_0x47b74e?_0x17a4e7:[],_0x44b870=_0x126fb7[_0x164b20(0x14e)](_0x21e482=>_0x21e482['activationActions']),_0x30d242=_0x44b870['filter'](_0x46f02e=>_0x46f02e[_0x164b20(0xb0)]===_0x164b20(0x105)),_0x509da7=_0x44b870['filter'](_0x236dbf=>_0x236dbf[_0x164b20(0xb0)]===_0x164b20(0x1a9)),_0x144104=_0x44b870['filter'](_0xd1c53=>_0xd1c53[_0x164b20(0xb0)]==='delete'),_0x3bc0ca=Array[_0x164b20(0x11c)](_0x4c7242)[_0x164b20(0xae)](),_0x516a5f=_0x49ea78?![]:_0x38e7f0[_0x164b20(0x18e)]>0x0||_0x3cbe25[_0x164b20(0x18e)]>0x0||_0x32ea73['length']>0x0,_0x747741=_0x45ca62[_0x164b20(0x18e)]>0x0||_0x3fc297[_0x164b20(0x18e)]>0x0||_0x79bcef[_0x164b20(0x18e)]>0x0,_0x32515d=_0x49ea78?![]:_0x44b870[_0x164b20(0x18e)]>0x0,_0x248044=_0x3bc0ca[_0x164b20(0x18e)]>0x0;return{'segments':{'new':_0x38e7f0,'changed':_0x3cbe25,'unchanged':_0x423f23,'toDelete':_0x32ea73},'journeys':{'new':_0x45ca62,'changed':_0x3fc297,'unchanged':_0x3cdd52,'toDelete':_0x79bcef},'activations':{'all':_0x44b870,'toCreate':_0x30d242,'toUpdate':_0x509da7,'toDelete':_0x144104},'folders':{'toCreate':_0x3bc0ca},'counts':{'segments':{'new':_0x38e7f0[_0x164b20(0x18e)],'changed':_0x3cbe25['length'],'unchanged':_0x423f23['length'],'toDelete':_0x32ea73['length']},'journeys':{'new':_0x45ca62['length'],'changed':_0x3fc297[_0x164b20(0x18e)],'unchanged':_0x3cdd52[_0x164b20(0x18e)],'toDelete':_0x79bcef['length']},'activations':{'create':_0x30d242[_0x164b20(0x18e)],'update':_0x509da7['length'],'delete':_0x144104[_0x164b20(0x18e)]},'folders':_0x3bc0ca['length']},'hasChanges':_0x516a5f||_0x747741||_0x32515d||_0x248044};}export async function buildPushExecutionContext(_0x5317b9,_0x48a694,_0x281469,_0x5d2261,_0xc65977,_0x5e067d){const _0x4e59d7=a152_0x54ab40,_0x20a3f9=extractRootFolderId(_0x281469),{pathToId:_0x497383,idToPath:_0x5aee73}=buildFolderMaps(_0xc65977),_0x3cda5d=buildSegmentNameToIdMap(_0x5d2261),_0xced097=new Map(),{batchAsync:_0x1d41ab}=await import('../../utils/async.js'),[_0x4edcf1,_0x20e849]=await Promise[_0x4e59d7(0x1ac)]([_0x5317b9[_0x4e59d7(0x114)][_0x4e59d7(0xd8)](),_0x5317b9[_0x4e59d7(0xb6)][_0x4e59d7(0xd1)](),((async()=>{const _0x58faf1=_0x4e59d7;!_0x5e067d&&_0x5d2261[_0x58faf1(0x18e)]>0x0&&await _0x1d41ab(_0x5d2261,async _0xfae654=>{const _0x3e37e3=_0x58faf1,_0x4681bf=await _0x5317b9[_0x3e37e3(0x1a7)][_0x3e37e3(0xa7)](_0x48a694,_0xfae654['id']);_0xced097[_0x3e37e3(0x1af)](_0xfae654['id'],_0x4681bf);});})())]),{emailToId:_0x3ba55c,idToEmail:_0x33caaf}=_0x4edcf1,_0x1dcd04=buildConnectionMaps(_0x20e849);return{'rootFolderId':_0x20a3f9,'folderPathToId':_0x497383,'folderIdToPath':_0x5aee73,'segmentNameToId':_0x3cda5d,'activationsBySegmentId':_0xced097,'emailToIdMap':_0x3ba55c,'idToEmailMap':_0x33caaf,'connectionNameToIdMap':_0x1dcd04[_0x4e59d7(0x17b)],'connectionIdToNameMap':_0x1dcd04[_0x4e59d7(0xc7)],'connectionNameToTypeMap':_0x1dcd04[_0x4e59d7(0x100)]};}export function createPushYamlContextForBundle(_0x468641,_0x3afc24,_0x4dfe57,_0x437d90,_0x662288,_0x3440ef,_0x175de4,_0x4d62ef){const {existingLocalSegmentNames:_0x35c6a3,localExpandedRuleToNames:_0x3616e3}=_0x437d90,_0x187899=new Set(),_0x5e8409=new Map(),_0x5b2596=new Map(),_0x508b8e=new Map(),_0x1c5657=createJumpTargetCache(),_0x2513e7=new Map(),_0x4f0c5d=new Map(),_0x41fc7d=new Set();let _0x4faf89;const _0xf7d3a0=_0x4c00fe=>{const _0x58433d={'resolveSegment':async _0x11d9b=>{const _0x11cc12=a152_0x1cc0,_0x1dae89=_0x508b8e['get'](_0x11d9b);if(_0x1dae89!==undefined)return{'name':_0x1dae89,'isJourneyLocal':!![]};try{const _0x415a72=await fetchSegment(_0x468641,_0x3afc24,_0x11d9b,_0x4dfe57);if(!_0x415a72)throw new Error(_0x11cc12(0x15a));const _0x235912=generateJourneyLocalName(_0x415a72['name']),_0x526aed=_0x415a72[_0x11cc12(0x182)]===SEGMENT_KIND_JOURNEY&&_0x235912!==undefined;let _0x2fe60c=_0x415a72[_0x11cc12(0x11b)],_0x2faf43;if(_0x526aed&&_0x415a72[_0x11cc12(0x193)]){const _0x2c0831=apiRuleToYaml(_0x415a72[_0x11cc12(0x193)]);_0x4f0c5d[_0x11cc12(0x1af)](_0x11d9b,_0x2c0831);const _0x39d200=async _0x4abc68=>{const _0x4ae495=_0x11cc12,_0x3f1cfd=collectSegmentRefsFromRule(_0x4abc68);for(const _0x5b00b1 of _0x3f1cfd){if(!_0x4f0c5d[_0x4ae495(0x12a)](_0x5b00b1))try{const _0x3ed7b3=await fetchSegment(_0x468641,_0x3afc24,_0x5b00b1,_0x4dfe57);if(_0x3ed7b3?.[_0x4ae495(0x193)]){const _0x4a0091=apiRuleToYaml(_0x3ed7b3[_0x4ae495(0x193)]);_0x4f0c5d[_0x4ae495(0x1af)](_0x5b00b1,_0x4a0091),await _0x39d200(_0x4a0091);}}catch(_0x48ff49){logger['debug'](_0x4ae495(0x18a)+_0x5b00b1+':\x20'+_0x48ff49);}}};await _0x39d200(_0x2c0831);const _0x2b33a1=serializeExpandedRule(_0x2c0831,_0x4f0c5d),_0x23fcef=_0x3616e3[_0x11cc12(0xcd)](_0x2b33a1);if(_0x23fcef&&_0x23fcef[_0x11cc12(0x18e)]>0x0){const _0x3f5fee=_0x5e8409[_0x11cc12(0xcd)](_0x2b33a1)||0x0,_0x240c9b=_0x23fcef[_0x3f5fee]||_0x23fcef[_0x23fcef[_0x11cc12(0x18e)]-0x1];_0x5e8409[_0x11cc12(0x1af)](_0x2b33a1,_0x3f5fee+0x1),_0x2fe60c=_0x240c9b,_0x187899[_0x11cc12(0xbc)](_0x2fe60c),_0x508b8e[_0x11cc12(0x1af)](_0x11d9b,_0x2fe60c);const _0x495ea0=await resolveRuleSegmentRefs(_0x2c0831,async _0xa43ea4=>{const _0x5d7325=_0x11cc12,_0x3e252e=_0x508b8e[_0x5d7325(0xcd)](_0xa43ea4);if(_0x3e252e)return _0x3e252e;const _0x2f22f2=await _0x4faf89['resolveSegment'](_0xa43ea4);return _0x2f22f2[_0x5d7325(0x11b)];});_0x2faf43={'description':_0x415a72['description'],'rule':_0x495ea0};}else{const _0x35d993=_0x2513e7[_0x11cc12(0xcd)](_0x2b33a1);if(_0x35d993)_0x2fe60c=_0x35d993,_0x508b8e[_0x11cc12(0x1af)](_0x11d9b,_0x2fe60c);else{if(_0x235912){let _0x294f5d=_0x235912,_0x1a53fc=0x2;while(_0x187899[_0x11cc12(0x12a)](_0x294f5d)||_0x35c6a3[_0x11cc12(0x12a)](_0x294f5d)){_0x294f5d=_0x235912+'_'+_0x1a53fc,_0x1a53fc++;}_0x187899[_0x11cc12(0xbc)](_0x294f5d),_0x2fe60c=_0x294f5d;}_0x508b8e[_0x11cc12(0x1af)](_0x11d9b,_0x2fe60c),_0x2513e7[_0x11cc12(0x1af)](_0x2b33a1,_0x2fe60c);const _0x4dcdb5=await resolveRuleSegmentRefs(_0x2c0831,async _0x92bc4b=>{const _0x1c4fba=_0x11cc12,_0x2bf080=_0x508b8e['get'](_0x92bc4b);if(_0x2bf080)return _0x2bf080;const _0x11ac55=await _0x4faf89[_0x1c4fba(0xfa)](_0x92bc4b);return _0x11ac55[_0x1c4fba(0x11b)];});_0x2faf43={'description':_0x415a72['description'],'rule':_0x4dcdb5};}}}return{'name':_0x2fe60c,'isJourneyLocal':_0x526aed,'definition':_0x2faf43};}catch(_0xa1aee5){return logger['debug'](_0x11cc12(0x191)+_0x11d9b+':\x20'+_0xa1aee5),{'name':_0x11d9b,'isJourneyLocal':![]};}},'resolveActivation':async _0x227d23=>{const _0x4d611b=a152_0x1cc0,_0x30731e=_0x5b2596[_0x4d611b(0xcd)](_0x227d23);if(_0x30731e!==undefined)return{'name':_0x30731e,'isJourneyLocal':!![]};try{let _0x52746c=_0x175de4?.[_0x4d611b(0xcd)](_0x227d23);!_0x52746c&&(_0x52746c=await _0x468641[_0x4d611b(0x129)][_0x4d611b(0x196)](_0x4c00fe,_0x227d23));const _0x1a4ba3=_0x52746c['attributes'][_0x4d611b(0x195)]['name']||_0x227d23,_0x2c73fd=sanitizeYamlKey(_0x1a4ba3)||_0x4d611b(0xe1)+_0x227d23,_0x32cda3=_0x2c73fd;_0x5b2596[_0x4d611b(0x1af)](_0x227d23,_0x32cda3);const _0x18fc09=journeyActivationStepToYaml(_0x52746c,_0x662288,_0x3440ef);return{'name':_0x32cda3,'isJourneyLocal':!![],'definition':_0x18fc09};}catch(_0xa6aeb8){return logger[_0x4d611b(0x134)](_0x4d611b(0xbd)+_0x227d23+':\x20'+_0xa6aeb8),{'name':_0x227d23,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x5eace2,_0x66ad4e)=>resolveJumpTarget(_0x5eace2,_0x66ad4e,_0x1c5657,async _0x50b191=>{const _0x47f04f=a152_0x1cc0,_0x55d1e9=_0x4d62ef?.[_0x47f04f(0xcd)](_0x50b191);if(_0x55d1e9)return _0x55d1e9;return _0x468641['journey'][_0x47f04f(0x101)](_0x50b191);})};return _0x4faf89=_0x58433d,_0x58433d;},_0x155271=async _0x5a290b=>{const _0x2667ad=a152_0x1cc0,{collectSegmentIdsFromJourneyApi:_0x126872}=await import('./journey-yaml.js'),{batchAsync:_0x5a4c31}=await import(_0x2667ad(0x136)),_0x326d9f=new Set();for(const _0x11c002 of _0x5a290b){let _0x4ca71b=_0x4d62ef?.[_0x2667ad(0xcd)](_0x11c002);!_0x4ca71b&&(_0x4ca71b=await _0x468641[_0x2667ad(0x129)]['getJourney'](_0x11c002));const _0x1c2393=_0x126872(_0x4ca71b);for(const _0x5b67a3 of _0x1c2393){_0x326d9f[_0x2667ad(0xbc)](_0x5b67a3);}}let _0x154cdf=Array['from'](_0x326d9f);while(_0x154cdf[_0x2667ad(0x18e)]>0x0){const _0x4b2256=_0x154cdf[_0x2667ad(0x175)](_0x23cedc=>!_0x41fc7d[_0x2667ad(0x12a)](_0x23cedc));if(_0x4b2256[_0x2667ad(0x18e)]===0x0)break;const _0x7bb7d=await _0x5a4c31(_0x4b2256,async _0x48f0f1=>{const _0x2124ec=_0x2667ad;_0x41fc7d[_0x2124ec(0xbc)](_0x48f0f1);const _0x2117be=await fetchSegment(_0x468641,_0x3afc24,_0x48f0f1,_0x4dfe57);if(!_0x2117be)return null;return{'segmentId':_0x48f0f1,'segment':_0x2117be};},0xa),_0x577f4b=new Set();for(const _0x435513 of _0x7bb7d){if(!_0x435513?.[_0x2667ad(0x1a7)]?.[_0x2667ad(0x193)])continue;const _0x2cfac7=apiRuleToYaml(_0x435513[_0x2667ad(0x1a7)][_0x2667ad(0x193)]);_0x4f0c5d[_0x2667ad(0x1af)](_0x435513[_0x2667ad(0x15e)],_0x2cfac7);const _0x17d5c4=collectSegmentRefsFromRule(_0x2cfac7);for(const _0x18e86e of _0x17d5c4){!_0x41fc7d[_0x2667ad(0x12a)](_0x18e86e)&&_0x577f4b['add'](_0x18e86e);}}_0x154cdf=Array[_0x2667ad(0x11c)](_0x577f4b);}};return{'createYamlContext':_0xf7d3a0,'prefetchJourneySegments':_0x155271};}export async function executePushSegments(_0x509eb6,_0x483cf4,_0x3e0d53,_0x4ed512,_0x8aedc){const _0x3bc36b=a152_0x54ab40,{segmentDefToCreateRequest:_0x6aba86,segmentDefToUpdateRequest:_0x3e629c}=await import(_0x3bc36b(0x13c)),_0x396c2e=_0x3e0d53[_0x3bc36b(0x15b)],_0x2c26bf=0x5,_0x52be9e=async _0x29a478=>{const _0x135f4=_0x3bc36b,_0x2f7be0=_0x29a478[_0x135f4(0xca)]?_0x396c2e['get'](_0x29a478[_0x135f4(0xca)]):undefined;let _0x1dc283;const _0x803c0d={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x5db7e4=_0x29a478[_0x135f4(0x199)];if(_0x29a478[_0x135f4(0x199)][_0x135f4(0x193)]){const _0x56cbd9=createSegmentIdResolver(_0x3e0d53[_0x135f4(0xe9)],_0x29a478[_0x135f4(0x199)][_0x135f4(0x11b)]),_0x2e7124=await resolveRuleSegmentIds(_0x29a478[_0x135f4(0x199)][_0x135f4(0x193)],_0x56cbd9);_0x5db7e4={..._0x29a478[_0x135f4(0x199)],'rule':_0x2e7124};}try{if(_0x29a478[_0x135f4(0x18c)]){_0x8aedc[_0x135f4(0x139)]?.({'type':_0x135f4(0x107),'name':_0x29a478['yamlConfig'][_0x135f4(0x11b)]});const _0x169da5=_0x6aba86(_0x5db7e4,_0x2f7be0),_0xaf131a=await _0x8aedc[_0x135f4(0xda)](_0x135f4(0x121)+_0x29a478[_0x135f4(0x199)][_0x135f4(0x11b)]+_0x135f4(0x177),()=>_0x509eb6[_0x135f4(0x1a7)][_0x135f4(0xd4)](_0x4ed512[_0x135f4(0x10b)],_0x169da5));_0x1dc283=_0xaf131a[_0x135f4(0xdf)]['id'],_0x3e0d53[_0x135f4(0xe9)][_0x135f4(0x1af)](_0x29a478['yamlConfig'][_0x135f4(0x11b)],_0x1dc283),_0x803c0d['createdSegmentId']={'name':_0x29a478[_0x135f4(0x199)][_0x135f4(0x11b)],'id':_0x1dc283},_0x8aedc['onProgress']?.({'type':_0x135f4(0x171),'name':_0x29a478['yamlConfig']['name'],'segmentId':_0x1dc283}),_0x8aedc[_0x135f4(0xa4)]?.(_0x135f4(0x16e)+_0x29a478[_0x135f4(0x199)][_0x135f4(0x11b)]+'\x27'),_0x803c0d[_0x135f4(0x14c)]=0x1;}else{if(_0x29a478[_0x135f4(0xe6)]){_0x8aedc[_0x135f4(0x139)]?.({'type':_0x135f4(0x16c),'name':_0x29a478['yamlConfig']['name']});const _0x2ee4a5=_0x3e629c(_0x5db7e4);_0x2f7be0!==_0x29a478['existingSegment']?.[_0x135f4(0x12d)]&&(_0x2ee4a5['segmentFolderId']=_0x2f7be0?parseInt(_0x2f7be0,0xa):undefined),await _0x8aedc[_0x135f4(0xda)](_0x135f4(0x10c)+_0x29a478['yamlConfig']['name']+_0x135f4(0x177),()=>_0x509eb6[_0x135f4(0x1a7)][_0x135f4(0x183)](_0x4ed512[_0x135f4(0x10b)],_0x29a478[_0x135f4(0x1ad)]['id'],_0x2ee4a5)),_0x1dc283=_0x29a478[_0x135f4(0x1ad)]['id'],_0x8aedc[_0x135f4(0x139)]?.({'type':_0x135f4(0x13b),'name':_0x29a478[_0x135f4(0x199)][_0x135f4(0x11b)]}),_0x8aedc[_0x135f4(0xa4)]?.('Updated\x20segment\x20\x27'+_0x29a478[_0x135f4(0x199)][_0x135f4(0x11b)]+'\x27'),_0x803c0d[_0x135f4(0x185)]=0x1;}else _0x1dc283=_0x29a478['existingSegment']['id'];}}catch(_0x24687){const _0x113855=isHttp400Error(_0x24687),_0x263a77=_0x113855?ErrorCode[_0x135f4(0x16a)]:ErrorCode[_0x135f4(0xaa)],_0xd54a=getErrorMessage(_0x24687);throw new SDKError(_0x263a77,'Failed\x20to\x20'+(_0x29a478[_0x135f4(0x18c)]?'create':'update')+_0x135f4(0xd3)+_0x29a478[_0x135f4(0x147)]+_0x135f4(0x1a5)+_0xd54a,_0x24687);}try{const _0x44a1fc=await syncActivationsForSegment(_0x509eb6,_0x4ed512[_0x135f4(0x10b)],_0x1dc283,_0x29a478[_0x135f4(0x199)][_0x135f4(0x11b)],_0x29a478['activationActions'],_0x8aedc,_0x29a478[_0x135f4(0x147)]);_0x803c0d['activations']=_0x44a1fc;}catch(_0x978509){if(_0x978509 instanceof SDKError)throw _0x978509;throw new SDKError(ErrorCode[_0x135f4(0xe5)],_0x135f4(0xed)+_0x29a478[_0x135f4(0x199)][_0x135f4(0x11b)]+_0x135f4(0xf6)+_0x29a478[_0x135f4(0x147)]+'\x0a\x20\x20'+getErrorMessage(_0x978509),_0x978509);}return _0x803c0d;},_0x436c98=await batchAsync(_0x483cf4,_0x52be9e,_0x2c26bf),_0x2a1fde={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x2fe466 of _0x436c98){_0x2a1fde[_0x3bc36b(0x14c)]+=_0x2fe466['created'],_0x2a1fde['updated']+=_0x2fe466[_0x3bc36b(0x185)],_0x2fe466[_0x3bc36b(0x17d)]&&_0x2a1fde[_0x3bc36b(0x16d)][_0x3bc36b(0x1af)](_0x2fe466[_0x3bc36b(0x17d)][_0x3bc36b(0x11b)],_0x2fe466[_0x3bc36b(0x17d)]['id']),_0x2a1fde['activations'][_0x3bc36b(0x14c)]+=_0x2fe466[_0x3bc36b(0x168)][_0x3bc36b(0x14c)],_0x2a1fde[_0x3bc36b(0x168)][_0x3bc36b(0x185)]+=_0x2fe466[_0x3bc36b(0x168)][_0x3bc36b(0x185)],_0x2a1fde[_0x3bc36b(0x168)]['deleted']+=_0x2fe466[_0x3bc36b(0x168)][_0x3bc36b(0x15d)];}return _0x2a1fde;}async function syncActivationsForSegment(_0xbe208,_0x3cad8c,_0x16f041,_0x59b314,_0x530fd2,_0x2b8e2b,_0x5a4ded){const _0x12d737=a152_0x54ab40,_0x3a280b={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x121ef8 of _0x530fd2){try{if(_0x121ef8[_0x12d737(0xb0)]===_0x12d737(0x105)&&_0x121ef8[_0x12d737(0x140)])_0x2b8e2b[_0x12d737(0x139)]?.({'type':_0x12d737(0xd0),'segmentName':_0x59b314,'activationName':_0x121ef8[_0x12d737(0x11b)]}),await _0x2b8e2b['withProgress']('Creating\x20activation\x20\x27'+_0x121ef8[_0x12d737(0x11b)]+_0x12d737(0x177),()=>_0xbe208[_0x12d737(0x1a7)]['createActivation'](_0x3cad8c,_0x16f041,_0x121ef8[_0x12d737(0x140)])),_0x2b8e2b[_0x12d737(0x139)]?.({'type':_0x12d737(0x1a4),'segmentName':_0x59b314,'activationName':_0x121ef8[_0x12d737(0x11b)]}),_0x2b8e2b[_0x12d737(0xa4)]?.('Created\x20activation\x20\x27'+_0x121ef8[_0x12d737(0x11b)]+'\x27'),_0x3a280b['created']++;else{if(_0x121ef8[_0x12d737(0xb0)]===_0x12d737(0x1a9)&&_0x121ef8['validatedRequest']&&_0x121ef8['existingActivation'])_0x2b8e2b['onProgress']?.({'type':'activation_updating','segmentName':_0x59b314,'activationName':_0x121ef8[_0x12d737(0x11b)]}),await _0x2b8e2b[_0x12d737(0xda)](_0x12d737(0x117)+_0x121ef8[_0x12d737(0x11b)]+'\x27...',()=>_0xbe208[_0x12d737(0x1a7)][_0x12d737(0xd6)](_0x3cad8c,_0x16f041,_0x121ef8[_0x12d737(0xf1)]['id'],_0x121ef8[_0x12d737(0x140)])),_0x2b8e2b[_0x12d737(0x139)]?.({'type':_0x12d737(0xc2),'segmentName':_0x59b314,'activationName':_0x121ef8[_0x12d737(0x11b)]}),_0x2b8e2b[_0x12d737(0xa4)]?.('Updated\x20activation\x20\x27'+_0x121ef8[_0x12d737(0x11b)]+'\x27'),_0x3a280b[_0x12d737(0x185)]++;else _0x121ef8[_0x12d737(0xb0)]===_0x12d737(0x116)&&_0x121ef8[_0x12d737(0xf1)]&&(_0x2b8e2b[_0x12d737(0x139)]?.({'type':_0x12d737(0x10f),'segmentName':_0x59b314,'activationName':_0x121ef8[_0x12d737(0x11b)]}),await _0x2b8e2b['withProgress']('Deleting\x20activation\x20\x27'+_0x121ef8[_0x12d737(0x11b)]+'\x27...',()=>_0xbe208[_0x12d737(0x1a7)][_0x12d737(0xb7)](_0x3cad8c,_0x16f041,_0x121ef8['existingActivation']['id'])),_0x2b8e2b[_0x12d737(0x139)]?.({'type':_0x12d737(0xd7),'segmentName':_0x59b314,'activationName':_0x121ef8[_0x12d737(0x11b)]}),_0x2b8e2b[_0x12d737(0xde)]?.(_0x12d737(0xf9)+_0x121ef8['name']+'\x27'),_0x3a280b['deleted']++);}}catch(_0x15659a){const _0x4f4396=isHttp400Error(_0x15659a),_0x46c891=_0x4f4396?ErrorCode[_0x12d737(0xff)]:ErrorCode[_0x12d737(0xe5)],_0x1c53a1=getErrorMessage(_0x15659a);throw new SDKError(_0x46c891,_0x12d737(0x1aa)+_0x121ef8['type']+_0x12d737(0x17c)+_0x121ef8[_0x12d737(0x11b)]+_0x12d737(0xf6)+_0x5a4ded+_0x12d737(0x1a5)+_0x1c53a1,_0x15659a);}}return _0x3a280b;}export async function executePushFolders(_0xe9eb4b,_0x18dcc7,_0x2aee60,_0x1ae35b,_0x5f44c9){const _0x5097fc=a152_0x54ab40,_0x9ced22=new Map(_0x2aee60),_0x5331c6=sortFoldersByDepth(_0x18dcc7);for(const _0x7f9b0b of _0x5331c6){const _0x1d9bf2=_0x7f9b0b['split']('/'),_0x22e0ef=_0x1d9bf2[_0x1d9bf2[_0x5097fc(0x18e)]-0x1],_0x518a9a=_0x1d9bf2['slice'](0x0,-0x1)[_0x5097fc(0x151)]('/'),_0x3ac165=_0x9ced22[_0x5097fc(0xcd)](_0x518a9a);_0x5f44c9['onProgress']?.({'type':_0x5097fc(0x111),'folder':_0x7f9b0b});const _0x772217={'name':_0x22e0ef,'parentFolderId':_0x3ac165},_0x4badb2=await _0x5f44c9['withProgress'](_0x5097fc(0x10a)+_0x7f9b0b+'\x27...',()=>_0xe9eb4b[_0x5097fc(0x1a7)][_0x5097fc(0x16f)](_0x1ae35b[_0x5097fc(0x10b)],_0x772217));_0x9ced22[_0x5097fc(0x1af)](_0x7f9b0b,_0x4badb2[_0x5097fc(0xdf)]['id']),_0x5f44c9[_0x5097fc(0x139)]?.({'type':_0x5097fc(0x106),'folder':_0x7f9b0b,'folderId':_0x4badb2[_0x5097fc(0xdf)]['id']}),_0x5f44c9[_0x5097fc(0x179)]?.(_0x5097fc(0x113)+_0x7f9b0b+'\x27');}return _0x9ced22;}export async function executePushSegmentDeletions(_0x103bfe,_0x3defdc,_0x21a4f3){const _0x2aeea2=a152_0x54ab40;if(_0x3defdc[_0x2aeea2(0x18e)]===0x0)return 0x0;const {batchAsync:_0xe83c62}=await import(_0x2aeea2(0x136)),_0x54cfa6=0x5,_0x28b84c=await _0xe83c62(_0x3defdc,async _0x3a1795=>{const _0x251242=_0x2aeea2;return _0x21a4f3[_0x251242(0x139)]?.({'type':_0x251242(0xbe),'name':_0x3a1795[_0x251242(0x11b)]}),await _0x103bfe[_0x251242(0x1a7)][_0x251242(0xfe)](_0x3a1795['id']),_0x21a4f3[_0x251242(0x139)]?.({'type':'segment_deleted','name':_0x3a1795[_0x251242(0x11b)]}),_0x21a4f3[_0x251242(0xde)]?.('Deleted\x20segment\x20\x27'+_0x3a1795['name']+'\x27'),0x1;},_0x54cfa6);return _0x28b84c[_0x2aeea2(0xcb)]((_0x2aae8d,_0x2b8586)=>_0x2aae8d+_0x2b8586,0x0);}export async function executePushJourneys(_0x348de9,_0x262258,_0x1e1aa4,_0x12b1a2,_0x401f4c){const _0x2e98d8=a152_0x54ab40,{journeyDefToRequest:_0x2c40a7}=await import(_0x2e98d8(0x127)),{activationDefToCreateRequest:_0x2ca9ed,yamlRuleToApi:_0x5a5895,validateSegmentRule:_0x6fd1f1}=await import(_0x2e98d8(0x13c)),_0x4bf03d={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x5b53f2=new Map(_0x1e1aa4[_0x2e98d8(0xe9)]),_0x578f88=0x5;for(let _0x5cae84=0x0;_0x5cae84<_0x262258['length'];_0x5cae84+=_0x578f88){const _0x56d263=_0x262258[_0x2e98d8(0x18b)](_0x5cae84,_0x5cae84+_0x578f88),_0x37e71e=await Promise['all'](_0x56d263[_0x2e98d8(0x169)](async _0x518a16=>{const _0xf2a65e=_0x2e98d8;if(!_0x518a16[_0xf2a65e(0x18c)]&&!_0x518a16[_0xf2a65e(0xe6)])return{'action':_0xf2a65e(0xbf),'name':_0x518a16[_0xf2a65e(0x199)][_0xf2a65e(0x11b)],'journeyId':_0x518a16['existingJourney']?.['id']};const _0x15b053=_0x518a16[_0xf2a65e(0xca)]?_0x1e1aa4[_0xf2a65e(0x15b)][_0xf2a65e(0xcd)](_0x518a16[_0xf2a65e(0xca)]):undefined;_0x401f4c[_0xf2a65e(0x139)]?.({'type':_0x518a16[_0xf2a65e(0x18c)]?_0xf2a65e(0x148):_0xf2a65e(0x173),'name':_0x518a16['yamlConfig'][_0xf2a65e(0x11b)]});try{const _0x4a4084=await executeSingleJourneyPush(_0x348de9,_0x518a16,{..._0x1e1aa4,'segmentNameToId':_0x5b53f2},{'parentId':_0x12b1a2[_0xf2a65e(0x10b)],'rootFolderId':_0x12b1a2['rootFolderId'],'folderId':_0x15b053,'verbose':_0x12b1a2[_0xf2a65e(0xc0)]},_0x401f4c,{'journeyDefToRequest':_0x2c40a7,'activationDefToCreateRequest':_0x2ca9ed,'yamlRuleToApi':_0x5a5895,'validateSegmentRule':_0x6fd1f1});for(const [_0x358790,_0x324484]of _0x4a4084[_0xf2a65e(0x174)]){_0x5b53f2[_0xf2a65e(0x1af)](_0x358790,_0x324484),_0x4bf03d[_0xf2a65e(0x174)]['set'](_0x358790,_0x324484);}if(_0x4a4084[_0xf2a65e(0xa5)]===_0xf2a65e(0x14c))_0x401f4c[_0xf2a65e(0x139)]?.({'type':'journey_created','name':_0x518a16[_0xf2a65e(0x199)][_0xf2a65e(0x11b)],'journeyId':_0x4a4084[_0xf2a65e(0x150)]}),_0x401f4c[_0xf2a65e(0xa4)]?.(_0xf2a65e(0x149)+_0x518a16[_0xf2a65e(0x199)]['name']+'\x27'),_0x4bf03d[_0xf2a65e(0x14c)]++;else _0x4a4084['action']===_0xf2a65e(0x185)&&(_0x401f4c[_0xf2a65e(0x139)]?.({'type':_0xf2a65e(0x124),'name':_0x518a16[_0xf2a65e(0x199)][_0xf2a65e(0x11b)]}),_0x401f4c[_0xf2a65e(0xa4)]?.(_0xf2a65e(0x16b)+_0x518a16['yamlConfig'][_0xf2a65e(0x11b)]+'\x27'),_0x4bf03d[_0xf2a65e(0x185)]++);return{'action':_0x4a4084[_0xf2a65e(0xa5)],'name':_0x518a16[_0xf2a65e(0x199)]['name'],'journeyId':_0x4a4084['journeyId']};}catch(_0x3ed8b8){const _0x1f857a=isHttp400Error(_0x3ed8b8),_0x568f82=_0x1f857a?ErrorCode[_0xf2a65e(0xd2)]:ErrorCode[_0xf2a65e(0xb2)],_0x5c2c12=getErrorMessage(_0x3ed8b8);throw new SDKError(_0x568f82,'Failed\x20to\x20'+(_0x518a16[_0xf2a65e(0x18c)]?'create':_0xf2a65e(0x1a9))+_0xf2a65e(0x12c)+_0x518a16[_0xf2a65e(0x147)]+_0xf2a65e(0x1a5)+_0x5c2c12,_0x3ed8b8);}}));_0x4bf03d['results']['push'](..._0x37e71e);}return _0x4bf03d;}async function matchExistingJourneySegments(_0x13c7fe,_0x46fe19,_0x30b3f1,_0x6aeb26,_0x4403bc){const _0x2de05a=a152_0x54ab40;if(!_0x46fe19[_0x2de05a(0x187)]||!_0x46fe19['yamlConfig'][_0x2de05a(0x112)])return;const _0x14813d=new Map(),_0x295174=new Set();for(const _0x200778 of Object[_0x2de05a(0x164)](_0x46fe19[_0x2de05a(0x199)][_0x2de05a(0x112)])){const _0x2af843=generateDeterministicJourneySegmentName(_0x46fe19[_0x2de05a(0x199)][_0x2de05a(0x11b)],_0x200778);_0x14813d[_0x2de05a(0x1af)](_0x2af843,_0x200778),_0x295174[_0x2de05a(0xbc)](_0x200778);}const _0x3f14e6=[],_0x1d74fe=collectSegmentIdsFromJourneyApi(_0x46fe19['existingJourney']);for(const _0x3e49d9 of _0x1d74fe){const _0x38b01d=await fetchSegment(_0x13c7fe,_0x30b3f1,_0x3e49d9,_0x6aeb26);if(!_0x38b01d?.[_0x2de05a(0x11b)])continue;const _0x22d360=_0x14813d[_0x2de05a(0xcd)](_0x38b01d[_0x2de05a(0x11b)]);_0x22d360?(_0x4403bc[_0x2de05a(0x1af)](_0x22d360,_0x3e49d9),_0x295174[_0x2de05a(0x116)](_0x22d360)):_0x3f14e6[_0x2de05a(0xd9)]({'id':_0x3e49d9,'seg':_0x38b01d});}if(_0x295174[_0x2de05a(0x1a1)]>0x0&&_0x3f14e6[_0x2de05a(0x18e)]>0x0){const {localExpandedRuleToNames:_0x1907d2}=buildLocalExpandedRuleMappings(_0x46fe19['yamlConfig']),_0x288cee=new Map();for(const {id:_0x4b723c,seg:_0x1bc0ba}of _0x3f14e6){if(_0x1bc0ba[_0x2de05a(0x193)]){const _0x21b2e9=apiRuleToYaml(_0x1bc0ba['rule']);_0x288cee[_0x2de05a(0x1af)](_0x4b723c,_0x21b2e9);}}for(const {id:_0x54a4bd,seg:_0x773a24}of _0x3f14e6){if(!_0x773a24['rule'])continue;const _0x180b20=_0x288cee[_0x2de05a(0xcd)](_0x54a4bd);if(!_0x180b20)continue;const _0x4a2b8d=serializeExpandedRule(_0x180b20,_0x288cee),_0x59da33=_0x1907d2[_0x2de05a(0xcd)](_0x4a2b8d);if(_0x59da33){const _0x16a8cc=_0x59da33[_0x2de05a(0x19a)](_0x382ecf=>_0x295174[_0x2de05a(0x12a)](_0x382ecf));_0x16a8cc&&(_0x4403bc['set'](_0x16a8cc,_0x54a4bd),_0x295174[_0x2de05a(0x116)](_0x16a8cc),logger['debug']('Matched\x20server\x20segment\x20\x27'+_0x773a24['name']+'\x27\x20to\x20local\x20\x27'+_0x16a8cc+_0x2de05a(0x1a2)));}}}}async function executeSingleJourneyPush(_0x43feee,_0x2b4e1c,_0x59ec44,_0x1be599,_0x24fff3,_0x51c8a6){const _0x19f9f4=a152_0x54ab40,{journeyDefToRequest:_0x2289f9,activationDefToCreateRequest:_0xdf4d2e,yamlRuleToApi:_0x1ecd9e,validateSegmentRule:_0x3cda63}=_0x51c8a6,_0x1d337e=new Map(),_0x4ef52a=new Map();recoverSegmentIdsFromPushRecovery(_0x2b4e1c,_0x1d337e,_0x59ec44[_0x19f9f4(0xe9)]);const _0x53d834=new Map(),_0x3d2210=new Map(),_0x480420=new Map();let _0x207239;const _0x20b25c=async()=>{const _0x790c6e=_0x19f9f4;if(_0x207239)return;_0x207239=new Map();if(!_0x2b4e1c[_0x790c6e(0x187)])return;const _0x327106=await _0x43feee[_0x790c6e(0x129)][_0x790c6e(0xa7)](_0x2b4e1c[_0x790c6e(0x187)]['id']);for(const _0x4af148 of _0x327106){const _0x417139=journeyActivationStepToYaml(_0x4af148,_0x59ec44[_0x790c6e(0x166)],_0x59ec44[_0x790c6e(0x19b)]),_0x183381=activationSignature(_0x417139);!_0x207239[_0x790c6e(0x12a)](_0x183381)&&_0x207239[_0x790c6e(0x1af)](_0x183381,_0x4af148['id']),_0x417139['name']&&_0x4ef52a[_0x790c6e(0x1af)](_0x417139[_0x790c6e(0x11b)],_0x4af148['id']);}};await matchExistingJourneySegments(_0x43feee,_0x2b4e1c,_0x1be599['parentId'],_0x59ec44[_0x19f9f4(0xdc)],_0x59ec44[_0x19f9f4(0xe9)]);const _0x26e035={'resolveSegmentId':async _0x21b431=>{const _0xa428f0=_0x19f9f4,_0x35e232=_0x59ec44['segmentNameToId']['get'](_0x21b431);if(!_0x35e232)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0xa428f0(0x104)+_0x21b431+_0xa428f0(0x160)+_0x2b4e1c['yamlConfig'][_0xa428f0(0x11b)]+')');return _0x35e232;},'resolveEmbeddedSegmentId':async(_0x481dc7,_0x2fb3ed)=>{const _0x2ed04e=_0x19f9f4,_0x3d3a46=_0x59ec44['segmentNameToId'][_0x2ed04e(0xcd)](_0x481dc7);if(_0x3d3a46)return _0x3d3a46;const _0x599ea2=_0x59ec44[_0x2ed04e(0xdc)][_0x2ed04e(0x19a)](_0x20ce40=>_0x20ce40[_0x2ed04e(0x11b)]===_0x481dc7);if(_0x599ea2)return _0x59ec44[_0x2ed04e(0xe9)]['set'](_0x481dc7,_0x599ea2['id']),_0x599ea2['id'];if(_0x2b4e1c[_0x2ed04e(0x18c)]){const {stageName:_0x17cadd,criteriaName:_0x56f5a0}=findSegmentCriteriaLocation(_0x2b4e1c[_0x2ed04e(0x199)],_0x481dc7);return _0x3cda63(_0x481dc7,_0x2fb3ed[_0x2ed04e(0x193)]),_0x3d2210[_0x2ed04e(0x1af)](_0x481dc7,{'definition':_0x2fb3ed,'stageName':_0x17cadd,'criteriaName':_0x56f5a0}),createPendingSegmentId(_0x481dc7);}const _0x509a48=_0x2b4e1c[_0x2ed04e(0x187)]?.['id'];if(!_0x509a48)throw new SDKError(ErrorCode['INTERNAL'],_0x2ed04e(0xbb));const _0x3b47c6=_0x53d834[_0x2ed04e(0xcd)](_0x481dc7);if(_0x3b47c6)return _0x3b47c6;const _0x694e9b=((async()=>{const _0x57485e=_0x2ed04e;_0x3cda63(_0x481dc7,_0x2fb3ed[_0x57485e(0x193)]);const _0x19aa67=generateDeterministicJourneySegmentName(_0x2b4e1c[_0x57485e(0x199)][_0x57485e(0x11b)],_0x481dc7),_0x5c501d=_0x59ec44[_0x57485e(0xdc)][_0x57485e(0x19a)](_0x1a20af=>_0x1a20af[_0x57485e(0x11b)]===_0x19aa67),_0x37fafa=createSegmentIdResolver(_0x59ec44[_0x57485e(0xe9)],_0x481dc7),_0x5590e8=await resolveRuleSegmentIds(_0x2fb3ed[_0x57485e(0x193)],_0x37fafa);let _0x20dbd5;return _0x5c501d?(await _0x43feee[_0x57485e(0x1a7)][_0x57485e(0x183)](_0x1be599[_0x57485e(0x10b)],_0x5c501d['id'],{'description':_0x2fb3ed[_0x57485e(0xac)]||_0x57485e(0x161)+_0x481dc7,'rule':_0x1ecd9e(_0x5590e8),'countPopulation':!![]}),_0x20dbd5=_0x5c501d['id'],saveSegmentToPushRecovery(_0x2b4e1c[_0x57485e(0x147)],_0x2b4e1c[_0x57485e(0x199)][_0x57485e(0x11b)],_0x481dc7,{'segmentId':_0x20dbd5,'uniqueServerName':_0x19aa67,'createdAt':new Date()[_0x57485e(0x188)]()})):_0x20dbd5=await createOrRecoverEmbeddedSegment(_0x43feee,_0x2b4e1c,{'localName':_0x481dc7,'uniqueSegmentName':_0x19aa67,'description':_0x2fb3ed[_0x57485e(0xac)]||'Entry\x20criteria:\x20'+_0x481dc7,'journeyId':_0x509a48,'resolvedRule':_0x5590e8,'parentId':_0x1be599[_0x57485e(0x10b)],'folderId':_0x1be599[_0x57485e(0xfd)]||''},_0x1ecd9e),_0x59ec44[_0x57485e(0xe9)][_0x57485e(0x1af)](_0x481dc7,_0x20dbd5),_0x1d337e[_0x57485e(0x1af)](_0x481dc7,_0x20dbd5),_0x20dbd5;})());_0x53d834[_0x2ed04e(0x1af)](_0x481dc7,_0x694e9b);try{return await _0x694e9b;}finally{_0x53d834[_0x2ed04e(0x116)](_0x481dc7);}},'resolveActivationId':async _0x1baf6a=>{const _0x2965e4=_0x19f9f4,_0x977b93=_0x4ef52a['get'](_0x1baf6a);if(_0x977b93)return _0x977b93;if(_0x2b4e1c[_0x2965e4(0x187)]){await _0x20b25c();const _0x5db86a=_0x4ef52a[_0x2965e4(0xcd)](_0x1baf6a);if(_0x5db86a)return _0x5db86a;}throw new SDKError(ErrorCode[_0x2965e4(0x186)],_0x2965e4(0xb4)+_0x1baf6a+_0x2965e4(0x160)+_0x2b4e1c[_0x2965e4(0x199)][_0x2965e4(0x11b)]+_0x2965e4(0x192)+_0x2965e4(0xe8));},'resolveEmbeddedActivationId':async(_0x55877f,_0x2dcc48)=>{const _0x1b7b34=_0x19f9f4,_0x1512ea=_0x4ef52a['get'](_0x55877f);if(_0x1512ea)return _0x1512ea;if(_0x2b4e1c[_0x1b7b34(0x18c)])return _0x480420[_0x1b7b34(0x1af)](_0x55877f,_0x2dcc48),createPendingActivationId(_0x55877f);if(_0x2b4e1c[_0x1b7b34(0x187)]){await _0x20b25c();const _0x42e441=_0x4ef52a[_0x1b7b34(0xcd)](_0x2dcc48[_0x1b7b34(0x11b)]);if(_0x42e441)return _0x4ef52a[_0x1b7b34(0x1af)](_0x55877f,_0x42e441),_0x42e441;const _0x4ffab6=activationSignature(_0x2dcc48),_0x2f448b=_0x207239?.[_0x1b7b34(0xcd)](_0x4ffab6);if(_0x2f448b)return _0x4ef52a[_0x1b7b34(0x1af)](_0x55877f,_0x2f448b),_0x2f448b;const _0x1cce58=await _0xdf4d2e(_0x2dcc48,_0x59ec44[_0x1b7b34(0xeb)]),_0x53d04b={..._0x1cce58,..._0x2dcc48[_0x1b7b34(0x135)]!==undefined&&{'runAfterJourneyRefresh':_0x2dcc48[_0x1b7b34(0x135)]}},_0x4e652c=await _0x43feee[_0x1b7b34(0x129)]['createActivation'](_0x2b4e1c[_0x1b7b34(0x187)]['id'],_0x53d04b);return _0x4ef52a[_0x1b7b34(0x1af)](_0x55877f,_0x4e652c['id']),_0x4e652c['id'];}throw new SDKError(ErrorCode[_0x1b7b34(0xfb)],_0x1b7b34(0x143));},'resolveJourneyId':async _0x5d61f4=>{const _0x3ec5d3=_0x19f9f4;try{return await _0x43feee[_0x3ec5d3(0x129)][_0x3ec5d3(0x189)](_0x1be599[_0x3ec5d3(0x10b)],_0x5d61f4);}catch(_0x3be491){throw new SDKError(ErrorCode[_0x3ec5d3(0x186)],'Journey\x20\x27'+_0x5d61f4+_0x3ec5d3(0x15c)+_0x2b4e1c[_0x3ec5d3(0x199)][_0x3ec5d3(0x11b)]+'\x27)',_0x3be491);}},'resolveStageId':async(_0x14f45d,_0x5dd55b)=>{const _0x306fc6=_0x19f9f4,_0x5cb786=await _0x43feee[_0x306fc6(0x129)][_0x306fc6(0x101)](_0x14f45d),_0xa7eafb=_0x5cb786[_0x306fc6(0x138)][_0x306fc6(0x19f)][_0x306fc6(0x19a)](_0x116fb6=>_0x116fb6[_0x306fc6(0x11b)][_0x306fc6(0xb9)]()===_0x5dd55b[_0x306fc6(0xb9)]());if(!_0xa7eafb?.['id'])throw new SDKError(ErrorCode[_0x306fc6(0x186)],'Stage\x20\x27'+_0x5dd55b+_0x306fc6(0x10d)+(_0x5cb786['attributes'][_0x306fc6(0x172)]||_0x5cb786[_0x306fc6(0x138)]['name'])+'\x27');return _0xa7eafb['id'];}},_0x193479=await _0x2289f9(_0x2b4e1c[_0x19f9f4(0x199)],_0x1be599[_0x19f9f4(0x10b)],_0x26e035),_0x65611a=_0x1be599[_0x19f9f4(0xcf)]||_0x1be599[_0x19f9f4(0xfd)];_0x65611a&&(_0x193479[_0x19f9f4(0x181)]={'parentFolder':{'data':{'id':_0x65611a,'type':_0x19f9f4(0xf3)}}});if(_0x2b4e1c[_0x19f9f4(0x18c)]){if(_0x3d2210['size']>0x0||_0x480420['size']>0x0)return await executeThreeStepJourneyCreate(_0x43feee,_0x2b4e1c,_0x193479,{'pendingEmbeddedSegments':_0x3d2210,'pendingEmbeddedActivations':_0x480420,'embeddedSegmentNameToId':_0x1d337e,'journeyActivationNameToId':_0x4ef52a},{..._0x1be599,'effectiveFolderId':_0x65611a},_0x59ec44,_0x24fff3,_0x51c8a6);else{ensureJourneyDefaults(_0x193479[_0x19f9f4(0x138)]);const _0x40daea=await _0x43feee['journey']['create'](_0x193479);return deletePushRecovery(_0x2b4e1c[_0x19f9f4(0x147)]),{'action':'created','journeyId':_0x40daea['id'],'embeddedSegmentNameToId':_0x1d337e};}}else{if(_0x2b4e1c[_0x19f9f4(0xe6)]&&_0x2b4e1c[_0x19f9f4(0x187)]){_0x193479['id']=_0x2b4e1c[_0x19f9f4(0x187)]['id'];const _0x4f478e=_0x193479['attributes'];_0x2b4e1c[_0x19f9f4(0x187)][_0x19f9f4(0x138)]?.['journeyBundleName']&&(_0x4f478e[_0x19f9f4(0x172)]=_0x2b4e1c[_0x19f9f4(0x187)][_0x19f9f4(0x138)][_0x19f9f4(0x172)]);const _0x2faca7=_0x2b4e1c[_0x19f9f4(0x187)]['attributes']?.['journeyStages'];return _0x2faca7&&_0x193479[_0x19f9f4(0x138)][_0x19f9f4(0x19f)]&&injectExistingStageIds(_0x193479['attributes'][_0x19f9f4(0x19f)],_0x2faca7),ensureJourneyDefaults(_0x4f478e),await _0x43feee[_0x19f9f4(0x129)]['update'](_0x2b4e1c[_0x19f9f4(0x187)]['id'],_0x193479),deletePushRecovery(_0x2b4e1c[_0x19f9f4(0x147)]),{'action':_0x19f9f4(0x185),'journeyId':_0x2b4e1c['existingJourney']['id'],'embeddedSegmentNameToId':_0x1d337e};}}return deletePushRecovery(_0x2b4e1c['absolutePath']),{'action':_0x19f9f4(0xbf),'journeyId':_0x2b4e1c['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x1d337e};}function findSegmentCriteriaLocation(_0xe70f04,_0x595b68){const _0x3d6b1d=a152_0x54ab40,_0x4bcf7e=_0xe70f04[_0x3d6b1d(0x194)]||_0xe70f04[_0x3d6b1d(0xea)]?.[0x0]?.[_0x3d6b1d(0x194)]||[];let _0x4b3ebb=_0x3d6b1d(0x144),_0x323a38=_0x595b68;const _0x46e060=_0xe70f04[_0x3d6b1d(0x1ae)]||_0xe70f04[_0x3d6b1d(0xea)]?.[0x0]?.[_0x3d6b1d(0x1ae)];if(_0x46e060?.[_0x3d6b1d(0x1a7)]===_0x595b68)return{'stageName':_0x3d6b1d(0x1ae),'criteriaName':_0x46e060[_0x3d6b1d(0x11b)]||_0x595b68};_0x44180b:for(const _0x265853 of _0x4bcf7e){if(_0x265853[_0x3d6b1d(0xe7)]?.['segment']===_0x595b68){_0x4b3ebb=_0x265853[_0x3d6b1d(0x11b)],_0x323a38=_0x265853[_0x3d6b1d(0xe7)][_0x3d6b1d(0x11b)]||_0x595b68;break;}if(_0x265853[_0x3d6b1d(0x133)])for(const _0x36f669 of _0x265853[_0x3d6b1d(0x133)]){if(_0x36f669[_0x3d6b1d(0xb0)]===_0x3d6b1d(0x18f)&&_0x36f669['with']?.['branches'])for(const _0x30d935 of _0x36f669[_0x3d6b1d(0x152)]['branches']){if(_0x30d935['segment']===_0x595b68){_0x4b3ebb=_0x265853['name'],_0x323a38=_0x30d935[_0x3d6b1d(0x11b)]||_0x595b68;break _0x44180b;}}}}return{'stageName':_0x4b3ebb,'criteriaName':_0x323a38};}async function executeThreeStepJourneyCreate(_0x294e9b,_0x1ccf59,_0xc35cd4,_0x354251,_0xf214d,_0x5520a3,_0x1d7185,_0x48dcbd){const _0x42f717=a152_0x54ab40,{activationDefToCreateRequest:_0x17faa8,yamlRuleToApi:_0x22bd0d}=_0x48dcbd,{pendingEmbeddedSegments:_0x2b7eb3,pendingEmbeddedActivations:_0x299dea,embeddedSegmentNameToId:_0x440dec}=_0x354251,_0x4a8336=JSON[_0x42f717(0x18d)](JSON[_0x42f717(0xf7)](_0xc35cd4));ensureJourneyDefaults(_0x4a8336[_0x42f717(0x138)]),stripPendingIds(_0x4a8336);const _0x1b9d21=await _0x294e9b[_0x42f717(0x129)][_0x42f717(0x105)](_0x4a8336),_0x4686f4=_0x1b9d21['id'],_0x4fedad=new Map();for(const _0x4d5566 of _0x1b9d21[_0x42f717(0x138)]['journeyStages']){_0x4fedad[_0x42f717(0x1af)](_0x4d5566['name']['toLowerCase'](),_0x4d5566['id']);}recoverSegmentIdsFromPushRecovery(_0x1ccf59,_0x440dec,_0x5520a3[_0x42f717(0xe9)]);for(const [_0x2dad84,{definition:_0x4f4d52}]of _0x2b7eb3){if(_0x440dec[_0x42f717(0x12a)](_0x2dad84)){_0x1d7185[_0x42f717(0x139)]?.({'type':'embedded_segment_created','journeyName':_0x1ccf59[_0x42f717(0x199)]['name'],'segmentName':_0x2dad84});continue;}const _0x46d3bd=generateDeterministicJourneySegmentName(_0x1ccf59['yamlConfig'][_0x42f717(0x11b)],_0x2dad84);_0x1d7185[_0x42f717(0x139)]?.({'type':'embedded_segment_creating','journeyName':_0x1ccf59[_0x42f717(0x199)][_0x42f717(0x11b)],'segmentName':_0x2dad84});const _0x21fd50=createSegmentIdResolver(_0x5520a3[_0x42f717(0xe9)],_0x2dad84),_0x3f9153=await resolveRuleSegmentIds(_0x4f4d52[_0x42f717(0x193)],_0x21fd50),_0x175715=await createOrRecoverEmbeddedSegment(_0x294e9b,_0x1ccf59,{'localName':_0x2dad84,'uniqueSegmentName':_0x46d3bd,'description':_0x4f4d52['description']||_0x42f717(0x161)+_0x2dad84,'journeyId':_0x4686f4,'resolvedRule':_0x3f9153,'parentId':_0xf214d[_0x42f717(0x10b)],'folderId':_0xf214d['effectiveFolderId']||''},_0x22bd0d);_0x440dec[_0x42f717(0x1af)](_0x2dad84,_0x175715),_0x5520a3[_0x42f717(0xe9)][_0x42f717(0x1af)](_0x2dad84,_0x175715),_0x1d7185[_0x42f717(0x139)]?.({'type':_0x42f717(0xb5),'journeyName':_0x1ccf59['yamlConfig']['name'],'segmentName':_0x2dad84});}const _0x1dcc8d=new Map();for(const [_0x3ed746,_0x4d4567]of _0x299dea){_0x1d7185[_0x42f717(0x139)]?.({'type':_0x42f717(0x130),'journeyName':_0x1ccf59[_0x42f717(0x199)][_0x42f717(0x11b)],'activationName':_0x3ed746});const _0x470d9b=await _0x17faa8(_0x4d4567,_0x5520a3['activationContext']),_0x33d097={..._0x470d9b,..._0x4d4567[_0x42f717(0x135)]!==undefined&&{'runAfterJourneyRefresh':_0x4d4567[_0x42f717(0x135)]}},_0x4560c6=await _0x294e9b[_0x42f717(0x129)][_0x42f717(0x128)](_0x4686f4,_0x33d097);_0x1dcc8d[_0x42f717(0x1af)](_0x3ed746,_0x4560c6['id']),_0x354251[_0x42f717(0x131)][_0x42f717(0x1af)](_0x3ed746,_0x4560c6['id']),_0x1d7185['onProgress']?.({'type':_0x42f717(0x141),'journeyName':_0x1ccf59[_0x42f717(0x199)]['name'],'activationName':_0x3ed746});}const _0x3265a4=JSON[_0x42f717(0x18d)](JSON[_0x42f717(0xf7)](_0xc35cd4));return _0x3265a4['id']=_0x4686f4,ensureJourneyDefaults(_0x3265a4[_0x42f717(0x138)]),resolvePendingIdsInRequest(_0x3265a4,_0xc35cd4,_0x4fedad,_0x440dec,_0x1dcc8d,_0x1d7185),await _0x294e9b['journey'][_0x42f717(0x1a9)](_0x4686f4,_0x3265a4),deletePushRecovery(_0x1ccf59['absolutePath']),{'action':_0x42f717(0x14c),'journeyId':_0x4686f4,'embeddedSegmentNameToId':_0x440dec};}export function stripWaitStepPendingIds(_0x358baf){const _0x2ead4f=a152_0x54ab40,_0x3be27b=_0x358baf[_0x2ead4f(0x118)]&&isPendingSegmentId(_0x358baf[_0x2ead4f(0x118)]),_0x3c3a28=_0x358baf[_0x2ead4f(0xb1)]?.['some'](_0x36175f=>_0x36175f[_0x2ead4f(0x15e)]&&isPendingSegmentId(_0x36175f['segmentId']));(_0x3be27b||_0x3c3a28)&&(_0x358baf[_0x2ead4f(0x1a6)]=_0x2ead4f(0x167),_0x358baf[_0x2ead4f(0xf0)]=0x1,_0x358baf[_0x2ead4f(0xef)]=_0x2ead4f(0x108),delete _0x358baf[_0x2ead4f(0x118)],delete _0x358baf[_0x2ead4f(0x12f)],delete _0x358baf['conditionTimeoutUnit'],delete _0x358baf[_0x2ead4f(0xb1)]);}export function resolveWaitStepPendingIds(_0x14a028,_0x4bc027,_0xc2cc57,_0x3bfa54){const _0x511872=a152_0x54ab40;if(_0x4bc027[_0x511872(0x118)]&&isPendingSegmentId(_0x4bc027[_0x511872(0x118)])){const _0x18f128=_0xc2cc57(_0x4bc027[_0x511872(0x118)],'stage\x20\x27'+_0x3bfa54+'\x27\x20wait\x20condition');_0x18f128&&(_0x14a028[_0x511872(0x1a6)]='Condition',_0x14a028[_0x511872(0x118)]=_0x18f128,delete _0x14a028['waitStep'],delete _0x14a028[_0x511872(0xef)],_0x4bc027[_0x511872(0x12f)]!==undefined&&(_0x14a028['conditionTimeoutDuration']=_0x4bc027['conditionTimeoutDuration']),_0x4bc027['conditionTimeoutUnit']&&(_0x14a028['conditionTimeoutUnit']=_0x4bc027[_0x511872(0x178)]));}if(_0x4bc027[_0x511872(0xb1)]){const _0x2a9d1=_0x4bc027[_0x511872(0xb1)][_0x511872(0xaf)](_0x281d1c=>_0x281d1c[_0x511872(0x15e)]&&isPendingSegmentId(_0x281d1c[_0x511872(0x15e)]));if(_0x2a9d1){const _0x11c4da=_0x4bc027[_0x511872(0xb1)][_0x511872(0x169)](_0x483f1d=>{const _0x395127=_0x511872;if(_0x483f1d[_0x395127(0x15e)]&&isPendingSegmentId(_0x483f1d[_0x395127(0x15e)])){const _0x239034=_0xc2cc57(_0x483f1d[_0x395127(0x15e)],_0x395127(0xe4)+_0x3bfa54+_0x395127(0x10e));return{..._0x483f1d,'segmentId':_0x239034||_0x483f1d[_0x395127(0x15e)]};}return{..._0x483f1d};});_0x14a028[_0x511872(0x1a6)]=_0x511872(0x11e),_0x14a028[_0x511872(0xb1)]=_0x11c4da,delete _0x14a028[_0x511872(0xf0)],delete _0x14a028[_0x511872(0xef)],delete _0x14a028[_0x511872(0x118)],delete _0x14a028[_0x511872(0x12f)],delete _0x14a028['conditionTimeoutUnit'];}}}function stripPendingIds(_0x2db73d){const _0x54a7b9=a152_0x54ab40;_0x2db73d[_0x54a7b9(0x138)][_0x54a7b9(0x1ae)]?.[_0x54a7b9(0x15e)]&&isPendingSegmentId(_0x2db73d[_0x54a7b9(0x138)][_0x54a7b9(0x1ae)][_0x54a7b9(0x15e)])&&delete _0x2db73d[_0x54a7b9(0x138)][_0x54a7b9(0x1ae)];for(const _0x55395b of _0x2db73d[_0x54a7b9(0x138)][_0x54a7b9(0x19f)]||[]){_0x55395b[_0x54a7b9(0x190)]?.[_0x54a7b9(0x15e)]&&isPendingSegmentId(_0x55395b[_0x54a7b9(0x190)][_0x54a7b9(0x15e)])&&delete _0x55395b['entryCriteria'];_0x55395b['milestone']?.[_0x54a7b9(0x15e)]&&isPendingSegmentId(_0x55395b[_0x54a7b9(0xe3)][_0x54a7b9(0x15e)])&&delete _0x55395b[_0x54a7b9(0xe3)];_0x55395b[_0x54a7b9(0x19c)]&&(_0x55395b['exitCriterias']=_0x55395b[_0x54a7b9(0x19c)][_0x54a7b9(0x175)](_0x3ad323=>!_0x3ad323[_0x54a7b9(0x15e)]||!isPendingSegmentId(_0x3ad323[_0x54a7b9(0x15e)])));if(_0x55395b[_0x54a7b9(0x133)])for(const _0x283902 of Object[_0x54a7b9(0x164)](_0x55395b[_0x54a7b9(0x133)])){const _0x2e263e=_0x55395b[_0x54a7b9(0x133)][_0x283902];_0x2e263e[_0x54a7b9(0xb0)]===_0x54a7b9(0xee)&&_0x2e263e[_0x54a7b9(0x1a8)]&&isPendingActivationId(_0x2e263e[_0x54a7b9(0x1a8)])&&(_0x2e263e[_0x54a7b9(0x1a8)]='');if(_0x2e263e['type']==='DecisionPoint'&&_0x2e263e[_0x54a7b9(0x154)])for(const _0x3b1411 of _0x2e263e[_0x54a7b9(0x154)]){_0x3b1411[_0x54a7b9(0x15e)]&&isPendingSegmentId(_0x3b1411[_0x54a7b9(0x15e)])&&(_0x3b1411[_0x54a7b9(0x15e)]='');}_0x2e263e[_0x54a7b9(0xb0)]===_0x54a7b9(0x13d)&&stripWaitStepPendingIds(_0x2e263e);}}}function resolvePendingIdsInRequest(_0x4247ce,_0x630af5,_0x49937a,_0x43104b,_0x5adfa7,_0x221a04){const _0x5a6ff2=a152_0x54ab40,_0x5574f5=(_0x4d7bf7,_0x148f8a)=>{const _0x452150=a152_0x1cc0;if(!isPendingSegmentId(_0x4d7bf7))return _0x4d7bf7;const _0x1afd63=extractPendingSegmentName(_0x4d7bf7),_0x10899f=_0x43104b['get'](_0x1afd63);return!_0x10899f&&_0x221a04[_0x452150(0x145)]?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x1afd63+'\x27\x20for\x20'+_0x148f8a),_0x10899f;};if(_0x4247ce[_0x5a6ff2(0x138)]['goal']?.[_0x5a6ff2(0x15e)]&&isPendingSegmentId(_0x4247ce[_0x5a6ff2(0x138)][_0x5a6ff2(0x1ae)][_0x5a6ff2(0x15e)])){const _0x199266=_0x5574f5(_0x4247ce['attributes'][_0x5a6ff2(0x1ae)][_0x5a6ff2(0x15e)],_0x5a6ff2(0x1ab));_0x199266&&(_0x4247ce[_0x5a6ff2(0x138)]['goal'][_0x5a6ff2(0x15e)]=_0x199266);}for(const _0x4c57e5 of _0x4247ce[_0x5a6ff2(0x138)][_0x5a6ff2(0x19f)]||[]){const _0x1f3ce2=_0x49937a[_0x5a6ff2(0xcd)](_0x4c57e5[_0x5a6ff2(0x11b)][_0x5a6ff2(0xb9)]());_0x1f3ce2&&(_0x4c57e5['id']=_0x1f3ce2);if(_0x4c57e5[_0x5a6ff2(0x190)]?.[_0x5a6ff2(0x15e)]&&isPendingSegmentId(_0x4c57e5['entryCriteria'][_0x5a6ff2(0x15e)])){const _0x110110=_0x5574f5(_0x4c57e5['entryCriteria'][_0x5a6ff2(0x15e)],'stage\x20\x27'+_0x4c57e5[_0x5a6ff2(0x11b)]+_0x5a6ff2(0xf5));_0x110110&&(_0x4c57e5['entryCriteria'][_0x5a6ff2(0x15e)]=_0x110110);}if(_0x4c57e5[_0x5a6ff2(0x19c)])for(const _0x47f123 of _0x4c57e5[_0x5a6ff2(0x19c)]){if(_0x47f123[_0x5a6ff2(0x15e)]&&isPendingSegmentId(_0x47f123[_0x5a6ff2(0x15e)])){const _0x2ff90a=_0x5574f5(_0x47f123[_0x5a6ff2(0x15e)],_0x5a6ff2(0xe4)+_0x4c57e5[_0x5a6ff2(0x11b)]+_0x5a6ff2(0x11d));_0x2ff90a&&(_0x47f123['segmentId']=_0x2ff90a);}}if(_0x4c57e5[_0x5a6ff2(0xe3)]?.[_0x5a6ff2(0x15e)]&&isPendingSegmentId(_0x4c57e5[_0x5a6ff2(0xe3)][_0x5a6ff2(0x15e)])){const _0x256c1c=_0x5574f5(_0x4c57e5['milestone'][_0x5a6ff2(0x15e)],_0x5a6ff2(0xe4)+_0x4c57e5[_0x5a6ff2(0x11b)]+_0x5a6ff2(0x122));_0x256c1c&&(_0x4c57e5['milestone'][_0x5a6ff2(0x15e)]=_0x256c1c);}if(_0x4c57e5[_0x5a6ff2(0x133)]){const _0x277d66=_0x530418=>_0x630af5['attributes'][_0x5a6ff2(0x19f)]?.['find'](_0x1fec89=>_0x1fec89[_0x5a6ff2(0x11b)][_0x5a6ff2(0xb9)]()===_0x4c57e5[_0x5a6ff2(0x11b)][_0x5a6ff2(0xb9)]())?.['steps']?.[_0x530418];for(const _0x3706f7 of Object[_0x5a6ff2(0x164)](_0x4c57e5[_0x5a6ff2(0x133)])){const _0x2c2ad2=_0x4c57e5[_0x5a6ff2(0x133)][_0x3706f7],_0x3ae0b4=_0x277d66(_0x3706f7);if(_0x2c2ad2[_0x5a6ff2(0xb0)]===_0x5a6ff2(0xee)&&_0x2c2ad2[_0x5a6ff2(0x1a8)]&&(isPendingActivationId(_0x2c2ad2[_0x5a6ff2(0x1a8)])||_0x2c2ad2['journeyActivationStepId']==='')){if(_0x3ae0b4?.[_0x5a6ff2(0x1a8)]&&isPendingActivationId(_0x3ae0b4[_0x5a6ff2(0x1a8)])){const _0x7eb8b4=extractPendingActivationName(_0x3ae0b4[_0x5a6ff2(0x1a8)]),_0x1e57ae=_0x5adfa7['get'](_0x7eb8b4);_0x1e57ae&&(_0x2c2ad2['journeyActivationStepId']=_0x1e57ae);}}if(_0x2c2ad2[_0x5a6ff2(0xb0)]===_0x5a6ff2(0x17f)&&_0x2c2ad2[_0x5a6ff2(0x154)]&&_0x3ae0b4?.[_0x5a6ff2(0x154)])for(let _0x1bad1a=0x0;_0x1bad1a<_0x2c2ad2[_0x5a6ff2(0x154)]['length'];_0x1bad1a++){const _0x4d281f=_0x2c2ad2[_0x5a6ff2(0x154)][_0x1bad1a],_0x30ee77=_0x3ae0b4[_0x5a6ff2(0x154)][_0x1bad1a];if(_0x30ee77?.['segmentId']&&isPendingSegmentId(_0x30ee77[_0x5a6ff2(0x15e)])){const _0x1a782e=_0x5574f5(_0x30ee77['segmentId'],_0x5a6ff2(0xe4)+_0x4c57e5[_0x5a6ff2(0x11b)]+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x4d281f[_0x5a6ff2(0x11b)]||_0x1bad1a)+'\x27');_0x1a782e&&(_0x4d281f[_0x5a6ff2(0x15e)]=_0x1a782e);}}_0x2c2ad2[_0x5a6ff2(0xb0)]===_0x5a6ff2(0x13d)&&_0x3ae0b4?.[_0x5a6ff2(0xb0)]===_0x5a6ff2(0x13d)&&resolveWaitStepPendingIds(_0x2c2ad2,_0x3ae0b4,_0x5574f5,_0x4c57e5[_0x5a6ff2(0x11b)]);}}}}
1
+ const a152_0x525dc2=a152_0x4bae;(function(_0x563ae7,_0x57a99a){const _0x1219f1=a152_0x4bae,_0x3f8ffc=_0x563ae7();while(!![]){try{const _0x2510f7=-parseInt(_0x1219f1(0x282))/0x1+parseInt(_0x1219f1(0x1c6))/0x2+-parseInt(_0x1219f1(0x23b))/0x3*(-parseInt(_0x1219f1(0x24f))/0x4)+parseInt(_0x1219f1(0x23d))/0x5*(-parseInt(_0x1219f1(0x1cb))/0x6)+parseInt(_0x1219f1(0x2a3))/0x7+-parseInt(_0x1219f1(0x25f))/0x8+parseInt(_0x1219f1(0x2a0))/0x9;if(_0x2510f7===_0x57a99a)break;else _0x3f8ffc['push'](_0x3f8ffc['shift']());}catch(_0xacf3c){_0x3f8ffc['push'](_0x3f8ffc['shift']());}}}(a152_0x2599,0x27631));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x525dc2(0x1f1));export const PENDING_SEGMENT_PREFIX='__pending_';export const PENDING_ACTIVATION_PREFIX=a152_0x525dc2(0x2a1);export function createPendingSegmentId(_0x531fde){return''+PENDING_SEGMENT_PREFIX+_0x531fde+'__';}export function isPendingSegmentId(_0x2336c8){const _0x1807b1=a152_0x525dc2;return _0x2336c8[_0x1807b1(0x242)](PENDING_SEGMENT_PREFIX)&&!_0x2336c8[_0x1807b1(0x242)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x3786c2){const _0x49c1e3=a152_0x525dc2;return _0x3786c2[_0x49c1e3(0x1ed)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x1040a8){return''+PENDING_ACTIVATION_PREFIX+_0x1040a8+'__';}export function isPendingActivationId(_0x3d911e){const _0x2c6277=a152_0x525dc2;return _0x3d911e[_0x2c6277(0x242)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x48d0e){const _0x382b97=a152_0x525dc2;return _0x48d0e[_0x382b97(0x1ed)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x3db450,_0x1637b9){const _0x5677ba=a152_0x525dc2,_0x91bcca=_0x3db450+'::'+(_0x1637b9[_0x5677ba(0x20e)]()||_0x5677ba(0x283)),_0x11de40=createHash(_0x5677ba(0x230))[_0x5677ba(0x1d9)](_0x91bcca)[_0x5677ba(0x26d)](_0x5677ba(0x24b))['slice'](0x0,0xc);return'journey_entry_criteria_'+_0x11de40;}export function ensureJourneyDefaults(_0x5ab821){const _0x4f9fcc=a152_0x525dc2;!_0x5ab821[_0x4f9fcc(0x206)]&&(_0x5ab821['description']=''),!_0x5ab821['state']&&(_0x5ab821['state']='draft');}export function injectExistingStageIds(_0x280ce2,_0x4717a5){const _0x1fedc6=a152_0x525dc2,_0x45fe3e=new Map(_0x4717a5[_0x1fedc6(0x237)](_0x4d454a=>[_0x4d454a[_0x1fedc6(0x1f7)],_0x4d454a['id']]));for(const _0x231e11 of _0x280ce2){if(!_0x231e11['id']){const _0x358212=_0x45fe3e[_0x1fedc6(0x21c)](_0x231e11[_0x1fedc6(0x1f7)]);_0x358212&&(_0x231e11['id']=_0x358212);}}}export function resolveTDFolderPath(_0x2adff6,_0x517583,_0x4e8ee8){const _0x3fed2a=a152_0x525dc2;if(!_0x517583)return _0x2adff6;if(_0x2adff6===_0x4e8ee8||_0x2adff6[_0x3fed2a(0x242)](_0x4e8ee8+'/'))return _0x2adff6;return _0x2adff6?_0x4e8ee8+'/'+_0x2adff6:_0x4e8ee8;}export function addFoldersToCreate(_0x4b3b9d,_0x3bf556,_0x53263d){const _0x155b14=a152_0x525dc2;if(!_0x4b3b9d)return;if(_0x3bf556[_0x155b14(0x23a)](_0x4b3b9d))return;const _0x8d6eb6=_0x4b3b9d[_0x155b14(0x269)]('/');let _0x5e9ac1='';for(const _0x12f48e of _0x8d6eb6){_0x5e9ac1=_0x5e9ac1?_0x5e9ac1+'/'+_0x12f48e:_0x12f48e,!_0x3bf556[_0x155b14(0x23a)](_0x5e9ac1)&&_0x53263d[_0x155b14(0x1f6)](_0x5e9ac1);}}export function sortFoldersByDepth(_0x4e9091){const _0x3b2794=a152_0x525dc2;return[..._0x4e9091][_0x3b2794(0x1b6)]((_0x5df8e9,_0x19df1c)=>{const _0x1afe19=_0x3b2794,_0x38e3c4=(_0x5df8e9[_0x1afe19(0x1ab)](/\//g)||[])['length'],_0x14396d=(_0x19df1c[_0x1afe19(0x1ab)](/\//g)||[])[_0x1afe19(0x1b9)];return _0x38e3c4-_0x14396d;});}import*as a152_0x103244 from'yaml';import{readFileSync}from'fs';import a152_0x493fd4 from'path';import{isJourneyDef,parseYamlString as a152_0x412f63,toYamlString as a152_0x111a4b,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(_0x32a1c6){const _0xb32d1d=a152_0x525dc2;if(Array['isArray'](_0x32a1c6))return'['+_0x32a1c6[_0xb32d1d(0x237)](_0x6c334c=>stableStringify(_0x6c334c))['join'](',')+']';if(_0x32a1c6&&typeof _0x32a1c6===_0xb32d1d(0x215)){const _0x12cc8e=_0x32a1c6,_0x5cc2d4=Object[_0xb32d1d(0x255)](_0x12cc8e)[_0xb32d1d(0x1b6)](),_0x25de25=_0x5cc2d4[_0xb32d1d(0x237)](_0x269a46=>'\x22'+_0x269a46+'\x22:'+stableStringify(_0x12cc8e[_0x269a46]));return'{'+_0x25de25[_0xb32d1d(0x1ef)](',')+'}';}const _0x3edb46=JSON['stringify'](_0x32a1c6);return _0x3edb46===undefined?_0xb32d1d(0x28a):_0x3edb46;}function activationSignature(_0x8025b3){const _0x4a84fe=a152_0x525dc2,_0x8919fa={'connection':_0x8025b3['connection'],..._0x8025b3[_0x4a84fe(0x26c)]!==undefined&&{'all_columns':_0x8025b3['all_columns']},..._0x8025b3[_0x4a84fe(0x1e0)]!==undefined&&{'columns':_0x8025b3[_0x4a84fe(0x1e0)]},..._0x8025b3[_0x4a84fe(0x1e8)]!==undefined&&{'behavior':_0x8025b3[_0x4a84fe(0x1e8)]},..._0x8025b3[_0x4a84fe(0x217)]!==undefined&&{'schedule':_0x8025b3[_0x4a84fe(0x217)]},..._0x8025b3[_0x4a84fe(0x1e7)]!==undefined&&{'notification':_0x8025b3[_0x4a84fe(0x1e7)]},..._0x8025b3[_0x4a84fe(0x20f)]!==undefined&&{'connector_config':_0x8025b3[_0x4a84fe(0x20f)]},..._0x8025b3['activation_template_id']!==undefined&&{'activation_template_id':_0x8025b3[_0x4a84fe(0x29e)]}};return stableStringify(_0x8919fa);}async function fetchSegment(_0x2af725,_0x2d0f16,_0x28d3d8,_0x2ed589){const _0x520e9f=a152_0x525dc2,_0x500661=_0x2ed589?.[_0x520e9f(0x1c8)](_0x20e4da=>_0x20e4da['id']===_0x28d3d8);if(_0x500661)return _0x500661;try{return await _0x2af725[_0x520e9f(0x283)][_0x520e9f(0x28f)](_0x2d0f16,_0x28d3d8);}catch(_0x4c1692){logger[_0x520e9f(0x1af)](_0x520e9f(0x270)+_0x28d3d8+_0x520e9f(0x1f5)+_0x4c1692);try{return await _0x2af725[_0x520e9f(0x283)][_0x520e9f(0x1de)](_0x28d3d8);}catch(_0x27d707){return logger[_0x520e9f(0x1af)]('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x28d3d8+':\x20'+_0x27d707),null;}}}function recoverSegmentIdsFromPushRecovery(_0xbe5d87,_0x41ee05,_0x542be1){const _0x543a49=a152_0x525dc2,_0x181d63=readPushRecovery(_0xbe5d87[_0x543a49(0x224)]);if(_0x181d63?.['journeyName']===_0xbe5d87[_0x543a49(0x220)][_0x543a49(0x1f7)])for(const [_0xc66e49,_0x5365d1]of Object['entries'](_0x181d63[_0x543a49(0x286)])){const _0x18a8e3=generateDeterministicJourneySegmentName(_0xbe5d87['yamlConfig'][_0x543a49(0x1f7)],_0xc66e49);_0x5365d1[_0x543a49(0x1fe)]===_0x18a8e3&&(_0x41ee05[_0x543a49(0x1b0)](_0xc66e49,_0x5365d1[_0x543a49(0x23c)]),_0x542be1[_0x543a49(0x1b0)](_0xc66e49,_0x5365d1[_0x543a49(0x23c)]));}}async function createOrRecoverEmbeddedSegment(_0x25680d,_0x16e36e,_0xdf3e81,_0x23f86a){const _0x513caf=a152_0x525dc2;let _0x4e6a10;try{_0x4e6a10=await _0x25680d['segment'][_0x513caf(0x259)]({'name':_0xdf3e81[_0x513caf(0x233)],'description':_0xdf3e81['description'],'journeyId':_0xdf3e81[_0x513caf(0x27c)],'rule':_0x23f86a(_0xdf3e81[_0x513caf(0x280)],!![]),'countPopulation':!![],'parentFolderId':_0xdf3e81[_0x513caf(0x1e6)],'audienceId':_0xdf3e81[_0x513caf(0x265)]});}catch(_0x39bdaa){const _0x185e74=_0x39bdaa instanceof Error&&_0x39bdaa[_0x513caf(0x1dc)]['includes'](_0x513caf(0x240));if(_0x185e74){const _0x66d761=readPushRecovery(_0x16e36e['absolutePath']),_0x433115=_0x66d761?.[_0x513caf(0x297)]===_0x16e36e[_0x513caf(0x220)][_0x513caf(0x1f7)]?_0x66d761['segments'][_0xdf3e81[_0x513caf(0x24c)]]:undefined;if(_0x433115?.['uniqueServerName']===_0xdf3e81[_0x513caf(0x233)])await _0x25680d['segment'][_0x513caf(0x294)](_0xdf3e81[_0x513caf(0x265)],_0x433115[_0x513caf(0x23c)],{'description':_0xdf3e81[_0x513caf(0x206)],'rule':_0x23f86a(_0xdf3e81[_0x513caf(0x280)],!![]),'countPopulation':!![]}),_0x4e6a10=_0x433115[_0x513caf(0x23c)];else throw new SDKError(ErrorCode[_0x513caf(0x281)],_0x513caf(0x1df)+_0xdf3e81[_0x513caf(0x24c)]+_0x513caf(0x292)+(_0x513caf(0x293)+_0x16e36e[_0x513caf(0x224)][_0x513caf(0x1ed)](/([^/]+)$/,'.$1.push-recovery.json')+')\x20')+_0x513caf(0x21a),_0x39bdaa);}else throw _0x39bdaa;}return saveSegmentToPushRecovery(_0x16e36e[_0x513caf(0x224)],_0x16e36e[_0x513caf(0x220)][_0x513caf(0x1f7)],_0xdf3e81[_0x513caf(0x24c)],{'segmentId':_0x4e6a10,'uniqueServerName':_0xdf3e81[_0x513caf(0x233)],'createdAt':new Date()[_0x513caf(0x1dd)]()}),_0x4e6a10;}export async function prepareSegmentFiles(_0x53c2a6,_0x35aff8,_0x25e092,_0x1bd19d,_0x5c36d4){const _0x4b7adb=a152_0x525dc2,{activationDefToCreateRequest:_0x46f14e}=await import(_0x4b7adb(0x1bc)),_0x15b430=[],_0x2dd2a8=new Set();for(const {yamlConfig:_0x5c05e4,folderPath:_0x322695,sourcePath:_0x3a50be}of _0x53c2a6){const _0x4f0fae=resolveTDFolderPath(_0x322695,_0x1bd19d,_0x5c36d4),_0x1e5c5a=_0x4f0fae+':'+_0x5c05e4[_0x4b7adb(0x1f7)],_0x7b5033=_0x35aff8[_0x4b7adb(0x1c9)][_0x4b7adb(0x21c)](_0x1e5c5a),_0x586e3=_0x7b5033?_0x35aff8[_0x4b7adb(0x1c5)][_0x4b7adb(0x21c)](_0x7b5033['id'])||[]:[];addFoldersToCreate(_0x4f0fae,_0x35aff8[_0x4b7adb(0x222)],_0x2dd2a8);const _0x3d82be=calculateActivationActions(_0x5c05e4['activations']||[],_0x586e3,_0x35aff8[_0x4b7adb(0x200)],_0x35aff8[_0x4b7adb(0x2a7)]);for(const _0x2b1cbe of _0x3d82be){(_0x2b1cbe['type']===_0x4b7adb(0x249)||_0x2b1cbe[_0x4b7adb(0x2a5)]===_0x4b7adb(0x1d9))&&_0x2b1cbe['yamlActivation']&&(_0x2b1cbe[_0x4b7adb(0x1f2)]=await _0x46f14e(_0x2b1cbe[_0x4b7adb(0x203)],_0x25e092));}const _0xe11d26=calculateSegmentDiff(_0x5c05e4,_0x7b5033,_0x586e3,_0x35aff8['idToEmailMap'],_0x35aff8[_0x4b7adb(0x2a7)]);_0x15b430[_0x4b7adb(0x1be)]({'relativePath':_0x5c05e4[_0x4b7adb(0x1f7)],'absolutePath':_0x3a50be,'yamlConfig':_0x5c05e4,'folderPath':_0x4f0fae,'existingSegment':_0x7b5033,'existingActivations':_0x586e3,'isNew':_0xe11d26['isNew'],'hasChanges':_0xe11d26['hasChanges'],'diff':_0xe11d26[_0x4b7adb(0x23e)],'activationActions':_0x3d82be});}return{'segmentFiles':_0x15b430,'foldersToCreate':_0x2dd2a8};}export async function prepareJourneyFiles(_0x304583,_0xae5da1,_0xb369d0,_0x5e437b){const _0x1bb547=a152_0x525dc2,_0x2f86b1=[],_0x320d35=new Set();for(const {yamlConfig:_0x5bb8c9,folderPath:_0x554f70,sourcePath:_0x4ff51b}of _0x304583){const _0x31495a=resolveTDFolderPath(_0x554f70,_0xb369d0,_0x5e437b),_0x26b2cd=_0x31495a+':'+_0x5bb8c9['name'],_0x431f0e=_0xae5da1[_0x1bb547(0x25b)][_0x1bb547(0x21c)](_0x26b2cd);let _0x5de921,_0x40e5fc;if(_0x431f0e&&_0x431f0e[_0x1bb547(0x1b9)]>0x0){const _0x363bc3=buildLocalExpandedRuleMappings(_0x5bb8c9),{createYamlContext:_0xc5fc23,prefetchJourneySegments:_0x218f52}=createPushYamlContextForBundle(_0xae5da1[_0x1bb547(0x20a)],_0xae5da1[_0x1bb547(0x265)],_0xae5da1[_0x1bb547(0x1b1)],_0x363bc3,_0xae5da1[_0x1bb547(0x200)],_0xae5da1[_0x1bb547(0x2a7)],_0xae5da1[_0x1bb547(0x1d3)],_0xae5da1['journeyById']);await _0x218f52(_0x431f0e[_0x1bb547(0x237)](_0x192cdd=>_0x192cdd['id']));const _0x57dd41=await _0xae5da1['deps'][_0x1bb547(0x262)][_0x1bb547(0x275)](_0x431f0e[0x0][_0x1bb547(0x24e)]),_0x5d63e8=hasMultipleVersions(_0x5bb8c9),_0x286eab=async _0x2c460b=>{const _0x292fd3=_0x1bb547,_0x1a63e4=_0xae5da1[_0x292fd3(0x264)]?.[_0x292fd3(0x21c)](_0x2c460b);if(_0x1a63e4)return _0x1a63e4;return _0xae5da1['fetchJourney']({'journeyId':_0x2c460b,'journeyName':_0x5bb8c9['name'],'isMultiVersion':_0x431f0e[_0x292fd3(0x1b9)]>0x1});};if(_0x5d63e8&&_0x431f0e[_0x1bb547(0x1b9)]>0x1){const _0xbcdbb2=[];for(const _0x2b6a12 of _0x431f0e){const _0x4a47a8=_0x2b6a12['versionNumber']||0x1;_0xae5da1[_0x1bb547(0x1ec)]?.['update']('Fetching\x20'+_0x5bb8c9[_0x1bb547(0x1f7)]+'\x20v'+_0x4a47a8);const _0x30b239=await _0x286eab(_0x2b6a12['id']),_0x3d7283=_0xc5fc23(_0x2b6a12['id']),_0x4f618d=await journeyResponseToDef(_0x30b239,_0x3d7283);_0xbcdbb2[_0x1bb547(0x1be)]({'item':_0x2b6a12,'yaml':_0x4f618d});}const _0x3accd5=buildLocalRuleToNameMappingFromJourney(_0x5bb8c9);_0x40e5fc=buildMergedJourneyDef(_0xbcdbb2,_0x3accd5,_0x57dd41);const _0x42e46c=Math[_0x1bb547(0x295)](..._0xbcdbb2[_0x1bb547(0x237)](_0xfad7e3=>_0xfad7e3[_0x1bb547(0x299)][_0x1bb547(0x1f4)]||0x0)),_0x25007d=_0x431f0e['find'](_0xfcdfb3=>(_0xfcdfb3['versionNumber']||0x0)===_0x42e46c);_0x25007d&&(_0xae5da1[_0x1bb547(0x1ec)]?.[_0x1bb547(0x1d9)]('Fetching\x20'+_0x5bb8c9[_0x1bb547(0x1f7)]+'\x20v'+_0x42e46c),_0x5de921=await _0x286eab(_0x25007d['id']));}else{const _0x2af32a=_0x431f0e[_0x431f0e[_0x1bb547(0x1b9)]-0x1];_0xae5da1[_0x1bb547(0x1ec)]?.['update']('Fetching\x20'+_0x5bb8c9[_0x1bb547(0x1f7)]),_0x5de921=await _0x286eab(_0x2af32a['id']);const _0x219d90=_0xc5fc23(_0x2af32a['id']),_0xe1acfd=await journeyResponseToDef(_0x5de921,_0x219d90),_0x2b517f=buildLocalRuleToNameMappingFromJourney(_0x5bb8c9);_0x40e5fc=buildMergedJourneyDef([{'item':_0x2af32a,'yaml':_0xe1acfd}],_0x2b517f,_0x57dd41);}}addFoldersToCreate(_0x31495a,_0xae5da1[_0x1bb547(0x222)],_0x320d35);const _0xa173c3=calculateJourneyDiff(_0x5bb8c9,_0x40e5fc);_0x2f86b1[_0x1bb547(0x1be)]({'relativePath':_0x5bb8c9['name'],'absolutePath':_0x4ff51b,'yamlConfig':_0x5bb8c9,'folderPath':_0x31495a,'existingJourney':_0x5de921,'isNew':_0xa173c3[_0x1bb547(0x254)],'hasChanges':_0xa173c3[_0x1bb547(0x20c)],'diff':_0xa173c3[_0x1bb547(0x23e)]});}return{'journeyFiles':_0x2f86b1,'foldersToCreate':_0x320d35};}export function calculateActivationActions(_0xfa3236,_0x3dbd08,_0x5c8b2b,_0x580e38){const _0x2888a7=a152_0x525dc2,_0x270e5e=[],_0x19777d=new Map();for(const _0x285b67 of _0x3dbd08){_0x19777d[_0x2888a7(0x1b0)](_0x285b67[_0x2888a7(0x1f7)],_0x285b67);}const _0x1bc790=new Map();for(const _0x337487 of _0xfa3236){_0x1bc790[_0x2888a7(0x1b0)](_0x337487[_0x2888a7(0x1f7)],_0x337487);}for(const _0x2ce51a of _0xfa3236){const _0x14a486=_0x19777d[_0x2888a7(0x21c)](_0x2ce51a['name']);if(!_0x14a486)_0x270e5e[_0x2888a7(0x1be)]({'type':_0x2888a7(0x249),'name':_0x2ce51a[_0x2888a7(0x1f7)],'yamlActivation':_0x2ce51a});else{const _0x1f8472=activationResponseToDef(_0x14a486,_0x5c8b2b,_0x580e38),_0x11ee18=a152_0x103244[_0x2888a7(0x1ce)](_0x1f8472),_0x48c359=a152_0x103244['stringify'](_0x2ce51a);_0x11ee18!==_0x48c359&&_0x270e5e[_0x2888a7(0x1be)]({'type':'update','name':_0x2ce51a[_0x2888a7(0x1f7)],'yamlActivation':_0x2ce51a,'existingActivation':_0x14a486});}}for(const _0x44cb42 of _0x3dbd08){!_0x1bc790[_0x2888a7(0x23a)](_0x44cb42[_0x2888a7(0x1f7)])&&_0x270e5e['push']({'type':_0x2888a7(0x288),'name':_0x44cb42[_0x2888a7(0x1f7)],'existingActivation':_0x44cb42});}return _0x270e5e;}function calculateYamlDiff(_0x2617c4,_0x38cc18){if(_0x38cc18){const _0x274d86=generateDiff(_0x38cc18,_0x2617c4),_0x2d07bd=hasChanges(_0x274d86);return{'isNew':![],'hasChanges':_0x2d07bd,'diff':_0x2d07bd?formatDiffWithColors(_0x274d86):undefined};}const _0x5e45ab=generateDiff('',_0x2617c4);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x5e45ab)};}export function calculateSegmentDiff(_0x350089,_0x16114e,_0x45f0c7,_0x51db32,_0x2209d0){const _0x25e71d=segmentToYamlString(_0x350089),_0x1a5b1a=_0x16114e?segmentToYamlString(segmentWithActivationsToYaml(_0x16114e,_0x45f0c7,undefined,_0x51db32,_0x2209d0)):undefined;return calculateYamlDiff(_0x25e71d,_0x1a5b1a);}export function calculateJourneyDiff(_0x1442b7,_0x10f323){const _0x77b82e=normalizeJourneyDef(_0x1442b7,_0x1442b7),_0x210205=a152_0x111a4b(_0x77b82e),_0x1d8771=_0x10f323?a152_0x111a4b(normalizeJourneyDef(_0x10f323,_0x1442b7)):undefined;return calculateYamlDiff(_0x210205,_0x1d8771);}export function findSegmentsToDelete(_0x396e4d,_0x3a010f,_0x286b15,_0x5de637,_0x20238e){const _0x24f9a3=a152_0x525dc2,_0x100ac8=new Set();for(const {yamlConfig:_0x7ba628,folderPath:_0x584764}of _0x3a010f){_0x100ac8['add'](_0x584764+':'+_0x7ba628[_0x24f9a3(0x1f7)]);}return _0x396e4d['filter'](_0x2b1df0=>{const _0x292554=_0x24f9a3,_0x5a54c8=_0x2b1df0[_0x292554(0x1b2)]?_0x286b15[_0x292554(0x21c)](_0x2b1df0[_0x292554(0x1b2)][_0x292554(0x209)]())||'':'',_0x3388e2=_0x5a54c8+':'+_0x2b1df0[_0x292554(0x1f7)];if(_0x100ac8['has'](_0x3388e2))return![];if(_0x20238e)return _0x5a54c8===_0x5de637||_0x5a54c8[_0x292554(0x242)](_0x5de637+'/');return!![];});}export function findJourneysToDelete(_0x9301df,_0x426935,_0x12a30d,_0x1efb9e,_0x43e1cb){const _0x2774bd=a152_0x525dc2,_0x395f2a=new Set();for(const {yamlConfig:_0x4da0f3,folderPath:_0x1636a0}of _0x426935){_0x395f2a[_0x2774bd(0x1f6)](_0x1636a0+':'+_0x4da0f3[_0x2774bd(0x1f7)]);}return _0x9301df['filter'](_0x1c94f6=>{const _0x200bae=_0x2774bd,_0x11d840=_0x1c94f6['folderId']?_0x12a30d[_0x200bae(0x21c)](_0x1c94f6['folderId'])||'':'',_0x2272f0=_0x11d840+':'+_0x1c94f6[_0x200bae(0x279)];if(_0x395f2a[_0x200bae(0x23a)](_0x2272f0))return![];if(_0x43e1cb)return _0x11d840===_0x1efb9e||_0x11d840[_0x200bae(0x242)](_0x1efb9e+'/');return!![];});}function a152_0x2599(){const _0x498c12=['segmentByFolderAndName','Condition','30uqHlVk','journey_created','nameToId','stringify','resolveSegment','created','attributes','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','activationStepsById','activation_updated','Creating\x20segment\x20\x27','segment_deleted','activationContext','Segment\x20not\x20found:\x20','update','index','Created\x20activation\x20\x27','message','toISOString','getSegmentEntity','Embedded\x20segment\x20\x27','columns','updated','Creating\x20folder\x20\x27','connection','Created\x20journey\x20\x27','decision_point','folderId','notification','behavior','segment_creating','Failed\x20to\x20resolve\x20activation\x20','createActivation','progress','replace','branches','join','Journey\x20\x27','tdx.sdk.push-workflow','validatedRequest','relative','versionNumber',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','add','name','Failed\x20to\x20fetch\x20referenced\x20segment\x20','segment_updating','waitStep','\x27\x20exit\x20criteria','errors','\x20error(s)','uniqueServerName','withProgress','idToEmailMap','reduce','embedded_activation_created','yamlActivation','updateActivation','parseDocument','description','Duration','\x20activation\x20\x27','toString','deps','createdSegmentId','hasChanges','utf-8','trim','connector_config','JOURNEY_SYNTAX_ERROR','embeddedSegmentNameToId','conditionSegmentId','journeyActivationStepId','results','object','kind','schedule','existingActivation','\x27...','and\x20the\x20server\x20segment,\x20then\x20retry.','journey_updated','get','steps','Updating\x20activation\x20\x27','\x27\x20wait\x20condition','yamlConfig','dirname','folderPathToId','\x27\x20for\x20','absolutePath','\x27\x20from\x20file:\x20','list','conditions','action','Entry\x20criteria:\x20','folder','Updating\x20segment\x20\x27','exitCriterias','journey_creating','size','logDeleted','sha1','stage\x20\x27','from','uniqueSegmentName','Creating\x20activation\x20\x27','waitStepType','\x20journey\x20from\x20file:\x20','map','deleted','buildUserMaps','has','231jgukSa','segmentId','274465RxtFtb','diff','journeys','Name\x20has\x20already\x20been\x20taken','createSegment','startsWith','SEGMENT_NOT_FOUND','listActivations','logSuccess','Matched\x20server\x20segment\x20\x27','../../utils/async.js','existingSegment','create','goal','hex','localName','folder_creating','journeyBundleId','11972AxyAul','Activation','Failed\x20to\x20','run_after_journey_refresh','Deleted\x20activation\x20\x27','isNew','keys','getJourney','\x27\x20by\x20rule\x20content','Segment\x20not\x20found','createJourneySegment','DecisionPoint','journeyBundlesByFolderAndName','valid','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','data','974696fFPSWZ','embedded_segment_created','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','journey','):\x20','journeyById','parentId','\x0a\x20\x20','Stage\x20\x27','slice','split','WaitStep','activation_created','all_columns','digest','goal\x20criteria','journeyStages','getSegment\x20failed\x20for\x20','activations','some','activation_deleted','activation_creating','getLatestJourneyId','day','Updated\x20journey\x20\x27','\x20(referenced\x20in\x20journey\x20','journeyBundleName','verbose','SEGMENT_SYNTAX_ERROR','journeyId','ACTIVATION_UPDATE_ERROR','journey_updating','activation_updating','resolvedRule','SEGMENT_UPDATE_ERROR','108517KSjmIc','segment','milestone','logInfo','segments','parse','delete','entry_criteria','null','journeyActivationNameToId','existingJourney','createFolder','with','getSegment','rule','Created\x20segment\x20\x27','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','Delete\x20the\x20push\x20recovery\x20file\x20(','updateSegmentById','max','filter','journeyName','values','item','Updated\x20activation\x20\x27','waitStepUnit','conditionTimeoutDuration','effectiveFolderId','activation_template_id','stages','3085209CPqjUF','__pending_act_','parentFolder','605962SfnSYH','embedded_segment_creating','type','all','connectionIdToNameMap','segment_deleting','Deleted\x20segment\x20\x27','relationships','match','deleteSegment','folder_created','onProgress','debug','set','existingSegments','segmentFolderId','activationActions','NOT_FOUND','logWarning','sort','INTERNAL','folderPath','length','rootFolderId','createdSegmentIds','./child-segment-yaml.js','segment_created','push','conditionTimeoutUnit','entryCriteria','segmentNameToId','./journey-yaml.js','toLowerCase','nameToType','activationsBySegmentId','12640QhzXSi','resolveJourneyId','find'];a152_0x2599=function(){return _0x498c12;};return a152_0x2599();}export function buildSegmentLookupMap(_0x1134df,_0x114b2f){const _0x3e3d29=a152_0x525dc2,_0x188ed8=new Map();for(const _0x1bb590 of _0x1134df){const _0x5e6ca6=_0x1bb590[_0x3e3d29(0x1b2)]?_0x114b2f['get'](_0x1bb590['segmentFolderId'][_0x3e3d29(0x209)]())||'':'',_0x1d7e95=_0x5e6ca6+':'+_0x1bb590[_0x3e3d29(0x1f7)];_0x188ed8[_0x3e3d29(0x1b0)](_0x1d7e95,_0x1bb590);}return _0x188ed8;}export function buildSegmentNameToIdMap(_0x1942e6){const _0x5a8255=a152_0x525dc2,_0x123422=new Map();for(const _0x134d71 of _0x1942e6){_0x123422[_0x5a8255(0x1b0)](_0x134d71[_0x5a8255(0x1f7)],_0x134d71['id']);}return _0x123422;}export function buildJourneyBundleLookupMap(_0x570f83,_0x568de8){const _0x4a96e2=a152_0x525dc2,_0x385da4=new Map();for(const _0xb3ac7d of _0x570f83){const _0x2e16d4=_0xb3ac7d['folderId']?_0x568de8['get'](_0xb3ac7d['folderId'])||'':'',_0x27ad5b=_0x2e16d4+':'+_0xb3ac7d[_0x4a96e2(0x279)];!_0x385da4[_0x4a96e2(0x23a)](_0x27ad5b)&&_0x385da4[_0x4a96e2(0x1b0)](_0x27ad5b,[]),_0x385da4['get'](_0x27ad5b)['push'](_0xb3ac7d);}for(const _0x330565 of _0x385da4[_0x4a96e2(0x298)]()){_0x330565[_0x4a96e2(0x1b6)]((_0x2b8643,_0x40d28c)=>(_0x2b8643[_0x4a96e2(0x1f4)]||0x0)-(_0x40d28c[_0x4a96e2(0x1f4)]||0x0));}return _0x385da4;}export function collectFoldersToCreate(_0x6a42aa,_0x42b7b7){const _0x564bd2=a152_0x525dc2,_0x41caf6=new Set();for(const _0x2b3ba0 of _0x6a42aa){if(!_0x2b3ba0)continue;if(_0x42b7b7[_0x564bd2(0x23a)](_0x2b3ba0))continue;const _0x41df5d=_0x2b3ba0['split']('/');let _0xe8417d='';for(const _0x3fee7a of _0x41df5d){_0xe8417d=_0xe8417d?_0xe8417d+'/'+_0x3fee7a:_0x3fee7a,!_0x42b7b7[_0x564bd2(0x23a)](_0xe8417d)&&_0x41caf6[_0x564bd2(0x1f6)](_0xe8417d);}}return _0x41caf6;}export function parseAndClassifyYamlFiles(_0x5a85e7,_0x31fe85,_0x1db018){const _0x204119=a152_0x525dc2,_0x14a566=[],_0x4b0e35=[];for(const _0x3f1231 of _0x5a85e7){const _0x1ed369=a152_0x493fd4[_0x204119(0x1f3)](_0x31fe85,a152_0x493fd4[_0x204119(0x221)](_0x3f1231)),_0x3f1fc9=_0x1ed369==='.'?'':_0x1ed369[_0x204119(0x1ed)](/\\/g,'/'),_0x990841=readFileSync(_0x3f1231,_0x204119(0x20d)),_0x31592a=a152_0x103244[_0x204119(0x287)](_0x990841);if(isJourneyDef(_0x31592a)){const _0x558ea5=a152_0x412f63(_0x990841);_0x4b0e35['push']({'yamlConfig':_0x558ea5,'folderPath':_0x3f1fc9,'sourcePath':_0x3f1231});}else{if(!_0x1db018?.['skipSegments']){const _0x1f6759=parseSegmentYamlFile(_0x990841),_0x29b47a=normalizeChildSegmentYaml(_0x1f6759);_0x14a566[_0x204119(0x1be)]({'yamlConfig':_0x29b47a,'folderPath':_0x3f1fc9,'sourcePath':_0x3f1231});}}}return{'segments':_0x14a566,'journeys':_0x4b0e35};}export function validateParsedFiles(_0x364611,_0x50698d){const _0xd23c56=a152_0x525dc2,_0x1fbc29=[];for(const {yamlConfig:_0x4fbb74,sourcePath:_0x337cff}of _0x364611[_0xd23c56(0x286)]){const _0x14923c=readFileSync(_0x337cff,_0xd23c56(0x20d)),_0x3861b8=a152_0x103244[_0xd23c56(0x205)](_0x14923c),_0x389b1f=validateSegmentDef(_0x4fbb74,{'source':_0x14923c,'document':_0x3861b8},{'skipSchema':!![]});if(!_0x389b1f[_0xd23c56(0x25c)]){const _0x50101c=a152_0x493fd4[_0xd23c56(0x1f3)](_0x50698d,_0x337cff);_0x1fbc29[_0xd23c56(0x1be)]({'filePath':_0x50101c,'source':_0x14923c,'result':_0x389b1f,'isJourney':![]});}}for(const {yamlConfig:_0x4809d6,sourcePath:_0x30e4d6}of _0x364611[_0xd23c56(0x23f)]){const _0x8f73d=readFileSync(_0x30e4d6,_0xd23c56(0x20d)),_0x51e6fb=a152_0x103244['parseDocument'](_0x8f73d),_0x2c6c12=validateJourneyDef(_0x4809d6,{'source':_0x8f73d,'document':_0x51e6fb},{'skipSchema':!![]});if(!_0x2c6c12[_0xd23c56(0x25c)]){const _0x3d4c49=a152_0x493fd4[_0xd23c56(0x1f3)](_0x50698d,_0x30e4d6);_0x1fbc29[_0xd23c56(0x1be)]({'filePath':_0x3d4c49,'source':_0x8f73d,'result':_0x2c6c12,'isJourney':!![]});}}return _0x1fbc29;}export function formatValidationErrors(_0x2ab48d){const _0x599d9b=a152_0x525dc2,_0x215b7c=[];for(const {filePath:_0x4d86e8,source:_0x31da30,result:_0x113813,isJourney:_0x2c6ddc}of _0x2ab48d){const _0x2f6126=_0x2c6ddc?_0x599d9b(0x262):'segment';_0x215b7c[_0x599d9b(0x1be)]('\x0a'+_0x4d86e8+'\x20('+_0x2f6126+_0x599d9b(0x263)+_0x113813[_0x599d9b(0x1fc)][_0x599d9b(0x1b9)]+_0x599d9b(0x1fd)),_0x215b7c[_0x599d9b(0x1be)](formatValidationResult(_0x113813,_0x31da30,_0x4d86e8));}return _0x215b7c['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x32fa6b){const _0x2bcacd=a152_0x525dc2,_0x471691=new Set(),_0x14c184=new Map(),_0x21062a=collectSegmentUsageCounts(_0x32fa6b);if(_0x32fa6b[_0x2bcacd(0x286)])for(const [_0x5e5e98,_0x5622b6]of Object['entries'](_0x32fa6b[_0x2bcacd(0x286)])){_0x471691['add'](_0x5e5e98);if(_0x5622b6[_0x2bcacd(0x290)]){const _0x124025=yamlRuleToApi(_0x5622b6[_0x2bcacd(0x290)]),_0x1c7289=apiRuleToYaml(_0x124025);_0x14c184[_0x2bcacd(0x1b0)](_0x5e5e98,_0x1c7289);}}const _0x3b6f8f=new Map();let _0x261e58=0x0;for(const [_0x949ce8,_0xd5b15d]of _0x14c184){const _0x5b5ad7=serializeExpandedRule(_0xd5b15d,_0x14c184),_0x4f55eb=_0x3b6f8f['get'](_0x5b5ad7)||[];_0x4f55eb[_0x2bcacd(0x1be)]({'name':_0x949ce8,'index':_0x261e58}),_0x3b6f8f['set'](_0x5b5ad7,_0x4f55eb),_0x261e58++;}const _0x2398a5=new Map();for(const [_0x55f9fc,_0x473558]of _0x3b6f8f){const _0x2627ef=_0x473558['slice']()[_0x2bcacd(0x1b6)]((_0x35b9db,_0x284be3)=>{const _0x34d7e1=_0x2bcacd,_0xcd6b39=_0x21062a[_0x34d7e1(0x21c)](_0x35b9db['name'])||0x0,_0x34ab65=_0x21062a['get'](_0x284be3[_0x34d7e1(0x1f7)])||0x0;if(_0xcd6b39!==_0x34ab65)return _0x34ab65-_0xcd6b39;return _0x35b9db[_0x34d7e1(0x1da)]-_0x284be3[_0x34d7e1(0x1da)];})['map'](_0x5f2491=>_0x5f2491[_0x2bcacd(0x1f7)]),_0x1c3664=[];for(const _0x18edec of _0x2627ef){const _0x1734c3=_0x21062a[_0x2bcacd(0x21c)](_0x18edec)||0x0,_0x1d26b0=Math[_0x2bcacd(0x295)](_0x1734c3,0x1);for(let _0x118bf8=0x0;_0x118bf8<_0x1d26b0;_0x118bf8++){_0x1c3664[_0x2bcacd(0x1be)](_0x18edec);}}_0x2398a5[_0x2bcacd(0x1b0)](_0x55f9fc,_0x1c3664);}return{'existingLocalSegmentNames':_0x471691,'localSegmentRules':_0x14c184,'localExpandedRuleToNames':_0x2398a5};}function a152_0x4bae(_0x1a5a6d,_0x201704){_0x1a5a6d=_0x1a5a6d-0x1a9;const _0x259918=a152_0x2599();let _0x4baea1=_0x259918[_0x1a5a6d];return _0x4baea1;}export function createSegmentIdResolver(_0x4bc85c,_0x3fc505){return async _0x370138=>{const _0x11d5cb=a152_0x4bae,_0x5ec4c5=_0x4bc85c[_0x11d5cb(0x21c)](_0x370138);if(!_0x5ec4c5)throw new SDKError(ErrorCode[_0x11d5cb(0x243)],'Segment\x20not\x20found:\x20'+_0x370138+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x3fc505+'\x27)');return _0x5ec4c5;};}export function extractRootFolderId(_0x4f7b3f){const _0x4c6ac2=a152_0x525dc2;return _0x4f7b3f[_0x4c6ac2(0x1aa)]?.['parentSegmentFolder']?.['data']?.['id']||_0x4f7b3f[_0x4c6ac2(0x1aa)]?.[_0x4c6ac2(0x2a2)]?.['data']?.['id'];}export function buildConnectionMaps(_0x52b7e1){const _0x578cd0=a152_0x525dc2,_0x5b1079=new Map(),_0x216fd9=new Map(),_0x54958c=new Map();for(const _0x1af02b of _0x52b7e1){_0x5b1079[_0x578cd0(0x1b0)](_0x1af02b['name'],parseInt(_0x1af02b['id'],0xa)),_0x216fd9[_0x578cd0(0x1b0)](_0x1af02b['id'],_0x1af02b['name']),_0x54958c[_0x578cd0(0x1b0)](_0x1af02b['name'],_0x1af02b[_0x578cd0(0x2a5)]);}return{'nameToId':_0x5b1079,'idToName':_0x216fd9,'nameToType':_0x54958c};}export function calculatePushStats(_0xb342de,_0x18b483,_0xebacc4,_0x539fe0,_0xaf1e13,_0x458a90,_0xc0776c){const _0x1c3ac0=a152_0x525dc2,_0x1bcbb9=_0xb342de['filter'](_0x47d1b1=>_0x47d1b1['isNew']),_0x8e28f3=_0xb342de['filter'](_0x53c075=>!_0x53c075[_0x1c3ac0(0x254)]&&_0x53c075[_0x1c3ac0(0x20c)]),_0x4b9598=_0xb342de[_0x1c3ac0(0x296)](_0x3aa8b5=>!_0x3aa8b5[_0x1c3ac0(0x254)]&&!_0x3aa8b5[_0x1c3ac0(0x20c)]),_0x226710=_0x458a90?_0x539fe0:[],_0x378c6e=_0x18b483[_0x1c3ac0(0x296)](_0x1d28a8=>_0x1d28a8[_0x1c3ac0(0x254)]),_0x41c164=_0x18b483['filter'](_0x8fa53=>!_0x8fa53[_0x1c3ac0(0x254)]&&_0x8fa53['hasChanges']),_0x272f1a=_0x18b483['filter'](_0x5ac227=>!_0x5ac227[_0x1c3ac0(0x254)]&&!_0x5ac227[_0x1c3ac0(0x20c)]),_0x1c3fcf=_0x458a90?_0xaf1e13:[],_0x589912=_0xb342de['flatMap'](_0x3446eb=>_0x3446eb[_0x1c3ac0(0x1b3)]),_0x2806b7=_0x589912[_0x1c3ac0(0x296)](_0x5a696e=>_0x5a696e['type']===_0x1c3ac0(0x249)),_0x3af55a=_0x589912[_0x1c3ac0(0x296)](_0x7f00ff=>_0x7f00ff[_0x1c3ac0(0x2a5)]===_0x1c3ac0(0x1d9)),_0x32b68f=_0x589912['filter'](_0xa96516=>_0xa96516['type']===_0x1c3ac0(0x288)),_0xd598f9=Array[_0x1c3ac0(0x232)](_0xebacc4)[_0x1c3ac0(0x1b6)](),_0x16877b=_0xc0776c?![]:_0x1bcbb9[_0x1c3ac0(0x1b9)]>0x0||_0x8e28f3['length']>0x0||_0x226710[_0x1c3ac0(0x1b9)]>0x0,_0x37450b=_0x378c6e['length']>0x0||_0x41c164[_0x1c3ac0(0x1b9)]>0x0||_0x1c3fcf['length']>0x0,_0x280e1d=_0xc0776c?![]:_0x589912[_0x1c3ac0(0x1b9)]>0x0,_0x225fc4=_0xd598f9['length']>0x0;return{'segments':{'new':_0x1bcbb9,'changed':_0x8e28f3,'unchanged':_0x4b9598,'toDelete':_0x226710},'journeys':{'new':_0x378c6e,'changed':_0x41c164,'unchanged':_0x272f1a,'toDelete':_0x1c3fcf},'activations':{'all':_0x589912,'toCreate':_0x2806b7,'toUpdate':_0x3af55a,'toDelete':_0x32b68f},'folders':{'toCreate':_0xd598f9},'counts':{'segments':{'new':_0x1bcbb9[_0x1c3ac0(0x1b9)],'changed':_0x8e28f3[_0x1c3ac0(0x1b9)],'unchanged':_0x4b9598['length'],'toDelete':_0x226710[_0x1c3ac0(0x1b9)]},'journeys':{'new':_0x378c6e['length'],'changed':_0x41c164[_0x1c3ac0(0x1b9)],'unchanged':_0x272f1a[_0x1c3ac0(0x1b9)],'toDelete':_0x1c3fcf[_0x1c3ac0(0x1b9)]},'activations':{'create':_0x2806b7['length'],'update':_0x3af55a[_0x1c3ac0(0x1b9)],'delete':_0x32b68f[_0x1c3ac0(0x1b9)]},'folders':_0xd598f9[_0x1c3ac0(0x1b9)]},'hasChanges':_0x16877b||_0x37450b||_0x280e1d||_0x225fc4};}export async function buildPushExecutionContext(_0x4185be,_0x558125,_0x59b8ff,_0x3c861d,_0x4432b6,_0x4fa6e6){const _0x3d9d32=a152_0x525dc2,_0x1f0e76=extractRootFolderId(_0x59b8ff),{pathToId:_0x5de1d2,idToPath:_0x1917cc}=buildFolderMaps(_0x4432b6),_0x3f7dd7=buildSegmentNameToIdMap(_0x3c861d),_0x228016=new Map(),{batchAsync:_0x473359}=await import(_0x3d9d32(0x247)),[_0x385f93,_0x518c5e]=await Promise['all']([_0x4185be['user'][_0x3d9d32(0x239)](),_0x4185be[_0x3d9d32(0x1e3)][_0x3d9d32(0x226)](),((async()=>{!_0x4fa6e6&&_0x3c861d['length']>0x0&&await _0x473359(_0x3c861d,async _0x327116=>{const _0x13bc57=a152_0x4bae,_0x28b368=await _0x4185be[_0x13bc57(0x283)][_0x13bc57(0x244)](_0x558125,_0x327116['id']);_0x228016[_0x13bc57(0x1b0)](_0x327116['id'],_0x28b368);});})())]),{emailToId:_0x5755db,idToEmail:_0x5de808}=_0x385f93,_0x2cbec9=buildConnectionMaps(_0x518c5e);return{'rootFolderId':_0x1f0e76,'folderPathToId':_0x5de1d2,'folderIdToPath':_0x1917cc,'segmentNameToId':_0x3f7dd7,'activationsBySegmentId':_0x228016,'emailToIdMap':_0x5755db,'idToEmailMap':_0x5de808,'connectionNameToIdMap':_0x2cbec9[_0x3d9d32(0x1cd)],'connectionIdToNameMap':_0x2cbec9['idToName'],'connectionNameToTypeMap':_0x2cbec9[_0x3d9d32(0x1c4)]};}export function createPushYamlContextForBundle(_0x4e7a4b,_0x1a33a8,_0x2ccda9,_0x332734,_0xc73ce,_0x171e97,_0x1b5e58,_0x265a81){const {existingLocalSegmentNames:_0x4e1e6c,localExpandedRuleToNames:_0x32a94a}=_0x332734,_0x1447b2=new Set(),_0x22afba=new Map(),_0x7a45bb=new Map(),_0x18264a=new Map(),_0x58aa31=createJumpTargetCache(),_0xaa6aef=new Map(),_0x4b3db9=new Map(),_0x2b6666=new Set();let _0x10d726;const _0x4404ef=_0x33c9e8=>{const _0x520e8c={'resolveSegment':async _0x3ef52a=>{const _0x4bc9a5=a152_0x4bae,_0xdd99c0=_0x18264a[_0x4bc9a5(0x21c)](_0x3ef52a);if(_0xdd99c0!==undefined)return{'name':_0xdd99c0,'isJourneyLocal':!![]};try{const _0x19aacc=await fetchSegment(_0x4e7a4b,_0x1a33a8,_0x3ef52a,_0x2ccda9);if(!_0x19aacc)throw new Error(_0x4bc9a5(0x258));const _0x20ed66=generateJourneyLocalName(_0x19aacc['name']),_0x10771f=_0x19aacc[_0x4bc9a5(0x216)]===SEGMENT_KIND_JOURNEY&&_0x20ed66!==undefined;let _0xa1c4d9=_0x19aacc[_0x4bc9a5(0x1f7)],_0x3484b4;if(_0x10771f&&_0x19aacc[_0x4bc9a5(0x290)]){const _0x268bb9=apiRuleToYaml(_0x19aacc[_0x4bc9a5(0x290)]);_0x4b3db9[_0x4bc9a5(0x1b0)](_0x3ef52a,_0x268bb9);const _0xff5ed8=async _0x96c549=>{const _0x385f86=_0x4bc9a5,_0x235469=collectSegmentRefsFromRule(_0x96c549);for(const _0x183dd2 of _0x235469){if(!_0x4b3db9[_0x385f86(0x23a)](_0x183dd2))try{const _0x1f5213=await fetchSegment(_0x4e7a4b,_0x1a33a8,_0x183dd2,_0x2ccda9);if(_0x1f5213?.[_0x385f86(0x290)]){const _0x128113=apiRuleToYaml(_0x1f5213[_0x385f86(0x290)]);_0x4b3db9['set'](_0x183dd2,_0x128113),await _0xff5ed8(_0x128113);}}catch(_0x20d64a){logger[_0x385f86(0x1af)](_0x385f86(0x1f8)+_0x183dd2+':\x20'+_0x20d64a);}}};await _0xff5ed8(_0x268bb9);const _0x50adbd=serializeExpandedRule(_0x268bb9,_0x4b3db9),_0x34d9a2=_0x32a94a['get'](_0x50adbd);if(_0x34d9a2&&_0x34d9a2['length']>0x0){const _0x1dbe82=_0x22afba[_0x4bc9a5(0x21c)](_0x50adbd)||0x0,_0x5c4dc5=_0x34d9a2[_0x1dbe82]||_0x34d9a2[_0x34d9a2['length']-0x1];_0x22afba['set'](_0x50adbd,_0x1dbe82+0x1),_0xa1c4d9=_0x5c4dc5,_0x1447b2['add'](_0xa1c4d9),_0x18264a[_0x4bc9a5(0x1b0)](_0x3ef52a,_0xa1c4d9);const _0x2b7aca=await resolveRuleSegmentRefs(_0x268bb9,async _0x16a53f=>{const _0xdc334e=_0x4bc9a5,_0x4c2b40=_0x18264a['get'](_0x16a53f);if(_0x4c2b40)return _0x4c2b40;const _0x30c60e=await _0x10d726[_0xdc334e(0x1cf)](_0x16a53f);return _0x30c60e[_0xdc334e(0x1f7)];});_0x3484b4={'description':_0x19aacc[_0x4bc9a5(0x206)],'rule':_0x2b7aca};}else{const _0x18c08c=_0xaa6aef[_0x4bc9a5(0x21c)](_0x50adbd);if(_0x18c08c)_0xa1c4d9=_0x18c08c,_0x18264a[_0x4bc9a5(0x1b0)](_0x3ef52a,_0xa1c4d9);else{if(_0x20ed66){let _0x28df24=_0x20ed66,_0x432c9e=0x2;while(_0x1447b2[_0x4bc9a5(0x23a)](_0x28df24)||_0x4e1e6c[_0x4bc9a5(0x23a)](_0x28df24)){_0x28df24=_0x20ed66+'_'+_0x432c9e,_0x432c9e++;}_0x1447b2[_0x4bc9a5(0x1f6)](_0x28df24),_0xa1c4d9=_0x28df24;}_0x18264a['set'](_0x3ef52a,_0xa1c4d9),_0xaa6aef[_0x4bc9a5(0x1b0)](_0x50adbd,_0xa1c4d9);const _0x33bb50=await resolveRuleSegmentRefs(_0x268bb9,async _0x3bc1f8=>{const _0x1e66a1=_0x4bc9a5,_0x5442ed=_0x18264a['get'](_0x3bc1f8);if(_0x5442ed)return _0x5442ed;const _0x2687ea=await _0x10d726[_0x1e66a1(0x1cf)](_0x3bc1f8);return _0x2687ea[_0x1e66a1(0x1f7)];});_0x3484b4={'description':_0x19aacc[_0x4bc9a5(0x206)],'rule':_0x33bb50};}}}return{'name':_0xa1c4d9,'isJourneyLocal':_0x10771f,'definition':_0x3484b4};}catch(_0x3c3d80){return logger[_0x4bc9a5(0x1af)]('Failed\x20to\x20resolve\x20segment\x20'+_0x3ef52a+':\x20'+_0x3c3d80),{'name':_0x3ef52a,'isJourneyLocal':![]};}},'resolveActivation':async _0x207d8c=>{const _0x18b44b=a152_0x4bae,_0xd4e01d=_0x7a45bb['get'](_0x207d8c);if(_0xd4e01d!==undefined)return{'name':_0xd4e01d,'isJourneyLocal':!![]};try{let _0x17a9bd=_0x1b5e58?.['get'](_0x207d8c);!_0x17a9bd&&(_0x17a9bd=await _0x4e7a4b[_0x18b44b(0x262)]['getActivation'](_0x33c9e8,_0x207d8c));const _0x41d09a=_0x17a9bd[_0x18b44b(0x1d1)]['activationParams'][_0x18b44b(0x1f7)]||_0x207d8c,_0x55f449=sanitizeYamlKey(_0x41d09a)||'activation_'+_0x207d8c,_0x5b8bbb=_0x55f449;_0x7a45bb[_0x18b44b(0x1b0)](_0x207d8c,_0x5b8bbb);const _0x46b1dc=journeyActivationStepToYaml(_0x17a9bd,_0xc73ce,_0x171e97);return{'name':_0x5b8bbb,'isJourneyLocal':!![],'definition':_0x46b1dc};}catch(_0x34e08d){return logger[_0x18b44b(0x1af)](_0x18b44b(0x1ea)+_0x207d8c+':\x20'+_0x34e08d),{'name':_0x207d8c,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x2101b4,_0x464cd8)=>resolveJumpTarget(_0x2101b4,_0x464cd8,_0x58aa31,async _0x2d4f4b=>{const _0x344474=a152_0x4bae,_0x5d51d3=_0x265a81?.[_0x344474(0x21c)](_0x2d4f4b);if(_0x5d51d3)return _0x5d51d3;return _0x4e7a4b[_0x344474(0x262)][_0x344474(0x256)](_0x2d4f4b);})};return _0x10d726=_0x520e8c,_0x520e8c;},_0x2838a3=async _0x1c721a=>{const _0x4dba5b=a152_0x4bae,{collectSegmentIdsFromJourneyApi:_0x4edb77}=await import('./journey-yaml.js'),{batchAsync:_0x2059e6}=await import('../../utils/async.js'),_0x43d1ad=new Set();for(const _0x322366 of _0x1c721a){let _0x4f10ae=_0x265a81?.['get'](_0x322366);!_0x4f10ae&&(_0x4f10ae=await _0x4e7a4b[_0x4dba5b(0x262)][_0x4dba5b(0x256)](_0x322366));const _0x456034=_0x4edb77(_0x4f10ae);for(const _0x497277 of _0x456034){_0x43d1ad['add'](_0x497277);}}let _0x278169=Array['from'](_0x43d1ad);while(_0x278169[_0x4dba5b(0x1b9)]>0x0){const _0x143cf8=_0x278169[_0x4dba5b(0x296)](_0x53cd39=>!_0x2b6666[_0x4dba5b(0x23a)](_0x53cd39));if(_0x143cf8[_0x4dba5b(0x1b9)]===0x0)break;const _0x18074c=await _0x2059e6(_0x143cf8,async _0x1d4999=>{const _0x5d1c15=_0x4dba5b;_0x2b6666[_0x5d1c15(0x1f6)](_0x1d4999);const _0x58e091=await fetchSegment(_0x4e7a4b,_0x1a33a8,_0x1d4999,_0x2ccda9);if(!_0x58e091)return null;return{'segmentId':_0x1d4999,'segment':_0x58e091};},0xa),_0xee85ac=new Set();for(const _0x584d8e of _0x18074c){if(!_0x584d8e?.[_0x4dba5b(0x283)]?.[_0x4dba5b(0x290)])continue;const _0x390e69=apiRuleToYaml(_0x584d8e[_0x4dba5b(0x283)][_0x4dba5b(0x290)]);_0x4b3db9[_0x4dba5b(0x1b0)](_0x584d8e[_0x4dba5b(0x23c)],_0x390e69);const _0x3a5d71=collectSegmentRefsFromRule(_0x390e69);for(const _0x2ae1f4 of _0x3a5d71){!_0x2b6666[_0x4dba5b(0x23a)](_0x2ae1f4)&&_0xee85ac[_0x4dba5b(0x1f6)](_0x2ae1f4);}}_0x278169=Array['from'](_0xee85ac);}};return{'createYamlContext':_0x4404ef,'prefetchJourneySegments':_0x2838a3};}export async function executePushSegments(_0x2ab5d8,_0x2ed1d4,_0x5e08f1,_0x2b0f8d,_0xfabfc){const _0x452ae6=a152_0x525dc2,{segmentDefToCreateRequest:_0x2d31b8,segmentDefToUpdateRequest:_0x591811}=await import(_0x452ae6(0x1bc)),_0x1e8a68=_0x5e08f1['folderPathToId'],_0xf6631a=0x5,_0x30b9d2=async _0x140dac=>{const _0xc618c7=_0x452ae6,_0x1ee9b4=_0x140dac[_0xc618c7(0x1b8)]?_0x1e8a68[_0xc618c7(0x21c)](_0x140dac['folderPath']):undefined;let _0x58cf6a;const _0xc4c43c={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x6f6d02=_0x140dac[_0xc618c7(0x220)];if(_0x140dac[_0xc618c7(0x220)][_0xc618c7(0x290)]){const _0x455224=createSegmentIdResolver(_0x5e08f1[_0xc618c7(0x1c1)],_0x140dac['yamlConfig'][_0xc618c7(0x1f7)]),_0x5b67b4=await resolveRuleSegmentIds(_0x140dac[_0xc618c7(0x220)][_0xc618c7(0x290)],_0x455224);_0x6f6d02={..._0x140dac[_0xc618c7(0x220)],'rule':_0x5b67b4};}try{if(_0x140dac[_0xc618c7(0x254)]){_0xfabfc[_0xc618c7(0x1ae)]?.({'type':_0xc618c7(0x1e9),'name':_0x140dac[_0xc618c7(0x220)][_0xc618c7(0x1f7)]});const _0x22339d=_0x2d31b8(_0x6f6d02,_0x1ee9b4),_0x469694=await _0xfabfc[_0xc618c7(0x1ff)](_0xc618c7(0x1d5)+_0x140dac['yamlConfig'][_0xc618c7(0x1f7)]+'\x27...',()=>_0x2ab5d8[_0xc618c7(0x283)][_0xc618c7(0x241)](_0x2b0f8d[_0xc618c7(0x265)],_0x22339d));_0x58cf6a=_0x469694[_0xc618c7(0x25e)]['id'],_0x5e08f1[_0xc618c7(0x1c1)][_0xc618c7(0x1b0)](_0x140dac['yamlConfig'][_0xc618c7(0x1f7)],_0x58cf6a),_0xc4c43c[_0xc618c7(0x20b)]={'name':_0x140dac['yamlConfig'][_0xc618c7(0x1f7)],'id':_0x58cf6a},_0xfabfc[_0xc618c7(0x1ae)]?.({'type':_0xc618c7(0x1bd),'name':_0x140dac[_0xc618c7(0x220)]['name'],'segmentId':_0x58cf6a}),_0xfabfc['logSuccess']?.(_0xc618c7(0x291)+_0x140dac[_0xc618c7(0x220)][_0xc618c7(0x1f7)]+'\x27'),_0xc4c43c['created']=0x1;}else{if(_0x140dac[_0xc618c7(0x20c)]){_0xfabfc['onProgress']?.({'type':_0xc618c7(0x1f9),'name':_0x140dac['yamlConfig']['name']});const _0x1631b7=_0x591811(_0x6f6d02);_0x1ee9b4!==_0x140dac[_0xc618c7(0x248)]?.[_0xc618c7(0x1b2)]&&(_0x1631b7[_0xc618c7(0x1b2)]=_0x1ee9b4?parseInt(_0x1ee9b4,0xa):undefined),await _0xfabfc[_0xc618c7(0x1ff)](_0xc618c7(0x22b)+_0x140dac['yamlConfig'][_0xc618c7(0x1f7)]+_0xc618c7(0x219),()=>_0x2ab5d8[_0xc618c7(0x283)][_0xc618c7(0x294)](_0x2b0f8d[_0xc618c7(0x265)],_0x140dac[_0xc618c7(0x248)]['id'],_0x1631b7)),_0x58cf6a=_0x140dac[_0xc618c7(0x248)]['id'],_0xfabfc['onProgress']?.({'type':'segment_updated','name':_0x140dac[_0xc618c7(0x220)][_0xc618c7(0x1f7)]}),_0xfabfc[_0xc618c7(0x245)]?.('Updated\x20segment\x20\x27'+_0x140dac[_0xc618c7(0x220)][_0xc618c7(0x1f7)]+'\x27'),_0xc4c43c[_0xc618c7(0x1e1)]=0x1;}else _0x58cf6a=_0x140dac[_0xc618c7(0x248)]['id'];}}catch(_0x3239b4){const _0x5f0e33=isHttp400Error(_0x3239b4),_0x424211=_0x5f0e33?ErrorCode[_0xc618c7(0x27b)]:ErrorCode[_0xc618c7(0x281)],_0x56e08c=getErrorMessage(_0x3239b4);throw new SDKError(_0x424211,_0xc618c7(0x251)+(_0x140dac[_0xc618c7(0x254)]?_0xc618c7(0x249):_0xc618c7(0x1d9))+'\x20segment\x20from\x20file:\x20'+_0x140dac['absolutePath']+_0xc618c7(0x266)+_0x56e08c,_0x3239b4);}try{const _0x5c8cf8=await syncActivationsForSegment(_0x2ab5d8,_0x2b0f8d['parentId'],_0x58cf6a,_0x140dac[_0xc618c7(0x220)][_0xc618c7(0x1f7)],_0x140dac[_0xc618c7(0x1b3)],_0xfabfc,_0x140dac[_0xc618c7(0x224)]);_0xc4c43c['activations']=_0x5c8cf8;}catch(_0x5a9349){if(_0x5a9349 instanceof SDKError)throw _0x5a9349;throw new SDKError(ErrorCode[_0xc618c7(0x27d)],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x140dac[_0xc618c7(0x220)][_0xc618c7(0x1f7)]+_0xc618c7(0x225)+_0x140dac[_0xc618c7(0x224)]+'\x0a\x20\x20'+getErrorMessage(_0x5a9349),_0x5a9349);}return _0xc4c43c;},_0x349ecc=await batchAsync(_0x2ed1d4,_0x30b9d2,_0xf6631a),_0x2e7ad6={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x4ce9f7 of _0x349ecc){_0x2e7ad6['created']+=_0x4ce9f7[_0x452ae6(0x1d0)],_0x2e7ad6['updated']+=_0x4ce9f7[_0x452ae6(0x1e1)],_0x4ce9f7[_0x452ae6(0x20b)]&&_0x2e7ad6[_0x452ae6(0x1bb)][_0x452ae6(0x1b0)](_0x4ce9f7[_0x452ae6(0x20b)]['name'],_0x4ce9f7[_0x452ae6(0x20b)]['id']),_0x2e7ad6[_0x452ae6(0x271)][_0x452ae6(0x1d0)]+=_0x4ce9f7[_0x452ae6(0x271)]['created'],_0x2e7ad6[_0x452ae6(0x271)][_0x452ae6(0x1e1)]+=_0x4ce9f7[_0x452ae6(0x271)][_0x452ae6(0x1e1)],_0x2e7ad6[_0x452ae6(0x271)]['deleted']+=_0x4ce9f7['activations'][_0x452ae6(0x238)];}return _0x2e7ad6;}async function syncActivationsForSegment(_0x2b1381,_0x271c47,_0xfe7bd7,_0x4523fe,_0x30f08d,_0x4ddc1d,_0x221061){const _0x3c4a55=a152_0x525dc2,_0x2c8794={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0xee6f5c of _0x30f08d){try{if(_0xee6f5c[_0x3c4a55(0x2a5)]===_0x3c4a55(0x249)&&_0xee6f5c[_0x3c4a55(0x1f2)])_0x4ddc1d[_0x3c4a55(0x1ae)]?.({'type':_0x3c4a55(0x274),'segmentName':_0x4523fe,'activationName':_0xee6f5c['name']}),await _0x4ddc1d[_0x3c4a55(0x1ff)](_0x3c4a55(0x234)+_0xee6f5c[_0x3c4a55(0x1f7)]+_0x3c4a55(0x219),()=>_0x2b1381['segment'][_0x3c4a55(0x1eb)](_0x271c47,_0xfe7bd7,_0xee6f5c[_0x3c4a55(0x1f2)])),_0x4ddc1d[_0x3c4a55(0x1ae)]?.({'type':_0x3c4a55(0x26b),'segmentName':_0x4523fe,'activationName':_0xee6f5c[_0x3c4a55(0x1f7)]}),_0x4ddc1d[_0x3c4a55(0x245)]?.(_0x3c4a55(0x1db)+_0xee6f5c[_0x3c4a55(0x1f7)]+'\x27'),_0x2c8794['created']++;else{if(_0xee6f5c[_0x3c4a55(0x2a5)]===_0x3c4a55(0x1d9)&&_0xee6f5c['validatedRequest']&&_0xee6f5c['existingActivation'])_0x4ddc1d[_0x3c4a55(0x1ae)]?.({'type':_0x3c4a55(0x27f),'segmentName':_0x4523fe,'activationName':_0xee6f5c[_0x3c4a55(0x1f7)]}),await _0x4ddc1d[_0x3c4a55(0x1ff)](_0x3c4a55(0x21e)+_0xee6f5c[_0x3c4a55(0x1f7)]+_0x3c4a55(0x219),()=>_0x2b1381[_0x3c4a55(0x283)][_0x3c4a55(0x204)](_0x271c47,_0xfe7bd7,_0xee6f5c[_0x3c4a55(0x218)]['id'],_0xee6f5c['validatedRequest'])),_0x4ddc1d['onProgress']?.({'type':_0x3c4a55(0x1d4),'segmentName':_0x4523fe,'activationName':_0xee6f5c[_0x3c4a55(0x1f7)]}),_0x4ddc1d[_0x3c4a55(0x245)]?.(_0x3c4a55(0x29a)+_0xee6f5c['name']+'\x27'),_0x2c8794[_0x3c4a55(0x1e1)]++;else _0xee6f5c['type']===_0x3c4a55(0x288)&&_0xee6f5c[_0x3c4a55(0x218)]&&(_0x4ddc1d[_0x3c4a55(0x1ae)]?.({'type':'activation_deleting','segmentName':_0x4523fe,'activationName':_0xee6f5c[_0x3c4a55(0x1f7)]}),await _0x4ddc1d[_0x3c4a55(0x1ff)]('Deleting\x20activation\x20\x27'+_0xee6f5c[_0x3c4a55(0x1f7)]+'\x27...',()=>_0x2b1381[_0x3c4a55(0x283)]['deleteActivation'](_0x271c47,_0xfe7bd7,_0xee6f5c[_0x3c4a55(0x218)]['id'])),_0x4ddc1d[_0x3c4a55(0x1ae)]?.({'type':_0x3c4a55(0x273),'segmentName':_0x4523fe,'activationName':_0xee6f5c['name']}),_0x4ddc1d[_0x3c4a55(0x22f)]?.(_0x3c4a55(0x253)+_0xee6f5c['name']+'\x27'),_0x2c8794[_0x3c4a55(0x238)]++);}}catch(_0x337734){const _0x369250=isHttp400Error(_0x337734),_0x26c2eb=_0x369250?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x2ba21a=getErrorMessage(_0x337734);throw new SDKError(_0x26c2eb,_0x3c4a55(0x251)+_0xee6f5c[_0x3c4a55(0x2a5)]+_0x3c4a55(0x208)+_0xee6f5c[_0x3c4a55(0x1f7)]+_0x3c4a55(0x225)+_0x221061+_0x3c4a55(0x266)+_0x2ba21a,_0x337734);}}return _0x2c8794;}export async function executePushFolders(_0x202ad0,_0x53b5fc,_0x2194dd,_0x243c8a,_0x1895ef){const _0xf6212=a152_0x525dc2,_0x5f1ed5=new Map(_0x2194dd),_0x1fe41b=sortFoldersByDepth(_0x53b5fc);for(const _0x23bb08 of _0x1fe41b){const _0x54ad04=_0x23bb08[_0xf6212(0x269)]('/'),_0x23b25d=_0x54ad04[_0x54ad04[_0xf6212(0x1b9)]-0x1],_0x8c605b=_0x54ad04[_0xf6212(0x268)](0x0,-0x1)[_0xf6212(0x1ef)]('/'),_0x528dd4=_0x5f1ed5['get'](_0x8c605b);_0x1895ef[_0xf6212(0x1ae)]?.({'type':_0xf6212(0x24d),'folder':_0x23bb08});const _0x1cea69={'name':_0x23b25d,'parentFolderId':_0x528dd4},_0x4a288e=await _0x1895ef[_0xf6212(0x1ff)](_0xf6212(0x1e2)+_0x23bb08+_0xf6212(0x219),()=>_0x202ad0['segment'][_0xf6212(0x28d)](_0x243c8a[_0xf6212(0x265)],_0x1cea69));_0x5f1ed5[_0xf6212(0x1b0)](_0x23bb08,_0x4a288e[_0xf6212(0x25e)]['id']),_0x1895ef['onProgress']?.({'type':_0xf6212(0x1ad),'folder':_0x23bb08,'folderId':_0x4a288e['data']['id']}),_0x1895ef[_0xf6212(0x285)]?.('Created\x20folder\x20\x27'+_0x23bb08+'\x27');}return _0x5f1ed5;}export async function executePushSegmentDeletions(_0x423876,_0x37648e,_0x4cf773){const _0x3a9991=a152_0x525dc2;if(_0x37648e['length']===0x0)return 0x0;const {batchAsync:_0x29818c}=await import(_0x3a9991(0x247)),_0x3bf5e5=0x5,_0x472a65=await _0x29818c(_0x37648e,async _0x28c72e=>{const _0x36f9cd=_0x3a9991;return _0x4cf773[_0x36f9cd(0x1ae)]?.({'type':_0x36f9cd(0x2a8),'name':_0x28c72e['name']}),await _0x423876['segment'][_0x36f9cd(0x1ac)](_0x28c72e['id']),_0x4cf773[_0x36f9cd(0x1ae)]?.({'type':_0x36f9cd(0x1d6),'name':_0x28c72e[_0x36f9cd(0x1f7)]}),_0x4cf773[_0x36f9cd(0x22f)]?.(_0x36f9cd(0x1a9)+_0x28c72e[_0x36f9cd(0x1f7)]+'\x27'),0x1;},_0x3bf5e5);return _0x472a65[_0x3a9991(0x201)]((_0x2aeb20,_0x203813)=>_0x2aeb20+_0x203813,0x0);}export async function executePushJourneys(_0x27a6c3,_0x357d36,_0x1b96cb,_0x572c39,_0x4510d7){const _0x5c73db=a152_0x525dc2,{journeyDefToRequest:_0x26eb93}=await import(_0x5c73db(0x1c2)),{activationDefToCreateRequest:_0x25cab5,yamlRuleToApi:_0x1fd536,validateSegmentRule:_0x2cea36}=await import(_0x5c73db(0x1bc)),_0x503fb1={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x5881ae=new Map(_0x1b96cb[_0x5c73db(0x1c1)]),_0x44ca3b=0x5;for(let _0x2d3dc6=0x0;_0x2d3dc6<_0x357d36[_0x5c73db(0x1b9)];_0x2d3dc6+=_0x44ca3b){const _0x114b78=_0x357d36[_0x5c73db(0x268)](_0x2d3dc6,_0x2d3dc6+_0x44ca3b),_0x32f998=await Promise[_0x5c73db(0x2a6)](_0x114b78[_0x5c73db(0x237)](async _0x3fadca=>{const _0x2b8047=_0x5c73db;if(!_0x3fadca[_0x2b8047(0x254)]&&!_0x3fadca['hasChanges'])return{'action':'unchanged','name':_0x3fadca[_0x2b8047(0x220)][_0x2b8047(0x1f7)],'journeyId':_0x3fadca['existingJourney']?.['id']};const _0x8ca1=_0x3fadca[_0x2b8047(0x1b8)]?_0x1b96cb[_0x2b8047(0x222)]['get'](_0x3fadca['folderPath']):undefined;_0x4510d7[_0x2b8047(0x1ae)]?.({'type':_0x3fadca[_0x2b8047(0x254)]?_0x2b8047(0x22d):_0x2b8047(0x27e),'name':_0x3fadca[_0x2b8047(0x220)]['name']});try{const _0x505a50=await executeSingleJourneyPush(_0x27a6c3,_0x3fadca,{..._0x1b96cb,'segmentNameToId':_0x5881ae},{'parentId':_0x572c39[_0x2b8047(0x265)],'rootFolderId':_0x572c39[_0x2b8047(0x1ba)],'folderId':_0x8ca1,'verbose':_0x572c39[_0x2b8047(0x27a)]},_0x4510d7,{'journeyDefToRequest':_0x26eb93,'activationDefToCreateRequest':_0x25cab5,'yamlRuleToApi':_0x1fd536,'validateSegmentRule':_0x2cea36});for(const [_0x39a300,_0x263045]of _0x505a50[_0x2b8047(0x211)]){_0x5881ae[_0x2b8047(0x1b0)](_0x39a300,_0x263045),_0x503fb1['embeddedSegmentNameToId'][_0x2b8047(0x1b0)](_0x39a300,_0x263045);}if(_0x505a50['action']===_0x2b8047(0x1d0))_0x4510d7[_0x2b8047(0x1ae)]?.({'type':_0x2b8047(0x1cc),'name':_0x3fadca[_0x2b8047(0x220)][_0x2b8047(0x1f7)],'journeyId':_0x505a50[_0x2b8047(0x27c)]}),_0x4510d7[_0x2b8047(0x245)]?.(_0x2b8047(0x1e4)+_0x3fadca[_0x2b8047(0x220)]['name']+'\x27'),_0x503fb1[_0x2b8047(0x1d0)]++;else _0x505a50['action']==='updated'&&(_0x4510d7['onProgress']?.({'type':_0x2b8047(0x21b),'name':_0x3fadca[_0x2b8047(0x220)][_0x2b8047(0x1f7)]}),_0x4510d7[_0x2b8047(0x245)]?.(_0x2b8047(0x277)+_0x3fadca[_0x2b8047(0x220)][_0x2b8047(0x1f7)]+'\x27'),_0x503fb1['updated']++);return{'action':_0x505a50[_0x2b8047(0x228)],'name':_0x3fadca[_0x2b8047(0x220)][_0x2b8047(0x1f7)],'journeyId':_0x505a50[_0x2b8047(0x27c)]};}catch(_0x2d490c){const _0x5b53c1=isHttp400Error(_0x2d490c),_0x93013=_0x5b53c1?ErrorCode[_0x2b8047(0x210)]:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x3d71b9=getErrorMessage(_0x2d490c);throw new SDKError(_0x93013,_0x2b8047(0x251)+(_0x3fadca[_0x2b8047(0x254)]?_0x2b8047(0x249):_0x2b8047(0x1d9))+_0x2b8047(0x236)+_0x3fadca['absolutePath']+'\x0a\x20\x20'+_0x3d71b9,_0x2d490c);}}));_0x503fb1[_0x5c73db(0x214)]['push'](..._0x32f998);}return _0x503fb1;}async function matchExistingJourneySegments(_0x2e20f1,_0xaa7df0,_0x35f9b5,_0xb15a16,_0x280d91){const _0x3786e8=a152_0x525dc2;if(!_0xaa7df0[_0x3786e8(0x28c)]||!_0xaa7df0[_0x3786e8(0x220)]['segments'])return;const _0x59453c=new Map(),_0x36543a=new Set();for(const _0x5c570e of Object[_0x3786e8(0x255)](_0xaa7df0[_0x3786e8(0x220)][_0x3786e8(0x286)])){const _0x386870=generateDeterministicJourneySegmentName(_0xaa7df0[_0x3786e8(0x220)][_0x3786e8(0x1f7)],_0x5c570e);_0x59453c['set'](_0x386870,_0x5c570e),_0x36543a[_0x3786e8(0x1f6)](_0x5c570e);}const _0x409cef=[],_0x19d7ca=collectSegmentIdsFromJourneyApi(_0xaa7df0['existingJourney']);for(const _0x3026be of _0x19d7ca){const _0x2e0ef7=await fetchSegment(_0x2e20f1,_0x35f9b5,_0x3026be,_0xb15a16);if(!_0x2e0ef7?.[_0x3786e8(0x1f7)])continue;const _0x528f31=_0x59453c[_0x3786e8(0x21c)](_0x2e0ef7[_0x3786e8(0x1f7)]);_0x528f31?(_0x280d91[_0x3786e8(0x1b0)](_0x528f31,_0x3026be),_0x36543a[_0x3786e8(0x288)](_0x528f31)):_0x409cef['push']({'id':_0x3026be,'seg':_0x2e0ef7});}if(_0x36543a[_0x3786e8(0x22e)]>0x0&&_0x409cef[_0x3786e8(0x1b9)]>0x0){const {localExpandedRuleToNames:_0x2fe957}=buildLocalExpandedRuleMappings(_0xaa7df0[_0x3786e8(0x220)]),_0x69ecda=new Map();for(const {id:_0x56f196,seg:_0x198b12}of _0x409cef){if(_0x198b12[_0x3786e8(0x290)]){const _0x372037=apiRuleToYaml(_0x198b12[_0x3786e8(0x290)]);_0x69ecda['set'](_0x56f196,_0x372037);}}for(const {id:_0x553c63,seg:_0x356b49}of _0x409cef){if(!_0x356b49[_0x3786e8(0x290)])continue;const _0x32ea12=_0x69ecda[_0x3786e8(0x21c)](_0x553c63);if(!_0x32ea12)continue;const _0x14e91d=serializeExpandedRule(_0x32ea12,_0x69ecda),_0x824532=_0x2fe957['get'](_0x14e91d);if(_0x824532){const _0x1c7e89=_0x824532[_0x3786e8(0x1c8)](_0x4ce024=>_0x36543a[_0x3786e8(0x23a)](_0x4ce024));_0x1c7e89&&(_0x280d91[_0x3786e8(0x1b0)](_0x1c7e89,_0x553c63),_0x36543a['delete'](_0x1c7e89),logger[_0x3786e8(0x1af)](_0x3786e8(0x246)+_0x356b49['name']+'\x27\x20to\x20local\x20\x27'+_0x1c7e89+_0x3786e8(0x257)));}}}}async function executeSingleJourneyPush(_0x52f0ea,_0x2f78c6,_0x2ecc08,_0x9153fc,_0x5e0763,_0x5bad6f){const _0x14a7fd=a152_0x525dc2,{journeyDefToRequest:_0x145029,activationDefToCreateRequest:_0xa0a734,yamlRuleToApi:_0x5b835e,validateSegmentRule:_0x1e7d4b}=_0x5bad6f,_0xab0f=new Map(),_0x563840=new Map();recoverSegmentIdsFromPushRecovery(_0x2f78c6,_0xab0f,_0x2ecc08[_0x14a7fd(0x1c1)]);const _0x4e3f0a=new Map(),_0x5b00c7=new Map(),_0x384818=new Map();let _0x329930;const _0x50f2c7=async()=>{const _0x437f42=_0x14a7fd;if(_0x329930)return;_0x329930=new Map();if(!_0x2f78c6[_0x437f42(0x28c)])return;const _0x98a00e=await _0x52f0ea[_0x437f42(0x262)][_0x437f42(0x244)](_0x2f78c6[_0x437f42(0x28c)]['id']);for(const _0xf6a690 of _0x98a00e){const _0x1769ca=journeyActivationStepToYaml(_0xf6a690,_0x2ecc08[_0x437f42(0x200)],_0x2ecc08[_0x437f42(0x2a7)]),_0x379e5a=activationSignature(_0x1769ca);!_0x329930[_0x437f42(0x23a)](_0x379e5a)&&_0x329930[_0x437f42(0x1b0)](_0x379e5a,_0xf6a690['id']),_0x1769ca[_0x437f42(0x1f7)]&&_0x563840['set'](_0x1769ca[_0x437f42(0x1f7)],_0xf6a690['id']);}};await matchExistingJourneySegments(_0x52f0ea,_0x2f78c6,_0x9153fc[_0x14a7fd(0x265)],_0x2ecc08[_0x14a7fd(0x1b1)],_0x2ecc08['segmentNameToId']);const _0x27b826={'resolveSegmentId':async _0x4977b1=>{const _0x29b488=_0x14a7fd,_0x401a94=_0x2ecc08[_0x29b488(0x1c1)][_0x29b488(0x21c)](_0x4977b1);if(!_0x401a94)throw new SDKError(ErrorCode[_0x29b488(0x243)],_0x29b488(0x1d8)+_0x4977b1+_0x29b488(0x278)+_0x2f78c6[_0x29b488(0x220)]['name']+')');return _0x401a94;},'resolveEmbeddedSegmentId':async(_0x4f1ede,_0x65af49)=>{const _0x2ff034=_0x14a7fd,_0x3bccb0=_0x2ecc08[_0x2ff034(0x1c1)][_0x2ff034(0x21c)](_0x4f1ede);if(_0x3bccb0)return _0x3bccb0;const _0x328978=_0x2ecc08[_0x2ff034(0x1b1)][_0x2ff034(0x1c8)](_0x593279=>_0x593279[_0x2ff034(0x1f7)]===_0x4f1ede);if(_0x328978)return _0x2ecc08[_0x2ff034(0x1c1)][_0x2ff034(0x1b0)](_0x4f1ede,_0x328978['id']),_0x328978['id'];if(_0x2f78c6[_0x2ff034(0x254)]){const {stageName:_0x318917,criteriaName:_0x9676bd}=findSegmentCriteriaLocation(_0x2f78c6[_0x2ff034(0x220)],_0x4f1ede);return _0x1e7d4b(_0x4f1ede,_0x65af49[_0x2ff034(0x290)]),_0x5b00c7[_0x2ff034(0x1b0)](_0x4f1ede,{'definition':_0x65af49,'stageName':_0x318917,'criteriaName':_0x9676bd}),createPendingSegmentId(_0x4f1ede);}const _0x5c123e=_0x2f78c6[_0x2ff034(0x28c)]?.['id'];if(!_0x5c123e)throw new SDKError(ErrorCode[_0x2ff034(0x1b7)],_0x2ff034(0x261));const _0xbf6919=_0x4e3f0a[_0x2ff034(0x21c)](_0x4f1ede);if(_0xbf6919)return _0xbf6919;const _0x34527b=((async()=>{const _0x537dc7=_0x2ff034;_0x1e7d4b(_0x4f1ede,_0x65af49['rule']);const _0x27643c=generateDeterministicJourneySegmentName(_0x2f78c6[_0x537dc7(0x220)]['name'],_0x4f1ede),_0x2931df=_0x2ecc08[_0x537dc7(0x1b1)][_0x537dc7(0x1c8)](_0xa0217c=>_0xa0217c[_0x537dc7(0x1f7)]===_0x27643c),_0x58d218=createSegmentIdResolver(_0x2ecc08[_0x537dc7(0x1c1)],_0x4f1ede),_0x345180=await resolveRuleSegmentIds(_0x65af49['rule'],_0x58d218);let _0x51912f;return _0x2931df?(await _0x52f0ea[_0x537dc7(0x283)]['updateSegmentById'](_0x9153fc[_0x537dc7(0x265)],_0x2931df['id'],{'description':_0x65af49[_0x537dc7(0x206)]||_0x537dc7(0x229)+_0x4f1ede,'rule':_0x5b835e(_0x345180),'countPopulation':!![]}),_0x51912f=_0x2931df['id'],saveSegmentToPushRecovery(_0x2f78c6[_0x537dc7(0x224)],_0x2f78c6[_0x537dc7(0x220)][_0x537dc7(0x1f7)],_0x4f1ede,{'segmentId':_0x51912f,'uniqueServerName':_0x27643c,'createdAt':new Date()[_0x537dc7(0x1dd)]()})):_0x51912f=await createOrRecoverEmbeddedSegment(_0x52f0ea,_0x2f78c6,{'localName':_0x4f1ede,'uniqueSegmentName':_0x27643c,'description':_0x65af49[_0x537dc7(0x206)]||_0x537dc7(0x229)+_0x4f1ede,'journeyId':_0x5c123e,'resolvedRule':_0x345180,'parentId':_0x9153fc[_0x537dc7(0x265)],'folderId':_0x9153fc[_0x537dc7(0x1ba)]||''},_0x5b835e),_0x2ecc08[_0x537dc7(0x1c1)][_0x537dc7(0x1b0)](_0x4f1ede,_0x51912f),_0xab0f[_0x537dc7(0x1b0)](_0x4f1ede,_0x51912f),_0x51912f;})());_0x4e3f0a['set'](_0x4f1ede,_0x34527b);try{return await _0x34527b;}finally{_0x4e3f0a[_0x2ff034(0x288)](_0x4f1ede);}},'resolveActivationId':async _0x5df39c=>{const _0x2d07a6=_0x14a7fd,_0x457581=_0x563840[_0x2d07a6(0x21c)](_0x5df39c);if(_0x457581)return _0x457581;if(_0x2f78c6['existingJourney']){await _0x50f2c7();const _0xb1be7e=_0x563840['get'](_0x5df39c);if(_0xb1be7e)return _0xb1be7e;}throw new SDKError(ErrorCode[_0x2d07a6(0x1b4)],'Activation\x20not\x20found:\x20'+_0x5df39c+_0x2d07a6(0x278)+_0x2f78c6[_0x2d07a6(0x220)][_0x2d07a6(0x1f7)]+').\x20'+_0x2d07a6(0x25d));},'resolveEmbeddedActivationId':async(_0xf96f37,_0x50d764)=>{const _0x578de2=_0x14a7fd,_0x57c185=_0x563840['get'](_0xf96f37);if(_0x57c185)return _0x57c185;if(_0x2f78c6['isNew'])return _0x384818[_0x578de2(0x1b0)](_0xf96f37,_0x50d764),createPendingActivationId(_0xf96f37);if(_0x2f78c6[_0x578de2(0x28c)]){await _0x50f2c7();const _0x2b7eeb=_0x563840['get'](_0x50d764[_0x578de2(0x1f7)]);if(_0x2b7eeb)return _0x563840['set'](_0xf96f37,_0x2b7eeb),_0x2b7eeb;const _0x311157=activationSignature(_0x50d764),_0x3aeb88=_0x329930?.[_0x578de2(0x21c)](_0x311157);if(_0x3aeb88)return _0x563840[_0x578de2(0x1b0)](_0xf96f37,_0x3aeb88),_0x3aeb88;const _0x12a61f=await _0xa0a734(_0x50d764,_0x2ecc08[_0x578de2(0x1d7)]),_0x7fa917={..._0x12a61f,..._0x50d764[_0x578de2(0x252)]!==undefined&&{'runAfterJourneyRefresh':_0x50d764[_0x578de2(0x252)]}},_0x3df50b=await _0x52f0ea[_0x578de2(0x262)][_0x578de2(0x1eb)](_0x2f78c6[_0x578de2(0x28c)]['id'],_0x7fa917);return _0x563840[_0x578de2(0x1b0)](_0xf96f37,_0x3df50b['id']),_0x3df50b['id'];}throw new SDKError(ErrorCode[_0x578de2(0x1b7)],_0x578de2(0x1d2));},'resolveJourneyId':async _0x5ba2fa=>{const _0x44f7fe=_0x14a7fd;try{return await _0x52f0ea['journey'][_0x44f7fe(0x1c7)](_0x9153fc[_0x44f7fe(0x265)],_0x5ba2fa);}catch(_0x3f7511){throw new SDKError(ErrorCode[_0x44f7fe(0x1b4)],_0x44f7fe(0x1f0)+_0x5ba2fa+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x2f78c6[_0x44f7fe(0x220)]['name']+'\x27)',_0x3f7511);}},'resolveStageId':async(_0x34faf1,_0x5b9652)=>{const _0x498ce8=_0x14a7fd,_0x48f787=await _0x52f0ea[_0x498ce8(0x262)][_0x498ce8(0x256)](_0x34faf1),_0x39f03b=_0x48f787[_0x498ce8(0x1d1)][_0x498ce8(0x26f)][_0x498ce8(0x1c8)](_0x3cf717=>_0x3cf717[_0x498ce8(0x1f7)]['toLowerCase']()===_0x5b9652[_0x498ce8(0x1c3)]());if(!_0x39f03b?.['id'])throw new SDKError(ErrorCode[_0x498ce8(0x1b4)],_0x498ce8(0x267)+_0x5b9652+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x48f787[_0x498ce8(0x1d1)]['journeyBundleName']||_0x48f787[_0x498ce8(0x1d1)][_0x498ce8(0x1f7)])+'\x27');return _0x39f03b['id'];}},_0xbc168f=await _0x145029(_0x2f78c6[_0x14a7fd(0x220)],_0x9153fc[_0x14a7fd(0x265)],_0x27b826),_0x1ae8df=_0x9153fc['folderId']||_0x9153fc[_0x14a7fd(0x1ba)];_0x1ae8df&&(_0xbc168f[_0x14a7fd(0x1aa)]={'parentFolder':{'data':{'id':_0x1ae8df,'type':_0x14a7fd(0x22a)}}});if(_0x2f78c6[_0x14a7fd(0x254)]){if(_0x5b00c7[_0x14a7fd(0x22e)]>0x0||_0x384818[_0x14a7fd(0x22e)]>0x0)return await executeThreeStepJourneyCreate(_0x52f0ea,_0x2f78c6,_0xbc168f,{'pendingEmbeddedSegments':_0x5b00c7,'pendingEmbeddedActivations':_0x384818,'embeddedSegmentNameToId':_0xab0f,'journeyActivationNameToId':_0x563840},{..._0x9153fc,'effectiveFolderId':_0x1ae8df},_0x2ecc08,_0x5e0763,_0x5bad6f);else{ensureJourneyDefaults(_0xbc168f['attributes']);const _0x9bb7f3=await _0x52f0ea[_0x14a7fd(0x262)][_0x14a7fd(0x249)](_0xbc168f);return deletePushRecovery(_0x2f78c6[_0x14a7fd(0x224)]),{'action':'created','journeyId':_0x9bb7f3['id'],'embeddedSegmentNameToId':_0xab0f};}}else{if(_0x2f78c6[_0x14a7fd(0x20c)]&&_0x2f78c6[_0x14a7fd(0x28c)]){_0xbc168f['id']=_0x2f78c6[_0x14a7fd(0x28c)]['id'];const _0x5d5f79=_0xbc168f[_0x14a7fd(0x1d1)];_0x2f78c6[_0x14a7fd(0x28c)]['attributes']?.['journeyBundleName']&&(_0x5d5f79[_0x14a7fd(0x279)]=_0x2f78c6[_0x14a7fd(0x28c)][_0x14a7fd(0x1d1)][_0x14a7fd(0x279)]);const _0x9a6cf8=_0x2f78c6['existingJourney'][_0x14a7fd(0x1d1)]?.['journeyStages'];return _0x9a6cf8&&_0xbc168f['attributes']['journeyStages']&&injectExistingStageIds(_0xbc168f[_0x14a7fd(0x1d1)][_0x14a7fd(0x26f)],_0x9a6cf8),ensureJourneyDefaults(_0x5d5f79),await _0x52f0ea['journey'][_0x14a7fd(0x1d9)](_0x2f78c6[_0x14a7fd(0x28c)]['id'],_0xbc168f),deletePushRecovery(_0x2f78c6['absolutePath']),{'action':_0x14a7fd(0x1e1),'journeyId':_0x2f78c6[_0x14a7fd(0x28c)]['id'],'embeddedSegmentNameToId':_0xab0f};}}return deletePushRecovery(_0x2f78c6[_0x14a7fd(0x224)]),{'action':'unchanged','journeyId':_0x2f78c6[_0x14a7fd(0x28c)]?.['id'],'embeddedSegmentNameToId':_0xab0f};}function findSegmentCriteriaLocation(_0x52defe,_0x1ae648){const _0x1b5caa=a152_0x525dc2,_0x9c8700=_0x52defe[_0x1b5caa(0x29f)]||_0x52defe[_0x1b5caa(0x23f)]?.[0x0]?.[_0x1b5caa(0x29f)]||[];let _0x4660b4='entry',_0x2767dd=_0x1ae648;const _0x312d49=_0x52defe[_0x1b5caa(0x24a)]||_0x52defe[_0x1b5caa(0x23f)]?.[0x0]?.[_0x1b5caa(0x24a)];if(_0x312d49?.[_0x1b5caa(0x283)]===_0x1ae648)return{'stageName':_0x1b5caa(0x24a),'criteriaName':_0x312d49[_0x1b5caa(0x1f7)]||_0x1ae648};_0xf365cb:for(const _0x2bad73 of _0x9c8700){if(_0x2bad73[_0x1b5caa(0x289)]?.[_0x1b5caa(0x283)]===_0x1ae648){_0x4660b4=_0x2bad73[_0x1b5caa(0x1f7)],_0x2767dd=_0x2bad73[_0x1b5caa(0x289)][_0x1b5caa(0x1f7)]||_0x1ae648;break;}if(_0x2bad73[_0x1b5caa(0x21d)])for(const _0x722568 of _0x2bad73[_0x1b5caa(0x21d)]){if(_0x722568[_0x1b5caa(0x2a5)]===_0x1b5caa(0x1e5)&&_0x722568['with']?.[_0x1b5caa(0x1ee)])for(const _0x37f8d6 of _0x722568[_0x1b5caa(0x28e)][_0x1b5caa(0x1ee)]){if(_0x37f8d6[_0x1b5caa(0x283)]===_0x1ae648){_0x4660b4=_0x2bad73['name'],_0x2767dd=_0x37f8d6[_0x1b5caa(0x1f7)]||_0x1ae648;break _0xf365cb;}}}}return{'stageName':_0x4660b4,'criteriaName':_0x2767dd};}async function executeThreeStepJourneyCreate(_0x488bd8,_0x36ae3d,_0x479a06,_0x442636,_0x5dfe11,_0x51c553,_0x5b3f77,_0x57befa){const _0x350667=a152_0x525dc2,{activationDefToCreateRequest:_0x4758e1,yamlRuleToApi:_0x16a94e}=_0x57befa,{pendingEmbeddedSegments:_0x265f8b,pendingEmbeddedActivations:_0x1ba4e7,embeddedSegmentNameToId:_0x38b99f}=_0x442636,_0x25166f=JSON[_0x350667(0x287)](JSON[_0x350667(0x1ce)](_0x479a06));ensureJourneyDefaults(_0x25166f[_0x350667(0x1d1)]),stripPendingIds(_0x25166f);const _0x17d74b=await _0x488bd8['journey'][_0x350667(0x249)](_0x25166f),_0x4d3b38=_0x17d74b['id'],_0x1d1921=new Map();for(const _0x5cebeb of _0x17d74b[_0x350667(0x1d1)][_0x350667(0x26f)]){_0x1d1921[_0x350667(0x1b0)](_0x5cebeb[_0x350667(0x1f7)]['toLowerCase'](),_0x5cebeb['id']);}recoverSegmentIdsFromPushRecovery(_0x36ae3d,_0x38b99f,_0x51c553[_0x350667(0x1c1)]);for(const [_0x26b12c,{definition:_0x8498a1}]of _0x265f8b){if(_0x38b99f['has'](_0x26b12c)){_0x5b3f77[_0x350667(0x1ae)]?.({'type':_0x350667(0x260),'journeyName':_0x36ae3d[_0x350667(0x220)][_0x350667(0x1f7)],'segmentName':_0x26b12c});continue;}const _0x472b6d=generateDeterministicJourneySegmentName(_0x36ae3d[_0x350667(0x220)][_0x350667(0x1f7)],_0x26b12c);_0x5b3f77[_0x350667(0x1ae)]?.({'type':_0x350667(0x2a4),'journeyName':_0x36ae3d['yamlConfig']['name'],'segmentName':_0x26b12c});const _0x26af08=createSegmentIdResolver(_0x51c553['segmentNameToId'],_0x26b12c),_0x416ba2=await resolveRuleSegmentIds(_0x8498a1[_0x350667(0x290)],_0x26af08),_0x383ada=await createOrRecoverEmbeddedSegment(_0x488bd8,_0x36ae3d,{'localName':_0x26b12c,'uniqueSegmentName':_0x472b6d,'description':_0x8498a1[_0x350667(0x206)]||_0x350667(0x229)+_0x26b12c,'journeyId':_0x4d3b38,'resolvedRule':_0x416ba2,'parentId':_0x5dfe11[_0x350667(0x265)],'folderId':_0x5dfe11[_0x350667(0x29d)]||''},_0x16a94e);_0x38b99f[_0x350667(0x1b0)](_0x26b12c,_0x383ada),_0x51c553['segmentNameToId'][_0x350667(0x1b0)](_0x26b12c,_0x383ada),_0x5b3f77[_0x350667(0x1ae)]?.({'type':_0x350667(0x260),'journeyName':_0x36ae3d[_0x350667(0x220)][_0x350667(0x1f7)],'segmentName':_0x26b12c});}const _0x2f52f1=new Map();for(const [_0x4b2990,_0x58d7fd]of _0x1ba4e7){_0x5b3f77['onProgress']?.({'type':'embedded_activation_creating','journeyName':_0x36ae3d['yamlConfig'][_0x350667(0x1f7)],'activationName':_0x4b2990});const _0x17c7e0=await _0x4758e1(_0x58d7fd,_0x51c553[_0x350667(0x1d7)]),_0x202eca={..._0x17c7e0,..._0x58d7fd[_0x350667(0x252)]!==undefined&&{'runAfterJourneyRefresh':_0x58d7fd[_0x350667(0x252)]}},_0x1df4f8=await _0x488bd8[_0x350667(0x262)][_0x350667(0x1eb)](_0x4d3b38,_0x202eca);_0x2f52f1['set'](_0x4b2990,_0x1df4f8['id']),_0x442636[_0x350667(0x28b)][_0x350667(0x1b0)](_0x4b2990,_0x1df4f8['id']),_0x5b3f77[_0x350667(0x1ae)]?.({'type':_0x350667(0x202),'journeyName':_0x36ae3d[_0x350667(0x220)][_0x350667(0x1f7)],'activationName':_0x4b2990});}const _0x3618d3=JSON[_0x350667(0x287)](JSON[_0x350667(0x1ce)](_0x479a06));return _0x3618d3['id']=_0x4d3b38,ensureJourneyDefaults(_0x3618d3[_0x350667(0x1d1)]),resolvePendingIdsInRequest(_0x3618d3,_0x479a06,_0x1d1921,_0x38b99f,_0x2f52f1,_0x5b3f77),await _0x488bd8[_0x350667(0x262)]['update'](_0x4d3b38,_0x3618d3),deletePushRecovery(_0x36ae3d['absolutePath']),{'action':_0x350667(0x1d0),'journeyId':_0x4d3b38,'embeddedSegmentNameToId':_0x38b99f};}export function stripWaitStepPendingIds(_0x303917){const _0x3bcc9e=a152_0x525dc2,_0x4b05f0=_0x303917[_0x3bcc9e(0x212)]&&isPendingSegmentId(_0x303917[_0x3bcc9e(0x212)]),_0x370ee1=_0x303917[_0x3bcc9e(0x227)]?.[_0x3bcc9e(0x272)](_0x25dea4=>_0x25dea4[_0x3bcc9e(0x23c)]&&isPendingSegmentId(_0x25dea4[_0x3bcc9e(0x23c)]));(_0x4b05f0||_0x370ee1)&&(_0x303917['waitStepType']=_0x3bcc9e(0x207),_0x303917[_0x3bcc9e(0x1fa)]=0x1,_0x303917[_0x3bcc9e(0x29b)]=_0x3bcc9e(0x276),delete _0x303917[_0x3bcc9e(0x212)],delete _0x303917['conditionTimeoutDuration'],delete _0x303917[_0x3bcc9e(0x1bf)],delete _0x303917[_0x3bcc9e(0x227)]);}export function resolveWaitStepPendingIds(_0x56eb51,_0x25e24c,_0x3d4cdb,_0x254faa){const _0x5cf525=a152_0x525dc2;if(_0x25e24c[_0x5cf525(0x212)]&&isPendingSegmentId(_0x25e24c['conditionSegmentId'])){const _0x45b9cb=_0x3d4cdb(_0x25e24c[_0x5cf525(0x212)],_0x5cf525(0x231)+_0x254faa+_0x5cf525(0x21f));_0x45b9cb&&(_0x56eb51[_0x5cf525(0x235)]=_0x5cf525(0x1ca),_0x56eb51[_0x5cf525(0x212)]=_0x45b9cb,delete _0x56eb51['waitStep'],delete _0x56eb51[_0x5cf525(0x29b)],_0x25e24c[_0x5cf525(0x29c)]!==undefined&&(_0x56eb51[_0x5cf525(0x29c)]=_0x25e24c[_0x5cf525(0x29c)]),_0x25e24c[_0x5cf525(0x1bf)]&&(_0x56eb51[_0x5cf525(0x1bf)]=_0x25e24c[_0x5cf525(0x1bf)]));}if(_0x25e24c[_0x5cf525(0x227)]){const _0x31e755=_0x25e24c['conditions'][_0x5cf525(0x272)](_0x2d7983=>_0x2d7983[_0x5cf525(0x23c)]&&isPendingSegmentId(_0x2d7983[_0x5cf525(0x23c)]));if(_0x31e755){const _0x3acd24=_0x25e24c[_0x5cf525(0x227)][_0x5cf525(0x237)](_0xd39841=>{const _0x4832d8=_0x5cf525;if(_0xd39841['segmentId']&&isPendingSegmentId(_0xd39841[_0x4832d8(0x23c)])){const _0x2b59b1=_0x3d4cdb(_0xd39841[_0x4832d8(0x23c)],_0x4832d8(0x231)+_0x254faa+_0x4832d8(0x21f));return{..._0xd39841,'segmentId':_0x2b59b1||_0xd39841[_0x4832d8(0x23c)]};}return{..._0xd39841};});_0x56eb51['waitStepType']=_0x5cf525(0x1ca),_0x56eb51[_0x5cf525(0x227)]=_0x3acd24,delete _0x56eb51['waitStep'],delete _0x56eb51[_0x5cf525(0x29b)],delete _0x56eb51[_0x5cf525(0x212)],delete _0x56eb51['conditionTimeoutDuration'],delete _0x56eb51['conditionTimeoutUnit'];}}}function stripPendingIds(_0x1b250c){const _0x15e443=a152_0x525dc2;_0x1b250c[_0x15e443(0x1d1)]['goal']?.[_0x15e443(0x23c)]&&isPendingSegmentId(_0x1b250c['attributes'][_0x15e443(0x24a)][_0x15e443(0x23c)])&&delete _0x1b250c[_0x15e443(0x1d1)]['goal'];for(const _0x4e6e5b of _0x1b250c[_0x15e443(0x1d1)][_0x15e443(0x26f)]||[]){_0x4e6e5b[_0x15e443(0x1c0)]?.[_0x15e443(0x23c)]&&isPendingSegmentId(_0x4e6e5b[_0x15e443(0x1c0)][_0x15e443(0x23c)])&&delete _0x4e6e5b[_0x15e443(0x1c0)];_0x4e6e5b[_0x15e443(0x284)]?.['segmentId']&&isPendingSegmentId(_0x4e6e5b[_0x15e443(0x284)][_0x15e443(0x23c)])&&delete _0x4e6e5b[_0x15e443(0x284)];_0x4e6e5b['exitCriterias']&&(_0x4e6e5b[_0x15e443(0x22c)]=_0x4e6e5b[_0x15e443(0x22c)]['filter'](_0x229828=>!_0x229828[_0x15e443(0x23c)]||!isPendingSegmentId(_0x229828[_0x15e443(0x23c)])));if(_0x4e6e5b[_0x15e443(0x21d)])for(const _0x549d9c of Object[_0x15e443(0x255)](_0x4e6e5b[_0x15e443(0x21d)])){const _0xf1c145=_0x4e6e5b['steps'][_0x549d9c];_0xf1c145['type']===_0x15e443(0x250)&&_0xf1c145[_0x15e443(0x213)]&&isPendingActivationId(_0xf1c145[_0x15e443(0x213)])&&(_0xf1c145[_0x15e443(0x213)]='');if(_0xf1c145['type']===_0x15e443(0x25a)&&_0xf1c145[_0x15e443(0x1ee)])for(const _0x1a1f88 of _0xf1c145[_0x15e443(0x1ee)]){_0x1a1f88[_0x15e443(0x23c)]&&isPendingSegmentId(_0x1a1f88['segmentId'])&&(_0x1a1f88['segmentId']='');}_0xf1c145[_0x15e443(0x2a5)]===_0x15e443(0x26a)&&stripWaitStepPendingIds(_0xf1c145);}}}function resolvePendingIdsInRequest(_0x4e8050,_0x3b8ba8,_0x309fae,_0x1fe980,_0x50cf3d,_0x5695c8){const _0x55becb=a152_0x525dc2,_0x2a7c5c=(_0x67fb78,_0x360222)=>{const _0x3247b6=a152_0x4bae;if(!isPendingSegmentId(_0x67fb78))return _0x67fb78;const _0xe442e7=extractPendingSegmentName(_0x67fb78),_0x16da8d=_0x1fe980[_0x3247b6(0x21c)](_0xe442e7);return!_0x16da8d&&_0x5695c8[_0x3247b6(0x1b5)]?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0xe442e7+_0x3247b6(0x223)+_0x360222),_0x16da8d;};if(_0x4e8050[_0x55becb(0x1d1)][_0x55becb(0x24a)]?.[_0x55becb(0x23c)]&&isPendingSegmentId(_0x4e8050['attributes']['goal'][_0x55becb(0x23c)])){const _0x33dc15=_0x2a7c5c(_0x4e8050['attributes'][_0x55becb(0x24a)]['segmentId'],_0x55becb(0x26e));_0x33dc15&&(_0x4e8050['attributes'][_0x55becb(0x24a)]['segmentId']=_0x33dc15);}for(const _0x445a03 of _0x4e8050[_0x55becb(0x1d1)][_0x55becb(0x26f)]||[]){const _0x296573=_0x309fae[_0x55becb(0x21c)](_0x445a03[_0x55becb(0x1f7)][_0x55becb(0x1c3)]());_0x296573&&(_0x445a03['id']=_0x296573);if(_0x445a03[_0x55becb(0x1c0)]?.['segmentId']&&isPendingSegmentId(_0x445a03['entryCriteria'][_0x55becb(0x23c)])){const _0x14cfcc=_0x2a7c5c(_0x445a03[_0x55becb(0x1c0)][_0x55becb(0x23c)],_0x55becb(0x231)+_0x445a03[_0x55becb(0x1f7)]+'\x27\x20entry\x20criteria');_0x14cfcc&&(_0x445a03['entryCriteria'][_0x55becb(0x23c)]=_0x14cfcc);}if(_0x445a03[_0x55becb(0x22c)])for(const _0xf1709e of _0x445a03[_0x55becb(0x22c)]){if(_0xf1709e[_0x55becb(0x23c)]&&isPendingSegmentId(_0xf1709e[_0x55becb(0x23c)])){const _0x23ec67=_0x2a7c5c(_0xf1709e[_0x55becb(0x23c)],_0x55becb(0x231)+_0x445a03[_0x55becb(0x1f7)]+_0x55becb(0x1fb));_0x23ec67&&(_0xf1709e[_0x55becb(0x23c)]=_0x23ec67);}}if(_0x445a03['milestone']?.['segmentId']&&isPendingSegmentId(_0x445a03[_0x55becb(0x284)][_0x55becb(0x23c)])){const _0x242c9d=_0x2a7c5c(_0x445a03[_0x55becb(0x284)][_0x55becb(0x23c)],_0x55becb(0x231)+_0x445a03[_0x55becb(0x1f7)]+'\x27\x20milestone');_0x242c9d&&(_0x445a03[_0x55becb(0x284)]['segmentId']=_0x242c9d);}if(_0x445a03[_0x55becb(0x21d)]){const _0x493f41=_0x43d67f=>_0x3b8ba8[_0x55becb(0x1d1)][_0x55becb(0x26f)]?.['find'](_0x530d76=>_0x530d76[_0x55becb(0x1f7)]['toLowerCase']()===_0x445a03[_0x55becb(0x1f7)]['toLowerCase']())?.[_0x55becb(0x21d)]?.[_0x43d67f];for(const _0xfcc8ab of Object[_0x55becb(0x255)](_0x445a03[_0x55becb(0x21d)])){const _0x19a375=_0x445a03[_0x55becb(0x21d)][_0xfcc8ab],_0x40499e=_0x493f41(_0xfcc8ab);if(_0x19a375[_0x55becb(0x2a5)]==='Activation'&&_0x19a375[_0x55becb(0x213)]&&(isPendingActivationId(_0x19a375['journeyActivationStepId'])||_0x19a375[_0x55becb(0x213)]==='')){if(_0x40499e?.[_0x55becb(0x213)]&&isPendingActivationId(_0x40499e['journeyActivationStepId'])){const _0x2b25e4=extractPendingActivationName(_0x40499e[_0x55becb(0x213)]),_0x1a6c2c=_0x50cf3d[_0x55becb(0x21c)](_0x2b25e4);_0x1a6c2c&&(_0x19a375[_0x55becb(0x213)]=_0x1a6c2c);}}if(_0x19a375[_0x55becb(0x2a5)]==='DecisionPoint'&&_0x19a375[_0x55becb(0x1ee)]&&_0x40499e?.[_0x55becb(0x1ee)])for(let _0xef446=0x0;_0xef446<_0x19a375[_0x55becb(0x1ee)]['length'];_0xef446++){const _0x18ffd9=_0x19a375['branches'][_0xef446],_0x5e71c2=_0x40499e[_0x55becb(0x1ee)][_0xef446];if(_0x5e71c2?.[_0x55becb(0x23c)]&&isPendingSegmentId(_0x5e71c2[_0x55becb(0x23c)])){const _0x261a54=_0x2a7c5c(_0x5e71c2[_0x55becb(0x23c)],_0x55becb(0x231)+_0x445a03[_0x55becb(0x1f7)]+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x18ffd9[_0x55becb(0x1f7)]||_0xef446)+'\x27');_0x261a54&&(_0x18ffd9['segmentId']=_0x261a54);}}_0x19a375['type']===_0x55becb(0x26a)&&_0x40499e?.['type']===_0x55becb(0x26a)&&resolveWaitStepPendingIds(_0x19a375,_0x40499e,_0x2a7c5c,_0x445a03[_0x55becb(0x1f7)]);}}}}
@@ -1 +1 @@
1
- function a153_0x4b01(_0x352cbd,_0x24c70b){_0x352cbd=_0x352cbd-0x151;const _0x4aa0e8=a153_0x4aa0();let _0x4b0139=_0x4aa0e8[_0x352cbd];return _0x4b0139;}(function(_0x41132,_0x69a0e1){const _0x3ebf6a=a153_0x4b01,_0x339488=_0x41132();while(!![]){try{const _0xaf74e1=parseInt(_0x3ebf6a(0x160))/0x1*(parseInt(_0x3ebf6a(0x153))/0x2)+-parseInt(_0x3ebf6a(0x15a))/0x3*(-parseInt(_0x3ebf6a(0x15e))/0x4)+-parseInt(_0x3ebf6a(0x15f))/0x5*(parseInt(_0x3ebf6a(0x161))/0x6)+-parseInt(_0x3ebf6a(0x154))/0x7*(-parseInt(_0x3ebf6a(0x156))/0x8)+-parseInt(_0x3ebf6a(0x15c))/0x9+parseInt(_0x3ebf6a(0x15d))/0xa*(parseInt(_0x3ebf6a(0x15b))/0xb)+-parseInt(_0x3ebf6a(0x155))/0xc*(parseInt(_0x3ebf6a(0x162))/0xd);if(_0xaf74e1===_0x69a0e1)break;else _0x339488['push'](_0x339488['shift']());}catch(_0x30f756){_0x339488['push'](_0x339488['shift']());}}}(a153_0x4aa0,0xf0cd6));export function buildFolderIdToPathMap(_0x348ee8){const _0x32e558=a153_0x4b01,_0x434eff=new Map(),_0x58baba=new Map();for(const _0x4a75ba of _0x348ee8){_0x58baba[_0x32e558(0x157)](_0x4a75ba['id'],_0x4a75ba);}const _0x2ef00b=new Set();for(const _0x32053d of _0x348ee8){!_0x32053d[_0x32e558(0x163)]&&_0x2ef00b[_0x32e558(0x159)](_0x32053d['id']);}function _0x2cb6c0(_0x666463){const _0x363b3b=_0x32e558;if(_0x434eff[_0x363b3b(0x158)](_0x666463['id']))return _0x434eff['get'](_0x666463['id']);if(_0x2ef00b[_0x363b3b(0x158)](_0x666463['id']))return _0x434eff[_0x363b3b(0x157)](_0x666463['id'],''),'';if(_0x666463[_0x363b3b(0x163)]){const _0x244411=_0x58baba[_0x363b3b(0x152)](_0x666463['parentFolderId']);if(_0x244411){const _0x3954ee=_0x2cb6c0(_0x244411),_0x360d6f=_0x3954ee?_0x3954ee+'/'+_0x666463[_0x363b3b(0x151)]:_0x666463[_0x363b3b(0x151)];return _0x434eff[_0x363b3b(0x157)](_0x666463['id'],_0x360d6f),_0x360d6f;}}const _0x17efe0=_0x666463[_0x363b3b(0x151)];return _0x434eff[_0x363b3b(0x157)](_0x666463['id'],_0x17efe0),_0x17efe0;}for(const _0x498402 of _0x348ee8){_0x2cb6c0(_0x498402);}return _0x434eff;}function a153_0x4aa0(){const _0xa6b7fc=['2814gpOsYG','161004WADCUM','32512MmKvuv','set','has','add','3qsTUvk','11XuiVve','4778370BbtswF','4263920WANqPg','4751392EDzEFu','9494330OPSsTb','697FBIPXP','6tbblmp','143hPgVYo','parentFolderId','name','get','906mfGIoH'];a153_0x4aa0=function(){return _0xa6b7fc;};return a153_0x4aa0();}export function buildFolderPathToIdMap(_0x2ffdb6){const _0x139865=a153_0x4b01,_0x44fffc=new Map(),_0x1583a5=new Map();for(const _0x55a21e of _0x2ffdb6){_0x1583a5['set'](_0x55a21e['id'],_0x55a21e);}const _0x5b2ce7=new Set();for(const _0x41ac3d of _0x2ffdb6){!_0x41ac3d[_0x139865(0x163)]&&_0x5b2ce7[_0x139865(0x159)](_0x41ac3d['id']);}function _0x4823b8(_0x3450fd){const _0x2a87c2=_0x139865;if(_0x5b2ce7[_0x2a87c2(0x158)](_0x3450fd['id']))return'';if(_0x3450fd[_0x2a87c2(0x163)]){const _0x4eaf7a=_0x1583a5[_0x2a87c2(0x152)](_0x3450fd[_0x2a87c2(0x163)]);if(_0x4eaf7a){const _0x2949a5=_0x4823b8(_0x4eaf7a);return _0x2949a5?_0x2949a5+'/'+_0x3450fd[_0x2a87c2(0x151)]:_0x3450fd[_0x2a87c2(0x151)];}}return _0x3450fd['name'];}for(const _0x349d2d of _0x2ffdb6){const _0x1aecdd=_0x4823b8(_0x349d2d);_0x44fffc[_0x139865(0x157)](_0x1aecdd,_0x349d2d['id']);}return _0x44fffc;}export function buildFolderMaps(_0x274869){const _0x3efb7f=a153_0x4b01,_0x2cf99b=buildFolderIdToPathMap(_0x274869),_0xf760eb=new Map();for(const [_0xe5db2,_0x5ce2a8]of _0x2cf99b){_0xf760eb[_0x3efb7f(0x157)](_0x5ce2a8,_0xe5db2);}return{'idToPath':_0x2cf99b,'pathToId':_0xf760eb};}export function getFolderPath(_0xe8cf0b,_0x267424){const _0x3731ea=a153_0x4b01;if(!_0xe8cf0b)return'';return _0x267424[_0x3731ea(0x152)](_0xe8cf0b)??'';}
1
+ (function(_0x2ff2fa,_0x7cf32b){const _0x5b76c1=a153_0x5f8c,_0x46fec6=_0x2ff2fa();while(!![]){try{const _0x1090c7=parseInt(_0x5b76c1(0x189))/0x1*(parseInt(_0x5b76c1(0x18e))/0x2)+-parseInt(_0x5b76c1(0x195))/0x3*(parseInt(_0x5b76c1(0x185))/0x4)+-parseInt(_0x5b76c1(0x18b))/0x5*(parseInt(_0x5b76c1(0x184))/0x6)+parseInt(_0x5b76c1(0x193))/0x7*(-parseInt(_0x5b76c1(0x192))/0x8)+parseInt(_0x5b76c1(0x188))/0x9+-parseInt(_0x5b76c1(0x196))/0xa*(parseInt(_0x5b76c1(0x18a))/0xb)+parseInt(_0x5b76c1(0x190))/0xc*(parseInt(_0x5b76c1(0x18f))/0xd);if(_0x1090c7===_0x7cf32b)break;else _0x46fec6['push'](_0x46fec6['shift']());}catch(_0x146937){_0x46fec6['push'](_0x46fec6['shift']());}}}(a153_0x12fc,0x78b92));export function buildFolderIdToPathMap(_0x8b32d7){const _0x300905=a153_0x5f8c,_0x4407fc=new Map(),_0x5b5fae=new Map();for(const _0x58d479 of _0x8b32d7){_0x5b5fae['set'](_0x58d479['id'],_0x58d479);}const _0x39c252=new Set();for(const _0x5b2f33 of _0x8b32d7){!_0x5b2f33['parentFolderId']&&_0x39c252[_0x300905(0x194)](_0x5b2f33['id']);}function _0x310e79(_0xb3170c){const _0x51041e=_0x300905;if(_0x4407fc[_0x51041e(0x191)](_0xb3170c['id']))return _0x4407fc['get'](_0xb3170c['id']);if(_0x39c252['has'](_0xb3170c['id']))return _0x4407fc[_0x51041e(0x18d)](_0xb3170c['id'],''),'';if(_0xb3170c[_0x51041e(0x186)]){const _0x25146d=_0x5b5fae[_0x51041e(0x18c)](_0xb3170c[_0x51041e(0x186)]);if(_0x25146d){const _0x1eb114=_0x310e79(_0x25146d),_0x4cc0de=_0x1eb114?_0x1eb114+'/'+_0xb3170c[_0x51041e(0x187)]:_0xb3170c[_0x51041e(0x187)];return _0x4407fc[_0x51041e(0x18d)](_0xb3170c['id'],_0x4cc0de),_0x4cc0de;}}const _0x36959a=_0xb3170c[_0x51041e(0x187)];return _0x4407fc[_0x51041e(0x18d)](_0xb3170c['id'],_0x36959a),_0x36959a;}for(const _0x4f6bef of _0x8b32d7){_0x310e79(_0x4f6bef);}return _0x4407fc;}export function buildFolderPathToIdMap(_0x5df35b){const _0x2bcb04=a153_0x5f8c,_0x30116c=new Map(),_0x4b590c=new Map();for(const _0x4a3644 of _0x5df35b){_0x4b590c['set'](_0x4a3644['id'],_0x4a3644);}const _0x184372=new Set();for(const _0x23044d of _0x5df35b){!_0x23044d[_0x2bcb04(0x186)]&&_0x184372['add'](_0x23044d['id']);}function _0x5dd8e3(_0x31f0b7){const _0x2e259b=_0x2bcb04;if(_0x184372[_0x2e259b(0x191)](_0x31f0b7['id']))return'';if(_0x31f0b7[_0x2e259b(0x186)]){const _0x10a3e=_0x4b590c[_0x2e259b(0x18c)](_0x31f0b7[_0x2e259b(0x186)]);if(_0x10a3e){const _0x5ba876=_0x5dd8e3(_0x10a3e);return _0x5ba876?_0x5ba876+'/'+_0x31f0b7[_0x2e259b(0x187)]:_0x31f0b7[_0x2e259b(0x187)];}}return _0x31f0b7[_0x2e259b(0x187)];}for(const _0x11dd17 of _0x5df35b){const _0x480e5d=_0x5dd8e3(_0x11dd17);_0x30116c[_0x2bcb04(0x18d)](_0x480e5d,_0x11dd17['id']);}return _0x30116c;}export function buildFolderMaps(_0x4280f9){const _0x34dea7=buildFolderIdToPathMap(_0x4280f9),_0x4349a0=new Map();for(const [_0x5b8f0a,_0x3dffe7]of _0x34dea7){_0x4349a0['set'](_0x3dffe7,_0x5b8f0a);}return{'idToPath':_0x34dea7,'pathToId':_0x4349a0};}export function getFolderPath(_0xbff6fb,_0x3a0f8d){const _0x3644f0=a153_0x5f8c;if(!_0xbff6fb)return'';return _0x3a0f8d[_0x3644f0(0x18c)](_0xbff6fb)??'';}function a153_0x5f8c(_0x5b8810,_0xa19935){_0x5b8810=_0x5b8810-0x184;const _0x12fcc2=a153_0x12fc();let _0x5f8ca3=_0x12fcc2[_0x5b8810];return _0x5f8ca3;}function a153_0x12fc(){const _0x2fc2ee=['has','8fZrMfY','4141865VGSgyK','add','2586xTcWKs','9836470tTrsEq','3113850YUQRFS','508cHvOsH','parentFolderId','name','4359483RXqNFj','75FhmlDl','11gGQgAq','5ljShhS','get','set','5062EdhESX','674687ZfFmQR','468dgjIhJ'];a153_0x12fc=function(){return _0x2fc2ee;};return a153_0x12fc();}
@@ -1 +1 @@
1
- (function(_0x25fd7e,_0x18ed25){const _0x3eb242=a154_0x5b6b,_0xba7662=_0x25fd7e();while(!![]){try{const _0x4d340c=-parseInt(_0x3eb242(0x1bf))/0x1*(-parseInt(_0x3eb242(0x1c6))/0x2)+parseInt(_0x3eb242(0x1d9))/0x3*(parseInt(_0x3eb242(0x1cb))/0x4)+parseInt(_0x3eb242(0x1d3))/0x5*(parseInt(_0x3eb242(0x1b6))/0x6)+-parseInt(_0x3eb242(0x1c9))/0x7*(-parseInt(_0x3eb242(0x1bc))/0x8)+-parseInt(_0x3eb242(0x1d6))/0x9+parseInt(_0x3eb242(0x1bb))/0xa+parseInt(_0x3eb242(0x1cc))/0xb*(-parseInt(_0x3eb242(0x1d4))/0xc);if(_0x4d340c===_0x18ed25)break;else _0xba7662['push'](_0xba7662['shift']());}catch(_0x43fdcf){_0xba7662['push'](_0xba7662['shift']());}}}(a154_0x4b55,0x2d062));import a154_0x500fad from'path';import{parse as a154_0x5b9147}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0xd532a1){const _0x514808=a154_0x5b6b;if(!_0xd532a1||_0xd532a1['trim']()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0x11180c=_0xd532a1[_0x514808(0x1ca)]();if(_0x11180c==='/')return{'segments':[],'isAbsolute':!![],'raw':_0xd532a1};const _0x4069af=_0x11180c[_0x514808(0x1db)]('/')?_0x11180c[_0x514808(0x1be)](0x1):_0x11180c,_0x23870b=_0x4069af[_0x514808(0x1b0)]('/')['filter'](_0x30f192=>_0x30f192!=='');if(_0x23870b[_0x514808(0x1d7)]===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x10e853=_0x11180c[_0x514808(0x1db)]('/')||!isRelativePathSegment(_0x23870b[0x0]);for(const _0xd23168 of _0x23870b){validatePathSegment(_0xd23168);}return{'segments':_0x23870b,'isAbsolute':_0x10e853,'raw':_0xd532a1};}function isRelativePathSegment(_0x215fb2){return _0x215fb2==='.'||_0x215fb2==='..';}function validatePathSegment(_0x87a927){const _0x4ef627=a154_0x5b6b;if(_0x87a927==='')throw new Error(_0x4ef627(0x1cd));if(_0x87a927==='.'||_0x87a927==='..')return;if(/[\x00-\x1F\x7F]/[_0x4ef627(0x1ae)](_0x87a927))throw new Error(_0x4ef627(0x1c0)+_0x87a927);if(_0x87a927!==_0x87a927[_0x4ef627(0x1ca)]()){}}export function validatePath(_0x455bb9){const _0x51e644=a154_0x5b6b;if(_0x455bb9['segments']['length']===0x0&&!_0x455bb9[_0x51e644(0x1c7)])throw new Error(_0x51e644(0x1ba));if(_0x455bb9[_0x51e644(0x1c7)]){if(_0x455bb9[_0x51e644(0x1ce)][0x0]==='..')throw new Error(_0x51e644(0x1bd));let _0x565a79=0x0;for(const _0x100b86 of _0x455bb9[_0x51e644(0x1ce)]){if(_0x100b86==='..'){if(_0x565a79===0x0)throw new Error(_0x51e644(0x1c4));_0x565a79--;}else _0x100b86!=='.'&&_0x565a79++;}}}export function joinPaths(_0x39524b,_0x41d38c){const _0x4f40db=a154_0x5b6b;if(!_0x39524b||_0x39524b==='/')return _0x41d38c;if(!_0x41d38c||_0x41d38c==='.')return _0x39524b;if(_0x41d38c[_0x4f40db(0x1db)]('/'))return _0x41d38c;const _0x164f65=parsePath(_0x39524b),_0xcef18d=parsePath(_0x41d38c),_0xd2c2e9=[..._0x164f65['segments']];for(const _0x4b353c of _0xcef18d['segments']){if(_0x4b353c==='.')continue;else{if(_0x4b353c==='..'){if(_0xd2c2e9[_0x4f40db(0x1d7)]===0x0)throw new Error(_0x4f40db(0x1d5));_0xd2c2e9[_0x4f40db(0x1da)]();}else _0xd2c2e9[_0x4f40db(0x1c3)](_0x4b353c);}}const _0x2ecb2a=_0xd2c2e9[_0x4f40db(0x1b8)]('/');return _0x164f65[_0x4f40db(0x1cf)][_0x4f40db(0x1db)]('/')?'/'+_0x2ecb2a:_0x2ecb2a;}export function normalizePath(_0x1aee34){const _0x4246b3=a154_0x5b6b,_0x3b3e17=parsePath(_0x1aee34),_0x49469c=[];for(const _0x5c1684 of _0x3b3e17['segments']){if(_0x5c1684==='.')continue;else{if(_0x5c1684==='..'){if(_0x49469c['length']===0x0){if(_0x3b3e17[_0x4246b3(0x1c7)])throw new Error(_0x4246b3(0x1d5));_0x49469c['push']('..');}else _0x49469c[_0x49469c[_0x4246b3(0x1d7)]-0x1]==='..'?_0x49469c[_0x4246b3(0x1c3)]('..'):_0x49469c[_0x4246b3(0x1da)]();}else _0x49469c[_0x4246b3(0x1c3)](_0x5c1684);}}if(_0x49469c[_0x4246b3(0x1d7)]===0x0)return _0x3b3e17['isAbsolute']?'/':'.';const _0x26b5d4=_0x49469c[_0x4246b3(0x1b8)]('/');return _0x3b3e17[_0x4246b3(0x1cf)][_0x4246b3(0x1db)]('/')?'/'+_0x26b5d4:_0x26b5d4;}export function getParentPath(_0x3680ed){const _0x3c5029=a154_0x5b6b,_0x27e50c=parsePath(_0x3680ed);if(_0x27e50c['segments']['length']<=0x1)return'/';const _0xa968b3=_0x27e50c[_0x3c5029(0x1ce)][_0x3c5029(0x1b1)](0x0,-0x1)['join']('/');return _0x27e50c[_0x3c5029(0x1cf)][_0x3c5029(0x1db)]('/')?'/'+_0xa968b3:_0xa968b3;}function a154_0x4b55(){const _0x3038bc=['name','Relative\x20path\x20cannot\x20be\x20empty','781870wnXBun','1744kEYEmD','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','substring','9SoKHlG','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','tdx.json','parse','push','Path\x20attempts\x20to\x20navigate\x20above\x20root','endsWith','8522rSSFQz','isAbsolute','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','4221cAZBEs','trim','1247012OXbnZE','11KJdgCF','Path\x20segment\x20cannot\x20be\x20empty','segments','raw','replace','journey','exists','15mSRWKh','5448372fpdUgZ','Cannot\x20navigate\x20above\x20root','37359qYaPZZ','length','readFile','3lqDGmd','pop','startsWith','relative','test','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','split','slice','No\x20tdx.json\x20found\x20for\x20file:\x20','dirname','.yml','.yaml','165714bqlCnB','parent_segment','join'];a154_0x4b55=function(){return _0x3038bc;};return a154_0x4b55();}export function getBaseName(_0xffed53){const _0x11a99c=a154_0x5b6b,_0x3e23d1=parsePath(_0xffed53);return _0x3e23d1[_0x11a99c(0x1ce)][_0x3e23d1[_0x11a99c(0x1ce)]['length']-0x1]||'';}function a154_0x5b6b(_0x547a6e,_0x16317e){_0x547a6e=_0x547a6e-0x1ae;const _0x4b5577=a154_0x4b55();let _0x5b6b79=_0x4b5577[_0x547a6e];return _0x5b6b79;}export function isChildPath(_0x3c0834,_0x1c9fca){const _0x259d23=a154_0x5b6b,_0x5383cc=parsePath(_0x3c0834),_0x2abd69=parsePath(_0x1c9fca);if(_0x5383cc['segments'][_0x259d23(0x1d7)]<=_0x2abd69[_0x259d23(0x1ce)][_0x259d23(0x1d7)])return![];for(let _0xa732d5=0x0;_0xa732d5<_0x2abd69[_0x259d23(0x1ce)][_0x259d23(0x1d7)];_0xa732d5++){if(_0x5383cc[_0x259d23(0x1ce)][_0xa732d5]!==_0x2abd69['segments'][_0xa732d5])return![];}return!![];}export function splitPath(_0x1d3ebe){const _0xd4b8bf=a154_0x5b6b,_0x2ca187=parsePath(_0x1d3ebe);if(_0x2ca187['segments'][_0xd4b8bf(0x1d7)]===0x0)throw new Error('Cannot\x20split\x20empty\x20path');if(_0x2ca187[_0xd4b8bf(0x1ce)][_0xd4b8bf(0x1d7)]===0x1)return{'parent':_0x2ca187[_0xd4b8bf(0x1ce)][0x0]};return{'parent':_0x2ca187['segments'][0x0],'child':_0x2ca187[_0xd4b8bf(0x1ce)][_0xd4b8bf(0x1b1)](0x1)[_0xd4b8bf(0x1b8)]('/')};}export function isYamlFilePath(_0x39ac39){const _0xa59700=a154_0x5b6b;return _0x39ac39[_0xa59700(0x1c5)](_0xa59700(0x1b4))||_0x39ac39[_0xa59700(0x1c5)](_0xa59700(0x1b5));}export async function resolveYamlFilePath(_0x5ea606,_0x1f829c=nodeFileSystem){const _0x330dda=a154_0x5b6b,_0x48c01b=a154_0x500fad['resolve'](_0x5ea606);if(!await _0x1f829c[_0x330dda(0x1d2)](_0x48c01b))throw new Error('File\x20not\x20found:\x20'+_0x5ea606);let _0x3c2751=a154_0x500fad[_0x330dda(0x1b3)](_0x48c01b),_0x452937=null,_0x2a4a2c=null;const _0x29f0ba=a154_0x500fad[_0x330dda(0x1c2)](_0x3c2751)['root'];while(_0x3c2751!==_0x29f0ba){const _0x208894=a154_0x500fad['join'](_0x3c2751,_0x330dda(0x1c1));if(await _0x1f829c[_0x330dda(0x1d2)](_0x208894)){_0x452937=_0x208894,_0x2a4a2c=_0x3c2751;break;}_0x3c2751=a154_0x500fad[_0x330dda(0x1b3)](_0x3c2751);}if(!_0x452937||!_0x2a4a2c)throw new Error(_0x330dda(0x1b2)+_0x5ea606+'\x0a'+'Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.');const _0x2b5153=await _0x1f829c[_0x330dda(0x1d8)](_0x452937),_0x467032=JSON[_0x330dda(0x1c2)](_0x2b5153),_0x53c824=_0x467032[_0x330dda(0x1b7)];if(!_0x53c824)throw new Error(_0x330dda(0x1af));const _0x56ad54=await _0x1f829c[_0x330dda(0x1d8)](_0x48c01b),_0x439cfb=a154_0x5b9147(_0x56ad54),_0x38ac33=_0x439cfb[_0x330dda(0x1b9)];if(!_0x38ac33)throw new Error(_0x330dda(0x1c8)+_0x5ea606);const _0x14fcb7=_0x439cfb['type']===_0x330dda(0x1d1)?_0x330dda(0x1d1):'segment',_0x8607d1=a154_0x500fad[_0x330dda(0x1dc)](_0x2a4a2c,_0x48c01b),_0x114241=a154_0x500fad[_0x330dda(0x1b3)](_0x8607d1),_0x469072=_0x114241==='.'?'':_0x114241[_0x330dda(0x1d0)](/\\/g,'/'),_0x4335da=_0x469072?_0x53c824+'/'+_0x469072+'/'+_0x38ac33:_0x53c824+'/'+_0x38ac33;return{'parentSegment':_0x53c824,'segmentName':_0x38ac33,'folderPath':_0x469072,'fullPath':_0x4335da,'resourceType':_0x14fcb7,'content':_0x56ad54};}
1
+ (function(_0x1fd062,_0x4961d4){const _0x3a1326=a154_0x1de0,_0x3373c4=_0x1fd062();while(!![]){try{const _0x46fd01=-parseInt(_0x3a1326(0xfe))/0x1*(parseInt(_0x3a1326(0x103))/0x2)+-parseInt(_0x3a1326(0x11e))/0x3+-parseInt(_0x3a1326(0x121))/0x4*(-parseInt(_0x3a1326(0x107))/0x5)+parseInt(_0x3a1326(0x10d))/0x6*(-parseInt(_0x3a1326(0x106))/0x7)+parseInt(_0x3a1326(0x122))/0x8*(parseInt(_0x3a1326(0x11b))/0x9)+-parseInt(_0x3a1326(0xf3))/0xa*(parseInt(_0x3a1326(0x112))/0xb)+parseInt(_0x3a1326(0x10f))/0xc;if(_0x46fd01===_0x4961d4)break;else _0x3373c4['push'](_0x3373c4['shift']());}catch(_0x21b646){_0x3373c4['push'](_0x3373c4['shift']());}}}(a154_0x4050,0x41ce9));import a154_0x18eb71 from'path';import{parse as a154_0xaf2578}from'yaml';function a154_0x4050(){const _0xadf858=['Cannot\x20split\x20empty\x20path','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','isAbsolute','slice','length','resolve','endsWith','2BCQeUn','push','pop','startsWith','trim','281210TRsWTn','dirname','Path\x20segment\x20cannot\x20be\x20empty','981316Gdxzkf','10OQjoCA','filter','exists','segments','replace','raw','6FFvNhk','parent_segment','10276224XBbedP','Cannot\x20navigate\x20above\x20root','readFile','1907686QUirXY','File\x20not\x20found:\x20','.yaml','relative','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','name','split','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','parse','9uWPXXK','join','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','1331676lopYbV','No\x20tdx.json\x20found\x20for\x20file:\x20','root','551228TDWPTY','2797768VcjECQ','.yml','20BjDpLF','journey','tdx.json','substring'];a154_0x4050=function(){return _0xadf858;};return a154_0x4050();}import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x48b2d3){const _0x8cfeda=a154_0x1de0;if(!_0x48b2d3||_0x48b2d3['trim']()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0x58078b=_0x48b2d3['trim']();if(_0x58078b==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x48b2d3};const _0x150d73=_0x58078b[_0x8cfeda(0x101)]('/')?_0x58078b[_0x8cfeda(0xf6)](0x1):_0x58078b,_0x110157=_0x150d73[_0x8cfeda(0x118)]('/')[_0x8cfeda(0x108)](_0x2e3888=>_0x2e3888!=='');if(_0x110157[_0x8cfeda(0xfb)]===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x2e77c8=_0x58078b[_0x8cfeda(0x101)]('/')||!isRelativePathSegment(_0x110157[0x0]);for(const _0xd0db8 of _0x110157){validatePathSegment(_0xd0db8);}return{'segments':_0x110157,'isAbsolute':_0x2e77c8,'raw':_0x48b2d3};}function isRelativePathSegment(_0x294c24){return _0x294c24==='.'||_0x294c24==='..';}function validatePathSegment(_0x1de79a){const _0x4954ca=a154_0x1de0;if(_0x1de79a==='')throw new Error(_0x4954ca(0x105));if(_0x1de79a==='.'||_0x1de79a==='..')return;if(/[\x00-\x1F\x7F]/['test'](_0x1de79a))throw new Error(_0x4954ca(0x116)+_0x1de79a);if(_0x1de79a!==_0x1de79a[_0x4954ca(0x102)]()){}}export function validatePath(_0x274e6e){const _0x2ed725=a154_0x1de0;if(_0x274e6e[_0x2ed725(0x10a)][_0x2ed725(0xfb)]===0x0&&!_0x274e6e[_0x2ed725(0xf9)])throw new Error('Relative\x20path\x20cannot\x20be\x20empty');if(_0x274e6e['isAbsolute']){if(_0x274e6e['segments'][0x0]==='..')throw new Error(_0x2ed725(0x119));let _0x36871c=0x0;for(const _0x50a65b of _0x274e6e[_0x2ed725(0x10a)]){if(_0x50a65b==='..'){if(_0x36871c===0x0)throw new Error('Path\x20attempts\x20to\x20navigate\x20above\x20root');_0x36871c--;}else _0x50a65b!=='.'&&_0x36871c++;}}}export function joinPaths(_0x3b4a61,_0x2a1444){const _0x2bc744=a154_0x1de0;if(!_0x3b4a61||_0x3b4a61==='/')return _0x2a1444;if(!_0x2a1444||_0x2a1444==='.')return _0x3b4a61;if(_0x2a1444['startsWith']('/'))return _0x2a1444;const _0x26afaf=parsePath(_0x3b4a61),_0x38f1fd=parsePath(_0x2a1444),_0x22f447=[..._0x26afaf[_0x2bc744(0x10a)]];for(const _0x2eeea4 of _0x38f1fd[_0x2bc744(0x10a)]){if(_0x2eeea4==='.')continue;else{if(_0x2eeea4==='..'){if(_0x22f447[_0x2bc744(0xfb)]===0x0)throw new Error(_0x2bc744(0x110));_0x22f447[_0x2bc744(0x100)]();}else _0x22f447[_0x2bc744(0xff)](_0x2eeea4);}}const _0x5e6f95=_0x22f447[_0x2bc744(0x11c)]('/');return _0x26afaf[_0x2bc744(0x10c)][_0x2bc744(0x101)]('/')?'/'+_0x5e6f95:_0x5e6f95;}export function normalizePath(_0x543c12){const _0x3c8597=a154_0x1de0,_0x2b666a=parsePath(_0x543c12),_0x2f86b4=[];for(const _0x4f6f6f of _0x2b666a[_0x3c8597(0x10a)]){if(_0x4f6f6f==='.')continue;else{if(_0x4f6f6f==='..'){if(_0x2f86b4[_0x3c8597(0xfb)]===0x0){if(_0x2b666a[_0x3c8597(0xf9)])throw new Error(_0x3c8597(0x110));_0x2f86b4[_0x3c8597(0xff)]('..');}else _0x2f86b4[_0x2f86b4[_0x3c8597(0xfb)]-0x1]==='..'?_0x2f86b4[_0x3c8597(0xff)]('..'):_0x2f86b4[_0x3c8597(0x100)]();}else _0x2f86b4[_0x3c8597(0xff)](_0x4f6f6f);}}if(_0x2f86b4[_0x3c8597(0xfb)]===0x0)return _0x2b666a['isAbsolute']?'/':'.';const _0x4202c4=_0x2f86b4[_0x3c8597(0x11c)]('/');return _0x2b666a[_0x3c8597(0x10c)][_0x3c8597(0x101)]('/')?'/'+_0x4202c4:_0x4202c4;}export function getParentPath(_0x22565d){const _0x6fd908=a154_0x1de0,_0x2bbf98=parsePath(_0x22565d);if(_0x2bbf98[_0x6fd908(0x10a)][_0x6fd908(0xfb)]<=0x1)return'/';const _0x23aeaa=_0x2bbf98[_0x6fd908(0x10a)]['slice'](0x0,-0x1)[_0x6fd908(0x11c)]('/');return _0x2bbf98[_0x6fd908(0x10c)][_0x6fd908(0x101)]('/')?'/'+_0x23aeaa:_0x23aeaa;}export function getBaseName(_0x479fd0){const _0x1d5737=a154_0x1de0,_0xa11fa2=parsePath(_0x479fd0);return _0xa11fa2['segments'][_0xa11fa2[_0x1d5737(0x10a)]['length']-0x1]||'';}export function isChildPath(_0x52ddac,_0x56865c){const _0x291c7b=a154_0x1de0,_0x13c576=parsePath(_0x52ddac),_0x530fe4=parsePath(_0x56865c);if(_0x13c576[_0x291c7b(0x10a)][_0x291c7b(0xfb)]<=_0x530fe4[_0x291c7b(0x10a)][_0x291c7b(0xfb)])return![];for(let _0x430385=0x0;_0x430385<_0x530fe4[_0x291c7b(0x10a)][_0x291c7b(0xfb)];_0x430385++){if(_0x13c576[_0x291c7b(0x10a)][_0x430385]!==_0x530fe4[_0x291c7b(0x10a)][_0x430385])return![];}return!![];}export function splitPath(_0x1a191b){const _0x424891=a154_0x1de0,_0x198d71=parsePath(_0x1a191b);if(_0x198d71[_0x424891(0x10a)][_0x424891(0xfb)]===0x0)throw new Error(_0x424891(0xf7));if(_0x198d71[_0x424891(0x10a)][_0x424891(0xfb)]===0x1)return{'parent':_0x198d71[_0x424891(0x10a)][0x0]};return{'parent':_0x198d71[_0x424891(0x10a)][0x0],'child':_0x198d71[_0x424891(0x10a)][_0x424891(0xfa)](0x1)['join']('/')};}function a154_0x1de0(_0x4afbcd,_0x2e040a){_0x4afbcd=_0x4afbcd-0xf3;const _0x4050ee=a154_0x4050();let _0x1de0ea=_0x4050ee[_0x4afbcd];return _0x1de0ea;}export function isYamlFilePath(_0x475a6a){const _0x28ee4c=a154_0x1de0;return _0x475a6a[_0x28ee4c(0xfd)](_0x28ee4c(0x123))||_0x475a6a[_0x28ee4c(0xfd)](_0x28ee4c(0x114));}export async function resolveYamlFilePath(_0x211783,_0x392812=nodeFileSystem){const _0x2d670a=a154_0x1de0,_0x28c5f9=a154_0x18eb71[_0x2d670a(0xfc)](_0x211783);if(!await _0x392812[_0x2d670a(0x109)](_0x28c5f9))throw new Error(_0x2d670a(0x113)+_0x211783);let _0x193086=a154_0x18eb71[_0x2d670a(0x104)](_0x28c5f9),_0x471c7c=null,_0x2d168b=null;const _0x32c93c=a154_0x18eb71[_0x2d670a(0x11a)](_0x193086)[_0x2d670a(0x120)];while(_0x193086!==_0x32c93c){const _0x5e7bd6=a154_0x18eb71['join'](_0x193086,_0x2d670a(0xf5));if(await _0x392812[_0x2d670a(0x109)](_0x5e7bd6)){_0x471c7c=_0x5e7bd6,_0x2d168b=_0x193086;break;}_0x193086=a154_0x18eb71[_0x2d670a(0x104)](_0x193086);}if(!_0x471c7c||!_0x2d168b)throw new Error(_0x2d670a(0x11f)+_0x211783+'\x0a'+_0x2d670a(0x11d));const _0x1be484=await _0x392812[_0x2d670a(0x111)](_0x471c7c),_0x419ac3=JSON[_0x2d670a(0x11a)](_0x1be484),_0x58f6fb=_0x419ac3[_0x2d670a(0x10e)];if(!_0x58f6fb)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x3098ab=await _0x392812[_0x2d670a(0x111)](_0x28c5f9),_0x39ef36=a154_0xaf2578(_0x3098ab),_0x243bf7=_0x39ef36[_0x2d670a(0x117)];if(!_0x243bf7)throw new Error(_0x2d670a(0xf8)+_0x211783);const _0x528584=_0x39ef36['type']===_0x2d670a(0xf4)?_0x2d670a(0xf4):'segment',_0x1e4241=a154_0x18eb71[_0x2d670a(0x115)](_0x2d168b,_0x28c5f9),_0x1f97fe=a154_0x18eb71['dirname'](_0x1e4241),_0x5781b8=_0x1f97fe==='.'?'':_0x1f97fe[_0x2d670a(0x10b)](/\\/g,'/'),_0x1012cb=_0x5781b8?_0x58f6fb+'/'+_0x5781b8+'/'+_0x243bf7:_0x58f6fb+'/'+_0x243bf7;return{'parentSegment':_0x58f6fb,'segmentName':_0x243bf7,'folderPath':_0x5781b8,'fullPath':_0x1012cb,'resourceType':_0x528584,'content':_0x3098ab};}
@@ -1 +1 @@
1
- function a155_0x7cd6(){const _0x4475cd=['136jcxsZG','146859MsTjme','indexOf','Invalid\x20segment\x20reference\x20format:\x20','109730vFsrjb','.\x20Child\x20name\x20cannot\x20be\x20empty','869832vCmIjd','9170056qLZCBv','36qhZqAD','.\x20Parent\x20name\x20cannot\x20be\x20empty','294480aZJVOs','70lqzULL','substring','26597461gKhWdt','459184NaUhUZ','10MsDgmO'];a155_0x7cd6=function(){return _0x4475cd;};return a155_0x7cd6();}function a155_0x5ace(_0x99c1fe,_0x2e92f1){_0x99c1fe=_0x99c1fe-0x168;const _0x7cd64d=a155_0x7cd6();let _0x5ace81=_0x7cd64d[_0x99c1fe];return _0x5ace81;}(function(_0x1e0c29,_0x33384f){const _0x5ecc84=a155_0x5ace,_0x328f48=_0x1e0c29();while(!![]){try{const _0x3d7f1e=parseInt(_0x5ecc84(0x177))/0x1+-parseInt(_0x5ecc84(0x171))/0x2*(-parseInt(_0x5ecc84(0x16a))/0x3)+-parseInt(_0x5ecc84(0x169))/0x4*(parseInt(_0x5ecc84(0x16d))/0x5)+-parseInt(_0x5ecc84(0x16f))/0x6*(-parseInt(_0x5ecc84(0x174))/0x7)+parseInt(_0x5ecc84(0x170))/0x8+-parseInt(_0x5ecc84(0x173))/0x9+parseInt(_0x5ecc84(0x168))/0xa*(-parseInt(_0x5ecc84(0x176))/0xb);if(_0x3d7f1e===_0x33384f)break;else _0x328f48['push'](_0x328f48['shift']());}catch(_0x1166cd){_0x328f48['push'](_0x328f48['shift']());}}}(a155_0x7cd6,0xb4898));export function parseSegmentRef(_0x3855ae){const _0x1b1c77=a155_0x5ace,_0x25483c=_0x3855ae[_0x1b1c77(0x16b)]('/');if(_0x25483c===-0x1)return{'parentId':_0x3855ae};if(_0x25483c===0x0)throw new Error(_0x1b1c77(0x16c)+_0x3855ae+_0x1b1c77(0x172));const _0x8dc2e7=_0x3855ae[_0x1b1c77(0x175)](0x0,_0x25483c),_0x1a5d77=_0x3855ae[_0x1b1c77(0x175)](_0x25483c+0x1);if(_0x1a5d77==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x3855ae+_0x1b1c77(0x16e));return{'parentId':_0x8dc2e7,'childId':_0x1a5d77};}
1
+ (function(_0x30b99a,_0x36b5d5){const _0x7cea0d=a155_0x2b19,_0x3467af=_0x30b99a();while(!![]){try{const _0x4d6fe3=parseInt(_0x7cea0d(0xdf))/0x1*(parseInt(_0x7cea0d(0xe0))/0x2)+parseInt(_0x7cea0d(0xe4))/0x3*(parseInt(_0x7cea0d(0xda))/0x4)+-parseInt(_0x7cea0d(0xe7))/0x5*(parseInt(_0x7cea0d(0xe9))/0x6)+-parseInt(_0x7cea0d(0xd9))/0x7*(-parseInt(_0x7cea0d(0xe5))/0x8)+parseInt(_0x7cea0d(0xdc))/0x9*(-parseInt(_0x7cea0d(0xe1))/0xa)+parseInt(_0x7cea0d(0xdd))/0xb+parseInt(_0x7cea0d(0xe3))/0xc*(parseInt(_0x7cea0d(0xdb))/0xd);if(_0x4d6fe3===_0x36b5d5)break;else _0x3467af['push'](_0x3467af['shift']());}catch(_0x194eca){_0x3467af['push'](_0x3467af['shift']());}}}(a155_0x24f7,0x7a0c5));function a155_0x24f7(){const _0x525719=['5ovfLHe','substring','5258976eNjYlS','indexOf','1659343vcuYdl','3016mZbMcN','8411RlZSIJ','850923TiXWdl','1134639IqlUeR','Invalid\x20segment\x20reference\x20format:\x20','25366oBOhBx','38hBhlYq','90Wgppdb','.\x20Child\x20name\x20cannot\x20be\x20empty','11292iHYUIL','339iMeyZy','32pHEbkH','.\x20Parent\x20name\x20cannot\x20be\x20empty'];a155_0x24f7=function(){return _0x525719;};return a155_0x24f7();}function a155_0x2b19(_0x3c4dd1,_0x3ccedc){_0x3c4dd1=_0x3c4dd1-0xd9;const _0x24f7cc=a155_0x24f7();let _0x2b1986=_0x24f7cc[_0x3c4dd1];return _0x2b1986;}export function parseSegmentRef(_0x392755){const _0x3cbd8c=a155_0x2b19,_0x58fb08=_0x392755[_0x3cbd8c(0xea)]('/');if(_0x58fb08===-0x1)return{'parentId':_0x392755};if(_0x58fb08===0x0)throw new Error(_0x3cbd8c(0xde)+_0x392755+_0x3cbd8c(0xe6));const _0x401281=_0x392755[_0x3cbd8c(0xe8)](0x0,_0x58fb08),_0x3a522d=_0x392755[_0x3cbd8c(0xe8)](_0x58fb08+0x1);if(_0x3a522d==='')throw new Error(_0x3cbd8c(0xde)+_0x392755+_0x3cbd8c(0xe2));return{'parentId':_0x401281,'childId':_0x3a522d};}
@@ -1 +1 @@
1
- function a156_0x29db(_0x138af9,_0x5b8f7c){_0x138af9=_0x138af9-0x170;const _0x212b92=a156_0x212b();let _0x29db0d=_0x212b92[_0x138af9];return _0x29db0d;}(function(_0x5d4644,_0x585820){const _0x3af9f1=a156_0x29db,_0x5183ec=_0x5d4644();while(!![]){try{const _0x5043c5=parseInt(_0x3af9f1(0x18c))/0x1*(parseInt(_0x3af9f1(0x1a9))/0x2)+parseInt(_0x3af9f1(0x198))/0x3*(parseInt(_0x3af9f1(0x1ad))/0x4)+-parseInt(_0x3af9f1(0x18e))/0x5+-parseInt(_0x3af9f1(0x19d))/0x6*(parseInt(_0x3af9f1(0x1b6))/0x7)+-parseInt(_0x3af9f1(0x179))/0x8+-parseInt(_0x3af9f1(0x190))/0x9+-parseInt(_0x3af9f1(0x1a6))/0xa*(-parseInt(_0x3af9f1(0x1b9))/0xb);if(_0x5043c5===_0x585820)break;else _0x5183ec['push'](_0x5183ec['shift']());}catch(_0xa422a4){_0x5183ec['push'](_0x5183ec['shift']());}}}(a156_0x212b,0x5754b));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x3b14a8,_0x4ca3b8={},_0x5246bc={}){const _0x472d37=a156_0x29db;if(_0x5246bc[_0x472d37(0x1ac)])return runSemanticChecks(_0x3b14a8,_0x4ca3b8);const _0x42e46c=SegmentDefSchema['safeParse'](_0x3b14a8);if(_0x42e46c[_0x472d37(0x1a1)])return runSemanticChecks(_0x42e46c[_0x472d37(0x1b3)],_0x4ca3b8);return zodErrorsToValidationResult(_0x42e46c[_0x472d37(0x184)],_0x4ca3b8);}export function validateRuleDef(_0x7a188,_0x3e39bb,_0x1b84df){const _0x1430fd=a156_0x29db;if(!_0x7a188)return[];const _0x5f48a7=RuleDefSchema['safeParse'](_0x7a188);if(_0x5f48a7[_0x1430fd(0x1a1)])return checkRule(_0x5f48a7['data'],_0x3e39bb,_0x1b84df);const _0x33f55d=flattenZodIssues(_0x5f48a7['error'][_0x1430fd(0x1a3)]);return _0x33f55d[_0x1430fd(0x19a)](_0x4759a8=>{const _0x21f4ec=_0x1430fd,_0x5df5f1=formatZodPath(_0x4759a8[_0x21f4ec(0x18d)]),_0x4c0203=_0x5df5f1?_0x3e39bb+'.'+_0x5df5f1:_0x3e39bb,_0x41149e=mapZodIssueToCode(_0x4759a8,_0x5df5f1),_0x44abb9=getLocationFromPath(_0x1b84df[_0x21f4ec(0x170)],_0x1b84df[_0x21f4ec(0x174)],pathToArray(_0x4c0203));return{'level':_0x21f4ec(0x184),'path':_0x4c0203,'code':_0x41149e,'message':_0x4759a8[_0x21f4ec(0x189)],..._0x44abb9&&{'location':_0x44abb9}};});}function zodErrorsToValidationResult(_0x1068c6,_0x175b40){const _0xa370d7=a156_0x29db,_0x2344a6=flattenZodIssues(_0x1068c6[_0xa370d7(0x1a3)]),_0x481888=_0x2344a6[_0xa370d7(0x19a)](_0x1c0699=>{const _0x16e582=_0xa370d7,_0x24a276=formatZodPath(_0x1c0699[_0x16e582(0x18d)]),_0x234812=mapZodIssueToCode(_0x1c0699,_0x24a276),_0x4dac72=getLocationFromPath(_0x175b40['document'],_0x175b40[_0x16e582(0x174)],_0x1c0699['path'][_0x16e582(0x19a)](_0x5ae4db=>typeof _0x5ae4db==='symbol'?String(_0x5ae4db):_0x5ae4db));return{'level':_0x16e582(0x184),'path':_0x24a276,'code':_0x234812,'message':_0x1c0699[_0x16e582(0x189)],..._0x4dac72&&{'location':_0x4dac72}};});return{'valid':![],'errors':_0x481888,'warnings':[]};}function a156_0x212b(){const _0x2d0582=['Attribute\x20name\x20cannot\x20be\x20empty','Value','warning','data','push','invalid_value','701477MagFeM','EMPTY_ATTRIBUTE','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','89749CgcmBh','document','.conditions[','type','code','source','.segment','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','Behavior\x20source\x20\x27','4348184KbXUvw','.conditions','.operator.value','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','MISSING_SEGMENT_REFERENCE','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','match','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','.filter','custom','BEHAVIOR_SOURCE_MISSING_FILTER','error','And','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','INVALID_RULE_TYPE','message','conditions','validationCode','3aXkUyK','path','1847370yjVzEO','filter','4231512xTFAzD','includes','level','Behavior','attribute','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','MISSING_TIME_UNIT','arrayMatching','401889eIbBpy','.source','map','params','.type','42xCIxgN','MISSING_CONDITIONS','EMPTY_CONDITIONS','.operator.type','success','length','issues','INVALID_ARRAY_MATCHING','.attribute','1390fQotIo','rule','endsWith','425622sytFkq','description','aggregation','skipSchema','20EeNfmC','MISSING_BETWEEN_BOUNDS','SEGMENT_SCHEMA_ERROR'];a156_0x212b=function(){return _0x2d0582;};return a156_0x212b();}function mapZodIssueToCode(_0x3d7335,_0x1e1642){const _0x4bb00d=a156_0x29db,_0x3fcd25=_0x3d7335[_0x4bb00d(0x173)]===_0x4bb00d(0x182)?_0x3d7335[_0x4bb00d(0x19b)]:undefined;if(_0x1e1642==='name')return'MISSING_NAME';if(_0x1e1642==='rule.type'||_0x1e1642[_0x4bb00d(0x1a8)](_0x4bb00d(0x19c))){if(_0x3d7335[_0x4bb00d(0x173)]===_0x4bb00d(0x1b5)){if(_0x1e1642==='rule.type'||_0x1e1642[_0x4bb00d(0x17f)](/\.conditions\[\d+\]\.type$/))return _0x4bb00d(0x188);}}if(_0x1e1642[_0x4bb00d(0x1a8)](_0x4bb00d(0x1a0)))return'INVALID_OPERATOR_TYPE';if(_0x1e1642['endsWith'](_0x4bb00d(0x17b)))return'MISSING_OPERATOR_VALUE';if(_0x3fcd25?.['validationCode']===_0x4bb00d(0x1ae))return _0x4bb00d(0x1ae);if(_0x3fcd25?.[_0x4bb00d(0x18b)]===_0x4bb00d(0x196))return _0x4bb00d(0x196);if(_0x1e1642[_0x4bb00d(0x1a8)]('.conditions')||_0x1e1642===_0x4bb00d(0x18a))return _0x4bb00d(0x19e);if(_0x1e1642[_0x4bb00d(0x191)](_0x4bb00d(0x197)))return _0x4bb00d(0x1a4);if(_0x1e1642[_0x4bb00d(0x1a8)](_0x4bb00d(0x175)))return _0x4bb00d(0x17d);return _0x4bb00d(0x1af);}function runSemanticChecks(_0x1f880e,_0x5f196a){const _0x514bb8=a156_0x29db,_0x379e6f=[];_0x1f880e['rule']&&_0x379e6f[_0x514bb8(0x1b4)](...checkRule(_0x1f880e[_0x514bb8(0x1a7)],_0x514bb8(0x1a7),_0x5f196a));const _0x4adc=_0x379e6f['filter'](_0x5b5c7c=>_0x5b5c7c[_0x514bb8(0x192)]===_0x514bb8(0x184)),_0x48ae87=_0x379e6f['filter'](_0x4adc10=>_0x4adc10['level']===_0x514bb8(0x1b2));return{'valid':_0x4adc['length']===0x0,'errors':_0x4adc,'warnings':_0x48ae87};}function checkRule(_0x148393,_0x3b2060,_0x5c7b88){const _0x14b8b0=a156_0x29db,_0x50a562=[];if(_0x148393['conditions'][_0x14b8b0(0x1a2)]===0x0)return _0x50a562['push']({'level':_0x14b8b0(0x184),'path':_0x3b2060+'.conditions','code':'EMPTY_CONDITIONS','message':'Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','location':getLocationFromPath(_0x5c7b88[_0x14b8b0(0x170)],_0x5c7b88['source'],pathToArray(_0x3b2060+_0x14b8b0(0x17a)))}),_0x50a562;return _0x50a562[_0x14b8b0(0x1b4)](...checkConditions(_0x148393[_0x14b8b0(0x18a)],_0x3b2060,_0x5c7b88)),_0x50a562;}function checkConditions(_0x1dbd4f,_0x5b86d6,_0x472936){const _0x1e8a21=a156_0x29db,_0xcab594=[];for(let _0x212130=0x0;_0x212130<_0x1dbd4f['length'];_0x212130++){const _0x538823=_0x1dbd4f[_0x212130],_0x411909=_0x5b86d6+_0x1e8a21(0x171)+_0x212130+']';_0xcab594[_0x1e8a21(0x1b4)](...checkCondition(_0x538823,_0x411909,_0x472936));}return _0xcab594;}function checkCondition(_0x517482,_0x17ace6,_0x30d955){const _0x21062c=a156_0x29db,_0x35d41e=[];if(_0x517482[_0x21062c(0x172)]===_0x21062c(0x185)||_0x517482[_0x21062c(0x172)]==='Or'){if(_0x517482[_0x21062c(0x18a)][_0x21062c(0x1a2)]===0x0)_0x35d41e['push']({'level':_0x21062c(0x184),'path':_0x17ace6+_0x21062c(0x17a),'code':_0x21062c(0x19f),'message':_0x517482['type']+_0x21062c(0x17e),'location':getLocationFromPath(_0x30d955[_0x21062c(0x170)],_0x30d955['source'],pathToArray(_0x17ace6+_0x21062c(0x17a)))});else{const _0x4efd42=_0x517482[_0x21062c(0x1aa)]!==undefined;!_0x4efd42&&_0x35d41e[_0x21062c(0x1b4)]({'level':'warning','path':_0x17ace6,'code':'NESTED_CONDITION_GROUP','message':_0x517482[_0x21062c(0x172)]+_0x21062c(0x195)+_0x21062c(0x1b8)+_0x21062c(0x17c),'location':getLocationFromPath(_0x30d955[_0x21062c(0x170)],_0x30d955[_0x21062c(0x174)],pathToArray(_0x17ace6))}),_0x35d41e['push'](...checkConditions(_0x517482['conditions'],_0x17ace6,_0x30d955));}return _0x35d41e;}if(_0x517482[_0x21062c(0x172)]===_0x21062c(0x1b1)||_0x517482[_0x21062c(0x172)]===_0x21062c(0x193)){const _0x970f9d=_0x517482,_0x4a6031=_0x970f9d['source'],_0x343381=_0x970f9d[_0x21062c(0x1ab)],_0x5038c0=_0x4a6031||_0x343381;(!_0x970f9d[_0x21062c(0x194)]||_0x970f9d['attribute']==='')&&(!_0x5038c0&&_0x35d41e[_0x21062c(0x1b4)]({'level':_0x21062c(0x184),'path':_0x17ace6+'.attribute','code':_0x21062c(0x1b7),'message':_0x21062c(0x1b0),'location':getLocationFromPath(_0x30d955[_0x21062c(0x170)],_0x30d955[_0x21062c(0x174)],pathToArray(_0x17ace6+_0x21062c(0x1a5)))}));_0x970f9d[_0x21062c(0x18f)]&&_0x35d41e[_0x21062c(0x1b4)](...checkRule(_0x970f9d['filter'],_0x17ace6+_0x21062c(0x181),_0x30d955));if(_0x970f9d[_0x21062c(0x174)]){const _0x4009b9=_0x970f9d[_0x21062c(0x194)]&&_0x970f9d['attribute']!=='';_0x4009b9&&!_0x970f9d[_0x21062c(0x18f)]&&_0x35d41e['push']({'level':_0x21062c(0x184),'path':_0x17ace6+_0x21062c(0x199),'code':_0x21062c(0x183),'message':_0x21062c(0x178)+_0x970f9d[_0x21062c(0x174)]+'\x27\x20with\x20attribute\x20\x27'+_0x970f9d[_0x21062c(0x194)]+'\x27\x20'+_0x21062c(0x186)+_0x21062c(0x187)+_0x21062c(0x177),'location':getLocationFromPath(_0x30d955[_0x21062c(0x170)],_0x30d955[_0x21062c(0x174)],pathToArray(_0x17ace6+'.source'))}),_0x4009b9&&_0x970f9d[_0x21062c(0x18f)]&&_0x35d41e[_0x21062c(0x1b4)]({'level':'warning','path':_0x17ace6+'.attribute','code':'BEHAVIOR_SOURCE_WITH_ATTRIBUTE','message':'Attribute\x20\x27'+_0x970f9d[_0x21062c(0x194)]+_0x21062c(0x180)+_0x21062c(0x176),'location':getLocationFromPath(_0x30d955[_0x21062c(0x170)],_0x30d955[_0x21062c(0x174)],pathToArray(_0x17ace6+_0x21062c(0x1a5)))});}}return _0x35d41e;}
1
+ (function(_0xad7aee,_0x2e74e6){const _0x5f509d=a156_0x200e,_0x1a3f6e=_0xad7aee();while(!![]){try{const _0x6f4fe8=-parseInt(_0x5f509d(0xb7))/0x1*(-parseInt(_0x5f509d(0xcd))/0x2)+parseInt(_0x5f509d(0xa0))/0x3+-parseInt(_0x5f509d(0xcf))/0x4*(-parseInt(_0x5f509d(0xd5))/0x5)+parseInt(_0x5f509d(0xce))/0x6*(-parseInt(_0x5f509d(0xb0))/0x7)+parseInt(_0x5f509d(0xa6))/0x8+-parseInt(_0x5f509d(0xa4))/0x9*(parseInt(_0x5f509d(0xd6))/0xa)+parseInt(_0x5f509d(0xa1))/0xb*(-parseInt(_0x5f509d(0xd9))/0xc);if(_0x6f4fe8===_0x2e74e6)break;else _0x1a3f6e['push'](_0x1a3f6e['shift']());}catch(_0x51bc10){_0x1a3f6e['push'](_0x1a3f6e['shift']());}}}(a156_0x4233,0x68df4));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';function a156_0x4233(){const _0x428415=['.conditions','aggregation','.filter','rule','814287FdyTWd','4301vNwXDg','NESTED_CONDITION_GROUP','rule.type','1321929ZySFtS','conditions','1604544ftMZIH','Attribute\x20\x27','push','custom','And','endsWith','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','invalid_value','MISSING_OPERATOR_VALUE','MISSING_BETWEEN_BOUNDS','28XAsWTb','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','\x27\x20with\x20attribute\x20\x27','warning','SEGMENT_SCHEMA_ERROR','.type','.segment','3985QudyYM','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','code','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','INVALID_OPERATOR_TYPE','EMPTY_ATTRIBUTE','filter','data','type','name','match','success','EMPTY_CONDITIONS','issues','arrayMatching','.operator.value','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','path','attribute','map','symbol','428UYtwvH','845688LSjjuR','2852LhjTBW','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','length','MISSING_CONDITIONS','.conditions[','description','955YaJZyT','30NBDTMO','BEHAVIOR_SOURCE_MISSING_FILTER','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','828MwKaem','safeParse','message','document','Value','.operator.type','params','level','Attribute\x20name\x20cannot\x20be\x20empty','source','error','.attribute','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','.source','validationCode','MISSING_NAME','MISSING_TIME_UNIT','includes','Behavior\x20source\x20\x27'];a156_0x4233=function(){return _0x428415;};return a156_0x4233();}function a156_0x200e(_0x1f86c9,_0x4195d2){_0x1f86c9=_0x1f86c9-0x98;const _0x42335f=a156_0x4233();let _0x200e1a=_0x42335f[_0x1f86c9];return _0x200e1a;}import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x3fbf0c,_0xb82221={},_0xaa5f21={}){const _0x1b080f=a156_0x200e;if(_0xaa5f21['skipSchema'])return runSemanticChecks(_0x3fbf0c,_0xb82221);const _0x25470b=SegmentDefSchema[_0x1b080f(0xda)](_0x3fbf0c);if(_0x25470b[_0x1b080f(0xc3)])return runSemanticChecks(_0x25470b[_0x1b080f(0xbf)],_0xb82221);return zodErrorsToValidationResult(_0x25470b[_0x1b080f(0xe3)],_0xb82221);}export function validateRuleDef(_0x192495,_0x1fff92,_0x2c734a){const _0x5da9bd=a156_0x200e;if(!_0x192495)return[];const _0x2a41b4=RuleDefSchema['safeParse'](_0x192495);if(_0x2a41b4[_0x5da9bd(0xc3)])return checkRule(_0x2a41b4[_0x5da9bd(0xbf)],_0x1fff92,_0x2c734a);const _0x509426=flattenZodIssues(_0x2a41b4[_0x5da9bd(0xe3)]['issues']);return _0x509426[_0x5da9bd(0xcb)](_0xb5a44e=>{const _0x3165e2=_0x5da9bd,_0x1ec32a=formatZodPath(_0xb5a44e[_0x3165e2(0xc9)]),_0x3aaa13=_0x1ec32a?_0x1fff92+'.'+_0x1ec32a:_0x1fff92,_0x4c4091=mapZodIssueToCode(_0xb5a44e,_0x1ec32a),_0x269a85=getLocationFromPath(_0x2c734a[_0x3165e2(0xdc)],_0x2c734a[_0x3165e2(0xe2)],pathToArray(_0x3aaa13));return{'level':_0x3165e2(0xe3),'path':_0x3aaa13,'code':_0x4c4091,'message':_0xb5a44e[_0x3165e2(0xdb)],..._0x269a85&&{'location':_0x269a85}};});}function zodErrorsToValidationResult(_0x2a557d,_0x2abcde){const _0x4dd5a5=a156_0x200e,_0x29c5ff=flattenZodIssues(_0x2a557d[_0x4dd5a5(0xc5)]),_0x33e68a=_0x29c5ff['map'](_0x15f760=>{const _0x40b726=_0x4dd5a5,_0x323325=formatZodPath(_0x15f760['path']),_0x570c8e=mapZodIssueToCode(_0x15f760,_0x323325),_0x18a11a=getLocationFromPath(_0x2abcde[_0x40b726(0xdc)],_0x2abcde['source'],_0x15f760['path'][_0x40b726(0xcb)](_0xc7357=>typeof _0xc7357===_0x40b726(0xcc)?String(_0xc7357):_0xc7357));return{'level':_0x40b726(0xe3),'path':_0x323325,'code':_0x570c8e,'message':_0x15f760[_0x40b726(0xdb)],..._0x18a11a&&{'location':_0x18a11a}};});return{'valid':![],'errors':_0x33e68a,'warnings':[]};}function mapZodIssueToCode(_0x21f6bf,_0x2cead1){const _0x203464=a156_0x200e,_0x562a95=_0x21f6bf['code']===_0x203464(0xa9)?_0x21f6bf[_0x203464(0xdf)]:undefined;if(_0x2cead1===_0x203464(0xc1))return _0x203464(0x98);if(_0x2cead1===_0x203464(0xa3)||_0x2cead1['endsWith'](_0x203464(0xb5))){if(_0x21f6bf[_0x203464(0xba)]===_0x203464(0xad)){if(_0x2cead1===_0x203464(0xa3)||_0x2cead1[_0x203464(0xc2)](/\.conditions\[\d+\]\.type$/))return'INVALID_RULE_TYPE';}}if(_0x2cead1[_0x203464(0xab)](_0x203464(0xde)))return _0x203464(0xbc);if(_0x2cead1[_0x203464(0xab)](_0x203464(0xc7)))return _0x203464(0xae);if(_0x562a95?.['validationCode']===_0x203464(0xaf))return _0x203464(0xaf);if(_0x562a95?.[_0x203464(0xe7)]===_0x203464(0x99))return _0x203464(0x99);if(_0x2cead1['endsWith'](_0x203464(0x9c))||_0x2cead1===_0x203464(0xa5))return _0x203464(0xd2);if(_0x2cead1[_0x203464(0x9a)](_0x203464(0xc6)))return'INVALID_ARRAY_MATCHING';if(_0x2cead1['endsWith'](_0x203464(0xb6)))return'MISSING_SEGMENT_REFERENCE';return _0x203464(0xb4);}function runSemanticChecks(_0x93b9e9,_0x55e0f6){const _0x2e8e94=a156_0x200e,_0x106566=[];_0x93b9e9[_0x2e8e94(0x9f)]&&_0x106566[_0x2e8e94(0xa8)](...checkRule(_0x93b9e9[_0x2e8e94(0x9f)],'rule',_0x55e0f6));const _0x5ce746=_0x106566['filter'](_0x3586ed=>_0x3586ed['level']===_0x2e8e94(0xe3)),_0x5a49dd=_0x106566[_0x2e8e94(0xbe)](_0x1dbebd=>_0x1dbebd[_0x2e8e94(0xe0)]===_0x2e8e94(0xb3));return{'valid':_0x5ce746['length']===0x0,'errors':_0x5ce746,'warnings':_0x5a49dd};}function checkRule(_0x58e825,_0x2a22b1,_0x386203){const _0x195626=a156_0x200e,_0x186161=[];if(_0x58e825[_0x195626(0xa5)][_0x195626(0xd1)]===0x0)return _0x186161[_0x195626(0xa8)]({'level':_0x195626(0xe3),'path':_0x2a22b1+'.conditions','code':_0x195626(0xc4),'message':_0x195626(0xd0),'location':getLocationFromPath(_0x386203[_0x195626(0xdc)],_0x386203[_0x195626(0xe2)],pathToArray(_0x2a22b1+'.conditions'))}),_0x186161;return _0x186161[_0x195626(0xa8)](...checkConditions(_0x58e825[_0x195626(0xa5)],_0x2a22b1,_0x386203)),_0x186161;}function checkConditions(_0x5104e0,_0x1ed77f,_0xbdd999){const _0x4e57b4=a156_0x200e,_0x252c95=[];for(let _0xf8615b=0x0;_0xf8615b<_0x5104e0['length'];_0xf8615b++){const _0xca99be=_0x5104e0[_0xf8615b],_0x43fd8d=_0x1ed77f+_0x4e57b4(0xd3)+_0xf8615b+']';_0x252c95['push'](...checkCondition(_0xca99be,_0x43fd8d,_0xbdd999));}return _0x252c95;}function checkCondition(_0x5ee358,_0x11a9f0,_0x561405){const _0x2c5f1b=a156_0x200e,_0x61457d=[];if(_0x5ee358[_0x2c5f1b(0xc0)]===_0x2c5f1b(0xaa)||_0x5ee358[_0x2c5f1b(0xc0)]==='Or'){if(_0x5ee358['conditions'][_0x2c5f1b(0xd1)]===0x0)_0x61457d[_0x2c5f1b(0xa8)]({'level':'error','path':_0x11a9f0+_0x2c5f1b(0x9c),'code':_0x2c5f1b(0xc4),'message':_0x5ee358['type']+_0x2c5f1b(0xb9),'location':getLocationFromPath(_0x561405['document'],_0x561405['source'],pathToArray(_0x11a9f0+_0x2c5f1b(0x9c)))});else{const _0xc1c38b=_0x5ee358[_0x2c5f1b(0xd4)]!==undefined;!_0xc1c38b&&_0x61457d['push']({'level':_0x2c5f1b(0xb3),'path':_0x11a9f0,'code':_0x2c5f1b(0xa2),'message':_0x5ee358[_0x2c5f1b(0xc0)]+'\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20'+'condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20'+_0x2c5f1b(0xac),'location':getLocationFromPath(_0x561405[_0x2c5f1b(0xdc)],_0x561405['source'],pathToArray(_0x11a9f0))}),_0x61457d[_0x2c5f1b(0xa8)](...checkConditions(_0x5ee358[_0x2c5f1b(0xa5)],_0x11a9f0,_0x561405));}return _0x61457d;}if(_0x5ee358['type']===_0x2c5f1b(0xdd)||_0x5ee358[_0x2c5f1b(0xc0)]==='Behavior'){const _0x38a2e7=_0x5ee358,_0x2b2a43=_0x38a2e7['source'],_0x33371f=_0x38a2e7[_0x2c5f1b(0x9d)],_0x1f234a=_0x2b2a43||_0x33371f;(!_0x38a2e7['attribute']||_0x38a2e7['attribute']==='')&&(!_0x1f234a&&_0x61457d[_0x2c5f1b(0xa8)]({'level':_0x2c5f1b(0xe3),'path':_0x11a9f0+_0x2c5f1b(0xe4),'code':_0x2c5f1b(0xbd),'message':_0x2c5f1b(0xe1),'location':getLocationFromPath(_0x561405[_0x2c5f1b(0xdc)],_0x561405['source'],pathToArray(_0x11a9f0+'.attribute'))}));_0x38a2e7[_0x2c5f1b(0xbe)]&&_0x61457d[_0x2c5f1b(0xa8)](...checkRule(_0x38a2e7[_0x2c5f1b(0xbe)],_0x11a9f0+_0x2c5f1b(0x9e),_0x561405));if(_0x38a2e7[_0x2c5f1b(0xe2)]){const _0x4684fc=_0x38a2e7[_0x2c5f1b(0xca)]&&_0x38a2e7['attribute']!=='';_0x4684fc&&!_0x38a2e7[_0x2c5f1b(0xbe)]&&_0x61457d['push']({'level':_0x2c5f1b(0xe3),'path':_0x11a9f0+_0x2c5f1b(0xe6),'code':_0x2c5f1b(0xd7),'message':_0x2c5f1b(0x9b)+_0x38a2e7[_0x2c5f1b(0xe2)]+_0x2c5f1b(0xb2)+_0x38a2e7[_0x2c5f1b(0xca)]+'\x27\x20'+_0x2c5f1b(0xbb)+_0x2c5f1b(0xe5)+_0x2c5f1b(0xc8),'location':getLocationFromPath(_0x561405[_0x2c5f1b(0xdc)],_0x561405[_0x2c5f1b(0xe2)],pathToArray(_0x11a9f0+_0x2c5f1b(0xe6)))}),_0x4684fc&&_0x38a2e7[_0x2c5f1b(0xbe)]&&_0x61457d[_0x2c5f1b(0xa8)]({'level':_0x2c5f1b(0xb3),'path':_0x11a9f0+_0x2c5f1b(0xe4),'code':_0x2c5f1b(0xb8),'message':_0x2c5f1b(0xa7)+_0x38a2e7[_0x2c5f1b(0xca)]+_0x2c5f1b(0xb1)+_0x2c5f1b(0xd8),'location':getLocationFromPath(_0x561405[_0x2c5f1b(0xdc)],_0x561405[_0x2c5f1b(0xe2)],pathToArray(_0x11a9f0+_0x2c5f1b(0xe4)))});}}return _0x61457d;}