@treasuredata/tdx 0.26.6 → 0.26.7

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 (191) 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.d.ts.map +1 -1
  22. package/dist/commands/job-command.js +1 -1
  23. package/dist/commands/job-command.js.map +1 -1
  24. package/dist/commands/journey-command.js +1 -1
  25. package/dist/commands/journey-validate-command.js +1 -1
  26. package/dist/commands/llm-command.js +1 -1
  27. package/dist/commands/mcp-command.js +1 -1
  28. package/dist/commands/parent-segment-command.js +1 -1
  29. package/dist/commands/profile-command.js +1 -1
  30. package/dist/commands/profiles-command.js +1 -1
  31. package/dist/commands/query-command.js +1 -1
  32. package/dist/commands/schedule-command.js +1 -1
  33. package/dist/commands/segment-command.js +1 -1
  34. package/dist/commands/segment-create-command.js +1 -1
  35. package/dist/commands/segment-fields-command.js +1 -1
  36. package/dist/commands/segment-pull-command.js +1 -1
  37. package/dist/commands/segment-push-command.js +1 -1
  38. package/dist/commands/segment-update-command.js +1 -1
  39. package/dist/commands/segment-use-command.js +1 -1
  40. package/dist/commands/segment-validate-command.js +1 -1
  41. package/dist/commands/segments.js +1 -1
  42. package/dist/commands/show.js +1 -1
  43. package/dist/commands/status-command.js +1 -1
  44. package/dist/commands/tables.js +1 -1
  45. package/dist/commands/unset-command.js +1 -1
  46. package/dist/commands/use-command.js +1 -1
  47. package/dist/commands/user-command.js +1 -1
  48. package/dist/commands/workflow-command.js +1 -1
  49. package/dist/core/auth.js +1 -1
  50. package/dist/core/command-output.js +1 -1
  51. package/dist/core/config.js +1 -1
  52. package/dist/core/connection-cache.js +1 -1
  53. package/dist/core/constants.js +1 -1
  54. package/dist/core/credential-cache.js +1 -1
  55. package/dist/core/global-context.js +1 -1
  56. package/dist/core/keychain.js +1 -1
  57. package/dist/core/profile.js +1 -1
  58. package/dist/core/project-config.js +1 -1
  59. package/dist/core/session.js +1 -1
  60. package/dist/core/user-cache.js +1 -1
  61. package/dist/core/version.js +1 -1
  62. package/dist/index.js +1 -1
  63. package/dist/mcp/server.js +1 -1
  64. package/dist/mcp/tools/index.js +1 -1
  65. package/dist/mcp/tools/tdx-run.js +1 -1
  66. package/dist/mcp/tools/tdx-search.js +1 -1
  67. package/dist/mcp/utils.js +1 -1
  68. package/dist/proxy/claude-usage-tracker.js +1 -1
  69. package/dist/proxy/passthrough-server.js +1 -1
  70. package/dist/proxy/sse-usage-parser.js +1 -1
  71. package/dist/sdk/agent/agent-config.js +1 -1
  72. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  73. package/dist/sdk/agent/agent-yaml.d.ts +14 -37
  74. package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
  75. package/dist/sdk/agent/agent-yaml.js +1 -1
  76. package/dist/sdk/agent/agent-yaml.js.map +1 -1
  77. package/dist/sdk/agent/test/evaluator.js +1 -1
  78. package/dist/sdk/agent/test/executor.js +1 -1
  79. package/dist/sdk/agent/test/index.js +1 -1
  80. package/dist/sdk/agent/test/output.js +1 -1
  81. package/dist/sdk/agent/test/parser.js +1 -1
  82. package/dist/sdk/agent/tool-target-registry.d.ts +82 -0
  83. package/dist/sdk/agent/tool-target-registry.d.ts.map +1 -0
  84. package/dist/sdk/agent/tool-target-registry.js +1 -0
  85. package/dist/sdk/agent/tool-target-registry.js.map +1 -0
  86. package/dist/sdk/agent/types/agent-def.d.ts +3 -2
  87. package/dist/sdk/agent/types/agent-def.d.ts.map +1 -1
  88. package/dist/sdk/api.js +1 -1
  89. package/dist/sdk/client/cdp-api-client.js +1 -1
  90. package/dist/sdk/client/endpoints.js +1 -1
  91. package/dist/sdk/client/engage-api-client.js +1 -1
  92. package/dist/sdk/client/http-client.js +1 -1
  93. package/dist/sdk/client/llm-api-client.d.ts +20 -0
  94. package/dist/sdk/client/llm-api-client.d.ts.map +1 -1
  95. package/dist/sdk/client/llm-api-client.js +1 -1
  96. package/dist/sdk/client/llm-api-client.js.map +1 -1
  97. package/dist/sdk/client/rate-limiter.js +1 -1
  98. package/dist/sdk/client/td-api-client.d.ts +2 -2
  99. package/dist/sdk/client/td-api-client.d.ts.map +1 -1
  100. package/dist/sdk/client/td-api-client.js +1 -1
  101. package/dist/sdk/client/td-api-client.js.map +1 -1
  102. package/dist/sdk/client/trino-api-client.js +1 -1
  103. package/dist/sdk/client/workflow-client.js +1 -1
  104. package/dist/sdk/connection-validator.js +1 -1
  105. package/dist/sdk/connection.js +1 -1
  106. package/dist/sdk/engage.js +1 -1
  107. package/dist/sdk/errors.js +1 -1
  108. package/dist/sdk/index.js +1 -1
  109. package/dist/sdk/io/index.js +1 -1
  110. package/dist/sdk/io/node-filesystem.js +1 -1
  111. package/dist/sdk/job.d.ts +1 -1
  112. package/dist/sdk/job.d.ts.map +1 -1
  113. package/dist/sdk/job.js +1 -1
  114. package/dist/sdk/job.js.map +1 -1
  115. package/dist/sdk/journey.js +1 -1
  116. package/dist/sdk/llm/chat-cache.js +1 -1
  117. package/dist/sdk/llm/index.d.ts.map +1 -1
  118. package/dist/sdk/llm/index.js +1 -1
  119. package/dist/sdk/llm/index.js.map +1 -1
  120. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  121. package/dist/sdk/llm/model-factors.js +1 -1
  122. package/dist/sdk/personalization.js +1 -1
  123. package/dist/sdk/query/index.js +1 -1
  124. package/dist/sdk/query/sql-parser.js +1 -1
  125. package/dist/sdk/realtime.js +1 -1
  126. package/dist/sdk/schedule.js +1 -1
  127. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  128. package/dist/sdk/segment/fields-display.js +1 -1
  129. package/dist/sdk/segment/file-discovery.js +1 -1
  130. package/dist/sdk/segment/journey-utils.js +1 -1
  131. package/dist/sdk/segment/journey-validator.js +1 -1
  132. package/dist/sdk/segment/journey-yaml.js +1 -1
  133. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  134. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  135. package/dist/sdk/segment/pull-workflow.js +1 -1
  136. package/dist/sdk/segment/push-recovery.js +1 -1
  137. package/dist/sdk/segment/push-workflow.js +1 -1
  138. package/dist/sdk/segment/resolution-context.js +1 -1
  139. package/dist/sdk/segment/segment-path-parser.js +1 -1
  140. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  141. package/dist/sdk/segment/target-resolution.js +1 -1
  142. package/dist/sdk/segment/tdx-config.js +1 -1
  143. package/dist/sdk/segment/validate-files.js +1 -1
  144. package/dist/sdk/segment/yaml-validator.js +1 -1
  145. package/dist/sdk/segment.js +1 -1
  146. package/dist/sdk/types/index.js +1 -1
  147. package/dist/sdk/types/progress.js +1 -1
  148. package/dist/sdk/user.js +1 -1
  149. package/dist/sdk/util/format-detector.js +1 -1
  150. package/dist/sdk/util/formatters.js +1 -1
  151. package/dist/sdk/util/index.js +1 -1
  152. package/dist/sdk/util/tree-formatter.js +1 -1
  153. package/dist/sdk/workflow/archive-validation.js +1 -1
  154. package/dist/sdk/workflow/clone-workflow.js +1 -1
  155. package/dist/sdk/workflow/index.js +1 -1
  156. package/dist/sdk/workflow/pull-workflow.js +1 -1
  157. package/dist/sdk/workflow/push-workflow.js +1 -1
  158. package/dist/sdk/workflow/tdx-config.js +1 -1
  159. package/dist/sdk/workflow/workflow-utils.js +1 -1
  160. package/dist/test-utils/command-runner.js +1 -1
  161. package/dist/test-utils/factories.js +1 -1
  162. package/dist/test-utils/fixtures.js +1 -1
  163. package/dist/test-utils/http-mock.js +1 -1
  164. package/dist/test-utils/index.js +1 -1
  165. package/dist/utils/async.js +1 -1
  166. package/dist/utils/colors.js +1 -1
  167. package/dist/utils/diff.js +1 -1
  168. package/dist/utils/file-permissions.js +1 -1
  169. package/dist/utils/global-cache.js +1 -1
  170. package/dist/utils/json-loader.js +1 -1
  171. package/dist/utils/local-cache.js +1 -1
  172. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  173. package/dist/utils/logger/formatters/index.js +1 -1
  174. package/dist/utils/logger/handlers/console-handler.js +1 -1
  175. package/dist/utils/logger/handlers/file-handler.js +1 -1
  176. package/dist/utils/logger/handlers/index.js +1 -1
  177. package/dist/utils/logger/handlers/null-handler.js +1 -1
  178. package/dist/utils/logger/index.js +1 -1
  179. package/dist/utils/logger/logger.js +1 -1
  180. package/dist/utils/logger/types.js +1 -1
  181. package/dist/utils/option-validation.js +1 -1
  182. package/dist/utils/port.js +1 -1
  183. package/dist/utils/process.js +1 -1
  184. package/dist/utils/prompt.js +1 -1
  185. package/dist/utils/spinner.js +1 -1
  186. package/dist/utils/sse-parser.js +1 -1
  187. package/dist/utils/string-utils.js +1 -1
  188. package/dist/utils/table-ref-parser.js +1 -1
  189. package/dist/utils/tdx-logger.js +1 -1
  190. package/dist/utils/version-check.js +1 -1
  191. package/package.json +1 -1
