@treasuredata/tdx 2026.3.27 → 2026.3.28

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 (222) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/auth-login-command.js +1 -1
  13. package/dist/commands/chat-command.js +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-statusline-command.js +1 -1
  16. package/dist/commands/claude-usage-command.js +1 -1
  17. package/dist/commands/command.js +1 -1
  18. package/dist/commands/connection-command.js +1 -1
  19. package/dist/commands/databases.js +1 -1
  20. package/dist/commands/delivery-command.js +1 -1
  21. package/dist/commands/describe.js +1 -1
  22. package/dist/commands/engage-campaign-pull-command.js +1 -1
  23. package/dist/commands/engage-campaign-push-command.js +1 -1
  24. package/dist/commands/engage-campaign-validate-command.js +1 -1
  25. package/dist/commands/engage-command.js +1 -1
  26. package/dist/commands/engage-template-pull-command.js +1 -1
  27. package/dist/commands/engage-template-push-command.js +1 -1
  28. package/dist/commands/engage-template-validate-command.js +1 -1
  29. package/dist/commands/job-command.js +1 -1
  30. package/dist/commands/journey-command.js +1 -1
  31. package/dist/commands/journey-validate-command.js +1 -1
  32. package/dist/commands/llm-command.js +1 -1
  33. package/dist/commands/mcp-command.js +1 -1
  34. package/dist/commands/parent-segment-command.d.ts +141 -2
  35. package/dist/commands/parent-segment-command.d.ts.map +1 -1
  36. package/dist/commands/parent-segment-command.js +1 -1
  37. package/dist/commands/parent-segment-command.js.map +1 -1
  38. package/dist/commands/policy-command.js +1 -1
  39. package/dist/commands/profile-command.js +1 -1
  40. package/dist/commands/profiles-command.js +1 -1
  41. package/dist/commands/query-command.js +1 -1
  42. package/dist/commands/schedule-command.js +1 -1
  43. package/dist/commands/segment-command.js +1 -1
  44. package/dist/commands/segment-create-command.js +1 -1
  45. package/dist/commands/segment-fields-command.js +1 -1
  46. package/dist/commands/segment-pull-command.js +1 -1
  47. package/dist/commands/segment-push-command.js +1 -1
  48. package/dist/commands/segment-update-command.js +1 -1
  49. package/dist/commands/segment-use-command.js +1 -1
  50. package/dist/commands/segment-validate-command.js +1 -1
  51. package/dist/commands/segments.js +1 -1
  52. package/dist/commands/show.js +1 -1
  53. package/dist/commands/status-command.js +1 -1
  54. package/dist/commands/tables.js +1 -1
  55. package/dist/commands/unset-command.js +1 -1
  56. package/dist/commands/upgrade-command.js +1 -1
  57. package/dist/commands/use-command.js +1 -1
  58. package/dist/commands/user-command.js +1 -1
  59. package/dist/commands/workflow-command.js +1 -1
  60. package/dist/core/auth.js +1 -1
  61. package/dist/core/command-output.js +1 -1
  62. package/dist/core/config.js +1 -1
  63. package/dist/core/connection-cache.js +1 -1
  64. package/dist/core/constants.js +1 -1
  65. package/dist/core/credential-cache.js +1 -1
  66. package/dist/core/global-context.js +1 -1
  67. package/dist/core/keychain.js +1 -1
  68. package/dist/core/oauth-keychain.js +1 -1
  69. package/dist/core/oauth.js +1 -1
  70. package/dist/core/profile.js +1 -1
  71. package/dist/core/project-config.js +1 -1
  72. package/dist/core/session.js +1 -1
  73. package/dist/core/user-cache.js +1 -1
  74. package/dist/core/version.js +1 -1
  75. package/dist/index.js +1 -1
  76. package/dist/mcp/server.js +1 -1
  77. package/dist/mcp/tools/index.js +1 -1
  78. package/dist/mcp/tools/tdx-run.js +1 -1
  79. package/dist/mcp/tools/tdx-search.js +1 -1
  80. package/dist/mcp/utils.js +1 -1
  81. package/dist/proxy/claude-usage-tracker.js +1 -1
  82. package/dist/proxy/passthrough-server.js +1 -1
  83. package/dist/proxy/sse-usage-parser.js +1 -1
  84. package/dist/sdk/agent/agent-config.js +1 -1
  85. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  86. package/dist/sdk/agent/agent-yaml.js +1 -1
  87. package/dist/sdk/agent/test/evaluator.js +1 -1
  88. package/dist/sdk/agent/test/executor.js +1 -1
  89. package/dist/sdk/agent/test/index.js +1 -1
  90. package/dist/sdk/agent/test/output.js +1 -1
  91. package/dist/sdk/agent/test/parser.js +1 -1
  92. package/dist/sdk/agent/tool-target-registry.js +1 -1
  93. package/dist/sdk/api.js +1 -1
  94. package/dist/sdk/client/cdp-api-client.d.ts +29 -1
  95. package/dist/sdk/client/cdp-api-client.d.ts.map +1 -1
  96. package/dist/sdk/client/cdp-api-client.js +1 -1
  97. package/dist/sdk/client/cdp-api-client.js.map +1 -1
  98. package/dist/sdk/client/delivery-api-client.js +1 -1
  99. package/dist/sdk/client/endpoints.js +1 -1
  100. package/dist/sdk/client/engage-api-client.js +1 -1
  101. package/dist/sdk/client/http-client.js +1 -1
  102. package/dist/sdk/client/llm-api-client.js +1 -1
  103. package/dist/sdk/client/oauth-refresh.js +1 -1
  104. package/dist/sdk/client/rate-limiter.js +1 -1
  105. package/dist/sdk/client/td-api-client.js +1 -1
  106. package/dist/sdk/client/trino-api-client.js +1 -1
  107. package/dist/sdk/client/workflow-client.js +1 -1
  108. package/dist/sdk/connection-validator.js +1 -1
  109. package/dist/sdk/connection.js +1 -1
  110. package/dist/sdk/delivery.js +1 -1
  111. package/dist/sdk/engage/campaign-pull.js +1 -1
  112. package/dist/sdk/engage/campaign-push.js +1 -1
  113. package/dist/sdk/engage/campaign-validator.js +1 -1
  114. package/dist/sdk/engage/campaign-yaml.js +1 -1
  115. package/dist/sdk/engage/template-pull.js +1 -1
  116. package/dist/sdk/engage/template-push.js +1 -1
  117. package/dist/sdk/engage/template-validator.js +1 -1
  118. package/dist/sdk/engage/template-yaml.js +1 -1
  119. package/dist/sdk/engage/types/campaign-def.js +1 -1
  120. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  121. package/dist/sdk/engage/types/template-schema.js +1 -1
  122. package/dist/sdk/engage.js +1 -1
  123. package/dist/sdk/errors.js +1 -1
  124. package/dist/sdk/index.js +1 -1
  125. package/dist/sdk/io/index.js +1 -1
  126. package/dist/sdk/io/node-filesystem.js +1 -1
  127. package/dist/sdk/job.js +1 -1
  128. package/dist/sdk/journey.js +1 -1
  129. package/dist/sdk/llm/chat-cache.js +1 -1
  130. package/dist/sdk/llm/index.js +1 -1
  131. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  132. package/dist/sdk/llm/model-factors.js +1 -1
  133. package/dist/sdk/personalization.d.ts +228 -0
  134. package/dist/sdk/personalization.d.ts.map +1 -1
  135. package/dist/sdk/personalization.js +1 -1
  136. package/dist/sdk/personalization.js.map +1 -1
  137. package/dist/sdk/policy.js +1 -1
  138. package/dist/sdk/query/index.js +1 -1
  139. package/dist/sdk/query/sql-parser.js +1 -1
  140. package/dist/sdk/realtime.d.ts +57 -0
  141. package/dist/sdk/realtime.d.ts.map +1 -1
  142. package/dist/sdk/realtime.js +1 -1
  143. package/dist/sdk/realtime.js.map +1 -1
  144. package/dist/sdk/schedule.js +1 -1
  145. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  146. package/dist/sdk/segment/fields-display.js +1 -1
  147. package/dist/sdk/segment/file-discovery.js +1 -1
  148. package/dist/sdk/segment/journey-utils.js +1 -1
  149. package/dist/sdk/segment/journey-validator.js +1 -1
  150. package/dist/sdk/segment/journey-yaml.js +1 -1
  151. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  152. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  153. package/dist/sdk/segment/pull-workflow.js +1 -1
  154. package/dist/sdk/segment/push-recovery.js +1 -1
  155. package/dist/sdk/segment/push-workflow.js +1 -1
  156. package/dist/sdk/segment/resolution-context.js +1 -1
  157. package/dist/sdk/segment/segment-path-parser.js +1 -1
  158. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  159. package/dist/sdk/segment/segment-validator.js +1 -1
  160. package/dist/sdk/segment/target-resolution.js +1 -1
  161. package/dist/sdk/segment/tdx-config.js +1 -1
  162. package/dist/sdk/segment/types/activation-schema.js +1 -1
  163. package/dist/sdk/segment/types/journey-def.js +1 -1
  164. package/dist/sdk/segment/types/journey-schema.js +1 -1
  165. package/dist/sdk/segment/types/segment-def.js +1 -1
  166. package/dist/sdk/segment/types/segment-schema.js +1 -1
  167. package/dist/sdk/segment/validate-files.js +1 -1
  168. package/dist/sdk/segment/yaml-validator.js +1 -1
  169. package/dist/sdk/segment.js +1 -1
  170. package/dist/sdk/types/cdp.d.ts +76 -0
  171. package/dist/sdk/types/cdp.d.ts.map +1 -1
  172. package/dist/sdk/types/index.d.ts +1 -1
  173. package/dist/sdk/types/index.d.ts.map +1 -1
  174. package/dist/sdk/types/index.js +1 -1
  175. package/dist/sdk/types/index.js.map +1 -1
  176. package/dist/sdk/types/progress.js +1 -1
  177. package/dist/sdk/user.js +1 -1
  178. package/dist/sdk/util/format-detector.js +1 -1
  179. package/dist/sdk/util/formatters.js +1 -1
  180. package/dist/sdk/util/index.js +1 -1
  181. package/dist/sdk/util/paginate.js +1 -1
  182. package/dist/sdk/util/tree-formatter.js +1 -1
  183. package/dist/sdk/workflow/archive-validation.js +1 -1
  184. package/dist/sdk/workflow/clone-workflow.js +1 -1
  185. package/dist/sdk/workflow/index.js +1 -1
  186. package/dist/sdk/workflow/pull-workflow.js +1 -1
  187. package/dist/sdk/workflow/push-workflow.js +1 -1
  188. package/dist/sdk/workflow/tdx-config.js +1 -1
  189. package/dist/sdk/workflow/workflow-utils.js +1 -1
  190. package/dist/test-utils/command-runner.js +1 -1
  191. package/dist/test-utils/factories.js +1 -1
  192. package/dist/test-utils/fixtures.js +1 -1
  193. package/dist/test-utils/http-mock.js +1 -1
  194. package/dist/test-utils/index.js +1 -1
  195. package/dist/utils/async.js +1 -1
  196. package/dist/utils/colors.js +1 -1
  197. package/dist/utils/diff.js +1 -1
  198. package/dist/utils/file-permissions.js +1 -1
  199. package/dist/utils/file-reader.js +1 -1
  200. package/dist/utils/github-releases.js +1 -1
  201. package/dist/utils/global-cache.js +1 -1
  202. package/dist/utils/json-loader.js +1 -1
  203. package/dist/utils/local-cache.js +1 -1
  204. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  205. package/dist/utils/logger/formatters/index.js +1 -1
  206. package/dist/utils/logger/handlers/console-handler.js +1 -1
  207. package/dist/utils/logger/handlers/file-handler.js +1 -1
  208. package/dist/utils/logger/handlers/index.js +1 -1
  209. package/dist/utils/logger/handlers/null-handler.js +1 -1
  210. package/dist/utils/logger/index.js +1 -1
  211. package/dist/utils/logger/logger.js +1 -1
  212. package/dist/utils/logger/types.js +1 -1
  213. package/dist/utils/option-validation.js +1 -1
  214. package/dist/utils/process.js +1 -1
  215. package/dist/utils/prompt.js +1 -1
  216. package/dist/utils/spinner.js +1 -1
  217. package/dist/utils/sse-parser.js +1 -1
  218. package/dist/utils/string-utils.js +1 -1
  219. package/dist/utils/table-ref-parser.js +1 -1
  220. package/dist/utils/tdx-logger.js +1 -1
  221. package/dist/utils/version-check.js +1 -1
  222. package/package.json +1 -1
