@treasuredata/tdx 2026.3.42 → 2026.3.43

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 (219) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/auth-login-command.js +1 -1
  11. package/dist/commands/cas-command.js +1 -1
  12. package/dist/commands/cas-segment-command.js +1 -1
  13. package/dist/commands/chat-command.js +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-statusline-command.js +1 -1
  16. package/dist/commands/claude-usage-command.js +1 -1
  17. package/dist/commands/command.js +1 -1
  18. package/dist/commands/connection-command.js +1 -1
  19. package/dist/commands/databases.js +1 -1
  20. package/dist/commands/delivery-command.js +1 -1
  21. package/dist/commands/describe.js +1 -1
  22. package/dist/commands/engage-campaign-pull-command.js +1 -1
  23. package/dist/commands/engage-campaign-push-command.js +1 -1
  24. package/dist/commands/engage-campaign-validate-command.js +1 -1
  25. package/dist/commands/engage-command.js +1 -1
  26. package/dist/commands/engage-template-pull-command.js +1 -1
  27. package/dist/commands/engage-template-push-command.js +1 -1
  28. package/dist/commands/engage-template-validate-command.js +1 -1
  29. package/dist/commands/job-command.js +1 -1
  30. package/dist/commands/journey-command.js +1 -1
  31. package/dist/commands/journey-validate-command.js +1 -1
  32. package/dist/commands/llm-command.js +1 -1
  33. package/dist/commands/mcp-command.js +1 -1
  34. package/dist/commands/parent-segment-command.js +1 -1
  35. package/dist/commands/policy-command.js +1 -1
  36. package/dist/commands/profile-command.js +1 -1
  37. package/dist/commands/profiles-command.js +1 -1
  38. package/dist/commands/query-command.js +1 -1
  39. package/dist/commands/schedule-command.js +1 -1
  40. package/dist/commands/segment-command.js +1 -1
  41. package/dist/commands/segment-create-command.js +1 -1
  42. package/dist/commands/segment-fields-command.js +1 -1
  43. package/dist/commands/segment-pull-command.js +1 -1
  44. package/dist/commands/segment-push-command.js +1 -1
  45. package/dist/commands/segment-update-command.js +1 -1
  46. package/dist/commands/segment-use-command.js +1 -1
  47. package/dist/commands/segment-validate-command.js +1 -1
  48. package/dist/commands/segments.js +1 -1
  49. package/dist/commands/show.js +1 -1
  50. package/dist/commands/status-command.js +1 -1
  51. package/dist/commands/tables.js +1 -1
  52. package/dist/commands/unset-command.js +1 -1
  53. package/dist/commands/upgrade-command.js +1 -1
  54. package/dist/commands/use-command.js +1 -1
  55. package/dist/commands/user-command.js +1 -1
  56. package/dist/commands/work-command.js +1 -1
  57. package/dist/commands/workflow-command.js +1 -1
  58. package/dist/core/auth.js +1 -1
  59. package/dist/core/command-output.js +1 -1
  60. package/dist/core/config.js +1 -1
  61. package/dist/core/connection-cache.js +1 -1
  62. package/dist/core/constants.js +1 -1
  63. package/dist/core/credential-cache.js +1 -1
  64. package/dist/core/global-context.js +1 -1
  65. package/dist/core/keychain.js +1 -1
  66. package/dist/core/oauth-keychain.js +1 -1
  67. package/dist/core/oauth.js +1 -1
  68. package/dist/core/profile.js +1 -1
  69. package/dist/core/project-config.js +1 -1
  70. package/dist/core/session.js +1 -1
  71. package/dist/core/user-cache.js +1 -1
  72. package/dist/core/version.js +1 -1
  73. package/dist/index.js +1 -1
  74. package/dist/mcp/server.js +1 -1
  75. package/dist/mcp/tools/index.js +1 -1
  76. package/dist/mcp/tools/tdx-run.js +1 -1
  77. package/dist/mcp/tools/tdx-search.js +1 -1
  78. package/dist/mcp/utils.js +1 -1
  79. package/dist/proxy/claude-usage-tracker.js +1 -1
  80. package/dist/proxy/passthrough-server.js +1 -1
  81. package/dist/proxy/sse-usage-parser.js +1 -1
  82. package/dist/sdk/agent/agent-config.js +1 -1
  83. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  84. package/dist/sdk/agent/agent-yaml.js +1 -1
  85. package/dist/sdk/agent/test/evaluator.js +1 -1
  86. package/dist/sdk/agent/test/executor.js +1 -1
  87. package/dist/sdk/agent/test/index.js +1 -1
  88. package/dist/sdk/agent/test/output.js +1 -1
  89. package/dist/sdk/agent/test/parser.js +1 -1
  90. package/dist/sdk/agent/tool-target-registry.js +1 -1
  91. package/dist/sdk/api.js +1 -1
  92. package/dist/sdk/cas/cas-api-client.js +1 -1
  93. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  94. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  95. package/dist/sdk/cas/index.js +1 -1
  96. package/dist/sdk/cas/pull-workflow.js +1 -1
  97. package/dist/sdk/cas/push-workflow.js +1 -1
  98. package/dist/sdk/client/cdp-api-client.js +1 -1
  99. package/dist/sdk/client/delivery-api-client.js +1 -1
  100. package/dist/sdk/client/endpoints.js +1 -1
  101. package/dist/sdk/client/engage-api-client.js +1 -1
  102. package/dist/sdk/client/http-client.js +1 -1
  103. package/dist/sdk/client/llm-api-client.js +1 -1
  104. package/dist/sdk/client/oauth-refresh.js +1 -1
  105. package/dist/sdk/client/rate-limiter.js +1 -1
  106. package/dist/sdk/client/td-api-client.js +1 -1
  107. package/dist/sdk/client/trino-api-client.js +1 -1
  108. package/dist/sdk/client/workflow-client.js +1 -1
  109. package/dist/sdk/connection-validator.js +1 -1
  110. package/dist/sdk/connection.js +1 -1
  111. package/dist/sdk/delivery.js +1 -1
  112. package/dist/sdk/engage/campaign-pull.js +1 -1
  113. package/dist/sdk/engage/campaign-push.js +1 -1
  114. package/dist/sdk/engage/campaign-validator.js +1 -1
  115. package/dist/sdk/engage/campaign-yaml.js +1 -1
  116. package/dist/sdk/engage/template-pull.js +1 -1
  117. package/dist/sdk/engage/template-push.js +1 -1
  118. package/dist/sdk/engage/template-validator.js +1 -1
  119. package/dist/sdk/engage/template-yaml.js +1 -1
  120. package/dist/sdk/engage/types/campaign-def.js +1 -1
  121. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  122. package/dist/sdk/engage/types/template-schema.js +1 -1
  123. package/dist/sdk/engage.js +1 -1
  124. package/dist/sdk/errors.js +1 -1
  125. package/dist/sdk/index.js +1 -1
  126. package/dist/sdk/io/index.js +1 -1
  127. package/dist/sdk/io/node-filesystem.js +1 -1
  128. package/dist/sdk/job.js +1 -1
  129. package/dist/sdk/journey.js +1 -1
  130. package/dist/sdk/llm/chat-cache.js +1 -1
  131. package/dist/sdk/llm/index.js +1 -1
  132. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  133. package/dist/sdk/llm/model-factors.js +1 -1
  134. package/dist/sdk/personalization.js +1 -1
  135. package/dist/sdk/policy.js +1 -1
  136. package/dist/sdk/query/index.js +1 -1
  137. package/dist/sdk/query/sql-parser.js +1 -1
  138. package/dist/sdk/realtime.js +1 -1
  139. package/dist/sdk/schedule.js +1 -1
  140. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  141. package/dist/sdk/segment/fields-display.js +1 -1
  142. package/dist/sdk/segment/file-discovery.js +1 -1
  143. package/dist/sdk/segment/journey-utils.js +1 -1
  144. package/dist/sdk/segment/journey-validator.js +1 -1
  145. package/dist/sdk/segment/journey-yaml.js +1 -1
  146. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  147. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  148. package/dist/sdk/segment/pull-workflow.js +1 -1
  149. package/dist/sdk/segment/push-recovery.js +1 -1
  150. package/dist/sdk/segment/push-workflow.js +1 -1
  151. package/dist/sdk/segment/resolution-context.js +1 -1
  152. package/dist/sdk/segment/segment-path-parser.js +1 -1
  153. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  154. package/dist/sdk/segment/segment-validator.js +1 -1
  155. package/dist/sdk/segment/target-resolution.js +1 -1
  156. package/dist/sdk/segment/tdx-config.js +1 -1
  157. package/dist/sdk/segment/types/activation-schema.js +1 -1
  158. package/dist/sdk/segment/types/journey-def.js +1 -1
  159. package/dist/sdk/segment/types/journey-schema.js +1 -1
  160. package/dist/sdk/segment/types/segment-def.js +1 -1
  161. package/dist/sdk/segment/types/segment-schema.js +1 -1
  162. package/dist/sdk/segment/validate-files.js +1 -1
  163. package/dist/sdk/segment/yaml-validator.js +1 -1
  164. package/dist/sdk/segment.js +1 -1
  165. package/dist/sdk/types/index.js +1 -1
  166. package/dist/sdk/types/progress.js +1 -1
  167. package/dist/sdk/types/workspace.js +1 -1
  168. package/dist/sdk/user.js +1 -1
  169. package/dist/sdk/util/format-detector.js +1 -1
  170. package/dist/sdk/util/formatters.js +1 -1
  171. package/dist/sdk/util/index.js +1 -1
  172. package/dist/sdk/util/paginate.js +1 -1
  173. package/dist/sdk/util/tree-formatter.js +1 -1
  174. package/dist/sdk/workflow/archive-validation.js +1 -1
  175. package/dist/sdk/workflow/clone-workflow.js +1 -1
  176. package/dist/sdk/workflow/index.js +1 -1
  177. package/dist/sdk/workflow/pull-workflow.js +1 -1
  178. package/dist/sdk/workflow/push-workflow.js +1 -1
  179. package/dist/sdk/workflow/tdx-config.js +1 -1
  180. package/dist/sdk/workflow/workflow-utils.js +1 -1
  181. package/dist/sdk/workspace/frontmatter.js +1 -1
  182. package/dist/sdk/workspace/git.js +1 -1
  183. package/dist/sdk/workspace/index.js +1 -1
  184. package/dist/sdk/workspace/templates.js +1 -1
  185. package/dist/sdk/workspace/weekly.js +1 -1
  186. package/dist/sdk/workspace/wikilinks.js +1 -1
  187. package/dist/test-utils/command-runner.js +1 -1
  188. package/dist/test-utils/factories.js +1 -1
  189. package/dist/test-utils/fixtures.js +1 -1
  190. package/dist/test-utils/http-mock.js +1 -1
  191. package/dist/test-utils/index.js +1 -1
  192. package/dist/utils/async.js +1 -1
  193. package/dist/utils/colors.js +1 -1
  194. package/dist/utils/diff.js +1 -1
  195. package/dist/utils/file-permissions.js +1 -1
  196. package/dist/utils/file-reader.js +1 -1
  197. package/dist/utils/github-releases.js +1 -1
  198. package/dist/utils/global-cache.js +1 -1
  199. package/dist/utils/json-loader.js +1 -1
  200. package/dist/utils/local-cache.js +1 -1
  201. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  202. package/dist/utils/logger/formatters/index.js +1 -1
  203. package/dist/utils/logger/handlers/console-handler.js +1 -1
  204. package/dist/utils/logger/handlers/file-handler.js +1 -1
  205. package/dist/utils/logger/handlers/index.js +1 -1
  206. package/dist/utils/logger/handlers/null-handler.js +1 -1
  207. package/dist/utils/logger/index.js +1 -1
  208. package/dist/utils/logger/logger.js +1 -1
  209. package/dist/utils/logger/types.js +1 -1
  210. package/dist/utils/option-validation.js +1 -1
  211. package/dist/utils/process.js +1 -1
  212. package/dist/utils/prompt.js +1 -1
  213. package/dist/utils/spinner.js +1 -1
  214. package/dist/utils/sse-parser.js +1 -1
  215. package/dist/utils/string-utils.js +1 -1
  216. package/dist/utils/table-ref-parser.js +1 -1
  217. package/dist/utils/tdx-logger.js +1 -1
  218. package/dist/utils/version-check.js +1 -1
  219. package/package.json +1 -1
