@treasuredata/tdx 2026.3.8 → 2026.3.9

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 (208) 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.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/auth-login-command.js +1 -1
  11. package/dist/commands/chat-command.js +1 -1
  12. package/dist/commands/claude-command.js +1 -1
  13. package/dist/commands/claude-statusline-command.js +1 -1
  14. package/dist/commands/claude-usage-command.js +1 -1
  15. package/dist/commands/command.js +1 -1
  16. package/dist/commands/connection-command.js +1 -1
  17. package/dist/commands/databases.js +1 -1
  18. package/dist/commands/delivery-command.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-campaign-pull-command.js +1 -1
  21. package/dist/commands/engage-campaign-push-command.js +1 -1
  22. package/dist/commands/engage-campaign-validate-command.js +1 -1
  23. package/dist/commands/engage-command.js +1 -1
  24. package/dist/commands/engage-template-pull-command.js +1 -1
  25. package/dist/commands/engage-template-push-command.js +1 -1
  26. package/dist/commands/engage-template-validate-command.js +1 -1
  27. package/dist/commands/job-command.js +1 -1
  28. package/dist/commands/journey-command.js +1 -1
  29. package/dist/commands/journey-validate-command.js +1 -1
  30. package/dist/commands/llm-command.js +1 -1
  31. package/dist/commands/mcp-command.js +1 -1
  32. package/dist/commands/parent-segment-command.js +1 -1
  33. package/dist/commands/profile-command.js +1 -1
  34. package/dist/commands/profiles-command.js +1 -1
  35. package/dist/commands/query-command.js +1 -1
  36. package/dist/commands/schedule-command.js +1 -1
  37. package/dist/commands/segment-command.js +1 -1
  38. package/dist/commands/segment-create-command.js +1 -1
  39. package/dist/commands/segment-fields-command.js +1 -1
  40. package/dist/commands/segment-pull-command.js +1 -1
  41. package/dist/commands/segment-push-command.js +1 -1
  42. package/dist/commands/segment-update-command.js +1 -1
  43. package/dist/commands/segment-use-command.js +1 -1
  44. package/dist/commands/segment-validate-command.js +1 -1
  45. package/dist/commands/segments.js +1 -1
  46. package/dist/commands/show.js +1 -1
  47. package/dist/commands/status-command.js +1 -1
  48. package/dist/commands/tables.js +1 -1
  49. package/dist/commands/unset-command.js +1 -1
  50. package/dist/commands/upgrade-command.js +1 -1
  51. package/dist/commands/use-command.js +1 -1
  52. package/dist/commands/user-command.js +1 -1
  53. package/dist/commands/workflow-command.js +1 -1
  54. package/dist/core/auth.js +1 -1
  55. package/dist/core/command-output.js +1 -1
  56. package/dist/core/config.js +1 -1
  57. package/dist/core/connection-cache.js +1 -1
  58. package/dist/core/constants.js +1 -1
  59. package/dist/core/credential-cache.js +1 -1
  60. package/dist/core/global-context.js +1 -1
  61. package/dist/core/keychain.js +1 -1
  62. package/dist/core/oauth-keychain.js +1 -1
  63. package/dist/core/oauth.d.ts +2 -2
  64. package/dist/core/oauth.js +1 -1
  65. package/dist/core/profile.js +1 -1
  66. package/dist/core/profile.js.map +1 -1
  67. package/dist/core/project-config.js +1 -1
  68. package/dist/core/session.js +1 -1
  69. package/dist/core/user-cache.js +1 -1
  70. package/dist/core/version.js +1 -1
  71. package/dist/index.js +1 -1
  72. package/dist/mcp/server.js +1 -1
  73. package/dist/mcp/tools/index.js +1 -1
  74. package/dist/mcp/tools/tdx-run.js +1 -1
  75. package/dist/mcp/tools/tdx-search.js +1 -1
  76. package/dist/mcp/utils.js +1 -1
  77. package/dist/proxy/claude-usage-tracker.js +1 -1
  78. package/dist/proxy/passthrough-server.js +1 -1
  79. package/dist/proxy/sse-usage-parser.js +1 -1
  80. package/dist/sdk/agent/agent-config.js +1 -1
  81. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  82. package/dist/sdk/agent/agent-yaml.js +1 -1
  83. package/dist/sdk/agent/test/evaluator.js +1 -1
  84. package/dist/sdk/agent/test/executor.js +1 -1
  85. package/dist/sdk/agent/test/index.js +1 -1
  86. package/dist/sdk/agent/test/output.js +1 -1
  87. package/dist/sdk/agent/test/parser.js +1 -1
  88. package/dist/sdk/agent/tool-target-registry.js +1 -1
  89. package/dist/sdk/api.js +1 -1
  90. package/dist/sdk/client/cdp-api-client.js +1 -1
  91. package/dist/sdk/client/delivery-api-client.js +1 -1
  92. package/dist/sdk/client/endpoints.js +1 -1
  93. package/dist/sdk/client/endpoints.js.map +1 -1
  94. package/dist/sdk/client/engage-api-client.js +1 -1
  95. package/dist/sdk/client/http-client.js +1 -1
  96. package/dist/sdk/client/llm-api-client.js +1 -1
  97. package/dist/sdk/client/oauth-refresh.d.ts +1 -1
  98. package/dist/sdk/client/oauth-refresh.js +1 -1
  99. package/dist/sdk/client/rate-limiter.js +1 -1
  100. package/dist/sdk/client/td-api-client.js +1 -1
  101. package/dist/sdk/client/trino-api-client.js +1 -1
  102. package/dist/sdk/client/workflow-client.js +1 -1
  103. package/dist/sdk/connection-validator.js +1 -1
  104. package/dist/sdk/connection.js +1 -1
  105. package/dist/sdk/delivery.js +1 -1
  106. package/dist/sdk/engage/campaign-pull.js +1 -1
  107. package/dist/sdk/engage/campaign-push.js +1 -1
  108. package/dist/sdk/engage/campaign-validator.js +1 -1
  109. package/dist/sdk/engage/campaign-yaml.js +1 -1
  110. package/dist/sdk/engage/template-pull.js +1 -1
  111. package/dist/sdk/engage/template-push.js +1 -1
  112. package/dist/sdk/engage/template-validator.js +1 -1
  113. package/dist/sdk/engage/template-yaml.js +1 -1
  114. package/dist/sdk/engage/types/campaign-def.js +1 -1
  115. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  116. package/dist/sdk/engage/types/template-schema.js +1 -1
  117. package/dist/sdk/engage.js +1 -1
  118. package/dist/sdk/errors.js +1 -1
  119. package/dist/sdk/index.js +1 -1
  120. package/dist/sdk/io/index.js +1 -1
  121. package/dist/sdk/io/node-filesystem.js +1 -1
  122. package/dist/sdk/job.js +1 -1
  123. package/dist/sdk/journey.js +1 -1
  124. package/dist/sdk/llm/chat-cache.js +1 -1
  125. package/dist/sdk/llm/index.js +1 -1
  126. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  127. package/dist/sdk/llm/model-factors.js +1 -1
  128. package/dist/sdk/personalization.js +1 -1
  129. package/dist/sdk/query/index.js +1 -1
  130. package/dist/sdk/query/sql-parser.js +1 -1
  131. package/dist/sdk/realtime.js +1 -1
  132. package/dist/sdk/schedule.js +1 -1
  133. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  134. package/dist/sdk/segment/fields-display.js +1 -1
  135. package/dist/sdk/segment/file-discovery.js +1 -1
  136. package/dist/sdk/segment/journey-utils.d.ts.map +1 -1
  137. package/dist/sdk/segment/journey-utils.js +1 -1
  138. package/dist/sdk/segment/journey-utils.js.map +1 -1
  139. package/dist/sdk/segment/journey-validator.js +1 -1
  140. package/dist/sdk/segment/journey-yaml.js +1 -1
  141. package/dist/sdk/segment/journey-yaml.js.map +1 -1
  142. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  143. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  144. package/dist/sdk/segment/pull-workflow.js +1 -1
  145. package/dist/sdk/segment/push-recovery.js +1 -1
  146. package/dist/sdk/segment/push-workflow.js +1 -1
  147. package/dist/sdk/segment/resolution-context.js +1 -1
  148. package/dist/sdk/segment/segment-path-parser.js +1 -1
  149. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  150. package/dist/sdk/segment/segment-validator.js +1 -1
  151. package/dist/sdk/segment/target-resolution.js +1 -1
  152. package/dist/sdk/segment/tdx-config.js +1 -1
  153. package/dist/sdk/segment/types/activation-schema.js +1 -1
  154. package/dist/sdk/segment/types/journey-def.js +1 -1
  155. package/dist/sdk/segment/types/journey-schema.js +1 -1
  156. package/dist/sdk/segment/types/segment-def.js +1 -1
  157. package/dist/sdk/segment/types/segment-schema.js +1 -1
  158. package/dist/sdk/segment/validate-files.js +1 -1
  159. package/dist/sdk/segment/yaml-validator.js +1 -1
  160. package/dist/sdk/segment.js +1 -1
  161. package/dist/sdk/types/index.js +1 -1
  162. package/dist/sdk/types/progress.js +1 -1
  163. package/dist/sdk/user.js +1 -1
  164. package/dist/sdk/util/format-detector.js +1 -1
  165. package/dist/sdk/util/formatters.js +1 -1
  166. package/dist/sdk/util/index.js +1 -1
  167. package/dist/sdk/util/paginate.js +1 -1
  168. package/dist/sdk/util/tree-formatter.js +1 -1
  169. package/dist/sdk/workflow/archive-validation.js +1 -1
  170. package/dist/sdk/workflow/clone-workflow.js +1 -1
  171. package/dist/sdk/workflow/index.js +1 -1
  172. package/dist/sdk/workflow/pull-workflow.js +1 -1
  173. package/dist/sdk/workflow/push-workflow.js +1 -1
  174. package/dist/sdk/workflow/tdx-config.js +1 -1
  175. package/dist/sdk/workflow/workflow-utils.js +1 -1
  176. package/dist/test-utils/command-runner.js +1 -1
  177. package/dist/test-utils/factories.js +1 -1
  178. package/dist/test-utils/fixtures.js +1 -1
  179. package/dist/test-utils/http-mock.js +1 -1
  180. package/dist/test-utils/index.js +1 -1
  181. package/dist/utils/async.js +1 -1
  182. package/dist/utils/colors.js +1 -1
  183. package/dist/utils/diff.js +1 -1
  184. package/dist/utils/file-permissions.js +1 -1
  185. package/dist/utils/file-reader.js +1 -1
  186. package/dist/utils/github-releases.js +1 -1
  187. package/dist/utils/global-cache.js +1 -1
  188. package/dist/utils/json-loader.js +1 -1
  189. package/dist/utils/local-cache.js +1 -1
  190. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  191. package/dist/utils/logger/formatters/index.js +1 -1
  192. package/dist/utils/logger/handlers/console-handler.js +1 -1
  193. package/dist/utils/logger/handlers/file-handler.js +1 -1
  194. package/dist/utils/logger/handlers/index.js +1 -1
  195. package/dist/utils/logger/handlers/null-handler.js +1 -1
  196. package/dist/utils/logger/index.js +1 -1
  197. package/dist/utils/logger/logger.js +1 -1
  198. package/dist/utils/logger/types.js +1 -1
  199. package/dist/utils/option-validation.js +1 -1
  200. package/dist/utils/process.js +1 -1
  201. package/dist/utils/prompt.js +1 -1
  202. package/dist/utils/spinner.js +1 -1
  203. package/dist/utils/sse-parser.js +1 -1
  204. package/dist/utils/string-utils.js +1 -1
  205. package/dist/utils/table-ref-parser.js +1 -1
  206. package/dist/utils/tdx-logger.js +1 -1
  207. package/dist/utils/version-check.js +1 -1
  208. package/package.json +1 -1
