@treasuredata/tdx 2026.6.3 → 2026.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/cas-command.js +1 -1
  13. package/dist/commands/cas-segment-command.js +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.js +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/connection-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-command.js +1 -1
  27. package/dist/commands/engage-template-pull-command.js +1 -1
  28. package/dist/commands/engage-template-push-command.js +1 -1
  29. package/dist/commands/engage-template-validate-command.js +1 -1
  30. package/dist/commands/job-command.js +1 -1
  31. package/dist/commands/journey-command.js +1 -1
  32. package/dist/commands/journey-validate-command.js +1 -1
  33. package/dist/commands/llm-command.js +1 -1
  34. package/dist/commands/mcp-command.js +1 -1
  35. package/dist/commands/parent-segment-command.js +1 -1
  36. package/dist/commands/policy-command.js +1 -1
  37. package/dist/commands/profile-command.js +1 -1
  38. package/dist/commands/profiles-command.js +1 -1
  39. package/dist/commands/query-command.js +1 -1
  40. package/dist/commands/schedule-command.js +1 -1
  41. package/dist/commands/segment-command.js +1 -1
  42. package/dist/commands/segment-create-command.js +1 -1
  43. package/dist/commands/segment-fields-command.js +1 -1
  44. package/dist/commands/segment-pull-command.js +1 -1
  45. package/dist/commands/segment-push-command.js +1 -1
  46. package/dist/commands/segment-update-command.js +1 -1
  47. package/dist/commands/segment-use-command.js +1 -1
  48. package/dist/commands/segment-validate-command.js +1 -1
  49. package/dist/commands/segments.js +1 -1
  50. package/dist/commands/show.js +1 -1
  51. package/dist/commands/status-command.js +1 -1
  52. package/dist/commands/table-deleted.js +1 -1
  53. package/dist/commands/tables.js +1 -1
  54. package/dist/commands/unset-command.js +1 -1
  55. package/dist/commands/upgrade-command.js +1 -1
  56. package/dist/commands/use-command.js +1 -1
  57. package/dist/commands/user-command.js +1 -1
  58. package/dist/commands/work-command.js +1 -1
  59. package/dist/commands/workflow-command.js +1 -1
  60. package/dist/core/auth.js +1 -1
  61. package/dist/core/command-output.js +1 -1
  62. package/dist/core/config.d.ts +14 -0
  63. package/dist/core/config.d.ts.map +1 -1
  64. package/dist/core/config.js +1 -1
  65. package/dist/core/config.js.map +1 -1
  66. package/dist/core/connection-cache.js +1 -1
  67. package/dist/core/constants.js +1 -1
  68. package/dist/core/credential-cache.js +1 -1
  69. package/dist/core/global-context.js +1 -1
  70. package/dist/core/keychain.js +1 -1
  71. package/dist/core/oauth-keychain.js +1 -1
  72. package/dist/core/oauth.js +1 -1
  73. package/dist/core/profile.js +1 -1
  74. package/dist/core/project-config.d.ts +1 -0
  75. package/dist/core/project-config.d.ts.map +1 -1
  76. package/dist/core/project-config.js +1 -1
  77. package/dist/core/project-config.js.map +1 -1
  78. package/dist/core/session.js +1 -1
  79. package/dist/core/user-cache.js +1 -1
  80. package/dist/core/version.js +1 -1
  81. package/dist/index.js +1 -1
  82. package/dist/mcp/server.js +1 -1
  83. package/dist/mcp/tools/index.js +1 -1
  84. package/dist/mcp/tools/tdx-run.js +1 -1
  85. package/dist/mcp/tools/tdx-search.d.ts.map +1 -1
  86. package/dist/mcp/tools/tdx-search.js +1 -1
  87. package/dist/mcp/tools/tdx-search.js.map +1 -1
  88. package/dist/mcp/tools/work-create-item.js +1 -1
  89. package/dist/mcp/utils.js +1 -1
  90. package/dist/proxy/claude-usage-tracker.js +1 -1
  91. package/dist/proxy/passthrough-server.js +1 -1
  92. package/dist/proxy/sse-usage-parser.js +1 -1
  93. package/dist/sdk/agent/agent-config.js +1 -1
  94. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  95. package/dist/sdk/agent/agent-yaml.js +1 -1
  96. package/dist/sdk/agent/test/evaluator.js +1 -1
  97. package/dist/sdk/agent/test/executor.js +1 -1
  98. package/dist/sdk/agent/test/index.js +1 -1
  99. package/dist/sdk/agent/test/output.js +1 -1
  100. package/dist/sdk/agent/test/parser.js +1 -1
  101. package/dist/sdk/agent/tool-target-registry.js +1 -1
  102. package/dist/sdk/api.js +1 -1
  103. package/dist/sdk/cas/cas-api-client.js +1 -1
  104. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  105. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  106. package/dist/sdk/cas/index.js +1 -1
  107. package/dist/sdk/cas/pull-workflow.js +1 -1
  108. package/dist/sdk/cas/push-workflow.js +1 -1
  109. package/dist/sdk/client/cdp-api-client.js +1 -1
  110. package/dist/sdk/client/delivery-api-client.js +1 -1
  111. package/dist/sdk/client/endpoints.js +1 -1
  112. package/dist/sdk/client/engage-api-client.js +1 -1
  113. package/dist/sdk/client/http-client.js +1 -1
  114. package/dist/sdk/client/llm-api-client.js +1 -1
  115. package/dist/sdk/client/oauth-refresh.js +1 -1
  116. package/dist/sdk/client/rate-limiter.js +1 -1
  117. package/dist/sdk/client/td-api-client.js +1 -1
  118. package/dist/sdk/client/trino-api-client.js +1 -1
  119. package/dist/sdk/client/workflow-client.js +1 -1
  120. package/dist/sdk/connection-validator.js +1 -1
  121. package/dist/sdk/connection.js +1 -1
  122. package/dist/sdk/delivery.js +1 -1
  123. package/dist/sdk/engage/campaign-pull.js +1 -1
  124. package/dist/sdk/engage/campaign-push.js +1 -1
  125. package/dist/sdk/engage/campaign-validator.js +1 -1
  126. package/dist/sdk/engage/campaign-yaml.js +1 -1
  127. package/dist/sdk/engage/template-pull.js +1 -1
  128. package/dist/sdk/engage/template-push.js +1 -1
  129. package/dist/sdk/engage/template-validator.js +1 -1
  130. package/dist/sdk/engage/template-yaml.js +1 -1
  131. package/dist/sdk/engage/types/campaign-def.js +1 -1
  132. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  133. package/dist/sdk/engage/types/template-schema.js +1 -1
  134. package/dist/sdk/engage.js +1 -1
  135. package/dist/sdk/errors.js +1 -1
  136. package/dist/sdk/index.js +1 -1
  137. package/dist/sdk/io/index.js +1 -1
  138. package/dist/sdk/io/node-filesystem.js +1 -1
  139. package/dist/sdk/job.js +1 -1
  140. package/dist/sdk/journey.js +1 -1
  141. package/dist/sdk/llm/chat-cache.js +1 -1
  142. package/dist/sdk/llm/index.js +1 -1
  143. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  144. package/dist/sdk/llm/model-factors.js +1 -1
  145. package/dist/sdk/llm/user-settings.js +1 -1
  146. package/dist/sdk/personalization.js +1 -1
  147. package/dist/sdk/policy.js +1 -1
  148. package/dist/sdk/query/deleted-table-validation.js +1 -1
  149. package/dist/sdk/query/index.js +1 -1
  150. package/dist/sdk/query/sql-parser.js +1 -1
  151. package/dist/sdk/realtime.js +1 -1
  152. package/dist/sdk/schedule.js +1 -1
  153. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  154. package/dist/sdk/segment/fields-display.js +1 -1
  155. package/dist/sdk/segment/file-discovery.js +1 -1
  156. package/dist/sdk/segment/journey-utils.js +1 -1
  157. package/dist/sdk/segment/journey-validator.js +1 -1
  158. package/dist/sdk/segment/journey-yaml.js +1 -1
  159. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  160. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  161. package/dist/sdk/segment/pull-workflow.js +1 -1
  162. package/dist/sdk/segment/push-recovery.js +1 -1
  163. package/dist/sdk/segment/push-workflow.js +1 -1
  164. package/dist/sdk/segment/resolution-context.js +1 -1
  165. package/dist/sdk/segment/segment-path-parser.js +1 -1
  166. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  167. package/dist/sdk/segment/segment-validator.js +1 -1
  168. package/dist/sdk/segment/target-resolution.js +1 -1
  169. package/dist/sdk/segment/tdx-config.js +1 -1
  170. package/dist/sdk/segment/types/activation-schema.js +1 -1
  171. package/dist/sdk/segment/types/journey-def.js +1 -1
  172. package/dist/sdk/segment/types/journey-schema.js +1 -1
  173. package/dist/sdk/segment/types/segment-def.js +1 -1
  174. package/dist/sdk/segment/types/segment-schema.js +1 -1
  175. package/dist/sdk/segment/validate-files.js +1 -1
  176. package/dist/sdk/segment/yaml-validator.js +1 -1
  177. package/dist/sdk/segment.js +1 -1
  178. package/dist/sdk/types/index.js +1 -1
  179. package/dist/sdk/types/progress.js +1 -1
  180. package/dist/sdk/types/workspace.js +1 -1
  181. package/dist/sdk/user.js +1 -1
  182. package/dist/sdk/util/format-detector.js +1 -1
  183. package/dist/sdk/util/formatters.js +1 -1
  184. package/dist/sdk/util/index.js +1 -1
  185. package/dist/sdk/util/paginate.js +1 -1
  186. package/dist/sdk/util/tree-formatter.js +1 -1
  187. package/dist/sdk/workflow/archive-validation.js +1 -1
  188. package/dist/sdk/workflow/clone-workflow.js +1 -1
  189. package/dist/sdk/workflow/index.js +1 -1
  190. package/dist/sdk/workflow/pull-workflow.js +1 -1
  191. package/dist/sdk/workflow/push-workflow.js +1 -1
  192. package/dist/sdk/workflow/task-graph.js +1 -1
  193. package/dist/sdk/workflow/tdx-config.js +1 -1
  194. package/dist/sdk/workflow/workflow-utils.js +1 -1
  195. package/dist/sdk/workspace/access-tracker.js +1 -1
  196. package/dist/sdk/workspace/frontmatter.js +1 -1
  197. package/dist/sdk/workspace/git.js +1 -1
  198. package/dist/sdk/workspace/index.js +1 -1
  199. package/dist/sdk/workspace/templates.js +1 -1
  200. package/dist/sdk/workspace/weekly.js +1 -1
  201. package/dist/sdk/workspace/wikilinks.js +1 -1
  202. package/dist/test-utils/command-runner.js +1 -1
  203. package/dist/test-utils/factories.js +1 -1
  204. package/dist/test-utils/fixtures.js +1 -1
  205. package/dist/test-utils/http-mock.js +1 -1
  206. package/dist/test-utils/index.js +1 -1
  207. package/dist/utils/async.js +1 -1
  208. package/dist/utils/colors.js +1 -1
  209. package/dist/utils/diff.js +1 -1
  210. package/dist/utils/file-permissions.js +1 -1
  211. package/dist/utils/file-reader.js +1 -1
  212. package/dist/utils/github-releases.js +1 -1
  213. package/dist/utils/global-cache.js +1 -1
  214. package/dist/utils/json-loader.js +1 -1
  215. package/dist/utils/local-cache.js +1 -1
  216. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  217. package/dist/utils/logger/formatters/index.js +1 -1
  218. package/dist/utils/logger/handlers/console-handler.js +1 -1
  219. package/dist/utils/logger/handlers/file-handler.js +1 -1
  220. package/dist/utils/logger/handlers/index.js +1 -1
  221. package/dist/utils/logger/handlers/null-handler.js +1 -1
  222. package/dist/utils/logger/index.js +1 -1
  223. package/dist/utils/logger/logger.js +1 -1
  224. package/dist/utils/logger/types.js +1 -1
  225. package/dist/utils/option-validation.js +1 -1
  226. package/dist/utils/process.js +1 -1
  227. package/dist/utils/prompt.js +1 -1
  228. package/dist/utils/spinner.js +1 -1
  229. package/dist/utils/sse-parser.js +1 -1
  230. package/dist/utils/string-utils.js +1 -1
  231. package/dist/utils/table-ref-parser.js +1 -1
  232. package/dist/utils/tdx-logger.js +1 -1
  233. package/dist/utils/version-check.js +1 -1
  234. package/package.json +1 -1
