@treasuredata/tdx 2026.3.31 → 2026.3.33

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 (256) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.d.ts +1 -1
  4. package/dist/cli-categories.js +1 -1
  5. package/dist/cli-categories.js.map +1 -1
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +1 -1
  8. package/dist/cli.js.map +1 -1
  9. package/dist/commands/activations.js +1 -1
  10. package/dist/commands/agent-command.js +1 -1
  11. package/dist/commands/agent-test-command.js +1 -1
  12. package/dist/commands/api-command.js +1 -1
  13. package/dist/commands/auth-command.js +1 -1
  14. package/dist/commands/auth-login-command.js +1 -1
  15. package/dist/commands/cas-command.js +1 -1
  16. package/dist/commands/cas-segment-command.js +1 -1
  17. package/dist/commands/chat-command.js +1 -1
  18. package/dist/commands/claude-command.js +1 -1
  19. package/dist/commands/claude-statusline-command.js +1 -1
  20. package/dist/commands/claude-usage-command.js +1 -1
  21. package/dist/commands/command.js +1 -1
  22. package/dist/commands/connection-command.js +1 -1
  23. package/dist/commands/databases.js +1 -1
  24. package/dist/commands/delivery-command.js +1 -1
  25. package/dist/commands/describe.js +1 -1
  26. package/dist/commands/engage-campaign-pull-command.js +1 -1
  27. package/dist/commands/engage-campaign-push-command.js +1 -1
  28. package/dist/commands/engage-campaign-validate-command.js +1 -1
  29. package/dist/commands/engage-command.js +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.js +1 -1
  35. package/dist/commands/journey-validate-command.js +1 -1
  36. package/dist/commands/llm-command.js +1 -1
  37. package/dist/commands/mcp-command.js +1 -1
  38. package/dist/commands/parent-segment-command.js +1 -1
  39. package/dist/commands/policy-command.js +1 -1
  40. package/dist/commands/profile-command.js +1 -1
  41. package/dist/commands/profiles-command.js +1 -1
  42. package/dist/commands/query-command.js +1 -1
  43. package/dist/commands/schedule-command.js +1 -1
  44. package/dist/commands/segment-command.js +1 -1
  45. package/dist/commands/segment-create-command.js +1 -1
  46. package/dist/commands/segment-fields-command.js +1 -1
  47. package/dist/commands/segment-pull-command.js +1 -1
  48. package/dist/commands/segment-push-command.js +1 -1
  49. package/dist/commands/segment-update-command.js +1 -1
  50. package/dist/commands/segment-use-command.js +1 -1
  51. package/dist/commands/segment-validate-command.js +1 -1
  52. package/dist/commands/segments.js +1 -1
  53. package/dist/commands/show.js +1 -1
  54. package/dist/commands/status-command.js +1 -1
  55. package/dist/commands/tables.js +1 -1
  56. package/dist/commands/unset-command.js +1 -1
  57. package/dist/commands/upgrade-command.js +1 -1
  58. package/dist/commands/use-command.js +1 -1
  59. package/dist/commands/user-command.js +1 -1
  60. package/dist/commands/work-command.d.ts +34 -0
  61. package/dist/commands/work-command.d.ts.map +1 -0
  62. package/dist/commands/work-command.js +1 -0
  63. package/dist/commands/work-command.js.map +1 -0
  64. package/dist/commands/workflow-command.js +1 -1
  65. package/dist/core/auth.js +1 -1
  66. package/dist/core/command-output.js +1 -1
  67. package/dist/core/config.js +1 -1
  68. package/dist/core/connection-cache.js +1 -1
  69. package/dist/core/constants.js +1 -1
  70. package/dist/core/credential-cache.js +1 -1
  71. package/dist/core/global-context.js +1 -1
  72. package/dist/core/keychain.js +1 -1
  73. package/dist/core/oauth-keychain.js +1 -1
  74. package/dist/core/oauth.js +1 -1
  75. package/dist/core/profile.js +1 -1
  76. package/dist/core/project-config.d.ts +2 -0
  77. package/dist/core/project-config.d.ts.map +1 -1
  78. package/dist/core/project-config.js +1 -1
  79. package/dist/core/project-config.js.map +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/utils.js +1 -1
  89. package/dist/proxy/claude-usage-tracker.js +1 -1
  90. package/dist/proxy/passthrough-server.js +1 -1
  91. package/dist/proxy/sse-usage-parser.js +1 -1
  92. package/dist/sdk/agent/agent-config.js +1 -1
  93. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  94. package/dist/sdk/agent/agent-yaml.js +1 -1
  95. package/dist/sdk/agent/test/evaluator.js +1 -1
  96. package/dist/sdk/agent/test/executor.js +1 -1
  97. package/dist/sdk/agent/test/index.js +1 -1
  98. package/dist/sdk/agent/test/output.js +1 -1
  99. package/dist/sdk/agent/test/parser.js +1 -1
  100. package/dist/sdk/agent/tool-target-registry.js +1 -1
  101. package/dist/sdk/api.js +1 -1
  102. package/dist/sdk/cas/cas-api-client.js +1 -1
  103. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  104. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  105. package/dist/sdk/cas/index.js +1 -1
  106. package/dist/sdk/cas/pull-workflow.js +1 -1
  107. package/dist/sdk/cas/push-workflow.js +1 -1
  108. package/dist/sdk/client/cdp-api-client.js +1 -1
  109. package/dist/sdk/client/delivery-api-client.js +1 -1
  110. package/dist/sdk/client/endpoints.js +1 -1
  111. package/dist/sdk/client/engage-api-client.js +1 -1
  112. package/dist/sdk/client/http-client.js +1 -1
  113. package/dist/sdk/client/llm-api-client.js +1 -1
  114. package/dist/sdk/client/oauth-refresh.js +1 -1
  115. package/dist/sdk/client/rate-limiter.js +1 -1
  116. package/dist/sdk/client/td-api-client.js +1 -1
  117. package/dist/sdk/client/trino-api-client.js +1 -1
  118. package/dist/sdk/client/workflow-client.js +1 -1
  119. package/dist/sdk/connection-validator.js +1 -1
  120. package/dist/sdk/connection.js +1 -1
  121. package/dist/sdk/delivery.js +1 -1
  122. package/dist/sdk/engage/campaign-pull.js +1 -1
  123. package/dist/sdk/engage/campaign-push.js +1 -1
  124. package/dist/sdk/engage/campaign-validator.js +1 -1
  125. package/dist/sdk/engage/campaign-yaml.js +1 -1
  126. package/dist/sdk/engage/template-pull.js +1 -1
  127. package/dist/sdk/engage/template-push.js +1 -1
  128. package/dist/sdk/engage/template-validator.js +1 -1
  129. package/dist/sdk/engage/template-yaml.js +1 -1
  130. package/dist/sdk/engage/types/campaign-def.js +1 -1
  131. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  132. package/dist/sdk/engage/types/template-schema.js +1 -1
  133. package/dist/sdk/engage.js +1 -1
  134. package/dist/sdk/errors.js +1 -1
  135. package/dist/sdk/index.d.ts +1 -0
  136. package/dist/sdk/index.d.ts.map +1 -1
  137. package/dist/sdk/index.js +1 -1
  138. package/dist/sdk/index.js.map +1 -1
  139. package/dist/sdk/io/index.js +1 -1
  140. package/dist/sdk/io/node-filesystem.js +1 -1
  141. package/dist/sdk/job.js +1 -1
  142. package/dist/sdk/journey.js +1 -1
  143. package/dist/sdk/llm/chat-cache.js +1 -1
  144. package/dist/sdk/llm/index.js +1 -1
  145. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  146. package/dist/sdk/llm/model-factors.js +1 -1
  147. package/dist/sdk/personalization.js +1 -1
  148. package/dist/sdk/policy.js +1 -1
  149. package/dist/sdk/query/index.js +1 -1
  150. package/dist/sdk/query/sql-parser.js +1 -1
  151. package/dist/sdk/realtime.js +1 -1
  152. package/dist/sdk/schedule.js +1 -1
  153. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  154. package/dist/sdk/segment/fields-display.js +1 -1
  155. package/dist/sdk/segment/file-discovery.js +1 -1
  156. package/dist/sdk/segment/journey-utils.js +1 -1
  157. package/dist/sdk/segment/journey-validator.js +1 -1
  158. package/dist/sdk/segment/journey-yaml.js +1 -1
  159. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  160. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  161. package/dist/sdk/segment/pull-workflow.js +1 -1
  162. package/dist/sdk/segment/push-recovery.js +1 -1
  163. package/dist/sdk/segment/push-workflow.js +1 -1
  164. package/dist/sdk/segment/resolution-context.js +1 -1
  165. package/dist/sdk/segment/segment-path-parser.js +1 -1
  166. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  167. package/dist/sdk/segment/segment-validator.js +1 -1
  168. package/dist/sdk/segment/target-resolution.js +1 -1
  169. package/dist/sdk/segment/tdx-config.js +1 -1
  170. package/dist/sdk/segment/types/activation-schema.js +1 -1
  171. package/dist/sdk/segment/types/journey-def.js +1 -1
  172. package/dist/sdk/segment/types/journey-schema.js +1 -1
  173. package/dist/sdk/segment/types/segment-def.js +1 -1
  174. package/dist/sdk/segment/types/segment-schema.js +1 -1
  175. package/dist/sdk/segment/validate-files.js +1 -1
  176. package/dist/sdk/segment/yaml-validator.js +1 -1
  177. package/dist/sdk/segment.js +1 -1
  178. package/dist/sdk/types/index.d.ts +2 -0
  179. package/dist/sdk/types/index.d.ts.map +1 -1
  180. package/dist/sdk/types/index.js +1 -1
  181. package/dist/sdk/types/index.js.map +1 -1
  182. package/dist/sdk/types/progress.js +1 -1
  183. package/dist/sdk/types/workspace.d.ts +169 -0
  184. package/dist/sdk/types/workspace.d.ts.map +1 -0
  185. package/dist/sdk/types/workspace.js +1 -0
  186. package/dist/sdk/types/workspace.js.map +1 -0
  187. package/dist/sdk/user.js +1 -1
  188. package/dist/sdk/util/format-detector.js +1 -1
  189. package/dist/sdk/util/formatters.js +1 -1
  190. package/dist/sdk/util/index.js +1 -1
  191. package/dist/sdk/util/paginate.js +1 -1
  192. package/dist/sdk/util/tree-formatter.js +1 -1
  193. package/dist/sdk/workflow/archive-validation.js +1 -1
  194. package/dist/sdk/workflow/clone-workflow.js +1 -1
  195. package/dist/sdk/workflow/index.js +1 -1
  196. package/dist/sdk/workflow/pull-workflow.js +1 -1
  197. package/dist/sdk/workflow/push-workflow.js +1 -1
  198. package/dist/sdk/workflow/tdx-config.js +1 -1
  199. package/dist/sdk/workflow/workflow-utils.js +1 -1
  200. package/dist/sdk/workspace/frontmatter.d.ts +28 -0
  201. package/dist/sdk/workspace/frontmatter.d.ts.map +1 -0
  202. package/dist/sdk/workspace/frontmatter.js +1 -0
  203. package/dist/sdk/workspace/frontmatter.js.map +1 -0
  204. package/dist/sdk/workspace/git.d.ts +70 -0
  205. package/dist/sdk/workspace/git.d.ts.map +1 -0
  206. package/dist/sdk/workspace/git.js +1 -0
  207. package/dist/sdk/workspace/git.js.map +1 -0
  208. package/dist/sdk/workspace/index.d.ts +166 -0
  209. package/dist/sdk/workspace/index.d.ts.map +1 -0
  210. package/dist/sdk/workspace/index.js +1 -0
  211. package/dist/sdk/workspace/index.js.map +1 -0
  212. package/dist/sdk/workspace/templates.d.ts +17 -0
  213. package/dist/sdk/workspace/templates.d.ts.map +1 -0
  214. package/dist/sdk/workspace/templates.js +1 -0
  215. package/dist/sdk/workspace/templates.js.map +1 -0
  216. package/dist/sdk/workspace/weekly.d.ts +49 -0
  217. package/dist/sdk/workspace/weekly.d.ts.map +1 -0
  218. package/dist/sdk/workspace/weekly.js +1 -0
  219. package/dist/sdk/workspace/weekly.js.map +1 -0
  220. package/dist/sdk/workspace/wikilinks.d.ts +49 -0
  221. package/dist/sdk/workspace/wikilinks.d.ts.map +1 -0
  222. package/dist/sdk/workspace/wikilinks.js +1 -0
  223. package/dist/sdk/workspace/wikilinks.js.map +1 -0
  224. package/dist/test-utils/command-runner.js +1 -1
  225. package/dist/test-utils/factories.js +1 -1
  226. package/dist/test-utils/fixtures.js +1 -1
  227. package/dist/test-utils/http-mock.js +1 -1
  228. package/dist/test-utils/index.js +1 -1
  229. package/dist/utils/async.js +1 -1
  230. package/dist/utils/colors.js +1 -1
  231. package/dist/utils/diff.js +1 -1
  232. package/dist/utils/file-permissions.js +1 -1
  233. package/dist/utils/file-reader.js +1 -1
  234. package/dist/utils/github-releases.js +1 -1
  235. package/dist/utils/global-cache.js +1 -1
  236. package/dist/utils/json-loader.js +1 -1
  237. package/dist/utils/local-cache.js +1 -1
  238. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  239. package/dist/utils/logger/formatters/index.js +1 -1
  240. package/dist/utils/logger/handlers/console-handler.js +1 -1
  241. package/dist/utils/logger/handlers/file-handler.js +1 -1
  242. package/dist/utils/logger/handlers/index.js +1 -1
  243. package/dist/utils/logger/handlers/null-handler.js +1 -1
  244. package/dist/utils/logger/index.js +1 -1
  245. package/dist/utils/logger/logger.js +1 -1
  246. package/dist/utils/logger/types.js +1 -1
  247. package/dist/utils/option-validation.js +1 -1
  248. package/dist/utils/process.js +1 -1
  249. package/dist/utils/prompt.js +1 -1
  250. package/dist/utils/spinner.js +1 -1
  251. package/dist/utils/sse-parser.js +1 -1
  252. package/dist/utils/string-utils.js +1 -1
  253. package/dist/utils/table-ref-parser.js +1 -1
  254. package/dist/utils/tdx-logger.js +1 -1
  255. package/dist/utils/version-check.js +1 -1
  256. package/package.json +1 -1
