@treasuredata/tdx 0.26.1 → 0.26.2

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 (167) 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/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/describe.js +1 -1
  18. package/dist/commands/engage-command.js +1 -1
  19. package/dist/commands/job-command.js +1 -1
  20. package/dist/commands/journey-command.js +1 -1
  21. package/dist/commands/journey-validate-command.js +1 -1
  22. package/dist/commands/llm-command.js +1 -1
  23. package/dist/commands/mcp-command.js +1 -1
  24. package/dist/commands/parent-segment-command.js +1 -1
  25. package/dist/commands/profile-command.js +1 -1
  26. package/dist/commands/profiles-command.js +1 -1
  27. package/dist/commands/query-command.js +1 -1
  28. package/dist/commands/schedule-command.js +1 -1
  29. package/dist/commands/segment-command.js +1 -1
  30. package/dist/commands/segment-create-command.js +1 -1
  31. package/dist/commands/segment-fields-command.js +1 -1
  32. package/dist/commands/segment-pull-command.js +1 -1
  33. package/dist/commands/segment-push-command.js +1 -1
  34. package/dist/commands/segment-update-command.js +1 -1
  35. package/dist/commands/segment-use-command.js +1 -1
  36. package/dist/commands/segment-validate-command.js +1 -1
  37. package/dist/commands/segments.js +1 -1
  38. package/dist/commands/show.js +1 -1
  39. package/dist/commands/status-command.js +1 -1
  40. package/dist/commands/tables.js +1 -1
  41. package/dist/commands/unset-command.js +1 -1
  42. package/dist/commands/use-command.js +1 -1
  43. package/dist/commands/user-command.js +1 -1
  44. package/dist/commands/workflow-command.js +1 -1
  45. package/dist/core/auth.js +1 -1
  46. package/dist/core/command-output.js +1 -1
  47. package/dist/core/config.js +1 -1
  48. package/dist/core/connection-cache.js +1 -1
  49. package/dist/core/constants.js +1 -1
  50. package/dist/core/credential-cache.js +1 -1
  51. package/dist/core/global-context.js +1 -1
  52. package/dist/core/keychain.js +1 -1
  53. package/dist/core/profile.js +1 -1
  54. package/dist/core/project-config.js +1 -1
  55. package/dist/core/session.js +1 -1
  56. package/dist/core/user-cache.js +1 -1
  57. package/dist/core/version.js +1 -1
  58. package/dist/index.js +1 -1
  59. package/dist/mcp/server.js +1 -1
  60. package/dist/mcp/tools/index.js +1 -1
  61. package/dist/mcp/tools/tdx-run.js +1 -1
  62. package/dist/mcp/tools/tdx-search.js +1 -1
  63. package/dist/mcp/utils.js +1 -1
  64. package/dist/proxy/claude-usage-tracker.js +1 -1
  65. package/dist/proxy/passthrough-server.js +1 -1
  66. package/dist/proxy/sse-usage-parser.js +1 -1
  67. package/dist/sdk/agent/agent-config.js +1 -1
  68. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  69. package/dist/sdk/agent/agent-yaml.js +1 -1
  70. package/dist/sdk/agent/test/evaluator.js +1 -1
  71. package/dist/sdk/agent/test/executor.js +1 -1
  72. package/dist/sdk/agent/test/index.js +1 -1
  73. package/dist/sdk/agent/test/output.js +1 -1
  74. package/dist/sdk/agent/test/parser.js +1 -1
  75. package/dist/sdk/api.js +1 -1
  76. package/dist/sdk/client/cdp-api-client.js +1 -1
  77. package/dist/sdk/client/endpoints.js +1 -1
  78. package/dist/sdk/client/engage-api-client.js +1 -1
  79. package/dist/sdk/client/http-client.js +1 -1
  80. package/dist/sdk/client/llm-api-client.js +1 -1
  81. package/dist/sdk/client/rate-limiter.js +1 -1
  82. package/dist/sdk/client/td-api-client.js +1 -1
  83. package/dist/sdk/client/trino-api-client.js +1 -1
  84. package/dist/sdk/client/workflow-client.js +1 -1
  85. package/dist/sdk/connection-validator.js +1 -1
  86. package/dist/sdk/connection.js +1 -1
  87. package/dist/sdk/engage.js +1 -1
  88. package/dist/sdk/errors.js +1 -1
  89. package/dist/sdk/index.js +1 -1
  90. package/dist/sdk/io/index.js +1 -1
  91. package/dist/sdk/io/node-filesystem.js +1 -1
  92. package/dist/sdk/job.js +1 -1
  93. package/dist/sdk/journey.js +1 -1
  94. package/dist/sdk/llm/chat-cache.js +1 -1
  95. package/dist/sdk/llm/index.js +1 -1
  96. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  97. package/dist/sdk/llm/model-factors.js +1 -1
  98. package/dist/sdk/personalization.js +1 -1
  99. package/dist/sdk/query/index.js +1 -1
  100. package/dist/sdk/query/sql-parser.js +1 -1
  101. package/dist/sdk/realtime.js +1 -1
  102. package/dist/sdk/schedule.js +1 -1
  103. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  104. package/dist/sdk/segment/fields-display.js +1 -1
  105. package/dist/sdk/segment/file-discovery.js +1 -1
  106. package/dist/sdk/segment/journey-utils.js +1 -1
  107. package/dist/sdk/segment/journey-validator.js +1 -1
  108. package/dist/sdk/segment/journey-yaml.js +1 -1
  109. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  110. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  111. package/dist/sdk/segment/pull-workflow.js +1 -1
  112. package/dist/sdk/segment/push-recovery.js +1 -1
  113. package/dist/sdk/segment/push-workflow.js +1 -1
  114. package/dist/sdk/segment/resolution-context.js +1 -1
  115. package/dist/sdk/segment/segment-path-parser.js +1 -1
  116. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  117. package/dist/sdk/segment/target-resolution.js +1 -1
  118. package/dist/sdk/segment/tdx-config.js +1 -1
  119. package/dist/sdk/segment/validate-files.js +1 -1
  120. package/dist/sdk/segment/yaml-validator.js +1 -1
  121. package/dist/sdk/segment.js +1 -1
  122. package/dist/sdk/types/index.js +1 -1
  123. package/dist/sdk/types/progress.js +1 -1
  124. package/dist/sdk/user.js +1 -1
  125. package/dist/sdk/util/format-detector.js +1 -1
  126. package/dist/sdk/util/formatters.js +1 -1
  127. package/dist/sdk/util/index.js +1 -1
  128. package/dist/sdk/util/tree-formatter.js +1 -1
  129. package/dist/sdk/workflow/archive-validation.js +1 -1
  130. package/dist/sdk/workflow/clone-workflow.js +1 -1
  131. package/dist/sdk/workflow/index.js +1 -1
  132. package/dist/sdk/workflow/pull-workflow.js +1 -1
  133. package/dist/sdk/workflow/push-workflow.js +1 -1
  134. package/dist/sdk/workflow/tdx-config.js +1 -1
  135. package/dist/sdk/workflow/workflow-utils.js +1 -1
  136. package/dist/test-utils/command-runner.js +1 -1
  137. package/dist/test-utils/factories.js +1 -1
  138. package/dist/test-utils/fixtures.js +1 -1
  139. package/dist/test-utils/http-mock.js +1 -1
  140. package/dist/test-utils/index.js +1 -1
  141. package/dist/utils/async.js +1 -1
  142. package/dist/utils/colors.js +1 -1
  143. package/dist/utils/diff.js +1 -1
  144. package/dist/utils/file-permissions.js +1 -1
  145. package/dist/utils/global-cache.js +1 -1
  146. package/dist/utils/json-loader.js +1 -1
  147. package/dist/utils/local-cache.js +1 -1
  148. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  149. package/dist/utils/logger/formatters/index.js +1 -1
  150. package/dist/utils/logger/handlers/console-handler.js +1 -1
  151. package/dist/utils/logger/handlers/file-handler.js +1 -1
  152. package/dist/utils/logger/handlers/index.js +1 -1
  153. package/dist/utils/logger/handlers/null-handler.js +1 -1
  154. package/dist/utils/logger/index.js +1 -1
  155. package/dist/utils/logger/logger.js +1 -1
  156. package/dist/utils/logger/types.js +1 -1
  157. package/dist/utils/option-validation.js +1 -1
  158. package/dist/utils/port.js +1 -1
  159. package/dist/utils/process.js +1 -1
  160. package/dist/utils/prompt.js +1 -1
  161. package/dist/utils/spinner.js +1 -1
  162. package/dist/utils/sse-parser.js +1 -1
  163. package/dist/utils/string-utils.js +1 -1
  164. package/dist/utils/table-ref-parser.js +1 -1
  165. package/dist/utils/tdx-logger.js +1 -1
  166. package/dist/utils/version-check.js +1 -1
  167. package/package.json +1 -1
