@treasuredata/tdx 2026.4.14 → 2026.4.15

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 (221) hide show
  1. package/README.md +1 -1
  2. package/dist/bin.js +1 -1
  3. package/dist/build-info.json +3 -3
  4. package/dist/cli-categories.js +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/commands/activations.js +1 -1
  7. package/dist/commands/agent-command.js +1 -1
  8. package/dist/commands/agent-test-command.js +1 -1
  9. package/dist/commands/api-command.js +1 -1
  10. package/dist/commands/auth-command.js +1 -1
  11. package/dist/commands/cas-command.js +1 -1
  12. package/dist/commands/cas-segment-command.js +1 -1
  13. package/dist/commands/chat-command.js +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-statusline-command.js +1 -1
  16. package/dist/commands/claude-usage-command.js +1 -1
  17. package/dist/commands/command.js +1 -1
  18. package/dist/commands/connection-command.js +1 -1
  19. package/dist/commands/databases.js +1 -1
  20. package/dist/commands/delivery-command.js +1 -1
  21. package/dist/commands/describe.js +1 -1
  22. package/dist/commands/engage-campaign-pull-command.js +1 -1
  23. package/dist/commands/engage-campaign-push-command.js +1 -1
  24. package/dist/commands/engage-campaign-validate-command.js +1 -1
  25. package/dist/commands/engage-command.js +1 -1
  26. package/dist/commands/engage-template-pull-command.js +1 -1
  27. package/dist/commands/engage-template-push-command.js +1 -1
  28. package/dist/commands/engage-template-validate-command.js +1 -1
  29. package/dist/commands/job-command.js +1 -1
  30. package/dist/commands/journey-command.js +1 -1
  31. package/dist/commands/journey-validate-command.js +1 -1
  32. package/dist/commands/llm-command.js +1 -1
  33. package/dist/commands/mcp-command.js +1 -1
  34. package/dist/commands/parent-segment-command.js +1 -1
  35. package/dist/commands/policy-command.js +1 -1
  36. package/dist/commands/profile-command.js +1 -1
  37. package/dist/commands/profiles-command.js +1 -1
  38. package/dist/commands/query-command.js +1 -1
  39. package/dist/commands/schedule-command.js +1 -1
  40. package/dist/commands/segment-command.js +1 -1
  41. package/dist/commands/segment-create-command.js +1 -1
  42. package/dist/commands/segment-fields-command.js +1 -1
  43. package/dist/commands/segment-pull-command.js +1 -1
  44. package/dist/commands/segment-push-command.js +1 -1
  45. package/dist/commands/segment-update-command.js +1 -1
  46. package/dist/commands/segment-use-command.js +1 -1
  47. package/dist/commands/segment-validate-command.js +1 -1
  48. package/dist/commands/segments.js +1 -1
  49. package/dist/commands/show.js +1 -1
  50. package/dist/commands/status-command.js +1 -1
  51. package/dist/commands/tables.js +1 -1
  52. package/dist/commands/unset-command.js +1 -1
  53. package/dist/commands/upgrade-command.js +1 -1
  54. package/dist/commands/use-command.js +1 -1
  55. package/dist/commands/user-command.js +1 -1
  56. package/dist/commands/work-command.js +1 -1
  57. package/dist/commands/workflow-command.js +1 -1
  58. package/dist/core/auth.js +1 -1
  59. package/dist/core/command-output.js +1 -1
  60. package/dist/core/config.js +1 -1
  61. package/dist/core/connection-cache.js +1 -1
  62. package/dist/core/constants.js +1 -1
  63. package/dist/core/credential-cache.js +1 -1
  64. package/dist/core/global-context.js +1 -1
  65. package/dist/core/keychain.js +1 -1
  66. package/dist/core/oauth-keychain.js +1 -1
  67. package/dist/core/oauth.js +1 -1
  68. package/dist/core/profile.js +1 -1
  69. package/dist/core/project-config.js +1 -1
  70. package/dist/core/session.js +1 -1
  71. package/dist/core/user-cache.js +1 -1
  72. package/dist/core/version.js +1 -1
  73. package/dist/index.js +1 -1
  74. package/dist/mcp/server.js +1 -1
  75. package/dist/mcp/tools/index.js +1 -1
  76. package/dist/mcp/tools/tdx-run.js +1 -1
  77. package/dist/mcp/tools/tdx-search.js +1 -1
  78. package/dist/mcp/tools/work-create-item.js +1 -1
  79. package/dist/mcp/utils.js +1 -1
  80. package/dist/proxy/claude-usage-tracker.js +1 -1
  81. package/dist/proxy/passthrough-server.js +1 -1
  82. package/dist/proxy/sse-usage-parser.js +1 -1
  83. package/dist/sdk/agent/agent-config.js +1 -1
  84. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  85. package/dist/sdk/agent/agent-yaml.js +1 -1
  86. package/dist/sdk/agent/test/evaluator.js +1 -1
  87. package/dist/sdk/agent/test/executor.js +1 -1
  88. package/dist/sdk/agent/test/index.js +1 -1
  89. package/dist/sdk/agent/test/output.js +1 -1
  90. package/dist/sdk/agent/test/parser.js +1 -1
  91. package/dist/sdk/agent/tool-target-registry.js +1 -1
  92. package/dist/sdk/api.js +1 -1
  93. package/dist/sdk/cas/cas-api-client.js +1 -1
  94. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  95. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  96. package/dist/sdk/cas/index.js +1 -1
  97. package/dist/sdk/cas/pull-workflow.js +1 -1
  98. package/dist/sdk/cas/push-workflow.js +1 -1
  99. package/dist/sdk/client/cdp-api-client.js +1 -1
  100. package/dist/sdk/client/delivery-api-client.js +1 -1
  101. package/dist/sdk/client/endpoints.js +1 -1
  102. package/dist/sdk/client/engage-api-client.js +1 -1
  103. package/dist/sdk/client/http-client.js +1 -1
  104. package/dist/sdk/client/llm-api-client.js +1 -1
  105. package/dist/sdk/client/oauth-refresh.js +1 -1
  106. package/dist/sdk/client/rate-limiter.js +1 -1
  107. package/dist/sdk/client/td-api-client.js +1 -1
  108. package/dist/sdk/client/trino-api-client.js +1 -1
  109. package/dist/sdk/client/workflow-client.js +1 -1
  110. package/dist/sdk/connection-validator.js +1 -1
  111. package/dist/sdk/connection.js +1 -1
  112. package/dist/sdk/delivery.js +1 -1
  113. package/dist/sdk/engage/campaign-pull.js +1 -1
  114. package/dist/sdk/engage/campaign-push.js +1 -1
  115. package/dist/sdk/engage/campaign-validator.js +1 -1
  116. package/dist/sdk/engage/campaign-yaml.js +1 -1
  117. package/dist/sdk/engage/template-pull.js +1 -1
  118. package/dist/sdk/engage/template-push.js +1 -1
  119. package/dist/sdk/engage/template-validator.js +1 -1
  120. package/dist/sdk/engage/template-yaml.js +1 -1
  121. package/dist/sdk/engage/types/campaign-def.js +1 -1
  122. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  123. package/dist/sdk/engage/types/template-schema.js +1 -1
  124. package/dist/sdk/engage.js +1 -1
  125. package/dist/sdk/errors.js +1 -1
  126. package/dist/sdk/index.js +1 -1
  127. package/dist/sdk/io/index.js +1 -1
  128. package/dist/sdk/io/node-filesystem.js +1 -1
  129. package/dist/sdk/job.js +1 -1
  130. package/dist/sdk/journey.js +1 -1
  131. package/dist/sdk/llm/chat-cache.js +1 -1
  132. package/dist/sdk/llm/index.js +1 -1
  133. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  134. package/dist/sdk/llm/model-factors.js +1 -1
  135. package/dist/sdk/personalization.js +1 -1
  136. package/dist/sdk/policy.js +1 -1
  137. package/dist/sdk/query/index.js +1 -1
  138. package/dist/sdk/query/sql-parser.js +1 -1
  139. package/dist/sdk/realtime.js +1 -1
  140. package/dist/sdk/schedule.js +1 -1
  141. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  142. package/dist/sdk/segment/fields-display.js +1 -1
  143. package/dist/sdk/segment/file-discovery.js +1 -1
  144. package/dist/sdk/segment/journey-utils.js +1 -1
  145. package/dist/sdk/segment/journey-validator.js +1 -1
  146. package/dist/sdk/segment/journey-yaml.js +1 -1
  147. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  148. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  149. package/dist/sdk/segment/pull-workflow.js +1 -1
  150. package/dist/sdk/segment/push-recovery.js +1 -1
  151. package/dist/sdk/segment/push-workflow.js +1 -1
  152. package/dist/sdk/segment/resolution-context.js +1 -1
  153. package/dist/sdk/segment/segment-path-parser.js +1 -1
  154. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  155. package/dist/sdk/segment/segment-validator.js +1 -1
  156. package/dist/sdk/segment/target-resolution.js +1 -1
  157. package/dist/sdk/segment/tdx-config.js +1 -1
  158. package/dist/sdk/segment/types/activation-schema.js +1 -1
  159. package/dist/sdk/segment/types/journey-def.js +1 -1
  160. package/dist/sdk/segment/types/journey-schema.js +1 -1
  161. package/dist/sdk/segment/types/segment-def.js +1 -1
  162. package/dist/sdk/segment/types/segment-schema.js +1 -1
  163. package/dist/sdk/segment/validate-files.js +1 -1
  164. package/dist/sdk/segment/yaml-validator.js +1 -1
  165. package/dist/sdk/segment.js +1 -1
  166. package/dist/sdk/types/index.js +1 -1
  167. package/dist/sdk/types/progress.js +1 -1
  168. package/dist/sdk/types/workspace.js +1 -1
  169. package/dist/sdk/user.js +1 -1
  170. package/dist/sdk/util/format-detector.js +1 -1
  171. package/dist/sdk/util/formatters.js +1 -1
  172. package/dist/sdk/util/index.js +1 -1
  173. package/dist/sdk/util/paginate.js +1 -1
  174. package/dist/sdk/util/tree-formatter.js +1 -1
  175. package/dist/sdk/workflow/archive-validation.js +1 -1
  176. package/dist/sdk/workflow/clone-workflow.js +1 -1
  177. package/dist/sdk/workflow/index.js +1 -1
  178. package/dist/sdk/workflow/pull-workflow.js +1 -1
  179. package/dist/sdk/workflow/push-workflow.js +1 -1
  180. package/dist/sdk/workflow/tdx-config.js +1 -1
  181. package/dist/sdk/workflow/workflow-utils.js +1 -1
  182. package/dist/sdk/workspace/access-tracker.js +1 -1
  183. package/dist/sdk/workspace/frontmatter.js +1 -1
  184. package/dist/sdk/workspace/git.js +1 -1
  185. package/dist/sdk/workspace/index.js +1 -1
  186. package/dist/sdk/workspace/templates.js +1 -1
  187. package/dist/sdk/workspace/weekly.js +1 -1
  188. package/dist/sdk/workspace/wikilinks.js +1 -1
  189. package/dist/test-utils/command-runner.js +1 -1
  190. package/dist/test-utils/factories.js +1 -1
  191. package/dist/test-utils/fixtures.js +1 -1
  192. package/dist/test-utils/http-mock.js +1 -1
  193. package/dist/test-utils/index.js +1 -1
  194. package/dist/utils/async.js +1 -1
  195. package/dist/utils/colors.js +1 -1
  196. package/dist/utils/diff.js +1 -1
  197. package/dist/utils/file-permissions.js +1 -1
  198. package/dist/utils/file-reader.js +1 -1
  199. package/dist/utils/github-releases.js +1 -1
  200. package/dist/utils/global-cache.js +1 -1
  201. package/dist/utils/json-loader.js +1 -1
  202. package/dist/utils/local-cache.js +1 -1
  203. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  204. package/dist/utils/logger/formatters/index.js +1 -1
  205. package/dist/utils/logger/handlers/console-handler.js +1 -1
  206. package/dist/utils/logger/handlers/file-handler.js +1 -1
  207. package/dist/utils/logger/handlers/index.js +1 -1
  208. package/dist/utils/logger/handlers/null-handler.js +1 -1
  209. package/dist/utils/logger/index.js +1 -1
  210. package/dist/utils/logger/logger.js +1 -1
  211. package/dist/utils/logger/types.js +1 -1
  212. package/dist/utils/option-validation.js +1 -1
  213. package/dist/utils/process.js +1 -1
  214. package/dist/utils/prompt.js +1 -1
  215. package/dist/utils/spinner.js +1 -1
  216. package/dist/utils/sse-parser.js +1 -1
  217. package/dist/utils/string-utils.js +1 -1
  218. package/dist/utils/table-ref-parser.js +1 -1
  219. package/dist/utils/tdx-logger.js +1 -1
  220. package/dist/utils/version-check.js +1 -1
  221. package/package.json +30 -12