@@ -1 +1 @@
1
- const a140_0x2ff839=a140_0x18bd;(function(_0x360ae2,_0xcf3f60){const _0x54ce01=a140_0x18bd,_0x514e43=_0x360ae2();while(!![]){try{const _0x4007a7=-parseInt(_0x54ce01(0x296))/0x1*(-parseInt(_0x54ce01(0x275))/0x2)+parseInt(_0x54ce01(0x2ba))/0x3+-parseInt(_0x54ce01(0x26a))/0x4*(parseInt(_0x54ce01(0x208))/0x5)+-parseInt(_0x54ce01(0x2d3))/0x6+-parseInt(_0x54ce01(0x253))/0x7+parseInt(_0x54ce01(0x234))/0x8*(parseInt(_0x54ce01(0x2b6))/0x9)+parseInt(_0x54ce01(0x251))/0xa;if(_0x4007a7===_0xcf3f60)break;else _0x514e43['push'](_0x514e43['shift']());}catch(_0x534fcf){_0x514e43['push'](_0x514e43['shift']());}}}(a140_0x33e7,0x492c3));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a140_0x2ff839(0x2d2));export const PENDING_SEGMENT_PREFIX=a140_0x2ff839(0x1ef);export const PENDING_ACTIVATION_PREFIX=a140_0x2ff839(0x22e);export function createPendingSegmentId(_0x43e1e5){return''+PENDING_SEGMENT_PREFIX+_0x43e1e5+'__';}export function isPendingSegmentId(_0x1f09da){const _0x50e166=a140_0x2ff839;return _0x1f09da[_0x50e166(0x27e)](PENDING_SEGMENT_PREFIX)&&!_0x1f09da[_0x50e166(0x27e)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x2a7476){return _0x2a7476['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x4aa51b){return''+PENDING_ACTIVATION_PREFIX+_0x4aa51b+'__';}export function isPendingActivationId(_0x731b9c){return _0x731b9c['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x8a4564){const _0x406810=a140_0x2ff839;return _0x8a4564[_0x406810(0x233)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x508eb4,_0x36f01a){const _0xb87d82=a140_0x2ff839,_0x4da48f=_0x508eb4+'::'+(_0x36f01a[_0xb87d82(0x256)]()||_0xb87d82(0x1f7)),_0xa2472e=createHash(_0xb87d82(0x216))[_0xb87d82(0x210)](_0x4da48f)[_0xb87d82(0x27d)](_0xb87d82(0x26c))[_0xb87d82(0x2d4)](0x0,0xc);return'journey_entry_criteria_'+_0xa2472e;}export function ensureJourneyDefaults(_0x253695){const _0x599ee4=a140_0x2ff839;!_0x253695[_0x599ee4(0x26d)]&&(_0x253695[_0x599ee4(0x26d)]=''),!_0x253695[_0x599ee4(0x1f3)]&&(_0x253695[_0x599ee4(0x1f3)]=_0x599ee4(0x23a));}export function injectExistingStageIds(_0x27db96,_0x33294f){const _0x2f2448=a140_0x2ff839,_0xcbebe9=new Map(_0x33294f['map'](_0x4847ca=>[_0x4847ca[_0x2f2448(0x258)],_0x4847ca['id']]));for(const _0x603da9 of _0x27db96){if(!_0x603da9['id']){const _0xed0e27=_0xcbebe9['get'](_0x603da9[_0x2f2448(0x258)]);_0xed0e27&&(_0x603da9['id']=_0xed0e27);}}}export function resolveTDFolderPath(_0x48c90f,_0x2d7aad,_0x4e627b){if(!_0x2d7aad)return _0x48c90f;if(_0x48c90f===_0x4e627b||_0x48c90f['startsWith'](_0x4e627b+'/'))return _0x48c90f;return _0x48c90f?_0x4e627b+'/'+_0x48c90f:_0x4e627b;}export function addFoldersToCreate(_0x31f4d6,_0x250c70,_0x30d180){const _0x3accfa=a140_0x2ff839;if(!_0x31f4d6)return;if(_0x250c70[_0x3accfa(0x200)](_0x31f4d6))return;const _0x2ba48b=_0x31f4d6['split']('/');let _0x49e595='';for(const _0x1f522d of _0x2ba48b){_0x49e595=_0x49e595?_0x49e595+'/'+_0x1f522d:_0x1f522d,!_0x250c70['has'](_0x49e595)&&_0x30d180[_0x3accfa(0x237)](_0x49e595);}}export function sortFoldersByDepth(_0x30a59e){const _0x48c1e4=a140_0x2ff839;return[..._0x30a59e][_0x48c1e4(0x2c7)]((_0xe67066,_0x549740)=>{const _0x6a8787=_0x48c1e4,_0xa878b1=(_0xe67066['match'](/\//g)||[])[_0x6a8787(0x2cc)],_0x4c4fe8=(_0x549740['match'](/\//g)||[])['length'];return _0xa878b1-_0x4c4fe8;});}import*as a140_0x2af49b from'yaml';import{readFileSync}from'fs';import a140_0x20a41d from'path';import{isJourneyDef,parseYamlString as a140_0x38903d,toYamlString as a140_0x20196f,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(_0x2d70de){const _0x1baf6a=a140_0x2ff839;if(Array[_0x1baf6a(0x280)](_0x2d70de))return'['+_0x2d70de[_0x1baf6a(0x295)](_0x35fe01=>stableStringify(_0x35fe01))[_0x1baf6a(0x2f0)](',')+']';if(_0x2d70de&&typeof _0x2d70de===_0x1baf6a(0x23f)){const _0x1554c0=_0x2d70de,_0x569572=Object[_0x1baf6a(0x20a)](_0x1554c0)[_0x1baf6a(0x2c7)](),_0x3c3997=_0x569572[_0x1baf6a(0x295)](_0x2fb686=>'\x22'+_0x2fb686+'\x22:'+stableStringify(_0x1554c0[_0x2fb686]));return'{'+_0x3c3997[_0x1baf6a(0x2f0)](',')+'}';}const _0x26a653=JSON['stringify'](_0x2d70de);return _0x26a653===undefined?'null':_0x26a653;}function activationSignature(_0x2082ed){const _0x48b90a=a140_0x2ff839,_0x172fa4={'connection':_0x2082ed['connection'],..._0x2082ed[_0x48b90a(0x277)]!==undefined&&{'all_columns':_0x2082ed[_0x48b90a(0x277)]},..._0x2082ed[_0x48b90a(0x276)]!==undefined&&{'columns':_0x2082ed[_0x48b90a(0x276)]},..._0x2082ed[_0x48b90a(0x1fd)]!==undefined&&{'behavior':_0x2082ed[_0x48b90a(0x1fd)]},..._0x2082ed[_0x48b90a(0x289)]!==undefined&&{'schedule':_0x2082ed[_0x48b90a(0x289)]},..._0x2082ed['notification']!==undefined&&{'notification':_0x2082ed['notification']},..._0x2082ed['connector_config']!==undefined&&{'connector_config':_0x2082ed['connector_config']},..._0x2082ed[_0x48b90a(0x231)]!==undefined&&{'activation_template_id':_0x2082ed[_0x48b90a(0x231)]}};return stableStringify(_0x172fa4);}async function fetchSegment(_0x36ce55,_0x4d427f,_0x232f58,_0x48ca09){const _0x22ee37=a140_0x2ff839,_0x2a75f5=_0x48ca09?.['find'](_0x352f6b=>_0x352f6b['id']===_0x232f58);if(_0x2a75f5)return _0x2a75f5;try{return await _0x36ce55['segment'][_0x22ee37(0x20d)](_0x4d427f,_0x232f58);}catch(_0x37809d){logger[_0x22ee37(0x262)](_0x22ee37(0x224)+_0x232f58+',\x20falling\x20back\x20to\x20getSegmentEntity:\x20'+_0x37809d);try{return await _0x36ce55['segment']['getSegmentEntity'](_0x232f58);}catch(_0x17f293){return logger[_0x22ee37(0x262)](_0x22ee37(0x2ee)+_0x232f58+':\x20'+_0x17f293),null;}}}function recoverSegmentIdsFromPushRecovery(_0x2a89a6,_0x34c4bb,_0x5223cc){const _0x3df85d=a140_0x2ff839,_0x5cbe49=readPushRecovery(_0x2a89a6[_0x3df85d(0x2d1)]);if(_0x5cbe49?.[_0x3df85d(0x248)]===_0x2a89a6[_0x3df85d(0x2a6)][_0x3df85d(0x258)])for(const [_0x22d013,_0xf0eea0]of Object[_0x3df85d(0x2ea)](_0x5cbe49[_0x3df85d(0x2e1)])){const _0x3faaee=generateDeterministicJourneySegmentName(_0x2a89a6[_0x3df85d(0x2a6)][_0x3df85d(0x258)],_0x22d013);_0xf0eea0[_0x3df85d(0x21f)]===_0x3faaee&&(_0x34c4bb['set'](_0x22d013,_0xf0eea0[_0x3df85d(0x2a2)]),_0x5223cc[_0x3df85d(0x282)](_0x22d013,_0xf0eea0['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x573e24,_0x14f28c,_0x18fa53,_0x54f463){const _0x59ae55=a140_0x2ff839;let _0x25a159;try{_0x25a159=await _0x573e24['segment'][_0x59ae55(0x227)]({'name':_0x18fa53['uniqueSegmentName'],'description':_0x18fa53[_0x59ae55(0x26d)],'journeyId':_0x18fa53['journeyId'],'rule':_0x54f463(_0x18fa53[_0x59ae55(0x27a)],!![]),'countPopulation':!![],'parentFolderId':_0x18fa53['folderId'],'audienceId':_0x18fa53[_0x59ae55(0x22c)]});}catch(_0x44f635){const _0x420e02=_0x44f635 instanceof Error&&_0x44f635[_0x59ae55(0x2c1)]['includes'](_0x59ae55(0x263));if(_0x420e02){const _0x281b1f=readPushRecovery(_0x14f28c[_0x59ae55(0x2d1)]),_0x62d385=_0x281b1f?.[_0x59ae55(0x248)]===_0x14f28c[_0x59ae55(0x2a6)][_0x59ae55(0x258)]?_0x281b1f[_0x59ae55(0x2e1)][_0x18fa53[_0x59ae55(0x290)]]:undefined;if(_0x62d385?.[_0x59ae55(0x21f)]===_0x18fa53[_0x59ae55(0x2e3)])await _0x573e24[_0x59ae55(0x1f7)][_0x59ae55(0x255)](_0x18fa53[_0x59ae55(0x22c)],_0x62d385[_0x59ae55(0x2a2)],{'description':_0x18fa53[_0x59ae55(0x26d)],'rule':_0x54f463(_0x18fa53[_0x59ae55(0x27a)],!![]),'countPopulation':!![]}),_0x25a159=_0x62d385[_0x59ae55(0x2a2)];else throw new SDKError(ErrorCode[_0x59ae55(0x287)],'Embedded\x20segment\x20\x27'+_0x18fa53['localName']+_0x59ae55(0x254)+(_0x59ae55(0x28f)+_0x14f28c[_0x59ae55(0x2d1)]['replace'](/([^/]+)$/,_0x59ae55(0x2bd))+')\x20')+_0x59ae55(0x1fe),_0x44f635);}else throw _0x44f635;}return saveSegmentToPushRecovery(_0x14f28c[_0x59ae55(0x2d1)],_0x14f28c[_0x59ae55(0x2a6)][_0x59ae55(0x258)],_0x18fa53['localName'],{'segmentId':_0x25a159,'uniqueServerName':_0x18fa53[_0x59ae55(0x2e3)],'createdAt':new Date()['toISOString']()}),_0x25a159;}export async function prepareSegmentFiles(_0x2c6a5b,_0x1a9c4c,_0x391ada,_0x7ba9cf,_0x62329e){const _0x1c306e=a140_0x2ff839,{activationDefToCreateRequest:_0x187937}=await import(_0x1c306e(0x2b4)),_0x5a219d=[],_0x3b5a63=new Set();for(const {yamlConfig:_0x1a39a2,folderPath:_0x2c28df,sourcePath:_0x5bfb20}of _0x2c6a5b){const _0xbda484=resolveTDFolderPath(_0x2c28df,_0x7ba9cf,_0x62329e),_0x3e5851=_0xbda484+':'+_0x1a39a2[_0x1c306e(0x258)],_0x23153a=_0x1a9c4c[_0x1c306e(0x204)]['get'](_0x3e5851),_0x5c1bff=_0x23153a?_0x1a9c4c[_0x1c306e(0x20b)][_0x1c306e(0x2c3)](_0x23153a['id'])||[]:[];addFoldersToCreate(_0xbda484,_0x1a9c4c[_0x1c306e(0x2ed)],_0x3b5a63);const _0x4a7e44=calculateActivationActions(_0x1a39a2['activations']||[],_0x5c1bff,_0x1a9c4c[_0x1c306e(0x225)],_0x1a9c4c['connectionIdToNameMap']);for(const _0x3b0647 of _0x4a7e44){(_0x3b0647[_0x1c306e(0x2b5)]===_0x1c306e(0x27f)||_0x3b0647[_0x1c306e(0x2b5)]===_0x1c306e(0x210))&&_0x3b0647[_0x1c306e(0x205)]&&(_0x3b0647[_0x1c306e(0x232)]=await _0x187937(_0x3b0647[_0x1c306e(0x205)],_0x391ada));}const _0x46bc29=calculateSegmentDiff(_0x1a39a2,_0x23153a,_0x5c1bff,_0x1a9c4c[_0x1c306e(0x225)],_0x1a9c4c[_0x1c306e(0x244)]);_0x5a219d[_0x1c306e(0x1fc)]({'relativePath':_0x1a39a2[_0x1c306e(0x258)],'absolutePath':_0x5bfb20,'yamlConfig':_0x1a39a2,'folderPath':_0xbda484,'existingSegment':_0x23153a,'existingActivations':_0x5c1bff,'isNew':_0x46bc29[_0x1c306e(0x264)],'hasChanges':_0x46bc29[_0x1c306e(0x24c)],'diff':_0x46bc29[_0x1c306e(0x29b)],'activationActions':_0x4a7e44});}return{'segmentFiles':_0x5a219d,'foldersToCreate':_0x3b5a63};}export async function prepareJourneyFiles(_0x3d602d,_0x2a80ca,_0x435a61,_0xdaba0f){const _0x9d0132=a140_0x2ff839,_0x39fb50=[],_0x25f8ba=new Set();for(const {yamlConfig:_0x15468c,folderPath:_0xc91c8d,sourcePath:_0x39e05b}of _0x3d602d){const _0x3d6dda=resolveTDFolderPath(_0xc91c8d,_0x435a61,_0xdaba0f),_0x538afd=_0x3d6dda+':'+_0x15468c['name'],_0x54ba95=_0x2a80ca[_0x9d0132(0x1f1)][_0x9d0132(0x2c3)](_0x538afd);let _0x230381,_0x27d305;if(_0x54ba95&&_0x54ba95[_0x9d0132(0x2cc)]>0x0){const _0x6c3a31=buildLocalExpandedRuleMappings(_0x15468c),{createYamlContext:_0x4c8004,prefetchJourneySegments:_0x472dc9}=createPushYamlContextForBundle(_0x2a80ca['deps'],_0x2a80ca['parentId'],_0x2a80ca['existingSegments'],_0x6c3a31,_0x2a80ca[_0x9d0132(0x225)],_0x2a80ca['connectionIdToNameMap'],_0x2a80ca['activationStepsById'],_0x2a80ca[_0x9d0132(0x2ef)]);await _0x472dc9(_0x54ba95[_0x9d0132(0x295)](_0x44aa67=>_0x44aa67['id']));const _0x16dca1=await _0x2a80ca['deps'][_0x9d0132(0x209)][_0x9d0132(0x23e)](_0x54ba95[0x0][_0x9d0132(0x236)]),_0x41b038=hasMultipleVersions(_0x15468c),_0x31da99=async _0x5a906a=>{const _0x4ec8cd=_0x9d0132,_0x198ddb=_0x2a80ca['journeyById']?.[_0x4ec8cd(0x2c3)](_0x5a906a);if(_0x198ddb)return _0x198ddb;return _0x2a80ca[_0x4ec8cd(0x246)]({'journeyId':_0x5a906a,'journeyName':_0x15468c[_0x4ec8cd(0x258)],'isMultiVersion':_0x54ba95['length']>0x1});};if(_0x41b038&&_0x54ba95[_0x9d0132(0x2cc)]>0x1){const _0x4c27fd=[];for(const _0x421857 of _0x54ba95){const _0x546c1e=_0x421857[_0x9d0132(0x235)]||0x1;_0x2a80ca[_0x9d0132(0x229)]?.[_0x9d0132(0x210)](_0x9d0132(0x2c9)+_0x15468c[_0x9d0132(0x258)]+'\x20v'+_0x546c1e);const _0xf06331=await _0x31da99(_0x421857['id']),_0x46719a=_0x4c8004(_0x421857['id']),_0x1ed747=await journeyResponseToDef(_0xf06331,_0x46719a);_0x4c27fd[_0x9d0132(0x1fc)]({'item':_0x421857,'yaml':_0x1ed747});}const _0x97f095=buildLocalRuleToNameMappingFromJourney(_0x15468c);_0x27d305=buildMergedJourneyDef(_0x4c27fd,_0x97f095,_0x16dca1);const _0x1b8ba=Math['max'](..._0x4c27fd[_0x9d0132(0x295)](_0x2db536=>_0x2db536[_0x9d0132(0x260)][_0x9d0132(0x235)]||0x0)),_0x4d8a12=_0x54ba95['find'](_0x256117=>(_0x256117[_0x9d0132(0x235)]||0x0)===_0x1b8ba);_0x4d8a12&&(_0x2a80ca[_0x9d0132(0x229)]?.['update'](_0x9d0132(0x2c9)+_0x15468c[_0x9d0132(0x258)]+'\x20v'+_0x1b8ba),_0x230381=await _0x31da99(_0x4d8a12['id']));}else{const _0x21dce2=_0x54ba95[_0x54ba95[_0x9d0132(0x2cc)]-0x1];_0x2a80ca['progress']?.[_0x9d0132(0x210)](_0x9d0132(0x2c9)+_0x15468c[_0x9d0132(0x258)]),_0x230381=await _0x31da99(_0x21dce2['id']);const _0x3d247f=_0x4c8004(_0x21dce2['id']),_0x423922=await journeyResponseToDef(_0x230381,_0x3d247f),_0xf6a8d6=buildLocalRuleToNameMappingFromJourney(_0x15468c);_0x27d305=buildMergedJourneyDef([{'item':_0x21dce2,'yaml':_0x423922}],_0xf6a8d6,_0x16dca1);}}addFoldersToCreate(_0x3d6dda,_0x2a80ca[_0x9d0132(0x2ed)],_0x25f8ba);const _0x55dcbc=calculateJourneyDiff(_0x15468c,_0x27d305);_0x39fb50[_0x9d0132(0x1fc)]({'relativePath':_0x15468c[_0x9d0132(0x258)],'absolutePath':_0x39e05b,'yamlConfig':_0x15468c,'folderPath':_0x3d6dda,'existingJourney':_0x230381,'isNew':_0x55dcbc[_0x9d0132(0x264)],'hasChanges':_0x55dcbc[_0x9d0132(0x24c)],'diff':_0x55dcbc[_0x9d0132(0x29b)]});}return{'journeyFiles':_0x39fb50,'foldersToCreate':_0x25f8ba};}export function calculateActivationActions(_0x1d63df,_0x31386c,_0x2c1322,_0x505960){const _0x475f0b=a140_0x2ff839,_0x158c8d=[],_0x4877d9=new Map();for(const _0x21f8f3 of _0x31386c){_0x4877d9[_0x475f0b(0x282)](_0x21f8f3[_0x475f0b(0x258)],_0x21f8f3);}const _0x230dfa=new Map();for(const _0x4fad1e of _0x1d63df){_0x230dfa['set'](_0x4fad1e[_0x475f0b(0x258)],_0x4fad1e);}for(const _0x5b6e57 of _0x1d63df){const _0x37a360=_0x4877d9['get'](_0x5b6e57['name']);if(!_0x37a360)_0x158c8d['push']({'type':_0x475f0b(0x27f),'name':_0x5b6e57['name'],'yamlActivation':_0x5b6e57});else{const _0x3b4dcc=activationResponseToDef(_0x37a360,_0x2c1322,_0x505960),_0x166183=a140_0x2af49b['stringify'](_0x3b4dcc),_0x3db876=a140_0x2af49b['stringify'](_0x5b6e57);_0x166183!==_0x3db876&&_0x158c8d['push']({'type':_0x475f0b(0x210),'name':_0x5b6e57[_0x475f0b(0x258)],'yamlActivation':_0x5b6e57,'existingActivation':_0x37a360});}}for(const _0x4c1269 of _0x31386c){!_0x230dfa[_0x475f0b(0x200)](_0x4c1269[_0x475f0b(0x258)])&&_0x158c8d[_0x475f0b(0x1fc)]({'type':_0x475f0b(0x2d9),'name':_0x4c1269[_0x475f0b(0x258)],'existingActivation':_0x4c1269});}return _0x158c8d;}function calculateYamlDiff(_0x3ea196,_0x56ab11){if(_0x56ab11){const _0x30a6d6=generateDiff(_0x56ab11,_0x3ea196),_0x4fe082=hasChanges(_0x30a6d6);return{'isNew':![],'hasChanges':_0x4fe082,'diff':_0x4fe082?formatDiffWithColors(_0x30a6d6):undefined};}const _0x1a6e22=generateDiff('',_0x3ea196);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x1a6e22)};}export function calculateSegmentDiff(_0x58b7ae,_0x360daa,_0x4bd6c9,_0x58a027,_0x5dce50){const _0x4e6c0a=segmentToYamlString(_0x58b7ae),_0x4f3141=_0x360daa?segmentToYamlString(segmentWithActivationsToYaml(_0x360daa,_0x4bd6c9,undefined,_0x58a027,_0x5dce50)):undefined;return calculateYamlDiff(_0x4e6c0a,_0x4f3141);}export function calculateJourneyDiff(_0x441ce4,_0x2f9587){const _0x373304=normalizeJourneyDef(_0x441ce4,_0x441ce4),_0x30f326=a140_0x20196f(_0x373304),_0x37c352=_0x2f9587?a140_0x20196f(normalizeJourneyDef(_0x2f9587,_0x441ce4)):undefined;return calculateYamlDiff(_0x30f326,_0x37c352);}export function findSegmentsToDelete(_0x551308,_0xa23430,_0x40c4f7,_0x35b107,_0x381896){const _0x5700c4=a140_0x2ff839,_0x2da6fe=new Set();for(const {yamlConfig:_0x252fc9,folderPath:_0x4126bb}of _0xa23430){_0x2da6fe[_0x5700c4(0x237)](_0x4126bb+':'+_0x252fc9['name']);}return _0x551308[_0x5700c4(0x2ec)](_0x493622=>{const _0x4c2e72=_0x5700c4,_0x398e1d=_0x493622[_0x4c2e72(0x299)]?_0x40c4f7[_0x4c2e72(0x2c3)](_0x493622[_0x4c2e72(0x299)][_0x4c2e72(0x24a)]())||'':'',_0x44b29e=_0x398e1d+':'+_0x493622[_0x4c2e72(0x258)];if(_0x2da6fe[_0x4c2e72(0x200)](_0x44b29e))return![];if(_0x381896)return _0x398e1d===_0x35b107||_0x398e1d[_0x4c2e72(0x27e)](_0x35b107+'/');return!![];});}export function findJourneysToDelete(_0x126f88,_0x3622e5,_0x357db9,_0x2d9461,_0x4ce486){const _0x39c615=a140_0x2ff839,_0x248924=new Set();for(const {yamlConfig:_0x14992b,folderPath:_0x338467}of _0x3622e5){_0x248924[_0x39c615(0x237)](_0x338467+':'+_0x14992b['name']);}return _0x126f88[_0x39c615(0x2ec)](_0x418b5d=>{const _0xfc5d2b=_0x39c615,_0x2439ec=_0x418b5d['folderId']?_0x357db9[_0xfc5d2b(0x2c3)](_0x418b5d['folderId'])||'':'',_0x2290f8=_0x2439ec+':'+_0x418b5d['journeyBundleName'];if(_0x248924['has'](_0x2290f8))return![];if(_0x4ce486)return _0x2439ec===_0x2d9461||_0x2439ec['startsWith'](_0x2d9461+'/');return!![];});}export function buildSegmentLookupMap(_0x3cf60f,_0x4fee0a){const _0x2fd090=a140_0x2ff839,_0x3fd2ed=new Map();for(const _0x1edd16 of _0x3cf60f){const _0x107410=_0x1edd16[_0x2fd090(0x299)]?_0x4fee0a[_0x2fd090(0x2c3)](_0x1edd16[_0x2fd090(0x299)]['toString']())||'':'',_0x52b4d7=_0x107410+':'+_0x1edd16[_0x2fd090(0x258)];_0x3fd2ed['set'](_0x52b4d7,_0x1edd16);}return _0x3fd2ed;}export function buildSegmentNameToIdMap(_0x3f6a10){const _0x1b8c97=a140_0x2ff839,_0x16a05c=new Map();for(const _0x5171c5 of _0x3f6a10){_0x16a05c[_0x1b8c97(0x282)](_0x5171c5['name'],_0x5171c5['id']);}return _0x16a05c;}export function buildJourneyBundleLookupMap(_0x39a1f8,_0x373fd5){const _0x258ee7=a140_0x2ff839,_0x13e3e3=new Map();for(const _0x328a19 of _0x39a1f8){const _0x215111=_0x328a19[_0x258ee7(0x29d)]?_0x373fd5['get'](_0x328a19[_0x258ee7(0x29d)])||'':'',_0x2c9707=_0x215111+':'+_0x328a19[_0x258ee7(0x220)];!_0x13e3e3[_0x258ee7(0x200)](_0x2c9707)&&_0x13e3e3['set'](_0x2c9707,[]),_0x13e3e3[_0x258ee7(0x2c3)](_0x2c9707)[_0x258ee7(0x1fc)](_0x328a19);}for(const _0x56d1f3 of _0x13e3e3[_0x258ee7(0x213)]()){_0x56d1f3[_0x258ee7(0x2c7)]((_0x407b08,_0x14bea7)=>(_0x407b08[_0x258ee7(0x235)]||0x0)-(_0x14bea7['versionNumber']||0x0));}return _0x13e3e3;}export function collectFoldersToCreate(_0x5d6adc,_0x155b75){const _0x29f2e8=a140_0x2ff839,_0x1e3913=new Set();for(const _0x3f29c3 of _0x5d6adc){if(!_0x3f29c3)continue;if(_0x155b75[_0x29f2e8(0x200)](_0x3f29c3))continue;const _0x206118=_0x3f29c3[_0x29f2e8(0x202)]('/');let _0x2f6472='';for(const _0x1f6568 of _0x206118){_0x2f6472=_0x2f6472?_0x2f6472+'/'+_0x1f6568:_0x1f6568,!_0x155b75[_0x29f2e8(0x200)](_0x2f6472)&&_0x1e3913[_0x29f2e8(0x237)](_0x2f6472);}}return _0x1e3913;}export function parseAndClassifyYamlFiles(_0x242ffd,_0x2dc30d,_0x45e31b){const _0x3c9271=a140_0x2ff839,_0x112d0e=[],_0x333546=[];for(const _0x5cd61a of _0x242ffd){const _0x1a3085=a140_0x20a41d['relative'](_0x2dc30d,a140_0x20a41d['dirname'](_0x5cd61a)),_0x25ae3e=_0x1a3085==='.'?'':_0x1a3085,_0x508033=readFileSync(_0x5cd61a,_0x3c9271(0x2b1)),_0x2cdbd6=a140_0x2af49b[_0x3c9271(0x2e2)](_0x508033);if(isJourneyDef(_0x2cdbd6)){const _0x2a9936=a140_0x38903d(_0x508033);_0x333546['push']({'yamlConfig':_0x2a9936,'folderPath':_0x25ae3e,'sourcePath':_0x5cd61a});}else{if(!_0x45e31b?.[_0x3c9271(0x2bb)]){const _0x574df9=parseSegmentYamlFile(_0x508033),_0xa978aa=normalizeChildSegmentYaml(_0x574df9);_0x112d0e[_0x3c9271(0x1fc)]({'yamlConfig':_0xa978aa,'folderPath':_0x25ae3e,'sourcePath':_0x5cd61a});}}}return{'segments':_0x112d0e,'journeys':_0x333546};}export function validateParsedFiles(_0x2d8f5b,_0x912a50){const _0x3eb86f=a140_0x2ff839,_0x134644=[];for(const {yamlConfig:_0x38e924,sourcePath:_0x423892}of _0x2d8f5b[_0x3eb86f(0x2e1)]){const _0x34da69=readFileSync(_0x423892,_0x3eb86f(0x2b1)),_0x19a555=a140_0x2af49b['parseDocument'](_0x34da69),_0x5c3922=validateSegmentDef(_0x38e924,{'source':_0x34da69,'document':_0x19a555},{'skipSchema':!![]});if(!_0x5c3922['valid']){const _0x369b1=a140_0x20a41d[_0x3eb86f(0x23c)](_0x912a50,_0x423892);_0x134644['push']({'filePath':_0x369b1,'source':_0x34da69,'result':_0x5c3922,'isJourney':![]});}}for(const {yamlConfig:_0xc1600a,sourcePath:_0x299cad}of _0x2d8f5b[_0x3eb86f(0x2c5)]){const _0x931037=readFileSync(_0x299cad,_0x3eb86f(0x2b1)),_0x508a04=a140_0x2af49b[_0x3eb86f(0x2de)](_0x931037),_0x3374fb=validateJourneyDef(_0xc1600a,{'source':_0x931037,'document':_0x508a04},{'skipSchema':!![]});if(!_0x3374fb['valid']){const _0x3952dc=a140_0x20a41d['relative'](_0x912a50,_0x299cad);_0x134644[_0x3eb86f(0x1fc)]({'filePath':_0x3952dc,'source':_0x931037,'result':_0x3374fb,'isJourney':!![]});}}return _0x134644;}export function formatValidationErrors(_0x4ea074){const _0x2dcd5f=a140_0x2ff839,_0x2046e6=[];for(const {filePath:_0x3ec459,source:_0x345f3b,result:_0xf47d3d,isJourney:_0x407310}of _0x4ea074){const _0x62a768=_0x407310?'journey':'segment';_0x2046e6[_0x2dcd5f(0x1fc)]('\x0a'+_0x3ec459+'\x20('+_0x62a768+_0x2dcd5f(0x22d)+_0xf47d3d[_0x2dcd5f(0x29a)][_0x2dcd5f(0x2cc)]+_0x2dcd5f(0x26e)),_0x2046e6[_0x2dcd5f(0x1fc)](formatValidationResult(_0xf47d3d,_0x345f3b,_0x3ec459));}return _0x2046e6['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x45efc4){const _0x18087b=a140_0x2ff839,_0x29c55e=new Set(),_0xc3b692=new Map(),_0x28a3cc=collectSegmentUsageCounts(_0x45efc4);if(_0x45efc4[_0x18087b(0x2e1)])for(const [_0x53bca9,_0x1bc45f]of Object[_0x18087b(0x2ea)](_0x45efc4[_0x18087b(0x2e1)])){_0x29c55e[_0x18087b(0x237)](_0x53bca9);if(_0x1bc45f[_0x18087b(0x268)]){const _0x49fae1=yamlRuleToApi(_0x1bc45f[_0x18087b(0x268)]),_0x4bc424=apiRuleToYaml(_0x49fae1);_0xc3b692[_0x18087b(0x282)](_0x53bca9,_0x4bc424);}}const _0x5a0b5f=new Map();let _0x4e5f19=0x0;for(const [_0x23f4a3,_0x5c1374]of _0xc3b692){const _0x2cf136=serializeExpandedRule(_0x5c1374,_0xc3b692),_0x2e78a=_0x5a0b5f['get'](_0x2cf136)||[];_0x2e78a['push']({'name':_0x23f4a3,'index':_0x4e5f19}),_0x5a0b5f[_0x18087b(0x282)](_0x2cf136,_0x2e78a),_0x4e5f19++;}const _0x421389=new Map();for(const [_0x5731f6,_0x5d474e]of _0x5a0b5f){const _0x1d3b76=_0x5d474e[_0x18087b(0x2d4)]()['sort']((_0x4eb3bc,_0x1524cf)=>{const _0x117b9d=_0x18087b,_0xe63f46=_0x28a3cc[_0x117b9d(0x2c3)](_0x4eb3bc['name'])||0x0,_0x51a218=_0x28a3cc['get'](_0x1524cf['name'])||0x0;if(_0xe63f46!==_0x51a218)return _0x51a218-_0xe63f46;return _0x4eb3bc['index']-_0x1524cf[_0x117b9d(0x2b3)];})[_0x18087b(0x295)](_0x2d3ffa=>_0x2d3ffa[_0x18087b(0x258)]),_0x3c5a0f=[];for(const _0x1d4b18 of _0x1d3b76){const _0x5b5f27=_0x28a3cc['get'](_0x1d4b18)||0x0,_0x4ac53d=Math[_0x18087b(0x2e8)](_0x5b5f27,0x1);for(let _0x18cb8d=0x0;_0x18cb8d<_0x4ac53d;_0x18cb8d++){_0x3c5a0f[_0x18087b(0x1fc)](_0x1d4b18);}}_0x421389[_0x18087b(0x282)](_0x5731f6,_0x3c5a0f);}return{'existingLocalSegmentNames':_0x29c55e,'localSegmentRules':_0xc3b692,'localExpandedRuleToNames':_0x421389};}export function createSegmentIdResolver(_0x504b38,_0xf1d3b5){return async _0x16616d=>{const _0x41930d=a140_0x18bd,_0x48c930=_0x504b38[_0x41930d(0x2c3)](_0x16616d);if(!_0x48c930)throw new SDKError(ErrorCode[_0x41930d(0x2a8)],_0x41930d(0x271)+_0x16616d+_0x41930d(0x252)+_0xf1d3b5+'\x27)');return _0x48c930;};}export function extractRootFolderId(_0x1774b6){const _0x167555=a140_0x2ff839;return _0x1774b6[_0x167555(0x25e)]?.[_0x167555(0x259)]?.[_0x167555(0x2b0)]?.['id']||_0x1774b6[_0x167555(0x25e)]?.[_0x167555(0x201)]?.[_0x167555(0x2b0)]?.['id'];}export function buildConnectionMaps(_0x43bec2){const _0x28aafc=a140_0x2ff839,_0x2c5816=new Map(),_0x9756c7=new Map(),_0x3191db=new Map();for(const _0x47c71e of _0x43bec2){_0x2c5816['set'](_0x47c71e[_0x28aafc(0x258)],parseInt(_0x47c71e['id'],0xa)),_0x9756c7[_0x28aafc(0x282)](_0x47c71e['id'],_0x47c71e[_0x28aafc(0x258)]),_0x3191db[_0x28aafc(0x282)](_0x47c71e[_0x28aafc(0x258)],_0x47c71e[_0x28aafc(0x2b5)]);}return{'nameToId':_0x2c5816,'idToName':_0x9756c7,'nameToType':_0x3191db};}export function calculatePushStats(_0xc8dae5,_0x1557aa,_0x23c373,_0x6ac3e9,_0x6ceb76,_0x4c1ada,_0x208f60){const _0x22e0d8=a140_0x2ff839,_0x9e0866=_0xc8dae5[_0x22e0d8(0x2ec)](_0x51051a=>_0x51051a['isNew']),_0x1d3322=_0xc8dae5[_0x22e0d8(0x2ec)](_0x12ad20=>!_0x12ad20['isNew']&&_0x12ad20[_0x22e0d8(0x24c)]),_0x2cec88=_0xc8dae5[_0x22e0d8(0x2ec)](_0xb0b4e1=>!_0xb0b4e1[_0x22e0d8(0x264)]&&!_0xb0b4e1[_0x22e0d8(0x24c)]),_0x586269=_0x4c1ada?_0x6ac3e9:[],_0xd6c3f9=_0x1557aa['filter'](_0x15884a=>_0x15884a[_0x22e0d8(0x264)]),_0x109f3c=_0x1557aa[_0x22e0d8(0x2ec)](_0x1cee2b=>!_0x1cee2b[_0x22e0d8(0x264)]&&_0x1cee2b[_0x22e0d8(0x24c)]),_0x1e2b24=_0x1557aa[_0x22e0d8(0x2ec)](_0x2813f3=>!_0x2813f3[_0x22e0d8(0x264)]&&!_0x2813f3[_0x22e0d8(0x24c)]),_0x5b54fc=_0x4c1ada?_0x6ceb76:[],_0x22c880=_0xc8dae5[_0x22e0d8(0x2d0)](_0x256628=>_0x256628[_0x22e0d8(0x26f)]),_0x3d3fae=_0x22c880[_0x22e0d8(0x2ec)](_0x525faa=>_0x525faa[_0x22e0d8(0x2b5)]===_0x22e0d8(0x27f)),_0x9903f3=_0x22c880[_0x22e0d8(0x2ec)](_0x5a55b4=>_0x5a55b4['type']==='update'),_0x3a256f=_0x22c880[_0x22e0d8(0x2ec)](_0x486d3b=>_0x486d3b[_0x22e0d8(0x2b5)]==='delete'),_0x1af9c9=Array[_0x22e0d8(0x2a7)](_0x23c373)[_0x22e0d8(0x2c7)](),_0x1e0924=_0x208f60?![]:_0x9e0866[_0x22e0d8(0x2cc)]>0x0||_0x1d3322['length']>0x0||_0x586269[_0x22e0d8(0x2cc)]>0x0,_0x2ac00f=_0xd6c3f9['length']>0x0||_0x109f3c['length']>0x0||_0x5b54fc[_0x22e0d8(0x2cc)]>0x0,_0x4b7d3c=_0x208f60?![]:_0x22c880[_0x22e0d8(0x2cc)]>0x0,_0x55a96d=_0x1af9c9['length']>0x0;return{'segments':{'new':_0x9e0866,'changed':_0x1d3322,'unchanged':_0x2cec88,'toDelete':_0x586269},'journeys':{'new':_0xd6c3f9,'changed':_0x109f3c,'unchanged':_0x1e2b24,'toDelete':_0x5b54fc},'activations':{'all':_0x22c880,'toCreate':_0x3d3fae,'toUpdate':_0x9903f3,'toDelete':_0x3a256f},'folders':{'toCreate':_0x1af9c9},'counts':{'segments':{'new':_0x9e0866[_0x22e0d8(0x2cc)],'changed':_0x1d3322[_0x22e0d8(0x2cc)],'unchanged':_0x2cec88[_0x22e0d8(0x2cc)],'toDelete':_0x586269['length']},'journeys':{'new':_0xd6c3f9[_0x22e0d8(0x2cc)],'changed':_0x109f3c['length'],'unchanged':_0x1e2b24[_0x22e0d8(0x2cc)],'toDelete':_0x5b54fc[_0x22e0d8(0x2cc)]},'activations':{'create':_0x3d3fae[_0x22e0d8(0x2cc)],'update':_0x9903f3[_0x22e0d8(0x2cc)],'delete':_0x3a256f['length']},'folders':_0x1af9c9[_0x22e0d8(0x2cc)]},'hasChanges':_0x1e0924||_0x2ac00f||_0x4b7d3c||_0x55a96d};}export async function buildPushExecutionContext(_0x521bfd,_0x1ad28d,_0x3cb99f,_0x163328,_0x74db05,_0x52e98a){const _0x23c6e7=a140_0x2ff839,_0x1bc259=extractRootFolderId(_0x3cb99f),{pathToId:_0x3674b6,idToPath:_0x666c58}=buildFolderMaps(_0x74db05),_0x155e6a=buildSegmentNameToIdMap(_0x163328),_0x387b06=new Map(),{batchAsync:_0x58903a}=await import(_0x23c6e7(0x25b)),[_0xf80bb6,_0x4ae0c5]=await Promise[_0x23c6e7(0x217)]([_0x521bfd[_0x23c6e7(0x2cd)]['buildUserMaps'](),_0x521bfd[_0x23c6e7(0x27b)][_0x23c6e7(0x269)](),((async()=>{const _0x5f5206=_0x23c6e7;!_0x52e98a&&_0x163328[_0x5f5206(0x2cc)]>0x0&&await _0x58903a(_0x163328,async _0x43bf8b=>{const _0x46e518=_0x5f5206,_0xd25559=await _0x521bfd[_0x46e518(0x1f7)][_0x46e518(0x21d)](_0x1ad28d,_0x43bf8b['id']);_0x387b06[_0x46e518(0x282)](_0x43bf8b['id'],_0xd25559);});})())]),{emailToId:_0x36e966,idToEmail:_0x15cbac}=_0xf80bb6,_0x5193a5=buildConnectionMaps(_0x4ae0c5);return{'rootFolderId':_0x1bc259,'folderPathToId':_0x3674b6,'folderIdToPath':_0x666c58,'segmentNameToId':_0x155e6a,'activationsBySegmentId':_0x387b06,'emailToIdMap':_0x36e966,'idToEmailMap':_0x15cbac,'connectionNameToIdMap':_0x5193a5[_0x23c6e7(0x270)],'connectionIdToNameMap':_0x5193a5[_0x23c6e7(0x2c6)],'connectionNameToTypeMap':_0x5193a5[_0x23c6e7(0x291)]};}export function createPushYamlContextForBundle(_0x2a5ff2,_0x2c7eaa,_0x46f7d0,_0x36f28a,_0x104d74,_0x23b6b0,_0x24b47a,_0x5a4bbe){const {existingLocalSegmentNames:_0x40dc,localExpandedRuleToNames:_0x39afe6}=_0x36f28a,_0x4c47bf=new Set(),_0x3e07b0=new Map(),_0x4c61ec=new Map(),_0x40f9fe=new Map(),_0x22d9ed=createJumpTargetCache(),_0x4afc48=new Map(),_0x44222e=new Map(),_0x1ccaf8=new Set();let _0x31bf86;const _0x30c635=_0x3ba5ef=>{const _0x2fa6af={'resolveSegment':async _0x142437=>{const _0x2f38c7=a140_0x18bd,_0x3b5e48=_0x40f9fe[_0x2f38c7(0x2c3)](_0x142437);if(_0x3b5e48!==undefined)return{'name':_0x3b5e48,'isJourneyLocal':!![]};try{const _0x39583c=await fetchSegment(_0x2a5ff2,_0x2c7eaa,_0x142437,_0x46f7d0);if(!_0x39583c)throw new Error(_0x2f38c7(0x298));const _0x597075=generateJourneyLocalName(_0x39583c[_0x2f38c7(0x258)]),_0x4f645f=_0x39583c[_0x2f38c7(0x28a)]===SEGMENT_KIND_JOURNEY&&_0x597075!==undefined;let _0x217283=_0x39583c[_0x2f38c7(0x258)],_0x5b3609;if(_0x4f645f&&_0x39583c[_0x2f38c7(0x268)]){const _0x1262e2=apiRuleToYaml(_0x39583c['rule']);_0x44222e[_0x2f38c7(0x282)](_0x142437,_0x1262e2);const _0x13c9da=async _0x206ce5=>{const _0x38038d=_0x2f38c7,_0x1717c7=collectSegmentRefsFromRule(_0x206ce5);for(const _0x438571 of _0x1717c7){if(!_0x44222e[_0x38038d(0x200)](_0x438571))try{const _0x5cf46b=await fetchSegment(_0x2a5ff2,_0x2c7eaa,_0x438571,_0x46f7d0);if(_0x5cf46b?.[_0x38038d(0x268)]){const _0xdeab5e=apiRuleToYaml(_0x5cf46b[_0x38038d(0x268)]);_0x44222e[_0x38038d(0x282)](_0x438571,_0xdeab5e),await _0x13c9da(_0xdeab5e);}}catch(_0x48c083){logger[_0x38038d(0x262)]('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0x438571+':\x20'+_0x48c083);}}};await _0x13c9da(_0x1262e2);const _0x339b3f=serializeExpandedRule(_0x1262e2,_0x44222e),_0x56b928=_0x39afe6[_0x2f38c7(0x2c3)](_0x339b3f);if(_0x56b928&&_0x56b928[_0x2f38c7(0x2cc)]>0x0){const _0x3c5f6f=_0x3e07b0[_0x2f38c7(0x2c3)](_0x339b3f)||0x0,_0x4459cf=_0x56b928[_0x3c5f6f]||_0x56b928[_0x56b928[_0x2f38c7(0x2cc)]-0x1];_0x3e07b0[_0x2f38c7(0x282)](_0x339b3f,_0x3c5f6f+0x1),_0x217283=_0x4459cf,_0x4c47bf[_0x2f38c7(0x237)](_0x217283),_0x40f9fe[_0x2f38c7(0x282)](_0x142437,_0x217283);const _0x5499a8=await resolveRuleSegmentRefs(_0x1262e2,async _0xb223af=>{const _0x2650bf=_0x2f38c7,_0x5c26e4=_0x40f9fe['get'](_0xb223af);if(_0x5c26e4)return _0x5c26e4;const _0x3f80fc=await _0x31bf86[_0x2650bf(0x241)](_0xb223af);return _0x3f80fc[_0x2650bf(0x258)];});_0x5b3609={'description':_0x39583c['description'],'rule':_0x5499a8};}else{const _0x294204=_0x4afc48[_0x2f38c7(0x2c3)](_0x339b3f);if(_0x294204)_0x217283=_0x294204,_0x40f9fe[_0x2f38c7(0x282)](_0x142437,_0x217283);else{if(_0x597075){let _0x3e0191=_0x597075,_0x187bbd=0x2;while(_0x4c47bf[_0x2f38c7(0x200)](_0x3e0191)||_0x40dc['has'](_0x3e0191)){_0x3e0191=_0x597075+'_'+_0x187bbd,_0x187bbd++;}_0x4c47bf[_0x2f38c7(0x237)](_0x3e0191),_0x217283=_0x3e0191;}_0x40f9fe[_0x2f38c7(0x282)](_0x142437,_0x217283),_0x4afc48[_0x2f38c7(0x282)](_0x339b3f,_0x217283);const _0x3f032d=await resolveRuleSegmentRefs(_0x1262e2,async _0x19429f=>{const _0x3be116=_0x2f38c7,_0x535f40=_0x40f9fe[_0x3be116(0x2c3)](_0x19429f);if(_0x535f40)return _0x535f40;const _0x2d1fe5=await _0x31bf86[_0x3be116(0x241)](_0x19429f);return _0x2d1fe5[_0x3be116(0x258)];});_0x5b3609={'description':_0x39583c[_0x2f38c7(0x26d)],'rule':_0x3f032d};}}}return{'name':_0x217283,'isJourneyLocal':_0x4f645f,'definition':_0x5b3609};}catch(_0x29c800){return logger[_0x2f38c7(0x262)](_0x2f38c7(0x250)+_0x142437+':\x20'+_0x29c800),{'name':_0x142437,'isJourneyLocal':![]};}},'resolveActivation':async _0x582fdc=>{const _0x26d3df=a140_0x18bd,_0x4c7c77=_0x4c61ec[_0x26d3df(0x2c3)](_0x582fdc);if(_0x4c7c77!==undefined)return{'name':_0x4c7c77,'isJourneyLocal':!![]};try{let _0xb6a34a=_0x24b47a?.[_0x26d3df(0x2c3)](_0x582fdc);!_0xb6a34a&&(_0xb6a34a=await _0x2a5ff2[_0x26d3df(0x209)]['getActivation'](_0x3ba5ef,_0x582fdc));const _0x427434=_0xb6a34a[_0x26d3df(0x27c)]['activationParams']['name']||_0x582fdc,_0x5c32a6=sanitizeYamlKey(_0x427434)||'activation_'+_0x582fdc,_0x3ec0ea=_0x5c32a6;_0x4c61ec[_0x26d3df(0x282)](_0x582fdc,_0x3ec0ea);const _0x5c15c5=journeyActivationStepToYaml(_0xb6a34a,_0x104d74,_0x23b6b0);return{'name':_0x3ec0ea,'isJourneyLocal':!![],'definition':_0x5c15c5};}catch(_0x4e6e9c){return logger[_0x26d3df(0x262)](_0x26d3df(0x284)+_0x582fdc+':\x20'+_0x4e6e9c),{'name':_0x582fdc,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x59b875,_0x47fd6b)=>resolveJumpTarget(_0x59b875,_0x47fd6b,_0x22d9ed,async _0x515917=>{const _0x49890e=a140_0x18bd,_0x2d50e1=_0x5a4bbe?.[_0x49890e(0x2c3)](_0x515917);if(_0x2d50e1)return _0x2d50e1;return _0x2a5ff2[_0x49890e(0x209)]['getJourney'](_0x515917);})};return _0x31bf86=_0x2fa6af,_0x2fa6af;},_0x13b5db=async _0x4390bb=>{const _0x41322d=a140_0x18bd,{collectSegmentIdsFromJourneyApi:_0x478650}=await import(_0x41322d(0x2be)),{batchAsync:_0x14345a}=await import(_0x41322d(0x25b)),_0x2dba67=new Set();for(const _0x393e12 of _0x4390bb){let _0x2964d1=_0x5a4bbe?.['get'](_0x393e12);!_0x2964d1&&(_0x2964d1=await _0x2a5ff2[_0x41322d(0x209)]['getJourney'](_0x393e12));const _0x15be49=_0x478650(_0x2964d1);for(const _0x16af6d of _0x15be49){_0x2dba67['add'](_0x16af6d);}}let _0x22b808=Array[_0x41322d(0x2a7)](_0x2dba67);while(_0x22b808['length']>0x0){const _0x32662a=_0x22b808[_0x41322d(0x2ec)](_0xa12aea=>!_0x1ccaf8[_0x41322d(0x200)](_0xa12aea));if(_0x32662a[_0x41322d(0x2cc)]===0x0)break;const _0x280fd3=await _0x14345a(_0x32662a,async _0x3b1c88=>{const _0x118e4d=_0x41322d;_0x1ccaf8[_0x118e4d(0x237)](_0x3b1c88);const _0x4a722f=await fetchSegment(_0x2a5ff2,_0x2c7eaa,_0x3b1c88,_0x46f7d0);if(!_0x4a722f)return null;return{'segmentId':_0x3b1c88,'segment':_0x4a722f};},0xa),_0x414236=new Set();for(const _0x439eb9 of _0x280fd3){if(!_0x439eb9?.['segment']?.[_0x41322d(0x268)])continue;const _0x5bc709=apiRuleToYaml(_0x439eb9['segment'][_0x41322d(0x268)]);_0x44222e['set'](_0x439eb9[_0x41322d(0x2a2)],_0x5bc709);const _0x3e6989=collectSegmentRefsFromRule(_0x5bc709);for(const _0x277dc9 of _0x3e6989){!_0x1ccaf8[_0x41322d(0x200)](_0x277dc9)&&_0x414236[_0x41322d(0x237)](_0x277dc9);}}_0x22b808=Array[_0x41322d(0x2a7)](_0x414236);}};return{'createYamlContext':_0x30c635,'prefetchJourneySegments':_0x13b5db};}export async function executePushSegments(_0x1302c5,_0x3f4c76,_0x482a1b,_0x11ba15,_0x248117){const _0x443431=a140_0x2ff839,{segmentDefToCreateRequest:_0x5d23ac,segmentDefToUpdateRequest:_0x26cbdb}=await import(_0x443431(0x2b4)),_0x4aa145=_0x482a1b['folderPathToId'],_0x29ccba=0x5,_0x5e76b7=async _0x2c31fd=>{const _0x1c57a4=_0x443431,_0x1b0a72=_0x2c31fd['folderPath']?_0x4aa145['get'](_0x2c31fd[_0x1c57a4(0x22a)]):undefined;let _0x4613a5;const _0x4d49f3={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x3472b3=_0x2c31fd[_0x1c57a4(0x2a6)];if(_0x2c31fd['yamlConfig'][_0x1c57a4(0x268)]){const _0x5f1c65=createSegmentIdResolver(_0x482a1b[_0x1c57a4(0x2c0)],_0x2c31fd[_0x1c57a4(0x2a6)][_0x1c57a4(0x258)]),_0x34c809=await resolveRuleSegmentIds(_0x2c31fd[_0x1c57a4(0x2a6)]['rule'],_0x5f1c65);_0x3472b3={..._0x2c31fd['yamlConfig'],'rule':_0x34c809};}try{if(_0x2c31fd[_0x1c57a4(0x264)]){_0x248117['onProgress']?.({'type':_0x1c57a4(0x211),'name':_0x2c31fd[_0x1c57a4(0x2a6)]['name']});const _0x4cb535=_0x5d23ac(_0x3472b3,_0x1b0a72),_0x31cd21=await _0x248117[_0x1c57a4(0x240)](_0x1c57a4(0x2a3)+_0x2c31fd[_0x1c57a4(0x2a6)][_0x1c57a4(0x258)]+'\x27...',()=>_0x1302c5[_0x1c57a4(0x1f7)]['createSegment'](_0x11ba15['parentId'],_0x4cb535));_0x4613a5=_0x31cd21['data']['id'],_0x482a1b[_0x1c57a4(0x2c0)][_0x1c57a4(0x282)](_0x2c31fd['yamlConfig'][_0x1c57a4(0x258)],_0x4613a5),_0x4d49f3[_0x1c57a4(0x274)]={'name':_0x2c31fd['yamlConfig'][_0x1c57a4(0x258)],'id':_0x4613a5},_0x248117['onProgress']?.({'type':_0x1c57a4(0x2b7),'name':_0x2c31fd[_0x1c57a4(0x2a6)][_0x1c57a4(0x258)],'segmentId':_0x4613a5}),_0x248117['logSuccess']?.('Created\x20segment\x20\x27'+_0x2c31fd[_0x1c57a4(0x2a6)]['name']+'\x27'),_0x4d49f3['created']=0x1;}else{if(_0x2c31fd['hasChanges']){_0x248117[_0x1c57a4(0x2e4)]?.({'type':_0x1c57a4(0x203),'name':_0x2c31fd[_0x1c57a4(0x2a6)][_0x1c57a4(0x258)]});const _0x467b4f=_0x26cbdb(_0x3472b3);_0x1b0a72!==_0x2c31fd['existingSegment']?.[_0x1c57a4(0x299)]&&(_0x467b4f[_0x1c57a4(0x299)]=_0x1b0a72?parseInt(_0x1b0a72,0xa):undefined),await _0x248117[_0x1c57a4(0x240)](_0x1c57a4(0x222)+_0x2c31fd[_0x1c57a4(0x2a6)][_0x1c57a4(0x258)]+_0x1c57a4(0x2b8),()=>_0x1302c5[_0x1c57a4(0x1f7)][_0x1c57a4(0x255)](_0x11ba15['parentId'],_0x2c31fd['existingSegment']['id'],_0x467b4f)),_0x4613a5=_0x2c31fd[_0x1c57a4(0x226)]['id'],_0x248117['onProgress']?.({'type':_0x1c57a4(0x239),'name':_0x2c31fd[_0x1c57a4(0x2a6)][_0x1c57a4(0x258)]}),_0x248117[_0x1c57a4(0x242)]?.(_0x1c57a4(0x281)+_0x2c31fd[_0x1c57a4(0x2a6)][_0x1c57a4(0x258)]+'\x27'),_0x4d49f3['updated']=0x1;}else _0x4613a5=_0x2c31fd[_0x1c57a4(0x226)]['id'];}}catch(_0x2f2fad){const _0x38e53c=isHttp400Error(_0x2f2fad),_0x49f018=_0x38e53c?ErrorCode[_0x1c57a4(0x273)]:ErrorCode[_0x1c57a4(0x287)],_0x28b3fc=getErrorMessage(_0x2f2fad);throw new SDKError(_0x49f018,'Failed\x20to\x20'+(_0x2c31fd[_0x1c57a4(0x264)]?_0x1c57a4(0x27f):_0x1c57a4(0x210))+_0x1c57a4(0x2e9)+_0x2c31fd['absolutePath']+_0x1c57a4(0x22f)+_0x28b3fc,_0x2f2fad);}try{const _0x3e3e82=await syncActivationsForSegment(_0x1302c5,_0x11ba15[_0x1c57a4(0x22c)],_0x4613a5,_0x2c31fd[_0x1c57a4(0x2a6)][_0x1c57a4(0x258)],_0x2c31fd[_0x1c57a4(0x26f)],_0x248117,_0x2c31fd[_0x1c57a4(0x2d1)]);_0x4d49f3['activations']=_0x3e3e82;}catch(_0x18ac1b){if(_0x18ac1b instanceof SDKError)throw _0x18ac1b;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x2c31fd[_0x1c57a4(0x2a6)]['name']+_0x1c57a4(0x29f)+_0x2c31fd['absolutePath']+_0x1c57a4(0x22f)+getErrorMessage(_0x18ac1b),_0x18ac1b);}return _0x4d49f3;},_0x1ec328=await batchAsync(_0x3f4c76,_0x5e76b7,_0x29ccba),_0x388165={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x259ad7 of _0x1ec328){_0x388165[_0x443431(0x2cb)]+=_0x259ad7[_0x443431(0x2cb)],_0x388165[_0x443431(0x25c)]+=_0x259ad7[_0x443431(0x25c)],_0x259ad7[_0x443431(0x274)]&&_0x388165[_0x443431(0x23d)][_0x443431(0x282)](_0x259ad7[_0x443431(0x274)][_0x443431(0x258)],_0x259ad7[_0x443431(0x274)]['id']),_0x388165[_0x443431(0x265)]['created']+=_0x259ad7[_0x443431(0x265)]['created'],_0x388165[_0x443431(0x265)]['updated']+=_0x259ad7[_0x443431(0x265)][_0x443431(0x25c)],_0x388165[_0x443431(0x265)]['deleted']+=_0x259ad7[_0x443431(0x265)][_0x443431(0x2d5)];}return _0x388165;}async function syncActivationsForSegment(_0x1e88b0,_0x16532b,_0x225b6a,_0x3a2f38,_0x7819ac,_0x2de87d,_0x590352){const _0x239aca=a140_0x2ff839,_0x4baf77={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x37530c of _0x7819ac){try{if(_0x37530c['type']===_0x239aca(0x27f)&&_0x37530c[_0x239aca(0x232)])_0x2de87d[_0x239aca(0x2e4)]?.({'type':_0x239aca(0x2d6),'segmentName':_0x3a2f38,'activationName':_0x37530c['name']}),await _0x2de87d[_0x239aca(0x240)]('Creating\x20activation\x20\x27'+_0x37530c['name']+_0x239aca(0x2b8),()=>_0x1e88b0['segment']['createActivation'](_0x16532b,_0x225b6a,_0x37530c['validatedRequest'])),_0x2de87d[_0x239aca(0x2e4)]?.({'type':'activation_created','segmentName':_0x3a2f38,'activationName':_0x37530c[_0x239aca(0x258)]}),_0x2de87d['logSuccess']?.('Created\x20activation\x20\x27'+_0x37530c[_0x239aca(0x258)]+'\x27'),_0x4baf77[_0x239aca(0x2cb)]++;else{if(_0x37530c[_0x239aca(0x2b5)]===_0x239aca(0x210)&&_0x37530c['validatedRequest']&&_0x37530c['existingActivation'])_0x2de87d[_0x239aca(0x2e4)]?.({'type':_0x239aca(0x293),'segmentName':_0x3a2f38,'activationName':_0x37530c[_0x239aca(0x258)]}),await _0x2de87d[_0x239aca(0x240)](_0x239aca(0x2a1)+_0x37530c[_0x239aca(0x258)]+_0x239aca(0x2b8),()=>_0x1e88b0['segment'][_0x239aca(0x1f2)](_0x16532b,_0x225b6a,_0x37530c[_0x239aca(0x21e)]['id'],_0x37530c['validatedRequest'])),_0x2de87d[_0x239aca(0x2e4)]?.({'type':_0x239aca(0x2e7),'segmentName':_0x3a2f38,'activationName':_0x37530c['name']}),_0x2de87d[_0x239aca(0x242)]?.('Updated\x20activation\x20\x27'+_0x37530c[_0x239aca(0x258)]+'\x27'),_0x4baf77['updated']++;else _0x37530c[_0x239aca(0x2b5)]===_0x239aca(0x2d9)&&_0x37530c['existingActivation']&&(_0x2de87d[_0x239aca(0x2e4)]?.({'type':_0x239aca(0x2e6),'segmentName':_0x3a2f38,'activationName':_0x37530c[_0x239aca(0x258)]}),await _0x2de87d[_0x239aca(0x240)](_0x239aca(0x297)+_0x37530c[_0x239aca(0x258)]+_0x239aca(0x2b8),()=>_0x1e88b0[_0x239aca(0x1f7)][_0x239aca(0x2a9)](_0x16532b,_0x225b6a,_0x37530c[_0x239aca(0x21e)]['id'])),_0x2de87d[_0x239aca(0x2e4)]?.({'type':'activation_deleted','segmentName':_0x3a2f38,'activationName':_0x37530c[_0x239aca(0x258)]}),_0x2de87d[_0x239aca(0x206)]?.('Deleted\x20activation\x20\x27'+_0x37530c['name']+'\x27'),_0x4baf77[_0x239aca(0x2d5)]++);}}catch(_0x51d6f3){const _0x3fac8a=isHttp400Error(_0x51d6f3),_0x406b09=_0x3fac8a?ErrorCode[_0x239aca(0x285)]:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x3c6c4e=getErrorMessage(_0x51d6f3);throw new SDKError(_0x406b09,_0x239aca(0x24b)+_0x37530c['type']+_0x239aca(0x272)+_0x37530c[_0x239aca(0x258)]+'\x27\x20from\x20file:\x20'+_0x590352+_0x239aca(0x22f)+_0x3c6c4e,_0x51d6f3);}}return _0x4baf77;}export async function executePushFolders(_0x1b1e2d,_0x581fbb,_0x36ffb5,_0x3eceda,_0x21a36d){const _0x1ca801=a140_0x2ff839,_0x6c94f3=new Map(_0x36ffb5),_0x2c70ab=sortFoldersByDepth(_0x581fbb);for(const _0x3edf9f of _0x2c70ab){const _0x28aad1=_0x3edf9f[_0x1ca801(0x202)]('/'),_0x560b48=_0x28aad1[_0x28aad1[_0x1ca801(0x2cc)]-0x1],_0xaca571=_0x28aad1['slice'](0x0,-0x1)[_0x1ca801(0x2f0)]('/'),_0x453b26=_0x6c94f3[_0x1ca801(0x2c3)](_0xaca571);_0x21a36d[_0x1ca801(0x2e4)]?.({'type':_0x1ca801(0x25d),'folder':_0x3edf9f});const _0x1bf754={'name':_0x560b48,'parentFolderId':_0x453b26},_0x33a1e4=await _0x21a36d[_0x1ca801(0x240)](_0x1ca801(0x29e)+_0x3edf9f+_0x1ca801(0x2b8),()=>_0x1b1e2d[_0x1ca801(0x1f7)][_0x1ca801(0x2bc)](_0x3eceda[_0x1ca801(0x22c)],_0x1bf754));_0x6c94f3[_0x1ca801(0x282)](_0x3edf9f,_0x33a1e4[_0x1ca801(0x2b0)]['id']),_0x21a36d[_0x1ca801(0x2e4)]?.({'type':_0x1ca801(0x212),'folder':_0x3edf9f,'folderId':_0x33a1e4[_0x1ca801(0x2b0)]['id']}),_0x21a36d['logInfo']?.('Created\x20folder\x20\x27'+_0x3edf9f+'\x27');}return _0x6c94f3;}export async function executePushSegmentDeletions(_0xb1539b,_0x4805c5,_0x5b4d41){const _0x117d84=a140_0x2ff839;if(_0x4805c5[_0x117d84(0x2cc)]===0x0)return 0x0;const {batchAsync:_0x35f445}=await import('../../utils/async.js'),_0xe44d5f=0x5,_0x31db1d=await _0x35f445(_0x4805c5,async _0x543587=>{const _0x5c501b=_0x117d84;return _0x5b4d41[_0x5c501b(0x2e4)]?.({'type':_0x5c501b(0x2c8),'name':_0x543587['name']}),await _0xb1539b[_0x5c501b(0x1f7)][_0x5c501b(0x2e0)](_0x543587['id']),_0x5b4d41[_0x5c501b(0x2e4)]?.({'type':_0x5c501b(0x1ff),'name':_0x543587['name']}),_0x5b4d41['logDeleted']?.('Deleted\x20segment\x20\x27'+_0x543587[_0x5c501b(0x258)]+'\x27'),0x1;},_0xe44d5f);return _0x31db1d[_0x117d84(0x2d8)]((_0x4dff44,_0x422255)=>_0x4dff44+_0x422255,0x0);}export async function executePushJourneys(_0x3f7d28,_0x524855,_0x442b11,_0x10632d,_0x29e3f0){const _0x2a9ca7=a140_0x2ff839,{journeyDefToRequest:_0x345c25}=await import(_0x2a9ca7(0x2be)),{activationDefToCreateRequest:_0x4ef1ab,yamlRuleToApi:_0x2b5831,validateSegmentRule:_0x3b53c2}=await import('./child-segment-yaml.js'),_0x522054={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x1b7381=new Map(_0x442b11[_0x2a9ca7(0x2c0)]),_0x142b04=0x5;for(let _0x19718d=0x0;_0x19718d<_0x524855[_0x2a9ca7(0x2cc)];_0x19718d+=_0x142b04){const _0x22085c=_0x524855[_0x2a9ca7(0x2d4)](_0x19718d,_0x19718d+_0x142b04),_0x3fb66f=await Promise['all'](_0x22085c[_0x2a9ca7(0x295)](async _0x3530dd=>{const _0x57f808=_0x2a9ca7;if(!_0x3530dd['isNew']&&!_0x3530dd['hasChanges'])return{'action':'unchanged','name':_0x3530dd[_0x57f808(0x2a6)][_0x57f808(0x258)],'journeyId':_0x3530dd[_0x57f808(0x2ad)]?.['id']};const _0x5348fa=_0x3530dd['folderPath']?_0x442b11[_0x57f808(0x2ed)][_0x57f808(0x2c3)](_0x3530dd['folderPath']):undefined;_0x29e3f0[_0x57f808(0x2e4)]?.({'type':_0x3530dd[_0x57f808(0x264)]?'journey_creating':'journey_updating','name':_0x3530dd[_0x57f808(0x2a6)][_0x57f808(0x258)]});try{const _0x5dfb46=await executeSingleJourneyPush(_0x3f7d28,_0x3530dd,{..._0x442b11,'segmentNameToId':_0x1b7381},{'parentId':_0x10632d[_0x57f808(0x22c)],'rootFolderId':_0x10632d[_0x57f808(0x2a0)],'folderId':_0x5348fa,'verbose':_0x10632d['verbose']},_0x29e3f0,{'journeyDefToRequest':_0x345c25,'activationDefToCreateRequest':_0x4ef1ab,'yamlRuleToApi':_0x2b5831,'validateSegmentRule':_0x3b53c2});for(const [_0x7294e8,_0x404867]of _0x5dfb46[_0x57f808(0x1f9)]){_0x1b7381[_0x57f808(0x282)](_0x7294e8,_0x404867),_0x522054[_0x57f808(0x1f9)][_0x57f808(0x282)](_0x7294e8,_0x404867);}if(_0x5dfb46[_0x57f808(0x21c)]==='created')_0x29e3f0['onProgress']?.({'type':_0x57f808(0x21a),'name':_0x3530dd['yamlConfig']['name'],'journeyId':_0x5dfb46[_0x57f808(0x294)]}),_0x29e3f0[_0x57f808(0x242)]?.(_0x57f808(0x292)+_0x3530dd['yamlConfig']['name']+'\x27'),_0x522054[_0x57f808(0x2cb)]++;else _0x5dfb46[_0x57f808(0x21c)]==='updated'&&(_0x29e3f0[_0x57f808(0x2e4)]?.({'type':'journey_updated','name':_0x3530dd[_0x57f808(0x2a6)]['name']}),_0x29e3f0[_0x57f808(0x242)]?.(_0x57f808(0x2c4)+_0x3530dd['yamlConfig'][_0x57f808(0x258)]+'\x27'),_0x522054[_0x57f808(0x25c)]++);return{'action':_0x5dfb46['action'],'name':_0x3530dd['yamlConfig'][_0x57f808(0x258)],'journeyId':_0x5dfb46[_0x57f808(0x294)]};}catch(_0x3d9044){const _0x502e32=isHttp400Error(_0x3d9044),_0x4102d7=_0x502e32?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x5246ec=getErrorMessage(_0x3d9044);throw new SDKError(_0x4102d7,_0x57f808(0x24b)+(_0x3530dd[_0x57f808(0x264)]?'create':_0x57f808(0x210))+_0x57f808(0x238)+_0x3530dd[_0x57f808(0x2d1)]+_0x57f808(0x22f)+_0x5246ec,_0x3d9044);}}));_0x522054[_0x2a9ca7(0x214)]['push'](..._0x3fb66f);}return _0x522054;}async function matchExistingJourneySegments(_0x1a606f,_0x2fa3b9,_0xf79aeb,_0x93cce7,_0xea03d6){const _0x4c2fd1=a140_0x2ff839;if(!_0x2fa3b9[_0x4c2fd1(0x2ad)]||!_0x2fa3b9[_0x4c2fd1(0x2a6)]['segments'])return;const _0x56d941=new Map(),_0x7550ff=new Set();for(const _0x4ea7c7 of Object[_0x4c2fd1(0x20a)](_0x2fa3b9[_0x4c2fd1(0x2a6)][_0x4c2fd1(0x2e1)])){const _0x3c7ab4=generateDeterministicJourneySegmentName(_0x2fa3b9[_0x4c2fd1(0x2a6)][_0x4c2fd1(0x258)],_0x4ea7c7);_0x56d941[_0x4c2fd1(0x282)](_0x3c7ab4,_0x4ea7c7),_0x7550ff[_0x4c2fd1(0x237)](_0x4ea7c7);}const _0x8c3d0f=[],_0x5818b6=collectSegmentIdsFromJourneyApi(_0x2fa3b9['existingJourney']);for(const _0x5ba9d5 of _0x5818b6){const _0x32861f=await fetchSegment(_0x1a606f,_0xf79aeb,_0x5ba9d5,_0x93cce7);if(!_0x32861f?.[_0x4c2fd1(0x258)])continue;const _0x2f9a60=_0x56d941['get'](_0x32861f[_0x4c2fd1(0x258)]);_0x2f9a60?(_0xea03d6[_0x4c2fd1(0x282)](_0x2f9a60,_0x5ba9d5),_0x7550ff[_0x4c2fd1(0x2d9)](_0x2f9a60)):_0x8c3d0f['push']({'id':_0x5ba9d5,'seg':_0x32861f});}if(_0x7550ff['size']>0x0&&_0x8c3d0f[_0x4c2fd1(0x2cc)]>0x0){const {localExpandedRuleToNames:_0xdf3eac}=buildLocalExpandedRuleMappings(_0x2fa3b9['yamlConfig']),_0x74cb57=new Map();for(const {id:_0x499495,seg:_0x49eb9c}of _0x8c3d0f){if(_0x49eb9c['rule']){const _0x1a119d=apiRuleToYaml(_0x49eb9c[_0x4c2fd1(0x268)]);_0x74cb57[_0x4c2fd1(0x282)](_0x499495,_0x1a119d);}}for(const {id:_0x25f5de,seg:_0x35d142}of _0x8c3d0f){if(!_0x35d142['rule'])continue;const _0x144eff=_0x74cb57['get'](_0x25f5de);if(!_0x144eff)continue;const _0x7dad37=serializeExpandedRule(_0x144eff,_0x74cb57),_0x20d2c8=_0xdf3eac[_0x4c2fd1(0x2c3)](_0x7dad37);if(_0x20d2c8){const _0x704afe=_0x20d2c8[_0x4c2fd1(0x219)](_0x36fea6=>_0x7550ff[_0x4c2fd1(0x200)](_0x36fea6));_0x704afe&&(_0xea03d6[_0x4c2fd1(0x282)](_0x704afe,_0x25f5de),_0x7550ff['delete'](_0x704afe),logger['debug']('Matched\x20server\x20segment\x20\x27'+_0x35d142[_0x4c2fd1(0x258)]+_0x4c2fd1(0x24e)+_0x704afe+_0x4c2fd1(0x223)));}}}}async function executeSingleJourneyPush(_0x29fb29,_0x187de8,_0x4eb0f6,_0x1170c1,_0x4017f9,_0x16842c){const _0x4b3285=a140_0x2ff839,{journeyDefToRequest:_0x4d1438,activationDefToCreateRequest:_0x4e69d1,yamlRuleToApi:_0x41aed4,validateSegmentRule:_0x5e7ddb}=_0x16842c,_0x2c0385=new Map(),_0x4067c5=new Map();recoverSegmentIdsFromPushRecovery(_0x187de8,_0x2c0385,_0x4eb0f6[_0x4b3285(0x2c0)]);const _0x1002bd=new Map(),_0x3ab5ec=new Map(),_0x153ea9=new Map();let _0x1ec9f5;const _0x55477a=async()=>{const _0x51ace8=_0x4b3285;if(_0x1ec9f5)return;_0x1ec9f5=new Map();if(!_0x187de8[_0x51ace8(0x2ad)])return;const _0x585cc0=await _0x29fb29[_0x51ace8(0x209)]['listActivations'](_0x187de8['existingJourney']['id']);for(const _0x45dd59 of _0x585cc0){const _0x4f86e4=journeyActivationStepToYaml(_0x45dd59,_0x4eb0f6[_0x51ace8(0x225)],_0x4eb0f6['connectionIdToNameMap']),_0x2cd70a=activationSignature(_0x4f86e4);!_0x1ec9f5['has'](_0x2cd70a)&&_0x1ec9f5[_0x51ace8(0x282)](_0x2cd70a,_0x45dd59['id']),_0x4f86e4['name']&&_0x4067c5[_0x51ace8(0x282)](_0x4f86e4[_0x51ace8(0x258)],_0x45dd59['id']);}};await matchExistingJourneySegments(_0x29fb29,_0x187de8,_0x1170c1[_0x4b3285(0x22c)],_0x4eb0f6[_0x4b3285(0x25a)],_0x4eb0f6[_0x4b3285(0x2c0)]);const _0x28b985={'resolveSegmentId':async _0x25ee48=>{const _0x4d61a5=_0x4b3285,_0x3b632b=_0x4eb0f6[_0x4d61a5(0x2c0)]['get'](_0x25ee48);if(!_0x3b632b)throw new SDKError(ErrorCode[_0x4d61a5(0x2a8)],'Segment\x20not\x20found:\x20'+_0x25ee48+_0x4d61a5(0x2cf)+_0x187de8[_0x4d61a5(0x2a6)][_0x4d61a5(0x258)]+')');return _0x3b632b;},'resolveEmbeddedSegmentId':async(_0x4ab4bb,_0x67e185)=>{const _0x2ce020=_0x4b3285,_0x54362e=_0x4eb0f6['segmentNameToId'][_0x2ce020(0x2c3)](_0x4ab4bb);if(_0x54362e)return _0x54362e;const _0x5e2242=_0x4eb0f6['existingSegments'][_0x2ce020(0x219)](_0x45f1c1=>_0x45f1c1[_0x2ce020(0x258)]===_0x4ab4bb);if(_0x5e2242)return _0x4eb0f6[_0x2ce020(0x2c0)][_0x2ce020(0x282)](_0x4ab4bb,_0x5e2242['id']),_0x5e2242['id'];if(_0x187de8[_0x2ce020(0x264)]){const {stageName:_0xc1295d,criteriaName:_0x1603b1}=findSegmentCriteriaLocation(_0x187de8[_0x2ce020(0x2a6)],_0x4ab4bb);return _0x5e7ddb(_0x4ab4bb,_0x67e185[_0x2ce020(0x268)]),_0x3ab5ec[_0x2ce020(0x282)](_0x4ab4bb,{'definition':_0x67e185,'stageName':_0xc1295d,'criteriaName':_0x1603b1}),createPendingSegmentId(_0x4ab4bb);}const _0x26a46c=_0x187de8[_0x2ce020(0x2ad)]?.['id'];if(!_0x26a46c)throw new SDKError(ErrorCode[_0x2ce020(0x1f6)],_0x2ce020(0x267));const _0x7eecc6=_0x1002bd[_0x2ce020(0x2c3)](_0x4ab4bb);if(_0x7eecc6)return _0x7eecc6;const _0x2fa200=((async()=>{const _0x49e1e4=_0x2ce020;_0x5e7ddb(_0x4ab4bb,_0x67e185[_0x49e1e4(0x268)]);const _0x8ddff8=generateDeterministicJourneySegmentName(_0x187de8['yamlConfig'][_0x49e1e4(0x258)],_0x4ab4bb),_0x8538d0=_0x4eb0f6[_0x49e1e4(0x25a)][_0x49e1e4(0x219)](_0x5850b0=>_0x5850b0[_0x49e1e4(0x258)]===_0x8ddff8),_0x2f4c19=createSegmentIdResolver(_0x4eb0f6['segmentNameToId'],_0x4ab4bb),_0x58a31d=await resolveRuleSegmentIds(_0x67e185[_0x49e1e4(0x268)],_0x2f4c19);let _0x35df54;return _0x8538d0?(await _0x29fb29[_0x49e1e4(0x1f7)][_0x49e1e4(0x255)](_0x1170c1[_0x49e1e4(0x22c)],_0x8538d0['id'],{'description':_0x67e185[_0x49e1e4(0x26d)]||_0x49e1e4(0x21b)+_0x4ab4bb,'rule':_0x41aed4(_0x58a31d,!![]),'countPopulation':!![]}),_0x35df54=_0x8538d0['id'],saveSegmentToPushRecovery(_0x187de8[_0x49e1e4(0x2d1)],_0x187de8[_0x49e1e4(0x2a6)][_0x49e1e4(0x258)],_0x4ab4bb,{'segmentId':_0x35df54,'uniqueServerName':_0x8ddff8,'createdAt':new Date()[_0x49e1e4(0x249)]()})):_0x35df54=await createOrRecoverEmbeddedSegment(_0x29fb29,_0x187de8,{'localName':_0x4ab4bb,'uniqueSegmentName':_0x8ddff8,'description':_0x67e185[_0x49e1e4(0x26d)]||'Entry\x20criteria:\x20'+_0x4ab4bb,'journeyId':_0x26a46c,'resolvedRule':_0x58a31d,'parentId':_0x1170c1[_0x49e1e4(0x22c)],'folderId':_0x1170c1[_0x49e1e4(0x2a0)]||''},_0x41aed4),_0x4eb0f6[_0x49e1e4(0x2c0)][_0x49e1e4(0x282)](_0x4ab4bb,_0x35df54),_0x2c0385['set'](_0x4ab4bb,_0x35df54),_0x35df54;})());_0x1002bd['set'](_0x4ab4bb,_0x2fa200);try{return await _0x2fa200;}finally{_0x1002bd['delete'](_0x4ab4bb);}},'resolveActivationId':async _0x4e0afd=>{const _0x1a6ca3=_0x4b3285,_0x57cd14=_0x4067c5[_0x1a6ca3(0x2c3)](_0x4e0afd);if(_0x57cd14)return _0x57cd14;if(_0x187de8[_0x1a6ca3(0x2ad)]){await _0x55477a();const _0x4f52f1=_0x4067c5[_0x1a6ca3(0x2c3)](_0x4e0afd);if(_0x4f52f1)return _0x4f52f1;}throw new SDKError(ErrorCode['NOT_FOUND'],_0x1a6ca3(0x28c)+_0x4e0afd+_0x1a6ca3(0x2cf)+_0x187de8[_0x1a6ca3(0x2a6)][_0x1a6ca3(0x258)]+_0x1a6ca3(0x228)+_0x1a6ca3(0x278));},'resolveEmbeddedActivationId':async(_0x49a1af,_0x46ad87)=>{const _0xf7aba6=_0x4b3285,_0x21ea07=_0x4067c5[_0xf7aba6(0x2c3)](_0x49a1af);if(_0x21ea07)return _0x21ea07;if(_0x187de8['isNew'])return _0x153ea9[_0xf7aba6(0x282)](_0x49a1af,_0x46ad87),createPendingActivationId(_0x49a1af);if(_0x187de8[_0xf7aba6(0x2ad)]){await _0x55477a();const _0x5955c4=_0x4067c5[_0xf7aba6(0x2c3)](_0x46ad87[_0xf7aba6(0x258)]);if(_0x5955c4)return _0x4067c5['set'](_0x49a1af,_0x5955c4),_0x5955c4;const _0x3246a8=activationSignature(_0x46ad87),_0x51b343=_0x1ec9f5?.[_0xf7aba6(0x2c3)](_0x3246a8);if(_0x51b343)return _0x4067c5[_0xf7aba6(0x282)](_0x49a1af,_0x51b343),_0x51b343;const _0x1fc6c0=await _0x4e69d1(_0x46ad87,_0x4eb0f6[_0xf7aba6(0x243)]),_0x18a572={..._0x1fc6c0,..._0x46ad87[_0xf7aba6(0x28d)]!==undefined&&{'runAfterJourneyRefresh':_0x46ad87[_0xf7aba6(0x28d)]}},_0x525357=await _0x29fb29[_0xf7aba6(0x209)][_0xf7aba6(0x2ae)](_0x187de8['existingJourney']['id'],_0x18a572);return _0x4067c5[_0xf7aba6(0x282)](_0x49a1af,_0x525357['id']),_0x525357['id'];}throw new SDKError(ErrorCode[_0xf7aba6(0x1f6)],_0xf7aba6(0x22b));},'resolveJourneyId':async _0x13598e=>{const _0x219525=_0x4b3285;try{return await _0x29fb29['journey'][_0x219525(0x24f)](_0x1170c1[_0x219525(0x22c)],_0x13598e);}catch(_0x207672){throw new SDKError(ErrorCode[_0x219525(0x286)],_0x219525(0x2dd)+_0x13598e+_0x219525(0x2c2)+_0x187de8[_0x219525(0x2a6)][_0x219525(0x258)]+'\x27)',_0x207672);}},'resolveStageId':async(_0x453c71,_0x35f00b)=>{const _0x3b6958=_0x4b3285,_0x5b2b95=await _0x29fb29[_0x3b6958(0x209)][_0x3b6958(0x2f1)](_0x453c71),_0x2a96e1=_0x5b2b95['attributes']['journeyStages'][_0x3b6958(0x219)](_0x56ac41=>_0x56ac41[_0x3b6958(0x258)][_0x3b6958(0x2a4)]()===_0x35f00b[_0x3b6958(0x2a4)]());if(!_0x2a96e1?.['id'])throw new SDKError(ErrorCode[_0x3b6958(0x286)],_0x3b6958(0x221)+_0x35f00b+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x5b2b95['attributes']['journeyBundleName']||_0x5b2b95[_0x3b6958(0x27c)][_0x3b6958(0x258)])+'\x27');return _0x2a96e1['id'];}},_0x45a406=await _0x4d1438(_0x187de8['yamlConfig'],_0x1170c1[_0x4b3285(0x22c)],_0x28b985),_0x3abece=_0x1170c1['folderId']||_0x1170c1['rootFolderId'];_0x3abece&&(_0x45a406[_0x4b3285(0x25e)]={'parentFolder':{'data':{'id':_0x3abece,'type':_0x4b3285(0x215)}}});if(_0x187de8['isNew']){if(_0x3ab5ec['size']>0x0||_0x153ea9[_0x4b3285(0x24d)]>0x0)return await executeThreeStepJourneyCreate(_0x29fb29,_0x187de8,_0x45a406,{'pendingEmbeddedSegments':_0x3ab5ec,'pendingEmbeddedActivations':_0x153ea9,'embeddedSegmentNameToId':_0x2c0385,'journeyActivationNameToId':_0x4067c5},{..._0x1170c1,'effectiveFolderId':_0x3abece},_0x4eb0f6,_0x4017f9,_0x16842c);else{ensureJourneyDefaults(_0x45a406[_0x4b3285(0x27c)]);const _0x460c22=await _0x29fb29[_0x4b3285(0x209)]['create'](_0x45a406);return deletePushRecovery(_0x187de8[_0x4b3285(0x2d1)]),{'action':_0x4b3285(0x2cb),'journeyId':_0x460c22['id'],'embeddedSegmentNameToId':_0x2c0385};}}else{if(_0x187de8['hasChanges']&&_0x187de8['existingJourney']){_0x45a406['id']=_0x187de8[_0x4b3285(0x2ad)]['id'];const _0x18c1d0=_0x45a406['attributes'];_0x187de8[_0x4b3285(0x2ad)][_0x4b3285(0x27c)]?.[_0x4b3285(0x220)]&&(_0x18c1d0['journeyBundleName']=_0x187de8[_0x4b3285(0x2ad)][_0x4b3285(0x27c)]['journeyBundleName']);const _0x192ad1=_0x187de8[_0x4b3285(0x2ad)][_0x4b3285(0x27c)]?.[_0x4b3285(0x2b9)];return _0x192ad1&&_0x45a406['attributes'][_0x4b3285(0x2b9)]&&injectExistingStageIds(_0x45a406['attributes']['journeyStages'],_0x192ad1),ensureJourneyDefaults(_0x18c1d0),await _0x29fb29[_0x4b3285(0x209)][_0x4b3285(0x210)](_0x187de8[_0x4b3285(0x2ad)]['id'],_0x45a406),deletePushRecovery(_0x187de8[_0x4b3285(0x2d1)]),{'action':_0x4b3285(0x25c),'journeyId':_0x187de8[_0x4b3285(0x2ad)]['id'],'embeddedSegmentNameToId':_0x2c0385};}}return deletePushRecovery(_0x187de8[_0x4b3285(0x2d1)]),{'action':_0x4b3285(0x20c),'journeyId':_0x187de8[_0x4b3285(0x2ad)]?.['id'],'embeddedSegmentNameToId':_0x2c0385};}function findSegmentCriteriaLocation(_0x5a021b,_0x248668){const _0x5ca10b=a140_0x2ff839,_0x282097=_0x5a021b[_0x5ca10b(0x2df)]||_0x5a021b[_0x5ca10b(0x2c5)]?.[0x0]?.[_0x5ca10b(0x2df)]||[];let _0xf58cdd=_0x5ca10b(0x2da),_0x4ab14c=_0x248668;const _0x5eec03=_0x5a021b['goal']||_0x5a021b[_0x5ca10b(0x2c5)]?.[0x0]?.[_0x5ca10b(0x25f)];if(_0x5eec03?.[_0x5ca10b(0x1f7)]===_0x248668)return{'stageName':_0x5ca10b(0x25f),'criteriaName':_0x5eec03[_0x5ca10b(0x258)]||_0x248668};_0x5cb7eb:for(const _0x38af51 of _0x282097){if(_0x38af51[_0x5ca10b(0x218)]?.[_0x5ca10b(0x1f7)]===_0x248668){_0xf58cdd=_0x38af51[_0x5ca10b(0x258)],_0x4ab14c=_0x38af51[_0x5ca10b(0x218)][_0x5ca10b(0x258)]||_0x248668;break;}if(_0x38af51[_0x5ca10b(0x288)])for(const _0x3146f6 of _0x38af51[_0x5ca10b(0x288)]){if(_0x3146f6[_0x5ca10b(0x2b5)]===_0x5ca10b(0x28b)&&_0x3146f6[_0x5ca10b(0x1f0)]?.[_0x5ca10b(0x28e)])for(const _0x107f25 of _0x3146f6[_0x5ca10b(0x1f0)]['branches']){if(_0x107f25[_0x5ca10b(0x1f7)]===_0x248668){_0xf58cdd=_0x38af51[_0x5ca10b(0x258)],_0x4ab14c=_0x107f25[_0x5ca10b(0x258)]||_0x248668;break _0x5cb7eb;}}}}return{'stageName':_0xf58cdd,'criteriaName':_0x4ab14c};}function a140_0x33e7(){const _0x36b319=['Updating\x20segment\x20\x27','\x27\x20by\x20rule\x20content','getSegment\x20failed\x20for\x20','idToEmailMap','existingSegment','createJourneySegment',').\x20','progress','folderPath','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','parentId','):\x20','__pending_act_','\x0a\x20\x20','\x27\x20wait\x20condition','activation_template_id','validatedRequest','replace','4072Buglcg','versionNumber','journeyBundleId','add','\x20journey\x20from\x20file:\x20','segment_updated','draft','goal\x20criteria','relative','createdSegmentIds','getLatestJourneyId','object','withProgress','resolveSegment','logSuccess','activationContext','connectionIdToNameMap','waitStep','fetchJourney','logWarning','journeyName','toISOString','toString','Failed\x20to\x20','hasChanges','size','\x27\x20to\x20local\x20\x27','resolveJourneyId','Failed\x20to\x20resolve\x20segment\x20','6412360RTYnPG','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','1985641haiHaI','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','updateSegmentById','trim','milestone','name','parentSegmentFolder','existingSegments','../../utils/async.js','updated','folder_creating','relationships','goal','item','journeyActivationNameToId','debug','Name\x20has\x20already\x20been\x20taken','isNew','activations','\x27\x20entry\x20criteria','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','rule','list','7772qhlLbl','embedded_segment_creating','hex','description','\x20error(s)','activationActions','nameToId','Segment\x20not\x20found:\x20','\x20activation\x20\x27','SEGMENT_SYNTAX_ERROR','createdSegmentId','38378hRSsEM','columns','all_columns','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','effectiveFolderId','resolvedRule','connection','attributes','digest','startsWith','create','isArray','Updated\x20segment\x20\x27','set','waitStepUnit','Failed\x20to\x20resolve\x20activation\x20','ACTIVATION_SYNTAX_ERROR','NOT_FOUND','SEGMENT_UPDATE_ERROR','steps','schedule','kind','decision_point','Activation\x20not\x20found:\x20','run_after_journey_refresh','branches','Delete\x20the\x20push\x20recovery\x20file\x20(','localName','nameToType','Created\x20journey\x20\x27','activation_updating','journeyId','map','11FcwbWB','Deleting\x20activation\x20\x27','Segment\x20not\x20found','segmentFolderId','errors','diff','Duration','folderId','Creating\x20folder\x20\x27','\x27\x20from\x20file:\x20','rootFolderId','Updating\x20activation\x20\x27','segmentId','Creating\x20segment\x20\x27','toLowerCase','embedded_segment_created','yamlConfig','from','SEGMENT_NOT_FOUND','deleteActivation','\x27\x20exit\x20criteria','conditionSegmentId','journeyActivationStepId','existingJourney','createActivation','stringify','data','utf-8','conditions','index','./child-segment-yaml.js','type','1494cQTokl','segment_created','\x27...','journeyStages','1094673WXtPNl','skipSegments','createFolder','.$1.push-recovery.json','./journey-yaml.js','entryCriteria','segmentNameToId','message','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','get','Updated\x20journey\x20\x27','journeys','idToName','sort','segment_deleting','Fetching\x20','Activation','created','length','user','\x27\x20for\x20','\x20(referenced\x20in\x20journey\x20','flatMap','absolutePath','tdx.sdk.push-workflow','1313826kYCodX','slice','deleted','activation_creating','\x27\x20milestone','reduce','delete','entry','day','Condition','Journey\x20\x27','parseDocument','stages','deleteSegment','segments','parse','uniqueSegmentName','onProgress','waitStepType','activation_deleting','activation_updated','max','\x20segment\x20from\x20file:\x20','entries','exitCriterias','filter','folderPathToId','getSegmentEntity\x20also\x20failed\x20for\x20','journeyById','join','getJourney','__pending_','with','journeyBundlesByFolderAndName','updateActivation','state','some','conditionTimeoutUnit','INTERNAL','segment','WaitStep','embeddedSegmentNameToId','conditionTimeoutDuration','DecisionPoint','push','behavior','and\x20the\x20server\x20segment,\x20then\x20retry.','segment_deleted','has','parentFolder','split','segment_updating','segmentByFolderAndName','yamlActivation','logDeleted','\x27\x20decision\x20point\x20branch\x20\x27','1285JeHtjL','journey','keys','activationsBySegmentId','unchanged','getSegment','embedded_activation_created','stage\x20\x27','update','segment_creating','folder_created','values','results','folder','sha1','all','entry_criteria','find','journey_created','Entry\x20criteria:\x20','action','listActivations','existingActivation','uniqueServerName','journeyBundleName','Stage\x20\x27'];a140_0x33e7=function(){return _0x36b319;};return a140_0x33e7();}function a140_0x18bd(_0x35ca75,_0x3132a8){_0x35ca75=_0x35ca75-0x1ef;const _0x33e760=a140_0x33e7();let _0x18bddb=_0x33e760[_0x35ca75];return _0x18bddb;}async function executeThreeStepJourneyCreate(_0x476d4e,_0x1e54d8,_0x13e14b,_0x2d4daf,_0x58a490,_0x1fd86a,_0x5dc65f,_0x343295){const _0x55745e=a140_0x2ff839,{activationDefToCreateRequest:_0x348f51,yamlRuleToApi:_0x120705}=_0x343295,{pendingEmbeddedSegments:_0x120c59,pendingEmbeddedActivations:_0x2e4e2c,embeddedSegmentNameToId:_0x1a4403}=_0x2d4daf,_0x5b3d58=JSON[_0x55745e(0x2e2)](JSON[_0x55745e(0x2af)](_0x13e14b));ensureJourneyDefaults(_0x5b3d58[_0x55745e(0x27c)]),stripPendingIds(_0x5b3d58);const _0x11bf67=await _0x476d4e['journey']['create'](_0x5b3d58),_0x3a60b4=_0x11bf67['id'],_0x657a73=new Map();for(const _0x388300 of _0x11bf67[_0x55745e(0x27c)]['journeyStages']){_0x657a73[_0x55745e(0x282)](_0x388300[_0x55745e(0x258)]['toLowerCase'](),_0x388300['id']);}recoverSegmentIdsFromPushRecovery(_0x1e54d8,_0x1a4403,_0x1fd86a[_0x55745e(0x2c0)]);for(const [_0x44542d,{definition:_0x2255eb}]of _0x120c59){if(_0x1a4403[_0x55745e(0x200)](_0x44542d)){_0x5dc65f[_0x55745e(0x2e4)]?.({'type':_0x55745e(0x2a5),'journeyName':_0x1e54d8['yamlConfig'][_0x55745e(0x258)],'segmentName':_0x44542d});continue;}const _0x379b31=generateDeterministicJourneySegmentName(_0x1e54d8[_0x55745e(0x2a6)][_0x55745e(0x258)],_0x44542d);_0x5dc65f['onProgress']?.({'type':_0x55745e(0x26b),'journeyName':_0x1e54d8['yamlConfig'][_0x55745e(0x258)],'segmentName':_0x44542d});const _0x2da118=createSegmentIdResolver(_0x1fd86a['segmentNameToId'],_0x44542d),_0x4124cb=await resolveRuleSegmentIds(_0x2255eb['rule'],_0x2da118),_0x48453c=await createOrRecoverEmbeddedSegment(_0x476d4e,_0x1e54d8,{'localName':_0x44542d,'uniqueSegmentName':_0x379b31,'description':_0x2255eb[_0x55745e(0x26d)]||'Entry\x20criteria:\x20'+_0x44542d,'journeyId':_0x3a60b4,'resolvedRule':_0x4124cb,'parentId':_0x58a490[_0x55745e(0x22c)],'folderId':_0x58a490[_0x55745e(0x279)]||''},_0x120705);_0x1a4403[_0x55745e(0x282)](_0x44542d,_0x48453c),_0x1fd86a[_0x55745e(0x2c0)]['set'](_0x44542d,_0x48453c),_0x5dc65f['onProgress']?.({'type':_0x55745e(0x2a5),'journeyName':_0x1e54d8[_0x55745e(0x2a6)][_0x55745e(0x258)],'segmentName':_0x44542d});}const _0x246905=new Map();for(const [_0x4ddaad,_0x2f7629]of _0x2e4e2c){_0x5dc65f['onProgress']?.({'type':'embedded_activation_creating','journeyName':_0x1e54d8[_0x55745e(0x2a6)]['name'],'activationName':_0x4ddaad});const _0x35410a=await _0x348f51(_0x2f7629,_0x1fd86a['activationContext']),_0xf9ca08={..._0x35410a,..._0x2f7629[_0x55745e(0x28d)]!==undefined&&{'runAfterJourneyRefresh':_0x2f7629['run_after_journey_refresh']}},_0x305c77=await _0x476d4e[_0x55745e(0x209)][_0x55745e(0x2ae)](_0x3a60b4,_0xf9ca08);_0x246905[_0x55745e(0x282)](_0x4ddaad,_0x305c77['id']),_0x2d4daf[_0x55745e(0x261)]['set'](_0x4ddaad,_0x305c77['id']),_0x5dc65f['onProgress']?.({'type':_0x55745e(0x20e),'journeyName':_0x1e54d8[_0x55745e(0x2a6)][_0x55745e(0x258)],'activationName':_0x4ddaad});}const _0x5133ee=JSON['parse'](JSON[_0x55745e(0x2af)](_0x13e14b));return _0x5133ee['id']=_0x3a60b4,ensureJourneyDefaults(_0x5133ee['attributes']),resolvePendingIdsInRequest(_0x5133ee,_0x13e14b,_0x657a73,_0x1a4403,_0x246905,_0x5dc65f),await _0x476d4e['journey'][_0x55745e(0x210)](_0x3a60b4,_0x5133ee),deletePushRecovery(_0x1e54d8[_0x55745e(0x2d1)]),{'action':_0x55745e(0x2cb),'journeyId':_0x3a60b4,'embeddedSegmentNameToId':_0x1a4403};}export function stripWaitStepPendingIds(_0x11bdea){const _0x3ad9f7=a140_0x2ff839,_0x5aff03=_0x11bdea[_0x3ad9f7(0x2ab)]&&isPendingSegmentId(_0x11bdea[_0x3ad9f7(0x2ab)]),_0x306211=_0x11bdea[_0x3ad9f7(0x2b2)]?.['some'](_0x4db57b=>_0x4db57b[_0x3ad9f7(0x2a2)]&&isPendingSegmentId(_0x4db57b[_0x3ad9f7(0x2a2)]));(_0x5aff03||_0x306211)&&(_0x11bdea[_0x3ad9f7(0x2e5)]=_0x3ad9f7(0x29c),_0x11bdea[_0x3ad9f7(0x245)]=0x1,_0x11bdea['waitStepUnit']=_0x3ad9f7(0x2db),delete _0x11bdea['conditionSegmentId'],delete _0x11bdea[_0x3ad9f7(0x1fa)],delete _0x11bdea[_0x3ad9f7(0x1f5)],delete _0x11bdea[_0x3ad9f7(0x2b2)]);}export function resolveWaitStepPendingIds(_0x2775c0,_0xef77bb,_0x5c81bd,_0x6f3d84){const _0x2f2dd3=a140_0x2ff839;if(_0xef77bb[_0x2f2dd3(0x2ab)]&&isPendingSegmentId(_0xef77bb[_0x2f2dd3(0x2ab)])){const _0xb84e75=_0x5c81bd(_0xef77bb[_0x2f2dd3(0x2ab)],_0x2f2dd3(0x20f)+_0x6f3d84+'\x27\x20wait\x20condition');_0xb84e75&&(_0x2775c0['waitStepType']=_0x2f2dd3(0x2dc),_0x2775c0[_0x2f2dd3(0x2ab)]=_0xb84e75,delete _0x2775c0[_0x2f2dd3(0x245)],delete _0x2775c0[_0x2f2dd3(0x283)],_0xef77bb[_0x2f2dd3(0x1fa)]!==undefined&&(_0x2775c0[_0x2f2dd3(0x1fa)]=_0xef77bb['conditionTimeoutDuration']),_0xef77bb[_0x2f2dd3(0x1f5)]&&(_0x2775c0[_0x2f2dd3(0x1f5)]=_0xef77bb['conditionTimeoutUnit']));}if(_0xef77bb[_0x2f2dd3(0x2b2)]){const _0x2dcb75=_0xef77bb[_0x2f2dd3(0x2b2)][_0x2f2dd3(0x1f4)](_0x5742a3=>_0x5742a3['segmentId']&&isPendingSegmentId(_0x5742a3[_0x2f2dd3(0x2a2)]));if(_0x2dcb75){const _0x37ec6=_0xef77bb[_0x2f2dd3(0x2b2)][_0x2f2dd3(0x295)](_0xa2ed07=>{const _0x32e1ed=_0x2f2dd3;if(_0xa2ed07['segmentId']&&isPendingSegmentId(_0xa2ed07[_0x32e1ed(0x2a2)])){const _0x41576d=_0x5c81bd(_0xa2ed07[_0x32e1ed(0x2a2)],_0x32e1ed(0x20f)+_0x6f3d84+_0x32e1ed(0x230));return{..._0xa2ed07,'segmentId':_0x41576d||_0xa2ed07[_0x32e1ed(0x2a2)]};}return{..._0xa2ed07};});_0x2775c0[_0x2f2dd3(0x2e5)]=_0x2f2dd3(0x2dc),_0x2775c0[_0x2f2dd3(0x2b2)]=_0x37ec6,delete _0x2775c0[_0x2f2dd3(0x245)],delete _0x2775c0[_0x2f2dd3(0x283)],delete _0x2775c0[_0x2f2dd3(0x2ab)],delete _0x2775c0[_0x2f2dd3(0x1fa)],delete _0x2775c0[_0x2f2dd3(0x1f5)];}}}function stripPendingIds(_0x4f5d8a){const _0x39106c=a140_0x2ff839;_0x4f5d8a[_0x39106c(0x27c)][_0x39106c(0x25f)]?.[_0x39106c(0x2a2)]&&isPendingSegmentId(_0x4f5d8a[_0x39106c(0x27c)][_0x39106c(0x25f)][_0x39106c(0x2a2)])&&delete _0x4f5d8a[_0x39106c(0x27c)][_0x39106c(0x25f)];for(const _0x1fe6f0 of _0x4f5d8a['attributes'][_0x39106c(0x2b9)]||[]){_0x1fe6f0[_0x39106c(0x2bf)]?.[_0x39106c(0x2a2)]&&isPendingSegmentId(_0x1fe6f0[_0x39106c(0x2bf)][_0x39106c(0x2a2)])&&delete _0x1fe6f0[_0x39106c(0x2bf)];_0x1fe6f0[_0x39106c(0x257)]?.[_0x39106c(0x2a2)]&&isPendingSegmentId(_0x1fe6f0[_0x39106c(0x257)]['segmentId'])&&delete _0x1fe6f0[_0x39106c(0x257)];_0x1fe6f0[_0x39106c(0x2eb)]&&(_0x1fe6f0['exitCriterias']=_0x1fe6f0[_0x39106c(0x2eb)][_0x39106c(0x2ec)](_0x8be94c=>!_0x8be94c[_0x39106c(0x2a2)]||!isPendingSegmentId(_0x8be94c[_0x39106c(0x2a2)])));if(_0x1fe6f0[_0x39106c(0x288)])for(const _0x5d51cb of Object[_0x39106c(0x20a)](_0x1fe6f0[_0x39106c(0x288)])){const _0x155fb7=_0x1fe6f0['steps'][_0x5d51cb];_0x155fb7[_0x39106c(0x2b5)]===_0x39106c(0x2ca)&&_0x155fb7[_0x39106c(0x2ac)]&&isPendingActivationId(_0x155fb7[_0x39106c(0x2ac)])&&(_0x155fb7[_0x39106c(0x2ac)]='');if(_0x155fb7[_0x39106c(0x2b5)]===_0x39106c(0x1fb)&&_0x155fb7[_0x39106c(0x28e)])for(const _0x563b10 of _0x155fb7[_0x39106c(0x28e)]){_0x563b10[_0x39106c(0x2a2)]&&isPendingSegmentId(_0x563b10['segmentId'])&&(_0x563b10['segmentId']='');}_0x155fb7[_0x39106c(0x2b5)]===_0x39106c(0x1f8)&&stripWaitStepPendingIds(_0x155fb7);}}}function resolvePendingIdsInRequest(_0x536d67,_0x443e91,_0xda3dc2,_0x2409d2,_0x3c86d1,_0xfe8f6){const _0x1e1354=a140_0x2ff839,_0x1ef65d=(_0x2b540f,_0x5adcdb)=>{const _0x2578c7=a140_0x18bd;if(!isPendingSegmentId(_0x2b540f))return _0x2b540f;const _0x75998f=extractPendingSegmentName(_0x2b540f),_0x393c23=_0x2409d2['get'](_0x75998f);return!_0x393c23&&_0xfe8f6[_0x2578c7(0x247)]?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x75998f+_0x2578c7(0x2ce)+_0x5adcdb),_0x393c23;};if(_0x536d67[_0x1e1354(0x27c)]['goal']?.[_0x1e1354(0x2a2)]&&isPendingSegmentId(_0x536d67['attributes'][_0x1e1354(0x25f)]['segmentId'])){const _0x2d0d2f=_0x1ef65d(_0x536d67['attributes']['goal']['segmentId'],_0x1e1354(0x23b));_0x2d0d2f&&(_0x536d67[_0x1e1354(0x27c)][_0x1e1354(0x25f)][_0x1e1354(0x2a2)]=_0x2d0d2f);}for(const _0x29290f of _0x536d67[_0x1e1354(0x27c)]['journeyStages']||[]){const _0x504bcc=_0xda3dc2[_0x1e1354(0x2c3)](_0x29290f[_0x1e1354(0x258)]['toLowerCase']());_0x504bcc&&(_0x29290f['id']=_0x504bcc);if(_0x29290f[_0x1e1354(0x2bf)]?.['segmentId']&&isPendingSegmentId(_0x29290f[_0x1e1354(0x2bf)][_0x1e1354(0x2a2)])){const _0x1b883f=_0x1ef65d(_0x29290f['entryCriteria'][_0x1e1354(0x2a2)],_0x1e1354(0x20f)+_0x29290f[_0x1e1354(0x258)]+_0x1e1354(0x266));_0x1b883f&&(_0x29290f[_0x1e1354(0x2bf)][_0x1e1354(0x2a2)]=_0x1b883f);}if(_0x29290f[_0x1e1354(0x2eb)])for(const _0x45f7b6 of _0x29290f[_0x1e1354(0x2eb)]){if(_0x45f7b6['segmentId']&&isPendingSegmentId(_0x45f7b6[_0x1e1354(0x2a2)])){const _0x449cc7=_0x1ef65d(_0x45f7b6[_0x1e1354(0x2a2)],_0x1e1354(0x20f)+_0x29290f[_0x1e1354(0x258)]+_0x1e1354(0x2aa));_0x449cc7&&(_0x45f7b6[_0x1e1354(0x2a2)]=_0x449cc7);}}if(_0x29290f['milestone']?.[_0x1e1354(0x2a2)]&&isPendingSegmentId(_0x29290f[_0x1e1354(0x257)][_0x1e1354(0x2a2)])){const _0xa26b96=_0x1ef65d(_0x29290f[_0x1e1354(0x257)][_0x1e1354(0x2a2)],'stage\x20\x27'+_0x29290f[_0x1e1354(0x258)]+_0x1e1354(0x2d7));_0xa26b96&&(_0x29290f[_0x1e1354(0x257)][_0x1e1354(0x2a2)]=_0xa26b96);}if(_0x29290f[_0x1e1354(0x288)]){const _0x24dd10=_0x184946=>_0x443e91[_0x1e1354(0x27c)][_0x1e1354(0x2b9)]?.[_0x1e1354(0x219)](_0x3e30ff=>_0x3e30ff[_0x1e1354(0x258)][_0x1e1354(0x2a4)]()===_0x29290f[_0x1e1354(0x258)][_0x1e1354(0x2a4)]())?.[_0x1e1354(0x288)]?.[_0x184946];for(const _0x10db98 of Object[_0x1e1354(0x20a)](_0x29290f[_0x1e1354(0x288)])){const _0x44095a=_0x29290f[_0x1e1354(0x288)][_0x10db98],_0x44b933=_0x24dd10(_0x10db98);if(_0x44095a['type']===_0x1e1354(0x2ca)&&_0x44095a['journeyActivationStepId']&&(isPendingActivationId(_0x44095a[_0x1e1354(0x2ac)])||_0x44095a[_0x1e1354(0x2ac)]==='')){if(_0x44b933?.[_0x1e1354(0x2ac)]&&isPendingActivationId(_0x44b933['journeyActivationStepId'])){const _0x9539df=extractPendingActivationName(_0x44b933['journeyActivationStepId']),_0x4d8ec3=_0x3c86d1[_0x1e1354(0x2c3)](_0x9539df);_0x4d8ec3&&(_0x44095a[_0x1e1354(0x2ac)]=_0x4d8ec3);}}if(_0x44095a['type']===_0x1e1354(0x1fb)&&_0x44095a[_0x1e1354(0x28e)]&&_0x44b933?.[_0x1e1354(0x28e)])for(let _0x172fbe=0x0;_0x172fbe<_0x44095a[_0x1e1354(0x28e)][_0x1e1354(0x2cc)];_0x172fbe++){const _0x2ba5cc=_0x44095a[_0x1e1354(0x28e)][_0x172fbe],_0x16b3ca=_0x44b933['branches'][_0x172fbe];if(_0x16b3ca?.[_0x1e1354(0x2a2)]&&isPendingSegmentId(_0x16b3ca[_0x1e1354(0x2a2)])){const _0x18de84=_0x1ef65d(_0x16b3ca['segmentId'],_0x1e1354(0x20f)+_0x29290f[_0x1e1354(0x258)]+_0x1e1354(0x207)+(_0x2ba5cc[_0x1e1354(0x258)]||_0x172fbe)+'\x27');_0x18de84&&(_0x2ba5cc['segmentId']=_0x18de84);}}_0x44095a[_0x1e1354(0x2b5)]===_0x1e1354(0x1f8)&&_0x44b933?.[_0x1e1354(0x2b5)]===_0x1e1354(0x1f8)&&resolveWaitStepPendingIds(_0x44095a,_0x44b933,_0x1ef65d,_0x29290f[_0x1e1354(0x258)]);}}}}
1
+ const a140_0x408869=a140_0x340f;(function(_0x22850a,_0x560072){const _0x59e4dd=a140_0x340f,_0x1a0736=_0x22850a();while(!![]){try{const _0x100e9f=-parseInt(_0x59e4dd(0x1ca))/0x1*(-parseInt(_0x59e4dd(0x1d7))/0x2)+parseInt(_0x59e4dd(0x22b))/0x3*(-parseInt(_0x59e4dd(0x224))/0x4)+-parseInt(_0x59e4dd(0x23a))/0x5*(-parseInt(_0x59e4dd(0x1a8))/0x6)+parseInt(_0x59e4dd(0x284))/0x7+parseInt(_0x59e4dd(0x1c5))/0x8+-parseInt(_0x59e4dd(0x260))/0x9*(-parseInt(_0x59e4dd(0x1ed))/0xa)+-parseInt(_0x59e4dd(0x25d))/0xb*(parseInt(_0x59e4dd(0x220))/0xc);if(_0x100e9f===_0x560072)break;else _0x1a0736['push'](_0x1a0736['shift']());}catch(_0x2271a0){_0x1a0736['push'](_0x1a0736['shift']());}}}(a140_0x54fe,0x6a819));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a140_0x408869(0x216));export const PENDING_SEGMENT_PREFIX=a140_0x408869(0x231);export const PENDING_ACTIVATION_PREFIX=a140_0x408869(0x273);export function createPendingSegmentId(_0x324fc8){return''+PENDING_SEGMENT_PREFIX+_0x324fc8+'__';}export function isPendingSegmentId(_0x5e4b8e){const _0x2eb419=a140_0x408869;return _0x5e4b8e[_0x2eb419(0x1d2)](PENDING_SEGMENT_PREFIX)&&!_0x5e4b8e[_0x2eb419(0x1d2)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x5a9854){const _0x1c67a5=a140_0x408869;return _0x5a9854[_0x1c67a5(0x1bf)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x7b2d47){return''+PENDING_ACTIVATION_PREFIX+_0x7b2d47+'__';}export function isPendingActivationId(_0x2f1ea1){return _0x2f1ea1['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x3c34f4){const _0x5873d0=a140_0x408869;return _0x3c34f4[_0x5873d0(0x1bf)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x46fcdd,_0x3f83a3){const _0x29dd70=a140_0x408869,_0x28a981=_0x46fcdd+'::'+(_0x3f83a3[_0x29dd70(0x195)]()||_0x29dd70(0x22d)),_0x556631=createHash('sha1')[_0x29dd70(0x250)](_0x28a981)[_0x29dd70(0x27b)](_0x29dd70(0x1a5))[_0x29dd70(0x282)](0x0,0xc);return'journey_entry_criteria_'+_0x556631;}export function ensureJourneyDefaults(_0x35a1fd){const _0x4eeaa0=a140_0x408869;!_0x35a1fd[_0x4eeaa0(0x1c0)]&&(_0x35a1fd[_0x4eeaa0(0x1c0)]=''),!_0x35a1fd[_0x4eeaa0(0x27c)]&&(_0x35a1fd['state']=_0x4eeaa0(0x1bc));}export function injectExistingStageIds(_0xafa801,_0x3660f6){const _0x31e8b1=a140_0x408869,_0x895946=new Map(_0x3660f6[_0x31e8b1(0x268)](_0x3a159b=>[_0x3a159b[_0x31e8b1(0x265)],_0x3a159b['id']]));for(const _0x3a4b83 of _0xafa801){if(!_0x3a4b83['id']){const _0x3cbfec=_0x895946[_0x31e8b1(0x1f1)](_0x3a4b83[_0x31e8b1(0x265)]);_0x3cbfec&&(_0x3a4b83['id']=_0x3cbfec);}}}export function resolveTDFolderPath(_0x428110,_0x59af8b,_0x5c726d){const _0xffd8f2=a140_0x408869;if(!_0x59af8b)return _0x428110;if(_0x428110===_0x5c726d||_0x428110[_0xffd8f2(0x1d2)](_0x5c726d+'/'))return _0x428110;return _0x428110?_0x5c726d+'/'+_0x428110:_0x5c726d;}export function addFoldersToCreate(_0x5239d5,_0x19cbd2,_0x8b5380){const _0x44a576=a140_0x408869;if(!_0x5239d5)return;if(_0x19cbd2[_0x44a576(0x1ea)](_0x5239d5))return;const _0x18860a=_0x5239d5['split']('/');let _0x1a8cc6='';for(const _0x2c0565 of _0x18860a){_0x1a8cc6=_0x1a8cc6?_0x1a8cc6+'/'+_0x2c0565:_0x2c0565,!_0x19cbd2['has'](_0x1a8cc6)&&_0x8b5380[_0x44a576(0x199)](_0x1a8cc6);}}export function sortFoldersByDepth(_0x501124){return[..._0x501124]['sort']((_0x5a4a87,_0xbbc2a6)=>{const _0x1ce752=a140_0x340f,_0x593d3a=(_0x5a4a87[_0x1ce752(0x21b)](/\//g)||[])[_0x1ce752(0x280)],_0x53153f=(_0xbbc2a6[_0x1ce752(0x21b)](/\//g)||[])[_0x1ce752(0x280)];return _0x593d3a-_0x53153f;});}import*as a140_0x461fde from'yaml';import{readFileSync}from'fs';function a140_0x340f(_0x171eae,_0x406706){_0x171eae=_0x171eae-0x188;const _0x54fe78=a140_0x54fe();let _0x340ff0=_0x54fe78[_0x171eae];return _0x340ff0;}import a140_0x44127b from'path';import{isJourneyDef,parseYamlString as a140_0x190f74,toYamlString as a140_0x3add77,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(_0x5e6c73){const _0xa967d=a140_0x408869;if(Array[_0xa967d(0x1d1)](_0x5e6c73))return'['+_0x5e6c73['map'](_0x1a66bf=>stableStringify(_0x1a66bf))[_0xa967d(0x1cc)](',')+']';if(_0x5e6c73&&typeof _0x5e6c73==='object'){const _0xd3744a=_0x5e6c73,_0x55da75=Object['keys'](_0xd3744a)['sort'](),_0x2ab27c=_0x55da75[_0xa967d(0x268)](_0xaf9eba=>'\x22'+_0xaf9eba+'\x22:'+stableStringify(_0xd3744a[_0xaf9eba]));return'{'+_0x2ab27c[_0xa967d(0x1cc)](',')+'}';}const _0x19f396=JSON[_0xa967d(0x22c)](_0x5e6c73);return _0x19f396===undefined?'null':_0x19f396;}function activationSignature(_0x4d2131){const _0x395f4c=a140_0x408869,_0x30d7d7={'connection':_0x4d2131[_0x395f4c(0x279)],..._0x4d2131[_0x395f4c(0x1b5)]!==undefined&&{'all_columns':_0x4d2131[_0x395f4c(0x1b5)]},..._0x4d2131['columns']!==undefined&&{'columns':_0x4d2131['columns']},..._0x4d2131['behavior']!==undefined&&{'behavior':_0x4d2131[_0x395f4c(0x1b9)]},..._0x4d2131['schedule']!==undefined&&{'schedule':_0x4d2131[_0x395f4c(0x21c)]},..._0x4d2131[_0x395f4c(0x20c)]!==undefined&&{'notification':_0x4d2131[_0x395f4c(0x20c)]},..._0x4d2131[_0x395f4c(0x1fc)]!==undefined&&{'connector_config':_0x4d2131[_0x395f4c(0x1fc)]},..._0x4d2131[_0x395f4c(0x24f)]!==undefined&&{'activation_template_id':_0x4d2131[_0x395f4c(0x24f)]}};return stableStringify(_0x30d7d7);}async function fetchSegment(_0x125494,_0x4b99ba,_0x59fa5b,_0x50df49){const _0xdb145=a140_0x408869,_0x478f92=_0x50df49?.[_0xdb145(0x270)](_0x1183b4=>_0x1183b4['id']===_0x59fa5b);if(_0x478f92)return _0x478f92;try{return await _0x125494[_0xdb145(0x22d)][_0xdb145(0x1ef)](_0x4b99ba,_0x59fa5b);}catch(_0x20a6ce){logger[_0xdb145(0x1bd)]('getSegment\x20failed\x20for\x20'+_0x59fa5b+_0xdb145(0x239)+_0x20a6ce);try{return await _0x125494[_0xdb145(0x22d)]['getSegmentEntity'](_0x59fa5b);}catch(_0x2d0ec6){return logger['debug'](_0xdb145(0x1ae)+_0x59fa5b+':\x20'+_0x2d0ec6),null;}}}function recoverSegmentIdsFromPushRecovery(_0x12fc54,_0x2dc972,_0x3c7b91){const _0x364346=a140_0x408869,_0x3c27dd=readPushRecovery(_0x12fc54[_0x364346(0x21d)]);if(_0x3c27dd?.[_0x364346(0x20b)]===_0x12fc54[_0x364346(0x18a)]['name'])for(const [_0x3a1682,_0x5c3ec4]of Object['entries'](_0x3c27dd[_0x364346(0x241)])){const _0x43411b=generateDeterministicJourneySegmentName(_0x12fc54[_0x364346(0x18a)][_0x364346(0x265)],_0x3a1682);_0x5c3ec4[_0x364346(0x25e)]===_0x43411b&&(_0x2dc972[_0x364346(0x1f8)](_0x3a1682,_0x5c3ec4['segmentId']),_0x3c7b91[_0x364346(0x1f8)](_0x3a1682,_0x5c3ec4['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0xf06427,_0x53c712,_0x1c1a9b,_0xa5834a){const _0x141bfd=a140_0x408869;let _0x2c413f;try{_0x2c413f=await _0xf06427['segment'][_0x141bfd(0x1a1)]({'name':_0x1c1a9b[_0x141bfd(0x26b)],'description':_0x1c1a9b[_0x141bfd(0x1c0)],'journeyId':_0x1c1a9b['journeyId'],'rule':_0xa5834a(_0x1c1a9b[_0x141bfd(0x275)],!![]),'countPopulation':!![],'parentFolderId':_0x1c1a9b[_0x141bfd(0x258)],'audienceId':_0x1c1a9b[_0x141bfd(0x18e)]});}catch(_0x443abb){const _0x287145=_0x443abb instanceof Error&&_0x443abb[_0x141bfd(0x192)]['includes'](_0x141bfd(0x1d3));if(_0x287145){const _0x79fac7=readPushRecovery(_0x53c712['absolutePath']),_0x42b156=_0x79fac7?.['journeyName']===_0x53c712[_0x141bfd(0x18a)][_0x141bfd(0x265)]?_0x79fac7[_0x141bfd(0x241)][_0x1c1a9b['localName']]:undefined;if(_0x42b156?.[_0x141bfd(0x25e)]===_0x1c1a9b[_0x141bfd(0x26b)])await _0xf06427[_0x141bfd(0x22d)][_0x141bfd(0x1b7)](_0x1c1a9b['parentId'],_0x42b156[_0x141bfd(0x1d4)],{'description':_0x1c1a9b[_0x141bfd(0x1c0)],'rule':_0xa5834a(_0x1c1a9b[_0x141bfd(0x275)],!![]),'countPopulation':!![]}),_0x2c413f=_0x42b156[_0x141bfd(0x1d4)];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],'Embedded\x20segment\x20\x27'+_0x1c1a9b[_0x141bfd(0x194)]+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+(_0x141bfd(0x237)+_0x53c712[_0x141bfd(0x21d)][_0x141bfd(0x1bf)](/([^/]+)$/,_0x141bfd(0x246))+')\x20')+_0x141bfd(0x229),_0x443abb);}else throw _0x443abb;}return saveSegmentToPushRecovery(_0x53c712[_0x141bfd(0x21d)],_0x53c712[_0x141bfd(0x18a)][_0x141bfd(0x265)],_0x1c1a9b['localName'],{'segmentId':_0x2c413f,'uniqueServerName':_0x1c1a9b[_0x141bfd(0x26b)],'createdAt':new Date()[_0x141bfd(0x1ec)]()}),_0x2c413f;}export async function prepareSegmentFiles(_0x2ddc8f,_0x169937,_0x4225b1,_0x4b80ef,_0x1115c6){const _0x382f15=a140_0x408869,{activationDefToCreateRequest:_0x35ca9c}=await import(_0x382f15(0x207)),_0x5b1d17=[],_0x4695cb=new Set();for(const {yamlConfig:_0x463111,folderPath:_0x595b0b,sourcePath:_0xc43a9e}of _0x2ddc8f){const _0x7d7151=resolveTDFolderPath(_0x595b0b,_0x4b80ef,_0x1115c6),_0xc8b524=_0x7d7151+':'+_0x463111['name'],_0x40c8cf=_0x169937[_0x382f15(0x200)][_0x382f15(0x1f1)](_0xc8b524),_0x2dd943=_0x40c8cf?_0x169937['activationsBySegmentId'][_0x382f15(0x1f1)](_0x40c8cf['id'])||[]:[];addFoldersToCreate(_0x7d7151,_0x169937['folderPathToId'],_0x4695cb);const _0x532156=calculateActivationActions(_0x463111[_0x382f15(0x20a)]||[],_0x2dd943,_0x169937[_0x382f15(0x1d8)],_0x169937['connectionIdToNameMap']);for(const _0x39a1ec of _0x532156){(_0x39a1ec[_0x382f15(0x1ce)]===_0x382f15(0x1e9)||_0x39a1ec['type']===_0x382f15(0x250))&&_0x39a1ec[_0x382f15(0x213)]&&(_0x39a1ec[_0x382f15(0x211)]=await _0x35ca9c(_0x39a1ec[_0x382f15(0x213)],_0x4225b1));}const _0xcfd9c0=calculateSegmentDiff(_0x463111,_0x40c8cf,_0x2dd943,_0x169937[_0x382f15(0x1d8)],_0x169937[_0x382f15(0x1e7)]);_0x5b1d17[_0x382f15(0x1aa)]({'relativePath':_0x463111[_0x382f15(0x265)],'absolutePath':_0xc43a9e,'yamlConfig':_0x463111,'folderPath':_0x7d7151,'existingSegment':_0x40c8cf,'existingActivations':_0x2dd943,'isNew':_0xcfd9c0[_0x382f15(0x248)],'hasChanges':_0xcfd9c0[_0x382f15(0x26a)],'diff':_0xcfd9c0['diff'],'activationActions':_0x532156});}return{'segmentFiles':_0x5b1d17,'foldersToCreate':_0x4695cb};}export async function prepareJourneyFiles(_0x2169a5,_0x4caca9,_0x5530e8,_0x24fb2e){const _0x40b92b=a140_0x408869,_0x6a65ca=[],_0x5dfba6=new Set();for(const {yamlConfig:_0x2fee0d,folderPath:_0x4881b9,sourcePath:_0x7dd2aa}of _0x2169a5){const _0x1b9831=resolveTDFolderPath(_0x4881b9,_0x5530e8,_0x24fb2e),_0x145425=_0x1b9831+':'+_0x2fee0d['name'],_0x5e8f81=_0x4caca9['journeyBundlesByFolderAndName'][_0x40b92b(0x1f1)](_0x145425);let _0x17bebc,_0x22857f;if(_0x5e8f81&&_0x5e8f81[_0x40b92b(0x280)]>0x0){const _0x5d3a5d=buildLocalExpandedRuleMappings(_0x2fee0d),{createYamlContext:_0x4228ac,prefetchJourneySegments:_0x40b233}=createPushYamlContextForBundle(_0x4caca9[_0x40b92b(0x20e)],_0x4caca9['parentId'],_0x4caca9[_0x40b92b(0x206)],_0x5d3a5d,_0x4caca9[_0x40b92b(0x1d8)],_0x4caca9[_0x40b92b(0x1e7)],_0x4caca9['activationStepsById'],_0x4caca9[_0x40b92b(0x1d5)]);await _0x40b233(_0x5e8f81[_0x40b92b(0x268)](_0x38eab3=>_0x38eab3['id']));const _0x9cf118=await _0x4caca9[_0x40b92b(0x20e)][_0x40b92b(0x25f)]['getLatestJourneyId'](_0x5e8f81[0x0][_0x40b92b(0x18b)]),_0x435e48=hasMultipleVersions(_0x2fee0d),_0x4074c7=async _0x402841=>{const _0x3dc4c2=_0x40b92b,_0x5fa100=_0x4caca9['journeyById']?.['get'](_0x402841);if(_0x5fa100)return _0x5fa100;return _0x4caca9[_0x3dc4c2(0x204)]({'journeyId':_0x402841,'journeyName':_0x2fee0d[_0x3dc4c2(0x265)],'isMultiVersion':_0x5e8f81[_0x3dc4c2(0x280)]>0x1});};if(_0x435e48&&_0x5e8f81[_0x40b92b(0x280)]>0x1){const _0x1457c8=[];for(const _0x57d5b4 of _0x5e8f81){const _0x81ee13=_0x57d5b4[_0x40b92b(0x1e4)]||0x1;_0x4caca9[_0x40b92b(0x272)]?.['update']('Fetching\x20'+_0x2fee0d[_0x40b92b(0x265)]+'\x20v'+_0x81ee13);const _0x133aaf=await _0x4074c7(_0x57d5b4['id']),_0x84c6e9=_0x4228ac(_0x57d5b4['id']),_0x2436bc=await journeyResponseToDef(_0x133aaf,_0x84c6e9);_0x1457c8[_0x40b92b(0x1aa)]({'item':_0x57d5b4,'yaml':_0x2436bc});}const _0x49013e=buildLocalRuleToNameMappingFromJourney(_0x2fee0d);_0x22857f=buildMergedJourneyDef(_0x1457c8,_0x49013e,_0x9cf118);const _0x40b2e6=Math[_0x40b92b(0x1db)](..._0x1457c8['map'](_0x2134e9=>_0x2134e9[_0x40b92b(0x26d)][_0x40b92b(0x1e4)]||0x0)),_0x123f93=_0x5e8f81['find'](_0x2fd038=>(_0x2fd038['versionNumber']||0x0)===_0x40b2e6);_0x123f93&&(_0x4caca9[_0x40b92b(0x272)]?.[_0x40b92b(0x250)](_0x40b92b(0x23b)+_0x2fee0d[_0x40b92b(0x265)]+'\x20v'+_0x40b2e6),_0x17bebc=await _0x4074c7(_0x123f93['id']));}else{const _0x527beb=_0x5e8f81[_0x5e8f81[_0x40b92b(0x280)]-0x1];_0x4caca9[_0x40b92b(0x272)]?.[_0x40b92b(0x250)](_0x40b92b(0x23b)+_0x2fee0d['name']),_0x17bebc=await _0x4074c7(_0x527beb['id']);const _0x216b66=_0x4228ac(_0x527beb['id']),_0x47c23c=await journeyResponseToDef(_0x17bebc,_0x216b66),_0xb443ed=buildLocalRuleToNameMappingFromJourney(_0x2fee0d);_0x22857f=buildMergedJourneyDef([{'item':_0x527beb,'yaml':_0x47c23c}],_0xb443ed,_0x9cf118);}}addFoldersToCreate(_0x1b9831,_0x4caca9[_0x40b92b(0x1ba)],_0x5dfba6);const _0x553bd8=calculateJourneyDiff(_0x2fee0d,_0x22857f);_0x6a65ca[_0x40b92b(0x1aa)]({'relativePath':_0x2fee0d['name'],'absolutePath':_0x7dd2aa,'yamlConfig':_0x2fee0d,'folderPath':_0x1b9831,'existingJourney':_0x17bebc,'isNew':_0x553bd8[_0x40b92b(0x248)],'hasChanges':_0x553bd8[_0x40b92b(0x26a)],'diff':_0x553bd8[_0x40b92b(0x18c)]});}return{'journeyFiles':_0x6a65ca,'foldersToCreate':_0x5dfba6};}export function calculateActivationActions(_0x5c29fb,_0x1aef03,_0x4554f9,_0x6a0ee1){const _0x3f7a0d=a140_0x408869,_0x4cc7a3=[],_0x2c40da=new Map();for(const _0x4cd2c0 of _0x1aef03){_0x2c40da['set'](_0x4cd2c0['name'],_0x4cd2c0);}const _0x1bb9c3=new Map();for(const _0x300a28 of _0x5c29fb){_0x1bb9c3[_0x3f7a0d(0x1f8)](_0x300a28[_0x3f7a0d(0x265)],_0x300a28);}for(const _0x4776fd of _0x5c29fb){const _0x1c2362=_0x2c40da[_0x3f7a0d(0x1f1)](_0x4776fd[_0x3f7a0d(0x265)]);if(!_0x1c2362)_0x4cc7a3['push']({'type':_0x3f7a0d(0x1e9),'name':_0x4776fd['name'],'yamlActivation':_0x4776fd});else{const _0x16a505=activationResponseToDef(_0x1c2362,_0x4554f9,_0x6a0ee1),_0x2a79e1=a140_0x461fde[_0x3f7a0d(0x22c)](_0x16a505),_0x1fbd6e=a140_0x461fde['stringify'](_0x4776fd);_0x2a79e1!==_0x1fbd6e&&_0x4cc7a3[_0x3f7a0d(0x1aa)]({'type':_0x3f7a0d(0x250),'name':_0x4776fd['name'],'yamlActivation':_0x4776fd,'existingActivation':_0x1c2362});}}for(const _0x1ee8fd of _0x1aef03){!_0x1bb9c3['has'](_0x1ee8fd['name'])&&_0x4cc7a3[_0x3f7a0d(0x1aa)]({'type':_0x3f7a0d(0x1b6),'name':_0x1ee8fd[_0x3f7a0d(0x265)],'existingActivation':_0x1ee8fd});}return _0x4cc7a3;}function calculateYamlDiff(_0x35045a,_0x47f825){if(_0x47f825){const _0x5254f9=generateDiff(_0x47f825,_0x35045a),_0x56af0f=hasChanges(_0x5254f9);return{'isNew':![],'hasChanges':_0x56af0f,'diff':_0x56af0f?formatDiffWithColors(_0x5254f9):undefined};}const _0x53ba7f=generateDiff('',_0x35045a);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x53ba7f)};}export function calculateSegmentDiff(_0x418259,_0x12008d,_0x7c64c6,_0x195c5a,_0x43fedb){const _0x57fd0b=segmentToYamlString(_0x418259),_0xc56ecf=_0x12008d?segmentToYamlString(segmentWithActivationsToYaml(_0x12008d,_0x7c64c6,undefined,_0x195c5a,_0x43fedb)):undefined;return calculateYamlDiff(_0x57fd0b,_0xc56ecf);}export function calculateJourneyDiff(_0x7d83ec,_0x4799c6){const _0x134131=normalizeJourneyDef(_0x7d83ec,_0x7d83ec),_0x452e32=a140_0x3add77(_0x134131),_0x5e8d43=_0x4799c6?a140_0x3add77(normalizeJourneyDef(_0x4799c6,_0x7d83ec)):undefined;return calculateYamlDiff(_0x452e32,_0x5e8d43);}export function findSegmentsToDelete(_0x79ab88,_0x4e5206,_0x3c68d2,_0x233aef,_0x38ad64){const _0x5b3aea=a140_0x408869,_0x5efc92=new Set();for(const {yamlConfig:_0x40ce24,folderPath:_0x3fcb0d}of _0x4e5206){_0x5efc92[_0x5b3aea(0x199)](_0x3fcb0d+':'+_0x40ce24['name']);}return _0x79ab88[_0x5b3aea(0x24c)](_0x431e4b=>{const _0x5c69d7=_0x5b3aea,_0x56e81a=_0x431e4b[_0x5c69d7(0x259)]?_0x3c68d2[_0x5c69d7(0x1f1)](_0x431e4b[_0x5c69d7(0x259)][_0x5c69d7(0x205)]())||'':'',_0x5b58e7=_0x56e81a+':'+_0x431e4b[_0x5c69d7(0x265)];if(_0x5efc92[_0x5c69d7(0x1ea)](_0x5b58e7))return![];if(_0x38ad64)return _0x56e81a===_0x233aef||_0x56e81a[_0x5c69d7(0x1d2)](_0x233aef+'/');return!![];});}export function findJourneysToDelete(_0x1dca75,_0x5d338d,_0x3270b1,_0x217cf1,_0x4883ce){const _0x22ad62=a140_0x408869,_0x2ef3d6=new Set();for(const {yamlConfig:_0x23dcbd,folderPath:_0x288634}of _0x5d338d){_0x2ef3d6[_0x22ad62(0x199)](_0x288634+':'+_0x23dcbd[_0x22ad62(0x265)]);}return _0x1dca75[_0x22ad62(0x24c)](_0x52762e=>{const _0x400469=_0x22ad62,_0x2ca7a7=_0x52762e[_0x400469(0x258)]?_0x3270b1[_0x400469(0x1f1)](_0x52762e['folderId'])||'':'',_0x5af57b=_0x2ca7a7+':'+_0x52762e['journeyBundleName'];if(_0x2ef3d6[_0x400469(0x1ea)](_0x5af57b))return![];if(_0x4883ce)return _0x2ca7a7===_0x217cf1||_0x2ca7a7[_0x400469(0x1d2)](_0x217cf1+'/');return!![];});}export function buildSegmentLookupMap(_0x54909b,_0x1a954c){const _0x3be367=a140_0x408869,_0x83739d=new Map();for(const _0x2bd7c0 of _0x54909b){const _0x5e9772=_0x2bd7c0[_0x3be367(0x259)]?_0x1a954c[_0x3be367(0x1f1)](_0x2bd7c0[_0x3be367(0x259)]['toString']())||'':'',_0x149c65=_0x5e9772+':'+_0x2bd7c0[_0x3be367(0x265)];_0x83739d[_0x3be367(0x1f8)](_0x149c65,_0x2bd7c0);}return _0x83739d;}export function buildSegmentNameToIdMap(_0x43a48a){const _0x535ff1=a140_0x408869,_0x253351=new Map();for(const _0x700df8 of _0x43a48a){_0x253351[_0x535ff1(0x1f8)](_0x700df8[_0x535ff1(0x265)],_0x700df8['id']);}return _0x253351;}export function buildJourneyBundleLookupMap(_0x3dcd6a,_0x211277){const _0x4214b1=a140_0x408869,_0x319bd6=new Map();for(const _0x475de9 of _0x3dcd6a){const _0x2c77ce=_0x475de9[_0x4214b1(0x258)]?_0x211277[_0x4214b1(0x1f1)](_0x475de9[_0x4214b1(0x258)])||'':'',_0x100ed5=_0x2c77ce+':'+_0x475de9[_0x4214b1(0x261)];!_0x319bd6[_0x4214b1(0x1ea)](_0x100ed5)&&_0x319bd6[_0x4214b1(0x1f8)](_0x100ed5,[]),_0x319bd6[_0x4214b1(0x1f1)](_0x100ed5)[_0x4214b1(0x1aa)](_0x475de9);}for(const _0x367c4a of _0x319bd6['values']()){_0x367c4a[_0x4214b1(0x191)]((_0x3d00c5,_0x42cfb3)=>(_0x3d00c5[_0x4214b1(0x1e4)]||0x0)-(_0x42cfb3[_0x4214b1(0x1e4)]||0x0));}return _0x319bd6;}export function collectFoldersToCreate(_0x3c06fa,_0x1966b1){const _0x5e7963=a140_0x408869,_0x3e65e8=new Set();for(const _0x5d5ec4 of _0x3c06fa){if(!_0x5d5ec4)continue;if(_0x1966b1[_0x5e7963(0x1ea)](_0x5d5ec4))continue;const _0x2af7d0=_0x5d5ec4[_0x5e7963(0x1dd)]('/');let _0x2a5a98='';for(const _0x57a2b0 of _0x2af7d0){_0x2a5a98=_0x2a5a98?_0x2a5a98+'/'+_0x57a2b0:_0x57a2b0,!_0x1966b1[_0x5e7963(0x1ea)](_0x2a5a98)&&_0x3e65e8[_0x5e7963(0x199)](_0x2a5a98);}}return _0x3e65e8;}export function parseAndClassifyYamlFiles(_0x54b0d9,_0x8b9f5b,_0x4f5432){const _0x4db2f6=a140_0x408869,_0x44f86e=[],_0x175be3=[];for(const _0x128fb9 of _0x54b0d9){const _0x4432f7=a140_0x44127b[_0x4db2f6(0x1e5)](_0x8b9f5b,a140_0x44127b[_0x4db2f6(0x223)](_0x128fb9)),_0x18edb9=_0x4432f7==='.'?'':_0x4432f7,_0x2b4163=readFileSync(_0x128fb9,'utf-8'),_0xad17f6=a140_0x461fde[_0x4db2f6(0x193)](_0x2b4163);if(isJourneyDef(_0xad17f6)){const _0xdf2c44=a140_0x190f74(_0x2b4163);_0x175be3[_0x4db2f6(0x1aa)]({'yamlConfig':_0xdf2c44,'folderPath':_0x18edb9,'sourcePath':_0x128fb9});}else{if(!_0x4f5432?.['skipSegments']){const _0x315f90=parseSegmentYamlFile(_0x2b4163),_0x20bcab=normalizeChildSegmentYaml(_0x315f90);_0x44f86e[_0x4db2f6(0x1aa)]({'yamlConfig':_0x20bcab,'folderPath':_0x18edb9,'sourcePath':_0x128fb9});}}}return{'segments':_0x44f86e,'journeys':_0x175be3};}export function validateParsedFiles(_0x2b4ecb,_0x16e1aa){const _0x27f35e=a140_0x408869,_0x53d608=[];for(const {yamlConfig:_0x47ddde,sourcePath:_0x2f06a3}of _0x2b4ecb[_0x27f35e(0x241)]){const _0xc36b00=readFileSync(_0x2f06a3,_0x27f35e(0x1fd)),_0x105b44=a140_0x461fde['parseDocument'](_0xc36b00),_0x3e05e5=validateSegmentDef(_0x47ddde,{'source':_0xc36b00,'document':_0x105b44},{'skipSchema':!![]});if(!_0x3e05e5['valid']){const _0x44851a=a140_0x44127b[_0x27f35e(0x1e5)](_0x16e1aa,_0x2f06a3);_0x53d608[_0x27f35e(0x1aa)]({'filePath':_0x44851a,'source':_0xc36b00,'result':_0x3e05e5,'isJourney':![]});}}for(const {yamlConfig:_0x16b271,sourcePath:_0x2bfe37}of _0x2b4ecb[_0x27f35e(0x1f9)]){const _0x4670ae=readFileSync(_0x2bfe37,_0x27f35e(0x1fd)),_0x38d39a=a140_0x461fde['parseDocument'](_0x4670ae),_0x13fc84=validateJourneyDef(_0x16b271,{'source':_0x4670ae,'document':_0x38d39a},{'skipSchema':!![]});if(!_0x13fc84[_0x27f35e(0x1b2)]){const _0x49f057=a140_0x44127b[_0x27f35e(0x1e5)](_0x16e1aa,_0x2bfe37);_0x53d608['push']({'filePath':_0x49f057,'source':_0x4670ae,'result':_0x13fc84,'isJourney':!![]});}}return _0x53d608;}export function formatValidationErrors(_0x21ca1e){const _0xd92b1b=a140_0x408869,_0x142b69=[];for(const {filePath:_0x483395,source:_0x462df8,result:_0x36ce96,isJourney:_0x2b945a}of _0x21ca1e){const _0x4a4d17=_0x2b945a?_0xd92b1b(0x25f):_0xd92b1b(0x22d);_0x142b69[_0xd92b1b(0x1aa)]('\x0a'+_0x483395+'\x20('+_0x4a4d17+_0xd92b1b(0x203)+_0x36ce96[_0xd92b1b(0x1a6)]['length']+_0xd92b1b(0x25b)),_0x142b69[_0xd92b1b(0x1aa)](formatValidationResult(_0x36ce96,_0x462df8,_0x483395));}return _0x142b69[_0xd92b1b(0x1cc)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x370202){const _0x385f8a=a140_0x408869,_0x597ff7=new Set(),_0x429f2c=new Map(),_0x872cd6=collectSegmentUsageCounts(_0x370202);if(_0x370202['segments'])for(const [_0x59a085,_0x1b0c01]of Object[_0x385f8a(0x18f)](_0x370202[_0x385f8a(0x241)])){_0x597ff7[_0x385f8a(0x199)](_0x59a085);if(_0x1b0c01[_0x385f8a(0x219)]){const _0x3dec84=yamlRuleToApi(_0x1b0c01[_0x385f8a(0x219)]),_0x47ebd8=apiRuleToYaml(_0x3dec84);_0x429f2c[_0x385f8a(0x1f8)](_0x59a085,_0x47ebd8);}}const _0x15280e=new Map();let _0x5818bb=0x0;for(const [_0x10be46,_0x5b8537]of _0x429f2c){const _0x5ced2b=serializeExpandedRule(_0x5b8537,_0x429f2c),_0x24bbee=_0x15280e[_0x385f8a(0x1f1)](_0x5ced2b)||[];_0x24bbee[_0x385f8a(0x1aa)]({'name':_0x10be46,'index':_0x5818bb}),_0x15280e[_0x385f8a(0x1f8)](_0x5ced2b,_0x24bbee),_0x5818bb++;}const _0x3676c5=new Map();for(const [_0x3fb60f,_0x12f6bb]of _0x15280e){const _0xc041d6=_0x12f6bb[_0x385f8a(0x282)]()[_0x385f8a(0x191)]((_0x13cb74,_0x255ccf)=>{const _0x3f25f7=_0x385f8a,_0x732471=_0x872cd6[_0x3f25f7(0x1f1)](_0x13cb74['name'])||0x0,_0x4a0d38=_0x872cd6[_0x3f25f7(0x1f1)](_0x255ccf[_0x3f25f7(0x265)])||0x0;if(_0x732471!==_0x4a0d38)return _0x4a0d38-_0x732471;return _0x13cb74['index']-_0x255ccf[_0x3f25f7(0x202)];})['map'](_0x28b0ba=>_0x28b0ba[_0x385f8a(0x265)]),_0xa95e19=[];for(const _0x938472 of _0xc041d6){const _0x1b6836=_0x872cd6[_0x385f8a(0x1f1)](_0x938472)||0x0,_0x1225aa=Math[_0x385f8a(0x1db)](_0x1b6836,0x1);for(let _0x13466e=0x0;_0x13466e<_0x1225aa;_0x13466e++){_0xa95e19['push'](_0x938472);}}_0x3676c5[_0x385f8a(0x1f8)](_0x3fb60f,_0xa95e19);}return{'existingLocalSegmentNames':_0x597ff7,'localSegmentRules':_0x429f2c,'localExpandedRuleToNames':_0x3676c5};}export function createSegmentIdResolver(_0xc1b9fa,_0x261ebb){return async _0x2d2dca=>{const _0x431e95=a140_0x340f,_0x162e85=_0xc1b9fa[_0x431e95(0x1f1)](_0x2d2dca);if(!_0x162e85)throw new SDKError(ErrorCode[_0x431e95(0x214)],_0x431e95(0x27e)+_0x2d2dca+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x261ebb+'\x27)');return _0x162e85;};}function a140_0x54fe(){const _0x160728=['embedded_segment_created','find','activation_deleting','progress','__pending_act_','Activation\x20not\x20found:\x20','resolvedRule','Failed\x20to\x20fetch\x20referenced\x20segment\x20','nameToType','./journey-yaml.js','connection','createdSegmentId','digest','state','waitStep','Segment\x20not\x20found:\x20','journey_updating','length','activationParams','slice','listActivations','124194iMOnfQ','\x27\x20exit\x20criteria','action','keys','activation_updating','waitStepType','stages','yamlConfig','journeyBundleId','diff','JOURNEY_UPDATE_ERROR','parentId','entries','activationContext','sort','message','parse','localName','trim','journey_created','Stage\x20\x27','Entry\x20criteria:\x20','add','\x27\x20for\x20','embeddedSegmentNameToId','JOURNEY_SYNTAX_ERROR','SEGMENT_SYNTAX_ERROR','ACTIVATION_UPDATE_ERROR','kind','from','createJourneySegment','rootFolderId','flatMap','conditionSegmentId','hex','errors','verbose','1498440PMMyyT','logSuccess','push','segment_updated','size','Deleted\x20activation\x20\x27','getSegmentEntity\x20also\x20failed\x20for\x20','logInfo','Activation','folderPath','valid','effectiveFolderId','activation_','all_columns','delete','updateSegmentById','Creating\x20folder\x20\x27','behavior','folderPathToId','embedded_activation_created','draft','debug','attributes','replace','description','journeyActivationNameToId','decision_point','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','entry_criteria','2354648mCXpJJ','folder_creating','\x27\x20from\x20file:\x20','INTERNAL','goal','104987CeYqQy','user','join','\x0a\x20\x20','type','activation_deleted','Updated\x20activation\x20\x27','isArray','startsWith','Name\x20has\x20already\x20been\x20taken','segmentId','journeyById','journey_updated','14EJunFb','idToEmailMap','parentSegmentFolder','../../utils/async.js','max','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','split','\x20journey\x20from\x20file:\x20','createActivation','journeyId','goal\x20criteria','conditions','Created\x20folder\x20\x27','versionNumber','relative','parentFolder','connectionIdToNameMap','Updated\x20segment\x20\x27','create','has','onProgress','toISOString','130VnTTnN','deleted','getSegment','embedded_activation_creating','get','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','conditionTimeoutUnit','Created\x20activation\x20\x27','embedded_segment_creating','WaitStep','Failed\x20to\x20resolve\x20activation\x20','set','journeys','segment_deleting','Failed\x20to\x20','connector_config','utf-8','run_after_journey_refresh','with','segmentByFolderAndName','logWarning','index','):\x20','fetchJourney','toString','existingSegments','./child-segment-yaml.js','activation_creating','\x27\x20to\x20local\x20\x27','activations','journeyName','notification','journeyActivationStepId','deps','waitStepUnit','buildUserMaps','validatedRequest','createdSegmentIds','yamlActivation','SEGMENT_NOT_FOUND','NOT_FOUND','tdx.sdk.push-workflow','results','toLowerCase','rule','Duration','match','schedule','absolutePath','existingActivation','\x20segment\x20from\x20file:\x20','1329888QbhJuk','Deleting\x20activation\x20\x27','existingJourney','dirname','1559724CuWbhJ','segment_created','segment_updating','data','Condition','and\x20the\x20server\x20segment,\x20then\x20retry.','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','3Nfaxaa','stringify','segment','steps','entry','reduce','__pending_','\x27...','activationActions','updated','Deleted\x20segment\x20\x27','entryCriteria','Delete\x20the\x20push\x20recovery\x20file\x20(','segmentNameToId',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','10wpcYqA','Fetching\x20','idToName','list','ACTIVATION_SYNTAX_ERROR','journeyStages','\x27\x20by\x20rule\x20content','segments','getJourney','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','DecisionPoint','relationships','.$1.push-recovery.json','all','isNew','Matched\x20server\x20segment\x20\x27','logDeleted','unchanged','filter','Journey\x20\x27',').\x20','activation_template_id','update','conditionTimeoutDuration','stage\x20\x27','existingSegment','created','getActivation','\x20(referenced\x20in\x20journey\x20','resolveJourneyId','folderId','segmentFolderId','Updating\x20activation\x20\x27','\x20error(s)','some','99QKACnd','uniqueServerName','journey','191862KhbwGT','journeyBundleName','branches','Creating\x20segment\x20\x27','exitCriterias','name','withProgress','deleteSegment','map','createSegment','hasChanges','uniqueSegmentName','milestone','item','SEGMENT_UPDATE_ERROR'];a140_0x54fe=function(){return _0x160728;};return a140_0x54fe();}export function extractRootFolderId(_0x4f22e3){const _0x47a9c5=a140_0x408869;return _0x4f22e3[_0x47a9c5(0x245)]?.[_0x47a9c5(0x1d9)]?.['data']?.['id']||_0x4f22e3[_0x47a9c5(0x245)]?.[_0x47a9c5(0x1e6)]?.[_0x47a9c5(0x227)]?.['id'];}export function buildConnectionMaps(_0x5bd74d){const _0x5c9903=a140_0x408869,_0x553d89=new Map(),_0x67023d=new Map(),_0x3ec7a3=new Map();for(const _0x59ba8e of _0x5bd74d){_0x553d89['set'](_0x59ba8e[_0x5c9903(0x265)],parseInt(_0x59ba8e['id'],0xa)),_0x67023d[_0x5c9903(0x1f8)](_0x59ba8e['id'],_0x59ba8e['name']),_0x3ec7a3[_0x5c9903(0x1f8)](_0x59ba8e[_0x5c9903(0x265)],_0x59ba8e[_0x5c9903(0x1ce)]);}return{'nameToId':_0x553d89,'idToName':_0x67023d,'nameToType':_0x3ec7a3};}export function calculatePushStats(_0x4a23a6,_0x122cb1,_0x45df88,_0x2e8de1,_0x19707d,_0x5b9420,_0x3d9843){const _0x133d99=a140_0x408869,_0x4b12c0=_0x4a23a6[_0x133d99(0x24c)](_0x36370c=>_0x36370c[_0x133d99(0x248)]),_0x236323=_0x4a23a6[_0x133d99(0x24c)](_0x7d55b3=>!_0x7d55b3[_0x133d99(0x248)]&&_0x7d55b3['hasChanges']),_0x440a0a=_0x4a23a6[_0x133d99(0x24c)](_0xaf2fbc=>!_0xaf2fbc[_0x133d99(0x248)]&&!_0xaf2fbc['hasChanges']),_0x23c715=_0x5b9420?_0x2e8de1:[],_0x48c00b=_0x122cb1[_0x133d99(0x24c)](_0x3fcd43=>_0x3fcd43['isNew']),_0xbcd41a=_0x122cb1[_0x133d99(0x24c)](_0x33846d=>!_0x33846d[_0x133d99(0x248)]&&_0x33846d[_0x133d99(0x26a)]),_0x38599=_0x122cb1['filter'](_0x337ed5=>!_0x337ed5[_0x133d99(0x248)]&&!_0x337ed5[_0x133d99(0x26a)]),_0x2bce97=_0x5b9420?_0x19707d:[],_0x3232ad=_0x4a23a6[_0x133d99(0x1a3)](_0x21956b=>_0x21956b[_0x133d99(0x233)]),_0x35dab7=_0x3232ad[_0x133d99(0x24c)](_0x2de1ea=>_0x2de1ea[_0x133d99(0x1ce)]===_0x133d99(0x1e9)),_0x4603d7=_0x3232ad[_0x133d99(0x24c)](_0x428486=>_0x428486[_0x133d99(0x1ce)]==='update'),_0x48e700=_0x3232ad[_0x133d99(0x24c)](_0x5ec09c=>_0x5ec09c['type']===_0x133d99(0x1b6)),_0x26227c=Array[_0x133d99(0x1a0)](_0x45df88)[_0x133d99(0x191)](),_0xd1a20c=_0x3d9843?![]:_0x4b12c0['length']>0x0||_0x236323[_0x133d99(0x280)]>0x0||_0x23c715[_0x133d99(0x280)]>0x0,_0x362c1a=_0x48c00b[_0x133d99(0x280)]>0x0||_0xbcd41a[_0x133d99(0x280)]>0x0||_0x2bce97['length']>0x0,_0x26254d=_0x3d9843?![]:_0x3232ad['length']>0x0,_0x55a573=_0x26227c[_0x133d99(0x280)]>0x0;return{'segments':{'new':_0x4b12c0,'changed':_0x236323,'unchanged':_0x440a0a,'toDelete':_0x23c715},'journeys':{'new':_0x48c00b,'changed':_0xbcd41a,'unchanged':_0x38599,'toDelete':_0x2bce97},'activations':{'all':_0x3232ad,'toCreate':_0x35dab7,'toUpdate':_0x4603d7,'toDelete':_0x48e700},'folders':{'toCreate':_0x26227c},'counts':{'segments':{'new':_0x4b12c0[_0x133d99(0x280)],'changed':_0x236323['length'],'unchanged':_0x440a0a[_0x133d99(0x280)],'toDelete':_0x23c715[_0x133d99(0x280)]},'journeys':{'new':_0x48c00b[_0x133d99(0x280)],'changed':_0xbcd41a[_0x133d99(0x280)],'unchanged':_0x38599[_0x133d99(0x280)],'toDelete':_0x2bce97['length']},'activations':{'create':_0x35dab7[_0x133d99(0x280)],'update':_0x4603d7[_0x133d99(0x280)],'delete':_0x48e700[_0x133d99(0x280)]},'folders':_0x26227c['length']},'hasChanges':_0xd1a20c||_0x362c1a||_0x26254d||_0x55a573};}export async function buildPushExecutionContext(_0x13350d,_0x370804,_0x1550e7,_0x2cf5e0,_0x21581a,_0x33424c){const _0x467408=a140_0x408869,_0x3ba13a=extractRootFolderId(_0x1550e7),{pathToId:_0x26de1f,idToPath:_0x258e3c}=buildFolderMaps(_0x21581a),_0x24fdb9=buildSegmentNameToIdMap(_0x2cf5e0),_0x5988f6=new Map(),{batchAsync:_0x5a96a2}=await import(_0x467408(0x1da)),[_0x2fafc2,_0x8f6585]=await Promise[_0x467408(0x247)]([_0x13350d[_0x467408(0x1cb)][_0x467408(0x210)](),_0x13350d[_0x467408(0x279)][_0x467408(0x23d)](),((async()=>{const _0x2b21ef=_0x467408;!_0x33424c&&_0x2cf5e0[_0x2b21ef(0x280)]>0x0&&await _0x5a96a2(_0x2cf5e0,async _0x588564=>{const _0x16428f=_0x2b21ef,_0x58a967=await _0x13350d['segment'][_0x16428f(0x283)](_0x370804,_0x588564['id']);_0x5988f6[_0x16428f(0x1f8)](_0x588564['id'],_0x58a967);});})())]),{emailToId:_0x2e766b,idToEmail:_0x43df6a}=_0x2fafc2,_0x37b1de=buildConnectionMaps(_0x8f6585);return{'rootFolderId':_0x3ba13a,'folderPathToId':_0x26de1f,'folderIdToPath':_0x258e3c,'segmentNameToId':_0x24fdb9,'activationsBySegmentId':_0x5988f6,'emailToIdMap':_0x2e766b,'idToEmailMap':_0x43df6a,'connectionNameToIdMap':_0x37b1de['nameToId'],'connectionIdToNameMap':_0x37b1de[_0x467408(0x23c)],'connectionNameToTypeMap':_0x37b1de[_0x467408(0x277)]};}export function createPushYamlContextForBundle(_0x47dd27,_0x377fd5,_0x1b4711,_0x1aba2c,_0x39785b,_0x2fe1ad,_0x47d169,_0x30831a){const {existingLocalSegmentNames:_0x2e104c,localExpandedRuleToNames:_0x1484b7}=_0x1aba2c,_0x364e67=new Set(),_0x24171e=new Map(),_0x46f883=new Map(),_0x1d11a7=new Map(),_0x4c3fd5=createJumpTargetCache(),_0xe92fa=new Map(),_0x4c3d4b=new Map(),_0x13ce04=new Set();let _0x15ad85;const _0x12eb6c=_0x44fdb8=>{const _0xf865e9={'resolveSegment':async _0x375e9a=>{const _0x4df532=a140_0x340f,_0x253289=_0x1d11a7[_0x4df532(0x1f1)](_0x375e9a);if(_0x253289!==undefined)return{'name':_0x253289,'isJourneyLocal':!![]};try{const _0x37e0a0=await fetchSegment(_0x47dd27,_0x377fd5,_0x375e9a,_0x1b4711);if(!_0x37e0a0)throw new Error('Segment\x20not\x20found');const _0x13f8f6=generateJourneyLocalName(_0x37e0a0[_0x4df532(0x265)]),_0x5e166d=_0x37e0a0[_0x4df532(0x19f)]===SEGMENT_KIND_JOURNEY&&_0x13f8f6!==undefined;let _0x21f8fe=_0x37e0a0[_0x4df532(0x265)],_0x31845a;if(_0x5e166d&&_0x37e0a0[_0x4df532(0x219)]){const _0xafe54c=apiRuleToYaml(_0x37e0a0[_0x4df532(0x219)]);_0x4c3d4b['set'](_0x375e9a,_0xafe54c);const _0x2212c4=async _0xf2fcc1=>{const _0x3aa59b=_0x4df532,_0x2092a5=collectSegmentRefsFromRule(_0xf2fcc1);for(const _0x4167ca of _0x2092a5){if(!_0x4c3d4b[_0x3aa59b(0x1ea)](_0x4167ca))try{const _0x55f1f2=await fetchSegment(_0x47dd27,_0x377fd5,_0x4167ca,_0x1b4711);if(_0x55f1f2?.[_0x3aa59b(0x219)]){const _0x3a7e83=apiRuleToYaml(_0x55f1f2[_0x3aa59b(0x219)]);_0x4c3d4b[_0x3aa59b(0x1f8)](_0x4167ca,_0x3a7e83),await _0x2212c4(_0x3a7e83);}}catch(_0x19dc1e){logger['debug'](_0x3aa59b(0x276)+_0x4167ca+':\x20'+_0x19dc1e);}}};await _0x2212c4(_0xafe54c);const _0x3db902=serializeExpandedRule(_0xafe54c,_0x4c3d4b),_0x4a83a2=_0x1484b7[_0x4df532(0x1f1)](_0x3db902);if(_0x4a83a2&&_0x4a83a2['length']>0x0){const _0x163f4e=_0x24171e[_0x4df532(0x1f1)](_0x3db902)||0x0,_0x41f741=_0x4a83a2[_0x163f4e]||_0x4a83a2[_0x4a83a2[_0x4df532(0x280)]-0x1];_0x24171e['set'](_0x3db902,_0x163f4e+0x1),_0x21f8fe=_0x41f741,_0x364e67[_0x4df532(0x199)](_0x21f8fe),_0x1d11a7[_0x4df532(0x1f8)](_0x375e9a,_0x21f8fe);const _0x23fe60=await resolveRuleSegmentRefs(_0xafe54c,async _0x17287d=>{const _0x493ea8=_0x4df532,_0x2063af=_0x1d11a7[_0x493ea8(0x1f1)](_0x17287d);if(_0x2063af)return _0x2063af;const _0x3737a8=await _0x15ad85['resolveSegment'](_0x17287d);return _0x3737a8[_0x493ea8(0x265)];});_0x31845a={'description':_0x37e0a0[_0x4df532(0x1c0)],'rule':_0x23fe60};}else{const _0x345271=_0xe92fa[_0x4df532(0x1f1)](_0x3db902);if(_0x345271)_0x21f8fe=_0x345271,_0x1d11a7[_0x4df532(0x1f8)](_0x375e9a,_0x21f8fe);else{if(_0x13f8f6){let _0x9db22c=_0x13f8f6,_0x4f1bd6=0x2;while(_0x364e67[_0x4df532(0x1ea)](_0x9db22c)||_0x2e104c[_0x4df532(0x1ea)](_0x9db22c)){_0x9db22c=_0x13f8f6+'_'+_0x4f1bd6,_0x4f1bd6++;}_0x364e67['add'](_0x9db22c),_0x21f8fe=_0x9db22c;}_0x1d11a7[_0x4df532(0x1f8)](_0x375e9a,_0x21f8fe),_0xe92fa['set'](_0x3db902,_0x21f8fe);const _0x2525d5=await resolveRuleSegmentRefs(_0xafe54c,async _0x6be67e=>{const _0xc0cde6=_0x4df532,_0x366823=_0x1d11a7[_0xc0cde6(0x1f1)](_0x6be67e);if(_0x366823)return _0x366823;const _0x2bb36b=await _0x15ad85['resolveSegment'](_0x6be67e);return _0x2bb36b[_0xc0cde6(0x265)];});_0x31845a={'description':_0x37e0a0['description'],'rule':_0x2525d5};}}}return{'name':_0x21f8fe,'isJourneyLocal':_0x5e166d,'definition':_0x31845a};}catch(_0xdc4d5e){return logger[_0x4df532(0x1bd)]('Failed\x20to\x20resolve\x20segment\x20'+_0x375e9a+':\x20'+_0xdc4d5e),{'name':_0x375e9a,'isJourneyLocal':![]};}},'resolveActivation':async _0x52487d=>{const _0x2aeb05=a140_0x340f,_0x6f6974=_0x46f883['get'](_0x52487d);if(_0x6f6974!==undefined)return{'name':_0x6f6974,'isJourneyLocal':!![]};try{let _0x5c0234=_0x47d169?.[_0x2aeb05(0x1f1)](_0x52487d);!_0x5c0234&&(_0x5c0234=await _0x47dd27[_0x2aeb05(0x25f)][_0x2aeb05(0x255)](_0x44fdb8,_0x52487d));const _0x7ceac6=_0x5c0234[_0x2aeb05(0x1be)][_0x2aeb05(0x281)][_0x2aeb05(0x265)]||_0x52487d,_0x319e66=sanitizeYamlKey(_0x7ceac6)||_0x2aeb05(0x1b4)+_0x52487d,_0x98f7dd=_0x319e66;_0x46f883[_0x2aeb05(0x1f8)](_0x52487d,_0x98f7dd);const _0x3365bc=journeyActivationStepToYaml(_0x5c0234,_0x39785b,_0x2fe1ad);return{'name':_0x98f7dd,'isJourneyLocal':!![],'definition':_0x3365bc};}catch(_0xe666af){return logger['debug'](_0x2aeb05(0x1f7)+_0x52487d+':\x20'+_0xe666af),{'name':_0x52487d,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x2575b2,_0x5ebbd7)=>resolveJumpTarget(_0x2575b2,_0x5ebbd7,_0x4c3fd5,async _0x4de4a2=>{const _0x25c8af=a140_0x340f,_0x2ecca1=_0x30831a?.['get'](_0x4de4a2);if(_0x2ecca1)return _0x2ecca1;return _0x47dd27[_0x25c8af(0x25f)][_0x25c8af(0x242)](_0x4de4a2);})};return _0x15ad85=_0xf865e9,_0xf865e9;},_0x3cd1fb=async _0xb32686=>{const _0x1f9131=a140_0x340f,{collectSegmentIdsFromJourneyApi:_0xb09066}=await import(_0x1f9131(0x278)),{batchAsync:_0x42f35f}=await import(_0x1f9131(0x1da)),_0x7ba163=new Set();for(const _0x58619f of _0xb32686){let _0x5daddc=_0x30831a?.[_0x1f9131(0x1f1)](_0x58619f);!_0x5daddc&&(_0x5daddc=await _0x47dd27[_0x1f9131(0x25f)][_0x1f9131(0x242)](_0x58619f));const _0x2bd285=_0xb09066(_0x5daddc);for(const _0x3a0574 of _0x2bd285){_0x7ba163[_0x1f9131(0x199)](_0x3a0574);}}let _0x20fd80=Array[_0x1f9131(0x1a0)](_0x7ba163);while(_0x20fd80[_0x1f9131(0x280)]>0x0){const _0x3970d0=_0x20fd80[_0x1f9131(0x24c)](_0x22da42=>!_0x13ce04['has'](_0x22da42));if(_0x3970d0['length']===0x0)break;const _0x188f14=await _0x42f35f(_0x3970d0,async _0x131e45=>{const _0x57ba8d=_0x1f9131;_0x13ce04[_0x57ba8d(0x199)](_0x131e45);const _0x5770c0=await fetchSegment(_0x47dd27,_0x377fd5,_0x131e45,_0x1b4711);if(!_0x5770c0)return null;return{'segmentId':_0x131e45,'segment':_0x5770c0};},0xa),_0x2657bd=new Set();for(const _0x256dc1 of _0x188f14){if(!_0x256dc1?.[_0x1f9131(0x22d)]?.['rule'])continue;const _0x1ff6eb=apiRuleToYaml(_0x256dc1[_0x1f9131(0x22d)][_0x1f9131(0x219)]);_0x4c3d4b[_0x1f9131(0x1f8)](_0x256dc1[_0x1f9131(0x1d4)],_0x1ff6eb);const _0x557af2=collectSegmentRefsFromRule(_0x1ff6eb);for(const _0x3be995 of _0x557af2){!_0x13ce04[_0x1f9131(0x1ea)](_0x3be995)&&_0x2657bd[_0x1f9131(0x199)](_0x3be995);}}_0x20fd80=Array[_0x1f9131(0x1a0)](_0x2657bd);}};return{'createYamlContext':_0x12eb6c,'prefetchJourneySegments':_0x3cd1fb};}export async function executePushSegments(_0x1f6af0,_0x40888d,_0xfecb41,_0x31cbe1,_0x40bd2e){const _0x1341ab=a140_0x408869,{segmentDefToCreateRequest:_0x2826f9,segmentDefToUpdateRequest:_0x1c9ff7}=await import(_0x1341ab(0x207)),_0x15692c=_0xfecb41[_0x1341ab(0x1ba)],_0x3b32ab=0x5,_0x587ba4=async _0x1d02a3=>{const _0x3f4437=_0x1341ab,_0x57b804=_0x1d02a3['folderPath']?_0x15692c[_0x3f4437(0x1f1)](_0x1d02a3[_0x3f4437(0x1b1)]):undefined;let _0x562e94;const _0x296e9c={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x681bf5=_0x1d02a3['yamlConfig'];if(_0x1d02a3[_0x3f4437(0x18a)]['rule']){const _0x133690=createSegmentIdResolver(_0xfecb41[_0x3f4437(0x238)],_0x1d02a3['yamlConfig'][_0x3f4437(0x265)]),_0x4b43af=await resolveRuleSegmentIds(_0x1d02a3['yamlConfig']['rule'],_0x133690);_0x681bf5={..._0x1d02a3[_0x3f4437(0x18a)],'rule':_0x4b43af};}try{if(_0x1d02a3['isNew']){_0x40bd2e[_0x3f4437(0x1eb)]?.({'type':'segment_creating','name':_0x1d02a3[_0x3f4437(0x18a)][_0x3f4437(0x265)]});const _0x2b927e=_0x2826f9(_0x681bf5,_0x57b804),_0x54b829=await _0x40bd2e[_0x3f4437(0x266)](_0x3f4437(0x263)+_0x1d02a3[_0x3f4437(0x18a)]['name']+_0x3f4437(0x232),()=>_0x1f6af0[_0x3f4437(0x22d)][_0x3f4437(0x269)](_0x31cbe1['parentId'],_0x2b927e));_0x562e94=_0x54b829[_0x3f4437(0x227)]['id'],_0xfecb41[_0x3f4437(0x238)][_0x3f4437(0x1f8)](_0x1d02a3['yamlConfig'][_0x3f4437(0x265)],_0x562e94),_0x296e9c['createdSegmentId']={'name':_0x1d02a3[_0x3f4437(0x18a)]['name'],'id':_0x562e94},_0x40bd2e['onProgress']?.({'type':_0x3f4437(0x225),'name':_0x1d02a3[_0x3f4437(0x18a)][_0x3f4437(0x265)],'segmentId':_0x562e94}),_0x40bd2e[_0x3f4437(0x1a9)]?.('Created\x20segment\x20\x27'+_0x1d02a3[_0x3f4437(0x18a)][_0x3f4437(0x265)]+'\x27'),_0x296e9c['created']=0x1;}else{if(_0x1d02a3[_0x3f4437(0x26a)]){_0x40bd2e[_0x3f4437(0x1eb)]?.({'type':_0x3f4437(0x226),'name':_0x1d02a3[_0x3f4437(0x18a)]['name']});const _0x59f4b2=_0x1c9ff7(_0x681bf5);_0x57b804!==_0x1d02a3['existingSegment']?.['segmentFolderId']&&(_0x59f4b2[_0x3f4437(0x259)]=_0x57b804?parseInt(_0x57b804,0xa):undefined),await _0x40bd2e['withProgress']('Updating\x20segment\x20\x27'+_0x1d02a3[_0x3f4437(0x18a)][_0x3f4437(0x265)]+'\x27...',()=>_0x1f6af0[_0x3f4437(0x22d)][_0x3f4437(0x1b7)](_0x31cbe1[_0x3f4437(0x18e)],_0x1d02a3[_0x3f4437(0x253)]['id'],_0x59f4b2)),_0x562e94=_0x1d02a3[_0x3f4437(0x253)]['id'],_0x40bd2e['onProgress']?.({'type':_0x3f4437(0x1ab),'name':_0x1d02a3[_0x3f4437(0x18a)][_0x3f4437(0x265)]}),_0x40bd2e[_0x3f4437(0x1a9)]?.(_0x3f4437(0x1e8)+_0x1d02a3[_0x3f4437(0x18a)]['name']+'\x27'),_0x296e9c['updated']=0x1;}else _0x562e94=_0x1d02a3[_0x3f4437(0x253)]['id'];}}catch(_0x5cbbe6){const _0x27abc8=isHttp400Error(_0x5cbbe6),_0x35669c=_0x27abc8?ErrorCode[_0x3f4437(0x19d)]:ErrorCode[_0x3f4437(0x26e)],_0x45a969=getErrorMessage(_0x5cbbe6);throw new SDKError(_0x35669c,_0x3f4437(0x1fb)+(_0x1d02a3[_0x3f4437(0x248)]?_0x3f4437(0x1e9):_0x3f4437(0x250))+_0x3f4437(0x21f)+_0x1d02a3[_0x3f4437(0x21d)]+'\x0a\x20\x20'+_0x45a969,_0x5cbbe6);}try{const _0x2ceca6=await syncActivationsForSegment(_0x1f6af0,_0x31cbe1[_0x3f4437(0x18e)],_0x562e94,_0x1d02a3['yamlConfig'][_0x3f4437(0x265)],_0x1d02a3[_0x3f4437(0x233)],_0x40bd2e,_0x1d02a3[_0x3f4437(0x21d)]);_0x296e9c['activations']=_0x2ceca6;}catch(_0x27a017){if(_0x27a017 instanceof SDKError)throw _0x27a017;throw new SDKError(ErrorCode[_0x3f4437(0x19e)],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x1d02a3[_0x3f4437(0x18a)][_0x3f4437(0x265)]+_0x3f4437(0x1c7)+_0x1d02a3['absolutePath']+_0x3f4437(0x1cd)+getErrorMessage(_0x27a017),_0x27a017);}return _0x296e9c;},_0x95e10=await batchAsync(_0x40888d,_0x587ba4,_0x3b32ab),_0x5bed67={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x70a8f2 of _0x95e10){_0x5bed67[_0x1341ab(0x254)]+=_0x70a8f2['created'],_0x5bed67[_0x1341ab(0x234)]+=_0x70a8f2[_0x1341ab(0x234)],_0x70a8f2[_0x1341ab(0x27a)]&&_0x5bed67[_0x1341ab(0x212)]['set'](_0x70a8f2[_0x1341ab(0x27a)]['name'],_0x70a8f2[_0x1341ab(0x27a)]['id']),_0x5bed67[_0x1341ab(0x20a)][_0x1341ab(0x254)]+=_0x70a8f2[_0x1341ab(0x20a)][_0x1341ab(0x254)],_0x5bed67[_0x1341ab(0x20a)]['updated']+=_0x70a8f2['activations'][_0x1341ab(0x234)],_0x5bed67[_0x1341ab(0x20a)][_0x1341ab(0x1ee)]+=_0x70a8f2[_0x1341ab(0x20a)][_0x1341ab(0x1ee)];}return _0x5bed67;}async function syncActivationsForSegment(_0x563221,_0x4d6ca5,_0x2822c7,_0x40dd26,_0x38fd40,_0x5a4c29,_0x286021){const _0x1f0bf6=a140_0x408869,_0x118579={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x1858cc of _0x38fd40){try{if(_0x1858cc[_0x1f0bf6(0x1ce)]===_0x1f0bf6(0x1e9)&&_0x1858cc[_0x1f0bf6(0x211)])_0x5a4c29[_0x1f0bf6(0x1eb)]?.({'type':_0x1f0bf6(0x208),'segmentName':_0x40dd26,'activationName':_0x1858cc[_0x1f0bf6(0x265)]}),await _0x5a4c29[_0x1f0bf6(0x266)]('Creating\x20activation\x20\x27'+_0x1858cc[_0x1f0bf6(0x265)]+_0x1f0bf6(0x232),()=>_0x563221[_0x1f0bf6(0x22d)][_0x1f0bf6(0x1df)](_0x4d6ca5,_0x2822c7,_0x1858cc[_0x1f0bf6(0x211)])),_0x5a4c29[_0x1f0bf6(0x1eb)]?.({'type':'activation_created','segmentName':_0x40dd26,'activationName':_0x1858cc[_0x1f0bf6(0x265)]}),_0x5a4c29[_0x1f0bf6(0x1a9)]?.(_0x1f0bf6(0x1f4)+_0x1858cc[_0x1f0bf6(0x265)]+'\x27'),_0x118579[_0x1f0bf6(0x254)]++;else{if(_0x1858cc['type']===_0x1f0bf6(0x250)&&_0x1858cc['validatedRequest']&&_0x1858cc[_0x1f0bf6(0x21e)])_0x5a4c29[_0x1f0bf6(0x1eb)]?.({'type':_0x1f0bf6(0x288),'segmentName':_0x40dd26,'activationName':_0x1858cc[_0x1f0bf6(0x265)]}),await _0x5a4c29[_0x1f0bf6(0x266)](_0x1f0bf6(0x25a)+_0x1858cc[_0x1f0bf6(0x265)]+_0x1f0bf6(0x232),()=>_0x563221[_0x1f0bf6(0x22d)]['updateActivation'](_0x4d6ca5,_0x2822c7,_0x1858cc[_0x1f0bf6(0x21e)]['id'],_0x1858cc[_0x1f0bf6(0x211)])),_0x5a4c29[_0x1f0bf6(0x1eb)]?.({'type':'activation_updated','segmentName':_0x40dd26,'activationName':_0x1858cc[_0x1f0bf6(0x265)]}),_0x5a4c29[_0x1f0bf6(0x1a9)]?.(_0x1f0bf6(0x1d0)+_0x1858cc[_0x1f0bf6(0x265)]+'\x27'),_0x118579['updated']++;else _0x1858cc[_0x1f0bf6(0x1ce)]===_0x1f0bf6(0x1b6)&&_0x1858cc[_0x1f0bf6(0x21e)]&&(_0x5a4c29['onProgress']?.({'type':_0x1f0bf6(0x271),'segmentName':_0x40dd26,'activationName':_0x1858cc[_0x1f0bf6(0x265)]}),await _0x5a4c29[_0x1f0bf6(0x266)](_0x1f0bf6(0x221)+_0x1858cc['name']+_0x1f0bf6(0x232),()=>_0x563221[_0x1f0bf6(0x22d)]['deleteActivation'](_0x4d6ca5,_0x2822c7,_0x1858cc[_0x1f0bf6(0x21e)]['id'])),_0x5a4c29['onProgress']?.({'type':_0x1f0bf6(0x1cf),'segmentName':_0x40dd26,'activationName':_0x1858cc[_0x1f0bf6(0x265)]}),_0x5a4c29[_0x1f0bf6(0x24a)]?.(_0x1f0bf6(0x1ad)+_0x1858cc['name']+'\x27'),_0x118579[_0x1f0bf6(0x1ee)]++);}}catch(_0xb256e8){const _0x483a83=isHttp400Error(_0xb256e8),_0x3afd7e=_0x483a83?ErrorCode[_0x1f0bf6(0x23e)]:ErrorCode[_0x1f0bf6(0x19e)],_0x2f5b07=getErrorMessage(_0xb256e8);throw new SDKError(_0x3afd7e,_0x1f0bf6(0x1fb)+_0x1858cc[_0x1f0bf6(0x1ce)]+'\x20activation\x20\x27'+_0x1858cc[_0x1f0bf6(0x265)]+'\x27\x20from\x20file:\x20'+_0x286021+_0x1f0bf6(0x1cd)+_0x2f5b07,_0xb256e8);}}return _0x118579;}export async function executePushFolders(_0x1dbb2e,_0x356c40,_0x39ec12,_0x23fbe8,_0x1aea2e){const _0x23e19a=a140_0x408869,_0x39644a=new Map(_0x39ec12),_0x206623=sortFoldersByDepth(_0x356c40);for(const _0x913e35 of _0x206623){const _0x1d6b37=_0x913e35['split']('/'),_0x4ad058=_0x1d6b37[_0x1d6b37[_0x23e19a(0x280)]-0x1],_0x188028=_0x1d6b37[_0x23e19a(0x282)](0x0,-0x1)[_0x23e19a(0x1cc)]('/'),_0x38ffda=_0x39644a[_0x23e19a(0x1f1)](_0x188028);_0x1aea2e[_0x23e19a(0x1eb)]?.({'type':_0x23e19a(0x1c6),'folder':_0x913e35});const _0xd09ef7={'name':_0x4ad058,'parentFolderId':_0x38ffda},_0x3b6e5f=await _0x1aea2e[_0x23e19a(0x266)](_0x23e19a(0x1b8)+_0x913e35+'\x27...',()=>_0x1dbb2e[_0x23e19a(0x22d)]['createFolder'](_0x23fbe8[_0x23e19a(0x18e)],_0xd09ef7));_0x39644a[_0x23e19a(0x1f8)](_0x913e35,_0x3b6e5f[_0x23e19a(0x227)]['id']),_0x1aea2e[_0x23e19a(0x1eb)]?.({'type':'folder_created','folder':_0x913e35,'folderId':_0x3b6e5f[_0x23e19a(0x227)]['id']}),_0x1aea2e[_0x23e19a(0x1af)]?.(_0x23e19a(0x1e3)+_0x913e35+'\x27');}return _0x39644a;}export async function executePushSegmentDeletions(_0x11e9a1,_0x4469ab,_0x587784){const _0x491345=a140_0x408869;if(_0x4469ab['length']===0x0)return 0x0;const {batchAsync:_0x7ae665}=await import(_0x491345(0x1da)),_0x5cf9c4=0x5,_0x300fd8=await _0x7ae665(_0x4469ab,async _0x45f676=>{const _0x1b344d=_0x491345;return _0x587784[_0x1b344d(0x1eb)]?.({'type':_0x1b344d(0x1fa),'name':_0x45f676[_0x1b344d(0x265)]}),await _0x11e9a1[_0x1b344d(0x22d)][_0x1b344d(0x267)](_0x45f676['id']),_0x587784[_0x1b344d(0x1eb)]?.({'type':'segment_deleted','name':_0x45f676[_0x1b344d(0x265)]}),_0x587784[_0x1b344d(0x24a)]?.(_0x1b344d(0x235)+_0x45f676[_0x1b344d(0x265)]+'\x27'),0x1;},_0x5cf9c4);return _0x300fd8[_0x491345(0x230)]((_0x4ee36a,_0x24139f)=>_0x4ee36a+_0x24139f,0x0);}export async function executePushJourneys(_0x53f96f,_0x98857,_0x7bfe4b,_0xe60785,_0x1d3570){const _0x4bcce7=a140_0x408869,{journeyDefToRequest:_0x406a68}=await import(_0x4bcce7(0x278)),{activationDefToCreateRequest:_0x2a8deb,yamlRuleToApi:_0x201a79,validateSegmentRule:_0x978db0}=await import('./child-segment-yaml.js'),_0x37c19f={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x1788fc=new Map(_0x7bfe4b[_0x4bcce7(0x238)]),_0x5adce3=0x5;for(let _0x1c2e5f=0x0;_0x1c2e5f<_0x98857['length'];_0x1c2e5f+=_0x5adce3){const _0x248d67=_0x98857[_0x4bcce7(0x282)](_0x1c2e5f,_0x1c2e5f+_0x5adce3),_0x3f2010=await Promise[_0x4bcce7(0x247)](_0x248d67['map'](async _0x4df9be=>{const _0x2892df=_0x4bcce7;if(!_0x4df9be[_0x2892df(0x248)]&&!_0x4df9be['hasChanges'])return{'action':_0x2892df(0x24b),'name':_0x4df9be['yamlConfig']['name'],'journeyId':_0x4df9be['existingJourney']?.['id']};const _0x111101=_0x4df9be[_0x2892df(0x1b1)]?_0x7bfe4b[_0x2892df(0x1ba)][_0x2892df(0x1f1)](_0x4df9be[_0x2892df(0x1b1)]):undefined;_0x1d3570[_0x2892df(0x1eb)]?.({'type':_0x4df9be[_0x2892df(0x248)]?'journey_creating':_0x2892df(0x27f),'name':_0x4df9be[_0x2892df(0x18a)]['name']});try{const _0x51b2b0=await executeSingleJourneyPush(_0x53f96f,_0x4df9be,{..._0x7bfe4b,'segmentNameToId':_0x1788fc},{'parentId':_0xe60785[_0x2892df(0x18e)],'rootFolderId':_0xe60785[_0x2892df(0x1a2)],'folderId':_0x111101,'verbose':_0xe60785[_0x2892df(0x1a7)]},_0x1d3570,{'journeyDefToRequest':_0x406a68,'activationDefToCreateRequest':_0x2a8deb,'yamlRuleToApi':_0x201a79,'validateSegmentRule':_0x978db0});for(const [_0x4ee8ca,_0x42421d]of _0x51b2b0[_0x2892df(0x19b)]){_0x1788fc[_0x2892df(0x1f8)](_0x4ee8ca,_0x42421d),_0x37c19f[_0x2892df(0x19b)][_0x2892df(0x1f8)](_0x4ee8ca,_0x42421d);}if(_0x51b2b0[_0x2892df(0x286)]===_0x2892df(0x254))_0x1d3570[_0x2892df(0x1eb)]?.({'type':_0x2892df(0x196),'name':_0x4df9be[_0x2892df(0x18a)][_0x2892df(0x265)],'journeyId':_0x51b2b0[_0x2892df(0x1e0)]}),_0x1d3570['logSuccess']?.('Created\x20journey\x20\x27'+_0x4df9be[_0x2892df(0x18a)][_0x2892df(0x265)]+'\x27'),_0x37c19f[_0x2892df(0x254)]++;else _0x51b2b0[_0x2892df(0x286)]==='updated'&&(_0x1d3570['onProgress']?.({'type':_0x2892df(0x1d6),'name':_0x4df9be[_0x2892df(0x18a)][_0x2892df(0x265)]}),_0x1d3570['logSuccess']?.('Updated\x20journey\x20\x27'+_0x4df9be[_0x2892df(0x18a)][_0x2892df(0x265)]+'\x27'),_0x37c19f[_0x2892df(0x234)]++);return{'action':_0x51b2b0[_0x2892df(0x286)],'name':_0x4df9be[_0x2892df(0x18a)][_0x2892df(0x265)],'journeyId':_0x51b2b0['journeyId']};}catch(_0x1fa63f){const _0x720db9=isHttp400Error(_0x1fa63f),_0x59998e=_0x720db9?ErrorCode[_0x2892df(0x19c)]:ErrorCode[_0x2892df(0x18d)],_0x482df9=getErrorMessage(_0x1fa63f);throw new SDKError(_0x59998e,_0x2892df(0x1fb)+(_0x4df9be['isNew']?_0x2892df(0x1e9):_0x2892df(0x250))+_0x2892df(0x1de)+_0x4df9be[_0x2892df(0x21d)]+'\x0a\x20\x20'+_0x482df9,_0x1fa63f);}}));_0x37c19f[_0x4bcce7(0x217)][_0x4bcce7(0x1aa)](..._0x3f2010);}return _0x37c19f;}async function matchExistingJourneySegments(_0x178bb2,_0x203c17,_0x63c686,_0x204d13,_0x30e0d1){const _0x385cd0=a140_0x408869;if(!_0x203c17[_0x385cd0(0x222)]||!_0x203c17[_0x385cd0(0x18a)][_0x385cd0(0x241)])return;const _0x168f36=new Map(),_0xe12648=new Set();for(const _0x258762 of Object[_0x385cd0(0x287)](_0x203c17[_0x385cd0(0x18a)]['segments'])){const _0x21dec9=generateDeterministicJourneySegmentName(_0x203c17[_0x385cd0(0x18a)]['name'],_0x258762);_0x168f36['set'](_0x21dec9,_0x258762),_0xe12648['add'](_0x258762);}const _0x3de9de=[],_0xb3226f=collectSegmentIdsFromJourneyApi(_0x203c17[_0x385cd0(0x222)]);for(const _0x96f902 of _0xb3226f){const _0x386731=await fetchSegment(_0x178bb2,_0x63c686,_0x96f902,_0x204d13);if(!_0x386731?.[_0x385cd0(0x265)])continue;const _0x52a452=_0x168f36[_0x385cd0(0x1f1)](_0x386731[_0x385cd0(0x265)]);_0x52a452?(_0x30e0d1[_0x385cd0(0x1f8)](_0x52a452,_0x96f902),_0xe12648['delete'](_0x52a452)):_0x3de9de[_0x385cd0(0x1aa)]({'id':_0x96f902,'seg':_0x386731});}if(_0xe12648['size']>0x0&&_0x3de9de[_0x385cd0(0x280)]>0x0){const {localExpandedRuleToNames:_0x3ee8cb}=buildLocalExpandedRuleMappings(_0x203c17[_0x385cd0(0x18a)]),_0x3fcec5=new Map();for(const {id:_0x4ff6ed,seg:_0x376fad}of _0x3de9de){if(_0x376fad[_0x385cd0(0x219)]){const _0x2427b4=apiRuleToYaml(_0x376fad['rule']);_0x3fcec5[_0x385cd0(0x1f8)](_0x4ff6ed,_0x2427b4);}}for(const {id:_0x2562f8,seg:_0x1cb87}of _0x3de9de){if(!_0x1cb87[_0x385cd0(0x219)])continue;const _0x1c9dfe=_0x3fcec5[_0x385cd0(0x1f1)](_0x2562f8);if(!_0x1c9dfe)continue;const _0xf88970=serializeExpandedRule(_0x1c9dfe,_0x3fcec5),_0x391291=_0x3ee8cb[_0x385cd0(0x1f1)](_0xf88970);if(_0x391291){const _0x18939a=_0x391291[_0x385cd0(0x270)](_0x18ddb2=>_0xe12648[_0x385cd0(0x1ea)](_0x18ddb2));_0x18939a&&(_0x30e0d1[_0x385cd0(0x1f8)](_0x18939a,_0x2562f8),_0xe12648[_0x385cd0(0x1b6)](_0x18939a),logger[_0x385cd0(0x1bd)](_0x385cd0(0x249)+_0x1cb87[_0x385cd0(0x265)]+_0x385cd0(0x209)+_0x18939a+_0x385cd0(0x240)));}}}}async function executeSingleJourneyPush(_0x6c2d50,_0x356a50,_0x22625,_0x37ef34,_0x11d977,_0x492d71){const _0x3beeb2=a140_0x408869,{journeyDefToRequest:_0xcccd3f,activationDefToCreateRequest:_0x1195d0,yamlRuleToApi:_0xd1193,validateSegmentRule:_0x567ef5}=_0x492d71,_0x30d5b0=new Map(),_0x329c25=new Map();recoverSegmentIdsFromPushRecovery(_0x356a50,_0x30d5b0,_0x22625['segmentNameToId']);const _0x51be36=new Map(),_0x1e78c8=new Map(),_0x20954d=new Map();let _0x180623;const _0x44e03f=async()=>{const _0x50be51=a140_0x340f;if(_0x180623)return;_0x180623=new Map();if(!_0x356a50['existingJourney'])return;const _0x371896=await _0x6c2d50['journey'][_0x50be51(0x283)](_0x356a50[_0x50be51(0x222)]['id']);for(const _0x14887f of _0x371896){const _0x2c2937=journeyActivationStepToYaml(_0x14887f,_0x22625[_0x50be51(0x1d8)],_0x22625[_0x50be51(0x1e7)]),_0x3aa355=activationSignature(_0x2c2937);!_0x180623[_0x50be51(0x1ea)](_0x3aa355)&&_0x180623[_0x50be51(0x1f8)](_0x3aa355,_0x14887f['id']),_0x2c2937[_0x50be51(0x265)]&&_0x329c25[_0x50be51(0x1f8)](_0x2c2937[_0x50be51(0x265)],_0x14887f['id']);}};await matchExistingJourneySegments(_0x6c2d50,_0x356a50,_0x37ef34[_0x3beeb2(0x18e)],_0x22625['existingSegments'],_0x22625[_0x3beeb2(0x238)]);const _0x3719b8={'resolveSegmentId':async _0xbc2e44=>{const _0x5c39e6=_0x3beeb2,_0x5ab49f=_0x22625[_0x5c39e6(0x238)]['get'](_0xbc2e44);if(!_0x5ab49f)throw new SDKError(ErrorCode[_0x5c39e6(0x214)],_0x5c39e6(0x27e)+_0xbc2e44+_0x5c39e6(0x256)+_0x356a50[_0x5c39e6(0x18a)][_0x5c39e6(0x265)]+')');return _0x5ab49f;},'resolveEmbeddedSegmentId':async(_0x5b39de,_0x1ac163)=>{const _0x40b815=_0x3beeb2,_0x32d1e3=_0x22625[_0x40b815(0x238)]['get'](_0x5b39de);if(_0x32d1e3)return _0x32d1e3;const _0x147761=_0x22625[_0x40b815(0x206)][_0x40b815(0x270)](_0x1580f3=>_0x1580f3[_0x40b815(0x265)]===_0x5b39de);if(_0x147761)return _0x22625['segmentNameToId'][_0x40b815(0x1f8)](_0x5b39de,_0x147761['id']),_0x147761['id'];if(_0x356a50['isNew']){const {stageName:_0x1ddf74,criteriaName:_0x28f2db}=findSegmentCriteriaLocation(_0x356a50[_0x40b815(0x18a)],_0x5b39de);return _0x567ef5(_0x5b39de,_0x1ac163[_0x40b815(0x219)]),_0x1e78c8[_0x40b815(0x1f8)](_0x5b39de,{'definition':_0x1ac163,'stageName':_0x1ddf74,'criteriaName':_0x28f2db}),createPendingSegmentId(_0x5b39de);}const _0x262dde=_0x356a50['existingJourney']?.['id'];if(!_0x262dde)throw new SDKError(ErrorCode[_0x40b815(0x1c8)],_0x40b815(0x22a));const _0x4cbc99=_0x51be36['get'](_0x5b39de);if(_0x4cbc99)return _0x4cbc99;const _0xaa1a60=((async()=>{const _0x4695d0=_0x40b815;_0x567ef5(_0x5b39de,_0x1ac163[_0x4695d0(0x219)]);const _0x2251eb=generateDeterministicJourneySegmentName(_0x356a50[_0x4695d0(0x18a)][_0x4695d0(0x265)],_0x5b39de),_0x520ef7=_0x22625['existingSegments'][_0x4695d0(0x270)](_0x2a677d=>_0x2a677d[_0x4695d0(0x265)]===_0x2251eb),_0x6a7594=createSegmentIdResolver(_0x22625['segmentNameToId'],_0x5b39de),_0x5cc1a5=await resolveRuleSegmentIds(_0x1ac163[_0x4695d0(0x219)],_0x6a7594);let _0x1d266c;return _0x520ef7?(await _0x6c2d50[_0x4695d0(0x22d)][_0x4695d0(0x1b7)](_0x37ef34['parentId'],_0x520ef7['id'],{'description':_0x1ac163[_0x4695d0(0x1c0)]||_0x4695d0(0x198)+_0x5b39de,'rule':_0xd1193(_0x5cc1a5,!![]),'countPopulation':!![]}),_0x1d266c=_0x520ef7['id'],saveSegmentToPushRecovery(_0x356a50['absolutePath'],_0x356a50[_0x4695d0(0x18a)][_0x4695d0(0x265)],_0x5b39de,{'segmentId':_0x1d266c,'uniqueServerName':_0x2251eb,'createdAt':new Date()[_0x4695d0(0x1ec)]()})):_0x1d266c=await createOrRecoverEmbeddedSegment(_0x6c2d50,_0x356a50,{'localName':_0x5b39de,'uniqueSegmentName':_0x2251eb,'description':_0x1ac163[_0x4695d0(0x1c0)]||_0x4695d0(0x198)+_0x5b39de,'journeyId':_0x262dde,'resolvedRule':_0x5cc1a5,'parentId':_0x37ef34[_0x4695d0(0x18e)],'folderId':_0x37ef34[_0x4695d0(0x1a2)]||''},_0xd1193),_0x22625[_0x4695d0(0x238)][_0x4695d0(0x1f8)](_0x5b39de,_0x1d266c),_0x30d5b0['set'](_0x5b39de,_0x1d266c),_0x1d266c;})());_0x51be36['set'](_0x5b39de,_0xaa1a60);try{return await _0xaa1a60;}finally{_0x51be36[_0x40b815(0x1b6)](_0x5b39de);}},'resolveActivationId':async _0x480e88=>{const _0x3af41b=_0x3beeb2,_0x17784a=_0x329c25[_0x3af41b(0x1f1)](_0x480e88);if(_0x17784a)return _0x17784a;if(_0x356a50[_0x3af41b(0x222)]){await _0x44e03f();const _0x4d4e4c=_0x329c25['get'](_0x480e88);if(_0x4d4e4c)return _0x4d4e4c;}throw new SDKError(ErrorCode[_0x3af41b(0x215)],_0x3af41b(0x274)+_0x480e88+_0x3af41b(0x256)+_0x356a50[_0x3af41b(0x18a)][_0x3af41b(0x265)]+_0x3af41b(0x24e)+_0x3af41b(0x1c3));},'resolveEmbeddedActivationId':async(_0x2df774,_0x4700e5)=>{const _0x2e4edd=_0x3beeb2,_0x44cda1=_0x329c25[_0x2e4edd(0x1f1)](_0x2df774);if(_0x44cda1)return _0x44cda1;if(_0x356a50['isNew'])return _0x20954d[_0x2e4edd(0x1f8)](_0x2df774,_0x4700e5),createPendingActivationId(_0x2df774);if(_0x356a50[_0x2e4edd(0x222)]){await _0x44e03f();const _0x5c3d09=_0x329c25[_0x2e4edd(0x1f1)](_0x4700e5[_0x2e4edd(0x265)]);if(_0x5c3d09)return _0x329c25[_0x2e4edd(0x1f8)](_0x2df774,_0x5c3d09),_0x5c3d09;const _0x5ad202=activationSignature(_0x4700e5),_0x32b66d=_0x180623?.[_0x2e4edd(0x1f1)](_0x5ad202);if(_0x32b66d)return _0x329c25[_0x2e4edd(0x1f8)](_0x2df774,_0x32b66d),_0x32b66d;const _0x4a3dda=await _0x1195d0(_0x4700e5,_0x22625[_0x2e4edd(0x190)]),_0x102be5={..._0x4a3dda,..._0x4700e5['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x4700e5[_0x2e4edd(0x1fe)]}},_0x580e03=await _0x6c2d50['journey'][_0x2e4edd(0x1df)](_0x356a50['existingJourney']['id'],_0x102be5);return _0x329c25[_0x2e4edd(0x1f8)](_0x2df774,_0x580e03['id']),_0x580e03['id'];}throw new SDKError(ErrorCode[_0x2e4edd(0x1c8)],_0x2e4edd(0x243));},'resolveJourneyId':async _0x42a532=>{const _0x5c6ba7=_0x3beeb2;try{return await _0x6c2d50[_0x5c6ba7(0x25f)][_0x5c6ba7(0x257)](_0x37ef34[_0x5c6ba7(0x18e)],_0x42a532);}catch(_0x35a065){throw new SDKError(ErrorCode[_0x5c6ba7(0x215)],_0x5c6ba7(0x24d)+_0x42a532+_0x5c6ba7(0x1f2)+_0x356a50[_0x5c6ba7(0x18a)][_0x5c6ba7(0x265)]+'\x27)',_0x35a065);}},'resolveStageId':async(_0x3bac24,_0x4934fa)=>{const _0x24b0ec=_0x3beeb2,_0x55d206=await _0x6c2d50[_0x24b0ec(0x25f)][_0x24b0ec(0x242)](_0x3bac24),_0x1ab2dd=_0x55d206['attributes'][_0x24b0ec(0x23f)]['find'](_0x49893c=>_0x49893c['name'][_0x24b0ec(0x218)]()===_0x4934fa['toLowerCase']());if(!_0x1ab2dd?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],_0x24b0ec(0x197)+_0x4934fa+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x55d206['attributes'][_0x24b0ec(0x261)]||_0x55d206[_0x24b0ec(0x1be)][_0x24b0ec(0x265)])+'\x27');return _0x1ab2dd['id'];}},_0x19d9ec=await _0xcccd3f(_0x356a50[_0x3beeb2(0x18a)],_0x37ef34[_0x3beeb2(0x18e)],_0x3719b8),_0x90030=_0x37ef34[_0x3beeb2(0x258)]||_0x37ef34[_0x3beeb2(0x1a2)];_0x90030&&(_0x19d9ec[_0x3beeb2(0x245)]={'parentFolder':{'data':{'id':_0x90030,'type':'folder'}}});if(_0x356a50[_0x3beeb2(0x248)]){if(_0x1e78c8['size']>0x0||_0x20954d[_0x3beeb2(0x1ac)]>0x0)return await executeThreeStepJourneyCreate(_0x6c2d50,_0x356a50,_0x19d9ec,{'pendingEmbeddedSegments':_0x1e78c8,'pendingEmbeddedActivations':_0x20954d,'embeddedSegmentNameToId':_0x30d5b0,'journeyActivationNameToId':_0x329c25},{..._0x37ef34,'effectiveFolderId':_0x90030},_0x22625,_0x11d977,_0x492d71);else{ensureJourneyDefaults(_0x19d9ec[_0x3beeb2(0x1be)]);const _0x4e77c7=await _0x6c2d50[_0x3beeb2(0x25f)]['create'](_0x19d9ec);return deletePushRecovery(_0x356a50[_0x3beeb2(0x21d)]),{'action':'created','journeyId':_0x4e77c7['id'],'embeddedSegmentNameToId':_0x30d5b0};}}else{if(_0x356a50[_0x3beeb2(0x26a)]&&_0x356a50[_0x3beeb2(0x222)]){_0x19d9ec['id']=_0x356a50[_0x3beeb2(0x222)]['id'];const _0x4e14c4=_0x19d9ec[_0x3beeb2(0x1be)];_0x356a50[_0x3beeb2(0x222)][_0x3beeb2(0x1be)]?.['journeyBundleName']&&(_0x4e14c4['journeyBundleName']=_0x356a50[_0x3beeb2(0x222)]['attributes']['journeyBundleName']);const _0x38f82d=_0x356a50[_0x3beeb2(0x222)][_0x3beeb2(0x1be)]?.['journeyStages'];return _0x38f82d&&_0x19d9ec['attributes'][_0x3beeb2(0x23f)]&&injectExistingStageIds(_0x19d9ec[_0x3beeb2(0x1be)]['journeyStages'],_0x38f82d),ensureJourneyDefaults(_0x4e14c4),await _0x6c2d50[_0x3beeb2(0x25f)]['update'](_0x356a50[_0x3beeb2(0x222)]['id'],_0x19d9ec),deletePushRecovery(_0x356a50['absolutePath']),{'action':_0x3beeb2(0x234),'journeyId':_0x356a50[_0x3beeb2(0x222)]['id'],'embeddedSegmentNameToId':_0x30d5b0};}}return deletePushRecovery(_0x356a50[_0x3beeb2(0x21d)]),{'action':_0x3beeb2(0x24b),'journeyId':_0x356a50[_0x3beeb2(0x222)]?.['id'],'embeddedSegmentNameToId':_0x30d5b0};}function findSegmentCriteriaLocation(_0x32c88c,_0x597482){const _0x448f9a=a140_0x408869,_0x573101=_0x32c88c[_0x448f9a(0x189)]||_0x32c88c[_0x448f9a(0x1f9)]?.[0x0]?.['stages']||[];let _0x52e8a8=_0x448f9a(0x22f),_0x4ab4a9=_0x597482;const _0x29ee1c=_0x32c88c[_0x448f9a(0x1c9)]||_0x32c88c[_0x448f9a(0x1f9)]?.[0x0]?.[_0x448f9a(0x1c9)];if(_0x29ee1c?.[_0x448f9a(0x22d)]===_0x597482)return{'stageName':_0x448f9a(0x1c9),'criteriaName':_0x29ee1c[_0x448f9a(0x265)]||_0x597482};_0x1b6a7e:for(const _0x4ec997 of _0x573101){if(_0x4ec997[_0x448f9a(0x1c4)]?.[_0x448f9a(0x22d)]===_0x597482){_0x52e8a8=_0x4ec997['name'],_0x4ab4a9=_0x4ec997[_0x448f9a(0x1c4)]['name']||_0x597482;break;}if(_0x4ec997[_0x448f9a(0x22e)])for(const _0x350bbb of _0x4ec997[_0x448f9a(0x22e)]){if(_0x350bbb['type']===_0x448f9a(0x1c2)&&_0x350bbb[_0x448f9a(0x1ff)]?.[_0x448f9a(0x262)])for(const _0x1f14e2 of _0x350bbb[_0x448f9a(0x1ff)]['branches']){if(_0x1f14e2[_0x448f9a(0x22d)]===_0x597482){_0x52e8a8=_0x4ec997[_0x448f9a(0x265)],_0x4ab4a9=_0x1f14e2['name']||_0x597482;break _0x1b6a7e;}}}}return{'stageName':_0x52e8a8,'criteriaName':_0x4ab4a9};}async function executeThreeStepJourneyCreate(_0x516d40,_0x15ecca,_0xf4c361,_0x644561,_0x21c672,_0x3b156d,_0x509632,_0x1ba0e8){const _0x3df28d=a140_0x408869,{activationDefToCreateRequest:_0x5a0d13,yamlRuleToApi:_0x2d79a7}=_0x1ba0e8,{pendingEmbeddedSegments:_0x790465,pendingEmbeddedActivations:_0x3b5b72,embeddedSegmentNameToId:_0xe264f8}=_0x644561,_0xcc8d05=JSON['parse'](JSON[_0x3df28d(0x22c)](_0xf4c361));ensureJourneyDefaults(_0xcc8d05[_0x3df28d(0x1be)]),stripPendingIds(_0xcc8d05);const _0x8b34b3=await _0x516d40[_0x3df28d(0x25f)][_0x3df28d(0x1e9)](_0xcc8d05),_0x19f135=_0x8b34b3['id'],_0x2bd27f=new Map();for(const _0x371c6a of _0x8b34b3[_0x3df28d(0x1be)][_0x3df28d(0x23f)]){_0x2bd27f[_0x3df28d(0x1f8)](_0x371c6a[_0x3df28d(0x265)]['toLowerCase'](),_0x371c6a['id']);}recoverSegmentIdsFromPushRecovery(_0x15ecca,_0xe264f8,_0x3b156d[_0x3df28d(0x238)]);for(const [_0x51cc34,{definition:_0x51b668}]of _0x790465){if(_0xe264f8[_0x3df28d(0x1ea)](_0x51cc34)){_0x509632['onProgress']?.({'type':_0x3df28d(0x26f),'journeyName':_0x15ecca['yamlConfig'][_0x3df28d(0x265)],'segmentName':_0x51cc34});continue;}const _0x36c4eb=generateDeterministicJourneySegmentName(_0x15ecca[_0x3df28d(0x18a)][_0x3df28d(0x265)],_0x51cc34);_0x509632[_0x3df28d(0x1eb)]?.({'type':_0x3df28d(0x1f5),'journeyName':_0x15ecca[_0x3df28d(0x18a)][_0x3df28d(0x265)],'segmentName':_0x51cc34});const _0x4e75e2=createSegmentIdResolver(_0x3b156d[_0x3df28d(0x238)],_0x51cc34),_0x5db16c=await resolveRuleSegmentIds(_0x51b668['rule'],_0x4e75e2),_0x4f3a43=await createOrRecoverEmbeddedSegment(_0x516d40,_0x15ecca,{'localName':_0x51cc34,'uniqueSegmentName':_0x36c4eb,'description':_0x51b668['description']||_0x3df28d(0x198)+_0x51cc34,'journeyId':_0x19f135,'resolvedRule':_0x5db16c,'parentId':_0x21c672[_0x3df28d(0x18e)],'folderId':_0x21c672[_0x3df28d(0x1b3)]||''},_0x2d79a7);_0xe264f8[_0x3df28d(0x1f8)](_0x51cc34,_0x4f3a43),_0x3b156d[_0x3df28d(0x238)]['set'](_0x51cc34,_0x4f3a43),_0x509632[_0x3df28d(0x1eb)]?.({'type':_0x3df28d(0x26f),'journeyName':_0x15ecca[_0x3df28d(0x18a)][_0x3df28d(0x265)],'segmentName':_0x51cc34});}const _0x500cd5=new Map();for(const [_0x308730,_0x5c4737]of _0x3b5b72){_0x509632[_0x3df28d(0x1eb)]?.({'type':_0x3df28d(0x1f0),'journeyName':_0x15ecca['yamlConfig'][_0x3df28d(0x265)],'activationName':_0x308730});const _0x13cc7a=await _0x5a0d13(_0x5c4737,_0x3b156d['activationContext']),_0xe24842={..._0x13cc7a,..._0x5c4737[_0x3df28d(0x1fe)]!==undefined&&{'runAfterJourneyRefresh':_0x5c4737[_0x3df28d(0x1fe)]}},_0x414e2e=await _0x516d40[_0x3df28d(0x25f)][_0x3df28d(0x1df)](_0x19f135,_0xe24842);_0x500cd5[_0x3df28d(0x1f8)](_0x308730,_0x414e2e['id']),_0x644561[_0x3df28d(0x1c1)][_0x3df28d(0x1f8)](_0x308730,_0x414e2e['id']),_0x509632[_0x3df28d(0x1eb)]?.({'type':_0x3df28d(0x1bb),'journeyName':_0x15ecca[_0x3df28d(0x18a)][_0x3df28d(0x265)],'activationName':_0x308730});}const _0x4134d3=JSON[_0x3df28d(0x193)](JSON[_0x3df28d(0x22c)](_0xf4c361));return _0x4134d3['id']=_0x19f135,ensureJourneyDefaults(_0x4134d3[_0x3df28d(0x1be)]),resolvePendingIdsInRequest(_0x4134d3,_0xf4c361,_0x2bd27f,_0xe264f8,_0x500cd5,_0x509632),await _0x516d40[_0x3df28d(0x25f)]['update'](_0x19f135,_0x4134d3),deletePushRecovery(_0x15ecca[_0x3df28d(0x21d)]),{'action':'created','journeyId':_0x19f135,'embeddedSegmentNameToId':_0xe264f8};}export function stripWaitStepPendingIds(_0x4f2400){const _0x5f2293=a140_0x408869,_0x47fd40=_0x4f2400[_0x5f2293(0x1a4)]&&isPendingSegmentId(_0x4f2400[_0x5f2293(0x1a4)]),_0x6b8b70=_0x4f2400['conditions']?.[_0x5f2293(0x25c)](_0x5e4dd8=>_0x5e4dd8['segmentId']&&isPendingSegmentId(_0x5e4dd8[_0x5f2293(0x1d4)]));(_0x47fd40||_0x6b8b70)&&(_0x4f2400[_0x5f2293(0x188)]=_0x5f2293(0x21a),_0x4f2400[_0x5f2293(0x27d)]=0x1,_0x4f2400[_0x5f2293(0x20f)]='day',delete _0x4f2400[_0x5f2293(0x1a4)],delete _0x4f2400['conditionTimeoutDuration'],delete _0x4f2400['conditionTimeoutUnit'],delete _0x4f2400[_0x5f2293(0x1e2)]);}export function resolveWaitStepPendingIds(_0x246975,_0x2f68c9,_0x2170de,_0x1db65e){const _0x23784f=a140_0x408869;if(_0x2f68c9[_0x23784f(0x1a4)]&&isPendingSegmentId(_0x2f68c9[_0x23784f(0x1a4)])){const _0x32ae1b=_0x2170de(_0x2f68c9[_0x23784f(0x1a4)],_0x23784f(0x252)+_0x1db65e+'\x27\x20wait\x20condition');_0x32ae1b&&(_0x246975['waitStepType']=_0x23784f(0x228),_0x246975[_0x23784f(0x1a4)]=_0x32ae1b,delete _0x246975[_0x23784f(0x27d)],delete _0x246975['waitStepUnit'],_0x2f68c9[_0x23784f(0x251)]!==undefined&&(_0x246975['conditionTimeoutDuration']=_0x2f68c9[_0x23784f(0x251)]),_0x2f68c9[_0x23784f(0x1f3)]&&(_0x246975[_0x23784f(0x1f3)]=_0x2f68c9[_0x23784f(0x1f3)]));}if(_0x2f68c9[_0x23784f(0x1e2)]){const _0x40c99c=_0x2f68c9[_0x23784f(0x1e2)][_0x23784f(0x25c)](_0xbad740=>_0xbad740['segmentId']&&isPendingSegmentId(_0xbad740[_0x23784f(0x1d4)]));if(_0x40c99c){const _0x42084f=_0x2f68c9[_0x23784f(0x1e2)][_0x23784f(0x268)](_0x1d79c5=>{const _0xf8132f=_0x23784f;if(_0x1d79c5[_0xf8132f(0x1d4)]&&isPendingSegmentId(_0x1d79c5[_0xf8132f(0x1d4)])){const _0x5f0d01=_0x2170de(_0x1d79c5['segmentId'],'stage\x20\x27'+_0x1db65e+'\x27\x20wait\x20condition');return{..._0x1d79c5,'segmentId':_0x5f0d01||_0x1d79c5[_0xf8132f(0x1d4)]};}return{..._0x1d79c5};});_0x246975[_0x23784f(0x188)]=_0x23784f(0x228),_0x246975['conditions']=_0x42084f,delete _0x246975[_0x23784f(0x27d)],delete _0x246975[_0x23784f(0x20f)],delete _0x246975[_0x23784f(0x1a4)],delete _0x246975[_0x23784f(0x251)],delete _0x246975[_0x23784f(0x1f3)];}}}function stripPendingIds(_0x3ecba5){const _0xa5609d=a140_0x408869;_0x3ecba5[_0xa5609d(0x1be)][_0xa5609d(0x1c9)]?.['segmentId']&&isPendingSegmentId(_0x3ecba5[_0xa5609d(0x1be)]['goal'][_0xa5609d(0x1d4)])&&delete _0x3ecba5[_0xa5609d(0x1be)][_0xa5609d(0x1c9)];for(const _0xb096 of _0x3ecba5[_0xa5609d(0x1be)][_0xa5609d(0x23f)]||[]){_0xb096[_0xa5609d(0x236)]?.[_0xa5609d(0x1d4)]&&isPendingSegmentId(_0xb096[_0xa5609d(0x236)][_0xa5609d(0x1d4)])&&delete _0xb096[_0xa5609d(0x236)];_0xb096[_0xa5609d(0x26c)]?.[_0xa5609d(0x1d4)]&&isPendingSegmentId(_0xb096[_0xa5609d(0x26c)]['segmentId'])&&delete _0xb096[_0xa5609d(0x26c)];_0xb096[_0xa5609d(0x264)]&&(_0xb096['exitCriterias']=_0xb096[_0xa5609d(0x264)][_0xa5609d(0x24c)](_0x1b95f3=>!_0x1b95f3[_0xa5609d(0x1d4)]||!isPendingSegmentId(_0x1b95f3['segmentId'])));if(_0xb096['steps'])for(const _0x291938 of Object['keys'](_0xb096[_0xa5609d(0x22e)])){const _0xca55c4=_0xb096[_0xa5609d(0x22e)][_0x291938];_0xca55c4[_0xa5609d(0x1ce)]==='Activation'&&_0xca55c4['journeyActivationStepId']&&isPendingActivationId(_0xca55c4[_0xa5609d(0x20d)])&&(_0xca55c4[_0xa5609d(0x20d)]='');if(_0xca55c4[_0xa5609d(0x1ce)]===_0xa5609d(0x244)&&_0xca55c4[_0xa5609d(0x262)])for(const _0x51f503 of _0xca55c4['branches']){_0x51f503[_0xa5609d(0x1d4)]&&isPendingSegmentId(_0x51f503[_0xa5609d(0x1d4)])&&(_0x51f503[_0xa5609d(0x1d4)]='');}_0xca55c4[_0xa5609d(0x1ce)]==='WaitStep'&&stripWaitStepPendingIds(_0xca55c4);}}}function resolvePendingIdsInRequest(_0x96d80b,_0x156990,_0x3b22b1,_0x493c50,_0x5e4ff9,_0x2a8465){const _0xa582bb=a140_0x408869,_0x5b8938=(_0x3047da,_0x5d77d5)=>{const _0x593dd1=a140_0x340f;if(!isPendingSegmentId(_0x3047da))return _0x3047da;const _0x6b540f=extractPendingSegmentName(_0x3047da),_0x4c548c=_0x493c50[_0x593dd1(0x1f1)](_0x6b540f);return!_0x4c548c&&_0x2a8465[_0x593dd1(0x201)]?.(_0x593dd1(0x1dc)+_0x6b540f+_0x593dd1(0x19a)+_0x5d77d5),_0x4c548c;};if(_0x96d80b[_0xa582bb(0x1be)][_0xa582bb(0x1c9)]?.['segmentId']&&isPendingSegmentId(_0x96d80b[_0xa582bb(0x1be)][_0xa582bb(0x1c9)]['segmentId'])){const _0x5c1aec=_0x5b8938(_0x96d80b[_0xa582bb(0x1be)][_0xa582bb(0x1c9)][_0xa582bb(0x1d4)],_0xa582bb(0x1e1));_0x5c1aec&&(_0x96d80b[_0xa582bb(0x1be)]['goal']['segmentId']=_0x5c1aec);}for(const _0x3637a9 of _0x96d80b[_0xa582bb(0x1be)][_0xa582bb(0x23f)]||[]){const _0x15ddf6=_0x3b22b1[_0xa582bb(0x1f1)](_0x3637a9[_0xa582bb(0x265)]['toLowerCase']());_0x15ddf6&&(_0x3637a9['id']=_0x15ddf6);if(_0x3637a9[_0xa582bb(0x236)]?.['segmentId']&&isPendingSegmentId(_0x3637a9[_0xa582bb(0x236)][_0xa582bb(0x1d4)])){const _0x3eab86=_0x5b8938(_0x3637a9[_0xa582bb(0x236)][_0xa582bb(0x1d4)],_0xa582bb(0x252)+_0x3637a9[_0xa582bb(0x265)]+'\x27\x20entry\x20criteria');_0x3eab86&&(_0x3637a9[_0xa582bb(0x236)][_0xa582bb(0x1d4)]=_0x3eab86);}if(_0x3637a9['exitCriterias'])for(const _0xb9e928 of _0x3637a9[_0xa582bb(0x264)]){if(_0xb9e928[_0xa582bb(0x1d4)]&&isPendingSegmentId(_0xb9e928[_0xa582bb(0x1d4)])){const _0x18f333=_0x5b8938(_0xb9e928[_0xa582bb(0x1d4)],_0xa582bb(0x252)+_0x3637a9[_0xa582bb(0x265)]+_0xa582bb(0x285));_0x18f333&&(_0xb9e928[_0xa582bb(0x1d4)]=_0x18f333);}}if(_0x3637a9[_0xa582bb(0x26c)]?.['segmentId']&&isPendingSegmentId(_0x3637a9[_0xa582bb(0x26c)]['segmentId'])){const _0x2f8d6e=_0x5b8938(_0x3637a9['milestone'][_0xa582bb(0x1d4)],'stage\x20\x27'+_0x3637a9['name']+'\x27\x20milestone');_0x2f8d6e&&(_0x3637a9[_0xa582bb(0x26c)][_0xa582bb(0x1d4)]=_0x2f8d6e);}if(_0x3637a9[_0xa582bb(0x22e)]){const _0x53d6f9=_0x2e0c2d=>_0x156990[_0xa582bb(0x1be)]['journeyStages']?.[_0xa582bb(0x270)](_0x1c58e1=>_0x1c58e1[_0xa582bb(0x265)][_0xa582bb(0x218)]()===_0x3637a9['name']['toLowerCase']())?.[_0xa582bb(0x22e)]?.[_0x2e0c2d];for(const _0x1a407c of Object[_0xa582bb(0x287)](_0x3637a9[_0xa582bb(0x22e)])){const _0x151848=_0x3637a9['steps'][_0x1a407c],_0x3e6843=_0x53d6f9(_0x1a407c);if(_0x151848[_0xa582bb(0x1ce)]===_0xa582bb(0x1b0)&&_0x151848[_0xa582bb(0x20d)]&&(isPendingActivationId(_0x151848[_0xa582bb(0x20d)])||_0x151848[_0xa582bb(0x20d)]==='')){if(_0x3e6843?.[_0xa582bb(0x20d)]&&isPendingActivationId(_0x3e6843[_0xa582bb(0x20d)])){const _0x38def3=extractPendingActivationName(_0x3e6843[_0xa582bb(0x20d)]),_0x57c868=_0x5e4ff9[_0xa582bb(0x1f1)](_0x38def3);_0x57c868&&(_0x151848['journeyActivationStepId']=_0x57c868);}}if(_0x151848[_0xa582bb(0x1ce)]==='DecisionPoint'&&_0x151848[_0xa582bb(0x262)]&&_0x3e6843?.[_0xa582bb(0x262)])for(let _0x19d50f=0x0;_0x19d50f<_0x151848[_0xa582bb(0x262)][_0xa582bb(0x280)];_0x19d50f++){const _0x475209=_0x151848['branches'][_0x19d50f],_0x1e4f4e=_0x3e6843[_0xa582bb(0x262)][_0x19d50f];if(_0x1e4f4e?.[_0xa582bb(0x1d4)]&&isPendingSegmentId(_0x1e4f4e[_0xa582bb(0x1d4)])){const _0x4d93e6=_0x5b8938(_0x1e4f4e[_0xa582bb(0x1d4)],_0xa582bb(0x252)+_0x3637a9[_0xa582bb(0x265)]+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x475209[_0xa582bb(0x265)]||_0x19d50f)+'\x27');_0x4d93e6&&(_0x475209[_0xa582bb(0x1d4)]=_0x4d93e6);}}_0x151848[_0xa582bb(0x1ce)]===_0xa582bb(0x1f6)&&_0x3e6843?.['type']===_0xa582bb(0x1f6)&&resolveWaitStepPendingIds(_0x151848,_0x3e6843,_0x5b8938,_0x3637a9[_0xa582bb(0x265)]);}}}}
@@ -1 +1 @@
1
- function a141_0x588f(_0x1929e2,_0x28eb3d){_0x1929e2=_0x1929e2-0xa4;const _0x557ed4=a141_0x557e();let _0x588f05=_0x557ed4[_0x1929e2];return _0x588f05;}(function(_0x35bee2,_0x1cd404){const _0x88f66=a141_0x588f,_0x36e46b=_0x35bee2();while(!![]){try{const _0x2caf94=parseInt(_0x88f66(0xa5))/0x1*(parseInt(_0x88f66(0xb0))/0x2)+parseInt(_0x88f66(0xa6))/0x3+parseInt(_0x88f66(0xaa))/0x4*(-parseInt(_0x88f66(0xb4))/0x5)+parseInt(_0x88f66(0xa4))/0x6+-parseInt(_0x88f66(0xab))/0x7*(-parseInt(_0x88f66(0xaf))/0x8)+-parseInt(_0x88f66(0xa9))/0x9*(-parseInt(_0x88f66(0xa8))/0xa)+-parseInt(_0x88f66(0xa7))/0xb;if(_0x2caf94===_0x1cd404)break;else _0x36e46b['push'](_0x36e46b['shift']());}catch(_0xf3a1b4){_0x36e46b['push'](_0x36e46b['shift']());}}}(a141_0x557e,0xe3f71));export function buildFolderIdToPathMap(_0x2158dd){const _0x273071=a141_0x588f,_0x488e8a=new Map(),_0x36a50d=new Map();for(const _0x4633d7 of _0x2158dd){_0x36a50d[_0x273071(0xb3)](_0x4633d7['id'],_0x4633d7);}const _0x5344de=new Set();for(const _0x280a09 of _0x2158dd){!_0x280a09['parentFolderId']&&_0x5344de['add'](_0x280a09['id']);}function _0x42ea5a(_0xcb75ab){const _0x14d1aa=_0x273071;if(_0x488e8a[_0x14d1aa(0xad)](_0xcb75ab['id']))return _0x488e8a[_0x14d1aa(0xb2)](_0xcb75ab['id']);if(_0x5344de[_0x14d1aa(0xad)](_0xcb75ab['id']))return _0x488e8a[_0x14d1aa(0xb3)](_0xcb75ab['id'],''),'';if(_0xcb75ab['parentFolderId']){const _0x5c86e0=_0x36a50d[_0x14d1aa(0xb2)](_0xcb75ab[_0x14d1aa(0xb1)]);if(_0x5c86e0){const _0x3abad4=_0x42ea5a(_0x5c86e0),_0x11efef=_0x3abad4?_0x3abad4+'/'+_0xcb75ab[_0x14d1aa(0xac)]:_0xcb75ab[_0x14d1aa(0xac)];return _0x488e8a[_0x14d1aa(0xb3)](_0xcb75ab['id'],_0x11efef),_0x11efef;}}const _0x419feb=_0xcb75ab['name'];return _0x488e8a[_0x14d1aa(0xb3)](_0xcb75ab['id'],_0x419feb),_0x419feb;}for(const _0x3fc309 of _0x2158dd){_0x42ea5a(_0x3fc309);}return _0x488e8a;}export function buildFolderPathToIdMap(_0x4ed30a){const _0x529d4f=a141_0x588f,_0x39ffa4=new Map(),_0x1b5319=new Map();for(const _0xac5341 of _0x4ed30a){_0x1b5319[_0x529d4f(0xb3)](_0xac5341['id'],_0xac5341);}const _0x490b9c=new Set();for(const _0x581639 of _0x4ed30a){!_0x581639[_0x529d4f(0xb1)]&&_0x490b9c[_0x529d4f(0xae)](_0x581639['id']);}function _0x55a057(_0x5e97dc){const _0x2e5fe2=_0x529d4f;if(_0x490b9c[_0x2e5fe2(0xad)](_0x5e97dc['id']))return'';if(_0x5e97dc[_0x2e5fe2(0xb1)]){const _0x1bab91=_0x1b5319[_0x2e5fe2(0xb2)](_0x5e97dc[_0x2e5fe2(0xb1)]);if(_0x1bab91){const _0x21e1e9=_0x55a057(_0x1bab91);return _0x21e1e9?_0x21e1e9+'/'+_0x5e97dc[_0x2e5fe2(0xac)]:_0x5e97dc[_0x2e5fe2(0xac)];}}return _0x5e97dc[_0x2e5fe2(0xac)];}for(const _0x41ac65 of _0x4ed30a){const _0x11f677=_0x55a057(_0x41ac65);_0x39ffa4['set'](_0x11f677,_0x41ac65['id']);}return _0x39ffa4;}export function buildFolderMaps(_0x4afc91){const _0x1f0750=buildFolderIdToPathMap(_0x4afc91),_0x20bc89=new Map();for(const [_0x222813,_0x5b95d1]of _0x1f0750){_0x20bc89['set'](_0x5b95d1,_0x222813);}return{'idToPath':_0x1f0750,'pathToId':_0x20bc89};}export function getFolderPath(_0x5c3b69,_0x11693a){const _0x29c313=a141_0x588f;if(!_0x5c3b69)return'';return _0x11693a[_0x29c313(0xb2)](_0x5c3b69)??'';}function a141_0x557e(){const _0x1345d8=['637EcKuFQ','name','has','add','50232XJAtYm','1313384madudD','parentFolderId','get','set','155lGIgFB','6212256htiSJG','2idMupY','2952813QckSMl','28766463kFbyyA','450XZDANI','119988bYklEr','123288TRqOVi'];a141_0x557e=function(){return _0x1345d8;};return a141_0x557e();}
1
+ (function(_0x1b8477,_0xa471b3){const _0x2340ca=a141_0x46f7,_0x1604e1=_0x1b8477();while(!![]){try{const _0x4039d4=-parseInt(_0x2340ca(0x19b))/0x1+-parseInt(_0x2340ca(0x192))/0x2*(-parseInt(_0x2340ca(0x19f))/0x3)+parseInt(_0x2340ca(0x19a))/0x4*(-parseInt(_0x2340ca(0x195))/0x5)+-parseInt(_0x2340ca(0x19c))/0x6+parseInt(_0x2340ca(0x197))/0x7*(-parseInt(_0x2340ca(0x193))/0x8)+parseInt(_0x2340ca(0x19d))/0x9+parseInt(_0x2340ca(0x199))/0xa;if(_0x4039d4===_0xa471b3)break;else _0x1604e1['push'](_0x1604e1['shift']());}catch(_0x2a029f){_0x1604e1['push'](_0x1604e1['shift']());}}}(a141_0x5058,0x397f5));export function buildFolderIdToPathMap(_0x27c392){const _0x5a2254=a141_0x46f7,_0x2859a8=new Map(),_0x49e92e=new Map();for(const _0x51d61a of _0x27c392){_0x49e92e[_0x5a2254(0x19e)](_0x51d61a['id'],_0x51d61a);}const _0xd85a62=new Set();for(const _0x2f5359 of _0x27c392){!_0x2f5359[_0x5a2254(0x196)]&&_0xd85a62[_0x5a2254(0x1a0)](_0x2f5359['id']);}function _0x47eae7(_0x594f73){const _0x529509=_0x5a2254;if(_0x2859a8[_0x529509(0x1a1)](_0x594f73['id']))return _0x2859a8['get'](_0x594f73['id']);if(_0xd85a62[_0x529509(0x1a1)](_0x594f73['id']))return _0x2859a8['set'](_0x594f73['id'],''),'';if(_0x594f73[_0x529509(0x196)]){const _0x1e81f2=_0x49e92e['get'](_0x594f73[_0x529509(0x196)]);if(_0x1e81f2){const _0x41604c=_0x47eae7(_0x1e81f2),_0x64bd01=_0x41604c?_0x41604c+'/'+_0x594f73[_0x529509(0x194)]:_0x594f73[_0x529509(0x194)];return _0x2859a8[_0x529509(0x19e)](_0x594f73['id'],_0x64bd01),_0x64bd01;}}const _0xca77c=_0x594f73[_0x529509(0x194)];return _0x2859a8[_0x529509(0x19e)](_0x594f73['id'],_0xca77c),_0xca77c;}for(const _0x483a5e of _0x27c392){_0x47eae7(_0x483a5e);}return _0x2859a8;}export function buildFolderPathToIdMap(_0x588206){const _0x382765=a141_0x46f7,_0x30d86e=new Map(),_0x94da5=new Map();for(const _0x408c3b of _0x588206){_0x94da5['set'](_0x408c3b['id'],_0x408c3b);}const _0x46513b=new Set();for(const _0x42d4e3 of _0x588206){!_0x42d4e3[_0x382765(0x196)]&&_0x46513b['add'](_0x42d4e3['id']);}function _0x3497b1(_0x1c668d){const _0x1a0d1a=_0x382765;if(_0x46513b['has'](_0x1c668d['id']))return'';if(_0x1c668d['parentFolderId']){const _0x5763d2=_0x94da5[_0x1a0d1a(0x198)](_0x1c668d[_0x1a0d1a(0x196)]);if(_0x5763d2){const _0x43f6a7=_0x3497b1(_0x5763d2);return _0x43f6a7?_0x43f6a7+'/'+_0x1c668d[_0x1a0d1a(0x194)]:_0x1c668d[_0x1a0d1a(0x194)];}}return _0x1c668d[_0x1a0d1a(0x194)];}for(const _0x145c1d of _0x588206){const _0xe4a757=_0x3497b1(_0x145c1d);_0x30d86e[_0x382765(0x19e)](_0xe4a757,_0x145c1d['id']);}return _0x30d86e;}export function buildFolderMaps(_0x52d2be){const _0x44a490=a141_0x46f7,_0x251eb0=buildFolderIdToPathMap(_0x52d2be),_0x26a60c=new Map();for(const [_0x528437,_0x55ef63]of _0x251eb0){_0x26a60c[_0x44a490(0x19e)](_0x55ef63,_0x528437);}return{'idToPath':_0x251eb0,'pathToId':_0x26a60c};}function a141_0x46f7(_0x1cb1f4,_0x23ecba){_0x1cb1f4=_0x1cb1f4-0x192;const _0x505864=a141_0x5058();let _0x46f70d=_0x505864[_0x1cb1f4];return _0x46f70d;}function a141_0x5058(){const _0x279f42=['parentFolderId','2590eGnKZI','get','1582540zhlbbr','88096imDFUu','71331mSNpGW','735144qViJFt','3331071DTNWjn','set','3MvnKEy','add','has','920834smIvoD','3048KjzQuJ','name','95lEnOwz'];a141_0x5058=function(){return _0x279f42;};return a141_0x5058();}export function getFolderPath(_0x5a384d,_0x18834e){const _0x37b15d=a141_0x46f7;if(!_0x5a384d)return'';return _0x18834e[_0x37b15d(0x198)](_0x5a384d)??'';}
@@ -1 +1 @@
1
- (function(_0x4a4fd4,_0x1e447f){const _0x308858=a142_0x5f54,_0x52bdeb=_0x4a4fd4();while(!![]){try{const _0x16e7a6=parseInt(_0x308858(0x1b3))/0x1*(-parseInt(_0x308858(0x186))/0x2)+parseInt(_0x308858(0x18c))/0x3+-parseInt(_0x308858(0x198))/0x4+-parseInt(_0x308858(0x1af))/0x5*(-parseInt(_0x308858(0x1a9))/0x6)+-parseInt(_0x308858(0x1a1))/0x7+parseInt(_0x308858(0x1b0))/0x8*(-parseInt(_0x308858(0x188))/0x9)+parseInt(_0x308858(0x1ae))/0xa;if(_0x16e7a6===_0x1e447f)break;else _0x52bdeb['push'](_0x52bdeb['shift']());}catch(_0x49ab94){_0x52bdeb['push'](_0x52bdeb['shift']());}}}(a142_0x18af,0xa2607));import a142_0x31116e from'path';import{parse as a142_0x377afe}from'yaml';function a142_0x18af(){const _0x1b959a=['Path\x20cannot\x20be\x20empty','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','relative','raw','trim','exists','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','dirname','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','1586584WxzeKr','startsWith','Path\x20attempts\x20to\x20navigate\x20above\x20root','type','parse','endsWith','root','.yml','segments','2819432wNtPUH','push','filter','Path\x20segment\x20cannot\x20be\x20empty','pop','length','isAbsolute','Cannot\x20navigate\x20above\x20root','354qDuujN','No\x20tdx.json\x20found\x20for\x20file:\x20','substring','resolve','tdx.json','18449180cmPImw','66985AgOXAj','9521896WxgEmt','replace','Relative\x20path\x20cannot\x20be\x20empty','565JOGJsZ','join','4422NdTzGB','journey','9hrHowz','readFile','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','segment','3805884oRIiDZ','test'];a142_0x18af=function(){return _0x1b959a;};return a142_0x18af();}import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x406fce){const _0xb0cf7d=a142_0x5f54;if(!_0x406fce||_0x406fce[_0xb0cf7d(0x192)]()==='')throw new Error(_0xb0cf7d(0x18e));const _0x21b7e8=_0x406fce[_0xb0cf7d(0x192)]();if(_0x21b7e8==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x406fce};const _0x3a0bde=_0x21b7e8[_0xb0cf7d(0x199)]('/')?_0x21b7e8[_0xb0cf7d(0x1ab)](0x1):_0x21b7e8,_0x3eb03d=_0x3a0bde['split']('/')[_0xb0cf7d(0x1a3)](_0x4461a1=>_0x4461a1!=='');if(_0x3eb03d['length']===0x0)throw new Error(_0xb0cf7d(0x196));const _0x28e811=_0x21b7e8[_0xb0cf7d(0x199)]('/')||!isRelativePathSegment(_0x3eb03d[0x0]);for(const _0x271455 of _0x3eb03d){validatePathSegment(_0x271455);}return{'segments':_0x3eb03d,'isAbsolute':_0x28e811,'raw':_0x406fce};}function isRelativePathSegment(_0x36dc63){return _0x36dc63==='.'||_0x36dc63==='..';}function validatePathSegment(_0x2ad352){const _0x12215a=a142_0x5f54;if(_0x2ad352==='')throw new Error(_0x12215a(0x1a4));if(_0x2ad352==='.'||_0x2ad352==='..')return;if(/[\x00-\x1F\x7F]/[_0x12215a(0x18d)](_0x2ad352))throw new Error(_0x12215a(0x194)+_0x2ad352);if(_0x2ad352!==_0x2ad352[_0x12215a(0x192)]()){}}export function validatePath(_0x39bfcd){const _0x1b44c4=a142_0x5f54;if(_0x39bfcd['segments'][_0x1b44c4(0x1a6)]===0x0&&!_0x39bfcd['isAbsolute'])throw new Error(_0x1b44c4(0x1b2));if(_0x39bfcd['isAbsolute']){if(_0x39bfcd[_0x1b44c4(0x1a0)][0x0]==='..')throw new Error(_0x1b44c4(0x18f));let _0x4d09f0=0x0;for(const _0x3f61aa of _0x39bfcd['segments']){if(_0x3f61aa==='..'){if(_0x4d09f0===0x0)throw new Error(_0x1b44c4(0x19a));_0x4d09f0--;}else _0x3f61aa!=='.'&&_0x4d09f0++;}}}export function joinPaths(_0x22d923,_0x118a22){const _0x4b63c3=a142_0x5f54;if(!_0x22d923||_0x22d923==='/')return _0x118a22;if(!_0x118a22||_0x118a22==='.')return _0x22d923;if(_0x118a22[_0x4b63c3(0x199)]('/'))return _0x118a22;const _0x2a7c9e=parsePath(_0x22d923),_0x4f9d2b=parsePath(_0x118a22),_0xea350=[..._0x2a7c9e[_0x4b63c3(0x1a0)]];for(const _0x2b98d0 of _0x4f9d2b[_0x4b63c3(0x1a0)]){if(_0x2b98d0==='.')continue;else{if(_0x2b98d0==='..'){if(_0xea350[_0x4b63c3(0x1a6)]===0x0)throw new Error(_0x4b63c3(0x1a8));_0xea350[_0x4b63c3(0x1a5)]();}else _0xea350[_0x4b63c3(0x1a2)](_0x2b98d0);}}const _0x303f50=_0xea350[_0x4b63c3(0x1b4)]('/');return _0x2a7c9e[_0x4b63c3(0x191)][_0x4b63c3(0x199)]('/')?'/'+_0x303f50:_0x303f50;}export function normalizePath(_0x28acd6){const _0x21ab8c=a142_0x5f54,_0x58a275=parsePath(_0x28acd6),_0x4dca1e=[];for(const _0x5c138e of _0x58a275['segments']){if(_0x5c138e==='.')continue;else{if(_0x5c138e==='..'){if(_0x4dca1e[_0x21ab8c(0x1a6)]===0x0){if(_0x58a275['isAbsolute'])throw new Error(_0x21ab8c(0x1a8));_0x4dca1e[_0x21ab8c(0x1a2)]('..');}else _0x4dca1e[_0x4dca1e[_0x21ab8c(0x1a6)]-0x1]==='..'?_0x4dca1e[_0x21ab8c(0x1a2)]('..'):_0x4dca1e['pop']();}else _0x4dca1e['push'](_0x5c138e);}}if(_0x4dca1e['length']===0x0)return _0x58a275[_0x21ab8c(0x1a7)]?'/':'.';const _0x24fc62=_0x4dca1e[_0x21ab8c(0x1b4)]('/');return _0x58a275[_0x21ab8c(0x191)][_0x21ab8c(0x199)]('/')?'/'+_0x24fc62:_0x24fc62;}export function getParentPath(_0x47a688){const _0x4c947f=a142_0x5f54,_0x411804=parsePath(_0x47a688);if(_0x411804[_0x4c947f(0x1a0)][_0x4c947f(0x1a6)]<=0x1)return'/';const _0x4b0fd2=_0x411804[_0x4c947f(0x1a0)]['slice'](0x0,-0x1)[_0x4c947f(0x1b4)]('/');return _0x411804[_0x4c947f(0x191)]['startsWith']('/')?'/'+_0x4b0fd2:_0x4b0fd2;}export function getBaseName(_0x51b116){const _0x4e8b99=a142_0x5f54,_0x1a9a01=parsePath(_0x51b116);return _0x1a9a01[_0x4e8b99(0x1a0)][_0x1a9a01[_0x4e8b99(0x1a0)][_0x4e8b99(0x1a6)]-0x1]||'';}export function isChildPath(_0x19db36,_0x3af44a){const _0x5e08df=a142_0x5f54,_0x1f6973=parsePath(_0x19db36),_0x2df254=parsePath(_0x3af44a);if(_0x1f6973[_0x5e08df(0x1a0)]['length']<=_0x2df254[_0x5e08df(0x1a0)][_0x5e08df(0x1a6)])return![];for(let _0x350d68=0x0;_0x350d68<_0x2df254[_0x5e08df(0x1a0)][_0x5e08df(0x1a6)];_0x350d68++){if(_0x1f6973[_0x5e08df(0x1a0)][_0x350d68]!==_0x2df254[_0x5e08df(0x1a0)][_0x350d68])return![];}return!![];}export function splitPath(_0x4da941){const _0x379e04=a142_0x5f54,_0x202749=parsePath(_0x4da941);if(_0x202749[_0x379e04(0x1a0)]['length']===0x0)throw new Error('Cannot\x20split\x20empty\x20path');if(_0x202749[_0x379e04(0x1a0)][_0x379e04(0x1a6)]===0x1)return{'parent':_0x202749[_0x379e04(0x1a0)][0x0]};return{'parent':_0x202749[_0x379e04(0x1a0)][0x0],'child':_0x202749['segments']['slice'](0x1)[_0x379e04(0x1b4)]('/')};}export function isYamlFilePath(_0x44e08f){const _0x330b99=a142_0x5f54;return _0x44e08f['endsWith'](_0x330b99(0x19f))||_0x44e08f[_0x330b99(0x19d)]('.yaml');}function a142_0x5f54(_0xaacfa4,_0x2964d7){_0xaacfa4=_0xaacfa4-0x186;const _0x18afd8=a142_0x18af();let _0x5f54c4=_0x18afd8[_0xaacfa4];return _0x5f54c4;}export async function resolveYamlFilePath(_0x2609f7,_0x181348=nodeFileSystem){const _0x1a8baf=a142_0x5f54,_0x259e8f=a142_0x31116e[_0x1a8baf(0x1ac)](_0x2609f7);if(!await _0x181348[_0x1a8baf(0x193)](_0x259e8f))throw new Error('File\x20not\x20found:\x20'+_0x2609f7);let _0x3ad21e=a142_0x31116e[_0x1a8baf(0x195)](_0x259e8f),_0x2d8328=null,_0x37807c=null;const _0x4a7075=a142_0x31116e[_0x1a8baf(0x19c)](_0x3ad21e)[_0x1a8baf(0x19e)];while(_0x3ad21e!==_0x4a7075){const _0xb4b8=a142_0x31116e[_0x1a8baf(0x1b4)](_0x3ad21e,_0x1a8baf(0x1ad));if(await _0x181348[_0x1a8baf(0x193)](_0xb4b8)){_0x2d8328=_0xb4b8,_0x37807c=_0x3ad21e;break;}_0x3ad21e=a142_0x31116e[_0x1a8baf(0x195)](_0x3ad21e);}if(!_0x2d8328||!_0x37807c)throw new Error(_0x1a8baf(0x1aa)+_0x2609f7+'\x0a'+'Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.');const _0x2d9bcd=await _0x181348[_0x1a8baf(0x189)](_0x2d8328),_0x49b25e=JSON['parse'](_0x2d9bcd),_0x3f8bdd=_0x49b25e['parent_segment'];if(!_0x3f8bdd)throw new Error(_0x1a8baf(0x18a));const _0x221c2c=await _0x181348['readFile'](_0x259e8f),_0x369d04=a142_0x377afe(_0x221c2c),_0x2d7f1b=_0x369d04['name'];if(!_0x2d7f1b)throw new Error(_0x1a8baf(0x197)+_0x2609f7);const _0xc7e71=_0x369d04[_0x1a8baf(0x19b)]===_0x1a8baf(0x187)?_0x1a8baf(0x187):_0x1a8baf(0x18b),_0x59e2a2=a142_0x31116e[_0x1a8baf(0x190)](_0x37807c,_0x259e8f),_0x50a5d3=a142_0x31116e[_0x1a8baf(0x195)](_0x59e2a2),_0x3ba983=_0x50a5d3==='.'?'':_0x50a5d3[_0x1a8baf(0x1b1)](/\\/g,'/'),_0x1a67cd=_0x3ba983?_0x3f8bdd+'/'+_0x3ba983+'/'+_0x2d7f1b:_0x3f8bdd+'/'+_0x2d7f1b;return{'parentSegment':_0x3f8bdd,'segmentName':_0x2d7f1b,'folderPath':_0x3ba983,'fullPath':_0x1a67cd,'resourceType':_0xc7e71,'content':_0x221c2c};}
1
+ (function(_0x3a9198,_0x291cef){const _0x4025fc=a142_0x1fde,_0x43de19=_0x3a9198();while(!![]){try{const _0x22c99c=parseInt(_0x4025fc(0x108))/0x1*(-parseInt(_0x4025fc(0x122))/0x2)+parseInt(_0x4025fc(0xf6))/0x3*(-parseInt(_0x4025fc(0x11b))/0x4)+parseInt(_0x4025fc(0xf2))/0x5*(parseInt(_0x4025fc(0xfd))/0x6)+-parseInt(_0x4025fc(0x112))/0x7+-parseInt(_0x4025fc(0x100))/0x8+parseInt(_0x4025fc(0xf8))/0x9*(parseInt(_0x4025fc(0x106))/0xa)+parseInt(_0x4025fc(0xf3))/0xb;if(_0x22c99c===_0x291cef)break;else _0x43de19['push'](_0x43de19['shift']());}catch(_0x127e60){_0x43de19['push'](_0x43de19['shift']());}}}(a142_0x5e8d,0x28aae));import a142_0x423373 from'path';import{parse as a142_0x249842}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x23583f){const _0x11732d=a142_0x1fde;if(!_0x23583f||_0x23583f[_0x11732d(0xfb)]()==='')throw new Error(_0x11732d(0x116));const _0x4fc9ce=_0x23583f['trim']();if(_0x4fc9ce==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x23583f};const _0x27b93f=_0x4fc9ce[_0x11732d(0x11f)]('/')?_0x4fc9ce[_0x11732d(0xfc)](0x1):_0x4fc9ce,_0x481e52=_0x27b93f['split']('/')[_0x11732d(0x118)](_0x535dec=>_0x535dec!=='');if(_0x481e52[_0x11732d(0x10d)]===0x0)throw new Error(_0x11732d(0x113));const _0xd25abb=_0x4fc9ce[_0x11732d(0x11f)]('/')||!isRelativePathSegment(_0x481e52[0x0]);for(const _0x35a734 of _0x481e52){validatePathSegment(_0x35a734);}return{'segments':_0x481e52,'isAbsolute':_0xd25abb,'raw':_0x23583f};}function isRelativePathSegment(_0x52674d){return _0x52674d==='.'||_0x52674d==='..';}function validatePathSegment(_0x3a52a0){const _0x134ad3=a142_0x1fde;if(_0x3a52a0==='')throw new Error(_0x134ad3(0x10c));if(_0x3a52a0==='.'||_0x3a52a0==='..')return;if(/[\x00-\x1F\x7F]/[_0x134ad3(0x104)](_0x3a52a0))throw new Error(_0x134ad3(0x120)+_0x3a52a0);if(_0x3a52a0!==_0x3a52a0[_0x134ad3(0xfb)]()){}}export function validatePath(_0x5a15c4){const _0x1507f8=a142_0x1fde;if(_0x5a15c4[_0x1507f8(0x11a)][_0x1507f8(0x10d)]===0x0&&!_0x5a15c4[_0x1507f8(0xf7)])throw new Error(_0x1507f8(0x10a));if(_0x5a15c4[_0x1507f8(0xf7)]){if(_0x5a15c4['segments'][0x0]==='..')throw new Error(_0x1507f8(0x11e));let _0x76c980=0x0;for(const _0x56df85 of _0x5a15c4[_0x1507f8(0x11a)]){if(_0x56df85==='..'){if(_0x76c980===0x0)throw new Error(_0x1507f8(0x111));_0x76c980--;}else _0x56df85!=='.'&&_0x76c980++;}}}export function joinPaths(_0x521efd,_0x5554e3){const _0x52d498=a142_0x1fde;if(!_0x521efd||_0x521efd==='/')return _0x5554e3;if(!_0x5554e3||_0x5554e3==='.')return _0x521efd;if(_0x5554e3[_0x52d498(0x11f)]('/'))return _0x5554e3;const _0x331b31=parsePath(_0x521efd),_0x4b96d3=parsePath(_0x5554e3),_0x5621b2=[..._0x331b31['segments']];for(const _0x249b5f of _0x4b96d3[_0x52d498(0x11a)]){if(_0x249b5f==='.')continue;else{if(_0x249b5f==='..'){if(_0x5621b2[_0x52d498(0x10d)]===0x0)throw new Error('Cannot\x20navigate\x20above\x20root');_0x5621b2['pop']();}else _0x5621b2[_0x52d498(0x121)](_0x249b5f);}}const _0x201931=_0x5621b2['join']('/');return _0x331b31[_0x52d498(0x10b)][_0x52d498(0x11f)]('/')?'/'+_0x201931:_0x201931;}export function normalizePath(_0x415d9b){const _0x530a79=a142_0x1fde,_0x4bfbca=parsePath(_0x415d9b),_0x173866=[];for(const _0x4a5315 of _0x4bfbca[_0x530a79(0x11a)]){if(_0x4a5315==='.')continue;else{if(_0x4a5315==='..'){if(_0x173866[_0x530a79(0x10d)]===0x0){if(_0x4bfbca[_0x530a79(0xf7)])throw new Error(_0x530a79(0x101));_0x173866[_0x530a79(0x121)]('..');}else _0x173866[_0x173866[_0x530a79(0x10d)]-0x1]==='..'?_0x173866[_0x530a79(0x121)]('..'):_0x173866['pop']();}else _0x173866[_0x530a79(0x121)](_0x4a5315);}}if(_0x173866['length']===0x0)return _0x4bfbca[_0x530a79(0xf7)]?'/':'.';const _0xb76903=_0x173866[_0x530a79(0xf4)]('/');return _0x4bfbca['raw']['startsWith']('/')?'/'+_0xb76903:_0xb76903;}export function getParentPath(_0x397431){const _0x46bcb7=a142_0x1fde,_0x27b758=parsePath(_0x397431);if(_0x27b758[_0x46bcb7(0x11a)][_0x46bcb7(0x10d)]<=0x1)return'/';const _0x272a73=_0x27b758['segments'][_0x46bcb7(0x115)](0x0,-0x1)['join']('/');return _0x27b758[_0x46bcb7(0x10b)]['startsWith']('/')?'/'+_0x272a73:_0x272a73;}function a142_0x5e8d(){const _0x22bff2=['90ULDXWF','parse','215062epIfza','.yml','Relative\x20path\x20cannot\x20be\x20empty','raw','Path\x20segment\x20cannot\x20be\x20empty','length','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','dirname','name','Path\x20attempts\x20to\x20navigate\x20above\x20root','2082122GlpjBG','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','root','slice','Path\x20cannot\x20be\x20empty','parent_segment','filter','replace','segments','12OvFoAm','tdx.json','Cannot\x20split\x20empty\x20path','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','startsWith','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','push','2vkZGuA','33610sdtAvY','9213919GosgAp','join','File\x20not\x20found:\x20','85713QdmNSJ','isAbsolute','94518JvJPOC','readFile','endsWith','trim','substring','108yGhVHg','.yaml','No\x20tdx.json\x20found\x20for\x20file:\x20','2306784OaGCPP','Cannot\x20navigate\x20above\x20root','segment','journey','test','exists'];a142_0x5e8d=function(){return _0x22bff2;};return a142_0x5e8d();}export function getBaseName(_0x5960c3){const _0x3e1a6d=a142_0x1fde,_0x563b6f=parsePath(_0x5960c3);return _0x563b6f[_0x3e1a6d(0x11a)][_0x563b6f[_0x3e1a6d(0x11a)][_0x3e1a6d(0x10d)]-0x1]||'';}export function isChildPath(_0x99cef3,_0x99dd05){const _0x324d0e=a142_0x1fde,_0x521aa6=parsePath(_0x99cef3),_0x565e7c=parsePath(_0x99dd05);if(_0x521aa6[_0x324d0e(0x11a)][_0x324d0e(0x10d)]<=_0x565e7c[_0x324d0e(0x11a)][_0x324d0e(0x10d)])return![];for(let _0x197e36=0x0;_0x197e36<_0x565e7c['segments'][_0x324d0e(0x10d)];_0x197e36++){if(_0x521aa6['segments'][_0x197e36]!==_0x565e7c[_0x324d0e(0x11a)][_0x197e36])return![];}return!![];}function a142_0x1fde(_0x5d94ab,_0x459785){_0x5d94ab=_0x5d94ab-0xf2;const _0x5e8d4d=a142_0x5e8d();let _0x1fde7c=_0x5e8d4d[_0x5d94ab];return _0x1fde7c;}export function splitPath(_0xff220d){const _0x12c543=a142_0x1fde,_0x146cd0=parsePath(_0xff220d);if(_0x146cd0[_0x12c543(0x11a)][_0x12c543(0x10d)]===0x0)throw new Error(_0x12c543(0x11d));if(_0x146cd0[_0x12c543(0x11a)]['length']===0x1)return{'parent':_0x146cd0['segments'][0x0]};return{'parent':_0x146cd0[_0x12c543(0x11a)][0x0],'child':_0x146cd0['segments']['slice'](0x1)[_0x12c543(0xf4)]('/')};}export function isYamlFilePath(_0x119269){const _0x187448=a142_0x1fde;return _0x119269[_0x187448(0xfa)](_0x187448(0x109))||_0x119269['endsWith'](_0x187448(0xfe));}export async function resolveYamlFilePath(_0x20e5f1,_0x3a1f5e=nodeFileSystem){const _0x165d55=a142_0x1fde,_0x2adb42=a142_0x423373['resolve'](_0x20e5f1);if(!await _0x3a1f5e[_0x165d55(0x105)](_0x2adb42))throw new Error(_0x165d55(0xf5)+_0x20e5f1);let _0x382901=a142_0x423373[_0x165d55(0x10f)](_0x2adb42),_0x52ca66=null,_0x593d32=null;const _0x434d43=a142_0x423373[_0x165d55(0x107)](_0x382901)[_0x165d55(0x114)];while(_0x382901!==_0x434d43){const _0x5db579=a142_0x423373['join'](_0x382901,_0x165d55(0x11c));if(await _0x3a1f5e['exists'](_0x5db579)){_0x52ca66=_0x5db579,_0x593d32=_0x382901;break;}_0x382901=a142_0x423373[_0x165d55(0x10f)](_0x382901);}if(!_0x52ca66||!_0x593d32)throw new Error(_0x165d55(0xff)+_0x20e5f1+'\x0a'+_0x165d55(0x10e));const _0x2e47e5=await _0x3a1f5e['readFile'](_0x52ca66),_0x4120d8=JSON[_0x165d55(0x107)](_0x2e47e5),_0xf1d6e8=_0x4120d8[_0x165d55(0x117)];if(!_0xf1d6e8)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x1c4be9=await _0x3a1f5e[_0x165d55(0xf9)](_0x2adb42),_0x34d543=a142_0x249842(_0x1c4be9),_0x5d7725=_0x34d543[_0x165d55(0x110)];if(!_0x5d7725)throw new Error('Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'+_0x20e5f1);const _0x1d98f1=_0x34d543['type']===_0x165d55(0x103)?_0x165d55(0x103):_0x165d55(0x102),_0xee7ab7=a142_0x423373['relative'](_0x593d32,_0x2adb42),_0x566e2d=a142_0x423373[_0x165d55(0x10f)](_0xee7ab7),_0x5634a8=_0x566e2d==='.'?'':_0x566e2d[_0x165d55(0x119)](/\\/g,'/'),_0x1ef39a=_0x5634a8?_0xf1d6e8+'/'+_0x5634a8+'/'+_0x5d7725:_0xf1d6e8+'/'+_0x5d7725;return{'parentSegment':_0xf1d6e8,'segmentName':_0x5d7725,'folderPath':_0x5634a8,'fullPath':_0x1ef39a,'resourceType':_0x1d98f1,'content':_0x1c4be9};}
@@ -1 +1 @@
1
- (function(_0x2388bb,_0x3a255a){const _0x436671=a143_0x158d,_0x6f45e7=_0x2388bb();while(!![]){try{const _0x5b1cec=parseInt(_0x436671(0x1eb))/0x1+-parseInt(_0x436671(0x1e9))/0x2+-parseInt(_0x436671(0x1ea))/0x3+-parseInt(_0x436671(0x1ec))/0x4+-parseInt(_0x436671(0x1e5))/0x5*(-parseInt(_0x436671(0x1e8))/0x6)+parseInt(_0x436671(0x1f0))/0x7*(-parseInt(_0x436671(0x1ef))/0x8)+-parseInt(_0x436671(0x1ed))/0x9*(-parseInt(_0x436671(0x1f1))/0xa);if(_0x5b1cec===_0x3a255a)break;else _0x6f45e7['push'](_0x6f45e7['shift']());}catch(_0x5bb85a){_0x6f45e7['push'](_0x6f45e7['shift']());}}}(a143_0x565b,0xe1241));function a143_0x565b(){const _0x2ef3fe=['.\x20Child\x20name\x20cannot\x20be\x20empty','indexOf','6NlRLLH','2195074OMmXWJ','1582434MVngcd','414311mWQIxg','1621504PTLGnz','11825586itBAuw','.\x20Parent\x20name\x20cannot\x20be\x20empty','12774064PRdBBs','7KTZqie','20hhpGQQ','Invalid\x20segment\x20reference\x20format:\x20','7535535xuKRuY'];a143_0x565b=function(){return _0x2ef3fe;};return a143_0x565b();}function a143_0x158d(_0x198890,_0x900996){_0x198890=_0x198890-0x1e4;const _0x565b0a=a143_0x565b();let _0x158d6a=_0x565b0a[_0x198890];return _0x158d6a;}export function parseSegmentRef(_0x4ad8df){const _0x1682a4=a143_0x158d,_0x4c067f=_0x4ad8df[_0x1682a4(0x1e7)]('/');if(_0x4c067f===-0x1)return{'parentId':_0x4ad8df};if(_0x4c067f===0x0)throw new Error(_0x1682a4(0x1e4)+_0x4ad8df+_0x1682a4(0x1ee));const _0x505e19=_0x4ad8df['substring'](0x0,_0x4c067f),_0x3aa5ad=_0x4ad8df['substring'](_0x4c067f+0x1);if(_0x3aa5ad==='')throw new Error(_0x1682a4(0x1e4)+_0x4ad8df+_0x1682a4(0x1e6));return{'parentId':_0x505e19,'childId':_0x3aa5ad};}
1
+ function a143_0x5455(_0x315dfa,_0xa00340){_0x315dfa=_0x315dfa-0x196;const _0x4203fd=a143_0x4203();let _0x545595=_0x4203fd[_0x315dfa];return _0x545595;}(function(_0x498c75,_0x2df1ad){const _0x20b995=a143_0x5455,_0xa8345c=_0x498c75();while(!![]){try{const _0xa70e9a=-parseInt(_0x20b995(0x1a4))/0x1*(-parseInt(_0x20b995(0x19f))/0x2)+parseInt(_0x20b995(0x19a))/0x3*(parseInt(_0x20b995(0x198))/0x4)+-parseInt(_0x20b995(0x19b))/0x5+parseInt(_0x20b995(0x1a0))/0x6*(-parseInt(_0x20b995(0x199))/0x7)+-parseInt(_0x20b995(0x1a5))/0x8*(-parseInt(_0x20b995(0x1a1))/0x9)+parseInt(_0x20b995(0x1a3))/0xa+-parseInt(_0x20b995(0x19c))/0xb;if(_0xa70e9a===_0x2df1ad)break;else _0xa8345c['push'](_0xa8345c['shift']());}catch(_0x2d7751){_0xa8345c['push'](_0xa8345c['shift']());}}}(a143_0x4203,0xb1c62));export function parseSegmentRef(_0x295681){const _0x282d2=a143_0x5455,_0x3d1be8=_0x295681[_0x282d2(0x19e)]('/');if(_0x3d1be8===-0x1)return{'parentId':_0x295681};if(_0x3d1be8===0x0)throw new Error(_0x282d2(0x1a2)+_0x295681+_0x282d2(0x19d));const _0x37ea1f=_0x295681[_0x282d2(0x197)](0x0,_0x3d1be8),_0x3099ab=_0x295681[_0x282d2(0x197)](_0x3d1be8+0x1);if(_0x3099ab==='')throw new Error(_0x282d2(0x1a2)+_0x295681+_0x282d2(0x196));return{'parentId':_0x37ea1f,'childId':_0x3099ab};}function a143_0x4203(){const _0x536e6b=['substring','6692pqselj','21jDuWSJ','1083skwnzc','3122960GFloQr','8588085VnbGgA','.\x20Parent\x20name\x20cannot\x20be\x20empty','indexOf','1204666lJoCSV','659310ufomZT','10994463MIJoxy','Invalid\x20segment\x20reference\x20format:\x20','352510ufJkwU','1InSSKO','8MWYcSl','.\x20Child\x20name\x20cannot\x20be\x20empty'];a143_0x4203=function(){return _0x536e6b;};return a143_0x4203();}
@@ -1 +1 @@
1
- (function(_0x47a1ee,_0x57f74a){const _0x4bcf07=a144_0x1fa6,_0xe3b98e=_0x47a1ee();while(!![]){try{const _0x402f20=parseInt(_0x4bcf07(0x8b))/0x1+-parseInt(_0x4bcf07(0x95))/0x2*(parseInt(_0x4bcf07(0x70))/0x3)+parseInt(_0x4bcf07(0xa7))/0x4*(parseInt(_0x4bcf07(0xac))/0x5)+-parseInt(_0x4bcf07(0x97))/0x6*(parseInt(_0x4bcf07(0xa1))/0x7)+-parseInt(_0x4bcf07(0x6b))/0x8*(parseInt(_0x4bcf07(0xa2))/0x9)+parseInt(_0x4bcf07(0xab))/0xa+-parseInt(_0x4bcf07(0x99))/0xb*(-parseInt(_0x4bcf07(0xaf))/0xc);if(_0x402f20===_0x57f74a)break;else _0xe3b98e['push'](_0xe3b98e['shift']());}catch(_0x220524){_0xe3b98e['push'](_0xe3b98e['shift']());}}}(a144_0x2ecc,0x1a9c4));function a144_0x1fa6(_0x1fe6e4,_0x5a2d71){_0x1fe6e4=_0x1fe6e4-0x6a;const _0x2ecc63=a144_0x2ecc();let _0x1fa6f4=_0x2ecc63[_0x1fe6e4];return _0x1fa6f4;}import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x5f3d15,_0x43f00d={},_0x5e72ed={}){const _0x4a7ba5=a144_0x1fa6;if(_0x5e72ed[_0x4a7ba5(0x98)])return runSemanticChecks(_0x5f3d15,_0x43f00d);const _0x2e4be6=SegmentDefSchema[_0x4a7ba5(0x7d)](_0x5f3d15);if(_0x2e4be6[_0x4a7ba5(0x9d)])return runSemanticChecks(_0x2e4be6[_0x4a7ba5(0x6f)],_0x43f00d);return zodErrorsToValidationResult(_0x2e4be6[_0x4a7ba5(0x94)],_0x43f00d);}export function validateRuleDef(_0x543a4f,_0x443b06,_0x3254a2){const _0x29c4e3=a144_0x1fa6;if(!_0x543a4f)return[];const _0x6154ca=RuleDefSchema[_0x29c4e3(0x7d)](_0x543a4f);if(_0x6154ca['success'])return checkRule(_0x6154ca[_0x29c4e3(0x6f)],_0x443b06,_0x3254a2);const _0x21a5ed=flattenZodIssues(_0x6154ca[_0x29c4e3(0x94)][_0x29c4e3(0x6e)]);return _0x21a5ed[_0x29c4e3(0x6a)](_0x82eb28=>{const _0x335991=_0x29c4e3,_0xeb136b=formatZodPath(_0x82eb28['path']),_0x298590=_0xeb136b?_0x443b06+'.'+_0xeb136b:_0x443b06,_0x153c10=mapZodIssueToCode(_0x82eb28,_0xeb136b),_0x546366=getLocationFromPath(_0x3254a2[_0x335991(0x9c)],_0x3254a2['source'],pathToArray(_0x298590));return{'level':'error','path':_0x298590,'code':_0x153c10,'message':_0x82eb28[_0x335991(0x9e)],..._0x546366&&{'location':_0x546366}};});}function zodErrorsToValidationResult(_0x59a6fe,_0x450dd1){const _0x3b9ab5=a144_0x1fa6,_0x49130b=flattenZodIssues(_0x59a6fe[_0x3b9ab5(0x6e)]),_0x62b69f=_0x49130b[_0x3b9ab5(0x6a)](_0x3e4422=>{const _0xa2d7a7=_0x3b9ab5,_0x4f6518=formatZodPath(_0x3e4422['path']),_0x28f197=mapZodIssueToCode(_0x3e4422,_0x4f6518),_0x3db163=getLocationFromPath(_0x450dd1[_0xa2d7a7(0x9c)],_0x450dd1[_0xa2d7a7(0x9b)],_0x3e4422[_0xa2d7a7(0x7b)][_0xa2d7a7(0x6a)](_0x2b6e41=>typeof _0x2b6e41===_0xa2d7a7(0x71)?String(_0x2b6e41):_0x2b6e41));return{'level':'error','path':_0x4f6518,'code':_0x28f197,'message':_0x3e4422[_0xa2d7a7(0x9e)],..._0x3db163&&{'location':_0x3db163}};});return{'valid':![],'errors':_0x62b69f,'warnings':[]};}function a144_0x2ecc(){const _0x3b8056=['2iuiFSp','length','6ptumcC','skipSchema','3762fUEJbK','.conditions','source','document','success','message','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','groups,\x20causing\x20local/server\x20discrepancy.\x20For\x20same-attribute\x20Or\x20conditions,\x20','740201TQzNBq','8559yqOqBx','rule','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','level','.operator.value','4pnGHeu','filter','rule.type','push','508790nqErJZ','393905rislnS','MISSING_CONDITIONS','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','10704isfhkP','map','1512GvvWLW','MISSING_NAME','EMPTY_CONDITIONS','issues','data','205773DpCtiE','symbol','match','.conditions[','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','MISSING_TIME_UNIT','MISSING_BETWEEN_BOUNDS','type','BEHAVIOR_SOURCE_MISSING_FILTER','conditions','EMPTY_ATTRIBUTE','path','Attribute\x20name\x20cannot\x20be\x20empty','safeParse','Behavior','arrayMatching','warning','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','code','\x20condition\x20group\x20not\x20supported.\x20Console\x20UI\x20ignores\x20nested\x20condition\x20','NESTED_CONDITION_GROUP','.attribute','MISSING_OPERATOR_VALUE','validationCode','aggregation','endsWith','28345jaJSJt','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','And','Value','.type','\x27\x20with\x20attribute\x20\x27','attribute','Attribute\x20\x27','error'];a144_0x2ecc=function(){return _0x3b8056;};return a144_0x2ecc();}function mapZodIssueToCode(_0x577d58,_0x4c4c51){const _0x4c4144=a144_0x1fa6,_0x5c8cfc=_0x577d58[_0x4c4144(0x83)]==='custom'?_0x577d58['params']:undefined;if(_0x4c4c51==='name')return _0x4c4144(0x6c);if(_0x4c4c51===_0x4c4144(0xa9)||_0x4c4c51[_0x4c4144(0x8a)](_0x4c4144(0x90))){if(_0x577d58[_0x4c4144(0x83)]==='invalid_value'){if(_0x4c4c51===_0x4c4144(0xa9)||_0x4c4c51[_0x4c4144(0x72)](/\.conditions\[\d+\]\.type$/))return'INVALID_RULE_TYPE';}}if(_0x4c4c51[_0x4c4144(0x8a)]('.operator.type'))return'INVALID_OPERATOR_TYPE';if(_0x4c4c51['endsWith'](_0x4c4144(0xa6)))return _0x4c4144(0x87);if(_0x5c8cfc?.['validationCode']===_0x4c4144(0x76))return _0x4c4144(0x76);if(_0x5c8cfc?.[_0x4c4144(0x88)]===_0x4c4144(0x75))return'MISSING_TIME_UNIT';if(_0x4c4c51[_0x4c4144(0x8a)](_0x4c4144(0x9a))||_0x4c4c51==='conditions')return _0x4c4144(0xad);if(_0x4c4c51['includes'](_0x4c4144(0x7f)))return'INVALID_ARRAY_MATCHING';if(_0x4c4c51[_0x4c4144(0x8a)]('.segment'))return'MISSING_SEGMENT_REFERENCE';return'SEGMENT_SCHEMA_ERROR';}function runSemanticChecks(_0x32e1ea,_0x269555){const _0x792cb2=a144_0x1fa6,_0x374e53=[];_0x32e1ea[_0x792cb2(0xa3)]&&_0x374e53[_0x792cb2(0xaa)](...checkRule(_0x32e1ea[_0x792cb2(0xa3)],_0x792cb2(0xa3),_0x269555));const _0x2e31f3=_0x374e53[_0x792cb2(0xa8)](_0x3e7e13=>_0x3e7e13[_0x792cb2(0xa5)]===_0x792cb2(0x94)),_0x1ae388=_0x374e53[_0x792cb2(0xa8)](_0x5865f4=>_0x5865f4[_0x792cb2(0xa5)]===_0x792cb2(0x80));return{'valid':_0x2e31f3[_0x792cb2(0x96)]===0x0,'errors':_0x2e31f3,'warnings':_0x1ae388};}function checkRule(_0x102921,_0x575413,_0x59e44e){const _0x23159d=a144_0x1fa6,_0x1e06f5=[];if(_0x102921[_0x23159d(0x79)][_0x23159d(0x96)]===0x0)return _0x1e06f5['push']({'level':_0x23159d(0x94),'path':_0x575413+_0x23159d(0x9a),'code':_0x23159d(0x6d),'message':_0x23159d(0xae),'location':getLocationFromPath(_0x59e44e[_0x23159d(0x9c)],_0x59e44e[_0x23159d(0x9b)],pathToArray(_0x575413+_0x23159d(0x9a)))}),_0x1e06f5;return _0x1e06f5[_0x23159d(0xaa)](...checkConditions(_0x102921[_0x23159d(0x79)],_0x575413,_0x59e44e)),_0x1e06f5;}function checkConditions(_0x5d146c,_0x1d30d,_0x424d12){const _0x340710=a144_0x1fa6,_0x291714=[];for(let _0x76bbda=0x0;_0x76bbda<_0x5d146c[_0x340710(0x96)];_0x76bbda++){const _0x2de746=_0x5d146c[_0x76bbda],_0x7238f7=_0x1d30d+_0x340710(0x73)+_0x76bbda+']';_0x291714[_0x340710(0xaa)](...checkCondition(_0x2de746,_0x7238f7,_0x424d12));}return _0x291714;}function checkCondition(_0x524ced,_0x4f7b17,_0x20a1e0){const _0x3c0c4e=a144_0x1fa6,_0x4399bf=[];if(_0x524ced[_0x3c0c4e(0x77)]===_0x3c0c4e(0x8e)||_0x524ced[_0x3c0c4e(0x77)]==='Or')return _0x524ced['conditions'][_0x3c0c4e(0x96)]===0x0?_0x4399bf[_0x3c0c4e(0xaa)]({'level':'error','path':_0x4f7b17+_0x3c0c4e(0x9a),'code':_0x3c0c4e(0x6d),'message':_0x524ced[_0x3c0c4e(0x77)]+_0x3c0c4e(0x81),'location':getLocationFromPath(_0x20a1e0['document'],_0x20a1e0[_0x3c0c4e(0x9b)],pathToArray(_0x4f7b17+_0x3c0c4e(0x9a)))}):_0x4399bf['push']({'level':_0x3c0c4e(0x94),'path':_0x4f7b17,'code':_0x3c0c4e(0x85),'message':_0x524ced['type']+_0x3c0c4e(0x84)+_0x3c0c4e(0xa0)+'use\x20\x27In\x27\x20operator\x20instead:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','location':getLocationFromPath(_0x20a1e0['document'],_0x20a1e0[_0x3c0c4e(0x9b)],pathToArray(_0x4f7b17))}),_0x4399bf;if(_0x524ced[_0x3c0c4e(0x77)]===_0x3c0c4e(0x8f)||_0x524ced[_0x3c0c4e(0x77)]===_0x3c0c4e(0x7e)){const _0x4c633d=_0x524ced,_0xd90670=_0x4c633d[_0x3c0c4e(0x9b)],_0xb39246=_0x4c633d[_0x3c0c4e(0x89)],_0x181f82=_0xd90670||_0xb39246;(!_0x4c633d[_0x3c0c4e(0x92)]||_0x4c633d['attribute']==='')&&(!_0x181f82&&_0x4399bf['push']({'level':_0x3c0c4e(0x94),'path':_0x4f7b17+_0x3c0c4e(0x86),'code':_0x3c0c4e(0x7a),'message':_0x3c0c4e(0x7c),'location':getLocationFromPath(_0x20a1e0[_0x3c0c4e(0x9c)],_0x20a1e0[_0x3c0c4e(0x9b)],pathToArray(_0x4f7b17+_0x3c0c4e(0x86)))}));_0x4c633d[_0x3c0c4e(0xa8)]&&_0x4399bf['push'](...checkRule(_0x4c633d[_0x3c0c4e(0xa8)],_0x4f7b17+'.filter',_0x20a1e0));if(_0x4c633d[_0x3c0c4e(0x9b)]){const _0x331da4=_0x4c633d['attribute']&&_0x4c633d[_0x3c0c4e(0x92)]!=='';_0x331da4&&!_0x4c633d[_0x3c0c4e(0xa8)]&&_0x4399bf[_0x3c0c4e(0xaa)]({'level':_0x3c0c4e(0x94),'path':_0x4f7b17+'.source','code':_0x3c0c4e(0x78),'message':'Behavior\x20source\x20\x27'+_0x4c633d['source']+_0x3c0c4e(0x91)+_0x4c633d[_0x3c0c4e(0x92)]+'\x27\x20'+_0x3c0c4e(0x82)+_0x3c0c4e(0x9f)+_0x3c0c4e(0x74),'location':getLocationFromPath(_0x20a1e0['document'],_0x20a1e0[_0x3c0c4e(0x9b)],pathToArray(_0x4f7b17+'.source'))}),_0x331da4&&_0x4c633d['filter']&&_0x4399bf[_0x3c0c4e(0xaa)]({'level':_0x3c0c4e(0x80),'path':_0x4f7b17+_0x3c0c4e(0x86),'code':_0x3c0c4e(0x8c),'message':_0x3c0c4e(0x93)+_0x4c633d[_0x3c0c4e(0x92)]+_0x3c0c4e(0x8d)+_0x3c0c4e(0xa4),'location':getLocationFromPath(_0x20a1e0[_0x3c0c4e(0x9c)],_0x20a1e0[_0x3c0c4e(0x9b)],pathToArray(_0x4f7b17+_0x3c0c4e(0x86)))});}}return _0x4399bf;}
1
+ (function(_0x4e9e4f,_0x3e9204){const _0x37ec88=a144_0xfc85,_0x3f4b38=_0x4e9e4f();while(!![]){try{const _0xdcb27b=-parseInt(_0x37ec88(0xb8))/0x1+-parseInt(_0x37ec88(0xc5))/0x2+parseInt(_0x37ec88(0xe1))/0x3*(parseInt(_0x37ec88(0xb6))/0x4)+parseInt(_0x37ec88(0xd2))/0x5*(-parseInt(_0x37ec88(0xc7))/0x6)+-parseInt(_0x37ec88(0xe2))/0x7+-parseInt(_0x37ec88(0xdd))/0x8*(parseInt(_0x37ec88(0xcd))/0x9)+-parseInt(_0x37ec88(0xee))/0xa*(-parseInt(_0x37ec88(0xbc))/0xb);if(_0xdcb27b===_0x3e9204)break;else _0x3f4b38['push'](_0x3f4b38['shift']());}catch(_0x2218f1){_0x3f4b38['push'](_0x3f4b38['shift']());}}}(a144_0x1c92,0x7b674));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x13685a,_0x36a0d2={},_0x1888d7={}){const _0x1ef814=a144_0xfc85;if(_0x1888d7[_0x1ef814(0xd9)])return runSemanticChecks(_0x13685a,_0x36a0d2);const _0x564091=SegmentDefSchema[_0x1ef814(0xe8)](_0x13685a);if(_0x564091[_0x1ef814(0xcc)])return runSemanticChecks(_0x564091[_0x1ef814(0xcb)],_0x36a0d2);return zodErrorsToValidationResult(_0x564091[_0x1ef814(0xc2)],_0x36a0d2);}export function validateRuleDef(_0x374cbe,_0x5451df,_0x557981){const _0x400e01=a144_0xfc85;if(!_0x374cbe)return[];const _0x4d55c5=RuleDefSchema['safeParse'](_0x374cbe);if(_0x4d55c5[_0x400e01(0xcc)])return checkRule(_0x4d55c5['data'],_0x5451df,_0x557981);const _0x5673e8=flattenZodIssues(_0x4d55c5[_0x400e01(0xc2)][_0x400e01(0xbf)]);return _0x5673e8[_0x400e01(0xbe)](_0x33f4aa=>{const _0x3ed4f8=_0x400e01,_0x206985=formatZodPath(_0x33f4aa[_0x3ed4f8(0xd8)]),_0x22aa0c=_0x206985?_0x5451df+'.'+_0x206985:_0x5451df,_0xf1a373=mapZodIssueToCode(_0x33f4aa,_0x206985),_0x458f85=getLocationFromPath(_0x557981[_0x3ed4f8(0xd3)],_0x557981[_0x3ed4f8(0xdc)],pathToArray(_0x22aa0c));return{'level':_0x3ed4f8(0xc2),'path':_0x22aa0c,'code':_0xf1a373,'message':_0x33f4aa[_0x3ed4f8(0xb0)],..._0x458f85&&{'location':_0x458f85}};});}function zodErrorsToValidationResult(_0x32f059,_0xa923f7){const _0x120745=a144_0xfc85,_0x4dc465=flattenZodIssues(_0x32f059[_0x120745(0xbf)]),_0x5006f6=_0x4dc465[_0x120745(0xbe)](_0x22d792=>{const _0x439e58=_0x120745,_0x1271c2=formatZodPath(_0x22d792['path']),_0x2d595e=mapZodIssueToCode(_0x22d792,_0x1271c2),_0x5d23a7=getLocationFromPath(_0xa923f7['document'],_0xa923f7[_0x439e58(0xdc)],_0x22d792[_0x439e58(0xd8)][_0x439e58(0xbe)](_0x72c5c7=>typeof _0x72c5c7==='symbol'?String(_0x72c5c7):_0x72c5c7));return{'level':_0x439e58(0xc2),'path':_0x1271c2,'code':_0x2d595e,'message':_0x22d792[_0x439e58(0xb0)],..._0x5d23a7&&{'location':_0x5d23a7}};});return{'valid':![],'errors':_0x5006f6,'warnings':[]};}function mapZodIssueToCode(_0x437468,_0x58a0ce){const _0x44e90d=a144_0xfc85,_0x80ba46=_0x437468[_0x44e90d(0xec)]==='custom'?_0x437468[_0x44e90d(0xb7)]:undefined;if(_0x58a0ce===_0x44e90d(0xe4))return _0x44e90d(0xb5);if(_0x58a0ce==='rule.type'||_0x58a0ce['endsWith'](_0x44e90d(0xde))){if(_0x437468[_0x44e90d(0xec)]===_0x44e90d(0xc0)){if(_0x58a0ce===_0x44e90d(0xb4)||_0x58a0ce[_0x44e90d(0xc8)](/\.conditions\[\d+\]\.type$/))return _0x44e90d(0xd4);}}if(_0x58a0ce['endsWith'](_0x44e90d(0xe3)))return _0x44e90d(0xed);if(_0x58a0ce[_0x44e90d(0xd6)]('.operator.value'))return _0x44e90d(0xe6);if(_0x80ba46?.['validationCode']==='MISSING_BETWEEN_BOUNDS')return _0x44e90d(0xdf);if(_0x80ba46?.['validationCode']===_0x44e90d(0xdb))return _0x44e90d(0xdb);if(_0x58a0ce[_0x44e90d(0xd6)]('.conditions')||_0x58a0ce==='conditions')return _0x44e90d(0xd0);if(_0x58a0ce['includes'](_0x44e90d(0xf2)))return'INVALID_ARRAY_MATCHING';if(_0x58a0ce[_0x44e90d(0xd6)](_0x44e90d(0xea)))return _0x44e90d(0xf1);return'SEGMENT_SCHEMA_ERROR';}function a144_0x1c92(){const _0xa0253=['use\x20\x27In\x27\x20operator\x20instead:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','map','issues','invalid_value','EMPTY_ATTRIBUTE','error','rule','length','835598jZQxKI','EMPTY_CONDITIONS','6Zoazgs','match','filter','\x20condition\x20group\x20not\x20supported.\x20Console\x20UI\x20ignores\x20nested\x20condition\x20','data','success','189BljviO','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','push','MISSING_CONDITIONS','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','1863270fRtshj','document','INVALID_RULE_TYPE','.conditions[','endsWith','.attribute','path','skipSchema','Behavior\x20source\x20\x27','MISSING_TIME_UNIT','source','291224zUgHIO','.type','MISSING_BETWEEN_BOUNDS','Attribute\x20\x27','134454OFFzXC','4902310aaAvem','.operator.type','name','type','MISSING_OPERATOR_VALUE','warning','safeParse','NESTED_CONDITION_GROUP','.segment','BEHAVIOR_SOURCE_MISSING_FILTER','code','INVALID_OPERATOR_TYPE','884090QTUibF','.source','aggregation','MISSING_SEGMENT_REFERENCE','arrayMatching','\x27\x20with\x20attribute\x20\x27','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','message','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','groups,\x20causing\x20local/server\x20discrepancy.\x20For\x20same-attribute\x20Or\x20conditions,\x20','attribute','rule.type','MISSING_NAME','8cMPOjr','params','688472tHlBcu','.conditions','level','Value','418uABGOS'];a144_0x1c92=function(){return _0xa0253;};return a144_0x1c92();}function a144_0xfc85(_0x4274bd,_0x4ff9e8){_0x4274bd=_0x4274bd-0xb0;const _0x1c92ad=a144_0x1c92();let _0xfc85ee=_0x1c92ad[_0x4274bd];return _0xfc85ee;}function runSemanticChecks(_0x56b7e8,_0x272012){const _0xe4a6c4=a144_0xfc85,_0x28c25c=[];_0x56b7e8[_0xe4a6c4(0xc3)]&&_0x28c25c[_0xe4a6c4(0xcf)](...checkRule(_0x56b7e8[_0xe4a6c4(0xc3)],_0xe4a6c4(0xc3),_0x272012));const _0x37ed1d=_0x28c25c['filter'](_0x2ea070=>_0x2ea070[_0xe4a6c4(0xba)]===_0xe4a6c4(0xc2)),_0x59e98b=_0x28c25c[_0xe4a6c4(0xc9)](_0x5b1526=>_0x5b1526[_0xe4a6c4(0xba)]===_0xe4a6c4(0xe7));return{'valid':_0x37ed1d[_0xe4a6c4(0xc4)]===0x0,'errors':_0x37ed1d,'warnings':_0x59e98b};}function checkRule(_0x336b2c,_0x33b30c,_0x508144){const _0x8c5ff5=a144_0xfc85,_0x28b7e7=[];if(_0x336b2c['conditions'][_0x8c5ff5(0xc4)]===0x0)return _0x28b7e7[_0x8c5ff5(0xcf)]({'level':'error','path':_0x33b30c+_0x8c5ff5(0xb9),'code':_0x8c5ff5(0xc6),'message':'Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','location':getLocationFromPath(_0x508144[_0x8c5ff5(0xd3)],_0x508144[_0x8c5ff5(0xdc)],pathToArray(_0x33b30c+_0x8c5ff5(0xb9)))}),_0x28b7e7;return _0x28b7e7['push'](...checkConditions(_0x336b2c['conditions'],_0x33b30c,_0x508144)),_0x28b7e7;}function checkConditions(_0x32f3ac,_0x5a1f88,_0x1a5948){const _0x1b0a6a=a144_0xfc85,_0x42bd5b=[];for(let _0x17afe2=0x0;_0x17afe2<_0x32f3ac['length'];_0x17afe2++){const _0x9b93ae=_0x32f3ac[_0x17afe2],_0xf9aedf=_0x5a1f88+_0x1b0a6a(0xd5)+_0x17afe2+']';_0x42bd5b[_0x1b0a6a(0xcf)](...checkCondition(_0x9b93ae,_0xf9aedf,_0x1a5948));}return _0x42bd5b;}function checkCondition(_0x30f02e,_0x571bbf,_0x284c98){const _0x4836ea=a144_0xfc85,_0x18ff32=[];if(_0x30f02e['type']==='And'||_0x30f02e['type']==='Or')return _0x30f02e['conditions'][_0x4836ea(0xc4)]===0x0?_0x18ff32[_0x4836ea(0xcf)]({'level':_0x4836ea(0xc2),'path':_0x571bbf+_0x4836ea(0xb9),'code':_0x4836ea(0xc6),'message':_0x30f02e['type']+'\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','location':getLocationFromPath(_0x284c98[_0x4836ea(0xd3)],_0x284c98[_0x4836ea(0xdc)],pathToArray(_0x571bbf+_0x4836ea(0xb9)))}):_0x18ff32[_0x4836ea(0xcf)]({'level':'error','path':_0x571bbf,'code':_0x4836ea(0xe9),'message':_0x30f02e[_0x4836ea(0xe5)]+_0x4836ea(0xca)+_0x4836ea(0xb2)+_0x4836ea(0xbd),'location':getLocationFromPath(_0x284c98[_0x4836ea(0xd3)],_0x284c98['source'],pathToArray(_0x571bbf))}),_0x18ff32;if(_0x30f02e['type']===_0x4836ea(0xbb)||_0x30f02e[_0x4836ea(0xe5)]==='Behavior'){const _0x520c47=_0x30f02e,_0xe212f8=_0x520c47[_0x4836ea(0xdc)],_0x22ca63=_0x520c47[_0x4836ea(0xf0)],_0xf6db1c=_0xe212f8||_0x22ca63;(!_0x520c47['attribute']||_0x520c47[_0x4836ea(0xb3)]==='')&&(!_0xf6db1c&&_0x18ff32[_0x4836ea(0xcf)]({'level':_0x4836ea(0xc2),'path':_0x571bbf+_0x4836ea(0xd7),'code':_0x4836ea(0xc1),'message':'Attribute\x20name\x20cannot\x20be\x20empty','location':getLocationFromPath(_0x284c98[_0x4836ea(0xd3)],_0x284c98[_0x4836ea(0xdc)],pathToArray(_0x571bbf+_0x4836ea(0xd7)))}));_0x520c47[_0x4836ea(0xc9)]&&_0x18ff32[_0x4836ea(0xcf)](...checkRule(_0x520c47['filter'],_0x571bbf+'.filter',_0x284c98));if(_0x520c47[_0x4836ea(0xdc)]){const _0x2ea801=_0x520c47[_0x4836ea(0xb3)]&&_0x520c47[_0x4836ea(0xb3)]!=='';_0x2ea801&&!_0x520c47['filter']&&_0x18ff32['push']({'level':_0x4836ea(0xc2),'path':_0x571bbf+_0x4836ea(0xef),'code':_0x4836ea(0xeb),'message':_0x4836ea(0xda)+_0x520c47[_0x4836ea(0xdc)]+_0x4836ea(0xf3)+_0x520c47['attribute']+'\x27\x20'+'requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20'+_0x4836ea(0xf4)+_0x4836ea(0xce),'location':getLocationFromPath(_0x284c98[_0x4836ea(0xd3)],_0x284c98[_0x4836ea(0xdc)],pathToArray(_0x571bbf+_0x4836ea(0xef)))}),_0x2ea801&&_0x520c47[_0x4836ea(0xc9)]&&_0x18ff32[_0x4836ea(0xcf)]({'level':'warning','path':_0x571bbf+'.attribute','code':'BEHAVIOR_SOURCE_WITH_ATTRIBUTE','message':_0x4836ea(0xe0)+_0x520c47[_0x4836ea(0xb3)]+_0x4836ea(0xb1)+_0x4836ea(0xd1),'location':getLocationFromPath(_0x284c98[_0x4836ea(0xd3)],_0x284c98['source'],pathToArray(_0x571bbf+'.attribute'))});}}return _0x18ff32;}