@@ -1 +1 @@
1
- const a114_0x3e8f2e=a114_0x3785;(function(_0x88f904,_0x25ea2a){const _0x5132f8=a114_0x3785,_0x2dac09=_0x88f904();while(!![]){try{const _0x4ef868=-parseInt(_0x5132f8(0x211))/0x1+parseInt(_0x5132f8(0x241))/0x2+-parseInt(_0x5132f8(0x22d))/0x3+-parseInt(_0x5132f8(0x1c0))/0x4+-parseInt(_0x5132f8(0x258))/0x5*(-parseInt(_0x5132f8(0x1c4))/0x6)+parseInt(_0x5132f8(0x215))/0x7+-parseInt(_0x5132f8(0x1b1))/0x8*(-parseInt(_0x5132f8(0x252))/0x9);if(_0x4ef868===_0x25ea2a)break;else _0x2dac09['push'](_0x2dac09['shift']());}catch(_0x1a7fd4){_0x2dac09['push'](_0x2dac09['shift']());}}}(a114_0x980c,0x52b3b));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a114_0x3e8f2e(0x266));export const PENDING_SEGMENT_PREFIX='__pending_';export const PENDING_ACTIVATION_PREFIX=a114_0x3e8f2e(0x1db);export function createPendingSegmentId(_0x46b8a6){return''+PENDING_SEGMENT_PREFIX+_0x46b8a6+'__';}export function isPendingSegmentId(_0x649ff4){const _0x503a29=a114_0x3e8f2e;return _0x649ff4[_0x503a29(0x28c)](PENDING_SEGMENT_PREFIX)&&!_0x649ff4[_0x503a29(0x28c)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x124df4){const _0x390bdf=a114_0x3e8f2e;return _0x124df4[_0x390bdf(0x28b)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x40eca8){return''+PENDING_ACTIVATION_PREFIX+_0x40eca8+'__';}export function isPendingActivationId(_0x2eb840){const _0x43c6bf=a114_0x3e8f2e;return _0x2eb840[_0x43c6bf(0x28c)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x580884){return _0x580884['replace'](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x41c33a,_0x1627f5){const _0x517daa=a114_0x3e8f2e,_0xf2fa21=_0x41c33a+'::'+(_0x1627f5['trim']()||'segment'),_0x308926=createHash('sha1')[_0x517daa(0x1ed)](_0xf2fa21)['digest']('hex')[_0x517daa(0x1cb)](0x0,0xc);return _0x517daa(0x1dc)+_0x308926;}export function ensureJourneyDefaults(_0x472226){const _0xa945b8=a114_0x3e8f2e;!_0x472226[_0xa945b8(0x285)]&&(_0x472226[_0xa945b8(0x285)]=''),!_0x472226['state']&&(_0x472226[_0xa945b8(0x1e9)]=_0xa945b8(0x1d2));}export function resolveTDFolderPath(_0x29ebdb,_0x5f43d0,_0x1cf8db){if(!_0x5f43d0)return _0x29ebdb;if(_0x29ebdb===_0x1cf8db||_0x29ebdb['startsWith'](_0x1cf8db+'/'))return _0x29ebdb;return _0x29ebdb?_0x1cf8db+'/'+_0x29ebdb:_0x1cf8db;}export function addFoldersToCreate(_0x32ad85,_0x3a7aea,_0x209e8b){const _0x5298de=a114_0x3e8f2e;if(!_0x32ad85)return;if(_0x3a7aea[_0x5298de(0x27e)](_0x32ad85))return;const _0x16ccf2=_0x32ad85[_0x5298de(0x1b2)]('/');let _0x3dc8d7='';for(const _0x1695ad of _0x16ccf2){_0x3dc8d7=_0x3dc8d7?_0x3dc8d7+'/'+_0x1695ad:_0x1695ad,!_0x3a7aea[_0x5298de(0x27e)](_0x3dc8d7)&&_0x209e8b[_0x5298de(0x234)](_0x3dc8d7);}}import*as a114_0x36eefc from'yaml';import{readFileSync}from'fs';import a114_0xfecf44 from'path';import{isJourneyDef,parseYamlString as a114_0x461563,toYamlString as a114_0x823185,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(_0x2da7c3){const _0x1ded2a=a114_0x3e8f2e;if(Array['isArray'](_0x2da7c3))return'['+_0x2da7c3[_0x1ded2a(0x1fe)](_0x3e569f=>stableStringify(_0x3e569f))[_0x1ded2a(0x1bb)](',')+']';if(_0x2da7c3&&typeof _0x2da7c3===_0x1ded2a(0x209)){const _0x2a6bd1=_0x2da7c3,_0x29d7c7=Object[_0x1ded2a(0x217)](_0x2a6bd1)[_0x1ded2a(0x1d1)](),_0x3ac971=_0x29d7c7[_0x1ded2a(0x1fe)](_0x1e177b=>'\x22'+_0x1e177b+'\x22:'+stableStringify(_0x2a6bd1[_0x1e177b]));return'{'+_0x3ac971[_0x1ded2a(0x1bb)](',')+'}';}const _0x702e5f=JSON[_0x1ded2a(0x235)](_0x2da7c3);return _0x702e5f===undefined?_0x1ded2a(0x1d3):_0x702e5f;}function activationSignature(_0x22458e){const _0x2ab5ae=a114_0x3e8f2e,_0x23fd0b={'connection':_0x22458e['connection'],..._0x22458e[_0x2ab5ae(0x272)]!==undefined&&{'all_columns':_0x22458e[_0x2ab5ae(0x272)]},..._0x22458e['columns']!==undefined&&{'columns':_0x22458e['columns']},..._0x22458e[_0x2ab5ae(0x239)]!==undefined&&{'behavior':_0x22458e['behavior']},..._0x22458e[_0x2ab5ae(0x282)]!==undefined&&{'schedule':_0x22458e[_0x2ab5ae(0x282)]},..._0x22458e[_0x2ab5ae(0x1fa)]!==undefined&&{'notification':_0x22458e[_0x2ab5ae(0x1fa)]},..._0x22458e['connector_config']!==undefined&&{'connector_config':_0x22458e[_0x2ab5ae(0x255)]},..._0x22458e['activation_template_id']!==undefined&&{'activation_template_id':_0x22458e['activation_template_id']}};return stableStringify(_0x23fd0b);}async function fetchSegment(_0x204b6a,_0x2e3736,_0x37c0a6,_0x313ce6){const _0x1326f5=a114_0x3e8f2e,_0x2de42d=_0x313ce6?.[_0x1326f5(0x1f4)](_0x578d75=>_0x578d75['id']===_0x37c0a6);if(_0x2de42d)return _0x2de42d;try{return await _0x204b6a[_0x1326f5(0x1e7)][_0x1326f5(0x265)](_0x2e3736,_0x37c0a6);}catch(_0x54e322){logger['debug'](_0x1326f5(0x271)+_0x37c0a6+_0x1326f5(0x23c)+_0x54e322);try{return await _0x204b6a['segment'][_0x1326f5(0x29a)](_0x37c0a6);}catch(_0x5d20be){return logger[_0x1326f5(0x1c7)](_0x1326f5(0x244)+_0x37c0a6+':\x20'+_0x5d20be),null;}}}function recoverSegmentIdsFromPushRecovery(_0x566588,_0x8ea16e,_0x3ccdf6){const _0x3b9daf=a114_0x3e8f2e,_0x2e9cd1=readPushRecovery(_0x566588['absolutePath']);if(_0x2e9cd1?.[_0x3b9daf(0x286)]===_0x566588[_0x3b9daf(0x28f)]['name'])for(const [_0x480f0c,_0x4baedc]of Object[_0x3b9daf(0x259)](_0x2e9cd1['segments'])){const _0x1d0f07=generateDeterministicJourneySegmentName(_0x566588['yamlConfig'][_0x3b9daf(0x1f6)],_0x480f0c);_0x4baedc[_0x3b9daf(0x218)]===_0x1d0f07&&(_0x8ea16e[_0x3b9daf(0x22a)](_0x480f0c,_0x4baedc[_0x3b9daf(0x294)]),_0x3ccdf6[_0x3b9daf(0x22a)](_0x480f0c,_0x4baedc['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x4adae0,_0x40ddbe,_0x108b0a,_0x9bef1d){const _0x48603f=a114_0x3e8f2e;let _0x54eebe;try{_0x54eebe=await _0x4adae0[_0x48603f(0x1e7)][_0x48603f(0x232)]({'name':_0x108b0a[_0x48603f(0x251)],'description':_0x108b0a[_0x48603f(0x285)],'journeyId':_0x108b0a[_0x48603f(0x205)],'rule':_0x9bef1d(_0x108b0a[_0x48603f(0x219)],!![]),'countPopulation':!![],'parentFolderId':_0x108b0a[_0x48603f(0x27d)],'audienceId':_0x108b0a[_0x48603f(0x297)]});}catch(_0x2be293){const _0x49f43a=_0x2be293 instanceof Error&&_0x2be293[_0x48603f(0x1f3)][_0x48603f(0x28e)](_0x48603f(0x28d));if(_0x49f43a){const _0x8a6597=readPushRecovery(_0x40ddbe['absolutePath']),_0x483bb2=_0x8a6597?.[_0x48603f(0x286)]===_0x40ddbe[_0x48603f(0x28f)]['name']?_0x8a6597[_0x48603f(0x210)][_0x108b0a['localName']]:undefined;if(_0x483bb2?.[_0x48603f(0x218)]===_0x108b0a['uniqueSegmentName'])await _0x4adae0[_0x48603f(0x1e7)][_0x48603f(0x227)](_0x108b0a[_0x48603f(0x297)],_0x483bb2[_0x48603f(0x294)],{'description':_0x108b0a[_0x48603f(0x285)],'rule':_0x9bef1d(_0x108b0a[_0x48603f(0x219)],!![]),'countPopulation':!![]}),_0x54eebe=_0x483bb2['segmentId'];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],_0x48603f(0x1ea)+_0x108b0a[_0x48603f(0x220)]+_0x48603f(0x246)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x40ddbe['absolutePath'][_0x48603f(0x28b)](/([^/]+)$/,'.$1.push-recovery.json')+')\x20')+_0x48603f(0x283),_0x2be293);}else throw _0x2be293;}return saveSegmentToPushRecovery(_0x40ddbe[_0x48603f(0x2a0)],_0x40ddbe[_0x48603f(0x28f)][_0x48603f(0x1f6)],_0x108b0a[_0x48603f(0x220)],{'segmentId':_0x54eebe,'uniqueServerName':_0x108b0a['uniqueSegmentName'],'createdAt':new Date()[_0x48603f(0x237)]()}),_0x54eebe;}export async function prepareSegmentFiles(_0x241a33,_0x30699c,_0x4b76a9,_0x25620c,_0x5b9a2e){const _0x5de560=a114_0x3e8f2e,{activationDefToCreateRequest:_0x476492}=await import(_0x5de560(0x1b0)),_0xce7fbb=[],_0x1cb20b=new Set();for(const {yamlConfig:_0x484b8c,folderPath:_0x3ec9f2,sourcePath:_0x3b4c06}of _0x241a33){const _0x2c7488=resolveTDFolderPath(_0x3ec9f2,_0x25620c,_0x5b9a2e),_0x5c71eb=_0x2c7488+':'+_0x484b8c[_0x5de560(0x1f6)],_0x566b36=_0x30699c[_0x5de560(0x1ce)][_0x5de560(0x1f1)](_0x5c71eb),_0x349a22=_0x566b36?_0x30699c['activationsBySegmentId'][_0x5de560(0x1f1)](_0x566b36['id'])||[]:[];addFoldersToCreate(_0x2c7488,_0x30699c[_0x5de560(0x1c1)],_0x1cb20b);const _0x613332=calculateActivationActions(_0x484b8c[_0x5de560(0x1df)]||[],_0x349a22,_0x30699c[_0x5de560(0x268)],_0x30699c[_0x5de560(0x295)]);for(const _0x309127 of _0x613332){(_0x309127[_0x5de560(0x202)]===_0x5de560(0x1c2)||_0x309127[_0x5de560(0x202)]===_0x5de560(0x1ed))&&_0x309127[_0x5de560(0x26e)]&&(_0x309127[_0x5de560(0x1b5)]=await _0x476492(_0x309127[_0x5de560(0x26e)],_0x4b76a9));}const _0x28d27e=calculateSegmentDiff(_0x484b8c,_0x566b36,_0x349a22,_0x30699c[_0x5de560(0x268)],_0x30699c[_0x5de560(0x295)]);_0xce7fbb[_0x5de560(0x1c8)]({'relativePath':_0x484b8c[_0x5de560(0x1f6)],'absolutePath':_0x3b4c06,'yamlConfig':_0x484b8c,'folderPath':_0x2c7488,'existingSegment':_0x566b36,'existingActivations':_0x349a22,'isNew':_0x28d27e[_0x5de560(0x1e5)],'hasChanges':_0x28d27e[_0x5de560(0x1e8)],'diff':_0x28d27e[_0x5de560(0x280)],'activationActions':_0x613332});}return{'segmentFiles':_0xce7fbb,'foldersToCreate':_0x1cb20b};}export async function prepareJourneyFiles(_0x262f6d,_0x1af38b,_0xbf6b80,_0x4ead4e){const _0x47be40=a114_0x3e8f2e,_0x339d50=[],_0x2603a3=new Set();for(const {yamlConfig:_0x5767d0,folderPath:_0x1ee65b,sourcePath:_0x326db2}of _0x262f6d){const _0xfd2d93=resolveTDFolderPath(_0x1ee65b,_0xbf6b80,_0x4ead4e),_0x5b12c9=_0xfd2d93+':'+_0x5767d0['name'],_0x5a3eb4=_0x1af38b[_0x47be40(0x260)][_0x47be40(0x1f1)](_0x5b12c9);let _0x3483af,_0x566264;if(_0x5a3eb4&&_0x5a3eb4[_0x47be40(0x1b7)]>0x0){const _0x2fd6ab=buildLocalExpandedRuleMappings(_0x5767d0),{createYamlContext:_0x253528,prefetchJourneySegments:_0xae143d}=createPushYamlContextForBundle(_0x1af38b[_0x47be40(0x216)],_0x1af38b['parentId'],_0x1af38b[_0x47be40(0x284)],_0x2fd6ab,_0x1af38b[_0x47be40(0x268)],_0x1af38b[_0x47be40(0x295)],_0x1af38b[_0x47be40(0x1ba)],_0x1af38b[_0x47be40(0x21f)]);await _0xae143d(_0x5a3eb4[_0x47be40(0x1fe)](_0x3f3a91=>_0x3f3a91['id']));const _0x1ae017=hasMultipleVersions(_0x5767d0),_0x6b528a=async _0x2ab6c6=>{const _0x493179=_0x47be40,_0x283133=_0x1af38b[_0x493179(0x21f)]?.[_0x493179(0x1f1)](_0x2ab6c6);if(_0x283133)return _0x283133;return _0x1af38b[_0x493179(0x1ee)]({'journeyId':_0x2ab6c6,'journeyName':_0x5767d0['name'],'isMultiVersion':_0x5a3eb4['length']>0x1});};if(_0x1ae017&&_0x5a3eb4['length']>0x1){const _0x106230=[];for(const _0x1c3850 of _0x5a3eb4){const _0xa3daa6=_0x1c3850['versionNumber']||0x1;_0x1af38b[_0x47be40(0x214)]?.[_0x47be40(0x1ed)](_0x47be40(0x1b9)+_0x5767d0[_0x47be40(0x1f6)]+'\x20v'+_0xa3daa6);const _0x5c5e79=await _0x6b528a(_0x1c3850['id']),_0x46d7f5=_0x253528(_0x1c3850['id']),_0x337887=await journeyResponseToDef(_0x5c5e79,_0x46d7f5);_0x106230[_0x47be40(0x1c8)]({'item':_0x1c3850,'yaml':_0x337887});}const _0x3bfe07=buildLocalRuleToNameMappingFromJourney(_0x5767d0);_0x566264=buildMergedJourneyDef(_0x106230,_0x3bfe07);const _0x2d2006=Math[_0x47be40(0x212)](..._0x106230[_0x47be40(0x1fe)](_0x549910=>_0x549910[_0x47be40(0x224)][_0x47be40(0x25e)]||0x0)),_0xa25a2a=_0x5a3eb4['find'](_0x2709a5=>(_0x2709a5[_0x47be40(0x25e)]||0x0)===_0x2d2006);_0xa25a2a&&(_0x1af38b['progress']?.[_0x47be40(0x1ed)](_0x47be40(0x1b9)+_0x5767d0[_0x47be40(0x1f6)]+'\x20v'+_0x2d2006),_0x3483af=await _0x6b528a(_0xa25a2a['id']));}else{const _0x971f97=_0x5a3eb4[_0x5a3eb4[_0x47be40(0x1b7)]-0x1];_0x1af38b[_0x47be40(0x214)]?.[_0x47be40(0x1ed)](_0x47be40(0x1b9)+_0x5767d0[_0x47be40(0x1f6)]),_0x3483af=await _0x6b528a(_0x971f97['id']);const _0x3f3c48=_0x253528(_0x971f97['id']),_0x4240ca=await journeyResponseToDef(_0x3483af,_0x3f3c48),_0x570cd2=buildLocalRuleToNameMappingFromJourney(_0x5767d0);_0x566264=buildMergedJourneyDef([{'item':_0x971f97,'yaml':_0x4240ca}],_0x570cd2);}}addFoldersToCreate(_0xfd2d93,_0x1af38b[_0x47be40(0x1c1)],_0x2603a3);const _0x4ac323=calculateJourneyDiff(_0x5767d0,_0x566264);_0x339d50['push']({'relativePath':_0x5767d0[_0x47be40(0x1f6)],'absolutePath':_0x326db2,'yamlConfig':_0x5767d0,'folderPath':_0xfd2d93,'existingJourney':_0x3483af,'isNew':_0x4ac323['isNew'],'hasChanges':_0x4ac323[_0x47be40(0x1e8)],'diff':_0x4ac323[_0x47be40(0x280)]});}return{'journeyFiles':_0x339d50,'foldersToCreate':_0x2603a3};}export function calculateActivationActions(_0x22b288,_0x2056ce,_0xbf8913,_0x4e984b){const _0x2fa79e=a114_0x3e8f2e,_0x264b5e=[],_0x10c542=new Map();for(const _0x3238d1 of _0x2056ce){_0x10c542[_0x2fa79e(0x22a)](_0x3238d1['name'],_0x3238d1);}const _0x384eaa=new Map();for(const _0x278992 of _0x22b288){_0x384eaa[_0x2fa79e(0x22a)](_0x278992[_0x2fa79e(0x1f6)],_0x278992);}for(const _0x1c7a4a of _0x22b288){const _0x514374=_0x10c542[_0x2fa79e(0x1f1)](_0x1c7a4a[_0x2fa79e(0x1f6)]);if(!_0x514374)_0x264b5e[_0x2fa79e(0x1c8)]({'type':_0x2fa79e(0x1c2),'name':_0x1c7a4a[_0x2fa79e(0x1f6)],'yamlActivation':_0x1c7a4a});else{const _0xd970bd=activationResponseToDef(_0x514374,_0xbf8913,_0x4e984b),_0x4b30bd=a114_0x36eefc[_0x2fa79e(0x235)](_0xd970bd),_0x400cf=a114_0x36eefc[_0x2fa79e(0x235)](_0x1c7a4a);_0x4b30bd!==_0x400cf&&_0x264b5e['push']({'type':_0x2fa79e(0x1ed),'name':_0x1c7a4a[_0x2fa79e(0x1f6)],'yamlActivation':_0x1c7a4a,'existingActivation':_0x514374});}}for(const _0x14a6f1 of _0x2056ce){!_0x384eaa[_0x2fa79e(0x27e)](_0x14a6f1[_0x2fa79e(0x1f6)])&&_0x264b5e[_0x2fa79e(0x1c8)]({'type':_0x2fa79e(0x277),'name':_0x14a6f1[_0x2fa79e(0x1f6)],'existingActivation':_0x14a6f1});}return _0x264b5e;}function calculateYamlDiff(_0x2b14a7,_0x46c7ab){if(_0x46c7ab){const _0x53b8d0=generateDiff(_0x46c7ab,_0x2b14a7),_0x24db97=hasChanges(_0x53b8d0);return{'isNew':![],'hasChanges':_0x24db97,'diff':_0x24db97?formatDiffWithColors(_0x53b8d0):undefined};}const _0x56955f=generateDiff('',_0x2b14a7);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x56955f)};}export function calculateSegmentDiff(_0x31464d,_0x486455,_0x501b94,_0xd1eac,_0x565270){const _0x28a23c=segmentToYamlString(_0x31464d),_0x1310bf=_0x486455?segmentToYamlString(segmentWithActivationsToYaml(_0x486455,_0x501b94,undefined,_0xd1eac,_0x565270)):undefined;return calculateYamlDiff(_0x28a23c,_0x1310bf);}export function calculateJourneyDiff(_0x21d8e9,_0x17fdf0){const _0x501dd5=normalizeJourneyDef(_0x21d8e9,_0x21d8e9),_0x364275=a114_0x823185(_0x501dd5),_0x40da7d=_0x17fdf0?a114_0x823185(normalizeJourneyDef(_0x17fdf0,_0x21d8e9)):undefined;return calculateYamlDiff(_0x364275,_0x40da7d);}export function findSegmentsToDelete(_0x1a4e8a,_0x532dd0,_0x4fe3cc,_0x71deae,_0xfce898){const _0x31607c=a114_0x3e8f2e,_0x207c97=new Set();for(const {yamlConfig:_0x27152b,folderPath:_0x25c315}of _0x532dd0){_0x207c97['add'](_0x25c315+':'+_0x27152b[_0x31607c(0x1f6)]);}return _0x1a4e8a['filter'](_0x4e2012=>{const _0x106cb0=_0x31607c,_0x73a269=_0x4e2012[_0x106cb0(0x21e)]?_0x4fe3cc['get'](_0x4e2012[_0x106cb0(0x21e)][_0x106cb0(0x1bf)]())||'':'',_0x351b3a=_0x73a269+':'+_0x4e2012['name'];if(_0x207c97[_0x106cb0(0x27e)](_0x351b3a))return![];if(_0xfce898)return _0x73a269===_0x71deae||_0x73a269['startsWith'](_0x71deae+'/');return!![];});}export function findJourneysToDelete(_0x53a36e,_0x12decb,_0x2b161f,_0x4f6be9,_0x1e6232){const _0x5a9ba5=a114_0x3e8f2e,_0x10507b=new Set();for(const {yamlConfig:_0x5d62b1,folderPath:_0x2cdc9e}of _0x12decb){_0x10507b[_0x5a9ba5(0x234)](_0x2cdc9e+':'+_0x5d62b1[_0x5a9ba5(0x1f6)]);}return _0x53a36e[_0x5a9ba5(0x29e)](_0x555a0c=>{const _0x1546d0=_0x5a9ba5,_0x3c4244=_0x555a0c[_0x1546d0(0x27d)]?_0x2b161f['get'](_0x555a0c[_0x1546d0(0x27d)])||'':'',_0x33e5f5=_0x3c4244+':'+_0x555a0c[_0x1546d0(0x25b)];if(_0x10507b['has'](_0x33e5f5))return![];if(_0x1e6232)return _0x3c4244===_0x4f6be9||_0x3c4244[_0x1546d0(0x28c)](_0x4f6be9+'/');return!![];});}export function buildSegmentLookupMap(_0x4d38fd,_0x1e5159){const _0x16ab27=a114_0x3e8f2e,_0x3285d9=new Map();for(const _0x2e7150 of _0x4d38fd){const _0x1dc0ab=_0x2e7150[_0x16ab27(0x21e)]?_0x1e5159['get'](_0x2e7150[_0x16ab27(0x21e)][_0x16ab27(0x1bf)]())||'':'',_0x544ad0=_0x1dc0ab+':'+_0x2e7150[_0x16ab27(0x1f6)];_0x3285d9['set'](_0x544ad0,_0x2e7150);}return _0x3285d9;}export function buildSegmentNameToIdMap(_0x2f1951){const _0x256a61=a114_0x3e8f2e,_0x7e70f8=new Map();for(const _0x15704c of _0x2f1951){_0x7e70f8[_0x256a61(0x22a)](_0x15704c['name'],_0x15704c['id']);}return _0x7e70f8;}export function buildJourneyBundleLookupMap(_0x4f1eb9,_0xd06fc6){const _0x29d43b=a114_0x3e8f2e,_0x440e59=new Map();for(const _0x475827 of _0x4f1eb9){const _0x684217=_0x475827[_0x29d43b(0x27d)]?_0xd06fc6[_0x29d43b(0x1f1)](_0x475827['folderId'])||'':'',_0x4f30f3=_0x684217+':'+_0x475827[_0x29d43b(0x25b)];!_0x440e59[_0x29d43b(0x27e)](_0x4f30f3)&&_0x440e59['set'](_0x4f30f3,[]),_0x440e59[_0x29d43b(0x1f1)](_0x4f30f3)[_0x29d43b(0x1c8)](_0x475827);}for(const _0xca1416 of _0x440e59[_0x29d43b(0x201)]()){_0xca1416[_0x29d43b(0x1d1)]((_0x3d3351,_0x46c174)=>(_0x3d3351['versionNumber']||0x0)-(_0x46c174[_0x29d43b(0x25e)]||0x0));}return _0x440e59;}export function collectFoldersToCreate(_0x208546,_0x10d53b){const _0x2366da=a114_0x3e8f2e,_0x4c0d83=new Set();for(const _0x35fc85 of _0x208546){if(!_0x35fc85)continue;if(_0x10d53b[_0x2366da(0x27e)](_0x35fc85))continue;const _0x5d3dc9=_0x35fc85[_0x2366da(0x1b2)]('/');let _0x53f94a='';for(const _0x514215 of _0x5d3dc9){_0x53f94a=_0x53f94a?_0x53f94a+'/'+_0x514215:_0x514215,!_0x10d53b['has'](_0x53f94a)&&_0x4c0d83[_0x2366da(0x234)](_0x53f94a);}}return _0x4c0d83;}export function parseAndClassifyYamlFiles(_0x1c7085,_0x583c8b,_0x23dd1d){const _0x3bf659=a114_0x3e8f2e,_0x11d0e8=[],_0x1a5152=[];for(const _0x494376 of _0x1c7085){const _0x23fda6=a114_0xfecf44[_0x3bf659(0x287)](_0x583c8b,a114_0xfecf44[_0x3bf659(0x230)](_0x494376)),_0x2e1821=_0x23fda6==='.'?'':_0x23fda6,_0x2a255b=readFileSync(_0x494376,_0x3bf659(0x200)),_0x2a9dfc=a114_0x36eefc[_0x3bf659(0x226)](_0x2a255b);if(isJourneyDef(_0x2a9dfc)){const _0x1dc484=a114_0x461563(_0x2a255b);_0x1a5152[_0x3bf659(0x1c8)]({'yamlConfig':_0x1dc484,'folderPath':_0x2e1821,'sourcePath':_0x494376});}else{if(!_0x23dd1d?.['skipSegments']){const _0x3b1ebb=parseSegmentYamlFile(_0x2a255b),_0x47c075=normalizeChildSegmentYaml(_0x3b1ebb);_0x11d0e8[_0x3bf659(0x1c8)]({'yamlConfig':_0x47c075,'folderPath':_0x2e1821,'sourcePath':_0x494376});}}}return{'segments':_0x11d0e8,'journeys':_0x1a5152};}export function validateParsedFiles(_0x5c2662,_0x31713f){const _0x5c230d=a114_0x3e8f2e,_0xc1401d=[];for(const {yamlConfig:_0xc80025,sourcePath:_0x5401c1}of _0x5c2662[_0x5c230d(0x210)]){const _0x346c0f=readFileSync(_0x5401c1,'utf-8'),_0x500f2e=a114_0x36eefc[_0x5c230d(0x1cc)](_0x346c0f),_0x40a21a=validateSegmentDef(_0xc80025,{'source':_0x346c0f,'document':_0x500f2e});if(!_0x40a21a[_0x5c230d(0x298)]){const _0x58d85e=a114_0xfecf44[_0x5c230d(0x287)](_0x31713f,_0x5401c1);_0xc1401d[_0x5c230d(0x1c8)]({'filePath':_0x58d85e,'source':_0x346c0f,'result':_0x40a21a,'isJourney':![]});}}for(const {yamlConfig:_0x3a76db,sourcePath:_0x303a6a}of _0x5c2662[_0x5c230d(0x1ec)]){const _0x2f0679=readFileSync(_0x303a6a,_0x5c230d(0x200)),_0x22675e=a114_0x36eefc[_0x5c230d(0x1cc)](_0x2f0679),_0x5866c5=validateJourneyDef(_0x3a76db,{'source':_0x2f0679,'document':_0x22675e});if(!_0x5866c5[_0x5c230d(0x298)]){const _0x15114c=a114_0xfecf44[_0x5c230d(0x287)](_0x31713f,_0x303a6a);_0xc1401d[_0x5c230d(0x1c8)]({'filePath':_0x15114c,'source':_0x2f0679,'result':_0x5866c5,'isJourney':!![]});}}return _0xc1401d;}export function formatValidationErrors(_0x58aab1){const _0x553d60=a114_0x3e8f2e,_0x2d3176=[];for(const {filePath:_0x2ddd37,source:_0x179cf0,result:_0x31f936,isJourney:_0x1229aa}of _0x58aab1){const _0x15cb4a=_0x1229aa?'journey':_0x553d60(0x1e7);_0x2d3176['push']('\x0a'+_0x2ddd37+'\x20('+_0x15cb4a+_0x553d60(0x1a8)+_0x31f936[_0x553d60(0x273)][_0x553d60(0x1b7)]+_0x553d60(0x1a7)),_0x2d3176[_0x553d60(0x1c8)](formatValidationResult(_0x31f936,_0x179cf0,_0x2ddd37));}return _0x2d3176[_0x553d60(0x1bb)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x102da5){const _0x35f09b=a114_0x3e8f2e,_0x526cf6=new Set(),_0x952e0=new Map(),_0x2a8417=collectSegmentUsageCounts(_0x102da5);if(_0x102da5['segments'])for(const [_0x51f678,_0x3cc5ba]of Object[_0x35f09b(0x259)](_0x102da5['segments'])){_0x526cf6[_0x35f09b(0x234)](_0x51f678);if(_0x3cc5ba[_0x35f09b(0x1a4)]){const _0x479776=yamlRuleToApi(_0x3cc5ba[_0x35f09b(0x1a4)]),_0x464286=apiRuleToYaml(_0x479776);_0x952e0['set'](_0x51f678,_0x464286);}}const _0x27f7a0=new Map();let _0x4b8a3c=0x0;for(const [_0x28ee4c,_0x454e70]of _0x952e0){const _0x59fe4a=serializeExpandedRule(_0x454e70,_0x952e0),_0x152927=_0x27f7a0[_0x35f09b(0x1f1)](_0x59fe4a)||[];_0x152927[_0x35f09b(0x1c8)]({'name':_0x28ee4c,'index':_0x4b8a3c}),_0x27f7a0[_0x35f09b(0x22a)](_0x59fe4a,_0x152927),_0x4b8a3c++;}const _0x3fdc9a=new Map();for(const [_0x267958,_0x23132f]of _0x27f7a0){const _0x4a401f=_0x23132f[_0x35f09b(0x1cb)]()[_0x35f09b(0x1d1)]((_0x1c78cb,_0x4f7d2c)=>{const _0x3f2023=_0x35f09b,_0xa07e58=_0x2a8417[_0x3f2023(0x1f1)](_0x1c78cb['name'])||0x0,_0x42a489=_0x2a8417['get'](_0x4f7d2c['name'])||0x0;if(_0xa07e58!==_0x42a489)return _0x42a489-_0xa07e58;return _0x1c78cb['index']-_0x4f7d2c['index'];})[_0x35f09b(0x1fe)](_0x518e30=>_0x518e30['name']),_0x1e9f57=[];for(const _0x19759a of _0x4a401f){const _0x1a8299=_0x2a8417[_0x35f09b(0x1f1)](_0x19759a)||0x0,_0x76e7d3=Math[_0x35f09b(0x212)](_0x1a8299,0x1);for(let _0x41374e=0x0;_0x41374e<_0x76e7d3;_0x41374e++){_0x1e9f57['push'](_0x19759a);}}_0x3fdc9a[_0x35f09b(0x22a)](_0x267958,_0x1e9f57);}return{'existingLocalSegmentNames':_0x526cf6,'localSegmentRules':_0x952e0,'localExpandedRuleToNames':_0x3fdc9a};}export function createSegmentIdResolver(_0xb1a7fa,_0x4d3f38){return async _0x27328f=>{const _0x4f61a5=a114_0x3785,_0x37ee1c=_0xb1a7fa[_0x4f61a5(0x1f1)](_0x27328f);if(!_0x37ee1c)throw new SDKError(ErrorCode[_0x4f61a5(0x1da)],_0x4f61a5(0x206)+_0x27328f+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x4d3f38+'\x27)');return _0x37ee1c;};}export function extractRootFolderId(_0x539f52){const _0x55f334=a114_0x3e8f2e;return _0x539f52['relationships']?.[_0x55f334(0x1d6)]?.[_0x55f334(0x257)]?.['id']||_0x539f52[_0x55f334(0x1f5)]?.[_0x55f334(0x1f7)]?.[_0x55f334(0x257)]?.['id'];}function a114_0x980c(){const _0x391c7d=['connectionIdToNameMap','createdSegmentIds','parentId','valid','createFolder','getSegmentEntity','Segment\x20not\x20found','SEGMENT_UPDATE_ERROR','folder_created','filter','logDeleted','absolutePath','waitStepUnit','flatMap','rule','logSuccess','embedded_segment_created','\x20error(s)','):\x20','steps','user','withProgress','journey','Created\x20activation\x20\x27','journey_created','journeyActivationNameToId','./child-segment-yaml.js','16ZPxjRg','split','onProgress','embedded_segment_creating','validatedRequest','Entry\x20criteria:\x20','length','list','Fetching\x20','activationStepsById','join','waitStep','goal','entry_criteria','toString','604256wKkEtE','folderPathToId','create','\x27\x20wait\x20condition','6QpuyYq','\x27\x20not\x20found\x20in\x20journey\x20\x27','conditionTimeoutUnit','debug','push','Updating\x20segment\x20\x27','Created\x20folder\x20\x27','slice','parseDocument','Failed\x20to\x20resolve\x20activation\x20','segmentByFolderAndName','connection','Condition','sort','draft','null','ACTIVATION_UPDATE_ERROR','Creating\x20segment\x20\x27','parentSegmentFolder','folder','Deleted\x20segment\x20\x27','\x27...','SEGMENT_NOT_FOUND','__pending_act_','journey_entry_criteria_','JOURNEY_SYNTAX_ERROR','../../utils/async.js','activations','existingActivation',').\x20','buildUserMaps','activation_creating','createdSegmentId','isNew','Deleting\x20activation\x20\x27','segment','hasChanges','state','Embedded\x20segment\x20\x27','conditionTimeoutDuration','journeys','update','fetchJourney','activation_created','JOURNEY_UPDATE_ERROR','get','branches','message','find','relationships','name','parentFolder','Created\x20segment\x20\x27','existingJourney','notification','stage\x20\x27','activationActions','resolveSegment','map','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','utf-8','values','type','exitCriterias','conditions','journeyId','Segment\x20not\x20found:\x20','activation_','run_after_journey_refresh','object','Creating\x20folder\x20\x27','segment_deleting','NOT_FOUND','segmentNameToId','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','milestone','segments','219774fgBjhe','max','\x27\x20from\x20file:\x20','progress','3939040GnZjTL','deps','keys','uniqueServerName','resolvedRule','deleted','logWarning','./journey-yaml.js','createActivation','segmentFolderId','journeyById','localName','getActivation','size','Activation','item','action','parse','updateSegmentById','entryCriteria','rootFolderId','set','logInfo','journeyStages','1649460OLvrJz','attributes','listActivations','dirname','conditionSegmentId','createJourneySegment','journeyActivationStepId','add','stringify','segment_deleted','toISOString','journey_creating','behavior','journey_updated','segment_updated',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','segment_created','segment_updating','WaitStep','resolveJourneyId','497932GpOUBp','from','\x20(referenced\x20in\x20journey\x20','getSegmentEntity\x20also\x20failed\x20for\x20','decision_point','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','embedded_activation_created','activation_updating','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','created','Failed\x20to\x20fetch\x20referenced\x20segment\x20','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','\x20segment\x20from\x20file:\x20','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','createSegment','\x27\x20milestone','uniqueSegmentName','1618317pZzSKI','\x27\x20exit\x20criteria','nameToType','connector_config','folder_creating','data','440465bUFzIC','entries','Duration','journeyBundleName','some','Updated\x20segment\x20\x27','versionNumber','segment_creating','journeyBundlesByFolderAndName','unchanged','INTERNAL','\x20journey\x20from\x20file:\x20','Failed\x20to\x20','getSegment','tdx.sdk.push-workflow','results','idToEmailMap','updated','Journey\x20\x27','DecisionPoint','deleteActivation','embeddedSegmentNameToId','yamlActivation','embedded_activation_creating','existingSegment','getSegment\x20failed\x20for\x20','all_columns','errors','updateActivation','Updated\x20activation\x20\x27','getJourney','delete','\x0a\x20\x20','activationContext','deleteSegment','goal\x20criteria','toLowerCase','folderId','has','waitStepType','diff','Created\x20journey\x20\x27','schedule','and\x20the\x20server\x20segment,\x20then\x20retry.','existingSegments','description','journeyName','relative','activationParams','all','Updated\x20journey\x20\x27','replace','startsWith','Name\x20has\x20already\x20been\x20taken','includes','yamlConfig','Updating\x20activation\x20\x27','with','folderPath','entry','segmentId'];a114_0x980c=function(){return _0x391c7d;};return a114_0x980c();}function a114_0x3785(_0x39d026,_0x227904){_0x39d026=_0x39d026-0x1a3;const _0x980c4a=a114_0x980c();let _0x3785ef=_0x980c4a[_0x39d026];return _0x3785ef;}export function buildConnectionMaps(_0x2b43a5){const _0x174ac6=a114_0x3e8f2e,_0x39c22e=new Map(),_0x55ac0b=new Map(),_0x498d9b=new Map();for(const _0x649eb7 of _0x2b43a5){_0x39c22e[_0x174ac6(0x22a)](_0x649eb7[_0x174ac6(0x1f6)],parseInt(_0x649eb7['id'],0xa)),_0x55ac0b[_0x174ac6(0x22a)](_0x649eb7['id'],_0x649eb7[_0x174ac6(0x1f6)]),_0x498d9b[_0x174ac6(0x22a)](_0x649eb7[_0x174ac6(0x1f6)],_0x649eb7['type']);}return{'nameToId':_0x39c22e,'idToName':_0x55ac0b,'nameToType':_0x498d9b};}export function calculatePushStats(_0xde2083,_0x4d54ef,_0x4a665b,_0x5a26b3,_0xc0a563,_0x3e3106,_0x1e6e94){const _0x3efec7=a114_0x3e8f2e,_0x6efff0=_0xde2083[_0x3efec7(0x29e)](_0x422c0b=>_0x422c0b['isNew']),_0x37ea06=_0xde2083['filter'](_0x45c4f5=>!_0x45c4f5[_0x3efec7(0x1e5)]&&_0x45c4f5[_0x3efec7(0x1e8)]),_0x541f51=_0xde2083[_0x3efec7(0x29e)](_0x53fce7=>!_0x53fce7['isNew']&&!_0x53fce7[_0x3efec7(0x1e8)]),_0x1cf4fd=_0x3e3106?_0x5a26b3:[],_0x1f34e9=_0x4d54ef[_0x3efec7(0x29e)](_0x40f3ce=>_0x40f3ce[_0x3efec7(0x1e5)]),_0x14d3d0=_0x4d54ef['filter'](_0x2096e5=>!_0x2096e5[_0x3efec7(0x1e5)]&&_0x2096e5['hasChanges']),_0x57ef5b=_0x4d54ef[_0x3efec7(0x29e)](_0x3f3174=>!_0x3f3174[_0x3efec7(0x1e5)]&&!_0x3f3174[_0x3efec7(0x1e8)]),_0x429850=_0x3e3106?_0xc0a563:[],_0x2a9edd=_0xde2083[_0x3efec7(0x1a3)](_0x326dc3=>_0x326dc3['activationActions']),_0x4c089f=_0x2a9edd[_0x3efec7(0x29e)](_0x380b42=>_0x380b42[_0x3efec7(0x202)]===_0x3efec7(0x1c2)),_0x5b9735=_0x2a9edd['filter'](_0x4d2f8d=>_0x4d2f8d['type']===_0x3efec7(0x1ed)),_0x30f0fd=_0x2a9edd[_0x3efec7(0x29e)](_0x3e1cbe=>_0x3e1cbe[_0x3efec7(0x202)]===_0x3efec7(0x277)),_0x5a325a=Array['from'](_0x4a665b)['sort'](),_0x1eaf88=_0x1e6e94?![]:_0x6efff0[_0x3efec7(0x1b7)]>0x0||_0x37ea06[_0x3efec7(0x1b7)]>0x0||_0x1cf4fd[_0x3efec7(0x1b7)]>0x0,_0x52ea7d=_0x1f34e9[_0x3efec7(0x1b7)]>0x0||_0x14d3d0[_0x3efec7(0x1b7)]>0x0||_0x429850[_0x3efec7(0x1b7)]>0x0,_0x31f253=_0x1e6e94?![]:_0x2a9edd['length']>0x0,_0x16db37=_0x5a325a[_0x3efec7(0x1b7)]>0x0;return{'segments':{'new':_0x6efff0,'changed':_0x37ea06,'unchanged':_0x541f51,'toDelete':_0x1cf4fd},'journeys':{'new':_0x1f34e9,'changed':_0x14d3d0,'unchanged':_0x57ef5b,'toDelete':_0x429850},'activations':{'all':_0x2a9edd,'toCreate':_0x4c089f,'toUpdate':_0x5b9735,'toDelete':_0x30f0fd},'folders':{'toCreate':_0x5a325a},'counts':{'segments':{'new':_0x6efff0['length'],'changed':_0x37ea06[_0x3efec7(0x1b7)],'unchanged':_0x541f51['length'],'toDelete':_0x1cf4fd[_0x3efec7(0x1b7)]},'journeys':{'new':_0x1f34e9[_0x3efec7(0x1b7)],'changed':_0x14d3d0[_0x3efec7(0x1b7)],'unchanged':_0x57ef5b[_0x3efec7(0x1b7)],'toDelete':_0x429850[_0x3efec7(0x1b7)]},'activations':{'create':_0x4c089f[_0x3efec7(0x1b7)],'update':_0x5b9735['length'],'delete':_0x30f0fd[_0x3efec7(0x1b7)]},'folders':_0x5a325a[_0x3efec7(0x1b7)]},'hasChanges':_0x1eaf88||_0x52ea7d||_0x31f253||_0x16db37};}export async function buildPushExecutionContext(_0x19315b,_0x172f3c,_0xc3942c,_0x5dc705,_0x258bed,_0x43066c){const _0x5c9c08=a114_0x3e8f2e,_0x30c637=extractRootFolderId(_0xc3942c),{pathToId:_0x12e92a,idToPath:_0x3394b6}=buildFolderMaps(_0x258bed),_0x1effd8=buildSegmentNameToIdMap(_0x5dc705),_0x462b33=new Map(),{batchAsync:_0x32003f}=await import(_0x5c9c08(0x1de)),[_0x41d0f7,_0x499ae0]=await Promise['all']([_0x19315b[_0x5c9c08(0x1aa)][_0x5c9c08(0x1e2)](),_0x19315b[_0x5c9c08(0x1cf)][_0x5c9c08(0x1b8)](),((async()=>{const _0x6132a6=_0x5c9c08;!_0x43066c&&_0x5dc705[_0x6132a6(0x1b7)]>0x0&&await _0x32003f(_0x5dc705,async _0x2a0ea3=>{const _0x72751a=_0x6132a6,_0x185fe5=await _0x19315b[_0x72751a(0x1e7)][_0x72751a(0x22f)](_0x172f3c,_0x2a0ea3['id']);_0x462b33[_0x72751a(0x22a)](_0x2a0ea3['id'],_0x185fe5);});})())]),{emailToId:_0x33fc83,idToEmail:_0x28c249}=_0x41d0f7,_0x41f27a=buildConnectionMaps(_0x499ae0);return{'rootFolderId':_0x30c637,'folderPathToId':_0x12e92a,'folderIdToPath':_0x3394b6,'segmentNameToId':_0x1effd8,'activationsBySegmentId':_0x462b33,'emailToIdMap':_0x33fc83,'idToEmailMap':_0x28c249,'connectionNameToIdMap':_0x41f27a['nameToId'],'connectionIdToNameMap':_0x41f27a['idToName'],'connectionNameToTypeMap':_0x41f27a[_0x5c9c08(0x254)]};}export function createPushYamlContextForBundle(_0x16ea0a,_0x131fed,_0x118f87,_0xee91ec,_0x41c282,_0x5aa663,_0x4d8a6a,_0x26727a){const {existingLocalSegmentNames:_0x3ce56a,localExpandedRuleToNames:_0x59f402}=_0xee91ec,_0x11083b=new Set(),_0x52d8bc=new Map(),_0x1b6c4f=new Map(),_0x489b7c=new Map(),_0x42ffb7=createJumpTargetCache(),_0x3d0bd8=new Map(),_0x28176d=new Map(),_0x451c99=new Set();let _0x534785;const _0x30c36a=_0x1726a1=>{const _0x183bc9={'resolveSegment':async _0x33d136=>{const _0x56552e=a114_0x3785,_0x5ea13d=_0x489b7c['get'](_0x33d136);if(_0x5ea13d!==undefined)return{'name':_0x5ea13d,'isJourneyLocal':!![]};try{const _0x265d57=await fetchSegment(_0x16ea0a,_0x131fed,_0x33d136,_0x118f87);if(!_0x265d57)throw new Error(_0x56552e(0x29b));const _0x2c81bd=generateJourneyLocalName(_0x265d57[_0x56552e(0x1f6)]),_0xed8a12=_0x265d57['kind']===SEGMENT_KIND_JOURNEY&&_0x2c81bd!==undefined;let _0x18682f=_0x265d57[_0x56552e(0x1f6)],_0x2db3ac;if(_0xed8a12&&_0x265d57[_0x56552e(0x1a4)]){const _0x354086=apiRuleToYaml(_0x265d57['rule']);_0x28176d[_0x56552e(0x22a)](_0x33d136,_0x354086);const _0x12a9df=async _0x4a74bd=>{const _0x5eab69=_0x56552e,_0x303f26=collectSegmentRefsFromRule(_0x4a74bd);for(const _0x41d856 of _0x303f26){if(!_0x28176d[_0x5eab69(0x27e)](_0x41d856))try{const _0x24f9e2=await fetchSegment(_0x16ea0a,_0x131fed,_0x41d856,_0x118f87);if(_0x24f9e2?.['rule']){const _0x458062=apiRuleToYaml(_0x24f9e2[_0x5eab69(0x1a4)]);_0x28176d[_0x5eab69(0x22a)](_0x41d856,_0x458062),await _0x12a9df(_0x458062);}}catch(_0x52e156){logger[_0x5eab69(0x1c7)](_0x5eab69(0x24b)+_0x41d856+':\x20'+_0x52e156);}}};await _0x12a9df(_0x354086);const _0x4a3d08=serializeExpandedRule(_0x354086,_0x28176d),_0x5c1ac9=_0x59f402[_0x56552e(0x1f1)](_0x4a3d08);if(_0x5c1ac9&&_0x5c1ac9[_0x56552e(0x1b7)]>0x0){const _0x389124=_0x52d8bc[_0x56552e(0x1f1)](_0x4a3d08)||0x0,_0x51e476=_0x5c1ac9[_0x389124]||_0x5c1ac9[_0x5c1ac9[_0x56552e(0x1b7)]-0x1];_0x52d8bc[_0x56552e(0x22a)](_0x4a3d08,_0x389124+0x1),_0x18682f=_0x51e476,_0x11083b['add'](_0x18682f),_0x489b7c[_0x56552e(0x22a)](_0x33d136,_0x18682f);const _0x3febf2=await resolveRuleSegmentRefs(_0x354086,async _0x1e0949=>{const _0xa09d01=_0x56552e,_0x2dce73=_0x489b7c['get'](_0x1e0949);if(_0x2dce73)return _0x2dce73;const _0x3cb279=await _0x534785[_0xa09d01(0x1fd)](_0x1e0949);return _0x3cb279[_0xa09d01(0x1f6)];});_0x2db3ac={'description':_0x265d57[_0x56552e(0x285)],'rule':_0x3febf2};}else{const _0x1192ff=_0x3d0bd8[_0x56552e(0x1f1)](_0x4a3d08);if(_0x1192ff)_0x18682f=_0x1192ff,_0x489b7c[_0x56552e(0x22a)](_0x33d136,_0x18682f);else{if(_0x2c81bd){let _0x500ee8=_0x2c81bd,_0x269a38=0x2;while(_0x11083b[_0x56552e(0x27e)](_0x500ee8)||_0x3ce56a[_0x56552e(0x27e)](_0x500ee8)){_0x500ee8=_0x2c81bd+'_'+_0x269a38,_0x269a38++;}_0x11083b['add'](_0x500ee8),_0x18682f=_0x500ee8;}_0x489b7c[_0x56552e(0x22a)](_0x33d136,_0x18682f),_0x3d0bd8['set'](_0x4a3d08,_0x18682f);const _0x201f48=await resolveRuleSegmentRefs(_0x354086,async _0x30f80f=>{const _0x5381f8=_0x56552e,_0x26662c=_0x489b7c['get'](_0x30f80f);if(_0x26662c)return _0x26662c;const _0x57aead=await _0x534785[_0x5381f8(0x1fd)](_0x30f80f);return _0x57aead[_0x5381f8(0x1f6)];});_0x2db3ac={'description':_0x265d57[_0x56552e(0x285)],'rule':_0x201f48};}}}return{'name':_0x18682f,'isJourneyLocal':_0xed8a12,'definition':_0x2db3ac};}catch(_0x500c59){return logger[_0x56552e(0x1c7)]('Failed\x20to\x20resolve\x20segment\x20'+_0x33d136+':\x20'+_0x500c59),{'name':_0x33d136,'isJourneyLocal':![]};}},'resolveActivation':async _0x3f6891=>{const _0x1c0fd5=a114_0x3785,_0x36688c=_0x1b6c4f[_0x1c0fd5(0x1f1)](_0x3f6891);if(_0x36688c!==undefined)return{'name':_0x36688c,'isJourneyLocal':!![]};try{let _0x9df16e=_0x4d8a6a?.[_0x1c0fd5(0x1f1)](_0x3f6891);!_0x9df16e&&(_0x9df16e=await _0x16ea0a[_0x1c0fd5(0x1ac)][_0x1c0fd5(0x221)](_0x1726a1,_0x3f6891));const _0x3fea65=_0x9df16e['attributes'][_0x1c0fd5(0x288)][_0x1c0fd5(0x1f6)]||_0x3f6891,_0x273278=sanitizeYamlKey(_0x3fea65)||_0x1c0fd5(0x207)+_0x3f6891,_0x56049e=_0x273278;_0x1b6c4f[_0x1c0fd5(0x22a)](_0x3f6891,_0x56049e);const _0x34a714=journeyActivationStepToYaml(_0x9df16e,_0x41c282,_0x5aa663);return{'name':_0x56049e,'isJourneyLocal':!![],'definition':_0x34a714};}catch(_0x356204){return logger[_0x1c0fd5(0x1c7)](_0x1c0fd5(0x1cd)+_0x3f6891+':\x20'+_0x356204),{'name':_0x3f6891,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x2d0b20,_0x39c32b)=>resolveJumpTarget(_0x2d0b20,_0x39c32b,_0x42ffb7,async _0x1a80fb=>{const _0x1a9997=a114_0x3785,_0x474492=_0x26727a?.[_0x1a9997(0x1f1)](_0x1a80fb);if(_0x474492)return _0x474492;return _0x16ea0a[_0x1a9997(0x1ac)][_0x1a9997(0x276)](_0x1a80fb);})};return _0x534785=_0x183bc9,_0x183bc9;},_0x5266b5=async _0x53af22=>{const _0x8063d0=a114_0x3785,{collectSegmentIdsFromJourneyApi:_0x2b8f48}=await import('./journey-yaml.js'),{batchAsync:_0x3ec9f6}=await import(_0x8063d0(0x1de)),_0x1c809b=new Set();for(const _0x46b337 of _0x53af22){let _0x57de8e=_0x26727a?.[_0x8063d0(0x1f1)](_0x46b337);!_0x57de8e&&(_0x57de8e=await _0x16ea0a['journey'][_0x8063d0(0x276)](_0x46b337));const _0x5ae21d=_0x2b8f48(_0x57de8e);for(const _0x5386b7 of _0x5ae21d){_0x1c809b[_0x8063d0(0x234)](_0x5386b7);}}let _0x30388b=Array[_0x8063d0(0x242)](_0x1c809b);while(_0x30388b[_0x8063d0(0x1b7)]>0x0){const _0x2e9491=_0x30388b[_0x8063d0(0x29e)](_0x24d9e3=>!_0x451c99[_0x8063d0(0x27e)](_0x24d9e3));if(_0x2e9491['length']===0x0)break;const _0x4dbc8b=await _0x3ec9f6(_0x2e9491,async _0x439a3c=>{_0x451c99['add'](_0x439a3c);const _0x36f5b0=await fetchSegment(_0x16ea0a,_0x131fed,_0x439a3c,_0x118f87);if(!_0x36f5b0)return null;return{'segmentId':_0x439a3c,'segment':_0x36f5b0};},0xa),_0x4d36a4=new Set();for(const _0x95378b of _0x4dbc8b){if(!_0x95378b?.[_0x8063d0(0x1e7)]?.[_0x8063d0(0x1a4)])continue;const _0x62bf7a=apiRuleToYaml(_0x95378b['segment'][_0x8063d0(0x1a4)]);_0x28176d['set'](_0x95378b[_0x8063d0(0x294)],_0x62bf7a);const _0x1636dc=collectSegmentRefsFromRule(_0x62bf7a);for(const _0x268867 of _0x1636dc){!_0x451c99[_0x8063d0(0x27e)](_0x268867)&&_0x4d36a4[_0x8063d0(0x234)](_0x268867);}}_0x30388b=Array['from'](_0x4d36a4);}};return{'createYamlContext':_0x30c36a,'prefetchJourneySegments':_0x5266b5};}export async function executePushSegments(_0x222a85,_0x596489,_0x15f344,_0x2e541b,_0x5e35dd){const _0x1a3ebb=a114_0x3e8f2e,{segmentDefToCreateRequest:_0x55b81e,segmentDefToUpdateRequest:_0x2e1eb1}=await import(_0x1a3ebb(0x1b0)),_0x3d2ace=_0x15f344[_0x1a3ebb(0x1c1)],_0x1cbf09=0x5,_0x49f646=async _0x5d8480=>{const _0x1f3211=_0x1a3ebb,_0x34d005=_0x5d8480[_0x1f3211(0x292)]?_0x3d2ace['get'](_0x5d8480['folderPath']):undefined;let _0x5e1283;const _0x55bf01={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};try{if(_0x5d8480[_0x1f3211(0x1e5)]){_0x5e35dd[_0x1f3211(0x1b3)]?.({'type':_0x1f3211(0x25f),'name':_0x5d8480[_0x1f3211(0x28f)]['name']});const _0x100e09=_0x55b81e(_0x5d8480[_0x1f3211(0x28f)],_0x34d005),_0x42dba3=await _0x5e35dd[_0x1f3211(0x1ab)](_0x1f3211(0x1d5)+_0x5d8480['yamlConfig'][_0x1f3211(0x1f6)]+_0x1f3211(0x1d9),()=>_0x222a85[_0x1f3211(0x1e7)][_0x1f3211(0x24f)](_0x2e541b[_0x1f3211(0x297)],_0x100e09));_0x5e1283=_0x42dba3['data']['id'],_0x55bf01[_0x1f3211(0x1e4)]={'name':_0x5d8480[_0x1f3211(0x28f)][_0x1f3211(0x1f6)],'id':_0x5e1283},_0x5e35dd[_0x1f3211(0x1b3)]?.({'type':_0x1f3211(0x23d),'name':_0x5d8480[_0x1f3211(0x28f)]['name'],'segmentId':_0x5e1283}),_0x5e35dd[_0x1f3211(0x1a5)]?.(_0x1f3211(0x1f8)+_0x5d8480[_0x1f3211(0x28f)]['name']+'\x27'),_0x55bf01[_0x1f3211(0x24a)]=0x1;}else{if(_0x5d8480['hasChanges']){_0x5e35dd['onProgress']?.({'type':_0x1f3211(0x23e),'name':_0x5d8480['yamlConfig']['name']});const _0x345742=_0x2e1eb1(_0x5d8480[_0x1f3211(0x28f)]);_0x34d005!==_0x5d8480[_0x1f3211(0x270)]?.[_0x1f3211(0x21e)]&&(_0x345742[_0x1f3211(0x21e)]=_0x34d005?parseInt(_0x34d005,0xa):undefined),await _0x5e35dd['withProgress'](_0x1f3211(0x1c9)+_0x5d8480[_0x1f3211(0x28f)][_0x1f3211(0x1f6)]+'\x27...',()=>_0x222a85[_0x1f3211(0x1e7)][_0x1f3211(0x227)](_0x2e541b[_0x1f3211(0x297)],_0x5d8480[_0x1f3211(0x270)]['id'],_0x345742)),_0x5e1283=_0x5d8480[_0x1f3211(0x270)]['id'],_0x5e35dd[_0x1f3211(0x1b3)]?.({'type':_0x1f3211(0x23b),'name':_0x5d8480[_0x1f3211(0x28f)][_0x1f3211(0x1f6)]}),_0x5e35dd[_0x1f3211(0x1a5)]?.(_0x1f3211(0x25d)+_0x5d8480[_0x1f3211(0x28f)][_0x1f3211(0x1f6)]+'\x27'),_0x55bf01[_0x1f3211(0x269)]=0x1;}else _0x5e1283=_0x5d8480[_0x1f3211(0x270)]['id'];}}catch(_0x3e3a4b){const _0x47c679=isHttp400Error(_0x3e3a4b),_0x4f4157=_0x47c679?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode[_0x1f3211(0x29c)],_0x3071ef=getErrorMessage(_0x3e3a4b);throw new SDKError(_0x4f4157,_0x1f3211(0x264)+(_0x5d8480['isNew']?_0x1f3211(0x1c2):_0x1f3211(0x1ed))+_0x1f3211(0x24d)+_0x5d8480[_0x1f3211(0x2a0)]+_0x1f3211(0x278)+_0x3071ef,_0x3e3a4b);}try{const _0x55cb28=await syncActivationsForSegment(_0x222a85,_0x2e541b[_0x1f3211(0x297)],_0x5e1283,_0x5d8480['yamlConfig'][_0x1f3211(0x1f6)],_0x5d8480[_0x1f3211(0x1fc)],_0x5e35dd,_0x5d8480['absolutePath']);_0x55bf01[_0x1f3211(0x1df)]=_0x55cb28;}catch(_0x158fe6){if(_0x158fe6 instanceof SDKError)throw _0x158fe6;throw new SDKError(ErrorCode[_0x1f3211(0x1d4)],_0x1f3211(0x20e)+_0x5d8480[_0x1f3211(0x28f)][_0x1f3211(0x1f6)]+_0x1f3211(0x213)+_0x5d8480[_0x1f3211(0x2a0)]+_0x1f3211(0x278)+getErrorMessage(_0x158fe6),_0x158fe6);}return _0x55bf01;},_0x3491af=await batchAsync(_0x596489,_0x49f646,_0x1cbf09),_0x20c291={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x41545f of _0x3491af){_0x20c291['created']+=_0x41545f[_0x1a3ebb(0x24a)],_0x20c291[_0x1a3ebb(0x269)]+=_0x41545f[_0x1a3ebb(0x269)],_0x41545f[_0x1a3ebb(0x1e4)]&&_0x20c291[_0x1a3ebb(0x296)][_0x1a3ebb(0x22a)](_0x41545f[_0x1a3ebb(0x1e4)][_0x1a3ebb(0x1f6)],_0x41545f['createdSegmentId']['id']),_0x20c291[_0x1a3ebb(0x1df)][_0x1a3ebb(0x24a)]+=_0x41545f[_0x1a3ebb(0x1df)][_0x1a3ebb(0x24a)],_0x20c291[_0x1a3ebb(0x1df)][_0x1a3ebb(0x269)]+=_0x41545f[_0x1a3ebb(0x1df)][_0x1a3ebb(0x269)],_0x20c291[_0x1a3ebb(0x1df)]['deleted']+=_0x41545f[_0x1a3ebb(0x1df)][_0x1a3ebb(0x21a)];}return _0x20c291;}async function syncActivationsForSegment(_0x51652c,_0x57d316,_0x2e30e0,_0x35855d,_0x32d612,_0x483a49,_0xd89e05){const _0x316569=a114_0x3e8f2e,_0x414149={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x4ea5ab of _0x32d612){try{if(_0x4ea5ab['type']===_0x316569(0x1c2)&&_0x4ea5ab[_0x316569(0x1b5)])_0x483a49[_0x316569(0x1b3)]?.({'type':_0x316569(0x1e3),'segmentName':_0x35855d,'activationName':_0x4ea5ab[_0x316569(0x1f6)]}),await _0x483a49['withProgress']('Creating\x20activation\x20\x27'+_0x4ea5ab[_0x316569(0x1f6)]+'\x27...',()=>_0x51652c['segment'][_0x316569(0x21d)](_0x57d316,_0x2e30e0,_0x4ea5ab[_0x316569(0x1b5)])),_0x483a49[_0x316569(0x1b3)]?.({'type':_0x316569(0x1ef),'segmentName':_0x35855d,'activationName':_0x4ea5ab['name']}),_0x483a49[_0x316569(0x1a5)]?.(_0x316569(0x1ad)+_0x4ea5ab[_0x316569(0x1f6)]+'\x27'),_0x414149[_0x316569(0x24a)]++;else{if(_0x4ea5ab[_0x316569(0x202)]==='update'&&_0x4ea5ab['validatedRequest']&&_0x4ea5ab[_0x316569(0x1e0)])_0x483a49['onProgress']?.({'type':_0x316569(0x248),'segmentName':_0x35855d,'activationName':_0x4ea5ab[_0x316569(0x1f6)]}),await _0x483a49[_0x316569(0x1ab)](_0x316569(0x290)+_0x4ea5ab[_0x316569(0x1f6)]+_0x316569(0x1d9),()=>_0x51652c['segment'][_0x316569(0x274)](_0x57d316,_0x2e30e0,_0x4ea5ab[_0x316569(0x1e0)]['id'],_0x4ea5ab['validatedRequest'])),_0x483a49[_0x316569(0x1b3)]?.({'type':'activation_updated','segmentName':_0x35855d,'activationName':_0x4ea5ab[_0x316569(0x1f6)]}),_0x483a49[_0x316569(0x1a5)]?.(_0x316569(0x275)+_0x4ea5ab[_0x316569(0x1f6)]+'\x27'),_0x414149['updated']++;else _0x4ea5ab[_0x316569(0x202)]==='delete'&&_0x4ea5ab[_0x316569(0x1e0)]&&(_0x483a49[_0x316569(0x1b3)]?.({'type':'activation_deleting','segmentName':_0x35855d,'activationName':_0x4ea5ab[_0x316569(0x1f6)]}),await _0x483a49[_0x316569(0x1ab)](_0x316569(0x1e6)+_0x4ea5ab[_0x316569(0x1f6)]+_0x316569(0x1d9),()=>_0x51652c['segment'][_0x316569(0x26c)](_0x57d316,_0x2e30e0,_0x4ea5ab[_0x316569(0x1e0)]['id'])),_0x483a49['onProgress']?.({'type':'activation_deleted','segmentName':_0x35855d,'activationName':_0x4ea5ab[_0x316569(0x1f6)]}),_0x483a49['logDeleted']?.('Deleted\x20activation\x20\x27'+_0x4ea5ab[_0x316569(0x1f6)]+'\x27'),_0x414149[_0x316569(0x21a)]++);}}catch(_0x3931d8){const _0x3de501=isHttp400Error(_0x3931d8),_0x3789c0=_0x3de501?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0x316569(0x1d4)],_0x351eff=getErrorMessage(_0x3931d8);throw new SDKError(_0x3789c0,'Failed\x20to\x20'+_0x4ea5ab['type']+'\x20activation\x20\x27'+_0x4ea5ab[_0x316569(0x1f6)]+'\x27\x20from\x20file:\x20'+_0xd89e05+_0x316569(0x278)+_0x351eff,_0x3931d8);}}return _0x414149;}export async function executePushFolders(_0x12c381,_0x5ab4cb,_0x3549eb,_0x236355,_0x1fd9b0){const _0x3883bc=a114_0x3e8f2e,_0x50e7eb=new Map(_0x3549eb);for(const _0x3774be of _0x5ab4cb){const _0x236cca=_0x3774be[_0x3883bc(0x1b2)]('/'),_0x5b1651=_0x236cca[_0x236cca[_0x3883bc(0x1b7)]-0x1],_0x569424=_0x236cca['slice'](0x0,-0x1)[_0x3883bc(0x1bb)]('/'),_0x2e65f4=_0x50e7eb[_0x3883bc(0x1f1)](_0x569424);_0x1fd9b0[_0x3883bc(0x1b3)]?.({'type':_0x3883bc(0x256),'folder':_0x3774be});const _0x2af11f={'name':_0x5b1651,'parentFolderId':_0x2e65f4},_0x2ed39f=await _0x1fd9b0[_0x3883bc(0x1ab)](_0x3883bc(0x20a)+_0x3774be+_0x3883bc(0x1d9),()=>_0x12c381['segment'][_0x3883bc(0x299)](_0x236355[_0x3883bc(0x297)],_0x2af11f));_0x50e7eb[_0x3883bc(0x22a)](_0x3774be,_0x2ed39f[_0x3883bc(0x257)]['id']),_0x1fd9b0[_0x3883bc(0x1b3)]?.({'type':_0x3883bc(0x29d),'folder':_0x3774be,'folderId':_0x2ed39f[_0x3883bc(0x257)]['id']}),_0x1fd9b0[_0x3883bc(0x22b)]?.(_0x3883bc(0x1ca)+_0x3774be+'\x27');}return _0x50e7eb;}export async function executePushSegmentDeletions(_0xe8ddbd,_0x4c8641,_0x9eef82){const _0x226d31=a114_0x3e8f2e;if(_0x4c8641[_0x226d31(0x1b7)]===0x0)return 0x0;const {batchAsync:_0x4e73aa}=await import(_0x226d31(0x1de)),_0x2e7b2=0x5,_0x480956=await _0x4e73aa(_0x4c8641,async _0x4d84f8=>{const _0x4de6c8=_0x226d31;return _0x9eef82['onProgress']?.({'type':_0x4de6c8(0x20b),'name':_0x4d84f8['name']}),await _0xe8ddbd[_0x4de6c8(0x1e7)][_0x4de6c8(0x27a)](_0x4d84f8['id']),_0x9eef82[_0x4de6c8(0x1b3)]?.({'type':_0x4de6c8(0x236),'name':_0x4d84f8[_0x4de6c8(0x1f6)]}),_0x9eef82[_0x4de6c8(0x29f)]?.(_0x4de6c8(0x1d8)+_0x4d84f8[_0x4de6c8(0x1f6)]+'\x27'),0x1;},_0x2e7b2);return _0x480956['reduce']((_0x593165,_0x559fae)=>_0x593165+_0x559fae,0x0);}export async function executePushJourneys(_0x35ef31,_0x38504c,_0x4a1528,_0x25c098,_0x463de3){const _0x2bdb80=a114_0x3e8f2e,{journeyDefToRequest:_0x6ea955}=await import(_0x2bdb80(0x21c)),{activationDefToCreateRequest:_0x1c06dd,yamlRuleToApi:_0x2e6d04,validateSegmentRule:_0x290e07}=await import(_0x2bdb80(0x1b0)),_0x2a8083={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x3e7949=new Map(_0x4a1528[_0x2bdb80(0x20d)]),_0x5cde65=0x5;for(let _0x259a99=0x0;_0x259a99<_0x38504c['length'];_0x259a99+=_0x5cde65){const _0x1c16a8=_0x38504c[_0x2bdb80(0x1cb)](_0x259a99,_0x259a99+_0x5cde65),_0x77757=await Promise[_0x2bdb80(0x289)](_0x1c16a8[_0x2bdb80(0x1fe)](async _0xe7e1da=>{const _0x470c3a=_0x2bdb80;if(!_0xe7e1da['isNew']&&!_0xe7e1da['hasChanges'])return{'action':_0x470c3a(0x261),'name':_0xe7e1da[_0x470c3a(0x28f)][_0x470c3a(0x1f6)],'journeyId':_0xe7e1da['existingJourney']?.['id']};const _0x8b2c2=_0xe7e1da['folderPath']?_0x4a1528['folderPathToId'][_0x470c3a(0x1f1)](_0xe7e1da[_0x470c3a(0x292)]):undefined;_0x463de3[_0x470c3a(0x1b3)]?.({'type':_0xe7e1da[_0x470c3a(0x1e5)]?_0x470c3a(0x238):'journey_updating','name':_0xe7e1da[_0x470c3a(0x28f)]['name']});try{const _0x4f9b62=await executeSingleJourneyPush(_0x35ef31,_0xe7e1da,{..._0x4a1528,'segmentNameToId':_0x3e7949},{'parentId':_0x25c098[_0x470c3a(0x297)],'rootFolderId':_0x25c098[_0x470c3a(0x229)],'folderId':_0x8b2c2,'verbose':_0x25c098['verbose']},_0x463de3,{'journeyDefToRequest':_0x6ea955,'activationDefToCreateRequest':_0x1c06dd,'yamlRuleToApi':_0x2e6d04,'validateSegmentRule':_0x290e07});for(const [_0x246783,_0x4e06a4]of _0x4f9b62[_0x470c3a(0x26d)]){_0x3e7949[_0x470c3a(0x22a)](_0x246783,_0x4e06a4),_0x2a8083[_0x470c3a(0x26d)][_0x470c3a(0x22a)](_0x246783,_0x4e06a4);}if(_0x4f9b62['action']===_0x470c3a(0x24a))_0x463de3[_0x470c3a(0x1b3)]?.({'type':_0x470c3a(0x1ae),'name':_0xe7e1da[_0x470c3a(0x28f)]['name'],'journeyId':_0x4f9b62[_0x470c3a(0x205)]}),_0x463de3[_0x470c3a(0x1a5)]?.(_0x470c3a(0x281)+_0xe7e1da[_0x470c3a(0x28f)][_0x470c3a(0x1f6)]+'\x27'),_0x2a8083[_0x470c3a(0x24a)]++;else _0x4f9b62[_0x470c3a(0x225)]===_0x470c3a(0x269)&&(_0x463de3[_0x470c3a(0x1b3)]?.({'type':_0x470c3a(0x23a),'name':_0xe7e1da['yamlConfig']['name']}),_0x463de3[_0x470c3a(0x1a5)]?.(_0x470c3a(0x28a)+_0xe7e1da['yamlConfig'][_0x470c3a(0x1f6)]+'\x27'),_0x2a8083['updated']++);return{'action':_0x4f9b62[_0x470c3a(0x225)],'name':_0xe7e1da[_0x470c3a(0x28f)][_0x470c3a(0x1f6)],'journeyId':_0x4f9b62[_0x470c3a(0x205)]};}catch(_0x2217cf){const _0x19efb7=isHttp400Error(_0x2217cf),_0x1ceae8=_0x19efb7?ErrorCode[_0x470c3a(0x1dd)]:ErrorCode[_0x470c3a(0x1f0)],_0x2c59d7=getErrorMessage(_0x2217cf);throw new SDKError(_0x1ceae8,_0x470c3a(0x264)+(_0xe7e1da[_0x470c3a(0x1e5)]?_0x470c3a(0x1c2):_0x470c3a(0x1ed))+_0x470c3a(0x263)+_0xe7e1da[_0x470c3a(0x2a0)]+'\x0a\x20\x20'+_0x2c59d7,_0x2217cf);}}));_0x2a8083[_0x2bdb80(0x267)][_0x2bdb80(0x1c8)](..._0x77757);}return _0x2a8083;}async function matchExistingJourneySegments(_0x47b97f,_0x13a109,_0x24f18a,_0x33dc4c,_0x4388d3){const _0x1c7d13=a114_0x3e8f2e;if(!_0x13a109[_0x1c7d13(0x1f9)]||!_0x13a109[_0x1c7d13(0x28f)][_0x1c7d13(0x210)])return;const _0x413fdc=new Map();for(const _0x293522 of Object[_0x1c7d13(0x217)](_0x13a109[_0x1c7d13(0x28f)][_0x1c7d13(0x210)])){const _0x2d1397=generateDeterministicJourneySegmentName(_0x13a109[_0x1c7d13(0x28f)]['name'],_0x293522);_0x413fdc[_0x1c7d13(0x22a)](_0x2d1397,_0x293522);}const _0x1407a4=collectSegmentIdsFromJourneyApi(_0x13a109[_0x1c7d13(0x1f9)]);for(const _0x43fb29 of _0x1407a4){const _0x225fa0=await fetchSegment(_0x47b97f,_0x24f18a,_0x43fb29,_0x33dc4c);if(!_0x225fa0?.[_0x1c7d13(0x1f6)])continue;const _0x350612=_0x413fdc['get'](_0x225fa0[_0x1c7d13(0x1f6)]);_0x350612&&_0x4388d3[_0x1c7d13(0x22a)](_0x350612,_0x43fb29);}}async function executeSingleJourneyPush(_0x826b1,_0x4a4823,_0x593202,_0x15eaff,_0x47e04b,_0x4c442c){const _0x163973=a114_0x3e8f2e,{journeyDefToRequest:_0x217147,activationDefToCreateRequest:_0x15991f,yamlRuleToApi:_0x5e382e,validateSegmentRule:_0x2a74f5}=_0x4c442c,_0xfa05ec=new Map(),_0x258117=new Map();recoverSegmentIdsFromPushRecovery(_0x4a4823,_0xfa05ec,_0x593202[_0x163973(0x20d)]);const _0x5e47e3=new Map(),_0x160b58=new Map(),_0x2f417d=new Map();let _0x1e7f0a;const _0x31d97b=async()=>{const _0x1f40d3=_0x163973;if(_0x1e7f0a)return;_0x1e7f0a=new Map();if(!_0x4a4823[_0x1f40d3(0x1f9)])return;const _0x4d0fd6=await _0x826b1['journey'][_0x1f40d3(0x22f)](_0x4a4823[_0x1f40d3(0x1f9)]['id']);for(const _0x18f387 of _0x4d0fd6){const _0x277c06=journeyActivationStepToYaml(_0x18f387,_0x593202[_0x1f40d3(0x268)],_0x593202[_0x1f40d3(0x295)]),_0x533747=activationSignature(_0x277c06);!_0x1e7f0a['has'](_0x533747)&&_0x1e7f0a[_0x1f40d3(0x22a)](_0x533747,_0x18f387['id']),_0x277c06[_0x1f40d3(0x1f6)]&&_0x258117[_0x1f40d3(0x22a)](_0x277c06[_0x1f40d3(0x1f6)],_0x18f387['id']);}};await matchExistingJourneySegments(_0x826b1,_0x4a4823,_0x15eaff[_0x163973(0x297)],_0x593202[_0x163973(0x284)],_0x593202[_0x163973(0x20d)]);const _0x390b06={'resolveSegmentId':async _0x3cd239=>{const _0x4ab433=_0x163973,_0x1da4cb=_0x593202[_0x4ab433(0x20d)][_0x4ab433(0x1f1)](_0x3cd239);if(!_0x1da4cb)throw new SDKError(ErrorCode[_0x4ab433(0x1da)],_0x4ab433(0x206)+_0x3cd239+_0x4ab433(0x243)+_0x4a4823[_0x4ab433(0x28f)][_0x4ab433(0x1f6)]+')');return _0x1da4cb;},'resolveEmbeddedSegmentId':async(_0x43181c,_0x57bf96)=>{const _0x5c6631=_0x163973,_0x26cf6c=_0x593202[_0x5c6631(0x20d)][_0x5c6631(0x1f1)](_0x43181c);if(_0x26cf6c)return _0x26cf6c;const _0x2c2518=_0x593202[_0x5c6631(0x284)][_0x5c6631(0x1f4)](_0x488f85=>_0x488f85[_0x5c6631(0x1f6)]===_0x43181c);if(_0x2c2518)return _0x593202[_0x5c6631(0x20d)]['set'](_0x43181c,_0x2c2518['id']),_0x2c2518['id'];if(_0x4a4823['isNew']){const {stageName:_0x44db16,criteriaName:_0x34c0a7}=findSegmentCriteriaLocation(_0x4a4823[_0x5c6631(0x28f)],_0x43181c);return _0x2a74f5(_0x43181c,_0x57bf96[_0x5c6631(0x1a4)]),_0x160b58[_0x5c6631(0x22a)](_0x43181c,{'definition':_0x57bf96,'stageName':_0x44db16,'criteriaName':_0x34c0a7}),createPendingSegmentId(_0x43181c);}const _0x25991a=_0x4a4823[_0x5c6631(0x1f9)]?.['id'];if(!_0x25991a)throw new SDKError(ErrorCode['INTERNAL'],_0x5c6631(0x1ff));const _0x52f9e9=_0x5e47e3[_0x5c6631(0x1f1)](_0x43181c);if(_0x52f9e9)return _0x52f9e9;const _0x3410e5=((async()=>{const _0x297c4a=_0x5c6631;_0x2a74f5(_0x43181c,_0x57bf96[_0x297c4a(0x1a4)]);const _0xf20dea=generateDeterministicJourneySegmentName(_0x4a4823['yamlConfig'][_0x297c4a(0x1f6)],_0x43181c),_0xb5610c=_0x593202[_0x297c4a(0x284)][_0x297c4a(0x1f4)](_0x1a289f=>_0x1a289f[_0x297c4a(0x1f6)]===_0xf20dea),_0x1ca560=createSegmentIdResolver(_0x593202[_0x297c4a(0x20d)],_0x43181c),_0x35d35b=await resolveRuleSegmentIds(_0x57bf96[_0x297c4a(0x1a4)],_0x1ca560);let _0x36e144;return _0xb5610c?(await _0x826b1['segment'][_0x297c4a(0x227)](_0x15eaff[_0x297c4a(0x297)],_0xb5610c['id'],{'description':_0x57bf96['description']||_0x297c4a(0x1b6)+_0x43181c,'rule':_0x5e382e(_0x35d35b,!![]),'countPopulation':!![]}),_0x36e144=_0xb5610c['id'],saveSegmentToPushRecovery(_0x4a4823[_0x297c4a(0x2a0)],_0x4a4823['yamlConfig'][_0x297c4a(0x1f6)],_0x43181c,{'segmentId':_0x36e144,'uniqueServerName':_0xf20dea,'createdAt':new Date()[_0x297c4a(0x237)]()})):_0x36e144=await createOrRecoverEmbeddedSegment(_0x826b1,_0x4a4823,{'localName':_0x43181c,'uniqueSegmentName':_0xf20dea,'description':_0x57bf96['description']||_0x297c4a(0x1b6)+_0x43181c,'journeyId':_0x25991a,'resolvedRule':_0x35d35b,'parentId':_0x15eaff[_0x297c4a(0x297)],'folderId':_0x15eaff['rootFolderId']||''},_0x5e382e),_0x593202[_0x297c4a(0x20d)]['set'](_0x43181c,_0x36e144),_0xfa05ec[_0x297c4a(0x22a)](_0x43181c,_0x36e144),_0x36e144;})());_0x5e47e3['set'](_0x43181c,_0x3410e5);try{return await _0x3410e5;}finally{_0x5e47e3[_0x5c6631(0x277)](_0x43181c);}},'resolveActivationId':async _0xb30f13=>{const _0x26eca2=_0x163973,_0x5ed542=_0x258117['get'](_0xb30f13);if(_0x5ed542)return _0x5ed542;if(_0x4a4823[_0x26eca2(0x1f9)]){await _0x31d97b();const _0x149cf9=_0x258117[_0x26eca2(0x1f1)](_0xb30f13);if(_0x149cf9)return _0x149cf9;}throw new SDKError(ErrorCode[_0x26eca2(0x20c)],'Activation\x20not\x20found:\x20'+_0xb30f13+_0x26eca2(0x243)+_0x4a4823[_0x26eca2(0x28f)][_0x26eca2(0x1f6)]+_0x26eca2(0x1e1)+_0x26eca2(0x24c));},'resolveEmbeddedActivationId':async(_0x2d9856,_0x3a8595)=>{const _0x243bc9=_0x163973,_0x41ba79=_0x258117['get'](_0x2d9856);if(_0x41ba79)return _0x41ba79;if(_0x4a4823[_0x243bc9(0x1e5)])return _0x2f417d[_0x243bc9(0x22a)](_0x2d9856,_0x3a8595),createPendingActivationId(_0x2d9856);if(_0x4a4823[_0x243bc9(0x1f9)]){await _0x31d97b();const _0x54cb4f=_0x258117[_0x243bc9(0x1f1)](_0x3a8595[_0x243bc9(0x1f6)]);if(_0x54cb4f)return _0x258117[_0x243bc9(0x22a)](_0x2d9856,_0x54cb4f),_0x54cb4f;const _0x55fddf=activationSignature(_0x3a8595),_0x1ed125=_0x1e7f0a?.[_0x243bc9(0x1f1)](_0x55fddf);if(_0x1ed125)return _0x258117[_0x243bc9(0x22a)](_0x2d9856,_0x1ed125),_0x1ed125;const _0x387431=await _0x15991f(_0x3a8595,_0x593202[_0x243bc9(0x279)]),_0x56b1b8={..._0x387431,..._0x3a8595['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x3a8595[_0x243bc9(0x208)]}},_0x29ccb7=await _0x826b1[_0x243bc9(0x1ac)]['createActivation'](_0x4a4823[_0x243bc9(0x1f9)]['id'],_0x56b1b8);return _0x258117['set'](_0x2d9856,_0x29ccb7['id']),_0x29ccb7['id'];}throw new SDKError(ErrorCode[_0x243bc9(0x262)],_0x243bc9(0x24e));},'resolveJourneyId':async _0x9326f4=>{const _0x1d04e9=_0x163973;try{return await _0x826b1[_0x1d04e9(0x1ac)][_0x1d04e9(0x240)](_0x15eaff[_0x1d04e9(0x297)],_0x9326f4);}catch(_0x516eb8){throw new SDKError(ErrorCode['NOT_FOUND'],_0x1d04e9(0x26a)+_0x9326f4+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x4a4823[_0x1d04e9(0x28f)][_0x1d04e9(0x1f6)]+'\x27)',_0x516eb8);}},'resolveStageId':async(_0xf17861,_0x27f7f6)=>{const _0x19319d=_0x163973,_0x293582=await _0x826b1['journey'][_0x19319d(0x276)](_0xf17861),_0x36b928=_0x293582['attributes']['journeyStages']['find'](_0x29463f=>_0x29463f[_0x19319d(0x1f6)][_0x19319d(0x27c)]()===_0x27f7f6[_0x19319d(0x27c)]());if(!_0x36b928?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],'Stage\x20\x27'+_0x27f7f6+_0x19319d(0x1c5)+(_0x293582[_0x19319d(0x22e)]['journeyBundleName']||_0x293582[_0x19319d(0x22e)][_0x19319d(0x1f6)])+'\x27');return _0x36b928['id'];}},_0xb5843f=await _0x217147(_0x4a4823[_0x163973(0x28f)],_0x15eaff[_0x163973(0x297)],_0x390b06),_0x2a9a98=_0x15eaff[_0x163973(0x27d)]||_0x15eaff[_0x163973(0x229)];_0x2a9a98&&(_0xb5843f[_0x163973(0x1f5)]={'parentFolder':{'data':{'id':_0x2a9a98,'type':_0x163973(0x1d7)}}});if(_0x4a4823['isNew']){if(_0x160b58['size']>0x0||_0x2f417d[_0x163973(0x222)]>0x0)return await executeThreeStepJourneyCreate(_0x826b1,_0x4a4823,_0xb5843f,{'pendingEmbeddedSegments':_0x160b58,'pendingEmbeddedActivations':_0x2f417d,'embeddedSegmentNameToId':_0xfa05ec,'journeyActivationNameToId':_0x258117},{..._0x15eaff,'effectiveFolderId':_0x2a9a98},_0x593202,_0x47e04b,_0x4c442c);else{ensureJourneyDefaults(_0xb5843f[_0x163973(0x22e)]);const _0x4ccaad=await _0x826b1[_0x163973(0x1ac)][_0x163973(0x1c2)](_0xb5843f);return deletePushRecovery(_0x4a4823['absolutePath']),{'action':'created','journeyId':_0x4ccaad['id'],'embeddedSegmentNameToId':_0xfa05ec};}}else{if(_0x4a4823[_0x163973(0x1e8)]&&_0x4a4823['existingJourney'])return ensureJourneyDefaults(_0xb5843f['attributes']),await _0x826b1[_0x163973(0x1ac)]['update'](_0x4a4823['existingJourney']['id'],_0xb5843f),deletePushRecovery(_0x4a4823[_0x163973(0x2a0)]),{'action':_0x163973(0x269),'journeyId':_0x4a4823[_0x163973(0x1f9)]['id'],'embeddedSegmentNameToId':_0xfa05ec};}return deletePushRecovery(_0x4a4823['absolutePath']),{'action':'unchanged','journeyId':_0x4a4823[_0x163973(0x1f9)]?.['id'],'embeddedSegmentNameToId':_0xfa05ec};}function findSegmentCriteriaLocation(_0x3d61ae,_0x18521a){const _0x3de3f1=a114_0x3e8f2e,_0x2cf218=_0x3d61ae['stages']||_0x3d61ae['journeys']?.[0x0]?.['stages']||[];let _0x232631=_0x3de3f1(0x293),_0x8d3209=_0x18521a;const _0x5bfdc9=_0x3d61ae[_0x3de3f1(0x1bd)]||_0x3d61ae[_0x3de3f1(0x1ec)]?.[0x0]?.[_0x3de3f1(0x1bd)];if(_0x5bfdc9?.[_0x3de3f1(0x1e7)]===_0x18521a)return{'stageName':_0x3de3f1(0x1bd),'criteriaName':_0x5bfdc9[_0x3de3f1(0x1f6)]||_0x18521a};_0x370932:for(const _0x3fb831 of _0x2cf218){if(_0x3fb831[_0x3de3f1(0x1be)]?.[_0x3de3f1(0x1e7)]===_0x18521a){_0x232631=_0x3fb831[_0x3de3f1(0x1f6)],_0x8d3209=_0x3fb831[_0x3de3f1(0x1be)][_0x3de3f1(0x1f6)]||_0x18521a;break;}if(_0x3fb831[_0x3de3f1(0x1a9)])for(const _0x1095f8 of _0x3fb831[_0x3de3f1(0x1a9)]){if(_0x1095f8[_0x3de3f1(0x202)]===_0x3de3f1(0x245)&&_0x1095f8[_0x3de3f1(0x291)]?.[_0x3de3f1(0x1f2)])for(const _0x18b341 of _0x1095f8[_0x3de3f1(0x291)]['branches']){if(_0x18b341[_0x3de3f1(0x1e7)]===_0x18521a){_0x232631=_0x3fb831['name'],_0x8d3209=_0x18b341[_0x3de3f1(0x1f6)]||_0x18521a;break _0x370932;}}}}return{'stageName':_0x232631,'criteriaName':_0x8d3209};}async function executeThreeStepJourneyCreate(_0x244505,_0x20b0cf,_0x21ba19,_0x1576db,_0x5bdc57,_0x22f819,_0x579118,_0x48a6d1){const _0x5008ee=a114_0x3e8f2e,{activationDefToCreateRequest:_0x403486,yamlRuleToApi:_0x32d540}=_0x48a6d1,{pendingEmbeddedSegments:_0x4f6756,pendingEmbeddedActivations:_0x267a6a,embeddedSegmentNameToId:_0x1db376}=_0x1576db,_0x1263e6=JSON[_0x5008ee(0x226)](JSON['stringify'](_0x21ba19));ensureJourneyDefaults(_0x1263e6[_0x5008ee(0x22e)]),stripPendingIds(_0x1263e6);const _0x1184bd=await _0x244505[_0x5008ee(0x1ac)][_0x5008ee(0x1c2)](_0x1263e6),_0xc67470=_0x1184bd['id'],_0x144938=new Map();for(const _0x30b7af of _0x1184bd['attributes'][_0x5008ee(0x22c)]){_0x144938[_0x5008ee(0x22a)](_0x30b7af[_0x5008ee(0x1f6)]['toLowerCase'](),_0x30b7af['id']);}recoverSegmentIdsFromPushRecovery(_0x20b0cf,_0x1db376,_0x22f819[_0x5008ee(0x20d)]);for(const [_0x41708f,{definition:_0x1d907c}]of _0x4f6756){if(_0x1db376[_0x5008ee(0x27e)](_0x41708f)){_0x579118[_0x5008ee(0x1b3)]?.({'type':_0x5008ee(0x1a6),'journeyName':_0x20b0cf[_0x5008ee(0x28f)][_0x5008ee(0x1f6)],'segmentName':_0x41708f});continue;}const _0x17bfca=generateDeterministicJourneySegmentName(_0x20b0cf['yamlConfig'][_0x5008ee(0x1f6)],_0x41708f);_0x579118[_0x5008ee(0x1b3)]?.({'type':_0x5008ee(0x1b4),'journeyName':_0x20b0cf[_0x5008ee(0x28f)][_0x5008ee(0x1f6)],'segmentName':_0x41708f});const _0x2721ba=createSegmentIdResolver(_0x22f819[_0x5008ee(0x20d)],_0x41708f),_0x33fe76=await resolveRuleSegmentIds(_0x1d907c[_0x5008ee(0x1a4)],_0x2721ba),_0x37497d=await createOrRecoverEmbeddedSegment(_0x244505,_0x20b0cf,{'localName':_0x41708f,'uniqueSegmentName':_0x17bfca,'description':_0x1d907c['description']||'Entry\x20criteria:\x20'+_0x41708f,'journeyId':_0xc67470,'resolvedRule':_0x33fe76,'parentId':_0x5bdc57[_0x5008ee(0x297)],'folderId':_0x5bdc57['effectiveFolderId']||''},_0x32d540);_0x1db376[_0x5008ee(0x22a)](_0x41708f,_0x37497d),_0x22f819[_0x5008ee(0x20d)][_0x5008ee(0x22a)](_0x41708f,_0x37497d),_0x579118[_0x5008ee(0x1b3)]?.({'type':'embedded_segment_created','journeyName':_0x20b0cf[_0x5008ee(0x28f)][_0x5008ee(0x1f6)],'segmentName':_0x41708f});}const _0x156820=new Map();for(const [_0x57515d,_0x57b155]of _0x267a6a){_0x579118['onProgress']?.({'type':_0x5008ee(0x26f),'journeyName':_0x20b0cf[_0x5008ee(0x28f)][_0x5008ee(0x1f6)],'activationName':_0x57515d});const _0x4212f2=await _0x403486(_0x57b155,_0x22f819[_0x5008ee(0x279)]),_0x5373a7={..._0x4212f2,..._0x57b155[_0x5008ee(0x208)]!==undefined&&{'runAfterJourneyRefresh':_0x57b155['run_after_journey_refresh']}},_0x1e8ad9=await _0x244505[_0x5008ee(0x1ac)][_0x5008ee(0x21d)](_0xc67470,_0x5373a7);_0x156820[_0x5008ee(0x22a)](_0x57515d,_0x1e8ad9['id']),_0x1576db[_0x5008ee(0x1af)][_0x5008ee(0x22a)](_0x57515d,_0x1e8ad9['id']),_0x579118[_0x5008ee(0x1b3)]?.({'type':_0x5008ee(0x247),'journeyName':_0x20b0cf[_0x5008ee(0x28f)][_0x5008ee(0x1f6)],'activationName':_0x57515d});}const _0x427989=JSON[_0x5008ee(0x226)](JSON['stringify'](_0x21ba19));return _0x427989['id']=_0xc67470,ensureJourneyDefaults(_0x427989[_0x5008ee(0x22e)]),resolvePendingIdsInRequest(_0x427989,_0x21ba19,_0x144938,_0x1db376,_0x156820,_0x579118),await _0x244505[_0x5008ee(0x1ac)][_0x5008ee(0x1ed)](_0xc67470,_0x427989),deletePushRecovery(_0x20b0cf[_0x5008ee(0x2a0)]),{'action':_0x5008ee(0x24a),'journeyId':_0xc67470,'embeddedSegmentNameToId':_0x1db376};}export function stripWaitStepPendingIds(_0x329dce){const _0xf935f=a114_0x3e8f2e,_0x30d9e2=_0x329dce[_0xf935f(0x231)]&&isPendingSegmentId(_0x329dce[_0xf935f(0x231)]),_0x4f6faf=_0x329dce[_0xf935f(0x204)]?.[_0xf935f(0x25c)](_0x2c7f49=>_0x2c7f49[_0xf935f(0x294)]&&isPendingSegmentId(_0x2c7f49[_0xf935f(0x294)]));(_0x30d9e2||_0x4f6faf)&&(_0x329dce[_0xf935f(0x27f)]=_0xf935f(0x25a),_0x329dce[_0xf935f(0x1bc)]=0x1,_0x329dce[_0xf935f(0x2a1)]='day',delete _0x329dce[_0xf935f(0x231)],delete _0x329dce['conditionTimeoutDuration'],delete _0x329dce['conditionTimeoutUnit'],delete _0x329dce['conditions']);}export function resolveWaitStepPendingIds(_0x670d89,_0x33b22b,_0x1b9655,_0x44e559){const _0x5de4b6=a114_0x3e8f2e;if(_0x33b22b[_0x5de4b6(0x231)]&&isPendingSegmentId(_0x33b22b[_0x5de4b6(0x231)])){const _0x56b47f=_0x1b9655(_0x33b22b['conditionSegmentId'],_0x5de4b6(0x1fb)+_0x44e559+_0x5de4b6(0x1c3));_0x56b47f&&(_0x670d89['waitStepType']=_0x5de4b6(0x1d0),_0x670d89['conditionSegmentId']=_0x56b47f,delete _0x670d89[_0x5de4b6(0x1bc)],delete _0x670d89['waitStepUnit'],_0x33b22b['conditionTimeoutDuration']!==undefined&&(_0x670d89[_0x5de4b6(0x1eb)]=_0x33b22b['conditionTimeoutDuration']),_0x33b22b[_0x5de4b6(0x1c6)]&&(_0x670d89[_0x5de4b6(0x1c6)]=_0x33b22b[_0x5de4b6(0x1c6)]));}if(_0x33b22b[_0x5de4b6(0x204)]){const _0x1eb0b2=_0x33b22b['conditions']['some'](_0x33ba4b=>_0x33ba4b[_0x5de4b6(0x294)]&&isPendingSegmentId(_0x33ba4b[_0x5de4b6(0x294)]));if(_0x1eb0b2){const _0x2856ea=_0x33b22b[_0x5de4b6(0x204)][_0x5de4b6(0x1fe)](_0x37f517=>{const _0x3430bb=_0x5de4b6;if(_0x37f517[_0x3430bb(0x294)]&&isPendingSegmentId(_0x37f517[_0x3430bb(0x294)])){const _0x1b64a3=_0x1b9655(_0x37f517[_0x3430bb(0x294)],'stage\x20\x27'+_0x44e559+_0x3430bb(0x1c3));return{..._0x37f517,'segmentId':_0x1b64a3||_0x37f517[_0x3430bb(0x294)]};}return{..._0x37f517};});_0x670d89['waitStepType']=_0x5de4b6(0x1d0),_0x670d89[_0x5de4b6(0x204)]=_0x2856ea,delete _0x670d89[_0x5de4b6(0x1bc)],delete _0x670d89[_0x5de4b6(0x2a1)],delete _0x670d89[_0x5de4b6(0x231)],delete _0x670d89[_0x5de4b6(0x1eb)],delete _0x670d89[_0x5de4b6(0x1c6)];}}}function stripPendingIds(_0x4111a9){const _0x53b14f=a114_0x3e8f2e;_0x4111a9[_0x53b14f(0x22e)]['goal']?.[_0x53b14f(0x294)]&&isPendingSegmentId(_0x4111a9[_0x53b14f(0x22e)][_0x53b14f(0x1bd)][_0x53b14f(0x294)])&&delete _0x4111a9['attributes'][_0x53b14f(0x1bd)];for(const _0x2f8212 of _0x4111a9[_0x53b14f(0x22e)][_0x53b14f(0x22c)]||[]){_0x2f8212['entryCriteria']?.[_0x53b14f(0x294)]&&isPendingSegmentId(_0x2f8212[_0x53b14f(0x228)][_0x53b14f(0x294)])&&delete _0x2f8212[_0x53b14f(0x228)];_0x2f8212[_0x53b14f(0x20f)]?.['segmentId']&&isPendingSegmentId(_0x2f8212[_0x53b14f(0x20f)]['segmentId'])&&delete _0x2f8212[_0x53b14f(0x20f)];_0x2f8212[_0x53b14f(0x203)]&&(_0x2f8212[_0x53b14f(0x203)]=_0x2f8212['exitCriterias'][_0x53b14f(0x29e)](_0x4e6192=>!_0x4e6192[_0x53b14f(0x294)]||!isPendingSegmentId(_0x4e6192[_0x53b14f(0x294)])));if(_0x2f8212[_0x53b14f(0x1a9)])for(const _0x5a57de of Object[_0x53b14f(0x217)](_0x2f8212[_0x53b14f(0x1a9)])){const _0x59a389=_0x2f8212[_0x53b14f(0x1a9)][_0x5a57de];_0x59a389[_0x53b14f(0x202)]===_0x53b14f(0x223)&&_0x59a389[_0x53b14f(0x233)]&&isPendingActivationId(_0x59a389[_0x53b14f(0x233)])&&(_0x59a389[_0x53b14f(0x233)]='');if(_0x59a389[_0x53b14f(0x202)]===_0x53b14f(0x26b)&&_0x59a389[_0x53b14f(0x1f2)])for(const _0x3da636 of _0x59a389[_0x53b14f(0x1f2)]){_0x3da636[_0x53b14f(0x294)]&&isPendingSegmentId(_0x3da636['segmentId'])&&(_0x3da636[_0x53b14f(0x294)]='');}_0x59a389[_0x53b14f(0x202)]===_0x53b14f(0x23f)&&stripWaitStepPendingIds(_0x59a389);}}}function resolvePendingIdsInRequest(_0x2840ff,_0x4cae86,_0x4d532b,_0x23ec24,_0x700b16,_0x1b4a3e){const _0x5e56e0=a114_0x3e8f2e,_0x514cf0=(_0x24a568,_0x52ba8c)=>{const _0x3b9a43=a114_0x3785;if(!isPendingSegmentId(_0x24a568))return _0x24a568;const _0x20be58=extractPendingSegmentName(_0x24a568),_0x47c566=_0x23ec24['get'](_0x20be58);return!_0x47c566&&_0x1b4a3e[_0x3b9a43(0x21b)]?.(_0x3b9a43(0x249)+_0x20be58+'\x27\x20for\x20'+_0x52ba8c),_0x47c566;};if(_0x2840ff[_0x5e56e0(0x22e)][_0x5e56e0(0x1bd)]?.[_0x5e56e0(0x294)]&&isPendingSegmentId(_0x2840ff['attributes'][_0x5e56e0(0x1bd)][_0x5e56e0(0x294)])){const _0x41edd2=_0x514cf0(_0x2840ff[_0x5e56e0(0x22e)][_0x5e56e0(0x1bd)][_0x5e56e0(0x294)],_0x5e56e0(0x27b));_0x41edd2&&(_0x2840ff[_0x5e56e0(0x22e)][_0x5e56e0(0x1bd)][_0x5e56e0(0x294)]=_0x41edd2);}for(const _0x314ec0 of _0x2840ff[_0x5e56e0(0x22e)]['journeyStages']||[]){const _0x4de1bf=_0x4d532b[_0x5e56e0(0x1f1)](_0x314ec0[_0x5e56e0(0x1f6)]['toLowerCase']());_0x4de1bf&&(_0x314ec0['id']=_0x4de1bf);if(_0x314ec0[_0x5e56e0(0x228)]?.['segmentId']&&isPendingSegmentId(_0x314ec0[_0x5e56e0(0x228)][_0x5e56e0(0x294)])){const _0x39f8aa=_0x514cf0(_0x314ec0[_0x5e56e0(0x228)][_0x5e56e0(0x294)],'stage\x20\x27'+_0x314ec0[_0x5e56e0(0x1f6)]+'\x27\x20entry\x20criteria');_0x39f8aa&&(_0x314ec0[_0x5e56e0(0x228)]['segmentId']=_0x39f8aa);}if(_0x314ec0[_0x5e56e0(0x203)])for(const _0x27e90a of _0x314ec0[_0x5e56e0(0x203)]){if(_0x27e90a[_0x5e56e0(0x294)]&&isPendingSegmentId(_0x27e90a[_0x5e56e0(0x294)])){const _0x177ecd=_0x514cf0(_0x27e90a['segmentId'],_0x5e56e0(0x1fb)+_0x314ec0[_0x5e56e0(0x1f6)]+_0x5e56e0(0x253));_0x177ecd&&(_0x27e90a[_0x5e56e0(0x294)]=_0x177ecd);}}if(_0x314ec0['milestone']?.[_0x5e56e0(0x294)]&&isPendingSegmentId(_0x314ec0[_0x5e56e0(0x20f)][_0x5e56e0(0x294)])){const _0x27fef5=_0x514cf0(_0x314ec0[_0x5e56e0(0x20f)][_0x5e56e0(0x294)],_0x5e56e0(0x1fb)+_0x314ec0[_0x5e56e0(0x1f6)]+_0x5e56e0(0x250));_0x27fef5&&(_0x314ec0['milestone']['segmentId']=_0x27fef5);}if(_0x314ec0[_0x5e56e0(0x1a9)]){const _0x194264=_0xff5afc=>_0x4cae86['attributes']['journeyStages']?.[_0x5e56e0(0x1f4)](_0x392427=>_0x392427[_0x5e56e0(0x1f6)]['toLowerCase']()===_0x314ec0[_0x5e56e0(0x1f6)][_0x5e56e0(0x27c)]())?.[_0x5e56e0(0x1a9)]?.[_0xff5afc];for(const _0x580735 of Object['keys'](_0x314ec0[_0x5e56e0(0x1a9)])){const _0x14d194=_0x314ec0[_0x5e56e0(0x1a9)][_0x580735],_0xf59cb1=_0x194264(_0x580735);if(_0x14d194[_0x5e56e0(0x202)]===_0x5e56e0(0x223)&&_0x14d194[_0x5e56e0(0x233)]&&(isPendingActivationId(_0x14d194['journeyActivationStepId'])||_0x14d194[_0x5e56e0(0x233)]==='')){if(_0xf59cb1?.[_0x5e56e0(0x233)]&&isPendingActivationId(_0xf59cb1[_0x5e56e0(0x233)])){const _0x4759a0=extractPendingActivationName(_0xf59cb1[_0x5e56e0(0x233)]),_0x4e4523=_0x700b16[_0x5e56e0(0x1f1)](_0x4759a0);_0x4e4523&&(_0x14d194[_0x5e56e0(0x233)]=_0x4e4523);}}if(_0x14d194[_0x5e56e0(0x202)]==='DecisionPoint'&&_0x14d194[_0x5e56e0(0x1f2)]&&_0xf59cb1?.['branches'])for(let _0x1a77f6=0x0;_0x1a77f6<_0x14d194['branches']['length'];_0x1a77f6++){const _0x2cd4a5=_0x14d194[_0x5e56e0(0x1f2)][_0x1a77f6],_0x4cf68b=_0xf59cb1[_0x5e56e0(0x1f2)][_0x1a77f6];if(_0x4cf68b?.[_0x5e56e0(0x294)]&&isPendingSegmentId(_0x4cf68b['segmentId'])){const _0xa1201=_0x514cf0(_0x4cf68b[_0x5e56e0(0x294)],_0x5e56e0(0x1fb)+_0x314ec0[_0x5e56e0(0x1f6)]+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x2cd4a5[_0x5e56e0(0x1f6)]||_0x1a77f6)+'\x27');_0xa1201&&(_0x2cd4a5[_0x5e56e0(0x294)]=_0xa1201);}}_0x14d194['type']===_0x5e56e0(0x23f)&&_0xf59cb1?.[_0x5e56e0(0x202)]===_0x5e56e0(0x23f)&&resolveWaitStepPendingIds(_0x14d194,_0xf59cb1,_0x514cf0,_0x314ec0[_0x5e56e0(0x1f6)]);}}}}
1
+ const a114_0x3308e7=a114_0x3638;(function(_0x3a41b8,_0x1134a5){const _0x44da4d=a114_0x3638,_0x6655a=_0x3a41b8();while(!![]){try{const _0xe2d53c=-parseInt(_0x44da4d(0x1a3))/0x1*(parseInt(_0x44da4d(0x1a9))/0x2)+parseInt(_0x44da4d(0x1fa))/0x3+-parseInt(_0x44da4d(0x1de))/0x4+-parseInt(_0x44da4d(0x212))/0x5*(parseInt(_0x44da4d(0x136))/0x6)+-parseInt(_0x44da4d(0x1af))/0x7+parseInt(_0x44da4d(0x142))/0x8+-parseInt(_0x44da4d(0x219))/0x9*(-parseInt(_0x44da4d(0x181))/0xa);if(_0xe2d53c===_0x1134a5)break;else _0x6655a['push'](_0x6655a['shift']());}catch(_0x3ef0a6){_0x6655a['push'](_0x6655a['shift']());}}}(a114_0x59fa,0xeb325));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of']('tdx.sdk.push-workflow');export const PENDING_SEGMENT_PREFIX=a114_0x3308e7(0x17a);export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0x4a6eb8){return''+PENDING_SEGMENT_PREFIX+_0x4a6eb8+'__';}export function isPendingSegmentId(_0x231525){const _0x2f5c4a=a114_0x3308e7;return _0x231525[_0x2f5c4a(0x1e6)](PENDING_SEGMENT_PREFIX)&&!_0x231525[_0x2f5c4a(0x1e6)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x31673a){const _0x15bfdf=a114_0x3308e7;return _0x31673a[_0x15bfdf(0x163)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x286407){return''+PENDING_ACTIVATION_PREFIX+_0x286407+'__';}export function isPendingActivationId(_0x3eeef1){const _0xbf3a2c=a114_0x3308e7;return _0x3eeef1[_0xbf3a2c(0x1e6)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0xccf473){const _0x3b0448=a114_0x3308e7;return _0xccf473[_0x3b0448(0x163)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x280cb4,_0x3ec167){const _0x67faca=a114_0x3308e7,_0x22f91c=_0x280cb4+'::'+(_0x3ec167[_0x67faca(0x140)]()||_0x67faca(0x189)),_0x167087=createHash(_0x67faca(0x209))[_0x67faca(0x1b2)](_0x22f91c)['digest'](_0x67faca(0x1d1))[_0x67faca(0x1eb)](0x0,0xc);return'journey_entry_criteria_'+_0x167087;}export function ensureJourneyDefaults(_0x4b12b9){const _0x28ed05=a114_0x3308e7;!_0x4b12b9['description']&&(_0x4b12b9[_0x28ed05(0x1e1)]=''),!_0x4b12b9[_0x28ed05(0x21b)]&&(_0x4b12b9['state']=_0x28ed05(0x1d0));}export function resolveTDFolderPath(_0x353d40,_0x34448a,_0x173416){const _0x1b9149=a114_0x3308e7;if(!_0x34448a)return _0x353d40;if(_0x353d40===_0x173416||_0x353d40[_0x1b9149(0x1e6)](_0x173416+'/'))return _0x353d40;return _0x353d40?_0x173416+'/'+_0x353d40:_0x173416;}export function addFoldersToCreate(_0x94ea4a,_0x11d165,_0x2ffa5f){const _0x585562=a114_0x3308e7;if(!_0x94ea4a)return;if(_0x11d165[_0x585562(0x16c)](_0x94ea4a))return;const _0x3bdcf1=_0x94ea4a[_0x585562(0x154)]('/');let _0x51e610='';for(const _0x298d9c of _0x3bdcf1){_0x51e610=_0x51e610?_0x51e610+'/'+_0x298d9c:_0x298d9c,!_0x11d165[_0x585562(0x16c)](_0x51e610)&&_0x2ffa5f[_0x585562(0x21e)](_0x51e610);}}import*as a114_0x4e4e82 from'yaml';import{readFileSync}from'fs';import a114_0x3befe2 from'path';import{isJourneyDef,parseYamlString as a114_0x393e31,toYamlString as a114_0x4663c6,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(_0x393ac4){const _0x3bc687=a114_0x3308e7;if(Array[_0x3bc687(0x19c)](_0x393ac4))return'['+_0x393ac4[_0x3bc687(0x224)](_0x2e8bca=>stableStringify(_0x2e8bca))['join'](',')+']';if(_0x393ac4&&typeof _0x393ac4==='object'){const _0x4e04f5=_0x393ac4,_0x3a57e5=Object[_0x3bc687(0x150)](_0x4e04f5)[_0x3bc687(0x14a)](),_0x1534ee=_0x3a57e5[_0x3bc687(0x224)](_0x87fc03=>'\x22'+_0x87fc03+'\x22:'+stableStringify(_0x4e04f5[_0x87fc03]));return'{'+_0x1534ee[_0x3bc687(0x1ad)](',')+'}';}const _0x611f7a=JSON[_0x3bc687(0x1d8)](_0x393ac4);return _0x611f7a===undefined?'null':_0x611f7a;}function activationSignature(_0x29a543){const _0x4fb5b2=a114_0x3308e7,_0x13cd71={'connection':_0x29a543[_0x4fb5b2(0x1f5)],..._0x29a543['all_columns']!==undefined&&{'all_columns':_0x29a543[_0x4fb5b2(0x1cd)]},..._0x29a543[_0x4fb5b2(0x174)]!==undefined&&{'columns':_0x29a543[_0x4fb5b2(0x174)]},..._0x29a543['behavior']!==undefined&&{'behavior':_0x29a543[_0x4fb5b2(0x18d)]},..._0x29a543[_0x4fb5b2(0x1a7)]!==undefined&&{'schedule':_0x29a543['schedule']},..._0x29a543[_0x4fb5b2(0x227)]!==undefined&&{'notification':_0x29a543[_0x4fb5b2(0x227)]},..._0x29a543[_0x4fb5b2(0x217)]!==undefined&&{'connector_config':_0x29a543[_0x4fb5b2(0x217)]},..._0x29a543[_0x4fb5b2(0x1bf)]!==undefined&&{'activation_template_id':_0x29a543[_0x4fb5b2(0x1bf)]}};return stableStringify(_0x13cd71);}async function fetchSegment(_0x1cf38a,_0x1f4fae,_0x45741d,_0x170cd9){const _0x34d995=a114_0x3308e7,_0x585b6f=_0x170cd9?.[_0x34d995(0x17f)](_0x2f4cca=>_0x2f4cca['id']===_0x45741d);if(_0x585b6f)return _0x585b6f;try{return await _0x1cf38a[_0x34d995(0x189)][_0x34d995(0x13f)](_0x1f4fae,_0x45741d);}catch(_0x18aa0d){logger['debug'](_0x34d995(0x183)+_0x45741d+',\x20falling\x20back\x20to\x20getSegmentEntity:\x20'+_0x18aa0d);try{return await _0x1cf38a[_0x34d995(0x189)][_0x34d995(0x1a0)](_0x45741d);}catch(_0x413495){return logger[_0x34d995(0x1ac)](_0x34d995(0x20d)+_0x45741d+':\x20'+_0x413495),null;}}}function recoverSegmentIdsFromPushRecovery(_0x5cf7a3,_0x5594b9,_0x4ddc95){const _0x1a5250=a114_0x3308e7,_0x13602e=readPushRecovery(_0x5cf7a3[_0x1a5250(0x149)]);if(_0x13602e?.[_0x1a5250(0x19a)]===_0x5cf7a3[_0x1a5250(0x225)][_0x1a5250(0x158)])for(const [_0x36bac9,_0x1c5223]of Object[_0x1a5250(0x173)](_0x13602e['segments'])){const _0x38ae48=generateDeterministicJourneySegmentName(_0x5cf7a3[_0x1a5250(0x225)][_0x1a5250(0x158)],_0x36bac9);_0x1c5223[_0x1a5250(0x197)]===_0x38ae48&&(_0x5594b9[_0x1a5250(0x17d)](_0x36bac9,_0x1c5223['segmentId']),_0x4ddc95[_0x1a5250(0x17d)](_0x36bac9,_0x1c5223[_0x1a5250(0x138)]));}}async function createOrRecoverEmbeddedSegment(_0x3b2407,_0x4ebc9f,_0x5168e2,_0x1fa0ac){const _0xb62d3d=a114_0x3308e7;let _0x52ef44;try{_0x52ef44=await _0x3b2407[_0xb62d3d(0x189)]['createJourneySegment']({'name':_0x5168e2[_0xb62d3d(0x148)],'description':_0x5168e2['description'],'journeyId':_0x5168e2[_0xb62d3d(0x1b0)],'rule':_0x1fa0ac(_0x5168e2[_0xb62d3d(0x16e)],!![]),'countPopulation':!![],'parentFolderId':_0x5168e2[_0xb62d3d(0x1e7)],'audienceId':_0x5168e2[_0xb62d3d(0x143)]});}catch(_0x5d6fe2){const _0x424d24=_0x5d6fe2 instanceof Error&&_0x5d6fe2[_0xb62d3d(0x159)][_0xb62d3d(0x206)](_0xb62d3d(0x16f));if(_0x424d24){const _0xb1dd46=readPushRecovery(_0x4ebc9f[_0xb62d3d(0x149)]),_0x515a58=_0xb1dd46?.[_0xb62d3d(0x19a)]===_0x4ebc9f[_0xb62d3d(0x225)][_0xb62d3d(0x158)]?_0xb1dd46[_0xb62d3d(0x1c6)][_0x5168e2[_0xb62d3d(0x166)]]:undefined;if(_0x515a58?.[_0xb62d3d(0x197)]===_0x5168e2['uniqueSegmentName'])await _0x3b2407[_0xb62d3d(0x189)]['updateSegmentById'](_0x5168e2[_0xb62d3d(0x143)],_0x515a58['segmentId'],{'description':_0x5168e2[_0xb62d3d(0x1e1)],'rule':_0x1fa0ac(_0x5168e2[_0xb62d3d(0x16e)],!![]),'countPopulation':!![]}),_0x52ef44=_0x515a58[_0xb62d3d(0x138)];else throw new SDKError(ErrorCode[_0xb62d3d(0x1a2)],_0xb62d3d(0x164)+_0x5168e2['localName']+_0xb62d3d(0x156)+(_0xb62d3d(0x20c)+_0x4ebc9f[_0xb62d3d(0x149)]['replace'](/([^/]+)$/,'.$1.push-recovery.json')+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x5d6fe2);}else throw _0x5d6fe2;}return saveSegmentToPushRecovery(_0x4ebc9f['absolutePath'],_0x4ebc9f[_0xb62d3d(0x225)]['name'],_0x5168e2['localName'],{'segmentId':_0x52ef44,'uniqueServerName':_0x5168e2[_0xb62d3d(0x148)],'createdAt':new Date()[_0xb62d3d(0x1b5)]()}),_0x52ef44;}export async function prepareSegmentFiles(_0x5f21ca,_0x3966c7,_0x9f8819,_0x26dc1f,_0x417f72){const _0x1a1f62=a114_0x3308e7,{activationDefToCreateRequest:_0x5e00bd}=await import(_0x1a1f62(0x1d4)),_0x2196c0=[],_0x300d36=new Set();for(const {yamlConfig:_0xb8833d,folderPath:_0x42cfcd,sourcePath:_0x3f7db9}of _0x5f21ca){const _0x55f1b6=resolveTDFolderPath(_0x42cfcd,_0x26dc1f,_0x417f72),_0x8ead01=_0x55f1b6+':'+_0xb8833d['name'],_0x1e1864=_0x3966c7['segmentByFolderAndName']['get'](_0x8ead01),_0x320a9d=_0x1e1864?_0x3966c7[_0x1a1f62(0x20b)][_0x1a1f62(0x175)](_0x1e1864['id'])||[]:[];addFoldersToCreate(_0x55f1b6,_0x3966c7[_0x1a1f62(0x13e)],_0x300d36);const _0x284673=calculateActivationActions(_0xb8833d[_0x1a1f62(0x12e)]||[],_0x320a9d,_0x3966c7['idToEmailMap'],_0x3966c7[_0x1a1f62(0x178)]);for(const _0x3efd75 of _0x284673){(_0x3efd75[_0x1a1f62(0x177)]===_0x1a1f62(0x1c3)||_0x3efd75[_0x1a1f62(0x177)]==='update')&&_0x3efd75[_0x1a1f62(0x179)]&&(_0x3efd75['validatedRequest']=await _0x5e00bd(_0x3efd75[_0x1a1f62(0x179)],_0x9f8819));}const _0x154f54=calculateSegmentDiff(_0xb8833d,_0x1e1864,_0x320a9d,_0x3966c7['idToEmailMap'],_0x3966c7[_0x1a1f62(0x178)]);_0x2196c0['push']({'relativePath':_0xb8833d[_0x1a1f62(0x158)],'absolutePath':_0x3f7db9,'yamlConfig':_0xb8833d,'folderPath':_0x55f1b6,'existingSegment':_0x1e1864,'existingActivations':_0x320a9d,'isNew':_0x154f54[_0x1a1f62(0x207)],'hasChanges':_0x154f54['hasChanges'],'diff':_0x154f54[_0x1a1f62(0x226)],'activationActions':_0x284673});}return{'segmentFiles':_0x2196c0,'foldersToCreate':_0x300d36};}export async function prepareJourneyFiles(_0x6a7d96,_0x2d1f45,_0x3961ec,_0x4cec2e){const _0x2dd29e=a114_0x3308e7,_0xf87917=[],_0x54c106=new Set();for(const {yamlConfig:_0x35704a,folderPath:_0x21466c,sourcePath:_0x6bdd89}of _0x6a7d96){const _0x3d8ceb=resolveTDFolderPath(_0x21466c,_0x3961ec,_0x4cec2e),_0x186f02=_0x3d8ceb+':'+_0x35704a[_0x2dd29e(0x158)],_0x25dc85=_0x2d1f45[_0x2dd29e(0x19b)][_0x2dd29e(0x175)](_0x186f02);let _0x48887d,_0x37ce75;if(_0x25dc85&&_0x25dc85['length']>0x0){const _0x142517=buildLocalExpandedRuleMappings(_0x35704a),{createYamlContext:_0x3a0ad7,prefetchJourneySegments:_0x572547}=createPushYamlContextForBundle(_0x2d1f45[_0x2dd29e(0x204)],_0x2d1f45[_0x2dd29e(0x143)],_0x2d1f45[_0x2dd29e(0x1ba)],_0x142517,_0x2d1f45[_0x2dd29e(0x1a4)],_0x2d1f45['connectionIdToNameMap'],_0x2d1f45[_0x2dd29e(0x155)],_0x2d1f45[_0x2dd29e(0x199)]);await _0x572547(_0x25dc85[_0x2dd29e(0x224)](_0x5d568c=>_0x5d568c['id']));const _0x3b37b6=hasMultipleVersions(_0x35704a),_0x2d6471=async _0x1e61f4=>{const _0x46b899=_0x2dd29e,_0x200c1e=_0x2d1f45[_0x46b899(0x199)]?.[_0x46b899(0x175)](_0x1e61f4);if(_0x200c1e)return _0x200c1e;return _0x2d1f45[_0x46b899(0x13a)]({'journeyId':_0x1e61f4,'journeyName':_0x35704a[_0x46b899(0x158)],'isMultiVersion':_0x25dc85[_0x46b899(0x1c9)]>0x1});};if(_0x3b37b6&&_0x25dc85['length']>0x1){const _0x1c9495=[];for(const _0x2b7aaf of _0x25dc85){const _0x479ffd=_0x2b7aaf['versionNumber']||0x1;_0x2d1f45[_0x2dd29e(0x1ed)]?.[_0x2dd29e(0x1b2)](_0x2dd29e(0x1bc)+_0x35704a['name']+'\x20v'+_0x479ffd);const _0x855d43=await _0x2d6471(_0x2b7aaf['id']),_0x24a533=_0x3a0ad7(_0x2b7aaf['id']),_0x5a87c6=await journeyResponseToDef(_0x855d43,_0x24a533);_0x1c9495[_0x2dd29e(0x21a)]({'item':_0x2b7aaf,'yaml':_0x5a87c6});}const _0x35a62e=buildLocalRuleToNameMappingFromJourney(_0x35704a);_0x37ce75=buildMergedJourneyDef(_0x1c9495,_0x35a62e);const _0x3f6142=Math['max'](..._0x1c9495[_0x2dd29e(0x224)](_0x447093=>_0x447093['item'][_0x2dd29e(0x196)]||0x0)),_0x2bc940=_0x25dc85[_0x2dd29e(0x17f)](_0x4ef002=>(_0x4ef002[_0x2dd29e(0x196)]||0x0)===_0x3f6142);_0x2bc940&&(_0x2d1f45[_0x2dd29e(0x1ed)]?.[_0x2dd29e(0x1b2)](_0x2dd29e(0x1bc)+_0x35704a[_0x2dd29e(0x158)]+'\x20v'+_0x3f6142),_0x48887d=await _0x2d6471(_0x2bc940['id']));}else{const _0x635c27=_0x25dc85[_0x25dc85[_0x2dd29e(0x1c9)]-0x1];_0x2d1f45[_0x2dd29e(0x1ed)]?.['update'](_0x2dd29e(0x1bc)+_0x35704a[_0x2dd29e(0x158)]),_0x48887d=await _0x2d6471(_0x635c27['id']);const _0x4118b2=_0x3a0ad7(_0x635c27['id']),_0x314cad=await journeyResponseToDef(_0x48887d,_0x4118b2),_0x42154d=buildLocalRuleToNameMappingFromJourney(_0x35704a);_0x37ce75=buildMergedJourneyDef([{'item':_0x635c27,'yaml':_0x314cad}],_0x42154d);}}addFoldersToCreate(_0x3d8ceb,_0x2d1f45[_0x2dd29e(0x13e)],_0x54c106);const _0x584830=calculateJourneyDiff(_0x35704a,_0x37ce75);_0xf87917['push']({'relativePath':_0x35704a[_0x2dd29e(0x158)],'absolutePath':_0x6bdd89,'yamlConfig':_0x35704a,'folderPath':_0x3d8ceb,'existingJourney':_0x48887d,'isNew':_0x584830[_0x2dd29e(0x207)],'hasChanges':_0x584830[_0x2dd29e(0x1b7)],'diff':_0x584830[_0x2dd29e(0x226)]});}return{'journeyFiles':_0xf87917,'foldersToCreate':_0x54c106};}export function calculateActivationActions(_0x333558,_0x4c3283,_0x343169,_0x20a31f){const _0x2300c9=a114_0x3308e7,_0x771131=[],_0x31fe26=new Map();for(const _0x210dd7 of _0x4c3283){_0x31fe26['set'](_0x210dd7[_0x2300c9(0x158)],_0x210dd7);}const _0x88819e=new Map();for(const _0x321138 of _0x333558){_0x88819e[_0x2300c9(0x17d)](_0x321138[_0x2300c9(0x158)],_0x321138);}for(const _0x2e3754 of _0x333558){const _0x4cb543=_0x31fe26[_0x2300c9(0x175)](_0x2e3754[_0x2300c9(0x158)]);if(!_0x4cb543)_0x771131[_0x2300c9(0x21a)]({'type':_0x2300c9(0x1c3),'name':_0x2e3754[_0x2300c9(0x158)],'yamlActivation':_0x2e3754});else{const _0x35e1c1=activationResponseToDef(_0x4cb543,_0x343169,_0x20a31f),_0x5b9cc3=a114_0x4e4e82[_0x2300c9(0x1d8)](_0x35e1c1),_0x4d7911=a114_0x4e4e82['stringify'](_0x2e3754);_0x5b9cc3!==_0x4d7911&&_0x771131['push']({'type':_0x2300c9(0x1b2),'name':_0x2e3754[_0x2300c9(0x158)],'yamlActivation':_0x2e3754,'existingActivation':_0x4cb543});}}for(const _0x542ac0 of _0x4c3283){!_0x88819e['has'](_0x542ac0['name'])&&_0x771131['push']({'type':_0x2300c9(0x223),'name':_0x542ac0[_0x2300c9(0x158)],'existingActivation':_0x542ac0});}return _0x771131;}function calculateYamlDiff(_0x5f501a,_0x490344){if(_0x490344){const _0x1941ad=generateDiff(_0x490344,_0x5f501a),_0xbc1b84=hasChanges(_0x1941ad);return{'isNew':![],'hasChanges':_0xbc1b84,'diff':_0xbc1b84?formatDiffWithColors(_0x1941ad):undefined};}const _0x22e144=generateDiff('',_0x5f501a);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x22e144)};}export function calculateSegmentDiff(_0xee0cb2,_0x2b2908,_0x301703,_0x50ab78,_0x196cb4){const _0x1e552f=segmentToYamlString(_0xee0cb2),_0x41aef6=_0x2b2908?segmentToYamlString(segmentWithActivationsToYaml(_0x2b2908,_0x301703,undefined,_0x50ab78,_0x196cb4)):undefined;return calculateYamlDiff(_0x1e552f,_0x41aef6);}export function calculateJourneyDiff(_0x422618,_0x219a3a){const _0x48ea1a=normalizeJourneyDef(_0x422618,_0x422618),_0x1c7ac5=a114_0x4663c6(_0x48ea1a),_0x300835=_0x219a3a?a114_0x4663c6(normalizeJourneyDef(_0x219a3a,_0x422618)):undefined;return calculateYamlDiff(_0x1c7ac5,_0x300835);}export function findSegmentsToDelete(_0x21169d,_0x21d4e6,_0x299129,_0x35128c,_0x220f93){const _0x1f215a=a114_0x3308e7,_0x52c9b1=new Set();for(const {yamlConfig:_0x328762,folderPath:_0xeade3b}of _0x21d4e6){_0x52c9b1[_0x1f215a(0x21e)](_0xeade3b+':'+_0x328762[_0x1f215a(0x158)]);}return _0x21169d[_0x1f215a(0x1bd)](_0x57cd34=>{const _0x3b467e=_0x1f215a,_0x5c091e=_0x57cd34['segmentFolderId']?_0x299129[_0x3b467e(0x175)](_0x57cd34['segmentFolderId'][_0x3b467e(0x17c)]())||'':'',_0x1ae460=_0x5c091e+':'+_0x57cd34[_0x3b467e(0x158)];if(_0x52c9b1[_0x3b467e(0x16c)](_0x1ae460))return![];if(_0x220f93)return _0x5c091e===_0x35128c||_0x5c091e['startsWith'](_0x35128c+'/');return!![];});}export function findJourneysToDelete(_0x55d72f,_0x5a8840,_0x17e86d,_0x5b58c9,_0x2f57f7){const _0x2d3a5e=a114_0x3308e7,_0x3ec8e5=new Set();for(const {yamlConfig:_0x48a46d,folderPath:_0x1c5e8a}of _0x5a8840){_0x3ec8e5[_0x2d3a5e(0x21e)](_0x1c5e8a+':'+_0x48a46d[_0x2d3a5e(0x158)]);}return _0x55d72f['filter'](_0x1cb8d9=>{const _0x5a65da=_0x2d3a5e,_0x581dcc=_0x1cb8d9[_0x5a65da(0x1e7)]?_0x17e86d[_0x5a65da(0x175)](_0x1cb8d9[_0x5a65da(0x1e7)])||'':'',_0x281917=_0x581dcc+':'+_0x1cb8d9[_0x5a65da(0x200)];if(_0x3ec8e5[_0x5a65da(0x16c)](_0x281917))return![];if(_0x2f57f7)return _0x581dcc===_0x5b58c9||_0x581dcc[_0x5a65da(0x1e6)](_0x5b58c9+'/');return!![];});}export function buildSegmentLookupMap(_0xab3c66,_0x566940){const _0x5868f4=a114_0x3308e7,_0x55f6ef=new Map();for(const _0x2998d8 of _0xab3c66){const _0x41e26f=_0x2998d8[_0x5868f4(0x1c4)]?_0x566940['get'](_0x2998d8[_0x5868f4(0x1c4)]['toString']())||'':'',_0x36470a=_0x41e26f+':'+_0x2998d8['name'];_0x55f6ef[_0x5868f4(0x17d)](_0x36470a,_0x2998d8);}return _0x55f6ef;}export function buildSegmentNameToIdMap(_0x432f29){const _0x155d72=a114_0x3308e7,_0x2bd57b=new Map();for(const _0x1db75d of _0x432f29){_0x2bd57b['set'](_0x1db75d[_0x155d72(0x158)],_0x1db75d['id']);}return _0x2bd57b;}export function buildJourneyBundleLookupMap(_0x131a53,_0x1fd072){const _0x7a911a=a114_0x3308e7,_0x1d07f0=new Map();for(const _0x338c46 of _0x131a53){const _0x250b1c=_0x338c46[_0x7a911a(0x1e7)]?_0x1fd072[_0x7a911a(0x175)](_0x338c46[_0x7a911a(0x1e7)])||'':'',_0x352ad3=_0x250b1c+':'+_0x338c46[_0x7a911a(0x200)];!_0x1d07f0[_0x7a911a(0x16c)](_0x352ad3)&&_0x1d07f0[_0x7a911a(0x17d)](_0x352ad3,[]),_0x1d07f0[_0x7a911a(0x175)](_0x352ad3)[_0x7a911a(0x21a)](_0x338c46);}for(const _0x290d65 of _0x1d07f0[_0x7a911a(0x1d2)]()){_0x290d65[_0x7a911a(0x14a)]((_0x28ac60,_0x367988)=>(_0x28ac60[_0x7a911a(0x196)]||0x0)-(_0x367988[_0x7a911a(0x196)]||0x0));}return _0x1d07f0;}function a114_0x3638(_0x40afbb,_0x21efc4){_0x40afbb=_0x40afbb-0x12c;const _0x59faa2=a114_0x59fa();let _0x36385d=_0x59faa2[_0x40afbb];return _0x36385d;}export function collectFoldersToCreate(_0x561b6a,_0x4118cb){const _0x4fd919=a114_0x3308e7,_0xfc4392=new Set();for(const _0x56b9e3 of _0x561b6a){if(!_0x56b9e3)continue;if(_0x4118cb[_0x4fd919(0x16c)](_0x56b9e3))continue;const _0x2acd0f=_0x56b9e3['split']('/');let _0x3f40f7='';for(const _0x42f4ec of _0x2acd0f){_0x3f40f7=_0x3f40f7?_0x3f40f7+'/'+_0x42f4ec:_0x42f4ec,!_0x4118cb[_0x4fd919(0x16c)](_0x3f40f7)&&_0xfc4392[_0x4fd919(0x21e)](_0x3f40f7);}}return _0xfc4392;}export function parseAndClassifyYamlFiles(_0x42c66b,_0x34b85e,_0x48ef97){const _0x4fda3d=a114_0x3308e7,_0x3668a0=[],_0x582e70=[];for(const _0x348003 of _0x42c66b){const _0x2b8620=a114_0x3befe2['relative'](_0x34b85e,a114_0x3befe2[_0x4fda3d(0x182)](_0x348003)),_0x252415=_0x2b8620==='.'?'':_0x2b8620,_0x115c0f=readFileSync(_0x348003,'utf-8'),_0x4c9398=a114_0x4e4e82['parse'](_0x115c0f);if(isJourneyDef(_0x4c9398)){const _0x1c85a9=a114_0x393e31(_0x115c0f);_0x582e70['push']({'yamlConfig':_0x1c85a9,'folderPath':_0x252415,'sourcePath':_0x348003});}else{if(!_0x48ef97?.[_0x4fda3d(0x1f9)]){const _0x1249de=parseSegmentYamlFile(_0x115c0f),_0xce8205=normalizeChildSegmentYaml(_0x1249de);_0x3668a0['push']({'yamlConfig':_0xce8205,'folderPath':_0x252415,'sourcePath':_0x348003});}}}return{'segments':_0x3668a0,'journeys':_0x582e70};}export function validateParsedFiles(_0x2e0d44,_0x5375b4){const _0x4f4bb5=a114_0x3308e7,_0x31bfae=[];for(const {yamlConfig:_0x2e0ff9,sourcePath:_0x22b479}of _0x2e0d44[_0x4f4bb5(0x1c6)]){const _0x38c398=readFileSync(_0x22b479,_0x4f4bb5(0x12c)),_0x2a2bc7=a114_0x4e4e82[_0x4f4bb5(0x14e)](_0x38c398),_0x3490d6=validateSegmentDef(_0x2e0ff9,{'source':_0x38c398,'document':_0x2a2bc7});if(!_0x3490d6['valid']){const _0x424854=a114_0x3befe2[_0x4f4bb5(0x186)](_0x5375b4,_0x22b479);_0x31bfae[_0x4f4bb5(0x21a)]({'filePath':_0x424854,'source':_0x38c398,'result':_0x3490d6,'isJourney':![]});}}for(const {yamlConfig:_0x20932c,sourcePath:_0x2bb3eb}of _0x2e0d44[_0x4f4bb5(0x134)]){const _0x239c9c=readFileSync(_0x2bb3eb,_0x4f4bb5(0x12c)),_0x229887=a114_0x4e4e82[_0x4f4bb5(0x14e)](_0x239c9c),_0xe72ae2=validateJourneyDef(_0x20932c,{'source':_0x239c9c,'document':_0x229887});if(!_0xe72ae2[_0x4f4bb5(0x172)]){const _0x3f7a3f=a114_0x3befe2[_0x4f4bb5(0x186)](_0x5375b4,_0x2bb3eb);_0x31bfae['push']({'filePath':_0x3f7a3f,'source':_0x239c9c,'result':_0xe72ae2,'isJourney':!![]});}}return _0x31bfae;}export function formatValidationErrors(_0x37f0d6){const _0x3d0101=a114_0x3308e7,_0x1d3912=[];for(const {filePath:_0x46faed,source:_0x343618,result:_0x1c064c,isJourney:_0x182dcf}of _0x37f0d6){const _0x45faf3=_0x182dcf?'journey':_0x3d0101(0x189);_0x1d3912[_0x3d0101(0x21a)]('\x0a'+_0x46faed+'\x20('+_0x45faf3+_0x3d0101(0x17e)+_0x1c064c[_0x3d0101(0x20a)][_0x3d0101(0x1c9)]+_0x3d0101(0x139)),_0x1d3912[_0x3d0101(0x21a)](formatValidationResult(_0x1c064c,_0x343618,_0x46faed));}return _0x1d3912['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x3b061b){const _0x427e20=a114_0x3308e7,_0x95dc8b=new Set(),_0x27045d=new Map(),_0x43b7fc=collectSegmentUsageCounts(_0x3b061b);if(_0x3b061b[_0x427e20(0x1c6)])for(const [_0x152709,_0x3ed063]of Object[_0x427e20(0x173)](_0x3b061b[_0x427e20(0x1c6)])){_0x95dc8b[_0x427e20(0x21e)](_0x152709);if(_0x3ed063['rule']){const _0x4f6b81=yamlRuleToApi(_0x3ed063[_0x427e20(0x1f2)]),_0xc3b456=apiRuleToYaml(_0x4f6b81);_0x27045d[_0x427e20(0x17d)](_0x152709,_0xc3b456);}}const _0x53f139=new Map();let _0x349775=0x0;for(const [_0xb0873d,_0xd0fdd3]of _0x27045d){const _0x1c07d6=serializeExpandedRule(_0xd0fdd3,_0x27045d),_0x398d40=_0x53f139['get'](_0x1c07d6)||[];_0x398d40['push']({'name':_0xb0873d,'index':_0x349775}),_0x53f139[_0x427e20(0x17d)](_0x1c07d6,_0x398d40),_0x349775++;}const _0x21bf95=new Map();for(const [_0x283fc5,_0x15c1d9]of _0x53f139){const _0x385665=_0x15c1d9['slice']()['sort']((_0x3209f8,_0x2c6a9f)=>{const _0x3292d7=_0x427e20,_0x592eb3=_0x43b7fc[_0x3292d7(0x175)](_0x3209f8[_0x3292d7(0x158)])||0x0,_0x27fc5d=_0x43b7fc[_0x3292d7(0x175)](_0x2c6a9f[_0x3292d7(0x158)])||0x0;if(_0x592eb3!==_0x27fc5d)return _0x27fc5d-_0x592eb3;return _0x3209f8['index']-_0x2c6a9f[_0x3292d7(0x16b)];})['map'](_0x420610=>_0x420610[_0x427e20(0x158)]),_0x3d57aa=[];for(const _0x22e1a9 of _0x385665){const _0x500500=_0x43b7fc[_0x427e20(0x175)](_0x22e1a9)||0x0,_0x7b7943=Math[_0x427e20(0x187)](_0x500500,0x1);for(let _0x49572f=0x0;_0x49572f<_0x7b7943;_0x49572f++){_0x3d57aa['push'](_0x22e1a9);}}_0x21bf95['set'](_0x283fc5,_0x3d57aa);}return{'existingLocalSegmentNames':_0x95dc8b,'localSegmentRules':_0x27045d,'localExpandedRuleToNames':_0x21bf95};}export function createSegmentIdResolver(_0x400dbb,_0x1dc074){return async _0x12a516=>{const _0x1d3111=a114_0x3638,_0x13df0c=_0x400dbb['get'](_0x12a516);if(!_0x13df0c)throw new SDKError(ErrorCode[_0x1d3111(0x1b8)],_0x1d3111(0x1cb)+_0x12a516+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x1dc074+'\x27)');return _0x13df0c;};}export function extractRootFolderId(_0x482c5c){const _0x5ce790=a114_0x3308e7;return _0x482c5c['relationships']?.['parentSegmentFolder']?.[_0x5ce790(0x1ca)]?.['id']||_0x482c5c['relationships']?.[_0x5ce790(0x171)]?.['data']?.['id'];}export function buildConnectionMaps(_0x2a0e51){const _0xa2d493=a114_0x3308e7,_0x3ec1d8=new Map(),_0x468c04=new Map(),_0x26ad12=new Map();for(const _0x56708a of _0x2a0e51){_0x3ec1d8[_0xa2d493(0x17d)](_0x56708a[_0xa2d493(0x158)],parseInt(_0x56708a['id'],0xa)),_0x468c04[_0xa2d493(0x17d)](_0x56708a['id'],_0x56708a[_0xa2d493(0x158)]),_0x26ad12['set'](_0x56708a[_0xa2d493(0x158)],_0x56708a['type']);}return{'nameToId':_0x3ec1d8,'idToName':_0x468c04,'nameToType':_0x26ad12};}export function calculatePushStats(_0x524054,_0x2f2db2,_0x3c1981,_0x511e87,_0x4c6938,_0x1bf792,_0xeed3ae){const _0x3923d3=a114_0x3308e7,_0x40e2d2=_0x524054[_0x3923d3(0x1bd)](_0x1e89f5=>_0x1e89f5[_0x3923d3(0x207)]),_0x3c6632=_0x524054[_0x3923d3(0x1bd)](_0x4dae87=>!_0x4dae87['isNew']&&_0x4dae87[_0x3923d3(0x1b7)]),_0x408efe=_0x524054[_0x3923d3(0x1bd)](_0x5e0e50=>!_0x5e0e50[_0x3923d3(0x207)]&&!_0x5e0e50['hasChanges']),_0x246eb5=_0x1bf792?_0x511e87:[],_0x238596=_0x2f2db2[_0x3923d3(0x1bd)](_0x5ef2eb=>_0x5ef2eb['isNew']),_0x76867b=_0x2f2db2[_0x3923d3(0x1bd)](_0x44ad80=>!_0x44ad80[_0x3923d3(0x207)]&&_0x44ad80[_0x3923d3(0x1b7)]),_0x3f78c9=_0x2f2db2['filter'](_0x4c0828=>!_0x4c0828[_0x3923d3(0x207)]&&!_0x4c0828[_0x3923d3(0x1b7)]),_0x236ece=_0x1bf792?_0x4c6938:[],_0x25b453=_0x524054[_0x3923d3(0x1e5)](_0x3d06ab=>_0x3d06ab[_0x3923d3(0x132)]),_0x378e4d=_0x25b453[_0x3923d3(0x1bd)](_0x3c16db=>_0x3c16db[_0x3923d3(0x177)]===_0x3923d3(0x1c3)),_0x327828=_0x25b453[_0x3923d3(0x1bd)](_0x1b36e0=>_0x1b36e0['type']==='update'),_0x2dfbbc=_0x25b453[_0x3923d3(0x1bd)](_0x3ccf9=>_0x3ccf9[_0x3923d3(0x177)]==='delete'),_0xfb3222=Array[_0x3923d3(0x1e0)](_0x3c1981)[_0x3923d3(0x14a)](),_0x2f993a=_0xeed3ae?![]:_0x40e2d2[_0x3923d3(0x1c9)]>0x0||_0x3c6632[_0x3923d3(0x1c9)]>0x0||_0x246eb5[_0x3923d3(0x1c9)]>0x0,_0x182a15=_0x238596[_0x3923d3(0x1c9)]>0x0||_0x76867b[_0x3923d3(0x1c9)]>0x0||_0x236ece[_0x3923d3(0x1c9)]>0x0,_0x255985=_0xeed3ae?![]:_0x25b453[_0x3923d3(0x1c9)]>0x0,_0x1b72e1=_0xfb3222[_0x3923d3(0x1c9)]>0x0;return{'segments':{'new':_0x40e2d2,'changed':_0x3c6632,'unchanged':_0x408efe,'toDelete':_0x246eb5},'journeys':{'new':_0x238596,'changed':_0x76867b,'unchanged':_0x3f78c9,'toDelete':_0x236ece},'activations':{'all':_0x25b453,'toCreate':_0x378e4d,'toUpdate':_0x327828,'toDelete':_0x2dfbbc},'folders':{'toCreate':_0xfb3222},'counts':{'segments':{'new':_0x40e2d2['length'],'changed':_0x3c6632[_0x3923d3(0x1c9)],'unchanged':_0x408efe[_0x3923d3(0x1c9)],'toDelete':_0x246eb5['length']},'journeys':{'new':_0x238596['length'],'changed':_0x76867b[_0x3923d3(0x1c9)],'unchanged':_0x3f78c9['length'],'toDelete':_0x236ece[_0x3923d3(0x1c9)]},'activations':{'create':_0x378e4d['length'],'update':_0x327828[_0x3923d3(0x1c9)],'delete':_0x2dfbbc[_0x3923d3(0x1c9)]},'folders':_0xfb3222[_0x3923d3(0x1c9)]},'hasChanges':_0x2f993a||_0x182a15||_0x255985||_0x1b72e1};}export async function buildPushExecutionContext(_0x18ea79,_0x5ef354,_0x3e7bf2,_0x4e637b,_0x274b89,_0x18f480){const _0x595f3f=a114_0x3308e7,_0xd01d70=extractRootFolderId(_0x3e7bf2),{pathToId:_0x514fc6,idToPath:_0x10eb7f}=buildFolderMaps(_0x274b89),_0x4aed25=buildSegmentNameToIdMap(_0x4e637b),_0x5a7c9c=new Map(),{batchAsync:_0x29c1ba}=await import(_0x595f3f(0x18f)),[_0x2c5f09,_0x43d08d]=await Promise[_0x595f3f(0x18b)]([_0x18ea79[_0x595f3f(0x1fd)][_0x595f3f(0x13b)](),_0x18ea79[_0x595f3f(0x1f5)][_0x595f3f(0x161)](),((async()=>{const _0x3bd540=_0x595f3f;!_0x18f480&&_0x4e637b[_0x3bd540(0x1c9)]>0x0&&await _0x29c1ba(_0x4e637b,async _0x11c6a6=>{const _0x9fed3d=_0x3bd540,_0x35987d=await _0x18ea79[_0x9fed3d(0x189)][_0x9fed3d(0x1e4)](_0x5ef354,_0x11c6a6['id']);_0x5a7c9c[_0x9fed3d(0x17d)](_0x11c6a6['id'],_0x35987d);});})())]),{emailToId:_0x2c746d,idToEmail:_0x4574c8}=_0x2c5f09,_0x33e816=buildConnectionMaps(_0x43d08d);return{'rootFolderId':_0xd01d70,'folderPathToId':_0x514fc6,'folderIdToPath':_0x10eb7f,'segmentNameToId':_0x4aed25,'activationsBySegmentId':_0x5a7c9c,'emailToIdMap':_0x2c746d,'idToEmailMap':_0x4574c8,'connectionNameToIdMap':_0x33e816[_0x595f3f(0x1be)],'connectionIdToNameMap':_0x33e816[_0x595f3f(0x15b)],'connectionNameToTypeMap':_0x33e816['nameToType']};}export function createPushYamlContextForBundle(_0x3a0ce8,_0x4e0b7a,_0x24f2a9,_0x20963f,_0x40a91a,_0xe9d29c,_0x3ca230,_0xf5de41){const {existingLocalSegmentNames:_0x489788,localExpandedRuleToNames:_0x66d47e}=_0x20963f,_0x173946=new Set(),_0x539691=new Map(),_0x28193a=new Map(),_0x10c7fc=new Map(),_0x41ad19=createJumpTargetCache(),_0x41ce51=new Map(),_0x51e85=new Map(),_0x377cc2=new Set();let _0x26398e;const _0x2782c1=_0x4969f3=>{const _0x3a5b89={'resolveSegment':async _0x24e806=>{const _0x6a5bb2=a114_0x3638,_0x2c7bbc=_0x10c7fc['get'](_0x24e806);if(_0x2c7bbc!==undefined)return{'name':_0x2c7bbc,'isJourneyLocal':!![]};try{const _0x1bcbde=await fetchSegment(_0x3a0ce8,_0x4e0b7a,_0x24e806,_0x24f2a9);if(!_0x1bcbde)throw new Error('Segment\x20not\x20found');const _0x1931ad=generateJourneyLocalName(_0x1bcbde[_0x6a5bb2(0x158)]),_0x22d5b6=_0x1bcbde[_0x6a5bb2(0x1fc)]===SEGMENT_KIND_JOURNEY&&_0x1931ad!==undefined;let _0x2a3a52=_0x1bcbde[_0x6a5bb2(0x158)],_0x1182d5;if(_0x22d5b6&&_0x1bcbde[_0x6a5bb2(0x1f2)]){const _0x3cca6c=apiRuleToYaml(_0x1bcbde[_0x6a5bb2(0x1f2)]);_0x51e85[_0x6a5bb2(0x17d)](_0x24e806,_0x3cca6c);const _0x2c5d5e=async _0x7f598d=>{const _0x58e9ff=_0x6a5bb2,_0x513992=collectSegmentRefsFromRule(_0x7f598d);for(const _0x3afe8c of _0x513992){if(!_0x51e85[_0x58e9ff(0x16c)](_0x3afe8c))try{const _0x436c05=await fetchSegment(_0x3a0ce8,_0x4e0b7a,_0x3afe8c,_0x24f2a9);if(_0x436c05?.[_0x58e9ff(0x1f2)]){const _0x17b556=apiRuleToYaml(_0x436c05[_0x58e9ff(0x1f2)]);_0x51e85[_0x58e9ff(0x17d)](_0x3afe8c,_0x17b556),await _0x2c5d5e(_0x17b556);}}catch(_0x383bbc){logger['debug'](_0x58e9ff(0x1ec)+_0x3afe8c+':\x20'+_0x383bbc);}}};await _0x2c5d5e(_0x3cca6c);const _0x316ab0=serializeExpandedRule(_0x3cca6c,_0x51e85),_0x3df320=_0x66d47e[_0x6a5bb2(0x175)](_0x316ab0);if(_0x3df320&&_0x3df320[_0x6a5bb2(0x1c9)]>0x0){const _0x24e239=_0x539691[_0x6a5bb2(0x175)](_0x316ab0)||0x0,_0x334efb=_0x3df320[_0x24e239]||_0x3df320[_0x3df320['length']-0x1];_0x539691[_0x6a5bb2(0x17d)](_0x316ab0,_0x24e239+0x1),_0x2a3a52=_0x334efb,_0x173946[_0x6a5bb2(0x21e)](_0x2a3a52),_0x10c7fc[_0x6a5bb2(0x17d)](_0x24e806,_0x2a3a52);const _0x5cb058=await resolveRuleSegmentRefs(_0x3cca6c,async _0x33fc89=>{const _0x54086e=_0x6a5bb2,_0x574d55=_0x10c7fc[_0x54086e(0x175)](_0x33fc89);if(_0x574d55)return _0x574d55;const _0x1f068f=await _0x26398e['resolveSegment'](_0x33fc89);return _0x1f068f['name'];});_0x1182d5={'description':_0x1bcbde[_0x6a5bb2(0x1e1)],'rule':_0x5cb058};}else{const _0x3aebc2=_0x41ce51['get'](_0x316ab0);if(_0x3aebc2)_0x2a3a52=_0x3aebc2,_0x10c7fc[_0x6a5bb2(0x17d)](_0x24e806,_0x2a3a52);else{if(_0x1931ad){let _0x5c819f=_0x1931ad,_0x5e387c=0x2;while(_0x173946[_0x6a5bb2(0x16c)](_0x5c819f)||_0x489788[_0x6a5bb2(0x16c)](_0x5c819f)){_0x5c819f=_0x1931ad+'_'+_0x5e387c,_0x5e387c++;}_0x173946[_0x6a5bb2(0x21e)](_0x5c819f),_0x2a3a52=_0x5c819f;}_0x10c7fc['set'](_0x24e806,_0x2a3a52),_0x41ce51['set'](_0x316ab0,_0x2a3a52);const _0x14ff1d=await resolveRuleSegmentRefs(_0x3cca6c,async _0xf754b0=>{const _0x47d707=_0x6a5bb2,_0x79b621=_0x10c7fc[_0x47d707(0x175)](_0xf754b0);if(_0x79b621)return _0x79b621;const _0xed806f=await _0x26398e[_0x47d707(0x220)](_0xf754b0);return _0xed806f[_0x47d707(0x158)];});_0x1182d5={'description':_0x1bcbde[_0x6a5bb2(0x1e1)],'rule':_0x14ff1d};}}}return{'name':_0x2a3a52,'isJourneyLocal':_0x22d5b6,'definition':_0x1182d5};}catch(_0x14c1ed){return logger[_0x6a5bb2(0x1ac)](_0x6a5bb2(0x1e2)+_0x24e806+':\x20'+_0x14c1ed),{'name':_0x24e806,'isJourneyLocal':![]};}},'resolveActivation':async _0xd9276e=>{const _0x419fd0=a114_0x3638,_0x53451a=_0x28193a[_0x419fd0(0x175)](_0xd9276e);if(_0x53451a!==undefined)return{'name':_0x53451a,'isJourneyLocal':!![]};try{let _0x2606dc=_0x3ca230?.[_0x419fd0(0x175)](_0xd9276e);!_0x2606dc&&(_0x2606dc=await _0x3a0ce8[_0x419fd0(0x190)]['getActivation'](_0x4969f3,_0xd9276e));const _0x1299ff=_0x2606dc[_0x419fd0(0x13c)]['activationParams']['name']||_0xd9276e,_0x34ec63=sanitizeYamlKey(_0x1299ff)||_0x419fd0(0x1fe)+_0xd9276e,_0x5eddcc=_0x34ec63;_0x28193a[_0x419fd0(0x17d)](_0xd9276e,_0x5eddcc);const _0xa939f2=journeyActivationStepToYaml(_0x2606dc,_0x40a91a,_0xe9d29c);return{'name':_0x5eddcc,'isJourneyLocal':!![],'definition':_0xa939f2};}catch(_0x230e82){return logger['debug'](_0x419fd0(0x222)+_0xd9276e+':\x20'+_0x230e82),{'name':_0xd9276e,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x5ea45a,_0x5d4355)=>resolveJumpTarget(_0x5ea45a,_0x5d4355,_0x41ad19,async _0x239a7b=>{const _0x30caa7=a114_0x3638,_0x13532d=_0xf5de41?.[_0x30caa7(0x175)](_0x239a7b);if(_0x13532d)return _0x13532d;return _0x3a0ce8[_0x30caa7(0x190)][_0x30caa7(0x1d6)](_0x239a7b);})};return _0x26398e=_0x3a5b89,_0x3a5b89;},_0x1df952=async _0x498b38=>{const _0x1259c7=a114_0x3638,{collectSegmentIdsFromJourneyApi:_0x77da1b}=await import(_0x1259c7(0x12f)),{batchAsync:_0x5611d3}=await import(_0x1259c7(0x18f)),_0x575f5c=new Set();for(const _0x364f82 of _0x498b38){let _0x5af40b=_0xf5de41?.[_0x1259c7(0x175)](_0x364f82);!_0x5af40b&&(_0x5af40b=await _0x3a0ce8[_0x1259c7(0x190)][_0x1259c7(0x1d6)](_0x364f82));const _0x5a271f=_0x77da1b(_0x5af40b);for(const _0x26f776 of _0x5a271f){_0x575f5c[_0x1259c7(0x21e)](_0x26f776);}}let _0x5bceab=Array[_0x1259c7(0x1e0)](_0x575f5c);while(_0x5bceab[_0x1259c7(0x1c9)]>0x0){const _0x111317=_0x5bceab[_0x1259c7(0x1bd)](_0xaec1a7=>!_0x377cc2[_0x1259c7(0x16c)](_0xaec1a7));if(_0x111317['length']===0x0)break;const _0x1cd13f=await _0x5611d3(_0x111317,async _0x2c15aa=>{const _0x44aab2=_0x1259c7;_0x377cc2[_0x44aab2(0x21e)](_0x2c15aa);const _0x5cb81a=await fetchSegment(_0x3a0ce8,_0x4e0b7a,_0x2c15aa,_0x24f2a9);if(!_0x5cb81a)return null;return{'segmentId':_0x2c15aa,'segment':_0x5cb81a};},0xa),_0x1cb88b=new Set();for(const _0x5b0fbc of _0x1cd13f){if(!_0x5b0fbc?.[_0x1259c7(0x189)]?.['rule'])continue;const _0x45e7e4=apiRuleToYaml(_0x5b0fbc[_0x1259c7(0x189)][_0x1259c7(0x1f2)]);_0x51e85[_0x1259c7(0x17d)](_0x5b0fbc[_0x1259c7(0x138)],_0x45e7e4);const _0x55bf65=collectSegmentRefsFromRule(_0x45e7e4);for(const _0x577201 of _0x55bf65){!_0x377cc2[_0x1259c7(0x16c)](_0x577201)&&_0x1cb88b[_0x1259c7(0x21e)](_0x577201);}}_0x5bceab=Array[_0x1259c7(0x1e0)](_0x1cb88b);}};return{'createYamlContext':_0x2782c1,'prefetchJourneySegments':_0x1df952};}export async function executePushSegments(_0x44064f,_0x10be76,_0xed2899,_0xc46c2f,_0x93b685){const _0x37f33f=a114_0x3308e7,{segmentDefToCreateRequest:_0x35eec0,segmentDefToUpdateRequest:_0x339175}=await import(_0x37f33f(0x1d4)),_0x54a9ac=_0xed2899[_0x37f33f(0x13e)],_0x19d748=0x5,_0x44c67d=async _0x180dab=>{const _0x448cc5=_0x37f33f,_0x56e950=_0x180dab[_0x448cc5(0x13d)]?_0x54a9ac[_0x448cc5(0x175)](_0x180dab[_0x448cc5(0x13d)]):undefined;let _0xff0d2b;const _0x1c5302={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};try{if(_0x180dab[_0x448cc5(0x207)]){_0x93b685[_0x448cc5(0x1fb)]?.({'type':_0x448cc5(0x1a5),'name':_0x180dab['yamlConfig'][_0x448cc5(0x158)]});const _0xbf8417=_0x35eec0(_0x180dab[_0x448cc5(0x225)],_0x56e950),_0x49310c=await _0x93b685[_0x448cc5(0x167)](_0x448cc5(0x1f4)+_0x180dab[_0x448cc5(0x225)][_0x448cc5(0x158)]+_0x448cc5(0x14f),()=>_0x44064f[_0x448cc5(0x189)][_0x448cc5(0x1d3)](_0xc46c2f['parentId'],_0xbf8417));_0xff0d2b=_0x49310c[_0x448cc5(0x1ca)]['id'],_0x1c5302[_0x448cc5(0x205)]={'name':_0x180dab[_0x448cc5(0x225)]['name'],'id':_0xff0d2b},_0x93b685[_0x448cc5(0x1fb)]?.({'type':_0x448cc5(0x1db),'name':_0x180dab['yamlConfig'][_0x448cc5(0x158)],'segmentId':_0xff0d2b}),_0x93b685['logSuccess']?.(_0x448cc5(0x1bb)+_0x180dab['yamlConfig'][_0x448cc5(0x158)]+'\x27'),_0x1c5302[_0x448cc5(0x1aa)]=0x1;}else{if(_0x180dab[_0x448cc5(0x1b7)]){_0x93b685['onProgress']?.({'type':_0x448cc5(0x1cf),'name':_0x180dab[_0x448cc5(0x225)][_0x448cc5(0x158)]});const _0x212276=_0x339175(_0x180dab[_0x448cc5(0x225)]);_0x56e950!==_0x180dab['existingSegment']?.[_0x448cc5(0x1c4)]&&(_0x212276[_0x448cc5(0x1c4)]=_0x56e950?parseInt(_0x56e950,0xa):undefined),await _0x93b685[_0x448cc5(0x167)](_0x448cc5(0x15a)+_0x180dab[_0x448cc5(0x225)][_0x448cc5(0x158)]+_0x448cc5(0x14f),()=>_0x44064f[_0x448cc5(0x189)]['updateSegmentById'](_0xc46c2f['parentId'],_0x180dab['existingSegment']['id'],_0x212276)),_0xff0d2b=_0x180dab[_0x448cc5(0x216)]['id'],_0x93b685[_0x448cc5(0x1fb)]?.({'type':_0x448cc5(0x18a),'name':_0x180dab['yamlConfig'][_0x448cc5(0x158)]}),_0x93b685['logSuccess']?.(_0x448cc5(0x1ab)+_0x180dab[_0x448cc5(0x225)][_0x448cc5(0x158)]+'\x27'),_0x1c5302['updated']=0x1;}else _0xff0d2b=_0x180dab['existingSegment']['id'];}}catch(_0x31f637){const _0x4ca49a=isHttp400Error(_0x31f637),_0x64efed=_0x4ca49a?ErrorCode[_0x448cc5(0x1e9)]:ErrorCode['SEGMENT_UPDATE_ERROR'],_0x5f1a3d=getErrorMessage(_0x31f637);throw new SDKError(_0x64efed,'Failed\x20to\x20'+(_0x180dab[_0x448cc5(0x207)]?'create':_0x448cc5(0x1b2))+_0x448cc5(0x1b9)+_0x180dab[_0x448cc5(0x149)]+_0x448cc5(0x144)+_0x5f1a3d,_0x31f637);}try{const _0x22ca98=await syncActivationsForSegment(_0x44064f,_0xc46c2f[_0x448cc5(0x143)],_0xff0d2b,_0x180dab[_0x448cc5(0x225)]['name'],_0x180dab[_0x448cc5(0x132)],_0x93b685,_0x180dab[_0x448cc5(0x149)]);_0x1c5302[_0x448cc5(0x12e)]=_0x22ca98;}catch(_0x4901a8){if(_0x4901a8 instanceof SDKError)throw _0x4901a8;throw new SDKError(ErrorCode[_0x448cc5(0x1b3)],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x180dab['yamlConfig'][_0x448cc5(0x158)]+_0x448cc5(0x135)+_0x180dab[_0x448cc5(0x149)]+_0x448cc5(0x144)+getErrorMessage(_0x4901a8),_0x4901a8);}return _0x1c5302;},_0x5e5cde=await batchAsync(_0x10be76,_0x44c67d,_0x19d748),_0x123652={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x4b7be5 of _0x5e5cde){_0x123652['created']+=_0x4b7be5['created'],_0x123652[_0x37f33f(0x162)]+=_0x4b7be5[_0x37f33f(0x162)],_0x4b7be5[_0x37f33f(0x205)]&&_0x123652[_0x37f33f(0x21d)][_0x37f33f(0x17d)](_0x4b7be5[_0x37f33f(0x205)][_0x37f33f(0x158)],_0x4b7be5[_0x37f33f(0x205)]['id']),_0x123652[_0x37f33f(0x12e)]['created']+=_0x4b7be5[_0x37f33f(0x12e)][_0x37f33f(0x1aa)],_0x123652[_0x37f33f(0x12e)][_0x37f33f(0x162)]+=_0x4b7be5[_0x37f33f(0x12e)][_0x37f33f(0x162)],_0x123652[_0x37f33f(0x12e)][_0x37f33f(0x192)]+=_0x4b7be5[_0x37f33f(0x12e)][_0x37f33f(0x192)];}return _0x123652;}function a114_0x59fa(){const _0x45bf8f=['folder_created','Created\x20activation\x20\x27','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','versionNumber','uniqueServerName','stage\x20\x27','journeyById','journeyName','journeyBundlesByFolderAndName','isArray','day','createFolder','embedded_segment_creating','getSegmentEntity','branches','SEGMENT_UPDATE_ERROR','49699Quupda','idToEmailMap','segment_creating','entry','schedule','activationContext','34QWULBc','created','Updated\x20segment\x20\x27','debug','join','activation_creating','4535538PdtAWj','journeyId','\x20activation\x20\x27','update','ACTIVATION_UPDATE_ERROR','run_after_journey_refresh','toISOString','activation_created','hasChanges','SEGMENT_NOT_FOUND','\x20segment\x20from\x20file:\x20','existingSegments','Created\x20segment\x20\x27','Fetching\x20','filter','nameToId','activation_template_id','deleteActivation','conditionTimeoutUnit','Journey\x20\x27','create','segmentFolderId','\x27\x20wait\x20condition','segments','journey_created','JOURNEY_UPDATE_ERROR','length','data','Segment\x20not\x20found:\x20','embeddedSegmentNameToId','all_columns','logDeleted','segment_updating','draft','hex','values','createSegment','./child-segment-yaml.js','steps','getJourney','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','stringify','relationships','existingJourney','segment_created','parse','size','7634960WKcsVY','conditions','from','description','Failed\x20to\x20resolve\x20segment\x20','\x27\x20milestone','listActivations','flatMap','startsWith','folderId','embedded_segment_created','SEGMENT_SYNTAX_ERROR','journeyActivationNameToId','slice','Failed\x20to\x20fetch\x20referenced\x20segment\x20','progress','logInfo','stages','waitStepUnit','Condition','rule','results','Creating\x20segment\x20\x27','connection','waitStep','\x27\x20decision\x20point\x20branch\x20\x27','DecisionPoint','skipSegments','224139IZniio','onProgress','kind','user','activation_','rootFolderId','journeyBundleName','embedded_activation_creating','activation_updating','waitStepType','deps','createdSegmentId','includes','isNew','Updated\x20journey\x20\x27','sha1','errors','activationsBySegmentId','Delete\x20the\x20push\x20recovery\x20file\x20(','getSegmentEntity\x20also\x20failed\x20for\x20','segment_deleting','\x20(referenced\x20in\x20journey\x20','effectiveFolderId','\x27\x20exit\x20criteria','5OVnClX','entryCriteria','conditionTimeoutDuration','unchanged','existingSegment','connector_config','journeyActivationStepId','1071otmFgN','push','state','Stage\x20\x27','createdSegmentIds','add','WaitStep','resolveSegment','milestone','Failed\x20to\x20resolve\x20activation\x20','delete','map','yamlConfig','diff','notification','utf-8','segmentNameToId','activations','./journey-yaml.js','Deleted\x20segment\x20\x27','some','activationActions','Created\x20journey\x20\x27','journeys','\x27\x20from\x20file:\x20','11127954NPbwmp','Activation\x20not\x20found:\x20','segmentId','\x20error(s)','fetchJourney','buildUserMaps','attributes','folderPath','folderPathToId','getSegment','trim','embedded_activation_created','11831976czYeWG','parentId','\x0a\x20\x20','logSuccess','activation_updated','Deleting\x20activation\x20\x27','uniqueSegmentName','absolutePath','sort','Duration','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','exitCriterias','parseDocument','\x27...','keys','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','segment_deleted','conditionSegmentId','split','activationStepsById','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','createActivation','name','message','Updating\x20segment\x20\x27','idToName','journey_updating','resolveJourneyId','Created\x20folder\x20\x27','decision_point','existingActivation','list','updated','replace','Embedded\x20segment\x20\x27','Updating\x20activation\x20\x27','localName','withProgress','NOT_FOUND','Activation','folder','index','has','validatedRequest','resolvedRule','Name\x20has\x20already\x20been\x20taken','Failed\x20to\x20','parentFolder','valid','entries','columns','get','INTERNAL','type','connectionIdToNameMap','yamlActivation','__pending_','Creating\x20activation\x20\x27','toString','set','):\x20','find','Entry\x20criteria:\x20','392090duZuOC','dirname','getSegment\x20failed\x20for\x20','toLowerCase','with','relative','max','entry_criteria','segment','segment_updated','all','\x27\x20entry\x20criteria','behavior','action','../../utils/async.js','journey','goal','deleted'];a114_0x59fa=function(){return _0x45bf8f;};return a114_0x59fa();}async function syncActivationsForSegment(_0x4cd9ac,_0x133391,_0x1b27b3,_0x454f05,_0x49aa5b,_0x1c2591,_0x146c25){const _0xa209a5=a114_0x3308e7,_0x555592={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x3247d5 of _0x49aa5b){try{if(_0x3247d5['type']===_0xa209a5(0x1c3)&&_0x3247d5[_0xa209a5(0x16d)])_0x1c2591[_0xa209a5(0x1fb)]?.({'type':_0xa209a5(0x1ae),'segmentName':_0x454f05,'activationName':_0x3247d5[_0xa209a5(0x158)]}),await _0x1c2591['withProgress'](_0xa209a5(0x17b)+_0x3247d5[_0xa209a5(0x158)]+_0xa209a5(0x14f),()=>_0x4cd9ac['segment']['createActivation'](_0x133391,_0x1b27b3,_0x3247d5[_0xa209a5(0x16d)])),_0x1c2591[_0xa209a5(0x1fb)]?.({'type':_0xa209a5(0x1b6),'segmentName':_0x454f05,'activationName':_0x3247d5[_0xa209a5(0x158)]}),_0x1c2591[_0xa209a5(0x145)]?.(_0xa209a5(0x194)+_0x3247d5[_0xa209a5(0x158)]+'\x27'),_0x555592[_0xa209a5(0x1aa)]++;else{if(_0x3247d5['type']===_0xa209a5(0x1b2)&&_0x3247d5[_0xa209a5(0x16d)]&&_0x3247d5[_0xa209a5(0x160)])_0x1c2591[_0xa209a5(0x1fb)]?.({'type':_0xa209a5(0x202),'segmentName':_0x454f05,'activationName':_0x3247d5['name']}),await _0x1c2591['withProgress'](_0xa209a5(0x165)+_0x3247d5['name']+_0xa209a5(0x14f),()=>_0x4cd9ac['segment']['updateActivation'](_0x133391,_0x1b27b3,_0x3247d5[_0xa209a5(0x160)]['id'],_0x3247d5['validatedRequest'])),_0x1c2591[_0xa209a5(0x1fb)]?.({'type':_0xa209a5(0x146),'segmentName':_0x454f05,'activationName':_0x3247d5[_0xa209a5(0x158)]}),_0x1c2591[_0xa209a5(0x145)]?.('Updated\x20activation\x20\x27'+_0x3247d5[_0xa209a5(0x158)]+'\x27'),_0x555592[_0xa209a5(0x162)]++;else _0x3247d5[_0xa209a5(0x177)]===_0xa209a5(0x223)&&_0x3247d5[_0xa209a5(0x160)]&&(_0x1c2591[_0xa209a5(0x1fb)]?.({'type':'activation_deleting','segmentName':_0x454f05,'activationName':_0x3247d5[_0xa209a5(0x158)]}),await _0x1c2591[_0xa209a5(0x167)](_0xa209a5(0x147)+_0x3247d5['name']+_0xa209a5(0x14f),()=>_0x4cd9ac[_0xa209a5(0x189)][_0xa209a5(0x1c0)](_0x133391,_0x1b27b3,_0x3247d5[_0xa209a5(0x160)]['id'])),_0x1c2591[_0xa209a5(0x1fb)]?.({'type':'activation_deleted','segmentName':_0x454f05,'activationName':_0x3247d5['name']}),_0x1c2591[_0xa209a5(0x1ce)]?.('Deleted\x20activation\x20\x27'+_0x3247d5[_0xa209a5(0x158)]+'\x27'),_0x555592[_0xa209a5(0x192)]++);}}catch(_0x35dd59){const _0x1fafec=isHttp400Error(_0x35dd59),_0x1c11bf=_0x1fafec?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0xa209a5(0x1b3)],_0x59984c=getErrorMessage(_0x35dd59);throw new SDKError(_0x1c11bf,_0xa209a5(0x170)+_0x3247d5['type']+_0xa209a5(0x1b1)+_0x3247d5['name']+_0xa209a5(0x135)+_0x146c25+_0xa209a5(0x144)+_0x59984c,_0x35dd59);}}return _0x555592;}export async function executePushFolders(_0x4d06fb,_0x4954f6,_0x26d587,_0x405165,_0x5010e9){const _0x30a4dc=a114_0x3308e7,_0x3c0cd1=new Map(_0x26d587);for(const _0x4d4f87 of _0x4954f6){const _0x1f4e81=_0x4d4f87[_0x30a4dc(0x154)]('/'),_0x1f8468=_0x1f4e81[_0x1f4e81['length']-0x1],_0x593b2f=_0x1f4e81[_0x30a4dc(0x1eb)](0x0,-0x1)['join']('/'),_0x4fefd4=_0x3c0cd1['get'](_0x593b2f);_0x5010e9['onProgress']?.({'type':'folder_creating','folder':_0x4d4f87});const _0x38fe64={'name':_0x1f8468,'parentFolderId':_0x4fefd4},_0x295ac8=await _0x5010e9['withProgress']('Creating\x20folder\x20\x27'+_0x4d4f87+_0x30a4dc(0x14f),()=>_0x4d06fb[_0x30a4dc(0x189)][_0x30a4dc(0x19e)](_0x405165[_0x30a4dc(0x143)],_0x38fe64));_0x3c0cd1[_0x30a4dc(0x17d)](_0x4d4f87,_0x295ac8[_0x30a4dc(0x1ca)]['id']),_0x5010e9[_0x30a4dc(0x1fb)]?.({'type':_0x30a4dc(0x193),'folder':_0x4d4f87,'folderId':_0x295ac8[_0x30a4dc(0x1ca)]['id']}),_0x5010e9[_0x30a4dc(0x1ee)]?.(_0x30a4dc(0x15e)+_0x4d4f87+'\x27');}return _0x3c0cd1;}export async function executePushSegmentDeletions(_0x2eada5,_0x2be90a,_0x493a88){const _0x3a05c0=a114_0x3308e7;if(_0x2be90a[_0x3a05c0(0x1c9)]===0x0)return 0x0;const {batchAsync:_0x45df7e}=await import(_0x3a05c0(0x18f)),_0xbe4675=0x5,_0x3ba078=await _0x45df7e(_0x2be90a,async _0x553ee4=>{const _0x3744dd=_0x3a05c0;return _0x493a88[_0x3744dd(0x1fb)]?.({'type':_0x3744dd(0x20e),'name':_0x553ee4[_0x3744dd(0x158)]}),await _0x2eada5['segment']['deleteSegment'](_0x553ee4['id']),_0x493a88[_0x3744dd(0x1fb)]?.({'type':_0x3744dd(0x152),'name':_0x553ee4['name']}),_0x493a88[_0x3744dd(0x1ce)]?.(_0x3744dd(0x130)+_0x553ee4['name']+'\x27'),0x1;},_0xbe4675);return _0x3ba078['reduce']((_0x11c4e8,_0xa17cb)=>_0x11c4e8+_0xa17cb,0x0);}export async function executePushJourneys(_0x3d4f53,_0x385691,_0x46537b,_0x47a19c,_0x290f6d){const _0x389b0c=a114_0x3308e7,{journeyDefToRequest:_0x49f632}=await import(_0x389b0c(0x12f)),{activationDefToCreateRequest:_0x46ae6c,yamlRuleToApi:_0x435d89,validateSegmentRule:_0x26b15d}=await import(_0x389b0c(0x1d4)),_0x88d3c7={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x5949c5=new Map(_0x46537b[_0x389b0c(0x12d)]),_0x723a05=0x5;for(let _0x5588b5=0x0;_0x5588b5<_0x385691[_0x389b0c(0x1c9)];_0x5588b5+=_0x723a05){const _0x2a882b=_0x385691[_0x389b0c(0x1eb)](_0x5588b5,_0x5588b5+_0x723a05),_0x3253a9=await Promise[_0x389b0c(0x18b)](_0x2a882b['map'](async _0x17b914=>{const _0x569c22=_0x389b0c;if(!_0x17b914[_0x569c22(0x207)]&&!_0x17b914['hasChanges'])return{'action':_0x569c22(0x215),'name':_0x17b914[_0x569c22(0x225)][_0x569c22(0x158)],'journeyId':_0x17b914[_0x569c22(0x1da)]?.['id']};const _0x1b85a9=_0x17b914['folderPath']?_0x46537b['folderPathToId'][_0x569c22(0x175)](_0x17b914[_0x569c22(0x13d)]):undefined;_0x290f6d['onProgress']?.({'type':_0x17b914[_0x569c22(0x207)]?'journey_creating':_0x569c22(0x15c),'name':_0x17b914[_0x569c22(0x225)]['name']});try{const _0x14a7f3=await executeSingleJourneyPush(_0x3d4f53,_0x17b914,{..._0x46537b,'segmentNameToId':_0x5949c5},{'parentId':_0x47a19c[_0x569c22(0x143)],'rootFolderId':_0x47a19c[_0x569c22(0x1ff)],'folderId':_0x1b85a9,'verbose':_0x47a19c['verbose']},_0x290f6d,{'journeyDefToRequest':_0x49f632,'activationDefToCreateRequest':_0x46ae6c,'yamlRuleToApi':_0x435d89,'validateSegmentRule':_0x26b15d});for(const [_0x5a7c7a,_0x178a25]of _0x14a7f3[_0x569c22(0x1cc)]){_0x5949c5[_0x569c22(0x17d)](_0x5a7c7a,_0x178a25),_0x88d3c7[_0x569c22(0x1cc)][_0x569c22(0x17d)](_0x5a7c7a,_0x178a25);}if(_0x14a7f3[_0x569c22(0x18e)]==='created')_0x290f6d['onProgress']?.({'type':_0x569c22(0x1c7),'name':_0x17b914['yamlConfig']['name'],'journeyId':_0x14a7f3['journeyId']}),_0x290f6d[_0x569c22(0x145)]?.(_0x569c22(0x133)+_0x17b914[_0x569c22(0x225)][_0x569c22(0x158)]+'\x27'),_0x88d3c7[_0x569c22(0x1aa)]++;else _0x14a7f3['action']===_0x569c22(0x162)&&(_0x290f6d[_0x569c22(0x1fb)]?.({'type':'journey_updated','name':_0x17b914[_0x569c22(0x225)][_0x569c22(0x158)]}),_0x290f6d[_0x569c22(0x145)]?.(_0x569c22(0x208)+_0x17b914[_0x569c22(0x225)][_0x569c22(0x158)]+'\x27'),_0x88d3c7[_0x569c22(0x162)]++);return{'action':_0x14a7f3[_0x569c22(0x18e)],'name':_0x17b914['yamlConfig'][_0x569c22(0x158)],'journeyId':_0x14a7f3[_0x569c22(0x1b0)]};}catch(_0x1fc99a){const _0x964667=isHttp400Error(_0x1fc99a),_0x4a4002=_0x964667?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode[_0x569c22(0x1c8)],_0x5de26a=getErrorMessage(_0x1fc99a);throw new SDKError(_0x4a4002,_0x569c22(0x170)+(_0x17b914[_0x569c22(0x207)]?_0x569c22(0x1c3):_0x569c22(0x1b2))+'\x20journey\x20from\x20file:\x20'+_0x17b914['absolutePath']+'\x0a\x20\x20'+_0x5de26a,_0x1fc99a);}}));_0x88d3c7[_0x389b0c(0x1f3)]['push'](..._0x3253a9);}return _0x88d3c7;}async function matchExistingJourneySegments(_0x3648e8,_0x565cd4,_0x54258c,_0x1304c6,_0x5802b8){const _0x1e8116=a114_0x3308e7;if(!_0x565cd4[_0x1e8116(0x1da)]||!_0x565cd4['yamlConfig'][_0x1e8116(0x1c6)])return;const _0x59aff9=new Map();for(const _0x32c65d of Object[_0x1e8116(0x150)](_0x565cd4[_0x1e8116(0x225)][_0x1e8116(0x1c6)])){const _0x67e1ea=generateDeterministicJourneySegmentName(_0x565cd4[_0x1e8116(0x225)]['name'],_0x32c65d);_0x59aff9[_0x1e8116(0x17d)](_0x67e1ea,_0x32c65d);}const _0x36cdbd=collectSegmentIdsFromJourneyApi(_0x565cd4[_0x1e8116(0x1da)]);for(const _0x257f57 of _0x36cdbd){const _0x458613=await fetchSegment(_0x3648e8,_0x54258c,_0x257f57,_0x1304c6);if(!_0x458613?.[_0x1e8116(0x158)])continue;const _0x334b42=_0x59aff9['get'](_0x458613[_0x1e8116(0x158)]);_0x334b42&&_0x5802b8[_0x1e8116(0x17d)](_0x334b42,_0x257f57);}}async function executeSingleJourneyPush(_0x29e0b3,_0x5c6275,_0x2dff10,_0x4c7e3d,_0x364b85,_0x21707b){const _0xe6b2a6=a114_0x3308e7,{journeyDefToRequest:_0x4e02f1,activationDefToCreateRequest:_0x40a594,yamlRuleToApi:_0xb48b9b,validateSegmentRule:_0x264c22}=_0x21707b,_0x19d3cd=new Map(),_0x2633bc=new Map();recoverSegmentIdsFromPushRecovery(_0x5c6275,_0x19d3cd,_0x2dff10[_0xe6b2a6(0x12d)]);const _0x2581bb=new Map(),_0x56b054=new Map(),_0x52552c=new Map();let _0x1b715a;const _0xf5e21f=async()=>{const _0x2750ae=_0xe6b2a6;if(_0x1b715a)return;_0x1b715a=new Map();if(!_0x5c6275['existingJourney'])return;const _0x2af9b3=await _0x29e0b3[_0x2750ae(0x190)][_0x2750ae(0x1e4)](_0x5c6275[_0x2750ae(0x1da)]['id']);for(const _0x485e43 of _0x2af9b3){const _0x26094a=journeyActivationStepToYaml(_0x485e43,_0x2dff10[_0x2750ae(0x1a4)],_0x2dff10[_0x2750ae(0x178)]),_0x46a645=activationSignature(_0x26094a);!_0x1b715a[_0x2750ae(0x16c)](_0x46a645)&&_0x1b715a[_0x2750ae(0x17d)](_0x46a645,_0x485e43['id']),_0x26094a['name']&&_0x2633bc[_0x2750ae(0x17d)](_0x26094a[_0x2750ae(0x158)],_0x485e43['id']);}};await matchExistingJourneySegments(_0x29e0b3,_0x5c6275,_0x4c7e3d[_0xe6b2a6(0x143)],_0x2dff10['existingSegments'],_0x2dff10['segmentNameToId']);const _0xe3fe8a={'resolveSegmentId':async _0x11e421=>{const _0x4932c7=_0xe6b2a6,_0x5c6562=_0x2dff10[_0x4932c7(0x12d)][_0x4932c7(0x175)](_0x11e421);if(!_0x5c6562)throw new SDKError(ErrorCode[_0x4932c7(0x1b8)],_0x4932c7(0x1cb)+_0x11e421+_0x4932c7(0x20f)+_0x5c6275['yamlConfig'][_0x4932c7(0x158)]+')');return _0x5c6562;},'resolveEmbeddedSegmentId':async(_0xb728f1,_0x360386)=>{const _0x3cb88c=_0xe6b2a6,_0x269189=_0x2dff10[_0x3cb88c(0x12d)][_0x3cb88c(0x175)](_0xb728f1);if(_0x269189)return _0x269189;const _0x426e03=_0x2dff10[_0x3cb88c(0x1ba)][_0x3cb88c(0x17f)](_0x6778b1=>_0x6778b1['name']===_0xb728f1);if(_0x426e03)return _0x2dff10[_0x3cb88c(0x12d)][_0x3cb88c(0x17d)](_0xb728f1,_0x426e03['id']),_0x426e03['id'];if(_0x5c6275[_0x3cb88c(0x207)]){const {stageName:_0x110c5a,criteriaName:_0x39e9d9}=findSegmentCriteriaLocation(_0x5c6275['yamlConfig'],_0xb728f1);return _0x264c22(_0xb728f1,_0x360386[_0x3cb88c(0x1f2)]),_0x56b054['set'](_0xb728f1,{'definition':_0x360386,'stageName':_0x110c5a,'criteriaName':_0x39e9d9}),createPendingSegmentId(_0xb728f1);}const _0x31b922=_0x5c6275[_0x3cb88c(0x1da)]?.['id'];if(!_0x31b922)throw new SDKError(ErrorCode[_0x3cb88c(0x176)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x38ef5c=_0x2581bb['get'](_0xb728f1);if(_0x38ef5c)return _0x38ef5c;const _0x46d136=((async()=>{const _0x568c56=_0x3cb88c;_0x264c22(_0xb728f1,_0x360386['rule']);const _0x4923e0=generateDeterministicJourneySegmentName(_0x5c6275[_0x568c56(0x225)]['name'],_0xb728f1),_0x24bdbd=_0x2dff10[_0x568c56(0x1ba)][_0x568c56(0x17f)](_0xdb09ab=>_0xdb09ab[_0x568c56(0x158)]===_0x4923e0),_0x4e97b4=createSegmentIdResolver(_0x2dff10[_0x568c56(0x12d)],_0xb728f1),_0xfb32f6=await resolveRuleSegmentIds(_0x360386[_0x568c56(0x1f2)],_0x4e97b4);let _0x28288e;return _0x24bdbd?(await _0x29e0b3[_0x568c56(0x189)]['updateSegmentById'](_0x4c7e3d['parentId'],_0x24bdbd['id'],{'description':_0x360386[_0x568c56(0x1e1)]||_0x568c56(0x180)+_0xb728f1,'rule':_0xb48b9b(_0xfb32f6,!![]),'countPopulation':!![]}),_0x28288e=_0x24bdbd['id'],saveSegmentToPushRecovery(_0x5c6275[_0x568c56(0x149)],_0x5c6275['yamlConfig']['name'],_0xb728f1,{'segmentId':_0x28288e,'uniqueServerName':_0x4923e0,'createdAt':new Date()[_0x568c56(0x1b5)]()})):_0x28288e=await createOrRecoverEmbeddedSegment(_0x29e0b3,_0x5c6275,{'localName':_0xb728f1,'uniqueSegmentName':_0x4923e0,'description':_0x360386[_0x568c56(0x1e1)]||'Entry\x20criteria:\x20'+_0xb728f1,'journeyId':_0x31b922,'resolvedRule':_0xfb32f6,'parentId':_0x4c7e3d[_0x568c56(0x143)],'folderId':_0x4c7e3d[_0x568c56(0x1ff)]||''},_0xb48b9b),_0x2dff10[_0x568c56(0x12d)][_0x568c56(0x17d)](_0xb728f1,_0x28288e),_0x19d3cd[_0x568c56(0x17d)](_0xb728f1,_0x28288e),_0x28288e;})());_0x2581bb[_0x3cb88c(0x17d)](_0xb728f1,_0x46d136);try{return await _0x46d136;}finally{_0x2581bb[_0x3cb88c(0x223)](_0xb728f1);}},'resolveActivationId':async _0x5e75ad=>{const _0x434693=_0xe6b2a6,_0x2562b8=_0x2633bc[_0x434693(0x175)](_0x5e75ad);if(_0x2562b8)return _0x2562b8;if(_0x5c6275['existingJourney']){await _0xf5e21f();const _0xbec94=_0x2633bc[_0x434693(0x175)](_0x5e75ad);if(_0xbec94)return _0xbec94;}throw new SDKError(ErrorCode['NOT_FOUND'],_0x434693(0x137)+_0x5e75ad+_0x434693(0x20f)+_0x5c6275[_0x434693(0x225)]['name']+').\x20'+_0x434693(0x195));},'resolveEmbeddedActivationId':async(_0x399d8f,_0x1485e8)=>{const _0x4723d4=_0xe6b2a6,_0x5db4ab=_0x2633bc[_0x4723d4(0x175)](_0x399d8f);if(_0x5db4ab)return _0x5db4ab;if(_0x5c6275[_0x4723d4(0x207)])return _0x52552c['set'](_0x399d8f,_0x1485e8),createPendingActivationId(_0x399d8f);if(_0x5c6275[_0x4723d4(0x1da)]){await _0xf5e21f();const _0x1b70d6=_0x2633bc[_0x4723d4(0x175)](_0x1485e8['name']);if(_0x1b70d6)return _0x2633bc[_0x4723d4(0x17d)](_0x399d8f,_0x1b70d6),_0x1b70d6;const _0xb2dd7f=activationSignature(_0x1485e8),_0x342abb=_0x1b715a?.['get'](_0xb2dd7f);if(_0x342abb)return _0x2633bc['set'](_0x399d8f,_0x342abb),_0x342abb;const _0x3621b5=await _0x40a594(_0x1485e8,_0x2dff10[_0x4723d4(0x1a8)]),_0x3d4b41={..._0x3621b5,..._0x1485e8[_0x4723d4(0x1b4)]!==undefined&&{'runAfterJourneyRefresh':_0x1485e8['run_after_journey_refresh']}},_0x32b020=await _0x29e0b3[_0x4723d4(0x190)]['createActivation'](_0x5c6275[_0x4723d4(0x1da)]['id'],_0x3d4b41);return _0x2633bc[_0x4723d4(0x17d)](_0x399d8f,_0x32b020['id']),_0x32b020['id'];}throw new SDKError(ErrorCode[_0x4723d4(0x176)],_0x4723d4(0x14c));},'resolveJourneyId':async _0x1abdd7=>{const _0x3b93ba=_0xe6b2a6;try{return await _0x29e0b3['journey'][_0x3b93ba(0x15d)](_0x4c7e3d[_0x3b93ba(0x143)],_0x1abdd7);}catch(_0x46d9c6){throw new SDKError(ErrorCode[_0x3b93ba(0x168)],_0x3b93ba(0x1c2)+_0x1abdd7+_0x3b93ba(0x1d7)+_0x5c6275[_0x3b93ba(0x225)][_0x3b93ba(0x158)]+'\x27)',_0x46d9c6);}},'resolveStageId':async(_0x206afa,_0x433f6f)=>{const _0x5237b6=_0xe6b2a6,_0x3b2014=await _0x29e0b3[_0x5237b6(0x190)][_0x5237b6(0x1d6)](_0x206afa),_0x90fcec=_0x3b2014[_0x5237b6(0x13c)]['journeyStages'][_0x5237b6(0x17f)](_0x3dd141=>_0x3dd141['name'][_0x5237b6(0x184)]()===_0x433f6f[_0x5237b6(0x184)]());if(!_0x90fcec?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],_0x5237b6(0x21c)+_0x433f6f+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x3b2014[_0x5237b6(0x13c)][_0x5237b6(0x200)]||_0x3b2014['attributes'][_0x5237b6(0x158)])+'\x27');return _0x90fcec['id'];}},_0x32a6ae=await _0x4e02f1(_0x5c6275['yamlConfig'],_0x4c7e3d[_0xe6b2a6(0x143)],_0xe3fe8a),_0x208384=_0x4c7e3d[_0xe6b2a6(0x1e7)]||_0x4c7e3d['rootFolderId'];_0x208384&&(_0x32a6ae[_0xe6b2a6(0x1d9)]={'parentFolder':{'data':{'id':_0x208384,'type':_0xe6b2a6(0x16a)}}});if(_0x5c6275[_0xe6b2a6(0x207)]){if(_0x56b054[_0xe6b2a6(0x1dd)]>0x0||_0x52552c[_0xe6b2a6(0x1dd)]>0x0)return await executeThreeStepJourneyCreate(_0x29e0b3,_0x5c6275,_0x32a6ae,{'pendingEmbeddedSegments':_0x56b054,'pendingEmbeddedActivations':_0x52552c,'embeddedSegmentNameToId':_0x19d3cd,'journeyActivationNameToId':_0x2633bc},{..._0x4c7e3d,'effectiveFolderId':_0x208384},_0x2dff10,_0x364b85,_0x21707b);else{ensureJourneyDefaults(_0x32a6ae[_0xe6b2a6(0x13c)]);const _0x1a5919=await _0x29e0b3['journey'][_0xe6b2a6(0x1c3)](_0x32a6ae);return deletePushRecovery(_0x5c6275[_0xe6b2a6(0x149)]),{'action':_0xe6b2a6(0x1aa),'journeyId':_0x1a5919['id'],'embeddedSegmentNameToId':_0x19d3cd};}}else{if(_0x5c6275[_0xe6b2a6(0x1b7)]&&_0x5c6275['existingJourney'])return ensureJourneyDefaults(_0x32a6ae['attributes']),await _0x29e0b3[_0xe6b2a6(0x190)][_0xe6b2a6(0x1b2)](_0x5c6275[_0xe6b2a6(0x1da)]['id'],_0x32a6ae),deletePushRecovery(_0x5c6275[_0xe6b2a6(0x149)]),{'action':_0xe6b2a6(0x162),'journeyId':_0x5c6275[_0xe6b2a6(0x1da)]['id'],'embeddedSegmentNameToId':_0x19d3cd};}return deletePushRecovery(_0x5c6275['absolutePath']),{'action':_0xe6b2a6(0x215),'journeyId':_0x5c6275[_0xe6b2a6(0x1da)]?.['id'],'embeddedSegmentNameToId':_0x19d3cd};}function findSegmentCriteriaLocation(_0x30e540,_0x5a59e5){const _0x29423c=a114_0x3308e7,_0x3fa38b=_0x30e540[_0x29423c(0x1ef)]||_0x30e540[_0x29423c(0x134)]?.[0x0]?.['stages']||[];let _0x509c97=_0x29423c(0x1a6),_0x10545b=_0x5a59e5;const _0x18661d=_0x30e540[_0x29423c(0x191)]||_0x30e540['journeys']?.[0x0]?.[_0x29423c(0x191)];if(_0x18661d?.['segment']===_0x5a59e5)return{'stageName':_0x29423c(0x191),'criteriaName':_0x18661d['name']||_0x5a59e5};_0x510d28:for(const _0x352838 of _0x3fa38b){if(_0x352838[_0x29423c(0x188)]?.[_0x29423c(0x189)]===_0x5a59e5){_0x509c97=_0x352838[_0x29423c(0x158)],_0x10545b=_0x352838[_0x29423c(0x188)][_0x29423c(0x158)]||_0x5a59e5;break;}if(_0x352838[_0x29423c(0x1d5)])for(const _0x152abe of _0x352838[_0x29423c(0x1d5)]){if(_0x152abe[_0x29423c(0x177)]===_0x29423c(0x15f)&&_0x152abe[_0x29423c(0x185)]?.[_0x29423c(0x1a1)])for(const _0x57118d of _0x152abe[_0x29423c(0x185)][_0x29423c(0x1a1)]){if(_0x57118d[_0x29423c(0x189)]===_0x5a59e5){_0x509c97=_0x352838[_0x29423c(0x158)],_0x10545b=_0x57118d[_0x29423c(0x158)]||_0x5a59e5;break _0x510d28;}}}}return{'stageName':_0x509c97,'criteriaName':_0x10545b};}async function executeThreeStepJourneyCreate(_0x23b85f,_0x605912,_0x34422c,_0x45d735,_0x39aab3,_0xe74f35,_0x4546a2,_0x589abc){const _0x57b50c=a114_0x3308e7,{activationDefToCreateRequest:_0x13ec4f,yamlRuleToApi:_0x3d020f}=_0x589abc,{pendingEmbeddedSegments:_0x18cfa0,pendingEmbeddedActivations:_0x3c6175,embeddedSegmentNameToId:_0x50901f}=_0x45d735,_0x3e6e7f=JSON[_0x57b50c(0x1dc)](JSON[_0x57b50c(0x1d8)](_0x34422c));ensureJourneyDefaults(_0x3e6e7f['attributes']),stripPendingIds(_0x3e6e7f);const _0x2a7ad1=await _0x23b85f[_0x57b50c(0x190)]['create'](_0x3e6e7f),_0x5d60f1=_0x2a7ad1['id'],_0x15a867=new Map();for(const _0x28ed8d of _0x2a7ad1[_0x57b50c(0x13c)]['journeyStages']){_0x15a867[_0x57b50c(0x17d)](_0x28ed8d[_0x57b50c(0x158)][_0x57b50c(0x184)](),_0x28ed8d['id']);}recoverSegmentIdsFromPushRecovery(_0x605912,_0x50901f,_0xe74f35[_0x57b50c(0x12d)]);for(const [_0x62c6c8,{definition:_0x219de0}]of _0x18cfa0){if(_0x50901f[_0x57b50c(0x16c)](_0x62c6c8)){_0x4546a2[_0x57b50c(0x1fb)]?.({'type':_0x57b50c(0x1e8),'journeyName':_0x605912[_0x57b50c(0x225)][_0x57b50c(0x158)],'segmentName':_0x62c6c8});continue;}const _0x3cd601=generateDeterministicJourneySegmentName(_0x605912['yamlConfig'][_0x57b50c(0x158)],_0x62c6c8);_0x4546a2[_0x57b50c(0x1fb)]?.({'type':_0x57b50c(0x19f),'journeyName':_0x605912[_0x57b50c(0x225)]['name'],'segmentName':_0x62c6c8});const _0x2bf679=createSegmentIdResolver(_0xe74f35['segmentNameToId'],_0x62c6c8),_0x58e67e=await resolveRuleSegmentIds(_0x219de0[_0x57b50c(0x1f2)],_0x2bf679),_0x5f32a6=await createOrRecoverEmbeddedSegment(_0x23b85f,_0x605912,{'localName':_0x62c6c8,'uniqueSegmentName':_0x3cd601,'description':_0x219de0['description']||'Entry\x20criteria:\x20'+_0x62c6c8,'journeyId':_0x5d60f1,'resolvedRule':_0x58e67e,'parentId':_0x39aab3[_0x57b50c(0x143)],'folderId':_0x39aab3[_0x57b50c(0x210)]||''},_0x3d020f);_0x50901f['set'](_0x62c6c8,_0x5f32a6),_0xe74f35[_0x57b50c(0x12d)][_0x57b50c(0x17d)](_0x62c6c8,_0x5f32a6),_0x4546a2[_0x57b50c(0x1fb)]?.({'type':_0x57b50c(0x1e8),'journeyName':_0x605912[_0x57b50c(0x225)][_0x57b50c(0x158)],'segmentName':_0x62c6c8});}const _0x11d66f=new Map();for(const [_0x5a0cc0,_0x2b6c6b]of _0x3c6175){_0x4546a2[_0x57b50c(0x1fb)]?.({'type':_0x57b50c(0x201),'journeyName':_0x605912[_0x57b50c(0x225)]['name'],'activationName':_0x5a0cc0});const _0x32ceb3=await _0x13ec4f(_0x2b6c6b,_0xe74f35[_0x57b50c(0x1a8)]),_0x3ba3ca={..._0x32ceb3,..._0x2b6c6b[_0x57b50c(0x1b4)]!==undefined&&{'runAfterJourneyRefresh':_0x2b6c6b[_0x57b50c(0x1b4)]}},_0x20d5e3=await _0x23b85f[_0x57b50c(0x190)][_0x57b50c(0x157)](_0x5d60f1,_0x3ba3ca);_0x11d66f['set'](_0x5a0cc0,_0x20d5e3['id']),_0x45d735[_0x57b50c(0x1ea)][_0x57b50c(0x17d)](_0x5a0cc0,_0x20d5e3['id']),_0x4546a2[_0x57b50c(0x1fb)]?.({'type':_0x57b50c(0x141),'journeyName':_0x605912['yamlConfig'][_0x57b50c(0x158)],'activationName':_0x5a0cc0});}const _0x39bd07=JSON[_0x57b50c(0x1dc)](JSON['stringify'](_0x34422c));return _0x39bd07['id']=_0x5d60f1,ensureJourneyDefaults(_0x39bd07[_0x57b50c(0x13c)]),resolvePendingIdsInRequest(_0x39bd07,_0x34422c,_0x15a867,_0x50901f,_0x11d66f,_0x4546a2),await _0x23b85f['journey'][_0x57b50c(0x1b2)](_0x5d60f1,_0x39bd07),deletePushRecovery(_0x605912[_0x57b50c(0x149)]),{'action':_0x57b50c(0x1aa),'journeyId':_0x5d60f1,'embeddedSegmentNameToId':_0x50901f};}export function stripWaitStepPendingIds(_0x1be0bb){const _0x4cbe20=a114_0x3308e7,_0x240a52=_0x1be0bb[_0x4cbe20(0x153)]&&isPendingSegmentId(_0x1be0bb[_0x4cbe20(0x153)]),_0x25be0a=_0x1be0bb['conditions']?.[_0x4cbe20(0x131)](_0x527aa9=>_0x527aa9['segmentId']&&isPendingSegmentId(_0x527aa9[_0x4cbe20(0x138)]));(_0x240a52||_0x25be0a)&&(_0x1be0bb[_0x4cbe20(0x203)]=_0x4cbe20(0x14b),_0x1be0bb[_0x4cbe20(0x1f6)]=0x1,_0x1be0bb[_0x4cbe20(0x1f0)]=_0x4cbe20(0x19d),delete _0x1be0bb[_0x4cbe20(0x153)],delete _0x1be0bb['conditionTimeoutDuration'],delete _0x1be0bb[_0x4cbe20(0x1c1)],delete _0x1be0bb['conditions']);}export function resolveWaitStepPendingIds(_0x1e2a61,_0x1e6ecb,_0x50b9e4,_0x3cacdf){const _0x2c1e45=a114_0x3308e7;if(_0x1e6ecb[_0x2c1e45(0x153)]&&isPendingSegmentId(_0x1e6ecb[_0x2c1e45(0x153)])){const _0x2e54f1=_0x50b9e4(_0x1e6ecb[_0x2c1e45(0x153)],_0x2c1e45(0x198)+_0x3cacdf+_0x2c1e45(0x1c5));_0x2e54f1&&(_0x1e2a61[_0x2c1e45(0x203)]='Condition',_0x1e2a61[_0x2c1e45(0x153)]=_0x2e54f1,delete _0x1e2a61['waitStep'],delete _0x1e2a61['waitStepUnit'],_0x1e6ecb[_0x2c1e45(0x214)]!==undefined&&(_0x1e2a61['conditionTimeoutDuration']=_0x1e6ecb[_0x2c1e45(0x214)]),_0x1e6ecb[_0x2c1e45(0x1c1)]&&(_0x1e2a61[_0x2c1e45(0x1c1)]=_0x1e6ecb[_0x2c1e45(0x1c1)]));}if(_0x1e6ecb[_0x2c1e45(0x1df)]){const _0x1ff2d0=_0x1e6ecb[_0x2c1e45(0x1df)]['some'](_0x1bf708=>_0x1bf708[_0x2c1e45(0x138)]&&isPendingSegmentId(_0x1bf708[_0x2c1e45(0x138)]));if(_0x1ff2d0){const _0x2d6d23=_0x1e6ecb[_0x2c1e45(0x1df)][_0x2c1e45(0x224)](_0x38f06e=>{const _0x1cf009=_0x2c1e45;if(_0x38f06e[_0x1cf009(0x138)]&&isPendingSegmentId(_0x38f06e[_0x1cf009(0x138)])){const _0x14932b=_0x50b9e4(_0x38f06e[_0x1cf009(0x138)],_0x1cf009(0x198)+_0x3cacdf+_0x1cf009(0x1c5));return{..._0x38f06e,'segmentId':_0x14932b||_0x38f06e['segmentId']};}return{..._0x38f06e};});_0x1e2a61[_0x2c1e45(0x203)]=_0x2c1e45(0x1f1),_0x1e2a61['conditions']=_0x2d6d23,delete _0x1e2a61[_0x2c1e45(0x1f6)],delete _0x1e2a61[_0x2c1e45(0x1f0)],delete _0x1e2a61[_0x2c1e45(0x153)],delete _0x1e2a61['conditionTimeoutDuration'],delete _0x1e2a61[_0x2c1e45(0x1c1)];}}}function stripPendingIds(_0x383881){const _0x21eea2=a114_0x3308e7;_0x383881[_0x21eea2(0x13c)][_0x21eea2(0x191)]?.['segmentId']&&isPendingSegmentId(_0x383881[_0x21eea2(0x13c)][_0x21eea2(0x191)]['segmentId'])&&delete _0x383881['attributes'][_0x21eea2(0x191)];for(const _0x2c7425 of _0x383881[_0x21eea2(0x13c)]['journeyStages']||[]){_0x2c7425['entryCriteria']?.[_0x21eea2(0x138)]&&isPendingSegmentId(_0x2c7425[_0x21eea2(0x213)]['segmentId'])&&delete _0x2c7425[_0x21eea2(0x213)];_0x2c7425[_0x21eea2(0x221)]?.[_0x21eea2(0x138)]&&isPendingSegmentId(_0x2c7425[_0x21eea2(0x221)][_0x21eea2(0x138)])&&delete _0x2c7425[_0x21eea2(0x221)];_0x2c7425[_0x21eea2(0x14d)]&&(_0x2c7425[_0x21eea2(0x14d)]=_0x2c7425['exitCriterias'][_0x21eea2(0x1bd)](_0x5a7887=>!_0x5a7887[_0x21eea2(0x138)]||!isPendingSegmentId(_0x5a7887['segmentId'])));if(_0x2c7425[_0x21eea2(0x1d5)])for(const _0x309b19 of Object[_0x21eea2(0x150)](_0x2c7425[_0x21eea2(0x1d5)])){const _0x3daa84=_0x2c7425['steps'][_0x309b19];_0x3daa84[_0x21eea2(0x177)]==='Activation'&&_0x3daa84[_0x21eea2(0x218)]&&isPendingActivationId(_0x3daa84[_0x21eea2(0x218)])&&(_0x3daa84[_0x21eea2(0x218)]='');if(_0x3daa84['type']===_0x21eea2(0x1f8)&&_0x3daa84[_0x21eea2(0x1a1)])for(const _0x5ab954 of _0x3daa84[_0x21eea2(0x1a1)]){_0x5ab954[_0x21eea2(0x138)]&&isPendingSegmentId(_0x5ab954[_0x21eea2(0x138)])&&(_0x5ab954[_0x21eea2(0x138)]='');}_0x3daa84[_0x21eea2(0x177)]===_0x21eea2(0x21f)&&stripWaitStepPendingIds(_0x3daa84);}}}function resolvePendingIdsInRequest(_0x3bb719,_0x5def8a,_0x1a5121,_0x800411,_0x59b6e9,_0x1f04ae){const _0x39b7a8=a114_0x3308e7,_0x1d1279=(_0xcf11d5,_0x484afa)=>{const _0x482b29=a114_0x3638;if(!isPendingSegmentId(_0xcf11d5))return _0xcf11d5;const _0x558b89=extractPendingSegmentName(_0xcf11d5),_0x326461=_0x800411[_0x482b29(0x175)](_0x558b89);return!_0x326461&&_0x1f04ae['logWarning']?.(_0x482b29(0x151)+_0x558b89+'\x27\x20for\x20'+_0x484afa),_0x326461;};if(_0x3bb719[_0x39b7a8(0x13c)][_0x39b7a8(0x191)]?.[_0x39b7a8(0x138)]&&isPendingSegmentId(_0x3bb719['attributes'][_0x39b7a8(0x191)]['segmentId'])){const _0x4f3916=_0x1d1279(_0x3bb719['attributes']['goal'][_0x39b7a8(0x138)],'goal\x20criteria');_0x4f3916&&(_0x3bb719[_0x39b7a8(0x13c)]['goal']['segmentId']=_0x4f3916);}for(const _0x4a2ad3 of _0x3bb719[_0x39b7a8(0x13c)]['journeyStages']||[]){const _0x351707=_0x1a5121['get'](_0x4a2ad3[_0x39b7a8(0x158)]['toLowerCase']());_0x351707&&(_0x4a2ad3['id']=_0x351707);if(_0x4a2ad3['entryCriteria']?.[_0x39b7a8(0x138)]&&isPendingSegmentId(_0x4a2ad3[_0x39b7a8(0x213)][_0x39b7a8(0x138)])){const _0x5e799a=_0x1d1279(_0x4a2ad3[_0x39b7a8(0x213)][_0x39b7a8(0x138)],'stage\x20\x27'+_0x4a2ad3['name']+_0x39b7a8(0x18c));_0x5e799a&&(_0x4a2ad3[_0x39b7a8(0x213)][_0x39b7a8(0x138)]=_0x5e799a);}if(_0x4a2ad3[_0x39b7a8(0x14d)])for(const _0x44bd39 of _0x4a2ad3[_0x39b7a8(0x14d)]){if(_0x44bd39[_0x39b7a8(0x138)]&&isPendingSegmentId(_0x44bd39[_0x39b7a8(0x138)])){const _0x7d1112=_0x1d1279(_0x44bd39['segmentId'],'stage\x20\x27'+_0x4a2ad3[_0x39b7a8(0x158)]+_0x39b7a8(0x211));_0x7d1112&&(_0x44bd39['segmentId']=_0x7d1112);}}if(_0x4a2ad3['milestone']?.[_0x39b7a8(0x138)]&&isPendingSegmentId(_0x4a2ad3['milestone']['segmentId'])){const _0x494d65=_0x1d1279(_0x4a2ad3[_0x39b7a8(0x221)][_0x39b7a8(0x138)],_0x39b7a8(0x198)+_0x4a2ad3[_0x39b7a8(0x158)]+_0x39b7a8(0x1e3));_0x494d65&&(_0x4a2ad3[_0x39b7a8(0x221)][_0x39b7a8(0x138)]=_0x494d65);}if(_0x4a2ad3[_0x39b7a8(0x1d5)]){const _0x58165e=_0x5c2b6b=>_0x5def8a[_0x39b7a8(0x13c)]['journeyStages']?.[_0x39b7a8(0x17f)](_0x6644cd=>_0x6644cd[_0x39b7a8(0x158)][_0x39b7a8(0x184)]()===_0x4a2ad3[_0x39b7a8(0x158)]['toLowerCase']())?.[_0x39b7a8(0x1d5)]?.[_0x5c2b6b];for(const _0x212561 of Object[_0x39b7a8(0x150)](_0x4a2ad3[_0x39b7a8(0x1d5)])){const _0x24b91f=_0x4a2ad3['steps'][_0x212561],_0x2b0b0f=_0x58165e(_0x212561);if(_0x24b91f[_0x39b7a8(0x177)]===_0x39b7a8(0x169)&&_0x24b91f[_0x39b7a8(0x218)]&&(isPendingActivationId(_0x24b91f[_0x39b7a8(0x218)])||_0x24b91f['journeyActivationStepId']==='')){if(_0x2b0b0f?.[_0x39b7a8(0x218)]&&isPendingActivationId(_0x2b0b0f[_0x39b7a8(0x218)])){const _0x52fc86=extractPendingActivationName(_0x2b0b0f[_0x39b7a8(0x218)]),_0x113d2c=_0x59b6e9[_0x39b7a8(0x175)](_0x52fc86);_0x113d2c&&(_0x24b91f[_0x39b7a8(0x218)]=_0x113d2c);}}if(_0x24b91f[_0x39b7a8(0x177)]===_0x39b7a8(0x1f8)&&_0x24b91f[_0x39b7a8(0x1a1)]&&_0x2b0b0f?.[_0x39b7a8(0x1a1)])for(let _0x1333c8=0x0;_0x1333c8<_0x24b91f['branches'][_0x39b7a8(0x1c9)];_0x1333c8++){const _0x4016e0=_0x24b91f[_0x39b7a8(0x1a1)][_0x1333c8],_0x40ae74=_0x2b0b0f[_0x39b7a8(0x1a1)][_0x1333c8];if(_0x40ae74?.[_0x39b7a8(0x138)]&&isPendingSegmentId(_0x40ae74[_0x39b7a8(0x138)])){const _0x397c67=_0x1d1279(_0x40ae74[_0x39b7a8(0x138)],_0x39b7a8(0x198)+_0x4a2ad3[_0x39b7a8(0x158)]+_0x39b7a8(0x1f7)+(_0x4016e0[_0x39b7a8(0x158)]||_0x1333c8)+'\x27');_0x397c67&&(_0x4016e0[_0x39b7a8(0x138)]=_0x397c67);}}_0x24b91f[_0x39b7a8(0x177)]===_0x39b7a8(0x21f)&&_0x2b0b0f?.[_0x39b7a8(0x177)]===_0x39b7a8(0x21f)&&resolveWaitStepPendingIds(_0x24b91f,_0x2b0b0f,_0x1d1279,_0x4a2ad3['name']);}}}}
@@ -1 +1 @@
1
- (function(_0x511c05,_0x29dd9d){const _0x599844=a115_0x1215,_0x902d0=_0x511c05();while(!![]){try{const _0x3ac24f=-parseInt(_0x599844(0x7f))/0x1*(parseInt(_0x599844(0x7e))/0x2)+-parseInt(_0x599844(0x77))/0x3+-parseInt(_0x599844(0x7c))/0x4*(parseInt(_0x599844(0x7d))/0x5)+-parseInt(_0x599844(0x78))/0x6+-parseInt(_0x599844(0x73))/0x7*(-parseInt(_0x599844(0x80))/0x8)+-parseInt(_0x599844(0x82))/0x9+parseInt(_0x599844(0x81))/0xa*(parseInt(_0x599844(0x74))/0xb);if(_0x3ac24f===_0x29dd9d)break;else _0x902d0['push'](_0x902d0['shift']());}catch(_0x4fa887){_0x902d0['push'](_0x902d0['shift']());}}}(a115_0x5531,0x3d8f8));export function buildFolderIdToPathMap(_0x235a2c){const _0x440ee6=a115_0x1215,_0x36ea63=new Map(),_0x5259cd=new Map();for(const _0x58795a of _0x235a2c){_0x5259cd[_0x440ee6(0x7a)](_0x58795a['id'],_0x58795a);}const _0x2b4ec9=new Set();for(const _0x238c36 of _0x235a2c){!_0x238c36[_0x440ee6(0x83)]&&_0x2b4ec9[_0x440ee6(0x76)](_0x238c36['id']);}function _0x5d83ef(_0x1eda53){const _0x42b959=_0x440ee6;if(_0x36ea63[_0x42b959(0x75)](_0x1eda53['id']))return _0x36ea63[_0x42b959(0x7b)](_0x1eda53['id']);if(_0x2b4ec9[_0x42b959(0x75)](_0x1eda53['id']))return _0x36ea63[_0x42b959(0x7a)](_0x1eda53['id'],''),'';if(_0x1eda53[_0x42b959(0x83)]){const _0x30d199=_0x5259cd[_0x42b959(0x7b)](_0x1eda53[_0x42b959(0x83)]);if(_0x30d199){const _0xeea89=_0x5d83ef(_0x30d199),_0x492398=_0xeea89?_0xeea89+'/'+_0x1eda53[_0x42b959(0x79)]:_0x1eda53['name'];return _0x36ea63[_0x42b959(0x7a)](_0x1eda53['id'],_0x492398),_0x492398;}}const _0x2a61c7=_0x1eda53['name'];return _0x36ea63['set'](_0x1eda53['id'],_0x2a61c7),_0x2a61c7;}for(const _0x3130ae of _0x235a2c){_0x5d83ef(_0x3130ae);}return _0x36ea63;}function a115_0x1215(_0x310c94,_0x1e289c){_0x310c94=_0x310c94-0x73;const _0x5531b2=a115_0x5531();let _0x121533=_0x5531b2[_0x310c94];return _0x121533;}export function buildFolderPathToIdMap(_0x2691c3){const _0x148964=a115_0x1215,_0xbfad3b=new Map(),_0x3f0dd8=new Map();for(const _0x8a8510 of _0x2691c3){_0x3f0dd8['set'](_0x8a8510['id'],_0x8a8510);}const _0x449695=new Set();for(const _0x54b382 of _0x2691c3){!_0x54b382[_0x148964(0x83)]&&_0x449695[_0x148964(0x76)](_0x54b382['id']);}function _0x56b09d(_0x22e949){const _0x4145fa=_0x148964;if(_0x449695['has'](_0x22e949['id']))return'';if(_0x22e949[_0x4145fa(0x83)]){const _0x468d6a=_0x3f0dd8[_0x4145fa(0x7b)](_0x22e949[_0x4145fa(0x83)]);if(_0x468d6a){const _0xf4502d=_0x56b09d(_0x468d6a);return _0xf4502d?_0xf4502d+'/'+_0x22e949[_0x4145fa(0x79)]:_0x22e949[_0x4145fa(0x79)];}}return _0x22e949[_0x4145fa(0x79)];}for(const _0x3b5f40 of _0x2691c3){const _0x3c716d=_0x56b09d(_0x3b5f40);_0xbfad3b['set'](_0x3c716d,_0x3b5f40['id']);}return _0xbfad3b;}function a115_0x5531(){const _0x3a36fe=['2aPbfsc','60981FbnGsn','1856gkwNyQ','5723130NCExBJ','757044yGuTgz','parentFolderId','9884htafWQ','11iTueaG','has','add','868254IdTeUa','830454RpZSSp','name','set','get','4kDbvbr','374105jxRSdl'];a115_0x5531=function(){return _0x3a36fe;};return a115_0x5531();}export function buildFolderMaps(_0x491f47){const _0x200dd9=buildFolderIdToPathMap(_0x491f47),_0x18945c=new Map();for(const [_0x12a15a,_0x52a57d]of _0x200dd9){_0x18945c['set'](_0x52a57d,_0x12a15a);}return{'idToPath':_0x200dd9,'pathToId':_0x18945c};}export function getFolderPath(_0x93c491,_0x32ef90){const _0x3a81b7=a115_0x1215;if(!_0x93c491)return'';return _0x32ef90[_0x3a81b7(0x7b)](_0x93c491)??'';}
1
+ function a115_0x13b2(_0x259028,_0x4329b4){_0x259028=_0x259028-0x19e;const _0x48200a=a115_0x4820();let _0x13b209=_0x48200a[_0x259028];return _0x13b209;}(function(_0x165d7e,_0x172839){const _0x19cbc9=a115_0x13b2,_0x1a1e7a=_0x165d7e();while(!![]){try{const _0x2f0e75=parseInt(_0x19cbc9(0x1a4))/0x1*(parseInt(_0x19cbc9(0x1a3))/0x2)+-parseInt(_0x19cbc9(0x19f))/0x3+parseInt(_0x19cbc9(0x1a1))/0x4*(-parseInt(_0x19cbc9(0x1a0))/0x5)+parseInt(_0x19cbc9(0x1a5))/0x6+-parseInt(_0x19cbc9(0x1ae))/0x7*(-parseInt(_0x19cbc9(0x19e))/0x8)+-parseInt(_0x19cbc9(0x1ad))/0x9*(parseInt(_0x19cbc9(0x1a9))/0xa)+-parseInt(_0x19cbc9(0x1a8))/0xb;if(_0x2f0e75===_0x172839)break;else _0x1a1e7a['push'](_0x1a1e7a['shift']());}catch(_0x134187){_0x1a1e7a['push'](_0x1a1e7a['shift']());}}}(a115_0x4820,0xdea9c));export function buildFolderIdToPathMap(_0x7d4eef){const _0x58360f=a115_0x13b2,_0x16ac8d=new Map(),_0x1195b5=new Map();for(const _0x1af984 of _0x7d4eef){_0x1195b5[_0x58360f(0x1a6)](_0x1af984['id'],_0x1af984);}const _0x7e5864=new Set();for(const _0x1feb9a of _0x7d4eef){!_0x1feb9a['parentFolderId']&&_0x7e5864[_0x58360f(0x1ac)](_0x1feb9a['id']);}function _0x3c49ad(_0x1f55f8){const _0x19d50e=_0x58360f;if(_0x16ac8d[_0x19d50e(0x1aa)](_0x1f55f8['id']))return _0x16ac8d[_0x19d50e(0x1ab)](_0x1f55f8['id']);if(_0x7e5864['has'](_0x1f55f8['id']))return _0x16ac8d['set'](_0x1f55f8['id'],''),'';if(_0x1f55f8[_0x19d50e(0x1a7)]){const _0x37dc3b=_0x1195b5[_0x19d50e(0x1ab)](_0x1f55f8['parentFolderId']);if(_0x37dc3b){const _0x1e7903=_0x3c49ad(_0x37dc3b),_0xc10f44=_0x1e7903?_0x1e7903+'/'+_0x1f55f8[_0x19d50e(0x1a2)]:_0x1f55f8[_0x19d50e(0x1a2)];return _0x16ac8d[_0x19d50e(0x1a6)](_0x1f55f8['id'],_0xc10f44),_0xc10f44;}}const _0xed710a=_0x1f55f8[_0x19d50e(0x1a2)];return _0x16ac8d[_0x19d50e(0x1a6)](_0x1f55f8['id'],_0xed710a),_0xed710a;}for(const _0x38da49 of _0x7d4eef){_0x3c49ad(_0x38da49);}return _0x16ac8d;}export function buildFolderPathToIdMap(_0x5d3df0){const _0x2ff449=a115_0x13b2,_0x1c3e5b=new Map(),_0x15afbe=new Map();for(const _0x224cd5 of _0x5d3df0){_0x15afbe[_0x2ff449(0x1a6)](_0x224cd5['id'],_0x224cd5);}const _0x38fa9f=new Set();for(const _0x73b48b of _0x5d3df0){!_0x73b48b[_0x2ff449(0x1a7)]&&_0x38fa9f[_0x2ff449(0x1ac)](_0x73b48b['id']);}function _0x359e20(_0x1b785b){const _0x14832e=_0x2ff449;if(_0x38fa9f[_0x14832e(0x1aa)](_0x1b785b['id']))return'';if(_0x1b785b['parentFolderId']){const _0x272a6e=_0x15afbe[_0x14832e(0x1ab)](_0x1b785b[_0x14832e(0x1a7)]);if(_0x272a6e){const _0x4312f4=_0x359e20(_0x272a6e);return _0x4312f4?_0x4312f4+'/'+_0x1b785b[_0x14832e(0x1a2)]:_0x1b785b['name'];}}return _0x1b785b[_0x14832e(0x1a2)];}for(const _0x491b48 of _0x5d3df0){const _0x4ec778=_0x359e20(_0x491b48);_0x1c3e5b[_0x2ff449(0x1a6)](_0x4ec778,_0x491b48['id']);}return _0x1c3e5b;}function a115_0x4820(){const _0x2f5b41=['63zkUJYH','343QmuBzl','274048NrcpsT','2528820ybWzHW','4035QMoyCD','5052RSkeCG','name','286690cQhmNk','9zYdxfF','10662606mNxGsL','set','parentFolderId','21174285DWChqg','66580raacMM','has','get','add'];a115_0x4820=function(){return _0x2f5b41;};return a115_0x4820();}export function buildFolderMaps(_0x489d86){const _0x41a532=a115_0x13b2,_0x289ab5=buildFolderIdToPathMap(_0x489d86),_0x53aa06=new Map();for(const [_0x1f7129,_0x5a9339]of _0x289ab5){_0x53aa06[_0x41a532(0x1a6)](_0x5a9339,_0x1f7129);}return{'idToPath':_0x289ab5,'pathToId':_0x53aa06};}export function getFolderPath(_0x46b8a4,_0x3eec6d){if(!_0x46b8a4)return'';return _0x3eec6d['get'](_0x46b8a4)??'';}
@@ -1 +1 @@
1
- (function(_0x263ed1,_0x5f49df){const _0x36a3d6=a116_0x71ea,_0x3d5db0=_0x263ed1();while(!![]){try{const _0x44ca46=-parseInt(_0x36a3d6(0x105))/0x1*(parseInt(_0x36a3d6(0xe7))/0x2)+-parseInt(_0x36a3d6(0xf3))/0x3*(-parseInt(_0x36a3d6(0xef))/0x4)+-parseInt(_0x36a3d6(0x103))/0x5*(-parseInt(_0x36a3d6(0x10c))/0x6)+-parseInt(_0x36a3d6(0xe9))/0x7+-parseInt(_0x36a3d6(0xf5))/0x8+-parseInt(_0x36a3d6(0x104))/0x9+parseInt(_0x36a3d6(0xf6))/0xa;if(_0x44ca46===_0x5f49df)break;else _0x3d5db0['push'](_0x3d5db0['shift']());}catch(_0x147cb3){_0x3d5db0['push'](_0x3d5db0['shift']());}}}(a116_0x4c42,0x24f35));import a116_0x52b5d9 from'path';import{parse as a116_0x3f597b}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x463986){const _0x377d2f=a116_0x71ea;if(!_0x463986||_0x463986[_0x377d2f(0x102)]()==='')throw new Error(_0x377d2f(0x108));const _0x50128a=_0x463986['trim']();if(_0x50128a==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x463986};const _0x45c663=_0x50128a[_0x377d2f(0xfc)]('/')?_0x50128a[_0x377d2f(0xf2)](0x1):_0x50128a,_0x1d8d87=_0x45c663[_0x377d2f(0x109)]('/')[_0x377d2f(0xe8)](_0x395420=>_0x395420!=='');if(_0x1d8d87[_0x377d2f(0xe6)]===0x0)throw new Error(_0x377d2f(0x106));const _0x4102f6=_0x50128a[_0x377d2f(0xfc)]('/')||!isRelativePathSegment(_0x1d8d87[0x0]);for(const _0x1338a0 of _0x1d8d87){validatePathSegment(_0x1338a0);}return{'segments':_0x1d8d87,'isAbsolute':_0x4102f6,'raw':_0x463986};}function a116_0x71ea(_0x26076a,_0x5234f7){_0x26076a=_0x26076a-0xe2;const _0x4c4231=a116_0x4c42();let _0x71ea22=_0x4c4231[_0x26076a];return _0x71ea22;}function isRelativePathSegment(_0x50d71c){return _0x50d71c==='.'||_0x50d71c==='..';}function validatePathSegment(_0x54a0be){const _0x485c9f=a116_0x71ea;if(_0x54a0be==='')throw new Error('Path\x20segment\x20cannot\x20be\x20empty');if(_0x54a0be==='.'||_0x54a0be==='..')return;if(/[\x00-\x1F\x7F]/[_0x485c9f(0x101)](_0x54a0be))throw new Error(_0x485c9f(0xf9)+_0x54a0be);if(_0x54a0be!==_0x54a0be['trim']()){}}export function validatePath(_0x4058d5){const _0x333b13=a116_0x71ea;if(_0x4058d5[_0x333b13(0x10a)]['length']===0x0&&!_0x4058d5[_0x333b13(0xf7)])throw new Error(_0x333b13(0xe3));if(_0x4058d5[_0x333b13(0xf7)]){if(_0x4058d5[_0x333b13(0x10a)][0x0]==='..')throw new Error('Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22');let _0x42ef2a=0x0;for(const _0x2dffe1 of _0x4058d5[_0x333b13(0x10a)]){if(_0x2dffe1==='..'){if(_0x42ef2a===0x0)throw new Error(_0x333b13(0xee));_0x42ef2a--;}else _0x2dffe1!=='.'&&_0x42ef2a++;}}}export function joinPaths(_0x21c78a,_0x40ad65){const _0x7b3570=a116_0x71ea;if(!_0x21c78a||_0x21c78a==='/')return _0x40ad65;if(!_0x40ad65||_0x40ad65==='.')return _0x21c78a;if(_0x40ad65[_0x7b3570(0xfc)]('/'))return _0x40ad65;const _0x478976=parsePath(_0x21c78a),_0x34d8d5=parsePath(_0x40ad65),_0x2a768a=[..._0x478976['segments']];for(const _0x3c49ac of _0x34d8d5[_0x7b3570(0x10a)]){if(_0x3c49ac==='.')continue;else{if(_0x3c49ac==='..'){if(_0x2a768a[_0x7b3570(0xe6)]===0x0)throw new Error('Cannot\x20navigate\x20above\x20root');_0x2a768a['pop']();}else _0x2a768a[_0x7b3570(0xec)](_0x3c49ac);}}const _0x2e3d7c=_0x2a768a[_0x7b3570(0xfe)]('/');return _0x478976[_0x7b3570(0xf0)][_0x7b3570(0xfc)]('/')?'/'+_0x2e3d7c:_0x2e3d7c;}export function normalizePath(_0x3895d6){const _0x343589=a116_0x71ea,_0x4b9219=parsePath(_0x3895d6),_0x5c4f7a=[];for(const _0x3d4aa0 of _0x4b9219[_0x343589(0x10a)]){if(_0x3d4aa0==='.')continue;else{if(_0x3d4aa0==='..'){if(_0x5c4f7a[_0x343589(0xe6)]===0x0){if(_0x4b9219[_0x343589(0xf7)])throw new Error(_0x343589(0xeb));_0x5c4f7a[_0x343589(0xec)]('..');}else _0x5c4f7a[_0x5c4f7a[_0x343589(0xe6)]-0x1]==='..'?_0x5c4f7a[_0x343589(0xec)]('..'):_0x5c4f7a[_0x343589(0xff)]();}else _0x5c4f7a[_0x343589(0xec)](_0x3d4aa0);}}if(_0x5c4f7a[_0x343589(0xe6)]===0x0)return _0x4b9219[_0x343589(0xf7)]?'/':'.';const _0x533110=_0x5c4f7a[_0x343589(0xfe)]('/');return _0x4b9219[_0x343589(0xf0)]['startsWith']('/')?'/'+_0x533110:_0x533110;}export function getParentPath(_0x189dc0){const _0x21ea04=a116_0x71ea,_0x470c4e=parsePath(_0x189dc0);if(_0x470c4e[_0x21ea04(0x10a)][_0x21ea04(0xe6)]<=0x1)return'/';const _0x2f3556=_0x470c4e[_0x21ea04(0x10a)][_0x21ea04(0x10b)](0x0,-0x1)[_0x21ea04(0xfe)]('/');return _0x470c4e[_0x21ea04(0xf0)][_0x21ea04(0xfc)]('/')?'/'+_0x2f3556:_0x2f3556;}export function getBaseName(_0x1f436f){const _0x3a0310=a116_0x71ea,_0x2f456d=parsePath(_0x1f436f);return _0x2f456d['segments'][_0x2f456d[_0x3a0310(0x10a)]['length']-0x1]||'';}export function isChildPath(_0x5a4dc1,_0x4a3f9b){const _0x496023=a116_0x71ea,_0x3e0a32=parsePath(_0x5a4dc1),_0x1794c4=parsePath(_0x4a3f9b);if(_0x3e0a32[_0x496023(0x10a)]['length']<=_0x1794c4['segments'][_0x496023(0xe6)])return![];for(let _0x2ebce8=0x0;_0x2ebce8<_0x1794c4[_0x496023(0x10a)][_0x496023(0xe6)];_0x2ebce8++){if(_0x3e0a32['segments'][_0x2ebce8]!==_0x1794c4['segments'][_0x2ebce8])return![];}return!![];}export function splitPath(_0x48c44a){const _0x3563ac=a116_0x71ea,_0x2590da=parsePath(_0x48c44a);if(_0x2590da[_0x3563ac(0x10a)][_0x3563ac(0xe6)]===0x0)throw new Error('Cannot\x20split\x20empty\x20path');if(_0x2590da['segments']['length']===0x1)return{'parent':_0x2590da[_0x3563ac(0x10a)][0x0]};return{'parent':_0x2590da[_0x3563ac(0x10a)][0x0],'child':_0x2590da['segments'][_0x3563ac(0x10b)](0x1)[_0x3563ac(0xfe)]('/')};}export function isYamlFilePath(_0x15e551){const _0x3e7c45=a116_0x71ea;return _0x15e551[_0x3e7c45(0x100)]('.yml')||_0x15e551[_0x3e7c45(0x100)](_0x3e7c45(0x107));}export async function resolveYamlFilePath(_0x36fb04,_0x3ceddc=nodeFileSystem){const _0xb4360f=a116_0x71ea,_0x139ade=a116_0x52b5d9[_0xb4360f(0xe4)](_0x36fb04);if(!await _0x3ceddc[_0xb4360f(0xf8)](_0x139ade))throw new Error(_0xb4360f(0xf4)+_0x36fb04);let _0x2553c7=a116_0x52b5d9[_0xb4360f(0xe5)](_0x139ade),_0x23d576=null,_0x4f355b=null;const _0x3cc19e=a116_0x52b5d9[_0xb4360f(0xea)](_0x2553c7)[_0xb4360f(0x10f)];while(_0x2553c7!==_0x3cc19e){const _0x1d25cd=a116_0x52b5d9[_0xb4360f(0xfe)](_0x2553c7,_0xb4360f(0x10d));if(await _0x3ceddc['exists'](_0x1d25cd)){_0x23d576=_0x1d25cd,_0x4f355b=_0x2553c7;break;}_0x2553c7=a116_0x52b5d9[_0xb4360f(0xe5)](_0x2553c7);}if(!_0x23d576||!_0x4f355b)throw new Error(_0xb4360f(0xe2)+_0x36fb04);const _0x1ccb24=await _0x3ceddc[_0xb4360f(0xed)](_0x23d576),_0x1c0d03=JSON[_0xb4360f(0xea)](_0x1ccb24),_0x30838d=_0x1c0d03[_0xb4360f(0x10e)];if(!_0x30838d)throw new Error(_0xb4360f(0xf1));const _0x37c0a6=await _0x3ceddc[_0xb4360f(0xed)](_0x139ade),_0x5c0db2=a116_0x3f597b(_0x37c0a6),_0x41a475=_0x5c0db2['name'];if(!_0x41a475)throw new Error(_0xb4360f(0xfa)+_0x36fb04);const _0x144a47=_0x5c0db2['type']===_0xb4360f(0xfd)?'journey':'segment',_0xe9eb03=a116_0x52b5d9['relative'](_0x4f355b,_0x139ade),_0x1192d5=a116_0x52b5d9['dirname'](_0xe9eb03),_0x5e8fcc=_0x1192d5==='.'?'':_0x1192d5[_0xb4360f(0xfb)](/\\/g,'/'),_0xbeb587=_0x5e8fcc?_0x30838d+'/'+_0x5e8fcc+'/'+_0x41a475:_0x30838d+'/'+_0x41a475;return{'parentSegment':_0x30838d,'segmentName':_0x41a475,'folderPath':_0x5e8fcc,'fullPath':_0xbeb587,'resourceType':_0x144a47};}function a116_0x4c42(){const _0x537f47=['isAbsolute','exists','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','replace','startsWith','journey','join','pop','endsWith','test','trim','66965zuJSVt','1513116acZXOC','6nyudVs','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','.yaml','Path\x20cannot\x20be\x20empty','split','segments','slice','48AydbCB','tdx.json','parent_segment','root','No\x20tdx.json\x20found\x20for\x20file:\x20','Relative\x20path\x20cannot\x20be\x20empty','resolve','dirname','length','65944zAiqRq','filter','1068319oBlpZN','parse','Cannot\x20navigate\x20above\x20root','push','readFile','Path\x20attempts\x20to\x20navigate\x20above\x20root','865376ZZweWV','raw','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','substring','3OgqjOJ','File\x20not\x20found:\x20','1934880ecfZKp','5882940HtXFSb'];a116_0x4c42=function(){return _0x537f47;};return a116_0x4c42();}
1
+ (function(_0x2a19b5,_0x546ee5){const _0x818ed6=a116_0x21c6,_0x125a41=_0x2a19b5();while(!![]){try{const _0x162f01=parseInt(_0x818ed6(0x204))/0x1*(-parseInt(_0x818ed6(0x1ff))/0x2)+parseInt(_0x818ed6(0x1ea))/0x3+parseInt(_0x818ed6(0x1f2))/0x4+-parseInt(_0x818ed6(0x1e5))/0x5*(-parseInt(_0x818ed6(0x1e4))/0x6)+parseInt(_0x818ed6(0x1ed))/0x7*(-parseInt(_0x818ed6(0x1de))/0x8)+-parseInt(_0x818ed6(0x1ee))/0x9*(parseInt(_0x818ed6(0x1dc))/0xa)+parseInt(_0x818ed6(0x203))/0xb*(parseInt(_0x818ed6(0x1f5))/0xc);if(_0x162f01===_0x546ee5)break;else _0x125a41['push'](_0x125a41['shift']());}catch(_0x512262){_0x125a41['push'](_0x125a41['shift']());}}}(a116_0x31e8,0xb8edb));import a116_0x383329 from'path';function a116_0x21c6(_0x25cd9d,_0x55367f){_0x25cd9d=_0x25cd9d-0x1d6;const _0x31e82c=a116_0x31e8();let _0x21c615=_0x31e82c[_0x25cd9d];return _0x21c615;}import{parse as a116_0x4ce121}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';function a116_0x31e8(){const _0x35f875=['resolve','9759505DeODgf','45mpJzjc','.yml','name','No\x20tdx.json\x20found\x20for\x20file:\x20','425944BdJURw','readFile','startsWith','3936552XlwQsQ','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','Cannot\x20split\x20empty\x20path','File\x20not\x20found:\x20','parse','test','segments','exists','join','endsWith','49718BqqkUx','Path\x20segment\x20cannot\x20be\x20empty','.yaml','Cannot\x20navigate\x20above\x20root','77ZIOsNH','41CFktyC','length','parent_segment','replace','isAbsolute','journey','slice','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','1419990tfUuWq','Relative\x20path\x20cannot\x20be\x20empty','8RaBVfo','push','trim','dirname','pop','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','883332ENNbev','5CDqQzw','filter','Path\x20cannot\x20be\x20empty','raw','split','3992598UPveZq','relative'];a116_0x31e8=function(){return _0x35f875;};return a116_0x31e8();}export function parsePath(_0x25adc8){const _0xb7a358=a116_0x21c6;if(!_0x25adc8||_0x25adc8['trim']()==='')throw new Error(_0xb7a358(0x1e7));const _0x39718d=_0x25adc8['trim']();if(_0x39718d==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x25adc8};const _0x726618=_0x39718d[_0xb7a358(0x1f4)]('/')?_0x39718d['substring'](0x1):_0x39718d,_0x19772e=_0x726618[_0xb7a358(0x1e9)]('/')[_0xb7a358(0x1e6)](_0x26b962=>_0x26b962!=='');if(_0x19772e[_0xb7a358(0x205)]===0x0)throw new Error(_0xb7a358(0x1db));const _0x1f6bcb=_0x39718d[_0xb7a358(0x1f4)]('/')||!isRelativePathSegment(_0x19772e[0x0]);for(const _0x5d42b5 of _0x19772e){validatePathSegment(_0x5d42b5);}return{'segments':_0x19772e,'isAbsolute':_0x1f6bcb,'raw':_0x25adc8};}function isRelativePathSegment(_0x2b8fb6){return _0x2b8fb6==='.'||_0x2b8fb6==='..';}function validatePathSegment(_0x23c082){const _0x39597b=a116_0x21c6;if(_0x23c082==='')throw new Error(_0x39597b(0x200));if(_0x23c082==='.'||_0x23c082==='..')return;if(/[\x00-\x1F\x7F]/[_0x39597b(0x1fa)](_0x23c082))throw new Error('Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20'+_0x23c082);if(_0x23c082!==_0x23c082[_0x39597b(0x1e0)]()){}}export function validatePath(_0x5ba4cb){const _0x1b3fed=a116_0x21c6;if(_0x5ba4cb['segments']['length']===0x0&&!_0x5ba4cb[_0x1b3fed(0x1d8)])throw new Error(_0x1b3fed(0x1dd));if(_0x5ba4cb[_0x1b3fed(0x1d8)]){if(_0x5ba4cb[_0x1b3fed(0x1fb)][0x0]==='..')throw new Error(_0x1b3fed(0x1f6));let _0x4baaa8=0x0;for(const _0x41dba4 of _0x5ba4cb[_0x1b3fed(0x1fb)]){if(_0x41dba4==='..'){if(_0x4baaa8===0x0)throw new Error('Path\x20attempts\x20to\x20navigate\x20above\x20root');_0x4baaa8--;}else _0x41dba4!=='.'&&_0x4baaa8++;}}}export function joinPaths(_0x2137b1,_0x4fc8e7){const _0x505424=a116_0x21c6;if(!_0x2137b1||_0x2137b1==='/')return _0x4fc8e7;if(!_0x4fc8e7||_0x4fc8e7==='.')return _0x2137b1;if(_0x4fc8e7['startsWith']('/'))return _0x4fc8e7;const _0x5f3860=parsePath(_0x2137b1),_0x48f52b=parsePath(_0x4fc8e7),_0x249478=[..._0x5f3860['segments']];for(const _0x10edb7 of _0x48f52b[_0x505424(0x1fb)]){if(_0x10edb7==='.')continue;else{if(_0x10edb7==='..'){if(_0x249478['length']===0x0)throw new Error(_0x505424(0x202));_0x249478[_0x505424(0x1e2)]();}else _0x249478[_0x505424(0x1df)](_0x10edb7);}}const _0x5afc27=_0x249478[_0x505424(0x1fd)]('/');return _0x5f3860[_0x505424(0x1e8)][_0x505424(0x1f4)]('/')?'/'+_0x5afc27:_0x5afc27;}export function normalizePath(_0x1ed6dd){const _0x3d137c=a116_0x21c6,_0x5d9add=parsePath(_0x1ed6dd),_0x54e7c8=[];for(const _0x2a1201 of _0x5d9add['segments']){if(_0x2a1201==='.')continue;else{if(_0x2a1201==='..'){if(_0x54e7c8[_0x3d137c(0x205)]===0x0){if(_0x5d9add['isAbsolute'])throw new Error(_0x3d137c(0x202));_0x54e7c8[_0x3d137c(0x1df)]('..');}else _0x54e7c8[_0x54e7c8[_0x3d137c(0x205)]-0x1]==='..'?_0x54e7c8[_0x3d137c(0x1df)]('..'):_0x54e7c8[_0x3d137c(0x1e2)]();}else _0x54e7c8[_0x3d137c(0x1df)](_0x2a1201);}}if(_0x54e7c8['length']===0x0)return _0x5d9add['isAbsolute']?'/':'.';const _0x560126=_0x54e7c8[_0x3d137c(0x1fd)]('/');return _0x5d9add['raw']['startsWith']('/')?'/'+_0x560126:_0x560126;}export function getParentPath(_0x3d3785){const _0x5a25a1=a116_0x21c6,_0x1938ff=parsePath(_0x3d3785);if(_0x1938ff['segments'][_0x5a25a1(0x205)]<=0x1)return'/';const _0xbb83da=_0x1938ff[_0x5a25a1(0x1fb)][_0x5a25a1(0x1da)](0x0,-0x1)[_0x5a25a1(0x1fd)]('/');return _0x1938ff[_0x5a25a1(0x1e8)][_0x5a25a1(0x1f4)]('/')?'/'+_0xbb83da:_0xbb83da;}export function getBaseName(_0x2f8508){const _0x161a11=a116_0x21c6,_0x32fc6d=parsePath(_0x2f8508);return _0x32fc6d['segments'][_0x32fc6d[_0x161a11(0x1fb)][_0x161a11(0x205)]-0x1]||'';}export function isChildPath(_0x17769e,_0xee6448){const _0x3e7693=a116_0x21c6,_0x292919=parsePath(_0x17769e),_0x4bbc52=parsePath(_0xee6448);if(_0x292919['segments'][_0x3e7693(0x205)]<=_0x4bbc52['segments']['length'])return![];for(let _0x591694=0x0;_0x591694<_0x4bbc52[_0x3e7693(0x1fb)]['length'];_0x591694++){if(_0x292919[_0x3e7693(0x1fb)][_0x591694]!==_0x4bbc52['segments'][_0x591694])return![];}return!![];}export function splitPath(_0x288d24){const _0x3a698d=a116_0x21c6,_0x790f5c=parsePath(_0x288d24);if(_0x790f5c['segments'][_0x3a698d(0x205)]===0x0)throw new Error(_0x3a698d(0x1f7));if(_0x790f5c[_0x3a698d(0x1fb)]['length']===0x1)return{'parent':_0x790f5c[_0x3a698d(0x1fb)][0x0]};return{'parent':_0x790f5c[_0x3a698d(0x1fb)][0x0],'child':_0x790f5c[_0x3a698d(0x1fb)][_0x3a698d(0x1da)](0x1)['join']('/')};}export function isYamlFilePath(_0x5173bb){const _0x55cc62=a116_0x21c6;return _0x5173bb[_0x55cc62(0x1fe)](_0x55cc62(0x1ef))||_0x5173bb[_0x55cc62(0x1fe)](_0x55cc62(0x201));}export async function resolveYamlFilePath(_0x3f2b94,_0x382c8c=nodeFileSystem){const _0x5888c3=a116_0x21c6,_0x35e6bd=a116_0x383329[_0x5888c3(0x1ec)](_0x3f2b94);if(!await _0x382c8c[_0x5888c3(0x1fc)](_0x35e6bd))throw new Error(_0x5888c3(0x1f8)+_0x3f2b94);let _0x5540db=a116_0x383329[_0x5888c3(0x1e1)](_0x35e6bd),_0x58e0f9=null,_0x2cd1e7=null;const _0x3725f7=a116_0x383329[_0x5888c3(0x1f9)](_0x5540db)['root'];while(_0x5540db!==_0x3725f7){const _0x3018bd=a116_0x383329[_0x5888c3(0x1fd)](_0x5540db,'tdx.json');if(await _0x382c8c['exists'](_0x3018bd)){_0x58e0f9=_0x3018bd,_0x2cd1e7=_0x5540db;break;}_0x5540db=a116_0x383329['dirname'](_0x5540db);}if(!_0x58e0f9||!_0x2cd1e7)throw new Error(_0x5888c3(0x1f1)+_0x3f2b94);const _0x11ecc1=await _0x382c8c[_0x5888c3(0x1f3)](_0x58e0f9),_0x5a49ae=JSON[_0x5888c3(0x1f9)](_0x11ecc1),_0x34745d=_0x5a49ae[_0x5888c3(0x1d6)];if(!_0x34745d)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x2dc936=await _0x382c8c[_0x5888c3(0x1f3)](_0x35e6bd),_0x25ce72=a116_0x4ce121(_0x2dc936),_0x326252=_0x25ce72[_0x5888c3(0x1f0)];if(!_0x326252)throw new Error(_0x5888c3(0x1e3)+_0x3f2b94);const _0x1eaf6b=_0x25ce72['type']===_0x5888c3(0x1d9)?_0x5888c3(0x1d9):'segment',_0x3cf092=a116_0x383329[_0x5888c3(0x1eb)](_0x2cd1e7,_0x35e6bd),_0x15b403=a116_0x383329[_0x5888c3(0x1e1)](_0x3cf092),_0x33b5e6=_0x15b403==='.'?'':_0x15b403[_0x5888c3(0x1d7)](/\\/g,'/'),_0x488766=_0x33b5e6?_0x34745d+'/'+_0x33b5e6+'/'+_0x326252:_0x34745d+'/'+_0x326252;return{'parentSegment':_0x34745d,'segmentName':_0x326252,'folderPath':_0x33b5e6,'fullPath':_0x488766,'resourceType':_0x1eaf6b};}
@@ -1 +1 @@
1
- function a117_0x28d1(){const _0x4bfe3f=['25358380vTRLVP','substring','.\x20Parent\x20name\x20cannot\x20be\x20empty','190707vzrRkr','2521798nTJqXY','180IEQWmb','.\x20Child\x20name\x20cannot\x20be\x20empty','2797613uDyflU','83472AXwyKW','Invalid\x20segment\x20reference\x20format:\x20','237200pPLrWu','655485pNFaek','indexOf','90lKRGih','36amtDrk'];a117_0x28d1=function(){return _0x4bfe3f;};return a117_0x28d1();}function a117_0x5b29(_0x2aa6e3,_0x328f03){_0x2aa6e3=_0x2aa6e3-0xe9;const _0x28d178=a117_0x28d1();let _0x5b296b=_0x28d178[_0x2aa6e3];return _0x5b296b;}(function(_0x1cdbb3,_0x13a58c){const _0x3fa86f=a117_0x5b29,_0x4f8277=_0x1cdbb3();while(!![]){try{const _0x46c936=-parseInt(_0x3fa86f(0xf0))/0x1+-parseInt(_0x3fa86f(0xe9))/0x2+-parseInt(_0x3fa86f(0xf7))/0x3*(parseInt(_0x3fa86f(0xf3))/0x4)+parseInt(_0x3fa86f(0xea))/0x5*(parseInt(_0x3fa86f(0xed))/0x6)+parseInt(_0x3fa86f(0xec))/0x7+parseInt(_0x3fa86f(0xef))/0x8*(-parseInt(_0x3fa86f(0xf2))/0x9)+parseInt(_0x3fa86f(0xf4))/0xa;if(_0x46c936===_0x13a58c)break;else _0x4f8277['push'](_0x4f8277['shift']());}catch(_0x44ae95){_0x4f8277['push'](_0x4f8277['shift']());}}}(a117_0x28d1,0x9f03c));export function parseSegmentRef(_0x5d67ce){const _0xd40435=a117_0x5b29,_0x43e10a=_0x5d67ce[_0xd40435(0xf1)]('/');if(_0x43e10a===-0x1)return{'parentId':_0x5d67ce};if(_0x43e10a===0x0)throw new Error(_0xd40435(0xee)+_0x5d67ce+_0xd40435(0xf6));const _0x4ba9e4=_0x5d67ce[_0xd40435(0xf5)](0x0,_0x43e10a),_0x56848b=_0x5d67ce['substring'](_0x43e10a+0x1);if(_0x56848b==='')throw new Error(_0xd40435(0xee)+_0x5d67ce+_0xd40435(0xeb));return{'parentId':_0x4ba9e4,'childId':_0x56848b};}
1
+ function a117_0x3b99(){const _0xbfbbb5=['substring','3531699VoaWZH','11ZyHrwl','12768CBsnNH','indexOf','522319LgLpBV','17360orDjUn','598610snlAYq','407301aXYOyZ','.\x20Child\x20name\x20cannot\x20be\x20empty','96WzWNgs','50PyKXFx','4706qdNkkX','Invalid\x20segment\x20reference\x20format:\x20','.\x20Parent\x20name\x20cannot\x20be\x20empty','4UTnJQC'];a117_0x3b99=function(){return _0xbfbbb5;};return a117_0x3b99();}(function(_0x1e80d9,_0x1a3f66){const _0x5f1b73=a117_0x503c,_0x1a81ff=_0x1e80d9();while(!![]){try{const _0x4e8a7c=parseInt(_0x5f1b73(0x1f4))/0x1*(-parseInt(_0x5f1b73(0x1f3))/0x2)+parseInt(_0x5f1b73(0x1f0))/0x3*(-parseInt(_0x5f1b73(0x1e7))/0x4)+-parseInt(_0x5f1b73(0x1ee))/0x5*(-parseInt(_0x5f1b73(0x1f2))/0x6)+parseInt(_0x5f1b73(0x1ed))/0x7+parseInt(_0x5f1b73(0x1eb))/0x8+parseInt(_0x5f1b73(0x1e9))/0x9+-parseInt(_0x5f1b73(0x1ef))/0xa*(-parseInt(_0x5f1b73(0x1ea))/0xb);if(_0x4e8a7c===_0x1a3f66)break;else _0x1a81ff['push'](_0x1a81ff['shift']());}catch(_0x29660f){_0x1a81ff['push'](_0x1a81ff['shift']());}}}(a117_0x3b99,0x50b7c));function a117_0x503c(_0x3a7151,_0x38034d){_0x3a7151=_0x3a7151-0x1e6;const _0x3b99ec=a117_0x3b99();let _0x503cca=_0x3b99ec[_0x3a7151];return _0x503cca;}export function parseSegmentRef(_0x1fe59e){const _0x39d243=a117_0x503c,_0x3d43e2=_0x1fe59e[_0x39d243(0x1ec)]('/');if(_0x3d43e2===-0x1)return{'parentId':_0x1fe59e};if(_0x3d43e2===0x0)throw new Error(_0x39d243(0x1f5)+_0x1fe59e+_0x39d243(0x1e6));const _0x469e32=_0x1fe59e['substring'](0x0,_0x3d43e2),_0x2b48f9=_0x1fe59e[_0x39d243(0x1e8)](_0x3d43e2+0x1);if(_0x2b48f9==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x1fe59e+_0x39d243(0x1f1));return{'parentId':_0x469e32,'childId':_0x2b48f9};}
@@ -1 +1 @@
1
- (function(_0x16a1f4,_0xb44aa4){const _0x1477df=a118_0x54f3,_0x436d52=_0x16a1f4();while(!![]){try{const _0x4c2960=-parseInt(_0x1477df(0x199))/0x1+-parseInt(_0x1477df(0x16c))/0x2*(-parseInt(_0x1477df(0x186))/0x3)+parseInt(_0x1477df(0x1a4))/0x4*(-parseInt(_0x1477df(0x184))/0x5)+-parseInt(_0x1477df(0x18f))/0x6*(parseInt(_0x1477df(0x17c))/0x7)+parseInt(_0x1477df(0x18c))/0x8+parseInt(_0x1477df(0x172))/0x9+-parseInt(_0x1477df(0x183))/0xa*(-parseInt(_0x1477df(0x194))/0xb);if(_0x4c2960===_0xb44aa4)break;else _0x436d52['push'](_0x436d52['shift']());}catch(_0x2ffda2){_0x436d52['push'](_0x436d52['shift']());}}}(a118_0x2f16,0x9ad7c));import a118_0x4bd61d from'path';import{sanitizeFileName}from'../../utils/string-utils.js';function a118_0x2f16(){const _0x47d8d2=['No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','resolve','File\x20not\x20found:\x20','824648LHcrrh','match','error','invalid_yaml','No\x20tdx.json\x20found\x20for\x20file:\x20','370617dlDJiK','segment','cwd','Tip:\x20Run\x20\x27tdx\x20sg\x20pull\x20<parent_name>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure\x0a\x20\x20Or\x20set\x20context:\x20\x27tdx\x20sg\x20use\x20<parent_name>\x27','configDir','Not\x20a\x20YAML\x20file:\x20','parentSegment','context','segmentName','startsWith','directory','58648NecGMK','includes','6aVFiWo','replace','readFile','root','exists','File\x20not\x20found','10609695CxJkmN','type','trim','no_config','extname','parent_segment','basename','file','parent_name','Parent\x20segment\x20not\x20specified','21KnuzsJ','relative','scopedFolderPath','No\x20tdx.json\x20found','file_not_found','isScoped','string','10WGxxsc','80EYLugz','tdx.json','171363WXGDRA','journey','dirname','folderPath','isDirectory','message','7809152YYWDCj','isFile','resourceType','2323770fIKqWw','parse'];a118_0x2f16=function(){return _0x47d8d2;};return a118_0x2f16();}import{nodeFileSystem}from'../io/node-filesystem.js';import{isYamlFilePath,resolveYamlFilePath}from'./segment-path-parser.js';function a118_0x54f3(_0x1b8adb,_0x1d7d07){_0x1b8adb=_0x1b8adb-0x16b;const _0x2f1620=a118_0x2f16();let _0x54f306=_0x2f1620[_0x1b8adb];return _0x54f306;}import{getSegmentRootDir}from'./tdx-config.js';export function isSuccessfulResolution(_0x49efcb){const _0x455cb2=a118_0x54f3;return _0x49efcb[_0x455cb2(0x173)]!==_0x455cb2(0x196);}export function isScopedResolution(_0x221ca1){const _0x2a0bd6=a118_0x54f3;return _0x221ca1[_0x2a0bd6(0x173)]===_0x2a0bd6(0x1a3)||_0x221ca1[_0x2a0bd6(0x173)]===_0x2a0bd6(0x179)||_0x221ca1[_0x2a0bd6(0x173)]===_0x2a0bd6(0x1a0);}export function getScopedDetails(_0x3325a1){const _0x46421b=a118_0x54f3;if(isScopedResolution(_0x3325a1))return{'isScoped':_0x3325a1['isScoped'],'scopedFolderPath':_0x3325a1[_0x46421b(0x17e)]};return undefined;}async function findTdxConfigAsync(_0xb8622b,_0x2fb0ab){const _0x2de3c0=a118_0x54f3;let _0x56c153=a118_0x4bd61d['resolve'](_0xb8622b);const _0x2e78d5=a118_0x4bd61d[_0x2de3c0(0x190)](_0x56c153)[_0x2de3c0(0x16f)];while(_0x56c153!==_0x2e78d5){const _0x588d94=a118_0x4bd61d['join'](_0x56c153,_0x2de3c0(0x185));if(await _0x2fb0ab[_0x2de3c0(0x170)](_0x588d94))try{const _0x47897d=await _0x2fb0ab[_0x2de3c0(0x16e)](_0x588d94),_0x314e0a=JSON[_0x2de3c0(0x190)](_0x47897d);if(_0x314e0a[_0x2de3c0(0x177)]&&typeof _0x314e0a[_0x2de3c0(0x177)]===_0x2de3c0(0x182))return{'configPath':_0x588d94,'configDir':_0x56c153,'parentSegment':_0x314e0a[_0x2de3c0(0x177)]};}catch{}_0x56c153=a118_0x4bd61d[_0x2de3c0(0x188)](_0x56c153);}return null;}function calculateScopedPath(_0x31d706,_0x2802b3){const _0x2342ea=a118_0x54f3,_0x5d4296=a118_0x4bd61d[_0x2342ea(0x17d)](_0x2802b3,_0x31d706),_0x4b2b34=_0x5d4296!==''&&_0x5d4296!=='.'&&!_0x5d4296[_0x2342ea(0x1a2)]('..');return{'isScoped':_0x4b2b34,'scopedFolderPath':_0x4b2b34?_0x5d4296[_0x2342ea(0x16d)](/\\/g,'/'):''};}export async function resolveTarget(_0x47400c){const _0x5cda6a=a118_0x54f3,{arg:_0x2946fe,contextParent:_0xd8079a,cwd:cwd=process[_0x5cda6a(0x19b)](),fs:fs=nodeFileSystem}=_0x47400c;if(_0x2946fe&&isYamlFilePath(_0x2946fe))try{const _0x5dca3a=await resolveYamlFilePath(_0x2946fe,fs),_0x49c7e9=a118_0x4bd61d['resolve'](_0x2946fe),_0x314f54=a118_0x4bd61d['dirname'](_0x49c7e9),_0x3c380f=await findTdxConfigAsync(_0x314f54,fs);if(!_0x3c380f){if(_0xd8079a){const _0x212e26=a118_0x4bd61d['dirname'](_0x49c7e9);return{'type':_0x5cda6a(0x179),'parentName':_0xd8079a,'targetDir':_0x212e26,'configRoot':_0x212e26,'filePath':_0x49c7e9,'resourceName':_0x5dca3a['segmentName'],'folderPath':_0x5dca3a['folderPath'],'resourceType':_0x5dca3a[_0x5cda6a(0x18e)],'isScoped':![],'scopedFolderPath':''};}return{'type':_0x5cda6a(0x196),'errorCode':_0x5cda6a(0x175),'message':_0x5cda6a(0x198)+_0x2946fe,'arg':_0x2946fe,'helpText':_0x5cda6a(0x19c)};}const _0xbcaeb9=calculateScopedPath(_0x314f54,_0x3c380f[_0x5cda6a(0x19d)]);return{'type':_0x5cda6a(0x179),'parentName':_0x3c380f[_0x5cda6a(0x19f)],'targetDir':_0x3c380f[_0x5cda6a(0x19d)],'configRoot':_0x3c380f['configDir'],'filePath':_0x49c7e9,'resourceName':_0x5dca3a[_0x5cda6a(0x1a1)],'folderPath':_0x5dca3a[_0x5cda6a(0x189)],'resourceType':_0x5dca3a['resourceType'],'isScoped':_0xbcaeb9[_0x5cda6a(0x181)],'scopedFolderPath':_0xbcaeb9[_0x5cda6a(0x17e)]};}catch(_0x71c549){const _0x223199=_0x71c549 instanceof Error?_0x71c549[_0x5cda6a(0x18b)]:String(_0x71c549);if(_0x223199[_0x5cda6a(0x16b)](_0x5cda6a(0x171)))return{'type':'error','errorCode':_0x5cda6a(0x180),'message':_0x5cda6a(0x193)+_0x2946fe,'arg':_0x2946fe};if(_0x223199[_0x5cda6a(0x16b)](_0x5cda6a(0x17f))){if(_0xd8079a){const _0x503e82=a118_0x4bd61d[_0x5cda6a(0x192)](_0x2946fe);if(await fs[_0x5cda6a(0x170)](_0x503e82)){const _0x30e4bf=a118_0x4bd61d[_0x5cda6a(0x188)](_0x503e82),_0x36c813=await fs[_0x5cda6a(0x16e)](_0x503e82),_0x351efe=_0x36c813['match'](/^name:\s*["']?([^"'\n]+)["']?/m),_0x25655f=_0x36c813[_0x5cda6a(0x195)](/^type:\s*["']?([^"'\n]+)["']?/m),_0x4ce6e2=_0x351efe?_0x351efe[0x1][_0x5cda6a(0x174)]():a118_0x4bd61d[_0x5cda6a(0x178)](_0x2946fe,a118_0x4bd61d[_0x5cda6a(0x176)](_0x2946fe)),_0x55ce70=_0x25655f&&_0x25655f[0x1][_0x5cda6a(0x174)]()==='journey'?_0x5cda6a(0x187):_0x5cda6a(0x19a);return{'type':_0x5cda6a(0x179),'parentName':_0xd8079a,'targetDir':_0x30e4bf,'configRoot':_0x30e4bf,'filePath':_0x503e82,'resourceName':_0x4ce6e2,'folderPath':'','resourceType':_0x55ce70,'isScoped':![],'scopedFolderPath':''};}}return{'type':'error','errorCode':_0x5cda6a(0x175),'message':_0x5cda6a(0x198)+_0x2946fe,'arg':_0x2946fe,'helpText':_0x5cda6a(0x19c)};}return{'type':_0x5cda6a(0x196),'errorCode':_0x5cda6a(0x197),'message':_0x223199,'arg':_0x2946fe};}if(_0x2946fe){const _0x334b3b=a118_0x4bd61d[_0x5cda6a(0x192)](cwd,_0x2946fe);let _0x58863b=null;try{_0x58863b=await fs['stat'](_0x334b3b);}catch{}if(_0x58863b?.[_0x5cda6a(0x18a)]()){const _0x49298=await findTdxConfigAsync(_0x334b3b,fs);if(_0x49298){const _0x193bb8=calculateScopedPath(_0x334b3b,_0x49298[_0x5cda6a(0x19d)]);return{'type':'directory','parentName':_0x49298[_0x5cda6a(0x19f)],'targetDir':_0x334b3b,'configRoot':_0x49298['configDir'],'isScoped':_0x193bb8['isScoped'],'scopedFolderPath':_0x193bb8['scopedFolderPath']};}if(_0xd8079a)return{'type':_0x5cda6a(0x1a3),'parentName':_0xd8079a,'targetDir':_0x334b3b,'configRoot':_0x334b3b,'isScoped':![],'scopedFolderPath':''};return{'type':_0x5cda6a(0x196),'errorCode':'no_config','message':_0x5cda6a(0x191)+_0x2946fe,'arg':_0x2946fe,'helpText':_0x5cda6a(0x19c)};}if(_0x58863b?.[_0x5cda6a(0x18d)]())return{'type':_0x5cda6a(0x196),'errorCode':_0x5cda6a(0x197),'message':_0x5cda6a(0x19e)+_0x2946fe,'arg':_0x2946fe,'helpText':'Segment\x20and\x20journey\x20files\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension'};const _0xeb6612=sanitizeFileName(_0x2946fe),_0x14a681=getSegmentRootDir(_0xeb6612,cwd);return{'type':_0x5cda6a(0x17a),'parentName':_0x2946fe,'targetDir':_0x14a681,'configRoot':_0x14a681};}const _0x27bbf0=await findTdxConfigAsync(cwd,fs);if(_0x27bbf0){const _0x3b9bac=calculateScopedPath(cwd,_0x27bbf0[_0x5cda6a(0x19d)]);return{'type':_0x5cda6a(0x1a0),'parentName':_0x27bbf0['parentSegment'],'targetDir':cwd,'configRoot':_0x27bbf0[_0x5cda6a(0x19d)],'isScoped':_0x3b9bac[_0x5cda6a(0x181)],'scopedFolderPath':_0x3b9bac[_0x5cda6a(0x17e)]};}if(_0xd8079a){const _0x3dcd2b=sanitizeFileName(_0xd8079a),_0x404827=getSegmentRootDir(_0x3dcd2b,cwd);return{'type':_0x5cda6a(0x1a0),'parentName':_0xd8079a,'targetDir':_0x404827,'configRoot':_0x404827,'isScoped':![],'scopedFolderPath':''};}return{'type':_0x5cda6a(0x196),'errorCode':'no_parent','message':_0x5cda6a(0x17b),'helpText':'Use\x20\x27tdx\x20sg\x20use\x20<parent_name>\x27\x20to\x20set\x20context\x0aOr\x20run\x20\x27tdx\x20sg\x20pull\x20<parent_name>\x27\x20to\x20create\x20the\x20folder\x20structure'};}
1
+ (function(_0x1392bc,_0x41da6f){const _0x53091d=a118_0x2c51,_0x51d8d0=_0x1392bc();while(!![]){try{const _0x37013f=-parseInt(_0x53091d(0xd5))/0x1+parseInt(_0x53091d(0xe0))/0x2*(-parseInt(_0x53091d(0xd2))/0x3)+-parseInt(_0x53091d(0xff))/0x4+parseInt(_0x53091d(0xf1))/0x5+-parseInt(_0x53091d(0xf5))/0x6+parseInt(_0x53091d(0xf3))/0x7*(-parseInt(_0x53091d(0x103))/0x8)+parseInt(_0x53091d(0xda))/0x9;if(_0x37013f===_0x41da6f)break;else _0x51d8d0['push'](_0x51d8d0['shift']());}catch(_0x272951){_0x51d8d0['push'](_0x51d8d0['shift']());}}}(a118_0xc860,0x810e0));import a118_0x177a7f from'path';import{sanitizeFileName}from'../../utils/string-utils.js';import{nodeFileSystem}from'../io/node-filesystem.js';import{isYamlFilePath,resolveYamlFilePath}from'./segment-path-parser.js';import{getSegmentRootDir}from'./tdx-config.js';export function isSuccessfulResolution(_0x4a54c0){const _0x3c531b=a118_0x2c51;return _0x4a54c0[_0x3c531b(0xd8)]!==_0x3c531b(0xef);}export function isScopedResolution(_0x1b6fa1){const _0x1e6a97=a118_0x2c51;return _0x1b6fa1[_0x1e6a97(0xd8)]===_0x1e6a97(0x102)||_0x1b6fa1[_0x1e6a97(0xd8)]==='file'||_0x1b6fa1[_0x1e6a97(0xd8)]===_0x1e6a97(0xee);}export function getScopedDetails(_0x11e69b){if(isScopedResolution(_0x11e69b))return{'isScoped':_0x11e69b['isScoped'],'scopedFolderPath':_0x11e69b['scopedFolderPath']};return undefined;}function a118_0x2c51(_0x387b88,_0x22f7ad){_0x387b88=_0x387b88-0xcf;const _0xc8603c=a118_0xc860();let _0x2c51b5=_0xc8603c[_0x387b88];return _0x2c51b5;}async function findTdxConfigAsync(_0x18f66f,_0x113896){const _0x4b8d74=a118_0x2c51;let _0x3f2c9f=a118_0x177a7f[_0x4b8d74(0xdb)](_0x18f66f);const _0x2e9a39=a118_0x177a7f[_0x4b8d74(0xfe)](_0x3f2c9f)['root'];while(_0x3f2c9f!==_0x2e9a39){const _0x3b45b6=a118_0x177a7f[_0x4b8d74(0xd3)](_0x3f2c9f,_0x4b8d74(0xf2));if(await _0x113896[_0x4b8d74(0xf4)](_0x3b45b6))try{const _0x28151b=await _0x113896[_0x4b8d74(0xd0)](_0x3b45b6),_0x41bf66=JSON['parse'](_0x28151b);if(_0x41bf66[_0x4b8d74(0xe2)]&&typeof _0x41bf66[_0x4b8d74(0xe2)]===_0x4b8d74(0xdf))return{'configPath':_0x3b45b6,'configDir':_0x3f2c9f,'parentSegment':_0x41bf66[_0x4b8d74(0xe2)]};}catch{}_0x3f2c9f=a118_0x177a7f['dirname'](_0x3f2c9f);}return null;}function calculateScopedPath(_0x1a7d92,_0x146481){const _0x425474=a118_0x2c51,_0x49c40a=a118_0x177a7f['relative'](_0x146481,_0x1a7d92),_0x3235a3=_0x49c40a!==''&&_0x49c40a!=='.'&&!_0x49c40a[_0x425474(0xfc)]('..');return{'isScoped':_0x3235a3,'scopedFolderPath':_0x3235a3?_0x49c40a['replace'](/\\/g,'/'):''};}function a118_0xc860(){const _0x941ffe=['2261540WJSllo','isDirectory','isFile','directory','144296xZliKq','parent_name','No\x20tdx.json\x20found\x20for\x20file:\x20','readFile','no_parent','21PUHjlm','join','segmentName','758827mQNndd','invalid_yaml','folderPath','type','Segment\x20and\x20journey\x20files\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension','22917681aCZySm','resolve','includes','File\x20not\x20found','No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','string','183046UeKuUU','cwd','parent_segment','no_config','Tip:\x20Run\x20\x27tdx\x20sg\x20pull\x20<parent_name>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure\x0a\x20\x20Or\x20set\x20context:\x20\x27tdx\x20sg\x20use\x20<parent_name>\x27','journey','stat','basename','segment','file_not_found','file','parentSegment','trim','isScoped','context','error','match','4515010LylFFc','tdx.json','336AEpeAM','exists','540924cgZWpf','Parent\x20segment\x20not\x20specified','Use\x20\x27tdx\x20sg\x20use\x20<parent_name>\x27\x20to\x20set\x20context\x0aOr\x20run\x20\x27tdx\x20sg\x20pull\x20<parent_name>\x27\x20to\x20create\x20the\x20folder\x20structure','scopedFolderPath','configDir','dirname','File\x20not\x20found:\x20','startsWith','message','parse'];a118_0xc860=function(){return _0x941ffe;};return a118_0xc860();}export async function resolveTarget(_0x3466c9){const _0x5cbbde=a118_0x2c51,{arg:_0x134d9d,contextParent:_0x54a2c9,cwd:cwd=process[_0x5cbbde(0xe1)](),fs:fs=nodeFileSystem}=_0x3466c9;if(_0x134d9d&&isYamlFilePath(_0x134d9d))try{const _0x558b3f=await resolveYamlFilePath(_0x134d9d,fs),_0x217a87=a118_0x177a7f[_0x5cbbde(0xdb)](_0x134d9d),_0x24413e=a118_0x177a7f[_0x5cbbde(0xfa)](_0x217a87),_0x335582=await findTdxConfigAsync(_0x24413e,fs);if(!_0x335582){if(_0x54a2c9){const _0x2185eb=a118_0x177a7f['dirname'](_0x217a87);return{'type':_0x5cbbde(0xea),'parentName':_0x54a2c9,'targetDir':_0x2185eb,'configRoot':_0x2185eb,'filePath':_0x217a87,'resourceName':_0x558b3f[_0x5cbbde(0xd4)],'folderPath':_0x558b3f['folderPath'],'resourceType':_0x558b3f['resourceType'],'isScoped':![],'scopedFolderPath':''};}return{'type':_0x5cbbde(0xef),'errorCode':_0x5cbbde(0xe3),'message':_0x5cbbde(0xcf)+_0x134d9d,'arg':_0x134d9d,'helpText':_0x5cbbde(0xe4)};}const _0x2f22b6=calculateScopedPath(_0x24413e,_0x335582[_0x5cbbde(0xf9)]);return{'type':_0x5cbbde(0xea),'parentName':_0x335582[_0x5cbbde(0xeb)],'targetDir':_0x335582['configDir'],'configRoot':_0x335582[_0x5cbbde(0xf9)],'filePath':_0x217a87,'resourceName':_0x558b3f['segmentName'],'folderPath':_0x558b3f[_0x5cbbde(0xd7)],'resourceType':_0x558b3f['resourceType'],'isScoped':_0x2f22b6[_0x5cbbde(0xed)],'scopedFolderPath':_0x2f22b6[_0x5cbbde(0xf8)]};}catch(_0x15faab){const _0x363b73=_0x15faab instanceof Error?_0x15faab[_0x5cbbde(0xfd)]:String(_0x15faab);if(_0x363b73[_0x5cbbde(0xdc)](_0x5cbbde(0xdd)))return{'type':_0x5cbbde(0xef),'errorCode':_0x5cbbde(0xe9),'message':_0x5cbbde(0xfb)+_0x134d9d,'arg':_0x134d9d};if(_0x363b73[_0x5cbbde(0xdc)]('No\x20tdx.json\x20found')){if(_0x54a2c9){const _0x112139=a118_0x177a7f[_0x5cbbde(0xdb)](_0x134d9d);if(await fs[_0x5cbbde(0xf4)](_0x112139)){const _0x2b56b3=a118_0x177a7f[_0x5cbbde(0xfa)](_0x112139),_0x253d09=await fs['readFile'](_0x112139),_0x23a2d6=_0x253d09[_0x5cbbde(0xf0)](/^name:\s*["']?([^"'\n]+)["']?/m),_0x24a633=_0x253d09[_0x5cbbde(0xf0)](/^type:\s*["']?([^"'\n]+)["']?/m),_0x23a75c=_0x23a2d6?_0x23a2d6[0x1][_0x5cbbde(0xec)]():a118_0x177a7f[_0x5cbbde(0xe7)](_0x134d9d,a118_0x177a7f['extname'](_0x134d9d)),_0x16e0ba=_0x24a633&&_0x24a633[0x1][_0x5cbbde(0xec)]()===_0x5cbbde(0xe5)?_0x5cbbde(0xe5):_0x5cbbde(0xe8);return{'type':_0x5cbbde(0xea),'parentName':_0x54a2c9,'targetDir':_0x2b56b3,'configRoot':_0x2b56b3,'filePath':_0x112139,'resourceName':_0x23a75c,'folderPath':'','resourceType':_0x16e0ba,'isScoped':![],'scopedFolderPath':''};}}return{'type':_0x5cbbde(0xef),'errorCode':_0x5cbbde(0xe3),'message':'No\x20tdx.json\x20found\x20for\x20file:\x20'+_0x134d9d,'arg':_0x134d9d,'helpText':_0x5cbbde(0xe4)};}return{'type':_0x5cbbde(0xef),'errorCode':_0x5cbbde(0xd6),'message':_0x363b73,'arg':_0x134d9d};}if(_0x134d9d){const _0x2bb496=a118_0x177a7f[_0x5cbbde(0xdb)](cwd,_0x134d9d);let _0x1474bb=null;try{_0x1474bb=await fs[_0x5cbbde(0xe6)](_0x2bb496);}catch{}if(_0x1474bb?.[_0x5cbbde(0x100)]()){const _0x5eeb26=await findTdxConfigAsync(_0x2bb496,fs);if(_0x5eeb26){const _0x2ea2ed=calculateScopedPath(_0x2bb496,_0x5eeb26[_0x5cbbde(0xf9)]);return{'type':_0x5cbbde(0x102),'parentName':_0x5eeb26[_0x5cbbde(0xeb)],'targetDir':_0x2bb496,'configRoot':_0x5eeb26[_0x5cbbde(0xf9)],'isScoped':_0x2ea2ed[_0x5cbbde(0xed)],'scopedFolderPath':_0x2ea2ed[_0x5cbbde(0xf8)]};}if(_0x54a2c9)return{'type':'directory','parentName':_0x54a2c9,'targetDir':_0x2bb496,'configRoot':_0x2bb496,'isScoped':![],'scopedFolderPath':''};return{'type':_0x5cbbde(0xef),'errorCode':'no_config','message':_0x5cbbde(0xde)+_0x134d9d,'arg':_0x134d9d,'helpText':_0x5cbbde(0xe4)};}if(_0x1474bb?.[_0x5cbbde(0x101)]())return{'type':_0x5cbbde(0xef),'errorCode':_0x5cbbde(0xd6),'message':'Not\x20a\x20YAML\x20file:\x20'+_0x134d9d,'arg':_0x134d9d,'helpText':_0x5cbbde(0xd9)};const _0x3a6fc2=sanitizeFileName(_0x134d9d),_0x858bc3=getSegmentRootDir(_0x3a6fc2,cwd);return{'type':_0x5cbbde(0x104),'parentName':_0x134d9d,'targetDir':_0x858bc3,'configRoot':_0x858bc3};}const _0x10ad5b=await findTdxConfigAsync(cwd,fs);if(_0x10ad5b){const _0x34f056=calculateScopedPath(cwd,_0x10ad5b['configDir']);return{'type':_0x5cbbde(0xee),'parentName':_0x10ad5b[_0x5cbbde(0xeb)],'targetDir':cwd,'configRoot':_0x10ad5b[_0x5cbbde(0xf9)],'isScoped':_0x34f056['isScoped'],'scopedFolderPath':_0x34f056[_0x5cbbde(0xf8)]};}if(_0x54a2c9){const _0x551792=sanitizeFileName(_0x54a2c9),_0x48a4a5=getSegmentRootDir(_0x551792,cwd);return{'type':'context','parentName':_0x54a2c9,'targetDir':_0x48a4a5,'configRoot':_0x48a4a5,'isScoped':![],'scopedFolderPath':''};}return{'type':_0x5cbbde(0xef),'errorCode':_0x5cbbde(0xd1),'message':_0x5cbbde(0xf6),'helpText':_0x5cbbde(0xf7)};}