@treasuredata/tdx 0.26.4 → 0.26.6

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 (169) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-command.js +1 -1
  21. package/dist/commands/job-command.js +1 -1
  22. package/dist/commands/journey-command.js +1 -1
  23. package/dist/commands/journey-validate-command.js +1 -1
  24. package/dist/commands/llm-command.js +1 -1
  25. package/dist/commands/mcp-command.js +1 -1
  26. package/dist/commands/parent-segment-command.js +1 -1
  27. package/dist/commands/profile-command.js +1 -1
  28. package/dist/commands/profiles-command.js +1 -1
  29. package/dist/commands/query-command.js +1 -1
  30. package/dist/commands/schedule-command.js +1 -1
  31. package/dist/commands/segment-command.js +1 -1
  32. package/dist/commands/segment-create-command.js +1 -1
  33. package/dist/commands/segment-fields-command.js +1 -1
  34. package/dist/commands/segment-pull-command.js +1 -1
  35. package/dist/commands/segment-push-command.js +1 -1
  36. package/dist/commands/segment-update-command.js +1 -1
  37. package/dist/commands/segment-use-command.js +1 -1
  38. package/dist/commands/segment-validate-command.js +1 -1
  39. package/dist/commands/segments.js +1 -1
  40. package/dist/commands/show.js +1 -1
  41. package/dist/commands/status-command.js +1 -1
  42. package/dist/commands/tables.js +1 -1
  43. package/dist/commands/unset-command.js +1 -1
  44. package/dist/commands/use-command.js +1 -1
  45. package/dist/commands/user-command.js +1 -1
  46. package/dist/commands/workflow-command.js +1 -1
  47. package/dist/core/auth.js +1 -1
  48. package/dist/core/command-output.js +1 -1
  49. package/dist/core/config.js +1 -1
  50. package/dist/core/connection-cache.js +1 -1
  51. package/dist/core/constants.js +1 -1
  52. package/dist/core/credential-cache.js +1 -1
  53. package/dist/core/global-context.js +1 -1
  54. package/dist/core/keychain.js +1 -1
  55. package/dist/core/profile.js +1 -1
  56. package/dist/core/project-config.js +1 -1
  57. package/dist/core/session.js +1 -1
  58. package/dist/core/user-cache.js +1 -1
  59. package/dist/core/version.js +1 -1
  60. package/dist/index.js +1 -1
  61. package/dist/mcp/server.js +1 -1
  62. package/dist/mcp/tools/index.js +1 -1
  63. package/dist/mcp/tools/tdx-run.js +1 -1
  64. package/dist/mcp/tools/tdx-search.js +1 -1
  65. package/dist/mcp/utils.js +1 -1
  66. package/dist/proxy/claude-usage-tracker.js +1 -1
  67. package/dist/proxy/passthrough-server.js +1 -1
  68. package/dist/proxy/sse-usage-parser.js +1 -1
  69. package/dist/sdk/agent/agent-config.js +1 -1
  70. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  71. package/dist/sdk/agent/agent-yaml.js +1 -1
  72. package/dist/sdk/agent/test/evaluator.js +1 -1
  73. package/dist/sdk/agent/test/executor.js +1 -1
  74. package/dist/sdk/agent/test/index.js +1 -1
  75. package/dist/sdk/agent/test/output.js +1 -1
  76. package/dist/sdk/agent/test/parser.js +1 -1
  77. package/dist/sdk/api.js +1 -1
  78. package/dist/sdk/client/cdp-api-client.js +1 -1
  79. package/dist/sdk/client/endpoints.js +1 -1
  80. package/dist/sdk/client/engage-api-client.js +1 -1
  81. package/dist/sdk/client/http-client.js +1 -1
  82. package/dist/sdk/client/llm-api-client.js +1 -1
  83. package/dist/sdk/client/rate-limiter.js +1 -1
  84. package/dist/sdk/client/td-api-client.js +1 -1
  85. package/dist/sdk/client/trino-api-client.js +1 -1
  86. package/dist/sdk/client/workflow-client.js +1 -1
  87. package/dist/sdk/connection-validator.js +1 -1
  88. package/dist/sdk/connection.js +1 -1
  89. package/dist/sdk/engage.js +1 -1
  90. package/dist/sdk/errors.js +1 -1
  91. package/dist/sdk/index.js +1 -1
  92. package/dist/sdk/io/index.js +1 -1
  93. package/dist/sdk/io/node-filesystem.js +1 -1
  94. package/dist/sdk/job.js +1 -1
  95. package/dist/sdk/journey.js +1 -1
  96. package/dist/sdk/llm/chat-cache.js +1 -1
  97. package/dist/sdk/llm/index.js +1 -1
  98. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  99. package/dist/sdk/llm/model-factors.js +1 -1
  100. package/dist/sdk/personalization.js +1 -1
  101. package/dist/sdk/query/index.js +1 -1
  102. package/dist/sdk/query/sql-parser.js +1 -1
  103. package/dist/sdk/realtime.js +1 -1
  104. package/dist/sdk/schedule.js +1 -1
  105. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  106. package/dist/sdk/segment/fields-display.js +1 -1
  107. package/dist/sdk/segment/file-discovery.js +1 -1
  108. package/dist/sdk/segment/journey-utils.js +1 -1
  109. package/dist/sdk/segment/journey-validator.js +1 -1
  110. package/dist/sdk/segment/journey-yaml.js +1 -1
  111. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  112. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  113. package/dist/sdk/segment/pull-workflow.js +1 -1
  114. package/dist/sdk/segment/push-recovery.js +1 -1
  115. package/dist/sdk/segment/push-workflow.js +1 -1
  116. package/dist/sdk/segment/resolution-context.js +1 -1
  117. package/dist/sdk/segment/segment-path-parser.js +1 -1
  118. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  119. package/dist/sdk/segment/target-resolution.js +1 -1
  120. package/dist/sdk/segment/tdx-config.js +1 -1
  121. package/dist/sdk/segment/validate-files.js +1 -1
  122. package/dist/sdk/segment/yaml-validator.js +1 -1
  123. package/dist/sdk/segment.js +1 -1
  124. package/dist/sdk/types/index.js +1 -1
  125. package/dist/sdk/types/progress.js +1 -1
  126. package/dist/sdk/user.js +1 -1
  127. package/dist/sdk/util/format-detector.js +1 -1
  128. package/dist/sdk/util/formatters.js +1 -1
  129. package/dist/sdk/util/index.js +1 -1
  130. package/dist/sdk/util/tree-formatter.js +1 -1
  131. package/dist/sdk/workflow/archive-validation.js +1 -1
  132. package/dist/sdk/workflow/clone-workflow.js +1 -1
  133. package/dist/sdk/workflow/index.js +1 -1
  134. package/dist/sdk/workflow/pull-workflow.js +1 -1
  135. package/dist/sdk/workflow/push-workflow.js +1 -1
  136. package/dist/sdk/workflow/tdx-config.js +1 -1
  137. package/dist/sdk/workflow/workflow-utils.js +1 -1
  138. package/dist/test-utils/command-runner.js +1 -1
  139. package/dist/test-utils/factories.js +1 -1
  140. package/dist/test-utils/fixtures.js +1 -1
  141. package/dist/test-utils/http-mock.js +1 -1
  142. package/dist/test-utils/index.js +1 -1
  143. package/dist/utils/async.js +1 -1
  144. package/dist/utils/colors.js +1 -1
  145. package/dist/utils/diff.js +1 -1
  146. package/dist/utils/file-permissions.js +1 -1
  147. package/dist/utils/global-cache.js +1 -1
  148. package/dist/utils/json-loader.js +1 -1
  149. package/dist/utils/local-cache.js +1 -1
  150. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  151. package/dist/utils/logger/formatters/index.js +1 -1
  152. package/dist/utils/logger/handlers/console-handler.js +1 -1
  153. package/dist/utils/logger/handlers/file-handler.js +1 -1
  154. package/dist/utils/logger/handlers/index.js +1 -1
  155. package/dist/utils/logger/handlers/null-handler.js +1 -1
  156. package/dist/utils/logger/index.js +1 -1
  157. package/dist/utils/logger/logger.js +1 -1
  158. package/dist/utils/logger/types.js +1 -1
  159. package/dist/utils/option-validation.js +1 -1
  160. package/dist/utils/port.js +1 -1
  161. package/dist/utils/process.js +1 -1
  162. package/dist/utils/prompt.js +1 -1
  163. package/dist/utils/spinner.js +1 -1
  164. package/dist/utils/sse-parser.js +1 -1
  165. package/dist/utils/string-utils.js +1 -1
  166. package/dist/utils/table-ref-parser.js +1 -1
  167. package/dist/utils/tdx-logger.js +1 -1
  168. package/dist/utils/version-check.js +1 -1
  169. package/package.json +1 -1