@@ -1 +1 @@
1
- (function(_0x15684c,_0x315bb3){const _0x3121f8=a155_0x2858,_0x26ee65=_0x15684c();while(!![]){try{const _0x3f4f9a=-parseInt(_0x3121f8(0x1f6))/0x1*(-parseInt(_0x3121f8(0x215))/0x2)+-parseInt(_0x3121f8(0x29e))/0x3*(-parseInt(_0x3121f8(0x1fd))/0x4)+-parseInt(_0x3121f8(0x2a2))/0x5*(-parseInt(_0x3121f8(0x21e))/0x6)+-parseInt(_0x3121f8(0x218))/0x7*(parseInt(_0x3121f8(0x1f1))/0x8)+-parseInt(_0x3121f8(0x281))/0x9+parseInt(_0x3121f8(0x282))/0xa+-parseInt(_0x3121f8(0x25d))/0xb;if(_0x3f4f9a===_0x315bb3)break;else _0x26ee65['push'](_0x26ee65['shift']());}catch(_0x333216){_0x26ee65['push'](_0x26ee65['shift']());}}}(a155_0x5a28,0xbc502));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of']('tdx.sdk.push-workflow');export const PENDING_SEGMENT_PREFIX='__pending_';export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0x1dd188){return''+PENDING_SEGMENT_PREFIX+_0x1dd188+'__';}export function isPendingSegmentId(_0x3b8504){const _0x398e3c=a155_0x2858;return _0x3b8504[_0x398e3c(0x229)](PENDING_SEGMENT_PREFIX)&&!_0x3b8504['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x3eb337){const _0x47bd8b=a155_0x2858;return _0x3eb337[_0x47bd8b(0x290)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x5c5f0b){return''+PENDING_ACTIVATION_PREFIX+_0x5c5f0b+'__';}export function isPendingActivationId(_0x452030){const _0x39403a=a155_0x2858;return _0x452030[_0x39403a(0x229)](PENDING_ACTIVATION_PREFIX);}function a155_0x2858(_0x3392a8,_0x413599){_0x3392a8=_0x3392a8-0x1bc;const _0x5a28bf=a155_0x5a28();let _0x2858d2=_0x5a28bf[_0x3392a8];return _0x2858d2;}export function extractPendingActivationName(_0x3966bb){const _0x109fab=a155_0x2858;return _0x3966bb[_0x109fab(0x290)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x47b896,_0x51c5ae){const _0x327235=a155_0x2858,_0x246973=_0x47b896+'::'+(_0x51c5ae['trim']()||'segment'),_0x409ba9=createHash('sha1')['update'](_0x246973)[_0x327235(0x2a9)](_0x327235(0x210))[_0x327235(0x2a1)](0x0,0xc);return'journey_entry_criteria_'+_0x409ba9;}export function ensureJourneyDefaults(_0x4db790){const _0x4adc93=a155_0x2858;!_0x4db790[_0x4adc93(0x25a)]&&(_0x4db790[_0x4adc93(0x25a)]=''),!_0x4db790[_0x4adc93(0x1da)]&&(_0x4db790[_0x4adc93(0x1da)]=_0x4adc93(0x28e));}export function injectExistingStageIds(_0x54758c,_0x45e3ec){const _0x3679f0=a155_0x2858,_0x20e1ec=new Map(_0x45e3ec[_0x3679f0(0x2a0)](_0x41ec14=>[_0x41ec14[_0x3679f0(0x243)],_0x41ec14['id']]));for(const _0x30d284 of _0x54758c){if(!_0x30d284['id']){const _0x621907=_0x20e1ec['get'](_0x30d284[_0x3679f0(0x243)]);_0x621907&&(_0x30d284['id']=_0x621907);}}}export function resolveTDFolderPath(_0x37d18f,_0x4dc149,_0x54ba9c){const _0x2efb87=a155_0x2858;if(!_0x4dc149)return _0x37d18f;if(_0x37d18f===_0x54ba9c||_0x37d18f[_0x2efb87(0x229)](_0x54ba9c+'/'))return _0x37d18f;return _0x37d18f?_0x54ba9c+'/'+_0x37d18f:_0x54ba9c;}export function addFoldersToCreate(_0xd68a66,_0x276714,_0x1ea277){const _0x4dd812=a155_0x2858;if(!_0xd68a66)return;if(_0x276714[_0x4dd812(0x1e8)](_0xd68a66))return;const _0xc255a9=_0xd68a66['split']('/');let _0x4bf690='';for(const _0x4832f1 of _0xc255a9){_0x4bf690=_0x4bf690?_0x4bf690+'/'+_0x4832f1:_0x4832f1,!_0x276714[_0x4dd812(0x1e8)](_0x4bf690)&&_0x1ea277[_0x4dd812(0x2ab)](_0x4bf690);}}export function sortFoldersByDepth(_0x3fee71){const _0x951ef1=a155_0x2858;return[..._0x3fee71][_0x951ef1(0x23c)]((_0x4f8dd7,_0x521181)=>{const _0x5cad52=_0x951ef1,_0x5684be=(_0x4f8dd7[_0x5cad52(0x26d)](/\//g)||[])[_0x5cad52(0x2bf)],_0x2aaa38=(_0x521181['match'](/\//g)||[])['length'];return _0x5684be-_0x2aaa38;});}import*as a155_0x4e0291 from'yaml';import{readFileSync}from'fs';import a155_0x3c0fa5 from'path';import{isJourneyDef,parseYamlString as a155_0x6de56d,toYamlString as a155_0x131aa0,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(_0x3e0c11){const _0x2a500d=a155_0x2858;if(Array['isArray'](_0x3e0c11))return'['+_0x3e0c11[_0x2a500d(0x2a0)](_0x5eaf2e=>stableStringify(_0x5eaf2e))['join'](',')+']';if(_0x3e0c11&&typeof _0x3e0c11===_0x2a500d(0x254)){const _0x52e345=_0x3e0c11,_0x301b6d=Object[_0x2a500d(0x1cb)](_0x52e345)[_0x2a500d(0x23c)](),_0x1abb31=_0x301b6d['map'](_0x2700d0=>'\x22'+_0x2700d0+'\x22:'+stableStringify(_0x52e345[_0x2700d0]));return'{'+_0x1abb31[_0x2a500d(0x1de)](',')+'}';}const _0x10b458=JSON[_0x2a500d(0x230)](_0x3e0c11);return _0x10b458===undefined?'null':_0x10b458;}function activationSignature(_0x5ddba4){const _0xb06d75=a155_0x2858,_0x10d8b4={'connection':_0x5ddba4[_0xb06d75(0x1f2)],..._0x5ddba4[_0xb06d75(0x25b)]!==undefined&&{'all_columns':_0x5ddba4['all_columns']},..._0x5ddba4['columns']!==undefined&&{'columns':_0x5ddba4[_0xb06d75(0x246)]},..._0x5ddba4[_0xb06d75(0x270)]!==undefined&&{'behavior':_0x5ddba4['behavior']},..._0x5ddba4['schedule']!==undefined&&{'schedule':_0x5ddba4[_0xb06d75(0x203)]},..._0x5ddba4['notification']!==undefined&&{'notification':_0x5ddba4[_0xb06d75(0x20b)]},..._0x5ddba4[_0xb06d75(0x2c1)]!==undefined&&{'connector_config':_0x5ddba4[_0xb06d75(0x2c1)]},..._0x5ddba4[_0xb06d75(0x216)]!==undefined&&{'activation_template_id':_0x5ddba4['activation_template_id']}};return stableStringify(_0x10d8b4);}async function fetchSegment(_0x268be6,_0x43af71,_0xec87d2,_0x507ff5){const _0x4408ee=a155_0x2858,_0x2ed33c=_0x507ff5?.[_0x4408ee(0x264)](_0x4d038c=>_0x4d038c['id']===_0xec87d2);if(_0x2ed33c)return _0x2ed33c;try{return await _0x268be6[_0x4408ee(0x1d9)][_0x4408ee(0x1ee)](_0x43af71,_0xec87d2);}catch(_0x3d4bf5){logger[_0x4408ee(0x2b6)](_0x4408ee(0x261)+_0xec87d2+',\x20falling\x20back\x20to\x20getSegmentEntity:\x20'+_0x3d4bf5);try{return await _0x268be6[_0x4408ee(0x1d9)][_0x4408ee(0x223)](_0xec87d2);}catch(_0x543195){return logger[_0x4408ee(0x2b6)]('getSegmentEntity\x20also\x20failed\x20for\x20'+_0xec87d2+':\x20'+_0x543195),null;}}}function recoverSegmentIdsFromPushRecovery(_0xaa540b,_0x439339,_0x29623a){const _0x12c053=a155_0x2858,_0x1f1e32=readPushRecovery(_0xaa540b['absolutePath']);if(_0x1f1e32?.[_0x12c053(0x211)]===_0xaa540b[_0x12c053(0x242)][_0x12c053(0x243)])for(const [_0x5092b1,_0x5d1dd6]of Object[_0x12c053(0x1e0)](_0x1f1e32[_0x12c053(0x26f)])){const _0x179574=generateDeterministicJourneySegmentName(_0xaa540b['yamlConfig'][_0x12c053(0x243)],_0x5092b1);_0x5d1dd6[_0x12c053(0x1cc)]===_0x179574&&(_0x439339['set'](_0x5092b1,_0x5d1dd6[_0x12c053(0x25e)]),_0x29623a[_0x12c053(0x1db)](_0x5092b1,_0x5d1dd6['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x4a384d,_0x1d82a5,_0x1202c8,_0x3fbf9d){const _0x27557c=a155_0x2858;let _0x2c2b5e;try{_0x2c2b5e=await _0x4a384d[_0x27557c(0x1d9)][_0x27557c(0x279)]({'name':_0x1202c8[_0x27557c(0x237)],'description':_0x1202c8[_0x27557c(0x25a)],'journeyId':_0x1202c8[_0x27557c(0x2ba)],'rule':_0x3fbf9d(_0x1202c8[_0x27557c(0x2b3)],!![]),'countPopulation':!![],'parentFolderId':_0x1202c8[_0x27557c(0x2b1)],'audienceId':_0x1202c8[_0x27557c(0x253)]});}catch(_0x1ac89e){const _0xa80462=_0x1ac89e instanceof Error&&_0x1ac89e['message'][_0x27557c(0x231)](_0x27557c(0x1c9));if(_0xa80462){const _0x240240=readPushRecovery(_0x1d82a5[_0x27557c(0x219)]),_0x4bf9ac=_0x240240?.[_0x27557c(0x211)]===_0x1d82a5[_0x27557c(0x242)]['name']?_0x240240[_0x27557c(0x26f)][_0x1202c8[_0x27557c(0x267)]]:undefined;if(_0x4bf9ac?.[_0x27557c(0x1cc)]===_0x1202c8['uniqueSegmentName'])await _0x4a384d['segment'][_0x27557c(0x22d)](_0x1202c8[_0x27557c(0x253)],_0x4bf9ac[_0x27557c(0x25e)],{'description':_0x1202c8['description'],'rule':_0x3fbf9d(_0x1202c8[_0x27557c(0x2b3)],!![]),'countPopulation':!![]}),_0x2c2b5e=_0x4bf9ac[_0x27557c(0x25e)];else throw new SDKError(ErrorCode[_0x27557c(0x29b)],_0x27557c(0x1fa)+_0x1202c8['localName']+_0x27557c(0x23e)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x1d82a5['absolutePath'][_0x27557c(0x290)](/([^/]+)$/,_0x27557c(0x1bc))+')\x20')+_0x27557c(0x2c3),_0x1ac89e);}else throw _0x1ac89e;}return saveSegmentToPushRecovery(_0x1d82a5[_0x27557c(0x219)],_0x1d82a5[_0x27557c(0x242)][_0x27557c(0x243)],_0x1202c8[_0x27557c(0x267)],{'segmentId':_0x2c2b5e,'uniqueServerName':_0x1202c8[_0x27557c(0x237)],'createdAt':new Date()['toISOString']()}),_0x2c2b5e;}export async function prepareSegmentFiles(_0x42b9c6,_0x3f5680,_0x3be6ae,_0x29e709,_0x94c5c3){const _0xf49da=a155_0x2858,{activationDefToCreateRequest:_0x213b46}=await import(_0xf49da(0x1ec)),_0x1ab3eb=[],_0xa64062=new Set();for(const {yamlConfig:_0x39d9a9,folderPath:_0x4427cc,sourcePath:_0x23c174}of _0x42b9c6){const _0x24b880=resolveTDFolderPath(_0x4427cc,_0x29e709,_0x94c5c3),_0x419509=_0x24b880+':'+_0x39d9a9['name'],_0x92db6e=_0x3f5680[_0xf49da(0x2af)][_0xf49da(0x28d)](_0x419509),_0x18f878=_0x92db6e?_0x3f5680['activationsBySegmentId'][_0xf49da(0x28d)](_0x92db6e['id'])||[]:[];addFoldersToCreate(_0x24b880,_0x3f5680[_0xf49da(0x25c)],_0xa64062);const _0x5d3e68=calculateActivationActions(_0x39d9a9['activations']||[],_0x18f878,_0x3f5680[_0xf49da(0x277)],_0x3f5680['connectionIdToNameMap']);for(const _0x5ae298 of _0x5d3e68){(_0x5ae298[_0xf49da(0x1df)]===_0xf49da(0x297)||_0x5ae298[_0xf49da(0x1df)]===_0xf49da(0x1d4))&&_0x5ae298[_0xf49da(0x1fc)]&&(_0x5ae298[_0xf49da(0x2a5)]=await _0x213b46(_0x5ae298[_0xf49da(0x1fc)],_0x3be6ae));}const _0x5505d0=calculateSegmentDiff(_0x39d9a9,_0x92db6e,_0x18f878,_0x3f5680[_0xf49da(0x277)],_0x3f5680['connectionIdToNameMap']);_0x1ab3eb[_0xf49da(0x25f)]({'relativePath':_0x39d9a9[_0xf49da(0x243)],'absolutePath':_0x23c174,'yamlConfig':_0x39d9a9,'folderPath':_0x24b880,'existingSegment':_0x92db6e,'existingActivations':_0x18f878,'isNew':_0x5505d0[_0xf49da(0x293)],'hasChanges':_0x5505d0[_0xf49da(0x21a)],'diff':_0x5505d0['diff'],'activationActions':_0x5d3e68});}return{'segmentFiles':_0x1ab3eb,'foldersToCreate':_0xa64062};}export async function prepareJourneyFiles(_0x5d80f2,_0x2ba0ed,_0x138897,_0x300f5c){const _0x1b51e5=a155_0x2858,_0x191c06=[],_0x2e79a8=new Set();for(const {yamlConfig:_0x2547f0,folderPath:_0x123841,sourcePath:_0x4c87a0}of _0x5d80f2){const _0x50434c=resolveTDFolderPath(_0x123841,_0x138897,_0x300f5c),_0x4c0627=_0x50434c+':'+_0x2547f0['name'],_0x156f18=_0x2ba0ed['journeyBundlesByFolderAndName'][_0x1b51e5(0x28d)](_0x4c0627);let _0x3a2a1f,_0x323e34;if(_0x156f18&&_0x156f18[_0x1b51e5(0x2bf)]>0x0){const _0x53b022=buildLocalExpandedRuleMappings(_0x2547f0),{createYamlContext:_0x345b6d,prefetchJourneySegments:_0x290275}=createPushYamlContextForBundle(_0x2ba0ed[_0x1b51e5(0x2b8)],_0x2ba0ed[_0x1b51e5(0x253)],_0x2ba0ed[_0x1b51e5(0x1e5)],_0x53b022,_0x2ba0ed[_0x1b51e5(0x277)],_0x2ba0ed['connectionIdToNameMap'],_0x2ba0ed[_0x1b51e5(0x217)],_0x2ba0ed[_0x1b51e5(0x2bc)]);await _0x290275(_0x156f18[_0x1b51e5(0x2a0)](_0x36f0cb=>_0x36f0cb['id']));const _0x4fedf7=await _0x2ba0ed[_0x1b51e5(0x2b8)][_0x1b51e5(0x2a8)][_0x1b51e5(0x257)](_0x156f18[0x0][_0x1b51e5(0x22f)]),_0x28a4e1=hasMultipleVersions(_0x2547f0),_0x3118ef=async _0x66042b=>{const _0x5a4a20=_0x1b51e5,_0x2abe2d=_0x2ba0ed[_0x5a4a20(0x2bc)]?.[_0x5a4a20(0x28d)](_0x66042b);if(_0x2abe2d)return _0x2abe2d;return _0x2ba0ed[_0x5a4a20(0x2ad)]({'journeyId':_0x66042b,'journeyName':_0x2547f0[_0x5a4a20(0x243)],'isMultiVersion':_0x156f18[_0x5a4a20(0x2bf)]>0x1});};if(_0x28a4e1&&_0x156f18[_0x1b51e5(0x2bf)]>0x1){const _0xd89c40=[];for(const _0x35541e of _0x156f18){const _0x4f5528=_0x35541e['versionNumber']||0x1;_0x2ba0ed[_0x1b51e5(0x288)]?.[_0x1b51e5(0x1d4)](_0x1b51e5(0x278)+_0x2547f0[_0x1b51e5(0x243)]+'\x20v'+_0x4f5528);const _0x287b8f=await _0x3118ef(_0x35541e['id']),_0x557630=_0x345b6d(_0x35541e['id']),_0x71a80f=await journeyResponseToDef(_0x287b8f,_0x557630);_0xd89c40[_0x1b51e5(0x25f)]({'item':_0x35541e,'yaml':_0x71a80f});}const _0x369fe0=buildLocalRuleToNameMappingFromJourney(_0x2547f0);_0x323e34=buildMergedJourneyDef(_0xd89c40,_0x369fe0,_0x4fedf7);const _0x27f91b=Math['max'](..._0xd89c40[_0x1b51e5(0x2a0)](_0x129b56=>_0x129b56[_0x1b51e5(0x221)][_0x1b51e5(0x1f8)]||0x0)),_0x15ee87=_0x156f18[_0x1b51e5(0x264)](_0x3f7f50=>(_0x3f7f50[_0x1b51e5(0x1f8)]||0x0)===_0x27f91b);_0x15ee87&&(_0x2ba0ed[_0x1b51e5(0x288)]?.[_0x1b51e5(0x1d4)](_0x1b51e5(0x278)+_0x2547f0[_0x1b51e5(0x243)]+'\x20v'+_0x27f91b),_0x3a2a1f=await _0x3118ef(_0x15ee87['id']));}else{const _0x3dc64b=_0x156f18[_0x156f18[_0x1b51e5(0x2bf)]-0x1];_0x2ba0ed[_0x1b51e5(0x288)]?.[_0x1b51e5(0x1d4)]('Fetching\x20'+_0x2547f0['name']),_0x3a2a1f=await _0x3118ef(_0x3dc64b['id']);const _0x1faf72=_0x345b6d(_0x3dc64b['id']),_0x2c78ca=await journeyResponseToDef(_0x3a2a1f,_0x1faf72),_0x28a800=buildLocalRuleToNameMappingFromJourney(_0x2547f0);_0x323e34=buildMergedJourneyDef([{'item':_0x3dc64b,'yaml':_0x2c78ca}],_0x28a800,_0x4fedf7);}}addFoldersToCreate(_0x50434c,_0x2ba0ed[_0x1b51e5(0x25c)],_0x2e79a8);const _0x5d3998=calculateJourneyDiff(_0x2547f0,_0x323e34);_0x191c06[_0x1b51e5(0x25f)]({'relativePath':_0x2547f0[_0x1b51e5(0x243)],'absolutePath':_0x4c87a0,'yamlConfig':_0x2547f0,'folderPath':_0x50434c,'existingJourney':_0x3a2a1f,'isNew':_0x5d3998[_0x1b51e5(0x293)],'hasChanges':_0x5d3998[_0x1b51e5(0x21a)],'diff':_0x5d3998[_0x1b51e5(0x245)]});}return{'journeyFiles':_0x191c06,'foldersToCreate':_0x2e79a8};}export function calculateActivationActions(_0x4d37dd,_0x10b0cf,_0x36cc7e,_0xd86f41){const _0x50c8cd=a155_0x2858,_0xdb7b53=[],_0x5df2e7=new Map();for(const _0x2e5011 of _0x10b0cf){_0x5df2e7['set'](_0x2e5011[_0x50c8cd(0x243)],_0x2e5011);}const _0x26874c=new Map();for(const _0x4154c0 of _0x4d37dd){_0x26874c[_0x50c8cd(0x1db)](_0x4154c0[_0x50c8cd(0x243)],_0x4154c0);}for(const _0x3495e0 of _0x4d37dd){const _0x11e372=_0x5df2e7[_0x50c8cd(0x28d)](_0x3495e0[_0x50c8cd(0x243)]);if(!_0x11e372)_0xdb7b53['push']({'type':'create','name':_0x3495e0[_0x50c8cd(0x243)],'yamlActivation':_0x3495e0});else{const _0x5b8cbf=activationResponseToDef(_0x11e372,_0x36cc7e,_0xd86f41),_0x468d86=a155_0x4e0291[_0x50c8cd(0x230)](_0x5b8cbf),_0x49ad8e=a155_0x4e0291[_0x50c8cd(0x230)](_0x3495e0);_0x468d86!==_0x49ad8e&&_0xdb7b53['push']({'type':_0x50c8cd(0x1d4),'name':_0x3495e0[_0x50c8cd(0x243)],'yamlActivation':_0x3495e0,'existingActivation':_0x11e372});}}for(const _0x49765b of _0x10b0cf){!_0x26874c['has'](_0x49765b['name'])&&_0xdb7b53['push']({'type':'delete','name':_0x49765b['name'],'existingActivation':_0x49765b});}return _0xdb7b53;}function calculateYamlDiff(_0x3e8f8f,_0xabdb96){if(_0xabdb96){const _0x3783dc=generateDiff(_0xabdb96,_0x3e8f8f),_0x414e1a=hasChanges(_0x3783dc);return{'isNew':![],'hasChanges':_0x414e1a,'diff':_0x414e1a?formatDiffWithColors(_0x3783dc):undefined};}const _0x43b681=generateDiff('',_0x3e8f8f);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x43b681)};}export function calculateSegmentDiff(_0x4cf4e7,_0x30c78e,_0x409e93,_0x5d2064,_0x2197ea){const _0x5088bf=segmentToYamlString(_0x4cf4e7),_0x1766d2=_0x30c78e?segmentToYamlString(segmentWithActivationsToYaml(_0x30c78e,_0x409e93,undefined,_0x5d2064,_0x2197ea)):undefined;return calculateYamlDiff(_0x5088bf,_0x1766d2);}export function calculateJourneyDiff(_0x1269e3,_0x2fec04){const _0x6ec99b=normalizeJourneyDef(_0x1269e3,_0x1269e3),_0x5920ab=a155_0x131aa0(_0x6ec99b),_0x203d73=_0x2fec04?a155_0x131aa0(normalizeJourneyDef(_0x2fec04,_0x1269e3)):undefined;return calculateYamlDiff(_0x5920ab,_0x203d73);}export function findSegmentsToDelete(_0x1a07ce,_0x1a6983,_0x53e95d,_0x26ceb4,_0x195c42){const _0x1469fd=a155_0x2858,_0x142bf5=new Set();for(const {yamlConfig:_0x587a4a,folderPath:_0x5d23cc}of _0x1a6983){_0x142bf5['add'](_0x5d23cc+':'+_0x587a4a[_0x1469fd(0x243)]);}return _0x1a07ce[_0x1469fd(0x27e)](_0x581bc5=>{const _0x34d11a=_0x1469fd,_0x202b2e=_0x581bc5[_0x34d11a(0x1cf)]?_0x53e95d[_0x34d11a(0x28d)](_0x581bc5['segmentFolderId'][_0x34d11a(0x2b4)]())||'':'',_0x7c9a2d=_0x202b2e+':'+_0x581bc5[_0x34d11a(0x243)];if(_0x142bf5[_0x34d11a(0x1e8)](_0x7c9a2d))return![];if(_0x195c42)return _0x202b2e===_0x26ceb4||_0x202b2e[_0x34d11a(0x229)](_0x26ceb4+'/');return!![];});}function a155_0x5a28(){const _0xa253e9=['validatedRequest','\x0a\x20\x20','existingSegment','journey','digest','Failed\x20to\x20resolve\x20segment\x20','add','DecisionPoint','fetchJourney','activation_updating','segmentByFolderAndName','created','folderId','nameToType','resolvedRule','toString','journey_updating','debug','toISOString','deps','run_after_journey_refresh','journeyId','conditions','journeyById','Stage\x20\x27','journeyStages','length','./journey-yaml.js','connector_config','activation_deleted','and\x20the\x20server\x20segment,\x20then\x20retry.','.$1.push-recovery.json','\x27\x20milestone','\x20activation\x20\x27','INTERNAL','activation_creating','\x27\x20entry\x20criteria','Updated\x20activation\x20\x27','skipSegments','Journey\x20\x27','NOT_FOUND','Failed\x20to\x20','flatMap','embedded_activation_created','Name\x20has\x20already\x20been\x20taken','results','keys','uniqueServerName','folderPath','conditionSegmentId','segmentFolderId','Activation','Matched\x20server\x20segment\x20\x27','createdSegmentId','rootFolderId','update','delete','segment_updated','relative','existingJourney','segment','state','set','Created\x20segment\x20\x27','waitStepUnit','join','type','entries','Creating\x20segment\x20\x27','listActivations','Entry\x20criteria:\x20','kind','existingSegments','folder','Segment\x20not\x20found','has','segment_updating','Creating\x20activation\x20\x27','segment_deleted','./child-segment-yaml.js','Creating\x20folder\x20\x27','getSegment','createFolder','day','10576pkLXpx','connection','Deleting\x20activation\x20\x27','journeyBundleName','\x20segment\x20from\x20file:\x20','1131859VFcOVg','journeyActivationNameToId','versionNumber','JOURNEY_UPDATE_ERROR','Embedded\x20segment\x20\x27','deleteSegment','yamlActivation','796dJIhcl','journeys','some','existingActivation','ACTIVATION_UPDATE_ERROR','verbose','schedule','branches','unchanged','waitStepType','values','stage\x20\x27','\x27\x20not\x20found\x20in\x20journey\x20\x27','parse','notification','max','index','activation_created','dirname','hex','journeyName','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','parentFolder','\x20error(s)','2fDBHGZ','activation_template_id','activationStepsById','77eWqlie','absolutePath','hasChanges','\x27...','Created\x20folder\x20\x27','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','1232172BzDhSE','activation_updated','journey_creating','item','size','getSegmentEntity','stages','segment_deleting','data','onProgress','attributes','startsWith','Created\x20activation\x20\x27','Activation\x20not\x20found:\x20','goal\x20criteria','updateSegmentById','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','journeyBundleId','stringify','includes','\x27\x20from\x20file:\x20','conditionTimeoutDuration','waitStep','activationContext','journeyActivationStepId','uniqueSegmentName','activations','reduce','Condition','connectionIdToNameMap','sort','entry_criteria','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','getActivation','Failed\x20to\x20resolve\x20activation\x20','embeddedSegmentNameToId','yamlConfig','name','rule','diff','columns','Updating\x20segment\x20\x27','Updated\x20segment\x20\x27','\x20journey\x20from\x20file:\x20','\x27\x20to\x20local\x20\x27','toLowerCase','from','Deleted\x20segment\x20\x27','list','parseDocument','entry','resolveSegment','):\x20','parentId','object','logDeleted','activation_deleting','getLatestJourneyId','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','user','description','all_columns','folderPathToId','8434151FgeqWX','segmentId','push','activationParams','getSegment\x20failed\x20for\x20','activationActions','segmentNameToId','find','updated','withProgress','localName','getJourney','milestone','journey_created','folder_creating','with','match','deleted','segments','behavior','action','WaitStep','exitCriterias','conditionTimeoutUnit','steps','decision_point','idToEmailMap','Fetching\x20','createJourneySegment','embedded_segment_created','all','valid','split','filter','\x27\x20decision\x20point\x20branch\x20\x27','logInfo','10670265OwojRD','5705560QZFxpU','\x27\x20exit\x20criteria','../../utils/async.js','SEGMENT_NOT_FOUND','createdSegmentIds','goal','progress','journey_updated','logWarning','createSegment','Segment\x20not\x20found:\x20','get','draft','createActivation','replace','\x27\x20by\x20rule\x20content','entryCriteria','isNew','effectiveFolderId','utf-8','logSuccess','create','\x20(referenced\x20in\x20journey\x20','SEGMENT_SYNTAX_ERROR','parentSegmentFolder','SEGMENT_UPDATE_ERROR','idToName','embedded_activation_creating','9423GMpKtg','deleteActivation','map','slice','10eHfADn','updateActivation','relationships'];a155_0x5a28=function(){return _0xa253e9;};return a155_0x5a28();}export function findJourneysToDelete(_0x5c1bb9,_0x1fba34,_0xf90f30,_0x41a3d6,_0x2bbb26){const _0x40e174=a155_0x2858,_0xb6f654=new Set();for(const {yamlConfig:_0x4733f3,folderPath:_0x593bae}of _0x1fba34){_0xb6f654[_0x40e174(0x2ab)](_0x593bae+':'+_0x4733f3[_0x40e174(0x243)]);}return _0x5c1bb9['filter'](_0x5929c6=>{const _0x138fb4=_0x40e174,_0xdf5565=_0x5929c6['folderId']?_0xf90f30[_0x138fb4(0x28d)](_0x5929c6[_0x138fb4(0x2b1)])||'':'',_0x3c1fad=_0xdf5565+':'+_0x5929c6[_0x138fb4(0x1f4)];if(_0xb6f654['has'](_0x3c1fad))return![];if(_0x2bbb26)return _0xdf5565===_0x41a3d6||_0xdf5565[_0x138fb4(0x229)](_0x41a3d6+'/');return!![];});}export function buildSegmentLookupMap(_0x2971d4,_0x52eeec){const _0xecd08e=a155_0x2858,_0x7f9bef=new Map();for(const _0x2df9ff of _0x2971d4){const _0x448041=_0x2df9ff['segmentFolderId']?_0x52eeec[_0xecd08e(0x28d)](_0x2df9ff[_0xecd08e(0x1cf)]['toString']())||'':'',_0x374521=_0x448041+':'+_0x2df9ff[_0xecd08e(0x243)];_0x7f9bef[_0xecd08e(0x1db)](_0x374521,_0x2df9ff);}return _0x7f9bef;}export function buildSegmentNameToIdMap(_0x2e82f2){const _0x1201c4=a155_0x2858,_0x38ab79=new Map();for(const _0x50001e of _0x2e82f2){_0x38ab79[_0x1201c4(0x1db)](_0x50001e['name'],_0x50001e['id']);}return _0x38ab79;}export function buildJourneyBundleLookupMap(_0x15610a,_0x55b442){const _0x3e1585=a155_0x2858,_0x20c4ea=new Map();for(const _0x445f4e of _0x15610a){const _0x18b0a1=_0x445f4e[_0x3e1585(0x2b1)]?_0x55b442[_0x3e1585(0x28d)](_0x445f4e[_0x3e1585(0x2b1)])||'':'',_0x4ed8b4=_0x18b0a1+':'+_0x445f4e[_0x3e1585(0x1f4)];!_0x20c4ea[_0x3e1585(0x1e8)](_0x4ed8b4)&&_0x20c4ea['set'](_0x4ed8b4,[]),_0x20c4ea[_0x3e1585(0x28d)](_0x4ed8b4)[_0x3e1585(0x25f)](_0x445f4e);}for(const _0x32b3ea of _0x20c4ea[_0x3e1585(0x207)]()){_0x32b3ea[_0x3e1585(0x23c)]((_0x1bb3c7,_0x420a5f)=>(_0x1bb3c7['versionNumber']||0x0)-(_0x420a5f[_0x3e1585(0x1f8)]||0x0));}return _0x20c4ea;}export function collectFoldersToCreate(_0x130dbd,_0x3c21fb){const _0x1cc493=a155_0x2858,_0x11a45e=new Set();for(const _0x2f88a2 of _0x130dbd){if(!_0x2f88a2)continue;if(_0x3c21fb[_0x1cc493(0x1e8)](_0x2f88a2))continue;const _0x21b528=_0x2f88a2[_0x1cc493(0x27d)]('/');let _0x103292='';for(const _0x3b05d0 of _0x21b528){_0x103292=_0x103292?_0x103292+'/'+_0x3b05d0:_0x3b05d0,!_0x3c21fb['has'](_0x103292)&&_0x11a45e[_0x1cc493(0x2ab)](_0x103292);}}return _0x11a45e;}export function parseAndClassifyYamlFiles(_0x19089b,_0x17278a,_0x4fd574){const _0x541ad0=a155_0x2858,_0x22871b=[],_0x207f4e=[];for(const _0x50fc7b of _0x19089b){const _0x2bbab3=a155_0x3c0fa5[_0x541ad0(0x1d7)](_0x17278a,a155_0x3c0fa5[_0x541ad0(0x20f)](_0x50fc7b)),_0x1e8f1e=_0x2bbab3==='.'?'':_0x2bbab3[_0x541ad0(0x290)](/\\/g,'/'),_0x583ff1=readFileSync(_0x50fc7b,_0x541ad0(0x295)),_0x5e79b=a155_0x4e0291['parse'](_0x583ff1);if(isJourneyDef(_0x5e79b)){const _0x3ef430=a155_0x6de56d(_0x583ff1);_0x207f4e['push']({'yamlConfig':_0x3ef430,'folderPath':_0x1e8f1e,'sourcePath':_0x50fc7b});}else{if(!_0x4fd574?.[_0x541ad0(0x1c3)]){const _0x3c8bde=parseSegmentYamlFile(_0x583ff1),_0x564356=normalizeChildSegmentYaml(_0x3c8bde);_0x22871b[_0x541ad0(0x25f)]({'yamlConfig':_0x564356,'folderPath':_0x1e8f1e,'sourcePath':_0x50fc7b});}}}return{'segments':_0x22871b,'journeys':_0x207f4e};}export function validateParsedFiles(_0x38b5a1,_0x3cefab){const _0x28c39e=a155_0x2858,_0x13fb53=[];for(const {yamlConfig:_0x399143,sourcePath:_0x1ed1d2}of _0x38b5a1[_0x28c39e(0x26f)]){const _0x33e12e=readFileSync(_0x1ed1d2,_0x28c39e(0x295)),_0x3d38bb=a155_0x4e0291['parseDocument'](_0x33e12e),_0x30e18c=validateSegmentDef(_0x399143,{'source':_0x33e12e,'document':_0x3d38bb},{'skipSchema':!![]});if(!_0x30e18c[_0x28c39e(0x27c)]){const _0x2f075d=a155_0x3c0fa5['relative'](_0x3cefab,_0x1ed1d2);_0x13fb53[_0x28c39e(0x25f)]({'filePath':_0x2f075d,'source':_0x33e12e,'result':_0x30e18c,'isJourney':![]});}}for(const {yamlConfig:_0x36d63a,sourcePath:_0x11d327}of _0x38b5a1[_0x28c39e(0x1fe)]){const _0x3eb665=readFileSync(_0x11d327,'utf-8'),_0xb83a22=a155_0x4e0291[_0x28c39e(0x24f)](_0x3eb665),_0x2c4200=validateJourneyDef(_0x36d63a,{'source':_0x3eb665,'document':_0xb83a22},{'skipSchema':!![]});if(!_0x2c4200['valid']){const _0x1bc5c9=a155_0x3c0fa5[_0x28c39e(0x1d7)](_0x3cefab,_0x11d327);_0x13fb53[_0x28c39e(0x25f)]({'filePath':_0x1bc5c9,'source':_0x3eb665,'result':_0x2c4200,'isJourney':!![]});}}return _0x13fb53;}export function formatValidationErrors(_0x955477){const _0x3b3501=a155_0x2858,_0x285aba=[];for(const {filePath:_0x340995,source:_0x393ac7,result:_0x3a5a06,isJourney:_0x2ada59}of _0x955477){const _0x3a344f=_0x2ada59?_0x3b3501(0x2a8):_0x3b3501(0x1d9);_0x285aba[_0x3b3501(0x25f)]('\x0a'+_0x340995+'\x20('+_0x3a344f+_0x3b3501(0x252)+_0x3a5a06['errors'][_0x3b3501(0x2bf)]+_0x3b3501(0x214)),_0x285aba['push'](formatValidationResult(_0x3a5a06,_0x393ac7,_0x340995));}return _0x285aba['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x3d7b2e){const _0x48ca8e=a155_0x2858,_0x47114d=new Set(),_0x2fa537=new Map(),_0x3842ab=collectSegmentUsageCounts(_0x3d7b2e);if(_0x3d7b2e[_0x48ca8e(0x26f)])for(const [_0x24f2b0,_0x4fe632]of Object[_0x48ca8e(0x1e0)](_0x3d7b2e['segments'])){_0x47114d[_0x48ca8e(0x2ab)](_0x24f2b0);if(_0x4fe632[_0x48ca8e(0x244)]){const _0x5ddaab=yamlRuleToApi(_0x4fe632[_0x48ca8e(0x244)]),_0x4b6427=apiRuleToYaml(_0x5ddaab);_0x2fa537[_0x48ca8e(0x1db)](_0x24f2b0,_0x4b6427);}}const _0x4a0c26=new Map();let _0x48def3=0x0;for(const [_0x1843be,_0x23a87e]of _0x2fa537){const _0x289d74=serializeExpandedRule(_0x23a87e,_0x2fa537),_0x28dd1c=_0x4a0c26[_0x48ca8e(0x28d)](_0x289d74)||[];_0x28dd1c[_0x48ca8e(0x25f)]({'name':_0x1843be,'index':_0x48def3}),_0x4a0c26[_0x48ca8e(0x1db)](_0x289d74,_0x28dd1c),_0x48def3++;}const _0x2d3412=new Map();for(const [_0x258bb8,_0x128de8]of _0x4a0c26){const _0x1aa499=_0x128de8['slice']()[_0x48ca8e(0x23c)]((_0xbcd8f8,_0x22607b)=>{const _0x2aacf9=_0x48ca8e,_0x1ce943=_0x3842ab[_0x2aacf9(0x28d)](_0xbcd8f8[_0x2aacf9(0x243)])||0x0,_0xdd25da=_0x3842ab['get'](_0x22607b[_0x2aacf9(0x243)])||0x0;if(_0x1ce943!==_0xdd25da)return _0xdd25da-_0x1ce943;return _0xbcd8f8[_0x2aacf9(0x20d)]-_0x22607b[_0x2aacf9(0x20d)];})[_0x48ca8e(0x2a0)](_0x2bbc54=>_0x2bbc54[_0x48ca8e(0x243)]),_0x3ece3d=[];for(const _0x55e70d of _0x1aa499){const _0x40cb9d=_0x3842ab[_0x48ca8e(0x28d)](_0x55e70d)||0x0,_0x4d7d0e=Math[_0x48ca8e(0x20c)](_0x40cb9d,0x1);for(let _0xe48d1a=0x0;_0xe48d1a<_0x4d7d0e;_0xe48d1a++){_0x3ece3d[_0x48ca8e(0x25f)](_0x55e70d);}}_0x2d3412[_0x48ca8e(0x1db)](_0x258bb8,_0x3ece3d);}return{'existingLocalSegmentNames':_0x47114d,'localSegmentRules':_0x2fa537,'localExpandedRuleToNames':_0x2d3412};}export function createSegmentIdResolver(_0x30ffd2,_0x42025b){return async _0x12cb1b=>{const _0x2826f9=a155_0x2858,_0x6cdb4a=_0x30ffd2['get'](_0x12cb1b);if(!_0x6cdb4a)throw new SDKError(ErrorCode[_0x2826f9(0x285)],_0x2826f9(0x28c)+_0x12cb1b+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x42025b+'\x27)');return _0x6cdb4a;};}export function extractRootFolderId(_0x1838a9){const _0x41d66d=a155_0x2858;return _0x1838a9[_0x41d66d(0x2a4)]?.[_0x41d66d(0x29a)]?.[_0x41d66d(0x226)]?.['id']||_0x1838a9[_0x41d66d(0x2a4)]?.[_0x41d66d(0x213)]?.['data']?.['id'];}export function buildConnectionMaps(_0x4fea3f){const _0x1f9d34=a155_0x2858,_0x3178cd=new Map(),_0x268db4=new Map(),_0x433849=new Map();for(const _0x4a95dc of _0x4fea3f){_0x3178cd['set'](_0x4a95dc[_0x1f9d34(0x243)],parseInt(_0x4a95dc['id'],0xa)),_0x268db4['set'](_0x4a95dc['id'],_0x4a95dc[_0x1f9d34(0x243)]),_0x433849[_0x1f9d34(0x1db)](_0x4a95dc[_0x1f9d34(0x243)],_0x4a95dc[_0x1f9d34(0x1df)]);}return{'nameToId':_0x3178cd,'idToName':_0x268db4,'nameToType':_0x433849};}export function calculatePushStats(_0x284474,_0x2dc866,_0x59402f,_0x2487ca,_0x48327e,_0x421fac,_0x36ce8c){const _0x4a6ec8=a155_0x2858,_0x4b4c83=_0x284474[_0x4a6ec8(0x27e)](_0x5d3302=>_0x5d3302['isNew']),_0x5cf3eb=_0x284474[_0x4a6ec8(0x27e)](_0x138e49=>!_0x138e49['isNew']&&_0x138e49[_0x4a6ec8(0x21a)]),_0x289137=_0x284474[_0x4a6ec8(0x27e)](_0x68ed4b=>!_0x68ed4b[_0x4a6ec8(0x293)]&&!_0x68ed4b[_0x4a6ec8(0x21a)]),_0x2a90fb=_0x421fac?_0x2487ca:[],_0x17e08c=_0x2dc866['filter'](_0x35f7cb=>_0x35f7cb[_0x4a6ec8(0x293)]),_0x4a1f32=_0x2dc866[_0x4a6ec8(0x27e)](_0x281c40=>!_0x281c40[_0x4a6ec8(0x293)]&&_0x281c40[_0x4a6ec8(0x21a)]),_0x931678=_0x2dc866['filter'](_0x2c8fbb=>!_0x2c8fbb[_0x4a6ec8(0x293)]&&!_0x2c8fbb[_0x4a6ec8(0x21a)]),_0x7304ec=_0x421fac?_0x48327e:[],_0x232915=_0x284474[_0x4a6ec8(0x1c7)](_0x56b471=>_0x56b471[_0x4a6ec8(0x262)]),_0x4f295c=_0x232915[_0x4a6ec8(0x27e)](_0x2149fc=>_0x2149fc[_0x4a6ec8(0x1df)]===_0x4a6ec8(0x297)),_0x453860=_0x232915[_0x4a6ec8(0x27e)](_0x580e8e=>_0x580e8e[_0x4a6ec8(0x1df)]===_0x4a6ec8(0x1d4)),_0x1448d3=_0x232915[_0x4a6ec8(0x27e)](_0x563601=>_0x563601['type']===_0x4a6ec8(0x1d5)),_0x4be2e6=Array[_0x4a6ec8(0x24c)](_0x59402f)['sort'](),_0x4bd21c=_0x36ce8c?![]:_0x4b4c83['length']>0x0||_0x5cf3eb['length']>0x0||_0x2a90fb[_0x4a6ec8(0x2bf)]>0x0,_0x5a4cce=_0x17e08c['length']>0x0||_0x4a1f32['length']>0x0||_0x7304ec[_0x4a6ec8(0x2bf)]>0x0,_0x1db2c9=_0x36ce8c?![]:_0x232915[_0x4a6ec8(0x2bf)]>0x0,_0x239b82=_0x4be2e6[_0x4a6ec8(0x2bf)]>0x0;return{'segments':{'new':_0x4b4c83,'changed':_0x5cf3eb,'unchanged':_0x289137,'toDelete':_0x2a90fb},'journeys':{'new':_0x17e08c,'changed':_0x4a1f32,'unchanged':_0x931678,'toDelete':_0x7304ec},'activations':{'all':_0x232915,'toCreate':_0x4f295c,'toUpdate':_0x453860,'toDelete':_0x1448d3},'folders':{'toCreate':_0x4be2e6},'counts':{'segments':{'new':_0x4b4c83[_0x4a6ec8(0x2bf)],'changed':_0x5cf3eb[_0x4a6ec8(0x2bf)],'unchanged':_0x289137[_0x4a6ec8(0x2bf)],'toDelete':_0x2a90fb[_0x4a6ec8(0x2bf)]},'journeys':{'new':_0x17e08c[_0x4a6ec8(0x2bf)],'changed':_0x4a1f32[_0x4a6ec8(0x2bf)],'unchanged':_0x931678[_0x4a6ec8(0x2bf)],'toDelete':_0x7304ec['length']},'activations':{'create':_0x4f295c[_0x4a6ec8(0x2bf)],'update':_0x453860[_0x4a6ec8(0x2bf)],'delete':_0x1448d3[_0x4a6ec8(0x2bf)]},'folders':_0x4be2e6[_0x4a6ec8(0x2bf)]},'hasChanges':_0x4bd21c||_0x5a4cce||_0x1db2c9||_0x239b82};}export async function buildPushExecutionContext(_0x3411ba,_0x211d82,_0x13197d,_0x9a6369,_0x44fa15,_0x4d2ef5){const _0x570268=a155_0x2858,_0x77d846=extractRootFolderId(_0x13197d),{pathToId:_0x5456d1,idToPath:_0xbf8b4e}=buildFolderMaps(_0x44fa15),_0x3efb90=buildSegmentNameToIdMap(_0x9a6369),_0x59297e=new Map(),{batchAsync:_0x21530c}=await import(_0x570268(0x284)),[_0x211f48,_0x2c1a72]=await Promise[_0x570268(0x27b)]([_0x3411ba[_0x570268(0x259)]['buildUserMaps'](),_0x3411ba[_0x570268(0x1f2)][_0x570268(0x24e)](),((async()=>{!_0x4d2ef5&&_0x9a6369['length']>0x0&&await _0x21530c(_0x9a6369,async _0x520360=>{const _0x5c84cc=a155_0x2858,_0x4b525f=await _0x3411ba[_0x5c84cc(0x1d9)][_0x5c84cc(0x1e2)](_0x211d82,_0x520360['id']);_0x59297e[_0x5c84cc(0x1db)](_0x520360['id'],_0x4b525f);});})())]),{emailToId:_0x148130,idToEmail:_0x31200e}=_0x211f48,_0xdae0fd=buildConnectionMaps(_0x2c1a72);return{'rootFolderId':_0x77d846,'folderPathToId':_0x5456d1,'folderIdToPath':_0xbf8b4e,'segmentNameToId':_0x3efb90,'activationsBySegmentId':_0x59297e,'emailToIdMap':_0x148130,'idToEmailMap':_0x31200e,'connectionNameToIdMap':_0xdae0fd['nameToId'],'connectionIdToNameMap':_0xdae0fd[_0x570268(0x29c)],'connectionNameToTypeMap':_0xdae0fd[_0x570268(0x2b2)]};}export function createPushYamlContextForBundle(_0x5591df,_0xbdda5d,_0x1a9373,_0x5a0703,_0x232094,_0x535e46,_0x7efdc7,_0x851b60){const {existingLocalSegmentNames:_0x2c6b7c,localExpandedRuleToNames:_0x4cae66}=_0x5a0703,_0x2498e2=new Set(),_0x2d3b29=new Map(),_0x24f6a5=new Map(),_0x21f132=new Map(),_0x21a9a8=createJumpTargetCache(),_0x40ae2c=new Map(),_0x233f56=new Map(),_0x53bcce=new Set();let _0x167feb;const _0x24179e=_0x19e23c=>{const _0x293ea1={'resolveSegment':async _0x404988=>{const _0x1c846a=a155_0x2858,_0x1a9897=_0x21f132[_0x1c846a(0x28d)](_0x404988);if(_0x1a9897!==undefined)return{'name':_0x1a9897,'isJourneyLocal':!![]};try{const _0x4e69a1=await fetchSegment(_0x5591df,_0xbdda5d,_0x404988,_0x1a9373);if(!_0x4e69a1)throw new Error(_0x1c846a(0x1e7));const _0x511e9d=generateJourneyLocalName(_0x4e69a1[_0x1c846a(0x243)]),_0x275e46=_0x4e69a1[_0x1c846a(0x1e4)]===SEGMENT_KIND_JOURNEY&&_0x511e9d!==undefined;let _0x235ec8=_0x4e69a1[_0x1c846a(0x243)],_0x4cca0;if(_0x275e46&&_0x4e69a1[_0x1c846a(0x244)]){const _0x35b462=apiRuleToYaml(_0x4e69a1[_0x1c846a(0x244)]);_0x233f56[_0x1c846a(0x1db)](_0x404988,_0x35b462);const _0x234fd0=async _0x6aafb7=>{const _0x55de6b=_0x1c846a,_0x5364c7=collectSegmentRefsFromRule(_0x6aafb7);for(const _0xd4cc2d of _0x5364c7){if(!_0x233f56[_0x55de6b(0x1e8)](_0xd4cc2d))try{const _0x38296c=await fetchSegment(_0x5591df,_0xbdda5d,_0xd4cc2d,_0x1a9373);if(_0x38296c?.['rule']){const _0x8444e9=apiRuleToYaml(_0x38296c[_0x55de6b(0x244)]);_0x233f56[_0x55de6b(0x1db)](_0xd4cc2d,_0x8444e9),await _0x234fd0(_0x8444e9);}}catch(_0x601e6c){logger[_0x55de6b(0x2b6)]('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0xd4cc2d+':\x20'+_0x601e6c);}}};await _0x234fd0(_0x35b462);const _0x1ffe97=serializeExpandedRule(_0x35b462,_0x233f56),_0x2294a9=_0x4cae66[_0x1c846a(0x28d)](_0x1ffe97);if(_0x2294a9&&_0x2294a9[_0x1c846a(0x2bf)]>0x0){const _0x5da488=_0x2d3b29['get'](_0x1ffe97)||0x0,_0x4dd870=_0x2294a9[_0x5da488]||_0x2294a9[_0x2294a9[_0x1c846a(0x2bf)]-0x1];_0x2d3b29['set'](_0x1ffe97,_0x5da488+0x1),_0x235ec8=_0x4dd870,_0x2498e2[_0x1c846a(0x2ab)](_0x235ec8),_0x21f132['set'](_0x404988,_0x235ec8);const _0xb578f0=await resolveRuleSegmentRefs(_0x35b462,async _0x4b9cb4=>{const _0x2b9b74=_0x1c846a,_0x1677de=_0x21f132['get'](_0x4b9cb4);if(_0x1677de)return _0x1677de;const _0x134ff5=await _0x167feb[_0x2b9b74(0x251)](_0x4b9cb4);return _0x134ff5[_0x2b9b74(0x243)];});_0x4cca0={'description':_0x4e69a1[_0x1c846a(0x25a)],'rule':_0xb578f0};}else{const _0x1aeead=_0x40ae2c[_0x1c846a(0x28d)](_0x1ffe97);if(_0x1aeead)_0x235ec8=_0x1aeead,_0x21f132[_0x1c846a(0x1db)](_0x404988,_0x235ec8);else{if(_0x511e9d){let _0x5ca687=_0x511e9d,_0x3c7bb2=0x2;while(_0x2498e2[_0x1c846a(0x1e8)](_0x5ca687)||_0x2c6b7c['has'](_0x5ca687)){_0x5ca687=_0x511e9d+'_'+_0x3c7bb2,_0x3c7bb2++;}_0x2498e2[_0x1c846a(0x2ab)](_0x5ca687),_0x235ec8=_0x5ca687;}_0x21f132[_0x1c846a(0x1db)](_0x404988,_0x235ec8),_0x40ae2c[_0x1c846a(0x1db)](_0x1ffe97,_0x235ec8);const _0x2010ba=await resolveRuleSegmentRefs(_0x35b462,async _0x504f43=>{const _0x14157d=_0x1c846a,_0x8980a2=_0x21f132[_0x14157d(0x28d)](_0x504f43);if(_0x8980a2)return _0x8980a2;const _0x55e9b7=await _0x167feb[_0x14157d(0x251)](_0x504f43);return _0x55e9b7['name'];});_0x4cca0={'description':_0x4e69a1[_0x1c846a(0x25a)],'rule':_0x2010ba};}}}return{'name':_0x235ec8,'isJourneyLocal':_0x275e46,'definition':_0x4cca0};}catch(_0x4eb9ab){return logger[_0x1c846a(0x2b6)](_0x1c846a(0x2aa)+_0x404988+':\x20'+_0x4eb9ab),{'name':_0x404988,'isJourneyLocal':![]};}},'resolveActivation':async _0xd7ba2e=>{const _0x5d6430=a155_0x2858,_0x4c506f=_0x24f6a5[_0x5d6430(0x28d)](_0xd7ba2e);if(_0x4c506f!==undefined)return{'name':_0x4c506f,'isJourneyLocal':!![]};try{let _0xd04a3f=_0x7efdc7?.[_0x5d6430(0x28d)](_0xd7ba2e);!_0xd04a3f&&(_0xd04a3f=await _0x5591df['journey'][_0x5d6430(0x23f)](_0x19e23c,_0xd7ba2e));const _0x5f2768=_0xd04a3f[_0x5d6430(0x228)][_0x5d6430(0x260)][_0x5d6430(0x243)]||_0xd7ba2e,_0x24faa0=sanitizeYamlKey(_0x5f2768)||'activation_'+_0xd7ba2e,_0x7bc328=_0x24faa0;_0x24f6a5[_0x5d6430(0x1db)](_0xd7ba2e,_0x7bc328);const _0x451200=journeyActivationStepToYaml(_0xd04a3f,_0x232094,_0x535e46);return{'name':_0x7bc328,'isJourneyLocal':!![],'definition':_0x451200};}catch(_0x2bd636){return logger[_0x5d6430(0x2b6)](_0x5d6430(0x240)+_0xd7ba2e+':\x20'+_0x2bd636),{'name':_0xd7ba2e,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x479860,_0x271db4)=>resolveJumpTarget(_0x479860,_0x271db4,_0x21a9a8,async _0x5be7f9=>{const _0xdb702d=a155_0x2858,_0x1d5a42=_0x851b60?.[_0xdb702d(0x28d)](_0x5be7f9);if(_0x1d5a42)return _0x1d5a42;return _0x5591df[_0xdb702d(0x2a8)][_0xdb702d(0x268)](_0x5be7f9);})};return _0x167feb=_0x293ea1,_0x293ea1;},_0x2d3daf=async _0x3b1463=>{const _0x48777b=a155_0x2858,{collectSegmentIdsFromJourneyApi:_0xd1cc9c}=await import(_0x48777b(0x2c0)),{batchAsync:_0x2d1b75}=await import(_0x48777b(0x284)),_0x3c85ab=new Set();for(const _0x371e59 of _0x3b1463){let _0x1b8191=_0x851b60?.['get'](_0x371e59);!_0x1b8191&&(_0x1b8191=await _0x5591df[_0x48777b(0x2a8)][_0x48777b(0x268)](_0x371e59));const _0x21ca95=_0xd1cc9c(_0x1b8191);for(const _0xdf5820 of _0x21ca95){_0x3c85ab['add'](_0xdf5820);}}let _0x25831d=Array['from'](_0x3c85ab);while(_0x25831d['length']>0x0){const _0x38e12b=_0x25831d[_0x48777b(0x27e)](_0x3eb589=>!_0x53bcce[_0x48777b(0x1e8)](_0x3eb589));if(_0x38e12b[_0x48777b(0x2bf)]===0x0)break;const _0x5c6ca8=await _0x2d1b75(_0x38e12b,async _0x51847d=>{_0x53bcce['add'](_0x51847d);const _0xf969ca=await fetchSegment(_0x5591df,_0xbdda5d,_0x51847d,_0x1a9373);if(!_0xf969ca)return null;return{'segmentId':_0x51847d,'segment':_0xf969ca};},0xa),_0x1d2673=new Set();for(const _0xc16d8b of _0x5c6ca8){if(!_0xc16d8b?.[_0x48777b(0x1d9)]?.[_0x48777b(0x244)])continue;const _0x61757e=apiRuleToYaml(_0xc16d8b[_0x48777b(0x1d9)][_0x48777b(0x244)]);_0x233f56[_0x48777b(0x1db)](_0xc16d8b['segmentId'],_0x61757e);const _0x590fda=collectSegmentRefsFromRule(_0x61757e);for(const _0x3a352c of _0x590fda){!_0x53bcce[_0x48777b(0x1e8)](_0x3a352c)&&_0x1d2673['add'](_0x3a352c);}}_0x25831d=Array[_0x48777b(0x24c)](_0x1d2673);}};return{'createYamlContext':_0x24179e,'prefetchJourneySegments':_0x2d3daf};}export async function executePushSegments(_0x7a2ad7,_0x55e847,_0x5a88c1,_0x11b0ec,_0x5dc44b){const _0x19ac12=a155_0x2858,{segmentDefToCreateRequest:_0x24978e,segmentDefToUpdateRequest:_0x4e6324}=await import(_0x19ac12(0x1ec)),_0x2ccd18=_0x5a88c1[_0x19ac12(0x25c)],_0x4b7408=0x5,_0x1f9501=async _0x3767f0=>{const _0x3fb2a4=_0x19ac12,_0x370778=_0x3767f0[_0x3fb2a4(0x1cd)]?_0x2ccd18['get'](_0x3767f0[_0x3fb2a4(0x1cd)]):undefined;let _0x15d4c9;const _0x3a3787={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x5a2f85=_0x3767f0[_0x3fb2a4(0x242)];if(_0x3767f0[_0x3fb2a4(0x242)]['rule']){const _0x51105e=createSegmentIdResolver(_0x5a88c1[_0x3fb2a4(0x263)],_0x3767f0['yamlConfig'][_0x3fb2a4(0x243)]),_0x1656c2=await resolveRuleSegmentIds(_0x3767f0[_0x3fb2a4(0x242)][_0x3fb2a4(0x244)],_0x51105e);_0x5a2f85={..._0x3767f0[_0x3fb2a4(0x242)],'rule':_0x1656c2};}try{if(_0x3767f0['isNew']){_0x5dc44b[_0x3fb2a4(0x227)]?.({'type':'segment_creating','name':_0x3767f0['yamlConfig'][_0x3fb2a4(0x243)]});const _0x2de20a=_0x24978e(_0x5a2f85,_0x370778),_0xe9f0c8=await _0x5dc44b['withProgress'](_0x3fb2a4(0x1e1)+_0x3767f0[_0x3fb2a4(0x242)][_0x3fb2a4(0x243)]+_0x3fb2a4(0x21b),()=>_0x7a2ad7[_0x3fb2a4(0x1d9)][_0x3fb2a4(0x28b)](_0x11b0ec[_0x3fb2a4(0x253)],_0x2de20a));_0x15d4c9=_0xe9f0c8[_0x3fb2a4(0x226)]['id'],_0x5a88c1[_0x3fb2a4(0x263)][_0x3fb2a4(0x1db)](_0x3767f0[_0x3fb2a4(0x242)][_0x3fb2a4(0x243)],_0x15d4c9),_0x3a3787[_0x3fb2a4(0x1d2)]={'name':_0x3767f0[_0x3fb2a4(0x242)][_0x3fb2a4(0x243)],'id':_0x15d4c9},_0x5dc44b[_0x3fb2a4(0x227)]?.({'type':'segment_created','name':_0x3767f0[_0x3fb2a4(0x242)][_0x3fb2a4(0x243)],'segmentId':_0x15d4c9}),_0x5dc44b[_0x3fb2a4(0x296)]?.(_0x3fb2a4(0x1dc)+_0x3767f0[_0x3fb2a4(0x242)][_0x3fb2a4(0x243)]+'\x27'),_0x3a3787[_0x3fb2a4(0x2b0)]=0x1;}else{if(_0x3767f0[_0x3fb2a4(0x21a)]){_0x5dc44b['onProgress']?.({'type':_0x3fb2a4(0x1e9),'name':_0x3767f0[_0x3fb2a4(0x242)][_0x3fb2a4(0x243)]});const _0x30bf62=_0x4e6324(_0x5a2f85);_0x370778!==_0x3767f0[_0x3fb2a4(0x2a7)]?.[_0x3fb2a4(0x1cf)]&&(_0x30bf62['segmentFolderId']=_0x370778?parseInt(_0x370778,0xa):undefined),await _0x5dc44b[_0x3fb2a4(0x266)](_0x3fb2a4(0x247)+_0x3767f0[_0x3fb2a4(0x242)][_0x3fb2a4(0x243)]+_0x3fb2a4(0x21b),()=>_0x7a2ad7[_0x3fb2a4(0x1d9)][_0x3fb2a4(0x22d)](_0x11b0ec[_0x3fb2a4(0x253)],_0x3767f0[_0x3fb2a4(0x2a7)]['id'],_0x30bf62)),_0x15d4c9=_0x3767f0[_0x3fb2a4(0x2a7)]['id'],_0x5dc44b['onProgress']?.({'type':_0x3fb2a4(0x1d6),'name':_0x3767f0[_0x3fb2a4(0x242)]['name']}),_0x5dc44b[_0x3fb2a4(0x296)]?.(_0x3fb2a4(0x248)+_0x3767f0['yamlConfig'][_0x3fb2a4(0x243)]+'\x27'),_0x3a3787['updated']=0x1;}else _0x15d4c9=_0x3767f0[_0x3fb2a4(0x2a7)]['id'];}}catch(_0x5dcef4){const _0x43f25a=isHttp400Error(_0x5dcef4),_0x2d07cc=_0x43f25a?ErrorCode[_0x3fb2a4(0x299)]:ErrorCode[_0x3fb2a4(0x29b)],_0x2a5da6=getErrorMessage(_0x5dcef4);throw new SDKError(_0x2d07cc,_0x3fb2a4(0x1c6)+(_0x3767f0[_0x3fb2a4(0x293)]?_0x3fb2a4(0x297):_0x3fb2a4(0x1d4))+_0x3fb2a4(0x1f5)+_0x3767f0[_0x3fb2a4(0x219)]+'\x0a\x20\x20'+_0x2a5da6,_0x5dcef4);}try{const _0x56da9d=await syncActivationsForSegment(_0x7a2ad7,_0x11b0ec['parentId'],_0x15d4c9,_0x3767f0[_0x3fb2a4(0x242)][_0x3fb2a4(0x243)],_0x3767f0[_0x3fb2a4(0x262)],_0x5dc44b,_0x3767f0['absolutePath']);_0x3a3787[_0x3fb2a4(0x238)]=_0x56da9d;}catch(_0x1d54ba){if(_0x1d54ba instanceof SDKError)throw _0x1d54ba;throw new SDKError(ErrorCode[_0x3fb2a4(0x201)],_0x3fb2a4(0x22e)+_0x3767f0[_0x3fb2a4(0x242)][_0x3fb2a4(0x243)]+_0x3fb2a4(0x232)+_0x3767f0[_0x3fb2a4(0x219)]+_0x3fb2a4(0x2a6)+getErrorMessage(_0x1d54ba),_0x1d54ba);}return _0x3a3787;},_0x4bb622=await batchAsync(_0x55e847,_0x1f9501,_0x4b7408),_0x315b73={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x131f0b of _0x4bb622){_0x315b73[_0x19ac12(0x2b0)]+=_0x131f0b['created'],_0x315b73[_0x19ac12(0x265)]+=_0x131f0b[_0x19ac12(0x265)],_0x131f0b[_0x19ac12(0x1d2)]&&_0x315b73[_0x19ac12(0x286)][_0x19ac12(0x1db)](_0x131f0b[_0x19ac12(0x1d2)]['name'],_0x131f0b[_0x19ac12(0x1d2)]['id']),_0x315b73['activations']['created']+=_0x131f0b['activations']['created'],_0x315b73[_0x19ac12(0x238)][_0x19ac12(0x265)]+=_0x131f0b[_0x19ac12(0x238)][_0x19ac12(0x265)],_0x315b73[_0x19ac12(0x238)][_0x19ac12(0x26e)]+=_0x131f0b[_0x19ac12(0x238)][_0x19ac12(0x26e)];}return _0x315b73;}async function syncActivationsForSegment(_0x4b2faa,_0x513717,_0x2a26d3,_0x2d1b00,_0x301b88,_0xc93807,_0x5a596d){const _0x3c20b3=a155_0x2858,_0x2131fe={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0xb72b3e of _0x301b88){try{if(_0xb72b3e['type']===_0x3c20b3(0x297)&&_0xb72b3e[_0x3c20b3(0x2a5)])_0xc93807[_0x3c20b3(0x227)]?.({'type':_0x3c20b3(0x1c0),'segmentName':_0x2d1b00,'activationName':_0xb72b3e[_0x3c20b3(0x243)]}),await _0xc93807[_0x3c20b3(0x266)](_0x3c20b3(0x1ea)+_0xb72b3e['name']+_0x3c20b3(0x21b),()=>_0x4b2faa['segment'][_0x3c20b3(0x28f)](_0x513717,_0x2a26d3,_0xb72b3e['validatedRequest'])),_0xc93807[_0x3c20b3(0x227)]?.({'type':_0x3c20b3(0x20e),'segmentName':_0x2d1b00,'activationName':_0xb72b3e[_0x3c20b3(0x243)]}),_0xc93807['logSuccess']?.(_0x3c20b3(0x22a)+_0xb72b3e['name']+'\x27'),_0x2131fe['created']++;else{if(_0xb72b3e[_0x3c20b3(0x1df)]===_0x3c20b3(0x1d4)&&_0xb72b3e['validatedRequest']&&_0xb72b3e[_0x3c20b3(0x200)])_0xc93807['onProgress']?.({'type':_0x3c20b3(0x2ae),'segmentName':_0x2d1b00,'activationName':_0xb72b3e[_0x3c20b3(0x243)]}),await _0xc93807[_0x3c20b3(0x266)]('Updating\x20activation\x20\x27'+_0xb72b3e['name']+_0x3c20b3(0x21b),()=>_0x4b2faa[_0x3c20b3(0x1d9)][_0x3c20b3(0x2a3)](_0x513717,_0x2a26d3,_0xb72b3e[_0x3c20b3(0x200)]['id'],_0xb72b3e[_0x3c20b3(0x2a5)])),_0xc93807['onProgress']?.({'type':_0x3c20b3(0x21f),'segmentName':_0x2d1b00,'activationName':_0xb72b3e[_0x3c20b3(0x243)]}),_0xc93807[_0x3c20b3(0x296)]?.(_0x3c20b3(0x1c2)+_0xb72b3e[_0x3c20b3(0x243)]+'\x27'),_0x2131fe[_0x3c20b3(0x265)]++;else _0xb72b3e['type']==='delete'&&_0xb72b3e[_0x3c20b3(0x200)]&&(_0xc93807['onProgress']?.({'type':_0x3c20b3(0x256),'segmentName':_0x2d1b00,'activationName':_0xb72b3e[_0x3c20b3(0x243)]}),await _0xc93807[_0x3c20b3(0x266)](_0x3c20b3(0x1f3)+_0xb72b3e[_0x3c20b3(0x243)]+_0x3c20b3(0x21b),()=>_0x4b2faa[_0x3c20b3(0x1d9)][_0x3c20b3(0x29f)](_0x513717,_0x2a26d3,_0xb72b3e[_0x3c20b3(0x200)]['id'])),_0xc93807[_0x3c20b3(0x227)]?.({'type':_0x3c20b3(0x2c2),'segmentName':_0x2d1b00,'activationName':_0xb72b3e[_0x3c20b3(0x243)]}),_0xc93807[_0x3c20b3(0x255)]?.('Deleted\x20activation\x20\x27'+_0xb72b3e[_0x3c20b3(0x243)]+'\x27'),_0x2131fe[_0x3c20b3(0x26e)]++);}}catch(_0x211e4b){const _0xa57c3b=isHttp400Error(_0x211e4b),_0x3eccbd=_0xa57c3b?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0x3c20b3(0x201)],_0x16f551=getErrorMessage(_0x211e4b);throw new SDKError(_0x3eccbd,_0x3c20b3(0x1c6)+_0xb72b3e[_0x3c20b3(0x1df)]+_0x3c20b3(0x1be)+_0xb72b3e[_0x3c20b3(0x243)]+_0x3c20b3(0x232)+_0x5a596d+_0x3c20b3(0x2a6)+_0x16f551,_0x211e4b);}}return _0x2131fe;}export async function executePushFolders(_0x1dd02d,_0x13d453,_0x818a8e,_0x30f3ad,_0x4d7205){const _0x363d1e=a155_0x2858,_0x2f8cf4=new Map(_0x818a8e),_0x200276=sortFoldersByDepth(_0x13d453);for(const _0x578da8 of _0x200276){const _0x265b5d=_0x578da8[_0x363d1e(0x27d)]('/'),_0x2c8cb3=_0x265b5d[_0x265b5d[_0x363d1e(0x2bf)]-0x1],_0x1aa0d3=_0x265b5d[_0x363d1e(0x2a1)](0x0,-0x1)[_0x363d1e(0x1de)]('/'),_0x29db65=_0x2f8cf4['get'](_0x1aa0d3);_0x4d7205[_0x363d1e(0x227)]?.({'type':_0x363d1e(0x26b),'folder':_0x578da8});const _0x449a81={'name':_0x2c8cb3,'parentFolderId':_0x29db65},_0x3c8290=await _0x4d7205[_0x363d1e(0x266)](_0x363d1e(0x1ed)+_0x578da8+_0x363d1e(0x21b),()=>_0x1dd02d[_0x363d1e(0x1d9)][_0x363d1e(0x1ef)](_0x30f3ad['parentId'],_0x449a81));_0x2f8cf4[_0x363d1e(0x1db)](_0x578da8,_0x3c8290[_0x363d1e(0x226)]['id']),_0x4d7205[_0x363d1e(0x227)]?.({'type':'folder_created','folder':_0x578da8,'folderId':_0x3c8290[_0x363d1e(0x226)]['id']}),_0x4d7205[_0x363d1e(0x280)]?.(_0x363d1e(0x21c)+_0x578da8+'\x27');}return _0x2f8cf4;}export async function executePushSegmentDeletions(_0x36143e,_0x4e5e81,_0x1b836f){const _0xb1dd4e=a155_0x2858;if(_0x4e5e81['length']===0x0)return 0x0;const {batchAsync:_0x39208d}=await import(_0xb1dd4e(0x284)),_0x54ab31=0x5,_0x1863db=await _0x39208d(_0x4e5e81,async _0x32c139=>{const _0x304f00=_0xb1dd4e;return _0x1b836f[_0x304f00(0x227)]?.({'type':_0x304f00(0x225),'name':_0x32c139['name']}),await _0x36143e[_0x304f00(0x1d9)][_0x304f00(0x1fb)](_0x32c139['id']),_0x1b836f[_0x304f00(0x227)]?.({'type':_0x304f00(0x1eb),'name':_0x32c139[_0x304f00(0x243)]}),_0x1b836f[_0x304f00(0x255)]?.(_0x304f00(0x24d)+_0x32c139[_0x304f00(0x243)]+'\x27'),0x1;},_0x54ab31);return _0x1863db[_0xb1dd4e(0x239)]((_0x441f3a,_0x2deaa6)=>_0x441f3a+_0x2deaa6,0x0);}export async function executePushJourneys(_0x343484,_0x8062c4,_0x546216,_0xc03288,_0x2e13f0){const _0x3cc2f9=a155_0x2858,{journeyDefToRequest:_0x58b0ad}=await import(_0x3cc2f9(0x2c0)),{activationDefToCreateRequest:_0x4478f1,yamlRuleToApi:_0x2ac832,validateSegmentRule:_0x2f3dbe}=await import(_0x3cc2f9(0x1ec)),_0xc1c8a={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x413d6a=new Map(_0x546216['segmentNameToId']),_0x5130ef=0x5;for(let _0x69c43e=0x0;_0x69c43e<_0x8062c4[_0x3cc2f9(0x2bf)];_0x69c43e+=_0x5130ef){const _0xd96f1e=_0x8062c4['slice'](_0x69c43e,_0x69c43e+_0x5130ef),_0x32895d=await Promise[_0x3cc2f9(0x27b)](_0xd96f1e[_0x3cc2f9(0x2a0)](async _0x2b1dcd=>{const _0x36633e=_0x3cc2f9;if(!_0x2b1dcd['isNew']&&!_0x2b1dcd[_0x36633e(0x21a)])return{'action':_0x36633e(0x205),'name':_0x2b1dcd[_0x36633e(0x242)][_0x36633e(0x243)],'journeyId':_0x2b1dcd['existingJourney']?.['id']};const _0x35741a=_0x2b1dcd['folderPath']?_0x546216[_0x36633e(0x25c)][_0x36633e(0x28d)](_0x2b1dcd[_0x36633e(0x1cd)]):undefined;_0x2e13f0[_0x36633e(0x227)]?.({'type':_0x2b1dcd['isNew']?_0x36633e(0x220):_0x36633e(0x2b5),'name':_0x2b1dcd[_0x36633e(0x242)][_0x36633e(0x243)]});try{const _0x40c19d=await executeSingleJourneyPush(_0x343484,_0x2b1dcd,{..._0x546216,'segmentNameToId':_0x413d6a},{'parentId':_0xc03288[_0x36633e(0x253)],'rootFolderId':_0xc03288['rootFolderId'],'folderId':_0x35741a,'verbose':_0xc03288[_0x36633e(0x202)]},_0x2e13f0,{'journeyDefToRequest':_0x58b0ad,'activationDefToCreateRequest':_0x4478f1,'yamlRuleToApi':_0x2ac832,'validateSegmentRule':_0x2f3dbe});for(const [_0x4404cd,_0x584ba6]of _0x40c19d[_0x36633e(0x241)]){_0x413d6a[_0x36633e(0x1db)](_0x4404cd,_0x584ba6),_0xc1c8a['embeddedSegmentNameToId'][_0x36633e(0x1db)](_0x4404cd,_0x584ba6);}if(_0x40c19d[_0x36633e(0x271)]==='created')_0x2e13f0[_0x36633e(0x227)]?.({'type':_0x36633e(0x26a),'name':_0x2b1dcd[_0x36633e(0x242)][_0x36633e(0x243)],'journeyId':_0x40c19d[_0x36633e(0x2ba)]}),_0x2e13f0[_0x36633e(0x296)]?.('Created\x20journey\x20\x27'+_0x2b1dcd[_0x36633e(0x242)][_0x36633e(0x243)]+'\x27'),_0xc1c8a['created']++;else _0x40c19d['action']===_0x36633e(0x265)&&(_0x2e13f0['onProgress']?.({'type':_0x36633e(0x289),'name':_0x2b1dcd[_0x36633e(0x242)][_0x36633e(0x243)]}),_0x2e13f0[_0x36633e(0x296)]?.('Updated\x20journey\x20\x27'+_0x2b1dcd[_0x36633e(0x242)]['name']+'\x27'),_0xc1c8a[_0x36633e(0x265)]++);return{'action':_0x40c19d[_0x36633e(0x271)],'name':_0x2b1dcd[_0x36633e(0x242)][_0x36633e(0x243)],'journeyId':_0x40c19d['journeyId']};}catch(_0x204a90){const _0x5d6f00=isHttp400Error(_0x204a90),_0x2cf9bf=_0x5d6f00?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode[_0x36633e(0x1f9)],_0x5d1d93=getErrorMessage(_0x204a90);throw new SDKError(_0x2cf9bf,_0x36633e(0x1c6)+(_0x2b1dcd[_0x36633e(0x293)]?_0x36633e(0x297):'update')+_0x36633e(0x249)+_0x2b1dcd[_0x36633e(0x219)]+_0x36633e(0x2a6)+_0x5d1d93,_0x204a90);}}));_0xc1c8a[_0x3cc2f9(0x1ca)][_0x3cc2f9(0x25f)](..._0x32895d);}return _0xc1c8a;}async function matchExistingJourneySegments(_0x3d8c1e,_0x4faec9,_0x3a9669,_0x3fe9ce,_0x1b180e){const _0x335e95=a155_0x2858;if(!_0x4faec9['existingJourney']||!_0x4faec9['yamlConfig']['segments'])return;const _0x32e1c0=new Map(),_0x482aa3=new Set();for(const _0x5102c8 of Object[_0x335e95(0x1cb)](_0x4faec9[_0x335e95(0x242)]['segments'])){const _0x1c2f05=generateDeterministicJourneySegmentName(_0x4faec9['yamlConfig'][_0x335e95(0x243)],_0x5102c8);_0x32e1c0[_0x335e95(0x1db)](_0x1c2f05,_0x5102c8),_0x482aa3[_0x335e95(0x2ab)](_0x5102c8);}const _0x48721c=[],_0x41adb4=collectSegmentIdsFromJourneyApi(_0x4faec9['existingJourney']);for(const _0x55ad4f of _0x41adb4){const _0x17868c=await fetchSegment(_0x3d8c1e,_0x3a9669,_0x55ad4f,_0x3fe9ce);if(!_0x17868c?.[_0x335e95(0x243)])continue;const _0x2a489e=_0x32e1c0[_0x335e95(0x28d)](_0x17868c[_0x335e95(0x243)]);_0x2a489e?(_0x1b180e[_0x335e95(0x1db)](_0x2a489e,_0x55ad4f),_0x482aa3[_0x335e95(0x1d5)](_0x2a489e)):_0x48721c[_0x335e95(0x25f)]({'id':_0x55ad4f,'seg':_0x17868c});}if(_0x482aa3['size']>0x0&&_0x48721c[_0x335e95(0x2bf)]>0x0){const {localExpandedRuleToNames:_0xe0c72d}=buildLocalExpandedRuleMappings(_0x4faec9[_0x335e95(0x242)]),_0x1e0def=new Map();for(const {id:_0x4b2e2d,seg:_0x113793}of _0x48721c){if(_0x113793[_0x335e95(0x244)]){const _0x20dda5=apiRuleToYaml(_0x113793[_0x335e95(0x244)]);_0x1e0def['set'](_0x4b2e2d,_0x20dda5);}}for(const {id:_0x40db1a,seg:_0x5291b9}of _0x48721c){if(!_0x5291b9['rule'])continue;const _0x5155cf=_0x1e0def[_0x335e95(0x28d)](_0x40db1a);if(!_0x5155cf)continue;const _0x4c6763=serializeExpandedRule(_0x5155cf,_0x1e0def),_0x5913e3=_0xe0c72d['get'](_0x4c6763);if(_0x5913e3){const _0x1e781a=_0x5913e3[_0x335e95(0x264)](_0x2c8287=>_0x482aa3['has'](_0x2c8287));_0x1e781a&&(_0x1b180e[_0x335e95(0x1db)](_0x1e781a,_0x40db1a),_0x482aa3[_0x335e95(0x1d5)](_0x1e781a),logger[_0x335e95(0x2b6)](_0x335e95(0x1d1)+_0x5291b9[_0x335e95(0x243)]+_0x335e95(0x24a)+_0x1e781a+_0x335e95(0x291)));}}}}async function executeSingleJourneyPush(_0x5e3e64,_0x3543e2,_0x2c4c46,_0x4d4e5f,_0xa918a,_0x4ce4ad){const _0x2a8d7a=a155_0x2858,{journeyDefToRequest:_0x5e70db,activationDefToCreateRequest:_0x57fe24,yamlRuleToApi:_0x186997,validateSegmentRule:_0x38a1a2}=_0x4ce4ad,_0x10af87=new Map(),_0x478c70=new Map();recoverSegmentIdsFromPushRecovery(_0x3543e2,_0x10af87,_0x2c4c46[_0x2a8d7a(0x263)]);const _0x183e1a=new Map(),_0x39fcf7=new Map(),_0x57f007=new Map();let _0x514270;const _0x4e73a2=async()=>{const _0x3a5e96=_0x2a8d7a;if(_0x514270)return;_0x514270=new Map();if(!_0x3543e2['existingJourney'])return;const _0x404311=await _0x5e3e64[_0x3a5e96(0x2a8)][_0x3a5e96(0x1e2)](_0x3543e2[_0x3a5e96(0x1d8)]['id']);for(const _0x1adde6 of _0x404311){const _0x391650=journeyActivationStepToYaml(_0x1adde6,_0x2c4c46[_0x3a5e96(0x277)],_0x2c4c46[_0x3a5e96(0x23b)]),_0x41f84d=activationSignature(_0x391650);!_0x514270[_0x3a5e96(0x1e8)](_0x41f84d)&&_0x514270[_0x3a5e96(0x1db)](_0x41f84d,_0x1adde6['id']),_0x391650['name']&&_0x478c70[_0x3a5e96(0x1db)](_0x391650['name'],_0x1adde6['id']);}};await matchExistingJourneySegments(_0x5e3e64,_0x3543e2,_0x4d4e5f[_0x2a8d7a(0x253)],_0x2c4c46[_0x2a8d7a(0x1e5)],_0x2c4c46['segmentNameToId']);const _0x2a724c={'resolveSegmentId':async _0x151b8c=>{const _0x333e06=_0x2a8d7a,_0x27f438=_0x2c4c46[_0x333e06(0x263)][_0x333e06(0x28d)](_0x151b8c);if(!_0x27f438)throw new SDKError(ErrorCode[_0x333e06(0x285)],_0x333e06(0x28c)+_0x151b8c+_0x333e06(0x298)+_0x3543e2['yamlConfig'][_0x333e06(0x243)]+')');return _0x27f438;},'resolveEmbeddedSegmentId':async(_0x5a0b1a,_0x187431)=>{const _0x4010e0=_0x2a8d7a,_0x110b5b=_0x2c4c46['segmentNameToId'][_0x4010e0(0x28d)](_0x5a0b1a);if(_0x110b5b)return _0x110b5b;const _0x11ae9d=_0x2c4c46['existingSegments']['find'](_0x1d75d6=>_0x1d75d6[_0x4010e0(0x243)]===_0x5a0b1a);if(_0x11ae9d)return _0x2c4c46['segmentNameToId'][_0x4010e0(0x1db)](_0x5a0b1a,_0x11ae9d['id']),_0x11ae9d['id'];if(_0x3543e2[_0x4010e0(0x293)]){const {stageName:_0x3ee886,criteriaName:_0xeef826}=findSegmentCriteriaLocation(_0x3543e2[_0x4010e0(0x242)],_0x5a0b1a);return _0x38a1a2(_0x5a0b1a,_0x187431[_0x4010e0(0x244)]),_0x39fcf7[_0x4010e0(0x1db)](_0x5a0b1a,{'definition':_0x187431,'stageName':_0x3ee886,'criteriaName':_0xeef826}),createPendingSegmentId(_0x5a0b1a);}const _0x375649=_0x3543e2[_0x4010e0(0x1d8)]?.['id'];if(!_0x375649)throw new SDKError(ErrorCode[_0x4010e0(0x1bf)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x876c8f=_0x183e1a[_0x4010e0(0x28d)](_0x5a0b1a);if(_0x876c8f)return _0x876c8f;const _0x4b4f31=((async()=>{const _0x133dc1=_0x4010e0;_0x38a1a2(_0x5a0b1a,_0x187431[_0x133dc1(0x244)]);const _0x51b88f=generateDeterministicJourneySegmentName(_0x3543e2[_0x133dc1(0x242)][_0x133dc1(0x243)],_0x5a0b1a),_0x36d1da=_0x2c4c46[_0x133dc1(0x1e5)]['find'](_0x317c8c=>_0x317c8c['name']===_0x51b88f),_0x33eba1=createSegmentIdResolver(_0x2c4c46[_0x133dc1(0x263)],_0x5a0b1a),_0x579529=await resolveRuleSegmentIds(_0x187431[_0x133dc1(0x244)],_0x33eba1);let _0x125afa;return _0x36d1da?(await _0x5e3e64[_0x133dc1(0x1d9)][_0x133dc1(0x22d)](_0x4d4e5f[_0x133dc1(0x253)],_0x36d1da['id'],{'description':_0x187431[_0x133dc1(0x25a)]||_0x133dc1(0x1e3)+_0x5a0b1a,'rule':_0x186997(_0x579529),'countPopulation':!![]}),_0x125afa=_0x36d1da['id'],saveSegmentToPushRecovery(_0x3543e2['absolutePath'],_0x3543e2[_0x133dc1(0x242)][_0x133dc1(0x243)],_0x5a0b1a,{'segmentId':_0x125afa,'uniqueServerName':_0x51b88f,'createdAt':new Date()[_0x133dc1(0x2b7)]()})):_0x125afa=await createOrRecoverEmbeddedSegment(_0x5e3e64,_0x3543e2,{'localName':_0x5a0b1a,'uniqueSegmentName':_0x51b88f,'description':_0x187431[_0x133dc1(0x25a)]||'Entry\x20criteria:\x20'+_0x5a0b1a,'journeyId':_0x375649,'resolvedRule':_0x579529,'parentId':_0x4d4e5f['parentId'],'folderId':_0x4d4e5f[_0x133dc1(0x1d3)]||''},_0x186997),_0x2c4c46[_0x133dc1(0x263)][_0x133dc1(0x1db)](_0x5a0b1a,_0x125afa),_0x10af87[_0x133dc1(0x1db)](_0x5a0b1a,_0x125afa),_0x125afa;})());_0x183e1a[_0x4010e0(0x1db)](_0x5a0b1a,_0x4b4f31);try{return await _0x4b4f31;}finally{_0x183e1a[_0x4010e0(0x1d5)](_0x5a0b1a);}},'resolveActivationId':async _0x485bcc=>{const _0x35e9d6=_0x2a8d7a,_0x2c8e35=_0x478c70[_0x35e9d6(0x28d)](_0x485bcc);if(_0x2c8e35)return _0x2c8e35;if(_0x3543e2[_0x35e9d6(0x1d8)]){await _0x4e73a2();const _0x128405=_0x478c70[_0x35e9d6(0x28d)](_0x485bcc);if(_0x128405)return _0x128405;}throw new SDKError(ErrorCode[_0x35e9d6(0x1c5)],_0x35e9d6(0x22b)+_0x485bcc+_0x35e9d6(0x298)+_0x3543e2[_0x35e9d6(0x242)][_0x35e9d6(0x243)]+').\x20'+_0x35e9d6(0x258));},'resolveEmbeddedActivationId':async(_0x32037e,_0x26578b)=>{const _0x1d2b4e=_0x2a8d7a,_0x5af93f=_0x478c70[_0x1d2b4e(0x28d)](_0x32037e);if(_0x5af93f)return _0x5af93f;if(_0x3543e2['isNew'])return _0x57f007[_0x1d2b4e(0x1db)](_0x32037e,_0x26578b),createPendingActivationId(_0x32037e);if(_0x3543e2['existingJourney']){await _0x4e73a2();const _0x363201=_0x478c70[_0x1d2b4e(0x28d)](_0x26578b[_0x1d2b4e(0x243)]);if(_0x363201)return _0x478c70[_0x1d2b4e(0x1db)](_0x32037e,_0x363201),_0x363201;const _0x381020=activationSignature(_0x26578b),_0x1de73c=_0x514270?.['get'](_0x381020);if(_0x1de73c)return _0x478c70[_0x1d2b4e(0x1db)](_0x32037e,_0x1de73c),_0x1de73c;const _0x5b22a1=await _0x57fe24(_0x26578b,_0x2c4c46[_0x1d2b4e(0x235)]),_0x1052d3={..._0x5b22a1,..._0x26578b[_0x1d2b4e(0x2b9)]!==undefined&&{'runAfterJourneyRefresh':_0x26578b['run_after_journey_refresh']}},_0xbedc05=await _0x5e3e64[_0x1d2b4e(0x2a8)][_0x1d2b4e(0x28f)](_0x3543e2['existingJourney']['id'],_0x1052d3);return _0x478c70[_0x1d2b4e(0x1db)](_0x32037e,_0xbedc05['id']),_0xbedc05['id'];}throw new SDKError(ErrorCode[_0x1d2b4e(0x1bf)],_0x1d2b4e(0x21d));},'resolveJourneyId':async _0x49b7f8=>{const _0x40e216=_0x2a8d7a;try{return await _0x5e3e64[_0x40e216(0x2a8)]['resolveJourneyId'](_0x4d4e5f[_0x40e216(0x253)],_0x49b7f8);}catch(_0x21f62a){throw new SDKError(ErrorCode[_0x40e216(0x1c5)],_0x40e216(0x1c4)+_0x49b7f8+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x3543e2['yamlConfig'][_0x40e216(0x243)]+'\x27)',_0x21f62a);}},'resolveStageId':async(_0x3a37e5,_0x1025ab)=>{const _0x5c0a3f=_0x2a8d7a,_0x133fbb=await _0x5e3e64[_0x5c0a3f(0x2a8)][_0x5c0a3f(0x268)](_0x3a37e5),_0x3b3f42=_0x133fbb[_0x5c0a3f(0x228)][_0x5c0a3f(0x2be)]['find'](_0xa9ff07=>_0xa9ff07[_0x5c0a3f(0x243)][_0x5c0a3f(0x24b)]()===_0x1025ab[_0x5c0a3f(0x24b)]());if(!_0x3b3f42?.['id'])throw new SDKError(ErrorCode[_0x5c0a3f(0x1c5)],_0x5c0a3f(0x2bd)+_0x1025ab+_0x5c0a3f(0x209)+(_0x133fbb[_0x5c0a3f(0x228)]['journeyBundleName']||_0x133fbb[_0x5c0a3f(0x228)][_0x5c0a3f(0x243)])+'\x27');return _0x3b3f42['id'];}},_0x3b4672=await _0x5e70db(_0x3543e2[_0x2a8d7a(0x242)],_0x4d4e5f['parentId'],_0x2a724c),_0x2dba00=_0x4d4e5f[_0x2a8d7a(0x2b1)]||_0x4d4e5f[_0x2a8d7a(0x1d3)];_0x2dba00&&(_0x3b4672[_0x2a8d7a(0x2a4)]={'parentFolder':{'data':{'id':_0x2dba00,'type':_0x2a8d7a(0x1e6)}}});if(_0x3543e2[_0x2a8d7a(0x293)]){if(_0x39fcf7[_0x2a8d7a(0x222)]>0x0||_0x57f007[_0x2a8d7a(0x222)]>0x0)return await executeThreeStepJourneyCreate(_0x5e3e64,_0x3543e2,_0x3b4672,{'pendingEmbeddedSegments':_0x39fcf7,'pendingEmbeddedActivations':_0x57f007,'embeddedSegmentNameToId':_0x10af87,'journeyActivationNameToId':_0x478c70},{..._0x4d4e5f,'effectiveFolderId':_0x2dba00},_0x2c4c46,_0xa918a,_0x4ce4ad);else{ensureJourneyDefaults(_0x3b4672[_0x2a8d7a(0x228)]);const _0x4e8aae=await _0x5e3e64[_0x2a8d7a(0x2a8)][_0x2a8d7a(0x297)](_0x3b4672);return deletePushRecovery(_0x3543e2[_0x2a8d7a(0x219)]),{'action':_0x2a8d7a(0x2b0),'journeyId':_0x4e8aae['id'],'embeddedSegmentNameToId':_0x10af87};}}else{if(_0x3543e2[_0x2a8d7a(0x21a)]&&_0x3543e2[_0x2a8d7a(0x1d8)]){_0x3b4672['id']=_0x3543e2[_0x2a8d7a(0x1d8)]['id'];const _0x2e8480=_0x3b4672[_0x2a8d7a(0x228)];_0x3543e2[_0x2a8d7a(0x1d8)][_0x2a8d7a(0x228)]?.[_0x2a8d7a(0x1f4)]&&(_0x2e8480[_0x2a8d7a(0x1f4)]=_0x3543e2[_0x2a8d7a(0x1d8)][_0x2a8d7a(0x228)][_0x2a8d7a(0x1f4)]);const _0x433260=_0x3543e2[_0x2a8d7a(0x1d8)][_0x2a8d7a(0x228)]?.['journeyStages'];return _0x433260&&_0x3b4672[_0x2a8d7a(0x228)][_0x2a8d7a(0x2be)]&&injectExistingStageIds(_0x3b4672['attributes'][_0x2a8d7a(0x2be)],_0x433260),ensureJourneyDefaults(_0x2e8480),await _0x5e3e64[_0x2a8d7a(0x2a8)][_0x2a8d7a(0x1d4)](_0x3543e2[_0x2a8d7a(0x1d8)]['id'],_0x3b4672),deletePushRecovery(_0x3543e2['absolutePath']),{'action':_0x2a8d7a(0x265),'journeyId':_0x3543e2[_0x2a8d7a(0x1d8)]['id'],'embeddedSegmentNameToId':_0x10af87};}}return deletePushRecovery(_0x3543e2['absolutePath']),{'action':_0x2a8d7a(0x205),'journeyId':_0x3543e2[_0x2a8d7a(0x1d8)]?.['id'],'embeddedSegmentNameToId':_0x10af87};}function findSegmentCriteriaLocation(_0x5ca107,_0x446a4c){const _0x2e0123=a155_0x2858,_0x34c096=_0x5ca107[_0x2e0123(0x224)]||_0x5ca107['journeys']?.[0x0]?.[_0x2e0123(0x224)]||[];let _0x1957f8=_0x2e0123(0x250),_0x2f46d4=_0x446a4c;const _0x367150=_0x5ca107['goal']||_0x5ca107['journeys']?.[0x0]?.[_0x2e0123(0x287)];if(_0x367150?.[_0x2e0123(0x1d9)]===_0x446a4c)return{'stageName':'goal','criteriaName':_0x367150[_0x2e0123(0x243)]||_0x446a4c};_0x213eca:for(const _0xc7b23 of _0x34c096){if(_0xc7b23[_0x2e0123(0x23d)]?.['segment']===_0x446a4c){_0x1957f8=_0xc7b23[_0x2e0123(0x243)],_0x2f46d4=_0xc7b23[_0x2e0123(0x23d)]['name']||_0x446a4c;break;}if(_0xc7b23['steps'])for(const _0x2d5be of _0xc7b23[_0x2e0123(0x275)]){if(_0x2d5be[_0x2e0123(0x1df)]===_0x2e0123(0x276)&&_0x2d5be[_0x2e0123(0x26c)]?.[_0x2e0123(0x204)])for(const _0x3d42ac of _0x2d5be[_0x2e0123(0x26c)][_0x2e0123(0x204)]){if(_0x3d42ac[_0x2e0123(0x1d9)]===_0x446a4c){_0x1957f8=_0xc7b23['name'],_0x2f46d4=_0x3d42ac[_0x2e0123(0x243)]||_0x446a4c;break _0x213eca;}}}}return{'stageName':_0x1957f8,'criteriaName':_0x2f46d4};}async function executeThreeStepJourneyCreate(_0x1205df,_0x135d32,_0x392bd9,_0x161cc5,_0x2d7a61,_0x5d5796,_0x575605,_0x4b5c03){const _0x5bfce3=a155_0x2858,{activationDefToCreateRequest:_0x4b48ec,yamlRuleToApi:_0x3d5ff4}=_0x4b5c03,{pendingEmbeddedSegments:_0x6b19e3,pendingEmbeddedActivations:_0x45ca87,embeddedSegmentNameToId:_0x377f6b}=_0x161cc5,_0x18dc06=JSON[_0x5bfce3(0x20a)](JSON[_0x5bfce3(0x230)](_0x392bd9));ensureJourneyDefaults(_0x18dc06[_0x5bfce3(0x228)]),stripPendingIds(_0x18dc06);const _0x3dfe8c=await _0x1205df[_0x5bfce3(0x2a8)][_0x5bfce3(0x297)](_0x18dc06),_0x13e272=_0x3dfe8c['id'],_0x527654=new Map();for(const _0x273922 of _0x3dfe8c[_0x5bfce3(0x228)][_0x5bfce3(0x2be)]){_0x527654[_0x5bfce3(0x1db)](_0x273922[_0x5bfce3(0x243)]['toLowerCase'](),_0x273922['id']);}recoverSegmentIdsFromPushRecovery(_0x135d32,_0x377f6b,_0x5d5796[_0x5bfce3(0x263)]);for(const [_0x181643,{definition:_0x27b6a5}]of _0x6b19e3){if(_0x377f6b[_0x5bfce3(0x1e8)](_0x181643)){_0x575605[_0x5bfce3(0x227)]?.({'type':_0x5bfce3(0x27a),'journeyName':_0x135d32[_0x5bfce3(0x242)][_0x5bfce3(0x243)],'segmentName':_0x181643});continue;}const _0x517bd2=generateDeterministicJourneySegmentName(_0x135d32['yamlConfig'][_0x5bfce3(0x243)],_0x181643);_0x575605[_0x5bfce3(0x227)]?.({'type':'embedded_segment_creating','journeyName':_0x135d32[_0x5bfce3(0x242)]['name'],'segmentName':_0x181643});const _0x42c1da=createSegmentIdResolver(_0x5d5796['segmentNameToId'],_0x181643),_0x4ac54d=await resolveRuleSegmentIds(_0x27b6a5['rule'],_0x42c1da),_0x2bf6af=await createOrRecoverEmbeddedSegment(_0x1205df,_0x135d32,{'localName':_0x181643,'uniqueSegmentName':_0x517bd2,'description':_0x27b6a5[_0x5bfce3(0x25a)]||_0x5bfce3(0x1e3)+_0x181643,'journeyId':_0x13e272,'resolvedRule':_0x4ac54d,'parentId':_0x2d7a61['parentId'],'folderId':_0x2d7a61[_0x5bfce3(0x294)]||''},_0x3d5ff4);_0x377f6b[_0x5bfce3(0x1db)](_0x181643,_0x2bf6af),_0x5d5796[_0x5bfce3(0x263)]['set'](_0x181643,_0x2bf6af),_0x575605[_0x5bfce3(0x227)]?.({'type':_0x5bfce3(0x27a),'journeyName':_0x135d32[_0x5bfce3(0x242)][_0x5bfce3(0x243)],'segmentName':_0x181643});}const _0x3d8d2b=new Map();for(const [_0x14f583,_0x12be28]of _0x45ca87){_0x575605[_0x5bfce3(0x227)]?.({'type':_0x5bfce3(0x29d),'journeyName':_0x135d32[_0x5bfce3(0x242)]['name'],'activationName':_0x14f583});const _0x524e99=await _0x4b48ec(_0x12be28,_0x5d5796[_0x5bfce3(0x235)]),_0x374140={..._0x524e99,..._0x12be28['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x12be28[_0x5bfce3(0x2b9)]}},_0x1bb1d9=await _0x1205df['journey']['createActivation'](_0x13e272,_0x374140);_0x3d8d2b[_0x5bfce3(0x1db)](_0x14f583,_0x1bb1d9['id']),_0x161cc5[_0x5bfce3(0x1f7)]['set'](_0x14f583,_0x1bb1d9['id']),_0x575605[_0x5bfce3(0x227)]?.({'type':_0x5bfce3(0x1c8),'journeyName':_0x135d32[_0x5bfce3(0x242)][_0x5bfce3(0x243)],'activationName':_0x14f583});}const _0x1b9835=JSON[_0x5bfce3(0x20a)](JSON[_0x5bfce3(0x230)](_0x392bd9));return _0x1b9835['id']=_0x13e272,ensureJourneyDefaults(_0x1b9835[_0x5bfce3(0x228)]),resolvePendingIdsInRequest(_0x1b9835,_0x392bd9,_0x527654,_0x377f6b,_0x3d8d2b,_0x575605),await _0x1205df[_0x5bfce3(0x2a8)][_0x5bfce3(0x1d4)](_0x13e272,_0x1b9835),deletePushRecovery(_0x135d32['absolutePath']),{'action':_0x5bfce3(0x2b0),'journeyId':_0x13e272,'embeddedSegmentNameToId':_0x377f6b};}export function stripWaitStepPendingIds(_0x3603e6){const _0x44fe0b=a155_0x2858,_0x4e5c63=_0x3603e6['conditionSegmentId']&&isPendingSegmentId(_0x3603e6[_0x44fe0b(0x1ce)]),_0x29b2fb=_0x3603e6[_0x44fe0b(0x2bb)]?.['some'](_0x38c95d=>_0x38c95d[_0x44fe0b(0x25e)]&&isPendingSegmentId(_0x38c95d[_0x44fe0b(0x25e)]));(_0x4e5c63||_0x29b2fb)&&(_0x3603e6[_0x44fe0b(0x206)]='Duration',_0x3603e6[_0x44fe0b(0x234)]=0x1,_0x3603e6['waitStepUnit']=_0x44fe0b(0x1f0),delete _0x3603e6[_0x44fe0b(0x1ce)],delete _0x3603e6[_0x44fe0b(0x233)],delete _0x3603e6[_0x44fe0b(0x274)],delete _0x3603e6['conditions']);}export function resolveWaitStepPendingIds(_0x3dab3d,_0x5f3b6c,_0x5aa506,_0x2ef3db){const _0xd439cb=a155_0x2858;if(_0x5f3b6c['conditionSegmentId']&&isPendingSegmentId(_0x5f3b6c[_0xd439cb(0x1ce)])){const _0x171291=_0x5aa506(_0x5f3b6c[_0xd439cb(0x1ce)],_0xd439cb(0x208)+_0x2ef3db+'\x27\x20wait\x20condition');_0x171291&&(_0x3dab3d[_0xd439cb(0x206)]=_0xd439cb(0x23a),_0x3dab3d[_0xd439cb(0x1ce)]=_0x171291,delete _0x3dab3d[_0xd439cb(0x234)],delete _0x3dab3d[_0xd439cb(0x1dd)],_0x5f3b6c['conditionTimeoutDuration']!==undefined&&(_0x3dab3d[_0xd439cb(0x233)]=_0x5f3b6c[_0xd439cb(0x233)]),_0x5f3b6c['conditionTimeoutUnit']&&(_0x3dab3d[_0xd439cb(0x274)]=_0x5f3b6c[_0xd439cb(0x274)]));}if(_0x5f3b6c[_0xd439cb(0x2bb)]){const _0x30ce05=_0x5f3b6c[_0xd439cb(0x2bb)][_0xd439cb(0x1ff)](_0x17a807=>_0x17a807[_0xd439cb(0x25e)]&&isPendingSegmentId(_0x17a807[_0xd439cb(0x25e)]));if(_0x30ce05){const _0x521b21=_0x5f3b6c[_0xd439cb(0x2bb)][_0xd439cb(0x2a0)](_0x45e08f=>{const _0x2aff0d=_0xd439cb;if(_0x45e08f['segmentId']&&isPendingSegmentId(_0x45e08f[_0x2aff0d(0x25e)])){const _0x12a853=_0x5aa506(_0x45e08f[_0x2aff0d(0x25e)],'stage\x20\x27'+_0x2ef3db+'\x27\x20wait\x20condition');return{..._0x45e08f,'segmentId':_0x12a853||_0x45e08f[_0x2aff0d(0x25e)]};}return{..._0x45e08f};});_0x3dab3d['waitStepType']='Condition',_0x3dab3d[_0xd439cb(0x2bb)]=_0x521b21,delete _0x3dab3d['waitStep'],delete _0x3dab3d[_0xd439cb(0x1dd)],delete _0x3dab3d[_0xd439cb(0x1ce)],delete _0x3dab3d['conditionTimeoutDuration'],delete _0x3dab3d[_0xd439cb(0x274)];}}}function stripPendingIds(_0x188683){const _0x35f49a=a155_0x2858;_0x188683[_0x35f49a(0x228)][_0x35f49a(0x287)]?.['segmentId']&&isPendingSegmentId(_0x188683[_0x35f49a(0x228)]['goal'][_0x35f49a(0x25e)])&&delete _0x188683[_0x35f49a(0x228)]['goal'];for(const _0x5d0a1c of _0x188683['attributes'][_0x35f49a(0x2be)]||[]){_0x5d0a1c[_0x35f49a(0x292)]?.['segmentId']&&isPendingSegmentId(_0x5d0a1c[_0x35f49a(0x292)][_0x35f49a(0x25e)])&&delete _0x5d0a1c[_0x35f49a(0x292)];_0x5d0a1c[_0x35f49a(0x269)]?.[_0x35f49a(0x25e)]&&isPendingSegmentId(_0x5d0a1c['milestone'][_0x35f49a(0x25e)])&&delete _0x5d0a1c[_0x35f49a(0x269)];_0x5d0a1c[_0x35f49a(0x273)]&&(_0x5d0a1c[_0x35f49a(0x273)]=_0x5d0a1c[_0x35f49a(0x273)][_0x35f49a(0x27e)](_0x4ea818=>!_0x4ea818[_0x35f49a(0x25e)]||!isPendingSegmentId(_0x4ea818[_0x35f49a(0x25e)])));if(_0x5d0a1c['steps'])for(const _0xdb6a01 of Object[_0x35f49a(0x1cb)](_0x5d0a1c['steps'])){const _0xc6b7ca=_0x5d0a1c[_0x35f49a(0x275)][_0xdb6a01];_0xc6b7ca['type']===_0x35f49a(0x1d0)&&_0xc6b7ca[_0x35f49a(0x236)]&&isPendingActivationId(_0xc6b7ca[_0x35f49a(0x236)])&&(_0xc6b7ca[_0x35f49a(0x236)]='');if(_0xc6b7ca[_0x35f49a(0x1df)]===_0x35f49a(0x2ac)&&_0xc6b7ca['branches'])for(const _0x18a0c9 of _0xc6b7ca[_0x35f49a(0x204)]){_0x18a0c9[_0x35f49a(0x25e)]&&isPendingSegmentId(_0x18a0c9[_0x35f49a(0x25e)])&&(_0x18a0c9[_0x35f49a(0x25e)]='');}_0xc6b7ca['type']==='WaitStep'&&stripWaitStepPendingIds(_0xc6b7ca);}}}function resolvePendingIdsInRequest(_0x58be16,_0x3a88d8,_0x4a51aa,_0x5e0004,_0x349e49,_0x151c5f){const _0x346561=a155_0x2858,_0x53cd5a=(_0x258edf,_0x18196b)=>{const _0x2b1ca7=a155_0x2858;if(!isPendingSegmentId(_0x258edf))return _0x258edf;const _0x348bff=extractPendingSegmentName(_0x258edf),_0x1901c8=_0x5e0004['get'](_0x348bff);return!_0x1901c8&&_0x151c5f[_0x2b1ca7(0x28a)]?.(_0x2b1ca7(0x212)+_0x348bff+'\x27\x20for\x20'+_0x18196b),_0x1901c8;};if(_0x58be16[_0x346561(0x228)][_0x346561(0x287)]?.[_0x346561(0x25e)]&&isPendingSegmentId(_0x58be16[_0x346561(0x228)]['goal'][_0x346561(0x25e)])){const _0x456fbd=_0x53cd5a(_0x58be16[_0x346561(0x228)][_0x346561(0x287)][_0x346561(0x25e)],_0x346561(0x22c));_0x456fbd&&(_0x58be16[_0x346561(0x228)][_0x346561(0x287)]['segmentId']=_0x456fbd);}for(const _0x430098 of _0x58be16['attributes']['journeyStages']||[]){const _0x450f17=_0x4a51aa[_0x346561(0x28d)](_0x430098['name']['toLowerCase']());_0x450f17&&(_0x430098['id']=_0x450f17);if(_0x430098[_0x346561(0x292)]?.[_0x346561(0x25e)]&&isPendingSegmentId(_0x430098[_0x346561(0x292)]['segmentId'])){const _0x32ce6b=_0x53cd5a(_0x430098[_0x346561(0x292)][_0x346561(0x25e)],_0x346561(0x208)+_0x430098['name']+_0x346561(0x1c1));_0x32ce6b&&(_0x430098['entryCriteria'][_0x346561(0x25e)]=_0x32ce6b);}if(_0x430098[_0x346561(0x273)])for(const _0x526e2f of _0x430098['exitCriterias']){if(_0x526e2f[_0x346561(0x25e)]&&isPendingSegmentId(_0x526e2f['segmentId'])){const _0x2cdf26=_0x53cd5a(_0x526e2f[_0x346561(0x25e)],_0x346561(0x208)+_0x430098[_0x346561(0x243)]+_0x346561(0x283));_0x2cdf26&&(_0x526e2f['segmentId']=_0x2cdf26);}}if(_0x430098[_0x346561(0x269)]?.[_0x346561(0x25e)]&&isPendingSegmentId(_0x430098[_0x346561(0x269)][_0x346561(0x25e)])){const _0x59e26e=_0x53cd5a(_0x430098[_0x346561(0x269)][_0x346561(0x25e)],_0x346561(0x208)+_0x430098['name']+_0x346561(0x1bd));_0x59e26e&&(_0x430098[_0x346561(0x269)][_0x346561(0x25e)]=_0x59e26e);}if(_0x430098[_0x346561(0x275)]){const _0x3f7eb3=_0x6046f8=>_0x3a88d8[_0x346561(0x228)][_0x346561(0x2be)]?.[_0x346561(0x264)](_0x65d5c3=>_0x65d5c3[_0x346561(0x243)][_0x346561(0x24b)]()===_0x430098[_0x346561(0x243)][_0x346561(0x24b)]())?.[_0x346561(0x275)]?.[_0x6046f8];for(const _0x2ff609 of Object[_0x346561(0x1cb)](_0x430098[_0x346561(0x275)])){const _0x4d634a=_0x430098[_0x346561(0x275)][_0x2ff609],_0x5ae6ba=_0x3f7eb3(_0x2ff609);if(_0x4d634a['type']===_0x346561(0x1d0)&&_0x4d634a[_0x346561(0x236)]&&(isPendingActivationId(_0x4d634a[_0x346561(0x236)])||_0x4d634a['journeyActivationStepId']==='')){if(_0x5ae6ba?.[_0x346561(0x236)]&&isPendingActivationId(_0x5ae6ba[_0x346561(0x236)])){const _0x43fe6e=extractPendingActivationName(_0x5ae6ba[_0x346561(0x236)]),_0x58b09b=_0x349e49['get'](_0x43fe6e);_0x58b09b&&(_0x4d634a['journeyActivationStepId']=_0x58b09b);}}if(_0x4d634a[_0x346561(0x1df)]===_0x346561(0x2ac)&&_0x4d634a[_0x346561(0x204)]&&_0x5ae6ba?.[_0x346561(0x204)])for(let _0x123974=0x0;_0x123974<_0x4d634a[_0x346561(0x204)][_0x346561(0x2bf)];_0x123974++){const _0x3d316c=_0x4d634a['branches'][_0x123974],_0x2fdecb=_0x5ae6ba[_0x346561(0x204)][_0x123974];if(_0x2fdecb?.[_0x346561(0x25e)]&&isPendingSegmentId(_0x2fdecb[_0x346561(0x25e)])){const _0x490c81=_0x53cd5a(_0x2fdecb[_0x346561(0x25e)],_0x346561(0x208)+_0x430098[_0x346561(0x243)]+_0x346561(0x27f)+(_0x3d316c[_0x346561(0x243)]||_0x123974)+'\x27');_0x490c81&&(_0x3d316c[_0x346561(0x25e)]=_0x490c81);}}_0x4d634a['type']===_0x346561(0x272)&&_0x5ae6ba?.[_0x346561(0x1df)]===_0x346561(0x272)&&resolveWaitStepPendingIds(_0x4d634a,_0x5ae6ba,_0x53cd5a,_0x430098[_0x346561(0x243)]);}}}}
1
+ const a155_0x213229=a155_0x27e5;(function(_0x4f8b6a,_0x7f42f0){const _0x1529e1=a155_0x27e5,_0x1e41f8=_0x4f8b6a();while(!![]){try{const _0x195fe7=parseInt(_0x1529e1(0x1a8))/0x1+parseInt(_0x1529e1(0x12e))/0x2*(-parseInt(_0x1529e1(0x1bd))/0x3)+-parseInt(_0x1529e1(0x15d))/0x4*(parseInt(_0x1529e1(0x129))/0x5)+parseInt(_0x1529e1(0x150))/0x6+-parseInt(_0x1529e1(0x105))/0x7*(parseInt(_0x1529e1(0x193))/0x8)+-parseInt(_0x1529e1(0xde))/0x9+parseInt(_0x1529e1(0x146))/0xa*(parseInt(_0x1529e1(0x163))/0xb);if(_0x195fe7===_0x7f42f0)break;else _0x1e41f8['push'](_0x1e41f8['shift']());}catch(_0x47bb02){_0x1e41f8['push'](_0x1e41f8['shift']());}}}(a155_0x4014,0x35dfa));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a155_0x213229(0xf5));export const PENDING_SEGMENT_PREFIX=a155_0x213229(0x11a);export const PENDING_ACTIVATION_PREFIX=a155_0x213229(0x1a5);export function createPendingSegmentId(_0x165912){return''+PENDING_SEGMENT_PREFIX+_0x165912+'__';}export function isPendingSegmentId(_0x3cc8d4){const _0x168f0f=a155_0x213229;return _0x3cc8d4[_0x168f0f(0x116)](PENDING_SEGMENT_PREFIX)&&!_0x3cc8d4['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x2252ca){const _0xc2d13c=a155_0x213229;return _0x2252ca[_0xc2d13c(0x1c6)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x5edec9){return''+PENDING_ACTIVATION_PREFIX+_0x5edec9+'__';}export function isPendingActivationId(_0x377b4e){const _0x36a891=a155_0x213229;return _0x377b4e[_0x36a891(0x116)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x40cf0d){const _0xdca3d8=a155_0x213229;return _0x40cf0d[_0xdca3d8(0x1c6)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x29c264,_0x157086){const _0x35c1a4=a155_0x213229,_0xe79614=_0x29c264+'::'+(_0x157086[_0x35c1a4(0xfe)]()||_0x35c1a4(0x175)),_0x576798=createHash('sha1')[_0x35c1a4(0x152)](_0xe79614)['digest'](_0x35c1a4(0x1b2))[_0x35c1a4(0x19d)](0x0,0xc);return _0x35c1a4(0x1d2)+_0x576798;}export function ensureJourneyDefaults(_0x491719){const _0x4a3ed5=a155_0x213229;!_0x491719['description']&&(_0x491719[_0x4a3ed5(0x177)]=''),!_0x491719['state']&&(_0x491719[_0x4a3ed5(0x14e)]='draft');}export function injectExistingStageIds(_0x1ba813,_0x3dbc26){const _0x191883=a155_0x213229,_0x2713f7=new Map(_0x3dbc26[_0x191883(0x19f)](_0x576176=>[_0x576176[_0x191883(0x108)],_0x576176['id']]));for(const _0x56d4c5 of _0x1ba813){if(!_0x56d4c5['id']){const _0x512329=_0x2713f7['get'](_0x56d4c5[_0x191883(0x108)]);_0x512329&&(_0x56d4c5['id']=_0x512329);}}}function a155_0x4014(){const _0x5c32de=['toString','relative','attributes','Delete\x20the\x20push\x20recovery\x20file\x20(','updateSegmentById','\x27\x20entry\x20criteria','diff','join','deleteSegment','33009OmNABE','segmentFolderId','message','deps','split','keys','listActivations','goal','resolveSegment','replace','yamlActivation','DecisionPoint','logDeleted','folderId','waitStepType','folderPath','results','push','sort','journeyBundleName','ACTIVATION_UPDATE_ERROR','journey_entry_criteria_','logInfo','createdSegmentId','\x20journey\x20from\x20file:\x20','index','activation_template_id','find','type','folder_creating','debug','notification','null','resolvedRule','waitStep','conditions','3574953riLYRJ','deleteActivation','idToEmailMap','entry','conditionTimeoutDuration','\x27\x20exit\x20criteria','versionNumber','run_after_journey_refresh','toISOString','entryCriteria','localName','with','segmentByFolderAndName','user','\x27\x20by\x20rule\x20content','filter','isNew','journeyBundlesByFolderAndName','segment_deleting','parse','journey_updating','./child-segment-yaml.js','journey','tdx.sdk.push-workflow','Created\x20segment\x20\x27','goal\x20criteria','onProgress','rule','activationContext','and\x20the\x20server\x20segment,\x20then\x20retry.','\x27\x20for\x20','logSuccess','trim','resolveJourneyId','Created\x20folder\x20\x27','journeyById','Updated\x20activation\x20\x27','createActivation','\x20(referenced\x20in\x20journey\x20','2576BhAwUa','object','branches','name','NOT_FOUND','activation_updated','conditionTimeoutUnit','max','updateActivation','segment_updated','parentId','parseDocument','Embedded\x20segment\x20\x27','Fetching\x20','schedule','Segment\x20not\x20found','journey_updated','startsWith','hasChanges','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','__pending_','Updating\x20segment\x20\x27','add','SEGMENT_UPDATE_ERROR','validatedRequest','verbose','all','Name\x20has\x20already\x20been\x20taken','created','updated','dirname','some','relationships','progress','deleted','82785xNrKvt','activation_creating','journeyActivationStepId','entries','withProgress','62JGOwuq','from','SEGMENT_SYNTAX_ERROR','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','journeys','segmentId','journey_created','effectiveFolderId','kind','rootFolderId','Matched\x20server\x20segment\x20\x27','Deleted\x20activation\x20\x27','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','Journey\x20\x27','activationParams','stages','activations','connector_config','journeyId','embedded_segment_creating','buildUserMaps','Creating\x20folder\x20\x27','absolutePath','createFolder','370jIqNLS','values','yamlConfig','Failed\x20to\x20resolve\x20segment\x20','existingSegment','reduce','steps','create','state','\x27\x20decision\x20point\x20branch\x20\x27','2155254giIdXw','journeyActivationNameToId','update','day','.$1.push-recovery.json','Failed\x20to\x20fetch\x20referenced\x20segment\x20','getSegment\x20failed\x20for\x20','exitCriterias','):\x20','embedded_activation_creating','toLowerCase','behavior','\x20error(s)','52gknUoH','all_columns','stringify','includes','journeyStages','Creating\x20activation\x20\x27','132121XbVOwz','item','ACTIVATION_SYNTAX_ERROR','\x20activation\x20\x27','set','createJourneySegment','activation_updating','activationActions','delete','uniqueSegmentName','size','logWarning','stage\x20\x27','INTERNAL','Updated\x20segment\x20\x27','Activation','\x27...',').\x20','segment','length','description','journeyName','action','nameToType','segment_creating','activationStepsById','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','activation_deleted','uniqueServerName','activationsBySegmentId','\x27\x20wait\x20condition','utf-8','segments','has','embedded_activation_created','match','get','decision_point','segment_deleted','conditionSegmentId','skipSegments','folderPathToId','list','Segment\x20not\x20found:\x20','entry_criteria','Creating\x20segment\x20\x27','existingJourney','createSegment','984JrPsqn','milestone','parentFolder','connection','nameToId','SEGMENT_NOT_FOUND','unchanged','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','Created\x20journey\x20\x27','Failed\x20to\x20','slice','segment_created','map','\x0a\x20\x20','segmentNameToId','getJourney','existingSegments','Condition','__pending_act_','../../utils/async.js','connectionIdToNameMap','415865nhSvEC','isArray','flatMap','embeddedSegmentNameToId','Updating\x20activation\x20\x27','columns','waitStepUnit','WaitStep','data','valid','hex','getSegment'];a155_0x4014=function(){return _0x5c32de;};return a155_0x4014();}export function resolveTDFolderPath(_0x2f87be,_0x18a668,_0x4fb91d){if(!_0x18a668)return _0x2f87be;if(_0x2f87be===_0x4fb91d||_0x2f87be['startsWith'](_0x4fb91d+'/'))return _0x2f87be;return _0x2f87be?_0x4fb91d+'/'+_0x2f87be:_0x4fb91d;}export function addFoldersToCreate(_0x249da1,_0x27e8d7,_0x233bbd){const _0x11859c=a155_0x213229;if(!_0x249da1)return;if(_0x27e8d7[_0x11859c(0x184)](_0x249da1))return;const _0x1185d6=_0x249da1[_0x11859c(0x1c1)]('/');let _0x1a0f9e='';for(const _0x1726b6 of _0x1185d6){_0x1a0f9e=_0x1a0f9e?_0x1a0f9e+'/'+_0x1726b6:_0x1726b6,!_0x27e8d7[_0x11859c(0x184)](_0x1a0f9e)&&_0x233bbd[_0x11859c(0x11c)](_0x1a0f9e);}}export function sortFoldersByDepth(_0x16504e){return[..._0x16504e]['sort']((_0x367543,_0x302d35)=>{const _0x35087b=a155_0x27e5,_0x14effd=(_0x367543[_0x35087b(0x186)](/\//g)||[])['length'],_0x83c756=(_0x302d35[_0x35087b(0x186)](/\//g)||[])[_0x35087b(0x176)];return _0x14effd-_0x83c756;});}import*as a155_0x28f1ca from'yaml';import{readFileSync}from'fs';import a155_0x55d76c from'path';import{isJourneyDef,parseYamlString as a155_0x1d7fcb,toYamlString as a155_0x452fd9,normalizeJourneyDef,hasMultipleVersions,journeyResponseToDef,collectSegmentIdsFromJourneyApi}from'./journey-yaml.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,createJumpTargetCache,resolveJumpTarget,buildMergedJourneyDef,buildLocalRuleToNameMappingFromJourney,collectSegmentUsageCounts}from'./journey-utils.js';import{activationResponseToDef,segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,apiRuleToYaml,yamlRuleToApi,serializeExpandedRule,collectSegmentRefsFromRule,resolveRuleSegmentRefs,resolveRuleSegmentIds,journeyActivationStepToYaml}from'./child-segment-yaml.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{batchAsync}from'../../utils/async.js';import{buildFolderMaps}from'./resolution-context.js';import{SDKError,ErrorCode,isHttp400Error,getErrorMessage}from'../errors.js';import{readPushRecovery,saveSegmentToPushRecovery,deletePushRecovery}from'./push-recovery.js';import{validateSegmentDef,formatValidationResult}from'./yaml-validator.js';import{validateJourneyDef}from'./journey-validator.js';function stableStringify(_0x3d285b){const _0x21e967=a155_0x213229;if(Array[_0x21e967(0x1a9)](_0x3d285b))return'['+_0x3d285b[_0x21e967(0x19f)](_0x3bfbab=>stableStringify(_0x3bfbab))['join'](',')+']';if(_0x3d285b&&typeof _0x3d285b===_0x21e967(0x106)){const _0x2f8e45=_0x3d285b,_0xbe7285=Object['keys'](_0x2f8e45)[_0x21e967(0x1cf)](),_0x1fe6d2=_0xbe7285[_0x21e967(0x19f)](_0xc3b079=>'\x22'+_0xc3b079+'\x22:'+stableStringify(_0x2f8e45[_0xc3b079]));return'{'+_0x1fe6d2[_0x21e967(0x1bb)](',')+'}';}const _0x27f84e=JSON[_0x21e967(0x15f)](_0x3d285b);return _0x27f84e===undefined?_0x21e967(0xda):_0x27f84e;}function activationSignature(_0x1fc5cd){const _0x5c3dc3=a155_0x213229,_0x322b23={'connection':_0x1fc5cd[_0x5c3dc3(0x196)],..._0x1fc5cd[_0x5c3dc3(0x15e)]!==undefined&&{'all_columns':_0x1fc5cd['all_columns']},..._0x1fc5cd[_0x5c3dc3(0x1ad)]!==undefined&&{'columns':_0x1fc5cd['columns']},..._0x1fc5cd[_0x5c3dc3(0x15b)]!==undefined&&{'behavior':_0x1fc5cd[_0x5c3dc3(0x15b)]},..._0x1fc5cd[_0x5c3dc3(0x113)]!==undefined&&{'schedule':_0x1fc5cd[_0x5c3dc3(0x113)]},..._0x1fc5cd[_0x5c3dc3(0xd9)]!==undefined&&{'notification':_0x1fc5cd[_0x5c3dc3(0xd9)]},..._0x1fc5cd[_0x5c3dc3(0x13f)]!==undefined&&{'connector_config':_0x1fc5cd['connector_config']},..._0x1fc5cd['activation_template_id']!==undefined&&{'activation_template_id':_0x1fc5cd[_0x5c3dc3(0x1d7)]}};return stableStringify(_0x322b23);}async function fetchSegment(_0x1d13a7,_0x4555db,_0x4a58ab,_0x5769d0){const _0x4c5158=a155_0x213229,_0x13f8a5=_0x5769d0?.[_0x4c5158(0xd5)](_0x1ce19f=>_0x1ce19f['id']===_0x4a58ab);if(_0x13f8a5)return _0x13f8a5;try{return await _0x1d13a7[_0x4c5158(0x175)][_0x4c5158(0x1b3)](_0x4555db,_0x4a58ab);}catch(_0x4955c3){logger[_0x4c5158(0xd8)](_0x4c5158(0x156)+_0x4a58ab+',\x20falling\x20back\x20to\x20getSegmentEntity:\x20'+_0x4955c3);try{return await _0x1d13a7[_0x4c5158(0x175)]['getSegmentEntity'](_0x4a58ab);}catch(_0x1310e1){return logger['debug']('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x4a58ab+':\x20'+_0x1310e1),null;}}}function a155_0x27e5(_0x5e088f,_0x535437){_0x5e088f=_0x5e088f-0xd5;const _0x40148c=a155_0x4014();let _0x27e5a7=_0x40148c[_0x5e088f];return _0x27e5a7;}function recoverSegmentIdsFromPushRecovery(_0x3e53b6,_0xf20dea,_0x55b572){const _0x42f040=a155_0x213229,_0x2e37f7=readPushRecovery(_0x3e53b6[_0x42f040(0x144)]);if(_0x2e37f7?.[_0x42f040(0x178)]===_0x3e53b6[_0x42f040(0x148)][_0x42f040(0x108)])for(const [_0x413beb,_0xdeff18]of Object[_0x42f040(0x12c)](_0x2e37f7[_0x42f040(0x183)])){const _0x2666a6=generateDeterministicJourneySegmentName(_0x3e53b6[_0x42f040(0x148)][_0x42f040(0x108)],_0x413beb);_0xdeff18[_0x42f040(0x17f)]===_0x2666a6&&(_0xf20dea[_0x42f040(0x167)](_0x413beb,_0xdeff18[_0x42f040(0x133)]),_0x55b572[_0x42f040(0x167)](_0x413beb,_0xdeff18['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x159eef,_0x5c0510,_0x11493b,_0x5b013e){const _0x595384=a155_0x213229;let _0xa3d9c;try{_0xa3d9c=await _0x159eef[_0x595384(0x175)][_0x595384(0x168)]({'name':_0x11493b['uniqueSegmentName'],'description':_0x11493b[_0x595384(0x177)],'journeyId':_0x11493b['journeyId'],'rule':_0x5b013e(_0x11493b[_0x595384(0xdb)],!![]),'countPopulation':!![],'parentFolderId':_0x11493b[_0x595384(0x1ca)],'audienceId':_0x11493b[_0x595384(0x10f)]});}catch(_0x15ca46){const _0x295c76=_0x15ca46 instanceof Error&&_0x15ca46[_0x595384(0x1bf)][_0x595384(0x160)](_0x595384(0x121));if(_0x295c76){const _0x32ac66=readPushRecovery(_0x5c0510[_0x595384(0x144)]),_0x5e5fc1=_0x32ac66?.[_0x595384(0x178)]===_0x5c0510['yamlConfig']['name']?_0x32ac66['segments'][_0x11493b['localName']]:undefined;if(_0x5e5fc1?.[_0x595384(0x17f)]===_0x11493b['uniqueSegmentName'])await _0x159eef['segment'][_0x595384(0x1b8)](_0x11493b['parentId'],_0x5e5fc1[_0x595384(0x133)],{'description':_0x11493b[_0x595384(0x177)],'rule':_0x5b013e(_0x11493b[_0x595384(0xdb)],!![]),'countPopulation':!![]}),_0xa3d9c=_0x5e5fc1[_0x595384(0x133)];else throw new SDKError(ErrorCode[_0x595384(0x11d)],_0x595384(0x111)+_0x11493b[_0x595384(0xe8)]+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+(_0x595384(0x1b7)+_0x5c0510[_0x595384(0x144)]['replace'](/([^/]+)$/,_0x595384(0x154))+')\x20')+_0x595384(0xfb),_0x15ca46);}else throw _0x15ca46;}return saveSegmentToPushRecovery(_0x5c0510[_0x595384(0x144)],_0x5c0510[_0x595384(0x148)][_0x595384(0x108)],_0x11493b[_0x595384(0xe8)],{'segmentId':_0xa3d9c,'uniqueServerName':_0x11493b[_0x595384(0x16c)],'createdAt':new Date()[_0x595384(0xe6)]()}),_0xa3d9c;}export async function prepareSegmentFiles(_0x28668c,_0x29b587,_0x208ca5,_0x2f87f1,_0xa42fa1){const _0x54980f=a155_0x213229,{activationDefToCreateRequest:_0x5241a1}=await import(_0x54980f(0xf3)),_0x82d80e=[],_0x3ce882=new Set();for(const {yamlConfig:_0x18e099,folderPath:_0x36ab8c,sourcePath:_0x2e8962}of _0x28668c){const _0x29d03d=resolveTDFolderPath(_0x36ab8c,_0x2f87f1,_0xa42fa1),_0x93ffd1=_0x29d03d+':'+_0x18e099[_0x54980f(0x108)],_0x18e381=_0x29b587[_0x54980f(0xea)]['get'](_0x93ffd1),_0x2dd6f1=_0x18e381?_0x29b587[_0x54980f(0x180)][_0x54980f(0x187)](_0x18e381['id'])||[]:[];addFoldersToCreate(_0x29d03d,_0x29b587[_0x54980f(0x18c)],_0x3ce882);const _0x4e830b=calculateActivationActions(_0x18e099[_0x54980f(0x13e)]||[],_0x2dd6f1,_0x29b587[_0x54980f(0xe0)],_0x29b587[_0x54980f(0x1a7)]);for(const _0x2cfb8e of _0x4e830b){(_0x2cfb8e['type']===_0x54980f(0x14d)||_0x2cfb8e[_0x54980f(0xd6)]===_0x54980f(0x152))&&_0x2cfb8e[_0x54980f(0x1c7)]&&(_0x2cfb8e[_0x54980f(0x11e)]=await _0x5241a1(_0x2cfb8e[_0x54980f(0x1c7)],_0x208ca5));}const _0x25d4ff=calculateSegmentDiff(_0x18e099,_0x18e381,_0x2dd6f1,_0x29b587[_0x54980f(0xe0)],_0x29b587['connectionIdToNameMap']);_0x82d80e[_0x54980f(0x1ce)]({'relativePath':_0x18e099['name'],'absolutePath':_0x2e8962,'yamlConfig':_0x18e099,'folderPath':_0x29d03d,'existingSegment':_0x18e381,'existingActivations':_0x2dd6f1,'isNew':_0x25d4ff[_0x54980f(0xee)],'hasChanges':_0x25d4ff[_0x54980f(0x117)],'diff':_0x25d4ff[_0x54980f(0x1ba)],'activationActions':_0x4e830b});}return{'segmentFiles':_0x82d80e,'foldersToCreate':_0x3ce882};}export async function prepareJourneyFiles(_0x362710,_0x1a7d0a,_0x5003ed,_0x6604c8){const _0x44c135=a155_0x213229,_0x5b249a=[],_0x13506e=new Set();for(const {yamlConfig:_0x36cf3a,folderPath:_0x2028de,sourcePath:_0x596b84}of _0x362710){const _0x3663af=resolveTDFolderPath(_0x2028de,_0x5003ed,_0x6604c8),_0x1d398c=_0x3663af+':'+_0x36cf3a[_0x44c135(0x108)],_0x21e234=_0x1a7d0a[_0x44c135(0xef)]['get'](_0x1d398c);let _0x1b09b9,_0x266155;if(_0x21e234&&_0x21e234[_0x44c135(0x176)]>0x0){const _0x1699e8=buildLocalExpandedRuleMappings(_0x36cf3a),{createYamlContext:_0x30224f,prefetchJourneySegments:_0x545e6f}=createPushYamlContextForBundle(_0x1a7d0a[_0x44c135(0x1c0)],_0x1a7d0a[_0x44c135(0x10f)],_0x1a7d0a['existingSegments'],_0x1699e8,_0x1a7d0a[_0x44c135(0xe0)],_0x1a7d0a[_0x44c135(0x1a7)],_0x1a7d0a[_0x44c135(0x17c)],_0x1a7d0a[_0x44c135(0x101)]);await _0x545e6f(_0x21e234[_0x44c135(0x19f)](_0x1f07e0=>_0x1f07e0['id']));const _0x5c6976=await _0x1a7d0a[_0x44c135(0x1c0)][_0x44c135(0xf4)]['getLatestJourneyId'](_0x21e234[0x0]['journeyBundleId']),_0x246a84=hasMultipleVersions(_0x36cf3a),_0x5cd6f0=async _0xff3372=>{const _0x348e21=_0x44c135,_0x2c6408=_0x1a7d0a[_0x348e21(0x101)]?.[_0x348e21(0x187)](_0xff3372);if(_0x2c6408)return _0x2c6408;return _0x1a7d0a['fetchJourney']({'journeyId':_0xff3372,'journeyName':_0x36cf3a['name'],'isMultiVersion':_0x21e234[_0x348e21(0x176)]>0x1});};if(_0x246a84&&_0x21e234[_0x44c135(0x176)]>0x1){const _0x31e778=[];for(const _0x34dda1 of _0x21e234){const _0x3ef850=_0x34dda1[_0x44c135(0xe4)]||0x1;_0x1a7d0a[_0x44c135(0x127)]?.['update'](_0x44c135(0x112)+_0x36cf3a['name']+'\x20v'+_0x3ef850);const _0x37ff1c=await _0x5cd6f0(_0x34dda1['id']),_0x360cb1=_0x30224f(_0x34dda1['id']),_0x28062b=await journeyResponseToDef(_0x37ff1c,_0x360cb1);_0x31e778[_0x44c135(0x1ce)]({'item':_0x34dda1,'yaml':_0x28062b});}const _0x2f8095=buildLocalRuleToNameMappingFromJourney(_0x36cf3a);_0x266155=buildMergedJourneyDef(_0x31e778,_0x2f8095,_0x5c6976);const _0x3fd281=Math[_0x44c135(0x10c)](..._0x31e778[_0x44c135(0x19f)](_0xc49d58=>_0xc49d58[_0x44c135(0x164)]['versionNumber']||0x0)),_0x4a7da8=_0x21e234['find'](_0x1231f4=>(_0x1231f4[_0x44c135(0xe4)]||0x0)===_0x3fd281);_0x4a7da8&&(_0x1a7d0a[_0x44c135(0x127)]?.[_0x44c135(0x152)](_0x44c135(0x112)+_0x36cf3a[_0x44c135(0x108)]+'\x20v'+_0x3fd281),_0x1b09b9=await _0x5cd6f0(_0x4a7da8['id']));}else{const _0x1c67a5=_0x21e234[_0x21e234[_0x44c135(0x176)]-0x1];_0x1a7d0a[_0x44c135(0x127)]?.[_0x44c135(0x152)](_0x44c135(0x112)+_0x36cf3a['name']),_0x1b09b9=await _0x5cd6f0(_0x1c67a5['id']);const _0x4b5052=_0x30224f(_0x1c67a5['id']),_0x220312=await journeyResponseToDef(_0x1b09b9,_0x4b5052),_0x4c24a5=buildLocalRuleToNameMappingFromJourney(_0x36cf3a);_0x266155=buildMergedJourneyDef([{'item':_0x1c67a5,'yaml':_0x220312}],_0x4c24a5,_0x5c6976);}}addFoldersToCreate(_0x3663af,_0x1a7d0a[_0x44c135(0x18c)],_0x13506e);const _0x4a8310=calculateJourneyDiff(_0x36cf3a,_0x266155);_0x5b249a['push']({'relativePath':_0x36cf3a[_0x44c135(0x108)],'absolutePath':_0x596b84,'yamlConfig':_0x36cf3a,'folderPath':_0x3663af,'existingJourney':_0x1b09b9,'isNew':_0x4a8310[_0x44c135(0xee)],'hasChanges':_0x4a8310['hasChanges'],'diff':_0x4a8310['diff']});}return{'journeyFiles':_0x5b249a,'foldersToCreate':_0x13506e};}export function calculateActivationActions(_0x30a3a1,_0x5ad173,_0x593c51,_0xef9eb5){const _0x18926d=a155_0x213229,_0x49c11c=[],_0x55f97b=new Map();for(const _0x230711 of _0x5ad173){_0x55f97b[_0x18926d(0x167)](_0x230711[_0x18926d(0x108)],_0x230711);}const _0x34dbb9=new Map();for(const _0x271673 of _0x30a3a1){_0x34dbb9['set'](_0x271673[_0x18926d(0x108)],_0x271673);}for(const _0xe5cf06 of _0x30a3a1){const _0x1b518f=_0x55f97b['get'](_0xe5cf06['name']);if(!_0x1b518f)_0x49c11c[_0x18926d(0x1ce)]({'type':_0x18926d(0x14d),'name':_0xe5cf06[_0x18926d(0x108)],'yamlActivation':_0xe5cf06});else{const _0x2146d0=activationResponseToDef(_0x1b518f,_0x593c51,_0xef9eb5),_0xaaeb70=a155_0x28f1ca[_0x18926d(0x15f)](_0x2146d0),_0x598a2e=a155_0x28f1ca[_0x18926d(0x15f)](_0xe5cf06);_0xaaeb70!==_0x598a2e&&_0x49c11c[_0x18926d(0x1ce)]({'type':_0x18926d(0x152),'name':_0xe5cf06[_0x18926d(0x108)],'yamlActivation':_0xe5cf06,'existingActivation':_0x1b518f});}}for(const _0x1cfa29 of _0x5ad173){!_0x34dbb9[_0x18926d(0x184)](_0x1cfa29[_0x18926d(0x108)])&&_0x49c11c[_0x18926d(0x1ce)]({'type':_0x18926d(0x16b),'name':_0x1cfa29[_0x18926d(0x108)],'existingActivation':_0x1cfa29});}return _0x49c11c;}function calculateYamlDiff(_0x4fb30e,_0x4d477c){if(_0x4d477c){const _0x1e10a4=generateDiff(_0x4d477c,_0x4fb30e),_0x53e15c=hasChanges(_0x1e10a4);return{'isNew':![],'hasChanges':_0x53e15c,'diff':_0x53e15c?formatDiffWithColors(_0x1e10a4):undefined};}const _0x198906=generateDiff('',_0x4fb30e);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x198906)};}export function calculateSegmentDiff(_0x3f2de7,_0x48b361,_0x3876ae,_0x5427cc,_0x1e4617){const _0x931e5d=segmentToYamlString(_0x3f2de7),_0x2541b2=_0x48b361?segmentToYamlString(segmentWithActivationsToYaml(_0x48b361,_0x3876ae,undefined,_0x5427cc,_0x1e4617)):undefined;return calculateYamlDiff(_0x931e5d,_0x2541b2);}export function calculateJourneyDiff(_0x236450,_0x5bc459){const _0x4ba88d=normalizeJourneyDef(_0x236450,_0x236450),_0x37f9f6=a155_0x452fd9(_0x4ba88d),_0x1302d4=_0x5bc459?a155_0x452fd9(normalizeJourneyDef(_0x5bc459,_0x236450)):undefined;return calculateYamlDiff(_0x37f9f6,_0x1302d4);}export function findSegmentsToDelete(_0x40111f,_0x5cbb88,_0x157d76,_0x1692db,_0x51cd6d){const _0x47e6c8=new Set();for(const {yamlConfig:_0xff0bcd,folderPath:_0x47566c}of _0x5cbb88){_0x47e6c8['add'](_0x47566c+':'+_0xff0bcd['name']);}return _0x40111f['filter'](_0x12fc60=>{const _0x735e02=a155_0x27e5,_0x1f8d9e=_0x12fc60['segmentFolderId']?_0x157d76['get'](_0x12fc60[_0x735e02(0x1be)][_0x735e02(0x1b4)]())||'':'',_0x40f217=_0x1f8d9e+':'+_0x12fc60[_0x735e02(0x108)];if(_0x47e6c8[_0x735e02(0x184)](_0x40f217))return![];if(_0x51cd6d)return _0x1f8d9e===_0x1692db||_0x1f8d9e[_0x735e02(0x116)](_0x1692db+'/');return!![];});}export function findJourneysToDelete(_0xac30f8,_0x4d7988,_0x62452f,_0x200ed1,_0x54d31f){const _0x6f7db1=a155_0x213229,_0x4dfd6e=new Set();for(const {yamlConfig:_0x131aa0,folderPath:_0xaa6af0}of _0x4d7988){_0x4dfd6e[_0x6f7db1(0x11c)](_0xaa6af0+':'+_0x131aa0['name']);}return _0xac30f8[_0x6f7db1(0xed)](_0x3b60cb=>{const _0x1fc9bf=_0x6f7db1,_0x241f13=_0x3b60cb[_0x1fc9bf(0x1ca)]?_0x62452f[_0x1fc9bf(0x187)](_0x3b60cb[_0x1fc9bf(0x1ca)])||'':'',_0xdb3c58=_0x241f13+':'+_0x3b60cb[_0x1fc9bf(0x1d0)];if(_0x4dfd6e[_0x1fc9bf(0x184)](_0xdb3c58))return![];if(_0x54d31f)return _0x241f13===_0x200ed1||_0x241f13[_0x1fc9bf(0x116)](_0x200ed1+'/');return!![];});}export function buildSegmentLookupMap(_0x5ea753,_0x4f0a44){const _0x477fce=a155_0x213229,_0x4bfade=new Map();for(const _0x35567e of _0x5ea753){const _0x1e30bb=_0x35567e[_0x477fce(0x1be)]?_0x4f0a44[_0x477fce(0x187)](_0x35567e['segmentFolderId'][_0x477fce(0x1b4)]())||'':'',_0x30cde4=_0x1e30bb+':'+_0x35567e[_0x477fce(0x108)];_0x4bfade[_0x477fce(0x167)](_0x30cde4,_0x35567e);}return _0x4bfade;}export function buildSegmentNameToIdMap(_0x488817){const _0x59f045=a155_0x213229,_0x5d33aa=new Map();for(const _0x3a055a of _0x488817){_0x5d33aa['set'](_0x3a055a[_0x59f045(0x108)],_0x3a055a['id']);}return _0x5d33aa;}export function buildJourneyBundleLookupMap(_0x49a957,_0x36863c){const _0x5b7fc7=a155_0x213229,_0x459db8=new Map();for(const _0x408688 of _0x49a957){const _0xeb7d21=_0x408688['folderId']?_0x36863c['get'](_0x408688['folderId'])||'':'',_0x4ac3f8=_0xeb7d21+':'+_0x408688[_0x5b7fc7(0x1d0)];!_0x459db8['has'](_0x4ac3f8)&&_0x459db8[_0x5b7fc7(0x167)](_0x4ac3f8,[]),_0x459db8['get'](_0x4ac3f8)['push'](_0x408688);}for(const _0x561614 of _0x459db8[_0x5b7fc7(0x147)]()){_0x561614[_0x5b7fc7(0x1cf)]((_0x57a1bd,_0x5cf544)=>(_0x57a1bd['versionNumber']||0x0)-(_0x5cf544['versionNumber']||0x0));}return _0x459db8;}export function collectFoldersToCreate(_0x3658fe,_0x2b0919){const _0x23b145=a155_0x213229,_0x2fbfb6=new Set();for(const _0x3b4e03 of _0x3658fe){if(!_0x3b4e03)continue;if(_0x2b0919['has'](_0x3b4e03))continue;const _0x55bf94=_0x3b4e03[_0x23b145(0x1c1)]('/');let _0x50bf2c='';for(const _0x572215 of _0x55bf94){_0x50bf2c=_0x50bf2c?_0x50bf2c+'/'+_0x572215:_0x572215,!_0x2b0919[_0x23b145(0x184)](_0x50bf2c)&&_0x2fbfb6['add'](_0x50bf2c);}}return _0x2fbfb6;}export function parseAndClassifyYamlFiles(_0x44d12b,_0x337a3e,_0x1a9cfc){const _0x5ef72a=a155_0x213229,_0x59061b=[],_0x4c2a16=[];for(const _0x59b126 of _0x44d12b){const _0x25ba76=a155_0x55d76c[_0x5ef72a(0x1b5)](_0x337a3e,a155_0x55d76c[_0x5ef72a(0x124)](_0x59b126)),_0x6fde59=_0x25ba76==='.'?'':_0x25ba76[_0x5ef72a(0x1c6)](/\\/g,'/'),_0x5f59e7=readFileSync(_0x59b126,'utf-8'),_0x4369b8=a155_0x28f1ca[_0x5ef72a(0xf1)](_0x5f59e7);if(isJourneyDef(_0x4369b8)){const _0x48047d=a155_0x1d7fcb(_0x5f59e7);_0x4c2a16[_0x5ef72a(0x1ce)]({'yamlConfig':_0x48047d,'folderPath':_0x6fde59,'sourcePath':_0x59b126});}else{if(!_0x1a9cfc?.[_0x5ef72a(0x18b)]){const _0x5d1f34=parseSegmentYamlFile(_0x5f59e7),_0x1f97b2=normalizeChildSegmentYaml(_0x5d1f34);_0x59061b['push']({'yamlConfig':_0x1f97b2,'folderPath':_0x6fde59,'sourcePath':_0x59b126});}}}return{'segments':_0x59061b,'journeys':_0x4c2a16};}export function validateParsedFiles(_0x2ba56f,_0x4e0a6d){const _0x3a66e7=a155_0x213229,_0x1f5859=[];for(const {yamlConfig:_0x32a91a,sourcePath:_0x449f0d}of _0x2ba56f['segments']){const _0x57d301=readFileSync(_0x449f0d,'utf-8'),_0x3ecddd=a155_0x28f1ca[_0x3a66e7(0x110)](_0x57d301),_0x387630=validateSegmentDef(_0x32a91a,{'source':_0x57d301,'document':_0x3ecddd},{'skipSchema':!![]});if(!_0x387630[_0x3a66e7(0x1b1)]){const _0xc1e092=a155_0x55d76c[_0x3a66e7(0x1b5)](_0x4e0a6d,_0x449f0d);_0x1f5859[_0x3a66e7(0x1ce)]({'filePath':_0xc1e092,'source':_0x57d301,'result':_0x387630,'isJourney':![]});}}for(const {yamlConfig:_0x2dc4e5,sourcePath:_0x437b27}of _0x2ba56f[_0x3a66e7(0x132)]){const _0x2d8d5f=readFileSync(_0x437b27,_0x3a66e7(0x182)),_0x3dc6dc=a155_0x28f1ca[_0x3a66e7(0x110)](_0x2d8d5f),_0x492f14=validateJourneyDef(_0x2dc4e5,{'source':_0x2d8d5f,'document':_0x3dc6dc},{'skipSchema':!![]});if(!_0x492f14[_0x3a66e7(0x1b1)]){const _0x560027=a155_0x55d76c[_0x3a66e7(0x1b5)](_0x4e0a6d,_0x437b27);_0x1f5859[_0x3a66e7(0x1ce)]({'filePath':_0x560027,'source':_0x2d8d5f,'result':_0x492f14,'isJourney':!![]});}}return _0x1f5859;}export function formatValidationErrors(_0x44ea85){const _0x1a60f9=a155_0x213229,_0x4b0382=[];for(const {filePath:_0x5df401,source:_0x14c6b1,result:_0x8c0dc0,isJourney:_0x8692b0}of _0x44ea85){const _0x3fb47b=_0x8692b0?_0x1a60f9(0xf4):_0x1a60f9(0x175);_0x4b0382[_0x1a60f9(0x1ce)]('\x0a'+_0x5df401+'\x20('+_0x3fb47b+_0x1a60f9(0x158)+_0x8c0dc0['errors']['length']+_0x1a60f9(0x15c)),_0x4b0382['push'](formatValidationResult(_0x8c0dc0,_0x14c6b1,_0x5df401));}return _0x4b0382[_0x1a60f9(0x1bb)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x392b5c){const _0x324d5a=a155_0x213229,_0xaf5bab=new Set(),_0x39558d=new Map(),_0x2f06b2=collectSegmentUsageCounts(_0x392b5c);if(_0x392b5c[_0x324d5a(0x183)])for(const [_0x4617e9,_0x3c7744]of Object[_0x324d5a(0x12c)](_0x392b5c[_0x324d5a(0x183)])){_0xaf5bab[_0x324d5a(0x11c)](_0x4617e9);if(_0x3c7744[_0x324d5a(0xf9)]){const _0xe1ae64=yamlRuleToApi(_0x3c7744[_0x324d5a(0xf9)]),_0x444b02=apiRuleToYaml(_0xe1ae64);_0x39558d[_0x324d5a(0x167)](_0x4617e9,_0x444b02);}}const _0x248bcf=new Map();let _0x22f7e5=0x0;for(const [_0xbee8f6,_0x18a05b]of _0x39558d){const _0x50faaa=serializeExpandedRule(_0x18a05b,_0x39558d),_0x36556e=_0x248bcf[_0x324d5a(0x187)](_0x50faaa)||[];_0x36556e[_0x324d5a(0x1ce)]({'name':_0xbee8f6,'index':_0x22f7e5}),_0x248bcf[_0x324d5a(0x167)](_0x50faaa,_0x36556e),_0x22f7e5++;}const _0xf9ac7b=new Map();for(const [_0x5a84d9,_0x4ca5ac]of _0x248bcf){const _0x44aded=_0x4ca5ac[_0x324d5a(0x19d)]()[_0x324d5a(0x1cf)]((_0x4dec95,_0x572fc8)=>{const _0x5af217=_0x324d5a,_0x2309fb=_0x2f06b2[_0x5af217(0x187)](_0x4dec95['name'])||0x0,_0x16d161=_0x2f06b2['get'](_0x572fc8[_0x5af217(0x108)])||0x0;if(_0x2309fb!==_0x16d161)return _0x16d161-_0x2309fb;return _0x4dec95[_0x5af217(0x1d6)]-_0x572fc8[_0x5af217(0x1d6)];})[_0x324d5a(0x19f)](_0xbc2081=>_0xbc2081[_0x324d5a(0x108)]),_0x520492=[];for(const _0x19ac72 of _0x44aded){const _0x203719=_0x2f06b2['get'](_0x19ac72)||0x0,_0x434319=Math[_0x324d5a(0x10c)](_0x203719,0x1);for(let _0x469c57=0x0;_0x469c57<_0x434319;_0x469c57++){_0x520492[_0x324d5a(0x1ce)](_0x19ac72);}}_0xf9ac7b['set'](_0x5a84d9,_0x520492);}return{'existingLocalSegmentNames':_0xaf5bab,'localSegmentRules':_0x39558d,'localExpandedRuleToNames':_0xf9ac7b};}export function createSegmentIdResolver(_0x1ec6ed,_0x1c312e){return async _0x4211b7=>{const _0x1c5308=a155_0x27e5,_0x1d878f=_0x1ec6ed[_0x1c5308(0x187)](_0x4211b7);if(!_0x1d878f)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1c5308(0x18e)+_0x4211b7+_0x1c5308(0x17d)+_0x1c312e+'\x27)');return _0x1d878f;};}export function extractRootFolderId(_0x2465f5){const _0x1ca617=a155_0x213229;return _0x2465f5[_0x1ca617(0x126)]?.['parentSegmentFolder']?.[_0x1ca617(0x1b0)]?.['id']||_0x2465f5[_0x1ca617(0x126)]?.[_0x1ca617(0x195)]?.['data']?.['id'];}export function buildConnectionMaps(_0x5666e5){const _0x194498=a155_0x213229,_0xa30a93=new Map(),_0x3e6c44=new Map(),_0x560e27=new Map();for(const _0x391524 of _0x5666e5){_0xa30a93['set'](_0x391524['name'],parseInt(_0x391524['id'],0xa)),_0x3e6c44[_0x194498(0x167)](_0x391524['id'],_0x391524['name']),_0x560e27[_0x194498(0x167)](_0x391524['name'],_0x391524[_0x194498(0xd6)]);}return{'nameToId':_0xa30a93,'idToName':_0x3e6c44,'nameToType':_0x560e27};}export function calculatePushStats(_0x551203,_0x4a54b5,_0x18f840,_0x3c7fa1,_0x26f296,_0x4847e6,_0x58e472){const _0x12be35=a155_0x213229,_0x4869a0=_0x551203[_0x12be35(0xed)](_0x36a854=>_0x36a854[_0x12be35(0xee)]),_0x346373=_0x551203[_0x12be35(0xed)](_0x36c3f2=>!_0x36c3f2['isNew']&&_0x36c3f2[_0x12be35(0x117)]),_0x32af35=_0x551203[_0x12be35(0xed)](_0x295c51=>!_0x295c51['isNew']&&!_0x295c51['hasChanges']),_0x3d980a=_0x4847e6?_0x3c7fa1:[],_0x7a5a4f=_0x4a54b5[_0x12be35(0xed)](_0x552a8e=>_0x552a8e[_0x12be35(0xee)]),_0x5b8595=_0x4a54b5[_0x12be35(0xed)](_0x591559=>!_0x591559[_0x12be35(0xee)]&&_0x591559['hasChanges']),_0x244864=_0x4a54b5[_0x12be35(0xed)](_0x1a3ef0=>!_0x1a3ef0[_0x12be35(0xee)]&&!_0x1a3ef0[_0x12be35(0x117)]),_0x123269=_0x4847e6?_0x26f296:[],_0xd2c5ca=_0x551203[_0x12be35(0x1aa)](_0x1ddffa=>_0x1ddffa[_0x12be35(0x16a)]),_0x595834=_0xd2c5ca[_0x12be35(0xed)](_0x2ea189=>_0x2ea189[_0x12be35(0xd6)]===_0x12be35(0x14d)),_0x4ef877=_0xd2c5ca['filter'](_0x534996=>_0x534996[_0x12be35(0xd6)]===_0x12be35(0x152)),_0x3848cf=_0xd2c5ca['filter'](_0x5c4845=>_0x5c4845[_0x12be35(0xd6)]===_0x12be35(0x16b)),_0x27d2aa=Array[_0x12be35(0x12f)](_0x18f840)['sort'](),_0x138dc6=_0x58e472?![]:_0x4869a0[_0x12be35(0x176)]>0x0||_0x346373[_0x12be35(0x176)]>0x0||_0x3d980a[_0x12be35(0x176)]>0x0,_0x2b3cb8=_0x7a5a4f['length']>0x0||_0x5b8595['length']>0x0||_0x123269[_0x12be35(0x176)]>0x0,_0x5a83ad=_0x58e472?![]:_0xd2c5ca[_0x12be35(0x176)]>0x0,_0x34d59a=_0x27d2aa[_0x12be35(0x176)]>0x0;return{'segments':{'new':_0x4869a0,'changed':_0x346373,'unchanged':_0x32af35,'toDelete':_0x3d980a},'journeys':{'new':_0x7a5a4f,'changed':_0x5b8595,'unchanged':_0x244864,'toDelete':_0x123269},'activations':{'all':_0xd2c5ca,'toCreate':_0x595834,'toUpdate':_0x4ef877,'toDelete':_0x3848cf},'folders':{'toCreate':_0x27d2aa},'counts':{'segments':{'new':_0x4869a0[_0x12be35(0x176)],'changed':_0x346373['length'],'unchanged':_0x32af35[_0x12be35(0x176)],'toDelete':_0x3d980a['length']},'journeys':{'new':_0x7a5a4f[_0x12be35(0x176)],'changed':_0x5b8595['length'],'unchanged':_0x244864[_0x12be35(0x176)],'toDelete':_0x123269[_0x12be35(0x176)]},'activations':{'create':_0x595834[_0x12be35(0x176)],'update':_0x4ef877[_0x12be35(0x176)],'delete':_0x3848cf[_0x12be35(0x176)]},'folders':_0x27d2aa[_0x12be35(0x176)]},'hasChanges':_0x138dc6||_0x2b3cb8||_0x5a83ad||_0x34d59a};}export async function buildPushExecutionContext(_0x6b917,_0x4dbdc9,_0xf28d38,_0x1fb066,_0x4ceda3,_0x4fc666){const _0x13e2c2=a155_0x213229,_0x571819=extractRootFolderId(_0xf28d38),{pathToId:_0x178b77,idToPath:_0x4ea740}=buildFolderMaps(_0x4ceda3),_0x1b9c0e=buildSegmentNameToIdMap(_0x1fb066),_0x12ff8b=new Map(),{batchAsync:_0x804e49}=await import(_0x13e2c2(0x1a6)),[_0x493fd8,_0x1558cb]=await Promise[_0x13e2c2(0x120)]([_0x6b917[_0x13e2c2(0xeb)][_0x13e2c2(0x142)](),_0x6b917[_0x13e2c2(0x196)][_0x13e2c2(0x18d)](),((async()=>{!_0x4fc666&&_0x1fb066['length']>0x0&&await _0x804e49(_0x1fb066,async _0x5f3111=>{const _0x16039c=a155_0x27e5,_0x59115e=await _0x6b917[_0x16039c(0x175)][_0x16039c(0x1c3)](_0x4dbdc9,_0x5f3111['id']);_0x12ff8b['set'](_0x5f3111['id'],_0x59115e);});})())]),{emailToId:_0x5d2f2d,idToEmail:_0x30dc23}=_0x493fd8,_0x1ea8c7=buildConnectionMaps(_0x1558cb);return{'rootFolderId':_0x571819,'folderPathToId':_0x178b77,'folderIdToPath':_0x4ea740,'segmentNameToId':_0x1b9c0e,'activationsBySegmentId':_0x12ff8b,'emailToIdMap':_0x5d2f2d,'idToEmailMap':_0x30dc23,'connectionNameToIdMap':_0x1ea8c7[_0x13e2c2(0x197)],'connectionIdToNameMap':_0x1ea8c7['idToName'],'connectionNameToTypeMap':_0x1ea8c7[_0x13e2c2(0x17a)]};}export function createPushYamlContextForBundle(_0x46ab93,_0x12018f,_0x24bf27,_0x50306c,_0x4b29ea,_0x380816,_0x33478e,_0x4e256d){const {existingLocalSegmentNames:_0x231de0,localExpandedRuleToNames:_0x2b7b2b}=_0x50306c,_0x52908f=new Set(),_0x5b0b5e=new Map(),_0x9d9f5f=new Map(),_0x4e81db=new Map(),_0x5ddf74=createJumpTargetCache(),_0x25cba8=new Map(),_0x4665ce=new Map(),_0xa9f52f=new Set();let _0x431b18;const _0xa49d6f=_0x2db170=>{const _0x25ab7f={'resolveSegment':async _0xe5b5a3=>{const _0x184c9a=a155_0x27e5,_0x18cf6b=_0x4e81db[_0x184c9a(0x187)](_0xe5b5a3);if(_0x18cf6b!==undefined)return{'name':_0x18cf6b,'isJourneyLocal':!![]};try{const _0x2144fb=await fetchSegment(_0x46ab93,_0x12018f,_0xe5b5a3,_0x24bf27);if(!_0x2144fb)throw new Error(_0x184c9a(0x114));const _0x392b4d=generateJourneyLocalName(_0x2144fb[_0x184c9a(0x108)]),_0x328740=_0x2144fb[_0x184c9a(0x136)]===SEGMENT_KIND_JOURNEY&&_0x392b4d!==undefined;let _0x377313=_0x2144fb['name'],_0x166447;if(_0x328740&&_0x2144fb[_0x184c9a(0xf9)]){const _0x54d62a=apiRuleToYaml(_0x2144fb[_0x184c9a(0xf9)]);_0x4665ce[_0x184c9a(0x167)](_0xe5b5a3,_0x54d62a);const _0x23a6a9=async _0x4d9a98=>{const _0x42310e=_0x184c9a,_0x412cad=collectSegmentRefsFromRule(_0x4d9a98);for(const _0x48eced of _0x412cad){if(!_0x4665ce['has'](_0x48eced))try{const _0x5cf062=await fetchSegment(_0x46ab93,_0x12018f,_0x48eced,_0x24bf27);if(_0x5cf062?.[_0x42310e(0xf9)]){const _0x3c134d=apiRuleToYaml(_0x5cf062['rule']);_0x4665ce[_0x42310e(0x167)](_0x48eced,_0x3c134d),await _0x23a6a9(_0x3c134d);}}catch(_0x328388){logger[_0x42310e(0xd8)](_0x42310e(0x155)+_0x48eced+':\x20'+_0x328388);}}};await _0x23a6a9(_0x54d62a);const _0x1cb75e=serializeExpandedRule(_0x54d62a,_0x4665ce),_0x7fd6ee=_0x2b7b2b['get'](_0x1cb75e);if(_0x7fd6ee&&_0x7fd6ee[_0x184c9a(0x176)]>0x0){const _0x3ddb81=_0x5b0b5e[_0x184c9a(0x187)](_0x1cb75e)||0x0,_0x451f70=_0x7fd6ee[_0x3ddb81]||_0x7fd6ee[_0x7fd6ee['length']-0x1];_0x5b0b5e[_0x184c9a(0x167)](_0x1cb75e,_0x3ddb81+0x1),_0x377313=_0x451f70,_0x52908f[_0x184c9a(0x11c)](_0x377313),_0x4e81db['set'](_0xe5b5a3,_0x377313);const _0x488e7f=await resolveRuleSegmentRefs(_0x54d62a,async _0x4ad729=>{const _0x5299ce=_0x4e81db['get'](_0x4ad729);if(_0x5299ce)return _0x5299ce;const _0x124e0b=await _0x431b18['resolveSegment'](_0x4ad729);return _0x124e0b['name'];});_0x166447={'description':_0x2144fb['description'],'rule':_0x488e7f};}else{const _0x410609=_0x25cba8[_0x184c9a(0x187)](_0x1cb75e);if(_0x410609)_0x377313=_0x410609,_0x4e81db[_0x184c9a(0x167)](_0xe5b5a3,_0x377313);else{if(_0x392b4d){let _0x5a9921=_0x392b4d,_0x8d9219=0x2;while(_0x52908f['has'](_0x5a9921)||_0x231de0[_0x184c9a(0x184)](_0x5a9921)){_0x5a9921=_0x392b4d+'_'+_0x8d9219,_0x8d9219++;}_0x52908f['add'](_0x5a9921),_0x377313=_0x5a9921;}_0x4e81db[_0x184c9a(0x167)](_0xe5b5a3,_0x377313),_0x25cba8['set'](_0x1cb75e,_0x377313);const _0x433bbc=await resolveRuleSegmentRefs(_0x54d62a,async _0x305de6=>{const _0x243a90=_0x184c9a,_0x58481b=_0x4e81db['get'](_0x305de6);if(_0x58481b)return _0x58481b;const _0xea834a=await _0x431b18[_0x243a90(0x1c5)](_0x305de6);return _0xea834a[_0x243a90(0x108)];});_0x166447={'description':_0x2144fb['description'],'rule':_0x433bbc};}}}return{'name':_0x377313,'isJourneyLocal':_0x328740,'definition':_0x166447};}catch(_0x580261){return logger[_0x184c9a(0xd8)](_0x184c9a(0x149)+_0xe5b5a3+':\x20'+_0x580261),{'name':_0xe5b5a3,'isJourneyLocal':![]};}},'resolveActivation':async _0x6fe9f3=>{const _0x33f1e7=a155_0x27e5,_0xceacc=_0x9d9f5f[_0x33f1e7(0x187)](_0x6fe9f3);if(_0xceacc!==undefined)return{'name':_0xceacc,'isJourneyLocal':!![]};try{let _0x2badf7=_0x33478e?.['get'](_0x6fe9f3);!_0x2badf7&&(_0x2badf7=await _0x46ab93[_0x33f1e7(0xf4)]['getActivation'](_0x2db170,_0x6fe9f3));const _0x62de98=_0x2badf7[_0x33f1e7(0x1b6)][_0x33f1e7(0x13c)][_0x33f1e7(0x108)]||_0x6fe9f3,_0x437c39=sanitizeYamlKey(_0x62de98)||'activation_'+_0x6fe9f3,_0x33c2b3=_0x437c39;_0x9d9f5f['set'](_0x6fe9f3,_0x33c2b3);const _0x4c5e89=journeyActivationStepToYaml(_0x2badf7,_0x4b29ea,_0x380816);return{'name':_0x33c2b3,'isJourneyLocal':!![],'definition':_0x4c5e89};}catch(_0x8c1cd6){return logger[_0x33f1e7(0xd8)]('Failed\x20to\x20resolve\x20activation\x20'+_0x6fe9f3+':\x20'+_0x8c1cd6),{'name':_0x6fe9f3,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x121e52,_0x230993)=>resolveJumpTarget(_0x121e52,_0x230993,_0x5ddf74,async _0x2f3b19=>{const _0x486e79=a155_0x27e5,_0xe66947=_0x4e256d?.[_0x486e79(0x187)](_0x2f3b19);if(_0xe66947)return _0xe66947;return _0x46ab93[_0x486e79(0xf4)]['getJourney'](_0x2f3b19);})};return _0x431b18=_0x25ab7f,_0x25ab7f;},_0x40d546=async _0x3e9c9f=>{const _0x34ab8b=a155_0x27e5,{collectSegmentIdsFromJourneyApi:_0x59320f}=await import('./journey-yaml.js'),{batchAsync:_0x2edd42}=await import(_0x34ab8b(0x1a6)),_0x40801b=new Set();for(const _0x41725b of _0x3e9c9f){let _0x4cd8a1=_0x4e256d?.['get'](_0x41725b);!_0x4cd8a1&&(_0x4cd8a1=await _0x46ab93['journey'][_0x34ab8b(0x1a2)](_0x41725b));const _0x3a8342=_0x59320f(_0x4cd8a1);for(const _0x483f43 of _0x3a8342){_0x40801b[_0x34ab8b(0x11c)](_0x483f43);}}let _0x14a511=Array['from'](_0x40801b);while(_0x14a511[_0x34ab8b(0x176)]>0x0){const _0x3d875c=_0x14a511[_0x34ab8b(0xed)](_0x279e21=>!_0xa9f52f[_0x34ab8b(0x184)](_0x279e21));if(_0x3d875c[_0x34ab8b(0x176)]===0x0)break;const _0x57823c=await _0x2edd42(_0x3d875c,async _0xc88a63=>{const _0x43aec2=_0x34ab8b;_0xa9f52f[_0x43aec2(0x11c)](_0xc88a63);const _0x2ae162=await fetchSegment(_0x46ab93,_0x12018f,_0xc88a63,_0x24bf27);if(!_0x2ae162)return null;return{'segmentId':_0xc88a63,'segment':_0x2ae162};},0xa),_0x3f28a5=new Set();for(const _0x4e053a of _0x57823c){if(!_0x4e053a?.[_0x34ab8b(0x175)]?.['rule'])continue;const _0x5d11f7=apiRuleToYaml(_0x4e053a[_0x34ab8b(0x175)]['rule']);_0x4665ce[_0x34ab8b(0x167)](_0x4e053a[_0x34ab8b(0x133)],_0x5d11f7);const _0x3c7b1a=collectSegmentRefsFromRule(_0x5d11f7);for(const _0x5ccd6a of _0x3c7b1a){!_0xa9f52f[_0x34ab8b(0x184)](_0x5ccd6a)&&_0x3f28a5[_0x34ab8b(0x11c)](_0x5ccd6a);}}_0x14a511=Array[_0x34ab8b(0x12f)](_0x3f28a5);}};return{'createYamlContext':_0xa49d6f,'prefetchJourneySegments':_0x40d546};}export async function executePushSegments(_0x278ba3,_0x9a95f4,_0xbea0ec,_0x1be8ad,_0x322cd8){const _0x663900=a155_0x213229,{segmentDefToCreateRequest:_0xb2ee73,segmentDefToUpdateRequest:_0x59066a}=await import(_0x663900(0xf3)),_0x1dcf17=_0xbea0ec['folderPathToId'],_0xff1961=0x5,_0x336198=async _0x9828d6=>{const _0x54d707=_0x663900,_0x13c7fa=_0x9828d6[_0x54d707(0x1cc)]?_0x1dcf17['get'](_0x9828d6[_0x54d707(0x1cc)]):undefined;let _0x50345;const _0x29aa91={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x377114=_0x9828d6[_0x54d707(0x148)];if(_0x9828d6[_0x54d707(0x148)][_0x54d707(0xf9)]){const _0x372a03=createSegmentIdResolver(_0xbea0ec['segmentNameToId'],_0x9828d6[_0x54d707(0x148)]['name']),_0x1b57e3=await resolveRuleSegmentIds(_0x9828d6['yamlConfig'][_0x54d707(0xf9)],_0x372a03);_0x377114={..._0x9828d6[_0x54d707(0x148)],'rule':_0x1b57e3};}try{if(_0x9828d6[_0x54d707(0xee)]){_0x322cd8[_0x54d707(0xf8)]?.({'type':_0x54d707(0x17b),'name':_0x9828d6['yamlConfig'][_0x54d707(0x108)]});const _0x2f962f=_0xb2ee73(_0x377114,_0x13c7fa),_0xc2a191=await _0x322cd8['withProgress'](_0x54d707(0x190)+_0x9828d6['yamlConfig']['name']+_0x54d707(0x173),()=>_0x278ba3[_0x54d707(0x175)][_0x54d707(0x192)](_0x1be8ad[_0x54d707(0x10f)],_0x2f962f));_0x50345=_0xc2a191[_0x54d707(0x1b0)]['id'],_0xbea0ec[_0x54d707(0x1a1)][_0x54d707(0x167)](_0x9828d6[_0x54d707(0x148)][_0x54d707(0x108)],_0x50345),_0x29aa91['createdSegmentId']={'name':_0x9828d6['yamlConfig'][_0x54d707(0x108)],'id':_0x50345},_0x322cd8[_0x54d707(0xf8)]?.({'type':_0x54d707(0x19e),'name':_0x9828d6['yamlConfig'][_0x54d707(0x108)],'segmentId':_0x50345}),_0x322cd8[_0x54d707(0xfd)]?.(_0x54d707(0xf6)+_0x9828d6[_0x54d707(0x148)][_0x54d707(0x108)]+'\x27'),_0x29aa91[_0x54d707(0x122)]=0x1;}else{if(_0x9828d6[_0x54d707(0x117)]){_0x322cd8[_0x54d707(0xf8)]?.({'type':'segment_updating','name':_0x9828d6[_0x54d707(0x148)]['name']});const _0x25c173=_0x59066a(_0x377114);_0x13c7fa!==_0x9828d6['existingSegment']?.['segmentFolderId']&&(_0x25c173[_0x54d707(0x1be)]=_0x13c7fa?parseInt(_0x13c7fa,0xa):undefined),await _0x322cd8['withProgress'](_0x54d707(0x11b)+_0x9828d6[_0x54d707(0x148)]['name']+_0x54d707(0x173),()=>_0x278ba3[_0x54d707(0x175)][_0x54d707(0x1b8)](_0x1be8ad[_0x54d707(0x10f)],_0x9828d6[_0x54d707(0x14a)]['id'],_0x25c173)),_0x50345=_0x9828d6[_0x54d707(0x14a)]['id'],_0x322cd8[_0x54d707(0xf8)]?.({'type':_0x54d707(0x10e),'name':_0x9828d6[_0x54d707(0x148)][_0x54d707(0x108)]}),_0x322cd8[_0x54d707(0xfd)]?.(_0x54d707(0x171)+_0x9828d6[_0x54d707(0x148)][_0x54d707(0x108)]+'\x27'),_0x29aa91['updated']=0x1;}else _0x50345=_0x9828d6[_0x54d707(0x14a)]['id'];}}catch(_0x2b9ffa){const _0x2dd1ff=isHttp400Error(_0x2b9ffa),_0x4855c4=_0x2dd1ff?ErrorCode[_0x54d707(0x130)]:ErrorCode[_0x54d707(0x11d)],_0x5eb40a=getErrorMessage(_0x2b9ffa);throw new SDKError(_0x4855c4,_0x54d707(0x19c)+(_0x9828d6[_0x54d707(0xee)]?'create':_0x54d707(0x152))+'\x20segment\x20from\x20file:\x20'+_0x9828d6[_0x54d707(0x144)]+_0x54d707(0x1a0)+_0x5eb40a,_0x2b9ffa);}try{const _0x5f40bd=await syncActivationsForSegment(_0x278ba3,_0x1be8ad[_0x54d707(0x10f)],_0x50345,_0x9828d6[_0x54d707(0x148)][_0x54d707(0x108)],_0x9828d6[_0x54d707(0x16a)],_0x322cd8,_0x9828d6[_0x54d707(0x144)]);_0x29aa91[_0x54d707(0x13e)]=_0x5f40bd;}catch(_0x34562b){if(_0x34562b instanceof SDKError)throw _0x34562b;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x9828d6[_0x54d707(0x148)][_0x54d707(0x108)]+'\x27\x20from\x20file:\x20'+_0x9828d6['absolutePath']+_0x54d707(0x1a0)+getErrorMessage(_0x34562b),_0x34562b);}return _0x29aa91;},_0x2d1a15=await batchAsync(_0x9a95f4,_0x336198,_0xff1961),_0x53501c={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x3e85e2 of _0x2d1a15){_0x53501c[_0x663900(0x122)]+=_0x3e85e2[_0x663900(0x122)],_0x53501c[_0x663900(0x123)]+=_0x3e85e2[_0x663900(0x123)],_0x3e85e2[_0x663900(0x1d4)]&&_0x53501c['createdSegmentIds']['set'](_0x3e85e2[_0x663900(0x1d4)][_0x663900(0x108)],_0x3e85e2[_0x663900(0x1d4)]['id']),_0x53501c['activations'][_0x663900(0x122)]+=_0x3e85e2[_0x663900(0x13e)][_0x663900(0x122)],_0x53501c[_0x663900(0x13e)][_0x663900(0x123)]+=_0x3e85e2['activations'][_0x663900(0x123)],_0x53501c[_0x663900(0x13e)][_0x663900(0x128)]+=_0x3e85e2[_0x663900(0x13e)][_0x663900(0x128)];}return _0x53501c;}async function syncActivationsForSegment(_0x45881e,_0x96c86e,_0x19a0ec,_0x2a5972,_0x2e4297,_0x8a13f4,_0x767cb1){const _0x5d54f4=a155_0x213229,_0x551caf={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x24b972 of _0x2e4297){try{if(_0x24b972[_0x5d54f4(0xd6)]===_0x5d54f4(0x14d)&&_0x24b972['validatedRequest'])_0x8a13f4['onProgress']?.({'type':_0x5d54f4(0x12a),'segmentName':_0x2a5972,'activationName':_0x24b972[_0x5d54f4(0x108)]}),await _0x8a13f4[_0x5d54f4(0x12d)](_0x5d54f4(0x162)+_0x24b972['name']+_0x5d54f4(0x173),()=>_0x45881e[_0x5d54f4(0x175)][_0x5d54f4(0x103)](_0x96c86e,_0x19a0ec,_0x24b972[_0x5d54f4(0x11e)])),_0x8a13f4['onProgress']?.({'type':'activation_created','segmentName':_0x2a5972,'activationName':_0x24b972[_0x5d54f4(0x108)]}),_0x8a13f4[_0x5d54f4(0xfd)]?.('Created\x20activation\x20\x27'+_0x24b972['name']+'\x27'),_0x551caf['created']++;else{if(_0x24b972[_0x5d54f4(0xd6)]==='update'&&_0x24b972['validatedRequest']&&_0x24b972['existingActivation'])_0x8a13f4['onProgress']?.({'type':_0x5d54f4(0x169),'segmentName':_0x2a5972,'activationName':_0x24b972['name']}),await _0x8a13f4[_0x5d54f4(0x12d)](_0x5d54f4(0x1ac)+_0x24b972[_0x5d54f4(0x108)]+_0x5d54f4(0x173),()=>_0x45881e[_0x5d54f4(0x175)][_0x5d54f4(0x10d)](_0x96c86e,_0x19a0ec,_0x24b972['existingActivation']['id'],_0x24b972[_0x5d54f4(0x11e)])),_0x8a13f4[_0x5d54f4(0xf8)]?.({'type':_0x5d54f4(0x10a),'segmentName':_0x2a5972,'activationName':_0x24b972[_0x5d54f4(0x108)]}),_0x8a13f4[_0x5d54f4(0xfd)]?.(_0x5d54f4(0x102)+_0x24b972[_0x5d54f4(0x108)]+'\x27'),_0x551caf[_0x5d54f4(0x123)]++;else _0x24b972['type']===_0x5d54f4(0x16b)&&_0x24b972['existingActivation']&&(_0x8a13f4[_0x5d54f4(0xf8)]?.({'type':'activation_deleting','segmentName':_0x2a5972,'activationName':_0x24b972[_0x5d54f4(0x108)]}),await _0x8a13f4[_0x5d54f4(0x12d)]('Deleting\x20activation\x20\x27'+_0x24b972['name']+_0x5d54f4(0x173),()=>_0x45881e[_0x5d54f4(0x175)][_0x5d54f4(0xdf)](_0x96c86e,_0x19a0ec,_0x24b972['existingActivation']['id'])),_0x8a13f4[_0x5d54f4(0xf8)]?.({'type':_0x5d54f4(0x17e),'segmentName':_0x2a5972,'activationName':_0x24b972[_0x5d54f4(0x108)]}),_0x8a13f4[_0x5d54f4(0x1c9)]?.(_0x5d54f4(0x139)+_0x24b972[_0x5d54f4(0x108)]+'\x27'),_0x551caf[_0x5d54f4(0x128)]++);}}catch(_0x306a7b){const _0x31dd3f=isHttp400Error(_0x306a7b),_0x13dd16=_0x31dd3f?ErrorCode[_0x5d54f4(0x165)]:ErrorCode[_0x5d54f4(0x1d1)],_0x33d709=getErrorMessage(_0x306a7b);throw new SDKError(_0x13dd16,'Failed\x20to\x20'+_0x24b972[_0x5d54f4(0xd6)]+_0x5d54f4(0x166)+_0x24b972[_0x5d54f4(0x108)]+'\x27\x20from\x20file:\x20'+_0x767cb1+'\x0a\x20\x20'+_0x33d709,_0x306a7b);}}return _0x551caf;}export async function executePushFolders(_0x3783a2,_0x30a42c,_0x126ce9,_0x303752,_0x2306a7){const _0x3e40c6=a155_0x213229,_0x4edef4=new Map(_0x126ce9),_0x611748=sortFoldersByDepth(_0x30a42c);for(const _0x462063 of _0x611748){const _0x27cd92=_0x462063['split']('/'),_0x13e1a6=_0x27cd92[_0x27cd92[_0x3e40c6(0x176)]-0x1],_0x5d9c60=_0x27cd92[_0x3e40c6(0x19d)](0x0,-0x1)['join']('/'),_0x2d9c7e=_0x4edef4[_0x3e40c6(0x187)](_0x5d9c60);_0x2306a7[_0x3e40c6(0xf8)]?.({'type':_0x3e40c6(0xd7),'folder':_0x462063});const _0x3bec31={'name':_0x13e1a6,'parentFolderId':_0x2d9c7e},_0x5bd1cf=await _0x2306a7['withProgress'](_0x3e40c6(0x143)+_0x462063+_0x3e40c6(0x173),()=>_0x3783a2[_0x3e40c6(0x175)][_0x3e40c6(0x145)](_0x303752[_0x3e40c6(0x10f)],_0x3bec31));_0x4edef4[_0x3e40c6(0x167)](_0x462063,_0x5bd1cf['data']['id']),_0x2306a7[_0x3e40c6(0xf8)]?.({'type':'folder_created','folder':_0x462063,'folderId':_0x5bd1cf['data']['id']}),_0x2306a7[_0x3e40c6(0x1d3)]?.(_0x3e40c6(0x100)+_0x462063+'\x27');}return _0x4edef4;}export async function executePushSegmentDeletions(_0x386d3b,_0x385a6b,_0x525f59){const _0x32e56f=a155_0x213229;if(_0x385a6b[_0x32e56f(0x176)]===0x0)return 0x0;const {batchAsync:_0x538a6d}=await import(_0x32e56f(0x1a6)),_0x43556c=0x5,_0x289715=await _0x538a6d(_0x385a6b,async _0x10ae73=>{const _0x978c85=_0x32e56f;return _0x525f59[_0x978c85(0xf8)]?.({'type':_0x978c85(0xf0),'name':_0x10ae73[_0x978c85(0x108)]}),await _0x386d3b[_0x978c85(0x175)][_0x978c85(0x1bc)](_0x10ae73['id']),_0x525f59[_0x978c85(0xf8)]?.({'type':_0x978c85(0x189),'name':_0x10ae73[_0x978c85(0x108)]}),_0x525f59[_0x978c85(0x1c9)]?.('Deleted\x20segment\x20\x27'+_0x10ae73[_0x978c85(0x108)]+'\x27'),0x1;},_0x43556c);return _0x289715[_0x32e56f(0x14b)]((_0x12d319,_0x20cd64)=>_0x12d319+_0x20cd64,0x0);}export async function executePushJourneys(_0x512588,_0x457d12,_0x267198,_0x557334,_0xbe3f3a){const _0x1d4bcd=a155_0x213229,{journeyDefToRequest:_0x5629ee}=await import('./journey-yaml.js'),{activationDefToCreateRequest:_0x329003,yamlRuleToApi:_0xd251b7,validateSegmentRule:_0x234a3e}=await import(_0x1d4bcd(0xf3)),_0x26b609={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x48de8a=new Map(_0x267198[_0x1d4bcd(0x1a1)]),_0x151f94=0x5;for(let _0x3c45ea=0x0;_0x3c45ea<_0x457d12[_0x1d4bcd(0x176)];_0x3c45ea+=_0x151f94){const _0x5b92f9=_0x457d12[_0x1d4bcd(0x19d)](_0x3c45ea,_0x3c45ea+_0x151f94),_0x327843=await Promise['all'](_0x5b92f9[_0x1d4bcd(0x19f)](async _0x3881a9=>{const _0x13bc9c=_0x1d4bcd;if(!_0x3881a9['isNew']&&!_0x3881a9[_0x13bc9c(0x117)])return{'action':_0x13bc9c(0x199),'name':_0x3881a9[_0x13bc9c(0x148)][_0x13bc9c(0x108)],'journeyId':_0x3881a9[_0x13bc9c(0x191)]?.['id']};const _0x50f922=_0x3881a9[_0x13bc9c(0x1cc)]?_0x267198[_0x13bc9c(0x18c)]['get'](_0x3881a9['folderPath']):undefined;_0xbe3f3a[_0x13bc9c(0xf8)]?.({'type':_0x3881a9[_0x13bc9c(0xee)]?'journey_creating':_0x13bc9c(0xf2),'name':_0x3881a9['yamlConfig'][_0x13bc9c(0x108)]});try{const _0x5ba75a=await executeSingleJourneyPush(_0x512588,_0x3881a9,{..._0x267198,'segmentNameToId':_0x48de8a},{'parentId':_0x557334[_0x13bc9c(0x10f)],'rootFolderId':_0x557334['rootFolderId'],'folderId':_0x50f922,'verbose':_0x557334[_0x13bc9c(0x11f)]},_0xbe3f3a,{'journeyDefToRequest':_0x5629ee,'activationDefToCreateRequest':_0x329003,'yamlRuleToApi':_0xd251b7,'validateSegmentRule':_0x234a3e});for(const [_0x19ea73,_0x3391c1]of _0x5ba75a[_0x13bc9c(0x1ab)]){_0x48de8a[_0x13bc9c(0x167)](_0x19ea73,_0x3391c1),_0x26b609[_0x13bc9c(0x1ab)][_0x13bc9c(0x167)](_0x19ea73,_0x3391c1);}if(_0x5ba75a['action']==='created')_0xbe3f3a[_0x13bc9c(0xf8)]?.({'type':_0x13bc9c(0x134),'name':_0x3881a9[_0x13bc9c(0x148)][_0x13bc9c(0x108)],'journeyId':_0x5ba75a[_0x13bc9c(0x140)]}),_0xbe3f3a['logSuccess']?.(_0x13bc9c(0x19b)+_0x3881a9[_0x13bc9c(0x148)]['name']+'\x27'),_0x26b609['created']++;else _0x5ba75a['action']===_0x13bc9c(0x123)&&(_0xbe3f3a['onProgress']?.({'type':_0x13bc9c(0x115),'name':_0x3881a9[_0x13bc9c(0x148)]['name']}),_0xbe3f3a[_0x13bc9c(0xfd)]?.('Updated\x20journey\x20\x27'+_0x3881a9[_0x13bc9c(0x148)][_0x13bc9c(0x108)]+'\x27'),_0x26b609['updated']++);return{'action':_0x5ba75a[_0x13bc9c(0x179)],'name':_0x3881a9[_0x13bc9c(0x148)]['name'],'journeyId':_0x5ba75a[_0x13bc9c(0x140)]};}catch(_0xb7ed5c){const _0x36585b=isHttp400Error(_0xb7ed5c),_0x7cded4=_0x36585b?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x3ef7b4=getErrorMessage(_0xb7ed5c);throw new SDKError(_0x7cded4,_0x13bc9c(0x19c)+(_0x3881a9[_0x13bc9c(0xee)]?_0x13bc9c(0x14d):'update')+_0x13bc9c(0x1d5)+_0x3881a9[_0x13bc9c(0x144)]+_0x13bc9c(0x1a0)+_0x3ef7b4,_0xb7ed5c);}}));_0x26b609[_0x1d4bcd(0x1cd)][_0x1d4bcd(0x1ce)](..._0x327843);}return _0x26b609;}async function matchExistingJourneySegments(_0x43fc03,_0x274674,_0x3586cf,_0x410fdb,_0x1a6db7){const _0x4c050d=a155_0x213229;if(!_0x274674[_0x4c050d(0x191)]||!_0x274674[_0x4c050d(0x148)]['segments'])return;const _0x58fa94=new Map(),_0x5016f3=new Set();for(const _0x1c874e of Object['keys'](_0x274674[_0x4c050d(0x148)][_0x4c050d(0x183)])){const _0x48be4a=generateDeterministicJourneySegmentName(_0x274674[_0x4c050d(0x148)]['name'],_0x1c874e);_0x58fa94['set'](_0x48be4a,_0x1c874e),_0x5016f3[_0x4c050d(0x11c)](_0x1c874e);}const _0x35ec3e=[],_0x57d06a=collectSegmentIdsFromJourneyApi(_0x274674['existingJourney']);for(const _0x92a1f2 of _0x57d06a){const _0x56b2b4=await fetchSegment(_0x43fc03,_0x3586cf,_0x92a1f2,_0x410fdb);if(!_0x56b2b4?.[_0x4c050d(0x108)])continue;const _0x43f267=_0x58fa94['get'](_0x56b2b4[_0x4c050d(0x108)]);_0x43f267?(_0x1a6db7[_0x4c050d(0x167)](_0x43f267,_0x92a1f2),_0x5016f3[_0x4c050d(0x16b)](_0x43f267)):_0x35ec3e[_0x4c050d(0x1ce)]({'id':_0x92a1f2,'seg':_0x56b2b4});}if(_0x5016f3[_0x4c050d(0x16d)]>0x0&&_0x35ec3e[_0x4c050d(0x176)]>0x0){const {localExpandedRuleToNames:_0x214b09}=buildLocalExpandedRuleMappings(_0x274674[_0x4c050d(0x148)]),_0x334bf4=new Map();for(const {id:_0x5a23ea,seg:_0xfcbdab}of _0x35ec3e){if(_0xfcbdab[_0x4c050d(0xf9)]){const _0x51da08=apiRuleToYaml(_0xfcbdab['rule']);_0x334bf4['set'](_0x5a23ea,_0x51da08);}}for(const {id:_0x1b3fe6,seg:_0xdb296e}of _0x35ec3e){if(!_0xdb296e[_0x4c050d(0xf9)])continue;const _0x1e36e2=_0x334bf4['get'](_0x1b3fe6);if(!_0x1e36e2)continue;const _0x5edcb0=serializeExpandedRule(_0x1e36e2,_0x334bf4),_0x642961=_0x214b09[_0x4c050d(0x187)](_0x5edcb0);if(_0x642961){const _0x4664aa=_0x642961[_0x4c050d(0xd5)](_0x672fa=>_0x5016f3[_0x4c050d(0x184)](_0x672fa));_0x4664aa&&(_0x1a6db7[_0x4c050d(0x167)](_0x4664aa,_0x1b3fe6),_0x5016f3['delete'](_0x4664aa),logger['debug'](_0x4c050d(0x138)+_0xdb296e[_0x4c050d(0x108)]+'\x27\x20to\x20local\x20\x27'+_0x4664aa+_0x4c050d(0xec)));}}}}async function executeSingleJourneyPush(_0x2d3f2a,_0x6b57c4,_0x4a4be9,_0x11202d,_0x44e193,_0x23c079){const _0x30a47e=a155_0x213229,{journeyDefToRequest:_0x3a7ebb,activationDefToCreateRequest:_0x26e042,yamlRuleToApi:_0x387fc0,validateSegmentRule:_0x480258}=_0x23c079,_0x134110=new Map(),_0x325734=new Map();recoverSegmentIdsFromPushRecovery(_0x6b57c4,_0x134110,_0x4a4be9['segmentNameToId']);const _0x15bca5=new Map(),_0x3e5b44=new Map(),_0x25fa30=new Map();let _0x11ad7a;const _0x39fd37=async()=>{const _0x5302ae=a155_0x27e5;if(_0x11ad7a)return;_0x11ad7a=new Map();if(!_0x6b57c4['existingJourney'])return;const _0x5a9b7c=await _0x2d3f2a[_0x5302ae(0xf4)][_0x5302ae(0x1c3)](_0x6b57c4['existingJourney']['id']);for(const _0x136d55 of _0x5a9b7c){const _0x1edf4e=journeyActivationStepToYaml(_0x136d55,_0x4a4be9['idToEmailMap'],_0x4a4be9[_0x5302ae(0x1a7)]),_0x56b2a7=activationSignature(_0x1edf4e);!_0x11ad7a[_0x5302ae(0x184)](_0x56b2a7)&&_0x11ad7a[_0x5302ae(0x167)](_0x56b2a7,_0x136d55['id']),_0x1edf4e['name']&&_0x325734[_0x5302ae(0x167)](_0x1edf4e[_0x5302ae(0x108)],_0x136d55['id']);}};await matchExistingJourneySegments(_0x2d3f2a,_0x6b57c4,_0x11202d[_0x30a47e(0x10f)],_0x4a4be9[_0x30a47e(0x1a3)],_0x4a4be9['segmentNameToId']);const _0x46bed7={'resolveSegmentId':async _0x3d6954=>{const _0x5627d5=_0x30a47e,_0x34d698=_0x4a4be9[_0x5627d5(0x1a1)][_0x5627d5(0x187)](_0x3d6954);if(!_0x34d698)throw new SDKError(ErrorCode[_0x5627d5(0x198)],'Segment\x20not\x20found:\x20'+_0x3d6954+_0x5627d5(0x104)+_0x6b57c4[_0x5627d5(0x148)][_0x5627d5(0x108)]+')');return _0x34d698;},'resolveEmbeddedSegmentId':async(_0x3f7746,_0x4b4b2f)=>{const _0x3674fb=_0x30a47e,_0x1d4abf=_0x4a4be9[_0x3674fb(0x1a1)][_0x3674fb(0x187)](_0x3f7746);if(_0x1d4abf)return _0x1d4abf;const _0x5780ba=_0x4a4be9[_0x3674fb(0x1a3)]['find'](_0x19fd18=>_0x19fd18['name']===_0x3f7746);if(_0x5780ba)return _0x4a4be9[_0x3674fb(0x1a1)][_0x3674fb(0x167)](_0x3f7746,_0x5780ba['id']),_0x5780ba['id'];if(_0x6b57c4[_0x3674fb(0xee)]){const {stageName:_0x1a3cb2,criteriaName:_0x1fec91}=findSegmentCriteriaLocation(_0x6b57c4[_0x3674fb(0x148)],_0x3f7746);return _0x480258(_0x3f7746,_0x4b4b2f['rule']),_0x3e5b44[_0x3674fb(0x167)](_0x3f7746,{'definition':_0x4b4b2f,'stageName':_0x1a3cb2,'criteriaName':_0x1fec91}),createPendingSegmentId(_0x3f7746);}const _0x3790cc=_0x6b57c4[_0x3674fb(0x191)]?.['id'];if(!_0x3790cc)throw new SDKError(ErrorCode[_0x3674fb(0x170)],_0x3674fb(0x13a));const _0x4ffd7a=_0x15bca5[_0x3674fb(0x187)](_0x3f7746);if(_0x4ffd7a)return _0x4ffd7a;const _0x55c107=((async()=>{const _0x1efcbe=_0x3674fb;_0x480258(_0x3f7746,_0x4b4b2f[_0x1efcbe(0xf9)]);const _0x3ba2e4=generateDeterministicJourneySegmentName(_0x6b57c4[_0x1efcbe(0x148)][_0x1efcbe(0x108)],_0x3f7746),_0x2747b0=_0x4a4be9[_0x1efcbe(0x1a3)][_0x1efcbe(0xd5)](_0x32b5b5=>_0x32b5b5[_0x1efcbe(0x108)]===_0x3ba2e4),_0x5bb42d=createSegmentIdResolver(_0x4a4be9[_0x1efcbe(0x1a1)],_0x3f7746),_0x53c752=await resolveRuleSegmentIds(_0x4b4b2f[_0x1efcbe(0xf9)],_0x5bb42d);let _0x5a74a3;return _0x2747b0?(await _0x2d3f2a['segment'][_0x1efcbe(0x1b8)](_0x11202d['parentId'],_0x2747b0['id'],{'description':_0x4b4b2f[_0x1efcbe(0x177)]||'Entry\x20criteria:\x20'+_0x3f7746,'rule':_0x387fc0(_0x53c752),'countPopulation':!![]}),_0x5a74a3=_0x2747b0['id'],saveSegmentToPushRecovery(_0x6b57c4['absolutePath'],_0x6b57c4['yamlConfig'][_0x1efcbe(0x108)],_0x3f7746,{'segmentId':_0x5a74a3,'uniqueServerName':_0x3ba2e4,'createdAt':new Date()['toISOString']()})):_0x5a74a3=await createOrRecoverEmbeddedSegment(_0x2d3f2a,_0x6b57c4,{'localName':_0x3f7746,'uniqueSegmentName':_0x3ba2e4,'description':_0x4b4b2f[_0x1efcbe(0x177)]||'Entry\x20criteria:\x20'+_0x3f7746,'journeyId':_0x3790cc,'resolvedRule':_0x53c752,'parentId':_0x11202d[_0x1efcbe(0x10f)],'folderId':_0x11202d[_0x1efcbe(0x137)]||''},_0x387fc0),_0x4a4be9[_0x1efcbe(0x1a1)][_0x1efcbe(0x167)](_0x3f7746,_0x5a74a3),_0x134110['set'](_0x3f7746,_0x5a74a3),_0x5a74a3;})());_0x15bca5[_0x3674fb(0x167)](_0x3f7746,_0x55c107);try{return await _0x55c107;}finally{_0x15bca5['delete'](_0x3f7746);}},'resolveActivationId':async _0x587814=>{const _0x4e199b=_0x30a47e,_0xf25c0e=_0x325734[_0x4e199b(0x187)](_0x587814);if(_0xf25c0e)return _0xf25c0e;if(_0x6b57c4[_0x4e199b(0x191)]){await _0x39fd37();const _0x5528ea=_0x325734[_0x4e199b(0x187)](_0x587814);if(_0x5528ea)return _0x5528ea;}throw new SDKError(ErrorCode['NOT_FOUND'],'Activation\x20not\x20found:\x20'+_0x587814+_0x4e199b(0x104)+_0x6b57c4[_0x4e199b(0x148)]['name']+_0x4e199b(0x174)+_0x4e199b(0x131));},'resolveEmbeddedActivationId':async(_0x148efc,_0x16a9d4)=>{const _0xd0f8f7=_0x30a47e,_0x1c25fe=_0x325734[_0xd0f8f7(0x187)](_0x148efc);if(_0x1c25fe)return _0x1c25fe;if(_0x6b57c4['isNew'])return _0x25fa30[_0xd0f8f7(0x167)](_0x148efc,_0x16a9d4),createPendingActivationId(_0x148efc);if(_0x6b57c4['existingJourney']){await _0x39fd37();const _0x358e91=_0x325734['get'](_0x16a9d4['name']);if(_0x358e91)return _0x325734['set'](_0x148efc,_0x358e91),_0x358e91;const _0x35b799=activationSignature(_0x16a9d4),_0x4d2f85=_0x11ad7a?.[_0xd0f8f7(0x187)](_0x35b799);if(_0x4d2f85)return _0x325734['set'](_0x148efc,_0x4d2f85),_0x4d2f85;const _0x327770=await _0x26e042(_0x16a9d4,_0x4a4be9[_0xd0f8f7(0xfa)]),_0x1b9980={..._0x327770,..._0x16a9d4['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x16a9d4[_0xd0f8f7(0xe5)]}},_0x4ff41a=await _0x2d3f2a[_0xd0f8f7(0xf4)]['createActivation'](_0x6b57c4['existingJourney']['id'],_0x1b9980);return _0x325734[_0xd0f8f7(0x167)](_0x148efc,_0x4ff41a['id']),_0x4ff41a['id'];}throw new SDKError(ErrorCode['INTERNAL'],_0xd0f8f7(0x118));},'resolveJourneyId':async _0x3bf34c=>{const _0x16f076=_0x30a47e;try{return await _0x2d3f2a['journey'][_0x16f076(0xff)](_0x11202d[_0x16f076(0x10f)],_0x3bf34c);}catch(_0x158273){throw new SDKError(ErrorCode[_0x16f076(0x109)],_0x16f076(0x13b)+_0x3bf34c+_0x16f076(0x19a)+_0x6b57c4[_0x16f076(0x148)][_0x16f076(0x108)]+'\x27)',_0x158273);}},'resolveStageId':async(_0x118095,_0x38e40e)=>{const _0x3aed00=_0x30a47e,_0x2bc9e2=await _0x2d3f2a[_0x3aed00(0xf4)]['getJourney'](_0x118095),_0x4a8cec=_0x2bc9e2[_0x3aed00(0x1b6)][_0x3aed00(0x161)][_0x3aed00(0xd5)](_0x4bab9f=>_0x4bab9f[_0x3aed00(0x108)][_0x3aed00(0x15a)]()===_0x38e40e[_0x3aed00(0x15a)]());if(!_0x4a8cec?.['id'])throw new SDKError(ErrorCode[_0x3aed00(0x109)],'Stage\x20\x27'+_0x38e40e+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x2bc9e2[_0x3aed00(0x1b6)][_0x3aed00(0x1d0)]||_0x2bc9e2[_0x3aed00(0x1b6)][_0x3aed00(0x108)])+'\x27');return _0x4a8cec['id'];}},_0x114e28=await _0x3a7ebb(_0x6b57c4[_0x30a47e(0x148)],_0x11202d['parentId'],_0x46bed7),_0x5f22bd=_0x11202d[_0x30a47e(0x1ca)]||_0x11202d['rootFolderId'];_0x5f22bd&&(_0x114e28[_0x30a47e(0x126)]={'parentFolder':{'data':{'id':_0x5f22bd,'type':'folder'}}});if(_0x6b57c4['isNew']){if(_0x3e5b44[_0x30a47e(0x16d)]>0x0||_0x25fa30[_0x30a47e(0x16d)]>0x0)return await executeThreeStepJourneyCreate(_0x2d3f2a,_0x6b57c4,_0x114e28,{'pendingEmbeddedSegments':_0x3e5b44,'pendingEmbeddedActivations':_0x25fa30,'embeddedSegmentNameToId':_0x134110,'journeyActivationNameToId':_0x325734},{..._0x11202d,'effectiveFolderId':_0x5f22bd},_0x4a4be9,_0x44e193,_0x23c079);else{ensureJourneyDefaults(_0x114e28['attributes']);const _0x64152f=await _0x2d3f2a[_0x30a47e(0xf4)][_0x30a47e(0x14d)](_0x114e28);return deletePushRecovery(_0x6b57c4[_0x30a47e(0x144)]),{'action':_0x30a47e(0x122),'journeyId':_0x64152f['id'],'embeddedSegmentNameToId':_0x134110};}}else{if(_0x6b57c4['hasChanges']&&_0x6b57c4[_0x30a47e(0x191)]){_0x114e28['id']=_0x6b57c4[_0x30a47e(0x191)]['id'];const _0x19f2e8=_0x114e28[_0x30a47e(0x1b6)];_0x6b57c4[_0x30a47e(0x191)][_0x30a47e(0x1b6)]?.[_0x30a47e(0x1d0)]&&(_0x19f2e8[_0x30a47e(0x1d0)]=_0x6b57c4[_0x30a47e(0x191)][_0x30a47e(0x1b6)][_0x30a47e(0x1d0)]);const _0x113790=_0x6b57c4[_0x30a47e(0x191)][_0x30a47e(0x1b6)]?.[_0x30a47e(0x161)];return _0x113790&&_0x114e28[_0x30a47e(0x1b6)]['journeyStages']&&injectExistingStageIds(_0x114e28[_0x30a47e(0x1b6)][_0x30a47e(0x161)],_0x113790),ensureJourneyDefaults(_0x19f2e8),await _0x2d3f2a[_0x30a47e(0xf4)][_0x30a47e(0x152)](_0x6b57c4[_0x30a47e(0x191)]['id'],_0x114e28),deletePushRecovery(_0x6b57c4[_0x30a47e(0x144)]),{'action':_0x30a47e(0x123),'journeyId':_0x6b57c4['existingJourney']['id'],'embeddedSegmentNameToId':_0x134110};}}return deletePushRecovery(_0x6b57c4[_0x30a47e(0x144)]),{'action':'unchanged','journeyId':_0x6b57c4[_0x30a47e(0x191)]?.['id'],'embeddedSegmentNameToId':_0x134110};}function findSegmentCriteriaLocation(_0x37e113,_0x954226){const _0x50ca2c=a155_0x213229,_0x12c470=_0x37e113[_0x50ca2c(0x13d)]||_0x37e113['journeys']?.[0x0]?.[_0x50ca2c(0x13d)]||[];let _0x43a5ee=_0x50ca2c(0xe1),_0xd39788=_0x954226;const _0x2629b6=_0x37e113[_0x50ca2c(0x1c4)]||_0x37e113[_0x50ca2c(0x132)]?.[0x0]?.[_0x50ca2c(0x1c4)];if(_0x2629b6?.['segment']===_0x954226)return{'stageName':_0x50ca2c(0x1c4),'criteriaName':_0x2629b6[_0x50ca2c(0x108)]||_0x954226};_0x3b372f:for(const _0x52df10 of _0x12c470){if(_0x52df10[_0x50ca2c(0x18f)]?.['segment']===_0x954226){_0x43a5ee=_0x52df10[_0x50ca2c(0x108)],_0xd39788=_0x52df10[_0x50ca2c(0x18f)][_0x50ca2c(0x108)]||_0x954226;break;}if(_0x52df10[_0x50ca2c(0x14c)])for(const _0x3b63a1 of _0x52df10[_0x50ca2c(0x14c)]){if(_0x3b63a1[_0x50ca2c(0xd6)]===_0x50ca2c(0x188)&&_0x3b63a1['with']?.[_0x50ca2c(0x107)])for(const _0x465326 of _0x3b63a1[_0x50ca2c(0xe9)][_0x50ca2c(0x107)]){if(_0x465326[_0x50ca2c(0x175)]===_0x954226){_0x43a5ee=_0x52df10[_0x50ca2c(0x108)],_0xd39788=_0x465326['name']||_0x954226;break _0x3b372f;}}}}return{'stageName':_0x43a5ee,'criteriaName':_0xd39788};}async function executeThreeStepJourneyCreate(_0x19fb78,_0x5c1748,_0x1171dc,_0x57b225,_0x45f17e,_0x4bcf14,_0x474f78,_0x274ba1){const _0x1a1165=a155_0x213229,{activationDefToCreateRequest:_0x29ac92,yamlRuleToApi:_0x5848c5}=_0x274ba1,{pendingEmbeddedSegments:_0x267d3a,pendingEmbeddedActivations:_0x3cd2f0,embeddedSegmentNameToId:_0x45fc24}=_0x57b225,_0x28d0c9=JSON[_0x1a1165(0xf1)](JSON[_0x1a1165(0x15f)](_0x1171dc));ensureJourneyDefaults(_0x28d0c9['attributes']),stripPendingIds(_0x28d0c9);const _0x1da99d=await _0x19fb78[_0x1a1165(0xf4)][_0x1a1165(0x14d)](_0x28d0c9),_0x90c69e=_0x1da99d['id'],_0x200696=new Map();for(const _0x4c87fa of _0x1da99d[_0x1a1165(0x1b6)][_0x1a1165(0x161)]){_0x200696[_0x1a1165(0x167)](_0x4c87fa[_0x1a1165(0x108)]['toLowerCase'](),_0x4c87fa['id']);}recoverSegmentIdsFromPushRecovery(_0x5c1748,_0x45fc24,_0x4bcf14[_0x1a1165(0x1a1)]);for(const [_0x3a6e53,{definition:_0x5024ab}]of _0x267d3a){if(_0x45fc24['has'](_0x3a6e53)){_0x474f78[_0x1a1165(0xf8)]?.({'type':'embedded_segment_created','journeyName':_0x5c1748[_0x1a1165(0x148)][_0x1a1165(0x108)],'segmentName':_0x3a6e53});continue;}const _0x13f3fd=generateDeterministicJourneySegmentName(_0x5c1748[_0x1a1165(0x148)][_0x1a1165(0x108)],_0x3a6e53);_0x474f78[_0x1a1165(0xf8)]?.({'type':_0x1a1165(0x141),'journeyName':_0x5c1748[_0x1a1165(0x148)]['name'],'segmentName':_0x3a6e53});const _0xaf5072=createSegmentIdResolver(_0x4bcf14['segmentNameToId'],_0x3a6e53),_0x4f20ef=await resolveRuleSegmentIds(_0x5024ab['rule'],_0xaf5072),_0x4d99ec=await createOrRecoverEmbeddedSegment(_0x19fb78,_0x5c1748,{'localName':_0x3a6e53,'uniqueSegmentName':_0x13f3fd,'description':_0x5024ab[_0x1a1165(0x177)]||'Entry\x20criteria:\x20'+_0x3a6e53,'journeyId':_0x90c69e,'resolvedRule':_0x4f20ef,'parentId':_0x45f17e[_0x1a1165(0x10f)],'folderId':_0x45f17e[_0x1a1165(0x135)]||''},_0x5848c5);_0x45fc24[_0x1a1165(0x167)](_0x3a6e53,_0x4d99ec),_0x4bcf14['segmentNameToId'][_0x1a1165(0x167)](_0x3a6e53,_0x4d99ec),_0x474f78[_0x1a1165(0xf8)]?.({'type':'embedded_segment_created','journeyName':_0x5c1748[_0x1a1165(0x148)]['name'],'segmentName':_0x3a6e53});}const _0x218561=new Map();for(const [_0x3f993a,_0x59fb25]of _0x3cd2f0){_0x474f78[_0x1a1165(0xf8)]?.({'type':_0x1a1165(0x159),'journeyName':_0x5c1748['yamlConfig']['name'],'activationName':_0x3f993a});const _0x211fad=await _0x29ac92(_0x59fb25,_0x4bcf14[_0x1a1165(0xfa)]),_0x4ae311={..._0x211fad,..._0x59fb25[_0x1a1165(0xe5)]!==undefined&&{'runAfterJourneyRefresh':_0x59fb25['run_after_journey_refresh']}},_0x376411=await _0x19fb78[_0x1a1165(0xf4)]['createActivation'](_0x90c69e,_0x4ae311);_0x218561[_0x1a1165(0x167)](_0x3f993a,_0x376411['id']),_0x57b225[_0x1a1165(0x151)][_0x1a1165(0x167)](_0x3f993a,_0x376411['id']),_0x474f78[_0x1a1165(0xf8)]?.({'type':_0x1a1165(0x185),'journeyName':_0x5c1748['yamlConfig'][_0x1a1165(0x108)],'activationName':_0x3f993a});}const _0x5e7265=JSON[_0x1a1165(0xf1)](JSON[_0x1a1165(0x15f)](_0x1171dc));return _0x5e7265['id']=_0x90c69e,ensureJourneyDefaults(_0x5e7265[_0x1a1165(0x1b6)]),resolvePendingIdsInRequest(_0x5e7265,_0x1171dc,_0x200696,_0x45fc24,_0x218561,_0x474f78),await _0x19fb78[_0x1a1165(0xf4)][_0x1a1165(0x152)](_0x90c69e,_0x5e7265),deletePushRecovery(_0x5c1748[_0x1a1165(0x144)]),{'action':_0x1a1165(0x122),'journeyId':_0x90c69e,'embeddedSegmentNameToId':_0x45fc24};}export function stripWaitStepPendingIds(_0x525242){const _0x4cb505=a155_0x213229,_0x1d27ea=_0x525242[_0x4cb505(0x18a)]&&isPendingSegmentId(_0x525242[_0x4cb505(0x18a)]),_0x142c45=_0x525242[_0x4cb505(0xdd)]?.[_0x4cb505(0x125)](_0x5a833c=>_0x5a833c[_0x4cb505(0x133)]&&isPendingSegmentId(_0x5a833c['segmentId']));(_0x1d27ea||_0x142c45)&&(_0x525242[_0x4cb505(0x1cb)]='Duration',_0x525242[_0x4cb505(0xdc)]=0x1,_0x525242[_0x4cb505(0x1ae)]=_0x4cb505(0x153),delete _0x525242[_0x4cb505(0x18a)],delete _0x525242['conditionTimeoutDuration'],delete _0x525242[_0x4cb505(0x10b)],delete _0x525242['conditions']);}export function resolveWaitStepPendingIds(_0x3f780a,_0x28edc7,_0x46c325,_0x5a70f7){const _0x2f202c=a155_0x213229;if(_0x28edc7[_0x2f202c(0x18a)]&&isPendingSegmentId(_0x28edc7['conditionSegmentId'])){const _0x174095=_0x46c325(_0x28edc7['conditionSegmentId'],_0x2f202c(0x16f)+_0x5a70f7+_0x2f202c(0x181));_0x174095&&(_0x3f780a[_0x2f202c(0x1cb)]=_0x2f202c(0x1a4),_0x3f780a[_0x2f202c(0x18a)]=_0x174095,delete _0x3f780a[_0x2f202c(0xdc)],delete _0x3f780a[_0x2f202c(0x1ae)],_0x28edc7[_0x2f202c(0xe2)]!==undefined&&(_0x3f780a['conditionTimeoutDuration']=_0x28edc7['conditionTimeoutDuration']),_0x28edc7[_0x2f202c(0x10b)]&&(_0x3f780a['conditionTimeoutUnit']=_0x28edc7[_0x2f202c(0x10b)]));}if(_0x28edc7[_0x2f202c(0xdd)]){const _0x598005=_0x28edc7[_0x2f202c(0xdd)][_0x2f202c(0x125)](_0x341783=>_0x341783[_0x2f202c(0x133)]&&isPendingSegmentId(_0x341783[_0x2f202c(0x133)]));if(_0x598005){const _0x3acd97=_0x28edc7['conditions'][_0x2f202c(0x19f)](_0x5af9b5=>{const _0x2a3bbe=_0x2f202c;if(_0x5af9b5[_0x2a3bbe(0x133)]&&isPendingSegmentId(_0x5af9b5[_0x2a3bbe(0x133)])){const _0x4d1cee=_0x46c325(_0x5af9b5[_0x2a3bbe(0x133)],_0x2a3bbe(0x16f)+_0x5a70f7+_0x2a3bbe(0x181));return{..._0x5af9b5,'segmentId':_0x4d1cee||_0x5af9b5[_0x2a3bbe(0x133)]};}return{..._0x5af9b5};});_0x3f780a['waitStepType']=_0x2f202c(0x1a4),_0x3f780a[_0x2f202c(0xdd)]=_0x3acd97,delete _0x3f780a['waitStep'],delete _0x3f780a[_0x2f202c(0x1ae)],delete _0x3f780a['conditionSegmentId'],delete _0x3f780a['conditionTimeoutDuration'],delete _0x3f780a[_0x2f202c(0x10b)];}}}function stripPendingIds(_0x3ab5a7){const _0x18150e=a155_0x213229;_0x3ab5a7[_0x18150e(0x1b6)][_0x18150e(0x1c4)]?.[_0x18150e(0x133)]&&isPendingSegmentId(_0x3ab5a7[_0x18150e(0x1b6)][_0x18150e(0x1c4)][_0x18150e(0x133)])&&delete _0x3ab5a7[_0x18150e(0x1b6)][_0x18150e(0x1c4)];for(const _0x3c29ff of _0x3ab5a7['attributes'][_0x18150e(0x161)]||[]){_0x3c29ff[_0x18150e(0xe7)]?.[_0x18150e(0x133)]&&isPendingSegmentId(_0x3c29ff['entryCriteria'][_0x18150e(0x133)])&&delete _0x3c29ff[_0x18150e(0xe7)];_0x3c29ff[_0x18150e(0x194)]?.[_0x18150e(0x133)]&&isPendingSegmentId(_0x3c29ff['milestone'][_0x18150e(0x133)])&&delete _0x3c29ff['milestone'];_0x3c29ff[_0x18150e(0x157)]&&(_0x3c29ff[_0x18150e(0x157)]=_0x3c29ff[_0x18150e(0x157)][_0x18150e(0xed)](_0x31d143=>!_0x31d143[_0x18150e(0x133)]||!isPendingSegmentId(_0x31d143['segmentId'])));if(_0x3c29ff[_0x18150e(0x14c)])for(const _0x45a958 of Object[_0x18150e(0x1c2)](_0x3c29ff[_0x18150e(0x14c)])){const _0x10faf1=_0x3c29ff['steps'][_0x45a958];_0x10faf1[_0x18150e(0xd6)]===_0x18150e(0x172)&&_0x10faf1['journeyActivationStepId']&&isPendingActivationId(_0x10faf1[_0x18150e(0x12b)])&&(_0x10faf1[_0x18150e(0x12b)]='');if(_0x10faf1['type']===_0x18150e(0x1c8)&&_0x10faf1[_0x18150e(0x107)])for(const _0x57bc55 of _0x10faf1[_0x18150e(0x107)]){_0x57bc55[_0x18150e(0x133)]&&isPendingSegmentId(_0x57bc55[_0x18150e(0x133)])&&(_0x57bc55[_0x18150e(0x133)]='');}_0x10faf1[_0x18150e(0xd6)]===_0x18150e(0x1af)&&stripWaitStepPendingIds(_0x10faf1);}}}function resolvePendingIdsInRequest(_0x4c94f9,_0x56438c,_0x2bf504,_0x273345,_0x2cf722,_0x26e37e){const _0x196549=a155_0x213229,_0xb6a941=(_0x3de90f,_0x36203c)=>{const _0x519f77=a155_0x27e5;if(!isPendingSegmentId(_0x3de90f))return _0x3de90f;const _0x9ef28e=extractPendingSegmentName(_0x3de90f),_0x257d5e=_0x273345[_0x519f77(0x187)](_0x9ef28e);return!_0x257d5e&&_0x26e37e[_0x519f77(0x16e)]?.(_0x519f77(0x119)+_0x9ef28e+_0x519f77(0xfc)+_0x36203c),_0x257d5e;};if(_0x4c94f9[_0x196549(0x1b6)][_0x196549(0x1c4)]?.['segmentId']&&isPendingSegmentId(_0x4c94f9['attributes'][_0x196549(0x1c4)][_0x196549(0x133)])){const _0x2e2bc2=_0xb6a941(_0x4c94f9[_0x196549(0x1b6)][_0x196549(0x1c4)][_0x196549(0x133)],_0x196549(0xf7));_0x2e2bc2&&(_0x4c94f9['attributes'][_0x196549(0x1c4)][_0x196549(0x133)]=_0x2e2bc2);}for(const _0x1b8fa9 of _0x4c94f9[_0x196549(0x1b6)][_0x196549(0x161)]||[]){const _0x861b70=_0x2bf504[_0x196549(0x187)](_0x1b8fa9['name'][_0x196549(0x15a)]());_0x861b70&&(_0x1b8fa9['id']=_0x861b70);if(_0x1b8fa9[_0x196549(0xe7)]?.[_0x196549(0x133)]&&isPendingSegmentId(_0x1b8fa9['entryCriteria'][_0x196549(0x133)])){const _0x39f949=_0xb6a941(_0x1b8fa9[_0x196549(0xe7)][_0x196549(0x133)],'stage\x20\x27'+_0x1b8fa9[_0x196549(0x108)]+_0x196549(0x1b9));_0x39f949&&(_0x1b8fa9['entryCriteria']['segmentId']=_0x39f949);}if(_0x1b8fa9[_0x196549(0x157)])for(const _0x5a5637 of _0x1b8fa9[_0x196549(0x157)]){if(_0x5a5637[_0x196549(0x133)]&&isPendingSegmentId(_0x5a5637[_0x196549(0x133)])){const _0x12df5c=_0xb6a941(_0x5a5637['segmentId'],_0x196549(0x16f)+_0x1b8fa9[_0x196549(0x108)]+_0x196549(0xe3));_0x12df5c&&(_0x5a5637[_0x196549(0x133)]=_0x12df5c);}}if(_0x1b8fa9[_0x196549(0x194)]?.[_0x196549(0x133)]&&isPendingSegmentId(_0x1b8fa9[_0x196549(0x194)]['segmentId'])){const _0x5ef28e=_0xb6a941(_0x1b8fa9[_0x196549(0x194)]['segmentId'],'stage\x20\x27'+_0x1b8fa9['name']+'\x27\x20milestone');_0x5ef28e&&(_0x1b8fa9[_0x196549(0x194)][_0x196549(0x133)]=_0x5ef28e);}if(_0x1b8fa9[_0x196549(0x14c)]){const _0x33d28e=_0x35759f=>_0x56438c[_0x196549(0x1b6)]['journeyStages']?.['find'](_0x5ef9a6=>_0x5ef9a6[_0x196549(0x108)][_0x196549(0x15a)]()===_0x1b8fa9['name'][_0x196549(0x15a)]())?.[_0x196549(0x14c)]?.[_0x35759f];for(const _0x2e70ae of Object[_0x196549(0x1c2)](_0x1b8fa9[_0x196549(0x14c)])){const _0x5119bf=_0x1b8fa9[_0x196549(0x14c)][_0x2e70ae],_0x397ed3=_0x33d28e(_0x2e70ae);if(_0x5119bf[_0x196549(0xd6)]===_0x196549(0x172)&&_0x5119bf[_0x196549(0x12b)]&&(isPendingActivationId(_0x5119bf[_0x196549(0x12b)])||_0x5119bf['journeyActivationStepId']==='')){if(_0x397ed3?.[_0x196549(0x12b)]&&isPendingActivationId(_0x397ed3[_0x196549(0x12b)])){const _0x50c6fd=extractPendingActivationName(_0x397ed3[_0x196549(0x12b)]),_0x3740ed=_0x2cf722[_0x196549(0x187)](_0x50c6fd);_0x3740ed&&(_0x5119bf['journeyActivationStepId']=_0x3740ed);}}if(_0x5119bf[_0x196549(0xd6)]===_0x196549(0x1c8)&&_0x5119bf[_0x196549(0x107)]&&_0x397ed3?.[_0x196549(0x107)])for(let _0x2ec549=0x0;_0x2ec549<_0x5119bf[_0x196549(0x107)][_0x196549(0x176)];_0x2ec549++){const _0x179abd=_0x5119bf[_0x196549(0x107)][_0x2ec549],_0x1c82e7=_0x397ed3[_0x196549(0x107)][_0x2ec549];if(_0x1c82e7?.[_0x196549(0x133)]&&isPendingSegmentId(_0x1c82e7['segmentId'])){const _0x1f6f22=_0xb6a941(_0x1c82e7[_0x196549(0x133)],_0x196549(0x16f)+_0x1b8fa9[_0x196549(0x108)]+_0x196549(0x14f)+(_0x179abd[_0x196549(0x108)]||_0x2ec549)+'\x27');_0x1f6f22&&(_0x179abd['segmentId']=_0x1f6f22);}}_0x5119bf[_0x196549(0xd6)]===_0x196549(0x1af)&&_0x397ed3?.[_0x196549(0xd6)]===_0x196549(0x1af)&&resolveWaitStepPendingIds(_0x5119bf,_0x397ed3,_0xb6a941,_0x1b8fa9['name']);}}}}
@@ -1 +1 @@
1
- (function(_0x53d2c9,_0x414495){const _0x25ca5e=a156_0x19b0,_0x2b6e68=_0x53d2c9();while(!![]){try{const _0x58d609=-parseInt(_0x25ca5e(0x157))/0x1*(-parseInt(_0x25ca5e(0x155))/0x2)+-parseInt(_0x25ca5e(0x153))/0x3+-parseInt(_0x25ca5e(0x15c))/0x4*(parseInt(_0x25ca5e(0x161))/0x5)+parseInt(_0x25ca5e(0x154))/0x6+-parseInt(_0x25ca5e(0x15a))/0x7+parseInt(_0x25ca5e(0x162))/0x8*(parseInt(_0x25ca5e(0x160))/0x9)+parseInt(_0x25ca5e(0x15b))/0xa*(-parseInt(_0x25ca5e(0x156))/0xb);if(_0x58d609===_0x414495)break;else _0x2b6e68['push'](_0x2b6e68['shift']());}catch(_0x4ab995){_0x2b6e68['push'](_0x2b6e68['shift']());}}}(a156_0x18aa,0x59185));function a156_0x19b0(_0x78a96b,_0x372213){_0x78a96b=_0x78a96b-0x153;const _0x18aae4=a156_0x18aa();let _0x19b082=_0x18aae4[_0x78a96b];return _0x19b082;}export function buildFolderIdToPathMap(_0x4a8399){const _0x3e9675=a156_0x19b0,_0x45890b=new Map(),_0x17d151=new Map();for(const _0x25f81b of _0x4a8399){_0x17d151['set'](_0x25f81b['id'],_0x25f81b);}const _0x4fa980=new Set();for(const _0x3d4c9d of _0x4a8399){!_0x3d4c9d[_0x3e9675(0x163)]&&_0x4fa980[_0x3e9675(0x15d)](_0x3d4c9d['id']);}function _0x3470fb(_0x3898f6){const _0x3c92c7=_0x3e9675;if(_0x45890b[_0x3c92c7(0x158)](_0x3898f6['id']))return _0x45890b['get'](_0x3898f6['id']);if(_0x4fa980[_0x3c92c7(0x158)](_0x3898f6['id']))return _0x45890b['set'](_0x3898f6['id'],''),'';if(_0x3898f6[_0x3c92c7(0x163)]){const _0x802b78=_0x17d151[_0x3c92c7(0x159)](_0x3898f6[_0x3c92c7(0x163)]);if(_0x802b78){const _0x8ab598=_0x3470fb(_0x802b78),_0x12165a=_0x8ab598?_0x8ab598+'/'+_0x3898f6[_0x3c92c7(0x15f)]:_0x3898f6[_0x3c92c7(0x15f)];return _0x45890b['set'](_0x3898f6['id'],_0x12165a),_0x12165a;}}const _0x32b245=_0x3898f6[_0x3c92c7(0x15f)];return _0x45890b[_0x3c92c7(0x15e)](_0x3898f6['id'],_0x32b245),_0x32b245;}for(const _0x1aa806 of _0x4a8399){_0x3470fb(_0x1aa806);}return _0x45890b;}export function buildFolderPathToIdMap(_0x5f4d52){const _0x281d16=new Map(),_0x15fbe5=new Map();for(const _0x5a331b of _0x5f4d52){_0x15fbe5['set'](_0x5a331b['id'],_0x5a331b);}const _0xa3d14c=new Set();for(const _0x29dd01 of _0x5f4d52){!_0x29dd01['parentFolderId']&&_0xa3d14c['add'](_0x29dd01['id']);}function _0x169731(_0x187c76){const _0x658b6c=a156_0x19b0;if(_0xa3d14c[_0x658b6c(0x158)](_0x187c76['id']))return'';if(_0x187c76['parentFolderId']){const _0x388f4=_0x15fbe5[_0x658b6c(0x159)](_0x187c76[_0x658b6c(0x163)]);if(_0x388f4){const _0x344ebd=_0x169731(_0x388f4);return _0x344ebd?_0x344ebd+'/'+_0x187c76[_0x658b6c(0x15f)]:_0x187c76['name'];}}return _0x187c76['name'];}for(const _0x594021 of _0x5f4d52){const _0x10c67e=_0x169731(_0x594021);_0x281d16['set'](_0x10c67e,_0x594021['id']);}return _0x281d16;}function a156_0x18aa(){const _0x4f032f=['11Kmgpxz','85197roTjaq','has','get','756196ampeiq','886910dbgYDG','76088nUnNxP','add','set','name','9Gfpkur','110AvZcun','30056tSVeMi','parentFolderId','406776lAIOhx','3604734WVtVqK','12RxvOqd'];a156_0x18aa=function(){return _0x4f032f;};return a156_0x18aa();}export function buildFolderMaps(_0x3d87e3){const _0x1c3d66=buildFolderIdToPathMap(_0x3d87e3),_0xddb8e6=new Map();for(const [_0x257f2b,_0x273000]of _0x1c3d66){_0xddb8e6['set'](_0x273000,_0x257f2b);}return{'idToPath':_0x1c3d66,'pathToId':_0xddb8e6};}export function getFolderPath(_0xd00f0a,_0x3404d9){const _0x3169cb=a156_0x19b0;if(!_0xd00f0a)return'';return _0x3404d9[_0x3169cb(0x159)](_0xd00f0a)??'';}
1
+ function a156_0x464e(_0x2f7d89,_0x5e00d5){_0x2f7d89=_0x2f7d89-0x1f2;const _0x11186f=a156_0x1118();let _0x464ed2=_0x11186f[_0x2f7d89];return _0x464ed2;}(function(_0x562c50,_0x5d3b22){const _0x1a091e=a156_0x464e,_0x1eddc5=_0x562c50();while(!![]){try{const _0x5ba0e7=-parseInt(_0x1a091e(0x1fb))/0x1+-parseInt(_0x1a091e(0x1f9))/0x2+-parseInt(_0x1a091e(0x200))/0x3*(parseInt(_0x1a091e(0x1ff))/0x4)+-parseInt(_0x1a091e(0x201))/0x5*(parseInt(_0x1a091e(0x1f3))/0x6)+-parseInt(_0x1a091e(0x1f5))/0x7*(parseInt(_0x1a091e(0x1f2))/0x8)+-parseInt(_0x1a091e(0x1fc))/0x9+parseInt(_0x1a091e(0x1fd))/0xa;if(_0x5ba0e7===_0x5d3b22)break;else _0x1eddc5['push'](_0x1eddc5['shift']());}catch(_0x241ce9){_0x1eddc5['push'](_0x1eddc5['shift']());}}}(a156_0x1118,0x87777));export function buildFolderIdToPathMap(_0x4cc826){const _0x133384=a156_0x464e,_0x4297fb=new Map(),_0x369bb6=new Map();for(const _0x263d8b of _0x4cc826){_0x369bb6[_0x133384(0x1f7)](_0x263d8b['id'],_0x263d8b);}const _0x5c1e33=new Set();for(const _0x39d0fa of _0x4cc826){!_0x39d0fa[_0x133384(0x1f4)]&&_0x5c1e33[_0x133384(0x1fa)](_0x39d0fa['id']);}function _0x1bd04d(_0xbf7f9a){const _0x3ea8d5=_0x133384;if(_0x4297fb[_0x3ea8d5(0x1f8)](_0xbf7f9a['id']))return _0x4297fb['get'](_0xbf7f9a['id']);if(_0x5c1e33[_0x3ea8d5(0x1f8)](_0xbf7f9a['id']))return _0x4297fb[_0x3ea8d5(0x1f7)](_0xbf7f9a['id'],''),'';if(_0xbf7f9a['parentFolderId']){const _0x3a083e=_0x369bb6[_0x3ea8d5(0x1f6)](_0xbf7f9a[_0x3ea8d5(0x1f4)]);if(_0x3a083e){const _0xbc2504=_0x1bd04d(_0x3a083e),_0x479bba=_0xbc2504?_0xbc2504+'/'+_0xbf7f9a['name']:_0xbf7f9a[_0x3ea8d5(0x1fe)];return _0x4297fb[_0x3ea8d5(0x1f7)](_0xbf7f9a['id'],_0x479bba),_0x479bba;}}const _0x3799fb=_0xbf7f9a[_0x3ea8d5(0x1fe)];return _0x4297fb[_0x3ea8d5(0x1f7)](_0xbf7f9a['id'],_0x3799fb),_0x3799fb;}for(const _0x1ecafc of _0x4cc826){_0x1bd04d(_0x1ecafc);}return _0x4297fb;}export function buildFolderPathToIdMap(_0x292e4e){const _0x151510=a156_0x464e,_0x4e3075=new Map(),_0x4f9524=new Map();for(const _0x1d9974 of _0x292e4e){_0x4f9524[_0x151510(0x1f7)](_0x1d9974['id'],_0x1d9974);}const _0x4fbc21=new Set();for(const _0x36470f of _0x292e4e){!_0x36470f[_0x151510(0x1f4)]&&_0x4fbc21[_0x151510(0x1fa)](_0x36470f['id']);}function _0xe56f(_0x4aed2f){const _0x3a0841=_0x151510;if(_0x4fbc21['has'](_0x4aed2f['id']))return'';if(_0x4aed2f['parentFolderId']){const _0x408f78=_0x4f9524['get'](_0x4aed2f['parentFolderId']);if(_0x408f78){const _0x7cdf94=_0xe56f(_0x408f78);return _0x7cdf94?_0x7cdf94+'/'+_0x4aed2f[_0x3a0841(0x1fe)]:_0x4aed2f[_0x3a0841(0x1fe)];}}return _0x4aed2f[_0x3a0841(0x1fe)];}for(const _0x39d579 of _0x292e4e){const _0x57785e=_0xe56f(_0x39d579);_0x4e3075[_0x151510(0x1f7)](_0x57785e,_0x39d579['id']);}return _0x4e3075;}function a156_0x1118(){const _0x56dc74=['40137710uZzOvH','name','2655020OUXwCP','3pUKgKo','40IJAriP','1512328ykIXfF','583206FPqPMO','parentFolderId','35KTqIMH','get','set','has','1176122bIBLhx','add','259338Rgqwdl','2024397CUIYxz'];a156_0x1118=function(){return _0x56dc74;};return a156_0x1118();}export function buildFolderMaps(_0x299558){const _0x624567=buildFolderIdToPathMap(_0x299558),_0x1e6a88=new Map();for(const [_0x5945fd,_0x366078]of _0x624567){_0x1e6a88['set'](_0x366078,_0x5945fd);}return{'idToPath':_0x624567,'pathToId':_0x1e6a88};}export function getFolderPath(_0x9288b1,_0x316fc3){const _0x8db2e8=a156_0x464e;if(!_0x9288b1)return'';return _0x316fc3[_0x8db2e8(0x1f6)](_0x9288b1)??'';}
@@ -1 +1 @@
1
- (function(_0x5e4bf3,_0x6fe988){const _0x5f2052=a157_0x406a,_0x519b39=_0x5e4bf3();while(!![]){try{const _0x1f6e37=-parseInt(_0x5f2052(0xc3))/0x1*(parseInt(_0x5f2052(0xc4))/0x2)+parseInt(_0x5f2052(0xd4))/0x3*(-parseInt(_0x5f2052(0xc6))/0x4)+-parseInt(_0x5f2052(0xbf))/0x5+-parseInt(_0x5f2052(0xe0))/0x6*(parseInt(_0x5f2052(0xd9))/0x7)+-parseInt(_0x5f2052(0xdb))/0x8*(-parseInt(_0x5f2052(0xb8))/0x9)+-parseInt(_0x5f2052(0xbc))/0xa+-parseInt(_0x5f2052(0xcd))/0xb*(-parseInt(_0x5f2052(0xe3))/0xc);if(_0x1f6e37===_0x6fe988)break;else _0x519b39['push'](_0x519b39['shift']());}catch(_0x347188){_0x519b39['push'](_0x519b39['shift']());}}}(a157_0x26ee,0x2313e));import a157_0x30ee73 from'path';import{parse as a157_0x3af7ad}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0xd7141){const _0x447669=a157_0x406a;if(!_0xd7141||_0xd7141['trim']()==='')throw new Error(_0x447669(0xe2));const _0x41455a=_0xd7141['trim']();if(_0x41455a==='/')return{'segments':[],'isAbsolute':!![],'raw':_0xd7141};const _0x308554=_0x41455a['startsWith']('/')?_0x41455a[_0x447669(0xb6)](0x1):_0x41455a,_0x444276=_0x308554[_0x447669(0xce)]('/')[_0x447669(0xd8)](_0x5d0968=>_0x5d0968!=='');if(_0x444276[_0x447669(0xb7)]===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x2ddea9=_0x41455a[_0x447669(0xc2)]('/')||!isRelativePathSegment(_0x444276[0x0]);for(const _0x7e277b of _0x444276){validatePathSegment(_0x7e277b);}return{'segments':_0x444276,'isAbsolute':_0x2ddea9,'raw':_0xd7141};}function isRelativePathSegment(_0x2ea7d0){return _0x2ea7d0==='.'||_0x2ea7d0==='..';}function a157_0x406a(_0x13f845,_0x3c0b42){_0x13f845=_0x13f845-0xb6;const _0x26ee30=a157_0x26ee();let _0x406af5=_0x26ee30[_0x13f845];return _0x406af5;}function validatePathSegment(_0xc743f4){const _0x92270b=a157_0x406a;if(_0xc743f4==='')throw new Error(_0x92270b(0xdc));if(_0xc743f4==='.'||_0xc743f4==='..')return;if(/[\x00-\x1F\x7F]/[_0x92270b(0xe4)](_0xc743f4))throw new Error('Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20'+_0xc743f4);if(_0xc743f4!==_0xc743f4[_0x92270b(0xde)]()){}}function a157_0x26ee(){const _0x37e445=['push','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','dirname','11NkKvxZ','split','Cannot\x20navigate\x20above\x20root','journey','No\x20tdx.json\x20found\x20for\x20file:\x20','exists','Relative\x20path\x20cannot\x20be\x20empty','95673UFolxZ','Path\x20attempts\x20to\x20navigate\x20above\x20root','endsWith','pop','filter','1593389VEVbTa','segments','3496ApufBo','Path\x20segment\x20cannot\x20be\x20empty','isAbsolute','trim','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','6mIywWa','Cannot\x20split\x20empty\x20path','Path\x20cannot\x20be\x20empty','12998700DyDnoO','test','substring','length','2799MMLxcB','slice','readFile','type','1858330lcYmOu','name','parse','951695pMBiKV','File\x20not\x20found:\x20','join','startsWith','74GnYVYk','6714uRiYZQ','segment','28xzMekP','raw','parent_segment'];a157_0x26ee=function(){return _0x37e445;};return a157_0x26ee();}export function validatePath(_0x35638e){const _0xf8fb44=a157_0x406a;if(_0x35638e[_0xf8fb44(0xda)]['length']===0x0&&!_0x35638e['isAbsolute'])throw new Error(_0xf8fb44(0xd3));if(_0x35638e[_0xf8fb44(0xdd)]){if(_0x35638e[_0xf8fb44(0xda)][0x0]==='..')throw new Error(_0xf8fb44(0xcb));let _0xf14de=0x0;for(const _0x36f4ac of _0x35638e[_0xf8fb44(0xda)]){if(_0x36f4ac==='..'){if(_0xf14de===0x0)throw new Error(_0xf8fb44(0xd5));_0xf14de--;}else _0x36f4ac!=='.'&&_0xf14de++;}}}export function joinPaths(_0x1938c9,_0x47c8ad){const _0x4dea84=a157_0x406a;if(!_0x1938c9||_0x1938c9==='/')return _0x47c8ad;if(!_0x47c8ad||_0x47c8ad==='.')return _0x1938c9;if(_0x47c8ad[_0x4dea84(0xc2)]('/'))return _0x47c8ad;const _0x6b74bb=parsePath(_0x1938c9),_0x56b896=parsePath(_0x47c8ad),_0x425e97=[..._0x6b74bb[_0x4dea84(0xda)]];for(const _0xad6650 of _0x56b896[_0x4dea84(0xda)]){if(_0xad6650==='.')continue;else{if(_0xad6650==='..'){if(_0x425e97[_0x4dea84(0xb7)]===0x0)throw new Error(_0x4dea84(0xcf));_0x425e97[_0x4dea84(0xd7)]();}else _0x425e97[_0x4dea84(0xc9)](_0xad6650);}}const _0x46c8c8=_0x425e97['join']('/');return _0x6b74bb['raw'][_0x4dea84(0xc2)]('/')?'/'+_0x46c8c8:_0x46c8c8;}export function normalizePath(_0x2f675b){const _0x2f4a7d=a157_0x406a,_0x5e59ad=parsePath(_0x2f675b),_0x5ebb8e=[];for(const _0x125975 of _0x5e59ad[_0x2f4a7d(0xda)]){if(_0x125975==='.')continue;else{if(_0x125975==='..'){if(_0x5ebb8e['length']===0x0){if(_0x5e59ad[_0x2f4a7d(0xdd)])throw new Error('Cannot\x20navigate\x20above\x20root');_0x5ebb8e[_0x2f4a7d(0xc9)]('..');}else _0x5ebb8e[_0x5ebb8e[_0x2f4a7d(0xb7)]-0x1]==='..'?_0x5ebb8e[_0x2f4a7d(0xc9)]('..'):_0x5ebb8e[_0x2f4a7d(0xd7)]();}else _0x5ebb8e[_0x2f4a7d(0xc9)](_0x125975);}}if(_0x5ebb8e[_0x2f4a7d(0xb7)]===0x0)return _0x5e59ad[_0x2f4a7d(0xdd)]?'/':'.';const _0x5f522a=_0x5ebb8e['join']('/');return _0x5e59ad[_0x2f4a7d(0xc7)][_0x2f4a7d(0xc2)]('/')?'/'+_0x5f522a:_0x5f522a;}export function getParentPath(_0x2a7d60){const _0x13c963=a157_0x406a,_0x56a6ad=parsePath(_0x2a7d60);if(_0x56a6ad['segments']['length']<=0x1)return'/';const _0x43a173=_0x56a6ad[_0x13c963(0xda)][_0x13c963(0xb9)](0x0,-0x1)[_0x13c963(0xc1)]('/');return _0x56a6ad[_0x13c963(0xc7)][_0x13c963(0xc2)]('/')?'/'+_0x43a173:_0x43a173;}export function getBaseName(_0x9d5261){const _0x53b35a=parsePath(_0x9d5261);return _0x53b35a['segments'][_0x53b35a['segments']['length']-0x1]||'';}export function isChildPath(_0x4fad7c,_0x1f82aa){const _0x5a6401=a157_0x406a,_0x2a26cf=parsePath(_0x4fad7c),_0x2a6560=parsePath(_0x1f82aa);if(_0x2a26cf[_0x5a6401(0xda)][_0x5a6401(0xb7)]<=_0x2a6560[_0x5a6401(0xda)][_0x5a6401(0xb7)])return![];for(let _0x4294e1=0x0;_0x4294e1<_0x2a6560['segments'][_0x5a6401(0xb7)];_0x4294e1++){if(_0x2a26cf[_0x5a6401(0xda)][_0x4294e1]!==_0x2a6560[_0x5a6401(0xda)][_0x4294e1])return![];}return!![];}export function splitPath(_0x5d4e15){const _0x4dc3da=a157_0x406a,_0xaee695=parsePath(_0x5d4e15);if(_0xaee695['segments'][_0x4dc3da(0xb7)]===0x0)throw new Error(_0x4dc3da(0xe1));if(_0xaee695[_0x4dc3da(0xda)]['length']===0x1)return{'parent':_0xaee695[_0x4dc3da(0xda)][0x0]};return{'parent':_0xaee695['segments'][0x0],'child':_0xaee695[_0x4dc3da(0xda)][_0x4dc3da(0xb9)](0x1)[_0x4dc3da(0xc1)]('/')};}export function isYamlFilePath(_0x1ac225){const _0x5189ad=a157_0x406a;return _0x1ac225[_0x5189ad(0xd6)]('.yml')||_0x1ac225[_0x5189ad(0xd6)]('.yaml');}export async function resolveYamlFilePath(_0x4d0a6b,_0x244de4=nodeFileSystem){const _0x5f9959=a157_0x406a,_0x1e08d0=a157_0x30ee73['resolve'](_0x4d0a6b);if(!await _0x244de4['exists'](_0x1e08d0))throw new Error(_0x5f9959(0xc0)+_0x4d0a6b);let _0xd7da41=a157_0x30ee73['dirname'](_0x1e08d0),_0x516878=null,_0xff3802=null;const _0x259ea2=a157_0x30ee73['parse'](_0xd7da41)['root'];while(_0xd7da41!==_0x259ea2){const _0x36b47f=a157_0x30ee73['join'](_0xd7da41,'tdx.json');if(await _0x244de4[_0x5f9959(0xd2)](_0x36b47f)){_0x516878=_0x36b47f,_0xff3802=_0xd7da41;break;}_0xd7da41=a157_0x30ee73[_0x5f9959(0xcc)](_0xd7da41);}if(!_0x516878||!_0xff3802)throw new Error(_0x5f9959(0xd1)+_0x4d0a6b+'\x0a'+_0x5f9959(0xca));const _0x3784e8=await _0x244de4['readFile'](_0x516878),_0x2b4d36=JSON[_0x5f9959(0xbe)](_0x3784e8),_0x2000f0=_0x2b4d36[_0x5f9959(0xc8)];if(!_0x2000f0)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x46b996=await _0x244de4[_0x5f9959(0xba)](_0x1e08d0),_0x3ea53c=a157_0x3af7ad(_0x46b996),_0x13e0f9=_0x3ea53c[_0x5f9959(0xbd)];if(!_0x13e0f9)throw new Error(_0x5f9959(0xdf)+_0x4d0a6b);const _0x2035c0=_0x3ea53c[_0x5f9959(0xbb)]==='journey'?_0x5f9959(0xd0):_0x5f9959(0xc5),_0xa86559=a157_0x30ee73['relative'](_0xff3802,_0x1e08d0),_0x20e525=a157_0x30ee73[_0x5f9959(0xcc)](_0xa86559),_0xaea2b7=_0x20e525==='.'?'':_0x20e525['replace'](/\\/g,'/'),_0x4ecebb=_0xaea2b7?_0x2000f0+'/'+_0xaea2b7+'/'+_0x13e0f9:_0x2000f0+'/'+_0x13e0f9;return{'parentSegment':_0x2000f0,'segmentName':_0x13e0f9,'folderPath':_0xaea2b7,'fullPath':_0x4ecebb,'resourceType':_0x2035c0,'content':_0x46b996};}
1
+ (function(_0x8adc4a,_0xda913f){const _0x214762=a157_0xbd72,_0x52be67=_0x8adc4a();while(!![]){try{const _0xe194e3=parseInt(_0x214762(0xdd))/0x1+parseInt(_0x214762(0xe0))/0x2*(parseInt(_0x214762(0xdf))/0x3)+parseInt(_0x214762(0xc7))/0x4+parseInt(_0x214762(0xcc))/0x5*(parseInt(_0x214762(0xc1))/0x6)+parseInt(_0x214762(0xc3))/0x7*(-parseInt(_0x214762(0xde))/0x8)+-parseInt(_0x214762(0xeb))/0x9*(parseInt(_0x214762(0xf1))/0xa)+parseInt(_0x214762(0xda))/0xb*(parseInt(_0x214762(0xd7))/0xc);if(_0xe194e3===_0xda913f)break;else _0x52be67['push'](_0x52be67['shift']());}catch(_0x13907c){_0x52be67['push'](_0x52be67['shift']());}}}(a157_0x2578,0xc2c93));import a157_0x21e016 from'path';import{parse as a157_0x121487}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x34aede){const _0xd595af=a157_0xbd72;if(!_0x34aede||_0x34aede[_0xd595af(0xe3)]()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0x395af8=_0x34aede[_0xd595af(0xe3)]();if(_0x395af8==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x34aede};const _0x2129fe=_0x395af8[_0xd595af(0xe5)]('/')?_0x395af8[_0xd595af(0xc2)](0x1):_0x395af8,_0x225e28=_0x2129fe[_0xd595af(0xc0)]('/')[_0xd595af(0xe8)](_0x53d4cd=>_0x53d4cd!=='');if(_0x225e28[_0xd595af(0xd1)]===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x2e1cbf=_0x395af8[_0xd595af(0xe5)]('/')||!isRelativePathSegment(_0x225e28[0x0]);for(const _0x27eecc of _0x225e28){validatePathSegment(_0x27eecc);}return{'segments':_0x225e28,'isAbsolute':_0x2e1cbf,'raw':_0x34aede};}function isRelativePathSegment(_0x3a3db5){return _0x3a3db5==='.'||_0x3a3db5==='..';}function a157_0x2578(){const _0x338b8d=['10874830OkkpRF','segments','split','330258ljXSDH','substring','335573CMCWFV','root','name','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','5624504qLAXav','journey','isAbsolute','Cannot\x20split\x20empty\x20path','Path\x20attempts\x20to\x20navigate\x20above\x20root','45JwWYhF','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','raw','pop','segment','length','replace','parse','.yml','test','.yaml','10772628GpySpL','resolve','Path\x20segment\x20cannot\x20be\x20empty','11rxDXOi','push','endsWith','179370HGfbEK','240XXUjoc','1542iKCtxI','1342aWhSNA','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','dirname','trim','Cannot\x20navigate\x20above\x20root','startsWith','slice','join','filter','type','Relative\x20path\x20cannot\x20be\x20empty','9JFAzqF','exists','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','tdx.json','readFile'];a157_0x2578=function(){return _0x338b8d;};return a157_0x2578();}function validatePathSegment(_0x61a2d2){const _0x4f19da=a157_0xbd72;if(_0x61a2d2==='')throw new Error(_0x4f19da(0xd9));if(_0x61a2d2==='.'||_0x61a2d2==='..')return;if(/[\x00-\x1F\x7F]/[_0x4f19da(0xd5)](_0x61a2d2))throw new Error(_0x4f19da(0xed)+_0x61a2d2);if(_0x61a2d2!==_0x61a2d2[_0x4f19da(0xe3)]()){}}export function validatePath(_0x23a4ca){const _0x15c599=a157_0xbd72;if(_0x23a4ca[_0x15c599(0xbf)][_0x15c599(0xd1)]===0x0&&!_0x23a4ca['isAbsolute'])throw new Error(_0x15c599(0xea));if(_0x23a4ca[_0x15c599(0xc9)]){if(_0x23a4ca[_0x15c599(0xbf)][0x0]==='..')throw new Error(_0x15c599(0xc6));let _0x5f01f7=0x0;for(const _0xe2527 of _0x23a4ca[_0x15c599(0xbf)]){if(_0xe2527==='..'){if(_0x5f01f7===0x0)throw new Error(_0x15c599(0xcb));_0x5f01f7--;}else _0xe2527!=='.'&&_0x5f01f7++;}}}export function joinPaths(_0x416483,_0x3473f0){const _0x4280b4=a157_0xbd72;if(!_0x416483||_0x416483==='/')return _0x3473f0;if(!_0x3473f0||_0x3473f0==='.')return _0x416483;if(_0x3473f0['startsWith']('/'))return _0x3473f0;const _0x2a978e=parsePath(_0x416483),_0x217f3e=parsePath(_0x3473f0),_0x39a13b=[..._0x2a978e[_0x4280b4(0xbf)]];for(const _0xc1b908 of _0x217f3e[_0x4280b4(0xbf)]){if(_0xc1b908==='.')continue;else{if(_0xc1b908==='..'){if(_0x39a13b[_0x4280b4(0xd1)]===0x0)throw new Error(_0x4280b4(0xe4));_0x39a13b['pop']();}else _0x39a13b[_0x4280b4(0xdb)](_0xc1b908);}}const _0x7c7f89=_0x39a13b[_0x4280b4(0xe7)]('/');return _0x2a978e[_0x4280b4(0xce)]['startsWith']('/')?'/'+_0x7c7f89:_0x7c7f89;}export function normalizePath(_0x13cb10){const _0x241db6=a157_0xbd72,_0x4a10fb=parsePath(_0x13cb10),_0x278daf=[];for(const _0x46ba59 of _0x4a10fb[_0x241db6(0xbf)]){if(_0x46ba59==='.')continue;else{if(_0x46ba59==='..'){if(_0x278daf[_0x241db6(0xd1)]===0x0){if(_0x4a10fb['isAbsolute'])throw new Error(_0x241db6(0xe4));_0x278daf[_0x241db6(0xdb)]('..');}else _0x278daf[_0x278daf['length']-0x1]==='..'?_0x278daf[_0x241db6(0xdb)]('..'):_0x278daf[_0x241db6(0xcf)]();}else _0x278daf[_0x241db6(0xdb)](_0x46ba59);}}if(_0x278daf['length']===0x0)return _0x4a10fb['isAbsolute']?'/':'.';const _0x2cc1dc=_0x278daf[_0x241db6(0xe7)]('/');return _0x4a10fb[_0x241db6(0xce)][_0x241db6(0xe5)]('/')?'/'+_0x2cc1dc:_0x2cc1dc;}export function getParentPath(_0x1ad0be){const _0x4e6fcd=a157_0xbd72,_0x2be7fa=parsePath(_0x1ad0be);if(_0x2be7fa['segments'][_0x4e6fcd(0xd1)]<=0x1)return'/';const _0x5c12cd=_0x2be7fa[_0x4e6fcd(0xbf)][_0x4e6fcd(0xe6)](0x0,-0x1)[_0x4e6fcd(0xe7)]('/');return _0x2be7fa[_0x4e6fcd(0xce)][_0x4e6fcd(0xe5)]('/')?'/'+_0x5c12cd:_0x5c12cd;}export function getBaseName(_0x516986){const _0xa47d1=a157_0xbd72,_0x2a43da=parsePath(_0x516986);return _0x2a43da[_0xa47d1(0xbf)][_0x2a43da[_0xa47d1(0xbf)][_0xa47d1(0xd1)]-0x1]||'';}function a157_0xbd72(_0x57c112,_0x10fd2b){_0x57c112=_0x57c112-0xbf;const _0x257831=a157_0x2578();let _0xbd7252=_0x257831[_0x57c112];return _0xbd7252;}export function isChildPath(_0x58c981,_0x1391de){const _0x136ccf=a157_0xbd72,_0x227422=parsePath(_0x58c981),_0xf1000e=parsePath(_0x1391de);if(_0x227422[_0x136ccf(0xbf)][_0x136ccf(0xd1)]<=_0xf1000e[_0x136ccf(0xbf)][_0x136ccf(0xd1)])return![];for(let _0x3aabe5=0x0;_0x3aabe5<_0xf1000e[_0x136ccf(0xbf)]['length'];_0x3aabe5++){if(_0x227422[_0x136ccf(0xbf)][_0x3aabe5]!==_0xf1000e[_0x136ccf(0xbf)][_0x3aabe5])return![];}return!![];}export function splitPath(_0x4f79c5){const _0x59735c=a157_0xbd72,_0x435499=parsePath(_0x4f79c5);if(_0x435499[_0x59735c(0xbf)]['length']===0x0)throw new Error(_0x59735c(0xca));if(_0x435499[_0x59735c(0xbf)][_0x59735c(0xd1)]===0x1)return{'parent':_0x435499[_0x59735c(0xbf)][0x0]};return{'parent':_0x435499[_0x59735c(0xbf)][0x0],'child':_0x435499['segments'][_0x59735c(0xe6)](0x1)[_0x59735c(0xe7)]('/')};}export function isYamlFilePath(_0x34a7f1){const _0x50d19f=a157_0xbd72;return _0x34a7f1[_0x50d19f(0xdc)](_0x50d19f(0xd4))||_0x34a7f1[_0x50d19f(0xdc)](_0x50d19f(0xd6));}export async function resolveYamlFilePath(_0x18355d,_0x25e8d9=nodeFileSystem){const _0x204266=a157_0xbd72,_0xfa7e66=a157_0x21e016[_0x204266(0xd8)](_0x18355d);if(!await _0x25e8d9[_0x204266(0xec)](_0xfa7e66))throw new Error('File\x20not\x20found:\x20'+_0x18355d);let _0x147fae=a157_0x21e016[_0x204266(0xe2)](_0xfa7e66),_0x523713=null,_0xee4eb1=null;const _0x21befe=a157_0x21e016[_0x204266(0xd3)](_0x147fae)[_0x204266(0xc4)];while(_0x147fae!==_0x21befe){const _0x192b8e=a157_0x21e016[_0x204266(0xe7)](_0x147fae,_0x204266(0xef));if(await _0x25e8d9[_0x204266(0xec)](_0x192b8e)){_0x523713=_0x192b8e,_0xee4eb1=_0x147fae;break;}_0x147fae=a157_0x21e016[_0x204266(0xe2)](_0x147fae);}if(!_0x523713||!_0xee4eb1)throw new Error('No\x20tdx.json\x20found\x20for\x20file:\x20'+_0x18355d+'\x0a'+_0x204266(0xcd));const _0x58a263=await _0x25e8d9[_0x204266(0xf0)](_0x523713),_0x22ff08=JSON[_0x204266(0xd3)](_0x58a263),_0x37111e=_0x22ff08['parent_segment'];if(!_0x37111e)throw new Error(_0x204266(0xee));const _0xb0bc8e=await _0x25e8d9[_0x204266(0xf0)](_0xfa7e66),_0x5db8e3=a157_0x121487(_0xb0bc8e),_0x19cf06=_0x5db8e3[_0x204266(0xc5)];if(!_0x19cf06)throw new Error(_0x204266(0xe1)+_0x18355d);const _0x5e8bdf=_0x5db8e3[_0x204266(0xe9)]===_0x204266(0xc8)?_0x204266(0xc8):_0x204266(0xd0),_0x1fbc5f=a157_0x21e016['relative'](_0xee4eb1,_0xfa7e66),_0x4f903c=a157_0x21e016[_0x204266(0xe2)](_0x1fbc5f),_0x5a25be=_0x4f903c==='.'?'':_0x4f903c[_0x204266(0xd2)](/\\/g,'/'),_0x4b7b3c=_0x5a25be?_0x37111e+'/'+_0x5a25be+'/'+_0x19cf06:_0x37111e+'/'+_0x19cf06;return{'parentSegment':_0x37111e,'segmentName':_0x19cf06,'folderPath':_0x5a25be,'fullPath':_0x4b7b3c,'resourceType':_0x5e8bdf,'content':_0xb0bc8e};}
@@ -1 +1 @@
1
- function a158_0x2cd0(_0x552412,_0x5bbac9){_0x552412=_0x552412-0xb0;const _0x5bc820=a158_0x5bc8();let _0x2cd021=_0x5bc820[_0x552412];return _0x2cd021;}(function(_0x4505a3,_0x40fc99){const _0x23aa50=a158_0x2cd0,_0xc7856=_0x4505a3();while(!![]){try{const _0x51260b=parseInt(_0x23aa50(0xb3))/0x1*(-parseInt(_0x23aa50(0xb4))/0x2)+-parseInt(_0x23aa50(0xb8))/0x3*(parseInt(_0x23aa50(0xbd))/0x4)+parseInt(_0x23aa50(0xb2))/0x5+parseInt(_0x23aa50(0xbe))/0x6*(parseInt(_0x23aa50(0xb1))/0x7)+parseInt(_0x23aa50(0xb5))/0x8+-parseInt(_0x23aa50(0xb7))/0x9*(parseInt(_0x23aa50(0xb9))/0xa)+parseInt(_0x23aa50(0xb6))/0xb*(parseInt(_0x23aa50(0xba))/0xc);if(_0x51260b===_0x40fc99)break;else _0xc7856['push'](_0xc7856['shift']());}catch(_0x1abc9c){_0xc7856['push'](_0xc7856['shift']());}}}(a158_0x5bc8,0x4d161));function a158_0x5bc8(){const _0x20965e=['11nfAZlO','171tknAaR','387PXPkZK','293320TEBdOk','4616736uJhfAK','.\x20Child\x20name\x20cannot\x20be\x20empty','Invalid\x20segment\x20reference\x20format:\x20','9584nqLgNR','1225320VNOaLy','substring','7gEAisC','1995935KBiYjL','25076WquRAJ','28UMSESq','4360528PQrqxc'];a158_0x5bc8=function(){return _0x20965e;};return a158_0x5bc8();}export function parseSegmentRef(_0xe6ba00){const _0x409bf9=a158_0x2cd0,_0x251336=_0xe6ba00['indexOf']('/');if(_0x251336===-0x1)return{'parentId':_0xe6ba00};if(_0x251336===0x0)throw new Error(_0x409bf9(0xbc)+_0xe6ba00+'.\x20Parent\x20name\x20cannot\x20be\x20empty');const _0x501e02=_0xe6ba00[_0x409bf9(0xb0)](0x0,_0x251336),_0x340375=_0xe6ba00[_0x409bf9(0xb0)](_0x251336+0x1);if(_0x340375==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0xe6ba00+_0x409bf9(0xbb));return{'parentId':_0x501e02,'childId':_0x340375};}
1
+ function a158_0x1b20(_0x19184f,_0x12ff16){_0x19184f=_0x19184f-0x14f;const _0x4a7675=a158_0x4a76();let _0x1b2077=_0x4a7675[_0x19184f];return _0x1b2077;}function a158_0x4a76(){const _0x4e9a61=['1261112EGrhgy','55OcphEi','16872nWMYZj','Invalid\x20segment\x20reference\x20format:\x20','.\x20Child\x20name\x20cannot\x20be\x20empty','substring','4NiWynk','602TZzyJZ','1714520DdrQLM','indexOf','19548rigRcd','623570gcthqH','555Ekbpiz','4006OLzult','24840OVbQfs'];a158_0x4a76=function(){return _0x4e9a61;};return a158_0x4a76();}(function(_0x334762,_0x3c4092){const _0x3d0230=a158_0x1b20,_0x181508=_0x334762();while(!![]){try{const _0x24ceb3=-parseInt(_0x3d0230(0x154))/0x1+parseInt(_0x3d0230(0x150))/0x2*(-parseInt(_0x3d0230(0x14f))/0x3)+-parseInt(_0x3d0230(0x158))/0x4*(-parseInt(_0x3d0230(0x15a))/0x5)+parseInt(_0x3d0230(0x15c))/0x6*(parseInt(_0x3d0230(0x159))/0x7)+-parseInt(_0x3d0230(0x152))/0x8+-parseInt(_0x3d0230(0x151))/0x9+parseInt(_0x3d0230(0x15d))/0xa*(parseInt(_0x3d0230(0x153))/0xb);if(_0x24ceb3===_0x3c4092)break;else _0x181508['push'](_0x181508['shift']());}catch(_0x58e7e6){_0x181508['push'](_0x181508['shift']());}}}(a158_0x4a76,0x5e7eb));export function parseSegmentRef(_0xfe14b1){const _0x1a86ee=a158_0x1b20,_0x7fa1f4=_0xfe14b1[_0x1a86ee(0x15b)]('/');if(_0x7fa1f4===-0x1)return{'parentId':_0xfe14b1};if(_0x7fa1f4===0x0)throw new Error(_0x1a86ee(0x155)+_0xfe14b1+'.\x20Parent\x20name\x20cannot\x20be\x20empty');const _0x32beef=_0xfe14b1[_0x1a86ee(0x157)](0x0,_0x7fa1f4),_0x3b5aca=_0xfe14b1['substring'](_0x7fa1f4+0x1);if(_0x3b5aca==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0xfe14b1+_0x1a86ee(0x156));return{'parentId':_0x32beef,'childId':_0x3b5aca};}
@@ -1 +1 @@
1
- (function(_0xb30290,_0x19cfe8){const _0x5bf392=a159_0x4336,_0x33cf4f=_0xb30290();while(!![]){try{const _0x59c9b5=-parseInt(_0x5bf392(0xbb))/0x1+parseInt(_0x5bf392(0x9a))/0x2+-parseInt(_0x5bf392(0x7f))/0x3*(-parseInt(_0x5bf392(0xa0))/0x4)+-parseInt(_0x5bf392(0xbe))/0x5*(-parseInt(_0x5bf392(0xaa))/0x6)+parseInt(_0x5bf392(0xb6))/0x7*(-parseInt(_0x5bf392(0xbd))/0x8)+parseInt(_0x5bf392(0xa2))/0x9*(parseInt(_0x5bf392(0x70))/0xa)+-parseInt(_0x5bf392(0x82))/0xb;if(_0x59c9b5===_0x19cfe8)break;else _0x33cf4f['push'](_0x33cf4f['shift']());}catch(_0x4e1179){_0x33cf4f['push'](_0x33cf4f['shift']());}}}(a159_0x180a,0x82470));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';function a159_0x4336(_0xf27a0c,_0x2fabaf){_0xf27a0c=_0xf27a0c-0x67;const _0x180ac5=a159_0x180a();let _0x43363c=_0x180ac5[_0xf27a0c];return _0x43363c;}import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x5e82bf,_0x15a5e7={},_0x415c41={}){const _0xca0156=a159_0x4336;if(_0x415c41[_0xca0156(0x8e)])return runSemanticChecks(_0x5e82bf,_0x15a5e7);const _0x421a72=SegmentDefSchema['safeParse'](_0x5e82bf);if(_0x421a72[_0xca0156(0x8c)])return runSemanticChecks(_0x421a72[_0xca0156(0x79)],_0x15a5e7);return zodErrorsToValidationResult(_0x421a72[_0xca0156(0x75)],_0x15a5e7);}export function validateRuleDef(_0x405b19,_0x5980af,_0x1f3f4c){const _0x1ffd75=a159_0x4336;if(!_0x405b19)return[];const _0x1883a5=RuleDefSchema['safeParse'](_0x405b19);if(_0x1883a5[_0x1ffd75(0x8c)])return checkRule(_0x1883a5[_0x1ffd75(0x79)],_0x5980af,_0x1f3f4c);const _0x4c6843=flattenZodIssues(_0x1883a5['error'][_0x1ffd75(0x74)]);return _0x4c6843[_0x1ffd75(0x78)](_0x5cf955=>{const _0x7a30a1=_0x1ffd75,_0x3b0a95=formatZodPath(_0x5cf955[_0x7a30a1(0x72)]),_0x2b5d9c=_0x3b0a95?_0x5980af+'.'+_0x3b0a95:_0x5980af,_0x1c0462=mapZodIssueToCode(_0x5cf955,_0x3b0a95),_0x75e320=getLocationFromPath(_0x1f3f4c[_0x7a30a1(0xad)],_0x1f3f4c[_0x7a30a1(0x7b)],pathToArray(_0x2b5d9c));return{'level':_0x7a30a1(0x75),'path':_0x2b5d9c,'code':_0x1c0462,'message':_0x5cf955[_0x7a30a1(0x68)],..._0x75e320&&{'location':_0x75e320}};});}function zodErrorsToValidationResult(_0x587440,_0x174007){const _0x398e62=a159_0x4336,_0x1baa98=flattenZodIssues(_0x587440[_0x398e62(0x74)]),_0x1cde19=_0x1baa98[_0x398e62(0x78)](_0x1dcd16=>{const _0xbce8b=_0x398e62,_0x54039c=formatZodPath(_0x1dcd16[_0xbce8b(0x72)]),_0x32dbaf=mapZodIssueToCode(_0x1dcd16,_0x54039c),_0x36ef72=getLocationFromPath(_0x174007[_0xbce8b(0xad)],_0x174007[_0xbce8b(0x7b)],_0x1dcd16[_0xbce8b(0x72)][_0xbce8b(0x78)](_0x4ee7e9=>typeof _0x4ee7e9===_0xbce8b(0xa4)?String(_0x4ee7e9):_0x4ee7e9));return{'level':_0xbce8b(0x75),'path':_0x54039c,'code':_0x32dbaf,'message':_0x1dcd16[_0xbce8b(0x68)],..._0x36ef72&&{'location':_0x36ef72}};});return{'valid':![],'errors':_0x1cde19,'warnings':[]};}function mapZodIssueToCode(_0x17789a,_0x35002b){const _0x50579d=a159_0x4336,_0x5e38a7=_0x17789a[_0x50579d(0x91)]===_0x50579d(0x95)?_0x17789a['params']:undefined;if(_0x35002b==='name')return _0x50579d(0xb2);if(_0x35002b===_0x50579d(0x8f)||_0x35002b[_0x50579d(0x69)]('.type')){if(_0x17789a[_0x50579d(0x91)]===_0x50579d(0x6c)){if(_0x35002b===_0x50579d(0x8f)||_0x35002b[_0x50579d(0xa6)](/\.conditions\[\d+\]\.type$/))return _0x50579d(0xb5);}}if(_0x35002b[_0x50579d(0x69)](_0x50579d(0xa3)))return _0x50579d(0xa9);if(_0x35002b[_0x50579d(0x69)](_0x50579d(0xb0)))return _0x50579d(0x83);if(_0x5e38a7?.[_0x50579d(0xbc)]===_0x50579d(0x6e))return _0x50579d(0x6e);if(_0x5e38a7?.[_0x50579d(0xbc)]===_0x50579d(0x85))return _0x50579d(0x85);if(_0x35002b[_0x50579d(0x69)](_0x50579d(0xb9))||_0x35002b===_0x50579d(0x89))return _0x50579d(0x81);if(_0x35002b[_0x50579d(0x6b)](_0x50579d(0x9c)))return _0x50579d(0xa8);if(_0x35002b[_0x50579d(0x69)]('.segment'))return _0x50579d(0x98);return _0x50579d(0x7a);}function runSemanticChecks(_0x59da1d,_0x1b1ebd){const _0x2a6ef5=a159_0x4336,_0x4faf24=[];_0x59da1d[_0x2a6ef5(0x7e)]&&_0x4faf24[_0x2a6ef5(0x7d)](...checkRule(_0x59da1d['rule'],_0x2a6ef5(0x7e),_0x1b1ebd));const _0x4a6515=_0x4faf24[_0x2a6ef5(0x6d)](_0x5e5e8b=>_0x5e5e8b[_0x2a6ef5(0xa1)]===_0x2a6ef5(0x75)),_0x9d1ed9=_0x4faf24[_0x2a6ef5(0x6d)](_0x405f3f=>_0x405f3f['level']===_0x2a6ef5(0xb7));return{'valid':_0x4a6515[_0x2a6ef5(0x8b)]===0x0,'errors':_0x4a6515,'warnings':_0x9d1ed9};}function checkRule(_0x5233e3,_0x3e79b7,_0x25b6e8){const _0x120f3c=a159_0x4336,_0xb1dea7=[];if(_0x5233e3[_0x120f3c(0x89)][_0x120f3c(0x8b)]===0x0)return _0xb1dea7['push']({'level':_0x120f3c(0x75),'path':_0x3e79b7+_0x120f3c(0xb9),'code':'EMPTY_CONDITIONS','message':'Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','location':getLocationFromPath(_0x25b6e8[_0x120f3c(0xad)],_0x25b6e8[_0x120f3c(0x7b)],pathToArray(_0x3e79b7+_0x120f3c(0xb9)))}),_0xb1dea7;return _0xb1dea7[_0x120f3c(0x7d)](...checkConditions(_0x5233e3[_0x120f3c(0x89)],_0x3e79b7,_0x25b6e8)),_0xb1dea7;}function checkConditions(_0x126fe7,_0x47b25e,_0x46f27f){const _0x1db6aa=a159_0x4336,_0x1ad1dd=[];for(let _0x2341f0=0x0;_0x2341f0<_0x126fe7[_0x1db6aa(0x8b)];_0x2341f0++){const _0x1e6fbc=_0x126fe7[_0x2341f0],_0x182944=_0x47b25e+_0x1db6aa(0x80)+_0x2341f0+']';_0x1ad1dd[_0x1db6aa(0x7d)](...checkCondition(_0x1e6fbc,_0x182944,_0x46f27f));}return _0x1ad1dd;}function a159_0x180a(){const _0x2c13c9=['match','operator','INVALID_ARRAY_MATCHING','INVALID_OPERATOR_TYPE','17310crbbBC','NESTED_CONDITION_GROUP','Operator\x20\x27','document','Remove\x20\x27not\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.','EMPTY_ATTRIBUTE','.operator.value','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','MISSING_NAME','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','Behavior\x20source\x20\x27','INVALID_RULE_TYPE','19579oQdriP','warning','attribute','.conditions','not','1058913cRmcHM','validationCode','312UolYMk','1735sKiATL','TEMPORAL_NEGATION_UNSUPPORTED','message','endsWith','TimeWithinPast','includes','invalid_value','filter','MISSING_BETWEEN_BOUNDS','TimeWithinNext','10pjpcqj','\x27\x20with\x20attribute\x20\x27','path','\x27\x20with\x20\x27not:\x20true\x27\x20is\x20not\x20supported\x20by\x20the\x20Console\x20segment\x20editor.\x20','issues','error','.source','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','map','data','SEGMENT_SCHEMA_ERROR','source','Value','push','rule','6TiWtQS','.conditions[','MISSING_CONDITIONS','14982715qWGWMt','MISSING_OPERATOR_VALUE','Remove\x20\x27not:\x20false\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.','MISSING_TIME_UNIT','type','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','.attribute','conditions','Attribute\x20name\x20cannot\x20be\x20empty','length','success','.filter','skipSchema','rule.type','The\x20editor\x20will\x20silently\x20drop\x20the\x20negation\x20and\x20corrupt\x20the\x20segment\x20on\x20re-save.\x20','code','BEHAVIOR_SOURCE_MISSING_FILTER','Composite','Behavior','custom','EMPTY_CONDITIONS','.operator.not','MISSING_SEGMENT_REFERENCE','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','843076KKfTeF','description','arrayMatching','aggregation','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','\x27\x20does\x20not\x20support\x20the\x20\x27not\x27\x20field.\x20','1199096bRrVdO','level','9373464TLrbyI','.operator.type','symbol','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20'];a159_0x180a=function(){return _0x2c13c9;};return a159_0x180a();}function checkCondition(_0x401584,_0x4acb88,_0x3dae44){const _0x5968dc=a159_0x4336,_0x38e0ee=[];if(_0x401584[_0x5968dc(0x86)]==='And'||_0x401584[_0x5968dc(0x86)]==='Or'||_0x401584[_0x5968dc(0x86)]===_0x5968dc(0x93)){if(_0x401584[_0x5968dc(0x89)][_0x5968dc(0x8b)]===0x0)_0x38e0ee['push']({'level':_0x5968dc(0x75),'path':_0x4acb88+_0x5968dc(0xb9),'code':_0x5968dc(0x96),'message':_0x401584[_0x5968dc(0x86)]+'\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','location':getLocationFromPath(_0x3dae44[_0x5968dc(0xad)],_0x3dae44[_0x5968dc(0x7b)],pathToArray(_0x4acb88+_0x5968dc(0xb9)))});else{const _0x396708=_0x401584[_0x5968dc(0x9b)]!==undefined,_0x443aa7=_0x401584[_0x5968dc(0x86)]===_0x5968dc(0x93);!_0x396708&&!_0x443aa7&&_0x38e0ee[_0x5968dc(0x7d)]({'level':'warning','path':_0x4acb88,'code':_0x5968dc(0xab),'message':_0x401584['type']+_0x5968dc(0x87)+_0x5968dc(0xb3)+'conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','location':getLocationFromPath(_0x3dae44[_0x5968dc(0xad)],_0x3dae44[_0x5968dc(0x7b)],pathToArray(_0x4acb88))}),_0x38e0ee['push'](...checkConditions(_0x401584[_0x5968dc(0x89)],_0x4acb88,_0x3dae44));}return _0x38e0ee;}if(_0x401584['type']===_0x5968dc(0x7c)||_0x401584[_0x5968dc(0x86)]===_0x5968dc(0x94)){const _0x291d26=_0x401584,_0x55abd3=_0x291d26[_0x5968dc(0x7b)],_0x54edcb=_0x291d26[_0x5968dc(0x9d)],_0x51d528=_0x55abd3||_0x54edcb,_0x1bf5f2=_0x291d26[_0x5968dc(0xa7)]?.['type'];if((_0x1bf5f2===_0x5968dc(0x6a)||_0x1bf5f2===_0x5968dc(0x6f))&&_0x291d26[_0x5968dc(0xa7)]?.['not']!==undefined){const _0x1ceea6=_0x291d26[_0x5968dc(0xa7)][_0x5968dc(0xba)]===!![];_0x38e0ee[_0x5968dc(0x7d)]({'level':_0x1ceea6?_0x5968dc(0x75):_0x5968dc(0xb7),'path':_0x4acb88+_0x5968dc(0x97),'code':_0x5968dc(0x67),'message':_0x1ceea6?'Operator\x20\x27'+_0x1bf5f2+_0x5968dc(0x73)+_0x5968dc(0x90)+_0x5968dc(0xae):_0x5968dc(0xac)+_0x1bf5f2+_0x5968dc(0x9f)+_0x5968dc(0x84),'location':getLocationFromPath(_0x3dae44[_0x5968dc(0xad)],_0x3dae44['source'],pathToArray(_0x4acb88+'.operator.not'))});}(!_0x291d26[_0x5968dc(0xb8)]||_0x291d26[_0x5968dc(0xb8)]==='')&&(!_0x51d528&&_0x38e0ee[_0x5968dc(0x7d)]({'level':_0x5968dc(0x75),'path':_0x4acb88+_0x5968dc(0x88),'code':_0x5968dc(0xaf),'message':_0x5968dc(0x8a),'location':getLocationFromPath(_0x3dae44[_0x5968dc(0xad)],_0x3dae44[_0x5968dc(0x7b)],pathToArray(_0x4acb88+_0x5968dc(0x88)))}));_0x291d26['filter']&&_0x38e0ee[_0x5968dc(0x7d)](...checkRule(_0x291d26['filter'],_0x4acb88+_0x5968dc(0x8d),_0x3dae44));if(_0x291d26[_0x5968dc(0x7b)]){const _0x35b175=_0x291d26[_0x5968dc(0xb8)]&&_0x291d26[_0x5968dc(0xb8)]!=='';_0x35b175&&!_0x291d26[_0x5968dc(0x6d)]&&_0x38e0ee['push']({'level':_0x5968dc(0x75),'path':_0x4acb88+_0x5968dc(0x76),'code':_0x5968dc(0x92),'message':_0x5968dc(0xb4)+_0x291d26[_0x5968dc(0x7b)]+_0x5968dc(0x71)+_0x291d26['attribute']+'\x27\x20'+_0x5968dc(0xa5)+_0x5968dc(0x99)+'Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','location':getLocationFromPath(_0x3dae44[_0x5968dc(0xad)],_0x3dae44[_0x5968dc(0x7b)],pathToArray(_0x4acb88+_0x5968dc(0x76)))}),_0x35b175&&_0x291d26[_0x5968dc(0x6d)]&&_0x38e0ee['push']({'level':_0x5968dc(0xb7),'path':_0x4acb88+_0x5968dc(0x88),'code':_0x5968dc(0xb1),'message':'Attribute\x20\x27'+_0x291d26[_0x5968dc(0xb8)]+_0x5968dc(0x77)+_0x5968dc(0x9e),'location':getLocationFromPath(_0x3dae44[_0x5968dc(0xad)],_0x3dae44[_0x5968dc(0x7b)],pathToArray(_0x4acb88+'.attribute'))});}}return _0x38e0ee;}
1
+ (function(_0x1d666b,_0xed3ddf){const _0x4d699f=a159_0x279f,_0x2956c0=_0x1d666b();while(!![]){try{const _0xfa0a6d=-parseInt(_0x4d699f(0x1a4))/0x1*(-parseInt(_0x4d699f(0x17c))/0x2)+parseInt(_0x4d699f(0x1a8))/0x3*(parseInt(_0x4d699f(0x17f))/0x4)+-parseInt(_0x4d699f(0x18d))/0x5*(-parseInt(_0x4d699f(0x194))/0x6)+-parseInt(_0x4d699f(0x199))/0x7+parseInt(_0x4d699f(0x190))/0x8*(-parseInt(_0x4d699f(0x185))/0x9)+parseInt(_0x4d699f(0x173))/0xa+-parseInt(_0x4d699f(0x170))/0xb;if(_0xfa0a6d===_0xed3ddf)break;else _0x2956c0['push'](_0x2956c0['shift']());}catch(_0x562ee5){_0x2956c0['push'](_0x2956c0['shift']());}}}(a159_0x43dc,0x1882f));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x25efbb,_0x2a6897={},_0xc51495={}){const _0x383d02=a159_0x279f;if(_0xc51495[_0x383d02(0x180)])return runSemanticChecks(_0x25efbb,_0x2a6897);const _0x95dfe8=SegmentDefSchema[_0x383d02(0x1ab)](_0x25efbb);if(_0x95dfe8[_0x383d02(0x1b2)])return runSemanticChecks(_0x95dfe8[_0x383d02(0x15b)],_0x2a6897);return zodErrorsToValidationResult(_0x95dfe8[_0x383d02(0x192)],_0x2a6897);}export function validateRuleDef(_0x21e4e1,_0x48af95,_0x413a38){const _0x2b3577=a159_0x279f;if(!_0x21e4e1)return[];const _0x28bbcb=RuleDefSchema['safeParse'](_0x21e4e1);if(_0x28bbcb[_0x2b3577(0x1b2)])return checkRule(_0x28bbcb['data'],_0x48af95,_0x413a38);const _0x3de9f1=flattenZodIssues(_0x28bbcb[_0x2b3577(0x192)][_0x2b3577(0x1ad)]);return _0x3de9f1['map'](_0x196f0a=>{const _0x50d9b6=_0x2b3577,_0x283aa3=formatZodPath(_0x196f0a[_0x50d9b6(0x16e)]),_0x2dee4d=_0x283aa3?_0x48af95+'.'+_0x283aa3:_0x48af95,_0x30286a=mapZodIssueToCode(_0x196f0a,_0x283aa3),_0x9698d5=getLocationFromPath(_0x413a38[_0x50d9b6(0x1ac)],_0x413a38[_0x50d9b6(0x178)],pathToArray(_0x2dee4d));return{'level':'error','path':_0x2dee4d,'code':_0x30286a,'message':_0x196f0a[_0x50d9b6(0x19a)],..._0x9698d5&&{'location':_0x9698d5}};});}function zodErrorsToValidationResult(_0x42cf0a,_0x49a93a){const _0x224606=a159_0x279f,_0x2b5dbc=flattenZodIssues(_0x42cf0a['issues']),_0x2e45b1=_0x2b5dbc[_0x224606(0x177)](_0x315925=>{const _0x374f30=_0x224606,_0x368f3d=formatZodPath(_0x315925[_0x374f30(0x16e)]),_0x226e5a=mapZodIssueToCode(_0x315925,_0x368f3d),_0x4168fc=getLocationFromPath(_0x49a93a[_0x374f30(0x1ac)],_0x49a93a['source'],_0x315925['path'][_0x374f30(0x177)](_0x80fc9f=>typeof _0x80fc9f===_0x374f30(0x15d)?String(_0x80fc9f):_0x80fc9f));return{'level':_0x374f30(0x192),'path':_0x368f3d,'code':_0x226e5a,'message':_0x315925[_0x374f30(0x19a)],..._0x4168fc&&{'location':_0x4168fc}};});return{'valid':![],'errors':_0x2e45b1,'warnings':[]};}function mapZodIssueToCode(_0x104609,_0x419954){const _0x3fe3e0=a159_0x279f,_0x42d654=_0x104609[_0x3fe3e0(0x196)]===_0x3fe3e0(0x18a)?_0x104609[_0x3fe3e0(0x195)]:undefined;if(_0x419954==='name')return'MISSING_NAME';if(_0x419954==='rule.type'||_0x419954[_0x3fe3e0(0x1b1)]('.type')){if(_0x104609[_0x3fe3e0(0x196)]===_0x3fe3e0(0x1a2)){if(_0x419954===_0x3fe3e0(0x169)||_0x419954[_0x3fe3e0(0x15f)](/\.conditions\[\d+\]\.type$/))return _0x3fe3e0(0x175);}}if(_0x419954[_0x3fe3e0(0x1b1)](_0x3fe3e0(0x1a3)))return _0x3fe3e0(0x197);if(_0x419954[_0x3fe3e0(0x1b1)]('.operator.value'))return _0x3fe3e0(0x161);if(_0x42d654?.[_0x3fe3e0(0x15c)]===_0x3fe3e0(0x187))return _0x3fe3e0(0x187);if(_0x42d654?.[_0x3fe3e0(0x15c)]===_0x3fe3e0(0x17e))return'MISSING_TIME_UNIT';if(_0x419954[_0x3fe3e0(0x1b1)]('.conditions')||_0x419954==='conditions')return _0x3fe3e0(0x1b0);if(_0x419954[_0x3fe3e0(0x1a1)](_0x3fe3e0(0x1af)))return'INVALID_ARRAY_MATCHING';if(_0x419954[_0x3fe3e0(0x1b1)](_0x3fe3e0(0x19b)))return'MISSING_SEGMENT_REFERENCE';return _0x3fe3e0(0x176);}function runSemanticChecks(_0x306643,_0x280160){const _0x22e066=a159_0x279f,_0x2e19ce=[];_0x306643['rule']&&_0x2e19ce[_0x22e066(0x189)](...checkRule(_0x306643[_0x22e066(0x18b)],'rule',_0x280160));const _0x291d51=_0x2e19ce[_0x22e066(0x16f)](_0x5a7462=>_0x5a7462[_0x22e066(0x168)]==='error'),_0x4c1fc0=_0x2e19ce[_0x22e066(0x16f)](_0x307e10=>_0x307e10['level']===_0x22e066(0x162));return{'valid':_0x291d51[_0x22e066(0x198)]===0x0,'errors':_0x291d51,'warnings':_0x4c1fc0};}function checkRule(_0x875312,_0x307a32,_0x284e0e){const _0x4566d7=a159_0x279f,_0x37f06f=[];if(_0x875312[_0x4566d7(0x1a7)][_0x4566d7(0x198)]===0x0)return _0x37f06f[_0x4566d7(0x189)]({'level':_0x4566d7(0x192),'path':_0x307a32+_0x4566d7(0x163),'code':'EMPTY_CONDITIONS','message':_0x4566d7(0x186),'location':getLocationFromPath(_0x284e0e[_0x4566d7(0x1ac)],_0x284e0e[_0x4566d7(0x178)],pathToArray(_0x307a32+'.conditions'))}),_0x37f06f;return _0x37f06f['push'](...checkConditions(_0x875312[_0x4566d7(0x1a7)],_0x307a32,_0x284e0e)),_0x37f06f;}function checkConditions(_0x530d1e,_0x1b693e,_0x1ac70c){const _0x2dc356=a159_0x279f,_0xe8a437=[];for(let _0x4c72d2=0x0;_0x4c72d2<_0x530d1e['length'];_0x4c72d2++){const _0x2c704d=_0x530d1e[_0x4c72d2],_0x190c8f=_0x1b693e+_0x2dc356(0x1a5)+_0x4c72d2+']';_0xe8a437[_0x2dc356(0x189)](...checkCondition(_0x2c704d,_0x190c8f,_0x1ac70c));}return _0xe8a437;}function checkCondition(_0x63c02d,_0x4a69d1,_0xd8e01c){const _0x4f243a=a159_0x279f,_0x39ebf9=[];if(_0x63c02d[_0x4f243a(0x167)]===_0x4f243a(0x19f)||_0x63c02d[_0x4f243a(0x167)]==='Or'||_0x63c02d[_0x4f243a(0x167)]===_0x4f243a(0x164)){if(_0x63c02d[_0x4f243a(0x1a7)][_0x4f243a(0x198)]===0x0)_0x39ebf9['push']({'level':_0x4f243a(0x192),'path':_0x4a69d1+_0x4f243a(0x163),'code':_0x4f243a(0x1a0),'message':_0x63c02d['type']+_0x4f243a(0x18f),'location':getLocationFromPath(_0xd8e01c[_0x4f243a(0x1ac)],_0xd8e01c[_0x4f243a(0x178)],pathToArray(_0x4a69d1+_0x4f243a(0x163)))});else{const _0x29568a=_0x63c02d['description']!==undefined,_0x4bc2d9=_0x63c02d[_0x4f243a(0x167)]==='Composite';!_0x29568a&&!_0x4bc2d9&&_0x39ebf9[_0x4f243a(0x189)]({'level':_0x4f243a(0x162),'path':_0x4a69d1,'code':_0x4f243a(0x174),'message':_0x63c02d[_0x4f243a(0x167)]+_0x4f243a(0x18c)+_0x4f243a(0x1a6)+_0x4f243a(0x160),'location':getLocationFromPath(_0xd8e01c[_0x4f243a(0x1ac)],_0xd8e01c[_0x4f243a(0x178)],pathToArray(_0x4a69d1))}),_0x39ebf9['push'](...checkConditions(_0x63c02d[_0x4f243a(0x1a7)],_0x4a69d1,_0xd8e01c));}return _0x39ebf9;}if(_0x63c02d[_0x4f243a(0x167)]===_0x4f243a(0x1aa)||_0x63c02d['type']===_0x4f243a(0x184)){const _0x2dc944=_0x63c02d,_0x2bb4f0=_0x2dc944[_0x4f243a(0x178)],_0x347950=_0x2dc944[_0x4f243a(0x165)],_0x4c1171=_0x2bb4f0||_0x347950,_0xb850c2=_0x2dc944[_0x4f243a(0x1ae)]?.[_0x4f243a(0x167)];if((_0xb850c2===_0x4f243a(0x17d)||_0xb850c2==='TimeWithinNext')&&_0x2dc944['operator']?.['not']!==undefined){const _0x1ffa71=_0x2dc944[_0x4f243a(0x1ae)][_0x4f243a(0x19d)]===!![];_0x39ebf9[_0x4f243a(0x189)]({'level':_0x1ffa71?_0x4f243a(0x192):'warning','path':_0x4a69d1+_0x4f243a(0x172),'code':_0x4f243a(0x16d),'message':_0x1ffa71?_0x4f243a(0x19e)+_0xb850c2+_0x4f243a(0x17a)+_0x4f243a(0x166)+_0x4f243a(0x188):_0x4f243a(0x19e)+_0xb850c2+'\x27\x20does\x20not\x20support\x20the\x20\x27not\x27\x20field.\x20'+_0x4f243a(0x183),'location':getLocationFromPath(_0xd8e01c['document'],_0xd8e01c[_0x4f243a(0x178)],pathToArray(_0x4a69d1+_0x4f243a(0x172)))});}(!_0x2dc944[_0x4f243a(0x193)]||_0x2dc944['attribute']==='')&&(!_0x4c1171&&_0x39ebf9[_0x4f243a(0x189)]({'level':_0x4f243a(0x192),'path':_0x4a69d1+'.attribute','code':_0x4f243a(0x1a9),'message':_0x4f243a(0x171),'location':getLocationFromPath(_0xd8e01c[_0x4f243a(0x1ac)],_0xd8e01c[_0x4f243a(0x178)],pathToArray(_0x4a69d1+_0x4f243a(0x179)))}));_0x2dc944[_0x4f243a(0x16f)]&&_0x39ebf9[_0x4f243a(0x189)](...checkRule(_0x2dc944[_0x4f243a(0x16f)],_0x4a69d1+_0x4f243a(0x19c),_0xd8e01c));if(_0x2dc944[_0x4f243a(0x178)]){const _0x2f54c6=_0x2dc944[_0x4f243a(0x193)]&&_0x2dc944[_0x4f243a(0x193)]!=='';_0x2f54c6&&!_0x2dc944['filter']&&_0x39ebf9[_0x4f243a(0x189)]({'level':_0x4f243a(0x192),'path':_0x4a69d1+'.source','code':_0x4f243a(0x181),'message':'Behavior\x20source\x20\x27'+_0x2dc944['source']+_0x4f243a(0x18e)+_0x2dc944[_0x4f243a(0x193)]+'\x27\x20'+_0x4f243a(0x15e)+_0x4f243a(0x191)+_0x4f243a(0x182),'location':getLocationFromPath(_0xd8e01c['document'],_0xd8e01c['source'],pathToArray(_0x4a69d1+_0x4f243a(0x16a)))}),_0x2f54c6&&_0x2dc944[_0x4f243a(0x16f)]&&_0x39ebf9['push']({'level':_0x4f243a(0x162),'path':_0x4a69d1+_0x4f243a(0x179),'code':_0x4f243a(0x16c),'message':_0x4f243a(0x1b3)+_0x2dc944[_0x4f243a(0x193)]+_0x4f243a(0x17b)+_0x4f243a(0x16b),'location':getLocationFromPath(_0xd8e01c['document'],_0xd8e01c['source'],pathToArray(_0x4a69d1+_0x4f243a(0x179)))});}}return _0x39ebf9;}function a159_0x279f(_0x191457,_0x5ede60){_0x191457=_0x191457-0x15b;const _0x43dca2=a159_0x43dc();let _0x279f38=_0x43dca2[_0x191457];return _0x279f38;}function a159_0x43dc(){const _0x26a4f5=['\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','1788PdUhwI','TimeWithinPast','MISSING_TIME_UNIT','1768VJZvMp','skipSchema','BEHAVIOR_SOURCE_MISSING_FILTER','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','Remove\x20\x27not:\x20false\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.','Behavior','84951UpXpeG','Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','MISSING_BETWEEN_BOUNDS','Remove\x20\x27not\x27\x20—\x20temporal\x20operators\x20do\x20not\x20support\x20negation.','push','custom','rule','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','980615Bjuzsb','\x27\x20with\x20attribute\x20\x27','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','56bNfZir','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','error','attribute','6OwrpPt','params','code','INVALID_OPERATOR_TYPE','length','282422NNsonr','message','.segment','.filter','not','Operator\x20\x27','And','EMPTY_CONDITIONS','includes','invalid_value','.operator.type','82iMFalB','.conditions[','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','conditions','1002prArlK','EMPTY_ATTRIBUTE','Value','safeParse','document','issues','operator','arrayMatching','MISSING_CONDITIONS','endsWith','success','Attribute\x20\x27','data','validationCode','symbol','requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20','match','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','MISSING_OPERATOR_VALUE','warning','.conditions','Composite','aggregation','The\x20editor\x20will\x20silently\x20drop\x20the\x20negation\x20and\x20corrupt\x20the\x20segment\x20on\x20re-save.\x20','type','level','rule.type','.source','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','TEMPORAL_NEGATION_UNSUPPORTED','path','filter','2320967UWkSqn','Attribute\x20name\x20cannot\x20be\x20empty','.operator.not','7560Ynvpbq','NESTED_CONDITION_GROUP','INVALID_RULE_TYPE','SEGMENT_SCHEMA_ERROR','map','source','.attribute','\x27\x20with\x20\x27not:\x20true\x27\x20is\x20not\x20supported\x20by\x20the\x20Console\x20segment\x20editor.\x20'];a159_0x43dc=function(){return _0x26a4f5;};return a159_0x43dc();}