@@ -1 +1 @@
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
+ const a115_0x188509=a115_0x4469;(function(_0xa29033,_0x918927){const _0x5d0404=a115_0x4469,_0x4a7094=_0xa29033();while(!![]){try{const _0x7d9971=-parseInt(_0x5d0404(0x1b2))/0x1+-parseInt(_0x5d0404(0x1f9))/0x2+-parseInt(_0x5d0404(0x21f))/0x3+-parseInt(_0x5d0404(0x212))/0x4*(-parseInt(_0x5d0404(0x285))/0x5)+parseInt(_0x5d0404(0x213))/0x6+-parseInt(_0x5d0404(0x228))/0x7*(parseInt(_0x5d0404(0x276))/0x8)+parseInt(_0x5d0404(0x22a))/0x9;if(_0x7d9971===_0x918927)break;else _0x4a7094['push'](_0x4a7094['shift']());}catch(_0x28cb47){_0x4a7094['push'](_0x4a7094['shift']());}}}(a115_0x35b7,0x643b8));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a115_0x188509(0x21c));export const PENDING_SEGMENT_PREFIX=a115_0x188509(0x1c5);export const PENDING_ACTIVATION_PREFIX=a115_0x188509(0x1b4);export function createPendingSegmentId(_0x3dce9e){return''+PENDING_SEGMENT_PREFIX+_0x3dce9e+'__';}export function isPendingSegmentId(_0x257c68){const _0x12f4f0=a115_0x188509;return _0x257c68[_0x12f4f0(0x263)](PENDING_SEGMENT_PREFIX)&&!_0x257c68[_0x12f4f0(0x263)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x5564cb){const _0x37ae88=a115_0x188509;return _0x5564cb[_0x37ae88(0x281)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x1a9cf8){return''+PENDING_ACTIVATION_PREFIX+_0x1a9cf8+'__';}export function isPendingActivationId(_0x3e9599){return _0x3e9599['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x233bcb){const _0x14cd61=a115_0x188509;return _0x233bcb[_0x14cd61(0x281)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x2d4e55,_0x54ca5b){const _0x2420cb=a115_0x188509,_0x413324=_0x2d4e55+'::'+(_0x54ca5b['trim']()||_0x2420cb(0x1db)),_0x3952e9=createHash('sha1')[_0x2420cb(0x289)](_0x413324)[_0x2420cb(0x1ef)]('hex')[_0x2420cb(0x238)](0x0,0xc);return _0x2420cb(0x1ca)+_0x3952e9;}export function ensureJourneyDefaults(_0x1e3dc3){const _0x156bb4=a115_0x188509;!_0x1e3dc3[_0x156bb4(0x1b7)]&&(_0x1e3dc3[_0x156bb4(0x1b7)]=''),!_0x1e3dc3['state']&&(_0x1e3dc3[_0x156bb4(0x28b)]=_0x156bb4(0x29b));}export function resolveTDFolderPath(_0x5cfa81,_0x2171fe,_0x3991e2){if(!_0x2171fe)return _0x5cfa81;if(_0x5cfa81===_0x3991e2||_0x5cfa81['startsWith'](_0x3991e2+'/'))return _0x5cfa81;return _0x5cfa81?_0x3991e2+'/'+_0x5cfa81:_0x3991e2;}export function addFoldersToCreate(_0x4ead26,_0x3c373b,_0x48855d){const _0x46a901=a115_0x188509;if(!_0x4ead26)return;if(_0x3c373b[_0x46a901(0x26e)](_0x4ead26))return;const _0x2a8e76=_0x4ead26[_0x46a901(0x216)]('/');let _0x69f20='';for(const _0x4f0bc3 of _0x2a8e76){_0x69f20=_0x69f20?_0x69f20+'/'+_0x4f0bc3:_0x4f0bc3,!_0x3c373b[_0x46a901(0x26e)](_0x69f20)&&_0x48855d[_0x46a901(0x29d)](_0x69f20);}}function a115_0x35b7(){const _0x563db4=['rootFolderId','milestone','segment_created','toISOString','segment_updated','uniqueSegmentName','embedded_activation_created','created','\x27\x20not\x20found\x20in\x20journey\x20\x27','\x27\x20milestone','waitStepUnit','delete','Updated\x20journey\x20\x27','startsWith','message','deleted','relative','activations','idToEmailMap','Embedded\x20segment\x20\x27','segmentFolderId','Segment\x20not\x20found','hasChanges','\x20journey\x20from\x20file:\x20','has','SEGMENT_NOT_FOUND','folderPathToId','logDeleted','folderId','../../utils/async.js','notification','conditions','24nAPNqY','all_columns','waitStep','activation_updating','\x27\x20from\x20file:\x20','sort','buildUserMaps','Creating\x20segment\x20\x27','journey_updated','idToName','conditionTimeoutUnit','replace','connector_config','parse','Name\x20has\x20already\x20been\x20taken','695aquUhO','):\x20','map','getSegmentEntity\x20also\x20failed\x20for\x20','update','skipSegments','state','Journey\x20\x27','logWarning','object','updateSegmentById','effectiveFolderId','segmentId','NOT_FOUND','item','journeyBundleName','fetchJourney','index','reduce','with','diff','action','draft','getSegmentEntity','add','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','getActivation','deps','activation_creating','Failed\x20to\x20','activation_deleted','errors','.$1.push-recovery.json','run_after_journey_refresh','Activation','schedule','resolveSegment','size','\x20(referenced\x20in\x20journey\x20','activationActions','Created\x20segment\x20\x27','day','./journey-yaml.js','parseDocument','Creating\x20activation\x20\x27','createActivation','deleteActivation','columns','89229SSnUGV','existingSegment','__pending_act_','nameToId','list','description','null','./child-segment-yaml.js','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','segment_creating','journeyBundlesByFolderAndName','stringify','journeyName','conditionTimeoutDuration','goal','existingSegments','updateActivation','valid','existingActivation','__pending_','\x27\x20decision\x20point\x20branch\x20\x27','activation_','journeys','find','journey_entry_criteria_','uniqueServerName','Updated\x20activation\x20\x27','\x27\x20exit\x20criteria','logInfo','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','conditionSegmentId','some','parentSegmentFolder','segmentByFolderAndName','absolutePath','folderPath','behavior','steps','listActivations','journeyId','validatedRequest','segment','from','createdSegmentId','data','SEGMENT_SYNTAX_ERROR','get','Condition','entries','journey_created','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','Deleted\x20segment\x20\x27','activation_created','branches','max','segment_deleted','activationContext','activation_template_id','create','resolveJourneyId','utf-8','digest','existingJourney','\x27\x20wait\x20condition','getSegment','exitCriterias','length','toLowerCase','unchanged','stage\x20\x27','journeyActivationStepId','618674XkyECY','\x27\x20for\x20','isArray','ACTIVATION_UPDATE_ERROR','Updating\x20activation\x20\x27','toString','attributes','relationships','Updated\x20segment\x20\x27','segments','Created\x20activation\x20\x27','JOURNEY_SYNTAX_ERROR','set','name','debug','journeyById','Updating\x20segment\x20\x27',').\x20','WaitStep','join','segment_updating','entryCriteria','Fetching\x20','parentId','yamlConfig','11292SAYrHM','3277410qtfZTz','folder_created','journey','split','journey_updating','activation_deleting','Deleted\x20activation\x20\x27','progress','folder_creating','tdx.sdk.push-workflow','isNew','withProgress','852606CboEzS','embedded_segment_creating','INTERNAL','embedded_segment_created','getJourney','logSuccess','journeyActivationNameToId','deleteSegment','resolvedRule','1627605oQvSHr','embeddedSegmentNameToId','7670097uvJPia','journey_creating','connection','\x27\x20entry\x20criteria','Failed\x20to\x20resolve\x20activation\x20','waitStepType','Created\x20journey\x20\x27','type','createFolder','keys','activation_updated','\x27...','segmentNameToId','filter','slice','decision_point','connectionIdToNameMap','goal\x20criteria','activationStepsById','onProgress','user','\x0a\x20\x20','\x20segment\x20from\x20file:\x20','yamlActivation','getSegment\x20failed\x20for\x20','updated','versionNumber','SEGMENT_UPDATE_ERROR','folder','kind','Creating\x20folder\x20\x27','createSegment',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','all','Entry\x20criteria:\x20','DecisionPoint','results','stages','Duration','rule','journeyStages','dirname','and\x20the\x20server\x20segment,\x20then\x20retry.','push'];a115_0x35b7=function(){return _0x563db4;};return a115_0x35b7();}import*as a115_0x535900 from'yaml';import{readFileSync}from'fs';import a115_0x435f13 from'path';import{isJourneyDef,parseYamlString as a115_0x3766b9,toYamlString as a115_0x2c6f0e,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(_0x564030){const _0x1692ee=a115_0x188509;if(Array[_0x1692ee(0x1fb)](_0x564030))return'['+_0x564030[_0x1692ee(0x287)](_0x4edfb6=>stableStringify(_0x4edfb6))[_0x1692ee(0x20c)](',')+']';if(_0x564030&&typeof _0x564030===_0x1692ee(0x28e)){const _0x25e16f=_0x564030,_0x5b61de=Object['keys'](_0x25e16f)[_0x1692ee(0x27b)](),_0x2e91f9=_0x5b61de[_0x1692ee(0x287)](_0x357d10=>'\x22'+_0x357d10+'\x22:'+stableStringify(_0x25e16f[_0x357d10]));return'{'+_0x2e91f9[_0x1692ee(0x20c)](',')+'}';}const _0x404a02=JSON[_0x1692ee(0x1bd)](_0x564030);return _0x404a02===undefined?_0x1692ee(0x1b8):_0x404a02;}function activationSignature(_0x5b001b){const _0x4df17f=a115_0x188509,_0x40cf8c={'connection':_0x5b001b[_0x4df17f(0x22c)],..._0x5b001b[_0x4df17f(0x277)]!==undefined&&{'all_columns':_0x5b001b[_0x4df17f(0x277)]},..._0x5b001b[_0x4df17f(0x1b1)]!==undefined&&{'columns':_0x5b001b['columns']},..._0x5b001b[_0x4df17f(0x1d6)]!==undefined&&{'behavior':_0x5b001b[_0x4df17f(0x1d6)]},..._0x5b001b[_0x4df17f(0x1a5)]!==undefined&&{'schedule':_0x5b001b[_0x4df17f(0x1a5)]},..._0x5b001b[_0x4df17f(0x274)]!==undefined&&{'notification':_0x5b001b['notification']},..._0x5b001b['connector_config']!==undefined&&{'connector_config':_0x5b001b[_0x4df17f(0x282)]},..._0x5b001b['activation_template_id']!==undefined&&{'activation_template_id':_0x5b001b[_0x4df17f(0x1eb)]}};return stableStringify(_0x40cf8c);}async function fetchSegment(_0x64e022,_0x413ebb,_0x299f9c,_0x13374a){const _0x59db66=a115_0x188509,_0x53b105=_0x13374a?.[_0x59db66(0x1c9)](_0x25bb95=>_0x25bb95['id']===_0x299f9c);if(_0x53b105)return _0x53b105;try{return await _0x64e022['segment'][_0x59db66(0x1f2)](_0x413ebb,_0x299f9c);}catch(_0x522ac7){logger[_0x59db66(0x207)](_0x59db66(0x242)+_0x299f9c+_0x59db66(0x24a)+_0x522ac7);try{return await _0x64e022[_0x59db66(0x1db)][_0x59db66(0x29c)](_0x299f9c);}catch(_0x316760){return logger['debug'](_0x59db66(0x288)+_0x299f9c+':\x20'+_0x316760),null;}}}function recoverSegmentIdsFromPushRecovery(_0xe900e0,_0x25a89e,_0x5ee377){const _0x283ac7=a115_0x188509,_0x7761e2=readPushRecovery(_0xe900e0[_0x283ac7(0x1d4)]);if(_0x7761e2?.['journeyName']===_0xe900e0['yamlConfig'][_0x283ac7(0x206)])for(const [_0x4ec5ff,_0x107f10]of Object[_0x283ac7(0x1e2)](_0x7761e2['segments'])){const _0x35cd8f=generateDeterministicJourneySegmentName(_0xe900e0[_0x283ac7(0x211)]['name'],_0x4ec5ff);_0x107f10[_0x283ac7(0x1cb)]===_0x35cd8f&&(_0x25a89e[_0x283ac7(0x205)](_0x4ec5ff,_0x107f10[_0x283ac7(0x291)]),_0x5ee377[_0x283ac7(0x205)](_0x4ec5ff,_0x107f10['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x46cb4f,_0x1b8e21,_0x589135,_0x437c07){const _0x679fe8=a115_0x188509;let _0x390433;try{_0x390433=await _0x46cb4f[_0x679fe8(0x1db)]['createJourneySegment']({'name':_0x589135[_0x679fe8(0x25b)],'description':_0x589135[_0x679fe8(0x1b7)],'journeyId':_0x589135[_0x679fe8(0x1d9)],'rule':_0x437c07(_0x589135['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0x589135[_0x679fe8(0x272)],'audienceId':_0x589135[_0x679fe8(0x210)]});}catch(_0x13e38b){const _0x1d9eea=_0x13e38b instanceof Error&&_0x13e38b[_0x679fe8(0x264)]['includes'](_0x679fe8(0x284));if(_0x1d9eea){const _0xfb2a85=readPushRecovery(_0x1b8e21[_0x679fe8(0x1d4)]),_0x144680=_0xfb2a85?.[_0x679fe8(0x1be)]===_0x1b8e21['yamlConfig'][_0x679fe8(0x206)]?_0xfb2a85[_0x679fe8(0x202)][_0x589135['localName']]:undefined;if(_0x144680?.[_0x679fe8(0x1cb)]===_0x589135[_0x679fe8(0x25b)])await _0x46cb4f[_0x679fe8(0x1db)][_0x679fe8(0x28f)](_0x589135[_0x679fe8(0x210)],_0x144680[_0x679fe8(0x291)],{'description':_0x589135[_0x679fe8(0x1b7)],'rule':_0x437c07(_0x589135[_0x679fe8(0x227)],!![]),'countPopulation':!![]}),_0x390433=_0x144680[_0x679fe8(0x291)];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],_0x679fe8(0x269)+_0x589135['localName']+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x1b8e21['absolutePath'][_0x679fe8(0x281)](/([^/]+)$/,_0x679fe8(0x1a2))+')\x20')+_0x679fe8(0x254),_0x13e38b);}else throw _0x13e38b;}return saveSegmentToPushRecovery(_0x1b8e21[_0x679fe8(0x1d4)],_0x1b8e21[_0x679fe8(0x211)][_0x679fe8(0x206)],_0x589135['localName'],{'segmentId':_0x390433,'uniqueServerName':_0x589135[_0x679fe8(0x25b)],'createdAt':new Date()[_0x679fe8(0x259)]()}),_0x390433;}export async function prepareSegmentFiles(_0x5f1a1f,_0x597a89,_0x37da29,_0x51b6bc,_0x560723){const _0x215e86=a115_0x188509,{activationDefToCreateRequest:_0x3a356c}=await import(_0x215e86(0x1b9)),_0x706c17=[],_0xfd9ac8=new Set();for(const {yamlConfig:_0x2ee7f4,folderPath:_0x16c70d,sourcePath:_0x5118e0}of _0x5f1a1f){const _0xb3309a=resolveTDFolderPath(_0x16c70d,_0x51b6bc,_0x560723),_0x2f319a=_0xb3309a+':'+_0x2ee7f4[_0x215e86(0x206)],_0x433748=_0x597a89[_0x215e86(0x1d3)][_0x215e86(0x1e0)](_0x2f319a),_0x50b3b4=_0x433748?_0x597a89['activationsBySegmentId'][_0x215e86(0x1e0)](_0x433748['id'])||[]:[];addFoldersToCreate(_0xb3309a,_0x597a89[_0x215e86(0x270)],_0xfd9ac8);const _0x1c0c9f=calculateActivationActions(_0x2ee7f4[_0x215e86(0x267)]||[],_0x50b3b4,_0x597a89['idToEmailMap'],_0x597a89[_0x215e86(0x23a)]);for(const _0x4c2b84 of _0x1c0c9f){(_0x4c2b84[_0x215e86(0x231)]==='create'||_0x4c2b84[_0x215e86(0x231)]===_0x215e86(0x289))&&_0x4c2b84[_0x215e86(0x241)]&&(_0x4c2b84[_0x215e86(0x1da)]=await _0x3a356c(_0x4c2b84['yamlActivation'],_0x37da29));}const _0x5cd1ba=calculateSegmentDiff(_0x2ee7f4,_0x433748,_0x50b3b4,_0x597a89[_0x215e86(0x268)],_0x597a89['connectionIdToNameMap']);_0x706c17[_0x215e86(0x255)]({'relativePath':_0x2ee7f4[_0x215e86(0x206)],'absolutePath':_0x5118e0,'yamlConfig':_0x2ee7f4,'folderPath':_0xb3309a,'existingSegment':_0x433748,'existingActivations':_0x50b3b4,'isNew':_0x5cd1ba[_0x215e86(0x21d)],'hasChanges':_0x5cd1ba[_0x215e86(0x26c)],'diff':_0x5cd1ba[_0x215e86(0x299)],'activationActions':_0x1c0c9f});}return{'segmentFiles':_0x706c17,'foldersToCreate':_0xfd9ac8};}export async function prepareJourneyFiles(_0x9631d0,_0x857acb,_0x19c80b,_0x2d43c9){const _0x548886=a115_0x188509,_0x3883d5=[],_0x1dd584=new Set();for(const {yamlConfig:_0x45dc5d,folderPath:_0x38ba5d,sourcePath:_0x247db9}of _0x9631d0){const _0x1a8b91=resolveTDFolderPath(_0x38ba5d,_0x19c80b,_0x2d43c9),_0x4d76f6=_0x1a8b91+':'+_0x45dc5d[_0x548886(0x206)],_0x585fd1=_0x857acb[_0x548886(0x1bc)][_0x548886(0x1e0)](_0x4d76f6);let _0x265371,_0x2bcaf5;if(_0x585fd1&&_0x585fd1['length']>0x0){const _0xe013c8=buildLocalExpandedRuleMappings(_0x45dc5d),{createYamlContext:_0x1d8d75,prefetchJourneySegments:_0x18d6ff}=createPushYamlContextForBundle(_0x857acb[_0x548886(0x2a0)],_0x857acb[_0x548886(0x210)],_0x857acb[_0x548886(0x1c1)],_0xe013c8,_0x857acb[_0x548886(0x268)],_0x857acb['connectionIdToNameMap'],_0x857acb[_0x548886(0x23c)],_0x857acb[_0x548886(0x208)]);await _0x18d6ff(_0x585fd1['map'](_0x3fd3af=>_0x3fd3af['id']));const _0x3ebc35=hasMultipleVersions(_0x45dc5d),_0x30d777=async _0x58dd9c=>{const _0x4248fe=_0x548886,_0x260cd2=_0x857acb[_0x4248fe(0x208)]?.['get'](_0x58dd9c);if(_0x260cd2)return _0x260cd2;return _0x857acb[_0x4248fe(0x295)]({'journeyId':_0x58dd9c,'journeyName':_0x45dc5d[_0x4248fe(0x206)],'isMultiVersion':_0x585fd1[_0x4248fe(0x1f4)]>0x1});};if(_0x3ebc35&&_0x585fd1[_0x548886(0x1f4)]>0x1){const _0x2a53de=[];for(const _0x3efecd of _0x585fd1){const _0x508995=_0x3efecd[_0x548886(0x244)]||0x1;_0x857acb['progress']?.[_0x548886(0x289)](_0x548886(0x20f)+_0x45dc5d[_0x548886(0x206)]+'\x20v'+_0x508995);const _0x426b02=await _0x30d777(_0x3efecd['id']),_0x50db60=_0x1d8d75(_0x3efecd['id']),_0x181b39=await journeyResponseToDef(_0x426b02,_0x50db60);_0x2a53de[_0x548886(0x255)]({'item':_0x3efecd,'yaml':_0x181b39});}const _0x18456e=buildLocalRuleToNameMappingFromJourney(_0x45dc5d);_0x2bcaf5=buildMergedJourneyDef(_0x2a53de,_0x18456e);const _0x5bc789=Math[_0x548886(0x1e8)](..._0x2a53de[_0x548886(0x287)](_0x37c10f=>_0x37c10f[_0x548886(0x293)]['versionNumber']||0x0)),_0x532edb=_0x585fd1[_0x548886(0x1c9)](_0x380db5=>(_0x380db5['versionNumber']||0x0)===_0x5bc789);_0x532edb&&(_0x857acb[_0x548886(0x21a)]?.[_0x548886(0x289)]('Fetching\x20'+_0x45dc5d[_0x548886(0x206)]+'\x20v'+_0x5bc789),_0x265371=await _0x30d777(_0x532edb['id']));}else{const _0x3099b4=_0x585fd1[_0x585fd1[_0x548886(0x1f4)]-0x1];_0x857acb['progress']?.['update'](_0x548886(0x20f)+_0x45dc5d['name']),_0x265371=await _0x30d777(_0x3099b4['id']);const _0x3cd910=_0x1d8d75(_0x3099b4['id']),_0x5ab180=await journeyResponseToDef(_0x265371,_0x3cd910),_0x31daf1=buildLocalRuleToNameMappingFromJourney(_0x45dc5d);_0x2bcaf5=buildMergedJourneyDef([{'item':_0x3099b4,'yaml':_0x5ab180}],_0x31daf1);}}addFoldersToCreate(_0x1a8b91,_0x857acb['folderPathToId'],_0x1dd584);const _0x2c1226=calculateJourneyDiff(_0x45dc5d,_0x2bcaf5);_0x3883d5[_0x548886(0x255)]({'relativePath':_0x45dc5d[_0x548886(0x206)],'absolutePath':_0x247db9,'yamlConfig':_0x45dc5d,'folderPath':_0x1a8b91,'existingJourney':_0x265371,'isNew':_0x2c1226[_0x548886(0x21d)],'hasChanges':_0x2c1226['hasChanges'],'diff':_0x2c1226[_0x548886(0x299)]});}return{'journeyFiles':_0x3883d5,'foldersToCreate':_0x1dd584};}export function calculateActivationActions(_0x253d13,_0x86e5ba,_0x5f23b4,_0x4c549e){const _0x2a9dc2=a115_0x188509,_0x387f96=[],_0x4028f0=new Map();for(const _0x449b10 of _0x86e5ba){_0x4028f0[_0x2a9dc2(0x205)](_0x449b10['name'],_0x449b10);}const _0x2253f8=new Map();for(const _0x46378e of _0x253d13){_0x2253f8[_0x2a9dc2(0x205)](_0x46378e['name'],_0x46378e);}for(const _0x608ad1 of _0x253d13){const _0x53e6b3=_0x4028f0[_0x2a9dc2(0x1e0)](_0x608ad1['name']);if(!_0x53e6b3)_0x387f96[_0x2a9dc2(0x255)]({'type':_0x2a9dc2(0x1ec),'name':_0x608ad1[_0x2a9dc2(0x206)],'yamlActivation':_0x608ad1});else{const _0x5d460b=activationResponseToDef(_0x53e6b3,_0x5f23b4,_0x4c549e),_0x5aad05=a115_0x535900[_0x2a9dc2(0x1bd)](_0x5d460b),_0x65fcfc=a115_0x535900[_0x2a9dc2(0x1bd)](_0x608ad1);_0x5aad05!==_0x65fcfc&&_0x387f96['push']({'type':_0x2a9dc2(0x289),'name':_0x608ad1[_0x2a9dc2(0x206)],'yamlActivation':_0x608ad1,'existingActivation':_0x53e6b3});}}for(const _0xb6226d of _0x86e5ba){!_0x2253f8['has'](_0xb6226d[_0x2a9dc2(0x206)])&&_0x387f96[_0x2a9dc2(0x255)]({'type':_0x2a9dc2(0x261),'name':_0xb6226d[_0x2a9dc2(0x206)],'existingActivation':_0xb6226d});}return _0x387f96;}function calculateYamlDiff(_0x37543f,_0xb7bd9f){if(_0xb7bd9f){const _0x7a0cbd=generateDiff(_0xb7bd9f,_0x37543f),_0x3e20a2=hasChanges(_0x7a0cbd);return{'isNew':![],'hasChanges':_0x3e20a2,'diff':_0x3e20a2?formatDiffWithColors(_0x7a0cbd):undefined};}const _0x212eae=generateDiff('',_0x37543f);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x212eae)};}export function calculateSegmentDiff(_0x10514a,_0x4223df,_0x1a46a1,_0x17e89e,_0x278732){const _0x4b1b71=segmentToYamlString(_0x10514a),_0x1e5ceb=_0x4223df?segmentToYamlString(segmentWithActivationsToYaml(_0x4223df,_0x1a46a1,undefined,_0x17e89e,_0x278732)):undefined;return calculateYamlDiff(_0x4b1b71,_0x1e5ceb);}export function calculateJourneyDiff(_0x27e4e1,_0x4aa3c8){const _0x3b5c21=normalizeJourneyDef(_0x27e4e1,_0x27e4e1),_0x4955aa=a115_0x2c6f0e(_0x3b5c21),_0x23831f=_0x4aa3c8?a115_0x2c6f0e(normalizeJourneyDef(_0x4aa3c8,_0x27e4e1)):undefined;return calculateYamlDiff(_0x4955aa,_0x23831f);}export function findSegmentsToDelete(_0x14f181,_0x26fbe5,_0x32523a,_0x3f76f6,_0x14d286){const _0x2f6c48=a115_0x188509,_0x11e301=new Set();for(const {yamlConfig:_0x1f5bfd,folderPath:_0x3b710c}of _0x26fbe5){_0x11e301[_0x2f6c48(0x29d)](_0x3b710c+':'+_0x1f5bfd[_0x2f6c48(0x206)]);}return _0x14f181[_0x2f6c48(0x237)](_0x195ebc=>{const _0x40d00a=_0x2f6c48,_0x49b371=_0x195ebc['segmentFolderId']?_0x32523a[_0x40d00a(0x1e0)](_0x195ebc[_0x40d00a(0x26a)][_0x40d00a(0x1fe)]())||'':'',_0x4f736f=_0x49b371+':'+_0x195ebc['name'];if(_0x11e301[_0x40d00a(0x26e)](_0x4f736f))return![];if(_0x14d286)return _0x49b371===_0x3f76f6||_0x49b371[_0x40d00a(0x263)](_0x3f76f6+'/');return!![];});}export function findJourneysToDelete(_0xacf26f,_0x1a4631,_0x2588d6,_0x164695,_0x468689){const _0x2a3e12=a115_0x188509,_0x1892ba=new Set();for(const {yamlConfig:_0x253428,folderPath:_0x44eab6}of _0x1a4631){_0x1892ba[_0x2a3e12(0x29d)](_0x44eab6+':'+_0x253428[_0x2a3e12(0x206)]);}return _0xacf26f['filter'](_0x2024a4=>{const _0x37de84=_0x2a3e12,_0x888e4a=_0x2024a4['folderId']?_0x2588d6[_0x37de84(0x1e0)](_0x2024a4['folderId'])||'':'',_0x438490=_0x888e4a+':'+_0x2024a4[_0x37de84(0x294)];if(_0x1892ba[_0x37de84(0x26e)](_0x438490))return![];if(_0x468689)return _0x888e4a===_0x164695||_0x888e4a[_0x37de84(0x263)](_0x164695+'/');return!![];});}export function buildSegmentLookupMap(_0x18aedc,_0x25618b){const _0x54c4f5=a115_0x188509,_0x2bd708=new Map();for(const _0x2efc86 of _0x18aedc){const _0x4cc389=_0x2efc86[_0x54c4f5(0x26a)]?_0x25618b[_0x54c4f5(0x1e0)](_0x2efc86[_0x54c4f5(0x26a)][_0x54c4f5(0x1fe)]())||'':'',_0x33cc58=_0x4cc389+':'+_0x2efc86[_0x54c4f5(0x206)];_0x2bd708[_0x54c4f5(0x205)](_0x33cc58,_0x2efc86);}return _0x2bd708;}export function buildSegmentNameToIdMap(_0x1b38d0){const _0xf90d36=a115_0x188509,_0x351690=new Map();for(const _0x1a8380 of _0x1b38d0){_0x351690[_0xf90d36(0x205)](_0x1a8380[_0xf90d36(0x206)],_0x1a8380['id']);}return _0x351690;}export function buildJourneyBundleLookupMap(_0x2e59c4,_0xb14731){const _0x6cc297=a115_0x188509,_0x4d2e55=new Map();for(const _0x3aacfa of _0x2e59c4){const _0x24dbf6=_0x3aacfa['folderId']?_0xb14731['get'](_0x3aacfa['folderId'])||'':'',_0x5112a3=_0x24dbf6+':'+_0x3aacfa[_0x6cc297(0x294)];!_0x4d2e55[_0x6cc297(0x26e)](_0x5112a3)&&_0x4d2e55[_0x6cc297(0x205)](_0x5112a3,[]),_0x4d2e55[_0x6cc297(0x1e0)](_0x5112a3)[_0x6cc297(0x255)](_0x3aacfa);}for(const _0x47ca8d of _0x4d2e55['values']()){_0x47ca8d['sort']((_0x2ad73d,_0x40f0cb)=>(_0x2ad73d['versionNumber']||0x0)-(_0x40f0cb[_0x6cc297(0x244)]||0x0));}return _0x4d2e55;}export function collectFoldersToCreate(_0xe5b249,_0x23a66b){const _0x4a928e=a115_0x188509,_0x2eddcc=new Set();for(const _0x8abe9b of _0xe5b249){if(!_0x8abe9b)continue;if(_0x23a66b[_0x4a928e(0x26e)](_0x8abe9b))continue;const _0x151054=_0x8abe9b['split']('/');let _0x308819='';for(const _0x42da83 of _0x151054){_0x308819=_0x308819?_0x308819+'/'+_0x42da83:_0x42da83,!_0x23a66b[_0x4a928e(0x26e)](_0x308819)&&_0x2eddcc[_0x4a928e(0x29d)](_0x308819);}}return _0x2eddcc;}export function parseAndClassifyYamlFiles(_0x43866a,_0x44e2cb,_0x26e9fd){const _0x26a098=a115_0x188509,_0xebd802=[],_0x4b166f=[];for(const _0x534387 of _0x43866a){const _0x47d57c=a115_0x435f13[_0x26a098(0x266)](_0x44e2cb,a115_0x435f13[_0x26a098(0x253)](_0x534387)),_0x1d6e5f=_0x47d57c==='.'?'':_0x47d57c,_0x9dc4ba=readFileSync(_0x534387,_0x26a098(0x1ee)),_0xf1e755=a115_0x535900[_0x26a098(0x283)](_0x9dc4ba);if(isJourneyDef(_0xf1e755)){const _0x5657db=a115_0x3766b9(_0x9dc4ba);_0x4b166f[_0x26a098(0x255)]({'yamlConfig':_0x5657db,'folderPath':_0x1d6e5f,'sourcePath':_0x534387});}else{if(!_0x26e9fd?.[_0x26a098(0x28a)]){const _0x91b7f0=parseSegmentYamlFile(_0x9dc4ba),_0x2004cd=normalizeChildSegmentYaml(_0x91b7f0);_0xebd802[_0x26a098(0x255)]({'yamlConfig':_0x2004cd,'folderPath':_0x1d6e5f,'sourcePath':_0x534387});}}}return{'segments':_0xebd802,'journeys':_0x4b166f};}export function validateParsedFiles(_0x16c51a,_0x40a861){const _0xed3292=a115_0x188509,_0x44ea91=[];for(const {yamlConfig:_0x3d8474,sourcePath:_0x7d6183}of _0x16c51a[_0xed3292(0x202)]){const _0x4ae17f=readFileSync(_0x7d6183,_0xed3292(0x1ee)),_0x5832fe=a115_0x535900[_0xed3292(0x1ad)](_0x4ae17f),_0x37010a=validateSegmentDef(_0x3d8474,{'source':_0x4ae17f,'document':_0x5832fe});if(!_0x37010a['valid']){const _0x302d14=a115_0x435f13[_0xed3292(0x266)](_0x40a861,_0x7d6183);_0x44ea91['push']({'filePath':_0x302d14,'source':_0x4ae17f,'result':_0x37010a,'isJourney':![]});}}for(const {yamlConfig:_0x9d0f16,sourcePath:_0x137645}of _0x16c51a[_0xed3292(0x1c8)]){const _0x2550ec=readFileSync(_0x137645,'utf-8'),_0x22b084=a115_0x535900[_0xed3292(0x1ad)](_0x2550ec),_0x51b797=validateJourneyDef(_0x9d0f16,{'source':_0x2550ec,'document':_0x22b084});if(!_0x51b797[_0xed3292(0x1c3)]){const _0xa0a4fd=a115_0x435f13[_0xed3292(0x266)](_0x40a861,_0x137645);_0x44ea91[_0xed3292(0x255)]({'filePath':_0xa0a4fd,'source':_0x2550ec,'result':_0x51b797,'isJourney':!![]});}}return _0x44ea91;}export function formatValidationErrors(_0x2e4707){const _0x403d2b=a115_0x188509,_0x24ec44=[];for(const {filePath:_0xfb7ad9,source:_0x32108e,result:_0x2c3bf0,isJourney:_0x4a5781}of _0x2e4707){const _0x34cda0=_0x4a5781?_0x403d2b(0x215):_0x403d2b(0x1db);_0x24ec44[_0x403d2b(0x255)]('\x0a'+_0xfb7ad9+'\x20('+_0x34cda0+_0x403d2b(0x286)+_0x2c3bf0[_0x403d2b(0x2a4)][_0x403d2b(0x1f4)]+'\x20error(s)'),_0x24ec44[_0x403d2b(0x255)](formatValidationResult(_0x2c3bf0,_0x32108e,_0xfb7ad9));}return _0x24ec44['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x4fb65e){const _0xe09df7=a115_0x188509,_0x38d864=new Set(),_0x2d4de0=new Map(),_0x3a6ec3=collectSegmentUsageCounts(_0x4fb65e);if(_0x4fb65e[_0xe09df7(0x202)])for(const [_0x3fce9b,_0x523241]of Object['entries'](_0x4fb65e['segments'])){_0x38d864[_0xe09df7(0x29d)](_0x3fce9b);if(_0x523241[_0xe09df7(0x251)]){const _0x1c37f4=yamlRuleToApi(_0x523241[_0xe09df7(0x251)]),_0x47d161=apiRuleToYaml(_0x1c37f4);_0x2d4de0[_0xe09df7(0x205)](_0x3fce9b,_0x47d161);}}const _0x1dcb44=new Map();let _0x1c9ab4=0x0;for(const [_0x4d160e,_0x29805b]of _0x2d4de0){const _0x458c49=serializeExpandedRule(_0x29805b,_0x2d4de0),_0xe39a2d=_0x1dcb44[_0xe09df7(0x1e0)](_0x458c49)||[];_0xe39a2d['push']({'name':_0x4d160e,'index':_0x1c9ab4}),_0x1dcb44[_0xe09df7(0x205)](_0x458c49,_0xe39a2d),_0x1c9ab4++;}const _0x6010c4=new Map();for(const [_0x33165d,_0x249165]of _0x1dcb44){const _0x2c716b=_0x249165[_0xe09df7(0x238)]()[_0xe09df7(0x27b)]((_0x47840e,_0x4d7061)=>{const _0x2635dc=_0xe09df7,_0x1bb065=_0x3a6ec3[_0x2635dc(0x1e0)](_0x47840e['name'])||0x0,_0x2a7be9=_0x3a6ec3[_0x2635dc(0x1e0)](_0x4d7061[_0x2635dc(0x206)])||0x0;if(_0x1bb065!==_0x2a7be9)return _0x2a7be9-_0x1bb065;return _0x47840e[_0x2635dc(0x296)]-_0x4d7061[_0x2635dc(0x296)];})[_0xe09df7(0x287)](_0x36ab61=>_0x36ab61[_0xe09df7(0x206)]),_0x1229d5=[];for(const _0x11878e of _0x2c716b){const _0x280217=_0x3a6ec3['get'](_0x11878e)||0x0,_0x371bc3=Math['max'](_0x280217,0x1);for(let _0x18fd98=0x0;_0x18fd98<_0x371bc3;_0x18fd98++){_0x1229d5[_0xe09df7(0x255)](_0x11878e);}}_0x6010c4[_0xe09df7(0x205)](_0x33165d,_0x1229d5);}return{'existingLocalSegmentNames':_0x38d864,'localSegmentRules':_0x2d4de0,'localExpandedRuleToNames':_0x6010c4};}export function createSegmentIdResolver(_0x4bdd7e,_0x39a0d7){return async _0x1652bb=>{const _0x4f5467=a115_0x4469,_0x5ae81b=_0x4bdd7e[_0x4f5467(0x1e0)](_0x1652bb);if(!_0x5ae81b)throw new SDKError(ErrorCode[_0x4f5467(0x26f)],'Segment\x20not\x20found:\x20'+_0x1652bb+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x39a0d7+'\x27)');return _0x5ae81b;};}export function extractRootFolderId(_0x48ae65){const _0x1a6318=a115_0x188509;return _0x48ae65[_0x1a6318(0x200)]?.[_0x1a6318(0x1d2)]?.[_0x1a6318(0x1de)]?.['id']||_0x48ae65['relationships']?.['parentFolder']?.[_0x1a6318(0x1de)]?.['id'];}export function buildConnectionMaps(_0x5333e1){const _0x40f361=a115_0x188509,_0xe8ef60=new Map(),_0x29a431=new Map(),_0x37f7a4=new Map();for(const _0x175fc2 of _0x5333e1){_0xe8ef60[_0x40f361(0x205)](_0x175fc2[_0x40f361(0x206)],parseInt(_0x175fc2['id'],0xa)),_0x29a431[_0x40f361(0x205)](_0x175fc2['id'],_0x175fc2[_0x40f361(0x206)]),_0x37f7a4[_0x40f361(0x205)](_0x175fc2[_0x40f361(0x206)],_0x175fc2[_0x40f361(0x231)]);}return{'nameToId':_0xe8ef60,'idToName':_0x29a431,'nameToType':_0x37f7a4};}export function calculatePushStats(_0x327692,_0x510c39,_0x1740a4,_0x46dc1e,_0x4cd5b8,_0x21274a,_0x4d4fb1){const _0x4aff35=a115_0x188509,_0x3a889e=_0x327692['filter'](_0x3e8ad9=>_0x3e8ad9['isNew']),_0x4c42fb=_0x327692[_0x4aff35(0x237)](_0x19d07f=>!_0x19d07f[_0x4aff35(0x21d)]&&_0x19d07f[_0x4aff35(0x26c)]),_0x4e6f65=_0x327692[_0x4aff35(0x237)](_0x3aad74=>!_0x3aad74[_0x4aff35(0x21d)]&&!_0x3aad74[_0x4aff35(0x26c)]),_0x24ba8f=_0x21274a?_0x46dc1e:[],_0x4e25a7=_0x510c39['filter'](_0x222dda=>_0x222dda[_0x4aff35(0x21d)]),_0x2a60e9=_0x510c39[_0x4aff35(0x237)](_0x1f3a37=>!_0x1f3a37['isNew']&&_0x1f3a37['hasChanges']),_0x240c3a=_0x510c39['filter'](_0x5f0bcc=>!_0x5f0bcc[_0x4aff35(0x21d)]&&!_0x5f0bcc[_0x4aff35(0x26c)]),_0xe7e4d8=_0x21274a?_0x4cd5b8:[],_0x211d48=_0x327692['flatMap'](_0x11a0d5=>_0x11a0d5[_0x4aff35(0x1a9)]),_0x1dae07=_0x211d48['filter'](_0x400e2b=>_0x400e2b[_0x4aff35(0x231)]===_0x4aff35(0x1ec)),_0x4a9003=_0x211d48[_0x4aff35(0x237)](_0x580ede=>_0x580ede[_0x4aff35(0x231)]===_0x4aff35(0x289)),_0x22072e=_0x211d48[_0x4aff35(0x237)](_0x20fccd=>_0x20fccd[_0x4aff35(0x231)]===_0x4aff35(0x261)),_0x465edd=Array[_0x4aff35(0x1dc)](_0x1740a4)[_0x4aff35(0x27b)](),_0x1c64c8=_0x4d4fb1?![]:_0x3a889e['length']>0x0||_0x4c42fb[_0x4aff35(0x1f4)]>0x0||_0x24ba8f[_0x4aff35(0x1f4)]>0x0,_0x27646d=_0x4e25a7[_0x4aff35(0x1f4)]>0x0||_0x2a60e9[_0x4aff35(0x1f4)]>0x0||_0xe7e4d8[_0x4aff35(0x1f4)]>0x0,_0x2c2ff5=_0x4d4fb1?![]:_0x211d48[_0x4aff35(0x1f4)]>0x0,_0x43e655=_0x465edd[_0x4aff35(0x1f4)]>0x0;return{'segments':{'new':_0x3a889e,'changed':_0x4c42fb,'unchanged':_0x4e6f65,'toDelete':_0x24ba8f},'journeys':{'new':_0x4e25a7,'changed':_0x2a60e9,'unchanged':_0x240c3a,'toDelete':_0xe7e4d8},'activations':{'all':_0x211d48,'toCreate':_0x1dae07,'toUpdate':_0x4a9003,'toDelete':_0x22072e},'folders':{'toCreate':_0x465edd},'counts':{'segments':{'new':_0x3a889e[_0x4aff35(0x1f4)],'changed':_0x4c42fb[_0x4aff35(0x1f4)],'unchanged':_0x4e6f65['length'],'toDelete':_0x24ba8f[_0x4aff35(0x1f4)]},'journeys':{'new':_0x4e25a7['length'],'changed':_0x2a60e9[_0x4aff35(0x1f4)],'unchanged':_0x240c3a[_0x4aff35(0x1f4)],'toDelete':_0xe7e4d8[_0x4aff35(0x1f4)]},'activations':{'create':_0x1dae07[_0x4aff35(0x1f4)],'update':_0x4a9003['length'],'delete':_0x22072e[_0x4aff35(0x1f4)]},'folders':_0x465edd[_0x4aff35(0x1f4)]},'hasChanges':_0x1c64c8||_0x27646d||_0x2c2ff5||_0x43e655};}export async function buildPushExecutionContext(_0x3f84c8,_0x30ec00,_0x288c1d,_0x361478,_0x2d206f,_0x534705){const _0x3abd23=a115_0x188509,_0x3b4e7e=extractRootFolderId(_0x288c1d),{pathToId:_0x42f1fb,idToPath:_0x48e5bb}=buildFolderMaps(_0x2d206f),_0x3ed63f=buildSegmentNameToIdMap(_0x361478),_0x4cdc25=new Map(),{batchAsync:_0x1486c1}=await import('../../utils/async.js'),[_0x16d8c1,_0x4eea0d]=await Promise[_0x3abd23(0x24b)]([_0x3f84c8[_0x3abd23(0x23e)][_0x3abd23(0x27c)](),_0x3f84c8[_0x3abd23(0x22c)][_0x3abd23(0x1b6)](),((async()=>{const _0x13fed4=_0x3abd23;!_0x534705&&_0x361478[_0x13fed4(0x1f4)]>0x0&&await _0x1486c1(_0x361478,async _0x552d87=>{const _0x13be2c=_0x13fed4,_0x583095=await _0x3f84c8[_0x13be2c(0x1db)][_0x13be2c(0x1d8)](_0x30ec00,_0x552d87['id']);_0x4cdc25[_0x13be2c(0x205)](_0x552d87['id'],_0x583095);});})())]),{emailToId:_0x495320,idToEmail:_0x385477}=_0x16d8c1,_0x546e0c=buildConnectionMaps(_0x4eea0d);return{'rootFolderId':_0x3b4e7e,'folderPathToId':_0x42f1fb,'folderIdToPath':_0x48e5bb,'segmentNameToId':_0x3ed63f,'activationsBySegmentId':_0x4cdc25,'emailToIdMap':_0x495320,'idToEmailMap':_0x385477,'connectionNameToIdMap':_0x546e0c[_0x3abd23(0x1b5)],'connectionIdToNameMap':_0x546e0c[_0x3abd23(0x27f)],'connectionNameToTypeMap':_0x546e0c['nameToType']};}export function createPushYamlContextForBundle(_0x56f358,_0x498a74,_0x1c1db3,_0x3e4895,_0x1cf097,_0x318e3b,_0x2d359d,_0x351e46){const {existingLocalSegmentNames:_0x4c7082,localExpandedRuleToNames:_0x579241}=_0x3e4895,_0x2e72ab=new Set(),_0x1629fd=new Map(),_0x4a97ea=new Map(),_0x196077=new Map(),_0x4ee473=createJumpTargetCache(),_0x1abb87=new Map(),_0x28f0c0=new Map(),_0x2c4205=new Set();let _0x4ede6c;const _0x571065=_0x32de10=>{const _0x368071={'resolveSegment':async _0x4e7c2c=>{const _0x5cdd16=a115_0x4469,_0x4ac1cb=_0x196077[_0x5cdd16(0x1e0)](_0x4e7c2c);if(_0x4ac1cb!==undefined)return{'name':_0x4ac1cb,'isJourneyLocal':!![]};try{const _0x3d18e4=await fetchSegment(_0x56f358,_0x498a74,_0x4e7c2c,_0x1c1db3);if(!_0x3d18e4)throw new Error(_0x5cdd16(0x26b));const _0x4ab0cc=generateJourneyLocalName(_0x3d18e4[_0x5cdd16(0x206)]),_0x175fcb=_0x3d18e4[_0x5cdd16(0x247)]===SEGMENT_KIND_JOURNEY&&_0x4ab0cc!==undefined;let _0x5507e4=_0x3d18e4[_0x5cdd16(0x206)],_0x314b49;if(_0x175fcb&&_0x3d18e4[_0x5cdd16(0x251)]){const _0x38025c=apiRuleToYaml(_0x3d18e4[_0x5cdd16(0x251)]);_0x28f0c0['set'](_0x4e7c2c,_0x38025c);const _0x14c801=async _0x53fb98=>{const _0x46ab5c=_0x5cdd16,_0x2b272d=collectSegmentRefsFromRule(_0x53fb98);for(const _0x3e34fa of _0x2b272d){if(!_0x28f0c0[_0x46ab5c(0x26e)](_0x3e34fa))try{const _0x4c697b=await fetchSegment(_0x56f358,_0x498a74,_0x3e34fa,_0x1c1db3);if(_0x4c697b?.['rule']){const _0x406a36=apiRuleToYaml(_0x4c697b[_0x46ab5c(0x251)]);_0x28f0c0[_0x46ab5c(0x205)](_0x3e34fa,_0x406a36),await _0x14c801(_0x406a36);}}catch(_0x5b4854){logger[_0x46ab5c(0x207)]('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0x3e34fa+':\x20'+_0x5b4854);}}};await _0x14c801(_0x38025c);const _0x42b630=serializeExpandedRule(_0x38025c,_0x28f0c0),_0x25397a=_0x579241[_0x5cdd16(0x1e0)](_0x42b630);if(_0x25397a&&_0x25397a[_0x5cdd16(0x1f4)]>0x0){const _0x35a2a0=_0x1629fd[_0x5cdd16(0x1e0)](_0x42b630)||0x0,_0x282bfe=_0x25397a[_0x35a2a0]||_0x25397a[_0x25397a[_0x5cdd16(0x1f4)]-0x1];_0x1629fd[_0x5cdd16(0x205)](_0x42b630,_0x35a2a0+0x1),_0x5507e4=_0x282bfe,_0x2e72ab[_0x5cdd16(0x29d)](_0x5507e4),_0x196077[_0x5cdd16(0x205)](_0x4e7c2c,_0x5507e4);const _0x51c8ab=await resolveRuleSegmentRefs(_0x38025c,async _0xfeee3b=>{const _0x187eea=_0x5cdd16,_0x4cf04f=_0x196077[_0x187eea(0x1e0)](_0xfeee3b);if(_0x4cf04f)return _0x4cf04f;const _0x362fcf=await _0x4ede6c[_0x187eea(0x1a6)](_0xfeee3b);return _0x362fcf['name'];});_0x314b49={'description':_0x3d18e4[_0x5cdd16(0x1b7)],'rule':_0x51c8ab};}else{const _0x126664=_0x1abb87[_0x5cdd16(0x1e0)](_0x42b630);if(_0x126664)_0x5507e4=_0x126664,_0x196077[_0x5cdd16(0x205)](_0x4e7c2c,_0x5507e4);else{if(_0x4ab0cc){let _0x13f3af=_0x4ab0cc,_0x2302cc=0x2;while(_0x2e72ab[_0x5cdd16(0x26e)](_0x13f3af)||_0x4c7082[_0x5cdd16(0x26e)](_0x13f3af)){_0x13f3af=_0x4ab0cc+'_'+_0x2302cc,_0x2302cc++;}_0x2e72ab[_0x5cdd16(0x29d)](_0x13f3af),_0x5507e4=_0x13f3af;}_0x196077[_0x5cdd16(0x205)](_0x4e7c2c,_0x5507e4),_0x1abb87['set'](_0x42b630,_0x5507e4);const _0x497820=await resolveRuleSegmentRefs(_0x38025c,async _0x3bfb70=>{const _0x33d02=_0x5cdd16,_0x5669ee=_0x196077[_0x33d02(0x1e0)](_0x3bfb70);if(_0x5669ee)return _0x5669ee;const _0x491bbb=await _0x4ede6c[_0x33d02(0x1a6)](_0x3bfb70);return _0x491bbb[_0x33d02(0x206)];});_0x314b49={'description':_0x3d18e4['description'],'rule':_0x497820};}}}return{'name':_0x5507e4,'isJourneyLocal':_0x175fcb,'definition':_0x314b49};}catch(_0x24d466){return logger[_0x5cdd16(0x207)]('Failed\x20to\x20resolve\x20segment\x20'+_0x4e7c2c+':\x20'+_0x24d466),{'name':_0x4e7c2c,'isJourneyLocal':![]};}},'resolveActivation':async _0x3f776e=>{const _0x2cb021=a115_0x4469,_0x36f84d=_0x4a97ea[_0x2cb021(0x1e0)](_0x3f776e);if(_0x36f84d!==undefined)return{'name':_0x36f84d,'isJourneyLocal':!![]};try{let _0xb30338=_0x2d359d?.[_0x2cb021(0x1e0)](_0x3f776e);!_0xb30338&&(_0xb30338=await _0x56f358[_0x2cb021(0x215)][_0x2cb021(0x29f)](_0x32de10,_0x3f776e));const _0x4ff9c7=_0xb30338[_0x2cb021(0x1ff)]['activationParams'][_0x2cb021(0x206)]||_0x3f776e,_0x4e9563=sanitizeYamlKey(_0x4ff9c7)||_0x2cb021(0x1c7)+_0x3f776e,_0x42bc6f=_0x4e9563;_0x4a97ea[_0x2cb021(0x205)](_0x3f776e,_0x42bc6f);const _0x5fbd13=journeyActivationStepToYaml(_0xb30338,_0x1cf097,_0x318e3b);return{'name':_0x42bc6f,'isJourneyLocal':!![],'definition':_0x5fbd13};}catch(_0xfedf81){return logger[_0x2cb021(0x207)](_0x2cb021(0x22e)+_0x3f776e+':\x20'+_0xfedf81),{'name':_0x3f776e,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x342ecb,_0xd008be)=>resolveJumpTarget(_0x342ecb,_0xd008be,_0x4ee473,async _0x3d6cb8=>{const _0x289ac7=a115_0x4469,_0x3b1989=_0x351e46?.[_0x289ac7(0x1e0)](_0x3d6cb8);if(_0x3b1989)return _0x3b1989;return _0x56f358[_0x289ac7(0x215)][_0x289ac7(0x223)](_0x3d6cb8);})};return _0x4ede6c=_0x368071,_0x368071;},_0x31fbfb=async _0x23851a=>{const _0x1d3446=a115_0x4469,{collectSegmentIdsFromJourneyApi:_0x4e7096}=await import(_0x1d3446(0x1ac)),{batchAsync:_0x2f0353}=await import(_0x1d3446(0x273)),_0x21fef6=new Set();for(const _0x17807e of _0x23851a){let _0x3f978e=_0x351e46?.['get'](_0x17807e);!_0x3f978e&&(_0x3f978e=await _0x56f358[_0x1d3446(0x215)]['getJourney'](_0x17807e));const _0x4e4d46=_0x4e7096(_0x3f978e);for(const _0x389b87 of _0x4e4d46){_0x21fef6[_0x1d3446(0x29d)](_0x389b87);}}let _0x1be6f0=Array['from'](_0x21fef6);while(_0x1be6f0[_0x1d3446(0x1f4)]>0x0){const _0x5a4c03=_0x1be6f0['filter'](_0x21ac38=>!_0x2c4205[_0x1d3446(0x26e)](_0x21ac38));if(_0x5a4c03[_0x1d3446(0x1f4)]===0x0)break;const _0x4c5f1b=await _0x2f0353(_0x5a4c03,async _0x3d4448=>{_0x2c4205['add'](_0x3d4448);const _0x51c518=await fetchSegment(_0x56f358,_0x498a74,_0x3d4448,_0x1c1db3);if(!_0x51c518)return null;return{'segmentId':_0x3d4448,'segment':_0x51c518};},0xa),_0x5b529f=new Set();for(const _0x4d5c86 of _0x4c5f1b){if(!_0x4d5c86?.[_0x1d3446(0x1db)]?.['rule'])continue;const _0x4d0dcb=apiRuleToYaml(_0x4d5c86['segment'][_0x1d3446(0x251)]);_0x28f0c0[_0x1d3446(0x205)](_0x4d5c86[_0x1d3446(0x291)],_0x4d0dcb);const _0x2769a6=collectSegmentRefsFromRule(_0x4d0dcb);for(const _0x5f38a1 of _0x2769a6){!_0x2c4205['has'](_0x5f38a1)&&_0x5b529f['add'](_0x5f38a1);}}_0x1be6f0=Array['from'](_0x5b529f);}};return{'createYamlContext':_0x571065,'prefetchJourneySegments':_0x31fbfb};}export async function executePushSegments(_0x13a14f,_0xc302a5,_0x9f51e7,_0x505d2d,_0x16b376){const _0x273e9b=a115_0x188509,{segmentDefToCreateRequest:_0x50db3c,segmentDefToUpdateRequest:_0x37f5b1}=await import(_0x273e9b(0x1b9)),_0x26f9fd=_0x9f51e7['folderPathToId'],_0x3c7095=0x5,_0x291266=async _0x2fec78=>{const _0x1bb9ac=_0x273e9b,_0x2a8dfc=_0x2fec78[_0x1bb9ac(0x1d5)]?_0x26f9fd[_0x1bb9ac(0x1e0)](_0x2fec78['folderPath']):undefined;let _0x3a59a1;const _0x256276={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};try{if(_0x2fec78[_0x1bb9ac(0x21d)]){_0x16b376[_0x1bb9ac(0x23d)]?.({'type':_0x1bb9ac(0x1bb),'name':_0x2fec78[_0x1bb9ac(0x211)][_0x1bb9ac(0x206)]});const _0x4c4722=_0x50db3c(_0x2fec78[_0x1bb9ac(0x211)],_0x2a8dfc),_0x3a7d53=await _0x16b376[_0x1bb9ac(0x21e)](_0x1bb9ac(0x27d)+_0x2fec78[_0x1bb9ac(0x211)][_0x1bb9ac(0x206)]+'\x27...',()=>_0x13a14f[_0x1bb9ac(0x1db)][_0x1bb9ac(0x249)](_0x505d2d[_0x1bb9ac(0x210)],_0x4c4722));_0x3a59a1=_0x3a7d53[_0x1bb9ac(0x1de)]['id'],_0x256276[_0x1bb9ac(0x1dd)]={'name':_0x2fec78[_0x1bb9ac(0x211)][_0x1bb9ac(0x206)],'id':_0x3a59a1},_0x16b376[_0x1bb9ac(0x23d)]?.({'type':_0x1bb9ac(0x258),'name':_0x2fec78['yamlConfig'][_0x1bb9ac(0x206)],'segmentId':_0x3a59a1}),_0x16b376['logSuccess']?.(_0x1bb9ac(0x1aa)+_0x2fec78[_0x1bb9ac(0x211)][_0x1bb9ac(0x206)]+'\x27'),_0x256276[_0x1bb9ac(0x25d)]=0x1;}else{if(_0x2fec78[_0x1bb9ac(0x26c)]){_0x16b376[_0x1bb9ac(0x23d)]?.({'type':_0x1bb9ac(0x20d),'name':_0x2fec78[_0x1bb9ac(0x211)]['name']});const _0x185a15=_0x37f5b1(_0x2fec78['yamlConfig']);_0x2a8dfc!==_0x2fec78['existingSegment']?.['segmentFolderId']&&(_0x185a15[_0x1bb9ac(0x26a)]=_0x2a8dfc?parseInt(_0x2a8dfc,0xa):undefined),await _0x16b376[_0x1bb9ac(0x21e)](_0x1bb9ac(0x209)+_0x2fec78[_0x1bb9ac(0x211)]['name']+_0x1bb9ac(0x235),()=>_0x13a14f[_0x1bb9ac(0x1db)][_0x1bb9ac(0x28f)](_0x505d2d[_0x1bb9ac(0x210)],_0x2fec78['existingSegment']['id'],_0x185a15)),_0x3a59a1=_0x2fec78[_0x1bb9ac(0x1b3)]['id'],_0x16b376[_0x1bb9ac(0x23d)]?.({'type':_0x1bb9ac(0x25a),'name':_0x2fec78[_0x1bb9ac(0x211)][_0x1bb9ac(0x206)]}),_0x16b376['logSuccess']?.(_0x1bb9ac(0x201)+_0x2fec78[_0x1bb9ac(0x211)][_0x1bb9ac(0x206)]+'\x27'),_0x256276[_0x1bb9ac(0x243)]=0x1;}else _0x3a59a1=_0x2fec78['existingSegment']['id'];}}catch(_0x91007f){const _0xd277ca=isHttp400Error(_0x91007f),_0x433ff0=_0xd277ca?ErrorCode[_0x1bb9ac(0x1df)]:ErrorCode[_0x1bb9ac(0x245)],_0x49bc9d=getErrorMessage(_0x91007f);throw new SDKError(_0x433ff0,'Failed\x20to\x20'+(_0x2fec78[_0x1bb9ac(0x21d)]?_0x1bb9ac(0x1ec):_0x1bb9ac(0x289))+_0x1bb9ac(0x240)+_0x2fec78[_0x1bb9ac(0x1d4)]+_0x1bb9ac(0x23f)+_0x49bc9d,_0x91007f);}try{const _0x1fafd0=await syncActivationsForSegment(_0x13a14f,_0x505d2d['parentId'],_0x3a59a1,_0x2fec78[_0x1bb9ac(0x211)][_0x1bb9ac(0x206)],_0x2fec78[_0x1bb9ac(0x1a9)],_0x16b376,_0x2fec78['absolutePath']);_0x256276[_0x1bb9ac(0x267)]=_0x1fafd0;}catch(_0x20bac4){if(_0x20bac4 instanceof SDKError)throw _0x20bac4;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x2fec78[_0x1bb9ac(0x211)][_0x1bb9ac(0x206)]+_0x1bb9ac(0x27a)+_0x2fec78['absolutePath']+_0x1bb9ac(0x23f)+getErrorMessage(_0x20bac4),_0x20bac4);}return _0x256276;},_0x3bc989=await batchAsync(_0xc302a5,_0x291266,_0x3c7095),_0x180a4b={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x557d5c of _0x3bc989){_0x180a4b[_0x273e9b(0x25d)]+=_0x557d5c[_0x273e9b(0x25d)],_0x180a4b[_0x273e9b(0x243)]+=_0x557d5c[_0x273e9b(0x243)],_0x557d5c['createdSegmentId']&&_0x180a4b['createdSegmentIds'][_0x273e9b(0x205)](_0x557d5c['createdSegmentId'][_0x273e9b(0x206)],_0x557d5c[_0x273e9b(0x1dd)]['id']),_0x180a4b[_0x273e9b(0x267)][_0x273e9b(0x25d)]+=_0x557d5c['activations'][_0x273e9b(0x25d)],_0x180a4b['activations'][_0x273e9b(0x243)]+=_0x557d5c[_0x273e9b(0x267)][_0x273e9b(0x243)],_0x180a4b['activations'][_0x273e9b(0x265)]+=_0x557d5c[_0x273e9b(0x267)][_0x273e9b(0x265)];}return _0x180a4b;}async function syncActivationsForSegment(_0x5b5d0b,_0x4c1a6c,_0x5c3237,_0x1970e8,_0x33c887,_0x5b450e,_0x2545ae){const _0x4dbd33=a115_0x188509,_0x14938b={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x35bf85 of _0x33c887){try{if(_0x35bf85[_0x4dbd33(0x231)]===_0x4dbd33(0x1ec)&&_0x35bf85['validatedRequest'])_0x5b450e[_0x4dbd33(0x23d)]?.({'type':_0x4dbd33(0x2a1),'segmentName':_0x1970e8,'activationName':_0x35bf85['name']}),await _0x5b450e[_0x4dbd33(0x21e)](_0x4dbd33(0x1ae)+_0x35bf85['name']+_0x4dbd33(0x235),()=>_0x5b5d0b[_0x4dbd33(0x1db)][_0x4dbd33(0x1af)](_0x4c1a6c,_0x5c3237,_0x35bf85['validatedRequest'])),_0x5b450e['onProgress']?.({'type':_0x4dbd33(0x1e6),'segmentName':_0x1970e8,'activationName':_0x35bf85[_0x4dbd33(0x206)]}),_0x5b450e['logSuccess']?.(_0x4dbd33(0x203)+_0x35bf85[_0x4dbd33(0x206)]+'\x27'),_0x14938b[_0x4dbd33(0x25d)]++;else{if(_0x35bf85[_0x4dbd33(0x231)]===_0x4dbd33(0x289)&&_0x35bf85[_0x4dbd33(0x1da)]&&_0x35bf85[_0x4dbd33(0x1c4)])_0x5b450e['onProgress']?.({'type':_0x4dbd33(0x279),'segmentName':_0x1970e8,'activationName':_0x35bf85['name']}),await _0x5b450e['withProgress'](_0x4dbd33(0x1fd)+_0x35bf85[_0x4dbd33(0x206)]+_0x4dbd33(0x235),()=>_0x5b5d0b['segment'][_0x4dbd33(0x1c2)](_0x4c1a6c,_0x5c3237,_0x35bf85[_0x4dbd33(0x1c4)]['id'],_0x35bf85[_0x4dbd33(0x1da)])),_0x5b450e['onProgress']?.({'type':_0x4dbd33(0x234),'segmentName':_0x1970e8,'activationName':_0x35bf85['name']}),_0x5b450e[_0x4dbd33(0x224)]?.(_0x4dbd33(0x1cc)+_0x35bf85[_0x4dbd33(0x206)]+'\x27'),_0x14938b['updated']++;else _0x35bf85[_0x4dbd33(0x231)]===_0x4dbd33(0x261)&&_0x35bf85[_0x4dbd33(0x1c4)]&&(_0x5b450e[_0x4dbd33(0x23d)]?.({'type':_0x4dbd33(0x218),'segmentName':_0x1970e8,'activationName':_0x35bf85['name']}),await _0x5b450e[_0x4dbd33(0x21e)]('Deleting\x20activation\x20\x27'+_0x35bf85[_0x4dbd33(0x206)]+_0x4dbd33(0x235),()=>_0x5b5d0b[_0x4dbd33(0x1db)][_0x4dbd33(0x1b0)](_0x4c1a6c,_0x5c3237,_0x35bf85['existingActivation']['id'])),_0x5b450e[_0x4dbd33(0x23d)]?.({'type':_0x4dbd33(0x2a3),'segmentName':_0x1970e8,'activationName':_0x35bf85[_0x4dbd33(0x206)]}),_0x5b450e[_0x4dbd33(0x271)]?.(_0x4dbd33(0x219)+_0x35bf85[_0x4dbd33(0x206)]+'\x27'),_0x14938b[_0x4dbd33(0x265)]++);}}catch(_0x156342){const _0x10a3bd=isHttp400Error(_0x156342),_0x2c3564=_0x10a3bd?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0x4dbd33(0x1fc)],_0x1da81f=getErrorMessage(_0x156342);throw new SDKError(_0x2c3564,_0x4dbd33(0x2a2)+_0x35bf85['type']+'\x20activation\x20\x27'+_0x35bf85[_0x4dbd33(0x206)]+_0x4dbd33(0x27a)+_0x2545ae+'\x0a\x20\x20'+_0x1da81f,_0x156342);}}return _0x14938b;}function a115_0x4469(_0x46aa33,_0x3e652a){_0x46aa33=_0x46aa33-0x1a2;const _0x35b73e=a115_0x35b7();let _0x4469be=_0x35b73e[_0x46aa33];return _0x4469be;}export async function executePushFolders(_0x472956,_0x34835a,_0x326b94,_0x4e030c,_0x43cf4c){const _0x99265d=a115_0x188509,_0x54e0e8=new Map(_0x326b94);for(const _0xd60d72 of _0x34835a){const _0x532eb4=_0xd60d72[_0x99265d(0x216)]('/'),_0x6263b5=_0x532eb4[_0x532eb4[_0x99265d(0x1f4)]-0x1],_0x2faccf=_0x532eb4['slice'](0x0,-0x1)['join']('/'),_0x51d3b5=_0x54e0e8[_0x99265d(0x1e0)](_0x2faccf);_0x43cf4c[_0x99265d(0x23d)]?.({'type':_0x99265d(0x21b),'folder':_0xd60d72});const _0x4bf171={'name':_0x6263b5,'parentFolderId':_0x51d3b5},_0x16bf1c=await _0x43cf4c['withProgress'](_0x99265d(0x248)+_0xd60d72+_0x99265d(0x235),()=>_0x472956['segment'][_0x99265d(0x232)](_0x4e030c['parentId'],_0x4bf171));_0x54e0e8['set'](_0xd60d72,_0x16bf1c[_0x99265d(0x1de)]['id']),_0x43cf4c['onProgress']?.({'type':_0x99265d(0x214),'folder':_0xd60d72,'folderId':_0x16bf1c[_0x99265d(0x1de)]['id']}),_0x43cf4c[_0x99265d(0x1ce)]?.('Created\x20folder\x20\x27'+_0xd60d72+'\x27');}return _0x54e0e8;}export async function executePushSegmentDeletions(_0x38576f,_0x4c971f,_0x522a67){const _0x561b19=a115_0x188509;if(_0x4c971f[_0x561b19(0x1f4)]===0x0)return 0x0;const {batchAsync:_0x41f60c}=await import('../../utils/async.js'),_0x5687cc=0x5,_0x51e65c=await _0x41f60c(_0x4c971f,async _0x5b3daf=>{const _0x43027f=_0x561b19;return _0x522a67[_0x43027f(0x23d)]?.({'type':'segment_deleting','name':_0x5b3daf['name']}),await _0x38576f['segment'][_0x43027f(0x226)](_0x5b3daf['id']),_0x522a67[_0x43027f(0x23d)]?.({'type':_0x43027f(0x1e9),'name':_0x5b3daf['name']}),_0x522a67[_0x43027f(0x271)]?.(_0x43027f(0x1e5)+_0x5b3daf[_0x43027f(0x206)]+'\x27'),0x1;},_0x5687cc);return _0x51e65c[_0x561b19(0x297)]((_0x1ce6e0,_0x49e4ba)=>_0x1ce6e0+_0x49e4ba,0x0);}export async function executePushJourneys(_0x24b23f,_0x4ed379,_0x302e82,_0x2a57cb,_0x50605b){const _0x4fcc89=a115_0x188509,{journeyDefToRequest:_0x1aed4c}=await import(_0x4fcc89(0x1ac)),{activationDefToCreateRequest:_0x3af413,yamlRuleToApi:_0x4f954c,validateSegmentRule:_0x49a8aa}=await import(_0x4fcc89(0x1b9)),_0x25c0a5={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x31c5e7=new Map(_0x302e82[_0x4fcc89(0x236)]),_0x26c172=0x5;for(let _0xc89308=0x0;_0xc89308<_0x4ed379[_0x4fcc89(0x1f4)];_0xc89308+=_0x26c172){const _0x4f4f3b=_0x4ed379[_0x4fcc89(0x238)](_0xc89308,_0xc89308+_0x26c172),_0x4a3175=await Promise[_0x4fcc89(0x24b)](_0x4f4f3b[_0x4fcc89(0x287)](async _0x4f449b=>{const _0x380799=_0x4fcc89;if(!_0x4f449b[_0x380799(0x21d)]&&!_0x4f449b[_0x380799(0x26c)])return{'action':_0x380799(0x1f6),'name':_0x4f449b['yamlConfig'][_0x380799(0x206)],'journeyId':_0x4f449b[_0x380799(0x1f0)]?.['id']};const _0x219ac1=_0x4f449b[_0x380799(0x1d5)]?_0x302e82[_0x380799(0x270)]['get'](_0x4f449b[_0x380799(0x1d5)]):undefined;_0x50605b[_0x380799(0x23d)]?.({'type':_0x4f449b[_0x380799(0x21d)]?_0x380799(0x22b):_0x380799(0x217),'name':_0x4f449b['yamlConfig'][_0x380799(0x206)]});try{const _0x5c0f81=await executeSingleJourneyPush(_0x24b23f,_0x4f449b,{..._0x302e82,'segmentNameToId':_0x31c5e7},{'parentId':_0x2a57cb['parentId'],'rootFolderId':_0x2a57cb[_0x380799(0x256)],'folderId':_0x219ac1,'verbose':_0x2a57cb['verbose']},_0x50605b,{'journeyDefToRequest':_0x1aed4c,'activationDefToCreateRequest':_0x3af413,'yamlRuleToApi':_0x4f954c,'validateSegmentRule':_0x49a8aa});for(const [_0x1ebb69,_0x1cdcaa]of _0x5c0f81[_0x380799(0x229)]){_0x31c5e7['set'](_0x1ebb69,_0x1cdcaa),_0x25c0a5['embeddedSegmentNameToId'][_0x380799(0x205)](_0x1ebb69,_0x1cdcaa);}if(_0x5c0f81['action']===_0x380799(0x25d))_0x50605b[_0x380799(0x23d)]?.({'type':_0x380799(0x1e3),'name':_0x4f449b[_0x380799(0x211)][_0x380799(0x206)],'journeyId':_0x5c0f81['journeyId']}),_0x50605b['logSuccess']?.(_0x380799(0x230)+_0x4f449b[_0x380799(0x211)][_0x380799(0x206)]+'\x27'),_0x25c0a5[_0x380799(0x25d)]++;else _0x5c0f81[_0x380799(0x29a)]===_0x380799(0x243)&&(_0x50605b[_0x380799(0x23d)]?.({'type':_0x380799(0x27e),'name':_0x4f449b[_0x380799(0x211)][_0x380799(0x206)]}),_0x50605b[_0x380799(0x224)]?.(_0x380799(0x262)+_0x4f449b[_0x380799(0x211)][_0x380799(0x206)]+'\x27'),_0x25c0a5[_0x380799(0x243)]++);return{'action':_0x5c0f81[_0x380799(0x29a)],'name':_0x4f449b[_0x380799(0x211)]['name'],'journeyId':_0x5c0f81[_0x380799(0x1d9)]};}catch(_0x46a4bc){const _0x5227bf=isHttp400Error(_0x46a4bc),_0x519d7c=_0x5227bf?ErrorCode[_0x380799(0x204)]:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x568e72=getErrorMessage(_0x46a4bc);throw new SDKError(_0x519d7c,_0x380799(0x2a2)+(_0x4f449b['isNew']?_0x380799(0x1ec):'update')+_0x380799(0x26d)+_0x4f449b[_0x380799(0x1d4)]+_0x380799(0x23f)+_0x568e72,_0x46a4bc);}}));_0x25c0a5[_0x4fcc89(0x24e)][_0x4fcc89(0x255)](..._0x4a3175);}return _0x25c0a5;}async function matchExistingJourneySegments(_0x55cbcf,_0xf6d9b3,_0x239c17,_0x37d397,_0x3512c5){const _0x599a06=a115_0x188509;if(!_0xf6d9b3[_0x599a06(0x1f0)]||!_0xf6d9b3[_0x599a06(0x211)][_0x599a06(0x202)])return;const _0x43093f=new Map();for(const _0x510ab2 of Object[_0x599a06(0x233)](_0xf6d9b3[_0x599a06(0x211)][_0x599a06(0x202)])){const _0x32e622=generateDeterministicJourneySegmentName(_0xf6d9b3[_0x599a06(0x211)][_0x599a06(0x206)],_0x510ab2);_0x43093f[_0x599a06(0x205)](_0x32e622,_0x510ab2);}const _0x16d8a7=collectSegmentIdsFromJourneyApi(_0xf6d9b3[_0x599a06(0x1f0)]);for(const _0x341ca6 of _0x16d8a7){const _0x41e402=await fetchSegment(_0x55cbcf,_0x239c17,_0x341ca6,_0x37d397);if(!_0x41e402?.[_0x599a06(0x206)])continue;const _0x3ab2e1=_0x43093f['get'](_0x41e402[_0x599a06(0x206)]);_0x3ab2e1&&_0x3512c5[_0x599a06(0x205)](_0x3ab2e1,_0x341ca6);}}async function executeSingleJourneyPush(_0x4975d3,_0x362472,_0x5b7ae7,_0x129478,_0x16207b,_0x4b48f0){const _0x4c0062=a115_0x188509,{journeyDefToRequest:_0xc70d7f,activationDefToCreateRequest:_0x52b1c8,yamlRuleToApi:_0x48fdee,validateSegmentRule:_0xdcce11}=_0x4b48f0,_0x41b7ec=new Map(),_0x25b862=new Map();recoverSegmentIdsFromPushRecovery(_0x362472,_0x41b7ec,_0x5b7ae7[_0x4c0062(0x236)]);const _0x3ccc0c=new Map(),_0x7ff698=new Map(),_0x4ea0ec=new Map();let _0x3d0aa9;const _0x3797d4=async()=>{const _0xbabca8=_0x4c0062;if(_0x3d0aa9)return;_0x3d0aa9=new Map();if(!_0x362472['existingJourney'])return;const _0x14fca7=await _0x4975d3[_0xbabca8(0x215)][_0xbabca8(0x1d8)](_0x362472[_0xbabca8(0x1f0)]['id']);for(const _0x5df5ef of _0x14fca7){const _0x3b3169=journeyActivationStepToYaml(_0x5df5ef,_0x5b7ae7[_0xbabca8(0x268)],_0x5b7ae7[_0xbabca8(0x23a)]),_0x31433f=activationSignature(_0x3b3169);!_0x3d0aa9['has'](_0x31433f)&&_0x3d0aa9[_0xbabca8(0x205)](_0x31433f,_0x5df5ef['id']),_0x3b3169[_0xbabca8(0x206)]&&_0x25b862['set'](_0x3b3169[_0xbabca8(0x206)],_0x5df5ef['id']);}};await matchExistingJourneySegments(_0x4975d3,_0x362472,_0x129478[_0x4c0062(0x210)],_0x5b7ae7[_0x4c0062(0x1c1)],_0x5b7ae7[_0x4c0062(0x236)]);const _0x557924={'resolveSegmentId':async _0x203ea8=>{const _0x4b4d14=_0x4c0062,_0x5daf7e=_0x5b7ae7['segmentNameToId']['get'](_0x203ea8);if(!_0x5daf7e)throw new SDKError(ErrorCode[_0x4b4d14(0x26f)],'Segment\x20not\x20found:\x20'+_0x203ea8+_0x4b4d14(0x1a8)+_0x362472[_0x4b4d14(0x211)][_0x4b4d14(0x206)]+')');return _0x5daf7e;},'resolveEmbeddedSegmentId':async(_0x56a580,_0x52761b)=>{const _0x5c7616=_0x4c0062,_0x75903f=_0x5b7ae7['segmentNameToId'][_0x5c7616(0x1e0)](_0x56a580);if(_0x75903f)return _0x75903f;const _0x171674=_0x5b7ae7[_0x5c7616(0x1c1)][_0x5c7616(0x1c9)](_0x56155d=>_0x56155d[_0x5c7616(0x206)]===_0x56a580);if(_0x171674)return _0x5b7ae7[_0x5c7616(0x236)][_0x5c7616(0x205)](_0x56a580,_0x171674['id']),_0x171674['id'];if(_0x362472[_0x5c7616(0x21d)]){const {stageName:_0x4c83a5,criteriaName:_0x4443a8}=findSegmentCriteriaLocation(_0x362472[_0x5c7616(0x211)],_0x56a580);return _0xdcce11(_0x56a580,_0x52761b[_0x5c7616(0x251)]),_0x7ff698[_0x5c7616(0x205)](_0x56a580,{'definition':_0x52761b,'stageName':_0x4c83a5,'criteriaName':_0x4443a8}),createPendingSegmentId(_0x56a580);}const _0x229938=_0x362472[_0x5c7616(0x1f0)]?.['id'];if(!_0x229938)throw new SDKError(ErrorCode['INTERNAL'],_0x5c7616(0x1e4));const _0x1b0eab=_0x3ccc0c[_0x5c7616(0x1e0)](_0x56a580);if(_0x1b0eab)return _0x1b0eab;const _0xc00831=((async()=>{const _0x4e1b8a=_0x5c7616;_0xdcce11(_0x56a580,_0x52761b[_0x4e1b8a(0x251)]);const _0x2f21ac=generateDeterministicJourneySegmentName(_0x362472[_0x4e1b8a(0x211)][_0x4e1b8a(0x206)],_0x56a580),_0x1eb6d0=_0x5b7ae7[_0x4e1b8a(0x1c1)][_0x4e1b8a(0x1c9)](_0x1554d1=>_0x1554d1[_0x4e1b8a(0x206)]===_0x2f21ac),_0x4ebbf7=createSegmentIdResolver(_0x5b7ae7['segmentNameToId'],_0x56a580),_0x41742d=await resolveRuleSegmentIds(_0x52761b[_0x4e1b8a(0x251)],_0x4ebbf7);let _0x4a3414;return _0x1eb6d0?(await _0x4975d3['segment'][_0x4e1b8a(0x28f)](_0x129478[_0x4e1b8a(0x210)],_0x1eb6d0['id'],{'description':_0x52761b[_0x4e1b8a(0x1b7)]||_0x4e1b8a(0x24c)+_0x56a580,'rule':_0x48fdee(_0x41742d,!![]),'countPopulation':!![]}),_0x4a3414=_0x1eb6d0['id'],saveSegmentToPushRecovery(_0x362472['absolutePath'],_0x362472[_0x4e1b8a(0x211)]['name'],_0x56a580,{'segmentId':_0x4a3414,'uniqueServerName':_0x2f21ac,'createdAt':new Date()[_0x4e1b8a(0x259)]()})):_0x4a3414=await createOrRecoverEmbeddedSegment(_0x4975d3,_0x362472,{'localName':_0x56a580,'uniqueSegmentName':_0x2f21ac,'description':_0x52761b[_0x4e1b8a(0x1b7)]||_0x4e1b8a(0x24c)+_0x56a580,'journeyId':_0x229938,'resolvedRule':_0x41742d,'parentId':_0x129478['parentId'],'folderId':_0x129478[_0x4e1b8a(0x256)]||''},_0x48fdee),_0x5b7ae7[_0x4e1b8a(0x236)]['set'](_0x56a580,_0x4a3414),_0x41b7ec['set'](_0x56a580,_0x4a3414),_0x4a3414;})());_0x3ccc0c[_0x5c7616(0x205)](_0x56a580,_0xc00831);try{return await _0xc00831;}finally{_0x3ccc0c['delete'](_0x56a580);}},'resolveActivationId':async _0x57d7f9=>{const _0x1e7e04=_0x4c0062,_0xed421f=_0x25b862[_0x1e7e04(0x1e0)](_0x57d7f9);if(_0xed421f)return _0xed421f;if(_0x362472[_0x1e7e04(0x1f0)]){await _0x3797d4();const _0xb5a089=_0x25b862['get'](_0x57d7f9);if(_0xb5a089)return _0xb5a089;}throw new SDKError(ErrorCode['NOT_FOUND'],'Activation\x20not\x20found:\x20'+_0x57d7f9+_0x1e7e04(0x1a8)+_0x362472[_0x1e7e04(0x211)]['name']+_0x1e7e04(0x20a)+'Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.');},'resolveEmbeddedActivationId':async(_0x18df79,_0x24fd5e)=>{const _0x4cf7af=_0x4c0062,_0x23864d=_0x25b862[_0x4cf7af(0x1e0)](_0x18df79);if(_0x23864d)return _0x23864d;if(_0x362472[_0x4cf7af(0x21d)])return _0x4ea0ec[_0x4cf7af(0x205)](_0x18df79,_0x24fd5e),createPendingActivationId(_0x18df79);if(_0x362472[_0x4cf7af(0x1f0)]){await _0x3797d4();const _0x5a6141=_0x25b862[_0x4cf7af(0x1e0)](_0x24fd5e[_0x4cf7af(0x206)]);if(_0x5a6141)return _0x25b862[_0x4cf7af(0x205)](_0x18df79,_0x5a6141),_0x5a6141;const _0x400874=activationSignature(_0x24fd5e),_0x50fa70=_0x3d0aa9?.[_0x4cf7af(0x1e0)](_0x400874);if(_0x50fa70)return _0x25b862[_0x4cf7af(0x205)](_0x18df79,_0x50fa70),_0x50fa70;const _0x396c1a=await _0x52b1c8(_0x24fd5e,_0x5b7ae7[_0x4cf7af(0x1ea)]),_0x4ac764={..._0x396c1a,..._0x24fd5e[_0x4cf7af(0x1a3)]!==undefined&&{'runAfterJourneyRefresh':_0x24fd5e[_0x4cf7af(0x1a3)]}},_0x18e9d4=await _0x4975d3[_0x4cf7af(0x215)][_0x4cf7af(0x1af)](_0x362472[_0x4cf7af(0x1f0)]['id'],_0x4ac764);return _0x25b862['set'](_0x18df79,_0x18e9d4['id']),_0x18e9d4['id'];}throw new SDKError(ErrorCode[_0x4cf7af(0x221)],_0x4cf7af(0x1cf));},'resolveJourneyId':async _0x2919f4=>{const _0x6c944a=_0x4c0062;try{return await _0x4975d3[_0x6c944a(0x215)][_0x6c944a(0x1ed)](_0x129478['parentId'],_0x2919f4);}catch(_0x59c1a3){throw new SDKError(ErrorCode['NOT_FOUND'],_0x6c944a(0x28c)+_0x2919f4+_0x6c944a(0x29e)+_0x362472['yamlConfig'][_0x6c944a(0x206)]+'\x27)',_0x59c1a3);}},'resolveStageId':async(_0x18ec0d,_0x316dd8)=>{const _0x1f9247=_0x4c0062,_0x243299=await _0x4975d3['journey'][_0x1f9247(0x223)](_0x18ec0d),_0x4be620=_0x243299[_0x1f9247(0x1ff)][_0x1f9247(0x252)][_0x1f9247(0x1c9)](_0x38a8ce=>_0x38a8ce['name']['toLowerCase']()===_0x316dd8[_0x1f9247(0x1f5)]());if(!_0x4be620?.['id'])throw new SDKError(ErrorCode[_0x1f9247(0x292)],'Stage\x20\x27'+_0x316dd8+_0x1f9247(0x25e)+(_0x243299[_0x1f9247(0x1ff)][_0x1f9247(0x294)]||_0x243299['attributes'][_0x1f9247(0x206)])+'\x27');return _0x4be620['id'];}},_0x1c31c2=await _0xc70d7f(_0x362472[_0x4c0062(0x211)],_0x129478[_0x4c0062(0x210)],_0x557924),_0x3c6127=_0x129478[_0x4c0062(0x272)]||_0x129478['rootFolderId'];_0x3c6127&&(_0x1c31c2[_0x4c0062(0x200)]={'parentFolder':{'data':{'id':_0x3c6127,'type':_0x4c0062(0x246)}}});if(_0x362472[_0x4c0062(0x21d)]){if(_0x7ff698['size']>0x0||_0x4ea0ec[_0x4c0062(0x1a7)]>0x0)return await executeThreeStepJourneyCreate(_0x4975d3,_0x362472,_0x1c31c2,{'pendingEmbeddedSegments':_0x7ff698,'pendingEmbeddedActivations':_0x4ea0ec,'embeddedSegmentNameToId':_0x41b7ec,'journeyActivationNameToId':_0x25b862},{..._0x129478,'effectiveFolderId':_0x3c6127},_0x5b7ae7,_0x16207b,_0x4b48f0);else{ensureJourneyDefaults(_0x1c31c2[_0x4c0062(0x1ff)]);const _0x5d3fd6=await _0x4975d3[_0x4c0062(0x215)][_0x4c0062(0x1ec)](_0x1c31c2);return deletePushRecovery(_0x362472[_0x4c0062(0x1d4)]),{'action':_0x4c0062(0x25d),'journeyId':_0x5d3fd6['id'],'embeddedSegmentNameToId':_0x41b7ec};}}else{if(_0x362472['hasChanges']&&_0x362472['existingJourney'])return ensureJourneyDefaults(_0x1c31c2[_0x4c0062(0x1ff)]),await _0x4975d3[_0x4c0062(0x215)]['update'](_0x362472['existingJourney']['id'],_0x1c31c2),deletePushRecovery(_0x362472[_0x4c0062(0x1d4)]),{'action':_0x4c0062(0x243),'journeyId':_0x362472[_0x4c0062(0x1f0)]['id'],'embeddedSegmentNameToId':_0x41b7ec};}return deletePushRecovery(_0x362472[_0x4c0062(0x1d4)]),{'action':_0x4c0062(0x1f6),'journeyId':_0x362472[_0x4c0062(0x1f0)]?.['id'],'embeddedSegmentNameToId':_0x41b7ec};}function findSegmentCriteriaLocation(_0x6b4221,_0x1e0b35){const _0x28f78e=a115_0x188509,_0x70d8e=_0x6b4221[_0x28f78e(0x24f)]||_0x6b4221['journeys']?.[0x0]?.[_0x28f78e(0x24f)]||[];let _0x239e93='entry',_0x3127ff=_0x1e0b35;const _0xeb8366=_0x6b4221[_0x28f78e(0x1c0)]||_0x6b4221[_0x28f78e(0x1c8)]?.[0x0]?.[_0x28f78e(0x1c0)];if(_0xeb8366?.[_0x28f78e(0x1db)]===_0x1e0b35)return{'stageName':_0x28f78e(0x1c0),'criteriaName':_0xeb8366[_0x28f78e(0x206)]||_0x1e0b35};_0x4373af:for(const _0x19b4e2 of _0x70d8e){if(_0x19b4e2['entry_criteria']?.[_0x28f78e(0x1db)]===_0x1e0b35){_0x239e93=_0x19b4e2[_0x28f78e(0x206)],_0x3127ff=_0x19b4e2['entry_criteria'][_0x28f78e(0x206)]||_0x1e0b35;break;}if(_0x19b4e2[_0x28f78e(0x1d7)])for(const _0x373675 of _0x19b4e2['steps']){if(_0x373675[_0x28f78e(0x231)]===_0x28f78e(0x239)&&_0x373675[_0x28f78e(0x298)]?.[_0x28f78e(0x1e7)])for(const _0x2bd711 of _0x373675[_0x28f78e(0x298)]['branches']){if(_0x2bd711['segment']===_0x1e0b35){_0x239e93=_0x19b4e2['name'],_0x3127ff=_0x2bd711[_0x28f78e(0x206)]||_0x1e0b35;break _0x4373af;}}}}return{'stageName':_0x239e93,'criteriaName':_0x3127ff};}async function executeThreeStepJourneyCreate(_0x2563e1,_0x1a8a3e,_0x27237f,_0x37fcf2,_0x359414,_0x2772f3,_0x4033f9,_0xae3569){const _0x2f297c=a115_0x188509,{activationDefToCreateRequest:_0x4ae0a3,yamlRuleToApi:_0x414fe3}=_0xae3569,{pendingEmbeddedSegments:_0x10e1a6,pendingEmbeddedActivations:_0x4850fc,embeddedSegmentNameToId:_0x4234e8}=_0x37fcf2,_0x52a00b=JSON['parse'](JSON[_0x2f297c(0x1bd)](_0x27237f));ensureJourneyDefaults(_0x52a00b[_0x2f297c(0x1ff)]),stripPendingIds(_0x52a00b);const _0x46957d=await _0x2563e1[_0x2f297c(0x215)][_0x2f297c(0x1ec)](_0x52a00b),_0x4413bf=_0x46957d['id'],_0x167b25=new Map();for(const _0x2b0a96 of _0x46957d[_0x2f297c(0x1ff)][_0x2f297c(0x252)]){_0x167b25[_0x2f297c(0x205)](_0x2b0a96[_0x2f297c(0x206)]['toLowerCase'](),_0x2b0a96['id']);}recoverSegmentIdsFromPushRecovery(_0x1a8a3e,_0x4234e8,_0x2772f3[_0x2f297c(0x236)]);for(const [_0x49a648,{definition:_0x48e5fa}]of _0x10e1a6){if(_0x4234e8['has'](_0x49a648)){_0x4033f9[_0x2f297c(0x23d)]?.({'type':_0x2f297c(0x222),'journeyName':_0x1a8a3e['yamlConfig']['name'],'segmentName':_0x49a648});continue;}const _0x1e9106=generateDeterministicJourneySegmentName(_0x1a8a3e['yamlConfig'][_0x2f297c(0x206)],_0x49a648);_0x4033f9[_0x2f297c(0x23d)]?.({'type':_0x2f297c(0x220),'journeyName':_0x1a8a3e['yamlConfig'][_0x2f297c(0x206)],'segmentName':_0x49a648});const _0x4add16=createSegmentIdResolver(_0x2772f3[_0x2f297c(0x236)],_0x49a648),_0x527277=await resolveRuleSegmentIds(_0x48e5fa[_0x2f297c(0x251)],_0x4add16),_0x243868=await createOrRecoverEmbeddedSegment(_0x2563e1,_0x1a8a3e,{'localName':_0x49a648,'uniqueSegmentName':_0x1e9106,'description':_0x48e5fa['description']||'Entry\x20criteria:\x20'+_0x49a648,'journeyId':_0x4413bf,'resolvedRule':_0x527277,'parentId':_0x359414[_0x2f297c(0x210)],'folderId':_0x359414[_0x2f297c(0x290)]||''},_0x414fe3);_0x4234e8[_0x2f297c(0x205)](_0x49a648,_0x243868),_0x2772f3[_0x2f297c(0x236)][_0x2f297c(0x205)](_0x49a648,_0x243868),_0x4033f9[_0x2f297c(0x23d)]?.({'type':_0x2f297c(0x222),'journeyName':_0x1a8a3e[_0x2f297c(0x211)][_0x2f297c(0x206)],'segmentName':_0x49a648});}const _0x503191=new Map();for(const [_0x1c2098,_0x5844d2]of _0x4850fc){_0x4033f9[_0x2f297c(0x23d)]?.({'type':'embedded_activation_creating','journeyName':_0x1a8a3e[_0x2f297c(0x211)][_0x2f297c(0x206)],'activationName':_0x1c2098});const _0xfb8b2e=await _0x4ae0a3(_0x5844d2,_0x2772f3[_0x2f297c(0x1ea)]),_0x39f93a={..._0xfb8b2e,..._0x5844d2[_0x2f297c(0x1a3)]!==undefined&&{'runAfterJourneyRefresh':_0x5844d2[_0x2f297c(0x1a3)]}},_0x45b171=await _0x2563e1[_0x2f297c(0x215)][_0x2f297c(0x1af)](_0x4413bf,_0x39f93a);_0x503191['set'](_0x1c2098,_0x45b171['id']),_0x37fcf2[_0x2f297c(0x225)][_0x2f297c(0x205)](_0x1c2098,_0x45b171['id']),_0x4033f9['onProgress']?.({'type':_0x2f297c(0x25c),'journeyName':_0x1a8a3e[_0x2f297c(0x211)][_0x2f297c(0x206)],'activationName':_0x1c2098});}const _0x121f6e=JSON[_0x2f297c(0x283)](JSON[_0x2f297c(0x1bd)](_0x27237f));return _0x121f6e['id']=_0x4413bf,ensureJourneyDefaults(_0x121f6e[_0x2f297c(0x1ff)]),resolvePendingIdsInRequest(_0x121f6e,_0x27237f,_0x167b25,_0x4234e8,_0x503191,_0x4033f9),await _0x2563e1[_0x2f297c(0x215)][_0x2f297c(0x289)](_0x4413bf,_0x121f6e),deletePushRecovery(_0x1a8a3e['absolutePath']),{'action':_0x2f297c(0x25d),'journeyId':_0x4413bf,'embeddedSegmentNameToId':_0x4234e8};}export function stripWaitStepPendingIds(_0x628060){const _0x29bd2c=a115_0x188509,_0x4c23fa=_0x628060[_0x29bd2c(0x1d0)]&&isPendingSegmentId(_0x628060[_0x29bd2c(0x1d0)]),_0x64a23a=_0x628060['conditions']?.[_0x29bd2c(0x1d1)](_0x179b61=>_0x179b61['segmentId']&&isPendingSegmentId(_0x179b61['segmentId']));(_0x4c23fa||_0x64a23a)&&(_0x628060[_0x29bd2c(0x22f)]=_0x29bd2c(0x250),_0x628060[_0x29bd2c(0x278)]=0x1,_0x628060[_0x29bd2c(0x260)]=_0x29bd2c(0x1ab),delete _0x628060[_0x29bd2c(0x1d0)],delete _0x628060['conditionTimeoutDuration'],delete _0x628060['conditionTimeoutUnit'],delete _0x628060[_0x29bd2c(0x275)]);}export function resolveWaitStepPendingIds(_0x20de75,_0x37a374,_0x17e957,_0xf1250c){const _0x2a1d69=a115_0x188509;if(_0x37a374[_0x2a1d69(0x1d0)]&&isPendingSegmentId(_0x37a374[_0x2a1d69(0x1d0)])){const _0x11ab3f=_0x17e957(_0x37a374['conditionSegmentId'],_0x2a1d69(0x1f7)+_0xf1250c+_0x2a1d69(0x1f1));_0x11ab3f&&(_0x20de75[_0x2a1d69(0x22f)]='Condition',_0x20de75[_0x2a1d69(0x1d0)]=_0x11ab3f,delete _0x20de75[_0x2a1d69(0x278)],delete _0x20de75[_0x2a1d69(0x260)],_0x37a374[_0x2a1d69(0x1bf)]!==undefined&&(_0x20de75[_0x2a1d69(0x1bf)]=_0x37a374[_0x2a1d69(0x1bf)]),_0x37a374['conditionTimeoutUnit']&&(_0x20de75['conditionTimeoutUnit']=_0x37a374['conditionTimeoutUnit']));}if(_0x37a374['conditions']){const _0xb2ba52=_0x37a374[_0x2a1d69(0x275)][_0x2a1d69(0x1d1)](_0x38fdcd=>_0x38fdcd['segmentId']&&isPendingSegmentId(_0x38fdcd[_0x2a1d69(0x291)]));if(_0xb2ba52){const _0x33de02=_0x37a374[_0x2a1d69(0x275)][_0x2a1d69(0x287)](_0x1166c0=>{const _0x4aaa21=_0x2a1d69;if(_0x1166c0['segmentId']&&isPendingSegmentId(_0x1166c0['segmentId'])){const _0x56b4bd=_0x17e957(_0x1166c0[_0x4aaa21(0x291)],'stage\x20\x27'+_0xf1250c+'\x27\x20wait\x20condition');return{..._0x1166c0,'segmentId':_0x56b4bd||_0x1166c0[_0x4aaa21(0x291)]};}return{..._0x1166c0};});_0x20de75[_0x2a1d69(0x22f)]=_0x2a1d69(0x1e1),_0x20de75[_0x2a1d69(0x275)]=_0x33de02,delete _0x20de75[_0x2a1d69(0x278)],delete _0x20de75[_0x2a1d69(0x260)],delete _0x20de75[_0x2a1d69(0x1d0)],delete _0x20de75[_0x2a1d69(0x1bf)],delete _0x20de75[_0x2a1d69(0x280)];}}}function stripPendingIds(_0x10c762){const _0x52274e=a115_0x188509;_0x10c762[_0x52274e(0x1ff)]['goal']?.[_0x52274e(0x291)]&&isPendingSegmentId(_0x10c762['attributes']['goal'][_0x52274e(0x291)])&&delete _0x10c762[_0x52274e(0x1ff)][_0x52274e(0x1c0)];for(const _0x1746f9 of _0x10c762[_0x52274e(0x1ff)][_0x52274e(0x252)]||[]){_0x1746f9[_0x52274e(0x20e)]?.[_0x52274e(0x291)]&&isPendingSegmentId(_0x1746f9[_0x52274e(0x20e)][_0x52274e(0x291)])&&delete _0x1746f9['entryCriteria'];_0x1746f9[_0x52274e(0x257)]?.[_0x52274e(0x291)]&&isPendingSegmentId(_0x1746f9['milestone'][_0x52274e(0x291)])&&delete _0x1746f9['milestone'];_0x1746f9[_0x52274e(0x1f3)]&&(_0x1746f9[_0x52274e(0x1f3)]=_0x1746f9[_0x52274e(0x1f3)][_0x52274e(0x237)](_0x1ae4ad=>!_0x1ae4ad[_0x52274e(0x291)]||!isPendingSegmentId(_0x1ae4ad[_0x52274e(0x291)])));if(_0x1746f9[_0x52274e(0x1d7)])for(const _0x1a1fd4 of Object['keys'](_0x1746f9[_0x52274e(0x1d7)])){const _0x500afd=_0x1746f9[_0x52274e(0x1d7)][_0x1a1fd4];_0x500afd[_0x52274e(0x231)]===_0x52274e(0x1a4)&&_0x500afd[_0x52274e(0x1f8)]&&isPendingActivationId(_0x500afd[_0x52274e(0x1f8)])&&(_0x500afd[_0x52274e(0x1f8)]='');if(_0x500afd[_0x52274e(0x231)]==='DecisionPoint'&&_0x500afd[_0x52274e(0x1e7)])for(const _0x5462d8 of _0x500afd['branches']){_0x5462d8[_0x52274e(0x291)]&&isPendingSegmentId(_0x5462d8[_0x52274e(0x291)])&&(_0x5462d8['segmentId']='');}_0x500afd['type']===_0x52274e(0x20b)&&stripWaitStepPendingIds(_0x500afd);}}}function resolvePendingIdsInRequest(_0x11c7e6,_0x180a01,_0xd4ce52,_0xf6d75,_0x321f09,_0x2de3ae){const _0x1b0a29=a115_0x188509,_0x5e061b=(_0x8533df,_0xdce9a1)=>{const _0x34eb56=a115_0x4469;if(!isPendingSegmentId(_0x8533df))return _0x8533df;const _0x56bd7c=extractPendingSegmentName(_0x8533df),_0x3ac14d=_0xf6d75[_0x34eb56(0x1e0)](_0x56bd7c);return!_0x3ac14d&&_0x2de3ae[_0x34eb56(0x28d)]?.(_0x34eb56(0x1ba)+_0x56bd7c+_0x34eb56(0x1fa)+_0xdce9a1),_0x3ac14d;};if(_0x11c7e6[_0x1b0a29(0x1ff)][_0x1b0a29(0x1c0)]?.['segmentId']&&isPendingSegmentId(_0x11c7e6[_0x1b0a29(0x1ff)][_0x1b0a29(0x1c0)][_0x1b0a29(0x291)])){const _0x31ff68=_0x5e061b(_0x11c7e6[_0x1b0a29(0x1ff)]['goal'][_0x1b0a29(0x291)],_0x1b0a29(0x23b));_0x31ff68&&(_0x11c7e6['attributes'][_0x1b0a29(0x1c0)][_0x1b0a29(0x291)]=_0x31ff68);}for(const _0x341e42 of _0x11c7e6[_0x1b0a29(0x1ff)][_0x1b0a29(0x252)]||[]){const _0x4c5b05=_0xd4ce52[_0x1b0a29(0x1e0)](_0x341e42[_0x1b0a29(0x206)][_0x1b0a29(0x1f5)]());_0x4c5b05&&(_0x341e42['id']=_0x4c5b05);if(_0x341e42[_0x1b0a29(0x20e)]?.[_0x1b0a29(0x291)]&&isPendingSegmentId(_0x341e42[_0x1b0a29(0x20e)][_0x1b0a29(0x291)])){const _0xf2d09b=_0x5e061b(_0x341e42[_0x1b0a29(0x20e)][_0x1b0a29(0x291)],'stage\x20\x27'+_0x341e42[_0x1b0a29(0x206)]+_0x1b0a29(0x22d));_0xf2d09b&&(_0x341e42[_0x1b0a29(0x20e)][_0x1b0a29(0x291)]=_0xf2d09b);}if(_0x341e42[_0x1b0a29(0x1f3)])for(const _0x5cf195 of _0x341e42['exitCriterias']){if(_0x5cf195['segmentId']&&isPendingSegmentId(_0x5cf195[_0x1b0a29(0x291)])){const _0x564bae=_0x5e061b(_0x5cf195['segmentId'],_0x1b0a29(0x1f7)+_0x341e42[_0x1b0a29(0x206)]+_0x1b0a29(0x1cd));_0x564bae&&(_0x5cf195[_0x1b0a29(0x291)]=_0x564bae);}}if(_0x341e42[_0x1b0a29(0x257)]?.[_0x1b0a29(0x291)]&&isPendingSegmentId(_0x341e42['milestone']['segmentId'])){const _0x5526d1=_0x5e061b(_0x341e42['milestone'][_0x1b0a29(0x291)],_0x1b0a29(0x1f7)+_0x341e42['name']+_0x1b0a29(0x25f));_0x5526d1&&(_0x341e42['milestone'][_0x1b0a29(0x291)]=_0x5526d1);}if(_0x341e42[_0x1b0a29(0x1d7)]){const _0x2e7eab=_0xa2b04e=>_0x180a01[_0x1b0a29(0x1ff)][_0x1b0a29(0x252)]?.[_0x1b0a29(0x1c9)](_0x2063d2=>_0x2063d2[_0x1b0a29(0x206)][_0x1b0a29(0x1f5)]()===_0x341e42[_0x1b0a29(0x206)]['toLowerCase']())?.[_0x1b0a29(0x1d7)]?.[_0xa2b04e];for(const _0xbc5812 of Object[_0x1b0a29(0x233)](_0x341e42[_0x1b0a29(0x1d7)])){const _0x309c5c=_0x341e42[_0x1b0a29(0x1d7)][_0xbc5812],_0x5883ca=_0x2e7eab(_0xbc5812);if(_0x309c5c[_0x1b0a29(0x231)]===_0x1b0a29(0x1a4)&&_0x309c5c['journeyActivationStepId']&&(isPendingActivationId(_0x309c5c[_0x1b0a29(0x1f8)])||_0x309c5c[_0x1b0a29(0x1f8)]==='')){if(_0x5883ca?.['journeyActivationStepId']&&isPendingActivationId(_0x5883ca[_0x1b0a29(0x1f8)])){const _0x1ca739=extractPendingActivationName(_0x5883ca['journeyActivationStepId']),_0x464a2f=_0x321f09['get'](_0x1ca739);_0x464a2f&&(_0x309c5c[_0x1b0a29(0x1f8)]=_0x464a2f);}}if(_0x309c5c[_0x1b0a29(0x231)]===_0x1b0a29(0x24d)&&_0x309c5c[_0x1b0a29(0x1e7)]&&_0x5883ca?.['branches'])for(let _0x45afb8=0x0;_0x45afb8<_0x309c5c[_0x1b0a29(0x1e7)]['length'];_0x45afb8++){const _0x492f86=_0x309c5c[_0x1b0a29(0x1e7)][_0x45afb8],_0x60def2=_0x5883ca[_0x1b0a29(0x1e7)][_0x45afb8];if(_0x60def2?.[_0x1b0a29(0x291)]&&isPendingSegmentId(_0x60def2[_0x1b0a29(0x291)])){const _0x195d35=_0x5e061b(_0x60def2[_0x1b0a29(0x291)],_0x1b0a29(0x1f7)+_0x341e42['name']+_0x1b0a29(0x1c6)+(_0x492f86[_0x1b0a29(0x206)]||_0x45afb8)+'\x27');_0x195d35&&(_0x492f86[_0x1b0a29(0x291)]=_0x195d35);}}_0x309c5c[_0x1b0a29(0x231)]===_0x1b0a29(0x20b)&&_0x5883ca?.[_0x1b0a29(0x231)]===_0x1b0a29(0x20b)&&resolveWaitStepPendingIds(_0x309c5c,_0x5883ca,_0x5e061b,_0x341e42[_0x1b0a29(0x206)]);}}}}
@@ -1 +1 @@
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
+ function a116_0x504f(_0xe7fa5a,_0x592bf2){_0xe7fa5a=_0xe7fa5a-0xa0;const _0x343a2b=a116_0x343a();let _0x504f41=_0x343a2b[_0xe7fa5a];return _0x504f41;}function a116_0x343a(){const _0x3c5a24=['41060pTjpbW','22482jBjJFs','set','3540780EGZZcx','8iKewUh','get','parentFolderId','10106eTdKdt','131UZQsdp','4218039qYTBRI','add','has','3378960nVHMaJ','123JzRCSS','2240997UKHtVS','1162kEmbxg','name'];a116_0x343a=function(){return _0x3c5a24;};return a116_0x343a();}(function(_0x2e2d6a,_0x48c6d6){const _0x3acd28=a116_0x504f,_0x5285b6=_0x2e2d6a();while(!![]){try{const _0x49258c=-parseInt(_0x3acd28(0xaa))/0x1*(parseInt(_0x3acd28(0xa9))/0x2)+parseInt(_0x3acd28(0xaf))/0x3*(parseInt(_0x3acd28(0xa2))/0x4)+parseInt(_0x3acd28(0xa5))/0x5+-parseInt(_0x3acd28(0xa3))/0x6*(-parseInt(_0x3acd28(0xa0))/0x7)+-parseInt(_0x3acd28(0xa6))/0x8*(parseInt(_0x3acd28(0xab))/0x9)+-parseInt(_0x3acd28(0xae))/0xa+parseInt(_0x3acd28(0xb0))/0xb;if(_0x49258c===_0x48c6d6)break;else _0x5285b6['push'](_0x5285b6['shift']());}catch(_0x27a2ea){_0x5285b6['push'](_0x5285b6['shift']());}}}(a116_0x343a,0x76b60));export function buildFolderIdToPathMap(_0x4d120c){const _0x12550b=a116_0x504f,_0x4124b0=new Map(),_0x340ff7=new Map();for(const _0x2660fe of _0x4d120c){_0x340ff7[_0x12550b(0xa4)](_0x2660fe['id'],_0x2660fe);}const _0x4fcebf=new Set();for(const _0x476a1a of _0x4d120c){!_0x476a1a[_0x12550b(0xa8)]&&_0x4fcebf['add'](_0x476a1a['id']);}function _0x2dc793(_0x45df50){const _0x1eab02=_0x12550b;if(_0x4124b0[_0x1eab02(0xad)](_0x45df50['id']))return _0x4124b0[_0x1eab02(0xa7)](_0x45df50['id']);if(_0x4fcebf[_0x1eab02(0xad)](_0x45df50['id']))return _0x4124b0[_0x1eab02(0xa4)](_0x45df50['id'],''),'';if(_0x45df50[_0x1eab02(0xa8)]){const _0x209f1d=_0x340ff7[_0x1eab02(0xa7)](_0x45df50[_0x1eab02(0xa8)]);if(_0x209f1d){const _0x352149=_0x2dc793(_0x209f1d),_0xe74301=_0x352149?_0x352149+'/'+_0x45df50[_0x1eab02(0xa1)]:_0x45df50[_0x1eab02(0xa1)];return _0x4124b0['set'](_0x45df50['id'],_0xe74301),_0xe74301;}}const _0x1415b3=_0x45df50['name'];return _0x4124b0[_0x1eab02(0xa4)](_0x45df50['id'],_0x1415b3),_0x1415b3;}for(const _0x555ca2 of _0x4d120c){_0x2dc793(_0x555ca2);}return _0x4124b0;}export function buildFolderPathToIdMap(_0x40e79d){const _0x258b01=a116_0x504f,_0x5cac51=new Map(),_0x170374=new Map();for(const _0x5dbdad of _0x40e79d){_0x170374['set'](_0x5dbdad['id'],_0x5dbdad);}const _0x48f581=new Set();for(const _0x2e07fc of _0x40e79d){!_0x2e07fc[_0x258b01(0xa8)]&&_0x48f581[_0x258b01(0xac)](_0x2e07fc['id']);}function _0x171867(_0x5b74ae){const _0x4df2ec=_0x258b01;if(_0x48f581[_0x4df2ec(0xad)](_0x5b74ae['id']))return'';if(_0x5b74ae[_0x4df2ec(0xa8)]){const _0x3465fd=_0x170374['get'](_0x5b74ae[_0x4df2ec(0xa8)]);if(_0x3465fd){const _0x49eec5=_0x171867(_0x3465fd);return _0x49eec5?_0x49eec5+'/'+_0x5b74ae[_0x4df2ec(0xa1)]:_0x5b74ae[_0x4df2ec(0xa1)];}}return _0x5b74ae[_0x4df2ec(0xa1)];}for(const _0x5e7588 of _0x40e79d){const _0x11647e=_0x171867(_0x5e7588);_0x5cac51[_0x258b01(0xa4)](_0x11647e,_0x5e7588['id']);}return _0x5cac51;}export function buildFolderMaps(_0x2720bd){const _0x5c8985=buildFolderIdToPathMap(_0x2720bd),_0x23deed=new Map();for(const [_0x5d56ac,_0x2718dc]of _0x5c8985){_0x23deed['set'](_0x2718dc,_0x5d56ac);}return{'idToPath':_0x5c8985,'pathToId':_0x23deed};}export function getFolderPath(_0x1984b2,_0x35d6cd){const _0xc485f=a116_0x504f;if(!_0x1984b2)return'';return _0x35d6cd[_0xc485f(0xa7)](_0x1984b2)??'';}
@@ -1 +1 @@
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
+ (function(_0x493485,_0x54ce0f){const _0x1b8b15=a117_0x532c,_0x3c4e84=_0x493485();while(!![]){try{const _0x4d44f8=parseInt(_0x1b8b15(0xd6))/0x1+-parseInt(_0x1b8b15(0xd4))/0x2+parseInt(_0x1b8b15(0xc1))/0x3+-parseInt(_0x1b8b15(0xb7))/0x4+-parseInt(_0x1b8b15(0xd8))/0x5*(-parseInt(_0x1b8b15(0xd3))/0x6)+-parseInt(_0x1b8b15(0xba))/0x7+parseInt(_0x1b8b15(0xd9))/0x8;if(_0x4d44f8===_0x54ce0f)break;else _0x3c4e84['push'](_0x3c4e84['shift']());}catch(_0x776469){_0x3c4e84['push'](_0x3c4e84['shift']());}}}(a117_0x4860,0x983d8));function a117_0x4860(){const _0x2638e3=['raw','8576120sGRAGX','type','split','slice','readFile','segment','replace','2856489rTXBUp','endsWith','startsWith','pop','test','join','File\x20not\x20found:\x20','resolve','root','journey','filter','.yaml','exists','parse','parent_segment','Path\x20attempts\x20to\x20navigate\x20above\x20root','push','length','169692qVWzbM','1877196TLFTZy','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','1121037JRMezh','Path\x20segment\x20cannot\x20be\x20empty','10MxHGVP','13673512APYKMT','trim','dirname','Cannot\x20navigate\x20above\x20root','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','segments','isAbsolute','4206476cWuydL','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field'];a117_0x4860=function(){return _0x2638e3;};return a117_0x4860();}import a117_0x22374c from'path';import{parse as a117_0x460075}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x24c705){const _0xb48401=a117_0x532c;if(!_0x24c705||_0x24c705[_0xb48401(0xda)]()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0x397b37=_0x24c705['trim']();if(_0x397b37==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x24c705};const _0x41a9c6=_0x397b37[_0xb48401(0xc3)]('/')?_0x397b37['substring'](0x1):_0x397b37,_0x77f89d=_0x41a9c6[_0xb48401(0xbc)]('/')[_0xb48401(0xcb)](_0x2c1e3b=>_0x2c1e3b!=='');if(_0x77f89d[_0xb48401(0xd2)]===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x125b20=_0x397b37['startsWith']('/')||!isRelativePathSegment(_0x77f89d[0x0]);for(const _0x5d0302 of _0x77f89d){validatePathSegment(_0x5d0302);}return{'segments':_0x77f89d,'isAbsolute':_0x125b20,'raw':_0x24c705};}function isRelativePathSegment(_0x5b532c){return _0x5b532c==='.'||_0x5b532c==='..';}function a117_0x532c(_0x56ffdc,_0x2fe3ca){_0x56ffdc=_0x56ffdc-0xb2;const _0x48608d=a117_0x4860();let _0x532c89=_0x48608d[_0x56ffdc];return _0x532c89;}function validatePathSegment(_0x55af04){const _0x27da71=a117_0x532c;if(_0x55af04==='')throw new Error(_0x27da71(0xd7));if(_0x55af04==='.'||_0x55af04==='..')return;if(/[\x00-\x1F\x7F]/[_0x27da71(0xc5)](_0x55af04))throw new Error(_0x27da71(0xb4)+_0x55af04);if(_0x55af04!==_0x55af04['trim']()){}}export function validatePath(_0x49921b){const _0x47d445=a117_0x532c;if(_0x49921b[_0x47d445(0xb5)][_0x47d445(0xd2)]===0x0&&!_0x49921b['isAbsolute'])throw new Error('Relative\x20path\x20cannot\x20be\x20empty');if(_0x49921b['isAbsolute']){if(_0x49921b[_0x47d445(0xb5)][0x0]==='..')throw new Error('Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22');let _0x251bee=0x0;for(const _0x9cbdaa of _0x49921b[_0x47d445(0xb5)]){if(_0x9cbdaa==='..'){if(_0x251bee===0x0)throw new Error(_0x47d445(0xd0));_0x251bee--;}else _0x9cbdaa!=='.'&&_0x251bee++;}}}export function joinPaths(_0x3cff58,_0x5a67a3){const _0x5b505c=a117_0x532c;if(!_0x3cff58||_0x3cff58==='/')return _0x5a67a3;if(!_0x5a67a3||_0x5a67a3==='.')return _0x3cff58;if(_0x5a67a3[_0x5b505c(0xc3)]('/'))return _0x5a67a3;const _0x2e4988=parsePath(_0x3cff58),_0x3f6eaa=parsePath(_0x5a67a3),_0x5e45e1=[..._0x2e4988[_0x5b505c(0xb5)]];for(const _0x35d7f1 of _0x3f6eaa['segments']){if(_0x35d7f1==='.')continue;else{if(_0x35d7f1==='..'){if(_0x5e45e1[_0x5b505c(0xd2)]===0x0)throw new Error(_0x5b505c(0xb3));_0x5e45e1[_0x5b505c(0xc4)]();}else _0x5e45e1['push'](_0x35d7f1);}}const _0x5b7653=_0x5e45e1[_0x5b505c(0xc6)]('/');return _0x2e4988[_0x5b505c(0xb9)]['startsWith']('/')?'/'+_0x5b7653:_0x5b7653;}export function normalizePath(_0x267868){const _0x4b978c=a117_0x532c,_0x3e72be=parsePath(_0x267868),_0x597126=[];for(const _0x4e4a8f of _0x3e72be['segments']){if(_0x4e4a8f==='.')continue;else{if(_0x4e4a8f==='..'){if(_0x597126['length']===0x0){if(_0x3e72be[_0x4b978c(0xb6)])throw new Error(_0x4b978c(0xb3));_0x597126[_0x4b978c(0xd1)]('..');}else _0x597126[_0x597126[_0x4b978c(0xd2)]-0x1]==='..'?_0x597126[_0x4b978c(0xd1)]('..'):_0x597126['pop']();}else _0x597126[_0x4b978c(0xd1)](_0x4e4a8f);}}if(_0x597126['length']===0x0)return _0x3e72be['isAbsolute']?'/':'.';const _0xd02457=_0x597126[_0x4b978c(0xc6)]('/');return _0x3e72be[_0x4b978c(0xb9)][_0x4b978c(0xc3)]('/')?'/'+_0xd02457:_0xd02457;}export function getParentPath(_0x1208c8){const _0x3a02c4=a117_0x532c,_0x2cbea3=parsePath(_0x1208c8);if(_0x2cbea3[_0x3a02c4(0xb5)][_0x3a02c4(0xd2)]<=0x1)return'/';const _0x1094f0=_0x2cbea3['segments'][_0x3a02c4(0xbd)](0x0,-0x1)[_0x3a02c4(0xc6)]('/');return _0x2cbea3[_0x3a02c4(0xb9)][_0x3a02c4(0xc3)]('/')?'/'+_0x1094f0:_0x1094f0;}export function getBaseName(_0x50e289){const _0x102132=a117_0x532c,_0xddfed9=parsePath(_0x50e289);return _0xddfed9[_0x102132(0xb5)][_0xddfed9[_0x102132(0xb5)][_0x102132(0xd2)]-0x1]||'';}export function isChildPath(_0x4da50e,_0x3b3b30){const _0x572356=a117_0x532c,_0x56a2ef=parsePath(_0x4da50e),_0x53ebde=parsePath(_0x3b3b30);if(_0x56a2ef[_0x572356(0xb5)]['length']<=_0x53ebde[_0x572356(0xb5)][_0x572356(0xd2)])return![];for(let _0x1c52a7=0x0;_0x1c52a7<_0x53ebde[_0x572356(0xb5)]['length'];_0x1c52a7++){if(_0x56a2ef[_0x572356(0xb5)][_0x1c52a7]!==_0x53ebde[_0x572356(0xb5)][_0x1c52a7])return![];}return!![];}export function splitPath(_0x38731b){const _0x3edb19=a117_0x532c,_0x327107=parsePath(_0x38731b);if(_0x327107[_0x3edb19(0xb5)]['length']===0x0)throw new Error('Cannot\x20split\x20empty\x20path');if(_0x327107[_0x3edb19(0xb5)][_0x3edb19(0xd2)]===0x1)return{'parent':_0x327107['segments'][0x0]};return{'parent':_0x327107['segments'][0x0],'child':_0x327107['segments'][_0x3edb19(0xbd)](0x1)[_0x3edb19(0xc6)]('/')};}export function isYamlFilePath(_0x1089c5){const _0x2f105d=a117_0x532c;return _0x1089c5['endsWith']('.yml')||_0x1089c5[_0x2f105d(0xc2)](_0x2f105d(0xcc));}export async function resolveYamlFilePath(_0xd5a5a7,_0x289ddd=nodeFileSystem){const _0x36f12b=a117_0x532c,_0x250396=a117_0x22374c[_0x36f12b(0xc8)](_0xd5a5a7);if(!await _0x289ddd[_0x36f12b(0xcd)](_0x250396))throw new Error(_0x36f12b(0xc7)+_0xd5a5a7);let _0x572110=a117_0x22374c[_0x36f12b(0xb2)](_0x250396),_0x4cc84c=null,_0xf2a6c9=null;const _0x2acb97=a117_0x22374c['parse'](_0x572110)[_0x36f12b(0xc9)];while(_0x572110!==_0x2acb97){const _0x5044ec=a117_0x22374c[_0x36f12b(0xc6)](_0x572110,'tdx.json');if(await _0x289ddd[_0x36f12b(0xcd)](_0x5044ec)){_0x4cc84c=_0x5044ec,_0xf2a6c9=_0x572110;break;}_0x572110=a117_0x22374c['dirname'](_0x572110);}if(!_0x4cc84c||!_0xf2a6c9)throw new Error('No\x20tdx.json\x20found\x20for\x20file:\x20'+_0xd5a5a7);const _0x4b153f=await _0x289ddd[_0x36f12b(0xbe)](_0x4cc84c),_0x1c4fca=JSON[_0x36f12b(0xce)](_0x4b153f),_0x554b87=_0x1c4fca[_0x36f12b(0xcf)];if(!_0x554b87)throw new Error(_0x36f12b(0xb8));const _0xb27fcc=await _0x289ddd[_0x36f12b(0xbe)](_0x250396),_0x2bf288=a117_0x460075(_0xb27fcc),_0x5f3e7c=_0x2bf288['name'];if(!_0x5f3e7c)throw new Error(_0x36f12b(0xd5)+_0xd5a5a7);const _0x251477=_0x2bf288[_0x36f12b(0xbb)]===_0x36f12b(0xca)?_0x36f12b(0xca):_0x36f12b(0xbf),_0x1226f2=a117_0x22374c['relative'](_0xf2a6c9,_0x250396),_0x2c1f0f=a117_0x22374c[_0x36f12b(0xb2)](_0x1226f2),_0x42aa50=_0x2c1f0f==='.'?'':_0x2c1f0f[_0x36f12b(0xc0)](/\\/g,'/'),_0x3b9828=_0x42aa50?_0x554b87+'/'+_0x42aa50+'/'+_0x5f3e7c:_0x554b87+'/'+_0x5f3e7c;return{'parentSegment':_0x554b87,'segmentName':_0x5f3e7c,'folderPath':_0x42aa50,'fullPath':_0x3b9828,'resourceType':_0x251477};}
@@ -1 +1 @@
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
+ (function(_0x5c262e,_0x4d8dc1){const _0x4c2285=a118_0x1c61,_0x169c67=_0x5c262e();while(!![]){try{const _0x42175f=parseInt(_0x4c2285(0x101))/0x1*(parseInt(_0x4c2285(0xf7))/0x2)+parseInt(_0x4c2285(0xfb))/0x3*(parseInt(_0x4c2285(0xfa))/0x4)+-parseInt(_0x4c2285(0xfd))/0x5+parseInt(_0x4c2285(0xf6))/0x6+parseInt(_0x4c2285(0xff))/0x7+parseInt(_0x4c2285(0xfe))/0x8+-parseInt(_0x4c2285(0x102))/0x9;if(_0x42175f===_0x4d8dc1)break;else _0x169c67['push'](_0x169c67['shift']());}catch(_0x1c91fc){_0x169c67['push'](_0x169c67['shift']());}}}(a118_0x4d63,0xae313));export function parseSegmentRef(_0x18126f){const _0x1ccb33=a118_0x1c61,_0x38065e=_0x18126f['indexOf']('/');if(_0x38065e===-0x1)return{'parentId':_0x18126f};if(_0x38065e===0x0)throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x18126f+_0x1ccb33(0xfc));const _0x56c41b=_0x18126f[_0x1ccb33(0xf8)](0x0,_0x38065e),_0x7f52db=_0x18126f[_0x1ccb33(0xf8)](_0x38065e+0x1);if(_0x7f52db==='')throw new Error(_0x1ccb33(0x100)+_0x18126f+_0x1ccb33(0xf9));return{'parentId':_0x56c41b,'childId':_0x7f52db};}function a118_0x1c61(_0x4c4900,_0xa6f04){_0x4c4900=_0x4c4900-0xf6;const _0x4d630a=a118_0x4d63();let _0x1c61b3=_0x4d630a[_0x4c4900];return _0x1c61b3;}function a118_0x4d63(){const _0xf7e6ab=['5216720DpmDWI','3712863oEWrtV','Invalid\x20segment\x20reference\x20format:\x20','1KIZyhY','21509109yrOsTt','8092470sYCyNZ','297716nVZgUi','substring','.\x20Child\x20name\x20cannot\x20be\x20empty','144khxWxq','87348NctWaq','.\x20Parent\x20name\x20cannot\x20be\x20empty','3124430iUZSpB'];a118_0x4d63=function(){return _0xf7e6ab;};return a118_0x4d63();}
@@ -1 +1 @@
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'};}
1
+ (function(_0x4e17af,_0xa5c2d4){const _0x1c78cf=a119_0x3948,_0x1c18ec=_0x4e17af();while(!![]){try{const _0x1dc6ed=-parseInt(_0x1c78cf(0x98))/0x1+parseInt(_0x1c78cf(0x69))/0x2*(-parseInt(_0x1c78cf(0x85))/0x3)+-parseInt(_0x1c78cf(0x89))/0x4+-parseInt(_0x1c78cf(0x80))/0x5+-parseInt(_0x1c78cf(0x79))/0x6+parseInt(_0x1c78cf(0x76))/0x7*(-parseInt(_0x1c78cf(0x86))/0x8)+parseInt(_0x1c78cf(0x8b))/0x9;if(_0x1dc6ed===_0xa5c2d4)break;else _0x1c18ec['push'](_0x1c18ec['shift']());}catch(_0xc405dc){_0x1c18ec['push'](_0x1c18ec['shift']());}}}(a119_0x5039,0xc2010));import a119_0x12a988 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(_0x58a10f){const _0x16ac61=a119_0x3948;return _0x58a10f[_0x16ac61(0x82)]!==_0x16ac61(0x88);}function a119_0x5039(){const _0xfca6e=['parent_segment','Segment\x20and\x20journey\x20files\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension','no_parent','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','context','134ZXGfBd','relative','segmentName','journey','cwd','No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','join','extname','parse','parent_name','resourceType','message','scopedFolderPath','147jvziIs','basename','isFile','1455276lSzkaH','resolve','tdx.json','directory','trim','File\x20not\x20found','no_config','741300yHtcEV','dirname','type','startsWith','root','40470vXqnbz','409928ynAGJD','exists','error','4669500rTcYpO','match','39350754tcxMee','No\x20tdx.json\x20found\x20for\x20file:\x20','parentSegment','isDirectory','File\x20not\x20found:\x20','segment','replace','file','No\x20tdx.json\x20found','isScoped','file_not_found','stat','configDir','39594TXOtpB','Not\x20a\x20YAML\x20file:\x20','readFile','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','invalid_yaml','folderPath'];a119_0x5039=function(){return _0xfca6e;};return a119_0x5039();}export function isScopedResolution(_0x46de69){const _0x1fd017=a119_0x3948;return _0x46de69[_0x1fd017(0x82)]===_0x1fd017(0x7c)||_0x46de69[_0x1fd017(0x82)]==='file'||_0x46de69[_0x1fd017(0x82)]===_0x1fd017(0x68);}export function getScopedDetails(_0x44f00e){const _0x36e898=a119_0x3948;if(isScopedResolution(_0x44f00e))return{'isScoped':_0x44f00e['isScoped'],'scopedFolderPath':_0x44f00e[_0x36e898(0x75)]};return undefined;}function a119_0x3948(_0x10d057,_0x137745){_0x10d057=_0x10d057-0x65;const _0x5039f6=a119_0x5039();let _0x39484e=_0x5039f6[_0x10d057];return _0x39484e;}async function findTdxConfigAsync(_0x7c1675,_0x59f7f4){const _0xb34e2d=a119_0x3948;let _0x5dbe67=a119_0x12a988[_0xb34e2d(0x7a)](_0x7c1675);const _0x1e02d3=a119_0x12a988['parse'](_0x5dbe67)[_0xb34e2d(0x84)];while(_0x5dbe67!==_0x1e02d3){const _0x4e5049=a119_0x12a988[_0xb34e2d(0x6f)](_0x5dbe67,_0xb34e2d(0x7b));if(await _0x59f7f4[_0xb34e2d(0x87)](_0x4e5049))try{const _0x1fecc0=await _0x59f7f4[_0xb34e2d(0x9a)](_0x4e5049),_0x280b99=JSON[_0xb34e2d(0x71)](_0x1fecc0);if(_0x280b99[_0xb34e2d(0x9e)]&&typeof _0x280b99[_0xb34e2d(0x9e)]==='string')return{'configPath':_0x4e5049,'configDir':_0x5dbe67,'parentSegment':_0x280b99[_0xb34e2d(0x9e)]};}catch{}_0x5dbe67=a119_0x12a988['dirname'](_0x5dbe67);}return null;}function calculateScopedPath(_0x1276e2,_0x2fabbe){const _0x17f7b8=a119_0x3948,_0x17360=a119_0x12a988[_0x17f7b8(0x6a)](_0x2fabbe,_0x1276e2),_0x3de98c=_0x17360!==''&&_0x17360!=='.'&&!_0x17360[_0x17f7b8(0x83)]('..');return{'isScoped':_0x3de98c,'scopedFolderPath':_0x3de98c?_0x17360[_0x17f7b8(0x91)](/\\/g,'/'):''};}export async function resolveTarget(_0x306c99){const _0x3553cc=a119_0x3948,{arg:_0x582669,contextParent:_0x2d14dc,cwd:cwd=process[_0x3553cc(0x6d)](),fs:fs=nodeFileSystem}=_0x306c99;if(_0x582669&&isYamlFilePath(_0x582669))try{const _0x44fb28=await resolveYamlFilePath(_0x582669,fs),_0x40b481=a119_0x12a988[_0x3553cc(0x7a)](_0x582669),_0x53c942=a119_0x12a988[_0x3553cc(0x81)](_0x40b481),_0xdc4e05=await findTdxConfigAsync(_0x53c942,fs);if(!_0xdc4e05){if(_0x2d14dc){const _0x42d627=a119_0x12a988[_0x3553cc(0x81)](_0x40b481);return{'type':_0x3553cc(0x92),'parentName':_0x2d14dc,'targetDir':_0x42d627,'configRoot':_0x42d627,'filePath':_0x40b481,'resourceName':_0x44fb28['segmentName'],'folderPath':_0x44fb28[_0x3553cc(0x9d)],'resourceType':_0x44fb28[_0x3553cc(0x73)],'isScoped':![],'scopedFolderPath':''};}return{'type':_0x3553cc(0x88),'errorCode':'no_config','message':_0x3553cc(0x8c)+_0x582669,'arg':_0x582669,'helpText':_0x3553cc(0x67)};}const _0x6d75a=calculateScopedPath(_0x53c942,_0xdc4e05[_0x3553cc(0x97)]);return{'type':_0x3553cc(0x92),'parentName':_0xdc4e05[_0x3553cc(0x8d)],'targetDir':_0xdc4e05['configDir'],'configRoot':_0xdc4e05[_0x3553cc(0x97)],'filePath':_0x40b481,'resourceName':_0x44fb28[_0x3553cc(0x6b)],'folderPath':_0x44fb28[_0x3553cc(0x9d)],'resourceType':_0x44fb28['resourceType'],'isScoped':_0x6d75a['isScoped'],'scopedFolderPath':_0x6d75a[_0x3553cc(0x75)]};}catch(_0x3fcea6){const _0xc3a1a5=_0x3fcea6 instanceof Error?_0x3fcea6[_0x3553cc(0x74)]:String(_0x3fcea6);if(_0xc3a1a5['includes'](_0x3553cc(0x7e)))return{'type':'error','errorCode':_0x3553cc(0x95),'message':_0x3553cc(0x8f)+_0x582669,'arg':_0x582669};if(_0xc3a1a5['includes'](_0x3553cc(0x93))){if(_0x2d14dc){const _0x11731d=a119_0x12a988['resolve'](_0x582669);if(await fs[_0x3553cc(0x87)](_0x11731d)){const _0x40fa3a=a119_0x12a988[_0x3553cc(0x81)](_0x11731d),_0x1a6df5=await fs[_0x3553cc(0x9a)](_0x11731d),_0xd32383=_0x1a6df5[_0x3553cc(0x8a)](/^name:\s*["']?([^"'\n]+)["']?/m),_0x48271a=_0x1a6df5['match'](/^type:\s*["']?([^"'\n]+)["']?/m),_0x2ce946=_0xd32383?_0xd32383[0x1][_0x3553cc(0x7d)]():a119_0x12a988[_0x3553cc(0x77)](_0x582669,a119_0x12a988[_0x3553cc(0x70)](_0x582669)),_0x334cef=_0x48271a&&_0x48271a[0x1][_0x3553cc(0x7d)]()==='journey'?_0x3553cc(0x6c):_0x3553cc(0x90);return{'type':_0x3553cc(0x92),'parentName':_0x2d14dc,'targetDir':_0x40fa3a,'configRoot':_0x40fa3a,'filePath':_0x11731d,'resourceName':_0x2ce946,'folderPath':'','resourceType':_0x334cef,'isScoped':![],'scopedFolderPath':''};}}return{'type':_0x3553cc(0x88),'errorCode':_0x3553cc(0x7f),'message':_0x3553cc(0x8c)+_0x582669,'arg':_0x582669,'helpText':_0x3553cc(0x67)};}return{'type':_0x3553cc(0x88),'errorCode':_0x3553cc(0x9c),'message':_0xc3a1a5,'arg':_0x582669};}if(_0x582669){const _0x162e48=a119_0x12a988[_0x3553cc(0x7a)](cwd,_0x582669);let _0x4d23f3=null;try{_0x4d23f3=await fs[_0x3553cc(0x96)](_0x162e48);}catch{}if(_0x4d23f3?.[_0x3553cc(0x8e)]()){const _0x431514=await findTdxConfigAsync(_0x162e48,fs);if(_0x431514){const _0x14e546=calculateScopedPath(_0x162e48,_0x431514[_0x3553cc(0x97)]);return{'type':_0x3553cc(0x7c),'parentName':_0x431514['parentSegment'],'targetDir':_0x162e48,'configRoot':_0x431514[_0x3553cc(0x97)],'isScoped':_0x14e546[_0x3553cc(0x94)],'scopedFolderPath':_0x14e546[_0x3553cc(0x75)]};}if(_0x2d14dc)return{'type':_0x3553cc(0x7c),'parentName':_0x2d14dc,'targetDir':_0x162e48,'configRoot':_0x162e48,'isScoped':![],'scopedFolderPath':''};return{'type':_0x3553cc(0x88),'errorCode':_0x3553cc(0x7f),'message':_0x3553cc(0x6e)+_0x582669,'arg':_0x582669,'helpText':_0x3553cc(0x67)};}if(_0x4d23f3?.[_0x3553cc(0x78)]())return{'type':_0x3553cc(0x88),'errorCode':'invalid_yaml','message':_0x3553cc(0x99)+_0x582669,'arg':_0x582669,'helpText':_0x3553cc(0x65)};const _0x795e4c=sanitizeFileName(_0x582669),_0x53b992=getSegmentRootDir(_0x795e4c,cwd);return{'type':_0x3553cc(0x72),'parentName':_0x582669,'targetDir':_0x53b992,'configRoot':_0x53b992};}const _0x4bb888=await findTdxConfigAsync(cwd,fs);if(_0x4bb888){const _0x8899be=calculateScopedPath(cwd,_0x4bb888['configDir']);return{'type':_0x3553cc(0x68),'parentName':_0x4bb888[_0x3553cc(0x8d)],'targetDir':cwd,'configRoot':_0x4bb888['configDir'],'isScoped':_0x8899be[_0x3553cc(0x94)],'scopedFolderPath':_0x8899be[_0x3553cc(0x75)]};}if(_0x2d14dc){const _0x34db36=sanitizeFileName(_0x2d14dc),_0x36c25b=getSegmentRootDir(_0x34db36,cwd);return{'type':_0x3553cc(0x68),'parentName':_0x2d14dc,'targetDir':_0x36c25b,'configRoot':_0x36c25b,'isScoped':![],'scopedFolderPath':''};}return{'type':_0x3553cc(0x88),'errorCode':_0x3553cc(0x66),'message':'Parent\x20segment\x20not\x20specified','helpText':_0x3553cc(0x9b)};}