@@ -1 +1 @@
1
- const a114_0x2ffb8c=a114_0x3577;(function(_0x1b6b70,_0x5eda10){const _0x459384=a114_0x3577,_0x497c07=_0x1b6b70();while(!![]){try{const _0x11df13=-parseInt(_0x459384(0x21e))/0x1+-parseInt(_0x459384(0x20d))/0x2+-parseInt(_0x459384(0x1db))/0x3*(parseInt(_0x459384(0x221))/0x4)+parseInt(_0x459384(0x22f))/0x5*(parseInt(_0x459384(0x227))/0x6)+-parseInt(_0x459384(0x1c6))/0x7+parseInt(_0x459384(0x1fe))/0x8+-parseInt(_0x459384(0x1a1))/0x9*(-parseInt(_0x459384(0x1ef))/0xa);if(_0x11df13===_0x5eda10)break;else _0x497c07['push'](_0x497c07['shift']());}catch(_0x1def51){_0x497c07['push'](_0x497c07['shift']());}}}(a114_0xd1dc,0xa48e7));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_0x2ffb8c(0x194);export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0x3bdcf9){return''+PENDING_SEGMENT_PREFIX+_0x3bdcf9+'__';}export function isPendingSegmentId(_0x2a1e06){const _0x121a4a=a114_0x2ffb8c;return _0x2a1e06[_0x121a4a(0x13f)](PENDING_SEGMENT_PREFIX)&&!_0x2a1e06[_0x121a4a(0x13f)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x1b116d){return _0x1b116d['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x288b25){return''+PENDING_ACTIVATION_PREFIX+_0x288b25+'__';}export function isPendingActivationId(_0x3e4279){const _0x71c960=a114_0x2ffb8c;return _0x3e4279[_0x71c960(0x13f)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x7112ae){const _0xfb138f=a114_0x2ffb8c;return _0x7112ae[_0xfb138f(0x1e7)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x2cf525,_0x49c1b7){const _0x533d04=a114_0x2ffb8c,_0x5e370e=_0x2cf525+'::'+(_0x49c1b7[_0x533d04(0x204)]()||_0x533d04(0x1a7)),_0x14538d=createHash(_0x533d04(0x145))[_0x533d04(0x149)](_0x5e370e)[_0x533d04(0x1f2)](_0x533d04(0x16e))[_0x533d04(0x21b)](0x0,0xc);return _0x533d04(0x148)+_0x14538d;}export function ensureJourneyDefaults(_0x67ed9d){const _0x5ba845=a114_0x2ffb8c;!_0x67ed9d[_0x5ba845(0x1b7)]&&(_0x67ed9d[_0x5ba845(0x1b7)]=''),!_0x67ed9d[_0x5ba845(0x234)]&&(_0x67ed9d['state']=_0x5ba845(0x1d0));}export function resolveTDFolderPath(_0x1d896f,_0x50a5cd,_0x5d46bd){const _0x4d8f13=a114_0x2ffb8c;if(!_0x50a5cd)return _0x1d896f;if(_0x1d896f===_0x5d46bd||_0x1d896f[_0x4d8f13(0x13f)](_0x5d46bd+'/'))return _0x1d896f;return _0x1d896f?_0x5d46bd+'/'+_0x1d896f:_0x5d46bd;}export function addFoldersToCreate(_0x166e88,_0x5ea4c7,_0x2a437a){const _0xbe344a=a114_0x2ffb8c;if(!_0x166e88)return;if(_0x5ea4c7[_0xbe344a(0x167)](_0x166e88))return;const _0xdbf1da=_0x166e88[_0xbe344a(0x1f9)]('/');let _0x5a3c48='';for(const _0xbe1242 of _0xdbf1da){_0x5a3c48=_0x5a3c48?_0x5a3c48+'/'+_0xbe1242:_0xbe1242,!_0x5ea4c7['has'](_0x5a3c48)&&_0x2a437a[_0xbe344a(0x1c7)](_0x5a3c48);}}import*as a114_0x471e57 from'yaml';import{readFileSync}from'fs';import a114_0x15b4cd from'path';import{isJourneyDef,parseYamlString as a114_0x514321,toYamlString as a114_0x3681a1,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(_0x2d13e7){const _0x59bd48=a114_0x2ffb8c;if(Array[_0x59bd48(0x1b3)](_0x2d13e7))return'['+_0x2d13e7['map'](_0x7ca415=>stableStringify(_0x7ca415))['join'](',')+']';if(_0x2d13e7&&typeof _0x2d13e7===_0x59bd48(0x183)){const _0x46322e=_0x2d13e7,_0x4d585c=Object[_0x59bd48(0x192)](_0x46322e)[_0x59bd48(0x1f6)](),_0x2851dc=_0x4d585c[_0x59bd48(0x1f5)](_0x307422=>'\x22'+_0x307422+'\x22:'+stableStringify(_0x46322e[_0x307422]));return'{'+_0x2851dc['join'](',')+'}';}const _0x2acbca=JSON['stringify'](_0x2d13e7);return _0x2acbca===undefined?_0x59bd48(0x1c0):_0x2acbca;}function activationSignature(_0x41dda2){const _0x10c123=a114_0x2ffb8c,_0x5b23cf={'connection':_0x41dda2[_0x10c123(0x1bf)],..._0x41dda2[_0x10c123(0x1c2)]!==undefined&&{'all_columns':_0x41dda2['all_columns']},..._0x41dda2['columns']!==undefined&&{'columns':_0x41dda2[_0x10c123(0x1b1)]},..._0x41dda2[_0x10c123(0x203)]!==undefined&&{'behavior':_0x41dda2['behavior']},..._0x41dda2[_0x10c123(0x19e)]!==undefined&&{'schedule':_0x41dda2[_0x10c123(0x19e)]},..._0x41dda2[_0x10c123(0x177)]!==undefined&&{'notification':_0x41dda2[_0x10c123(0x177)]},..._0x41dda2[_0x10c123(0x232)]!==undefined&&{'connector_config':_0x41dda2[_0x10c123(0x232)]},..._0x41dda2['activation_template_id']!==undefined&&{'activation_template_id':_0x41dda2[_0x10c123(0x162)]}};return stableStringify(_0x5b23cf);}async function fetchSegment(_0x2b7cf0,_0x15a46f,_0x3da32c,_0x130719){const _0x1e2e03=a114_0x2ffb8c,_0x35b091=_0x130719?.['find'](_0x50c6b9=>_0x50c6b9['id']===_0x3da32c);if(_0x35b091)return _0x35b091;try{return await _0x2b7cf0['segment'][_0x1e2e03(0x1e9)](_0x15a46f,_0x3da32c);}catch(_0x1fce57){logger[_0x1e2e03(0x22b)](_0x1e2e03(0x1ee)+_0x3da32c+',\x20falling\x20back\x20to\x20getSegmentEntity:\x20'+_0x1fce57);try{return await _0x2b7cf0[_0x1e2e03(0x1a7)][_0x1e2e03(0x1f7)](_0x3da32c);}catch(_0x2332af){return logger[_0x1e2e03(0x22b)](_0x1e2e03(0x1af)+_0x3da32c+':\x20'+_0x2332af),null;}}}function recoverSegmentIdsFromPushRecovery(_0x2db2cd,_0x4220f5,_0x491e3c){const _0x3777d1=a114_0x2ffb8c,_0x298ef4=readPushRecovery(_0x2db2cd[_0x3777d1(0x142)]);if(_0x298ef4?.[_0x3777d1(0x1fc)]===_0x2db2cd[_0x3777d1(0x191)][_0x3777d1(0x237)])for(const [_0x12511a,_0x5d3133]of Object[_0x3777d1(0x169)](_0x298ef4[_0x3777d1(0x170)])){const _0x19e02d=generateDeterministicJourneySegmentName(_0x2db2cd['yamlConfig'][_0x3777d1(0x237)],_0x12511a);_0x5d3133[_0x3777d1(0x15b)]===_0x19e02d&&(_0x4220f5['set'](_0x12511a,_0x5d3133[_0x3777d1(0x1e8)]),_0x491e3c[_0x3777d1(0x18c)](_0x12511a,_0x5d3133[_0x3777d1(0x1e8)]));}}async function createOrRecoverEmbeddedSegment(_0x297462,_0x5bba76,_0x2722ec,_0x142659){const _0x58839b=a114_0x2ffb8c;let _0x211ea9;try{_0x211ea9=await _0x297462[_0x58839b(0x1a7)]['createJourneySegment']({'name':_0x2722ec['uniqueSegmentName'],'description':_0x2722ec['description'],'journeyId':_0x2722ec['journeyId'],'rule':_0x142659(_0x2722ec[_0x58839b(0x20e)],!![]),'countPopulation':!![],'parentFolderId':_0x2722ec[_0x58839b(0x182)],'audienceId':_0x2722ec[_0x58839b(0x172)]});}catch(_0x1aa1bc){const _0x4d63df=_0x1aa1bc instanceof Error&&_0x1aa1bc[_0x58839b(0x233)]['includes']('Name\x20has\x20already\x20been\x20taken');if(_0x4d63df){const _0xd7caee=readPushRecovery(_0x5bba76[_0x58839b(0x142)]),_0x5839dd=_0xd7caee?.['journeyName']===_0x5bba76[_0x58839b(0x191)]['name']?_0xd7caee['segments'][_0x2722ec[_0x58839b(0x1b2)]]:undefined;if(_0x5839dd?.[_0x58839b(0x15b)]===_0x2722ec['uniqueSegmentName'])await _0x297462['segment'][_0x58839b(0x1a6)](_0x2722ec['parentId'],_0x5839dd[_0x58839b(0x1e8)],{'description':_0x2722ec[_0x58839b(0x1b7)],'rule':_0x142659(_0x2722ec[_0x58839b(0x20e)],!![]),'countPopulation':!![]}),_0x211ea9=_0x5839dd['segmentId'];else throw new SDKError(ErrorCode[_0x58839b(0x16d)],_0x58839b(0x229)+_0x2722ec[_0x58839b(0x1b2)]+_0x58839b(0x1b5)+(_0x58839b(0x225)+_0x5bba76[_0x58839b(0x142)]['replace'](/([^/]+)$/,_0x58839b(0x13d))+')\x20')+_0x58839b(0x228),_0x1aa1bc);}else throw _0x1aa1bc;}return saveSegmentToPushRecovery(_0x5bba76['absolutePath'],_0x5bba76[_0x58839b(0x191)][_0x58839b(0x237)],_0x2722ec['localName'],{'segmentId':_0x211ea9,'uniqueServerName':_0x2722ec[_0x58839b(0x163)],'createdAt':new Date()['toISOString']()}),_0x211ea9;}export async function prepareSegmentFiles(_0xcd23bc,_0x26d4e7,_0x49411b,_0x3e1da5,_0x47c107){const _0xa3b332=a114_0x2ffb8c,{activationDefToCreateRequest:_0x1dd5fe}=await import(_0xa3b332(0x1cc)),_0x2651d4=[],_0x5eb578=new Set();for(const {yamlConfig:_0x21f4a8,folderPath:_0x18ff61,sourcePath:_0xa49c6}of _0xcd23bc){const _0x46a09e=resolveTDFolderPath(_0x18ff61,_0x3e1da5,_0x47c107),_0x22abd6=_0x46a09e+':'+_0x21f4a8[_0xa3b332(0x237)],_0x5be340=_0x26d4e7['segmentByFolderAndName']['get'](_0x22abd6),_0x392b5e=_0x5be340?_0x26d4e7[_0xa3b332(0x226)][_0xa3b332(0x15a)](_0x5be340['id'])||[]:[];addFoldersToCreate(_0x46a09e,_0x26d4e7[_0xa3b332(0x179)],_0x5eb578);const _0x5a5324=calculateActivationActions(_0x21f4a8[_0xa3b332(0x1ab)]||[],_0x392b5e,_0x26d4e7[_0xa3b332(0x1bd)],_0x26d4e7[_0xa3b332(0x231)]);for(const _0x1db0f9 of _0x5a5324){(_0x1db0f9[_0xa3b332(0x1c3)]==='create'||_0x1db0f9[_0xa3b332(0x1c3)]==='update')&&_0x1db0f9['yamlActivation']&&(_0x1db0f9[_0xa3b332(0x175)]=await _0x1dd5fe(_0x1db0f9[_0xa3b332(0x141)],_0x49411b));}const _0x42bd76=calculateSegmentDiff(_0x21f4a8,_0x5be340,_0x392b5e,_0x26d4e7[_0xa3b332(0x1bd)],_0x26d4e7['connectionIdToNameMap']);_0x2651d4[_0xa3b332(0x139)]({'relativePath':_0x21f4a8[_0xa3b332(0x237)],'absolutePath':_0xa49c6,'yamlConfig':_0x21f4a8,'folderPath':_0x46a09e,'existingSegment':_0x5be340,'existingActivations':_0x392b5e,'isNew':_0x42bd76[_0xa3b332(0x197)],'hasChanges':_0x42bd76[_0xa3b332(0x230)],'diff':_0x42bd76[_0xa3b332(0x209)],'activationActions':_0x5a5324});}return{'segmentFiles':_0x2651d4,'foldersToCreate':_0x5eb578};}export async function prepareJourneyFiles(_0xd04269,_0x1029b6,_0xacf38f,_0x50ce93){const _0x47bc45=a114_0x2ffb8c,_0x5be59e=[],_0x38ef7a=new Set();for(const {yamlConfig:_0x5a75f9,folderPath:_0x3a501b,sourcePath:_0x372860}of _0xd04269){const _0x54bc0e=resolveTDFolderPath(_0x3a501b,_0xacf38f,_0x50ce93),_0x3c0779=_0x54bc0e+':'+_0x5a75f9[_0x47bc45(0x237)],_0x5803d6=_0x1029b6['journeyBundlesByFolderAndName'][_0x47bc45(0x15a)](_0x3c0779);let _0x51f74f,_0xc960f1;if(_0x5803d6&&_0x5803d6['length']>0x0){const _0x74ab83=buildLocalExpandedRuleMappings(_0x5a75f9),{createYamlContext:_0x555e3a,prefetchJourneySegments:_0x14fdcb}=createPushYamlContextForBundle(_0x1029b6[_0x47bc45(0x13e)],_0x1029b6[_0x47bc45(0x172)],_0x1029b6[_0x47bc45(0x18a)],_0x74ab83,_0x1029b6['idToEmailMap'],_0x1029b6['connectionIdToNameMap'],_0x1029b6['activationStepsById'],_0x1029b6[_0x47bc45(0x18e)]);await _0x14fdcb(_0x5803d6[_0x47bc45(0x1f5)](_0x23073c=>_0x23073c['id']));const _0xff39d7=hasMultipleVersions(_0x5a75f9),_0x3f53ae=async _0x456185=>{const _0x57b55b=_0x47bc45,_0x520d17=_0x1029b6[_0x57b55b(0x18e)]?.[_0x57b55b(0x15a)](_0x456185);if(_0x520d17)return _0x520d17;return _0x1029b6['fetchJourney']({'journeyId':_0x456185,'journeyName':_0x5a75f9[_0x57b55b(0x237)],'isMultiVersion':_0x5803d6[_0x57b55b(0x176)]>0x1});};if(_0xff39d7&&_0x5803d6['length']>0x1){const _0xce9365=[];for(const _0x54bb6c of _0x5803d6){const _0x291a3c=_0x54bb6c[_0x47bc45(0x207)]||0x1;_0x1029b6[_0x47bc45(0x19a)]?.[_0x47bc45(0x149)](_0x47bc45(0x13a)+_0x5a75f9[_0x47bc45(0x237)]+'\x20v'+_0x291a3c);const _0x3d775f=await _0x3f53ae(_0x54bb6c['id']),_0xe1e210=_0x555e3a(_0x54bb6c['id']),_0xa2ef84=await journeyResponseToDef(_0x3d775f,_0xe1e210);_0xce9365[_0x47bc45(0x139)]({'item':_0x54bb6c,'yaml':_0xa2ef84});}const _0x2633ee=buildLocalRuleToNameMappingFromJourney(_0x5a75f9);_0xc960f1=buildMergedJourneyDef(_0xce9365,_0x2633ee);const _0x36acf2=Math['max'](..._0xce9365['map'](_0xa38310=>_0xa38310[_0x47bc45(0x160)][_0x47bc45(0x207)]||0x0)),_0x12acba=_0x5803d6['find'](_0x3391d3=>(_0x3391d3[_0x47bc45(0x207)]||0x0)===_0x36acf2);_0x12acba&&(_0x1029b6['progress']?.[_0x47bc45(0x149)]('Fetching\x20'+_0x5a75f9[_0x47bc45(0x237)]+'\x20v'+_0x36acf2),_0x51f74f=await _0x3f53ae(_0x12acba['id']));}else{const _0x2ac21c=_0x5803d6[_0x5803d6[_0x47bc45(0x176)]-0x1];_0x1029b6[_0x47bc45(0x19a)]?.[_0x47bc45(0x149)](_0x47bc45(0x13a)+_0x5a75f9[_0x47bc45(0x237)]),_0x51f74f=await _0x3f53ae(_0x2ac21c['id']);const _0xaa9fd8=_0x555e3a(_0x2ac21c['id']),_0x24b417=await journeyResponseToDef(_0x51f74f,_0xaa9fd8),_0x126803=buildLocalRuleToNameMappingFromJourney(_0x5a75f9);_0xc960f1=buildMergedJourneyDef([{'item':_0x2ac21c,'yaml':_0x24b417}],_0x126803);}}addFoldersToCreate(_0x54bc0e,_0x1029b6[_0x47bc45(0x179)],_0x38ef7a);const _0x5e12ea=calculateJourneyDiff(_0x5a75f9,_0xc960f1);_0x5be59e[_0x47bc45(0x139)]({'relativePath':_0x5a75f9['name'],'absolutePath':_0x372860,'yamlConfig':_0x5a75f9,'folderPath':_0x54bc0e,'existingJourney':_0x51f74f,'isNew':_0x5e12ea[_0x47bc45(0x197)],'hasChanges':_0x5e12ea[_0x47bc45(0x230)],'diff':_0x5e12ea['diff']});}return{'journeyFiles':_0x5be59e,'foldersToCreate':_0x38ef7a};}export function calculateActivationActions(_0x112da4,_0x5b08b3,_0x193f4b,_0xedcd82){const _0x5b309c=a114_0x2ffb8c,_0x2d043b=[],_0x507cc8=new Map();for(const _0x2654ef of _0x5b08b3){_0x507cc8[_0x5b309c(0x18c)](_0x2654ef[_0x5b309c(0x237)],_0x2654ef);}const _0x6a894c=new Map();for(const _0x4c68ad of _0x112da4){_0x6a894c[_0x5b309c(0x18c)](_0x4c68ad[_0x5b309c(0x237)],_0x4c68ad);}for(const _0x9e3479 of _0x112da4){const _0x33f7b3=_0x507cc8[_0x5b309c(0x15a)](_0x9e3479['name']);if(!_0x33f7b3)_0x2d043b[_0x5b309c(0x139)]({'type':_0x5b309c(0x21f),'name':_0x9e3479['name'],'yamlActivation':_0x9e3479});else{const _0xfa8def=activationResponseToDef(_0x33f7b3,_0x193f4b,_0xedcd82),_0x8480f5=a114_0x471e57['stringify'](_0xfa8def),_0x554d0e=a114_0x471e57[_0x5b309c(0x1f8)](_0x9e3479);_0x8480f5!==_0x554d0e&&_0x2d043b[_0x5b309c(0x139)]({'type':_0x5b309c(0x149),'name':_0x9e3479['name'],'yamlActivation':_0x9e3479,'existingActivation':_0x33f7b3});}}for(const _0x14043d of _0x5b08b3){!_0x6a894c['has'](_0x14043d[_0x5b309c(0x237)])&&_0x2d043b[_0x5b309c(0x139)]({'type':_0x5b309c(0x1d9),'name':_0x14043d[_0x5b309c(0x237)],'existingActivation':_0x14043d});}return _0x2d043b;}function calculateYamlDiff(_0x594763,_0x21e0a9){if(_0x21e0a9){const _0x2204d0=generateDiff(_0x21e0a9,_0x594763),_0x12e31b=hasChanges(_0x2204d0);return{'isNew':![],'hasChanges':_0x12e31b,'diff':_0x12e31b?formatDiffWithColors(_0x2204d0):undefined};}const _0x2aabae=generateDiff('',_0x594763);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x2aabae)};}export function calculateSegmentDiff(_0x9053e0,_0x5eaf09,_0x3508e8,_0x4b1628,_0x527bf0){const _0x3ec4fe=segmentToYamlString(_0x9053e0),_0x5243ce=_0x5eaf09?segmentToYamlString(segmentWithActivationsToYaml(_0x5eaf09,_0x3508e8,undefined,_0x4b1628,_0x527bf0)):undefined;return calculateYamlDiff(_0x3ec4fe,_0x5243ce);}export function calculateJourneyDiff(_0x56fe43,_0x2c5d6c){const _0x2eb292=normalizeJourneyDef(_0x56fe43,_0x56fe43),_0x4ae7fa=a114_0x3681a1(_0x2eb292),_0x1ea624=_0x2c5d6c?a114_0x3681a1(normalizeJourneyDef(_0x2c5d6c,_0x56fe43)):undefined;return calculateYamlDiff(_0x4ae7fa,_0x1ea624);}export function findSegmentsToDelete(_0x3d3ddc,_0x16bcfa,_0x52c10c,_0x3204f8,_0x1c7593){const _0xb0db18=a114_0x2ffb8c,_0x4c9789=new Set();for(const {yamlConfig:_0x175a65,folderPath:_0x230ac7}of _0x16bcfa){_0x4c9789['add'](_0x230ac7+':'+_0x175a65['name']);}return _0x3d3ddc[_0xb0db18(0x1ea)](_0x7a58f=>{const _0x321d41=_0xb0db18,_0x197aba=_0x7a58f[_0x321d41(0x171)]?_0x52c10c['get'](_0x7a58f[_0x321d41(0x171)][_0x321d41(0x219)]())||'':'',_0x34be77=_0x197aba+':'+_0x7a58f[_0x321d41(0x237)];if(_0x4c9789[_0x321d41(0x167)](_0x34be77))return![];if(_0x1c7593)return _0x197aba===_0x3204f8||_0x197aba[_0x321d41(0x13f)](_0x3204f8+'/');return!![];});}export function findJourneysToDelete(_0x4b9492,_0x2ae81e,_0x2ba6da,_0x5c71a8,_0xa4e69f){const _0x55b1b=a114_0x2ffb8c,_0x4d9484=new Set();for(const {yamlConfig:_0x5558f2,folderPath:_0x4b97b7}of _0x2ae81e){_0x4d9484[_0x55b1b(0x1c7)](_0x4b97b7+':'+_0x5558f2['name']);}return _0x4b9492[_0x55b1b(0x1ea)](_0x57eeeb=>{const _0x31b9bd=_0x55b1b,_0x507880=_0x57eeeb[_0x31b9bd(0x182)]?_0x2ba6da['get'](_0x57eeeb[_0x31b9bd(0x182)])||'':'',_0x25c2f2=_0x507880+':'+_0x57eeeb[_0x31b9bd(0x199)];if(_0x4d9484[_0x31b9bd(0x167)](_0x25c2f2))return![];if(_0xa4e69f)return _0x507880===_0x5c71a8||_0x507880[_0x31b9bd(0x13f)](_0x5c71a8+'/');return!![];});}export function buildSegmentLookupMap(_0x33940a,_0x1f6315){const _0x256c59=a114_0x2ffb8c,_0x4cdf23=new Map();for(const _0x4976eb of _0x33940a){const _0x5a9abc=_0x4976eb['segmentFolderId']?_0x1f6315[_0x256c59(0x15a)](_0x4976eb[_0x256c59(0x171)]['toString']())||'':'',_0x56ade2=_0x5a9abc+':'+_0x4976eb[_0x256c59(0x237)];_0x4cdf23[_0x256c59(0x18c)](_0x56ade2,_0x4976eb);}return _0x4cdf23;}export function buildSegmentNameToIdMap(_0x38f8a8){const _0x2fb762=new Map();for(const _0x3620af of _0x38f8a8){_0x2fb762['set'](_0x3620af['name'],_0x3620af['id']);}return _0x2fb762;}export function buildJourneyBundleLookupMap(_0x3abf87,_0x3b983e){const _0x1c3124=a114_0x2ffb8c,_0x38d34d=new Map();for(const _0x32d290 of _0x3abf87){const _0x176804=_0x32d290[_0x1c3124(0x182)]?_0x3b983e[_0x1c3124(0x15a)](_0x32d290[_0x1c3124(0x182)])||'':'',_0x9b8359=_0x176804+':'+_0x32d290[_0x1c3124(0x199)];!_0x38d34d['has'](_0x9b8359)&&_0x38d34d['set'](_0x9b8359,[]),_0x38d34d['get'](_0x9b8359)['push'](_0x32d290);}for(const _0xfaf82e of _0x38d34d[_0x1c3124(0x22c)]()){_0xfaf82e[_0x1c3124(0x1f6)]((_0x5a30b4,_0x38d9eb)=>(_0x5a30b4[_0x1c3124(0x207)]||0x0)-(_0x38d9eb[_0x1c3124(0x207)]||0x0));}return _0x38d34d;}function a114_0xd1dc(){const _0x25ae10=['Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','\x27\x20decision\x20point\x20branch\x20\x27','WaitStep','activationContext','folderId','object','created','parentFolder','toLowerCase','\x27\x20exit\x20criteria','folderPath','createdSegmentId','existingSegments','max','set','getJourney','journeyById','Created\x20journey\x20\x27','ACTIVATION_SYNTAX_ERROR','yamlConfig','keys','stages','__pending_','flatMap','NOT_FOUND','isNew','activation_deleting','journeyBundleName','progress','nameToType','segment_created','deleteSegment','schedule','Failed\x20to\x20fetch\x20referenced\x20segment\x20','JOURNEY_SYNTAX_ERROR','882FIlWcP','user','size','Creating\x20segment\x20\x27','stage\x20\x27','updateSegmentById','segment','journey_updated','join','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','activations','\x27\x20milestone','activationParams','Creating\x20folder\x20\x27','getSegmentEntity\x20also\x20failed\x20for\x20','Condition','columns','localName','isArray','journey_creating','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','Stage\x20\x27','description','deleted','waitStepType','existingSegment','Journey\x20\x27','logSuccess','idToEmailMap','valid','connection','null','run_after_journey_refresh','all_columns','type','onProgress','action','9324518lGtaLw','add','JOURNEY_UPDATE_ERROR','../../utils/async.js','milestone','activation_created','./child-segment-yaml.js','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','createSegment','conditionTimeoutUnit','draft','Deleted\x20segment\x20\x27','):\x20','logInfo','some','journeys','folder_created','Created\x20activation\x20\x27','segment_deleting','delete','\x20(referenced\x20in\x20journey\x20','18597CdTPiy','goal\x20criteria','segment_creating','decision_point','Created\x20segment\x20\x27','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','segment_updated','SEGMENT_SYNTAX_ERROR','Created\x20folder\x20\x27','\x0a\x20\x20','logDeleted','entryCriteria','replace','segmentId','getSegment','filter','journeyActivationStepId','with','conditionTimeoutDuration','getSegment\x20failed\x20for\x20','442070wopvvp','waitStep','INTERNAL','digest','data','Deleted\x20activation\x20\x27','map','sort','getSegmentEntity','stringify','split','updated','Entry\x20criteria:\x20','journeyName','folder','3886672pwrIam','deleteActivation','rootFolderId','index','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','behavior','trim','activation_deleted','rule','versionNumber','relationships','diff','resolveJourneyId','idToName','Updated\x20journey\x20\x27','2599692YSqNoE','resolvedRule','embedded_segment_creating','buildUserMaps','branches','Updated\x20segment\x20\x27','getActivation','all','\x27\x20from\x20file:\x20','activation_updated','utf-8','Updated\x20activation\x20\x27','toString','embeddedSegmentNameToId','slice','journey','logWarning','384863bSegEG','create','\x20error(s)','824ofXbgw','journeyId','from','DecisionPoint','Delete\x20the\x20push\x20recovery\x20file\x20(','activationsBySegmentId','6giosKl','and\x20the\x20server\x20segment,\x20then\x20retry.','Embedded\x20segment\x20\x27','existingActivation','debug','values','./journey-yaml.js','kind','748400VXzgYR','hasChanges','connectionIdToNameMap','connector_config','message','state','\x27\x20entry\x20criteria','createActivation','name','Segment\x20not\x20found','push','Fetching\x20','createFolder','Segment\x20not\x20found:\x20','.$1.push-recovery.json','deps','startsWith','find','yamlActivation','absolutePath','Failed\x20to\x20','journey_updating','sha1','results','embedded_activation_creating','journey_entry_criteria_','update','embedded_segment_created','\x27\x20wait\x20condition','segmentNameToId','\x20activation\x20\x27','entry','resolveSegment','attributes','Activation','conditionSegmentId','verbose','exitCriterias','Deleting\x20activation\x20\x27','\x27...','withProgress','activation_updating','createdSegmentIds','get','uniqueServerName','journeyStages','relative','segment_updating','day','item','journey_created','activation_template_id','uniqueSegmentName','skipSegments','listActivations','parseDocument','has','list','entries','folder_creating','Failed\x20to\x20resolve\x20segment\x20','conditions','SEGMENT_UPDATE_ERROR','hex','existingJourney','segments','segmentFolderId','parentId','waitStepUnit','SEGMENT_NOT_FOUND','validatedRequest','length','notification','activation_creating','folderPathToId','goal','parse','ACTIVATION_UPDATE_ERROR','steps'];a114_0xd1dc=function(){return _0x25ae10;};return a114_0xd1dc();}export function collectFoldersToCreate(_0x2db9bc,_0x1e17b9){const _0x4ec53a=a114_0x2ffb8c,_0x12602f=new Set();for(const _0x292a03 of _0x2db9bc){if(!_0x292a03)continue;if(_0x1e17b9[_0x4ec53a(0x167)](_0x292a03))continue;const _0x417b33=_0x292a03[_0x4ec53a(0x1f9)]('/');let _0x779c6b='';for(const _0x110d3d of _0x417b33){_0x779c6b=_0x779c6b?_0x779c6b+'/'+_0x110d3d:_0x110d3d,!_0x1e17b9[_0x4ec53a(0x167)](_0x779c6b)&&_0x12602f[_0x4ec53a(0x1c7)](_0x779c6b);}}return _0x12602f;}export function parseAndClassifyYamlFiles(_0x559991,_0x51c9cb,_0x4be4de){const _0x46894e=a114_0x2ffb8c,_0x272ca8=[],_0x563bce=[];for(const _0x3cda6f of _0x559991){const _0x5a7237=a114_0x15b4cd[_0x46894e(0x15d)](_0x51c9cb,a114_0x15b4cd['dirname'](_0x3cda6f)),_0xa3b258=_0x5a7237==='.'?'':_0x5a7237,_0x79364e=readFileSync(_0x3cda6f,_0x46894e(0x217)),_0x392a51=a114_0x471e57[_0x46894e(0x17b)](_0x79364e);if(isJourneyDef(_0x392a51)){const _0x57a101=a114_0x514321(_0x79364e);_0x563bce[_0x46894e(0x139)]({'yamlConfig':_0x57a101,'folderPath':_0xa3b258,'sourcePath':_0x3cda6f});}else{if(!_0x4be4de?.[_0x46894e(0x164)]){const _0x261fce=parseSegmentYamlFile(_0x79364e),_0xccc716=normalizeChildSegmentYaml(_0x261fce);_0x272ca8[_0x46894e(0x139)]({'yamlConfig':_0xccc716,'folderPath':_0xa3b258,'sourcePath':_0x3cda6f});}}}return{'segments':_0x272ca8,'journeys':_0x563bce};}export function validateParsedFiles(_0x231206,_0x3bca3b){const _0x17631c=a114_0x2ffb8c,_0xc9bb43=[];for(const {yamlConfig:_0xf1adbe,sourcePath:_0x46742e}of _0x231206[_0x17631c(0x170)]){const _0x11cbfe=readFileSync(_0x46742e,_0x17631c(0x217)),_0x38d106=a114_0x471e57[_0x17631c(0x166)](_0x11cbfe),_0x685e9=validateSegmentDef(_0xf1adbe,{'source':_0x11cbfe,'document':_0x38d106});if(!_0x685e9[_0x17631c(0x1be)]){const _0x45eada=a114_0x15b4cd[_0x17631c(0x15d)](_0x3bca3b,_0x46742e);_0xc9bb43[_0x17631c(0x139)]({'filePath':_0x45eada,'source':_0x11cbfe,'result':_0x685e9,'isJourney':![]});}}for(const {yamlConfig:_0x237bac,sourcePath:_0x597a32}of _0x231206[_0x17631c(0x1d5)]){const _0x397755=readFileSync(_0x597a32,_0x17631c(0x217)),_0x3c4e3a=a114_0x471e57[_0x17631c(0x166)](_0x397755),_0x2f0dcc=validateJourneyDef(_0x237bac,{'source':_0x397755,'document':_0x3c4e3a});if(!_0x2f0dcc[_0x17631c(0x1be)]){const _0x2b9d12=a114_0x15b4cd[_0x17631c(0x15d)](_0x3bca3b,_0x597a32);_0xc9bb43[_0x17631c(0x139)]({'filePath':_0x2b9d12,'source':_0x397755,'result':_0x2f0dcc,'isJourney':!![]});}}return _0xc9bb43;}function a114_0x3577(_0x114411,_0x24c45e){_0x114411=_0x114411-0x138;const _0xd1dc6e=a114_0xd1dc();let _0x35770e=_0xd1dc6e[_0x114411];return _0x35770e;}export function formatValidationErrors(_0x1d9d74){const _0x5a86d0=a114_0x2ffb8c,_0x204b6e=[];for(const {filePath:_0x378d55,source:_0x21ff31,result:_0x2f4e57,isJourney:_0xf5f314}of _0x1d9d74){const _0x169513=_0xf5f314?_0x5a86d0(0x21c):_0x5a86d0(0x1a7);_0x204b6e[_0x5a86d0(0x139)]('\x0a'+_0x378d55+'\x20('+_0x169513+_0x5a86d0(0x1d2)+_0x2f4e57['errors'][_0x5a86d0(0x176)]+_0x5a86d0(0x220)),_0x204b6e[_0x5a86d0(0x139)](formatValidationResult(_0x2f4e57,_0x21ff31,_0x378d55));}return _0x204b6e[_0x5a86d0(0x1a9)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x4efaf8){const _0x478c62=a114_0x2ffb8c,_0x3a7517=new Set(),_0x1a7e08=new Map(),_0x1b7102=collectSegmentUsageCounts(_0x4efaf8);if(_0x4efaf8[_0x478c62(0x170)])for(const [_0x491fff,_0x5969aa]of Object[_0x478c62(0x169)](_0x4efaf8[_0x478c62(0x170)])){_0x3a7517[_0x478c62(0x1c7)](_0x491fff);if(_0x5969aa[_0x478c62(0x206)]){const _0xf9c3bd=yamlRuleToApi(_0x5969aa[_0x478c62(0x206)]),_0x4466b2=apiRuleToYaml(_0xf9c3bd);_0x1a7e08[_0x478c62(0x18c)](_0x491fff,_0x4466b2);}}const _0x299a16=new Map();let _0xaa3561=0x0;for(const [_0x2a44ee,_0x5f0eb1]of _0x1a7e08){const _0x26523d=serializeExpandedRule(_0x5f0eb1,_0x1a7e08),_0x51fd92=_0x299a16[_0x478c62(0x15a)](_0x26523d)||[];_0x51fd92[_0x478c62(0x139)]({'name':_0x2a44ee,'index':_0xaa3561}),_0x299a16[_0x478c62(0x18c)](_0x26523d,_0x51fd92),_0xaa3561++;}const _0x2e0c5d=new Map();for(const [_0x3bd49e,_0x4efc64]of _0x299a16){const _0x2e68b8=_0x4efc64[_0x478c62(0x21b)]()[_0x478c62(0x1f6)]((_0x4e13cc,_0x17fdd8)=>{const _0x4008fe=_0x478c62,_0x1584ae=_0x1b7102[_0x4008fe(0x15a)](_0x4e13cc[_0x4008fe(0x237)])||0x0,_0x2377f2=_0x1b7102['get'](_0x17fdd8[_0x4008fe(0x237)])||0x0;if(_0x1584ae!==_0x2377f2)return _0x2377f2-_0x1584ae;return _0x4e13cc[_0x4008fe(0x201)]-_0x17fdd8[_0x4008fe(0x201)];})[_0x478c62(0x1f5)](_0x406e05=>_0x406e05[_0x478c62(0x237)]),_0x2b409a=[];for(const _0x10cf12 of _0x2e68b8){const _0x1d2618=_0x1b7102[_0x478c62(0x15a)](_0x10cf12)||0x0,_0x39d4ab=Math[_0x478c62(0x18b)](_0x1d2618,0x1);for(let _0x449c15=0x0;_0x449c15<_0x39d4ab;_0x449c15++){_0x2b409a[_0x478c62(0x139)](_0x10cf12);}}_0x2e0c5d[_0x478c62(0x18c)](_0x3bd49e,_0x2b409a);}return{'existingLocalSegmentNames':_0x3a7517,'localSegmentRules':_0x1a7e08,'localExpandedRuleToNames':_0x2e0c5d};}export function createSegmentIdResolver(_0x49f8fa,_0x44270d){return async _0x36dca7=>{const _0x418253=a114_0x3577,_0x4402fd=_0x49f8fa[_0x418253(0x15a)](_0x36dca7);if(!_0x4402fd)throw new SDKError(ErrorCode[_0x418253(0x174)],'Segment\x20not\x20found:\x20'+_0x36dca7+_0x418253(0x202)+_0x44270d+'\x27)');return _0x4402fd;};}export function extractRootFolderId(_0x320210){const _0x32cc61=a114_0x2ffb8c;return _0x320210['relationships']?.['parentSegmentFolder']?.[_0x32cc61(0x1f3)]?.['id']||_0x320210[_0x32cc61(0x208)]?.[_0x32cc61(0x185)]?.[_0x32cc61(0x1f3)]?.['id'];}export function buildConnectionMaps(_0x48b6c0){const _0x22acee=a114_0x2ffb8c,_0x388158=new Map(),_0x3098f8=new Map(),_0xed1246=new Map();for(const _0xa5b14a of _0x48b6c0){_0x388158[_0x22acee(0x18c)](_0xa5b14a[_0x22acee(0x237)],parseInt(_0xa5b14a['id'],0xa)),_0x3098f8[_0x22acee(0x18c)](_0xa5b14a['id'],_0xa5b14a[_0x22acee(0x237)]),_0xed1246[_0x22acee(0x18c)](_0xa5b14a[_0x22acee(0x237)],_0xa5b14a[_0x22acee(0x1c3)]);}return{'nameToId':_0x388158,'idToName':_0x3098f8,'nameToType':_0xed1246};}export function calculatePushStats(_0x385e8a,_0x4f4bee,_0x370f9a,_0x5c3fce,_0x308f58,_0x140510,_0x40cdc9){const _0x6357e0=a114_0x2ffb8c,_0x35f208=_0x385e8a[_0x6357e0(0x1ea)](_0x4cc713=>_0x4cc713['isNew']),_0x15ceb6=_0x385e8a[_0x6357e0(0x1ea)](_0x1a121d=>!_0x1a121d[_0x6357e0(0x197)]&&_0x1a121d['hasChanges']),_0x55b7f5=_0x385e8a[_0x6357e0(0x1ea)](_0x54e336=>!_0x54e336[_0x6357e0(0x197)]&&!_0x54e336[_0x6357e0(0x230)]),_0xaa00e3=_0x140510?_0x5c3fce:[],_0x17132f=_0x4f4bee['filter'](_0x5f22a9=>_0x5f22a9[_0x6357e0(0x197)]),_0x4827cd=_0x4f4bee[_0x6357e0(0x1ea)](_0x3b486d=>!_0x3b486d[_0x6357e0(0x197)]&&_0x3b486d[_0x6357e0(0x230)]),_0x217d7c=_0x4f4bee[_0x6357e0(0x1ea)](_0x48504b=>!_0x48504b[_0x6357e0(0x197)]&&!_0x48504b['hasChanges']),_0x659490=_0x140510?_0x308f58:[],_0x8bb77=_0x385e8a[_0x6357e0(0x195)](_0x165dd0=>_0x165dd0['activationActions']),_0x26111e=_0x8bb77['filter'](_0x4ca12d=>_0x4ca12d['type']===_0x6357e0(0x21f)),_0x3debc9=_0x8bb77['filter'](_0x4ba357=>_0x4ba357['type']===_0x6357e0(0x149)),_0x1e5080=_0x8bb77['filter'](_0x4fd0e2=>_0x4fd0e2[_0x6357e0(0x1c3)]==='delete'),_0x475bef=Array[_0x6357e0(0x223)](_0x370f9a)[_0x6357e0(0x1f6)](),_0x573b54=_0x40cdc9?![]:_0x35f208[_0x6357e0(0x176)]>0x0||_0x15ceb6[_0x6357e0(0x176)]>0x0||_0xaa00e3[_0x6357e0(0x176)]>0x0,_0x40fdc4=_0x17132f[_0x6357e0(0x176)]>0x0||_0x4827cd[_0x6357e0(0x176)]>0x0||_0x659490['length']>0x0,_0x2daacb=_0x40cdc9?![]:_0x8bb77[_0x6357e0(0x176)]>0x0,_0x419f18=_0x475bef[_0x6357e0(0x176)]>0x0;return{'segments':{'new':_0x35f208,'changed':_0x15ceb6,'unchanged':_0x55b7f5,'toDelete':_0xaa00e3},'journeys':{'new':_0x17132f,'changed':_0x4827cd,'unchanged':_0x217d7c,'toDelete':_0x659490},'activations':{'all':_0x8bb77,'toCreate':_0x26111e,'toUpdate':_0x3debc9,'toDelete':_0x1e5080},'folders':{'toCreate':_0x475bef},'counts':{'segments':{'new':_0x35f208['length'],'changed':_0x15ceb6[_0x6357e0(0x176)],'unchanged':_0x55b7f5[_0x6357e0(0x176)],'toDelete':_0xaa00e3['length']},'journeys':{'new':_0x17132f[_0x6357e0(0x176)],'changed':_0x4827cd[_0x6357e0(0x176)],'unchanged':_0x217d7c[_0x6357e0(0x176)],'toDelete':_0x659490[_0x6357e0(0x176)]},'activations':{'create':_0x26111e[_0x6357e0(0x176)],'update':_0x3debc9['length'],'delete':_0x1e5080[_0x6357e0(0x176)]},'folders':_0x475bef[_0x6357e0(0x176)]},'hasChanges':_0x573b54||_0x40fdc4||_0x2daacb||_0x419f18};}export async function buildPushExecutionContext(_0x4f1138,_0x7445b5,_0x3a4031,_0x35d43e,_0x1ddc6d,_0x15f39c){const _0x16d9cc=a114_0x2ffb8c,_0x4b2cee=extractRootFolderId(_0x3a4031),{pathToId:_0x3abbec,idToPath:_0x1d44f6}=buildFolderMaps(_0x1ddc6d),_0x83500c=buildSegmentNameToIdMap(_0x35d43e),_0x44b507=new Map(),{batchAsync:_0x114b36}=await import('../../utils/async.js'),[_0x13052e,_0x25c013]=await Promise[_0x16d9cc(0x214)]([_0x4f1138[_0x16d9cc(0x1a2)][_0x16d9cc(0x210)](),_0x4f1138[_0x16d9cc(0x1bf)][_0x16d9cc(0x168)](),((async()=>{const _0x1d6741=_0x16d9cc;!_0x15f39c&&_0x35d43e[_0x1d6741(0x176)]>0x0&&await _0x114b36(_0x35d43e,async _0x3ab8d5=>{const _0x242414=_0x1d6741,_0x43b1e6=await _0x4f1138[_0x242414(0x1a7)]['listActivations'](_0x7445b5,_0x3ab8d5['id']);_0x44b507[_0x242414(0x18c)](_0x3ab8d5['id'],_0x43b1e6);});})())]),{emailToId:_0x4a8b07,idToEmail:_0x4b2506}=_0x13052e,_0x455065=buildConnectionMaps(_0x25c013);return{'rootFolderId':_0x4b2cee,'folderPathToId':_0x3abbec,'folderIdToPath':_0x1d44f6,'segmentNameToId':_0x83500c,'activationsBySegmentId':_0x44b507,'emailToIdMap':_0x4a8b07,'idToEmailMap':_0x4b2506,'connectionNameToIdMap':_0x455065['nameToId'],'connectionIdToNameMap':_0x455065[_0x16d9cc(0x20b)],'connectionNameToTypeMap':_0x455065[_0x16d9cc(0x19b)]};}export function createPushYamlContextForBundle(_0x3d03ac,_0x320046,_0x5e429b,_0x287aea,_0x118338,_0x515535,_0x423a64,_0x6ca0f4){const {existingLocalSegmentNames:_0x449d26,localExpandedRuleToNames:_0x3dd461}=_0x287aea,_0xab936d=new Set(),_0x3b415f=new Map(),_0x505f2e=new Map(),_0x255f26=new Map(),_0x419a1f=createJumpTargetCache(),_0x436ded=new Map(),_0x1f62e4=new Map(),_0x132f55=new Set();let _0xf2f9c6;const _0x1e76bf=_0x1bce27=>{const _0x369ae2={'resolveSegment':async _0x4518de=>{const _0x546ac=a114_0x3577,_0x542d6b=_0x255f26[_0x546ac(0x15a)](_0x4518de);if(_0x542d6b!==undefined)return{'name':_0x542d6b,'isJourneyLocal':!![]};try{const _0x444993=await fetchSegment(_0x3d03ac,_0x320046,_0x4518de,_0x5e429b);if(!_0x444993)throw new Error(_0x546ac(0x138));const _0x4c000c=generateJourneyLocalName(_0x444993[_0x546ac(0x237)]),_0x26d962=_0x444993[_0x546ac(0x22e)]===SEGMENT_KIND_JOURNEY&&_0x4c000c!==undefined;let _0x112be3=_0x444993[_0x546ac(0x237)],_0x815615;if(_0x26d962&&_0x444993[_0x546ac(0x206)]){const _0xd687fe=apiRuleToYaml(_0x444993['rule']);_0x1f62e4[_0x546ac(0x18c)](_0x4518de,_0xd687fe);const _0x363f63=async _0x545992=>{const _0x34b04c=_0x546ac,_0x11a678=collectSegmentRefsFromRule(_0x545992);for(const _0x59e555 of _0x11a678){if(!_0x1f62e4[_0x34b04c(0x167)](_0x59e555))try{const _0x447b84=await fetchSegment(_0x3d03ac,_0x320046,_0x59e555,_0x5e429b);if(_0x447b84?.[_0x34b04c(0x206)]){const _0x4a1c60=apiRuleToYaml(_0x447b84['rule']);_0x1f62e4[_0x34b04c(0x18c)](_0x59e555,_0x4a1c60),await _0x363f63(_0x4a1c60);}}catch(_0x2be332){logger[_0x34b04c(0x22b)](_0x34b04c(0x19f)+_0x59e555+':\x20'+_0x2be332);}}};await _0x363f63(_0xd687fe);const _0x1c386d=serializeExpandedRule(_0xd687fe,_0x1f62e4),_0x25896f=_0x3dd461[_0x546ac(0x15a)](_0x1c386d);if(_0x25896f&&_0x25896f[_0x546ac(0x176)]>0x0){const _0x3c513d=_0x3b415f[_0x546ac(0x15a)](_0x1c386d)||0x0,_0x4fde3f=_0x25896f[_0x3c513d]||_0x25896f[_0x25896f['length']-0x1];_0x3b415f[_0x546ac(0x18c)](_0x1c386d,_0x3c513d+0x1),_0x112be3=_0x4fde3f,_0xab936d[_0x546ac(0x1c7)](_0x112be3),_0x255f26[_0x546ac(0x18c)](_0x4518de,_0x112be3);const _0x509346=await resolveRuleSegmentRefs(_0xd687fe,async _0x292001=>{const _0x249db1=_0x546ac,_0x157b87=_0x255f26[_0x249db1(0x15a)](_0x292001);if(_0x157b87)return _0x157b87;const _0x422884=await _0xf2f9c6[_0x249db1(0x14f)](_0x292001);return _0x422884['name'];});_0x815615={'description':_0x444993[_0x546ac(0x1b7)],'rule':_0x509346};}else{const _0x122f82=_0x436ded[_0x546ac(0x15a)](_0x1c386d);if(_0x122f82)_0x112be3=_0x122f82,_0x255f26[_0x546ac(0x18c)](_0x4518de,_0x112be3);else{if(_0x4c000c){let _0x30cc01=_0x4c000c,_0x1e589b=0x2;while(_0xab936d[_0x546ac(0x167)](_0x30cc01)||_0x449d26['has'](_0x30cc01)){_0x30cc01=_0x4c000c+'_'+_0x1e589b,_0x1e589b++;}_0xab936d[_0x546ac(0x1c7)](_0x30cc01),_0x112be3=_0x30cc01;}_0x255f26['set'](_0x4518de,_0x112be3),_0x436ded['set'](_0x1c386d,_0x112be3);const _0x251f94=await resolveRuleSegmentRefs(_0xd687fe,async _0x2f260c=>{const _0x1b1df1=_0x546ac,_0x431b83=_0x255f26['get'](_0x2f260c);if(_0x431b83)return _0x431b83;const _0x54d199=await _0xf2f9c6[_0x1b1df1(0x14f)](_0x2f260c);return _0x54d199['name'];});_0x815615={'description':_0x444993[_0x546ac(0x1b7)],'rule':_0x251f94};}}}return{'name':_0x112be3,'isJourneyLocal':_0x26d962,'definition':_0x815615};}catch(_0x7eaf51){return logger[_0x546ac(0x22b)](_0x546ac(0x16b)+_0x4518de+':\x20'+_0x7eaf51),{'name':_0x4518de,'isJourneyLocal':![]};}},'resolveActivation':async _0x6a5741=>{const _0x18a7c6=a114_0x3577,_0x59919f=_0x505f2e[_0x18a7c6(0x15a)](_0x6a5741);if(_0x59919f!==undefined)return{'name':_0x59919f,'isJourneyLocal':!![]};try{let _0x5c0f6e=_0x423a64?.[_0x18a7c6(0x15a)](_0x6a5741);!_0x5c0f6e&&(_0x5c0f6e=await _0x3d03ac[_0x18a7c6(0x21c)][_0x18a7c6(0x213)](_0x1bce27,_0x6a5741));const _0x8a7740=_0x5c0f6e['attributes'][_0x18a7c6(0x1ad)][_0x18a7c6(0x237)]||_0x6a5741,_0x4de6c9=sanitizeYamlKey(_0x8a7740)||'activation_'+_0x6a5741,_0x546479=_0x4de6c9;_0x505f2e['set'](_0x6a5741,_0x546479);const _0x345a0f=journeyActivationStepToYaml(_0x5c0f6e,_0x118338,_0x515535);return{'name':_0x546479,'isJourneyLocal':!![],'definition':_0x345a0f};}catch(_0x532333){return logger[_0x18a7c6(0x22b)]('Failed\x20to\x20resolve\x20activation\x20'+_0x6a5741+':\x20'+_0x532333),{'name':_0x6a5741,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x45a230,_0x19291f)=>resolveJumpTarget(_0x45a230,_0x19291f,_0x419a1f,async _0x51bcf0=>{const _0x5ea93b=a114_0x3577,_0x1fe3ab=_0x6ca0f4?.['get'](_0x51bcf0);if(_0x1fe3ab)return _0x1fe3ab;return _0x3d03ac[_0x5ea93b(0x21c)][_0x5ea93b(0x18d)](_0x51bcf0);})};return _0xf2f9c6=_0x369ae2,_0x369ae2;},_0x17b255=async _0x37d5e6=>{const _0x4f372c=a114_0x3577,{collectSegmentIdsFromJourneyApi:_0x12706c}=await import(_0x4f372c(0x22d)),{batchAsync:_0x5d1129}=await import(_0x4f372c(0x1c9)),_0x570d7f=new Set();for(const _0x17aa02 of _0x37d5e6){let _0x49b259=_0x6ca0f4?.['get'](_0x17aa02);!_0x49b259&&(_0x49b259=await _0x3d03ac[_0x4f372c(0x21c)]['getJourney'](_0x17aa02));const _0x25bba7=_0x12706c(_0x49b259);for(const _0x161d1c of _0x25bba7){_0x570d7f['add'](_0x161d1c);}}let _0x158109=Array['from'](_0x570d7f);while(_0x158109['length']>0x0){const _0x147c8a=_0x158109[_0x4f372c(0x1ea)](_0x3af726=>!_0x132f55[_0x4f372c(0x167)](_0x3af726));if(_0x147c8a['length']===0x0)break;const _0x53c838=await _0x5d1129(_0x147c8a,async _0x104001=>{const _0x565eb0=_0x4f372c;_0x132f55[_0x565eb0(0x1c7)](_0x104001);const _0x2834be=await fetchSegment(_0x3d03ac,_0x320046,_0x104001,_0x5e429b);if(!_0x2834be)return null;return{'segmentId':_0x104001,'segment':_0x2834be};},0xa),_0x3be281=new Set();for(const _0x56754f of _0x53c838){if(!_0x56754f?.[_0x4f372c(0x1a7)]?.['rule'])continue;const _0x295058=apiRuleToYaml(_0x56754f[_0x4f372c(0x1a7)]['rule']);_0x1f62e4[_0x4f372c(0x18c)](_0x56754f[_0x4f372c(0x1e8)],_0x295058);const _0x5d30cb=collectSegmentRefsFromRule(_0x295058);for(const _0x5a3ed7 of _0x5d30cb){!_0x132f55['has'](_0x5a3ed7)&&_0x3be281[_0x4f372c(0x1c7)](_0x5a3ed7);}}_0x158109=Array['from'](_0x3be281);}};return{'createYamlContext':_0x1e76bf,'prefetchJourneySegments':_0x17b255};}export async function executePushSegments(_0x33d024,_0x3cd0ff,_0x43d689,_0x49669a,_0x211562){const _0x2db860=a114_0x2ffb8c,{segmentDefToCreateRequest:_0x59442b,segmentDefToUpdateRequest:_0x90a131}=await import(_0x2db860(0x1cc)),_0x246e16=_0x43d689[_0x2db860(0x179)],_0x309f94=0x5,_0x49931a=async _0x5f0ef3=>{const _0x2e397d=_0x2db860,_0x3bd948=_0x5f0ef3[_0x2e397d(0x188)]?_0x246e16['get'](_0x5f0ef3['folderPath']):undefined;let _0x37416e;const _0x54be02={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};try{if(_0x5f0ef3['isNew']){_0x211562['onProgress']?.({'type':_0x2e397d(0x1dd),'name':_0x5f0ef3[_0x2e397d(0x191)]['name']});const _0x51a9e1=_0x59442b(_0x5f0ef3[_0x2e397d(0x191)],_0x3bd948),_0x1c2e22=await _0x211562[_0x2e397d(0x157)](_0x2e397d(0x1a4)+_0x5f0ef3['yamlConfig'][_0x2e397d(0x237)]+_0x2e397d(0x156),()=>_0x33d024[_0x2e397d(0x1a7)][_0x2e397d(0x1ce)](_0x49669a[_0x2e397d(0x172)],_0x51a9e1));_0x37416e=_0x1c2e22[_0x2e397d(0x1f3)]['id'],_0x54be02[_0x2e397d(0x189)]={'name':_0x5f0ef3[_0x2e397d(0x191)][_0x2e397d(0x237)],'id':_0x37416e},_0x211562[_0x2e397d(0x1c4)]?.({'type':_0x2e397d(0x19c),'name':_0x5f0ef3[_0x2e397d(0x191)][_0x2e397d(0x237)],'segmentId':_0x37416e}),_0x211562[_0x2e397d(0x1bc)]?.(_0x2e397d(0x1df)+_0x5f0ef3[_0x2e397d(0x191)][_0x2e397d(0x237)]+'\x27'),_0x54be02['created']=0x1;}else{if(_0x5f0ef3[_0x2e397d(0x230)]){_0x211562['onProgress']?.({'type':_0x2e397d(0x15e),'name':_0x5f0ef3[_0x2e397d(0x191)]['name']});const _0x55b4ac=_0x90a131(_0x5f0ef3['yamlConfig']);_0x3bd948!==_0x5f0ef3[_0x2e397d(0x1ba)]?.[_0x2e397d(0x171)]&&(_0x55b4ac[_0x2e397d(0x171)]=_0x3bd948?parseInt(_0x3bd948,0xa):undefined),await _0x211562[_0x2e397d(0x157)]('Updating\x20segment\x20\x27'+_0x5f0ef3[_0x2e397d(0x191)][_0x2e397d(0x237)]+_0x2e397d(0x156),()=>_0x33d024[_0x2e397d(0x1a7)][_0x2e397d(0x1a6)](_0x49669a[_0x2e397d(0x172)],_0x5f0ef3['existingSegment']['id'],_0x55b4ac)),_0x37416e=_0x5f0ef3[_0x2e397d(0x1ba)]['id'],_0x211562[_0x2e397d(0x1c4)]?.({'type':_0x2e397d(0x1e1),'name':_0x5f0ef3[_0x2e397d(0x191)][_0x2e397d(0x237)]}),_0x211562[_0x2e397d(0x1bc)]?.(_0x2e397d(0x212)+_0x5f0ef3['yamlConfig']['name']+'\x27'),_0x54be02[_0x2e397d(0x1fa)]=0x1;}else _0x37416e=_0x5f0ef3['existingSegment']['id'];}}catch(_0x38cb5){const _0x4be805=isHttp400Error(_0x38cb5),_0x1ade3a=_0x4be805?ErrorCode[_0x2e397d(0x1e2)]:ErrorCode[_0x2e397d(0x16d)],_0x5105d4=getErrorMessage(_0x38cb5);throw new SDKError(_0x1ade3a,_0x2e397d(0x143)+(_0x5f0ef3[_0x2e397d(0x197)]?_0x2e397d(0x21f):_0x2e397d(0x149))+'\x20segment\x20from\x20file:\x20'+_0x5f0ef3[_0x2e397d(0x142)]+_0x2e397d(0x1e4)+_0x5105d4,_0x38cb5);}try{const _0x49c4a6=await syncActivationsForSegment(_0x33d024,_0x49669a[_0x2e397d(0x172)],_0x37416e,_0x5f0ef3[_0x2e397d(0x191)][_0x2e397d(0x237)],_0x5f0ef3['activationActions'],_0x211562,_0x5f0ef3[_0x2e397d(0x142)]);_0x54be02[_0x2e397d(0x1ab)]=_0x49c4a6;}catch(_0x84a48){if(_0x84a48 instanceof SDKError)throw _0x84a48;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x5f0ef3[_0x2e397d(0x191)][_0x2e397d(0x237)]+'\x27\x20from\x20file:\x20'+_0x5f0ef3[_0x2e397d(0x142)]+'\x0a\x20\x20'+getErrorMessage(_0x84a48),_0x84a48);}return _0x54be02;},_0x25cb43=await batchAsync(_0x3cd0ff,_0x49931a,_0x309f94),_0x54c77a={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x516609 of _0x25cb43){_0x54c77a['created']+=_0x516609[_0x2db860(0x184)],_0x54c77a[_0x2db860(0x1fa)]+=_0x516609[_0x2db860(0x1fa)],_0x516609[_0x2db860(0x189)]&&_0x54c77a[_0x2db860(0x159)][_0x2db860(0x18c)](_0x516609[_0x2db860(0x189)][_0x2db860(0x237)],_0x516609[_0x2db860(0x189)]['id']),_0x54c77a[_0x2db860(0x1ab)]['created']+=_0x516609[_0x2db860(0x1ab)][_0x2db860(0x184)],_0x54c77a['activations'][_0x2db860(0x1fa)]+=_0x516609[_0x2db860(0x1ab)][_0x2db860(0x1fa)],_0x54c77a[_0x2db860(0x1ab)][_0x2db860(0x1b8)]+=_0x516609['activations'][_0x2db860(0x1b8)];}return _0x54c77a;}async function syncActivationsForSegment(_0x5d2a83,_0x44b1ff,_0x521626,_0x364981,_0x4772b3,_0x107a07,_0x3e124e){const _0x5cbe4a=a114_0x2ffb8c,_0x5d8021={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0xb5602b of _0x4772b3){try{if(_0xb5602b[_0x5cbe4a(0x1c3)]===_0x5cbe4a(0x21f)&&_0xb5602b[_0x5cbe4a(0x175)])_0x107a07['onProgress']?.({'type':_0x5cbe4a(0x178),'segmentName':_0x364981,'activationName':_0xb5602b[_0x5cbe4a(0x237)]}),await _0x107a07[_0x5cbe4a(0x157)]('Creating\x20activation\x20\x27'+_0xb5602b[_0x5cbe4a(0x237)]+'\x27...',()=>_0x5d2a83['segment']['createActivation'](_0x44b1ff,_0x521626,_0xb5602b[_0x5cbe4a(0x175)])),_0x107a07[_0x5cbe4a(0x1c4)]?.({'type':_0x5cbe4a(0x1cb),'segmentName':_0x364981,'activationName':_0xb5602b['name']}),_0x107a07[_0x5cbe4a(0x1bc)]?.(_0x5cbe4a(0x1d7)+_0xb5602b['name']+'\x27'),_0x5d8021[_0x5cbe4a(0x184)]++;else{if(_0xb5602b[_0x5cbe4a(0x1c3)]===_0x5cbe4a(0x149)&&_0xb5602b[_0x5cbe4a(0x175)]&&_0xb5602b[_0x5cbe4a(0x22a)])_0x107a07[_0x5cbe4a(0x1c4)]?.({'type':_0x5cbe4a(0x158),'segmentName':_0x364981,'activationName':_0xb5602b[_0x5cbe4a(0x237)]}),await _0x107a07[_0x5cbe4a(0x157)]('Updating\x20activation\x20\x27'+_0xb5602b[_0x5cbe4a(0x237)]+_0x5cbe4a(0x156),()=>_0x5d2a83[_0x5cbe4a(0x1a7)]['updateActivation'](_0x44b1ff,_0x521626,_0xb5602b[_0x5cbe4a(0x22a)]['id'],_0xb5602b['validatedRequest'])),_0x107a07[_0x5cbe4a(0x1c4)]?.({'type':_0x5cbe4a(0x216),'segmentName':_0x364981,'activationName':_0xb5602b[_0x5cbe4a(0x237)]}),_0x107a07[_0x5cbe4a(0x1bc)]?.(_0x5cbe4a(0x218)+_0xb5602b[_0x5cbe4a(0x237)]+'\x27'),_0x5d8021[_0x5cbe4a(0x1fa)]++;else _0xb5602b['type']==='delete'&&_0xb5602b[_0x5cbe4a(0x22a)]&&(_0x107a07['onProgress']?.({'type':_0x5cbe4a(0x198),'segmentName':_0x364981,'activationName':_0xb5602b[_0x5cbe4a(0x237)]}),await _0x107a07[_0x5cbe4a(0x157)](_0x5cbe4a(0x155)+_0xb5602b['name']+_0x5cbe4a(0x156),()=>_0x5d2a83['segment'][_0x5cbe4a(0x1ff)](_0x44b1ff,_0x521626,_0xb5602b[_0x5cbe4a(0x22a)]['id'])),_0x107a07[_0x5cbe4a(0x1c4)]?.({'type':_0x5cbe4a(0x205),'segmentName':_0x364981,'activationName':_0xb5602b[_0x5cbe4a(0x237)]}),_0x107a07['logDeleted']?.(_0x5cbe4a(0x1f4)+_0xb5602b['name']+'\x27'),_0x5d8021['deleted']++);}}catch(_0x47ba08){const _0x27be3f=isHttp400Error(_0x47ba08),_0x36e5b0=_0x27be3f?ErrorCode[_0x5cbe4a(0x190)]:ErrorCode[_0x5cbe4a(0x17c)],_0x33a2c5=getErrorMessage(_0x47ba08);throw new SDKError(_0x36e5b0,_0x5cbe4a(0x143)+_0xb5602b[_0x5cbe4a(0x1c3)]+_0x5cbe4a(0x14d)+_0xb5602b[_0x5cbe4a(0x237)]+_0x5cbe4a(0x215)+_0x3e124e+_0x5cbe4a(0x1e4)+_0x33a2c5,_0x47ba08);}}return _0x5d8021;}export async function executePushFolders(_0x349b37,_0x3d66e5,_0x4752b2,_0x12fd31,_0x2154e4){const _0x105970=a114_0x2ffb8c,_0x7b26ae=new Map(_0x4752b2);for(const _0x35ff36 of _0x3d66e5){const _0x4dcdda=_0x35ff36['split']('/'),_0x8f3de5=_0x4dcdda[_0x4dcdda[_0x105970(0x176)]-0x1],_0x16d533=_0x4dcdda['slice'](0x0,-0x1)['join']('/'),_0x2b84df=_0x7b26ae[_0x105970(0x15a)](_0x16d533);_0x2154e4[_0x105970(0x1c4)]?.({'type':_0x105970(0x16a),'folder':_0x35ff36});const _0x1004f1={'name':_0x8f3de5,'parentFolderId':_0x2b84df},_0x5e63b7=await _0x2154e4['withProgress'](_0x105970(0x1ae)+_0x35ff36+_0x105970(0x156),()=>_0x349b37[_0x105970(0x1a7)][_0x105970(0x13b)](_0x12fd31[_0x105970(0x172)],_0x1004f1));_0x7b26ae['set'](_0x35ff36,_0x5e63b7[_0x105970(0x1f3)]['id']),_0x2154e4[_0x105970(0x1c4)]?.({'type':_0x105970(0x1d6),'folder':_0x35ff36,'folderId':_0x5e63b7[_0x105970(0x1f3)]['id']}),_0x2154e4[_0x105970(0x1d3)]?.(_0x105970(0x1e3)+_0x35ff36+'\x27');}return _0x7b26ae;}export async function executePushSegmentDeletions(_0x4a629a,_0x3ef24d,_0x27adce){if(_0x3ef24d['length']===0x0)return 0x0;const {batchAsync:_0x27c244}=await import('../../utils/async.js'),_0x523e9c=0x5,_0x4c9808=await _0x27c244(_0x3ef24d,async _0x3d8448=>{const _0x2cc88a=a114_0x3577;return _0x27adce[_0x2cc88a(0x1c4)]?.({'type':_0x2cc88a(0x1d8),'name':_0x3d8448[_0x2cc88a(0x237)]}),await _0x4a629a[_0x2cc88a(0x1a7)][_0x2cc88a(0x19d)](_0x3d8448['id']),_0x27adce['onProgress']?.({'type':'segment_deleted','name':_0x3d8448[_0x2cc88a(0x237)]}),_0x27adce[_0x2cc88a(0x1e5)]?.(_0x2cc88a(0x1d1)+_0x3d8448['name']+'\x27'),0x1;},_0x523e9c);return _0x4c9808['reduce']((_0x8f912,_0x309bac)=>_0x8f912+_0x309bac,0x0);}export async function executePushJourneys(_0x29848f,_0x488568,_0x54bc10,_0x2300b1,_0x4e4f4b){const _0x3d7ee2=a114_0x2ffb8c,{journeyDefToRequest:_0x16c4f7}=await import(_0x3d7ee2(0x22d)),{activationDefToCreateRequest:_0xb7924f,yamlRuleToApi:_0xec12b4,validateSegmentRule:_0x2fd1dc}=await import(_0x3d7ee2(0x1cc)),_0x3e4924={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x582de0=new Map(_0x54bc10['segmentNameToId']),_0x5532e9=0x5;for(let _0x3e75c8=0x0;_0x3e75c8<_0x488568[_0x3d7ee2(0x176)];_0x3e75c8+=_0x5532e9){const _0x348bc7=_0x488568[_0x3d7ee2(0x21b)](_0x3e75c8,_0x3e75c8+_0x5532e9),_0x3b5eaf=await Promise[_0x3d7ee2(0x214)](_0x348bc7[_0x3d7ee2(0x1f5)](async _0x217fa2=>{const _0x3d5e99=_0x3d7ee2;if(!_0x217fa2[_0x3d5e99(0x197)]&&!_0x217fa2[_0x3d5e99(0x230)])return{'action':'unchanged','name':_0x217fa2['yamlConfig'][_0x3d5e99(0x237)],'journeyId':_0x217fa2[_0x3d5e99(0x16f)]?.['id']};const _0x1feb23=_0x217fa2[_0x3d5e99(0x188)]?_0x54bc10['folderPathToId'][_0x3d5e99(0x15a)](_0x217fa2[_0x3d5e99(0x188)]):undefined;_0x4e4f4b['onProgress']?.({'type':_0x217fa2[_0x3d5e99(0x197)]?_0x3d5e99(0x1b4):_0x3d5e99(0x144),'name':_0x217fa2[_0x3d5e99(0x191)][_0x3d5e99(0x237)]});try{const _0x1bca72=await executeSingleJourneyPush(_0x29848f,_0x217fa2,{..._0x54bc10,'segmentNameToId':_0x582de0},{'parentId':_0x2300b1['parentId'],'rootFolderId':_0x2300b1[_0x3d5e99(0x200)],'folderId':_0x1feb23,'verbose':_0x2300b1[_0x3d5e99(0x153)]},_0x4e4f4b,{'journeyDefToRequest':_0x16c4f7,'activationDefToCreateRequest':_0xb7924f,'yamlRuleToApi':_0xec12b4,'validateSegmentRule':_0x2fd1dc});for(const [_0xdc83e6,_0x8dd272]of _0x1bca72[_0x3d5e99(0x21a)]){_0x582de0[_0x3d5e99(0x18c)](_0xdc83e6,_0x8dd272),_0x3e4924[_0x3d5e99(0x21a)]['set'](_0xdc83e6,_0x8dd272);}if(_0x1bca72[_0x3d5e99(0x1c5)]===_0x3d5e99(0x184))_0x4e4f4b['onProgress']?.({'type':_0x3d5e99(0x161),'name':_0x217fa2[_0x3d5e99(0x191)][_0x3d5e99(0x237)],'journeyId':_0x1bca72[_0x3d5e99(0x222)]}),_0x4e4f4b[_0x3d5e99(0x1bc)]?.(_0x3d5e99(0x18f)+_0x217fa2[_0x3d5e99(0x191)][_0x3d5e99(0x237)]+'\x27'),_0x3e4924[_0x3d5e99(0x184)]++;else _0x1bca72[_0x3d5e99(0x1c5)]===_0x3d5e99(0x1fa)&&(_0x4e4f4b[_0x3d5e99(0x1c4)]?.({'type':_0x3d5e99(0x1a8),'name':_0x217fa2[_0x3d5e99(0x191)][_0x3d5e99(0x237)]}),_0x4e4f4b[_0x3d5e99(0x1bc)]?.(_0x3d5e99(0x20c)+_0x217fa2['yamlConfig'][_0x3d5e99(0x237)]+'\x27'),_0x3e4924[_0x3d5e99(0x1fa)]++);return{'action':_0x1bca72[_0x3d5e99(0x1c5)],'name':_0x217fa2['yamlConfig']['name'],'journeyId':_0x1bca72[_0x3d5e99(0x222)]};}catch(_0x3490d2){const _0x21b0fc=isHttp400Error(_0x3490d2),_0x428f8f=_0x21b0fc?ErrorCode[_0x3d5e99(0x1a0)]:ErrorCode[_0x3d5e99(0x1c8)],_0x44fdbe=getErrorMessage(_0x3490d2);throw new SDKError(_0x428f8f,_0x3d5e99(0x143)+(_0x217fa2[_0x3d5e99(0x197)]?'create':_0x3d5e99(0x149))+'\x20journey\x20from\x20file:\x20'+_0x217fa2[_0x3d5e99(0x142)]+'\x0a\x20\x20'+_0x44fdbe,_0x3490d2);}}));_0x3e4924[_0x3d7ee2(0x146)][_0x3d7ee2(0x139)](..._0x3b5eaf);}return _0x3e4924;}async function matchExistingJourneySegments(_0x390ae4,_0x4a6146,_0x6c06a3,_0xe7875d,_0x20e180){const _0x43a8d1=a114_0x2ffb8c;if(!_0x4a6146[_0x43a8d1(0x16f)]||!_0x4a6146['yamlConfig'][_0x43a8d1(0x170)])return;const _0x47af3e=new Map();for(const _0x11b7b2 of Object[_0x43a8d1(0x192)](_0x4a6146[_0x43a8d1(0x191)][_0x43a8d1(0x170)])){const _0x47ea5d=generateDeterministicJourneySegmentName(_0x4a6146['yamlConfig'][_0x43a8d1(0x237)],_0x11b7b2);_0x47af3e[_0x43a8d1(0x18c)](_0x47ea5d,_0x11b7b2);}const _0x3da753=collectSegmentIdsFromJourneyApi(_0x4a6146[_0x43a8d1(0x16f)]);for(const _0x178413 of _0x3da753){const _0x1ef1c7=await fetchSegment(_0x390ae4,_0x6c06a3,_0x178413,_0xe7875d);if(!_0x1ef1c7?.[_0x43a8d1(0x237)])continue;const _0x3349e5=_0x47af3e[_0x43a8d1(0x15a)](_0x1ef1c7[_0x43a8d1(0x237)]);_0x3349e5&&_0x20e180[_0x43a8d1(0x18c)](_0x3349e5,_0x178413);}}async function executeSingleJourneyPush(_0x313ca9,_0x38e64b,_0x8bca96,_0x1b3d71,_0x559926,_0x473ff2){const _0x3b6d7d=a114_0x2ffb8c,{journeyDefToRequest:_0x5db2f8,activationDefToCreateRequest:_0x466ecd,yamlRuleToApi:_0x55418a,validateSegmentRule:_0x15bfdc}=_0x473ff2,_0x4696bc=new Map(),_0xb1b21f=new Map();recoverSegmentIdsFromPushRecovery(_0x38e64b,_0x4696bc,_0x8bca96[_0x3b6d7d(0x14c)]);const _0x1a6dd5=new Map(),_0x4a35e3=new Map(),_0x2937d9=new Map();let _0x587cd3;const _0x2c498a=async()=>{const _0x468f6e=_0x3b6d7d;if(_0x587cd3)return;_0x587cd3=new Map();if(!_0x38e64b['existingJourney'])return;const _0x43e88d=await _0x313ca9[_0x468f6e(0x21c)][_0x468f6e(0x165)](_0x38e64b[_0x468f6e(0x16f)]['id']);for(const _0x152e53 of _0x43e88d){const _0x30398b=journeyActivationStepToYaml(_0x152e53,_0x8bca96[_0x468f6e(0x1bd)],_0x8bca96[_0x468f6e(0x231)]),_0xf43d80=activationSignature(_0x30398b);!_0x587cd3[_0x468f6e(0x167)](_0xf43d80)&&_0x587cd3[_0x468f6e(0x18c)](_0xf43d80,_0x152e53['id']),_0x30398b[_0x468f6e(0x237)]&&_0xb1b21f[_0x468f6e(0x18c)](_0x30398b[_0x468f6e(0x237)],_0x152e53['id']);}};await matchExistingJourneySegments(_0x313ca9,_0x38e64b,_0x1b3d71['parentId'],_0x8bca96[_0x3b6d7d(0x18a)],_0x8bca96[_0x3b6d7d(0x14c)]);const _0x1a2169={'resolveSegmentId':async _0x8d0612=>{const _0x4774d7=_0x3b6d7d,_0x5c9e43=_0x8bca96[_0x4774d7(0x14c)]['get'](_0x8d0612);if(!_0x5c9e43)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4774d7(0x13c)+_0x8d0612+'\x20(referenced\x20in\x20journey\x20'+_0x38e64b['yamlConfig']['name']+')');return _0x5c9e43;},'resolveEmbeddedSegmentId':async(_0x18626d,_0x5d1006)=>{const _0x35a2fb=_0x3b6d7d,_0x3f9ee8=_0x8bca96[_0x35a2fb(0x14c)]['get'](_0x18626d);if(_0x3f9ee8)return _0x3f9ee8;const _0x5ba444=_0x8bca96[_0x35a2fb(0x18a)][_0x35a2fb(0x140)](_0x1b942d=>_0x1b942d[_0x35a2fb(0x237)]===_0x18626d);if(_0x5ba444)return _0x8bca96[_0x35a2fb(0x14c)]['set'](_0x18626d,_0x5ba444['id']),_0x5ba444['id'];if(_0x38e64b[_0x35a2fb(0x197)]){const {stageName:_0x1b04c8,criteriaName:_0x3c08a2}=findSegmentCriteriaLocation(_0x38e64b[_0x35a2fb(0x191)],_0x18626d);return _0x15bfdc(_0x18626d,_0x5d1006[_0x35a2fb(0x206)]),_0x4a35e3[_0x35a2fb(0x18c)](_0x18626d,{'definition':_0x5d1006,'stageName':_0x1b04c8,'criteriaName':_0x3c08a2}),createPendingSegmentId(_0x18626d);}const _0xc0ffc8=_0x38e64b[_0x35a2fb(0x16f)]?.['id'];if(!_0xc0ffc8)throw new SDKError(ErrorCode['INTERNAL'],_0x35a2fb(0x1aa));const _0x3e7e4a=_0x1a6dd5[_0x35a2fb(0x15a)](_0x18626d);if(_0x3e7e4a)return _0x3e7e4a;const _0x338f5f=((async()=>{const _0xa9efba=_0x35a2fb;_0x15bfdc(_0x18626d,_0x5d1006[_0xa9efba(0x206)]);const _0x2fbe3d=generateDeterministicJourneySegmentName(_0x38e64b[_0xa9efba(0x191)][_0xa9efba(0x237)],_0x18626d),_0x10075b=_0x8bca96['existingSegments'][_0xa9efba(0x140)](_0x572b79=>_0x572b79['name']===_0x2fbe3d),_0x21a268=createSegmentIdResolver(_0x8bca96[_0xa9efba(0x14c)],_0x18626d),_0x4dd505=await resolveRuleSegmentIds(_0x5d1006[_0xa9efba(0x206)],_0x21a268);let _0x5df4cb;return _0x10075b?(await _0x313ca9['segment'][_0xa9efba(0x1a6)](_0x1b3d71['parentId'],_0x10075b['id'],{'description':_0x5d1006['description']||_0xa9efba(0x1fb)+_0x18626d,'rule':_0x55418a(_0x4dd505,!![]),'countPopulation':!![]}),_0x5df4cb=_0x10075b['id'],saveSegmentToPushRecovery(_0x38e64b['absolutePath'],_0x38e64b[_0xa9efba(0x191)][_0xa9efba(0x237)],_0x18626d,{'segmentId':_0x5df4cb,'uniqueServerName':_0x2fbe3d,'createdAt':new Date()['toISOString']()})):_0x5df4cb=await createOrRecoverEmbeddedSegment(_0x313ca9,_0x38e64b,{'localName':_0x18626d,'uniqueSegmentName':_0x2fbe3d,'description':_0x5d1006[_0xa9efba(0x1b7)]||_0xa9efba(0x1fb)+_0x18626d,'journeyId':_0xc0ffc8,'resolvedRule':_0x4dd505,'parentId':_0x1b3d71[_0xa9efba(0x172)],'folderId':_0x1b3d71[_0xa9efba(0x200)]||''},_0x55418a),_0x8bca96[_0xa9efba(0x14c)][_0xa9efba(0x18c)](_0x18626d,_0x5df4cb),_0x4696bc[_0xa9efba(0x18c)](_0x18626d,_0x5df4cb),_0x5df4cb;})());_0x1a6dd5[_0x35a2fb(0x18c)](_0x18626d,_0x338f5f);try{return await _0x338f5f;}finally{_0x1a6dd5['delete'](_0x18626d);}},'resolveActivationId':async _0x5db86f=>{const _0x1eee4f=_0x3b6d7d,_0x118a43=_0xb1b21f[_0x1eee4f(0x15a)](_0x5db86f);if(_0x118a43)return _0x118a43;if(_0x38e64b['existingJourney']){await _0x2c498a();const _0x3352ee=_0xb1b21f[_0x1eee4f(0x15a)](_0x5db86f);if(_0x3352ee)return _0x3352ee;}throw new SDKError(ErrorCode[_0x1eee4f(0x196)],'Activation\x20not\x20found:\x20'+_0x5db86f+_0x1eee4f(0x1da)+_0x38e64b[_0x1eee4f(0x191)][_0x1eee4f(0x237)]+').\x20'+_0x1eee4f(0x17e));},'resolveEmbeddedActivationId':async(_0x280f88,_0x2b5f37)=>{const _0x1870c4=_0x3b6d7d,_0x3c5916=_0xb1b21f[_0x1870c4(0x15a)](_0x280f88);if(_0x3c5916)return _0x3c5916;if(_0x38e64b['isNew'])return _0x2937d9['set'](_0x280f88,_0x2b5f37),createPendingActivationId(_0x280f88);if(_0x38e64b[_0x1870c4(0x16f)]){await _0x2c498a();const _0x546421=_0xb1b21f['get'](_0x2b5f37[_0x1870c4(0x237)]);if(_0x546421)return _0xb1b21f[_0x1870c4(0x18c)](_0x280f88,_0x546421),_0x546421;const _0x1b5206=activationSignature(_0x2b5f37),_0x568911=_0x587cd3?.[_0x1870c4(0x15a)](_0x1b5206);if(_0x568911)return _0xb1b21f[_0x1870c4(0x18c)](_0x280f88,_0x568911),_0x568911;const _0x124907=await _0x466ecd(_0x2b5f37,_0x8bca96[_0x1870c4(0x181)]),_0x5ce6a3={..._0x124907,..._0x2b5f37[_0x1870c4(0x1c1)]!==undefined&&{'runAfterJourneyRefresh':_0x2b5f37[_0x1870c4(0x1c1)]}},_0x13a21e=await _0x313ca9[_0x1870c4(0x21c)][_0x1870c4(0x236)](_0x38e64b[_0x1870c4(0x16f)]['id'],_0x5ce6a3);return _0xb1b21f[_0x1870c4(0x18c)](_0x280f88,_0x13a21e['id']),_0x13a21e['id'];}throw new SDKError(ErrorCode[_0x1870c4(0x1f1)],_0x1870c4(0x1cd));},'resolveJourneyId':async _0x7593d4=>{const _0xca978c=_0x3b6d7d;try{return await _0x313ca9[_0xca978c(0x21c)][_0xca978c(0x20a)](_0x1b3d71[_0xca978c(0x172)],_0x7593d4);}catch(_0x4d34ba){throw new SDKError(ErrorCode[_0xca978c(0x196)],_0xca978c(0x1bb)+_0x7593d4+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x38e64b['yamlConfig'][_0xca978c(0x237)]+'\x27)',_0x4d34ba);}},'resolveStageId':async(_0x107146,_0x3d732b)=>{const _0x544254=_0x3b6d7d,_0x3edba4=await _0x313ca9[_0x544254(0x21c)][_0x544254(0x18d)](_0x107146),_0x448fc5=_0x3edba4[_0x544254(0x150)][_0x544254(0x15c)][_0x544254(0x140)](_0x10d7dc=>_0x10d7dc[_0x544254(0x237)][_0x544254(0x186)]()===_0x3d732b[_0x544254(0x186)]());if(!_0x448fc5?.['id'])throw new SDKError(ErrorCode[_0x544254(0x196)],_0x544254(0x1b6)+_0x3d732b+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x3edba4[_0x544254(0x150)][_0x544254(0x199)]||_0x3edba4[_0x544254(0x150)][_0x544254(0x237)])+'\x27');return _0x448fc5['id'];}},_0x5295d9=await _0x5db2f8(_0x38e64b[_0x3b6d7d(0x191)],_0x1b3d71[_0x3b6d7d(0x172)],_0x1a2169),_0x2555fe=_0x1b3d71['folderId']||_0x1b3d71['rootFolderId'];_0x2555fe&&(_0x5295d9[_0x3b6d7d(0x208)]={'parentFolder':{'data':{'id':_0x2555fe,'type':_0x3b6d7d(0x1fd)}}});if(_0x38e64b[_0x3b6d7d(0x197)]){if(_0x4a35e3[_0x3b6d7d(0x1a3)]>0x0||_0x2937d9['size']>0x0)return await executeThreeStepJourneyCreate(_0x313ca9,_0x38e64b,_0x5295d9,{'pendingEmbeddedSegments':_0x4a35e3,'pendingEmbeddedActivations':_0x2937d9,'embeddedSegmentNameToId':_0x4696bc,'journeyActivationNameToId':_0xb1b21f},{..._0x1b3d71,'effectiveFolderId':_0x2555fe},_0x8bca96,_0x559926,_0x473ff2);else{ensureJourneyDefaults(_0x5295d9['attributes']);const _0x4e266c=await _0x313ca9['journey'][_0x3b6d7d(0x21f)](_0x5295d9);return deletePushRecovery(_0x38e64b[_0x3b6d7d(0x142)]),{'action':'created','journeyId':_0x4e266c['id'],'embeddedSegmentNameToId':_0x4696bc};}}else{if(_0x38e64b['hasChanges']&&_0x38e64b['existingJourney'])return ensureJourneyDefaults(_0x5295d9[_0x3b6d7d(0x150)]),await _0x313ca9[_0x3b6d7d(0x21c)][_0x3b6d7d(0x149)](_0x38e64b[_0x3b6d7d(0x16f)]['id'],_0x5295d9),deletePushRecovery(_0x38e64b[_0x3b6d7d(0x142)]),{'action':_0x3b6d7d(0x1fa),'journeyId':_0x38e64b[_0x3b6d7d(0x16f)]['id'],'embeddedSegmentNameToId':_0x4696bc};}return deletePushRecovery(_0x38e64b['absolutePath']),{'action':'unchanged','journeyId':_0x38e64b['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x4696bc};}function findSegmentCriteriaLocation(_0x3ca499,_0x4d64a0){const _0x2a8fe1=a114_0x2ffb8c,_0x228d2c=_0x3ca499[_0x2a8fe1(0x193)]||_0x3ca499[_0x2a8fe1(0x1d5)]?.[0x0]?.[_0x2a8fe1(0x193)]||[];let _0x21ceb3=_0x2a8fe1(0x14e),_0x913995=_0x4d64a0;const _0x2b8e74=_0x3ca499[_0x2a8fe1(0x17a)]||_0x3ca499['journeys']?.[0x0]?.[_0x2a8fe1(0x17a)];if(_0x2b8e74?.[_0x2a8fe1(0x1a7)]===_0x4d64a0)return{'stageName':_0x2a8fe1(0x17a),'criteriaName':_0x2b8e74['name']||_0x4d64a0};_0x33bf75:for(const _0x290fda of _0x228d2c){if(_0x290fda['entry_criteria']?.[_0x2a8fe1(0x1a7)]===_0x4d64a0){_0x21ceb3=_0x290fda[_0x2a8fe1(0x237)],_0x913995=_0x290fda['entry_criteria'][_0x2a8fe1(0x237)]||_0x4d64a0;break;}if(_0x290fda[_0x2a8fe1(0x17d)])for(const _0x45a69e of _0x290fda[_0x2a8fe1(0x17d)]){if(_0x45a69e[_0x2a8fe1(0x1c3)]===_0x2a8fe1(0x1de)&&_0x45a69e[_0x2a8fe1(0x1ec)]?.[_0x2a8fe1(0x211)])for(const _0xee3338 of _0x45a69e[_0x2a8fe1(0x1ec)]['branches']){if(_0xee3338[_0x2a8fe1(0x1a7)]===_0x4d64a0){_0x21ceb3=_0x290fda[_0x2a8fe1(0x237)],_0x913995=_0xee3338[_0x2a8fe1(0x237)]||_0x4d64a0;break _0x33bf75;}}}}return{'stageName':_0x21ceb3,'criteriaName':_0x913995};}async function executeThreeStepJourneyCreate(_0x5d4878,_0x179e10,_0x26ca32,_0x39587f,_0x5f3d78,_0x802ed2,_0x2aa56d,_0x442265){const _0x603236=a114_0x2ffb8c,{activationDefToCreateRequest:_0x29237e,yamlRuleToApi:_0x27b7e8}=_0x442265,{pendingEmbeddedSegments:_0x497f54,pendingEmbeddedActivations:_0x27a9f0,embeddedSegmentNameToId:_0x2b26f1}=_0x39587f,_0x3e7d39=JSON[_0x603236(0x17b)](JSON[_0x603236(0x1f8)](_0x26ca32));ensureJourneyDefaults(_0x3e7d39[_0x603236(0x150)]),stripPendingIds(_0x3e7d39);const _0x150bfa=await _0x5d4878['journey']['create'](_0x3e7d39),_0x56e3ea=_0x150bfa['id'],_0x407ff3=new Map();for(const _0x396469 of _0x150bfa['attributes'][_0x603236(0x15c)]){_0x407ff3[_0x603236(0x18c)](_0x396469[_0x603236(0x237)]['toLowerCase'](),_0x396469['id']);}recoverSegmentIdsFromPushRecovery(_0x179e10,_0x2b26f1,_0x802ed2['segmentNameToId']);for(const [_0x464e95,{definition:_0x14812e}]of _0x497f54){if(_0x2b26f1['has'](_0x464e95)){_0x2aa56d[_0x603236(0x1c4)]?.({'type':_0x603236(0x14a),'journeyName':_0x179e10[_0x603236(0x191)][_0x603236(0x237)],'segmentName':_0x464e95});continue;}const _0x86c446=generateDeterministicJourneySegmentName(_0x179e10[_0x603236(0x191)][_0x603236(0x237)],_0x464e95);_0x2aa56d[_0x603236(0x1c4)]?.({'type':_0x603236(0x20f),'journeyName':_0x179e10[_0x603236(0x191)][_0x603236(0x237)],'segmentName':_0x464e95});const _0x4da33a=createSegmentIdResolver(_0x802ed2['segmentNameToId'],_0x464e95),_0x393ee7=await resolveRuleSegmentIds(_0x14812e[_0x603236(0x206)],_0x4da33a),_0x595857=await createOrRecoverEmbeddedSegment(_0x5d4878,_0x179e10,{'localName':_0x464e95,'uniqueSegmentName':_0x86c446,'description':_0x14812e[_0x603236(0x1b7)]||'Entry\x20criteria:\x20'+_0x464e95,'journeyId':_0x56e3ea,'resolvedRule':_0x393ee7,'parentId':_0x5f3d78[_0x603236(0x172)],'folderId':_0x5f3d78['effectiveFolderId']||''},_0x27b7e8);_0x2b26f1['set'](_0x464e95,_0x595857),_0x802ed2[_0x603236(0x14c)]['set'](_0x464e95,_0x595857),_0x2aa56d[_0x603236(0x1c4)]?.({'type':'embedded_segment_created','journeyName':_0x179e10['yamlConfig'][_0x603236(0x237)],'segmentName':_0x464e95});}const _0x5170de=new Map();for(const [_0x2b79e0,_0x355d4d]of _0x27a9f0){_0x2aa56d['onProgress']?.({'type':_0x603236(0x147),'journeyName':_0x179e10[_0x603236(0x191)][_0x603236(0x237)],'activationName':_0x2b79e0});const _0x936cbd=await _0x29237e(_0x355d4d,_0x802ed2[_0x603236(0x181)]),_0x3c250f={..._0x936cbd,..._0x355d4d[_0x603236(0x1c1)]!==undefined&&{'runAfterJourneyRefresh':_0x355d4d['run_after_journey_refresh']}},_0x1936a5=await _0x5d4878[_0x603236(0x21c)][_0x603236(0x236)](_0x56e3ea,_0x3c250f);_0x5170de[_0x603236(0x18c)](_0x2b79e0,_0x1936a5['id']),_0x39587f['journeyActivationNameToId'][_0x603236(0x18c)](_0x2b79e0,_0x1936a5['id']),_0x2aa56d['onProgress']?.({'type':'embedded_activation_created','journeyName':_0x179e10['yamlConfig'][_0x603236(0x237)],'activationName':_0x2b79e0});}const _0x20baf5=JSON[_0x603236(0x17b)](JSON[_0x603236(0x1f8)](_0x26ca32));return _0x20baf5['id']=_0x56e3ea,ensureJourneyDefaults(_0x20baf5[_0x603236(0x150)]),resolvePendingIdsInRequest(_0x20baf5,_0x26ca32,_0x407ff3,_0x2b26f1,_0x5170de,_0x2aa56d),await _0x5d4878[_0x603236(0x21c)][_0x603236(0x149)](_0x56e3ea,_0x20baf5),deletePushRecovery(_0x179e10[_0x603236(0x142)]),{'action':_0x603236(0x184),'journeyId':_0x56e3ea,'embeddedSegmentNameToId':_0x2b26f1};}export function stripWaitStepPendingIds(_0x522bbf){const _0x373c76=a114_0x2ffb8c,_0x55dd3d=_0x522bbf[_0x373c76(0x152)]&&isPendingSegmentId(_0x522bbf[_0x373c76(0x152)]),_0x2c3301=_0x522bbf[_0x373c76(0x16c)]?.['some'](_0x511782=>_0x511782[_0x373c76(0x1e8)]&&isPendingSegmentId(_0x511782[_0x373c76(0x1e8)]));(_0x55dd3d||_0x2c3301)&&(_0x522bbf['waitStepType']='Duration',_0x522bbf['waitStep']=0x1,_0x522bbf['waitStepUnit']=_0x373c76(0x15f),delete _0x522bbf['conditionSegmentId'],delete _0x522bbf[_0x373c76(0x1ed)],delete _0x522bbf['conditionTimeoutUnit'],delete _0x522bbf[_0x373c76(0x16c)]);}export function resolveWaitStepPendingIds(_0x5200b9,_0x3fd251,_0x3ad2ca,_0x8d68d3){const _0x5a5051=a114_0x2ffb8c;if(_0x3fd251[_0x5a5051(0x152)]&&isPendingSegmentId(_0x3fd251[_0x5a5051(0x152)])){const _0x5a3ddd=_0x3ad2ca(_0x3fd251[_0x5a5051(0x152)],'stage\x20\x27'+_0x8d68d3+'\x27\x20wait\x20condition');_0x5a3ddd&&(_0x5200b9[_0x5a5051(0x1b9)]=_0x5a5051(0x1b0),_0x5200b9[_0x5a5051(0x152)]=_0x5a3ddd,delete _0x5200b9['waitStep'],delete _0x5200b9[_0x5a5051(0x173)],_0x3fd251['conditionTimeoutDuration']!==undefined&&(_0x5200b9[_0x5a5051(0x1ed)]=_0x3fd251['conditionTimeoutDuration']),_0x3fd251[_0x5a5051(0x1cf)]&&(_0x5200b9[_0x5a5051(0x1cf)]=_0x3fd251[_0x5a5051(0x1cf)]));}if(_0x3fd251[_0x5a5051(0x16c)]){const _0x2c99bc=_0x3fd251['conditions'][_0x5a5051(0x1d4)](_0x38c4c7=>_0x38c4c7['segmentId']&&isPendingSegmentId(_0x38c4c7['segmentId']));if(_0x2c99bc){const _0x5b47b6=_0x3fd251[_0x5a5051(0x16c)][_0x5a5051(0x1f5)](_0x189d4a=>{const _0x146298=_0x5a5051;if(_0x189d4a['segmentId']&&isPendingSegmentId(_0x189d4a[_0x146298(0x1e8)])){const _0x57936a=_0x3ad2ca(_0x189d4a['segmentId'],_0x146298(0x1a5)+_0x8d68d3+_0x146298(0x14b));return{..._0x189d4a,'segmentId':_0x57936a||_0x189d4a['segmentId']};}return{..._0x189d4a};});_0x5200b9[_0x5a5051(0x1b9)]='Condition',_0x5200b9[_0x5a5051(0x16c)]=_0x5b47b6,delete _0x5200b9[_0x5a5051(0x1f0)],delete _0x5200b9[_0x5a5051(0x173)],delete _0x5200b9[_0x5a5051(0x152)],delete _0x5200b9[_0x5a5051(0x1ed)],delete _0x5200b9['conditionTimeoutUnit'];}}}function stripPendingIds(_0x251ece){const _0x2872c5=a114_0x2ffb8c;_0x251ece[_0x2872c5(0x150)][_0x2872c5(0x17a)]?.[_0x2872c5(0x1e8)]&&isPendingSegmentId(_0x251ece[_0x2872c5(0x150)][_0x2872c5(0x17a)]['segmentId'])&&delete _0x251ece[_0x2872c5(0x150)]['goal'];for(const _0x579786 of _0x251ece[_0x2872c5(0x150)][_0x2872c5(0x15c)]||[]){_0x579786['entryCriteria']?.[_0x2872c5(0x1e8)]&&isPendingSegmentId(_0x579786[_0x2872c5(0x1e6)]['segmentId'])&&delete _0x579786[_0x2872c5(0x1e6)];_0x579786[_0x2872c5(0x1ca)]?.['segmentId']&&isPendingSegmentId(_0x579786[_0x2872c5(0x1ca)][_0x2872c5(0x1e8)])&&delete _0x579786[_0x2872c5(0x1ca)];_0x579786[_0x2872c5(0x154)]&&(_0x579786[_0x2872c5(0x154)]=_0x579786['exitCriterias'][_0x2872c5(0x1ea)](_0x5d7c84=>!_0x5d7c84['segmentId']||!isPendingSegmentId(_0x5d7c84[_0x2872c5(0x1e8)])));if(_0x579786[_0x2872c5(0x17d)])for(const _0x46bf5c of Object[_0x2872c5(0x192)](_0x579786[_0x2872c5(0x17d)])){const _0x5cbff4=_0x579786[_0x2872c5(0x17d)][_0x46bf5c];_0x5cbff4[_0x2872c5(0x1c3)]===_0x2872c5(0x151)&&_0x5cbff4[_0x2872c5(0x1eb)]&&isPendingActivationId(_0x5cbff4[_0x2872c5(0x1eb)])&&(_0x5cbff4[_0x2872c5(0x1eb)]='');if(_0x5cbff4[_0x2872c5(0x1c3)]===_0x2872c5(0x224)&&_0x5cbff4['branches'])for(const _0x47565a of _0x5cbff4[_0x2872c5(0x211)]){_0x47565a['segmentId']&&isPendingSegmentId(_0x47565a[_0x2872c5(0x1e8)])&&(_0x47565a['segmentId']='');}_0x5cbff4[_0x2872c5(0x1c3)]==='WaitStep'&&stripWaitStepPendingIds(_0x5cbff4);}}}function resolvePendingIdsInRequest(_0x2f3616,_0x209c43,_0x561883,_0x2e9078,_0x104023,_0x55b6af){const _0x5a90d3=a114_0x2ffb8c,_0x2d19fb=(_0x5a41b8,_0x1e1b9f)=>{const _0x209830=a114_0x3577;if(!isPendingSegmentId(_0x5a41b8))return _0x5a41b8;const _0x5f1531=extractPendingSegmentName(_0x5a41b8),_0x470709=_0x2e9078['get'](_0x5f1531);return!_0x470709&&_0x55b6af[_0x209830(0x21d)]?.(_0x209830(0x1e0)+_0x5f1531+'\x27\x20for\x20'+_0x1e1b9f),_0x470709;};if(_0x2f3616[_0x5a90d3(0x150)][_0x5a90d3(0x17a)]?.[_0x5a90d3(0x1e8)]&&isPendingSegmentId(_0x2f3616[_0x5a90d3(0x150)]['goal'][_0x5a90d3(0x1e8)])){const _0x4a9fee=_0x2d19fb(_0x2f3616[_0x5a90d3(0x150)][_0x5a90d3(0x17a)]['segmentId'],_0x5a90d3(0x1dc));_0x4a9fee&&(_0x2f3616[_0x5a90d3(0x150)]['goal'][_0x5a90d3(0x1e8)]=_0x4a9fee);}for(const _0x1eec0d of _0x2f3616['attributes'][_0x5a90d3(0x15c)]||[]){const _0x198fec=_0x561883[_0x5a90d3(0x15a)](_0x1eec0d[_0x5a90d3(0x237)][_0x5a90d3(0x186)]());_0x198fec&&(_0x1eec0d['id']=_0x198fec);if(_0x1eec0d[_0x5a90d3(0x1e6)]?.[_0x5a90d3(0x1e8)]&&isPendingSegmentId(_0x1eec0d[_0x5a90d3(0x1e6)]['segmentId'])){const _0x1c929e=_0x2d19fb(_0x1eec0d['entryCriteria'][_0x5a90d3(0x1e8)],_0x5a90d3(0x1a5)+_0x1eec0d[_0x5a90d3(0x237)]+_0x5a90d3(0x235));_0x1c929e&&(_0x1eec0d['entryCriteria'][_0x5a90d3(0x1e8)]=_0x1c929e);}if(_0x1eec0d[_0x5a90d3(0x154)])for(const _0x4e8f23 of _0x1eec0d[_0x5a90d3(0x154)]){if(_0x4e8f23['segmentId']&&isPendingSegmentId(_0x4e8f23['segmentId'])){const _0xa45ef5=_0x2d19fb(_0x4e8f23[_0x5a90d3(0x1e8)],'stage\x20\x27'+_0x1eec0d['name']+_0x5a90d3(0x187));_0xa45ef5&&(_0x4e8f23[_0x5a90d3(0x1e8)]=_0xa45ef5);}}if(_0x1eec0d['milestone']?.[_0x5a90d3(0x1e8)]&&isPendingSegmentId(_0x1eec0d[_0x5a90d3(0x1ca)][_0x5a90d3(0x1e8)])){const _0x4d6bd5=_0x2d19fb(_0x1eec0d[_0x5a90d3(0x1ca)][_0x5a90d3(0x1e8)],_0x5a90d3(0x1a5)+_0x1eec0d[_0x5a90d3(0x237)]+_0x5a90d3(0x1ac));_0x4d6bd5&&(_0x1eec0d[_0x5a90d3(0x1ca)]['segmentId']=_0x4d6bd5);}if(_0x1eec0d[_0x5a90d3(0x17d)]){const _0xec1fc1=_0x4692eb=>_0x209c43[_0x5a90d3(0x150)][_0x5a90d3(0x15c)]?.[_0x5a90d3(0x140)](_0x52726f=>_0x52726f[_0x5a90d3(0x237)]['toLowerCase']()===_0x1eec0d[_0x5a90d3(0x237)][_0x5a90d3(0x186)]())?.[_0x5a90d3(0x17d)]?.[_0x4692eb];for(const _0x1faa7b of Object[_0x5a90d3(0x192)](_0x1eec0d[_0x5a90d3(0x17d)])){const _0x116864=_0x1eec0d[_0x5a90d3(0x17d)][_0x1faa7b],_0x283a69=_0xec1fc1(_0x1faa7b);if(_0x116864[_0x5a90d3(0x1c3)]===_0x5a90d3(0x151)&&_0x116864['journeyActivationStepId']&&(isPendingActivationId(_0x116864[_0x5a90d3(0x1eb)])||_0x116864[_0x5a90d3(0x1eb)]==='')){if(_0x283a69?.[_0x5a90d3(0x1eb)]&&isPendingActivationId(_0x283a69['journeyActivationStepId'])){const _0x2d7d53=extractPendingActivationName(_0x283a69[_0x5a90d3(0x1eb)]),_0x27fa6a=_0x104023[_0x5a90d3(0x15a)](_0x2d7d53);_0x27fa6a&&(_0x116864[_0x5a90d3(0x1eb)]=_0x27fa6a);}}if(_0x116864['type']===_0x5a90d3(0x224)&&_0x116864[_0x5a90d3(0x211)]&&_0x283a69?.[_0x5a90d3(0x211)])for(let _0xc4d2d5=0x0;_0xc4d2d5<_0x116864[_0x5a90d3(0x211)][_0x5a90d3(0x176)];_0xc4d2d5++){const _0x59c930=_0x116864[_0x5a90d3(0x211)][_0xc4d2d5],_0x3d3e95=_0x283a69['branches'][_0xc4d2d5];if(_0x3d3e95?.[_0x5a90d3(0x1e8)]&&isPendingSegmentId(_0x3d3e95[_0x5a90d3(0x1e8)])){const _0x2169d4=_0x2d19fb(_0x3d3e95['segmentId'],_0x5a90d3(0x1a5)+_0x1eec0d[_0x5a90d3(0x237)]+_0x5a90d3(0x17f)+(_0x59c930[_0x5a90d3(0x237)]||_0xc4d2d5)+'\x27');_0x2169d4&&(_0x59c930[_0x5a90d3(0x1e8)]=_0x2169d4);}}_0x116864[_0x5a90d3(0x1c3)]===_0x5a90d3(0x180)&&_0x283a69?.['type']===_0x5a90d3(0x180)&&resolveWaitStepPendingIds(_0x116864,_0x283a69,_0x2d19fb,_0x1eec0d[_0x5a90d3(0x237)]);}}}}
1
+ const a114_0x52cd1c=a114_0x3d4f;(function(_0x1232ca,_0x417ee7){const _0x3e84c4=a114_0x3d4f,_0x572c79=_0x1232ca();while(!![]){try{const _0x37beb2=-parseInt(_0x3e84c4(0xeb))/0x1*(-parseInt(_0x3e84c4(0x191))/0x2)+-parseInt(_0x3e84c4(0x10f))/0x3*(-parseInt(_0x3e84c4(0x114))/0x4)+parseInt(_0x3e84c4(0x124))/0x5+parseInt(_0x3e84c4(0xbd))/0x6*(parseInt(_0x3e84c4(0x12b))/0x7)+-parseInt(_0x3e84c4(0xd2))/0x8+-parseInt(_0x3e84c4(0xca))/0x9*(-parseInt(_0x3e84c4(0x12f))/0xa)+-parseInt(_0x3e84c4(0x157))/0xb;if(_0x37beb2===_0x417ee7)break;else _0x572c79['push'](_0x572c79['shift']());}catch(_0x166bad){_0x572c79['push'](_0x572c79['shift']());}}}(a114_0x3d04,0x9bcf9));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a114_0x52cd1c(0x13e));export const PENDING_SEGMENT_PREFIX=a114_0x52cd1c(0x1a6);export const PENDING_ACTIVATION_PREFIX=a114_0x52cd1c(0xb3);export function createPendingSegmentId(_0x3cb34b){return''+PENDING_SEGMENT_PREFIX+_0x3cb34b+'__';}export function isPendingSegmentId(_0x1d3079){const _0x4de1f5=a114_0x52cd1c;return _0x1d3079[_0x4de1f5(0x117)](PENDING_SEGMENT_PREFIX)&&!_0x1d3079[_0x4de1f5(0x117)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x30b759){const _0x40844b=a114_0x52cd1c;return _0x30b759[_0x40844b(0xb0)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x3e9687){return''+PENDING_ACTIVATION_PREFIX+_0x3e9687+'__';}export function isPendingActivationId(_0x5755fc){const _0x3773e4=a114_0x52cd1c;return _0x5755fc[_0x3773e4(0x117)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x24247e){const _0xb5684=a114_0x52cd1c;return _0x24247e[_0xb5684(0xb0)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0xed544a,_0x1b7ec7){const _0x7124f4=a114_0x52cd1c,_0x11b540=_0xed544a+'::'+(_0x1b7ec7['trim']()||_0x7124f4(0x105)),_0x244ac4=createHash('sha1')['update'](_0x11b540)['digest']('hex')[_0x7124f4(0xe8)](0x0,0xc);return'journey_entry_criteria_'+_0x244ac4;}export function ensureJourneyDefaults(_0x4d8362){const _0xa6e1a4=a114_0x52cd1c;!_0x4d8362['description']&&(_0x4d8362[_0xa6e1a4(0x169)]=''),!_0x4d8362[_0xa6e1a4(0xc0)]&&(_0x4d8362[_0xa6e1a4(0xc0)]=_0xa6e1a4(0xc5));}export function resolveTDFolderPath(_0xc595f6,_0x337696,_0x46d91c){const _0x4e6a0a=a114_0x52cd1c;if(!_0x337696)return _0xc595f6;if(_0xc595f6===_0x46d91c||_0xc595f6[_0x4e6a0a(0x117)](_0x46d91c+'/'))return _0xc595f6;return _0xc595f6?_0x46d91c+'/'+_0xc595f6:_0x46d91c;}export function addFoldersToCreate(_0x444b4d,_0x4e7554,_0x109c69){const _0x2dc86=a114_0x52cd1c;if(!_0x444b4d)return;if(_0x4e7554[_0x2dc86(0x128)](_0x444b4d))return;const _0x169f66=_0x444b4d[_0x2dc86(0x136)]('/');let _0x100ffc='';for(const _0x52ab7a of _0x169f66){_0x100ffc=_0x100ffc?_0x100ffc+'/'+_0x52ab7a:_0x52ab7a,!_0x4e7554[_0x2dc86(0x128)](_0x100ffc)&&_0x109c69[_0x2dc86(0xb2)](_0x100ffc);}}import*as a114_0x2c56c4 from'yaml';import{readFileSync}from'fs';import a114_0x49a0c3 from'path';import{isJourneyDef,parseYamlString as a114_0x3b3770,toYamlString as a114_0x4d5e57,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(_0x4b2702){const _0x196b16=a114_0x52cd1c;if(Array['isArray'](_0x4b2702))return'['+_0x4b2702[_0x196b16(0x134)](_0x167f7a=>stableStringify(_0x167f7a))['join'](',')+']';if(_0x4b2702&&typeof _0x4b2702==='object'){const _0x3288c7=_0x4b2702,_0x10a1e4=Object['keys'](_0x3288c7)[_0x196b16(0xae)](),_0x199d0b=_0x10a1e4['map'](_0x1ab1ba=>'\x22'+_0x1ab1ba+'\x22:'+stableStringify(_0x3288c7[_0x1ab1ba]));return'{'+_0x199d0b[_0x196b16(0x180)](',')+'}';}const _0x569025=JSON[_0x196b16(0x188)](_0x4b2702);return _0x569025===undefined?'null':_0x569025;}function activationSignature(_0x23e78a){const _0x448fcd=a114_0x52cd1c,_0x40ce28={'connection':_0x23e78a[_0x448fcd(0x142)],..._0x23e78a[_0x448fcd(0x187)]!==undefined&&{'all_columns':_0x23e78a['all_columns']},..._0x23e78a['columns']!==undefined&&{'columns':_0x23e78a[_0x448fcd(0x190)]},..._0x23e78a['behavior']!==undefined&&{'behavior':_0x23e78a['behavior']},..._0x23e78a['schedule']!==undefined&&{'schedule':_0x23e78a[_0x448fcd(0x12d)]},..._0x23e78a[_0x448fcd(0x11f)]!==undefined&&{'notification':_0x23e78a[_0x448fcd(0x11f)]},..._0x23e78a['connector_config']!==undefined&&{'connector_config':_0x23e78a[_0x448fcd(0x19b)]},..._0x23e78a[_0x448fcd(0x11b)]!==undefined&&{'activation_template_id':_0x23e78a[_0x448fcd(0x11b)]}};return stableStringify(_0x40ce28);}async function fetchSegment(_0x13e3cb,_0x3331e9,_0x3eb003,_0x21ba2e){const _0xbd7418=a114_0x52cd1c,_0x4ee5b8=_0x21ba2e?.[_0xbd7418(0x1a0)](_0x319ca0=>_0x319ca0['id']===_0x3eb003);if(_0x4ee5b8)return _0x4ee5b8;try{return await _0x13e3cb[_0xbd7418(0x105)]['getSegment'](_0x3331e9,_0x3eb003);}catch(_0x553d18){logger['debug']('getSegment\x20failed\x20for\x20'+_0x3eb003+_0xbd7418(0x107)+_0x553d18);try{return await _0x13e3cb[_0xbd7418(0x105)]['getSegmentEntity'](_0x3eb003);}catch(_0x211954){return logger[_0xbd7418(0x13a)](_0xbd7418(0x121)+_0x3eb003+':\x20'+_0x211954),null;}}}function recoverSegmentIdsFromPushRecovery(_0x1f7600,_0x4adfbd,_0x29fbf4){const _0xf84cfc=a114_0x52cd1c,_0x345557=readPushRecovery(_0x1f7600[_0xf84cfc(0x1a1)]);if(_0x345557?.[_0xf84cfc(0x176)]===_0x1f7600['yamlConfig'][_0xf84cfc(0x174)])for(const [_0x14e790,_0x3a0257]of Object[_0xf84cfc(0x15f)](_0x345557[_0xf84cfc(0x16b)])){const _0x29e667=generateDeterministicJourneySegmentName(_0x1f7600[_0xf84cfc(0x161)]['name'],_0x14e790);_0x3a0257[_0xf84cfc(0x16e)]===_0x29e667&&(_0x4adfbd[_0xf84cfc(0x18c)](_0x14e790,_0x3a0257[_0xf84cfc(0x182)]),_0x29fbf4[_0xf84cfc(0x18c)](_0x14e790,_0x3a0257[_0xf84cfc(0x182)]));}}async function createOrRecoverEmbeddedSegment(_0x1e962d,_0x9873b7,_0x3c4f32,_0x266018){const _0x32e5db=a114_0x52cd1c;let _0x58bbd2;try{_0x58bbd2=await _0x1e962d[_0x32e5db(0x105)][_0x32e5db(0xbf)]({'name':_0x3c4f32['uniqueSegmentName'],'description':_0x3c4f32[_0x32e5db(0x169)],'journeyId':_0x3c4f32[_0x32e5db(0x167)],'rule':_0x266018(_0x3c4f32[_0x32e5db(0xb1)],!![]),'countPopulation':!![],'parentFolderId':_0x3c4f32[_0x32e5db(0x101)],'audienceId':_0x3c4f32['parentId']});}catch(_0x3617f4){const _0x16f30c=_0x3617f4 instanceof Error&&_0x3617f4['message'][_0x32e5db(0x123)](_0x32e5db(0x17b));if(_0x16f30c){const _0x2a76ad=readPushRecovery(_0x9873b7[_0x32e5db(0x1a1)]),_0x3c7781=_0x2a76ad?.[_0x32e5db(0x176)]===_0x9873b7[_0x32e5db(0x161)][_0x32e5db(0x174)]?_0x2a76ad[_0x32e5db(0x16b)][_0x3c4f32['localName']]:undefined;if(_0x3c7781?.['uniqueServerName']===_0x3c4f32[_0x32e5db(0xcc)])await _0x1e962d[_0x32e5db(0x105)]['updateSegmentById'](_0x3c4f32[_0x32e5db(0x125)],_0x3c7781[_0x32e5db(0x182)],{'description':_0x3c4f32['description'],'rule':_0x266018(_0x3c4f32['resolvedRule'],!![]),'countPopulation':!![]}),_0x58bbd2=_0x3c7781['segmentId'];else throw new SDKError(ErrorCode[_0x32e5db(0x11c)],_0x32e5db(0x18b)+_0x3c4f32[_0x32e5db(0xff)]+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+(_0x32e5db(0xb9)+_0x9873b7['absolutePath'][_0x32e5db(0xb0)](/([^/]+)$/,_0x32e5db(0xe7))+')\x20')+_0x32e5db(0x153),_0x3617f4);}else throw _0x3617f4;}return saveSegmentToPushRecovery(_0x9873b7['absolutePath'],_0x9873b7['yamlConfig']['name'],_0x3c4f32[_0x32e5db(0xff)],{'segmentId':_0x58bbd2,'uniqueServerName':_0x3c4f32[_0x32e5db(0xcc)],'createdAt':new Date()['toISOString']()}),_0x58bbd2;}export async function prepareSegmentFiles(_0x422fef,_0xab2cdc,_0x3f6616,_0x274ebd,_0x51f62c){const _0x258f5d=a114_0x52cd1c,{activationDefToCreateRequest:_0x406d5b}=await import(_0x258f5d(0x14e)),_0x1bd0dc=[],_0x2d2bf1=new Set();for(const {yamlConfig:_0x576737,folderPath:_0x428dd3,sourcePath:_0x342b0f}of _0x422fef){const _0x499858=resolveTDFolderPath(_0x428dd3,_0x274ebd,_0x51f62c),_0x30887b=_0x499858+':'+_0x576737[_0x258f5d(0x174)],_0x364409=_0xab2cdc['segmentByFolderAndName'][_0x258f5d(0x138)](_0x30887b),_0x1d28e7=_0x364409?_0xab2cdc[_0x258f5d(0xf6)][_0x258f5d(0x138)](_0x364409['id'])||[]:[];addFoldersToCreate(_0x499858,_0xab2cdc[_0x258f5d(0x192)],_0x2d2bf1);const _0x178ac2=calculateActivationActions(_0x576737[_0x258f5d(0xfa)]||[],_0x1d28e7,_0xab2cdc['idToEmailMap'],_0xab2cdc[_0x258f5d(0x168)]);for(const _0x2c43dd of _0x178ac2){(_0x2c43dd['type']===_0x258f5d(0xbc)||_0x2c43dd['type']===_0x258f5d(0x14f))&&_0x2c43dd['yamlActivation']&&(_0x2c43dd[_0x258f5d(0x14d)]=await _0x406d5b(_0x2c43dd[_0x258f5d(0xee)],_0x3f6616));}const _0x420675=calculateSegmentDiff(_0x576737,_0x364409,_0x1d28e7,_0xab2cdc[_0x258f5d(0x144)],_0xab2cdc['connectionIdToNameMap']);_0x1bd0dc['push']({'relativePath':_0x576737[_0x258f5d(0x174)],'absolutePath':_0x342b0f,'yamlConfig':_0x576737,'folderPath':_0x499858,'existingSegment':_0x364409,'existingActivations':_0x1d28e7,'isNew':_0x420675[_0x258f5d(0x159)],'hasChanges':_0x420675['hasChanges'],'diff':_0x420675[_0x258f5d(0x13f)],'activationActions':_0x178ac2});}return{'segmentFiles':_0x1bd0dc,'foldersToCreate':_0x2d2bf1};}export async function prepareJourneyFiles(_0x662a18,_0x5624d8,_0x184635,_0x45617a){const _0x11c510=a114_0x52cd1c,_0x9d5d=[],_0x5130c2=new Set();for(const {yamlConfig:_0x495fad,folderPath:_0x4b956c,sourcePath:_0x4bc314}of _0x662a18){const _0x503f25=resolveTDFolderPath(_0x4b956c,_0x184635,_0x45617a),_0x4b171e=_0x503f25+':'+_0x495fad[_0x11c510(0x174)],_0x4baf78=_0x5624d8[_0x11c510(0xf7)][_0x11c510(0x138)](_0x4b171e);let _0x4c89ee,_0x47800d;if(_0x4baf78&&_0x4baf78['length']>0x0){const _0x5dab5b=buildLocalExpandedRuleMappings(_0x495fad),{createYamlContext:_0x3ac4a6,prefetchJourneySegments:_0x1b54a1}=createPushYamlContextForBundle(_0x5624d8[_0x11c510(0x12e)],_0x5624d8[_0x11c510(0x125)],_0x5624d8[_0x11c510(0x15a)],_0x5dab5b,_0x5624d8[_0x11c510(0x144)],_0x5624d8['connectionIdToNameMap'],_0x5624d8[_0x11c510(0x16f)],_0x5624d8[_0x11c510(0xe1)]);await _0x1b54a1(_0x4baf78[_0x11c510(0x134)](_0x1f17f7=>_0x1f17f7['id']));const _0x12ef0c=hasMultipleVersions(_0x495fad),_0x13e8a9=async _0x186a1d=>{const _0x28e75e=_0x11c510,_0x45fe79=_0x5624d8['journeyById']?.[_0x28e75e(0x138)](_0x186a1d);if(_0x45fe79)return _0x45fe79;return _0x5624d8['fetchJourney']({'journeyId':_0x186a1d,'journeyName':_0x495fad[_0x28e75e(0x174)],'isMultiVersion':_0x4baf78[_0x28e75e(0x1a5)]>0x1});};if(_0x12ef0c&&_0x4baf78['length']>0x1){const _0x172bf2=[];for(const _0x20479a of _0x4baf78){const _0x6f8b95=_0x20479a[_0x11c510(0xf1)]||0x1;_0x5624d8['progress']?.[_0x11c510(0x14f)]('Fetching\x20'+_0x495fad[_0x11c510(0x174)]+'\x20v'+_0x6f8b95);const _0xde6074=await _0x13e8a9(_0x20479a['id']),_0x2c0f89=_0x3ac4a6(_0x20479a['id']),_0x502bb3=await journeyResponseToDef(_0xde6074,_0x2c0f89);_0x172bf2['push']({'item':_0x20479a,'yaml':_0x502bb3});}const _0x13767c=buildLocalRuleToNameMappingFromJourney(_0x495fad);_0x47800d=buildMergedJourneyDef(_0x172bf2,_0x13767c);const _0x91070f=Math[_0x11c510(0x19f)](..._0x172bf2[_0x11c510(0x134)](_0x4f2f75=>_0x4f2f75[_0x11c510(0xcd)][_0x11c510(0xf1)]||0x0)),_0x25cfc6=_0x4baf78[_0x11c510(0x1a0)](_0x1f61e5=>(_0x1f61e5[_0x11c510(0xf1)]||0x0)===_0x91070f);_0x25cfc6&&(_0x5624d8[_0x11c510(0x149)]?.['update'](_0x11c510(0x162)+_0x495fad[_0x11c510(0x174)]+'\x20v'+_0x91070f),_0x4c89ee=await _0x13e8a9(_0x25cfc6['id']));}else{const _0x1f36f6=_0x4baf78[_0x4baf78[_0x11c510(0x1a5)]-0x1];_0x5624d8[_0x11c510(0x149)]?.[_0x11c510(0x14f)](_0x11c510(0x162)+_0x495fad[_0x11c510(0x174)]),_0x4c89ee=await _0x13e8a9(_0x1f36f6['id']);const _0xb37a95=_0x3ac4a6(_0x1f36f6['id']),_0xba7a81=await journeyResponseToDef(_0x4c89ee,_0xb37a95),_0x257e3e=buildLocalRuleToNameMappingFromJourney(_0x495fad);_0x47800d=buildMergedJourneyDef([{'item':_0x1f36f6,'yaml':_0xba7a81}],_0x257e3e);}}addFoldersToCreate(_0x503f25,_0x5624d8['folderPathToId'],_0x5130c2);const _0x363abf=calculateJourneyDiff(_0x495fad,_0x47800d);_0x9d5d['push']({'relativePath':_0x495fad['name'],'absolutePath':_0x4bc314,'yamlConfig':_0x495fad,'folderPath':_0x503f25,'existingJourney':_0x4c89ee,'isNew':_0x363abf['isNew'],'hasChanges':_0x363abf[_0x11c510(0x154)],'diff':_0x363abf[_0x11c510(0x13f)]});}return{'journeyFiles':_0x9d5d,'foldersToCreate':_0x5130c2};}export function calculateActivationActions(_0x128b82,_0x1088ab,_0x264177,_0x4431a4){const _0xc5ed33=a114_0x52cd1c,_0x42dc84=[],_0xfec53e=new Map();for(const _0xa060e3 of _0x1088ab){_0xfec53e[_0xc5ed33(0x18c)](_0xa060e3[_0xc5ed33(0x174)],_0xa060e3);}const _0x47f8d5=new Map();for(const _0x7b411a of _0x128b82){_0x47f8d5[_0xc5ed33(0x18c)](_0x7b411a[_0xc5ed33(0x174)],_0x7b411a);}for(const _0x8e8b36 of _0x128b82){const _0x4607c0=_0xfec53e[_0xc5ed33(0x138)](_0x8e8b36['name']);if(!_0x4607c0)_0x42dc84['push']({'type':_0xc5ed33(0xbc),'name':_0x8e8b36['name'],'yamlActivation':_0x8e8b36});else{const _0x15bc5a=activationResponseToDef(_0x4607c0,_0x264177,_0x4431a4),_0x367a19=a114_0x2c56c4['stringify'](_0x15bc5a),_0xf0f88a=a114_0x2c56c4[_0xc5ed33(0x188)](_0x8e8b36);_0x367a19!==_0xf0f88a&&_0x42dc84['push']({'type':'update','name':_0x8e8b36['name'],'yamlActivation':_0x8e8b36,'existingActivation':_0x4607c0});}}for(const _0x4c78c7 of _0x1088ab){!_0x47f8d5[_0xc5ed33(0x128)](_0x4c78c7[_0xc5ed33(0x174)])&&_0x42dc84[_0xc5ed33(0x122)]({'type':'delete','name':_0x4c78c7['name'],'existingActivation':_0x4c78c7});}return _0x42dc84;}function calculateYamlDiff(_0x3bf360,_0x2dde6f){if(_0x2dde6f){const _0x45528a=generateDiff(_0x2dde6f,_0x3bf360),_0x31cc04=hasChanges(_0x45528a);return{'isNew':![],'hasChanges':_0x31cc04,'diff':_0x31cc04?formatDiffWithColors(_0x45528a):undefined};}const _0x580bcd=generateDiff('',_0x3bf360);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x580bcd)};}export function calculateSegmentDiff(_0x2767a4,_0x5ca401,_0x306a77,_0x38cc8d,_0x1306ee){const _0x42e3ae=segmentToYamlString(_0x2767a4),_0x2a9b3d=_0x5ca401?segmentToYamlString(segmentWithActivationsToYaml(_0x5ca401,_0x306a77,undefined,_0x38cc8d,_0x1306ee)):undefined;return calculateYamlDiff(_0x42e3ae,_0x2a9b3d);}export function calculateJourneyDiff(_0x161eb6,_0x2f558d){const _0x461d2c=normalizeJourneyDef(_0x161eb6,_0x161eb6),_0x2f009c=a114_0x4d5e57(_0x461d2c),_0x3affe1=_0x2f558d?a114_0x4d5e57(normalizeJourneyDef(_0x2f558d,_0x161eb6)):undefined;return calculateYamlDiff(_0x2f009c,_0x3affe1);}export function findSegmentsToDelete(_0x443a46,_0x41c16b,_0x238b74,_0x2cff51,_0x4d3448){const _0x2cedd4=a114_0x52cd1c,_0x5dce3f=new Set();for(const {yamlConfig:_0x2bfc6a,folderPath:_0x100326}of _0x41c16b){_0x5dce3f['add'](_0x100326+':'+_0x2bfc6a[_0x2cedd4(0x174)]);}return _0x443a46[_0x2cedd4(0x166)](_0x2834cf=>{const _0x4b5659=_0x2cedd4,_0x5c7b69=_0x2834cf[_0x4b5659(0xf3)]?_0x238b74['get'](_0x2834cf['segmentFolderId'][_0x4b5659(0xce)]())||'':'',_0x148fdd=_0x5c7b69+':'+_0x2834cf['name'];if(_0x5dce3f[_0x4b5659(0x128)](_0x148fdd))return![];if(_0x4d3448)return _0x5c7b69===_0x2cff51||_0x5c7b69['startsWith'](_0x2cff51+'/');return!![];});}function a114_0x3d4f(_0xdad64d,_0x6c89ff){_0xdad64d=_0xdad64d-0xac;const _0x3d0465=a114_0x3d04();let _0x3d4f10=_0x3d0465[_0xdad64d];return _0x3d4f10;}export function findJourneysToDelete(_0x3acf71,_0x5f32a5,_0x44fd27,_0x17aad4,_0x11fd7){const _0x3518de=a114_0x52cd1c,_0x3e4ec6=new Set();for(const {yamlConfig:_0x57fe1b,folderPath:_0x3061d6}of _0x5f32a5){_0x3e4ec6[_0x3518de(0xb2)](_0x3061d6+':'+_0x57fe1b[_0x3518de(0x174)]);}return _0x3acf71[_0x3518de(0x166)](_0x4e3804=>{const _0x3bb71e=_0x3518de,_0x341316=_0x4e3804[_0x3bb71e(0x101)]?_0x44fd27['get'](_0x4e3804[_0x3bb71e(0x101)])||'':'',_0x21cfa0=_0x341316+':'+_0x4e3804[_0x3bb71e(0xc6)];if(_0x3e4ec6[_0x3bb71e(0x128)](_0x21cfa0))return![];if(_0x11fd7)return _0x341316===_0x17aad4||_0x341316[_0x3bb71e(0x117)](_0x17aad4+'/');return!![];});}export function buildSegmentLookupMap(_0x5f11fd,_0x207d7c){const _0x34fb0e=a114_0x52cd1c,_0x41eddf=new Map();for(const _0x556519 of _0x5f11fd){const _0xd3c841=_0x556519[_0x34fb0e(0xf3)]?_0x207d7c[_0x34fb0e(0x138)](_0x556519[_0x34fb0e(0xf3)][_0x34fb0e(0xce)]())||'':'',_0x5bb7aa=_0xd3c841+':'+_0x556519[_0x34fb0e(0x174)];_0x41eddf[_0x34fb0e(0x18c)](_0x5bb7aa,_0x556519);}return _0x41eddf;}export function buildSegmentNameToIdMap(_0x421274){const _0x77e4ed=a114_0x52cd1c,_0x5e2a2b=new Map();for(const _0x59d5e4 of _0x421274){_0x5e2a2b[_0x77e4ed(0x18c)](_0x59d5e4[_0x77e4ed(0x174)],_0x59d5e4['id']);}return _0x5e2a2b;}export function buildJourneyBundleLookupMap(_0x2086fd,_0x174235){const _0x4edb46=a114_0x52cd1c,_0x25c981=new Map();for(const _0x3a1e1d of _0x2086fd){const _0x3d7866=_0x3a1e1d[_0x4edb46(0x101)]?_0x174235['get'](_0x3a1e1d[_0x4edb46(0x101)])||'':'',_0x234841=_0x3d7866+':'+_0x3a1e1d[_0x4edb46(0xc6)];!_0x25c981['has'](_0x234841)&&_0x25c981[_0x4edb46(0x18c)](_0x234841,[]),_0x25c981[_0x4edb46(0x138)](_0x234841)['push'](_0x3a1e1d);}for(const _0x268c31 of _0x25c981[_0x4edb46(0xbb)]()){_0x268c31[_0x4edb46(0xae)]((_0x17c011,_0x377cff)=>(_0x17c011[_0x4edb46(0xf1)]||0x0)-(_0x377cff[_0x4edb46(0xf1)]||0x0));}return _0x25c981;}export function collectFoldersToCreate(_0x58dcd9,_0x3b408d){const _0x1bcd7b=a114_0x52cd1c,_0xc04e0e=new Set();for(const _0x1aa448 of _0x58dcd9){if(!_0x1aa448)continue;if(_0x3b408d[_0x1bcd7b(0x128)](_0x1aa448))continue;const _0x30736c=_0x1aa448[_0x1bcd7b(0x136)]('/');let _0x3fb46a='';for(const _0x7a8d45 of _0x30736c){_0x3fb46a=_0x3fb46a?_0x3fb46a+'/'+_0x7a8d45:_0x7a8d45,!_0x3b408d['has'](_0x3fb46a)&&_0xc04e0e[_0x1bcd7b(0xb2)](_0x3fb46a);}}return _0xc04e0e;}export function parseAndClassifyYamlFiles(_0x472c90,_0x2382e8,_0x39d788){const _0x3b35aa=a114_0x52cd1c,_0x3d09ea=[],_0x222cd1=[];for(const _0x169297 of _0x472c90){const _0x54f13c=a114_0x49a0c3[_0x3b35aa(0x135)](_0x2382e8,a114_0x49a0c3[_0x3b35aa(0x11d)](_0x169297)),_0x100057=_0x54f13c==='.'?'':_0x54f13c,_0x3761f2=readFileSync(_0x169297,_0x3b35aa(0xd4)),_0x1e9d15=a114_0x2c56c4[_0x3b35aa(0x17e)](_0x3761f2);if(isJourneyDef(_0x1e9d15)){const _0x2404b5=a114_0x3b3770(_0x3761f2);_0x222cd1[_0x3b35aa(0x122)]({'yamlConfig':_0x2404b5,'folderPath':_0x100057,'sourcePath':_0x169297});}else{if(!_0x39d788?.[_0x3b35aa(0x127)]){const _0x11fbf2=parseSegmentYamlFile(_0x3761f2),_0x429fb1=normalizeChildSegmentYaml(_0x11fbf2);_0x3d09ea['push']({'yamlConfig':_0x429fb1,'folderPath':_0x100057,'sourcePath':_0x169297});}}}return{'segments':_0x3d09ea,'journeys':_0x222cd1};}export function validateParsedFiles(_0x57bcb8,_0x53b592){const _0x29645c=a114_0x52cd1c,_0x5e4b22=[];for(const {yamlConfig:_0x404da0,sourcePath:_0x379ead}of _0x57bcb8[_0x29645c(0x16b)]){const _0x5edadb=readFileSync(_0x379ead,_0x29645c(0xd4)),_0x4ae0ee=a114_0x2c56c4['parseDocument'](_0x5edadb),_0x55c710=validateSegmentDef(_0x404da0,{'source':_0x5edadb,'document':_0x4ae0ee});if(!_0x55c710['valid']){const _0x547ef3=a114_0x49a0c3['relative'](_0x53b592,_0x379ead);_0x5e4b22[_0x29645c(0x122)]({'filePath':_0x547ef3,'source':_0x5edadb,'result':_0x55c710,'isJourney':![]});}}for(const {yamlConfig:_0x5f09e0,sourcePath:_0x5798d6}of _0x57bcb8['journeys']){const _0x351da6=readFileSync(_0x5798d6,_0x29645c(0xd4)),_0x2aee23=a114_0x2c56c4[_0x29645c(0x147)](_0x351da6),_0x3feaa5=validateJourneyDef(_0x5f09e0,{'source':_0x351da6,'document':_0x2aee23});if(!_0x3feaa5[_0x29645c(0x170)]){const _0x229681=a114_0x49a0c3[_0x29645c(0x135)](_0x53b592,_0x5798d6);_0x5e4b22[_0x29645c(0x122)]({'filePath':_0x229681,'source':_0x351da6,'result':_0x3feaa5,'isJourney':!![]});}}return _0x5e4b22;}export function formatValidationErrors(_0x39fb8d){const _0x31523=a114_0x52cd1c,_0x2e5e5e=[];for(const {filePath:_0x4ea537,source:_0x25c0c1,result:_0x3b6b84,isJourney:_0xfb8e8e}of _0x39fb8d){const _0x31dc2b=_0xfb8e8e?'journey':_0x31523(0x105);_0x2e5e5e[_0x31523(0x122)]('\x0a'+_0x4ea537+'\x20('+_0x31dc2b+_0x31523(0x19e)+_0x3b6b84[_0x31523(0x130)][_0x31523(0x1a5)]+_0x31523(0x160)),_0x2e5e5e['push'](formatValidationResult(_0x3b6b84,_0x25c0c1,_0x4ea537));}return _0x2e5e5e['join']('\x0a');}function a114_0x3d04(){const _0x2a7b15=['folder','effectiveFolderId','columns','1428166HpiTcd','folderPathToId','relationships','Failed\x20to\x20resolve\x20segment\x20','segment_updating','ACTIVATION_SYNTAX_ERROR','Journey\x20\x27','INTERNAL','ACTIVATION_UPDATE_ERROR','reduce','connector_config','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','existingActivation','):\x20','max','find','absolutePath','listActivations','Failed\x20to\x20resolve\x20activation\x20','waitStep','length','__pending_','journey','JOURNEY_UPDATE_ERROR','index','conditionTimeoutDuration','sort','getJourney','replace','resolvedRule','add','__pending_act_','DecisionPoint','stage\x20\x27','delete','Created\x20journey\x20\x27','action','Delete\x20the\x20push\x20recovery\x20file\x20(','activation_','values','create','840KQIDIU','segmentNameToId','createJourneySegment','state','updateSegmentById','\x20(referenced\x20in\x20journey\x20','updated','activation_deleting','draft','journeyBundleName','\x27...','goal\x20criteria','\x27\x20from\x20file:\x20','4125204kDwSOh','attributes','uniqueSegmentName','item','toString','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','activation_created','Failed\x20to\x20','9017552gzpCpO','NOT_FOUND','utf-8','\x27\x20wait\x20condition','user','waitStepUnit','steps','activationContext','Updated\x20journey\x20\x27','waitStepType','embedded_segment_created','activation_updating','segment_created','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','resolveSegment','journeyById','../../utils/async.js','logWarning','branches','journeys','run_after_journey_refresh','.$1.push-recovery.json','slice','createSegment','Deleted\x20activation\x20\x27','1iyDsmo','folder_created','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','yamlActivation','Updating\x20activation\x20\x27','\x27\x20not\x20found\x20in\x20journey\x20\x27','versionNumber','activation_creating','segmentFolderId','JOURNEY_SYNTAX_ERROR','embeddedSegmentNameToId','activationsBySegmentId','journeyBundlesByFolderAndName','Stage\x20\x27','\x27\x20exit\x20criteria','activations','segment_deleting','journey_updating','journeyActivationNameToId','\x0a\x20\x20','localName','getActivation','folderId','created','activation_deleted','goal','segment','entryCriteria',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','logSuccess','Creating\x20folder\x20\x27','entry','journey_creating','data','conditionTimeoutUnit','from','27apQGDI','entry_criteria','kind','Deleted\x20segment\x20\x27','folder_creating','224244YxiocS','activationParams','some','startsWith','type','results','segment_creating','activation_template_id','SEGMENT_UPDATE_ERROR','dirname','logDeleted','notification','existingSegment','getSegmentEntity\x20also\x20failed\x20for\x20','push','includes','826610kECZAW','parentId','withProgress','skipSegments','has','rootFolderId','logInfo','30002bjdChH','buildUserMaps','schedule','deps','20UYHHoH','errors','Segment\x20not\x20found','WaitStep','size','map','relative','split','Updated\x20activation\x20\x27','get','conditionSegmentId','debug','createActivation','keys','journeyActivationStepId','tdx.sdk.push-workflow','diff','resolveJourneyId','Created\x20folder\x20\x27','connection','Duration','idToEmailMap','embedded_activation_creating','deleteSegment','parseDocument','createdSegmentId','progress','nameToType','journey_updated','\x27\x20decision\x20point\x20branch\x20\x27','validatedRequest','./child-segment-yaml.js','update','journeyStages','Activation\x20not\x20found:\x20','parentSegmentFolder','and\x20the\x20server\x20segment,\x20then\x20retry.','hasChanges','folderPath','day','12488421sEvceO','existingJourney','isNew','existingSegments','rule','Updated\x20segment\x20\x27','stages','\x27\x20for\x20','entries','\x20error(s)','yamlConfig','Fetching\x20','./journey-yaml.js','unchanged','exitCriterias','filter','journeyId','connectionIdToNameMap','description','conditions','segments','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','embedded_segment_creating','uniqueServerName','activationStepsById','valid','activationActions','createdSegmentIds','Entry\x20criteria:\x20','name','Activation','journeyName','milestone','Segment\x20not\x20found:\x20','Failed\x20to\x20fetch\x20referenced\x20segment\x20','journey_created','Name\x20has\x20already\x20been\x20taken','Condition','nameToId','parse','\x27\x20milestone','join','with','segmentId','deleted','Creating\x20segment\x20\x27','toLowerCase','Updating\x20segment\x20\x27','all_columns','stringify','SEGMENT_NOT_FOUND','segment_deleted','Embedded\x20segment\x20\x27','set','onProgress'];a114_0x3d04=function(){return _0x2a7b15;};return a114_0x3d04();}export function buildLocalExpandedRuleMappings(_0x125eeb){const _0x4dd9eb=a114_0x52cd1c,_0xea3f38=new Set(),_0x42db7a=new Map(),_0x10647f=collectSegmentUsageCounts(_0x125eeb);if(_0x125eeb[_0x4dd9eb(0x16b)])for(const [_0x37428f,_0x4cd670]of Object[_0x4dd9eb(0x15f)](_0x125eeb['segments'])){_0xea3f38[_0x4dd9eb(0xb2)](_0x37428f);if(_0x4cd670[_0x4dd9eb(0x15b)]){const _0x18f026=yamlRuleToApi(_0x4cd670[_0x4dd9eb(0x15b)]),_0x382d69=apiRuleToYaml(_0x18f026);_0x42db7a['set'](_0x37428f,_0x382d69);}}const _0x484e87=new Map();let _0x548949=0x0;for(const [_0x353dda,_0x573b45]of _0x42db7a){const _0xd664f1=serializeExpandedRule(_0x573b45,_0x42db7a),_0x44fe71=_0x484e87[_0x4dd9eb(0x138)](_0xd664f1)||[];_0x44fe71[_0x4dd9eb(0x122)]({'name':_0x353dda,'index':_0x548949}),_0x484e87[_0x4dd9eb(0x18c)](_0xd664f1,_0x44fe71),_0x548949++;}const _0x1199b8=new Map();for(const [_0x977595,_0x1c6f6c]of _0x484e87){const _0x3f3930=_0x1c6f6c[_0x4dd9eb(0xe8)]()[_0x4dd9eb(0xae)]((_0x1853b5,_0x248c52)=>{const _0x10b46f=_0x4dd9eb,_0x4a8c89=_0x10647f[_0x10b46f(0x138)](_0x1853b5[_0x10b46f(0x174)])||0x0,_0x555078=_0x10647f[_0x10b46f(0x138)](_0x248c52['name'])||0x0;if(_0x4a8c89!==_0x555078)return _0x555078-_0x4a8c89;return _0x1853b5[_0x10b46f(0xac)]-_0x248c52['index'];})['map'](_0x542ca7=>_0x542ca7[_0x4dd9eb(0x174)]),_0x3bbbd5=[];for(const _0x29c075 of _0x3f3930){const _0x1709a4=_0x10647f['get'](_0x29c075)||0x0,_0xf2b79e=Math[_0x4dd9eb(0x19f)](_0x1709a4,0x1);for(let _0x48f582=0x0;_0x48f582<_0xf2b79e;_0x48f582++){_0x3bbbd5[_0x4dd9eb(0x122)](_0x29c075);}}_0x1199b8['set'](_0x977595,_0x3bbbd5);}return{'existingLocalSegmentNames':_0xea3f38,'localSegmentRules':_0x42db7a,'localExpandedRuleToNames':_0x1199b8};}export function createSegmentIdResolver(_0x259fcb,_0x41a956){return async _0x1eb2d7=>{const _0x3de447=a114_0x3d4f,_0x40f13c=_0x259fcb[_0x3de447(0x138)](_0x1eb2d7);if(!_0x40f13c)throw new SDKError(ErrorCode[_0x3de447(0x189)],_0x3de447(0x178)+_0x1eb2d7+_0x3de447(0x16c)+_0x41a956+'\x27)');return _0x40f13c;};}export function extractRootFolderId(_0x1324c0){const _0x2728dc=a114_0x52cd1c;return _0x1324c0[_0x2728dc(0x193)]?.[_0x2728dc(0x152)]?.[_0x2728dc(0x10c)]?.['id']||_0x1324c0[_0x2728dc(0x193)]?.['parentFolder']?.[_0x2728dc(0x10c)]?.['id'];}export function buildConnectionMaps(_0x4f3a0f){const _0x3c6033=a114_0x52cd1c,_0x3040a8=new Map(),_0x353259=new Map(),_0x21bd81=new Map();for(const _0x293474 of _0x4f3a0f){_0x3040a8[_0x3c6033(0x18c)](_0x293474[_0x3c6033(0x174)],parseInt(_0x293474['id'],0xa)),_0x353259['set'](_0x293474['id'],_0x293474[_0x3c6033(0x174)]),_0x21bd81['set'](_0x293474[_0x3c6033(0x174)],_0x293474['type']);}return{'nameToId':_0x3040a8,'idToName':_0x353259,'nameToType':_0x21bd81};}export function calculatePushStats(_0x2e4873,_0x1f7040,_0x520650,_0x1be467,_0x3bfb6e,_0x3b372d,_0x387609){const _0x10f2db=a114_0x52cd1c,_0x4ccc46=_0x2e4873[_0x10f2db(0x166)](_0x3cb606=>_0x3cb606['isNew']),_0x5c12f3=_0x2e4873[_0x10f2db(0x166)](_0x4b7b3f=>!_0x4b7b3f[_0x10f2db(0x159)]&&_0x4b7b3f['hasChanges']),_0xfe6b05=_0x2e4873[_0x10f2db(0x166)](_0x3f0d22=>!_0x3f0d22[_0x10f2db(0x159)]&&!_0x3f0d22[_0x10f2db(0x154)]),_0x4b5f45=_0x3b372d?_0x1be467:[],_0x4b8458=_0x1f7040['filter'](_0x393a84=>_0x393a84['isNew']),_0x2c34e5=_0x1f7040[_0x10f2db(0x166)](_0x2fa43c=>!_0x2fa43c[_0x10f2db(0x159)]&&_0x2fa43c[_0x10f2db(0x154)]),_0x467897=_0x1f7040['filter'](_0x4edcba=>!_0x4edcba['isNew']&&!_0x4edcba[_0x10f2db(0x154)]),_0x118335=_0x3b372d?_0x3bfb6e:[],_0x199d41=_0x2e4873['flatMap'](_0x3c5714=>_0x3c5714['activationActions']),_0x527b70=_0x199d41['filter'](_0xf6566d=>_0xf6566d[_0x10f2db(0x118)]==='create'),_0x2a49e2=_0x199d41['filter'](_0xa7ecbc=>_0xa7ecbc[_0x10f2db(0x118)]==='update'),_0x381e07=_0x199d41[_0x10f2db(0x166)](_0x2eaf5d=>_0x2eaf5d[_0x10f2db(0x118)]===_0x10f2db(0xb6)),_0xc43c81=Array['from'](_0x520650)['sort'](),_0xe19ba3=_0x387609?![]:_0x4ccc46['length']>0x0||_0x5c12f3[_0x10f2db(0x1a5)]>0x0||_0x4b5f45['length']>0x0,_0x2b9a77=_0x4b8458[_0x10f2db(0x1a5)]>0x0||_0x2c34e5[_0x10f2db(0x1a5)]>0x0||_0x118335['length']>0x0,_0x4a3707=_0x387609?![]:_0x199d41[_0x10f2db(0x1a5)]>0x0,_0x7739a=_0xc43c81[_0x10f2db(0x1a5)]>0x0;return{'segments':{'new':_0x4ccc46,'changed':_0x5c12f3,'unchanged':_0xfe6b05,'toDelete':_0x4b5f45},'journeys':{'new':_0x4b8458,'changed':_0x2c34e5,'unchanged':_0x467897,'toDelete':_0x118335},'activations':{'all':_0x199d41,'toCreate':_0x527b70,'toUpdate':_0x2a49e2,'toDelete':_0x381e07},'folders':{'toCreate':_0xc43c81},'counts':{'segments':{'new':_0x4ccc46[_0x10f2db(0x1a5)],'changed':_0x5c12f3[_0x10f2db(0x1a5)],'unchanged':_0xfe6b05['length'],'toDelete':_0x4b5f45[_0x10f2db(0x1a5)]},'journeys':{'new':_0x4b8458[_0x10f2db(0x1a5)],'changed':_0x2c34e5['length'],'unchanged':_0x467897['length'],'toDelete':_0x118335[_0x10f2db(0x1a5)]},'activations':{'create':_0x527b70[_0x10f2db(0x1a5)],'update':_0x2a49e2['length'],'delete':_0x381e07[_0x10f2db(0x1a5)]},'folders':_0xc43c81['length']},'hasChanges':_0xe19ba3||_0x2b9a77||_0x4a3707||_0x7739a};}export async function buildPushExecutionContext(_0x5a1207,_0x3c034c,_0x5a274d,_0x5a3656,_0x473ed,_0x338259){const _0x1d10fb=a114_0x52cd1c,_0x13bae0=extractRootFolderId(_0x5a274d),{pathToId:_0x41c5f7,idToPath:_0x5607b8}=buildFolderMaps(_0x473ed),_0x4496ca=buildSegmentNameToIdMap(_0x5a3656),_0x1d09e6=new Map(),{batchAsync:_0x44d578}=await import(_0x1d10fb(0xe2)),[_0x1d86e3,_0x53ff4d]=await Promise['all']([_0x5a1207[_0x1d10fb(0xd6)][_0x1d10fb(0x12c)](),_0x5a1207[_0x1d10fb(0x142)]['list'](),((async()=>{!_0x338259&&_0x5a3656['length']>0x0&&await _0x44d578(_0x5a3656,async _0x49db9f=>{const _0x1c1b52=a114_0x3d4f,_0x12f660=await _0x5a1207[_0x1c1b52(0x105)]['listActivations'](_0x3c034c,_0x49db9f['id']);_0x1d09e6[_0x1c1b52(0x18c)](_0x49db9f['id'],_0x12f660);});})())]),{emailToId:_0x5f13af,idToEmail:_0x226078}=_0x1d86e3,_0x183c03=buildConnectionMaps(_0x53ff4d);return{'rootFolderId':_0x13bae0,'folderPathToId':_0x41c5f7,'folderIdToPath':_0x5607b8,'segmentNameToId':_0x4496ca,'activationsBySegmentId':_0x1d09e6,'emailToIdMap':_0x5f13af,'idToEmailMap':_0x226078,'connectionNameToIdMap':_0x183c03[_0x1d10fb(0x17d)],'connectionIdToNameMap':_0x183c03['idToName'],'connectionNameToTypeMap':_0x183c03[_0x1d10fb(0x14a)]};}export function createPushYamlContextForBundle(_0x3f888e,_0x420dad,_0x3dac12,_0x56f04d,_0x11a35b,_0x40eb0f,_0x4bd092,_0x306177){const {existingLocalSegmentNames:_0x4275b7,localExpandedRuleToNames:_0x4e4191}=_0x56f04d,_0x3739d8=new Set(),_0x2e6d64=new Map(),_0x311a2a=new Map(),_0x5615bb=new Map(),_0x523e3b=createJumpTargetCache(),_0xa2ec5=new Map(),_0x1d55fb=new Map(),_0x822514=new Set();let _0x4413e5;const _0x2e9472=_0x26b220=>{const _0x48ab7c={'resolveSegment':async _0x474440=>{const _0x5ae1c1=a114_0x3d4f,_0x30e63e=_0x5615bb[_0x5ae1c1(0x138)](_0x474440);if(_0x30e63e!==undefined)return{'name':_0x30e63e,'isJourneyLocal':!![]};try{const _0x2a9eff=await fetchSegment(_0x3f888e,_0x420dad,_0x474440,_0x3dac12);if(!_0x2a9eff)throw new Error(_0x5ae1c1(0x131));const _0x205d1d=generateJourneyLocalName(_0x2a9eff[_0x5ae1c1(0x174)]),_0x4c2ba1=_0x2a9eff[_0x5ae1c1(0x111)]===SEGMENT_KIND_JOURNEY&&_0x205d1d!==undefined;let _0xa56252=_0x2a9eff['name'],_0x947386;if(_0x4c2ba1&&_0x2a9eff[_0x5ae1c1(0x15b)]){const _0x5db334=apiRuleToYaml(_0x2a9eff[_0x5ae1c1(0x15b)]);_0x1d55fb['set'](_0x474440,_0x5db334);const _0x27ed1b=async _0x53d828=>{const _0x5b5c87=_0x5ae1c1,_0xfc5338=collectSegmentRefsFromRule(_0x53d828);for(const _0x5a1e91 of _0xfc5338){if(!_0x1d55fb[_0x5b5c87(0x128)](_0x5a1e91))try{const _0xa4cef0=await fetchSegment(_0x3f888e,_0x420dad,_0x5a1e91,_0x3dac12);if(_0xa4cef0?.[_0x5b5c87(0x15b)]){const _0x5bb4b0=apiRuleToYaml(_0xa4cef0[_0x5b5c87(0x15b)]);_0x1d55fb[_0x5b5c87(0x18c)](_0x5a1e91,_0x5bb4b0),await _0x27ed1b(_0x5bb4b0);}}catch(_0x4112f0){logger['debug'](_0x5b5c87(0x179)+_0x5a1e91+':\x20'+_0x4112f0);}}};await _0x27ed1b(_0x5db334);const _0x3d41cf=serializeExpandedRule(_0x5db334,_0x1d55fb),_0x23e323=_0x4e4191[_0x5ae1c1(0x138)](_0x3d41cf);if(_0x23e323&&_0x23e323[_0x5ae1c1(0x1a5)]>0x0){const _0x3f7f44=_0x2e6d64['get'](_0x3d41cf)||0x0,_0x6e3165=_0x23e323[_0x3f7f44]||_0x23e323[_0x23e323[_0x5ae1c1(0x1a5)]-0x1];_0x2e6d64[_0x5ae1c1(0x18c)](_0x3d41cf,_0x3f7f44+0x1),_0xa56252=_0x6e3165,_0x3739d8[_0x5ae1c1(0xb2)](_0xa56252),_0x5615bb[_0x5ae1c1(0x18c)](_0x474440,_0xa56252);const _0x45e4e0=await resolveRuleSegmentRefs(_0x5db334,async _0x211bdb=>{const _0x26380e=_0x5ae1c1,_0x2da01b=_0x5615bb[_0x26380e(0x138)](_0x211bdb);if(_0x2da01b)return _0x2da01b;const _0x960fcb=await _0x4413e5[_0x26380e(0xe0)](_0x211bdb);return _0x960fcb[_0x26380e(0x174)];});_0x947386={'description':_0x2a9eff[_0x5ae1c1(0x169)],'rule':_0x45e4e0};}else{const _0x32dbba=_0xa2ec5[_0x5ae1c1(0x138)](_0x3d41cf);if(_0x32dbba)_0xa56252=_0x32dbba,_0x5615bb[_0x5ae1c1(0x18c)](_0x474440,_0xa56252);else{if(_0x205d1d){let _0x52256c=_0x205d1d,_0x4aaef8=0x2;while(_0x3739d8[_0x5ae1c1(0x128)](_0x52256c)||_0x4275b7[_0x5ae1c1(0x128)](_0x52256c)){_0x52256c=_0x205d1d+'_'+_0x4aaef8,_0x4aaef8++;}_0x3739d8[_0x5ae1c1(0xb2)](_0x52256c),_0xa56252=_0x52256c;}_0x5615bb['set'](_0x474440,_0xa56252),_0xa2ec5[_0x5ae1c1(0x18c)](_0x3d41cf,_0xa56252);const _0x591535=await resolveRuleSegmentRefs(_0x5db334,async _0x3d43fd=>{const _0x57ded7=_0x5ae1c1,_0x41b7c6=_0x5615bb[_0x57ded7(0x138)](_0x3d43fd);if(_0x41b7c6)return _0x41b7c6;const _0x549693=await _0x4413e5[_0x57ded7(0xe0)](_0x3d43fd);return _0x549693[_0x57ded7(0x174)];});_0x947386={'description':_0x2a9eff[_0x5ae1c1(0x169)],'rule':_0x591535};}}}return{'name':_0xa56252,'isJourneyLocal':_0x4c2ba1,'definition':_0x947386};}catch(_0x498710){return logger[_0x5ae1c1(0x13a)](_0x5ae1c1(0x194)+_0x474440+':\x20'+_0x498710),{'name':_0x474440,'isJourneyLocal':![]};}},'resolveActivation':async _0x1cead7=>{const _0x138bc3=a114_0x3d4f,_0xd10cb=_0x311a2a['get'](_0x1cead7);if(_0xd10cb!==undefined)return{'name':_0xd10cb,'isJourneyLocal':!![]};try{let _0x3d1fc4=_0x4bd092?.['get'](_0x1cead7);!_0x3d1fc4&&(_0x3d1fc4=await _0x3f888e[_0x138bc3(0x1a7)][_0x138bc3(0x100)](_0x26b220,_0x1cead7));const _0xb8fc3b=_0x3d1fc4[_0x138bc3(0xcb)][_0x138bc3(0x115)][_0x138bc3(0x174)]||_0x1cead7,_0x68df8b=sanitizeYamlKey(_0xb8fc3b)||_0x138bc3(0xba)+_0x1cead7,_0x30c7f1=_0x68df8b;_0x311a2a[_0x138bc3(0x18c)](_0x1cead7,_0x30c7f1);const _0x1e1b5a=journeyActivationStepToYaml(_0x3d1fc4,_0x11a35b,_0x40eb0f);return{'name':_0x30c7f1,'isJourneyLocal':!![],'definition':_0x1e1b5a};}catch(_0x36c7fc){return logger[_0x138bc3(0x13a)](_0x138bc3(0x1a3)+_0x1cead7+':\x20'+_0x36c7fc),{'name':_0x1cead7,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x3224bd,_0x286132)=>resolveJumpTarget(_0x3224bd,_0x286132,_0x523e3b,async _0x481e31=>{const _0x45641b=a114_0x3d4f,_0x395183=_0x306177?.[_0x45641b(0x138)](_0x481e31);if(_0x395183)return _0x395183;return _0x3f888e['journey']['getJourney'](_0x481e31);})};return _0x4413e5=_0x48ab7c,_0x48ab7c;},_0x361919=async _0x215c09=>{const _0x37d168=a114_0x3d4f,{collectSegmentIdsFromJourneyApi:_0xd8cbde}=await import(_0x37d168(0x163)),{batchAsync:_0x5a2173}=await import(_0x37d168(0xe2)),_0x5628a1=new Set();for(const _0x2d6219 of _0x215c09){let _0x3dec45=_0x306177?.[_0x37d168(0x138)](_0x2d6219);!_0x3dec45&&(_0x3dec45=await _0x3f888e[_0x37d168(0x1a7)][_0x37d168(0xaf)](_0x2d6219));const _0x12655c=_0xd8cbde(_0x3dec45);for(const _0x125a6f of _0x12655c){_0x5628a1[_0x37d168(0xb2)](_0x125a6f);}}let _0x3e52a4=Array[_0x37d168(0x10e)](_0x5628a1);while(_0x3e52a4[_0x37d168(0x1a5)]>0x0){const _0x2c4c1b=_0x3e52a4[_0x37d168(0x166)](_0x5152d0=>!_0x822514[_0x37d168(0x128)](_0x5152d0));if(_0x2c4c1b[_0x37d168(0x1a5)]===0x0)break;const _0x5a587e=await _0x5a2173(_0x2c4c1b,async _0xd431ce=>{const _0x554a19=_0x37d168;_0x822514[_0x554a19(0xb2)](_0xd431ce);const _0x2086ac=await fetchSegment(_0x3f888e,_0x420dad,_0xd431ce,_0x3dac12);if(!_0x2086ac)return null;return{'segmentId':_0xd431ce,'segment':_0x2086ac};},0xa),_0x25cb25=new Set();for(const _0x48be69 of _0x5a587e){if(!_0x48be69?.['segment']?.[_0x37d168(0x15b)])continue;const _0x4ba039=apiRuleToYaml(_0x48be69[_0x37d168(0x105)]['rule']);_0x1d55fb[_0x37d168(0x18c)](_0x48be69['segmentId'],_0x4ba039);const _0x19d3b5=collectSegmentRefsFromRule(_0x4ba039);for(const _0x35a06d of _0x19d3b5){!_0x822514['has'](_0x35a06d)&&_0x25cb25['add'](_0x35a06d);}}_0x3e52a4=Array[_0x37d168(0x10e)](_0x25cb25);}};return{'createYamlContext':_0x2e9472,'prefetchJourneySegments':_0x361919};}export async function executePushSegments(_0x54d8c7,_0x54b222,_0xeaed7e,_0x6becd,_0xce4214){const _0x168237=a114_0x52cd1c,{segmentDefToCreateRequest:_0x11f65f,segmentDefToUpdateRequest:_0x1cb190}=await import(_0x168237(0x14e)),_0x2b5056=_0xeaed7e[_0x168237(0x192)],_0x3fab1e=0x5,_0x19570e=async _0x5ea6bc=>{const _0x90a0f3=_0x168237,_0x236348=_0x5ea6bc[_0x90a0f3(0x155)]?_0x2b5056[_0x90a0f3(0x138)](_0x5ea6bc[_0x90a0f3(0x155)]):undefined;let _0x34aabe;const _0x3f6c21={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};try{if(_0x5ea6bc['isNew']){_0xce4214[_0x90a0f3(0x18d)]?.({'type':_0x90a0f3(0x11a),'name':_0x5ea6bc[_0x90a0f3(0x161)]['name']});const _0xde84b9=_0x11f65f(_0x5ea6bc[_0x90a0f3(0x161)],_0x236348),_0x5dacdd=await _0xce4214[_0x90a0f3(0x126)](_0x90a0f3(0x184)+_0x5ea6bc[_0x90a0f3(0x161)][_0x90a0f3(0x174)]+_0x90a0f3(0xc7),()=>_0x54d8c7[_0x90a0f3(0x105)][_0x90a0f3(0xe9)](_0x6becd['parentId'],_0xde84b9));_0x34aabe=_0x5dacdd[_0x90a0f3(0x10c)]['id'],_0x3f6c21[_0x90a0f3(0x148)]={'name':_0x5ea6bc[_0x90a0f3(0x161)][_0x90a0f3(0x174)],'id':_0x34aabe},_0xce4214['onProgress']?.({'type':_0x90a0f3(0xde),'name':_0x5ea6bc[_0x90a0f3(0x161)][_0x90a0f3(0x174)],'segmentId':_0x34aabe}),_0xce4214['logSuccess']?.('Created\x20segment\x20\x27'+_0x5ea6bc[_0x90a0f3(0x161)][_0x90a0f3(0x174)]+'\x27'),_0x3f6c21[_0x90a0f3(0x102)]=0x1;}else{if(_0x5ea6bc[_0x90a0f3(0x154)]){_0xce4214[_0x90a0f3(0x18d)]?.({'type':_0x90a0f3(0x195),'name':_0x5ea6bc[_0x90a0f3(0x161)]['name']});const _0xfef8a1=_0x1cb190(_0x5ea6bc[_0x90a0f3(0x161)]);_0x236348!==_0x5ea6bc['existingSegment']?.[_0x90a0f3(0xf3)]&&(_0xfef8a1[_0x90a0f3(0xf3)]=_0x236348?parseInt(_0x236348,0xa):undefined),await _0xce4214[_0x90a0f3(0x126)](_0x90a0f3(0x186)+_0x5ea6bc['yamlConfig'][_0x90a0f3(0x174)]+'\x27...',()=>_0x54d8c7[_0x90a0f3(0x105)][_0x90a0f3(0xc1)](_0x6becd[_0x90a0f3(0x125)],_0x5ea6bc[_0x90a0f3(0x120)]['id'],_0xfef8a1)),_0x34aabe=_0x5ea6bc['existingSegment']['id'],_0xce4214[_0x90a0f3(0x18d)]?.({'type':'segment_updated','name':_0x5ea6bc[_0x90a0f3(0x161)]['name']}),_0xce4214[_0x90a0f3(0x108)]?.(_0x90a0f3(0x15c)+_0x5ea6bc[_0x90a0f3(0x161)][_0x90a0f3(0x174)]+'\x27'),_0x3f6c21[_0x90a0f3(0xc3)]=0x1;}else _0x34aabe=_0x5ea6bc[_0x90a0f3(0x120)]['id'];}}catch(_0x2cdad5){const _0x57c796=isHttp400Error(_0x2cdad5),_0x2e4d7f=_0x57c796?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode[_0x90a0f3(0x11c)],_0x6491b5=getErrorMessage(_0x2cdad5);throw new SDKError(_0x2e4d7f,_0x90a0f3(0xd1)+(_0x5ea6bc[_0x90a0f3(0x159)]?_0x90a0f3(0xbc):_0x90a0f3(0x14f))+'\x20segment\x20from\x20file:\x20'+_0x5ea6bc['absolutePath']+_0x90a0f3(0xfe)+_0x6491b5,_0x2cdad5);}try{const _0x1d9322=await syncActivationsForSegment(_0x54d8c7,_0x6becd[_0x90a0f3(0x125)],_0x34aabe,_0x5ea6bc['yamlConfig'][_0x90a0f3(0x174)],_0x5ea6bc[_0x90a0f3(0x171)],_0xce4214,_0x5ea6bc[_0x90a0f3(0x1a1)]);_0x3f6c21['activations']=_0x1d9322;}catch(_0x29d509){if(_0x29d509 instanceof SDKError)throw _0x29d509;throw new SDKError(ErrorCode[_0x90a0f3(0x199)],_0x90a0f3(0x19c)+_0x5ea6bc[_0x90a0f3(0x161)]['name']+_0x90a0f3(0xc9)+_0x5ea6bc[_0x90a0f3(0x1a1)]+'\x0a\x20\x20'+getErrorMessage(_0x29d509),_0x29d509);}return _0x3f6c21;},_0x5864b0=await batchAsync(_0x54b222,_0x19570e,_0x3fab1e),_0x4858bb={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x269b8d of _0x5864b0){_0x4858bb[_0x168237(0x102)]+=_0x269b8d[_0x168237(0x102)],_0x4858bb[_0x168237(0xc3)]+=_0x269b8d[_0x168237(0xc3)],_0x269b8d[_0x168237(0x148)]&&_0x4858bb[_0x168237(0x172)][_0x168237(0x18c)](_0x269b8d[_0x168237(0x148)][_0x168237(0x174)],_0x269b8d['createdSegmentId']['id']),_0x4858bb[_0x168237(0xfa)][_0x168237(0x102)]+=_0x269b8d['activations'][_0x168237(0x102)],_0x4858bb['activations'][_0x168237(0xc3)]+=_0x269b8d[_0x168237(0xfa)]['updated'],_0x4858bb['activations']['deleted']+=_0x269b8d[_0x168237(0xfa)][_0x168237(0x183)];}return _0x4858bb;}async function syncActivationsForSegment(_0x16baea,_0x28b238,_0x242026,_0x252a9f,_0x1f5561,_0x41e4b0,_0x54d5a8){const _0x39dd2d=a114_0x52cd1c,_0x29174d={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0xb6bf60 of _0x1f5561){try{if(_0xb6bf60[_0x39dd2d(0x118)]===_0x39dd2d(0xbc)&&_0xb6bf60[_0x39dd2d(0x14d)])_0x41e4b0['onProgress']?.({'type':_0x39dd2d(0xf2),'segmentName':_0x252a9f,'activationName':_0xb6bf60[_0x39dd2d(0x174)]}),await _0x41e4b0[_0x39dd2d(0x126)]('Creating\x20activation\x20\x27'+_0xb6bf60[_0x39dd2d(0x174)]+'\x27...',()=>_0x16baea[_0x39dd2d(0x105)][_0x39dd2d(0x13b)](_0x28b238,_0x242026,_0xb6bf60[_0x39dd2d(0x14d)])),_0x41e4b0['onProgress']?.({'type':_0x39dd2d(0xd0),'segmentName':_0x252a9f,'activationName':_0xb6bf60[_0x39dd2d(0x174)]}),_0x41e4b0['logSuccess']?.('Created\x20activation\x20\x27'+_0xb6bf60['name']+'\x27'),_0x29174d[_0x39dd2d(0x102)]++;else{if(_0xb6bf60[_0x39dd2d(0x118)]===_0x39dd2d(0x14f)&&_0xb6bf60[_0x39dd2d(0x14d)]&&_0xb6bf60['existingActivation'])_0x41e4b0['onProgress']?.({'type':_0x39dd2d(0xdd),'segmentName':_0x252a9f,'activationName':_0xb6bf60[_0x39dd2d(0x174)]}),await _0x41e4b0[_0x39dd2d(0x126)](_0x39dd2d(0xef)+_0xb6bf60['name']+_0x39dd2d(0xc7),()=>_0x16baea[_0x39dd2d(0x105)]['updateActivation'](_0x28b238,_0x242026,_0xb6bf60[_0x39dd2d(0x19d)]['id'],_0xb6bf60[_0x39dd2d(0x14d)])),_0x41e4b0[_0x39dd2d(0x18d)]?.({'type':'activation_updated','segmentName':_0x252a9f,'activationName':_0xb6bf60[_0x39dd2d(0x174)]}),_0x41e4b0[_0x39dd2d(0x108)]?.(_0x39dd2d(0x137)+_0xb6bf60[_0x39dd2d(0x174)]+'\x27'),_0x29174d[_0x39dd2d(0xc3)]++;else _0xb6bf60[_0x39dd2d(0x118)]===_0x39dd2d(0xb6)&&_0xb6bf60[_0x39dd2d(0x19d)]&&(_0x41e4b0[_0x39dd2d(0x18d)]?.({'type':_0x39dd2d(0xc4),'segmentName':_0x252a9f,'activationName':_0xb6bf60['name']}),await _0x41e4b0['withProgress']('Deleting\x20activation\x20\x27'+_0xb6bf60[_0x39dd2d(0x174)]+_0x39dd2d(0xc7),()=>_0x16baea[_0x39dd2d(0x105)]['deleteActivation'](_0x28b238,_0x242026,_0xb6bf60['existingActivation']['id'])),_0x41e4b0[_0x39dd2d(0x18d)]?.({'type':_0x39dd2d(0x103),'segmentName':_0x252a9f,'activationName':_0xb6bf60[_0x39dd2d(0x174)]}),_0x41e4b0['logDeleted']?.(_0x39dd2d(0xea)+_0xb6bf60[_0x39dd2d(0x174)]+'\x27'),_0x29174d['deleted']++);}}catch(_0x4095ec){const _0x580738=isHttp400Error(_0x4095ec),_0x4f9d62=_0x580738?ErrorCode[_0x39dd2d(0x196)]:ErrorCode[_0x39dd2d(0x199)],_0x3518a8=getErrorMessage(_0x4095ec);throw new SDKError(_0x4f9d62,'Failed\x20to\x20'+_0xb6bf60[_0x39dd2d(0x118)]+'\x20activation\x20\x27'+_0xb6bf60[_0x39dd2d(0x174)]+_0x39dd2d(0xc9)+_0x54d5a8+_0x39dd2d(0xfe)+_0x3518a8,_0x4095ec);}}return _0x29174d;}export async function executePushFolders(_0x43d97e,_0x3be312,_0xdfd3f8,_0x300ccb,_0x300876){const _0x567af0=a114_0x52cd1c,_0x4334cb=new Map(_0xdfd3f8);for(const _0x1b0f25 of _0x3be312){const _0x46bbff=_0x1b0f25[_0x567af0(0x136)]('/'),_0x173fa8=_0x46bbff[_0x46bbff[_0x567af0(0x1a5)]-0x1],_0x288a52=_0x46bbff['slice'](0x0,-0x1)[_0x567af0(0x180)]('/'),_0x3a455d=_0x4334cb['get'](_0x288a52);_0x300876[_0x567af0(0x18d)]?.({'type':_0x567af0(0x113),'folder':_0x1b0f25});const _0x5f54bb={'name':_0x173fa8,'parentFolderId':_0x3a455d},_0x946a55=await _0x300876[_0x567af0(0x126)](_0x567af0(0x109)+_0x1b0f25+_0x567af0(0xc7),()=>_0x43d97e['segment']['createFolder'](_0x300ccb[_0x567af0(0x125)],_0x5f54bb));_0x4334cb[_0x567af0(0x18c)](_0x1b0f25,_0x946a55[_0x567af0(0x10c)]['id']),_0x300876[_0x567af0(0x18d)]?.({'type':_0x567af0(0xec),'folder':_0x1b0f25,'folderId':_0x946a55[_0x567af0(0x10c)]['id']}),_0x300876[_0x567af0(0x12a)]?.(_0x567af0(0x141)+_0x1b0f25+'\x27');}return _0x4334cb;}export async function executePushSegmentDeletions(_0x2f68fa,_0x4f4069,_0x75cdd4){const _0x17e3a6=a114_0x52cd1c;if(_0x4f4069['length']===0x0)return 0x0;const {batchAsync:_0x439620}=await import(_0x17e3a6(0xe2)),_0x32534b=0x5,_0x56e6b4=await _0x439620(_0x4f4069,async _0x39772a=>{const _0x520e8a=_0x17e3a6;return _0x75cdd4['onProgress']?.({'type':_0x520e8a(0xfb),'name':_0x39772a[_0x520e8a(0x174)]}),await _0x2f68fa[_0x520e8a(0x105)][_0x520e8a(0x146)](_0x39772a['id']),_0x75cdd4[_0x520e8a(0x18d)]?.({'type':_0x520e8a(0x18a),'name':_0x39772a[_0x520e8a(0x174)]}),_0x75cdd4[_0x520e8a(0x11e)]?.(_0x520e8a(0x112)+_0x39772a[_0x520e8a(0x174)]+'\x27'),0x1;},_0x32534b);return _0x56e6b4[_0x17e3a6(0x19a)]((_0x12c707,_0x221173)=>_0x12c707+_0x221173,0x0);}export async function executePushJourneys(_0x1621cb,_0x384202,_0x1d0577,_0x5ab202,_0x2e6209){const _0x56f07f=a114_0x52cd1c,{journeyDefToRequest:_0x3fdfaf}=await import('./journey-yaml.js'),{activationDefToCreateRequest:_0x49fbb6,yamlRuleToApi:_0xe4edba,validateSegmentRule:_0x11cb9f}=await import('./child-segment-yaml.js'),_0x6ed631={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x1a63e6=new Map(_0x1d0577['segmentNameToId']),_0x26cdc1=0x5;for(let _0x2be072=0x0;_0x2be072<_0x384202[_0x56f07f(0x1a5)];_0x2be072+=_0x26cdc1){const _0x46471e=_0x384202['slice'](_0x2be072,_0x2be072+_0x26cdc1),_0x2807ac=await Promise['all'](_0x46471e['map'](async _0x4bf766=>{const _0x263bca=_0x56f07f;if(!_0x4bf766[_0x263bca(0x159)]&&!_0x4bf766[_0x263bca(0x154)])return{'action':_0x263bca(0x164),'name':_0x4bf766[_0x263bca(0x161)][_0x263bca(0x174)],'journeyId':_0x4bf766[_0x263bca(0x158)]?.['id']};const _0x3d05df=_0x4bf766[_0x263bca(0x155)]?_0x1d0577[_0x263bca(0x192)][_0x263bca(0x138)](_0x4bf766[_0x263bca(0x155)]):undefined;_0x2e6209[_0x263bca(0x18d)]?.({'type':_0x4bf766['isNew']?_0x263bca(0x10b):_0x263bca(0xfc),'name':_0x4bf766[_0x263bca(0x161)][_0x263bca(0x174)]});try{const _0x4745c4=await executeSingleJourneyPush(_0x1621cb,_0x4bf766,{..._0x1d0577,'segmentNameToId':_0x1a63e6},{'parentId':_0x5ab202[_0x263bca(0x125)],'rootFolderId':_0x5ab202[_0x263bca(0x129)],'folderId':_0x3d05df,'verbose':_0x5ab202['verbose']},_0x2e6209,{'journeyDefToRequest':_0x3fdfaf,'activationDefToCreateRequest':_0x49fbb6,'yamlRuleToApi':_0xe4edba,'validateSegmentRule':_0x11cb9f});for(const [_0x2fadbb,_0x9189b7]of _0x4745c4['embeddedSegmentNameToId']){_0x1a63e6[_0x263bca(0x18c)](_0x2fadbb,_0x9189b7),_0x6ed631[_0x263bca(0xf5)][_0x263bca(0x18c)](_0x2fadbb,_0x9189b7);}if(_0x4745c4[_0x263bca(0xb8)]===_0x263bca(0x102))_0x2e6209[_0x263bca(0x18d)]?.({'type':_0x263bca(0x17a),'name':_0x4bf766[_0x263bca(0x161)][_0x263bca(0x174)],'journeyId':_0x4745c4[_0x263bca(0x167)]}),_0x2e6209[_0x263bca(0x108)]?.(_0x263bca(0xb7)+_0x4bf766[_0x263bca(0x161)][_0x263bca(0x174)]+'\x27'),_0x6ed631['created']++;else _0x4745c4['action']==='updated'&&(_0x2e6209[_0x263bca(0x18d)]?.({'type':_0x263bca(0x14b),'name':_0x4bf766['yamlConfig']['name']}),_0x2e6209['logSuccess']?.(_0x263bca(0xda)+_0x4bf766[_0x263bca(0x161)][_0x263bca(0x174)]+'\x27'),_0x6ed631[_0x263bca(0xc3)]++);return{'action':_0x4745c4[_0x263bca(0xb8)],'name':_0x4bf766[_0x263bca(0x161)]['name'],'journeyId':_0x4745c4['journeyId']};}catch(_0x17a8c4){const _0x4a37a6=isHttp400Error(_0x17a8c4),_0x49252a=_0x4a37a6?ErrorCode[_0x263bca(0xf4)]:ErrorCode[_0x263bca(0x1a8)],_0x4cb5bc=getErrorMessage(_0x17a8c4);throw new SDKError(_0x49252a,_0x263bca(0xd1)+(_0x4bf766['isNew']?'create':_0x263bca(0x14f))+'\x20journey\x20from\x20file:\x20'+_0x4bf766[_0x263bca(0x1a1)]+_0x263bca(0xfe)+_0x4cb5bc,_0x17a8c4);}}));_0x6ed631[_0x56f07f(0x119)][_0x56f07f(0x122)](..._0x2807ac);}return _0x6ed631;}async function matchExistingJourneySegments(_0x4e37de,_0x562373,_0x2bb6d9,_0x25a7b1,_0x2d8f08){const _0x33193b=a114_0x52cd1c;if(!_0x562373[_0x33193b(0x158)]||!_0x562373[_0x33193b(0x161)][_0x33193b(0x16b)])return;const _0xe60af0=new Map();for(const _0x51b2dc of Object[_0x33193b(0x13c)](_0x562373[_0x33193b(0x161)][_0x33193b(0x16b)])){const _0x3d4969=generateDeterministicJourneySegmentName(_0x562373[_0x33193b(0x161)]['name'],_0x51b2dc);_0xe60af0[_0x33193b(0x18c)](_0x3d4969,_0x51b2dc);}const _0x4e8f3c=collectSegmentIdsFromJourneyApi(_0x562373[_0x33193b(0x158)]);for(const _0x30a506 of _0x4e8f3c){const _0x40a7f3=await fetchSegment(_0x4e37de,_0x2bb6d9,_0x30a506,_0x25a7b1);if(!_0x40a7f3?.[_0x33193b(0x174)])continue;const _0x1b4caa=_0xe60af0['get'](_0x40a7f3[_0x33193b(0x174)]);_0x1b4caa&&_0x2d8f08[_0x33193b(0x18c)](_0x1b4caa,_0x30a506);}}async function executeSingleJourneyPush(_0x442d3d,_0x3ed15e,_0x837c91,_0x1d79fa,_0x5b7422,_0xf7ab85){const _0x3ac36e=a114_0x52cd1c,{journeyDefToRequest:_0x3235f8,activationDefToCreateRequest:_0x2f62c7,yamlRuleToApi:_0x490b8e,validateSegmentRule:_0x4ea031}=_0xf7ab85,_0x21dac9=new Map(),_0x15e283=new Map();recoverSegmentIdsFromPushRecovery(_0x3ed15e,_0x21dac9,_0x837c91['segmentNameToId']);const _0xbed13f=new Map(),_0x3ea3e7=new Map(),_0x2f9185=new Map();let _0x23f9c4;const _0x5a9186=async()=>{const _0x1d752d=a114_0x3d4f;if(_0x23f9c4)return;_0x23f9c4=new Map();if(!_0x3ed15e[_0x1d752d(0x158)])return;const _0x5b95d3=await _0x442d3d[_0x1d752d(0x1a7)][_0x1d752d(0x1a2)](_0x3ed15e[_0x1d752d(0x158)]['id']);for(const _0x17003c of _0x5b95d3){const _0x1ce5d1=journeyActivationStepToYaml(_0x17003c,_0x837c91[_0x1d752d(0x144)],_0x837c91[_0x1d752d(0x168)]),_0x53dbf9=activationSignature(_0x1ce5d1);!_0x23f9c4[_0x1d752d(0x128)](_0x53dbf9)&&_0x23f9c4[_0x1d752d(0x18c)](_0x53dbf9,_0x17003c['id']),_0x1ce5d1['name']&&_0x15e283[_0x1d752d(0x18c)](_0x1ce5d1[_0x1d752d(0x174)],_0x17003c['id']);}};await matchExistingJourneySegments(_0x442d3d,_0x3ed15e,_0x1d79fa['parentId'],_0x837c91[_0x3ac36e(0x15a)],_0x837c91[_0x3ac36e(0xbe)]);const _0x35f251={'resolveSegmentId':async _0x3d841a=>{const _0x375f48=_0x3ac36e,_0x48a745=_0x837c91[_0x375f48(0xbe)][_0x375f48(0x138)](_0x3d841a);if(!_0x48a745)throw new SDKError(ErrorCode[_0x375f48(0x189)],_0x375f48(0x178)+_0x3d841a+_0x375f48(0xc2)+_0x3ed15e[_0x375f48(0x161)][_0x375f48(0x174)]+')');return _0x48a745;},'resolveEmbeddedSegmentId':async(_0x18663f,_0x394909)=>{const _0x4cef14=_0x3ac36e,_0x3f5895=_0x837c91[_0x4cef14(0xbe)][_0x4cef14(0x138)](_0x18663f);if(_0x3f5895)return _0x3f5895;const _0x5871cb=_0x837c91[_0x4cef14(0x15a)]['find'](_0x12347d=>_0x12347d['name']===_0x18663f);if(_0x5871cb)return _0x837c91[_0x4cef14(0xbe)][_0x4cef14(0x18c)](_0x18663f,_0x5871cb['id']),_0x5871cb['id'];if(_0x3ed15e['isNew']){const {stageName:_0x4a0f3c,criteriaName:_0x349fbc}=findSegmentCriteriaLocation(_0x3ed15e['yamlConfig'],_0x18663f);return _0x4ea031(_0x18663f,_0x394909[_0x4cef14(0x15b)]),_0x3ea3e7[_0x4cef14(0x18c)](_0x18663f,{'definition':_0x394909,'stageName':_0x4a0f3c,'criteriaName':_0x349fbc}),createPendingSegmentId(_0x18663f);}const _0xe2aafc=_0x3ed15e[_0x4cef14(0x158)]?.['id'];if(!_0xe2aafc)throw new SDKError(ErrorCode[_0x4cef14(0x198)],_0x4cef14(0xed));const _0x1da10f=_0xbed13f[_0x4cef14(0x138)](_0x18663f);if(_0x1da10f)return _0x1da10f;const _0x4f2dad=((async()=>{const _0x4eaa7c=_0x4cef14;_0x4ea031(_0x18663f,_0x394909[_0x4eaa7c(0x15b)]);const _0x4bdf07=generateDeterministicJourneySegmentName(_0x3ed15e[_0x4eaa7c(0x161)][_0x4eaa7c(0x174)],_0x18663f),_0x55e2c4=_0x837c91[_0x4eaa7c(0x15a)][_0x4eaa7c(0x1a0)](_0x2dd619=>_0x2dd619[_0x4eaa7c(0x174)]===_0x4bdf07),_0x579fbf=createSegmentIdResolver(_0x837c91['segmentNameToId'],_0x18663f),_0x465cc1=await resolveRuleSegmentIds(_0x394909[_0x4eaa7c(0x15b)],_0x579fbf);let _0x3395af;return _0x55e2c4?(await _0x442d3d[_0x4eaa7c(0x105)]['updateSegmentById'](_0x1d79fa[_0x4eaa7c(0x125)],_0x55e2c4['id'],{'description':_0x394909[_0x4eaa7c(0x169)]||_0x4eaa7c(0x173)+_0x18663f,'rule':_0x490b8e(_0x465cc1,!![]),'countPopulation':!![]}),_0x3395af=_0x55e2c4['id'],saveSegmentToPushRecovery(_0x3ed15e[_0x4eaa7c(0x1a1)],_0x3ed15e[_0x4eaa7c(0x161)][_0x4eaa7c(0x174)],_0x18663f,{'segmentId':_0x3395af,'uniqueServerName':_0x4bdf07,'createdAt':new Date()['toISOString']()})):_0x3395af=await createOrRecoverEmbeddedSegment(_0x442d3d,_0x3ed15e,{'localName':_0x18663f,'uniqueSegmentName':_0x4bdf07,'description':_0x394909['description']||_0x4eaa7c(0x173)+_0x18663f,'journeyId':_0xe2aafc,'resolvedRule':_0x465cc1,'parentId':_0x1d79fa[_0x4eaa7c(0x125)],'folderId':_0x1d79fa[_0x4eaa7c(0x129)]||''},_0x490b8e),_0x837c91[_0x4eaa7c(0xbe)][_0x4eaa7c(0x18c)](_0x18663f,_0x3395af),_0x21dac9[_0x4eaa7c(0x18c)](_0x18663f,_0x3395af),_0x3395af;})());_0xbed13f['set'](_0x18663f,_0x4f2dad);try{return await _0x4f2dad;}finally{_0xbed13f[_0x4cef14(0xb6)](_0x18663f);}},'resolveActivationId':async _0x425bdf=>{const _0x19bd2e=_0x3ac36e,_0x2e88e2=_0x15e283[_0x19bd2e(0x138)](_0x425bdf);if(_0x2e88e2)return _0x2e88e2;if(_0x3ed15e['existingJourney']){await _0x5a9186();const _0x1efe2a=_0x15e283[_0x19bd2e(0x138)](_0x425bdf);if(_0x1efe2a)return _0x1efe2a;}throw new SDKError(ErrorCode[_0x19bd2e(0xd3)],_0x19bd2e(0x151)+_0x425bdf+_0x19bd2e(0xc2)+_0x3ed15e[_0x19bd2e(0x161)][_0x19bd2e(0x174)]+').\x20'+_0x19bd2e(0xcf));},'resolveEmbeddedActivationId':async(_0x30c386,_0x1acf8b)=>{const _0x887dd=_0x3ac36e,_0x3dcd7f=_0x15e283[_0x887dd(0x138)](_0x30c386);if(_0x3dcd7f)return _0x3dcd7f;if(_0x3ed15e[_0x887dd(0x159)])return _0x2f9185['set'](_0x30c386,_0x1acf8b),createPendingActivationId(_0x30c386);if(_0x3ed15e[_0x887dd(0x158)]){await _0x5a9186();const _0x447816=_0x15e283[_0x887dd(0x138)](_0x1acf8b[_0x887dd(0x174)]);if(_0x447816)return _0x15e283[_0x887dd(0x18c)](_0x30c386,_0x447816),_0x447816;const _0x5b3dae=activationSignature(_0x1acf8b),_0x227612=_0x23f9c4?.[_0x887dd(0x138)](_0x5b3dae);if(_0x227612)return _0x15e283['set'](_0x30c386,_0x227612),_0x227612;const _0x472e78=await _0x2f62c7(_0x1acf8b,_0x837c91[_0x887dd(0xd9)]),_0xddfb6a={..._0x472e78,..._0x1acf8b[_0x887dd(0xe6)]!==undefined&&{'runAfterJourneyRefresh':_0x1acf8b['run_after_journey_refresh']}},_0x562f80=await _0x442d3d[_0x887dd(0x1a7)][_0x887dd(0x13b)](_0x3ed15e[_0x887dd(0x158)]['id'],_0xddfb6a);return _0x15e283['set'](_0x30c386,_0x562f80['id']),_0x562f80['id'];}throw new SDKError(ErrorCode[_0x887dd(0x198)],_0x887dd(0xdf));},'resolveJourneyId':async _0x353124=>{const _0x304781=_0x3ac36e;try{return await _0x442d3d[_0x304781(0x1a7)][_0x304781(0x140)](_0x1d79fa[_0x304781(0x125)],_0x353124);}catch(_0x1be189){throw new SDKError(ErrorCode['NOT_FOUND'],_0x304781(0x197)+_0x353124+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x3ed15e[_0x304781(0x161)][_0x304781(0x174)]+'\x27)',_0x1be189);}},'resolveStageId':async(_0x12e0c8,_0x56e19d)=>{const _0xe3f3cb=_0x3ac36e,_0x48fc2b=await _0x442d3d['journey'][_0xe3f3cb(0xaf)](_0x12e0c8),_0x2c67d7=_0x48fc2b['attributes'][_0xe3f3cb(0x150)][_0xe3f3cb(0x1a0)](_0xb59c2f=>_0xb59c2f['name'][_0xe3f3cb(0x185)]()===_0x56e19d['toLowerCase']());if(!_0x2c67d7?.['id'])throw new SDKError(ErrorCode[_0xe3f3cb(0xd3)],_0xe3f3cb(0xf8)+_0x56e19d+_0xe3f3cb(0xf0)+(_0x48fc2b[_0xe3f3cb(0xcb)][_0xe3f3cb(0xc6)]||_0x48fc2b[_0xe3f3cb(0xcb)][_0xe3f3cb(0x174)])+'\x27');return _0x2c67d7['id'];}},_0x201989=await _0x3235f8(_0x3ed15e[_0x3ac36e(0x161)],_0x1d79fa[_0x3ac36e(0x125)],_0x35f251),_0x3c1649=_0x1d79fa[_0x3ac36e(0x101)]||_0x1d79fa[_0x3ac36e(0x129)];_0x3c1649&&(_0x201989[_0x3ac36e(0x193)]={'parentFolder':{'data':{'id':_0x3c1649,'type':_0x3ac36e(0x18e)}}});if(_0x3ed15e[_0x3ac36e(0x159)]){if(_0x3ea3e7['size']>0x0||_0x2f9185[_0x3ac36e(0x133)]>0x0)return await executeThreeStepJourneyCreate(_0x442d3d,_0x3ed15e,_0x201989,{'pendingEmbeddedSegments':_0x3ea3e7,'pendingEmbeddedActivations':_0x2f9185,'embeddedSegmentNameToId':_0x21dac9,'journeyActivationNameToId':_0x15e283},{..._0x1d79fa,'effectiveFolderId':_0x3c1649},_0x837c91,_0x5b7422,_0xf7ab85);else{ensureJourneyDefaults(_0x201989['attributes']);const _0x1af751=await _0x442d3d[_0x3ac36e(0x1a7)][_0x3ac36e(0xbc)](_0x201989);return deletePushRecovery(_0x3ed15e['absolutePath']),{'action':'created','journeyId':_0x1af751['id'],'embeddedSegmentNameToId':_0x21dac9};}}else{if(_0x3ed15e[_0x3ac36e(0x154)]&&_0x3ed15e['existingJourney'])return ensureJourneyDefaults(_0x201989['attributes']),await _0x442d3d['journey'][_0x3ac36e(0x14f)](_0x3ed15e['existingJourney']['id'],_0x201989),deletePushRecovery(_0x3ed15e[_0x3ac36e(0x1a1)]),{'action':'updated','journeyId':_0x3ed15e[_0x3ac36e(0x158)]['id'],'embeddedSegmentNameToId':_0x21dac9};}return deletePushRecovery(_0x3ed15e[_0x3ac36e(0x1a1)]),{'action':_0x3ac36e(0x164),'journeyId':_0x3ed15e[_0x3ac36e(0x158)]?.['id'],'embeddedSegmentNameToId':_0x21dac9};}function findSegmentCriteriaLocation(_0x5d728c,_0x3ff200){const _0x14bfce=a114_0x52cd1c,_0x3330e5=_0x5d728c[_0x14bfce(0x15d)]||_0x5d728c[_0x14bfce(0xe5)]?.[0x0]?.[_0x14bfce(0x15d)]||[];let _0x353001=_0x14bfce(0x10a),_0x3e4622=_0x3ff200;const _0x1221c8=_0x5d728c['goal']||_0x5d728c[_0x14bfce(0xe5)]?.[0x0]?.[_0x14bfce(0x104)];if(_0x1221c8?.[_0x14bfce(0x105)]===_0x3ff200)return{'stageName':'goal','criteriaName':_0x1221c8['name']||_0x3ff200};_0x3eca0d:for(const _0x474d1d of _0x3330e5){if(_0x474d1d[_0x14bfce(0x110)]?.[_0x14bfce(0x105)]===_0x3ff200){_0x353001=_0x474d1d[_0x14bfce(0x174)],_0x3e4622=_0x474d1d[_0x14bfce(0x110)]['name']||_0x3ff200;break;}if(_0x474d1d[_0x14bfce(0xd8)])for(const _0xdff664 of _0x474d1d[_0x14bfce(0xd8)]){if(_0xdff664[_0x14bfce(0x118)]==='decision_point'&&_0xdff664[_0x14bfce(0x181)]?.['branches'])for(const _0xf7dedc of _0xdff664[_0x14bfce(0x181)][_0x14bfce(0xe4)]){if(_0xf7dedc[_0x14bfce(0x105)]===_0x3ff200){_0x353001=_0x474d1d[_0x14bfce(0x174)],_0x3e4622=_0xf7dedc[_0x14bfce(0x174)]||_0x3ff200;break _0x3eca0d;}}}}return{'stageName':_0x353001,'criteriaName':_0x3e4622};}async function executeThreeStepJourneyCreate(_0x42a4e7,_0xb63564,_0x1b845b,_0x35d3f4,_0x453600,_0xb26d47,_0xcd5c5d,_0x58b8c3){const _0x4def7e=a114_0x52cd1c,{activationDefToCreateRequest:_0xd72147,yamlRuleToApi:_0x2b4259}=_0x58b8c3,{pendingEmbeddedSegments:_0x473ab0,pendingEmbeddedActivations:_0x40a545,embeddedSegmentNameToId:_0x3bb63d}=_0x35d3f4,_0x4d1ee5=JSON[_0x4def7e(0x17e)](JSON['stringify'](_0x1b845b));ensureJourneyDefaults(_0x4d1ee5[_0x4def7e(0xcb)]),stripPendingIds(_0x4d1ee5);const _0x301df5=await _0x42a4e7[_0x4def7e(0x1a7)][_0x4def7e(0xbc)](_0x4d1ee5),_0x85217a=_0x301df5['id'],_0x176ece=new Map();for(const _0x2bf78f of _0x301df5[_0x4def7e(0xcb)][_0x4def7e(0x150)]){_0x176ece['set'](_0x2bf78f[_0x4def7e(0x174)][_0x4def7e(0x185)](),_0x2bf78f['id']);}recoverSegmentIdsFromPushRecovery(_0xb63564,_0x3bb63d,_0xb26d47['segmentNameToId']);for(const [_0xd0b463,{definition:_0x437ade}]of _0x473ab0){if(_0x3bb63d['has'](_0xd0b463)){_0xcd5c5d['onProgress']?.({'type':'embedded_segment_created','journeyName':_0xb63564[_0x4def7e(0x161)][_0x4def7e(0x174)],'segmentName':_0xd0b463});continue;}const _0x215704=generateDeterministicJourneySegmentName(_0xb63564[_0x4def7e(0x161)][_0x4def7e(0x174)],_0xd0b463);_0xcd5c5d[_0x4def7e(0x18d)]?.({'type':_0x4def7e(0x16d),'journeyName':_0xb63564[_0x4def7e(0x161)]['name'],'segmentName':_0xd0b463});const _0x4e2876=createSegmentIdResolver(_0xb26d47[_0x4def7e(0xbe)],_0xd0b463),_0x2412f5=await resolveRuleSegmentIds(_0x437ade[_0x4def7e(0x15b)],_0x4e2876),_0x4fc63d=await createOrRecoverEmbeddedSegment(_0x42a4e7,_0xb63564,{'localName':_0xd0b463,'uniqueSegmentName':_0x215704,'description':_0x437ade[_0x4def7e(0x169)]||_0x4def7e(0x173)+_0xd0b463,'journeyId':_0x85217a,'resolvedRule':_0x2412f5,'parentId':_0x453600['parentId'],'folderId':_0x453600[_0x4def7e(0x18f)]||''},_0x2b4259);_0x3bb63d['set'](_0xd0b463,_0x4fc63d),_0xb26d47[_0x4def7e(0xbe)][_0x4def7e(0x18c)](_0xd0b463,_0x4fc63d),_0xcd5c5d['onProgress']?.({'type':_0x4def7e(0xdc),'journeyName':_0xb63564['yamlConfig'][_0x4def7e(0x174)],'segmentName':_0xd0b463});}const _0x2d87c9=new Map();for(const [_0x91df98,_0x5b1383]of _0x40a545){_0xcd5c5d['onProgress']?.({'type':_0x4def7e(0x145),'journeyName':_0xb63564['yamlConfig'][_0x4def7e(0x174)],'activationName':_0x91df98});const _0x5b9f96=await _0xd72147(_0x5b1383,_0xb26d47['activationContext']),_0x201a2c={..._0x5b9f96,..._0x5b1383['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x5b1383[_0x4def7e(0xe6)]}},_0x4acd5e=await _0x42a4e7['journey'][_0x4def7e(0x13b)](_0x85217a,_0x201a2c);_0x2d87c9[_0x4def7e(0x18c)](_0x91df98,_0x4acd5e['id']),_0x35d3f4[_0x4def7e(0xfd)][_0x4def7e(0x18c)](_0x91df98,_0x4acd5e['id']),_0xcd5c5d[_0x4def7e(0x18d)]?.({'type':'embedded_activation_created','journeyName':_0xb63564['yamlConfig'][_0x4def7e(0x174)],'activationName':_0x91df98});}const _0x20d7c2=JSON['parse'](JSON['stringify'](_0x1b845b));return _0x20d7c2['id']=_0x85217a,ensureJourneyDefaults(_0x20d7c2[_0x4def7e(0xcb)]),resolvePendingIdsInRequest(_0x20d7c2,_0x1b845b,_0x176ece,_0x3bb63d,_0x2d87c9,_0xcd5c5d),await _0x42a4e7[_0x4def7e(0x1a7)]['update'](_0x85217a,_0x20d7c2),deletePushRecovery(_0xb63564[_0x4def7e(0x1a1)]),{'action':_0x4def7e(0x102),'journeyId':_0x85217a,'embeddedSegmentNameToId':_0x3bb63d};}export function stripWaitStepPendingIds(_0x16b2d9){const _0x401adf=a114_0x52cd1c,_0x1c391b=_0x16b2d9[_0x401adf(0x139)]&&isPendingSegmentId(_0x16b2d9[_0x401adf(0x139)]),_0x3bc112=_0x16b2d9['conditions']?.[_0x401adf(0x116)](_0x281346=>_0x281346[_0x401adf(0x182)]&&isPendingSegmentId(_0x281346['segmentId']));(_0x1c391b||_0x3bc112)&&(_0x16b2d9[_0x401adf(0xdb)]=_0x401adf(0x143),_0x16b2d9['waitStep']=0x1,_0x16b2d9['waitStepUnit']=_0x401adf(0x156),delete _0x16b2d9['conditionSegmentId'],delete _0x16b2d9['conditionTimeoutDuration'],delete _0x16b2d9[_0x401adf(0x10d)],delete _0x16b2d9[_0x401adf(0x16a)]);}export function resolveWaitStepPendingIds(_0x3696d6,_0x329b91,_0x3ad3ec,_0x216aca){const _0x34bc9d=a114_0x52cd1c;if(_0x329b91[_0x34bc9d(0x139)]&&isPendingSegmentId(_0x329b91[_0x34bc9d(0x139)])){const _0x380e98=_0x3ad3ec(_0x329b91[_0x34bc9d(0x139)],'stage\x20\x27'+_0x216aca+_0x34bc9d(0xd5));_0x380e98&&(_0x3696d6[_0x34bc9d(0xdb)]=_0x34bc9d(0x17c),_0x3696d6['conditionSegmentId']=_0x380e98,delete _0x3696d6[_0x34bc9d(0x1a4)],delete _0x3696d6[_0x34bc9d(0xd7)],_0x329b91[_0x34bc9d(0xad)]!==undefined&&(_0x3696d6[_0x34bc9d(0xad)]=_0x329b91[_0x34bc9d(0xad)]),_0x329b91['conditionTimeoutUnit']&&(_0x3696d6['conditionTimeoutUnit']=_0x329b91[_0x34bc9d(0x10d)]));}if(_0x329b91[_0x34bc9d(0x16a)]){const _0x19e584=_0x329b91['conditions'][_0x34bc9d(0x116)](_0x28be45=>_0x28be45['segmentId']&&isPendingSegmentId(_0x28be45[_0x34bc9d(0x182)]));if(_0x19e584){const _0xc05469=_0x329b91['conditions']['map'](_0x572b67=>{const _0x3f7c2d=_0x34bc9d;if(_0x572b67[_0x3f7c2d(0x182)]&&isPendingSegmentId(_0x572b67['segmentId'])){const _0x30827a=_0x3ad3ec(_0x572b67['segmentId'],_0x3f7c2d(0xb5)+_0x216aca+'\x27\x20wait\x20condition');return{..._0x572b67,'segmentId':_0x30827a||_0x572b67['segmentId']};}return{..._0x572b67};});_0x3696d6[_0x34bc9d(0xdb)]='Condition',_0x3696d6['conditions']=_0xc05469,delete _0x3696d6[_0x34bc9d(0x1a4)],delete _0x3696d6[_0x34bc9d(0xd7)],delete _0x3696d6['conditionSegmentId'],delete _0x3696d6[_0x34bc9d(0xad)],delete _0x3696d6[_0x34bc9d(0x10d)];}}}function stripPendingIds(_0x26e9e8){const _0x362566=a114_0x52cd1c;_0x26e9e8[_0x362566(0xcb)][_0x362566(0x104)]?.['segmentId']&&isPendingSegmentId(_0x26e9e8[_0x362566(0xcb)][_0x362566(0x104)][_0x362566(0x182)])&&delete _0x26e9e8[_0x362566(0xcb)][_0x362566(0x104)];for(const _0x5915ac of _0x26e9e8[_0x362566(0xcb)][_0x362566(0x150)]||[]){_0x5915ac[_0x362566(0x106)]?.['segmentId']&&isPendingSegmentId(_0x5915ac[_0x362566(0x106)][_0x362566(0x182)])&&delete _0x5915ac[_0x362566(0x106)];_0x5915ac[_0x362566(0x177)]?.[_0x362566(0x182)]&&isPendingSegmentId(_0x5915ac[_0x362566(0x177)][_0x362566(0x182)])&&delete _0x5915ac[_0x362566(0x177)];_0x5915ac[_0x362566(0x165)]&&(_0x5915ac[_0x362566(0x165)]=_0x5915ac[_0x362566(0x165)][_0x362566(0x166)](_0x1872e0=>!_0x1872e0[_0x362566(0x182)]||!isPendingSegmentId(_0x1872e0[_0x362566(0x182)])));if(_0x5915ac['steps'])for(const _0xc5d083 of Object[_0x362566(0x13c)](_0x5915ac[_0x362566(0xd8)])){const _0x54642f=_0x5915ac[_0x362566(0xd8)][_0xc5d083];_0x54642f[_0x362566(0x118)]===_0x362566(0x175)&&_0x54642f[_0x362566(0x13d)]&&isPendingActivationId(_0x54642f['journeyActivationStepId'])&&(_0x54642f[_0x362566(0x13d)]='');if(_0x54642f['type']===_0x362566(0xb4)&&_0x54642f['branches'])for(const _0x47e4b2 of _0x54642f[_0x362566(0xe4)]){_0x47e4b2[_0x362566(0x182)]&&isPendingSegmentId(_0x47e4b2[_0x362566(0x182)])&&(_0x47e4b2[_0x362566(0x182)]='');}_0x54642f[_0x362566(0x118)]===_0x362566(0x132)&&stripWaitStepPendingIds(_0x54642f);}}}function resolvePendingIdsInRequest(_0x1321dc,_0x4519dd,_0x2a533a,_0x5f517d,_0x15791c,_0x1abe9b){const _0x5ee4cd=a114_0x52cd1c,_0x2167b9=(_0x3929f3,_0x234f20)=>{const _0x5c478c=a114_0x3d4f;if(!isPendingSegmentId(_0x3929f3))return _0x3929f3;const _0x59e0d8=extractPendingSegmentName(_0x3929f3),_0x370536=_0x5f517d[_0x5c478c(0x138)](_0x59e0d8);return!_0x370536&&_0x1abe9b[_0x5c478c(0xe3)]?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x59e0d8+_0x5c478c(0x15e)+_0x234f20),_0x370536;};if(_0x1321dc[_0x5ee4cd(0xcb)]['goal']?.['segmentId']&&isPendingSegmentId(_0x1321dc[_0x5ee4cd(0xcb)][_0x5ee4cd(0x104)][_0x5ee4cd(0x182)])){const _0x4ba5a5=_0x2167b9(_0x1321dc[_0x5ee4cd(0xcb)]['goal'][_0x5ee4cd(0x182)],_0x5ee4cd(0xc8));_0x4ba5a5&&(_0x1321dc[_0x5ee4cd(0xcb)][_0x5ee4cd(0x104)][_0x5ee4cd(0x182)]=_0x4ba5a5);}for(const _0x5acf80 of _0x1321dc['attributes'][_0x5ee4cd(0x150)]||[]){const _0x1f1439=_0x2a533a[_0x5ee4cd(0x138)](_0x5acf80[_0x5ee4cd(0x174)]['toLowerCase']());_0x1f1439&&(_0x5acf80['id']=_0x1f1439);if(_0x5acf80[_0x5ee4cd(0x106)]?.[_0x5ee4cd(0x182)]&&isPendingSegmentId(_0x5acf80['entryCriteria'][_0x5ee4cd(0x182)])){const _0x46ff80=_0x2167b9(_0x5acf80[_0x5ee4cd(0x106)][_0x5ee4cd(0x182)],_0x5ee4cd(0xb5)+_0x5acf80[_0x5ee4cd(0x174)]+'\x27\x20entry\x20criteria');_0x46ff80&&(_0x5acf80[_0x5ee4cd(0x106)][_0x5ee4cd(0x182)]=_0x46ff80);}if(_0x5acf80[_0x5ee4cd(0x165)])for(const _0xe2230d of _0x5acf80[_0x5ee4cd(0x165)]){if(_0xe2230d[_0x5ee4cd(0x182)]&&isPendingSegmentId(_0xe2230d[_0x5ee4cd(0x182)])){const _0x46e0f6=_0x2167b9(_0xe2230d['segmentId'],_0x5ee4cd(0xb5)+_0x5acf80[_0x5ee4cd(0x174)]+_0x5ee4cd(0xf9));_0x46e0f6&&(_0xe2230d[_0x5ee4cd(0x182)]=_0x46e0f6);}}if(_0x5acf80[_0x5ee4cd(0x177)]?.[_0x5ee4cd(0x182)]&&isPendingSegmentId(_0x5acf80['milestone']['segmentId'])){const _0x50aaa7=_0x2167b9(_0x5acf80[_0x5ee4cd(0x177)]['segmentId'],'stage\x20\x27'+_0x5acf80[_0x5ee4cd(0x174)]+_0x5ee4cd(0x17f));_0x50aaa7&&(_0x5acf80['milestone'][_0x5ee4cd(0x182)]=_0x50aaa7);}if(_0x5acf80[_0x5ee4cd(0xd8)]){const _0x2c0bc3=_0x102a1d=>_0x4519dd['attributes']['journeyStages']?.['find'](_0x4f34a5=>_0x4f34a5[_0x5ee4cd(0x174)][_0x5ee4cd(0x185)]()===_0x5acf80[_0x5ee4cd(0x174)][_0x5ee4cd(0x185)]())?.[_0x5ee4cd(0xd8)]?.[_0x102a1d];for(const _0x145d13 of Object[_0x5ee4cd(0x13c)](_0x5acf80['steps'])){const _0x3b906f=_0x5acf80[_0x5ee4cd(0xd8)][_0x145d13],_0x4380e9=_0x2c0bc3(_0x145d13);if(_0x3b906f[_0x5ee4cd(0x118)]===_0x5ee4cd(0x175)&&_0x3b906f[_0x5ee4cd(0x13d)]&&(isPendingActivationId(_0x3b906f[_0x5ee4cd(0x13d)])||_0x3b906f[_0x5ee4cd(0x13d)]==='')){if(_0x4380e9?.[_0x5ee4cd(0x13d)]&&isPendingActivationId(_0x4380e9['journeyActivationStepId'])){const _0x114616=extractPendingActivationName(_0x4380e9[_0x5ee4cd(0x13d)]),_0x4fc752=_0x15791c[_0x5ee4cd(0x138)](_0x114616);_0x4fc752&&(_0x3b906f[_0x5ee4cd(0x13d)]=_0x4fc752);}}if(_0x3b906f[_0x5ee4cd(0x118)]===_0x5ee4cd(0xb4)&&_0x3b906f[_0x5ee4cd(0xe4)]&&_0x4380e9?.[_0x5ee4cd(0xe4)])for(let _0x2ff0fa=0x0;_0x2ff0fa<_0x3b906f[_0x5ee4cd(0xe4)]['length'];_0x2ff0fa++){const _0xf50da=_0x3b906f['branches'][_0x2ff0fa],_0x1c47d2=_0x4380e9[_0x5ee4cd(0xe4)][_0x2ff0fa];if(_0x1c47d2?.['segmentId']&&isPendingSegmentId(_0x1c47d2[_0x5ee4cd(0x182)])){const _0x3ac88a=_0x2167b9(_0x1c47d2[_0x5ee4cd(0x182)],'stage\x20\x27'+_0x5acf80[_0x5ee4cd(0x174)]+_0x5ee4cd(0x14c)+(_0xf50da[_0x5ee4cd(0x174)]||_0x2ff0fa)+'\x27');_0x3ac88a&&(_0xf50da[_0x5ee4cd(0x182)]=_0x3ac88a);}}_0x3b906f[_0x5ee4cd(0x118)]==='WaitStep'&&_0x4380e9?.[_0x5ee4cd(0x118)]===_0x5ee4cd(0x132)&&resolveWaitStepPendingIds(_0x3b906f,_0x4380e9,_0x2167b9,_0x5acf80[_0x5ee4cd(0x174)]);}}}}
@@ -1 +1 @@
1
- (function(_0x5eec75,_0x5526df){const _0x2ef798=a115_0x5961,_0x1efc85=_0x5eec75();while(!![]){try{const _0x59162d=-parseInt(_0x2ef798(0x153))/0x1+-parseInt(_0x2ef798(0x148))/0x2+parseInt(_0x2ef798(0x14b))/0x3+parseInt(_0x2ef798(0x14e))/0x4*(-parseInt(_0x2ef798(0x14d))/0x5)+parseInt(_0x2ef798(0x145))/0x6*(-parseInt(_0x2ef798(0x144))/0x7)+-parseInt(_0x2ef798(0x14f))/0x8+-parseInt(_0x2ef798(0x14a))/0x9*(-parseInt(_0x2ef798(0x149))/0xa);if(_0x59162d===_0x5526df)break;else _0x1efc85['push'](_0x1efc85['shift']());}catch(_0x4eb9d4){_0x1efc85['push'](_0x1efc85['shift']());}}}(a115_0x2656,0x4da76));function a115_0x2656(){const _0x1fc48c=['501734jQolge','21889zwVVhS','894PHTceY','set','get','129598hHFkBp','610MnBLYX','155151OvHaMw','1606200eMNZlj','has','20dHprXV','40408JggiDi','1568360XvzVBA','add','parentFolderId','name'];a115_0x2656=function(){return _0x1fc48c;};return a115_0x2656();}function a115_0x5961(_0x44355e,_0x182504){_0x44355e=_0x44355e-0x144;const _0x265682=a115_0x2656();let _0x5961ae=_0x265682[_0x44355e];return _0x5961ae;}export function buildFolderIdToPathMap(_0x34d209){const _0x131038=a115_0x5961,_0x507a81=new Map(),_0x25379c=new Map();for(const _0x4c8597 of _0x34d209){_0x25379c[_0x131038(0x146)](_0x4c8597['id'],_0x4c8597);}const _0x23b5ee=new Set();for(const _0x530545 of _0x34d209){!_0x530545[_0x131038(0x151)]&&_0x23b5ee['add'](_0x530545['id']);}function _0x2bece4(_0x1a03f5){const _0x250d84=_0x131038;if(_0x507a81[_0x250d84(0x14c)](_0x1a03f5['id']))return _0x507a81['get'](_0x1a03f5['id']);if(_0x23b5ee['has'](_0x1a03f5['id']))return _0x507a81[_0x250d84(0x146)](_0x1a03f5['id'],''),'';if(_0x1a03f5[_0x250d84(0x151)]){const _0x1838f6=_0x25379c[_0x250d84(0x147)](_0x1a03f5[_0x250d84(0x151)]);if(_0x1838f6){const _0x36b3a9=_0x2bece4(_0x1838f6),_0x59d1e8=_0x36b3a9?_0x36b3a9+'/'+_0x1a03f5[_0x250d84(0x152)]:_0x1a03f5['name'];return _0x507a81[_0x250d84(0x146)](_0x1a03f5['id'],_0x59d1e8),_0x59d1e8;}}const _0x27d516=_0x1a03f5['name'];return _0x507a81['set'](_0x1a03f5['id'],_0x27d516),_0x27d516;}for(const _0x16419d of _0x34d209){_0x2bece4(_0x16419d);}return _0x507a81;}export function buildFolderPathToIdMap(_0x2c1bfb){const _0x44cc09=a115_0x5961,_0x4fb967=new Map(),_0x3dc87e=new Map();for(const _0x1bed9a of _0x2c1bfb){_0x3dc87e[_0x44cc09(0x146)](_0x1bed9a['id'],_0x1bed9a);}const _0x514c30=new Set();for(const _0x5edaa7 of _0x2c1bfb){!_0x5edaa7[_0x44cc09(0x151)]&&_0x514c30[_0x44cc09(0x150)](_0x5edaa7['id']);}function _0xc28212(_0x264492){const _0x18eee2=_0x44cc09;if(_0x514c30['has'](_0x264492['id']))return'';if(_0x264492[_0x18eee2(0x151)]){const _0x10c5cb=_0x3dc87e[_0x18eee2(0x147)](_0x264492[_0x18eee2(0x151)]);if(_0x10c5cb){const _0x35a690=_0xc28212(_0x10c5cb);return _0x35a690?_0x35a690+'/'+_0x264492[_0x18eee2(0x152)]:_0x264492[_0x18eee2(0x152)];}}return _0x264492[_0x18eee2(0x152)];}for(const _0x26a4ce of _0x2c1bfb){const _0x8288ed=_0xc28212(_0x26a4ce);_0x4fb967[_0x44cc09(0x146)](_0x8288ed,_0x26a4ce['id']);}return _0x4fb967;}export function buildFolderMaps(_0x321895){const _0xd52aa3=buildFolderIdToPathMap(_0x321895),_0x197c56=new Map();for(const [_0x214c67,_0x505b50]of _0xd52aa3){_0x197c56['set'](_0x505b50,_0x214c67);}return{'idToPath':_0xd52aa3,'pathToId':_0x197c56};}export function getFolderPath(_0x5a38cd,_0x424cce){if(!_0x5a38cd)return'';return _0x424cce['get'](_0x5a38cd)??'';}
1
+ (function(_0x2689d1,_0x301823){const _0x24dd24=a115_0xeeee,_0x88c624=_0x2689d1();while(!![]){try{const _0x23930d=-parseInt(_0x24dd24(0x1d7))/0x1*(-parseInt(_0x24dd24(0x1da))/0x2)+-parseInt(_0x24dd24(0x1ce))/0x3+parseInt(_0x24dd24(0x1dc))/0x4*(parseInt(_0x24dd24(0x1d6))/0x5)+-parseInt(_0x24dd24(0x1d4))/0x6*(parseInt(_0x24dd24(0x1d8))/0x7)+-parseInt(_0x24dd24(0x1cd))/0x8+-parseInt(_0x24dd24(0x1d0))/0x9+parseInt(_0x24dd24(0x1cf))/0xa;if(_0x23930d===_0x301823)break;else _0x88c624['push'](_0x88c624['shift']());}catch(_0x54b171){_0x88c624['push'](_0x88c624['shift']());}}}(a115_0xfbc5,0xb3fed));function a115_0xeeee(_0x2d310b,_0x460410){_0x2d310b=_0x2d310b-0x1cd;const _0xfbc53a=a115_0xfbc5();let _0xeeee=_0xfbc53a[_0x2d310b];return _0xeeee;}function a115_0xfbc5(){const _0x4dd46e=['add','90dquhpx','has','27665bZwWeK','2nfrJiG','106351yxPNJs','set','923266QyRfzS','name','760HQTUOJ','6885152cNkonm','501945XAZLgF','9423280HYOnBX','8313741Gdqiot','parentFolderId','get'];a115_0xfbc5=function(){return _0x4dd46e;};return a115_0xfbc5();}export function buildFolderIdToPathMap(_0x474c55){const _0x2e90bb=a115_0xeeee,_0x4a911e=new Map(),_0xaacc1a=new Map();for(const _0x42b6ad of _0x474c55){_0xaacc1a[_0x2e90bb(0x1d9)](_0x42b6ad['id'],_0x42b6ad);}const _0x398688=new Set();for(const _0x5a6dd5 of _0x474c55){!_0x5a6dd5[_0x2e90bb(0x1d1)]&&_0x398688[_0x2e90bb(0x1d3)](_0x5a6dd5['id']);}function _0x10efb5(_0x3bb227){const _0x23bea2=_0x2e90bb;if(_0x4a911e[_0x23bea2(0x1d5)](_0x3bb227['id']))return _0x4a911e[_0x23bea2(0x1d2)](_0x3bb227['id']);if(_0x398688[_0x23bea2(0x1d5)](_0x3bb227['id']))return _0x4a911e['set'](_0x3bb227['id'],''),'';if(_0x3bb227[_0x23bea2(0x1d1)]){const _0x3cf923=_0xaacc1a[_0x23bea2(0x1d2)](_0x3bb227[_0x23bea2(0x1d1)]);if(_0x3cf923){const _0x5dfd18=_0x10efb5(_0x3cf923),_0x2266df=_0x5dfd18?_0x5dfd18+'/'+_0x3bb227[_0x23bea2(0x1db)]:_0x3bb227[_0x23bea2(0x1db)];return _0x4a911e[_0x23bea2(0x1d9)](_0x3bb227['id'],_0x2266df),_0x2266df;}}const _0x31f767=_0x3bb227[_0x23bea2(0x1db)];return _0x4a911e['set'](_0x3bb227['id'],_0x31f767),_0x31f767;}for(const _0x1b1008 of _0x474c55){_0x10efb5(_0x1b1008);}return _0x4a911e;}export function buildFolderPathToIdMap(_0x4fd000){const _0x301d30=a115_0xeeee,_0x4fc79b=new Map(),_0x7329f5=new Map();for(const _0x1fdc7a of _0x4fd000){_0x7329f5['set'](_0x1fdc7a['id'],_0x1fdc7a);}const _0xe28ae8=new Set();for(const _0x394da8 of _0x4fd000){!_0x394da8[_0x301d30(0x1d1)]&&_0xe28ae8[_0x301d30(0x1d3)](_0x394da8['id']);}function _0x7b99cc(_0x5cbb37){const _0x5d82a0=_0x301d30;if(_0xe28ae8[_0x5d82a0(0x1d5)](_0x5cbb37['id']))return'';if(_0x5cbb37['parentFolderId']){const _0x52bc55=_0x7329f5[_0x5d82a0(0x1d2)](_0x5cbb37[_0x5d82a0(0x1d1)]);if(_0x52bc55){const _0xc4e8b3=_0x7b99cc(_0x52bc55);return _0xc4e8b3?_0xc4e8b3+'/'+_0x5cbb37['name']:_0x5cbb37[_0x5d82a0(0x1db)];}}return _0x5cbb37[_0x5d82a0(0x1db)];}for(const _0x37ed4f of _0x4fd000){const _0x353529=_0x7b99cc(_0x37ed4f);_0x4fc79b[_0x301d30(0x1d9)](_0x353529,_0x37ed4f['id']);}return _0x4fc79b;}export function buildFolderMaps(_0x41101d){const _0x514b39=a115_0xeeee,_0x313983=buildFolderIdToPathMap(_0x41101d),_0xffdf18=new Map();for(const [_0x443be2,_0x23c6ac]of _0x313983){_0xffdf18[_0x514b39(0x1d9)](_0x23c6ac,_0x443be2);}return{'idToPath':_0x313983,'pathToId':_0xffdf18};}export function getFolderPath(_0x3287f6,_0xb00b64){const _0x21ceb6=a115_0xeeee;if(!_0x3287f6)return'';return _0xb00b64[_0x21ceb6(0x1d2)](_0x3287f6)??'';}
@@ -1 +1 @@
1
- (function(_0x4c2c5f,_0x2c6031){const _0x1f2690=a116_0x26c3,_0x493e51=_0x4c2c5f();while(!![]){try{const _0x57b6e5=-parseInt(_0x1f2690(0x204))/0x1*(parseInt(_0x1f2690(0x20b))/0x2)+parseInt(_0x1f2690(0x205))/0x3+parseInt(_0x1f2690(0x1f4))/0x4*(-parseInt(_0x1f2690(0x1f1))/0x5)+parseInt(_0x1f2690(0x21a))/0x6*(parseInt(_0x1f2690(0x20c))/0x7)+parseInt(_0x1f2690(0x219))/0x8*(parseInt(_0x1f2690(0x201))/0x9)+parseInt(_0x1f2690(0x1ef))/0xa*(-parseInt(_0x1f2690(0x200))/0xb)+-parseInt(_0x1f2690(0x20d))/0xc*(parseInt(_0x1f2690(0x207))/0xd);if(_0x57b6e5===_0x2c6031)break;else _0x493e51['push'](_0x493e51['shift']());}catch(_0x49b2df){_0x493e51['push'](_0x493e51['shift']());}}}(a116_0x4b67,0x476ff));import a116_0x3d9df0 from'path';import{parse as a116_0x492313}from'yaml';function a116_0x4b67(){const _0x34e071=['length','143YUaoRo','startsWith','push','Cannot\x20split\x20empty\x20path','358IIMeFF','988309HMneKm','388908NDdKfH','trim','dirname','test','filter','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','File\x20not\x20found:\x20','join','type','.yaml','journey','Cannot\x20navigate\x20above\x20root','1856056dYYWhb','18MbPTrQ','pop','raw','name','isAbsolute','resolve','split','root','tdx.json','10PLoFgM','readFile','408030Yelnij','parse','No\x20tdx.json\x20found\x20for\x20file:\x20','4RNOjUY','parent_segment','segment','exists','segments','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','endsWith','relative','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','slice','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','Path\x20attempts\x20to\x20navigate\x20above\x20root','482383mWcJwB','9bcwkyP','.yml','replace','2317xFUumr','1601220SaXVRc'];a116_0x4b67=function(){return _0x34e071;};return a116_0x4b67();}import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x539c40){const _0x53bb61=a116_0x26c3;if(!_0x539c40||_0x539c40['trim']()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0x240f80=_0x539c40['trim']();if(_0x240f80==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x539c40};const _0x396565=_0x240f80[_0x53bb61(0x208)]('/')?_0x240f80['substring'](0x1):_0x240f80,_0x1d1c64=_0x396565[_0x53bb61(0x1ec)]('/')[_0x53bb61(0x211)](_0x153782=>_0x153782!=='');if(_0x1d1c64['length']===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x5886f6=_0x240f80[_0x53bb61(0x208)]('/')||!isRelativePathSegment(_0x1d1c64[0x0]);for(const _0x2d9bb6 of _0x1d1c64){validatePathSegment(_0x2d9bb6);}return{'segments':_0x1d1c64,'isAbsolute':_0x5886f6,'raw':_0x539c40};}function a116_0x26c3(_0x46bd4d,_0x111e22){_0x46bd4d=_0x46bd4d-0x1ec;const _0x4b6784=a116_0x4b67();let _0x26c30e=_0x4b6784[_0x46bd4d];return _0x26c30e;}function isRelativePathSegment(_0x5c58de){return _0x5c58de==='.'||_0x5c58de==='..';}function validatePathSegment(_0x15dd0f){const _0x202ea5=a116_0x26c3;if(_0x15dd0f==='')throw new Error('Path\x20segment\x20cannot\x20be\x20empty');if(_0x15dd0f==='.'||_0x15dd0f==='..')return;if(/[\x00-\x1F\x7F]/[_0x202ea5(0x210)](_0x15dd0f))throw new Error(_0x202ea5(0x212)+_0x15dd0f);if(_0x15dd0f!==_0x15dd0f[_0x202ea5(0x20e)]()){}}export function validatePath(_0xe5d6d7){const _0x40c92b=a116_0x26c3;if(_0xe5d6d7[_0x40c92b(0x1f8)][_0x40c92b(0x206)]===0x0&&!_0xe5d6d7[_0x40c92b(0x21e)])throw new Error('Relative\x20path\x20cannot\x20be\x20empty');if(_0xe5d6d7['isAbsolute']){if(_0xe5d6d7[_0x40c92b(0x1f8)][0x0]==='..')throw new Error(_0x40c92b(0x1fc));let _0x3b6a7b=0x0;for(const _0x33e5de of _0xe5d6d7[_0x40c92b(0x1f8)]){if(_0x33e5de==='..'){if(_0x3b6a7b===0x0)throw new Error(_0x40c92b(0x1ff));_0x3b6a7b--;}else _0x33e5de!=='.'&&_0x3b6a7b++;}}}export function joinPaths(_0x11a9cf,_0xc2354d){const _0x67c02e=a116_0x26c3;if(!_0x11a9cf||_0x11a9cf==='/')return _0xc2354d;if(!_0xc2354d||_0xc2354d==='.')return _0x11a9cf;if(_0xc2354d[_0x67c02e(0x208)]('/'))return _0xc2354d;const _0x532296=parsePath(_0x11a9cf),_0x58fcb0=parsePath(_0xc2354d),_0x48b23b=[..._0x532296['segments']];for(const _0xb4cfa of _0x58fcb0[_0x67c02e(0x1f8)]){if(_0xb4cfa==='.')continue;else{if(_0xb4cfa==='..'){if(_0x48b23b[_0x67c02e(0x206)]===0x0)throw new Error(_0x67c02e(0x218));_0x48b23b[_0x67c02e(0x21b)]();}else _0x48b23b[_0x67c02e(0x209)](_0xb4cfa);}}const _0x36266d=_0x48b23b[_0x67c02e(0x214)]('/');return _0x532296[_0x67c02e(0x21c)]['startsWith']('/')?'/'+_0x36266d:_0x36266d;}export function normalizePath(_0x3de59d){const _0x32a50d=a116_0x26c3,_0x2209e1=parsePath(_0x3de59d),_0x57316a=[];for(const _0xfbad89 of _0x2209e1[_0x32a50d(0x1f8)]){if(_0xfbad89==='.')continue;else{if(_0xfbad89==='..'){if(_0x57316a[_0x32a50d(0x206)]===0x0){if(_0x2209e1[_0x32a50d(0x21e)])throw new Error(_0x32a50d(0x218));_0x57316a[_0x32a50d(0x209)]('..');}else _0x57316a[_0x57316a[_0x32a50d(0x206)]-0x1]==='..'?_0x57316a[_0x32a50d(0x209)]('..'):_0x57316a['pop']();}else _0x57316a['push'](_0xfbad89);}}if(_0x57316a[_0x32a50d(0x206)]===0x0)return _0x2209e1[_0x32a50d(0x21e)]?'/':'.';const _0x5dbab0=_0x57316a[_0x32a50d(0x214)]('/');return _0x2209e1[_0x32a50d(0x21c)]['startsWith']('/')?'/'+_0x5dbab0:_0x5dbab0;}export function getParentPath(_0x13bcf4){const _0xf64e65=a116_0x26c3,_0x53bb03=parsePath(_0x13bcf4);if(_0x53bb03[_0xf64e65(0x1f8)][_0xf64e65(0x206)]<=0x1)return'/';const _0x1d50c8=_0x53bb03['segments'][_0xf64e65(0x1fd)](0x0,-0x1)[_0xf64e65(0x214)]('/');return _0x53bb03[_0xf64e65(0x21c)][_0xf64e65(0x208)]('/')?'/'+_0x1d50c8:_0x1d50c8;}export function getBaseName(_0x4fc5d9){const _0x4e939e=a116_0x26c3,_0x36454c=parsePath(_0x4fc5d9);return _0x36454c[_0x4e939e(0x1f8)][_0x36454c['segments'][_0x4e939e(0x206)]-0x1]||'';}export function isChildPath(_0x54f13a,_0x10c002){const _0x3c8383=a116_0x26c3,_0x2d4e2d=parsePath(_0x54f13a),_0x2bdeef=parsePath(_0x10c002);if(_0x2d4e2d[_0x3c8383(0x1f8)][_0x3c8383(0x206)]<=_0x2bdeef[_0x3c8383(0x1f8)][_0x3c8383(0x206)])return![];for(let _0x173f53=0x0;_0x173f53<_0x2bdeef[_0x3c8383(0x1f8)][_0x3c8383(0x206)];_0x173f53++){if(_0x2d4e2d[_0x3c8383(0x1f8)][_0x173f53]!==_0x2bdeef['segments'][_0x173f53])return![];}return!![];}export function splitPath(_0x4677bf){const _0x2c320a=a116_0x26c3,_0x34d835=parsePath(_0x4677bf);if(_0x34d835[_0x2c320a(0x1f8)]['length']===0x0)throw new Error(_0x2c320a(0x20a));if(_0x34d835['segments']['length']===0x1)return{'parent':_0x34d835['segments'][0x0]};return{'parent':_0x34d835[_0x2c320a(0x1f8)][0x0],'child':_0x34d835['segments']['slice'](0x1)[_0x2c320a(0x214)]('/')};}export function isYamlFilePath(_0x45e07b){const _0x2f3138=a116_0x26c3;return _0x45e07b[_0x2f3138(0x1fa)](_0x2f3138(0x202))||_0x45e07b['endsWith'](_0x2f3138(0x216));}export async function resolveYamlFilePath(_0x42f99c,_0x313a38=nodeFileSystem){const _0x256307=a116_0x26c3,_0x484ca6=a116_0x3d9df0[_0x256307(0x21f)](_0x42f99c);if(!await _0x313a38[_0x256307(0x1f7)](_0x484ca6))throw new Error(_0x256307(0x213)+_0x42f99c);let _0x31d583=a116_0x3d9df0[_0x256307(0x20f)](_0x484ca6),_0x33e352=null,_0x33883c=null;const _0x83cc39=a116_0x3d9df0['parse'](_0x31d583)[_0x256307(0x1ed)];while(_0x31d583!==_0x83cc39){const _0x2a61f0=a116_0x3d9df0[_0x256307(0x214)](_0x31d583,_0x256307(0x1ee));if(await _0x313a38[_0x256307(0x1f7)](_0x2a61f0)){_0x33e352=_0x2a61f0,_0x33883c=_0x31d583;break;}_0x31d583=a116_0x3d9df0['dirname'](_0x31d583);}if(!_0x33e352||!_0x33883c)throw new Error(_0x256307(0x1f3)+_0x42f99c);const _0x1983f4=await _0x313a38[_0x256307(0x1f0)](_0x33e352),_0x731053=JSON[_0x256307(0x1f2)](_0x1983f4),_0x395537=_0x731053[_0x256307(0x1f5)];if(!_0x395537)throw new Error(_0x256307(0x1fe));const _0x84b8ba=await _0x313a38[_0x256307(0x1f0)](_0x484ca6),_0x1279ed=a116_0x492313(_0x84b8ba),_0x1f2b07=_0x1279ed[_0x256307(0x21d)];if(!_0x1f2b07)throw new Error(_0x256307(0x1f9)+_0x42f99c);const _0x1ac919=_0x1279ed[_0x256307(0x215)]===_0x256307(0x217)?'journey':_0x256307(0x1f6),_0x264e5b=a116_0x3d9df0[_0x256307(0x1fb)](_0x33883c,_0x484ca6),_0x119800=a116_0x3d9df0[_0x256307(0x20f)](_0x264e5b),_0x12c55e=_0x119800==='.'?'':_0x119800[_0x256307(0x203)](/\\/g,'/'),_0x25b030=_0x12c55e?_0x395537+'/'+_0x12c55e+'/'+_0x1f2b07:_0x395537+'/'+_0x1f2b07;return{'parentSegment':_0x395537,'segmentName':_0x1f2b07,'folderPath':_0x12c55e,'fullPath':_0x25b030,'resourceType':_0x1ac919};}
1
+ (function(_0x4d2390,_0x142166){const _0x31687b=a116_0x341e,_0x17ddb9=_0x4d2390();while(!![]){try{const _0x2da679=parseInt(_0x31687b(0x19b))/0x1*(-parseInt(_0x31687b(0x1c3))/0x2)+-parseInt(_0x31687b(0x1ad))/0x3+parseInt(_0x31687b(0x1bf))/0x4*(-parseInt(_0x31687b(0x1a0))/0x5)+parseInt(_0x31687b(0x199))/0x6*(-parseInt(_0x31687b(0x1a3))/0x7)+-parseInt(_0x31687b(0x1c5))/0x8+-parseInt(_0x31687b(0x1b1))/0x9*(parseInt(_0x31687b(0x1be))/0xa)+-parseInt(_0x31687b(0x1bb))/0xb*(-parseInt(_0x31687b(0x19a))/0xc);if(_0x2da679===_0x142166)break;else _0x17ddb9['push'](_0x17ddb9['shift']());}catch(_0x1fbca0){_0x17ddb9['push'](_0x17ddb9['shift']());}}}(a116_0x37a9,0x669af));import a116_0x211265 from'path';import{parse as a116_0x1a1839}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';function a116_0x37a9(){const _0x5a85db=['18NRCtjB','2196LkDbRB','48QqHTGl','Cannot\x20navigate\x20above\x20root','raw','dirname','Path\x20attempts\x20to\x20navigate\x20above\x20root','31070FxsENT','join','segments','1238531RSFPeO','Path\x20cannot\x20be\x20empty','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','endsWith','isAbsolute','trim','relative','filter','Cannot\x20split\x20empty\x20path','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','2339109TZPEvF','name','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','readFile','2579760juJZAY','parent_segment','root','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','push','substring','segment','.yaml','Path\x20segment\x20cannot\x20be\x20empty','No\x20tdx.json\x20found\x20for\x20file:\x20','187462rcXlcP','parse','File\x20not\x20found:\x20','10XehGdd','116hQAHGt','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','startsWith','slice','8530MiIdkI','resolve','5730776DyIPhL','pop','Relative\x20path\x20cannot\x20be\x20empty','split','length'];a116_0x37a9=function(){return _0x5a85db;};return a116_0x37a9();}export function parsePath(_0x514167){const _0x209b48=a116_0x341e;if(!_0x514167||_0x514167[_0x209b48(0x1a8)]()==='')throw new Error(_0x209b48(0x1a4));const _0x5f0b37=_0x514167['trim']();if(_0x5f0b37==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x514167};const _0x49ea75=_0x5f0b37[_0x209b48(0x1c1)]('/')?_0x5f0b37[_0x209b48(0x1b6)](0x1):_0x5f0b37,_0x54dcfb=_0x49ea75[_0x209b48(0x1c8)]('/')[_0x209b48(0x1aa)](_0x32f8d1=>_0x32f8d1!=='');if(_0x54dcfb[_0x209b48(0x198)]===0x0)throw new Error(_0x209b48(0x1c0));const _0x11de46=_0x5f0b37[_0x209b48(0x1c1)]('/')||!isRelativePathSegment(_0x54dcfb[0x0]);for(const _0x51e900 of _0x54dcfb){validatePathSegment(_0x51e900);}return{'segments':_0x54dcfb,'isAbsolute':_0x11de46,'raw':_0x514167};}function isRelativePathSegment(_0x48a459){return _0x48a459==='.'||_0x48a459==='..';}function validatePathSegment(_0x44f873){const _0x571fea=a116_0x341e;if(_0x44f873==='')throw new Error(_0x571fea(0x1b9));if(_0x44f873==='.'||_0x44f873==='..')return;if(/[\x00-\x1F\x7F]/['test'](_0x44f873))throw new Error(_0x571fea(0x1a5)+_0x44f873);if(_0x44f873!==_0x44f873[_0x571fea(0x1a8)]()){}}export function validatePath(_0x172fdc){const _0x5493ef=a116_0x341e;if(_0x172fdc[_0x5493ef(0x1a2)][_0x5493ef(0x198)]===0x0&&!_0x172fdc[_0x5493ef(0x1a7)])throw new Error(_0x5493ef(0x1c7));if(_0x172fdc['isAbsolute']){if(_0x172fdc['segments'][0x0]==='..')throw new Error(_0x5493ef(0x1ac));let _0x1c4bbd=0x0;for(const _0x1e1a9 of _0x172fdc[_0x5493ef(0x1a2)]){if(_0x1e1a9==='..'){if(_0x1c4bbd===0x0)throw new Error(_0x5493ef(0x19f));_0x1c4bbd--;}else _0x1e1a9!=='.'&&_0x1c4bbd++;}}}export function joinPaths(_0x32a967,_0x5f2f33){const _0xfa6800=a116_0x341e;if(!_0x32a967||_0x32a967==='/')return _0x5f2f33;if(!_0x5f2f33||_0x5f2f33==='.')return _0x32a967;if(_0x5f2f33[_0xfa6800(0x1c1)]('/'))return _0x5f2f33;const _0xa34e58=parsePath(_0x32a967),_0x14d405=parsePath(_0x5f2f33),_0x376d05=[..._0xa34e58[_0xfa6800(0x1a2)]];for(const _0xc8b403 of _0x14d405['segments']){if(_0xc8b403==='.')continue;else{if(_0xc8b403==='..'){if(_0x376d05['length']===0x0)throw new Error(_0xfa6800(0x19c));_0x376d05[_0xfa6800(0x1c6)]();}else _0x376d05[_0xfa6800(0x1b5)](_0xc8b403);}}const _0x8bf98e=_0x376d05[_0xfa6800(0x1a1)]('/');return _0xa34e58[_0xfa6800(0x19d)]['startsWith']('/')?'/'+_0x8bf98e:_0x8bf98e;}export function normalizePath(_0x16c4ec){const _0x26d0c6=a116_0x341e,_0x399604=parsePath(_0x16c4ec),_0x3065ce=[];for(const _0x113b18 of _0x399604['segments']){if(_0x113b18==='.')continue;else{if(_0x113b18==='..'){if(_0x3065ce[_0x26d0c6(0x198)]===0x0){if(_0x399604[_0x26d0c6(0x1a7)])throw new Error('Cannot\x20navigate\x20above\x20root');_0x3065ce[_0x26d0c6(0x1b5)]('..');}else _0x3065ce[_0x3065ce[_0x26d0c6(0x198)]-0x1]==='..'?_0x3065ce[_0x26d0c6(0x1b5)]('..'):_0x3065ce['pop']();}else _0x3065ce[_0x26d0c6(0x1b5)](_0x113b18);}}if(_0x3065ce[_0x26d0c6(0x198)]===0x0)return _0x399604[_0x26d0c6(0x1a7)]?'/':'.';const _0x384de0=_0x3065ce[_0x26d0c6(0x1a1)]('/');return _0x399604[_0x26d0c6(0x19d)][_0x26d0c6(0x1c1)]('/')?'/'+_0x384de0:_0x384de0;}export function getParentPath(_0x2cedc1){const _0xe12802=a116_0x341e,_0x385b9b=parsePath(_0x2cedc1);if(_0x385b9b[_0xe12802(0x1a2)][_0xe12802(0x198)]<=0x1)return'/';const _0x280d4b=_0x385b9b[_0xe12802(0x1a2)][_0xe12802(0x1c2)](0x0,-0x1)['join']('/');return _0x385b9b[_0xe12802(0x19d)][_0xe12802(0x1c1)]('/')?'/'+_0x280d4b:_0x280d4b;}export function getBaseName(_0x2db544){const _0x7648b3=a116_0x341e,_0x516a94=parsePath(_0x2db544);return _0x516a94[_0x7648b3(0x1a2)][_0x516a94[_0x7648b3(0x1a2)]['length']-0x1]||'';}export function isChildPath(_0x3871ee,_0x5b09ea){const _0x4b2e7c=a116_0x341e,_0x1f391e=parsePath(_0x3871ee),_0x217f77=parsePath(_0x5b09ea);if(_0x1f391e[_0x4b2e7c(0x1a2)][_0x4b2e7c(0x198)]<=_0x217f77[_0x4b2e7c(0x1a2)][_0x4b2e7c(0x198)])return![];for(let _0x4a1f1a=0x0;_0x4a1f1a<_0x217f77['segments']['length'];_0x4a1f1a++){if(_0x1f391e[_0x4b2e7c(0x1a2)][_0x4a1f1a]!==_0x217f77['segments'][_0x4a1f1a])return![];}return!![];}function a116_0x341e(_0x28a116,_0x65e3be){_0x28a116=_0x28a116-0x198;const _0x37a9c9=a116_0x37a9();let _0x341e4f=_0x37a9c9[_0x28a116];return _0x341e4f;}export function splitPath(_0x482219){const _0x15d4a3=a116_0x341e,_0x4bef4e=parsePath(_0x482219);if(_0x4bef4e['segments'][_0x15d4a3(0x198)]===0x0)throw new Error(_0x15d4a3(0x1ab));if(_0x4bef4e['segments'][_0x15d4a3(0x198)]===0x1)return{'parent':_0x4bef4e['segments'][0x0]};return{'parent':_0x4bef4e['segments'][0x0],'child':_0x4bef4e['segments'][_0x15d4a3(0x1c2)](0x1)[_0x15d4a3(0x1a1)]('/')};}export function isYamlFilePath(_0x34b4fc){const _0x276a63=a116_0x341e;return _0x34b4fc[_0x276a63(0x1a6)]('.yml')||_0x34b4fc[_0x276a63(0x1a6)](_0x276a63(0x1b8));}export async function resolveYamlFilePath(_0x561cb0,_0x5910ec=nodeFileSystem){const _0x4d9980=a116_0x341e,_0x13836c=a116_0x211265[_0x4d9980(0x1c4)](_0x561cb0);if(!await _0x5910ec['exists'](_0x13836c))throw new Error(_0x4d9980(0x1bd)+_0x561cb0);let _0x54d9b6=a116_0x211265[_0x4d9980(0x19e)](_0x13836c),_0x3a883b=null,_0xb5c3c3=null;const _0x451292=a116_0x211265[_0x4d9980(0x1bc)](_0x54d9b6)[_0x4d9980(0x1b3)];while(_0x54d9b6!==_0x451292){const _0x483790=a116_0x211265[_0x4d9980(0x1a1)](_0x54d9b6,'tdx.json');if(await _0x5910ec['exists'](_0x483790)){_0x3a883b=_0x483790,_0xb5c3c3=_0x54d9b6;break;}_0x54d9b6=a116_0x211265[_0x4d9980(0x19e)](_0x54d9b6);}if(!_0x3a883b||!_0xb5c3c3)throw new Error(_0x4d9980(0x1ba)+_0x561cb0);const _0x4bef85=await _0x5910ec[_0x4d9980(0x1b0)](_0x3a883b),_0x4dc335=JSON[_0x4d9980(0x1bc)](_0x4bef85),_0x2e2a01=_0x4dc335[_0x4d9980(0x1b2)];if(!_0x2e2a01)throw new Error(_0x4d9980(0x1b4));const _0x3ce79f=await _0x5910ec[_0x4d9980(0x1b0)](_0x13836c),_0x273d45=a116_0x1a1839(_0x3ce79f),_0x351b2b=_0x273d45[_0x4d9980(0x1ae)];if(!_0x351b2b)throw new Error(_0x4d9980(0x1af)+_0x561cb0);const _0x57509e=_0x273d45['type']==='journey'?'journey':_0x4d9980(0x1b7),_0xcda234=a116_0x211265[_0x4d9980(0x1a9)](_0xb5c3c3,_0x13836c),_0x418a4d=a116_0x211265['dirname'](_0xcda234),_0x27e0fc=_0x418a4d==='.'?'':_0x418a4d['replace'](/\\/g,'/'),_0x84afcd=_0x27e0fc?_0x2e2a01+'/'+_0x27e0fc+'/'+_0x351b2b:_0x2e2a01+'/'+_0x351b2b;return{'parentSegment':_0x2e2a01,'segmentName':_0x351b2b,'folderPath':_0x27e0fc,'fullPath':_0x84afcd,'resourceType':_0x57509e};}
@@ -1 +1 @@
1
- function a117_0x50ce(){const _0x37c8c6=['3782768TMQnsM','10LCJnjx','.\x20Parent\x20name\x20cannot\x20be\x20empty','substring','64490UYGWYx','985769ZWJUUV','Invalid\x20segment\x20reference\x20format:\x20','1413cADiSW','245212yHpEjF','.\x20Child\x20name\x20cannot\x20be\x20empty','9493187MUgeaH','7qowUgp','1678860ArconQ','268594ovAYpl','6mLyewy','indexOf'];a117_0x50ce=function(){return _0x37c8c6;};return a117_0x50ce();}(function(_0x132999,_0x4d9ec3){const _0x179c2f=a117_0x4720,_0x51bbc1=_0x132999();while(!![]){try{const _0x9dd03c=-parseInt(_0x179c2f(0x83))/0x1+parseInt(_0x179c2f(0x8b))/0x2*(-parseInt(_0x179c2f(0x8c))/0x3)+parseInt(_0x179c2f(0x86))/0x4+-parseInt(_0x179c2f(0x8f))/0x5*(parseInt(_0x179c2f(0x8a))/0x6)+-parseInt(_0x179c2f(0x89))/0x7*(-parseInt(_0x179c2f(0x8e))/0x8)+-parseInt(_0x179c2f(0x85))/0x9*(-parseInt(_0x179c2f(0x82))/0xa)+parseInt(_0x179c2f(0x88))/0xb;if(_0x9dd03c===_0x4d9ec3)break;else _0x51bbc1['push'](_0x51bbc1['shift']());}catch(_0x57f1bd){_0x51bbc1['push'](_0x51bbc1['shift']());}}}(a117_0x50ce,0x916dc));function a117_0x4720(_0x438a58,_0x3744d0){_0x438a58=_0x438a58-0x80;const _0x50ce26=a117_0x50ce();let _0x47208e=_0x50ce26[_0x438a58];return _0x47208e;}export function parseSegmentRef(_0x58d0b6){const _0x31594e=a117_0x4720,_0x39d6dc=_0x58d0b6[_0x31594e(0x8d)]('/');if(_0x39d6dc===-0x1)return{'parentId':_0x58d0b6};if(_0x39d6dc===0x0)throw new Error(_0x31594e(0x84)+_0x58d0b6+_0x31594e(0x80));const _0x16866d=_0x58d0b6[_0x31594e(0x81)](0x0,_0x39d6dc),_0x43679d=_0x58d0b6['substring'](_0x39d6dc+0x1);if(_0x43679d==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x58d0b6+_0x31594e(0x87));return{'parentId':_0x16866d,'childId':_0x43679d};}
1
+ (function(_0x58ce00,_0x41930b){const _0x58652e=a117_0x5951,_0x2cb3bf=_0x58ce00();while(!![]){try{const _0x531128=-parseInt(_0x58652e(0x1a2))/0x1+parseInt(_0x58652e(0x1a9))/0x2*(-parseInt(_0x58652e(0x1a0))/0x3)+-parseInt(_0x58652e(0x1aa))/0x4+-parseInt(_0x58652e(0x1ac))/0x5+-parseInt(_0x58652e(0x1a4))/0x6*(parseInt(_0x58652e(0x1ab))/0x7)+-parseInt(_0x58652e(0x1a5))/0x8+parseInt(_0x58652e(0x1a8))/0x9;if(_0x531128===_0x41930b)break;else _0x2cb3bf['push'](_0x2cb3bf['shift']());}catch(_0x31afc1){_0x2cb3bf['push'](_0x2cb3bf['shift']());}}}(a117_0x12fe,0x2b386));function a117_0x12fe(){const _0x277918=['Invalid\x20segment\x20reference\x20format:\x20','122192cmYsfZ','.\x20Parent\x20name\x20cannot\x20be\x20empty','35562CnAYrS','206888TXkCkZ','indexOf','substring','10510029IcaODt','164236prLdOy','805900DpszbZ','280edXDTO','1199535uJGHpi','.\x20Child\x20name\x20cannot\x20be\x20empty','6efvRyx'];a117_0x12fe=function(){return _0x277918;};return a117_0x12fe();}function a117_0x5951(_0x3fef7a,_0x2c75eb){_0x3fef7a=_0x3fef7a-0x1a0;const _0x12fed6=a117_0x12fe();let _0x5951c1=_0x12fed6[_0x3fef7a];return _0x5951c1;}export function parseSegmentRef(_0x17b6e5){const _0x32f1bc=a117_0x5951,_0x5b6188=_0x17b6e5[_0x32f1bc(0x1a6)]('/');if(_0x5b6188===-0x1)return{'parentId':_0x17b6e5};if(_0x5b6188===0x0)throw new Error(_0x32f1bc(0x1a1)+_0x17b6e5+_0x32f1bc(0x1a3));const _0x2744d5=_0x17b6e5[_0x32f1bc(0x1a7)](0x0,_0x5b6188),_0x6f753c=_0x17b6e5[_0x32f1bc(0x1a7)](_0x5b6188+0x1);if(_0x6f753c==='')throw new Error(_0x32f1bc(0x1a1)+_0x17b6e5+_0x32f1bc(0x1ad));return{'parentId':_0x2744d5,'childId':_0x6f753c};}
@@ -1 +1 @@
1
- function a118_0x1334(_0x43264e,_0x3a9d85){_0x43264e=_0x43264e-0xe7;const _0x306c24=a118_0x306c();let _0x1334c1=_0x306c24[_0x43264e];return _0x1334c1;}(function(_0x258779,_0x122907){const _0x3ea5bf=a118_0x1334,_0x133768=_0x258779();while(!![]){try{const _0x3e5b66=-parseInt(_0x3ea5bf(0xec))/0x1*(-parseInt(_0x3ea5bf(0x100))/0x2)+-parseInt(_0x3ea5bf(0x110))/0x3+parseInt(_0x3ea5bf(0x106))/0x4*(-parseInt(_0x3ea5bf(0xf2))/0x5)+-parseInt(_0x3ea5bf(0x10e))/0x6+-parseInt(_0x3ea5bf(0xf7))/0x7+-parseInt(_0x3ea5bf(0x102))/0x8+parseInt(_0x3ea5bf(0xee))/0x9;if(_0x3e5b66===_0x122907)break;else _0x133768['push'](_0x133768['shift']());}catch(_0x53c146){_0x133768['push'](_0x133768['shift']());}}}(a118_0x306c,0x1ce7a));function a118_0x306c(){const _0xb6cb14=['type','1524425BchrQm','join','trim','context','invalid_yaml','Not\x20a\x20YAML\x20file:\x20','scopedFolderPath','basename','file','217254uuOGGc','match','193712wLXOsn','file_not_found','journey','configDir','20372XDiyJa','File\x20not\x20found','resolve','includes','isScoped','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','string','folderPath','37542DzISGP','directory','590673LHaBxG','segmentName','isFile','cwd','parentSegment','dirname','message','segment','no_config','parse','No\x20tdx.json\x20found\x20for\x20file:\x20','stat','error','parent_segment','2ZuHXgj','Segment\x20and\x20journey\x20files\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension','4858299ZfTyvc','no_parent','extname','File\x20not\x20found:\x20','190vKyqSk','No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','resourceType','readFile'];a118_0x306c=function(){return _0xb6cb14;};return a118_0x306c();}import a118_0x1effab 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(_0xd9ddd9){const _0x3bb157=a118_0x1334;return _0xd9ddd9[_0x3bb157(0xf6)]!==_0x3bb157(0xea);}export function isScopedResolution(_0x4f6668){const _0x3659d5=a118_0x1334;return _0x4f6668[_0x3659d5(0xf6)]===_0x3659d5(0x10f)||_0x4f6668[_0x3659d5(0xf6)]===_0x3659d5(0xff)||_0x4f6668[_0x3659d5(0xf6)]===_0x3659d5(0xfa);}export function getScopedDetails(_0xa3a8e6){const _0x2578c1=a118_0x1334;if(isScopedResolution(_0xa3a8e6))return{'isScoped':_0xa3a8e6[_0x2578c1(0x10a)],'scopedFolderPath':_0xa3a8e6['scopedFolderPath']};return undefined;}async function findTdxConfigAsync(_0x21ce2e,_0x291cd0){const _0x3a83e9=a118_0x1334;let _0x5e19c3=a118_0x1effab[_0x3a83e9(0x108)](_0x21ce2e);const _0x3d20c9=a118_0x1effab[_0x3a83e9(0xe7)](_0x5e19c3)['root'];while(_0x5e19c3!==_0x3d20c9){const _0x85476a=a118_0x1effab[_0x3a83e9(0xf8)](_0x5e19c3,'tdx.json');if(await _0x291cd0['exists'](_0x85476a))try{const _0x366f0f=await _0x291cd0[_0x3a83e9(0xf5)](_0x85476a),_0x4208d5=JSON['parse'](_0x366f0f);if(_0x4208d5[_0x3a83e9(0xeb)]&&typeof _0x4208d5['parent_segment']===_0x3a83e9(0x10c))return{'configPath':_0x85476a,'configDir':_0x5e19c3,'parentSegment':_0x4208d5[_0x3a83e9(0xeb)]};}catch{}_0x5e19c3=a118_0x1effab[_0x3a83e9(0x115)](_0x5e19c3);}return null;}function calculateScopedPath(_0x1d39ee,_0x1f9492){const _0x19328f=a118_0x1effab['relative'](_0x1f9492,_0x1d39ee),_0x598524=_0x19328f!==''&&_0x19328f!=='.'&&!_0x19328f['startsWith']('..');return{'isScoped':_0x598524,'scopedFolderPath':_0x598524?_0x19328f['replace'](/\\/g,'/'):''};}export async function resolveTarget(_0x41f761){const _0x272eef=a118_0x1334,{arg:_0x4645c2,contextParent:_0x4a55b2,cwd:cwd=process[_0x272eef(0x113)](),fs:fs=nodeFileSystem}=_0x41f761;if(_0x4645c2&&isYamlFilePath(_0x4645c2))try{const _0x213220=await resolveYamlFilePath(_0x4645c2,fs),_0x10e1f4=a118_0x1effab[_0x272eef(0x108)](_0x4645c2),_0x1cc487=a118_0x1effab[_0x272eef(0x115)](_0x10e1f4),_0x18963a=await findTdxConfigAsync(_0x1cc487,fs);if(!_0x18963a){if(_0x4a55b2){const _0x18a598=a118_0x1effab[_0x272eef(0x115)](_0x10e1f4);return{'type':_0x272eef(0xff),'parentName':_0x4a55b2,'targetDir':_0x18a598,'configRoot':_0x18a598,'filePath':_0x10e1f4,'resourceName':_0x213220['segmentName'],'folderPath':_0x213220[_0x272eef(0x10d)],'resourceType':_0x213220[_0x272eef(0xf4)],'isScoped':![],'scopedFolderPath':''};}return{'type':_0x272eef(0xea),'errorCode':_0x272eef(0x118),'message':_0x272eef(0xe8)+_0x4645c2,'arg':_0x4645c2,'helpText':'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'};}const _0x3b305a=calculateScopedPath(_0x1cc487,_0x18963a[_0x272eef(0x105)]);return{'type':_0x272eef(0xff),'parentName':_0x18963a[_0x272eef(0x114)],'targetDir':_0x18963a['configDir'],'configRoot':_0x18963a[_0x272eef(0x105)],'filePath':_0x10e1f4,'resourceName':_0x213220[_0x272eef(0x111)],'folderPath':_0x213220[_0x272eef(0x10d)],'resourceType':_0x213220['resourceType'],'isScoped':_0x3b305a[_0x272eef(0x10a)],'scopedFolderPath':_0x3b305a[_0x272eef(0xfd)]};}catch(_0x322ce4){const _0x12439c=_0x322ce4 instanceof Error?_0x322ce4[_0x272eef(0x116)]:String(_0x322ce4);if(_0x12439c[_0x272eef(0x109)](_0x272eef(0x107)))return{'type':_0x272eef(0xea),'errorCode':_0x272eef(0x103),'message':_0x272eef(0xf1)+_0x4645c2,'arg':_0x4645c2};if(_0x12439c[_0x272eef(0x109)]('No\x20tdx.json\x20found')){if(_0x4a55b2){const _0x5d9a23=a118_0x1effab['resolve'](_0x4645c2);if(await fs['exists'](_0x5d9a23)){const _0x29a364=a118_0x1effab[_0x272eef(0x115)](_0x5d9a23),_0x1b770b=await fs[_0x272eef(0xf5)](_0x5d9a23),_0x55b162=_0x1b770b['match'](/^name:\s*["']?([^"'\n]+)["']?/m),_0x1c5817=_0x1b770b[_0x272eef(0x101)](/^type:\s*["']?([^"'\n]+)["']?/m),_0x25a801=_0x55b162?_0x55b162[0x1][_0x272eef(0xf9)]():a118_0x1effab[_0x272eef(0xfe)](_0x4645c2,a118_0x1effab[_0x272eef(0xf0)](_0x4645c2)),_0x394534=_0x1c5817&&_0x1c5817[0x1][_0x272eef(0xf9)]()===_0x272eef(0x104)?_0x272eef(0x104):_0x272eef(0x117);return{'type':_0x272eef(0xff),'parentName':_0x4a55b2,'targetDir':_0x29a364,'configRoot':_0x29a364,'filePath':_0x5d9a23,'resourceName':_0x25a801,'folderPath':'','resourceType':_0x394534,'isScoped':![],'scopedFolderPath':''};}}return{'type':'error','errorCode':_0x272eef(0x118),'message':_0x272eef(0xe8)+_0x4645c2,'arg':_0x4645c2,'helpText':'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'};}return{'type':_0x272eef(0xea),'errorCode':_0x272eef(0xfb),'message':_0x12439c,'arg':_0x4645c2};}if(_0x4645c2){const _0x24ac6c=a118_0x1effab['resolve'](cwd,_0x4645c2);let _0x4d1140=null;try{_0x4d1140=await fs[_0x272eef(0xe9)](_0x24ac6c);}catch{}if(_0x4d1140?.['isDirectory']()){const _0x419cbd=await findTdxConfigAsync(_0x24ac6c,fs);if(_0x419cbd){const _0xba1e1d=calculateScopedPath(_0x24ac6c,_0x419cbd[_0x272eef(0x105)]);return{'type':_0x272eef(0x10f),'parentName':_0x419cbd['parentSegment'],'targetDir':_0x24ac6c,'configRoot':_0x419cbd[_0x272eef(0x105)],'isScoped':_0xba1e1d[_0x272eef(0x10a)],'scopedFolderPath':_0xba1e1d['scopedFolderPath']};}if(_0x4a55b2)return{'type':_0x272eef(0x10f),'parentName':_0x4a55b2,'targetDir':_0x24ac6c,'configRoot':_0x24ac6c,'isScoped':![],'scopedFolderPath':''};return{'type':'error','errorCode':_0x272eef(0x118),'message':_0x272eef(0xf3)+_0x4645c2,'arg':_0x4645c2,'helpText':_0x272eef(0x10b)};}if(_0x4d1140?.[_0x272eef(0x112)]())return{'type':_0x272eef(0xea),'errorCode':_0x272eef(0xfb),'message':_0x272eef(0xfc)+_0x4645c2,'arg':_0x4645c2,'helpText':_0x272eef(0xed)};const _0x4ead1f=sanitizeFileName(_0x4645c2),_0xc654bb=getSegmentRootDir(_0x4ead1f,cwd);return{'type':'parent_name','parentName':_0x4645c2,'targetDir':_0xc654bb,'configRoot':_0xc654bb};}const _0x5a2a9b=await findTdxConfigAsync(cwd,fs);if(_0x5a2a9b){const _0x4be30f=calculateScopedPath(cwd,_0x5a2a9b['configDir']);return{'type':'context','parentName':_0x5a2a9b[_0x272eef(0x114)],'targetDir':cwd,'configRoot':_0x5a2a9b[_0x272eef(0x105)],'isScoped':_0x4be30f['isScoped'],'scopedFolderPath':_0x4be30f[_0x272eef(0xfd)]};}if(_0x4a55b2){const _0x464eaf=sanitizeFileName(_0x4a55b2),_0x35860e=getSegmentRootDir(_0x464eaf,cwd);return{'type':'context','parentName':_0x4a55b2,'targetDir':_0x35860e,'configRoot':_0x35860e,'isScoped':![],'scopedFolderPath':''};}return{'type':_0x272eef(0xea),'errorCode':_0x272eef(0xef),'message':'Parent\x20segment\x20not\x20specified','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 a118_0x2ff4(){const _0x36649f=['readFile','no_parent','tdx.json','1103048niqMup','directory','No\x20tdx.json\x20found\x20for\x20file:\x20','18699637naryxr','configDir','8598anpTSC','relative','no_config','Parent\x20segment\x20not\x20specified','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','join','Segment\x20and\x20journey\x20files\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension','File\x20not\x20found:\x20','resolve','parent_name','match','File\x20not\x20found','parse','basename','cwd','root','isScoped','invalid_yaml','5521404HdZwnl','message','4342080yALTtT','journey','scopedFolderPath','exists','parent_segment','folderPath','segment','12eDddSr','35GiEvrz','dirname','5416170flwlXc','replace','trim','file','extname','context','No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','isDirectory','startsWith','type','includes','110KyznkI','27fGaAbf','error','parentSegment','string','173596rAnvBW'];a118_0x2ff4=function(){return _0x36649f;};return a118_0x2ff4();}(function(_0x4a233e,_0x535220){const _0x415b7e=a118_0x4cc8,_0x137d74=_0x4a233e();while(!![]){try{const _0x55dcdb=parseInt(_0x415b7e(0xc9))/0x1*(parseInt(_0x415b7e(0xbb))/0x2)+parseInt(_0x415b7e(0xdd))/0x3+parseInt(_0x415b7e(0xc0))/0x4*(parseInt(_0x415b7e(0xe5))/0x5)+parseInt(_0x415b7e(0xe4))/0x6*(-parseInt(_0x415b7e(0xdb))/0x7)+parseInt(_0x415b7e(0xc4))/0x8+parseInt(_0x415b7e(0xbc))/0x9*(-parseInt(_0x415b7e(0xe7))/0xa)+parseInt(_0x415b7e(0xc7))/0xb;if(_0x55dcdb===_0x535220)break;else _0x137d74['push'](_0x137d74['shift']());}catch(_0x2930c4){_0x137d74['push'](_0x137d74['shift']());}}}(a118_0x2ff4,0xd1d68));import a118_0x2a3544 from'path';import{sanitizeFileName}from'../../utils/string-utils.js';import{nodeFileSystem}from'../io/node-filesystem.js';function a118_0x4cc8(_0x1facbf,_0x20defe){_0x1facbf=_0x1facbf-0xba;const _0x2ff447=a118_0x2ff4();let _0x4cc8ac=_0x2ff447[_0x1facbf];return _0x4cc8ac;}import{isYamlFilePath,resolveYamlFilePath}from'./segment-path-parser.js';import{getSegmentRootDir}from'./tdx-config.js';export function isSuccessfulResolution(_0x3d314d){const _0xd34448=a118_0x4cc8;return _0x3d314d[_0xd34448(0xf0)]!==_0xd34448(0xbd);}export function isScopedResolution(_0x451fc0){const _0x57dd42=a118_0x4cc8;return _0x451fc0['type']===_0x57dd42(0xc5)||_0x451fc0[_0x57dd42(0xf0)]===_0x57dd42(0xea)||_0x451fc0[_0x57dd42(0xf0)]===_0x57dd42(0xec);}export function getScopedDetails(_0x48fffc){const _0x141c3c=a118_0x4cc8;if(isScopedResolution(_0x48fffc))return{'isScoped':_0x48fffc[_0x141c3c(0xd9)],'scopedFolderPath':_0x48fffc[_0x141c3c(0xdf)]};return undefined;}async function findTdxConfigAsync(_0x1a3693,_0x3d0415){const _0x21d2b8=a118_0x4cc8;let _0x40eba6=a118_0x2a3544[_0x21d2b8(0xd1)](_0x1a3693);const _0x2ce3b4=a118_0x2a3544[_0x21d2b8(0xd5)](_0x40eba6)[_0x21d2b8(0xd8)];while(_0x40eba6!==_0x2ce3b4){const _0x8b1f8f=a118_0x2a3544[_0x21d2b8(0xce)](_0x40eba6,_0x21d2b8(0xc3));if(await _0x3d0415['exists'](_0x8b1f8f))try{const _0xf3a740=await _0x3d0415[_0x21d2b8(0xc1)](_0x8b1f8f),_0x11fe9d=JSON[_0x21d2b8(0xd5)](_0xf3a740);if(_0x11fe9d['parent_segment']&&typeof _0x11fe9d[_0x21d2b8(0xe1)]===_0x21d2b8(0xbf))return{'configPath':_0x8b1f8f,'configDir':_0x40eba6,'parentSegment':_0x11fe9d[_0x21d2b8(0xe1)]};}catch{}_0x40eba6=a118_0x2a3544[_0x21d2b8(0xe6)](_0x40eba6);}return null;}function calculateScopedPath(_0x1eb7f5,_0x12791c){const _0x48d798=a118_0x4cc8,_0x57deae=a118_0x2a3544[_0x48d798(0xca)](_0x12791c,_0x1eb7f5),_0x8eb93a=_0x57deae!==''&&_0x57deae!=='.'&&!_0x57deae[_0x48d798(0xef)]('..');return{'isScoped':_0x8eb93a,'scopedFolderPath':_0x8eb93a?_0x57deae[_0x48d798(0xe8)](/\\/g,'/'):''};}export async function resolveTarget(_0x5ad4ce){const _0x3d98d1=a118_0x4cc8,{arg:_0x3919fe,contextParent:_0x143865,cwd:cwd=process[_0x3d98d1(0xd7)](),fs:fs=nodeFileSystem}=_0x5ad4ce;if(_0x3919fe&&isYamlFilePath(_0x3919fe))try{const _0x55a69f=await resolveYamlFilePath(_0x3919fe,fs),_0x406f91=a118_0x2a3544[_0x3d98d1(0xd1)](_0x3919fe),_0x20e720=a118_0x2a3544[_0x3d98d1(0xe6)](_0x406f91),_0x2f3546=await findTdxConfigAsync(_0x20e720,fs);if(!_0x2f3546){if(_0x143865){const _0x53c25f=a118_0x2a3544['dirname'](_0x406f91);return{'type':_0x3d98d1(0xea),'parentName':_0x143865,'targetDir':_0x53c25f,'configRoot':_0x53c25f,'filePath':_0x406f91,'resourceName':_0x55a69f['segmentName'],'folderPath':_0x55a69f[_0x3d98d1(0xe2)],'resourceType':_0x55a69f['resourceType'],'isScoped':![],'scopedFolderPath':''};}return{'type':_0x3d98d1(0xbd),'errorCode':_0x3d98d1(0xcb),'message':_0x3d98d1(0xc6)+_0x3919fe,'arg':_0x3919fe,'helpText':'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'};}const _0x136e3d=calculateScopedPath(_0x20e720,_0x2f3546['configDir']);return{'type':'file','parentName':_0x2f3546[_0x3d98d1(0xbe)],'targetDir':_0x2f3546[_0x3d98d1(0xc8)],'configRoot':_0x2f3546['configDir'],'filePath':_0x406f91,'resourceName':_0x55a69f['segmentName'],'folderPath':_0x55a69f['folderPath'],'resourceType':_0x55a69f['resourceType'],'isScoped':_0x136e3d[_0x3d98d1(0xd9)],'scopedFolderPath':_0x136e3d[_0x3d98d1(0xdf)]};}catch(_0x19a95a){const _0xf9bee4=_0x19a95a instanceof Error?_0x19a95a[_0x3d98d1(0xdc)]:String(_0x19a95a);if(_0xf9bee4[_0x3d98d1(0xba)](_0x3d98d1(0xd4)))return{'type':_0x3d98d1(0xbd),'errorCode':'file_not_found','message':_0x3d98d1(0xd0)+_0x3919fe,'arg':_0x3919fe};if(_0xf9bee4[_0x3d98d1(0xba)]('No\x20tdx.json\x20found')){if(_0x143865){const _0x269bd3=a118_0x2a3544[_0x3d98d1(0xd1)](_0x3919fe);if(await fs[_0x3d98d1(0xe0)](_0x269bd3)){const _0xdd1803=a118_0x2a3544[_0x3d98d1(0xe6)](_0x269bd3),_0x10866d=await fs[_0x3d98d1(0xc1)](_0x269bd3),_0x32f9af=_0x10866d['match'](/^name:\s*["']?([^"'\n]+)["']?/m),_0x552310=_0x10866d[_0x3d98d1(0xd3)](/^type:\s*["']?([^"'\n]+)["']?/m),_0x3be99d=_0x32f9af?_0x32f9af[0x1][_0x3d98d1(0xe9)]():a118_0x2a3544[_0x3d98d1(0xd6)](_0x3919fe,a118_0x2a3544[_0x3d98d1(0xeb)](_0x3919fe)),_0x5cde7d=_0x552310&&_0x552310[0x1]['trim']()===_0x3d98d1(0xde)?'journey':_0x3d98d1(0xe3);return{'type':_0x3d98d1(0xea),'parentName':_0x143865,'targetDir':_0xdd1803,'configRoot':_0xdd1803,'filePath':_0x269bd3,'resourceName':_0x3be99d,'folderPath':'','resourceType':_0x5cde7d,'isScoped':![],'scopedFolderPath':''};}}return{'type':'error','errorCode':_0x3d98d1(0xcb),'message':_0x3d98d1(0xc6)+_0x3919fe,'arg':_0x3919fe,'helpText':_0x3d98d1(0xcd)};}return{'type':'error','errorCode':_0x3d98d1(0xda),'message':_0xf9bee4,'arg':_0x3919fe};}if(_0x3919fe){const _0x4bbaf9=a118_0x2a3544[_0x3d98d1(0xd1)](cwd,_0x3919fe);let _0xb46b45=null;try{_0xb46b45=await fs['stat'](_0x4bbaf9);}catch{}if(_0xb46b45?.[_0x3d98d1(0xee)]()){const _0x50cf11=await findTdxConfigAsync(_0x4bbaf9,fs);if(_0x50cf11){const _0x1445f2=calculateScopedPath(_0x4bbaf9,_0x50cf11[_0x3d98d1(0xc8)]);return{'type':_0x3d98d1(0xc5),'parentName':_0x50cf11[_0x3d98d1(0xbe)],'targetDir':_0x4bbaf9,'configRoot':_0x50cf11[_0x3d98d1(0xc8)],'isScoped':_0x1445f2[_0x3d98d1(0xd9)],'scopedFolderPath':_0x1445f2['scopedFolderPath']};}if(_0x143865)return{'type':_0x3d98d1(0xc5),'parentName':_0x143865,'targetDir':_0x4bbaf9,'configRoot':_0x4bbaf9,'isScoped':![],'scopedFolderPath':''};return{'type':'error','errorCode':_0x3d98d1(0xcb),'message':_0x3d98d1(0xed)+_0x3919fe,'arg':_0x3919fe,'helpText':_0x3d98d1(0xcd)};}if(_0xb46b45?.['isFile']())return{'type':_0x3d98d1(0xbd),'errorCode':_0x3d98d1(0xda),'message':'Not\x20a\x20YAML\x20file:\x20'+_0x3919fe,'arg':_0x3919fe,'helpText':_0x3d98d1(0xcf)};const _0x29a785=sanitizeFileName(_0x3919fe),_0x71228e=getSegmentRootDir(_0x29a785,cwd);return{'type':_0x3d98d1(0xd2),'parentName':_0x3919fe,'targetDir':_0x71228e,'configRoot':_0x71228e};}const _0x5874b3=await findTdxConfigAsync(cwd,fs);if(_0x5874b3){const _0xd7820c=calculateScopedPath(cwd,_0x5874b3[_0x3d98d1(0xc8)]);return{'type':'context','parentName':_0x5874b3[_0x3d98d1(0xbe)],'targetDir':cwd,'configRoot':_0x5874b3[_0x3d98d1(0xc8)],'isScoped':_0xd7820c[_0x3d98d1(0xd9)],'scopedFolderPath':_0xd7820c[_0x3d98d1(0xdf)]};}if(_0x143865){const _0x1f7dc3=sanitizeFileName(_0x143865),_0x32f438=getSegmentRootDir(_0x1f7dc3,cwd);return{'type':_0x3d98d1(0xec),'parentName':_0x143865,'targetDir':_0x32f438,'configRoot':_0x32f438,'isScoped':![],'scopedFolderPath':''};}return{'type':_0x3d98d1(0xbd),'errorCode':_0x3d98d1(0xc2),'message':_0x3d98d1(0xcc),'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'};}