@treasuredata/tdx 2026.6.2 → 2026.6.4

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 (235) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/cas-command.js +1 -1
  13. package/dist/commands/cas-segment-command.js +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.js +1 -1
  16. package/dist/commands/claude-command.js.map +1 -1
  17. package/dist/commands/claude-statusline-command.js +1 -1
  18. package/dist/commands/claude-usage-command.js +1 -1
  19. package/dist/commands/command.js +1 -1
  20. package/dist/commands/connection-command.js +1 -1
  21. package/dist/commands/databases.js +1 -1
  22. package/dist/commands/delivery-command.js +1 -1
  23. package/dist/commands/describe.js +1 -1
  24. package/dist/commands/engage-campaign-pull-command.js +1 -1
  25. package/dist/commands/engage-campaign-push-command.js +1 -1
  26. package/dist/commands/engage-campaign-validate-command.js +1 -1
  27. package/dist/commands/engage-command.js +1 -1
  28. package/dist/commands/engage-template-pull-command.js +1 -1
  29. package/dist/commands/engage-template-push-command.js +1 -1
  30. package/dist/commands/engage-template-validate-command.js +1 -1
  31. package/dist/commands/job-command.js +1 -1
  32. package/dist/commands/journey-command.js +1 -1
  33. package/dist/commands/journey-validate-command.js +1 -1
  34. package/dist/commands/llm-command.js +1 -1
  35. package/dist/commands/mcp-command.js +1 -1
  36. package/dist/commands/parent-segment-command.js +1 -1
  37. package/dist/commands/policy-command.js +1 -1
  38. package/dist/commands/profile-command.js +1 -1
  39. package/dist/commands/profiles-command.js +1 -1
  40. package/dist/commands/query-command.js +1 -1
  41. package/dist/commands/schedule-command.js +1 -1
  42. package/dist/commands/segment-command.js +1 -1
  43. package/dist/commands/segment-create-command.js +1 -1
  44. package/dist/commands/segment-fields-command.js +1 -1
  45. package/dist/commands/segment-pull-command.js +1 -1
  46. package/dist/commands/segment-push-command.js +1 -1
  47. package/dist/commands/segment-update-command.js +1 -1
  48. package/dist/commands/segment-use-command.js +1 -1
  49. package/dist/commands/segment-validate-command.js +1 -1
  50. package/dist/commands/segments.js +1 -1
  51. package/dist/commands/show.js +1 -1
  52. package/dist/commands/status-command.js +1 -1
  53. package/dist/commands/table-deleted.js +1 -1
  54. package/dist/commands/tables.js +1 -1
  55. package/dist/commands/unset-command.js +1 -1
  56. package/dist/commands/upgrade-command.js +1 -1
  57. package/dist/commands/use-command.js +1 -1
  58. package/dist/commands/user-command.js +1 -1
  59. package/dist/commands/work-command.js +1 -1
  60. package/dist/commands/workflow-command.js +1 -1
  61. package/dist/core/auth.js +1 -1
  62. package/dist/core/command-output.js +1 -1
  63. package/dist/core/config.d.ts +14 -0
  64. package/dist/core/config.d.ts.map +1 -1
  65. package/dist/core/config.js +1 -1
  66. package/dist/core/config.js.map +1 -1
  67. package/dist/core/connection-cache.js +1 -1
  68. package/dist/core/constants.js +1 -1
  69. package/dist/core/credential-cache.js +1 -1
  70. package/dist/core/global-context.js +1 -1
  71. package/dist/core/keychain.js +1 -1
  72. package/dist/core/oauth-keychain.js +1 -1
  73. package/dist/core/oauth.js +1 -1
  74. package/dist/core/profile.js +1 -1
  75. package/dist/core/project-config.d.ts +1 -0
  76. package/dist/core/project-config.d.ts.map +1 -1
  77. package/dist/core/project-config.js +1 -1
  78. package/dist/core/project-config.js.map +1 -1
  79. package/dist/core/session.js +1 -1
  80. package/dist/core/user-cache.js +1 -1
  81. package/dist/core/version.js +1 -1
  82. package/dist/index.js +1 -1
  83. package/dist/mcp/server.js +1 -1
  84. package/dist/mcp/tools/index.js +1 -1
  85. package/dist/mcp/tools/tdx-run.js +1 -1
  86. package/dist/mcp/tools/tdx-search.d.ts.map +1 -1
  87. package/dist/mcp/tools/tdx-search.js +1 -1
  88. package/dist/mcp/tools/tdx-search.js.map +1 -1
  89. package/dist/mcp/tools/work-create-item.js +1 -1
  90. package/dist/mcp/utils.js +1 -1
  91. package/dist/proxy/claude-usage-tracker.js +1 -1
  92. package/dist/proxy/passthrough-server.js +1 -1
  93. package/dist/proxy/sse-usage-parser.js +1 -1
  94. package/dist/sdk/agent/agent-config.js +1 -1
  95. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  96. package/dist/sdk/agent/agent-yaml.js +1 -1
  97. package/dist/sdk/agent/test/evaluator.js +1 -1
  98. package/dist/sdk/agent/test/executor.js +1 -1
  99. package/dist/sdk/agent/test/index.js +1 -1
  100. package/dist/sdk/agent/test/output.js +1 -1
  101. package/dist/sdk/agent/test/parser.js +1 -1
  102. package/dist/sdk/agent/tool-target-registry.js +1 -1
  103. package/dist/sdk/api.js +1 -1
  104. package/dist/sdk/cas/cas-api-client.js +1 -1
  105. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  106. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  107. package/dist/sdk/cas/index.js +1 -1
  108. package/dist/sdk/cas/pull-workflow.js +1 -1
  109. package/dist/sdk/cas/push-workflow.js +1 -1
  110. package/dist/sdk/client/cdp-api-client.js +1 -1
  111. package/dist/sdk/client/delivery-api-client.js +1 -1
  112. package/dist/sdk/client/endpoints.js +1 -1
  113. package/dist/sdk/client/engage-api-client.js +1 -1
  114. package/dist/sdk/client/http-client.js +1 -1
  115. package/dist/sdk/client/llm-api-client.js +1 -1
  116. package/dist/sdk/client/oauth-refresh.js +1 -1
  117. package/dist/sdk/client/rate-limiter.js +1 -1
  118. package/dist/sdk/client/td-api-client.js +1 -1
  119. package/dist/sdk/client/trino-api-client.js +1 -1
  120. package/dist/sdk/client/workflow-client.js +1 -1
  121. package/dist/sdk/connection-validator.js +1 -1
  122. package/dist/sdk/connection.js +1 -1
  123. package/dist/sdk/delivery.js +1 -1
  124. package/dist/sdk/engage/campaign-pull.js +1 -1
  125. package/dist/sdk/engage/campaign-push.js +1 -1
  126. package/dist/sdk/engage/campaign-validator.js +1 -1
  127. package/dist/sdk/engage/campaign-yaml.js +1 -1
  128. package/dist/sdk/engage/template-pull.js +1 -1
  129. package/dist/sdk/engage/template-push.js +1 -1
  130. package/dist/sdk/engage/template-validator.js +1 -1
  131. package/dist/sdk/engage/template-yaml.js +1 -1
  132. package/dist/sdk/engage/types/campaign-def.js +1 -1
  133. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  134. package/dist/sdk/engage/types/template-schema.js +1 -1
  135. package/dist/sdk/engage.js +1 -1
  136. package/dist/sdk/errors.js +1 -1
  137. package/dist/sdk/index.js +1 -1
  138. package/dist/sdk/io/index.js +1 -1
  139. package/dist/sdk/io/node-filesystem.js +1 -1
  140. package/dist/sdk/job.js +1 -1
  141. package/dist/sdk/journey.js +1 -1
  142. package/dist/sdk/llm/chat-cache.js +1 -1
  143. package/dist/sdk/llm/index.js +1 -1
  144. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  145. package/dist/sdk/llm/model-factors.js +1 -1
  146. package/dist/sdk/llm/user-settings.js +1 -1
  147. package/dist/sdk/personalization.js +1 -1
  148. package/dist/sdk/policy.js +1 -1
  149. package/dist/sdk/query/deleted-table-validation.js +1 -1
  150. package/dist/sdk/query/index.js +1 -1
  151. package/dist/sdk/query/sql-parser.js +1 -1
  152. package/dist/sdk/realtime.js +1 -1
  153. package/dist/sdk/schedule.js +1 -1
  154. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  155. package/dist/sdk/segment/fields-display.js +1 -1
  156. package/dist/sdk/segment/file-discovery.js +1 -1
  157. package/dist/sdk/segment/journey-utils.js +1 -1
  158. package/dist/sdk/segment/journey-validator.js +1 -1
  159. package/dist/sdk/segment/journey-yaml.js +1 -1
  160. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  161. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  162. package/dist/sdk/segment/pull-workflow.js +1 -1
  163. package/dist/sdk/segment/push-recovery.js +1 -1
  164. package/dist/sdk/segment/push-workflow.js +1 -1
  165. package/dist/sdk/segment/resolution-context.js +1 -1
  166. package/dist/sdk/segment/segment-path-parser.js +1 -1
  167. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  168. package/dist/sdk/segment/segment-validator.js +1 -1
  169. package/dist/sdk/segment/target-resolution.js +1 -1
  170. package/dist/sdk/segment/tdx-config.js +1 -1
  171. package/dist/sdk/segment/types/activation-schema.js +1 -1
  172. package/dist/sdk/segment/types/journey-def.js +1 -1
  173. package/dist/sdk/segment/types/journey-schema.js +1 -1
  174. package/dist/sdk/segment/types/segment-def.js +1 -1
  175. package/dist/sdk/segment/types/segment-schema.js +1 -1
  176. package/dist/sdk/segment/validate-files.js +1 -1
  177. package/dist/sdk/segment/yaml-validator.js +1 -1
  178. package/dist/sdk/segment.js +1 -1
  179. package/dist/sdk/types/index.js +1 -1
  180. package/dist/sdk/types/progress.js +1 -1
  181. package/dist/sdk/types/workspace.js +1 -1
  182. package/dist/sdk/user.js +1 -1
  183. package/dist/sdk/util/format-detector.js +1 -1
  184. package/dist/sdk/util/formatters.js +1 -1
  185. package/dist/sdk/util/index.js +1 -1
  186. package/dist/sdk/util/paginate.js +1 -1
  187. package/dist/sdk/util/tree-formatter.js +1 -1
  188. package/dist/sdk/workflow/archive-validation.js +1 -1
  189. package/dist/sdk/workflow/clone-workflow.js +1 -1
  190. package/dist/sdk/workflow/index.js +1 -1
  191. package/dist/sdk/workflow/pull-workflow.js +1 -1
  192. package/dist/sdk/workflow/push-workflow.js +1 -1
  193. package/dist/sdk/workflow/task-graph.js +1 -1
  194. package/dist/sdk/workflow/tdx-config.js +1 -1
  195. package/dist/sdk/workflow/workflow-utils.js +1 -1
  196. package/dist/sdk/workspace/access-tracker.js +1 -1
  197. package/dist/sdk/workspace/frontmatter.js +1 -1
  198. package/dist/sdk/workspace/git.js +1 -1
  199. package/dist/sdk/workspace/index.js +1 -1
  200. package/dist/sdk/workspace/templates.js +1 -1
  201. package/dist/sdk/workspace/weekly.js +1 -1
  202. package/dist/sdk/workspace/wikilinks.js +1 -1
  203. package/dist/test-utils/command-runner.js +1 -1
  204. package/dist/test-utils/factories.js +1 -1
  205. package/dist/test-utils/fixtures.js +1 -1
  206. package/dist/test-utils/http-mock.js +1 -1
  207. package/dist/test-utils/index.js +1 -1
  208. package/dist/utils/async.js +1 -1
  209. package/dist/utils/colors.js +1 -1
  210. package/dist/utils/diff.js +1 -1
  211. package/dist/utils/file-permissions.js +1 -1
  212. package/dist/utils/file-reader.js +1 -1
  213. package/dist/utils/github-releases.js +1 -1
  214. package/dist/utils/global-cache.js +1 -1
  215. package/dist/utils/json-loader.js +1 -1
  216. package/dist/utils/local-cache.js +1 -1
  217. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  218. package/dist/utils/logger/formatters/index.js +1 -1
  219. package/dist/utils/logger/handlers/console-handler.js +1 -1
  220. package/dist/utils/logger/handlers/file-handler.js +1 -1
  221. package/dist/utils/logger/handlers/index.js +1 -1
  222. package/dist/utils/logger/handlers/null-handler.js +1 -1
  223. package/dist/utils/logger/index.js +1 -1
  224. package/dist/utils/logger/logger.js +1 -1
  225. package/dist/utils/logger/types.js +1 -1
  226. package/dist/utils/option-validation.js +1 -1
  227. package/dist/utils/process.js +1 -1
  228. package/dist/utils/prompt.js +1 -1
  229. package/dist/utils/spinner.js +1 -1
  230. package/dist/utils/sse-parser.js +1 -1
  231. package/dist/utils/string-utils.js +1 -1
  232. package/dist/utils/table-ref-parser.js +1 -1
  233. package/dist/utils/tdx-logger.js +1 -1
  234. package/dist/utils/version-check.js +1 -1
  235. package/package.json +1 -1