@@ -1 +1 @@
1
- const a152_0x4fdbc8=a152_0x43de;(function(_0x57bf6e,_0x42eee9){const _0x4f3827=a152_0x43de,_0x3f4a71=_0x57bf6e();while(!![]){try{const _0x5d6e54=-parseInt(_0x4f3827(0x1d6))/0x1*(-parseInt(_0x4f3827(0x228))/0x2)+-parseInt(_0x4f3827(0x19c))/0x3+-parseInt(_0x4f3827(0x192))/0x4*(-parseInt(_0x4f3827(0x1fa))/0x5)+parseInt(_0x4f3827(0x221))/0x6+parseInt(_0x4f3827(0x240))/0x7*(-parseInt(_0x4f3827(0x15e))/0x8)+parseInt(_0x4f3827(0x15b))/0x9*(-parseInt(_0x4f3827(0x1d8))/0xa)+parseInt(_0x4f3827(0x17b))/0xb;if(_0x5d6e54===_0x42eee9)break;else _0x3f4a71['push'](_0x3f4a71['shift']());}catch(_0x256b61){_0x3f4a71['push'](_0x3f4a71['shift']());}}}(a152_0x1807,0x28d0e));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x4fdbc8(0x219));export const PENDING_SEGMENT_PREFIX=a152_0x4fdbc8(0x1e4);export const PENDING_ACTIVATION_PREFIX=a152_0x4fdbc8(0x1fd);export function createPendingSegmentId(_0x5edb86){return''+PENDING_SEGMENT_PREFIX+_0x5edb86+'__';}export function isPendingSegmentId(_0x49523d){const _0x159f8c=a152_0x4fdbc8;return _0x49523d[_0x159f8c(0x205)](PENDING_SEGMENT_PREFIX)&&!_0x49523d[_0x159f8c(0x205)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0xebd45f){return _0xebd45f['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x425cc6){return''+PENDING_ACTIVATION_PREFIX+_0x425cc6+'__';}export function isPendingActivationId(_0x5661ec){return _0x5661ec['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x27b201){const _0x1a69d7=a152_0x4fdbc8;return _0x27b201[_0x1a69d7(0x235)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x3715eb,_0x5a4202){const _0x322ce3=a152_0x4fdbc8,_0x5ba9f7=_0x3715eb+'::'+(_0x5a4202[_0x322ce3(0x17d)]()||_0x322ce3(0x1b1)),_0x4ad482=createHash('sha1')[_0x322ce3(0x1d5)](_0x5ba9f7)[_0x322ce3(0x220)](_0x322ce3(0x1e9))[_0x322ce3(0x197)](0x0,0xc);return _0x322ce3(0x25e)+_0x4ad482;}export function ensureJourneyDefaults(_0x5a6b25){const _0x5bcfea=a152_0x4fdbc8;!_0x5a6b25['description']&&(_0x5a6b25[_0x5bcfea(0x1cf)]=''),!_0x5a6b25[_0x5bcfea(0x256)]&&(_0x5a6b25[_0x5bcfea(0x256)]=_0x5bcfea(0x16b));}export function injectExistingStageIds(_0x517662,_0x51d86f){const _0x58ee89=a152_0x4fdbc8,_0x23f651=new Map(_0x51d86f[_0x58ee89(0x23f)](_0x192f28=>[_0x192f28[_0x58ee89(0x1c3)],_0x192f28['id']]));for(const _0x3cacd0 of _0x517662){if(!_0x3cacd0['id']){const _0x5a4110=_0x23f651[_0x58ee89(0x177)](_0x3cacd0[_0x58ee89(0x1c3)]);_0x5a4110&&(_0x3cacd0['id']=_0x5a4110);}}}export function resolveTDFolderPath(_0x6ff81b,_0x1088f3,_0x1c047e){const _0x3029b4=a152_0x4fdbc8;if(!_0x1088f3)return _0x6ff81b;if(_0x6ff81b===_0x1c047e||_0x6ff81b[_0x3029b4(0x205)](_0x1c047e+'/'))return _0x6ff81b;return _0x6ff81b?_0x1c047e+'/'+_0x6ff81b:_0x1c047e;}export function addFoldersToCreate(_0x3d74ca,_0xc6e682,_0x423fe3){const _0x151d9f=a152_0x4fdbc8;if(!_0x3d74ca)return;if(_0xc6e682[_0x151d9f(0x18c)](_0x3d74ca))return;const _0x43759c=_0x3d74ca[_0x151d9f(0x1c8)]('/');let _0x4a4b97='';for(const _0x30fb44 of _0x43759c){_0x4a4b97=_0x4a4b97?_0x4a4b97+'/'+_0x30fb44:_0x30fb44,!_0xc6e682[_0x151d9f(0x18c)](_0x4a4b97)&&_0x423fe3[_0x151d9f(0x1fe)](_0x4a4b97);}}export function sortFoldersByDepth(_0x3ae7e1){return[..._0x3ae7e1]['sort']((_0x36bc86,_0x1e5a26)=>{const _0x1483fd=a152_0x43de,_0x8f8a42=(_0x36bc86['match'](/\//g)||[])[_0x1483fd(0x1a4)],_0x449b47=(_0x1e5a26[_0x1483fd(0x1b6)](/\//g)||[])[_0x1483fd(0x1a4)];return _0x8f8a42-_0x449b47;});}import*as a152_0xf6b755 from'yaml';import{readFileSync}from'fs';import a152_0x552734 from'path';import{isJourneyDef,parseYamlString as a152_0x41ddad,toYamlString as a152_0x597cc5,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';function a152_0x1807(){const _0x19f015=['match','conditionSegmentId','type','activation_deleted','uniqueServerName','journeyName','Activation\x20not\x20found:\x20','rule','activation_updating','activation_deleting','delete','segment_creating','INTERNAL','name','DecisionPoint','SEGMENT_SYNTAX_ERROR','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','Creating\x20activation\x20\x27','split','index','createdSegmentIds','parseDocument','parentId','WaitStep','all_columns','description','entry_criteria','\x27...','unchanged','Duration','behavior','update','7ekLUFy','columns','120WolwcX','schedule','Stage\x20\x27','deleteActivation','existingActivation','waitStepUnit','Deleted\x20segment\x20\x27','folder_creating','ACTIVATION_SYNTAX_ERROR','folderPathToId','goal\x20criteria','Created\x20segment\x20\x27','__pending_','folderId','\x27\x20to\x20local\x20\x27','SEGMENT_NOT_FOUND','):\x20','hex','SEGMENT_UPDATE_ERROR','Matched\x20server\x20segment\x20\x27','Updated\x20segment\x20\x27','attributes','journeys','absolutePath','existingSegment','max','\x20error(s)','connector_config','push','skipSegments','data','existingSegments','verbose','stage\x20\x27','1135yUVHPQ','updated','getSegment','__pending_act_','add','embeddedSegmentNameToId','\x27\x20exit\x20criteria','Updated\x20journey\x20\x27','user','NOT_FOUND','Segment\x20not\x20found:\x20','startsWith','waitStep','activationActions','\x20activation\x20\x27','Failed\x20to\x20fetch\x20referenced\x20segment\x20','effectiveFolderId','kind','Updating\x20activation\x20\x27','parse','\x20journey\x20from\x20file:\x20','idToName','stringify','./journey-yaml.js','yamlActivation','debug','\x27\x20wait\x20condition','journey_updating','resolvedRule','hasChanges','versionNumber','tdx.sdk.push-workflow','flatMap','folder_created','logDeleted','item','embedded_activation_creating','and\x20the\x20server\x20segment,\x20then\x20retry.','digest','47010aWyMYQ','activationContext','Journey\x20\x27','segmentFolderId','entries','\x27\x20for\x20','action','19634chPgca','Activation','createJourneySegment','Entry\x20criteria:\x20','deleted','decision_point','journey_creating','./child-segment-yaml.js','deleteSegment','parentSegmentFolder','activation_template_id','Fetching\x20','\x27\x20not\x20found\x20in\x20journey\x20\x27','replace','relationships','conditions','updateSegmentById','toString','stages','progress','journeyId','rootFolderId','Creating\x20segment\x20\x27','map','6405Nlyatw','all',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','existingJourney','created','message','valid','onProgress','\x27\x20from\x20file:\x20','journeyBundleId','Updating\x20segment\x20\x27','segmentId','segment_updating','deps','exitCriterias','parentFolder','journeyById','conditionTimeoutUnit','ACTIVATION_UPDATE_ERROR','.$1.push-recovery.json','journeyBundleName','connectionIdToNameMap','state','listActivations','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','createdSegmentId','getActivation','createSegment','conditionTimeoutDuration','withProgress','journey_entry_criteria_','idToEmailMap','Creating\x20folder\x20\x27','folderPath',').\x20','segment_deleted','create','journeyBundlesByFolderAndName','91566HdVLXQ','segments','embedded_segment_creating','96FluyJv','steps','logSuccess','dirname','\x27\x20decision\x20point\x20branch\x20\x27','activations','from','Embedded\x20segment\x20\x27','diff','notification','goal','\x27\x20by\x20rule\x20content','embedded_segment_created','draft','object','getSegmentEntity','day','\x27\x20milestone','journey','Delete\x20the\x20push\x20recovery\x20file\x20(','errors','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','journeyStages','Updated\x20activation\x20\x27','resolveJourneyId','get','validatedRequest','reduce','isNew','3411826ojmqFJ','Failed\x20to\x20resolve\x20activation\x20','trim','createActivation','milestone','nameToType','set','waitStepType','some','toISOString','connection','localName','logWarning','toLowerCase','\x20segment\x20from\x20file:\x20','Created\x20folder\x20\x27','yamlConfig','has','getLatestJourneyId','Failed\x20to\x20','list','with','\x27\x20entry\x20criteria','392sgfMjK','activation_','\x20(referenced\x20in\x20journey\x20','Created\x20journey\x20\x27','filter','slice','updateActivation','JOURNEY_UPDATE_ERROR','utf-8','entry','326148hqBeUY','\x0a\x20\x20','segmentNameToId','entryCriteria','Segment\x20not\x20found','relative','size','isArray','length','join','sort','find','segment_updated','activation_created','getJourney','resolveSegment','branches','../../utils/async.js','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','run_after_journey_refresh','JOURNEY_SYNTAX_ERROR','segment','keys','journey_created','journeyActivationStepId','nameToId'];a152_0x1807=function(){return _0x19f015;};return a152_0x1807();}function a152_0x43de(_0x5cc36e,_0x3fcc65){_0x5cc36e=_0x5cc36e-0x155;const _0x1807ac=a152_0x1807();let _0x43de6c=_0x1807ac[_0x5cc36e];return _0x43de6c;}import{validateJourneyDef}from'./journey-validator.js';function stableStringify(_0x3fbffb){const _0x35defc=a152_0x4fdbc8;if(Array[_0x35defc(0x1a3)](_0x3fbffb))return'['+_0x3fbffb[_0x35defc(0x23f)](_0x46b37a=>stableStringify(_0x46b37a))[_0x35defc(0x1a5)](',')+']';if(_0x3fbffb&&typeof _0x3fbffb===_0x35defc(0x16c)){const _0x58f3ac=_0x3fbffb,_0x31a46f=Object['keys'](_0x58f3ac)['sort'](),_0x126681=_0x31a46f['map'](_0x320296=>'\x22'+_0x320296+'\x22:'+stableStringify(_0x58f3ac[_0x320296]));return'{'+_0x126681[_0x35defc(0x1a5)](',')+'}';}const _0x3b15d9=JSON[_0x35defc(0x210)](_0x3fbffb);return _0x3b15d9===undefined?'null':_0x3b15d9;}function activationSignature(_0x4e439f){const _0x3c8254=a152_0x4fdbc8,_0x4c1027={'connection':_0x4e439f[_0x3c8254(0x185)],..._0x4e439f[_0x3c8254(0x1ce)]!==undefined&&{'all_columns':_0x4e439f[_0x3c8254(0x1ce)]},..._0x4e439f[_0x3c8254(0x1d7)]!==undefined&&{'columns':_0x4e439f[_0x3c8254(0x1d7)]},..._0x4e439f[_0x3c8254(0x1d4)]!==undefined&&{'behavior':_0x4e439f[_0x3c8254(0x1d4)]},..._0x4e439f[_0x3c8254(0x1d9)]!==undefined&&{'schedule':_0x4e439f[_0x3c8254(0x1d9)]},..._0x4e439f[_0x3c8254(0x167)]!==undefined&&{'notification':_0x4e439f[_0x3c8254(0x167)]},..._0x4e439f[_0x3c8254(0x1f3)]!==undefined&&{'connector_config':_0x4e439f['connector_config']},..._0x4e439f[_0x3c8254(0x232)]!==undefined&&{'activation_template_id':_0x4e439f[_0x3c8254(0x232)]}};return stableStringify(_0x4c1027);}async function fetchSegment(_0x30a0e9,_0x55c489,_0x4ef737,_0x475e77){const _0x37bf3a=a152_0x4fdbc8,_0x5021da=_0x475e77?.['find'](_0x10e300=>_0x10e300['id']===_0x4ef737);if(_0x5021da)return _0x5021da;try{return await _0x30a0e9['segment'][_0x37bf3a(0x1fc)](_0x55c489,_0x4ef737);}catch(_0x34716f){logger[_0x37bf3a(0x213)]('getSegment\x20failed\x20for\x20'+_0x4ef737+_0x37bf3a(0x242)+_0x34716f);try{return await _0x30a0e9[_0x37bf3a(0x1b1)][_0x37bf3a(0x16d)](_0x4ef737);}catch(_0x314e3d){return logger['debug']('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x4ef737+':\x20'+_0x314e3d),null;}}}function recoverSegmentIdsFromPushRecovery(_0x10fdd8,_0xa83291,_0x2c4bb4){const _0x55fa2c=a152_0x4fdbc8,_0x59bef6=readPushRecovery(_0x10fdd8['absolutePath']);if(_0x59bef6?.[_0x55fa2c(0x1bb)]===_0x10fdd8[_0x55fa2c(0x18b)][_0x55fa2c(0x1c3)])for(const [_0x500f2d,_0x4be8b4]of Object[_0x55fa2c(0x225)](_0x59bef6[_0x55fa2c(0x15c)])){const _0x32bd2f=generateDeterministicJourneySegmentName(_0x10fdd8[_0x55fa2c(0x18b)][_0x55fa2c(0x1c3)],_0x500f2d);_0x4be8b4[_0x55fa2c(0x1ba)]===_0x32bd2f&&(_0xa83291['set'](_0x500f2d,_0x4be8b4[_0x55fa2c(0x24b)]),_0x2c4bb4[_0x55fa2c(0x181)](_0x500f2d,_0x4be8b4['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x57df9a,_0x1309ec,_0x480744,_0x56c277){const _0x2f66b6=a152_0x4fdbc8;let _0x4a0477;try{_0x4a0477=await _0x57df9a[_0x2f66b6(0x1b1)][_0x2f66b6(0x22a)]({'name':_0x480744['uniqueSegmentName'],'description':_0x480744[_0x2f66b6(0x1cf)],'journeyId':_0x480744[_0x2f66b6(0x23c)],'rule':_0x56c277(_0x480744[_0x2f66b6(0x216)],!![]),'countPopulation':!![],'parentFolderId':_0x480744[_0x2f66b6(0x1e5)],'audienceId':_0x480744[_0x2f66b6(0x1cc)]});}catch(_0x47b87c){const _0x11282f=_0x47b87c instanceof Error&&_0x47b87c[_0x2f66b6(0x245)]['includes']('Name\x20has\x20already\x20been\x20taken');if(_0x11282f){const _0x2c0dfd=readPushRecovery(_0x1309ec[_0x2f66b6(0x1ef)]),_0x553fb3=_0x2c0dfd?.[_0x2f66b6(0x1bb)]===_0x1309ec['yamlConfig'][_0x2f66b6(0x1c3)]?_0x2c0dfd[_0x2f66b6(0x15c)][_0x480744[_0x2f66b6(0x186)]]:undefined;if(_0x553fb3?.['uniqueServerName']===_0x480744['uniqueSegmentName'])await _0x57df9a['segment']['updateSegmentById'](_0x480744['parentId'],_0x553fb3[_0x2f66b6(0x24b)],{'description':_0x480744[_0x2f66b6(0x1cf)],'rule':_0x56c277(_0x480744['resolvedRule'],!![]),'countPopulation':!![]}),_0x4a0477=_0x553fb3['segmentId'];else throw new SDKError(ErrorCode[_0x2f66b6(0x1ea)],_0x2f66b6(0x165)+_0x480744['localName']+_0x2f66b6(0x1c6)+(_0x2f66b6(0x171)+_0x1309ec[_0x2f66b6(0x1ef)][_0x2f66b6(0x235)](/([^/]+)$/,_0x2f66b6(0x253))+')\x20')+_0x2f66b6(0x21f),_0x47b87c);}else throw _0x47b87c;}return saveSegmentToPushRecovery(_0x1309ec[_0x2f66b6(0x1ef)],_0x1309ec[_0x2f66b6(0x18b)][_0x2f66b6(0x1c3)],_0x480744[_0x2f66b6(0x186)],{'segmentId':_0x4a0477,'uniqueServerName':_0x480744['uniqueSegmentName'],'createdAt':new Date()[_0x2f66b6(0x184)]()}),_0x4a0477;}export async function prepareSegmentFiles(_0x439fa1,_0x3900dc,_0x5b6984,_0x326fd1,_0x2a0108){const _0x4d430e=a152_0x4fdbc8,{activationDefToCreateRequest:_0x1e718a}=await import(_0x4d430e(0x22f)),_0x1d0cde=[],_0x3b425d=new Set();for(const {yamlConfig:_0x24a5b4,folderPath:_0x3cfc5d,sourcePath:_0xde61e5}of _0x439fa1){const _0x35b5af=resolveTDFolderPath(_0x3cfc5d,_0x326fd1,_0x2a0108),_0x44fb05=_0x35b5af+':'+_0x24a5b4['name'],_0x4dd6c6=_0x3900dc['segmentByFolderAndName'][_0x4d430e(0x177)](_0x44fb05),_0x37ae75=_0x4dd6c6?_0x3900dc['activationsBySegmentId'][_0x4d430e(0x177)](_0x4dd6c6['id'])||[]:[];addFoldersToCreate(_0x35b5af,_0x3900dc['folderPathToId'],_0x3b425d);const _0x5bdb78=calculateActivationActions(_0x24a5b4['activations']||[],_0x37ae75,_0x3900dc[_0x4d430e(0x25f)],_0x3900dc['connectionIdToNameMap']);for(const _0x54a5cf of _0x5bdb78){(_0x54a5cf['type']==='create'||_0x54a5cf[_0x4d430e(0x1b8)]==='update')&&_0x54a5cf[_0x4d430e(0x212)]&&(_0x54a5cf['validatedRequest']=await _0x1e718a(_0x54a5cf[_0x4d430e(0x212)],_0x5b6984));}const _0x30ab54=calculateSegmentDiff(_0x24a5b4,_0x4dd6c6,_0x37ae75,_0x3900dc[_0x4d430e(0x25f)],_0x3900dc[_0x4d430e(0x255)]);_0x1d0cde[_0x4d430e(0x1f4)]({'relativePath':_0x24a5b4[_0x4d430e(0x1c3)],'absolutePath':_0xde61e5,'yamlConfig':_0x24a5b4,'folderPath':_0x35b5af,'existingSegment':_0x4dd6c6,'existingActivations':_0x37ae75,'isNew':_0x30ab54[_0x4d430e(0x17a)],'hasChanges':_0x30ab54[_0x4d430e(0x217)],'diff':_0x30ab54['diff'],'activationActions':_0x5bdb78});}return{'segmentFiles':_0x1d0cde,'foldersToCreate':_0x3b425d};}export async function prepareJourneyFiles(_0x4fb673,_0x410e9a,_0x5c027e,_0x45b833){const _0x6f45fb=a152_0x4fdbc8,_0x2cb610=[],_0x23fb75=new Set();for(const {yamlConfig:_0x2fb401,folderPath:_0x2ec13b,sourcePath:_0x2341ff}of _0x4fb673){const _0x427324=resolveTDFolderPath(_0x2ec13b,_0x5c027e,_0x45b833),_0x5d4976=_0x427324+':'+_0x2fb401['name'],_0x1bedb6=_0x410e9a[_0x6f45fb(0x15a)][_0x6f45fb(0x177)](_0x5d4976);let _0x56aae7,_0x144b84;if(_0x1bedb6&&_0x1bedb6[_0x6f45fb(0x1a4)]>0x0){const _0x316c3e=buildLocalExpandedRuleMappings(_0x2fb401),{createYamlContext:_0x260005,prefetchJourneySegments:_0x3d3816}=createPushYamlContextForBundle(_0x410e9a['deps'],_0x410e9a['parentId'],_0x410e9a[_0x6f45fb(0x1f7)],_0x316c3e,_0x410e9a[_0x6f45fb(0x25f)],_0x410e9a[_0x6f45fb(0x255)],_0x410e9a['activationStepsById'],_0x410e9a[_0x6f45fb(0x250)]);await _0x3d3816(_0x1bedb6['map'](_0x7fceda=>_0x7fceda['id']));const _0xf75f78=await _0x410e9a[_0x6f45fb(0x24d)][_0x6f45fb(0x170)][_0x6f45fb(0x18d)](_0x1bedb6[0x0][_0x6f45fb(0x249)]),_0x267fec=hasMultipleVersions(_0x2fb401),_0x5b12c7=async _0x540862=>{const _0x590ac3=_0x6f45fb,_0x3f54c6=_0x410e9a[_0x590ac3(0x250)]?.[_0x590ac3(0x177)](_0x540862);if(_0x3f54c6)return _0x3f54c6;return _0x410e9a['fetchJourney']({'journeyId':_0x540862,'journeyName':_0x2fb401[_0x590ac3(0x1c3)],'isMultiVersion':_0x1bedb6[_0x590ac3(0x1a4)]>0x1});};if(_0x267fec&&_0x1bedb6[_0x6f45fb(0x1a4)]>0x1){const _0x288c1f=[];for(const _0x4e8b0a of _0x1bedb6){const _0x4fa8b7=_0x4e8b0a[_0x6f45fb(0x218)]||0x1;_0x410e9a[_0x6f45fb(0x23b)]?.['update'](_0x6f45fb(0x233)+_0x2fb401[_0x6f45fb(0x1c3)]+'\x20v'+_0x4fa8b7);const _0x1715ac=await _0x5b12c7(_0x4e8b0a['id']),_0x84c187=_0x260005(_0x4e8b0a['id']),_0x5633e2=await journeyResponseToDef(_0x1715ac,_0x84c187);_0x288c1f[_0x6f45fb(0x1f4)]({'item':_0x4e8b0a,'yaml':_0x5633e2});}const _0x57edd6=buildLocalRuleToNameMappingFromJourney(_0x2fb401);_0x144b84=buildMergedJourneyDef(_0x288c1f,_0x57edd6,_0xf75f78);const _0x21f87f=Math['max'](..._0x288c1f[_0x6f45fb(0x23f)](_0x1f572f=>_0x1f572f[_0x6f45fb(0x21d)]['versionNumber']||0x0)),_0x6252d7=_0x1bedb6[_0x6f45fb(0x1a7)](_0x167030=>(_0x167030[_0x6f45fb(0x218)]||0x0)===_0x21f87f);_0x6252d7&&(_0x410e9a[_0x6f45fb(0x23b)]?.['update'](_0x6f45fb(0x233)+_0x2fb401['name']+'\x20v'+_0x21f87f),_0x56aae7=await _0x5b12c7(_0x6252d7['id']));}else{const _0x270518=_0x1bedb6[_0x1bedb6[_0x6f45fb(0x1a4)]-0x1];_0x410e9a[_0x6f45fb(0x23b)]?.['update']('Fetching\x20'+_0x2fb401[_0x6f45fb(0x1c3)]),_0x56aae7=await _0x5b12c7(_0x270518['id']);const _0x43adc0=_0x260005(_0x270518['id']),_0x42da3d=await journeyResponseToDef(_0x56aae7,_0x43adc0),_0x109db9=buildLocalRuleToNameMappingFromJourney(_0x2fb401);_0x144b84=buildMergedJourneyDef([{'item':_0x270518,'yaml':_0x42da3d}],_0x109db9,_0xf75f78);}}addFoldersToCreate(_0x427324,_0x410e9a[_0x6f45fb(0x1e1)],_0x23fb75);const _0x3e2dd9=calculateJourneyDiff(_0x2fb401,_0x144b84);_0x2cb610[_0x6f45fb(0x1f4)]({'relativePath':_0x2fb401[_0x6f45fb(0x1c3)],'absolutePath':_0x2341ff,'yamlConfig':_0x2fb401,'folderPath':_0x427324,'existingJourney':_0x56aae7,'isNew':_0x3e2dd9[_0x6f45fb(0x17a)],'hasChanges':_0x3e2dd9['hasChanges'],'diff':_0x3e2dd9[_0x6f45fb(0x166)]});}return{'journeyFiles':_0x2cb610,'foldersToCreate':_0x23fb75};}export function calculateActivationActions(_0x2ad2ab,_0x3d92e4,_0x5cdc9f,_0x5b72de){const _0x2c1058=a152_0x4fdbc8,_0x57f8e9=[],_0x49a282=new Map();for(const _0xdb3714 of _0x3d92e4){_0x49a282['set'](_0xdb3714[_0x2c1058(0x1c3)],_0xdb3714);}const _0x14e3bb=new Map();for(const _0x8071af of _0x2ad2ab){_0x14e3bb[_0x2c1058(0x181)](_0x8071af[_0x2c1058(0x1c3)],_0x8071af);}for(const _0x491e8a of _0x2ad2ab){const _0x430e60=_0x49a282[_0x2c1058(0x177)](_0x491e8a['name']);if(!_0x430e60)_0x57f8e9[_0x2c1058(0x1f4)]({'type':_0x2c1058(0x159),'name':_0x491e8a[_0x2c1058(0x1c3)],'yamlActivation':_0x491e8a});else{const _0x3381be=activationResponseToDef(_0x430e60,_0x5cdc9f,_0x5b72de),_0x2816db=a152_0xf6b755['stringify'](_0x3381be),_0x1888ac=a152_0xf6b755[_0x2c1058(0x210)](_0x491e8a);_0x2816db!==_0x1888ac&&_0x57f8e9[_0x2c1058(0x1f4)]({'type':_0x2c1058(0x1d5),'name':_0x491e8a[_0x2c1058(0x1c3)],'yamlActivation':_0x491e8a,'existingActivation':_0x430e60});}}for(const _0x35344f of _0x3d92e4){!_0x14e3bb[_0x2c1058(0x18c)](_0x35344f[_0x2c1058(0x1c3)])&&_0x57f8e9[_0x2c1058(0x1f4)]({'type':_0x2c1058(0x1c0),'name':_0x35344f[_0x2c1058(0x1c3)],'existingActivation':_0x35344f});}return _0x57f8e9;}function calculateYamlDiff(_0x2b85c6,_0x2618e3){if(_0x2618e3){const _0x229709=generateDiff(_0x2618e3,_0x2b85c6),_0x1dd202=hasChanges(_0x229709);return{'isNew':![],'hasChanges':_0x1dd202,'diff':_0x1dd202?formatDiffWithColors(_0x229709):undefined};}const _0x2f4960=generateDiff('',_0x2b85c6);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x2f4960)};}export function calculateSegmentDiff(_0x4bd490,_0x425e13,_0x541f20,_0x22c60d,_0x50b5c2){const _0x4ef9a6=segmentToYamlString(_0x4bd490),_0x402dd1=_0x425e13?segmentToYamlString(segmentWithActivationsToYaml(_0x425e13,_0x541f20,undefined,_0x22c60d,_0x50b5c2)):undefined;return calculateYamlDiff(_0x4ef9a6,_0x402dd1);}export function calculateJourneyDiff(_0x334149,_0x4782f5){const _0x51e27f=normalizeJourneyDef(_0x334149,_0x334149),_0x3d3b0b=a152_0x597cc5(_0x51e27f),_0x26c8ac=_0x4782f5?a152_0x597cc5(normalizeJourneyDef(_0x4782f5,_0x334149)):undefined;return calculateYamlDiff(_0x3d3b0b,_0x26c8ac);}export function findSegmentsToDelete(_0x187bb2,_0xee2649,_0x210058,_0x2ed1c9,_0x2e9f92){const _0x34e75e=a152_0x4fdbc8,_0x1c61af=new Set();for(const {yamlConfig:_0x4c23bf,folderPath:_0x36d521}of _0xee2649){_0x1c61af[_0x34e75e(0x1fe)](_0x36d521+':'+_0x4c23bf['name']);}return _0x187bb2[_0x34e75e(0x196)](_0x307718=>{const _0x4a4809=_0x34e75e,_0x28944b=_0x307718[_0x4a4809(0x224)]?_0x210058['get'](_0x307718['segmentFolderId'][_0x4a4809(0x239)]())||'':'',_0x4e0b78=_0x28944b+':'+_0x307718['name'];if(_0x1c61af['has'](_0x4e0b78))return![];if(_0x2e9f92)return _0x28944b===_0x2ed1c9||_0x28944b[_0x4a4809(0x205)](_0x2ed1c9+'/');return!![];});}export function findJourneysToDelete(_0x135761,_0x390e4c,_0xb80af9,_0x3e019d,_0xe7594){const _0x4dfb00=a152_0x4fdbc8,_0xa84a89=new Set();for(const {yamlConfig:_0xd72cdd,folderPath:_0x4fb72b}of _0x390e4c){_0xa84a89[_0x4dfb00(0x1fe)](_0x4fb72b+':'+_0xd72cdd[_0x4dfb00(0x1c3)]);}return _0x135761[_0x4dfb00(0x196)](_0x2cce64=>{const _0x31d483=_0x4dfb00,_0x299298=_0x2cce64[_0x31d483(0x1e5)]?_0xb80af9[_0x31d483(0x177)](_0x2cce64[_0x31d483(0x1e5)])||'':'',_0x846786=_0x299298+':'+_0x2cce64[_0x31d483(0x254)];if(_0xa84a89[_0x31d483(0x18c)](_0x846786))return![];if(_0xe7594)return _0x299298===_0x3e019d||_0x299298[_0x31d483(0x205)](_0x3e019d+'/');return!![];});}export function buildSegmentLookupMap(_0x5088d4,_0x134546){const _0x3d19a8=a152_0x4fdbc8,_0x1c70c4=new Map();for(const _0x5399a5 of _0x5088d4){const _0x226004=_0x5399a5[_0x3d19a8(0x224)]?_0x134546[_0x3d19a8(0x177)](_0x5399a5[_0x3d19a8(0x224)][_0x3d19a8(0x239)]())||'':'',_0x7e9954=_0x226004+':'+_0x5399a5['name'];_0x1c70c4['set'](_0x7e9954,_0x5399a5);}return _0x1c70c4;}export function buildSegmentNameToIdMap(_0x2db1c4){const _0x421956=a152_0x4fdbc8,_0x16ebaa=new Map();for(const _0x3cdda2 of _0x2db1c4){_0x16ebaa[_0x421956(0x181)](_0x3cdda2[_0x421956(0x1c3)],_0x3cdda2['id']);}return _0x16ebaa;}export function buildJourneyBundleLookupMap(_0x50220c,_0x59e259){const _0x8c47f2=a152_0x4fdbc8,_0x92a941=new Map();for(const _0x10c2b0 of _0x50220c){const _0xb3db68=_0x10c2b0[_0x8c47f2(0x1e5)]?_0x59e259['get'](_0x10c2b0[_0x8c47f2(0x1e5)])||'':'',_0x2f9ba1=_0xb3db68+':'+_0x10c2b0[_0x8c47f2(0x254)];!_0x92a941['has'](_0x2f9ba1)&&_0x92a941[_0x8c47f2(0x181)](_0x2f9ba1,[]),_0x92a941[_0x8c47f2(0x177)](_0x2f9ba1)[_0x8c47f2(0x1f4)](_0x10c2b0);}for(const _0x1ee03f of _0x92a941['values']()){_0x1ee03f[_0x8c47f2(0x1a6)]((_0x161ab8,_0x32e2da)=>(_0x161ab8[_0x8c47f2(0x218)]||0x0)-(_0x32e2da[_0x8c47f2(0x218)]||0x0));}return _0x92a941;}export function collectFoldersToCreate(_0x5e11fc,_0x2ac604){const _0x228469=a152_0x4fdbc8,_0x3cda1e=new Set();for(const _0x1d99e4 of _0x5e11fc){if(!_0x1d99e4)continue;if(_0x2ac604[_0x228469(0x18c)](_0x1d99e4))continue;const _0x4496b0=_0x1d99e4[_0x228469(0x1c8)]('/');let _0x145f0c='';for(const _0x5cef7a of _0x4496b0){_0x145f0c=_0x145f0c?_0x145f0c+'/'+_0x5cef7a:_0x5cef7a,!_0x2ac604[_0x228469(0x18c)](_0x145f0c)&&_0x3cda1e[_0x228469(0x1fe)](_0x145f0c);}}return _0x3cda1e;}export function parseAndClassifyYamlFiles(_0x1aad48,_0x26ff83,_0x49db41){const _0x29789b=a152_0x4fdbc8,_0x3695b9=[],_0xe17382=[];for(const _0x2e8ddb of _0x1aad48){const _0x409e24=a152_0x552734[_0x29789b(0x1a1)](_0x26ff83,a152_0x552734[_0x29789b(0x161)](_0x2e8ddb)),_0x4a2d45=_0x409e24==='.'?'':_0x409e24[_0x29789b(0x235)](/\\/g,'/'),_0x44ea4d=readFileSync(_0x2e8ddb,_0x29789b(0x19a)),_0x528242=a152_0xf6b755['parse'](_0x44ea4d);if(isJourneyDef(_0x528242)){const _0x4ea303=a152_0x41ddad(_0x44ea4d);_0xe17382['push']({'yamlConfig':_0x4ea303,'folderPath':_0x4a2d45,'sourcePath':_0x2e8ddb});}else{if(!_0x49db41?.[_0x29789b(0x1f5)]){const _0x36eb45=parseSegmentYamlFile(_0x44ea4d),_0x112898=normalizeChildSegmentYaml(_0x36eb45);_0x3695b9[_0x29789b(0x1f4)]({'yamlConfig':_0x112898,'folderPath':_0x4a2d45,'sourcePath':_0x2e8ddb});}}}return{'segments':_0x3695b9,'journeys':_0xe17382};}export function validateParsedFiles(_0x4f2758,_0x159c91){const _0x4325c3=a152_0x4fdbc8,_0xd3743f=[];for(const {yamlConfig:_0x16a752,sourcePath:_0xd01d05}of _0x4f2758[_0x4325c3(0x15c)]){const _0x4af187=readFileSync(_0xd01d05,_0x4325c3(0x19a)),_0x1818bf=a152_0xf6b755[_0x4325c3(0x1cb)](_0x4af187),_0x45a537=validateSegmentDef(_0x16a752,{'source':_0x4af187,'document':_0x1818bf},{'skipSchema':!![]});if(!_0x45a537['valid']){const _0x5de394=a152_0x552734['relative'](_0x159c91,_0xd01d05);_0xd3743f[_0x4325c3(0x1f4)]({'filePath':_0x5de394,'source':_0x4af187,'result':_0x45a537,'isJourney':![]});}}for(const {yamlConfig:_0x3a1035,sourcePath:_0x460296}of _0x4f2758[_0x4325c3(0x1ee)]){const _0xc6ca97=readFileSync(_0x460296,_0x4325c3(0x19a)),_0x1c6734=a152_0xf6b755[_0x4325c3(0x1cb)](_0xc6ca97),_0x40bc17=validateJourneyDef(_0x3a1035,{'source':_0xc6ca97,'document':_0x1c6734},{'skipSchema':!![]});if(!_0x40bc17[_0x4325c3(0x246)]){const _0x42165e=a152_0x552734[_0x4325c3(0x1a1)](_0x159c91,_0x460296);_0xd3743f[_0x4325c3(0x1f4)]({'filePath':_0x42165e,'source':_0xc6ca97,'result':_0x40bc17,'isJourney':!![]});}}return _0xd3743f;}export function formatValidationErrors(_0x19180f){const _0x382698=a152_0x4fdbc8,_0x1e5a73=[];for(const {filePath:_0x167ad1,source:_0x196575,result:_0x5e9223,isJourney:_0x157b21}of _0x19180f){const _0x444bfa=_0x157b21?_0x382698(0x170):_0x382698(0x1b1);_0x1e5a73[_0x382698(0x1f4)]('\x0a'+_0x167ad1+'\x20('+_0x444bfa+_0x382698(0x1e8)+_0x5e9223[_0x382698(0x172)]['length']+_0x382698(0x1f2)),_0x1e5a73[_0x382698(0x1f4)](formatValidationResult(_0x5e9223,_0x196575,_0x167ad1));}return _0x1e5a73[_0x382698(0x1a5)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x33ce00){const _0x51e670=a152_0x4fdbc8,_0x24e6fd=new Set(),_0x1f4a00=new Map(),_0x156075=collectSegmentUsageCounts(_0x33ce00);if(_0x33ce00[_0x51e670(0x15c)])for(const [_0x2abfd9,_0x26036b]of Object[_0x51e670(0x225)](_0x33ce00[_0x51e670(0x15c)])){_0x24e6fd['add'](_0x2abfd9);if(_0x26036b[_0x51e670(0x1bd)]){const _0x5d1814=yamlRuleToApi(_0x26036b[_0x51e670(0x1bd)]),_0x41e282=apiRuleToYaml(_0x5d1814);_0x1f4a00['set'](_0x2abfd9,_0x41e282);}}const _0x50cde4=new Map();let _0x7be26d=0x0;for(const [_0x27419e,_0x26fb66]of _0x1f4a00){const _0x5dd0fa=serializeExpandedRule(_0x26fb66,_0x1f4a00),_0x7c072e=_0x50cde4['get'](_0x5dd0fa)||[];_0x7c072e[_0x51e670(0x1f4)]({'name':_0x27419e,'index':_0x7be26d}),_0x50cde4['set'](_0x5dd0fa,_0x7c072e),_0x7be26d++;}const _0x29398d=new Map();for(const [_0x4b7c65,_0x2dbbab]of _0x50cde4){const _0x2c6193=_0x2dbbab['slice']()[_0x51e670(0x1a6)]((_0x3f1227,_0x1e59f9)=>{const _0x2f2265=_0x51e670,_0x429117=_0x156075[_0x2f2265(0x177)](_0x3f1227[_0x2f2265(0x1c3)])||0x0,_0x16ec37=_0x156075[_0x2f2265(0x177)](_0x1e59f9[_0x2f2265(0x1c3)])||0x0;if(_0x429117!==_0x16ec37)return _0x16ec37-_0x429117;return _0x3f1227[_0x2f2265(0x1c9)]-_0x1e59f9[_0x2f2265(0x1c9)];})[_0x51e670(0x23f)](_0x3ff576=>_0x3ff576[_0x51e670(0x1c3)]),_0x5ed9e3=[];for(const _0x125032 of _0x2c6193){const _0x3b67bb=_0x156075[_0x51e670(0x177)](_0x125032)||0x0,_0x182e25=Math[_0x51e670(0x1f1)](_0x3b67bb,0x1);for(let _0x4413fe=0x0;_0x4413fe<_0x182e25;_0x4413fe++){_0x5ed9e3[_0x51e670(0x1f4)](_0x125032);}}_0x29398d[_0x51e670(0x181)](_0x4b7c65,_0x5ed9e3);}return{'existingLocalSegmentNames':_0x24e6fd,'localSegmentRules':_0x1f4a00,'localExpandedRuleToNames':_0x29398d};}export function createSegmentIdResolver(_0xe39c54,_0x4da999){return async _0x3438c5=>{const _0x58b2b8=a152_0x43de,_0x52e8c2=_0xe39c54[_0x58b2b8(0x177)](_0x3438c5);if(!_0x52e8c2)throw new SDKError(ErrorCode[_0x58b2b8(0x1e7)],_0x58b2b8(0x204)+_0x3438c5+_0x58b2b8(0x1ae)+_0x4da999+'\x27)');return _0x52e8c2;};}export function extractRootFolderId(_0x4c1bbf){const _0x367d2b=a152_0x4fdbc8;return _0x4c1bbf[_0x367d2b(0x236)]?.[_0x367d2b(0x231)]?.[_0x367d2b(0x1f6)]?.['id']||_0x4c1bbf[_0x367d2b(0x236)]?.[_0x367d2b(0x24f)]?.[_0x367d2b(0x1f6)]?.['id'];}export function buildConnectionMaps(_0x3afc7a){const _0x3da616=a152_0x4fdbc8,_0x1d1ae7=new Map(),_0x52e9e9=new Map(),_0x3b94f9=new Map();for(const _0x550c91 of _0x3afc7a){_0x1d1ae7[_0x3da616(0x181)](_0x550c91[_0x3da616(0x1c3)],parseInt(_0x550c91['id'],0xa)),_0x52e9e9[_0x3da616(0x181)](_0x550c91['id'],_0x550c91[_0x3da616(0x1c3)]),_0x3b94f9[_0x3da616(0x181)](_0x550c91[_0x3da616(0x1c3)],_0x550c91[_0x3da616(0x1b8)]);}return{'nameToId':_0x1d1ae7,'idToName':_0x52e9e9,'nameToType':_0x3b94f9};}export function calculatePushStats(_0x27472f,_0x37764a,_0x4eb3c9,_0x4c2235,_0x546a06,_0x3e39f8,_0x303fc7){const _0x3afc00=a152_0x4fdbc8,_0x4bc737=_0x27472f[_0x3afc00(0x196)](_0x183ef4=>_0x183ef4[_0x3afc00(0x17a)]),_0x39c5d4=_0x27472f[_0x3afc00(0x196)](_0x37cd97=>!_0x37cd97[_0x3afc00(0x17a)]&&_0x37cd97['hasChanges']),_0x337347=_0x27472f['filter'](_0x3996d8=>!_0x3996d8[_0x3afc00(0x17a)]&&!_0x3996d8[_0x3afc00(0x217)]),_0x5cda4f=_0x3e39f8?_0x4c2235:[],_0x1316f3=_0x37764a[_0x3afc00(0x196)](_0x42a348=>_0x42a348[_0x3afc00(0x17a)]),_0x1a77fe=_0x37764a['filter'](_0x41dce0=>!_0x41dce0[_0x3afc00(0x17a)]&&_0x41dce0[_0x3afc00(0x217)]),_0x2c6f50=_0x37764a[_0x3afc00(0x196)](_0x23e69b=>!_0x23e69b[_0x3afc00(0x17a)]&&!_0x23e69b[_0x3afc00(0x217)]),_0x4c8f2c=_0x3e39f8?_0x546a06:[],_0xd5ef37=_0x27472f[_0x3afc00(0x21a)](_0x512275=>_0x512275[_0x3afc00(0x207)]),_0x2182d3=_0xd5ef37[_0x3afc00(0x196)](_0x711fba=>_0x711fba[_0x3afc00(0x1b8)]==='create'),_0x35b600=_0xd5ef37['filter'](_0x5020d5=>_0x5020d5['type']==='update'),_0x5b3fc3=_0xd5ef37[_0x3afc00(0x196)](_0xd02215=>_0xd02215[_0x3afc00(0x1b8)]===_0x3afc00(0x1c0)),_0x1ad17d=Array[_0x3afc00(0x164)](_0x4eb3c9)[_0x3afc00(0x1a6)](),_0x50eba9=_0x303fc7?![]:_0x4bc737[_0x3afc00(0x1a4)]>0x0||_0x39c5d4[_0x3afc00(0x1a4)]>0x0||_0x5cda4f[_0x3afc00(0x1a4)]>0x0,_0x4f5d63=_0x1316f3[_0x3afc00(0x1a4)]>0x0||_0x1a77fe[_0x3afc00(0x1a4)]>0x0||_0x4c8f2c[_0x3afc00(0x1a4)]>0x0,_0x2bd9d0=_0x303fc7?![]:_0xd5ef37[_0x3afc00(0x1a4)]>0x0,_0x24617c=_0x1ad17d[_0x3afc00(0x1a4)]>0x0;return{'segments':{'new':_0x4bc737,'changed':_0x39c5d4,'unchanged':_0x337347,'toDelete':_0x5cda4f},'journeys':{'new':_0x1316f3,'changed':_0x1a77fe,'unchanged':_0x2c6f50,'toDelete':_0x4c8f2c},'activations':{'all':_0xd5ef37,'toCreate':_0x2182d3,'toUpdate':_0x35b600,'toDelete':_0x5b3fc3},'folders':{'toCreate':_0x1ad17d},'counts':{'segments':{'new':_0x4bc737['length'],'changed':_0x39c5d4[_0x3afc00(0x1a4)],'unchanged':_0x337347[_0x3afc00(0x1a4)],'toDelete':_0x5cda4f[_0x3afc00(0x1a4)]},'journeys':{'new':_0x1316f3[_0x3afc00(0x1a4)],'changed':_0x1a77fe[_0x3afc00(0x1a4)],'unchanged':_0x2c6f50[_0x3afc00(0x1a4)],'toDelete':_0x4c8f2c[_0x3afc00(0x1a4)]},'activations':{'create':_0x2182d3[_0x3afc00(0x1a4)],'update':_0x35b600[_0x3afc00(0x1a4)],'delete':_0x5b3fc3[_0x3afc00(0x1a4)]},'folders':_0x1ad17d[_0x3afc00(0x1a4)]},'hasChanges':_0x50eba9||_0x4f5d63||_0x2bd9d0||_0x24617c};}export async function buildPushExecutionContext(_0x2c2691,_0xf02872,_0x119f26,_0x2eb0e1,_0x2f75d2,_0x4e24c1){const _0x5160c7=a152_0x4fdbc8,_0x4897e2=extractRootFolderId(_0x119f26),{pathToId:_0x2e183e,idToPath:_0x1f39da}=buildFolderMaps(_0x2f75d2),_0x210920=buildSegmentNameToIdMap(_0x2eb0e1),_0x47b7e7=new Map(),{batchAsync:_0x474845}=await import(_0x5160c7(0x1ad)),[_0x32e0ac,_0x2f07ce]=await Promise['all']([_0x2c2691[_0x5160c7(0x202)]['buildUserMaps'](),_0x2c2691[_0x5160c7(0x185)][_0x5160c7(0x18f)](),((async()=>{!_0x4e24c1&&_0x2eb0e1['length']>0x0&&await _0x474845(_0x2eb0e1,async _0x1bbeaf=>{const _0x51306d=a152_0x43de,_0x4e9d6c=await _0x2c2691[_0x51306d(0x1b1)][_0x51306d(0x257)](_0xf02872,_0x1bbeaf['id']);_0x47b7e7[_0x51306d(0x181)](_0x1bbeaf['id'],_0x4e9d6c);});})())]),{emailToId:_0x32178f,idToEmail:_0x5e7544}=_0x32e0ac,_0x92b6bb=buildConnectionMaps(_0x2f07ce);return{'rootFolderId':_0x4897e2,'folderPathToId':_0x2e183e,'folderIdToPath':_0x1f39da,'segmentNameToId':_0x210920,'activationsBySegmentId':_0x47b7e7,'emailToIdMap':_0x32178f,'idToEmailMap':_0x5e7544,'connectionNameToIdMap':_0x92b6bb[_0x5160c7(0x1b5)],'connectionIdToNameMap':_0x92b6bb[_0x5160c7(0x20f)],'connectionNameToTypeMap':_0x92b6bb[_0x5160c7(0x180)]};}export function createPushYamlContextForBundle(_0x19281d,_0x17a94d,_0x8c4b9a,_0x5ba874,_0x134625,_0x27b5fa,_0x595a03,_0x3f7c5c){const {existingLocalSegmentNames:_0x1da1b5,localExpandedRuleToNames:_0x4bce87}=_0x5ba874,_0x1d9745=new Set(),_0x57a6b4=new Map(),_0x3a5ef5=new Map(),_0x69f383=new Map(),_0x46eb37=createJumpTargetCache(),_0x165332=new Map(),_0x1aa30f=new Map(),_0x4b15ce=new Set();let _0x3dfbc1;const _0x524995=_0x19d8b0=>{const _0x41f886={'resolveSegment':async _0x3a3465=>{const _0x30f4c5=a152_0x43de,_0x23c8af=_0x69f383['get'](_0x3a3465);if(_0x23c8af!==undefined)return{'name':_0x23c8af,'isJourneyLocal':!![]};try{const _0x3957a6=await fetchSegment(_0x19281d,_0x17a94d,_0x3a3465,_0x8c4b9a);if(!_0x3957a6)throw new Error(_0x30f4c5(0x1a0));const _0x3dfe7d=generateJourneyLocalName(_0x3957a6[_0x30f4c5(0x1c3)]),_0x4f74a6=_0x3957a6[_0x30f4c5(0x20b)]===SEGMENT_KIND_JOURNEY&&_0x3dfe7d!==undefined;let _0x20ce28=_0x3957a6[_0x30f4c5(0x1c3)],_0x4a23fa;if(_0x4f74a6&&_0x3957a6['rule']){const _0x4e8695=apiRuleToYaml(_0x3957a6[_0x30f4c5(0x1bd)]);_0x1aa30f[_0x30f4c5(0x181)](_0x3a3465,_0x4e8695);const _0x4dd3b1=async _0x1f5878=>{const _0x50324b=_0x30f4c5,_0x11f3e6=collectSegmentRefsFromRule(_0x1f5878);for(const _0x3fc26a of _0x11f3e6){if(!_0x1aa30f[_0x50324b(0x18c)](_0x3fc26a))try{const _0x5d8e19=await fetchSegment(_0x19281d,_0x17a94d,_0x3fc26a,_0x8c4b9a);if(_0x5d8e19?.[_0x50324b(0x1bd)]){const _0x20c1f4=apiRuleToYaml(_0x5d8e19['rule']);_0x1aa30f[_0x50324b(0x181)](_0x3fc26a,_0x20c1f4),await _0x4dd3b1(_0x20c1f4);}}catch(_0x5b0857){logger[_0x50324b(0x213)](_0x50324b(0x209)+_0x3fc26a+':\x20'+_0x5b0857);}}};await _0x4dd3b1(_0x4e8695);const _0x1f7356=serializeExpandedRule(_0x4e8695,_0x1aa30f),_0x449073=_0x4bce87[_0x30f4c5(0x177)](_0x1f7356);if(_0x449073&&_0x449073[_0x30f4c5(0x1a4)]>0x0){const _0x557cea=_0x57a6b4[_0x30f4c5(0x177)](_0x1f7356)||0x0,_0x15d342=_0x449073[_0x557cea]||_0x449073[_0x449073['length']-0x1];_0x57a6b4[_0x30f4c5(0x181)](_0x1f7356,_0x557cea+0x1),_0x20ce28=_0x15d342,_0x1d9745[_0x30f4c5(0x1fe)](_0x20ce28),_0x69f383['set'](_0x3a3465,_0x20ce28);const _0x49bce6=await resolveRuleSegmentRefs(_0x4e8695,async _0x2678d8=>{const _0x5adae7=_0x30f4c5,_0x13863a=_0x69f383['get'](_0x2678d8);if(_0x13863a)return _0x13863a;const _0x39958d=await _0x3dfbc1[_0x5adae7(0x1ab)](_0x2678d8);return _0x39958d['name'];});_0x4a23fa={'description':_0x3957a6[_0x30f4c5(0x1cf)],'rule':_0x49bce6};}else{const _0xadfb8e=_0x165332[_0x30f4c5(0x177)](_0x1f7356);if(_0xadfb8e)_0x20ce28=_0xadfb8e,_0x69f383[_0x30f4c5(0x181)](_0x3a3465,_0x20ce28);else{if(_0x3dfe7d){let _0x5c41cf=_0x3dfe7d,_0xc9620f=0x2;while(_0x1d9745['has'](_0x5c41cf)||_0x1da1b5[_0x30f4c5(0x18c)](_0x5c41cf)){_0x5c41cf=_0x3dfe7d+'_'+_0xc9620f,_0xc9620f++;}_0x1d9745['add'](_0x5c41cf),_0x20ce28=_0x5c41cf;}_0x69f383[_0x30f4c5(0x181)](_0x3a3465,_0x20ce28),_0x165332['set'](_0x1f7356,_0x20ce28);const _0x3e991d=await resolveRuleSegmentRefs(_0x4e8695,async _0x21c469=>{const _0x345b97=_0x30f4c5,_0x4e0456=_0x69f383[_0x345b97(0x177)](_0x21c469);if(_0x4e0456)return _0x4e0456;const _0x249a43=await _0x3dfbc1[_0x345b97(0x1ab)](_0x21c469);return _0x249a43[_0x345b97(0x1c3)];});_0x4a23fa={'description':_0x3957a6['description'],'rule':_0x3e991d};}}}return{'name':_0x20ce28,'isJourneyLocal':_0x4f74a6,'definition':_0x4a23fa};}catch(_0x2bce0d){return logger['debug']('Failed\x20to\x20resolve\x20segment\x20'+_0x3a3465+':\x20'+_0x2bce0d),{'name':_0x3a3465,'isJourneyLocal':![]};}},'resolveActivation':async _0x513e34=>{const _0x2609b5=a152_0x43de,_0x5a7e89=_0x3a5ef5['get'](_0x513e34);if(_0x5a7e89!==undefined)return{'name':_0x5a7e89,'isJourneyLocal':!![]};try{let _0x3f6f05=_0x595a03?.[_0x2609b5(0x177)](_0x513e34);!_0x3f6f05&&(_0x3f6f05=await _0x19281d[_0x2609b5(0x170)][_0x2609b5(0x25a)](_0x19d8b0,_0x513e34));const _0x3ecb7f=_0x3f6f05[_0x2609b5(0x1ed)]['activationParams'][_0x2609b5(0x1c3)]||_0x513e34,_0x409cbe=sanitizeYamlKey(_0x3ecb7f)||_0x2609b5(0x193)+_0x513e34,_0x4b6e92=_0x409cbe;_0x3a5ef5['set'](_0x513e34,_0x4b6e92);const _0x3b689b=journeyActivationStepToYaml(_0x3f6f05,_0x134625,_0x27b5fa);return{'name':_0x4b6e92,'isJourneyLocal':!![],'definition':_0x3b689b};}catch(_0x275356){return logger[_0x2609b5(0x213)](_0x2609b5(0x17c)+_0x513e34+':\x20'+_0x275356),{'name':_0x513e34,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x5bae05,_0x873503)=>resolveJumpTarget(_0x5bae05,_0x873503,_0x46eb37,async _0x2f83c2=>{const _0xd8c3ed=a152_0x43de,_0x272f61=_0x3f7c5c?.['get'](_0x2f83c2);if(_0x272f61)return _0x272f61;return _0x19281d[_0xd8c3ed(0x170)]['getJourney'](_0x2f83c2);})};return _0x3dfbc1=_0x41f886,_0x41f886;},_0x5c46ec=async _0x2873b9=>{const _0x52d5ff=a152_0x43de,{collectSegmentIdsFromJourneyApi:_0x1b42dc}=await import(_0x52d5ff(0x211)),{batchAsync:_0xfe5733}=await import(_0x52d5ff(0x1ad)),_0x3acfdd=new Set();for(const _0x50ea0b of _0x2873b9){let _0xd0d1b2=_0x3f7c5c?.[_0x52d5ff(0x177)](_0x50ea0b);!_0xd0d1b2&&(_0xd0d1b2=await _0x19281d[_0x52d5ff(0x170)][_0x52d5ff(0x1aa)](_0x50ea0b));const _0x508e47=_0x1b42dc(_0xd0d1b2);for(const _0x2c3651 of _0x508e47){_0x3acfdd['add'](_0x2c3651);}}let _0x801450=Array['from'](_0x3acfdd);while(_0x801450['length']>0x0){const _0x52f6ef=_0x801450[_0x52d5ff(0x196)](_0x136f4c=>!_0x4b15ce['has'](_0x136f4c));if(_0x52f6ef[_0x52d5ff(0x1a4)]===0x0)break;const _0x576234=await _0xfe5733(_0x52f6ef,async _0x5b157d=>{_0x4b15ce['add'](_0x5b157d);const _0x572d9b=await fetchSegment(_0x19281d,_0x17a94d,_0x5b157d,_0x8c4b9a);if(!_0x572d9b)return null;return{'segmentId':_0x5b157d,'segment':_0x572d9b};},0xa),_0x4f6a54=new Set();for(const _0x2746a4 of _0x576234){if(!_0x2746a4?.[_0x52d5ff(0x1b1)]?.[_0x52d5ff(0x1bd)])continue;const _0x31f5b4=apiRuleToYaml(_0x2746a4[_0x52d5ff(0x1b1)][_0x52d5ff(0x1bd)]);_0x1aa30f[_0x52d5ff(0x181)](_0x2746a4['segmentId'],_0x31f5b4);const _0x2b10ec=collectSegmentRefsFromRule(_0x31f5b4);for(const _0x16b0e0 of _0x2b10ec){!_0x4b15ce[_0x52d5ff(0x18c)](_0x16b0e0)&&_0x4f6a54['add'](_0x16b0e0);}}_0x801450=Array[_0x52d5ff(0x164)](_0x4f6a54);}};return{'createYamlContext':_0x524995,'prefetchJourneySegments':_0x5c46ec};}export async function executePushSegments(_0x22bd98,_0x5728c9,_0x5e8203,_0x3bf1a6,_0x560b25){const _0x4bb4fd=a152_0x4fdbc8,{segmentDefToCreateRequest:_0x373f75,segmentDefToUpdateRequest:_0x2a6d6b}=await import(_0x4bb4fd(0x22f)),_0x4114d4=_0x5e8203['folderPathToId'],_0x3c9560=0x5,_0x559025=async _0x42950f=>{const _0x49e414=_0x4bb4fd,_0x406c69=_0x42950f[_0x49e414(0x156)]?_0x4114d4['get'](_0x42950f[_0x49e414(0x156)]):undefined;let _0x314fba;const _0x3a9885={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x991086=_0x42950f[_0x49e414(0x18b)];if(_0x42950f[_0x49e414(0x18b)][_0x49e414(0x1bd)]){const _0x5f1f17=createSegmentIdResolver(_0x5e8203[_0x49e414(0x19e)],_0x42950f['yamlConfig'][_0x49e414(0x1c3)]),_0x5dc9b4=await resolveRuleSegmentIds(_0x42950f[_0x49e414(0x18b)]['rule'],_0x5f1f17);_0x991086={..._0x42950f['yamlConfig'],'rule':_0x5dc9b4};}try{if(_0x42950f[_0x49e414(0x17a)]){_0x560b25[_0x49e414(0x247)]?.({'type':_0x49e414(0x1c1),'name':_0x42950f['yamlConfig'][_0x49e414(0x1c3)]});const _0x60b98=_0x373f75(_0x991086,_0x406c69),_0x489096=await _0x560b25[_0x49e414(0x25d)](_0x49e414(0x23e)+_0x42950f[_0x49e414(0x18b)][_0x49e414(0x1c3)]+'\x27...',()=>_0x22bd98['segment'][_0x49e414(0x25b)](_0x3bf1a6[_0x49e414(0x1cc)],_0x60b98));_0x314fba=_0x489096[_0x49e414(0x1f6)]['id'],_0x5e8203[_0x49e414(0x19e)]['set'](_0x42950f[_0x49e414(0x18b)][_0x49e414(0x1c3)],_0x314fba),_0x3a9885['createdSegmentId']={'name':_0x42950f[_0x49e414(0x18b)][_0x49e414(0x1c3)],'id':_0x314fba},_0x560b25[_0x49e414(0x247)]?.({'type':'segment_created','name':_0x42950f[_0x49e414(0x18b)][_0x49e414(0x1c3)],'segmentId':_0x314fba}),_0x560b25[_0x49e414(0x160)]?.(_0x49e414(0x1e3)+_0x42950f['yamlConfig'][_0x49e414(0x1c3)]+'\x27'),_0x3a9885['created']=0x1;}else{if(_0x42950f[_0x49e414(0x217)]){_0x560b25[_0x49e414(0x247)]?.({'type':_0x49e414(0x24c),'name':_0x42950f[_0x49e414(0x18b)]['name']});const _0x234fec=_0x2a6d6b(_0x991086);_0x406c69!==_0x42950f[_0x49e414(0x1f0)]?.['segmentFolderId']&&(_0x234fec[_0x49e414(0x224)]=_0x406c69?parseInt(_0x406c69,0xa):undefined),await _0x560b25[_0x49e414(0x25d)](_0x49e414(0x24a)+_0x42950f[_0x49e414(0x18b)][_0x49e414(0x1c3)]+_0x49e414(0x1d1),()=>_0x22bd98['segment'][_0x49e414(0x238)](_0x3bf1a6[_0x49e414(0x1cc)],_0x42950f['existingSegment']['id'],_0x234fec)),_0x314fba=_0x42950f['existingSegment']['id'],_0x560b25[_0x49e414(0x247)]?.({'type':_0x49e414(0x1a8),'name':_0x42950f[_0x49e414(0x18b)][_0x49e414(0x1c3)]}),_0x560b25[_0x49e414(0x160)]?.(_0x49e414(0x1ec)+_0x42950f['yamlConfig'][_0x49e414(0x1c3)]+'\x27'),_0x3a9885[_0x49e414(0x1fb)]=0x1;}else _0x314fba=_0x42950f[_0x49e414(0x1f0)]['id'];}}catch(_0x5c75fc){const _0xe8e97=isHttp400Error(_0x5c75fc),_0x1bd17d=_0xe8e97?ErrorCode[_0x49e414(0x1c5)]:ErrorCode[_0x49e414(0x1ea)],_0x517ff9=getErrorMessage(_0x5c75fc);throw new SDKError(_0x1bd17d,_0x49e414(0x18e)+(_0x42950f['isNew']?_0x49e414(0x159):'update')+_0x49e414(0x189)+_0x42950f[_0x49e414(0x1ef)]+'\x0a\x20\x20'+_0x517ff9,_0x5c75fc);}try{const _0x28344c=await syncActivationsForSegment(_0x22bd98,_0x3bf1a6[_0x49e414(0x1cc)],_0x314fba,_0x42950f[_0x49e414(0x18b)]['name'],_0x42950f[_0x49e414(0x207)],_0x560b25,_0x42950f[_0x49e414(0x1ef)]);_0x3a9885[_0x49e414(0x163)]=_0x28344c;}catch(_0x5bb342){if(_0x5bb342 instanceof SDKError)throw _0x5bb342;throw new SDKError(ErrorCode[_0x49e414(0x252)],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x42950f['yamlConfig'][_0x49e414(0x1c3)]+_0x49e414(0x248)+_0x42950f[_0x49e414(0x1ef)]+'\x0a\x20\x20'+getErrorMessage(_0x5bb342),_0x5bb342);}return _0x3a9885;},_0x1c1ffc=await batchAsync(_0x5728c9,_0x559025,_0x3c9560),_0x5836bb={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x5a5f1b of _0x1c1ffc){_0x5836bb[_0x4bb4fd(0x244)]+=_0x5a5f1b['created'],_0x5836bb[_0x4bb4fd(0x1fb)]+=_0x5a5f1b[_0x4bb4fd(0x1fb)],_0x5a5f1b['createdSegmentId']&&_0x5836bb[_0x4bb4fd(0x1ca)][_0x4bb4fd(0x181)](_0x5a5f1b[_0x4bb4fd(0x259)][_0x4bb4fd(0x1c3)],_0x5a5f1b[_0x4bb4fd(0x259)]['id']),_0x5836bb['activations'][_0x4bb4fd(0x244)]+=_0x5a5f1b[_0x4bb4fd(0x163)][_0x4bb4fd(0x244)],_0x5836bb[_0x4bb4fd(0x163)][_0x4bb4fd(0x1fb)]+=_0x5a5f1b[_0x4bb4fd(0x163)]['updated'],_0x5836bb[_0x4bb4fd(0x163)][_0x4bb4fd(0x22c)]+=_0x5a5f1b['activations'][_0x4bb4fd(0x22c)];}return _0x5836bb;}async function syncActivationsForSegment(_0x33d5d5,_0x21dd13,_0x4aacaf,_0x48421e,_0x5e91b5,_0x59003b,_0x2e063c){const _0x1ac17e=a152_0x4fdbc8,_0x37825d={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x2e02df of _0x5e91b5){try{if(_0x2e02df[_0x1ac17e(0x1b8)]===_0x1ac17e(0x159)&&_0x2e02df['validatedRequest'])_0x59003b[_0x1ac17e(0x247)]?.({'type':'activation_creating','segmentName':_0x48421e,'activationName':_0x2e02df['name']}),await _0x59003b['withProgress'](_0x1ac17e(0x1c7)+_0x2e02df[_0x1ac17e(0x1c3)]+'\x27...',()=>_0x33d5d5[_0x1ac17e(0x1b1)]['createActivation'](_0x21dd13,_0x4aacaf,_0x2e02df[_0x1ac17e(0x178)])),_0x59003b[_0x1ac17e(0x247)]?.({'type':_0x1ac17e(0x1a9),'segmentName':_0x48421e,'activationName':_0x2e02df[_0x1ac17e(0x1c3)]}),_0x59003b[_0x1ac17e(0x160)]?.('Created\x20activation\x20\x27'+_0x2e02df[_0x1ac17e(0x1c3)]+'\x27'),_0x37825d[_0x1ac17e(0x244)]++;else{if(_0x2e02df[_0x1ac17e(0x1b8)]===_0x1ac17e(0x1d5)&&_0x2e02df[_0x1ac17e(0x178)]&&_0x2e02df[_0x1ac17e(0x1dc)])_0x59003b[_0x1ac17e(0x247)]?.({'type':_0x1ac17e(0x1be),'segmentName':_0x48421e,'activationName':_0x2e02df[_0x1ac17e(0x1c3)]}),await _0x59003b[_0x1ac17e(0x25d)](_0x1ac17e(0x20c)+_0x2e02df[_0x1ac17e(0x1c3)]+'\x27...',()=>_0x33d5d5[_0x1ac17e(0x1b1)][_0x1ac17e(0x198)](_0x21dd13,_0x4aacaf,_0x2e02df[_0x1ac17e(0x1dc)]['id'],_0x2e02df[_0x1ac17e(0x178)])),_0x59003b[_0x1ac17e(0x247)]?.({'type':'activation_updated','segmentName':_0x48421e,'activationName':_0x2e02df['name']}),_0x59003b[_0x1ac17e(0x160)]?.(_0x1ac17e(0x175)+_0x2e02df['name']+'\x27'),_0x37825d[_0x1ac17e(0x1fb)]++;else _0x2e02df[_0x1ac17e(0x1b8)]==='delete'&&_0x2e02df[_0x1ac17e(0x1dc)]&&(_0x59003b[_0x1ac17e(0x247)]?.({'type':_0x1ac17e(0x1bf),'segmentName':_0x48421e,'activationName':_0x2e02df[_0x1ac17e(0x1c3)]}),await _0x59003b[_0x1ac17e(0x25d)]('Deleting\x20activation\x20\x27'+_0x2e02df[_0x1ac17e(0x1c3)]+_0x1ac17e(0x1d1),()=>_0x33d5d5['segment'][_0x1ac17e(0x1db)](_0x21dd13,_0x4aacaf,_0x2e02df[_0x1ac17e(0x1dc)]['id'])),_0x59003b[_0x1ac17e(0x247)]?.({'type':_0x1ac17e(0x1b9),'segmentName':_0x48421e,'activationName':_0x2e02df[_0x1ac17e(0x1c3)]}),_0x59003b['logDeleted']?.('Deleted\x20activation\x20\x27'+_0x2e02df[_0x1ac17e(0x1c3)]+'\x27'),_0x37825d['deleted']++);}}catch(_0x4e79f1){const _0x21395e=isHttp400Error(_0x4e79f1),_0x36ceb8=_0x21395e?ErrorCode[_0x1ac17e(0x1e0)]:ErrorCode[_0x1ac17e(0x252)],_0x2ac930=getErrorMessage(_0x4e79f1);throw new SDKError(_0x36ceb8,'Failed\x20to\x20'+_0x2e02df[_0x1ac17e(0x1b8)]+_0x1ac17e(0x208)+_0x2e02df[_0x1ac17e(0x1c3)]+_0x1ac17e(0x248)+_0x2e063c+_0x1ac17e(0x19d)+_0x2ac930,_0x4e79f1);}}return _0x37825d;}export async function executePushFolders(_0xa24897,_0x387bf1,_0x2e85e4,_0x5b9cc1,_0x459892){const _0x328bec=a152_0x4fdbc8,_0x4446d7=new Map(_0x2e85e4),_0x2d3274=sortFoldersByDepth(_0x387bf1);for(const _0x308fff of _0x2d3274){const _0x1d7d0a=_0x308fff[_0x328bec(0x1c8)]('/'),_0x27090b=_0x1d7d0a[_0x1d7d0a['length']-0x1],_0x3bd46b=_0x1d7d0a['slice'](0x0,-0x1)['join']('/'),_0x41e237=_0x4446d7['get'](_0x3bd46b);_0x459892[_0x328bec(0x247)]?.({'type':_0x328bec(0x1df),'folder':_0x308fff});const _0x5ca2e1={'name':_0x27090b,'parentFolderId':_0x41e237},_0x3e6073=await _0x459892[_0x328bec(0x25d)](_0x328bec(0x155)+_0x308fff+_0x328bec(0x1d1),()=>_0xa24897['segment']['createFolder'](_0x5b9cc1['parentId'],_0x5ca2e1));_0x4446d7[_0x328bec(0x181)](_0x308fff,_0x3e6073[_0x328bec(0x1f6)]['id']),_0x459892['onProgress']?.({'type':_0x328bec(0x21b),'folder':_0x308fff,'folderId':_0x3e6073[_0x328bec(0x1f6)]['id']}),_0x459892['logInfo']?.(_0x328bec(0x18a)+_0x308fff+'\x27');}return _0x4446d7;}export async function executePushSegmentDeletions(_0x192e9d,_0x326435,_0x533f77){const _0x5aadbf=a152_0x4fdbc8;if(_0x326435[_0x5aadbf(0x1a4)]===0x0)return 0x0;const {batchAsync:_0x4085e6}=await import('../../utils/async.js'),_0x58ab31=0x5,_0x296881=await _0x4085e6(_0x326435,async _0xbc30a9=>{const _0x3c1f6e=_0x5aadbf;return _0x533f77[_0x3c1f6e(0x247)]?.({'type':'segment_deleting','name':_0xbc30a9[_0x3c1f6e(0x1c3)]}),await _0x192e9d[_0x3c1f6e(0x1b1)][_0x3c1f6e(0x230)](_0xbc30a9['id']),_0x533f77['onProgress']?.({'type':_0x3c1f6e(0x158),'name':_0xbc30a9['name']}),_0x533f77[_0x3c1f6e(0x21c)]?.(_0x3c1f6e(0x1de)+_0xbc30a9[_0x3c1f6e(0x1c3)]+'\x27'),0x1;},_0x58ab31);return _0x296881[_0x5aadbf(0x179)]((_0xc7d538,_0x4d35ed)=>_0xc7d538+_0x4d35ed,0x0);}export async function executePushJourneys(_0x3d5a70,_0x3a3bc0,_0x1890c3,_0x5a65f9,_0x3d3713){const _0x160cce=a152_0x4fdbc8,{journeyDefToRequest:_0xc9f627}=await import(_0x160cce(0x211)),{activationDefToCreateRequest:_0x1a1db6,yamlRuleToApi:_0x4e0467,validateSegmentRule:_0x103c17}=await import(_0x160cce(0x22f)),_0x5cf042={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x440c8d=new Map(_0x1890c3[_0x160cce(0x19e)]),_0x10303f=0x5;for(let _0x934d6d=0x0;_0x934d6d<_0x3a3bc0['length'];_0x934d6d+=_0x10303f){const _0xca29e=_0x3a3bc0[_0x160cce(0x197)](_0x934d6d,_0x934d6d+_0x10303f),_0xb30d0a=await Promise[_0x160cce(0x241)](_0xca29e[_0x160cce(0x23f)](async _0x275dab=>{const _0xdabce4=_0x160cce;if(!_0x275dab['isNew']&&!_0x275dab[_0xdabce4(0x217)])return{'action':'unchanged','name':_0x275dab['yamlConfig'][_0xdabce4(0x1c3)],'journeyId':_0x275dab[_0xdabce4(0x243)]?.['id']};const _0x18e33e=_0x275dab['folderPath']?_0x1890c3[_0xdabce4(0x1e1)][_0xdabce4(0x177)](_0x275dab[_0xdabce4(0x156)]):undefined;_0x3d3713['onProgress']?.({'type':_0x275dab[_0xdabce4(0x17a)]?_0xdabce4(0x22e):_0xdabce4(0x215),'name':_0x275dab[_0xdabce4(0x18b)][_0xdabce4(0x1c3)]});try{const _0x48e126=await executeSingleJourneyPush(_0x3d5a70,_0x275dab,{..._0x1890c3,'segmentNameToId':_0x440c8d},{'parentId':_0x5a65f9[_0xdabce4(0x1cc)],'rootFolderId':_0x5a65f9[_0xdabce4(0x23d)],'folderId':_0x18e33e,'verbose':_0x5a65f9[_0xdabce4(0x1f8)]},_0x3d3713,{'journeyDefToRequest':_0xc9f627,'activationDefToCreateRequest':_0x1a1db6,'yamlRuleToApi':_0x4e0467,'validateSegmentRule':_0x103c17});for(const [_0x135091,_0x491a02]of _0x48e126[_0xdabce4(0x1ff)]){_0x440c8d[_0xdabce4(0x181)](_0x135091,_0x491a02),_0x5cf042[_0xdabce4(0x1ff)][_0xdabce4(0x181)](_0x135091,_0x491a02);}if(_0x48e126[_0xdabce4(0x227)]===_0xdabce4(0x244))_0x3d3713[_0xdabce4(0x247)]?.({'type':_0xdabce4(0x1b3),'name':_0x275dab[_0xdabce4(0x18b)]['name'],'journeyId':_0x48e126[_0xdabce4(0x23c)]}),_0x3d3713[_0xdabce4(0x160)]?.(_0xdabce4(0x195)+_0x275dab[_0xdabce4(0x18b)][_0xdabce4(0x1c3)]+'\x27'),_0x5cf042[_0xdabce4(0x244)]++;else _0x48e126[_0xdabce4(0x227)]===_0xdabce4(0x1fb)&&(_0x3d3713[_0xdabce4(0x247)]?.({'type':'journey_updated','name':_0x275dab[_0xdabce4(0x18b)][_0xdabce4(0x1c3)]}),_0x3d3713[_0xdabce4(0x160)]?.(_0xdabce4(0x201)+_0x275dab[_0xdabce4(0x18b)][_0xdabce4(0x1c3)]+'\x27'),_0x5cf042['updated']++);return{'action':_0x48e126[_0xdabce4(0x227)],'name':_0x275dab[_0xdabce4(0x18b)][_0xdabce4(0x1c3)],'journeyId':_0x48e126['journeyId']};}catch(_0x1d3e46){const _0x4e8850=isHttp400Error(_0x1d3e46),_0x2f7e71=_0x4e8850?ErrorCode[_0xdabce4(0x1b0)]:ErrorCode[_0xdabce4(0x199)],_0x298c8a=getErrorMessage(_0x1d3e46);throw new SDKError(_0x2f7e71,'Failed\x20to\x20'+(_0x275dab[_0xdabce4(0x17a)]?'create':'update')+_0xdabce4(0x20e)+_0x275dab['absolutePath']+'\x0a\x20\x20'+_0x298c8a,_0x1d3e46);}}));_0x5cf042['results'][_0x160cce(0x1f4)](..._0xb30d0a);}return _0x5cf042;}async function matchExistingJourneySegments(_0x411c4b,_0x49e408,_0x5aab54,_0x40991f,_0x336b94){const _0x55f6a9=a152_0x4fdbc8;if(!_0x49e408[_0x55f6a9(0x243)]||!_0x49e408[_0x55f6a9(0x18b)][_0x55f6a9(0x15c)])return;const _0x152d18=new Map(),_0x14fdda=new Set();for(const _0x1001da of Object[_0x55f6a9(0x1b2)](_0x49e408[_0x55f6a9(0x18b)]['segments'])){const _0x3153dd=generateDeterministicJourneySegmentName(_0x49e408[_0x55f6a9(0x18b)]['name'],_0x1001da);_0x152d18[_0x55f6a9(0x181)](_0x3153dd,_0x1001da),_0x14fdda['add'](_0x1001da);}const _0xe7af36=[],_0x56bf4c=collectSegmentIdsFromJourneyApi(_0x49e408['existingJourney']);for(const _0x476691 of _0x56bf4c){const _0x51d5aa=await fetchSegment(_0x411c4b,_0x5aab54,_0x476691,_0x40991f);if(!_0x51d5aa?.[_0x55f6a9(0x1c3)])continue;const _0x4c5f20=_0x152d18[_0x55f6a9(0x177)](_0x51d5aa[_0x55f6a9(0x1c3)]);_0x4c5f20?(_0x336b94[_0x55f6a9(0x181)](_0x4c5f20,_0x476691),_0x14fdda[_0x55f6a9(0x1c0)](_0x4c5f20)):_0xe7af36[_0x55f6a9(0x1f4)]({'id':_0x476691,'seg':_0x51d5aa});}if(_0x14fdda['size']>0x0&&_0xe7af36['length']>0x0){const {localExpandedRuleToNames:_0x3e7e08}=buildLocalExpandedRuleMappings(_0x49e408[_0x55f6a9(0x18b)]),_0x945940=new Map();for(const {id:_0xe65f07,seg:_0x4af1ce}of _0xe7af36){if(_0x4af1ce['rule']){const _0x3b70d9=apiRuleToYaml(_0x4af1ce[_0x55f6a9(0x1bd)]);_0x945940[_0x55f6a9(0x181)](_0xe65f07,_0x3b70d9);}}for(const {id:_0x350499,seg:_0x14ce56}of _0xe7af36){if(!_0x14ce56[_0x55f6a9(0x1bd)])continue;const _0x5d10ee=_0x945940[_0x55f6a9(0x177)](_0x350499);if(!_0x5d10ee)continue;const _0x584af2=serializeExpandedRule(_0x5d10ee,_0x945940),_0x33e373=_0x3e7e08[_0x55f6a9(0x177)](_0x584af2);if(_0x33e373){const _0xc4610=_0x33e373['find'](_0x269f72=>_0x14fdda[_0x55f6a9(0x18c)](_0x269f72));_0xc4610&&(_0x336b94[_0x55f6a9(0x181)](_0xc4610,_0x350499),_0x14fdda['delete'](_0xc4610),logger[_0x55f6a9(0x213)](_0x55f6a9(0x1eb)+_0x14ce56[_0x55f6a9(0x1c3)]+_0x55f6a9(0x1e6)+_0xc4610+_0x55f6a9(0x169)));}}}}async function executeSingleJourneyPush(_0x51f4ac,_0x3af42c,_0x2f313b,_0x3f0e6c,_0x217204,_0x45fd7c){const _0xec6f68=a152_0x4fdbc8,{journeyDefToRequest:_0x595169,activationDefToCreateRequest:_0x999e5d,yamlRuleToApi:_0x49b000,validateSegmentRule:_0x2771c7}=_0x45fd7c,_0x210367=new Map(),_0x41d9f1=new Map();recoverSegmentIdsFromPushRecovery(_0x3af42c,_0x210367,_0x2f313b['segmentNameToId']);const _0x472f65=new Map(),_0x4fed0b=new Map(),_0x614049=new Map();let _0x256201;const _0x5d806b=async()=>{const _0x6b93f=a152_0x43de;if(_0x256201)return;_0x256201=new Map();if(!_0x3af42c['existingJourney'])return;const _0x438a71=await _0x51f4ac[_0x6b93f(0x170)][_0x6b93f(0x257)](_0x3af42c[_0x6b93f(0x243)]['id']);for(const _0x277100 of _0x438a71){const _0x2125be=journeyActivationStepToYaml(_0x277100,_0x2f313b['idToEmailMap'],_0x2f313b['connectionIdToNameMap']),_0x31decf=activationSignature(_0x2125be);!_0x256201['has'](_0x31decf)&&_0x256201['set'](_0x31decf,_0x277100['id']),_0x2125be[_0x6b93f(0x1c3)]&&_0x41d9f1[_0x6b93f(0x181)](_0x2125be[_0x6b93f(0x1c3)],_0x277100['id']);}};await matchExistingJourneySegments(_0x51f4ac,_0x3af42c,_0x3f0e6c[_0xec6f68(0x1cc)],_0x2f313b[_0xec6f68(0x1f7)],_0x2f313b[_0xec6f68(0x19e)]);const _0x5cba10={'resolveSegmentId':async _0x500e04=>{const _0x7d0d69=_0xec6f68,_0x53a9be=_0x2f313b[_0x7d0d69(0x19e)][_0x7d0d69(0x177)](_0x500e04);if(!_0x53a9be)throw new SDKError(ErrorCode[_0x7d0d69(0x1e7)],_0x7d0d69(0x204)+_0x500e04+_0x7d0d69(0x194)+_0x3af42c[_0x7d0d69(0x18b)]['name']+')');return _0x53a9be;},'resolveEmbeddedSegmentId':async(_0x34425b,_0x3ccea9)=>{const _0x58013f=_0xec6f68,_0xde5bf9=_0x2f313b[_0x58013f(0x19e)][_0x58013f(0x177)](_0x34425b);if(_0xde5bf9)return _0xde5bf9;const _0x3cb143=_0x2f313b[_0x58013f(0x1f7)][_0x58013f(0x1a7)](_0x15ddb6=>_0x15ddb6[_0x58013f(0x1c3)]===_0x34425b);if(_0x3cb143)return _0x2f313b['segmentNameToId'][_0x58013f(0x181)](_0x34425b,_0x3cb143['id']),_0x3cb143['id'];if(_0x3af42c[_0x58013f(0x17a)]){const {stageName:_0x3d5f64,criteriaName:_0x98bfb5}=findSegmentCriteriaLocation(_0x3af42c[_0x58013f(0x18b)],_0x34425b);return _0x2771c7(_0x34425b,_0x3ccea9[_0x58013f(0x1bd)]),_0x4fed0b['set'](_0x34425b,{'definition':_0x3ccea9,'stageName':_0x3d5f64,'criteriaName':_0x98bfb5}),createPendingSegmentId(_0x34425b);}const _0x1a01cc=_0x3af42c[_0x58013f(0x243)]?.['id'];if(!_0x1a01cc)throw new SDKError(ErrorCode[_0x58013f(0x1c2)],_0x58013f(0x258));const _0x164365=_0x472f65[_0x58013f(0x177)](_0x34425b);if(_0x164365)return _0x164365;const _0x542e6b=((async()=>{const _0x36ec17=_0x58013f;_0x2771c7(_0x34425b,_0x3ccea9[_0x36ec17(0x1bd)]);const _0x41c713=generateDeterministicJourneySegmentName(_0x3af42c[_0x36ec17(0x18b)][_0x36ec17(0x1c3)],_0x34425b),_0x238193=_0x2f313b['existingSegments']['find'](_0x334f15=>_0x334f15[_0x36ec17(0x1c3)]===_0x41c713),_0x542bba=createSegmentIdResolver(_0x2f313b[_0x36ec17(0x19e)],_0x34425b),_0x5b390e=await resolveRuleSegmentIds(_0x3ccea9[_0x36ec17(0x1bd)],_0x542bba);let _0x5b41f9;return _0x238193?(await _0x51f4ac[_0x36ec17(0x1b1)][_0x36ec17(0x238)](_0x3f0e6c[_0x36ec17(0x1cc)],_0x238193['id'],{'description':_0x3ccea9[_0x36ec17(0x1cf)]||_0x36ec17(0x22b)+_0x34425b,'rule':_0x49b000(_0x5b390e),'countPopulation':!![]}),_0x5b41f9=_0x238193['id'],saveSegmentToPushRecovery(_0x3af42c[_0x36ec17(0x1ef)],_0x3af42c[_0x36ec17(0x18b)]['name'],_0x34425b,{'segmentId':_0x5b41f9,'uniqueServerName':_0x41c713,'createdAt':new Date()[_0x36ec17(0x184)]()})):_0x5b41f9=await createOrRecoverEmbeddedSegment(_0x51f4ac,_0x3af42c,{'localName':_0x34425b,'uniqueSegmentName':_0x41c713,'description':_0x3ccea9[_0x36ec17(0x1cf)]||_0x36ec17(0x22b)+_0x34425b,'journeyId':_0x1a01cc,'resolvedRule':_0x5b390e,'parentId':_0x3f0e6c[_0x36ec17(0x1cc)],'folderId':_0x3f0e6c[_0x36ec17(0x23d)]||''},_0x49b000),_0x2f313b[_0x36ec17(0x19e)]['set'](_0x34425b,_0x5b41f9),_0x210367['set'](_0x34425b,_0x5b41f9),_0x5b41f9;})());_0x472f65[_0x58013f(0x181)](_0x34425b,_0x542e6b);try{return await _0x542e6b;}finally{_0x472f65[_0x58013f(0x1c0)](_0x34425b);}},'resolveActivationId':async _0x817dd3=>{const _0x116566=_0xec6f68,_0x2ac137=_0x41d9f1['get'](_0x817dd3);if(_0x2ac137)return _0x2ac137;if(_0x3af42c[_0x116566(0x243)]){await _0x5d806b();const _0x3c6b13=_0x41d9f1[_0x116566(0x177)](_0x817dd3);if(_0x3c6b13)return _0x3c6b13;}throw new SDKError(ErrorCode[_0x116566(0x203)],_0x116566(0x1bc)+_0x817dd3+_0x116566(0x194)+_0x3af42c['yamlConfig']['name']+_0x116566(0x157)+'Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.');},'resolveEmbeddedActivationId':async(_0x1ca2a2,_0x30276f)=>{const _0x2dcf4c=_0xec6f68,_0x540d04=_0x41d9f1['get'](_0x1ca2a2);if(_0x540d04)return _0x540d04;if(_0x3af42c[_0x2dcf4c(0x17a)])return _0x614049[_0x2dcf4c(0x181)](_0x1ca2a2,_0x30276f),createPendingActivationId(_0x1ca2a2);if(_0x3af42c[_0x2dcf4c(0x243)]){await _0x5d806b();const _0xe41c4c=_0x41d9f1[_0x2dcf4c(0x177)](_0x30276f[_0x2dcf4c(0x1c3)]);if(_0xe41c4c)return _0x41d9f1[_0x2dcf4c(0x181)](_0x1ca2a2,_0xe41c4c),_0xe41c4c;const _0x245d75=activationSignature(_0x30276f),_0x13ea16=_0x256201?.[_0x2dcf4c(0x177)](_0x245d75);if(_0x13ea16)return _0x41d9f1[_0x2dcf4c(0x181)](_0x1ca2a2,_0x13ea16),_0x13ea16;const _0x511cd4=await _0x999e5d(_0x30276f,_0x2f313b[_0x2dcf4c(0x222)]),_0x42d59a={..._0x511cd4,..._0x30276f['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x30276f['run_after_journey_refresh']}},_0x454839=await _0x51f4ac[_0x2dcf4c(0x170)]['createActivation'](_0x3af42c[_0x2dcf4c(0x243)]['id'],_0x42d59a);return _0x41d9f1[_0x2dcf4c(0x181)](_0x1ca2a2,_0x454839['id']),_0x454839['id'];}throw new SDKError(ErrorCode[_0x2dcf4c(0x1c2)],_0x2dcf4c(0x173));},'resolveJourneyId':async _0x20b077=>{const _0x124d82=_0xec6f68;try{return await _0x51f4ac[_0x124d82(0x170)][_0x124d82(0x176)](_0x3f0e6c['parentId'],_0x20b077);}catch(_0x2b0ec8){throw new SDKError(ErrorCode[_0x124d82(0x203)],_0x124d82(0x223)+_0x20b077+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x3af42c['yamlConfig'][_0x124d82(0x1c3)]+'\x27)',_0x2b0ec8);}},'resolveStageId':async(_0x21a45c,_0x27fc3d)=>{const _0x1fb6e2=_0xec6f68,_0xe50f8f=await _0x51f4ac['journey'][_0x1fb6e2(0x1aa)](_0x21a45c),_0x306996=_0xe50f8f['attributes'][_0x1fb6e2(0x174)]['find'](_0x20b143=>_0x20b143[_0x1fb6e2(0x1c3)][_0x1fb6e2(0x188)]()===_0x27fc3d[_0x1fb6e2(0x188)]());if(!_0x306996?.['id'])throw new SDKError(ErrorCode[_0x1fb6e2(0x203)],_0x1fb6e2(0x1da)+_0x27fc3d+_0x1fb6e2(0x234)+(_0xe50f8f[_0x1fb6e2(0x1ed)][_0x1fb6e2(0x254)]||_0xe50f8f[_0x1fb6e2(0x1ed)][_0x1fb6e2(0x1c3)])+'\x27');return _0x306996['id'];}},_0x38ed7d=await _0x595169(_0x3af42c[_0xec6f68(0x18b)],_0x3f0e6c[_0xec6f68(0x1cc)],_0x5cba10),_0x5bee7d=_0x3f0e6c['folderId']||_0x3f0e6c[_0xec6f68(0x23d)];_0x5bee7d&&(_0x38ed7d['relationships']={'parentFolder':{'data':{'id':_0x5bee7d,'type':'folder'}}});if(_0x3af42c['isNew']){if(_0x4fed0b[_0xec6f68(0x1a2)]>0x0||_0x614049[_0xec6f68(0x1a2)]>0x0)return await executeThreeStepJourneyCreate(_0x51f4ac,_0x3af42c,_0x38ed7d,{'pendingEmbeddedSegments':_0x4fed0b,'pendingEmbeddedActivations':_0x614049,'embeddedSegmentNameToId':_0x210367,'journeyActivationNameToId':_0x41d9f1},{..._0x3f0e6c,'effectiveFolderId':_0x5bee7d},_0x2f313b,_0x217204,_0x45fd7c);else{ensureJourneyDefaults(_0x38ed7d[_0xec6f68(0x1ed)]);const _0x3898aa=await _0x51f4ac[_0xec6f68(0x170)]['create'](_0x38ed7d);return deletePushRecovery(_0x3af42c['absolutePath']),{'action':_0xec6f68(0x244),'journeyId':_0x3898aa['id'],'embeddedSegmentNameToId':_0x210367};}}else{if(_0x3af42c[_0xec6f68(0x217)]&&_0x3af42c[_0xec6f68(0x243)]){_0x38ed7d['id']=_0x3af42c['existingJourney']['id'];const _0x1ca65f=_0x38ed7d[_0xec6f68(0x1ed)];_0x3af42c[_0xec6f68(0x243)]['attributes']?.[_0xec6f68(0x254)]&&(_0x1ca65f[_0xec6f68(0x254)]=_0x3af42c[_0xec6f68(0x243)]['attributes'][_0xec6f68(0x254)]);const _0x159de5=_0x3af42c[_0xec6f68(0x243)][_0xec6f68(0x1ed)]?.[_0xec6f68(0x174)];return _0x159de5&&_0x38ed7d[_0xec6f68(0x1ed)][_0xec6f68(0x174)]&&injectExistingStageIds(_0x38ed7d[_0xec6f68(0x1ed)][_0xec6f68(0x174)],_0x159de5),ensureJourneyDefaults(_0x1ca65f),await _0x51f4ac[_0xec6f68(0x170)][_0xec6f68(0x1d5)](_0x3af42c[_0xec6f68(0x243)]['id'],_0x38ed7d),deletePushRecovery(_0x3af42c[_0xec6f68(0x1ef)]),{'action':'updated','journeyId':_0x3af42c[_0xec6f68(0x243)]['id'],'embeddedSegmentNameToId':_0x210367};}}return deletePushRecovery(_0x3af42c[_0xec6f68(0x1ef)]),{'action':_0xec6f68(0x1d2),'journeyId':_0x3af42c['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x210367};}function findSegmentCriteriaLocation(_0x466114,_0xdd1d7d){const _0x312c7b=a152_0x4fdbc8,_0x5c9ce3=_0x466114[_0x312c7b(0x23a)]||_0x466114[_0x312c7b(0x1ee)]?.[0x0]?.[_0x312c7b(0x23a)]||[];let _0x5edb60=_0x312c7b(0x19b),_0x575cc0=_0xdd1d7d;const _0x27b065=_0x466114[_0x312c7b(0x168)]||_0x466114[_0x312c7b(0x1ee)]?.[0x0]?.['goal'];if(_0x27b065?.['segment']===_0xdd1d7d)return{'stageName':_0x312c7b(0x168),'criteriaName':_0x27b065[_0x312c7b(0x1c3)]||_0xdd1d7d};_0x233e07:for(const _0x1e8732 of _0x5c9ce3){if(_0x1e8732[_0x312c7b(0x1d0)]?.[_0x312c7b(0x1b1)]===_0xdd1d7d){_0x5edb60=_0x1e8732[_0x312c7b(0x1c3)],_0x575cc0=_0x1e8732[_0x312c7b(0x1d0)][_0x312c7b(0x1c3)]||_0xdd1d7d;break;}if(_0x1e8732['steps'])for(const _0x34262b of _0x1e8732[_0x312c7b(0x15f)]){if(_0x34262b[_0x312c7b(0x1b8)]===_0x312c7b(0x22d)&&_0x34262b[_0x312c7b(0x190)]?.['branches'])for(const _0x25813a of _0x34262b[_0x312c7b(0x190)][_0x312c7b(0x1ac)]){if(_0x25813a[_0x312c7b(0x1b1)]===_0xdd1d7d){_0x5edb60=_0x1e8732['name'],_0x575cc0=_0x25813a[_0x312c7b(0x1c3)]||_0xdd1d7d;break _0x233e07;}}}}return{'stageName':_0x5edb60,'criteriaName':_0x575cc0};}async function executeThreeStepJourneyCreate(_0x472c3c,_0x150a2b,_0x4d0281,_0x381382,_0x1c05f0,_0x56cbeb,_0x3f067c,_0x10a173){const _0x12fb33=a152_0x4fdbc8,{activationDefToCreateRequest:_0x20e6a7,yamlRuleToApi:_0x28d2fa}=_0x10a173,{pendingEmbeddedSegments:_0x2d608e,pendingEmbeddedActivations:_0xf451e9,embeddedSegmentNameToId:_0x265699}=_0x381382,_0x564c77=JSON[_0x12fb33(0x20d)](JSON['stringify'](_0x4d0281));ensureJourneyDefaults(_0x564c77[_0x12fb33(0x1ed)]),stripPendingIds(_0x564c77);const _0x2b76cd=await _0x472c3c[_0x12fb33(0x170)][_0x12fb33(0x159)](_0x564c77),_0x153634=_0x2b76cd['id'],_0x407954=new Map();for(const _0x35243c of _0x2b76cd[_0x12fb33(0x1ed)][_0x12fb33(0x174)]){_0x407954['set'](_0x35243c['name'][_0x12fb33(0x188)](),_0x35243c['id']);}recoverSegmentIdsFromPushRecovery(_0x150a2b,_0x265699,_0x56cbeb['segmentNameToId']);for(const [_0x480042,{definition:_0x263df7}]of _0x2d608e){if(_0x265699[_0x12fb33(0x18c)](_0x480042)){_0x3f067c[_0x12fb33(0x247)]?.({'type':_0x12fb33(0x16a),'journeyName':_0x150a2b[_0x12fb33(0x18b)][_0x12fb33(0x1c3)],'segmentName':_0x480042});continue;}const _0x44be40=generateDeterministicJourneySegmentName(_0x150a2b[_0x12fb33(0x18b)]['name'],_0x480042);_0x3f067c[_0x12fb33(0x247)]?.({'type':_0x12fb33(0x15d),'journeyName':_0x150a2b[_0x12fb33(0x18b)][_0x12fb33(0x1c3)],'segmentName':_0x480042});const _0x50b1f4=createSegmentIdResolver(_0x56cbeb[_0x12fb33(0x19e)],_0x480042),_0x5c1505=await resolveRuleSegmentIds(_0x263df7['rule'],_0x50b1f4),_0x50e8ec=await createOrRecoverEmbeddedSegment(_0x472c3c,_0x150a2b,{'localName':_0x480042,'uniqueSegmentName':_0x44be40,'description':_0x263df7[_0x12fb33(0x1cf)]||_0x12fb33(0x22b)+_0x480042,'journeyId':_0x153634,'resolvedRule':_0x5c1505,'parentId':_0x1c05f0[_0x12fb33(0x1cc)],'folderId':_0x1c05f0[_0x12fb33(0x20a)]||''},_0x28d2fa);_0x265699['set'](_0x480042,_0x50e8ec),_0x56cbeb['segmentNameToId'][_0x12fb33(0x181)](_0x480042,_0x50e8ec),_0x3f067c[_0x12fb33(0x247)]?.({'type':_0x12fb33(0x16a),'journeyName':_0x150a2b[_0x12fb33(0x18b)][_0x12fb33(0x1c3)],'segmentName':_0x480042});}const _0x105487=new Map();for(const [_0x18ec6e,_0x15f7d5]of _0xf451e9){_0x3f067c[_0x12fb33(0x247)]?.({'type':_0x12fb33(0x21e),'journeyName':_0x150a2b[_0x12fb33(0x18b)][_0x12fb33(0x1c3)],'activationName':_0x18ec6e});const _0x3ca85e=await _0x20e6a7(_0x15f7d5,_0x56cbeb['activationContext']),_0x33ec8a={..._0x3ca85e,..._0x15f7d5[_0x12fb33(0x1af)]!==undefined&&{'runAfterJourneyRefresh':_0x15f7d5['run_after_journey_refresh']}},_0xbe465d=await _0x472c3c['journey'][_0x12fb33(0x17e)](_0x153634,_0x33ec8a);_0x105487[_0x12fb33(0x181)](_0x18ec6e,_0xbe465d['id']),_0x381382['journeyActivationNameToId'][_0x12fb33(0x181)](_0x18ec6e,_0xbe465d['id']),_0x3f067c[_0x12fb33(0x247)]?.({'type':'embedded_activation_created','journeyName':_0x150a2b[_0x12fb33(0x18b)][_0x12fb33(0x1c3)],'activationName':_0x18ec6e});}const _0x1d2c29=JSON[_0x12fb33(0x20d)](JSON[_0x12fb33(0x210)](_0x4d0281));return _0x1d2c29['id']=_0x153634,ensureJourneyDefaults(_0x1d2c29[_0x12fb33(0x1ed)]),resolvePendingIdsInRequest(_0x1d2c29,_0x4d0281,_0x407954,_0x265699,_0x105487,_0x3f067c),await _0x472c3c['journey'][_0x12fb33(0x1d5)](_0x153634,_0x1d2c29),deletePushRecovery(_0x150a2b[_0x12fb33(0x1ef)]),{'action':_0x12fb33(0x244),'journeyId':_0x153634,'embeddedSegmentNameToId':_0x265699};}export function stripWaitStepPendingIds(_0x1899da){const _0x37d7ae=a152_0x4fdbc8,_0x21ea84=_0x1899da[_0x37d7ae(0x1b7)]&&isPendingSegmentId(_0x1899da[_0x37d7ae(0x1b7)]),_0x2c137e=_0x1899da['conditions']?.[_0x37d7ae(0x183)](_0x2a02b2=>_0x2a02b2[_0x37d7ae(0x24b)]&&isPendingSegmentId(_0x2a02b2[_0x37d7ae(0x24b)]));(_0x21ea84||_0x2c137e)&&(_0x1899da['waitStepType']=_0x37d7ae(0x1d3),_0x1899da['waitStep']=0x1,_0x1899da[_0x37d7ae(0x1dd)]=_0x37d7ae(0x16e),delete _0x1899da[_0x37d7ae(0x1b7)],delete _0x1899da[_0x37d7ae(0x25c)],delete _0x1899da[_0x37d7ae(0x251)],delete _0x1899da[_0x37d7ae(0x237)]);}export function resolveWaitStepPendingIds(_0x45eb21,_0x267e5e,_0x53a2bd,_0x1dcbdf){const _0x57fa55=a152_0x4fdbc8;if(_0x267e5e['conditionSegmentId']&&isPendingSegmentId(_0x267e5e[_0x57fa55(0x1b7)])){const _0x55da8c=_0x53a2bd(_0x267e5e[_0x57fa55(0x1b7)],_0x57fa55(0x1f9)+_0x1dcbdf+_0x57fa55(0x214));_0x55da8c&&(_0x45eb21[_0x57fa55(0x182)]='Condition',_0x45eb21[_0x57fa55(0x1b7)]=_0x55da8c,delete _0x45eb21['waitStep'],delete _0x45eb21['waitStepUnit'],_0x267e5e['conditionTimeoutDuration']!==undefined&&(_0x45eb21['conditionTimeoutDuration']=_0x267e5e['conditionTimeoutDuration']),_0x267e5e[_0x57fa55(0x251)]&&(_0x45eb21[_0x57fa55(0x251)]=_0x267e5e[_0x57fa55(0x251)]));}if(_0x267e5e[_0x57fa55(0x237)]){const _0x1b7bda=_0x267e5e['conditions'][_0x57fa55(0x183)](_0x17b568=>_0x17b568['segmentId']&&isPendingSegmentId(_0x17b568[_0x57fa55(0x24b)]));if(_0x1b7bda){const _0x2824f6=_0x267e5e[_0x57fa55(0x237)][_0x57fa55(0x23f)](_0x5da401=>{const _0x3b4a2b=_0x57fa55;if(_0x5da401['segmentId']&&isPendingSegmentId(_0x5da401[_0x3b4a2b(0x24b)])){const _0x1ba1c9=_0x53a2bd(_0x5da401[_0x3b4a2b(0x24b)],_0x3b4a2b(0x1f9)+_0x1dcbdf+_0x3b4a2b(0x214));return{..._0x5da401,'segmentId':_0x1ba1c9||_0x5da401['segmentId']};}return{..._0x5da401};});_0x45eb21['waitStepType']='Condition',_0x45eb21[_0x57fa55(0x237)]=_0x2824f6,delete _0x45eb21[_0x57fa55(0x206)],delete _0x45eb21[_0x57fa55(0x1dd)],delete _0x45eb21['conditionSegmentId'],delete _0x45eb21['conditionTimeoutDuration'],delete _0x45eb21[_0x57fa55(0x251)];}}}function stripPendingIds(_0x30b9df){const _0x539c74=a152_0x4fdbc8;_0x30b9df[_0x539c74(0x1ed)][_0x539c74(0x168)]?.['segmentId']&&isPendingSegmentId(_0x30b9df['attributes'][_0x539c74(0x168)]['segmentId'])&&delete _0x30b9df['attributes'][_0x539c74(0x168)];for(const _0xd43d2b of _0x30b9df[_0x539c74(0x1ed)][_0x539c74(0x174)]||[]){_0xd43d2b[_0x539c74(0x19f)]?.['segmentId']&&isPendingSegmentId(_0xd43d2b[_0x539c74(0x19f)][_0x539c74(0x24b)])&&delete _0xd43d2b[_0x539c74(0x19f)];_0xd43d2b[_0x539c74(0x17f)]?.[_0x539c74(0x24b)]&&isPendingSegmentId(_0xd43d2b[_0x539c74(0x17f)][_0x539c74(0x24b)])&&delete _0xd43d2b[_0x539c74(0x17f)];_0xd43d2b[_0x539c74(0x24e)]&&(_0xd43d2b[_0x539c74(0x24e)]=_0xd43d2b[_0x539c74(0x24e)][_0x539c74(0x196)](_0x2ff39e=>!_0x2ff39e[_0x539c74(0x24b)]||!isPendingSegmentId(_0x2ff39e[_0x539c74(0x24b)])));if(_0xd43d2b[_0x539c74(0x15f)])for(const _0x187367 of Object['keys'](_0xd43d2b['steps'])){const _0x4ffd8a=_0xd43d2b['steps'][_0x187367];_0x4ffd8a[_0x539c74(0x1b8)]===_0x539c74(0x229)&&_0x4ffd8a[_0x539c74(0x1b4)]&&isPendingActivationId(_0x4ffd8a[_0x539c74(0x1b4)])&&(_0x4ffd8a['journeyActivationStepId']='');if(_0x4ffd8a[_0x539c74(0x1b8)]===_0x539c74(0x1c4)&&_0x4ffd8a[_0x539c74(0x1ac)])for(const _0x317f07 of _0x4ffd8a[_0x539c74(0x1ac)]){_0x317f07['segmentId']&&isPendingSegmentId(_0x317f07[_0x539c74(0x24b)])&&(_0x317f07[_0x539c74(0x24b)]='');}_0x4ffd8a[_0x539c74(0x1b8)]===_0x539c74(0x1cd)&&stripWaitStepPendingIds(_0x4ffd8a);}}}function resolvePendingIdsInRequest(_0x22f628,_0x34e7f6,_0x12d7c6,_0x19778f,_0x6d488f,_0xfa4949){const _0x1068a8=a152_0x4fdbc8,_0x4bf550=(_0x407bb5,_0x36ce43)=>{const _0x185a66=a152_0x43de;if(!isPendingSegmentId(_0x407bb5))return _0x407bb5;const _0x9a430c=extractPendingSegmentName(_0x407bb5),_0x3d1dfd=_0x19778f[_0x185a66(0x177)](_0x9a430c);return!_0x3d1dfd&&_0xfa4949[_0x185a66(0x187)]?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x9a430c+_0x185a66(0x226)+_0x36ce43),_0x3d1dfd;};if(_0x22f628['attributes'][_0x1068a8(0x168)]?.[_0x1068a8(0x24b)]&&isPendingSegmentId(_0x22f628[_0x1068a8(0x1ed)]['goal'][_0x1068a8(0x24b)])){const _0x17b477=_0x4bf550(_0x22f628[_0x1068a8(0x1ed)][_0x1068a8(0x168)][_0x1068a8(0x24b)],_0x1068a8(0x1e2));_0x17b477&&(_0x22f628['attributes'][_0x1068a8(0x168)][_0x1068a8(0x24b)]=_0x17b477);}for(const _0x581d30 of _0x22f628[_0x1068a8(0x1ed)][_0x1068a8(0x174)]||[]){const _0x2cf709=_0x12d7c6[_0x1068a8(0x177)](_0x581d30[_0x1068a8(0x1c3)]['toLowerCase']());_0x2cf709&&(_0x581d30['id']=_0x2cf709);if(_0x581d30['entryCriteria']?.[_0x1068a8(0x24b)]&&isPendingSegmentId(_0x581d30[_0x1068a8(0x19f)][_0x1068a8(0x24b)])){const _0x2fabfa=_0x4bf550(_0x581d30['entryCriteria']['segmentId'],_0x1068a8(0x1f9)+_0x581d30[_0x1068a8(0x1c3)]+_0x1068a8(0x191));_0x2fabfa&&(_0x581d30[_0x1068a8(0x19f)][_0x1068a8(0x24b)]=_0x2fabfa);}if(_0x581d30['exitCriterias'])for(const _0x249b05 of _0x581d30[_0x1068a8(0x24e)]){if(_0x249b05[_0x1068a8(0x24b)]&&isPendingSegmentId(_0x249b05[_0x1068a8(0x24b)])){const _0x122e14=_0x4bf550(_0x249b05[_0x1068a8(0x24b)],_0x1068a8(0x1f9)+_0x581d30[_0x1068a8(0x1c3)]+_0x1068a8(0x200));_0x122e14&&(_0x249b05[_0x1068a8(0x24b)]=_0x122e14);}}if(_0x581d30[_0x1068a8(0x17f)]?.[_0x1068a8(0x24b)]&&isPendingSegmentId(_0x581d30['milestone'][_0x1068a8(0x24b)])){const _0x2b5498=_0x4bf550(_0x581d30[_0x1068a8(0x17f)][_0x1068a8(0x24b)],_0x1068a8(0x1f9)+_0x581d30[_0x1068a8(0x1c3)]+_0x1068a8(0x16f));_0x2b5498&&(_0x581d30[_0x1068a8(0x17f)][_0x1068a8(0x24b)]=_0x2b5498);}if(_0x581d30['steps']){const _0x2f9e26=_0x10575d=>_0x34e7f6[_0x1068a8(0x1ed)]['journeyStages']?.['find'](_0x3b8e96=>_0x3b8e96[_0x1068a8(0x1c3)]['toLowerCase']()===_0x581d30[_0x1068a8(0x1c3)]['toLowerCase']())?.[_0x1068a8(0x15f)]?.[_0x10575d];for(const _0x39db4d of Object['keys'](_0x581d30[_0x1068a8(0x15f)])){const _0x320370=_0x581d30[_0x1068a8(0x15f)][_0x39db4d],_0x26053c=_0x2f9e26(_0x39db4d);if(_0x320370[_0x1068a8(0x1b8)]==='Activation'&&_0x320370[_0x1068a8(0x1b4)]&&(isPendingActivationId(_0x320370[_0x1068a8(0x1b4)])||_0x320370[_0x1068a8(0x1b4)]==='')){if(_0x26053c?.[_0x1068a8(0x1b4)]&&isPendingActivationId(_0x26053c[_0x1068a8(0x1b4)])){const _0x2a173=extractPendingActivationName(_0x26053c[_0x1068a8(0x1b4)]),_0x2258b0=_0x6d488f[_0x1068a8(0x177)](_0x2a173);_0x2258b0&&(_0x320370[_0x1068a8(0x1b4)]=_0x2258b0);}}if(_0x320370[_0x1068a8(0x1b8)]===_0x1068a8(0x1c4)&&_0x320370[_0x1068a8(0x1ac)]&&_0x26053c?.[_0x1068a8(0x1ac)])for(let _0x348dac=0x0;_0x348dac<_0x320370[_0x1068a8(0x1ac)][_0x1068a8(0x1a4)];_0x348dac++){const _0x2473b9=_0x320370['branches'][_0x348dac],_0x44a41c=_0x26053c[_0x1068a8(0x1ac)][_0x348dac];if(_0x44a41c?.[_0x1068a8(0x24b)]&&isPendingSegmentId(_0x44a41c[_0x1068a8(0x24b)])){const _0x4e931c=_0x4bf550(_0x44a41c[_0x1068a8(0x24b)],_0x1068a8(0x1f9)+_0x581d30[_0x1068a8(0x1c3)]+_0x1068a8(0x162)+(_0x2473b9[_0x1068a8(0x1c3)]||_0x348dac)+'\x27');_0x4e931c&&(_0x2473b9[_0x1068a8(0x24b)]=_0x4e931c);}}_0x320370[_0x1068a8(0x1b8)]==='WaitStep'&&_0x26053c?.[_0x1068a8(0x1b8)]===_0x1068a8(0x1cd)&&resolveWaitStepPendingIds(_0x320370,_0x26053c,_0x4bf550,_0x581d30[_0x1068a8(0x1c3)]);}}}}
1
+ const a152_0x17e28a=a152_0x2b62;(function(_0x404b16,_0x558802){const _0x206a0e=a152_0x2b62,_0xf283d5=_0x404b16();while(!![]){try{const _0x5d039c=-parseInt(_0x206a0e(0x1dd))/0x1*(parseInt(_0x206a0e(0x217))/0x2)+-parseInt(_0x206a0e(0x25e))/0x3*(-parseInt(_0x206a0e(0x22f))/0x4)+-parseInt(_0x206a0e(0x26d))/0x5*(-parseInt(_0x206a0e(0x1e5))/0x6)+parseInt(_0x206a0e(0x219))/0x7*(parseInt(_0x206a0e(0x1e2))/0x8)+-parseInt(_0x206a0e(0x23a))/0x9*(-parseInt(_0x206a0e(0x1e4))/0xa)+-parseInt(_0x206a0e(0x24d))/0xb*(-parseInt(_0x206a0e(0x224))/0xc)+parseInt(_0x206a0e(0x290))/0xd*(-parseInt(_0x206a0e(0x1f0))/0xe);if(_0x5d039c===_0x558802)break;else _0xf283d5['push'](_0xf283d5['shift']());}catch(_0x4d44ef){_0xf283d5['push'](_0xf283d5['shift']());}}}(a152_0x429e,0xa84f9));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x17e28a(0x230));export const PENDING_SEGMENT_PREFIX='__pending_';export const PENDING_ACTIVATION_PREFIX=a152_0x17e28a(0x21b);export function createPendingSegmentId(_0x5607d8){return''+PENDING_SEGMENT_PREFIX+_0x5607d8+'__';}export function isPendingSegmentId(_0x4e3171){const _0x8fdd14=a152_0x17e28a;return _0x4e3171[_0x8fdd14(0x264)](PENDING_SEGMENT_PREFIX)&&!_0x4e3171['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x47fed8){const _0x41e6e5=a152_0x17e28a;return _0x47fed8[_0x41e6e5(0x240)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x1dc9f2){return''+PENDING_ACTIVATION_PREFIX+_0x1dc9f2+'__';}export function isPendingActivationId(_0x48833f){const _0x408162=a152_0x17e28a;return _0x48833f[_0x408162(0x264)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x1268b3){const _0x1ec05c=a152_0x17e28a;return _0x1268b3[_0x1ec05c(0x240)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x4dc32b,_0xe0d28d){const _0x26b180=a152_0x17e28a,_0x599583=_0x4dc32b+'::'+(_0xe0d28d['trim']()||_0x26b180(0x1ae)),_0x45186b=createHash(_0x26b180(0x28b))[_0x26b180(0x271)](_0x599583)[_0x26b180(0x222)](_0x26b180(0x25d))[_0x26b180(0x241)](0x0,0xc);return'journey_entry_criteria_'+_0x45186b;}export function ensureJourneyDefaults(_0x1863af){const _0x29ec21=a152_0x17e28a;!_0x1863af[_0x29ec21(0x1a2)]&&(_0x1863af[_0x29ec21(0x1a2)]=''),!_0x1863af[_0x29ec21(0x23e)]&&(_0x1863af[_0x29ec21(0x23e)]='draft');}export function injectExistingStageIds(_0x13e8f6,_0x16e13e){const _0x37160c=a152_0x17e28a,_0x4a26c7=new Map(_0x16e13e['map'](_0x4df0ed=>[_0x4df0ed[_0x37160c(0x255)],_0x4df0ed['id']]));for(const _0xee26a4 of _0x13e8f6){if(!_0xee26a4['id']){const _0x21b811=_0x4a26c7[_0x37160c(0x252)](_0xee26a4[_0x37160c(0x255)]);_0x21b811&&(_0xee26a4['id']=_0x21b811);}}}export function resolveTDFolderPath(_0x5709ae,_0x361ee8,_0xc3aba3){const _0x57d8f3=a152_0x17e28a;if(!_0x361ee8)return _0x5709ae;if(_0x5709ae===_0xc3aba3||_0x5709ae[_0x57d8f3(0x264)](_0xc3aba3+'/'))return _0x5709ae;return _0x5709ae?_0xc3aba3+'/'+_0x5709ae:_0xc3aba3;}export function addFoldersToCreate(_0x1df7cd,_0x1a698f,_0x2e2150){const _0x21ddeb=a152_0x17e28a;if(!_0x1df7cd)return;if(_0x1a698f[_0x21ddeb(0x1f1)](_0x1df7cd))return;const _0x3232f8=_0x1df7cd[_0x21ddeb(0x260)]('/');let _0x54894e='';for(const _0x233f21 of _0x3232f8){_0x54894e=_0x54894e?_0x54894e+'/'+_0x233f21:_0x233f21,!_0x1a698f[_0x21ddeb(0x1f1)](_0x54894e)&&_0x2e2150[_0x21ddeb(0x275)](_0x54894e);}}export function sortFoldersByDepth(_0x1c6106){const _0x45733f=a152_0x17e28a;return[..._0x1c6106][_0x45733f(0x1b6)]((_0x491457,_0x29ee61)=>{const _0x4796ad=_0x45733f,_0x3027b0=(_0x491457['match'](/\//g)||[])['length'],_0x256d56=(_0x29ee61[_0x4796ad(0x277)](/\//g)||[])[_0x4796ad(0x27c)];return _0x3027b0-_0x256d56;});}import*as a152_0x46608f from'yaml';import{readFileSync}from'fs';import a152_0x3df059 from'path';import{isJourneyDef,parseYamlString as a152_0x4227b9,toYamlString as a152_0x29accb,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(_0x2570da){const _0x597a73=a152_0x17e28a;if(Array['isArray'](_0x2570da))return'['+_0x2570da[_0x597a73(0x21e)](_0x1ccf5=>stableStringify(_0x1ccf5))['join'](',')+']';if(_0x2570da&&typeof _0x2570da===_0x597a73(0x1ad)){const _0x58c6ef=_0x2570da,_0x1fc0dd=Object[_0x597a73(0x19d)](_0x58c6ef)[_0x597a73(0x1b6)](),_0x4f5b07=_0x1fc0dd[_0x597a73(0x21e)](_0x81a438=>'\x22'+_0x81a438+'\x22:'+stableStringify(_0x58c6ef[_0x81a438]));return'{'+_0x4f5b07[_0x597a73(0x1cb)](',')+'}';}const _0x4437a9=JSON[_0x597a73(0x20c)](_0x2570da);return _0x4437a9===undefined?_0x597a73(0x258):_0x4437a9;}function a152_0x429e(){const _0x1da185=['deleteSegment','getSegmentEntity\x20also\x20failed\x20for\x20','730505tjpfhA','journeyBundlesByFolderAndName','notification','.$1.push-recovery.json','Matched\x20server\x20segment\x20\x27','679480rUBpBK','Fetching\x20','169610CuzBGJ','2789196zfGzyz','\x27\x20by\x20rule\x20content','behavior','size','from','folderPathToId','Updating\x20segment\x20\x27','entry_criteria','createActivation','onProgress','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','14bnqTEq','has','\x27\x20decision\x20point\x20branch\x20\x27','conditionTimeoutUnit','\x0a\x20\x20','\x20(referenced\x20in\x20journey\x20','parseDocument','logSuccess','Created\x20segment\x20\x27','conditionSegmentId','\x27\x20entry\x20criteria','Stage\x20\x27','\x27\x20wait\x20condition','segmentByFolderAndName','filter','Activation\x20not\x20found:\x20','embedded_segment_created','branches','index','activations','Deleted\x20segment\x20\x27','includes','values','journey_updated','INTERNAL','Creating\x20folder\x20\x27','yamlActivation','create','stringify','attributes','Failed\x20to\x20fetch\x20referenced\x20segment\x20','entries','\x27\x20for\x20','activationContext','idToEmailMap','stage\x20\x27','segment_updated','relative','entryCriteria','2GIFQGG','embedded_segment_creating','98rgiYkT','segmentFolderId','__pending_act_','existingJourney','activation_','map','reduce','valid','activationParams','digest','SEGMENT_NOT_FOUND','12xCRdnE','type','createdSegmentIds','message','Entry\x20criteria:\x20','journeys','conditions','updated','created','connection','run_after_journey_refresh','3946780ictuWa','tdx.sdk.push-workflow','schedule','resolvedRule','waitStepType','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','getLatestJourneyId','ACTIVATION_UPDATE_ERROR','Updated\x20segment\x20\x27','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','updateSegmentById','18fmGiJl','parentId','all','embeddedSegmentNameToId','state','toLowerCase','replace','slice','nameToId','Duration','Condition','getSegmentEntity','max','folderPath','Segment\x20not\x20found','and\x20the\x20server\x20segment,\x20then\x20retry.','activation_deleting','user','./child-segment-yaml.js','12553585PXsIBl','Updating\x20activation\x20\x27','rule','folder_creating','item','get','activation_deleted',').\x20','name','NOT_FOUND','journeyActivationStepId','null','createdSegmentId','segment_deleted','\x27\x20from\x20file:\x20','find','hex','3ZypDca','logWarning','split','milestone','withProgress','Failed\x20to\x20','startsWith','JOURNEY_UPDATE_ERROR','journeyBundleId','journey_updating','activation_updating','data','conditionTimeoutDuration','segments','journeyName','5zZNejm','existingActivation','activationsBySegmentId','utf-8','update','columns','journeyById','absolutePath','add','rootFolderId','match','buildUserMaps','folder','activation_template_id',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','length','toISOString','logInfo','Creating\x20activation\x20\x27','waitStep','progress','folderId','parentSegmentFolder','DecisionPoint','deleted','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','resolveSegment','getActivation','\x27...','Updated\x20activation\x20\x27','sha1','\x20activation\x20\x27','steps','logDeleted','versionNumber','31146726ESlczT','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','unchanged','goal','Creating\x20segment\x20\x27','journey','uniqueServerName','connectionIdToNameMap','Deleting\x20activation\x20\x27','segmentId','Delete\x20the\x20push\x20recovery\x20file\x20(','keys','deps','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','existingSegment','yamlConfig','description','entry','WaitStep','set','skipSegments','existingSegments','\x27\x20milestone','./journey-yaml.js','../../utils/async.js','listActivations','\x20journey\x20from\x20file:\x20','object','segment','Failed\x20to\x20resolve\x20segment\x20','action','localName','segment_updating','\x20error(s)','diff','journeyId','sort','parse','with','all_columns','day','activation_created','waitStepUnit','segment_created','validatedRequest','delete','Activation','push','journeyBundleName','journeyStages','\x20segment\x20from\x20file:\x20','SEGMENT_UPDATE_ERROR','journey_created','createSegment','Failed\x20to\x20resolve\x20activation\x20','errors','segmentNameToId','join','debug','exitCriterias','isNew','goal\x20criteria','idToName','Segment\x20not\x20found:\x20','relationships','resolveJourneyId','list','connector_config','getJourney','hasChanges','\x27\x20exit\x20criteria','kind','Embedded\x20segment\x20\x27'];a152_0x429e=function(){return _0x1da185;};return a152_0x429e();}function activationSignature(_0x2f394c){const _0x16ff60=a152_0x17e28a,_0x1bea12={'connection':_0x2f394c[_0x16ff60(0x22d)],..._0x2f394c[_0x16ff60(0x1b9)]!==undefined&&{'all_columns':_0x2f394c[_0x16ff60(0x1b9)]},..._0x2f394c['columns']!==undefined&&{'columns':_0x2f394c[_0x16ff60(0x272)]},..._0x2f394c[_0x16ff60(0x1e7)]!==undefined&&{'behavior':_0x2f394c[_0x16ff60(0x1e7)]},..._0x2f394c[_0x16ff60(0x231)]!==undefined&&{'schedule':_0x2f394c[_0x16ff60(0x231)]},..._0x2f394c[_0x16ff60(0x1df)]!==undefined&&{'notification':_0x2f394c[_0x16ff60(0x1df)]},..._0x2f394c['connector_config']!==undefined&&{'connector_config':_0x2f394c[_0x16ff60(0x1d5)]},..._0x2f394c['activation_template_id']!==undefined&&{'activation_template_id':_0x2f394c[_0x16ff60(0x27a)]}};return stableStringify(_0x1bea12);}async function fetchSegment(_0x537789,_0x533dd3,_0x10b6b4,_0x563078){const _0x1e7f05=a152_0x17e28a,_0x149112=_0x563078?.[_0x1e7f05(0x25c)](_0x1fca13=>_0x1fca13['id']===_0x10b6b4);if(_0x149112)return _0x149112;try{return await _0x537789[_0x1e7f05(0x1ae)]['getSegment'](_0x533dd3,_0x10b6b4);}catch(_0x52cfe6){logger['debug']('getSegment\x20failed\x20for\x20'+_0x10b6b4+_0x1e7f05(0x27b)+_0x52cfe6);try{return await _0x537789[_0x1e7f05(0x1ae)][_0x1e7f05(0x245)](_0x10b6b4);}catch(_0x5497e9){return logger[_0x1e7f05(0x1cc)](_0x1e7f05(0x1dc)+_0x10b6b4+':\x20'+_0x5497e9),null;}}}function recoverSegmentIdsFromPushRecovery(_0x502118,_0x557999,_0x1404d0){const _0x1c30ab=a152_0x17e28a,_0x11de57=readPushRecovery(_0x502118[_0x1c30ab(0x274)]);if(_0x11de57?.['journeyName']===_0x502118[_0x1c30ab(0x1a1)][_0x1c30ab(0x255)])for(const [_0x14ace4,_0xa6178e]of Object['entries'](_0x11de57[_0x1c30ab(0x26b)])){const _0x106e12=generateDeterministicJourneySegmentName(_0x502118['yamlConfig']['name'],_0x14ace4);_0xa6178e['uniqueServerName']===_0x106e12&&(_0x557999[_0x1c30ab(0x1a5)](_0x14ace4,_0xa6178e[_0x1c30ab(0x19b)]),_0x1404d0['set'](_0x14ace4,_0xa6178e['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x46d30c,_0x28560c,_0x2514b8,_0xc8395){const _0x2272fc=a152_0x17e28a;let _0x2fbc8a;try{_0x2fbc8a=await _0x46d30c[_0x2272fc(0x1ae)]['createJourneySegment']({'name':_0x2514b8['uniqueSegmentName'],'description':_0x2514b8[_0x2272fc(0x1a2)],'journeyId':_0x2514b8['journeyId'],'rule':_0xc8395(_0x2514b8[_0x2272fc(0x232)],!![]),'countPopulation':!![],'parentFolderId':_0x2514b8[_0x2272fc(0x282)],'audienceId':_0x2514b8[_0x2272fc(0x23b)]});}catch(_0x3f53e1){const _0x29d2b5=_0x3f53e1 instanceof Error&&_0x3f53e1[_0x2272fc(0x227)][_0x2272fc(0x205)]('Name\x20has\x20already\x20been\x20taken');if(_0x29d2b5){const _0xf275f1=readPushRecovery(_0x28560c[_0x2272fc(0x274)]),_0x272d72=_0xf275f1?.[_0x2272fc(0x26c)]===_0x28560c[_0x2272fc(0x1a1)][_0x2272fc(0x255)]?_0xf275f1[_0x2272fc(0x26b)][_0x2514b8[_0x2272fc(0x1b1)]]:undefined;if(_0x272d72?.[_0x2272fc(0x198)]===_0x2514b8['uniqueSegmentName'])await _0x46d30c[_0x2272fc(0x1ae)][_0x2272fc(0x239)](_0x2514b8[_0x2272fc(0x23b)],_0x272d72[_0x2272fc(0x19b)],{'description':_0x2514b8[_0x2272fc(0x1a2)],'rule':_0xc8395(_0x2514b8[_0x2272fc(0x232)],!![]),'countPopulation':!![]}),_0x2fbc8a=_0x272d72[_0x2272fc(0x19b)];else throw new SDKError(ErrorCode[_0x2272fc(0x1c5)],_0x2272fc(0x1da)+_0x2514b8['localName']+_0x2272fc(0x238)+(_0x2272fc(0x19c)+_0x28560c[_0x2272fc(0x274)]['replace'](/([^/]+)$/,_0x2272fc(0x1e0))+')\x20')+_0x2272fc(0x249),_0x3f53e1);}else throw _0x3f53e1;}return saveSegmentToPushRecovery(_0x28560c['absolutePath'],_0x28560c[_0x2272fc(0x1a1)][_0x2272fc(0x255)],_0x2514b8[_0x2272fc(0x1b1)],{'segmentId':_0x2fbc8a,'uniqueServerName':_0x2514b8['uniqueSegmentName'],'createdAt':new Date()[_0x2272fc(0x27d)]()}),_0x2fbc8a;}export async function prepareSegmentFiles(_0x4cdb46,_0x5beef2,_0x1d1b46,_0x847b23,_0xc40e6e){const _0x8db653=a152_0x17e28a,{activationDefToCreateRequest:_0x330329}=await import(_0x8db653(0x24c)),_0x3e5dd9=[],_0xa79865=new Set();for(const {yamlConfig:_0x2c8868,folderPath:_0x75e95e,sourcePath:_0x50d3f1}of _0x4cdb46){const _0x37bb76=resolveTDFolderPath(_0x75e95e,_0x847b23,_0xc40e6e),_0x587ffe=_0x37bb76+':'+_0x2c8868[_0x8db653(0x255)],_0x8f4154=_0x5beef2[_0x8db653(0x1fd)][_0x8db653(0x252)](_0x587ffe),_0x5caef1=_0x8f4154?_0x5beef2[_0x8db653(0x26f)]['get'](_0x8f4154['id'])||[]:[];addFoldersToCreate(_0x37bb76,_0x5beef2[_0x8db653(0x1ea)],_0xa79865);const _0x344b32=calculateActivationActions(_0x2c8868[_0x8db653(0x203)]||[],_0x5caef1,_0x5beef2[_0x8db653(0x212)],_0x5beef2['connectionIdToNameMap']);for(const _0x379615 of _0x344b32){(_0x379615[_0x8db653(0x225)]==='create'||_0x379615[_0x8db653(0x225)]===_0x8db653(0x271))&&_0x379615[_0x8db653(0x20a)]&&(_0x379615[_0x8db653(0x1be)]=await _0x330329(_0x379615[_0x8db653(0x20a)],_0x1d1b46));}const _0x2ea6d4=calculateSegmentDiff(_0x2c8868,_0x8f4154,_0x5caef1,_0x5beef2[_0x8db653(0x212)],_0x5beef2[_0x8db653(0x199)]);_0x3e5dd9[_0x8db653(0x1c1)]({'relativePath':_0x2c8868[_0x8db653(0x255)],'absolutePath':_0x50d3f1,'yamlConfig':_0x2c8868,'folderPath':_0x37bb76,'existingSegment':_0x8f4154,'existingActivations':_0x5caef1,'isNew':_0x2ea6d4[_0x8db653(0x1ce)],'hasChanges':_0x2ea6d4['hasChanges'],'diff':_0x2ea6d4[_0x8db653(0x1b4)],'activationActions':_0x344b32});}return{'segmentFiles':_0x3e5dd9,'foldersToCreate':_0xa79865};}export async function prepareJourneyFiles(_0x108b37,_0x5db8df,_0x4e5df8,_0x225d8e){const _0x50aabd=a152_0x17e28a,_0x112052=[],_0x5db03e=new Set();for(const {yamlConfig:_0x1d2580,folderPath:_0x2813fb,sourcePath:_0x56b1cf}of _0x108b37){const _0x5a1db5=resolveTDFolderPath(_0x2813fb,_0x4e5df8,_0x225d8e),_0x353c38=_0x5a1db5+':'+_0x1d2580['name'],_0x4bd3cb=_0x5db8df[_0x50aabd(0x1de)][_0x50aabd(0x252)](_0x353c38);let _0x4b50e4,_0x6e9cb3;if(_0x4bd3cb&&_0x4bd3cb[_0x50aabd(0x27c)]>0x0){const _0x5aa416=buildLocalExpandedRuleMappings(_0x1d2580),{createYamlContext:_0x11a9b4,prefetchJourneySegments:_0x1b676c}=createPushYamlContextForBundle(_0x5db8df[_0x50aabd(0x19e)],_0x5db8df['parentId'],_0x5db8df['existingSegments'],_0x5aa416,_0x5db8df[_0x50aabd(0x212)],_0x5db8df[_0x50aabd(0x199)],_0x5db8df['activationStepsById'],_0x5db8df[_0x50aabd(0x273)]);await _0x1b676c(_0x4bd3cb['map'](_0x4d38f7=>_0x4d38f7['id']));const _0x109944=await _0x5db8df[_0x50aabd(0x19e)]['journey'][_0x50aabd(0x235)](_0x4bd3cb[0x0][_0x50aabd(0x266)]),_0x44308a=hasMultipleVersions(_0x1d2580),_0x273e21=async _0x3606d1=>{const _0x2cc82d=_0x50aabd,_0x302ecf=_0x5db8df[_0x2cc82d(0x273)]?.[_0x2cc82d(0x252)](_0x3606d1);if(_0x302ecf)return _0x302ecf;return _0x5db8df['fetchJourney']({'journeyId':_0x3606d1,'journeyName':_0x1d2580[_0x2cc82d(0x255)],'isMultiVersion':_0x4bd3cb[_0x2cc82d(0x27c)]>0x1});};if(_0x44308a&&_0x4bd3cb['length']>0x1){const _0x1e5fcf=[];for(const _0x539d61 of _0x4bd3cb){const _0x26a7ac=_0x539d61['versionNumber']||0x1;_0x5db8df['progress']?.[_0x50aabd(0x271)](_0x50aabd(0x1e3)+_0x1d2580['name']+'\x20v'+_0x26a7ac);const _0x459fa4=await _0x273e21(_0x539d61['id']),_0x288c30=_0x11a9b4(_0x539d61['id']),_0x438e4b=await journeyResponseToDef(_0x459fa4,_0x288c30);_0x1e5fcf[_0x50aabd(0x1c1)]({'item':_0x539d61,'yaml':_0x438e4b});}const _0x2f39c0=buildLocalRuleToNameMappingFromJourney(_0x1d2580);_0x6e9cb3=buildMergedJourneyDef(_0x1e5fcf,_0x2f39c0,_0x109944);const _0x327239=Math[_0x50aabd(0x246)](..._0x1e5fcf['map'](_0x451434=>_0x451434[_0x50aabd(0x251)][_0x50aabd(0x28f)]||0x0)),_0x11ab48=_0x4bd3cb[_0x50aabd(0x25c)](_0x408d83=>(_0x408d83[_0x50aabd(0x28f)]||0x0)===_0x327239);_0x11ab48&&(_0x5db8df[_0x50aabd(0x281)]?.[_0x50aabd(0x271)]('Fetching\x20'+_0x1d2580[_0x50aabd(0x255)]+'\x20v'+_0x327239),_0x4b50e4=await _0x273e21(_0x11ab48['id']));}else{const _0x2d9599=_0x4bd3cb[_0x4bd3cb['length']-0x1];_0x5db8df[_0x50aabd(0x281)]?.['update'](_0x50aabd(0x1e3)+_0x1d2580['name']),_0x4b50e4=await _0x273e21(_0x2d9599['id']);const _0x44a8df=_0x11a9b4(_0x2d9599['id']),_0x59165c=await journeyResponseToDef(_0x4b50e4,_0x44a8df),_0x4000c1=buildLocalRuleToNameMappingFromJourney(_0x1d2580);_0x6e9cb3=buildMergedJourneyDef([{'item':_0x2d9599,'yaml':_0x59165c}],_0x4000c1,_0x109944);}}addFoldersToCreate(_0x5a1db5,_0x5db8df[_0x50aabd(0x1ea)],_0x5db03e);const _0x1eb7cf=calculateJourneyDiff(_0x1d2580,_0x6e9cb3);_0x112052[_0x50aabd(0x1c1)]({'relativePath':_0x1d2580[_0x50aabd(0x255)],'absolutePath':_0x56b1cf,'yamlConfig':_0x1d2580,'folderPath':_0x5a1db5,'existingJourney':_0x4b50e4,'isNew':_0x1eb7cf['isNew'],'hasChanges':_0x1eb7cf[_0x50aabd(0x1d7)],'diff':_0x1eb7cf[_0x50aabd(0x1b4)]});}return{'journeyFiles':_0x112052,'foldersToCreate':_0x5db03e};}export function calculateActivationActions(_0x180aa8,_0x3074a4,_0x5e688c,_0x4966da){const _0x9f2f09=a152_0x17e28a,_0x3ab617=[],_0x124bcb=new Map();for(const _0x298ffc of _0x3074a4){_0x124bcb['set'](_0x298ffc[_0x9f2f09(0x255)],_0x298ffc);}const _0x2e07ce=new Map();for(const _0x3f42a2 of _0x180aa8){_0x2e07ce['set'](_0x3f42a2[_0x9f2f09(0x255)],_0x3f42a2);}for(const _0x3fce76 of _0x180aa8){const _0x249aad=_0x124bcb[_0x9f2f09(0x252)](_0x3fce76[_0x9f2f09(0x255)]);if(!_0x249aad)_0x3ab617[_0x9f2f09(0x1c1)]({'type':_0x9f2f09(0x20b),'name':_0x3fce76[_0x9f2f09(0x255)],'yamlActivation':_0x3fce76});else{const _0x5b9315=activationResponseToDef(_0x249aad,_0x5e688c,_0x4966da),_0x309255=a152_0x46608f[_0x9f2f09(0x20c)](_0x5b9315),_0x270606=a152_0x46608f[_0x9f2f09(0x20c)](_0x3fce76);_0x309255!==_0x270606&&_0x3ab617[_0x9f2f09(0x1c1)]({'type':_0x9f2f09(0x271),'name':_0x3fce76[_0x9f2f09(0x255)],'yamlActivation':_0x3fce76,'existingActivation':_0x249aad});}}for(const _0x175763 of _0x3074a4){!_0x2e07ce[_0x9f2f09(0x1f1)](_0x175763[_0x9f2f09(0x255)])&&_0x3ab617['push']({'type':_0x9f2f09(0x1bf),'name':_0x175763[_0x9f2f09(0x255)],'existingActivation':_0x175763});}return _0x3ab617;}function calculateYamlDiff(_0x28080d,_0x44fb2e){if(_0x44fb2e){const _0x27a43f=generateDiff(_0x44fb2e,_0x28080d),_0x240365=hasChanges(_0x27a43f);return{'isNew':![],'hasChanges':_0x240365,'diff':_0x240365?formatDiffWithColors(_0x27a43f):undefined};}const _0x127f00=generateDiff('',_0x28080d);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x127f00)};}export function calculateSegmentDiff(_0x32237b,_0xc7d27f,_0x450f71,_0x44da24,_0xa69455){const _0x444a32=segmentToYamlString(_0x32237b),_0x49f622=_0xc7d27f?segmentToYamlString(segmentWithActivationsToYaml(_0xc7d27f,_0x450f71,undefined,_0x44da24,_0xa69455)):undefined;return calculateYamlDiff(_0x444a32,_0x49f622);}export function calculateJourneyDiff(_0x2117ae,_0x57530c){const _0x436ac6=normalizeJourneyDef(_0x2117ae,_0x2117ae),_0x29782a=a152_0x29accb(_0x436ac6),_0x358593=_0x57530c?a152_0x29accb(normalizeJourneyDef(_0x57530c,_0x2117ae)):undefined;return calculateYamlDiff(_0x29782a,_0x358593);}export function findSegmentsToDelete(_0x4fae4c,_0x3251dc,_0x7eeeae,_0x20f40e,_0x46fad3){const _0x558b40=a152_0x17e28a,_0x2cfaa6=new Set();for(const {yamlConfig:_0x36cadc,folderPath:_0x31ce6f}of _0x3251dc){_0x2cfaa6[_0x558b40(0x275)](_0x31ce6f+':'+_0x36cadc[_0x558b40(0x255)]);}return _0x4fae4c[_0x558b40(0x1fe)](_0x5b4d48=>{const _0x4f955e=_0x558b40,_0x464576=_0x5b4d48[_0x4f955e(0x21a)]?_0x7eeeae[_0x4f955e(0x252)](_0x5b4d48['segmentFolderId']['toString']())||'':'',_0x3998cf=_0x464576+':'+_0x5b4d48[_0x4f955e(0x255)];if(_0x2cfaa6[_0x4f955e(0x1f1)](_0x3998cf))return![];if(_0x46fad3)return _0x464576===_0x20f40e||_0x464576['startsWith'](_0x20f40e+'/');return!![];});}export function findJourneysToDelete(_0x267f2b,_0x322591,_0x473b88,_0x12d7ac,_0x338b68){const _0x2fab9d=a152_0x17e28a,_0x8c3883=new Set();for(const {yamlConfig:_0xfb7940,folderPath:_0x734fe2}of _0x322591){_0x8c3883[_0x2fab9d(0x275)](_0x734fe2+':'+_0xfb7940['name']);}return _0x267f2b[_0x2fab9d(0x1fe)](_0x2aa823=>{const _0x44a7d9=_0x2fab9d,_0x2d8528=_0x2aa823[_0x44a7d9(0x282)]?_0x473b88[_0x44a7d9(0x252)](_0x2aa823[_0x44a7d9(0x282)])||'':'',_0x16221b=_0x2d8528+':'+_0x2aa823[_0x44a7d9(0x1c2)];if(_0x8c3883[_0x44a7d9(0x1f1)](_0x16221b))return![];if(_0x338b68)return _0x2d8528===_0x12d7ac||_0x2d8528[_0x44a7d9(0x264)](_0x12d7ac+'/');return!![];});}export function buildSegmentLookupMap(_0x3492a8,_0x493a53){const _0x561031=a152_0x17e28a,_0x3a953d=new Map();for(const _0x2c17a9 of _0x3492a8){const _0xfb734f=_0x2c17a9[_0x561031(0x21a)]?_0x493a53[_0x561031(0x252)](_0x2c17a9[_0x561031(0x21a)]['toString']())||'':'',_0x10ac04=_0xfb734f+':'+_0x2c17a9[_0x561031(0x255)];_0x3a953d['set'](_0x10ac04,_0x2c17a9);}return _0x3a953d;}export function buildSegmentNameToIdMap(_0x17791b){const _0x1a9506=a152_0x17e28a,_0x3e7bb5=new Map();for(const _0x1887bf of _0x17791b){_0x3e7bb5['set'](_0x1887bf[_0x1a9506(0x255)],_0x1887bf['id']);}return _0x3e7bb5;}export function buildJourneyBundleLookupMap(_0x30dea8,_0x5630a4){const _0x56ee2c=a152_0x17e28a,_0x361cd4=new Map();for(const _0x163dc6 of _0x30dea8){const _0xe24d70=_0x163dc6[_0x56ee2c(0x282)]?_0x5630a4[_0x56ee2c(0x252)](_0x163dc6[_0x56ee2c(0x282)])||'':'',_0x29bfba=_0xe24d70+':'+_0x163dc6[_0x56ee2c(0x1c2)];!_0x361cd4[_0x56ee2c(0x1f1)](_0x29bfba)&&_0x361cd4[_0x56ee2c(0x1a5)](_0x29bfba,[]),_0x361cd4[_0x56ee2c(0x252)](_0x29bfba)[_0x56ee2c(0x1c1)](_0x163dc6);}for(const _0x3fc121 of _0x361cd4[_0x56ee2c(0x206)]()){_0x3fc121['sort']((_0x37b7ab,_0x162756)=>(_0x37b7ab[_0x56ee2c(0x28f)]||0x0)-(_0x162756[_0x56ee2c(0x28f)]||0x0));}return _0x361cd4;}export function collectFoldersToCreate(_0x303fed,_0x5d2aee){const _0x448975=a152_0x17e28a,_0x532e9a=new Set();for(const _0x5aed78 of _0x303fed){if(!_0x5aed78)continue;if(_0x5d2aee[_0x448975(0x1f1)](_0x5aed78))continue;const _0x44dc83=_0x5aed78[_0x448975(0x260)]('/');let _0x33e1b1='';for(const _0x456504 of _0x44dc83){_0x33e1b1=_0x33e1b1?_0x33e1b1+'/'+_0x456504:_0x456504,!_0x5d2aee[_0x448975(0x1f1)](_0x33e1b1)&&_0x532e9a[_0x448975(0x275)](_0x33e1b1);}}return _0x532e9a;}export function parseAndClassifyYamlFiles(_0x4f25c0,_0x104262,_0x107340){const _0x154095=a152_0x17e28a,_0x36d0ce=[],_0x41528a=[];for(const _0x31a8d6 of _0x4f25c0){const _0x3ac1a3=a152_0x3df059[_0x154095(0x215)](_0x104262,a152_0x3df059['dirname'](_0x31a8d6)),_0x292909=_0x3ac1a3==='.'?'':_0x3ac1a3[_0x154095(0x240)](/\\/g,'/'),_0x216c47=readFileSync(_0x31a8d6,_0x154095(0x270)),_0x2c4ee5=a152_0x46608f[_0x154095(0x1b7)](_0x216c47);if(isJourneyDef(_0x2c4ee5)){const _0x43d52b=a152_0x4227b9(_0x216c47);_0x41528a['push']({'yamlConfig':_0x43d52b,'folderPath':_0x292909,'sourcePath':_0x31a8d6});}else{if(!_0x107340?.[_0x154095(0x1a6)]){const _0x318a40=parseSegmentYamlFile(_0x216c47),_0xfc0d30=normalizeChildSegmentYaml(_0x318a40);_0x36d0ce[_0x154095(0x1c1)]({'yamlConfig':_0xfc0d30,'folderPath':_0x292909,'sourcePath':_0x31a8d6});}}}return{'segments':_0x36d0ce,'journeys':_0x41528a};}export function validateParsedFiles(_0x37a4d1,_0x19b9b6){const _0x15b42e=a152_0x17e28a,_0x1f51dd=[];for(const {yamlConfig:_0x95b3c,sourcePath:_0x4771d9}of _0x37a4d1[_0x15b42e(0x26b)]){const _0x1dabd9=readFileSync(_0x4771d9,_0x15b42e(0x270)),_0x458e95=a152_0x46608f[_0x15b42e(0x1f6)](_0x1dabd9),_0x46a9c0=validateSegmentDef(_0x95b3c,{'source':_0x1dabd9,'document':_0x458e95},{'skipSchema':!![]});if(!_0x46a9c0[_0x15b42e(0x220)]){const _0x1d82bb=a152_0x3df059['relative'](_0x19b9b6,_0x4771d9);_0x1f51dd[_0x15b42e(0x1c1)]({'filePath':_0x1d82bb,'source':_0x1dabd9,'result':_0x46a9c0,'isJourney':![]});}}for(const {yamlConfig:_0x44b139,sourcePath:_0x438c58}of _0x37a4d1['journeys']){const _0x3eb7b2=readFileSync(_0x438c58,'utf-8'),_0x420a56=a152_0x46608f[_0x15b42e(0x1f6)](_0x3eb7b2),_0x43b096=validateJourneyDef(_0x44b139,{'source':_0x3eb7b2,'document':_0x420a56},{'skipSchema':!![]});if(!_0x43b096[_0x15b42e(0x220)]){const _0x42eee7=a152_0x3df059['relative'](_0x19b9b6,_0x438c58);_0x1f51dd[_0x15b42e(0x1c1)]({'filePath':_0x42eee7,'source':_0x3eb7b2,'result':_0x43b096,'isJourney':!![]});}}return _0x1f51dd;}export function formatValidationErrors(_0x408c5b){const _0x3c83ea=a152_0x17e28a,_0x25ca0b=[];for(const {filePath:_0x34e445,source:_0x5c3241,result:_0x447724,isJourney:_0x27694b}of _0x408c5b){const _0x5cd5a8=_0x27694b?_0x3c83ea(0x197):_0x3c83ea(0x1ae);_0x25ca0b[_0x3c83ea(0x1c1)]('\x0a'+_0x34e445+'\x20('+_0x5cd5a8+'):\x20'+_0x447724[_0x3c83ea(0x1c9)][_0x3c83ea(0x27c)]+_0x3c83ea(0x1b3)),_0x25ca0b[_0x3c83ea(0x1c1)](formatValidationResult(_0x447724,_0x5c3241,_0x34e445));}return _0x25ca0b['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x2fc8d7){const _0x411e94=a152_0x17e28a,_0x17eb24=new Set(),_0x3ddb40=new Map(),_0x105c8a=collectSegmentUsageCounts(_0x2fc8d7);if(_0x2fc8d7[_0x411e94(0x26b)])for(const [_0x14cdc8,_0x4492d9]of Object[_0x411e94(0x20f)](_0x2fc8d7[_0x411e94(0x26b)])){_0x17eb24['add'](_0x14cdc8);if(_0x4492d9[_0x411e94(0x24f)]){const _0x308094=yamlRuleToApi(_0x4492d9[_0x411e94(0x24f)]),_0x3007dc=apiRuleToYaml(_0x308094);_0x3ddb40[_0x411e94(0x1a5)](_0x14cdc8,_0x3007dc);}}const _0x2e8d81=new Map();let _0x444933=0x0;for(const [_0x3bc39a,_0x3f0519]of _0x3ddb40){const _0x2f5d0a=serializeExpandedRule(_0x3f0519,_0x3ddb40),_0x4a7bd5=_0x2e8d81['get'](_0x2f5d0a)||[];_0x4a7bd5[_0x411e94(0x1c1)]({'name':_0x3bc39a,'index':_0x444933}),_0x2e8d81[_0x411e94(0x1a5)](_0x2f5d0a,_0x4a7bd5),_0x444933++;}const _0x10257e=new Map();for(const [_0x38ddef,_0x16caf3]of _0x2e8d81){const _0x3ffeb6=_0x16caf3[_0x411e94(0x241)]()[_0x411e94(0x1b6)]((_0x43bed1,_0x50cbfd)=>{const _0x431d3b=_0x411e94,_0x411812=_0x105c8a['get'](_0x43bed1[_0x431d3b(0x255)])||0x0,_0x1f0286=_0x105c8a['get'](_0x50cbfd[_0x431d3b(0x255)])||0x0;if(_0x411812!==_0x1f0286)return _0x1f0286-_0x411812;return _0x43bed1[_0x431d3b(0x202)]-_0x50cbfd[_0x431d3b(0x202)];})['map'](_0x439bd8=>_0x439bd8[_0x411e94(0x255)]),_0x2dd79e=[];for(const _0x168149 of _0x3ffeb6){const _0x472a80=_0x105c8a[_0x411e94(0x252)](_0x168149)||0x0,_0x224378=Math[_0x411e94(0x246)](_0x472a80,0x1);for(let _0x527b52=0x0;_0x527b52<_0x224378;_0x527b52++){_0x2dd79e[_0x411e94(0x1c1)](_0x168149);}}_0x10257e[_0x411e94(0x1a5)](_0x38ddef,_0x2dd79e);}return{'existingLocalSegmentNames':_0x17eb24,'localSegmentRules':_0x3ddb40,'localExpandedRuleToNames':_0x10257e};}export function createSegmentIdResolver(_0x542353,_0xcf8ab0){return async _0x1652df=>{const _0x55a8e5=a152_0x2b62,_0x46cb98=_0x542353[_0x55a8e5(0x252)](_0x1652df);if(!_0x46cb98)throw new SDKError(ErrorCode[_0x55a8e5(0x223)],'Segment\x20not\x20found:\x20'+_0x1652df+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0xcf8ab0+'\x27)');return _0x46cb98;};}export function extractRootFolderId(_0x194251){const _0x42d5de=a152_0x17e28a;return _0x194251[_0x42d5de(0x1d2)]?.[_0x42d5de(0x283)]?.[_0x42d5de(0x269)]?.['id']||_0x194251[_0x42d5de(0x1d2)]?.['parentFolder']?.[_0x42d5de(0x269)]?.['id'];}export function buildConnectionMaps(_0x432b92){const _0x4e2add=a152_0x17e28a,_0x3a023b=new Map(),_0x190adb=new Map(),_0x3613ce=new Map();for(const _0x239cca of _0x432b92){_0x3a023b[_0x4e2add(0x1a5)](_0x239cca['name'],parseInt(_0x239cca['id'],0xa)),_0x190adb[_0x4e2add(0x1a5)](_0x239cca['id'],_0x239cca['name']),_0x3613ce['set'](_0x239cca[_0x4e2add(0x255)],_0x239cca['type']);}return{'nameToId':_0x3a023b,'idToName':_0x190adb,'nameToType':_0x3613ce};}export function calculatePushStats(_0x3b5d61,_0x4087d0,_0x2daac9,_0x37c0a7,_0x1fc22b,_0x5f495a,_0x16641f){const _0xfbb1ed=a152_0x17e28a,_0x33e2e6=_0x3b5d61['filter'](_0x3dc41f=>_0x3dc41f[_0xfbb1ed(0x1ce)]),_0x53c473=_0x3b5d61['filter'](_0x2d431a=>!_0x2d431a[_0xfbb1ed(0x1ce)]&&_0x2d431a[_0xfbb1ed(0x1d7)]),_0x1e24f6=_0x3b5d61[_0xfbb1ed(0x1fe)](_0x275c8b=>!_0x275c8b[_0xfbb1ed(0x1ce)]&&!_0x275c8b[_0xfbb1ed(0x1d7)]),_0x1707bc=_0x5f495a?_0x37c0a7:[],_0x413b27=_0x4087d0[_0xfbb1ed(0x1fe)](_0x45ebfb=>_0x45ebfb[_0xfbb1ed(0x1ce)]),_0x1edea0=_0x4087d0[_0xfbb1ed(0x1fe)](_0x4154fb=>!_0x4154fb[_0xfbb1ed(0x1ce)]&&_0x4154fb['hasChanges']),_0x3434f0=_0x4087d0[_0xfbb1ed(0x1fe)](_0xc0be51=>!_0xc0be51[_0xfbb1ed(0x1ce)]&&!_0xc0be51[_0xfbb1ed(0x1d7)]),_0x1689a4=_0x5f495a?_0x1fc22b:[],_0x98857d=_0x3b5d61['flatMap'](_0x37cb32=>_0x37cb32['activationActions']),_0x56d897=_0x98857d['filter'](_0x3f0a0b=>_0x3f0a0b['type']==='create'),_0x48d3d0=_0x98857d['filter'](_0x5294e2=>_0x5294e2['type']===_0xfbb1ed(0x271)),_0x5b71f7=_0x98857d['filter'](_0x1f5e1a=>_0x1f5e1a[_0xfbb1ed(0x225)]===_0xfbb1ed(0x1bf)),_0x1572a1=Array[_0xfbb1ed(0x1e9)](_0x2daac9)[_0xfbb1ed(0x1b6)](),_0x1a6594=_0x16641f?![]:_0x33e2e6[_0xfbb1ed(0x27c)]>0x0||_0x53c473[_0xfbb1ed(0x27c)]>0x0||_0x1707bc[_0xfbb1ed(0x27c)]>0x0,_0x2a094a=_0x413b27['length']>0x0||_0x1edea0[_0xfbb1ed(0x27c)]>0x0||_0x1689a4[_0xfbb1ed(0x27c)]>0x0,_0x6a14e0=_0x16641f?![]:_0x98857d[_0xfbb1ed(0x27c)]>0x0,_0x46f941=_0x1572a1['length']>0x0;return{'segments':{'new':_0x33e2e6,'changed':_0x53c473,'unchanged':_0x1e24f6,'toDelete':_0x1707bc},'journeys':{'new':_0x413b27,'changed':_0x1edea0,'unchanged':_0x3434f0,'toDelete':_0x1689a4},'activations':{'all':_0x98857d,'toCreate':_0x56d897,'toUpdate':_0x48d3d0,'toDelete':_0x5b71f7},'folders':{'toCreate':_0x1572a1},'counts':{'segments':{'new':_0x33e2e6[_0xfbb1ed(0x27c)],'changed':_0x53c473['length'],'unchanged':_0x1e24f6[_0xfbb1ed(0x27c)],'toDelete':_0x1707bc['length']},'journeys':{'new':_0x413b27['length'],'changed':_0x1edea0[_0xfbb1ed(0x27c)],'unchanged':_0x3434f0['length'],'toDelete':_0x1689a4[_0xfbb1ed(0x27c)]},'activations':{'create':_0x56d897['length'],'update':_0x48d3d0['length'],'delete':_0x5b71f7[_0xfbb1ed(0x27c)]},'folders':_0x1572a1[_0xfbb1ed(0x27c)]},'hasChanges':_0x1a6594||_0x2a094a||_0x6a14e0||_0x46f941};}export async function buildPushExecutionContext(_0x4396af,_0x4e3fb4,_0x1c1521,_0x49b595,_0x1bd7cf,_0x192369){const _0x1454f8=a152_0x17e28a,_0x5753d7=extractRootFolderId(_0x1c1521),{pathToId:_0x154f0c,idToPath:_0x4762d7}=buildFolderMaps(_0x1bd7cf),_0x228ccf=buildSegmentNameToIdMap(_0x49b595),_0x799d7e=new Map(),{batchAsync:_0x1e4f95}=await import('../../utils/async.js'),[_0x1b0886,_0x570d93]=await Promise[_0x1454f8(0x23c)]([_0x4396af[_0x1454f8(0x24b)][_0x1454f8(0x278)](),_0x4396af[_0x1454f8(0x22d)][_0x1454f8(0x1d4)](),((async()=>{const _0x1568f8=_0x1454f8;!_0x192369&&_0x49b595[_0x1568f8(0x27c)]>0x0&&await _0x1e4f95(_0x49b595,async _0x2b956c=>{const _0x43ecba=_0x1568f8,_0x2ca572=await _0x4396af[_0x43ecba(0x1ae)][_0x43ecba(0x1ab)](_0x4e3fb4,_0x2b956c['id']);_0x799d7e[_0x43ecba(0x1a5)](_0x2b956c['id'],_0x2ca572);});})())]),{emailToId:_0x1ac535,idToEmail:_0x5e5d70}=_0x1b0886,_0x543b0e=buildConnectionMaps(_0x570d93);return{'rootFolderId':_0x5753d7,'folderPathToId':_0x154f0c,'folderIdToPath':_0x4762d7,'segmentNameToId':_0x228ccf,'activationsBySegmentId':_0x799d7e,'emailToIdMap':_0x1ac535,'idToEmailMap':_0x5e5d70,'connectionNameToIdMap':_0x543b0e[_0x1454f8(0x242)],'connectionIdToNameMap':_0x543b0e[_0x1454f8(0x1d0)],'connectionNameToTypeMap':_0x543b0e['nameToType']};}export function createPushYamlContextForBundle(_0x235694,_0x57b142,_0x553e7d,_0x3f0216,_0x32e472,_0x32a303,_0x2d98f0,_0x1b5111){const {existingLocalSegmentNames:_0xfb622,localExpandedRuleToNames:_0x99201f}=_0x3f0216,_0x58da08=new Set(),_0x560984=new Map(),_0x8b0670=new Map(),_0x40012e=new Map(),_0x34c1b5=createJumpTargetCache(),_0x17a84e=new Map(),_0x5633b9=new Map(),_0x11ff6a=new Set();let _0x2bd2b3;const _0x3d03a4=_0x221104=>{const _0x128856={'resolveSegment':async _0x3aeb06=>{const _0x4f9bc6=a152_0x2b62,_0x2bd99b=_0x40012e[_0x4f9bc6(0x252)](_0x3aeb06);if(_0x2bd99b!==undefined)return{'name':_0x2bd99b,'isJourneyLocal':!![]};try{const _0xf2aa=await fetchSegment(_0x235694,_0x57b142,_0x3aeb06,_0x553e7d);if(!_0xf2aa)throw new Error(_0x4f9bc6(0x248));const _0x1c269a=generateJourneyLocalName(_0xf2aa[_0x4f9bc6(0x255)]),_0x2d769d=_0xf2aa[_0x4f9bc6(0x1d9)]===SEGMENT_KIND_JOURNEY&&_0x1c269a!==undefined;let _0x3f7b14=_0xf2aa[_0x4f9bc6(0x255)],_0x9dbbdf;if(_0x2d769d&&_0xf2aa[_0x4f9bc6(0x24f)]){const _0xffc110=apiRuleToYaml(_0xf2aa[_0x4f9bc6(0x24f)]);_0x5633b9['set'](_0x3aeb06,_0xffc110);const _0x145c24=async _0x525f90=>{const _0x274196=_0x4f9bc6,_0xf0c64=collectSegmentRefsFromRule(_0x525f90);for(const _0x3716f7 of _0xf0c64){if(!_0x5633b9[_0x274196(0x1f1)](_0x3716f7))try{const _0xa7fac1=await fetchSegment(_0x235694,_0x57b142,_0x3716f7,_0x553e7d);if(_0xa7fac1?.['rule']){const _0x26fa6f=apiRuleToYaml(_0xa7fac1[_0x274196(0x24f)]);_0x5633b9[_0x274196(0x1a5)](_0x3716f7,_0x26fa6f),await _0x145c24(_0x26fa6f);}}catch(_0x14b3be){logger[_0x274196(0x1cc)](_0x274196(0x20e)+_0x3716f7+':\x20'+_0x14b3be);}}};await _0x145c24(_0xffc110);const _0x3ce996=serializeExpandedRule(_0xffc110,_0x5633b9),_0x37af90=_0x99201f[_0x4f9bc6(0x252)](_0x3ce996);if(_0x37af90&&_0x37af90['length']>0x0){const _0x574268=_0x560984[_0x4f9bc6(0x252)](_0x3ce996)||0x0,_0x5d4bd7=_0x37af90[_0x574268]||_0x37af90[_0x37af90[_0x4f9bc6(0x27c)]-0x1];_0x560984[_0x4f9bc6(0x1a5)](_0x3ce996,_0x574268+0x1),_0x3f7b14=_0x5d4bd7,_0x58da08[_0x4f9bc6(0x275)](_0x3f7b14),_0x40012e[_0x4f9bc6(0x1a5)](_0x3aeb06,_0x3f7b14);const _0x552fa9=await resolveRuleSegmentRefs(_0xffc110,async _0x1be401=>{const _0x46d38d=_0x4f9bc6,_0x1eb12f=_0x40012e['get'](_0x1be401);if(_0x1eb12f)return _0x1eb12f;const _0x4a0432=await _0x2bd2b3[_0x46d38d(0x287)](_0x1be401);return _0x4a0432[_0x46d38d(0x255)];});_0x9dbbdf={'description':_0xf2aa['description'],'rule':_0x552fa9};}else{const _0x5998fd=_0x17a84e[_0x4f9bc6(0x252)](_0x3ce996);if(_0x5998fd)_0x3f7b14=_0x5998fd,_0x40012e['set'](_0x3aeb06,_0x3f7b14);else{if(_0x1c269a){let _0x192bea=_0x1c269a,_0x55caa1=0x2;while(_0x58da08['has'](_0x192bea)||_0xfb622[_0x4f9bc6(0x1f1)](_0x192bea)){_0x192bea=_0x1c269a+'_'+_0x55caa1,_0x55caa1++;}_0x58da08[_0x4f9bc6(0x275)](_0x192bea),_0x3f7b14=_0x192bea;}_0x40012e[_0x4f9bc6(0x1a5)](_0x3aeb06,_0x3f7b14),_0x17a84e[_0x4f9bc6(0x1a5)](_0x3ce996,_0x3f7b14);const _0xef2ea0=await resolveRuleSegmentRefs(_0xffc110,async _0x6cd642=>{const _0x1f53ff=_0x4f9bc6,_0x3641f5=_0x40012e[_0x1f53ff(0x252)](_0x6cd642);if(_0x3641f5)return _0x3641f5;const _0x56283c=await _0x2bd2b3[_0x1f53ff(0x287)](_0x6cd642);return _0x56283c['name'];});_0x9dbbdf={'description':_0xf2aa[_0x4f9bc6(0x1a2)],'rule':_0xef2ea0};}}}return{'name':_0x3f7b14,'isJourneyLocal':_0x2d769d,'definition':_0x9dbbdf};}catch(_0x5db64d){return logger[_0x4f9bc6(0x1cc)](_0x4f9bc6(0x1af)+_0x3aeb06+':\x20'+_0x5db64d),{'name':_0x3aeb06,'isJourneyLocal':![]};}},'resolveActivation':async _0x146cd1=>{const _0x530119=a152_0x2b62,_0x30e44e=_0x8b0670[_0x530119(0x252)](_0x146cd1);if(_0x30e44e!==undefined)return{'name':_0x30e44e,'isJourneyLocal':!![]};try{let _0x287583=_0x2d98f0?.[_0x530119(0x252)](_0x146cd1);!_0x287583&&(_0x287583=await _0x235694[_0x530119(0x197)][_0x530119(0x288)](_0x221104,_0x146cd1));const _0x3c4700=_0x287583[_0x530119(0x20d)][_0x530119(0x221)][_0x530119(0x255)]||_0x146cd1,_0x34b57c=sanitizeYamlKey(_0x3c4700)||_0x530119(0x21d)+_0x146cd1,_0x3dec17=_0x34b57c;_0x8b0670[_0x530119(0x1a5)](_0x146cd1,_0x3dec17);const _0x36b306=journeyActivationStepToYaml(_0x287583,_0x32e472,_0x32a303);return{'name':_0x3dec17,'isJourneyLocal':!![],'definition':_0x36b306};}catch(_0x507b80){return logger['debug'](_0x530119(0x1c8)+_0x146cd1+':\x20'+_0x507b80),{'name':_0x146cd1,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x127a66,_0x1cdb55)=>resolveJumpTarget(_0x127a66,_0x1cdb55,_0x34c1b5,async _0x465594=>{const _0x1239e6=a152_0x2b62,_0x45888a=_0x1b5111?.[_0x1239e6(0x252)](_0x465594);if(_0x45888a)return _0x45888a;return _0x235694[_0x1239e6(0x197)]['getJourney'](_0x465594);})};return _0x2bd2b3=_0x128856,_0x128856;},_0x5ced7a=async _0x50bae2=>{const _0x390004=a152_0x2b62,{collectSegmentIdsFromJourneyApi:_0x596e7e}=await import(_0x390004(0x1a9)),{batchAsync:_0x1513f7}=await import(_0x390004(0x1aa)),_0x397432=new Set();for(const _0x146f74 of _0x50bae2){let _0x13b672=_0x1b5111?.['get'](_0x146f74);!_0x13b672&&(_0x13b672=await _0x235694[_0x390004(0x197)][_0x390004(0x1d6)](_0x146f74));const _0x3c5ad0=_0x596e7e(_0x13b672);for(const _0x2a5494 of _0x3c5ad0){_0x397432[_0x390004(0x275)](_0x2a5494);}}let _0x3cb2a9=Array[_0x390004(0x1e9)](_0x397432);while(_0x3cb2a9[_0x390004(0x27c)]>0x0){const _0x1d7087=_0x3cb2a9[_0x390004(0x1fe)](_0x53e7a5=>!_0x11ff6a[_0x390004(0x1f1)](_0x53e7a5));if(_0x1d7087[_0x390004(0x27c)]===0x0)break;const _0x301bc7=await _0x1513f7(_0x1d7087,async _0x2899d0=>{const _0x1919c8=_0x390004;_0x11ff6a[_0x1919c8(0x275)](_0x2899d0);const _0x2bf023=await fetchSegment(_0x235694,_0x57b142,_0x2899d0,_0x553e7d);if(!_0x2bf023)return null;return{'segmentId':_0x2899d0,'segment':_0x2bf023};},0xa),_0x1a92f7=new Set();for(const _0x7e0146 of _0x301bc7){if(!_0x7e0146?.[_0x390004(0x1ae)]?.[_0x390004(0x24f)])continue;const _0x40ef55=apiRuleToYaml(_0x7e0146[_0x390004(0x1ae)]['rule']);_0x5633b9[_0x390004(0x1a5)](_0x7e0146['segmentId'],_0x40ef55);const _0x8b1f96=collectSegmentRefsFromRule(_0x40ef55);for(const _0x2667ea of _0x8b1f96){!_0x11ff6a['has'](_0x2667ea)&&_0x1a92f7[_0x390004(0x275)](_0x2667ea);}}_0x3cb2a9=Array[_0x390004(0x1e9)](_0x1a92f7);}};return{'createYamlContext':_0x3d03a4,'prefetchJourneySegments':_0x5ced7a};}export async function executePushSegments(_0x1a4295,_0x185250,_0x5e26fa,_0x13b3ad,_0x42cafd){const _0x15a636=a152_0x17e28a,{segmentDefToCreateRequest:_0x499aeb,segmentDefToUpdateRequest:_0x2a8a8b}=await import(_0x15a636(0x24c)),_0x171d7f=_0x5e26fa[_0x15a636(0x1ea)],_0x98e70b=0x5,_0x13df31=async _0x1a3a87=>{const _0x58329e=_0x15a636,_0x59907f=_0x1a3a87[_0x58329e(0x247)]?_0x171d7f[_0x58329e(0x252)](_0x1a3a87[_0x58329e(0x247)]):undefined;let _0x362e31;const _0xbcd886={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x150b55=_0x1a3a87[_0x58329e(0x1a1)];if(_0x1a3a87['yamlConfig'][_0x58329e(0x24f)]){const _0x55bdaf=createSegmentIdResolver(_0x5e26fa[_0x58329e(0x1ca)],_0x1a3a87[_0x58329e(0x1a1)]['name']),_0x2ec8fe=await resolveRuleSegmentIds(_0x1a3a87[_0x58329e(0x1a1)][_0x58329e(0x24f)],_0x55bdaf);_0x150b55={..._0x1a3a87[_0x58329e(0x1a1)],'rule':_0x2ec8fe};}try{if(_0x1a3a87[_0x58329e(0x1ce)]){_0x42cafd['onProgress']?.({'type':'segment_creating','name':_0x1a3a87[_0x58329e(0x1a1)][_0x58329e(0x255)]});const _0xb9ab32=_0x499aeb(_0x150b55,_0x59907f),_0x1e633e=await _0x42cafd[_0x58329e(0x262)](_0x58329e(0x196)+_0x1a3a87[_0x58329e(0x1a1)]['name']+_0x58329e(0x289),()=>_0x1a4295[_0x58329e(0x1ae)][_0x58329e(0x1c7)](_0x13b3ad[_0x58329e(0x23b)],_0xb9ab32));_0x362e31=_0x1e633e[_0x58329e(0x269)]['id'],_0x5e26fa['segmentNameToId'][_0x58329e(0x1a5)](_0x1a3a87[_0x58329e(0x1a1)][_0x58329e(0x255)],_0x362e31),_0xbcd886[_0x58329e(0x259)]={'name':_0x1a3a87[_0x58329e(0x1a1)][_0x58329e(0x255)],'id':_0x362e31},_0x42cafd[_0x58329e(0x1ee)]?.({'type':_0x58329e(0x1bd),'name':_0x1a3a87['yamlConfig'][_0x58329e(0x255)],'segmentId':_0x362e31}),_0x42cafd[_0x58329e(0x1f7)]?.(_0x58329e(0x1f8)+_0x1a3a87[_0x58329e(0x1a1)][_0x58329e(0x255)]+'\x27'),_0xbcd886[_0x58329e(0x22c)]=0x1;}else{if(_0x1a3a87[_0x58329e(0x1d7)]){_0x42cafd['onProgress']?.({'type':_0x58329e(0x1b2),'name':_0x1a3a87[_0x58329e(0x1a1)][_0x58329e(0x255)]});const _0x3416ff=_0x2a8a8b(_0x150b55);_0x59907f!==_0x1a3a87['existingSegment']?.[_0x58329e(0x21a)]&&(_0x3416ff[_0x58329e(0x21a)]=_0x59907f?parseInt(_0x59907f,0xa):undefined),await _0x42cafd[_0x58329e(0x262)](_0x58329e(0x1eb)+_0x1a3a87[_0x58329e(0x1a1)][_0x58329e(0x255)]+_0x58329e(0x289),()=>_0x1a4295[_0x58329e(0x1ae)][_0x58329e(0x239)](_0x13b3ad[_0x58329e(0x23b)],_0x1a3a87['existingSegment']['id'],_0x3416ff)),_0x362e31=_0x1a3a87[_0x58329e(0x1a0)]['id'],_0x42cafd[_0x58329e(0x1ee)]?.({'type':_0x58329e(0x214),'name':_0x1a3a87['yamlConfig']['name']}),_0x42cafd[_0x58329e(0x1f7)]?.(_0x58329e(0x237)+_0x1a3a87[_0x58329e(0x1a1)][_0x58329e(0x255)]+'\x27'),_0xbcd886[_0x58329e(0x22b)]=0x1;}else _0x362e31=_0x1a3a87['existingSegment']['id'];}}catch(_0x40d155){const _0x2f90ec=isHttp400Error(_0x40d155),_0x53f5b5=_0x2f90ec?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode[_0x58329e(0x1c5)],_0xdbdd4=getErrorMessage(_0x40d155);throw new SDKError(_0x53f5b5,'Failed\x20to\x20'+(_0x1a3a87[_0x58329e(0x1ce)]?'create':_0x58329e(0x271))+_0x58329e(0x1c4)+_0x1a3a87[_0x58329e(0x274)]+'\x0a\x20\x20'+_0xdbdd4,_0x40d155);}try{const _0x191dc3=await syncActivationsForSegment(_0x1a4295,_0x13b3ad['parentId'],_0x362e31,_0x1a3a87[_0x58329e(0x1a1)][_0x58329e(0x255)],_0x1a3a87['activationActions'],_0x42cafd,_0x1a3a87[_0x58329e(0x274)]);_0xbcd886[_0x58329e(0x203)]=_0x191dc3;}catch(_0x4bddc0){if(_0x4bddc0 instanceof SDKError)throw _0x4bddc0;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x58329e(0x1ef)+_0x1a3a87[_0x58329e(0x1a1)]['name']+_0x58329e(0x25b)+_0x1a3a87[_0x58329e(0x274)]+_0x58329e(0x1f4)+getErrorMessage(_0x4bddc0),_0x4bddc0);}return _0xbcd886;},_0x9056d0=await batchAsync(_0x185250,_0x13df31,_0x98e70b),_0x481fbd={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x4fd0a0 of _0x9056d0){_0x481fbd[_0x15a636(0x22c)]+=_0x4fd0a0[_0x15a636(0x22c)],_0x481fbd['updated']+=_0x4fd0a0[_0x15a636(0x22b)],_0x4fd0a0[_0x15a636(0x259)]&&_0x481fbd[_0x15a636(0x226)][_0x15a636(0x1a5)](_0x4fd0a0[_0x15a636(0x259)][_0x15a636(0x255)],_0x4fd0a0[_0x15a636(0x259)]['id']),_0x481fbd[_0x15a636(0x203)][_0x15a636(0x22c)]+=_0x4fd0a0['activations'][_0x15a636(0x22c)],_0x481fbd[_0x15a636(0x203)][_0x15a636(0x22b)]+=_0x4fd0a0[_0x15a636(0x203)][_0x15a636(0x22b)],_0x481fbd[_0x15a636(0x203)][_0x15a636(0x285)]+=_0x4fd0a0[_0x15a636(0x203)]['deleted'];}return _0x481fbd;}async function syncActivationsForSegment(_0x28d0e1,_0x3f1996,_0x31be77,_0x3b45e3,_0x108b48,_0x5a8d91,_0x4369e5){const _0x13cc8e=a152_0x17e28a,_0x1ca91a={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x217874 of _0x108b48){try{if(_0x217874[_0x13cc8e(0x225)]===_0x13cc8e(0x20b)&&_0x217874[_0x13cc8e(0x1be)])_0x5a8d91[_0x13cc8e(0x1ee)]?.({'type':'activation_creating','segmentName':_0x3b45e3,'activationName':_0x217874[_0x13cc8e(0x255)]}),await _0x5a8d91['withProgress'](_0x13cc8e(0x27f)+_0x217874[_0x13cc8e(0x255)]+_0x13cc8e(0x289),()=>_0x28d0e1[_0x13cc8e(0x1ae)][_0x13cc8e(0x1ed)](_0x3f1996,_0x31be77,_0x217874['validatedRequest'])),_0x5a8d91[_0x13cc8e(0x1ee)]?.({'type':_0x13cc8e(0x1bb),'segmentName':_0x3b45e3,'activationName':_0x217874['name']}),_0x5a8d91[_0x13cc8e(0x1f7)]?.('Created\x20activation\x20\x27'+_0x217874[_0x13cc8e(0x255)]+'\x27'),_0x1ca91a['created']++;else{if(_0x217874[_0x13cc8e(0x225)]===_0x13cc8e(0x271)&&_0x217874['validatedRequest']&&_0x217874[_0x13cc8e(0x26e)])_0x5a8d91['onProgress']?.({'type':_0x13cc8e(0x268),'segmentName':_0x3b45e3,'activationName':_0x217874['name']}),await _0x5a8d91['withProgress'](_0x13cc8e(0x24e)+_0x217874[_0x13cc8e(0x255)]+'\x27...',()=>_0x28d0e1['segment']['updateActivation'](_0x3f1996,_0x31be77,_0x217874[_0x13cc8e(0x26e)]['id'],_0x217874[_0x13cc8e(0x1be)])),_0x5a8d91['onProgress']?.({'type':'activation_updated','segmentName':_0x3b45e3,'activationName':_0x217874[_0x13cc8e(0x255)]}),_0x5a8d91[_0x13cc8e(0x1f7)]?.(_0x13cc8e(0x28a)+_0x217874[_0x13cc8e(0x255)]+'\x27'),_0x1ca91a[_0x13cc8e(0x22b)]++;else _0x217874[_0x13cc8e(0x225)]===_0x13cc8e(0x1bf)&&_0x217874[_0x13cc8e(0x26e)]&&(_0x5a8d91[_0x13cc8e(0x1ee)]?.({'type':_0x13cc8e(0x24a),'segmentName':_0x3b45e3,'activationName':_0x217874['name']}),await _0x5a8d91['withProgress'](_0x13cc8e(0x19a)+_0x217874['name']+_0x13cc8e(0x289),()=>_0x28d0e1[_0x13cc8e(0x1ae)]['deleteActivation'](_0x3f1996,_0x31be77,_0x217874[_0x13cc8e(0x26e)]['id'])),_0x5a8d91[_0x13cc8e(0x1ee)]?.({'type':_0x13cc8e(0x253),'segmentName':_0x3b45e3,'activationName':_0x217874[_0x13cc8e(0x255)]}),_0x5a8d91[_0x13cc8e(0x28e)]?.('Deleted\x20activation\x20\x27'+_0x217874[_0x13cc8e(0x255)]+'\x27'),_0x1ca91a[_0x13cc8e(0x285)]++);}}catch(_0x4de98f){const _0x2d4862=isHttp400Error(_0x4de98f),_0x2515fc=_0x2d4862?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0x13cc8e(0x236)],_0x596067=getErrorMessage(_0x4de98f);throw new SDKError(_0x2515fc,'Failed\x20to\x20'+_0x217874[_0x13cc8e(0x225)]+_0x13cc8e(0x28c)+_0x217874[_0x13cc8e(0x255)]+_0x13cc8e(0x25b)+_0x4369e5+_0x13cc8e(0x1f4)+_0x596067,_0x4de98f);}}return _0x1ca91a;}export async function executePushFolders(_0x7d93e2,_0x2e35ff,_0x488d42,_0x2c837b,_0x58e680){const _0x43b748=a152_0x17e28a,_0x884fd5=new Map(_0x488d42),_0x311d1c=sortFoldersByDepth(_0x2e35ff);for(const _0x3bd0e8 of _0x311d1c){const _0x4cc31b=_0x3bd0e8[_0x43b748(0x260)]('/'),_0x3950a3=_0x4cc31b[_0x4cc31b['length']-0x1],_0x5e6b7e=_0x4cc31b[_0x43b748(0x241)](0x0,-0x1)[_0x43b748(0x1cb)]('/'),_0x1b9d45=_0x884fd5[_0x43b748(0x252)](_0x5e6b7e);_0x58e680[_0x43b748(0x1ee)]?.({'type':_0x43b748(0x250),'folder':_0x3bd0e8});const _0x41658c={'name':_0x3950a3,'parentFolderId':_0x1b9d45},_0x489913=await _0x58e680['withProgress'](_0x43b748(0x209)+_0x3bd0e8+_0x43b748(0x289),()=>_0x7d93e2[_0x43b748(0x1ae)]['createFolder'](_0x2c837b[_0x43b748(0x23b)],_0x41658c));_0x884fd5[_0x43b748(0x1a5)](_0x3bd0e8,_0x489913[_0x43b748(0x269)]['id']),_0x58e680[_0x43b748(0x1ee)]?.({'type':'folder_created','folder':_0x3bd0e8,'folderId':_0x489913[_0x43b748(0x269)]['id']}),_0x58e680[_0x43b748(0x27e)]?.('Created\x20folder\x20\x27'+_0x3bd0e8+'\x27');}return _0x884fd5;}export async function executePushSegmentDeletions(_0x5467e1,_0x38352f,_0x290bf6){const _0x221468=a152_0x17e28a;if(_0x38352f['length']===0x0)return 0x0;const {batchAsync:_0x3d87e5}=await import(_0x221468(0x1aa)),_0x30c508=0x5,_0x2f5c4a=await _0x3d87e5(_0x38352f,async _0x1caccf=>{const _0x2021d0=_0x221468;return _0x290bf6['onProgress']?.({'type':'segment_deleting','name':_0x1caccf['name']}),await _0x5467e1['segment'][_0x2021d0(0x1db)](_0x1caccf['id']),_0x290bf6[_0x2021d0(0x1ee)]?.({'type':_0x2021d0(0x25a),'name':_0x1caccf['name']}),_0x290bf6['logDeleted']?.(_0x2021d0(0x204)+_0x1caccf[_0x2021d0(0x255)]+'\x27'),0x1;},_0x30c508);return _0x2f5c4a[_0x221468(0x21f)]((_0x41e3cd,_0x129f98)=>_0x41e3cd+_0x129f98,0x0);}export async function executePushJourneys(_0x3d9a83,_0xd6e3cb,_0x1b6a95,_0x1a896f,_0x3a8c83){const _0x17d9a9=a152_0x17e28a,{journeyDefToRequest:_0x45eb65}=await import(_0x17d9a9(0x1a9)),{activationDefToCreateRequest:_0x22502b,yamlRuleToApi:_0x575c78,validateSegmentRule:_0x5b3b21}=await import('./child-segment-yaml.js'),_0x17af9a={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x142b87=new Map(_0x1b6a95[_0x17d9a9(0x1ca)]),_0x5ee306=0x5;for(let _0x4cfbcc=0x0;_0x4cfbcc<_0xd6e3cb[_0x17d9a9(0x27c)];_0x4cfbcc+=_0x5ee306){const _0x3535b1=_0xd6e3cb[_0x17d9a9(0x241)](_0x4cfbcc,_0x4cfbcc+_0x5ee306),_0x5b17fc=await Promise[_0x17d9a9(0x23c)](_0x3535b1[_0x17d9a9(0x21e)](async _0x48ce2c=>{const _0x4a1472=_0x17d9a9;if(!_0x48ce2c[_0x4a1472(0x1ce)]&&!_0x48ce2c['hasChanges'])return{'action':_0x4a1472(0x292),'name':_0x48ce2c[_0x4a1472(0x1a1)]['name'],'journeyId':_0x48ce2c[_0x4a1472(0x21c)]?.['id']};const _0xe3c43f=_0x48ce2c['folderPath']?_0x1b6a95['folderPathToId']['get'](_0x48ce2c['folderPath']):undefined;_0x3a8c83[_0x4a1472(0x1ee)]?.({'type':_0x48ce2c[_0x4a1472(0x1ce)]?'journey_creating':_0x4a1472(0x267),'name':_0x48ce2c[_0x4a1472(0x1a1)]['name']});try{const _0xd48dd8=await executeSingleJourneyPush(_0x3d9a83,_0x48ce2c,{..._0x1b6a95,'segmentNameToId':_0x142b87},{'parentId':_0x1a896f[_0x4a1472(0x23b)],'rootFolderId':_0x1a896f[_0x4a1472(0x276)],'folderId':_0xe3c43f,'verbose':_0x1a896f['verbose']},_0x3a8c83,{'journeyDefToRequest':_0x45eb65,'activationDefToCreateRequest':_0x22502b,'yamlRuleToApi':_0x575c78,'validateSegmentRule':_0x5b3b21});for(const [_0x166f6f,_0x7cad31]of _0xd48dd8['embeddedSegmentNameToId']){_0x142b87[_0x4a1472(0x1a5)](_0x166f6f,_0x7cad31),_0x17af9a[_0x4a1472(0x23d)][_0x4a1472(0x1a5)](_0x166f6f,_0x7cad31);}if(_0xd48dd8[_0x4a1472(0x1b0)]==='created')_0x3a8c83['onProgress']?.({'type':_0x4a1472(0x1c6),'name':_0x48ce2c[_0x4a1472(0x1a1)]['name'],'journeyId':_0xd48dd8['journeyId']}),_0x3a8c83[_0x4a1472(0x1f7)]?.('Created\x20journey\x20\x27'+_0x48ce2c[_0x4a1472(0x1a1)][_0x4a1472(0x255)]+'\x27'),_0x17af9a[_0x4a1472(0x22c)]++;else _0xd48dd8[_0x4a1472(0x1b0)]===_0x4a1472(0x22b)&&(_0x3a8c83[_0x4a1472(0x1ee)]?.({'type':_0x4a1472(0x207),'name':_0x48ce2c['yamlConfig']['name']}),_0x3a8c83[_0x4a1472(0x1f7)]?.('Updated\x20journey\x20\x27'+_0x48ce2c[_0x4a1472(0x1a1)][_0x4a1472(0x255)]+'\x27'),_0x17af9a[_0x4a1472(0x22b)]++);return{'action':_0xd48dd8[_0x4a1472(0x1b0)],'name':_0x48ce2c[_0x4a1472(0x1a1)][_0x4a1472(0x255)],'journeyId':_0xd48dd8[_0x4a1472(0x1b5)]};}catch(_0xdb80e7){const _0x48aa11=isHttp400Error(_0xdb80e7),_0x4167b2=_0x48aa11?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode[_0x4a1472(0x265)],_0x350c45=getErrorMessage(_0xdb80e7);throw new SDKError(_0x4167b2,_0x4a1472(0x263)+(_0x48ce2c[_0x4a1472(0x1ce)]?'create':_0x4a1472(0x271))+_0x4a1472(0x1ac)+_0x48ce2c[_0x4a1472(0x274)]+_0x4a1472(0x1f4)+_0x350c45,_0xdb80e7);}}));_0x17af9a['results']['push'](..._0x5b17fc);}return _0x17af9a;}async function matchExistingJourneySegments(_0x2da5ed,_0x47ec84,_0x25a85c,_0x1e1274,_0x2cc2a2){const _0x26cf99=a152_0x17e28a;if(!_0x47ec84['existingJourney']||!_0x47ec84[_0x26cf99(0x1a1)][_0x26cf99(0x26b)])return;const _0x2d3dab=new Map(),_0x454d61=new Set();for(const _0x4e57f5 of Object[_0x26cf99(0x19d)](_0x47ec84[_0x26cf99(0x1a1)][_0x26cf99(0x26b)])){const _0x12b96e=generateDeterministicJourneySegmentName(_0x47ec84[_0x26cf99(0x1a1)][_0x26cf99(0x255)],_0x4e57f5);_0x2d3dab[_0x26cf99(0x1a5)](_0x12b96e,_0x4e57f5),_0x454d61[_0x26cf99(0x275)](_0x4e57f5);}const _0x14a601=[],_0x2fe112=collectSegmentIdsFromJourneyApi(_0x47ec84[_0x26cf99(0x21c)]);for(const _0x5677db of _0x2fe112){const _0x5d9700=await fetchSegment(_0x2da5ed,_0x25a85c,_0x5677db,_0x1e1274);if(!_0x5d9700?.['name'])continue;const _0x4e602c=_0x2d3dab[_0x26cf99(0x252)](_0x5d9700[_0x26cf99(0x255)]);_0x4e602c?(_0x2cc2a2[_0x26cf99(0x1a5)](_0x4e602c,_0x5677db),_0x454d61[_0x26cf99(0x1bf)](_0x4e602c)):_0x14a601[_0x26cf99(0x1c1)]({'id':_0x5677db,'seg':_0x5d9700});}if(_0x454d61[_0x26cf99(0x1e8)]>0x0&&_0x14a601[_0x26cf99(0x27c)]>0x0){const {localExpandedRuleToNames:_0x4a4a79}=buildLocalExpandedRuleMappings(_0x47ec84[_0x26cf99(0x1a1)]),_0x5cc3fb=new Map();for(const {id:_0x880aed,seg:_0x3b6954}of _0x14a601){if(_0x3b6954[_0x26cf99(0x24f)]){const _0x293e24=apiRuleToYaml(_0x3b6954[_0x26cf99(0x24f)]);_0x5cc3fb['set'](_0x880aed,_0x293e24);}}for(const {id:_0x4e2157,seg:_0x44fb6d}of _0x14a601){if(!_0x44fb6d[_0x26cf99(0x24f)])continue;const _0x2f5f6b=_0x5cc3fb['get'](_0x4e2157);if(!_0x2f5f6b)continue;const _0x4c9def=serializeExpandedRule(_0x2f5f6b,_0x5cc3fb),_0x385005=_0x4a4a79[_0x26cf99(0x252)](_0x4c9def);if(_0x385005){const _0x4c5255=_0x385005[_0x26cf99(0x25c)](_0x54010f=>_0x454d61['has'](_0x54010f));_0x4c5255&&(_0x2cc2a2[_0x26cf99(0x1a5)](_0x4c5255,_0x4e2157),_0x454d61[_0x26cf99(0x1bf)](_0x4c5255),logger['debug'](_0x26cf99(0x1e1)+_0x44fb6d['name']+'\x27\x20to\x20local\x20\x27'+_0x4c5255+_0x26cf99(0x1e6)));}}}}function a152_0x2b62(_0x45dde7,_0x41669b){_0x45dde7=_0x45dde7-0x195;const _0x429efc=a152_0x429e();let _0x2b62ff=_0x429efc[_0x45dde7];return _0x2b62ff;}async function executeSingleJourneyPush(_0x18a68a,_0x36235a,_0x29a5f4,_0x58e97c,_0x94913c,_0x1978eb){const _0x570268=a152_0x17e28a,{journeyDefToRequest:_0xeec273,activationDefToCreateRequest:_0x56a754,yamlRuleToApi:_0x1ab9e2,validateSegmentRule:_0xb5768e}=_0x1978eb,_0x3e3fe3=new Map(),_0x379d5e=new Map();recoverSegmentIdsFromPushRecovery(_0x36235a,_0x3e3fe3,_0x29a5f4[_0x570268(0x1ca)]);const _0x57b293=new Map(),_0x4b9bb4=new Map(),_0x17e27c=new Map();let _0x2066f2;const _0x4f691f=async()=>{const _0x154a12=_0x570268;if(_0x2066f2)return;_0x2066f2=new Map();if(!_0x36235a[_0x154a12(0x21c)])return;const _0x393850=await _0x18a68a[_0x154a12(0x197)]['listActivations'](_0x36235a[_0x154a12(0x21c)]['id']);for(const _0x534de0 of _0x393850){const _0x8c9f33=journeyActivationStepToYaml(_0x534de0,_0x29a5f4[_0x154a12(0x212)],_0x29a5f4[_0x154a12(0x199)]),_0x6816d3=activationSignature(_0x8c9f33);!_0x2066f2[_0x154a12(0x1f1)](_0x6816d3)&&_0x2066f2[_0x154a12(0x1a5)](_0x6816d3,_0x534de0['id']),_0x8c9f33[_0x154a12(0x255)]&&_0x379d5e[_0x154a12(0x1a5)](_0x8c9f33['name'],_0x534de0['id']);}};await matchExistingJourneySegments(_0x18a68a,_0x36235a,_0x58e97c[_0x570268(0x23b)],_0x29a5f4[_0x570268(0x1a7)],_0x29a5f4[_0x570268(0x1ca)]);const _0x4e5c83={'resolveSegmentId':async _0xb6e545=>{const _0xbc6a3=_0x570268,_0x5bd8b6=_0x29a5f4['segmentNameToId'][_0xbc6a3(0x252)](_0xb6e545);if(!_0x5bd8b6)throw new SDKError(ErrorCode[_0xbc6a3(0x223)],_0xbc6a3(0x1d1)+_0xb6e545+'\x20(referenced\x20in\x20journey\x20'+_0x36235a[_0xbc6a3(0x1a1)]['name']+')');return _0x5bd8b6;},'resolveEmbeddedSegmentId':async(_0x59549d,_0x11c945)=>{const _0x2284cb=_0x570268,_0x5a5917=_0x29a5f4[_0x2284cb(0x1ca)][_0x2284cb(0x252)](_0x59549d);if(_0x5a5917)return _0x5a5917;const _0x51b1be=_0x29a5f4['existingSegments'][_0x2284cb(0x25c)](_0x5a6082=>_0x5a6082['name']===_0x59549d);if(_0x51b1be)return _0x29a5f4[_0x2284cb(0x1ca)]['set'](_0x59549d,_0x51b1be['id']),_0x51b1be['id'];if(_0x36235a[_0x2284cb(0x1ce)]){const {stageName:_0x2d67b9,criteriaName:_0x2002e7}=findSegmentCriteriaLocation(_0x36235a[_0x2284cb(0x1a1)],_0x59549d);return _0xb5768e(_0x59549d,_0x11c945[_0x2284cb(0x24f)]),_0x4b9bb4[_0x2284cb(0x1a5)](_0x59549d,{'definition':_0x11c945,'stageName':_0x2d67b9,'criteriaName':_0x2002e7}),createPendingSegmentId(_0x59549d);}const _0x41a187=_0x36235a[_0x2284cb(0x21c)]?.['id'];if(!_0x41a187)throw new SDKError(ErrorCode[_0x2284cb(0x208)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x3e58b0=_0x57b293[_0x2284cb(0x252)](_0x59549d);if(_0x3e58b0)return _0x3e58b0;const _0x183829=((async()=>{const _0x4b0da8=_0x2284cb;_0xb5768e(_0x59549d,_0x11c945[_0x4b0da8(0x24f)]);const _0x51ea13=generateDeterministicJourneySegmentName(_0x36235a[_0x4b0da8(0x1a1)]['name'],_0x59549d),_0x30b627=_0x29a5f4[_0x4b0da8(0x1a7)][_0x4b0da8(0x25c)](_0x2a5e08=>_0x2a5e08[_0x4b0da8(0x255)]===_0x51ea13),_0x5c5c9d=createSegmentIdResolver(_0x29a5f4['segmentNameToId'],_0x59549d),_0x30c5fc=await resolveRuleSegmentIds(_0x11c945[_0x4b0da8(0x24f)],_0x5c5c9d);let _0x59f751;return _0x30b627?(await _0x18a68a['segment'][_0x4b0da8(0x239)](_0x58e97c[_0x4b0da8(0x23b)],_0x30b627['id'],{'description':_0x11c945[_0x4b0da8(0x1a2)]||'Entry\x20criteria:\x20'+_0x59549d,'rule':_0x1ab9e2(_0x30c5fc),'countPopulation':!![]}),_0x59f751=_0x30b627['id'],saveSegmentToPushRecovery(_0x36235a[_0x4b0da8(0x274)],_0x36235a['yamlConfig'][_0x4b0da8(0x255)],_0x59549d,{'segmentId':_0x59f751,'uniqueServerName':_0x51ea13,'createdAt':new Date()['toISOString']()})):_0x59f751=await createOrRecoverEmbeddedSegment(_0x18a68a,_0x36235a,{'localName':_0x59549d,'uniqueSegmentName':_0x51ea13,'description':_0x11c945[_0x4b0da8(0x1a2)]||_0x4b0da8(0x228)+_0x59549d,'journeyId':_0x41a187,'resolvedRule':_0x30c5fc,'parentId':_0x58e97c['parentId'],'folderId':_0x58e97c['rootFolderId']||''},_0x1ab9e2),_0x29a5f4['segmentNameToId']['set'](_0x59549d,_0x59f751),_0x3e3fe3[_0x4b0da8(0x1a5)](_0x59549d,_0x59f751),_0x59f751;})());_0x57b293['set'](_0x59549d,_0x183829);try{return await _0x183829;}finally{_0x57b293[_0x2284cb(0x1bf)](_0x59549d);}},'resolveActivationId':async _0x42ec18=>{const _0x22f8dc=_0x570268,_0x367bb7=_0x379d5e[_0x22f8dc(0x252)](_0x42ec18);if(_0x367bb7)return _0x367bb7;if(_0x36235a[_0x22f8dc(0x21c)]){await _0x4f691f();const _0x5de93e=_0x379d5e[_0x22f8dc(0x252)](_0x42ec18);if(_0x5de93e)return _0x5de93e;}throw new SDKError(ErrorCode['NOT_FOUND'],_0x22f8dc(0x1ff)+_0x42ec18+_0x22f8dc(0x1f5)+_0x36235a[_0x22f8dc(0x1a1)][_0x22f8dc(0x255)]+_0x22f8dc(0x254)+_0x22f8dc(0x234));},'resolveEmbeddedActivationId':async(_0x3ca916,_0x2940a9)=>{const _0x3d73c1=_0x570268,_0x2b3dac=_0x379d5e[_0x3d73c1(0x252)](_0x3ca916);if(_0x2b3dac)return _0x2b3dac;if(_0x36235a[_0x3d73c1(0x1ce)])return _0x17e27c[_0x3d73c1(0x1a5)](_0x3ca916,_0x2940a9),createPendingActivationId(_0x3ca916);if(_0x36235a[_0x3d73c1(0x21c)]){await _0x4f691f();const _0x3aa29e=_0x379d5e[_0x3d73c1(0x252)](_0x2940a9[_0x3d73c1(0x255)]);if(_0x3aa29e)return _0x379d5e[_0x3d73c1(0x1a5)](_0x3ca916,_0x3aa29e),_0x3aa29e;const _0x2f82cc=activationSignature(_0x2940a9),_0x3ee645=_0x2066f2?.[_0x3d73c1(0x252)](_0x2f82cc);if(_0x3ee645)return _0x379d5e[_0x3d73c1(0x1a5)](_0x3ca916,_0x3ee645),_0x3ee645;const _0x26824=await _0x56a754(_0x2940a9,_0x29a5f4[_0x3d73c1(0x211)]),_0x597915={..._0x26824,..._0x2940a9[_0x3d73c1(0x22e)]!==undefined&&{'runAfterJourneyRefresh':_0x2940a9[_0x3d73c1(0x22e)]}},_0x3cdf64=await _0x18a68a['journey'][_0x3d73c1(0x1ed)](_0x36235a[_0x3d73c1(0x21c)]['id'],_0x597915);return _0x379d5e[_0x3d73c1(0x1a5)](_0x3ca916,_0x3cdf64['id']),_0x3cdf64['id'];}throw new SDKError(ErrorCode['INTERNAL'],_0x3d73c1(0x286));},'resolveJourneyId':async _0x8cd6ae=>{const _0x2bd853=_0x570268;try{return await _0x18a68a[_0x2bd853(0x197)][_0x2bd853(0x1d3)](_0x58e97c['parentId'],_0x8cd6ae);}catch(_0x33a081){throw new SDKError(ErrorCode[_0x2bd853(0x256)],'Journey\x20\x27'+_0x8cd6ae+_0x2bd853(0x291)+_0x36235a[_0x2bd853(0x1a1)][_0x2bd853(0x255)]+'\x27)',_0x33a081);}},'resolveStageId':async(_0x252a95,_0x35eb3c)=>{const _0x33e45e=_0x570268,_0x15574c=await _0x18a68a[_0x33e45e(0x197)][_0x33e45e(0x1d6)](_0x252a95),_0x3c12b8=_0x15574c[_0x33e45e(0x20d)][_0x33e45e(0x1c3)][_0x33e45e(0x25c)](_0x59416e=>_0x59416e[_0x33e45e(0x255)][_0x33e45e(0x23f)]()===_0x35eb3c[_0x33e45e(0x23f)]());if(!_0x3c12b8?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],_0x33e45e(0x1fb)+_0x35eb3c+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x15574c[_0x33e45e(0x20d)]['journeyBundleName']||_0x15574c[_0x33e45e(0x20d)][_0x33e45e(0x255)])+'\x27');return _0x3c12b8['id'];}},_0x233d37=await _0xeec273(_0x36235a[_0x570268(0x1a1)],_0x58e97c[_0x570268(0x23b)],_0x4e5c83),_0x4e96ea=_0x58e97c[_0x570268(0x282)]||_0x58e97c[_0x570268(0x276)];_0x4e96ea&&(_0x233d37[_0x570268(0x1d2)]={'parentFolder':{'data':{'id':_0x4e96ea,'type':_0x570268(0x279)}}});if(_0x36235a[_0x570268(0x1ce)]){if(_0x4b9bb4[_0x570268(0x1e8)]>0x0||_0x17e27c[_0x570268(0x1e8)]>0x0)return await executeThreeStepJourneyCreate(_0x18a68a,_0x36235a,_0x233d37,{'pendingEmbeddedSegments':_0x4b9bb4,'pendingEmbeddedActivations':_0x17e27c,'embeddedSegmentNameToId':_0x3e3fe3,'journeyActivationNameToId':_0x379d5e},{..._0x58e97c,'effectiveFolderId':_0x4e96ea},_0x29a5f4,_0x94913c,_0x1978eb);else{ensureJourneyDefaults(_0x233d37[_0x570268(0x20d)]);const _0x301eff=await _0x18a68a[_0x570268(0x197)][_0x570268(0x20b)](_0x233d37);return deletePushRecovery(_0x36235a[_0x570268(0x274)]),{'action':'created','journeyId':_0x301eff['id'],'embeddedSegmentNameToId':_0x3e3fe3};}}else{if(_0x36235a[_0x570268(0x1d7)]&&_0x36235a['existingJourney']){_0x233d37['id']=_0x36235a[_0x570268(0x21c)]['id'];const _0x48a559=_0x233d37[_0x570268(0x20d)];_0x36235a['existingJourney'][_0x570268(0x20d)]?.[_0x570268(0x1c2)]&&(_0x48a559[_0x570268(0x1c2)]=_0x36235a['existingJourney'][_0x570268(0x20d)][_0x570268(0x1c2)]);const _0x158056=_0x36235a['existingJourney'][_0x570268(0x20d)]?.[_0x570268(0x1c3)];return _0x158056&&_0x233d37[_0x570268(0x20d)][_0x570268(0x1c3)]&&injectExistingStageIds(_0x233d37['attributes'][_0x570268(0x1c3)],_0x158056),ensureJourneyDefaults(_0x48a559),await _0x18a68a[_0x570268(0x197)][_0x570268(0x271)](_0x36235a[_0x570268(0x21c)]['id'],_0x233d37),deletePushRecovery(_0x36235a['absolutePath']),{'action':_0x570268(0x22b),'journeyId':_0x36235a[_0x570268(0x21c)]['id'],'embeddedSegmentNameToId':_0x3e3fe3};}}return deletePushRecovery(_0x36235a['absolutePath']),{'action':_0x570268(0x292),'journeyId':_0x36235a[_0x570268(0x21c)]?.['id'],'embeddedSegmentNameToId':_0x3e3fe3};}function findSegmentCriteriaLocation(_0x4ca252,_0x21d779){const _0x5ea1d0=a152_0x17e28a,_0x2a8795=_0x4ca252['stages']||_0x4ca252[_0x5ea1d0(0x229)]?.[0x0]?.['stages']||[];let _0x486b67=_0x5ea1d0(0x1a3),_0x37cc12=_0x21d779;const _0x5905bf=_0x4ca252[_0x5ea1d0(0x195)]||_0x4ca252[_0x5ea1d0(0x229)]?.[0x0]?.[_0x5ea1d0(0x195)];if(_0x5905bf?.[_0x5ea1d0(0x1ae)]===_0x21d779)return{'stageName':'goal','criteriaName':_0x5905bf[_0x5ea1d0(0x255)]||_0x21d779};_0xa11619:for(const _0x52160d of _0x2a8795){if(_0x52160d[_0x5ea1d0(0x1ec)]?.['segment']===_0x21d779){_0x486b67=_0x52160d[_0x5ea1d0(0x255)],_0x37cc12=_0x52160d[_0x5ea1d0(0x1ec)][_0x5ea1d0(0x255)]||_0x21d779;break;}if(_0x52160d[_0x5ea1d0(0x28d)])for(const _0x4fe1d3 of _0x52160d[_0x5ea1d0(0x28d)]){if(_0x4fe1d3[_0x5ea1d0(0x225)]==='decision_point'&&_0x4fe1d3['with']?.[_0x5ea1d0(0x201)])for(const _0x2683a3 of _0x4fe1d3[_0x5ea1d0(0x1b8)][_0x5ea1d0(0x201)]){if(_0x2683a3['segment']===_0x21d779){_0x486b67=_0x52160d['name'],_0x37cc12=_0x2683a3[_0x5ea1d0(0x255)]||_0x21d779;break _0xa11619;}}}}return{'stageName':_0x486b67,'criteriaName':_0x37cc12};}async function executeThreeStepJourneyCreate(_0x4388de,_0x835997,_0x236c93,_0x4b6d41,_0x2bfd6c,_0x400906,_0x263d3f,_0x46b109){const _0x28335d=a152_0x17e28a,{activationDefToCreateRequest:_0x2df998,yamlRuleToApi:_0x32f232}=_0x46b109,{pendingEmbeddedSegments:_0x32fa1a,pendingEmbeddedActivations:_0x28f4f5,embeddedSegmentNameToId:_0x45d2cb}=_0x4b6d41,_0x2aa79b=JSON['parse'](JSON['stringify'](_0x236c93));ensureJourneyDefaults(_0x2aa79b[_0x28335d(0x20d)]),stripPendingIds(_0x2aa79b);const _0x6a8eb6=await _0x4388de[_0x28335d(0x197)]['create'](_0x2aa79b),_0x258478=_0x6a8eb6['id'],_0x5a9bf2=new Map();for(const _0x298dcb of _0x6a8eb6[_0x28335d(0x20d)][_0x28335d(0x1c3)]){_0x5a9bf2[_0x28335d(0x1a5)](_0x298dcb[_0x28335d(0x255)][_0x28335d(0x23f)](),_0x298dcb['id']);}recoverSegmentIdsFromPushRecovery(_0x835997,_0x45d2cb,_0x400906[_0x28335d(0x1ca)]);for(const [_0x3ddeb5,{definition:_0x2c2a0d}]of _0x32fa1a){if(_0x45d2cb[_0x28335d(0x1f1)](_0x3ddeb5)){_0x263d3f[_0x28335d(0x1ee)]?.({'type':'embedded_segment_created','journeyName':_0x835997['yamlConfig'][_0x28335d(0x255)],'segmentName':_0x3ddeb5});continue;}const _0x1c9718=generateDeterministicJourneySegmentName(_0x835997[_0x28335d(0x1a1)]['name'],_0x3ddeb5);_0x263d3f[_0x28335d(0x1ee)]?.({'type':_0x28335d(0x218),'journeyName':_0x835997[_0x28335d(0x1a1)][_0x28335d(0x255)],'segmentName':_0x3ddeb5});const _0x48f672=createSegmentIdResolver(_0x400906[_0x28335d(0x1ca)],_0x3ddeb5),_0x567197=await resolveRuleSegmentIds(_0x2c2a0d[_0x28335d(0x24f)],_0x48f672),_0x2dbfd8=await createOrRecoverEmbeddedSegment(_0x4388de,_0x835997,{'localName':_0x3ddeb5,'uniqueSegmentName':_0x1c9718,'description':_0x2c2a0d[_0x28335d(0x1a2)]||_0x28335d(0x228)+_0x3ddeb5,'journeyId':_0x258478,'resolvedRule':_0x567197,'parentId':_0x2bfd6c[_0x28335d(0x23b)],'folderId':_0x2bfd6c['effectiveFolderId']||''},_0x32f232);_0x45d2cb[_0x28335d(0x1a5)](_0x3ddeb5,_0x2dbfd8),_0x400906[_0x28335d(0x1ca)]['set'](_0x3ddeb5,_0x2dbfd8),_0x263d3f[_0x28335d(0x1ee)]?.({'type':_0x28335d(0x200),'journeyName':_0x835997[_0x28335d(0x1a1)][_0x28335d(0x255)],'segmentName':_0x3ddeb5});}const _0x140805=new Map();for(const [_0x5a8659,_0x3c9e2f]of _0x28f4f5){_0x263d3f[_0x28335d(0x1ee)]?.({'type':'embedded_activation_creating','journeyName':_0x835997['yamlConfig'][_0x28335d(0x255)],'activationName':_0x5a8659});const _0x54f615=await _0x2df998(_0x3c9e2f,_0x400906['activationContext']),_0x1ce324={..._0x54f615,..._0x3c9e2f[_0x28335d(0x22e)]!==undefined&&{'runAfterJourneyRefresh':_0x3c9e2f[_0x28335d(0x22e)]}},_0x219ffa=await _0x4388de[_0x28335d(0x197)][_0x28335d(0x1ed)](_0x258478,_0x1ce324);_0x140805[_0x28335d(0x1a5)](_0x5a8659,_0x219ffa['id']),_0x4b6d41['journeyActivationNameToId'][_0x28335d(0x1a5)](_0x5a8659,_0x219ffa['id']),_0x263d3f[_0x28335d(0x1ee)]?.({'type':'embedded_activation_created','journeyName':_0x835997[_0x28335d(0x1a1)][_0x28335d(0x255)],'activationName':_0x5a8659});}const _0x4471e5=JSON[_0x28335d(0x1b7)](JSON[_0x28335d(0x20c)](_0x236c93));return _0x4471e5['id']=_0x258478,ensureJourneyDefaults(_0x4471e5['attributes']),resolvePendingIdsInRequest(_0x4471e5,_0x236c93,_0x5a9bf2,_0x45d2cb,_0x140805,_0x263d3f),await _0x4388de['journey'][_0x28335d(0x271)](_0x258478,_0x4471e5),deletePushRecovery(_0x835997[_0x28335d(0x274)]),{'action':'created','journeyId':_0x258478,'embeddedSegmentNameToId':_0x45d2cb};}export function stripWaitStepPendingIds(_0x1b8a85){const _0x4cc7e0=a152_0x17e28a,_0x1f8f32=_0x1b8a85[_0x4cc7e0(0x1f9)]&&isPendingSegmentId(_0x1b8a85[_0x4cc7e0(0x1f9)]),_0x233e09=_0x1b8a85[_0x4cc7e0(0x22a)]?.['some'](_0x16cd30=>_0x16cd30[_0x4cc7e0(0x19b)]&&isPendingSegmentId(_0x16cd30[_0x4cc7e0(0x19b)]));(_0x1f8f32||_0x233e09)&&(_0x1b8a85[_0x4cc7e0(0x233)]=_0x4cc7e0(0x243),_0x1b8a85['waitStep']=0x1,_0x1b8a85[_0x4cc7e0(0x1bc)]=_0x4cc7e0(0x1ba),delete _0x1b8a85[_0x4cc7e0(0x1f9)],delete _0x1b8a85['conditionTimeoutDuration'],delete _0x1b8a85[_0x4cc7e0(0x1f3)],delete _0x1b8a85[_0x4cc7e0(0x22a)]);}export function resolveWaitStepPendingIds(_0xe18169,_0x1d508b,_0x240ccb,_0x4625fc){const _0x7e2b46=a152_0x17e28a;if(_0x1d508b['conditionSegmentId']&&isPendingSegmentId(_0x1d508b['conditionSegmentId'])){const _0x59e21b=_0x240ccb(_0x1d508b[_0x7e2b46(0x1f9)],_0x7e2b46(0x213)+_0x4625fc+_0x7e2b46(0x1fc));_0x59e21b&&(_0xe18169[_0x7e2b46(0x233)]=_0x7e2b46(0x244),_0xe18169['conditionSegmentId']=_0x59e21b,delete _0xe18169[_0x7e2b46(0x280)],delete _0xe18169[_0x7e2b46(0x1bc)],_0x1d508b[_0x7e2b46(0x26a)]!==undefined&&(_0xe18169[_0x7e2b46(0x26a)]=_0x1d508b[_0x7e2b46(0x26a)]),_0x1d508b[_0x7e2b46(0x1f3)]&&(_0xe18169[_0x7e2b46(0x1f3)]=_0x1d508b[_0x7e2b46(0x1f3)]));}if(_0x1d508b[_0x7e2b46(0x22a)]){const _0xb54e0=_0x1d508b[_0x7e2b46(0x22a)]['some'](_0x2304b6=>_0x2304b6['segmentId']&&isPendingSegmentId(_0x2304b6[_0x7e2b46(0x19b)]));if(_0xb54e0){const _0x73b76f=_0x1d508b[_0x7e2b46(0x22a)][_0x7e2b46(0x21e)](_0x5e316b=>{const _0x39a087=_0x7e2b46;if(_0x5e316b[_0x39a087(0x19b)]&&isPendingSegmentId(_0x5e316b[_0x39a087(0x19b)])){const _0x1898b6=_0x240ccb(_0x5e316b[_0x39a087(0x19b)],_0x39a087(0x213)+_0x4625fc+'\x27\x20wait\x20condition');return{..._0x5e316b,'segmentId':_0x1898b6||_0x5e316b['segmentId']};}return{..._0x5e316b};});_0xe18169['waitStepType']='Condition',_0xe18169['conditions']=_0x73b76f,delete _0xe18169[_0x7e2b46(0x280)],delete _0xe18169['waitStepUnit'],delete _0xe18169['conditionSegmentId'],delete _0xe18169[_0x7e2b46(0x26a)],delete _0xe18169[_0x7e2b46(0x1f3)];}}}function stripPendingIds(_0x3babb0){const _0x2da600=a152_0x17e28a;_0x3babb0[_0x2da600(0x20d)]['goal']?.['segmentId']&&isPendingSegmentId(_0x3babb0[_0x2da600(0x20d)]['goal']['segmentId'])&&delete _0x3babb0[_0x2da600(0x20d)][_0x2da600(0x195)];for(const _0x3608de of _0x3babb0[_0x2da600(0x20d)][_0x2da600(0x1c3)]||[]){_0x3608de['entryCriteria']?.[_0x2da600(0x19b)]&&isPendingSegmentId(_0x3608de[_0x2da600(0x216)][_0x2da600(0x19b)])&&delete _0x3608de[_0x2da600(0x216)];_0x3608de[_0x2da600(0x261)]?.[_0x2da600(0x19b)]&&isPendingSegmentId(_0x3608de[_0x2da600(0x261)][_0x2da600(0x19b)])&&delete _0x3608de[_0x2da600(0x261)];_0x3608de[_0x2da600(0x1cd)]&&(_0x3608de['exitCriterias']=_0x3608de[_0x2da600(0x1cd)][_0x2da600(0x1fe)](_0x38c919=>!_0x38c919[_0x2da600(0x19b)]||!isPendingSegmentId(_0x38c919[_0x2da600(0x19b)])));if(_0x3608de[_0x2da600(0x28d)])for(const _0x455c74 of Object[_0x2da600(0x19d)](_0x3608de[_0x2da600(0x28d)])){const _0x2e0b6f=_0x3608de['steps'][_0x455c74];_0x2e0b6f[_0x2da600(0x225)]===_0x2da600(0x1c0)&&_0x2e0b6f[_0x2da600(0x257)]&&isPendingActivationId(_0x2e0b6f['journeyActivationStepId'])&&(_0x2e0b6f['journeyActivationStepId']='');if(_0x2e0b6f[_0x2da600(0x225)]==='DecisionPoint'&&_0x2e0b6f['branches'])for(const _0x4499e7 of _0x2e0b6f['branches']){_0x4499e7[_0x2da600(0x19b)]&&isPendingSegmentId(_0x4499e7[_0x2da600(0x19b)])&&(_0x4499e7[_0x2da600(0x19b)]='');}_0x2e0b6f[_0x2da600(0x225)]===_0x2da600(0x1a4)&&stripWaitStepPendingIds(_0x2e0b6f);}}}function resolvePendingIdsInRequest(_0x5d7fe8,_0xf89adf,_0x37ba32,_0x4b94f8,_0xa0e47a,_0x5ba0eb){const _0xad1aad=a152_0x17e28a,_0x4a5291=(_0x1b0902,_0x38754f)=>{const _0x2e712b=a152_0x2b62;if(!isPendingSegmentId(_0x1b0902))return _0x1b0902;const _0x3a32b4=extractPendingSegmentName(_0x1b0902),_0x1b3a24=_0x4b94f8[_0x2e712b(0x252)](_0x3a32b4);return!_0x1b3a24&&_0x5ba0eb[_0x2e712b(0x25f)]?.(_0x2e712b(0x19f)+_0x3a32b4+_0x2e712b(0x210)+_0x38754f),_0x1b3a24;};if(_0x5d7fe8['attributes']['goal']?.[_0xad1aad(0x19b)]&&isPendingSegmentId(_0x5d7fe8[_0xad1aad(0x20d)][_0xad1aad(0x195)][_0xad1aad(0x19b)])){const _0x52a891=_0x4a5291(_0x5d7fe8['attributes'][_0xad1aad(0x195)][_0xad1aad(0x19b)],_0xad1aad(0x1cf));_0x52a891&&(_0x5d7fe8[_0xad1aad(0x20d)][_0xad1aad(0x195)]['segmentId']=_0x52a891);}for(const _0x2536a9 of _0x5d7fe8['attributes'][_0xad1aad(0x1c3)]||[]){const _0x157dbd=_0x37ba32['get'](_0x2536a9[_0xad1aad(0x255)][_0xad1aad(0x23f)]());_0x157dbd&&(_0x2536a9['id']=_0x157dbd);if(_0x2536a9['entryCriteria']?.[_0xad1aad(0x19b)]&&isPendingSegmentId(_0x2536a9['entryCriteria'][_0xad1aad(0x19b)])){const _0x1729d6=_0x4a5291(_0x2536a9[_0xad1aad(0x216)][_0xad1aad(0x19b)],_0xad1aad(0x213)+_0x2536a9[_0xad1aad(0x255)]+_0xad1aad(0x1fa));_0x1729d6&&(_0x2536a9[_0xad1aad(0x216)][_0xad1aad(0x19b)]=_0x1729d6);}if(_0x2536a9[_0xad1aad(0x1cd)])for(const _0x1735f1 of _0x2536a9[_0xad1aad(0x1cd)]){if(_0x1735f1[_0xad1aad(0x19b)]&&isPendingSegmentId(_0x1735f1['segmentId'])){const _0x25de4a=_0x4a5291(_0x1735f1[_0xad1aad(0x19b)],_0xad1aad(0x213)+_0x2536a9['name']+_0xad1aad(0x1d8));_0x25de4a&&(_0x1735f1[_0xad1aad(0x19b)]=_0x25de4a);}}if(_0x2536a9[_0xad1aad(0x261)]?.[_0xad1aad(0x19b)]&&isPendingSegmentId(_0x2536a9[_0xad1aad(0x261)][_0xad1aad(0x19b)])){const _0x2011be=_0x4a5291(_0x2536a9['milestone'][_0xad1aad(0x19b)],_0xad1aad(0x213)+_0x2536a9[_0xad1aad(0x255)]+_0xad1aad(0x1a8));_0x2011be&&(_0x2536a9['milestone'][_0xad1aad(0x19b)]=_0x2011be);}if(_0x2536a9['steps']){const _0x5a8dc5=_0x4dce6c=>_0xf89adf['attributes'][_0xad1aad(0x1c3)]?.['find'](_0x5038eb=>_0x5038eb[_0xad1aad(0x255)]['toLowerCase']()===_0x2536a9[_0xad1aad(0x255)]['toLowerCase']())?.[_0xad1aad(0x28d)]?.[_0x4dce6c];for(const _0x219ebe of Object[_0xad1aad(0x19d)](_0x2536a9[_0xad1aad(0x28d)])){const _0x3cbbbe=_0x2536a9['steps'][_0x219ebe],_0x23293a=_0x5a8dc5(_0x219ebe);if(_0x3cbbbe[_0xad1aad(0x225)]===_0xad1aad(0x1c0)&&_0x3cbbbe[_0xad1aad(0x257)]&&(isPendingActivationId(_0x3cbbbe[_0xad1aad(0x257)])||_0x3cbbbe[_0xad1aad(0x257)]==='')){if(_0x23293a?.['journeyActivationStepId']&&isPendingActivationId(_0x23293a['journeyActivationStepId'])){const _0x488753=extractPendingActivationName(_0x23293a[_0xad1aad(0x257)]),_0x1bff81=_0xa0e47a[_0xad1aad(0x252)](_0x488753);_0x1bff81&&(_0x3cbbbe[_0xad1aad(0x257)]=_0x1bff81);}}if(_0x3cbbbe[_0xad1aad(0x225)]===_0xad1aad(0x284)&&_0x3cbbbe['branches']&&_0x23293a?.[_0xad1aad(0x201)])for(let _0x1a0a89=0x0;_0x1a0a89<_0x3cbbbe[_0xad1aad(0x201)][_0xad1aad(0x27c)];_0x1a0a89++){const _0x2708b9=_0x3cbbbe[_0xad1aad(0x201)][_0x1a0a89],_0x5a6aea=_0x23293a[_0xad1aad(0x201)][_0x1a0a89];if(_0x5a6aea?.[_0xad1aad(0x19b)]&&isPendingSegmentId(_0x5a6aea[_0xad1aad(0x19b)])){const _0x2de1d6=_0x4a5291(_0x5a6aea[_0xad1aad(0x19b)],'stage\x20\x27'+_0x2536a9['name']+_0xad1aad(0x1f2)+(_0x2708b9[_0xad1aad(0x255)]||_0x1a0a89)+'\x27');_0x2de1d6&&(_0x2708b9[_0xad1aad(0x19b)]=_0x2de1d6);}}_0x3cbbbe[_0xad1aad(0x225)]===_0xad1aad(0x1a4)&&_0x23293a?.['type']===_0xad1aad(0x1a4)&&resolveWaitStepPendingIds(_0x3cbbbe,_0x23293a,_0x4a5291,_0x2536a9['name']);}}}}
@@ -1 +1 @@
1
- (function(_0x16b50d,_0x45bb5a){const _0x136188=a153_0x55a7,_0x301bd4=_0x16b50d();while(!![]){try{const _0x4aed97=parseInt(_0x136188(0xd1))/0x1+parseInt(_0x136188(0xd2))/0x2+parseInt(_0x136188(0xcb))/0x3*(parseInt(_0x136188(0xcd))/0x4)+-parseInt(_0x136188(0xd6))/0x5+-parseInt(_0x136188(0xd7))/0x6*(-parseInt(_0x136188(0xd0))/0x7)+-parseInt(_0x136188(0xca))/0x8+-parseInt(_0x136188(0xc9))/0x9;if(_0x4aed97===_0x45bb5a)break;else _0x301bd4['push'](_0x301bd4['shift']());}catch(_0x5b70c5){_0x301bd4['push'](_0x301bd4['shift']());}}}(a153_0x3c37,0x96375));export function buildFolderIdToPathMap(_0x65dff8){const _0xa6b428=a153_0x55a7,_0x2a4864=new Map(),_0x3b5ca7=new Map();for(const _0x38755f of _0x65dff8){_0x3b5ca7['set'](_0x38755f['id'],_0x38755f);}const _0xe408bb=new Set();for(const _0x3c2b1d of _0x65dff8){!_0x3c2b1d[_0xa6b428(0xcc)]&&_0xe408bb[_0xa6b428(0xcf)](_0x3c2b1d['id']);}function _0x1e6246(_0x34d19c){const _0x53cbac=_0xa6b428;if(_0x2a4864[_0x53cbac(0xd4)](_0x34d19c['id']))return _0x2a4864[_0x53cbac(0xd3)](_0x34d19c['id']);if(_0xe408bb[_0x53cbac(0xd4)](_0x34d19c['id']))return _0x2a4864['set'](_0x34d19c['id'],''),'';if(_0x34d19c[_0x53cbac(0xcc)]){const _0x19ec23=_0x3b5ca7['get'](_0x34d19c[_0x53cbac(0xcc)]);if(_0x19ec23){const _0x510ea0=_0x1e6246(_0x19ec23),_0x3b6841=_0x510ea0?_0x510ea0+'/'+_0x34d19c[_0x53cbac(0xce)]:_0x34d19c[_0x53cbac(0xce)];return _0x2a4864[_0x53cbac(0xd5)](_0x34d19c['id'],_0x3b6841),_0x3b6841;}}const _0x5245c8=_0x34d19c[_0x53cbac(0xce)];return _0x2a4864['set'](_0x34d19c['id'],_0x5245c8),_0x5245c8;}for(const _0x2ae296 of _0x65dff8){_0x1e6246(_0x2ae296);}return _0x2a4864;}export function buildFolderPathToIdMap(_0x3b08ed){const _0x8fcf0f=a153_0x55a7,_0x23d614=new Map(),_0xdf0ddc=new Map();for(const _0x1455ba of _0x3b08ed){_0xdf0ddc[_0x8fcf0f(0xd5)](_0x1455ba['id'],_0x1455ba);}const _0x236e2c=new Set();for(const _0x38a7a9 of _0x3b08ed){!_0x38a7a9[_0x8fcf0f(0xcc)]&&_0x236e2c['add'](_0x38a7a9['id']);}function _0x4c22ee(_0x4907a3){const _0x3056cc=_0x8fcf0f;if(_0x236e2c[_0x3056cc(0xd4)](_0x4907a3['id']))return'';if(_0x4907a3[_0x3056cc(0xcc)]){const _0x47c085=_0xdf0ddc[_0x3056cc(0xd3)](_0x4907a3['parentFolderId']);if(_0x47c085){const _0xcfb52e=_0x4c22ee(_0x47c085);return _0xcfb52e?_0xcfb52e+'/'+_0x4907a3[_0x3056cc(0xce)]:_0x4907a3['name'];}}return _0x4907a3[_0x3056cc(0xce)];}for(const _0xecb514 of _0x3b08ed){const _0x30d3df=_0x4c22ee(_0xecb514);_0x23d614[_0x8fcf0f(0xd5)](_0x30d3df,_0xecb514['id']);}return _0x23d614;}export function buildFolderMaps(_0x105063){const _0x38852f=a153_0x55a7,_0x47b8f8=buildFolderIdToPathMap(_0x105063),_0x2f1a34=new Map();for(const [_0xdf4977,_0x41c09a]of _0x47b8f8){_0x2f1a34[_0x38852f(0xd5)](_0x41c09a,_0xdf4977);}return{'idToPath':_0x47b8f8,'pathToId':_0x2f1a34};}function a153_0x55a7(_0x5dd3bf,_0x29dc9e){_0x5dd3bf=_0x5dd3bf-0xc9;const _0x3c377a=a153_0x3c37();let _0x55a732=_0x3c377a[_0x5dd3bf];return _0x55a732;}function a153_0x3c37(){const _0x1d3df8=['68ITAkBP','name','add','98VPoFsV','952290BhrpDl','1871168sXwVmY','get','has','set','1646635BNoHRi','93684YjZFDA','8397972LRrfwB','7737704sCvGJk','130317objJCk','parentFolderId'];a153_0x3c37=function(){return _0x1d3df8;};return a153_0x3c37();}export function getFolderPath(_0x4583aa,_0x2ae4bc){const _0x39146b=a153_0x55a7;if(!_0x4583aa)return'';return _0x2ae4bc[_0x39146b(0xd3)](_0x4583aa)??'';}
1
+ function a153_0x1b05(_0x524db6,_0x511b31){_0x524db6=_0x524db6-0x16b;const _0x43dc7e=a153_0x43dc();let _0x1b0540=_0x43dc7e[_0x524db6];return _0x1b0540;}(function(_0x4959e8,_0x260d1b){const _0x5416ae=a153_0x1b05,_0x40da8f=_0x4959e8();while(!![]){try{const _0x215693=parseInt(_0x5416ae(0x16d))/0x1+parseInt(_0x5416ae(0x177))/0x2*(parseInt(_0x5416ae(0x173))/0x3)+parseInt(_0x5416ae(0x16b))/0x4+parseInt(_0x5416ae(0x16c))/0x5+-parseInt(_0x5416ae(0x170))/0x6*(parseInt(_0x5416ae(0x16e))/0x7)+parseInt(_0x5416ae(0x178))/0x8+-parseInt(_0x5416ae(0x179))/0x9*(parseInt(_0x5416ae(0x175))/0xa);if(_0x215693===_0x260d1b)break;else _0x40da8f['push'](_0x40da8f['shift']());}catch(_0x17808e){_0x40da8f['push'](_0x40da8f['shift']());}}}(a153_0x43dc,0xd8bf6));export function buildFolderIdToPathMap(_0x5b9f85){const _0x38feed=a153_0x1b05,_0x4804eb=new Map(),_0x303e21=new Map();for(const _0x513f18 of _0x5b9f85){_0x303e21[_0x38feed(0x176)](_0x513f18['id'],_0x513f18);}const _0x1e757a=new Set();for(const _0x324539 of _0x5b9f85){!_0x324539[_0x38feed(0x17a)]&&_0x1e757a['add'](_0x324539['id']);}function _0x45d8e0(_0x193645){const _0xa9e065=_0x38feed;if(_0x4804eb[_0xa9e065(0x174)](_0x193645['id']))return _0x4804eb[_0xa9e065(0x171)](_0x193645['id']);if(_0x1e757a[_0xa9e065(0x174)](_0x193645['id']))return _0x4804eb['set'](_0x193645['id'],''),'';if(_0x193645['parentFolderId']){const _0x52ba86=_0x303e21[_0xa9e065(0x171)](_0x193645[_0xa9e065(0x17a)]);if(_0x52ba86){const _0x1c2f48=_0x45d8e0(_0x52ba86),_0x2c375c=_0x1c2f48?_0x1c2f48+'/'+_0x193645[_0xa9e065(0x172)]:_0x193645['name'];return _0x4804eb[_0xa9e065(0x176)](_0x193645['id'],_0x2c375c),_0x2c375c;}}const _0x856a58=_0x193645['name'];return _0x4804eb[_0xa9e065(0x176)](_0x193645['id'],_0x856a58),_0x856a58;}for(const _0x80a67e of _0x5b9f85){_0x45d8e0(_0x80a67e);}return _0x4804eb;}export function buildFolderPathToIdMap(_0x306f53){const _0xa61e0=a153_0x1b05,_0x1f9428=new Map(),_0x5adeac=new Map();for(const _0x298d83 of _0x306f53){_0x5adeac[_0xa61e0(0x176)](_0x298d83['id'],_0x298d83);}const _0x4686c8=new Set();for(const _0x3f294b of _0x306f53){!_0x3f294b[_0xa61e0(0x17a)]&&_0x4686c8[_0xa61e0(0x16f)](_0x3f294b['id']);}function _0x361007(_0x3db485){const _0xafb208=_0xa61e0;if(_0x4686c8['has'](_0x3db485['id']))return'';if(_0x3db485[_0xafb208(0x17a)]){const _0x34989f=_0x5adeac[_0xafb208(0x171)](_0x3db485[_0xafb208(0x17a)]);if(_0x34989f){const _0x524af0=_0x361007(_0x34989f);return _0x524af0?_0x524af0+'/'+_0x3db485['name']:_0x3db485[_0xafb208(0x172)];}}return _0x3db485['name'];}for(const _0x486558 of _0x306f53){const _0x1eca64=_0x361007(_0x486558);_0x1f9428[_0xa61e0(0x176)](_0x1eca64,_0x486558['id']);}return _0x1f9428;}function a153_0x43dc(){const _0x211af1=['679ELNsfx','add','81282WXsYsL','get','name','3aSRqPf','has','90ojZaeX','set','2939446wwXFke','11914464AFjLxk','3250773sLCCCb','parentFolderId','4643460dwavHv','5939345oBfsfw','144865SbXWCY'];a153_0x43dc=function(){return _0x211af1;};return a153_0x43dc();}export function buildFolderMaps(_0x297173){const _0x4780f9=a153_0x1b05,_0x52fece=buildFolderIdToPathMap(_0x297173),_0x20b3e4=new Map();for(const [_0x1ec1dd,_0x10cb48]of _0x52fece){_0x20b3e4[_0x4780f9(0x176)](_0x10cb48,_0x1ec1dd);}return{'idToPath':_0x52fece,'pathToId':_0x20b3e4};}export function getFolderPath(_0x347be7,_0x16a6bd){const _0x38a096=a153_0x1b05;if(!_0x347be7)return'';return _0x16a6bd[_0x38a096(0x171)](_0x347be7)??'';}
@@ -1 +1 @@
1
- (function(_0x50a3e9,_0x5ae592){const _0x4b3339=a154_0x4010,_0x156a65=_0x50a3e9();while(!![]){try{const _0x13d478=-parseInt(_0x4b3339(0x1d8))/0x1+parseInt(_0x4b3339(0x1b6))/0x2+-parseInt(_0x4b3339(0x1b9))/0x3+parseInt(_0x4b3339(0x1e7))/0x4*(parseInt(_0x4b3339(0x1db))/0x5)+-parseInt(_0x4b3339(0x1d4))/0x6*(-parseInt(_0x4b3339(0x1c8))/0x7)+parseInt(_0x4b3339(0x1e1))/0x8+-parseInt(_0x4b3339(0x1d1))/0x9;if(_0x13d478===_0x5ae592)break;else _0x156a65['push'](_0x156a65['shift']());}catch(_0x2b7b7a){_0x156a65['push'](_0x156a65['shift']());}}}(a154_0x2e6b,0x561b1));function a154_0x2e6b(){const _0x47b668=['Cannot\x20navigate\x20above\x20root','14WEiJuz','Relative\x20path\x20cannot\x20be\x20empty','raw','No\x20tdx.json\x20found\x20for\x20file:\x20','tdx.json','dirname','push','Path\x20attempts\x20to\x20navigate\x20above\x20root','name','4700718iNofBS','replace','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','447756SRNopB','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','parse','317487BLVLrV','join','relative','31445JaDlnf','filter','parent_segment','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','Cannot\x20split\x20empty\x20path','split','4409512yTNrEX','substring','endsWith','segments','test','slice','436qLRUAj','pop','204920ZRMvsm','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','length','887772ExERaI','trim','journey','startsWith','Path\x20cannot\x20be\x20empty','Path\x20segment\x20cannot\x20be\x20empty','.yaml','.yml','resolve','root','isAbsolute','exists','type','segment'];a154_0x2e6b=function(){return _0x47b668;};return a154_0x2e6b();}import a154_0x34159b from'path';function a154_0x4010(_0x1fcd5f,_0x19436c){_0x1fcd5f=_0x1fcd5f-0x1b6;const _0x2e6bf3=a154_0x2e6b();let _0x4010bc=_0x2e6bf3[_0x1fcd5f];return _0x4010bc;}import{parse as a154_0x19891a}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x281e73){const _0x50fc4f=a154_0x4010;if(!_0x281e73||_0x281e73[_0x50fc4f(0x1ba)]()==='')throw new Error(_0x50fc4f(0x1bd));const _0x2b20b4=_0x281e73[_0x50fc4f(0x1ba)]();if(_0x2b20b4==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x281e73};const _0x437549=_0x2b20b4[_0x50fc4f(0x1bc)]('/')?_0x2b20b4[_0x50fc4f(0x1e2)](0x1):_0x2b20b4,_0x36e008=_0x437549[_0x50fc4f(0x1e0)]('/')[_0x50fc4f(0x1dc)](_0x3dc246=>_0x3dc246!=='');if(_0x36e008[_0x50fc4f(0x1b8)]===0x0)throw new Error(_0x50fc4f(0x1d3));const _0x85b120=_0x2b20b4[_0x50fc4f(0x1bc)]('/')||!isRelativePathSegment(_0x36e008[0x0]);for(const _0x237068 of _0x36e008){validatePathSegment(_0x237068);}return{'segments':_0x36e008,'isAbsolute':_0x85b120,'raw':_0x281e73};}function isRelativePathSegment(_0x47f4c5){return _0x47f4c5==='.'||_0x47f4c5==='..';}function validatePathSegment(_0x1730f6){const _0xcc2fcc=a154_0x4010;if(_0x1730f6==='')throw new Error(_0xcc2fcc(0x1be));if(_0x1730f6==='.'||_0x1730f6==='..')return;if(/[\x00-\x1F\x7F]/[_0xcc2fcc(0x1e5)](_0x1730f6))throw new Error(_0xcc2fcc(0x1de)+_0x1730f6);if(_0x1730f6!==_0x1730f6[_0xcc2fcc(0x1ba)]()){}}export function validatePath(_0x352423){const _0x56d67b=a154_0x4010;if(_0x352423[_0x56d67b(0x1e4)][_0x56d67b(0x1b8)]===0x0&&!_0x352423[_0x56d67b(0x1c3)])throw new Error(_0x56d67b(0x1c9));if(_0x352423[_0x56d67b(0x1c3)]){if(_0x352423[_0x56d67b(0x1e4)][0x0]==='..')throw new Error('Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22');let _0x379c17=0x0;for(const _0x38ba2d of _0x352423[_0x56d67b(0x1e4)]){if(_0x38ba2d==='..'){if(_0x379c17===0x0)throw new Error(_0x56d67b(0x1cf));_0x379c17--;}else _0x38ba2d!=='.'&&_0x379c17++;}}}export function joinPaths(_0x5c8332,_0xe66116){const _0x14ad79=a154_0x4010;if(!_0x5c8332||_0x5c8332==='/')return _0xe66116;if(!_0xe66116||_0xe66116==='.')return _0x5c8332;if(_0xe66116[_0x14ad79(0x1bc)]('/'))return _0xe66116;const _0x192097=parsePath(_0x5c8332),_0x36c892=parsePath(_0xe66116),_0x387e70=[..._0x192097[_0x14ad79(0x1e4)]];for(const _0x4a422c of _0x36c892[_0x14ad79(0x1e4)]){if(_0x4a422c==='.')continue;else{if(_0x4a422c==='..'){if(_0x387e70[_0x14ad79(0x1b8)]===0x0)throw new Error(_0x14ad79(0x1c7));_0x387e70[_0x14ad79(0x1e8)]();}else _0x387e70[_0x14ad79(0x1ce)](_0x4a422c);}}const _0x1495fc=_0x387e70['join']('/');return _0x192097['raw'][_0x14ad79(0x1bc)]('/')?'/'+_0x1495fc:_0x1495fc;}export function normalizePath(_0x58bf67){const _0x21bdb6=a154_0x4010,_0x48d1ce=parsePath(_0x58bf67),_0xccf921=[];for(const _0x3866b3 of _0x48d1ce['segments']){if(_0x3866b3==='.')continue;else{if(_0x3866b3==='..'){if(_0xccf921[_0x21bdb6(0x1b8)]===0x0){if(_0x48d1ce[_0x21bdb6(0x1c3)])throw new Error(_0x21bdb6(0x1c7));_0xccf921[_0x21bdb6(0x1ce)]('..');}else _0xccf921[_0xccf921[_0x21bdb6(0x1b8)]-0x1]==='..'?_0xccf921['push']('..'):_0xccf921['pop']();}else _0xccf921[_0x21bdb6(0x1ce)](_0x3866b3);}}if(_0xccf921[_0x21bdb6(0x1b8)]===0x0)return _0x48d1ce[_0x21bdb6(0x1c3)]?'/':'.';const _0x1279c1=_0xccf921[_0x21bdb6(0x1d9)]('/');return _0x48d1ce['raw']['startsWith']('/')?'/'+_0x1279c1:_0x1279c1;}export function getParentPath(_0x4ebfa6){const _0x52edf8=a154_0x4010,_0x44846e=parsePath(_0x4ebfa6);if(_0x44846e['segments'][_0x52edf8(0x1b8)]<=0x1)return'/';const _0x1b5c6d=_0x44846e[_0x52edf8(0x1e4)][_0x52edf8(0x1e6)](0x0,-0x1)[_0x52edf8(0x1d9)]('/');return _0x44846e[_0x52edf8(0x1ca)][_0x52edf8(0x1bc)]('/')?'/'+_0x1b5c6d:_0x1b5c6d;}export function getBaseName(_0x5e0e2f){const _0x156584=a154_0x4010,_0x34a821=parsePath(_0x5e0e2f);return _0x34a821[_0x156584(0x1e4)][_0x34a821[_0x156584(0x1e4)][_0x156584(0x1b8)]-0x1]||'';}export function isChildPath(_0x2f35b4,_0x922f4b){const _0x1d0b1b=a154_0x4010,_0x29627f=parsePath(_0x2f35b4),_0x1e1def=parsePath(_0x922f4b);if(_0x29627f[_0x1d0b1b(0x1e4)][_0x1d0b1b(0x1b8)]<=_0x1e1def['segments'][_0x1d0b1b(0x1b8)])return![];for(let _0x22a04a=0x0;_0x22a04a<_0x1e1def[_0x1d0b1b(0x1e4)]['length'];_0x22a04a++){if(_0x29627f[_0x1d0b1b(0x1e4)][_0x22a04a]!==_0x1e1def[_0x1d0b1b(0x1e4)][_0x22a04a])return![];}return!![];}export function splitPath(_0x5082ed){const _0x28f1fc=a154_0x4010,_0x509c1e=parsePath(_0x5082ed);if(_0x509c1e[_0x28f1fc(0x1e4)][_0x28f1fc(0x1b8)]===0x0)throw new Error(_0x28f1fc(0x1df));if(_0x509c1e[_0x28f1fc(0x1e4)][_0x28f1fc(0x1b8)]===0x1)return{'parent':_0x509c1e['segments'][0x0]};return{'parent':_0x509c1e[_0x28f1fc(0x1e4)][0x0],'child':_0x509c1e[_0x28f1fc(0x1e4)][_0x28f1fc(0x1e6)](0x1)[_0x28f1fc(0x1d9)]('/')};}export function isYamlFilePath(_0x32429c){const _0x46755c=a154_0x4010;return _0x32429c[_0x46755c(0x1e3)](_0x46755c(0x1c0))||_0x32429c[_0x46755c(0x1e3)](_0x46755c(0x1bf));}export async function resolveYamlFilePath(_0x3d82b2,_0x4f7727=nodeFileSystem){const _0x4dca9b=a154_0x4010,_0x22e145=a154_0x34159b[_0x4dca9b(0x1c1)](_0x3d82b2);if(!await _0x4f7727[_0x4dca9b(0x1c4)](_0x22e145))throw new Error('File\x20not\x20found:\x20'+_0x3d82b2);let _0x30f38c=a154_0x34159b[_0x4dca9b(0x1cd)](_0x22e145),_0x2a99a=null,_0x5b9c5f=null;const _0x490289=a154_0x34159b[_0x4dca9b(0x1d7)](_0x30f38c)[_0x4dca9b(0x1c2)];while(_0x30f38c!==_0x490289){const _0x3ddbef=a154_0x34159b[_0x4dca9b(0x1d9)](_0x30f38c,_0x4dca9b(0x1cc));if(await _0x4f7727['exists'](_0x3ddbef)){_0x2a99a=_0x3ddbef,_0x5b9c5f=_0x30f38c;break;}_0x30f38c=a154_0x34159b[_0x4dca9b(0x1cd)](_0x30f38c);}if(!_0x2a99a||!_0x5b9c5f)throw new Error(_0x4dca9b(0x1cb)+_0x3d82b2+'\x0a'+_0x4dca9b(0x1b7));const _0x4ad798=await _0x4f7727['readFile'](_0x2a99a),_0x1ea4c1=JSON['parse'](_0x4ad798),_0x3029f6=_0x1ea4c1[_0x4dca9b(0x1dd)];if(!_0x3029f6)throw new Error(_0x4dca9b(0x1d5));const _0x228212=await _0x4f7727['readFile'](_0x22e145),_0x524a6e=a154_0x19891a(_0x228212),_0x22d346=_0x524a6e[_0x4dca9b(0x1d0)];if(!_0x22d346)throw new Error(_0x4dca9b(0x1d6)+_0x3d82b2);const _0x48dc18=_0x524a6e[_0x4dca9b(0x1c5)]===_0x4dca9b(0x1bb)?_0x4dca9b(0x1bb):_0x4dca9b(0x1c6),_0x5bdd13=a154_0x34159b[_0x4dca9b(0x1da)](_0x5b9c5f,_0x22e145),_0x507da9=a154_0x34159b['dirname'](_0x5bdd13),_0x41895d=_0x507da9==='.'?'':_0x507da9[_0x4dca9b(0x1d2)](/\\/g,'/'),_0x4f486a=_0x41895d?_0x3029f6+'/'+_0x41895d+'/'+_0x22d346:_0x3029f6+'/'+_0x22d346;return{'parentSegment':_0x3029f6,'segmentName':_0x22d346,'folderPath':_0x41895d,'fullPath':_0x4f486a,'resourceType':_0x48dc18,'content':_0x228212};}
1
+ (function(_0x17e315,_0x13b2d2){const _0x24d08a=a154_0x3953,_0x18a16b=_0x17e315();while(!![]){try{const _0x1d4a51=parseInt(_0x24d08a(0x189))/0x1+-parseInt(_0x24d08a(0x183))/0x2*(-parseInt(_0x24d08a(0x178))/0x3)+parseInt(_0x24d08a(0x166))/0x4+-parseInt(_0x24d08a(0x164))/0x5*(parseInt(_0x24d08a(0x18a))/0x6)+-parseInt(_0x24d08a(0x16a))/0x7*(parseInt(_0x24d08a(0x185))/0x8)+parseInt(_0x24d08a(0x162))/0x9+-parseInt(_0x24d08a(0x184))/0xa*(parseInt(_0x24d08a(0x171))/0xb);if(_0x1d4a51===_0x13b2d2)break;else _0x18a16b['push'](_0x18a16b['shift']());}catch(_0x3490dd){_0x18a16b['push'](_0x18a16b['shift']());}}}(a154_0x51a3,0xee9d5));import a154_0x1c0d97 from'path';import{parse as a154_0x35291c}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x3122dc){const _0x2f5c0c=a154_0x3953;if(!_0x3122dc||_0x3122dc[_0x2f5c0c(0x18c)]()==='')throw new Error(_0x2f5c0c(0x187));const _0x217f03=_0x3122dc['trim']();if(_0x217f03==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x3122dc};const _0x218285=_0x217f03[_0x2f5c0c(0x165)]('/')?_0x217f03[_0x2f5c0c(0x17f)](0x1):_0x217f03,_0x28be1e=_0x218285[_0x2f5c0c(0x170)]('/')[_0x2f5c0c(0x17b)](_0x4b2e4f=>_0x4b2e4f!=='');if(_0x28be1e[_0x2f5c0c(0x168)]===0x0)throw new Error(_0x2f5c0c(0x16b));const _0x2ea516=_0x217f03['startsWith']('/')||!isRelativePathSegment(_0x28be1e[0x0]);for(const _0x5e1659 of _0x28be1e){validatePathSegment(_0x5e1659);}return{'segments':_0x28be1e,'isAbsolute':_0x2ea516,'raw':_0x3122dc};}function isRelativePathSegment(_0x335641){return _0x335641==='.'||_0x335641==='..';}function validatePathSegment(_0x4d4b8c){const _0x2dbafa=a154_0x3953;if(_0x4d4b8c==='')throw new Error(_0x2dbafa(0x190));if(_0x4d4b8c==='.'||_0x4d4b8c==='..')return;if(/[\x00-\x1F\x7F]/[_0x2dbafa(0x167)](_0x4d4b8c))throw new Error(_0x2dbafa(0x188)+_0x4d4b8c);if(_0x4d4b8c!==_0x4d4b8c[_0x2dbafa(0x18c)]()){}}export function validatePath(_0x10b6a9){const _0x521832=a154_0x3953;if(_0x10b6a9['segments'][_0x521832(0x168)]===0x0&&!_0x10b6a9[_0x521832(0x174)])throw new Error(_0x521832(0x172));if(_0x10b6a9[_0x521832(0x174)]){if(_0x10b6a9[_0x521832(0x17d)][0x0]==='..')throw new Error(_0x521832(0x180));let _0x57948b=0x0;for(const _0x876ebf of _0x10b6a9[_0x521832(0x17d)]){if(_0x876ebf==='..'){if(_0x57948b===0x0)throw new Error('Path\x20attempts\x20to\x20navigate\x20above\x20root');_0x57948b--;}else _0x876ebf!=='.'&&_0x57948b++;}}}export function joinPaths(_0x458841,_0x1e1788){const _0xee18a4=a154_0x3953;if(!_0x458841||_0x458841==='/')return _0x1e1788;if(!_0x1e1788||_0x1e1788==='.')return _0x458841;if(_0x1e1788[_0xee18a4(0x165)]('/'))return _0x1e1788;const _0xe49bf1=parsePath(_0x458841),_0x276746=parsePath(_0x1e1788),_0x16c836=[..._0xe49bf1[_0xee18a4(0x17d)]];for(const _0x4706e9 of _0x276746[_0xee18a4(0x17d)]){if(_0x4706e9==='.')continue;else{if(_0x4706e9==='..'){if(_0x16c836['length']===0x0)throw new Error(_0xee18a4(0x179));_0x16c836[_0xee18a4(0x191)]();}else _0x16c836[_0xee18a4(0x163)](_0x4706e9);}}const _0x27c54c=_0x16c836[_0xee18a4(0x169)]('/');return _0xe49bf1[_0xee18a4(0x193)][_0xee18a4(0x165)]('/')?'/'+_0x27c54c:_0x27c54c;}function a154_0x51a3(){const _0x62f9d3=['126nlrWTj','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','exists','slice','No\x20tdx.json\x20found\x20for\x20file:\x20','resolve','split','825eRqFYO','Relative\x20path\x20cannot\x20be\x20empty','tdx.json','isAbsolute','parent_segment','dirname','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','6pdrBFN','Cannot\x20navigate\x20above\x20root','File\x20not\x20found:\x20','filter','.yml','segments','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','substring','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','parse','journey','454BtGeUH','77950uxtSPg','193152QllPlc','Cannot\x20split\x20empty\x20path','Path\x20cannot\x20be\x20empty','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','1205383mXwiAS','12HNYgYj','type','trim','relative','endsWith','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','Path\x20segment\x20cannot\x20be\x20empty','pop','root','raw','8853084bnooAc','push','3154735kiseqG','startsWith','4275852VQQsCv','test','length','join'];a154_0x51a3=function(){return _0x62f9d3;};return a154_0x51a3();}export function normalizePath(_0x5238aa){const _0x31e5a4=a154_0x3953,_0x498f8c=parsePath(_0x5238aa),_0x5734c3=[];for(const _0x34285d of _0x498f8c[_0x31e5a4(0x17d)]){if(_0x34285d==='.')continue;else{if(_0x34285d==='..'){if(_0x5734c3[_0x31e5a4(0x168)]===0x0){if(_0x498f8c[_0x31e5a4(0x174)])throw new Error(_0x31e5a4(0x179));_0x5734c3[_0x31e5a4(0x163)]('..');}else _0x5734c3[_0x5734c3[_0x31e5a4(0x168)]-0x1]==='..'?_0x5734c3['push']('..'):_0x5734c3[_0x31e5a4(0x191)]();}else _0x5734c3[_0x31e5a4(0x163)](_0x34285d);}}if(_0x5734c3['length']===0x0)return _0x498f8c[_0x31e5a4(0x174)]?'/':'.';const _0x323214=_0x5734c3[_0x31e5a4(0x169)]('/');return _0x498f8c['raw'][_0x31e5a4(0x165)]('/')?'/'+_0x323214:_0x323214;}export function getParentPath(_0x3fcc8f){const _0x157ea5=a154_0x3953,_0x272626=parsePath(_0x3fcc8f);if(_0x272626[_0x157ea5(0x17d)][_0x157ea5(0x168)]<=0x1)return'/';const _0x1a1ec3=_0x272626[_0x157ea5(0x17d)]['slice'](0x0,-0x1)['join']('/');return _0x272626[_0x157ea5(0x193)][_0x157ea5(0x165)]('/')?'/'+_0x1a1ec3:_0x1a1ec3;}export function getBaseName(_0x2c4817){const _0x55e594=a154_0x3953,_0x36ad4f=parsePath(_0x2c4817);return _0x36ad4f[_0x55e594(0x17d)][_0x36ad4f[_0x55e594(0x17d)][_0x55e594(0x168)]-0x1]||'';}function a154_0x3953(_0x369677,_0x3b23e1){_0x369677=_0x369677-0x162;const _0x51a345=a154_0x51a3();let _0x3953b6=_0x51a345[_0x369677];return _0x3953b6;}export function isChildPath(_0x1e0856,_0x17c4c9){const _0x36e9ec=a154_0x3953,_0x248991=parsePath(_0x1e0856),_0x1004d4=parsePath(_0x17c4c9);if(_0x248991[_0x36e9ec(0x17d)][_0x36e9ec(0x168)]<=_0x1004d4[_0x36e9ec(0x17d)][_0x36e9ec(0x168)])return![];for(let _0x104b6f=0x0;_0x104b6f<_0x1004d4['segments']['length'];_0x104b6f++){if(_0x248991['segments'][_0x104b6f]!==_0x1004d4[_0x36e9ec(0x17d)][_0x104b6f])return![];}return!![];}export function splitPath(_0x174b16){const _0x472eb1=a154_0x3953,_0x1c2bc3=parsePath(_0x174b16);if(_0x1c2bc3['segments'][_0x472eb1(0x168)]===0x0)throw new Error(_0x472eb1(0x186));if(_0x1c2bc3[_0x472eb1(0x17d)][_0x472eb1(0x168)]===0x1)return{'parent':_0x1c2bc3[_0x472eb1(0x17d)][0x0]};return{'parent':_0x1c2bc3[_0x472eb1(0x17d)][0x0],'child':_0x1c2bc3[_0x472eb1(0x17d)][_0x472eb1(0x16d)](0x1)['join']('/')};}export function isYamlFilePath(_0x5cf04e){const _0xd0e740=a154_0x3953;return _0x5cf04e[_0xd0e740(0x18e)](_0xd0e740(0x17c))||_0x5cf04e[_0xd0e740(0x18e)]('.yaml');}export async function resolveYamlFilePath(_0x1eca0e,_0x281401=nodeFileSystem){const _0x125233=a154_0x3953,_0x295b11=a154_0x1c0d97[_0x125233(0x16f)](_0x1eca0e);if(!await _0x281401['exists'](_0x295b11))throw new Error(_0x125233(0x17a)+_0x1eca0e);let _0x2be102=a154_0x1c0d97[_0x125233(0x176)](_0x295b11),_0x5ed022=null,_0x642a7=null;const _0x457241=a154_0x1c0d97[_0x125233(0x181)](_0x2be102)[_0x125233(0x192)];while(_0x2be102!==_0x457241){const _0x353a3a=a154_0x1c0d97[_0x125233(0x169)](_0x2be102,_0x125233(0x173));if(await _0x281401[_0x125233(0x16c)](_0x353a3a)){_0x5ed022=_0x353a3a,_0x642a7=_0x2be102;break;}_0x2be102=a154_0x1c0d97['dirname'](_0x2be102);}if(!_0x5ed022||!_0x642a7)throw new Error(_0x125233(0x16e)+_0x1eca0e+'\x0a'+_0x125233(0x177));const _0xb982d1=await _0x281401['readFile'](_0x5ed022),_0x517587=JSON[_0x125233(0x181)](_0xb982d1),_0x13e851=_0x517587[_0x125233(0x175)];if(!_0x13e851)throw new Error(_0x125233(0x17e));const _0x9dbae1=await _0x281401['readFile'](_0x295b11),_0xe56397=a154_0x35291c(_0x9dbae1),_0x1722a7=_0xe56397['name'];if(!_0x1722a7)throw new Error(_0x125233(0x18f)+_0x1eca0e);const _0x5700e7=_0xe56397[_0x125233(0x18b)]===_0x125233(0x182)?'journey':'segment',_0x15f6ec=a154_0x1c0d97[_0x125233(0x18d)](_0x642a7,_0x295b11),_0x4c9ab1=a154_0x1c0d97[_0x125233(0x176)](_0x15f6ec),_0x38a67b=_0x4c9ab1==='.'?'':_0x4c9ab1['replace'](/\\/g,'/'),_0x46060b=_0x38a67b?_0x13e851+'/'+_0x38a67b+'/'+_0x1722a7:_0x13e851+'/'+_0x1722a7;return{'parentSegment':_0x13e851,'segmentName':_0x1722a7,'folderPath':_0x38a67b,'fullPath':_0x46060b,'resourceType':_0x5700e7,'content':_0x9dbae1};}
@@ -1 +1 @@
1
- (function(_0x2cdac6,_0xa73455){const _0x53e9c3=a155_0x1c7b,_0x1d73a6=_0x2cdac6();while(!![]){try{const _0x4e99fc=-parseInt(_0x53e9c3(0x1c0))/0x1*(-parseInt(_0x53e9c3(0x1c9))/0x2)+-parseInt(_0x53e9c3(0x1c4))/0x3*(parseInt(_0x53e9c3(0x1bf))/0x4)+-parseInt(_0x53e9c3(0x1c5))/0x5+-parseInt(_0x53e9c3(0x1c1))/0x6*(parseInt(_0x53e9c3(0x1bd))/0x7)+parseInt(_0x53e9c3(0x1cb))/0x8+-parseInt(_0x53e9c3(0x1c6))/0x9+parseInt(_0x53e9c3(0x1c7))/0xa*(parseInt(_0x53e9c3(0x1c2))/0xb);if(_0x4e99fc===_0xa73455)break;else _0x1d73a6['push'](_0x1d73a6['shift']());}catch(_0x1d5983){_0x1d73a6['push'](_0x1d73a6['shift']());}}}(a155_0x10a5,0x2890b));function a155_0x10a5(){const _0x2a9a37=['.\x20Parent\x20name\x20cannot\x20be\x20empty','184XnqBFE','347ApHaGI','32658JpQLIN','4325629LLlGxL','Invalid\x20segment\x20reference\x20format:\x20','7581rYKOwp','399295qHCUqd','2063745zcXLXJ','10KhQkpS','.\x20Child\x20name\x20cannot\x20be\x20empty','1114EzvbiP','substring','2391720KfKuYC','378TtPZsO'];a155_0x10a5=function(){return _0x2a9a37;};return a155_0x10a5();}function a155_0x1c7b(_0xdbb412,_0x290298){_0xdbb412=_0xdbb412-0x1bd;const _0x10a508=a155_0x10a5();let _0x1c7b9f=_0x10a508[_0xdbb412];return _0x1c7b9f;}export function parseSegmentRef(_0x32511e){const _0x5c28fb=a155_0x1c7b,_0x45a220=_0x32511e['indexOf']('/');if(_0x45a220===-0x1)return{'parentId':_0x32511e};if(_0x45a220===0x0)throw new Error(_0x5c28fb(0x1c3)+_0x32511e+_0x5c28fb(0x1be));const _0x1bca34=_0x32511e[_0x5c28fb(0x1ca)](0x0,_0x45a220),_0x56cfc3=_0x32511e[_0x5c28fb(0x1ca)](_0x45a220+0x1);if(_0x56cfc3==='')throw new Error(_0x5c28fb(0x1c3)+_0x32511e+_0x5c28fb(0x1c8));return{'parentId':_0x1bca34,'childId':_0x56cfc3};}
1
+ (function(_0x4e43bd,_0x29054f){const _0x5970d5=a155_0xcab5,_0x512177=_0x4e43bd();while(!![]){try{const _0x1d3956=-parseInt(_0x5970d5(0x156))/0x1*(parseInt(_0x5970d5(0x15a))/0x2)+parseInt(_0x5970d5(0x153))/0x3+parseInt(_0x5970d5(0x150))/0x4+-parseInt(_0x5970d5(0x159))/0x5*(-parseInt(_0x5970d5(0x14d))/0x6)+parseInt(_0x5970d5(0x14e))/0x7*(-parseInt(_0x5970d5(0x155))/0x8)+parseInt(_0x5970d5(0x151))/0x9*(parseInt(_0x5970d5(0x157))/0xa)+-parseInt(_0x5970d5(0x15c))/0xb*(parseInt(_0x5970d5(0x152))/0xc);if(_0x1d3956===_0x29054f)break;else _0x512177['push'](_0x512177['shift']());}catch(_0x45e8a1){_0x512177['push'](_0x512177['shift']());}}}(a155_0x480a,0x890dd));function a155_0xcab5(_0x3789a3,_0x8fb8e8){_0x3789a3=_0x3789a3-0x14d;const _0x480a08=a155_0x480a();let _0xcab553=_0x480a08[_0x3789a3];return _0xcab553;}function a155_0x480a(){const _0x1b6e29=['285KCpPGd','4SDeiUX','.\x20Parent\x20name\x20cannot\x20be\x20empty','22oTxzGA','indexOf','67692utVcmi','112gJiKIL','Invalid\x20segment\x20reference\x20format:\x20','1521448naHEJZ','414LBNvlI','6486408vjqQfl','1768545voSsCA','.\x20Child\x20name\x20cannot\x20be\x20empty','61208BmrpvT','148389eqkTDI','97540tyNApZ','substring'];a155_0x480a=function(){return _0x1b6e29;};return a155_0x480a();}export function parseSegmentRef(_0x351af8){const _0x333fb4=a155_0xcab5,_0x54fa60=_0x351af8[_0x333fb4(0x15d)]('/');if(_0x54fa60===-0x1)return{'parentId':_0x351af8};if(_0x54fa60===0x0)throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x351af8+_0x333fb4(0x15b));const _0x2aea83=_0x351af8['substring'](0x0,_0x54fa60),_0xefa05e=_0x351af8[_0x333fb4(0x158)](_0x54fa60+0x1);if(_0xefa05e==='')throw new Error(_0x333fb4(0x14f)+_0x351af8+_0x333fb4(0x154));return{'parentId':_0x2aea83,'childId':_0xefa05e};}
@@ -1 +1 @@
1
- (function(_0x4a1a0c,_0x3d20f3){const _0x5d3c88=a156_0x3f0a,_0x21e417=_0x4a1a0c();while(!![]){try{const _0x1cea26=-parseInt(_0x5d3c88(0xd4))/0x1+-parseInt(_0x5d3c88(0x114))/0x2+-parseInt(_0x5d3c88(0xff))/0x3+-parseInt(_0x5d3c88(0xdc))/0x4*(parseInt(_0x5d3c88(0x111))/0x5)+parseInt(_0x5d3c88(0xe1))/0x6+-parseInt(_0x5d3c88(0xe4))/0x7+parseInt(_0x5d3c88(0x110))/0x8;if(_0x1cea26===_0x3d20f3)break;else _0x21e417['push'](_0x21e417['shift']());}catch(_0x583262){_0x21e417['push'](_0x21e417['shift']());}}}(a156_0x10ae,0x6bfe9));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0xec8daf,_0x46c0a6={},_0x5baf1c={}){const _0x3965cd=a156_0x3f0a;if(_0x5baf1c[_0x3965cd(0xf6)])return runSemanticChecks(_0xec8daf,_0x46c0a6);const _0x4afa8b=SegmentDefSchema[_0x3965cd(0x101)](_0xec8daf);if(_0x4afa8b[_0x3965cd(0xec)])return runSemanticChecks(_0x4afa8b[_0x3965cd(0xf0)],_0x46c0a6);return zodErrorsToValidationResult(_0x4afa8b[_0x3965cd(0xe3)],_0x46c0a6);}export function validateRuleDef(_0x8d35c1,_0x33ff87,_0x2c3287){const _0x3b83dd=a156_0x3f0a;if(!_0x8d35c1)return[];const _0x1ab77e=RuleDefSchema[_0x3b83dd(0x101)](_0x8d35c1);if(_0x1ab77e[_0x3b83dd(0xec)])return checkRule(_0x1ab77e[_0x3b83dd(0xf0)],_0x33ff87,_0x2c3287);const _0x3839bf=flattenZodIssues(_0x1ab77e[_0x3b83dd(0xe3)][_0x3b83dd(0xe8)]);return _0x3839bf[_0x3b83dd(0xdf)](_0x5822d6=>{const _0x5b9b81=_0x3b83dd,_0xa1cd63=formatZodPath(_0x5822d6[_0x5b9b81(0xee)]),_0x327578=_0xa1cd63?_0x33ff87+'.'+_0xa1cd63:_0x33ff87,_0x305c33=mapZodIssueToCode(_0x5822d6,_0xa1cd63),_0x3c50e1=getLocationFromPath(_0x2c3287[_0x5b9b81(0xe7)],_0x2c3287[_0x5b9b81(0xe9)],pathToArray(_0x327578));return{'level':_0x5b9b81(0xe3),'path':_0x327578,'code':_0x305c33,'message':_0x5822d6['message'],..._0x3c50e1&&{'location':_0x3c50e1}};});}function zodErrorsToValidationResult(_0x4e4bb4,_0x10dad4){const _0x2b7b64=a156_0x3f0a,_0x41c36f=flattenZodIssues(_0x4e4bb4['issues']),_0x4e137c=_0x41c36f[_0x2b7b64(0xdf)](_0x2bde64=>{const _0x4e7a90=_0x2b7b64,_0x2f2ef5=formatZodPath(_0x2bde64[_0x4e7a90(0xee)]),_0x5773c4=mapZodIssueToCode(_0x2bde64,_0x2f2ef5),_0xb3e5b8=getLocationFromPath(_0x10dad4[_0x4e7a90(0xe7)],_0x10dad4[_0x4e7a90(0xe9)],_0x2bde64[_0x4e7a90(0xee)][_0x4e7a90(0xdf)](_0x2d5533=>typeof _0x2d5533===_0x4e7a90(0x102)?String(_0x2d5533):_0x2d5533));return{'level':_0x4e7a90(0xe3),'path':_0x2f2ef5,'code':_0x5773c4,'message':_0x2bde64['message'],..._0xb3e5b8&&{'location':_0xb3e5b8}};});return{'valid':![],'errors':_0x4e137c,'warnings':[]};}function mapZodIssueToCode(_0x3d08ab,_0x5045e4){const _0x431225=a156_0x3f0a,_0x57aa4a=_0x3d08ab[_0x431225(0xe0)]===_0x431225(0xd7)?_0x3d08ab[_0x431225(0xfe)]:undefined;if(_0x5045e4==='name')return'MISSING_NAME';if(_0x5045e4===_0x431225(0xe5)||_0x5045e4['endsWith'](_0x431225(0xf1))){if(_0x3d08ab[_0x431225(0xe0)]===_0x431225(0x10e)){if(_0x5045e4===_0x431225(0xe5)||_0x5045e4['match'](/\.conditions\[\d+\]\.type$/))return _0x431225(0x10b);}}if(_0x5045e4[_0x431225(0x113)](_0x431225(0x10c)))return'INVALID_OPERATOR_TYPE';if(_0x5045e4[_0x431225(0x113)]('.operator.value'))return _0x431225(0xd8);if(_0x57aa4a?.[_0x431225(0xde)]===_0x431225(0x100))return _0x431225(0x100);if(_0x57aa4a?.[_0x431225(0xde)]===_0x431225(0xf5))return _0x431225(0xf5);if(_0x5045e4[_0x431225(0x113)](_0x431225(0xd9))||_0x5045e4===_0x431225(0xef))return _0x431225(0xd6);if(_0x5045e4['includes'](_0x431225(0x112)))return'INVALID_ARRAY_MATCHING';if(_0x5045e4['endsWith']('.segment'))return _0x431225(0xda);return _0x431225(0x115);}function runSemanticChecks(_0x35bce9,_0x11e620){const _0x501b95=a156_0x3f0a,_0x4d4f3e=[];_0x35bce9[_0x501b95(0x103)]&&_0x4d4f3e[_0x501b95(0xed)](...checkRule(_0x35bce9[_0x501b95(0x103)],_0x501b95(0x103),_0x11e620));const _0x2e6f5d=_0x4d4f3e[_0x501b95(0xe6)](_0x569d93=>_0x569d93['level']==='error'),_0x4528bb=_0x4d4f3e[_0x501b95(0xe6)](_0x20a338=>_0x20a338[_0x501b95(0xf4)]===_0x501b95(0xeb));return{'valid':_0x2e6f5d[_0x501b95(0xf8)]===0x0,'errors':_0x2e6f5d,'warnings':_0x4528bb};}function checkRule(_0x3b2c20,_0x4a99c5,_0x53386d){const _0x3dc375=a156_0x3f0a,_0x40ecd4=[];if(_0x3b2c20[_0x3dc375(0xef)][_0x3dc375(0xf8)]===0x0)return _0x40ecd4[_0x3dc375(0xed)]({'level':_0x3dc375(0xe3),'path':_0x4a99c5+_0x3dc375(0xd9),'code':_0x3dc375(0x10a),'message':_0x3dc375(0xf9),'location':getLocationFromPath(_0x53386d[_0x3dc375(0xe7)],_0x53386d[_0x3dc375(0xe9)],pathToArray(_0x4a99c5+_0x3dc375(0xd9)))}),_0x40ecd4;return _0x40ecd4['push'](...checkConditions(_0x3b2c20[_0x3dc375(0xef)],_0x4a99c5,_0x53386d)),_0x40ecd4;}function checkConditions(_0x53e271,_0x1c8d49,_0xd11575){const _0x4d19cd=a156_0x3f0a,_0x14b32a=[];for(let _0xef3644=0x0;_0xef3644<_0x53e271[_0x4d19cd(0xf8)];_0xef3644++){const _0x505765=_0x53e271[_0xef3644],_0x3000d5=_0x1c8d49+_0x4d19cd(0x105)+_0xef3644+']';_0x14b32a['push'](...checkCondition(_0x505765,_0x3000d5,_0xd11575));}return _0x14b32a;}function checkCondition(_0xb2a687,_0x2c64d4,_0x27bb7b){const _0x5924b8=a156_0x3f0a,_0x34f4c5=[];if(_0xb2a687[_0x5924b8(0x104)]==='And'||_0xb2a687[_0x5924b8(0x104)]==='Or'){if(_0xb2a687['conditions'][_0x5924b8(0xf8)]===0x0)_0x34f4c5[_0x5924b8(0xed)]({'level':'error','path':_0x2c64d4+'.conditions','code':_0x5924b8(0x10a),'message':_0xb2a687[_0x5924b8(0x104)]+_0x5924b8(0x116),'location':getLocationFromPath(_0x27bb7b['document'],_0x27bb7b[_0x5924b8(0xe9)],pathToArray(_0x2c64d4+_0x5924b8(0xd9)))});else{const _0x1a0cca=_0xb2a687['description']!==undefined;!_0x1a0cca&&_0x34f4c5['push']({'level':_0x5924b8(0xeb),'path':_0x2c64d4,'code':_0x5924b8(0x106),'message':_0xb2a687[_0x5924b8(0x104)]+_0x5924b8(0xd5)+_0x5924b8(0xdb)+'conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','location':getLocationFromPath(_0x27bb7b[_0x5924b8(0xe7)],_0x27bb7b['source'],pathToArray(_0x2c64d4))}),_0x34f4c5[_0x5924b8(0xed)](...checkConditions(_0xb2a687['conditions'],_0x2c64d4,_0x27bb7b));}return _0x34f4c5;}if(_0xb2a687[_0x5924b8(0x104)]===_0x5924b8(0xf2)||_0xb2a687[_0x5924b8(0x104)]==='Behavior'){const _0x34c02c=_0xb2a687,_0x49f910=_0x34c02c[_0x5924b8(0xe9)],_0x118a23=_0x34c02c['aggregation'],_0xcb1dc2=_0x49f910||_0x118a23;(!_0x34c02c['attribute']||_0x34c02c[_0x5924b8(0xf7)]==='')&&(!_0xcb1dc2&&_0x34f4c5[_0x5924b8(0xed)]({'level':_0x5924b8(0xe3),'path':_0x2c64d4+'.attribute','code':_0x5924b8(0xea),'message':_0x5924b8(0x10f),'location':getLocationFromPath(_0x27bb7b[_0x5924b8(0xe7)],_0x27bb7b[_0x5924b8(0xe9)],pathToArray(_0x2c64d4+'.attribute'))}));_0x34c02c[_0x5924b8(0xe6)]&&_0x34f4c5[_0x5924b8(0xed)](...checkRule(_0x34c02c[_0x5924b8(0xe6)],_0x2c64d4+_0x5924b8(0xdd),_0x27bb7b));if(_0x34c02c[_0x5924b8(0xe9)]){const _0x2abd0e=_0x34c02c['attribute']&&_0x34c02c[_0x5924b8(0xf7)]!=='';_0x2abd0e&&!_0x34c02c[_0x5924b8(0xe6)]&&_0x34f4c5[_0x5924b8(0xed)]({'level':'error','path':_0x2c64d4+_0x5924b8(0x108),'code':_0x5924b8(0xfc),'message':_0x5924b8(0xfd)+_0x34c02c[_0x5924b8(0xe9)]+_0x5924b8(0xf3)+_0x34c02c[_0x5924b8(0xf7)]+'\x27\x20'+_0x5924b8(0xe2)+'the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20'+_0x5924b8(0xfa),'location':getLocationFromPath(_0x27bb7b[_0x5924b8(0xe7)],_0x27bb7b[_0x5924b8(0xe9)],pathToArray(_0x2c64d4+_0x5924b8(0x108)))}),_0x2abd0e&&_0x34c02c[_0x5924b8(0xe6)]&&_0x34f4c5['push']({'level':_0x5924b8(0xeb),'path':_0x2c64d4+'.attribute','code':_0x5924b8(0x107),'message':_0x5924b8(0xfb)+_0x34c02c['attribute']+'\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20'+_0x5924b8(0x10d),'location':getLocationFromPath(_0x27bb7b[_0x5924b8(0xe7)],_0x27bb7b[_0x5924b8(0xe9)],pathToArray(_0x2c64d4+_0x5924b8(0x109)))});}}return _0x34f4c5;}function a156_0x3f0a(_0x5d8bda,_0x4ff1fa){_0x5d8bda=_0x5d8bda-0xd4;const _0x10ae0f=a156_0x10ae();let _0x3f0a82=_0x10ae0f[_0x5d8bda];return _0x3f0a82;}function a156_0x10ae(){const _0x104a81=['data','.type','Value','\x27\x20with\x20attribute\x20\x27','level','MISSING_TIME_UNIT','skipSchema','attribute','length','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','Attribute\x20\x27','BEHAVIOR_SOURCE_MISSING_FILTER','Behavior\x20source\x20\x27','params','2170416bAZfPf','MISSING_BETWEEN_BOUNDS','safeParse','symbol','rule','type','.conditions[','NESTED_CONDITION_GROUP','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','.source','.attribute','EMPTY_CONDITIONS','INVALID_RULE_TYPE','.operator.type','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','invalid_value','Attribute\x20name\x20cannot\x20be\x20empty','21827480ilzPRK','115wepnVD','arrayMatching','endsWith','1560364Gxjgzn','SEGMENT_SCHEMA_ERROR','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','214830CnJhfY','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','MISSING_CONDITIONS','custom','MISSING_OPERATOR_VALUE','.conditions','MISSING_SEGMENT_REFERENCE','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','141396TWUKhN','.filter','validationCode','map','code','1674504djqtKT','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','error','235641huYqIm','rule.type','filter','document','issues','source','EMPTY_ATTRIBUTE','warning','success','push','path','conditions'];a156_0x10ae=function(){return _0x104a81;};return a156_0x10ae();}
1
+ (function(_0x2dad3b,_0x1efb24){const _0x414e9d=a156_0x467a,_0x58733c=_0x2dad3b();while(!![]){try{const _0x12e04c=parseInt(_0x414e9d(0xf6))/0x1+parseInt(_0x414e9d(0xfe))/0x2+-parseInt(_0x414e9d(0xee))/0x3+parseInt(_0x414e9d(0xc6))/0x4+-parseInt(_0x414e9d(0xf9))/0x5*(-parseInt(_0x414e9d(0xbc))/0x6)+parseInt(_0x414e9d(0xf3))/0x7+-parseInt(_0x414e9d(0xbe))/0x8;if(_0x12e04c===_0x1efb24)break;else _0x58733c['push'](_0x58733c['shift']());}catch(_0x57bc81){_0x58733c['push'](_0x58733c['shift']());}}}(a156_0x4582,0x7e603));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x1f11f1,_0x22979b={},_0x2a3bd9={}){const _0x31fa36=a156_0x467a;if(_0x2a3bd9[_0x31fa36(0xf8)])return runSemanticChecks(_0x1f11f1,_0x22979b);const _0x74898a=SegmentDefSchema[_0x31fa36(0xf0)](_0x1f11f1);if(_0x74898a[_0x31fa36(0xcd)])return runSemanticChecks(_0x74898a[_0x31fa36(0xc7)],_0x22979b);return zodErrorsToValidationResult(_0x74898a[_0x31fa36(0xd5)],_0x22979b);}export function validateRuleDef(_0x27718e,_0x27afef,_0x39c30f){const _0x1ba203=a156_0x467a;if(!_0x27718e)return[];const _0x1d1b4d=RuleDefSchema[_0x1ba203(0xf0)](_0x27718e);if(_0x1d1b4d[_0x1ba203(0xcd)])return checkRule(_0x1d1b4d['data'],_0x27afef,_0x39c30f);const _0x2f3eec=flattenZodIssues(_0x1d1b4d['error'][_0x1ba203(0xca)]);return _0x2f3eec[_0x1ba203(0xdc)](_0x397530=>{const _0x45dd39=_0x1ba203,_0x3d83d5=formatZodPath(_0x397530[_0x45dd39(0xc3)]),_0x50bf52=_0x3d83d5?_0x27afef+'.'+_0x3d83d5:_0x27afef,_0x3e7781=mapZodIssueToCode(_0x397530,_0x3d83d5),_0x456658=getLocationFromPath(_0x39c30f[_0x45dd39(0xd0)],_0x39c30f[_0x45dd39(0xd7)],pathToArray(_0x50bf52));return{'level':_0x45dd39(0xd5),'path':_0x50bf52,'code':_0x3e7781,'message':_0x397530['message'],..._0x456658&&{'location':_0x456658}};});}function a156_0x467a(_0x1c9946,_0x1276ec){_0x1c9946=_0x1c9946-0xb8;const _0x4582c9=a156_0x4582();let _0x467a47=_0x4582c9[_0x1c9946];return _0x467a47;}function zodErrorsToValidationResult(_0x1dd2ad,_0x561d15){const _0xec9442=a156_0x467a,_0x1908ca=flattenZodIssues(_0x1dd2ad[_0xec9442(0xca)]),_0x5d08f2=_0x1908ca['map'](_0x570e8c=>{const _0xe3ae81=_0xec9442,_0x5da153=formatZodPath(_0x570e8c[_0xe3ae81(0xc3)]),_0x415155=mapZodIssueToCode(_0x570e8c,_0x5da153),_0x4971c9=getLocationFromPath(_0x561d15[_0xe3ae81(0xd0)],_0x561d15[_0xe3ae81(0xd7)],_0x570e8c[_0xe3ae81(0xc3)][_0xe3ae81(0xdc)](_0x357b8e=>typeof _0x357b8e===_0xe3ae81(0xc0)?String(_0x357b8e):_0x357b8e));return{'level':_0xe3ae81(0xd5),'path':_0x5da153,'code':_0x415155,'message':_0x570e8c[_0xe3ae81(0xba)],..._0x4971c9&&{'location':_0x4971c9}};});return{'valid':![],'errors':_0x5d08f2,'warnings':[]};}function a156_0x4582(){const _0x5a41cb=['INVALID_OPERATOR_TYPE','document','SEGMENT_SCHEMA_ERROR','level','aggregation','match','error','.type','source','Behavior\x20source\x20\x27','And','.conditions[','push','map','MISSING_TIME_UNIT','warning','name','attribute','validationCode','description','rule.type','.segment','.operator.value','custom','type','endsWith','BEHAVIOR_SOURCE_MISSING_FILTER','includes','rule','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','.filter','2303865ADAqcR','Attribute\x20name\x20cannot\x20be\x20empty','safeParse','\x27\x20with\x20attribute\x20\x27','length','5874568AjozuB','MISSING_OPERATOR_VALUE','invalid_value','163906bQDPuk','EMPTY_CONDITIONS','skipSchema','4435qlwGCa','params','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','Value','EMPTY_ATTRIBUTE','1847342KKQzGl','code','INVALID_ARRAY_MATCHING','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','.source','message','filter','6918gplOka','.conditions','15131928VWaLnn','Attribute\x20\x27','symbol','arrayMatching','MISSING_CONDITIONS','path','.attribute','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','910276LEUPqT','data','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','conditions','issues','.operator.type','INVALID_RULE_TYPE','success','MISSING_BETWEEN_BOUNDS'];a156_0x4582=function(){return _0x5a41cb;};return a156_0x4582();}function mapZodIssueToCode(_0x5dc1f6,_0x3a82c9){const _0x5d04cc=a156_0x467a,_0x2d627c=_0x5dc1f6[_0x5d04cc(0xff)]===_0x5d04cc(0xe6)?_0x5dc1f6[_0x5d04cc(0xfa)]:undefined;if(_0x3a82c9===_0x5d04cc(0xdf))return'MISSING_NAME';if(_0x3a82c9===_0x5d04cc(0xe3)||_0x3a82c9['endsWith'](_0x5d04cc(0xd6))){if(_0x5dc1f6[_0x5d04cc(0xff)]===_0x5d04cc(0xf5)){if(_0x3a82c9===_0x5d04cc(0xe3)||_0x3a82c9[_0x5d04cc(0xd4)](/\.conditions\[\d+\]\.type$/))return _0x5d04cc(0xcc);}}if(_0x3a82c9['endsWith'](_0x5d04cc(0xcb)))return _0x5d04cc(0xcf);if(_0x3a82c9[_0x5d04cc(0xe8)](_0x5d04cc(0xe5)))return _0x5d04cc(0xf4);if(_0x2d627c?.[_0x5d04cc(0xe1)]===_0x5d04cc(0xce))return _0x5d04cc(0xce);if(_0x2d627c?.['validationCode']===_0x5d04cc(0xdd))return _0x5d04cc(0xdd);if(_0x3a82c9[_0x5d04cc(0xe8)](_0x5d04cc(0xbd))||_0x3a82c9==='conditions')return _0x5d04cc(0xc2);if(_0x3a82c9[_0x5d04cc(0xea)](_0x5d04cc(0xc1)))return _0x5d04cc(0x100);if(_0x3a82c9['endsWith'](_0x5d04cc(0xe4)))return'MISSING_SEGMENT_REFERENCE';return _0x5d04cc(0xd1);}function runSemanticChecks(_0x1a1126,_0x5ee573){const _0x5be781=a156_0x467a,_0x2846a8=[];_0x1a1126[_0x5be781(0xeb)]&&_0x2846a8[_0x5be781(0xdb)](...checkRule(_0x1a1126[_0x5be781(0xeb)],_0x5be781(0xeb),_0x5ee573));const _0x38f424=_0x2846a8[_0x5be781(0xbb)](_0x39a01a=>_0x39a01a['level']===_0x5be781(0xd5)),_0x53f828=_0x2846a8[_0x5be781(0xbb)](_0x2e1224=>_0x2e1224[_0x5be781(0xd2)]===_0x5be781(0xde));return{'valid':_0x38f424[_0x5be781(0xf2)]===0x0,'errors':_0x38f424,'warnings':_0x53f828};}function checkRule(_0x4f5396,_0x3a23cb,_0x235f14){const _0x13b77d=a156_0x467a,_0x1cc347=[];if(_0x4f5396[_0x13b77d(0xc9)][_0x13b77d(0xf2)]===0x0)return _0x1cc347['push']({'level':_0x13b77d(0xd5),'path':_0x3a23cb+_0x13b77d(0xbd),'code':_0x13b77d(0xf7),'message':'Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','location':getLocationFromPath(_0x235f14[_0x13b77d(0xd0)],_0x235f14[_0x13b77d(0xd7)],pathToArray(_0x3a23cb+'.conditions'))}),_0x1cc347;return _0x1cc347[_0x13b77d(0xdb)](...checkConditions(_0x4f5396[_0x13b77d(0xc9)],_0x3a23cb,_0x235f14)),_0x1cc347;}function checkConditions(_0x1b1827,_0x57ce25,_0x17146d){const _0x3fbc75=a156_0x467a,_0x2e7677=[];for(let _0x2bd854=0x0;_0x2bd854<_0x1b1827[_0x3fbc75(0xf2)];_0x2bd854++){const _0x5dcbb5=_0x1b1827[_0x2bd854],_0x2b2c95=_0x57ce25+_0x3fbc75(0xda)+_0x2bd854+']';_0x2e7677[_0x3fbc75(0xdb)](...checkCondition(_0x5dcbb5,_0x2b2c95,_0x17146d));}return _0x2e7677;}function checkCondition(_0x3917e9,_0x465f7c,_0x283216){const _0x47cb80=a156_0x467a,_0x388f2b=[];if(_0x3917e9['type']===_0x47cb80(0xd9)||_0x3917e9[_0x47cb80(0xe7)]==='Or'){if(_0x3917e9['conditions'][_0x47cb80(0xf2)]===0x0)_0x388f2b[_0x47cb80(0xdb)]({'level':'error','path':_0x465f7c+'.conditions','code':_0x47cb80(0xf7),'message':_0x3917e9[_0x47cb80(0xe7)]+_0x47cb80(0xb8),'location':getLocationFromPath(_0x283216['document'],_0x283216[_0x47cb80(0xd7)],pathToArray(_0x465f7c+'.conditions'))});else{const _0x543356=_0x3917e9[_0x47cb80(0xe2)]!==undefined;!_0x543356&&_0x388f2b[_0x47cb80(0xdb)]({'level':_0x47cb80(0xde),'path':_0x465f7c,'code':'NESTED_CONDITION_GROUP','message':_0x3917e9[_0x47cb80(0xe7)]+'\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20'+'condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20'+'conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','location':getLocationFromPath(_0x283216[_0x47cb80(0xd0)],_0x283216[_0x47cb80(0xd7)],pathToArray(_0x465f7c))}),_0x388f2b['push'](...checkConditions(_0x3917e9['conditions'],_0x465f7c,_0x283216));}return _0x388f2b;}if(_0x3917e9['type']===_0x47cb80(0xfc)||_0x3917e9[_0x47cb80(0xe7)]==='Behavior'){const _0xf0715a=_0x3917e9,_0x57105e=_0xf0715a[_0x47cb80(0xd7)],_0x5a8e90=_0xf0715a[_0x47cb80(0xd3)],_0x5e3764=_0x57105e||_0x5a8e90;(!_0xf0715a[_0x47cb80(0xe0)]||_0xf0715a[_0x47cb80(0xe0)]==='')&&(!_0x5e3764&&_0x388f2b[_0x47cb80(0xdb)]({'level':'error','path':_0x465f7c+'.attribute','code':_0x47cb80(0xfd),'message':_0x47cb80(0xef),'location':getLocationFromPath(_0x283216['document'],_0x283216[_0x47cb80(0xd7)],pathToArray(_0x465f7c+_0x47cb80(0xc4)))}));_0xf0715a['filter']&&_0x388f2b['push'](...checkRule(_0xf0715a[_0x47cb80(0xbb)],_0x465f7c+_0x47cb80(0xed),_0x283216));if(_0xf0715a[_0x47cb80(0xd7)]){const _0x5cd184=_0xf0715a['attribute']&&_0xf0715a[_0x47cb80(0xe0)]!=='';_0x5cd184&&!_0xf0715a[_0x47cb80(0xbb)]&&_0x388f2b['push']({'level':_0x47cb80(0xd5),'path':_0x465f7c+_0x47cb80(0xb9),'code':_0x47cb80(0xe9),'message':_0x47cb80(0xd8)+_0xf0715a[_0x47cb80(0xd7)]+_0x47cb80(0xf1)+_0xf0715a['attribute']+'\x27\x20'+'requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20'+_0x47cb80(0xc5)+_0x47cb80(0xec),'location':getLocationFromPath(_0x283216[_0x47cb80(0xd0)],_0x283216['source'],pathToArray(_0x465f7c+_0x47cb80(0xb9)))}),_0x5cd184&&_0xf0715a[_0x47cb80(0xbb)]&&_0x388f2b[_0x47cb80(0xdb)]({'level':'warning','path':_0x465f7c+_0x47cb80(0xc4),'code':'BEHAVIOR_SOURCE_WITH_ATTRIBUTE','message':_0x47cb80(0xbf)+_0xf0715a['attribute']+_0x47cb80(0xc8)+_0x47cb80(0xfb),'location':getLocationFromPath(_0x283216[_0x47cb80(0xd0)],_0x283216['source'],pathToArray(_0x465f7c+'.attribute'))});}}return _0x388f2b;}