@@ -1 +1 @@
1
- const a151_0x403771=a151_0xf275;(function(_0x34673b,_0x4bacd6){const _0x3c5fc3=a151_0xf275,_0x54da34=_0x34673b();while(!![]){try{const _0x21a869=-parseInt(_0x3c5fc3(0x1a7))/0x1*(-parseInt(_0x3c5fc3(0xe4))/0x2)+parseInt(_0x3c5fc3(0x1b0))/0x3*(-parseInt(_0x3c5fc3(0x125))/0x4)+-parseInt(_0x3c5fc3(0x1ae))/0x5*(parseInt(_0x3c5fc3(0x1d6))/0x6)+parseInt(_0x3c5fc3(0x1d0))/0x7*(parseInt(_0x3c5fc3(0x109))/0x8)+parseInt(_0x3c5fc3(0x12d))/0x9+-parseInt(_0x3c5fc3(0x14a))/0xa*(parseInt(_0x3c5fc3(0x1a3))/0xb)+-parseInt(_0x3c5fc3(0x121))/0xc*(-parseInt(_0x3c5fc3(0x156))/0xd);if(_0x21a869===_0x4bacd6)break;else _0x54da34['push'](_0x54da34['shift']());}catch(_0x3a7f65){_0x54da34['push'](_0x54da34['shift']());}}}(a151_0x2b08,0x58684));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a151_0x403771(0x10f));export const PENDING_SEGMENT_PREFIX=a151_0x403771(0x116);export const PENDING_ACTIVATION_PREFIX=a151_0x403771(0xf5);export function createPendingSegmentId(_0x593946){return''+PENDING_SEGMENT_PREFIX+_0x593946+'__';}export function isPendingSegmentId(_0x225858){return _0x225858['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x225858['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0xd6400c){return _0xd6400c['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x5f1d77){return''+PENDING_ACTIVATION_PREFIX+_0x5f1d77+'__';}export function isPendingActivationId(_0x44bc46){const _0x160b68=a151_0x403771;return _0x44bc46[_0x160b68(0x14f)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x2a7720){return _0x2a7720['replace'](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x103d10,_0x2300bb){const _0x511b00=a151_0x403771,_0x315b9f=_0x103d10+'::'+(_0x2300bb['trim']()||_0x511b00(0xe1)),_0xb27f7=createHash('sha1')['update'](_0x315b9f)[_0x511b00(0x128)]('hex')[_0x511b00(0x187)](0x0,0xc);return'journey_entry_criteria_'+_0xb27f7;}export function ensureJourneyDefaults(_0x69e71d){const _0x32230c=a151_0x403771;!_0x69e71d['description']&&(_0x69e71d[_0x32230c(0x175)]=''),!_0x69e71d[_0x32230c(0x142)]&&(_0x69e71d['state']=_0x32230c(0x147));}export function injectExistingStageIds(_0x2ed170,_0x38a852){const _0x1b09db=a151_0x403771,_0x62fb0a=new Map(_0x38a852['map'](_0x3747c8=>[_0x3747c8['name'],_0x3747c8['id']]));for(const _0x30415b of _0x2ed170){if(!_0x30415b['id']){const _0x5eb90c=_0x62fb0a[_0x1b09db(0x16c)](_0x30415b[_0x1b09db(0x140)]);_0x5eb90c&&(_0x30415b['id']=_0x5eb90c);}}}export function resolveTDFolderPath(_0x134027,_0x636deb,_0x4636d5){const _0x1f1f6a=a151_0x403771;if(!_0x636deb)return _0x134027;if(_0x134027===_0x4636d5||_0x134027[_0x1f1f6a(0x14f)](_0x4636d5+'/'))return _0x134027;return _0x134027?_0x4636d5+'/'+_0x134027:_0x4636d5;}export function addFoldersToCreate(_0x394145,_0x5913b2,_0x39967b){const _0x1719e0=a151_0x403771;if(!_0x394145)return;if(_0x5913b2[_0x1719e0(0x16d)](_0x394145))return;const _0x220d3d=_0x394145[_0x1719e0(0x117)]('/');let _0x333d32='';for(const _0x3f73a4 of _0x220d3d){_0x333d32=_0x333d32?_0x333d32+'/'+_0x3f73a4:_0x3f73a4,!_0x5913b2[_0x1719e0(0x16d)](_0x333d32)&&_0x39967b[_0x1719e0(0x1c9)](_0x333d32);}}export function sortFoldersByDepth(_0xdb43b1){const _0x26b641=a151_0x403771;return[..._0xdb43b1][_0x26b641(0x13c)]((_0x785cb9,_0x2b6447)=>{const _0x340d2b=_0x26b641,_0x5c4fb6=(_0x785cb9[_0x340d2b(0x188)](/\//g)||[])[_0x340d2b(0x112)],_0x189f4c=(_0x2b6447['match'](/\//g)||[])[_0x340d2b(0x112)];return _0x5c4fb6-_0x189f4c;});}import*as a151_0x4508c5 from'yaml';import{readFileSync}from'fs';import a151_0x518d89 from'path';function a151_0x2b08(){const _0x34cdf8=['Deleted\x20activation\x20\x27','12999228AYUCho','all_columns','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','Failed\x20to\x20resolve\x20activation\x20','377492hyuMfv','activation_creating','INTERNAL','digest','SEGMENT_NOT_FOUND','toLowerCase','kind','JOURNEY_SYNTAX_ERROR','2020563NDsGss','absolutePath','isNew','connectionIdToNameMap','journeyBundleName','Created\x20folder\x20\x27','Created\x20journey\x20\x27','\x0a\x20\x20','segment_deleting','Updating\x20segment\x20\x27','behavior','\x20segment\x20from\x20file:\x20','all','filter','existingSegments','sort','delete','replace','from','name','notification','state','folderPathToId','Activation\x20not\x20found:\x20','Updated\x20activation\x20\x27','segment_updating','draft','entry','data','130ejKruE','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','onProgress',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','debug','startsWith','getLatestJourneyId','deps','activationParams','keys','segmentNameToId','embedded_segment_created','13rPyZtT','logSuccess','toISOString','run_after_journey_refresh','some','logInfo','effectiveFolderId','resolvedRule','activations','Fetching\x20','createActivation','connection','./journey-yaml.js','activation_updated','fetchJourney','user','yamlConfig','dirname','index','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','journeyById','verbose','get','has','segmentId','rootFolderId','\x27\x20milestone','folderId','steps','\x27\x20wait\x20condition','columns','description','NOT_FOUND','journeyName','Failed\x20to\x20','journey_created','entry_criteria','create','DecisionPoint','folder_created','versionNumber','Delete\x20the\x20push\x20recovery\x20file\x20(','entries','update','journeyStages','milestone','Segment\x20not\x20found','getJourney','object','slice','match','):\x20','relationships','utf-8','uniqueSegmentName',').\x20','idToName','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','idToEmailMap','\x27\x20entry\x20criteria','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','Activation','Updating\x20activation\x20\x27','and\x20the\x20server\x20segment,\x20then\x20retry.','journey_updating','deleteActivation','with','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','Matched\x20server\x20segment\x20\x27','unchanged','WaitStep','\x27...','connector_config','join','activationContext','resolveJourneyId','errors','371327YWyeYB','null','goal\x20criteria','valid','1HcGdha','attributes','\x20journey\x20from\x20file:\x20','./child-segment-yaml.js','branches','Failed\x20to\x20fetch\x20referenced\x20segment\x20','activation_deleted','1420RBsIHD','ACTIVATION_UPDATE_ERROR','21XqcqAi','ACTIVATION_SYNTAX_ERROR','folderPath','goal','parse','Name\x20has\x20already\x20been\x20taken','journey_creating','progress','Created\x20activation\x20\x27','Updated\x20segment\x20\x27','activation_updating','action','activationActions','\x27\x20for\x20','entryCriteria','localName','updateActivation','resolveSegment','stage\x20\x27','diff','exitCriterias','segments','set','flatMap','JOURNEY_UPDATE_ERROR','add','parseDocument','activation_deleting','folder','includes','parentId','results','3955NlKmsa','parentFolder','journeyActivationStepId','Journey\x20\x27','logDeleted','createdSegmentId','10734OcuYcu','type','journey_updated','Stage\x20\x27','buildUserMaps','embeddedSegmentNameToId','existingJourney','conditions','segment_deleted','Deleted\x20segment\x20\x27','conditionSegmentId','size','segment','hasChanges','Creating\x20folder\x20\x27','771166fXTuzB','Segment\x20not\x20found:\x20','activation_created','\x27\x20to\x20local\x20\x27','Entry\x20criteria:\x20','updated','relative','waitStep','stages','SEGMENT_UPDATE_ERROR','Condition','\x27\x20from\x20file:\x20','day','existingActivation','conditionTimeoutUnit','map','segmentFolderId','__pending_act_','validatedRequest','getSegmentEntity\x20also\x20failed\x20for\x20','created','stringify','segmentByFolderAndName','createJourneySegment','Creating\x20segment\x20\x27','deleteSegment','journey','listActivations','journeyActivationNameToId','createFolder','parentSegmentFolder','skipSegments','schedule','createdSegmentIds','updateSegmentById','getActivation','existingSegment','3912LydIyT','waitStepType','journeyId','withProgress','deleted','push','tdx.sdk.push-workflow','getSegment\x20failed\x20for\x20','\x20(referenced\x20in\x20journey\x20','length','\x27\x20exit\x20criteria','activation_template_id','find','__pending_','split','values','conditionTimeoutDuration','toString','journeys','rule','max','\x27\x20decision\x20point\x20branch\x20\x27','segment_creating'];a151_0x2b08=function(){return _0x34cdf8;};return a151_0x2b08();}import{isJourneyDef,parseYamlString as a151_0x3a7b76,toYamlString as a151_0x55512a,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(_0x5605db){const _0x55c325=a151_0x403771;if(Array['isArray'](_0x5605db))return'['+_0x5605db['map'](_0x4419d2=>stableStringify(_0x4419d2))[_0x55c325(0x19f)](',')+']';if(_0x5605db&&typeof _0x5605db===_0x55c325(0x186)){const _0x44205c=_0x5605db,_0x1054dd=Object[_0x55c325(0x153)](_0x44205c)[_0x55c325(0x13c)](),_0x24cd89=_0x1054dd[_0x55c325(0xf3)](_0x43a15d=>'\x22'+_0x43a15d+'\x22:'+stableStringify(_0x44205c[_0x43a15d]));return'{'+_0x24cd89[_0x55c325(0x19f)](',')+'}';}const _0x37b89b=JSON[_0x55c325(0xf9)](_0x5605db);return _0x37b89b===undefined?_0x55c325(0x1a4):_0x37b89b;}function activationSignature(_0x2a3684){const _0x1131ee=a151_0x403771,_0x43927d={'connection':_0x2a3684[_0x1131ee(0x161)],..._0x2a3684[_0x1131ee(0x122)]!==undefined&&{'all_columns':_0x2a3684[_0x1131ee(0x122)]},..._0x2a3684[_0x1131ee(0x174)]!==undefined&&{'columns':_0x2a3684[_0x1131ee(0x174)]},..._0x2a3684['behavior']!==undefined&&{'behavior':_0x2a3684[_0x1131ee(0x137)]},..._0x2a3684[_0x1131ee(0x104)]!==undefined&&{'schedule':_0x2a3684['schedule']},..._0x2a3684[_0x1131ee(0x141)]!==undefined&&{'notification':_0x2a3684[_0x1131ee(0x141)]},..._0x2a3684[_0x1131ee(0x19e)]!==undefined&&{'connector_config':_0x2a3684['connector_config']},..._0x2a3684[_0x1131ee(0x114)]!==undefined&&{'activation_template_id':_0x2a3684[_0x1131ee(0x114)]}};return stableStringify(_0x43927d);}async function fetchSegment(_0x510f16,_0x763c0c,_0x3f9ab3,_0x147418){const _0x2c8663=a151_0x403771,_0x1daad0=_0x147418?.[_0x2c8663(0x115)](_0x2e6d42=>_0x2e6d42['id']===_0x3f9ab3);if(_0x1daad0)return _0x1daad0;try{return await _0x510f16[_0x2c8663(0xe1)]['getSegment'](_0x763c0c,_0x3f9ab3);}catch(_0x10f514){logger['debug'](_0x2c8663(0x110)+_0x3f9ab3+_0x2c8663(0x14d)+_0x10f514);try{return await _0x510f16['segment']['getSegmentEntity'](_0x3f9ab3);}catch(_0x176669){return logger[_0x2c8663(0x14e)](_0x2c8663(0xf7)+_0x3f9ab3+':\x20'+_0x176669),null;}}}function recoverSegmentIdsFromPushRecovery(_0x2d445d,_0x3ab526,_0x1e209a){const _0x4bbc36=a151_0x403771,_0x28e2ab=readPushRecovery(_0x2d445d[_0x4bbc36(0x12e)]);if(_0x28e2ab?.['journeyName']===_0x2d445d['yamlConfig'][_0x4bbc36(0x140)])for(const [_0x498d3d,_0x170b6f]of Object[_0x4bbc36(0x180)](_0x28e2ab[_0x4bbc36(0x1c5)])){const _0x135f37=generateDeterministicJourneySegmentName(_0x2d445d['yamlConfig'][_0x4bbc36(0x140)],_0x498d3d);_0x170b6f['uniqueServerName']===_0x135f37&&(_0x3ab526[_0x4bbc36(0x1c6)](_0x498d3d,_0x170b6f['segmentId']),_0x1e209a['set'](_0x498d3d,_0x170b6f[_0x4bbc36(0x16e)]));}}async function createOrRecoverEmbeddedSegment(_0x4ec68c,_0x23dc73,_0x126eca,_0x40b2c6){const _0x28a415=a151_0x403771;let _0x4e4f49;try{_0x4e4f49=await _0x4ec68c[_0x28a415(0xe1)][_0x28a415(0xfb)]({'name':_0x126eca[_0x28a415(0x18c)],'description':_0x126eca['description'],'journeyId':_0x126eca[_0x28a415(0x10b)],'rule':_0x40b2c6(_0x126eca[_0x28a415(0x15d)],!![]),'countPopulation':!![],'parentFolderId':_0x126eca['folderId'],'audienceId':_0x126eca['parentId']});}catch(_0x3db453){const _0x1f5813=_0x3db453 instanceof Error&&_0x3db453['message'][_0x28a415(0x1cd)](_0x28a415(0x1b5));if(_0x1f5813){const _0x4a0932=readPushRecovery(_0x23dc73[_0x28a415(0x12e)]),_0x4ec2ee=_0x4a0932?.[_0x28a415(0x177)]===_0x23dc73[_0x28a415(0x166)][_0x28a415(0x140)]?_0x4a0932['segments'][_0x126eca[_0x28a415(0x1bf)]]:undefined;if(_0x4ec2ee?.['uniqueServerName']===_0x126eca[_0x28a415(0x18c)])await _0x4ec68c[_0x28a415(0xe1)][_0x28a415(0x106)](_0x126eca[_0x28a415(0x1ce)],_0x4ec2ee[_0x28a415(0x16e)],{'description':_0x126eca[_0x28a415(0x175)],'rule':_0x40b2c6(_0x126eca[_0x28a415(0x15d)],!![]),'countPopulation':!![]}),_0x4e4f49=_0x4ec2ee[_0x28a415(0x16e)];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],'Embedded\x20segment\x20\x27'+_0x126eca[_0x28a415(0x1bf)]+_0x28a415(0x18f)+(_0x28a415(0x17f)+_0x23dc73[_0x28a415(0x12e)][_0x28a415(0x13e)](/([^/]+)$/,'.$1.push-recovery.json')+')\x20')+_0x28a415(0x195),_0x3db453);}else throw _0x3db453;}return saveSegmentToPushRecovery(_0x23dc73['absolutePath'],_0x23dc73[_0x28a415(0x166)][_0x28a415(0x140)],_0x126eca[_0x28a415(0x1bf)],{'segmentId':_0x4e4f49,'uniqueServerName':_0x126eca[_0x28a415(0x18c)],'createdAt':new Date()[_0x28a415(0x158)]()}),_0x4e4f49;}export async function prepareSegmentFiles(_0x1fc471,_0xc95f5d,_0x18496b,_0x239528,_0x3afb37){const _0xa0f8a2=a151_0x403771,{activationDefToCreateRequest:_0x519ed5}=await import(_0xa0f8a2(0x1aa)),_0x11c57b=[],_0x434184=new Set();for(const {yamlConfig:_0x3e9cb3,folderPath:_0x162f40,sourcePath:_0x5a7c89}of _0x1fc471){const _0x495393=resolveTDFolderPath(_0x162f40,_0x239528,_0x3afb37),_0x2553c0=_0x495393+':'+_0x3e9cb3[_0xa0f8a2(0x140)],_0x516b0a=_0xc95f5d[_0xa0f8a2(0xfa)]['get'](_0x2553c0),_0x47ff66=_0x516b0a?_0xc95f5d['activationsBySegmentId'][_0xa0f8a2(0x16c)](_0x516b0a['id'])||[]:[];addFoldersToCreate(_0x495393,_0xc95f5d['folderPathToId'],_0x434184);const _0x4ff371=calculateActivationActions(_0x3e9cb3['activations']||[],_0x47ff66,_0xc95f5d[_0xa0f8a2(0x190)],_0xc95f5d[_0xa0f8a2(0x130)]);for(const _0xb41d8f of _0x4ff371){(_0xb41d8f[_0xa0f8a2(0x1d7)]===_0xa0f8a2(0x17b)||_0xb41d8f['type']===_0xa0f8a2(0x181))&&_0xb41d8f['yamlActivation']&&(_0xb41d8f['validatedRequest']=await _0x519ed5(_0xb41d8f['yamlActivation'],_0x18496b));}const _0x451456=calculateSegmentDiff(_0x3e9cb3,_0x516b0a,_0x47ff66,_0xc95f5d[_0xa0f8a2(0x190)],_0xc95f5d[_0xa0f8a2(0x130)]);_0x11c57b[_0xa0f8a2(0x10e)]({'relativePath':_0x3e9cb3[_0xa0f8a2(0x140)],'absolutePath':_0x5a7c89,'yamlConfig':_0x3e9cb3,'folderPath':_0x495393,'existingSegment':_0x516b0a,'existingActivations':_0x47ff66,'isNew':_0x451456[_0xa0f8a2(0x12f)],'hasChanges':_0x451456['hasChanges'],'diff':_0x451456['diff'],'activationActions':_0x4ff371});}return{'segmentFiles':_0x11c57b,'foldersToCreate':_0x434184};}export async function prepareJourneyFiles(_0x451d6b,_0x37553a,_0x1081c7,_0x4be896){const _0x2ba365=a151_0x403771,_0x4905e4=[],_0x38f1d0=new Set();for(const {yamlConfig:_0x1eab29,folderPath:_0x22af6b,sourcePath:_0x3f400d}of _0x451d6b){const _0x3e51da=resolveTDFolderPath(_0x22af6b,_0x1081c7,_0x4be896),_0x5e4b1d=_0x3e51da+':'+_0x1eab29[_0x2ba365(0x140)],_0x52735b=_0x37553a['journeyBundlesByFolderAndName'][_0x2ba365(0x16c)](_0x5e4b1d);let _0x2c0622,_0x50198b;if(_0x52735b&&_0x52735b['length']>0x0){const _0x385659=buildLocalExpandedRuleMappings(_0x1eab29),{createYamlContext:_0x42182e,prefetchJourneySegments:_0x66961d}=createPushYamlContextForBundle(_0x37553a[_0x2ba365(0x151)],_0x37553a['parentId'],_0x37553a[_0x2ba365(0x13b)],_0x385659,_0x37553a[_0x2ba365(0x190)],_0x37553a['connectionIdToNameMap'],_0x37553a['activationStepsById'],_0x37553a['journeyById']);await _0x66961d(_0x52735b[_0x2ba365(0xf3)](_0x3ec668=>_0x3ec668['id']));const _0x356057=await _0x37553a[_0x2ba365(0x151)][_0x2ba365(0xfe)][_0x2ba365(0x150)](_0x52735b[0x0]['journeyBundleId']),_0x5f20db=hasMultipleVersions(_0x1eab29),_0x2f67ad=async _0x1d7f23=>{const _0x195123=_0x2ba365,_0x28fc31=_0x37553a[_0x195123(0x16a)]?.[_0x195123(0x16c)](_0x1d7f23);if(_0x28fc31)return _0x28fc31;return _0x37553a[_0x195123(0x164)]({'journeyId':_0x1d7f23,'journeyName':_0x1eab29[_0x195123(0x140)],'isMultiVersion':_0x52735b[_0x195123(0x112)]>0x1});};if(_0x5f20db&&_0x52735b['length']>0x1){const _0x8aaa31=[];for(const _0x285655 of _0x52735b){const _0x582357=_0x285655[_0x2ba365(0x17e)]||0x1;_0x37553a[_0x2ba365(0x1b7)]?.['update']('Fetching\x20'+_0x1eab29[_0x2ba365(0x140)]+'\x20v'+_0x582357);const _0x101fcc=await _0x2f67ad(_0x285655['id']),_0xa01a4a=_0x42182e(_0x285655['id']),_0x20d81c=await journeyResponseToDef(_0x101fcc,_0xa01a4a);_0x8aaa31[_0x2ba365(0x10e)]({'item':_0x285655,'yaml':_0x20d81c});}const _0x412cbe=buildLocalRuleToNameMappingFromJourney(_0x1eab29);_0x50198b=buildMergedJourneyDef(_0x8aaa31,_0x412cbe,_0x356057);const _0x8fa65b=Math[_0x2ba365(0x11d)](..._0x8aaa31[_0x2ba365(0xf3)](_0x13e23d=>_0x13e23d['item'][_0x2ba365(0x17e)]||0x0)),_0x155d0a=_0x52735b[_0x2ba365(0x115)](_0x2d6b2f=>(_0x2d6b2f[_0x2ba365(0x17e)]||0x0)===_0x8fa65b);_0x155d0a&&(_0x37553a[_0x2ba365(0x1b7)]?.[_0x2ba365(0x181)](_0x2ba365(0x15f)+_0x1eab29['name']+'\x20v'+_0x8fa65b),_0x2c0622=await _0x2f67ad(_0x155d0a['id']));}else{const _0x4135ae=_0x52735b[_0x52735b[_0x2ba365(0x112)]-0x1];_0x37553a[_0x2ba365(0x1b7)]?.[_0x2ba365(0x181)]('Fetching\x20'+_0x1eab29[_0x2ba365(0x140)]),_0x2c0622=await _0x2f67ad(_0x4135ae['id']);const _0x294f43=_0x42182e(_0x4135ae['id']),_0x3f980e=await journeyResponseToDef(_0x2c0622,_0x294f43),_0x2ba846=buildLocalRuleToNameMappingFromJourney(_0x1eab29);_0x50198b=buildMergedJourneyDef([{'item':_0x4135ae,'yaml':_0x3f980e}],_0x2ba846,_0x356057);}}addFoldersToCreate(_0x3e51da,_0x37553a[_0x2ba365(0x143)],_0x38f1d0);const _0x12e2bb=calculateJourneyDiff(_0x1eab29,_0x50198b);_0x4905e4[_0x2ba365(0x10e)]({'relativePath':_0x1eab29[_0x2ba365(0x140)],'absolutePath':_0x3f400d,'yamlConfig':_0x1eab29,'folderPath':_0x3e51da,'existingJourney':_0x2c0622,'isNew':_0x12e2bb[_0x2ba365(0x12f)],'hasChanges':_0x12e2bb['hasChanges'],'diff':_0x12e2bb[_0x2ba365(0x1c3)]});}return{'journeyFiles':_0x4905e4,'foldersToCreate':_0x38f1d0};}function a151_0xf275(_0x92d4b2,_0x492207){_0x92d4b2=_0x92d4b2-0xdf;const _0x2b0840=a151_0x2b08();let _0xf2751f=_0x2b0840[_0x92d4b2];return _0xf2751f;}export function calculateActivationActions(_0x287c1d,_0xa20b06,_0x2c7256,_0x288793){const _0x4016a3=a151_0x403771,_0x4c475f=[],_0x19aad4=new Map();for(const _0x1eecbb of _0xa20b06){_0x19aad4['set'](_0x1eecbb[_0x4016a3(0x140)],_0x1eecbb);}const _0x27615f=new Map();for(const _0x1e785f of _0x287c1d){_0x27615f[_0x4016a3(0x1c6)](_0x1e785f['name'],_0x1e785f);}for(const _0x529600 of _0x287c1d){const _0x53b829=_0x19aad4[_0x4016a3(0x16c)](_0x529600[_0x4016a3(0x140)]);if(!_0x53b829)_0x4c475f[_0x4016a3(0x10e)]({'type':_0x4016a3(0x17b),'name':_0x529600['name'],'yamlActivation':_0x529600});else{const _0x26bc0e=activationResponseToDef(_0x53b829,_0x2c7256,_0x288793),_0x23689e=a151_0x4508c5[_0x4016a3(0xf9)](_0x26bc0e),_0x2d7608=a151_0x4508c5[_0x4016a3(0xf9)](_0x529600);_0x23689e!==_0x2d7608&&_0x4c475f['push']({'type':_0x4016a3(0x181),'name':_0x529600[_0x4016a3(0x140)],'yamlActivation':_0x529600,'existingActivation':_0x53b829});}}for(const _0x3f73a2 of _0xa20b06){!_0x27615f[_0x4016a3(0x16d)](_0x3f73a2[_0x4016a3(0x140)])&&_0x4c475f[_0x4016a3(0x10e)]({'type':_0x4016a3(0x13d),'name':_0x3f73a2[_0x4016a3(0x140)],'existingActivation':_0x3f73a2});}return _0x4c475f;}function calculateYamlDiff(_0x4c061a,_0x43470b){if(_0x43470b){const _0x22776d=generateDiff(_0x43470b,_0x4c061a),_0x55970d=hasChanges(_0x22776d);return{'isNew':![],'hasChanges':_0x55970d,'diff':_0x55970d?formatDiffWithColors(_0x22776d):undefined};}const _0x3ca9bb=generateDiff('',_0x4c061a);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x3ca9bb)};}export function calculateSegmentDiff(_0x3e4a3d,_0x375f70,_0x39af61,_0x75164f,_0x3d58b0){const _0x390f3b=segmentToYamlString(_0x3e4a3d),_0x19db72=_0x375f70?segmentToYamlString(segmentWithActivationsToYaml(_0x375f70,_0x39af61,undefined,_0x75164f,_0x3d58b0)):undefined;return calculateYamlDiff(_0x390f3b,_0x19db72);}export function calculateJourneyDiff(_0x1859e5,_0x576d77){const _0x451371=normalizeJourneyDef(_0x1859e5,_0x1859e5),_0xef9863=a151_0x55512a(_0x451371),_0x3afc1c=_0x576d77?a151_0x55512a(normalizeJourneyDef(_0x576d77,_0x1859e5)):undefined;return calculateYamlDiff(_0xef9863,_0x3afc1c);}export function findSegmentsToDelete(_0x39386d,_0x32aecd,_0x271e99,_0x2b53e1,_0x2fd609){const _0xf40ce2=a151_0x403771,_0x16d2c6=new Set();for(const {yamlConfig:_0x681437,folderPath:_0x5936ba}of _0x32aecd){_0x16d2c6[_0xf40ce2(0x1c9)](_0x5936ba+':'+_0x681437[_0xf40ce2(0x140)]);}return _0x39386d['filter'](_0x52c707=>{const _0x46293b=_0xf40ce2,_0x2dcc39=_0x52c707['segmentFolderId']?_0x271e99[_0x46293b(0x16c)](_0x52c707[_0x46293b(0xf4)][_0x46293b(0x11a)]())||'':'',_0x24c459=_0x2dcc39+':'+_0x52c707[_0x46293b(0x140)];if(_0x16d2c6[_0x46293b(0x16d)](_0x24c459))return![];if(_0x2fd609)return _0x2dcc39===_0x2b53e1||_0x2dcc39[_0x46293b(0x14f)](_0x2b53e1+'/');return!![];});}export function findJourneysToDelete(_0x376cd3,_0x3e2aeb,_0x3b014e,_0x29d003,_0x5aee44){const _0x2a6aea=a151_0x403771,_0x115fc3=new Set();for(const {yamlConfig:_0x47b577,folderPath:_0x189566}of _0x3e2aeb){_0x115fc3['add'](_0x189566+':'+_0x47b577['name']);}return _0x376cd3[_0x2a6aea(0x13a)](_0x5b75c5=>{const _0x10d9dc=_0x2a6aea,_0x5857ad=_0x5b75c5[_0x10d9dc(0x171)]?_0x3b014e[_0x10d9dc(0x16c)](_0x5b75c5[_0x10d9dc(0x171)])||'':'',_0x1a9f29=_0x5857ad+':'+_0x5b75c5[_0x10d9dc(0x131)];if(_0x115fc3[_0x10d9dc(0x16d)](_0x1a9f29))return![];if(_0x5aee44)return _0x5857ad===_0x29d003||_0x5857ad[_0x10d9dc(0x14f)](_0x29d003+'/');return!![];});}export function buildSegmentLookupMap(_0x532231,_0x5697e0){const _0x1e93c6=a151_0x403771,_0x58d837=new Map();for(const _0x2b4566 of _0x532231){const _0x48e25d=_0x2b4566[_0x1e93c6(0xf4)]?_0x5697e0['get'](_0x2b4566['segmentFolderId'][_0x1e93c6(0x11a)]())||'':'',_0x5a902b=_0x48e25d+':'+_0x2b4566[_0x1e93c6(0x140)];_0x58d837[_0x1e93c6(0x1c6)](_0x5a902b,_0x2b4566);}return _0x58d837;}export function buildSegmentNameToIdMap(_0x30b4ce){const _0x3ff22b=a151_0x403771,_0x2a3f57=new Map();for(const _0x1fafd4 of _0x30b4ce){_0x2a3f57['set'](_0x1fafd4[_0x3ff22b(0x140)],_0x1fafd4['id']);}return _0x2a3f57;}export function buildJourneyBundleLookupMap(_0x4d7c4c,_0x426eeb){const _0x236389=a151_0x403771,_0x19cd61=new Map();for(const _0x4fa8b7 of _0x4d7c4c){const _0x1d0ae8=_0x4fa8b7[_0x236389(0x171)]?_0x426eeb[_0x236389(0x16c)](_0x4fa8b7[_0x236389(0x171)])||'':'',_0x188f29=_0x1d0ae8+':'+_0x4fa8b7[_0x236389(0x131)];!_0x19cd61[_0x236389(0x16d)](_0x188f29)&&_0x19cd61[_0x236389(0x1c6)](_0x188f29,[]),_0x19cd61['get'](_0x188f29)[_0x236389(0x10e)](_0x4fa8b7);}for(const _0x54a63a of _0x19cd61[_0x236389(0x118)]()){_0x54a63a['sort']((_0x5a6720,_0x1b1f57)=>(_0x5a6720[_0x236389(0x17e)]||0x0)-(_0x1b1f57[_0x236389(0x17e)]||0x0));}return _0x19cd61;}export function collectFoldersToCreate(_0x209ec6,_0xf9cfbe){const _0x3788eb=a151_0x403771,_0x15243e=new Set();for(const _0x5b9cae of _0x209ec6){if(!_0x5b9cae)continue;if(_0xf9cfbe[_0x3788eb(0x16d)](_0x5b9cae))continue;const _0x277c12=_0x5b9cae['split']('/');let _0x33331b='';for(const _0x138481 of _0x277c12){_0x33331b=_0x33331b?_0x33331b+'/'+_0x138481:_0x138481,!_0xf9cfbe['has'](_0x33331b)&&_0x15243e[_0x3788eb(0x1c9)](_0x33331b);}}return _0x15243e;}export function parseAndClassifyYamlFiles(_0x31d0ab,_0x33f55f,_0x3f1eba){const _0x59476f=a151_0x403771,_0x192468=[],_0x39930a=[];for(const _0x7fa4e7 of _0x31d0ab){const _0x243937=a151_0x518d89[_0x59476f(0xea)](_0x33f55f,a151_0x518d89[_0x59476f(0x167)](_0x7fa4e7)),_0x1bf13c=_0x243937==='.'?'':_0x243937,_0x668d75=readFileSync(_0x7fa4e7,_0x59476f(0x18b)),_0x2e27f8=a151_0x4508c5[_0x59476f(0x1b4)](_0x668d75);if(isJourneyDef(_0x2e27f8)){const _0x19a9d7=a151_0x3a7b76(_0x668d75);_0x39930a[_0x59476f(0x10e)]({'yamlConfig':_0x19a9d7,'folderPath':_0x1bf13c,'sourcePath':_0x7fa4e7});}else{if(!_0x3f1eba?.[_0x59476f(0x103)]){const _0x2bbf82=parseSegmentYamlFile(_0x668d75),_0x177963=normalizeChildSegmentYaml(_0x2bbf82);_0x192468['push']({'yamlConfig':_0x177963,'folderPath':_0x1bf13c,'sourcePath':_0x7fa4e7});}}}return{'segments':_0x192468,'journeys':_0x39930a};}export function validateParsedFiles(_0x34c03a,_0x2bbbd8){const _0x251904=a151_0x403771,_0x333a5f=[];for(const {yamlConfig:_0x7b9113,sourcePath:_0x2ff506}of _0x34c03a[_0x251904(0x1c5)]){const _0x4b5064=readFileSync(_0x2ff506,_0x251904(0x18b)),_0x261e8e=a151_0x4508c5['parseDocument'](_0x4b5064),_0x17e67b=validateSegmentDef(_0x7b9113,{'source':_0x4b5064,'document':_0x261e8e},{'skipSchema':!![]});if(!_0x17e67b[_0x251904(0x1a6)]){const _0xef8492=a151_0x518d89['relative'](_0x2bbbd8,_0x2ff506);_0x333a5f[_0x251904(0x10e)]({'filePath':_0xef8492,'source':_0x4b5064,'result':_0x17e67b,'isJourney':![]});}}for(const {yamlConfig:_0x34e02d,sourcePath:_0x393e1c}of _0x34c03a[_0x251904(0x11b)]){const _0x5f11e0=readFileSync(_0x393e1c,_0x251904(0x18b)),_0x113aeb=a151_0x4508c5[_0x251904(0x1ca)](_0x5f11e0),_0xba5ba1=validateJourneyDef(_0x34e02d,{'source':_0x5f11e0,'document':_0x113aeb},{'skipSchema':!![]});if(!_0xba5ba1[_0x251904(0x1a6)]){const _0x2425ef=a151_0x518d89['relative'](_0x2bbbd8,_0x393e1c);_0x333a5f[_0x251904(0x10e)]({'filePath':_0x2425ef,'source':_0x5f11e0,'result':_0xba5ba1,'isJourney':!![]});}}return _0x333a5f;}export function formatValidationErrors(_0x26b301){const _0x3f957e=a151_0x403771,_0x5ddadf=[];for(const {filePath:_0x3aa4a4,source:_0xe8f34,result:_0x552756,isJourney:_0x18ab0a}of _0x26b301){const _0x170bc6=_0x18ab0a?_0x3f957e(0xfe):_0x3f957e(0xe1);_0x5ddadf['push']('\x0a'+_0x3aa4a4+'\x20('+_0x170bc6+_0x3f957e(0x189)+_0x552756[_0x3f957e(0x1a2)][_0x3f957e(0x112)]+'\x20error(s)'),_0x5ddadf[_0x3f957e(0x10e)](formatValidationResult(_0x552756,_0xe8f34,_0x3aa4a4));}return _0x5ddadf[_0x3f957e(0x19f)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x22c0a4){const _0x25cfe4=a151_0x403771,_0x3a79d6=new Set(),_0x422c26=new Map(),_0x40e299=collectSegmentUsageCounts(_0x22c0a4);if(_0x22c0a4[_0x25cfe4(0x1c5)])for(const [_0x2c486e,_0x41d6e8]of Object[_0x25cfe4(0x180)](_0x22c0a4[_0x25cfe4(0x1c5)])){_0x3a79d6[_0x25cfe4(0x1c9)](_0x2c486e);if(_0x41d6e8[_0x25cfe4(0x11c)]){const _0xe1f569=yamlRuleToApi(_0x41d6e8[_0x25cfe4(0x11c)]),_0x4d6814=apiRuleToYaml(_0xe1f569);_0x422c26[_0x25cfe4(0x1c6)](_0x2c486e,_0x4d6814);}}const _0x1580ff=new Map();let _0x1a5f41=0x0;for(const [_0x52ed4b,_0x5c5b40]of _0x422c26){const _0x2b3bd3=serializeExpandedRule(_0x5c5b40,_0x422c26),_0x4ee5cd=_0x1580ff[_0x25cfe4(0x16c)](_0x2b3bd3)||[];_0x4ee5cd[_0x25cfe4(0x10e)]({'name':_0x52ed4b,'index':_0x1a5f41}),_0x1580ff[_0x25cfe4(0x1c6)](_0x2b3bd3,_0x4ee5cd),_0x1a5f41++;}const _0xdbb6d=new Map();for(const [_0x4d4de6,_0xa904e5]of _0x1580ff){const _0x139829=_0xa904e5[_0x25cfe4(0x187)]()[_0x25cfe4(0x13c)]((_0xfb31f0,_0x21c973)=>{const _0x47150c=_0x25cfe4,_0x484c3d=_0x40e299[_0x47150c(0x16c)](_0xfb31f0[_0x47150c(0x140)])||0x0,_0x26c326=_0x40e299[_0x47150c(0x16c)](_0x21c973['name'])||0x0;if(_0x484c3d!==_0x26c326)return _0x26c326-_0x484c3d;return _0xfb31f0['index']-_0x21c973[_0x47150c(0x168)];})['map'](_0xd41c11=>_0xd41c11['name']),_0x9d0522=[];for(const _0x16fc3b of _0x139829){const _0x3d522c=_0x40e299['get'](_0x16fc3b)||0x0,_0x585af6=Math[_0x25cfe4(0x11d)](_0x3d522c,0x1);for(let _0x4ca075=0x0;_0x4ca075<_0x585af6;_0x4ca075++){_0x9d0522[_0x25cfe4(0x10e)](_0x16fc3b);}}_0xdbb6d[_0x25cfe4(0x1c6)](_0x4d4de6,_0x9d0522);}return{'existingLocalSegmentNames':_0x3a79d6,'localSegmentRules':_0x422c26,'localExpandedRuleToNames':_0xdbb6d};}export function createSegmentIdResolver(_0x22a8f4,_0x33824e){return async _0x520fe2=>{const _0x5640e3=a151_0xf275,_0x321ead=_0x22a8f4['get'](_0x520fe2);if(!_0x321ead)throw new SDKError(ErrorCode[_0x5640e3(0x129)],'Segment\x20not\x20found:\x20'+_0x520fe2+_0x5640e3(0x192)+_0x33824e+'\x27)');return _0x321ead;};}export function extractRootFolderId(_0x26050c){const _0x2ac65b=a151_0x403771;return _0x26050c[_0x2ac65b(0x18a)]?.[_0x2ac65b(0x102)]?.[_0x2ac65b(0x149)]?.['id']||_0x26050c['relationships']?.[_0x2ac65b(0x1d1)]?.[_0x2ac65b(0x149)]?.['id'];}export function buildConnectionMaps(_0x5385e1){const _0x20bae6=a151_0x403771,_0x5890fe=new Map(),_0x4dc008=new Map(),_0x35ce70=new Map();for(const _0x245989 of _0x5385e1){_0x5890fe[_0x20bae6(0x1c6)](_0x245989[_0x20bae6(0x140)],parseInt(_0x245989['id'],0xa)),_0x4dc008[_0x20bae6(0x1c6)](_0x245989['id'],_0x245989[_0x20bae6(0x140)]),_0x35ce70[_0x20bae6(0x1c6)](_0x245989[_0x20bae6(0x140)],_0x245989[_0x20bae6(0x1d7)]);}return{'nameToId':_0x5890fe,'idToName':_0x4dc008,'nameToType':_0x35ce70};}export function calculatePushStats(_0xf7129f,_0x1b5fb2,_0x286cd4,_0x100af9,_0x29f81a,_0x4ab3cc,_0x5a1b7e){const _0x11954a=a151_0x403771,_0x1fd915=_0xf7129f[_0x11954a(0x13a)](_0x540e4a=>_0x540e4a[_0x11954a(0x12f)]),_0x3fb387=_0xf7129f[_0x11954a(0x13a)](_0x467ad3=>!_0x467ad3['isNew']&&_0x467ad3[_0x11954a(0xe2)]),_0xb4c1c8=_0xf7129f[_0x11954a(0x13a)](_0x3f366f=>!_0x3f366f[_0x11954a(0x12f)]&&!_0x3f366f[_0x11954a(0xe2)]),_0x1b96e2=_0x4ab3cc?_0x100af9:[],_0x3cb213=_0x1b5fb2[_0x11954a(0x13a)](_0x12045f=>_0x12045f[_0x11954a(0x12f)]),_0x45f88c=_0x1b5fb2[_0x11954a(0x13a)](_0x3c7027=>!_0x3c7027[_0x11954a(0x12f)]&&_0x3c7027[_0x11954a(0xe2)]),_0x3c8816=_0x1b5fb2[_0x11954a(0x13a)](_0x28e841=>!_0x28e841[_0x11954a(0x12f)]&&!_0x28e841[_0x11954a(0xe2)]),_0x16f6e7=_0x4ab3cc?_0x29f81a:[],_0x556733=_0xf7129f[_0x11954a(0x1c7)](_0x42c29c=>_0x42c29c[_0x11954a(0x1bc)]),_0x5cc15b=_0x556733[_0x11954a(0x13a)](_0x507b4e=>_0x507b4e[_0x11954a(0x1d7)]===_0x11954a(0x17b)),_0x1fc85f=_0x556733[_0x11954a(0x13a)](_0x108eed=>_0x108eed[_0x11954a(0x1d7)]===_0x11954a(0x181)),_0x162138=_0x556733['filter'](_0x191de5=>_0x191de5['type']===_0x11954a(0x13d)),_0x296d1c=Array[_0x11954a(0x13f)](_0x286cd4)[_0x11954a(0x13c)](),_0x22af09=_0x5a1b7e?![]:_0x1fd915[_0x11954a(0x112)]>0x0||_0x3fb387[_0x11954a(0x112)]>0x0||_0x1b96e2[_0x11954a(0x112)]>0x0,_0x20e2e4=_0x3cb213[_0x11954a(0x112)]>0x0||_0x45f88c[_0x11954a(0x112)]>0x0||_0x16f6e7[_0x11954a(0x112)]>0x0,_0x18145b=_0x5a1b7e?![]:_0x556733[_0x11954a(0x112)]>0x0,_0x274380=_0x296d1c[_0x11954a(0x112)]>0x0;return{'segments':{'new':_0x1fd915,'changed':_0x3fb387,'unchanged':_0xb4c1c8,'toDelete':_0x1b96e2},'journeys':{'new':_0x3cb213,'changed':_0x45f88c,'unchanged':_0x3c8816,'toDelete':_0x16f6e7},'activations':{'all':_0x556733,'toCreate':_0x5cc15b,'toUpdate':_0x1fc85f,'toDelete':_0x162138},'folders':{'toCreate':_0x296d1c},'counts':{'segments':{'new':_0x1fd915['length'],'changed':_0x3fb387[_0x11954a(0x112)],'unchanged':_0xb4c1c8[_0x11954a(0x112)],'toDelete':_0x1b96e2[_0x11954a(0x112)]},'journeys':{'new':_0x3cb213[_0x11954a(0x112)],'changed':_0x45f88c[_0x11954a(0x112)],'unchanged':_0x3c8816[_0x11954a(0x112)],'toDelete':_0x16f6e7[_0x11954a(0x112)]},'activations':{'create':_0x5cc15b[_0x11954a(0x112)],'update':_0x1fc85f[_0x11954a(0x112)],'delete':_0x162138[_0x11954a(0x112)]},'folders':_0x296d1c[_0x11954a(0x112)]},'hasChanges':_0x22af09||_0x20e2e4||_0x18145b||_0x274380};}export async function buildPushExecutionContext(_0x3d0475,_0x1e86db,_0x4d0872,_0x2cc7e2,_0x361d34,_0x449a75){const _0x5b7346=a151_0x403771,_0x50d830=extractRootFolderId(_0x4d0872),{pathToId:_0x4229e7,idToPath:_0x2922ac}=buildFolderMaps(_0x361d34),_0x41f3a0=buildSegmentNameToIdMap(_0x2cc7e2),_0x6f1823=new Map(),{batchAsync:_0x2bd001}=await import('../../utils/async.js'),[_0x2b04ac,_0x55155f]=await Promise[_0x5b7346(0x139)]([_0x3d0475[_0x5b7346(0x165)][_0x5b7346(0x1da)](),_0x3d0475[_0x5b7346(0x161)]['list'](),((async()=>{!_0x449a75&&_0x2cc7e2['length']>0x0&&await _0x2bd001(_0x2cc7e2,async _0x52c1ed=>{const _0x15bb04=a151_0xf275,_0x114823=await _0x3d0475['segment'][_0x15bb04(0xff)](_0x1e86db,_0x52c1ed['id']);_0x6f1823[_0x15bb04(0x1c6)](_0x52c1ed['id'],_0x114823);});})())]),{emailToId:_0x5dc695,idToEmail:_0x4bd37d}=_0x2b04ac,_0x4d91c0=buildConnectionMaps(_0x55155f);return{'rootFolderId':_0x50d830,'folderPathToId':_0x4229e7,'folderIdToPath':_0x2922ac,'segmentNameToId':_0x41f3a0,'activationsBySegmentId':_0x6f1823,'emailToIdMap':_0x5dc695,'idToEmailMap':_0x4bd37d,'connectionNameToIdMap':_0x4d91c0['nameToId'],'connectionIdToNameMap':_0x4d91c0[_0x5b7346(0x18e)],'connectionNameToTypeMap':_0x4d91c0['nameToType']};}export function createPushYamlContextForBundle(_0x4bbf88,_0x222b64,_0x4dc15b,_0x420c0d,_0x2de360,_0x297436,_0x2bc55c,_0x46c4c5){const {existingLocalSegmentNames:_0x2a3692,localExpandedRuleToNames:_0x260254}=_0x420c0d,_0x3eb60e=new Set(),_0x13758d=new Map(),_0x2a5a90=new Map(),_0x59b65c=new Map(),_0x230282=createJumpTargetCache(),_0x35c181=new Map(),_0x124569=new Map(),_0xf1fa71=new Set();let _0x158432;const _0x45184a=_0xb4bf76=>{const _0x2987ed={'resolveSegment':async _0xda4a5b=>{const _0x4a295e=a151_0xf275,_0x1a8e78=_0x59b65c[_0x4a295e(0x16c)](_0xda4a5b);if(_0x1a8e78!==undefined)return{'name':_0x1a8e78,'isJourneyLocal':!![]};try{const _0x130755=await fetchSegment(_0x4bbf88,_0x222b64,_0xda4a5b,_0x4dc15b);if(!_0x130755)throw new Error(_0x4a295e(0x184));const _0xddd055=generateJourneyLocalName(_0x130755['name']),_0x134b43=_0x130755[_0x4a295e(0x12b)]===SEGMENT_KIND_JOURNEY&&_0xddd055!==undefined;let _0x1f18ac=_0x130755[_0x4a295e(0x140)],_0x599b9b;if(_0x134b43&&_0x130755[_0x4a295e(0x11c)]){const _0x273061=apiRuleToYaml(_0x130755[_0x4a295e(0x11c)]);_0x124569[_0x4a295e(0x1c6)](_0xda4a5b,_0x273061);const _0x15865d=async _0x31cddd=>{const _0xc101f6=_0x4a295e,_0x2b18dd=collectSegmentRefsFromRule(_0x31cddd);for(const _0x82be20 of _0x2b18dd){if(!_0x124569[_0xc101f6(0x16d)](_0x82be20))try{const _0x413f75=await fetchSegment(_0x4bbf88,_0x222b64,_0x82be20,_0x4dc15b);if(_0x413f75?.[_0xc101f6(0x11c)]){const _0x2057e6=apiRuleToYaml(_0x413f75[_0xc101f6(0x11c)]);_0x124569[_0xc101f6(0x1c6)](_0x82be20,_0x2057e6),await _0x15865d(_0x2057e6);}}catch(_0x842333){logger[_0xc101f6(0x14e)](_0xc101f6(0x1ac)+_0x82be20+':\x20'+_0x842333);}}};await _0x15865d(_0x273061);const _0x499cd2=serializeExpandedRule(_0x273061,_0x124569),_0x47d597=_0x260254[_0x4a295e(0x16c)](_0x499cd2);if(_0x47d597&&_0x47d597['length']>0x0){const _0x46c9c6=_0x13758d[_0x4a295e(0x16c)](_0x499cd2)||0x0,_0x412972=_0x47d597[_0x46c9c6]||_0x47d597[_0x47d597['length']-0x1];_0x13758d[_0x4a295e(0x1c6)](_0x499cd2,_0x46c9c6+0x1),_0x1f18ac=_0x412972,_0x3eb60e[_0x4a295e(0x1c9)](_0x1f18ac),_0x59b65c[_0x4a295e(0x1c6)](_0xda4a5b,_0x1f18ac);const _0x5c70b7=await resolveRuleSegmentRefs(_0x273061,async _0x165b82=>{const _0x4869e0=_0x4a295e,_0x1ecce0=_0x59b65c[_0x4869e0(0x16c)](_0x165b82);if(_0x1ecce0)return _0x1ecce0;const _0x54d26a=await _0x158432[_0x4869e0(0x1c1)](_0x165b82);return _0x54d26a['name'];});_0x599b9b={'description':_0x130755[_0x4a295e(0x175)],'rule':_0x5c70b7};}else{const _0x114a93=_0x35c181[_0x4a295e(0x16c)](_0x499cd2);if(_0x114a93)_0x1f18ac=_0x114a93,_0x59b65c[_0x4a295e(0x1c6)](_0xda4a5b,_0x1f18ac);else{if(_0xddd055){let _0x1ac817=_0xddd055,_0x36654f=0x2;while(_0x3eb60e[_0x4a295e(0x16d)](_0x1ac817)||_0x2a3692[_0x4a295e(0x16d)](_0x1ac817)){_0x1ac817=_0xddd055+'_'+_0x36654f,_0x36654f++;}_0x3eb60e[_0x4a295e(0x1c9)](_0x1ac817),_0x1f18ac=_0x1ac817;}_0x59b65c['set'](_0xda4a5b,_0x1f18ac),_0x35c181[_0x4a295e(0x1c6)](_0x499cd2,_0x1f18ac);const _0x1f7faa=await resolveRuleSegmentRefs(_0x273061,async _0x7e9dc4=>{const _0x228d0b=_0x4a295e,_0x2a701d=_0x59b65c[_0x228d0b(0x16c)](_0x7e9dc4);if(_0x2a701d)return _0x2a701d;const _0x491943=await _0x158432[_0x228d0b(0x1c1)](_0x7e9dc4);return _0x491943[_0x228d0b(0x140)];});_0x599b9b={'description':_0x130755['description'],'rule':_0x1f7faa};}}}return{'name':_0x1f18ac,'isJourneyLocal':_0x134b43,'definition':_0x599b9b};}catch(_0x54aafa){return logger[_0x4a295e(0x14e)]('Failed\x20to\x20resolve\x20segment\x20'+_0xda4a5b+':\x20'+_0x54aafa),{'name':_0xda4a5b,'isJourneyLocal':![]};}},'resolveActivation':async _0x19a17d=>{const _0x44718f=a151_0xf275,_0x2d6026=_0x2a5a90['get'](_0x19a17d);if(_0x2d6026!==undefined)return{'name':_0x2d6026,'isJourneyLocal':!![]};try{let _0x46a366=_0x2bc55c?.[_0x44718f(0x16c)](_0x19a17d);!_0x46a366&&(_0x46a366=await _0x4bbf88[_0x44718f(0xfe)][_0x44718f(0x107)](_0xb4bf76,_0x19a17d));const _0x43c16f=_0x46a366[_0x44718f(0x1a8)][_0x44718f(0x152)]['name']||_0x19a17d,_0x51334e=sanitizeYamlKey(_0x43c16f)||'activation_'+_0x19a17d,_0x3a5a76=_0x51334e;_0x2a5a90[_0x44718f(0x1c6)](_0x19a17d,_0x3a5a76);const _0x459234=journeyActivationStepToYaml(_0x46a366,_0x2de360,_0x297436);return{'name':_0x3a5a76,'isJourneyLocal':!![],'definition':_0x459234};}catch(_0x5cf429){return logger['debug'](_0x44718f(0x124)+_0x19a17d+':\x20'+_0x5cf429),{'name':_0x19a17d,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x57cd85,_0x3c463c)=>resolveJumpTarget(_0x57cd85,_0x3c463c,_0x230282,async _0x59d34b=>{const _0x20b3cf=a151_0xf275,_0x466d7d=_0x46c4c5?.['get'](_0x59d34b);if(_0x466d7d)return _0x466d7d;return _0x4bbf88[_0x20b3cf(0xfe)][_0x20b3cf(0x185)](_0x59d34b);})};return _0x158432=_0x2987ed,_0x2987ed;},_0x341d6d=async _0x35ea73=>{const _0x1785a3=a151_0xf275,{collectSegmentIdsFromJourneyApi:_0x4ffc1c}=await import(_0x1785a3(0x162)),{batchAsync:_0x267237}=await import('../../utils/async.js'),_0x3ad562=new Set();for(const _0x4fb6bf of _0x35ea73){let _0x2d2e48=_0x46c4c5?.[_0x1785a3(0x16c)](_0x4fb6bf);!_0x2d2e48&&(_0x2d2e48=await _0x4bbf88[_0x1785a3(0xfe)][_0x1785a3(0x185)](_0x4fb6bf));const _0x1e6245=_0x4ffc1c(_0x2d2e48);for(const _0x539a98 of _0x1e6245){_0x3ad562[_0x1785a3(0x1c9)](_0x539a98);}}let _0x1943b6=Array[_0x1785a3(0x13f)](_0x3ad562);while(_0x1943b6['length']>0x0){const _0x3362d9=_0x1943b6[_0x1785a3(0x13a)](_0x1290f6=>!_0xf1fa71[_0x1785a3(0x16d)](_0x1290f6));if(_0x3362d9[_0x1785a3(0x112)]===0x0)break;const _0x2bdcf7=await _0x267237(_0x3362d9,async _0x50aff5=>{const _0x9a6fed=_0x1785a3;_0xf1fa71[_0x9a6fed(0x1c9)](_0x50aff5);const _0x399854=await fetchSegment(_0x4bbf88,_0x222b64,_0x50aff5,_0x4dc15b);if(!_0x399854)return null;return{'segmentId':_0x50aff5,'segment':_0x399854};},0xa),_0x4fd2c3=new Set();for(const _0x3280e2 of _0x2bdcf7){if(!_0x3280e2?.[_0x1785a3(0xe1)]?.[_0x1785a3(0x11c)])continue;const _0x19d287=apiRuleToYaml(_0x3280e2['segment'][_0x1785a3(0x11c)]);_0x124569[_0x1785a3(0x1c6)](_0x3280e2[_0x1785a3(0x16e)],_0x19d287);const _0x36541d=collectSegmentRefsFromRule(_0x19d287);for(const _0x433f25 of _0x36541d){!_0xf1fa71[_0x1785a3(0x16d)](_0x433f25)&&_0x4fd2c3['add'](_0x433f25);}}_0x1943b6=Array[_0x1785a3(0x13f)](_0x4fd2c3);}};return{'createYamlContext':_0x45184a,'prefetchJourneySegments':_0x341d6d};}export async function executePushSegments(_0x3c3c8a,_0x175295,_0x51ca0e,_0x420dc6,_0xf32ff3){const _0x2b6729=a151_0x403771,{segmentDefToCreateRequest:_0x3ddebb,segmentDefToUpdateRequest:_0x87a1a9}=await import(_0x2b6729(0x1aa)),_0x3f689a=_0x51ca0e[_0x2b6729(0x143)],_0x59c9e7=0x5,_0x214dca=async _0x3cd9c4=>{const _0x57e3a1=_0x2b6729,_0xdea1fa=_0x3cd9c4[_0x57e3a1(0x1b2)]?_0x3f689a[_0x57e3a1(0x16c)](_0x3cd9c4['folderPath']):undefined;let _0x1b5610;const _0xa4e686={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x2ad9f7=_0x3cd9c4['yamlConfig'];if(_0x3cd9c4[_0x57e3a1(0x166)]['rule']){const _0xe4e5e1=createSegmentIdResolver(_0x51ca0e[_0x57e3a1(0x154)],_0x3cd9c4['yamlConfig'][_0x57e3a1(0x140)]),_0x57c159=await resolveRuleSegmentIds(_0x3cd9c4[_0x57e3a1(0x166)][_0x57e3a1(0x11c)],_0xe4e5e1);_0x2ad9f7={..._0x3cd9c4[_0x57e3a1(0x166)],'rule':_0x57c159};}try{if(_0x3cd9c4['isNew']){_0xf32ff3['onProgress']?.({'type':_0x57e3a1(0x11f),'name':_0x3cd9c4[_0x57e3a1(0x166)][_0x57e3a1(0x140)]});const _0x5ae65f=_0x3ddebb(_0x2ad9f7,_0xdea1fa),_0x4258a7=await _0xf32ff3[_0x57e3a1(0x10c)](_0x57e3a1(0xfc)+_0x3cd9c4['yamlConfig'][_0x57e3a1(0x140)]+_0x57e3a1(0x19d),()=>_0x3c3c8a[_0x57e3a1(0xe1)]['createSegment'](_0x420dc6[_0x57e3a1(0x1ce)],_0x5ae65f));_0x1b5610=_0x4258a7[_0x57e3a1(0x149)]['id'],_0x51ca0e[_0x57e3a1(0x154)][_0x57e3a1(0x1c6)](_0x3cd9c4[_0x57e3a1(0x166)][_0x57e3a1(0x140)],_0x1b5610),_0xa4e686[_0x57e3a1(0x1d5)]={'name':_0x3cd9c4[_0x57e3a1(0x166)][_0x57e3a1(0x140)],'id':_0x1b5610},_0xf32ff3[_0x57e3a1(0x14c)]?.({'type':'segment_created','name':_0x3cd9c4[_0x57e3a1(0x166)][_0x57e3a1(0x140)],'segmentId':_0x1b5610}),_0xf32ff3['logSuccess']?.('Created\x20segment\x20\x27'+_0x3cd9c4['yamlConfig'][_0x57e3a1(0x140)]+'\x27'),_0xa4e686[_0x57e3a1(0xf8)]=0x1;}else{if(_0x3cd9c4['hasChanges']){_0xf32ff3[_0x57e3a1(0x14c)]?.({'type':_0x57e3a1(0x146),'name':_0x3cd9c4[_0x57e3a1(0x166)][_0x57e3a1(0x140)]});const _0x1f5834=_0x87a1a9(_0x2ad9f7);_0xdea1fa!==_0x3cd9c4[_0x57e3a1(0x108)]?.[_0x57e3a1(0xf4)]&&(_0x1f5834['segmentFolderId']=_0xdea1fa?parseInt(_0xdea1fa,0xa):undefined),await _0xf32ff3[_0x57e3a1(0x10c)](_0x57e3a1(0x136)+_0x3cd9c4['yamlConfig']['name']+_0x57e3a1(0x19d),()=>_0x3c3c8a['segment'][_0x57e3a1(0x106)](_0x420dc6[_0x57e3a1(0x1ce)],_0x3cd9c4[_0x57e3a1(0x108)]['id'],_0x1f5834)),_0x1b5610=_0x3cd9c4[_0x57e3a1(0x108)]['id'],_0xf32ff3[_0x57e3a1(0x14c)]?.({'type':'segment_updated','name':_0x3cd9c4[_0x57e3a1(0x166)][_0x57e3a1(0x140)]}),_0xf32ff3[_0x57e3a1(0x157)]?.(_0x57e3a1(0x1b9)+_0x3cd9c4[_0x57e3a1(0x166)]['name']+'\x27'),_0xa4e686[_0x57e3a1(0xe9)]=0x1;}else _0x1b5610=_0x3cd9c4[_0x57e3a1(0x108)]['id'];}}catch(_0x5de18c){const _0x27a402=isHttp400Error(_0x5de18c),_0x3af9d4=_0x27a402?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode[_0x57e3a1(0xed)],_0x3f2b74=getErrorMessage(_0x5de18c);throw new SDKError(_0x3af9d4,_0x57e3a1(0x178)+(_0x3cd9c4[_0x57e3a1(0x12f)]?'create':_0x57e3a1(0x181))+_0x57e3a1(0x138)+_0x3cd9c4[_0x57e3a1(0x12e)]+_0x57e3a1(0x134)+_0x3f2b74,_0x5de18c);}try{const _0xc5c4f2=await syncActivationsForSegment(_0x3c3c8a,_0x420dc6['parentId'],_0x1b5610,_0x3cd9c4['yamlConfig']['name'],_0x3cd9c4[_0x57e3a1(0x1bc)],_0xf32ff3,_0x3cd9c4['absolutePath']);_0xa4e686[_0x57e3a1(0x15e)]=_0xc5c4f2;}catch(_0x79befe){if(_0x79befe instanceof SDKError)throw _0x79befe;throw new SDKError(ErrorCode[_0x57e3a1(0x1af)],_0x57e3a1(0x123)+_0x3cd9c4[_0x57e3a1(0x166)][_0x57e3a1(0x140)]+_0x57e3a1(0xef)+_0x3cd9c4['absolutePath']+_0x57e3a1(0x134)+getErrorMessage(_0x79befe),_0x79befe);}return _0xa4e686;},_0x46b523=await batchAsync(_0x175295,_0x214dca,_0x59c9e7),_0x263786={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x4a570e of _0x46b523){_0x263786[_0x2b6729(0xf8)]+=_0x4a570e[_0x2b6729(0xf8)],_0x263786[_0x2b6729(0xe9)]+=_0x4a570e[_0x2b6729(0xe9)],_0x4a570e[_0x2b6729(0x1d5)]&&_0x263786[_0x2b6729(0x105)][_0x2b6729(0x1c6)](_0x4a570e[_0x2b6729(0x1d5)][_0x2b6729(0x140)],_0x4a570e[_0x2b6729(0x1d5)]['id']),_0x263786[_0x2b6729(0x15e)][_0x2b6729(0xf8)]+=_0x4a570e[_0x2b6729(0x15e)][_0x2b6729(0xf8)],_0x263786[_0x2b6729(0x15e)][_0x2b6729(0xe9)]+=_0x4a570e[_0x2b6729(0x15e)][_0x2b6729(0xe9)],_0x263786[_0x2b6729(0x15e)][_0x2b6729(0x10d)]+=_0x4a570e[_0x2b6729(0x15e)][_0x2b6729(0x10d)];}return _0x263786;}async function syncActivationsForSegment(_0x12821f,_0x4fce82,_0x234b82,_0x46f31e,_0x29cfc3,_0x4ab2e0,_0x1a386f){const _0x141f6a=a151_0x403771,_0x14f43c={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x1687e9 of _0x29cfc3){try{if(_0x1687e9[_0x141f6a(0x1d7)]===_0x141f6a(0x17b)&&_0x1687e9[_0x141f6a(0xf6)])_0x4ab2e0[_0x141f6a(0x14c)]?.({'type':_0x141f6a(0x126),'segmentName':_0x46f31e,'activationName':_0x1687e9['name']}),await _0x4ab2e0[_0x141f6a(0x10c)]('Creating\x20activation\x20\x27'+_0x1687e9[_0x141f6a(0x140)]+'\x27...',()=>_0x12821f[_0x141f6a(0xe1)]['createActivation'](_0x4fce82,_0x234b82,_0x1687e9[_0x141f6a(0xf6)])),_0x4ab2e0['onProgress']?.({'type':_0x141f6a(0xe6),'segmentName':_0x46f31e,'activationName':_0x1687e9[_0x141f6a(0x140)]}),_0x4ab2e0[_0x141f6a(0x157)]?.(_0x141f6a(0x1b8)+_0x1687e9['name']+'\x27'),_0x14f43c[_0x141f6a(0xf8)]++;else{if(_0x1687e9[_0x141f6a(0x1d7)]==='update'&&_0x1687e9[_0x141f6a(0xf6)]&&_0x1687e9[_0x141f6a(0xf1)])_0x4ab2e0[_0x141f6a(0x14c)]?.({'type':_0x141f6a(0x1ba),'segmentName':_0x46f31e,'activationName':_0x1687e9[_0x141f6a(0x140)]}),await _0x4ab2e0['withProgress'](_0x141f6a(0x194)+_0x1687e9[_0x141f6a(0x140)]+_0x141f6a(0x19d),()=>_0x12821f[_0x141f6a(0xe1)][_0x141f6a(0x1c0)](_0x4fce82,_0x234b82,_0x1687e9[_0x141f6a(0xf1)]['id'],_0x1687e9['validatedRequest'])),_0x4ab2e0['onProgress']?.({'type':_0x141f6a(0x163),'segmentName':_0x46f31e,'activationName':_0x1687e9[_0x141f6a(0x140)]}),_0x4ab2e0[_0x141f6a(0x157)]?.(_0x141f6a(0x145)+_0x1687e9[_0x141f6a(0x140)]+'\x27'),_0x14f43c[_0x141f6a(0xe9)]++;else _0x1687e9[_0x141f6a(0x1d7)]===_0x141f6a(0x13d)&&_0x1687e9[_0x141f6a(0xf1)]&&(_0x4ab2e0[_0x141f6a(0x14c)]?.({'type':_0x141f6a(0x1cb),'segmentName':_0x46f31e,'activationName':_0x1687e9['name']}),await _0x4ab2e0[_0x141f6a(0x10c)]('Deleting\x20activation\x20\x27'+_0x1687e9['name']+'\x27...',()=>_0x12821f[_0x141f6a(0xe1)][_0x141f6a(0x197)](_0x4fce82,_0x234b82,_0x1687e9[_0x141f6a(0xf1)]['id'])),_0x4ab2e0[_0x141f6a(0x14c)]?.({'type':_0x141f6a(0x1ad),'segmentName':_0x46f31e,'activationName':_0x1687e9[_0x141f6a(0x140)]}),_0x4ab2e0[_0x141f6a(0x1d4)]?.(_0x141f6a(0x120)+_0x1687e9[_0x141f6a(0x140)]+'\x27'),_0x14f43c['deleted']++);}}catch(_0x37a8b2){const _0x4b23db=isHttp400Error(_0x37a8b2),_0x116747=_0x4b23db?ErrorCode[_0x141f6a(0x1b1)]:ErrorCode[_0x141f6a(0x1af)],_0x5958b8=getErrorMessage(_0x37a8b2);throw new SDKError(_0x116747,_0x141f6a(0x178)+_0x1687e9[_0x141f6a(0x1d7)]+'\x20activation\x20\x27'+_0x1687e9[_0x141f6a(0x140)]+_0x141f6a(0xef)+_0x1a386f+_0x141f6a(0x134)+_0x5958b8,_0x37a8b2);}}return _0x14f43c;}export async function executePushFolders(_0x26e306,_0x2cd70b,_0x3c4b34,_0x126e74,_0x45e3e7){const _0x1a7012=a151_0x403771,_0x4fe1be=new Map(_0x3c4b34),_0x3d1f34=sortFoldersByDepth(_0x2cd70b);for(const _0x2b9a81 of _0x3d1f34){const _0x69fcd5=_0x2b9a81[_0x1a7012(0x117)]('/'),_0x2a2fad=_0x69fcd5[_0x69fcd5[_0x1a7012(0x112)]-0x1],_0x31a1a8=_0x69fcd5[_0x1a7012(0x187)](0x0,-0x1)[_0x1a7012(0x19f)]('/'),_0x45a68b=_0x4fe1be['get'](_0x31a1a8);_0x45e3e7['onProgress']?.({'type':'folder_creating','folder':_0x2b9a81});const _0x4bfb35={'name':_0x2a2fad,'parentFolderId':_0x45a68b},_0xd0df57=await _0x45e3e7[_0x1a7012(0x10c)](_0x1a7012(0xe3)+_0x2b9a81+'\x27...',()=>_0x26e306[_0x1a7012(0xe1)][_0x1a7012(0x101)](_0x126e74[_0x1a7012(0x1ce)],_0x4bfb35));_0x4fe1be['set'](_0x2b9a81,_0xd0df57[_0x1a7012(0x149)]['id']),_0x45e3e7[_0x1a7012(0x14c)]?.({'type':_0x1a7012(0x17d),'folder':_0x2b9a81,'folderId':_0xd0df57['data']['id']}),_0x45e3e7[_0x1a7012(0x15b)]?.(_0x1a7012(0x132)+_0x2b9a81+'\x27');}return _0x4fe1be;}export async function executePushSegmentDeletions(_0x47ca34,_0x18cf63,_0x204bbf){if(_0x18cf63['length']===0x0)return 0x0;const {batchAsync:_0x14b02d}=await import('../../utils/async.js'),_0x116a1c=0x5,_0x103993=await _0x14b02d(_0x18cf63,async _0xa3d132=>{const _0x2a8de7=a151_0xf275;return _0x204bbf[_0x2a8de7(0x14c)]?.({'type':_0x2a8de7(0x135),'name':_0xa3d132['name']}),await _0x47ca34[_0x2a8de7(0xe1)][_0x2a8de7(0xfd)](_0xa3d132['id']),_0x204bbf[_0x2a8de7(0x14c)]?.({'type':_0x2a8de7(0x1de),'name':_0xa3d132[_0x2a8de7(0x140)]}),_0x204bbf[_0x2a8de7(0x1d4)]?.(_0x2a8de7(0x1df)+_0xa3d132[_0x2a8de7(0x140)]+'\x27'),0x1;},_0x116a1c);return _0x103993['reduce']((_0x37a908,_0x553bff)=>_0x37a908+_0x553bff,0x0);}export async function executePushJourneys(_0x18ed69,_0x54e02e,_0x2a719a,_0x172c20,_0x2f50ee){const _0x186a68=a151_0x403771,{journeyDefToRequest:_0x6dc6d5}=await import(_0x186a68(0x162)),{activationDefToCreateRequest:_0x10d844,yamlRuleToApi:_0x2b4c67,validateSegmentRule:_0x51c069}=await import(_0x186a68(0x1aa)),_0x93003d={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x62cf22=new Map(_0x2a719a[_0x186a68(0x154)]),_0x119ce0=0x5;for(let _0x30804b=0x0;_0x30804b<_0x54e02e[_0x186a68(0x112)];_0x30804b+=_0x119ce0){const _0x1b53bd=_0x54e02e[_0x186a68(0x187)](_0x30804b,_0x30804b+_0x119ce0),_0x4cdb91=await Promise['all'](_0x1b53bd[_0x186a68(0xf3)](async _0x5b9442=>{const _0x5cf154=_0x186a68;if(!_0x5b9442[_0x5cf154(0x12f)]&&!_0x5b9442[_0x5cf154(0xe2)])return{'action':_0x5cf154(0x19b),'name':_0x5b9442['yamlConfig'][_0x5cf154(0x140)],'journeyId':_0x5b9442[_0x5cf154(0x1dc)]?.['id']};const _0x57a0ab=_0x5b9442[_0x5cf154(0x1b2)]?_0x2a719a[_0x5cf154(0x143)]['get'](_0x5b9442['folderPath']):undefined;_0x2f50ee['onProgress']?.({'type':_0x5b9442[_0x5cf154(0x12f)]?_0x5cf154(0x1b6):_0x5cf154(0x196),'name':_0x5b9442[_0x5cf154(0x166)]['name']});try{const _0x3e309b=await executeSingleJourneyPush(_0x18ed69,_0x5b9442,{..._0x2a719a,'segmentNameToId':_0x62cf22},{'parentId':_0x172c20[_0x5cf154(0x1ce)],'rootFolderId':_0x172c20[_0x5cf154(0x16f)],'folderId':_0x57a0ab,'verbose':_0x172c20[_0x5cf154(0x16b)]},_0x2f50ee,{'journeyDefToRequest':_0x6dc6d5,'activationDefToCreateRequest':_0x10d844,'yamlRuleToApi':_0x2b4c67,'validateSegmentRule':_0x51c069});for(const [_0x2c32fb,_0x50fc77]of _0x3e309b['embeddedSegmentNameToId']){_0x62cf22[_0x5cf154(0x1c6)](_0x2c32fb,_0x50fc77),_0x93003d[_0x5cf154(0x1db)][_0x5cf154(0x1c6)](_0x2c32fb,_0x50fc77);}if(_0x3e309b['action']===_0x5cf154(0xf8))_0x2f50ee[_0x5cf154(0x14c)]?.({'type':_0x5cf154(0x179),'name':_0x5b9442[_0x5cf154(0x166)][_0x5cf154(0x140)],'journeyId':_0x3e309b['journeyId']}),_0x2f50ee['logSuccess']?.(_0x5cf154(0x133)+_0x5b9442[_0x5cf154(0x166)][_0x5cf154(0x140)]+'\x27'),_0x93003d[_0x5cf154(0xf8)]++;else _0x3e309b[_0x5cf154(0x1bb)]===_0x5cf154(0xe9)&&(_0x2f50ee[_0x5cf154(0x14c)]?.({'type':_0x5cf154(0x1d8),'name':_0x5b9442['yamlConfig'][_0x5cf154(0x140)]}),_0x2f50ee[_0x5cf154(0x157)]?.('Updated\x20journey\x20\x27'+_0x5b9442[_0x5cf154(0x166)][_0x5cf154(0x140)]+'\x27'),_0x93003d[_0x5cf154(0xe9)]++);return{'action':_0x3e309b[_0x5cf154(0x1bb)],'name':_0x5b9442[_0x5cf154(0x166)][_0x5cf154(0x140)],'journeyId':_0x3e309b[_0x5cf154(0x10b)]};}catch(_0x470aa1){const _0x228bb1=isHttp400Error(_0x470aa1),_0x4e4ff7=_0x228bb1?ErrorCode[_0x5cf154(0x12c)]:ErrorCode[_0x5cf154(0x1c8)],_0x16fa88=getErrorMessage(_0x470aa1);throw new SDKError(_0x4e4ff7,_0x5cf154(0x178)+(_0x5b9442[_0x5cf154(0x12f)]?'create':_0x5cf154(0x181))+_0x5cf154(0x1a9)+_0x5b9442[_0x5cf154(0x12e)]+_0x5cf154(0x134)+_0x16fa88,_0x470aa1);}}));_0x93003d[_0x186a68(0x1cf)][_0x186a68(0x10e)](..._0x4cdb91);}return _0x93003d;}async function matchExistingJourneySegments(_0x44db92,_0x5a487f,_0x106a32,_0x16e613,_0x47d717){const _0x130c3d=a151_0x403771;if(!_0x5a487f[_0x130c3d(0x1dc)]||!_0x5a487f[_0x130c3d(0x166)][_0x130c3d(0x1c5)])return;const _0x22380a=new Map(),_0x14157f=new Set();for(const _0x4b3f9c of Object['keys'](_0x5a487f[_0x130c3d(0x166)]['segments'])){const _0x3cd7d2=generateDeterministicJourneySegmentName(_0x5a487f[_0x130c3d(0x166)][_0x130c3d(0x140)],_0x4b3f9c);_0x22380a[_0x130c3d(0x1c6)](_0x3cd7d2,_0x4b3f9c),_0x14157f[_0x130c3d(0x1c9)](_0x4b3f9c);}const _0x20e674=[],_0x443b46=collectSegmentIdsFromJourneyApi(_0x5a487f[_0x130c3d(0x1dc)]);for(const _0x23564a of _0x443b46){const _0x214bb0=await fetchSegment(_0x44db92,_0x106a32,_0x23564a,_0x16e613);if(!_0x214bb0?.['name'])continue;const _0x41681b=_0x22380a[_0x130c3d(0x16c)](_0x214bb0[_0x130c3d(0x140)]);_0x41681b?(_0x47d717['set'](_0x41681b,_0x23564a),_0x14157f[_0x130c3d(0x13d)](_0x41681b)):_0x20e674['push']({'id':_0x23564a,'seg':_0x214bb0});}if(_0x14157f['size']>0x0&&_0x20e674[_0x130c3d(0x112)]>0x0){const {localExpandedRuleToNames:_0x25fa43}=buildLocalExpandedRuleMappings(_0x5a487f[_0x130c3d(0x166)]),_0x579110=new Map();for(const {id:_0x354eea,seg:_0x5c1bcc}of _0x20e674){if(_0x5c1bcc[_0x130c3d(0x11c)]){const _0x2e5832=apiRuleToYaml(_0x5c1bcc['rule']);_0x579110[_0x130c3d(0x1c6)](_0x354eea,_0x2e5832);}}for(const {id:_0x4e49cc,seg:_0x3bbbfa}of _0x20e674){if(!_0x3bbbfa['rule'])continue;const _0x112c17=_0x579110['get'](_0x4e49cc);if(!_0x112c17)continue;const _0x4cadfd=serializeExpandedRule(_0x112c17,_0x579110),_0x56c91a=_0x25fa43['get'](_0x4cadfd);if(_0x56c91a){const _0x2a26d4=_0x56c91a['find'](_0x30b3f9=>_0x14157f[_0x130c3d(0x16d)](_0x30b3f9));_0x2a26d4&&(_0x47d717['set'](_0x2a26d4,_0x4e49cc),_0x14157f['delete'](_0x2a26d4),logger[_0x130c3d(0x14e)](_0x130c3d(0x19a)+_0x3bbbfa[_0x130c3d(0x140)]+_0x130c3d(0xe7)+_0x2a26d4+'\x27\x20by\x20rule\x20content'));}}}}async function executeSingleJourneyPush(_0x4e5be3,_0x5220d,_0x2c2d39,_0x48f44f,_0x1e4dd1,_0xe82f96){const _0x47ca3c=a151_0x403771,{journeyDefToRequest:_0x8aa101,activationDefToCreateRequest:_0xfb4e8e,yamlRuleToApi:_0x345163,validateSegmentRule:_0x41cedc}=_0xe82f96,_0x35f315=new Map(),_0x5bc9f2=new Map();recoverSegmentIdsFromPushRecovery(_0x5220d,_0x35f315,_0x2c2d39['segmentNameToId']);const _0x1754b7=new Map(),_0x11c95a=new Map(),_0x34846b=new Map();let _0x6b09fa;const _0x5e942f=async()=>{const _0x508dce=a151_0xf275;if(_0x6b09fa)return;_0x6b09fa=new Map();if(!_0x5220d['existingJourney'])return;const _0xe4465b=await _0x4e5be3[_0x508dce(0xfe)][_0x508dce(0xff)](_0x5220d[_0x508dce(0x1dc)]['id']);for(const _0x1d85fd of _0xe4465b){const _0x45d2fa=journeyActivationStepToYaml(_0x1d85fd,_0x2c2d39[_0x508dce(0x190)],_0x2c2d39[_0x508dce(0x130)]),_0x2e1888=activationSignature(_0x45d2fa);!_0x6b09fa['has'](_0x2e1888)&&_0x6b09fa[_0x508dce(0x1c6)](_0x2e1888,_0x1d85fd['id']),_0x45d2fa[_0x508dce(0x140)]&&_0x5bc9f2['set'](_0x45d2fa[_0x508dce(0x140)],_0x1d85fd['id']);}};await matchExistingJourneySegments(_0x4e5be3,_0x5220d,_0x48f44f[_0x47ca3c(0x1ce)],_0x2c2d39[_0x47ca3c(0x13b)],_0x2c2d39['segmentNameToId']);const _0x19dca9={'resolveSegmentId':async _0x113db7=>{const _0x263d2b=_0x47ca3c,_0x3b0743=_0x2c2d39[_0x263d2b(0x154)][_0x263d2b(0x16c)](_0x113db7);if(!_0x3b0743)throw new SDKError(ErrorCode[_0x263d2b(0x129)],_0x263d2b(0xe5)+_0x113db7+_0x263d2b(0x111)+_0x5220d[_0x263d2b(0x166)]['name']+')');return _0x3b0743;},'resolveEmbeddedSegmentId':async(_0x3e55cd,_0x8aa9fb)=>{const _0x10fc8f=_0x47ca3c,_0x32af4a=_0x2c2d39[_0x10fc8f(0x154)][_0x10fc8f(0x16c)](_0x3e55cd);if(_0x32af4a)return _0x32af4a;const _0x1eb3be=_0x2c2d39['existingSegments']['find'](_0x1dadba=>_0x1dadba[_0x10fc8f(0x140)]===_0x3e55cd);if(_0x1eb3be)return _0x2c2d39[_0x10fc8f(0x154)][_0x10fc8f(0x1c6)](_0x3e55cd,_0x1eb3be['id']),_0x1eb3be['id'];if(_0x5220d[_0x10fc8f(0x12f)]){const {stageName:_0x3765d1,criteriaName:_0x54fe08}=findSegmentCriteriaLocation(_0x5220d[_0x10fc8f(0x166)],_0x3e55cd);return _0x41cedc(_0x3e55cd,_0x8aa9fb[_0x10fc8f(0x11c)]),_0x11c95a[_0x10fc8f(0x1c6)](_0x3e55cd,{'definition':_0x8aa9fb,'stageName':_0x3765d1,'criteriaName':_0x54fe08}),createPendingSegmentId(_0x3e55cd);}const _0x29eee9=_0x5220d[_0x10fc8f(0x1dc)]?.['id'];if(!_0x29eee9)throw new SDKError(ErrorCode[_0x10fc8f(0x127)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x1e81bd=_0x1754b7[_0x10fc8f(0x16c)](_0x3e55cd);if(_0x1e81bd)return _0x1e81bd;const _0x30107e=((async()=>{const _0x1af045=_0x10fc8f;_0x41cedc(_0x3e55cd,_0x8aa9fb[_0x1af045(0x11c)]);const _0x43e124=generateDeterministicJourneySegmentName(_0x5220d['yamlConfig']['name'],_0x3e55cd),_0x5e02c4=_0x2c2d39['existingSegments']['find'](_0x28bf9f=>_0x28bf9f[_0x1af045(0x140)]===_0x43e124),_0x37f2f4=createSegmentIdResolver(_0x2c2d39[_0x1af045(0x154)],_0x3e55cd),_0x21f651=await resolveRuleSegmentIds(_0x8aa9fb[_0x1af045(0x11c)],_0x37f2f4);let _0x5edea4;return _0x5e02c4?(await _0x4e5be3[_0x1af045(0xe1)][_0x1af045(0x106)](_0x48f44f[_0x1af045(0x1ce)],_0x5e02c4['id'],{'description':_0x8aa9fb['description']||'Entry\x20criteria:\x20'+_0x3e55cd,'rule':_0x345163(_0x21f651,!![]),'countPopulation':!![]}),_0x5edea4=_0x5e02c4['id'],saveSegmentToPushRecovery(_0x5220d[_0x1af045(0x12e)],_0x5220d[_0x1af045(0x166)][_0x1af045(0x140)],_0x3e55cd,{'segmentId':_0x5edea4,'uniqueServerName':_0x43e124,'createdAt':new Date()[_0x1af045(0x158)]()})):_0x5edea4=await createOrRecoverEmbeddedSegment(_0x4e5be3,_0x5220d,{'localName':_0x3e55cd,'uniqueSegmentName':_0x43e124,'description':_0x8aa9fb[_0x1af045(0x175)]||'Entry\x20criteria:\x20'+_0x3e55cd,'journeyId':_0x29eee9,'resolvedRule':_0x21f651,'parentId':_0x48f44f[_0x1af045(0x1ce)],'folderId':_0x48f44f[_0x1af045(0x16f)]||''},_0x345163),_0x2c2d39['segmentNameToId'][_0x1af045(0x1c6)](_0x3e55cd,_0x5edea4),_0x35f315['set'](_0x3e55cd,_0x5edea4),_0x5edea4;})());_0x1754b7[_0x10fc8f(0x1c6)](_0x3e55cd,_0x30107e);try{return await _0x30107e;}finally{_0x1754b7[_0x10fc8f(0x13d)](_0x3e55cd);}},'resolveActivationId':async _0x24c426=>{const _0x524317=_0x47ca3c,_0x532c2a=_0x5bc9f2[_0x524317(0x16c)](_0x24c426);if(_0x532c2a)return _0x532c2a;if(_0x5220d['existingJourney']){await _0x5e942f();const _0x31df76=_0x5bc9f2['get'](_0x24c426);if(_0x31df76)return _0x31df76;}throw new SDKError(ErrorCode[_0x524317(0x176)],_0x524317(0x144)+_0x24c426+_0x524317(0x111)+_0x5220d[_0x524317(0x166)]['name']+_0x524317(0x18d)+_0x524317(0x199));},'resolveEmbeddedActivationId':async(_0x1e285e,_0x3a146c)=>{const _0x11f5c0=_0x47ca3c,_0x21050f=_0x5bc9f2[_0x11f5c0(0x16c)](_0x1e285e);if(_0x21050f)return _0x21050f;if(_0x5220d[_0x11f5c0(0x12f)])return _0x34846b[_0x11f5c0(0x1c6)](_0x1e285e,_0x3a146c),createPendingActivationId(_0x1e285e);if(_0x5220d[_0x11f5c0(0x1dc)]){await _0x5e942f();const _0x46f56b=_0x5bc9f2['get'](_0x3a146c[_0x11f5c0(0x140)]);if(_0x46f56b)return _0x5bc9f2[_0x11f5c0(0x1c6)](_0x1e285e,_0x46f56b),_0x46f56b;const _0x1a78a0=activationSignature(_0x3a146c),_0x785391=_0x6b09fa?.[_0x11f5c0(0x16c)](_0x1a78a0);if(_0x785391)return _0x5bc9f2[_0x11f5c0(0x1c6)](_0x1e285e,_0x785391),_0x785391;const _0x48ba4a=await _0xfb4e8e(_0x3a146c,_0x2c2d39[_0x11f5c0(0x1a0)]),_0x2ca88f={..._0x48ba4a,..._0x3a146c['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x3a146c[_0x11f5c0(0x159)]}},_0x5e0cb8=await _0x4e5be3['journey'][_0x11f5c0(0x160)](_0x5220d[_0x11f5c0(0x1dc)]['id'],_0x2ca88f);return _0x5bc9f2[_0x11f5c0(0x1c6)](_0x1e285e,_0x5e0cb8['id']),_0x5e0cb8['id'];}throw new SDKError(ErrorCode[_0x11f5c0(0x127)],_0x11f5c0(0x169));},'resolveJourneyId':async _0x2ac1d6=>{const _0x92f6aa=_0x47ca3c;try{return await _0x4e5be3[_0x92f6aa(0xfe)][_0x92f6aa(0x1a1)](_0x48f44f[_0x92f6aa(0x1ce)],_0x2ac1d6);}catch(_0x104190){throw new SDKError(ErrorCode[_0x92f6aa(0x176)],_0x92f6aa(0x1d3)+_0x2ac1d6+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x5220d[_0x92f6aa(0x166)]['name']+'\x27)',_0x104190);}},'resolveStageId':async(_0x2c186a,_0x4c1318)=>{const _0x219c95=_0x47ca3c,_0x1b339d=await _0x4e5be3[_0x219c95(0xfe)]['getJourney'](_0x2c186a),_0x3a8d7f=_0x1b339d[_0x219c95(0x1a8)][_0x219c95(0x182)]['find'](_0x3f45ba=>_0x3f45ba[_0x219c95(0x140)][_0x219c95(0x12a)]()===_0x4c1318['toLowerCase']());if(!_0x3a8d7f?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],_0x219c95(0x1d9)+_0x4c1318+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x1b339d[_0x219c95(0x1a8)][_0x219c95(0x131)]||_0x1b339d[_0x219c95(0x1a8)][_0x219c95(0x140)])+'\x27');return _0x3a8d7f['id'];}},_0x29c99a=await _0x8aa101(_0x5220d[_0x47ca3c(0x166)],_0x48f44f['parentId'],_0x19dca9),_0x48680d=_0x48f44f['folderId']||_0x48f44f['rootFolderId'];_0x48680d&&(_0x29c99a[_0x47ca3c(0x18a)]={'parentFolder':{'data':{'id':_0x48680d,'type':_0x47ca3c(0x1cc)}}});if(_0x5220d[_0x47ca3c(0x12f)]){if(_0x11c95a[_0x47ca3c(0xe0)]>0x0||_0x34846b[_0x47ca3c(0xe0)]>0x0)return await executeThreeStepJourneyCreate(_0x4e5be3,_0x5220d,_0x29c99a,{'pendingEmbeddedSegments':_0x11c95a,'pendingEmbeddedActivations':_0x34846b,'embeddedSegmentNameToId':_0x35f315,'journeyActivationNameToId':_0x5bc9f2},{..._0x48f44f,'effectiveFolderId':_0x48680d},_0x2c2d39,_0x1e4dd1,_0xe82f96);else{ensureJourneyDefaults(_0x29c99a[_0x47ca3c(0x1a8)]);const _0x324b75=await _0x4e5be3[_0x47ca3c(0xfe)][_0x47ca3c(0x17b)](_0x29c99a);return deletePushRecovery(_0x5220d['absolutePath']),{'action':'created','journeyId':_0x324b75['id'],'embeddedSegmentNameToId':_0x35f315};}}else{if(_0x5220d[_0x47ca3c(0xe2)]&&_0x5220d[_0x47ca3c(0x1dc)]){_0x29c99a['id']=_0x5220d[_0x47ca3c(0x1dc)]['id'];const _0x22f6d6=_0x29c99a[_0x47ca3c(0x1a8)];_0x5220d['existingJourney'][_0x47ca3c(0x1a8)]?.[_0x47ca3c(0x131)]&&(_0x22f6d6[_0x47ca3c(0x131)]=_0x5220d[_0x47ca3c(0x1dc)][_0x47ca3c(0x1a8)][_0x47ca3c(0x131)]);const _0x2d14a5=_0x5220d['existingJourney'][_0x47ca3c(0x1a8)]?.[_0x47ca3c(0x182)];return _0x2d14a5&&_0x29c99a['attributes'][_0x47ca3c(0x182)]&&injectExistingStageIds(_0x29c99a['attributes'][_0x47ca3c(0x182)],_0x2d14a5),ensureJourneyDefaults(_0x22f6d6),await _0x4e5be3[_0x47ca3c(0xfe)][_0x47ca3c(0x181)](_0x5220d['existingJourney']['id'],_0x29c99a),deletePushRecovery(_0x5220d[_0x47ca3c(0x12e)]),{'action':_0x47ca3c(0xe9),'journeyId':_0x5220d[_0x47ca3c(0x1dc)]['id'],'embeddedSegmentNameToId':_0x35f315};}}return deletePushRecovery(_0x5220d[_0x47ca3c(0x12e)]),{'action':_0x47ca3c(0x19b),'journeyId':_0x5220d['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x35f315};}function findSegmentCriteriaLocation(_0x577b89,_0x4efdf5){const _0xc02448=a151_0x403771,_0x584beb=_0x577b89['stages']||_0x577b89[_0xc02448(0x11b)]?.[0x0]?.[_0xc02448(0xec)]||[];let _0x4a4e25=_0xc02448(0x148),_0x5cd0ab=_0x4efdf5;const _0x4489a7=_0x577b89['goal']||_0x577b89[_0xc02448(0x11b)]?.[0x0]?.[_0xc02448(0x1b3)];if(_0x4489a7?.[_0xc02448(0xe1)]===_0x4efdf5)return{'stageName':'goal','criteriaName':_0x4489a7[_0xc02448(0x140)]||_0x4efdf5};_0x25d0c5:for(const _0x4e8751 of _0x584beb){if(_0x4e8751[_0xc02448(0x17a)]?.[_0xc02448(0xe1)]===_0x4efdf5){_0x4a4e25=_0x4e8751[_0xc02448(0x140)],_0x5cd0ab=_0x4e8751[_0xc02448(0x17a)]['name']||_0x4efdf5;break;}if(_0x4e8751[_0xc02448(0x172)])for(const _0x2de20f of _0x4e8751[_0xc02448(0x172)]){if(_0x2de20f[_0xc02448(0x1d7)]==='decision_point'&&_0x2de20f[_0xc02448(0x198)]?.[_0xc02448(0x1ab)])for(const _0x3b76ec of _0x2de20f[_0xc02448(0x198)][_0xc02448(0x1ab)]){if(_0x3b76ec[_0xc02448(0xe1)]===_0x4efdf5){_0x4a4e25=_0x4e8751[_0xc02448(0x140)],_0x5cd0ab=_0x3b76ec['name']||_0x4efdf5;break _0x25d0c5;}}}}return{'stageName':_0x4a4e25,'criteriaName':_0x5cd0ab};}async function executeThreeStepJourneyCreate(_0x5aa19f,_0x149964,_0x5eb7f5,_0x31700e,_0x475fdd,_0x5a253,_0x7a5ea,_0x3bde90){const _0x1f462b=a151_0x403771,{activationDefToCreateRequest:_0x5d6095,yamlRuleToApi:_0x18f6b0}=_0x3bde90,{pendingEmbeddedSegments:_0x58be32,pendingEmbeddedActivations:_0xfd5255,embeddedSegmentNameToId:_0x111c7a}=_0x31700e,_0x419bdf=JSON['parse'](JSON[_0x1f462b(0xf9)](_0x5eb7f5));ensureJourneyDefaults(_0x419bdf[_0x1f462b(0x1a8)]),stripPendingIds(_0x419bdf);const _0x141a84=await _0x5aa19f['journey'][_0x1f462b(0x17b)](_0x419bdf),_0x57a69b=_0x141a84['id'],_0x95e9c3=new Map();for(const _0x261c7d of _0x141a84[_0x1f462b(0x1a8)][_0x1f462b(0x182)]){_0x95e9c3[_0x1f462b(0x1c6)](_0x261c7d[_0x1f462b(0x140)]['toLowerCase'](),_0x261c7d['id']);}recoverSegmentIdsFromPushRecovery(_0x149964,_0x111c7a,_0x5a253[_0x1f462b(0x154)]);for(const [_0x485ef4,{definition:_0x1237cc}]of _0x58be32){if(_0x111c7a['has'](_0x485ef4)){_0x7a5ea[_0x1f462b(0x14c)]?.({'type':_0x1f462b(0x155),'journeyName':_0x149964[_0x1f462b(0x166)]['name'],'segmentName':_0x485ef4});continue;}const _0x37cb94=generateDeterministicJourneySegmentName(_0x149964[_0x1f462b(0x166)][_0x1f462b(0x140)],_0x485ef4);_0x7a5ea[_0x1f462b(0x14c)]?.({'type':'embedded_segment_creating','journeyName':_0x149964['yamlConfig']['name'],'segmentName':_0x485ef4});const _0x398802=createSegmentIdResolver(_0x5a253[_0x1f462b(0x154)],_0x485ef4),_0x426624=await resolveRuleSegmentIds(_0x1237cc[_0x1f462b(0x11c)],_0x398802),_0x463d24=await createOrRecoverEmbeddedSegment(_0x5aa19f,_0x149964,{'localName':_0x485ef4,'uniqueSegmentName':_0x37cb94,'description':_0x1237cc[_0x1f462b(0x175)]||_0x1f462b(0xe8)+_0x485ef4,'journeyId':_0x57a69b,'resolvedRule':_0x426624,'parentId':_0x475fdd[_0x1f462b(0x1ce)],'folderId':_0x475fdd[_0x1f462b(0x15c)]||''},_0x18f6b0);_0x111c7a[_0x1f462b(0x1c6)](_0x485ef4,_0x463d24),_0x5a253[_0x1f462b(0x154)]['set'](_0x485ef4,_0x463d24),_0x7a5ea[_0x1f462b(0x14c)]?.({'type':'embedded_segment_created','journeyName':_0x149964[_0x1f462b(0x166)][_0x1f462b(0x140)],'segmentName':_0x485ef4});}const _0x5361c6=new Map();for(const [_0x482743,_0x3f95dc]of _0xfd5255){_0x7a5ea[_0x1f462b(0x14c)]?.({'type':'embedded_activation_creating','journeyName':_0x149964[_0x1f462b(0x166)][_0x1f462b(0x140)],'activationName':_0x482743});const _0x5dd252=await _0x5d6095(_0x3f95dc,_0x5a253['activationContext']),_0x591048={..._0x5dd252,..._0x3f95dc['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x3f95dc[_0x1f462b(0x159)]}},_0x478931=await _0x5aa19f[_0x1f462b(0xfe)][_0x1f462b(0x160)](_0x57a69b,_0x591048);_0x5361c6['set'](_0x482743,_0x478931['id']),_0x31700e[_0x1f462b(0x100)][_0x1f462b(0x1c6)](_0x482743,_0x478931['id']),_0x7a5ea['onProgress']?.({'type':'embedded_activation_created','journeyName':_0x149964[_0x1f462b(0x166)][_0x1f462b(0x140)],'activationName':_0x482743});}const _0x140be4=JSON['parse'](JSON[_0x1f462b(0xf9)](_0x5eb7f5));return _0x140be4['id']=_0x57a69b,ensureJourneyDefaults(_0x140be4['attributes']),resolvePendingIdsInRequest(_0x140be4,_0x5eb7f5,_0x95e9c3,_0x111c7a,_0x5361c6,_0x7a5ea),await _0x5aa19f[_0x1f462b(0xfe)][_0x1f462b(0x181)](_0x57a69b,_0x140be4),deletePushRecovery(_0x149964[_0x1f462b(0x12e)]),{'action':'created','journeyId':_0x57a69b,'embeddedSegmentNameToId':_0x111c7a};}export function stripWaitStepPendingIds(_0x3c22ab){const _0x578bc9=a151_0x403771,_0x32ead4=_0x3c22ab['conditionSegmentId']&&isPendingSegmentId(_0x3c22ab[_0x578bc9(0xdf)]),_0x40d720=_0x3c22ab[_0x578bc9(0x1dd)]?.[_0x578bc9(0x15a)](_0x3165ab=>_0x3165ab['segmentId']&&isPendingSegmentId(_0x3165ab[_0x578bc9(0x16e)]));(_0x32ead4||_0x40d720)&&(_0x3c22ab[_0x578bc9(0x10a)]='Duration',_0x3c22ab[_0x578bc9(0xeb)]=0x1,_0x3c22ab['waitStepUnit']=_0x578bc9(0xf0),delete _0x3c22ab['conditionSegmentId'],delete _0x3c22ab[_0x578bc9(0x119)],delete _0x3c22ab[_0x578bc9(0xf2)],delete _0x3c22ab[_0x578bc9(0x1dd)]);}export function resolveWaitStepPendingIds(_0x19923d,_0x6c8189,_0x643c04,_0x18a962){const _0x4d89fe=a151_0x403771;if(_0x6c8189['conditionSegmentId']&&isPendingSegmentId(_0x6c8189[_0x4d89fe(0xdf)])){const _0x5e6efb=_0x643c04(_0x6c8189['conditionSegmentId'],_0x4d89fe(0x1c2)+_0x18a962+'\x27\x20wait\x20condition');_0x5e6efb&&(_0x19923d[_0x4d89fe(0x10a)]=_0x4d89fe(0xee),_0x19923d['conditionSegmentId']=_0x5e6efb,delete _0x19923d[_0x4d89fe(0xeb)],delete _0x19923d['waitStepUnit'],_0x6c8189[_0x4d89fe(0x119)]!==undefined&&(_0x19923d[_0x4d89fe(0x119)]=_0x6c8189[_0x4d89fe(0x119)]),_0x6c8189[_0x4d89fe(0xf2)]&&(_0x19923d[_0x4d89fe(0xf2)]=_0x6c8189[_0x4d89fe(0xf2)]));}if(_0x6c8189[_0x4d89fe(0x1dd)]){const _0x44120f=_0x6c8189[_0x4d89fe(0x1dd)][_0x4d89fe(0x15a)](_0x48c801=>_0x48c801[_0x4d89fe(0x16e)]&&isPendingSegmentId(_0x48c801[_0x4d89fe(0x16e)]));if(_0x44120f){const _0x351916=_0x6c8189[_0x4d89fe(0x1dd)][_0x4d89fe(0xf3)](_0x54d0b1=>{const _0x5a01bc=_0x4d89fe;if(_0x54d0b1[_0x5a01bc(0x16e)]&&isPendingSegmentId(_0x54d0b1['segmentId'])){const _0x50ae28=_0x643c04(_0x54d0b1[_0x5a01bc(0x16e)],_0x5a01bc(0x1c2)+_0x18a962+_0x5a01bc(0x173));return{..._0x54d0b1,'segmentId':_0x50ae28||_0x54d0b1[_0x5a01bc(0x16e)]};}return{..._0x54d0b1};});_0x19923d[_0x4d89fe(0x10a)]='Condition',_0x19923d[_0x4d89fe(0x1dd)]=_0x351916,delete _0x19923d[_0x4d89fe(0xeb)],delete _0x19923d['waitStepUnit'],delete _0x19923d[_0x4d89fe(0xdf)],delete _0x19923d[_0x4d89fe(0x119)],delete _0x19923d['conditionTimeoutUnit'];}}}function stripPendingIds(_0x37223d){const _0xd8125a=a151_0x403771;_0x37223d[_0xd8125a(0x1a8)][_0xd8125a(0x1b3)]?.['segmentId']&&isPendingSegmentId(_0x37223d['attributes'][_0xd8125a(0x1b3)]['segmentId'])&&delete _0x37223d[_0xd8125a(0x1a8)][_0xd8125a(0x1b3)];for(const _0x25add8 of _0x37223d['attributes'][_0xd8125a(0x182)]||[]){_0x25add8[_0xd8125a(0x1be)]?.[_0xd8125a(0x16e)]&&isPendingSegmentId(_0x25add8[_0xd8125a(0x1be)][_0xd8125a(0x16e)])&&delete _0x25add8['entryCriteria'];_0x25add8[_0xd8125a(0x183)]?.[_0xd8125a(0x16e)]&&isPendingSegmentId(_0x25add8[_0xd8125a(0x183)][_0xd8125a(0x16e)])&&delete _0x25add8[_0xd8125a(0x183)];_0x25add8['exitCriterias']&&(_0x25add8['exitCriterias']=_0x25add8[_0xd8125a(0x1c4)]['filter'](_0x14a45c=>!_0x14a45c[_0xd8125a(0x16e)]||!isPendingSegmentId(_0x14a45c[_0xd8125a(0x16e)])));if(_0x25add8['steps'])for(const _0x519f42 of Object[_0xd8125a(0x153)](_0x25add8[_0xd8125a(0x172)])){const _0x361324=_0x25add8[_0xd8125a(0x172)][_0x519f42];_0x361324[_0xd8125a(0x1d7)]===_0xd8125a(0x193)&&_0x361324[_0xd8125a(0x1d2)]&&isPendingActivationId(_0x361324[_0xd8125a(0x1d2)])&&(_0x361324[_0xd8125a(0x1d2)]='');if(_0x361324[_0xd8125a(0x1d7)]==='DecisionPoint'&&_0x361324[_0xd8125a(0x1ab)])for(const _0x62811d of _0x361324[_0xd8125a(0x1ab)]){_0x62811d[_0xd8125a(0x16e)]&&isPendingSegmentId(_0x62811d[_0xd8125a(0x16e)])&&(_0x62811d[_0xd8125a(0x16e)]='');}_0x361324[_0xd8125a(0x1d7)]==='WaitStep'&&stripWaitStepPendingIds(_0x361324);}}}function resolvePendingIdsInRequest(_0x11f046,_0x1f39f1,_0x29b95e,_0x5d9a47,_0x14edc5,_0x51fd12){const _0x5d2bb6=a151_0x403771,_0x28e3ad=(_0x2a153b,_0x2ebc94)=>{const _0x3f502b=a151_0xf275;if(!isPendingSegmentId(_0x2a153b))return _0x2a153b;const _0x324b22=extractPendingSegmentName(_0x2a153b),_0x39f9fd=_0x5d9a47[_0x3f502b(0x16c)](_0x324b22);return!_0x39f9fd&&_0x51fd12['logWarning']?.(_0x3f502b(0x14b)+_0x324b22+_0x3f502b(0x1bd)+_0x2ebc94),_0x39f9fd;};if(_0x11f046['attributes'][_0x5d2bb6(0x1b3)]?.[_0x5d2bb6(0x16e)]&&isPendingSegmentId(_0x11f046[_0x5d2bb6(0x1a8)][_0x5d2bb6(0x1b3)]['segmentId'])){const _0x2fa57c=_0x28e3ad(_0x11f046[_0x5d2bb6(0x1a8)]['goal']['segmentId'],_0x5d2bb6(0x1a5));_0x2fa57c&&(_0x11f046[_0x5d2bb6(0x1a8)][_0x5d2bb6(0x1b3)][_0x5d2bb6(0x16e)]=_0x2fa57c);}for(const _0x54d2e0 of _0x11f046['attributes'][_0x5d2bb6(0x182)]||[]){const _0x5f2590=_0x29b95e['get'](_0x54d2e0[_0x5d2bb6(0x140)]['toLowerCase']());_0x5f2590&&(_0x54d2e0['id']=_0x5f2590);if(_0x54d2e0[_0x5d2bb6(0x1be)]?.[_0x5d2bb6(0x16e)]&&isPendingSegmentId(_0x54d2e0[_0x5d2bb6(0x1be)][_0x5d2bb6(0x16e)])){const _0x19180f=_0x28e3ad(_0x54d2e0[_0x5d2bb6(0x1be)][_0x5d2bb6(0x16e)],_0x5d2bb6(0x1c2)+_0x54d2e0['name']+_0x5d2bb6(0x191));_0x19180f&&(_0x54d2e0['entryCriteria']['segmentId']=_0x19180f);}if(_0x54d2e0['exitCriterias'])for(const _0x70cd72 of _0x54d2e0['exitCriterias']){if(_0x70cd72[_0x5d2bb6(0x16e)]&&isPendingSegmentId(_0x70cd72[_0x5d2bb6(0x16e)])){const _0x5bce25=_0x28e3ad(_0x70cd72[_0x5d2bb6(0x16e)],_0x5d2bb6(0x1c2)+_0x54d2e0['name']+_0x5d2bb6(0x113));_0x5bce25&&(_0x70cd72[_0x5d2bb6(0x16e)]=_0x5bce25);}}if(_0x54d2e0['milestone']?.[_0x5d2bb6(0x16e)]&&isPendingSegmentId(_0x54d2e0[_0x5d2bb6(0x183)][_0x5d2bb6(0x16e)])){const _0x253f82=_0x28e3ad(_0x54d2e0[_0x5d2bb6(0x183)][_0x5d2bb6(0x16e)],_0x5d2bb6(0x1c2)+_0x54d2e0[_0x5d2bb6(0x140)]+_0x5d2bb6(0x170));_0x253f82&&(_0x54d2e0[_0x5d2bb6(0x183)][_0x5d2bb6(0x16e)]=_0x253f82);}if(_0x54d2e0[_0x5d2bb6(0x172)]){const _0x372c99=_0x2e7981=>_0x1f39f1['attributes'][_0x5d2bb6(0x182)]?.[_0x5d2bb6(0x115)](_0x57a2ef=>_0x57a2ef[_0x5d2bb6(0x140)][_0x5d2bb6(0x12a)]()===_0x54d2e0[_0x5d2bb6(0x140)][_0x5d2bb6(0x12a)]())?.[_0x5d2bb6(0x172)]?.[_0x2e7981];for(const _0x274a66 of Object[_0x5d2bb6(0x153)](_0x54d2e0[_0x5d2bb6(0x172)])){const _0x2c2e49=_0x54d2e0[_0x5d2bb6(0x172)][_0x274a66],_0x124e38=_0x372c99(_0x274a66);if(_0x2c2e49[_0x5d2bb6(0x1d7)]===_0x5d2bb6(0x193)&&_0x2c2e49[_0x5d2bb6(0x1d2)]&&(isPendingActivationId(_0x2c2e49['journeyActivationStepId'])||_0x2c2e49['journeyActivationStepId']==='')){if(_0x124e38?.[_0x5d2bb6(0x1d2)]&&isPendingActivationId(_0x124e38['journeyActivationStepId'])){const _0x306141=extractPendingActivationName(_0x124e38[_0x5d2bb6(0x1d2)]),_0x5793c1=_0x14edc5[_0x5d2bb6(0x16c)](_0x306141);_0x5793c1&&(_0x2c2e49[_0x5d2bb6(0x1d2)]=_0x5793c1);}}if(_0x2c2e49[_0x5d2bb6(0x1d7)]===_0x5d2bb6(0x17c)&&_0x2c2e49[_0x5d2bb6(0x1ab)]&&_0x124e38?.[_0x5d2bb6(0x1ab)])for(let _0x190de2=0x0;_0x190de2<_0x2c2e49[_0x5d2bb6(0x1ab)][_0x5d2bb6(0x112)];_0x190de2++){const _0x28b3f8=_0x2c2e49['branches'][_0x190de2],_0x323aa9=_0x124e38[_0x5d2bb6(0x1ab)][_0x190de2];if(_0x323aa9?.['segmentId']&&isPendingSegmentId(_0x323aa9[_0x5d2bb6(0x16e)])){const _0x58efad=_0x28e3ad(_0x323aa9[_0x5d2bb6(0x16e)],_0x5d2bb6(0x1c2)+_0x54d2e0[_0x5d2bb6(0x140)]+_0x5d2bb6(0x11e)+(_0x28b3f8[_0x5d2bb6(0x140)]||_0x190de2)+'\x27');_0x58efad&&(_0x28b3f8[_0x5d2bb6(0x16e)]=_0x58efad);}}_0x2c2e49['type']===_0x5d2bb6(0x19c)&&_0x124e38?.[_0x5d2bb6(0x1d7)]===_0x5d2bb6(0x19c)&&resolveWaitStepPendingIds(_0x2c2e49,_0x124e38,_0x28e3ad,_0x54d2e0[_0x5d2bb6(0x140)]);}}}}
1
+ (function(_0xeddd9c,_0x216e6b){const _0x47506c=a152_0x4bbc,_0x4f0c3e=_0xeddd9c();while(!![]){try{const _0x1e3034=parseInt(_0x47506c(0x199))/0x1+-parseInt(_0x47506c(0x152))/0x2*(-parseInt(_0x47506c(0x178))/0x3)+parseInt(_0x47506c(0x1d4))/0x4+parseInt(_0x47506c(0xfa))/0x5*(parseInt(_0x47506c(0x12f))/0x6)+-parseInt(_0x47506c(0x174))/0x7*(parseInt(_0x47506c(0x143))/0x8)+parseInt(_0x47506c(0x1ab))/0x9*(-parseInt(_0x47506c(0x15b))/0xa)+parseInt(_0x47506c(0x1a9))/0xb*(-parseInt(_0x47506c(0x13d))/0xc);if(_0x1e3034===_0x216e6b)break;else _0x4f0c3e['push'](_0x4f0c3e['shift']());}catch(_0x512a6e){_0x4f0c3e['push'](_0x4f0c3e['shift']());}}}(a152_0x14ea,0x341bf));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of']('tdx.sdk.push-workflow');export const PENDING_SEGMENT_PREFIX='__pending_';export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0x2422a2){return''+PENDING_SEGMENT_PREFIX+_0x2422a2+'__';}export function isPendingSegmentId(_0x15c739){const _0x8fb34b=a152_0x4bbc;return _0x15c739['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x15c739[_0x8fb34b(0x14c)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x136ba9){const _0x3bff9a=a152_0x4bbc;return _0x136ba9[_0x3bff9a(0x1cd)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x5ede46){return''+PENDING_ACTIVATION_PREFIX+_0x5ede46+'__';}export function isPendingActivationId(_0xe0bafd){const _0x46aa9d=a152_0x4bbc;return _0xe0bafd[_0x46aa9d(0x14c)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x1e58aa){const _0x5de08c=a152_0x4bbc;return _0x1e58aa[_0x5de08c(0x1cd)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x5b8101,_0x14c9d6){const _0xf5d277=a152_0x4bbc,_0x255c45=_0x5b8101+'::'+(_0x14c9d6[_0xf5d277(0x1a7)]()||'segment'),_0x2ff16f=createHash(_0xf5d277(0x1b2))[_0xf5d277(0x142)](_0x255c45)['digest']('hex')[_0xf5d277(0x1b9)](0x0,0xc);return _0xf5d277(0x13f)+_0x2ff16f;}export function ensureJourneyDefaults(_0x22ba80){const _0x1d0edf=a152_0x4bbc;!_0x22ba80[_0x1d0edf(0x19f)]&&(_0x22ba80['description']=''),!_0x22ba80['state']&&(_0x22ba80[_0x1d0edf(0x113)]='draft');}export function injectExistingStageIds(_0x6b93b1,_0x4a2509){const _0x1c9230=a152_0x4bbc,_0x30d0ff=new Map(_0x4a2509['map'](_0x16516b=>[_0x16516b[_0x1c9230(0x1da)],_0x16516b['id']]));for(const _0x102091 of _0x6b93b1){if(!_0x102091['id']){const _0x5f3fde=_0x30d0ff[_0x1c9230(0x138)](_0x102091[_0x1c9230(0x1da)]);_0x5f3fde&&(_0x102091['id']=_0x5f3fde);}}}export function resolveTDFolderPath(_0x56e625,_0x5a5e38,_0x399eac){const _0x557360=a152_0x4bbc;if(!_0x5a5e38)return _0x56e625;if(_0x56e625===_0x399eac||_0x56e625[_0x557360(0x14c)](_0x399eac+'/'))return _0x56e625;return _0x56e625?_0x399eac+'/'+_0x56e625:_0x399eac;}export function addFoldersToCreate(_0x55480a,_0x4384f1,_0x257c55){const _0x2160a4=a152_0x4bbc;if(!_0x55480a)return;if(_0x4384f1[_0x2160a4(0x1ad)](_0x55480a))return;const _0x54698f=_0x55480a['split']('/');let _0x4605bc='';for(const _0x3f53f2 of _0x54698f){_0x4605bc=_0x4605bc?_0x4605bc+'/'+_0x3f53f2:_0x3f53f2,!_0x4384f1['has'](_0x4605bc)&&_0x257c55[_0x2160a4(0x12c)](_0x4605bc);}}export function sortFoldersByDepth(_0x546df5){const _0x5192cf=a152_0x4bbc;return[..._0x546df5][_0x5192cf(0x135)]((_0x3dc8f2,_0x3e809f)=>{const _0x217abd=_0x5192cf,_0x6fd75a=(_0x3dc8f2[_0x217abd(0x13c)](/\//g)||[])[_0x217abd(0x175)],_0x45dc79=(_0x3e809f[_0x217abd(0x13c)](/\//g)||[])[_0x217abd(0x175)];return _0x6fd75a-_0x45dc79;});}import*as a152_0x24f2de from'yaml';import{readFileSync}from'fs';import a152_0x3752ae from'path';import{isJourneyDef,parseYamlString as a152_0x55956b,toYamlString as a152_0x585ff1,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(_0xa23781){const _0x1af84c=a152_0x4bbc;if(Array['isArray'](_0xa23781))return'['+_0xa23781[_0x1af84c(0x1db)](_0x1daf6d=>stableStringify(_0x1daf6d))[_0x1af84c(0x1ea)](',')+']';if(_0xa23781&&typeof _0xa23781==='object'){const _0x4b5fb4=_0xa23781,_0x7a53e6=Object[_0x1af84c(0x1b3)](_0x4b5fb4)[_0x1af84c(0x135)](),_0x820af3=_0x7a53e6[_0x1af84c(0x1db)](_0x47a3ce=>'\x22'+_0x47a3ce+'\x22:'+stableStringify(_0x4b5fb4[_0x47a3ce]));return'{'+_0x820af3[_0x1af84c(0x1ea)](',')+'}';}const _0x53fba6=JSON['stringify'](_0xa23781);return _0x53fba6===undefined?_0x1af84c(0x139):_0x53fba6;}function activationSignature(_0x11875b){const _0x4952d1=a152_0x4bbc,_0x679169={'connection':_0x11875b[_0x4952d1(0x1c7)],..._0x11875b[_0x4952d1(0x1cf)]!==undefined&&{'all_columns':_0x11875b[_0x4952d1(0x1cf)]},..._0x11875b[_0x4952d1(0x1ba)]!==undefined&&{'columns':_0x11875b['columns']},..._0x11875b[_0x4952d1(0x114)]!==undefined&&{'behavior':_0x11875b[_0x4952d1(0x114)]},..._0x11875b[_0x4952d1(0x196)]!==undefined&&{'schedule':_0x11875b[_0x4952d1(0x196)]},..._0x11875b[_0x4952d1(0x1e3)]!==undefined&&{'notification':_0x11875b[_0x4952d1(0x1e3)]},..._0x11875b[_0x4952d1(0x1b8)]!==undefined&&{'connector_config':_0x11875b[_0x4952d1(0x1b8)]},..._0x11875b[_0x4952d1(0x1a2)]!==undefined&&{'activation_template_id':_0x11875b[_0x4952d1(0x1a2)]}};return stableStringify(_0x679169);}async function fetchSegment(_0x51746f,_0x27e3c1,_0x18fb71,_0x45bf3d){const _0x19073b=a152_0x4bbc,_0x520bea=_0x45bf3d?.[_0x19073b(0x1a3)](_0x577a1d=>_0x577a1d['id']===_0x18fb71);if(_0x520bea)return _0x520bea;try{return await _0x51746f['segment'][_0x19073b(0x1ed)](_0x27e3c1,_0x18fb71);}catch(_0xbc4627){logger[_0x19073b(0x119)](_0x19073b(0x197)+_0x18fb71+_0x19073b(0x169)+_0xbc4627);try{return await _0x51746f[_0x19073b(0x161)][_0x19073b(0x15d)](_0x18fb71);}catch(_0x3657a2){return logger[_0x19073b(0x119)]('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x18fb71+':\x20'+_0x3657a2),null;}}}function recoverSegmentIdsFromPushRecovery(_0x52c4d9,_0x37552d,_0x3682a5){const _0x47e2d7=a152_0x4bbc,_0x1b6a56=readPushRecovery(_0x52c4d9[_0x47e2d7(0x1ef)]);if(_0x1b6a56?.['journeyName']===_0x52c4d9[_0x47e2d7(0x1a1)][_0x47e2d7(0x1da)])for(const [_0x2787d2,_0x8fb067]of Object[_0x47e2d7(0x1cc)](_0x1b6a56[_0x47e2d7(0x134)])){const _0x383269=generateDeterministicJourneySegmentName(_0x52c4d9[_0x47e2d7(0x1a1)][_0x47e2d7(0x1da)],_0x2787d2);_0x8fb067[_0x47e2d7(0x159)]===_0x383269&&(_0x37552d[_0x47e2d7(0x18f)](_0x2787d2,_0x8fb067[_0x47e2d7(0x179)]),_0x3682a5[_0x47e2d7(0x18f)](_0x2787d2,_0x8fb067['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x460f0e,_0x41e80b,_0x368dee,_0x5c4751){const _0x2fb6a5=a152_0x4bbc;let _0x227d50;try{_0x227d50=await _0x460f0e[_0x2fb6a5(0x161)][_0x2fb6a5(0x1bf)]({'name':_0x368dee[_0x2fb6a5(0x1bd)],'description':_0x368dee[_0x2fb6a5(0x19f)],'journeyId':_0x368dee['journeyId'],'rule':_0x5c4751(_0x368dee[_0x2fb6a5(0x1e0)],!![]),'countPopulation':!![],'parentFolderId':_0x368dee['folderId'],'audienceId':_0x368dee[_0x2fb6a5(0x17c)]});}catch(_0x43a7cd){const _0x4afb08=_0x43a7cd instanceof Error&&_0x43a7cd[_0x2fb6a5(0x15f)][_0x2fb6a5(0x14e)](_0x2fb6a5(0x19d));if(_0x4afb08){const _0x277a12=readPushRecovery(_0x41e80b[_0x2fb6a5(0x1ef)]),_0x3ffa0e=_0x277a12?.[_0x2fb6a5(0x155)]===_0x41e80b[_0x2fb6a5(0x1a1)][_0x2fb6a5(0x1da)]?_0x277a12[_0x2fb6a5(0x134)][_0x368dee[_0x2fb6a5(0x1b6)]]:undefined;if(_0x3ffa0e?.['uniqueServerName']===_0x368dee[_0x2fb6a5(0x1bd)])await _0x460f0e[_0x2fb6a5(0x161)][_0x2fb6a5(0x1f0)](_0x368dee[_0x2fb6a5(0x17c)],_0x3ffa0e[_0x2fb6a5(0x179)],{'description':_0x368dee[_0x2fb6a5(0x19f)],'rule':_0x5c4751(_0x368dee[_0x2fb6a5(0x1e0)],!![]),'countPopulation':!![]}),_0x227d50=_0x3ffa0e[_0x2fb6a5(0x179)];else throw new SDKError(ErrorCode[_0x2fb6a5(0x1d1)],_0x2fb6a5(0x1ca)+_0x368dee[_0x2fb6a5(0x1b6)]+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+(_0x2fb6a5(0x10c)+_0x41e80b[_0x2fb6a5(0x1ef)]['replace'](/([^/]+)$/,_0x2fb6a5(0x13e))+')\x20')+_0x2fb6a5(0x131),_0x43a7cd);}else throw _0x43a7cd;}return saveSegmentToPushRecovery(_0x41e80b[_0x2fb6a5(0x1ef)],_0x41e80b['yamlConfig'][_0x2fb6a5(0x1da)],_0x368dee['localName'],{'segmentId':_0x227d50,'uniqueServerName':_0x368dee['uniqueSegmentName'],'createdAt':new Date()['toISOString']()}),_0x227d50;}function a152_0x4bbc(_0x270057,_0xa65067){_0x270057=_0x270057-0xf5;const _0x14ea14=a152_0x14ea();let _0x4bbc9a=_0x14ea14[_0x270057];return _0x4bbc9a;}export async function prepareSegmentFiles(_0x422333,_0x214058,_0x4e05f7,_0x7ea325,_0x54ff81){const _0x5831f8=a152_0x4bbc,{activationDefToCreateRequest:_0x18b438}=await import(_0x5831f8(0x16a)),_0x4a632e=[],_0x25bc62=new Set();for(const {yamlConfig:_0x42361d,folderPath:_0x234705,sourcePath:_0x2d1728}of _0x422333){const _0x2bf3f0=resolveTDFolderPath(_0x234705,_0x7ea325,_0x54ff81),_0x1ff323=_0x2bf3f0+':'+_0x42361d[_0x5831f8(0x1da)],_0x1394eb=_0x214058[_0x5831f8(0x158)]['get'](_0x1ff323),_0x36b916=_0x1394eb?_0x214058['activationsBySegmentId'][_0x5831f8(0x138)](_0x1394eb['id'])||[]:[];addFoldersToCreate(_0x2bf3f0,_0x214058[_0x5831f8(0x185)],_0x25bc62);const _0x15d7f9=calculateActivationActions(_0x42361d['activations']||[],_0x36b916,_0x214058[_0x5831f8(0x180)],_0x214058[_0x5831f8(0x186)]);for(const _0x145951 of _0x15d7f9){(_0x145951['type']===_0x5831f8(0x145)||_0x145951[_0x5831f8(0xf9)]===_0x5831f8(0x142))&&_0x145951['yamlActivation']&&(_0x145951[_0x5831f8(0x1a4)]=await _0x18b438(_0x145951[_0x5831f8(0x1c5)],_0x4e05f7));}const _0x2e6725=calculateSegmentDiff(_0x42361d,_0x1394eb,_0x36b916,_0x214058[_0x5831f8(0x180)],_0x214058['connectionIdToNameMap']);_0x4a632e['push']({'relativePath':_0x42361d[_0x5831f8(0x1da)],'absolutePath':_0x2d1728,'yamlConfig':_0x42361d,'folderPath':_0x2bf3f0,'existingSegment':_0x1394eb,'existingActivations':_0x36b916,'isNew':_0x2e6725[_0x5831f8(0x128)],'hasChanges':_0x2e6725['hasChanges'],'diff':_0x2e6725[_0x5831f8(0x121)],'activationActions':_0x15d7f9});}return{'segmentFiles':_0x4a632e,'foldersToCreate':_0x25bc62};}export async function prepareJourneyFiles(_0x4033a8,_0xe365cb,_0x43f3e2,_0x47655c){const _0x4c304f=a152_0x4bbc,_0x45295f=[],_0x32b978=new Set();for(const {yamlConfig:_0x1dbc28,folderPath:_0x24d7ea,sourcePath:_0x5b3432}of _0x4033a8){const _0x381041=resolveTDFolderPath(_0x24d7ea,_0x43f3e2,_0x47655c),_0x8cc1c6=_0x381041+':'+_0x1dbc28['name'],_0x53ff64=_0xe365cb[_0x4c304f(0x171)][_0x4c304f(0x138)](_0x8cc1c6);let _0x725dfe,_0xc2a7dc;if(_0x53ff64&&_0x53ff64[_0x4c304f(0x175)]>0x0){const _0x4fb3a7=buildLocalExpandedRuleMappings(_0x1dbc28),{createYamlContext:_0x123678,prefetchJourneySegments:_0x10cc80}=createPushYamlContextForBundle(_0xe365cb[_0x4c304f(0x11f)],_0xe365cb[_0x4c304f(0x17c)],_0xe365cb[_0x4c304f(0x122)],_0x4fb3a7,_0xe365cb[_0x4c304f(0x180)],_0xe365cb[_0x4c304f(0x186)],_0xe365cb[_0x4c304f(0xfb)],_0xe365cb[_0x4c304f(0x1a8)]);await _0x10cc80(_0x53ff64[_0x4c304f(0x1db)](_0x7ef6dd=>_0x7ef6dd['id']));const _0x2cc743=await _0xe365cb[_0x4c304f(0x11f)]['journey']['getLatestJourneyId'](_0x53ff64[0x0][_0x4c304f(0x126)]),_0x7737df=hasMultipleVersions(_0x1dbc28),_0x363c76=async _0x107a01=>{const _0x2b8b4e=_0x4c304f,_0x171f19=_0xe365cb[_0x2b8b4e(0x1a8)]?.[_0x2b8b4e(0x138)](_0x107a01);if(_0x171f19)return _0x171f19;return _0xe365cb[_0x2b8b4e(0x118)]({'journeyId':_0x107a01,'journeyName':_0x1dbc28[_0x2b8b4e(0x1da)],'isMultiVersion':_0x53ff64[_0x2b8b4e(0x175)]>0x1});};if(_0x7737df&&_0x53ff64['length']>0x1){const _0x305104=[];for(const _0x510158 of _0x53ff64){const _0x4a4800=_0x510158['versionNumber']||0x1;_0xe365cb[_0x4c304f(0x1af)]?.[_0x4c304f(0x142)](_0x4c304f(0x17f)+_0x1dbc28[_0x4c304f(0x1da)]+'\x20v'+_0x4a4800);const _0x56b36c=await _0x363c76(_0x510158['id']),_0x197c7c=_0x123678(_0x510158['id']),_0x40b174=await journeyResponseToDef(_0x56b36c,_0x197c7c);_0x305104['push']({'item':_0x510158,'yaml':_0x40b174});}const _0x593f50=buildLocalRuleToNameMappingFromJourney(_0x1dbc28);_0xc2a7dc=buildMergedJourneyDef(_0x305104,_0x593f50,_0x2cc743);const _0x4ebc76=Math['max'](..._0x305104[_0x4c304f(0x1db)](_0x1b8a77=>_0x1b8a77[_0x4c304f(0x1a0)]['versionNumber']||0x0)),_0x4a34ce=_0x53ff64['find'](_0x5ab72f=>(_0x5ab72f[_0x4c304f(0x129)]||0x0)===_0x4ebc76);_0x4a34ce&&(_0xe365cb[_0x4c304f(0x1af)]?.[_0x4c304f(0x142)](_0x4c304f(0x17f)+_0x1dbc28[_0x4c304f(0x1da)]+'\x20v'+_0x4ebc76),_0x725dfe=await _0x363c76(_0x4a34ce['id']));}else{const _0x4608c0=_0x53ff64[_0x53ff64[_0x4c304f(0x175)]-0x1];_0xe365cb[_0x4c304f(0x1af)]?.[_0x4c304f(0x142)](_0x4c304f(0x17f)+_0x1dbc28[_0x4c304f(0x1da)]),_0x725dfe=await _0x363c76(_0x4608c0['id']);const _0x23b4c1=_0x123678(_0x4608c0['id']),_0x2db159=await journeyResponseToDef(_0x725dfe,_0x23b4c1),_0x49cc24=buildLocalRuleToNameMappingFromJourney(_0x1dbc28);_0xc2a7dc=buildMergedJourneyDef([{'item':_0x4608c0,'yaml':_0x2db159}],_0x49cc24,_0x2cc743);}}addFoldersToCreate(_0x381041,_0xe365cb[_0x4c304f(0x185)],_0x32b978);const _0x2f0b7a=calculateJourneyDiff(_0x1dbc28,_0xc2a7dc);_0x45295f['push']({'relativePath':_0x1dbc28[_0x4c304f(0x1da)],'absolutePath':_0x5b3432,'yamlConfig':_0x1dbc28,'folderPath':_0x381041,'existingJourney':_0x725dfe,'isNew':_0x2f0b7a['isNew'],'hasChanges':_0x2f0b7a['hasChanges'],'diff':_0x2f0b7a['diff']});}return{'journeyFiles':_0x45295f,'foldersToCreate':_0x32b978};}export function calculateActivationActions(_0x5de89d,_0x37670b,_0x43eb17,_0x987a03){const _0x51be23=a152_0x4bbc,_0x2b760e=[],_0x20a79c=new Map();for(const _0x5f5549 of _0x37670b){_0x20a79c['set'](_0x5f5549['name'],_0x5f5549);}const _0x3dc699=new Map();for(const _0x2c5f52 of _0x5de89d){_0x3dc699[_0x51be23(0x18f)](_0x2c5f52['name'],_0x2c5f52);}for(const _0x251a06 of _0x5de89d){const _0x138311=_0x20a79c[_0x51be23(0x138)](_0x251a06[_0x51be23(0x1da)]);if(!_0x138311)_0x2b760e['push']({'type':_0x51be23(0x145),'name':_0x251a06[_0x51be23(0x1da)],'yamlActivation':_0x251a06});else{const _0x433309=activationResponseToDef(_0x138311,_0x43eb17,_0x987a03),_0x184aff=a152_0x24f2de[_0x51be23(0x172)](_0x433309),_0x102bf6=a152_0x24f2de[_0x51be23(0x172)](_0x251a06);_0x184aff!==_0x102bf6&&_0x2b760e[_0x51be23(0x1b5)]({'type':'update','name':_0x251a06[_0x51be23(0x1da)],'yamlActivation':_0x251a06,'existingActivation':_0x138311});}}for(const _0x27d6bb of _0x37670b){!_0x3dc699['has'](_0x27d6bb['name'])&&_0x2b760e[_0x51be23(0x1b5)]({'type':_0x51be23(0x144),'name':_0x27d6bb['name'],'existingActivation':_0x27d6bb});}return _0x2b760e;}function calculateYamlDiff(_0x2a58cf,_0x103583){if(_0x103583){const _0x49a9e5=generateDiff(_0x103583,_0x2a58cf),_0x5d28fc=hasChanges(_0x49a9e5);return{'isNew':![],'hasChanges':_0x5d28fc,'diff':_0x5d28fc?formatDiffWithColors(_0x49a9e5):undefined};}const _0x3244b7=generateDiff('',_0x2a58cf);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x3244b7)};}export function calculateSegmentDiff(_0x34d706,_0x477b6b,_0xba9f07,_0x37965e,_0x5d38a0){const _0x583aaf=segmentToYamlString(_0x34d706),_0x53256e=_0x477b6b?segmentToYamlString(segmentWithActivationsToYaml(_0x477b6b,_0xba9f07,undefined,_0x37965e,_0x5d38a0)):undefined;return calculateYamlDiff(_0x583aaf,_0x53256e);}export function calculateJourneyDiff(_0x1442b9,_0x42eaf4){const _0x1060c0=normalizeJourneyDef(_0x1442b9,_0x1442b9),_0x450ce9=a152_0x585ff1(_0x1060c0),_0x34e7ac=_0x42eaf4?a152_0x585ff1(normalizeJourneyDef(_0x42eaf4,_0x1442b9)):undefined;return calculateYamlDiff(_0x450ce9,_0x34e7ac);}export function findSegmentsToDelete(_0xa50285,_0x175e21,_0x5f0a53,_0x1944ed,_0xb95816){const _0x4c517e=a152_0x4bbc,_0x47f354=new Set();for(const {yamlConfig:_0xdf3b35,folderPath:_0x451a35}of _0x175e21){_0x47f354[_0x4c517e(0x12c)](_0x451a35+':'+_0xdf3b35['name']);}return _0xa50285['filter'](_0x31c5ff=>{const _0x20a9ec=_0x4c517e,_0x49cb1d=_0x31c5ff[_0x20a9ec(0x1de)]?_0x5f0a53[_0x20a9ec(0x138)](_0x31c5ff[_0x20a9ec(0x1de)][_0x20a9ec(0x19e)]())||'':'',_0x1425b4=_0x49cb1d+':'+_0x31c5ff['name'];if(_0x47f354['has'](_0x1425b4))return![];if(_0xb95816)return _0x49cb1d===_0x1944ed||_0x49cb1d['startsWith'](_0x1944ed+'/');return!![];});}export function findJourneysToDelete(_0x33f3ba,_0x10a8ce,_0x1b4e6d,_0x1ce655,_0x513877){const _0x542ffe=a152_0x4bbc,_0x35be70=new Set();for(const {yamlConfig:_0x2d01b5,folderPath:_0x20619a}of _0x10a8ce){_0x35be70['add'](_0x20619a+':'+_0x2d01b5[_0x542ffe(0x1da)]);}return _0x33f3ba[_0x542ffe(0x110)](_0xcf5bef=>{const _0xc529a9=_0x542ffe,_0x439c54=_0xcf5bef[_0xc529a9(0x157)]?_0x1b4e6d[_0xc529a9(0x138)](_0xcf5bef[_0xc529a9(0x157)])||'':'',_0x353660=_0x439c54+':'+_0xcf5bef[_0xc529a9(0x1e9)];if(_0x35be70['has'](_0x353660))return![];if(_0x513877)return _0x439c54===_0x1ce655||_0x439c54['startsWith'](_0x1ce655+'/');return!![];});}function a152_0x14ea(){const _0x503f1f=['max','journeyBundleId','existingJourney','isNew','versionNumber','\x0a\x20\x20','embedded_activation_creating','add','Deleted\x20activation\x20\x27','waitStepUnit','6tdtFxH','conditionTimeoutDuration','and\x20the\x20server\x20segment,\x20then\x20retry.','Entry\x20criteria:\x20','activation_deleted','segments','sort','\x20error(s)','\x27\x20not\x20found\x20in\x20journey\x20\x27','get','null','journey_updating','waitStepType','match','784452jKgzFJ','.$1.push-recovery.json','journey_entry_criteria_','Creating\x20activation\x20\x27','Failed\x20to\x20resolve\x20activation\x20','update','1671584NDyrhn','delete','create','activation_creating','exitCriterias','resolveJourneyId','Activation','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','unchanged','startsWith','segmentNameToId','includes','NOT_FOUND','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','813634ANolRb','reduce','getJourney','journeyName','size','folderId','segmentByFolderAndName','uniqueServerName','waitStep','40hpghiD','logDeleted','getSegmentEntity','journeyActivationStepId','message','journey','segment','../../utils/async.js','goal\x20criteria','Failed\x20to\x20','\x27\x20decision\x20point\x20branch\x20\x27','segment_creating','journeyStages','valid',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','./child-segment-yaml.js','conditionSegmentId','Creating\x20folder\x20\x27','updateActivation','segment_updating','Segment\x20not\x20found:\x20','SEGMENT_NOT_FOUND','journeyBundlesByFolderAndName','stringify','kind','7TqKqei','length','Failed\x20to\x20resolve\x20segment\x20','activation_updated','3aHTLag','segmentId','listActivations','utf-8','parentId','logSuccess','verbose','Fetching\x20','idToEmailMap','goal','withProgress','journeyId','Creating\x20segment\x20\x27','folderPathToId','connectionIdToNameMap','user','getActivation','Duration','Updating\x20activation\x20\x27','\x27\x20entry\x20criteria','WaitStep','folder','with','set','./journey-yaml.js','toISOString','flatMap','existingSegment','Condition','branches','schedule','getSegment\x20failed\x20for\x20','Activation\x20not\x20found:\x20','211622BOWzcL','errors','\x27...','parentSegmentFolder','Name\x20has\x20already\x20been\x20taken','toString','description','item','yamlConfig','activation_template_id','find','validatedRequest','activationContext','activation_','trim','journeyById','110XBBTMM','folder_created','370989KNUcVg','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','has','\x27\x20for\x20','progress','segment_deleting','steps','sha1','keys','data','push','localName','relationships','connector_config','slice','columns','parseDocument','logInfo','uniqueSegmentName','Created\x20segment\x20\x27','createJourneySegment','skipSegments','deleted','\x27\x20from\x20file:\x20','\x27\x20by\x20rule\x20content','createdSegmentId','yamlActivation','\x20segment\x20from\x20file:\x20','connection','entry_criteria','stage\x20\x27','Embedded\x20segment\x20\x27','results','entries','replace','Matched\x20server\x20segment\x20\x27','all_columns','embedded_segment_created','SEGMENT_UPDATE_ERROR','deleteSegment','entryCriteria','1410736zIgrXS','decision_point','conditions','stages','run_after_journey_refresh','action','name','map','ACTIVATION_UPDATE_ERROR','):\x20','segmentFolderId','conditionTimeoutUnit','resolvedRule','nameToId','logWarning','notification','Segment\x20not\x20found','\x20journey\x20from\x20file:\x20',').\x20','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','hasChanges','journeyBundleName','join','split','rule','getSegment','deleteActivation','absolutePath','updateSegmentById','segment_created','created','attributes','updated','Updated\x20journey\x20\x27','type','1349290zDFjGb','activationStepsById','\x27\x20exit\x20criteria','milestone','rootFolderId','activations','dirname','folderPath','DecisionPoint','journey_updated','resolveSegment','some','Created\x20journey\x20\x27','parentFolder','from','parse','onProgress','embeddedSegmentNameToId','Delete\x20the\x20push\x20recovery\x20file\x20(','journeys','all','Stage\x20\x27','filter','buildUserMaps','Updating\x20segment\x20\x27','state','behavior','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','nameToType','existingActivation','fetchJourney','debug','toLowerCase','\x20activation\x20\x27','Deleted\x20segment\x20\x27','INTERNAL','createActivation','deps','\x20(referenced\x20in\x20journey\x20','diff','existingSegments','index','relative'];a152_0x14ea=function(){return _0x503f1f;};return a152_0x14ea();}export function buildSegmentLookupMap(_0x48f232,_0x52bcd5){const _0x10922f=a152_0x4bbc,_0x3d36be=new Map();for(const _0x57123a of _0x48f232){const _0x3eb91a=_0x57123a[_0x10922f(0x1de)]?_0x52bcd5[_0x10922f(0x138)](_0x57123a['segmentFolderId'][_0x10922f(0x19e)]())||'':'',_0x14ff5a=_0x3eb91a+':'+_0x57123a[_0x10922f(0x1da)];_0x3d36be['set'](_0x14ff5a,_0x57123a);}return _0x3d36be;}export function buildSegmentNameToIdMap(_0x49a55b){const _0x362fdc=a152_0x4bbc,_0x5208f7=new Map();for(const _0x35d406 of _0x49a55b){_0x5208f7['set'](_0x35d406[_0x362fdc(0x1da)],_0x35d406['id']);}return _0x5208f7;}export function buildJourneyBundleLookupMap(_0x5ada5b,_0x27a3d8){const _0x4085c1=a152_0x4bbc,_0x33a5c5=new Map();for(const _0x29e764 of _0x5ada5b){const _0x11fe01=_0x29e764[_0x4085c1(0x157)]?_0x27a3d8[_0x4085c1(0x138)](_0x29e764['folderId'])||'':'',_0x41eed6=_0x11fe01+':'+_0x29e764['journeyBundleName'];!_0x33a5c5[_0x4085c1(0x1ad)](_0x41eed6)&&_0x33a5c5['set'](_0x41eed6,[]),_0x33a5c5[_0x4085c1(0x138)](_0x41eed6)['push'](_0x29e764);}for(const _0x3a28e3 of _0x33a5c5['values']()){_0x3a28e3[_0x4085c1(0x135)]((_0x10b4e3,_0x488a95)=>(_0x10b4e3[_0x4085c1(0x129)]||0x0)-(_0x488a95['versionNumber']||0x0));}return _0x33a5c5;}export function collectFoldersToCreate(_0x3120c5,_0x323150){const _0x5939d3=a152_0x4bbc,_0x4adc9d=new Set();for(const _0x2e76ed of _0x3120c5){if(!_0x2e76ed)continue;if(_0x323150[_0x5939d3(0x1ad)](_0x2e76ed))continue;const _0x45461d=_0x2e76ed[_0x5939d3(0x1eb)]('/');let _0x2aaef5='';for(const _0x1476d7 of _0x45461d){_0x2aaef5=_0x2aaef5?_0x2aaef5+'/'+_0x1476d7:_0x1476d7,!_0x323150[_0x5939d3(0x1ad)](_0x2aaef5)&&_0x4adc9d[_0x5939d3(0x12c)](_0x2aaef5);}}return _0x4adc9d;}export function parseAndClassifyYamlFiles(_0xa4e72,_0x2e9d51,_0x588116){const _0x28f676=a152_0x4bbc,_0x24257d=[],_0x5cbe55=[];for(const _0x22110a of _0xa4e72){const _0x2faf28=a152_0x3752ae[_0x28f676(0x124)](_0x2e9d51,a152_0x3752ae[_0x28f676(0x100)](_0x22110a)),_0x305f9d=_0x2faf28==='.'?'':_0x2faf28,_0x14eb0b=readFileSync(_0x22110a,_0x28f676(0x17b)),_0x271d12=a152_0x24f2de[_0x28f676(0x109)](_0x14eb0b);if(isJourneyDef(_0x271d12)){const _0x1d47e3=a152_0x55956b(_0x14eb0b);_0x5cbe55['push']({'yamlConfig':_0x1d47e3,'folderPath':_0x305f9d,'sourcePath':_0x22110a});}else{if(!_0x588116?.[_0x28f676(0x1c0)]){const _0x4b6b68=parseSegmentYamlFile(_0x14eb0b),_0x383673=normalizeChildSegmentYaml(_0x4b6b68);_0x24257d[_0x28f676(0x1b5)]({'yamlConfig':_0x383673,'folderPath':_0x305f9d,'sourcePath':_0x22110a});}}}return{'segments':_0x24257d,'journeys':_0x5cbe55};}export function validateParsedFiles(_0x49d516,_0x448e91){const _0x297b24=a152_0x4bbc,_0x220cc4=[];for(const {yamlConfig:_0x47f5f1,sourcePath:_0x43bf7c}of _0x49d516[_0x297b24(0x134)]){const _0x511ade=readFileSync(_0x43bf7c,_0x297b24(0x17b)),_0x5dc9ee=a152_0x24f2de['parseDocument'](_0x511ade),_0x5e9cb7=validateSegmentDef(_0x47f5f1,{'source':_0x511ade,'document':_0x5dc9ee},{'skipSchema':!![]});if(!_0x5e9cb7[_0x297b24(0x168)]){const _0x42cec6=a152_0x3752ae[_0x297b24(0x124)](_0x448e91,_0x43bf7c);_0x220cc4[_0x297b24(0x1b5)]({'filePath':_0x42cec6,'source':_0x511ade,'result':_0x5e9cb7,'isJourney':![]});}}for(const {yamlConfig:_0x374cb3,sourcePath:_0x39b6e4}of _0x49d516[_0x297b24(0x10d)]){const _0x4fd11a=readFileSync(_0x39b6e4,_0x297b24(0x17b)),_0x3f059f=a152_0x24f2de[_0x297b24(0x1bb)](_0x4fd11a),_0x1632d6=validateJourneyDef(_0x374cb3,{'source':_0x4fd11a,'document':_0x3f059f},{'skipSchema':!![]});if(!_0x1632d6[_0x297b24(0x168)]){const _0x12f498=a152_0x3752ae[_0x297b24(0x124)](_0x448e91,_0x39b6e4);_0x220cc4[_0x297b24(0x1b5)]({'filePath':_0x12f498,'source':_0x4fd11a,'result':_0x1632d6,'isJourney':!![]});}}return _0x220cc4;}export function formatValidationErrors(_0x5c2fb0){const _0x34483b=a152_0x4bbc,_0x3bc148=[];for(const {filePath:_0x3a3824,source:_0x340475,result:_0x354e91,isJourney:_0x28a452}of _0x5c2fb0){const _0x81af1a=_0x28a452?_0x34483b(0x160):_0x34483b(0x161);_0x3bc148['push']('\x0a'+_0x3a3824+'\x20('+_0x81af1a+_0x34483b(0x1dd)+_0x354e91[_0x34483b(0x19a)]['length']+_0x34483b(0x136)),_0x3bc148[_0x34483b(0x1b5)](formatValidationResult(_0x354e91,_0x340475,_0x3a3824));}return _0x3bc148[_0x34483b(0x1ea)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x31b976){const _0xa1ecf=a152_0x4bbc,_0x865af2=new Set(),_0x15bd77=new Map(),_0x16d1cc=collectSegmentUsageCounts(_0x31b976);if(_0x31b976[_0xa1ecf(0x134)])for(const [_0x431e94,_0x1670ac]of Object[_0xa1ecf(0x1cc)](_0x31b976[_0xa1ecf(0x134)])){_0x865af2[_0xa1ecf(0x12c)](_0x431e94);if(_0x1670ac['rule']){const _0x2f2a9c=yamlRuleToApi(_0x1670ac['rule']),_0x526573=apiRuleToYaml(_0x2f2a9c);_0x15bd77['set'](_0x431e94,_0x526573);}}const _0x13c42d=new Map();let _0x888e5=0x0;for(const [_0x42c4b7,_0x527dfc]of _0x15bd77){const _0x47f3e3=serializeExpandedRule(_0x527dfc,_0x15bd77),_0x521e43=_0x13c42d[_0xa1ecf(0x138)](_0x47f3e3)||[];_0x521e43['push']({'name':_0x42c4b7,'index':_0x888e5}),_0x13c42d[_0xa1ecf(0x18f)](_0x47f3e3,_0x521e43),_0x888e5++;}const _0x4ce410=new Map();for(const [_0xd6d128,_0x4fcf79]of _0x13c42d){const _0x4d7e58=_0x4fcf79[_0xa1ecf(0x1b9)]()[_0xa1ecf(0x135)]((_0x445668,_0x30b6c9)=>{const _0x1dd1eb=_0xa1ecf,_0x5a3ab9=_0x16d1cc['get'](_0x445668[_0x1dd1eb(0x1da)])||0x0,_0x523322=_0x16d1cc[_0x1dd1eb(0x138)](_0x30b6c9[_0x1dd1eb(0x1da)])||0x0;if(_0x5a3ab9!==_0x523322)return _0x523322-_0x5a3ab9;return _0x445668[_0x1dd1eb(0x123)]-_0x30b6c9[_0x1dd1eb(0x123)];})[_0xa1ecf(0x1db)](_0x20895d=>_0x20895d[_0xa1ecf(0x1da)]),_0x4b6f47=[];for(const _0x3104d1 of _0x4d7e58){const _0x344cc7=_0x16d1cc[_0xa1ecf(0x138)](_0x3104d1)||0x0,_0x2d1c0e=Math[_0xa1ecf(0x125)](_0x344cc7,0x1);for(let _0xdc761b=0x0;_0xdc761b<_0x2d1c0e;_0xdc761b++){_0x4b6f47[_0xa1ecf(0x1b5)](_0x3104d1);}}_0x4ce410[_0xa1ecf(0x18f)](_0xd6d128,_0x4b6f47);}return{'existingLocalSegmentNames':_0x865af2,'localSegmentRules':_0x15bd77,'localExpandedRuleToNames':_0x4ce410};}export function createSegmentIdResolver(_0x1e51b6,_0x40d2dc){return async _0x26a860=>{const _0x2aa85b=a152_0x4bbc,_0x79c82e=_0x1e51b6[_0x2aa85b(0x138)](_0x26a860);if(!_0x79c82e)throw new SDKError(ErrorCode[_0x2aa85b(0x170)],'Segment\x20not\x20found:\x20'+_0x26a860+_0x2aa85b(0x115)+_0x40d2dc+'\x27)');return _0x79c82e;};}export function extractRootFolderId(_0x50ddff){const _0x1d432d=a152_0x4bbc;return _0x50ddff[_0x1d432d(0x1b7)]?.[_0x1d432d(0x19c)]?.[_0x1d432d(0x1b4)]?.['id']||_0x50ddff['relationships']?.[_0x1d432d(0x107)]?.[_0x1d432d(0x1b4)]?.['id'];}export function buildConnectionMaps(_0x4d0938){const _0x2640ce=a152_0x4bbc,_0x130590=new Map(),_0x5c7fc1=new Map(),_0x4ccf62=new Map();for(const _0x376bf0 of _0x4d0938){_0x130590[_0x2640ce(0x18f)](_0x376bf0[_0x2640ce(0x1da)],parseInt(_0x376bf0['id'],0xa)),_0x5c7fc1[_0x2640ce(0x18f)](_0x376bf0['id'],_0x376bf0[_0x2640ce(0x1da)]),_0x4ccf62[_0x2640ce(0x18f)](_0x376bf0[_0x2640ce(0x1da)],_0x376bf0[_0x2640ce(0xf9)]);}return{'nameToId':_0x130590,'idToName':_0x5c7fc1,'nameToType':_0x4ccf62};}export function calculatePushStats(_0x6fd125,_0x3d3193,_0x59df58,_0x1f339c,_0x53f789,_0x42bada,_0x1ba02a){const _0x3d32c4=a152_0x4bbc,_0x263077=_0x6fd125[_0x3d32c4(0x110)](_0xc2c565=>_0xc2c565[_0x3d32c4(0x128)]),_0x1da4c8=_0x6fd125['filter'](_0x3a6be2=>!_0x3a6be2[_0x3d32c4(0x128)]&&_0x3a6be2[_0x3d32c4(0x1e8)]),_0x3f56a0=_0x6fd125['filter'](_0x35d7d3=>!_0x35d7d3[_0x3d32c4(0x128)]&&!_0x35d7d3[_0x3d32c4(0x1e8)]),_0x2582a1=_0x42bada?_0x1f339c:[],_0x31ba66=_0x3d3193['filter'](_0x2416eb=>_0x2416eb['isNew']),_0x1efa99=_0x3d3193['filter'](_0x349b2b=>!_0x349b2b[_0x3d32c4(0x128)]&&_0x349b2b[_0x3d32c4(0x1e8)]),_0x213424=_0x3d3193['filter'](_0x461baa=>!_0x461baa[_0x3d32c4(0x128)]&&!_0x461baa['hasChanges']),_0x4725c2=_0x42bada?_0x53f789:[],_0x328a90=_0x6fd125[_0x3d32c4(0x192)](_0x40f514=>_0x40f514['activationActions']),_0x541dac=_0x328a90['filter'](_0x121233=>_0x121233[_0x3d32c4(0xf9)]===_0x3d32c4(0x145)),_0x1e1d7b=_0x328a90['filter'](_0x189864=>_0x189864[_0x3d32c4(0xf9)]===_0x3d32c4(0x142)),_0x3bc845=_0x328a90['filter'](_0x278925=>_0x278925['type']===_0x3d32c4(0x144)),_0x5eae5a=Array['from'](_0x59df58)[_0x3d32c4(0x135)](),_0x8c5ca5=_0x1ba02a?![]:_0x263077['length']>0x0||_0x1da4c8[_0x3d32c4(0x175)]>0x0||_0x2582a1[_0x3d32c4(0x175)]>0x0,_0x38ac68=_0x31ba66['length']>0x0||_0x1efa99['length']>0x0||_0x4725c2[_0x3d32c4(0x175)]>0x0,_0x4187db=_0x1ba02a?![]:_0x328a90['length']>0x0,_0x299bb7=_0x5eae5a['length']>0x0;return{'segments':{'new':_0x263077,'changed':_0x1da4c8,'unchanged':_0x3f56a0,'toDelete':_0x2582a1},'journeys':{'new':_0x31ba66,'changed':_0x1efa99,'unchanged':_0x213424,'toDelete':_0x4725c2},'activations':{'all':_0x328a90,'toCreate':_0x541dac,'toUpdate':_0x1e1d7b,'toDelete':_0x3bc845},'folders':{'toCreate':_0x5eae5a},'counts':{'segments':{'new':_0x263077[_0x3d32c4(0x175)],'changed':_0x1da4c8[_0x3d32c4(0x175)],'unchanged':_0x3f56a0['length'],'toDelete':_0x2582a1['length']},'journeys':{'new':_0x31ba66['length'],'changed':_0x1efa99['length'],'unchanged':_0x213424[_0x3d32c4(0x175)],'toDelete':_0x4725c2['length']},'activations':{'create':_0x541dac[_0x3d32c4(0x175)],'update':_0x1e1d7b[_0x3d32c4(0x175)],'delete':_0x3bc845['length']},'folders':_0x5eae5a[_0x3d32c4(0x175)]},'hasChanges':_0x8c5ca5||_0x38ac68||_0x4187db||_0x299bb7};}export async function buildPushExecutionContext(_0x40dde1,_0x41174f,_0x15b552,_0x5c626a,_0x5c74ec,_0x7b15c8){const _0x3fc76e=a152_0x4bbc,_0x98cf55=extractRootFolderId(_0x15b552),{pathToId:_0x52b7c2,idToPath:_0x315688}=buildFolderMaps(_0x5c74ec),_0x2b2ed0=buildSegmentNameToIdMap(_0x5c626a),_0x348ee9=new Map(),{batchAsync:_0x1617ce}=await import(_0x3fc76e(0x162)),[_0x2d5cd2,_0x17b488]=await Promise['all']([_0x40dde1[_0x3fc76e(0x187)][_0x3fc76e(0x111)](),_0x40dde1['connection']['list'](),((async()=>{const _0x5d5a3e=_0x3fc76e;!_0x7b15c8&&_0x5c626a[_0x5d5a3e(0x175)]>0x0&&await _0x1617ce(_0x5c626a,async _0x4883f2=>{const _0x442639=_0x5d5a3e,_0x5d95fb=await _0x40dde1[_0x442639(0x161)][_0x442639(0x17a)](_0x41174f,_0x4883f2['id']);_0x348ee9[_0x442639(0x18f)](_0x4883f2['id'],_0x5d95fb);});})())]),{emailToId:_0x5912ca,idToEmail:_0x49ef36}=_0x2d5cd2,_0x41d474=buildConnectionMaps(_0x17b488);return{'rootFolderId':_0x98cf55,'folderPathToId':_0x52b7c2,'folderIdToPath':_0x315688,'segmentNameToId':_0x2b2ed0,'activationsBySegmentId':_0x348ee9,'emailToIdMap':_0x5912ca,'idToEmailMap':_0x49ef36,'connectionNameToIdMap':_0x41d474[_0x3fc76e(0x1e1)],'connectionIdToNameMap':_0x41d474['idToName'],'connectionNameToTypeMap':_0x41d474[_0x3fc76e(0x116)]};}export function createPushYamlContextForBundle(_0x290365,_0x48fa98,_0x1d60bd,_0x1f14ce,_0x2f95ca,_0x4e29e6,_0x241054,_0x5e8a74){const {existingLocalSegmentNames:_0x1a3573,localExpandedRuleToNames:_0x428dfa}=_0x1f14ce,_0x148556=new Set(),_0x3ab259=new Map(),_0x535dcd=new Map(),_0x3f0030=new Map(),_0x578c1c=createJumpTargetCache(),_0x29b54b=new Map(),_0x4032f7=new Map(),_0x4bbbcd=new Set();let _0x110b61;const _0x7aca00=_0x3dc6a4=>{const _0x2529c6={'resolveSegment':async _0x3c3a3f=>{const _0x5db759=a152_0x4bbc,_0x52c6fc=_0x3f0030[_0x5db759(0x138)](_0x3c3a3f);if(_0x52c6fc!==undefined)return{'name':_0x52c6fc,'isJourneyLocal':!![]};try{const _0x47fb64=await fetchSegment(_0x290365,_0x48fa98,_0x3c3a3f,_0x1d60bd);if(!_0x47fb64)throw new Error(_0x5db759(0x1e4));const _0x14eb26=generateJourneyLocalName(_0x47fb64[_0x5db759(0x1da)]),_0x2304b0=_0x47fb64[_0x5db759(0x173)]===SEGMENT_KIND_JOURNEY&&_0x14eb26!==undefined;let _0xf9a436=_0x47fb64[_0x5db759(0x1da)],_0xa062d7;if(_0x2304b0&&_0x47fb64[_0x5db759(0x1ec)]){const _0x2aff78=apiRuleToYaml(_0x47fb64[_0x5db759(0x1ec)]);_0x4032f7[_0x5db759(0x18f)](_0x3c3a3f,_0x2aff78);const _0x27caca=async _0x50dd86=>{const _0x30232a=_0x5db759,_0x3a8bce=collectSegmentRefsFromRule(_0x50dd86);for(const _0x4691ba of _0x3a8bce){if(!_0x4032f7[_0x30232a(0x1ad)](_0x4691ba))try{const _0x1df604=await fetchSegment(_0x290365,_0x48fa98,_0x4691ba,_0x1d60bd);if(_0x1df604?.[_0x30232a(0x1ec)]){const _0x2f38df=apiRuleToYaml(_0x1df604['rule']);_0x4032f7[_0x30232a(0x18f)](_0x4691ba,_0x2f38df),await _0x27caca(_0x2f38df);}}catch(_0x145083){logger[_0x30232a(0x119)]('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0x4691ba+':\x20'+_0x145083);}}};await _0x27caca(_0x2aff78);const _0x54ece8=serializeExpandedRule(_0x2aff78,_0x4032f7),_0x1c4deb=_0x428dfa['get'](_0x54ece8);if(_0x1c4deb&&_0x1c4deb[_0x5db759(0x175)]>0x0){const _0x332674=_0x3ab259[_0x5db759(0x138)](_0x54ece8)||0x0,_0x5dd097=_0x1c4deb[_0x332674]||_0x1c4deb[_0x1c4deb['length']-0x1];_0x3ab259[_0x5db759(0x18f)](_0x54ece8,_0x332674+0x1),_0xf9a436=_0x5dd097,_0x148556[_0x5db759(0x12c)](_0xf9a436),_0x3f0030[_0x5db759(0x18f)](_0x3c3a3f,_0xf9a436);const _0xe4fd98=await resolveRuleSegmentRefs(_0x2aff78,async _0x214ec6=>{const _0x9c919d=_0x5db759,_0x67ccff=_0x3f0030[_0x9c919d(0x138)](_0x214ec6);if(_0x67ccff)return _0x67ccff;const _0x3dd1c1=await _0x110b61[_0x9c919d(0x104)](_0x214ec6);return _0x3dd1c1[_0x9c919d(0x1da)];});_0xa062d7={'description':_0x47fb64[_0x5db759(0x19f)],'rule':_0xe4fd98};}else{const _0x1973eb=_0x29b54b[_0x5db759(0x138)](_0x54ece8);if(_0x1973eb)_0xf9a436=_0x1973eb,_0x3f0030[_0x5db759(0x18f)](_0x3c3a3f,_0xf9a436);else{if(_0x14eb26){let _0x19c4ea=_0x14eb26,_0x18a559=0x2;while(_0x148556[_0x5db759(0x1ad)](_0x19c4ea)||_0x1a3573[_0x5db759(0x1ad)](_0x19c4ea)){_0x19c4ea=_0x14eb26+'_'+_0x18a559,_0x18a559++;}_0x148556[_0x5db759(0x12c)](_0x19c4ea),_0xf9a436=_0x19c4ea;}_0x3f0030[_0x5db759(0x18f)](_0x3c3a3f,_0xf9a436),_0x29b54b[_0x5db759(0x18f)](_0x54ece8,_0xf9a436);const _0x360bf2=await resolveRuleSegmentRefs(_0x2aff78,async _0xd2018f=>{const _0x65d378=_0x5db759,_0x4670aa=_0x3f0030[_0x65d378(0x138)](_0xd2018f);if(_0x4670aa)return _0x4670aa;const _0x2d5195=await _0x110b61['resolveSegment'](_0xd2018f);return _0x2d5195['name'];});_0xa062d7={'description':_0x47fb64[_0x5db759(0x19f)],'rule':_0x360bf2};}}}return{'name':_0xf9a436,'isJourneyLocal':_0x2304b0,'definition':_0xa062d7};}catch(_0x1cacfe){return logger['debug'](_0x5db759(0x176)+_0x3c3a3f+':\x20'+_0x1cacfe),{'name':_0x3c3a3f,'isJourneyLocal':![]};}},'resolveActivation':async _0x41bb96=>{const _0xe03f36=a152_0x4bbc,_0x11d039=_0x535dcd[_0xe03f36(0x138)](_0x41bb96);if(_0x11d039!==undefined)return{'name':_0x11d039,'isJourneyLocal':!![]};try{let _0x50e35e=_0x241054?.[_0xe03f36(0x138)](_0x41bb96);!_0x50e35e&&(_0x50e35e=await _0x290365[_0xe03f36(0x160)][_0xe03f36(0x188)](_0x3dc6a4,_0x41bb96));const _0x27064c=_0x50e35e['attributes']['activationParams'][_0xe03f36(0x1da)]||_0x41bb96,_0x4cd226=sanitizeYamlKey(_0x27064c)||_0xe03f36(0x1a6)+_0x41bb96,_0x3f30f4=_0x4cd226;_0x535dcd[_0xe03f36(0x18f)](_0x41bb96,_0x3f30f4);const _0x1d3885=journeyActivationStepToYaml(_0x50e35e,_0x2f95ca,_0x4e29e6);return{'name':_0x3f30f4,'isJourneyLocal':!![],'definition':_0x1d3885};}catch(_0x21d517){return logger[_0xe03f36(0x119)](_0xe03f36(0x141)+_0x41bb96+':\x20'+_0x21d517),{'name':_0x41bb96,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x5b97a7,_0x167996)=>resolveJumpTarget(_0x5b97a7,_0x167996,_0x578c1c,async _0x421e22=>{const _0x392b5c=a152_0x4bbc,_0x46d6a0=_0x5e8a74?.['get'](_0x421e22);if(_0x46d6a0)return _0x46d6a0;return _0x290365[_0x392b5c(0x160)][_0x392b5c(0x154)](_0x421e22);})};return _0x110b61=_0x2529c6,_0x2529c6;},_0x393f8a=async _0x4975a8=>{const _0x45a636=a152_0x4bbc,{collectSegmentIdsFromJourneyApi:_0x1132bb}=await import(_0x45a636(0x190)),{batchAsync:_0x28961d}=await import('../../utils/async.js'),_0x26adbd=new Set();for(const _0x115cf0 of _0x4975a8){let _0x10dfe7=_0x5e8a74?.['get'](_0x115cf0);!_0x10dfe7&&(_0x10dfe7=await _0x290365[_0x45a636(0x160)][_0x45a636(0x154)](_0x115cf0));const _0x19f560=_0x1132bb(_0x10dfe7);for(const _0x40fef3 of _0x19f560){_0x26adbd['add'](_0x40fef3);}}let _0x113128=Array['from'](_0x26adbd);while(_0x113128['length']>0x0){const _0x403600=_0x113128[_0x45a636(0x110)](_0x9bb244=>!_0x4bbbcd[_0x45a636(0x1ad)](_0x9bb244));if(_0x403600[_0x45a636(0x175)]===0x0)break;const _0x3be1bf=await _0x28961d(_0x403600,async _0x4995e5=>{_0x4bbbcd['add'](_0x4995e5);const _0x165ec4=await fetchSegment(_0x290365,_0x48fa98,_0x4995e5,_0x1d60bd);if(!_0x165ec4)return null;return{'segmentId':_0x4995e5,'segment':_0x165ec4};},0xa),_0x199813=new Set();for(const _0x170632 of _0x3be1bf){if(!_0x170632?.[_0x45a636(0x161)]?.[_0x45a636(0x1ec)])continue;const _0x57aeb8=apiRuleToYaml(_0x170632[_0x45a636(0x161)][_0x45a636(0x1ec)]);_0x4032f7[_0x45a636(0x18f)](_0x170632['segmentId'],_0x57aeb8);const _0x2f2bd1=collectSegmentRefsFromRule(_0x57aeb8);for(const _0x3434da of _0x2f2bd1){!_0x4bbbcd[_0x45a636(0x1ad)](_0x3434da)&&_0x199813[_0x45a636(0x12c)](_0x3434da);}}_0x113128=Array[_0x45a636(0x108)](_0x199813);}};return{'createYamlContext':_0x7aca00,'prefetchJourneySegments':_0x393f8a};}export async function executePushSegments(_0x4197a4,_0x33cdf6,_0x10b8a6,_0x1855bc,_0x4649c9){const _0x5dfd7d=a152_0x4bbc,{segmentDefToCreateRequest:_0x38bb06,segmentDefToUpdateRequest:_0x2022dd}=await import(_0x5dfd7d(0x16a)),_0x41fc44=_0x10b8a6[_0x5dfd7d(0x185)],_0x4d9867=0x5,_0x35c347=async _0xe64578=>{const _0x2a2a36=_0x5dfd7d,_0xf25577=_0xe64578[_0x2a2a36(0x101)]?_0x41fc44[_0x2a2a36(0x138)](_0xe64578[_0x2a2a36(0x101)]):undefined;let _0x1f7bed;const _0x583b31={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x418e4b=_0xe64578[_0x2a2a36(0x1a1)];if(_0xe64578['yamlConfig'][_0x2a2a36(0x1ec)]){const _0x24b096=createSegmentIdResolver(_0x10b8a6[_0x2a2a36(0x14d)],_0xe64578['yamlConfig']['name']),_0x42f985=await resolveRuleSegmentIds(_0xe64578['yamlConfig'][_0x2a2a36(0x1ec)],_0x24b096);_0x418e4b={..._0xe64578[_0x2a2a36(0x1a1)],'rule':_0x42f985};}try{if(_0xe64578['isNew']){_0x4649c9[_0x2a2a36(0x10a)]?.({'type':_0x2a2a36(0x166),'name':_0xe64578['yamlConfig']['name']});const _0xfc8cb0=_0x38bb06(_0x418e4b,_0xf25577),_0x4673b4=await _0x4649c9[_0x2a2a36(0x182)](_0x2a2a36(0x184)+_0xe64578[_0x2a2a36(0x1a1)][_0x2a2a36(0x1da)]+'\x27...',()=>_0x4197a4[_0x2a2a36(0x161)]['createSegment'](_0x1855bc[_0x2a2a36(0x17c)],_0xfc8cb0));_0x1f7bed=_0x4673b4['data']['id'],_0x10b8a6['segmentNameToId']['set'](_0xe64578[_0x2a2a36(0x1a1)][_0x2a2a36(0x1da)],_0x1f7bed),_0x583b31['createdSegmentId']={'name':_0xe64578[_0x2a2a36(0x1a1)]['name'],'id':_0x1f7bed},_0x4649c9['onProgress']?.({'type':_0x2a2a36(0x1f1),'name':_0xe64578[_0x2a2a36(0x1a1)][_0x2a2a36(0x1da)],'segmentId':_0x1f7bed}),_0x4649c9[_0x2a2a36(0x17d)]?.(_0x2a2a36(0x1be)+_0xe64578['yamlConfig'][_0x2a2a36(0x1da)]+'\x27'),_0x583b31[_0x2a2a36(0xf5)]=0x1;}else{if(_0xe64578[_0x2a2a36(0x1e8)]){_0x4649c9[_0x2a2a36(0x10a)]?.({'type':_0x2a2a36(0x16e),'name':_0xe64578['yamlConfig'][_0x2a2a36(0x1da)]});const _0x495697=_0x2022dd(_0x418e4b);_0xf25577!==_0xe64578[_0x2a2a36(0x193)]?.[_0x2a2a36(0x1de)]&&(_0x495697[_0x2a2a36(0x1de)]=_0xf25577?parseInt(_0xf25577,0xa):undefined),await _0x4649c9[_0x2a2a36(0x182)](_0x2a2a36(0x112)+_0xe64578[_0x2a2a36(0x1a1)][_0x2a2a36(0x1da)]+_0x2a2a36(0x19b),()=>_0x4197a4[_0x2a2a36(0x161)][_0x2a2a36(0x1f0)](_0x1855bc['parentId'],_0xe64578[_0x2a2a36(0x193)]['id'],_0x495697)),_0x1f7bed=_0xe64578[_0x2a2a36(0x193)]['id'],_0x4649c9[_0x2a2a36(0x10a)]?.({'type':'segment_updated','name':_0xe64578[_0x2a2a36(0x1a1)][_0x2a2a36(0x1da)]}),_0x4649c9[_0x2a2a36(0x17d)]?.('Updated\x20segment\x20\x27'+_0xe64578[_0x2a2a36(0x1a1)][_0x2a2a36(0x1da)]+'\x27'),_0x583b31[_0x2a2a36(0xf7)]=0x1;}else _0x1f7bed=_0xe64578['existingSegment']['id'];}}catch(_0x1bcaa6){const _0x356338=isHttp400Error(_0x1bcaa6),_0xc039af=_0x356338?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode['SEGMENT_UPDATE_ERROR'],_0x419fc4=getErrorMessage(_0x1bcaa6);throw new SDKError(_0xc039af,'Failed\x20to\x20'+(_0xe64578[_0x2a2a36(0x128)]?'create':'update')+_0x2a2a36(0x1c6)+_0xe64578[_0x2a2a36(0x1ef)]+_0x2a2a36(0x12a)+_0x419fc4,_0x1bcaa6);}try{const _0x28844f=await syncActivationsForSegment(_0x4197a4,_0x1855bc[_0x2a2a36(0x17c)],_0x1f7bed,_0xe64578[_0x2a2a36(0x1a1)][_0x2a2a36(0x1da)],_0xe64578['activationActions'],_0x4649c9,_0xe64578[_0x2a2a36(0x1ef)]);_0x583b31[_0x2a2a36(0xff)]=_0x28844f;}catch(_0x24278a){if(_0x24278a instanceof SDKError)throw _0x24278a;throw new SDKError(ErrorCode[_0x2a2a36(0x1dc)],_0x2a2a36(0x1ac)+_0xe64578[_0x2a2a36(0x1a1)][_0x2a2a36(0x1da)]+_0x2a2a36(0x1c2)+_0xe64578[_0x2a2a36(0x1ef)]+'\x0a\x20\x20'+getErrorMessage(_0x24278a),_0x24278a);}return _0x583b31;},_0x48ea67=await batchAsync(_0x33cdf6,_0x35c347,_0x4d9867),_0x5957f0={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x365759 of _0x48ea67){_0x5957f0[_0x5dfd7d(0xf5)]+=_0x365759[_0x5dfd7d(0xf5)],_0x5957f0[_0x5dfd7d(0xf7)]+=_0x365759[_0x5dfd7d(0xf7)],_0x365759[_0x5dfd7d(0x1c4)]&&_0x5957f0['createdSegmentIds'][_0x5dfd7d(0x18f)](_0x365759['createdSegmentId'][_0x5dfd7d(0x1da)],_0x365759[_0x5dfd7d(0x1c4)]['id']),_0x5957f0[_0x5dfd7d(0xff)][_0x5dfd7d(0xf5)]+=_0x365759['activations'][_0x5dfd7d(0xf5)],_0x5957f0[_0x5dfd7d(0xff)][_0x5dfd7d(0xf7)]+=_0x365759['activations'][_0x5dfd7d(0xf7)],_0x5957f0['activations'][_0x5dfd7d(0x1c1)]+=_0x365759[_0x5dfd7d(0xff)]['deleted'];}return _0x5957f0;}async function syncActivationsForSegment(_0x177ed4,_0x223ccb,_0x3a1939,_0x4bb41e,_0x338059,_0x4a1509,_0x2317b2){const _0x107075=a152_0x4bbc,_0x7a0cee={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x4cb445 of _0x338059){try{if(_0x4cb445[_0x107075(0xf9)]===_0x107075(0x145)&&_0x4cb445[_0x107075(0x1a4)])_0x4a1509[_0x107075(0x10a)]?.({'type':_0x107075(0x146),'segmentName':_0x4bb41e,'activationName':_0x4cb445[_0x107075(0x1da)]}),await _0x4a1509[_0x107075(0x182)](_0x107075(0x140)+_0x4cb445[_0x107075(0x1da)]+_0x107075(0x19b),()=>_0x177ed4['segment'][_0x107075(0x11e)](_0x223ccb,_0x3a1939,_0x4cb445[_0x107075(0x1a4)])),_0x4a1509['onProgress']?.({'type':'activation_created','segmentName':_0x4bb41e,'activationName':_0x4cb445[_0x107075(0x1da)]}),_0x4a1509[_0x107075(0x17d)]?.('Created\x20activation\x20\x27'+_0x4cb445['name']+'\x27'),_0x7a0cee['created']++;else{if(_0x4cb445[_0x107075(0xf9)]===_0x107075(0x142)&&_0x4cb445['validatedRequest']&&_0x4cb445[_0x107075(0x117)])_0x4a1509[_0x107075(0x10a)]?.({'type':'activation_updating','segmentName':_0x4bb41e,'activationName':_0x4cb445[_0x107075(0x1da)]}),await _0x4a1509[_0x107075(0x182)](_0x107075(0x18a)+_0x4cb445['name']+'\x27...',()=>_0x177ed4[_0x107075(0x161)][_0x107075(0x16d)](_0x223ccb,_0x3a1939,_0x4cb445[_0x107075(0x117)]['id'],_0x4cb445[_0x107075(0x1a4)])),_0x4a1509[_0x107075(0x10a)]?.({'type':_0x107075(0x177),'segmentName':_0x4bb41e,'activationName':_0x4cb445[_0x107075(0x1da)]}),_0x4a1509[_0x107075(0x17d)]?.('Updated\x20activation\x20\x27'+_0x4cb445[_0x107075(0x1da)]+'\x27'),_0x7a0cee[_0x107075(0xf7)]++;else _0x4cb445['type']===_0x107075(0x144)&&_0x4cb445[_0x107075(0x117)]&&(_0x4a1509['onProgress']?.({'type':'activation_deleting','segmentName':_0x4bb41e,'activationName':_0x4cb445[_0x107075(0x1da)]}),await _0x4a1509[_0x107075(0x182)]('Deleting\x20activation\x20\x27'+_0x4cb445[_0x107075(0x1da)]+_0x107075(0x19b),()=>_0x177ed4[_0x107075(0x161)][_0x107075(0x1ee)](_0x223ccb,_0x3a1939,_0x4cb445[_0x107075(0x117)]['id'])),_0x4a1509[_0x107075(0x10a)]?.({'type':_0x107075(0x133),'segmentName':_0x4bb41e,'activationName':_0x4cb445[_0x107075(0x1da)]}),_0x4a1509[_0x107075(0x15c)]?.(_0x107075(0x12d)+_0x4cb445[_0x107075(0x1da)]+'\x27'),_0x7a0cee[_0x107075(0x1c1)]++);}}catch(_0x507480){const _0x34f492=isHttp400Error(_0x507480),_0x98c196=_0x34f492?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0x107075(0x1dc)],_0x201fa5=getErrorMessage(_0x507480);throw new SDKError(_0x98c196,_0x107075(0x164)+_0x4cb445[_0x107075(0xf9)]+_0x107075(0x11b)+_0x4cb445[_0x107075(0x1da)]+_0x107075(0x1c2)+_0x2317b2+_0x107075(0x12a)+_0x201fa5,_0x507480);}}return _0x7a0cee;}export async function executePushFolders(_0x3f0a4c,_0x568794,_0x1e0189,_0x200d5b,_0x209919){const _0x5bd381=a152_0x4bbc,_0x6a27bf=new Map(_0x1e0189),_0x3448f6=sortFoldersByDepth(_0x568794);for(const _0xff3702 of _0x3448f6){const _0x1c3d7e=_0xff3702[_0x5bd381(0x1eb)]('/'),_0x34ed5d=_0x1c3d7e[_0x1c3d7e['length']-0x1],_0x3b7b10=_0x1c3d7e[_0x5bd381(0x1b9)](0x0,-0x1)[_0x5bd381(0x1ea)]('/'),_0x4342f7=_0x6a27bf[_0x5bd381(0x138)](_0x3b7b10);_0x209919[_0x5bd381(0x10a)]?.({'type':'folder_creating','folder':_0xff3702});const _0x1214ab={'name':_0x34ed5d,'parentFolderId':_0x4342f7},_0x2a6a5a=await _0x209919[_0x5bd381(0x182)](_0x5bd381(0x16c)+_0xff3702+_0x5bd381(0x19b),()=>_0x3f0a4c[_0x5bd381(0x161)]['createFolder'](_0x200d5b['parentId'],_0x1214ab));_0x6a27bf[_0x5bd381(0x18f)](_0xff3702,_0x2a6a5a[_0x5bd381(0x1b4)]['id']),_0x209919[_0x5bd381(0x10a)]?.({'type':_0x5bd381(0x1aa),'folder':_0xff3702,'folderId':_0x2a6a5a[_0x5bd381(0x1b4)]['id']}),_0x209919[_0x5bd381(0x1bc)]?.('Created\x20folder\x20\x27'+_0xff3702+'\x27');}return _0x6a27bf;}export async function executePushSegmentDeletions(_0xe3b10c,_0x2abd14,_0x45b3b9){const _0x44dff8=a152_0x4bbc;if(_0x2abd14[_0x44dff8(0x175)]===0x0)return 0x0;const {batchAsync:_0x232429}=await import(_0x44dff8(0x162)),_0x56cfef=0x5,_0x3375bb=await _0x232429(_0x2abd14,async _0x431f24=>{const _0x54322a=_0x44dff8;return _0x45b3b9['onProgress']?.({'type':_0x54322a(0x1b0),'name':_0x431f24[_0x54322a(0x1da)]}),await _0xe3b10c[_0x54322a(0x161)][_0x54322a(0x1d2)](_0x431f24['id']),_0x45b3b9[_0x54322a(0x10a)]?.({'type':'segment_deleted','name':_0x431f24[_0x54322a(0x1da)]}),_0x45b3b9[_0x54322a(0x15c)]?.(_0x54322a(0x11c)+_0x431f24['name']+'\x27'),0x1;},_0x56cfef);return _0x3375bb[_0x44dff8(0x153)]((_0x1de469,_0x235bb9)=>_0x1de469+_0x235bb9,0x0);}export async function executePushJourneys(_0x4ba479,_0xcac01,_0x1ff10b,_0x11dcc2,_0x470e5a){const _0x24cac9=a152_0x4bbc,{journeyDefToRequest:_0x5a9ca9}=await import(_0x24cac9(0x190)),{activationDefToCreateRequest:_0x207e83,yamlRuleToApi:_0x31edf1,validateSegmentRule:_0x548658}=await import('./child-segment-yaml.js'),_0x4706ed={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x4348e4=new Map(_0x1ff10b[_0x24cac9(0x14d)]),_0x2d6fbc=0x5;for(let _0x5ed94d=0x0;_0x5ed94d<_0xcac01[_0x24cac9(0x175)];_0x5ed94d+=_0x2d6fbc){const _0x2c39b6=_0xcac01[_0x24cac9(0x1b9)](_0x5ed94d,_0x5ed94d+_0x2d6fbc),_0x67a3f8=await Promise[_0x24cac9(0x10e)](_0x2c39b6[_0x24cac9(0x1db)](async _0x1eb578=>{const _0x2803bb=_0x24cac9;if(!_0x1eb578[_0x2803bb(0x128)]&&!_0x1eb578[_0x2803bb(0x1e8)])return{'action':_0x2803bb(0x14b),'name':_0x1eb578['yamlConfig'][_0x2803bb(0x1da)],'journeyId':_0x1eb578[_0x2803bb(0x127)]?.['id']};const _0x33072f=_0x1eb578[_0x2803bb(0x101)]?_0x1ff10b[_0x2803bb(0x185)][_0x2803bb(0x138)](_0x1eb578['folderPath']):undefined;_0x470e5a[_0x2803bb(0x10a)]?.({'type':_0x1eb578[_0x2803bb(0x128)]?'journey_creating':_0x2803bb(0x13a),'name':_0x1eb578['yamlConfig'][_0x2803bb(0x1da)]});try{const _0x10736f=await executeSingleJourneyPush(_0x4ba479,_0x1eb578,{..._0x1ff10b,'segmentNameToId':_0x4348e4},{'parentId':_0x11dcc2['parentId'],'rootFolderId':_0x11dcc2['rootFolderId'],'folderId':_0x33072f,'verbose':_0x11dcc2[_0x2803bb(0x17e)]},_0x470e5a,{'journeyDefToRequest':_0x5a9ca9,'activationDefToCreateRequest':_0x207e83,'yamlRuleToApi':_0x31edf1,'validateSegmentRule':_0x548658});for(const [_0x566b1b,_0x5d83e8]of _0x10736f[_0x2803bb(0x10b)]){_0x4348e4['set'](_0x566b1b,_0x5d83e8),_0x4706ed['embeddedSegmentNameToId']['set'](_0x566b1b,_0x5d83e8);}if(_0x10736f['action']===_0x2803bb(0xf5))_0x470e5a[_0x2803bb(0x10a)]?.({'type':'journey_created','name':_0x1eb578[_0x2803bb(0x1a1)][_0x2803bb(0x1da)],'journeyId':_0x10736f[_0x2803bb(0x183)]}),_0x470e5a[_0x2803bb(0x17d)]?.(_0x2803bb(0x106)+_0x1eb578[_0x2803bb(0x1a1)]['name']+'\x27'),_0x4706ed[_0x2803bb(0xf5)]++;else _0x10736f[_0x2803bb(0x1d9)]===_0x2803bb(0xf7)&&(_0x470e5a[_0x2803bb(0x10a)]?.({'type':_0x2803bb(0x103),'name':_0x1eb578[_0x2803bb(0x1a1)][_0x2803bb(0x1da)]}),_0x470e5a[_0x2803bb(0x17d)]?.(_0x2803bb(0xf8)+_0x1eb578[_0x2803bb(0x1a1)][_0x2803bb(0x1da)]+'\x27'),_0x4706ed['updated']++);return{'action':_0x10736f[_0x2803bb(0x1d9)],'name':_0x1eb578['yamlConfig'][_0x2803bb(0x1da)],'journeyId':_0x10736f['journeyId']};}catch(_0x5f530c){const _0x389793=isHttp400Error(_0x5f530c),_0x56c050=_0x389793?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x5be41a=getErrorMessage(_0x5f530c);throw new SDKError(_0x56c050,_0x2803bb(0x164)+(_0x1eb578[_0x2803bb(0x128)]?_0x2803bb(0x145):'update')+_0x2803bb(0x1e5)+_0x1eb578[_0x2803bb(0x1ef)]+_0x2803bb(0x12a)+_0x5be41a,_0x5f530c);}}));_0x4706ed[_0x24cac9(0x1cb)][_0x24cac9(0x1b5)](..._0x67a3f8);}return _0x4706ed;}async function matchExistingJourneySegments(_0x5a53ed,_0xce1176,_0x3d5624,_0x16fdd7,_0xd5c3a){const _0x55c9c6=a152_0x4bbc;if(!_0xce1176['existingJourney']||!_0xce1176[_0x55c9c6(0x1a1)][_0x55c9c6(0x134)])return;const _0x33c48e=new Map(),_0x417223=new Set();for(const _0x2958f1 of Object[_0x55c9c6(0x1b3)](_0xce1176[_0x55c9c6(0x1a1)][_0x55c9c6(0x134)])){const _0x19eb26=generateDeterministicJourneySegmentName(_0xce1176[_0x55c9c6(0x1a1)][_0x55c9c6(0x1da)],_0x2958f1);_0x33c48e['set'](_0x19eb26,_0x2958f1),_0x417223[_0x55c9c6(0x12c)](_0x2958f1);}const _0x495f00=[],_0x524dcd=collectSegmentIdsFromJourneyApi(_0xce1176[_0x55c9c6(0x127)]);for(const _0x569f86 of _0x524dcd){const _0x18b0fe=await fetchSegment(_0x5a53ed,_0x3d5624,_0x569f86,_0x16fdd7);if(!_0x18b0fe?.[_0x55c9c6(0x1da)])continue;const _0x32e1bf=_0x33c48e[_0x55c9c6(0x138)](_0x18b0fe[_0x55c9c6(0x1da)]);_0x32e1bf?(_0xd5c3a['set'](_0x32e1bf,_0x569f86),_0x417223['delete'](_0x32e1bf)):_0x495f00[_0x55c9c6(0x1b5)]({'id':_0x569f86,'seg':_0x18b0fe});}if(_0x417223[_0x55c9c6(0x156)]>0x0&&_0x495f00['length']>0x0){const {localExpandedRuleToNames:_0x35222c}=buildLocalExpandedRuleMappings(_0xce1176[_0x55c9c6(0x1a1)]),_0x544a13=new Map();for(const {id:_0x9b6ff8,seg:_0x1e7d1b}of _0x495f00){if(_0x1e7d1b['rule']){const _0x114efa=apiRuleToYaml(_0x1e7d1b['rule']);_0x544a13[_0x55c9c6(0x18f)](_0x9b6ff8,_0x114efa);}}for(const {id:_0x27784c,seg:_0x9f9d50}of _0x495f00){if(!_0x9f9d50[_0x55c9c6(0x1ec)])continue;const _0x22903f=_0x544a13[_0x55c9c6(0x138)](_0x27784c);if(!_0x22903f)continue;const _0x25a82f=serializeExpandedRule(_0x22903f,_0x544a13),_0x45f975=_0x35222c[_0x55c9c6(0x138)](_0x25a82f);if(_0x45f975){const _0x518de4=_0x45f975['find'](_0x472b68=>_0x417223[_0x55c9c6(0x1ad)](_0x472b68));_0x518de4&&(_0xd5c3a[_0x55c9c6(0x18f)](_0x518de4,_0x27784c),_0x417223['delete'](_0x518de4),logger[_0x55c9c6(0x119)](_0x55c9c6(0x1ce)+_0x9f9d50[_0x55c9c6(0x1da)]+'\x27\x20to\x20local\x20\x27'+_0x518de4+_0x55c9c6(0x1c3)));}}}}async function executeSingleJourneyPush(_0x1ac246,_0x43a1ab,_0x18c69d,_0x13192f,_0x35b3b1,_0x3cb95f){const _0xc5e80f=a152_0x4bbc,{journeyDefToRequest:_0x25468a,activationDefToCreateRequest:_0x106de3,yamlRuleToApi:_0x51873b,validateSegmentRule:_0x10b2d8}=_0x3cb95f,_0x88b05c=new Map(),_0x393493=new Map();recoverSegmentIdsFromPushRecovery(_0x43a1ab,_0x88b05c,_0x18c69d['segmentNameToId']);const _0x30b33a=new Map(),_0x2d18b0=new Map(),_0x424e0a=new Map();let _0x554034;const _0x584f98=async()=>{const _0x18d474=a152_0x4bbc;if(_0x554034)return;_0x554034=new Map();if(!_0x43a1ab['existingJourney'])return;const _0x4c5bf7=await _0x1ac246[_0x18d474(0x160)][_0x18d474(0x17a)](_0x43a1ab['existingJourney']['id']);for(const _0x47b4ff of _0x4c5bf7){const _0x481410=journeyActivationStepToYaml(_0x47b4ff,_0x18c69d[_0x18d474(0x180)],_0x18c69d[_0x18d474(0x186)]),_0x3c54ca=activationSignature(_0x481410);!_0x554034[_0x18d474(0x1ad)](_0x3c54ca)&&_0x554034[_0x18d474(0x18f)](_0x3c54ca,_0x47b4ff['id']),_0x481410[_0x18d474(0x1da)]&&_0x393493['set'](_0x481410[_0x18d474(0x1da)],_0x47b4ff['id']);}};await matchExistingJourneySegments(_0x1ac246,_0x43a1ab,_0x13192f['parentId'],_0x18c69d['existingSegments'],_0x18c69d['segmentNameToId']);const _0x4cdbb6={'resolveSegmentId':async _0x6f8f6e=>{const _0x1ad5f5=a152_0x4bbc,_0x1da3be=_0x18c69d['segmentNameToId'][_0x1ad5f5(0x138)](_0x6f8f6e);if(!_0x1da3be)throw new SDKError(ErrorCode[_0x1ad5f5(0x170)],_0x1ad5f5(0x16f)+_0x6f8f6e+_0x1ad5f5(0x120)+_0x43a1ab[_0x1ad5f5(0x1a1)][_0x1ad5f5(0x1da)]+')');return _0x1da3be;},'resolveEmbeddedSegmentId':async(_0x268dac,_0x5b6991)=>{const _0x3bbc18=a152_0x4bbc,_0x20cbe9=_0x18c69d[_0x3bbc18(0x14d)][_0x3bbc18(0x138)](_0x268dac);if(_0x20cbe9)return _0x20cbe9;const _0x3f24cb=_0x18c69d[_0x3bbc18(0x122)][_0x3bbc18(0x1a3)](_0x33caae=>_0x33caae[_0x3bbc18(0x1da)]===_0x268dac);if(_0x3f24cb)return _0x18c69d['segmentNameToId'][_0x3bbc18(0x18f)](_0x268dac,_0x3f24cb['id']),_0x3f24cb['id'];if(_0x43a1ab[_0x3bbc18(0x128)]){const {stageName:_0x1769ef,criteriaName:_0x3402e4}=findSegmentCriteriaLocation(_0x43a1ab['yamlConfig'],_0x268dac);return _0x10b2d8(_0x268dac,_0x5b6991[_0x3bbc18(0x1ec)]),_0x2d18b0[_0x3bbc18(0x18f)](_0x268dac,{'definition':_0x5b6991,'stageName':_0x1769ef,'criteriaName':_0x3402e4}),createPendingSegmentId(_0x268dac);}const _0x15041b=_0x43a1ab['existingJourney']?.['id'];if(!_0x15041b)throw new SDKError(ErrorCode[_0x3bbc18(0x11d)],_0x3bbc18(0x1e7));const _0x28071e=_0x30b33a['get'](_0x268dac);if(_0x28071e)return _0x28071e;const _0x4381f9=((async()=>{const _0x48d61f=_0x3bbc18;_0x10b2d8(_0x268dac,_0x5b6991[_0x48d61f(0x1ec)]);const _0x449e9f=generateDeterministicJourneySegmentName(_0x43a1ab[_0x48d61f(0x1a1)]['name'],_0x268dac),_0x11ec73=_0x18c69d['existingSegments'][_0x48d61f(0x1a3)](_0x5b6706=>_0x5b6706[_0x48d61f(0x1da)]===_0x449e9f),_0x2b3d19=createSegmentIdResolver(_0x18c69d[_0x48d61f(0x14d)],_0x268dac),_0x202849=await resolveRuleSegmentIds(_0x5b6991[_0x48d61f(0x1ec)],_0x2b3d19);let _0x49860f;return _0x11ec73?(await _0x1ac246[_0x48d61f(0x161)][_0x48d61f(0x1f0)](_0x13192f['parentId'],_0x11ec73['id'],{'description':_0x5b6991[_0x48d61f(0x19f)]||_0x48d61f(0x132)+_0x268dac,'rule':_0x51873b(_0x202849,!![]),'countPopulation':!![]}),_0x49860f=_0x11ec73['id'],saveSegmentToPushRecovery(_0x43a1ab[_0x48d61f(0x1ef)],_0x43a1ab[_0x48d61f(0x1a1)][_0x48d61f(0x1da)],_0x268dac,{'segmentId':_0x49860f,'uniqueServerName':_0x449e9f,'createdAt':new Date()[_0x48d61f(0x191)]()})):_0x49860f=await createOrRecoverEmbeddedSegment(_0x1ac246,_0x43a1ab,{'localName':_0x268dac,'uniqueSegmentName':_0x449e9f,'description':_0x5b6991[_0x48d61f(0x19f)]||_0x48d61f(0x132)+_0x268dac,'journeyId':_0x15041b,'resolvedRule':_0x202849,'parentId':_0x13192f[_0x48d61f(0x17c)],'folderId':_0x13192f['rootFolderId']||''},_0x51873b),_0x18c69d[_0x48d61f(0x14d)][_0x48d61f(0x18f)](_0x268dac,_0x49860f),_0x88b05c[_0x48d61f(0x18f)](_0x268dac,_0x49860f),_0x49860f;})());_0x30b33a[_0x3bbc18(0x18f)](_0x268dac,_0x4381f9);try{return await _0x4381f9;}finally{_0x30b33a[_0x3bbc18(0x144)](_0x268dac);}},'resolveActivationId':async _0x46316f=>{const _0x5d52e9=a152_0x4bbc,_0x5e8cde=_0x393493[_0x5d52e9(0x138)](_0x46316f);if(_0x5e8cde)return _0x5e8cde;if(_0x43a1ab[_0x5d52e9(0x127)]){await _0x584f98();const _0x302fb3=_0x393493[_0x5d52e9(0x138)](_0x46316f);if(_0x302fb3)return _0x302fb3;}throw new SDKError(ErrorCode['NOT_FOUND'],_0x5d52e9(0x198)+_0x46316f+_0x5d52e9(0x120)+_0x43a1ab[_0x5d52e9(0x1a1)][_0x5d52e9(0x1da)]+_0x5d52e9(0x1e6)+_0x5d52e9(0x151));},'resolveEmbeddedActivationId':async(_0x110804,_0x2da819)=>{const _0x10a47a=a152_0x4bbc,_0x3f19d5=_0x393493[_0x10a47a(0x138)](_0x110804);if(_0x3f19d5)return _0x3f19d5;if(_0x43a1ab['isNew'])return _0x424e0a['set'](_0x110804,_0x2da819),createPendingActivationId(_0x110804);if(_0x43a1ab[_0x10a47a(0x127)]){await _0x584f98();const _0x1a1b79=_0x393493[_0x10a47a(0x138)](_0x2da819[_0x10a47a(0x1da)]);if(_0x1a1b79)return _0x393493[_0x10a47a(0x18f)](_0x110804,_0x1a1b79),_0x1a1b79;const _0x139b60=activationSignature(_0x2da819),_0x27e967=_0x554034?.[_0x10a47a(0x138)](_0x139b60);if(_0x27e967)return _0x393493[_0x10a47a(0x18f)](_0x110804,_0x27e967),_0x27e967;const _0x3a216d=await _0x106de3(_0x2da819,_0x18c69d[_0x10a47a(0x1a5)]),_0x2bfbc7={..._0x3a216d,..._0x2da819[_0x10a47a(0x1d8)]!==undefined&&{'runAfterJourneyRefresh':_0x2da819[_0x10a47a(0x1d8)]}},_0x442194=await _0x1ac246[_0x10a47a(0x160)][_0x10a47a(0x11e)](_0x43a1ab[_0x10a47a(0x127)]['id'],_0x2bfbc7);return _0x393493[_0x10a47a(0x18f)](_0x110804,_0x442194['id']),_0x442194['id'];}throw new SDKError(ErrorCode[_0x10a47a(0x11d)],_0x10a47a(0x14a));},'resolveJourneyId':async _0x44b05c=>{const _0xf196c9=a152_0x4bbc;try{return await _0x1ac246[_0xf196c9(0x160)][_0xf196c9(0x148)](_0x13192f[_0xf196c9(0x17c)],_0x44b05c);}catch(_0x4c0f09){throw new SDKError(ErrorCode['NOT_FOUND'],'Journey\x20\x27'+_0x44b05c+_0xf196c9(0x150)+_0x43a1ab['yamlConfig'][_0xf196c9(0x1da)]+'\x27)',_0x4c0f09);}},'resolveStageId':async(_0xa06587,_0x4e8443)=>{const _0x10684d=a152_0x4bbc,_0x105001=await _0x1ac246[_0x10684d(0x160)]['getJourney'](_0xa06587),_0x27b088=_0x105001['attributes'][_0x10684d(0x167)][_0x10684d(0x1a3)](_0x476759=>_0x476759[_0x10684d(0x1da)][_0x10684d(0x11a)]()===_0x4e8443['toLowerCase']());if(!_0x27b088?.['id'])throw new SDKError(ErrorCode[_0x10684d(0x14f)],_0x10684d(0x10f)+_0x4e8443+_0x10684d(0x137)+(_0x105001[_0x10684d(0xf6)]['journeyBundleName']||_0x105001['attributes'][_0x10684d(0x1da)])+'\x27');return _0x27b088['id'];}},_0x20b76e=await _0x25468a(_0x43a1ab[_0xc5e80f(0x1a1)],_0x13192f['parentId'],_0x4cdbb6),_0x560f9a=_0x13192f[_0xc5e80f(0x157)]||_0x13192f[_0xc5e80f(0xfe)];_0x560f9a&&(_0x20b76e[_0xc5e80f(0x1b7)]={'parentFolder':{'data':{'id':_0x560f9a,'type':_0xc5e80f(0x18d)}}});if(_0x43a1ab[_0xc5e80f(0x128)]){if(_0x2d18b0[_0xc5e80f(0x156)]>0x0||_0x424e0a[_0xc5e80f(0x156)]>0x0)return await executeThreeStepJourneyCreate(_0x1ac246,_0x43a1ab,_0x20b76e,{'pendingEmbeddedSegments':_0x2d18b0,'pendingEmbeddedActivations':_0x424e0a,'embeddedSegmentNameToId':_0x88b05c,'journeyActivationNameToId':_0x393493},{..._0x13192f,'effectiveFolderId':_0x560f9a},_0x18c69d,_0x35b3b1,_0x3cb95f);else{ensureJourneyDefaults(_0x20b76e[_0xc5e80f(0xf6)]);const _0x38007a=await _0x1ac246[_0xc5e80f(0x160)][_0xc5e80f(0x145)](_0x20b76e);return deletePushRecovery(_0x43a1ab['absolutePath']),{'action':_0xc5e80f(0xf5),'journeyId':_0x38007a['id'],'embeddedSegmentNameToId':_0x88b05c};}}else{if(_0x43a1ab[_0xc5e80f(0x1e8)]&&_0x43a1ab['existingJourney']){_0x20b76e['id']=_0x43a1ab['existingJourney']['id'];const _0x41a681=_0x20b76e[_0xc5e80f(0xf6)];_0x43a1ab[_0xc5e80f(0x127)][_0xc5e80f(0xf6)]?.[_0xc5e80f(0x1e9)]&&(_0x41a681[_0xc5e80f(0x1e9)]=_0x43a1ab[_0xc5e80f(0x127)][_0xc5e80f(0xf6)][_0xc5e80f(0x1e9)]);const _0x4059e5=_0x43a1ab[_0xc5e80f(0x127)][_0xc5e80f(0xf6)]?.[_0xc5e80f(0x167)];return _0x4059e5&&_0x20b76e[_0xc5e80f(0xf6)][_0xc5e80f(0x167)]&&injectExistingStageIds(_0x20b76e[_0xc5e80f(0xf6)]['journeyStages'],_0x4059e5),ensureJourneyDefaults(_0x41a681),await _0x1ac246[_0xc5e80f(0x160)][_0xc5e80f(0x142)](_0x43a1ab[_0xc5e80f(0x127)]['id'],_0x20b76e),deletePushRecovery(_0x43a1ab['absolutePath']),{'action':'updated','journeyId':_0x43a1ab[_0xc5e80f(0x127)]['id'],'embeddedSegmentNameToId':_0x88b05c};}}return deletePushRecovery(_0x43a1ab[_0xc5e80f(0x1ef)]),{'action':_0xc5e80f(0x14b),'journeyId':_0x43a1ab[_0xc5e80f(0x127)]?.['id'],'embeddedSegmentNameToId':_0x88b05c};}function findSegmentCriteriaLocation(_0x4bc60d,_0x35b552){const _0x378cf4=a152_0x4bbc,_0x5ada35=_0x4bc60d[_0x378cf4(0x1d7)]||_0x4bc60d[_0x378cf4(0x10d)]?.[0x0]?.[_0x378cf4(0x1d7)]||[];let _0x5c240e='entry',_0x46c54e=_0x35b552;const _0x45b6c5=_0x4bc60d[_0x378cf4(0x181)]||_0x4bc60d['journeys']?.[0x0]?.[_0x378cf4(0x181)];if(_0x45b6c5?.['segment']===_0x35b552)return{'stageName':'goal','criteriaName':_0x45b6c5[_0x378cf4(0x1da)]||_0x35b552};_0x1d003d:for(const _0x3d9351 of _0x5ada35){if(_0x3d9351[_0x378cf4(0x1c8)]?.[_0x378cf4(0x161)]===_0x35b552){_0x5c240e=_0x3d9351['name'],_0x46c54e=_0x3d9351[_0x378cf4(0x1c8)]['name']||_0x35b552;break;}if(_0x3d9351[_0x378cf4(0x1b1)])for(const _0x4ee550 of _0x3d9351['steps']){if(_0x4ee550['type']===_0x378cf4(0x1d5)&&_0x4ee550[_0x378cf4(0x18e)]?.[_0x378cf4(0x195)])for(const _0x48a613 of _0x4ee550['with'][_0x378cf4(0x195)]){if(_0x48a613[_0x378cf4(0x161)]===_0x35b552){_0x5c240e=_0x3d9351['name'],_0x46c54e=_0x48a613[_0x378cf4(0x1da)]||_0x35b552;break _0x1d003d;}}}}return{'stageName':_0x5c240e,'criteriaName':_0x46c54e};}async function executeThreeStepJourneyCreate(_0x576d30,_0x1edc6a,_0x55811b,_0x43a69f,_0x313c8a,_0x2900d3,_0x4f8377,_0x506bfd){const _0x9e3141=a152_0x4bbc,{activationDefToCreateRequest:_0x3d2f0c,yamlRuleToApi:_0x1fd8c0}=_0x506bfd,{pendingEmbeddedSegments:_0x304c4b,pendingEmbeddedActivations:_0x53e345,embeddedSegmentNameToId:_0x325bab}=_0x43a69f,_0x5d7d76=JSON[_0x9e3141(0x109)](JSON[_0x9e3141(0x172)](_0x55811b));ensureJourneyDefaults(_0x5d7d76[_0x9e3141(0xf6)]),stripPendingIds(_0x5d7d76);const _0x38d151=await _0x576d30['journey'][_0x9e3141(0x145)](_0x5d7d76),_0x3ce49e=_0x38d151['id'],_0x4ac3f8=new Map();for(const _0x5e6496 of _0x38d151[_0x9e3141(0xf6)][_0x9e3141(0x167)]){_0x4ac3f8['set'](_0x5e6496[_0x9e3141(0x1da)][_0x9e3141(0x11a)](),_0x5e6496['id']);}recoverSegmentIdsFromPushRecovery(_0x1edc6a,_0x325bab,_0x2900d3[_0x9e3141(0x14d)]);for(const [_0xeef6f8,{definition:_0xd74fe5}]of _0x304c4b){if(_0x325bab[_0x9e3141(0x1ad)](_0xeef6f8)){_0x4f8377['onProgress']?.({'type':_0x9e3141(0x1d0),'journeyName':_0x1edc6a[_0x9e3141(0x1a1)][_0x9e3141(0x1da)],'segmentName':_0xeef6f8});continue;}const _0x51eeec=generateDeterministicJourneySegmentName(_0x1edc6a[_0x9e3141(0x1a1)]['name'],_0xeef6f8);_0x4f8377['onProgress']?.({'type':'embedded_segment_creating','journeyName':_0x1edc6a['yamlConfig'][_0x9e3141(0x1da)],'segmentName':_0xeef6f8});const _0x10e18c=createSegmentIdResolver(_0x2900d3['segmentNameToId'],_0xeef6f8),_0x4123a4=await resolveRuleSegmentIds(_0xd74fe5[_0x9e3141(0x1ec)],_0x10e18c),_0x45e8c5=await createOrRecoverEmbeddedSegment(_0x576d30,_0x1edc6a,{'localName':_0xeef6f8,'uniqueSegmentName':_0x51eeec,'description':_0xd74fe5[_0x9e3141(0x19f)]||_0x9e3141(0x132)+_0xeef6f8,'journeyId':_0x3ce49e,'resolvedRule':_0x4123a4,'parentId':_0x313c8a[_0x9e3141(0x17c)],'folderId':_0x313c8a['effectiveFolderId']||''},_0x1fd8c0);_0x325bab[_0x9e3141(0x18f)](_0xeef6f8,_0x45e8c5),_0x2900d3['segmentNameToId'][_0x9e3141(0x18f)](_0xeef6f8,_0x45e8c5),_0x4f8377[_0x9e3141(0x10a)]?.({'type':_0x9e3141(0x1d0),'journeyName':_0x1edc6a[_0x9e3141(0x1a1)][_0x9e3141(0x1da)],'segmentName':_0xeef6f8});}const _0x3f356e=new Map();for(const [_0x1fc100,_0x32d4a4]of _0x53e345){_0x4f8377[_0x9e3141(0x10a)]?.({'type':_0x9e3141(0x12b),'journeyName':_0x1edc6a[_0x9e3141(0x1a1)][_0x9e3141(0x1da)],'activationName':_0x1fc100});const _0x3b5b3b=await _0x3d2f0c(_0x32d4a4,_0x2900d3[_0x9e3141(0x1a5)]),_0x3730f9={..._0x3b5b3b,..._0x32d4a4[_0x9e3141(0x1d8)]!==undefined&&{'runAfterJourneyRefresh':_0x32d4a4['run_after_journey_refresh']}},_0x447ab1=await _0x576d30[_0x9e3141(0x160)]['createActivation'](_0x3ce49e,_0x3730f9);_0x3f356e[_0x9e3141(0x18f)](_0x1fc100,_0x447ab1['id']),_0x43a69f['journeyActivationNameToId'][_0x9e3141(0x18f)](_0x1fc100,_0x447ab1['id']),_0x4f8377[_0x9e3141(0x10a)]?.({'type':'embedded_activation_created','journeyName':_0x1edc6a[_0x9e3141(0x1a1)][_0x9e3141(0x1da)],'activationName':_0x1fc100});}const _0x1ac8e5=JSON[_0x9e3141(0x109)](JSON[_0x9e3141(0x172)](_0x55811b));return _0x1ac8e5['id']=_0x3ce49e,ensureJourneyDefaults(_0x1ac8e5[_0x9e3141(0xf6)]),resolvePendingIdsInRequest(_0x1ac8e5,_0x55811b,_0x4ac3f8,_0x325bab,_0x3f356e,_0x4f8377),await _0x576d30[_0x9e3141(0x160)][_0x9e3141(0x142)](_0x3ce49e,_0x1ac8e5),deletePushRecovery(_0x1edc6a[_0x9e3141(0x1ef)]),{'action':_0x9e3141(0xf5),'journeyId':_0x3ce49e,'embeddedSegmentNameToId':_0x325bab};}export function stripWaitStepPendingIds(_0x582586){const _0x141379=a152_0x4bbc,_0x2822c2=_0x582586[_0x141379(0x16b)]&&isPendingSegmentId(_0x582586[_0x141379(0x16b)]),_0x27e8f8=_0x582586[_0x141379(0x1d6)]?.[_0x141379(0x105)](_0xec7571=>_0xec7571[_0x141379(0x179)]&&isPendingSegmentId(_0xec7571[_0x141379(0x179)]));(_0x2822c2||_0x27e8f8)&&(_0x582586[_0x141379(0x13b)]=_0x141379(0x189),_0x582586[_0x141379(0x15a)]=0x1,_0x582586[_0x141379(0x12e)]='day',delete _0x582586[_0x141379(0x16b)],delete _0x582586[_0x141379(0x130)],delete _0x582586[_0x141379(0x1df)],delete _0x582586['conditions']);}export function resolveWaitStepPendingIds(_0x367411,_0x4933af,_0x290578,_0x5c12a2){const _0x2dea22=a152_0x4bbc;if(_0x4933af[_0x2dea22(0x16b)]&&isPendingSegmentId(_0x4933af['conditionSegmentId'])){const _0x3a82d6=_0x290578(_0x4933af['conditionSegmentId'],_0x2dea22(0x1c9)+_0x5c12a2+'\x27\x20wait\x20condition');_0x3a82d6&&(_0x367411[_0x2dea22(0x13b)]=_0x2dea22(0x194),_0x367411[_0x2dea22(0x16b)]=_0x3a82d6,delete _0x367411[_0x2dea22(0x15a)],delete _0x367411['waitStepUnit'],_0x4933af['conditionTimeoutDuration']!==undefined&&(_0x367411['conditionTimeoutDuration']=_0x4933af[_0x2dea22(0x130)]),_0x4933af[_0x2dea22(0x1df)]&&(_0x367411[_0x2dea22(0x1df)]=_0x4933af[_0x2dea22(0x1df)]));}if(_0x4933af[_0x2dea22(0x1d6)]){const _0x3e0e52=_0x4933af['conditions'][_0x2dea22(0x105)](_0x4b970b=>_0x4b970b[_0x2dea22(0x179)]&&isPendingSegmentId(_0x4b970b[_0x2dea22(0x179)]));if(_0x3e0e52){const _0x3ce1eb=_0x4933af['conditions']['map'](_0x5f0cd9=>{const _0xd697d3=_0x2dea22;if(_0x5f0cd9[_0xd697d3(0x179)]&&isPendingSegmentId(_0x5f0cd9[_0xd697d3(0x179)])){const _0x14ea7f=_0x290578(_0x5f0cd9[_0xd697d3(0x179)],'stage\x20\x27'+_0x5c12a2+'\x27\x20wait\x20condition');return{..._0x5f0cd9,'segmentId':_0x14ea7f||_0x5f0cd9[_0xd697d3(0x179)]};}return{..._0x5f0cd9};});_0x367411[_0x2dea22(0x13b)]='Condition',_0x367411[_0x2dea22(0x1d6)]=_0x3ce1eb,delete _0x367411[_0x2dea22(0x15a)],delete _0x367411[_0x2dea22(0x12e)],delete _0x367411[_0x2dea22(0x16b)],delete _0x367411[_0x2dea22(0x130)],delete _0x367411[_0x2dea22(0x1df)];}}}function stripPendingIds(_0x14331e){const _0x2491ca=a152_0x4bbc;_0x14331e['attributes'][_0x2491ca(0x181)]?.[_0x2491ca(0x179)]&&isPendingSegmentId(_0x14331e[_0x2491ca(0xf6)][_0x2491ca(0x181)][_0x2491ca(0x179)])&&delete _0x14331e[_0x2491ca(0xf6)]['goal'];for(const _0x5466bc of _0x14331e[_0x2491ca(0xf6)][_0x2491ca(0x167)]||[]){_0x5466bc[_0x2491ca(0x1d3)]?.[_0x2491ca(0x179)]&&isPendingSegmentId(_0x5466bc['entryCriteria'][_0x2491ca(0x179)])&&delete _0x5466bc[_0x2491ca(0x1d3)];_0x5466bc['milestone']?.[_0x2491ca(0x179)]&&isPendingSegmentId(_0x5466bc[_0x2491ca(0xfd)][_0x2491ca(0x179)])&&delete _0x5466bc[_0x2491ca(0xfd)];_0x5466bc[_0x2491ca(0x147)]&&(_0x5466bc[_0x2491ca(0x147)]=_0x5466bc[_0x2491ca(0x147)][_0x2491ca(0x110)](_0x50cbea=>!_0x50cbea['segmentId']||!isPendingSegmentId(_0x50cbea['segmentId'])));if(_0x5466bc[_0x2491ca(0x1b1)])for(const _0x23b650 of Object[_0x2491ca(0x1b3)](_0x5466bc[_0x2491ca(0x1b1)])){const _0x1592f3=_0x5466bc[_0x2491ca(0x1b1)][_0x23b650];_0x1592f3['type']==='Activation'&&_0x1592f3[_0x2491ca(0x15e)]&&isPendingActivationId(_0x1592f3[_0x2491ca(0x15e)])&&(_0x1592f3[_0x2491ca(0x15e)]='');if(_0x1592f3[_0x2491ca(0xf9)]===_0x2491ca(0x102)&&_0x1592f3[_0x2491ca(0x195)])for(const _0x58ce1e of _0x1592f3[_0x2491ca(0x195)]){_0x58ce1e[_0x2491ca(0x179)]&&isPendingSegmentId(_0x58ce1e[_0x2491ca(0x179)])&&(_0x58ce1e['segmentId']='');}_0x1592f3[_0x2491ca(0xf9)]==='WaitStep'&&stripWaitStepPendingIds(_0x1592f3);}}}function resolvePendingIdsInRequest(_0x1cd088,_0xa951e2,_0x38a662,_0x1abdaf,_0x7d2ce,_0x9a52fd){const _0x45ba8f=a152_0x4bbc,_0x49c8c1=(_0x563fee,_0x10125b)=>{const _0x33a823=a152_0x4bbc;if(!isPendingSegmentId(_0x563fee))return _0x563fee;const _0x14b042=extractPendingSegmentName(_0x563fee),_0x43aa20=_0x1abdaf[_0x33a823(0x138)](_0x14b042);return!_0x43aa20&&_0x9a52fd[_0x33a823(0x1e2)]?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x14b042+_0x33a823(0x1ae)+_0x10125b),_0x43aa20;};if(_0x1cd088[_0x45ba8f(0xf6)][_0x45ba8f(0x181)]?.[_0x45ba8f(0x179)]&&isPendingSegmentId(_0x1cd088[_0x45ba8f(0xf6)]['goal'][_0x45ba8f(0x179)])){const _0x2b340e=_0x49c8c1(_0x1cd088[_0x45ba8f(0xf6)][_0x45ba8f(0x181)][_0x45ba8f(0x179)],_0x45ba8f(0x163));_0x2b340e&&(_0x1cd088[_0x45ba8f(0xf6)][_0x45ba8f(0x181)][_0x45ba8f(0x179)]=_0x2b340e);}for(const _0x16de02 of _0x1cd088[_0x45ba8f(0xf6)][_0x45ba8f(0x167)]||[]){const _0x4ecf1e=_0x38a662[_0x45ba8f(0x138)](_0x16de02[_0x45ba8f(0x1da)]['toLowerCase']());_0x4ecf1e&&(_0x16de02['id']=_0x4ecf1e);if(_0x16de02[_0x45ba8f(0x1d3)]?.[_0x45ba8f(0x179)]&&isPendingSegmentId(_0x16de02[_0x45ba8f(0x1d3)][_0x45ba8f(0x179)])){const _0x46418f=_0x49c8c1(_0x16de02[_0x45ba8f(0x1d3)]['segmentId'],_0x45ba8f(0x1c9)+_0x16de02['name']+_0x45ba8f(0x18b));_0x46418f&&(_0x16de02['entryCriteria']['segmentId']=_0x46418f);}if(_0x16de02[_0x45ba8f(0x147)])for(const _0x289125 of _0x16de02[_0x45ba8f(0x147)]){if(_0x289125[_0x45ba8f(0x179)]&&isPendingSegmentId(_0x289125[_0x45ba8f(0x179)])){const _0x47c82e=_0x49c8c1(_0x289125[_0x45ba8f(0x179)],_0x45ba8f(0x1c9)+_0x16de02['name']+_0x45ba8f(0xfc));_0x47c82e&&(_0x289125['segmentId']=_0x47c82e);}}if(_0x16de02[_0x45ba8f(0xfd)]?.['segmentId']&&isPendingSegmentId(_0x16de02[_0x45ba8f(0xfd)]['segmentId'])){const _0x1afb2f=_0x49c8c1(_0x16de02[_0x45ba8f(0xfd)][_0x45ba8f(0x179)],_0x45ba8f(0x1c9)+_0x16de02[_0x45ba8f(0x1da)]+'\x27\x20milestone');_0x1afb2f&&(_0x16de02[_0x45ba8f(0xfd)][_0x45ba8f(0x179)]=_0x1afb2f);}if(_0x16de02[_0x45ba8f(0x1b1)]){const _0x48603b=_0x29891b=>_0xa951e2[_0x45ba8f(0xf6)]['journeyStages']?.[_0x45ba8f(0x1a3)](_0x34e537=>_0x34e537['name']['toLowerCase']()===_0x16de02[_0x45ba8f(0x1da)][_0x45ba8f(0x11a)]())?.[_0x45ba8f(0x1b1)]?.[_0x29891b];for(const _0x263c9d of Object['keys'](_0x16de02[_0x45ba8f(0x1b1)])){const _0x281be5=_0x16de02['steps'][_0x263c9d],_0x50ba6a=_0x48603b(_0x263c9d);if(_0x281be5[_0x45ba8f(0xf9)]===_0x45ba8f(0x149)&&_0x281be5[_0x45ba8f(0x15e)]&&(isPendingActivationId(_0x281be5[_0x45ba8f(0x15e)])||_0x281be5['journeyActivationStepId']==='')){if(_0x50ba6a?.[_0x45ba8f(0x15e)]&&isPendingActivationId(_0x50ba6a[_0x45ba8f(0x15e)])){const _0x1dafac=extractPendingActivationName(_0x50ba6a[_0x45ba8f(0x15e)]),_0x16eab4=_0x7d2ce[_0x45ba8f(0x138)](_0x1dafac);_0x16eab4&&(_0x281be5[_0x45ba8f(0x15e)]=_0x16eab4);}}if(_0x281be5[_0x45ba8f(0xf9)]===_0x45ba8f(0x102)&&_0x281be5[_0x45ba8f(0x195)]&&_0x50ba6a?.[_0x45ba8f(0x195)])for(let _0x4940ec=0x0;_0x4940ec<_0x281be5['branches'][_0x45ba8f(0x175)];_0x4940ec++){const _0x439b73=_0x281be5[_0x45ba8f(0x195)][_0x4940ec],_0x107551=_0x50ba6a[_0x45ba8f(0x195)][_0x4940ec];if(_0x107551?.[_0x45ba8f(0x179)]&&isPendingSegmentId(_0x107551['segmentId'])){const _0x3014b9=_0x49c8c1(_0x107551[_0x45ba8f(0x179)],_0x45ba8f(0x1c9)+_0x16de02[_0x45ba8f(0x1da)]+_0x45ba8f(0x165)+(_0x439b73[_0x45ba8f(0x1da)]||_0x4940ec)+'\x27');_0x3014b9&&(_0x439b73['segmentId']=_0x3014b9);}}_0x281be5['type']==='WaitStep'&&_0x50ba6a?.['type']===_0x45ba8f(0x18c)&&resolveWaitStepPendingIds(_0x281be5,_0x50ba6a,_0x49c8c1,_0x16de02[_0x45ba8f(0x1da)]);}}}}
@@ -1 +1 @@
1
- (function(_0x46fee9,_0x907be6){const _0xd1b4ad=a152_0x3586,_0x147929=_0x46fee9();while(!![]){try{const _0x3b91b1=parseInt(_0xd1b4ad(0x134))/0x1+parseInt(_0xd1b4ad(0x131))/0x2+parseInt(_0xd1b4ad(0x13f))/0x3*(parseInt(_0xd1b4ad(0x13e))/0x4)+parseInt(_0xd1b4ad(0x13a))/0x5+-parseInt(_0xd1b4ad(0x132))/0x6*(-parseInt(_0xd1b4ad(0x13d))/0x7)+-parseInt(_0xd1b4ad(0x140))/0x8*(-parseInt(_0xd1b4ad(0x136))/0x9)+-parseInt(_0xd1b4ad(0x139))/0xa;if(_0x3b91b1===_0x907be6)break;else _0x147929['push'](_0x147929['shift']());}catch(_0x993a3e){_0x147929['push'](_0x147929['shift']());}}}(a152_0x4cef,0x75fcd));export function buildFolderIdToPathMap(_0x15aa6b){const _0x48e9ed=a152_0x3586,_0x302e77=new Map(),_0x47907d=new Map();for(const _0x2ac171 of _0x15aa6b){_0x47907d['set'](_0x2ac171['id'],_0x2ac171);}const _0x30bd0d=new Set();for(const _0x5da120 of _0x15aa6b){!_0x5da120[_0x48e9ed(0x13c)]&&_0x30bd0d[_0x48e9ed(0x133)](_0x5da120['id']);}function _0x5c65aa(_0x155eb3){const _0x362152=_0x48e9ed;if(_0x302e77[_0x362152(0x13b)](_0x155eb3['id']))return _0x302e77[_0x362152(0x137)](_0x155eb3['id']);if(_0x30bd0d['has'](_0x155eb3['id']))return _0x302e77[_0x362152(0x135)](_0x155eb3['id'],''),'';if(_0x155eb3[_0x362152(0x13c)]){const _0xa1fb6f=_0x47907d['get'](_0x155eb3['parentFolderId']);if(_0xa1fb6f){const _0x1b4b58=_0x5c65aa(_0xa1fb6f),_0x5e4306=_0x1b4b58?_0x1b4b58+'/'+_0x155eb3[_0x362152(0x138)]:_0x155eb3[_0x362152(0x138)];return _0x302e77[_0x362152(0x135)](_0x155eb3['id'],_0x5e4306),_0x5e4306;}}const _0x1f8436=_0x155eb3[_0x362152(0x138)];return _0x302e77[_0x362152(0x135)](_0x155eb3['id'],_0x1f8436),_0x1f8436;}for(const _0x410270 of _0x15aa6b){_0x5c65aa(_0x410270);}return _0x302e77;}export function buildFolderPathToIdMap(_0x508552){const _0x319a31=new Map(),_0x12eca9=new Map();for(const _0x1a5e0c of _0x508552){_0x12eca9['set'](_0x1a5e0c['id'],_0x1a5e0c);}const _0x5164ce=new Set();for(const _0xa16ad0 of _0x508552){!_0xa16ad0['parentFolderId']&&_0x5164ce['add'](_0xa16ad0['id']);}function _0x4bfa11(_0x4a249b){const _0x1c74b1=a152_0x3586;if(_0x5164ce[_0x1c74b1(0x13b)](_0x4a249b['id']))return'';if(_0x4a249b[_0x1c74b1(0x13c)]){const _0x1727f0=_0x12eca9['get'](_0x4a249b[_0x1c74b1(0x13c)]);if(_0x1727f0){const _0x27a1df=_0x4bfa11(_0x1727f0);return _0x27a1df?_0x27a1df+'/'+_0x4a249b[_0x1c74b1(0x138)]:_0x4a249b[_0x1c74b1(0x138)];}}return _0x4a249b[_0x1c74b1(0x138)];}for(const _0x15b855 of _0x508552){const _0x409f15=_0x4bfa11(_0x15b855);_0x319a31['set'](_0x409f15,_0x15b855['id']);}return _0x319a31;}function a152_0x3586(_0x31ab5c,_0x4e8c79){_0x31ab5c=_0x31ab5c-0x131;const _0x4cefd3=a152_0x4cef();let _0x35869e=_0x4cefd3[_0x31ab5c];return _0x35869e;}function a152_0x4cef(){const _0x43a2bc=['2457725hxFBzx','has','parentFolderId','2612309tgEZQx','130724yYjwLE','87hRbPnx','8FwVJHj','1521790UwaIXC','12ZiKzkZ','add','412955OhQXjv','set','3636081ZyHIIJ','get','name','32802500zdWhnR'];a152_0x4cef=function(){return _0x43a2bc;};return a152_0x4cef();}export function buildFolderMaps(_0x1f0dd8){const _0x385a84=buildFolderIdToPathMap(_0x1f0dd8),_0x5ed4c3=new Map();for(const [_0x331ebe,_0x185928]of _0x385a84){_0x5ed4c3['set'](_0x185928,_0x331ebe);}return{'idToPath':_0x385a84,'pathToId':_0x5ed4c3};}export function getFolderPath(_0x132b28,_0x21c506){const _0xb369d4=a152_0x3586;if(!_0x132b28)return'';return _0x21c506[_0xb369d4(0x137)](_0x132b28)??'';}
1
+ (function(_0x46ea28,_0x1df305){const _0x88f06e=a153_0x42fc,_0x595ce2=_0x46ea28();while(!![]){try{const _0x24a9a9=parseInt(_0x88f06e(0x147))/0x1*(parseInt(_0x88f06e(0x13e))/0x2)+-parseInt(_0x88f06e(0x145))/0x3+-parseInt(_0x88f06e(0x14c))/0x4*(-parseInt(_0x88f06e(0x14d))/0x5)+parseInt(_0x88f06e(0x140))/0x6*(parseInt(_0x88f06e(0x148))/0x7)+parseInt(_0x88f06e(0x141))/0x8+-parseInt(_0x88f06e(0x14a))/0x9*(-parseInt(_0x88f06e(0x14e))/0xa)+-parseInt(_0x88f06e(0x13f))/0xb;if(_0x24a9a9===_0x1df305)break;else _0x595ce2['push'](_0x595ce2['shift']());}catch(_0x33b7e9){_0x595ce2['push'](_0x595ce2['shift']());}}}(a153_0x1bdf,0x9f23b));export function buildFolderIdToPathMap(_0x49c329){const _0x2f9e91=a153_0x42fc,_0x530a04=new Map(),_0x26d35b=new Map();for(const _0x4ab34d of _0x49c329){_0x26d35b[_0x2f9e91(0x14b)](_0x4ab34d['id'],_0x4ab34d);}const _0x4e585a=new Set();for(const _0xe9650f of _0x49c329){!_0xe9650f[_0x2f9e91(0x149)]&&_0x4e585a[_0x2f9e91(0x144)](_0xe9650f['id']);}function _0x42367e(_0x15c70e){const _0x4b3dc0=_0x2f9e91;if(_0x530a04[_0x4b3dc0(0x142)](_0x15c70e['id']))return _0x530a04[_0x4b3dc0(0x143)](_0x15c70e['id']);if(_0x4e585a[_0x4b3dc0(0x142)](_0x15c70e['id']))return _0x530a04[_0x4b3dc0(0x14b)](_0x15c70e['id'],''),'';if(_0x15c70e[_0x4b3dc0(0x149)]){const _0x537786=_0x26d35b[_0x4b3dc0(0x143)](_0x15c70e[_0x4b3dc0(0x149)]);if(_0x537786){const _0x30b4c0=_0x42367e(_0x537786),_0x1f6b61=_0x30b4c0?_0x30b4c0+'/'+_0x15c70e[_0x4b3dc0(0x146)]:_0x15c70e[_0x4b3dc0(0x146)];return _0x530a04[_0x4b3dc0(0x14b)](_0x15c70e['id'],_0x1f6b61),_0x1f6b61;}}const _0xf1a3f7=_0x15c70e['name'];return _0x530a04[_0x4b3dc0(0x14b)](_0x15c70e['id'],_0xf1a3f7),_0xf1a3f7;}for(const _0x2ad9d1 of _0x49c329){_0x42367e(_0x2ad9d1);}return _0x530a04;}function a153_0x42fc(_0x2a603b,_0x14a6cd){_0x2a603b=_0x2a603b-0x13e;const _0x1bdfba=a153_0x1bdf();let _0x42fc95=_0x1bdfba[_0x2a603b];return _0x42fc95;}function a153_0x1bdf(){const _0x4fb965=['2294988RqPoaT','31755570guGBMv','1413282nLgSSR','8496272Vyogci','has','get','add','3266946nAOojK','name','1JrFjsI','35ElHRhc','parentFolderId','6309nGwFJR','set','19468KVRqtF','1270dEdDrj','60nADiEE'];a153_0x1bdf=function(){return _0x4fb965;};return a153_0x1bdf();}export function buildFolderPathToIdMap(_0x465959){const _0x4d863f=a153_0x42fc,_0x504edc=new Map(),_0x31a067=new Map();for(const _0x28a6c5 of _0x465959){_0x31a067[_0x4d863f(0x14b)](_0x28a6c5['id'],_0x28a6c5);}const _0x31c3b5=new Set();for(const _0x2bac05 of _0x465959){!_0x2bac05[_0x4d863f(0x149)]&&_0x31c3b5[_0x4d863f(0x144)](_0x2bac05['id']);}function _0x4f4da2(_0x400c54){const _0x20ea3b=_0x4d863f;if(_0x31c3b5['has'](_0x400c54['id']))return'';if(_0x400c54[_0x20ea3b(0x149)]){const _0x3631da=_0x31a067['get'](_0x400c54[_0x20ea3b(0x149)]);if(_0x3631da){const _0x223d05=_0x4f4da2(_0x3631da);return _0x223d05?_0x223d05+'/'+_0x400c54[_0x20ea3b(0x146)]:_0x400c54[_0x20ea3b(0x146)];}}return _0x400c54[_0x20ea3b(0x146)];}for(const _0x4fdee9 of _0x465959){const _0x252d1d=_0x4f4da2(_0x4fdee9);_0x504edc[_0x4d863f(0x14b)](_0x252d1d,_0x4fdee9['id']);}return _0x504edc;}export function buildFolderMaps(_0x4d5818){const _0x4152ed=a153_0x42fc,_0x5d960e=buildFolderIdToPathMap(_0x4d5818),_0x1190e1=new Map();for(const [_0x458ca5,_0x4f4d3a]of _0x5d960e){_0x1190e1[_0x4152ed(0x14b)](_0x4f4d3a,_0x458ca5);}return{'idToPath':_0x5d960e,'pathToId':_0x1190e1};}export function getFolderPath(_0x24a3ac,_0x57985b){const _0x593a28=a153_0x42fc;if(!_0x24a3ac)return'';return _0x57985b[_0x593a28(0x143)](_0x24a3ac)??'';}
@@ -1 +1 @@
1
- (function(_0x116e58,_0x49a1a1){const _0x4711c8=a153_0x4f28,_0x1484ff=_0x116e58();while(!![]){try{const _0x58ba2b=parseInt(_0x4711c8(0x193))/0x1*(parseInt(_0x4711c8(0x186))/0x2)+-parseInt(_0x4711c8(0x18f))/0x3+-parseInt(_0x4711c8(0x199))/0x4+-parseInt(_0x4711c8(0x18c))/0x5+parseInt(_0x4711c8(0x183))/0x6+parseInt(_0x4711c8(0x16d))/0x7+-parseInt(_0x4711c8(0x192))/0x8*(-parseInt(_0x4711c8(0x175))/0x9);if(_0x58ba2b===_0x49a1a1)break;else _0x1484ff['push'](_0x1484ff['shift']());}catch(_0x3685d4){_0x1484ff['push'](_0x1484ff['shift']());}}}(a153_0x451b,0x4f414));import a153_0x35eca9 from'path';function a153_0x4f28(_0x28b64b,_0x2efcea){_0x28b64b=_0x28b64b-0x16b;const _0x451b73=a153_0x451b();let _0x4f287b=_0x451b73[_0x28b64b];return _0x4f287b;}import{parse as a153_0x137018}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';function a153_0x451b(){const _0x509ef4=['endsWith','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','Cannot\x20navigate\x20above\x20root','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','746732DhWMyM','split','resolve','Path\x20cannot\x20be\x20empty','slice','name','raw','startsWith','9mptdaB','segment','substring','.yaml','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','Relative\x20path\x20cannot\x20be\x20empty','root','tdx.json','dirname','push','parse','length','journey','parent_segment','645714CvrqqB','segments','Path\x20attempts\x20to\x20navigate\x20above\x20root','87848DvtjgL','filter','replace','trim','No\x20tdx.json\x20found\x20for\x20file:\x20','test','1734690ldUNOz','type','exists','1012182JBoyQr','isAbsolute','Path\x20segment\x20cannot\x20be\x20empty','6663208EiwXdP','3hHJdcB','readFile','join','.yml','Cannot\x20split\x20empty\x20path','relative','680032BAAhAu','File\x20not\x20found:\x20'];a153_0x451b=function(){return _0x509ef4;};return a153_0x451b();}export function parsePath(_0x5eb385){const _0x32c4e9=a153_0x4f28;if(!_0x5eb385||_0x5eb385[_0x32c4e9(0x189)]()==='')throw new Error(_0x32c4e9(0x170));const _0x59710d=_0x5eb385[_0x32c4e9(0x189)]();if(_0x59710d==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x5eb385};const _0x4d862a=_0x59710d['startsWith']('/')?_0x59710d[_0x32c4e9(0x177)](0x1):_0x59710d,_0x21298a=_0x4d862a[_0x32c4e9(0x16e)]('/')[_0x32c4e9(0x187)](_0x28f167=>_0x28f167!=='');if(_0x21298a[_0x32c4e9(0x180)]===0x0)throw new Error(_0x32c4e9(0x19c));const _0x5e44d0=_0x59710d['startsWith']('/')||!isRelativePathSegment(_0x21298a[0x0]);for(const _0x107c3b of _0x21298a){validatePathSegment(_0x107c3b);}return{'segments':_0x21298a,'isAbsolute':_0x5e44d0,'raw':_0x5eb385};}function isRelativePathSegment(_0x2ae7b3){return _0x2ae7b3==='.'||_0x2ae7b3==='..';}function validatePathSegment(_0x30df4a){const _0x5d9024=a153_0x4f28;if(_0x30df4a==='')throw new Error(_0x5d9024(0x191));if(_0x30df4a==='.'||_0x30df4a==='..')return;if(/[\x00-\x1F\x7F]/[_0x5d9024(0x18b)](_0x30df4a))throw new Error(_0x5d9024(0x16b)+_0x30df4a);if(_0x30df4a!==_0x30df4a[_0x5d9024(0x189)]()){}}export function validatePath(_0x554cb3){const _0x143bf7=a153_0x4f28;if(_0x554cb3['segments'][_0x143bf7(0x180)]===0x0&&!_0x554cb3[_0x143bf7(0x190)])throw new Error(_0x143bf7(0x17a));if(_0x554cb3['isAbsolute']){if(_0x554cb3[_0x143bf7(0x184)][0x0]==='..')throw new Error(_0x143bf7(0x179));let _0x177e25=0x0;for(const _0x144898 of _0x554cb3[_0x143bf7(0x184)]){if(_0x144898==='..'){if(_0x177e25===0x0)throw new Error(_0x143bf7(0x185));_0x177e25--;}else _0x144898!=='.'&&_0x177e25++;}}}export function joinPaths(_0x148e25,_0x500772){const _0x11bb21=a153_0x4f28;if(!_0x148e25||_0x148e25==='/')return _0x500772;if(!_0x500772||_0x500772==='.')return _0x148e25;if(_0x500772[_0x11bb21(0x174)]('/'))return _0x500772;const _0x29bac7=parsePath(_0x148e25),_0x172f9e=parsePath(_0x500772),_0x1b2695=[..._0x29bac7[_0x11bb21(0x184)]];for(const _0x3d735e of _0x172f9e[_0x11bb21(0x184)]){if(_0x3d735e==='.')continue;else{if(_0x3d735e==='..'){if(_0x1b2695[_0x11bb21(0x180)]===0x0)throw new Error(_0x11bb21(0x19d));_0x1b2695['pop']();}else _0x1b2695['push'](_0x3d735e);}}const _0x2ae8bb=_0x1b2695['join']('/');return _0x29bac7[_0x11bb21(0x173)]['startsWith']('/')?'/'+_0x2ae8bb:_0x2ae8bb;}export function normalizePath(_0xf40179){const _0x1600b4=a153_0x4f28,_0x717299=parsePath(_0xf40179),_0x5d1078=[];for(const _0x46ec2d of _0x717299['segments']){if(_0x46ec2d==='.')continue;else{if(_0x46ec2d==='..'){if(_0x5d1078['length']===0x0){if(_0x717299[_0x1600b4(0x190)])throw new Error(_0x1600b4(0x19d));_0x5d1078[_0x1600b4(0x17e)]('..');}else _0x5d1078[_0x5d1078[_0x1600b4(0x180)]-0x1]==='..'?_0x5d1078[_0x1600b4(0x17e)]('..'):_0x5d1078['pop']();}else _0x5d1078[_0x1600b4(0x17e)](_0x46ec2d);}}if(_0x5d1078['length']===0x0)return _0x717299[_0x1600b4(0x190)]?'/':'.';const _0x1b317d=_0x5d1078['join']('/');return _0x717299['raw'][_0x1600b4(0x174)]('/')?'/'+_0x1b317d:_0x1b317d;}export function getParentPath(_0x3c9968){const _0x10c42a=a153_0x4f28,_0x58a1bc=parsePath(_0x3c9968);if(_0x58a1bc[_0x10c42a(0x184)][_0x10c42a(0x180)]<=0x1)return'/';const _0x4c21d4=_0x58a1bc['segments'][_0x10c42a(0x171)](0x0,-0x1)['join']('/');return _0x58a1bc[_0x10c42a(0x173)]['startsWith']('/')?'/'+_0x4c21d4:_0x4c21d4;}export function getBaseName(_0x1a345a){const _0x4b90c7=a153_0x4f28,_0x235869=parsePath(_0x1a345a);return _0x235869[_0x4b90c7(0x184)][_0x235869['segments'][_0x4b90c7(0x180)]-0x1]||'';}export function isChildPath(_0x1d10f5,_0x37df3b){const _0x3b8a4f=a153_0x4f28,_0xc86af0=parsePath(_0x1d10f5),_0x1a264d=parsePath(_0x37df3b);if(_0xc86af0[_0x3b8a4f(0x184)][_0x3b8a4f(0x180)]<=_0x1a264d[_0x3b8a4f(0x184)]['length'])return![];for(let _0x1f9c88=0x0;_0x1f9c88<_0x1a264d[_0x3b8a4f(0x184)]['length'];_0x1f9c88++){if(_0xc86af0[_0x3b8a4f(0x184)][_0x1f9c88]!==_0x1a264d['segments'][_0x1f9c88])return![];}return!![];}export function splitPath(_0x15f897){const _0x517246=a153_0x4f28,_0x188c94=parsePath(_0x15f897);if(_0x188c94[_0x517246(0x184)]['length']===0x0)throw new Error(_0x517246(0x197));if(_0x188c94['segments']['length']===0x1)return{'parent':_0x188c94[_0x517246(0x184)][0x0]};return{'parent':_0x188c94[_0x517246(0x184)][0x0],'child':_0x188c94[_0x517246(0x184)][_0x517246(0x171)](0x1)['join']('/')};}export function isYamlFilePath(_0x596ee0){const _0x3059f9=a153_0x4f28;return _0x596ee0[_0x3059f9(0x19b)](_0x3059f9(0x196))||_0x596ee0[_0x3059f9(0x19b)](_0x3059f9(0x178));}export async function resolveYamlFilePath(_0x47b6b3,_0x15d68e=nodeFileSystem){const _0x540516=a153_0x4f28,_0x4bff0c=a153_0x35eca9[_0x540516(0x16f)](_0x47b6b3);if(!await _0x15d68e[_0x540516(0x18e)](_0x4bff0c))throw new Error(_0x540516(0x19a)+_0x47b6b3);let _0x3aa812=a153_0x35eca9['dirname'](_0x4bff0c),_0x1e83c2=null,_0x226638=null;const _0x57df58=a153_0x35eca9['parse'](_0x3aa812)[_0x540516(0x17b)];while(_0x3aa812!==_0x57df58){const _0x47528e=a153_0x35eca9[_0x540516(0x195)](_0x3aa812,_0x540516(0x17c));if(await _0x15d68e[_0x540516(0x18e)](_0x47528e)){_0x1e83c2=_0x47528e,_0x226638=_0x3aa812;break;}_0x3aa812=a153_0x35eca9[_0x540516(0x17d)](_0x3aa812);}if(!_0x1e83c2||!_0x226638)throw new Error(_0x540516(0x18a)+_0x47b6b3+'\x0a'+'Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.');const _0x19b6ba=await _0x15d68e['readFile'](_0x1e83c2),_0x16afa8=JSON[_0x540516(0x17f)](_0x19b6ba),_0x210f1d=_0x16afa8[_0x540516(0x182)];if(!_0x210f1d)throw new Error(_0x540516(0x16c));const _0x590c7e=await _0x15d68e[_0x540516(0x194)](_0x4bff0c),_0x191b47=a153_0x137018(_0x590c7e),_0x5ae85c=_0x191b47[_0x540516(0x172)];if(!_0x5ae85c)throw new Error('Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'+_0x47b6b3);const _0x79e443=_0x191b47[_0x540516(0x18d)]===_0x540516(0x181)?_0x540516(0x181):_0x540516(0x176),_0x2ee893=a153_0x35eca9[_0x540516(0x198)](_0x226638,_0x4bff0c),_0x22101c=a153_0x35eca9[_0x540516(0x17d)](_0x2ee893),_0x3a9b29=_0x22101c==='.'?'':_0x22101c[_0x540516(0x188)](/\\/g,'/'),_0x28c54a=_0x3a9b29?_0x210f1d+'/'+_0x3a9b29+'/'+_0x5ae85c:_0x210f1d+'/'+_0x5ae85c;return{'parentSegment':_0x210f1d,'segmentName':_0x5ae85c,'folderPath':_0x3a9b29,'fullPath':_0x28c54a,'resourceType':_0x79e443,'content':_0x590c7e};}
1
+ (function(_0x19d9e8,_0x16266d){const _0x3880a7=a154_0x45e7,_0x164c11=_0x19d9e8();while(!![]){try{const _0x8bb682=parseInt(_0x3880a7(0x14c))/0x1*(-parseInt(_0x3880a7(0x14b))/0x2)+-parseInt(_0x3880a7(0x13f))/0x3*(parseInt(_0x3880a7(0x160))/0x4)+parseInt(_0x3880a7(0x137))/0x5+parseInt(_0x3880a7(0x164))/0x6*(-parseInt(_0x3880a7(0x140))/0x7)+parseInt(_0x3880a7(0x146))/0x8+parseInt(_0x3880a7(0x15a))/0x9*(-parseInt(_0x3880a7(0x13d))/0xa)+parseInt(_0x3880a7(0x156))/0xb*(parseInt(_0x3880a7(0x158))/0xc);if(_0x8bb682===_0x16266d)break;else _0x164c11['push'](_0x164c11['shift']());}catch(_0x50c0a4){_0x164c11['push'](_0x164c11['shift']());}}}(a154_0x68fc,0x6c1ca));import a154_0x238df5 from'path';import{parse as a154_0x4e7c3c}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x566359){const _0x5b2290=a154_0x45e7;if(!_0x566359||_0x566359['trim']()==='')throw new Error(_0x5b2290(0x139));const _0xcc287d=_0x566359[_0x5b2290(0x165)]();if(_0xcc287d==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x566359};const _0x205cc1=_0xcc287d[_0x5b2290(0x13c)]('/')?_0xcc287d[_0x5b2290(0x163)](0x1):_0xcc287d,_0x3fb502=_0x205cc1[_0x5b2290(0x149)]('/')['filter'](_0x5177e0=>_0x5177e0!=='');if(_0x3fb502[_0x5b2290(0x141)]===0x0)throw new Error(_0x5b2290(0x142));const _0x3f488c=_0xcc287d['startsWith']('/')||!isRelativePathSegment(_0x3fb502[0x0]);for(const _0x4abf45 of _0x3fb502){validatePathSegment(_0x4abf45);}return{'segments':_0x3fb502,'isAbsolute':_0x3f488c,'raw':_0x566359};}function a154_0x45e7(_0x362a56,_0x41399d){_0x362a56=_0x362a56-0x137;const _0x68fc98=a154_0x68fc();let _0x45e790=_0x68fc98[_0x362a56];return _0x45e790;}function isRelativePathSegment(_0x2eb66c){return _0x2eb66c==='.'||_0x2eb66c==='..';}function validatePathSegment(_0x4c328e){const _0x35f25c=a154_0x45e7;if(_0x4c328e==='')throw new Error(_0x35f25c(0x151));if(_0x4c328e==='.'||_0x4c328e==='..')return;if(/[\x00-\x1F\x7F]/['test'](_0x4c328e))throw new Error(_0x35f25c(0x14d)+_0x4c328e);if(_0x4c328e!==_0x4c328e[_0x35f25c(0x165)]()){}}export function validatePath(_0xfeb9da){const _0x40b7ce=a154_0x45e7;if(_0xfeb9da[_0x40b7ce(0x162)][_0x40b7ce(0x141)]===0x0&&!_0xfeb9da[_0x40b7ce(0x15b)])throw new Error(_0x40b7ce(0x147));if(_0xfeb9da[_0x40b7ce(0x15b)]){if(_0xfeb9da['segments'][0x0]==='..')throw new Error(_0x40b7ce(0x169));let _0x5aff2e=0x0;for(const _0x51f588 of _0xfeb9da[_0x40b7ce(0x162)]){if(_0x51f588==='..'){if(_0x5aff2e===0x0)throw new Error(_0x40b7ce(0x168));_0x5aff2e--;}else _0x51f588!=='.'&&_0x5aff2e++;}}}export function joinPaths(_0x33a891,_0xe7890d){const _0x5be9cd=a154_0x45e7;if(!_0x33a891||_0x33a891==='/')return _0xe7890d;if(!_0xe7890d||_0xe7890d==='.')return _0x33a891;if(_0xe7890d['startsWith']('/'))return _0xe7890d;const _0x24ac2d=parsePath(_0x33a891),_0x4cc46d=parsePath(_0xe7890d),_0x417a1f=[..._0x24ac2d[_0x5be9cd(0x162)]];for(const _0x1d8b2f of _0x4cc46d['segments']){if(_0x1d8b2f==='.')continue;else{if(_0x1d8b2f==='..'){if(_0x417a1f[_0x5be9cd(0x141)]===0x0)throw new Error('Cannot\x20navigate\x20above\x20root');_0x417a1f[_0x5be9cd(0x143)]();}else _0x417a1f[_0x5be9cd(0x138)](_0x1d8b2f);}}const _0x4a9272=_0x417a1f[_0x5be9cd(0x161)]('/');return _0x24ac2d[_0x5be9cd(0x15c)][_0x5be9cd(0x13c)]('/')?'/'+_0x4a9272:_0x4a9272;}function a154_0x68fc(){const _0xdc84d6=['slice','endsWith','.yml','Path\x20segment\x20cannot\x20be\x20empty','journey','parse','readFile','Cannot\x20split\x20empty\x20path','9097jqTPNb','root','29976zxUYTI','.yaml','54alkbsf','isAbsolute','raw','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','name','relative','28sSQhkJ','join','segments','substring','480xhkAsK','trim','segment','Cannot\x20navigate\x20above\x20root','Path\x20attempts\x20to\x20navigate\x20above\x20root','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','2767095DUmAlp','push','Path\x20cannot\x20be\x20empty','replace','parent_segment','startsWith','285350UWfdyk','tdx.json','290661sDtRBt','56392YeuaJq','length','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','pop','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','type','1478664tExfvu','Relative\x20path\x20cannot\x20be\x20empty','dirname','split','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','1734746KnXtCH','1ENIHna','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20'];a154_0x68fc=function(){return _0xdc84d6;};return a154_0x68fc();}export function normalizePath(_0x21961d){const _0x2f3c4a=a154_0x45e7,_0x7e9a99=parsePath(_0x21961d),_0x57f3e8=[];for(const _0x3ec529 of _0x7e9a99['segments']){if(_0x3ec529==='.')continue;else{if(_0x3ec529==='..'){if(_0x57f3e8[_0x2f3c4a(0x141)]===0x0){if(_0x7e9a99['isAbsolute'])throw new Error(_0x2f3c4a(0x167));_0x57f3e8['push']('..');}else _0x57f3e8[_0x57f3e8[_0x2f3c4a(0x141)]-0x1]==='..'?_0x57f3e8[_0x2f3c4a(0x138)]('..'):_0x57f3e8[_0x2f3c4a(0x143)]();}else _0x57f3e8['push'](_0x3ec529);}}if(_0x57f3e8[_0x2f3c4a(0x141)]===0x0)return _0x7e9a99[_0x2f3c4a(0x15b)]?'/':'.';const _0x2da723=_0x57f3e8[_0x2f3c4a(0x161)]('/');return _0x7e9a99['raw']['startsWith']('/')?'/'+_0x2da723:_0x2da723;}export function getParentPath(_0x429ed8){const _0x2b8110=a154_0x45e7,_0x22d1eb=parsePath(_0x429ed8);if(_0x22d1eb[_0x2b8110(0x162)][_0x2b8110(0x141)]<=0x1)return'/';const _0x13c23c=_0x22d1eb['segments'][_0x2b8110(0x14e)](0x0,-0x1)[_0x2b8110(0x161)]('/');return _0x22d1eb[_0x2b8110(0x15c)][_0x2b8110(0x13c)]('/')?'/'+_0x13c23c:_0x13c23c;}export function getBaseName(_0x5340c8){const _0x4f0ea1=a154_0x45e7,_0x2cb3b6=parsePath(_0x5340c8);return _0x2cb3b6['segments'][_0x2cb3b6[_0x4f0ea1(0x162)][_0x4f0ea1(0x141)]-0x1]||'';}export function isChildPath(_0xdb0cf0,_0x4aa17c){const _0x1614b1=a154_0x45e7,_0x199132=parsePath(_0xdb0cf0),_0xc0e55a=parsePath(_0x4aa17c);if(_0x199132[_0x1614b1(0x162)][_0x1614b1(0x141)]<=_0xc0e55a[_0x1614b1(0x162)][_0x1614b1(0x141)])return![];for(let _0x13e696=0x0;_0x13e696<_0xc0e55a[_0x1614b1(0x162)][_0x1614b1(0x141)];_0x13e696++){if(_0x199132['segments'][_0x13e696]!==_0xc0e55a[_0x1614b1(0x162)][_0x13e696])return![];}return!![];}export function splitPath(_0x2eceb1){const _0x5dd360=a154_0x45e7,_0x59a652=parsePath(_0x2eceb1);if(_0x59a652[_0x5dd360(0x162)][_0x5dd360(0x141)]===0x0)throw new Error(_0x5dd360(0x155));if(_0x59a652['segments'][_0x5dd360(0x141)]===0x1)return{'parent':_0x59a652[_0x5dd360(0x162)][0x0]};return{'parent':_0x59a652['segments'][0x0],'child':_0x59a652[_0x5dd360(0x162)][_0x5dd360(0x14e)](0x1)[_0x5dd360(0x161)]('/')};}export function isYamlFilePath(_0x53493b){const _0x327e56=a154_0x45e7;return _0x53493b[_0x327e56(0x14f)](_0x327e56(0x150))||_0x53493b[_0x327e56(0x14f)](_0x327e56(0x159));}export async function resolveYamlFilePath(_0x579cc7,_0x25284d=nodeFileSystem){const _0x23c1e8=a154_0x45e7,_0x3eb19e=a154_0x238df5['resolve'](_0x579cc7);if(!await _0x25284d['exists'](_0x3eb19e))throw new Error('File\x20not\x20found:\x20'+_0x579cc7);let _0x3dc520=a154_0x238df5[_0x23c1e8(0x148)](_0x3eb19e),_0x408bc8=null,_0x42834d=null;const _0x548aeb=a154_0x238df5[_0x23c1e8(0x153)](_0x3dc520)[_0x23c1e8(0x157)];while(_0x3dc520!==_0x548aeb){const _0x232826=a154_0x238df5['join'](_0x3dc520,_0x23c1e8(0x13e));if(await _0x25284d['exists'](_0x232826)){_0x408bc8=_0x232826,_0x42834d=_0x3dc520;break;}_0x3dc520=a154_0x238df5['dirname'](_0x3dc520);}if(!_0x408bc8||!_0x42834d)throw new Error('No\x20tdx.json\x20found\x20for\x20file:\x20'+_0x579cc7+'\x0a'+_0x23c1e8(0x15d));const _0x3b1b29=await _0x25284d['readFile'](_0x408bc8),_0x2b8726=JSON['parse'](_0x3b1b29),_0x39e3ac=_0x2b8726[_0x23c1e8(0x13b)];if(!_0x39e3ac)throw new Error(_0x23c1e8(0x144));const _0x3bd80b=await _0x25284d[_0x23c1e8(0x154)](_0x3eb19e),_0x44ca5f=a154_0x4e7c3c(_0x3bd80b),_0x52fed9=_0x44ca5f[_0x23c1e8(0x15e)];if(!_0x52fed9)throw new Error(_0x23c1e8(0x14a)+_0x579cc7);const _0x14429f=_0x44ca5f[_0x23c1e8(0x145)]===_0x23c1e8(0x152)?'journey':_0x23c1e8(0x166),_0x5dbefb=a154_0x238df5[_0x23c1e8(0x15f)](_0x42834d,_0x3eb19e),_0x73b14f=a154_0x238df5[_0x23c1e8(0x148)](_0x5dbefb),_0x2c3d78=_0x73b14f==='.'?'':_0x73b14f[_0x23c1e8(0x13a)](/\\/g,'/'),_0x1734df=_0x2c3d78?_0x39e3ac+'/'+_0x2c3d78+'/'+_0x52fed9:_0x39e3ac+'/'+_0x52fed9;return{'parentSegment':_0x39e3ac,'segmentName':_0x52fed9,'folderPath':_0x2c3d78,'fullPath':_0x1734df,'resourceType':_0x14429f,'content':_0x3bd80b};}
@@ -1 +1 @@
1
- (function(_0x581905,_0x3d367b){const _0x1d2e57=a154_0x3113,_0x5f53ae=_0x581905();while(!![]){try{const _0x24eaa1=-parseInt(_0x1d2e57(0x1bc))/0x1+-parseInt(_0x1d2e57(0x1b5))/0x2+-parseInt(_0x1d2e57(0x1ba))/0x3*(parseInt(_0x1d2e57(0x1b6))/0x4)+-parseInt(_0x1d2e57(0x1be))/0x5*(parseInt(_0x1d2e57(0x1b7))/0x6)+parseInt(_0x1d2e57(0x1b3))/0x7+-parseInt(_0x1d2e57(0x1b8))/0x8+parseInt(_0x1d2e57(0x1b9))/0x9*(parseInt(_0x1d2e57(0x1bb))/0xa);if(_0x24eaa1===_0x3d367b)break;else _0x5f53ae['push'](_0x5f53ae['shift']());}catch(_0x4903f9){_0x5f53ae['push'](_0x5f53ae['shift']());}}}(a154_0x4095,0xa88dc));function a154_0x3113(_0x3b3b15,_0x3c0ca8){_0x3b3b15=_0x3b3b15-0x1b3;const _0x4095ee=a154_0x4095();let _0x311379=_0x4095ee[_0x3b3b15];return _0x311379;}function a154_0x4095(){const _0x16364c=['122830zGgnVv','817611cVzghT','Invalid\x20segment\x20reference\x20format:\x20','25FPwFCD','.\x20Parent\x20name\x20cannot\x20be\x20empty','indexOf','8745401Kdbpks','substring','531290tDRExv','4vPbSyo','1073658WisFym','583512LCNrAv','1116CUuWyV','93387qdMfqv'];a154_0x4095=function(){return _0x16364c;};return a154_0x4095();}export function parseSegmentRef(_0x1971bb){const _0x156acf=a154_0x3113,_0x279aa8=_0x1971bb[_0x156acf(0x1c0)]('/');if(_0x279aa8===-0x1)return{'parentId':_0x1971bb};if(_0x279aa8===0x0)throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x1971bb+_0x156acf(0x1bf));const _0x54bc1c=_0x1971bb[_0x156acf(0x1b4)](0x0,_0x279aa8),_0x2c6f71=_0x1971bb[_0x156acf(0x1b4)](_0x279aa8+0x1);if(_0x2c6f71==='')throw new Error(_0x156acf(0x1bd)+_0x1971bb+'.\x20Child\x20name\x20cannot\x20be\x20empty');return{'parentId':_0x54bc1c,'childId':_0x2c6f71};}
1
+ function a155_0xdf18(_0xbc6db5,_0x41f48e){_0xbc6db5=_0xbc6db5-0x9c;const _0x297e2f=a155_0x297e();let _0xdf1893=_0x297e2f[_0xbc6db5];return _0xdf1893;}(function(_0x2feebb,_0x6533cc){const _0x1f8786=a155_0xdf18,_0x3abaf6=_0x2feebb();while(!![]){try{const _0xe07786=-parseInt(_0x1f8786(0x9c))/0x1*(-parseInt(_0x1f8786(0xa5))/0x2)+-parseInt(_0x1f8786(0x9d))/0x3+parseInt(_0x1f8786(0xa3))/0x4*(-parseInt(_0x1f8786(0xa7))/0x5)+parseInt(_0x1f8786(0xa4))/0x6*(parseInt(_0x1f8786(0xa0))/0x7)+parseInt(_0x1f8786(0xa9))/0x8+-parseInt(_0x1f8786(0xa8))/0x9*(parseInt(_0x1f8786(0xaa))/0xa)+parseInt(_0x1f8786(0x9e))/0xb;if(_0xe07786===_0x6533cc)break;else _0x3abaf6['push'](_0x3abaf6['shift']());}catch(_0x2f72f7){_0x3abaf6['push'](_0x3abaf6['shift']());}}}(a155_0x297e,0xe2eaf));function a155_0x297e(){const _0x1ceb3f=['9693704GhKyAd','461660PuVdna','58153ofMUyF','3296349JFdCit','31232344NeBFyK','substring','14xFkJnP','.\x20Child\x20name\x20cannot\x20be\x20empty','.\x20Parent\x20name\x20cannot\x20be\x20empty','4lUFQeq','2427654QGvOVt','14weZlsV','Invalid\x20segment\x20reference\x20format:\x20','9039610hxswAF','279dAJtDU'];a155_0x297e=function(){return _0x1ceb3f;};return a155_0x297e();}export function parseSegmentRef(_0x2d532b){const _0x44fdad=a155_0xdf18,_0x51eb47=_0x2d532b['indexOf']('/');if(_0x51eb47===-0x1)return{'parentId':_0x2d532b};if(_0x51eb47===0x0)throw new Error(_0x44fdad(0xa6)+_0x2d532b+_0x44fdad(0xa2));const _0x3124fb=_0x2d532b['substring'](0x0,_0x51eb47),_0x3428a4=_0x2d532b[_0x44fdad(0x9f)](_0x51eb47+0x1);if(_0x3428a4==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x2d532b+_0x44fdad(0xa1));return{'parentId':_0x3124fb,'childId':_0x3428a4};}
@@ -1 +1 @@
1
- (function(_0x360777,_0x4b1e97){const _0x31ed10=a155_0x36ac,_0x31e75f=_0x360777();while(!![]){try{const _0x4759df=parseInt(_0x31ed10(0x120))/0x1*(-parseInt(_0x31ed10(0x12e))/0x2)+parseInt(_0x31ed10(0x128))/0x3*(parseInt(_0x31ed10(0x132))/0x4)+parseInt(_0x31ed10(0x11a))/0x5*(parseInt(_0x31ed10(0x129))/0x6)+parseInt(_0x31ed10(0x127))/0x7*(parseInt(_0x31ed10(0x125))/0x8)+parseInt(_0x31ed10(0x10e))/0x9+-parseInt(_0x31ed10(0x112))/0xa+parseInt(_0x31ed10(0x126))/0xb*(-parseInt(_0x31ed10(0xff))/0xc);if(_0x4759df===_0x4b1e97)break;else _0x31e75f['push'](_0x31e75f['shift']());}catch(_0x59ce78){_0x31e75f['push'](_0x31e75f['shift']());}}}(a155_0x2e3d,0x526c6));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';function a155_0x36ac(_0x4bdffc,_0x3310e8){_0x4bdffc=_0x4bdffc-0xf0;const _0x2e3da7=a155_0x2e3d();let _0x36acd8=_0x2e3da7[_0x4bdffc];return _0x36acd8;}export function validateSegmentDef(_0x6a22b0,_0x15adcd={},_0x432269={}){const _0x24bd85=a155_0x36ac;if(_0x432269[_0x24bd85(0x119)])return runSemanticChecks(_0x6a22b0,_0x15adcd);const _0x26f70f=SegmentDefSchema[_0x24bd85(0xf5)](_0x6a22b0);if(_0x26f70f[_0x24bd85(0x101)])return runSemanticChecks(_0x26f70f['data'],_0x15adcd);return zodErrorsToValidationResult(_0x26f70f[_0x24bd85(0xfb)],_0x15adcd);}export function validateRuleDef(_0x3eb6fe,_0x40f5ac,_0x32311){const _0x551a0b=a155_0x36ac;if(!_0x3eb6fe)return[];const _0x48681=RuleDefSchema[_0x551a0b(0xf5)](_0x3eb6fe);if(_0x48681[_0x551a0b(0x101)])return checkRule(_0x48681[_0x551a0b(0x11c)],_0x40f5ac,_0x32311);const _0x2c6897=flattenZodIssues(_0x48681['error'][_0x551a0b(0xf8)]);return _0x2c6897['map'](_0x43cd13=>{const _0x93233=_0x551a0b,_0x4c4503=formatZodPath(_0x43cd13[_0x93233(0x12d)]),_0x3357ca=_0x4c4503?_0x40f5ac+'.'+_0x4c4503:_0x40f5ac,_0x508984=mapZodIssueToCode(_0x43cd13,_0x4c4503),_0x2562c7=getLocationFromPath(_0x32311[_0x93233(0x124)],_0x32311[_0x93233(0x10a)],pathToArray(_0x3357ca));return{'level':_0x93233(0xfb),'path':_0x3357ca,'code':_0x508984,'message':_0x43cd13[_0x93233(0x10c)],..._0x2562c7&&{'location':_0x2562c7}};});}function zodErrorsToValidationResult(_0x48e74e,_0x33ea6a){const _0xfd06a2=a155_0x36ac,_0x58905f=flattenZodIssues(_0x48e74e[_0xfd06a2(0xf8)]),_0x1b8155=_0x58905f[_0xfd06a2(0x12a)](_0x336c44=>{const _0xc4a974=_0xfd06a2,_0x55742f=formatZodPath(_0x336c44[_0xc4a974(0x12d)]),_0xcd935=mapZodIssueToCode(_0x336c44,_0x55742f),_0x18dc0f=getLocationFromPath(_0x33ea6a[_0xc4a974(0x124)],_0x33ea6a[_0xc4a974(0x10a)],_0x336c44[_0xc4a974(0x12d)]['map'](_0x39e38b=>typeof _0x39e38b==='symbol'?String(_0x39e38b):_0x39e38b));return{'level':_0xc4a974(0xfb),'path':_0x55742f,'code':_0xcd935,'message':_0x336c44['message'],..._0x18dc0f&&{'location':_0x18dc0f}};});return{'valid':![],'errors':_0x1b8155,'warnings':[]};}function mapZodIssueToCode(_0x325c7b,_0x1a623c){const _0xd0fc2f=a155_0x36ac,_0x1ece00=_0x325c7b[_0xd0fc2f(0x12f)]==='custom'?_0x325c7b['params']:undefined;if(_0x1a623c===_0xd0fc2f(0xf0))return _0xd0fc2f(0x122);if(_0x1a623c===_0xd0fc2f(0x113)||_0x1a623c[_0xd0fc2f(0x116)]('.type')){if(_0x325c7b['code']===_0xd0fc2f(0xfc)){if(_0x1a623c===_0xd0fc2f(0x113)||_0x1a623c[_0xd0fc2f(0x133)](/\.conditions\[\d+\]\.type$/))return _0xd0fc2f(0x11f);}}if(_0x1a623c['endsWith'](_0xd0fc2f(0x108)))return _0xd0fc2f(0x134);if(_0x1a623c[_0xd0fc2f(0x116)](_0xd0fc2f(0x100)))return'MISSING_OPERATOR_VALUE';if(_0x1ece00?.[_0xd0fc2f(0xf9)]==='MISSING_BETWEEN_BOUNDS')return'MISSING_BETWEEN_BOUNDS';if(_0x1ece00?.[_0xd0fc2f(0xf9)]===_0xd0fc2f(0x130))return'MISSING_TIME_UNIT';if(_0x1a623c['endsWith'](_0xd0fc2f(0xf4))||_0x1a623c===_0xd0fc2f(0x117))return'MISSING_CONDITIONS';if(_0x1a623c['includes']('arrayMatching'))return _0xd0fc2f(0x118);if(_0x1a623c['endsWith'](_0xd0fc2f(0x111)))return _0xd0fc2f(0x131);return'SEGMENT_SCHEMA_ERROR';}function runSemanticChecks(_0x2eb7a6,_0x44f5c7){const _0x37808c=a155_0x36ac,_0x48d7d5=[];_0x2eb7a6[_0x37808c(0x11d)]&&_0x48d7d5['push'](...checkRule(_0x2eb7a6[_0x37808c(0x11d)],_0x37808c(0x11d),_0x44f5c7));const _0x5a2884=_0x48d7d5[_0x37808c(0x105)](_0x549dcb=>_0x549dcb[_0x37808c(0xf6)]===_0x37808c(0xfb)),_0x5a2b77=_0x48d7d5[_0x37808c(0x105)](_0x46bea8=>_0x46bea8['level']===_0x37808c(0x114));return{'valid':_0x5a2884['length']===0x0,'errors':_0x5a2884,'warnings':_0x5a2b77};}function checkRule(_0x3c43ed,_0x34f0b5,_0x1bd801){const _0x12a26e=a155_0x36ac,_0xe685e1=[];if(_0x3c43ed[_0x12a26e(0x117)][_0x12a26e(0x11e)]===0x0)return _0xe685e1[_0x12a26e(0x107)]({'level':_0x12a26e(0xfb),'path':_0x34f0b5+'.conditions','code':_0x12a26e(0x10f),'message':_0x12a26e(0x12c),'location':getLocationFromPath(_0x1bd801[_0x12a26e(0x124)],_0x1bd801['source'],pathToArray(_0x34f0b5+_0x12a26e(0xf4)))}),_0xe685e1;return _0xe685e1[_0x12a26e(0x107)](...checkConditions(_0x3c43ed[_0x12a26e(0x117)],_0x34f0b5,_0x1bd801)),_0xe685e1;}function a155_0x2e3d(){const _0x28aa7a=['success','Value','Behavior','\x27\x20with\x20attribute\x20\x27','filter','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','push','.operator.type','Behavior\x20source\x20\x27','source','And','message','Attribute\x20name\x20cannot\x20be\x20empty','5036013kQywHg','EMPTY_CONDITIONS','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','.segment','1473500nwtgtj','rule.type','warning','attribute','endsWith','conditions','INVALID_ARRAY_MATCHING','skipSchema','901935VafPij','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','data','rule','length','INVALID_RULE_TYPE','2YKryjq','.source','MISSING_NAME','.filter','document','3387472BkkjCN','11bNvuBU','7Onfyaw','66ADNciB','12FBBxpi','map','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','path','121010RxoxiU','code','MISSING_TIME_UNIT','MISSING_SEGMENT_REFERENCE','70376jXBJKU','match','INVALID_OPERATOR_TYPE','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','.attribute','type','name','BEHAVIOR_SOURCE_MISSING_FILTER','NESTED_CONDITION_GROUP','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','.conditions','safeParse','level','aggregation','issues','validationCode','.conditions[','error','invalid_value','Attribute\x20\x27','EMPTY_ATTRIBUTE','13498404VfUKuR','.operator.value'];a155_0x2e3d=function(){return _0x28aa7a;};return a155_0x2e3d();}function checkConditions(_0x251c76,_0x56d9ee,_0x150a84){const _0x210fab=a155_0x36ac,_0x448fbe=[];for(let _0x40ca9b=0x0;_0x40ca9b<_0x251c76[_0x210fab(0x11e)];_0x40ca9b++){const _0x41021d=_0x251c76[_0x40ca9b],_0x4f1c95=_0x56d9ee+_0x210fab(0xfa)+_0x40ca9b+']';_0x448fbe[_0x210fab(0x107)](...checkCondition(_0x41021d,_0x4f1c95,_0x150a84));}return _0x448fbe;}function checkCondition(_0x47fdd9,_0x3d4c69,_0x413a26){const _0x3743a3=a155_0x36ac,_0x1e2f04=[];if(_0x47fdd9[_0x3743a3(0x137)]===_0x3743a3(0x10b)||_0x47fdd9[_0x3743a3(0x137)]==='Or')return _0x47fdd9[_0x3743a3(0x117)][_0x3743a3(0x11e)]===0x0?_0x1e2f04[_0x3743a3(0x107)]({'level':_0x3743a3(0xfb),'path':_0x3d4c69+_0x3743a3(0xf4),'code':'EMPTY_CONDITIONS','message':_0x47fdd9[_0x3743a3(0x137)]+_0x3743a3(0xf3),'location':getLocationFromPath(_0x413a26[_0x3743a3(0x124)],_0x413a26[_0x3743a3(0x10a)],pathToArray(_0x3d4c69+_0x3743a3(0xf4)))}):(_0x1e2f04['push']({'level':_0x3743a3(0x114),'path':_0x3d4c69,'code':_0x3743a3(0xf2),'message':_0x47fdd9['type']+'\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20'+_0x3743a3(0x110)+'conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','location':getLocationFromPath(_0x413a26[_0x3743a3(0x124)],_0x413a26[_0x3743a3(0x10a)],pathToArray(_0x3d4c69))}),_0x1e2f04['push'](...checkConditions(_0x47fdd9[_0x3743a3(0x117)],_0x3d4c69,_0x413a26))),_0x1e2f04;if(_0x47fdd9[_0x3743a3(0x137)]===_0x3743a3(0x102)||_0x47fdd9[_0x3743a3(0x137)]===_0x3743a3(0x103)){const _0x5680e4=_0x47fdd9,_0x23231c=_0x5680e4[_0x3743a3(0x10a)],_0x449583=_0x5680e4[_0x3743a3(0xf7)],_0x325254=_0x23231c||_0x449583;(!_0x5680e4[_0x3743a3(0x115)]||_0x5680e4['attribute']==='')&&(!_0x325254&&_0x1e2f04[_0x3743a3(0x107)]({'level':_0x3743a3(0xfb),'path':_0x3d4c69+_0x3743a3(0x136),'code':_0x3743a3(0xfe),'message':_0x3743a3(0x10d),'location':getLocationFromPath(_0x413a26[_0x3743a3(0x124)],_0x413a26['source'],pathToArray(_0x3d4c69+'.attribute'))}));_0x5680e4[_0x3743a3(0x105)]&&_0x1e2f04[_0x3743a3(0x107)](...checkRule(_0x5680e4[_0x3743a3(0x105)],_0x3d4c69+_0x3743a3(0x123),_0x413a26));if(_0x5680e4[_0x3743a3(0x10a)]){const _0x2d9c43=_0x5680e4['attribute']&&_0x5680e4[_0x3743a3(0x115)]!=='';_0x2d9c43&&!_0x5680e4['filter']&&_0x1e2f04[_0x3743a3(0x107)]({'level':_0x3743a3(0xfb),'path':_0x3d4c69+_0x3743a3(0x121),'code':_0x3743a3(0xf1),'message':_0x3743a3(0x109)+_0x5680e4[_0x3743a3(0x10a)]+_0x3743a3(0x104)+_0x5680e4['attribute']+'\x27\x20'+'requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20'+_0x3743a3(0x11b)+_0x3743a3(0x106),'location':getLocationFromPath(_0x413a26['document'],_0x413a26[_0x3743a3(0x10a)],pathToArray(_0x3d4c69+_0x3743a3(0x121)))}),_0x2d9c43&&_0x5680e4[_0x3743a3(0x105)]&&_0x1e2f04['push']({'level':_0x3743a3(0x114),'path':_0x3d4c69+'.attribute','code':_0x3743a3(0x135),'message':_0x3743a3(0xfd)+_0x5680e4['attribute']+'\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20'+_0x3743a3(0x12b),'location':getLocationFromPath(_0x413a26[_0x3743a3(0x124)],_0x413a26[_0x3743a3(0x10a)],pathToArray(_0x3d4c69+_0x3743a3(0x136)))});}}return _0x1e2f04;}
1
+ (function(_0x2174e1,_0x5f1574){const _0x56b012=a156_0x3016,_0x3a48ed=_0x2174e1();while(!![]){try{const _0x262190=-parseInt(_0x56b012(0x113))/0x1*(-parseInt(_0x56b012(0x119))/0x2)+-parseInt(_0x56b012(0xfd))/0x3*(-parseInt(_0x56b012(0x128))/0x4)+-parseInt(_0x56b012(0xfb))/0x5*(-parseInt(_0x56b012(0x129))/0x6)+-parseInt(_0x56b012(0x12a))/0x7+parseInt(_0x56b012(0xf1))/0x8+-parseInt(_0x56b012(0x123))/0x9+-parseInt(_0x56b012(0x127))/0xa*(-parseInt(_0x56b012(0x115))/0xb);if(_0x262190===_0x5f1574)break;else _0x3a48ed['push'](_0x3a48ed['shift']());}catch(_0x36c74c){_0x3a48ed['push'](_0x3a48ed['shift']());}}}(a156_0x5b1f,0x5cfcf));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x28cc4c,_0x16f326={},_0xb51d4d={}){const _0x403a30=a156_0x3016;if(_0xb51d4d[_0x403a30(0x114)])return runSemanticChecks(_0x28cc4c,_0x16f326);const _0x5acf9c=SegmentDefSchema[_0x403a30(0x131)](_0x28cc4c);if(_0x5acf9c[_0x403a30(0xf3)])return runSemanticChecks(_0x5acf9c[_0x403a30(0x112)],_0x16f326);return zodErrorsToValidationResult(_0x5acf9c['error'],_0x16f326);}function a156_0x5b1f(){const _0x5cec4a=['SEGMENT_SCHEMA_ERROR','rule.type','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','endsWith','5679585dAtmzl','.conditions','MISSING_OPERATOR_VALUE','.conditions[','380vDtnQu','98252QoNGpV','6qLzAvC','3114237qvWgqO','MISSING_BETWEEN_BOUNDS','message','arrayMatching','params','EMPTY_CONDITIONS','rule','safeParse','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','Attribute\x20name\x20cannot\x20be\x20empty','Behavior','map','MISSING_SEGMENT_REFERENCE','conditions','document','5038776VaqTQJ','.attribute','success','level','filter','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','INVALID_OPERATOR_TYPE','includes','match','Attribute\x20\x27','689435GwqpHi','MISSING_TIME_UNIT','57NJZCWB','path','type','error','name','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','push','source','attribute','INVALID_ARRAY_MATCHING','Value','.filter','aggregation','.source','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','.operator.type','warning','issues','code','length','BEHAVIOR_SOURCE_MISSING_FILTER','data','450BPUNGU','skipSchema','46013buRYDM','validationCode','.segment','.type','282oEkaGu','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','EMPTY_ATTRIBUTE','And','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20'];a156_0x5b1f=function(){return _0x5cec4a;};return a156_0x5b1f();}function a156_0x3016(_0x2481c9,_0x79dea5){_0x2481c9=_0x2481c9-0xed;const _0x5b1f27=a156_0x5b1f();let _0x3016ad=_0x5b1f27[_0x2481c9];return _0x3016ad;}export function validateRuleDef(_0x42acb8,_0x4a7136,_0x1bead0){const _0xf76c6e=a156_0x3016;if(!_0x42acb8)return[];const _0x568127=RuleDefSchema[_0xf76c6e(0x131)](_0x42acb8);if(_0x568127[_0xf76c6e(0xf3)])return checkRule(_0x568127[_0xf76c6e(0x112)],_0x4a7136,_0x1bead0);const _0x101fb2=flattenZodIssues(_0x568127[_0xf76c6e(0x100)]['issues']);return _0x101fb2[_0xf76c6e(0xed)](_0x26e53c=>{const _0x155f1a=_0xf76c6e,_0x502243=formatZodPath(_0x26e53c[_0x155f1a(0xfe)]),_0x33afe2=_0x502243?_0x4a7136+'.'+_0x502243:_0x4a7136,_0x3d3e5e=mapZodIssueToCode(_0x26e53c,_0x502243),_0x510ee3=getLocationFromPath(_0x1bead0['document'],_0x1bead0['source'],pathToArray(_0x33afe2));return{'level':'error','path':_0x33afe2,'code':_0x3d3e5e,'message':_0x26e53c[_0x155f1a(0x12c)],..._0x510ee3&&{'location':_0x510ee3}};});}function zodErrorsToValidationResult(_0xddde3e,_0x5e5d26){const _0x2cd9a3=a156_0x3016,_0x40b354=flattenZodIssues(_0xddde3e[_0x2cd9a3(0x10e)]),_0x32e4ae=_0x40b354[_0x2cd9a3(0xed)](_0x33df7a=>{const _0x550f5b=_0x2cd9a3,_0x4e604d=formatZodPath(_0x33df7a['path']),_0x13b53d=mapZodIssueToCode(_0x33df7a,_0x4e604d),_0x248975=getLocationFromPath(_0x5e5d26[_0x550f5b(0xf0)],_0x5e5d26[_0x550f5b(0x104)],_0x33df7a['path']['map'](_0xb51507=>typeof _0xb51507==='symbol'?String(_0xb51507):_0xb51507));return{'level':_0x550f5b(0x100),'path':_0x4e604d,'code':_0x13b53d,'message':_0x33df7a[_0x550f5b(0x12c)],..._0x248975&&{'location':_0x248975}};});return{'valid':![],'errors':_0x32e4ae,'warnings':[]};}function mapZodIssueToCode(_0x40df2f,_0x40d8ff){const _0x410b34=a156_0x3016,_0xb1dd0b=_0x40df2f['code']==='custom'?_0x40df2f[_0x410b34(0x12e)]:undefined;if(_0x40d8ff===_0x410b34(0x101))return'MISSING_NAME';if(_0x40d8ff===_0x410b34(0x11f)||_0x40d8ff[_0x410b34(0x122)](_0x410b34(0x118))){if(_0x40df2f[_0x410b34(0x10f)]==='invalid_value'){if(_0x40d8ff==='rule.type'||_0x40d8ff[_0x410b34(0xf9)](/\.conditions\[\d+\]\.type$/))return'INVALID_RULE_TYPE';}}if(_0x40d8ff[_0x410b34(0x122)](_0x410b34(0x10c)))return _0x410b34(0xf7);if(_0x40d8ff[_0x410b34(0x122)]('.operator.value'))return _0x410b34(0x125);if(_0xb1dd0b?.[_0x410b34(0x116)]===_0x410b34(0x12b))return _0x410b34(0x12b);if(_0xb1dd0b?.[_0x410b34(0x116)]===_0x410b34(0xfc))return _0x410b34(0xfc);if(_0x40d8ff[_0x410b34(0x122)]('.conditions')||_0x40d8ff===_0x410b34(0xef))return'MISSING_CONDITIONS';if(_0x40d8ff[_0x410b34(0xf8)](_0x410b34(0x12d)))return _0x410b34(0x106);if(_0x40d8ff[_0x410b34(0x122)](_0x410b34(0x117)))return _0x410b34(0xee);return _0x410b34(0x11e);}function runSemanticChecks(_0x42527c,_0x5554ab){const _0x73c3a9=a156_0x3016,_0x417abc=[];_0x42527c[_0x73c3a9(0x130)]&&_0x417abc[_0x73c3a9(0x103)](...checkRule(_0x42527c['rule'],_0x73c3a9(0x130),_0x5554ab));const _0x359f8b=_0x417abc['filter'](_0x495fff=>_0x495fff[_0x73c3a9(0xf4)]===_0x73c3a9(0x100)),_0x2dd493=_0x417abc[_0x73c3a9(0xf5)](_0xc4a680=>_0xc4a680[_0x73c3a9(0xf4)]==='warning');return{'valid':_0x359f8b[_0x73c3a9(0x110)]===0x0,'errors':_0x359f8b,'warnings':_0x2dd493};}function checkRule(_0x5a6602,_0x4d4370,_0x4cbb92){const _0x2747c0=a156_0x3016,_0x30709b=[];if(_0x5a6602[_0x2747c0(0xef)][_0x2747c0(0x110)]===0x0)return _0x30709b[_0x2747c0(0x103)]({'level':'error','path':_0x4d4370+_0x2747c0(0x124),'code':_0x2747c0(0x12f),'message':'Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','location':getLocationFromPath(_0x4cbb92['document'],_0x4cbb92['source'],pathToArray(_0x4d4370+_0x2747c0(0x124)))}),_0x30709b;return _0x30709b[_0x2747c0(0x103)](...checkConditions(_0x5a6602['conditions'],_0x4d4370,_0x4cbb92)),_0x30709b;}function checkConditions(_0x17bfd2,_0x112df6,_0x3ec4cd){const _0x6b691=a156_0x3016,_0x3230f7=[];for(let _0x588f41=0x0;_0x588f41<_0x17bfd2[_0x6b691(0x110)];_0x588f41++){const _0x4aca3f=_0x17bfd2[_0x588f41],_0x5c66d2=_0x112df6+_0x6b691(0x126)+_0x588f41+']';_0x3230f7['push'](...checkCondition(_0x4aca3f,_0x5c66d2,_0x3ec4cd));}return _0x3230f7;}function checkCondition(_0x39081a,_0x2b26b7,_0x154876){const _0x2cf319=a156_0x3016,_0xf043b7=[];if(_0x39081a[_0x2cf319(0xff)]===_0x2cf319(0x11c)||_0x39081a[_0x2cf319(0xff)]==='Or')return _0x39081a[_0x2cf319(0xef)][_0x2cf319(0x110)]===0x0?_0xf043b7[_0x2cf319(0x103)]({'level':_0x2cf319(0x100),'path':_0x2b26b7+_0x2cf319(0x124),'code':_0x2cf319(0x12f),'message':_0x39081a['type']+_0x2cf319(0x10b),'location':getLocationFromPath(_0x154876['document'],_0x154876[_0x2cf319(0x104)],pathToArray(_0x2b26b7+_0x2cf319(0x124)))}):(_0xf043b7['push']({'level':_0x2cf319(0x10d),'path':_0x2b26b7,'code':'NESTED_CONDITION_GROUP','message':_0x39081a[_0x2cf319(0xff)]+'\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20'+'condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20'+_0x2cf319(0x102),'location':getLocationFromPath(_0x154876[_0x2cf319(0xf0)],_0x154876['source'],pathToArray(_0x2b26b7))}),_0xf043b7[_0x2cf319(0x103)](...checkConditions(_0x39081a[_0x2cf319(0xef)],_0x2b26b7,_0x154876))),_0xf043b7;if(_0x39081a[_0x2cf319(0xff)]===_0x2cf319(0x107)||_0x39081a[_0x2cf319(0xff)]===_0x2cf319(0x134)){const _0x57b083=_0x39081a,_0x381122=_0x57b083[_0x2cf319(0x104)],_0x49fd08=_0x57b083[_0x2cf319(0x109)],_0x45fff1=_0x381122||_0x49fd08;(!_0x57b083[_0x2cf319(0x105)]||_0x57b083[_0x2cf319(0x105)]==='')&&(!_0x45fff1&&_0xf043b7[_0x2cf319(0x103)]({'level':_0x2cf319(0x100),'path':_0x2b26b7+_0x2cf319(0xf2),'code':_0x2cf319(0x11b),'message':_0x2cf319(0x133),'location':getLocationFromPath(_0x154876[_0x2cf319(0xf0)],_0x154876[_0x2cf319(0x104)],pathToArray(_0x2b26b7+_0x2cf319(0xf2)))}));_0x57b083['filter']&&_0xf043b7['push'](...checkRule(_0x57b083[_0x2cf319(0xf5)],_0x2b26b7+_0x2cf319(0x108),_0x154876));if(_0x57b083['source']){const _0x3f3cc7=_0x57b083[_0x2cf319(0x105)]&&_0x57b083['attribute']!=='';_0x3f3cc7&&!_0x57b083[_0x2cf319(0xf5)]&&_0xf043b7[_0x2cf319(0x103)]({'level':_0x2cf319(0x100),'path':_0x2b26b7+_0x2cf319(0x10a),'code':_0x2cf319(0x111),'message':'Behavior\x20source\x20\x27'+_0x57b083['source']+'\x27\x20with\x20attribute\x20\x27'+_0x57b083['attribute']+'\x27\x20'+_0x2cf319(0x121)+_0x2cf319(0x132)+_0x2cf319(0x11a),'location':getLocationFromPath(_0x154876[_0x2cf319(0xf0)],_0x154876[_0x2cf319(0x104)],pathToArray(_0x2b26b7+'.source'))}),_0x3f3cc7&&_0x57b083['filter']&&_0xf043b7[_0x2cf319(0x103)]({'level':_0x2cf319(0x10d),'path':_0x2b26b7+_0x2cf319(0xf2),'code':_0x2cf319(0xf6),'message':_0x2cf319(0xfa)+_0x57b083['attribute']+_0x2cf319(0x11d)+_0x2cf319(0x120),'location':getLocationFromPath(_0x154876[_0x2cf319(0xf0)],_0x154876[_0x2cf319(0x104)],pathToArray(_0x2b26b7+_0x2cf319(0xf2)))});}}return _0xf043b7;}