@@ -1 +1 @@
1
- const a142_0x119b8a=a142_0x3007;(function(_0x1ca649,_0x2dfb32){const _0x30c3e6=a142_0x3007,_0x4b7dee=_0x1ca649();while(!![]){try{const _0x4cabf0=parseInt(_0x30c3e6(0x220))/0x1+-parseInt(_0x30c3e6(0x27a))/0x2+-parseInt(_0x30c3e6(0x264))/0x3+parseInt(_0x30c3e6(0x1c6))/0x4+-parseInt(_0x30c3e6(0x214))/0x5*(-parseInt(_0x30c3e6(0x2b4))/0x6)+-parseInt(_0x30c3e6(0x1c2))/0x7+-parseInt(_0x30c3e6(0x1ef))/0x8*(-parseInt(_0x30c3e6(0x267))/0x9);if(_0x4cabf0===_0x2dfb32)break;else _0x4b7dee['push'](_0x4b7dee['shift']());}catch(_0x551b5e){_0x4b7dee['push'](_0x4b7dee['shift']());}}}(a142_0x2b21,0x2287b));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a142_0x119b8a(0x1fc));export const PENDING_SEGMENT_PREFIX=a142_0x119b8a(0x204);export const PENDING_ACTIVATION_PREFIX=a142_0x119b8a(0x235);export function createPendingSegmentId(_0xaef6a3){return''+PENDING_SEGMENT_PREFIX+_0xaef6a3+'__';}export function isPendingSegmentId(_0x2513ee){const _0x5cef88=a142_0x119b8a;return _0x2513ee[_0x5cef88(0x218)](PENDING_SEGMENT_PREFIX)&&!_0x2513ee[_0x5cef88(0x218)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x282171){return _0x282171['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x42dde0){return''+PENDING_ACTIVATION_PREFIX+_0x42dde0+'__';}export function isPendingActivationId(_0x3ace21){return _0x3ace21['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x238eca){return _0x238eca['replace'](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x2ae7d0,_0x58486a){const _0x31f91d=a142_0x119b8a,_0x1ed5e3=_0x2ae7d0+'::'+(_0x58486a[_0x31f91d(0x28e)]()||_0x31f91d(0x1ea)),_0x5cf252=createHash(_0x31f91d(0x27c))['update'](_0x1ed5e3)[_0x31f91d(0x1d4)]('hex')['slice'](0x0,0xc);return'journey_entry_criteria_'+_0x5cf252;}export function ensureJourneyDefaults(_0x52c78b){const _0x2233a9=a142_0x119b8a;!_0x52c78b[_0x2233a9(0x243)]&&(_0x52c78b[_0x2233a9(0x243)]=''),!_0x52c78b[_0x2233a9(0x2ae)]&&(_0x52c78b['state']=_0x2233a9(0x27f));}export function injectExistingStageIds(_0x51d2ea,_0x40657a){const _0x42844c=a142_0x119b8a,_0x43fa12=new Map(_0x40657a['map'](_0x138069=>[_0x138069[_0x42844c(0x1d5)],_0x138069['id']]));for(const _0xf97af of _0x51d2ea){if(!_0xf97af['id']){const _0x5b5ad0=_0x43fa12[_0x42844c(0x255)](_0xf97af[_0x42844c(0x1d5)]);_0x5b5ad0&&(_0xf97af['id']=_0x5b5ad0);}}}export function resolveTDFolderPath(_0xdcf848,_0xbf2583,_0x3b9b11){const _0x1da9c8=a142_0x119b8a;if(!_0xbf2583)return _0xdcf848;if(_0xdcf848===_0x3b9b11||_0xdcf848[_0x1da9c8(0x218)](_0x3b9b11+'/'))return _0xdcf848;return _0xdcf848?_0x3b9b11+'/'+_0xdcf848:_0x3b9b11;}export function addFoldersToCreate(_0x1389b1,_0x25a50e,_0x1d95bc){const _0x22af9e=a142_0x119b8a;if(!_0x1389b1)return;if(_0x25a50e[_0x22af9e(0x215)](_0x1389b1))return;const _0x3eb2c5=_0x1389b1[_0x22af9e(0x29e)]('/');let _0x272eca='';for(const _0x3fc1d4 of _0x3eb2c5){_0x272eca=_0x272eca?_0x272eca+'/'+_0x3fc1d4:_0x3fc1d4,!_0x25a50e[_0x22af9e(0x215)](_0x272eca)&&_0x1d95bc[_0x22af9e(0x1e8)](_0x272eca);}}export function sortFoldersByDepth(_0x423ce8){const _0x4a6f62=a142_0x119b8a;return[..._0x423ce8][_0x4a6f62(0x1f4)]((_0x4a11b8,_0x556978)=>{const _0xcfed2e=_0x4a6f62,_0x1a4fd2=(_0x4a11b8[_0xcfed2e(0x2b6)](/\//g)||[])['length'],_0x1312d9=(_0x556978[_0xcfed2e(0x2b6)](/\//g)||[])[_0xcfed2e(0x207)];return _0x1a4fd2-_0x1312d9;});}import*as a142_0x47e672 from'yaml';import{readFileSync}from'fs';import a142_0x23e26b from'path';import{isJourneyDef,parseYamlString as a142_0x1b9769,toYamlString as a142_0x407e51,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(_0x36a6be){const _0xddeddc=a142_0x119b8a;if(Array[_0xddeddc(0x1d9)](_0x36a6be))return'['+_0x36a6be[_0xddeddc(0x2b1)](_0x456f62=>stableStringify(_0x456f62))[_0xddeddc(0x265)](',')+']';if(_0x36a6be&&typeof _0x36a6be===_0xddeddc(0x20c)){const _0x17e111=_0x36a6be,_0xdacedf=Object['keys'](_0x17e111)['sort'](),_0x19cb16=_0xdacedf[_0xddeddc(0x2b1)](_0x5ec1eb=>'\x22'+_0x5ec1eb+'\x22:'+stableStringify(_0x17e111[_0x5ec1eb]));return'{'+_0x19cb16['join'](',')+'}';}const _0x138825=JSON[_0xddeddc(0x2a6)](_0x36a6be);return _0x138825===undefined?_0xddeddc(0x210):_0x138825;}function activationSignature(_0x40b23f){const _0x1ea233=a142_0x119b8a,_0x242109={'connection':_0x40b23f['connection'],..._0x40b23f[_0x1ea233(0x292)]!==undefined&&{'all_columns':_0x40b23f[_0x1ea233(0x292)]},..._0x40b23f[_0x1ea233(0x21d)]!==undefined&&{'columns':_0x40b23f[_0x1ea233(0x21d)]},..._0x40b23f[_0x1ea233(0x25d)]!==undefined&&{'behavior':_0x40b23f[_0x1ea233(0x25d)]},..._0x40b23f[_0x1ea233(0x219)]!==undefined&&{'schedule':_0x40b23f['schedule']},..._0x40b23f[_0x1ea233(0x28f)]!==undefined&&{'notification':_0x40b23f[_0x1ea233(0x28f)]},..._0x40b23f[_0x1ea233(0x1f3)]!==undefined&&{'connector_config':_0x40b23f['connector_config']},..._0x40b23f[_0x1ea233(0x242)]!==undefined&&{'activation_template_id':_0x40b23f['activation_template_id']}};return stableStringify(_0x242109);}async function fetchSegment(_0xac2eba,_0x52ccc9,_0xe9a5de,_0x10074d){const _0x14e59c=a142_0x119b8a,_0x1dc9ae=_0x10074d?.[_0x14e59c(0x240)](_0x1fd81a=>_0x1fd81a['id']===_0xe9a5de);if(_0x1dc9ae)return _0x1dc9ae;try{return await _0xac2eba[_0x14e59c(0x1ea)][_0x14e59c(0x205)](_0x52ccc9,_0xe9a5de);}catch(_0x4eae08){logger['debug']('getSegment\x20failed\x20for\x20'+_0xe9a5de+_0x14e59c(0x1f0)+_0x4eae08);try{return await _0xac2eba[_0x14e59c(0x1ea)][_0x14e59c(0x2a4)](_0xe9a5de);}catch(_0x420dde){return logger[_0x14e59c(0x245)]('getSegmentEntity\x20also\x20failed\x20for\x20'+_0xe9a5de+':\x20'+_0x420dde),null;}}}function recoverSegmentIdsFromPushRecovery(_0x507d5d,_0x1d0f69,_0x298c9b){const _0x146744=a142_0x119b8a,_0xc50950=readPushRecovery(_0x507d5d[_0x146744(0x1c1)]);if(_0xc50950?.[_0x146744(0x25e)]===_0x507d5d[_0x146744(0x257)][_0x146744(0x1d5)])for(const [_0x190ec9,_0x2ad979]of Object['entries'](_0xc50950[_0x146744(0x1f7)])){const _0x35c1f9=generateDeterministicJourneySegmentName(_0x507d5d[_0x146744(0x257)][_0x146744(0x1d5)],_0x190ec9);_0x2ad979['uniqueServerName']===_0x35c1f9&&(_0x1d0f69[_0x146744(0x1e5)](_0x190ec9,_0x2ad979[_0x146744(0x278)]),_0x298c9b[_0x146744(0x1e5)](_0x190ec9,_0x2ad979[_0x146744(0x278)]));}}async function createOrRecoverEmbeddedSegment(_0x3aba1e,_0x5f4f58,_0x463c7a,_0x4d0606){const _0x2462d3=a142_0x119b8a;let _0x3270af;try{_0x3270af=await _0x3aba1e[_0x2462d3(0x1ea)][_0x2462d3(0x2a0)]({'name':_0x463c7a[_0x2462d3(0x1f6)],'description':_0x463c7a[_0x2462d3(0x243)],'journeyId':_0x463c7a[_0x2462d3(0x276)],'rule':_0x4d0606(_0x463c7a[_0x2462d3(0x1d2)],!![]),'countPopulation':!![],'parentFolderId':_0x463c7a[_0x2462d3(0x275)],'audienceId':_0x463c7a[_0x2462d3(0x24a)]});}catch(_0x81f540){const _0x30a9e4=_0x81f540 instanceof Error&&_0x81f540['message'][_0x2462d3(0x228)](_0x2462d3(0x234));if(_0x30a9e4){const _0x3cecee=readPushRecovery(_0x5f4f58[_0x2462d3(0x1c1)]),_0x29e3b1=_0x3cecee?.['journeyName']===_0x5f4f58[_0x2462d3(0x257)][_0x2462d3(0x1d5)]?_0x3cecee[_0x2462d3(0x1f7)][_0x463c7a[_0x2462d3(0x1be)]]:undefined;if(_0x29e3b1?.[_0x2462d3(0x288)]===_0x463c7a[_0x2462d3(0x1f6)])await _0x3aba1e[_0x2462d3(0x1ea)][_0x2462d3(0x25f)](_0x463c7a[_0x2462d3(0x24a)],_0x29e3b1['segmentId'],{'description':_0x463c7a['description'],'rule':_0x4d0606(_0x463c7a[_0x2462d3(0x1d2)],!![]),'countPopulation':!![]}),_0x3270af=_0x29e3b1[_0x2462d3(0x278)];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],_0x2462d3(0x253)+_0x463c7a[_0x2462d3(0x1be)]+_0x2462d3(0x258)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x5f4f58['absolutePath'][_0x2462d3(0x26e)](/([^/]+)$/,_0x2462d3(0x29d))+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x81f540);}else throw _0x81f540;}return saveSegmentToPushRecovery(_0x5f4f58['absolutePath'],_0x5f4f58[_0x2462d3(0x257)][_0x2462d3(0x1d5)],_0x463c7a[_0x2462d3(0x1be)],{'segmentId':_0x3270af,'uniqueServerName':_0x463c7a[_0x2462d3(0x1f6)],'createdAt':new Date()[_0x2462d3(0x1ce)]()}),_0x3270af;}export async function prepareSegmentFiles(_0x56101d,_0x6bcdd8,_0x3412a4,_0x3c71a4,_0x105684){const _0x1aa318=a142_0x119b8a,{activationDefToCreateRequest:_0x29a46a}=await import('./child-segment-yaml.js'),_0x5c0940=[],_0xf9bead=new Set();for(const {yamlConfig:_0x3f6c82,folderPath:_0x370875,sourcePath:_0x50160b}of _0x56101d){const _0x5cda9b=resolveTDFolderPath(_0x370875,_0x3c71a4,_0x105684),_0x1eacfc=_0x5cda9b+':'+_0x3f6c82['name'],_0x1b216b=_0x6bcdd8['segmentByFolderAndName'][_0x1aa318(0x255)](_0x1eacfc),_0x5ba356=_0x1b216b?_0x6bcdd8[_0x1aa318(0x272)][_0x1aa318(0x255)](_0x1b216b['id'])||[]:[];addFoldersToCreate(_0x5cda9b,_0x6bcdd8[_0x1aa318(0x2a2)],_0xf9bead);const _0x21006d=calculateActivationActions(_0x3f6c82[_0x1aa318(0x293)]||[],_0x5ba356,_0x6bcdd8['idToEmailMap'],_0x6bcdd8[_0x1aa318(0x1d1)]);for(const _0x4867b9 of _0x21006d){(_0x4867b9['type']===_0x1aa318(0x1cb)||_0x4867b9[_0x1aa318(0x1e7)]===_0x1aa318(0x1ee))&&_0x4867b9[_0x1aa318(0x287)]&&(_0x4867b9[_0x1aa318(0x1f2)]=await _0x29a46a(_0x4867b9[_0x1aa318(0x287)],_0x3412a4));}const _0x2171b7=calculateSegmentDiff(_0x3f6c82,_0x1b216b,_0x5ba356,_0x6bcdd8[_0x1aa318(0x29b)],_0x6bcdd8[_0x1aa318(0x1d1)]);_0x5c0940[_0x1aa318(0x23a)]({'relativePath':_0x3f6c82[_0x1aa318(0x1d5)],'absolutePath':_0x50160b,'yamlConfig':_0x3f6c82,'folderPath':_0x5cda9b,'existingSegment':_0x1b216b,'existingActivations':_0x5ba356,'isNew':_0x2171b7[_0x1aa318(0x1c0)],'hasChanges':_0x2171b7[_0x1aa318(0x295)],'diff':_0x2171b7['diff'],'activationActions':_0x21006d});}return{'segmentFiles':_0x5c0940,'foldersToCreate':_0xf9bead};}export async function prepareJourneyFiles(_0x1c5802,_0x57f358,_0x3c1597,_0x378126){const _0x47314f=a142_0x119b8a,_0x1956cd=[],_0x19aad1=new Set();for(const {yamlConfig:_0x5ada95,folderPath:_0x1b9ff0,sourcePath:_0x2fc5e5}of _0x1c5802){const _0x3be21f=resolveTDFolderPath(_0x1b9ff0,_0x3c1597,_0x378126),_0x52ed79=_0x3be21f+':'+_0x5ada95[_0x47314f(0x1d5)],_0x529e6f=_0x57f358[_0x47314f(0x290)]['get'](_0x52ed79);let _0x352ce3,_0x302d3a;if(_0x529e6f&&_0x529e6f['length']>0x0){const _0x1a2d1b=buildLocalExpandedRuleMappings(_0x5ada95),{createYamlContext:_0x503e91,prefetchJourneySegments:_0x2b6946}=createPushYamlContextForBundle(_0x57f358[_0x47314f(0x1bf)],_0x57f358[_0x47314f(0x24a)],_0x57f358[_0x47314f(0x281)],_0x1a2d1b,_0x57f358[_0x47314f(0x29b)],_0x57f358['connectionIdToNameMap'],_0x57f358[_0x47314f(0x22a)],_0x57f358[_0x47314f(0x232)]);await _0x2b6946(_0x529e6f[_0x47314f(0x2b1)](_0x9ac62e=>_0x9ac62e['id']));const _0x191ad3=await _0x57f358[_0x47314f(0x1bf)][_0x47314f(0x1fa)]['getLatestJourneyId'](_0x529e6f[0x0][_0x47314f(0x285)]),_0x44f31c=hasMultipleVersions(_0x5ada95),_0x450c2f=async _0x68171e=>{const _0x2c38bb=_0x47314f,_0xdd1270=_0x57f358[_0x2c38bb(0x232)]?.['get'](_0x68171e);if(_0xdd1270)return _0xdd1270;return _0x57f358['fetchJourney']({'journeyId':_0x68171e,'journeyName':_0x5ada95[_0x2c38bb(0x1d5)],'isMultiVersion':_0x529e6f[_0x2c38bb(0x207)]>0x1});};if(_0x44f31c&&_0x529e6f[_0x47314f(0x207)]>0x1){const _0x229b93=[];for(const _0x246627 of _0x529e6f){const _0x5f16c0=_0x246627[_0x47314f(0x20d)]||0x1;_0x57f358[_0x47314f(0x271)]?.[_0x47314f(0x1ee)]('Fetching\x20'+_0x5ada95[_0x47314f(0x1d5)]+'\x20v'+_0x5f16c0);const _0x320395=await _0x450c2f(_0x246627['id']),_0x4a7bed=_0x503e91(_0x246627['id']),_0x588f0b=await journeyResponseToDef(_0x320395,_0x4a7bed);_0x229b93['push']({'item':_0x246627,'yaml':_0x588f0b});}const _0x1f7fe7=buildLocalRuleToNameMappingFromJourney(_0x5ada95);_0x302d3a=buildMergedJourneyDef(_0x229b93,_0x1f7fe7,_0x191ad3);const _0x3e927f=Math[_0x47314f(0x259)](..._0x229b93[_0x47314f(0x2b1)](_0x3ce589=>_0x3ce589['item']['versionNumber']||0x0)),_0x33ad44=_0x529e6f[_0x47314f(0x240)](_0xc5d538=>(_0xc5d538[_0x47314f(0x20d)]||0x0)===_0x3e927f);_0x33ad44&&(_0x57f358[_0x47314f(0x271)]?.[_0x47314f(0x1ee)](_0x47314f(0x1c5)+_0x5ada95[_0x47314f(0x1d5)]+'\x20v'+_0x3e927f),_0x352ce3=await _0x450c2f(_0x33ad44['id']));}else{const _0x1615e2=_0x529e6f[_0x529e6f[_0x47314f(0x207)]-0x1];_0x57f358[_0x47314f(0x271)]?.[_0x47314f(0x1ee)](_0x47314f(0x1c5)+_0x5ada95[_0x47314f(0x1d5)]),_0x352ce3=await _0x450c2f(_0x1615e2['id']);const _0x71b6=_0x503e91(_0x1615e2['id']),_0x1b1af7=await journeyResponseToDef(_0x352ce3,_0x71b6),_0x4989f3=buildLocalRuleToNameMappingFromJourney(_0x5ada95);_0x302d3a=buildMergedJourneyDef([{'item':_0x1615e2,'yaml':_0x1b1af7}],_0x4989f3,_0x191ad3);}}addFoldersToCreate(_0x3be21f,_0x57f358[_0x47314f(0x2a2)],_0x19aad1);const _0x20e165=calculateJourneyDiff(_0x5ada95,_0x302d3a);_0x1956cd[_0x47314f(0x23a)]({'relativePath':_0x5ada95['name'],'absolutePath':_0x2fc5e5,'yamlConfig':_0x5ada95,'folderPath':_0x3be21f,'existingJourney':_0x352ce3,'isNew':_0x20e165[_0x47314f(0x1c0)],'hasChanges':_0x20e165['hasChanges'],'diff':_0x20e165['diff']});}return{'journeyFiles':_0x1956cd,'foldersToCreate':_0x19aad1};}export function calculateActivationActions(_0x29971f,_0x2ab93f,_0x444a06,_0x1e5c03){const _0x55b1e2=a142_0x119b8a,_0xd33262=[],_0x4837f3=new Map();for(const _0xdd6182 of _0x2ab93f){_0x4837f3['set'](_0xdd6182['name'],_0xdd6182);}const _0x51cfb0=new Map();for(const _0x373dd3 of _0x29971f){_0x51cfb0[_0x55b1e2(0x1e5)](_0x373dd3[_0x55b1e2(0x1d5)],_0x373dd3);}for(const _0x339181 of _0x29971f){const _0x2c8c19=_0x4837f3['get'](_0x339181[_0x55b1e2(0x1d5)]);if(!_0x2c8c19)_0xd33262[_0x55b1e2(0x23a)]({'type':_0x55b1e2(0x1cb),'name':_0x339181['name'],'yamlActivation':_0x339181});else{const _0x3739fd=activationResponseToDef(_0x2c8c19,_0x444a06,_0x1e5c03),_0x3dfbd4=a142_0x47e672[_0x55b1e2(0x2a6)](_0x3739fd),_0x50e6c7=a142_0x47e672[_0x55b1e2(0x2a6)](_0x339181);_0x3dfbd4!==_0x50e6c7&&_0xd33262['push']({'type':_0x55b1e2(0x1ee),'name':_0x339181['name'],'yamlActivation':_0x339181,'existingActivation':_0x2c8c19});}}for(const _0x564e00 of _0x2ab93f){!_0x51cfb0[_0x55b1e2(0x215)](_0x564e00[_0x55b1e2(0x1d5)])&&_0xd33262[_0x55b1e2(0x23a)]({'type':_0x55b1e2(0x2bc),'name':_0x564e00['name'],'existingActivation':_0x564e00});}return _0xd33262;}function calculateYamlDiff(_0x2e36c8,_0x5d374f){if(_0x5d374f){const _0xa5836=generateDiff(_0x5d374f,_0x2e36c8),_0x2be849=hasChanges(_0xa5836);return{'isNew':![],'hasChanges':_0x2be849,'diff':_0x2be849?formatDiffWithColors(_0xa5836):undefined};}const _0xb1d3a5=generateDiff('',_0x2e36c8);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0xb1d3a5)};}export function calculateSegmentDiff(_0x10e762,_0x1aeec1,_0x35620f,_0x162fde,_0x2b0891){const _0x30b5ee=segmentToYamlString(_0x10e762),_0x1e1e0b=_0x1aeec1?segmentToYamlString(segmentWithActivationsToYaml(_0x1aeec1,_0x35620f,undefined,_0x162fde,_0x2b0891)):undefined;return calculateYamlDiff(_0x30b5ee,_0x1e1e0b);}export function calculateJourneyDiff(_0x5487a2,_0x5df1ed){const _0x474042=normalizeJourneyDef(_0x5487a2,_0x5487a2),_0xe74bf2=a142_0x407e51(_0x474042),_0x43fc8d=_0x5df1ed?a142_0x407e51(normalizeJourneyDef(_0x5df1ed,_0x5487a2)):undefined;return calculateYamlDiff(_0xe74bf2,_0x43fc8d);}export function findSegmentsToDelete(_0x3a5ec5,_0x555379,_0x4c23f0,_0x4501f8,_0x295a2a){const _0x400828=a142_0x119b8a,_0x2d08fc=new Set();for(const {yamlConfig:_0x46304f,folderPath:_0x4976ca}of _0x555379){_0x2d08fc[_0x400828(0x1e8)](_0x4976ca+':'+_0x46304f[_0x400828(0x1d5)]);}return _0x3a5ec5[_0x400828(0x2be)](_0x112c06=>{const _0x552967=_0x400828,_0x5c8aeb=_0x112c06[_0x552967(0x21a)]?_0x4c23f0['get'](_0x112c06[_0x552967(0x21a)][_0x552967(0x283)]())||'':'',_0x33c524=_0x5c8aeb+':'+_0x112c06[_0x552967(0x1d5)];if(_0x2d08fc[_0x552967(0x215)](_0x33c524))return![];if(_0x295a2a)return _0x5c8aeb===_0x4501f8||_0x5c8aeb[_0x552967(0x218)](_0x4501f8+'/');return!![];});}export function findJourneysToDelete(_0x5cd6a7,_0x1bfc8f,_0x2a856b,_0x366013,_0x433a0d){const _0x4e875f=a142_0x119b8a,_0x39109a=new Set();for(const {yamlConfig:_0x2c847e,folderPath:_0x146572}of _0x1bfc8f){_0x39109a[_0x4e875f(0x1e8)](_0x146572+':'+_0x2c847e['name']);}return _0x5cd6a7['filter'](_0x341d06=>{const _0x24660e=_0x4e875f,_0x34f7d7=_0x341d06[_0x24660e(0x275)]?_0x2a856b['get'](_0x341d06[_0x24660e(0x275)])||'':'',_0x38f7bc=_0x34f7d7+':'+_0x341d06[_0x24660e(0x297)];if(_0x39109a[_0x24660e(0x215)](_0x38f7bc))return![];if(_0x433a0d)return _0x34f7d7===_0x366013||_0x34f7d7[_0x24660e(0x218)](_0x366013+'/');return!![];});}function a142_0x2b21(){const _0x542ca0=['stringify','activationActions','idToName','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','Updating\x20activation\x20\x27','parse','stages','createdSegmentIds','state','branches','Segment\x20not\x20found:\x20','map','Segment\x20not\x20found','conditions','558FoRPTL','conditionTimeoutDuration','match','nameToType','Updating\x20segment\x20\x27','decision_point','parentFolder','stage\x20\x27','delete','Creating\x20folder\x20\x27','filter','listActivations','ACTIVATION_SYNTAX_ERROR','deleteActivation','journeyActivationStepId','SEGMENT_NOT_FOUND','\x27\x20for\x20','localName','deps','isNew','absolutePath','1318849nKYxJx','./child-segment-yaml.js','activation_updated','Fetching\x20','64884Lznxhd','parseDocument','SEGMENT_UPDATE_ERROR','createSegment','journey_created','create','segment_deleting','segment_deleted','toISOString','relationships','Created\x20activation\x20\x27','connectionIdToNameMap','resolvedRule','embedded_activation_creating','digest','name','list','Updated\x20activation\x20\x27','embedded_activation_created','isArray','Creating\x20activation\x20\x27','embeddedSegmentNameToId','results','created','resolveSegment','resolveJourneyId','from','segment_creating','Deleting\x20activation\x20\x27','segmentNameToId','folder_creating','set','\x27\x20entry\x20criteria','type','add','unchanged','segment','goal\x20criteria','createFolder','activation_created','update','87536SJNttT',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','updated','validatedRequest','connector_config','sort','goal','uniqueSegmentName','segments','journeys','folderPath','journey','onProgress','tdx.sdk.push-workflow','Created\x20segment\x20\x27','INTERNAL','Activation\x20not\x20found:\x20','waitStep','journey_creating','toLowerCase','activationContext','__pending_','getSegment','attributes','length','effectiveFolderId','rule','buildUserMaps','Failed\x20to\x20fetch\x20referenced\x20segment\x20','object','versionNumber','reduce','parentSegmentFolder','null','deleted','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','kind','12815cYdYbA','has','Stage\x20\x27','some','startsWith','schedule','segmentFolderId','activation_creating','Failed\x20to\x20resolve\x20segment\x20','columns','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','activation_updating','92217tZmNJl',').\x20','Creating\x20segment\x20\x27','journeyStages','waitStepType','\x0a\x20\x20','segment_updated','\x27\x20from\x20file:\x20','includes','folder_created','activationStepsById','Failed\x20to\x20resolve\x20activation\x20','errors','\x20(referenced\x20in\x20journey\x20','WaitStep','with','run_after_journey_refresh','all','journeyById','rootFolderId','Name\x20has\x20already\x20been\x20taken','__pending_act_','logInfo','milestone','\x27\x20not\x20found\x20in\x20journey\x20\x27','entry_criteria','push','NOT_FOUND','Failed\x20to\x20','getJourney','JOURNEY_UPDATE_ERROR','\x27\x20wait\x20condition','find','withProgress','activation_template_id','description','relative','debug','logWarning','Activation','existingSegment','createActivation','parentId','activationParams','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','waitStepUnit','nameToId','day','\x27\x20milestone','valid','embedded_segment_created','Embedded\x20segment\x20\x27','steps','get','exitCriterias','yamlConfig','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','max','slice','segment_updating','folder','behavior','journeyName','updateSegmentById','SEGMENT_SYNTAX_ERROR','DecisionPoint','embedded_segment_creating','../../utils/async.js','534063zvvXRS','join','flatMap','144UhAKCO','\x27...','logDeleted','entryCriteria','conditionSegmentId','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','updateActivation','replace','journey_updated','Deleted\x20activation\x20\x27','progress','activationsBySegmentId','user','size','folderId','journeyId','\x20activation\x20\x27','segmentId','JOURNEY_SYNTAX_ERROR','28012Mooqtj','ACTIVATION_UPDATE_ERROR','sha1','activation_deleted','entry','draft','dirname','existingSegments','Created\x20journey\x20\x27','toString','data','journeyBundleId','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','yamlActivation','uniqueServerName','conditionTimeoutUnit','index','existingActivation','createdSegmentId','utf-8','trim','notification','journeyBundlesByFolderAndName','Deleted\x20segment\x20\x27','all_columns','activations','\x20journey\x20from\x20file:\x20','hasChanges','logSuccess','journeyBundleName','journey_updating','existingJourney','keys','idToEmailMap','action','.$1.push-recovery.json','split','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','createJourneySegment','Duration','folderPathToId','Journey\x20\x27','getSegmentEntity','Entry\x20criteria:\x20'];a142_0x2b21=function(){return _0x542ca0;};return a142_0x2b21();}export function buildSegmentLookupMap(_0xf7ce32,_0x5297fe){const _0x38abc3=a142_0x119b8a,_0x4ec330=new Map();for(const _0x418250 of _0xf7ce32){const _0x1cf85b=_0x418250[_0x38abc3(0x21a)]?_0x5297fe[_0x38abc3(0x255)](_0x418250[_0x38abc3(0x21a)]['toString']())||'':'',_0x1759b6=_0x1cf85b+':'+_0x418250[_0x38abc3(0x1d5)];_0x4ec330['set'](_0x1759b6,_0x418250);}return _0x4ec330;}export function buildSegmentNameToIdMap(_0x30fad9){const _0x5ab121=a142_0x119b8a,_0x2ec7c3=new Map();for(const _0x31be53 of _0x30fad9){_0x2ec7c3[_0x5ab121(0x1e5)](_0x31be53['name'],_0x31be53['id']);}return _0x2ec7c3;}export function buildJourneyBundleLookupMap(_0x32c2bc,_0x2494a6){const _0x230110=a142_0x119b8a,_0x159457=new Map();for(const _0xf9b338 of _0x32c2bc){const _0x1bb5d3=_0xf9b338[_0x230110(0x275)]?_0x2494a6['get'](_0xf9b338[_0x230110(0x275)])||'':'',_0x369e0d=_0x1bb5d3+':'+_0xf9b338[_0x230110(0x297)];!_0x159457[_0x230110(0x215)](_0x369e0d)&&_0x159457[_0x230110(0x1e5)](_0x369e0d,[]),_0x159457[_0x230110(0x255)](_0x369e0d)[_0x230110(0x23a)](_0xf9b338);}for(const _0x5882d2 of _0x159457['values']()){_0x5882d2[_0x230110(0x1f4)]((_0xd20ce2,_0x14fa7c)=>(_0xd20ce2['versionNumber']||0x0)-(_0x14fa7c[_0x230110(0x20d)]||0x0));}return _0x159457;}export function collectFoldersToCreate(_0x3c8149,_0x360665){const _0x3305a9=a142_0x119b8a,_0x5b6b31=new Set();for(const _0x568e40 of _0x3c8149){if(!_0x568e40)continue;if(_0x360665['has'](_0x568e40))continue;const _0x500454=_0x568e40[_0x3305a9(0x29e)]('/');let _0x4c67c6='';for(const _0x4ce074 of _0x500454){_0x4c67c6=_0x4c67c6?_0x4c67c6+'/'+_0x4ce074:_0x4ce074,!_0x360665['has'](_0x4c67c6)&&_0x5b6b31[_0x3305a9(0x1e8)](_0x4c67c6);}}return _0x5b6b31;}export function parseAndClassifyYamlFiles(_0x4bda26,_0x1fda52,_0x3367fb){const _0x123c37=a142_0x119b8a,_0x1a6f6e=[],_0x388957=[];for(const _0x418257 of _0x4bda26){const _0x24264b=a142_0x23e26b[_0x123c37(0x244)](_0x1fda52,a142_0x23e26b[_0x123c37(0x280)](_0x418257)),_0x148f6e=_0x24264b==='.'?'':_0x24264b,_0x2209d9=readFileSync(_0x418257,'utf-8'),_0x6a6075=a142_0x47e672[_0x123c37(0x2ab)](_0x2209d9);if(isJourneyDef(_0x6a6075)){const _0x33fb42=a142_0x1b9769(_0x2209d9);_0x388957[_0x123c37(0x23a)]({'yamlConfig':_0x33fb42,'folderPath':_0x148f6e,'sourcePath':_0x418257});}else{if(!_0x3367fb?.['skipSegments']){const _0x5b0adf=parseSegmentYamlFile(_0x2209d9),_0x474384=normalizeChildSegmentYaml(_0x5b0adf);_0x1a6f6e[_0x123c37(0x23a)]({'yamlConfig':_0x474384,'folderPath':_0x148f6e,'sourcePath':_0x418257});}}}return{'segments':_0x1a6f6e,'journeys':_0x388957};}export function validateParsedFiles(_0x2cfa90,_0x1bccfa){const _0x29fc8d=a142_0x119b8a,_0x1826d0=[];for(const {yamlConfig:_0xfbe49a,sourcePath:_0x33ffc3}of _0x2cfa90[_0x29fc8d(0x1f7)]){const _0x191712=readFileSync(_0x33ffc3,_0x29fc8d(0x28d)),_0x21eac6=a142_0x47e672[_0x29fc8d(0x1c7)](_0x191712),_0x4900e6=validateSegmentDef(_0xfbe49a,{'source':_0x191712,'document':_0x21eac6},{'skipSchema':!![]});if(!_0x4900e6[_0x29fc8d(0x251)]){const _0x4f8e2c=a142_0x23e26b[_0x29fc8d(0x244)](_0x1bccfa,_0x33ffc3);_0x1826d0[_0x29fc8d(0x23a)]({'filePath':_0x4f8e2c,'source':_0x191712,'result':_0x4900e6,'isJourney':![]});}}for(const {yamlConfig:_0x322424,sourcePath:_0x2aa0af}of _0x2cfa90[_0x29fc8d(0x1f8)]){const _0x2a0d4a=readFileSync(_0x2aa0af,_0x29fc8d(0x28d)),_0x29d38e=a142_0x47e672[_0x29fc8d(0x1c7)](_0x2a0d4a),_0x34e2f0=validateJourneyDef(_0x322424,{'source':_0x2a0d4a,'document':_0x29d38e},{'skipSchema':!![]});if(!_0x34e2f0['valid']){const _0x26ff6f=a142_0x23e26b[_0x29fc8d(0x244)](_0x1bccfa,_0x2aa0af);_0x1826d0['push']({'filePath':_0x26ff6f,'source':_0x2a0d4a,'result':_0x34e2f0,'isJourney':!![]});}}return _0x1826d0;}export function formatValidationErrors(_0x56f13a){const _0x5c4140=a142_0x119b8a,_0x13b9c7=[];for(const {filePath:_0xd2eb,source:_0x2ea80b,result:_0x3898b5,isJourney:_0x5d490f}of _0x56f13a){const _0x4d0091=_0x5d490f?_0x5c4140(0x1fa):_0x5c4140(0x1ea);_0x13b9c7[_0x5c4140(0x23a)]('\x0a'+_0xd2eb+'\x20('+_0x4d0091+'):\x20'+_0x3898b5[_0x5c4140(0x22c)]['length']+'\x20error(s)'),_0x13b9c7[_0x5c4140(0x23a)](formatValidationResult(_0x3898b5,_0x2ea80b,_0xd2eb));}return _0x13b9c7['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x4a2fe5){const _0x5ace12=a142_0x119b8a,_0x2f38ef=new Set(),_0x4f0685=new Map(),_0x598dc2=collectSegmentUsageCounts(_0x4a2fe5);if(_0x4a2fe5[_0x5ace12(0x1f7)])for(const [_0x22de42,_0x2f7ae9]of Object['entries'](_0x4a2fe5[_0x5ace12(0x1f7)])){_0x2f38ef[_0x5ace12(0x1e8)](_0x22de42);if(_0x2f7ae9[_0x5ace12(0x209)]){const _0x13f0f1=yamlRuleToApi(_0x2f7ae9[_0x5ace12(0x209)]),_0x54f192=apiRuleToYaml(_0x13f0f1);_0x4f0685[_0x5ace12(0x1e5)](_0x22de42,_0x54f192);}}const _0x5d2f08=new Map();let _0x41e366=0x0;for(const [_0x104ac7,_0x46f195]of _0x4f0685){const _0xa0342d=serializeExpandedRule(_0x46f195,_0x4f0685),_0x481a89=_0x5d2f08[_0x5ace12(0x255)](_0xa0342d)||[];_0x481a89[_0x5ace12(0x23a)]({'name':_0x104ac7,'index':_0x41e366}),_0x5d2f08['set'](_0xa0342d,_0x481a89),_0x41e366++;}const _0x5e4d60=new Map();for(const [_0x873fb6,_0x2733ff]of _0x5d2f08){const _0x2d2e35=_0x2733ff[_0x5ace12(0x25a)]()[_0x5ace12(0x1f4)]((_0xfd8502,_0x411eb1)=>{const _0x330c99=_0x5ace12,_0x5e917b=_0x598dc2[_0x330c99(0x255)](_0xfd8502[_0x330c99(0x1d5)])||0x0,_0x4a435a=_0x598dc2[_0x330c99(0x255)](_0x411eb1[_0x330c99(0x1d5)])||0x0;if(_0x5e917b!==_0x4a435a)return _0x4a435a-_0x5e917b;return _0xfd8502[_0x330c99(0x28a)]-_0x411eb1[_0x330c99(0x28a)];})['map'](_0x14b2e1=>_0x14b2e1['name']),_0x26e618=[];for(const _0x22ed73 of _0x2d2e35){const _0x422bcd=_0x598dc2[_0x5ace12(0x255)](_0x22ed73)||0x0,_0x2b4d7b=Math['max'](_0x422bcd,0x1);for(let _0x272ef6=0x0;_0x272ef6<_0x2b4d7b;_0x272ef6++){_0x26e618[_0x5ace12(0x23a)](_0x22ed73);}}_0x5e4d60['set'](_0x873fb6,_0x26e618);}return{'existingLocalSegmentNames':_0x2f38ef,'localSegmentRules':_0x4f0685,'localExpandedRuleToNames':_0x5e4d60};}export function createSegmentIdResolver(_0x5d7938,_0x53fb8b){return async _0x3a5210=>{const _0x4cf928=a142_0x3007,_0x39525c=_0x5d7938['get'](_0x3a5210);if(!_0x39525c)throw new SDKError(ErrorCode[_0x4cf928(0x1bc)],_0x4cf928(0x2b0)+_0x3a5210+_0x4cf928(0x26c)+_0x53fb8b+'\x27)');return _0x39525c;};}export function extractRootFolderId(_0x5aeda4){const _0x17260d=a142_0x119b8a;return _0x5aeda4[_0x17260d(0x1cf)]?.[_0x17260d(0x20f)]?.['data']?.['id']||_0x5aeda4[_0x17260d(0x1cf)]?.[_0x17260d(0x2ba)]?.[_0x17260d(0x284)]?.['id'];}export function buildConnectionMaps(_0x3553b9){const _0x477206=a142_0x119b8a,_0x45a386=new Map(),_0x11ff61=new Map(),_0x4af573=new Map();for(const _0x3835b9 of _0x3553b9){_0x45a386[_0x477206(0x1e5)](_0x3835b9['name'],parseInt(_0x3835b9['id'],0xa)),_0x11ff61[_0x477206(0x1e5)](_0x3835b9['id'],_0x3835b9[_0x477206(0x1d5)]),_0x4af573['set'](_0x3835b9[_0x477206(0x1d5)],_0x3835b9[_0x477206(0x1e7)]);}return{'nameToId':_0x45a386,'idToName':_0x11ff61,'nameToType':_0x4af573};}export function calculatePushStats(_0x4578da,_0x5b6319,_0x1b4a0d,_0x1d0496,_0x18461a,_0x11ab5e,_0x431d33){const _0x30aa2a=a142_0x119b8a,_0x56614f=_0x4578da[_0x30aa2a(0x2be)](_0x10396d=>_0x10396d[_0x30aa2a(0x1c0)]),_0xd2d6db=_0x4578da['filter'](_0x47ca53=>!_0x47ca53['isNew']&&_0x47ca53[_0x30aa2a(0x295)]),_0x1072c4=_0x4578da['filter'](_0x25f9d6=>!_0x25f9d6['isNew']&&!_0x25f9d6['hasChanges']),_0x2ebcb5=_0x11ab5e?_0x1d0496:[],_0xaaef5c=_0x5b6319[_0x30aa2a(0x2be)](_0x511b2d=>_0x511b2d[_0x30aa2a(0x1c0)]),_0x3bb394=_0x5b6319['filter'](_0x350330=>!_0x350330['isNew']&&_0x350330[_0x30aa2a(0x295)]),_0x18f524=_0x5b6319[_0x30aa2a(0x2be)](_0x3d261f=>!_0x3d261f[_0x30aa2a(0x1c0)]&&!_0x3d261f[_0x30aa2a(0x295)]),_0x3c8420=_0x11ab5e?_0x18461a:[],_0x3fb27e=_0x4578da[_0x30aa2a(0x266)](_0x4288af=>_0x4288af[_0x30aa2a(0x2a7)]),_0x571108=_0x3fb27e['filter'](_0x1a971e=>_0x1a971e[_0x30aa2a(0x1e7)]===_0x30aa2a(0x1cb)),_0x3c87e7=_0x3fb27e['filter'](_0x25f0d5=>_0x25f0d5[_0x30aa2a(0x1e7)]===_0x30aa2a(0x1ee)),_0x16ec0c=_0x3fb27e[_0x30aa2a(0x2be)](_0x42ee24=>_0x42ee24['type']===_0x30aa2a(0x2bc)),_0x480fbf=Array['from'](_0x1b4a0d)['sort'](),_0x62afb9=_0x431d33?![]:_0x56614f[_0x30aa2a(0x207)]>0x0||_0xd2d6db[_0x30aa2a(0x207)]>0x0||_0x2ebcb5[_0x30aa2a(0x207)]>0x0,_0x16a7b1=_0xaaef5c[_0x30aa2a(0x207)]>0x0||_0x3bb394['length']>0x0||_0x3c8420[_0x30aa2a(0x207)]>0x0,_0x2cde06=_0x431d33?![]:_0x3fb27e[_0x30aa2a(0x207)]>0x0,_0x7ebbcc=_0x480fbf[_0x30aa2a(0x207)]>0x0;return{'segments':{'new':_0x56614f,'changed':_0xd2d6db,'unchanged':_0x1072c4,'toDelete':_0x2ebcb5},'journeys':{'new':_0xaaef5c,'changed':_0x3bb394,'unchanged':_0x18f524,'toDelete':_0x3c8420},'activations':{'all':_0x3fb27e,'toCreate':_0x571108,'toUpdate':_0x3c87e7,'toDelete':_0x16ec0c},'folders':{'toCreate':_0x480fbf},'counts':{'segments':{'new':_0x56614f[_0x30aa2a(0x207)],'changed':_0xd2d6db[_0x30aa2a(0x207)],'unchanged':_0x1072c4[_0x30aa2a(0x207)],'toDelete':_0x2ebcb5[_0x30aa2a(0x207)]},'journeys':{'new':_0xaaef5c[_0x30aa2a(0x207)],'changed':_0x3bb394['length'],'unchanged':_0x18f524[_0x30aa2a(0x207)],'toDelete':_0x3c8420[_0x30aa2a(0x207)]},'activations':{'create':_0x571108[_0x30aa2a(0x207)],'update':_0x3c87e7[_0x30aa2a(0x207)],'delete':_0x16ec0c[_0x30aa2a(0x207)]},'folders':_0x480fbf[_0x30aa2a(0x207)]},'hasChanges':_0x62afb9||_0x16a7b1||_0x2cde06||_0x7ebbcc};}export async function buildPushExecutionContext(_0x54dafc,_0x49ffcd,_0x3b2556,_0x41a151,_0x2c4f8f,_0x519d38){const _0x132af3=a142_0x119b8a,_0x289455=extractRootFolderId(_0x3b2556),{pathToId:_0x39edd2,idToPath:_0x13ed8b}=buildFolderMaps(_0x2c4f8f),_0x5d2288=buildSegmentNameToIdMap(_0x41a151),_0x216830=new Map(),{batchAsync:_0x571cb5}=await import(_0x132af3(0x263)),[_0x3eb4d4,_0x38e543]=await Promise[_0x132af3(0x231)]([_0x54dafc[_0x132af3(0x273)][_0x132af3(0x20a)](),_0x54dafc['connection'][_0x132af3(0x1d6)](),((async()=>{!_0x519d38&&_0x41a151['length']>0x0&&await _0x571cb5(_0x41a151,async _0x16f051=>{const _0x386333=a142_0x3007,_0xc892b7=await _0x54dafc[_0x386333(0x1ea)][_0x386333(0x2bf)](_0x49ffcd,_0x16f051['id']);_0x216830[_0x386333(0x1e5)](_0x16f051['id'],_0xc892b7);});})())]),{emailToId:_0x4b506f,idToEmail:_0xf261f}=_0x3eb4d4,_0x50d4bb=buildConnectionMaps(_0x38e543);return{'rootFolderId':_0x289455,'folderPathToId':_0x39edd2,'folderIdToPath':_0x13ed8b,'segmentNameToId':_0x5d2288,'activationsBySegmentId':_0x216830,'emailToIdMap':_0x4b506f,'idToEmailMap':_0xf261f,'connectionNameToIdMap':_0x50d4bb[_0x132af3(0x24e)],'connectionIdToNameMap':_0x50d4bb[_0x132af3(0x2a8)],'connectionNameToTypeMap':_0x50d4bb[_0x132af3(0x2b7)]};}export function createPushYamlContextForBundle(_0x5d47ca,_0x152655,_0x11bc00,_0x1ad2f9,_0xded039,_0x1c2fcb,_0x474d25,_0x295344){const {existingLocalSegmentNames:_0x1d3f09,localExpandedRuleToNames:_0xd61fa}=_0x1ad2f9,_0x4f51ee=new Set(),_0x317062=new Map(),_0x4826b0=new Map(),_0x52303b=new Map(),_0x15eea2=createJumpTargetCache(),_0x58f304=new Map(),_0x52b3fc=new Map(),_0x4110fd=new Set();let _0xd5cbb3;const _0x50f83a=_0x16aab6=>{const _0x223b2d={'resolveSegment':async _0x4b9e3b=>{const _0x522685=a142_0x3007,_0x31319a=_0x52303b['get'](_0x4b9e3b);if(_0x31319a!==undefined)return{'name':_0x31319a,'isJourneyLocal':!![]};try{const _0x27e4c9=await fetchSegment(_0x5d47ca,_0x152655,_0x4b9e3b,_0x11bc00);if(!_0x27e4c9)throw new Error(_0x522685(0x2b2));const _0x25a966=generateJourneyLocalName(_0x27e4c9[_0x522685(0x1d5)]),_0x12a095=_0x27e4c9[_0x522685(0x213)]===SEGMENT_KIND_JOURNEY&&_0x25a966!==undefined;let _0x21be9c=_0x27e4c9[_0x522685(0x1d5)],_0x367785;if(_0x12a095&&_0x27e4c9['rule']){const _0x28b35c=apiRuleToYaml(_0x27e4c9['rule']);_0x52b3fc[_0x522685(0x1e5)](_0x4b9e3b,_0x28b35c);const _0x30bf68=async _0x5299f9=>{const _0x441d06=_0x522685,_0x360bc9=collectSegmentRefsFromRule(_0x5299f9);for(const _0x48ec74 of _0x360bc9){if(!_0x52b3fc[_0x441d06(0x215)](_0x48ec74))try{const _0x414ac4=await fetchSegment(_0x5d47ca,_0x152655,_0x48ec74,_0x11bc00);if(_0x414ac4?.[_0x441d06(0x209)]){const _0x53a2f3=apiRuleToYaml(_0x414ac4['rule']);_0x52b3fc['set'](_0x48ec74,_0x53a2f3),await _0x30bf68(_0x53a2f3);}}catch(_0x24a8aa){logger[_0x441d06(0x245)](_0x441d06(0x20b)+_0x48ec74+':\x20'+_0x24a8aa);}}};await _0x30bf68(_0x28b35c);const _0x1b307f=serializeExpandedRule(_0x28b35c,_0x52b3fc),_0x12a612=_0xd61fa[_0x522685(0x255)](_0x1b307f);if(_0x12a612&&_0x12a612[_0x522685(0x207)]>0x0){const _0x3866b9=_0x317062[_0x522685(0x255)](_0x1b307f)||0x0,_0x3be4dd=_0x12a612[_0x3866b9]||_0x12a612[_0x12a612[_0x522685(0x207)]-0x1];_0x317062['set'](_0x1b307f,_0x3866b9+0x1),_0x21be9c=_0x3be4dd,_0x4f51ee[_0x522685(0x1e8)](_0x21be9c),_0x52303b[_0x522685(0x1e5)](_0x4b9e3b,_0x21be9c);const _0x7de080=await resolveRuleSegmentRefs(_0x28b35c,async _0x2a9343=>{const _0x123564=_0x522685,_0x3d3b95=_0x52303b[_0x123564(0x255)](_0x2a9343);if(_0x3d3b95)return _0x3d3b95;const _0x1f95dd=await _0xd5cbb3[_0x123564(0x1de)](_0x2a9343);return _0x1f95dd[_0x123564(0x1d5)];});_0x367785={'description':_0x27e4c9[_0x522685(0x243)],'rule':_0x7de080};}else{const _0x43e561=_0x58f304[_0x522685(0x255)](_0x1b307f);if(_0x43e561)_0x21be9c=_0x43e561,_0x52303b[_0x522685(0x1e5)](_0x4b9e3b,_0x21be9c);else{if(_0x25a966){let _0x543090=_0x25a966,_0x1f8f42=0x2;while(_0x4f51ee[_0x522685(0x215)](_0x543090)||_0x1d3f09[_0x522685(0x215)](_0x543090)){_0x543090=_0x25a966+'_'+_0x1f8f42,_0x1f8f42++;}_0x4f51ee[_0x522685(0x1e8)](_0x543090),_0x21be9c=_0x543090;}_0x52303b[_0x522685(0x1e5)](_0x4b9e3b,_0x21be9c),_0x58f304[_0x522685(0x1e5)](_0x1b307f,_0x21be9c);const _0x165c62=await resolveRuleSegmentRefs(_0x28b35c,async _0x2b7113=>{const _0x49344c=_0x522685,_0x3943a9=_0x52303b['get'](_0x2b7113);if(_0x3943a9)return _0x3943a9;const _0x44c3d8=await _0xd5cbb3[_0x49344c(0x1de)](_0x2b7113);return _0x44c3d8[_0x49344c(0x1d5)];});_0x367785={'description':_0x27e4c9[_0x522685(0x243)],'rule':_0x165c62};}}}return{'name':_0x21be9c,'isJourneyLocal':_0x12a095,'definition':_0x367785};}catch(_0x57fdb2){return logger[_0x522685(0x245)](_0x522685(0x21c)+_0x4b9e3b+':\x20'+_0x57fdb2),{'name':_0x4b9e3b,'isJourneyLocal':![]};}},'resolveActivation':async _0xb83d64=>{const _0x124f3f=a142_0x3007,_0x491431=_0x4826b0[_0x124f3f(0x255)](_0xb83d64);if(_0x491431!==undefined)return{'name':_0x491431,'isJourneyLocal':!![]};try{let _0x4192e4=_0x474d25?.[_0x124f3f(0x255)](_0xb83d64);!_0x4192e4&&(_0x4192e4=await _0x5d47ca[_0x124f3f(0x1fa)]['getActivation'](_0x16aab6,_0xb83d64));const _0x144fd1=_0x4192e4['attributes'][_0x124f3f(0x24b)]['name']||_0xb83d64,_0x139078=sanitizeYamlKey(_0x144fd1)||'activation_'+_0xb83d64,_0x23a3bd=_0x139078;_0x4826b0[_0x124f3f(0x1e5)](_0xb83d64,_0x23a3bd);const _0x20b3bf=journeyActivationStepToYaml(_0x4192e4,_0xded039,_0x1c2fcb);return{'name':_0x23a3bd,'isJourneyLocal':!![],'definition':_0x20b3bf};}catch(_0x5c69de){return logger[_0x124f3f(0x245)](_0x124f3f(0x22b)+_0xb83d64+':\x20'+_0x5c69de),{'name':_0xb83d64,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x7a2ddd,_0xa6a694)=>resolveJumpTarget(_0x7a2ddd,_0xa6a694,_0x15eea2,async _0x27989f=>{const _0x420e5f=a142_0x3007,_0x2e502d=_0x295344?.[_0x420e5f(0x255)](_0x27989f);if(_0x2e502d)return _0x2e502d;return _0x5d47ca[_0x420e5f(0x1fa)][_0x420e5f(0x23d)](_0x27989f);})};return _0xd5cbb3=_0x223b2d,_0x223b2d;},_0x5e2d19=async _0x172206=>{const _0x50f282=a142_0x3007,{collectSegmentIdsFromJourneyApi:_0x4868c5}=await import('./journey-yaml.js'),{batchAsync:_0x1b38d1}=await import(_0x50f282(0x263)),_0x5a531=new Set();for(const _0xc17362 of _0x172206){let _0x2be179=_0x295344?.[_0x50f282(0x255)](_0xc17362);!_0x2be179&&(_0x2be179=await _0x5d47ca[_0x50f282(0x1fa)][_0x50f282(0x23d)](_0xc17362));const _0x311699=_0x4868c5(_0x2be179);for(const _0x1eb03f of _0x311699){_0x5a531['add'](_0x1eb03f);}}let _0x4ec6eb=Array[_0x50f282(0x1e0)](_0x5a531);while(_0x4ec6eb[_0x50f282(0x207)]>0x0){const _0x1dfa7d=_0x4ec6eb['filter'](_0x4b4610=>!_0x4110fd['has'](_0x4b4610));if(_0x1dfa7d[_0x50f282(0x207)]===0x0)break;const _0x4f45ab=await _0x1b38d1(_0x1dfa7d,async _0x8dae75=>{const _0x1d9d05=_0x50f282;_0x4110fd[_0x1d9d05(0x1e8)](_0x8dae75);const _0x3b4dc9=await fetchSegment(_0x5d47ca,_0x152655,_0x8dae75,_0x11bc00);if(!_0x3b4dc9)return null;return{'segmentId':_0x8dae75,'segment':_0x3b4dc9};},0xa),_0x5a7e13=new Set();for(const _0x462a5e of _0x4f45ab){if(!_0x462a5e?.[_0x50f282(0x1ea)]?.['rule'])continue;const _0x14f47d=apiRuleToYaml(_0x462a5e['segment'][_0x50f282(0x209)]);_0x52b3fc['set'](_0x462a5e[_0x50f282(0x278)],_0x14f47d);const _0x302832=collectSegmentRefsFromRule(_0x14f47d);for(const _0x2408e4 of _0x302832){!_0x4110fd[_0x50f282(0x215)](_0x2408e4)&&_0x5a7e13[_0x50f282(0x1e8)](_0x2408e4);}}_0x4ec6eb=Array[_0x50f282(0x1e0)](_0x5a7e13);}};return{'createYamlContext':_0x50f83a,'prefetchJourneySegments':_0x5e2d19};}export async function executePushSegments(_0x10ac81,_0x865481,_0xe40789,_0x3931bf,_0x2a22d5){const _0x419675=a142_0x119b8a,{segmentDefToCreateRequest:_0x286afd,segmentDefToUpdateRequest:_0x66458f}=await import(_0x419675(0x1c3)),_0x2e3bf3=_0xe40789[_0x419675(0x2a2)],_0x545212=0x5,_0x3bd82a=async _0x5e33f3=>{const _0x48ea38=_0x419675,_0xf3e7c3=_0x5e33f3['folderPath']?_0x2e3bf3['get'](_0x5e33f3['folderPath']):undefined;let _0x2fa58c;const _0x33be31={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x5c0abb=_0x5e33f3[_0x48ea38(0x257)];if(_0x5e33f3[_0x48ea38(0x257)][_0x48ea38(0x209)]){const _0x3848e9=createSegmentIdResolver(_0xe40789[_0x48ea38(0x1e3)],_0x5e33f3[_0x48ea38(0x257)][_0x48ea38(0x1d5)]),_0x4eb344=await resolveRuleSegmentIds(_0x5e33f3[_0x48ea38(0x257)][_0x48ea38(0x209)],_0x3848e9);_0x5c0abb={..._0x5e33f3[_0x48ea38(0x257)],'rule':_0x4eb344};}try{if(_0x5e33f3[_0x48ea38(0x1c0)]){_0x2a22d5[_0x48ea38(0x1fb)]?.({'type':_0x48ea38(0x1e1),'name':_0x5e33f3[_0x48ea38(0x257)]['name']});const _0x19b383=_0x286afd(_0x5c0abb,_0xf3e7c3),_0x52ee9d=await _0x2a22d5[_0x48ea38(0x241)](_0x48ea38(0x222)+_0x5e33f3[_0x48ea38(0x257)][_0x48ea38(0x1d5)]+'\x27...',()=>_0x10ac81['segment'][_0x48ea38(0x1c9)](_0x3931bf['parentId'],_0x19b383));_0x2fa58c=_0x52ee9d[_0x48ea38(0x284)]['id'],_0xe40789[_0x48ea38(0x1e3)][_0x48ea38(0x1e5)](_0x5e33f3[_0x48ea38(0x257)][_0x48ea38(0x1d5)],_0x2fa58c),_0x33be31['createdSegmentId']={'name':_0x5e33f3[_0x48ea38(0x257)][_0x48ea38(0x1d5)],'id':_0x2fa58c},_0x2a22d5[_0x48ea38(0x1fb)]?.({'type':'segment_created','name':_0x5e33f3[_0x48ea38(0x257)][_0x48ea38(0x1d5)],'segmentId':_0x2fa58c}),_0x2a22d5['logSuccess']?.(_0x48ea38(0x1fd)+_0x5e33f3[_0x48ea38(0x257)][_0x48ea38(0x1d5)]+'\x27'),_0x33be31[_0x48ea38(0x1dd)]=0x1;}else{if(_0x5e33f3[_0x48ea38(0x295)]){_0x2a22d5[_0x48ea38(0x1fb)]?.({'type':_0x48ea38(0x25b),'name':_0x5e33f3[_0x48ea38(0x257)][_0x48ea38(0x1d5)]});const _0xafda08=_0x66458f(_0x5c0abb);_0xf3e7c3!==_0x5e33f3[_0x48ea38(0x248)]?.['segmentFolderId']&&(_0xafda08['segmentFolderId']=_0xf3e7c3?parseInt(_0xf3e7c3,0xa):undefined),await _0x2a22d5[_0x48ea38(0x241)](_0x48ea38(0x2b8)+_0x5e33f3[_0x48ea38(0x257)]['name']+_0x48ea38(0x268),()=>_0x10ac81[_0x48ea38(0x1ea)][_0x48ea38(0x25f)](_0x3931bf[_0x48ea38(0x24a)],_0x5e33f3[_0x48ea38(0x248)]['id'],_0xafda08)),_0x2fa58c=_0x5e33f3[_0x48ea38(0x248)]['id'],_0x2a22d5[_0x48ea38(0x1fb)]?.({'type':_0x48ea38(0x226),'name':_0x5e33f3[_0x48ea38(0x257)][_0x48ea38(0x1d5)]}),_0x2a22d5[_0x48ea38(0x296)]?.('Updated\x20segment\x20\x27'+_0x5e33f3[_0x48ea38(0x257)][_0x48ea38(0x1d5)]+'\x27'),_0x33be31[_0x48ea38(0x1f1)]=0x1;}else _0x2fa58c=_0x5e33f3['existingSegment']['id'];}}catch(_0x24462d){const _0x253317=isHttp400Error(_0x24462d),_0x3cff19=_0x253317?ErrorCode[_0x48ea38(0x260)]:ErrorCode[_0x48ea38(0x1c8)],_0x2470e2=getErrorMessage(_0x24462d);throw new SDKError(_0x3cff19,_0x48ea38(0x23c)+(_0x5e33f3['isNew']?_0x48ea38(0x1cb):'update')+'\x20segment\x20from\x20file:\x20'+_0x5e33f3[_0x48ea38(0x1c1)]+_0x48ea38(0x225)+_0x2470e2,_0x24462d);}try{const _0xc08c69=await syncActivationsForSegment(_0x10ac81,_0x3931bf[_0x48ea38(0x24a)],_0x2fa58c,_0x5e33f3[_0x48ea38(0x257)][_0x48ea38(0x1d5)],_0x5e33f3[_0x48ea38(0x2a7)],_0x2a22d5,_0x5e33f3[_0x48ea38(0x1c1)]);_0x33be31['activations']=_0xc08c69;}catch(_0xbfe1b7){if(_0xbfe1b7 instanceof SDKError)throw _0xbfe1b7;throw new SDKError(ErrorCode[_0x48ea38(0x27b)],_0x48ea38(0x212)+_0x5e33f3[_0x48ea38(0x257)][_0x48ea38(0x1d5)]+_0x48ea38(0x227)+_0x5e33f3[_0x48ea38(0x1c1)]+_0x48ea38(0x225)+getErrorMessage(_0xbfe1b7),_0xbfe1b7);}return _0x33be31;},_0x36c58c=await batchAsync(_0x865481,_0x3bd82a,_0x545212),_0x3703fb={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x2fa2bd of _0x36c58c){_0x3703fb[_0x419675(0x1dd)]+=_0x2fa2bd[_0x419675(0x1dd)],_0x3703fb['updated']+=_0x2fa2bd[_0x419675(0x1f1)],_0x2fa2bd[_0x419675(0x28c)]&&_0x3703fb[_0x419675(0x2ad)][_0x419675(0x1e5)](_0x2fa2bd[_0x419675(0x28c)][_0x419675(0x1d5)],_0x2fa2bd[_0x419675(0x28c)]['id']),_0x3703fb['activations'][_0x419675(0x1dd)]+=_0x2fa2bd[_0x419675(0x293)][_0x419675(0x1dd)],_0x3703fb[_0x419675(0x293)][_0x419675(0x1f1)]+=_0x2fa2bd['activations'][_0x419675(0x1f1)],_0x3703fb[_0x419675(0x293)][_0x419675(0x211)]+=_0x2fa2bd['activations'][_0x419675(0x211)];}return _0x3703fb;}async function syncActivationsForSegment(_0x4fb354,_0x5ed1ef,_0x5ecf01,_0x20e22f,_0x2ffc24,_0x195937,_0x21fa7e){const _0x5b438f=a142_0x119b8a,_0x1ae6e4={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x199021 of _0x2ffc24){try{if(_0x199021[_0x5b438f(0x1e7)]===_0x5b438f(0x1cb)&&_0x199021[_0x5b438f(0x1f2)])_0x195937[_0x5b438f(0x1fb)]?.({'type':_0x5b438f(0x21b),'segmentName':_0x20e22f,'activationName':_0x199021[_0x5b438f(0x1d5)]}),await _0x195937[_0x5b438f(0x241)](_0x5b438f(0x1da)+_0x199021[_0x5b438f(0x1d5)]+_0x5b438f(0x268),()=>_0x4fb354[_0x5b438f(0x1ea)][_0x5b438f(0x249)](_0x5ed1ef,_0x5ecf01,_0x199021[_0x5b438f(0x1f2)])),_0x195937['onProgress']?.({'type':_0x5b438f(0x1ed),'segmentName':_0x20e22f,'activationName':_0x199021[_0x5b438f(0x1d5)]}),_0x195937[_0x5b438f(0x296)]?.(_0x5b438f(0x1d0)+_0x199021['name']+'\x27'),_0x1ae6e4['created']++;else{if(_0x199021[_0x5b438f(0x1e7)]===_0x5b438f(0x1ee)&&_0x199021[_0x5b438f(0x1f2)]&&_0x199021['existingActivation'])_0x195937[_0x5b438f(0x1fb)]?.({'type':_0x5b438f(0x21f),'segmentName':_0x20e22f,'activationName':_0x199021['name']}),await _0x195937[_0x5b438f(0x241)](_0x5b438f(0x2aa)+_0x199021[_0x5b438f(0x1d5)]+_0x5b438f(0x268),()=>_0x4fb354['segment'][_0x5b438f(0x26d)](_0x5ed1ef,_0x5ecf01,_0x199021[_0x5b438f(0x28b)]['id'],_0x199021['validatedRequest'])),_0x195937[_0x5b438f(0x1fb)]?.({'type':_0x5b438f(0x1c4),'segmentName':_0x20e22f,'activationName':_0x199021[_0x5b438f(0x1d5)]}),_0x195937[_0x5b438f(0x296)]?.(_0x5b438f(0x1d7)+_0x199021[_0x5b438f(0x1d5)]+'\x27'),_0x1ae6e4['updated']++;else _0x199021[_0x5b438f(0x1e7)]==='delete'&&_0x199021[_0x5b438f(0x28b)]&&(_0x195937['onProgress']?.({'type':'activation_deleting','segmentName':_0x20e22f,'activationName':_0x199021[_0x5b438f(0x1d5)]}),await _0x195937['withProgress'](_0x5b438f(0x1e2)+_0x199021[_0x5b438f(0x1d5)]+_0x5b438f(0x268),()=>_0x4fb354[_0x5b438f(0x1ea)][_0x5b438f(0x1ba)](_0x5ed1ef,_0x5ecf01,_0x199021[_0x5b438f(0x28b)]['id'])),_0x195937[_0x5b438f(0x1fb)]?.({'type':_0x5b438f(0x27d),'segmentName':_0x20e22f,'activationName':_0x199021[_0x5b438f(0x1d5)]}),_0x195937[_0x5b438f(0x269)]?.(_0x5b438f(0x270)+_0x199021[_0x5b438f(0x1d5)]+'\x27'),_0x1ae6e4['deleted']++);}}catch(_0x2a15e7){const _0x463ee2=isHttp400Error(_0x2a15e7),_0x1b3fb0=_0x463ee2?ErrorCode[_0x5b438f(0x1b9)]:ErrorCode[_0x5b438f(0x27b)],_0x21c9ff=getErrorMessage(_0x2a15e7);throw new SDKError(_0x1b3fb0,'Failed\x20to\x20'+_0x199021[_0x5b438f(0x1e7)]+_0x5b438f(0x277)+_0x199021[_0x5b438f(0x1d5)]+_0x5b438f(0x227)+_0x21fa7e+_0x5b438f(0x225)+_0x21c9ff,_0x2a15e7);}}return _0x1ae6e4;}export async function executePushFolders(_0xce7912,_0x585e4b,_0x52a133,_0x2c03ac,_0x106446){const _0xc0f244=a142_0x119b8a,_0x372d25=new Map(_0x52a133),_0x5798a1=sortFoldersByDepth(_0x585e4b);for(const _0x5de59e of _0x5798a1){const _0x3e0b12=_0x5de59e[_0xc0f244(0x29e)]('/'),_0x351fa4=_0x3e0b12[_0x3e0b12[_0xc0f244(0x207)]-0x1],_0x312efb=_0x3e0b12[_0xc0f244(0x25a)](0x0,-0x1)[_0xc0f244(0x265)]('/'),_0x24c341=_0x372d25[_0xc0f244(0x255)](_0x312efb);_0x106446['onProgress']?.({'type':_0xc0f244(0x1e4),'folder':_0x5de59e});const _0x5970fa={'name':_0x351fa4,'parentFolderId':_0x24c341},_0x2c2cd3=await _0x106446[_0xc0f244(0x241)](_0xc0f244(0x2bd)+_0x5de59e+_0xc0f244(0x268),()=>_0xce7912[_0xc0f244(0x1ea)][_0xc0f244(0x1ec)](_0x2c03ac[_0xc0f244(0x24a)],_0x5970fa));_0x372d25[_0xc0f244(0x1e5)](_0x5de59e,_0x2c2cd3[_0xc0f244(0x284)]['id']),_0x106446[_0xc0f244(0x1fb)]?.({'type':_0xc0f244(0x229),'folder':_0x5de59e,'folderId':_0x2c2cd3[_0xc0f244(0x284)]['id']}),_0x106446[_0xc0f244(0x236)]?.('Created\x20folder\x20\x27'+_0x5de59e+'\x27');}return _0x372d25;}export async function executePushSegmentDeletions(_0x2388da,_0x37563c,_0x264d6f){const _0x858e20=a142_0x119b8a;if(_0x37563c[_0x858e20(0x207)]===0x0)return 0x0;const {batchAsync:_0x51489d}=await import(_0x858e20(0x263)),_0x53ef0d=0x5,_0xd163d5=await _0x51489d(_0x37563c,async _0x2f0e89=>{const _0xc1b39c=_0x858e20;return _0x264d6f[_0xc1b39c(0x1fb)]?.({'type':_0xc1b39c(0x1cc),'name':_0x2f0e89[_0xc1b39c(0x1d5)]}),await _0x2388da[_0xc1b39c(0x1ea)]['deleteSegment'](_0x2f0e89['id']),_0x264d6f[_0xc1b39c(0x1fb)]?.({'type':_0xc1b39c(0x1cd),'name':_0x2f0e89['name']}),_0x264d6f['logDeleted']?.(_0xc1b39c(0x291)+_0x2f0e89[_0xc1b39c(0x1d5)]+'\x27'),0x1;},_0x53ef0d);return _0xd163d5[_0x858e20(0x20e)]((_0x30a12e,_0x3be94c)=>_0x30a12e+_0x3be94c,0x0);}export async function executePushJourneys(_0x3c4613,_0x315ad6,_0x4272f6,_0x5f3140,_0x494c4e){const _0x3dcefb=a142_0x119b8a,{journeyDefToRequest:_0x36a792}=await import('./journey-yaml.js'),{activationDefToCreateRequest:_0x189d7b,yamlRuleToApi:_0x10d7d7,validateSegmentRule:_0x220102}=await import(_0x3dcefb(0x1c3)),_0x1a9eb4={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x1baa63=new Map(_0x4272f6[_0x3dcefb(0x1e3)]),_0x5840e6=0x5;for(let _0x381257=0x0;_0x381257<_0x315ad6[_0x3dcefb(0x207)];_0x381257+=_0x5840e6){const _0x44da6c=_0x315ad6[_0x3dcefb(0x25a)](_0x381257,_0x381257+_0x5840e6),_0x254f7c=await Promise[_0x3dcefb(0x231)](_0x44da6c[_0x3dcefb(0x2b1)](async _0x1ea8f1=>{const _0x4ecce9=_0x3dcefb;if(!_0x1ea8f1[_0x4ecce9(0x1c0)]&&!_0x1ea8f1[_0x4ecce9(0x295)])return{'action':_0x4ecce9(0x1e9),'name':_0x1ea8f1[_0x4ecce9(0x257)][_0x4ecce9(0x1d5)],'journeyId':_0x1ea8f1[_0x4ecce9(0x299)]?.['id']};const _0x2b2a1f=_0x1ea8f1[_0x4ecce9(0x1f9)]?_0x4272f6['folderPathToId'][_0x4ecce9(0x255)](_0x1ea8f1[_0x4ecce9(0x1f9)]):undefined;_0x494c4e[_0x4ecce9(0x1fb)]?.({'type':_0x1ea8f1['isNew']?_0x4ecce9(0x201):_0x4ecce9(0x298),'name':_0x1ea8f1[_0x4ecce9(0x257)][_0x4ecce9(0x1d5)]});try{const _0x440ff7=await executeSingleJourneyPush(_0x3c4613,_0x1ea8f1,{..._0x4272f6,'segmentNameToId':_0x1baa63},{'parentId':_0x5f3140['parentId'],'rootFolderId':_0x5f3140['rootFolderId'],'folderId':_0x2b2a1f,'verbose':_0x5f3140['verbose']},_0x494c4e,{'journeyDefToRequest':_0x36a792,'activationDefToCreateRequest':_0x189d7b,'yamlRuleToApi':_0x10d7d7,'validateSegmentRule':_0x220102});for(const [_0x1534e9,_0x27f226]of _0x440ff7[_0x4ecce9(0x1db)]){_0x1baa63[_0x4ecce9(0x1e5)](_0x1534e9,_0x27f226),_0x1a9eb4[_0x4ecce9(0x1db)][_0x4ecce9(0x1e5)](_0x1534e9,_0x27f226);}if(_0x440ff7[_0x4ecce9(0x29c)]==='created')_0x494c4e['onProgress']?.({'type':_0x4ecce9(0x1ca),'name':_0x1ea8f1[_0x4ecce9(0x257)]['name'],'journeyId':_0x440ff7[_0x4ecce9(0x276)]}),_0x494c4e[_0x4ecce9(0x296)]?.(_0x4ecce9(0x282)+_0x1ea8f1['yamlConfig'][_0x4ecce9(0x1d5)]+'\x27'),_0x1a9eb4[_0x4ecce9(0x1dd)]++;else _0x440ff7[_0x4ecce9(0x29c)]===_0x4ecce9(0x1f1)&&(_0x494c4e[_0x4ecce9(0x1fb)]?.({'type':_0x4ecce9(0x26f),'name':_0x1ea8f1[_0x4ecce9(0x257)][_0x4ecce9(0x1d5)]}),_0x494c4e[_0x4ecce9(0x296)]?.('Updated\x20journey\x20\x27'+_0x1ea8f1[_0x4ecce9(0x257)]['name']+'\x27'),_0x1a9eb4[_0x4ecce9(0x1f1)]++);return{'action':_0x440ff7[_0x4ecce9(0x29c)],'name':_0x1ea8f1['yamlConfig'][_0x4ecce9(0x1d5)],'journeyId':_0x440ff7[_0x4ecce9(0x276)]};}catch(_0x4a4781){const _0x38b3d0=isHttp400Error(_0x4a4781),_0x595417=_0x38b3d0?ErrorCode[_0x4ecce9(0x279)]:ErrorCode[_0x4ecce9(0x23e)],_0x71cfdb=getErrorMessage(_0x4a4781);throw new SDKError(_0x595417,_0x4ecce9(0x23c)+(_0x1ea8f1['isNew']?'create':_0x4ecce9(0x1ee))+_0x4ecce9(0x294)+_0x1ea8f1['absolutePath']+_0x4ecce9(0x225)+_0x71cfdb,_0x4a4781);}}));_0x1a9eb4[_0x3dcefb(0x1dc)][_0x3dcefb(0x23a)](..._0x254f7c);}return _0x1a9eb4;}async function matchExistingJourneySegments(_0x4964ba,_0x4ec620,_0x35b07e,_0x400e59,_0x53b91c){const _0x59c368=a142_0x119b8a;if(!_0x4ec620[_0x59c368(0x299)]||!_0x4ec620[_0x59c368(0x257)][_0x59c368(0x1f7)])return;const _0x741a47=new Map(),_0x3cf898=new Set();for(const _0xb5d5b8 of Object[_0x59c368(0x29a)](_0x4ec620[_0x59c368(0x257)]['segments'])){const _0x2b47a8=generateDeterministicJourneySegmentName(_0x4ec620['yamlConfig'][_0x59c368(0x1d5)],_0xb5d5b8);_0x741a47['set'](_0x2b47a8,_0xb5d5b8),_0x3cf898[_0x59c368(0x1e8)](_0xb5d5b8);}const _0x17895a=[],_0x1acf2a=collectSegmentIdsFromJourneyApi(_0x4ec620[_0x59c368(0x299)]);for(const _0x123be9 of _0x1acf2a){const _0x5494cf=await fetchSegment(_0x4964ba,_0x35b07e,_0x123be9,_0x400e59);if(!_0x5494cf?.[_0x59c368(0x1d5)])continue;const _0xfec926=_0x741a47[_0x59c368(0x255)](_0x5494cf[_0x59c368(0x1d5)]);_0xfec926?(_0x53b91c[_0x59c368(0x1e5)](_0xfec926,_0x123be9),_0x3cf898[_0x59c368(0x2bc)](_0xfec926)):_0x17895a['push']({'id':_0x123be9,'seg':_0x5494cf});}if(_0x3cf898['size']>0x0&&_0x17895a[_0x59c368(0x207)]>0x0){const {localExpandedRuleToNames:_0x1aec61}=buildLocalExpandedRuleMappings(_0x4ec620[_0x59c368(0x257)]),_0x7cea12=new Map();for(const {id:_0x598327,seg:_0x47d5b2}of _0x17895a){if(_0x47d5b2[_0x59c368(0x209)]){const _0x26f026=apiRuleToYaml(_0x47d5b2[_0x59c368(0x209)]);_0x7cea12[_0x59c368(0x1e5)](_0x598327,_0x26f026);}}for(const {id:_0x3ce84e,seg:_0x22f829}of _0x17895a){if(!_0x22f829[_0x59c368(0x209)])continue;const _0x55ab96=_0x7cea12[_0x59c368(0x255)](_0x3ce84e);if(!_0x55ab96)continue;const _0x2e86d7=serializeExpandedRule(_0x55ab96,_0x7cea12),_0x86749=_0x1aec61[_0x59c368(0x255)](_0x2e86d7);if(_0x86749){const _0x2b880d=_0x86749[_0x59c368(0x240)](_0xb51de3=>_0x3cf898[_0x59c368(0x215)](_0xb51de3));_0x2b880d&&(_0x53b91c[_0x59c368(0x1e5)](_0x2b880d,_0x3ce84e),_0x3cf898[_0x59c368(0x2bc)](_0x2b880d),logger[_0x59c368(0x245)]('Matched\x20server\x20segment\x20\x27'+_0x22f829[_0x59c368(0x1d5)]+'\x27\x20to\x20local\x20\x27'+_0x2b880d+'\x27\x20by\x20rule\x20content'));}}}}async function executeSingleJourneyPush(_0x3b4182,_0x1f2bd6,_0x41e2d8,_0x343f43,_0x1b02cd,_0x23b2d){const _0x146cb6=a142_0x119b8a,{journeyDefToRequest:_0x45aaa5,activationDefToCreateRequest:_0x2db6be,yamlRuleToApi:_0x29c873,validateSegmentRule:_0x24bdea}=_0x23b2d,_0xc0fa1f=new Map(),_0x5ac523=new Map();recoverSegmentIdsFromPushRecovery(_0x1f2bd6,_0xc0fa1f,_0x41e2d8[_0x146cb6(0x1e3)]);const _0x4d445b=new Map(),_0x4c61ad=new Map(),_0x56dfa2=new Map();let _0x27f7e7;const _0x2c61ad=async()=>{const _0x4a66e4=_0x146cb6;if(_0x27f7e7)return;_0x27f7e7=new Map();if(!_0x1f2bd6[_0x4a66e4(0x299)])return;const _0x4f5dd6=await _0x3b4182[_0x4a66e4(0x1fa)][_0x4a66e4(0x2bf)](_0x1f2bd6[_0x4a66e4(0x299)]['id']);for(const _0xff05ad of _0x4f5dd6){const _0x44fe68=journeyActivationStepToYaml(_0xff05ad,_0x41e2d8[_0x4a66e4(0x29b)],_0x41e2d8['connectionIdToNameMap']),_0x1ef10d=activationSignature(_0x44fe68);!_0x27f7e7[_0x4a66e4(0x215)](_0x1ef10d)&&_0x27f7e7['set'](_0x1ef10d,_0xff05ad['id']),_0x44fe68[_0x4a66e4(0x1d5)]&&_0x5ac523[_0x4a66e4(0x1e5)](_0x44fe68[_0x4a66e4(0x1d5)],_0xff05ad['id']);}};await matchExistingJourneySegments(_0x3b4182,_0x1f2bd6,_0x343f43[_0x146cb6(0x24a)],_0x41e2d8[_0x146cb6(0x281)],_0x41e2d8[_0x146cb6(0x1e3)]);const _0x592680={'resolveSegmentId':async _0x414312=>{const _0x8443f2=_0x146cb6,_0x2b26ea=_0x41e2d8[_0x8443f2(0x1e3)][_0x8443f2(0x255)](_0x414312);if(!_0x2b26ea)throw new SDKError(ErrorCode[_0x8443f2(0x1bc)],_0x8443f2(0x2b0)+_0x414312+'\x20(referenced\x20in\x20journey\x20'+_0x1f2bd6[_0x8443f2(0x257)][_0x8443f2(0x1d5)]+')');return _0x2b26ea;},'resolveEmbeddedSegmentId':async(_0xe09e62,_0x950ccd)=>{const _0x1e6ec9=_0x146cb6,_0x100f97=_0x41e2d8[_0x1e6ec9(0x1e3)][_0x1e6ec9(0x255)](_0xe09e62);if(_0x100f97)return _0x100f97;const _0x3ba189=_0x41e2d8[_0x1e6ec9(0x281)][_0x1e6ec9(0x240)](_0xb161d2=>_0xb161d2['name']===_0xe09e62);if(_0x3ba189)return _0x41e2d8[_0x1e6ec9(0x1e3)][_0x1e6ec9(0x1e5)](_0xe09e62,_0x3ba189['id']),_0x3ba189['id'];if(_0x1f2bd6[_0x1e6ec9(0x1c0)]){const {stageName:_0x2c3d10,criteriaName:_0x5955cf}=findSegmentCriteriaLocation(_0x1f2bd6[_0x1e6ec9(0x257)],_0xe09e62);return _0x24bdea(_0xe09e62,_0x950ccd[_0x1e6ec9(0x209)]),_0x4c61ad['set'](_0xe09e62,{'definition':_0x950ccd,'stageName':_0x2c3d10,'criteriaName':_0x5955cf}),createPendingSegmentId(_0xe09e62);}const _0x507b5f=_0x1f2bd6[_0x1e6ec9(0x299)]?.['id'];if(!_0x507b5f)throw new SDKError(ErrorCode['INTERNAL'],_0x1e6ec9(0x29f));const _0x3d762a=_0x4d445b[_0x1e6ec9(0x255)](_0xe09e62);if(_0x3d762a)return _0x3d762a;const _0x20839=((async()=>{const _0x59fa80=_0x1e6ec9;_0x24bdea(_0xe09e62,_0x950ccd[_0x59fa80(0x209)]);const _0x123b49=generateDeterministicJourneySegmentName(_0x1f2bd6['yamlConfig'][_0x59fa80(0x1d5)],_0xe09e62),_0x5f311b=_0x41e2d8[_0x59fa80(0x281)][_0x59fa80(0x240)](_0x2e1185=>_0x2e1185['name']===_0x123b49),_0x504f1a=createSegmentIdResolver(_0x41e2d8[_0x59fa80(0x1e3)],_0xe09e62),_0x31ac50=await resolveRuleSegmentIds(_0x950ccd[_0x59fa80(0x209)],_0x504f1a);let _0x47d279;return _0x5f311b?(await _0x3b4182[_0x59fa80(0x1ea)][_0x59fa80(0x25f)](_0x343f43[_0x59fa80(0x24a)],_0x5f311b['id'],{'description':_0x950ccd[_0x59fa80(0x243)]||_0x59fa80(0x2a5)+_0xe09e62,'rule':_0x29c873(_0x31ac50,!![]),'countPopulation':!![]}),_0x47d279=_0x5f311b['id'],saveSegmentToPushRecovery(_0x1f2bd6[_0x59fa80(0x1c1)],_0x1f2bd6['yamlConfig'][_0x59fa80(0x1d5)],_0xe09e62,{'segmentId':_0x47d279,'uniqueServerName':_0x123b49,'createdAt':new Date()[_0x59fa80(0x1ce)]()})):_0x47d279=await createOrRecoverEmbeddedSegment(_0x3b4182,_0x1f2bd6,{'localName':_0xe09e62,'uniqueSegmentName':_0x123b49,'description':_0x950ccd[_0x59fa80(0x243)]||'Entry\x20criteria:\x20'+_0xe09e62,'journeyId':_0x507b5f,'resolvedRule':_0x31ac50,'parentId':_0x343f43['parentId'],'folderId':_0x343f43[_0x59fa80(0x233)]||''},_0x29c873),_0x41e2d8[_0x59fa80(0x1e3)][_0x59fa80(0x1e5)](_0xe09e62,_0x47d279),_0xc0fa1f['set'](_0xe09e62,_0x47d279),_0x47d279;})());_0x4d445b[_0x1e6ec9(0x1e5)](_0xe09e62,_0x20839);try{return await _0x20839;}finally{_0x4d445b[_0x1e6ec9(0x2bc)](_0xe09e62);}},'resolveActivationId':async _0x1843b5=>{const _0x8dabfe=_0x146cb6,_0x46b3d9=_0x5ac523[_0x8dabfe(0x255)](_0x1843b5);if(_0x46b3d9)return _0x46b3d9;if(_0x1f2bd6['existingJourney']){await _0x2c61ad();const _0x3f5448=_0x5ac523[_0x8dabfe(0x255)](_0x1843b5);if(_0x3f5448)return _0x3f5448;}throw new SDKError(ErrorCode[_0x8dabfe(0x23b)],_0x8dabfe(0x1ff)+_0x1843b5+_0x8dabfe(0x22d)+_0x1f2bd6[_0x8dabfe(0x257)][_0x8dabfe(0x1d5)]+_0x8dabfe(0x221)+_0x8dabfe(0x21e));},'resolveEmbeddedActivationId':async(_0x143653,_0x3e1e78)=>{const _0x3e18a2=_0x146cb6,_0x3315fb=_0x5ac523[_0x3e18a2(0x255)](_0x143653);if(_0x3315fb)return _0x3315fb;if(_0x1f2bd6['isNew'])return _0x56dfa2[_0x3e18a2(0x1e5)](_0x143653,_0x3e1e78),createPendingActivationId(_0x143653);if(_0x1f2bd6[_0x3e18a2(0x299)]){await _0x2c61ad();const _0x519fc4=_0x5ac523[_0x3e18a2(0x255)](_0x3e1e78[_0x3e18a2(0x1d5)]);if(_0x519fc4)return _0x5ac523[_0x3e18a2(0x1e5)](_0x143653,_0x519fc4),_0x519fc4;const _0x2204be=activationSignature(_0x3e1e78),_0x54c550=_0x27f7e7?.['get'](_0x2204be);if(_0x54c550)return _0x5ac523[_0x3e18a2(0x1e5)](_0x143653,_0x54c550),_0x54c550;const _0x456c5e=await _0x2db6be(_0x3e1e78,_0x41e2d8[_0x3e18a2(0x203)]),_0x5a682e={..._0x456c5e,..._0x3e1e78[_0x3e18a2(0x230)]!==undefined&&{'runAfterJourneyRefresh':_0x3e1e78[_0x3e18a2(0x230)]}},_0x441fe0=await _0x3b4182[_0x3e18a2(0x1fa)]['createActivation'](_0x1f2bd6[_0x3e18a2(0x299)]['id'],_0x5a682e);return _0x5ac523[_0x3e18a2(0x1e5)](_0x143653,_0x441fe0['id']),_0x441fe0['id'];}throw new SDKError(ErrorCode[_0x3e18a2(0x1fe)],_0x3e18a2(0x24c));},'resolveJourneyId':async _0x4b49c2=>{const _0x5ab159=_0x146cb6;try{return await _0x3b4182[_0x5ab159(0x1fa)][_0x5ab159(0x1df)](_0x343f43['parentId'],_0x4b49c2);}catch(_0x5e2bce){throw new SDKError(ErrorCode['NOT_FOUND'],_0x5ab159(0x2a3)+_0x4b49c2+_0x5ab159(0x2a9)+_0x1f2bd6[_0x5ab159(0x257)][_0x5ab159(0x1d5)]+'\x27)',_0x5e2bce);}},'resolveStageId':async(_0x14a8fd,_0x45efba)=>{const _0x5105ed=_0x146cb6,_0x1a997c=await _0x3b4182[_0x5105ed(0x1fa)]['getJourney'](_0x14a8fd),_0x71107d=_0x1a997c[_0x5105ed(0x206)][_0x5105ed(0x223)][_0x5105ed(0x240)](_0x89cd1d=>_0x89cd1d[_0x5105ed(0x1d5)]['toLowerCase']()===_0x45efba[_0x5105ed(0x202)]());if(!_0x71107d?.['id'])throw new SDKError(ErrorCode[_0x5105ed(0x23b)],_0x5105ed(0x216)+_0x45efba+_0x5105ed(0x238)+(_0x1a997c[_0x5105ed(0x206)]['journeyBundleName']||_0x1a997c[_0x5105ed(0x206)][_0x5105ed(0x1d5)])+'\x27');return _0x71107d['id'];}},_0x2e77ad=await _0x45aaa5(_0x1f2bd6[_0x146cb6(0x257)],_0x343f43[_0x146cb6(0x24a)],_0x592680),_0x43b432=_0x343f43['folderId']||_0x343f43[_0x146cb6(0x233)];_0x43b432&&(_0x2e77ad[_0x146cb6(0x1cf)]={'parentFolder':{'data':{'id':_0x43b432,'type':_0x146cb6(0x25c)}}});if(_0x1f2bd6[_0x146cb6(0x1c0)]){if(_0x4c61ad['size']>0x0||_0x56dfa2[_0x146cb6(0x274)]>0x0)return await executeThreeStepJourneyCreate(_0x3b4182,_0x1f2bd6,_0x2e77ad,{'pendingEmbeddedSegments':_0x4c61ad,'pendingEmbeddedActivations':_0x56dfa2,'embeddedSegmentNameToId':_0xc0fa1f,'journeyActivationNameToId':_0x5ac523},{..._0x343f43,'effectiveFolderId':_0x43b432},_0x41e2d8,_0x1b02cd,_0x23b2d);else{ensureJourneyDefaults(_0x2e77ad['attributes']);const _0x53212d=await _0x3b4182['journey'][_0x146cb6(0x1cb)](_0x2e77ad);return deletePushRecovery(_0x1f2bd6['absolutePath']),{'action':_0x146cb6(0x1dd),'journeyId':_0x53212d['id'],'embeddedSegmentNameToId':_0xc0fa1f};}}else{if(_0x1f2bd6[_0x146cb6(0x295)]&&_0x1f2bd6[_0x146cb6(0x299)]){_0x2e77ad['id']=_0x1f2bd6['existingJourney']['id'];const _0xf4275b=_0x2e77ad[_0x146cb6(0x206)];_0x1f2bd6[_0x146cb6(0x299)]['attributes']?.['journeyBundleName']&&(_0xf4275b['journeyBundleName']=_0x1f2bd6[_0x146cb6(0x299)]['attributes'][_0x146cb6(0x297)]);const _0x11bffb=_0x1f2bd6[_0x146cb6(0x299)]['attributes']?.[_0x146cb6(0x223)];return _0x11bffb&&_0x2e77ad[_0x146cb6(0x206)]['journeyStages']&&injectExistingStageIds(_0x2e77ad[_0x146cb6(0x206)][_0x146cb6(0x223)],_0x11bffb),ensureJourneyDefaults(_0xf4275b),await _0x3b4182[_0x146cb6(0x1fa)]['update'](_0x1f2bd6[_0x146cb6(0x299)]['id'],_0x2e77ad),deletePushRecovery(_0x1f2bd6['absolutePath']),{'action':_0x146cb6(0x1f1),'journeyId':_0x1f2bd6[_0x146cb6(0x299)]['id'],'embeddedSegmentNameToId':_0xc0fa1f};}}return deletePushRecovery(_0x1f2bd6[_0x146cb6(0x1c1)]),{'action':_0x146cb6(0x1e9),'journeyId':_0x1f2bd6[_0x146cb6(0x299)]?.['id'],'embeddedSegmentNameToId':_0xc0fa1f};}function findSegmentCriteriaLocation(_0x296073,_0x28a46e){const _0x26e7c3=a142_0x119b8a,_0x969d13=_0x296073[_0x26e7c3(0x2ac)]||_0x296073[_0x26e7c3(0x1f8)]?.[0x0]?.[_0x26e7c3(0x2ac)]||[];let _0xbc334d=_0x26e7c3(0x27e),_0x119cb6=_0x28a46e;const _0x4874aa=_0x296073['goal']||_0x296073['journeys']?.[0x0]?.['goal'];if(_0x4874aa?.[_0x26e7c3(0x1ea)]===_0x28a46e)return{'stageName':_0x26e7c3(0x1f5),'criteriaName':_0x4874aa['name']||_0x28a46e};_0x32e0ce:for(const _0x1f2b31 of _0x969d13){if(_0x1f2b31['entry_criteria']?.[_0x26e7c3(0x1ea)]===_0x28a46e){_0xbc334d=_0x1f2b31['name'],_0x119cb6=_0x1f2b31[_0x26e7c3(0x239)]['name']||_0x28a46e;break;}if(_0x1f2b31[_0x26e7c3(0x254)])for(const _0x17b853 of _0x1f2b31[_0x26e7c3(0x254)]){if(_0x17b853[_0x26e7c3(0x1e7)]===_0x26e7c3(0x2b9)&&_0x17b853['with']?.[_0x26e7c3(0x2af)])for(const _0xe4b7af of _0x17b853[_0x26e7c3(0x22f)][_0x26e7c3(0x2af)]){if(_0xe4b7af[_0x26e7c3(0x1ea)]===_0x28a46e){_0xbc334d=_0x1f2b31[_0x26e7c3(0x1d5)],_0x119cb6=_0xe4b7af[_0x26e7c3(0x1d5)]||_0x28a46e;break _0x32e0ce;}}}}return{'stageName':_0xbc334d,'criteriaName':_0x119cb6};}function a142_0x3007(_0xc1ae4e,_0x4ae4e5){_0xc1ae4e=_0xc1ae4e-0x1b9;const _0x2b21b0=a142_0x2b21();let _0x3007db=_0x2b21b0[_0xc1ae4e];return _0x3007db;}async function executeThreeStepJourneyCreate(_0x7becea,_0xb2f641,_0x1b2369,_0x5418c9,_0x3b894d,_0x2f0b84,_0x5465be,_0xf11fee){const _0x13b9d4=a142_0x119b8a,{activationDefToCreateRequest:_0x4450c0,yamlRuleToApi:_0x23df70}=_0xf11fee,{pendingEmbeddedSegments:_0x181fed,pendingEmbeddedActivations:_0x2931eb,embeddedSegmentNameToId:_0x10049c}=_0x5418c9,_0xfa2585=JSON[_0x13b9d4(0x2ab)](JSON['stringify'](_0x1b2369));ensureJourneyDefaults(_0xfa2585['attributes']),stripPendingIds(_0xfa2585);const _0x1178cd=await _0x7becea[_0x13b9d4(0x1fa)]['create'](_0xfa2585),_0x2929e3=_0x1178cd['id'],_0x621450=new Map();for(const _0x5c5aed of _0x1178cd[_0x13b9d4(0x206)]['journeyStages']){_0x621450[_0x13b9d4(0x1e5)](_0x5c5aed[_0x13b9d4(0x1d5)][_0x13b9d4(0x202)](),_0x5c5aed['id']);}recoverSegmentIdsFromPushRecovery(_0xb2f641,_0x10049c,_0x2f0b84[_0x13b9d4(0x1e3)]);for(const [_0xcb288c,{definition:_0x4dd65b}]of _0x181fed){if(_0x10049c[_0x13b9d4(0x215)](_0xcb288c)){_0x5465be[_0x13b9d4(0x1fb)]?.({'type':_0x13b9d4(0x252),'journeyName':_0xb2f641['yamlConfig'][_0x13b9d4(0x1d5)],'segmentName':_0xcb288c});continue;}const _0x5f1637=generateDeterministicJourneySegmentName(_0xb2f641[_0x13b9d4(0x257)][_0x13b9d4(0x1d5)],_0xcb288c);_0x5465be[_0x13b9d4(0x1fb)]?.({'type':_0x13b9d4(0x262),'journeyName':_0xb2f641[_0x13b9d4(0x257)][_0x13b9d4(0x1d5)],'segmentName':_0xcb288c});const _0x4007f0=createSegmentIdResolver(_0x2f0b84[_0x13b9d4(0x1e3)],_0xcb288c),_0x3927cc=await resolveRuleSegmentIds(_0x4dd65b[_0x13b9d4(0x209)],_0x4007f0),_0x424b97=await createOrRecoverEmbeddedSegment(_0x7becea,_0xb2f641,{'localName':_0xcb288c,'uniqueSegmentName':_0x5f1637,'description':_0x4dd65b[_0x13b9d4(0x243)]||_0x13b9d4(0x2a5)+_0xcb288c,'journeyId':_0x2929e3,'resolvedRule':_0x3927cc,'parentId':_0x3b894d[_0x13b9d4(0x24a)],'folderId':_0x3b894d[_0x13b9d4(0x208)]||''},_0x23df70);_0x10049c[_0x13b9d4(0x1e5)](_0xcb288c,_0x424b97),_0x2f0b84[_0x13b9d4(0x1e3)][_0x13b9d4(0x1e5)](_0xcb288c,_0x424b97),_0x5465be[_0x13b9d4(0x1fb)]?.({'type':_0x13b9d4(0x252),'journeyName':_0xb2f641[_0x13b9d4(0x257)]['name'],'segmentName':_0xcb288c});}const _0x109914=new Map();for(const [_0x138c18,_0x1f1b65]of _0x2931eb){_0x5465be['onProgress']?.({'type':_0x13b9d4(0x1d3),'journeyName':_0xb2f641[_0x13b9d4(0x257)][_0x13b9d4(0x1d5)],'activationName':_0x138c18});const _0x262068=await _0x4450c0(_0x1f1b65,_0x2f0b84['activationContext']),_0x3cc25a={..._0x262068,..._0x1f1b65[_0x13b9d4(0x230)]!==undefined&&{'runAfterJourneyRefresh':_0x1f1b65[_0x13b9d4(0x230)]}},_0x1b971e=await _0x7becea[_0x13b9d4(0x1fa)]['createActivation'](_0x2929e3,_0x3cc25a);_0x109914[_0x13b9d4(0x1e5)](_0x138c18,_0x1b971e['id']),_0x5418c9['journeyActivationNameToId'][_0x13b9d4(0x1e5)](_0x138c18,_0x1b971e['id']),_0x5465be[_0x13b9d4(0x1fb)]?.({'type':_0x13b9d4(0x1d8),'journeyName':_0xb2f641[_0x13b9d4(0x257)][_0x13b9d4(0x1d5)],'activationName':_0x138c18});}const _0x942075=JSON[_0x13b9d4(0x2ab)](JSON[_0x13b9d4(0x2a6)](_0x1b2369));return _0x942075['id']=_0x2929e3,ensureJourneyDefaults(_0x942075[_0x13b9d4(0x206)]),resolvePendingIdsInRequest(_0x942075,_0x1b2369,_0x621450,_0x10049c,_0x109914,_0x5465be),await _0x7becea[_0x13b9d4(0x1fa)][_0x13b9d4(0x1ee)](_0x2929e3,_0x942075),deletePushRecovery(_0xb2f641['absolutePath']),{'action':_0x13b9d4(0x1dd),'journeyId':_0x2929e3,'embeddedSegmentNameToId':_0x10049c};}export function stripWaitStepPendingIds(_0x3e7830){const _0x4cd8fd=a142_0x119b8a,_0x12bd6c=_0x3e7830[_0x4cd8fd(0x26b)]&&isPendingSegmentId(_0x3e7830[_0x4cd8fd(0x26b)]),_0xa17fb2=_0x3e7830[_0x4cd8fd(0x2b3)]?.[_0x4cd8fd(0x217)](_0x4cb3aa=>_0x4cb3aa[_0x4cd8fd(0x278)]&&isPendingSegmentId(_0x4cb3aa[_0x4cd8fd(0x278)]));(_0x12bd6c||_0xa17fb2)&&(_0x3e7830[_0x4cd8fd(0x224)]=_0x4cd8fd(0x2a1),_0x3e7830[_0x4cd8fd(0x200)]=0x1,_0x3e7830[_0x4cd8fd(0x24d)]=_0x4cd8fd(0x24f),delete _0x3e7830['conditionSegmentId'],delete _0x3e7830[_0x4cd8fd(0x2b5)],delete _0x3e7830[_0x4cd8fd(0x289)],delete _0x3e7830[_0x4cd8fd(0x2b3)]);}export function resolveWaitStepPendingIds(_0x6a11bf,_0x1e8431,_0x57b0e9,_0x109e8){const _0x3f1145=a142_0x119b8a;if(_0x1e8431[_0x3f1145(0x26b)]&&isPendingSegmentId(_0x1e8431['conditionSegmentId'])){const _0x360176=_0x57b0e9(_0x1e8431[_0x3f1145(0x26b)],_0x3f1145(0x2bb)+_0x109e8+_0x3f1145(0x23f));_0x360176&&(_0x6a11bf['waitStepType']='Condition',_0x6a11bf[_0x3f1145(0x26b)]=_0x360176,delete _0x6a11bf[_0x3f1145(0x200)],delete _0x6a11bf[_0x3f1145(0x24d)],_0x1e8431[_0x3f1145(0x2b5)]!==undefined&&(_0x6a11bf[_0x3f1145(0x2b5)]=_0x1e8431[_0x3f1145(0x2b5)]),_0x1e8431[_0x3f1145(0x289)]&&(_0x6a11bf[_0x3f1145(0x289)]=_0x1e8431[_0x3f1145(0x289)]));}if(_0x1e8431['conditions']){const _0x571b89=_0x1e8431[_0x3f1145(0x2b3)]['some'](_0x33b6fb=>_0x33b6fb[_0x3f1145(0x278)]&&isPendingSegmentId(_0x33b6fb[_0x3f1145(0x278)]));if(_0x571b89){const _0x2ac240=_0x1e8431[_0x3f1145(0x2b3)][_0x3f1145(0x2b1)](_0x5928a9=>{const _0x162c37=_0x3f1145;if(_0x5928a9[_0x162c37(0x278)]&&isPendingSegmentId(_0x5928a9[_0x162c37(0x278)])){const _0x57f2f8=_0x57b0e9(_0x5928a9[_0x162c37(0x278)],_0x162c37(0x2bb)+_0x109e8+'\x27\x20wait\x20condition');return{..._0x5928a9,'segmentId':_0x57f2f8||_0x5928a9['segmentId']};}return{..._0x5928a9};});_0x6a11bf[_0x3f1145(0x224)]='Condition',_0x6a11bf[_0x3f1145(0x2b3)]=_0x2ac240,delete _0x6a11bf[_0x3f1145(0x200)],delete _0x6a11bf[_0x3f1145(0x24d)],delete _0x6a11bf[_0x3f1145(0x26b)],delete _0x6a11bf[_0x3f1145(0x2b5)],delete _0x6a11bf[_0x3f1145(0x289)];}}}function stripPendingIds(_0xefc5f){const _0x5f4d6d=a142_0x119b8a;_0xefc5f[_0x5f4d6d(0x206)][_0x5f4d6d(0x1f5)]?.[_0x5f4d6d(0x278)]&&isPendingSegmentId(_0xefc5f[_0x5f4d6d(0x206)][_0x5f4d6d(0x1f5)][_0x5f4d6d(0x278)])&&delete _0xefc5f[_0x5f4d6d(0x206)]['goal'];for(const _0x357150 of _0xefc5f[_0x5f4d6d(0x206)]['journeyStages']||[]){_0x357150['entryCriteria']?.[_0x5f4d6d(0x278)]&&isPendingSegmentId(_0x357150[_0x5f4d6d(0x26a)][_0x5f4d6d(0x278)])&&delete _0x357150[_0x5f4d6d(0x26a)];_0x357150[_0x5f4d6d(0x237)]?.[_0x5f4d6d(0x278)]&&isPendingSegmentId(_0x357150[_0x5f4d6d(0x237)][_0x5f4d6d(0x278)])&&delete _0x357150['milestone'];_0x357150[_0x5f4d6d(0x256)]&&(_0x357150['exitCriterias']=_0x357150[_0x5f4d6d(0x256)][_0x5f4d6d(0x2be)](_0xb2b311=>!_0xb2b311['segmentId']||!isPendingSegmentId(_0xb2b311[_0x5f4d6d(0x278)])));if(_0x357150[_0x5f4d6d(0x254)])for(const _0x447dcf of Object[_0x5f4d6d(0x29a)](_0x357150[_0x5f4d6d(0x254)])){const _0x3554a9=_0x357150[_0x5f4d6d(0x254)][_0x447dcf];_0x3554a9[_0x5f4d6d(0x1e7)]===_0x5f4d6d(0x247)&&_0x3554a9[_0x5f4d6d(0x1bb)]&&isPendingActivationId(_0x3554a9['journeyActivationStepId'])&&(_0x3554a9['journeyActivationStepId']='');if(_0x3554a9[_0x5f4d6d(0x1e7)]==='DecisionPoint'&&_0x3554a9[_0x5f4d6d(0x2af)])for(const _0x8009df of _0x3554a9[_0x5f4d6d(0x2af)]){_0x8009df[_0x5f4d6d(0x278)]&&isPendingSegmentId(_0x8009df[_0x5f4d6d(0x278)])&&(_0x8009df[_0x5f4d6d(0x278)]='');}_0x3554a9['type']===_0x5f4d6d(0x22e)&&stripWaitStepPendingIds(_0x3554a9);}}}function resolvePendingIdsInRequest(_0x3d57c8,_0x208f0b,_0x2e0519,_0x46ec09,_0x415230,_0x5dd185){const _0x5b9f90=a142_0x119b8a,_0x2cd91d=(_0x3a7edf,_0x93874)=>{const _0x39c5ba=a142_0x3007;if(!isPendingSegmentId(_0x3a7edf))return _0x3a7edf;const _0x4a5a0c=extractPendingSegmentName(_0x3a7edf),_0x870831=_0x46ec09[_0x39c5ba(0x255)](_0x4a5a0c);return!_0x870831&&_0x5dd185[_0x39c5ba(0x246)]?.(_0x39c5ba(0x286)+_0x4a5a0c+_0x39c5ba(0x1bd)+_0x93874),_0x870831;};if(_0x3d57c8[_0x5b9f90(0x206)][_0x5b9f90(0x1f5)]?.[_0x5b9f90(0x278)]&&isPendingSegmentId(_0x3d57c8[_0x5b9f90(0x206)][_0x5b9f90(0x1f5)]['segmentId'])){const _0x4dbb66=_0x2cd91d(_0x3d57c8['attributes'][_0x5b9f90(0x1f5)]['segmentId'],_0x5b9f90(0x1eb));_0x4dbb66&&(_0x3d57c8[_0x5b9f90(0x206)][_0x5b9f90(0x1f5)][_0x5b9f90(0x278)]=_0x4dbb66);}for(const _0x7d2e7f of _0x3d57c8['attributes'][_0x5b9f90(0x223)]||[]){const _0x1acea4=_0x2e0519[_0x5b9f90(0x255)](_0x7d2e7f['name']['toLowerCase']());_0x1acea4&&(_0x7d2e7f['id']=_0x1acea4);if(_0x7d2e7f['entryCriteria']?.[_0x5b9f90(0x278)]&&isPendingSegmentId(_0x7d2e7f[_0x5b9f90(0x26a)][_0x5b9f90(0x278)])){const _0xf57f36=_0x2cd91d(_0x7d2e7f[_0x5b9f90(0x26a)][_0x5b9f90(0x278)],_0x5b9f90(0x2bb)+_0x7d2e7f[_0x5b9f90(0x1d5)]+_0x5b9f90(0x1e6));_0xf57f36&&(_0x7d2e7f['entryCriteria'][_0x5b9f90(0x278)]=_0xf57f36);}if(_0x7d2e7f[_0x5b9f90(0x256)])for(const _0x8a8650 of _0x7d2e7f[_0x5b9f90(0x256)]){if(_0x8a8650['segmentId']&&isPendingSegmentId(_0x8a8650['segmentId'])){const _0x3945d4=_0x2cd91d(_0x8a8650[_0x5b9f90(0x278)],_0x5b9f90(0x2bb)+_0x7d2e7f[_0x5b9f90(0x1d5)]+'\x27\x20exit\x20criteria');_0x3945d4&&(_0x8a8650[_0x5b9f90(0x278)]=_0x3945d4);}}if(_0x7d2e7f[_0x5b9f90(0x237)]?.[_0x5b9f90(0x278)]&&isPendingSegmentId(_0x7d2e7f['milestone'][_0x5b9f90(0x278)])){const _0x4d30e8=_0x2cd91d(_0x7d2e7f['milestone']['segmentId'],'stage\x20\x27'+_0x7d2e7f[_0x5b9f90(0x1d5)]+_0x5b9f90(0x250));_0x4d30e8&&(_0x7d2e7f[_0x5b9f90(0x237)][_0x5b9f90(0x278)]=_0x4d30e8);}if(_0x7d2e7f['steps']){const _0x242301=_0x59983b=>_0x208f0b[_0x5b9f90(0x206)][_0x5b9f90(0x223)]?.[_0x5b9f90(0x240)](_0x5434dd=>_0x5434dd['name'][_0x5b9f90(0x202)]()===_0x7d2e7f[_0x5b9f90(0x1d5)][_0x5b9f90(0x202)]())?.[_0x5b9f90(0x254)]?.[_0x59983b];for(const _0x4c1c48 of Object[_0x5b9f90(0x29a)](_0x7d2e7f[_0x5b9f90(0x254)])){const _0x1fe375=_0x7d2e7f['steps'][_0x4c1c48],_0x2ae32b=_0x242301(_0x4c1c48);if(_0x1fe375[_0x5b9f90(0x1e7)]===_0x5b9f90(0x247)&&_0x1fe375[_0x5b9f90(0x1bb)]&&(isPendingActivationId(_0x1fe375[_0x5b9f90(0x1bb)])||_0x1fe375[_0x5b9f90(0x1bb)]==='')){if(_0x2ae32b?.[_0x5b9f90(0x1bb)]&&isPendingActivationId(_0x2ae32b[_0x5b9f90(0x1bb)])){const _0x25b470=extractPendingActivationName(_0x2ae32b[_0x5b9f90(0x1bb)]),_0x31f601=_0x415230[_0x5b9f90(0x255)](_0x25b470);_0x31f601&&(_0x1fe375['journeyActivationStepId']=_0x31f601);}}if(_0x1fe375['type']===_0x5b9f90(0x261)&&_0x1fe375[_0x5b9f90(0x2af)]&&_0x2ae32b?.[_0x5b9f90(0x2af)])for(let _0x3ae288=0x0;_0x3ae288<_0x1fe375[_0x5b9f90(0x2af)][_0x5b9f90(0x207)];_0x3ae288++){const _0x5a6576=_0x1fe375[_0x5b9f90(0x2af)][_0x3ae288],_0x22ce1a=_0x2ae32b[_0x5b9f90(0x2af)][_0x3ae288];if(_0x22ce1a?.['segmentId']&&isPendingSegmentId(_0x22ce1a[_0x5b9f90(0x278)])){const _0x4c9f86=_0x2cd91d(_0x22ce1a[_0x5b9f90(0x278)],'stage\x20\x27'+_0x7d2e7f[_0x5b9f90(0x1d5)]+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x5a6576[_0x5b9f90(0x1d5)]||_0x3ae288)+'\x27');_0x4c9f86&&(_0x5a6576[_0x5b9f90(0x278)]=_0x4c9f86);}}_0x1fe375[_0x5b9f90(0x1e7)]===_0x5b9f90(0x22e)&&_0x2ae32b?.[_0x5b9f90(0x1e7)]===_0x5b9f90(0x22e)&&resolveWaitStepPendingIds(_0x1fe375,_0x2ae32b,_0x2cd91d,_0x7d2e7f['name']);}}}}
1
+ const a142_0x5b9def=a142_0x361a;(function(_0x35f6f5,_0x5c8d44){const _0x30be72=a142_0x361a,_0x2e27c0=_0x35f6f5();while(!![]){try{const _0x2c5395=parseInt(_0x30be72(0x1d0))/0x1+-parseInt(_0x30be72(0x18e))/0x2+-parseInt(_0x30be72(0x1bd))/0x3*(-parseInt(_0x30be72(0x209))/0x4)+-parseInt(_0x30be72(0x18c))/0x5*(-parseInt(_0x30be72(0x12f))/0x6)+-parseInt(_0x30be72(0x21a))/0x7+-parseInt(_0x30be72(0x1ae))/0x8+parseInt(_0x30be72(0x1e9))/0x9*(parseInt(_0x30be72(0x1f3))/0xa);if(_0x2c5395===_0x5c8d44)break;else _0x2e27c0['push'](_0x2e27c0['shift']());}catch(_0x58c4d5){_0x2e27c0['push'](_0x2e27c0['shift']());}}}(a142_0x3d03,0x3648b));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a142_0x5b9def(0x16a));export const PENDING_SEGMENT_PREFIX=a142_0x5b9def(0x220);export const PENDING_ACTIVATION_PREFIX=a142_0x5b9def(0x13f);export function createPendingSegmentId(_0x13c79b){return''+PENDING_SEGMENT_PREFIX+_0x13c79b+'__';}export function isPendingSegmentId(_0x4ad2d3){const _0x17661e=a142_0x5b9def;return _0x4ad2d3['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x4ad2d3[_0x17661e(0x1ff)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x1c511a){const _0x259067=a142_0x5b9def;return _0x1c511a[_0x259067(0x1d4)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x147ccf){return''+PENDING_ACTIVATION_PREFIX+_0x147ccf+'__';}function a142_0x361a(_0x14676b,_0x3c423f){_0x14676b=_0x14676b-0x124;const _0x3d033d=a142_0x3d03();let _0x361ab4=_0x3d033d[_0x14676b];return _0x361ab4;}export function isPendingActivationId(_0x3f432a){return _0x3f432a['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x1f077a){const _0x2ad562=a142_0x5b9def;return _0x1f077a[_0x2ad562(0x1d4)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x3e2e21,_0x4e10bd){const _0x24ac83=a142_0x5b9def,_0x3b3f8a=_0x3e2e21+'::'+(_0x4e10bd[_0x24ac83(0x12b)]()||'segment'),_0x57a75c=createHash(_0x24ac83(0x21b))[_0x24ac83(0x1c3)](_0x3b3f8a)[_0x24ac83(0x142)]('hex')[_0x24ac83(0x12e)](0x0,0xc);return'journey_entry_criteria_'+_0x57a75c;}export function ensureJourneyDefaults(_0xd398f4){const _0x433b17=a142_0x5b9def;!_0xd398f4[_0x433b17(0x190)]&&(_0xd398f4[_0x433b17(0x190)]=''),!_0xd398f4[_0x433b17(0x179)]&&(_0xd398f4[_0x433b17(0x179)]=_0x433b17(0x124));}export function injectExistingStageIds(_0x1fd4be,_0x9a7690){const _0x32e889=a142_0x5b9def,_0x2f61fc=new Map(_0x9a7690[_0x32e889(0x17c)](_0x134f88=>[_0x134f88[_0x32e889(0x13e)],_0x134f88['id']]));for(const _0x1f1052 of _0x1fd4be){if(!_0x1f1052['id']){const _0x15d5f8=_0x2f61fc[_0x32e889(0x1b1)](_0x1f1052[_0x32e889(0x13e)]);_0x15d5f8&&(_0x1f1052['id']=_0x15d5f8);}}}export function resolveTDFolderPath(_0x446a17,_0x584c97,_0x3dee29){const _0xc653c6=a142_0x5b9def;if(!_0x584c97)return _0x446a17;if(_0x446a17===_0x3dee29||_0x446a17[_0xc653c6(0x1ff)](_0x3dee29+'/'))return _0x446a17;return _0x446a17?_0x3dee29+'/'+_0x446a17:_0x3dee29;}export function addFoldersToCreate(_0x101458,_0x2d9641,_0x2c0ea9){const _0x72b1ce=a142_0x5b9def;if(!_0x101458)return;if(_0x2d9641[_0x72b1ce(0x1da)](_0x101458))return;const _0x130e26=_0x101458[_0x72b1ce(0x208)]('/');let _0x1f1922='';for(const _0x1cdc1b of _0x130e26){_0x1f1922=_0x1f1922?_0x1f1922+'/'+_0x1cdc1b:_0x1cdc1b,!_0x2d9641['has'](_0x1f1922)&&_0x2c0ea9['add'](_0x1f1922);}}export function sortFoldersByDepth(_0x2c6f2e){const _0x53c4f9=a142_0x5b9def;return[..._0x2c6f2e][_0x53c4f9(0x1f8)]((_0x5ee70c,_0x257db8)=>{const _0x18671d=_0x53c4f9,_0x1bd985=(_0x5ee70c[_0x18671d(0x1e2)](/\//g)||[])['length'],_0x255b87=(_0x257db8['match'](/\//g)||[])[_0x18671d(0x164)];return _0x1bd985-_0x255b87;});}import*as a142_0x2bab56 from'yaml';import{readFileSync}from'fs';import a142_0x30beb9 from'path';import{isJourneyDef,parseYamlString as a142_0x2abc5a,toYamlString as a142_0x4333ae,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(_0x55f503){const _0x5e7762=a142_0x5b9def;if(Array['isArray'](_0x55f503))return'['+_0x55f503[_0x5e7762(0x17c)](_0x5ecf29=>stableStringify(_0x5ecf29))[_0x5e7762(0x1e3)](',')+']';if(_0x55f503&&typeof _0x55f503===_0x5e7762(0x180)){const _0xe7d24f=_0x55f503,_0x29c002=Object[_0x5e7762(0x205)](_0xe7d24f)[_0x5e7762(0x1f8)](),_0x45e906=_0x29c002[_0x5e7762(0x17c)](_0x392a45=>'\x22'+_0x392a45+'\x22:'+stableStringify(_0xe7d24f[_0x392a45]));return'{'+_0x45e906[_0x5e7762(0x1e3)](',')+'}';}const _0x49a21c=JSON[_0x5e7762(0x1dd)](_0x55f503);return _0x49a21c===undefined?'null':_0x49a21c;}function activationSignature(_0x230781){const _0x2c217b=a142_0x5b9def,_0x302f57={'connection':_0x230781[_0x2c217b(0x13c)],..._0x230781[_0x2c217b(0x174)]!==undefined&&{'all_columns':_0x230781['all_columns']},..._0x230781[_0x2c217b(0x1a1)]!==undefined&&{'columns':_0x230781[_0x2c217b(0x1a1)]},..._0x230781[_0x2c217b(0x224)]!==undefined&&{'behavior':_0x230781[_0x2c217b(0x224)]},..._0x230781[_0x2c217b(0x137)]!==undefined&&{'schedule':_0x230781['schedule']},..._0x230781[_0x2c217b(0x1dc)]!==undefined&&{'notification':_0x230781[_0x2c217b(0x1dc)]},..._0x230781[_0x2c217b(0x1f9)]!==undefined&&{'connector_config':_0x230781[_0x2c217b(0x1f9)]},..._0x230781[_0x2c217b(0x1e6)]!==undefined&&{'activation_template_id':_0x230781[_0x2c217b(0x1e6)]}};return stableStringify(_0x302f57);}async function fetchSegment(_0x80bf7f,_0x43343b,_0x474cca,_0x3004c0){const _0x33c67d=a142_0x5b9def,_0x109f71=_0x3004c0?.[_0x33c67d(0x1c5)](_0x2f9ea9=>_0x2f9ea9['id']===_0x474cca);if(_0x109f71)return _0x109f71;try{return await _0x80bf7f[_0x33c67d(0x162)][_0x33c67d(0x14d)](_0x43343b,_0x474cca);}catch(_0x158ade){logger[_0x33c67d(0x1c7)]('getSegment\x20failed\x20for\x20'+_0x474cca+_0x33c67d(0x1c0)+_0x158ade);try{return await _0x80bf7f[_0x33c67d(0x162)][_0x33c67d(0x1cc)](_0x474cca);}catch(_0x52055f){return logger[_0x33c67d(0x1c7)](_0x33c67d(0x1e5)+_0x474cca+':\x20'+_0x52055f),null;}}}function recoverSegmentIdsFromPushRecovery(_0x3792dc,_0x3a2b30,_0x4e76a9){const _0x2881f5=a142_0x5b9def,_0x56addc=readPushRecovery(_0x3792dc['absolutePath']);if(_0x56addc?.[_0x2881f5(0x183)]===_0x3792dc[_0x2881f5(0x219)][_0x2881f5(0x13e)])for(const [_0x105559,_0x2dc7e2]of Object[_0x2881f5(0x181)](_0x56addc[_0x2881f5(0x15b)])){const _0x1869a1=generateDeterministicJourneySegmentName(_0x3792dc[_0x2881f5(0x219)][_0x2881f5(0x13e)],_0x105559);_0x2dc7e2['uniqueServerName']===_0x1869a1&&(_0x3a2b30[_0x2881f5(0x204)](_0x105559,_0x2dc7e2[_0x2881f5(0x191)]),_0x4e76a9['set'](_0x105559,_0x2dc7e2[_0x2881f5(0x191)]));}}async function createOrRecoverEmbeddedSegment(_0xf91b10,_0x50ed06,_0x373a50,_0x3fc75c){const _0x2aa6f4=a142_0x5b9def;let _0x3d5b6a;try{_0x3d5b6a=await _0xf91b10[_0x2aa6f4(0x162)][_0x2aa6f4(0x196)]({'name':_0x373a50['uniqueSegmentName'],'description':_0x373a50[_0x2aa6f4(0x190)],'journeyId':_0x373a50[_0x2aa6f4(0x1b7)],'rule':_0x3fc75c(_0x373a50[_0x2aa6f4(0x1bc)],!![]),'countPopulation':!![],'parentFolderId':_0x373a50['folderId'],'audienceId':_0x373a50[_0x2aa6f4(0x13d)]});}catch(_0x5aaa61){const _0x1a9cea=_0x5aaa61 instanceof Error&&_0x5aaa61[_0x2aa6f4(0x18f)][_0x2aa6f4(0x16b)]('Name\x20has\x20already\x20been\x20taken');if(_0x1a9cea){const _0x4db459=readPushRecovery(_0x50ed06['absolutePath']),_0x24d5d5=_0x4db459?.[_0x2aa6f4(0x183)]===_0x50ed06[_0x2aa6f4(0x219)]['name']?_0x4db459[_0x2aa6f4(0x15b)][_0x373a50[_0x2aa6f4(0x1e4)]]:undefined;if(_0x24d5d5?.[_0x2aa6f4(0x201)]===_0x373a50[_0x2aa6f4(0x130)])await _0xf91b10[_0x2aa6f4(0x162)][_0x2aa6f4(0x1df)](_0x373a50['parentId'],_0x24d5d5[_0x2aa6f4(0x191)],{'description':_0x373a50['description'],'rule':_0x3fc75c(_0x373a50['resolvedRule'],!![]),'countPopulation':!![]}),_0x3d5b6a=_0x24d5d5[_0x2aa6f4(0x191)];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],_0x2aa6f4(0x19a)+_0x373a50[_0x2aa6f4(0x1e4)]+_0x2aa6f4(0x15f)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x50ed06[_0x2aa6f4(0x156)]['replace'](/([^/]+)$/,_0x2aa6f4(0x195))+')\x20')+_0x2aa6f4(0x12d),_0x5aaa61);}else throw _0x5aaa61;}return saveSegmentToPushRecovery(_0x50ed06[_0x2aa6f4(0x156)],_0x50ed06[_0x2aa6f4(0x219)][_0x2aa6f4(0x13e)],_0x373a50[_0x2aa6f4(0x1e4)],{'segmentId':_0x3d5b6a,'uniqueServerName':_0x373a50[_0x2aa6f4(0x130)],'createdAt':new Date()[_0x2aa6f4(0x177)]()}),_0x3d5b6a;}export async function prepareSegmentFiles(_0x88ed8b,_0x13bb44,_0x1f028a,_0x47f0a9,_0x4bacac){const _0x22e14e=a142_0x5b9def,{activationDefToCreateRequest:_0x1d5db8}=await import('./child-segment-yaml.js'),_0x10a485=[],_0xe8566a=new Set();for(const {yamlConfig:_0x1bc3d5,folderPath:_0x461670,sourcePath:_0x59dc5e}of _0x88ed8b){const _0x4ff918=resolveTDFolderPath(_0x461670,_0x47f0a9,_0x4bacac),_0x4effad=_0x4ff918+':'+_0x1bc3d5[_0x22e14e(0x13e)],_0x200f5c=_0x13bb44['segmentByFolderAndName'][_0x22e14e(0x1b1)](_0x4effad),_0x531575=_0x200f5c?_0x13bb44['activationsBySegmentId'][_0x22e14e(0x1b1)](_0x200f5c['id'])||[]:[];addFoldersToCreate(_0x4ff918,_0x13bb44[_0x22e14e(0x1db)],_0xe8566a);const _0x1dcb74=calculateActivationActions(_0x1bc3d5[_0x22e14e(0x1d5)]||[],_0x531575,_0x13bb44[_0x22e14e(0x141)],_0x13bb44[_0x22e14e(0x1d9)]);for(const _0x123fba of _0x1dcb74){(_0x123fba[_0x22e14e(0x17b)]===_0x22e14e(0x1d1)||_0x123fba['type']===_0x22e14e(0x1c3))&&_0x123fba[_0x22e14e(0x12c)]&&(_0x123fba['validatedRequest']=await _0x1d5db8(_0x123fba[_0x22e14e(0x12c)],_0x1f028a));}const _0x53a5b8=calculateSegmentDiff(_0x1bc3d5,_0x200f5c,_0x531575,_0x13bb44[_0x22e14e(0x141)],_0x13bb44[_0x22e14e(0x1d9)]);_0x10a485[_0x22e14e(0x188)]({'relativePath':_0x1bc3d5['name'],'absolutePath':_0x59dc5e,'yamlConfig':_0x1bc3d5,'folderPath':_0x4ff918,'existingSegment':_0x200f5c,'existingActivations':_0x531575,'isNew':_0x53a5b8[_0x22e14e(0x1af)],'hasChanges':_0x53a5b8[_0x22e14e(0x161)],'diff':_0x53a5b8[_0x22e14e(0x21c)],'activationActions':_0x1dcb74});}return{'segmentFiles':_0x10a485,'foldersToCreate':_0xe8566a};}export async function prepareJourneyFiles(_0x65d119,_0x315c89,_0x287613,_0x197936){const _0x4d2c25=a142_0x5b9def,_0x1692d2=[],_0x1edd87=new Set();for(const {yamlConfig:_0x395f47,folderPath:_0x44cc5e,sourcePath:_0x2ca8e4}of _0x65d119){const _0x2fd61c=resolveTDFolderPath(_0x44cc5e,_0x287613,_0x197936),_0x2c65bf=_0x2fd61c+':'+_0x395f47[_0x4d2c25(0x13e)],_0x17ac1f=_0x315c89['journeyBundlesByFolderAndName'][_0x4d2c25(0x1b1)](_0x2c65bf);let _0x35c7c5,_0xdf7515;if(_0x17ac1f&&_0x17ac1f[_0x4d2c25(0x164)]>0x0){const _0x571047=buildLocalExpandedRuleMappings(_0x395f47),{createYamlContext:_0x31dea5,prefetchJourneySegments:_0xe318cf}=createPushYamlContextForBundle(_0x315c89[_0x4d2c25(0x160)],_0x315c89['parentId'],_0x315c89[_0x4d2c25(0x1ee)],_0x571047,_0x315c89[_0x4d2c25(0x141)],_0x315c89['connectionIdToNameMap'],_0x315c89[_0x4d2c25(0x1a7)],_0x315c89[_0x4d2c25(0x157)]);await _0xe318cf(_0x17ac1f['map'](_0x54b70e=>_0x54b70e['id']));const _0x2377ed=await _0x315c89[_0x4d2c25(0x160)]['journey'][_0x4d2c25(0x15d)](_0x17ac1f[0x0]['journeyBundleId']),_0x51b79a=hasMultipleVersions(_0x395f47),_0x38ad48=async _0x3f006b=>{const _0x38a26b=_0x4d2c25,_0x18ef7c=_0x315c89[_0x38a26b(0x157)]?.[_0x38a26b(0x1b1)](_0x3f006b);if(_0x18ef7c)return _0x18ef7c;return _0x315c89[_0x38a26b(0x136)]({'journeyId':_0x3f006b,'journeyName':_0x395f47['name'],'isMultiVersion':_0x17ac1f[_0x38a26b(0x164)]>0x1});};if(_0x51b79a&&_0x17ac1f[_0x4d2c25(0x164)]>0x1){const _0x415c0c=[];for(const _0xf10e02 of _0x17ac1f){const _0x3e6bac=_0xf10e02[_0x4d2c25(0x207)]||0x1;_0x315c89['progress']?.['update'](_0x4d2c25(0x1e1)+_0x395f47[_0x4d2c25(0x13e)]+'\x20v'+_0x3e6bac);const _0x75e628=await _0x38ad48(_0xf10e02['id']),_0x56b272=_0x31dea5(_0xf10e02['id']),_0x26fe83=await journeyResponseToDef(_0x75e628,_0x56b272);_0x415c0c[_0x4d2c25(0x188)]({'item':_0xf10e02,'yaml':_0x26fe83});}const _0x3e7f74=buildLocalRuleToNameMappingFromJourney(_0x395f47);_0xdf7515=buildMergedJourneyDef(_0x415c0c,_0x3e7f74,_0x2377ed);const _0x45add8=Math[_0x4d2c25(0x202)](..._0x415c0c[_0x4d2c25(0x17c)](_0x5aa5ca=>_0x5aa5ca[_0x4d2c25(0x18d)]['versionNumber']||0x0)),_0x3c8b98=_0x17ac1f[_0x4d2c25(0x1c5)](_0x33411b=>(_0x33411b[_0x4d2c25(0x207)]||0x0)===_0x45add8);_0x3c8b98&&(_0x315c89['progress']?.[_0x4d2c25(0x1c3)](_0x4d2c25(0x1e1)+_0x395f47['name']+'\x20v'+_0x45add8),_0x35c7c5=await _0x38ad48(_0x3c8b98['id']));}else{const _0x30caef=_0x17ac1f[_0x17ac1f[_0x4d2c25(0x164)]-0x1];_0x315c89['progress']?.[_0x4d2c25(0x1c3)](_0x4d2c25(0x1e1)+_0x395f47[_0x4d2c25(0x13e)]),_0x35c7c5=await _0x38ad48(_0x30caef['id']);const _0x5a970c=_0x31dea5(_0x30caef['id']),_0x1fcbcb=await journeyResponseToDef(_0x35c7c5,_0x5a970c),_0x383eb3=buildLocalRuleToNameMappingFromJourney(_0x395f47);_0xdf7515=buildMergedJourneyDef([{'item':_0x30caef,'yaml':_0x1fcbcb}],_0x383eb3,_0x2377ed);}}addFoldersToCreate(_0x2fd61c,_0x315c89[_0x4d2c25(0x1db)],_0x1edd87);const _0x26a831=calculateJourneyDiff(_0x395f47,_0xdf7515);_0x1692d2['push']({'relativePath':_0x395f47['name'],'absolutePath':_0x2ca8e4,'yamlConfig':_0x395f47,'folderPath':_0x2fd61c,'existingJourney':_0x35c7c5,'isNew':_0x26a831[_0x4d2c25(0x1af)],'hasChanges':_0x26a831[_0x4d2c25(0x161)],'diff':_0x26a831[_0x4d2c25(0x21c)]});}return{'journeyFiles':_0x1692d2,'foldersToCreate':_0x1edd87};}export function calculateActivationActions(_0x1f08d2,_0x12c859,_0x4a9b54,_0x9ec071){const _0x34ca93=a142_0x5b9def,_0x27b201=[],_0x49de1c=new Map();for(const _0xa68d91 of _0x12c859){_0x49de1c['set'](_0xa68d91[_0x34ca93(0x13e)],_0xa68d91);}const _0x437379=new Map();for(const _0x13c563 of _0x1f08d2){_0x437379['set'](_0x13c563[_0x34ca93(0x13e)],_0x13c563);}for(const _0x372e3f of _0x1f08d2){const _0x84158c=_0x49de1c[_0x34ca93(0x1b1)](_0x372e3f['name']);if(!_0x84158c)_0x27b201['push']({'type':_0x34ca93(0x1d1),'name':_0x372e3f[_0x34ca93(0x13e)],'yamlActivation':_0x372e3f});else{const _0xa86263=activationResponseToDef(_0x84158c,_0x4a9b54,_0x9ec071),_0x3825d5=a142_0x2bab56[_0x34ca93(0x1dd)](_0xa86263),_0x13f7d9=a142_0x2bab56['stringify'](_0x372e3f);_0x3825d5!==_0x13f7d9&&_0x27b201[_0x34ca93(0x188)]({'type':_0x34ca93(0x1c3),'name':_0x372e3f[_0x34ca93(0x13e)],'yamlActivation':_0x372e3f,'existingActivation':_0x84158c});}}for(const _0x3af0ee of _0x12c859){!_0x437379['has'](_0x3af0ee['name'])&&_0x27b201[_0x34ca93(0x188)]({'type':_0x34ca93(0x173),'name':_0x3af0ee[_0x34ca93(0x13e)],'existingActivation':_0x3af0ee});}return _0x27b201;}function calculateYamlDiff(_0x236765,_0x5a0d3d){if(_0x5a0d3d){const _0x1afd87=generateDiff(_0x5a0d3d,_0x236765),_0xc5d015=hasChanges(_0x1afd87);return{'isNew':![],'hasChanges':_0xc5d015,'diff':_0xc5d015?formatDiffWithColors(_0x1afd87):undefined};}const _0x27aeae=generateDiff('',_0x236765);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x27aeae)};}export function calculateSegmentDiff(_0x4d7bc8,_0x58053b,_0x16b6ff,_0x67574a,_0x2548aa){const _0x2ad68d=segmentToYamlString(_0x4d7bc8),_0x6c6041=_0x58053b?segmentToYamlString(segmentWithActivationsToYaml(_0x58053b,_0x16b6ff,undefined,_0x67574a,_0x2548aa)):undefined;return calculateYamlDiff(_0x2ad68d,_0x6c6041);}export function calculateJourneyDiff(_0x41c7c8,_0x2dba6a){const _0x246405=normalizeJourneyDef(_0x41c7c8,_0x41c7c8),_0x101253=a142_0x4333ae(_0x246405),_0x415cda=_0x2dba6a?a142_0x4333ae(normalizeJourneyDef(_0x2dba6a,_0x41c7c8)):undefined;return calculateYamlDiff(_0x101253,_0x415cda);}export function findSegmentsToDelete(_0x5c799c,_0x5a72fb,_0x5aab89,_0x51b98c,_0x4ae8d9){const _0x5ae967=a142_0x5b9def,_0x1949ae=new Set();for(const {yamlConfig:_0x1f2f61,folderPath:_0x48c3d8}of _0x5a72fb){_0x1949ae[_0x5ae967(0x128)](_0x48c3d8+':'+_0x1f2f61[_0x5ae967(0x13e)]);}return _0x5c799c[_0x5ae967(0x192)](_0x434755=>{const _0x308429=_0x5ae967,_0x2cc097=_0x434755['segmentFolderId']?_0x5aab89['get'](_0x434755[_0x308429(0x1d7)][_0x308429(0x1b0)]())||'':'',_0x598272=_0x2cc097+':'+_0x434755[_0x308429(0x13e)];if(_0x1949ae[_0x308429(0x1da)](_0x598272))return![];if(_0x4ae8d9)return _0x2cc097===_0x51b98c||_0x2cc097[_0x308429(0x1ff)](_0x51b98c+'/');return!![];});}export function findJourneysToDelete(_0x1da516,_0xae1b83,_0x2f0741,_0x4da8dd,_0x6bc7cc){const _0x3f899d=a142_0x5b9def,_0x180757=new Set();for(const {yamlConfig:_0x12ce42,folderPath:_0x1926d2}of _0xae1b83){_0x180757[_0x3f899d(0x128)](_0x1926d2+':'+_0x12ce42[_0x3f899d(0x13e)]);}return _0x1da516[_0x3f899d(0x192)](_0x4b7962=>{const _0x3111f2=_0x3f899d,_0x38a791=_0x4b7962[_0x3111f2(0x132)]?_0x2f0741['get'](_0x4b7962[_0x3111f2(0x132)])||'':'',_0x24d4df=_0x38a791+':'+_0x4b7962[_0x3111f2(0x1ab)];if(_0x180757[_0x3111f2(0x1da)](_0x24d4df))return![];if(_0x6bc7cc)return _0x38a791===_0x4da8dd||_0x38a791[_0x3111f2(0x1ff)](_0x4da8dd+'/');return!![];});}export function buildSegmentLookupMap(_0x45eaa1,_0x458082){const _0x59f084=a142_0x5b9def,_0x261bfe=new Map();for(const _0xb92f0c of _0x45eaa1){const _0x2c6753=_0xb92f0c[_0x59f084(0x1d7)]?_0x458082[_0x59f084(0x1b1)](_0xb92f0c['segmentFolderId']['toString']())||'':'',_0xa2622a=_0x2c6753+':'+_0xb92f0c[_0x59f084(0x13e)];_0x261bfe[_0x59f084(0x204)](_0xa2622a,_0xb92f0c);}return _0x261bfe;}export function buildSegmentNameToIdMap(_0x3882c3){const _0x343629=a142_0x5b9def,_0x580da6=new Map();for(const _0x2a9273 of _0x3882c3){_0x580da6[_0x343629(0x204)](_0x2a9273['name'],_0x2a9273['id']);}return _0x580da6;}export function buildJourneyBundleLookupMap(_0x1aa5c9,_0x20e6a0){const _0x5eb5b6=a142_0x5b9def,_0x23d9ea=new Map();for(const _0x361597 of _0x1aa5c9){const _0x42a0dc=_0x361597[_0x5eb5b6(0x132)]?_0x20e6a0[_0x5eb5b6(0x1b1)](_0x361597['folderId'])||'':'',_0x28d643=_0x42a0dc+':'+_0x361597[_0x5eb5b6(0x1ab)];!_0x23d9ea[_0x5eb5b6(0x1da)](_0x28d643)&&_0x23d9ea[_0x5eb5b6(0x204)](_0x28d643,[]),_0x23d9ea[_0x5eb5b6(0x1b1)](_0x28d643)[_0x5eb5b6(0x188)](_0x361597);}for(const _0x53abbc of _0x23d9ea[_0x5eb5b6(0x1d3)]()){_0x53abbc[_0x5eb5b6(0x1f8)]((_0xdc24c,_0x2979e3)=>(_0xdc24c[_0x5eb5b6(0x207)]||0x0)-(_0x2979e3[_0x5eb5b6(0x207)]||0x0));}return _0x23d9ea;}export function collectFoldersToCreate(_0x2e13cb,_0x1d7c24){const _0x121b64=a142_0x5b9def,_0xd5a9e1=new Set();for(const _0x5cb0ff of _0x2e13cb){if(!_0x5cb0ff)continue;if(_0x1d7c24['has'](_0x5cb0ff))continue;const _0x4578eb=_0x5cb0ff['split']('/');let _0x1374f0='';for(const _0xbcf442 of _0x4578eb){_0x1374f0=_0x1374f0?_0x1374f0+'/'+_0xbcf442:_0xbcf442,!_0x1d7c24[_0x121b64(0x1da)](_0x1374f0)&&_0xd5a9e1['add'](_0x1374f0);}}return _0xd5a9e1;}export function parseAndClassifyYamlFiles(_0x1e66b3,_0x62d109,_0x499880){const _0x50ddda=a142_0x5b9def,_0xbe5d2f=[],_0x2c7cc9=[];for(const _0x1e9bb9 of _0x1e66b3){const _0x5f5554=a142_0x30beb9[_0x50ddda(0x1f1)](_0x62d109,a142_0x30beb9[_0x50ddda(0x194)](_0x1e9bb9)),_0x1f2e24=_0x5f5554==='.'?'':_0x5f5554,_0x223582=readFileSync(_0x1e9bb9,_0x50ddda(0x19f)),_0x44d8e4=a142_0x2bab56[_0x50ddda(0x16f)](_0x223582);if(isJourneyDef(_0x44d8e4)){const _0x464146=a142_0x2abc5a(_0x223582);_0x2c7cc9['push']({'yamlConfig':_0x464146,'folderPath':_0x1f2e24,'sourcePath':_0x1e9bb9});}else{if(!_0x499880?.[_0x50ddda(0x1cd)]){const _0x4ccfa1=parseSegmentYamlFile(_0x223582),_0x460bd3=normalizeChildSegmentYaml(_0x4ccfa1);_0xbe5d2f[_0x50ddda(0x188)]({'yamlConfig':_0x460bd3,'folderPath':_0x1f2e24,'sourcePath':_0x1e9bb9});}}}return{'segments':_0xbe5d2f,'journeys':_0x2c7cc9};}export function validateParsedFiles(_0x303777,_0x3540d1){const _0x552525=a142_0x5b9def,_0x301380=[];for(const {yamlConfig:_0x5beddc,sourcePath:_0x1e330a}of _0x303777['segments']){const _0xd46d60=readFileSync(_0x1e330a,_0x552525(0x19f)),_0x4e78f9=a142_0x2bab56[_0x552525(0x17f)](_0xd46d60),_0x42aed3=validateSegmentDef(_0x5beddc,{'source':_0xd46d60,'document':_0x4e78f9},{'skipSchema':!![]});if(!_0x42aed3['valid']){const _0x44fbd4=a142_0x30beb9[_0x552525(0x1f1)](_0x3540d1,_0x1e330a);_0x301380['push']({'filePath':_0x44fbd4,'source':_0xd46d60,'result':_0x42aed3,'isJourney':![]});}}for(const {yamlConfig:_0x2323d8,sourcePath:_0x2148cf}of _0x303777[_0x552525(0x212)]){const _0x50776f=readFileSync(_0x2148cf,'utf-8'),_0x5ab2a1=a142_0x2bab56['parseDocument'](_0x50776f),_0x57a597=validateJourneyDef(_0x2323d8,{'source':_0x50776f,'document':_0x5ab2a1},{'skipSchema':!![]});if(!_0x57a597[_0x552525(0x1bf)]){const _0x3aee5a=a142_0x30beb9['relative'](_0x3540d1,_0x2148cf);_0x301380[_0x552525(0x188)]({'filePath':_0x3aee5a,'source':_0x50776f,'result':_0x57a597,'isJourney':!![]});}}return _0x301380;}export function formatValidationErrors(_0x382087){const _0x18896f=a142_0x5b9def,_0x3afa5a=[];for(const {filePath:_0x34ef0a,source:_0x3c023e,result:_0x2a6347,isJourney:_0x375476}of _0x382087){const _0x3983f5=_0x375476?_0x18896f(0x169):_0x18896f(0x162);_0x3afa5a[_0x18896f(0x188)]('\x0a'+_0x34ef0a+'\x20('+_0x3983f5+_0x18896f(0x211)+_0x2a6347[_0x18896f(0x171)][_0x18896f(0x164)]+'\x20error(s)'),_0x3afa5a['push'](formatValidationResult(_0x2a6347,_0x3c023e,_0x34ef0a));}return _0x3afa5a['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x21dc94){const _0x38658f=a142_0x5b9def,_0x69a2a7=new Set(),_0x1e5601=new Map(),_0x4b3956=collectSegmentUsageCounts(_0x21dc94);if(_0x21dc94[_0x38658f(0x15b)])for(const [_0x154936,_0x2912b0]of Object[_0x38658f(0x181)](_0x21dc94['segments'])){_0x69a2a7[_0x38658f(0x128)](_0x154936);if(_0x2912b0[_0x38658f(0x14c)]){const _0x5bcb2d=yamlRuleToApi(_0x2912b0[_0x38658f(0x14c)]),_0x6f17d8=apiRuleToYaml(_0x5bcb2d);_0x1e5601['set'](_0x154936,_0x6f17d8);}}const _0x2d8329=new Map();let _0x434541=0x0;for(const [_0x1f17e8,_0x38d99e]of _0x1e5601){const _0x357758=serializeExpandedRule(_0x38d99e,_0x1e5601),_0x3118ba=_0x2d8329[_0x38658f(0x1b1)](_0x357758)||[];_0x3118ba['push']({'name':_0x1f17e8,'index':_0x434541}),_0x2d8329[_0x38658f(0x204)](_0x357758,_0x3118ba),_0x434541++;}const _0x595cfe=new Map();for(const [_0x29e290,_0x387ca5]of _0x2d8329){const _0x20f580=_0x387ca5[_0x38658f(0x12e)]()[_0x38658f(0x1f8)]((_0x70acba,_0xd2598)=>{const _0x1581a2=_0x38658f,_0x3dc273=_0x4b3956[_0x1581a2(0x1b1)](_0x70acba[_0x1581a2(0x13e)])||0x0,_0x1747ca=_0x4b3956[_0x1581a2(0x1b1)](_0xd2598[_0x1581a2(0x13e)])||0x0;if(_0x3dc273!==_0x1747ca)return _0x1747ca-_0x3dc273;return _0x70acba[_0x1581a2(0x163)]-_0xd2598[_0x1581a2(0x163)];})[_0x38658f(0x17c)](_0x15404e=>_0x15404e['name']),_0x1d0c04=[];for(const _0x220a54 of _0x20f580){const _0x4a935c=_0x4b3956['get'](_0x220a54)||0x0,_0x2c6351=Math[_0x38658f(0x202)](_0x4a935c,0x1);for(let _0x48e2d3=0x0;_0x48e2d3<_0x2c6351;_0x48e2d3++){_0x1d0c04['push'](_0x220a54);}}_0x595cfe[_0x38658f(0x204)](_0x29e290,_0x1d0c04);}return{'existingLocalSegmentNames':_0x69a2a7,'localSegmentRules':_0x1e5601,'localExpandedRuleToNames':_0x595cfe};}function a142_0x3d03(){const _0x200918=['213UZpzkY','activationContext','valid',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','activationParams','day','update','some','find','\x27\x20decision\x20point\x20branch\x20\x27','debug','journey_creating','\x27\x20from\x20file:\x20','branches','\x27\x20milestone','getSegmentEntity','skipSegments','\x27\x20not\x20found\x20in\x20journey\x20\x27','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','239176BAuBFJ','create','INTERNAL','values','replace','activations','deleteSegment','segmentFolderId','Condition','connectionIdToNameMap','has','folderPathToId','notification','stringify','\x27\x20entry\x20criteria','updateSegmentById','entryCriteria','Fetching\x20','match','join','localName','getSegmentEntity\x20also\x20failed\x20for\x20','activation_template_id','goal\x20criteria','flatMap','20583MCeSyJ','Activation','withProgress','folder_created','Created\x20activation\x20\x27','existingSegments','run_after_journey_refresh','results','relative','JOURNEY_UPDATE_ERROR','2020jHfAQS','createFolder','exitCriterias','getActivation','journey_updating','sort','connector_config','created','Created\x20journey\x20\x27','reduce','\x27\x20for\x20','logDeleted','startsWith','deleted','uniqueServerName','max','kind','set','keys','\x20(referenced\x20in\x20journey\x20','versionNumber','split','2656nWcfkw','activation_deleted','segment_deleted','SEGMENT_SYNTAX_ERROR','Segment\x20not\x20found','JOURNEY_SYNTAX_ERROR','updated','\x20segment\x20from\x20file:\x20','):\x20','journeys','./journey-yaml.js','Updated\x20segment\x20\x27','waitStepType','createSegment','toLowerCase','WaitStep','yamlConfig','2118508NMszVS','sha1','diff','journeyStages','segmentNameToId','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','__pending_','verbose','parentSegmentFolder','Duration','behavior','draft','logInfo','data','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','add','resolveSegment','journeyActivationNameToId','trim','yamlActivation','and\x20the\x20server\x20segment,\x20then\x20retry.','slice','3246aoUiLY','uniqueSegmentName','Entry\x20criteria:\x20','folderId','embedded_activation_creating','steps','createActivation','fetchJourney','schedule','createdSegmentId','journey_created','segment_creating','Failed\x20to\x20','connection','parentId','name','__pending_act_','Creating\x20segment\x20\x27','idToEmailMap','digest','\x0a\x20\x20','folder','activation_','embeddedSegmentNameToId','conditionTimeoutUnit','onProgress','activation_created','embedded_segment_created','segment_deleting','rule','getSegment','NOT_FOUND','stages','getJourney','milestone','size','\x27\x20exit\x20criteria','resolveJourneyId','logSuccess','absolutePath','journeyById','conditionSegmentId','ACTIVATION_UPDATE_ERROR','conditionTimeoutDuration','segments','existingActivation','getLatestJourneyId','Updating\x20segment\x20\x27','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','deps','hasChanges','segment','index','length','Created\x20segment\x20\x27','conditions','rootFolderId','waitStepUnit','journey','tdx.sdk.push-workflow','includes','Matched\x20server\x20segment\x20\x27','embedded_activation_created','SEGMENT_UPDATE_ERROR','parse','Creating\x20folder\x20\x27','errors','list','delete','all_columns','activationActions','with','toISOString','Creating\x20activation\x20\x27','state','Updated\x20journey\x20\x27','type','map','Deleted\x20activation\x20\x27','action','parseDocument','object','entries','\x27\x20to\x20local\x20\x27','journeyName','listActivations','ACTIVATION_SYNTAX_ERROR',').\x20','\x27\x20by\x20rule\x20content','push','embedded_segment_creating','attributes','../../utils/async.js','1055Jasgpy','item','161764yGaBQF','message','description','segmentId','filter','journey_updated','dirname','.$1.push-recovery.json','createJourneySegment','Created\x20folder\x20\x27','waitStep','from','Embedded\x20segment\x20\x27','existingJourney','\x27...','idToName','updateActivation','utf-8','Segment\x20not\x20found:\x20','columns','Updated\x20activation\x20\x27','validatedRequest','nameToId','relationships','stage\x20\x27','activationStepsById','\x27\x20wait\x20condition','DecisionPoint','activation_deleting','journeyBundleName','goal','existingSegment','2052576LFudxg','isNew','toString','get','deleteActivation','journeyActivationStepId','entry_criteria','Stage\x20\x27','createdSegmentIds','journeyId','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','unchanged','Deleted\x20segment\x20\x27','folderPath','resolvedRule'];a142_0x3d03=function(){return _0x200918;};return a142_0x3d03();}export function createSegmentIdResolver(_0x58dff9,_0x17ddf3){return async _0x478668=>{const _0x4b5458=a142_0x361a,_0x267f0c=_0x58dff9[_0x4b5458(0x1b1)](_0x478668);if(!_0x267f0c)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20not\x20found:\x20'+_0x478668+_0x4b5458(0x21f)+_0x17ddf3+'\x27)');return _0x267f0c;};}export function extractRootFolderId(_0x34e8ca){const _0x5f34c9=a142_0x5b9def;return _0x34e8ca['relationships']?.[_0x5f34c9(0x222)]?.[_0x5f34c9(0x126)]?.['id']||_0x34e8ca[_0x5f34c9(0x1a5)]?.['parentFolder']?.[_0x5f34c9(0x126)]?.['id'];}export function buildConnectionMaps(_0x3c21b5){const _0x30513f=a142_0x5b9def,_0x3baa62=new Map(),_0x4770a7=new Map(),_0x3c08d0=new Map();for(const _0x8a28b3 of _0x3c21b5){_0x3baa62[_0x30513f(0x204)](_0x8a28b3[_0x30513f(0x13e)],parseInt(_0x8a28b3['id'],0xa)),_0x4770a7['set'](_0x8a28b3['id'],_0x8a28b3[_0x30513f(0x13e)]),_0x3c08d0[_0x30513f(0x204)](_0x8a28b3['name'],_0x8a28b3[_0x30513f(0x17b)]);}return{'nameToId':_0x3baa62,'idToName':_0x4770a7,'nameToType':_0x3c08d0};}export function calculatePushStats(_0xe93db,_0xb38064,_0x1b2d5b,_0x3146d5,_0x2da9b2,_0x24be96,_0x52b4b3){const _0x598222=a142_0x5b9def,_0x1a97a8=_0xe93db[_0x598222(0x192)](_0x132ba0=>_0x132ba0['isNew']),_0x1bdd93=_0xe93db[_0x598222(0x192)](_0x3dcac8=>!_0x3dcac8[_0x598222(0x1af)]&&_0x3dcac8[_0x598222(0x161)]),_0x4ff01d=_0xe93db[_0x598222(0x192)](_0x5d39d8=>!_0x5d39d8[_0x598222(0x1af)]&&!_0x5d39d8[_0x598222(0x161)]),_0x44fc87=_0x24be96?_0x3146d5:[],_0x428971=_0xb38064[_0x598222(0x192)](_0x8d6c12=>_0x8d6c12[_0x598222(0x1af)]),_0x3b5db0=_0xb38064[_0x598222(0x192)](_0x5e539b=>!_0x5e539b[_0x598222(0x1af)]&&_0x5e539b['hasChanges']),_0x32d691=_0xb38064['filter'](_0x105875=>!_0x105875[_0x598222(0x1af)]&&!_0x105875[_0x598222(0x161)]),_0x3a821c=_0x24be96?_0x2da9b2:[],_0x56e3be=_0xe93db[_0x598222(0x1e8)](_0x5abff6=>_0x5abff6[_0x598222(0x175)]),_0x24e705=_0x56e3be[_0x598222(0x192)](_0x2a4955=>_0x2a4955[_0x598222(0x17b)]==='create'),_0x103696=_0x56e3be[_0x598222(0x192)](_0x183580=>_0x183580[_0x598222(0x17b)]==='update'),_0x1e6ac8=_0x56e3be[_0x598222(0x192)](_0x16f664=>_0x16f664[_0x598222(0x17b)]===_0x598222(0x173)),_0x22d502=Array[_0x598222(0x199)](_0x1b2d5b)[_0x598222(0x1f8)](),_0x37367a=_0x52b4b3?![]:_0x1a97a8[_0x598222(0x164)]>0x0||_0x1bdd93[_0x598222(0x164)]>0x0||_0x44fc87[_0x598222(0x164)]>0x0,_0x65404e=_0x428971[_0x598222(0x164)]>0x0||_0x3b5db0[_0x598222(0x164)]>0x0||_0x3a821c['length']>0x0,_0x2f6f2c=_0x52b4b3?![]:_0x56e3be[_0x598222(0x164)]>0x0,_0x2d2286=_0x22d502['length']>0x0;return{'segments':{'new':_0x1a97a8,'changed':_0x1bdd93,'unchanged':_0x4ff01d,'toDelete':_0x44fc87},'journeys':{'new':_0x428971,'changed':_0x3b5db0,'unchanged':_0x32d691,'toDelete':_0x3a821c},'activations':{'all':_0x56e3be,'toCreate':_0x24e705,'toUpdate':_0x103696,'toDelete':_0x1e6ac8},'folders':{'toCreate':_0x22d502},'counts':{'segments':{'new':_0x1a97a8[_0x598222(0x164)],'changed':_0x1bdd93[_0x598222(0x164)],'unchanged':_0x4ff01d[_0x598222(0x164)],'toDelete':_0x44fc87[_0x598222(0x164)]},'journeys':{'new':_0x428971[_0x598222(0x164)],'changed':_0x3b5db0[_0x598222(0x164)],'unchanged':_0x32d691['length'],'toDelete':_0x3a821c[_0x598222(0x164)]},'activations':{'create':_0x24e705['length'],'update':_0x103696['length'],'delete':_0x1e6ac8['length']},'folders':_0x22d502[_0x598222(0x164)]},'hasChanges':_0x37367a||_0x65404e||_0x2f6f2c||_0x2d2286};}export async function buildPushExecutionContext(_0x17735f,_0x4fcf2a,_0x2d192c,_0x3a2946,_0x9349ef,_0x388ab2){const _0x87b22d=a142_0x5b9def,_0x50bdb9=extractRootFolderId(_0x2d192c),{pathToId:_0x24e3a3,idToPath:_0x24d90b}=buildFolderMaps(_0x9349ef),_0x5157de=buildSegmentNameToIdMap(_0x3a2946),_0x26ef8b=new Map(),{batchAsync:_0x47e665}=await import(_0x87b22d(0x18b)),[_0x2b6c79,_0x3d5a0b]=await Promise['all']([_0x17735f['user']['buildUserMaps'](),_0x17735f['connection'][_0x87b22d(0x172)](),((async()=>{const _0x386b6c=_0x87b22d;!_0x388ab2&&_0x3a2946[_0x386b6c(0x164)]>0x0&&await _0x47e665(_0x3a2946,async _0x4941e4=>{const _0x250a96=_0x386b6c,_0x67dd8f=await _0x17735f[_0x250a96(0x162)][_0x250a96(0x184)](_0x4fcf2a,_0x4941e4['id']);_0x26ef8b[_0x250a96(0x204)](_0x4941e4['id'],_0x67dd8f);});})())]),{emailToId:_0x16df21,idToEmail:_0x22659c}=_0x2b6c79,_0x54b829=buildConnectionMaps(_0x3d5a0b);return{'rootFolderId':_0x50bdb9,'folderPathToId':_0x24e3a3,'folderIdToPath':_0x24d90b,'segmentNameToId':_0x5157de,'activationsBySegmentId':_0x26ef8b,'emailToIdMap':_0x16df21,'idToEmailMap':_0x22659c,'connectionNameToIdMap':_0x54b829[_0x87b22d(0x1a4)],'connectionIdToNameMap':_0x54b829[_0x87b22d(0x19d)],'connectionNameToTypeMap':_0x54b829['nameToType']};}export function createPushYamlContextForBundle(_0xa7bf1,_0x2cd9ec,_0x230b87,_0x397bbf,_0x414c15,_0x5648ba,_0x509c10,_0x20e76c){const {existingLocalSegmentNames:_0x4a1a65,localExpandedRuleToNames:_0xf4c73a}=_0x397bbf,_0xa290e1=new Set(),_0x2a8e47=new Map(),_0x4ab824=new Map(),_0x258af5=new Map(),_0x9fb272=createJumpTargetCache(),_0x1fc254=new Map(),_0x4f1289=new Map(),_0x36a6bc=new Set();let _0xc18c34;const _0x2a1a55=_0x4081ac=>{const _0x29b8aa={'resolveSegment':async _0x599cf9=>{const _0x481030=a142_0x361a,_0x14bec7=_0x258af5['get'](_0x599cf9);if(_0x14bec7!==undefined)return{'name':_0x14bec7,'isJourneyLocal':!![]};try{const _0x162c61=await fetchSegment(_0xa7bf1,_0x2cd9ec,_0x599cf9,_0x230b87);if(!_0x162c61)throw new Error(_0x481030(0x20d));const _0x53a872=generateJourneyLocalName(_0x162c61[_0x481030(0x13e)]),_0x1c5d81=_0x162c61[_0x481030(0x203)]===SEGMENT_KIND_JOURNEY&&_0x53a872!==undefined;let _0x5e0a73=_0x162c61['name'],_0x4b7a91;if(_0x1c5d81&&_0x162c61['rule']){const _0x1f74da=apiRuleToYaml(_0x162c61[_0x481030(0x14c)]);_0x4f1289[_0x481030(0x204)](_0x599cf9,_0x1f74da);const _0x58187f=async _0x25f0db=>{const _0x3de00d=_0x481030,_0x72c375=collectSegmentRefsFromRule(_0x25f0db);for(const _0x319ba0 of _0x72c375){if(!_0x4f1289['has'](_0x319ba0))try{const _0x49d485=await fetchSegment(_0xa7bf1,_0x2cd9ec,_0x319ba0,_0x230b87);if(_0x49d485?.[_0x3de00d(0x14c)]){const _0x538d7e=apiRuleToYaml(_0x49d485['rule']);_0x4f1289[_0x3de00d(0x204)](_0x319ba0,_0x538d7e),await _0x58187f(_0x538d7e);}}catch(_0xacd245){logger['debug']('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0x319ba0+':\x20'+_0xacd245);}}};await _0x58187f(_0x1f74da);const _0x297e8b=serializeExpandedRule(_0x1f74da,_0x4f1289),_0x45ff5b=_0xf4c73a[_0x481030(0x1b1)](_0x297e8b);if(_0x45ff5b&&_0x45ff5b[_0x481030(0x164)]>0x0){const _0x21edd2=_0x2a8e47[_0x481030(0x1b1)](_0x297e8b)||0x0,_0x502978=_0x45ff5b[_0x21edd2]||_0x45ff5b[_0x45ff5b[_0x481030(0x164)]-0x1];_0x2a8e47[_0x481030(0x204)](_0x297e8b,_0x21edd2+0x1),_0x5e0a73=_0x502978,_0xa290e1[_0x481030(0x128)](_0x5e0a73),_0x258af5['set'](_0x599cf9,_0x5e0a73);const _0x57c73b=await resolveRuleSegmentRefs(_0x1f74da,async _0xfad175=>{const _0x46368c=_0x481030,_0x2cc824=_0x258af5[_0x46368c(0x1b1)](_0xfad175);if(_0x2cc824)return _0x2cc824;const _0x50feba=await _0xc18c34[_0x46368c(0x129)](_0xfad175);return _0x50feba[_0x46368c(0x13e)];});_0x4b7a91={'description':_0x162c61[_0x481030(0x190)],'rule':_0x57c73b};}else{const _0x5eb0e7=_0x1fc254[_0x481030(0x1b1)](_0x297e8b);if(_0x5eb0e7)_0x5e0a73=_0x5eb0e7,_0x258af5[_0x481030(0x204)](_0x599cf9,_0x5e0a73);else{if(_0x53a872){let _0x499af1=_0x53a872,_0x43fdac=0x2;while(_0xa290e1[_0x481030(0x1da)](_0x499af1)||_0x4a1a65[_0x481030(0x1da)](_0x499af1)){_0x499af1=_0x53a872+'_'+_0x43fdac,_0x43fdac++;}_0xa290e1[_0x481030(0x128)](_0x499af1),_0x5e0a73=_0x499af1;}_0x258af5[_0x481030(0x204)](_0x599cf9,_0x5e0a73),_0x1fc254[_0x481030(0x204)](_0x297e8b,_0x5e0a73);const _0x32bed2=await resolveRuleSegmentRefs(_0x1f74da,async _0x471d65=>{const _0x476c58=_0x481030,_0x262201=_0x258af5[_0x476c58(0x1b1)](_0x471d65);if(_0x262201)return _0x262201;const _0x1124e4=await _0xc18c34[_0x476c58(0x129)](_0x471d65);return _0x1124e4['name'];});_0x4b7a91={'description':_0x162c61[_0x481030(0x190)],'rule':_0x32bed2};}}}return{'name':_0x5e0a73,'isJourneyLocal':_0x1c5d81,'definition':_0x4b7a91};}catch(_0x314732){return logger[_0x481030(0x1c7)]('Failed\x20to\x20resolve\x20segment\x20'+_0x599cf9+':\x20'+_0x314732),{'name':_0x599cf9,'isJourneyLocal':![]};}},'resolveActivation':async _0x32f078=>{const _0x358bae=a142_0x361a,_0x1f4181=_0x4ab824[_0x358bae(0x1b1)](_0x32f078);if(_0x1f4181!==undefined)return{'name':_0x1f4181,'isJourneyLocal':!![]};try{let _0x4f15b3=_0x509c10?.[_0x358bae(0x1b1)](_0x32f078);!_0x4f15b3&&(_0x4f15b3=await _0xa7bf1[_0x358bae(0x169)][_0x358bae(0x1f6)](_0x4081ac,_0x32f078));const _0x4d5886=_0x4f15b3[_0x358bae(0x18a)][_0x358bae(0x1c1)][_0x358bae(0x13e)]||_0x32f078,_0x55a139=sanitizeYamlKey(_0x4d5886)||_0x358bae(0x145)+_0x32f078,_0x1976a3=_0x55a139;_0x4ab824[_0x358bae(0x204)](_0x32f078,_0x1976a3);const _0x125385=journeyActivationStepToYaml(_0x4f15b3,_0x414c15,_0x5648ba);return{'name':_0x1976a3,'isJourneyLocal':!![],'definition':_0x125385};}catch(_0x37d7f6){return logger['debug']('Failed\x20to\x20resolve\x20activation\x20'+_0x32f078+':\x20'+_0x37d7f6),{'name':_0x32f078,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x20e54c,_0x17369b)=>resolveJumpTarget(_0x20e54c,_0x17369b,_0x9fb272,async _0x26d12c=>{const _0x3b65c3=a142_0x361a,_0x1fee34=_0x20e76c?.[_0x3b65c3(0x1b1)](_0x26d12c);if(_0x1fee34)return _0x1fee34;return _0xa7bf1[_0x3b65c3(0x169)][_0x3b65c3(0x150)](_0x26d12c);})};return _0xc18c34=_0x29b8aa,_0x29b8aa;},_0x3e8e13=async _0x2f1c4c=>{const _0x1836e7=a142_0x361a,{collectSegmentIdsFromJourneyApi:_0x5744a6}=await import(_0x1836e7(0x213)),{batchAsync:_0x4f4aef}=await import(_0x1836e7(0x18b)),_0x256c51=new Set();for(const _0x400ad5 of _0x2f1c4c){let _0x4bafe2=_0x20e76c?.[_0x1836e7(0x1b1)](_0x400ad5);!_0x4bafe2&&(_0x4bafe2=await _0xa7bf1[_0x1836e7(0x169)][_0x1836e7(0x150)](_0x400ad5));const _0x508e90=_0x5744a6(_0x4bafe2);for(const _0x476035 of _0x508e90){_0x256c51[_0x1836e7(0x128)](_0x476035);}}let _0x1ee74f=Array[_0x1836e7(0x199)](_0x256c51);while(_0x1ee74f['length']>0x0){const _0x2f83b2=_0x1ee74f[_0x1836e7(0x192)](_0x39b3a5=>!_0x36a6bc[_0x1836e7(0x1da)](_0x39b3a5));if(_0x2f83b2[_0x1836e7(0x164)]===0x0)break;const _0x372698=await _0x4f4aef(_0x2f83b2,async _0x4973ed=>{const _0x4653df=_0x1836e7;_0x36a6bc[_0x4653df(0x128)](_0x4973ed);const _0x11aa5b=await fetchSegment(_0xa7bf1,_0x2cd9ec,_0x4973ed,_0x230b87);if(!_0x11aa5b)return null;return{'segmentId':_0x4973ed,'segment':_0x11aa5b};},0xa),_0x2018cf=new Set();for(const _0x5b05c0 of _0x372698){if(!_0x5b05c0?.[_0x1836e7(0x162)]?.[_0x1836e7(0x14c)])continue;const _0x8cc859=apiRuleToYaml(_0x5b05c0[_0x1836e7(0x162)][_0x1836e7(0x14c)]);_0x4f1289['set'](_0x5b05c0[_0x1836e7(0x191)],_0x8cc859);const _0x3acac9=collectSegmentRefsFromRule(_0x8cc859);for(const _0x4dad1a of _0x3acac9){!_0x36a6bc[_0x1836e7(0x1da)](_0x4dad1a)&&_0x2018cf[_0x1836e7(0x128)](_0x4dad1a);}}_0x1ee74f=Array[_0x1836e7(0x199)](_0x2018cf);}};return{'createYamlContext':_0x2a1a55,'prefetchJourneySegments':_0x3e8e13};}export async function executePushSegments(_0x2db69b,_0x40115f,_0x2aa1d1,_0x559fff,_0x589abb){const _0x2fc3b1=a142_0x5b9def,{segmentDefToCreateRequest:_0x2b342d,segmentDefToUpdateRequest:_0x45929b}=await import('./child-segment-yaml.js'),_0x2469b7=_0x2aa1d1[_0x2fc3b1(0x1db)],_0x46411f=0x5,_0x234530=async _0x19e058=>{const _0x564c78=_0x2fc3b1,_0xc03415=_0x19e058[_0x564c78(0x1bb)]?_0x2469b7[_0x564c78(0x1b1)](_0x19e058[_0x564c78(0x1bb)]):undefined;let _0x49f1af;const _0x565587={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x99d17b=_0x19e058[_0x564c78(0x219)];if(_0x19e058[_0x564c78(0x219)][_0x564c78(0x14c)]){const _0x3d170c=createSegmentIdResolver(_0x2aa1d1[_0x564c78(0x21e)],_0x19e058[_0x564c78(0x219)][_0x564c78(0x13e)]),_0x4c628d=await resolveRuleSegmentIds(_0x19e058['yamlConfig'][_0x564c78(0x14c)],_0x3d170c);_0x99d17b={..._0x19e058[_0x564c78(0x219)],'rule':_0x4c628d};}try{if(_0x19e058[_0x564c78(0x1af)]){_0x589abb[_0x564c78(0x148)]?.({'type':_0x564c78(0x13a),'name':_0x19e058['yamlConfig']['name']});const _0x29a80e=_0x2b342d(_0x99d17b,_0xc03415),_0x33ece8=await _0x589abb[_0x564c78(0x1eb)](_0x564c78(0x140)+_0x19e058[_0x564c78(0x219)][_0x564c78(0x13e)]+'\x27...',()=>_0x2db69b['segment'][_0x564c78(0x216)](_0x559fff['parentId'],_0x29a80e));_0x49f1af=_0x33ece8['data']['id'],_0x2aa1d1[_0x564c78(0x21e)][_0x564c78(0x204)](_0x19e058[_0x564c78(0x219)][_0x564c78(0x13e)],_0x49f1af),_0x565587[_0x564c78(0x138)]={'name':_0x19e058['yamlConfig'][_0x564c78(0x13e)],'id':_0x49f1af},_0x589abb[_0x564c78(0x148)]?.({'type':'segment_created','name':_0x19e058['yamlConfig'][_0x564c78(0x13e)],'segmentId':_0x49f1af}),_0x589abb[_0x564c78(0x155)]?.(_0x564c78(0x165)+_0x19e058[_0x564c78(0x219)][_0x564c78(0x13e)]+'\x27'),_0x565587[_0x564c78(0x1fa)]=0x1;}else{if(_0x19e058['hasChanges']){_0x589abb[_0x564c78(0x148)]?.({'type':'segment_updating','name':_0x19e058[_0x564c78(0x219)][_0x564c78(0x13e)]});const _0x22ed54=_0x45929b(_0x99d17b);_0xc03415!==_0x19e058[_0x564c78(0x1ad)]?.[_0x564c78(0x1d7)]&&(_0x22ed54['segmentFolderId']=_0xc03415?parseInt(_0xc03415,0xa):undefined),await _0x589abb[_0x564c78(0x1eb)](_0x564c78(0x15e)+_0x19e058[_0x564c78(0x219)][_0x564c78(0x13e)]+_0x564c78(0x19c),()=>_0x2db69b['segment'][_0x564c78(0x1df)](_0x559fff[_0x564c78(0x13d)],_0x19e058[_0x564c78(0x1ad)]['id'],_0x22ed54)),_0x49f1af=_0x19e058[_0x564c78(0x1ad)]['id'],_0x589abb['onProgress']?.({'type':'segment_updated','name':_0x19e058[_0x564c78(0x219)][_0x564c78(0x13e)]}),_0x589abb['logSuccess']?.(_0x564c78(0x214)+_0x19e058['yamlConfig']['name']+'\x27'),_0x565587[_0x564c78(0x20f)]=0x1;}else _0x49f1af=_0x19e058[_0x564c78(0x1ad)]['id'];}}catch(_0x4efde8){const _0x45d614=isHttp400Error(_0x4efde8),_0x1e0b2d=_0x45d614?ErrorCode[_0x564c78(0x20c)]:ErrorCode[_0x564c78(0x16e)],_0x513398=getErrorMessage(_0x4efde8);throw new SDKError(_0x1e0b2d,'Failed\x20to\x20'+(_0x19e058[_0x564c78(0x1af)]?_0x564c78(0x1d1):_0x564c78(0x1c3))+_0x564c78(0x210)+_0x19e058[_0x564c78(0x156)]+_0x564c78(0x143)+_0x513398,_0x4efde8);}try{const _0x1bd399=await syncActivationsForSegment(_0x2db69b,_0x559fff[_0x564c78(0x13d)],_0x49f1af,_0x19e058[_0x564c78(0x219)][_0x564c78(0x13e)],_0x19e058[_0x564c78(0x175)],_0x589abb,_0x19e058['absolutePath']);_0x565587[_0x564c78(0x1d5)]=_0x1bd399;}catch(_0x448ade){if(_0x448ade instanceof SDKError)throw _0x448ade;throw new SDKError(ErrorCode[_0x564c78(0x159)],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x19e058['yamlConfig']['name']+_0x564c78(0x1c9)+_0x19e058[_0x564c78(0x156)]+_0x564c78(0x143)+getErrorMessage(_0x448ade),_0x448ade);}return _0x565587;},_0x44771e=await batchAsync(_0x40115f,_0x234530,_0x46411f),_0x2f2bd7={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x457462 of _0x44771e){_0x2f2bd7[_0x2fc3b1(0x1fa)]+=_0x457462[_0x2fc3b1(0x1fa)],_0x2f2bd7[_0x2fc3b1(0x20f)]+=_0x457462['updated'],_0x457462[_0x2fc3b1(0x138)]&&_0x2f2bd7[_0x2fc3b1(0x1b6)][_0x2fc3b1(0x204)](_0x457462[_0x2fc3b1(0x138)][_0x2fc3b1(0x13e)],_0x457462[_0x2fc3b1(0x138)]['id']),_0x2f2bd7[_0x2fc3b1(0x1d5)]['created']+=_0x457462[_0x2fc3b1(0x1d5)]['created'],_0x2f2bd7['activations'][_0x2fc3b1(0x20f)]+=_0x457462[_0x2fc3b1(0x1d5)]['updated'],_0x2f2bd7['activations'][_0x2fc3b1(0x200)]+=_0x457462['activations'][_0x2fc3b1(0x200)];}return _0x2f2bd7;}async function syncActivationsForSegment(_0x180cca,_0x15643a,_0x4b8441,_0x497751,_0x1401b8,_0x5391e8,_0x13395a){const _0x272d6f=a142_0x5b9def,_0x541fcb={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x28e38b of _0x1401b8){try{if(_0x28e38b['type']===_0x272d6f(0x1d1)&&_0x28e38b[_0x272d6f(0x1a3)])_0x5391e8[_0x272d6f(0x148)]?.({'type':'activation_creating','segmentName':_0x497751,'activationName':_0x28e38b[_0x272d6f(0x13e)]}),await _0x5391e8[_0x272d6f(0x1eb)](_0x272d6f(0x178)+_0x28e38b[_0x272d6f(0x13e)]+_0x272d6f(0x19c),()=>_0x180cca[_0x272d6f(0x162)][_0x272d6f(0x135)](_0x15643a,_0x4b8441,_0x28e38b[_0x272d6f(0x1a3)])),_0x5391e8['onProgress']?.({'type':_0x272d6f(0x149),'segmentName':_0x497751,'activationName':_0x28e38b[_0x272d6f(0x13e)]}),_0x5391e8[_0x272d6f(0x155)]?.(_0x272d6f(0x1ed)+_0x28e38b[_0x272d6f(0x13e)]+'\x27'),_0x541fcb['created']++;else{if(_0x28e38b[_0x272d6f(0x17b)]==='update'&&_0x28e38b[_0x272d6f(0x1a3)]&&_0x28e38b[_0x272d6f(0x15c)])_0x5391e8['onProgress']?.({'type':'activation_updating','segmentName':_0x497751,'activationName':_0x28e38b[_0x272d6f(0x13e)]}),await _0x5391e8['withProgress']('Updating\x20activation\x20\x27'+_0x28e38b[_0x272d6f(0x13e)]+_0x272d6f(0x19c),()=>_0x180cca['segment'][_0x272d6f(0x19e)](_0x15643a,_0x4b8441,_0x28e38b[_0x272d6f(0x15c)]['id'],_0x28e38b[_0x272d6f(0x1a3)])),_0x5391e8['onProgress']?.({'type':'activation_updated','segmentName':_0x497751,'activationName':_0x28e38b['name']}),_0x5391e8[_0x272d6f(0x155)]?.(_0x272d6f(0x1a2)+_0x28e38b[_0x272d6f(0x13e)]+'\x27'),_0x541fcb[_0x272d6f(0x20f)]++;else _0x28e38b['type']===_0x272d6f(0x173)&&_0x28e38b[_0x272d6f(0x15c)]&&(_0x5391e8[_0x272d6f(0x148)]?.({'type':_0x272d6f(0x1aa),'segmentName':_0x497751,'activationName':_0x28e38b[_0x272d6f(0x13e)]}),await _0x5391e8[_0x272d6f(0x1eb)]('Deleting\x20activation\x20\x27'+_0x28e38b['name']+_0x272d6f(0x19c),()=>_0x180cca[_0x272d6f(0x162)][_0x272d6f(0x1b2)](_0x15643a,_0x4b8441,_0x28e38b[_0x272d6f(0x15c)]['id'])),_0x5391e8['onProgress']?.({'type':_0x272d6f(0x20a),'segmentName':_0x497751,'activationName':_0x28e38b[_0x272d6f(0x13e)]}),_0x5391e8[_0x272d6f(0x1fe)]?.(_0x272d6f(0x17d)+_0x28e38b[_0x272d6f(0x13e)]+'\x27'),_0x541fcb[_0x272d6f(0x200)]++);}}catch(_0x34c63c){const _0x3804b4=isHttp400Error(_0x34c63c),_0x3f18d9=_0x3804b4?ErrorCode[_0x272d6f(0x185)]:ErrorCode[_0x272d6f(0x159)],_0x2c87ab=getErrorMessage(_0x34c63c);throw new SDKError(_0x3f18d9,'Failed\x20to\x20'+_0x28e38b['type']+'\x20activation\x20\x27'+_0x28e38b[_0x272d6f(0x13e)]+'\x27\x20from\x20file:\x20'+_0x13395a+_0x272d6f(0x143)+_0x2c87ab,_0x34c63c);}}return _0x541fcb;}export async function executePushFolders(_0x1a8917,_0x39202f,_0x6efc97,_0xaea03a,_0x213591){const _0x1910d8=a142_0x5b9def,_0x26d6bf=new Map(_0x6efc97),_0xbcf289=sortFoldersByDepth(_0x39202f);for(const _0x3225ba of _0xbcf289){const _0x109f61=_0x3225ba['split']('/'),_0xd0c45a=_0x109f61[_0x109f61[_0x1910d8(0x164)]-0x1],_0x59f2f7=_0x109f61[_0x1910d8(0x12e)](0x0,-0x1)[_0x1910d8(0x1e3)]('/'),_0x201eb9=_0x26d6bf['get'](_0x59f2f7);_0x213591[_0x1910d8(0x148)]?.({'type':'folder_creating','folder':_0x3225ba});const _0x21b5d8={'name':_0xd0c45a,'parentFolderId':_0x201eb9},_0x31bb8c=await _0x213591[_0x1910d8(0x1eb)](_0x1910d8(0x170)+_0x3225ba+_0x1910d8(0x19c),()=>_0x1a8917['segment'][_0x1910d8(0x1f4)](_0xaea03a['parentId'],_0x21b5d8));_0x26d6bf[_0x1910d8(0x204)](_0x3225ba,_0x31bb8c[_0x1910d8(0x126)]['id']),_0x213591[_0x1910d8(0x148)]?.({'type':_0x1910d8(0x1ec),'folder':_0x3225ba,'folderId':_0x31bb8c[_0x1910d8(0x126)]['id']}),_0x213591[_0x1910d8(0x125)]?.(_0x1910d8(0x197)+_0x3225ba+'\x27');}return _0x26d6bf;}export async function executePushSegmentDeletions(_0x3ac322,_0x563782,_0x5191a7){const _0x4c988f=a142_0x5b9def;if(_0x563782[_0x4c988f(0x164)]===0x0)return 0x0;const {batchAsync:_0x643a1b}=await import(_0x4c988f(0x18b)),_0x215d35=0x5,_0x4352d1=await _0x643a1b(_0x563782,async _0x4aa51f=>{const _0x32fef7=_0x4c988f;return _0x5191a7[_0x32fef7(0x148)]?.({'type':_0x32fef7(0x14b),'name':_0x4aa51f[_0x32fef7(0x13e)]}),await _0x3ac322['segment'][_0x32fef7(0x1d6)](_0x4aa51f['id']),_0x5191a7[_0x32fef7(0x148)]?.({'type':_0x32fef7(0x20b),'name':_0x4aa51f[_0x32fef7(0x13e)]}),_0x5191a7[_0x32fef7(0x1fe)]?.(_0x32fef7(0x1ba)+_0x4aa51f[_0x32fef7(0x13e)]+'\x27'),0x1;},_0x215d35);return _0x4352d1[_0x4c988f(0x1fc)]((_0x1653bd,_0x363db2)=>_0x1653bd+_0x363db2,0x0);}export async function executePushJourneys(_0x419963,_0x2e5393,_0x59aed5,_0x37d098,_0x4db60a){const _0x4063f4=a142_0x5b9def,{journeyDefToRequest:_0x2c7430}=await import(_0x4063f4(0x213)),{activationDefToCreateRequest:_0x1957a6,yamlRuleToApi:_0x39e886,validateSegmentRule:_0x2ad619}=await import('./child-segment-yaml.js'),_0x528f15={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x43c515=new Map(_0x59aed5[_0x4063f4(0x21e)]),_0x3f6c64=0x5;for(let _0x569a1c=0x0;_0x569a1c<_0x2e5393[_0x4063f4(0x164)];_0x569a1c+=_0x3f6c64){const _0x37f8d9=_0x2e5393[_0x4063f4(0x12e)](_0x569a1c,_0x569a1c+_0x3f6c64),_0x54125d=await Promise['all'](_0x37f8d9[_0x4063f4(0x17c)](async _0x51af5a=>{const _0x3202f0=_0x4063f4;if(!_0x51af5a['isNew']&&!_0x51af5a['hasChanges'])return{'action':'unchanged','name':_0x51af5a[_0x3202f0(0x219)]['name'],'journeyId':_0x51af5a[_0x3202f0(0x19b)]?.['id']};const _0x3ea679=_0x51af5a[_0x3202f0(0x1bb)]?_0x59aed5[_0x3202f0(0x1db)][_0x3202f0(0x1b1)](_0x51af5a[_0x3202f0(0x1bb)]):undefined;_0x4db60a[_0x3202f0(0x148)]?.({'type':_0x51af5a['isNew']?_0x3202f0(0x1c8):_0x3202f0(0x1f7),'name':_0x51af5a[_0x3202f0(0x219)][_0x3202f0(0x13e)]});try{const _0x5b7ab9=await executeSingleJourneyPush(_0x419963,_0x51af5a,{..._0x59aed5,'segmentNameToId':_0x43c515},{'parentId':_0x37d098['parentId'],'rootFolderId':_0x37d098[_0x3202f0(0x167)],'folderId':_0x3ea679,'verbose':_0x37d098[_0x3202f0(0x221)]},_0x4db60a,{'journeyDefToRequest':_0x2c7430,'activationDefToCreateRequest':_0x1957a6,'yamlRuleToApi':_0x39e886,'validateSegmentRule':_0x2ad619});for(const [_0x4ac0c6,_0x3e5b11]of _0x5b7ab9[_0x3202f0(0x146)]){_0x43c515[_0x3202f0(0x204)](_0x4ac0c6,_0x3e5b11),_0x528f15[_0x3202f0(0x146)]['set'](_0x4ac0c6,_0x3e5b11);}if(_0x5b7ab9[_0x3202f0(0x17e)]===_0x3202f0(0x1fa))_0x4db60a['onProgress']?.({'type':_0x3202f0(0x139),'name':_0x51af5a[_0x3202f0(0x219)][_0x3202f0(0x13e)],'journeyId':_0x5b7ab9[_0x3202f0(0x1b7)]}),_0x4db60a[_0x3202f0(0x155)]?.(_0x3202f0(0x1fb)+_0x51af5a[_0x3202f0(0x219)][_0x3202f0(0x13e)]+'\x27'),_0x528f15[_0x3202f0(0x1fa)]++;else _0x5b7ab9[_0x3202f0(0x17e)]===_0x3202f0(0x20f)&&(_0x4db60a[_0x3202f0(0x148)]?.({'type':_0x3202f0(0x193),'name':_0x51af5a[_0x3202f0(0x219)]['name']}),_0x4db60a['logSuccess']?.(_0x3202f0(0x17a)+_0x51af5a[_0x3202f0(0x219)]['name']+'\x27'),_0x528f15['updated']++);return{'action':_0x5b7ab9[_0x3202f0(0x17e)],'name':_0x51af5a['yamlConfig']['name'],'journeyId':_0x5b7ab9[_0x3202f0(0x1b7)]};}catch(_0x59a13d){const _0x294fe3=isHttp400Error(_0x59a13d),_0x65085d=_0x294fe3?ErrorCode[_0x3202f0(0x20e)]:ErrorCode[_0x3202f0(0x1f2)],_0x12898b=getErrorMessage(_0x59a13d);throw new SDKError(_0x65085d,_0x3202f0(0x13b)+(_0x51af5a['isNew']?_0x3202f0(0x1d1):_0x3202f0(0x1c3))+'\x20journey\x20from\x20file:\x20'+_0x51af5a[_0x3202f0(0x156)]+_0x3202f0(0x143)+_0x12898b,_0x59a13d);}}));_0x528f15[_0x4063f4(0x1f0)][_0x4063f4(0x188)](..._0x54125d);}return _0x528f15;}async function matchExistingJourneySegments(_0x187695,_0x42ad9d,_0x5264d0,_0x272e67,_0x6f0ef5){const _0x218112=a142_0x5b9def;if(!_0x42ad9d['existingJourney']||!_0x42ad9d[_0x218112(0x219)]['segments'])return;const _0x428f03=new Map(),_0x2ada2f=new Set();for(const _0x481345 of Object[_0x218112(0x205)](_0x42ad9d[_0x218112(0x219)][_0x218112(0x15b)])){const _0x174349=generateDeterministicJourneySegmentName(_0x42ad9d[_0x218112(0x219)]['name'],_0x481345);_0x428f03[_0x218112(0x204)](_0x174349,_0x481345),_0x2ada2f[_0x218112(0x128)](_0x481345);}const _0x5874f3=[],_0x46139e=collectSegmentIdsFromJourneyApi(_0x42ad9d[_0x218112(0x19b)]);for(const _0x320f22 of _0x46139e){const _0x1693b5=await fetchSegment(_0x187695,_0x5264d0,_0x320f22,_0x272e67);if(!_0x1693b5?.[_0x218112(0x13e)])continue;const _0x526211=_0x428f03[_0x218112(0x1b1)](_0x1693b5[_0x218112(0x13e)]);_0x526211?(_0x6f0ef5[_0x218112(0x204)](_0x526211,_0x320f22),_0x2ada2f['delete'](_0x526211)):_0x5874f3[_0x218112(0x188)]({'id':_0x320f22,'seg':_0x1693b5});}if(_0x2ada2f[_0x218112(0x152)]>0x0&&_0x5874f3[_0x218112(0x164)]>0x0){const {localExpandedRuleToNames:_0x2b3e2d}=buildLocalExpandedRuleMappings(_0x42ad9d[_0x218112(0x219)]),_0x247a44=new Map();for(const {id:_0x5a91ca,seg:_0x45b543}of _0x5874f3){if(_0x45b543[_0x218112(0x14c)]){const _0x3b2937=apiRuleToYaml(_0x45b543[_0x218112(0x14c)]);_0x247a44['set'](_0x5a91ca,_0x3b2937);}}for(const {id:_0x48f4f2,seg:_0x5e697f}of _0x5874f3){if(!_0x5e697f[_0x218112(0x14c)])continue;const _0x1de032=_0x247a44[_0x218112(0x1b1)](_0x48f4f2);if(!_0x1de032)continue;const _0x1a52f5=serializeExpandedRule(_0x1de032,_0x247a44),_0x2bc24c=_0x2b3e2d[_0x218112(0x1b1)](_0x1a52f5);if(_0x2bc24c){const _0x4fee32=_0x2bc24c[_0x218112(0x1c5)](_0x102a62=>_0x2ada2f['has'](_0x102a62));_0x4fee32&&(_0x6f0ef5[_0x218112(0x204)](_0x4fee32,_0x48f4f2),_0x2ada2f[_0x218112(0x173)](_0x4fee32),logger[_0x218112(0x1c7)](_0x218112(0x16c)+_0x5e697f[_0x218112(0x13e)]+_0x218112(0x182)+_0x4fee32+_0x218112(0x187)));}}}}async function executeSingleJourneyPush(_0x2395a0,_0x197416,_0x122c1d,_0x2edff7,_0x223588,_0x4c4a77){const _0x10b21c=a142_0x5b9def,{journeyDefToRequest:_0x2ec786,activationDefToCreateRequest:_0x396506,yamlRuleToApi:_0x21943c,validateSegmentRule:_0x38225c}=_0x4c4a77,_0x5b0685=new Map(),_0x13bbc8=new Map();recoverSegmentIdsFromPushRecovery(_0x197416,_0x5b0685,_0x122c1d[_0x10b21c(0x21e)]);const _0x44756b=new Map(),_0x4e1579=new Map(),_0x166001=new Map();let _0x1fa7f5;const _0x1e2806=async()=>{const _0xaa1403=_0x10b21c;if(_0x1fa7f5)return;_0x1fa7f5=new Map();if(!_0x197416[_0xaa1403(0x19b)])return;const _0x3bebbc=await _0x2395a0[_0xaa1403(0x169)][_0xaa1403(0x184)](_0x197416[_0xaa1403(0x19b)]['id']);for(const _0x2c902a of _0x3bebbc){const _0x7cc1f6=journeyActivationStepToYaml(_0x2c902a,_0x122c1d[_0xaa1403(0x141)],_0x122c1d['connectionIdToNameMap']),_0x2c4b1a=activationSignature(_0x7cc1f6);!_0x1fa7f5[_0xaa1403(0x1da)](_0x2c4b1a)&&_0x1fa7f5[_0xaa1403(0x204)](_0x2c4b1a,_0x2c902a['id']),_0x7cc1f6[_0xaa1403(0x13e)]&&_0x13bbc8['set'](_0x7cc1f6[_0xaa1403(0x13e)],_0x2c902a['id']);}};await matchExistingJourneySegments(_0x2395a0,_0x197416,_0x2edff7[_0x10b21c(0x13d)],_0x122c1d[_0x10b21c(0x1ee)],_0x122c1d[_0x10b21c(0x21e)]);const _0x2cc9ae={'resolveSegmentId':async _0x417922=>{const _0x5b8a97=_0x10b21c,_0x121936=_0x122c1d['segmentNameToId'][_0x5b8a97(0x1b1)](_0x417922);if(!_0x121936)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5b8a97(0x1a0)+_0x417922+'\x20(referenced\x20in\x20journey\x20'+_0x197416[_0x5b8a97(0x219)][_0x5b8a97(0x13e)]+')');return _0x121936;},'resolveEmbeddedSegmentId':async(_0x10f796,_0x1525cc)=>{const _0x1cbd3d=_0x10b21c,_0x1b4377=_0x122c1d[_0x1cbd3d(0x21e)][_0x1cbd3d(0x1b1)](_0x10f796);if(_0x1b4377)return _0x1b4377;const _0x26cb47=_0x122c1d[_0x1cbd3d(0x1ee)][_0x1cbd3d(0x1c5)](_0x2826bf=>_0x2826bf[_0x1cbd3d(0x13e)]===_0x10f796);if(_0x26cb47)return _0x122c1d[_0x1cbd3d(0x21e)]['set'](_0x10f796,_0x26cb47['id']),_0x26cb47['id'];if(_0x197416[_0x1cbd3d(0x1af)]){const {stageName:_0x467ed5,criteriaName:_0x30fd7f}=findSegmentCriteriaLocation(_0x197416[_0x1cbd3d(0x219)],_0x10f796);return _0x38225c(_0x10f796,_0x1525cc[_0x1cbd3d(0x14c)]),_0x4e1579['set'](_0x10f796,{'definition':_0x1525cc,'stageName':_0x467ed5,'criteriaName':_0x30fd7f}),createPendingSegmentId(_0x10f796);}const _0x239608=_0x197416[_0x1cbd3d(0x19b)]?.['id'];if(!_0x239608)throw new SDKError(ErrorCode[_0x1cbd3d(0x1d2)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x5bd33e=_0x44756b[_0x1cbd3d(0x1b1)](_0x10f796);if(_0x5bd33e)return _0x5bd33e;const _0x1ba79c=((async()=>{const _0x522c5b=_0x1cbd3d;_0x38225c(_0x10f796,_0x1525cc[_0x522c5b(0x14c)]);const _0x305d47=generateDeterministicJourneySegmentName(_0x197416['yamlConfig'][_0x522c5b(0x13e)],_0x10f796),_0x4c19d6=_0x122c1d[_0x522c5b(0x1ee)][_0x522c5b(0x1c5)](_0x4a0188=>_0x4a0188[_0x522c5b(0x13e)]===_0x305d47),_0x1b35c6=createSegmentIdResolver(_0x122c1d[_0x522c5b(0x21e)],_0x10f796),_0x290bdc=await resolveRuleSegmentIds(_0x1525cc[_0x522c5b(0x14c)],_0x1b35c6);let _0x2a00d4;return _0x4c19d6?(await _0x2395a0['segment'][_0x522c5b(0x1df)](_0x2edff7[_0x522c5b(0x13d)],_0x4c19d6['id'],{'description':_0x1525cc[_0x522c5b(0x190)]||_0x522c5b(0x131)+_0x10f796,'rule':_0x21943c(_0x290bdc,!![]),'countPopulation':!![]}),_0x2a00d4=_0x4c19d6['id'],saveSegmentToPushRecovery(_0x197416[_0x522c5b(0x156)],_0x197416[_0x522c5b(0x219)][_0x522c5b(0x13e)],_0x10f796,{'segmentId':_0x2a00d4,'uniqueServerName':_0x305d47,'createdAt':new Date()[_0x522c5b(0x177)]()})):_0x2a00d4=await createOrRecoverEmbeddedSegment(_0x2395a0,_0x197416,{'localName':_0x10f796,'uniqueSegmentName':_0x305d47,'description':_0x1525cc[_0x522c5b(0x190)]||_0x522c5b(0x131)+_0x10f796,'journeyId':_0x239608,'resolvedRule':_0x290bdc,'parentId':_0x2edff7['parentId'],'folderId':_0x2edff7[_0x522c5b(0x167)]||''},_0x21943c),_0x122c1d[_0x522c5b(0x21e)]['set'](_0x10f796,_0x2a00d4),_0x5b0685[_0x522c5b(0x204)](_0x10f796,_0x2a00d4),_0x2a00d4;})());_0x44756b['set'](_0x10f796,_0x1ba79c);try{return await _0x1ba79c;}finally{_0x44756b['delete'](_0x10f796);}},'resolveActivationId':async _0x1ffe38=>{const _0xa9b4e7=_0x10b21c,_0x215c43=_0x13bbc8[_0xa9b4e7(0x1b1)](_0x1ffe38);if(_0x215c43)return _0x215c43;if(_0x197416['existingJourney']){await _0x1e2806();const _0x17cc35=_0x13bbc8[_0xa9b4e7(0x1b1)](_0x1ffe38);if(_0x17cc35)return _0x17cc35;}throw new SDKError(ErrorCode[_0xa9b4e7(0x14e)],'Activation\x20not\x20found:\x20'+_0x1ffe38+_0xa9b4e7(0x206)+_0x197416[_0xa9b4e7(0x219)][_0xa9b4e7(0x13e)]+_0xa9b4e7(0x186)+_0xa9b4e7(0x1b8));},'resolveEmbeddedActivationId':async(_0x25e30f,_0x3f2b02)=>{const _0x7d805a=_0x10b21c,_0x52940d=_0x13bbc8['get'](_0x25e30f);if(_0x52940d)return _0x52940d;if(_0x197416[_0x7d805a(0x1af)])return _0x166001[_0x7d805a(0x204)](_0x25e30f,_0x3f2b02),createPendingActivationId(_0x25e30f);if(_0x197416['existingJourney']){await _0x1e2806();const _0x45cbe3=_0x13bbc8[_0x7d805a(0x1b1)](_0x3f2b02['name']);if(_0x45cbe3)return _0x13bbc8['set'](_0x25e30f,_0x45cbe3),_0x45cbe3;const _0x23580e=activationSignature(_0x3f2b02),_0x24384c=_0x1fa7f5?.[_0x7d805a(0x1b1)](_0x23580e);if(_0x24384c)return _0x13bbc8['set'](_0x25e30f,_0x24384c),_0x24384c;const _0x54f7cc=await _0x396506(_0x3f2b02,_0x122c1d['activationContext']),_0x5cf1bf={..._0x54f7cc,..._0x3f2b02[_0x7d805a(0x1ef)]!==undefined&&{'runAfterJourneyRefresh':_0x3f2b02[_0x7d805a(0x1ef)]}},_0xc6a545=await _0x2395a0[_0x7d805a(0x169)][_0x7d805a(0x135)](_0x197416[_0x7d805a(0x19b)]['id'],_0x5cf1bf);return _0x13bbc8[_0x7d805a(0x204)](_0x25e30f,_0xc6a545['id']),_0xc6a545['id'];}throw new SDKError(ErrorCode[_0x7d805a(0x1d2)],_0x7d805a(0x127));},'resolveJourneyId':async _0xb1ecd1=>{const _0x3bf19a=_0x10b21c;try{return await _0x2395a0['journey'][_0x3bf19a(0x154)](_0x2edff7['parentId'],_0xb1ecd1);}catch(_0x1ae32c){throw new SDKError(ErrorCode[_0x3bf19a(0x14e)],'Journey\x20\x27'+_0xb1ecd1+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x197416[_0x3bf19a(0x219)][_0x3bf19a(0x13e)]+'\x27)',_0x1ae32c);}},'resolveStageId':async(_0x3a3777,_0xbbf602)=>{const _0x227cec=_0x10b21c,_0xd3b5b0=await _0x2395a0['journey']['getJourney'](_0x3a3777),_0x7fe8f8=_0xd3b5b0[_0x227cec(0x18a)]['journeyStages'][_0x227cec(0x1c5)](_0x3e5ab0=>_0x3e5ab0[_0x227cec(0x13e)][_0x227cec(0x217)]()===_0xbbf602[_0x227cec(0x217)]());if(!_0x7fe8f8?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],_0x227cec(0x1b5)+_0xbbf602+_0x227cec(0x1ce)+(_0xd3b5b0['attributes']['journeyBundleName']||_0xd3b5b0[_0x227cec(0x18a)][_0x227cec(0x13e)])+'\x27');return _0x7fe8f8['id'];}},_0x2d60b5=await _0x2ec786(_0x197416[_0x10b21c(0x219)],_0x2edff7['parentId'],_0x2cc9ae),_0x2b7064=_0x2edff7[_0x10b21c(0x132)]||_0x2edff7['rootFolderId'];_0x2b7064&&(_0x2d60b5['relationships']={'parentFolder':{'data':{'id':_0x2b7064,'type':_0x10b21c(0x144)}}});if(_0x197416['isNew']){if(_0x4e1579['size']>0x0||_0x166001['size']>0x0)return await executeThreeStepJourneyCreate(_0x2395a0,_0x197416,_0x2d60b5,{'pendingEmbeddedSegments':_0x4e1579,'pendingEmbeddedActivations':_0x166001,'embeddedSegmentNameToId':_0x5b0685,'journeyActivationNameToId':_0x13bbc8},{..._0x2edff7,'effectiveFolderId':_0x2b7064},_0x122c1d,_0x223588,_0x4c4a77);else{ensureJourneyDefaults(_0x2d60b5[_0x10b21c(0x18a)]);const _0x2ccf71=await _0x2395a0['journey']['create'](_0x2d60b5);return deletePushRecovery(_0x197416['absolutePath']),{'action':'created','journeyId':_0x2ccf71['id'],'embeddedSegmentNameToId':_0x5b0685};}}else{if(_0x197416[_0x10b21c(0x161)]&&_0x197416[_0x10b21c(0x19b)]){_0x2d60b5['id']=_0x197416[_0x10b21c(0x19b)]['id'];const _0x4693b0=_0x2d60b5[_0x10b21c(0x18a)];_0x197416['existingJourney'][_0x10b21c(0x18a)]?.[_0x10b21c(0x1ab)]&&(_0x4693b0[_0x10b21c(0x1ab)]=_0x197416[_0x10b21c(0x19b)][_0x10b21c(0x18a)][_0x10b21c(0x1ab)]);const _0x203c97=_0x197416['existingJourney'][_0x10b21c(0x18a)]?.['journeyStages'];return _0x203c97&&_0x2d60b5[_0x10b21c(0x18a)][_0x10b21c(0x21d)]&&injectExistingStageIds(_0x2d60b5[_0x10b21c(0x18a)][_0x10b21c(0x21d)],_0x203c97),ensureJourneyDefaults(_0x4693b0),await _0x2395a0[_0x10b21c(0x169)][_0x10b21c(0x1c3)](_0x197416[_0x10b21c(0x19b)]['id'],_0x2d60b5),deletePushRecovery(_0x197416[_0x10b21c(0x156)]),{'action':_0x10b21c(0x20f),'journeyId':_0x197416['existingJourney']['id'],'embeddedSegmentNameToId':_0x5b0685};}}return deletePushRecovery(_0x197416[_0x10b21c(0x156)]),{'action':_0x10b21c(0x1b9),'journeyId':_0x197416['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x5b0685};}function findSegmentCriteriaLocation(_0x331046,_0x4b4a27){const _0x5821db=a142_0x5b9def,_0x6df35a=_0x331046[_0x5821db(0x14f)]||_0x331046[_0x5821db(0x212)]?.[0x0]?.[_0x5821db(0x14f)]||[];let _0x4596bd='entry',_0xa189e0=_0x4b4a27;const _0x2a2108=_0x331046[_0x5821db(0x1ac)]||_0x331046[_0x5821db(0x212)]?.[0x0]?.[_0x5821db(0x1ac)];if(_0x2a2108?.[_0x5821db(0x162)]===_0x4b4a27)return{'stageName':_0x5821db(0x1ac),'criteriaName':_0x2a2108[_0x5821db(0x13e)]||_0x4b4a27};_0x55cc6c:for(const _0x18bdcd of _0x6df35a){if(_0x18bdcd[_0x5821db(0x1b4)]?.[_0x5821db(0x162)]===_0x4b4a27){_0x4596bd=_0x18bdcd[_0x5821db(0x13e)],_0xa189e0=_0x18bdcd[_0x5821db(0x1b4)][_0x5821db(0x13e)]||_0x4b4a27;break;}if(_0x18bdcd[_0x5821db(0x134)])for(const _0x5e0703 of _0x18bdcd[_0x5821db(0x134)]){if(_0x5e0703['type']==='decision_point'&&_0x5e0703['with']?.['branches'])for(const _0x32276d of _0x5e0703[_0x5821db(0x176)][_0x5821db(0x1ca)]){if(_0x32276d['segment']===_0x4b4a27){_0x4596bd=_0x18bdcd[_0x5821db(0x13e)],_0xa189e0=_0x32276d[_0x5821db(0x13e)]||_0x4b4a27;break _0x55cc6c;}}}}return{'stageName':_0x4596bd,'criteriaName':_0xa189e0};}async function executeThreeStepJourneyCreate(_0x4f4cdb,_0x5c6863,_0x36999a,_0x353ed4,_0x1bc477,_0x2edfcd,_0x2f6630,_0x2b847e){const _0x380613=a142_0x5b9def,{activationDefToCreateRequest:_0x33925e,yamlRuleToApi:_0x5cf754}=_0x2b847e,{pendingEmbeddedSegments:_0x54fe25,pendingEmbeddedActivations:_0x67c8cf,embeddedSegmentNameToId:_0x52aa92}=_0x353ed4,_0x166a0e=JSON[_0x380613(0x16f)](JSON[_0x380613(0x1dd)](_0x36999a));ensureJourneyDefaults(_0x166a0e[_0x380613(0x18a)]),stripPendingIds(_0x166a0e);const _0x41aa9a=await _0x4f4cdb[_0x380613(0x169)][_0x380613(0x1d1)](_0x166a0e),_0x3c00d2=_0x41aa9a['id'],_0x1dd5f9=new Map();for(const _0x5d30c8 of _0x41aa9a[_0x380613(0x18a)][_0x380613(0x21d)]){_0x1dd5f9[_0x380613(0x204)](_0x5d30c8[_0x380613(0x13e)][_0x380613(0x217)](),_0x5d30c8['id']);}recoverSegmentIdsFromPushRecovery(_0x5c6863,_0x52aa92,_0x2edfcd[_0x380613(0x21e)]);for(const [_0x47125a,{definition:_0x4a4929}]of _0x54fe25){if(_0x52aa92[_0x380613(0x1da)](_0x47125a)){_0x2f6630[_0x380613(0x148)]?.({'type':_0x380613(0x14a),'journeyName':_0x5c6863[_0x380613(0x219)]['name'],'segmentName':_0x47125a});continue;}const _0x41d147=generateDeterministicJourneySegmentName(_0x5c6863[_0x380613(0x219)][_0x380613(0x13e)],_0x47125a);_0x2f6630['onProgress']?.({'type':_0x380613(0x189),'journeyName':_0x5c6863[_0x380613(0x219)][_0x380613(0x13e)],'segmentName':_0x47125a});const _0xc95687=createSegmentIdResolver(_0x2edfcd[_0x380613(0x21e)],_0x47125a),_0x2af6d1=await resolveRuleSegmentIds(_0x4a4929[_0x380613(0x14c)],_0xc95687),_0x5f4f4c=await createOrRecoverEmbeddedSegment(_0x4f4cdb,_0x5c6863,{'localName':_0x47125a,'uniqueSegmentName':_0x41d147,'description':_0x4a4929['description']||_0x380613(0x131)+_0x47125a,'journeyId':_0x3c00d2,'resolvedRule':_0x2af6d1,'parentId':_0x1bc477[_0x380613(0x13d)],'folderId':_0x1bc477['effectiveFolderId']||''},_0x5cf754);_0x52aa92[_0x380613(0x204)](_0x47125a,_0x5f4f4c),_0x2edfcd[_0x380613(0x21e)][_0x380613(0x204)](_0x47125a,_0x5f4f4c),_0x2f6630[_0x380613(0x148)]?.({'type':_0x380613(0x14a),'journeyName':_0x5c6863[_0x380613(0x219)][_0x380613(0x13e)],'segmentName':_0x47125a});}const _0x2b1eda=new Map();for(const [_0x36f324,_0x51ea75]of _0x67c8cf){_0x2f6630['onProgress']?.({'type':_0x380613(0x133),'journeyName':_0x5c6863['yamlConfig']['name'],'activationName':_0x36f324});const _0x18f507=await _0x33925e(_0x51ea75,_0x2edfcd[_0x380613(0x1be)]),_0x1e7539={..._0x18f507,..._0x51ea75[_0x380613(0x1ef)]!==undefined&&{'runAfterJourneyRefresh':_0x51ea75[_0x380613(0x1ef)]}},_0x4a2a1b=await _0x4f4cdb[_0x380613(0x169)][_0x380613(0x135)](_0x3c00d2,_0x1e7539);_0x2b1eda['set'](_0x36f324,_0x4a2a1b['id']),_0x353ed4[_0x380613(0x12a)][_0x380613(0x204)](_0x36f324,_0x4a2a1b['id']),_0x2f6630[_0x380613(0x148)]?.({'type':_0x380613(0x16d),'journeyName':_0x5c6863['yamlConfig'][_0x380613(0x13e)],'activationName':_0x36f324});}const _0x13079d=JSON[_0x380613(0x16f)](JSON[_0x380613(0x1dd)](_0x36999a));return _0x13079d['id']=_0x3c00d2,ensureJourneyDefaults(_0x13079d[_0x380613(0x18a)]),resolvePendingIdsInRequest(_0x13079d,_0x36999a,_0x1dd5f9,_0x52aa92,_0x2b1eda,_0x2f6630),await _0x4f4cdb[_0x380613(0x169)][_0x380613(0x1c3)](_0x3c00d2,_0x13079d),deletePushRecovery(_0x5c6863[_0x380613(0x156)]),{'action':_0x380613(0x1fa),'journeyId':_0x3c00d2,'embeddedSegmentNameToId':_0x52aa92};}export function stripWaitStepPendingIds(_0x18257c){const _0x20ecd5=a142_0x5b9def,_0x3f8914=_0x18257c[_0x20ecd5(0x158)]&&isPendingSegmentId(_0x18257c[_0x20ecd5(0x158)]),_0x540926=_0x18257c[_0x20ecd5(0x166)]?.['some'](_0x26f063=>_0x26f063[_0x20ecd5(0x191)]&&isPendingSegmentId(_0x26f063[_0x20ecd5(0x191)]));(_0x3f8914||_0x540926)&&(_0x18257c[_0x20ecd5(0x215)]=_0x20ecd5(0x223),_0x18257c[_0x20ecd5(0x198)]=0x1,_0x18257c[_0x20ecd5(0x168)]=_0x20ecd5(0x1c2),delete _0x18257c[_0x20ecd5(0x158)],delete _0x18257c[_0x20ecd5(0x15a)],delete _0x18257c['conditionTimeoutUnit'],delete _0x18257c['conditions']);}export function resolveWaitStepPendingIds(_0x111bbd,_0x56c280,_0x3019e6,_0x5df7da){const _0x17615e=a142_0x5b9def;if(_0x56c280[_0x17615e(0x158)]&&isPendingSegmentId(_0x56c280[_0x17615e(0x158)])){const _0x3a51e0=_0x3019e6(_0x56c280[_0x17615e(0x158)],'stage\x20\x27'+_0x5df7da+_0x17615e(0x1a8));_0x3a51e0&&(_0x111bbd[_0x17615e(0x215)]=_0x17615e(0x1d8),_0x111bbd[_0x17615e(0x158)]=_0x3a51e0,delete _0x111bbd[_0x17615e(0x198)],delete _0x111bbd[_0x17615e(0x168)],_0x56c280[_0x17615e(0x15a)]!==undefined&&(_0x111bbd[_0x17615e(0x15a)]=_0x56c280[_0x17615e(0x15a)]),_0x56c280[_0x17615e(0x147)]&&(_0x111bbd['conditionTimeoutUnit']=_0x56c280[_0x17615e(0x147)]));}if(_0x56c280[_0x17615e(0x166)]){const _0x18b282=_0x56c280[_0x17615e(0x166)][_0x17615e(0x1c4)](_0x23ce37=>_0x23ce37[_0x17615e(0x191)]&&isPendingSegmentId(_0x23ce37[_0x17615e(0x191)]));if(_0x18b282){const _0x5af847=_0x56c280[_0x17615e(0x166)][_0x17615e(0x17c)](_0x3c2039=>{const _0x486e39=_0x17615e;if(_0x3c2039[_0x486e39(0x191)]&&isPendingSegmentId(_0x3c2039[_0x486e39(0x191)])){const _0x1179a2=_0x3019e6(_0x3c2039['segmentId'],'stage\x20\x27'+_0x5df7da+_0x486e39(0x1a8));return{..._0x3c2039,'segmentId':_0x1179a2||_0x3c2039[_0x486e39(0x191)]};}return{..._0x3c2039};});_0x111bbd[_0x17615e(0x215)]=_0x17615e(0x1d8),_0x111bbd[_0x17615e(0x166)]=_0x5af847,delete _0x111bbd[_0x17615e(0x198)],delete _0x111bbd[_0x17615e(0x168)],delete _0x111bbd[_0x17615e(0x158)],delete _0x111bbd[_0x17615e(0x15a)],delete _0x111bbd[_0x17615e(0x147)];}}}function stripPendingIds(_0x45f013){const _0x38c017=a142_0x5b9def;_0x45f013[_0x38c017(0x18a)][_0x38c017(0x1ac)]?.[_0x38c017(0x191)]&&isPendingSegmentId(_0x45f013[_0x38c017(0x18a)][_0x38c017(0x1ac)]['segmentId'])&&delete _0x45f013[_0x38c017(0x18a)]['goal'];for(const _0x75fd7f of _0x45f013['attributes'][_0x38c017(0x21d)]||[]){_0x75fd7f[_0x38c017(0x1e0)]?.[_0x38c017(0x191)]&&isPendingSegmentId(_0x75fd7f[_0x38c017(0x1e0)][_0x38c017(0x191)])&&delete _0x75fd7f[_0x38c017(0x1e0)];_0x75fd7f['milestone']?.[_0x38c017(0x191)]&&isPendingSegmentId(_0x75fd7f[_0x38c017(0x151)][_0x38c017(0x191)])&&delete _0x75fd7f[_0x38c017(0x151)];_0x75fd7f['exitCriterias']&&(_0x75fd7f[_0x38c017(0x1f5)]=_0x75fd7f['exitCriterias'][_0x38c017(0x192)](_0x3f02a5=>!_0x3f02a5[_0x38c017(0x191)]||!isPendingSegmentId(_0x3f02a5['segmentId'])));if(_0x75fd7f[_0x38c017(0x134)])for(const _0x2ad080 of Object[_0x38c017(0x205)](_0x75fd7f[_0x38c017(0x134)])){const _0x416b52=_0x75fd7f[_0x38c017(0x134)][_0x2ad080];_0x416b52[_0x38c017(0x17b)]==='Activation'&&_0x416b52[_0x38c017(0x1b3)]&&isPendingActivationId(_0x416b52['journeyActivationStepId'])&&(_0x416b52[_0x38c017(0x1b3)]='');if(_0x416b52[_0x38c017(0x17b)]===_0x38c017(0x1a9)&&_0x416b52[_0x38c017(0x1ca)])for(const _0x51bfdd of _0x416b52['branches']){_0x51bfdd['segmentId']&&isPendingSegmentId(_0x51bfdd[_0x38c017(0x191)])&&(_0x51bfdd[_0x38c017(0x191)]='');}_0x416b52[_0x38c017(0x17b)]===_0x38c017(0x218)&&stripWaitStepPendingIds(_0x416b52);}}}function resolvePendingIdsInRequest(_0x58414b,_0x49a13a,_0x23e0e5,_0x426af9,_0x16cd4e,_0x51ad89){const _0x222cdb=a142_0x5b9def,_0x434695=(_0x1150cb,_0x4d8536)=>{const _0x311ac3=a142_0x361a;if(!isPendingSegmentId(_0x1150cb))return _0x1150cb;const _0x26ed78=extractPendingSegmentName(_0x1150cb),_0x577277=_0x426af9[_0x311ac3(0x1b1)](_0x26ed78);return!_0x577277&&_0x51ad89['logWarning']?.(_0x311ac3(0x1cf)+_0x26ed78+_0x311ac3(0x1fd)+_0x4d8536),_0x577277;};if(_0x58414b['attributes'][_0x222cdb(0x1ac)]?.['segmentId']&&isPendingSegmentId(_0x58414b[_0x222cdb(0x18a)][_0x222cdb(0x1ac)]['segmentId'])){const _0x3f88a8=_0x434695(_0x58414b[_0x222cdb(0x18a)][_0x222cdb(0x1ac)][_0x222cdb(0x191)],_0x222cdb(0x1e7));_0x3f88a8&&(_0x58414b[_0x222cdb(0x18a)][_0x222cdb(0x1ac)][_0x222cdb(0x191)]=_0x3f88a8);}for(const _0xe4817c of _0x58414b['attributes'][_0x222cdb(0x21d)]||[]){const _0x23371a=_0x23e0e5[_0x222cdb(0x1b1)](_0xe4817c['name'][_0x222cdb(0x217)]());_0x23371a&&(_0xe4817c['id']=_0x23371a);if(_0xe4817c[_0x222cdb(0x1e0)]?.[_0x222cdb(0x191)]&&isPendingSegmentId(_0xe4817c[_0x222cdb(0x1e0)]['segmentId'])){const _0x483a92=_0x434695(_0xe4817c['entryCriteria']['segmentId'],_0x222cdb(0x1a6)+_0xe4817c[_0x222cdb(0x13e)]+_0x222cdb(0x1de));_0x483a92&&(_0xe4817c[_0x222cdb(0x1e0)]['segmentId']=_0x483a92);}if(_0xe4817c[_0x222cdb(0x1f5)])for(const _0x198b35 of _0xe4817c[_0x222cdb(0x1f5)]){if(_0x198b35[_0x222cdb(0x191)]&&isPendingSegmentId(_0x198b35[_0x222cdb(0x191)])){const _0x57d80d=_0x434695(_0x198b35[_0x222cdb(0x191)],_0x222cdb(0x1a6)+_0xe4817c[_0x222cdb(0x13e)]+_0x222cdb(0x153));_0x57d80d&&(_0x198b35[_0x222cdb(0x191)]=_0x57d80d);}}if(_0xe4817c[_0x222cdb(0x151)]?.[_0x222cdb(0x191)]&&isPendingSegmentId(_0xe4817c[_0x222cdb(0x151)][_0x222cdb(0x191)])){const _0x1c810e=_0x434695(_0xe4817c[_0x222cdb(0x151)][_0x222cdb(0x191)],_0x222cdb(0x1a6)+_0xe4817c[_0x222cdb(0x13e)]+_0x222cdb(0x1cb));_0x1c810e&&(_0xe4817c[_0x222cdb(0x151)][_0x222cdb(0x191)]=_0x1c810e);}if(_0xe4817c[_0x222cdb(0x134)]){const _0x5afc04=_0x53f660=>_0x49a13a[_0x222cdb(0x18a)][_0x222cdb(0x21d)]?.[_0x222cdb(0x1c5)](_0x4b08a2=>_0x4b08a2[_0x222cdb(0x13e)][_0x222cdb(0x217)]()===_0xe4817c[_0x222cdb(0x13e)][_0x222cdb(0x217)]())?.['steps']?.[_0x53f660];for(const _0x51fe24 of Object['keys'](_0xe4817c['steps'])){const _0x405af3=_0xe4817c[_0x222cdb(0x134)][_0x51fe24],_0x67e4a2=_0x5afc04(_0x51fe24);if(_0x405af3[_0x222cdb(0x17b)]===_0x222cdb(0x1ea)&&_0x405af3[_0x222cdb(0x1b3)]&&(isPendingActivationId(_0x405af3['journeyActivationStepId'])||_0x405af3[_0x222cdb(0x1b3)]==='')){if(_0x67e4a2?.[_0x222cdb(0x1b3)]&&isPendingActivationId(_0x67e4a2[_0x222cdb(0x1b3)])){const _0x54f62c=extractPendingActivationName(_0x67e4a2[_0x222cdb(0x1b3)]),_0x18cf1a=_0x16cd4e[_0x222cdb(0x1b1)](_0x54f62c);_0x18cf1a&&(_0x405af3[_0x222cdb(0x1b3)]=_0x18cf1a);}}if(_0x405af3['type']==='DecisionPoint'&&_0x405af3[_0x222cdb(0x1ca)]&&_0x67e4a2?.['branches'])for(let _0x5f0550=0x0;_0x5f0550<_0x405af3['branches'][_0x222cdb(0x164)];_0x5f0550++){const _0x265c70=_0x405af3[_0x222cdb(0x1ca)][_0x5f0550],_0x1ef780=_0x67e4a2[_0x222cdb(0x1ca)][_0x5f0550];if(_0x1ef780?.[_0x222cdb(0x191)]&&isPendingSegmentId(_0x1ef780[_0x222cdb(0x191)])){const _0x59f397=_0x434695(_0x1ef780[_0x222cdb(0x191)],_0x222cdb(0x1a6)+_0xe4817c[_0x222cdb(0x13e)]+_0x222cdb(0x1c6)+(_0x265c70[_0x222cdb(0x13e)]||_0x5f0550)+'\x27');_0x59f397&&(_0x265c70[_0x222cdb(0x191)]=_0x59f397);}}_0x405af3[_0x222cdb(0x17b)]===_0x222cdb(0x218)&&_0x67e4a2?.[_0x222cdb(0x17b)]===_0x222cdb(0x218)&&resolveWaitStepPendingIds(_0x405af3,_0x67e4a2,_0x434695,_0xe4817c[_0x222cdb(0x13e)]);}}}}
@@ -1 +1 @@
1
- (function(_0x1db703,_0xc5973){const _0x2c5519=a143_0x27ea,_0x2dd321=_0x1db703();while(!![]){try{const _0x4f3ace=parseInt(_0x2c5519(0x1e7))/0x1+parseInt(_0x2c5519(0x1eb))/0x2+parseInt(_0x2c5519(0x1f0))/0x3*(parseInt(_0x2c5519(0x1ee))/0x4)+-parseInt(_0x2c5519(0x1e5))/0x5+-parseInt(_0x2c5519(0x1f2))/0x6*(-parseInt(_0x2c5519(0x1f4))/0x7)+-parseInt(_0x2c5519(0x1ea))/0x8*(-parseInt(_0x2c5519(0x1ec))/0x9)+-parseInt(_0x2c5519(0x1e9))/0xa*(parseInt(_0x2c5519(0x1f1))/0xb);if(_0x4f3ace===_0xc5973)break;else _0x2dd321['push'](_0x2dd321['shift']());}catch(_0x972687){_0x2dd321['push'](_0x2dd321['shift']());}}}(a143_0x5851,0x9c1c3));function a143_0x27ea(_0x523f84,_0x1c6452){_0x523f84=_0x523f84-0x1e4;const _0x585159=a143_0x5851();let _0x27ea3c=_0x585159[_0x523f84];return _0x27ea3c;}export function buildFolderIdToPathMap(_0x199edf){const _0x256e66=a143_0x27ea,_0x1a20e7=new Map(),_0x249bc9=new Map();for(const _0x20bcec of _0x199edf){_0x249bc9['set'](_0x20bcec['id'],_0x20bcec);}const _0x2ea369=new Set();for(const _0x24534a of _0x199edf){!_0x24534a[_0x256e66(0x1e8)]&&_0x2ea369[_0x256e66(0x1e4)](_0x24534a['id']);}function _0x1d919d(_0x31c96d){const _0x140825=_0x256e66;if(_0x1a20e7[_0x140825(0x1f3)](_0x31c96d['id']))return _0x1a20e7[_0x140825(0x1ef)](_0x31c96d['id']);if(_0x2ea369[_0x140825(0x1f3)](_0x31c96d['id']))return _0x1a20e7[_0x140825(0x1e6)](_0x31c96d['id'],''),'';if(_0x31c96d[_0x140825(0x1e8)]){const _0x4ce514=_0x249bc9[_0x140825(0x1ef)](_0x31c96d[_0x140825(0x1e8)]);if(_0x4ce514){const _0x27181c=_0x1d919d(_0x4ce514),_0x57a20d=_0x27181c?_0x27181c+'/'+_0x31c96d['name']:_0x31c96d['name'];return _0x1a20e7[_0x140825(0x1e6)](_0x31c96d['id'],_0x57a20d),_0x57a20d;}}const _0x3e079b=_0x31c96d[_0x140825(0x1ed)];return _0x1a20e7['set'](_0x31c96d['id'],_0x3e079b),_0x3e079b;}for(const _0x1f5a6a of _0x199edf){_0x1d919d(_0x1f5a6a);}return _0x1a20e7;}function a143_0x5851(){const _0x38085f=['2407160DKnvnw','add','20570bjkurk','set','487854EsKdZI','parentFolderId','5490vhzSDn','161488aPOMZe','2132394gtKvAy','54vBTKQv','name','472tsxTtB','get','6618GXQLvY','39666BKJTnW','12Ruyvhm','has'];a143_0x5851=function(){return _0x38085f;};return a143_0x5851();}export function buildFolderPathToIdMap(_0x2790aa){const _0x1522d8=a143_0x27ea,_0x2657b8=new Map(),_0x400455=new Map();for(const _0x257ab8 of _0x2790aa){_0x400455[_0x1522d8(0x1e6)](_0x257ab8['id'],_0x257ab8);}const _0x58f0a8=new Set();for(const _0xc212ad of _0x2790aa){!_0xc212ad[_0x1522d8(0x1e8)]&&_0x58f0a8[_0x1522d8(0x1e4)](_0xc212ad['id']);}function _0x81d772(_0x195d97){const _0x1f41ff=_0x1522d8;if(_0x58f0a8[_0x1f41ff(0x1f3)](_0x195d97['id']))return'';if(_0x195d97[_0x1f41ff(0x1e8)]){const _0xd3ae2d=_0x400455['get'](_0x195d97[_0x1f41ff(0x1e8)]);if(_0xd3ae2d){const _0x39b9cc=_0x81d772(_0xd3ae2d);return _0x39b9cc?_0x39b9cc+'/'+_0x195d97[_0x1f41ff(0x1ed)]:_0x195d97['name'];}}return _0x195d97[_0x1f41ff(0x1ed)];}for(const _0x1b01a2 of _0x2790aa){const _0x8bd74=_0x81d772(_0x1b01a2);_0x2657b8[_0x1522d8(0x1e6)](_0x8bd74,_0x1b01a2['id']);}return _0x2657b8;}export function buildFolderMaps(_0x4c1953){const _0x3b4cf6=a143_0x27ea,_0x1b86ea=buildFolderIdToPathMap(_0x4c1953),_0x19c569=new Map();for(const [_0x830ec,_0x597256]of _0x1b86ea){_0x19c569[_0x3b4cf6(0x1e6)](_0x597256,_0x830ec);}return{'idToPath':_0x1b86ea,'pathToId':_0x19c569};}export function getFolderPath(_0x513b1f,_0x1152ad){if(!_0x513b1f)return'';return _0x1152ad['get'](_0x513b1f)??'';}
1
+ (function(_0xb6d4d7,_0x26c081){const _0x356984=a143_0xf61f,_0x33e0a6=_0xb6d4d7();while(!![]){try{const _0x59ea2a=-parseInt(_0x356984(0x130))/0x1*(parseInt(_0x356984(0x134))/0x2)+-parseInt(_0x356984(0x12d))/0x3*(-parseInt(_0x356984(0x12c))/0x4)+parseInt(_0x356984(0x127))/0x5+parseInt(_0x356984(0x133))/0x6+parseInt(_0x356984(0x12b))/0x7*(-parseInt(_0x356984(0x132))/0x8)+-parseInt(_0x356984(0x135))/0x9+-parseInt(_0x356984(0x12f))/0xa*(parseInt(_0x356984(0x137))/0xb);if(_0x59ea2a===_0x26c081)break;else _0x33e0a6['push'](_0x33e0a6['shift']());}catch(_0x181247){_0x33e0a6['push'](_0x33e0a6['shift']());}}}(a143_0x4824,0x9657a));export function buildFolderIdToPathMap(_0x3447d6){const _0x5012ea=a143_0xf61f,_0x580a7d=new Map(),_0x1ae0de=new Map();for(const _0x5dfffa of _0x3447d6){_0x1ae0de['set'](_0x5dfffa['id'],_0x5dfffa);}const _0x306695=new Set();for(const _0x38a065 of _0x3447d6){!_0x38a065[_0x5012ea(0x12e)]&&_0x306695[_0x5012ea(0x136)](_0x38a065['id']);}function _0x583353(_0x2d29a7){const _0x5c05e6=_0x5012ea;if(_0x580a7d[_0x5c05e6(0x128)](_0x2d29a7['id']))return _0x580a7d[_0x5c05e6(0x12a)](_0x2d29a7['id']);if(_0x306695[_0x5c05e6(0x128)](_0x2d29a7['id']))return _0x580a7d['set'](_0x2d29a7['id'],''),'';if(_0x2d29a7[_0x5c05e6(0x12e)]){const _0x10107f=_0x1ae0de['get'](_0x2d29a7[_0x5c05e6(0x12e)]);if(_0x10107f){const _0x7d8f75=_0x583353(_0x10107f),_0x4e137b=_0x7d8f75?_0x7d8f75+'/'+_0x2d29a7[_0x5c05e6(0x131)]:_0x2d29a7[_0x5c05e6(0x131)];return _0x580a7d[_0x5c05e6(0x129)](_0x2d29a7['id'],_0x4e137b),_0x4e137b;}}const _0x3b6ea0=_0x2d29a7[_0x5c05e6(0x131)];return _0x580a7d[_0x5c05e6(0x129)](_0x2d29a7['id'],_0x3b6ea0),_0x3b6ea0;}for(const _0x448378 of _0x3447d6){_0x583353(_0x448378);}return _0x580a7d;}function a143_0xf61f(_0x710418,_0x1bdcf2){_0x710418=_0x710418-0x127;const _0x4824bf=a143_0x4824();let _0xf61f54=_0x4824bf[_0x710418];return _0xf61f54;}function a143_0x4824(){const _0x31e2d4=['parentFolderId','30ktGMrw','32941NqNyyA','name','904KUPxSb','4670226pbPOst','6abBJBW','4228119BZqewl','add','2364923KVLyiI','3547370yGMxyt','has','set','get','15701ejbkhd','7508aEXHnN','951EjNHZX'];a143_0x4824=function(){return _0x31e2d4;};return a143_0x4824();}export function buildFolderPathToIdMap(_0x17d067){const _0x10378d=a143_0xf61f,_0x5bfa5d=new Map(),_0x176e0e=new Map();for(const _0x268aea of _0x17d067){_0x176e0e['set'](_0x268aea['id'],_0x268aea);}const _0x52a83f=new Set();for(const _0x2b129e of _0x17d067){!_0x2b129e[_0x10378d(0x12e)]&&_0x52a83f[_0x10378d(0x136)](_0x2b129e['id']);}function _0x219331(_0x42c47d){const _0x2b85f2=_0x10378d;if(_0x52a83f[_0x2b85f2(0x128)](_0x42c47d['id']))return'';if(_0x42c47d[_0x2b85f2(0x12e)]){const _0xb28a79=_0x176e0e[_0x2b85f2(0x12a)](_0x42c47d[_0x2b85f2(0x12e)]);if(_0xb28a79){const _0x8ffa7b=_0x219331(_0xb28a79);return _0x8ffa7b?_0x8ffa7b+'/'+_0x42c47d[_0x2b85f2(0x131)]:_0x42c47d[_0x2b85f2(0x131)];}}return _0x42c47d['name'];}for(const _0x324b10 of _0x17d067){const _0x26f560=_0x219331(_0x324b10);_0x5bfa5d[_0x10378d(0x129)](_0x26f560,_0x324b10['id']);}return _0x5bfa5d;}export function buildFolderMaps(_0x4f7134){const _0x302fed=a143_0xf61f,_0x2a7e73=buildFolderIdToPathMap(_0x4f7134),_0x14d693=new Map();for(const [_0x28ba3a,_0x2a56d2]of _0x2a7e73){_0x14d693[_0x302fed(0x129)](_0x2a56d2,_0x28ba3a);}return{'idToPath':_0x2a7e73,'pathToId':_0x14d693};}export function getFolderPath(_0x4119ac,_0xd02f30){const _0x43234a=a143_0xf61f;if(!_0x4119ac)return'';return _0xd02f30[_0x43234a(0x12a)](_0x4119ac)??'';}
@@ -1 +1 @@
1
- (function(_0x5d3dea,_0x34d4f6){const _0x2c5e3d=a144_0x4823,_0x4e3839=_0x5d3dea();while(!![]){try{const _0x1f0bfd=parseInt(_0x2c5e3d(0x185))/0x1*(-parseInt(_0x2c5e3d(0x180))/0x2)+parseInt(_0x2c5e3d(0x170))/0x3*(parseInt(_0x2c5e3d(0x16f))/0x4)+parseInt(_0x2c5e3d(0x17e))/0x5*(-parseInt(_0x2c5e3d(0x17f))/0x6)+-parseInt(_0x2c5e3d(0x162))/0x7+parseInt(_0x2c5e3d(0x167))/0x8*(-parseInt(_0x2c5e3d(0x15f))/0x9)+-parseInt(_0x2c5e3d(0x181))/0xa*(-parseInt(_0x2c5e3d(0x166))/0xb)+parseInt(_0x2c5e3d(0x184))/0xc;if(_0x1f0bfd===_0x34d4f6)break;else _0x4e3839['push'](_0x4e3839['shift']());}catch(_0x421704){_0x4e3839['push'](_0x4e3839['shift']());}}}(a144_0x32fd,0x96ec4));function a144_0x32fd(){const _0x3e4acd=['Relative\x20path\x20cannot\x20be\x20empty','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','No\x20tdx.json\x20found\x20for\x20file:\x20','readFile','endsWith','pop','8WPjasL','1182849XdAvCy','relative','slice','name','replace','tdx.json','Cannot\x20split\x20empty\x20path','parse','journey','trim','isAbsolute','root','substring','push','95330FnwHQH','114MfOFEa','16VLuWVK','20wpuNAi','startsWith','Path\x20cannot\x20be\x20empty','1935468HPCQja','10987ZmqLmr','length','join','dirname','filter','Cannot\x20navigate\x20above\x20root','Path\x20attempts\x20to\x20navigate\x20above\x20root','raw','test','4043961ZWSjLB','Path\x20segment\x20cannot\x20be\x20empty','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','480235exBtAE','segments','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','5971559ohetUi','16WQGMIC','exists'];a144_0x32fd=function(){return _0x3e4acd;};return a144_0x32fd();}import a144_0x5c21e7 from'path';import{parse as a144_0x253e61}from'yaml';function a144_0x4823(_0x3ea31b,_0x11581e){_0x3ea31b=_0x3ea31b-0x15c;const _0x32fdca=a144_0x32fd();let _0x482317=_0x32fdca[_0x3ea31b];return _0x482317;}import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x2669ce){const _0x2bc0f5=a144_0x4823;if(!_0x2669ce||_0x2669ce[_0x2bc0f5(0x179)]()==='')throw new Error(_0x2bc0f5(0x183));const _0x1c3e52=_0x2669ce[_0x2bc0f5(0x179)]();if(_0x1c3e52==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x2669ce};const _0x3f4f77=_0x1c3e52['startsWith']('/')?_0x1c3e52[_0x2bc0f5(0x17c)](0x1):_0x1c3e52,_0x112f23=_0x3f4f77['split']('/')[_0x2bc0f5(0x189)](_0x2f83e9=>_0x2f83e9!=='');if(_0x112f23[_0x2bc0f5(0x186)]===0x0)throw new Error(_0x2bc0f5(0x16a));const _0x1f71a2=_0x1c3e52[_0x2bc0f5(0x182)]('/')||!isRelativePathSegment(_0x112f23[0x0]);for(const _0x406282 of _0x112f23){validatePathSegment(_0x406282);}return{'segments':_0x112f23,'isAbsolute':_0x1f71a2,'raw':_0x2669ce};}function isRelativePathSegment(_0x7a0e30){return _0x7a0e30==='.'||_0x7a0e30==='..';}function validatePathSegment(_0x2727d7){const _0x3ece6f=a144_0x4823;if(_0x2727d7==='')throw new Error(_0x3ece6f(0x160));if(_0x2727d7==='.'||_0x2727d7==='..')return;if(/[\x00-\x1F\x7F]/[_0x3ece6f(0x15e)](_0x2727d7))throw new Error('Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20'+_0x2727d7);if(_0x2727d7!==_0x2727d7[_0x3ece6f(0x179)]()){}}export function validatePath(_0x3503b4){const _0x21924d=a144_0x4823;if(_0x3503b4[_0x21924d(0x163)][_0x21924d(0x186)]===0x0&&!_0x3503b4[_0x21924d(0x17a)])throw new Error(_0x21924d(0x169));if(_0x3503b4[_0x21924d(0x17a)]){if(_0x3503b4[_0x21924d(0x163)][0x0]==='..')throw new Error(_0x21924d(0x165));let _0x25e914=0x0;for(const _0x1fbf6f of _0x3503b4[_0x21924d(0x163)]){if(_0x1fbf6f==='..'){if(_0x25e914===0x0)throw new Error(_0x21924d(0x15c));_0x25e914--;}else _0x1fbf6f!=='.'&&_0x25e914++;}}}export function joinPaths(_0x5cf140,_0x268567){const _0xff585f=a144_0x4823;if(!_0x5cf140||_0x5cf140==='/')return _0x268567;if(!_0x268567||_0x268567==='.')return _0x5cf140;if(_0x268567['startsWith']('/'))return _0x268567;const _0x5a0ce3=parsePath(_0x5cf140),_0x11f62b=parsePath(_0x268567),_0x55b377=[..._0x5a0ce3[_0xff585f(0x163)]];for(const _0x18433d of _0x11f62b[_0xff585f(0x163)]){if(_0x18433d==='.')continue;else{if(_0x18433d==='..'){if(_0x55b377[_0xff585f(0x186)]===0x0)throw new Error('Cannot\x20navigate\x20above\x20root');_0x55b377[_0xff585f(0x16e)]();}else _0x55b377[_0xff585f(0x17d)](_0x18433d);}}const _0x820ce2=_0x55b377['join']('/');return _0x5a0ce3[_0xff585f(0x15d)][_0xff585f(0x182)]('/')?'/'+_0x820ce2:_0x820ce2;}export function normalizePath(_0x4ad3ab){const _0x2c4b89=a144_0x4823,_0x2fc83=parsePath(_0x4ad3ab),_0x2433be=[];for(const _0x4f8072 of _0x2fc83[_0x2c4b89(0x163)]){if(_0x4f8072==='.')continue;else{if(_0x4f8072==='..'){if(_0x2433be[_0x2c4b89(0x186)]===0x0){if(_0x2fc83[_0x2c4b89(0x17a)])throw new Error(_0x2c4b89(0x18a));_0x2433be[_0x2c4b89(0x17d)]('..');}else _0x2433be[_0x2433be[_0x2c4b89(0x186)]-0x1]==='..'?_0x2433be['push']('..'):_0x2433be['pop']();}else _0x2433be[_0x2c4b89(0x17d)](_0x4f8072);}}if(_0x2433be[_0x2c4b89(0x186)]===0x0)return _0x2fc83[_0x2c4b89(0x17a)]?'/':'.';const _0x5ea252=_0x2433be[_0x2c4b89(0x187)]('/');return _0x2fc83[_0x2c4b89(0x15d)][_0x2c4b89(0x182)]('/')?'/'+_0x5ea252:_0x5ea252;}export function getParentPath(_0x22cc4a){const _0x2146d2=a144_0x4823,_0x4bad07=parsePath(_0x22cc4a);if(_0x4bad07[_0x2146d2(0x163)][_0x2146d2(0x186)]<=0x1)return'/';const _0x42b7ba=_0x4bad07[_0x2146d2(0x163)][_0x2146d2(0x172)](0x0,-0x1)['join']('/');return _0x4bad07[_0x2146d2(0x15d)]['startsWith']('/')?'/'+_0x42b7ba:_0x42b7ba;}export function getBaseName(_0x46cde8){const _0x1cd383=a144_0x4823,_0x3267f3=parsePath(_0x46cde8);return _0x3267f3[_0x1cd383(0x163)][_0x3267f3[_0x1cd383(0x163)][_0x1cd383(0x186)]-0x1]||'';}export function isChildPath(_0x55cdd7,_0x478f5a){const _0x1018f0=a144_0x4823,_0x25237b=parsePath(_0x55cdd7),_0x7bc13d=parsePath(_0x478f5a);if(_0x25237b[_0x1018f0(0x163)]['length']<=_0x7bc13d[_0x1018f0(0x163)]['length'])return![];for(let _0x5e1ea8=0x0;_0x5e1ea8<_0x7bc13d[_0x1018f0(0x163)]['length'];_0x5e1ea8++){if(_0x25237b['segments'][_0x5e1ea8]!==_0x7bc13d['segments'][_0x5e1ea8])return![];}return!![];}export function splitPath(_0x267e40){const _0x2fbeaf=a144_0x4823,_0x547b17=parsePath(_0x267e40);if(_0x547b17[_0x2fbeaf(0x163)][_0x2fbeaf(0x186)]===0x0)throw new Error(_0x2fbeaf(0x176));if(_0x547b17[_0x2fbeaf(0x163)][_0x2fbeaf(0x186)]===0x1)return{'parent':_0x547b17[_0x2fbeaf(0x163)][0x0]};return{'parent':_0x547b17[_0x2fbeaf(0x163)][0x0],'child':_0x547b17[_0x2fbeaf(0x163)][_0x2fbeaf(0x172)](0x1)[_0x2fbeaf(0x187)]('/')};}export function isYamlFilePath(_0x2d6d32){const _0x3bbc2f=a144_0x4823;return _0x2d6d32[_0x3bbc2f(0x16d)]('.yml')||_0x2d6d32['endsWith']('.yaml');}export async function resolveYamlFilePath(_0x3b027a,_0x1ae8fa=nodeFileSystem){const _0x31e1a9=a144_0x4823,_0x5ff14=a144_0x5c21e7['resolve'](_0x3b027a);if(!await _0x1ae8fa[_0x31e1a9(0x168)](_0x5ff14))throw new Error('File\x20not\x20found:\x20'+_0x3b027a);let _0x3fb070=a144_0x5c21e7['dirname'](_0x5ff14),_0x2df538=null,_0x5135ff=null;const _0x36d473=a144_0x5c21e7[_0x31e1a9(0x177)](_0x3fb070)[_0x31e1a9(0x17b)];while(_0x3fb070!==_0x36d473){const _0x4e7d75=a144_0x5c21e7['join'](_0x3fb070,_0x31e1a9(0x175));if(await _0x1ae8fa[_0x31e1a9(0x168)](_0x4e7d75)){_0x2df538=_0x4e7d75,_0x5135ff=_0x3fb070;break;}_0x3fb070=a144_0x5c21e7[_0x31e1a9(0x188)](_0x3fb070);}if(!_0x2df538||!_0x5135ff)throw new Error(_0x31e1a9(0x16b)+_0x3b027a+'\x0a'+_0x31e1a9(0x161));const _0x23b640=await _0x1ae8fa[_0x31e1a9(0x16c)](_0x2df538),_0x4bfd80=JSON[_0x31e1a9(0x177)](_0x23b640),_0x46a5c8=_0x4bfd80['parent_segment'];if(!_0x46a5c8)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x18f7ff=await _0x1ae8fa[_0x31e1a9(0x16c)](_0x5ff14),_0x3aae7c=a144_0x253e61(_0x18f7ff),_0x45bb4d=_0x3aae7c[_0x31e1a9(0x173)];if(!_0x45bb4d)throw new Error(_0x31e1a9(0x164)+_0x3b027a);const _0x247dc7=_0x3aae7c['type']===_0x31e1a9(0x178)?_0x31e1a9(0x178):'segment',_0x4cec79=a144_0x5c21e7[_0x31e1a9(0x171)](_0x5135ff,_0x5ff14),_0x11d55b=a144_0x5c21e7['dirname'](_0x4cec79),_0x3dec45=_0x11d55b==='.'?'':_0x11d55b[_0x31e1a9(0x174)](/\\/g,'/'),_0x375cfb=_0x3dec45?_0x46a5c8+'/'+_0x3dec45+'/'+_0x45bb4d:_0x46a5c8+'/'+_0x45bb4d;return{'parentSegment':_0x46a5c8,'segmentName':_0x45bb4d,'folderPath':_0x3dec45,'fullPath':_0x375cfb,'resourceType':_0x247dc7,'content':_0x18f7ff};}
1
+ (function(_0x546336,_0x5c94d0){const _0x5bda56=a144_0x1a25,_0x398cfa=_0x546336();while(!![]){try{const _0x570194=-parseInt(_0x5bda56(0x129))/0x1+-parseInt(_0x5bda56(0x10e))/0x2*(-parseInt(_0x5bda56(0x108))/0x3)+-parseInt(_0x5bda56(0x110))/0x4*(parseInt(_0x5bda56(0x111))/0x5)+parseInt(_0x5bda56(0x107))/0x6*(-parseInt(_0x5bda56(0x125))/0x7)+-parseInt(_0x5bda56(0x116))/0x8+-parseInt(_0x5bda56(0x131))/0x9*(parseInt(_0x5bda56(0x113))/0xa)+parseInt(_0x5bda56(0x132))/0xb*(parseInt(_0x5bda56(0x10d))/0xc);if(_0x570194===_0x5c94d0)break;else _0x398cfa['push'](_0x398cfa['shift']());}catch(_0x9a7ef5){_0x398cfa['push'](_0x398cfa['shift']());}}}(a144_0x2b1f,0x394cd));function a144_0x2b1f(){const _0x5c9b63=['push','95358lRsOeS','21kpjoFJ','segment','No\x20tdx.json\x20found\x20for\x20file:\x20','length','exists','84WzDYyR','87254OVuLYB','replace','4hdnuou','2035080ixPGUM','Path\x20cannot\x20be\x20empty','310srXdRc','parse','root','2955824HjAcxb','Relative\x20path\x20cannot\x20be\x20empty','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','Path\x20attempts\x20to\x20navigate\x20above\x20root','pop','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','journey','join','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','type','readFile','segments','filter','relative','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','77ylalkl','endsWith','.yaml','isAbsolute','174209mWyCWO','Cannot\x20navigate\x20above\x20root','parent_segment','tdx.json','name','.yml','dirname','test','4869TifIFD','1683957gRGFpr','trim','raw','startsWith','substring','split','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'];a144_0x2b1f=function(){return _0x5c9b63;};return a144_0x2b1f();}import a144_0x43ee37 from'path';import{parse as a144_0x34cf87}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x35360a){const _0x291512=a144_0x1a25;if(!_0x35360a||_0x35360a[_0x291512(0x100)]()==='')throw new Error(_0x291512(0x112));const _0x45ed56=_0x35360a[_0x291512(0x100)]();if(_0x45ed56==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x35360a};const _0x479b64=_0x45ed56[_0x291512(0x102)]('/')?_0x45ed56[_0x291512(0x103)](0x1):_0x45ed56,_0x16800c=_0x479b64[_0x291512(0x104)]('/')[_0x291512(0x122)](_0x459219=>_0x459219!=='');if(_0x16800c[_0x291512(0x10b)]===0x0)throw new Error(_0x291512(0x124));const _0x3ce212=_0x45ed56['startsWith']('/')||!isRelativePathSegment(_0x16800c[0x0]);for(const _0x3a5dbd of _0x16800c){validatePathSegment(_0x3a5dbd);}return{'segments':_0x16800c,'isAbsolute':_0x3ce212,'raw':_0x35360a};}function isRelativePathSegment(_0x305513){return _0x305513==='.'||_0x305513==='..';}function validatePathSegment(_0x231ba7){const _0x1a8a67=a144_0x1a25;if(_0x231ba7==='')throw new Error('Path\x20segment\x20cannot\x20be\x20empty');if(_0x231ba7==='.'||_0x231ba7==='..')return;if(/[\x00-\x1F\x7F]/[_0x1a8a67(0x130)](_0x231ba7))throw new Error(_0x1a8a67(0x11e)+_0x231ba7);if(_0x231ba7!==_0x231ba7[_0x1a8a67(0x100)]()){}}export function validatePath(_0x38892c){const _0x16cb7a=a144_0x1a25;if(_0x38892c[_0x16cb7a(0x121)]['length']===0x0&&!_0x38892c[_0x16cb7a(0x128)])throw new Error(_0x16cb7a(0x117));if(_0x38892c[_0x16cb7a(0x128)]){if(_0x38892c['segments'][0x0]==='..')throw new Error(_0x16cb7a(0x11b));let _0x12c8ca=0x0;for(const _0x587d6b of _0x38892c[_0x16cb7a(0x121)]){if(_0x587d6b==='..'){if(_0x12c8ca===0x0)throw new Error(_0x16cb7a(0x119));_0x12c8ca--;}else _0x587d6b!=='.'&&_0x12c8ca++;}}}export function joinPaths(_0x45a70b,_0x116084){const _0x9daa16=a144_0x1a25;if(!_0x45a70b||_0x45a70b==='/')return _0x116084;if(!_0x116084||_0x116084==='.')return _0x45a70b;if(_0x116084[_0x9daa16(0x102)]('/'))return _0x116084;const _0x13dfcc=parsePath(_0x45a70b),_0xd569f8=parsePath(_0x116084),_0x51807c=[..._0x13dfcc['segments']];for(const _0x3eb81d of _0xd569f8[_0x9daa16(0x121)]){if(_0x3eb81d==='.')continue;else{if(_0x3eb81d==='..'){if(_0x51807c['length']===0x0)throw new Error(_0x9daa16(0x12a));_0x51807c[_0x9daa16(0x11a)]();}else _0x51807c[_0x9daa16(0x106)](_0x3eb81d);}}const _0x4cb213=_0x51807c[_0x9daa16(0x11d)]('/');return _0x13dfcc[_0x9daa16(0x101)][_0x9daa16(0x102)]('/')?'/'+_0x4cb213:_0x4cb213;}function a144_0x1a25(_0x292ee2,_0x444df5){_0x292ee2=_0x292ee2-0x100;const _0x2b1fd0=a144_0x2b1f();let _0x1a25ed=_0x2b1fd0[_0x292ee2];return _0x1a25ed;}export function normalizePath(_0x3897f5){const _0x54ba71=a144_0x1a25,_0x33de84=parsePath(_0x3897f5),_0x5fc364=[];for(const _0x3f4d67 of _0x33de84[_0x54ba71(0x121)]){if(_0x3f4d67==='.')continue;else{if(_0x3f4d67==='..'){if(_0x5fc364[_0x54ba71(0x10b)]===0x0){if(_0x33de84[_0x54ba71(0x128)])throw new Error('Cannot\x20navigate\x20above\x20root');_0x5fc364['push']('..');}else _0x5fc364[_0x5fc364[_0x54ba71(0x10b)]-0x1]==='..'?_0x5fc364['push']('..'):_0x5fc364['pop']();}else _0x5fc364[_0x54ba71(0x106)](_0x3f4d67);}}if(_0x5fc364[_0x54ba71(0x10b)]===0x0)return _0x33de84[_0x54ba71(0x128)]?'/':'.';const _0x8a26f4=_0x5fc364[_0x54ba71(0x11d)]('/');return _0x33de84[_0x54ba71(0x101)][_0x54ba71(0x102)]('/')?'/'+_0x8a26f4:_0x8a26f4;}export function getParentPath(_0x3ac69f){const _0x15942d=a144_0x1a25,_0x6d0a78=parsePath(_0x3ac69f);if(_0x6d0a78[_0x15942d(0x121)]['length']<=0x1)return'/';const _0x1ac8e9=_0x6d0a78[_0x15942d(0x121)]['slice'](0x0,-0x1)[_0x15942d(0x11d)]('/');return _0x6d0a78['raw'][_0x15942d(0x102)]('/')?'/'+_0x1ac8e9:_0x1ac8e9;}export function getBaseName(_0x24eb17){const _0x4312bd=a144_0x1a25,_0x8d607a=parsePath(_0x24eb17);return _0x8d607a[_0x4312bd(0x121)][_0x8d607a[_0x4312bd(0x121)][_0x4312bd(0x10b)]-0x1]||'';}export function isChildPath(_0x142d68,_0x18ae45){const _0x426b1c=a144_0x1a25,_0x253da2=parsePath(_0x142d68),_0x285471=parsePath(_0x18ae45);if(_0x253da2[_0x426b1c(0x121)]['length']<=_0x285471[_0x426b1c(0x121)][_0x426b1c(0x10b)])return![];for(let _0x38dc04=0x0;_0x38dc04<_0x285471['segments'][_0x426b1c(0x10b)];_0x38dc04++){if(_0x253da2[_0x426b1c(0x121)][_0x38dc04]!==_0x285471['segments'][_0x38dc04])return![];}return!![];}export function splitPath(_0x23c838){const _0x43019f=a144_0x1a25,_0x318b29=parsePath(_0x23c838);if(_0x318b29[_0x43019f(0x121)][_0x43019f(0x10b)]===0x0)throw new Error('Cannot\x20split\x20empty\x20path');if(_0x318b29['segments'][_0x43019f(0x10b)]===0x1)return{'parent':_0x318b29[_0x43019f(0x121)][0x0]};return{'parent':_0x318b29[_0x43019f(0x121)][0x0],'child':_0x318b29[_0x43019f(0x121)]['slice'](0x1)[_0x43019f(0x11d)]('/')};}export function isYamlFilePath(_0x4e31ab){const _0x12219d=a144_0x1a25;return _0x4e31ab[_0x12219d(0x126)](_0x12219d(0x12e))||_0x4e31ab[_0x12219d(0x126)](_0x12219d(0x127));}export async function resolveYamlFilePath(_0x11a2d7,_0x4fcebf=nodeFileSystem){const _0xa7a68e=a144_0x1a25,_0x5e7bca=a144_0x43ee37['resolve'](_0x11a2d7);if(!await _0x4fcebf[_0xa7a68e(0x10c)](_0x5e7bca))throw new Error('File\x20not\x20found:\x20'+_0x11a2d7);let _0x2ad81b=a144_0x43ee37['dirname'](_0x5e7bca),_0x286447=null,_0x4ad788=null;const _0x5656db=a144_0x43ee37[_0xa7a68e(0x114)](_0x2ad81b)[_0xa7a68e(0x115)];while(_0x2ad81b!==_0x5656db){const _0x4b92dc=a144_0x43ee37[_0xa7a68e(0x11d)](_0x2ad81b,_0xa7a68e(0x12c));if(await _0x4fcebf[_0xa7a68e(0x10c)](_0x4b92dc)){_0x286447=_0x4b92dc,_0x4ad788=_0x2ad81b;break;}_0x2ad81b=a144_0x43ee37[_0xa7a68e(0x12f)](_0x2ad81b);}if(!_0x286447||!_0x4ad788)throw new Error(_0xa7a68e(0x10a)+_0x11a2d7+'\x0a'+_0xa7a68e(0x118));const _0xb626fc=await _0x4fcebf[_0xa7a68e(0x120)](_0x286447),_0x3a73c7=JSON[_0xa7a68e(0x114)](_0xb626fc),_0x135940=_0x3a73c7[_0xa7a68e(0x12b)];if(!_0x135940)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x44865b=await _0x4fcebf['readFile'](_0x5e7bca),_0x41398c=a144_0x34cf87(_0x44865b),_0x1ab8dd=_0x41398c[_0xa7a68e(0x12d)];if(!_0x1ab8dd)throw new Error(_0xa7a68e(0x105)+_0x11a2d7);const _0x5acfd7=_0x41398c[_0xa7a68e(0x11f)]===_0xa7a68e(0x11c)?_0xa7a68e(0x11c):_0xa7a68e(0x109),_0x79a4f7=a144_0x43ee37[_0xa7a68e(0x123)](_0x4ad788,_0x5e7bca),_0x104c19=a144_0x43ee37[_0xa7a68e(0x12f)](_0x79a4f7),_0x1497c7=_0x104c19==='.'?'':_0x104c19[_0xa7a68e(0x10f)](/\\/g,'/'),_0x526cb1=_0x1497c7?_0x135940+'/'+_0x1497c7+'/'+_0x1ab8dd:_0x135940+'/'+_0x1ab8dd;return{'parentSegment':_0x135940,'segmentName':_0x1ab8dd,'folderPath':_0x1497c7,'fullPath':_0x526cb1,'resourceType':_0x5acfd7,'content':_0x44865b};}
@@ -1 +1 @@
1
- (function(_0x197ac3,_0x3508af){const _0x506d20=a145_0x218b,_0x37001d=_0x197ac3();while(!![]){try{const _0x521957=-parseInt(_0x506d20(0x15b))/0x1*(-parseInt(_0x506d20(0x15a))/0x2)+parseInt(_0x506d20(0x166))/0x3*(parseInt(_0x506d20(0x161))/0x4)+-parseInt(_0x506d20(0x160))/0x5+parseInt(_0x506d20(0x159))/0x6*(-parseInt(_0x506d20(0x15d))/0x7)+-parseInt(_0x506d20(0x163))/0x8+-parseInt(_0x506d20(0x15e))/0x9+parseInt(_0x506d20(0x15f))/0xa;if(_0x521957===_0x3508af)break;else _0x37001d['push'](_0x37001d['shift']());}catch(_0x4d8ca3){_0x37001d['push'](_0x37001d['shift']());}}}(a145_0x13c0,0x6fe7b));export function parseSegmentRef(_0x1df5df){const _0x13fc11=a145_0x218b,_0x32af75=_0x1df5df[_0x13fc11(0x162)]('/');if(_0x32af75===-0x1)return{'parentId':_0x1df5df};if(_0x32af75===0x0)throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x1df5df+_0x13fc11(0x165));const _0x1c2527=_0x1df5df[_0x13fc11(0x164)](0x0,_0x32af75),_0x335017=_0x1df5df['substring'](_0x32af75+0x1);if(_0x335017==='')throw new Error(_0x13fc11(0x15c)+_0x1df5df+_0x13fc11(0x167));return{'parentId':_0x1c2527,'childId':_0x335017};}function a145_0x218b(_0x27482a,_0x584940){_0x27482a=_0x27482a-0x159;const _0x13c007=a145_0x13c0();let _0x218be0=_0x13c007[_0x27482a];return _0x218be0;}function a145_0x13c0(){const _0x43bba1=['substring','.\x20Parent\x20name\x20cannot\x20be\x20empty','3138SDQxQY','.\x20Child\x20name\x20cannot\x20be\x20empty','138buajdI','14OnMqaZ','90053DwOAha','Invalid\x20segment\x20reference\x20format:\x20','139951eqBFIm','8165898ytOqky','6120230TkQXMC','13810eEUQtt','3464gUgoeW','indexOf','2559552nOBfxN'];a145_0x13c0=function(){return _0x43bba1;};return a145_0x13c0();}
1
+ function a145_0x10ef(_0x5e47df,_0x33076f){_0x5e47df=_0x5e47df-0x1ca;const _0x1a5599=a145_0x1a55();let _0x10efda=_0x1a5599[_0x5e47df];return _0x10efda;}function a145_0x1a55(){const _0x2c448c=['Invalid\x20segment\x20reference\x20format:\x20','substring','123831zhevPW','.\x20Parent\x20name\x20cannot\x20be\x20empty','1100348CVyVYE','3462605CKiVnx','6490168xmxyvF','6HRlXLZ','2593948dFvurI','151501ZaPYyM','1202572JnkoxV','indexOf','.\x20Child\x20name\x20cannot\x20be\x20empty','9VDrRMZ'];a145_0x1a55=function(){return _0x2c448c;};return a145_0x1a55();}(function(_0x2c6004,_0x33f034){const _0x43be7d=a145_0x10ef,_0xc7a639=_0x2c6004();while(!![]){try{const _0x14cc8f=parseInt(_0x43be7d(0x1d4))/0x1+-parseInt(_0x43be7d(0x1cf))/0x2+-parseInt(_0x43be7d(0x1cd))/0x3+parseInt(_0x43be7d(0x1d5))/0x4+-parseInt(_0x43be7d(0x1d0))/0x5*(parseInt(_0x43be7d(0x1d2))/0x6)+parseInt(_0x43be7d(0x1d3))/0x7+-parseInt(_0x43be7d(0x1d1))/0x8*(-parseInt(_0x43be7d(0x1ca))/0x9);if(_0x14cc8f===_0x33f034)break;else _0xc7a639['push'](_0xc7a639['shift']());}catch(_0x9c9187){_0xc7a639['push'](_0xc7a639['shift']());}}}(a145_0x1a55,0x55737));export function parseSegmentRef(_0xdacbc){const _0x24db6e=a145_0x10ef,_0x1d074b=_0xdacbc[_0x24db6e(0x1d6)]('/');if(_0x1d074b===-0x1)return{'parentId':_0xdacbc};if(_0x1d074b===0x0)throw new Error(_0x24db6e(0x1cb)+_0xdacbc+_0x24db6e(0x1ce));const _0x15014e=_0xdacbc['substring'](0x0,_0x1d074b),_0x157dd5=_0xdacbc[_0x24db6e(0x1cc)](_0x1d074b+0x1);if(_0x157dd5==='')throw new Error(_0x24db6e(0x1cb)+_0xdacbc+_0x24db6e(0x1d7));return{'parentId':_0x15014e,'childId':_0x157dd5};}
@@ -1 +1 @@
1
- (function(_0x41e421,_0x29c300){const _0x19eab1=a146_0x3831,_0x4ee915=_0x41e421();while(!![]){try{const _0xbc941c=-parseInt(_0x19eab1(0x1b0))/0x1+-parseInt(_0x19eab1(0x1b8))/0x2*(-parseInt(_0x19eab1(0x1bb))/0x3)+parseInt(_0x19eab1(0x1c6))/0x4*(-parseInt(_0x19eab1(0x198))/0x5)+-parseInt(_0x19eab1(0x1ab))/0x6+parseInt(_0x19eab1(0x1c1))/0x7+parseInt(_0x19eab1(0x197))/0x8+parseInt(_0x19eab1(0x1c3))/0x9;if(_0xbc941c===_0x29c300)break;else _0x4ee915['push'](_0x4ee915['shift']());}catch(_0x376a2f){_0x4ee915['push'](_0x4ee915['shift']());}}}(a146_0x202a,0x85b0a));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';function a146_0x202a(){const _0x36cc70=['warning','filter','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','message','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','skipSchema','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','attribute','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','push','MISSING_SEGMENT_REFERENCE','success','endsWith','INVALID_OPERATOR_TYPE','.segment','map','.operator.value','5959304sfcetr','416865hbJdoz','INVALID_ARRAY_MATCHING','issues','length','EMPTY_CONDITIONS','.filter','MISSING_CONDITIONS','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','.source','includes','.attribute','custom','params','invalid_value','Behavior\x20source\x20\x27','safeParse','error','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','EMPTY_ATTRIBUTE','2082384zUvdgP','.conditions[','name','rule.type','MISSING_TIME_UNIT','708866lyetzn','match','validationCode','MISSING_NAME','source','\x27\x20with\x20attribute\x20\x27','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','path','15172BfiPBE','level','type','201pWafrH','rule','conditions','aggregation','Behavior','Attribute\x20\x27','6340404NGDGhO','.conditions','4005477xwyqyn','MISSING_BETWEEN_BOUNDS','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','48dbIEUA','BEHAVIOR_SOURCE_MISSING_FILTER','And','INVALID_RULE_TYPE','.type','MISSING_OPERATOR_VALUE','code','document','Value'];a146_0x202a=function(){return _0x36cc70;};return a146_0x202a();}import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';function a146_0x3831(_0x5c6994,_0x594a09){_0x5c6994=_0x5c6994-0x188;const _0x202aaf=a146_0x202a();let _0x3831aa=_0x202aaf[_0x5c6994];return _0x3831aa;}export function validateSegmentDef(_0x36dd24,_0x29552b={},_0x32b1c0={}){const _0x421991=a146_0x3831;if(_0x32b1c0[_0x421991(0x18b)])return runSemanticChecks(_0x36dd24,_0x29552b);const _0x29b80c=SegmentDefSchema[_0x421991(0x1a7)](_0x36dd24);if(_0x29b80c['success'])return runSemanticChecks(_0x29b80c['data'],_0x29552b);return zodErrorsToValidationResult(_0x29b80c[_0x421991(0x1a8)],_0x29552b);}export function validateRuleDef(_0x5901f0,_0x297b61,_0x2458c2){const _0x1a914c=a146_0x3831;if(!_0x5901f0)return[];const _0x251644=RuleDefSchema[_0x1a914c(0x1a7)](_0x5901f0);if(_0x251644[_0x1a914c(0x191)])return checkRule(_0x251644['data'],_0x297b61,_0x2458c2);const _0x1cabab=flattenZodIssues(_0x251644[_0x1a914c(0x1a8)][_0x1a914c(0x19a)]);return _0x1cabab[_0x1a914c(0x195)](_0x51dc6b=>{const _0x3fc3bf=_0x1a914c,_0x17b475=formatZodPath(_0x51dc6b[_0x3fc3bf(0x1b7)]),_0x10cfb8=_0x17b475?_0x297b61+'.'+_0x17b475:_0x297b61,_0x5138ed=mapZodIssueToCode(_0x51dc6b,_0x17b475),_0x1cb3c5=getLocationFromPath(_0x2458c2[_0x3fc3bf(0x1cd)],_0x2458c2['source'],pathToArray(_0x10cfb8));return{'level':'error','path':_0x10cfb8,'code':_0x5138ed,'message':_0x51dc6b[_0x3fc3bf(0x189)],..._0x1cb3c5&&{'location':_0x1cb3c5}};});}function zodErrorsToValidationResult(_0x10f953,_0x5c6ac2){const _0x1cc521=a146_0x3831,_0x162698=flattenZodIssues(_0x10f953[_0x1cc521(0x19a)]),_0x105703=_0x162698[_0x1cc521(0x195)](_0x35343b=>{const _0x1f6657=_0x1cc521,_0x9374fa=formatZodPath(_0x35343b[_0x1f6657(0x1b7)]),_0x5294ab=mapZodIssueToCode(_0x35343b,_0x9374fa),_0x3f6868=getLocationFromPath(_0x5c6ac2[_0x1f6657(0x1cd)],_0x5c6ac2[_0x1f6657(0x1b4)],_0x35343b[_0x1f6657(0x1b7)][_0x1f6657(0x195)](_0x593868=>typeof _0x593868==='symbol'?String(_0x593868):_0x593868));return{'level':_0x1f6657(0x1a8),'path':_0x9374fa,'code':_0x5294ab,'message':_0x35343b[_0x1f6657(0x189)],..._0x3f6868&&{'location':_0x3f6868}};});return{'valid':![],'errors':_0x105703,'warnings':[]};}function mapZodIssueToCode(_0x49fdd6,_0x290c60){const _0x36f7b8=a146_0x3831,_0x32f66f=_0x49fdd6[_0x36f7b8(0x1cc)]===_0x36f7b8(0x1a3)?_0x49fdd6[_0x36f7b8(0x1a4)]:undefined;if(_0x290c60===_0x36f7b8(0x1ad))return _0x36f7b8(0x1b3);if(_0x290c60===_0x36f7b8(0x1ae)||_0x290c60['endsWith'](_0x36f7b8(0x1ca))){if(_0x49fdd6[_0x36f7b8(0x1cc)]===_0x36f7b8(0x1a5)){if(_0x290c60===_0x36f7b8(0x1ae)||_0x290c60[_0x36f7b8(0x1b1)](/\.conditions\[\d+\]\.type$/))return _0x36f7b8(0x1c9);}}if(_0x290c60[_0x36f7b8(0x192)]('.operator.type'))return _0x36f7b8(0x193);if(_0x290c60[_0x36f7b8(0x192)](_0x36f7b8(0x196)))return _0x36f7b8(0x1cb);if(_0x32f66f?.[_0x36f7b8(0x1b2)]===_0x36f7b8(0x1c4))return _0x36f7b8(0x1c4);if(_0x32f66f?.[_0x36f7b8(0x1b2)]===_0x36f7b8(0x1af))return _0x36f7b8(0x1af);if(_0x290c60[_0x36f7b8(0x192)](_0x36f7b8(0x1c2))||_0x290c60===_0x36f7b8(0x1bd))return _0x36f7b8(0x19e);if(_0x290c60[_0x36f7b8(0x1a1)]('arrayMatching'))return _0x36f7b8(0x199);if(_0x290c60['endsWith'](_0x36f7b8(0x194)))return _0x36f7b8(0x190);return'SEGMENT_SCHEMA_ERROR';}function runSemanticChecks(_0x3f9ff1,_0xdeacd4){const _0x5bb213=a146_0x3831,_0x229955=[];_0x3f9ff1[_0x5bb213(0x1bc)]&&_0x229955[_0x5bb213(0x18f)](...checkRule(_0x3f9ff1['rule'],_0x5bb213(0x1bc),_0xdeacd4));const _0x4b3ab6=_0x229955[_0x5bb213(0x1d0)](_0x3d480c=>_0x3d480c['level']==='error'),_0x1dc83d=_0x229955[_0x5bb213(0x1d0)](_0x424757=>_0x424757[_0x5bb213(0x1b9)]===_0x5bb213(0x1cf));return{'valid':_0x4b3ab6[_0x5bb213(0x19b)]===0x0,'errors':_0x4b3ab6,'warnings':_0x1dc83d};}function checkRule(_0x5a238e,_0x49e53f,_0x2a4dd1){const _0x3e42c6=a146_0x3831,_0x4b2b30=[];if(_0x5a238e[_0x3e42c6(0x1bd)][_0x3e42c6(0x19b)]===0x0)return _0x4b2b30['push']({'level':_0x3e42c6(0x1a8),'path':_0x49e53f+'.conditions','code':_0x3e42c6(0x19c),'message':_0x3e42c6(0x18e),'location':getLocationFromPath(_0x2a4dd1[_0x3e42c6(0x1cd)],_0x2a4dd1[_0x3e42c6(0x1b4)],pathToArray(_0x49e53f+_0x3e42c6(0x1c2)))}),_0x4b2b30;return _0x4b2b30[_0x3e42c6(0x18f)](...checkConditions(_0x5a238e[_0x3e42c6(0x1bd)],_0x49e53f,_0x2a4dd1)),_0x4b2b30;}function checkConditions(_0x5c20a0,_0x39805f,_0x393d6c){const _0x58beaf=a146_0x3831,_0x4dce32=[];for(let _0x434db0=0x0;_0x434db0<_0x5c20a0[_0x58beaf(0x19b)];_0x434db0++){const _0x360c52=_0x5c20a0[_0x434db0],_0x2990d6=_0x39805f+_0x58beaf(0x1ac)+_0x434db0+']';_0x4dce32['push'](...checkCondition(_0x360c52,_0x2990d6,_0x393d6c));}return _0x4dce32;}function checkCondition(_0x4a3a33,_0x54aa51,_0x550752){const _0x1b47d4=a146_0x3831,_0x300f93=[];if(_0x4a3a33[_0x1b47d4(0x1ba)]===_0x1b47d4(0x1c8)||_0x4a3a33[_0x1b47d4(0x1ba)]==='Or')return _0x4a3a33[_0x1b47d4(0x1bd)]['length']===0x0?_0x300f93[_0x1b47d4(0x18f)]({'level':_0x1b47d4(0x1a8),'path':_0x54aa51+_0x1b47d4(0x1c2),'code':_0x1b47d4(0x19c),'message':_0x4a3a33[_0x1b47d4(0x1ba)]+_0x1b47d4(0x1a9),'location':getLocationFromPath(_0x550752[_0x1b47d4(0x1cd)],_0x550752['source'],pathToArray(_0x54aa51+'.conditions'))}):(_0x300f93['push']({'level':_0x1b47d4(0x1cf),'path':_0x54aa51,'code':'NESTED_CONDITION_GROUP','message':_0x4a3a33[_0x1b47d4(0x1ba)]+'\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20'+_0x1b47d4(0x1b6)+'conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','location':getLocationFromPath(_0x550752[_0x1b47d4(0x1cd)],_0x550752['source'],pathToArray(_0x54aa51))}),_0x300f93[_0x1b47d4(0x18f)](...checkConditions(_0x4a3a33[_0x1b47d4(0x1bd)],_0x54aa51,_0x550752))),_0x300f93;if(_0x4a3a33[_0x1b47d4(0x1ba)]===_0x1b47d4(0x1ce)||_0x4a3a33['type']===_0x1b47d4(0x1bf)){const _0x31983d=_0x4a3a33,_0x50d03a=_0x31983d[_0x1b47d4(0x1b4)],_0xdb19ea=_0x31983d[_0x1b47d4(0x1be)],_0x121f0b=_0x50d03a||_0xdb19ea;(!_0x31983d[_0x1b47d4(0x18d)]||_0x31983d[_0x1b47d4(0x18d)]==='')&&(!_0x121f0b&&_0x300f93[_0x1b47d4(0x18f)]({'level':_0x1b47d4(0x1a8),'path':_0x54aa51+_0x1b47d4(0x1a2),'code':_0x1b47d4(0x1aa),'message':'Attribute\x20name\x20cannot\x20be\x20empty','location':getLocationFromPath(_0x550752['document'],_0x550752[_0x1b47d4(0x1b4)],pathToArray(_0x54aa51+'.attribute'))}));_0x31983d['filter']&&_0x300f93[_0x1b47d4(0x18f)](...checkRule(_0x31983d[_0x1b47d4(0x1d0)],_0x54aa51+_0x1b47d4(0x19d),_0x550752));if(_0x31983d[_0x1b47d4(0x1b4)]){const _0x1bad8b=_0x31983d[_0x1b47d4(0x18d)]&&_0x31983d[_0x1b47d4(0x18d)]!=='';_0x1bad8b&&!_0x31983d[_0x1b47d4(0x1d0)]&&_0x300f93['push']({'level':_0x1b47d4(0x1a8),'path':_0x54aa51+_0x1b47d4(0x1a0),'code':_0x1b47d4(0x1c7),'message':_0x1b47d4(0x1a6)+_0x31983d['source']+_0x1b47d4(0x1b5)+_0x31983d[_0x1b47d4(0x18d)]+'\x27\x20'+_0x1b47d4(0x19f)+_0x1b47d4(0x18a)+'Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','location':getLocationFromPath(_0x550752[_0x1b47d4(0x1cd)],_0x550752['source'],pathToArray(_0x54aa51+_0x1b47d4(0x1a0)))}),_0x1bad8b&&_0x31983d[_0x1b47d4(0x1d0)]&&_0x300f93[_0x1b47d4(0x18f)]({'level':_0x1b47d4(0x1cf),'path':_0x54aa51+_0x1b47d4(0x1a2),'code':_0x1b47d4(0x18c),'message':_0x1b47d4(0x1c0)+_0x31983d['attribute']+_0x1b47d4(0x1c5)+_0x1b47d4(0x188),'location':getLocationFromPath(_0x550752[_0x1b47d4(0x1cd)],_0x550752[_0x1b47d4(0x1b4)],pathToArray(_0x54aa51+'.attribute'))});}}return _0x300f93;}
1
+ (function(_0x1232df,_0x1eba9e){const _0x400ae1=a146_0x3bd3,_0x18ffec=_0x1232df();while(!![]){try{const _0x393435=-parseInt(_0x400ae1(0xb8))/0x1+parseInt(_0x400ae1(0xc5))/0x2*(parseInt(_0x400ae1(0xc3))/0x3)+-parseInt(_0x400ae1(0xac))/0x4+parseInt(_0x400ae1(0xc1))/0x5+parseInt(_0x400ae1(0xce))/0x6+-parseInt(_0x400ae1(0xdb))/0x7*(-parseInt(_0x400ae1(0xb2))/0x8)+-parseInt(_0x400ae1(0xd1))/0x9;if(_0x393435===_0x1eba9e)break;else _0x18ffec['push'](_0x18ffec['shift']());}catch(_0xb09402){_0x18ffec['push'](_0x18ffec['shift']());}}}(a146_0x42e4,0x3398f));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x241711,_0xbbfdc6={},_0x4e9fb7={}){const _0x4621d1=a146_0x3bd3;if(_0x4e9fb7[_0x4621d1(0xc2)])return runSemanticChecks(_0x241711,_0xbbfdc6);const _0x513277=SegmentDefSchema[_0x4621d1(0xbd)](_0x241711);if(_0x513277[_0x4621d1(0xc9)])return runSemanticChecks(_0x513277['data'],_0xbbfdc6);return zodErrorsToValidationResult(_0x513277['error'],_0xbbfdc6);}export function validateRuleDef(_0x50da61,_0x3fb173,_0x254aa5){const _0x549ba1=a146_0x3bd3;if(!_0x50da61)return[];const _0x34db4b=RuleDefSchema[_0x549ba1(0xbd)](_0x50da61);if(_0x34db4b[_0x549ba1(0xc9)])return checkRule(_0x34db4b['data'],_0x3fb173,_0x254aa5);const _0x4aed6d=flattenZodIssues(_0x34db4b['error'][_0x549ba1(0xe8)]);return _0x4aed6d[_0x549ba1(0xe9)](_0x37ac28=>{const _0x2bb0c4=_0x549ba1,_0x3e93a9=formatZodPath(_0x37ac28[_0x2bb0c4(0xb0)]),_0x5d60e8=_0x3e93a9?_0x3fb173+'.'+_0x3e93a9:_0x3fb173,_0x417954=mapZodIssueToCode(_0x37ac28,_0x3e93a9),_0x283019=getLocationFromPath(_0x254aa5['document'],_0x254aa5[_0x2bb0c4(0xb4)],pathToArray(_0x5d60e8));return{'level':'error','path':_0x5d60e8,'code':_0x417954,'message':_0x37ac28[_0x2bb0c4(0xe5)],..._0x283019&&{'location':_0x283019}};});}function zodErrorsToValidationResult(_0x2c9c35,_0x2af881){const _0x5a238b=a146_0x3bd3,_0x24fd40=flattenZodIssues(_0x2c9c35[_0x5a238b(0xe8)]),_0x387b58=_0x24fd40[_0x5a238b(0xe9)](_0x334441=>{const _0x1e1a79=_0x5a238b,_0x593fa3=formatZodPath(_0x334441[_0x1e1a79(0xb0)]),_0x85b299=mapZodIssueToCode(_0x334441,_0x593fa3),_0x4a4009=getLocationFromPath(_0x2af881[_0x1e1a79(0xda)],_0x2af881[_0x1e1a79(0xb4)],_0x334441[_0x1e1a79(0xb0)][_0x1e1a79(0xe9)](_0x44ebac=>typeof _0x44ebac===_0x1e1a79(0xba)?String(_0x44ebac):_0x44ebac));return{'level':_0x1e1a79(0xbb),'path':_0x593fa3,'code':_0x85b299,'message':_0x334441[_0x1e1a79(0xe5)],..._0x4a4009&&{'location':_0x4a4009}};});return{'valid':![],'errors':_0x387b58,'warnings':[]};}function mapZodIssueToCode(_0x52c6ab,_0x210028){const _0x46017d=a146_0x3bd3,_0x362092=_0x52c6ab[_0x46017d(0xb3)]===_0x46017d(0xcf)?_0x52c6ab[_0x46017d(0xb6)]:undefined;if(_0x210028===_0x46017d(0xe4))return _0x46017d(0xd7);if(_0x210028===_0x46017d(0xc4)||_0x210028['endsWith']('.type')){if(_0x52c6ab[_0x46017d(0xb3)]===_0x46017d(0xae)){if(_0x210028===_0x46017d(0xc4)||_0x210028[_0x46017d(0xcc)](/\.conditions\[\d+\]\.type$/))return _0x46017d(0xc8);}}if(_0x210028['endsWith']('.operator.type'))return'INVALID_OPERATOR_TYPE';if(_0x210028[_0x46017d(0xc6)](_0x46017d(0xad)))return'MISSING_OPERATOR_VALUE';if(_0x362092?.['validationCode']===_0x46017d(0xe3))return _0x46017d(0xe3);if(_0x362092?.[_0x46017d(0xd8)]===_0x46017d(0xd6))return _0x46017d(0xd6);if(_0x210028[_0x46017d(0xc6)]('.conditions')||_0x210028===_0x46017d(0xc0))return'MISSING_CONDITIONS';if(_0x210028[_0x46017d(0xd9)](_0x46017d(0xcd)))return'INVALID_ARRAY_MATCHING';if(_0x210028[_0x46017d(0xc6)](_0x46017d(0xab)))return _0x46017d(0xca);return _0x46017d(0xb7);}function a146_0x3bd3(_0x2b3127,_0x3b631e){_0x2b3127=_0x2b3127-0xa8;const _0x42e451=a146_0x42e4();let _0x3bd39f=_0x42e451[_0x2b3127];return _0x3bd39f;}function runSemanticChecks(_0x361c30,_0x480ae0){const _0x550298=a146_0x3bd3,_0x434386=[];_0x361c30[_0x550298(0xcb)]&&_0x434386[_0x550298(0xdd)](...checkRule(_0x361c30['rule'],_0x550298(0xcb),_0x480ae0));const _0x4138c8=_0x434386['filter'](_0xad1251=>_0xad1251['level']==='error'),_0x77ec7d=_0x434386[_0x550298(0xc7)](_0x5a28ae=>_0x5a28ae['level']===_0x550298(0xd5));return{'valid':_0x4138c8[_0x550298(0xd4)]===0x0,'errors':_0x4138c8,'warnings':_0x77ec7d};}function checkRule(_0x556655,_0xa5b3f1,_0x4640c1){const _0x24f10f=a146_0x3bd3,_0x548a01=[];if(_0x556655['conditions']['length']===0x0)return _0x548a01[_0x24f10f(0xdd)]({'level':_0x24f10f(0xbb),'path':_0xa5b3f1+_0x24f10f(0xde),'code':_0x24f10f(0xd3),'message':_0x24f10f(0xd2),'location':getLocationFromPath(_0x4640c1[_0x24f10f(0xda)],_0x4640c1[_0x24f10f(0xb4)],pathToArray(_0xa5b3f1+'.conditions'))}),_0x548a01;return _0x548a01['push'](...checkConditions(_0x556655['conditions'],_0xa5b3f1,_0x4640c1)),_0x548a01;}function checkConditions(_0x264418,_0x507705,_0x502616){const _0x3eb3a6=[];for(let _0x43e1d2=0x0;_0x43e1d2<_0x264418['length'];_0x43e1d2++){const _0x16780b=_0x264418[_0x43e1d2],_0x4849bb=_0x507705+'.conditions['+_0x43e1d2+']';_0x3eb3a6['push'](...checkCondition(_0x16780b,_0x4849bb,_0x502616));}return _0x3eb3a6;}function checkCondition(_0x32aae6,_0x584722,_0x5c41c0){const _0x13601f=a146_0x3bd3,_0x5d245a=[];if(_0x32aae6[_0x13601f(0xe7)]===_0x13601f(0xe6)||_0x32aae6[_0x13601f(0xe7)]==='Or')return _0x32aae6['conditions'][_0x13601f(0xd4)]===0x0?_0x5d245a[_0x13601f(0xdd)]({'level':_0x13601f(0xbb),'path':_0x584722+_0x13601f(0xde),'code':_0x13601f(0xd3),'message':_0x32aae6[_0x13601f(0xe7)]+_0x13601f(0xbc),'location':getLocationFromPath(_0x5c41c0['document'],_0x5c41c0[_0x13601f(0xb4)],pathToArray(_0x584722+'.conditions'))}):(_0x5d245a[_0x13601f(0xdd)]({'level':_0x13601f(0xd5),'path':_0x584722,'code':_0x13601f(0xb1),'message':_0x32aae6[_0x13601f(0xe7)]+_0x13601f(0xdf)+_0x13601f(0xea)+_0x13601f(0xbe),'location':getLocationFromPath(_0x5c41c0['document'],_0x5c41c0['source'],pathToArray(_0x584722))}),_0x5d245a[_0x13601f(0xdd)](...checkConditions(_0x32aae6[_0x13601f(0xc0)],_0x584722,_0x5c41c0))),_0x5d245a;if(_0x32aae6['type']==='Value'||_0x32aae6[_0x13601f(0xe7)]===_0x13601f(0xe1)){const _0x4e7169=_0x32aae6,_0x404548=_0x4e7169[_0x13601f(0xb4)],_0x1f6656=_0x4e7169[_0x13601f(0xe0)],_0x14c7a2=_0x404548||_0x1f6656;(!_0x4e7169[_0x13601f(0xeb)]||_0x4e7169['attribute']==='')&&(!_0x14c7a2&&_0x5d245a[_0x13601f(0xdd)]({'level':'error','path':_0x584722+_0x13601f(0xaf),'code':_0x13601f(0xdc),'message':_0x13601f(0xe2),'location':getLocationFromPath(_0x5c41c0[_0x13601f(0xda)],_0x5c41c0[_0x13601f(0xb4)],pathToArray(_0x584722+_0x13601f(0xaf)))}));_0x4e7169['filter']&&_0x5d245a[_0x13601f(0xdd)](...checkRule(_0x4e7169['filter'],_0x584722+_0x13601f(0xaa),_0x5c41c0));if(_0x4e7169[_0x13601f(0xb4)]){const _0x558876=_0x4e7169[_0x13601f(0xeb)]&&_0x4e7169['attribute']!=='';_0x558876&&!_0x4e7169['filter']&&_0x5d245a[_0x13601f(0xdd)]({'level':_0x13601f(0xbb),'path':_0x584722+_0x13601f(0xb5),'code':'BEHAVIOR_SOURCE_MISSING_FILTER','message':_0x13601f(0xd0)+_0x4e7169[_0x13601f(0xb4)]+_0x13601f(0xbf)+_0x4e7169['attribute']+'\x27\x20'+_0x13601f(0xa8)+'the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20'+'Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','location':getLocationFromPath(_0x5c41c0[_0x13601f(0xda)],_0x5c41c0[_0x13601f(0xb4)],pathToArray(_0x584722+_0x13601f(0xb5)))}),_0x558876&&_0x4e7169[_0x13601f(0xc7)]&&_0x5d245a[_0x13601f(0xdd)]({'level':_0x13601f(0xd5),'path':_0x584722+_0x13601f(0xaf),'code':'BEHAVIOR_SOURCE_WITH_ATTRIBUTE','message':'Attribute\x20\x27'+_0x4e7169[_0x13601f(0xeb)]+_0x13601f(0xa9)+_0x13601f(0xb9),'location':getLocationFromPath(_0x5c41c0[_0x13601f(0xda)],_0x5c41c0[_0x13601f(0xb4)],pathToArray(_0x584722+'.attribute'))});}}return _0x5d245a;}function a146_0x42e4(){const _0x5d45e0=['4938eAxSEb','rule.type','72xlYNsR','endsWith','filter','INVALID_RULE_TYPE','success','MISSING_SEGMENT_REFERENCE','rule','match','arrayMatching','1489278TXzfhQ','custom','Behavior\x20source\x20\x27','72945XNjDSO','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','EMPTY_CONDITIONS','length','warning','MISSING_TIME_UNIT','MISSING_NAME','validationCode','includes','document','455IlPdzw','EMPTY_ATTRIBUTE','push','.conditions','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','aggregation','Behavior','Attribute\x20name\x20cannot\x20be\x20empty','MISSING_BETWEEN_BOUNDS','name','message','And','type','issues','map','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','attribute','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','.filter','.segment','875052FyKTjT','.operator.value','invalid_value','.attribute','path','NESTED_CONDITION_GROUP','34160QRgMMT','code','source','.source','params','SEGMENT_SCHEMA_ERROR','295365jpzHAE','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','symbol','error','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','safeParse','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','\x27\x20with\x20attribute\x20\x27','conditions','742785iXEkuA','skipSchema'];a146_0x42e4=function(){return _0x5d45e0;};return a146_0x42e4();}