@@ -1 +1 @@
1
- const a152_0x33e6a2=a152_0x591f;(function(_0xb03d36,_0x1c8cc2){const _0x650d8f=a152_0x591f,_0x663443=_0xb03d36();while(!![]){try{const _0x38832b=parseInt(_0x650d8f(0x13c))/0x1*(-parseInt(_0x650d8f(0xa4))/0x2)+parseInt(_0x650d8f(0xa9))/0x3+parseInt(_0x650d8f(0x139))/0x4*(parseInt(_0x650d8f(0x12b))/0x5)+parseInt(_0x650d8f(0x112))/0x6*(parseInt(_0x650d8f(0xcc))/0x7)+parseInt(_0x650d8f(0x113))/0x8+-parseInt(_0x650d8f(0x108))/0x9+-parseInt(_0x650d8f(0xee))/0xa;if(_0x38832b===_0x1c8cc2)break;else _0x663443['push'](_0x663443['shift']());}catch(_0x2c8aaf){_0x663443['push'](_0x663443['shift']());}}}(a152_0x555c,0x710fc));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of']('tdx.sdk.push-workflow');export const PENDING_SEGMENT_PREFIX=a152_0x33e6a2(0xef);export const PENDING_ACTIVATION_PREFIX=a152_0x33e6a2(0x13f);export function createPendingSegmentId(_0x25074c){return''+PENDING_SEGMENT_PREFIX+_0x25074c+'__';}export function isPendingSegmentId(_0x5d247e){const _0x4089cf=a152_0x33e6a2;return _0x5d247e['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x5d247e[_0x4089cf(0xe8)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x3e1139){return _0x3e1139['replace'](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x4cc1b8){return''+PENDING_ACTIVATION_PREFIX+_0x4cc1b8+'__';}export function isPendingActivationId(_0x4fe5f5){const _0x45944c=a152_0x33e6a2;return _0x4fe5f5[_0x45944c(0xe8)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x5531b1){const _0x2c167d=a152_0x33e6a2;return _0x5531b1[_0x2c167d(0xb7)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x2a9aa9,_0x1234de){const _0xa104dd=a152_0x33e6a2,_0x59876a=_0x2a9aa9+'::'+(_0x1234de[_0xa104dd(0xc5)]()||_0xa104dd(0x197)),_0x241209=createHash('sha1')['update'](_0x59876a)[_0xa104dd(0x158)](_0xa104dd(0x12d))[_0xa104dd(0x12c)](0x0,0xc);return _0xa104dd(0x15d)+_0x241209;}export function ensureJourneyDefaults(_0x3ce02b){const _0x1d1fdb=a152_0x33e6a2;!_0x3ce02b[_0x1d1fdb(0xdf)]&&(_0x3ce02b[_0x1d1fdb(0xdf)]=''),!_0x3ce02b[_0x1d1fdb(0x19a)]&&(_0x3ce02b[_0x1d1fdb(0x19a)]=_0x1d1fdb(0x14a));}export function injectExistingStageIds(_0x348a16,_0xdbe24c){const _0x20b5bd=a152_0x33e6a2,_0x2ba503=new Map(_0xdbe24c[_0x20b5bd(0x129)](_0x14f4e2=>[_0x14f4e2['name'],_0x14f4e2['id']]));for(const _0x5151f3 of _0x348a16){if(!_0x5151f3['id']){const _0x37c7a3=_0x2ba503['get'](_0x5151f3[_0x20b5bd(0x121)]);_0x37c7a3&&(_0x5151f3['id']=_0x37c7a3);}}}export function resolveTDFolderPath(_0x18e0df,_0xe080b3,_0x4c293d){const _0x1f9fef=a152_0x33e6a2;if(!_0xe080b3)return _0x18e0df;if(_0x18e0df===_0x4c293d||_0x18e0df[_0x1f9fef(0xe8)](_0x4c293d+'/'))return _0x18e0df;return _0x18e0df?_0x4c293d+'/'+_0x18e0df:_0x4c293d;}export function addFoldersToCreate(_0x18df84,_0xab9533,_0xa408b8){const _0x423bc7=a152_0x33e6a2;if(!_0x18df84)return;if(_0xab9533[_0x423bc7(0x198)](_0x18df84))return;const _0x15f4fa=_0x18df84[_0x423bc7(0xc9)]('/');let _0x2d6ed2='';for(const _0x178ca6 of _0x15f4fa){_0x2d6ed2=_0x2d6ed2?_0x2d6ed2+'/'+_0x178ca6:_0x178ca6,!_0xab9533[_0x423bc7(0x198)](_0x2d6ed2)&&_0xa408b8[_0x423bc7(0xbb)](_0x2d6ed2);}}export function sortFoldersByDepth(_0x2c5b46){const _0x297dfd=a152_0x33e6a2;return[..._0x2c5b46][_0x297dfd(0xb8)]((_0x557bb4,_0x329d1a)=>{const _0x21e981=_0x297dfd,_0x45a6a6=(_0x557bb4['match'](/\//g)||[])[_0x21e981(0xae)],_0x5c190a=(_0x329d1a[_0x21e981(0x17f)](/\//g)||[])[_0x21e981(0xae)];return _0x45a6a6-_0x5c190a;});}import*as a152_0x559f5b from'yaml';import{readFileSync}from'fs';function a152_0x555c(){const _0xf23850=['isArray','unchanged','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','isNew','journey','segmentFolderId','deps','journey_created','SEGMENT_SYNTAX_ERROR','137542NwjgED','get','hasChanges','activation_updating','uniqueServerName','811680mRqQlQ','activation_template_id','Activation','updateActivation','\x20segment\x20from\x20file:\x20','length','push','attributes','some','parseDocument','journey_updated','conditionTimeoutDuration','NOT_FOUND','\x27\x20exit\x20criteria','replace','sort','Activation\x20not\x20found:\x20','nameToId','add','join','segment_deleted','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','withProgress','journeys','data','):\x20','DecisionPoint','SEGMENT_NOT_FOUND','trim','journeyActivationStepId','conditionTimeoutUnit','Creating\x20segment\x20\x27','split','utf-8','resolveSegment','3227FblMEh','Created\x20folder\x20\x27','listActivations','onProgress','\x20journey\x20from\x20file:\x20','from','journeyBundleName','activationActions','uniqueSegmentName',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','relationships','\x0a\x20\x20','relative','connectionIdToNameMap','localName','segments','flatMap','Embedded\x20segment\x20\x27','embeddedSegmentNameToId','description','deleteSegment','create','folderPath','reduce','item','\x27\x20decision\x20point\x20branch\x20\x27','createdSegmentId','getJourney','startsWith','entry_criteria','logDeleted','Condition','segmentNameToId','kind','396280pKCQUk','__pending_','size','columns','all_columns','activations','entryCriteria','includes','debug','waitStepType','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','Segment\x20not\x20found:\x20','schedule','waitStep','steps','diff','journeyName','folderPathToId','goal','rootFolderId','activation_deleting','journeyStages','\x27\x20not\x20found\x20in\x20journey\x20\x27','\x27\x20from\x20file:\x20','yamlConfig','activation_','4839102efQFZJ','find','\x27\x20by\x20rule\x20content','parentId','valid','activation_created','\x27\x20for\x20','journey_creating','updateSegmentById','validatedRequest','8508thXWFm','3243400yzbLQj','segment_created','SEGMENT_UPDATE_ERROR','getLatestJourneyId','values','type','\x20error(s)','max','yamlActivation','entry','created','activationContext','JOURNEY_SYNTAX_ERROR','updated','name','Matched\x20server\x20segment\x20\x27','Failed\x20to\x20','conditionSegmentId','existingJourney','activation_deleted','conditions','branches','map','toISOString','136445adsFaC','slice','hex','notification','filter','createActivation','embedded_segment_creating','stage\x20\x27','journey_updating','getSegment','toLowerCase','keys','activationsBySegmentId','journeyId','8UvJNiy','WaitStep','segment_updating','5pNysIJ','logSuccess','run_after_journey_refresh','__pending_act_','rule','segment_deleting','activationStepsById','Updating\x20segment\x20\x27','Creating\x20folder\x20\x27','ACTIVATION_SYNTAX_ERROR','goal\x20criteria','verbose','with','embedded_segment_created','draft','Entry\x20criteria:\x20','Created\x20activation\x20\x27','progress','idToName','null','waitStepUnit','createJourneySegment','skipSegments','set','\x27...','fetchJourney','update','toString','digest','./journey-yaml.js','exitCriterias','action','Updated\x20journey\x20\x27','journey_entry_criteria_','segmentId','entries','Creating\x20activation\x20\x27','./child-segment-yaml.js','\x20activation\x20\x27','getActivation','embedded_activation_created','resolveJourneyId','behavior','getSegmentEntity\x20also\x20failed\x20for\x20','segment_updated','Created\x20segment\x20\x27','createSegment','results','idToEmailMap','connector_config','createdSegmentIds','dirname','embedded_activation_creating','connection','Fetching\x20','Name\x20has\x20already\x20been\x20taken','day','parentFolder','activationParams','ACTIVATION_UPDATE_ERROR','Segment\x20not\x20found','effectiveFolderId','logInfo','Delete\x20the\x20push\x20recovery\x20file\x20(','parse','all','buildUserMaps','match','Stage\x20\x27','deleted','delete','index','milestone','Failed\x20to\x20resolve\x20activation\x20','journeyBundlesByFolderAndName','existingSegments','existingActivation','INTERNAL','activation_updated','\x27\x20wait\x20condition','../../utils/async.js','stringify','\x27\x20milestone','folderId','absolutePath','nameToType','existingSegment','\x20(referenced\x20in\x20journey\x20','Failed\x20to\x20resolve\x20segment\x20','stages','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','segment','has','deleteActivation','state','versionNumber','journeyById'];a152_0x555c=function(){return _0xf23850;};return a152_0x555c();}import a152_0x3c1d30 from'path';import{isJourneyDef,parseYamlString as a152_0x418e5c,toYamlString as a152_0x2bc7f9,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(_0x24a935){const _0x4240bb=a152_0x33e6a2;if(Array[_0x4240bb(0x19d)](_0x24a935))return'['+_0x24a935[_0x4240bb(0x129)](_0x581763=>stableStringify(_0x581763))[_0x4240bb(0xbc)](',')+']';if(_0x24a935&&typeof _0x24a935==='object'){const _0x6b456d=_0x24a935,_0x266d22=Object[_0x4240bb(0x136)](_0x6b456d)[_0x4240bb(0xb8)](),_0x28a545=_0x266d22[_0x4240bb(0x129)](_0x5cf121=>'\x22'+_0x5cf121+'\x22:'+stableStringify(_0x6b456d[_0x5cf121]));return'{'+_0x28a545[_0x4240bb(0xbc)](',')+'}';}const _0x58f8c9=JSON[_0x4240bb(0x18d)](_0x24a935);return _0x58f8c9===undefined?_0x4240bb(0x14f):_0x58f8c9;}function activationSignature(_0x1f1791){const _0x59e2f1=a152_0x33e6a2,_0x17e38d={'connection':_0x1f1791[_0x59e2f1(0x171)],..._0x1f1791[_0x59e2f1(0xf2)]!==undefined&&{'all_columns':_0x1f1791[_0x59e2f1(0xf2)]},..._0x1f1791[_0x59e2f1(0xf1)]!==undefined&&{'columns':_0x1f1791['columns']},..._0x1f1791[_0x59e2f1(0x166)]!==undefined&&{'behavior':_0x1f1791[_0x59e2f1(0x166)]},..._0x1f1791[_0x59e2f1(0xfa)]!==undefined&&{'schedule':_0x1f1791[_0x59e2f1(0xfa)]},..._0x1f1791[_0x59e2f1(0x12e)]!==undefined&&{'notification':_0x1f1791[_0x59e2f1(0x12e)]},..._0x1f1791[_0x59e2f1(0x16d)]!==undefined&&{'connector_config':_0x1f1791[_0x59e2f1(0x16d)]},..._0x1f1791[_0x59e2f1(0xaa)]!==undefined&&{'activation_template_id':_0x1f1791[_0x59e2f1(0xaa)]}};return stableStringify(_0x17e38d);}async function fetchSegment(_0x463d73,_0x1d4932,_0x4ff9a7,_0x1256c3){const _0x3b3429=a152_0x33e6a2,_0x30f91a=_0x1256c3?.['find'](_0x4cc5aa=>_0x4cc5aa['id']===_0x4ff9a7);if(_0x30f91a)return _0x30f91a;try{return await _0x463d73[_0x3b3429(0x197)][_0x3b3429(0x134)](_0x1d4932,_0x4ff9a7);}catch(_0x23cf96){logger[_0x3b3429(0xf6)]('getSegment\x20failed\x20for\x20'+_0x4ff9a7+_0x3b3429(0xd5)+_0x23cf96);try{return await _0x463d73[_0x3b3429(0x197)]['getSegmentEntity'](_0x4ff9a7);}catch(_0x236c65){return logger[_0x3b3429(0xf6)](_0x3b3429(0x167)+_0x4ff9a7+':\x20'+_0x236c65),null;}}}function recoverSegmentIdsFromPushRecovery(_0x553793,_0x3278ba,_0x14e130){const _0x3bb337=a152_0x33e6a2,_0x27c549=readPushRecovery(_0x553793[_0x3bb337(0x190)]);if(_0x27c549?.['journeyName']===_0x553793[_0x3bb337(0x106)][_0x3bb337(0x121)])for(const [_0x7f2afe,_0x3a8ae2]of Object[_0x3bb337(0x15f)](_0x27c549[_0x3bb337(0xdb)])){const _0x463ddd=generateDeterministicJourneySegmentName(_0x553793[_0x3bb337(0x106)][_0x3bb337(0x121)],_0x7f2afe);_0x3a8ae2[_0x3bb337(0xa8)]===_0x463ddd&&(_0x3278ba[_0x3bb337(0x153)](_0x7f2afe,_0x3a8ae2['segmentId']),_0x14e130[_0x3bb337(0x153)](_0x7f2afe,_0x3a8ae2[_0x3bb337(0x15e)]));}}async function createOrRecoverEmbeddedSegment(_0x556482,_0x9c8c83,_0xbfcac7,_0x14b0d3){const _0x53517f=a152_0x33e6a2;let _0x58ec29;try{_0x58ec29=await _0x556482[_0x53517f(0x197)][_0x53517f(0x151)]({'name':_0xbfcac7[_0x53517f(0xd4)],'description':_0xbfcac7[_0x53517f(0xdf)],'journeyId':_0xbfcac7[_0x53517f(0x138)],'rule':_0x14b0d3(_0xbfcac7['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0xbfcac7[_0x53517f(0x18f)],'audienceId':_0xbfcac7[_0x53517f(0x10b)]});}catch(_0x447780){const _0x5e8dda=_0x447780 instanceof Error&&_0x447780['message'][_0x53517f(0xf5)](_0x53517f(0x173));if(_0x5e8dda){const _0x441477=readPushRecovery(_0x9c8c83[_0x53517f(0x190)]),_0x16eb3e=_0x441477?.[_0x53517f(0xfe)]===_0x9c8c83[_0x53517f(0x106)][_0x53517f(0x121)]?_0x441477['segments'][_0xbfcac7[_0x53517f(0xda)]]:undefined;if(_0x16eb3e?.[_0x53517f(0xa8)]===_0xbfcac7[_0x53517f(0xd4)])await _0x556482[_0x53517f(0x197)]['updateSegmentById'](_0xbfcac7[_0x53517f(0x10b)],_0x16eb3e[_0x53517f(0x15e)],{'description':_0xbfcac7['description'],'rule':_0x14b0d3(_0xbfcac7['resolvedRule'],!![]),'countPopulation':!![]}),_0x58ec29=_0x16eb3e[_0x53517f(0x15e)];else throw new SDKError(ErrorCode[_0x53517f(0x115)],_0x53517f(0xdd)+_0xbfcac7[_0x53517f(0xda)]+_0x53517f(0x196)+(_0x53517f(0x17b)+_0x9c8c83[_0x53517f(0x190)][_0x53517f(0xb7)](/([^/]+)$/,'.$1.push-recovery.json')+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x447780);}else throw _0x447780;}return saveSegmentToPushRecovery(_0x9c8c83[_0x53517f(0x190)],_0x9c8c83['yamlConfig'][_0x53517f(0x121)],_0xbfcac7[_0x53517f(0xda)],{'segmentId':_0x58ec29,'uniqueServerName':_0xbfcac7[_0x53517f(0xd4)],'createdAt':new Date()[_0x53517f(0x12a)]()}),_0x58ec29;}export async function prepareSegmentFiles(_0x2edf4a,_0x3d1a9a,_0x27d68c,_0x588e2e,_0x370860){const _0x55a8ce=a152_0x33e6a2,{activationDefToCreateRequest:_0x232941}=await import('./child-segment-yaml.js'),_0x22a503=[],_0x2a35a5=new Set();for(const {yamlConfig:_0x4fc187,folderPath:_0x1e7b93,sourcePath:_0x402780}of _0x2edf4a){const _0x55032c=resolveTDFolderPath(_0x1e7b93,_0x588e2e,_0x370860),_0x50f4bc=_0x55032c+':'+_0x4fc187[_0x55a8ce(0x121)],_0xe7e5fd=_0x3d1a9a['segmentByFolderAndName']['get'](_0x50f4bc),_0x43c628=_0xe7e5fd?_0x3d1a9a[_0x55a8ce(0x137)]['get'](_0xe7e5fd['id'])||[]:[];addFoldersToCreate(_0x55032c,_0x3d1a9a['folderPathToId'],_0x2a35a5);const _0x16f7ce=calculateActivationActions(_0x4fc187[_0x55a8ce(0xf3)]||[],_0x43c628,_0x3d1a9a[_0x55a8ce(0x16c)],_0x3d1a9a[_0x55a8ce(0xd9)]);for(const _0x301aa4 of _0x16f7ce){(_0x301aa4['type']===_0x55a8ce(0xe1)||_0x301aa4[_0x55a8ce(0x118)]==='update')&&_0x301aa4[_0x55a8ce(0x11b)]&&(_0x301aa4['validatedRequest']=await _0x232941(_0x301aa4[_0x55a8ce(0x11b)],_0x27d68c));}const _0x2cc3a9=calculateSegmentDiff(_0x4fc187,_0xe7e5fd,_0x43c628,_0x3d1a9a[_0x55a8ce(0x16c)],_0x3d1a9a[_0x55a8ce(0xd9)]);_0x22a503[_0x55a8ce(0xaf)]({'relativePath':_0x4fc187[_0x55a8ce(0x121)],'absolutePath':_0x402780,'yamlConfig':_0x4fc187,'folderPath':_0x55032c,'existingSegment':_0xe7e5fd,'existingActivations':_0x43c628,'isNew':_0x2cc3a9[_0x55a8ce(0x9e)],'hasChanges':_0x2cc3a9['hasChanges'],'diff':_0x2cc3a9[_0x55a8ce(0xfd)],'activationActions':_0x16f7ce});}return{'segmentFiles':_0x22a503,'foldersToCreate':_0x2a35a5};}export async function prepareJourneyFiles(_0x473c65,_0x50f831,_0x265fd1,_0x26ebf4){const _0x2f2807=a152_0x33e6a2,_0x18cc49=[],_0x26c00b=new Set();for(const {yamlConfig:_0x4a1679,folderPath:_0x5685ef,sourcePath:_0x1385c8}of _0x473c65){const _0x44c1aa=resolveTDFolderPath(_0x5685ef,_0x265fd1,_0x26ebf4),_0x2333df=_0x44c1aa+':'+_0x4a1679[_0x2f2807(0x121)],_0x15063c=_0x50f831[_0x2f2807(0x186)][_0x2f2807(0xa5)](_0x2333df);let _0x14e035,_0x4f0b3c;if(_0x15063c&&_0x15063c[_0x2f2807(0xae)]>0x0){const _0xb6b9e=buildLocalExpandedRuleMappings(_0x4a1679),{createYamlContext:_0x3ec505,prefetchJourneySegments:_0x1873ef}=createPushYamlContextForBundle(_0x50f831[_0x2f2807(0xa1)],_0x50f831[_0x2f2807(0x10b)],_0x50f831[_0x2f2807(0x187)],_0xb6b9e,_0x50f831['idToEmailMap'],_0x50f831['connectionIdToNameMap'],_0x50f831[_0x2f2807(0x142)],_0x50f831['journeyById']);await _0x1873ef(_0x15063c[_0x2f2807(0x129)](_0x440f9a=>_0x440f9a['id']));const _0x2c1a7a=await _0x50f831['deps'][_0x2f2807(0x9f)][_0x2f2807(0x116)](_0x15063c[0x0]['journeyBundleId']),_0x585727=hasMultipleVersions(_0x4a1679),_0x174c03=async _0x4e3726=>{const _0x4856f2=_0x2f2807,_0x55090c=_0x50f831[_0x4856f2(0x19c)]?.['get'](_0x4e3726);if(_0x55090c)return _0x55090c;return _0x50f831[_0x4856f2(0x155)]({'journeyId':_0x4e3726,'journeyName':_0x4a1679['name'],'isMultiVersion':_0x15063c[_0x4856f2(0xae)]>0x1});};if(_0x585727&&_0x15063c[_0x2f2807(0xae)]>0x1){const _0x462815=[];for(const _0x442236 of _0x15063c){const _0x386af0=_0x442236[_0x2f2807(0x19b)]||0x1;_0x50f831[_0x2f2807(0x14d)]?.['update'](_0x2f2807(0x172)+_0x4a1679[_0x2f2807(0x121)]+'\x20v'+_0x386af0);const _0x13f378=await _0x174c03(_0x442236['id']),_0x1ec861=_0x3ec505(_0x442236['id']),_0x4ca480=await journeyResponseToDef(_0x13f378,_0x1ec861);_0x462815['push']({'item':_0x442236,'yaml':_0x4ca480});}const _0x14c579=buildLocalRuleToNameMappingFromJourney(_0x4a1679);_0x4f0b3c=buildMergedJourneyDef(_0x462815,_0x14c579,_0x2c1a7a);const _0x396681=Math['max'](..._0x462815[_0x2f2807(0x129)](_0x57aa28=>_0x57aa28[_0x2f2807(0xe4)]['versionNumber']||0x0)),_0x2752c8=_0x15063c[_0x2f2807(0x109)](_0xa8965d=>(_0xa8965d['versionNumber']||0x0)===_0x396681);_0x2752c8&&(_0x50f831[_0x2f2807(0x14d)]?.[_0x2f2807(0x156)](_0x2f2807(0x172)+_0x4a1679[_0x2f2807(0x121)]+'\x20v'+_0x396681),_0x14e035=await _0x174c03(_0x2752c8['id']));}else{const _0x33a6f4=_0x15063c[_0x15063c['length']-0x1];_0x50f831[_0x2f2807(0x14d)]?.[_0x2f2807(0x156)](_0x2f2807(0x172)+_0x4a1679[_0x2f2807(0x121)]),_0x14e035=await _0x174c03(_0x33a6f4['id']);const _0x57a842=_0x3ec505(_0x33a6f4['id']),_0x5447a0=await journeyResponseToDef(_0x14e035,_0x57a842),_0x58e9d1=buildLocalRuleToNameMappingFromJourney(_0x4a1679);_0x4f0b3c=buildMergedJourneyDef([{'item':_0x33a6f4,'yaml':_0x5447a0}],_0x58e9d1,_0x2c1a7a);}}addFoldersToCreate(_0x44c1aa,_0x50f831[_0x2f2807(0xff)],_0x26c00b);const _0x3834a1=calculateJourneyDiff(_0x4a1679,_0x4f0b3c);_0x18cc49['push']({'relativePath':_0x4a1679['name'],'absolutePath':_0x1385c8,'yamlConfig':_0x4a1679,'folderPath':_0x44c1aa,'existingJourney':_0x14e035,'isNew':_0x3834a1[_0x2f2807(0x9e)],'hasChanges':_0x3834a1['hasChanges'],'diff':_0x3834a1[_0x2f2807(0xfd)]});}return{'journeyFiles':_0x18cc49,'foldersToCreate':_0x26c00b};}export function calculateActivationActions(_0xb1f854,_0x5b389a,_0x51dee0,_0x459648){const _0x23295d=a152_0x33e6a2,_0x351b15=[],_0x2f5884=new Map();for(const _0x326916 of _0x5b389a){_0x2f5884[_0x23295d(0x153)](_0x326916['name'],_0x326916);}const _0x212b3a=new Map();for(const _0x335b55 of _0xb1f854){_0x212b3a[_0x23295d(0x153)](_0x335b55[_0x23295d(0x121)],_0x335b55);}for(const _0x50cc1f of _0xb1f854){const _0x277779=_0x2f5884[_0x23295d(0xa5)](_0x50cc1f[_0x23295d(0x121)]);if(!_0x277779)_0x351b15[_0x23295d(0xaf)]({'type':'create','name':_0x50cc1f[_0x23295d(0x121)],'yamlActivation':_0x50cc1f});else{const _0xaf33c6=activationResponseToDef(_0x277779,_0x51dee0,_0x459648),_0x572acb=a152_0x559f5b[_0x23295d(0x18d)](_0xaf33c6),_0x4dd1c0=a152_0x559f5b[_0x23295d(0x18d)](_0x50cc1f);_0x572acb!==_0x4dd1c0&&_0x351b15[_0x23295d(0xaf)]({'type':_0x23295d(0x156),'name':_0x50cc1f['name'],'yamlActivation':_0x50cc1f,'existingActivation':_0x277779});}}for(const _0x39c0ad of _0x5b389a){!_0x212b3a[_0x23295d(0x198)](_0x39c0ad[_0x23295d(0x121)])&&_0x351b15[_0x23295d(0xaf)]({'type':_0x23295d(0x182),'name':_0x39c0ad[_0x23295d(0x121)],'existingActivation':_0x39c0ad});}return _0x351b15;}function calculateYamlDiff(_0x5ef664,_0x14c685){if(_0x14c685){const _0x34932f=generateDiff(_0x14c685,_0x5ef664),_0x4d9679=hasChanges(_0x34932f);return{'isNew':![],'hasChanges':_0x4d9679,'diff':_0x4d9679?formatDiffWithColors(_0x34932f):undefined};}const _0x4470dc=generateDiff('',_0x5ef664);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x4470dc)};}export function calculateSegmentDiff(_0x1522a2,_0x16604a,_0x21a0f9,_0x421983,_0x4c9046){const _0x3bdf9f=segmentToYamlString(_0x1522a2),_0x343abe=_0x16604a?segmentToYamlString(segmentWithActivationsToYaml(_0x16604a,_0x21a0f9,undefined,_0x421983,_0x4c9046)):undefined;return calculateYamlDiff(_0x3bdf9f,_0x343abe);}export function calculateJourneyDiff(_0x41b5ce,_0x4d0796){const _0x8500cd=normalizeJourneyDef(_0x41b5ce,_0x41b5ce),_0x291cb8=a152_0x2bc7f9(_0x8500cd),_0x1e9817=_0x4d0796?a152_0x2bc7f9(normalizeJourneyDef(_0x4d0796,_0x41b5ce)):undefined;return calculateYamlDiff(_0x291cb8,_0x1e9817);}export function findSegmentsToDelete(_0x2d4871,_0x2f7a10,_0x402693,_0x1f9997,_0x2f8340){const _0x4c1238=a152_0x33e6a2,_0x21edac=new Set();for(const {yamlConfig:_0x532855,folderPath:_0x58f119}of _0x2f7a10){_0x21edac['add'](_0x58f119+':'+_0x532855['name']);}return _0x2d4871[_0x4c1238(0x12f)](_0x571e84=>{const _0x149089=_0x4c1238,_0x558d17=_0x571e84[_0x149089(0xa0)]?_0x402693['get'](_0x571e84[_0x149089(0xa0)]['toString']())||'':'',_0x4d3d89=_0x558d17+':'+_0x571e84[_0x149089(0x121)];if(_0x21edac[_0x149089(0x198)](_0x4d3d89))return![];if(_0x2f8340)return _0x558d17===_0x1f9997||_0x558d17[_0x149089(0xe8)](_0x1f9997+'/');return!![];});}export function findJourneysToDelete(_0x298d83,_0x5aac0d,_0x3dacf3,_0x2c523a,_0x2d0447){const _0x2b034d=a152_0x33e6a2,_0x92a97b=new Set();for(const {yamlConfig:_0x3ad6a0,folderPath:_0x4f024f}of _0x5aac0d){_0x92a97b[_0x2b034d(0xbb)](_0x4f024f+':'+_0x3ad6a0['name']);}return _0x298d83[_0x2b034d(0x12f)](_0x44db89=>{const _0x4f3c15=_0x2b034d,_0x37ff64=_0x44db89[_0x4f3c15(0x18f)]?_0x3dacf3[_0x4f3c15(0xa5)](_0x44db89[_0x4f3c15(0x18f)])||'':'',_0x305d67=_0x37ff64+':'+_0x44db89[_0x4f3c15(0xd2)];if(_0x92a97b[_0x4f3c15(0x198)](_0x305d67))return![];if(_0x2d0447)return _0x37ff64===_0x2c523a||_0x37ff64[_0x4f3c15(0xe8)](_0x2c523a+'/');return!![];});}function a152_0x591f(_0x58e09e,_0x41bff5){_0x58e09e=_0x58e09e-0x9c;const _0x555cdf=a152_0x555c();let _0x591f20=_0x555cdf[_0x58e09e];return _0x591f20;}export function buildSegmentLookupMap(_0x337b62,_0xcdaf73){const _0x2c8c75=a152_0x33e6a2,_0x1722ec=new Map();for(const _0x46b749 of _0x337b62){const _0x13af04=_0x46b749[_0x2c8c75(0xa0)]?_0xcdaf73[_0x2c8c75(0xa5)](_0x46b749[_0x2c8c75(0xa0)][_0x2c8c75(0x157)]())||'':'',_0x45b2dd=_0x13af04+':'+_0x46b749[_0x2c8c75(0x121)];_0x1722ec[_0x2c8c75(0x153)](_0x45b2dd,_0x46b749);}return _0x1722ec;}export function buildSegmentNameToIdMap(_0x4dab46){const _0x2d2fae=a152_0x33e6a2,_0x3e1648=new Map();for(const _0x240a96 of _0x4dab46){_0x3e1648[_0x2d2fae(0x153)](_0x240a96[_0x2d2fae(0x121)],_0x240a96['id']);}return _0x3e1648;}export function buildJourneyBundleLookupMap(_0x13336b,_0x40a2d0){const _0x5463fe=a152_0x33e6a2,_0x22df47=new Map();for(const _0x48ee76 of _0x13336b){const _0x617d32=_0x48ee76['folderId']?_0x40a2d0['get'](_0x48ee76['folderId'])||'':'',_0x25f950=_0x617d32+':'+_0x48ee76[_0x5463fe(0xd2)];!_0x22df47[_0x5463fe(0x198)](_0x25f950)&&_0x22df47[_0x5463fe(0x153)](_0x25f950,[]),_0x22df47['get'](_0x25f950)[_0x5463fe(0xaf)](_0x48ee76);}for(const _0x372029 of _0x22df47[_0x5463fe(0x117)]()){_0x372029[_0x5463fe(0xb8)]((_0x4c979e,_0x46ea0b)=>(_0x4c979e['versionNumber']||0x0)-(_0x46ea0b['versionNumber']||0x0));}return _0x22df47;}export function collectFoldersToCreate(_0xc3d22b,_0x4113e7){const _0x155c1a=a152_0x33e6a2,_0x5e75b1=new Set();for(const _0x399515 of _0xc3d22b){if(!_0x399515)continue;if(_0x4113e7[_0x155c1a(0x198)](_0x399515))continue;const _0x4348eb=_0x399515[_0x155c1a(0xc9)]('/');let _0x1bc667='';for(const _0x5d841d of _0x4348eb){_0x1bc667=_0x1bc667?_0x1bc667+'/'+_0x5d841d:_0x5d841d,!_0x4113e7[_0x155c1a(0x198)](_0x1bc667)&&_0x5e75b1[_0x155c1a(0xbb)](_0x1bc667);}}return _0x5e75b1;}export function parseAndClassifyYamlFiles(_0x5f2ef3,_0x12dae6,_0x53fef9){const _0x50eea7=a152_0x33e6a2,_0x5b1bf8=[],_0x35627f=[];for(const _0x425514 of _0x5f2ef3){const _0x2b4a33=a152_0x3c1d30[_0x50eea7(0xd8)](_0x12dae6,a152_0x3c1d30[_0x50eea7(0x16f)](_0x425514)),_0x2dc6f5=_0x2b4a33==='.'?'':_0x2b4a33,_0x430528=readFileSync(_0x425514,'utf-8'),_0x1a141d=a152_0x559f5b['parse'](_0x430528);if(isJourneyDef(_0x1a141d)){const _0x5c573d=a152_0x418e5c(_0x430528);_0x35627f[_0x50eea7(0xaf)]({'yamlConfig':_0x5c573d,'folderPath':_0x2dc6f5,'sourcePath':_0x425514});}else{if(!_0x53fef9?.[_0x50eea7(0x152)]){const _0x103ca8=parseSegmentYamlFile(_0x430528),_0x5a2655=normalizeChildSegmentYaml(_0x103ca8);_0x5b1bf8[_0x50eea7(0xaf)]({'yamlConfig':_0x5a2655,'folderPath':_0x2dc6f5,'sourcePath':_0x425514});}}}return{'segments':_0x5b1bf8,'journeys':_0x35627f};}export function validateParsedFiles(_0x55e620,_0x57f2c1){const _0x20898c=a152_0x33e6a2,_0x3a350d=[];for(const {yamlConfig:_0x1c8316,sourcePath:_0x177d16}of _0x55e620[_0x20898c(0xdb)]){const _0xa158df=readFileSync(_0x177d16,_0x20898c(0xca)),_0x21b040=a152_0x559f5b[_0x20898c(0xb2)](_0xa158df),_0x1d3a9c=validateSegmentDef(_0x1c8316,{'source':_0xa158df,'document':_0x21b040},{'skipSchema':!![]});if(!_0x1d3a9c['valid']){const _0x10c7a9=a152_0x3c1d30[_0x20898c(0xd8)](_0x57f2c1,_0x177d16);_0x3a350d[_0x20898c(0xaf)]({'filePath':_0x10c7a9,'source':_0xa158df,'result':_0x1d3a9c,'isJourney':![]});}}for(const {yamlConfig:_0x1b9614,sourcePath:_0x151e1e}of _0x55e620[_0x20898c(0xc0)]){const _0x37c9fe=readFileSync(_0x151e1e,_0x20898c(0xca)),_0x32eedc=a152_0x559f5b[_0x20898c(0xb2)](_0x37c9fe),_0x4c7f02=validateJourneyDef(_0x1b9614,{'source':_0x37c9fe,'document':_0x32eedc},{'skipSchema':!![]});if(!_0x4c7f02[_0x20898c(0x10c)]){const _0x3e94d9=a152_0x3c1d30[_0x20898c(0xd8)](_0x57f2c1,_0x151e1e);_0x3a350d[_0x20898c(0xaf)]({'filePath':_0x3e94d9,'source':_0x37c9fe,'result':_0x4c7f02,'isJourney':!![]});}}return _0x3a350d;}export function formatValidationErrors(_0x177f54){const _0x465aa9=a152_0x33e6a2,_0x43c6eb=[];for(const {filePath:_0x25ab7c,source:_0x212d40,result:_0x623cb8,isJourney:_0x363e67}of _0x177f54){const _0x20a1aa=_0x363e67?_0x465aa9(0x9f):'segment';_0x43c6eb['push']('\x0a'+_0x25ab7c+'\x20('+_0x20a1aa+_0x465aa9(0xc2)+_0x623cb8['errors'][_0x465aa9(0xae)]+_0x465aa9(0x119)),_0x43c6eb['push'](formatValidationResult(_0x623cb8,_0x212d40,_0x25ab7c));}return _0x43c6eb[_0x465aa9(0xbc)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x11275c){const _0x1ca8d8=a152_0x33e6a2,_0xa0efab=new Set(),_0x390810=new Map(),_0x5dc4c6=collectSegmentUsageCounts(_0x11275c);if(_0x11275c[_0x1ca8d8(0xdb)])for(const [_0x35dbaa,_0x26f282]of Object[_0x1ca8d8(0x15f)](_0x11275c[_0x1ca8d8(0xdb)])){_0xa0efab[_0x1ca8d8(0xbb)](_0x35dbaa);if(_0x26f282[_0x1ca8d8(0x140)]){const _0x2ae9a8=yamlRuleToApi(_0x26f282[_0x1ca8d8(0x140)]),_0x1f5a79=apiRuleToYaml(_0x2ae9a8);_0x390810['set'](_0x35dbaa,_0x1f5a79);}}const _0x589d3b=new Map();let _0x567047=0x0;for(const [_0xa66869,_0x20d3c3]of _0x390810){const _0x329419=serializeExpandedRule(_0x20d3c3,_0x390810),_0x100899=_0x589d3b[_0x1ca8d8(0xa5)](_0x329419)||[];_0x100899[_0x1ca8d8(0xaf)]({'name':_0xa66869,'index':_0x567047}),_0x589d3b[_0x1ca8d8(0x153)](_0x329419,_0x100899),_0x567047++;}const _0x435f79=new Map();for(const [_0x2d09dc,_0x44a45f]of _0x589d3b){const _0x40a39e=_0x44a45f[_0x1ca8d8(0x12c)]()[_0x1ca8d8(0xb8)]((_0x41c8ba,_0x19394e)=>{const _0x5b8c5f=_0x1ca8d8,_0x4609c9=_0x5dc4c6['get'](_0x41c8ba[_0x5b8c5f(0x121)])||0x0,_0x2dc9c0=_0x5dc4c6[_0x5b8c5f(0xa5)](_0x19394e[_0x5b8c5f(0x121)])||0x0;if(_0x4609c9!==_0x2dc9c0)return _0x2dc9c0-_0x4609c9;return _0x41c8ba[_0x5b8c5f(0x183)]-_0x19394e['index'];})['map'](_0x46794a=>_0x46794a[_0x1ca8d8(0x121)]),_0x53fedc=[];for(const _0x30712a of _0x40a39e){const _0x1c8faa=_0x5dc4c6[_0x1ca8d8(0xa5)](_0x30712a)||0x0,_0xd92337=Math[_0x1ca8d8(0x11a)](_0x1c8faa,0x1);for(let _0x49f01a=0x0;_0x49f01a<_0xd92337;_0x49f01a++){_0x53fedc[_0x1ca8d8(0xaf)](_0x30712a);}}_0x435f79['set'](_0x2d09dc,_0x53fedc);}return{'existingLocalSegmentNames':_0xa0efab,'localSegmentRules':_0x390810,'localExpandedRuleToNames':_0x435f79};}export function createSegmentIdResolver(_0x4fd46e,_0x3b0223){return async _0x17463e=>{const _0x3d10c7=a152_0x591f,_0x3329e1=_0x4fd46e['get'](_0x17463e);if(!_0x3329e1)throw new SDKError(ErrorCode[_0x3d10c7(0xc4)],_0x3d10c7(0xf9)+_0x17463e+_0x3d10c7(0xbe)+_0x3b0223+'\x27)');return _0x3329e1;};}export function extractRootFolderId(_0x35ab43){const _0x2124e1=a152_0x33e6a2;return _0x35ab43[_0x2124e1(0xd6)]?.['parentSegmentFolder']?.[_0x2124e1(0xc1)]?.['id']||_0x35ab43[_0x2124e1(0xd6)]?.[_0x2124e1(0x175)]?.[_0x2124e1(0xc1)]?.['id'];}export function buildConnectionMaps(_0x383a8c){const _0x1eb918=a152_0x33e6a2,_0x46c07f=new Map(),_0x25c9f2=new Map(),_0x29b85e=new Map();for(const _0x41d33c of _0x383a8c){_0x46c07f[_0x1eb918(0x153)](_0x41d33c[_0x1eb918(0x121)],parseInt(_0x41d33c['id'],0xa)),_0x25c9f2['set'](_0x41d33c['id'],_0x41d33c['name']),_0x29b85e[_0x1eb918(0x153)](_0x41d33c['name'],_0x41d33c[_0x1eb918(0x118)]);}return{'nameToId':_0x46c07f,'idToName':_0x25c9f2,'nameToType':_0x29b85e};}export function calculatePushStats(_0x16ccde,_0x4c5eec,_0x9fc129,_0x44ad8d,_0x1cc621,_0x951c8b,_0x53a039){const _0x5cc5de=a152_0x33e6a2,_0x56cbe2=_0x16ccde['filter'](_0x48fb40=>_0x48fb40[_0x5cc5de(0x9e)]),_0x30c027=_0x16ccde[_0x5cc5de(0x12f)](_0x52ef0b=>!_0x52ef0b[_0x5cc5de(0x9e)]&&_0x52ef0b[_0x5cc5de(0xa6)]),_0x39cc60=_0x16ccde[_0x5cc5de(0x12f)](_0x31502c=>!_0x31502c[_0x5cc5de(0x9e)]&&!_0x31502c[_0x5cc5de(0xa6)]),_0x4efd62=_0x951c8b?_0x44ad8d:[],_0x566e68=_0x4c5eec['filter'](_0x427fcd=>_0x427fcd[_0x5cc5de(0x9e)]),_0x44e9d9=_0x4c5eec[_0x5cc5de(0x12f)](_0x495de3=>!_0x495de3[_0x5cc5de(0x9e)]&&_0x495de3[_0x5cc5de(0xa6)]),_0x292159=_0x4c5eec[_0x5cc5de(0x12f)](_0x1c6f6e=>!_0x1c6f6e[_0x5cc5de(0x9e)]&&!_0x1c6f6e[_0x5cc5de(0xa6)]),_0x1dc476=_0x951c8b?_0x1cc621:[],_0x5df468=_0x16ccde[_0x5cc5de(0xdc)](_0x453092=>_0x453092[_0x5cc5de(0xd3)]),_0x4fccdb=_0x5df468[_0x5cc5de(0x12f)](_0x59d905=>_0x59d905[_0x5cc5de(0x118)]==='create'),_0x2f3279=_0x5df468[_0x5cc5de(0x12f)](_0x41223a=>_0x41223a[_0x5cc5de(0x118)]===_0x5cc5de(0x156)),_0x2e77e7=_0x5df468[_0x5cc5de(0x12f)](_0x3580a6=>_0x3580a6['type']===_0x5cc5de(0x182)),_0x118c20=Array[_0x5cc5de(0xd1)](_0x9fc129)['sort'](),_0x487ba4=_0x53a039?![]:_0x56cbe2[_0x5cc5de(0xae)]>0x0||_0x30c027[_0x5cc5de(0xae)]>0x0||_0x4efd62[_0x5cc5de(0xae)]>0x0,_0x18df8e=_0x566e68[_0x5cc5de(0xae)]>0x0||_0x44e9d9['length']>0x0||_0x1dc476[_0x5cc5de(0xae)]>0x0,_0x849921=_0x53a039?![]:_0x5df468[_0x5cc5de(0xae)]>0x0,_0x2d8bbb=_0x118c20[_0x5cc5de(0xae)]>0x0;return{'segments':{'new':_0x56cbe2,'changed':_0x30c027,'unchanged':_0x39cc60,'toDelete':_0x4efd62},'journeys':{'new':_0x566e68,'changed':_0x44e9d9,'unchanged':_0x292159,'toDelete':_0x1dc476},'activations':{'all':_0x5df468,'toCreate':_0x4fccdb,'toUpdate':_0x2f3279,'toDelete':_0x2e77e7},'folders':{'toCreate':_0x118c20},'counts':{'segments':{'new':_0x56cbe2[_0x5cc5de(0xae)],'changed':_0x30c027[_0x5cc5de(0xae)],'unchanged':_0x39cc60[_0x5cc5de(0xae)],'toDelete':_0x4efd62[_0x5cc5de(0xae)]},'journeys':{'new':_0x566e68['length'],'changed':_0x44e9d9[_0x5cc5de(0xae)],'unchanged':_0x292159['length'],'toDelete':_0x1dc476[_0x5cc5de(0xae)]},'activations':{'create':_0x4fccdb['length'],'update':_0x2f3279['length'],'delete':_0x2e77e7[_0x5cc5de(0xae)]},'folders':_0x118c20['length']},'hasChanges':_0x487ba4||_0x18df8e||_0x849921||_0x2d8bbb};}export async function buildPushExecutionContext(_0xdd37ae,_0x5aaefd,_0x2dc5a0,_0x47231f,_0x132412,_0x3d6511){const _0x393564=a152_0x33e6a2,_0x57834c=extractRootFolderId(_0x2dc5a0),{pathToId:_0x5259b4,idToPath:_0x2374ee}=buildFolderMaps(_0x132412),_0x3e5c64=buildSegmentNameToIdMap(_0x47231f),_0x4d5e84=new Map(),{batchAsync:_0x2316c1}=await import('../../utils/async.js'),[_0x4031ed,_0x4a2229]=await Promise[_0x393564(0x17d)]([_0xdd37ae['user'][_0x393564(0x17e)](),_0xdd37ae[_0x393564(0x171)]['list'](),((async()=>{const _0x57cc4c=_0x393564;!_0x3d6511&&_0x47231f[_0x57cc4c(0xae)]>0x0&&await _0x2316c1(_0x47231f,async _0x572a06=>{const _0x13ded1=_0x57cc4c,_0x26677c=await _0xdd37ae['segment'][_0x13ded1(0xce)](_0x5aaefd,_0x572a06['id']);_0x4d5e84[_0x13ded1(0x153)](_0x572a06['id'],_0x26677c);});})())]),{emailToId:_0x5bdc82,idToEmail:_0xac7604}=_0x4031ed,_0x49e0b8=buildConnectionMaps(_0x4a2229);return{'rootFolderId':_0x57834c,'folderPathToId':_0x5259b4,'folderIdToPath':_0x2374ee,'segmentNameToId':_0x3e5c64,'activationsBySegmentId':_0x4d5e84,'emailToIdMap':_0x5bdc82,'idToEmailMap':_0xac7604,'connectionNameToIdMap':_0x49e0b8[_0x393564(0xba)],'connectionIdToNameMap':_0x49e0b8[_0x393564(0x14e)],'connectionNameToTypeMap':_0x49e0b8[_0x393564(0x191)]};}export function createPushYamlContextForBundle(_0x1eba3d,_0xd5778,_0x5de546,_0x441d59,_0x7a1481,_0x4f07b4,_0x1b275b,_0x3bd82e){const {existingLocalSegmentNames:_0x162a0d,localExpandedRuleToNames:_0x4504cb}=_0x441d59,_0x806b05=new Set(),_0x1b4b49=new Map(),_0xb6183e=new Map(),_0x239d3a=new Map(),_0x49c073=createJumpTargetCache(),_0x5ec82b=new Map(),_0xe02e74=new Map(),_0x4aa9e4=new Set();let _0x2d5cab;const _0x498462=_0x32bbc0=>{const _0x213894={'resolveSegment':async _0x15c9cb=>{const _0x280164=a152_0x591f,_0x1ba673=_0x239d3a[_0x280164(0xa5)](_0x15c9cb);if(_0x1ba673!==undefined)return{'name':_0x1ba673,'isJourneyLocal':!![]};try{const _0x10334a=await fetchSegment(_0x1eba3d,_0xd5778,_0x15c9cb,_0x5de546);if(!_0x10334a)throw new Error(_0x280164(0x178));const _0x48f49e=generateJourneyLocalName(_0x10334a[_0x280164(0x121)]),_0x2f4fbc=_0x10334a[_0x280164(0xed)]===SEGMENT_KIND_JOURNEY&&_0x48f49e!==undefined;let _0x18146c=_0x10334a[_0x280164(0x121)],_0x47f63e;if(_0x2f4fbc&&_0x10334a[_0x280164(0x140)]){const _0x5402d4=apiRuleToYaml(_0x10334a[_0x280164(0x140)]);_0xe02e74['set'](_0x15c9cb,_0x5402d4);const _0x334dcb=async _0x4a1112=>{const _0x2f49b3=_0x280164,_0x57cf48=collectSegmentRefsFromRule(_0x4a1112);for(const _0x14c109 of _0x57cf48){if(!_0xe02e74[_0x2f49b3(0x198)](_0x14c109))try{const _0x2d6227=await fetchSegment(_0x1eba3d,_0xd5778,_0x14c109,_0x5de546);if(_0x2d6227?.['rule']){const _0x5a9741=apiRuleToYaml(_0x2d6227['rule']);_0xe02e74['set'](_0x14c109,_0x5a9741),await _0x334dcb(_0x5a9741);}}catch(_0x24af56){logger['debug']('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0x14c109+':\x20'+_0x24af56);}}};await _0x334dcb(_0x5402d4);const _0x18acd8=serializeExpandedRule(_0x5402d4,_0xe02e74),_0xaaa6dc=_0x4504cb[_0x280164(0xa5)](_0x18acd8);if(_0xaaa6dc&&_0xaaa6dc[_0x280164(0xae)]>0x0){const _0x2c2adc=_0x1b4b49['get'](_0x18acd8)||0x0,_0xa81225=_0xaaa6dc[_0x2c2adc]||_0xaaa6dc[_0xaaa6dc[_0x280164(0xae)]-0x1];_0x1b4b49['set'](_0x18acd8,_0x2c2adc+0x1),_0x18146c=_0xa81225,_0x806b05[_0x280164(0xbb)](_0x18146c),_0x239d3a['set'](_0x15c9cb,_0x18146c);const _0x2678ae=await resolveRuleSegmentRefs(_0x5402d4,async _0x15aaf1=>{const _0x428af4=_0x280164,_0x549db9=_0x239d3a[_0x428af4(0xa5)](_0x15aaf1);if(_0x549db9)return _0x549db9;const _0x38c493=await _0x2d5cab[_0x428af4(0xcb)](_0x15aaf1);return _0x38c493[_0x428af4(0x121)];});_0x47f63e={'description':_0x10334a['description'],'rule':_0x2678ae};}else{const _0x4a873f=_0x5ec82b[_0x280164(0xa5)](_0x18acd8);if(_0x4a873f)_0x18146c=_0x4a873f,_0x239d3a[_0x280164(0x153)](_0x15c9cb,_0x18146c);else{if(_0x48f49e){let _0x612669=_0x48f49e,_0x1ad5d4=0x2;while(_0x806b05['has'](_0x612669)||_0x162a0d[_0x280164(0x198)](_0x612669)){_0x612669=_0x48f49e+'_'+_0x1ad5d4,_0x1ad5d4++;}_0x806b05[_0x280164(0xbb)](_0x612669),_0x18146c=_0x612669;}_0x239d3a[_0x280164(0x153)](_0x15c9cb,_0x18146c),_0x5ec82b[_0x280164(0x153)](_0x18acd8,_0x18146c);const _0x483960=await resolveRuleSegmentRefs(_0x5402d4,async _0x4ac869=>{const _0xd93948=_0x280164,_0x5a6805=_0x239d3a[_0xd93948(0xa5)](_0x4ac869);if(_0x5a6805)return _0x5a6805;const _0x365b1d=await _0x2d5cab[_0xd93948(0xcb)](_0x4ac869);return _0x365b1d[_0xd93948(0x121)];});_0x47f63e={'description':_0x10334a['description'],'rule':_0x483960};}}}return{'name':_0x18146c,'isJourneyLocal':_0x2f4fbc,'definition':_0x47f63e};}catch(_0x4af34e){return logger[_0x280164(0xf6)](_0x280164(0x194)+_0x15c9cb+':\x20'+_0x4af34e),{'name':_0x15c9cb,'isJourneyLocal':![]};}},'resolveActivation':async _0x329a69=>{const _0x181e9e=a152_0x591f,_0x3f2880=_0xb6183e[_0x181e9e(0xa5)](_0x329a69);if(_0x3f2880!==undefined)return{'name':_0x3f2880,'isJourneyLocal':!![]};try{let _0xb3061f=_0x1b275b?.[_0x181e9e(0xa5)](_0x329a69);!_0xb3061f&&(_0xb3061f=await _0x1eba3d[_0x181e9e(0x9f)][_0x181e9e(0x163)](_0x32bbc0,_0x329a69));const _0x38867f=_0xb3061f[_0x181e9e(0xb0)][_0x181e9e(0x176)]['name']||_0x329a69,_0x162937=sanitizeYamlKey(_0x38867f)||_0x181e9e(0x107)+_0x329a69,_0x34a848=_0x162937;_0xb6183e[_0x181e9e(0x153)](_0x329a69,_0x34a848);const _0x24e965=journeyActivationStepToYaml(_0xb3061f,_0x7a1481,_0x4f07b4);return{'name':_0x34a848,'isJourneyLocal':!![],'definition':_0x24e965};}catch(_0x4ee82d){return logger[_0x181e9e(0xf6)](_0x181e9e(0x185)+_0x329a69+':\x20'+_0x4ee82d),{'name':_0x329a69,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x307f0f,_0x29b892)=>resolveJumpTarget(_0x307f0f,_0x29b892,_0x49c073,async _0x2aed46=>{const _0x336885=a152_0x591f,_0x568bda=_0x3bd82e?.[_0x336885(0xa5)](_0x2aed46);if(_0x568bda)return _0x568bda;return _0x1eba3d[_0x336885(0x9f)]['getJourney'](_0x2aed46);})};return _0x2d5cab=_0x213894,_0x213894;},_0xb572d8=async _0x387ee3=>{const _0x2fd00d=a152_0x591f,{collectSegmentIdsFromJourneyApi:_0x41119b}=await import(_0x2fd00d(0x159)),{batchAsync:_0x1d2e04}=await import(_0x2fd00d(0x18c)),_0x380f1e=new Set();for(const _0x36ae11 of _0x387ee3){let _0x1bb1fb=_0x3bd82e?.[_0x2fd00d(0xa5)](_0x36ae11);!_0x1bb1fb&&(_0x1bb1fb=await _0x1eba3d[_0x2fd00d(0x9f)]['getJourney'](_0x36ae11));const _0x401800=_0x41119b(_0x1bb1fb);for(const _0x5b7283 of _0x401800){_0x380f1e['add'](_0x5b7283);}}let _0xee95e9=Array[_0x2fd00d(0xd1)](_0x380f1e);while(_0xee95e9[_0x2fd00d(0xae)]>0x0){const _0x4e3ae3=_0xee95e9[_0x2fd00d(0x12f)](_0x25f681=>!_0x4aa9e4['has'](_0x25f681));if(_0x4e3ae3[_0x2fd00d(0xae)]===0x0)break;const _0x728295=await _0x1d2e04(_0x4e3ae3,async _0x209be7=>{const _0x5e7d23=_0x2fd00d;_0x4aa9e4[_0x5e7d23(0xbb)](_0x209be7);const _0x23d810=await fetchSegment(_0x1eba3d,_0xd5778,_0x209be7,_0x5de546);if(!_0x23d810)return null;return{'segmentId':_0x209be7,'segment':_0x23d810};},0xa),_0xf34fdc=new Set();for(const _0x44b060 of _0x728295){if(!_0x44b060?.[_0x2fd00d(0x197)]?.[_0x2fd00d(0x140)])continue;const _0xaa3a11=apiRuleToYaml(_0x44b060['segment']['rule']);_0xe02e74[_0x2fd00d(0x153)](_0x44b060['segmentId'],_0xaa3a11);const _0x4d0062=collectSegmentRefsFromRule(_0xaa3a11);for(const _0x190e3f of _0x4d0062){!_0x4aa9e4[_0x2fd00d(0x198)](_0x190e3f)&&_0xf34fdc['add'](_0x190e3f);}}_0xee95e9=Array[_0x2fd00d(0xd1)](_0xf34fdc);}};return{'createYamlContext':_0x498462,'prefetchJourneySegments':_0xb572d8};}export async function executePushSegments(_0x538128,_0x420e83,_0x2678ac,_0x37f7e4,_0x263a87){const _0x445226=a152_0x33e6a2,{segmentDefToCreateRequest:_0x389a6c,segmentDefToUpdateRequest:_0x41db06}=await import(_0x445226(0x161)),_0x252afc=_0x2678ac['folderPathToId'],_0xb8ff94=0x5,_0x143aec=async _0x51e1ed=>{const _0x1f13a1=_0x445226,_0x12e03b=_0x51e1ed[_0x1f13a1(0xe2)]?_0x252afc[_0x1f13a1(0xa5)](_0x51e1ed['folderPath']):undefined;let _0x1f215e;const _0x878891={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x29c847=_0x51e1ed[_0x1f13a1(0x106)];if(_0x51e1ed['yamlConfig'][_0x1f13a1(0x140)]){const _0x5dda2e=createSegmentIdResolver(_0x2678ac[_0x1f13a1(0xec)],_0x51e1ed[_0x1f13a1(0x106)][_0x1f13a1(0x121)]),_0x589126=await resolveRuleSegmentIds(_0x51e1ed[_0x1f13a1(0x106)][_0x1f13a1(0x140)],_0x5dda2e);_0x29c847={..._0x51e1ed[_0x1f13a1(0x106)],'rule':_0x589126};}try{if(_0x51e1ed[_0x1f13a1(0x9e)]){_0x263a87['onProgress']?.({'type':'segment_creating','name':_0x51e1ed['yamlConfig']['name']});const _0x1af404=_0x389a6c(_0x29c847,_0x12e03b),_0x5b1621=await _0x263a87['withProgress'](_0x1f13a1(0xc8)+_0x51e1ed[_0x1f13a1(0x106)][_0x1f13a1(0x121)]+'\x27...',()=>_0x538128[_0x1f13a1(0x197)][_0x1f13a1(0x16a)](_0x37f7e4[_0x1f13a1(0x10b)],_0x1af404));_0x1f215e=_0x5b1621['data']['id'],_0x2678ac[_0x1f13a1(0xec)][_0x1f13a1(0x153)](_0x51e1ed['yamlConfig'][_0x1f13a1(0x121)],_0x1f215e),_0x878891[_0x1f13a1(0xe6)]={'name':_0x51e1ed[_0x1f13a1(0x106)][_0x1f13a1(0x121)],'id':_0x1f215e},_0x263a87[_0x1f13a1(0xcf)]?.({'type':_0x1f13a1(0x114),'name':_0x51e1ed[_0x1f13a1(0x106)][_0x1f13a1(0x121)],'segmentId':_0x1f215e}),_0x263a87['logSuccess']?.(_0x1f13a1(0x169)+_0x51e1ed[_0x1f13a1(0x106)][_0x1f13a1(0x121)]+'\x27'),_0x878891[_0x1f13a1(0x11d)]=0x1;}else{if(_0x51e1ed[_0x1f13a1(0xa6)]){_0x263a87[_0x1f13a1(0xcf)]?.({'type':_0x1f13a1(0x13b),'name':_0x51e1ed[_0x1f13a1(0x106)][_0x1f13a1(0x121)]});const _0x4a7ad5=_0x41db06(_0x29c847);_0x12e03b!==_0x51e1ed['existingSegment']?.[_0x1f13a1(0xa0)]&&(_0x4a7ad5[_0x1f13a1(0xa0)]=_0x12e03b?parseInt(_0x12e03b,0xa):undefined),await _0x263a87['withProgress'](_0x1f13a1(0x143)+_0x51e1ed['yamlConfig']['name']+'\x27...',()=>_0x538128[_0x1f13a1(0x197)][_0x1f13a1(0x110)](_0x37f7e4[_0x1f13a1(0x10b)],_0x51e1ed[_0x1f13a1(0x192)]['id'],_0x4a7ad5)),_0x1f215e=_0x51e1ed['existingSegment']['id'],_0x263a87[_0x1f13a1(0xcf)]?.({'type':_0x1f13a1(0x168),'name':_0x51e1ed[_0x1f13a1(0x106)][_0x1f13a1(0x121)]}),_0x263a87[_0x1f13a1(0x13d)]?.('Updated\x20segment\x20\x27'+_0x51e1ed[_0x1f13a1(0x106)][_0x1f13a1(0x121)]+'\x27'),_0x878891[_0x1f13a1(0x120)]=0x1;}else _0x1f215e=_0x51e1ed[_0x1f13a1(0x192)]['id'];}}catch(_0x488cd2){const _0x165fc3=isHttp400Error(_0x488cd2),_0x17f23c=_0x165fc3?ErrorCode[_0x1f13a1(0xa3)]:ErrorCode[_0x1f13a1(0x115)],_0x3b6e8d=getErrorMessage(_0x488cd2);throw new SDKError(_0x17f23c,'Failed\x20to\x20'+(_0x51e1ed[_0x1f13a1(0x9e)]?_0x1f13a1(0xe1):_0x1f13a1(0x156))+_0x1f13a1(0xad)+_0x51e1ed[_0x1f13a1(0x190)]+_0x1f13a1(0xd7)+_0x3b6e8d,_0x488cd2);}try{const _0x26f167=await syncActivationsForSegment(_0x538128,_0x37f7e4[_0x1f13a1(0x10b)],_0x1f215e,_0x51e1ed[_0x1f13a1(0x106)][_0x1f13a1(0x121)],_0x51e1ed['activationActions'],_0x263a87,_0x51e1ed[_0x1f13a1(0x190)]);_0x878891[_0x1f13a1(0xf3)]=_0x26f167;}catch(_0xb98fd3){if(_0xb98fd3 instanceof SDKError)throw _0xb98fd3;throw new SDKError(ErrorCode[_0x1f13a1(0x177)],_0x1f13a1(0xf8)+_0x51e1ed['yamlConfig']['name']+_0x1f13a1(0x105)+_0x51e1ed[_0x1f13a1(0x190)]+_0x1f13a1(0xd7)+getErrorMessage(_0xb98fd3),_0xb98fd3);}return _0x878891;},_0x2bf2d3=await batchAsync(_0x420e83,_0x143aec,_0xb8ff94),_0x29d6fe={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x581dd4 of _0x2bf2d3){_0x29d6fe[_0x445226(0x11d)]+=_0x581dd4[_0x445226(0x11d)],_0x29d6fe[_0x445226(0x120)]+=_0x581dd4[_0x445226(0x120)],_0x581dd4[_0x445226(0xe6)]&&_0x29d6fe[_0x445226(0x16e)][_0x445226(0x153)](_0x581dd4[_0x445226(0xe6)]['name'],_0x581dd4[_0x445226(0xe6)]['id']),_0x29d6fe[_0x445226(0xf3)]['created']+=_0x581dd4[_0x445226(0xf3)][_0x445226(0x11d)],_0x29d6fe[_0x445226(0xf3)][_0x445226(0x120)]+=_0x581dd4[_0x445226(0xf3)][_0x445226(0x120)],_0x29d6fe[_0x445226(0xf3)][_0x445226(0x181)]+=_0x581dd4[_0x445226(0xf3)][_0x445226(0x181)];}return _0x29d6fe;}async function syncActivationsForSegment(_0x1ea013,_0x4138f4,_0x121bf8,_0x5b81e9,_0x1cc9f3,_0x55f172,_0x2fd188){const _0x525360=a152_0x33e6a2,_0x1e9b6d={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x2a16bd of _0x1cc9f3){try{if(_0x2a16bd[_0x525360(0x118)]===_0x525360(0xe1)&&_0x2a16bd[_0x525360(0x111)])_0x55f172[_0x525360(0xcf)]?.({'type':'activation_creating','segmentName':_0x5b81e9,'activationName':_0x2a16bd[_0x525360(0x121)]}),await _0x55f172[_0x525360(0xbf)](_0x525360(0x160)+_0x2a16bd[_0x525360(0x121)]+_0x525360(0x154),()=>_0x1ea013[_0x525360(0x197)][_0x525360(0x130)](_0x4138f4,_0x121bf8,_0x2a16bd[_0x525360(0x111)])),_0x55f172[_0x525360(0xcf)]?.({'type':_0x525360(0x10d),'segmentName':_0x5b81e9,'activationName':_0x2a16bd[_0x525360(0x121)]}),_0x55f172[_0x525360(0x13d)]?.(_0x525360(0x14c)+_0x2a16bd[_0x525360(0x121)]+'\x27'),_0x1e9b6d[_0x525360(0x11d)]++;else{if(_0x2a16bd[_0x525360(0x118)]===_0x525360(0x156)&&_0x2a16bd[_0x525360(0x111)]&&_0x2a16bd['existingActivation'])_0x55f172[_0x525360(0xcf)]?.({'type':_0x525360(0xa7),'segmentName':_0x5b81e9,'activationName':_0x2a16bd['name']}),await _0x55f172[_0x525360(0xbf)]('Updating\x20activation\x20\x27'+_0x2a16bd[_0x525360(0x121)]+'\x27...',()=>_0x1ea013[_0x525360(0x197)][_0x525360(0xac)](_0x4138f4,_0x121bf8,_0x2a16bd['existingActivation']['id'],_0x2a16bd[_0x525360(0x111)])),_0x55f172[_0x525360(0xcf)]?.({'type':_0x525360(0x18a),'segmentName':_0x5b81e9,'activationName':_0x2a16bd[_0x525360(0x121)]}),_0x55f172[_0x525360(0x13d)]?.('Updated\x20activation\x20\x27'+_0x2a16bd[_0x525360(0x121)]+'\x27'),_0x1e9b6d[_0x525360(0x120)]++;else _0x2a16bd[_0x525360(0x118)]===_0x525360(0x182)&&_0x2a16bd[_0x525360(0x188)]&&(_0x55f172[_0x525360(0xcf)]?.({'type':_0x525360(0x102),'segmentName':_0x5b81e9,'activationName':_0x2a16bd['name']}),await _0x55f172[_0x525360(0xbf)]('Deleting\x20activation\x20\x27'+_0x2a16bd[_0x525360(0x121)]+'\x27...',()=>_0x1ea013['segment'][_0x525360(0x199)](_0x4138f4,_0x121bf8,_0x2a16bd[_0x525360(0x188)]['id'])),_0x55f172[_0x525360(0xcf)]?.({'type':_0x525360(0x126),'segmentName':_0x5b81e9,'activationName':_0x2a16bd[_0x525360(0x121)]}),_0x55f172[_0x525360(0xea)]?.('Deleted\x20activation\x20\x27'+_0x2a16bd[_0x525360(0x121)]+'\x27'),_0x1e9b6d[_0x525360(0x181)]++);}}catch(_0x15062e){const _0x3a4ed6=isHttp400Error(_0x15062e),_0x2bcaef=_0x3a4ed6?ErrorCode[_0x525360(0x145)]:ErrorCode[_0x525360(0x177)],_0x358d6b=getErrorMessage(_0x15062e);throw new SDKError(_0x2bcaef,'Failed\x20to\x20'+_0x2a16bd[_0x525360(0x118)]+_0x525360(0x162)+_0x2a16bd[_0x525360(0x121)]+_0x525360(0x105)+_0x2fd188+_0x525360(0xd7)+_0x358d6b,_0x15062e);}}return _0x1e9b6d;}export async function executePushFolders(_0x292e7c,_0x47fcfb,_0x15afd7,_0x1b4682,_0x5c69b1){const _0xd4dd4f=a152_0x33e6a2,_0x237320=new Map(_0x15afd7),_0x24b803=sortFoldersByDepth(_0x47fcfb);for(const _0x283a9b of _0x24b803){const _0x294acc=_0x283a9b[_0xd4dd4f(0xc9)]('/'),_0x41e9ea=_0x294acc[_0x294acc[_0xd4dd4f(0xae)]-0x1],_0x4a3b40=_0x294acc[_0xd4dd4f(0x12c)](0x0,-0x1)[_0xd4dd4f(0xbc)]('/'),_0x23d4eb=_0x237320[_0xd4dd4f(0xa5)](_0x4a3b40);_0x5c69b1['onProgress']?.({'type':'folder_creating','folder':_0x283a9b});const _0x287a81={'name':_0x41e9ea,'parentFolderId':_0x23d4eb},_0x2043ba=await _0x5c69b1[_0xd4dd4f(0xbf)](_0xd4dd4f(0x144)+_0x283a9b+_0xd4dd4f(0x154),()=>_0x292e7c['segment']['createFolder'](_0x1b4682[_0xd4dd4f(0x10b)],_0x287a81));_0x237320[_0xd4dd4f(0x153)](_0x283a9b,_0x2043ba[_0xd4dd4f(0xc1)]['id']),_0x5c69b1['onProgress']?.({'type':'folder_created','folder':_0x283a9b,'folderId':_0x2043ba[_0xd4dd4f(0xc1)]['id']}),_0x5c69b1[_0xd4dd4f(0x17a)]?.(_0xd4dd4f(0xcd)+_0x283a9b+'\x27');}return _0x237320;}export async function executePushSegmentDeletions(_0x52b6e0,_0x39038d,_0x4e3295){const _0x591765=a152_0x33e6a2;if(_0x39038d[_0x591765(0xae)]===0x0)return 0x0;const {batchAsync:_0x1084dd}=await import(_0x591765(0x18c)),_0x18802e=0x5,_0x5ae023=await _0x1084dd(_0x39038d,async _0x4a3a9c=>{const _0x497ba9=_0x591765;return _0x4e3295['onProgress']?.({'type':_0x497ba9(0x141),'name':_0x4a3a9c[_0x497ba9(0x121)]}),await _0x52b6e0[_0x497ba9(0x197)][_0x497ba9(0xe0)](_0x4a3a9c['id']),_0x4e3295[_0x497ba9(0xcf)]?.({'type':_0x497ba9(0xbd),'name':_0x4a3a9c[_0x497ba9(0x121)]}),_0x4e3295[_0x497ba9(0xea)]?.('Deleted\x20segment\x20\x27'+_0x4a3a9c['name']+'\x27'),0x1;},_0x18802e);return _0x5ae023[_0x591765(0xe3)]((_0x38cbd6,_0x265816)=>_0x38cbd6+_0x265816,0x0);}export async function executePushJourneys(_0x357343,_0x24393d,_0x2319c0,_0x2f62b5,_0x1f4547){const _0x181a9f=a152_0x33e6a2,{journeyDefToRequest:_0x446b09}=await import(_0x181a9f(0x159)),{activationDefToCreateRequest:_0x273f29,yamlRuleToApi:_0x5709a3,validateSegmentRule:_0x3a3229}=await import(_0x181a9f(0x161)),_0x1e34be={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x40012d=new Map(_0x2319c0[_0x181a9f(0xec)]),_0x33de8d=0x5;for(let _0x58d45c=0x0;_0x58d45c<_0x24393d[_0x181a9f(0xae)];_0x58d45c+=_0x33de8d){const _0x23bb24=_0x24393d['slice'](_0x58d45c,_0x58d45c+_0x33de8d),_0xbf76aa=await Promise[_0x181a9f(0x17d)](_0x23bb24['map'](async _0x19c607=>{const _0x101c1=_0x181a9f;if(!_0x19c607[_0x101c1(0x9e)]&&!_0x19c607[_0x101c1(0xa6)])return{'action':_0x101c1(0x9c),'name':_0x19c607[_0x101c1(0x106)][_0x101c1(0x121)],'journeyId':_0x19c607['existingJourney']?.['id']};const _0x3cbca4=_0x19c607[_0x101c1(0xe2)]?_0x2319c0[_0x101c1(0xff)]['get'](_0x19c607[_0x101c1(0xe2)]):undefined;_0x1f4547['onProgress']?.({'type':_0x19c607[_0x101c1(0x9e)]?_0x101c1(0x10f):_0x101c1(0x133),'name':_0x19c607['yamlConfig'][_0x101c1(0x121)]});try{const _0x4dd991=await executeSingleJourneyPush(_0x357343,_0x19c607,{..._0x2319c0,'segmentNameToId':_0x40012d},{'parentId':_0x2f62b5[_0x101c1(0x10b)],'rootFolderId':_0x2f62b5['rootFolderId'],'folderId':_0x3cbca4,'verbose':_0x2f62b5[_0x101c1(0x147)]},_0x1f4547,{'journeyDefToRequest':_0x446b09,'activationDefToCreateRequest':_0x273f29,'yamlRuleToApi':_0x5709a3,'validateSegmentRule':_0x3a3229});for(const [_0x4fb436,_0x589fbb]of _0x4dd991[_0x101c1(0xde)]){_0x40012d[_0x101c1(0x153)](_0x4fb436,_0x589fbb),_0x1e34be[_0x101c1(0xde)][_0x101c1(0x153)](_0x4fb436,_0x589fbb);}if(_0x4dd991[_0x101c1(0x15b)]===_0x101c1(0x11d))_0x1f4547['onProgress']?.({'type':_0x101c1(0xa2),'name':_0x19c607[_0x101c1(0x106)][_0x101c1(0x121)],'journeyId':_0x4dd991[_0x101c1(0x138)]}),_0x1f4547[_0x101c1(0x13d)]?.('Created\x20journey\x20\x27'+_0x19c607['yamlConfig']['name']+'\x27'),_0x1e34be[_0x101c1(0x11d)]++;else _0x4dd991[_0x101c1(0x15b)]===_0x101c1(0x120)&&(_0x1f4547[_0x101c1(0xcf)]?.({'type':_0x101c1(0xb3),'name':_0x19c607['yamlConfig'][_0x101c1(0x121)]}),_0x1f4547[_0x101c1(0x13d)]?.(_0x101c1(0x15c)+_0x19c607[_0x101c1(0x106)][_0x101c1(0x121)]+'\x27'),_0x1e34be[_0x101c1(0x120)]++);return{'action':_0x4dd991[_0x101c1(0x15b)],'name':_0x19c607[_0x101c1(0x106)]['name'],'journeyId':_0x4dd991[_0x101c1(0x138)]};}catch(_0x4b80f1){const _0x237c12=isHttp400Error(_0x4b80f1),_0x84cf19=_0x237c12?ErrorCode[_0x101c1(0x11f)]:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x5acc06=getErrorMessage(_0x4b80f1);throw new SDKError(_0x84cf19,_0x101c1(0x123)+(_0x19c607[_0x101c1(0x9e)]?'create':_0x101c1(0x156))+_0x101c1(0xd0)+_0x19c607[_0x101c1(0x190)]+'\x0a\x20\x20'+_0x5acc06,_0x4b80f1);}}));_0x1e34be[_0x181a9f(0x16b)]['push'](..._0xbf76aa);}return _0x1e34be;}async function matchExistingJourneySegments(_0x3f9b84,_0x21051e,_0x28af5f,_0x60b601,_0x2b9919){const _0x5b2cd6=a152_0x33e6a2;if(!_0x21051e[_0x5b2cd6(0x125)]||!_0x21051e[_0x5b2cd6(0x106)][_0x5b2cd6(0xdb)])return;const _0xb13f8c=new Map(),_0x164c85=new Set();for(const _0x3bdc8d of Object[_0x5b2cd6(0x136)](_0x21051e[_0x5b2cd6(0x106)]['segments'])){const _0x79b3c6=generateDeterministicJourneySegmentName(_0x21051e[_0x5b2cd6(0x106)]['name'],_0x3bdc8d);_0xb13f8c[_0x5b2cd6(0x153)](_0x79b3c6,_0x3bdc8d),_0x164c85[_0x5b2cd6(0xbb)](_0x3bdc8d);}const _0x5221da=[],_0x59101b=collectSegmentIdsFromJourneyApi(_0x21051e[_0x5b2cd6(0x125)]);for(const _0x2d6564 of _0x59101b){const _0x265258=await fetchSegment(_0x3f9b84,_0x28af5f,_0x2d6564,_0x60b601);if(!_0x265258?.[_0x5b2cd6(0x121)])continue;const _0x467707=_0xb13f8c[_0x5b2cd6(0xa5)](_0x265258[_0x5b2cd6(0x121)]);_0x467707?(_0x2b9919[_0x5b2cd6(0x153)](_0x467707,_0x2d6564),_0x164c85['delete'](_0x467707)):_0x5221da[_0x5b2cd6(0xaf)]({'id':_0x2d6564,'seg':_0x265258});}if(_0x164c85[_0x5b2cd6(0xf0)]>0x0&&_0x5221da[_0x5b2cd6(0xae)]>0x0){const {localExpandedRuleToNames:_0x2e4f60}=buildLocalExpandedRuleMappings(_0x21051e[_0x5b2cd6(0x106)]),_0x55f100=new Map();for(const {id:_0x1df259,seg:_0x21e616}of _0x5221da){if(_0x21e616[_0x5b2cd6(0x140)]){const _0x390bee=apiRuleToYaml(_0x21e616[_0x5b2cd6(0x140)]);_0x55f100[_0x5b2cd6(0x153)](_0x1df259,_0x390bee);}}for(const {id:_0x137fa0,seg:_0x1fbd57}of _0x5221da){if(!_0x1fbd57[_0x5b2cd6(0x140)])continue;const _0x564e98=_0x55f100['get'](_0x137fa0);if(!_0x564e98)continue;const _0x5f0117=serializeExpandedRule(_0x564e98,_0x55f100),_0x3e2699=_0x2e4f60['get'](_0x5f0117);if(_0x3e2699){const _0x4e903b=_0x3e2699[_0x5b2cd6(0x109)](_0x57553f=>_0x164c85['has'](_0x57553f));_0x4e903b&&(_0x2b9919[_0x5b2cd6(0x153)](_0x4e903b,_0x137fa0),_0x164c85['delete'](_0x4e903b),logger[_0x5b2cd6(0xf6)](_0x5b2cd6(0x122)+_0x1fbd57[_0x5b2cd6(0x121)]+'\x27\x20to\x20local\x20\x27'+_0x4e903b+_0x5b2cd6(0x10a)));}}}}async function executeSingleJourneyPush(_0x462dad,_0x4fe26f,_0x3cb75e,_0x36e76b,_0x2755eb,_0x57d1a6){const _0x47f847=a152_0x33e6a2,{journeyDefToRequest:_0x29dc0b,activationDefToCreateRequest:_0x7b5474,yamlRuleToApi:_0x9d1fb,validateSegmentRule:_0x2dd4ec}=_0x57d1a6,_0x1cf98a=new Map(),_0x1e81fa=new Map();recoverSegmentIdsFromPushRecovery(_0x4fe26f,_0x1cf98a,_0x3cb75e[_0x47f847(0xec)]);const _0x228704=new Map(),_0x2a916b=new Map(),_0x4f0a27=new Map();let _0xa55795;const _0x487a80=async()=>{const _0x9adfa2=_0x47f847;if(_0xa55795)return;_0xa55795=new Map();if(!_0x4fe26f[_0x9adfa2(0x125)])return;const _0x2be5a5=await _0x462dad[_0x9adfa2(0x9f)]['listActivations'](_0x4fe26f[_0x9adfa2(0x125)]['id']);for(const _0x345907 of _0x2be5a5){const _0x100da=journeyActivationStepToYaml(_0x345907,_0x3cb75e['idToEmailMap'],_0x3cb75e[_0x9adfa2(0xd9)]),_0x577da5=activationSignature(_0x100da);!_0xa55795['has'](_0x577da5)&&_0xa55795[_0x9adfa2(0x153)](_0x577da5,_0x345907['id']),_0x100da['name']&&_0x1e81fa[_0x9adfa2(0x153)](_0x100da[_0x9adfa2(0x121)],_0x345907['id']);}};await matchExistingJourneySegments(_0x462dad,_0x4fe26f,_0x36e76b[_0x47f847(0x10b)],_0x3cb75e[_0x47f847(0x187)],_0x3cb75e['segmentNameToId']);const _0xa368c2={'resolveSegmentId':async _0x45ba7e=>{const _0x2bd3e1=_0x47f847,_0x32858d=_0x3cb75e[_0x2bd3e1(0xec)][_0x2bd3e1(0xa5)](_0x45ba7e);if(!_0x32858d)throw new SDKError(ErrorCode[_0x2bd3e1(0xc4)],_0x2bd3e1(0xf9)+_0x45ba7e+'\x20(referenced\x20in\x20journey\x20'+_0x4fe26f[_0x2bd3e1(0x106)][_0x2bd3e1(0x121)]+')');return _0x32858d;},'resolveEmbeddedSegmentId':async(_0x2f1187,_0x760a77)=>{const _0x21d137=_0x47f847,_0x4544d0=_0x3cb75e[_0x21d137(0xec)]['get'](_0x2f1187);if(_0x4544d0)return _0x4544d0;const _0x2ef4df=_0x3cb75e[_0x21d137(0x187)][_0x21d137(0x109)](_0x489cf2=>_0x489cf2[_0x21d137(0x121)]===_0x2f1187);if(_0x2ef4df)return _0x3cb75e[_0x21d137(0xec)]['set'](_0x2f1187,_0x2ef4df['id']),_0x2ef4df['id'];if(_0x4fe26f[_0x21d137(0x9e)]){const {stageName:_0x55edc0,criteriaName:_0x34def6}=findSegmentCriteriaLocation(_0x4fe26f['yamlConfig'],_0x2f1187);return _0x2dd4ec(_0x2f1187,_0x760a77[_0x21d137(0x140)]),_0x2a916b[_0x21d137(0x153)](_0x2f1187,{'definition':_0x760a77,'stageName':_0x55edc0,'criteriaName':_0x34def6}),createPendingSegmentId(_0x2f1187);}const _0x3e3d6d=_0x4fe26f['existingJourney']?.['id'];if(!_0x3e3d6d)throw new SDKError(ErrorCode[_0x21d137(0x189)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x4b6430=_0x228704[_0x21d137(0xa5)](_0x2f1187);if(_0x4b6430)return _0x4b6430;const _0x3acd68=((async()=>{const _0x5bde8b=_0x21d137;_0x2dd4ec(_0x2f1187,_0x760a77[_0x5bde8b(0x140)]);const _0x24af52=generateDeterministicJourneySegmentName(_0x4fe26f[_0x5bde8b(0x106)][_0x5bde8b(0x121)],_0x2f1187),_0x88a03a=_0x3cb75e[_0x5bde8b(0x187)][_0x5bde8b(0x109)](_0x388d35=>_0x388d35['name']===_0x24af52),_0x177ca1=createSegmentIdResolver(_0x3cb75e[_0x5bde8b(0xec)],_0x2f1187),_0x36a548=await resolveRuleSegmentIds(_0x760a77[_0x5bde8b(0x140)],_0x177ca1);let _0x20ee00;return _0x88a03a?(await _0x462dad[_0x5bde8b(0x197)][_0x5bde8b(0x110)](_0x36e76b[_0x5bde8b(0x10b)],_0x88a03a['id'],{'description':_0x760a77[_0x5bde8b(0xdf)]||_0x5bde8b(0x14b)+_0x2f1187,'rule':_0x9d1fb(_0x36a548),'countPopulation':!![]}),_0x20ee00=_0x88a03a['id'],saveSegmentToPushRecovery(_0x4fe26f[_0x5bde8b(0x190)],_0x4fe26f[_0x5bde8b(0x106)][_0x5bde8b(0x121)],_0x2f1187,{'segmentId':_0x20ee00,'uniqueServerName':_0x24af52,'createdAt':new Date()['toISOString']()})):_0x20ee00=await createOrRecoverEmbeddedSegment(_0x462dad,_0x4fe26f,{'localName':_0x2f1187,'uniqueSegmentName':_0x24af52,'description':_0x760a77['description']||_0x5bde8b(0x14b)+_0x2f1187,'journeyId':_0x3e3d6d,'resolvedRule':_0x36a548,'parentId':_0x36e76b[_0x5bde8b(0x10b)],'folderId':_0x36e76b[_0x5bde8b(0x101)]||''},_0x9d1fb),_0x3cb75e[_0x5bde8b(0xec)][_0x5bde8b(0x153)](_0x2f1187,_0x20ee00),_0x1cf98a['set'](_0x2f1187,_0x20ee00),_0x20ee00;})());_0x228704[_0x21d137(0x153)](_0x2f1187,_0x3acd68);try{return await _0x3acd68;}finally{_0x228704['delete'](_0x2f1187);}},'resolveActivationId':async _0x17e2dd=>{const _0x85c3f0=_0x47f847,_0x546c12=_0x1e81fa['get'](_0x17e2dd);if(_0x546c12)return _0x546c12;if(_0x4fe26f[_0x85c3f0(0x125)]){await _0x487a80();const _0x23e765=_0x1e81fa[_0x85c3f0(0xa5)](_0x17e2dd);if(_0x23e765)return _0x23e765;}throw new SDKError(ErrorCode[_0x85c3f0(0xb5)],_0x85c3f0(0xb9)+_0x17e2dd+_0x85c3f0(0x193)+_0x4fe26f[_0x85c3f0(0x106)][_0x85c3f0(0x121)]+').\x20'+'Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.');},'resolveEmbeddedActivationId':async(_0x1f9156,_0x30e0ce)=>{const _0x7301c=_0x47f847,_0x54cee6=_0x1e81fa[_0x7301c(0xa5)](_0x1f9156);if(_0x54cee6)return _0x54cee6;if(_0x4fe26f[_0x7301c(0x9e)])return _0x4f0a27[_0x7301c(0x153)](_0x1f9156,_0x30e0ce),createPendingActivationId(_0x1f9156);if(_0x4fe26f[_0x7301c(0x125)]){await _0x487a80();const _0x151ca0=_0x1e81fa[_0x7301c(0xa5)](_0x30e0ce[_0x7301c(0x121)]);if(_0x151ca0)return _0x1e81fa[_0x7301c(0x153)](_0x1f9156,_0x151ca0),_0x151ca0;const _0x128053=activationSignature(_0x30e0ce),_0x8175b5=_0xa55795?.[_0x7301c(0xa5)](_0x128053);if(_0x8175b5)return _0x1e81fa[_0x7301c(0x153)](_0x1f9156,_0x8175b5),_0x8175b5;const _0x3f5289=await _0x7b5474(_0x30e0ce,_0x3cb75e['activationContext']),_0x57a20c={..._0x3f5289,..._0x30e0ce['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x30e0ce[_0x7301c(0x13e)]}},_0x22f08f=await _0x462dad['journey'][_0x7301c(0x130)](_0x4fe26f['existingJourney']['id'],_0x57a20c);return _0x1e81fa['set'](_0x1f9156,_0x22f08f['id']),_0x22f08f['id'];}throw new SDKError(ErrorCode[_0x7301c(0x189)],_0x7301c(0x9d));},'resolveJourneyId':async _0x222c53=>{const _0x5da819=_0x47f847;try{return await _0x462dad[_0x5da819(0x9f)][_0x5da819(0x165)](_0x36e76b['parentId'],_0x222c53);}catch(_0x526571){throw new SDKError(ErrorCode[_0x5da819(0xb5)],'Journey\x20\x27'+_0x222c53+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x4fe26f[_0x5da819(0x106)][_0x5da819(0x121)]+'\x27)',_0x526571);}},'resolveStageId':async(_0x81388,_0x500dda)=>{const _0x52cb6d=_0x47f847,_0x532871=await _0x462dad[_0x52cb6d(0x9f)][_0x52cb6d(0xe7)](_0x81388),_0x5d1c74=_0x532871[_0x52cb6d(0xb0)][_0x52cb6d(0x103)]['find'](_0x2c681d=>_0x2c681d[_0x52cb6d(0x121)][_0x52cb6d(0x135)]()===_0x500dda['toLowerCase']());if(!_0x5d1c74?.['id'])throw new SDKError(ErrorCode[_0x52cb6d(0xb5)],_0x52cb6d(0x180)+_0x500dda+_0x52cb6d(0x104)+(_0x532871[_0x52cb6d(0xb0)]['journeyBundleName']||_0x532871[_0x52cb6d(0xb0)][_0x52cb6d(0x121)])+'\x27');return _0x5d1c74['id'];}},_0x3dd5cb=await _0x29dc0b(_0x4fe26f['yamlConfig'],_0x36e76b['parentId'],_0xa368c2),_0x2a483f=_0x36e76b['folderId']||_0x36e76b['rootFolderId'];_0x2a483f&&(_0x3dd5cb[_0x47f847(0xd6)]={'parentFolder':{'data':{'id':_0x2a483f,'type':'folder'}}});if(_0x4fe26f[_0x47f847(0x9e)]){if(_0x2a916b[_0x47f847(0xf0)]>0x0||_0x4f0a27[_0x47f847(0xf0)]>0x0)return await executeThreeStepJourneyCreate(_0x462dad,_0x4fe26f,_0x3dd5cb,{'pendingEmbeddedSegments':_0x2a916b,'pendingEmbeddedActivations':_0x4f0a27,'embeddedSegmentNameToId':_0x1cf98a,'journeyActivationNameToId':_0x1e81fa},{..._0x36e76b,'effectiveFolderId':_0x2a483f},_0x3cb75e,_0x2755eb,_0x57d1a6);else{ensureJourneyDefaults(_0x3dd5cb[_0x47f847(0xb0)]);const _0x508020=await _0x462dad['journey'][_0x47f847(0xe1)](_0x3dd5cb);return deletePushRecovery(_0x4fe26f['absolutePath']),{'action':_0x47f847(0x11d),'journeyId':_0x508020['id'],'embeddedSegmentNameToId':_0x1cf98a};}}else{if(_0x4fe26f[_0x47f847(0xa6)]&&_0x4fe26f[_0x47f847(0x125)]){_0x3dd5cb['id']=_0x4fe26f[_0x47f847(0x125)]['id'];const _0x305079=_0x3dd5cb[_0x47f847(0xb0)];_0x4fe26f[_0x47f847(0x125)]['attributes']?.['journeyBundleName']&&(_0x305079[_0x47f847(0xd2)]=_0x4fe26f[_0x47f847(0x125)][_0x47f847(0xb0)][_0x47f847(0xd2)]);const _0x4c25ce=_0x4fe26f[_0x47f847(0x125)][_0x47f847(0xb0)]?.['journeyStages'];return _0x4c25ce&&_0x3dd5cb[_0x47f847(0xb0)][_0x47f847(0x103)]&&injectExistingStageIds(_0x3dd5cb[_0x47f847(0xb0)]['journeyStages'],_0x4c25ce),ensureJourneyDefaults(_0x305079),await _0x462dad[_0x47f847(0x9f)][_0x47f847(0x156)](_0x4fe26f['existingJourney']['id'],_0x3dd5cb),deletePushRecovery(_0x4fe26f[_0x47f847(0x190)]),{'action':_0x47f847(0x120),'journeyId':_0x4fe26f['existingJourney']['id'],'embeddedSegmentNameToId':_0x1cf98a};}}return deletePushRecovery(_0x4fe26f[_0x47f847(0x190)]),{'action':_0x47f847(0x9c),'journeyId':_0x4fe26f[_0x47f847(0x125)]?.['id'],'embeddedSegmentNameToId':_0x1cf98a};}function findSegmentCriteriaLocation(_0x1d4c68,_0x55c82f){const _0x3835f9=a152_0x33e6a2,_0x32a4ef=_0x1d4c68['stages']||_0x1d4c68[_0x3835f9(0xc0)]?.[0x0]?.[_0x3835f9(0x195)]||[];let _0x1f6a50=_0x3835f9(0x11c),_0xd97e7d=_0x55c82f;const _0x4a03b5=_0x1d4c68['goal']||_0x1d4c68[_0x3835f9(0xc0)]?.[0x0]?.[_0x3835f9(0x100)];if(_0x4a03b5?.[_0x3835f9(0x197)]===_0x55c82f)return{'stageName':_0x3835f9(0x100),'criteriaName':_0x4a03b5[_0x3835f9(0x121)]||_0x55c82f};_0x1a077f:for(const _0x5ceeaf of _0x32a4ef){if(_0x5ceeaf[_0x3835f9(0xe9)]?.[_0x3835f9(0x197)]===_0x55c82f){_0x1f6a50=_0x5ceeaf[_0x3835f9(0x121)],_0xd97e7d=_0x5ceeaf[_0x3835f9(0xe9)][_0x3835f9(0x121)]||_0x55c82f;break;}if(_0x5ceeaf[_0x3835f9(0xfc)])for(const _0x2c0e2b of _0x5ceeaf['steps']){if(_0x2c0e2b[_0x3835f9(0x118)]==='decision_point'&&_0x2c0e2b[_0x3835f9(0x148)]?.['branches'])for(const _0x43ebe8 of _0x2c0e2b['with']['branches']){if(_0x43ebe8['segment']===_0x55c82f){_0x1f6a50=_0x5ceeaf[_0x3835f9(0x121)],_0xd97e7d=_0x43ebe8[_0x3835f9(0x121)]||_0x55c82f;break _0x1a077f;}}}}return{'stageName':_0x1f6a50,'criteriaName':_0xd97e7d};}async function executeThreeStepJourneyCreate(_0x2666f1,_0x378337,_0x786708,_0x41c490,_0x4b57b9,_0x1ff56d,_0x114800,_0x433d51){const _0x28038a=a152_0x33e6a2,{activationDefToCreateRequest:_0x5b42fc,yamlRuleToApi:_0x2c96d3}=_0x433d51,{pendingEmbeddedSegments:_0x3c7d89,pendingEmbeddedActivations:_0x5b6936,embeddedSegmentNameToId:_0x490a54}=_0x41c490,_0x12b337=JSON[_0x28038a(0x17c)](JSON[_0x28038a(0x18d)](_0x786708));ensureJourneyDefaults(_0x12b337['attributes']),stripPendingIds(_0x12b337);const _0x5f162d=await _0x2666f1[_0x28038a(0x9f)][_0x28038a(0xe1)](_0x12b337),_0x4f9852=_0x5f162d['id'],_0x574476=new Map();for(const _0x5995d9 of _0x5f162d[_0x28038a(0xb0)][_0x28038a(0x103)]){_0x574476[_0x28038a(0x153)](_0x5995d9['name']['toLowerCase'](),_0x5995d9['id']);}recoverSegmentIdsFromPushRecovery(_0x378337,_0x490a54,_0x1ff56d[_0x28038a(0xec)]);for(const [_0x36bf19,{definition:_0x53ed92}]of _0x3c7d89){if(_0x490a54[_0x28038a(0x198)](_0x36bf19)){_0x114800[_0x28038a(0xcf)]?.({'type':_0x28038a(0x149),'journeyName':_0x378337['yamlConfig']['name'],'segmentName':_0x36bf19});continue;}const _0x3155b2=generateDeterministicJourneySegmentName(_0x378337['yamlConfig'][_0x28038a(0x121)],_0x36bf19);_0x114800[_0x28038a(0xcf)]?.({'type':_0x28038a(0x131),'journeyName':_0x378337['yamlConfig'][_0x28038a(0x121)],'segmentName':_0x36bf19});const _0x1e19ba=createSegmentIdResolver(_0x1ff56d['segmentNameToId'],_0x36bf19),_0x342005=await resolveRuleSegmentIds(_0x53ed92[_0x28038a(0x140)],_0x1e19ba),_0x1caf9c=await createOrRecoverEmbeddedSegment(_0x2666f1,_0x378337,{'localName':_0x36bf19,'uniqueSegmentName':_0x3155b2,'description':_0x53ed92[_0x28038a(0xdf)]||_0x28038a(0x14b)+_0x36bf19,'journeyId':_0x4f9852,'resolvedRule':_0x342005,'parentId':_0x4b57b9[_0x28038a(0x10b)],'folderId':_0x4b57b9[_0x28038a(0x179)]||''},_0x2c96d3);_0x490a54[_0x28038a(0x153)](_0x36bf19,_0x1caf9c),_0x1ff56d[_0x28038a(0xec)][_0x28038a(0x153)](_0x36bf19,_0x1caf9c),_0x114800[_0x28038a(0xcf)]?.({'type':_0x28038a(0x149),'journeyName':_0x378337['yamlConfig']['name'],'segmentName':_0x36bf19});}const _0x44ac71=new Map();for(const [_0x260540,_0x43a35c]of _0x5b6936){_0x114800[_0x28038a(0xcf)]?.({'type':_0x28038a(0x170),'journeyName':_0x378337[_0x28038a(0x106)]['name'],'activationName':_0x260540});const _0x3be364=await _0x5b42fc(_0x43a35c,_0x1ff56d[_0x28038a(0x11e)]),_0x429a46={..._0x3be364,..._0x43a35c[_0x28038a(0x13e)]!==undefined&&{'runAfterJourneyRefresh':_0x43a35c['run_after_journey_refresh']}},_0x172867=await _0x2666f1[_0x28038a(0x9f)]['createActivation'](_0x4f9852,_0x429a46);_0x44ac71[_0x28038a(0x153)](_0x260540,_0x172867['id']),_0x41c490['journeyActivationNameToId'][_0x28038a(0x153)](_0x260540,_0x172867['id']),_0x114800['onProgress']?.({'type':_0x28038a(0x164),'journeyName':_0x378337['yamlConfig'][_0x28038a(0x121)],'activationName':_0x260540});}const _0x23bbd9=JSON[_0x28038a(0x17c)](JSON[_0x28038a(0x18d)](_0x786708));return _0x23bbd9['id']=_0x4f9852,ensureJourneyDefaults(_0x23bbd9['attributes']),resolvePendingIdsInRequest(_0x23bbd9,_0x786708,_0x574476,_0x490a54,_0x44ac71,_0x114800),await _0x2666f1[_0x28038a(0x9f)][_0x28038a(0x156)](_0x4f9852,_0x23bbd9),deletePushRecovery(_0x378337[_0x28038a(0x190)]),{'action':_0x28038a(0x11d),'journeyId':_0x4f9852,'embeddedSegmentNameToId':_0x490a54};}export function stripWaitStepPendingIds(_0x25b1de){const _0x2c837e=a152_0x33e6a2,_0x82a929=_0x25b1de[_0x2c837e(0x124)]&&isPendingSegmentId(_0x25b1de[_0x2c837e(0x124)]),_0x3bac09=_0x25b1de[_0x2c837e(0x127)]?.['some'](_0x23dd75=>_0x23dd75['segmentId']&&isPendingSegmentId(_0x23dd75['segmentId']));(_0x82a929||_0x3bac09)&&(_0x25b1de[_0x2c837e(0xf7)]='Duration',_0x25b1de[_0x2c837e(0xfb)]=0x1,_0x25b1de[_0x2c837e(0x150)]=_0x2c837e(0x174),delete _0x25b1de[_0x2c837e(0x124)],delete _0x25b1de[_0x2c837e(0xb4)],delete _0x25b1de['conditionTimeoutUnit'],delete _0x25b1de[_0x2c837e(0x127)]);}export function resolveWaitStepPendingIds(_0x7edd65,_0xff8e3c,_0x41dd23,_0x4fb0e5){const _0x363ffc=a152_0x33e6a2;if(_0xff8e3c['conditionSegmentId']&&isPendingSegmentId(_0xff8e3c['conditionSegmentId'])){const _0x2af9fb=_0x41dd23(_0xff8e3c[_0x363ffc(0x124)],'stage\x20\x27'+_0x4fb0e5+'\x27\x20wait\x20condition');_0x2af9fb&&(_0x7edd65[_0x363ffc(0xf7)]=_0x363ffc(0xeb),_0x7edd65['conditionSegmentId']=_0x2af9fb,delete _0x7edd65[_0x363ffc(0xfb)],delete _0x7edd65['waitStepUnit'],_0xff8e3c[_0x363ffc(0xb4)]!==undefined&&(_0x7edd65[_0x363ffc(0xb4)]=_0xff8e3c[_0x363ffc(0xb4)]),_0xff8e3c[_0x363ffc(0xc7)]&&(_0x7edd65[_0x363ffc(0xc7)]=_0xff8e3c['conditionTimeoutUnit']));}if(_0xff8e3c[_0x363ffc(0x127)]){const _0x51e1ce=_0xff8e3c[_0x363ffc(0x127)][_0x363ffc(0xb1)](_0x5913cd=>_0x5913cd['segmentId']&&isPendingSegmentId(_0x5913cd['segmentId']));if(_0x51e1ce){const _0x4c7023=_0xff8e3c[_0x363ffc(0x127)]['map'](_0xb10799=>{const _0x513040=_0x363ffc;if(_0xb10799['segmentId']&&isPendingSegmentId(_0xb10799['segmentId'])){const _0x19ce17=_0x41dd23(_0xb10799[_0x513040(0x15e)],_0x513040(0x132)+_0x4fb0e5+_0x513040(0x18b));return{..._0xb10799,'segmentId':_0x19ce17||_0xb10799[_0x513040(0x15e)]};}return{..._0xb10799};});_0x7edd65[_0x363ffc(0xf7)]=_0x363ffc(0xeb),_0x7edd65[_0x363ffc(0x127)]=_0x4c7023,delete _0x7edd65['waitStep'],delete _0x7edd65[_0x363ffc(0x150)],delete _0x7edd65[_0x363ffc(0x124)],delete _0x7edd65[_0x363ffc(0xb4)],delete _0x7edd65[_0x363ffc(0xc7)];}}}function stripPendingIds(_0x577235){const _0x4815cd=a152_0x33e6a2;_0x577235[_0x4815cd(0xb0)]['goal']?.['segmentId']&&isPendingSegmentId(_0x577235[_0x4815cd(0xb0)][_0x4815cd(0x100)][_0x4815cd(0x15e)])&&delete _0x577235[_0x4815cd(0xb0)][_0x4815cd(0x100)];for(const _0x4c1d3d of _0x577235['attributes'][_0x4815cd(0x103)]||[]){_0x4c1d3d[_0x4815cd(0xf4)]?.[_0x4815cd(0x15e)]&&isPendingSegmentId(_0x4c1d3d[_0x4815cd(0xf4)][_0x4815cd(0x15e)])&&delete _0x4c1d3d['entryCriteria'];_0x4c1d3d['milestone']?.[_0x4815cd(0x15e)]&&isPendingSegmentId(_0x4c1d3d[_0x4815cd(0x184)][_0x4815cd(0x15e)])&&delete _0x4c1d3d[_0x4815cd(0x184)];_0x4c1d3d[_0x4815cd(0x15a)]&&(_0x4c1d3d[_0x4815cd(0x15a)]=_0x4c1d3d['exitCriterias'][_0x4815cd(0x12f)](_0x6e19d9=>!_0x6e19d9['segmentId']||!isPendingSegmentId(_0x6e19d9['segmentId'])));if(_0x4c1d3d[_0x4815cd(0xfc)])for(const _0x569601 of Object['keys'](_0x4c1d3d['steps'])){const _0x483a41=_0x4c1d3d[_0x4815cd(0xfc)][_0x569601];_0x483a41[_0x4815cd(0x118)]==='Activation'&&_0x483a41[_0x4815cd(0xc6)]&&isPendingActivationId(_0x483a41[_0x4815cd(0xc6)])&&(_0x483a41[_0x4815cd(0xc6)]='');if(_0x483a41[_0x4815cd(0x118)]===_0x4815cd(0xc3)&&_0x483a41['branches'])for(const _0x28f9d4 of _0x483a41['branches']){_0x28f9d4[_0x4815cd(0x15e)]&&isPendingSegmentId(_0x28f9d4['segmentId'])&&(_0x28f9d4[_0x4815cd(0x15e)]='');}_0x483a41[_0x4815cd(0x118)]==='WaitStep'&&stripWaitStepPendingIds(_0x483a41);}}}function resolvePendingIdsInRequest(_0x460254,_0x4a3dd7,_0xc4bb68,_0x53107d,_0xddfff3,_0xd30293){const _0x58c033=a152_0x33e6a2,_0x200d10=(_0x2ed343,_0x4bfefc)=>{const _0x3ff864=a152_0x591f;if(!isPendingSegmentId(_0x2ed343))return _0x2ed343;const _0x1f7383=extractPendingSegmentName(_0x2ed343),_0x16d1f6=_0x53107d[_0x3ff864(0xa5)](_0x1f7383);return!_0x16d1f6&&_0xd30293['logWarning']?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x1f7383+_0x3ff864(0x10e)+_0x4bfefc),_0x16d1f6;};if(_0x460254[_0x58c033(0xb0)][_0x58c033(0x100)]?.[_0x58c033(0x15e)]&&isPendingSegmentId(_0x460254[_0x58c033(0xb0)][_0x58c033(0x100)]['segmentId'])){const _0x4a682e=_0x200d10(_0x460254['attributes'][_0x58c033(0x100)]['segmentId'],_0x58c033(0x146));_0x4a682e&&(_0x460254['attributes'][_0x58c033(0x100)][_0x58c033(0x15e)]=_0x4a682e);}for(const _0x3bdf98 of _0x460254[_0x58c033(0xb0)]['journeyStages']||[]){const _0xe4abbd=_0xc4bb68[_0x58c033(0xa5)](_0x3bdf98[_0x58c033(0x121)]['toLowerCase']());_0xe4abbd&&(_0x3bdf98['id']=_0xe4abbd);if(_0x3bdf98['entryCriteria']?.[_0x58c033(0x15e)]&&isPendingSegmentId(_0x3bdf98['entryCriteria']['segmentId'])){const _0x5102d8=_0x200d10(_0x3bdf98[_0x58c033(0xf4)][_0x58c033(0x15e)],_0x58c033(0x132)+_0x3bdf98[_0x58c033(0x121)]+'\x27\x20entry\x20criteria');_0x5102d8&&(_0x3bdf98['entryCriteria']['segmentId']=_0x5102d8);}if(_0x3bdf98[_0x58c033(0x15a)])for(const _0xb649de of _0x3bdf98[_0x58c033(0x15a)]){if(_0xb649de['segmentId']&&isPendingSegmentId(_0xb649de[_0x58c033(0x15e)])){const _0x2a756b=_0x200d10(_0xb649de[_0x58c033(0x15e)],_0x58c033(0x132)+_0x3bdf98['name']+_0x58c033(0xb6));_0x2a756b&&(_0xb649de[_0x58c033(0x15e)]=_0x2a756b);}}if(_0x3bdf98['milestone']?.[_0x58c033(0x15e)]&&isPendingSegmentId(_0x3bdf98[_0x58c033(0x184)][_0x58c033(0x15e)])){const _0x20f2a2=_0x200d10(_0x3bdf98[_0x58c033(0x184)]['segmentId'],_0x58c033(0x132)+_0x3bdf98[_0x58c033(0x121)]+_0x58c033(0x18e));_0x20f2a2&&(_0x3bdf98[_0x58c033(0x184)][_0x58c033(0x15e)]=_0x20f2a2);}if(_0x3bdf98['steps']){const _0x543ab5=_0x5dc41b=>_0x4a3dd7['attributes'][_0x58c033(0x103)]?.['find'](_0x5a1c1b=>_0x5a1c1b[_0x58c033(0x121)][_0x58c033(0x135)]()===_0x3bdf98[_0x58c033(0x121)]['toLowerCase']())?.[_0x58c033(0xfc)]?.[_0x5dc41b];for(const _0x2dd287 of Object[_0x58c033(0x136)](_0x3bdf98['steps'])){const _0x2cb03a=_0x3bdf98[_0x58c033(0xfc)][_0x2dd287],_0x5c8529=_0x543ab5(_0x2dd287);if(_0x2cb03a[_0x58c033(0x118)]===_0x58c033(0xab)&&_0x2cb03a[_0x58c033(0xc6)]&&(isPendingActivationId(_0x2cb03a[_0x58c033(0xc6)])||_0x2cb03a[_0x58c033(0xc6)]==='')){if(_0x5c8529?.[_0x58c033(0xc6)]&&isPendingActivationId(_0x5c8529['journeyActivationStepId'])){const _0x43aca0=extractPendingActivationName(_0x5c8529[_0x58c033(0xc6)]),_0xbeaea9=_0xddfff3[_0x58c033(0xa5)](_0x43aca0);_0xbeaea9&&(_0x2cb03a[_0x58c033(0xc6)]=_0xbeaea9);}}if(_0x2cb03a[_0x58c033(0x118)]===_0x58c033(0xc3)&&_0x2cb03a[_0x58c033(0x128)]&&_0x5c8529?.[_0x58c033(0x128)])for(let _0x26fa1f=0x0;_0x26fa1f<_0x2cb03a[_0x58c033(0x128)]['length'];_0x26fa1f++){const _0x1232b2=_0x2cb03a[_0x58c033(0x128)][_0x26fa1f],_0x389f74=_0x5c8529['branches'][_0x26fa1f];if(_0x389f74?.[_0x58c033(0x15e)]&&isPendingSegmentId(_0x389f74[_0x58c033(0x15e)])){const _0x3ef391=_0x200d10(_0x389f74['segmentId'],'stage\x20\x27'+_0x3bdf98['name']+_0x58c033(0xe5)+(_0x1232b2[_0x58c033(0x121)]||_0x26fa1f)+'\x27');_0x3ef391&&(_0x1232b2[_0x58c033(0x15e)]=_0x3ef391);}}_0x2cb03a[_0x58c033(0x118)]===_0x58c033(0x13a)&&_0x5c8529?.['type']===_0x58c033(0x13a)&&resolveWaitStepPendingIds(_0x2cb03a,_0x5c8529,_0x200d10,_0x3bdf98['name']);}}}}
1
+ const a152_0x1444f9=a152_0x576d;(function(_0x5cd12d,_0x3db49e){const _0xe3efa=a152_0x576d,_0x4b52d8=_0x5cd12d();while(!![]){try{const _0x133986=parseInt(_0xe3efa(0x127))/0x1+-parseInt(_0xe3efa(0x14a))/0x2+parseInt(_0xe3efa(0x1c2))/0x3+-parseInt(_0xe3efa(0x107))/0x4+parseInt(_0xe3efa(0x1b7))/0x5*(-parseInt(_0xe3efa(0x200))/0x6)+parseInt(_0xe3efa(0x16f))/0x7*(-parseInt(_0xe3efa(0x150))/0x8)+-parseInt(_0xe3efa(0x16d))/0x9*(-parseInt(_0xe3efa(0x109))/0xa);if(_0x133986===_0x3db49e)break;else _0x4b52d8['push'](_0x4b52d8['shift']());}catch(_0x5924f9){_0x4b52d8['push'](_0x4b52d8['shift']());}}}(a152_0x2c43,0x31eac));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x1444f9(0x1e7));export const PENDING_SEGMENT_PREFIX=a152_0x1444f9(0x11f);export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0x4fbf4e){return''+PENDING_SEGMENT_PREFIX+_0x4fbf4e+'__';}export function isPendingSegmentId(_0x4869d0){const _0x28e3dd=a152_0x1444f9;return _0x4869d0[_0x28e3dd(0x17b)](PENDING_SEGMENT_PREFIX)&&!_0x4869d0[_0x28e3dd(0x17b)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x57aa7a){const _0x1d4b27=a152_0x1444f9;return _0x57aa7a[_0x1d4b27(0x118)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0xe168c9){return''+PENDING_ACTIVATION_PREFIX+_0xe168c9+'__';}export function isPendingActivationId(_0x5a18ad){return _0x5a18ad['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x54b4b0){return _0x54b4b0['replace'](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x493626,_0x5a9ca0){const _0x20e303=a152_0x1444f9,_0xa9f2d1=_0x493626+'::'+(_0x5a9ca0[_0x20e303(0x1c1)]()||_0x20e303(0x1f0)),_0x48e2af=createHash(_0x20e303(0x14d))[_0x20e303(0x172)](_0xa9f2d1)[_0x20e303(0x185)]('hex')[_0x20e303(0x10c)](0x0,0xc);return _0x20e303(0x19c)+_0x48e2af;}export function ensureJourneyDefaults(_0x8bbb28){const _0x34d050=a152_0x1444f9;!_0x8bbb28[_0x34d050(0x19e)]&&(_0x8bbb28[_0x34d050(0x19e)]=''),!_0x8bbb28[_0x34d050(0x187)]&&(_0x8bbb28['state']=_0x34d050(0x182));}export function injectExistingStageIds(_0x33dfe6,_0x49ffa6){const _0x16076f=a152_0x1444f9,_0x394799=new Map(_0x49ffa6[_0x16076f(0x136)](_0x58505b=>[_0x58505b[_0x16076f(0x1aa)],_0x58505b['id']]));for(const _0x3231d8 of _0x33dfe6){if(!_0x3231d8['id']){const _0x1ddb02=_0x394799[_0x16076f(0x183)](_0x3231d8[_0x16076f(0x1aa)]);_0x1ddb02&&(_0x3231d8['id']=_0x1ddb02);}}}export function resolveTDFolderPath(_0x2cc152,_0x32f88c,_0x26103d){const _0x2b557c=a152_0x1444f9;if(!_0x32f88c)return _0x2cc152;if(_0x2cc152===_0x26103d||_0x2cc152[_0x2b557c(0x17b)](_0x26103d+'/'))return _0x2cc152;return _0x2cc152?_0x26103d+'/'+_0x2cc152:_0x26103d;}export function addFoldersToCreate(_0x385e61,_0x3479f5,_0x2ea89d){const _0x840648=a152_0x1444f9;if(!_0x385e61)return;if(_0x3479f5['has'](_0x385e61))return;const _0x244ca4=_0x385e61[_0x840648(0x191)]('/');let _0x3cfc40='';for(const _0x120cd9 of _0x244ca4){_0x3cfc40=_0x3cfc40?_0x3cfc40+'/'+_0x120cd9:_0x120cd9,!_0x3479f5['has'](_0x3cfc40)&&_0x2ea89d[_0x840648(0x1eb)](_0x3cfc40);}}export function sortFoldersByDepth(_0x42425e){const _0x5d4e9b=a152_0x1444f9;return[..._0x42425e][_0x5d4e9b(0x164)]((_0x3ae25d,_0x4bdc7d)=>{const _0x32c30d=_0x5d4e9b,_0xa22976=(_0x3ae25d[_0x32c30d(0x168)](/\//g)||[])['length'],_0xeb5af5=(_0x4bdc7d[_0x32c30d(0x168)](/\//g)||[])[_0x32c30d(0x124)];return _0xa22976-_0xeb5af5;});}function a152_0x2c43(){const _0xea3acf=['waitStepType','segment_creating','fetchJourney','deleteSegment','\x27\x20from\x20file:\x20','./child-segment-yaml.js','parentFolder','user','map','resolveSegment','nameToType','entries','activation_deleted','Fetching\x20','updated','\x27\x20not\x20found\x20in\x20journey\x20\x27','notification','conditionTimeoutUnit','size','push','\x27\x20by\x20rule\x20content','journeys','segments','deleteActivation','uniqueSegmentName','hasChanges','yamlActivation','toLowerCase','654440rKZgEI','toISOString','journey_created','sha1','\x27\x20exit\x20criteria','parentId','16mGkjJW','kind','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','message','createJourneySegment','includes','Created\x20journey\x20\x27','journey','type','all','branches','existingActivation','deleted','\x20activation\x20\x27','\x20(referenced\x20in\x20journey\x20','getSegmentEntity','skipSegments','folderPath','unchanged','Creating\x20segment\x20\x27','sort','delete','conditionTimeoutDuration','filter','match','from','entry_criteria','Updating\x20segment\x20\x27','milestone','5626755hsytwU','activations','182581hyjTMb','createdSegmentIds','ACTIVATION_SYNTAX_ERROR','update','behavior','segmentId','existingJourney','find','results','buildUserMaps','\x27...','uniqueServerName','startsWith','absolutePath','entryCriteria','create','createSegment','conditions','idToEmailMap','draft','get','\x27\x20milestone','digest','activationActions','state','JOURNEY_UPDATE_ERROR','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','folder_created','existingSegments','data','Stage\x20\x27','journeyStages','segment_deleting','resolvedRule','split','\x27\x20entry\x20criteria','INTERNAL','item','diff','\x0a\x20\x20','localName','SEGMENT_SYNTAX_ERROR','yamlConfig','segment_deleted','\x20error(s)','journey_entry_criteria_','Failed\x20to\x20','description','journeyBundleName','updateSegmentById','goal\x20criteria','Name\x20has\x20already\x20been\x20taken','segment_created','\x20journey\x20from\x20file:\x20','steps','stages','connector_config','idToName','isNew','name','existingSegment','journeyBundlesByFolderAndName','Updating\x20activation\x20\x27','withProgress','parentSegmentFolder','onProgress','entry','activation_creating','progress','exitCriterias','Updated\x20segment\x20\x27','segmentNameToId','20AtviLE','versionNumber','\x20segment\x20from\x20file:\x20','validatedRequest','null','journeyActivationNameToId','index','decision_point','logInfo','Embedded\x20segment\x20\x27','trim','463362yVFFDv','getSegment\x20failed\x20for\x20','journeyBundleId',').\x20','listActivations','Journey\x20\x27','rule','DecisionPoint','folderId','Deleted\x20segment\x20\x27','Created\x20activation\x20\x27','schedule','journeyName','embedded_activation_created','verbose','max','toString','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','valid','Condition','connectionIdToNameMap','journey_updated','conditionSegmentId','updateActivation','getJourney','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','Segment\x20not\x20found','createActivation','dirname','folder_creating','journeyId','some','debug','Segment\x20not\x20found:\x20','join',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','activation_updating','tdx.sdk.push-workflow','waitStepUnit','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','\x27\x20for\x20','add','WaitStep','activation_created','reduce','with','segment','rootFolderId','parse','activationStepsById','SEGMENT_NOT_FOUND','logDeleted','effectiveFolderId','segmentByFolderAndName','embedded_segment_created','deps','Activation','day','logSuccess','folderPathToId','created','\x27\x20to\x20local\x20\x27','76134giUACM','journey_creating','journeyActivationStepId','\x27\x20wait\x20condition','Created\x20folder\x20\x27','Entry\x20criteria:\x20','activation_','JOURNEY_SYNTAX_ERROR','activationContext','Created\x20segment\x20\x27','getActivation','segmentFolderId','relative','keys','embedded_segment_creating','errors','../../utils/async.js','folder','1377672EpHayb','relationships','10AsdOkR','NOT_FOUND','action','slice','Creating\x20activation\x20\x27','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','Updated\x20activation\x20\x27','object','activationsBySegmentId','utf-8','stage\x20\x27','./journey-yaml.js','Deleting\x20activation\x20\x27','waitStep','replace','createdSegmentId','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','activation_deleting','values','stringify','getLatestJourneyId','__pending_','goal','set','has','SEGMENT_UPDATE_ERROR','length','activation_template_id','\x27\x20decision\x20point\x20branch\x20\x27','199371GTikZR','attributes','journeyById','Failed\x20to\x20resolve\x20segment\x20','run_after_journey_refresh','connection','ACTIVATION_UPDATE_ERROR'];a152_0x2c43=function(){return _0xea3acf;};return a152_0x2c43();}import*as a152_0x24cb6f from'yaml';import{readFileSync}from'fs';import a152_0x5df6f3 from'path';import{isJourneyDef,parseYamlString as a152_0x3f4e65,toYamlString as a152_0x414edb,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(_0x36c2b6){const _0x456220=a152_0x1444f9;if(Array['isArray'](_0x36c2b6))return'['+_0x36c2b6[_0x456220(0x136)](_0xff71bc=>stableStringify(_0xff71bc))[_0x456220(0x1e4)](',')+']';if(_0x36c2b6&&typeof _0x36c2b6===_0x456220(0x111)){const _0x368b36=_0x36c2b6,_0x56b256=Object[_0x456220(0x102)](_0x368b36)[_0x456220(0x164)](),_0x3a4bdf=_0x56b256[_0x456220(0x136)](_0x323206=>'\x22'+_0x323206+'\x22:'+stableStringify(_0x368b36[_0x323206]));return'{'+_0x3a4bdf[_0x456220(0x1e4)](',')+'}';}const _0x573b2c=JSON[_0x456220(0x11d)](_0x36c2b6);return _0x573b2c===undefined?_0x456220(0x1bb):_0x573b2c;}function activationSignature(_0x15d5a4){const _0x2cec3a=a152_0x1444f9,_0x3c573f={'connection':_0x15d5a4[_0x2cec3a(0x12c)],..._0x15d5a4['all_columns']!==undefined&&{'all_columns':_0x15d5a4['all_columns']},..._0x15d5a4['columns']!==undefined&&{'columns':_0x15d5a4['columns']},..._0x15d5a4[_0x2cec3a(0x173)]!==undefined&&{'behavior':_0x15d5a4['behavior']},..._0x15d5a4[_0x2cec3a(0x1cd)]!==undefined&&{'schedule':_0x15d5a4[_0x2cec3a(0x1cd)]},..._0x15d5a4[_0x2cec3a(0x13e)]!==undefined&&{'notification':_0x15d5a4[_0x2cec3a(0x13e)]},..._0x15d5a4[_0x2cec3a(0x1a7)]!==undefined&&{'connector_config':_0x15d5a4[_0x2cec3a(0x1a7)]},..._0x15d5a4[_0x2cec3a(0x125)]!==undefined&&{'activation_template_id':_0x15d5a4[_0x2cec3a(0x125)]}};return stableStringify(_0x3c573f);}async function fetchSegment(_0x4181b3,_0x4901fd,_0x10d304,_0x159b57){const _0x51ab4b=a152_0x1444f9,_0x236bae=_0x159b57?.[_0x51ab4b(0x176)](_0x130457=>_0x130457['id']===_0x10d304);if(_0x236bae)return _0x236bae;try{return await _0x4181b3[_0x51ab4b(0x1f0)]['getSegment'](_0x4901fd,_0x10d304);}catch(_0x60bcff){logger[_0x51ab4b(0x1e2)](_0x51ab4b(0x1c3)+_0x10d304+_0x51ab4b(0x1e5)+_0x60bcff);try{return await _0x4181b3['segment'][_0x51ab4b(0x15f)](_0x10d304);}catch(_0x2b07af){return logger['debug']('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x10d304+':\x20'+_0x2b07af),null;}}}function recoverSegmentIdsFromPushRecovery(_0x2187fc,_0x46853c,_0x3fb9f7){const _0x472589=a152_0x1444f9,_0x2e0604=readPushRecovery(_0x2187fc['absolutePath']);if(_0x2e0604?.[_0x472589(0x1ce)]===_0x2187fc[_0x472589(0x199)][_0x472589(0x1aa)])for(const [_0x547ed3,_0x4cf30b]of Object[_0x472589(0x139)](_0x2e0604[_0x472589(0x144)])){const _0x56e4f9=generateDeterministicJourneySegmentName(_0x2187fc[_0x472589(0x199)][_0x472589(0x1aa)],_0x547ed3);_0x4cf30b[_0x472589(0x17a)]===_0x56e4f9&&(_0x46853c[_0x472589(0x121)](_0x547ed3,_0x4cf30b[_0x472589(0x174)]),_0x3fb9f7['set'](_0x547ed3,_0x4cf30b[_0x472589(0x174)]));}}async function createOrRecoverEmbeddedSegment(_0x1958b7,_0x94a9d,_0x468901,_0x10ba0d){const _0x5d5de9=a152_0x1444f9;let _0x5006b9;try{_0x5006b9=await _0x1958b7[_0x5d5de9(0x1f0)][_0x5d5de9(0x154)]({'name':_0x468901['uniqueSegmentName'],'description':_0x468901[_0x5d5de9(0x19e)],'journeyId':_0x468901['journeyId'],'rule':_0x10ba0d(_0x468901[_0x5d5de9(0x190)],!![]),'countPopulation':!![],'parentFolderId':_0x468901[_0x5d5de9(0x1ca)],'audienceId':_0x468901[_0x5d5de9(0x14f)]});}catch(_0x31e649){const _0x5b5c53=_0x31e649 instanceof Error&&_0x31e649[_0x5d5de9(0x153)][_0x5d5de9(0x155)](_0x5d5de9(0x1a2));if(_0x5b5c53){const _0x20668a=readPushRecovery(_0x94a9d[_0x5d5de9(0x17c)]),_0x5dbc5a=_0x20668a?.[_0x5d5de9(0x1ce)]===_0x94a9d[_0x5d5de9(0x199)][_0x5d5de9(0x1aa)]?_0x20668a[_0x5d5de9(0x144)][_0x468901[_0x5d5de9(0x197)]]:undefined;if(_0x5dbc5a?.[_0x5d5de9(0x17a)]===_0x468901[_0x5d5de9(0x146)])await _0x1958b7['segment'][_0x5d5de9(0x1a0)](_0x468901[_0x5d5de9(0x14f)],_0x5dbc5a[_0x5d5de9(0x174)],{'description':_0x468901['description'],'rule':_0x10ba0d(_0x468901[_0x5d5de9(0x190)],!![]),'countPopulation':!![]}),_0x5006b9=_0x5dbc5a[_0x5d5de9(0x174)];else throw new SDKError(ErrorCode[_0x5d5de9(0x123)],_0x5d5de9(0x1c0)+_0x468901[_0x5d5de9(0x197)]+_0x5d5de9(0x1e9)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x94a9d[_0x5d5de9(0x17c)]['replace'](/([^/]+)$/,'.$1.push-recovery.json')+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x31e649);}else throw _0x31e649;}return saveSegmentToPushRecovery(_0x94a9d[_0x5d5de9(0x17c)],_0x94a9d[_0x5d5de9(0x199)][_0x5d5de9(0x1aa)],_0x468901['localName'],{'segmentId':_0x5006b9,'uniqueServerName':_0x468901['uniqueSegmentName'],'createdAt':new Date()[_0x5d5de9(0x14b)]()}),_0x5006b9;}export async function prepareSegmentFiles(_0x3d6c76,_0x1f5476,_0x47614b,_0x2b77af,_0x595661){const _0x160f82=a152_0x1444f9,{activationDefToCreateRequest:_0x10a58a}=await import(_0x160f82(0x133)),_0x586c78=[],_0x48b438=new Set();for(const {yamlConfig:_0x579f1e,folderPath:_0x4602d8,sourcePath:_0x4a994b}of _0x3d6c76){const _0x4f8b41=resolveTDFolderPath(_0x4602d8,_0x2b77af,_0x595661),_0x1cd9b2=_0x4f8b41+':'+_0x579f1e[_0x160f82(0x1aa)],_0x223821=_0x1f5476[_0x160f82(0x1f7)]['get'](_0x1cd9b2),_0x5b6b6c=_0x223821?_0x1f5476[_0x160f82(0x112)][_0x160f82(0x183)](_0x223821['id'])||[]:[];addFoldersToCreate(_0x4f8b41,_0x1f5476[_0x160f82(0x1fd)],_0x48b438);const _0x5793bb=calculateActivationActions(_0x579f1e['activations']||[],_0x5b6b6c,_0x1f5476['idToEmailMap'],_0x1f5476[_0x160f82(0x1d6)]);for(const _0x567247 of _0x5793bb){(_0x567247['type']==='create'||_0x567247[_0x160f82(0x158)]===_0x160f82(0x172))&&_0x567247[_0x160f82(0x148)]&&(_0x567247[_0x160f82(0x1ba)]=await _0x10a58a(_0x567247[_0x160f82(0x148)],_0x47614b));}const _0x383132=calculateSegmentDiff(_0x579f1e,_0x223821,_0x5b6b6c,_0x1f5476[_0x160f82(0x181)],_0x1f5476['connectionIdToNameMap']);_0x586c78['push']({'relativePath':_0x579f1e[_0x160f82(0x1aa)],'absolutePath':_0x4a994b,'yamlConfig':_0x579f1e,'folderPath':_0x4f8b41,'existingSegment':_0x223821,'existingActivations':_0x5b6b6c,'isNew':_0x383132[_0x160f82(0x1a9)],'hasChanges':_0x383132[_0x160f82(0x147)],'diff':_0x383132[_0x160f82(0x195)],'activationActions':_0x5793bb});}return{'segmentFiles':_0x586c78,'foldersToCreate':_0x48b438};}export async function prepareJourneyFiles(_0x44680a,_0x1039cf,_0xcc5bb9,_0x4ece73){const _0x556dc7=a152_0x1444f9,_0x2f7773=[],_0x52018b=new Set();for(const {yamlConfig:_0x56005d,folderPath:_0x2cebc0,sourcePath:_0x6b3993}of _0x44680a){const _0x18efad=resolveTDFolderPath(_0x2cebc0,_0xcc5bb9,_0x4ece73),_0x2f0d2b=_0x18efad+':'+_0x56005d[_0x556dc7(0x1aa)],_0x38d34b=_0x1039cf[_0x556dc7(0x1ac)][_0x556dc7(0x183)](_0x2f0d2b);let _0x35504a,_0x12ce56;if(_0x38d34b&&_0x38d34b[_0x556dc7(0x124)]>0x0){const _0x61b1e1=buildLocalExpandedRuleMappings(_0x56005d),{createYamlContext:_0x3087bb,prefetchJourneySegments:_0xc419d5}=createPushYamlContextForBundle(_0x1039cf['deps'],_0x1039cf[_0x556dc7(0x14f)],_0x1039cf[_0x556dc7(0x18b)],_0x61b1e1,_0x1039cf['idToEmailMap'],_0x1039cf[_0x556dc7(0x1d6)],_0x1039cf[_0x556dc7(0x1f3)],_0x1039cf[_0x556dc7(0x129)]);await _0xc419d5(_0x38d34b[_0x556dc7(0x136)](_0x149300=>_0x149300['id']));const _0x216df3=await _0x1039cf[_0x556dc7(0x1f9)][_0x556dc7(0x157)][_0x556dc7(0x11e)](_0x38d34b[0x0][_0x556dc7(0x1c4)]),_0x13bac0=hasMultipleVersions(_0x56005d),_0x3191fa=async _0x195012=>{const _0x42b1d9=_0x556dc7,_0x20c2b4=_0x1039cf['journeyById']?.[_0x42b1d9(0x183)](_0x195012);if(_0x20c2b4)return _0x20c2b4;return _0x1039cf[_0x42b1d9(0x130)]({'journeyId':_0x195012,'journeyName':_0x56005d[_0x42b1d9(0x1aa)],'isMultiVersion':_0x38d34b['length']>0x1});};if(_0x13bac0&&_0x38d34b[_0x556dc7(0x124)]>0x1){const _0x49003a=[];for(const _0x147133 of _0x38d34b){const _0x4d4377=_0x147133[_0x556dc7(0x1b8)]||0x1;_0x1039cf['progress']?.[_0x556dc7(0x172)](_0x556dc7(0x13b)+_0x56005d[_0x556dc7(0x1aa)]+'\x20v'+_0x4d4377);const _0x34ad88=await _0x3191fa(_0x147133['id']),_0x2d0994=_0x3087bb(_0x147133['id']),_0x2845f4=await journeyResponseToDef(_0x34ad88,_0x2d0994);_0x49003a[_0x556dc7(0x141)]({'item':_0x147133,'yaml':_0x2845f4});}const _0x539783=buildLocalRuleToNameMappingFromJourney(_0x56005d);_0x12ce56=buildMergedJourneyDef(_0x49003a,_0x539783,_0x216df3);const _0x2a249b=Math[_0x556dc7(0x1d1)](..._0x49003a['map'](_0x37cdc5=>_0x37cdc5[_0x556dc7(0x194)][_0x556dc7(0x1b8)]||0x0)),_0x5c70e4=_0x38d34b[_0x556dc7(0x176)](_0x3cb1cf=>(_0x3cb1cf[_0x556dc7(0x1b8)]||0x0)===_0x2a249b);_0x5c70e4&&(_0x1039cf[_0x556dc7(0x1b3)]?.[_0x556dc7(0x172)](_0x556dc7(0x13b)+_0x56005d[_0x556dc7(0x1aa)]+'\x20v'+_0x2a249b),_0x35504a=await _0x3191fa(_0x5c70e4['id']));}else{const _0x2705dc=_0x38d34b[_0x38d34b[_0x556dc7(0x124)]-0x1];_0x1039cf['progress']?.['update'](_0x556dc7(0x13b)+_0x56005d['name']),_0x35504a=await _0x3191fa(_0x2705dc['id']);const _0x49a6bd=_0x3087bb(_0x2705dc['id']),_0x20390e=await journeyResponseToDef(_0x35504a,_0x49a6bd),_0x4060ec=buildLocalRuleToNameMappingFromJourney(_0x56005d);_0x12ce56=buildMergedJourneyDef([{'item':_0x2705dc,'yaml':_0x20390e}],_0x4060ec,_0x216df3);}}addFoldersToCreate(_0x18efad,_0x1039cf[_0x556dc7(0x1fd)],_0x52018b);const _0x176eba=calculateJourneyDiff(_0x56005d,_0x12ce56);_0x2f7773['push']({'relativePath':_0x56005d['name'],'absolutePath':_0x6b3993,'yamlConfig':_0x56005d,'folderPath':_0x18efad,'existingJourney':_0x35504a,'isNew':_0x176eba['isNew'],'hasChanges':_0x176eba[_0x556dc7(0x147)],'diff':_0x176eba[_0x556dc7(0x195)]});}return{'journeyFiles':_0x2f7773,'foldersToCreate':_0x52018b};}export function calculateActivationActions(_0xbca267,_0x3bca7b,_0x5eed4d,_0x4bb607){const _0x5f3f06=a152_0x1444f9,_0x39f47a=[],_0x2e6097=new Map();for(const _0x326489 of _0x3bca7b){_0x2e6097[_0x5f3f06(0x121)](_0x326489['name'],_0x326489);}const _0x4fc772=new Map();for(const _0xa38eac of _0xbca267){_0x4fc772[_0x5f3f06(0x121)](_0xa38eac[_0x5f3f06(0x1aa)],_0xa38eac);}for(const _0x3477cb of _0xbca267){const _0x2986c4=_0x2e6097[_0x5f3f06(0x183)](_0x3477cb[_0x5f3f06(0x1aa)]);if(!_0x2986c4)_0x39f47a[_0x5f3f06(0x141)]({'type':'create','name':_0x3477cb[_0x5f3f06(0x1aa)],'yamlActivation':_0x3477cb});else{const _0x2914be=activationResponseToDef(_0x2986c4,_0x5eed4d,_0x4bb607),_0xfddfe5=a152_0x24cb6f['stringify'](_0x2914be),_0xcf1482=a152_0x24cb6f[_0x5f3f06(0x11d)](_0x3477cb);_0xfddfe5!==_0xcf1482&&_0x39f47a[_0x5f3f06(0x141)]({'type':'update','name':_0x3477cb[_0x5f3f06(0x1aa)],'yamlActivation':_0x3477cb,'existingActivation':_0x2986c4});}}for(const _0x4882f1 of _0x3bca7b){!_0x4fc772['has'](_0x4882f1['name'])&&_0x39f47a[_0x5f3f06(0x141)]({'type':_0x5f3f06(0x165),'name':_0x4882f1[_0x5f3f06(0x1aa)],'existingActivation':_0x4882f1});}return _0x39f47a;}function calculateYamlDiff(_0x542334,_0x5f1a79){if(_0x5f1a79){const _0x4262eb=generateDiff(_0x5f1a79,_0x542334),_0x4af54e=hasChanges(_0x4262eb);return{'isNew':![],'hasChanges':_0x4af54e,'diff':_0x4af54e?formatDiffWithColors(_0x4262eb):undefined};}const _0xed21ab=generateDiff('',_0x542334);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0xed21ab)};}export function calculateSegmentDiff(_0x406b08,_0x4cbd61,_0x29e84e,_0x523ef6,_0x3272ec){const _0x39c5e5=segmentToYamlString(_0x406b08),_0x275419=_0x4cbd61?segmentToYamlString(segmentWithActivationsToYaml(_0x4cbd61,_0x29e84e,undefined,_0x523ef6,_0x3272ec)):undefined;return calculateYamlDiff(_0x39c5e5,_0x275419);}export function calculateJourneyDiff(_0x91aae2,_0x3ce707){const _0x4ae400=normalizeJourneyDef(_0x91aae2,_0x91aae2),_0x59f6e7=a152_0x414edb(_0x4ae400),_0x299171=_0x3ce707?a152_0x414edb(normalizeJourneyDef(_0x3ce707,_0x91aae2)):undefined;return calculateYamlDiff(_0x59f6e7,_0x299171);}export function findSegmentsToDelete(_0x2dcff3,_0x2bf01d,_0x573341,_0x2d71e1,_0x4ec45f){const _0x423400=a152_0x1444f9,_0x32bc8f=new Set();for(const {yamlConfig:_0x3179ca,folderPath:_0x1352e4}of _0x2bf01d){_0x32bc8f[_0x423400(0x1eb)](_0x1352e4+':'+_0x3179ca[_0x423400(0x1aa)]);}return _0x2dcff3['filter'](_0x2c1a29=>{const _0x31e07b=_0x423400,_0x4b9c05=_0x2c1a29[_0x31e07b(0x100)]?_0x573341[_0x31e07b(0x183)](_0x2c1a29[_0x31e07b(0x100)][_0x31e07b(0x1d2)]())||'':'',_0x1b1e2a=_0x4b9c05+':'+_0x2c1a29['name'];if(_0x32bc8f['has'](_0x1b1e2a))return![];if(_0x4ec45f)return _0x4b9c05===_0x2d71e1||_0x4b9c05[_0x31e07b(0x17b)](_0x2d71e1+'/');return!![];});}export function findJourneysToDelete(_0x3b9fc9,_0x265484,_0x5020d0,_0x2c7630,_0xfd222){const _0x4df614=a152_0x1444f9,_0x24a3b7=new Set();for(const {yamlConfig:_0x80579d,folderPath:_0x1b335c}of _0x265484){_0x24a3b7[_0x4df614(0x1eb)](_0x1b335c+':'+_0x80579d[_0x4df614(0x1aa)]);}return _0x3b9fc9['filter'](_0x5008df=>{const _0x2560ab=_0x4df614,_0x4339f0=_0x5008df['folderId']?_0x5020d0['get'](_0x5008df[_0x2560ab(0x1ca)])||'':'',_0x119043=_0x4339f0+':'+_0x5008df[_0x2560ab(0x19f)];if(_0x24a3b7[_0x2560ab(0x122)](_0x119043))return![];if(_0xfd222)return _0x4339f0===_0x2c7630||_0x4339f0[_0x2560ab(0x17b)](_0x2c7630+'/');return!![];});}function a152_0x576d(_0x3f53e3,_0x230a81){_0x3f53e3=_0x3f53e3-0xf6;const _0x2c435f=a152_0x2c43();let _0x576dbd=_0x2c435f[_0x3f53e3];return _0x576dbd;}export function buildSegmentLookupMap(_0x36c256,_0x5a9e7e){const _0x43f930=a152_0x1444f9,_0x3df5b8=new Map();for(const _0x14306b of _0x36c256){const _0x513e2b=_0x14306b[_0x43f930(0x100)]?_0x5a9e7e['get'](_0x14306b[_0x43f930(0x100)][_0x43f930(0x1d2)]())||'':'',_0x2eb330=_0x513e2b+':'+_0x14306b[_0x43f930(0x1aa)];_0x3df5b8[_0x43f930(0x121)](_0x2eb330,_0x14306b);}return _0x3df5b8;}export function buildSegmentNameToIdMap(_0x17431b){const _0x59be21=a152_0x1444f9,_0xe6b9bd=new Map();for(const _0x10029a of _0x17431b){_0xe6b9bd[_0x59be21(0x121)](_0x10029a[_0x59be21(0x1aa)],_0x10029a['id']);}return _0xe6b9bd;}export function buildJourneyBundleLookupMap(_0x2f7fe7,_0x16550e){const _0x39c166=a152_0x1444f9,_0x23f2e1=new Map();for(const _0xe21193 of _0x2f7fe7){const _0x11cc3a=_0xe21193[_0x39c166(0x1ca)]?_0x16550e[_0x39c166(0x183)](_0xe21193[_0x39c166(0x1ca)])||'':'',_0x230a9f=_0x11cc3a+':'+_0xe21193[_0x39c166(0x19f)];!_0x23f2e1[_0x39c166(0x122)](_0x230a9f)&&_0x23f2e1[_0x39c166(0x121)](_0x230a9f,[]),_0x23f2e1[_0x39c166(0x183)](_0x230a9f)[_0x39c166(0x141)](_0xe21193);}for(const _0x289c2f of _0x23f2e1[_0x39c166(0x11c)]()){_0x289c2f['sort']((_0x8deca0,_0x1ba249)=>(_0x8deca0[_0x39c166(0x1b8)]||0x0)-(_0x1ba249['versionNumber']||0x0));}return _0x23f2e1;}export function collectFoldersToCreate(_0x180769,_0x1ec15e){const _0x464179=a152_0x1444f9,_0x4de849=new Set();for(const _0x25b7ba of _0x180769){if(!_0x25b7ba)continue;if(_0x1ec15e[_0x464179(0x122)](_0x25b7ba))continue;const _0x2d972b=_0x25b7ba['split']('/');let _0x1088c7='';for(const _0x17b22b of _0x2d972b){_0x1088c7=_0x1088c7?_0x1088c7+'/'+_0x17b22b:_0x17b22b,!_0x1ec15e[_0x464179(0x122)](_0x1088c7)&&_0x4de849[_0x464179(0x1eb)](_0x1088c7);}}return _0x4de849;}export function parseAndClassifyYamlFiles(_0x49bf7e,_0x135b2d,_0x3e88c3){const _0x4d4f64=a152_0x1444f9,_0x1cd22f=[],_0x15786b=[];for(const _0x3d8278 of _0x49bf7e){const _0x3f7a08=a152_0x5df6f3['relative'](_0x135b2d,a152_0x5df6f3[_0x4d4f64(0x1de)](_0x3d8278)),_0x4afd15=_0x3f7a08==='.'?'':_0x3f7a08,_0x407864=readFileSync(_0x3d8278,'utf-8'),_0x2c6a54=a152_0x24cb6f[_0x4d4f64(0x1f2)](_0x407864);if(isJourneyDef(_0x2c6a54)){const _0x262c65=a152_0x3f4e65(_0x407864);_0x15786b[_0x4d4f64(0x141)]({'yamlConfig':_0x262c65,'folderPath':_0x4afd15,'sourcePath':_0x3d8278});}else{if(!_0x3e88c3?.[_0x4d4f64(0x160)]){const _0x203e9d=parseSegmentYamlFile(_0x407864),_0x11480c=normalizeChildSegmentYaml(_0x203e9d);_0x1cd22f[_0x4d4f64(0x141)]({'yamlConfig':_0x11480c,'folderPath':_0x4afd15,'sourcePath':_0x3d8278});}}}return{'segments':_0x1cd22f,'journeys':_0x15786b};}export function validateParsedFiles(_0x3bd0cd,_0x34dce6){const _0x3786de=a152_0x1444f9,_0x159dd9=[];for(const {yamlConfig:_0x5d1205,sourcePath:_0x120f79}of _0x3bd0cd[_0x3786de(0x144)]){const _0x2a3155=readFileSync(_0x120f79,_0x3786de(0x113)),_0x33e6e2=a152_0x24cb6f['parseDocument'](_0x2a3155),_0x5cb895=validateSegmentDef(_0x5d1205,{'source':_0x2a3155,'document':_0x33e6e2},{'skipSchema':!![]});if(!_0x5cb895[_0x3786de(0x1d4)]){const _0x2d6f5c=a152_0x5df6f3['relative'](_0x34dce6,_0x120f79);_0x159dd9['push']({'filePath':_0x2d6f5c,'source':_0x2a3155,'result':_0x5cb895,'isJourney':![]});}}for(const {yamlConfig:_0x210de6,sourcePath:_0x3b5f7a}of _0x3bd0cd[_0x3786de(0x143)]){const _0x431e0b=readFileSync(_0x3b5f7a,_0x3786de(0x113)),_0x36cc5b=a152_0x24cb6f['parseDocument'](_0x431e0b),_0xc2b105=validateJourneyDef(_0x210de6,{'source':_0x431e0b,'document':_0x36cc5b},{'skipSchema':!![]});if(!_0xc2b105['valid']){const _0x31f8bd=a152_0x5df6f3[_0x3786de(0x101)](_0x34dce6,_0x3b5f7a);_0x159dd9['push']({'filePath':_0x31f8bd,'source':_0x431e0b,'result':_0xc2b105,'isJourney':!![]});}}return _0x159dd9;}export function formatValidationErrors(_0x31a927){const _0xfdfbea=a152_0x1444f9,_0x7f380a=[];for(const {filePath:_0x520b4d,source:_0x59ff54,result:_0x121594,isJourney:_0x57448e}of _0x31a927){const _0x349639=_0x57448e?'journey':_0xfdfbea(0x1f0);_0x7f380a['push']('\x0a'+_0x520b4d+'\x20('+_0x349639+'):\x20'+_0x121594[_0xfdfbea(0x104)][_0xfdfbea(0x124)]+_0xfdfbea(0x19b)),_0x7f380a[_0xfdfbea(0x141)](formatValidationResult(_0x121594,_0x59ff54,_0x520b4d));}return _0x7f380a[_0xfdfbea(0x1e4)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x7287dc){const _0x11c65a=a152_0x1444f9,_0x5dd449=new Set(),_0xe366f2=new Map(),_0x21310d=collectSegmentUsageCounts(_0x7287dc);if(_0x7287dc[_0x11c65a(0x144)])for(const [_0x106998,_0x50c354]of Object['entries'](_0x7287dc[_0x11c65a(0x144)])){_0x5dd449[_0x11c65a(0x1eb)](_0x106998);if(_0x50c354['rule']){const _0x51df09=yamlRuleToApi(_0x50c354['rule']),_0x52dccb=apiRuleToYaml(_0x51df09);_0xe366f2[_0x11c65a(0x121)](_0x106998,_0x52dccb);}}const _0x1220f7=new Map();let _0x45b100=0x0;for(const [_0xcbefe2,_0x217145]of _0xe366f2){const _0x24ae41=serializeExpandedRule(_0x217145,_0xe366f2),_0x5271de=_0x1220f7[_0x11c65a(0x183)](_0x24ae41)||[];_0x5271de[_0x11c65a(0x141)]({'name':_0xcbefe2,'index':_0x45b100}),_0x1220f7['set'](_0x24ae41,_0x5271de),_0x45b100++;}const _0x4144d5=new Map();for(const [_0x474206,_0xb60ebb]of _0x1220f7){const _0x17a9d9=_0xb60ebb[_0x11c65a(0x10c)]()['sort']((_0x4d85ce,_0x34a4c8)=>{const _0xd4f1bb=_0x11c65a,_0x5f23d3=_0x21310d[_0xd4f1bb(0x183)](_0x4d85ce['name'])||0x0,_0x56d74b=_0x21310d['get'](_0x34a4c8[_0xd4f1bb(0x1aa)])||0x0;if(_0x5f23d3!==_0x56d74b)return _0x56d74b-_0x5f23d3;return _0x4d85ce[_0xd4f1bb(0x1bd)]-_0x34a4c8[_0xd4f1bb(0x1bd)];})[_0x11c65a(0x136)](_0x164f5d=>_0x164f5d['name']),_0x57f864=[];for(const _0x4329f5 of _0x17a9d9){const _0x5699c0=_0x21310d[_0x11c65a(0x183)](_0x4329f5)||0x0,_0x55da83=Math[_0x11c65a(0x1d1)](_0x5699c0,0x1);for(let _0x2276cc=0x0;_0x2276cc<_0x55da83;_0x2276cc++){_0x57f864[_0x11c65a(0x141)](_0x4329f5);}}_0x4144d5['set'](_0x474206,_0x57f864);}return{'existingLocalSegmentNames':_0x5dd449,'localSegmentRules':_0xe366f2,'localExpandedRuleToNames':_0x4144d5};}export function createSegmentIdResolver(_0x1efc50,_0x569c95){return async _0x4a3b6f=>{const _0x7c3d36=a152_0x576d,_0x43a6c7=_0x1efc50[_0x7c3d36(0x183)](_0x4a3b6f);if(!_0x43a6c7)throw new SDKError(ErrorCode[_0x7c3d36(0x1f4)],_0x7c3d36(0x1e3)+_0x4a3b6f+_0x7c3d36(0x189)+_0x569c95+'\x27)');return _0x43a6c7;};}export function extractRootFolderId(_0x44eb36){const _0x16c4bb=a152_0x1444f9;return _0x44eb36[_0x16c4bb(0x108)]?.[_0x16c4bb(0x1af)]?.[_0x16c4bb(0x18c)]?.['id']||_0x44eb36[_0x16c4bb(0x108)]?.[_0x16c4bb(0x134)]?.['data']?.['id'];}export function buildConnectionMaps(_0x357f51){const _0xe14d5f=a152_0x1444f9,_0x7769ca=new Map(),_0x3d6047=new Map(),_0x495ecb=new Map();for(const _0x4ef1b3 of _0x357f51){_0x7769ca[_0xe14d5f(0x121)](_0x4ef1b3['name'],parseInt(_0x4ef1b3['id'],0xa)),_0x3d6047[_0xe14d5f(0x121)](_0x4ef1b3['id'],_0x4ef1b3['name']),_0x495ecb[_0xe14d5f(0x121)](_0x4ef1b3[_0xe14d5f(0x1aa)],_0x4ef1b3['type']);}return{'nameToId':_0x7769ca,'idToName':_0x3d6047,'nameToType':_0x495ecb};}export function calculatePushStats(_0x5144f7,_0x49e9f9,_0x95a879,_0x5d3ca5,_0xbb3ee6,_0x53621a,_0x4a9696){const _0x25fae0=a152_0x1444f9,_0x538a5c=_0x5144f7[_0x25fae0(0x167)](_0x43cb09=>_0x43cb09[_0x25fae0(0x1a9)]),_0x3b7d61=_0x5144f7[_0x25fae0(0x167)](_0x340a65=>!_0x340a65['isNew']&&_0x340a65[_0x25fae0(0x147)]),_0x324b41=_0x5144f7[_0x25fae0(0x167)](_0x1e2c85=>!_0x1e2c85[_0x25fae0(0x1a9)]&&!_0x1e2c85[_0x25fae0(0x147)]),_0x1b4082=_0x53621a?_0x5d3ca5:[],_0x26889b=_0x49e9f9['filter'](_0x1efff5=>_0x1efff5[_0x25fae0(0x1a9)]),_0x1370e3=_0x49e9f9[_0x25fae0(0x167)](_0x2a1109=>!_0x2a1109[_0x25fae0(0x1a9)]&&_0x2a1109[_0x25fae0(0x147)]),_0x17b0c7=_0x49e9f9[_0x25fae0(0x167)](_0x1efdb3=>!_0x1efdb3['isNew']&&!_0x1efdb3['hasChanges']),_0x4d86dc=_0x53621a?_0xbb3ee6:[],_0x5690b9=_0x5144f7['flatMap'](_0x26f340=>_0x26f340[_0x25fae0(0x186)]),_0xe24887=_0x5690b9['filter'](_0x1de3d8=>_0x1de3d8[_0x25fae0(0x158)]===_0x25fae0(0x17e)),_0xd2d7dc=_0x5690b9['filter'](_0x2f2ac7=>_0x2f2ac7[_0x25fae0(0x158)]===_0x25fae0(0x172)),_0x2ed092=_0x5690b9[_0x25fae0(0x167)](_0x258b69=>_0x258b69[_0x25fae0(0x158)]===_0x25fae0(0x165)),_0x891416=Array[_0x25fae0(0x169)](_0x95a879)[_0x25fae0(0x164)](),_0x3008e4=_0x4a9696?![]:_0x538a5c[_0x25fae0(0x124)]>0x0||_0x3b7d61[_0x25fae0(0x124)]>0x0||_0x1b4082[_0x25fae0(0x124)]>0x0,_0x58b0b1=_0x26889b[_0x25fae0(0x124)]>0x0||_0x1370e3[_0x25fae0(0x124)]>0x0||_0x4d86dc[_0x25fae0(0x124)]>0x0,_0xe3c7ab=_0x4a9696?![]:_0x5690b9[_0x25fae0(0x124)]>0x0,_0x5a8b5d=_0x891416[_0x25fae0(0x124)]>0x0;return{'segments':{'new':_0x538a5c,'changed':_0x3b7d61,'unchanged':_0x324b41,'toDelete':_0x1b4082},'journeys':{'new':_0x26889b,'changed':_0x1370e3,'unchanged':_0x17b0c7,'toDelete':_0x4d86dc},'activations':{'all':_0x5690b9,'toCreate':_0xe24887,'toUpdate':_0xd2d7dc,'toDelete':_0x2ed092},'folders':{'toCreate':_0x891416},'counts':{'segments':{'new':_0x538a5c[_0x25fae0(0x124)],'changed':_0x3b7d61['length'],'unchanged':_0x324b41[_0x25fae0(0x124)],'toDelete':_0x1b4082['length']},'journeys':{'new':_0x26889b[_0x25fae0(0x124)],'changed':_0x1370e3[_0x25fae0(0x124)],'unchanged':_0x17b0c7[_0x25fae0(0x124)],'toDelete':_0x4d86dc[_0x25fae0(0x124)]},'activations':{'create':_0xe24887[_0x25fae0(0x124)],'update':_0xd2d7dc['length'],'delete':_0x2ed092[_0x25fae0(0x124)]},'folders':_0x891416[_0x25fae0(0x124)]},'hasChanges':_0x3008e4||_0x58b0b1||_0xe3c7ab||_0x5a8b5d};}export async function buildPushExecutionContext(_0x222a53,_0x35c708,_0x43deba,_0x3c289d,_0x6f196b,_0x5e229a){const _0x435aec=a152_0x1444f9,_0x325dc3=extractRootFolderId(_0x43deba),{pathToId:_0x46d690,idToPath:_0x51b8e8}=buildFolderMaps(_0x6f196b),_0x3805cd=buildSegmentNameToIdMap(_0x3c289d),_0x503ce5=new Map(),{batchAsync:_0x2c0153}=await import('../../utils/async.js'),[_0x1825ab,_0x21662f]=await Promise['all']([_0x222a53[_0x435aec(0x135)][_0x435aec(0x178)](),_0x222a53[_0x435aec(0x12c)]['list'](),((async()=>{const _0xdabf6d=_0x435aec;!_0x5e229a&&_0x3c289d[_0xdabf6d(0x124)]>0x0&&await _0x2c0153(_0x3c289d,async _0x2ce2b6=>{const _0x1c0104=_0xdabf6d,_0xb98d12=await _0x222a53['segment'][_0x1c0104(0x1c6)](_0x35c708,_0x2ce2b6['id']);_0x503ce5[_0x1c0104(0x121)](_0x2ce2b6['id'],_0xb98d12);});})())]),{emailToId:_0x3e2a7c,idToEmail:_0x51a4f4}=_0x1825ab,_0x7db405=buildConnectionMaps(_0x21662f);return{'rootFolderId':_0x325dc3,'folderPathToId':_0x46d690,'folderIdToPath':_0x51b8e8,'segmentNameToId':_0x3805cd,'activationsBySegmentId':_0x503ce5,'emailToIdMap':_0x3e2a7c,'idToEmailMap':_0x51a4f4,'connectionNameToIdMap':_0x7db405['nameToId'],'connectionIdToNameMap':_0x7db405[_0x435aec(0x1a8)],'connectionNameToTypeMap':_0x7db405[_0x435aec(0x138)]};}export function createPushYamlContextForBundle(_0x3701ea,_0x37ddf4,_0x56d552,_0x8edb03,_0x212174,_0x256af4,_0x3d99fc,_0x56a992){const {existingLocalSegmentNames:_0x433baa,localExpandedRuleToNames:_0x1cefe6}=_0x8edb03,_0x1d3bb8=new Set(),_0x1bc4fd=new Map(),_0x130185=new Map(),_0x799b77=new Map(),_0x321894=createJumpTargetCache(),_0x3a997b=new Map(),_0x3be5a4=new Map(),_0x31ea35=new Set();let _0x426d1e;const _0x234841=_0x316e7c=>{const _0x25fffd={'resolveSegment':async _0x44d1ff=>{const _0x2b8881=a152_0x576d,_0x3e9286=_0x799b77[_0x2b8881(0x183)](_0x44d1ff);if(_0x3e9286!==undefined)return{'name':_0x3e9286,'isJourneyLocal':!![]};try{const _0x1b0e16=await fetchSegment(_0x3701ea,_0x37ddf4,_0x44d1ff,_0x56d552);if(!_0x1b0e16)throw new Error(_0x2b8881(0x1dc));const _0x4b42a1=generateJourneyLocalName(_0x1b0e16[_0x2b8881(0x1aa)]),_0x42b440=_0x1b0e16[_0x2b8881(0x151)]===SEGMENT_KIND_JOURNEY&&_0x4b42a1!==undefined;let _0x2e5aa9=_0x1b0e16[_0x2b8881(0x1aa)],_0x48d567;if(_0x42b440&&_0x1b0e16[_0x2b8881(0x1c8)]){const _0x2e7c51=apiRuleToYaml(_0x1b0e16[_0x2b8881(0x1c8)]);_0x3be5a4['set'](_0x44d1ff,_0x2e7c51);const _0x2c902d=async _0x198e77=>{const _0x479650=_0x2b8881,_0x5e1d68=collectSegmentRefsFromRule(_0x198e77);for(const _0x13a423 of _0x5e1d68){if(!_0x3be5a4[_0x479650(0x122)](_0x13a423))try{const _0x3f68b3=await fetchSegment(_0x3701ea,_0x37ddf4,_0x13a423,_0x56d552);if(_0x3f68b3?.[_0x479650(0x1c8)]){const _0x561ec1=apiRuleToYaml(_0x3f68b3[_0x479650(0x1c8)]);_0x3be5a4[_0x479650(0x121)](_0x13a423,_0x561ec1),await _0x2c902d(_0x561ec1);}}catch(_0x4d5a9b){logger[_0x479650(0x1e2)]('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0x13a423+':\x20'+_0x4d5a9b);}}};await _0x2c902d(_0x2e7c51);const _0x1d8e2d=serializeExpandedRule(_0x2e7c51,_0x3be5a4),_0x4194f0=_0x1cefe6[_0x2b8881(0x183)](_0x1d8e2d);if(_0x4194f0&&_0x4194f0[_0x2b8881(0x124)]>0x0){const _0x58725b=_0x1bc4fd[_0x2b8881(0x183)](_0x1d8e2d)||0x0,_0x20ccee=_0x4194f0[_0x58725b]||_0x4194f0[_0x4194f0['length']-0x1];_0x1bc4fd['set'](_0x1d8e2d,_0x58725b+0x1),_0x2e5aa9=_0x20ccee,_0x1d3bb8['add'](_0x2e5aa9),_0x799b77[_0x2b8881(0x121)](_0x44d1ff,_0x2e5aa9);const _0x8ca1d8=await resolveRuleSegmentRefs(_0x2e7c51,async _0x5ceab4=>{const _0x56e75e=_0x2b8881,_0xae8d52=_0x799b77['get'](_0x5ceab4);if(_0xae8d52)return _0xae8d52;const _0x157c2e=await _0x426d1e[_0x56e75e(0x137)](_0x5ceab4);return _0x157c2e[_0x56e75e(0x1aa)];});_0x48d567={'description':_0x1b0e16['description'],'rule':_0x8ca1d8};}else{const _0x5b29b5=_0x3a997b[_0x2b8881(0x183)](_0x1d8e2d);if(_0x5b29b5)_0x2e5aa9=_0x5b29b5,_0x799b77['set'](_0x44d1ff,_0x2e5aa9);else{if(_0x4b42a1){let _0x385239=_0x4b42a1,_0x1d2a44=0x2;while(_0x1d3bb8[_0x2b8881(0x122)](_0x385239)||_0x433baa[_0x2b8881(0x122)](_0x385239)){_0x385239=_0x4b42a1+'_'+_0x1d2a44,_0x1d2a44++;}_0x1d3bb8[_0x2b8881(0x1eb)](_0x385239),_0x2e5aa9=_0x385239;}_0x799b77[_0x2b8881(0x121)](_0x44d1ff,_0x2e5aa9),_0x3a997b[_0x2b8881(0x121)](_0x1d8e2d,_0x2e5aa9);const _0x2650e7=await resolveRuleSegmentRefs(_0x2e7c51,async _0x59ecf3=>{const _0x4092d3=_0x2b8881,_0x3f829e=_0x799b77[_0x4092d3(0x183)](_0x59ecf3);if(_0x3f829e)return _0x3f829e;const _0x424c35=await _0x426d1e[_0x4092d3(0x137)](_0x59ecf3);return _0x424c35[_0x4092d3(0x1aa)];});_0x48d567={'description':_0x1b0e16[_0x2b8881(0x19e)],'rule':_0x2650e7};}}}return{'name':_0x2e5aa9,'isJourneyLocal':_0x42b440,'definition':_0x48d567};}catch(_0x39e3c0){return logger[_0x2b8881(0x1e2)](_0x2b8881(0x12a)+_0x44d1ff+':\x20'+_0x39e3c0),{'name':_0x44d1ff,'isJourneyLocal':![]};}},'resolveActivation':async _0xb13841=>{const _0x62db9b=a152_0x576d,_0x4570c5=_0x130185[_0x62db9b(0x183)](_0xb13841);if(_0x4570c5!==undefined)return{'name':_0x4570c5,'isJourneyLocal':!![]};try{let _0x1be311=_0x3d99fc?.[_0x62db9b(0x183)](_0xb13841);!_0x1be311&&(_0x1be311=await _0x3701ea[_0x62db9b(0x157)][_0x62db9b(0xff)](_0x316e7c,_0xb13841));const _0x43477d=_0x1be311[_0x62db9b(0x128)]['activationParams'][_0x62db9b(0x1aa)]||_0xb13841,_0x12299e=sanitizeYamlKey(_0x43477d)||_0x62db9b(0xfb)+_0xb13841,_0x371c90=_0x12299e;_0x130185[_0x62db9b(0x121)](_0xb13841,_0x371c90);const _0x174e7e=journeyActivationStepToYaml(_0x1be311,_0x212174,_0x256af4);return{'name':_0x371c90,'isJourneyLocal':!![],'definition':_0x174e7e};}catch(_0x2f8bdd){return logger[_0x62db9b(0x1e2)]('Failed\x20to\x20resolve\x20activation\x20'+_0xb13841+':\x20'+_0x2f8bdd),{'name':_0xb13841,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x307392,_0x185450)=>resolveJumpTarget(_0x307392,_0x185450,_0x321894,async _0x2674d4=>{const _0x189526=a152_0x576d,_0x3a5ea9=_0x56a992?.['get'](_0x2674d4);if(_0x3a5ea9)return _0x3a5ea9;return _0x3701ea[_0x189526(0x157)]['getJourney'](_0x2674d4);})};return _0x426d1e=_0x25fffd,_0x25fffd;},_0xe7a3d7=async _0x287e6c=>{const _0x408afe=a152_0x576d,{collectSegmentIdsFromJourneyApi:_0x3fc4e6}=await import(_0x408afe(0x115)),{batchAsync:_0x56737c}=await import(_0x408afe(0x105)),_0x1f33d6=new Set();for(const _0xd9fbcd of _0x287e6c){let _0x3eb974=_0x56a992?.[_0x408afe(0x183)](_0xd9fbcd);!_0x3eb974&&(_0x3eb974=await _0x3701ea[_0x408afe(0x157)][_0x408afe(0x1da)](_0xd9fbcd));const _0x5a663f=_0x3fc4e6(_0x3eb974);for(const _0x327069 of _0x5a663f){_0x1f33d6['add'](_0x327069);}}let _0xe0d182=Array[_0x408afe(0x169)](_0x1f33d6);while(_0xe0d182['length']>0x0){const _0x31e258=_0xe0d182[_0x408afe(0x167)](_0x57213b=>!_0x31ea35[_0x408afe(0x122)](_0x57213b));if(_0x31e258[_0x408afe(0x124)]===0x0)break;const _0x41ef60=await _0x56737c(_0x31e258,async _0x46e7ee=>{const _0x2d98ce=_0x408afe;_0x31ea35[_0x2d98ce(0x1eb)](_0x46e7ee);const _0x1300fd=await fetchSegment(_0x3701ea,_0x37ddf4,_0x46e7ee,_0x56d552);if(!_0x1300fd)return null;return{'segmentId':_0x46e7ee,'segment':_0x1300fd};},0xa),_0x849305=new Set();for(const _0x5960ee of _0x41ef60){if(!_0x5960ee?.[_0x408afe(0x1f0)]?.[_0x408afe(0x1c8)])continue;const _0x23991e=apiRuleToYaml(_0x5960ee[_0x408afe(0x1f0)][_0x408afe(0x1c8)]);_0x3be5a4[_0x408afe(0x121)](_0x5960ee[_0x408afe(0x174)],_0x23991e);const _0x519eb1=collectSegmentRefsFromRule(_0x23991e);for(const _0x7e2792 of _0x519eb1){!_0x31ea35['has'](_0x7e2792)&&_0x849305[_0x408afe(0x1eb)](_0x7e2792);}}_0xe0d182=Array['from'](_0x849305);}};return{'createYamlContext':_0x234841,'prefetchJourneySegments':_0xe7a3d7};}export async function executePushSegments(_0x4dbe95,_0x30d5cb,_0xb8f91b,_0x246f00,_0x32f4fe){const _0x5ea110=a152_0x1444f9,{segmentDefToCreateRequest:_0x1269bf,segmentDefToUpdateRequest:_0x3d9640}=await import(_0x5ea110(0x133)),_0x3b9f4a=_0xb8f91b[_0x5ea110(0x1fd)],_0x1eb354=0x5,_0x3d0caa=async _0x4cd757=>{const _0x480447=_0x5ea110,_0x378244=_0x4cd757[_0x480447(0x161)]?_0x3b9f4a['get'](_0x4cd757['folderPath']):undefined;let _0x532d3c;const _0x122aba={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x3e8a62=_0x4cd757['yamlConfig'];if(_0x4cd757['yamlConfig'][_0x480447(0x1c8)]){const _0xca2077=createSegmentIdResolver(_0xb8f91b[_0x480447(0x1b6)],_0x4cd757['yamlConfig'][_0x480447(0x1aa)]),_0x3235ef=await resolveRuleSegmentIds(_0x4cd757[_0x480447(0x199)]['rule'],_0xca2077);_0x3e8a62={..._0x4cd757[_0x480447(0x199)],'rule':_0x3235ef};}try{if(_0x4cd757[_0x480447(0x1a9)]){_0x32f4fe[_0x480447(0x1b0)]?.({'type':_0x480447(0x12f),'name':_0x4cd757['yamlConfig'][_0x480447(0x1aa)]});const _0x4a97ed=_0x1269bf(_0x3e8a62,_0x378244),_0x1b5f01=await _0x32f4fe[_0x480447(0x1ae)](_0x480447(0x163)+_0x4cd757['yamlConfig'][_0x480447(0x1aa)]+_0x480447(0x179),()=>_0x4dbe95[_0x480447(0x1f0)][_0x480447(0x17f)](_0x246f00[_0x480447(0x14f)],_0x4a97ed));_0x532d3c=_0x1b5f01[_0x480447(0x18c)]['id'],_0xb8f91b[_0x480447(0x1b6)][_0x480447(0x121)](_0x4cd757[_0x480447(0x199)][_0x480447(0x1aa)],_0x532d3c),_0x122aba[_0x480447(0x119)]={'name':_0x4cd757['yamlConfig'][_0x480447(0x1aa)],'id':_0x532d3c},_0x32f4fe['onProgress']?.({'type':_0x480447(0x1a3),'name':_0x4cd757[_0x480447(0x199)]['name'],'segmentId':_0x532d3c}),_0x32f4fe[_0x480447(0x1fc)]?.(_0x480447(0xfe)+_0x4cd757['yamlConfig'][_0x480447(0x1aa)]+'\x27'),_0x122aba['created']=0x1;}else{if(_0x4cd757[_0x480447(0x147)]){_0x32f4fe[_0x480447(0x1b0)]?.({'type':'segment_updating','name':_0x4cd757[_0x480447(0x199)]['name']});const _0x424114=_0x3d9640(_0x3e8a62);_0x378244!==_0x4cd757[_0x480447(0x1ab)]?.[_0x480447(0x100)]&&(_0x424114[_0x480447(0x100)]=_0x378244?parseInt(_0x378244,0xa):undefined),await _0x32f4fe[_0x480447(0x1ae)](_0x480447(0x16b)+_0x4cd757[_0x480447(0x199)][_0x480447(0x1aa)]+_0x480447(0x179),()=>_0x4dbe95['segment'][_0x480447(0x1a0)](_0x246f00[_0x480447(0x14f)],_0x4cd757['existingSegment']['id'],_0x424114)),_0x532d3c=_0x4cd757[_0x480447(0x1ab)]['id'],_0x32f4fe['onProgress']?.({'type':'segment_updated','name':_0x4cd757[_0x480447(0x199)][_0x480447(0x1aa)]}),_0x32f4fe[_0x480447(0x1fc)]?.(_0x480447(0x1b5)+_0x4cd757['yamlConfig'][_0x480447(0x1aa)]+'\x27'),_0x122aba[_0x480447(0x13c)]=0x1;}else _0x532d3c=_0x4cd757[_0x480447(0x1ab)]['id'];}}catch(_0x1cd46e){const _0x4469ff=isHttp400Error(_0x1cd46e),_0x518741=_0x4469ff?ErrorCode[_0x480447(0x198)]:ErrorCode[_0x480447(0x123)],_0x591ebf=getErrorMessage(_0x1cd46e);throw new SDKError(_0x518741,_0x480447(0x19d)+(_0x4cd757[_0x480447(0x1a9)]?_0x480447(0x17e):_0x480447(0x172))+_0x480447(0x1b9)+_0x4cd757[_0x480447(0x17c)]+_0x480447(0x196)+_0x591ebf,_0x1cd46e);}try{const _0x2b6473=await syncActivationsForSegment(_0x4dbe95,_0x246f00[_0x480447(0x14f)],_0x532d3c,_0x4cd757[_0x480447(0x199)][_0x480447(0x1aa)],_0x4cd757[_0x480447(0x186)],_0x32f4fe,_0x4cd757['absolutePath']);_0x122aba[_0x480447(0x16e)]=_0x2b6473;}catch(_0x5e8dea){if(_0x5e8dea instanceof SDKError)throw _0x5e8dea;throw new SDKError(ErrorCode[_0x480447(0x12d)],_0x480447(0x10f)+_0x4cd757[_0x480447(0x199)]['name']+_0x480447(0x132)+_0x4cd757['absolutePath']+_0x480447(0x196)+getErrorMessage(_0x5e8dea),_0x5e8dea);}return _0x122aba;},_0x42507a=await batchAsync(_0x30d5cb,_0x3d0caa,_0x1eb354),_0x2b67e8={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x2424f3 of _0x42507a){_0x2b67e8[_0x5ea110(0x1fe)]+=_0x2424f3['created'],_0x2b67e8[_0x5ea110(0x13c)]+=_0x2424f3['updated'],_0x2424f3[_0x5ea110(0x119)]&&_0x2b67e8[_0x5ea110(0x170)]['set'](_0x2424f3['createdSegmentId'][_0x5ea110(0x1aa)],_0x2424f3[_0x5ea110(0x119)]['id']),_0x2b67e8['activations']['created']+=_0x2424f3[_0x5ea110(0x16e)][_0x5ea110(0x1fe)],_0x2b67e8[_0x5ea110(0x16e)][_0x5ea110(0x13c)]+=_0x2424f3['activations'][_0x5ea110(0x13c)],_0x2b67e8[_0x5ea110(0x16e)]['deleted']+=_0x2424f3[_0x5ea110(0x16e)][_0x5ea110(0x15c)];}return _0x2b67e8;}async function syncActivationsForSegment(_0x539542,_0x3e0a15,_0x2cac77,_0x860588,_0x4dab61,_0x585dab,_0x1be1d6){const _0xe0098d=a152_0x1444f9,_0x28b38b={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x2234ee of _0x4dab61){try{if(_0x2234ee[_0xe0098d(0x158)]==='create'&&_0x2234ee['validatedRequest'])_0x585dab[_0xe0098d(0x1b0)]?.({'type':_0xe0098d(0x1b2),'segmentName':_0x860588,'activationName':_0x2234ee[_0xe0098d(0x1aa)]}),await _0x585dab['withProgress'](_0xe0098d(0x10d)+_0x2234ee[_0xe0098d(0x1aa)]+'\x27...',()=>_0x539542['segment']['createActivation'](_0x3e0a15,_0x2cac77,_0x2234ee['validatedRequest'])),_0x585dab[_0xe0098d(0x1b0)]?.({'type':_0xe0098d(0x1ed),'segmentName':_0x860588,'activationName':_0x2234ee[_0xe0098d(0x1aa)]}),_0x585dab['logSuccess']?.(_0xe0098d(0x1cc)+_0x2234ee[_0xe0098d(0x1aa)]+'\x27'),_0x28b38b[_0xe0098d(0x1fe)]++;else{if(_0x2234ee[_0xe0098d(0x158)]==='update'&&_0x2234ee[_0xe0098d(0x1ba)]&&_0x2234ee[_0xe0098d(0x15b)])_0x585dab[_0xe0098d(0x1b0)]?.({'type':_0xe0098d(0x1e6),'segmentName':_0x860588,'activationName':_0x2234ee[_0xe0098d(0x1aa)]}),await _0x585dab[_0xe0098d(0x1ae)](_0xe0098d(0x1ad)+_0x2234ee['name']+_0xe0098d(0x179),()=>_0x539542[_0xe0098d(0x1f0)][_0xe0098d(0x1d9)](_0x3e0a15,_0x2cac77,_0x2234ee[_0xe0098d(0x15b)]['id'],_0x2234ee['validatedRequest'])),_0x585dab[_0xe0098d(0x1b0)]?.({'type':'activation_updated','segmentName':_0x860588,'activationName':_0x2234ee[_0xe0098d(0x1aa)]}),_0x585dab['logSuccess']?.(_0xe0098d(0x110)+_0x2234ee[_0xe0098d(0x1aa)]+'\x27'),_0x28b38b[_0xe0098d(0x13c)]++;else _0x2234ee[_0xe0098d(0x158)]==='delete'&&_0x2234ee[_0xe0098d(0x15b)]&&(_0x585dab[_0xe0098d(0x1b0)]?.({'type':_0xe0098d(0x11b),'segmentName':_0x860588,'activationName':_0x2234ee[_0xe0098d(0x1aa)]}),await _0x585dab[_0xe0098d(0x1ae)](_0xe0098d(0x116)+_0x2234ee['name']+'\x27...',()=>_0x539542[_0xe0098d(0x1f0)][_0xe0098d(0x145)](_0x3e0a15,_0x2cac77,_0x2234ee[_0xe0098d(0x15b)]['id'])),_0x585dab[_0xe0098d(0x1b0)]?.({'type':_0xe0098d(0x13a),'segmentName':_0x860588,'activationName':_0x2234ee[_0xe0098d(0x1aa)]}),_0x585dab[_0xe0098d(0x1f5)]?.('Deleted\x20activation\x20\x27'+_0x2234ee[_0xe0098d(0x1aa)]+'\x27'),_0x28b38b[_0xe0098d(0x15c)]++);}}catch(_0x298f2b){const _0x34e844=isHttp400Error(_0x298f2b),_0x51dec5=_0x34e844?ErrorCode[_0xe0098d(0x171)]:ErrorCode[_0xe0098d(0x12d)],_0x216b09=getErrorMessage(_0x298f2b);throw new SDKError(_0x51dec5,_0xe0098d(0x19d)+_0x2234ee[_0xe0098d(0x158)]+_0xe0098d(0x15d)+_0x2234ee[_0xe0098d(0x1aa)]+'\x27\x20from\x20file:\x20'+_0x1be1d6+_0xe0098d(0x196)+_0x216b09,_0x298f2b);}}return _0x28b38b;}export async function executePushFolders(_0x2c1732,_0x31e0e6,_0x2e9207,_0x50d434,_0x2415ad){const _0x12178c=a152_0x1444f9,_0x5c944c=new Map(_0x2e9207),_0x5297fa=sortFoldersByDepth(_0x31e0e6);for(const _0x1eefa7 of _0x5297fa){const _0x349205=_0x1eefa7[_0x12178c(0x191)]('/'),_0x45d284=_0x349205[_0x349205[_0x12178c(0x124)]-0x1],_0x1a0ca8=_0x349205['slice'](0x0,-0x1)[_0x12178c(0x1e4)]('/'),_0x464574=_0x5c944c['get'](_0x1a0ca8);_0x2415ad[_0x12178c(0x1b0)]?.({'type':_0x12178c(0x1df),'folder':_0x1eefa7});const _0x42bb5e={'name':_0x45d284,'parentFolderId':_0x464574},_0x322338=await _0x2415ad[_0x12178c(0x1ae)]('Creating\x20folder\x20\x27'+_0x1eefa7+'\x27...',()=>_0x2c1732[_0x12178c(0x1f0)]['createFolder'](_0x50d434[_0x12178c(0x14f)],_0x42bb5e));_0x5c944c[_0x12178c(0x121)](_0x1eefa7,_0x322338[_0x12178c(0x18c)]['id']),_0x2415ad['onProgress']?.({'type':_0x12178c(0x18a),'folder':_0x1eefa7,'folderId':_0x322338[_0x12178c(0x18c)]['id']}),_0x2415ad[_0x12178c(0x1bf)]?.(_0x12178c(0xf9)+_0x1eefa7+'\x27');}return _0x5c944c;}export async function executePushSegmentDeletions(_0xe1dd90,_0x3431b5,_0x388a68){const _0x4773b8=a152_0x1444f9;if(_0x3431b5[_0x4773b8(0x124)]===0x0)return 0x0;const {batchAsync:_0x1b45f2}=await import(_0x4773b8(0x105)),_0x1dd6e3=0x5,_0x4af7d7=await _0x1b45f2(_0x3431b5,async _0x8ddc9b=>{const _0x514843=_0x4773b8;return _0x388a68['onProgress']?.({'type':_0x514843(0x18f),'name':_0x8ddc9b[_0x514843(0x1aa)]}),await _0xe1dd90[_0x514843(0x1f0)][_0x514843(0x131)](_0x8ddc9b['id']),_0x388a68['onProgress']?.({'type':_0x514843(0x19a),'name':_0x8ddc9b[_0x514843(0x1aa)]}),_0x388a68[_0x514843(0x1f5)]?.(_0x514843(0x1cb)+_0x8ddc9b[_0x514843(0x1aa)]+'\x27'),0x1;},_0x1dd6e3);return _0x4af7d7[_0x4773b8(0x1ee)]((_0x28cc19,_0x58b095)=>_0x28cc19+_0x58b095,0x0);}export async function executePushJourneys(_0x1f0daa,_0x158de3,_0x191b64,_0x39fa22,_0x40e581){const _0x8fdcb2=a152_0x1444f9,{journeyDefToRequest:_0x3aea02}=await import(_0x8fdcb2(0x115)),{activationDefToCreateRequest:_0x1ada08,yamlRuleToApi:_0x400a0d,validateSegmentRule:_0x3f662e}=await import(_0x8fdcb2(0x133)),_0x29b0cb={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x34161a=new Map(_0x191b64[_0x8fdcb2(0x1b6)]),_0x1a92b5=0x5;for(let _0x5093ca=0x0;_0x5093ca<_0x158de3[_0x8fdcb2(0x124)];_0x5093ca+=_0x1a92b5){const _0x1df6ab=_0x158de3['slice'](_0x5093ca,_0x5093ca+_0x1a92b5),_0x1193f3=await Promise[_0x8fdcb2(0x159)](_0x1df6ab[_0x8fdcb2(0x136)](async _0x2aefc0=>{const _0xeb07bb=_0x8fdcb2;if(!_0x2aefc0[_0xeb07bb(0x1a9)]&&!_0x2aefc0[_0xeb07bb(0x147)])return{'action':'unchanged','name':_0x2aefc0[_0xeb07bb(0x199)][_0xeb07bb(0x1aa)],'journeyId':_0x2aefc0[_0xeb07bb(0x175)]?.['id']};const _0x2c129a=_0x2aefc0[_0xeb07bb(0x161)]?_0x191b64[_0xeb07bb(0x1fd)][_0xeb07bb(0x183)](_0x2aefc0[_0xeb07bb(0x161)]):undefined;_0x40e581[_0xeb07bb(0x1b0)]?.({'type':_0x2aefc0[_0xeb07bb(0x1a9)]?_0xeb07bb(0xf6):'journey_updating','name':_0x2aefc0['yamlConfig'][_0xeb07bb(0x1aa)]});try{const _0x335a1b=await executeSingleJourneyPush(_0x1f0daa,_0x2aefc0,{..._0x191b64,'segmentNameToId':_0x34161a},{'parentId':_0x39fa22[_0xeb07bb(0x14f)],'rootFolderId':_0x39fa22[_0xeb07bb(0x1f1)],'folderId':_0x2c129a,'verbose':_0x39fa22[_0xeb07bb(0x1d0)]},_0x40e581,{'journeyDefToRequest':_0x3aea02,'activationDefToCreateRequest':_0x1ada08,'yamlRuleToApi':_0x400a0d,'validateSegmentRule':_0x3f662e});for(const [_0x5de16c,_0x116b0c]of _0x335a1b['embeddedSegmentNameToId']){_0x34161a[_0xeb07bb(0x121)](_0x5de16c,_0x116b0c),_0x29b0cb['embeddedSegmentNameToId'][_0xeb07bb(0x121)](_0x5de16c,_0x116b0c);}if(_0x335a1b['action']==='created')_0x40e581['onProgress']?.({'type':_0xeb07bb(0x14c),'name':_0x2aefc0[_0xeb07bb(0x199)][_0xeb07bb(0x1aa)],'journeyId':_0x335a1b[_0xeb07bb(0x1e0)]}),_0x40e581['logSuccess']?.(_0xeb07bb(0x156)+_0x2aefc0[_0xeb07bb(0x199)][_0xeb07bb(0x1aa)]+'\x27'),_0x29b0cb[_0xeb07bb(0x1fe)]++;else _0x335a1b['action']===_0xeb07bb(0x13c)&&(_0x40e581[_0xeb07bb(0x1b0)]?.({'type':_0xeb07bb(0x1d7),'name':_0x2aefc0[_0xeb07bb(0x199)][_0xeb07bb(0x1aa)]}),_0x40e581[_0xeb07bb(0x1fc)]?.('Updated\x20journey\x20\x27'+_0x2aefc0[_0xeb07bb(0x199)][_0xeb07bb(0x1aa)]+'\x27'),_0x29b0cb[_0xeb07bb(0x13c)]++);return{'action':_0x335a1b[_0xeb07bb(0x10b)],'name':_0x2aefc0['yamlConfig']['name'],'journeyId':_0x335a1b[_0xeb07bb(0x1e0)]};}catch(_0x232f2f){const _0x15b4df=isHttp400Error(_0x232f2f),_0x282b63=_0x15b4df?ErrorCode[_0xeb07bb(0xfc)]:ErrorCode[_0xeb07bb(0x188)],_0x59e1e1=getErrorMessage(_0x232f2f);throw new SDKError(_0x282b63,_0xeb07bb(0x19d)+(_0x2aefc0[_0xeb07bb(0x1a9)]?_0xeb07bb(0x17e):_0xeb07bb(0x172))+_0xeb07bb(0x1a4)+_0x2aefc0['absolutePath']+_0xeb07bb(0x196)+_0x59e1e1,_0x232f2f);}}));_0x29b0cb[_0x8fdcb2(0x177)]['push'](..._0x1193f3);}return _0x29b0cb;}async function matchExistingJourneySegments(_0x51ed82,_0x59a6e1,_0x227576,_0x47d6c6,_0x4e0761){const _0x8f1bc4=a152_0x1444f9;if(!_0x59a6e1[_0x8f1bc4(0x175)]||!_0x59a6e1[_0x8f1bc4(0x199)][_0x8f1bc4(0x144)])return;const _0x263f15=new Map(),_0x4868c4=new Set();for(const _0x4d8f3d of Object[_0x8f1bc4(0x102)](_0x59a6e1[_0x8f1bc4(0x199)]['segments'])){const _0x5759f4=generateDeterministicJourneySegmentName(_0x59a6e1[_0x8f1bc4(0x199)][_0x8f1bc4(0x1aa)],_0x4d8f3d);_0x263f15[_0x8f1bc4(0x121)](_0x5759f4,_0x4d8f3d),_0x4868c4[_0x8f1bc4(0x1eb)](_0x4d8f3d);}const _0x5021ba=[],_0x1490f4=collectSegmentIdsFromJourneyApi(_0x59a6e1['existingJourney']);for(const _0x52d509 of _0x1490f4){const _0x247413=await fetchSegment(_0x51ed82,_0x227576,_0x52d509,_0x47d6c6);if(!_0x247413?.[_0x8f1bc4(0x1aa)])continue;const _0x1e7538=_0x263f15[_0x8f1bc4(0x183)](_0x247413['name']);_0x1e7538?(_0x4e0761[_0x8f1bc4(0x121)](_0x1e7538,_0x52d509),_0x4868c4['delete'](_0x1e7538)):_0x5021ba[_0x8f1bc4(0x141)]({'id':_0x52d509,'seg':_0x247413});}if(_0x4868c4['size']>0x0&&_0x5021ba[_0x8f1bc4(0x124)]>0x0){const {localExpandedRuleToNames:_0xd0a8f7}=buildLocalExpandedRuleMappings(_0x59a6e1[_0x8f1bc4(0x199)]),_0x537e16=new Map();for(const {id:_0x2a51bf,seg:_0x568969}of _0x5021ba){if(_0x568969[_0x8f1bc4(0x1c8)]){const _0x535419=apiRuleToYaml(_0x568969[_0x8f1bc4(0x1c8)]);_0x537e16[_0x8f1bc4(0x121)](_0x2a51bf,_0x535419);}}for(const {id:_0x48cb6f,seg:_0x39165c}of _0x5021ba){if(!_0x39165c[_0x8f1bc4(0x1c8)])continue;const _0x2b6231=_0x537e16['get'](_0x48cb6f);if(!_0x2b6231)continue;const _0x2abc07=serializeExpandedRule(_0x2b6231,_0x537e16),_0x52c76e=_0xd0a8f7[_0x8f1bc4(0x183)](_0x2abc07);if(_0x52c76e){const _0x118ef8=_0x52c76e[_0x8f1bc4(0x176)](_0x29b650=>_0x4868c4[_0x8f1bc4(0x122)](_0x29b650));_0x118ef8&&(_0x4e0761['set'](_0x118ef8,_0x48cb6f),_0x4868c4[_0x8f1bc4(0x165)](_0x118ef8),logger[_0x8f1bc4(0x1e2)]('Matched\x20server\x20segment\x20\x27'+_0x39165c[_0x8f1bc4(0x1aa)]+_0x8f1bc4(0x1ff)+_0x118ef8+_0x8f1bc4(0x142)));}}}}async function executeSingleJourneyPush(_0x39f45b,_0x55b7d6,_0xe51bf5,_0x26a3f3,_0x2e9e7a,_0x1c3b1e){const _0x39d96a=a152_0x1444f9,{journeyDefToRequest:_0x5e80da,activationDefToCreateRequest:_0x585b5f,yamlRuleToApi:_0x29f6a1,validateSegmentRule:_0x57bab1}=_0x1c3b1e,_0x2cabaa=new Map(),_0x40dc68=new Map();recoverSegmentIdsFromPushRecovery(_0x55b7d6,_0x2cabaa,_0xe51bf5['segmentNameToId']);const _0x7ad242=new Map(),_0x34d20c=new Map(),_0x2d441d=new Map();let _0x152a57;const _0x1b9742=async()=>{const _0x5337cf=a152_0x576d;if(_0x152a57)return;_0x152a57=new Map();if(!_0x55b7d6[_0x5337cf(0x175)])return;const _0x257ca4=await _0x39f45b[_0x5337cf(0x157)][_0x5337cf(0x1c6)](_0x55b7d6[_0x5337cf(0x175)]['id']);for(const _0x3a8690 of _0x257ca4){const _0x35821f=journeyActivationStepToYaml(_0x3a8690,_0xe51bf5[_0x5337cf(0x181)],_0xe51bf5['connectionIdToNameMap']),_0x354d7e=activationSignature(_0x35821f);!_0x152a57['has'](_0x354d7e)&&_0x152a57[_0x5337cf(0x121)](_0x354d7e,_0x3a8690['id']),_0x35821f[_0x5337cf(0x1aa)]&&_0x40dc68['set'](_0x35821f[_0x5337cf(0x1aa)],_0x3a8690['id']);}};await matchExistingJourneySegments(_0x39f45b,_0x55b7d6,_0x26a3f3['parentId'],_0xe51bf5[_0x39d96a(0x18b)],_0xe51bf5[_0x39d96a(0x1b6)]);const _0x4c107={'resolveSegmentId':async _0xbfa3cb=>{const _0x5b432e=_0x39d96a,_0x1097fe=_0xe51bf5['segmentNameToId'][_0x5b432e(0x183)](_0xbfa3cb);if(!_0x1097fe)throw new SDKError(ErrorCode[_0x5b432e(0x1f4)],_0x5b432e(0x1e3)+_0xbfa3cb+_0x5b432e(0x15e)+_0x55b7d6[_0x5b432e(0x199)][_0x5b432e(0x1aa)]+')');return _0x1097fe;},'resolveEmbeddedSegmentId':async(_0x420482,_0x2bfaa3)=>{const _0xf12393=_0x39d96a,_0x5a1864=_0xe51bf5[_0xf12393(0x1b6)][_0xf12393(0x183)](_0x420482);if(_0x5a1864)return _0x5a1864;const _0x5775ab=_0xe51bf5[_0xf12393(0x18b)][_0xf12393(0x176)](_0x2c1f23=>_0x2c1f23[_0xf12393(0x1aa)]===_0x420482);if(_0x5775ab)return _0xe51bf5[_0xf12393(0x1b6)][_0xf12393(0x121)](_0x420482,_0x5775ab['id']),_0x5775ab['id'];if(_0x55b7d6[_0xf12393(0x1a9)]){const {stageName:_0x5a1ae4,criteriaName:_0x1865d9}=findSegmentCriteriaLocation(_0x55b7d6[_0xf12393(0x199)],_0x420482);return _0x57bab1(_0x420482,_0x2bfaa3['rule']),_0x34d20c['set'](_0x420482,{'definition':_0x2bfaa3,'stageName':_0x5a1ae4,'criteriaName':_0x1865d9}),createPendingSegmentId(_0x420482);}const _0x40aa86=_0x55b7d6[_0xf12393(0x175)]?.['id'];if(!_0x40aa86)throw new SDKError(ErrorCode['INTERNAL'],_0xf12393(0x1d3));const _0x23ce56=_0x7ad242[_0xf12393(0x183)](_0x420482);if(_0x23ce56)return _0x23ce56;const _0x56d54e=((async()=>{const _0x47eb38=_0xf12393;_0x57bab1(_0x420482,_0x2bfaa3['rule']);const _0x46f52d=generateDeterministicJourneySegmentName(_0x55b7d6['yamlConfig'][_0x47eb38(0x1aa)],_0x420482),_0xc4c568=_0xe51bf5['existingSegments']['find'](_0x34b71a=>_0x34b71a[_0x47eb38(0x1aa)]===_0x46f52d),_0x41497a=createSegmentIdResolver(_0xe51bf5[_0x47eb38(0x1b6)],_0x420482),_0x260c32=await resolveRuleSegmentIds(_0x2bfaa3[_0x47eb38(0x1c8)],_0x41497a);let _0x8fcd7d;return _0xc4c568?(await _0x39f45b['segment']['updateSegmentById'](_0x26a3f3[_0x47eb38(0x14f)],_0xc4c568['id'],{'description':_0x2bfaa3[_0x47eb38(0x19e)]||_0x47eb38(0xfa)+_0x420482,'rule':_0x29f6a1(_0x260c32),'countPopulation':!![]}),_0x8fcd7d=_0xc4c568['id'],saveSegmentToPushRecovery(_0x55b7d6[_0x47eb38(0x17c)],_0x55b7d6[_0x47eb38(0x199)][_0x47eb38(0x1aa)],_0x420482,{'segmentId':_0x8fcd7d,'uniqueServerName':_0x46f52d,'createdAt':new Date()['toISOString']()})):_0x8fcd7d=await createOrRecoverEmbeddedSegment(_0x39f45b,_0x55b7d6,{'localName':_0x420482,'uniqueSegmentName':_0x46f52d,'description':_0x2bfaa3['description']||_0x47eb38(0xfa)+_0x420482,'journeyId':_0x40aa86,'resolvedRule':_0x260c32,'parentId':_0x26a3f3['parentId'],'folderId':_0x26a3f3[_0x47eb38(0x1f1)]||''},_0x29f6a1),_0xe51bf5[_0x47eb38(0x1b6)][_0x47eb38(0x121)](_0x420482,_0x8fcd7d),_0x2cabaa[_0x47eb38(0x121)](_0x420482,_0x8fcd7d),_0x8fcd7d;})());_0x7ad242[_0xf12393(0x121)](_0x420482,_0x56d54e);try{return await _0x56d54e;}finally{_0x7ad242[_0xf12393(0x165)](_0x420482);}},'resolveActivationId':async _0x7e6413=>{const _0x219f30=_0x39d96a,_0x4a766f=_0x40dc68[_0x219f30(0x183)](_0x7e6413);if(_0x4a766f)return _0x4a766f;if(_0x55b7d6[_0x219f30(0x175)]){await _0x1b9742();const _0x4bd11f=_0x40dc68[_0x219f30(0x183)](_0x7e6413);if(_0x4bd11f)return _0x4bd11f;}throw new SDKError(ErrorCode['NOT_FOUND'],'Activation\x20not\x20found:\x20'+_0x7e6413+_0x219f30(0x15e)+_0x55b7d6['yamlConfig']['name']+_0x219f30(0x1c5)+_0x219f30(0x1db));},'resolveEmbeddedActivationId':async(_0xe841db,_0x11acc2)=>{const _0x2b3fd0=_0x39d96a,_0x49eaf2=_0x40dc68[_0x2b3fd0(0x183)](_0xe841db);if(_0x49eaf2)return _0x49eaf2;if(_0x55b7d6[_0x2b3fd0(0x1a9)])return _0x2d441d[_0x2b3fd0(0x121)](_0xe841db,_0x11acc2),createPendingActivationId(_0xe841db);if(_0x55b7d6[_0x2b3fd0(0x175)]){await _0x1b9742();const _0x56834f=_0x40dc68[_0x2b3fd0(0x183)](_0x11acc2[_0x2b3fd0(0x1aa)]);if(_0x56834f)return _0x40dc68[_0x2b3fd0(0x121)](_0xe841db,_0x56834f),_0x56834f;const _0x359825=activationSignature(_0x11acc2),_0x4b1cff=_0x152a57?.['get'](_0x359825);if(_0x4b1cff)return _0x40dc68[_0x2b3fd0(0x121)](_0xe841db,_0x4b1cff),_0x4b1cff;const _0x4589a2=await _0x585b5f(_0x11acc2,_0xe51bf5[_0x2b3fd0(0xfd)]),_0x583196={..._0x4589a2,..._0x11acc2[_0x2b3fd0(0x12b)]!==undefined&&{'runAfterJourneyRefresh':_0x11acc2[_0x2b3fd0(0x12b)]}},_0xca2fc2=await _0x39f45b['journey'][_0x2b3fd0(0x1dd)](_0x55b7d6[_0x2b3fd0(0x175)]['id'],_0x583196);return _0x40dc68[_0x2b3fd0(0x121)](_0xe841db,_0xca2fc2['id']),_0xca2fc2['id'];}throw new SDKError(ErrorCode[_0x2b3fd0(0x193)],_0x2b3fd0(0x11a));},'resolveJourneyId':async _0x75e32c=>{const _0x23257c=_0x39d96a;try{return await _0x39f45b[_0x23257c(0x157)]['resolveJourneyId'](_0x26a3f3['parentId'],_0x75e32c);}catch(_0x2dd1db){throw new SDKError(ErrorCode[_0x23257c(0x10a)],_0x23257c(0x1c7)+_0x75e32c+_0x23257c(0x152)+_0x55b7d6['yamlConfig'][_0x23257c(0x1aa)]+'\x27)',_0x2dd1db);}},'resolveStageId':async(_0x1833b3,_0x339354)=>{const _0x39b1fa=_0x39d96a,_0x4bdefa=await _0x39f45b[_0x39b1fa(0x157)]['getJourney'](_0x1833b3),_0x2553e3=_0x4bdefa[_0x39b1fa(0x128)][_0x39b1fa(0x18e)][_0x39b1fa(0x176)](_0x14437f=>_0x14437f[_0x39b1fa(0x1aa)][_0x39b1fa(0x149)]()===_0x339354[_0x39b1fa(0x149)]());if(!_0x2553e3?.['id'])throw new SDKError(ErrorCode[_0x39b1fa(0x10a)],_0x39b1fa(0x18d)+_0x339354+_0x39b1fa(0x13d)+(_0x4bdefa[_0x39b1fa(0x128)][_0x39b1fa(0x19f)]||_0x4bdefa[_0x39b1fa(0x128)][_0x39b1fa(0x1aa)])+'\x27');return _0x2553e3['id'];}},_0x231c42=await _0x5e80da(_0x55b7d6[_0x39d96a(0x199)],_0x26a3f3[_0x39d96a(0x14f)],_0x4c107),_0x446032=_0x26a3f3[_0x39d96a(0x1ca)]||_0x26a3f3['rootFolderId'];_0x446032&&(_0x231c42[_0x39d96a(0x108)]={'parentFolder':{'data':{'id':_0x446032,'type':_0x39d96a(0x106)}}});if(_0x55b7d6[_0x39d96a(0x1a9)]){if(_0x34d20c[_0x39d96a(0x140)]>0x0||_0x2d441d['size']>0x0)return await executeThreeStepJourneyCreate(_0x39f45b,_0x55b7d6,_0x231c42,{'pendingEmbeddedSegments':_0x34d20c,'pendingEmbeddedActivations':_0x2d441d,'embeddedSegmentNameToId':_0x2cabaa,'journeyActivationNameToId':_0x40dc68},{..._0x26a3f3,'effectiveFolderId':_0x446032},_0xe51bf5,_0x2e9e7a,_0x1c3b1e);else{ensureJourneyDefaults(_0x231c42[_0x39d96a(0x128)]);const _0x205bbc=await _0x39f45b[_0x39d96a(0x157)][_0x39d96a(0x17e)](_0x231c42);return deletePushRecovery(_0x55b7d6[_0x39d96a(0x17c)]),{'action':_0x39d96a(0x1fe),'journeyId':_0x205bbc['id'],'embeddedSegmentNameToId':_0x2cabaa};}}else{if(_0x55b7d6[_0x39d96a(0x147)]&&_0x55b7d6[_0x39d96a(0x175)]){_0x231c42['id']=_0x55b7d6[_0x39d96a(0x175)]['id'];const _0x5b6112=_0x231c42[_0x39d96a(0x128)];_0x55b7d6['existingJourney'][_0x39d96a(0x128)]?.[_0x39d96a(0x19f)]&&(_0x5b6112['journeyBundleName']=_0x55b7d6[_0x39d96a(0x175)][_0x39d96a(0x128)][_0x39d96a(0x19f)]);const _0x402545=_0x55b7d6[_0x39d96a(0x175)][_0x39d96a(0x128)]?.[_0x39d96a(0x18e)];return _0x402545&&_0x231c42[_0x39d96a(0x128)][_0x39d96a(0x18e)]&&injectExistingStageIds(_0x231c42['attributes'][_0x39d96a(0x18e)],_0x402545),ensureJourneyDefaults(_0x5b6112),await _0x39f45b[_0x39d96a(0x157)][_0x39d96a(0x172)](_0x55b7d6[_0x39d96a(0x175)]['id'],_0x231c42),deletePushRecovery(_0x55b7d6[_0x39d96a(0x17c)]),{'action':_0x39d96a(0x13c),'journeyId':_0x55b7d6[_0x39d96a(0x175)]['id'],'embeddedSegmentNameToId':_0x2cabaa};}}return deletePushRecovery(_0x55b7d6[_0x39d96a(0x17c)]),{'action':_0x39d96a(0x162),'journeyId':_0x55b7d6[_0x39d96a(0x175)]?.['id'],'embeddedSegmentNameToId':_0x2cabaa};}function findSegmentCriteriaLocation(_0x25575b,_0x3e93cf){const _0x19f5bf=a152_0x1444f9,_0x10c523=_0x25575b[_0x19f5bf(0x1a6)]||_0x25575b[_0x19f5bf(0x143)]?.[0x0]?.['stages']||[];let _0x367dd1=_0x19f5bf(0x1b1),_0x239b49=_0x3e93cf;const _0x49ebf8=_0x25575b[_0x19f5bf(0x120)]||_0x25575b[_0x19f5bf(0x143)]?.[0x0]?.[_0x19f5bf(0x120)];if(_0x49ebf8?.[_0x19f5bf(0x1f0)]===_0x3e93cf)return{'stageName':_0x19f5bf(0x120),'criteriaName':_0x49ebf8[_0x19f5bf(0x1aa)]||_0x3e93cf};_0x260064:for(const _0x6649cb of _0x10c523){if(_0x6649cb[_0x19f5bf(0x16a)]?.[_0x19f5bf(0x1f0)]===_0x3e93cf){_0x367dd1=_0x6649cb[_0x19f5bf(0x1aa)],_0x239b49=_0x6649cb[_0x19f5bf(0x16a)][_0x19f5bf(0x1aa)]||_0x3e93cf;break;}if(_0x6649cb[_0x19f5bf(0x1a5)])for(const _0x348e5c of _0x6649cb[_0x19f5bf(0x1a5)]){if(_0x348e5c['type']===_0x19f5bf(0x1be)&&_0x348e5c[_0x19f5bf(0x1ef)]?.[_0x19f5bf(0x15a)])for(const _0x4aa2ff of _0x348e5c['with'][_0x19f5bf(0x15a)]){if(_0x4aa2ff[_0x19f5bf(0x1f0)]===_0x3e93cf){_0x367dd1=_0x6649cb[_0x19f5bf(0x1aa)],_0x239b49=_0x4aa2ff[_0x19f5bf(0x1aa)]||_0x3e93cf;break _0x260064;}}}}return{'stageName':_0x367dd1,'criteriaName':_0x239b49};}async function executeThreeStepJourneyCreate(_0xcbb836,_0x412790,_0x49e9ec,_0x381c71,_0x320d94,_0x357690,_0x1b9d1a,_0xfc5803){const _0x11fa89=a152_0x1444f9,{activationDefToCreateRequest:_0x39b92b,yamlRuleToApi:_0x5cdec3}=_0xfc5803,{pendingEmbeddedSegments:_0x4aa21f,pendingEmbeddedActivations:_0x32f675,embeddedSegmentNameToId:_0x15787a}=_0x381c71,_0x44ba93=JSON['parse'](JSON['stringify'](_0x49e9ec));ensureJourneyDefaults(_0x44ba93[_0x11fa89(0x128)]),stripPendingIds(_0x44ba93);const _0xa2112d=await _0xcbb836[_0x11fa89(0x157)][_0x11fa89(0x17e)](_0x44ba93),_0x14d4c9=_0xa2112d['id'],_0x50814b=new Map();for(const _0xb0c1d1 of _0xa2112d[_0x11fa89(0x128)][_0x11fa89(0x18e)]){_0x50814b[_0x11fa89(0x121)](_0xb0c1d1[_0x11fa89(0x1aa)]['toLowerCase'](),_0xb0c1d1['id']);}recoverSegmentIdsFromPushRecovery(_0x412790,_0x15787a,_0x357690[_0x11fa89(0x1b6)]);for(const [_0x67094e,{definition:_0x1f5d51}]of _0x4aa21f){if(_0x15787a[_0x11fa89(0x122)](_0x67094e)){_0x1b9d1a[_0x11fa89(0x1b0)]?.({'type':_0x11fa89(0x1f8),'journeyName':_0x412790[_0x11fa89(0x199)]['name'],'segmentName':_0x67094e});continue;}const _0x5885c9=generateDeterministicJourneySegmentName(_0x412790[_0x11fa89(0x199)][_0x11fa89(0x1aa)],_0x67094e);_0x1b9d1a[_0x11fa89(0x1b0)]?.({'type':_0x11fa89(0x103),'journeyName':_0x412790[_0x11fa89(0x199)]['name'],'segmentName':_0x67094e});const _0x2c8a00=createSegmentIdResolver(_0x357690[_0x11fa89(0x1b6)],_0x67094e),_0xe8d115=await resolveRuleSegmentIds(_0x1f5d51['rule'],_0x2c8a00),_0xf3eb66=await createOrRecoverEmbeddedSegment(_0xcbb836,_0x412790,{'localName':_0x67094e,'uniqueSegmentName':_0x5885c9,'description':_0x1f5d51[_0x11fa89(0x19e)]||_0x11fa89(0xfa)+_0x67094e,'journeyId':_0x14d4c9,'resolvedRule':_0xe8d115,'parentId':_0x320d94[_0x11fa89(0x14f)],'folderId':_0x320d94[_0x11fa89(0x1f6)]||''},_0x5cdec3);_0x15787a[_0x11fa89(0x121)](_0x67094e,_0xf3eb66),_0x357690[_0x11fa89(0x1b6)]['set'](_0x67094e,_0xf3eb66),_0x1b9d1a[_0x11fa89(0x1b0)]?.({'type':_0x11fa89(0x1f8),'journeyName':_0x412790['yamlConfig']['name'],'segmentName':_0x67094e});}const _0x4029e0=new Map();for(const [_0x246e91,_0x3e71cf]of _0x32f675){_0x1b9d1a['onProgress']?.({'type':'embedded_activation_creating','journeyName':_0x412790['yamlConfig']['name'],'activationName':_0x246e91});const _0x185216=await _0x39b92b(_0x3e71cf,_0x357690[_0x11fa89(0xfd)]),_0xc151be={..._0x185216,..._0x3e71cf[_0x11fa89(0x12b)]!==undefined&&{'runAfterJourneyRefresh':_0x3e71cf[_0x11fa89(0x12b)]}},_0x5a8aab=await _0xcbb836['journey']['createActivation'](_0x14d4c9,_0xc151be);_0x4029e0[_0x11fa89(0x121)](_0x246e91,_0x5a8aab['id']),_0x381c71[_0x11fa89(0x1bc)][_0x11fa89(0x121)](_0x246e91,_0x5a8aab['id']),_0x1b9d1a[_0x11fa89(0x1b0)]?.({'type':_0x11fa89(0x1cf),'journeyName':_0x412790[_0x11fa89(0x199)][_0x11fa89(0x1aa)],'activationName':_0x246e91});}const _0x4f635c=JSON[_0x11fa89(0x1f2)](JSON[_0x11fa89(0x11d)](_0x49e9ec));return _0x4f635c['id']=_0x14d4c9,ensureJourneyDefaults(_0x4f635c['attributes']),resolvePendingIdsInRequest(_0x4f635c,_0x49e9ec,_0x50814b,_0x15787a,_0x4029e0,_0x1b9d1a),await _0xcbb836[_0x11fa89(0x157)]['update'](_0x14d4c9,_0x4f635c),deletePushRecovery(_0x412790['absolutePath']),{'action':_0x11fa89(0x1fe),'journeyId':_0x14d4c9,'embeddedSegmentNameToId':_0x15787a};}export function stripWaitStepPendingIds(_0x2ce212){const _0x44ac39=a152_0x1444f9,_0x3a75f9=_0x2ce212['conditionSegmentId']&&isPendingSegmentId(_0x2ce212[_0x44ac39(0x1d8)]),_0x15c4af=_0x2ce212[_0x44ac39(0x180)]?.[_0x44ac39(0x1e1)](_0x3793a0=>_0x3793a0[_0x44ac39(0x174)]&&isPendingSegmentId(_0x3793a0[_0x44ac39(0x174)]));(_0x3a75f9||_0x15c4af)&&(_0x2ce212[_0x44ac39(0x12e)]='Duration',_0x2ce212['waitStep']=0x1,_0x2ce212[_0x44ac39(0x1e8)]=_0x44ac39(0x1fb),delete _0x2ce212['conditionSegmentId'],delete _0x2ce212['conditionTimeoutDuration'],delete _0x2ce212['conditionTimeoutUnit'],delete _0x2ce212[_0x44ac39(0x180)]);}export function resolveWaitStepPendingIds(_0x2c5594,_0x13badb,_0x308f6e,_0x5407ba){const _0x279bd2=a152_0x1444f9;if(_0x13badb[_0x279bd2(0x1d8)]&&isPendingSegmentId(_0x13badb[_0x279bd2(0x1d8)])){const _0x65d3d3=_0x308f6e(_0x13badb['conditionSegmentId'],_0x279bd2(0x114)+_0x5407ba+_0x279bd2(0xf8));_0x65d3d3&&(_0x2c5594[_0x279bd2(0x12e)]=_0x279bd2(0x1d5),_0x2c5594[_0x279bd2(0x1d8)]=_0x65d3d3,delete _0x2c5594[_0x279bd2(0x117)],delete _0x2c5594[_0x279bd2(0x1e8)],_0x13badb[_0x279bd2(0x166)]!==undefined&&(_0x2c5594[_0x279bd2(0x166)]=_0x13badb[_0x279bd2(0x166)]),_0x13badb[_0x279bd2(0x13f)]&&(_0x2c5594['conditionTimeoutUnit']=_0x13badb[_0x279bd2(0x13f)]));}if(_0x13badb[_0x279bd2(0x180)]){const _0x317169=_0x13badb[_0x279bd2(0x180)]['some'](_0x1d9b43=>_0x1d9b43[_0x279bd2(0x174)]&&isPendingSegmentId(_0x1d9b43[_0x279bd2(0x174)]));if(_0x317169){const _0x1f14ca=_0x13badb['conditions'][_0x279bd2(0x136)](_0x426297=>{const _0x260034=_0x279bd2;if(_0x426297[_0x260034(0x174)]&&isPendingSegmentId(_0x426297[_0x260034(0x174)])){const _0x22b89b=_0x308f6e(_0x426297['segmentId'],_0x260034(0x114)+_0x5407ba+_0x260034(0xf8));return{..._0x426297,'segmentId':_0x22b89b||_0x426297[_0x260034(0x174)]};}return{..._0x426297};});_0x2c5594[_0x279bd2(0x12e)]='Condition',_0x2c5594[_0x279bd2(0x180)]=_0x1f14ca,delete _0x2c5594[_0x279bd2(0x117)],delete _0x2c5594[_0x279bd2(0x1e8)],delete _0x2c5594[_0x279bd2(0x1d8)],delete _0x2c5594[_0x279bd2(0x166)],delete _0x2c5594[_0x279bd2(0x13f)];}}}function stripPendingIds(_0x5a5226){const _0x1da644=a152_0x1444f9;_0x5a5226[_0x1da644(0x128)]['goal']?.['segmentId']&&isPendingSegmentId(_0x5a5226[_0x1da644(0x128)]['goal'][_0x1da644(0x174)])&&delete _0x5a5226[_0x1da644(0x128)][_0x1da644(0x120)];for(const _0x31ebd9 of _0x5a5226[_0x1da644(0x128)][_0x1da644(0x18e)]||[]){_0x31ebd9[_0x1da644(0x17d)]?.[_0x1da644(0x174)]&&isPendingSegmentId(_0x31ebd9[_0x1da644(0x17d)][_0x1da644(0x174)])&&delete _0x31ebd9[_0x1da644(0x17d)];_0x31ebd9['milestone']?.[_0x1da644(0x174)]&&isPendingSegmentId(_0x31ebd9[_0x1da644(0x16c)][_0x1da644(0x174)])&&delete _0x31ebd9[_0x1da644(0x16c)];_0x31ebd9[_0x1da644(0x1b4)]&&(_0x31ebd9[_0x1da644(0x1b4)]=_0x31ebd9[_0x1da644(0x1b4)][_0x1da644(0x167)](_0x5745d1=>!_0x5745d1[_0x1da644(0x174)]||!isPendingSegmentId(_0x5745d1[_0x1da644(0x174)])));if(_0x31ebd9['steps'])for(const _0x4831b5 of Object[_0x1da644(0x102)](_0x31ebd9['steps'])){const _0x168ff1=_0x31ebd9[_0x1da644(0x1a5)][_0x4831b5];_0x168ff1[_0x1da644(0x158)]===_0x1da644(0x1fa)&&_0x168ff1[_0x1da644(0xf7)]&&isPendingActivationId(_0x168ff1[_0x1da644(0xf7)])&&(_0x168ff1[_0x1da644(0xf7)]='');if(_0x168ff1[_0x1da644(0x158)]===_0x1da644(0x1c9)&&_0x168ff1[_0x1da644(0x15a)])for(const _0x3955fc of _0x168ff1['branches']){_0x3955fc['segmentId']&&isPendingSegmentId(_0x3955fc['segmentId'])&&(_0x3955fc[_0x1da644(0x174)]='');}_0x168ff1[_0x1da644(0x158)]===_0x1da644(0x1ec)&&stripWaitStepPendingIds(_0x168ff1);}}}function resolvePendingIdsInRequest(_0x3987dd,_0x562dbe,_0xf91444,_0x57e5f0,_0xbb41bc,_0x4bd720){const _0x5954ee=a152_0x1444f9,_0x8801f6=(_0x230c8f,_0x522216)=>{const _0x2f3e59=a152_0x576d;if(!isPendingSegmentId(_0x230c8f))return _0x230c8f;const _0x25c2f2=extractPendingSegmentName(_0x230c8f),_0x57ae86=_0x57e5f0[_0x2f3e59(0x183)](_0x25c2f2);return!_0x57ae86&&_0x4bd720['logWarning']?.(_0x2f3e59(0x10e)+_0x25c2f2+_0x2f3e59(0x1ea)+_0x522216),_0x57ae86;};if(_0x3987dd['attributes']['goal']?.[_0x5954ee(0x174)]&&isPendingSegmentId(_0x3987dd[_0x5954ee(0x128)][_0x5954ee(0x120)][_0x5954ee(0x174)])){const _0x2592c8=_0x8801f6(_0x3987dd[_0x5954ee(0x128)][_0x5954ee(0x120)][_0x5954ee(0x174)],_0x5954ee(0x1a1));_0x2592c8&&(_0x3987dd[_0x5954ee(0x128)][_0x5954ee(0x120)][_0x5954ee(0x174)]=_0x2592c8);}for(const _0x2231de of _0x3987dd[_0x5954ee(0x128)]['journeyStages']||[]){const _0x1b06d8=_0xf91444[_0x5954ee(0x183)](_0x2231de[_0x5954ee(0x1aa)]['toLowerCase']());_0x1b06d8&&(_0x2231de['id']=_0x1b06d8);if(_0x2231de[_0x5954ee(0x17d)]?.[_0x5954ee(0x174)]&&isPendingSegmentId(_0x2231de['entryCriteria'][_0x5954ee(0x174)])){const _0x43c89c=_0x8801f6(_0x2231de[_0x5954ee(0x17d)][_0x5954ee(0x174)],_0x5954ee(0x114)+_0x2231de[_0x5954ee(0x1aa)]+_0x5954ee(0x192));_0x43c89c&&(_0x2231de['entryCriteria'][_0x5954ee(0x174)]=_0x43c89c);}if(_0x2231de[_0x5954ee(0x1b4)])for(const _0x3ed438 of _0x2231de[_0x5954ee(0x1b4)]){if(_0x3ed438[_0x5954ee(0x174)]&&isPendingSegmentId(_0x3ed438[_0x5954ee(0x174)])){const _0x22dcf7=_0x8801f6(_0x3ed438[_0x5954ee(0x174)],_0x5954ee(0x114)+_0x2231de['name']+_0x5954ee(0x14e));_0x22dcf7&&(_0x3ed438[_0x5954ee(0x174)]=_0x22dcf7);}}if(_0x2231de[_0x5954ee(0x16c)]?.[_0x5954ee(0x174)]&&isPendingSegmentId(_0x2231de['milestone'][_0x5954ee(0x174)])){const _0x21df2c=_0x8801f6(_0x2231de[_0x5954ee(0x16c)][_0x5954ee(0x174)],'stage\x20\x27'+_0x2231de['name']+_0x5954ee(0x184));_0x21df2c&&(_0x2231de[_0x5954ee(0x16c)][_0x5954ee(0x174)]=_0x21df2c);}if(_0x2231de[_0x5954ee(0x1a5)]){const _0x199e04=_0x58ac8f=>_0x562dbe['attributes'][_0x5954ee(0x18e)]?.[_0x5954ee(0x176)](_0x2ec2ce=>_0x2ec2ce[_0x5954ee(0x1aa)]['toLowerCase']()===_0x2231de['name'][_0x5954ee(0x149)]())?.[_0x5954ee(0x1a5)]?.[_0x58ac8f];for(const _0x59dc25 of Object[_0x5954ee(0x102)](_0x2231de[_0x5954ee(0x1a5)])){const _0x94bfac=_0x2231de[_0x5954ee(0x1a5)][_0x59dc25],_0x50b6a1=_0x199e04(_0x59dc25);if(_0x94bfac[_0x5954ee(0x158)]===_0x5954ee(0x1fa)&&_0x94bfac['journeyActivationStepId']&&(isPendingActivationId(_0x94bfac[_0x5954ee(0xf7)])||_0x94bfac['journeyActivationStepId']==='')){if(_0x50b6a1?.[_0x5954ee(0xf7)]&&isPendingActivationId(_0x50b6a1['journeyActivationStepId'])){const _0x4747f3=extractPendingActivationName(_0x50b6a1['journeyActivationStepId']),_0x396a85=_0xbb41bc['get'](_0x4747f3);_0x396a85&&(_0x94bfac[_0x5954ee(0xf7)]=_0x396a85);}}if(_0x94bfac[_0x5954ee(0x158)]==='DecisionPoint'&&_0x94bfac['branches']&&_0x50b6a1?.[_0x5954ee(0x15a)])for(let _0x2e9c76=0x0;_0x2e9c76<_0x94bfac[_0x5954ee(0x15a)][_0x5954ee(0x124)];_0x2e9c76++){const _0x219ba6=_0x94bfac[_0x5954ee(0x15a)][_0x2e9c76],_0x23fec6=_0x50b6a1[_0x5954ee(0x15a)][_0x2e9c76];if(_0x23fec6?.[_0x5954ee(0x174)]&&isPendingSegmentId(_0x23fec6[_0x5954ee(0x174)])){const _0x4af7f9=_0x8801f6(_0x23fec6[_0x5954ee(0x174)],_0x5954ee(0x114)+_0x2231de[_0x5954ee(0x1aa)]+_0x5954ee(0x126)+(_0x219ba6[_0x5954ee(0x1aa)]||_0x2e9c76)+'\x27');_0x4af7f9&&(_0x219ba6[_0x5954ee(0x174)]=_0x4af7f9);}}_0x94bfac[_0x5954ee(0x158)]===_0x5954ee(0x1ec)&&_0x50b6a1?.['type']===_0x5954ee(0x1ec)&&resolveWaitStepPendingIds(_0x94bfac,_0x50b6a1,_0x8801f6,_0x2231de[_0x5954ee(0x1aa)]);}}}}
@@ -1 +1 @@
1
- function a153_0x3fba(_0x4d0b19,_0xe1cb89){_0x4d0b19=_0x4d0b19-0x80;const _0x48e1c5=a153_0x48e1();let _0x3fba49=_0x48e1c5[_0x4d0b19];return _0x3fba49;}(function(_0x83797f,_0x2b735b){const _0x18c133=a153_0x3fba,_0x49f194=_0x83797f();while(!![]){try{const _0xfd8228=parseInt(_0x18c133(0x82))/0x1+parseInt(_0x18c133(0x81))/0x2*(-parseInt(_0x18c133(0x90))/0x3)+parseInt(_0x18c133(0x89))/0x4+-parseInt(_0x18c133(0x8e))/0x5*(parseInt(_0x18c133(0x8a))/0x6)+-parseInt(_0x18c133(0x85))/0x7*(parseInt(_0x18c133(0x8b))/0x8)+-parseInt(_0x18c133(0x86))/0x9*(-parseInt(_0x18c133(0x91))/0xa)+parseInt(_0x18c133(0x8d))/0xb*(parseInt(_0x18c133(0x84))/0xc);if(_0xfd8228===_0x2b735b)break;else _0x49f194['push'](_0x49f194['shift']());}catch(_0x739cdb){_0x49f194['push'](_0x49f194['shift']());}}}(a153_0x48e1,0x2b912));function a153_0x48e1(){const _0x10e5a3=['7001401TPiGAM','5vPxOdx','add','15474bvJEXJ','10yLtAnb','name','118OgEeSJ','134548kRMxBq','get','12ntRfRX','7eDQeMR','408627rFGFGC','has','set','141048nONlJT','666714YrquEL','2062504ouAhmT','parentFolderId'];a153_0x48e1=function(){return _0x10e5a3;};return a153_0x48e1();}export function buildFolderIdToPathMap(_0xa9227e){const _0x5cdfd4=a153_0x3fba,_0xd9a9b5=new Map(),_0x41f3dc=new Map();for(const _0x16fd50 of _0xa9227e){_0x41f3dc[_0x5cdfd4(0x88)](_0x16fd50['id'],_0x16fd50);}const _0x4a9446=new Set();for(const _0x3d5126 of _0xa9227e){!_0x3d5126['parentFolderId']&&_0x4a9446[_0x5cdfd4(0x8f)](_0x3d5126['id']);}function _0x5e20cf(_0x327c94){const _0x1c761e=_0x5cdfd4;if(_0xd9a9b5[_0x1c761e(0x87)](_0x327c94['id']))return _0xd9a9b5['get'](_0x327c94['id']);if(_0x4a9446[_0x1c761e(0x87)](_0x327c94['id']))return _0xd9a9b5['set'](_0x327c94['id'],''),'';if(_0x327c94[_0x1c761e(0x8c)]){const _0x4fd7f1=_0x41f3dc[_0x1c761e(0x83)](_0x327c94[_0x1c761e(0x8c)]);if(_0x4fd7f1){const _0x459de7=_0x5e20cf(_0x4fd7f1),_0x4a86f6=_0x459de7?_0x459de7+'/'+_0x327c94[_0x1c761e(0x80)]:_0x327c94[_0x1c761e(0x80)];return _0xd9a9b5[_0x1c761e(0x88)](_0x327c94['id'],_0x4a86f6),_0x4a86f6;}}const _0x197795=_0x327c94[_0x1c761e(0x80)];return _0xd9a9b5['set'](_0x327c94['id'],_0x197795),_0x197795;}for(const _0x3c031c of _0xa9227e){_0x5e20cf(_0x3c031c);}return _0xd9a9b5;}export function buildFolderPathToIdMap(_0x2dfdfa){const _0x50c99f=a153_0x3fba,_0x4990bb=new Map(),_0x5c3d8e=new Map();for(const _0x344f7f of _0x2dfdfa){_0x5c3d8e['set'](_0x344f7f['id'],_0x344f7f);}const _0x38caf3=new Set();for(const _0x2c426c of _0x2dfdfa){!_0x2c426c[_0x50c99f(0x8c)]&&_0x38caf3['add'](_0x2c426c['id']);}function _0x32d53c(_0x37d397){const _0x4dfad4=_0x50c99f;if(_0x38caf3[_0x4dfad4(0x87)](_0x37d397['id']))return'';if(_0x37d397[_0x4dfad4(0x8c)]){const _0x578903=_0x5c3d8e['get'](_0x37d397['parentFolderId']);if(_0x578903){const _0x239068=_0x32d53c(_0x578903);return _0x239068?_0x239068+'/'+_0x37d397[_0x4dfad4(0x80)]:_0x37d397[_0x4dfad4(0x80)];}}return _0x37d397['name'];}for(const _0x1c631f of _0x2dfdfa){const _0xfe3af4=_0x32d53c(_0x1c631f);_0x4990bb[_0x50c99f(0x88)](_0xfe3af4,_0x1c631f['id']);}return _0x4990bb;}export function buildFolderMaps(_0x120d7d){const _0x55739c=a153_0x3fba,_0x29fdff=buildFolderIdToPathMap(_0x120d7d),_0x2f0270=new Map();for(const [_0x1474ab,_0x35c45a]of _0x29fdff){_0x2f0270[_0x55739c(0x88)](_0x35c45a,_0x1474ab);}return{'idToPath':_0x29fdff,'pathToId':_0x2f0270};}export function getFolderPath(_0x40b2c4,_0x5261c2){const _0x1dd159=a153_0x3fba;if(!_0x40b2c4)return'';return _0x5261c2[_0x1dd159(0x83)](_0x40b2c4)??'';}
1
+ function a153_0x111d(_0x22ca96,_0x3064c4){_0x22ca96=_0x22ca96-0xc1;const _0x8a9d08=a153_0x8a9d();let _0x111d6b=_0x8a9d08[_0x22ca96];return _0x111d6b;}(function(_0x59152b,_0x145fcf){const _0x1a6bde=a153_0x111d,_0x2b15ee=_0x59152b();while(!![]){try{const _0x5afb1a=parseInt(_0x1a6bde(0xc5))/0x1*(-parseInt(_0x1a6bde(0xca))/0x2)+parseInt(_0x1a6bde(0xcf))/0x3*(-parseInt(_0x1a6bde(0xcb))/0x4)+-parseInt(_0x1a6bde(0xc2))/0x5+parseInt(_0x1a6bde(0xd0))/0x6+-parseInt(_0x1a6bde(0xc9))/0x7*(-parseInt(_0x1a6bde(0xc3))/0x8)+parseInt(_0x1a6bde(0xcd))/0x9*(-parseInt(_0x1a6bde(0xce))/0xa)+parseInt(_0x1a6bde(0xc1))/0xb;if(_0x5afb1a===_0x145fcf)break;else _0x2b15ee['push'](_0x2b15ee['shift']());}catch(_0x1e61d3){_0x2b15ee['push'](_0x2b15ee['shift']());}}}(a153_0x8a9d,0x3663b));export function buildFolderIdToPathMap(_0x17074f){const _0x39d16d=a153_0x111d,_0x37627f=new Map(),_0x136fbb=new Map();for(const _0x15bc77 of _0x17074f){_0x136fbb[_0x39d16d(0xd1)](_0x15bc77['id'],_0x15bc77);}const _0x642f30=new Set();for(const _0x2defc1 of _0x17074f){!_0x2defc1[_0x39d16d(0xc6)]&&_0x642f30[_0x39d16d(0xc8)](_0x2defc1['id']);}function _0x44cbdd(_0x12024c){const _0x1df4ed=_0x39d16d;if(_0x37627f[_0x1df4ed(0xcc)](_0x12024c['id']))return _0x37627f[_0x1df4ed(0xc4)](_0x12024c['id']);if(_0x642f30[_0x1df4ed(0xcc)](_0x12024c['id']))return _0x37627f['set'](_0x12024c['id'],''),'';if(_0x12024c[_0x1df4ed(0xc6)]){const _0x3fc25e=_0x136fbb[_0x1df4ed(0xc4)](_0x12024c[_0x1df4ed(0xc6)]);if(_0x3fc25e){const _0x532a37=_0x44cbdd(_0x3fc25e),_0x31a03d=_0x532a37?_0x532a37+'/'+_0x12024c[_0x1df4ed(0xc7)]:_0x12024c[_0x1df4ed(0xc7)];return _0x37627f[_0x1df4ed(0xd1)](_0x12024c['id'],_0x31a03d),_0x31a03d;}}const _0x5099d1=_0x12024c[_0x1df4ed(0xc7)];return _0x37627f[_0x1df4ed(0xd1)](_0x12024c['id'],_0x5099d1),_0x5099d1;}for(const _0x54e8dd of _0x17074f){_0x44cbdd(_0x54e8dd);}return _0x37627f;}function a153_0x8a9d(){const _0x3da4d4=['add','21VtUEHx','72042bRjfpA','11092jjLDzp','has','3987SgbBwT','7810DjLpRR','375luWLNd','593274pnDifa','set','11521301txhhpJ','1168545AsnFPZ','968096AeORno','get','10YdtUqi','parentFolderId','name'];a153_0x8a9d=function(){return _0x3da4d4;};return a153_0x8a9d();}export function buildFolderPathToIdMap(_0x98ebeb){const _0x3dbfc0=a153_0x111d,_0x17ced6=new Map(),_0x4fd357=new Map();for(const _0x409e7b of _0x98ebeb){_0x4fd357[_0x3dbfc0(0xd1)](_0x409e7b['id'],_0x409e7b);}const _0x53a8f0=new Set();for(const _0x2f14c6 of _0x98ebeb){!_0x2f14c6[_0x3dbfc0(0xc6)]&&_0x53a8f0[_0x3dbfc0(0xc8)](_0x2f14c6['id']);}function _0x508cb5(_0x5ec741){const _0x528a4d=_0x3dbfc0;if(_0x53a8f0[_0x528a4d(0xcc)](_0x5ec741['id']))return'';if(_0x5ec741['parentFolderId']){const _0x534294=_0x4fd357[_0x528a4d(0xc4)](_0x5ec741[_0x528a4d(0xc6)]);if(_0x534294){const _0x3a710c=_0x508cb5(_0x534294);return _0x3a710c?_0x3a710c+'/'+_0x5ec741['name']:_0x5ec741[_0x528a4d(0xc7)];}}return _0x5ec741[_0x528a4d(0xc7)];}for(const _0x3e95b4 of _0x98ebeb){const _0x3b9ebc=_0x508cb5(_0x3e95b4);_0x17ced6[_0x3dbfc0(0xd1)](_0x3b9ebc,_0x3e95b4['id']);}return _0x17ced6;}export function buildFolderMaps(_0x411045){const _0x655aea=a153_0x111d,_0x3e3f7e=buildFolderIdToPathMap(_0x411045),_0xc9e279=new Map();for(const [_0xc7e2e6,_0x404960]of _0x3e3f7e){_0xc9e279[_0x655aea(0xd1)](_0x404960,_0xc7e2e6);}return{'idToPath':_0x3e3f7e,'pathToId':_0xc9e279};}export function getFolderPath(_0x21772e,_0x306928){if(!_0x21772e)return'';return _0x306928['get'](_0x21772e)??'';}
@@ -1 +1 @@
1
- (function(_0x3afc42,_0x1da322){const _0x4e977f=a154_0xe3c3,_0x45ca39=_0x3afc42();while(!![]){try{const _0x57f677=parseInt(_0x4e977f(0x1de))/0x1*(-parseInt(_0x4e977f(0x1cb))/0x2)+-parseInt(_0x4e977f(0x1c9))/0x3*(-parseInt(_0x4e977f(0x1eb))/0x4)+parseInt(_0x4e977f(0x1da))/0x5+parseInt(_0x4e977f(0x1db))/0x6+parseInt(_0x4e977f(0x1cd))/0x7+parseInt(_0x4e977f(0x1f0))/0x8*(-parseInt(_0x4e977f(0x1f1))/0x9)+-parseInt(_0x4e977f(0x1f4))/0xa*(parseInt(_0x4e977f(0x1d7))/0xb);if(_0x57f677===_0x1da322)break;else _0x45ca39['push'](_0x45ca39['shift']());}catch(_0xf13659){_0x45ca39['push'](_0x45ca39['shift']());}}}(a154_0x3569,0xa9297));import a154_0x34f677 from'path';import{parse as a154_0x5d3231}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x54d656){const _0x254ebc=a154_0xe3c3;if(!_0x54d656||_0x54d656[_0x254ebc(0x1e6)]()==='')throw new Error(_0x254ebc(0x1e2));const _0x5da9d1=_0x54d656['trim']();if(_0x5da9d1==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x54d656};const _0x4043df=_0x5da9d1[_0x254ebc(0x1d3)]('/')?_0x5da9d1[_0x254ebc(0x1dc)](0x1):_0x5da9d1,_0x51af5e=_0x4043df[_0x254ebc(0x1e5)]('/')[_0x254ebc(0x1e1)](_0x45fbb1=>_0x45fbb1!=='');if(_0x51af5e[_0x254ebc(0x1ce)]===0x0)throw new Error(_0x254ebc(0x1f3));const _0x2ae0f8=_0x5da9d1[_0x254ebc(0x1d3)]('/')||!isRelativePathSegment(_0x51af5e[0x0]);for(const _0x4712f4 of _0x51af5e){validatePathSegment(_0x4712f4);}return{'segments':_0x51af5e,'isAbsolute':_0x2ae0f8,'raw':_0x54d656};}function a154_0xe3c3(_0x171208,_0x595238){_0x171208=_0x171208-0x1c2;const _0x356915=a154_0x3569();let _0xe3c3b5=_0x356915[_0x171208];return _0xe3c3b5;}function isRelativePathSegment(_0xd07494){return _0xd07494==='.'||_0xd07494==='..';}function validatePathSegment(_0x48be36){const _0x4adcd1=a154_0xe3c3;if(_0x48be36==='')throw new Error(_0x4adcd1(0x1d8));if(_0x48be36==='.'||_0x48be36==='..')return;if(/[\x00-\x1F\x7F]/[_0x4adcd1(0x1c6)](_0x48be36))throw new Error(_0x4adcd1(0x1d2)+_0x48be36);if(_0x48be36!==_0x48be36[_0x4adcd1(0x1e6)]()){}}export function validatePath(_0x4c6e93){const _0x3f15f9=a154_0xe3c3;if(_0x4c6e93['segments']['length']===0x0&&!_0x4c6e93[_0x3f15f9(0x1c8)])throw new Error(_0x3f15f9(0x1c7));if(_0x4c6e93['isAbsolute']){if(_0x4c6e93[_0x3f15f9(0x1ef)][0x0]==='..')throw new Error(_0x3f15f9(0x1f2));let _0x303b7c=0x0;for(const _0x340176 of _0x4c6e93['segments']){if(_0x340176==='..'){if(_0x303b7c===0x0)throw new Error('Path\x20attempts\x20to\x20navigate\x20above\x20root');_0x303b7c--;}else _0x340176!=='.'&&_0x303b7c++;}}}export function joinPaths(_0x153cd9,_0x240107){const _0x31b4d5=a154_0xe3c3;if(!_0x153cd9||_0x153cd9==='/')return _0x240107;if(!_0x240107||_0x240107==='.')return _0x153cd9;if(_0x240107[_0x31b4d5(0x1d3)]('/'))return _0x240107;const _0x10064f=parsePath(_0x153cd9),_0x51f809=parsePath(_0x240107),_0x1c92ce=[..._0x10064f[_0x31b4d5(0x1ef)]];for(const _0x402230 of _0x51f809['segments']){if(_0x402230==='.')continue;else{if(_0x402230==='..'){if(_0x1c92ce[_0x31b4d5(0x1ce)]===0x0)throw new Error(_0x31b4d5(0x1ee));_0x1c92ce[_0x31b4d5(0x1c3)]();}else _0x1c92ce[_0x31b4d5(0x1c4)](_0x402230);}}const _0x3343b8=_0x1c92ce[_0x31b4d5(0x1e3)]('/');return _0x10064f[_0x31b4d5(0x1e4)][_0x31b4d5(0x1d3)]('/')?'/'+_0x3343b8:_0x3343b8;}export function normalizePath(_0x42815e){const _0xeb846d=a154_0xe3c3,_0x550e17=parsePath(_0x42815e),_0x2a044b=[];for(const _0x726e87 of _0x550e17['segments']){if(_0x726e87==='.')continue;else{if(_0x726e87==='..'){if(_0x2a044b['length']===0x0){if(_0x550e17[_0xeb846d(0x1c8)])throw new Error('Cannot\x20navigate\x20above\x20root');_0x2a044b[_0xeb846d(0x1c4)]('..');}else _0x2a044b[_0x2a044b[_0xeb846d(0x1ce)]-0x1]==='..'?_0x2a044b['push']('..'):_0x2a044b[_0xeb846d(0x1c3)]();}else _0x2a044b['push'](_0x726e87);}}if(_0x2a044b['length']===0x0)return _0x550e17[_0xeb846d(0x1c8)]?'/':'.';const _0x2f883f=_0x2a044b['join']('/');return _0x550e17[_0xeb846d(0x1e4)][_0xeb846d(0x1d3)]('/')?'/'+_0x2f883f:_0x2f883f;}export function getParentPath(_0x29092a){const _0x91d56c=a154_0xe3c3,_0x5542b2=parsePath(_0x29092a);if(_0x5542b2[_0x91d56c(0x1ef)][_0x91d56c(0x1ce)]<=0x1)return'/';const _0xce45f9=_0x5542b2[_0x91d56c(0x1ef)]['slice'](0x0,-0x1)['join']('/');return _0x5542b2[_0x91d56c(0x1e4)][_0x91d56c(0x1d3)]('/')?'/'+_0xce45f9:_0xce45f9;}export function getBaseName(_0x5434a8){const _0x9d0495=a154_0xe3c3,_0x5cfc5b=parsePath(_0x5434a8);return _0x5cfc5b[_0x9d0495(0x1ef)][_0x5cfc5b[_0x9d0495(0x1ef)]['length']-0x1]||'';}function a154_0x3569(){const _0x29744e=['raw','split','trim','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','replace','.yaml','type','953896SqhQEP','root','relative','Cannot\x20navigate\x20above\x20root','segments','120wsCjDC','209268bDZZat','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','20vhPKCB','Cannot\x20split\x20empty\x20path','pop','push','parse','test','Relative\x20path\x20cannot\x20be\x20empty','isAbsolute','3WOVFFR','resolve','66pmItgq','segment','3204936awcmEb','length','endsWith','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','name','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','startsWith','dirname','exists','.yml','5491805pwtOPA','Path\x20segment\x20cannot\x20be\x20empty','File\x20not\x20found:\x20','5961840nUHbdg','2192556GOQgmH','substring','journey','6483MXifdv','readFile','slice','filter','Path\x20cannot\x20be\x20empty','join'];a154_0x3569=function(){return _0x29744e;};return a154_0x3569();}export function isChildPath(_0x357ddf,_0x4a24c2){const _0x370bbe=a154_0xe3c3,_0x35a578=parsePath(_0x357ddf),_0x5de4ba=parsePath(_0x4a24c2);if(_0x35a578[_0x370bbe(0x1ef)]['length']<=_0x5de4ba[_0x370bbe(0x1ef)]['length'])return![];for(let _0xe7bbfc=0x0;_0xe7bbfc<_0x5de4ba['segments'][_0x370bbe(0x1ce)];_0xe7bbfc++){if(_0x35a578[_0x370bbe(0x1ef)][_0xe7bbfc]!==_0x5de4ba[_0x370bbe(0x1ef)][_0xe7bbfc])return![];}return!![];}export function splitPath(_0x2ad2e1){const _0x11a487=a154_0xe3c3,_0x593d5f=parsePath(_0x2ad2e1);if(_0x593d5f[_0x11a487(0x1ef)]['length']===0x0)throw new Error(_0x11a487(0x1c2));if(_0x593d5f[_0x11a487(0x1ef)][_0x11a487(0x1ce)]===0x1)return{'parent':_0x593d5f[_0x11a487(0x1ef)][0x0]};return{'parent':_0x593d5f['segments'][0x0],'child':_0x593d5f[_0x11a487(0x1ef)][_0x11a487(0x1e0)](0x1)[_0x11a487(0x1e3)]('/')};}export function isYamlFilePath(_0x42bcb3){const _0x1227a4=a154_0xe3c3;return _0x42bcb3[_0x1227a4(0x1cf)](_0x1227a4(0x1d6))||_0x42bcb3[_0x1227a4(0x1cf)](_0x1227a4(0x1e9));}export async function resolveYamlFilePath(_0x38e37e,_0x3222b6=nodeFileSystem){const _0x2b2a2e=a154_0xe3c3,_0x2b4b4f=a154_0x34f677[_0x2b2a2e(0x1ca)](_0x38e37e);if(!await _0x3222b6[_0x2b2a2e(0x1d5)](_0x2b4b4f))throw new Error(_0x2b2a2e(0x1d9)+_0x38e37e);let _0x1f5ec2=a154_0x34f677['dirname'](_0x2b4b4f),_0x3a8a1a=null,_0x1f6dc8=null;const _0xd880d3=a154_0x34f677[_0x2b2a2e(0x1c5)](_0x1f5ec2)[_0x2b2a2e(0x1ec)];while(_0x1f5ec2!==_0xd880d3){const _0x2bf66e=a154_0x34f677[_0x2b2a2e(0x1e3)](_0x1f5ec2,'tdx.json');if(await _0x3222b6['exists'](_0x2bf66e)){_0x3a8a1a=_0x2bf66e,_0x1f6dc8=_0x1f5ec2;break;}_0x1f5ec2=a154_0x34f677[_0x2b2a2e(0x1d4)](_0x1f5ec2);}if(!_0x3a8a1a||!_0x1f6dc8)throw new Error('No\x20tdx.json\x20found\x20for\x20file:\x20'+_0x38e37e+'\x0a'+_0x2b2a2e(0x1d0));const _0x498c62=await _0x3222b6[_0x2b2a2e(0x1df)](_0x3a8a1a),_0x29189d=JSON['parse'](_0x498c62),_0x38faca=_0x29189d['parent_segment'];if(!_0x38faca)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x1f1c98=await _0x3222b6[_0x2b2a2e(0x1df)](_0x2b4b4f),_0x3761f2=a154_0x5d3231(_0x1f1c98),_0x14bb96=_0x3761f2[_0x2b2a2e(0x1d1)];if(!_0x14bb96)throw new Error(_0x2b2a2e(0x1e7)+_0x38e37e);const _0x394582=_0x3761f2[_0x2b2a2e(0x1ea)]===_0x2b2a2e(0x1dd)?_0x2b2a2e(0x1dd):_0x2b2a2e(0x1cc),_0x439840=a154_0x34f677[_0x2b2a2e(0x1ed)](_0x1f6dc8,_0x2b4b4f),_0x38b050=a154_0x34f677[_0x2b2a2e(0x1d4)](_0x439840),_0x1dd34e=_0x38b050==='.'?'':_0x38b050[_0x2b2a2e(0x1e8)](/\\/g,'/'),_0x4fd846=_0x1dd34e?_0x38faca+'/'+_0x1dd34e+'/'+_0x14bb96:_0x38faca+'/'+_0x14bb96;return{'parentSegment':_0x38faca,'segmentName':_0x14bb96,'folderPath':_0x1dd34e,'fullPath':_0x4fd846,'resourceType':_0x394582,'content':_0x1f1c98};}
1
+ (function(_0x1051bf,_0x4e84c7){const _0x37dd4b=a154_0x289a,_0x225358=_0x1051bf();while(!![]){try{const _0x42e4d9=parseInt(_0x37dd4b(0xe3))/0x1*(-parseInt(_0x37dd4b(0xfc))/0x2)+parseInt(_0x37dd4b(0x102))/0x3*(-parseInt(_0x37dd4b(0xe0))/0x4)+-parseInt(_0x37dd4b(0xf5))/0x5*(parseInt(_0x37dd4b(0xf3))/0x6)+parseInt(_0x37dd4b(0xeb))/0x7+parseInt(_0x37dd4b(0x108))/0x8+-parseInt(_0x37dd4b(0xfe))/0x9+parseInt(_0x37dd4b(0xea))/0xa;if(_0x42e4d9===_0x4e84c7)break;else _0x225358['push'](_0x225358['shift']());}catch(_0x424006){_0x225358['push'](_0x225358['shift']());}}}(a154_0x2418,0x8d6d7));import a154_0x2e5901 from'path';function a154_0x2418(){const _0x12a964=['parent_segment','5GzTwic','trim','readFile','dirname','raw','startsWith','slice','146WRuLja','length','4580442ZUBWbO','File\x20not\x20found:\x20','substring','No\x20tdx.json\x20found\x20for\x20file:\x20','1158kMCuNr','relative','Relative\x20path\x20cannot\x20be\x20empty','endsWith','isAbsolute','join','6498944lImVnY','segments','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','7064NVFNur','push','Path\x20cannot\x20be\x20empty','12279VgfAyQ','exists','filter','Path\x20attempts\x20to\x20navigate\x20above\x20root','replace','resolve','.yml','17952000CvPMJC','3496815sHpSVT','parse','segment','journey','root','pop','type','Cannot\x20navigate\x20above\x20root','2645070cvINjV'];a154_0x2418=function(){return _0x12a964;};return a154_0x2418();}import{parse as a154_0x24051f}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x124b57){const _0x5d4d33=a154_0x289a;if(!_0x124b57||_0x124b57[_0x5d4d33(0xf6)]()==='')throw new Error(_0x5d4d33(0xe2));const _0x490168=_0x124b57[_0x5d4d33(0xf6)]();if(_0x490168==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x124b57};const _0x17b158=_0x490168['startsWith']('/')?_0x490168[_0x5d4d33(0x100)](0x1):_0x490168,_0x45012c=_0x17b158['split']('/')[_0x5d4d33(0xe5)](_0x46a10c=>_0x46a10c!=='');if(_0x45012c[_0x5d4d33(0xfd)]===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x452fc6=_0x490168[_0x5d4d33(0xfa)]('/')||!isRelativePathSegment(_0x45012c[0x0]);for(const _0xdac68b of _0x45012c){validatePathSegment(_0xdac68b);}return{'segments':_0x45012c,'isAbsolute':_0x452fc6,'raw':_0x124b57};}function isRelativePathSegment(_0xe12f10){return _0xe12f10==='.'||_0xe12f10==='..';}function validatePathSegment(_0x10a63c){const _0x3a3099=a154_0x289a;if(_0x10a63c==='')throw new Error('Path\x20segment\x20cannot\x20be\x20empty');if(_0x10a63c==='.'||_0x10a63c==='..')return;if(/[\x00-\x1F\x7F]/['test'](_0x10a63c))throw new Error(_0x3a3099(0x10a)+_0x10a63c);if(_0x10a63c!==_0x10a63c['trim']()){}}export function validatePath(_0x264ea8){const _0x58277e=a154_0x289a;if(_0x264ea8[_0x58277e(0x109)][_0x58277e(0xfd)]===0x0&&!_0x264ea8[_0x58277e(0x106)])throw new Error(_0x58277e(0x104));if(_0x264ea8['isAbsolute']){if(_0x264ea8[_0x58277e(0x109)][0x0]==='..')throw new Error('Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22');let _0x419f96=0x0;for(const _0x243a82 of _0x264ea8['segments']){if(_0x243a82==='..'){if(_0x419f96===0x0)throw new Error(_0x58277e(0xe6));_0x419f96--;}else _0x243a82!=='.'&&_0x419f96++;}}}export function joinPaths(_0x4f97b5,_0x5e5ca9){const _0x22b9c2=a154_0x289a;if(!_0x4f97b5||_0x4f97b5==='/')return _0x5e5ca9;if(!_0x5e5ca9||_0x5e5ca9==='.')return _0x4f97b5;if(_0x5e5ca9['startsWith']('/'))return _0x5e5ca9;const _0x528a20=parsePath(_0x4f97b5),_0x1660e7=parsePath(_0x5e5ca9),_0x2b4494=[..._0x528a20[_0x22b9c2(0x109)]];for(const _0x284518 of _0x1660e7[_0x22b9c2(0x109)]){if(_0x284518==='.')continue;else{if(_0x284518==='..'){if(_0x2b4494['length']===0x0)throw new Error(_0x22b9c2(0xf2));_0x2b4494[_0x22b9c2(0xf0)]();}else _0x2b4494[_0x22b9c2(0xe1)](_0x284518);}}const _0x5c7bd1=_0x2b4494[_0x22b9c2(0x107)]('/');return _0x528a20['raw'][_0x22b9c2(0xfa)]('/')?'/'+_0x5c7bd1:_0x5c7bd1;}export function normalizePath(_0x56a422){const _0x2861fe=a154_0x289a,_0x3c33eb=parsePath(_0x56a422),_0x597769=[];for(const _0x4a6555 of _0x3c33eb[_0x2861fe(0x109)]){if(_0x4a6555==='.')continue;else{if(_0x4a6555==='..'){if(_0x597769[_0x2861fe(0xfd)]===0x0){if(_0x3c33eb['isAbsolute'])throw new Error('Cannot\x20navigate\x20above\x20root');_0x597769[_0x2861fe(0xe1)]('..');}else _0x597769[_0x597769[_0x2861fe(0xfd)]-0x1]==='..'?_0x597769[_0x2861fe(0xe1)]('..'):_0x597769[_0x2861fe(0xf0)]();}else _0x597769['push'](_0x4a6555);}}if(_0x597769[_0x2861fe(0xfd)]===0x0)return _0x3c33eb['isAbsolute']?'/':'.';const _0x43814d=_0x597769[_0x2861fe(0x107)]('/');return _0x3c33eb[_0x2861fe(0xf9)]['startsWith']('/')?'/'+_0x43814d:_0x43814d;}export function getParentPath(_0x5c1436){const _0x5714dc=a154_0x289a,_0x3b3c58=parsePath(_0x5c1436);if(_0x3b3c58['segments']['length']<=0x1)return'/';const _0x36072b=_0x3b3c58[_0x5714dc(0x109)][_0x5714dc(0xfb)](0x0,-0x1)[_0x5714dc(0x107)]('/');return _0x3b3c58[_0x5714dc(0xf9)][_0x5714dc(0xfa)]('/')?'/'+_0x36072b:_0x36072b;}export function getBaseName(_0x31228d){const _0x343722=a154_0x289a,_0x1a6061=parsePath(_0x31228d);return _0x1a6061[_0x343722(0x109)][_0x1a6061['segments']['length']-0x1]||'';}function a154_0x289a(_0x411c4e,_0x558618){_0x411c4e=_0x411c4e-0xe0;const _0x24180e=a154_0x2418();let _0x289abd=_0x24180e[_0x411c4e];return _0x289abd;}export function isChildPath(_0x2b134e,_0x2f0ba8){const _0x543439=a154_0x289a,_0x512710=parsePath(_0x2b134e),_0x26b03f=parsePath(_0x2f0ba8);if(_0x512710[_0x543439(0x109)]['length']<=_0x26b03f[_0x543439(0x109)][_0x543439(0xfd)])return![];for(let _0x3ac859=0x0;_0x3ac859<_0x26b03f[_0x543439(0x109)][_0x543439(0xfd)];_0x3ac859++){if(_0x512710[_0x543439(0x109)][_0x3ac859]!==_0x26b03f[_0x543439(0x109)][_0x3ac859])return![];}return!![];}export function splitPath(_0x498ffe){const _0x5bfa98=a154_0x289a,_0x2e556d=parsePath(_0x498ffe);if(_0x2e556d[_0x5bfa98(0x109)][_0x5bfa98(0xfd)]===0x0)throw new Error('Cannot\x20split\x20empty\x20path');if(_0x2e556d[_0x5bfa98(0x109)][_0x5bfa98(0xfd)]===0x1)return{'parent':_0x2e556d[_0x5bfa98(0x109)][0x0]};return{'parent':_0x2e556d['segments'][0x0],'child':_0x2e556d['segments']['slice'](0x1)[_0x5bfa98(0x107)]('/')};}export function isYamlFilePath(_0x540113){const _0x1bd90e=a154_0x289a;return _0x540113[_0x1bd90e(0x105)](_0x1bd90e(0xe9))||_0x540113['endsWith']('.yaml');}export async function resolveYamlFilePath(_0x1227b2,_0x4d6f4e=nodeFileSystem){const _0x2d63bf=a154_0x289a,_0x358eff=a154_0x2e5901[_0x2d63bf(0xe8)](_0x1227b2);if(!await _0x4d6f4e['exists'](_0x358eff))throw new Error(_0x2d63bf(0xff)+_0x1227b2);let _0x3102ce=a154_0x2e5901[_0x2d63bf(0xf8)](_0x358eff),_0x594776=null,_0x1f3931=null;const _0x20ab1d=a154_0x2e5901[_0x2d63bf(0xec)](_0x3102ce)[_0x2d63bf(0xef)];while(_0x3102ce!==_0x20ab1d){const _0xbe5a34=a154_0x2e5901[_0x2d63bf(0x107)](_0x3102ce,'tdx.json');if(await _0x4d6f4e[_0x2d63bf(0xe4)](_0xbe5a34)){_0x594776=_0xbe5a34,_0x1f3931=_0x3102ce;break;}_0x3102ce=a154_0x2e5901[_0x2d63bf(0xf8)](_0x3102ce);}if(!_0x594776||!_0x1f3931)throw new Error(_0x2d63bf(0x101)+_0x1227b2+'\x0a'+'Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.');const _0x1091e1=await _0x4d6f4e[_0x2d63bf(0xf7)](_0x594776),_0x109074=JSON['parse'](_0x1091e1),_0x1adaa9=_0x109074[_0x2d63bf(0xf4)];if(!_0x1adaa9)throw new Error(_0x2d63bf(0x10b));const _0x456072=await _0x4d6f4e[_0x2d63bf(0xf7)](_0x358eff),_0x345e37=a154_0x24051f(_0x456072),_0x582b13=_0x345e37['name'];if(!_0x582b13)throw new Error('Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'+_0x1227b2);const _0x445d6e=_0x345e37[_0x2d63bf(0xf1)]===_0x2d63bf(0xee)?'journey':_0x2d63bf(0xed),_0x47c72e=a154_0x2e5901[_0x2d63bf(0x103)](_0x1f3931,_0x358eff),_0x5d0b8e=a154_0x2e5901[_0x2d63bf(0xf8)](_0x47c72e),_0x275d9d=_0x5d0b8e==='.'?'':_0x5d0b8e[_0x2d63bf(0xe7)](/\\/g,'/'),_0x1f41ec=_0x275d9d?_0x1adaa9+'/'+_0x275d9d+'/'+_0x582b13:_0x1adaa9+'/'+_0x582b13;return{'parentSegment':_0x1adaa9,'segmentName':_0x582b13,'folderPath':_0x275d9d,'fullPath':_0x1f41ec,'resourceType':_0x445d6e,'content':_0x456072};}
@@ -1 +1 @@
1
- function a155_0x5b4f(_0x570f67,_0x436fe1){_0x570f67=_0x570f67-0x185;const _0x1d7d03=a155_0x1d7d();let _0x5b4f31=_0x1d7d03[_0x570f67];return _0x5b4f31;}function a155_0x1d7d(){const _0x198a70=['12988woGdvs','indexOf','Invalid\x20segment\x20reference\x20format:\x20','276gjwhaj','814548mxSAPP','substring','193897YadeRc','60aKYJDe','.\x20Child\x20name\x20cannot\x20be\x20empty','187730VSrNcE','132507XlJXEe','40BudIwh','530nLYzkW','4827632Tcjinw','2625cNGqPE','.\x20Parent\x20name\x20cannot\x20be\x20empty','8796SPPHsx'];a155_0x1d7d=function(){return _0x198a70;};return a155_0x1d7d();}(function(_0x4667fe,_0x421527){const _0xdd3ff4=a155_0x5b4f,_0xa8d9c5=_0x4667fe();while(!![]){try{const _0x5b265a=parseInt(_0xdd3ff4(0x185))/0x1+parseInt(_0xdd3ff4(0x192))/0x2*(-parseInt(_0xdd3ff4(0x195))/0x3)+parseInt(_0xdd3ff4(0x18c))/0x4*(-parseInt(_0xdd3ff4(0x18a))/0x5)+parseInt(_0xdd3ff4(0x191))/0x6*(parseInt(_0xdd3ff4(0x18f))/0x7)+-parseInt(_0xdd3ff4(0x18e))/0x8+-parseInt(_0xdd3ff4(0x18b))/0x9*(-parseInt(_0xdd3ff4(0x18d))/0xa)+-parseInt(_0xdd3ff4(0x187))/0xb*(-parseInt(_0xdd3ff4(0x188))/0xc);if(_0x5b265a===_0x421527)break;else _0xa8d9c5['push'](_0xa8d9c5['shift']());}catch(_0x1dfd31){_0xa8d9c5['push'](_0xa8d9c5['shift']());}}}(a155_0x1d7d,0xa0406));export function parseSegmentRef(_0x4445cc){const _0x940394=a155_0x5b4f,_0x5868ed=_0x4445cc[_0x940394(0x193)]('/');if(_0x5868ed===-0x1)return{'parentId':_0x4445cc};if(_0x5868ed===0x0)throw new Error(_0x940394(0x194)+_0x4445cc+_0x940394(0x190));const _0x416067=_0x4445cc[_0x940394(0x186)](0x0,_0x5868ed),_0x31b318=_0x4445cc[_0x940394(0x186)](_0x5868ed+0x1);if(_0x31b318==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x4445cc+_0x940394(0x189));return{'parentId':_0x416067,'childId':_0x31b318};}
1
+ function a155_0x1d4f(){const _0x59e4de=['9CqZCZM','5272825JXrLuB','Invalid\x20segment\x20reference\x20format:\x20','8852096GahPAP','810590SXdeNl','6qRMDWu','259309vuCBUv','977151KxcxFL','6140418qrfNoE','substring','114447BMFhXt','.\x20Parent\x20name\x20cannot\x20be\x20empty','48QbtTbH','indexOf'];a155_0x1d4f=function(){return _0x59e4de;};return a155_0x1d4f();}(function(_0x19dd3a,_0x51476d){const _0x5b060d=a155_0x5bdf,_0x4c4842=_0x19dd3a();while(!![]){try{const _0x5e1382=-parseInt(_0x5b060d(0x84))/0x1*(parseInt(_0x5b060d(0x83))/0x2)+parseInt(_0x5b060d(0x88))/0x3*(parseInt(_0x5b060d(0x8a))/0x4)+-parseInt(_0x5b060d(0x8d))/0x5+parseInt(_0x5b060d(0x86))/0x6+parseInt(_0x5b060d(0x85))/0x7+parseInt(_0x5b060d(0x8f))/0x8+-parseInt(_0x5b060d(0x8c))/0x9*(-parseInt(_0x5b060d(0x90))/0xa);if(_0x5e1382===_0x51476d)break;else _0x4c4842['push'](_0x4c4842['shift']());}catch(_0x5a428e){_0x4c4842['push'](_0x4c4842['shift']());}}}(a155_0x1d4f,0xee3f7));function a155_0x5bdf(_0x2d8339,_0x25da12){_0x2d8339=_0x2d8339-0x83;const _0x1d4fbc=a155_0x1d4f();let _0x5bdfbf=_0x1d4fbc[_0x2d8339];return _0x5bdfbf;}export function parseSegmentRef(_0x4a4b05){const _0x28d605=a155_0x5bdf,_0xffebaa=_0x4a4b05[_0x28d605(0x8b)]('/');if(_0xffebaa===-0x1)return{'parentId':_0x4a4b05};if(_0xffebaa===0x0)throw new Error(_0x28d605(0x8e)+_0x4a4b05+_0x28d605(0x89));const _0x489be6=_0x4a4b05[_0x28d605(0x87)](0x0,_0xffebaa),_0x67b517=_0x4a4b05[_0x28d605(0x87)](_0xffebaa+0x1);if(_0x67b517==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x4a4b05+'.\x20Child\x20name\x20cannot\x20be\x20empty');return{'parentId':_0x489be6,'childId':_0x67b517};}
@@ -1 +1 @@
1
- (function(_0x25a650,_0x396a61){const _0x130cbd=a156_0x525d,_0xe8d3d7=_0x25a650();while(!![]){try{const _0xaa8fb2=-parseInt(_0x130cbd(0x17d))/0x1*(parseInt(_0x130cbd(0x152))/0x2)+parseInt(_0x130cbd(0x170))/0x3+-parseInt(_0x130cbd(0x13e))/0x4+parseInt(_0x130cbd(0x172))/0x5+parseInt(_0x130cbd(0x16c))/0x6*(parseInt(_0x130cbd(0x150))/0x7)+parseInt(_0x130cbd(0x174))/0x8+parseInt(_0x130cbd(0x158))/0x9*(-parseInt(_0x130cbd(0x140))/0xa);if(_0xaa8fb2===_0x396a61)break;else _0xe8d3d7['push'](_0xe8d3d7['shift']());}catch(_0x5dd830){_0xe8d3d7['push'](_0xe8d3d7['shift']());}}}(a156_0x4ed3,0x8ab08));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0xae5c63,_0x5a70e8={},_0x127a69={}){const _0x46eea8=a156_0x525d;if(_0x127a69[_0x46eea8(0x14b)])return runSemanticChecks(_0xae5c63,_0x5a70e8);const _0x5695c4=SegmentDefSchema[_0x46eea8(0x149)](_0xae5c63);if(_0x5695c4[_0x46eea8(0x157)])return runSemanticChecks(_0x5695c4[_0x46eea8(0x166)],_0x5a70e8);return zodErrorsToValidationResult(_0x5695c4[_0x46eea8(0x15c)],_0x5a70e8);}function a156_0x525d(_0x7531e8,_0x3f1a99){_0x7531e8=_0x7531e8-0x13a;const _0x4ed3c8=a156_0x4ed3();let _0x525d34=_0x4ed3c8[_0x7531e8];return _0x525d34;}function a156_0x4ed3(){const _0x106701=['MISSING_NAME','360IhIDYD','attribute','description','INVALID_ARRAY_MATCHING','validationCode','success','144HlpMrk','code','invalid_value','conditions','error','path','rule','document','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','length','level','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','warning','data','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','MISSING_SEGMENT_REFERENCE','Attribute\x20name\x20cannot\x20be\x20empty','\x27\x20with\x20attribute\x20\x27','12qJaKeI','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','INVALID_OPERATOR_TYPE','Value','838299NfjTng','.attribute','3202490qCQZmB','MISSING_BETWEEN_BOUNDS','6744608GglHRa','name','rule.type','map','aggregation','type','filter','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','message','3772IGXeOu','Behavior','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','INVALID_RULE_TYPE','Attribute\x20\x27','MISSING_CONDITIONS','arrayMatching','MISSING_TIME_UNIT','SEGMENT_SCHEMA_ERROR','.conditions[','279692gWLgTv','And','827990seYPBe','endsWith','source','push','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','BEHAVIOR_SOURCE_MISSING_FILTER','NESTED_CONDITION_GROUP','EMPTY_CONDITIONS','issues','safeParse','params','skipSchema','.operator.value','.conditions','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','match','3075562ormGtX'];a156_0x4ed3=function(){return _0x106701;};return a156_0x4ed3();}export function validateRuleDef(_0xc67f6,_0x170a6c,_0x2bc0b4){const _0x47ef64=a156_0x525d;if(!_0xc67f6)return[];const _0x420375=RuleDefSchema[_0x47ef64(0x149)](_0xc67f6);if(_0x420375['success'])return checkRule(_0x420375['data'],_0x170a6c,_0x2bc0b4);const _0x2199eb=flattenZodIssues(_0x420375['error']['issues']);return _0x2199eb[_0x47ef64(0x177)](_0x2f4a9f=>{const _0xbd5ae7=_0x47ef64,_0x1475de=formatZodPath(_0x2f4a9f[_0xbd5ae7(0x15d)]),_0x841bb=_0x1475de?_0x170a6c+'.'+_0x1475de:_0x170a6c,_0x559157=mapZodIssueToCode(_0x2f4a9f,_0x1475de),_0xcfed4=getLocationFromPath(_0x2bc0b4[_0xbd5ae7(0x15f)],_0x2bc0b4[_0xbd5ae7(0x142)],pathToArray(_0x841bb));return{'level':_0xbd5ae7(0x15c),'path':_0x841bb,'code':_0x559157,'message':_0x2f4a9f[_0xbd5ae7(0x17c)],..._0xcfed4&&{'location':_0xcfed4}};});}function zodErrorsToValidationResult(_0x436af0,_0x203fa1){const _0x1f5e62=a156_0x525d,_0x131552=flattenZodIssues(_0x436af0[_0x1f5e62(0x148)]),_0x2af63a=_0x131552[_0x1f5e62(0x177)](_0x182e6f=>{const _0x47e569=_0x1f5e62,_0x15b259=formatZodPath(_0x182e6f['path']),_0x599755=mapZodIssueToCode(_0x182e6f,_0x15b259),_0x536009=getLocationFromPath(_0x203fa1[_0x47e569(0x15f)],_0x203fa1[_0x47e569(0x142)],_0x182e6f[_0x47e569(0x15d)][_0x47e569(0x177)](_0x2c51c4=>typeof _0x2c51c4==='symbol'?String(_0x2c51c4):_0x2c51c4));return{'level':_0x47e569(0x15c),'path':_0x15b259,'code':_0x599755,'message':_0x182e6f[_0x47e569(0x17c)],..._0x536009&&{'location':_0x536009}};});return{'valid':![],'errors':_0x2af63a,'warnings':[]};}function mapZodIssueToCode(_0x29c47b,_0x5cf22c){const _0x596598=a156_0x525d,_0x368575=_0x29c47b[_0x596598(0x159)]==='custom'?_0x29c47b[_0x596598(0x14a)]:undefined;if(_0x5cf22c===_0x596598(0x175))return _0x596598(0x151);if(_0x5cf22c===_0x596598(0x176)||_0x5cf22c[_0x596598(0x141)]('.type')){if(_0x29c47b[_0x596598(0x159)]===_0x596598(0x15a)){if(_0x5cf22c===_0x596598(0x176)||_0x5cf22c[_0x596598(0x14f)](/\.conditions\[\d+\]\.type$/))return _0x596598(0x180);}}if(_0x5cf22c[_0x596598(0x141)]('.operator.type'))return _0x596598(0x16e);if(_0x5cf22c[_0x596598(0x141)](_0x596598(0x14c)))return'MISSING_OPERATOR_VALUE';if(_0x368575?.['validationCode']===_0x596598(0x173))return _0x596598(0x173);if(_0x368575?.[_0x596598(0x156)]===_0x596598(0x13b))return _0x596598(0x13b);if(_0x5cf22c['endsWith'](_0x596598(0x14d))||_0x5cf22c===_0x596598(0x15b))return _0x596598(0x182);if(_0x5cf22c['includes'](_0x596598(0x13a)))return _0x596598(0x155);if(_0x5cf22c[_0x596598(0x141)]('.segment'))return _0x596598(0x169);return _0x596598(0x13c);}function runSemanticChecks(_0x305b9c,_0x211e0f){const _0x1ca710=a156_0x525d,_0x2a1124=[];_0x305b9c['rule']&&_0x2a1124[_0x1ca710(0x143)](...checkRule(_0x305b9c[_0x1ca710(0x15e)],_0x1ca710(0x15e),_0x211e0f));const _0x15fe8e=_0x2a1124[_0x1ca710(0x17a)](_0x6d8809=>_0x6d8809[_0x1ca710(0x162)]===_0x1ca710(0x15c)),_0x4aef51=_0x2a1124[_0x1ca710(0x17a)](_0x5d25c2=>_0x5d25c2['level']==='warning');return{'valid':_0x15fe8e['length']===0x0,'errors':_0x15fe8e,'warnings':_0x4aef51};}function checkRule(_0x4a0ff8,_0x201e91,_0x1a9598){const _0x4854ce=a156_0x525d,_0x479eed=[];if(_0x4a0ff8[_0x4854ce(0x15b)]['length']===0x0)return _0x479eed[_0x4854ce(0x143)]({'level':'error','path':_0x201e91+'.conditions','code':_0x4854ce(0x147),'message':_0x4854ce(0x168),'location':getLocationFromPath(_0x1a9598[_0x4854ce(0x15f)],_0x1a9598['source'],pathToArray(_0x201e91+_0x4854ce(0x14d)))}),_0x479eed;return _0x479eed[_0x4854ce(0x143)](...checkConditions(_0x4a0ff8[_0x4854ce(0x15b)],_0x201e91,_0x1a9598)),_0x479eed;}function checkConditions(_0x1f2b36,_0x5ca794,_0x1e8e8b){const _0x168e51=a156_0x525d,_0x8af913=[];for(let _0x412032=0x0;_0x412032<_0x1f2b36[_0x168e51(0x161)];_0x412032++){const _0x28b25a=_0x1f2b36[_0x412032],_0x572670=_0x5ca794+_0x168e51(0x13d)+_0x412032+']';_0x8af913[_0x168e51(0x143)](...checkCondition(_0x28b25a,_0x572670,_0x1e8e8b));}return _0x8af913;}function checkCondition(_0x384bde,_0x5bc70c,_0x162078){const _0x4f3f5d=a156_0x525d,_0x1b1831=[];if(_0x384bde[_0x4f3f5d(0x179)]===_0x4f3f5d(0x13f)||_0x384bde[_0x4f3f5d(0x179)]==='Or'){if(_0x384bde['conditions'][_0x4f3f5d(0x161)]===0x0)_0x1b1831['push']({'level':'error','path':_0x5bc70c+_0x4f3f5d(0x14d),'code':'EMPTY_CONDITIONS','message':_0x384bde[_0x4f3f5d(0x179)]+_0x4f3f5d(0x17f),'location':getLocationFromPath(_0x162078[_0x4f3f5d(0x15f)],_0x162078[_0x4f3f5d(0x142)],pathToArray(_0x5bc70c+_0x4f3f5d(0x14d)))});else{const _0xb03869=_0x384bde[_0x4f3f5d(0x154)]!==undefined;!_0xb03869&&_0x1b1831[_0x4f3f5d(0x143)]({'level':_0x4f3f5d(0x165),'path':_0x5bc70c,'code':_0x4f3f5d(0x146),'message':_0x384bde[_0x4f3f5d(0x179)]+_0x4f3f5d(0x17b)+_0x4f3f5d(0x144)+'conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','location':getLocationFromPath(_0x162078[_0x4f3f5d(0x15f)],_0x162078[_0x4f3f5d(0x142)],pathToArray(_0x5bc70c))}),_0x1b1831[_0x4f3f5d(0x143)](...checkConditions(_0x384bde[_0x4f3f5d(0x15b)],_0x5bc70c,_0x162078));}return _0x1b1831;}if(_0x384bde[_0x4f3f5d(0x179)]===_0x4f3f5d(0x16f)||_0x384bde[_0x4f3f5d(0x179)]===_0x4f3f5d(0x17e)){const _0x5be8e3=_0x384bde,_0x308458=_0x5be8e3[_0x4f3f5d(0x142)],_0x6b3e28=_0x5be8e3[_0x4f3f5d(0x178)],_0x506378=_0x308458||_0x6b3e28;(!_0x5be8e3[_0x4f3f5d(0x153)]||_0x5be8e3[_0x4f3f5d(0x153)]==='')&&(!_0x506378&&_0x1b1831[_0x4f3f5d(0x143)]({'level':_0x4f3f5d(0x15c),'path':_0x5bc70c+_0x4f3f5d(0x171),'code':'EMPTY_ATTRIBUTE','message':_0x4f3f5d(0x16a),'location':getLocationFromPath(_0x162078[_0x4f3f5d(0x15f)],_0x162078['source'],pathToArray(_0x5bc70c+_0x4f3f5d(0x171)))}));_0x5be8e3['filter']&&_0x1b1831[_0x4f3f5d(0x143)](...checkRule(_0x5be8e3[_0x4f3f5d(0x17a)],_0x5bc70c+'.filter',_0x162078));if(_0x5be8e3[_0x4f3f5d(0x142)]){const _0x37a176=_0x5be8e3[_0x4f3f5d(0x153)]&&_0x5be8e3[_0x4f3f5d(0x153)]!=='';_0x37a176&&!_0x5be8e3['filter']&&_0x1b1831[_0x4f3f5d(0x143)]({'level':_0x4f3f5d(0x15c),'path':_0x5bc70c+'.source','code':_0x4f3f5d(0x145),'message':'Behavior\x20source\x20\x27'+_0x5be8e3['source']+_0x4f3f5d(0x16b)+_0x5be8e3[_0x4f3f5d(0x153)]+'\x27\x20'+_0x4f3f5d(0x167)+_0x4f3f5d(0x16d)+_0x4f3f5d(0x164),'location':getLocationFromPath(_0x162078[_0x4f3f5d(0x15f)],_0x162078[_0x4f3f5d(0x142)],pathToArray(_0x5bc70c+'.source'))}),_0x37a176&&_0x5be8e3[_0x4f3f5d(0x17a)]&&_0x1b1831[_0x4f3f5d(0x143)]({'level':_0x4f3f5d(0x165),'path':_0x5bc70c+_0x4f3f5d(0x171),'code':_0x4f3f5d(0x163),'message':_0x4f3f5d(0x181)+_0x5be8e3[_0x4f3f5d(0x153)]+_0x4f3f5d(0x14e)+_0x4f3f5d(0x160),'location':getLocationFromPath(_0x162078['document'],_0x162078[_0x4f3f5d(0x142)],pathToArray(_0x5bc70c+_0x4f3f5d(0x171)))});}}return _0x1b1831;}
1
+ function a156_0x4797(_0x16d7a6,_0x3ba066){_0x16d7a6=_0x16d7a6-0x9d;const _0x528cfb=a156_0x528c();let _0x47975e=_0x528cfb[_0x16d7a6];return _0x47975e;}(function(_0x1cdc5a,_0x310758){const _0x4c6e8a=a156_0x4797,_0x29261e=_0x1cdc5a();while(!![]){try{const _0x21c240=parseInt(_0x4c6e8a(0x9f))/0x1+parseInt(_0x4c6e8a(0xa3))/0x2+parseInt(_0x4c6e8a(0xc0))/0x3*(parseInt(_0x4c6e8a(0xbd))/0x4)+parseInt(_0x4c6e8a(0xab))/0x5+-parseInt(_0x4c6e8a(0xdf))/0x6+-parseInt(_0x4c6e8a(0xda))/0x7*(-parseInt(_0x4c6e8a(0xba))/0x8)+parseInt(_0x4c6e8a(0xac))/0x9*(-parseInt(_0x4c6e8a(0xbf))/0xa);if(_0x21c240===_0x310758)break;else _0x29261e['push'](_0x29261e['shift']());}catch(_0x53b8d6){_0x29261e['push'](_0x29261e['shift']());}}}(a156_0x528c,0xdbe4b));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0xf11bf,_0x421989={},_0x2ed01c={}){const _0x20becc=a156_0x4797;if(_0x2ed01c[_0x20becc(0x9d)])return runSemanticChecks(_0xf11bf,_0x421989);const _0x78e623=SegmentDefSchema[_0x20becc(0xb6)](_0xf11bf);if(_0x78e623[_0x20becc(0xa4)])return runSemanticChecks(_0x78e623['data'],_0x421989);return zodErrorsToValidationResult(_0x78e623[_0x20becc(0xbe)],_0x421989);}export function validateRuleDef(_0x244864,_0x443108,_0x28cbb8){const _0x2ac9cb=a156_0x4797;if(!_0x244864)return[];const _0x1a43f5=RuleDefSchema[_0x2ac9cb(0xb6)](_0x244864);if(_0x1a43f5['success'])return checkRule(_0x1a43f5['data'],_0x443108,_0x28cbb8);const _0x337587=flattenZodIssues(_0x1a43f5[_0x2ac9cb(0xbe)][_0x2ac9cb(0xaa)]);return _0x337587[_0x2ac9cb(0xa8)](_0x2b33ed=>{const _0x10bca7=_0x2ac9cb,_0x1b4375=formatZodPath(_0x2b33ed[_0x10bca7(0xaf)]),_0x234aba=_0x1b4375?_0x443108+'.'+_0x1b4375:_0x443108,_0x21abec=mapZodIssueToCode(_0x2b33ed,_0x1b4375),_0x28b8ec=getLocationFromPath(_0x28cbb8[_0x10bca7(0xd6)],_0x28cbb8['source'],pathToArray(_0x234aba));return{'level':_0x10bca7(0xbe),'path':_0x234aba,'code':_0x21abec,'message':_0x2b33ed[_0x10bca7(0xb0)],..._0x28b8ec&&{'location':_0x28b8ec}};});}function zodErrorsToValidationResult(_0x5caaa3,_0x95df7a){const _0x5cdc07=a156_0x4797,_0x595fc9=flattenZodIssues(_0x5caaa3[_0x5cdc07(0xaa)]),_0x146681=_0x595fc9[_0x5cdc07(0xa8)](_0x4e2945=>{const _0x47b4ef=_0x5cdc07,_0x2ccdb6=formatZodPath(_0x4e2945[_0x47b4ef(0xaf)]),_0x195298=mapZodIssueToCode(_0x4e2945,_0x2ccdb6),_0x3083a3=getLocationFromPath(_0x95df7a[_0x47b4ef(0xd6)],_0x95df7a[_0x47b4ef(0xbc)],_0x4e2945[_0x47b4ef(0xaf)][_0x47b4ef(0xa8)](_0x209946=>typeof _0x209946==='symbol'?String(_0x209946):_0x209946));return{'level':'error','path':_0x2ccdb6,'code':_0x195298,'message':_0x4e2945[_0x47b4ef(0xb0)],..._0x3083a3&&{'location':_0x3083a3}};});return{'valid':![],'errors':_0x146681,'warnings':[]};}function mapZodIssueToCode(_0x15c21a,_0x1d35d9){const _0x52a946=a156_0x4797,_0x1eba58=_0x15c21a[_0x52a946(0xb2)]===_0x52a946(0xcb)?_0x15c21a[_0x52a946(0xa7)]:undefined;if(_0x1d35d9==='name')return _0x52a946(0xa5);if(_0x1d35d9===_0x52a946(0xd1)||_0x1d35d9[_0x52a946(0xd3)](_0x52a946(0xc4))){if(_0x15c21a['code']===_0x52a946(0xb3)){if(_0x1d35d9===_0x52a946(0xd1)||_0x1d35d9[_0x52a946(0xd7)](/\.conditions\[\d+\]\.type$/))return'INVALID_RULE_TYPE';}}if(_0x1d35d9[_0x52a946(0xd3)]('.operator.type'))return _0x52a946(0xd2);if(_0x1d35d9['endsWith'](_0x52a946(0xb1)))return _0x52a946(0xc9);if(_0x1eba58?.[_0x52a946(0xbb)]===_0x52a946(0xcf))return _0x52a946(0xcf);if(_0x1eba58?.[_0x52a946(0xbb)]===_0x52a946(0xd4))return'MISSING_TIME_UNIT';if(_0x1d35d9['endsWith'](_0x52a946(0x9e))||_0x1d35d9==='conditions')return _0x52a946(0xc2);if(_0x1d35d9[_0x52a946(0xc3)]('arrayMatching'))return'INVALID_ARRAY_MATCHING';if(_0x1d35d9[_0x52a946(0xd3)](_0x52a946(0xc5)))return'MISSING_SEGMENT_REFERENCE';return _0x52a946(0xb4);}function runSemanticChecks(_0x1f60c5,_0x3c8e00){const _0x4c3fe1=a156_0x4797,_0x14bdf2=[];_0x1f60c5[_0x4c3fe1(0xb5)]&&_0x14bdf2[_0x4c3fe1(0xc1)](...checkRule(_0x1f60c5[_0x4c3fe1(0xb5)],_0x4c3fe1(0xb5),_0x3c8e00));const _0x50ba19=_0x14bdf2[_0x4c3fe1(0xa1)](_0x3dec35=>_0x3dec35[_0x4c3fe1(0xad)]===_0x4c3fe1(0xbe)),_0x4cb7c3=_0x14bdf2[_0x4c3fe1(0xa1)](_0x3e8cfe=>_0x3e8cfe[_0x4c3fe1(0xad)]===_0x4c3fe1(0xc6));return{'valid':_0x50ba19[_0x4c3fe1(0xd0)]===0x0,'errors':_0x50ba19,'warnings':_0x4cb7c3};}function a156_0x528c(){const _0x4c16fc=['attribute','.conditions[','MISSING_OPERATOR_VALUE','Behavior','custom','And','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','MISSING_BETWEEN_BOUNDS','length','rule.type','INVALID_OPERATOR_TYPE','endsWith','MISSING_TIME_UNIT','conditions','document','match','NESTED_CONDITION_GROUP','type','7aDFRCS','.filter','\x27\x20with\x20attribute\x20\x27','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','EMPTY_CONDITIONS','1664808qDXPfe','skipSchema','.conditions','581007QOpuWy','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','filter','EMPTY_ATTRIBUTE','1794416gVLFPk','success','MISSING_NAME','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','params','map','Attribute\x20\x27','issues','1844455aUJbfP','18vLMQJL','level','BEHAVIOR_SOURCE_MISSING_FILTER','path','message','.operator.value','code','invalid_value','SEGMENT_SCHEMA_ERROR','rule','safeParse','Attribute\x20name\x20cannot\x20be\x20empty','.attribute','.source','6453864qsukcj','validationCode','source','6741016xJNIWa','error','15804710eNInZk','3ZoPjra','push','MISSING_CONDITIONS','includes','.type','.segment','warning'];a156_0x528c=function(){return _0x4c16fc;};return a156_0x528c();}function checkRule(_0x1fd92f,_0xcef25e,_0x248f7d){const _0x5c0d2b=a156_0x4797,_0x522547=[];if(_0x1fd92f[_0x5c0d2b(0xd5)]['length']===0x0)return _0x522547[_0x5c0d2b(0xc1)]({'level':_0x5c0d2b(0xbe),'path':_0xcef25e+_0x5c0d2b(0x9e),'code':_0x5c0d2b(0xde),'message':'Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','location':getLocationFromPath(_0x248f7d['document'],_0x248f7d[_0x5c0d2b(0xbc)],pathToArray(_0xcef25e+_0x5c0d2b(0x9e)))}),_0x522547;return _0x522547[_0x5c0d2b(0xc1)](...checkConditions(_0x1fd92f[_0x5c0d2b(0xd5)],_0xcef25e,_0x248f7d)),_0x522547;}function checkConditions(_0x2bae45,_0x1d179e,_0x55e7e8){const _0x587018=a156_0x4797,_0x2abf28=[];for(let _0x2e56cb=0x0;_0x2e56cb<_0x2bae45[_0x587018(0xd0)];_0x2e56cb++){const _0x368ddb=_0x2bae45[_0x2e56cb],_0x19f355=_0x1d179e+_0x587018(0xc8)+_0x2e56cb+']';_0x2abf28[_0x587018(0xc1)](...checkCondition(_0x368ddb,_0x19f355,_0x55e7e8));}return _0x2abf28;}function checkCondition(_0x2bc080,_0x40df6f,_0x487bea){const _0x42243b=a156_0x4797,_0x39ee1a=[];if(_0x2bc080[_0x42243b(0xd9)]===_0x42243b(0xcc)||_0x2bc080[_0x42243b(0xd9)]==='Or'){if(_0x2bc080[_0x42243b(0xd5)][_0x42243b(0xd0)]===0x0)_0x39ee1a['push']({'level':'error','path':_0x40df6f+_0x42243b(0x9e),'code':'EMPTY_CONDITIONS','message':_0x2bc080[_0x42243b(0xd9)]+'\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','location':getLocationFromPath(_0x487bea['document'],_0x487bea[_0x42243b(0xbc)],pathToArray(_0x40df6f+_0x42243b(0x9e)))});else{const _0x49861a=_0x2bc080['description']!==undefined;!_0x49861a&&_0x39ee1a[_0x42243b(0xc1)]({'level':_0x42243b(0xc6),'path':_0x40df6f,'code':_0x42243b(0xd8),'message':_0x2bc080[_0x42243b(0xd9)]+'\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20'+_0x42243b(0xa6)+_0x42243b(0xa0),'location':getLocationFromPath(_0x487bea[_0x42243b(0xd6)],_0x487bea[_0x42243b(0xbc)],pathToArray(_0x40df6f))}),_0x39ee1a['push'](...checkConditions(_0x2bc080[_0x42243b(0xd5)],_0x40df6f,_0x487bea));}return _0x39ee1a;}if(_0x2bc080[_0x42243b(0xd9)]==='Value'||_0x2bc080[_0x42243b(0xd9)]===_0x42243b(0xca)){const _0x1febc7=_0x2bc080,_0x313ae4=_0x1febc7[_0x42243b(0xbc)],_0x1eb8fc=_0x1febc7['aggregation'],_0x4a4089=_0x313ae4||_0x1eb8fc;(!_0x1febc7[_0x42243b(0xc7)]||_0x1febc7[_0x42243b(0xc7)]==='')&&(!_0x4a4089&&_0x39ee1a['push']({'level':_0x42243b(0xbe),'path':_0x40df6f+'.attribute','code':_0x42243b(0xa2),'message':_0x42243b(0xb7),'location':getLocationFromPath(_0x487bea[_0x42243b(0xd6)],_0x487bea[_0x42243b(0xbc)],pathToArray(_0x40df6f+_0x42243b(0xb8)))}));_0x1febc7[_0x42243b(0xa1)]&&_0x39ee1a[_0x42243b(0xc1)](...checkRule(_0x1febc7[_0x42243b(0xa1)],_0x40df6f+_0x42243b(0xdb),_0x487bea));if(_0x1febc7[_0x42243b(0xbc)]){const _0xc4c6a9=_0x1febc7[_0x42243b(0xc7)]&&_0x1febc7[_0x42243b(0xc7)]!=='';_0xc4c6a9&&!_0x1febc7[_0x42243b(0xa1)]&&_0x39ee1a[_0x42243b(0xc1)]({'level':'error','path':_0x40df6f+_0x42243b(0xb9),'code':_0x42243b(0xae),'message':'Behavior\x20source\x20\x27'+_0x1febc7[_0x42243b(0xbc)]+_0x42243b(0xdc)+_0x1febc7[_0x42243b(0xc7)]+'\x27\x20'+'requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20'+'the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20'+_0x42243b(0xce),'location':getLocationFromPath(_0x487bea['document'],_0x487bea[_0x42243b(0xbc)],pathToArray(_0x40df6f+_0x42243b(0xb9)))}),_0xc4c6a9&&_0x1febc7[_0x42243b(0xa1)]&&_0x39ee1a[_0x42243b(0xc1)]({'level':'warning','path':_0x40df6f+_0x42243b(0xb8),'code':'BEHAVIOR_SOURCE_WITH_ATTRIBUTE','message':_0x42243b(0xa9)+_0x1febc7[_0x42243b(0xc7)]+_0x42243b(0xcd)+_0x42243b(0xdd),'location':getLocationFromPath(_0x487bea[_0x42243b(0xd6)],_0x487bea[_0x42243b(0xbc)],pathToArray(_0x40df6f+_0x42243b(0xb8)))});}}return _0x39ee1a;}