@@ -1 +1 @@
1
- const a155_0x50aee1=a155_0x1494;(function(_0x1196e1,_0x38270e){const _0x115241=a155_0x1494,_0x5dcd61=_0x1196e1();while(!![]){try{const _0x44274f=-parseInt(_0x115241(0x12d))/0x1*(-parseInt(_0x115241(0x135))/0x2)+parseInt(_0x115241(0x95))/0x3+parseInt(_0x115241(0x7b))/0x4+parseInt(_0x115241(0x7e))/0x5*(parseInt(_0x115241(0x16f))/0x6)+parseInt(_0x115241(0xfc))/0x7*(-parseInt(_0x115241(0x83))/0x8)+-parseInt(_0x115241(0x162))/0x9*(-parseInt(_0x115241(0x11b))/0xa)+-parseInt(_0x115241(0x81))/0xb;if(_0x44274f===_0x38270e)break;else _0x5dcd61['push'](_0x5dcd61['shift']());}catch(_0x3b75ce){_0x5dcd61['push'](_0x5dcd61['shift']());}}}(a155_0x383d,0x8b3e6));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a155_0x50aee1(0x163));export const PENDING_SEGMENT_PREFIX=a155_0x50aee1(0x118);export const PENDING_ACTIVATION_PREFIX=a155_0x50aee1(0x175);export function createPendingSegmentId(_0x1da63a){return''+PENDING_SEGMENT_PREFIX+_0x1da63a+'__';}export function isPendingSegmentId(_0x3878af){const _0x4107f2=a155_0x50aee1;return _0x3878af[_0x4107f2(0x146)](PENDING_SEGMENT_PREFIX)&&!_0x3878af['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x46cfdd){const _0x1a825f=a155_0x50aee1;return _0x46cfdd[_0x1a825f(0x131)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x4112d9){return''+PENDING_ACTIVATION_PREFIX+_0x4112d9+'__';}export function isPendingActivationId(_0x307d70){const _0xa0edee=a155_0x50aee1;return _0x307d70[_0xa0edee(0x146)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0xeaba7b){const _0x249164=a155_0x50aee1;return _0xeaba7b[_0x249164(0x131)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x174cbc,_0x290f51){const _0x532c49=a155_0x50aee1,_0x27eee0=_0x174cbc+'::'+(_0x290f51['trim']()||_0x532c49(0xa7)),_0x41ab3c=createHash(_0x532c49(0x158))[_0x532c49(0xd7)](_0x27eee0)['digest'](_0x532c49(0x8d))[_0x532c49(0x8b)](0x0,0xc);return'journey_entry_criteria_'+_0x41ab3c;}export function ensureJourneyDefaults(_0x468d1a){const _0x14c537=a155_0x50aee1;!_0x468d1a['description']&&(_0x468d1a[_0x14c537(0x174)]=''),!_0x468d1a['state']&&(_0x468d1a[_0x14c537(0x17a)]=_0x14c537(0xb5));}export function injectExistingStageIds(_0x5c68ad,_0x4598dd){const _0x47ccd6=a155_0x50aee1,_0x2349a6=new Map(_0x4598dd['map'](_0x5b1d72=>[_0x5b1d72[_0x47ccd6(0xa3)],_0x5b1d72['id']]));for(const _0x4050cd of _0x5c68ad){if(!_0x4050cd['id']){const _0x1a171b=_0x2349a6[_0x47ccd6(0x100)](_0x4050cd[_0x47ccd6(0xa3)]);_0x1a171b&&(_0x4050cd['id']=_0x1a171b);}}}export function resolveTDFolderPath(_0x26c0fe,_0x6739ff,_0x2f3469){const _0x4b578b=a155_0x50aee1;if(!_0x6739ff)return _0x26c0fe;if(_0x26c0fe===_0x2f3469||_0x26c0fe[_0x4b578b(0x146)](_0x2f3469+'/'))return _0x26c0fe;return _0x26c0fe?_0x2f3469+'/'+_0x26c0fe:_0x2f3469;}export function addFoldersToCreate(_0x140aeb,_0x539a1f,_0x30b0a8){const _0x330b04=a155_0x50aee1;if(!_0x140aeb)return;if(_0x539a1f[_0x330b04(0x125)](_0x140aeb))return;const _0x4d6965=_0x140aeb['split']('/');let _0x4ef3bc='';for(const _0x6aa9 of _0x4d6965){_0x4ef3bc=_0x4ef3bc?_0x4ef3bc+'/'+_0x6aa9:_0x6aa9,!_0x539a1f[_0x330b04(0x125)](_0x4ef3bc)&&_0x30b0a8[_0x330b04(0x167)](_0x4ef3bc);}}export function sortFoldersByDepth(_0x1a7af0){const _0x2d0503=a155_0x50aee1;return[..._0x1a7af0][_0x2d0503(0xc4)]((_0x97beda,_0x5925b1)=>{const _0x288d54=_0x2d0503,_0x5966a6=(_0x97beda['match'](/\//g)||[])[_0x288d54(0xd1)],_0x2d446e=(_0x5925b1[_0x288d54(0x11e)](/\//g)||[])[_0x288d54(0xd1)];return _0x5966a6-_0x2d446e;});}import*as a155_0x2b1cb1 from'yaml';import{readFileSync}from'fs';import a155_0x156b1f from'path';import{isJourneyDef,parseYamlString as a155_0x41b119,toYamlString as a155_0x359912,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';function a155_0x383d(){const _0x20e812=['Condition','action','errors','yamlActivation','draft','join','data','logSuccess','includes','parse','createdSegmentIds','waitStepUnit','\x27\x20entry\x20criteria','embedded_activation_created','getSegment\x20failed\x20for\x20','keys','diff','yamlConfig','segment_updated','sort','some','folderPath','relationships','Updating\x20segment\x20\x27','toString','SEGMENT_NOT_FOUND','find','JOURNEY_UPDATE_ERROR','../../utils/async.js','message','debug','Duration','length','behavior','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','nameToType','deleteSegment','validatedRequest','update','getJourney','existingSegments','isNew','absolutePath','journeyActivationStepId','getLatestJourneyId','uniqueServerName','exitCriterias','existingJourney','all','Deleting\x20activation\x20\x27','\x27\x20wait\x20condition','Journey\x20\x27','object','columns','activations','./child-segment-yaml.js','activationStepsById','\x27\x20exit\x20criteria','decision_point','Failed\x20to\x20resolve\x20segment\x20','toISOString','effectiveFolderId','INTERNAL','DecisionPoint','conditionTimeoutUnit','toLowerCase','journeyStages','branches','ACTIVATION_UPDATE_ERROR','steps','uniqueSegmentName','Creating\x20folder\x20\x27','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','Matched\x20server\x20segment\x20\x27','rootFolderId','6219178NUiAOi','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','rule','Segment\x20not\x20found:\x20','get','notification','type','folder_created','journey_creating','segment_creating','idToEmailMap','journeyActivationNameToId','attributes','item','\x27\x20from\x20file:\x20','and\x20the\x20server\x20segment,\x20then\x20retry.','embedded_segment_created','push','Updated\x20segment\x20\x27','createdSegmentId','Delete\x20the\x20push\x20recovery\x20file\x20(',').\x20','activation_template_id','goal','Failed\x20to\x20','Entry\x20criteria:\x20','\x27\x20for\x20','journeyId','__pending_','list','segmentId','470WSpCcc','waitStep','max','match','split','.$1.push-recovery.json','schedule','parseDocument','resolvedRule','index','has','getSegmentEntity\x20also\x20failed\x20for\x20','\x27\x20not\x20found\x20in\x20journey\x20\x27','\x27\x20to\x20local\x20\x27','deleted','progress','listActivations','connection','274121bkhpFY','connector_config','logInfo','stringify','replace','journeyBundleId','entries','JOURNEY_SYNTAX_ERROR','2hAslfg','map','journeyBundleName','conditions','updated','SEGMENT_UPDATE_ERROR','\x0a\x20\x20','connectionIdToNameMap','Segment\x20not\x20found','versionNumber','Failed\x20to\x20resolve\x20activation\x20','Created\x20segment\x20\x27','segment_deleted','parentId','activationsBySegmentId','embeddedSegmentNameToId','segmentNameToId','startsWith','NOT_FOUND','folderId','relative','waitStepType','with','\x27\x20decision\x20point\x20branch\x20\x27','size','all_columns','entry_criteria','folderPathToId','embedded_activation_creating','activation_deleting','idToName','localName','SEGMENT_SYNTAX_ERROR','segments','createFolder','sha1','createJourneySegment','Name\x20has\x20already\x20been\x20taken','milestone','nameToId','Activation\x20not\x20found:\x20','filter','journeyName','delete','utf-8','198972DnrKIU','tdx.sdk.push-workflow','from','Fetching\x20','hasChanges','add','journeyBundlesByFolderAndName','dirname','fetchJourney','Creating\x20activation\x20\x27','\x20(referenced\x20in\x20journey\x20','WaitStep','created','176532PkfFva','logWarning','getSegmentEntity','journey_updating','\x20journey\x20from\x20file:\x20','description','__pending_act_','activation_created','entryCriteria','embedded_segment_creating','stages','state','segment_updating','activationParams','getActivation','resolveSegment','journey_created','values','segmentByFolderAndName','activation_deleted','flatMap','ACTIVATION_SYNTAX_ERROR','3399028BGiaVk','\x27...','set','5ZhdtBz','Created\x20activation\x20\x27','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','11852170gvueRA','segment_created','8ixlWEC','journey','Created\x20folder\x20\x27','Activation','create','existingActivation','parentFolder','Deleted\x20activation\x20\x27','slice','conditionTimeoutDuration','hex','segmentFolderId','createActivation','activationActions','Updated\x20journey\x20\x27','journeys','resolveJourneyId','logDeleted','1031670SssANQ','Embedded\x20segment\x20\x27','valid','journey_updated',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','folder_creating','goal\x20criteria','onProgress','Failed\x20to\x20fetch\x20referenced\x20segment\x20','\x27\x20milestone','conditionSegmentId','activation_','updateSegmentById','run_after_journey_refresh','name','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','./journey-yaml.js','reduce','segment','withProgress','isArray','existingSegment','journeyById','unchanged','stage\x20\x27','activationContext','deps','verbose'];a155_0x383d=function(){return _0x20e812;};return a155_0x383d();}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(_0x4e5f7c){const _0x547cfd=a155_0x50aee1;if(Array[_0x547cfd(0xa9)](_0x4e5f7c))return'['+_0x4e5f7c['map'](_0x4f6370=>stableStringify(_0x4f6370))['join'](',')+']';if(_0x4e5f7c&&typeof _0x4e5f7c===_0x547cfd(0xe5)){const _0x18a566=_0x4e5f7c,_0x4873db=Object[_0x547cfd(0xc0)](_0x18a566)[_0x547cfd(0xc4)](),_0x1a92ff=_0x4873db[_0x547cfd(0x136)](_0x56006a=>'\x22'+_0x56006a+'\x22:'+stableStringify(_0x18a566[_0x56006a]));return'{'+_0x1a92ff[_0x547cfd(0xb6)](',')+'}';}const _0x2b7f56=JSON[_0x547cfd(0x130)](_0x4e5f7c);return _0x2b7f56===undefined?'null':_0x2b7f56;}function activationSignature(_0xfa716b){const _0x135b72=a155_0x50aee1,_0x4c7c26={'connection':_0xfa716b['connection'],..._0xfa716b[_0x135b72(0x14e)]!==undefined&&{'all_columns':_0xfa716b[_0x135b72(0x14e)]},..._0xfa716b[_0x135b72(0xe6)]!==undefined&&{'columns':_0xfa716b[_0x135b72(0xe6)]},..._0xfa716b[_0x135b72(0xd2)]!==undefined&&{'behavior':_0xfa716b[_0x135b72(0xd2)]},..._0xfa716b[_0x135b72(0x121)]!==undefined&&{'schedule':_0xfa716b[_0x135b72(0x121)]},..._0xfa716b[_0x135b72(0x101)]!==undefined&&{'notification':_0xfa716b[_0x135b72(0x101)]},..._0xfa716b['connector_config']!==undefined&&{'connector_config':_0xfa716b[_0x135b72(0x12e)]},..._0xfa716b[_0x135b72(0x112)]!==undefined&&{'activation_template_id':_0xfa716b[_0x135b72(0x112)]}};return stableStringify(_0x4c7c26);}function a155_0x1494(_0x3bca8c,_0x248c4b){_0x3bca8c=_0x3bca8c-0x77;const _0x383d3a=a155_0x383d();let _0x14942b=_0x383d3a[_0x3bca8c];return _0x14942b;}async function fetchSegment(_0x4f3275,_0x5b148f,_0x541f29,_0x14e6af){const _0x47daf2=a155_0x50aee1,_0xb639e0=_0x14e6af?.[_0x47daf2(0xcb)](_0x2caa68=>_0x2caa68['id']===_0x541f29);if(_0xb639e0)return _0xb639e0;try{return await _0x4f3275[_0x47daf2(0xa7)]['getSegment'](_0x5b148f,_0x541f29);}catch(_0xdd6cfc){logger[_0x47daf2(0xcf)](_0x47daf2(0xbf)+_0x541f29+_0x47daf2(0x99)+_0xdd6cfc);try{return await _0x4f3275[_0x47daf2(0xa7)][_0x47daf2(0x171)](_0x541f29);}catch(_0x2f4273){return logger[_0x47daf2(0xcf)](_0x47daf2(0x126)+_0x541f29+':\x20'+_0x2f4273),null;}}}function recoverSegmentIdsFromPushRecovery(_0x485885,_0x543577,_0x4a6109){const _0x5cc31f=a155_0x50aee1,_0x3a5618=readPushRecovery(_0x485885[_0x5cc31f(0xdb)]);if(_0x3a5618?.[_0x5cc31f(0x15f)]===_0x485885[_0x5cc31f(0xc2)][_0x5cc31f(0xa3)])for(const [_0x1494ff,_0x882791]of Object[_0x5cc31f(0x133)](_0x3a5618['segments'])){const _0x2fe42f=generateDeterministicJourneySegmentName(_0x485885[_0x5cc31f(0xc2)][_0x5cc31f(0xa3)],_0x1494ff);_0x882791['uniqueServerName']===_0x2fe42f&&(_0x543577[_0x5cc31f(0x7d)](_0x1494ff,_0x882791[_0x5cc31f(0x11a)]),_0x4a6109[_0x5cc31f(0x7d)](_0x1494ff,_0x882791['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x210ebe,_0xfcf7ba,_0x1349f8,_0x1eb141){const _0x248385=a155_0x50aee1;let _0x228aaa;try{_0x228aaa=await _0x210ebe[_0x248385(0xa7)][_0x248385(0x159)]({'name':_0x1349f8[_0x248385(0xf7)],'description':_0x1349f8[_0x248385(0x174)],'journeyId':_0x1349f8['journeyId'],'rule':_0x1eb141(_0x1349f8[_0x248385(0x123)],!![]),'countPopulation':!![],'parentFolderId':_0x1349f8['folderId'],'audienceId':_0x1349f8[_0x248385(0x142)]});}catch(_0xdd8561){const _0x276634=_0xdd8561 instanceof Error&&_0xdd8561[_0x248385(0xce)][_0x248385(0xb9)](_0x248385(0x15a));if(_0x276634){const _0x52a676=readPushRecovery(_0xfcf7ba[_0x248385(0xdb)]),_0x765795=_0x52a676?.[_0x248385(0x15f)]===_0xfcf7ba[_0x248385(0xc2)][_0x248385(0xa3)]?_0x52a676[_0x248385(0x156)][_0x1349f8[_0x248385(0x154)]]:undefined;if(_0x765795?.[_0x248385(0xde)]===_0x1349f8['uniqueSegmentName'])await _0x210ebe[_0x248385(0xa7)][_0x248385(0xa1)](_0x1349f8[_0x248385(0x142)],_0x765795['segmentId'],{'description':_0x1349f8[_0x248385(0x174)],'rule':_0x1eb141(_0x1349f8[_0x248385(0x123)],!![]),'countPopulation':!![]}),_0x228aaa=_0x765795['segmentId'];else throw new SDKError(ErrorCode[_0x248385(0x13a)],_0x248385(0x96)+_0x1349f8[_0x248385(0x154)]+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+(_0x248385(0x110)+_0xfcf7ba[_0x248385(0xdb)][_0x248385(0x131)](/([^/]+)$/,_0x248385(0x120))+')\x20')+_0x248385(0x10b),_0xdd8561);}else throw _0xdd8561;}return saveSegmentToPushRecovery(_0xfcf7ba[_0x248385(0xdb)],_0xfcf7ba[_0x248385(0xc2)][_0x248385(0xa3)],_0x1349f8['localName'],{'segmentId':_0x228aaa,'uniqueServerName':_0x1349f8[_0x248385(0xf7)],'createdAt':new Date()['toISOString']()}),_0x228aaa;}export async function prepareSegmentFiles(_0x20dcc5,_0x21c2a4,_0x3030bd,_0x16d711,_0x281b7c){const _0x1f1c85=a155_0x50aee1,{activationDefToCreateRequest:_0x49fd86}=await import('./child-segment-yaml.js'),_0x25dd25=[],_0x17191a=new Set();for(const {yamlConfig:_0x4743ee,folderPath:_0x5591ab,sourcePath:_0x13a424}of _0x20dcc5){const _0xb557fe=resolveTDFolderPath(_0x5591ab,_0x16d711,_0x281b7c),_0x7ec1eb=_0xb557fe+':'+_0x4743ee['name'],_0x1c3e9d=_0x21c2a4[_0x1f1c85(0x77)][_0x1f1c85(0x100)](_0x7ec1eb),_0x3928e0=_0x1c3e9d?_0x21c2a4[_0x1f1c85(0x143)][_0x1f1c85(0x100)](_0x1c3e9d['id'])||[]:[];addFoldersToCreate(_0xb557fe,_0x21c2a4[_0x1f1c85(0x150)],_0x17191a);const _0x465243=calculateActivationActions(_0x4743ee[_0x1f1c85(0xe7)]||[],_0x3928e0,_0x21c2a4['idToEmailMap'],_0x21c2a4['connectionIdToNameMap']);for(const _0x193d16 of _0x465243){(_0x193d16[_0x1f1c85(0x102)]===_0x1f1c85(0x87)||_0x193d16[_0x1f1c85(0x102)]===_0x1f1c85(0xd7))&&_0x193d16[_0x1f1c85(0xb4)]&&(_0x193d16['validatedRequest']=await _0x49fd86(_0x193d16[_0x1f1c85(0xb4)],_0x3030bd));}const _0x13e7b5=calculateSegmentDiff(_0x4743ee,_0x1c3e9d,_0x3928e0,_0x21c2a4[_0x1f1c85(0x106)],_0x21c2a4[_0x1f1c85(0x13c)]);_0x25dd25[_0x1f1c85(0x10d)]({'relativePath':_0x4743ee[_0x1f1c85(0xa3)],'absolutePath':_0x13a424,'yamlConfig':_0x4743ee,'folderPath':_0xb557fe,'existingSegment':_0x1c3e9d,'existingActivations':_0x3928e0,'isNew':_0x13e7b5['isNew'],'hasChanges':_0x13e7b5['hasChanges'],'diff':_0x13e7b5[_0x1f1c85(0xc1)],'activationActions':_0x465243});}return{'segmentFiles':_0x25dd25,'foldersToCreate':_0x17191a};}export async function prepareJourneyFiles(_0x5bf83c,_0xdbc9f9,_0x3421af,_0x44a1af){const _0x213e0a=a155_0x50aee1,_0x437500=[],_0x231426=new Set();for(const {yamlConfig:_0x3cbb4f,folderPath:_0x3e8a16,sourcePath:_0x5130fe}of _0x5bf83c){const _0x11ea56=resolveTDFolderPath(_0x3e8a16,_0x3421af,_0x44a1af),_0x398c8e=_0x11ea56+':'+_0x3cbb4f[_0x213e0a(0xa3)],_0x1c3e38=_0xdbc9f9[_0x213e0a(0x168)][_0x213e0a(0x100)](_0x398c8e);let _0x58ab3c,_0x25fd28;if(_0x1c3e38&&_0x1c3e38[_0x213e0a(0xd1)]>0x0){const _0x51bb65=buildLocalExpandedRuleMappings(_0x3cbb4f),{createYamlContext:_0x2af5c3,prefetchJourneySegments:_0x36a382}=createPushYamlContextForBundle(_0xdbc9f9['deps'],_0xdbc9f9['parentId'],_0xdbc9f9[_0x213e0a(0xd9)],_0x51bb65,_0xdbc9f9[_0x213e0a(0x106)],_0xdbc9f9['connectionIdToNameMap'],_0xdbc9f9[_0x213e0a(0xe9)],_0xdbc9f9['journeyById']);await _0x36a382(_0x1c3e38[_0x213e0a(0x136)](_0x24ff93=>_0x24ff93['id']));const _0x4ee2ce=await _0xdbc9f9[_0x213e0a(0xaf)]['journey'][_0x213e0a(0xdd)](_0x1c3e38[0x0][_0x213e0a(0x132)]),_0x45ddca=hasMultipleVersions(_0x3cbb4f),_0x52172f=async _0xd18e22=>{const _0x394b88=_0x213e0a,_0x59af78=_0xdbc9f9[_0x394b88(0xab)]?.[_0x394b88(0x100)](_0xd18e22);if(_0x59af78)return _0x59af78;return _0xdbc9f9[_0x394b88(0x16a)]({'journeyId':_0xd18e22,'journeyName':_0x3cbb4f['name'],'isMultiVersion':_0x1c3e38[_0x394b88(0xd1)]>0x1});};if(_0x45ddca&&_0x1c3e38['length']>0x1){const _0x58ae41=[];for(const _0x322e9f of _0x1c3e38){const _0x5f6e54=_0x322e9f['versionNumber']||0x1;_0xdbc9f9['progress']?.['update'](_0x213e0a(0x165)+_0x3cbb4f[_0x213e0a(0xa3)]+'\x20v'+_0x5f6e54);const _0x149c8f=await _0x52172f(_0x322e9f['id']),_0x36be9a=_0x2af5c3(_0x322e9f['id']),_0x5568dc=await journeyResponseToDef(_0x149c8f,_0x36be9a);_0x58ae41[_0x213e0a(0x10d)]({'item':_0x322e9f,'yaml':_0x5568dc});}const _0x473e98=buildLocalRuleToNameMappingFromJourney(_0x3cbb4f);_0x25fd28=buildMergedJourneyDef(_0x58ae41,_0x473e98,_0x4ee2ce);const _0x63e2b3=Math[_0x213e0a(0x11d)](..._0x58ae41['map'](_0x308d0b=>_0x308d0b[_0x213e0a(0x109)]['versionNumber']||0x0)),_0x3aea8c=_0x1c3e38[_0x213e0a(0xcb)](_0x4f8b92=>(_0x4f8b92['versionNumber']||0x0)===_0x63e2b3);_0x3aea8c&&(_0xdbc9f9[_0x213e0a(0x12a)]?.[_0x213e0a(0xd7)]('Fetching\x20'+_0x3cbb4f[_0x213e0a(0xa3)]+'\x20v'+_0x63e2b3),_0x58ab3c=await _0x52172f(_0x3aea8c['id']));}else{const _0x407e32=_0x1c3e38[_0x1c3e38[_0x213e0a(0xd1)]-0x1];_0xdbc9f9[_0x213e0a(0x12a)]?.[_0x213e0a(0xd7)](_0x213e0a(0x165)+_0x3cbb4f[_0x213e0a(0xa3)]),_0x58ab3c=await _0x52172f(_0x407e32['id']);const _0x505d9d=_0x2af5c3(_0x407e32['id']),_0x4eab5a=await journeyResponseToDef(_0x58ab3c,_0x505d9d),_0xd0c230=buildLocalRuleToNameMappingFromJourney(_0x3cbb4f);_0x25fd28=buildMergedJourneyDef([{'item':_0x407e32,'yaml':_0x4eab5a}],_0xd0c230,_0x4ee2ce);}}addFoldersToCreate(_0x11ea56,_0xdbc9f9[_0x213e0a(0x150)],_0x231426);const _0x496f08=calculateJourneyDiff(_0x3cbb4f,_0x25fd28);_0x437500['push']({'relativePath':_0x3cbb4f[_0x213e0a(0xa3)],'absolutePath':_0x5130fe,'yamlConfig':_0x3cbb4f,'folderPath':_0x11ea56,'existingJourney':_0x58ab3c,'isNew':_0x496f08[_0x213e0a(0xda)],'hasChanges':_0x496f08[_0x213e0a(0x166)],'diff':_0x496f08[_0x213e0a(0xc1)]});}return{'journeyFiles':_0x437500,'foldersToCreate':_0x231426};}export function calculateActivationActions(_0x380762,_0x42d2a9,_0x252b60,_0x43626e){const _0x58c760=a155_0x50aee1,_0x5a7f1f=[],_0x2f62e6=new Map();for(const _0x5d2bf6 of _0x42d2a9){_0x2f62e6[_0x58c760(0x7d)](_0x5d2bf6['name'],_0x5d2bf6);}const _0x3c5455=new Map();for(const _0x3558b2 of _0x380762){_0x3c5455[_0x58c760(0x7d)](_0x3558b2[_0x58c760(0xa3)],_0x3558b2);}for(const _0x5051e1 of _0x380762){const _0x1e1fb5=_0x2f62e6[_0x58c760(0x100)](_0x5051e1[_0x58c760(0xa3)]);if(!_0x1e1fb5)_0x5a7f1f[_0x58c760(0x10d)]({'type':_0x58c760(0x87),'name':_0x5051e1[_0x58c760(0xa3)],'yamlActivation':_0x5051e1});else{const _0x20b055=activationResponseToDef(_0x1e1fb5,_0x252b60,_0x43626e),_0x3e8ae5=a155_0x2b1cb1[_0x58c760(0x130)](_0x20b055),_0x4965eb=a155_0x2b1cb1[_0x58c760(0x130)](_0x5051e1);_0x3e8ae5!==_0x4965eb&&_0x5a7f1f['push']({'type':_0x58c760(0xd7),'name':_0x5051e1[_0x58c760(0xa3)],'yamlActivation':_0x5051e1,'existingActivation':_0x1e1fb5});}}for(const _0x2b2d8c of _0x42d2a9){!_0x3c5455[_0x58c760(0x125)](_0x2b2d8c[_0x58c760(0xa3)])&&_0x5a7f1f['push']({'type':_0x58c760(0x160),'name':_0x2b2d8c[_0x58c760(0xa3)],'existingActivation':_0x2b2d8c});}return _0x5a7f1f;}function calculateYamlDiff(_0x44b5db,_0x5970a2){if(_0x5970a2){const _0x44d127=generateDiff(_0x5970a2,_0x44b5db),_0x231f8b=hasChanges(_0x44d127);return{'isNew':![],'hasChanges':_0x231f8b,'diff':_0x231f8b?formatDiffWithColors(_0x44d127):undefined};}const _0x5e30d6=generateDiff('',_0x44b5db);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x5e30d6)};}export function calculateSegmentDiff(_0x4937bf,_0x2c72fe,_0x10a89c,_0x44afc0,_0x34853d){const _0x4051a6=segmentToYamlString(_0x4937bf),_0x269e46=_0x2c72fe?segmentToYamlString(segmentWithActivationsToYaml(_0x2c72fe,_0x10a89c,undefined,_0x44afc0,_0x34853d)):undefined;return calculateYamlDiff(_0x4051a6,_0x269e46);}export function calculateJourneyDiff(_0x1ee8e6,_0x3797eb){const _0x655024=normalizeJourneyDef(_0x1ee8e6,_0x1ee8e6),_0x522a7a=a155_0x359912(_0x655024),_0x3373c9=_0x3797eb?a155_0x359912(normalizeJourneyDef(_0x3797eb,_0x1ee8e6)):undefined;return calculateYamlDiff(_0x522a7a,_0x3373c9);}export function findSegmentsToDelete(_0xbaca7d,_0x24a21b,_0x46bb9a,_0x178e75,_0x4fcbd6){const _0x373e17=a155_0x50aee1,_0x4850f8=new Set();for(const {yamlConfig:_0x273e03,folderPath:_0x533db7}of _0x24a21b){_0x4850f8[_0x373e17(0x167)](_0x533db7+':'+_0x273e03[_0x373e17(0xa3)]);}return _0xbaca7d[_0x373e17(0x15e)](_0x516c30=>{const _0x259dd3=_0x373e17,_0x3dcf55=_0x516c30[_0x259dd3(0x8e)]?_0x46bb9a[_0x259dd3(0x100)](_0x516c30[_0x259dd3(0x8e)][_0x259dd3(0xc9)]())||'':'',_0x4cbbf8=_0x3dcf55+':'+_0x516c30[_0x259dd3(0xa3)];if(_0x4850f8['has'](_0x4cbbf8))return![];if(_0x4fcbd6)return _0x3dcf55===_0x178e75||_0x3dcf55[_0x259dd3(0x146)](_0x178e75+'/');return!![];});}export function findJourneysToDelete(_0xeb6a0e,_0x1db81d,_0x3e4412,_0x593255,_0x909eb9){const _0x4cb2b8=a155_0x50aee1,_0x2ffcbb=new Set();for(const {yamlConfig:_0x88cefe,folderPath:_0x4319a1}of _0x1db81d){_0x2ffcbb[_0x4cb2b8(0x167)](_0x4319a1+':'+_0x88cefe[_0x4cb2b8(0xa3)]);}return _0xeb6a0e[_0x4cb2b8(0x15e)](_0x20ab50=>{const _0x446c5d=_0x4cb2b8,_0x11786c=_0x20ab50[_0x446c5d(0x148)]?_0x3e4412[_0x446c5d(0x100)](_0x20ab50[_0x446c5d(0x148)])||'':'',_0x3ad103=_0x11786c+':'+_0x20ab50['journeyBundleName'];if(_0x2ffcbb['has'](_0x3ad103))return![];if(_0x909eb9)return _0x11786c===_0x593255||_0x11786c[_0x446c5d(0x146)](_0x593255+'/');return!![];});}export function buildSegmentLookupMap(_0x5ae78a,_0x417084){const _0x255537=a155_0x50aee1,_0x1e2b37=new Map();for(const _0x515a9 of _0x5ae78a){const _0x128914=_0x515a9[_0x255537(0x8e)]?_0x417084['get'](_0x515a9[_0x255537(0x8e)][_0x255537(0xc9)]())||'':'',_0x482a0e=_0x128914+':'+_0x515a9[_0x255537(0xa3)];_0x1e2b37['set'](_0x482a0e,_0x515a9);}return _0x1e2b37;}export function buildSegmentNameToIdMap(_0x1314ac){const _0x2e5c04=a155_0x50aee1,_0x370602=new Map();for(const _0x129f1b of _0x1314ac){_0x370602[_0x2e5c04(0x7d)](_0x129f1b[_0x2e5c04(0xa3)],_0x129f1b['id']);}return _0x370602;}export function buildJourneyBundleLookupMap(_0x4f1d15,_0x35656d){const _0x5183e4=a155_0x50aee1,_0x172424=new Map();for(const _0x7a877a of _0x4f1d15){const _0x2eec36=_0x7a877a[_0x5183e4(0x148)]?_0x35656d[_0x5183e4(0x100)](_0x7a877a[_0x5183e4(0x148)])||'':'',_0x5d2f5b=_0x2eec36+':'+_0x7a877a['journeyBundleName'];!_0x172424[_0x5183e4(0x125)](_0x5d2f5b)&&_0x172424[_0x5183e4(0x7d)](_0x5d2f5b,[]),_0x172424[_0x5183e4(0x100)](_0x5d2f5b)[_0x5183e4(0x10d)](_0x7a877a);}for(const _0x3e80a5 of _0x172424[_0x5183e4(0x180)]()){_0x3e80a5[_0x5183e4(0xc4)]((_0x5571b6,_0x4c4b9d)=>(_0x5571b6[_0x5183e4(0x13e)]||0x0)-(_0x4c4b9d['versionNumber']||0x0));}return _0x172424;}export function collectFoldersToCreate(_0x4bc4fe,_0x4c2330){const _0x35555b=a155_0x50aee1,_0x18bed1=new Set();for(const _0xf2933b of _0x4bc4fe){if(!_0xf2933b)continue;if(_0x4c2330['has'](_0xf2933b))continue;const _0xf2237e=_0xf2933b[_0x35555b(0x11f)]('/');let _0x51ea3d='';for(const _0x16a032 of _0xf2237e){_0x51ea3d=_0x51ea3d?_0x51ea3d+'/'+_0x16a032:_0x16a032,!_0x4c2330[_0x35555b(0x125)](_0x51ea3d)&&_0x18bed1[_0x35555b(0x167)](_0x51ea3d);}}return _0x18bed1;}export function parseAndClassifyYamlFiles(_0x3c502c,_0x4ebac6,_0x29e1fa){const _0x5ed937=a155_0x50aee1,_0x18532d=[],_0x37ef07=[];for(const _0x46a073 of _0x3c502c){const _0x13f20b=a155_0x156b1f[_0x5ed937(0x149)](_0x4ebac6,a155_0x156b1f[_0x5ed937(0x169)](_0x46a073)),_0x27ca91=_0x13f20b==='.'?'':_0x13f20b['replace'](/\\/g,'/'),_0x187e93=readFileSync(_0x46a073,_0x5ed937(0x161)),_0x40291e=a155_0x2b1cb1[_0x5ed937(0xba)](_0x187e93);if(isJourneyDef(_0x40291e)){const _0x44425a=a155_0x41b119(_0x187e93);_0x37ef07[_0x5ed937(0x10d)]({'yamlConfig':_0x44425a,'folderPath':_0x27ca91,'sourcePath':_0x46a073});}else{if(!_0x29e1fa?.['skipSegments']){const _0x114d5c=parseSegmentYamlFile(_0x187e93),_0x1c0532=normalizeChildSegmentYaml(_0x114d5c);_0x18532d[_0x5ed937(0x10d)]({'yamlConfig':_0x1c0532,'folderPath':_0x27ca91,'sourcePath':_0x46a073});}}}return{'segments':_0x18532d,'journeys':_0x37ef07};}export function validateParsedFiles(_0x4dc75c,_0x1bf8b6){const _0x43003c=a155_0x50aee1,_0x511215=[];for(const {yamlConfig:_0x5686c0,sourcePath:_0x3d81b3}of _0x4dc75c[_0x43003c(0x156)]){const _0x47f214=readFileSync(_0x3d81b3,_0x43003c(0x161)),_0x27c33f=a155_0x2b1cb1[_0x43003c(0x122)](_0x47f214),_0x1c8278=validateSegmentDef(_0x5686c0,{'source':_0x47f214,'document':_0x27c33f},{'skipSchema':!![]});if(!_0x1c8278[_0x43003c(0x97)]){const _0x2bad7e=a155_0x156b1f[_0x43003c(0x149)](_0x1bf8b6,_0x3d81b3);_0x511215[_0x43003c(0x10d)]({'filePath':_0x2bad7e,'source':_0x47f214,'result':_0x1c8278,'isJourney':![]});}}for(const {yamlConfig:_0x2eb122,sourcePath:_0x1d0a66}of _0x4dc75c['journeys']){const _0x1bb9db=readFileSync(_0x1d0a66,_0x43003c(0x161)),_0xcfd8b4=a155_0x2b1cb1[_0x43003c(0x122)](_0x1bb9db),_0x34aabd=validateJourneyDef(_0x2eb122,{'source':_0x1bb9db,'document':_0xcfd8b4},{'skipSchema':!![]});if(!_0x34aabd[_0x43003c(0x97)]){const _0x25aac4=a155_0x156b1f['relative'](_0x1bf8b6,_0x1d0a66);_0x511215[_0x43003c(0x10d)]({'filePath':_0x25aac4,'source':_0x1bb9db,'result':_0x34aabd,'isJourney':!![]});}}return _0x511215;}export function formatValidationErrors(_0x1262b8){const _0x3f2c1f=a155_0x50aee1,_0x147970=[];for(const {filePath:_0x5d3241,source:_0x249772,result:_0x858520,isJourney:_0xc2cd4f}of _0x1262b8){const _0x31177c=_0xc2cd4f?_0x3f2c1f(0x84):'segment';_0x147970[_0x3f2c1f(0x10d)]('\x0a'+_0x5d3241+'\x20('+_0x31177c+'):\x20'+_0x858520[_0x3f2c1f(0xb3)][_0x3f2c1f(0xd1)]+'\x20error(s)'),_0x147970[_0x3f2c1f(0x10d)](formatValidationResult(_0x858520,_0x249772,_0x5d3241));}return _0x147970[_0x3f2c1f(0xb6)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x43027f){const _0x248d97=a155_0x50aee1,_0xfb019c=new Set(),_0x3ae564=new Map(),_0x511f0b=collectSegmentUsageCounts(_0x43027f);if(_0x43027f[_0x248d97(0x156)])for(const [_0x55e8a7,_0x54194c]of Object[_0x248d97(0x133)](_0x43027f[_0x248d97(0x156)])){_0xfb019c[_0x248d97(0x167)](_0x55e8a7);if(_0x54194c[_0x248d97(0xfe)]){const _0xb3ccf7=yamlRuleToApi(_0x54194c[_0x248d97(0xfe)]),_0x4477a4=apiRuleToYaml(_0xb3ccf7);_0x3ae564[_0x248d97(0x7d)](_0x55e8a7,_0x4477a4);}}const _0x22ca13=new Map();let _0x2b0048=0x0;for(const [_0x54ba10,_0x2d691a]of _0x3ae564){const _0x317ee0=serializeExpandedRule(_0x2d691a,_0x3ae564),_0x34c350=_0x22ca13[_0x248d97(0x100)](_0x317ee0)||[];_0x34c350[_0x248d97(0x10d)]({'name':_0x54ba10,'index':_0x2b0048}),_0x22ca13[_0x248d97(0x7d)](_0x317ee0,_0x34c350),_0x2b0048++;}const _0x3f302d=new Map();for(const [_0x468d1c,_0x405352]of _0x22ca13){const _0x7ddafb=_0x405352['slice']()[_0x248d97(0xc4)]((_0x59aee5,_0x159b26)=>{const _0x34c6b7=_0x248d97,_0xc11e7a=_0x511f0b[_0x34c6b7(0x100)](_0x59aee5['name'])||0x0,_0x18e616=_0x511f0b[_0x34c6b7(0x100)](_0x159b26['name'])||0x0;if(_0xc11e7a!==_0x18e616)return _0x18e616-_0xc11e7a;return _0x59aee5[_0x34c6b7(0x124)]-_0x159b26[_0x34c6b7(0x124)];})[_0x248d97(0x136)](_0x3fc4f4=>_0x3fc4f4[_0x248d97(0xa3)]),_0x186f38=[];for(const _0x5550fb of _0x7ddafb){const _0x48c578=_0x511f0b[_0x248d97(0x100)](_0x5550fb)||0x0,_0x250f2e=Math['max'](_0x48c578,0x1);for(let _0x449294=0x0;_0x449294<_0x250f2e;_0x449294++){_0x186f38['push'](_0x5550fb);}}_0x3f302d[_0x248d97(0x7d)](_0x468d1c,_0x186f38);}return{'existingLocalSegmentNames':_0xfb019c,'localSegmentRules':_0x3ae564,'localExpandedRuleToNames':_0x3f302d};}export function createSegmentIdResolver(_0x59b06a,_0x3aee7b){return async _0x532100=>{const _0x52e4e2=a155_0x1494,_0x3bbbc8=_0x59b06a[_0x52e4e2(0x100)](_0x532100);if(!_0x3bbbc8)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x52e4e2(0xff)+_0x532100+_0x52e4e2(0x80)+_0x3aee7b+'\x27)');return _0x3bbbc8;};}export function extractRootFolderId(_0x35dee5){const _0x10797c=a155_0x50aee1;return _0x35dee5[_0x10797c(0xc7)]?.['parentSegmentFolder']?.[_0x10797c(0xb7)]?.['id']||_0x35dee5[_0x10797c(0xc7)]?.[_0x10797c(0x89)]?.[_0x10797c(0xb7)]?.['id'];}export function buildConnectionMaps(_0x4f38bf){const _0x55bcd3=a155_0x50aee1,_0x120911=new Map(),_0x18b56d=new Map(),_0x105561=new Map();for(const _0x1bbb89 of _0x4f38bf){_0x120911[_0x55bcd3(0x7d)](_0x1bbb89['name'],parseInt(_0x1bbb89['id'],0xa)),_0x18b56d[_0x55bcd3(0x7d)](_0x1bbb89['id'],_0x1bbb89[_0x55bcd3(0xa3)]),_0x105561[_0x55bcd3(0x7d)](_0x1bbb89[_0x55bcd3(0xa3)],_0x1bbb89[_0x55bcd3(0x102)]);}return{'nameToId':_0x120911,'idToName':_0x18b56d,'nameToType':_0x105561};}export function calculatePushStats(_0x1710b8,_0x58a952,_0x3644ad,_0x124830,_0x597ad4,_0xa0d640,_0x1e947e){const _0x37c555=a155_0x50aee1,_0x11ee02=_0x1710b8[_0x37c555(0x15e)](_0x22d112=>_0x22d112['isNew']),_0x226177=_0x1710b8[_0x37c555(0x15e)](_0x34d17a=>!_0x34d17a[_0x37c555(0xda)]&&_0x34d17a[_0x37c555(0x166)]),_0x153752=_0x1710b8[_0x37c555(0x15e)](_0x51e60b=>!_0x51e60b['isNew']&&!_0x51e60b[_0x37c555(0x166)]),_0x19a49e=_0xa0d640?_0x124830:[],_0x538cae=_0x58a952[_0x37c555(0x15e)](_0x14c5e6=>_0x14c5e6[_0x37c555(0xda)]),_0x487ad3=_0x58a952[_0x37c555(0x15e)](_0x50b4a3=>!_0x50b4a3[_0x37c555(0xda)]&&_0x50b4a3[_0x37c555(0x166)]),_0x3428bf=_0x58a952[_0x37c555(0x15e)](_0x49dbb7=>!_0x49dbb7[_0x37c555(0xda)]&&!_0x49dbb7[_0x37c555(0x166)]),_0x3354ee=_0xa0d640?_0x597ad4:[],_0x5e9e5e=_0x1710b8[_0x37c555(0x79)](_0x26a59a=>_0x26a59a[_0x37c555(0x90)]),_0x2623c1=_0x5e9e5e['filter'](_0x21c6f2=>_0x21c6f2[_0x37c555(0x102)]===_0x37c555(0x87)),_0x1dbb05=_0x5e9e5e['filter'](_0x176c15=>_0x176c15[_0x37c555(0x102)]===_0x37c555(0xd7)),_0x37aa1a=_0x5e9e5e[_0x37c555(0x15e)](_0x515c25=>_0x515c25[_0x37c555(0x102)]==='delete'),_0x22873d=Array[_0x37c555(0x164)](_0x3644ad)[_0x37c555(0xc4)](),_0x4213d3=_0x1e947e?![]:_0x11ee02[_0x37c555(0xd1)]>0x0||_0x226177[_0x37c555(0xd1)]>0x0||_0x19a49e[_0x37c555(0xd1)]>0x0,_0x496e85=_0x538cae[_0x37c555(0xd1)]>0x0||_0x487ad3[_0x37c555(0xd1)]>0x0||_0x3354ee['length']>0x0,_0x72d108=_0x1e947e?![]:_0x5e9e5e[_0x37c555(0xd1)]>0x0,_0x2d0d57=_0x22873d['length']>0x0;return{'segments':{'new':_0x11ee02,'changed':_0x226177,'unchanged':_0x153752,'toDelete':_0x19a49e},'journeys':{'new':_0x538cae,'changed':_0x487ad3,'unchanged':_0x3428bf,'toDelete':_0x3354ee},'activations':{'all':_0x5e9e5e,'toCreate':_0x2623c1,'toUpdate':_0x1dbb05,'toDelete':_0x37aa1a},'folders':{'toCreate':_0x22873d},'counts':{'segments':{'new':_0x11ee02[_0x37c555(0xd1)],'changed':_0x226177['length'],'unchanged':_0x153752['length'],'toDelete':_0x19a49e['length']},'journeys':{'new':_0x538cae['length'],'changed':_0x487ad3[_0x37c555(0xd1)],'unchanged':_0x3428bf[_0x37c555(0xd1)],'toDelete':_0x3354ee[_0x37c555(0xd1)]},'activations':{'create':_0x2623c1[_0x37c555(0xd1)],'update':_0x1dbb05[_0x37c555(0xd1)],'delete':_0x37aa1a[_0x37c555(0xd1)]},'folders':_0x22873d['length']},'hasChanges':_0x4213d3||_0x496e85||_0x72d108||_0x2d0d57};}export async function buildPushExecutionContext(_0x6987cf,_0x327217,_0x3bada9,_0x5c8051,_0x2392d8,_0x31c7f5){const _0x153646=a155_0x50aee1,_0x1ec90e=extractRootFolderId(_0x3bada9),{pathToId:_0x3e8722,idToPath:_0x51f191}=buildFolderMaps(_0x2392d8),_0x48976a=buildSegmentNameToIdMap(_0x5c8051),_0x15048d=new Map(),{batchAsync:_0x642942}=await import(_0x153646(0xcd)),[_0x5c2123,_0x443e44]=await Promise[_0x153646(0xe1)]([_0x6987cf['user']['buildUserMaps'](),_0x6987cf[_0x153646(0x12c)][_0x153646(0x119)](),((async()=>{!_0x31c7f5&&_0x5c8051['length']>0x0&&await _0x642942(_0x5c8051,async _0x57a782=>{const _0x149c5=a155_0x1494,_0x4aacd2=await _0x6987cf[_0x149c5(0xa7)][_0x149c5(0x12b)](_0x327217,_0x57a782['id']);_0x15048d[_0x149c5(0x7d)](_0x57a782['id'],_0x4aacd2);});})())]),{emailToId:_0x16d2b9,idToEmail:_0x1fa136}=_0x5c2123,_0x265d3d=buildConnectionMaps(_0x443e44);return{'rootFolderId':_0x1ec90e,'folderPathToId':_0x3e8722,'folderIdToPath':_0x51f191,'segmentNameToId':_0x48976a,'activationsBySegmentId':_0x15048d,'emailToIdMap':_0x16d2b9,'idToEmailMap':_0x1fa136,'connectionNameToIdMap':_0x265d3d[_0x153646(0x15c)],'connectionIdToNameMap':_0x265d3d[_0x153646(0x153)],'connectionNameToTypeMap':_0x265d3d[_0x153646(0xd4)]};}export function createPushYamlContextForBundle(_0x39bcd1,_0xc13b73,_0x388341,_0x5db2e0,_0x4e6380,_0x4a09b1,_0x2a4a27,_0x279939){const {existingLocalSegmentNames:_0x45af1b,localExpandedRuleToNames:_0x17fe00}=_0x5db2e0,_0x351acc=new Set(),_0xc25a17=new Map(),_0x4f4a12=new Map(),_0x50d26e=new Map(),_0x56ae6e=createJumpTargetCache(),_0x1f5097=new Map(),_0x33c6be=new Map(),_0x61640d=new Set();let _0x32b8db;const _0x56963f=_0x81ec25=>{const _0x25b67d={'resolveSegment':async _0x38f794=>{const _0x5a292b=a155_0x1494,_0x335032=_0x50d26e[_0x5a292b(0x100)](_0x38f794);if(_0x335032!==undefined)return{'name':_0x335032,'isJourneyLocal':!![]};try{const _0x84163e=await fetchSegment(_0x39bcd1,_0xc13b73,_0x38f794,_0x388341);if(!_0x84163e)throw new Error(_0x5a292b(0x13d));const _0x4c521f=generateJourneyLocalName(_0x84163e[_0x5a292b(0xa3)]),_0x4a0a4a=_0x84163e['kind']===SEGMENT_KIND_JOURNEY&&_0x4c521f!==undefined;let _0x23e37c=_0x84163e[_0x5a292b(0xa3)],_0x30c55c;if(_0x4a0a4a&&_0x84163e[_0x5a292b(0xfe)]){const _0x36e33c=apiRuleToYaml(_0x84163e[_0x5a292b(0xfe)]);_0x33c6be[_0x5a292b(0x7d)](_0x38f794,_0x36e33c);const _0x570adb=async _0x3caea3=>{const _0x50a85a=_0x5a292b,_0x1dac4c=collectSegmentRefsFromRule(_0x3caea3);for(const _0xf7c6e6 of _0x1dac4c){if(!_0x33c6be[_0x50a85a(0x125)](_0xf7c6e6))try{const _0x5b2e5f=await fetchSegment(_0x39bcd1,_0xc13b73,_0xf7c6e6,_0x388341);if(_0x5b2e5f?.['rule']){const _0x4adcc1=apiRuleToYaml(_0x5b2e5f[_0x50a85a(0xfe)]);_0x33c6be[_0x50a85a(0x7d)](_0xf7c6e6,_0x4adcc1),await _0x570adb(_0x4adcc1);}}catch(_0x5b09a6){logger[_0x50a85a(0xcf)](_0x50a85a(0x9d)+_0xf7c6e6+':\x20'+_0x5b09a6);}}};await _0x570adb(_0x36e33c);const _0x5eb151=serializeExpandedRule(_0x36e33c,_0x33c6be),_0x2ca7e4=_0x17fe00[_0x5a292b(0x100)](_0x5eb151);if(_0x2ca7e4&&_0x2ca7e4[_0x5a292b(0xd1)]>0x0){const _0x1ccb5c=_0xc25a17['get'](_0x5eb151)||0x0,_0xca6fec=_0x2ca7e4[_0x1ccb5c]||_0x2ca7e4[_0x2ca7e4[_0x5a292b(0xd1)]-0x1];_0xc25a17[_0x5a292b(0x7d)](_0x5eb151,_0x1ccb5c+0x1),_0x23e37c=_0xca6fec,_0x351acc[_0x5a292b(0x167)](_0x23e37c),_0x50d26e[_0x5a292b(0x7d)](_0x38f794,_0x23e37c);const _0x125dd3=await resolveRuleSegmentRefs(_0x36e33c,async _0x5b5c2c=>{const _0x5d3531=_0x5a292b,_0x5175dc=_0x50d26e[_0x5d3531(0x100)](_0x5b5c2c);if(_0x5175dc)return _0x5175dc;const _0x8b80d0=await _0x32b8db[_0x5d3531(0x17e)](_0x5b5c2c);return _0x8b80d0[_0x5d3531(0xa3)];});_0x30c55c={'description':_0x84163e[_0x5a292b(0x174)],'rule':_0x125dd3};}else{const _0x57e02e=_0x1f5097['get'](_0x5eb151);if(_0x57e02e)_0x23e37c=_0x57e02e,_0x50d26e[_0x5a292b(0x7d)](_0x38f794,_0x23e37c);else{if(_0x4c521f){let _0x3bc99b=_0x4c521f,_0x36ec99=0x2;while(_0x351acc['has'](_0x3bc99b)||_0x45af1b['has'](_0x3bc99b)){_0x3bc99b=_0x4c521f+'_'+_0x36ec99,_0x36ec99++;}_0x351acc[_0x5a292b(0x167)](_0x3bc99b),_0x23e37c=_0x3bc99b;}_0x50d26e[_0x5a292b(0x7d)](_0x38f794,_0x23e37c),_0x1f5097[_0x5a292b(0x7d)](_0x5eb151,_0x23e37c);const _0x2771fe=await resolveRuleSegmentRefs(_0x36e33c,async _0xfe1871=>{const _0x35cebb=_0x5a292b,_0x11cafb=_0x50d26e[_0x35cebb(0x100)](_0xfe1871);if(_0x11cafb)return _0x11cafb;const _0x4c572b=await _0x32b8db[_0x35cebb(0x17e)](_0xfe1871);return _0x4c572b[_0x35cebb(0xa3)];});_0x30c55c={'description':_0x84163e[_0x5a292b(0x174)],'rule':_0x2771fe};}}}return{'name':_0x23e37c,'isJourneyLocal':_0x4a0a4a,'definition':_0x30c55c};}catch(_0x34389d){return logger[_0x5a292b(0xcf)](_0x5a292b(0xec)+_0x38f794+':\x20'+_0x34389d),{'name':_0x38f794,'isJourneyLocal':![]};}},'resolveActivation':async _0x588962=>{const _0x46ab04=a155_0x1494,_0x3e4282=_0x4f4a12[_0x46ab04(0x100)](_0x588962);if(_0x3e4282!==undefined)return{'name':_0x3e4282,'isJourneyLocal':!![]};try{let _0x167dd8=_0x2a4a27?.[_0x46ab04(0x100)](_0x588962);!_0x167dd8&&(_0x167dd8=await _0x39bcd1['journey'][_0x46ab04(0x17d)](_0x81ec25,_0x588962));const _0x6b0cd=_0x167dd8[_0x46ab04(0x108)][_0x46ab04(0x17c)]['name']||_0x588962,_0x32266d=sanitizeYamlKey(_0x6b0cd)||_0x46ab04(0xa0)+_0x588962,_0x1e119f=_0x32266d;_0x4f4a12[_0x46ab04(0x7d)](_0x588962,_0x1e119f);const _0x41f506=journeyActivationStepToYaml(_0x167dd8,_0x4e6380,_0x4a09b1);return{'name':_0x1e119f,'isJourneyLocal':!![],'definition':_0x41f506};}catch(_0x57e7d2){return logger[_0x46ab04(0xcf)](_0x46ab04(0x13f)+_0x588962+':\x20'+_0x57e7d2),{'name':_0x588962,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x54a17d,_0x1f6b7d)=>resolveJumpTarget(_0x54a17d,_0x1f6b7d,_0x56ae6e,async _0x47f1bc=>{const _0x3c03c0=a155_0x1494,_0x30be09=_0x279939?.[_0x3c03c0(0x100)](_0x47f1bc);if(_0x30be09)return _0x30be09;return _0x39bcd1['journey'][_0x3c03c0(0xd8)](_0x47f1bc);})};return _0x32b8db=_0x25b67d,_0x25b67d;},_0x3f4ea1=async _0xee3b88=>{const _0x5916d4=a155_0x1494,{collectSegmentIdsFromJourneyApi:_0x30867a}=await import(_0x5916d4(0xa5)),{batchAsync:_0x2071b5}=await import('../../utils/async.js'),_0x5ea57b=new Set();for(const _0x27e892 of _0xee3b88){let _0x562fe6=_0x279939?.[_0x5916d4(0x100)](_0x27e892);!_0x562fe6&&(_0x562fe6=await _0x39bcd1[_0x5916d4(0x84)][_0x5916d4(0xd8)](_0x27e892));const _0x47e9b7=_0x30867a(_0x562fe6);for(const _0x54953b of _0x47e9b7){_0x5ea57b[_0x5916d4(0x167)](_0x54953b);}}let _0x1c1722=Array[_0x5916d4(0x164)](_0x5ea57b);while(_0x1c1722['length']>0x0){const _0x401b3a=_0x1c1722[_0x5916d4(0x15e)](_0x4bb9fa=>!_0x61640d[_0x5916d4(0x125)](_0x4bb9fa));if(_0x401b3a['length']===0x0)break;const _0x2151bd=await _0x2071b5(_0x401b3a,async _0x3ecba9=>{const _0x2e8bc2=_0x5916d4;_0x61640d[_0x2e8bc2(0x167)](_0x3ecba9);const _0x5ea434=await fetchSegment(_0x39bcd1,_0xc13b73,_0x3ecba9,_0x388341);if(!_0x5ea434)return null;return{'segmentId':_0x3ecba9,'segment':_0x5ea434};},0xa),_0x564370=new Set();for(const _0x15efe7 of _0x2151bd){if(!_0x15efe7?.[_0x5916d4(0xa7)]?.[_0x5916d4(0xfe)])continue;const _0x11e207=apiRuleToYaml(_0x15efe7[_0x5916d4(0xa7)][_0x5916d4(0xfe)]);_0x33c6be[_0x5916d4(0x7d)](_0x15efe7[_0x5916d4(0x11a)],_0x11e207);const _0x2ff607=collectSegmentRefsFromRule(_0x11e207);for(const _0x2162ed of _0x2ff607){!_0x61640d['has'](_0x2162ed)&&_0x564370[_0x5916d4(0x167)](_0x2162ed);}}_0x1c1722=Array[_0x5916d4(0x164)](_0x564370);}};return{'createYamlContext':_0x56963f,'prefetchJourneySegments':_0x3f4ea1};}export async function executePushSegments(_0x49bb7d,_0x1237ef,_0x210b07,_0x44b4b2,_0x5cb7ed){const _0x2d9f96=a155_0x50aee1,{segmentDefToCreateRequest:_0x47365e,segmentDefToUpdateRequest:_0x519f9d}=await import(_0x2d9f96(0xe8)),_0x33daa2=_0x210b07[_0x2d9f96(0x150)],_0x57696e=0x5,_0x2f9b5b=async _0x572e3e=>{const _0x2d8c35=_0x2d9f96,_0x3b61fd=_0x572e3e[_0x2d8c35(0xc6)]?_0x33daa2[_0x2d8c35(0x100)](_0x572e3e['folderPath']):undefined;let _0x5c83e4;const _0x55728d={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x2c268e=_0x572e3e[_0x2d8c35(0xc2)];if(_0x572e3e[_0x2d8c35(0xc2)]['rule']){const _0x4903bb=createSegmentIdResolver(_0x210b07['segmentNameToId'],_0x572e3e[_0x2d8c35(0xc2)][_0x2d8c35(0xa3)]),_0x4ea86c=await resolveRuleSegmentIds(_0x572e3e[_0x2d8c35(0xc2)]['rule'],_0x4903bb);_0x2c268e={..._0x572e3e['yamlConfig'],'rule':_0x4ea86c};}try{if(_0x572e3e[_0x2d8c35(0xda)]){_0x5cb7ed['onProgress']?.({'type':_0x2d8c35(0x105),'name':_0x572e3e[_0x2d8c35(0xc2)][_0x2d8c35(0xa3)]});const _0x1b07a4=_0x47365e(_0x2c268e,_0x3b61fd),_0xdfc9e9=await _0x5cb7ed['withProgress']('Creating\x20segment\x20\x27'+_0x572e3e[_0x2d8c35(0xc2)][_0x2d8c35(0xa3)]+_0x2d8c35(0x7c),()=>_0x49bb7d[_0x2d8c35(0xa7)]['createSegment'](_0x44b4b2[_0x2d8c35(0x142)],_0x1b07a4));_0x5c83e4=_0xdfc9e9[_0x2d8c35(0xb7)]['id'],_0x210b07['segmentNameToId'][_0x2d8c35(0x7d)](_0x572e3e[_0x2d8c35(0xc2)][_0x2d8c35(0xa3)],_0x5c83e4),_0x55728d[_0x2d8c35(0x10f)]={'name':_0x572e3e[_0x2d8c35(0xc2)][_0x2d8c35(0xa3)],'id':_0x5c83e4},_0x5cb7ed['onProgress']?.({'type':_0x2d8c35(0x82),'name':_0x572e3e['yamlConfig']['name'],'segmentId':_0x5c83e4}),_0x5cb7ed[_0x2d8c35(0xb8)]?.(_0x2d8c35(0x140)+_0x572e3e[_0x2d8c35(0xc2)]['name']+'\x27'),_0x55728d[_0x2d8c35(0x16e)]=0x1;}else{if(_0x572e3e['hasChanges']){_0x5cb7ed[_0x2d8c35(0x9c)]?.({'type':_0x2d8c35(0x17b),'name':_0x572e3e[_0x2d8c35(0xc2)]['name']});const _0x4e8b26=_0x519f9d(_0x2c268e);_0x3b61fd!==_0x572e3e[_0x2d8c35(0xaa)]?.[_0x2d8c35(0x8e)]&&(_0x4e8b26[_0x2d8c35(0x8e)]=_0x3b61fd?parseInt(_0x3b61fd,0xa):undefined),await _0x5cb7ed['withProgress'](_0x2d8c35(0xc8)+_0x572e3e[_0x2d8c35(0xc2)][_0x2d8c35(0xa3)]+_0x2d8c35(0x7c),()=>_0x49bb7d[_0x2d8c35(0xa7)][_0x2d8c35(0xa1)](_0x44b4b2[_0x2d8c35(0x142)],_0x572e3e[_0x2d8c35(0xaa)]['id'],_0x4e8b26)),_0x5c83e4=_0x572e3e[_0x2d8c35(0xaa)]['id'],_0x5cb7ed[_0x2d8c35(0x9c)]?.({'type':_0x2d8c35(0xc3),'name':_0x572e3e['yamlConfig']['name']}),_0x5cb7ed[_0x2d8c35(0xb8)]?.(_0x2d8c35(0x10e)+_0x572e3e[_0x2d8c35(0xc2)][_0x2d8c35(0xa3)]+'\x27'),_0x55728d[_0x2d8c35(0x139)]=0x1;}else _0x5c83e4=_0x572e3e[_0x2d8c35(0xaa)]['id'];}}catch(_0x18f10b){const _0x3c10bd=isHttp400Error(_0x18f10b),_0x2eed67=_0x3c10bd?ErrorCode[_0x2d8c35(0x155)]:ErrorCode[_0x2d8c35(0x13a)],_0x1eaa9a=getErrorMessage(_0x18f10b);throw new SDKError(_0x2eed67,_0x2d8c35(0x114)+(_0x572e3e[_0x2d8c35(0xda)]?_0x2d8c35(0x87):_0x2d8c35(0xd7))+'\x20segment\x20from\x20file:\x20'+_0x572e3e[_0x2d8c35(0xdb)]+'\x0a\x20\x20'+_0x1eaa9a,_0x18f10b);}try{const _0x3beeac=await syncActivationsForSegment(_0x49bb7d,_0x44b4b2['parentId'],_0x5c83e4,_0x572e3e[_0x2d8c35(0xc2)][_0x2d8c35(0xa3)],_0x572e3e[_0x2d8c35(0x90)],_0x5cb7ed,_0x572e3e[_0x2d8c35(0xdb)]);_0x55728d[_0x2d8c35(0xe7)]=_0x3beeac;}catch(_0x115a89){if(_0x115a89 instanceof SDKError)throw _0x115a89;throw new SDKError(ErrorCode[_0x2d8c35(0xf5)],_0x2d8c35(0xfd)+_0x572e3e[_0x2d8c35(0xc2)][_0x2d8c35(0xa3)]+_0x2d8c35(0x10a)+_0x572e3e[_0x2d8c35(0xdb)]+_0x2d8c35(0x13b)+getErrorMessage(_0x115a89),_0x115a89);}return _0x55728d;},_0x5c8126=await batchAsync(_0x1237ef,_0x2f9b5b,_0x57696e),_0x48d36c={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x2ee420 of _0x5c8126){_0x48d36c['created']+=_0x2ee420[_0x2d9f96(0x16e)],_0x48d36c['updated']+=_0x2ee420['updated'],_0x2ee420[_0x2d9f96(0x10f)]&&_0x48d36c[_0x2d9f96(0xbb)][_0x2d9f96(0x7d)](_0x2ee420[_0x2d9f96(0x10f)][_0x2d9f96(0xa3)],_0x2ee420[_0x2d9f96(0x10f)]['id']),_0x48d36c[_0x2d9f96(0xe7)][_0x2d9f96(0x16e)]+=_0x2ee420[_0x2d9f96(0xe7)][_0x2d9f96(0x16e)],_0x48d36c[_0x2d9f96(0xe7)][_0x2d9f96(0x139)]+=_0x2ee420['activations'][_0x2d9f96(0x139)],_0x48d36c['activations'][_0x2d9f96(0x129)]+=_0x2ee420['activations']['deleted'];}return _0x48d36c;}async function syncActivationsForSegment(_0x2e83eb,_0x3ddcd9,_0x34c118,_0x25ebb5,_0x258d00,_0x30ea52,_0x5296f4){const _0x3d11a9=a155_0x50aee1,_0x53ca63={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x38e192 of _0x258d00){try{if(_0x38e192['type']===_0x3d11a9(0x87)&&_0x38e192[_0x3d11a9(0xd6)])_0x30ea52[_0x3d11a9(0x9c)]?.({'type':'activation_creating','segmentName':_0x25ebb5,'activationName':_0x38e192['name']}),await _0x30ea52['withProgress'](_0x3d11a9(0x16b)+_0x38e192[_0x3d11a9(0xa3)]+_0x3d11a9(0x7c),()=>_0x2e83eb['segment'][_0x3d11a9(0x8f)](_0x3ddcd9,_0x34c118,_0x38e192[_0x3d11a9(0xd6)])),_0x30ea52['onProgress']?.({'type':_0x3d11a9(0x176),'segmentName':_0x25ebb5,'activationName':_0x38e192[_0x3d11a9(0xa3)]}),_0x30ea52[_0x3d11a9(0xb8)]?.(_0x3d11a9(0x7f)+_0x38e192[_0x3d11a9(0xa3)]+'\x27'),_0x53ca63[_0x3d11a9(0x16e)]++;else{if(_0x38e192[_0x3d11a9(0x102)]===_0x3d11a9(0xd7)&&_0x38e192['validatedRequest']&&_0x38e192[_0x3d11a9(0x88)])_0x30ea52[_0x3d11a9(0x9c)]?.({'type':'activation_updating','segmentName':_0x25ebb5,'activationName':_0x38e192[_0x3d11a9(0xa3)]}),await _0x30ea52['withProgress']('Updating\x20activation\x20\x27'+_0x38e192[_0x3d11a9(0xa3)]+_0x3d11a9(0x7c),()=>_0x2e83eb[_0x3d11a9(0xa7)]['updateActivation'](_0x3ddcd9,_0x34c118,_0x38e192[_0x3d11a9(0x88)]['id'],_0x38e192['validatedRequest'])),_0x30ea52[_0x3d11a9(0x9c)]?.({'type':'activation_updated','segmentName':_0x25ebb5,'activationName':_0x38e192[_0x3d11a9(0xa3)]}),_0x30ea52[_0x3d11a9(0xb8)]?.('Updated\x20activation\x20\x27'+_0x38e192[_0x3d11a9(0xa3)]+'\x27'),_0x53ca63[_0x3d11a9(0x139)]++;else _0x38e192[_0x3d11a9(0x102)]===_0x3d11a9(0x160)&&_0x38e192[_0x3d11a9(0x88)]&&(_0x30ea52[_0x3d11a9(0x9c)]?.({'type':_0x3d11a9(0x152),'segmentName':_0x25ebb5,'activationName':_0x38e192[_0x3d11a9(0xa3)]}),await _0x30ea52['withProgress'](_0x3d11a9(0xe2)+_0x38e192['name']+_0x3d11a9(0x7c),()=>_0x2e83eb[_0x3d11a9(0xa7)]['deleteActivation'](_0x3ddcd9,_0x34c118,_0x38e192[_0x3d11a9(0x88)]['id'])),_0x30ea52[_0x3d11a9(0x9c)]?.({'type':_0x3d11a9(0x78),'segmentName':_0x25ebb5,'activationName':_0x38e192[_0x3d11a9(0xa3)]}),_0x30ea52[_0x3d11a9(0x94)]?.(_0x3d11a9(0x8a)+_0x38e192[_0x3d11a9(0xa3)]+'\x27'),_0x53ca63[_0x3d11a9(0x129)]++);}}catch(_0x3d998c){const _0x24ea4a=isHttp400Error(_0x3d998c),_0x61b44a=_0x24ea4a?ErrorCode[_0x3d11a9(0x7a)]:ErrorCode[_0x3d11a9(0xf5)],_0x434f8b=getErrorMessage(_0x3d998c);throw new SDKError(_0x61b44a,_0x3d11a9(0x114)+_0x38e192[_0x3d11a9(0x102)]+'\x20activation\x20\x27'+_0x38e192[_0x3d11a9(0xa3)]+_0x3d11a9(0x10a)+_0x5296f4+'\x0a\x20\x20'+_0x434f8b,_0x3d998c);}}return _0x53ca63;}export async function executePushFolders(_0x4e39a5,_0x4f8f7d,_0x3ee285,_0x2a4610,_0x5666fb){const _0x533b0d=a155_0x50aee1,_0x1f51c=new Map(_0x3ee285),_0x50812f=sortFoldersByDepth(_0x4f8f7d);for(const _0x5568bc of _0x50812f){const _0x176268=_0x5568bc[_0x533b0d(0x11f)]('/'),_0x3043ac=_0x176268[_0x176268['length']-0x1],_0x57e863=_0x176268[_0x533b0d(0x8b)](0x0,-0x1)['join']('/'),_0x53b1e7=_0x1f51c[_0x533b0d(0x100)](_0x57e863);_0x5666fb['onProgress']?.({'type':_0x533b0d(0x9a),'folder':_0x5568bc});const _0x3945d9={'name':_0x3043ac,'parentFolderId':_0x53b1e7},_0x406a95=await _0x5666fb[_0x533b0d(0xa8)](_0x533b0d(0xf8)+_0x5568bc+'\x27...',()=>_0x4e39a5[_0x533b0d(0xa7)][_0x533b0d(0x157)](_0x2a4610[_0x533b0d(0x142)],_0x3945d9));_0x1f51c[_0x533b0d(0x7d)](_0x5568bc,_0x406a95[_0x533b0d(0xb7)]['id']),_0x5666fb[_0x533b0d(0x9c)]?.({'type':_0x533b0d(0x103),'folder':_0x5568bc,'folderId':_0x406a95[_0x533b0d(0xb7)]['id']}),_0x5666fb[_0x533b0d(0x12f)]?.(_0x533b0d(0x85)+_0x5568bc+'\x27');}return _0x1f51c;}export async function executePushSegmentDeletions(_0x397910,_0x10ad72,_0x4de12b){const _0x4f5e81=a155_0x50aee1;if(_0x10ad72[_0x4f5e81(0xd1)]===0x0)return 0x0;const {batchAsync:_0x186238}=await import(_0x4f5e81(0xcd)),_0x514161=0x5,_0x4d4c64=await _0x186238(_0x10ad72,async _0x20ea8d=>{const _0x352288=_0x4f5e81;return _0x4de12b[_0x352288(0x9c)]?.({'type':'segment_deleting','name':_0x20ea8d[_0x352288(0xa3)]}),await _0x397910[_0x352288(0xa7)][_0x352288(0xd5)](_0x20ea8d['id']),_0x4de12b[_0x352288(0x9c)]?.({'type':_0x352288(0x141),'name':_0x20ea8d[_0x352288(0xa3)]}),_0x4de12b[_0x352288(0x94)]?.('Deleted\x20segment\x20\x27'+_0x20ea8d[_0x352288(0xa3)]+'\x27'),0x1;},_0x514161);return _0x4d4c64[_0x4f5e81(0xa6)]((_0x3c5574,_0x74bdb3)=>_0x3c5574+_0x74bdb3,0x0);}export async function executePushJourneys(_0xcfee1,_0x5c7743,_0x5a1064,_0x20ad1a,_0x1344af){const _0x2a30c8=a155_0x50aee1,{journeyDefToRequest:_0x51a5c4}=await import(_0x2a30c8(0xa5)),{activationDefToCreateRequest:_0x3ec110,yamlRuleToApi:_0x34c287,validateSegmentRule:_0x35d3a6}=await import(_0x2a30c8(0xe8)),_0x5479d7={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x103bef=new Map(_0x5a1064['segmentNameToId']),_0x15bf0b=0x5;for(let _0x3cecff=0x0;_0x3cecff<_0x5c7743[_0x2a30c8(0xd1)];_0x3cecff+=_0x15bf0b){const _0x229539=_0x5c7743['slice'](_0x3cecff,_0x3cecff+_0x15bf0b),_0x957928=await Promise[_0x2a30c8(0xe1)](_0x229539['map'](async _0x8e200d=>{const _0x2fe9d4=_0x2a30c8;if(!_0x8e200d[_0x2fe9d4(0xda)]&&!_0x8e200d[_0x2fe9d4(0x166)])return{'action':_0x2fe9d4(0xac),'name':_0x8e200d[_0x2fe9d4(0xc2)]['name'],'journeyId':_0x8e200d[_0x2fe9d4(0xe0)]?.['id']};const _0x133e33=_0x8e200d[_0x2fe9d4(0xc6)]?_0x5a1064[_0x2fe9d4(0x150)][_0x2fe9d4(0x100)](_0x8e200d[_0x2fe9d4(0xc6)]):undefined;_0x1344af[_0x2fe9d4(0x9c)]?.({'type':_0x8e200d['isNew']?_0x2fe9d4(0x104):_0x2fe9d4(0x172),'name':_0x8e200d['yamlConfig']['name']});try{const _0x447b2b=await executeSingleJourneyPush(_0xcfee1,_0x8e200d,{..._0x5a1064,'segmentNameToId':_0x103bef},{'parentId':_0x20ad1a[_0x2fe9d4(0x142)],'rootFolderId':_0x20ad1a[_0x2fe9d4(0xfb)],'folderId':_0x133e33,'verbose':_0x20ad1a[_0x2fe9d4(0xb0)]},_0x1344af,{'journeyDefToRequest':_0x51a5c4,'activationDefToCreateRequest':_0x3ec110,'yamlRuleToApi':_0x34c287,'validateSegmentRule':_0x35d3a6});for(const [_0x151924,_0x40ac7a]of _0x447b2b[_0x2fe9d4(0x144)]){_0x103bef[_0x2fe9d4(0x7d)](_0x151924,_0x40ac7a),_0x5479d7['embeddedSegmentNameToId'][_0x2fe9d4(0x7d)](_0x151924,_0x40ac7a);}if(_0x447b2b[_0x2fe9d4(0xb2)]==='created')_0x1344af['onProgress']?.({'type':_0x2fe9d4(0x17f),'name':_0x8e200d[_0x2fe9d4(0xc2)][_0x2fe9d4(0xa3)],'journeyId':_0x447b2b['journeyId']}),_0x1344af[_0x2fe9d4(0xb8)]?.('Created\x20journey\x20\x27'+_0x8e200d[_0x2fe9d4(0xc2)][_0x2fe9d4(0xa3)]+'\x27'),_0x5479d7[_0x2fe9d4(0x16e)]++;else _0x447b2b[_0x2fe9d4(0xb2)]==='updated'&&(_0x1344af['onProgress']?.({'type':_0x2fe9d4(0x98),'name':_0x8e200d['yamlConfig'][_0x2fe9d4(0xa3)]}),_0x1344af[_0x2fe9d4(0xb8)]?.(_0x2fe9d4(0x91)+_0x8e200d[_0x2fe9d4(0xc2)][_0x2fe9d4(0xa3)]+'\x27'),_0x5479d7[_0x2fe9d4(0x139)]++);return{'action':_0x447b2b[_0x2fe9d4(0xb2)],'name':_0x8e200d[_0x2fe9d4(0xc2)][_0x2fe9d4(0xa3)],'journeyId':_0x447b2b[_0x2fe9d4(0x117)]};}catch(_0x5a291a){const _0x312fc6=isHttp400Error(_0x5a291a),_0xaad62c=_0x312fc6?ErrorCode[_0x2fe9d4(0x134)]:ErrorCode[_0x2fe9d4(0xcc)],_0x4bb872=getErrorMessage(_0x5a291a);throw new SDKError(_0xaad62c,_0x2fe9d4(0x114)+(_0x8e200d['isNew']?_0x2fe9d4(0x87):_0x2fe9d4(0xd7))+_0x2fe9d4(0x173)+_0x8e200d['absolutePath']+_0x2fe9d4(0x13b)+_0x4bb872,_0x5a291a);}}));_0x5479d7['results'][_0x2a30c8(0x10d)](..._0x957928);}return _0x5479d7;}async function matchExistingJourneySegments(_0x2fcfdd,_0xbd1845,_0x54461f,_0x24fd55,_0x285b72){const _0x6e452a=a155_0x50aee1;if(!_0xbd1845[_0x6e452a(0xe0)]||!_0xbd1845[_0x6e452a(0xc2)][_0x6e452a(0x156)])return;const _0x562d1a=new Map(),_0x34c46c=new Set();for(const _0x4d5289 of Object[_0x6e452a(0xc0)](_0xbd1845[_0x6e452a(0xc2)][_0x6e452a(0x156)])){const _0x1561b3=generateDeterministicJourneySegmentName(_0xbd1845[_0x6e452a(0xc2)][_0x6e452a(0xa3)],_0x4d5289);_0x562d1a['set'](_0x1561b3,_0x4d5289),_0x34c46c[_0x6e452a(0x167)](_0x4d5289);}const _0x3f6aac=[],_0x2f705f=collectSegmentIdsFromJourneyApi(_0xbd1845['existingJourney']);for(const _0x5ef7a5 of _0x2f705f){const _0xa0b0d1=await fetchSegment(_0x2fcfdd,_0x54461f,_0x5ef7a5,_0x24fd55);if(!_0xa0b0d1?.[_0x6e452a(0xa3)])continue;const _0x5f5054=_0x562d1a[_0x6e452a(0x100)](_0xa0b0d1[_0x6e452a(0xa3)]);_0x5f5054?(_0x285b72['set'](_0x5f5054,_0x5ef7a5),_0x34c46c[_0x6e452a(0x160)](_0x5f5054)):_0x3f6aac[_0x6e452a(0x10d)]({'id':_0x5ef7a5,'seg':_0xa0b0d1});}if(_0x34c46c[_0x6e452a(0x14d)]>0x0&&_0x3f6aac[_0x6e452a(0xd1)]>0x0){const {localExpandedRuleToNames:_0x24543a}=buildLocalExpandedRuleMappings(_0xbd1845['yamlConfig']),_0x5bda60=new Map();for(const {id:_0xe8a8c7,seg:_0x485919}of _0x3f6aac){if(_0x485919['rule']){const _0x4354db=apiRuleToYaml(_0x485919[_0x6e452a(0xfe)]);_0x5bda60[_0x6e452a(0x7d)](_0xe8a8c7,_0x4354db);}}for(const {id:_0xb680c4,seg:_0x129284}of _0x3f6aac){if(!_0x129284[_0x6e452a(0xfe)])continue;const _0x42690a=_0x5bda60[_0x6e452a(0x100)](_0xb680c4);if(!_0x42690a)continue;const _0x2de0aa=serializeExpandedRule(_0x42690a,_0x5bda60),_0x2d1d3b=_0x24543a[_0x6e452a(0x100)](_0x2de0aa);if(_0x2d1d3b){const _0xfa9c89=_0x2d1d3b['find'](_0x51051d=>_0x34c46c['has'](_0x51051d));_0xfa9c89&&(_0x285b72[_0x6e452a(0x7d)](_0xfa9c89,_0xb680c4),_0x34c46c[_0x6e452a(0x160)](_0xfa9c89),logger[_0x6e452a(0xcf)](_0x6e452a(0xfa)+_0x129284[_0x6e452a(0xa3)]+_0x6e452a(0x128)+_0xfa9c89+'\x27\x20by\x20rule\x20content'));}}}}async function executeSingleJourneyPush(_0x25e109,_0x14c1cc,_0x3bdd23,_0x163caa,_0x32db20,_0x4553b3){const _0xec0b3a=a155_0x50aee1,{journeyDefToRequest:_0x5003da,activationDefToCreateRequest:_0x3686ae,yamlRuleToApi:_0x4bd32a,validateSegmentRule:_0x1ac64f}=_0x4553b3,_0x1c6c72=new Map(),_0x4e417a=new Map();recoverSegmentIdsFromPushRecovery(_0x14c1cc,_0x1c6c72,_0x3bdd23['segmentNameToId']);const _0x5b9bb4=new Map(),_0x337d2d=new Map(),_0x2c0769=new Map();let _0x27491d;const _0x547577=async()=>{const _0x2a0f7d=a155_0x1494;if(_0x27491d)return;_0x27491d=new Map();if(!_0x14c1cc[_0x2a0f7d(0xe0)])return;const _0x29394d=await _0x25e109['journey'][_0x2a0f7d(0x12b)](_0x14c1cc[_0x2a0f7d(0xe0)]['id']);for(const _0x2be7c2 of _0x29394d){const _0x5d1aeb=journeyActivationStepToYaml(_0x2be7c2,_0x3bdd23['idToEmailMap'],_0x3bdd23[_0x2a0f7d(0x13c)]),_0x576594=activationSignature(_0x5d1aeb);!_0x27491d[_0x2a0f7d(0x125)](_0x576594)&&_0x27491d[_0x2a0f7d(0x7d)](_0x576594,_0x2be7c2['id']),_0x5d1aeb['name']&&_0x4e417a['set'](_0x5d1aeb[_0x2a0f7d(0xa3)],_0x2be7c2['id']);}};await matchExistingJourneySegments(_0x25e109,_0x14c1cc,_0x163caa[_0xec0b3a(0x142)],_0x3bdd23['existingSegments'],_0x3bdd23[_0xec0b3a(0x145)]);const _0x305024={'resolveSegmentId':async _0x6a10a7=>{const _0xe017b6=_0xec0b3a,_0x308d97=_0x3bdd23['segmentNameToId'][_0xe017b6(0x100)](_0x6a10a7);if(!_0x308d97)throw new SDKError(ErrorCode[_0xe017b6(0xca)],_0xe017b6(0xff)+_0x6a10a7+_0xe017b6(0x16c)+_0x14c1cc['yamlConfig']['name']+')');return _0x308d97;},'resolveEmbeddedSegmentId':async(_0x496a9b,_0x4416d4)=>{const _0x57042b=_0xec0b3a,_0x2b0420=_0x3bdd23[_0x57042b(0x145)][_0x57042b(0x100)](_0x496a9b);if(_0x2b0420)return _0x2b0420;const _0x50ecef=_0x3bdd23[_0x57042b(0xd9)][_0x57042b(0xcb)](_0x22c06b=>_0x22c06b[_0x57042b(0xa3)]===_0x496a9b);if(_0x50ecef)return _0x3bdd23[_0x57042b(0x145)][_0x57042b(0x7d)](_0x496a9b,_0x50ecef['id']),_0x50ecef['id'];if(_0x14c1cc[_0x57042b(0xda)]){const {stageName:_0x418ecf,criteriaName:_0x7b874b}=findSegmentCriteriaLocation(_0x14c1cc[_0x57042b(0xc2)],_0x496a9b);return _0x1ac64f(_0x496a9b,_0x4416d4[_0x57042b(0xfe)]),_0x337d2d[_0x57042b(0x7d)](_0x496a9b,{'definition':_0x4416d4,'stageName':_0x418ecf,'criteriaName':_0x7b874b}),createPendingSegmentId(_0x496a9b);}const _0x3b4bfa=_0x14c1cc[_0x57042b(0xe0)]?.['id'];if(!_0x3b4bfa)throw new SDKError(ErrorCode[_0x57042b(0xef)],_0x57042b(0xf9));const _0x5007a8=_0x5b9bb4[_0x57042b(0x100)](_0x496a9b);if(_0x5007a8)return _0x5007a8;const _0x275411=((async()=>{const _0x31d853=_0x57042b;_0x1ac64f(_0x496a9b,_0x4416d4[_0x31d853(0xfe)]);const _0x4451c3=generateDeterministicJourneySegmentName(_0x14c1cc[_0x31d853(0xc2)]['name'],_0x496a9b),_0x25b35c=_0x3bdd23['existingSegments'][_0x31d853(0xcb)](_0x4d07d7=>_0x4d07d7[_0x31d853(0xa3)]===_0x4451c3),_0x2708f9=createSegmentIdResolver(_0x3bdd23[_0x31d853(0x145)],_0x496a9b),_0x536e39=await resolveRuleSegmentIds(_0x4416d4['rule'],_0x2708f9);let _0x289320;return _0x25b35c?(await _0x25e109['segment'][_0x31d853(0xa1)](_0x163caa[_0x31d853(0x142)],_0x25b35c['id'],{'description':_0x4416d4[_0x31d853(0x174)]||_0x31d853(0x115)+_0x496a9b,'rule':_0x4bd32a(_0x536e39),'countPopulation':!![]}),_0x289320=_0x25b35c['id'],saveSegmentToPushRecovery(_0x14c1cc['absolutePath'],_0x14c1cc[_0x31d853(0xc2)][_0x31d853(0xa3)],_0x496a9b,{'segmentId':_0x289320,'uniqueServerName':_0x4451c3,'createdAt':new Date()[_0x31d853(0xed)]()})):_0x289320=await createOrRecoverEmbeddedSegment(_0x25e109,_0x14c1cc,{'localName':_0x496a9b,'uniqueSegmentName':_0x4451c3,'description':_0x4416d4[_0x31d853(0x174)]||_0x31d853(0x115)+_0x496a9b,'journeyId':_0x3b4bfa,'resolvedRule':_0x536e39,'parentId':_0x163caa[_0x31d853(0x142)],'folderId':_0x163caa[_0x31d853(0xfb)]||''},_0x4bd32a),_0x3bdd23[_0x31d853(0x145)][_0x31d853(0x7d)](_0x496a9b,_0x289320),_0x1c6c72[_0x31d853(0x7d)](_0x496a9b,_0x289320),_0x289320;})());_0x5b9bb4[_0x57042b(0x7d)](_0x496a9b,_0x275411);try{return await _0x275411;}finally{_0x5b9bb4[_0x57042b(0x160)](_0x496a9b);}},'resolveActivationId':async _0x216be9=>{const _0x5270b9=_0xec0b3a,_0x4969ab=_0x4e417a[_0x5270b9(0x100)](_0x216be9);if(_0x4969ab)return _0x4969ab;if(_0x14c1cc[_0x5270b9(0xe0)]){await _0x547577();const _0x2986c3=_0x4e417a['get'](_0x216be9);if(_0x2986c3)return _0x2986c3;}throw new SDKError(ErrorCode[_0x5270b9(0x147)],_0x5270b9(0x15d)+_0x216be9+_0x5270b9(0x16c)+_0x14c1cc['yamlConfig'][_0x5270b9(0xa3)]+_0x5270b9(0x111)+_0x5270b9(0xa4));},'resolveEmbeddedActivationId':async(_0x484a51,_0x2cefde)=>{const _0x172ed7=_0xec0b3a,_0x5da23c=_0x4e417a[_0x172ed7(0x100)](_0x484a51);if(_0x5da23c)return _0x5da23c;if(_0x14c1cc[_0x172ed7(0xda)])return _0x2c0769[_0x172ed7(0x7d)](_0x484a51,_0x2cefde),createPendingActivationId(_0x484a51);if(_0x14c1cc[_0x172ed7(0xe0)]){await _0x547577();const _0x127347=_0x4e417a[_0x172ed7(0x100)](_0x2cefde['name']);if(_0x127347)return _0x4e417a[_0x172ed7(0x7d)](_0x484a51,_0x127347),_0x127347;const _0x4f2b96=activationSignature(_0x2cefde),_0x2a2bca=_0x27491d?.['get'](_0x4f2b96);if(_0x2a2bca)return _0x4e417a['set'](_0x484a51,_0x2a2bca),_0x2a2bca;const _0x221c7d=await _0x3686ae(_0x2cefde,_0x3bdd23[_0x172ed7(0xae)]),_0x224e65={..._0x221c7d,..._0x2cefde[_0x172ed7(0xa2)]!==undefined&&{'runAfterJourneyRefresh':_0x2cefde[_0x172ed7(0xa2)]}},_0x7fd1eb=await _0x25e109[_0x172ed7(0x84)][_0x172ed7(0x8f)](_0x14c1cc[_0x172ed7(0xe0)]['id'],_0x224e65);return _0x4e417a['set'](_0x484a51,_0x7fd1eb['id']),_0x7fd1eb['id'];}throw new SDKError(ErrorCode[_0x172ed7(0xef)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0xe004b8=>{const _0x1d9a00=_0xec0b3a;try{return await _0x25e109[_0x1d9a00(0x84)][_0x1d9a00(0x93)](_0x163caa[_0x1d9a00(0x142)],_0xe004b8);}catch(_0x45c30a){throw new SDKError(ErrorCode[_0x1d9a00(0x147)],_0x1d9a00(0xe4)+_0xe004b8+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x14c1cc[_0x1d9a00(0xc2)][_0x1d9a00(0xa3)]+'\x27)',_0x45c30a);}},'resolveStageId':async(_0x1c2418,_0x8d3f28)=>{const _0x4b6314=_0xec0b3a,_0x5259aa=await _0x25e109[_0x4b6314(0x84)][_0x4b6314(0xd8)](_0x1c2418),_0x51a5e0=_0x5259aa[_0x4b6314(0x108)]['journeyStages'][_0x4b6314(0xcb)](_0x1c322c=>_0x1c322c[_0x4b6314(0xa3)][_0x4b6314(0xf2)]()===_0x8d3f28[_0x4b6314(0xf2)]());if(!_0x51a5e0?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],'Stage\x20\x27'+_0x8d3f28+_0x4b6314(0x127)+(_0x5259aa['attributes'][_0x4b6314(0x137)]||_0x5259aa[_0x4b6314(0x108)]['name'])+'\x27');return _0x51a5e0['id'];}},_0x1e82f9=await _0x5003da(_0x14c1cc[_0xec0b3a(0xc2)],_0x163caa[_0xec0b3a(0x142)],_0x305024),_0x3e4db8=_0x163caa[_0xec0b3a(0x148)]||_0x163caa[_0xec0b3a(0xfb)];_0x3e4db8&&(_0x1e82f9[_0xec0b3a(0xc7)]={'parentFolder':{'data':{'id':_0x3e4db8,'type':'folder'}}});if(_0x14c1cc[_0xec0b3a(0xda)]){if(_0x337d2d[_0xec0b3a(0x14d)]>0x0||_0x2c0769[_0xec0b3a(0x14d)]>0x0)return await executeThreeStepJourneyCreate(_0x25e109,_0x14c1cc,_0x1e82f9,{'pendingEmbeddedSegments':_0x337d2d,'pendingEmbeddedActivations':_0x2c0769,'embeddedSegmentNameToId':_0x1c6c72,'journeyActivationNameToId':_0x4e417a},{..._0x163caa,'effectiveFolderId':_0x3e4db8},_0x3bdd23,_0x32db20,_0x4553b3);else{ensureJourneyDefaults(_0x1e82f9[_0xec0b3a(0x108)]);const _0x49d82c=await _0x25e109[_0xec0b3a(0x84)][_0xec0b3a(0x87)](_0x1e82f9);return deletePushRecovery(_0x14c1cc[_0xec0b3a(0xdb)]),{'action':_0xec0b3a(0x16e),'journeyId':_0x49d82c['id'],'embeddedSegmentNameToId':_0x1c6c72};}}else{if(_0x14c1cc[_0xec0b3a(0x166)]&&_0x14c1cc[_0xec0b3a(0xe0)]){_0x1e82f9['id']=_0x14c1cc['existingJourney']['id'];const _0xb68fd9=_0x1e82f9[_0xec0b3a(0x108)];_0x14c1cc[_0xec0b3a(0xe0)][_0xec0b3a(0x108)]?.[_0xec0b3a(0x137)]&&(_0xb68fd9[_0xec0b3a(0x137)]=_0x14c1cc['existingJourney'][_0xec0b3a(0x108)][_0xec0b3a(0x137)]);const _0x476afb=_0x14c1cc[_0xec0b3a(0xe0)][_0xec0b3a(0x108)]?.['journeyStages'];return _0x476afb&&_0x1e82f9[_0xec0b3a(0x108)][_0xec0b3a(0xf3)]&&injectExistingStageIds(_0x1e82f9[_0xec0b3a(0x108)][_0xec0b3a(0xf3)],_0x476afb),ensureJourneyDefaults(_0xb68fd9),await _0x25e109['journey'][_0xec0b3a(0xd7)](_0x14c1cc[_0xec0b3a(0xe0)]['id'],_0x1e82f9),deletePushRecovery(_0x14c1cc['absolutePath']),{'action':_0xec0b3a(0x139),'journeyId':_0x14c1cc[_0xec0b3a(0xe0)]['id'],'embeddedSegmentNameToId':_0x1c6c72};}}return deletePushRecovery(_0x14c1cc['absolutePath']),{'action':_0xec0b3a(0xac),'journeyId':_0x14c1cc[_0xec0b3a(0xe0)]?.['id'],'embeddedSegmentNameToId':_0x1c6c72};}function findSegmentCriteriaLocation(_0x5ec0b3,_0x39317e){const _0x4b781e=a155_0x50aee1,_0x542d06=_0x5ec0b3[_0x4b781e(0x179)]||_0x5ec0b3[_0x4b781e(0x92)]?.[0x0]?.[_0x4b781e(0x179)]||[];let _0xb018a5='entry',_0xcc9d63=_0x39317e;const _0xb62fdb=_0x5ec0b3[_0x4b781e(0x113)]||_0x5ec0b3[_0x4b781e(0x92)]?.[0x0]?.[_0x4b781e(0x113)];if(_0xb62fdb?.[_0x4b781e(0xa7)]===_0x39317e)return{'stageName':_0x4b781e(0x113),'criteriaName':_0xb62fdb[_0x4b781e(0xa3)]||_0x39317e};_0x3ff5ba:for(const _0x1d5aa8 of _0x542d06){if(_0x1d5aa8[_0x4b781e(0x14f)]?.['segment']===_0x39317e){_0xb018a5=_0x1d5aa8['name'],_0xcc9d63=_0x1d5aa8['entry_criteria']['name']||_0x39317e;break;}if(_0x1d5aa8[_0x4b781e(0xf6)])for(const _0x50e0c6 of _0x1d5aa8[_0x4b781e(0xf6)]){if(_0x50e0c6['type']===_0x4b781e(0xeb)&&_0x50e0c6['with']?.[_0x4b781e(0xf4)])for(const _0x35a855 of _0x50e0c6[_0x4b781e(0x14b)]['branches']){if(_0x35a855[_0x4b781e(0xa7)]===_0x39317e){_0xb018a5=_0x1d5aa8[_0x4b781e(0xa3)],_0xcc9d63=_0x35a855['name']||_0x39317e;break _0x3ff5ba;}}}}return{'stageName':_0xb018a5,'criteriaName':_0xcc9d63};}async function executeThreeStepJourneyCreate(_0x230d58,_0x2c5e38,_0xab1331,_0x57d765,_0x5d570e,_0x164675,_0x4fbc5f,_0x593ee0){const _0x3cdcbb=a155_0x50aee1,{activationDefToCreateRequest:_0x254e9b,yamlRuleToApi:_0x595b07}=_0x593ee0,{pendingEmbeddedSegments:_0x38e4c1,pendingEmbeddedActivations:_0xb3211e,embeddedSegmentNameToId:_0x5ced84}=_0x57d765,_0x5c3b19=JSON[_0x3cdcbb(0xba)](JSON[_0x3cdcbb(0x130)](_0xab1331));ensureJourneyDefaults(_0x5c3b19[_0x3cdcbb(0x108)]),stripPendingIds(_0x5c3b19);const _0x155547=await _0x230d58[_0x3cdcbb(0x84)][_0x3cdcbb(0x87)](_0x5c3b19),_0x3c46bf=_0x155547['id'],_0x1349cc=new Map();for(const _0x512ea2 of _0x155547[_0x3cdcbb(0x108)][_0x3cdcbb(0xf3)]){_0x1349cc['set'](_0x512ea2[_0x3cdcbb(0xa3)]['toLowerCase'](),_0x512ea2['id']);}recoverSegmentIdsFromPushRecovery(_0x2c5e38,_0x5ced84,_0x164675[_0x3cdcbb(0x145)]);for(const [_0x3ee8b2,{definition:_0x34eb27}]of _0x38e4c1){if(_0x5ced84[_0x3cdcbb(0x125)](_0x3ee8b2)){_0x4fbc5f[_0x3cdcbb(0x9c)]?.({'type':_0x3cdcbb(0x10c),'journeyName':_0x2c5e38[_0x3cdcbb(0xc2)]['name'],'segmentName':_0x3ee8b2});continue;}const _0xeccecd=generateDeterministicJourneySegmentName(_0x2c5e38['yamlConfig']['name'],_0x3ee8b2);_0x4fbc5f[_0x3cdcbb(0x9c)]?.({'type':_0x3cdcbb(0x178),'journeyName':_0x2c5e38['yamlConfig'][_0x3cdcbb(0xa3)],'segmentName':_0x3ee8b2});const _0x2884fb=createSegmentIdResolver(_0x164675[_0x3cdcbb(0x145)],_0x3ee8b2),_0x1f7d57=await resolveRuleSegmentIds(_0x34eb27[_0x3cdcbb(0xfe)],_0x2884fb),_0x44f4d2=await createOrRecoverEmbeddedSegment(_0x230d58,_0x2c5e38,{'localName':_0x3ee8b2,'uniqueSegmentName':_0xeccecd,'description':_0x34eb27[_0x3cdcbb(0x174)]||'Entry\x20criteria:\x20'+_0x3ee8b2,'journeyId':_0x3c46bf,'resolvedRule':_0x1f7d57,'parentId':_0x5d570e[_0x3cdcbb(0x142)],'folderId':_0x5d570e[_0x3cdcbb(0xee)]||''},_0x595b07);_0x5ced84[_0x3cdcbb(0x7d)](_0x3ee8b2,_0x44f4d2),_0x164675[_0x3cdcbb(0x145)][_0x3cdcbb(0x7d)](_0x3ee8b2,_0x44f4d2),_0x4fbc5f[_0x3cdcbb(0x9c)]?.({'type':_0x3cdcbb(0x10c),'journeyName':_0x2c5e38[_0x3cdcbb(0xc2)][_0x3cdcbb(0xa3)],'segmentName':_0x3ee8b2});}const _0x18e9be=new Map();for(const [_0x2c3f18,_0x4a5cd8]of _0xb3211e){_0x4fbc5f[_0x3cdcbb(0x9c)]?.({'type':_0x3cdcbb(0x151),'journeyName':_0x2c5e38[_0x3cdcbb(0xc2)]['name'],'activationName':_0x2c3f18});const _0x509b54=await _0x254e9b(_0x4a5cd8,_0x164675[_0x3cdcbb(0xae)]),_0x212b26={..._0x509b54,..._0x4a5cd8['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x4a5cd8[_0x3cdcbb(0xa2)]}},_0x2db942=await _0x230d58['journey']['createActivation'](_0x3c46bf,_0x212b26);_0x18e9be[_0x3cdcbb(0x7d)](_0x2c3f18,_0x2db942['id']),_0x57d765[_0x3cdcbb(0x107)][_0x3cdcbb(0x7d)](_0x2c3f18,_0x2db942['id']),_0x4fbc5f[_0x3cdcbb(0x9c)]?.({'type':_0x3cdcbb(0xbe),'journeyName':_0x2c5e38[_0x3cdcbb(0xc2)][_0x3cdcbb(0xa3)],'activationName':_0x2c3f18});}const _0x554343=JSON[_0x3cdcbb(0xba)](JSON['stringify'](_0xab1331));return _0x554343['id']=_0x3c46bf,ensureJourneyDefaults(_0x554343[_0x3cdcbb(0x108)]),resolvePendingIdsInRequest(_0x554343,_0xab1331,_0x1349cc,_0x5ced84,_0x18e9be,_0x4fbc5f),await _0x230d58['journey'][_0x3cdcbb(0xd7)](_0x3c46bf,_0x554343),deletePushRecovery(_0x2c5e38[_0x3cdcbb(0xdb)]),{'action':_0x3cdcbb(0x16e),'journeyId':_0x3c46bf,'embeddedSegmentNameToId':_0x5ced84};}export function stripWaitStepPendingIds(_0x349828){const _0x33f457=a155_0x50aee1,_0x1ececc=_0x349828[_0x33f457(0x9f)]&&isPendingSegmentId(_0x349828['conditionSegmentId']),_0x2d70c4=_0x349828['conditions']?.[_0x33f457(0xc5)](_0x536361=>_0x536361[_0x33f457(0x11a)]&&isPendingSegmentId(_0x536361['segmentId']));(_0x1ececc||_0x2d70c4)&&(_0x349828[_0x33f457(0x14a)]=_0x33f457(0xd0),_0x349828[_0x33f457(0x11c)]=0x1,_0x349828[_0x33f457(0xbc)]='day',delete _0x349828[_0x33f457(0x9f)],delete _0x349828[_0x33f457(0x8c)],delete _0x349828[_0x33f457(0xf1)],delete _0x349828[_0x33f457(0x138)]);}export function resolveWaitStepPendingIds(_0x4bb036,_0x13a48f,_0x499b55,_0xb3c94e){const _0x5cc635=a155_0x50aee1;if(_0x13a48f['conditionSegmentId']&&isPendingSegmentId(_0x13a48f[_0x5cc635(0x9f)])){const _0x40d041=_0x499b55(_0x13a48f[_0x5cc635(0x9f)],'stage\x20\x27'+_0xb3c94e+_0x5cc635(0xe3));_0x40d041&&(_0x4bb036[_0x5cc635(0x14a)]='Condition',_0x4bb036[_0x5cc635(0x9f)]=_0x40d041,delete _0x4bb036['waitStep'],delete _0x4bb036[_0x5cc635(0xbc)],_0x13a48f[_0x5cc635(0x8c)]!==undefined&&(_0x4bb036[_0x5cc635(0x8c)]=_0x13a48f[_0x5cc635(0x8c)]),_0x13a48f[_0x5cc635(0xf1)]&&(_0x4bb036[_0x5cc635(0xf1)]=_0x13a48f[_0x5cc635(0xf1)]));}if(_0x13a48f[_0x5cc635(0x138)]){const _0x1955d1=_0x13a48f[_0x5cc635(0x138)][_0x5cc635(0xc5)](_0x211ce6=>_0x211ce6[_0x5cc635(0x11a)]&&isPendingSegmentId(_0x211ce6[_0x5cc635(0x11a)]));if(_0x1955d1){const _0x4933b8=_0x13a48f[_0x5cc635(0x138)][_0x5cc635(0x136)](_0x3c033e=>{const _0x1c2764=_0x5cc635;if(_0x3c033e[_0x1c2764(0x11a)]&&isPendingSegmentId(_0x3c033e[_0x1c2764(0x11a)])){const _0x3d6d26=_0x499b55(_0x3c033e[_0x1c2764(0x11a)],_0x1c2764(0xad)+_0xb3c94e+_0x1c2764(0xe3));return{..._0x3c033e,'segmentId':_0x3d6d26||_0x3c033e[_0x1c2764(0x11a)]};}return{..._0x3c033e};});_0x4bb036[_0x5cc635(0x14a)]=_0x5cc635(0xb1),_0x4bb036['conditions']=_0x4933b8,delete _0x4bb036['waitStep'],delete _0x4bb036[_0x5cc635(0xbc)],delete _0x4bb036[_0x5cc635(0x9f)],delete _0x4bb036['conditionTimeoutDuration'],delete _0x4bb036[_0x5cc635(0xf1)];}}}function stripPendingIds(_0x96b8f3){const _0x165a60=a155_0x50aee1;_0x96b8f3['attributes'][_0x165a60(0x113)]?.[_0x165a60(0x11a)]&&isPendingSegmentId(_0x96b8f3[_0x165a60(0x108)][_0x165a60(0x113)][_0x165a60(0x11a)])&&delete _0x96b8f3[_0x165a60(0x108)][_0x165a60(0x113)];for(const _0x3eb4f8 of _0x96b8f3[_0x165a60(0x108)][_0x165a60(0xf3)]||[]){_0x3eb4f8[_0x165a60(0x177)]?.[_0x165a60(0x11a)]&&isPendingSegmentId(_0x3eb4f8[_0x165a60(0x177)][_0x165a60(0x11a)])&&delete _0x3eb4f8[_0x165a60(0x177)];_0x3eb4f8[_0x165a60(0x15b)]?.['segmentId']&&isPendingSegmentId(_0x3eb4f8['milestone']['segmentId'])&&delete _0x3eb4f8[_0x165a60(0x15b)];_0x3eb4f8[_0x165a60(0xdf)]&&(_0x3eb4f8[_0x165a60(0xdf)]=_0x3eb4f8[_0x165a60(0xdf)][_0x165a60(0x15e)](_0x4818b0=>!_0x4818b0['segmentId']||!isPendingSegmentId(_0x4818b0[_0x165a60(0x11a)])));if(_0x3eb4f8[_0x165a60(0xf6)])for(const _0x30db2d of Object[_0x165a60(0xc0)](_0x3eb4f8[_0x165a60(0xf6)])){const _0x3b7b87=_0x3eb4f8[_0x165a60(0xf6)][_0x30db2d];_0x3b7b87[_0x165a60(0x102)]===_0x165a60(0x86)&&_0x3b7b87['journeyActivationStepId']&&isPendingActivationId(_0x3b7b87['journeyActivationStepId'])&&(_0x3b7b87[_0x165a60(0xdc)]='');if(_0x3b7b87[_0x165a60(0x102)]===_0x165a60(0xf0)&&_0x3b7b87['branches'])for(const _0x505e68 of _0x3b7b87[_0x165a60(0xf4)]){_0x505e68[_0x165a60(0x11a)]&&isPendingSegmentId(_0x505e68[_0x165a60(0x11a)])&&(_0x505e68[_0x165a60(0x11a)]='');}_0x3b7b87[_0x165a60(0x102)]===_0x165a60(0x16d)&&stripWaitStepPendingIds(_0x3b7b87);}}}function resolvePendingIdsInRequest(_0x272eca,_0x34eb85,_0x675199,_0x2cfe71,_0xebd268,_0x5cca25){const _0x400bfa=a155_0x50aee1,_0x156134=(_0xe4ca0e,_0x384004)=>{const _0x47c078=a155_0x1494;if(!isPendingSegmentId(_0xe4ca0e))return _0xe4ca0e;const _0x5bc245=extractPendingSegmentName(_0xe4ca0e),_0x41903a=_0x2cfe71['get'](_0x5bc245);return!_0x41903a&&_0x5cca25[_0x47c078(0x170)]?.(_0x47c078(0xd3)+_0x5bc245+_0x47c078(0x116)+_0x384004),_0x41903a;};if(_0x272eca[_0x400bfa(0x108)]['goal']?.[_0x400bfa(0x11a)]&&isPendingSegmentId(_0x272eca[_0x400bfa(0x108)][_0x400bfa(0x113)][_0x400bfa(0x11a)])){const _0x2ab228=_0x156134(_0x272eca[_0x400bfa(0x108)][_0x400bfa(0x113)][_0x400bfa(0x11a)],_0x400bfa(0x9b));_0x2ab228&&(_0x272eca[_0x400bfa(0x108)]['goal'][_0x400bfa(0x11a)]=_0x2ab228);}for(const _0x408a3e of _0x272eca[_0x400bfa(0x108)][_0x400bfa(0xf3)]||[]){const _0x228d94=_0x675199[_0x400bfa(0x100)](_0x408a3e[_0x400bfa(0xa3)][_0x400bfa(0xf2)]());_0x228d94&&(_0x408a3e['id']=_0x228d94);if(_0x408a3e[_0x400bfa(0x177)]?.[_0x400bfa(0x11a)]&&isPendingSegmentId(_0x408a3e[_0x400bfa(0x177)][_0x400bfa(0x11a)])){const _0x4df93d=_0x156134(_0x408a3e['entryCriteria'][_0x400bfa(0x11a)],_0x400bfa(0xad)+_0x408a3e['name']+_0x400bfa(0xbd));_0x4df93d&&(_0x408a3e[_0x400bfa(0x177)][_0x400bfa(0x11a)]=_0x4df93d);}if(_0x408a3e['exitCriterias'])for(const _0x5b1cfa of _0x408a3e['exitCriterias']){if(_0x5b1cfa[_0x400bfa(0x11a)]&&isPendingSegmentId(_0x5b1cfa[_0x400bfa(0x11a)])){const _0x27bdeb=_0x156134(_0x5b1cfa['segmentId'],_0x400bfa(0xad)+_0x408a3e[_0x400bfa(0xa3)]+_0x400bfa(0xea));_0x27bdeb&&(_0x5b1cfa[_0x400bfa(0x11a)]=_0x27bdeb);}}if(_0x408a3e['milestone']?.[_0x400bfa(0x11a)]&&isPendingSegmentId(_0x408a3e[_0x400bfa(0x15b)][_0x400bfa(0x11a)])){const _0x2f223e=_0x156134(_0x408a3e['milestone'][_0x400bfa(0x11a)],'stage\x20\x27'+_0x408a3e[_0x400bfa(0xa3)]+_0x400bfa(0x9e));_0x2f223e&&(_0x408a3e[_0x400bfa(0x15b)]['segmentId']=_0x2f223e);}if(_0x408a3e[_0x400bfa(0xf6)]){const _0x1fc1dc=_0x3eeacf=>_0x34eb85[_0x400bfa(0x108)]['journeyStages']?.['find'](_0x2aef32=>_0x2aef32[_0x400bfa(0xa3)][_0x400bfa(0xf2)]()===_0x408a3e['name']['toLowerCase']())?.[_0x400bfa(0xf6)]?.[_0x3eeacf];for(const _0x125593 of Object['keys'](_0x408a3e[_0x400bfa(0xf6)])){const _0x107f96=_0x408a3e[_0x400bfa(0xf6)][_0x125593],_0x1278ea=_0x1fc1dc(_0x125593);if(_0x107f96[_0x400bfa(0x102)]===_0x400bfa(0x86)&&_0x107f96[_0x400bfa(0xdc)]&&(isPendingActivationId(_0x107f96['journeyActivationStepId'])||_0x107f96[_0x400bfa(0xdc)]==='')){if(_0x1278ea?.[_0x400bfa(0xdc)]&&isPendingActivationId(_0x1278ea['journeyActivationStepId'])){const _0x15fd83=extractPendingActivationName(_0x1278ea[_0x400bfa(0xdc)]),_0x772dfa=_0xebd268[_0x400bfa(0x100)](_0x15fd83);_0x772dfa&&(_0x107f96[_0x400bfa(0xdc)]=_0x772dfa);}}if(_0x107f96[_0x400bfa(0x102)]===_0x400bfa(0xf0)&&_0x107f96['branches']&&_0x1278ea?.['branches'])for(let _0x5d934d=0x0;_0x5d934d<_0x107f96[_0x400bfa(0xf4)][_0x400bfa(0xd1)];_0x5d934d++){const _0x1de1e8=_0x107f96['branches'][_0x5d934d],_0x4b3bb6=_0x1278ea['branches'][_0x5d934d];if(_0x4b3bb6?.[_0x400bfa(0x11a)]&&isPendingSegmentId(_0x4b3bb6['segmentId'])){const _0x32b2c0=_0x156134(_0x4b3bb6[_0x400bfa(0x11a)],_0x400bfa(0xad)+_0x408a3e[_0x400bfa(0xa3)]+_0x400bfa(0x14c)+(_0x1de1e8[_0x400bfa(0xa3)]||_0x5d934d)+'\x27');_0x32b2c0&&(_0x1de1e8[_0x400bfa(0x11a)]=_0x32b2c0);}}_0x107f96[_0x400bfa(0x102)]===_0x400bfa(0x16d)&&_0x1278ea?.[_0x400bfa(0x102)]===_0x400bfa(0x16d)&&resolveWaitStepPendingIds(_0x107f96,_0x1278ea,_0x156134,_0x408a3e[_0x400bfa(0xa3)]);}}}}
1
+ const a155_0x213229=a155_0x27e5;(function(_0x4f8b6a,_0x7f42f0){const _0x1529e1=a155_0x27e5,_0x1e41f8=_0x4f8b6a();while(!![]){try{const _0x195fe7=parseInt(_0x1529e1(0x1a8))/0x1+parseInt(_0x1529e1(0x12e))/0x2*(-parseInt(_0x1529e1(0x1bd))/0x3)+-parseInt(_0x1529e1(0x15d))/0x4*(parseInt(_0x1529e1(0x129))/0x5)+parseInt(_0x1529e1(0x150))/0x6+-parseInt(_0x1529e1(0x105))/0x7*(parseInt(_0x1529e1(0x193))/0x8)+-parseInt(_0x1529e1(0xde))/0x9+parseInt(_0x1529e1(0x146))/0xa*(parseInt(_0x1529e1(0x163))/0xb);if(_0x195fe7===_0x7f42f0)break;else _0x1e41f8['push'](_0x1e41f8['shift']());}catch(_0x47bb02){_0x1e41f8['push'](_0x1e41f8['shift']());}}}(a155_0x4014,0x35dfa));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a155_0x213229(0xf5));export const PENDING_SEGMENT_PREFIX=a155_0x213229(0x11a);export const PENDING_ACTIVATION_PREFIX=a155_0x213229(0x1a5);export function createPendingSegmentId(_0x165912){return''+PENDING_SEGMENT_PREFIX+_0x165912+'__';}export function isPendingSegmentId(_0x3cc8d4){const _0x168f0f=a155_0x213229;return _0x3cc8d4[_0x168f0f(0x116)](PENDING_SEGMENT_PREFIX)&&!_0x3cc8d4['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x2252ca){const _0xc2d13c=a155_0x213229;return _0x2252ca[_0xc2d13c(0x1c6)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x5edec9){return''+PENDING_ACTIVATION_PREFIX+_0x5edec9+'__';}export function isPendingActivationId(_0x377b4e){const _0x36a891=a155_0x213229;return _0x377b4e[_0x36a891(0x116)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x40cf0d){const _0xdca3d8=a155_0x213229;return _0x40cf0d[_0xdca3d8(0x1c6)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x29c264,_0x157086){const _0x35c1a4=a155_0x213229,_0xe79614=_0x29c264+'::'+(_0x157086[_0x35c1a4(0xfe)]()||_0x35c1a4(0x175)),_0x576798=createHash('sha1')[_0x35c1a4(0x152)](_0xe79614)['digest'](_0x35c1a4(0x1b2))[_0x35c1a4(0x19d)](0x0,0xc);return _0x35c1a4(0x1d2)+_0x576798;}export function ensureJourneyDefaults(_0x491719){const _0x4a3ed5=a155_0x213229;!_0x491719['description']&&(_0x491719[_0x4a3ed5(0x177)]=''),!_0x491719['state']&&(_0x491719[_0x4a3ed5(0x14e)]='draft');}export function injectExistingStageIds(_0x1ba813,_0x3dbc26){const _0x191883=a155_0x213229,_0x2713f7=new Map(_0x3dbc26[_0x191883(0x19f)](_0x576176=>[_0x576176[_0x191883(0x108)],_0x576176['id']]));for(const _0x56d4c5 of _0x1ba813){if(!_0x56d4c5['id']){const _0x512329=_0x2713f7['get'](_0x56d4c5[_0x191883(0x108)]);_0x512329&&(_0x56d4c5['id']=_0x512329);}}}function a155_0x4014(){const _0x5c32de=['toString','relative','attributes','Delete\x20the\x20push\x20recovery\x20file\x20(','updateSegmentById','\x27\x20entry\x20criteria','diff','join','deleteSegment','33009OmNABE','segmentFolderId','message','deps','split','keys','listActivations','goal','resolveSegment','replace','yamlActivation','DecisionPoint','logDeleted','folderId','waitStepType','folderPath','results','push','sort','journeyBundleName','ACTIVATION_UPDATE_ERROR','journey_entry_criteria_','logInfo','createdSegmentId','\x20journey\x20from\x20file:\x20','index','activation_template_id','find','type','folder_creating','debug','notification','null','resolvedRule','waitStep','conditions','3574953riLYRJ','deleteActivation','idToEmailMap','entry','conditionTimeoutDuration','\x27\x20exit\x20criteria','versionNumber','run_after_journey_refresh','toISOString','entryCriteria','localName','with','segmentByFolderAndName','user','\x27\x20by\x20rule\x20content','filter','isNew','journeyBundlesByFolderAndName','segment_deleting','parse','journey_updating','./child-segment-yaml.js','journey','tdx.sdk.push-workflow','Created\x20segment\x20\x27','goal\x20criteria','onProgress','rule','activationContext','and\x20the\x20server\x20segment,\x20then\x20retry.','\x27\x20for\x20','logSuccess','trim','resolveJourneyId','Created\x20folder\x20\x27','journeyById','Updated\x20activation\x20\x27','createActivation','\x20(referenced\x20in\x20journey\x20','2576BhAwUa','object','branches','name','NOT_FOUND','activation_updated','conditionTimeoutUnit','max','updateActivation','segment_updated','parentId','parseDocument','Embedded\x20segment\x20\x27','Fetching\x20','schedule','Segment\x20not\x20found','journey_updated','startsWith','hasChanges','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','__pending_','Updating\x20segment\x20\x27','add','SEGMENT_UPDATE_ERROR','validatedRequest','verbose','all','Name\x20has\x20already\x20been\x20taken','created','updated','dirname','some','relationships','progress','deleted','82785xNrKvt','activation_creating','journeyActivationStepId','entries','withProgress','62JGOwuq','from','SEGMENT_SYNTAX_ERROR','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','journeys','segmentId','journey_created','effectiveFolderId','kind','rootFolderId','Matched\x20server\x20segment\x20\x27','Deleted\x20activation\x20\x27','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','Journey\x20\x27','activationParams','stages','activations','connector_config','journeyId','embedded_segment_creating','buildUserMaps','Creating\x20folder\x20\x27','absolutePath','createFolder','370jIqNLS','values','yamlConfig','Failed\x20to\x20resolve\x20segment\x20','existingSegment','reduce','steps','create','state','\x27\x20decision\x20point\x20branch\x20\x27','2155254giIdXw','journeyActivationNameToId','update','day','.$1.push-recovery.json','Failed\x20to\x20fetch\x20referenced\x20segment\x20','getSegment\x20failed\x20for\x20','exitCriterias','):\x20','embedded_activation_creating','toLowerCase','behavior','\x20error(s)','52gknUoH','all_columns','stringify','includes','journeyStages','Creating\x20activation\x20\x27','132121XbVOwz','item','ACTIVATION_SYNTAX_ERROR','\x20activation\x20\x27','set','createJourneySegment','activation_updating','activationActions','delete','uniqueSegmentName','size','logWarning','stage\x20\x27','INTERNAL','Updated\x20segment\x20\x27','Activation','\x27...',').\x20','segment','length','description','journeyName','action','nameToType','segment_creating','activationStepsById','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','activation_deleted','uniqueServerName','activationsBySegmentId','\x27\x20wait\x20condition','utf-8','segments','has','embedded_activation_created','match','get','decision_point','segment_deleted','conditionSegmentId','skipSegments','folderPathToId','list','Segment\x20not\x20found:\x20','entry_criteria','Creating\x20segment\x20\x27','existingJourney','createSegment','984JrPsqn','milestone','parentFolder','connection','nameToId','SEGMENT_NOT_FOUND','unchanged','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','Created\x20journey\x20\x27','Failed\x20to\x20','slice','segment_created','map','\x0a\x20\x20','segmentNameToId','getJourney','existingSegments','Condition','__pending_act_','../../utils/async.js','connectionIdToNameMap','415865nhSvEC','isArray','flatMap','embeddedSegmentNameToId','Updating\x20activation\x20\x27','columns','waitStepUnit','WaitStep','data','valid','hex','getSegment'];a155_0x4014=function(){return _0x5c32de;};return a155_0x4014();}export function resolveTDFolderPath(_0x2f87be,_0x18a668,_0x4fb91d){if(!_0x18a668)return _0x2f87be;if(_0x2f87be===_0x4fb91d||_0x2f87be['startsWith'](_0x4fb91d+'/'))return _0x2f87be;return _0x2f87be?_0x4fb91d+'/'+_0x2f87be:_0x4fb91d;}export function addFoldersToCreate(_0x249da1,_0x27e8d7,_0x233bbd){const _0x11859c=a155_0x213229;if(!_0x249da1)return;if(_0x27e8d7[_0x11859c(0x184)](_0x249da1))return;const _0x1185d6=_0x249da1[_0x11859c(0x1c1)]('/');let _0x1a0f9e='';for(const _0x1726b6 of _0x1185d6){_0x1a0f9e=_0x1a0f9e?_0x1a0f9e+'/'+_0x1726b6:_0x1726b6,!_0x27e8d7[_0x11859c(0x184)](_0x1a0f9e)&&_0x233bbd[_0x11859c(0x11c)](_0x1a0f9e);}}export function sortFoldersByDepth(_0x16504e){return[..._0x16504e]['sort']((_0x367543,_0x302d35)=>{const _0x35087b=a155_0x27e5,_0x14effd=(_0x367543[_0x35087b(0x186)](/\//g)||[])['length'],_0x83c756=(_0x302d35[_0x35087b(0x186)](/\//g)||[])[_0x35087b(0x176)];return _0x14effd-_0x83c756;});}import*as a155_0x28f1ca from'yaml';import{readFileSync}from'fs';import a155_0x55d76c from'path';import{isJourneyDef,parseYamlString as a155_0x1d7fcb,toYamlString as a155_0x452fd9,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(_0x3d285b){const _0x21e967=a155_0x213229;if(Array[_0x21e967(0x1a9)](_0x3d285b))return'['+_0x3d285b[_0x21e967(0x19f)](_0x3bfbab=>stableStringify(_0x3bfbab))['join'](',')+']';if(_0x3d285b&&typeof _0x3d285b===_0x21e967(0x106)){const _0x2f8e45=_0x3d285b,_0xbe7285=Object['keys'](_0x2f8e45)[_0x21e967(0x1cf)](),_0x1fe6d2=_0xbe7285[_0x21e967(0x19f)](_0xc3b079=>'\x22'+_0xc3b079+'\x22:'+stableStringify(_0x2f8e45[_0xc3b079]));return'{'+_0x1fe6d2[_0x21e967(0x1bb)](',')+'}';}const _0x27f84e=JSON[_0x21e967(0x15f)](_0x3d285b);return _0x27f84e===undefined?_0x21e967(0xda):_0x27f84e;}function activationSignature(_0x1fc5cd){const _0x5c3dc3=a155_0x213229,_0x322b23={'connection':_0x1fc5cd[_0x5c3dc3(0x196)],..._0x1fc5cd[_0x5c3dc3(0x15e)]!==undefined&&{'all_columns':_0x1fc5cd['all_columns']},..._0x1fc5cd[_0x5c3dc3(0x1ad)]!==undefined&&{'columns':_0x1fc5cd['columns']},..._0x1fc5cd[_0x5c3dc3(0x15b)]!==undefined&&{'behavior':_0x1fc5cd[_0x5c3dc3(0x15b)]},..._0x1fc5cd[_0x5c3dc3(0x113)]!==undefined&&{'schedule':_0x1fc5cd[_0x5c3dc3(0x113)]},..._0x1fc5cd[_0x5c3dc3(0xd9)]!==undefined&&{'notification':_0x1fc5cd[_0x5c3dc3(0xd9)]},..._0x1fc5cd[_0x5c3dc3(0x13f)]!==undefined&&{'connector_config':_0x1fc5cd['connector_config']},..._0x1fc5cd['activation_template_id']!==undefined&&{'activation_template_id':_0x1fc5cd[_0x5c3dc3(0x1d7)]}};return stableStringify(_0x322b23);}async function fetchSegment(_0x1d13a7,_0x4555db,_0x4a58ab,_0x5769d0){const _0x4c5158=a155_0x213229,_0x13f8a5=_0x5769d0?.[_0x4c5158(0xd5)](_0x1ce19f=>_0x1ce19f['id']===_0x4a58ab);if(_0x13f8a5)return _0x13f8a5;try{return await _0x1d13a7[_0x4c5158(0x175)][_0x4c5158(0x1b3)](_0x4555db,_0x4a58ab);}catch(_0x4955c3){logger[_0x4c5158(0xd8)](_0x4c5158(0x156)+_0x4a58ab+',\x20falling\x20back\x20to\x20getSegmentEntity:\x20'+_0x4955c3);try{return await _0x1d13a7[_0x4c5158(0x175)]['getSegmentEntity'](_0x4a58ab);}catch(_0x1310e1){return logger['debug']('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x4a58ab+':\x20'+_0x1310e1),null;}}}function a155_0x27e5(_0x5e088f,_0x535437){_0x5e088f=_0x5e088f-0xd5;const _0x40148c=a155_0x4014();let _0x27e5a7=_0x40148c[_0x5e088f];return _0x27e5a7;}function recoverSegmentIdsFromPushRecovery(_0x3e53b6,_0xf20dea,_0x55b572){const _0x42f040=a155_0x213229,_0x2e37f7=readPushRecovery(_0x3e53b6[_0x42f040(0x144)]);if(_0x2e37f7?.[_0x42f040(0x178)]===_0x3e53b6[_0x42f040(0x148)][_0x42f040(0x108)])for(const [_0x413beb,_0xdeff18]of Object[_0x42f040(0x12c)](_0x2e37f7[_0x42f040(0x183)])){const _0x2666a6=generateDeterministicJourneySegmentName(_0x3e53b6[_0x42f040(0x148)][_0x42f040(0x108)],_0x413beb);_0xdeff18[_0x42f040(0x17f)]===_0x2666a6&&(_0xf20dea[_0x42f040(0x167)](_0x413beb,_0xdeff18[_0x42f040(0x133)]),_0x55b572[_0x42f040(0x167)](_0x413beb,_0xdeff18['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x159eef,_0x5c0510,_0x11493b,_0x5b013e){const _0x595384=a155_0x213229;let _0xa3d9c;try{_0xa3d9c=await _0x159eef[_0x595384(0x175)][_0x595384(0x168)]({'name':_0x11493b['uniqueSegmentName'],'description':_0x11493b[_0x595384(0x177)],'journeyId':_0x11493b['journeyId'],'rule':_0x5b013e(_0x11493b[_0x595384(0xdb)],!![]),'countPopulation':!![],'parentFolderId':_0x11493b[_0x595384(0x1ca)],'audienceId':_0x11493b[_0x595384(0x10f)]});}catch(_0x15ca46){const _0x295c76=_0x15ca46 instanceof Error&&_0x15ca46[_0x595384(0x1bf)][_0x595384(0x160)](_0x595384(0x121));if(_0x295c76){const _0x32ac66=readPushRecovery(_0x5c0510[_0x595384(0x144)]),_0x5e5fc1=_0x32ac66?.[_0x595384(0x178)]===_0x5c0510['yamlConfig']['name']?_0x32ac66['segments'][_0x11493b['localName']]:undefined;if(_0x5e5fc1?.[_0x595384(0x17f)]===_0x11493b['uniqueSegmentName'])await _0x159eef['segment'][_0x595384(0x1b8)](_0x11493b['parentId'],_0x5e5fc1[_0x595384(0x133)],{'description':_0x11493b[_0x595384(0x177)],'rule':_0x5b013e(_0x11493b[_0x595384(0xdb)],!![]),'countPopulation':!![]}),_0xa3d9c=_0x5e5fc1[_0x595384(0x133)];else throw new SDKError(ErrorCode[_0x595384(0x11d)],_0x595384(0x111)+_0x11493b[_0x595384(0xe8)]+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+(_0x595384(0x1b7)+_0x5c0510[_0x595384(0x144)]['replace'](/([^/]+)$/,_0x595384(0x154))+')\x20')+_0x595384(0xfb),_0x15ca46);}else throw _0x15ca46;}return saveSegmentToPushRecovery(_0x5c0510[_0x595384(0x144)],_0x5c0510[_0x595384(0x148)][_0x595384(0x108)],_0x11493b[_0x595384(0xe8)],{'segmentId':_0xa3d9c,'uniqueServerName':_0x11493b[_0x595384(0x16c)],'createdAt':new Date()[_0x595384(0xe6)]()}),_0xa3d9c;}export async function prepareSegmentFiles(_0x28668c,_0x29b587,_0x208ca5,_0x2f87f1,_0xa42fa1){const _0x54980f=a155_0x213229,{activationDefToCreateRequest:_0x5241a1}=await import(_0x54980f(0xf3)),_0x82d80e=[],_0x3ce882=new Set();for(const {yamlConfig:_0x18e099,folderPath:_0x36ab8c,sourcePath:_0x2e8962}of _0x28668c){const _0x29d03d=resolveTDFolderPath(_0x36ab8c,_0x2f87f1,_0xa42fa1),_0x93ffd1=_0x29d03d+':'+_0x18e099[_0x54980f(0x108)],_0x18e381=_0x29b587[_0x54980f(0xea)]['get'](_0x93ffd1),_0x2dd6f1=_0x18e381?_0x29b587[_0x54980f(0x180)][_0x54980f(0x187)](_0x18e381['id'])||[]:[];addFoldersToCreate(_0x29d03d,_0x29b587[_0x54980f(0x18c)],_0x3ce882);const _0x4e830b=calculateActivationActions(_0x18e099[_0x54980f(0x13e)]||[],_0x2dd6f1,_0x29b587[_0x54980f(0xe0)],_0x29b587[_0x54980f(0x1a7)]);for(const _0x2cfb8e of _0x4e830b){(_0x2cfb8e['type']===_0x54980f(0x14d)||_0x2cfb8e[_0x54980f(0xd6)]===_0x54980f(0x152))&&_0x2cfb8e[_0x54980f(0x1c7)]&&(_0x2cfb8e[_0x54980f(0x11e)]=await _0x5241a1(_0x2cfb8e[_0x54980f(0x1c7)],_0x208ca5));}const _0x25d4ff=calculateSegmentDiff(_0x18e099,_0x18e381,_0x2dd6f1,_0x29b587[_0x54980f(0xe0)],_0x29b587['connectionIdToNameMap']);_0x82d80e[_0x54980f(0x1ce)]({'relativePath':_0x18e099['name'],'absolutePath':_0x2e8962,'yamlConfig':_0x18e099,'folderPath':_0x29d03d,'existingSegment':_0x18e381,'existingActivations':_0x2dd6f1,'isNew':_0x25d4ff[_0x54980f(0xee)],'hasChanges':_0x25d4ff[_0x54980f(0x117)],'diff':_0x25d4ff[_0x54980f(0x1ba)],'activationActions':_0x4e830b});}return{'segmentFiles':_0x82d80e,'foldersToCreate':_0x3ce882};}export async function prepareJourneyFiles(_0x362710,_0x1a7d0a,_0x5003ed,_0x6604c8){const _0x44c135=a155_0x213229,_0x5b249a=[],_0x13506e=new Set();for(const {yamlConfig:_0x36cf3a,folderPath:_0x2028de,sourcePath:_0x596b84}of _0x362710){const _0x3663af=resolveTDFolderPath(_0x2028de,_0x5003ed,_0x6604c8),_0x1d398c=_0x3663af+':'+_0x36cf3a[_0x44c135(0x108)],_0x21e234=_0x1a7d0a[_0x44c135(0xef)]['get'](_0x1d398c);let _0x1b09b9,_0x266155;if(_0x21e234&&_0x21e234[_0x44c135(0x176)]>0x0){const _0x1699e8=buildLocalExpandedRuleMappings(_0x36cf3a),{createYamlContext:_0x30224f,prefetchJourneySegments:_0x545e6f}=createPushYamlContextForBundle(_0x1a7d0a[_0x44c135(0x1c0)],_0x1a7d0a[_0x44c135(0x10f)],_0x1a7d0a['existingSegments'],_0x1699e8,_0x1a7d0a[_0x44c135(0xe0)],_0x1a7d0a[_0x44c135(0x1a7)],_0x1a7d0a[_0x44c135(0x17c)],_0x1a7d0a[_0x44c135(0x101)]);await _0x545e6f(_0x21e234[_0x44c135(0x19f)](_0x1f07e0=>_0x1f07e0['id']));const _0x5c6976=await _0x1a7d0a[_0x44c135(0x1c0)][_0x44c135(0xf4)]['getLatestJourneyId'](_0x21e234[0x0]['journeyBundleId']),_0x246a84=hasMultipleVersions(_0x36cf3a),_0x5cd6f0=async _0xff3372=>{const _0x348e21=_0x44c135,_0x2c6408=_0x1a7d0a[_0x348e21(0x101)]?.[_0x348e21(0x187)](_0xff3372);if(_0x2c6408)return _0x2c6408;return _0x1a7d0a['fetchJourney']({'journeyId':_0xff3372,'journeyName':_0x36cf3a['name'],'isMultiVersion':_0x21e234[_0x348e21(0x176)]>0x1});};if(_0x246a84&&_0x21e234[_0x44c135(0x176)]>0x1){const _0x31e778=[];for(const _0x34dda1 of _0x21e234){const _0x3ef850=_0x34dda1[_0x44c135(0xe4)]||0x1;_0x1a7d0a[_0x44c135(0x127)]?.['update'](_0x44c135(0x112)+_0x36cf3a['name']+'\x20v'+_0x3ef850);const _0x37ff1c=await _0x5cd6f0(_0x34dda1['id']),_0x360cb1=_0x30224f(_0x34dda1['id']),_0x28062b=await journeyResponseToDef(_0x37ff1c,_0x360cb1);_0x31e778[_0x44c135(0x1ce)]({'item':_0x34dda1,'yaml':_0x28062b});}const _0x2f8095=buildLocalRuleToNameMappingFromJourney(_0x36cf3a);_0x266155=buildMergedJourneyDef(_0x31e778,_0x2f8095,_0x5c6976);const _0x3fd281=Math[_0x44c135(0x10c)](..._0x31e778[_0x44c135(0x19f)](_0xc49d58=>_0xc49d58[_0x44c135(0x164)]['versionNumber']||0x0)),_0x4a7da8=_0x21e234['find'](_0x1231f4=>(_0x1231f4[_0x44c135(0xe4)]||0x0)===_0x3fd281);_0x4a7da8&&(_0x1a7d0a[_0x44c135(0x127)]?.[_0x44c135(0x152)](_0x44c135(0x112)+_0x36cf3a[_0x44c135(0x108)]+'\x20v'+_0x3fd281),_0x1b09b9=await _0x5cd6f0(_0x4a7da8['id']));}else{const _0x1c67a5=_0x21e234[_0x21e234[_0x44c135(0x176)]-0x1];_0x1a7d0a[_0x44c135(0x127)]?.[_0x44c135(0x152)](_0x44c135(0x112)+_0x36cf3a['name']),_0x1b09b9=await _0x5cd6f0(_0x1c67a5['id']);const _0x4b5052=_0x30224f(_0x1c67a5['id']),_0x220312=await journeyResponseToDef(_0x1b09b9,_0x4b5052),_0x4c24a5=buildLocalRuleToNameMappingFromJourney(_0x36cf3a);_0x266155=buildMergedJourneyDef([{'item':_0x1c67a5,'yaml':_0x220312}],_0x4c24a5,_0x5c6976);}}addFoldersToCreate(_0x3663af,_0x1a7d0a[_0x44c135(0x18c)],_0x13506e);const _0x4a8310=calculateJourneyDiff(_0x36cf3a,_0x266155);_0x5b249a['push']({'relativePath':_0x36cf3a[_0x44c135(0x108)],'absolutePath':_0x596b84,'yamlConfig':_0x36cf3a,'folderPath':_0x3663af,'existingJourney':_0x1b09b9,'isNew':_0x4a8310[_0x44c135(0xee)],'hasChanges':_0x4a8310['hasChanges'],'diff':_0x4a8310['diff']});}return{'journeyFiles':_0x5b249a,'foldersToCreate':_0x13506e};}export function calculateActivationActions(_0x30a3a1,_0x5ad173,_0x593c51,_0xef9eb5){const _0x18926d=a155_0x213229,_0x49c11c=[],_0x55f97b=new Map();for(const _0x230711 of _0x5ad173){_0x55f97b[_0x18926d(0x167)](_0x230711[_0x18926d(0x108)],_0x230711);}const _0x34dbb9=new Map();for(const _0x271673 of _0x30a3a1){_0x34dbb9['set'](_0x271673[_0x18926d(0x108)],_0x271673);}for(const _0xe5cf06 of _0x30a3a1){const _0x1b518f=_0x55f97b['get'](_0xe5cf06['name']);if(!_0x1b518f)_0x49c11c[_0x18926d(0x1ce)]({'type':_0x18926d(0x14d),'name':_0xe5cf06[_0x18926d(0x108)],'yamlActivation':_0xe5cf06});else{const _0x2146d0=activationResponseToDef(_0x1b518f,_0x593c51,_0xef9eb5),_0xaaeb70=a155_0x28f1ca[_0x18926d(0x15f)](_0x2146d0),_0x598a2e=a155_0x28f1ca[_0x18926d(0x15f)](_0xe5cf06);_0xaaeb70!==_0x598a2e&&_0x49c11c[_0x18926d(0x1ce)]({'type':_0x18926d(0x152),'name':_0xe5cf06[_0x18926d(0x108)],'yamlActivation':_0xe5cf06,'existingActivation':_0x1b518f});}}for(const _0x1cfa29 of _0x5ad173){!_0x34dbb9[_0x18926d(0x184)](_0x1cfa29[_0x18926d(0x108)])&&_0x49c11c[_0x18926d(0x1ce)]({'type':_0x18926d(0x16b),'name':_0x1cfa29[_0x18926d(0x108)],'existingActivation':_0x1cfa29});}return _0x49c11c;}function calculateYamlDiff(_0x4fb30e,_0x4d477c){if(_0x4d477c){const _0x1e10a4=generateDiff(_0x4d477c,_0x4fb30e),_0x53e15c=hasChanges(_0x1e10a4);return{'isNew':![],'hasChanges':_0x53e15c,'diff':_0x53e15c?formatDiffWithColors(_0x1e10a4):undefined};}const _0x198906=generateDiff('',_0x4fb30e);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x198906)};}export function calculateSegmentDiff(_0x3f2de7,_0x48b361,_0x3876ae,_0x5427cc,_0x1e4617){const _0x931e5d=segmentToYamlString(_0x3f2de7),_0x2541b2=_0x48b361?segmentToYamlString(segmentWithActivationsToYaml(_0x48b361,_0x3876ae,undefined,_0x5427cc,_0x1e4617)):undefined;return calculateYamlDiff(_0x931e5d,_0x2541b2);}export function calculateJourneyDiff(_0x236450,_0x5bc459){const _0x4ba88d=normalizeJourneyDef(_0x236450,_0x236450),_0x37f9f6=a155_0x452fd9(_0x4ba88d),_0x1302d4=_0x5bc459?a155_0x452fd9(normalizeJourneyDef(_0x5bc459,_0x236450)):undefined;return calculateYamlDiff(_0x37f9f6,_0x1302d4);}export function findSegmentsToDelete(_0x40111f,_0x5cbb88,_0x157d76,_0x1692db,_0x51cd6d){const _0x47e6c8=new Set();for(const {yamlConfig:_0xff0bcd,folderPath:_0x47566c}of _0x5cbb88){_0x47e6c8['add'](_0x47566c+':'+_0xff0bcd['name']);}return _0x40111f['filter'](_0x12fc60=>{const _0x735e02=a155_0x27e5,_0x1f8d9e=_0x12fc60['segmentFolderId']?_0x157d76['get'](_0x12fc60[_0x735e02(0x1be)][_0x735e02(0x1b4)]())||'':'',_0x40f217=_0x1f8d9e+':'+_0x12fc60[_0x735e02(0x108)];if(_0x47e6c8[_0x735e02(0x184)](_0x40f217))return![];if(_0x51cd6d)return _0x1f8d9e===_0x1692db||_0x1f8d9e[_0x735e02(0x116)](_0x1692db+'/');return!![];});}export function findJourneysToDelete(_0xac30f8,_0x4d7988,_0x62452f,_0x200ed1,_0x54d31f){const _0x6f7db1=a155_0x213229,_0x4dfd6e=new Set();for(const {yamlConfig:_0x131aa0,folderPath:_0xaa6af0}of _0x4d7988){_0x4dfd6e[_0x6f7db1(0x11c)](_0xaa6af0+':'+_0x131aa0['name']);}return _0xac30f8[_0x6f7db1(0xed)](_0x3b60cb=>{const _0x1fc9bf=_0x6f7db1,_0x241f13=_0x3b60cb[_0x1fc9bf(0x1ca)]?_0x62452f[_0x1fc9bf(0x187)](_0x3b60cb[_0x1fc9bf(0x1ca)])||'':'',_0xdb3c58=_0x241f13+':'+_0x3b60cb[_0x1fc9bf(0x1d0)];if(_0x4dfd6e[_0x1fc9bf(0x184)](_0xdb3c58))return![];if(_0x54d31f)return _0x241f13===_0x200ed1||_0x241f13[_0x1fc9bf(0x116)](_0x200ed1+'/');return!![];});}export function buildSegmentLookupMap(_0x5ea753,_0x4f0a44){const _0x477fce=a155_0x213229,_0x4bfade=new Map();for(const _0x35567e of _0x5ea753){const _0x1e30bb=_0x35567e[_0x477fce(0x1be)]?_0x4f0a44[_0x477fce(0x187)](_0x35567e['segmentFolderId'][_0x477fce(0x1b4)]())||'':'',_0x30cde4=_0x1e30bb+':'+_0x35567e[_0x477fce(0x108)];_0x4bfade[_0x477fce(0x167)](_0x30cde4,_0x35567e);}return _0x4bfade;}export function buildSegmentNameToIdMap(_0x488817){const _0x59f045=a155_0x213229,_0x5d33aa=new Map();for(const _0x3a055a of _0x488817){_0x5d33aa['set'](_0x3a055a[_0x59f045(0x108)],_0x3a055a['id']);}return _0x5d33aa;}export function buildJourneyBundleLookupMap(_0x49a957,_0x36863c){const _0x5b7fc7=a155_0x213229,_0x459db8=new Map();for(const _0x408688 of _0x49a957){const _0xeb7d21=_0x408688['folderId']?_0x36863c['get'](_0x408688['folderId'])||'':'',_0x4ac3f8=_0xeb7d21+':'+_0x408688[_0x5b7fc7(0x1d0)];!_0x459db8['has'](_0x4ac3f8)&&_0x459db8[_0x5b7fc7(0x167)](_0x4ac3f8,[]),_0x459db8['get'](_0x4ac3f8)['push'](_0x408688);}for(const _0x561614 of _0x459db8[_0x5b7fc7(0x147)]()){_0x561614[_0x5b7fc7(0x1cf)]((_0x57a1bd,_0x5cf544)=>(_0x57a1bd['versionNumber']||0x0)-(_0x5cf544['versionNumber']||0x0));}return _0x459db8;}export function collectFoldersToCreate(_0x3658fe,_0x2b0919){const _0x23b145=a155_0x213229,_0x2fbfb6=new Set();for(const _0x3b4e03 of _0x3658fe){if(!_0x3b4e03)continue;if(_0x2b0919['has'](_0x3b4e03))continue;const _0x55bf94=_0x3b4e03[_0x23b145(0x1c1)]('/');let _0x50bf2c='';for(const _0x572215 of _0x55bf94){_0x50bf2c=_0x50bf2c?_0x50bf2c+'/'+_0x572215:_0x572215,!_0x2b0919[_0x23b145(0x184)](_0x50bf2c)&&_0x2fbfb6['add'](_0x50bf2c);}}return _0x2fbfb6;}export function parseAndClassifyYamlFiles(_0x44d12b,_0x337a3e,_0x1a9cfc){const _0x5ef72a=a155_0x213229,_0x59061b=[],_0x4c2a16=[];for(const _0x59b126 of _0x44d12b){const _0x25ba76=a155_0x55d76c[_0x5ef72a(0x1b5)](_0x337a3e,a155_0x55d76c[_0x5ef72a(0x124)](_0x59b126)),_0x6fde59=_0x25ba76==='.'?'':_0x25ba76[_0x5ef72a(0x1c6)](/\\/g,'/'),_0x5f59e7=readFileSync(_0x59b126,'utf-8'),_0x4369b8=a155_0x28f1ca[_0x5ef72a(0xf1)](_0x5f59e7);if(isJourneyDef(_0x4369b8)){const _0x48047d=a155_0x1d7fcb(_0x5f59e7);_0x4c2a16[_0x5ef72a(0x1ce)]({'yamlConfig':_0x48047d,'folderPath':_0x6fde59,'sourcePath':_0x59b126});}else{if(!_0x1a9cfc?.[_0x5ef72a(0x18b)]){const _0x5d1f34=parseSegmentYamlFile(_0x5f59e7),_0x1f97b2=normalizeChildSegmentYaml(_0x5d1f34);_0x59061b['push']({'yamlConfig':_0x1f97b2,'folderPath':_0x6fde59,'sourcePath':_0x59b126});}}}return{'segments':_0x59061b,'journeys':_0x4c2a16};}export function validateParsedFiles(_0x2ba56f,_0x4e0a6d){const _0x3a66e7=a155_0x213229,_0x1f5859=[];for(const {yamlConfig:_0x32a91a,sourcePath:_0x449f0d}of _0x2ba56f['segments']){const _0x57d301=readFileSync(_0x449f0d,'utf-8'),_0x3ecddd=a155_0x28f1ca[_0x3a66e7(0x110)](_0x57d301),_0x387630=validateSegmentDef(_0x32a91a,{'source':_0x57d301,'document':_0x3ecddd},{'skipSchema':!![]});if(!_0x387630[_0x3a66e7(0x1b1)]){const _0xc1e092=a155_0x55d76c[_0x3a66e7(0x1b5)](_0x4e0a6d,_0x449f0d);_0x1f5859[_0x3a66e7(0x1ce)]({'filePath':_0xc1e092,'source':_0x57d301,'result':_0x387630,'isJourney':![]});}}for(const {yamlConfig:_0x2dc4e5,sourcePath:_0x437b27}of _0x2ba56f[_0x3a66e7(0x132)]){const _0x2d8d5f=readFileSync(_0x437b27,_0x3a66e7(0x182)),_0x3dc6dc=a155_0x28f1ca[_0x3a66e7(0x110)](_0x2d8d5f),_0x492f14=validateJourneyDef(_0x2dc4e5,{'source':_0x2d8d5f,'document':_0x3dc6dc},{'skipSchema':!![]});if(!_0x492f14[_0x3a66e7(0x1b1)]){const _0x560027=a155_0x55d76c[_0x3a66e7(0x1b5)](_0x4e0a6d,_0x437b27);_0x1f5859[_0x3a66e7(0x1ce)]({'filePath':_0x560027,'source':_0x2d8d5f,'result':_0x492f14,'isJourney':!![]});}}return _0x1f5859;}export function formatValidationErrors(_0x44ea85){const _0x1a60f9=a155_0x213229,_0x4b0382=[];for(const {filePath:_0x5df401,source:_0x14c6b1,result:_0x8c0dc0,isJourney:_0x8692b0}of _0x44ea85){const _0x3fb47b=_0x8692b0?_0x1a60f9(0xf4):_0x1a60f9(0x175);_0x4b0382[_0x1a60f9(0x1ce)]('\x0a'+_0x5df401+'\x20('+_0x3fb47b+_0x1a60f9(0x158)+_0x8c0dc0['errors']['length']+_0x1a60f9(0x15c)),_0x4b0382['push'](formatValidationResult(_0x8c0dc0,_0x14c6b1,_0x5df401));}return _0x4b0382[_0x1a60f9(0x1bb)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x392b5c){const _0x324d5a=a155_0x213229,_0xaf5bab=new Set(),_0x39558d=new Map(),_0x2f06b2=collectSegmentUsageCounts(_0x392b5c);if(_0x392b5c[_0x324d5a(0x183)])for(const [_0x4617e9,_0x3c7744]of Object[_0x324d5a(0x12c)](_0x392b5c[_0x324d5a(0x183)])){_0xaf5bab[_0x324d5a(0x11c)](_0x4617e9);if(_0x3c7744[_0x324d5a(0xf9)]){const _0xe1ae64=yamlRuleToApi(_0x3c7744[_0x324d5a(0xf9)]),_0x444b02=apiRuleToYaml(_0xe1ae64);_0x39558d[_0x324d5a(0x167)](_0x4617e9,_0x444b02);}}const _0x248bcf=new Map();let _0x22f7e5=0x0;for(const [_0xbee8f6,_0x18a05b]of _0x39558d){const _0x50faaa=serializeExpandedRule(_0x18a05b,_0x39558d),_0x36556e=_0x248bcf[_0x324d5a(0x187)](_0x50faaa)||[];_0x36556e[_0x324d5a(0x1ce)]({'name':_0xbee8f6,'index':_0x22f7e5}),_0x248bcf[_0x324d5a(0x167)](_0x50faaa,_0x36556e),_0x22f7e5++;}const _0xf9ac7b=new Map();for(const [_0x5a84d9,_0x4ca5ac]of _0x248bcf){const _0x44aded=_0x4ca5ac[_0x324d5a(0x19d)]()[_0x324d5a(0x1cf)]((_0x4dec95,_0x572fc8)=>{const _0x5af217=_0x324d5a,_0x2309fb=_0x2f06b2[_0x5af217(0x187)](_0x4dec95['name'])||0x0,_0x16d161=_0x2f06b2['get'](_0x572fc8[_0x5af217(0x108)])||0x0;if(_0x2309fb!==_0x16d161)return _0x16d161-_0x2309fb;return _0x4dec95[_0x5af217(0x1d6)]-_0x572fc8[_0x5af217(0x1d6)];})[_0x324d5a(0x19f)](_0xbc2081=>_0xbc2081[_0x324d5a(0x108)]),_0x520492=[];for(const _0x19ac72 of _0x44aded){const _0x203719=_0x2f06b2['get'](_0x19ac72)||0x0,_0x434319=Math[_0x324d5a(0x10c)](_0x203719,0x1);for(let _0x469c57=0x0;_0x469c57<_0x434319;_0x469c57++){_0x520492[_0x324d5a(0x1ce)](_0x19ac72);}}_0xf9ac7b['set'](_0x5a84d9,_0x520492);}return{'existingLocalSegmentNames':_0xaf5bab,'localSegmentRules':_0x39558d,'localExpandedRuleToNames':_0xf9ac7b};}export function createSegmentIdResolver(_0x1ec6ed,_0x1c312e){return async _0x4211b7=>{const _0x1c5308=a155_0x27e5,_0x1d878f=_0x1ec6ed[_0x1c5308(0x187)](_0x4211b7);if(!_0x1d878f)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1c5308(0x18e)+_0x4211b7+_0x1c5308(0x17d)+_0x1c312e+'\x27)');return _0x1d878f;};}export function extractRootFolderId(_0x2465f5){const _0x1ca617=a155_0x213229;return _0x2465f5[_0x1ca617(0x126)]?.['parentSegmentFolder']?.[_0x1ca617(0x1b0)]?.['id']||_0x2465f5[_0x1ca617(0x126)]?.[_0x1ca617(0x195)]?.['data']?.['id'];}export function buildConnectionMaps(_0x5666e5){const _0x194498=a155_0x213229,_0xa30a93=new Map(),_0x3e6c44=new Map(),_0x560e27=new Map();for(const _0x391524 of _0x5666e5){_0xa30a93['set'](_0x391524['name'],parseInt(_0x391524['id'],0xa)),_0x3e6c44[_0x194498(0x167)](_0x391524['id'],_0x391524['name']),_0x560e27[_0x194498(0x167)](_0x391524['name'],_0x391524[_0x194498(0xd6)]);}return{'nameToId':_0xa30a93,'idToName':_0x3e6c44,'nameToType':_0x560e27};}export function calculatePushStats(_0x551203,_0x4a54b5,_0x18f840,_0x3c7fa1,_0x26f296,_0x4847e6,_0x58e472){const _0x12be35=a155_0x213229,_0x4869a0=_0x551203[_0x12be35(0xed)](_0x36a854=>_0x36a854[_0x12be35(0xee)]),_0x346373=_0x551203[_0x12be35(0xed)](_0x36c3f2=>!_0x36c3f2['isNew']&&_0x36c3f2[_0x12be35(0x117)]),_0x32af35=_0x551203[_0x12be35(0xed)](_0x295c51=>!_0x295c51['isNew']&&!_0x295c51['hasChanges']),_0x3d980a=_0x4847e6?_0x3c7fa1:[],_0x7a5a4f=_0x4a54b5[_0x12be35(0xed)](_0x552a8e=>_0x552a8e[_0x12be35(0xee)]),_0x5b8595=_0x4a54b5[_0x12be35(0xed)](_0x591559=>!_0x591559[_0x12be35(0xee)]&&_0x591559['hasChanges']),_0x244864=_0x4a54b5[_0x12be35(0xed)](_0x1a3ef0=>!_0x1a3ef0[_0x12be35(0xee)]&&!_0x1a3ef0[_0x12be35(0x117)]),_0x123269=_0x4847e6?_0x26f296:[],_0xd2c5ca=_0x551203[_0x12be35(0x1aa)](_0x1ddffa=>_0x1ddffa[_0x12be35(0x16a)]),_0x595834=_0xd2c5ca[_0x12be35(0xed)](_0x2ea189=>_0x2ea189[_0x12be35(0xd6)]===_0x12be35(0x14d)),_0x4ef877=_0xd2c5ca['filter'](_0x534996=>_0x534996[_0x12be35(0xd6)]===_0x12be35(0x152)),_0x3848cf=_0xd2c5ca['filter'](_0x5c4845=>_0x5c4845[_0x12be35(0xd6)]===_0x12be35(0x16b)),_0x27d2aa=Array[_0x12be35(0x12f)](_0x18f840)['sort'](),_0x138dc6=_0x58e472?![]:_0x4869a0[_0x12be35(0x176)]>0x0||_0x346373[_0x12be35(0x176)]>0x0||_0x3d980a[_0x12be35(0x176)]>0x0,_0x2b3cb8=_0x7a5a4f['length']>0x0||_0x5b8595['length']>0x0||_0x123269[_0x12be35(0x176)]>0x0,_0x5a83ad=_0x58e472?![]:_0xd2c5ca[_0x12be35(0x176)]>0x0,_0x34d59a=_0x27d2aa[_0x12be35(0x176)]>0x0;return{'segments':{'new':_0x4869a0,'changed':_0x346373,'unchanged':_0x32af35,'toDelete':_0x3d980a},'journeys':{'new':_0x7a5a4f,'changed':_0x5b8595,'unchanged':_0x244864,'toDelete':_0x123269},'activations':{'all':_0xd2c5ca,'toCreate':_0x595834,'toUpdate':_0x4ef877,'toDelete':_0x3848cf},'folders':{'toCreate':_0x27d2aa},'counts':{'segments':{'new':_0x4869a0[_0x12be35(0x176)],'changed':_0x346373['length'],'unchanged':_0x32af35[_0x12be35(0x176)],'toDelete':_0x3d980a['length']},'journeys':{'new':_0x7a5a4f[_0x12be35(0x176)],'changed':_0x5b8595['length'],'unchanged':_0x244864[_0x12be35(0x176)],'toDelete':_0x123269[_0x12be35(0x176)]},'activations':{'create':_0x595834[_0x12be35(0x176)],'update':_0x4ef877[_0x12be35(0x176)],'delete':_0x3848cf[_0x12be35(0x176)]},'folders':_0x27d2aa[_0x12be35(0x176)]},'hasChanges':_0x138dc6||_0x2b3cb8||_0x5a83ad||_0x34d59a};}export async function buildPushExecutionContext(_0x6b917,_0x4dbdc9,_0xf28d38,_0x1fb066,_0x4ceda3,_0x4fc666){const _0x13e2c2=a155_0x213229,_0x571819=extractRootFolderId(_0xf28d38),{pathToId:_0x178b77,idToPath:_0x4ea740}=buildFolderMaps(_0x4ceda3),_0x1b9c0e=buildSegmentNameToIdMap(_0x1fb066),_0x12ff8b=new Map(),{batchAsync:_0x804e49}=await import(_0x13e2c2(0x1a6)),[_0x493fd8,_0x1558cb]=await Promise[_0x13e2c2(0x120)]([_0x6b917[_0x13e2c2(0xeb)][_0x13e2c2(0x142)](),_0x6b917[_0x13e2c2(0x196)][_0x13e2c2(0x18d)](),((async()=>{!_0x4fc666&&_0x1fb066['length']>0x0&&await _0x804e49(_0x1fb066,async _0x5f3111=>{const _0x16039c=a155_0x27e5,_0x59115e=await _0x6b917[_0x16039c(0x175)][_0x16039c(0x1c3)](_0x4dbdc9,_0x5f3111['id']);_0x12ff8b['set'](_0x5f3111['id'],_0x59115e);});})())]),{emailToId:_0x5d2f2d,idToEmail:_0x30dc23}=_0x493fd8,_0x1ea8c7=buildConnectionMaps(_0x1558cb);return{'rootFolderId':_0x571819,'folderPathToId':_0x178b77,'folderIdToPath':_0x4ea740,'segmentNameToId':_0x1b9c0e,'activationsBySegmentId':_0x12ff8b,'emailToIdMap':_0x5d2f2d,'idToEmailMap':_0x30dc23,'connectionNameToIdMap':_0x1ea8c7[_0x13e2c2(0x197)],'connectionIdToNameMap':_0x1ea8c7['idToName'],'connectionNameToTypeMap':_0x1ea8c7[_0x13e2c2(0x17a)]};}export function createPushYamlContextForBundle(_0x46ab93,_0x12018f,_0x24bf27,_0x50306c,_0x4b29ea,_0x380816,_0x33478e,_0x4e256d){const {existingLocalSegmentNames:_0x231de0,localExpandedRuleToNames:_0x2b7b2b}=_0x50306c,_0x52908f=new Set(),_0x5b0b5e=new Map(),_0x9d9f5f=new Map(),_0x4e81db=new Map(),_0x5ddf74=createJumpTargetCache(),_0x25cba8=new Map(),_0x4665ce=new Map(),_0xa9f52f=new Set();let _0x431b18;const _0xa49d6f=_0x2db170=>{const _0x25ab7f={'resolveSegment':async _0xe5b5a3=>{const _0x184c9a=a155_0x27e5,_0x18cf6b=_0x4e81db[_0x184c9a(0x187)](_0xe5b5a3);if(_0x18cf6b!==undefined)return{'name':_0x18cf6b,'isJourneyLocal':!![]};try{const _0x2144fb=await fetchSegment(_0x46ab93,_0x12018f,_0xe5b5a3,_0x24bf27);if(!_0x2144fb)throw new Error(_0x184c9a(0x114));const _0x392b4d=generateJourneyLocalName(_0x2144fb[_0x184c9a(0x108)]),_0x328740=_0x2144fb[_0x184c9a(0x136)]===SEGMENT_KIND_JOURNEY&&_0x392b4d!==undefined;let _0x377313=_0x2144fb['name'],_0x166447;if(_0x328740&&_0x2144fb[_0x184c9a(0xf9)]){const _0x54d62a=apiRuleToYaml(_0x2144fb[_0x184c9a(0xf9)]);_0x4665ce[_0x184c9a(0x167)](_0xe5b5a3,_0x54d62a);const _0x23a6a9=async _0x4d9a98=>{const _0x42310e=_0x184c9a,_0x412cad=collectSegmentRefsFromRule(_0x4d9a98);for(const _0x48eced of _0x412cad){if(!_0x4665ce['has'](_0x48eced))try{const _0x5cf062=await fetchSegment(_0x46ab93,_0x12018f,_0x48eced,_0x24bf27);if(_0x5cf062?.[_0x42310e(0xf9)]){const _0x3c134d=apiRuleToYaml(_0x5cf062['rule']);_0x4665ce[_0x42310e(0x167)](_0x48eced,_0x3c134d),await _0x23a6a9(_0x3c134d);}}catch(_0x328388){logger[_0x42310e(0xd8)](_0x42310e(0x155)+_0x48eced+':\x20'+_0x328388);}}};await _0x23a6a9(_0x54d62a);const _0x1cb75e=serializeExpandedRule(_0x54d62a,_0x4665ce),_0x7fd6ee=_0x2b7b2b['get'](_0x1cb75e);if(_0x7fd6ee&&_0x7fd6ee[_0x184c9a(0x176)]>0x0){const _0x3ddb81=_0x5b0b5e[_0x184c9a(0x187)](_0x1cb75e)||0x0,_0x451f70=_0x7fd6ee[_0x3ddb81]||_0x7fd6ee[_0x7fd6ee['length']-0x1];_0x5b0b5e[_0x184c9a(0x167)](_0x1cb75e,_0x3ddb81+0x1),_0x377313=_0x451f70,_0x52908f[_0x184c9a(0x11c)](_0x377313),_0x4e81db['set'](_0xe5b5a3,_0x377313);const _0x488e7f=await resolveRuleSegmentRefs(_0x54d62a,async _0x4ad729=>{const _0x5299ce=_0x4e81db['get'](_0x4ad729);if(_0x5299ce)return _0x5299ce;const _0x124e0b=await _0x431b18['resolveSegment'](_0x4ad729);return _0x124e0b['name'];});_0x166447={'description':_0x2144fb['description'],'rule':_0x488e7f};}else{const _0x410609=_0x25cba8[_0x184c9a(0x187)](_0x1cb75e);if(_0x410609)_0x377313=_0x410609,_0x4e81db[_0x184c9a(0x167)](_0xe5b5a3,_0x377313);else{if(_0x392b4d){let _0x5a9921=_0x392b4d,_0x8d9219=0x2;while(_0x52908f['has'](_0x5a9921)||_0x231de0[_0x184c9a(0x184)](_0x5a9921)){_0x5a9921=_0x392b4d+'_'+_0x8d9219,_0x8d9219++;}_0x52908f['add'](_0x5a9921),_0x377313=_0x5a9921;}_0x4e81db[_0x184c9a(0x167)](_0xe5b5a3,_0x377313),_0x25cba8['set'](_0x1cb75e,_0x377313);const _0x433bbc=await resolveRuleSegmentRefs(_0x54d62a,async _0x305de6=>{const _0x243a90=_0x184c9a,_0x58481b=_0x4e81db['get'](_0x305de6);if(_0x58481b)return _0x58481b;const _0xea834a=await _0x431b18[_0x243a90(0x1c5)](_0x305de6);return _0xea834a[_0x243a90(0x108)];});_0x166447={'description':_0x2144fb['description'],'rule':_0x433bbc};}}}return{'name':_0x377313,'isJourneyLocal':_0x328740,'definition':_0x166447};}catch(_0x580261){return logger[_0x184c9a(0xd8)](_0x184c9a(0x149)+_0xe5b5a3+':\x20'+_0x580261),{'name':_0xe5b5a3,'isJourneyLocal':![]};}},'resolveActivation':async _0x6fe9f3=>{const _0x33f1e7=a155_0x27e5,_0xceacc=_0x9d9f5f[_0x33f1e7(0x187)](_0x6fe9f3);if(_0xceacc!==undefined)return{'name':_0xceacc,'isJourneyLocal':!![]};try{let _0x2badf7=_0x33478e?.['get'](_0x6fe9f3);!_0x2badf7&&(_0x2badf7=await _0x46ab93[_0x33f1e7(0xf4)]['getActivation'](_0x2db170,_0x6fe9f3));const _0x62de98=_0x2badf7[_0x33f1e7(0x1b6)][_0x33f1e7(0x13c)][_0x33f1e7(0x108)]||_0x6fe9f3,_0x437c39=sanitizeYamlKey(_0x62de98)||'activation_'+_0x6fe9f3,_0x33c2b3=_0x437c39;_0x9d9f5f['set'](_0x6fe9f3,_0x33c2b3);const _0x4c5e89=journeyActivationStepToYaml(_0x2badf7,_0x4b29ea,_0x380816);return{'name':_0x33c2b3,'isJourneyLocal':!![],'definition':_0x4c5e89};}catch(_0x8c1cd6){return logger[_0x33f1e7(0xd8)]('Failed\x20to\x20resolve\x20activation\x20'+_0x6fe9f3+':\x20'+_0x8c1cd6),{'name':_0x6fe9f3,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x121e52,_0x230993)=>resolveJumpTarget(_0x121e52,_0x230993,_0x5ddf74,async _0x2f3b19=>{const _0x486e79=a155_0x27e5,_0xe66947=_0x4e256d?.[_0x486e79(0x187)](_0x2f3b19);if(_0xe66947)return _0xe66947;return _0x46ab93[_0x486e79(0xf4)]['getJourney'](_0x2f3b19);})};return _0x431b18=_0x25ab7f,_0x25ab7f;},_0x40d546=async _0x3e9c9f=>{const _0x34ab8b=a155_0x27e5,{collectSegmentIdsFromJourneyApi:_0x59320f}=await import('./journey-yaml.js'),{batchAsync:_0x2edd42}=await import(_0x34ab8b(0x1a6)),_0x40801b=new Set();for(const _0x41725b of _0x3e9c9f){let _0x4cd8a1=_0x4e256d?.['get'](_0x41725b);!_0x4cd8a1&&(_0x4cd8a1=await _0x46ab93['journey'][_0x34ab8b(0x1a2)](_0x41725b));const _0x3a8342=_0x59320f(_0x4cd8a1);for(const _0x483f43 of _0x3a8342){_0x40801b[_0x34ab8b(0x11c)](_0x483f43);}}let _0x14a511=Array['from'](_0x40801b);while(_0x14a511[_0x34ab8b(0x176)]>0x0){const _0x3d875c=_0x14a511[_0x34ab8b(0xed)](_0x279e21=>!_0xa9f52f[_0x34ab8b(0x184)](_0x279e21));if(_0x3d875c[_0x34ab8b(0x176)]===0x0)break;const _0x57823c=await _0x2edd42(_0x3d875c,async _0xc88a63=>{const _0x43aec2=_0x34ab8b;_0xa9f52f[_0x43aec2(0x11c)](_0xc88a63);const _0x2ae162=await fetchSegment(_0x46ab93,_0x12018f,_0xc88a63,_0x24bf27);if(!_0x2ae162)return null;return{'segmentId':_0xc88a63,'segment':_0x2ae162};},0xa),_0x3f28a5=new Set();for(const _0x4e053a of _0x57823c){if(!_0x4e053a?.[_0x34ab8b(0x175)]?.['rule'])continue;const _0x5d11f7=apiRuleToYaml(_0x4e053a[_0x34ab8b(0x175)]['rule']);_0x4665ce[_0x34ab8b(0x167)](_0x4e053a[_0x34ab8b(0x133)],_0x5d11f7);const _0x3c7b1a=collectSegmentRefsFromRule(_0x5d11f7);for(const _0x5ccd6a of _0x3c7b1a){!_0xa9f52f[_0x34ab8b(0x184)](_0x5ccd6a)&&_0x3f28a5[_0x34ab8b(0x11c)](_0x5ccd6a);}}_0x14a511=Array[_0x34ab8b(0x12f)](_0x3f28a5);}};return{'createYamlContext':_0xa49d6f,'prefetchJourneySegments':_0x40d546};}export async function executePushSegments(_0x278ba3,_0x9a95f4,_0xbea0ec,_0x1be8ad,_0x322cd8){const _0x663900=a155_0x213229,{segmentDefToCreateRequest:_0xb2ee73,segmentDefToUpdateRequest:_0x59066a}=await import(_0x663900(0xf3)),_0x1dcf17=_0xbea0ec['folderPathToId'],_0xff1961=0x5,_0x336198=async _0x9828d6=>{const _0x54d707=_0x663900,_0x13c7fa=_0x9828d6[_0x54d707(0x1cc)]?_0x1dcf17['get'](_0x9828d6[_0x54d707(0x1cc)]):undefined;let _0x50345;const _0x29aa91={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x377114=_0x9828d6[_0x54d707(0x148)];if(_0x9828d6[_0x54d707(0x148)][_0x54d707(0xf9)]){const _0x372a03=createSegmentIdResolver(_0xbea0ec['segmentNameToId'],_0x9828d6[_0x54d707(0x148)]['name']),_0x1b57e3=await resolveRuleSegmentIds(_0x9828d6['yamlConfig'][_0x54d707(0xf9)],_0x372a03);_0x377114={..._0x9828d6[_0x54d707(0x148)],'rule':_0x1b57e3};}try{if(_0x9828d6[_0x54d707(0xee)]){_0x322cd8[_0x54d707(0xf8)]?.({'type':_0x54d707(0x17b),'name':_0x9828d6['yamlConfig'][_0x54d707(0x108)]});const _0x2f962f=_0xb2ee73(_0x377114,_0x13c7fa),_0xc2a191=await _0x322cd8['withProgress'](_0x54d707(0x190)+_0x9828d6['yamlConfig']['name']+_0x54d707(0x173),()=>_0x278ba3[_0x54d707(0x175)][_0x54d707(0x192)](_0x1be8ad[_0x54d707(0x10f)],_0x2f962f));_0x50345=_0xc2a191[_0x54d707(0x1b0)]['id'],_0xbea0ec[_0x54d707(0x1a1)][_0x54d707(0x167)](_0x9828d6[_0x54d707(0x148)][_0x54d707(0x108)],_0x50345),_0x29aa91['createdSegmentId']={'name':_0x9828d6['yamlConfig'][_0x54d707(0x108)],'id':_0x50345},_0x322cd8[_0x54d707(0xf8)]?.({'type':_0x54d707(0x19e),'name':_0x9828d6['yamlConfig'][_0x54d707(0x108)],'segmentId':_0x50345}),_0x322cd8[_0x54d707(0xfd)]?.(_0x54d707(0xf6)+_0x9828d6[_0x54d707(0x148)][_0x54d707(0x108)]+'\x27'),_0x29aa91[_0x54d707(0x122)]=0x1;}else{if(_0x9828d6[_0x54d707(0x117)]){_0x322cd8[_0x54d707(0xf8)]?.({'type':'segment_updating','name':_0x9828d6[_0x54d707(0x148)]['name']});const _0x25c173=_0x59066a(_0x377114);_0x13c7fa!==_0x9828d6['existingSegment']?.['segmentFolderId']&&(_0x25c173[_0x54d707(0x1be)]=_0x13c7fa?parseInt(_0x13c7fa,0xa):undefined),await _0x322cd8['withProgress'](_0x54d707(0x11b)+_0x9828d6[_0x54d707(0x148)]['name']+_0x54d707(0x173),()=>_0x278ba3[_0x54d707(0x175)][_0x54d707(0x1b8)](_0x1be8ad[_0x54d707(0x10f)],_0x9828d6[_0x54d707(0x14a)]['id'],_0x25c173)),_0x50345=_0x9828d6[_0x54d707(0x14a)]['id'],_0x322cd8[_0x54d707(0xf8)]?.({'type':_0x54d707(0x10e),'name':_0x9828d6[_0x54d707(0x148)][_0x54d707(0x108)]}),_0x322cd8[_0x54d707(0xfd)]?.(_0x54d707(0x171)+_0x9828d6[_0x54d707(0x148)][_0x54d707(0x108)]+'\x27'),_0x29aa91['updated']=0x1;}else _0x50345=_0x9828d6[_0x54d707(0x14a)]['id'];}}catch(_0x2b9ffa){const _0x2dd1ff=isHttp400Error(_0x2b9ffa),_0x4855c4=_0x2dd1ff?ErrorCode[_0x54d707(0x130)]:ErrorCode[_0x54d707(0x11d)],_0x5eb40a=getErrorMessage(_0x2b9ffa);throw new SDKError(_0x4855c4,_0x54d707(0x19c)+(_0x9828d6[_0x54d707(0xee)]?'create':_0x54d707(0x152))+'\x20segment\x20from\x20file:\x20'+_0x9828d6[_0x54d707(0x144)]+_0x54d707(0x1a0)+_0x5eb40a,_0x2b9ffa);}try{const _0x5f40bd=await syncActivationsForSegment(_0x278ba3,_0x1be8ad[_0x54d707(0x10f)],_0x50345,_0x9828d6[_0x54d707(0x148)][_0x54d707(0x108)],_0x9828d6[_0x54d707(0x16a)],_0x322cd8,_0x9828d6[_0x54d707(0x144)]);_0x29aa91[_0x54d707(0x13e)]=_0x5f40bd;}catch(_0x34562b){if(_0x34562b instanceof SDKError)throw _0x34562b;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x9828d6[_0x54d707(0x148)][_0x54d707(0x108)]+'\x27\x20from\x20file:\x20'+_0x9828d6['absolutePath']+_0x54d707(0x1a0)+getErrorMessage(_0x34562b),_0x34562b);}return _0x29aa91;},_0x2d1a15=await batchAsync(_0x9a95f4,_0x336198,_0xff1961),_0x53501c={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x3e85e2 of _0x2d1a15){_0x53501c[_0x663900(0x122)]+=_0x3e85e2[_0x663900(0x122)],_0x53501c[_0x663900(0x123)]+=_0x3e85e2[_0x663900(0x123)],_0x3e85e2[_0x663900(0x1d4)]&&_0x53501c['createdSegmentIds']['set'](_0x3e85e2[_0x663900(0x1d4)][_0x663900(0x108)],_0x3e85e2[_0x663900(0x1d4)]['id']),_0x53501c['activations'][_0x663900(0x122)]+=_0x3e85e2[_0x663900(0x13e)][_0x663900(0x122)],_0x53501c[_0x663900(0x13e)][_0x663900(0x123)]+=_0x3e85e2['activations'][_0x663900(0x123)],_0x53501c[_0x663900(0x13e)][_0x663900(0x128)]+=_0x3e85e2[_0x663900(0x13e)][_0x663900(0x128)];}return _0x53501c;}async function syncActivationsForSegment(_0x45881e,_0x96c86e,_0x19a0ec,_0x2a5972,_0x2e4297,_0x8a13f4,_0x767cb1){const _0x5d54f4=a155_0x213229,_0x551caf={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x24b972 of _0x2e4297){try{if(_0x24b972[_0x5d54f4(0xd6)]===_0x5d54f4(0x14d)&&_0x24b972['validatedRequest'])_0x8a13f4['onProgress']?.({'type':_0x5d54f4(0x12a),'segmentName':_0x2a5972,'activationName':_0x24b972[_0x5d54f4(0x108)]}),await _0x8a13f4[_0x5d54f4(0x12d)](_0x5d54f4(0x162)+_0x24b972['name']+_0x5d54f4(0x173),()=>_0x45881e[_0x5d54f4(0x175)][_0x5d54f4(0x103)](_0x96c86e,_0x19a0ec,_0x24b972[_0x5d54f4(0x11e)])),_0x8a13f4['onProgress']?.({'type':'activation_created','segmentName':_0x2a5972,'activationName':_0x24b972[_0x5d54f4(0x108)]}),_0x8a13f4[_0x5d54f4(0xfd)]?.('Created\x20activation\x20\x27'+_0x24b972['name']+'\x27'),_0x551caf['created']++;else{if(_0x24b972[_0x5d54f4(0xd6)]==='update'&&_0x24b972['validatedRequest']&&_0x24b972['existingActivation'])_0x8a13f4['onProgress']?.({'type':_0x5d54f4(0x169),'segmentName':_0x2a5972,'activationName':_0x24b972['name']}),await _0x8a13f4[_0x5d54f4(0x12d)](_0x5d54f4(0x1ac)+_0x24b972[_0x5d54f4(0x108)]+_0x5d54f4(0x173),()=>_0x45881e[_0x5d54f4(0x175)][_0x5d54f4(0x10d)](_0x96c86e,_0x19a0ec,_0x24b972['existingActivation']['id'],_0x24b972[_0x5d54f4(0x11e)])),_0x8a13f4[_0x5d54f4(0xf8)]?.({'type':_0x5d54f4(0x10a),'segmentName':_0x2a5972,'activationName':_0x24b972[_0x5d54f4(0x108)]}),_0x8a13f4[_0x5d54f4(0xfd)]?.(_0x5d54f4(0x102)+_0x24b972[_0x5d54f4(0x108)]+'\x27'),_0x551caf[_0x5d54f4(0x123)]++;else _0x24b972['type']===_0x5d54f4(0x16b)&&_0x24b972['existingActivation']&&(_0x8a13f4[_0x5d54f4(0xf8)]?.({'type':'activation_deleting','segmentName':_0x2a5972,'activationName':_0x24b972[_0x5d54f4(0x108)]}),await _0x8a13f4[_0x5d54f4(0x12d)]('Deleting\x20activation\x20\x27'+_0x24b972['name']+_0x5d54f4(0x173),()=>_0x45881e[_0x5d54f4(0x175)][_0x5d54f4(0xdf)](_0x96c86e,_0x19a0ec,_0x24b972['existingActivation']['id'])),_0x8a13f4[_0x5d54f4(0xf8)]?.({'type':_0x5d54f4(0x17e),'segmentName':_0x2a5972,'activationName':_0x24b972[_0x5d54f4(0x108)]}),_0x8a13f4[_0x5d54f4(0x1c9)]?.(_0x5d54f4(0x139)+_0x24b972[_0x5d54f4(0x108)]+'\x27'),_0x551caf[_0x5d54f4(0x128)]++);}}catch(_0x306a7b){const _0x31dd3f=isHttp400Error(_0x306a7b),_0x13dd16=_0x31dd3f?ErrorCode[_0x5d54f4(0x165)]:ErrorCode[_0x5d54f4(0x1d1)],_0x33d709=getErrorMessage(_0x306a7b);throw new SDKError(_0x13dd16,'Failed\x20to\x20'+_0x24b972[_0x5d54f4(0xd6)]+_0x5d54f4(0x166)+_0x24b972[_0x5d54f4(0x108)]+'\x27\x20from\x20file:\x20'+_0x767cb1+'\x0a\x20\x20'+_0x33d709,_0x306a7b);}}return _0x551caf;}export async function executePushFolders(_0x3783a2,_0x30a42c,_0x126ce9,_0x303752,_0x2306a7){const _0x3e40c6=a155_0x213229,_0x4edef4=new Map(_0x126ce9),_0x611748=sortFoldersByDepth(_0x30a42c);for(const _0x462063 of _0x611748){const _0x27cd92=_0x462063['split']('/'),_0x13e1a6=_0x27cd92[_0x27cd92[_0x3e40c6(0x176)]-0x1],_0x5d9c60=_0x27cd92[_0x3e40c6(0x19d)](0x0,-0x1)['join']('/'),_0x2d9c7e=_0x4edef4[_0x3e40c6(0x187)](_0x5d9c60);_0x2306a7[_0x3e40c6(0xf8)]?.({'type':_0x3e40c6(0xd7),'folder':_0x462063});const _0x3bec31={'name':_0x13e1a6,'parentFolderId':_0x2d9c7e},_0x5bd1cf=await _0x2306a7['withProgress'](_0x3e40c6(0x143)+_0x462063+_0x3e40c6(0x173),()=>_0x3783a2[_0x3e40c6(0x175)][_0x3e40c6(0x145)](_0x303752[_0x3e40c6(0x10f)],_0x3bec31));_0x4edef4[_0x3e40c6(0x167)](_0x462063,_0x5bd1cf['data']['id']),_0x2306a7[_0x3e40c6(0xf8)]?.({'type':'folder_created','folder':_0x462063,'folderId':_0x5bd1cf['data']['id']}),_0x2306a7[_0x3e40c6(0x1d3)]?.(_0x3e40c6(0x100)+_0x462063+'\x27');}return _0x4edef4;}export async function executePushSegmentDeletions(_0x386d3b,_0x385a6b,_0x525f59){const _0x32e56f=a155_0x213229;if(_0x385a6b[_0x32e56f(0x176)]===0x0)return 0x0;const {batchAsync:_0x538a6d}=await import(_0x32e56f(0x1a6)),_0x43556c=0x5,_0x289715=await _0x538a6d(_0x385a6b,async _0x10ae73=>{const _0x978c85=_0x32e56f;return _0x525f59[_0x978c85(0xf8)]?.({'type':_0x978c85(0xf0),'name':_0x10ae73[_0x978c85(0x108)]}),await _0x386d3b[_0x978c85(0x175)][_0x978c85(0x1bc)](_0x10ae73['id']),_0x525f59[_0x978c85(0xf8)]?.({'type':_0x978c85(0x189),'name':_0x10ae73[_0x978c85(0x108)]}),_0x525f59[_0x978c85(0x1c9)]?.('Deleted\x20segment\x20\x27'+_0x10ae73[_0x978c85(0x108)]+'\x27'),0x1;},_0x43556c);return _0x289715[_0x32e56f(0x14b)]((_0x12d319,_0x20cd64)=>_0x12d319+_0x20cd64,0x0);}export async function executePushJourneys(_0x512588,_0x457d12,_0x267198,_0x557334,_0xbe3f3a){const _0x1d4bcd=a155_0x213229,{journeyDefToRequest:_0x5629ee}=await import('./journey-yaml.js'),{activationDefToCreateRequest:_0x329003,yamlRuleToApi:_0xd251b7,validateSegmentRule:_0x234a3e}=await import(_0x1d4bcd(0xf3)),_0x26b609={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x48de8a=new Map(_0x267198[_0x1d4bcd(0x1a1)]),_0x151f94=0x5;for(let _0x3c45ea=0x0;_0x3c45ea<_0x457d12[_0x1d4bcd(0x176)];_0x3c45ea+=_0x151f94){const _0x5b92f9=_0x457d12[_0x1d4bcd(0x19d)](_0x3c45ea,_0x3c45ea+_0x151f94),_0x327843=await Promise['all'](_0x5b92f9[_0x1d4bcd(0x19f)](async _0x3881a9=>{const _0x13bc9c=_0x1d4bcd;if(!_0x3881a9['isNew']&&!_0x3881a9[_0x13bc9c(0x117)])return{'action':_0x13bc9c(0x199),'name':_0x3881a9[_0x13bc9c(0x148)][_0x13bc9c(0x108)],'journeyId':_0x3881a9[_0x13bc9c(0x191)]?.['id']};const _0x50f922=_0x3881a9[_0x13bc9c(0x1cc)]?_0x267198[_0x13bc9c(0x18c)]['get'](_0x3881a9['folderPath']):undefined;_0xbe3f3a[_0x13bc9c(0xf8)]?.({'type':_0x3881a9[_0x13bc9c(0xee)]?'journey_creating':_0x13bc9c(0xf2),'name':_0x3881a9['yamlConfig'][_0x13bc9c(0x108)]});try{const _0x5ba75a=await executeSingleJourneyPush(_0x512588,_0x3881a9,{..._0x267198,'segmentNameToId':_0x48de8a},{'parentId':_0x557334[_0x13bc9c(0x10f)],'rootFolderId':_0x557334['rootFolderId'],'folderId':_0x50f922,'verbose':_0x557334[_0x13bc9c(0x11f)]},_0xbe3f3a,{'journeyDefToRequest':_0x5629ee,'activationDefToCreateRequest':_0x329003,'yamlRuleToApi':_0xd251b7,'validateSegmentRule':_0x234a3e});for(const [_0x19ea73,_0x3391c1]of _0x5ba75a[_0x13bc9c(0x1ab)]){_0x48de8a[_0x13bc9c(0x167)](_0x19ea73,_0x3391c1),_0x26b609[_0x13bc9c(0x1ab)][_0x13bc9c(0x167)](_0x19ea73,_0x3391c1);}if(_0x5ba75a['action']==='created')_0xbe3f3a[_0x13bc9c(0xf8)]?.({'type':_0x13bc9c(0x134),'name':_0x3881a9[_0x13bc9c(0x148)][_0x13bc9c(0x108)],'journeyId':_0x5ba75a[_0x13bc9c(0x140)]}),_0xbe3f3a['logSuccess']?.(_0x13bc9c(0x19b)+_0x3881a9[_0x13bc9c(0x148)]['name']+'\x27'),_0x26b609['created']++;else _0x5ba75a['action']===_0x13bc9c(0x123)&&(_0xbe3f3a['onProgress']?.({'type':_0x13bc9c(0x115),'name':_0x3881a9[_0x13bc9c(0x148)]['name']}),_0xbe3f3a[_0x13bc9c(0xfd)]?.('Updated\x20journey\x20\x27'+_0x3881a9[_0x13bc9c(0x148)][_0x13bc9c(0x108)]+'\x27'),_0x26b609['updated']++);return{'action':_0x5ba75a[_0x13bc9c(0x179)],'name':_0x3881a9[_0x13bc9c(0x148)]['name'],'journeyId':_0x5ba75a[_0x13bc9c(0x140)]};}catch(_0xb7ed5c){const _0x36585b=isHttp400Error(_0xb7ed5c),_0x7cded4=_0x36585b?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x3ef7b4=getErrorMessage(_0xb7ed5c);throw new SDKError(_0x7cded4,_0x13bc9c(0x19c)+(_0x3881a9[_0x13bc9c(0xee)]?_0x13bc9c(0x14d):'update')+_0x13bc9c(0x1d5)+_0x3881a9[_0x13bc9c(0x144)]+_0x13bc9c(0x1a0)+_0x3ef7b4,_0xb7ed5c);}}));_0x26b609[_0x1d4bcd(0x1cd)][_0x1d4bcd(0x1ce)](..._0x327843);}return _0x26b609;}async function matchExistingJourneySegments(_0x43fc03,_0x274674,_0x3586cf,_0x410fdb,_0x1a6db7){const _0x4c050d=a155_0x213229;if(!_0x274674[_0x4c050d(0x191)]||!_0x274674[_0x4c050d(0x148)]['segments'])return;const _0x58fa94=new Map(),_0x5016f3=new Set();for(const _0x1c874e of Object['keys'](_0x274674[_0x4c050d(0x148)][_0x4c050d(0x183)])){const _0x48be4a=generateDeterministicJourneySegmentName(_0x274674[_0x4c050d(0x148)]['name'],_0x1c874e);_0x58fa94['set'](_0x48be4a,_0x1c874e),_0x5016f3[_0x4c050d(0x11c)](_0x1c874e);}const _0x35ec3e=[],_0x57d06a=collectSegmentIdsFromJourneyApi(_0x274674['existingJourney']);for(const _0x92a1f2 of _0x57d06a){const _0x56b2b4=await fetchSegment(_0x43fc03,_0x3586cf,_0x92a1f2,_0x410fdb);if(!_0x56b2b4?.[_0x4c050d(0x108)])continue;const _0x43f267=_0x58fa94['get'](_0x56b2b4[_0x4c050d(0x108)]);_0x43f267?(_0x1a6db7[_0x4c050d(0x167)](_0x43f267,_0x92a1f2),_0x5016f3[_0x4c050d(0x16b)](_0x43f267)):_0x35ec3e[_0x4c050d(0x1ce)]({'id':_0x92a1f2,'seg':_0x56b2b4});}if(_0x5016f3[_0x4c050d(0x16d)]>0x0&&_0x35ec3e[_0x4c050d(0x176)]>0x0){const {localExpandedRuleToNames:_0x214b09}=buildLocalExpandedRuleMappings(_0x274674[_0x4c050d(0x148)]),_0x334bf4=new Map();for(const {id:_0x5a23ea,seg:_0xfcbdab}of _0x35ec3e){if(_0xfcbdab[_0x4c050d(0xf9)]){const _0x51da08=apiRuleToYaml(_0xfcbdab['rule']);_0x334bf4['set'](_0x5a23ea,_0x51da08);}}for(const {id:_0x1b3fe6,seg:_0xdb296e}of _0x35ec3e){if(!_0xdb296e[_0x4c050d(0xf9)])continue;const _0x1e36e2=_0x334bf4['get'](_0x1b3fe6);if(!_0x1e36e2)continue;const _0x5edcb0=serializeExpandedRule(_0x1e36e2,_0x334bf4),_0x642961=_0x214b09[_0x4c050d(0x187)](_0x5edcb0);if(_0x642961){const _0x4664aa=_0x642961[_0x4c050d(0xd5)](_0x672fa=>_0x5016f3[_0x4c050d(0x184)](_0x672fa));_0x4664aa&&(_0x1a6db7[_0x4c050d(0x167)](_0x4664aa,_0x1b3fe6),_0x5016f3['delete'](_0x4664aa),logger['debug'](_0x4c050d(0x138)+_0xdb296e[_0x4c050d(0x108)]+'\x27\x20to\x20local\x20\x27'+_0x4664aa+_0x4c050d(0xec)));}}}}async function executeSingleJourneyPush(_0x2d3f2a,_0x6b57c4,_0x4a4be9,_0x11202d,_0x44e193,_0x23c079){const _0x30a47e=a155_0x213229,{journeyDefToRequest:_0x3a7ebb,activationDefToCreateRequest:_0x26e042,yamlRuleToApi:_0x387fc0,validateSegmentRule:_0x480258}=_0x23c079,_0x134110=new Map(),_0x325734=new Map();recoverSegmentIdsFromPushRecovery(_0x6b57c4,_0x134110,_0x4a4be9['segmentNameToId']);const _0x15bca5=new Map(),_0x3e5b44=new Map(),_0x25fa30=new Map();let _0x11ad7a;const _0x39fd37=async()=>{const _0x5302ae=a155_0x27e5;if(_0x11ad7a)return;_0x11ad7a=new Map();if(!_0x6b57c4['existingJourney'])return;const _0x5a9b7c=await _0x2d3f2a[_0x5302ae(0xf4)][_0x5302ae(0x1c3)](_0x6b57c4['existingJourney']['id']);for(const _0x136d55 of _0x5a9b7c){const _0x1edf4e=journeyActivationStepToYaml(_0x136d55,_0x4a4be9['idToEmailMap'],_0x4a4be9[_0x5302ae(0x1a7)]),_0x56b2a7=activationSignature(_0x1edf4e);!_0x11ad7a[_0x5302ae(0x184)](_0x56b2a7)&&_0x11ad7a[_0x5302ae(0x167)](_0x56b2a7,_0x136d55['id']),_0x1edf4e['name']&&_0x325734[_0x5302ae(0x167)](_0x1edf4e[_0x5302ae(0x108)],_0x136d55['id']);}};await matchExistingJourneySegments(_0x2d3f2a,_0x6b57c4,_0x11202d[_0x30a47e(0x10f)],_0x4a4be9[_0x30a47e(0x1a3)],_0x4a4be9['segmentNameToId']);const _0x46bed7={'resolveSegmentId':async _0x3d6954=>{const _0x5627d5=_0x30a47e,_0x34d698=_0x4a4be9[_0x5627d5(0x1a1)][_0x5627d5(0x187)](_0x3d6954);if(!_0x34d698)throw new SDKError(ErrorCode[_0x5627d5(0x198)],'Segment\x20not\x20found:\x20'+_0x3d6954+_0x5627d5(0x104)+_0x6b57c4[_0x5627d5(0x148)][_0x5627d5(0x108)]+')');return _0x34d698;},'resolveEmbeddedSegmentId':async(_0x3f7746,_0x4b4b2f)=>{const _0x3674fb=_0x30a47e,_0x1d4abf=_0x4a4be9[_0x3674fb(0x1a1)][_0x3674fb(0x187)](_0x3f7746);if(_0x1d4abf)return _0x1d4abf;const _0x5780ba=_0x4a4be9[_0x3674fb(0x1a3)]['find'](_0x19fd18=>_0x19fd18['name']===_0x3f7746);if(_0x5780ba)return _0x4a4be9[_0x3674fb(0x1a1)][_0x3674fb(0x167)](_0x3f7746,_0x5780ba['id']),_0x5780ba['id'];if(_0x6b57c4[_0x3674fb(0xee)]){const {stageName:_0x1a3cb2,criteriaName:_0x1fec91}=findSegmentCriteriaLocation(_0x6b57c4[_0x3674fb(0x148)],_0x3f7746);return _0x480258(_0x3f7746,_0x4b4b2f['rule']),_0x3e5b44[_0x3674fb(0x167)](_0x3f7746,{'definition':_0x4b4b2f,'stageName':_0x1a3cb2,'criteriaName':_0x1fec91}),createPendingSegmentId(_0x3f7746);}const _0x3790cc=_0x6b57c4[_0x3674fb(0x191)]?.['id'];if(!_0x3790cc)throw new SDKError(ErrorCode[_0x3674fb(0x170)],_0x3674fb(0x13a));const _0x4ffd7a=_0x15bca5[_0x3674fb(0x187)](_0x3f7746);if(_0x4ffd7a)return _0x4ffd7a;const _0x55c107=((async()=>{const _0x1efcbe=_0x3674fb;_0x480258(_0x3f7746,_0x4b4b2f[_0x1efcbe(0xf9)]);const _0x3ba2e4=generateDeterministicJourneySegmentName(_0x6b57c4[_0x1efcbe(0x148)][_0x1efcbe(0x108)],_0x3f7746),_0x2747b0=_0x4a4be9[_0x1efcbe(0x1a3)][_0x1efcbe(0xd5)](_0x32b5b5=>_0x32b5b5[_0x1efcbe(0x108)]===_0x3ba2e4),_0x5bb42d=createSegmentIdResolver(_0x4a4be9[_0x1efcbe(0x1a1)],_0x3f7746),_0x53c752=await resolveRuleSegmentIds(_0x4b4b2f[_0x1efcbe(0xf9)],_0x5bb42d);let _0x5a74a3;return _0x2747b0?(await _0x2d3f2a['segment'][_0x1efcbe(0x1b8)](_0x11202d['parentId'],_0x2747b0['id'],{'description':_0x4b4b2f[_0x1efcbe(0x177)]||'Entry\x20criteria:\x20'+_0x3f7746,'rule':_0x387fc0(_0x53c752),'countPopulation':!![]}),_0x5a74a3=_0x2747b0['id'],saveSegmentToPushRecovery(_0x6b57c4['absolutePath'],_0x6b57c4['yamlConfig'][_0x1efcbe(0x108)],_0x3f7746,{'segmentId':_0x5a74a3,'uniqueServerName':_0x3ba2e4,'createdAt':new Date()['toISOString']()})):_0x5a74a3=await createOrRecoverEmbeddedSegment(_0x2d3f2a,_0x6b57c4,{'localName':_0x3f7746,'uniqueSegmentName':_0x3ba2e4,'description':_0x4b4b2f[_0x1efcbe(0x177)]||'Entry\x20criteria:\x20'+_0x3f7746,'journeyId':_0x3790cc,'resolvedRule':_0x53c752,'parentId':_0x11202d[_0x1efcbe(0x10f)],'folderId':_0x11202d[_0x1efcbe(0x137)]||''},_0x387fc0),_0x4a4be9[_0x1efcbe(0x1a1)][_0x1efcbe(0x167)](_0x3f7746,_0x5a74a3),_0x134110['set'](_0x3f7746,_0x5a74a3),_0x5a74a3;})());_0x15bca5[_0x3674fb(0x167)](_0x3f7746,_0x55c107);try{return await _0x55c107;}finally{_0x15bca5['delete'](_0x3f7746);}},'resolveActivationId':async _0x587814=>{const _0x4e199b=_0x30a47e,_0xf25c0e=_0x325734[_0x4e199b(0x187)](_0x587814);if(_0xf25c0e)return _0xf25c0e;if(_0x6b57c4[_0x4e199b(0x191)]){await _0x39fd37();const _0x5528ea=_0x325734[_0x4e199b(0x187)](_0x587814);if(_0x5528ea)return _0x5528ea;}throw new SDKError(ErrorCode['NOT_FOUND'],'Activation\x20not\x20found:\x20'+_0x587814+_0x4e199b(0x104)+_0x6b57c4[_0x4e199b(0x148)]['name']+_0x4e199b(0x174)+_0x4e199b(0x131));},'resolveEmbeddedActivationId':async(_0x148efc,_0x16a9d4)=>{const _0xd0f8f7=_0x30a47e,_0x1c25fe=_0x325734[_0xd0f8f7(0x187)](_0x148efc);if(_0x1c25fe)return _0x1c25fe;if(_0x6b57c4['isNew'])return _0x25fa30[_0xd0f8f7(0x167)](_0x148efc,_0x16a9d4),createPendingActivationId(_0x148efc);if(_0x6b57c4['existingJourney']){await _0x39fd37();const _0x358e91=_0x325734['get'](_0x16a9d4['name']);if(_0x358e91)return _0x325734['set'](_0x148efc,_0x358e91),_0x358e91;const _0x35b799=activationSignature(_0x16a9d4),_0x4d2f85=_0x11ad7a?.[_0xd0f8f7(0x187)](_0x35b799);if(_0x4d2f85)return _0x325734['set'](_0x148efc,_0x4d2f85),_0x4d2f85;const _0x327770=await _0x26e042(_0x16a9d4,_0x4a4be9[_0xd0f8f7(0xfa)]),_0x1b9980={..._0x327770,..._0x16a9d4['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x16a9d4[_0xd0f8f7(0xe5)]}},_0x4ff41a=await _0x2d3f2a[_0xd0f8f7(0xf4)]['createActivation'](_0x6b57c4['existingJourney']['id'],_0x1b9980);return _0x325734[_0xd0f8f7(0x167)](_0x148efc,_0x4ff41a['id']),_0x4ff41a['id'];}throw new SDKError(ErrorCode['INTERNAL'],_0xd0f8f7(0x118));},'resolveJourneyId':async _0x3bf34c=>{const _0x16f076=_0x30a47e;try{return await _0x2d3f2a['journey'][_0x16f076(0xff)](_0x11202d[_0x16f076(0x10f)],_0x3bf34c);}catch(_0x158273){throw new SDKError(ErrorCode[_0x16f076(0x109)],_0x16f076(0x13b)+_0x3bf34c+_0x16f076(0x19a)+_0x6b57c4[_0x16f076(0x148)][_0x16f076(0x108)]+'\x27)',_0x158273);}},'resolveStageId':async(_0x118095,_0x38e40e)=>{const _0x3aed00=_0x30a47e,_0x2bc9e2=await _0x2d3f2a[_0x3aed00(0xf4)]['getJourney'](_0x118095),_0x4a8cec=_0x2bc9e2[_0x3aed00(0x1b6)][_0x3aed00(0x161)][_0x3aed00(0xd5)](_0x4bab9f=>_0x4bab9f[_0x3aed00(0x108)][_0x3aed00(0x15a)]()===_0x38e40e[_0x3aed00(0x15a)]());if(!_0x4a8cec?.['id'])throw new SDKError(ErrorCode[_0x3aed00(0x109)],'Stage\x20\x27'+_0x38e40e+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x2bc9e2[_0x3aed00(0x1b6)][_0x3aed00(0x1d0)]||_0x2bc9e2[_0x3aed00(0x1b6)][_0x3aed00(0x108)])+'\x27');return _0x4a8cec['id'];}},_0x114e28=await _0x3a7ebb(_0x6b57c4[_0x30a47e(0x148)],_0x11202d['parentId'],_0x46bed7),_0x5f22bd=_0x11202d[_0x30a47e(0x1ca)]||_0x11202d['rootFolderId'];_0x5f22bd&&(_0x114e28[_0x30a47e(0x126)]={'parentFolder':{'data':{'id':_0x5f22bd,'type':'folder'}}});if(_0x6b57c4['isNew']){if(_0x3e5b44[_0x30a47e(0x16d)]>0x0||_0x25fa30[_0x30a47e(0x16d)]>0x0)return await executeThreeStepJourneyCreate(_0x2d3f2a,_0x6b57c4,_0x114e28,{'pendingEmbeddedSegments':_0x3e5b44,'pendingEmbeddedActivations':_0x25fa30,'embeddedSegmentNameToId':_0x134110,'journeyActivationNameToId':_0x325734},{..._0x11202d,'effectiveFolderId':_0x5f22bd},_0x4a4be9,_0x44e193,_0x23c079);else{ensureJourneyDefaults(_0x114e28['attributes']);const _0x64152f=await _0x2d3f2a[_0x30a47e(0xf4)][_0x30a47e(0x14d)](_0x114e28);return deletePushRecovery(_0x6b57c4[_0x30a47e(0x144)]),{'action':_0x30a47e(0x122),'journeyId':_0x64152f['id'],'embeddedSegmentNameToId':_0x134110};}}else{if(_0x6b57c4['hasChanges']&&_0x6b57c4[_0x30a47e(0x191)]){_0x114e28['id']=_0x6b57c4[_0x30a47e(0x191)]['id'];const _0x19f2e8=_0x114e28[_0x30a47e(0x1b6)];_0x6b57c4[_0x30a47e(0x191)][_0x30a47e(0x1b6)]?.[_0x30a47e(0x1d0)]&&(_0x19f2e8[_0x30a47e(0x1d0)]=_0x6b57c4[_0x30a47e(0x191)][_0x30a47e(0x1b6)][_0x30a47e(0x1d0)]);const _0x113790=_0x6b57c4[_0x30a47e(0x191)][_0x30a47e(0x1b6)]?.[_0x30a47e(0x161)];return _0x113790&&_0x114e28[_0x30a47e(0x1b6)]['journeyStages']&&injectExistingStageIds(_0x114e28[_0x30a47e(0x1b6)][_0x30a47e(0x161)],_0x113790),ensureJourneyDefaults(_0x19f2e8),await _0x2d3f2a[_0x30a47e(0xf4)][_0x30a47e(0x152)](_0x6b57c4[_0x30a47e(0x191)]['id'],_0x114e28),deletePushRecovery(_0x6b57c4[_0x30a47e(0x144)]),{'action':_0x30a47e(0x123),'journeyId':_0x6b57c4['existingJourney']['id'],'embeddedSegmentNameToId':_0x134110};}}return deletePushRecovery(_0x6b57c4[_0x30a47e(0x144)]),{'action':'unchanged','journeyId':_0x6b57c4[_0x30a47e(0x191)]?.['id'],'embeddedSegmentNameToId':_0x134110};}function findSegmentCriteriaLocation(_0x37e113,_0x954226){const _0x50ca2c=a155_0x213229,_0x12c470=_0x37e113[_0x50ca2c(0x13d)]||_0x37e113['journeys']?.[0x0]?.[_0x50ca2c(0x13d)]||[];let _0x43a5ee=_0x50ca2c(0xe1),_0xd39788=_0x954226;const _0x2629b6=_0x37e113[_0x50ca2c(0x1c4)]||_0x37e113[_0x50ca2c(0x132)]?.[0x0]?.[_0x50ca2c(0x1c4)];if(_0x2629b6?.['segment']===_0x954226)return{'stageName':_0x50ca2c(0x1c4),'criteriaName':_0x2629b6[_0x50ca2c(0x108)]||_0x954226};_0x3b372f:for(const _0x52df10 of _0x12c470){if(_0x52df10[_0x50ca2c(0x18f)]?.['segment']===_0x954226){_0x43a5ee=_0x52df10[_0x50ca2c(0x108)],_0xd39788=_0x52df10[_0x50ca2c(0x18f)][_0x50ca2c(0x108)]||_0x954226;break;}if(_0x52df10[_0x50ca2c(0x14c)])for(const _0x3b63a1 of _0x52df10[_0x50ca2c(0x14c)]){if(_0x3b63a1[_0x50ca2c(0xd6)]===_0x50ca2c(0x188)&&_0x3b63a1['with']?.[_0x50ca2c(0x107)])for(const _0x465326 of _0x3b63a1[_0x50ca2c(0xe9)][_0x50ca2c(0x107)]){if(_0x465326[_0x50ca2c(0x175)]===_0x954226){_0x43a5ee=_0x52df10[_0x50ca2c(0x108)],_0xd39788=_0x465326['name']||_0x954226;break _0x3b372f;}}}}return{'stageName':_0x43a5ee,'criteriaName':_0xd39788};}async function executeThreeStepJourneyCreate(_0x19fb78,_0x5c1748,_0x1171dc,_0x57b225,_0x45f17e,_0x4bcf14,_0x474f78,_0x274ba1){const _0x1a1165=a155_0x213229,{activationDefToCreateRequest:_0x29ac92,yamlRuleToApi:_0x5848c5}=_0x274ba1,{pendingEmbeddedSegments:_0x267d3a,pendingEmbeddedActivations:_0x3cd2f0,embeddedSegmentNameToId:_0x45fc24}=_0x57b225,_0x28d0c9=JSON[_0x1a1165(0xf1)](JSON[_0x1a1165(0x15f)](_0x1171dc));ensureJourneyDefaults(_0x28d0c9['attributes']),stripPendingIds(_0x28d0c9);const _0x1da99d=await _0x19fb78[_0x1a1165(0xf4)][_0x1a1165(0x14d)](_0x28d0c9),_0x90c69e=_0x1da99d['id'],_0x200696=new Map();for(const _0x4c87fa of _0x1da99d[_0x1a1165(0x1b6)][_0x1a1165(0x161)]){_0x200696[_0x1a1165(0x167)](_0x4c87fa[_0x1a1165(0x108)]['toLowerCase'](),_0x4c87fa['id']);}recoverSegmentIdsFromPushRecovery(_0x5c1748,_0x45fc24,_0x4bcf14[_0x1a1165(0x1a1)]);for(const [_0x3a6e53,{definition:_0x5024ab}]of _0x267d3a){if(_0x45fc24['has'](_0x3a6e53)){_0x474f78[_0x1a1165(0xf8)]?.({'type':'embedded_segment_created','journeyName':_0x5c1748[_0x1a1165(0x148)][_0x1a1165(0x108)],'segmentName':_0x3a6e53});continue;}const _0x13f3fd=generateDeterministicJourneySegmentName(_0x5c1748[_0x1a1165(0x148)][_0x1a1165(0x108)],_0x3a6e53);_0x474f78[_0x1a1165(0xf8)]?.({'type':_0x1a1165(0x141),'journeyName':_0x5c1748[_0x1a1165(0x148)]['name'],'segmentName':_0x3a6e53});const _0xaf5072=createSegmentIdResolver(_0x4bcf14['segmentNameToId'],_0x3a6e53),_0x4f20ef=await resolveRuleSegmentIds(_0x5024ab['rule'],_0xaf5072),_0x4d99ec=await createOrRecoverEmbeddedSegment(_0x19fb78,_0x5c1748,{'localName':_0x3a6e53,'uniqueSegmentName':_0x13f3fd,'description':_0x5024ab[_0x1a1165(0x177)]||'Entry\x20criteria:\x20'+_0x3a6e53,'journeyId':_0x90c69e,'resolvedRule':_0x4f20ef,'parentId':_0x45f17e[_0x1a1165(0x10f)],'folderId':_0x45f17e[_0x1a1165(0x135)]||''},_0x5848c5);_0x45fc24[_0x1a1165(0x167)](_0x3a6e53,_0x4d99ec),_0x4bcf14['segmentNameToId'][_0x1a1165(0x167)](_0x3a6e53,_0x4d99ec),_0x474f78[_0x1a1165(0xf8)]?.({'type':'embedded_segment_created','journeyName':_0x5c1748[_0x1a1165(0x148)]['name'],'segmentName':_0x3a6e53});}const _0x218561=new Map();for(const [_0x3f993a,_0x59fb25]of _0x3cd2f0){_0x474f78[_0x1a1165(0xf8)]?.({'type':_0x1a1165(0x159),'journeyName':_0x5c1748['yamlConfig']['name'],'activationName':_0x3f993a});const _0x211fad=await _0x29ac92(_0x59fb25,_0x4bcf14[_0x1a1165(0xfa)]),_0x4ae311={..._0x211fad,..._0x59fb25[_0x1a1165(0xe5)]!==undefined&&{'runAfterJourneyRefresh':_0x59fb25['run_after_journey_refresh']}},_0x376411=await _0x19fb78[_0x1a1165(0xf4)]['createActivation'](_0x90c69e,_0x4ae311);_0x218561[_0x1a1165(0x167)](_0x3f993a,_0x376411['id']),_0x57b225[_0x1a1165(0x151)][_0x1a1165(0x167)](_0x3f993a,_0x376411['id']),_0x474f78[_0x1a1165(0xf8)]?.({'type':_0x1a1165(0x185),'journeyName':_0x5c1748['yamlConfig'][_0x1a1165(0x108)],'activationName':_0x3f993a});}const _0x5e7265=JSON[_0x1a1165(0xf1)](JSON[_0x1a1165(0x15f)](_0x1171dc));return _0x5e7265['id']=_0x90c69e,ensureJourneyDefaults(_0x5e7265[_0x1a1165(0x1b6)]),resolvePendingIdsInRequest(_0x5e7265,_0x1171dc,_0x200696,_0x45fc24,_0x218561,_0x474f78),await _0x19fb78[_0x1a1165(0xf4)][_0x1a1165(0x152)](_0x90c69e,_0x5e7265),deletePushRecovery(_0x5c1748[_0x1a1165(0x144)]),{'action':_0x1a1165(0x122),'journeyId':_0x90c69e,'embeddedSegmentNameToId':_0x45fc24};}export function stripWaitStepPendingIds(_0x525242){const _0x4cb505=a155_0x213229,_0x1d27ea=_0x525242[_0x4cb505(0x18a)]&&isPendingSegmentId(_0x525242[_0x4cb505(0x18a)]),_0x142c45=_0x525242[_0x4cb505(0xdd)]?.[_0x4cb505(0x125)](_0x5a833c=>_0x5a833c[_0x4cb505(0x133)]&&isPendingSegmentId(_0x5a833c['segmentId']));(_0x1d27ea||_0x142c45)&&(_0x525242[_0x4cb505(0x1cb)]='Duration',_0x525242[_0x4cb505(0xdc)]=0x1,_0x525242[_0x4cb505(0x1ae)]=_0x4cb505(0x153),delete _0x525242[_0x4cb505(0x18a)],delete _0x525242['conditionTimeoutDuration'],delete _0x525242[_0x4cb505(0x10b)],delete _0x525242['conditions']);}export function resolveWaitStepPendingIds(_0x3f780a,_0x28edc7,_0x46c325,_0x5a70f7){const _0x2f202c=a155_0x213229;if(_0x28edc7[_0x2f202c(0x18a)]&&isPendingSegmentId(_0x28edc7['conditionSegmentId'])){const _0x174095=_0x46c325(_0x28edc7['conditionSegmentId'],_0x2f202c(0x16f)+_0x5a70f7+_0x2f202c(0x181));_0x174095&&(_0x3f780a[_0x2f202c(0x1cb)]=_0x2f202c(0x1a4),_0x3f780a[_0x2f202c(0x18a)]=_0x174095,delete _0x3f780a[_0x2f202c(0xdc)],delete _0x3f780a[_0x2f202c(0x1ae)],_0x28edc7[_0x2f202c(0xe2)]!==undefined&&(_0x3f780a['conditionTimeoutDuration']=_0x28edc7['conditionTimeoutDuration']),_0x28edc7[_0x2f202c(0x10b)]&&(_0x3f780a['conditionTimeoutUnit']=_0x28edc7[_0x2f202c(0x10b)]));}if(_0x28edc7[_0x2f202c(0xdd)]){const _0x598005=_0x28edc7[_0x2f202c(0xdd)][_0x2f202c(0x125)](_0x341783=>_0x341783[_0x2f202c(0x133)]&&isPendingSegmentId(_0x341783[_0x2f202c(0x133)]));if(_0x598005){const _0x3acd97=_0x28edc7['conditions'][_0x2f202c(0x19f)](_0x5af9b5=>{const _0x2a3bbe=_0x2f202c;if(_0x5af9b5[_0x2a3bbe(0x133)]&&isPendingSegmentId(_0x5af9b5[_0x2a3bbe(0x133)])){const _0x4d1cee=_0x46c325(_0x5af9b5[_0x2a3bbe(0x133)],_0x2a3bbe(0x16f)+_0x5a70f7+_0x2a3bbe(0x181));return{..._0x5af9b5,'segmentId':_0x4d1cee||_0x5af9b5[_0x2a3bbe(0x133)]};}return{..._0x5af9b5};});_0x3f780a['waitStepType']=_0x2f202c(0x1a4),_0x3f780a[_0x2f202c(0xdd)]=_0x3acd97,delete _0x3f780a['waitStep'],delete _0x3f780a[_0x2f202c(0x1ae)],delete _0x3f780a['conditionSegmentId'],delete _0x3f780a['conditionTimeoutDuration'],delete _0x3f780a[_0x2f202c(0x10b)];}}}function stripPendingIds(_0x3ab5a7){const _0x18150e=a155_0x213229;_0x3ab5a7[_0x18150e(0x1b6)][_0x18150e(0x1c4)]?.[_0x18150e(0x133)]&&isPendingSegmentId(_0x3ab5a7[_0x18150e(0x1b6)][_0x18150e(0x1c4)][_0x18150e(0x133)])&&delete _0x3ab5a7[_0x18150e(0x1b6)][_0x18150e(0x1c4)];for(const _0x3c29ff of _0x3ab5a7['attributes'][_0x18150e(0x161)]||[]){_0x3c29ff[_0x18150e(0xe7)]?.[_0x18150e(0x133)]&&isPendingSegmentId(_0x3c29ff['entryCriteria'][_0x18150e(0x133)])&&delete _0x3c29ff[_0x18150e(0xe7)];_0x3c29ff[_0x18150e(0x194)]?.[_0x18150e(0x133)]&&isPendingSegmentId(_0x3c29ff['milestone'][_0x18150e(0x133)])&&delete _0x3c29ff['milestone'];_0x3c29ff[_0x18150e(0x157)]&&(_0x3c29ff[_0x18150e(0x157)]=_0x3c29ff[_0x18150e(0x157)][_0x18150e(0xed)](_0x31d143=>!_0x31d143[_0x18150e(0x133)]||!isPendingSegmentId(_0x31d143['segmentId'])));if(_0x3c29ff[_0x18150e(0x14c)])for(const _0x45a958 of Object[_0x18150e(0x1c2)](_0x3c29ff[_0x18150e(0x14c)])){const _0x10faf1=_0x3c29ff['steps'][_0x45a958];_0x10faf1[_0x18150e(0xd6)]===_0x18150e(0x172)&&_0x10faf1['journeyActivationStepId']&&isPendingActivationId(_0x10faf1[_0x18150e(0x12b)])&&(_0x10faf1[_0x18150e(0x12b)]='');if(_0x10faf1['type']===_0x18150e(0x1c8)&&_0x10faf1[_0x18150e(0x107)])for(const _0x57bc55 of _0x10faf1[_0x18150e(0x107)]){_0x57bc55[_0x18150e(0x133)]&&isPendingSegmentId(_0x57bc55[_0x18150e(0x133)])&&(_0x57bc55[_0x18150e(0x133)]='');}_0x10faf1[_0x18150e(0xd6)]===_0x18150e(0x1af)&&stripWaitStepPendingIds(_0x10faf1);}}}function resolvePendingIdsInRequest(_0x4c94f9,_0x56438c,_0x2bf504,_0x273345,_0x2cf722,_0x26e37e){const _0x196549=a155_0x213229,_0xb6a941=(_0x3de90f,_0x36203c)=>{const _0x519f77=a155_0x27e5;if(!isPendingSegmentId(_0x3de90f))return _0x3de90f;const _0x9ef28e=extractPendingSegmentName(_0x3de90f),_0x257d5e=_0x273345[_0x519f77(0x187)](_0x9ef28e);return!_0x257d5e&&_0x26e37e[_0x519f77(0x16e)]?.(_0x519f77(0x119)+_0x9ef28e+_0x519f77(0xfc)+_0x36203c),_0x257d5e;};if(_0x4c94f9[_0x196549(0x1b6)][_0x196549(0x1c4)]?.['segmentId']&&isPendingSegmentId(_0x4c94f9['attributes'][_0x196549(0x1c4)][_0x196549(0x133)])){const _0x2e2bc2=_0xb6a941(_0x4c94f9[_0x196549(0x1b6)][_0x196549(0x1c4)][_0x196549(0x133)],_0x196549(0xf7));_0x2e2bc2&&(_0x4c94f9['attributes'][_0x196549(0x1c4)][_0x196549(0x133)]=_0x2e2bc2);}for(const _0x1b8fa9 of _0x4c94f9[_0x196549(0x1b6)][_0x196549(0x161)]||[]){const _0x861b70=_0x2bf504[_0x196549(0x187)](_0x1b8fa9['name'][_0x196549(0x15a)]());_0x861b70&&(_0x1b8fa9['id']=_0x861b70);if(_0x1b8fa9[_0x196549(0xe7)]?.[_0x196549(0x133)]&&isPendingSegmentId(_0x1b8fa9['entryCriteria'][_0x196549(0x133)])){const _0x39f949=_0xb6a941(_0x1b8fa9[_0x196549(0xe7)][_0x196549(0x133)],'stage\x20\x27'+_0x1b8fa9[_0x196549(0x108)]+_0x196549(0x1b9));_0x39f949&&(_0x1b8fa9['entryCriteria']['segmentId']=_0x39f949);}if(_0x1b8fa9[_0x196549(0x157)])for(const _0x5a5637 of _0x1b8fa9[_0x196549(0x157)]){if(_0x5a5637[_0x196549(0x133)]&&isPendingSegmentId(_0x5a5637[_0x196549(0x133)])){const _0x12df5c=_0xb6a941(_0x5a5637['segmentId'],_0x196549(0x16f)+_0x1b8fa9[_0x196549(0x108)]+_0x196549(0xe3));_0x12df5c&&(_0x5a5637[_0x196549(0x133)]=_0x12df5c);}}if(_0x1b8fa9[_0x196549(0x194)]?.[_0x196549(0x133)]&&isPendingSegmentId(_0x1b8fa9[_0x196549(0x194)]['segmentId'])){const _0x5ef28e=_0xb6a941(_0x1b8fa9[_0x196549(0x194)]['segmentId'],'stage\x20\x27'+_0x1b8fa9['name']+'\x27\x20milestone');_0x5ef28e&&(_0x1b8fa9[_0x196549(0x194)][_0x196549(0x133)]=_0x5ef28e);}if(_0x1b8fa9[_0x196549(0x14c)]){const _0x33d28e=_0x35759f=>_0x56438c[_0x196549(0x1b6)]['journeyStages']?.['find'](_0x5ef9a6=>_0x5ef9a6[_0x196549(0x108)][_0x196549(0x15a)]()===_0x1b8fa9['name'][_0x196549(0x15a)]())?.[_0x196549(0x14c)]?.[_0x35759f];for(const _0x2e70ae of Object[_0x196549(0x1c2)](_0x1b8fa9[_0x196549(0x14c)])){const _0x5119bf=_0x1b8fa9[_0x196549(0x14c)][_0x2e70ae],_0x397ed3=_0x33d28e(_0x2e70ae);if(_0x5119bf[_0x196549(0xd6)]===_0x196549(0x172)&&_0x5119bf[_0x196549(0x12b)]&&(isPendingActivationId(_0x5119bf[_0x196549(0x12b)])||_0x5119bf['journeyActivationStepId']==='')){if(_0x397ed3?.[_0x196549(0x12b)]&&isPendingActivationId(_0x397ed3[_0x196549(0x12b)])){const _0x50c6fd=extractPendingActivationName(_0x397ed3[_0x196549(0x12b)]),_0x3740ed=_0x2cf722[_0x196549(0x187)](_0x50c6fd);_0x3740ed&&(_0x5119bf['journeyActivationStepId']=_0x3740ed);}}if(_0x5119bf[_0x196549(0xd6)]===_0x196549(0x1c8)&&_0x5119bf[_0x196549(0x107)]&&_0x397ed3?.[_0x196549(0x107)])for(let _0x2ec549=0x0;_0x2ec549<_0x5119bf[_0x196549(0x107)][_0x196549(0x176)];_0x2ec549++){const _0x179abd=_0x5119bf[_0x196549(0x107)][_0x2ec549],_0x1c82e7=_0x397ed3[_0x196549(0x107)][_0x2ec549];if(_0x1c82e7?.[_0x196549(0x133)]&&isPendingSegmentId(_0x1c82e7['segmentId'])){const _0x1f6f22=_0xb6a941(_0x1c82e7[_0x196549(0x133)],_0x196549(0x16f)+_0x1b8fa9[_0x196549(0x108)]+_0x196549(0x14f)+(_0x179abd[_0x196549(0x108)]||_0x2ec549)+'\x27');_0x1f6f22&&(_0x179abd['segmentId']=_0x1f6f22);}}_0x5119bf[_0x196549(0xd6)]===_0x196549(0x1af)&&_0x397ed3?.[_0x196549(0xd6)]===_0x196549(0x1af)&&resolveWaitStepPendingIds(_0x5119bf,_0x397ed3,_0xb6a941,_0x1b8fa9['name']);}}}}
@@ -1 +1 @@
1
- (function(_0xabb88a,_0x5cc42c){const _0x2cfe9c=a156_0x414d,_0x3ebad6=_0xabb88a();while(!![]){try{const _0x5a52da=-parseInt(_0x2cfe9c(0x193))/0x1*(-parseInt(_0x2cfe9c(0x194))/0x2)+-parseInt(_0x2cfe9c(0x19c))/0x3+parseInt(_0x2cfe9c(0x19e))/0x4+-parseInt(_0x2cfe9c(0x192))/0x5+parseInt(_0x2cfe9c(0x195))/0x6*(-parseInt(_0x2cfe9c(0x19a))/0x7)+-parseInt(_0x2cfe9c(0x19b))/0x8+parseInt(_0x2cfe9c(0x19d))/0x9*(parseInt(_0x2cfe9c(0x198))/0xa);if(_0x5a52da===_0x5cc42c)break;else _0x3ebad6['push'](_0x3ebad6['shift']());}catch(_0x139afd){_0x3ebad6['push'](_0x3ebad6['shift']());}}}(a156_0x29c9,0xe05be));export function buildFolderIdToPathMap(_0x21f93e){const _0x45df86=a156_0x414d,_0x1710f6=new Map(),_0x461594=new Map();for(const _0x30d7bc of _0x21f93e){_0x461594[_0x45df86(0x197)](_0x30d7bc['id'],_0x30d7bc);}const _0x2ca36c=new Set();for(const _0x2fde9f of _0x21f93e){!_0x2fde9f[_0x45df86(0x19f)]&&_0x2ca36c['add'](_0x2fde9f['id']);}function _0x413e55(_0x1b9783){const _0x5addf1=_0x45df86;if(_0x1710f6[_0x5addf1(0x1a0)](_0x1b9783['id']))return _0x1710f6[_0x5addf1(0x1a1)](_0x1b9783['id']);if(_0x2ca36c['has'](_0x1b9783['id']))return _0x1710f6[_0x5addf1(0x197)](_0x1b9783['id'],''),'';if(_0x1b9783['parentFolderId']){const _0x6d6191=_0x461594['get'](_0x1b9783[_0x5addf1(0x19f)]);if(_0x6d6191){const _0x592f9d=_0x413e55(_0x6d6191),_0x49c94d=_0x592f9d?_0x592f9d+'/'+_0x1b9783[_0x5addf1(0x199)]:_0x1b9783[_0x5addf1(0x199)];return _0x1710f6['set'](_0x1b9783['id'],_0x49c94d),_0x49c94d;}}const _0x2d23d4=_0x1b9783[_0x5addf1(0x199)];return _0x1710f6[_0x5addf1(0x197)](_0x1b9783['id'],_0x2d23d4),_0x2d23d4;}for(const _0x4bfd1d of _0x21f93e){_0x413e55(_0x4bfd1d);}return _0x1710f6;}export function buildFolderPathToIdMap(_0x4bee1){const _0x3c3242=a156_0x414d,_0x17f2fb=new Map(),_0x4bcf86=new Map();for(const _0x2e0ddc of _0x4bee1){_0x4bcf86[_0x3c3242(0x197)](_0x2e0ddc['id'],_0x2e0ddc);}const _0x180fd0=new Set();for(const _0x4318a9 of _0x4bee1){!_0x4318a9[_0x3c3242(0x19f)]&&_0x180fd0[_0x3c3242(0x196)](_0x4318a9['id']);}function _0x5cfa4e(_0x45f75f){const _0x5bca55=_0x3c3242;if(_0x180fd0[_0x5bca55(0x1a0)](_0x45f75f['id']))return'';if(_0x45f75f[_0x5bca55(0x19f)]){const _0xad2ce8=_0x4bcf86[_0x5bca55(0x1a1)](_0x45f75f['parentFolderId']);if(_0xad2ce8){const _0x19af43=_0x5cfa4e(_0xad2ce8);return _0x19af43?_0x19af43+'/'+_0x45f75f[_0x5bca55(0x199)]:_0x45f75f[_0x5bca55(0x199)];}}return _0x45f75f[_0x5bca55(0x199)];}for(const _0x201fc1 of _0x4bee1){const _0x2940c0=_0x5cfa4e(_0x201fc1);_0x17f2fb[_0x3c3242(0x197)](_0x2940c0,_0x201fc1['id']);}return _0x17f2fb;}function a156_0x414d(_0xa9cbb0,_0x8eaae){_0xa9cbb0=_0xa9cbb0-0x192;const _0x29c936=a156_0x29c9();let _0x414deb=_0x29c936[_0xa9cbb0];return _0x414deb;}export function buildFolderMaps(_0x2d64e9){const _0xc455c=a156_0x414d,_0x468d3c=buildFolderIdToPathMap(_0x2d64e9),_0xc95bda=new Map();for(const [_0x208261,_0x3d9dea]of _0x468d3c){_0xc95bda[_0xc455c(0x197)](_0x3d9dea,_0x208261);}return{'idToPath':_0x468d3c,'pathToId':_0xc95bda};}export function getFolderPath(_0x24b0e6,_0x454a7d){const _0x4a4317=a156_0x414d;if(!_0x24b0e6)return'';return _0x454a7d[_0x4a4317(0x1a1)](_0x24b0e6)??'';}function a156_0x29c9(){const _0x37d0ca=['1030722cwJEhl','9SNACsj','6811604zrrmqM','parentFolderId','has','get','356690zVWchl','1oSnJBc','850856EZwgPs','12vItrtk','add','set','3413380LpkJGY','name','879116sRcsth','7076840YyQIbP'];a156_0x29c9=function(){return _0x37d0ca;};return a156_0x29c9();}
1
+ function a156_0x464e(_0x2f7d89,_0x5e00d5){_0x2f7d89=_0x2f7d89-0x1f2;const _0x11186f=a156_0x1118();let _0x464ed2=_0x11186f[_0x2f7d89];return _0x464ed2;}(function(_0x562c50,_0x5d3b22){const _0x1a091e=a156_0x464e,_0x1eddc5=_0x562c50();while(!![]){try{const _0x5ba0e7=-parseInt(_0x1a091e(0x1fb))/0x1+-parseInt(_0x1a091e(0x1f9))/0x2+-parseInt(_0x1a091e(0x200))/0x3*(parseInt(_0x1a091e(0x1ff))/0x4)+-parseInt(_0x1a091e(0x201))/0x5*(parseInt(_0x1a091e(0x1f3))/0x6)+-parseInt(_0x1a091e(0x1f5))/0x7*(parseInt(_0x1a091e(0x1f2))/0x8)+-parseInt(_0x1a091e(0x1fc))/0x9+parseInt(_0x1a091e(0x1fd))/0xa;if(_0x5ba0e7===_0x5d3b22)break;else _0x1eddc5['push'](_0x1eddc5['shift']());}catch(_0x241ce9){_0x1eddc5['push'](_0x1eddc5['shift']());}}}(a156_0x1118,0x87777));export function buildFolderIdToPathMap(_0x4cc826){const _0x133384=a156_0x464e,_0x4297fb=new Map(),_0x369bb6=new Map();for(const _0x263d8b of _0x4cc826){_0x369bb6[_0x133384(0x1f7)](_0x263d8b['id'],_0x263d8b);}const _0x5c1e33=new Set();for(const _0x39d0fa of _0x4cc826){!_0x39d0fa[_0x133384(0x1f4)]&&_0x5c1e33[_0x133384(0x1fa)](_0x39d0fa['id']);}function _0x1bd04d(_0xbf7f9a){const _0x3ea8d5=_0x133384;if(_0x4297fb[_0x3ea8d5(0x1f8)](_0xbf7f9a['id']))return _0x4297fb['get'](_0xbf7f9a['id']);if(_0x5c1e33[_0x3ea8d5(0x1f8)](_0xbf7f9a['id']))return _0x4297fb[_0x3ea8d5(0x1f7)](_0xbf7f9a['id'],''),'';if(_0xbf7f9a['parentFolderId']){const _0x3a083e=_0x369bb6[_0x3ea8d5(0x1f6)](_0xbf7f9a[_0x3ea8d5(0x1f4)]);if(_0x3a083e){const _0xbc2504=_0x1bd04d(_0x3a083e),_0x479bba=_0xbc2504?_0xbc2504+'/'+_0xbf7f9a['name']:_0xbf7f9a[_0x3ea8d5(0x1fe)];return _0x4297fb[_0x3ea8d5(0x1f7)](_0xbf7f9a['id'],_0x479bba),_0x479bba;}}const _0x3799fb=_0xbf7f9a[_0x3ea8d5(0x1fe)];return _0x4297fb[_0x3ea8d5(0x1f7)](_0xbf7f9a['id'],_0x3799fb),_0x3799fb;}for(const _0x1ecafc of _0x4cc826){_0x1bd04d(_0x1ecafc);}return _0x4297fb;}export function buildFolderPathToIdMap(_0x292e4e){const _0x151510=a156_0x464e,_0x4e3075=new Map(),_0x4f9524=new Map();for(const _0x1d9974 of _0x292e4e){_0x4f9524[_0x151510(0x1f7)](_0x1d9974['id'],_0x1d9974);}const _0x4fbc21=new Set();for(const _0x36470f of _0x292e4e){!_0x36470f[_0x151510(0x1f4)]&&_0x4fbc21[_0x151510(0x1fa)](_0x36470f['id']);}function _0xe56f(_0x4aed2f){const _0x3a0841=_0x151510;if(_0x4fbc21['has'](_0x4aed2f['id']))return'';if(_0x4aed2f['parentFolderId']){const _0x408f78=_0x4f9524['get'](_0x4aed2f['parentFolderId']);if(_0x408f78){const _0x7cdf94=_0xe56f(_0x408f78);return _0x7cdf94?_0x7cdf94+'/'+_0x4aed2f[_0x3a0841(0x1fe)]:_0x4aed2f[_0x3a0841(0x1fe)];}}return _0x4aed2f[_0x3a0841(0x1fe)];}for(const _0x39d579 of _0x292e4e){const _0x57785e=_0xe56f(_0x39d579);_0x4e3075[_0x151510(0x1f7)](_0x57785e,_0x39d579['id']);}return _0x4e3075;}function a156_0x1118(){const _0x56dc74=['40137710uZzOvH','name','2655020OUXwCP','3pUKgKo','40IJAriP','1512328ykIXfF','583206FPqPMO','parentFolderId','35KTqIMH','get','set','has','1176122bIBLhx','add','259338Rgqwdl','2024397CUIYxz'];a156_0x1118=function(){return _0x56dc74;};return a156_0x1118();}export function buildFolderMaps(_0x299558){const _0x624567=buildFolderIdToPathMap(_0x299558),_0x1e6a88=new Map();for(const [_0x5945fd,_0x366078]of _0x624567){_0x1e6a88['set'](_0x366078,_0x5945fd);}return{'idToPath':_0x624567,'pathToId':_0x1e6a88};}export function getFolderPath(_0x9288b1,_0x316fc3){const _0x8db2e8=a156_0x464e;if(!_0x9288b1)return'';return _0x316fc3[_0x8db2e8(0x1f6)](_0x9288b1)??'';}
@@ -1 +1 @@
1
- (function(_0xcb3d19,_0x38e246){const _0x38dda5=a157_0x57cc,_0x28101a=_0xcb3d19();while(!![]){try{const _0x40e6b4=-parseInt(_0x38dda5(0x83))/0x1*(-parseInt(_0x38dda5(0x96))/0x2)+parseInt(_0x38dda5(0x7f))/0x3*(parseInt(_0x38dda5(0xa0))/0x4)+parseInt(_0x38dda5(0xb2))/0x5+parseInt(_0x38dda5(0x99))/0x6*(-parseInt(_0x38dda5(0x92))/0x7)+parseInt(_0x38dda5(0x84))/0x8+-parseInt(_0x38dda5(0xa6))/0x9+parseInt(_0x38dda5(0xa4))/0xa*(-parseInt(_0x38dda5(0x9a))/0xb);if(_0x40e6b4===_0x38e246)break;else _0x28101a['push'](_0x28101a['shift']());}catch(_0x293060){_0x28101a['push'](_0x28101a['shift']());}}}(a157_0x4b29,0xe2d40));import a157_0x112c91 from'path';import{parse as a157_0x539c96}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x166886){const _0x23e7ca=a157_0x57cc;if(!_0x166886||_0x166886[_0x23e7ca(0xad)]()==='')throw new Error(_0x23e7ca(0x9c));const _0x25610e=_0x166886['trim']();if(_0x25610e==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x166886};const _0x2d1970=_0x25610e[_0x23e7ca(0xab)]('/')?_0x25610e[_0x23e7ca(0xa1)](0x1):_0x25610e,_0x49cfbb=_0x2d1970['split']('/')[_0x23e7ca(0x8c)](_0x48c149=>_0x48c149!=='');if(_0x49cfbb['length']===0x0)throw new Error(_0x23e7ca(0xae));const _0x4bdf04=_0x25610e['startsWith']('/')||!isRelativePathSegment(_0x49cfbb[0x0]);for(const _0x1a8312 of _0x49cfbb){validatePathSegment(_0x1a8312);}return{'segments':_0x49cfbb,'isAbsolute':_0x4bdf04,'raw':_0x166886};}function isRelativePathSegment(_0x4625b5){return _0x4625b5==='.'||_0x4625b5==='..';}function validatePathSegment(_0x4d6f57){const _0x3fa96f=a157_0x57cc;if(_0x4d6f57==='')throw new Error(_0x3fa96f(0xa5));if(_0x4d6f57==='.'||_0x4d6f57==='..')return;if(/[\x00-\x1F\x7F]/[_0x3fa96f(0x81)](_0x4d6f57))throw new Error(_0x3fa96f(0x82)+_0x4d6f57);if(_0x4d6f57!==_0x4d6f57[_0x3fa96f(0xad)]()){}}export function validatePath(_0x1baf56){const _0x552419=a157_0x57cc;if(_0x1baf56[_0x552419(0xb0)]['length']===0x0&&!_0x1baf56[_0x552419(0xb1)])throw new Error(_0x552419(0x90));if(_0x1baf56[_0x552419(0xb1)]){if(_0x1baf56['segments'][0x0]==='..')throw new Error(_0x552419(0xa2));let _0xb85714=0x0;for(const _0x57f0f8 of _0x1baf56[_0x552419(0xb0)]){if(_0x57f0f8==='..'){if(_0xb85714===0x0)throw new Error(_0x552419(0xa7));_0xb85714--;}else _0x57f0f8!=='.'&&_0xb85714++;}}}export function joinPaths(_0x569ab2,_0x172f25){const _0x1de9e4=a157_0x57cc;if(!_0x569ab2||_0x569ab2==='/')return _0x172f25;if(!_0x172f25||_0x172f25==='.')return _0x569ab2;if(_0x172f25[_0x1de9e4(0xab)]('/'))return _0x172f25;const _0x446190=parsePath(_0x569ab2),_0x4f8841=parsePath(_0x172f25),_0x2504d6=[..._0x446190[_0x1de9e4(0xb0)]];for(const _0x59674f of _0x4f8841[_0x1de9e4(0xb0)]){if(_0x59674f==='.')continue;else{if(_0x59674f==='..'){if(_0x2504d6[_0x1de9e4(0x9d)]===0x0)throw new Error('Cannot\x20navigate\x20above\x20root');_0x2504d6['pop']();}else _0x2504d6[_0x1de9e4(0x8b)](_0x59674f);}}const _0x4aad16=_0x2504d6[_0x1de9e4(0x95)]('/');return _0x446190[_0x1de9e4(0x8a)][_0x1de9e4(0xab)]('/')?'/'+_0x4aad16:_0x4aad16;}function a157_0x4b29(){const _0x41b351=['Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','Path\x20cannot\x20be\x20empty','length','parent_segment','tdx.json','19704BXkClq','substring','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','resolve','610vJbeVm','Path\x20segment\x20cannot\x20be\x20empty','2953809DtvnVi','Path\x20attempts\x20to\x20navigate\x20above\x20root','slice','exists','readFile','startsWith','dirname','trim','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','type','segments','isAbsolute','8594065pQshFY','897wZTMtH','parse','test','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','4niWmBX','5649032FeJSDP','root','journey','endsWith','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','File\x20not\x20found:\x20','raw','push','filter','No\x20tdx.json\x20found\x20for\x20file:\x20','name','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','Relative\x20path\x20cannot\x20be\x20empty','Cannot\x20navigate\x20above\x20root','161ttcmJG','.yml','replace','join','53854dtEhVA','Cannot\x20split\x20empty\x20path','pop','441492ujQOoe','190399GDiRCj'];a157_0x4b29=function(){return _0x41b351;};return a157_0x4b29();}function a157_0x57cc(_0x1c83e9,_0x4dcb03){_0x1c83e9=_0x1c83e9-0x7f;const _0x4b295c=a157_0x4b29();let _0x57cce6=_0x4b295c[_0x1c83e9];return _0x57cce6;}export function normalizePath(_0x811509){const _0x4764f7=a157_0x57cc,_0x1a1990=parsePath(_0x811509),_0x1bc216=[];for(const _0x27b4ce of _0x1a1990[_0x4764f7(0xb0)]){if(_0x27b4ce==='.')continue;else{if(_0x27b4ce==='..'){if(_0x1bc216['length']===0x0){if(_0x1a1990[_0x4764f7(0xb1)])throw new Error(_0x4764f7(0x91));_0x1bc216[_0x4764f7(0x8b)]('..');}else _0x1bc216[_0x1bc216['length']-0x1]==='..'?_0x1bc216[_0x4764f7(0x8b)]('..'):_0x1bc216[_0x4764f7(0x98)]();}else _0x1bc216['push'](_0x27b4ce);}}if(_0x1bc216[_0x4764f7(0x9d)]===0x0)return _0x1a1990[_0x4764f7(0xb1)]?'/':'.';const _0x118784=_0x1bc216[_0x4764f7(0x95)]('/');return _0x1a1990[_0x4764f7(0x8a)][_0x4764f7(0xab)]('/')?'/'+_0x118784:_0x118784;}export function getParentPath(_0x541c3f){const _0x1a8a33=a157_0x57cc,_0x4154c5=parsePath(_0x541c3f);if(_0x4154c5[_0x1a8a33(0xb0)][_0x1a8a33(0x9d)]<=0x1)return'/';const _0x29a85f=_0x4154c5[_0x1a8a33(0xb0)][_0x1a8a33(0xa8)](0x0,-0x1)['join']('/');return _0x4154c5['raw'][_0x1a8a33(0xab)]('/')?'/'+_0x29a85f:_0x29a85f;}export function getBaseName(_0x1e1ceb){const _0x16f6a9=a157_0x57cc,_0x55b4d=parsePath(_0x1e1ceb);return _0x55b4d[_0x16f6a9(0xb0)][_0x55b4d[_0x16f6a9(0xb0)][_0x16f6a9(0x9d)]-0x1]||'';}export function isChildPath(_0xee3dc5,_0x479188){const _0x2a13ad=a157_0x57cc,_0x71835e=parsePath(_0xee3dc5),_0x32febc=parsePath(_0x479188);if(_0x71835e[_0x2a13ad(0xb0)][_0x2a13ad(0x9d)]<=_0x32febc[_0x2a13ad(0xb0)][_0x2a13ad(0x9d)])return![];for(let _0x4e9232=0x0;_0x4e9232<_0x32febc[_0x2a13ad(0xb0)][_0x2a13ad(0x9d)];_0x4e9232++){if(_0x71835e[_0x2a13ad(0xb0)][_0x4e9232]!==_0x32febc[_0x2a13ad(0xb0)][_0x4e9232])return![];}return!![];}export function splitPath(_0x5b0d50){const _0x2a03f1=a157_0x57cc,_0x239311=parsePath(_0x5b0d50);if(_0x239311[_0x2a03f1(0xb0)][_0x2a03f1(0x9d)]===0x0)throw new Error(_0x2a03f1(0x97));if(_0x239311[_0x2a03f1(0xb0)][_0x2a03f1(0x9d)]===0x1)return{'parent':_0x239311[_0x2a03f1(0xb0)][0x0]};return{'parent':_0x239311[_0x2a03f1(0xb0)][0x0],'child':_0x239311[_0x2a03f1(0xb0)][_0x2a03f1(0xa8)](0x1)[_0x2a03f1(0x95)]('/')};}export function isYamlFilePath(_0x88ab0d){const _0x32364f=a157_0x57cc;return _0x88ab0d['endsWith'](_0x32364f(0x93))||_0x88ab0d[_0x32364f(0x87)]('.yaml');}export async function resolveYamlFilePath(_0xa9cfa3,_0xf925db=nodeFileSystem){const _0x26ed08=a157_0x57cc,_0x5e934e=a157_0x112c91[_0x26ed08(0xa3)](_0xa9cfa3);if(!await _0xf925db[_0x26ed08(0xa9)](_0x5e934e))throw new Error(_0x26ed08(0x89)+_0xa9cfa3);let _0x1105f5=a157_0x112c91['dirname'](_0x5e934e),_0x5d1d4a=null,_0x3acd29=null;const _0x1aff38=a157_0x112c91[_0x26ed08(0x80)](_0x1105f5)[_0x26ed08(0x85)];while(_0x1105f5!==_0x1aff38){const _0x2b49c7=a157_0x112c91[_0x26ed08(0x95)](_0x1105f5,_0x26ed08(0x9f));if(await _0xf925db[_0x26ed08(0xa9)](_0x2b49c7)){_0x5d1d4a=_0x2b49c7,_0x3acd29=_0x1105f5;break;}_0x1105f5=a157_0x112c91[_0x26ed08(0xac)](_0x1105f5);}if(!_0x5d1d4a||!_0x3acd29)throw new Error(_0x26ed08(0x8d)+_0xa9cfa3+'\x0a'+_0x26ed08(0x9b));const _0x53135f=await _0xf925db[_0x26ed08(0xaa)](_0x5d1d4a),_0x2eae5b=JSON[_0x26ed08(0x80)](_0x53135f),_0x1fe413=_0x2eae5b[_0x26ed08(0x9e)];if(!_0x1fe413)throw new Error(_0x26ed08(0x8f));const _0x5c8a28=await _0xf925db[_0x26ed08(0xaa)](_0x5e934e),_0x55461c=a157_0x539c96(_0x5c8a28),_0x2fa232=_0x55461c[_0x26ed08(0x8e)];if(!_0x2fa232)throw new Error(_0x26ed08(0x88)+_0xa9cfa3);const _0x1dff07=_0x55461c[_0x26ed08(0xaf)]===_0x26ed08(0x86)?_0x26ed08(0x86):'segment',_0xfeb68f=a157_0x112c91['relative'](_0x3acd29,_0x5e934e),_0x2e7ad4=a157_0x112c91[_0x26ed08(0xac)](_0xfeb68f),_0x1db879=_0x2e7ad4==='.'?'':_0x2e7ad4[_0x26ed08(0x94)](/\\/g,'/'),_0xdc667b=_0x1db879?_0x1fe413+'/'+_0x1db879+'/'+_0x2fa232:_0x1fe413+'/'+_0x2fa232;return{'parentSegment':_0x1fe413,'segmentName':_0x2fa232,'folderPath':_0x1db879,'fullPath':_0xdc667b,'resourceType':_0x1dff07,'content':_0x5c8a28};}
1
+ (function(_0x8adc4a,_0xda913f){const _0x214762=a157_0xbd72,_0x52be67=_0x8adc4a();while(!![]){try{const _0xe194e3=parseInt(_0x214762(0xdd))/0x1+parseInt(_0x214762(0xe0))/0x2*(parseInt(_0x214762(0xdf))/0x3)+parseInt(_0x214762(0xc7))/0x4+parseInt(_0x214762(0xcc))/0x5*(parseInt(_0x214762(0xc1))/0x6)+parseInt(_0x214762(0xc3))/0x7*(-parseInt(_0x214762(0xde))/0x8)+-parseInt(_0x214762(0xeb))/0x9*(parseInt(_0x214762(0xf1))/0xa)+parseInt(_0x214762(0xda))/0xb*(parseInt(_0x214762(0xd7))/0xc);if(_0xe194e3===_0xda913f)break;else _0x52be67['push'](_0x52be67['shift']());}catch(_0x13907c){_0x52be67['push'](_0x52be67['shift']());}}}(a157_0x2578,0xc2c93));import a157_0x21e016 from'path';import{parse as a157_0x121487}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x34aede){const _0xd595af=a157_0xbd72;if(!_0x34aede||_0x34aede[_0xd595af(0xe3)]()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0x395af8=_0x34aede[_0xd595af(0xe3)]();if(_0x395af8==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x34aede};const _0x2129fe=_0x395af8[_0xd595af(0xe5)]('/')?_0x395af8[_0xd595af(0xc2)](0x1):_0x395af8,_0x225e28=_0x2129fe[_0xd595af(0xc0)]('/')[_0xd595af(0xe8)](_0x53d4cd=>_0x53d4cd!=='');if(_0x225e28[_0xd595af(0xd1)]===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x2e1cbf=_0x395af8[_0xd595af(0xe5)]('/')||!isRelativePathSegment(_0x225e28[0x0]);for(const _0x27eecc of _0x225e28){validatePathSegment(_0x27eecc);}return{'segments':_0x225e28,'isAbsolute':_0x2e1cbf,'raw':_0x34aede};}function isRelativePathSegment(_0x3a3db5){return _0x3a3db5==='.'||_0x3a3db5==='..';}function a157_0x2578(){const _0x338b8d=['10874830OkkpRF','segments','split','330258ljXSDH','substring','335573CMCWFV','root','name','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','5624504qLAXav','journey','isAbsolute','Cannot\x20split\x20empty\x20path','Path\x20attempts\x20to\x20navigate\x20above\x20root','45JwWYhF','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','raw','pop','segment','length','replace','parse','.yml','test','.yaml','10772628GpySpL','resolve','Path\x20segment\x20cannot\x20be\x20empty','11rxDXOi','push','endsWith','179370HGfbEK','240XXUjoc','1542iKCtxI','1342aWhSNA','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','dirname','trim','Cannot\x20navigate\x20above\x20root','startsWith','slice','join','filter','type','Relative\x20path\x20cannot\x20be\x20empty','9JFAzqF','exists','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','tdx.json','readFile'];a157_0x2578=function(){return _0x338b8d;};return a157_0x2578();}function validatePathSegment(_0x61a2d2){const _0x4f19da=a157_0xbd72;if(_0x61a2d2==='')throw new Error(_0x4f19da(0xd9));if(_0x61a2d2==='.'||_0x61a2d2==='..')return;if(/[\x00-\x1F\x7F]/[_0x4f19da(0xd5)](_0x61a2d2))throw new Error(_0x4f19da(0xed)+_0x61a2d2);if(_0x61a2d2!==_0x61a2d2[_0x4f19da(0xe3)]()){}}export function validatePath(_0x23a4ca){const _0x15c599=a157_0xbd72;if(_0x23a4ca[_0x15c599(0xbf)][_0x15c599(0xd1)]===0x0&&!_0x23a4ca['isAbsolute'])throw new Error(_0x15c599(0xea));if(_0x23a4ca[_0x15c599(0xc9)]){if(_0x23a4ca[_0x15c599(0xbf)][0x0]==='..')throw new Error(_0x15c599(0xc6));let _0x5f01f7=0x0;for(const _0xe2527 of _0x23a4ca[_0x15c599(0xbf)]){if(_0xe2527==='..'){if(_0x5f01f7===0x0)throw new Error(_0x15c599(0xcb));_0x5f01f7--;}else _0xe2527!=='.'&&_0x5f01f7++;}}}export function joinPaths(_0x416483,_0x3473f0){const _0x4280b4=a157_0xbd72;if(!_0x416483||_0x416483==='/')return _0x3473f0;if(!_0x3473f0||_0x3473f0==='.')return _0x416483;if(_0x3473f0['startsWith']('/'))return _0x3473f0;const _0x2a978e=parsePath(_0x416483),_0x217f3e=parsePath(_0x3473f0),_0x39a13b=[..._0x2a978e[_0x4280b4(0xbf)]];for(const _0xc1b908 of _0x217f3e[_0x4280b4(0xbf)]){if(_0xc1b908==='.')continue;else{if(_0xc1b908==='..'){if(_0x39a13b[_0x4280b4(0xd1)]===0x0)throw new Error(_0x4280b4(0xe4));_0x39a13b['pop']();}else _0x39a13b[_0x4280b4(0xdb)](_0xc1b908);}}const _0x7c7f89=_0x39a13b[_0x4280b4(0xe7)]('/');return _0x2a978e[_0x4280b4(0xce)]['startsWith']('/')?'/'+_0x7c7f89:_0x7c7f89;}export function normalizePath(_0x13cb10){const _0x241db6=a157_0xbd72,_0x4a10fb=parsePath(_0x13cb10),_0x278daf=[];for(const _0x46ba59 of _0x4a10fb[_0x241db6(0xbf)]){if(_0x46ba59==='.')continue;else{if(_0x46ba59==='..'){if(_0x278daf[_0x241db6(0xd1)]===0x0){if(_0x4a10fb['isAbsolute'])throw new Error(_0x241db6(0xe4));_0x278daf[_0x241db6(0xdb)]('..');}else _0x278daf[_0x278daf['length']-0x1]==='..'?_0x278daf[_0x241db6(0xdb)]('..'):_0x278daf[_0x241db6(0xcf)]();}else _0x278daf[_0x241db6(0xdb)](_0x46ba59);}}if(_0x278daf['length']===0x0)return _0x4a10fb['isAbsolute']?'/':'.';const _0x2cc1dc=_0x278daf[_0x241db6(0xe7)]('/');return _0x4a10fb[_0x241db6(0xce)][_0x241db6(0xe5)]('/')?'/'+_0x2cc1dc:_0x2cc1dc;}export function getParentPath(_0x1ad0be){const _0x4e6fcd=a157_0xbd72,_0x2be7fa=parsePath(_0x1ad0be);if(_0x2be7fa['segments'][_0x4e6fcd(0xd1)]<=0x1)return'/';const _0x5c12cd=_0x2be7fa[_0x4e6fcd(0xbf)][_0x4e6fcd(0xe6)](0x0,-0x1)[_0x4e6fcd(0xe7)]('/');return _0x2be7fa[_0x4e6fcd(0xce)][_0x4e6fcd(0xe5)]('/')?'/'+_0x5c12cd:_0x5c12cd;}export function getBaseName(_0x516986){const _0xa47d1=a157_0xbd72,_0x2a43da=parsePath(_0x516986);return _0x2a43da[_0xa47d1(0xbf)][_0x2a43da[_0xa47d1(0xbf)][_0xa47d1(0xd1)]-0x1]||'';}function a157_0xbd72(_0x57c112,_0x10fd2b){_0x57c112=_0x57c112-0xbf;const _0x257831=a157_0x2578();let _0xbd7252=_0x257831[_0x57c112];return _0xbd7252;}export function isChildPath(_0x58c981,_0x1391de){const _0x136ccf=a157_0xbd72,_0x227422=parsePath(_0x58c981),_0xf1000e=parsePath(_0x1391de);if(_0x227422[_0x136ccf(0xbf)][_0x136ccf(0xd1)]<=_0xf1000e[_0x136ccf(0xbf)][_0x136ccf(0xd1)])return![];for(let _0x3aabe5=0x0;_0x3aabe5<_0xf1000e[_0x136ccf(0xbf)]['length'];_0x3aabe5++){if(_0x227422[_0x136ccf(0xbf)][_0x3aabe5]!==_0xf1000e[_0x136ccf(0xbf)][_0x3aabe5])return![];}return!![];}export function splitPath(_0x4f79c5){const _0x59735c=a157_0xbd72,_0x435499=parsePath(_0x4f79c5);if(_0x435499[_0x59735c(0xbf)]['length']===0x0)throw new Error(_0x59735c(0xca));if(_0x435499[_0x59735c(0xbf)][_0x59735c(0xd1)]===0x1)return{'parent':_0x435499[_0x59735c(0xbf)][0x0]};return{'parent':_0x435499[_0x59735c(0xbf)][0x0],'child':_0x435499['segments'][_0x59735c(0xe6)](0x1)[_0x59735c(0xe7)]('/')};}export function isYamlFilePath(_0x34a7f1){const _0x50d19f=a157_0xbd72;return _0x34a7f1[_0x50d19f(0xdc)](_0x50d19f(0xd4))||_0x34a7f1[_0x50d19f(0xdc)](_0x50d19f(0xd6));}export async function resolveYamlFilePath(_0x18355d,_0x25e8d9=nodeFileSystem){const _0x204266=a157_0xbd72,_0xfa7e66=a157_0x21e016[_0x204266(0xd8)](_0x18355d);if(!await _0x25e8d9[_0x204266(0xec)](_0xfa7e66))throw new Error('File\x20not\x20found:\x20'+_0x18355d);let _0x147fae=a157_0x21e016[_0x204266(0xe2)](_0xfa7e66),_0x523713=null,_0xee4eb1=null;const _0x21befe=a157_0x21e016[_0x204266(0xd3)](_0x147fae)[_0x204266(0xc4)];while(_0x147fae!==_0x21befe){const _0x192b8e=a157_0x21e016[_0x204266(0xe7)](_0x147fae,_0x204266(0xef));if(await _0x25e8d9[_0x204266(0xec)](_0x192b8e)){_0x523713=_0x192b8e,_0xee4eb1=_0x147fae;break;}_0x147fae=a157_0x21e016[_0x204266(0xe2)](_0x147fae);}if(!_0x523713||!_0xee4eb1)throw new Error('No\x20tdx.json\x20found\x20for\x20file:\x20'+_0x18355d+'\x0a'+_0x204266(0xcd));const _0x58a263=await _0x25e8d9[_0x204266(0xf0)](_0x523713),_0x22ff08=JSON[_0x204266(0xd3)](_0x58a263),_0x37111e=_0x22ff08['parent_segment'];if(!_0x37111e)throw new Error(_0x204266(0xee));const _0xb0bc8e=await _0x25e8d9[_0x204266(0xf0)](_0xfa7e66),_0x5db8e3=a157_0x121487(_0xb0bc8e),_0x19cf06=_0x5db8e3[_0x204266(0xc5)];if(!_0x19cf06)throw new Error(_0x204266(0xe1)+_0x18355d);const _0x5e8bdf=_0x5db8e3[_0x204266(0xe9)]===_0x204266(0xc8)?_0x204266(0xc8):_0x204266(0xd0),_0x1fbc5f=a157_0x21e016['relative'](_0xee4eb1,_0xfa7e66),_0x4f903c=a157_0x21e016[_0x204266(0xe2)](_0x1fbc5f),_0x5a25be=_0x4f903c==='.'?'':_0x4f903c[_0x204266(0xd2)](/\\/g,'/'),_0x4b7b3c=_0x5a25be?_0x37111e+'/'+_0x5a25be+'/'+_0x19cf06:_0x37111e+'/'+_0x19cf06;return{'parentSegment':_0x37111e,'segmentName':_0x19cf06,'folderPath':_0x5a25be,'fullPath':_0x4b7b3c,'resourceType':_0x5e8bdf,'content':_0xb0bc8e};}
@@ -1 +1 @@
1
- function a158_0x2a64(){const _0xf17d46=['570699IfogkR','Invalid\x20segment\x20reference\x20format:\x20','6362163mIaLtu','.\x20Child\x20name\x20cannot\x20be\x20empty','substring','135yQNGnu','.\x20Parent\x20name\x20cannot\x20be\x20empty','7GvYclQ','2664192OmYWvs','68394BrRKUd','2842552PPwlEM','6lezrxo','3942323nzWXMv','indexOf','10aoeMiW','455205HhAkmh'];a158_0x2a64=function(){return _0xf17d46;};return a158_0x2a64();}(function(_0x20d7b1,_0x26383e){const _0x5694ab=a158_0x42e7,_0x36856d=_0x20d7b1();while(!![]){try{const _0x5e3622=-parseInt(_0x5694ab(0x178))/0x1+parseInt(_0x5694ab(0x174))/0x2*(parseInt(_0x5694ab(0x169))/0x3)+parseInt(_0x5694ab(0x171))/0x4+parseInt(_0x5694ab(0x16e))/0x5*(parseInt(_0x5694ab(0x172))/0x6)+parseInt(_0x5694ab(0x170))/0x7*(-parseInt(_0x5694ab(0x173))/0x8)+parseInt(_0x5694ab(0x16b))/0x9*(-parseInt(_0x5694ab(0x177))/0xa)+parseInt(_0x5694ab(0x175))/0xb;if(_0x5e3622===_0x26383e)break;else _0x36856d['push'](_0x36856d['shift']());}catch(_0x48e718){_0x36856d['push'](_0x36856d['shift']());}}}(a158_0x2a64,0x5e1ca));function a158_0x42e7(_0x37ae2d,_0x4af14e){_0x37ae2d=_0x37ae2d-0x169;const _0x2a647a=a158_0x2a64();let _0x42e75a=_0x2a647a[_0x37ae2d];return _0x42e75a;}export function parseSegmentRef(_0x2e79bb){const _0x1a4e1c=a158_0x42e7,_0x630e77=_0x2e79bb[_0x1a4e1c(0x176)]('/');if(_0x630e77===-0x1)return{'parentId':_0x2e79bb};if(_0x630e77===0x0)throw new Error(_0x1a4e1c(0x16a)+_0x2e79bb+_0x1a4e1c(0x16f));const _0x5a7eb6=_0x2e79bb['substring'](0x0,_0x630e77),_0x40a2a7=_0x2e79bb[_0x1a4e1c(0x16d)](_0x630e77+0x1);if(_0x40a2a7==='')throw new Error(_0x1a4e1c(0x16a)+_0x2e79bb+_0x1a4e1c(0x16c));return{'parentId':_0x5a7eb6,'childId':_0x40a2a7};}
1
+ function a158_0x1b20(_0x19184f,_0x12ff16){_0x19184f=_0x19184f-0x14f;const _0x4a7675=a158_0x4a76();let _0x1b2077=_0x4a7675[_0x19184f];return _0x1b2077;}function a158_0x4a76(){const _0x4e9a61=['1261112EGrhgy','55OcphEi','16872nWMYZj','Invalid\x20segment\x20reference\x20format:\x20','.\x20Child\x20name\x20cannot\x20be\x20empty','substring','4NiWynk','602TZzyJZ','1714520DdrQLM','indexOf','19548rigRcd','623570gcthqH','555Ekbpiz','4006OLzult','24840OVbQfs'];a158_0x4a76=function(){return _0x4e9a61;};return a158_0x4a76();}(function(_0x334762,_0x3c4092){const _0x3d0230=a158_0x1b20,_0x181508=_0x334762();while(!![]){try{const _0x24ceb3=-parseInt(_0x3d0230(0x154))/0x1+parseInt(_0x3d0230(0x150))/0x2*(-parseInt(_0x3d0230(0x14f))/0x3)+-parseInt(_0x3d0230(0x158))/0x4*(-parseInt(_0x3d0230(0x15a))/0x5)+parseInt(_0x3d0230(0x15c))/0x6*(parseInt(_0x3d0230(0x159))/0x7)+-parseInt(_0x3d0230(0x152))/0x8+-parseInt(_0x3d0230(0x151))/0x9+parseInt(_0x3d0230(0x15d))/0xa*(parseInt(_0x3d0230(0x153))/0xb);if(_0x24ceb3===_0x3c4092)break;else _0x181508['push'](_0x181508['shift']());}catch(_0x58e7e6){_0x181508['push'](_0x181508['shift']());}}}(a158_0x4a76,0x5e7eb));export function parseSegmentRef(_0xfe14b1){const _0x1a86ee=a158_0x1b20,_0x7fa1f4=_0xfe14b1[_0x1a86ee(0x15b)]('/');if(_0x7fa1f4===-0x1)return{'parentId':_0xfe14b1};if(_0x7fa1f4===0x0)throw new Error(_0x1a86ee(0x155)+_0xfe14b1+'.\x20Parent\x20name\x20cannot\x20be\x20empty');const _0x32beef=_0xfe14b1[_0x1a86ee(0x157)](0x0,_0x7fa1f4),_0x3b5aca=_0xfe14b1['substring'](_0x7fa1f4+0x1);if(_0x3b5aca==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0xfe14b1+_0x1a86ee(0x156));return{'parentId':_0x32beef,'childId':_0x3b5aca};}
@@ -1 +1 @@
1
- (function(_0x122c6c,_0x1633f1){const _0x1f1610=a159_0x1511,_0x246b62=_0x122c6c();while(!![]){try{const _0x1a4738=parseInt(_0x1f1610(0x230))/0x1*(parseInt(_0x1f1610(0x233))/0x2)+parseInt(_0x1f1610(0x22b))/0x3*(-parseInt(_0x1f1610(0x1e9))/0x4)+parseInt(_0x1f1610(0x21f))/0x5+-parseInt(_0x1f1610(0x1fe))/0x6*(parseInt(_0x1f1610(0x1ee))/0x7)+-parseInt(_0x1f1610(0x1ef))/0x8*(parseInt(_0x1f1610(0x222))/0x9)+-parseInt(_0x1f1610(0x1eb))/0xa+-parseInt(_0x1f1610(0x20f))/0xb*(-parseInt(_0x1f1610(0x217))/0xc);if(_0x1a4738===_0x1633f1)break;else _0x246b62['push'](_0x246b62['shift']());}catch(_0x199cca){_0x246b62['push'](_0x246b62['shift']());}}}(a159_0x20b4,0xdf444));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';function a159_0x20b4(){const _0x3aa687=['.operator.value','2524790BHaURn','Behavior','attribute','686623zKFCyD','3220432oISHne','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','TimeWithinNext','Attribute\x20name\x20cannot\x20be\x20empty','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','MISSING_NAME','type','path','description','endsWith','name','custom','match','map','issues','6YhxJao','level','params','Attribute\x20\x27','Behavior\x20source\x20\x27','rule.type','.operator.type','Value','MISSING_TIME_UNIT','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','.filter','aggregation','MISSING_OPERATOR_VALUE','source','includes','push','Remove\x20\x27not:\x20false\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.','2268101pdlzqC','success','conditions','.attribute','filter','\x27\x20with\x20attribute\x20\x27','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','Remove\x20\x27not\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.','36pOSlAT','INVALID_OPERATOR_TYPE','operator','.operator.not','EMPTY_CONDITIONS','skipSchema','BEHAVIOR_SOURCE_MISSING_FILTER','code','5205555hAPXgZ','error','MISSING_BETWEEN_BOUNDS','9FRRgTi','INVALID_ARRAY_MATCHING','TEMPORAL_NEGATION_UNSUPPORTED','NESTED_CONDITION_GROUP','data','validationCode','Operator\x20\x27','.conditions[','MISSING_CONDITIONS','1344711xqYinV','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','TimeWithinPast','warning','MISSING_SEGMENT_REFERENCE','91235XWjYUk','rule','document','10LUUwHs','message','invalid_value','length','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','safeParse','.conditions','symbol','not','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','Composite','4fnLFWw'];a159_0x20b4=function(){return _0x3aa687;};return a159_0x20b4();}export function validateSegmentDef(_0x4a616d,_0x8f3d21={},_0x20ecf4={}){const _0x3d52ba=a159_0x1511;if(_0x20ecf4[_0x3d52ba(0x21c)])return runSemanticChecks(_0x4a616d,_0x8f3d21);const _0x2e3bac=SegmentDefSchema[_0x3d52ba(0x1e3)](_0x4a616d);if(_0x2e3bac[_0x3d52ba(0x210)])return runSemanticChecks(_0x2e3bac[_0x3d52ba(0x226)],_0x8f3d21);return zodErrorsToValidationResult(_0x2e3bac[_0x3d52ba(0x220)],_0x8f3d21);}export function validateRuleDef(_0x4431c9,_0x8e5dbc,_0xf5c73a){const _0x953589=a159_0x1511;if(!_0x4431c9)return[];const _0x38f9ee=RuleDefSchema['safeParse'](_0x4431c9);if(_0x38f9ee['success'])return checkRule(_0x38f9ee[_0x953589(0x226)],_0x8e5dbc,_0xf5c73a);const _0x115126=flattenZodIssues(_0x38f9ee[_0x953589(0x220)][_0x953589(0x1fd)]);return _0x115126[_0x953589(0x1fc)](_0x39c0f6=>{const _0x3cd0b5=_0x953589,_0x30a5d0=formatZodPath(_0x39c0f6[_0x3cd0b5(0x1f6)]),_0x88770e=_0x30a5d0?_0x8e5dbc+'.'+_0x30a5d0:_0x8e5dbc,_0x32d33e=mapZodIssueToCode(_0x39c0f6,_0x30a5d0),_0x5f516c=getLocationFromPath(_0xf5c73a[_0x3cd0b5(0x232)],_0xf5c73a[_0x3cd0b5(0x20b)],pathToArray(_0x88770e));return{'level':'error','path':_0x88770e,'code':_0x32d33e,'message':_0x39c0f6[_0x3cd0b5(0x234)],..._0x5f516c&&{'location':_0x5f516c}};});}function zodErrorsToValidationResult(_0x310b73,_0x4de2c3){const _0xc17b76=a159_0x1511,_0x538456=flattenZodIssues(_0x310b73[_0xc17b76(0x1fd)]),_0xf73e7c=_0x538456[_0xc17b76(0x1fc)](_0x5f2f51=>{const _0x28706c=_0xc17b76,_0x1e3a82=formatZodPath(_0x5f2f51['path']),_0x2b5266=mapZodIssueToCode(_0x5f2f51,_0x1e3a82),_0x25bcaa=getLocationFromPath(_0x4de2c3[_0x28706c(0x232)],_0x4de2c3[_0x28706c(0x20b)],_0x5f2f51[_0x28706c(0x1f6)][_0x28706c(0x1fc)](_0x2f47dc=>typeof _0x2f47dc===_0x28706c(0x1e5)?String(_0x2f47dc):_0x2f47dc));return{'level':_0x28706c(0x220),'path':_0x1e3a82,'code':_0x2b5266,'message':_0x5f2f51['message'],..._0x25bcaa&&{'location':_0x25bcaa}};});return{'valid':![],'errors':_0xf73e7c,'warnings':[]};}function mapZodIssueToCode(_0x4492cb,_0xd0b6a){const _0x2b669e=a159_0x1511,_0x2397ce=_0x4492cb[_0x2b669e(0x21e)]===_0x2b669e(0x1fa)?_0x4492cb[_0x2b669e(0x200)]:undefined;if(_0xd0b6a===_0x2b669e(0x1f9))return _0x2b669e(0x1f4);if(_0xd0b6a===_0x2b669e(0x203)||_0xd0b6a['endsWith']('.type')){if(_0x4492cb[_0x2b669e(0x21e)]===_0x2b669e(0x235)){if(_0xd0b6a==='rule.type'||_0xd0b6a[_0x2b669e(0x1fb)](/\.conditions\[\d+\]\.type$/))return'INVALID_RULE_TYPE';}}if(_0xd0b6a[_0x2b669e(0x1f8)](_0x2b669e(0x204)))return _0x2b669e(0x218);if(_0xd0b6a[_0x2b669e(0x1f8)](_0x2b669e(0x1ea)))return _0x2b669e(0x20a);if(_0x2397ce?.[_0x2b669e(0x227)]===_0x2b669e(0x221))return _0x2b669e(0x221);if(_0x2397ce?.[_0x2b669e(0x227)]==='MISSING_TIME_UNIT')return _0x2b669e(0x206);if(_0xd0b6a[_0x2b669e(0x1f8)](_0x2b669e(0x1e4))||_0xd0b6a===_0x2b669e(0x211))return _0x2b669e(0x22a);if(_0xd0b6a[_0x2b669e(0x20c)]('arrayMatching'))return _0x2b669e(0x223);if(_0xd0b6a[_0x2b669e(0x1f8)]('.segment'))return _0x2b669e(0x22f);return'SEGMENT_SCHEMA_ERROR';}function runSemanticChecks(_0x373bb0,_0x4b426e){const _0x398717=a159_0x1511,_0x1ea58d=[];_0x373bb0[_0x398717(0x231)]&&_0x1ea58d[_0x398717(0x20d)](...checkRule(_0x373bb0[_0x398717(0x231)],_0x398717(0x231),_0x4b426e));const _0x383357=_0x1ea58d['filter'](_0x27c2ef=>_0x27c2ef[_0x398717(0x1ff)]==='error'),_0x173261=_0x1ea58d[_0x398717(0x213)](_0x57e6de=>_0x57e6de[_0x398717(0x1ff)]===_0x398717(0x22e));return{'valid':_0x383357['length']===0x0,'errors':_0x383357,'warnings':_0x173261};}function a159_0x1511(_0x3e25d0,_0x1d51ab){_0x3e25d0=_0x3e25d0-0x1e2;const _0x20b44c=a159_0x20b4();let _0x1511c8=_0x20b44c[_0x3e25d0];return _0x1511c8;}function checkRule(_0x49d888,_0x54a124,_0x1865cd){const _0x1762bf=a159_0x1511,_0x3f5c1b=[];if(_0x49d888['conditions']['length']===0x0)return _0x3f5c1b['push']({'level':_0x1762bf(0x220),'path':_0x54a124+_0x1762bf(0x1e4),'code':_0x1762bf(0x21b),'message':_0x1762bf(0x207),'location':getLocationFromPath(_0x1865cd[_0x1762bf(0x232)],_0x1865cd['source'],pathToArray(_0x54a124+_0x1762bf(0x1e4)))}),_0x3f5c1b;return _0x3f5c1b[_0x1762bf(0x20d)](...checkConditions(_0x49d888[_0x1762bf(0x211)],_0x54a124,_0x1865cd)),_0x3f5c1b;}function checkConditions(_0x60743d,_0x599675,_0x5c69f2){const _0x1fe69=a159_0x1511,_0x1d434=[];for(let _0x21d322=0x0;_0x21d322<_0x60743d[_0x1fe69(0x236)];_0x21d322++){const _0x2b8b05=_0x60743d[_0x21d322],_0x42f5f7=_0x599675+_0x1fe69(0x229)+_0x21d322+']';_0x1d434[_0x1fe69(0x20d)](...checkCondition(_0x2b8b05,_0x42f5f7,_0x5c69f2));}return _0x1d434;}function checkCondition(_0x2b24a6,_0x56aeff,_0x30b243){const _0xfbc84=a159_0x1511,_0x4b3080=[];if(_0x2b24a6['type']==='And'||_0x2b24a6[_0xfbc84(0x1f5)]==='Or'||_0x2b24a6[_0xfbc84(0x1f5)]===_0xfbc84(0x1e8)){if(_0x2b24a6[_0xfbc84(0x211)][_0xfbc84(0x236)]===0x0)_0x4b3080[_0xfbc84(0x20d)]({'level':'error','path':_0x56aeff+_0xfbc84(0x1e4),'code':_0xfbc84(0x21b),'message':_0x2b24a6['type']+_0xfbc84(0x215),'location':getLocationFromPath(_0x30b243[_0xfbc84(0x232)],_0x30b243['source'],pathToArray(_0x56aeff+_0xfbc84(0x1e4)))});else{const _0x370b46=_0x2b24a6[_0xfbc84(0x1f7)]!==undefined,_0x6bc3b0=_0x2b24a6[_0xfbc84(0x1f5)]===_0xfbc84(0x1e8);!_0x370b46&&!_0x6bc3b0&&_0x4b3080['push']({'level':_0xfbc84(0x22e),'path':_0x56aeff,'code':_0xfbc84(0x225),'message':_0x2b24a6[_0xfbc84(0x1f5)]+'\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20'+_0xfbc84(0x1f0)+_0xfbc84(0x1e7),'location':getLocationFromPath(_0x30b243[_0xfbc84(0x232)],_0x30b243[_0xfbc84(0x20b)],pathToArray(_0x56aeff))}),_0x4b3080['push'](...checkConditions(_0x2b24a6[_0xfbc84(0x211)],_0x56aeff,_0x30b243));}return _0x4b3080;}if(_0x2b24a6[_0xfbc84(0x1f5)]===_0xfbc84(0x205)||_0x2b24a6[_0xfbc84(0x1f5)]===_0xfbc84(0x1ec)){const _0x5221a5=_0x2b24a6,_0x247ac1=_0x5221a5['source'],_0x2a3d06=_0x5221a5[_0xfbc84(0x209)],_0x1057a4=_0x247ac1||_0x2a3d06,_0x5a7ef3=_0x5221a5[_0xfbc84(0x219)]?.[_0xfbc84(0x1f5)];if((_0x5a7ef3===_0xfbc84(0x22d)||_0x5a7ef3===_0xfbc84(0x1f1))&&_0x5221a5[_0xfbc84(0x219)]?.[_0xfbc84(0x1e6)]!==undefined){const _0x4f643a=_0x5221a5['operator'][_0xfbc84(0x1e6)]===!![];_0x4b3080[_0xfbc84(0x20d)]({'level':_0x4f643a?'error':_0xfbc84(0x22e),'path':_0x56aeff+_0xfbc84(0x21a),'code':_0xfbc84(0x224),'message':_0x4f643a?_0xfbc84(0x228)+_0x5a7ef3+'\x27\x20with\x20\x27not:\x20true\x27\x20is\x20not\x20supported\x20by\x20the\x20Console\x20segment\x20editor.\x20'+'The\x20editor\x20will\x20silently\x20drop\x20the\x20negation\x20and\x20corrupt\x20the\x20segment\x20on\x20re-save.\x20'+_0xfbc84(0x216):_0xfbc84(0x228)+_0x5a7ef3+'\x27\x20does\x20not\x20support\x20the\x20\x27not\x27\x20field.\x20'+_0xfbc84(0x20e),'location':getLocationFromPath(_0x30b243['document'],_0x30b243[_0xfbc84(0x20b)],pathToArray(_0x56aeff+_0xfbc84(0x21a)))});}(!_0x5221a5[_0xfbc84(0x1ed)]||_0x5221a5[_0xfbc84(0x1ed)]==='')&&(!_0x1057a4&&_0x4b3080[_0xfbc84(0x20d)]({'level':_0xfbc84(0x220),'path':_0x56aeff+_0xfbc84(0x212),'code':'EMPTY_ATTRIBUTE','message':_0xfbc84(0x1f2),'location':getLocationFromPath(_0x30b243['document'],_0x30b243['source'],pathToArray(_0x56aeff+_0xfbc84(0x212)))}));_0x5221a5['filter']&&_0x4b3080['push'](...checkRule(_0x5221a5[_0xfbc84(0x213)],_0x56aeff+_0xfbc84(0x208),_0x30b243));if(_0x5221a5[_0xfbc84(0x20b)]){const _0x27dc33=_0x5221a5[_0xfbc84(0x1ed)]&&_0x5221a5['attribute']!=='';_0x27dc33&&!_0x5221a5[_0xfbc84(0x213)]&&_0x4b3080[_0xfbc84(0x20d)]({'level':_0xfbc84(0x220),'path':_0x56aeff+'.source','code':_0xfbc84(0x21d),'message':_0xfbc84(0x202)+_0x5221a5[_0xfbc84(0x20b)]+_0xfbc84(0x214)+_0x5221a5[_0xfbc84(0x1ed)]+'\x27\x20'+_0xfbc84(0x1f3)+_0xfbc84(0x1e2)+'Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','location':getLocationFromPath(_0x30b243['document'],_0x30b243[_0xfbc84(0x20b)],pathToArray(_0x56aeff+'.source'))}),_0x27dc33&&_0x5221a5['filter']&&_0x4b3080['push']({'level':_0xfbc84(0x22e),'path':_0x56aeff+_0xfbc84(0x212),'code':_0xfbc84(0x22c),'message':_0xfbc84(0x201)+_0x5221a5[_0xfbc84(0x1ed)]+'\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20'+'For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','location':getLocationFromPath(_0x30b243['document'],_0x30b243[_0xfbc84(0x20b)],pathToArray(_0x56aeff+'.attribute'))});}}return _0x4b3080;}
1
+ (function(_0x1d666b,_0xed3ddf){const _0x4d699f=a159_0x279f,_0x2956c0=_0x1d666b();while(!![]){try{const _0xfa0a6d=-parseInt(_0x4d699f(0x1a4))/0x1*(-parseInt(_0x4d699f(0x17c))/0x2)+parseInt(_0x4d699f(0x1a8))/0x3*(parseInt(_0x4d699f(0x17f))/0x4)+-parseInt(_0x4d699f(0x18d))/0x5*(-parseInt(_0x4d699f(0x194))/0x6)+-parseInt(_0x4d699f(0x199))/0x7+parseInt(_0x4d699f(0x190))/0x8*(-parseInt(_0x4d699f(0x185))/0x9)+parseInt(_0x4d699f(0x173))/0xa+-parseInt(_0x4d699f(0x170))/0xb;if(_0xfa0a6d===_0xed3ddf)break;else _0x2956c0['push'](_0x2956c0['shift']());}catch(_0x562ee5){_0x2956c0['push'](_0x2956c0['shift']());}}}(a159_0x43dc,0x1882f));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x25efbb,_0x2a6897={},_0xc51495={}){const _0x383d02=a159_0x279f;if(_0xc51495[_0x383d02(0x180)])return runSemanticChecks(_0x25efbb,_0x2a6897);const _0x95dfe8=SegmentDefSchema[_0x383d02(0x1ab)](_0x25efbb);if(_0x95dfe8[_0x383d02(0x1b2)])return runSemanticChecks(_0x95dfe8[_0x383d02(0x15b)],_0x2a6897);return zodErrorsToValidationResult(_0x95dfe8[_0x383d02(0x192)],_0x2a6897);}export function validateRuleDef(_0x21e4e1,_0x48af95,_0x413a38){const _0x2b3577=a159_0x279f;if(!_0x21e4e1)return[];const _0x28bbcb=RuleDefSchema['safeParse'](_0x21e4e1);if(_0x28bbcb[_0x2b3577(0x1b2)])return checkRule(_0x28bbcb['data'],_0x48af95,_0x413a38);const _0x3de9f1=flattenZodIssues(_0x28bbcb[_0x2b3577(0x192)][_0x2b3577(0x1ad)]);return _0x3de9f1['map'](_0x196f0a=>{const _0x50d9b6=_0x2b3577,_0x283aa3=formatZodPath(_0x196f0a[_0x50d9b6(0x16e)]),_0x2dee4d=_0x283aa3?_0x48af95+'.'+_0x283aa3:_0x48af95,_0x30286a=mapZodIssueToCode(_0x196f0a,_0x283aa3),_0x9698d5=getLocationFromPath(_0x413a38[_0x50d9b6(0x1ac)],_0x413a38[_0x50d9b6(0x178)],pathToArray(_0x2dee4d));return{'level':'error','path':_0x2dee4d,'code':_0x30286a,'message':_0x196f0a[_0x50d9b6(0x19a)],..._0x9698d5&&{'location':_0x9698d5}};});}function zodErrorsToValidationResult(_0x42cf0a,_0x49a93a){const _0x224606=a159_0x279f,_0x2b5dbc=flattenZodIssues(_0x42cf0a['issues']),_0x2e45b1=_0x2b5dbc[_0x224606(0x177)](_0x315925=>{const _0x374f30=_0x224606,_0x368f3d=formatZodPath(_0x315925[_0x374f30(0x16e)]),_0x226e5a=mapZodIssueToCode(_0x315925,_0x368f3d),_0x4168fc=getLocationFromPath(_0x49a93a[_0x374f30(0x1ac)],_0x49a93a['source'],_0x315925['path'][_0x374f30(0x177)](_0x80fc9f=>typeof _0x80fc9f===_0x374f30(0x15d)?String(_0x80fc9f):_0x80fc9f));return{'level':_0x374f30(0x192),'path':_0x368f3d,'code':_0x226e5a,'message':_0x315925[_0x374f30(0x19a)],..._0x4168fc&&{'location':_0x4168fc}};});return{'valid':![],'errors':_0x2e45b1,'warnings':[]};}function mapZodIssueToCode(_0x104609,_0x419954){const _0x3fe3e0=a159_0x279f,_0x42d654=_0x104609[_0x3fe3e0(0x196)]===_0x3fe3e0(0x18a)?_0x104609[_0x3fe3e0(0x195)]:undefined;if(_0x419954==='name')return'MISSING_NAME';if(_0x419954==='rule.type'||_0x419954[_0x3fe3e0(0x1b1)]('.type')){if(_0x104609[_0x3fe3e0(0x196)]===_0x3fe3e0(0x1a2)){if(_0x419954===_0x3fe3e0(0x169)||_0x419954[_0x3fe3e0(0x15f)](/\.conditions\[\d+\]\.type$/))return _0x3fe3e0(0x175);}}if(_0x419954[_0x3fe3e0(0x1b1)](_0x3fe3e0(0x1a3)))return _0x3fe3e0(0x197);if(_0x419954[_0x3fe3e0(0x1b1)]('.operator.value'))return _0x3fe3e0(0x161);if(_0x42d654?.[_0x3fe3e0(0x15c)]===_0x3fe3e0(0x187))return _0x3fe3e0(0x187);if(_0x42d654?.[_0x3fe3e0(0x15c)]===_0x3fe3e0(0x17e))return'MISSING_TIME_UNIT';if(_0x419954[_0x3fe3e0(0x1b1)]('.conditions')||_0x419954==='conditions')return _0x3fe3e0(0x1b0);if(_0x419954[_0x3fe3e0(0x1a1)](_0x3fe3e0(0x1af)))return'INVALID_ARRAY_MATCHING';if(_0x419954[_0x3fe3e0(0x1b1)](_0x3fe3e0(0x19b)))return'MISSING_SEGMENT_REFERENCE';return _0x3fe3e0(0x176);}function runSemanticChecks(_0x306643,_0x280160){const _0x22e066=a159_0x279f,_0x2e19ce=[];_0x306643['rule']&&_0x2e19ce[_0x22e066(0x189)](...checkRule(_0x306643[_0x22e066(0x18b)],'rule',_0x280160));const _0x291d51=_0x2e19ce[_0x22e066(0x16f)](_0x5a7462=>_0x5a7462[_0x22e066(0x168)]==='error'),_0x4c1fc0=_0x2e19ce[_0x22e066(0x16f)](_0x307e10=>_0x307e10['level']===_0x22e066(0x162));return{'valid':_0x291d51[_0x22e066(0x198)]===0x0,'errors':_0x291d51,'warnings':_0x4c1fc0};}function checkRule(_0x875312,_0x307a32,_0x284e0e){const _0x4566d7=a159_0x279f,_0x37f06f=[];if(_0x875312[_0x4566d7(0x1a7)][_0x4566d7(0x198)]===0x0)return _0x37f06f[_0x4566d7(0x189)]({'level':_0x4566d7(0x192),'path':_0x307a32+_0x4566d7(0x163),'code':'EMPTY_CONDITIONS','message':_0x4566d7(0x186),'location':getLocationFromPath(_0x284e0e[_0x4566d7(0x1ac)],_0x284e0e[_0x4566d7(0x178)],pathToArray(_0x307a32+'.conditions'))}),_0x37f06f;return _0x37f06f['push'](...checkConditions(_0x875312[_0x4566d7(0x1a7)],_0x307a32,_0x284e0e)),_0x37f06f;}function checkConditions(_0x530d1e,_0x1b693e,_0x1ac70c){const _0x2dc356=a159_0x279f,_0xe8a437=[];for(let _0x4c72d2=0x0;_0x4c72d2<_0x530d1e['length'];_0x4c72d2++){const _0x2c704d=_0x530d1e[_0x4c72d2],_0x190c8f=_0x1b693e+_0x2dc356(0x1a5)+_0x4c72d2+']';_0xe8a437[_0x2dc356(0x189)](...checkCondition(_0x2c704d,_0x190c8f,_0x1ac70c));}return _0xe8a437;}function checkCondition(_0x63c02d,_0x4a69d1,_0xd8e01c){const _0x4f243a=a159_0x279f,_0x39ebf9=[];if(_0x63c02d[_0x4f243a(0x167)]===_0x4f243a(0x19f)||_0x63c02d[_0x4f243a(0x167)]==='Or'||_0x63c02d[_0x4f243a(0x167)]===_0x4f243a(0x164)){if(_0x63c02d[_0x4f243a(0x1a7)][_0x4f243a(0x198)]===0x0)_0x39ebf9['push']({'level':_0x4f243a(0x192),'path':_0x4a69d1+_0x4f243a(0x163),'code':_0x4f243a(0x1a0),'message':_0x63c02d['type']+_0x4f243a(0x18f),'location':getLocationFromPath(_0xd8e01c[_0x4f243a(0x1ac)],_0xd8e01c[_0x4f243a(0x178)],pathToArray(_0x4a69d1+_0x4f243a(0x163)))});else{const _0x29568a=_0x63c02d['description']!==undefined,_0x4bc2d9=_0x63c02d[_0x4f243a(0x167)]==='Composite';!_0x29568a&&!_0x4bc2d9&&_0x39ebf9[_0x4f243a(0x189)]({'level':_0x4f243a(0x162),'path':_0x4a69d1,'code':_0x4f243a(0x174),'message':_0x63c02d[_0x4f243a(0x167)]+_0x4f243a(0x18c)+_0x4f243a(0x1a6)+_0x4f243a(0x160),'location':getLocationFromPath(_0xd8e01c[_0x4f243a(0x1ac)],_0xd8e01c[_0x4f243a(0x178)],pathToArray(_0x4a69d1))}),_0x39ebf9['push'](...checkConditions(_0x63c02d[_0x4f243a(0x1a7)],_0x4a69d1,_0xd8e01c));}return _0x39ebf9;}if(_0x63c02d[_0x4f243a(0x167)]===_0x4f243a(0x1aa)||_0x63c02d['type']===_0x4f243a(0x184)){const _0x2dc944=_0x63c02d,_0x2bb4f0=_0x2dc944[_0x4f243a(0x178)],_0x347950=_0x2dc944[_0x4f243a(0x165)],_0x4c1171=_0x2bb4f0||_0x347950,_0xb850c2=_0x2dc944[_0x4f243a(0x1ae)]?.[_0x4f243a(0x167)];if((_0xb850c2===_0x4f243a(0x17d)||_0xb850c2==='TimeWithinNext')&&_0x2dc944['operator']?.['not']!==undefined){const _0x1ffa71=_0x2dc944[_0x4f243a(0x1ae)][_0x4f243a(0x19d)]===!![];_0x39ebf9[_0x4f243a(0x189)]({'level':_0x1ffa71?_0x4f243a(0x192):'warning','path':_0x4a69d1+_0x4f243a(0x172),'code':_0x4f243a(0x16d),'message':_0x1ffa71?_0x4f243a(0x19e)+_0xb850c2+_0x4f243a(0x17a)+_0x4f243a(0x166)+_0x4f243a(0x188):_0x4f243a(0x19e)+_0xb850c2+'\x27\x20does\x20not\x20support\x20the\x20\x27not\x27\x20field.\x20'+_0x4f243a(0x183),'location':getLocationFromPath(_0xd8e01c['document'],_0xd8e01c[_0x4f243a(0x178)],pathToArray(_0x4a69d1+_0x4f243a(0x172)))});}(!_0x2dc944[_0x4f243a(0x193)]||_0x2dc944['attribute']==='')&&(!_0x4c1171&&_0x39ebf9[_0x4f243a(0x189)]({'level':_0x4f243a(0x192),'path':_0x4a69d1+'.attribute','code':_0x4f243a(0x1a9),'message':_0x4f243a(0x171),'location':getLocationFromPath(_0xd8e01c[_0x4f243a(0x1ac)],_0xd8e01c[_0x4f243a(0x178)],pathToArray(_0x4a69d1+_0x4f243a(0x179)))}));_0x2dc944[_0x4f243a(0x16f)]&&_0x39ebf9[_0x4f243a(0x189)](...checkRule(_0x2dc944[_0x4f243a(0x16f)],_0x4a69d1+_0x4f243a(0x19c),_0xd8e01c));if(_0x2dc944[_0x4f243a(0x178)]){const _0x2f54c6=_0x2dc944[_0x4f243a(0x193)]&&_0x2dc944[_0x4f243a(0x193)]!=='';_0x2f54c6&&!_0x2dc944['filter']&&_0x39ebf9[_0x4f243a(0x189)]({'level':_0x4f243a(0x192),'path':_0x4a69d1+'.source','code':_0x4f243a(0x181),'message':'Behavior\x20source\x20\x27'+_0x2dc944['source']+_0x4f243a(0x18e)+_0x2dc944[_0x4f243a(0x193)]+'\x27\x20'+_0x4f243a(0x15e)+_0x4f243a(0x191)+_0x4f243a(0x182),'location':getLocationFromPath(_0xd8e01c['document'],_0xd8e01c['source'],pathToArray(_0x4a69d1+_0x4f243a(0x16a)))}),_0x2f54c6&&_0x2dc944[_0x4f243a(0x16f)]&&_0x39ebf9['push']({'level':_0x4f243a(0x162),'path':_0x4a69d1+_0x4f243a(0x179),'code':_0x4f243a(0x16c),'message':_0x4f243a(0x1b3)+_0x2dc944[_0x4f243a(0x193)]+_0x4f243a(0x17b)+_0x4f243a(0x16b),'location':getLocationFromPath(_0xd8e01c['document'],_0xd8e01c['source'],pathToArray(_0x4a69d1+_0x4f243a(0x179)))});}}return _0x39ebf9;}function a159_0x279f(_0x191457,_0x5ede60){_0x191457=_0x191457-0x15b;const _0x43dca2=a159_0x43dc();let _0x279f38=_0x43dca2[_0x191457];return _0x279f38;}function a159_0x43dc(){const _0x26a4f5=['\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','1788PdUhwI','TimeWithinPast','MISSING_TIME_UNIT','1768VJZvMp','skipSchema','BEHAVIOR_SOURCE_MISSING_FILTER','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','Remove\x20\x27not:\x20false\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.','Behavior','84951UpXpeG','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','MISSING_BETWEEN_BOUNDS','Remove\x20\x27not\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.','push','custom','rule','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','980615Bjuzsb','\x27\x20with\x20attribute\x20\x27','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','56bNfZir','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','error','attribute','6OwrpPt','params','code','INVALID_OPERATOR_TYPE','length','282422NNsonr','message','.segment','.filter','not','Operator\x20\x27','And','EMPTY_CONDITIONS','includes','invalid_value','.operator.type','82iMFalB','.conditions[','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','conditions','1002prArlK','EMPTY_ATTRIBUTE','Value','safeParse','document','issues','operator','arrayMatching','MISSING_CONDITIONS','endsWith','success','Attribute\x20\x27','data','validationCode','symbol','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','match','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','MISSING_OPERATOR_VALUE','warning','.conditions','Composite','aggregation','The\x20editor\x20will\x20silently\x20drop\x20the\x20negation\x20and\x20corrupt\x20the\x20segment\x20on\x20re-save.\x20','type','level','rule.type','.source','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','TEMPORAL_NEGATION_UNSUPPORTED','path','filter','2320967UWkSqn','Attribute\x20name\x20cannot\x20be\x20empty','.operator.not','7560Ynvpbq','NESTED_CONDITION_GROUP','INVALID_RULE_TYPE','SEGMENT_SCHEMA_ERROR','map','source','.attribute','\x27\x20with\x20\x27not:\x20true\x27\x20is\x20not\x20supported\x20by\x20the\x20Console\x20segment\x20editor.\x20'];a159_0x43dc=function(){return _0x26a4f5;};return a159_0x43dc();}