@treasuredata/tdx 2026.4.5 → 2026.4.6

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 (231) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/policy-command.js +1 -1
  35. package/dist/commands/profile-command.js +1 -1
  36. package/dist/commands/profiles-command.js +1 -1
  37. package/dist/commands/query-command.js +1 -1
  38. package/dist/commands/schedule-command.js +1 -1
  39. package/dist/commands/segment-command.js +1 -1
  40. package/dist/commands/segment-create-command.js +1 -1
  41. package/dist/commands/segment-fields-command.js +1 -1
  42. package/dist/commands/segment-pull-command.js +1 -1
  43. package/dist/commands/segment-push-command.js +1 -1
  44. package/dist/commands/segment-update-command.js +1 -1
  45. package/dist/commands/segment-use-command.js +1 -1
  46. package/dist/commands/segment-validate-command.js +1 -1
  47. package/dist/commands/segments.js +1 -1
  48. package/dist/commands/show.js +1 -1
  49. package/dist/commands/status-command.js +1 -1
  50. package/dist/commands/tables.js +1 -1
  51. package/dist/commands/unset-command.js +1 -1
  52. package/dist/commands/upgrade-command.js +1 -1
  53. package/dist/commands/use-command.js +1 -1
  54. package/dist/commands/user-command.js +1 -1
  55. package/dist/commands/work-command.js +1 -1
  56. package/dist/commands/workflow-command.js +1 -1
  57. package/dist/core/auth.js +1 -1
  58. package/dist/core/command-output.js +1 -1
  59. package/dist/core/config.js +1 -1
  60. package/dist/core/connection-cache.js +1 -1
  61. package/dist/core/constants.js +1 -1
  62. package/dist/core/credential-cache.js +1 -1
  63. package/dist/core/global-context.js +1 -1
  64. package/dist/core/keychain.js +1 -1
  65. package/dist/core/oauth-keychain.js +1 -1
  66. package/dist/core/oauth.js +1 -1
  67. package/dist/core/profile.js +1 -1
  68. package/dist/core/project-config.js +1 -1
  69. package/dist/core/session.js +1 -1
  70. package/dist/core/user-cache.js +1 -1
  71. package/dist/core/version.js +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/mcp/server.js +1 -1
  74. package/dist/mcp/tools/index.js +1 -1
  75. package/dist/mcp/tools/tdx-run.js +1 -1
  76. package/dist/mcp/tools/tdx-search.js +1 -1
  77. package/dist/mcp/tools/work-create-item.js +1 -1
  78. package/dist/mcp/utils.js +1 -1
  79. package/dist/proxy/claude-usage-tracker.js +1 -1
  80. package/dist/proxy/passthrough-server.js +1 -1
  81. package/dist/proxy/sse-usage-parser.js +1 -1
  82. package/dist/sdk/agent/agent-config.js +1 -1
  83. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  84. package/dist/sdk/agent/agent-yaml.js +1 -1
  85. package/dist/sdk/agent/test/evaluator.js +1 -1
  86. package/dist/sdk/agent/test/executor.js +1 -1
  87. package/dist/sdk/agent/test/index.js +1 -1
  88. package/dist/sdk/agent/test/output.js +1 -1
  89. package/dist/sdk/agent/test/parser.js +1 -1
  90. package/dist/sdk/agent/tool-target-registry.js +1 -1
  91. package/dist/sdk/api.js +1 -1
  92. package/dist/sdk/cas/cas-api-client.js +1 -1
  93. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  94. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  95. package/dist/sdk/cas/index.js +1 -1
  96. package/dist/sdk/cas/pull-workflow.js +1 -1
  97. package/dist/sdk/cas/push-workflow.js +1 -1
  98. package/dist/sdk/client/cdp-api-client.js +1 -1
  99. package/dist/sdk/client/delivery-api-client.js +1 -1
  100. package/dist/sdk/client/endpoints.js +1 -1
  101. package/dist/sdk/client/engage-api-client.js +1 -1
  102. package/dist/sdk/client/http-client.js +1 -1
  103. package/dist/sdk/client/llm-api-client.js +1 -1
  104. package/dist/sdk/client/oauth-refresh.js +1 -1
  105. package/dist/sdk/client/rate-limiter.js +1 -1
  106. package/dist/sdk/client/td-api-client.js +1 -1
  107. package/dist/sdk/client/trino-api-client.js +1 -1
  108. package/dist/sdk/client/workflow-client.js +1 -1
  109. package/dist/sdk/connection-validator.js +1 -1
  110. package/dist/sdk/connection.js +1 -1
  111. package/dist/sdk/delivery.js +1 -1
  112. package/dist/sdk/engage/campaign-pull.js +1 -1
  113. package/dist/sdk/engage/campaign-push.js +1 -1
  114. package/dist/sdk/engage/campaign-validator.js +1 -1
  115. package/dist/sdk/engage/campaign-yaml.js +1 -1
  116. package/dist/sdk/engage/template-pull.js +1 -1
  117. package/dist/sdk/engage/template-push.js +1 -1
  118. package/dist/sdk/engage/template-validator.js +1 -1
  119. package/dist/sdk/engage/template-yaml.js +1 -1
  120. package/dist/sdk/engage/types/campaign-def.js +1 -1
  121. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  122. package/dist/sdk/engage/types/template-schema.js +1 -1
  123. package/dist/sdk/engage.js +1 -1
  124. package/dist/sdk/errors.js +1 -1
  125. package/dist/sdk/index.js +1 -1
  126. package/dist/sdk/io/index.js +1 -1
  127. package/dist/sdk/io/node-filesystem.js +1 -1
  128. package/dist/sdk/job.js +1 -1
  129. package/dist/sdk/journey.js +1 -1
  130. package/dist/sdk/llm/chat-cache.js +1 -1
  131. package/dist/sdk/llm/index.js +1 -1
  132. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  133. package/dist/sdk/llm/model-factors.js +1 -1
  134. package/dist/sdk/personalization.js +1 -1
  135. package/dist/sdk/policy.js +1 -1
  136. package/dist/sdk/query/index.js +1 -1
  137. package/dist/sdk/query/sql-parser.js +1 -1
  138. package/dist/sdk/realtime.js +1 -1
  139. package/dist/sdk/schedule.js +1 -1
  140. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  141. package/dist/sdk/segment/fields-display.js +1 -1
  142. package/dist/sdk/segment/file-discovery.js +1 -1
  143. package/dist/sdk/segment/journey-utils.js +1 -1
  144. package/dist/sdk/segment/journey-validator.js +1 -1
  145. package/dist/sdk/segment/journey-yaml.js +1 -1
  146. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  147. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  148. package/dist/sdk/segment/pull-workflow.js +1 -1
  149. package/dist/sdk/segment/push-recovery.js +1 -1
  150. package/dist/sdk/segment/push-workflow.js +1 -1
  151. package/dist/sdk/segment/resolution-context.js +1 -1
  152. package/dist/sdk/segment/segment-path-parser.js +1 -1
  153. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  154. package/dist/sdk/segment/segment-validator.js +1 -1
  155. package/dist/sdk/segment/target-resolution.js +1 -1
  156. package/dist/sdk/segment/tdx-config.js +1 -1
  157. package/dist/sdk/segment/types/activation-schema.js +1 -1
  158. package/dist/sdk/segment/types/journey-def.js +1 -1
  159. package/dist/sdk/segment/types/journey-schema.js +1 -1
  160. package/dist/sdk/segment/types/segment-def.js +1 -1
  161. package/dist/sdk/segment/types/segment-schema.js +1 -1
  162. package/dist/sdk/segment/validate-files.js +1 -1
  163. package/dist/sdk/segment/yaml-validator.js +1 -1
  164. package/dist/sdk/segment.js +1 -1
  165. package/dist/sdk/types/index.js +1 -1
  166. package/dist/sdk/types/progress.js +1 -1
  167. package/dist/sdk/types/workspace.d.ts +3 -0
  168. package/dist/sdk/types/workspace.d.ts.map +1 -1
  169. package/dist/sdk/types/workspace.js +1 -1
  170. package/dist/sdk/types/workspace.js.map +1 -1
  171. package/dist/sdk/user.js +1 -1
  172. package/dist/sdk/util/format-detector.js +1 -1
  173. package/dist/sdk/util/formatters.js +1 -1
  174. package/dist/sdk/util/index.js +1 -1
  175. package/dist/sdk/util/paginate.js +1 -1
  176. package/dist/sdk/util/tree-formatter.js +1 -1
  177. package/dist/sdk/workflow/archive-validation.js +1 -1
  178. package/dist/sdk/workflow/clone-workflow.js +1 -1
  179. package/dist/sdk/workflow/index.js +1 -1
  180. package/dist/sdk/workflow/pull-workflow.js +1 -1
  181. package/dist/sdk/workflow/push-workflow.js +1 -1
  182. package/dist/sdk/workflow/tdx-config.js +1 -1
  183. package/dist/sdk/workflow/workflow-utils.js +1 -1
  184. package/dist/sdk/workspace/access-tracker.d.ts.map +1 -1
  185. package/dist/sdk/workspace/access-tracker.js +1 -1
  186. package/dist/sdk/workspace/access-tracker.js.map +1 -1
  187. package/dist/sdk/workspace/frontmatter.js +1 -1
  188. package/dist/sdk/workspace/git.js +1 -1
  189. package/dist/sdk/workspace/index.d.ts +1 -1
  190. package/dist/sdk/workspace/index.d.ts.map +1 -1
  191. package/dist/sdk/workspace/index.js +1 -1
  192. package/dist/sdk/workspace/index.js.map +1 -1
  193. package/dist/sdk/workspace/templates.js +1 -1
  194. package/dist/sdk/workspace/weekly.js +1 -1
  195. package/dist/sdk/workspace/wikilinks.d.ts +2 -0
  196. package/dist/sdk/workspace/wikilinks.d.ts.map +1 -1
  197. package/dist/sdk/workspace/wikilinks.js +1 -1
  198. package/dist/sdk/workspace/wikilinks.js.map +1 -1
  199. package/dist/test-utils/command-runner.js +1 -1
  200. package/dist/test-utils/factories.js +1 -1
  201. package/dist/test-utils/fixtures.js +1 -1
  202. package/dist/test-utils/http-mock.js +1 -1
  203. package/dist/test-utils/index.js +1 -1
  204. package/dist/utils/async.js +1 -1
  205. package/dist/utils/colors.js +1 -1
  206. package/dist/utils/diff.js +1 -1
  207. package/dist/utils/file-permissions.js +1 -1
  208. package/dist/utils/file-reader.js +1 -1
  209. package/dist/utils/github-releases.js +1 -1
  210. package/dist/utils/global-cache.js +1 -1
  211. package/dist/utils/json-loader.js +1 -1
  212. package/dist/utils/local-cache.js +1 -1
  213. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  214. package/dist/utils/logger/formatters/index.js +1 -1
  215. package/dist/utils/logger/handlers/console-handler.js +1 -1
  216. package/dist/utils/logger/handlers/file-handler.js +1 -1
  217. package/dist/utils/logger/handlers/index.js +1 -1
  218. package/dist/utils/logger/handlers/null-handler.js +1 -1
  219. package/dist/utils/logger/index.js +1 -1
  220. package/dist/utils/logger/logger.js +1 -1
  221. package/dist/utils/logger/types.js +1 -1
  222. package/dist/utils/option-validation.js +1 -1
  223. package/dist/utils/process.js +1 -1
  224. package/dist/utils/prompt.js +1 -1
  225. package/dist/utils/spinner.js +1 -1
  226. package/dist/utils/sse-parser.js +1 -1
  227. package/dist/utils/string-utils.js +1 -1
  228. package/dist/utils/table-ref-parser.js +1 -1
  229. package/dist/utils/tdx-logger.js +1 -1
  230. package/dist/utils/version-check.js +1 -1
  231. package/package.json +1 -1
@@ -1 +1 @@
1
- const a152_0x2723ce=a152_0x282b;(function(_0x5c26b6,_0x35b3ca){const _0xa21aa5=a152_0x282b,_0xd9539d=_0x5c26b6();while(!![]){try{const _0x5b61db=parseInt(_0xa21aa5(0x187))/0x1*(parseInt(_0xa21aa5(0x17c))/0x2)+parseInt(_0xa21aa5(0x124))/0x3*(-parseInt(_0xa21aa5(0xed))/0x4)+-parseInt(_0xa21aa5(0x186))/0x5*(-parseInt(_0xa21aa5(0xcc))/0x6)+-parseInt(_0xa21aa5(0xef))/0x7*(-parseInt(_0xa21aa5(0x1a7))/0x8)+-parseInt(_0xa21aa5(0x1ce))/0x9*(parseInt(_0xa21aa5(0x19d))/0xa)+-parseInt(_0xa21aa5(0xf3))/0xb+parseInt(_0xa21aa5(0x164))/0xc*(parseInt(_0xa21aa5(0xd4))/0xd);if(_0x5b61db===_0x35b3ca)break;else _0xd9539d['push'](_0xd9539d['shift']());}catch(_0x46eb4a){_0xd9539d['push'](_0xd9539d['shift']());}}}(a152_0x6faf,0x68c4b));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x2723ce(0x18d));export const PENDING_SEGMENT_PREFIX=a152_0x2723ce(0xe2);export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0x2d7cbf){return''+PENDING_SEGMENT_PREFIX+_0x2d7cbf+'__';}export function isPendingSegmentId(_0x5b3087){const _0x2f37f7=a152_0x2723ce;return _0x5b3087[_0x2f37f7(0x13d)](PENDING_SEGMENT_PREFIX)&&!_0x5b3087[_0x2f37f7(0x13d)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x266ec0){const _0x1a2af3=a152_0x2723ce;return _0x266ec0[_0x1a2af3(0x1ca)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0xf50756){return''+PENDING_ACTIVATION_PREFIX+_0xf50756+'__';}export function isPendingActivationId(_0x19a3b2){const _0x18b55f=a152_0x2723ce;return _0x19a3b2[_0x18b55f(0x13d)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x1a3835){const _0x47f0fb=a152_0x2723ce;return _0x1a3835[_0x47f0fb(0x1ca)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x16e740,_0x384125){const _0x1ea5e=a152_0x2723ce,_0x104fa5=_0x16e740+'::'+(_0x384125[_0x1ea5e(0x1b5)]()||'segment'),_0x3688c8=createHash('sha1')[_0x1ea5e(0x161)](_0x104fa5)[_0x1ea5e(0x1ae)](_0x1ea5e(0x14f))['slice'](0x0,0xc);return _0x1ea5e(0xd1)+_0x3688c8;}export function ensureJourneyDefaults(_0x587954){const _0x5b15ca=a152_0x2723ce;!_0x587954[_0x5b15ca(0x149)]&&(_0x587954[_0x5b15ca(0x149)]=''),!_0x587954[_0x5b15ca(0x11e)]&&(_0x587954[_0x5b15ca(0x11e)]='draft');}export function injectExistingStageIds(_0x2963f7,_0x331ec0){const _0x37d4ac=a152_0x2723ce,_0x367a60=new Map(_0x331ec0[_0x37d4ac(0x111)](_0x971f65=>[_0x971f65['name'],_0x971f65['id']]));for(const _0x4cde1f of _0x2963f7){if(!_0x4cde1f['id']){const _0x59d25e=_0x367a60['get'](_0x4cde1f[_0x37d4ac(0x105)]);_0x59d25e&&(_0x4cde1f['id']=_0x59d25e);}}}export function resolveTDFolderPath(_0x48e4db,_0x25cec6,_0x3f8a95){const _0x17e7a8=a152_0x2723ce;if(!_0x25cec6)return _0x48e4db;if(_0x48e4db===_0x3f8a95||_0x48e4db[_0x17e7a8(0x13d)](_0x3f8a95+'/'))return _0x48e4db;return _0x48e4db?_0x3f8a95+'/'+_0x48e4db:_0x3f8a95;}export function addFoldersToCreate(_0x597eeb,_0x1c2618,_0x20bb0f){const _0x277570=a152_0x2723ce;if(!_0x597eeb)return;if(_0x1c2618['has'](_0x597eeb))return;const _0x260a3b=_0x597eeb['split']('/');let _0x1332fc='';for(const _0x14e1b4 of _0x260a3b){_0x1332fc=_0x1332fc?_0x1332fc+'/'+_0x14e1b4:_0x14e1b4,!_0x1c2618[_0x277570(0x19c)](_0x1332fc)&&_0x20bb0f['add'](_0x1332fc);}}export function sortFoldersByDepth(_0x18ebfb){const _0x2407ef=a152_0x2723ce;return[..._0x18ebfb][_0x2407ef(0x156)]((_0x19c975,_0x3654c1)=>{const _0x1aced7=_0x2407ef,_0x368081=(_0x19c975[_0x1aced7(0x143)](/\//g)||[])[_0x1aced7(0x103)],_0x233194=(_0x3654c1[_0x1aced7(0x143)](/\//g)||[])['length'];return _0x368081-_0x233194;});}import*as a152_0x432775 from'yaml';import{readFileSync}from'fs';import a152_0x57e623 from'path';import{isJourneyDef,parseYamlString as a152_0x35d44f,toYamlString as a152_0x4b9e18,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(_0x1c0682){const _0x54c937=a152_0x2723ce;if(Array['isArray'](_0x1c0682))return'['+_0x1c0682['map'](_0x342c8e=>stableStringify(_0x342c8e))['join'](',')+']';if(_0x1c0682&&typeof _0x1c0682==='object'){const _0x131253=_0x1c0682,_0x5af9e9=Object[_0x54c937(0x139)](_0x131253)['sort'](),_0x27feee=_0x5af9e9[_0x54c937(0x111)](_0x58b1a2=>'\x22'+_0x58b1a2+'\x22:'+stableStringify(_0x131253[_0x58b1a2]));return'{'+_0x27feee[_0x54c937(0x112)](',')+'}';}const _0x26aa7b=JSON[_0x54c937(0x1a0)](_0x1c0682);return _0x26aa7b===undefined?_0x54c937(0x1c0):_0x26aa7b;}function activationSignature(_0x3d3aaa){const _0x44390c=a152_0x2723ce,_0x3f128f={'connection':_0x3d3aaa[_0x44390c(0x11f)],..._0x3d3aaa['all_columns']!==undefined&&{'all_columns':_0x3d3aaa[_0x44390c(0x140)]},..._0x3d3aaa[_0x44390c(0x11a)]!==undefined&&{'columns':_0x3d3aaa['columns']},..._0x3d3aaa[_0x44390c(0x1a1)]!==undefined&&{'behavior':_0x3d3aaa[_0x44390c(0x1a1)]},..._0x3d3aaa[_0x44390c(0x126)]!==undefined&&{'schedule':_0x3d3aaa['schedule']},..._0x3d3aaa['notification']!==undefined&&{'notification':_0x3d3aaa[_0x44390c(0xd2)]},..._0x3d3aaa[_0x44390c(0x1af)]!==undefined&&{'connector_config':_0x3d3aaa[_0x44390c(0x1af)]},..._0x3d3aaa['activation_template_id']!==undefined&&{'activation_template_id':_0x3d3aaa[_0x44390c(0x19e)]}};return stableStringify(_0x3f128f);}async function fetchSegment(_0x5131de,_0x3504f1,_0x4b082c,_0x5bc7d9){const _0x4e7d7a=a152_0x2723ce,_0x2b46c0=_0x5bc7d9?.[_0x4e7d7a(0x129)](_0x1466eb=>_0x1466eb['id']===_0x4b082c);if(_0x2b46c0)return _0x2b46c0;try{return await _0x5131de[_0x4e7d7a(0x14a)][_0x4e7d7a(0x151)](_0x3504f1,_0x4b082c);}catch(_0x13e819){logger[_0x4e7d7a(0x12f)]('getSegment\x20failed\x20for\x20'+_0x4b082c+',\x20falling\x20back\x20to\x20getSegmentEntity:\x20'+_0x13e819);try{return await _0x5131de[_0x4e7d7a(0x14a)]['getSegmentEntity'](_0x4b082c);}catch(_0x47cff7){return logger[_0x4e7d7a(0x12f)](_0x4e7d7a(0x108)+_0x4b082c+':\x20'+_0x47cff7),null;}}}function recoverSegmentIdsFromPushRecovery(_0x446ff4,_0x280366,_0x4f1eee){const _0x2c9adf=a152_0x2723ce,_0x2d36ed=readPushRecovery(_0x446ff4['absolutePath']);if(_0x2d36ed?.[_0x2c9adf(0x190)]===_0x446ff4[_0x2c9adf(0x158)][_0x2c9adf(0x105)])for(const [_0xcb4f2b,_0x3f38dc]of Object[_0x2c9adf(0x13f)](_0x2d36ed[_0x2c9adf(0x125)])){const _0x59bc18=generateDeterministicJourneySegmentName(_0x446ff4[_0x2c9adf(0x158)][_0x2c9adf(0x105)],_0xcb4f2b);_0x3f38dc[_0x2c9adf(0xee)]===_0x59bc18&&(_0x280366[_0x2c9adf(0x118)](_0xcb4f2b,_0x3f38dc['segmentId']),_0x4f1eee[_0x2c9adf(0x118)](_0xcb4f2b,_0x3f38dc[_0x2c9adf(0x176)]));}}async function createOrRecoverEmbeddedSegment(_0x4d60ff,_0x54604b,_0xc578d8,_0x1b14dd){const _0x168c33=a152_0x2723ce;let _0x29a44f;try{_0x29a44f=await _0x4d60ff[_0x168c33(0x14a)][_0x168c33(0x171)]({'name':_0xc578d8[_0x168c33(0x12c)],'description':_0xc578d8[_0x168c33(0x149)],'journeyId':_0xc578d8['journeyId'],'rule':_0x1b14dd(_0xc578d8['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0xc578d8[_0x168c33(0x1c5)],'audienceId':_0xc578d8[_0x168c33(0x130)]});}catch(_0x5147ab){const _0x4749d8=_0x5147ab instanceof Error&&_0x5147ab['message']['includes'](_0x168c33(0x1d0));if(_0x4749d8){const _0x15357d=readPushRecovery(_0x54604b[_0x168c33(0xd7)]),_0xd12e1e=_0x15357d?.[_0x168c33(0x190)]===_0x54604b['yamlConfig'][_0x168c33(0x105)]?_0x15357d[_0x168c33(0x125)][_0xc578d8[_0x168c33(0x120)]]:undefined;if(_0xd12e1e?.['uniqueServerName']===_0xc578d8['uniqueSegmentName'])await _0x4d60ff[_0x168c33(0x14a)][_0x168c33(0x10c)](_0xc578d8[_0x168c33(0x130)],_0xd12e1e['segmentId'],{'description':_0xc578d8[_0x168c33(0x149)],'rule':_0x1b14dd(_0xc578d8[_0x168c33(0x1b9)],!![]),'countPopulation':!![]}),_0x29a44f=_0xd12e1e[_0x168c33(0x176)];else throw new SDKError(ErrorCode[_0x168c33(0x1b3)],_0x168c33(0xfc)+_0xc578d8[_0x168c33(0x120)]+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+(_0x168c33(0x19f)+_0x54604b[_0x168c33(0xd7)][_0x168c33(0x1ca)](/([^/]+)$/,_0x168c33(0xf5))+')\x20')+_0x168c33(0xdd),_0x5147ab);}else throw _0x5147ab;}return saveSegmentToPushRecovery(_0x54604b[_0x168c33(0xd7)],_0x54604b[_0x168c33(0x158)][_0x168c33(0x105)],_0xc578d8['localName'],{'segmentId':_0x29a44f,'uniqueServerName':_0xc578d8[_0x168c33(0x12c)],'createdAt':new Date()[_0x168c33(0xf0)]()}),_0x29a44f;}export async function prepareSegmentFiles(_0x1718c0,_0x25ce61,_0x23a53b,_0x7f2615,_0x181539){const _0x439721=a152_0x2723ce,{activationDefToCreateRequest:_0x1069e1}=await import(_0x439721(0x162)),_0x204583=[],_0x688cc0=new Set();for(const {yamlConfig:_0x577096,folderPath:_0x5ba979,sourcePath:_0x4d234d}of _0x1718c0){const _0x4a1f90=resolveTDFolderPath(_0x5ba979,_0x7f2615,_0x181539),_0x5cd91a=_0x4a1f90+':'+_0x577096[_0x439721(0x105)],_0xb479d3=_0x25ce61[_0x439721(0x154)][_0x439721(0x178)](_0x5cd91a),_0x78d353=_0xb479d3?_0x25ce61['activationsBySegmentId']['get'](_0xb479d3['id'])||[]:[];addFoldersToCreate(_0x4a1f90,_0x25ce61[_0x439721(0x197)],_0x688cc0);const _0x2d9fd5=calculateActivationActions(_0x577096[_0x439721(0x142)]||[],_0x78d353,_0x25ce61[_0x439721(0x13a)],_0x25ce61['connectionIdToNameMap']);for(const _0xc483ed of _0x2d9fd5){(_0xc483ed['type']==='create'||_0xc483ed[_0x439721(0x1b8)]===_0x439721(0x161))&&_0xc483ed['yamlActivation']&&(_0xc483ed['validatedRequest']=await _0x1069e1(_0xc483ed['yamlActivation'],_0x23a53b));}const _0x25150f=calculateSegmentDiff(_0x577096,_0xb479d3,_0x78d353,_0x25ce61['idToEmailMap'],_0x25ce61[_0x439721(0x17a)]);_0x204583[_0x439721(0x1b7)]({'relativePath':_0x577096['name'],'absolutePath':_0x4d234d,'yamlConfig':_0x577096,'folderPath':_0x4a1f90,'existingSegment':_0xb479d3,'existingActivations':_0x78d353,'isNew':_0x25150f[_0x439721(0x159)],'hasChanges':_0x25150f['hasChanges'],'diff':_0x25150f[_0x439721(0x196)],'activationActions':_0x2d9fd5});}return{'segmentFiles':_0x204583,'foldersToCreate':_0x688cc0};}export async function prepareJourneyFiles(_0x1a8b64,_0x51c281,_0x56087f,_0x3eca26){const _0xd4e970=a152_0x2723ce,_0x496afb=[],_0x725e29=new Set();for(const {yamlConfig:_0x2fb6ce,folderPath:_0x493a55,sourcePath:_0x3cf935}of _0x1a8b64){const _0x52f62c=resolveTDFolderPath(_0x493a55,_0x56087f,_0x3eca26),_0x89175a=_0x52f62c+':'+_0x2fb6ce[_0xd4e970(0x105)],_0x21914f=_0x51c281[_0xd4e970(0x166)][_0xd4e970(0x178)](_0x89175a);let _0x3d84a6,_0x4f5ebc;if(_0x21914f&&_0x21914f[_0xd4e970(0x103)]>0x0){const _0x2c9e34=buildLocalExpandedRuleMappings(_0x2fb6ce),{createYamlContext:_0x3c4b46,prefetchJourneySegments:_0xe770b7}=createPushYamlContextForBundle(_0x51c281[_0xd4e970(0xe8)],_0x51c281[_0xd4e970(0x130)],_0x51c281[_0xd4e970(0x1cb)],_0x2c9e34,_0x51c281[_0xd4e970(0x13a)],_0x51c281[_0xd4e970(0x17a)],_0x51c281['activationStepsById'],_0x51c281[_0xd4e970(0xd6)]);await _0xe770b7(_0x21914f[_0xd4e970(0x111)](_0xdc8fe=>_0xdc8fe['id']));const _0x3d416e=await _0x51c281[_0xd4e970(0xe8)]['journey'][_0xd4e970(0x160)](_0x21914f[0x0][_0xd4e970(0xf1)]),_0x564a3d=hasMultipleVersions(_0x2fb6ce),_0x43e0c8=async _0x3ed98d=>{const _0x591f48=_0xd4e970,_0x2adb4d=_0x51c281[_0x591f48(0xd6)]?.[_0x591f48(0x178)](_0x3ed98d);if(_0x2adb4d)return _0x2adb4d;return _0x51c281['fetchJourney']({'journeyId':_0x3ed98d,'journeyName':_0x2fb6ce[_0x591f48(0x105)],'isMultiVersion':_0x21914f[_0x591f48(0x103)]>0x1});};if(_0x564a3d&&_0x21914f['length']>0x1){const _0x1df653=[];for(const _0x3cb252 of _0x21914f){const _0x17bc9d=_0x3cb252['versionNumber']||0x1;_0x51c281[_0xd4e970(0x15e)]?.[_0xd4e970(0x161)](_0xd4e970(0x1b0)+_0x2fb6ce['name']+'\x20v'+_0x17bc9d);const _0x57281a=await _0x43e0c8(_0x3cb252['id']),_0x471770=_0x3c4b46(_0x3cb252['id']),_0x1b5048=await journeyResponseToDef(_0x57281a,_0x471770);_0x1df653[_0xd4e970(0x1b7)]({'item':_0x3cb252,'yaml':_0x1b5048});}const _0x41fd5a=buildLocalRuleToNameMappingFromJourney(_0x2fb6ce);_0x4f5ebc=buildMergedJourneyDef(_0x1df653,_0x41fd5a,_0x3d416e);const _0x48e2e1=Math['max'](..._0x1df653[_0xd4e970(0x111)](_0x1fab7b=>_0x1fab7b[_0xd4e970(0x123)][_0xd4e970(0xfe)]||0x0)),_0x53830d=_0x21914f['find'](_0x261813=>(_0x261813[_0xd4e970(0xfe)]||0x0)===_0x48e2e1);_0x53830d&&(_0x51c281[_0xd4e970(0x15e)]?.['update']('Fetching\x20'+_0x2fb6ce['name']+'\x20v'+_0x48e2e1),_0x3d84a6=await _0x43e0c8(_0x53830d['id']));}else{const _0x394c28=_0x21914f[_0x21914f[_0xd4e970(0x103)]-0x1];_0x51c281[_0xd4e970(0x15e)]?.[_0xd4e970(0x161)]('Fetching\x20'+_0x2fb6ce[_0xd4e970(0x105)]),_0x3d84a6=await _0x43e0c8(_0x394c28['id']);const _0x3598f3=_0x3c4b46(_0x394c28['id']),_0x25455a=await journeyResponseToDef(_0x3d84a6,_0x3598f3),_0x1a34ed=buildLocalRuleToNameMappingFromJourney(_0x2fb6ce);_0x4f5ebc=buildMergedJourneyDef([{'item':_0x394c28,'yaml':_0x25455a}],_0x1a34ed,_0x3d416e);}}addFoldersToCreate(_0x52f62c,_0x51c281[_0xd4e970(0x197)],_0x725e29);const _0x3e6e07=calculateJourneyDiff(_0x2fb6ce,_0x4f5ebc);_0x496afb[_0xd4e970(0x1b7)]({'relativePath':_0x2fb6ce[_0xd4e970(0x105)],'absolutePath':_0x3cf935,'yamlConfig':_0x2fb6ce,'folderPath':_0x52f62c,'existingJourney':_0x3d84a6,'isNew':_0x3e6e07[_0xd4e970(0x159)],'hasChanges':_0x3e6e07[_0xd4e970(0x122)],'diff':_0x3e6e07['diff']});}return{'journeyFiles':_0x496afb,'foldersToCreate':_0x725e29};}export function calculateActivationActions(_0x482dd2,_0x60f5b5,_0x53ecfc,_0x322875){const _0x3d97a1=a152_0x2723ce,_0x4fd022=[],_0x30e368=new Map();for(const _0x2d18b9 of _0x60f5b5){_0x30e368[_0x3d97a1(0x118)](_0x2d18b9[_0x3d97a1(0x105)],_0x2d18b9);}const _0x18ed6b=new Map();for(const _0x19a4a4 of _0x482dd2){_0x18ed6b[_0x3d97a1(0x118)](_0x19a4a4[_0x3d97a1(0x105)],_0x19a4a4);}for(const _0x57a6ed of _0x482dd2){const _0x3e292b=_0x30e368['get'](_0x57a6ed['name']);if(!_0x3e292b)_0x4fd022[_0x3d97a1(0x1b7)]({'type':_0x3d97a1(0x182),'name':_0x57a6ed[_0x3d97a1(0x105)],'yamlActivation':_0x57a6ed});else{const _0x320f2c=activationResponseToDef(_0x3e292b,_0x53ecfc,_0x322875),_0x58be13=a152_0x432775[_0x3d97a1(0x1a0)](_0x320f2c),_0x4b8146=a152_0x432775[_0x3d97a1(0x1a0)](_0x57a6ed);_0x58be13!==_0x4b8146&&_0x4fd022[_0x3d97a1(0x1b7)]({'type':_0x3d97a1(0x161),'name':_0x57a6ed[_0x3d97a1(0x105)],'yamlActivation':_0x57a6ed,'existingActivation':_0x3e292b});}}for(const _0x4415b4 of _0x60f5b5){!_0x18ed6b[_0x3d97a1(0x19c)](_0x4415b4[_0x3d97a1(0x105)])&&_0x4fd022[_0x3d97a1(0x1b7)]({'type':_0x3d97a1(0x13c),'name':_0x4415b4['name'],'existingActivation':_0x4415b4});}return _0x4fd022;}function calculateYamlDiff(_0xe50309,_0x3c7fcf){if(_0x3c7fcf){const _0x13d632=generateDiff(_0x3c7fcf,_0xe50309),_0x39a24d=hasChanges(_0x13d632);return{'isNew':![],'hasChanges':_0x39a24d,'diff':_0x39a24d?formatDiffWithColors(_0x13d632):undefined};}const _0x52d838=generateDiff('',_0xe50309);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x52d838)};}export function calculateSegmentDiff(_0x2ab684,_0x98bde5,_0x5a66aa,_0x2cf6f0,_0x57b8a9){const _0x22fbe5=segmentToYamlString(_0x2ab684),_0x2002d8=_0x98bde5?segmentToYamlString(segmentWithActivationsToYaml(_0x98bde5,_0x5a66aa,undefined,_0x2cf6f0,_0x57b8a9)):undefined;return calculateYamlDiff(_0x22fbe5,_0x2002d8);}export function calculateJourneyDiff(_0x4f8ab6,_0x574e64){const _0x1db3b3=normalizeJourneyDef(_0x4f8ab6,_0x4f8ab6),_0x4be342=a152_0x4b9e18(_0x1db3b3),_0x1b0dff=_0x574e64?a152_0x4b9e18(normalizeJourneyDef(_0x574e64,_0x4f8ab6)):undefined;return calculateYamlDiff(_0x4be342,_0x1b0dff);}export function findSegmentsToDelete(_0x652871,_0x5aab1c,_0x5d4956,_0xce877b,_0x352340){const _0x3d521e=a152_0x2723ce,_0x1d7669=new Set();for(const {yamlConfig:_0x3ce6f7,folderPath:_0x48d7cb}of _0x5aab1c){_0x1d7669[_0x3d521e(0x1c6)](_0x48d7cb+':'+_0x3ce6f7[_0x3d521e(0x105)]);}return _0x652871[_0x3d521e(0x1c3)](_0x516190=>{const _0x397ca0=_0x3d521e,_0x3e2bb3=_0x516190['segmentFolderId']?_0x5d4956[_0x397ca0(0x178)](_0x516190[_0x397ca0(0x121)][_0x397ca0(0x16c)]())||'':'',_0x3eea09=_0x3e2bb3+':'+_0x516190[_0x397ca0(0x105)];if(_0x1d7669[_0x397ca0(0x19c)](_0x3eea09))return![];if(_0x352340)return _0x3e2bb3===_0xce877b||_0x3e2bb3[_0x397ca0(0x13d)](_0xce877b+'/');return!![];});}export function findJourneysToDelete(_0x1c8fde,_0x156419,_0x4b5215,_0x2545b0,_0x5be482){const _0x1e3c0d=a152_0x2723ce,_0x1dcae9=new Set();for(const {yamlConfig:_0x57b087,folderPath:_0x3a8118}of _0x156419){_0x1dcae9[_0x1e3c0d(0x1c6)](_0x3a8118+':'+_0x57b087['name']);}return _0x1c8fde['filter'](_0x57ef66=>{const _0x18e774=_0x1e3c0d,_0xc837e8=_0x57ef66[_0x18e774(0x1c5)]?_0x4b5215[_0x18e774(0x178)](_0x57ef66[_0x18e774(0x1c5)])||'':'',_0x6bbbda=_0xc837e8+':'+_0x57ef66[_0x18e774(0x15f)];if(_0x1dcae9[_0x18e774(0x19c)](_0x6bbbda))return![];if(_0x5be482)return _0xc837e8===_0x2545b0||_0xc837e8[_0x18e774(0x13d)](_0x2545b0+'/');return!![];});}function a152_0x6faf(){const _0x49eca8=['state','connection','localName','segmentFolderId','hasChanges','item','201hlDeBZ','segments','schedule','stage\x20\x27','segment_updated','find','\x20(referenced\x20in\x20journey\x20','entry_criteria','uniqueSegmentName','getJourney','Updated\x20segment\x20\x27','debug','parentId','rootFolderId','DecisionPoint','unchanged','relationships','embedded_segment_creating','Segment\x20not\x20found:\x20','entryCriteria','Duration','keys','idToEmailMap','Failed\x20to\x20resolve\x20segment\x20','delete','startsWith','activationActions','entries','all_columns','toLowerCase','activations','match','logSuccess','SEGMENT_NOT_FOUND','reduce','embeddedSegmentNameToId','waitStepUnit','description','segment','day','conditionTimeoutDuration','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','relative','hex','Created\x20activation\x20\x27','getSegment','Creating\x20folder\x20\x27','journeyId','segmentByFolderAndName','Stage\x20\x27','sort','withProgress','yamlConfig','isNew','Failed\x20to\x20resolve\x20activation\x20','buildUserMaps','activationContext','journeys','progress','journeyBundleName','getLatestJourneyId','update','./child-segment-yaml.js','data','3032256ZgUfpI','nameToType','journeyBundlesByFolderAndName','activation_deleted',').\x20','with','deleteSegment','\x20error(s)','toString','branches','journeyStages','logDeleted','journey_updating','createJourneySegment','Entry\x20criteria:\x20','activation_created','WaitStep','list','segmentId','segmentNameToId','get','\x27\x20exit\x20criteria','connectionIdToNameMap','listActivations','2pVlYdM','Journey\x20\x27','Failed\x20to\x20fetch\x20referenced\x20segment\x20','../../utils/async.js','validatedRequest','\x27\x20not\x20found\x20in\x20journey\x20\x27','create','ACTIVATION_UPDATE_ERROR','segment_created','utf-8','3845UyZIKP','782893BPnNAJ','conditionSegmentId','journey','decision_point','rule','Updating\x20activation\x20\x27','tdx.sdk.push-workflow','embedded_activation_creating','folderPath','journeyName','existingJourney','user','\x27\x20for\x20','verbose','\x27\x20entry\x20criteria','diff','folderPathToId','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','\x27\x20from\x20file:\x20','some','exitCriterias','has','66460djFBeu','activation_template_id','Delete\x20the\x20push\x20recovery\x20file\x20(','stringify','behavior','nameToId','effectiveFolderId','Segment\x20not\x20found','size','segment_deleted','8RSyPkO','errors','embedded_segment_created','valid','action','waitStepType','run_after_journey_refresh','digest','connector_config','Fetching\x20','logWarning','parentFolder','SEGMENT_UPDATE_ERROR','all','trim','\x20journey\x20from\x20file:\x20','push','type','resolvedRule','SEGMENT_SYNTAX_ERROR','deleteActivation','Matched\x20server\x20segment\x20\x27','\x27\x20by\x20rule\x20content','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','deleted','null','Failed\x20to\x20','Condition','filter','entry','folderId','add','activationParams','resolveSegment','waitStep','replace','existingSegments','steps','Created\x20folder\x20\x27','243yYuZav','createdSegmentIds','Name\x20has\x20already\x20been\x20taken','3018YVtnAz','\x0a\x20\x20','Created\x20journey\x20\x27','flatMap','dirname','journey_entry_criteria_','notification','INTERNAL','13BnKkeu','\x27\x20milestone','journeyById','absolutePath','activation_deleting','createSegment','conditionTimeoutUnit','NOT_FOUND','idToName','and\x20the\x20server\x20segment,\x20then\x20retry.','Created\x20segment\x20\x27','createActivation','slice','\x27...','__pending_','folder','index','parse','Activation\x20not\x20found:\x20','journeyActivationNameToId','deps','createFolder','activation_updating','activation_','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','46100fbibIv','uniqueServerName','458703AhNfhU','toISOString','journeyBundleId','goal','1178859TeRuIe','Activation','.$1.push-recovery.json','conditions','split','updateActivation','JOURNEY_UPDATE_ERROR','Updating\x20segment\x20\x27','skipSegments','Embedded\x20segment\x20\x27','from','versionNumber','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','\x27\x20wait\x20condition','stages','existingSegment','length','values','name','attributes','results','getSegmentEntity\x20also\x20failed\x20for\x20','existingActivation','updated','activation_creating','updateSegmentById','activation_updated','folder_created','onProgress','Deleted\x20activation\x20\x27','map','join','./journey-yaml.js','journey_creating','journeyActivationStepId','milestone','created','set','createdSegmentId','columns','journey_updated','parentSegmentFolder','\x27\x20decision\x20point\x20branch\x20\x27'];a152_0x6faf=function(){return _0x49eca8;};return a152_0x6faf();}export function buildSegmentLookupMap(_0x320263,_0xf8745a){const _0x5bae10=a152_0x2723ce,_0x1c82c8=new Map();for(const _0x58113a of _0x320263){const _0x16322f=_0x58113a[_0x5bae10(0x121)]?_0xf8745a[_0x5bae10(0x178)](_0x58113a['segmentFolderId'][_0x5bae10(0x16c)]())||'':'',_0x1b51ae=_0x16322f+':'+_0x58113a['name'];_0x1c82c8['set'](_0x1b51ae,_0x58113a);}return _0x1c82c8;}export function buildSegmentNameToIdMap(_0x3feeb4){const _0x37586f=a152_0x2723ce,_0x229e95=new Map();for(const _0x4878b1 of _0x3feeb4){_0x229e95[_0x37586f(0x118)](_0x4878b1['name'],_0x4878b1['id']);}return _0x229e95;}export function buildJourneyBundleLookupMap(_0x1bddde,_0x399ddf){const _0x5d5513=a152_0x2723ce,_0x4aefc9=new Map();for(const _0x2b7ff5 of _0x1bddde){const _0xe3a556=_0x2b7ff5[_0x5d5513(0x1c5)]?_0x399ddf[_0x5d5513(0x178)](_0x2b7ff5[_0x5d5513(0x1c5)])||'':'',_0x1f1527=_0xe3a556+':'+_0x2b7ff5[_0x5d5513(0x15f)];!_0x4aefc9[_0x5d5513(0x19c)](_0x1f1527)&&_0x4aefc9[_0x5d5513(0x118)](_0x1f1527,[]),_0x4aefc9[_0x5d5513(0x178)](_0x1f1527)[_0x5d5513(0x1b7)](_0x2b7ff5);}for(const _0x7d7b06 of _0x4aefc9[_0x5d5513(0x104)]()){_0x7d7b06[_0x5d5513(0x156)]((_0x21513f,_0xd0e4f2)=>(_0x21513f[_0x5d5513(0xfe)]||0x0)-(_0xd0e4f2[_0x5d5513(0xfe)]||0x0));}return _0x4aefc9;}export function collectFoldersToCreate(_0x13e3d1,_0x1df4f3){const _0xcae019=a152_0x2723ce,_0x26511b=new Set();for(const _0x1208e6 of _0x13e3d1){if(!_0x1208e6)continue;if(_0x1df4f3['has'](_0x1208e6))continue;const _0x24271a=_0x1208e6[_0xcae019(0xf7)]('/');let _0x4146b6='';for(const _0x3eaf87 of _0x24271a){_0x4146b6=_0x4146b6?_0x4146b6+'/'+_0x3eaf87:_0x3eaf87,!_0x1df4f3[_0xcae019(0x19c)](_0x4146b6)&&_0x26511b[_0xcae019(0x1c6)](_0x4146b6);}}return _0x26511b;}export function parseAndClassifyYamlFiles(_0x351768,_0x3b506d,_0x14a678){const _0x3d5e5f=a152_0x2723ce,_0x150292=[],_0xba1899=[];for(const _0x3473a4 of _0x351768){const _0x352081=a152_0x57e623['relative'](_0x3b506d,a152_0x57e623[_0x3d5e5f(0xd0)](_0x3473a4)),_0x3f041c=_0x352081==='.'?'':_0x352081[_0x3d5e5f(0x1ca)](/\\/g,'/'),_0x31d6ad=readFileSync(_0x3473a4,_0x3d5e5f(0x185)),_0x88a69f=a152_0x432775['parse'](_0x31d6ad);if(isJourneyDef(_0x88a69f)){const _0x21fc68=a152_0x35d44f(_0x31d6ad);_0xba1899[_0x3d5e5f(0x1b7)]({'yamlConfig':_0x21fc68,'folderPath':_0x3f041c,'sourcePath':_0x3473a4});}else{if(!_0x14a678?.[_0x3d5e5f(0xfb)]){const _0x47a287=parseSegmentYamlFile(_0x31d6ad),_0x4e0ce7=normalizeChildSegmentYaml(_0x47a287);_0x150292[_0x3d5e5f(0x1b7)]({'yamlConfig':_0x4e0ce7,'folderPath':_0x3f041c,'sourcePath':_0x3473a4});}}}return{'segments':_0x150292,'journeys':_0xba1899};}export function validateParsedFiles(_0xa47f74,_0x2ccc46){const _0x5be031=a152_0x2723ce,_0x1952fc=[];for(const {yamlConfig:_0xeed5e4,sourcePath:_0x20db30}of _0xa47f74[_0x5be031(0x125)]){const _0x21ffc5=readFileSync(_0x20db30,_0x5be031(0x185)),_0x380e5a=a152_0x432775['parseDocument'](_0x21ffc5),_0x23e6ba=validateSegmentDef(_0xeed5e4,{'source':_0x21ffc5,'document':_0x380e5a},{'skipSchema':!![]});if(!_0x23e6ba[_0x5be031(0x1aa)]){const _0x238ff0=a152_0x57e623['relative'](_0x2ccc46,_0x20db30);_0x1952fc['push']({'filePath':_0x238ff0,'source':_0x21ffc5,'result':_0x23e6ba,'isJourney':![]});}}for(const {yamlConfig:_0x26c79e,sourcePath:_0x497a34}of _0xa47f74[_0x5be031(0x15d)]){const _0x1064f6=readFileSync(_0x497a34,_0x5be031(0x185)),_0x436c7c=a152_0x432775['parseDocument'](_0x1064f6),_0xb65f53=validateJourneyDef(_0x26c79e,{'source':_0x1064f6,'document':_0x436c7c},{'skipSchema':!![]});if(!_0xb65f53['valid']){const _0x3aadfc=a152_0x57e623[_0x5be031(0x14e)](_0x2ccc46,_0x497a34);_0x1952fc[_0x5be031(0x1b7)]({'filePath':_0x3aadfc,'source':_0x1064f6,'result':_0xb65f53,'isJourney':!![]});}}return _0x1952fc;}export function formatValidationErrors(_0x26bb6f){const _0x2b4103=a152_0x2723ce,_0x582df9=[];for(const {filePath:_0x1c04b7,source:_0x4b0183,result:_0x1374ae,isJourney:_0x402b81}of _0x26bb6f){const _0x2c73ce=_0x402b81?'journey':_0x2b4103(0x14a);_0x582df9['push']('\x0a'+_0x1c04b7+'\x20('+_0x2c73ce+'):\x20'+_0x1374ae[_0x2b4103(0x1a8)][_0x2b4103(0x103)]+_0x2b4103(0x16b)),_0x582df9[_0x2b4103(0x1b7)](formatValidationResult(_0x1374ae,_0x4b0183,_0x1c04b7));}return _0x582df9[_0x2b4103(0x112)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x4ded3f){const _0x42929e=a152_0x2723ce,_0x57ab14=new Set(),_0x12c430=new Map(),_0x4dc4a2=collectSegmentUsageCounts(_0x4ded3f);if(_0x4ded3f[_0x42929e(0x125)])for(const [_0x212fcf,_0x11cac5]of Object[_0x42929e(0x13f)](_0x4ded3f['segments'])){_0x57ab14[_0x42929e(0x1c6)](_0x212fcf);if(_0x11cac5[_0x42929e(0x18b)]){const _0x21f4e4=yamlRuleToApi(_0x11cac5['rule']),_0x3b0f93=apiRuleToYaml(_0x21f4e4);_0x12c430[_0x42929e(0x118)](_0x212fcf,_0x3b0f93);}}const _0x5c1553=new Map();let _0x65ecd0=0x0;for(const [_0x1a0999,_0x32dbee]of _0x12c430){const _0x3df61f=serializeExpandedRule(_0x32dbee,_0x12c430),_0x242abc=_0x5c1553['get'](_0x3df61f)||[];_0x242abc[_0x42929e(0x1b7)]({'name':_0x1a0999,'index':_0x65ecd0}),_0x5c1553[_0x42929e(0x118)](_0x3df61f,_0x242abc),_0x65ecd0++;}const _0x4662ad=new Map();for(const [_0x5dbe35,_0x389cc1]of _0x5c1553){const _0x4725b1=_0x389cc1['slice']()['sort']((_0x1dcb79,_0x3ed958)=>{const _0x19573c=_0x42929e,_0x34d43b=_0x4dc4a2[_0x19573c(0x178)](_0x1dcb79['name'])||0x0,_0x3c02a8=_0x4dc4a2[_0x19573c(0x178)](_0x3ed958[_0x19573c(0x105)])||0x0;if(_0x34d43b!==_0x3c02a8)return _0x3c02a8-_0x34d43b;return _0x1dcb79[_0x19573c(0xe4)]-_0x3ed958[_0x19573c(0xe4)];})[_0x42929e(0x111)](_0x2a58d9=>_0x2a58d9[_0x42929e(0x105)]),_0x27d9e5=[];for(const _0x27fba7 of _0x4725b1){const _0x237f4f=_0x4dc4a2[_0x42929e(0x178)](_0x27fba7)||0x0,_0x2a98cd=Math['max'](_0x237f4f,0x1);for(let _0x40e5cb=0x0;_0x40e5cb<_0x2a98cd;_0x40e5cb++){_0x27d9e5['push'](_0x27fba7);}}_0x4662ad[_0x42929e(0x118)](_0x5dbe35,_0x27d9e5);}return{'existingLocalSegmentNames':_0x57ab14,'localSegmentRules':_0x12c430,'localExpandedRuleToNames':_0x4662ad};}export function createSegmentIdResolver(_0x5759a0,_0x576ef5){return async _0x3fc08f=>{const _0x156702=a152_0x282b,_0x27562b=_0x5759a0['get'](_0x3fc08f);if(!_0x27562b)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x156702(0x136)+_0x3fc08f+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x576ef5+'\x27)');return _0x27562b;};}export function extractRootFolderId(_0x55865c){const _0x2a85d1=a152_0x2723ce;return _0x55865c['relationships']?.[_0x2a85d1(0x11c)]?.[_0x2a85d1(0x163)]?.['id']||_0x55865c[_0x2a85d1(0x134)]?.[_0x2a85d1(0x1b2)]?.[_0x2a85d1(0x163)]?.['id'];}export function buildConnectionMaps(_0x4c1261){const _0x5a543e=a152_0x2723ce,_0x526ce5=new Map(),_0x2af9b4=new Map(),_0x48462c=new Map();for(const _0x181dfb of _0x4c1261){_0x526ce5[_0x5a543e(0x118)](_0x181dfb['name'],parseInt(_0x181dfb['id'],0xa)),_0x2af9b4[_0x5a543e(0x118)](_0x181dfb['id'],_0x181dfb[_0x5a543e(0x105)]),_0x48462c[_0x5a543e(0x118)](_0x181dfb['name'],_0x181dfb[_0x5a543e(0x1b8)]);}return{'nameToId':_0x526ce5,'idToName':_0x2af9b4,'nameToType':_0x48462c};}export function calculatePushStats(_0x44d36f,_0xea1aa3,_0x242da9,_0x2f5a7e,_0x1c6b1b,_0x2fe4e2,_0x42ae5b){const _0x27c308=a152_0x2723ce,_0x1b7aca=_0x44d36f['filter'](_0x1c3436=>_0x1c3436[_0x27c308(0x159)]),_0xfde73d=_0x44d36f[_0x27c308(0x1c3)](_0x384209=>!_0x384209[_0x27c308(0x159)]&&_0x384209[_0x27c308(0x122)]),_0x1c0bc6=_0x44d36f['filter'](_0x2d94ad=>!_0x2d94ad[_0x27c308(0x159)]&&!_0x2d94ad['hasChanges']),_0x4ba61d=_0x2fe4e2?_0x2f5a7e:[],_0x32c081=_0xea1aa3[_0x27c308(0x1c3)](_0x33d136=>_0x33d136[_0x27c308(0x159)]),_0x33903e=_0xea1aa3[_0x27c308(0x1c3)](_0x291ed1=>!_0x291ed1[_0x27c308(0x159)]&&_0x291ed1[_0x27c308(0x122)]),_0x31cb42=_0xea1aa3[_0x27c308(0x1c3)](_0x52bf75=>!_0x52bf75['isNew']&&!_0x52bf75[_0x27c308(0x122)]),_0x54ab92=_0x2fe4e2?_0x1c6b1b:[],_0x1c1c11=_0x44d36f[_0x27c308(0xcf)](_0x1a5f9b=>_0x1a5f9b[_0x27c308(0x13e)]),_0x477da9=_0x1c1c11[_0x27c308(0x1c3)](_0x3bb7dc=>_0x3bb7dc[_0x27c308(0x1b8)]===_0x27c308(0x182)),_0x4651a4=_0x1c1c11[_0x27c308(0x1c3)](_0x114310=>_0x114310[_0x27c308(0x1b8)]===_0x27c308(0x161)),_0xd1715f=_0x1c1c11[_0x27c308(0x1c3)](_0x593243=>_0x593243[_0x27c308(0x1b8)]===_0x27c308(0x13c)),_0x5d5c06=Array[_0x27c308(0xfd)](_0x242da9)['sort'](),_0x1659b3=_0x42ae5b?![]:_0x1b7aca[_0x27c308(0x103)]>0x0||_0xfde73d[_0x27c308(0x103)]>0x0||_0x4ba61d[_0x27c308(0x103)]>0x0,_0x26b04b=_0x32c081['length']>0x0||_0x33903e[_0x27c308(0x103)]>0x0||_0x54ab92[_0x27c308(0x103)]>0x0,_0x517314=_0x42ae5b?![]:_0x1c1c11['length']>0x0,_0x58cae8=_0x5d5c06['length']>0x0;return{'segments':{'new':_0x1b7aca,'changed':_0xfde73d,'unchanged':_0x1c0bc6,'toDelete':_0x4ba61d},'journeys':{'new':_0x32c081,'changed':_0x33903e,'unchanged':_0x31cb42,'toDelete':_0x54ab92},'activations':{'all':_0x1c1c11,'toCreate':_0x477da9,'toUpdate':_0x4651a4,'toDelete':_0xd1715f},'folders':{'toCreate':_0x5d5c06},'counts':{'segments':{'new':_0x1b7aca['length'],'changed':_0xfde73d[_0x27c308(0x103)],'unchanged':_0x1c0bc6[_0x27c308(0x103)],'toDelete':_0x4ba61d[_0x27c308(0x103)]},'journeys':{'new':_0x32c081['length'],'changed':_0x33903e['length'],'unchanged':_0x31cb42[_0x27c308(0x103)],'toDelete':_0x54ab92['length']},'activations':{'create':_0x477da9[_0x27c308(0x103)],'update':_0x4651a4['length'],'delete':_0xd1715f[_0x27c308(0x103)]},'folders':_0x5d5c06['length']},'hasChanges':_0x1659b3||_0x26b04b||_0x517314||_0x58cae8};}export async function buildPushExecutionContext(_0x4b703e,_0x16b4b2,_0x1af07f,_0x2dd664,_0x4dc1a0,_0xf71774){const _0x548e56=a152_0x2723ce,_0x1ea6b0=extractRootFolderId(_0x1af07f),{pathToId:_0x447fd0,idToPath:_0x261706}=buildFolderMaps(_0x4dc1a0),_0x1a6d20=buildSegmentNameToIdMap(_0x2dd664),_0x51d2de=new Map(),{batchAsync:_0x569667}=await import(_0x548e56(0x17f)),[_0x281ce3,_0x3ea970]=await Promise[_0x548e56(0x1b4)]([_0x4b703e[_0x548e56(0x192)][_0x548e56(0x15b)](),_0x4b703e['connection'][_0x548e56(0x175)](),((async()=>{const _0x44c206=_0x548e56;!_0xf71774&&_0x2dd664[_0x44c206(0x103)]>0x0&&await _0x569667(_0x2dd664,async _0xb72026=>{const _0x18cd07=_0x44c206,_0x2f5a5c=await _0x4b703e[_0x18cd07(0x14a)][_0x18cd07(0x17b)](_0x16b4b2,_0xb72026['id']);_0x51d2de[_0x18cd07(0x118)](_0xb72026['id'],_0x2f5a5c);});})())]),{emailToId:_0x3ab083,idToEmail:_0x3d48df}=_0x281ce3,_0x33fe66=buildConnectionMaps(_0x3ea970);return{'rootFolderId':_0x1ea6b0,'folderPathToId':_0x447fd0,'folderIdToPath':_0x261706,'segmentNameToId':_0x1a6d20,'activationsBySegmentId':_0x51d2de,'emailToIdMap':_0x3ab083,'idToEmailMap':_0x3d48df,'connectionNameToIdMap':_0x33fe66[_0x548e56(0x1a2)],'connectionIdToNameMap':_0x33fe66[_0x548e56(0xdc)],'connectionNameToTypeMap':_0x33fe66[_0x548e56(0x165)]};}export function createPushYamlContextForBundle(_0x81411f,_0x585669,_0x22992f,_0x335832,_0x43f913,_0x4128a7,_0x5ae625,_0x194b1f){const {existingLocalSegmentNames:_0x4e6b75,localExpandedRuleToNames:_0xa2f317}=_0x335832,_0x2e19c0=new Set(),_0x5d6d9f=new Map(),_0x56d071=new Map(),_0x157da1=new Map(),_0x36fa8b=createJumpTargetCache(),_0x3b0812=new Map(),_0x50af0a=new Map(),_0x39419c=new Set();let _0x147afb;const _0x2fea74=_0x2a1264=>{const _0x3f1c67={'resolveSegment':async _0x3d4c3f=>{const _0x194faf=a152_0x282b,_0x57ed35=_0x157da1[_0x194faf(0x178)](_0x3d4c3f);if(_0x57ed35!==undefined)return{'name':_0x57ed35,'isJourneyLocal':!![]};try{const _0x4e6d3c=await fetchSegment(_0x81411f,_0x585669,_0x3d4c3f,_0x22992f);if(!_0x4e6d3c)throw new Error(_0x194faf(0x1a4));const _0x2e72c8=generateJourneyLocalName(_0x4e6d3c[_0x194faf(0x105)]),_0x482af3=_0x4e6d3c['kind']===SEGMENT_KIND_JOURNEY&&_0x2e72c8!==undefined;let _0x68b049=_0x4e6d3c[_0x194faf(0x105)],_0x3b6d98;if(_0x482af3&&_0x4e6d3c[_0x194faf(0x18b)]){const _0x558929=apiRuleToYaml(_0x4e6d3c[_0x194faf(0x18b)]);_0x50af0a[_0x194faf(0x118)](_0x3d4c3f,_0x558929);const _0x13aefa=async _0x32e0b2=>{const _0xe0fdd9=_0x194faf,_0x483e27=collectSegmentRefsFromRule(_0x32e0b2);for(const _0x5495c7 of _0x483e27){if(!_0x50af0a['has'](_0x5495c7))try{const _0x3c90a8=await fetchSegment(_0x81411f,_0x585669,_0x5495c7,_0x22992f);if(_0x3c90a8?.[_0xe0fdd9(0x18b)]){const _0x39dc50=apiRuleToYaml(_0x3c90a8['rule']);_0x50af0a[_0xe0fdd9(0x118)](_0x5495c7,_0x39dc50),await _0x13aefa(_0x39dc50);}}catch(_0x20da62){logger[_0xe0fdd9(0x12f)](_0xe0fdd9(0x17e)+_0x5495c7+':\x20'+_0x20da62);}}};await _0x13aefa(_0x558929);const _0x7db5b=serializeExpandedRule(_0x558929,_0x50af0a),_0x534d44=_0xa2f317[_0x194faf(0x178)](_0x7db5b);if(_0x534d44&&_0x534d44[_0x194faf(0x103)]>0x0){const _0x22fb9c=_0x5d6d9f[_0x194faf(0x178)](_0x7db5b)||0x0,_0x5de59a=_0x534d44[_0x22fb9c]||_0x534d44[_0x534d44[_0x194faf(0x103)]-0x1];_0x5d6d9f['set'](_0x7db5b,_0x22fb9c+0x1),_0x68b049=_0x5de59a,_0x2e19c0['add'](_0x68b049),_0x157da1[_0x194faf(0x118)](_0x3d4c3f,_0x68b049);const _0x4962d2=await resolveRuleSegmentRefs(_0x558929,async _0x2f1203=>{const _0x3547fd=_0x194faf,_0x10b489=_0x157da1[_0x3547fd(0x178)](_0x2f1203);if(_0x10b489)return _0x10b489;const _0x1fbb40=await _0x147afb[_0x3547fd(0x1c8)](_0x2f1203);return _0x1fbb40[_0x3547fd(0x105)];});_0x3b6d98={'description':_0x4e6d3c['description'],'rule':_0x4962d2};}else{const _0x49b808=_0x3b0812[_0x194faf(0x178)](_0x7db5b);if(_0x49b808)_0x68b049=_0x49b808,_0x157da1['set'](_0x3d4c3f,_0x68b049);else{if(_0x2e72c8){let _0x166d0b=_0x2e72c8,_0x478e4c=0x2;while(_0x2e19c0['has'](_0x166d0b)||_0x4e6b75[_0x194faf(0x19c)](_0x166d0b)){_0x166d0b=_0x2e72c8+'_'+_0x478e4c,_0x478e4c++;}_0x2e19c0[_0x194faf(0x1c6)](_0x166d0b),_0x68b049=_0x166d0b;}_0x157da1[_0x194faf(0x118)](_0x3d4c3f,_0x68b049),_0x3b0812[_0x194faf(0x118)](_0x7db5b,_0x68b049);const _0x26337a=await resolveRuleSegmentRefs(_0x558929,async _0x40e01e=>{const _0x2da995=_0x194faf,_0x3a1c97=_0x157da1[_0x2da995(0x178)](_0x40e01e);if(_0x3a1c97)return _0x3a1c97;const _0x3f8a97=await _0x147afb[_0x2da995(0x1c8)](_0x40e01e);return _0x3f8a97[_0x2da995(0x105)];});_0x3b6d98={'description':_0x4e6d3c[_0x194faf(0x149)],'rule':_0x26337a};}}}return{'name':_0x68b049,'isJourneyLocal':_0x482af3,'definition':_0x3b6d98};}catch(_0x2da541){return logger['debug'](_0x194faf(0x13b)+_0x3d4c3f+':\x20'+_0x2da541),{'name':_0x3d4c3f,'isJourneyLocal':![]};}},'resolveActivation':async _0x1dcd79=>{const _0xb96819=a152_0x282b,_0x221748=_0x56d071[_0xb96819(0x178)](_0x1dcd79);if(_0x221748!==undefined)return{'name':_0x221748,'isJourneyLocal':!![]};try{let _0x29010f=_0x5ae625?.[_0xb96819(0x178)](_0x1dcd79);!_0x29010f&&(_0x29010f=await _0x81411f[_0xb96819(0x189)]['getActivation'](_0x2a1264,_0x1dcd79));const _0x4e99ea=_0x29010f['attributes'][_0xb96819(0x1c7)][_0xb96819(0x105)]||_0x1dcd79,_0x4c41d7=sanitizeYamlKey(_0x4e99ea)||_0xb96819(0xeb)+_0x1dcd79,_0x531aaf=_0x4c41d7;_0x56d071['set'](_0x1dcd79,_0x531aaf);const _0x297b8e=journeyActivationStepToYaml(_0x29010f,_0x43f913,_0x4128a7);return{'name':_0x531aaf,'isJourneyLocal':!![],'definition':_0x297b8e};}catch(_0x18b0a8){return logger[_0xb96819(0x12f)](_0xb96819(0x15a)+_0x1dcd79+':\x20'+_0x18b0a8),{'name':_0x1dcd79,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x12198e,_0x1d0150)=>resolveJumpTarget(_0x12198e,_0x1d0150,_0x36fa8b,async _0x4907e2=>{const _0x54e437=a152_0x282b,_0x48e472=_0x194b1f?.['get'](_0x4907e2);if(_0x48e472)return _0x48e472;return _0x81411f[_0x54e437(0x189)]['getJourney'](_0x4907e2);})};return _0x147afb=_0x3f1c67,_0x3f1c67;},_0x18291d=async _0x4ea96f=>{const _0x32fb36=a152_0x282b,{collectSegmentIdsFromJourneyApi:_0x4a902a}=await import(_0x32fb36(0x113)),{batchAsync:_0x2be9f0}=await import('../../utils/async.js'),_0x2d91aa=new Set();for(const _0xf7e37a of _0x4ea96f){let _0x53c29b=_0x194b1f?.['get'](_0xf7e37a);!_0x53c29b&&(_0x53c29b=await _0x81411f['journey'][_0x32fb36(0x12d)](_0xf7e37a));const _0x30c86b=_0x4a902a(_0x53c29b);for(const _0x36e30b of _0x30c86b){_0x2d91aa[_0x32fb36(0x1c6)](_0x36e30b);}}let _0x2226b0=Array[_0x32fb36(0xfd)](_0x2d91aa);while(_0x2226b0[_0x32fb36(0x103)]>0x0){const _0x389b87=_0x2226b0[_0x32fb36(0x1c3)](_0x3d54c0=>!_0x39419c['has'](_0x3d54c0));if(_0x389b87['length']===0x0)break;const _0x1a3242=await _0x2be9f0(_0x389b87,async _0x18744b=>{_0x39419c['add'](_0x18744b);const _0x2c97aa=await fetchSegment(_0x81411f,_0x585669,_0x18744b,_0x22992f);if(!_0x2c97aa)return null;return{'segmentId':_0x18744b,'segment':_0x2c97aa};},0xa),_0x5e874e=new Set();for(const _0x1f258e of _0x1a3242){if(!_0x1f258e?.['segment']?.[_0x32fb36(0x18b)])continue;const _0x59455d=apiRuleToYaml(_0x1f258e[_0x32fb36(0x14a)]['rule']);_0x50af0a[_0x32fb36(0x118)](_0x1f258e[_0x32fb36(0x176)],_0x59455d);const _0x12daa1=collectSegmentRefsFromRule(_0x59455d);for(const _0x329488 of _0x12daa1){!_0x39419c[_0x32fb36(0x19c)](_0x329488)&&_0x5e874e[_0x32fb36(0x1c6)](_0x329488);}}_0x2226b0=Array[_0x32fb36(0xfd)](_0x5e874e);}};return{'createYamlContext':_0x2fea74,'prefetchJourneySegments':_0x18291d};}export async function executePushSegments(_0x13b978,_0x240ddd,_0x15a5a7,_0x2ee927,_0x48ce3f){const _0x4bc54a=a152_0x2723ce,{segmentDefToCreateRequest:_0x1a27ab,segmentDefToUpdateRequest:_0x730f4a}=await import(_0x4bc54a(0x162)),_0x42709f=_0x15a5a7[_0x4bc54a(0x197)],_0x1b099a=0x5,_0x4a4162=async _0x4128b0=>{const _0x16cafa=_0x4bc54a,_0x314bd9=_0x4128b0[_0x16cafa(0x18f)]?_0x42709f['get'](_0x4128b0[_0x16cafa(0x18f)]):undefined;let _0x362af7;const _0x4de135={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x14f80c=_0x4128b0[_0x16cafa(0x158)];if(_0x4128b0[_0x16cafa(0x158)][_0x16cafa(0x18b)]){const _0xb50952=createSegmentIdResolver(_0x15a5a7['segmentNameToId'],_0x4128b0[_0x16cafa(0x158)][_0x16cafa(0x105)]),_0x24ec5d=await resolveRuleSegmentIds(_0x4128b0[_0x16cafa(0x158)]['rule'],_0xb50952);_0x14f80c={..._0x4128b0[_0x16cafa(0x158)],'rule':_0x24ec5d};}try{if(_0x4128b0[_0x16cafa(0x159)]){_0x48ce3f['onProgress']?.({'type':'segment_creating','name':_0x4128b0[_0x16cafa(0x158)][_0x16cafa(0x105)]});const _0x4eafca=_0x1a27ab(_0x14f80c,_0x314bd9),_0x322a03=await _0x48ce3f[_0x16cafa(0x157)]('Creating\x20segment\x20\x27'+_0x4128b0['yamlConfig']['name']+'\x27...',()=>_0x13b978[_0x16cafa(0x14a)][_0x16cafa(0xd9)](_0x2ee927[_0x16cafa(0x130)],_0x4eafca));_0x362af7=_0x322a03[_0x16cafa(0x163)]['id'],_0x15a5a7[_0x16cafa(0x177)][_0x16cafa(0x118)](_0x4128b0[_0x16cafa(0x158)][_0x16cafa(0x105)],_0x362af7),_0x4de135[_0x16cafa(0x119)]={'name':_0x4128b0[_0x16cafa(0x158)][_0x16cafa(0x105)],'id':_0x362af7},_0x48ce3f['onProgress']?.({'type':_0x16cafa(0x184),'name':_0x4128b0[_0x16cafa(0x158)][_0x16cafa(0x105)],'segmentId':_0x362af7}),_0x48ce3f[_0x16cafa(0x144)]?.(_0x16cafa(0xde)+_0x4128b0['yamlConfig'][_0x16cafa(0x105)]+'\x27'),_0x4de135[_0x16cafa(0x117)]=0x1;}else{if(_0x4128b0[_0x16cafa(0x122)]){_0x48ce3f[_0x16cafa(0x10f)]?.({'type':'segment_updating','name':_0x4128b0['yamlConfig'][_0x16cafa(0x105)]});const _0xb6d402=_0x730f4a(_0x14f80c);_0x314bd9!==_0x4128b0[_0x16cafa(0x102)]?.['segmentFolderId']&&(_0xb6d402[_0x16cafa(0x121)]=_0x314bd9?parseInt(_0x314bd9,0xa):undefined),await _0x48ce3f[_0x16cafa(0x157)](_0x16cafa(0xfa)+_0x4128b0[_0x16cafa(0x158)][_0x16cafa(0x105)]+_0x16cafa(0xe1),()=>_0x13b978[_0x16cafa(0x14a)]['updateSegmentById'](_0x2ee927[_0x16cafa(0x130)],_0x4128b0[_0x16cafa(0x102)]['id'],_0xb6d402)),_0x362af7=_0x4128b0[_0x16cafa(0x102)]['id'],_0x48ce3f[_0x16cafa(0x10f)]?.({'type':_0x16cafa(0x128),'name':_0x4128b0[_0x16cafa(0x158)][_0x16cafa(0x105)]}),_0x48ce3f[_0x16cafa(0x144)]?.(_0x16cafa(0x12e)+_0x4128b0[_0x16cafa(0x158)][_0x16cafa(0x105)]+'\x27'),_0x4de135[_0x16cafa(0x10a)]=0x1;}else _0x362af7=_0x4128b0[_0x16cafa(0x102)]['id'];}}catch(_0xcd8662){const _0x12ff72=isHttp400Error(_0xcd8662),_0x4ec8ae=_0x12ff72?ErrorCode[_0x16cafa(0x1ba)]:ErrorCode[_0x16cafa(0x1b3)],_0x296a5e=getErrorMessage(_0xcd8662);throw new SDKError(_0x4ec8ae,_0x16cafa(0x1c1)+(_0x4128b0[_0x16cafa(0x159)]?_0x16cafa(0x182):_0x16cafa(0x161))+'\x20segment\x20from\x20file:\x20'+_0x4128b0['absolutePath']+'\x0a\x20\x20'+_0x296a5e,_0xcd8662);}try{const _0x57bf46=await syncActivationsForSegment(_0x13b978,_0x2ee927[_0x16cafa(0x130)],_0x362af7,_0x4128b0[_0x16cafa(0x158)]['name'],_0x4128b0[_0x16cafa(0x13e)],_0x48ce3f,_0x4128b0[_0x16cafa(0xd7)]);_0x4de135[_0x16cafa(0x142)]=_0x57bf46;}catch(_0x2e9c7e){if(_0x2e9c7e instanceof SDKError)throw _0x2e9c7e;throw new SDKError(ErrorCode[_0x16cafa(0x183)],_0x16cafa(0x1be)+_0x4128b0[_0x16cafa(0x158)][_0x16cafa(0x105)]+_0x16cafa(0x199)+_0x4128b0[_0x16cafa(0xd7)]+_0x16cafa(0xcd)+getErrorMessage(_0x2e9c7e),_0x2e9c7e);}return _0x4de135;},_0x4b0797=await batchAsync(_0x240ddd,_0x4a4162,_0x1b099a),_0x117a58={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x159093 of _0x4b0797){_0x117a58[_0x4bc54a(0x117)]+=_0x159093[_0x4bc54a(0x117)],_0x117a58[_0x4bc54a(0x10a)]+=_0x159093[_0x4bc54a(0x10a)],_0x159093[_0x4bc54a(0x119)]&&_0x117a58[_0x4bc54a(0x1cf)]['set'](_0x159093[_0x4bc54a(0x119)]['name'],_0x159093[_0x4bc54a(0x119)]['id']),_0x117a58[_0x4bc54a(0x142)][_0x4bc54a(0x117)]+=_0x159093['activations']['created'],_0x117a58[_0x4bc54a(0x142)][_0x4bc54a(0x10a)]+=_0x159093[_0x4bc54a(0x142)][_0x4bc54a(0x10a)],_0x117a58['activations']['deleted']+=_0x159093[_0x4bc54a(0x142)][_0x4bc54a(0x1bf)];}return _0x117a58;}async function syncActivationsForSegment(_0xc67869,_0x2d3525,_0x419c57,_0x321f42,_0x444d7f,_0x4602b7,_0x16ec5b){const _0x3f1f83=a152_0x2723ce,_0x2c8eb3={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x5f20bd of _0x444d7f){try{if(_0x5f20bd['type']==='create'&&_0x5f20bd[_0x3f1f83(0x180)])_0x4602b7[_0x3f1f83(0x10f)]?.({'type':_0x3f1f83(0x10b),'segmentName':_0x321f42,'activationName':_0x5f20bd[_0x3f1f83(0x105)]}),await _0x4602b7[_0x3f1f83(0x157)]('Creating\x20activation\x20\x27'+_0x5f20bd['name']+_0x3f1f83(0xe1),()=>_0xc67869[_0x3f1f83(0x14a)][_0x3f1f83(0xdf)](_0x2d3525,_0x419c57,_0x5f20bd[_0x3f1f83(0x180)])),_0x4602b7[_0x3f1f83(0x10f)]?.({'type':_0x3f1f83(0x173),'segmentName':_0x321f42,'activationName':_0x5f20bd[_0x3f1f83(0x105)]}),_0x4602b7['logSuccess']?.(_0x3f1f83(0x150)+_0x5f20bd['name']+'\x27'),_0x2c8eb3[_0x3f1f83(0x117)]++;else{if(_0x5f20bd[_0x3f1f83(0x1b8)]==='update'&&_0x5f20bd[_0x3f1f83(0x180)]&&_0x5f20bd['existingActivation'])_0x4602b7[_0x3f1f83(0x10f)]?.({'type':_0x3f1f83(0xea),'segmentName':_0x321f42,'activationName':_0x5f20bd[_0x3f1f83(0x105)]}),await _0x4602b7[_0x3f1f83(0x157)](_0x3f1f83(0x18c)+_0x5f20bd[_0x3f1f83(0x105)]+_0x3f1f83(0xe1),()=>_0xc67869[_0x3f1f83(0x14a)][_0x3f1f83(0xf8)](_0x2d3525,_0x419c57,_0x5f20bd[_0x3f1f83(0x109)]['id'],_0x5f20bd[_0x3f1f83(0x180)])),_0x4602b7[_0x3f1f83(0x10f)]?.({'type':_0x3f1f83(0x10d),'segmentName':_0x321f42,'activationName':_0x5f20bd['name']}),_0x4602b7[_0x3f1f83(0x144)]?.('Updated\x20activation\x20\x27'+_0x5f20bd[_0x3f1f83(0x105)]+'\x27'),_0x2c8eb3['updated']++;else _0x5f20bd[_0x3f1f83(0x1b8)]==='delete'&&_0x5f20bd[_0x3f1f83(0x109)]&&(_0x4602b7[_0x3f1f83(0x10f)]?.({'type':_0x3f1f83(0xd8),'segmentName':_0x321f42,'activationName':_0x5f20bd[_0x3f1f83(0x105)]}),await _0x4602b7['withProgress']('Deleting\x20activation\x20\x27'+_0x5f20bd[_0x3f1f83(0x105)]+_0x3f1f83(0xe1),()=>_0xc67869[_0x3f1f83(0x14a)][_0x3f1f83(0x1bb)](_0x2d3525,_0x419c57,_0x5f20bd[_0x3f1f83(0x109)]['id'])),_0x4602b7[_0x3f1f83(0x10f)]?.({'type':_0x3f1f83(0x167),'segmentName':_0x321f42,'activationName':_0x5f20bd[_0x3f1f83(0x105)]}),_0x4602b7[_0x3f1f83(0x16f)]?.(_0x3f1f83(0x110)+_0x5f20bd[_0x3f1f83(0x105)]+'\x27'),_0x2c8eb3[_0x3f1f83(0x1bf)]++);}}catch(_0x1ac5b0){const _0xdadeea=isHttp400Error(_0x1ac5b0),_0x4662a6=_0xdadeea?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0x3f1f83(0x183)],_0x11abb5=getErrorMessage(_0x1ac5b0);throw new SDKError(_0x4662a6,_0x3f1f83(0x1c1)+_0x5f20bd[_0x3f1f83(0x1b8)]+'\x20activation\x20\x27'+_0x5f20bd[_0x3f1f83(0x105)]+_0x3f1f83(0x199)+_0x16ec5b+_0x3f1f83(0xcd)+_0x11abb5,_0x1ac5b0);}}return _0x2c8eb3;}export async function executePushFolders(_0x1328fc,_0x2923aa,_0x266f97,_0x2c63c0,_0xa610cf){const _0x5d7f0e=a152_0x2723ce,_0x436d99=new Map(_0x266f97),_0x27a376=sortFoldersByDepth(_0x2923aa);for(const _0x54aca0 of _0x27a376){const _0x3b80f7=_0x54aca0[_0x5d7f0e(0xf7)]('/'),_0x3126cf=_0x3b80f7[_0x3b80f7['length']-0x1],_0x3029bf=_0x3b80f7[_0x5d7f0e(0xe0)](0x0,-0x1)[_0x5d7f0e(0x112)]('/'),_0x382143=_0x436d99['get'](_0x3029bf);_0xa610cf['onProgress']?.({'type':'folder_creating','folder':_0x54aca0});const _0x3f8cb5={'name':_0x3126cf,'parentFolderId':_0x382143},_0x4633d2=await _0xa610cf[_0x5d7f0e(0x157)](_0x5d7f0e(0x152)+_0x54aca0+_0x5d7f0e(0xe1),()=>_0x1328fc[_0x5d7f0e(0x14a)][_0x5d7f0e(0xe9)](_0x2c63c0['parentId'],_0x3f8cb5));_0x436d99[_0x5d7f0e(0x118)](_0x54aca0,_0x4633d2[_0x5d7f0e(0x163)]['id']),_0xa610cf['onProgress']?.({'type':_0x5d7f0e(0x10e),'folder':_0x54aca0,'folderId':_0x4633d2[_0x5d7f0e(0x163)]['id']}),_0xa610cf['logInfo']?.(_0x5d7f0e(0x1cd)+_0x54aca0+'\x27');}return _0x436d99;}export async function executePushSegmentDeletions(_0x1e62e6,_0x1d2cc7,_0x1b4c3f){const _0x1cface=a152_0x2723ce;if(_0x1d2cc7['length']===0x0)return 0x0;const {batchAsync:_0x5e278c}=await import('../../utils/async.js'),_0x3a67a1=0x5,_0x2b29b5=await _0x5e278c(_0x1d2cc7,async _0x3ef044=>{const _0x3f8b56=a152_0x282b;return _0x1b4c3f[_0x3f8b56(0x10f)]?.({'type':'segment_deleting','name':_0x3ef044['name']}),await _0x1e62e6['segment'][_0x3f8b56(0x16a)](_0x3ef044['id']),_0x1b4c3f[_0x3f8b56(0x10f)]?.({'type':_0x3f8b56(0x1a6),'name':_0x3ef044['name']}),_0x1b4c3f['logDeleted']?.('Deleted\x20segment\x20\x27'+_0x3ef044[_0x3f8b56(0x105)]+'\x27'),0x1;},_0x3a67a1);return _0x2b29b5[_0x1cface(0x146)]((_0x531a7d,_0x29c6ec)=>_0x531a7d+_0x29c6ec,0x0);}export async function executePushJourneys(_0x285d2f,_0x37f03d,_0x167dfc,_0x1f8410,_0x391809){const _0x1bf121=a152_0x2723ce,{journeyDefToRequest:_0x1f67ce}=await import(_0x1bf121(0x113)),{activationDefToCreateRequest:_0xa154e8,yamlRuleToApi:_0x39b5fd,validateSegmentRule:_0x9aaa5d}=await import(_0x1bf121(0x162)),_0x3da8a0={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x3cc125=new Map(_0x167dfc[_0x1bf121(0x177)]),_0x5a4138=0x5;for(let _0x3111b1=0x0;_0x3111b1<_0x37f03d[_0x1bf121(0x103)];_0x3111b1+=_0x5a4138){const _0x4a90bc=_0x37f03d[_0x1bf121(0xe0)](_0x3111b1,_0x3111b1+_0x5a4138),_0x5a8ded=await Promise[_0x1bf121(0x1b4)](_0x4a90bc[_0x1bf121(0x111)](async _0x191241=>{const _0x319eb0=_0x1bf121;if(!_0x191241[_0x319eb0(0x159)]&&!_0x191241[_0x319eb0(0x122)])return{'action':_0x319eb0(0x133),'name':_0x191241[_0x319eb0(0x158)]['name'],'journeyId':_0x191241[_0x319eb0(0x191)]?.['id']};const _0x3ae5fc=_0x191241[_0x319eb0(0x18f)]?_0x167dfc['folderPathToId'][_0x319eb0(0x178)](_0x191241['folderPath']):undefined;_0x391809[_0x319eb0(0x10f)]?.({'type':_0x191241[_0x319eb0(0x159)]?_0x319eb0(0x114):_0x319eb0(0x170),'name':_0x191241[_0x319eb0(0x158)]['name']});try{const _0x991e03=await executeSingleJourneyPush(_0x285d2f,_0x191241,{..._0x167dfc,'segmentNameToId':_0x3cc125},{'parentId':_0x1f8410[_0x319eb0(0x130)],'rootFolderId':_0x1f8410['rootFolderId'],'folderId':_0x3ae5fc,'verbose':_0x1f8410[_0x319eb0(0x194)]},_0x391809,{'journeyDefToRequest':_0x1f67ce,'activationDefToCreateRequest':_0xa154e8,'yamlRuleToApi':_0x39b5fd,'validateSegmentRule':_0x9aaa5d});for(const [_0x2169cb,_0x33897a]of _0x991e03['embeddedSegmentNameToId']){_0x3cc125['set'](_0x2169cb,_0x33897a),_0x3da8a0[_0x319eb0(0x147)][_0x319eb0(0x118)](_0x2169cb,_0x33897a);}if(_0x991e03[_0x319eb0(0x1ab)]==='created')_0x391809['onProgress']?.({'type':'journey_created','name':_0x191241[_0x319eb0(0x158)]['name'],'journeyId':_0x991e03[_0x319eb0(0x153)]}),_0x391809['logSuccess']?.(_0x319eb0(0xce)+_0x191241['yamlConfig'][_0x319eb0(0x105)]+'\x27'),_0x3da8a0[_0x319eb0(0x117)]++;else _0x991e03[_0x319eb0(0x1ab)]===_0x319eb0(0x10a)&&(_0x391809[_0x319eb0(0x10f)]?.({'type':_0x319eb0(0x11b),'name':_0x191241['yamlConfig'][_0x319eb0(0x105)]}),_0x391809['logSuccess']?.('Updated\x20journey\x20\x27'+_0x191241[_0x319eb0(0x158)]['name']+'\x27'),_0x3da8a0[_0x319eb0(0x10a)]++);return{'action':_0x991e03[_0x319eb0(0x1ab)],'name':_0x191241[_0x319eb0(0x158)][_0x319eb0(0x105)],'journeyId':_0x991e03[_0x319eb0(0x153)]};}catch(_0x1fe996){const _0x491692=isHttp400Error(_0x1fe996),_0x1ea8f6=_0x491692?ErrorCode['JOURNEY_SYNTAX_ERROR']:ErrorCode[_0x319eb0(0xf9)],_0x1235cb=getErrorMessage(_0x1fe996);throw new SDKError(_0x1ea8f6,'Failed\x20to\x20'+(_0x191241['isNew']?_0x319eb0(0x182):_0x319eb0(0x161))+_0x319eb0(0x1b6)+_0x191241[_0x319eb0(0xd7)]+'\x0a\x20\x20'+_0x1235cb,_0x1fe996);}}));_0x3da8a0[_0x1bf121(0x107)][_0x1bf121(0x1b7)](..._0x5a8ded);}return _0x3da8a0;}async function matchExistingJourneySegments(_0x5d12bf,_0x55f27d,_0x4dd83e,_0x3bc348,_0x66ce1a){const _0x4e9585=a152_0x2723ce;if(!_0x55f27d[_0x4e9585(0x191)]||!_0x55f27d[_0x4e9585(0x158)][_0x4e9585(0x125)])return;const _0x14bdb2=new Map(),_0x5f34ec=new Set();for(const _0x30f952 of Object[_0x4e9585(0x139)](_0x55f27d['yamlConfig'][_0x4e9585(0x125)])){const _0x1691bd=generateDeterministicJourneySegmentName(_0x55f27d[_0x4e9585(0x158)][_0x4e9585(0x105)],_0x30f952);_0x14bdb2[_0x4e9585(0x118)](_0x1691bd,_0x30f952),_0x5f34ec['add'](_0x30f952);}const _0x3bbbf2=[],_0x481c06=collectSegmentIdsFromJourneyApi(_0x55f27d[_0x4e9585(0x191)]);for(const _0x15c9af of _0x481c06){const _0x477d7c=await fetchSegment(_0x5d12bf,_0x4dd83e,_0x15c9af,_0x3bc348);if(!_0x477d7c?.['name'])continue;const _0x2ae91e=_0x14bdb2[_0x4e9585(0x178)](_0x477d7c[_0x4e9585(0x105)]);_0x2ae91e?(_0x66ce1a['set'](_0x2ae91e,_0x15c9af),_0x5f34ec[_0x4e9585(0x13c)](_0x2ae91e)):_0x3bbbf2['push']({'id':_0x15c9af,'seg':_0x477d7c});}if(_0x5f34ec[_0x4e9585(0x1a5)]>0x0&&_0x3bbbf2[_0x4e9585(0x103)]>0x0){const {localExpandedRuleToNames:_0x5d27be}=buildLocalExpandedRuleMappings(_0x55f27d[_0x4e9585(0x158)]),_0x4ee9a=new Map();for(const {id:_0x2fcdb9,seg:_0x52b153}of _0x3bbbf2){if(_0x52b153[_0x4e9585(0x18b)]){const _0x5e2f26=apiRuleToYaml(_0x52b153[_0x4e9585(0x18b)]);_0x4ee9a[_0x4e9585(0x118)](_0x2fcdb9,_0x5e2f26);}}for(const {id:_0x1be721,seg:_0x3ec15b}of _0x3bbbf2){if(!_0x3ec15b[_0x4e9585(0x18b)])continue;const _0x565f07=_0x4ee9a[_0x4e9585(0x178)](_0x1be721);if(!_0x565f07)continue;const _0x1efb9a=serializeExpandedRule(_0x565f07,_0x4ee9a),_0x1d2514=_0x5d27be[_0x4e9585(0x178)](_0x1efb9a);if(_0x1d2514){const _0x170592=_0x1d2514['find'](_0x452f36=>_0x5f34ec[_0x4e9585(0x19c)](_0x452f36));_0x170592&&(_0x66ce1a[_0x4e9585(0x118)](_0x170592,_0x1be721),_0x5f34ec['delete'](_0x170592),logger[_0x4e9585(0x12f)](_0x4e9585(0x1bc)+_0x3ec15b[_0x4e9585(0x105)]+'\x27\x20to\x20local\x20\x27'+_0x170592+_0x4e9585(0x1bd)));}}}}async function executeSingleJourneyPush(_0x1f8668,_0x2d518c,_0x26e6d2,_0x1da7c4,_0x212105,_0x2146f2){const _0x23a460=a152_0x2723ce,{journeyDefToRequest:_0x4866cc,activationDefToCreateRequest:_0x189309,yamlRuleToApi:_0x5f09da,validateSegmentRule:_0x36edf7}=_0x2146f2,_0x588277=new Map(),_0x3012f3=new Map();recoverSegmentIdsFromPushRecovery(_0x2d518c,_0x588277,_0x26e6d2[_0x23a460(0x177)]);const _0x31a6e3=new Map(),_0x3be5bb=new Map(),_0x12328c=new Map();let _0x3e5370;const _0x4dbd73=async()=>{const _0x76c9b1=_0x23a460;if(_0x3e5370)return;_0x3e5370=new Map();if(!_0x2d518c['existingJourney'])return;const _0x98cbd6=await _0x1f8668[_0x76c9b1(0x189)]['listActivations'](_0x2d518c[_0x76c9b1(0x191)]['id']);for(const _0x243fea of _0x98cbd6){const _0x3673d7=journeyActivationStepToYaml(_0x243fea,_0x26e6d2['idToEmailMap'],_0x26e6d2['connectionIdToNameMap']),_0x4b02a4=activationSignature(_0x3673d7);!_0x3e5370[_0x76c9b1(0x19c)](_0x4b02a4)&&_0x3e5370[_0x76c9b1(0x118)](_0x4b02a4,_0x243fea['id']),_0x3673d7[_0x76c9b1(0x105)]&&_0x3012f3[_0x76c9b1(0x118)](_0x3673d7[_0x76c9b1(0x105)],_0x243fea['id']);}};await matchExistingJourneySegments(_0x1f8668,_0x2d518c,_0x1da7c4[_0x23a460(0x130)],_0x26e6d2[_0x23a460(0x1cb)],_0x26e6d2['segmentNameToId']);const _0x2db053={'resolveSegmentId':async _0xe6dd5e=>{const _0x1e5b8f=_0x23a460,_0x25057e=_0x26e6d2[_0x1e5b8f(0x177)][_0x1e5b8f(0x178)](_0xe6dd5e);if(!_0x25057e)throw new SDKError(ErrorCode[_0x1e5b8f(0x145)],_0x1e5b8f(0x136)+_0xe6dd5e+_0x1e5b8f(0x12a)+_0x2d518c[_0x1e5b8f(0x158)][_0x1e5b8f(0x105)]+')');return _0x25057e;},'resolveEmbeddedSegmentId':async(_0x2d2094,_0x2582d2)=>{const _0x3cf064=_0x23a460,_0x490c17=_0x26e6d2[_0x3cf064(0x177)][_0x3cf064(0x178)](_0x2d2094);if(_0x490c17)return _0x490c17;const _0xdeacad=_0x26e6d2['existingSegments'][_0x3cf064(0x129)](_0x461d0e=>_0x461d0e['name']===_0x2d2094);if(_0xdeacad)return _0x26e6d2[_0x3cf064(0x177)][_0x3cf064(0x118)](_0x2d2094,_0xdeacad['id']),_0xdeacad['id'];if(_0x2d518c[_0x3cf064(0x159)]){const {stageName:_0x52ad38,criteriaName:_0x32b44}=findSegmentCriteriaLocation(_0x2d518c[_0x3cf064(0x158)],_0x2d2094);return _0x36edf7(_0x2d2094,_0x2582d2['rule']),_0x3be5bb['set'](_0x2d2094,{'definition':_0x2582d2,'stageName':_0x52ad38,'criteriaName':_0x32b44}),createPendingSegmentId(_0x2d2094);}const _0x286c7b=_0x2d518c[_0x3cf064(0x191)]?.['id'];if(!_0x286c7b)throw new SDKError(ErrorCode[_0x3cf064(0xd3)],_0x3cf064(0xec));const _0x2b6ba3=_0x31a6e3[_0x3cf064(0x178)](_0x2d2094);if(_0x2b6ba3)return _0x2b6ba3;const _0x5e9d75=((async()=>{const _0x164ac2=_0x3cf064;_0x36edf7(_0x2d2094,_0x2582d2[_0x164ac2(0x18b)]);const _0xb01358=generateDeterministicJourneySegmentName(_0x2d518c[_0x164ac2(0x158)][_0x164ac2(0x105)],_0x2d2094),_0x72248a=_0x26e6d2[_0x164ac2(0x1cb)]['find'](_0x4aa906=>_0x4aa906[_0x164ac2(0x105)]===_0xb01358),_0x8be10=createSegmentIdResolver(_0x26e6d2[_0x164ac2(0x177)],_0x2d2094),_0x548974=await resolveRuleSegmentIds(_0x2582d2[_0x164ac2(0x18b)],_0x8be10);let _0x269138;return _0x72248a?(await _0x1f8668['segment'][_0x164ac2(0x10c)](_0x1da7c4['parentId'],_0x72248a['id'],{'description':_0x2582d2[_0x164ac2(0x149)]||_0x164ac2(0x172)+_0x2d2094,'rule':_0x5f09da(_0x548974),'countPopulation':!![]}),_0x269138=_0x72248a['id'],saveSegmentToPushRecovery(_0x2d518c[_0x164ac2(0xd7)],_0x2d518c[_0x164ac2(0x158)][_0x164ac2(0x105)],_0x2d2094,{'segmentId':_0x269138,'uniqueServerName':_0xb01358,'createdAt':new Date()[_0x164ac2(0xf0)]()})):_0x269138=await createOrRecoverEmbeddedSegment(_0x1f8668,_0x2d518c,{'localName':_0x2d2094,'uniqueSegmentName':_0xb01358,'description':_0x2582d2['description']||_0x164ac2(0x172)+_0x2d2094,'journeyId':_0x286c7b,'resolvedRule':_0x548974,'parentId':_0x1da7c4[_0x164ac2(0x130)],'folderId':_0x1da7c4[_0x164ac2(0x131)]||''},_0x5f09da),_0x26e6d2[_0x164ac2(0x177)][_0x164ac2(0x118)](_0x2d2094,_0x269138),_0x588277[_0x164ac2(0x118)](_0x2d2094,_0x269138),_0x269138;})());_0x31a6e3[_0x3cf064(0x118)](_0x2d2094,_0x5e9d75);try{return await _0x5e9d75;}finally{_0x31a6e3['delete'](_0x2d2094);}},'resolveActivationId':async _0x416657=>{const _0x1dcfc1=_0x23a460,_0x1f5d61=_0x3012f3[_0x1dcfc1(0x178)](_0x416657);if(_0x1f5d61)return _0x1f5d61;if(_0x2d518c['existingJourney']){await _0x4dbd73();const _0xd045a0=_0x3012f3[_0x1dcfc1(0x178)](_0x416657);if(_0xd045a0)return _0xd045a0;}throw new SDKError(ErrorCode[_0x1dcfc1(0xdb)],_0x1dcfc1(0xe6)+_0x416657+'\x20(referenced\x20in\x20journey\x20'+_0x2d518c['yamlConfig']['name']+_0x1dcfc1(0x168)+_0x1dcfc1(0x14d));},'resolveEmbeddedActivationId':async(_0x1237cb,_0x873593)=>{const _0x1cf75f=_0x23a460,_0x5955c1=_0x3012f3[_0x1cf75f(0x178)](_0x1237cb);if(_0x5955c1)return _0x5955c1;if(_0x2d518c['isNew'])return _0x12328c[_0x1cf75f(0x118)](_0x1237cb,_0x873593),createPendingActivationId(_0x1237cb);if(_0x2d518c[_0x1cf75f(0x191)]){await _0x4dbd73();const _0x4413bd=_0x3012f3[_0x1cf75f(0x178)](_0x873593[_0x1cf75f(0x105)]);if(_0x4413bd)return _0x3012f3[_0x1cf75f(0x118)](_0x1237cb,_0x4413bd),_0x4413bd;const _0x1ad1e9=activationSignature(_0x873593),_0x23b556=_0x3e5370?.[_0x1cf75f(0x178)](_0x1ad1e9);if(_0x23b556)return _0x3012f3[_0x1cf75f(0x118)](_0x1237cb,_0x23b556),_0x23b556;const _0x27c7d3=await _0x189309(_0x873593,_0x26e6d2[_0x1cf75f(0x15c)]),_0x349ddd={..._0x27c7d3,..._0x873593[_0x1cf75f(0x1ad)]!==undefined&&{'runAfterJourneyRefresh':_0x873593[_0x1cf75f(0x1ad)]}},_0x3175a8=await _0x1f8668['journey'][_0x1cf75f(0xdf)](_0x2d518c[_0x1cf75f(0x191)]['id'],_0x349ddd);return _0x3012f3['set'](_0x1237cb,_0x3175a8['id']),_0x3175a8['id'];}throw new SDKError(ErrorCode['INTERNAL'],_0x1cf75f(0xff));},'resolveJourneyId':async _0x4a8457=>{const _0x49c0e3=_0x23a460;try{return await _0x1f8668[_0x49c0e3(0x189)]['resolveJourneyId'](_0x1da7c4[_0x49c0e3(0x130)],_0x4a8457);}catch(_0x938664){throw new SDKError(ErrorCode[_0x49c0e3(0xdb)],_0x49c0e3(0x17d)+_0x4a8457+_0x49c0e3(0x198)+_0x2d518c[_0x49c0e3(0x158)][_0x49c0e3(0x105)]+'\x27)',_0x938664);}},'resolveStageId':async(_0x118cf7,_0x91ed17)=>{const _0x40df7d=_0x23a460,_0x22fd1a=await _0x1f8668[_0x40df7d(0x189)][_0x40df7d(0x12d)](_0x118cf7),_0x2473de=_0x22fd1a['attributes'][_0x40df7d(0x16e)][_0x40df7d(0x129)](_0x14d13f=>_0x14d13f[_0x40df7d(0x105)]['toLowerCase']()===_0x91ed17[_0x40df7d(0x141)]());if(!_0x2473de?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],_0x40df7d(0x155)+_0x91ed17+_0x40df7d(0x181)+(_0x22fd1a[_0x40df7d(0x106)][_0x40df7d(0x15f)]||_0x22fd1a[_0x40df7d(0x106)][_0x40df7d(0x105)])+'\x27');return _0x2473de['id'];}},_0x8b174b=await _0x4866cc(_0x2d518c[_0x23a460(0x158)],_0x1da7c4[_0x23a460(0x130)],_0x2db053),_0x5e7e1e=_0x1da7c4[_0x23a460(0x1c5)]||_0x1da7c4[_0x23a460(0x131)];_0x5e7e1e&&(_0x8b174b[_0x23a460(0x134)]={'parentFolder':{'data':{'id':_0x5e7e1e,'type':_0x23a460(0xe3)}}});if(_0x2d518c['isNew']){if(_0x3be5bb[_0x23a460(0x1a5)]>0x0||_0x12328c[_0x23a460(0x1a5)]>0x0)return await executeThreeStepJourneyCreate(_0x1f8668,_0x2d518c,_0x8b174b,{'pendingEmbeddedSegments':_0x3be5bb,'pendingEmbeddedActivations':_0x12328c,'embeddedSegmentNameToId':_0x588277,'journeyActivationNameToId':_0x3012f3},{..._0x1da7c4,'effectiveFolderId':_0x5e7e1e},_0x26e6d2,_0x212105,_0x2146f2);else{ensureJourneyDefaults(_0x8b174b[_0x23a460(0x106)]);const _0x555a8a=await _0x1f8668[_0x23a460(0x189)][_0x23a460(0x182)](_0x8b174b);return deletePushRecovery(_0x2d518c['absolutePath']),{'action':_0x23a460(0x117),'journeyId':_0x555a8a['id'],'embeddedSegmentNameToId':_0x588277};}}else{if(_0x2d518c['hasChanges']&&_0x2d518c[_0x23a460(0x191)]){_0x8b174b['id']=_0x2d518c[_0x23a460(0x191)]['id'];const _0x1c1145=_0x8b174b[_0x23a460(0x106)];_0x2d518c[_0x23a460(0x191)][_0x23a460(0x106)]?.[_0x23a460(0x15f)]&&(_0x1c1145[_0x23a460(0x15f)]=_0x2d518c[_0x23a460(0x191)][_0x23a460(0x106)][_0x23a460(0x15f)]);const _0x17ba53=_0x2d518c['existingJourney'][_0x23a460(0x106)]?.[_0x23a460(0x16e)];return _0x17ba53&&_0x8b174b['attributes'][_0x23a460(0x16e)]&&injectExistingStageIds(_0x8b174b[_0x23a460(0x106)][_0x23a460(0x16e)],_0x17ba53),ensureJourneyDefaults(_0x1c1145),await _0x1f8668['journey'][_0x23a460(0x161)](_0x2d518c[_0x23a460(0x191)]['id'],_0x8b174b),deletePushRecovery(_0x2d518c[_0x23a460(0xd7)]),{'action':_0x23a460(0x10a),'journeyId':_0x2d518c[_0x23a460(0x191)]['id'],'embeddedSegmentNameToId':_0x588277};}}return deletePushRecovery(_0x2d518c['absolutePath']),{'action':_0x23a460(0x133),'journeyId':_0x2d518c['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x588277};}function findSegmentCriteriaLocation(_0x20f5ae,_0x4d420f){const _0x49d5f9=a152_0x2723ce,_0x1a4271=_0x20f5ae[_0x49d5f9(0x101)]||_0x20f5ae[_0x49d5f9(0x15d)]?.[0x0]?.[_0x49d5f9(0x101)]||[];let _0x51bc74=_0x49d5f9(0x1c4),_0x6f4696=_0x4d420f;const _0x58f0dd=_0x20f5ae[_0x49d5f9(0xf2)]||_0x20f5ae[_0x49d5f9(0x15d)]?.[0x0]?.[_0x49d5f9(0xf2)];if(_0x58f0dd?.['segment']===_0x4d420f)return{'stageName':'goal','criteriaName':_0x58f0dd[_0x49d5f9(0x105)]||_0x4d420f};_0x3c4827:for(const _0x2f953e of _0x1a4271){if(_0x2f953e['entry_criteria']?.[_0x49d5f9(0x14a)]===_0x4d420f){_0x51bc74=_0x2f953e[_0x49d5f9(0x105)],_0x6f4696=_0x2f953e[_0x49d5f9(0x12b)][_0x49d5f9(0x105)]||_0x4d420f;break;}if(_0x2f953e[_0x49d5f9(0x1cc)])for(const _0x1a3406 of _0x2f953e[_0x49d5f9(0x1cc)]){if(_0x1a3406[_0x49d5f9(0x1b8)]===_0x49d5f9(0x18a)&&_0x1a3406[_0x49d5f9(0x169)]?.[_0x49d5f9(0x16d)])for(const _0x4d2e20 of _0x1a3406[_0x49d5f9(0x169)]['branches']){if(_0x4d2e20[_0x49d5f9(0x14a)]===_0x4d420f){_0x51bc74=_0x2f953e[_0x49d5f9(0x105)],_0x6f4696=_0x4d2e20[_0x49d5f9(0x105)]||_0x4d420f;break _0x3c4827;}}}}return{'stageName':_0x51bc74,'criteriaName':_0x6f4696};}async function executeThreeStepJourneyCreate(_0x4a7e1d,_0x1afe88,_0x4b7adc,_0x3bd423,_0x76886e,_0x31f92e,_0x4815ba,_0x1a4fac){const _0x140820=a152_0x2723ce,{activationDefToCreateRequest:_0x411fbd,yamlRuleToApi:_0x46a6a4}=_0x1a4fac,{pendingEmbeddedSegments:_0x3dca93,pendingEmbeddedActivations:_0x117a93,embeddedSegmentNameToId:_0xdb0bb1}=_0x3bd423,_0x85349d=JSON[_0x140820(0xe5)](JSON[_0x140820(0x1a0)](_0x4b7adc));ensureJourneyDefaults(_0x85349d['attributes']),stripPendingIds(_0x85349d);const _0x195020=await _0x4a7e1d[_0x140820(0x189)]['create'](_0x85349d),_0x10053b=_0x195020['id'],_0x5ec62e=new Map();for(const _0x33563d of _0x195020[_0x140820(0x106)][_0x140820(0x16e)]){_0x5ec62e[_0x140820(0x118)](_0x33563d[_0x140820(0x105)][_0x140820(0x141)](),_0x33563d['id']);}recoverSegmentIdsFromPushRecovery(_0x1afe88,_0xdb0bb1,_0x31f92e[_0x140820(0x177)]);for(const [_0x4cc79d,{definition:_0x440861}]of _0x3dca93){if(_0xdb0bb1[_0x140820(0x19c)](_0x4cc79d)){_0x4815ba[_0x140820(0x10f)]?.({'type':'embedded_segment_created','journeyName':_0x1afe88[_0x140820(0x158)][_0x140820(0x105)],'segmentName':_0x4cc79d});continue;}const _0x2d30b8=generateDeterministicJourneySegmentName(_0x1afe88[_0x140820(0x158)][_0x140820(0x105)],_0x4cc79d);_0x4815ba[_0x140820(0x10f)]?.({'type':_0x140820(0x135),'journeyName':_0x1afe88[_0x140820(0x158)][_0x140820(0x105)],'segmentName':_0x4cc79d});const _0x43f584=createSegmentIdResolver(_0x31f92e[_0x140820(0x177)],_0x4cc79d),_0x1078c5=await resolveRuleSegmentIds(_0x440861['rule'],_0x43f584),_0x3a86e9=await createOrRecoverEmbeddedSegment(_0x4a7e1d,_0x1afe88,{'localName':_0x4cc79d,'uniqueSegmentName':_0x2d30b8,'description':_0x440861[_0x140820(0x149)]||_0x140820(0x172)+_0x4cc79d,'journeyId':_0x10053b,'resolvedRule':_0x1078c5,'parentId':_0x76886e[_0x140820(0x130)],'folderId':_0x76886e[_0x140820(0x1a3)]||''},_0x46a6a4);_0xdb0bb1[_0x140820(0x118)](_0x4cc79d,_0x3a86e9),_0x31f92e[_0x140820(0x177)][_0x140820(0x118)](_0x4cc79d,_0x3a86e9),_0x4815ba[_0x140820(0x10f)]?.({'type':_0x140820(0x1a9),'journeyName':_0x1afe88[_0x140820(0x158)][_0x140820(0x105)],'segmentName':_0x4cc79d});}const _0x3be553=new Map();for(const [_0x9db1bd,_0x41a637]of _0x117a93){_0x4815ba[_0x140820(0x10f)]?.({'type':_0x140820(0x18e),'journeyName':_0x1afe88['yamlConfig'][_0x140820(0x105)],'activationName':_0x9db1bd});const _0x20a7b8=await _0x411fbd(_0x41a637,_0x31f92e[_0x140820(0x15c)]),_0x17d017={..._0x20a7b8,..._0x41a637[_0x140820(0x1ad)]!==undefined&&{'runAfterJourneyRefresh':_0x41a637[_0x140820(0x1ad)]}},_0x187241=await _0x4a7e1d[_0x140820(0x189)]['createActivation'](_0x10053b,_0x17d017);_0x3be553['set'](_0x9db1bd,_0x187241['id']),_0x3bd423[_0x140820(0xe7)][_0x140820(0x118)](_0x9db1bd,_0x187241['id']),_0x4815ba['onProgress']?.({'type':'embedded_activation_created','journeyName':_0x1afe88[_0x140820(0x158)][_0x140820(0x105)],'activationName':_0x9db1bd});}const _0x2b1f22=JSON[_0x140820(0xe5)](JSON['stringify'](_0x4b7adc));return _0x2b1f22['id']=_0x10053b,ensureJourneyDefaults(_0x2b1f22['attributes']),resolvePendingIdsInRequest(_0x2b1f22,_0x4b7adc,_0x5ec62e,_0xdb0bb1,_0x3be553,_0x4815ba),await _0x4a7e1d[_0x140820(0x189)][_0x140820(0x161)](_0x10053b,_0x2b1f22),deletePushRecovery(_0x1afe88['absolutePath']),{'action':_0x140820(0x117),'journeyId':_0x10053b,'embeddedSegmentNameToId':_0xdb0bb1};}export function stripWaitStepPendingIds(_0xb9cec2){const _0x387300=a152_0x2723ce,_0x11c020=_0xb9cec2[_0x387300(0x188)]&&isPendingSegmentId(_0xb9cec2['conditionSegmentId']),_0x22e6ae=_0xb9cec2[_0x387300(0xf6)]?.['some'](_0x5a20d9=>_0x5a20d9[_0x387300(0x176)]&&isPendingSegmentId(_0x5a20d9['segmentId']));(_0x11c020||_0x22e6ae)&&(_0xb9cec2[_0x387300(0x1ac)]=_0x387300(0x138),_0xb9cec2[_0x387300(0x1c9)]=0x1,_0xb9cec2[_0x387300(0x148)]=_0x387300(0x14b),delete _0xb9cec2[_0x387300(0x188)],delete _0xb9cec2['conditionTimeoutDuration'],delete _0xb9cec2[_0x387300(0xda)],delete _0xb9cec2['conditions']);}export function resolveWaitStepPendingIds(_0x4136f1,_0x5ac211,_0x430396,_0x4e8421){const _0x29cc96=a152_0x2723ce;if(_0x5ac211[_0x29cc96(0x188)]&&isPendingSegmentId(_0x5ac211[_0x29cc96(0x188)])){const _0x1f0bb6=_0x430396(_0x5ac211[_0x29cc96(0x188)],_0x29cc96(0x127)+_0x4e8421+_0x29cc96(0x100));_0x1f0bb6&&(_0x4136f1[_0x29cc96(0x1ac)]=_0x29cc96(0x1c2),_0x4136f1[_0x29cc96(0x188)]=_0x1f0bb6,delete _0x4136f1[_0x29cc96(0x1c9)],delete _0x4136f1[_0x29cc96(0x148)],_0x5ac211['conditionTimeoutDuration']!==undefined&&(_0x4136f1[_0x29cc96(0x14c)]=_0x5ac211[_0x29cc96(0x14c)]),_0x5ac211[_0x29cc96(0xda)]&&(_0x4136f1[_0x29cc96(0xda)]=_0x5ac211[_0x29cc96(0xda)]));}if(_0x5ac211['conditions']){const _0x2eb71e=_0x5ac211['conditions'][_0x29cc96(0x19a)](_0x5333a2=>_0x5333a2['segmentId']&&isPendingSegmentId(_0x5333a2['segmentId']));if(_0x2eb71e){const _0x488a41=_0x5ac211[_0x29cc96(0xf6)][_0x29cc96(0x111)](_0x42ac1b=>{const _0x2307db=_0x29cc96;if(_0x42ac1b[_0x2307db(0x176)]&&isPendingSegmentId(_0x42ac1b[_0x2307db(0x176)])){const _0x5d88ed=_0x430396(_0x42ac1b[_0x2307db(0x176)],_0x2307db(0x127)+_0x4e8421+_0x2307db(0x100));return{..._0x42ac1b,'segmentId':_0x5d88ed||_0x42ac1b[_0x2307db(0x176)]};}return{..._0x42ac1b};});_0x4136f1[_0x29cc96(0x1ac)]=_0x29cc96(0x1c2),_0x4136f1[_0x29cc96(0xf6)]=_0x488a41,delete _0x4136f1[_0x29cc96(0x1c9)],delete _0x4136f1['waitStepUnit'],delete _0x4136f1[_0x29cc96(0x188)],delete _0x4136f1[_0x29cc96(0x14c)],delete _0x4136f1[_0x29cc96(0xda)];}}}function stripPendingIds(_0x7f75d6){const _0x54c6d8=a152_0x2723ce;_0x7f75d6[_0x54c6d8(0x106)]['goal']?.[_0x54c6d8(0x176)]&&isPendingSegmentId(_0x7f75d6[_0x54c6d8(0x106)][_0x54c6d8(0xf2)][_0x54c6d8(0x176)])&&delete _0x7f75d6[_0x54c6d8(0x106)][_0x54c6d8(0xf2)];for(const _0x4cc1c7 of _0x7f75d6[_0x54c6d8(0x106)][_0x54c6d8(0x16e)]||[]){_0x4cc1c7['entryCriteria']?.['segmentId']&&isPendingSegmentId(_0x4cc1c7[_0x54c6d8(0x137)]['segmentId'])&&delete _0x4cc1c7[_0x54c6d8(0x137)];_0x4cc1c7[_0x54c6d8(0x116)]?.[_0x54c6d8(0x176)]&&isPendingSegmentId(_0x4cc1c7['milestone'][_0x54c6d8(0x176)])&&delete _0x4cc1c7[_0x54c6d8(0x116)];_0x4cc1c7['exitCriterias']&&(_0x4cc1c7['exitCriterias']=_0x4cc1c7[_0x54c6d8(0x19b)][_0x54c6d8(0x1c3)](_0x37b14e=>!_0x37b14e[_0x54c6d8(0x176)]||!isPendingSegmentId(_0x37b14e[_0x54c6d8(0x176)])));if(_0x4cc1c7[_0x54c6d8(0x1cc)])for(const _0x973ee2 of Object['keys'](_0x4cc1c7[_0x54c6d8(0x1cc)])){const _0x2e5130=_0x4cc1c7[_0x54c6d8(0x1cc)][_0x973ee2];_0x2e5130[_0x54c6d8(0x1b8)]==='Activation'&&_0x2e5130['journeyActivationStepId']&&isPendingActivationId(_0x2e5130['journeyActivationStepId'])&&(_0x2e5130[_0x54c6d8(0x115)]='');if(_0x2e5130['type']===_0x54c6d8(0x132)&&_0x2e5130[_0x54c6d8(0x16d)])for(const _0x4e3c13 of _0x2e5130[_0x54c6d8(0x16d)]){_0x4e3c13['segmentId']&&isPendingSegmentId(_0x4e3c13[_0x54c6d8(0x176)])&&(_0x4e3c13[_0x54c6d8(0x176)]='');}_0x2e5130['type']===_0x54c6d8(0x174)&&stripWaitStepPendingIds(_0x2e5130);}}}function a152_0x282b(_0x3288a8,_0x482f69){_0x3288a8=_0x3288a8-0xcc;const _0x6faf0=a152_0x6faf();let _0x282b78=_0x6faf0[_0x3288a8];return _0x282b78;}function resolvePendingIdsInRequest(_0x3d71f8,_0x369458,_0x5918a3,_0x49b1c1,_0x4fc633,_0x2e2248){const _0x1dd5ae=a152_0x2723ce,_0x1a8656=(_0x4a7299,_0x459875)=>{const _0xa5c2da=a152_0x282b;if(!isPendingSegmentId(_0x4a7299))return _0x4a7299;const _0x5d2d8c=extractPendingSegmentName(_0x4a7299),_0x4c82af=_0x49b1c1[_0xa5c2da(0x178)](_0x5d2d8c);return!_0x4c82af&&_0x2e2248[_0xa5c2da(0x1b1)]?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x5d2d8c+_0xa5c2da(0x193)+_0x459875),_0x4c82af;};if(_0x3d71f8[_0x1dd5ae(0x106)]['goal']?.[_0x1dd5ae(0x176)]&&isPendingSegmentId(_0x3d71f8[_0x1dd5ae(0x106)][_0x1dd5ae(0xf2)][_0x1dd5ae(0x176)])){const _0x43d614=_0x1a8656(_0x3d71f8[_0x1dd5ae(0x106)][_0x1dd5ae(0xf2)][_0x1dd5ae(0x176)],'goal\x20criteria');_0x43d614&&(_0x3d71f8['attributes'][_0x1dd5ae(0xf2)]['segmentId']=_0x43d614);}for(const _0x14b7ee of _0x3d71f8['attributes'][_0x1dd5ae(0x16e)]||[]){const _0x3c6449=_0x5918a3[_0x1dd5ae(0x178)](_0x14b7ee[_0x1dd5ae(0x105)]['toLowerCase']());_0x3c6449&&(_0x14b7ee['id']=_0x3c6449);if(_0x14b7ee[_0x1dd5ae(0x137)]?.[_0x1dd5ae(0x176)]&&isPendingSegmentId(_0x14b7ee[_0x1dd5ae(0x137)][_0x1dd5ae(0x176)])){const _0x4d422a=_0x1a8656(_0x14b7ee[_0x1dd5ae(0x137)][_0x1dd5ae(0x176)],'stage\x20\x27'+_0x14b7ee[_0x1dd5ae(0x105)]+_0x1dd5ae(0x195));_0x4d422a&&(_0x14b7ee[_0x1dd5ae(0x137)][_0x1dd5ae(0x176)]=_0x4d422a);}if(_0x14b7ee['exitCriterias'])for(const _0x3ba3a9 of _0x14b7ee[_0x1dd5ae(0x19b)]){if(_0x3ba3a9['segmentId']&&isPendingSegmentId(_0x3ba3a9[_0x1dd5ae(0x176)])){const _0x27bfaf=_0x1a8656(_0x3ba3a9[_0x1dd5ae(0x176)],'stage\x20\x27'+_0x14b7ee['name']+_0x1dd5ae(0x179));_0x27bfaf&&(_0x3ba3a9[_0x1dd5ae(0x176)]=_0x27bfaf);}}if(_0x14b7ee[_0x1dd5ae(0x116)]?.['segmentId']&&isPendingSegmentId(_0x14b7ee[_0x1dd5ae(0x116)][_0x1dd5ae(0x176)])){const _0x347382=_0x1a8656(_0x14b7ee[_0x1dd5ae(0x116)][_0x1dd5ae(0x176)],_0x1dd5ae(0x127)+_0x14b7ee[_0x1dd5ae(0x105)]+_0x1dd5ae(0xd5));_0x347382&&(_0x14b7ee['milestone'][_0x1dd5ae(0x176)]=_0x347382);}if(_0x14b7ee[_0x1dd5ae(0x1cc)]){const _0x10b901=_0x333635=>_0x369458[_0x1dd5ae(0x106)][_0x1dd5ae(0x16e)]?.[_0x1dd5ae(0x129)](_0x4fb190=>_0x4fb190[_0x1dd5ae(0x105)][_0x1dd5ae(0x141)]()===_0x14b7ee[_0x1dd5ae(0x105)][_0x1dd5ae(0x141)]())?.['steps']?.[_0x333635];for(const _0x2b6f78 of Object['keys'](_0x14b7ee[_0x1dd5ae(0x1cc)])){const _0x7c9107=_0x14b7ee[_0x1dd5ae(0x1cc)][_0x2b6f78],_0x59f023=_0x10b901(_0x2b6f78);if(_0x7c9107['type']===_0x1dd5ae(0xf4)&&_0x7c9107[_0x1dd5ae(0x115)]&&(isPendingActivationId(_0x7c9107['journeyActivationStepId'])||_0x7c9107[_0x1dd5ae(0x115)]==='')){if(_0x59f023?.[_0x1dd5ae(0x115)]&&isPendingActivationId(_0x59f023[_0x1dd5ae(0x115)])){const _0x57bf31=extractPendingActivationName(_0x59f023['journeyActivationStepId']),_0x2a6a21=_0x4fc633['get'](_0x57bf31);_0x2a6a21&&(_0x7c9107['journeyActivationStepId']=_0x2a6a21);}}if(_0x7c9107['type']==='DecisionPoint'&&_0x7c9107[_0x1dd5ae(0x16d)]&&_0x59f023?.[_0x1dd5ae(0x16d)])for(let _0x2360f5=0x0;_0x2360f5<_0x7c9107['branches']['length'];_0x2360f5++){const _0x57bdcb=_0x7c9107[_0x1dd5ae(0x16d)][_0x2360f5],_0x4d90b6=_0x59f023[_0x1dd5ae(0x16d)][_0x2360f5];if(_0x4d90b6?.[_0x1dd5ae(0x176)]&&isPendingSegmentId(_0x4d90b6[_0x1dd5ae(0x176)])){const _0x34b906=_0x1a8656(_0x4d90b6[_0x1dd5ae(0x176)],_0x1dd5ae(0x127)+_0x14b7ee[_0x1dd5ae(0x105)]+_0x1dd5ae(0x11d)+(_0x57bdcb[_0x1dd5ae(0x105)]||_0x2360f5)+'\x27');_0x34b906&&(_0x57bdcb[_0x1dd5ae(0x176)]=_0x34b906);}}_0x7c9107['type']===_0x1dd5ae(0x174)&&_0x59f023?.[_0x1dd5ae(0x1b8)]===_0x1dd5ae(0x174)&&resolveWaitStepPendingIds(_0x7c9107,_0x59f023,_0x1a8656,_0x14b7ee[_0x1dd5ae(0x105)]);}}}}
1
+ const a152_0x14882b=a152_0x4c54;(function(_0x4433ff,_0x1add72){const _0x4a75ab=a152_0x4c54,_0x25369f=_0x4433ff();while(!![]){try{const _0x16bab9=-parseInt(_0x4a75ab(0x221))/0x1+-parseInt(_0x4a75ab(0x2c1))/0x2*(-parseInt(_0x4a75ab(0x26f))/0x3)+parseInt(_0x4a75ab(0x253))/0x4+parseInt(_0x4a75ab(0x2ad))/0x5+parseInt(_0x4a75ab(0x283))/0x6*(parseInt(_0x4a75ab(0x257))/0x7)+parseInt(_0x4a75ab(0x25b))/0x8+-parseInt(_0x4a75ab(0x282))/0x9;if(_0x16bab9===_0x1add72)break;else _0x25369f['push'](_0x25369f['shift']());}catch(_0x2c67aa){_0x25369f['push'](_0x25369f['shift']());}}}(a152_0x2baf,0x6d499));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x14882b(0x2d0));export const PENDING_SEGMENT_PREFIX=a152_0x14882b(0x23e);export const PENDING_ACTIVATION_PREFIX=a152_0x14882b(0x242);export function createPendingSegmentId(_0x1bb59b){return''+PENDING_SEGMENT_PREFIX+_0x1bb59b+'__';}export function isPendingSegmentId(_0x1f6c01){const _0x5b24ea=a152_0x14882b;return _0x1f6c01['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x1f6c01[_0x5b24ea(0x281)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x594bd4){const _0x9fb554=a152_0x14882b;return _0x594bd4[_0x9fb554(0x2c2)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x452f32){return''+PENDING_ACTIVATION_PREFIX+_0x452f32+'__';}export function isPendingActivationId(_0xe7fecc){const _0x5c9980=a152_0x14882b;return _0xe7fecc[_0x5c9980(0x281)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x1905fd){const _0x174e30=a152_0x14882b;return _0x1905fd[_0x174e30(0x2c2)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x11a1c2,_0x372c73){const _0x3a2e33=a152_0x14882b,_0xfb52dc=_0x11a1c2+'::'+(_0x372c73[_0x3a2e33(0x296)]()||'segment'),_0x3395c5=createHash(_0x3a2e33(0x265))[_0x3a2e33(0x250)](_0xfb52dc)[_0x3a2e33(0x2c0)]('hex')[_0x3a2e33(0x280)](0x0,0xc);return'journey_entry_criteria_'+_0x3395c5;}export function ensureJourneyDefaults(_0x55ccc4){const _0x315665=a152_0x14882b;!_0x55ccc4['description']&&(_0x55ccc4[_0x315665(0x2b4)]=''),!_0x55ccc4[_0x315665(0x1e3)]&&(_0x55ccc4[_0x315665(0x1e3)]=_0x315665(0x2ce));}export function injectExistingStageIds(_0x499add,_0xaeb5a8){const _0x2c42b7=a152_0x14882b,_0x32e393=new Map(_0xaeb5a8[_0x2c42b7(0x1de)](_0x16bfc3=>[_0x16bfc3['name'],_0x16bfc3['id']]));for(const _0x4f3f9c of _0x499add){if(!_0x4f3f9c['id']){const _0x255221=_0x32e393[_0x2c42b7(0x2c4)](_0x4f3f9c[_0x2c42b7(0x24d)]);_0x255221&&(_0x4f3f9c['id']=_0x255221);}}}export function resolveTDFolderPath(_0x3c2c1d,_0x595123,_0x322e3c){const _0x57e5e5=a152_0x14882b;if(!_0x595123)return _0x3c2c1d;if(_0x3c2c1d===_0x322e3c||_0x3c2c1d[_0x57e5e5(0x281)](_0x322e3c+'/'))return _0x3c2c1d;return _0x3c2c1d?_0x322e3c+'/'+_0x3c2c1d:_0x322e3c;}export function addFoldersToCreate(_0x3917e9,_0x34531b,_0x4a9588){const _0x51e26d=a152_0x14882b;if(!_0x3917e9)return;if(_0x34531b[_0x51e26d(0x20c)](_0x3917e9))return;const _0x8ffa45=_0x3917e9[_0x51e26d(0x2d7)]('/');let _0x7ec313='';for(const _0x212f26 of _0x8ffa45){_0x7ec313=_0x7ec313?_0x7ec313+'/'+_0x212f26:_0x212f26,!_0x34531b['has'](_0x7ec313)&&_0x4a9588['add'](_0x7ec313);}}export function sortFoldersByDepth(_0x665452){const _0x2b859d=a152_0x14882b;return[..._0x665452][_0x2b859d(0x232)]((_0x24e80f,_0x22db4c)=>{const _0x1529b7=_0x2b859d,_0x3ba773=(_0x24e80f[_0x1529b7(0x2d9)](/\//g)||[])[_0x1529b7(0x224)],_0x95553e=(_0x22db4c[_0x1529b7(0x2d9)](/\//g)||[])['length'];return _0x3ba773-_0x95553e;});}import*as a152_0x2adcdb from'yaml';function a152_0x4c54(_0x44fc0c,_0x2f4657){_0x44fc0c=_0x44fc0c-0x1cf;const _0x2baf7e=a152_0x2baf();let _0x4c547b=_0x2baf7e[_0x44fc0c];return _0x4c547b;}import{readFileSync}from'fs';import a152_0x35b22c from'path';import{isJourneyDef,parseYamlString as a152_0x23eb1a,toYamlString as a152_0x338dca,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(_0x322be1){const _0x234c3b=a152_0x14882b;if(Array['isArray'](_0x322be1))return'['+_0x322be1[_0x234c3b(0x1de)](_0x128077=>stableStringify(_0x128077))[_0x234c3b(0x1d5)](',')+']';if(_0x322be1&&typeof _0x322be1===_0x234c3b(0x1fe)){const _0x5c7059=_0x322be1,_0x343045=Object[_0x234c3b(0x24c)](_0x5c7059)[_0x234c3b(0x232)](),_0x40a47a=_0x343045[_0x234c3b(0x1de)](_0x139136=>'\x22'+_0x139136+'\x22:'+stableStringify(_0x5c7059[_0x139136]));return'{'+_0x40a47a[_0x234c3b(0x1d5)](',')+'}';}const _0x29bfcd=JSON['stringify'](_0x322be1);return _0x29bfcd===undefined?_0x234c3b(0x225):_0x29bfcd;}function activationSignature(_0x4a1bbf){const _0x4d8cb6=a152_0x14882b,_0x57ffab={'connection':_0x4a1bbf['connection'],..._0x4a1bbf['all_columns']!==undefined&&{'all_columns':_0x4a1bbf[_0x4d8cb6(0x20d)]},..._0x4a1bbf[_0x4d8cb6(0x216)]!==undefined&&{'columns':_0x4a1bbf[_0x4d8cb6(0x216)]},..._0x4a1bbf[_0x4d8cb6(0x1e5)]!==undefined&&{'behavior':_0x4a1bbf[_0x4d8cb6(0x1e5)]},..._0x4a1bbf[_0x4d8cb6(0x206)]!==undefined&&{'schedule':_0x4a1bbf[_0x4d8cb6(0x206)]},..._0x4a1bbf['notification']!==undefined&&{'notification':_0x4a1bbf[_0x4d8cb6(0x228)]},..._0x4a1bbf[_0x4d8cb6(0x2da)]!==undefined&&{'connector_config':_0x4a1bbf[_0x4d8cb6(0x2da)]},..._0x4a1bbf[_0x4d8cb6(0x26a)]!==undefined&&{'activation_template_id':_0x4a1bbf[_0x4d8cb6(0x26a)]}};return stableStringify(_0x57ffab);}async function fetchSegment(_0x2f55f1,_0x33872f,_0x25dc89,_0x397f3b){const _0x40b82b=a152_0x14882b,_0x7fb4cb=_0x397f3b?.[_0x40b82b(0x28e)](_0x5b096a=>_0x5b096a['id']===_0x25dc89);if(_0x7fb4cb)return _0x7fb4cb;try{return await _0x2f55f1[_0x40b82b(0x23d)][_0x40b82b(0x1eb)](_0x33872f,_0x25dc89);}catch(_0x1b8717){logger[_0x40b82b(0x2ab)]('getSegment\x20failed\x20for\x20'+_0x25dc89+_0x40b82b(0x28d)+_0x1b8717);try{return await _0x2f55f1[_0x40b82b(0x23d)][_0x40b82b(0x21e)](_0x25dc89);}catch(_0x41ff0f){return logger['debug']('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x25dc89+':\x20'+_0x41ff0f),null;}}}function recoverSegmentIdsFromPushRecovery(_0xb08426,_0x1ee28b,_0x3fb4f2){const _0x370795=a152_0x14882b,_0x1918a9=readPushRecovery(_0xb08426[_0x370795(0x20e)]);if(_0x1918a9?.[_0x370795(0x26d)]===_0xb08426[_0x370795(0x2db)]['name'])for(const [_0xa88dcf,_0x1337ed]of Object[_0x370795(0x1f7)](_0x1918a9[_0x370795(0x2bf)])){const _0x201a00=generateDeterministicJourneySegmentName(_0xb08426[_0x370795(0x2db)]['name'],_0xa88dcf);_0x1337ed[_0x370795(0x2d8)]===_0x201a00&&(_0x1ee28b['set'](_0xa88dcf,_0x1337ed[_0x370795(0x26b)]),_0x3fb4f2[_0x370795(0x1f4)](_0xa88dcf,_0x1337ed[_0x370795(0x26b)]));}}async function createOrRecoverEmbeddedSegment(_0x31b2e4,_0x386909,_0x3ba2ed,_0x30322d){const _0x484d0c=a152_0x14882b;let _0x4df39b;try{_0x4df39b=await _0x31b2e4[_0x484d0c(0x23d)][_0x484d0c(0x293)]({'name':_0x3ba2ed[_0x484d0c(0x269)],'description':_0x3ba2ed[_0x484d0c(0x2b4)],'journeyId':_0x3ba2ed[_0x484d0c(0x2d2)],'rule':_0x30322d(_0x3ba2ed[_0x484d0c(0x23a)],!![]),'countPopulation':!![],'parentFolderId':_0x3ba2ed[_0x484d0c(0x2aa)],'audienceId':_0x3ba2ed['parentId']});}catch(_0x17c00b){const _0x27c295=_0x17c00b instanceof Error&&_0x17c00b[_0x484d0c(0x212)][_0x484d0c(0x262)](_0x484d0c(0x230));if(_0x27c295){const _0x134d4e=readPushRecovery(_0x386909[_0x484d0c(0x20e)]),_0x1600fa=_0x134d4e?.[_0x484d0c(0x26d)]===_0x386909[_0x484d0c(0x2db)][_0x484d0c(0x24d)]?_0x134d4e[_0x484d0c(0x2bf)][_0x3ba2ed[_0x484d0c(0x211)]]:undefined;if(_0x1600fa?.['uniqueServerName']===_0x3ba2ed[_0x484d0c(0x269)])await _0x31b2e4[_0x484d0c(0x23d)]['updateSegmentById'](_0x3ba2ed['parentId'],_0x1600fa[_0x484d0c(0x26b)],{'description':_0x3ba2ed[_0x484d0c(0x2b4)],'rule':_0x30322d(_0x3ba2ed['resolvedRule'],!![]),'countPopulation':!![]}),_0x4df39b=_0x1600fa[_0x484d0c(0x26b)];else throw new SDKError(ErrorCode[_0x484d0c(0x2bd)],_0x484d0c(0x21d)+_0x3ba2ed[_0x484d0c(0x211)]+_0x484d0c(0x270)+(_0x484d0c(0x1d7)+_0x386909['absolutePath']['replace'](/([^/]+)$/,_0x484d0c(0x215))+')\x20')+_0x484d0c(0x203),_0x17c00b);}else throw _0x17c00b;}return saveSegmentToPushRecovery(_0x386909['absolutePath'],_0x386909[_0x484d0c(0x2db)][_0x484d0c(0x24d)],_0x3ba2ed['localName'],{'segmentId':_0x4df39b,'uniqueServerName':_0x3ba2ed[_0x484d0c(0x269)],'createdAt':new Date()[_0x484d0c(0x220)]()}),_0x4df39b;}export async function prepareSegmentFiles(_0xa77b02,_0x4e5124,_0x1c2751,_0x35d0be,_0xe18ddf){const _0x12646f=a152_0x14882b,{activationDefToCreateRequest:_0x3489ed}=await import(_0x12646f(0x2c5)),_0x25e99d=[],_0x2d7efa=new Set();for(const {yamlConfig:_0x57cec0,folderPath:_0x3cc0dd,sourcePath:_0x573cec}of _0xa77b02){const _0x51a765=resolveTDFolderPath(_0x3cc0dd,_0x35d0be,_0xe18ddf),_0x31390e=_0x51a765+':'+_0x57cec0[_0x12646f(0x24d)],_0x37c2d1=_0x4e5124[_0x12646f(0x266)][_0x12646f(0x2c4)](_0x31390e),_0x4a6afd=_0x37c2d1?_0x4e5124[_0x12646f(0x295)][_0x12646f(0x2c4)](_0x37c2d1['id'])||[]:[];addFoldersToCreate(_0x51a765,_0x4e5124['folderPathToId'],_0x2d7efa);const _0x4bed75=calculateActivationActions(_0x57cec0[_0x12646f(0x223)]||[],_0x4a6afd,_0x4e5124[_0x12646f(0x214)],_0x4e5124['connectionIdToNameMap']);for(const _0x152b58 of _0x4bed75){(_0x152b58[_0x12646f(0x20f)]===_0x12646f(0x2b0)||_0x152b58[_0x12646f(0x20f)]==='update')&&_0x152b58['yamlActivation']&&(_0x152b58[_0x12646f(0x246)]=await _0x3489ed(_0x152b58[_0x12646f(0x2a5)],_0x1c2751));}const _0xd734b7=calculateSegmentDiff(_0x57cec0,_0x37c2d1,_0x4a6afd,_0x4e5124[_0x12646f(0x214)],_0x4e5124[_0x12646f(0x298)]);_0x25e99d[_0x12646f(0x299)]({'relativePath':_0x57cec0[_0x12646f(0x24d)],'absolutePath':_0x573cec,'yamlConfig':_0x57cec0,'folderPath':_0x51a765,'existingSegment':_0x37c2d1,'existingActivations':_0x4a6afd,'isNew':_0xd734b7[_0x12646f(0x2b3)],'hasChanges':_0xd734b7['hasChanges'],'diff':_0xd734b7[_0x12646f(0x1e1)],'activationActions':_0x4bed75});}return{'segmentFiles':_0x25e99d,'foldersToCreate':_0x2d7efa};}export async function prepareJourneyFiles(_0x1a27f5,_0x4042b2,_0x427a4f,_0x368507){const _0x5cb1e5=a152_0x14882b,_0x4b6852=[],_0x41d234=new Set();for(const {yamlConfig:_0x54f8a3,folderPath:_0x115f03,sourcePath:_0x1fb879}of _0x1a27f5){const _0x58a275=resolveTDFolderPath(_0x115f03,_0x427a4f,_0x368507),_0x16f408=_0x58a275+':'+_0x54f8a3[_0x5cb1e5(0x24d)],_0x24199e=_0x4042b2[_0x5cb1e5(0x254)][_0x5cb1e5(0x2c4)](_0x16f408);let _0x4a471f,_0x35165e;if(_0x24199e&&_0x24199e[_0x5cb1e5(0x224)]>0x0){const _0xcaf91a=buildLocalExpandedRuleMappings(_0x54f8a3),{createYamlContext:_0x14bbc4,prefetchJourneySegments:_0x3eafd6}=createPushYamlContextForBundle(_0x4042b2['deps'],_0x4042b2[_0x5cb1e5(0x1f5)],_0x4042b2[_0x5cb1e5(0x217)],_0xcaf91a,_0x4042b2[_0x5cb1e5(0x214)],_0x4042b2['connectionIdToNameMap'],_0x4042b2[_0x5cb1e5(0x260)],_0x4042b2[_0x5cb1e5(0x287)]);await _0x3eafd6(_0x24199e[_0x5cb1e5(0x1de)](_0x4d325f=>_0x4d325f['id']));const _0x24c55e=await _0x4042b2[_0x5cb1e5(0x226)][_0x5cb1e5(0x2a4)][_0x5cb1e5(0x27c)](_0x24199e[0x0][_0x5cb1e5(0x229)]),_0x18739f=hasMultipleVersions(_0x54f8a3),_0x4d1126=async _0x55d203=>{const _0x5c1040=_0x5cb1e5,_0x27ce29=_0x4042b2['journeyById']?.['get'](_0x55d203);if(_0x27ce29)return _0x27ce29;return _0x4042b2[_0x5c1040(0x235)]({'journeyId':_0x55d203,'journeyName':_0x54f8a3[_0x5c1040(0x24d)],'isMultiVersion':_0x24199e[_0x5c1040(0x224)]>0x1});};if(_0x18739f&&_0x24199e['length']>0x1){const _0x38778f=[];for(const _0x41615c of _0x24199e){const _0x53624b=_0x41615c['versionNumber']||0x1;_0x4042b2[_0x5cb1e5(0x1d9)]?.[_0x5cb1e5(0x250)](_0x5cb1e5(0x25f)+_0x54f8a3['name']+'\x20v'+_0x53624b);const _0x16aece=await _0x4d1126(_0x41615c['id']),_0x542586=_0x14bbc4(_0x41615c['id']),_0x3e737b=await journeyResponseToDef(_0x16aece,_0x542586);_0x38778f[_0x5cb1e5(0x299)]({'item':_0x41615c,'yaml':_0x3e737b});}const _0x1dd7e4=buildLocalRuleToNameMappingFromJourney(_0x54f8a3);_0x35165e=buildMergedJourneyDef(_0x38778f,_0x1dd7e4,_0x24c55e);const _0x49343b=Math[_0x5cb1e5(0x2b5)](..._0x38778f['map'](_0x5a9d9d=>_0x5a9d9d[_0x5cb1e5(0x28b)][_0x5cb1e5(0x1d8)]||0x0)),_0x173dc5=_0x24199e['find'](_0x3bb1be=>(_0x3bb1be[_0x5cb1e5(0x1d8)]||0x0)===_0x49343b);_0x173dc5&&(_0x4042b2[_0x5cb1e5(0x1d9)]?.['update'](_0x5cb1e5(0x25f)+_0x54f8a3[_0x5cb1e5(0x24d)]+'\x20v'+_0x49343b),_0x4a471f=await _0x4d1126(_0x173dc5['id']));}else{const _0x508a0f=_0x24199e[_0x24199e[_0x5cb1e5(0x224)]-0x1];_0x4042b2['progress']?.[_0x5cb1e5(0x250)](_0x5cb1e5(0x25f)+_0x54f8a3[_0x5cb1e5(0x24d)]),_0x4a471f=await _0x4d1126(_0x508a0f['id']);const _0x140284=_0x14bbc4(_0x508a0f['id']),_0x16171c=await journeyResponseToDef(_0x4a471f,_0x140284),_0x345000=buildLocalRuleToNameMappingFromJourney(_0x54f8a3);_0x35165e=buildMergedJourneyDef([{'item':_0x508a0f,'yaml':_0x16171c}],_0x345000,_0x24c55e);}}addFoldersToCreate(_0x58a275,_0x4042b2[_0x5cb1e5(0x27d)],_0x41d234);const _0x2c9de1=calculateJourneyDiff(_0x54f8a3,_0x35165e);_0x4b6852[_0x5cb1e5(0x299)]({'relativePath':_0x54f8a3[_0x5cb1e5(0x24d)],'absolutePath':_0x1fb879,'yamlConfig':_0x54f8a3,'folderPath':_0x58a275,'existingJourney':_0x4a471f,'isNew':_0x2c9de1[_0x5cb1e5(0x2b3)],'hasChanges':_0x2c9de1[_0x5cb1e5(0x264)],'diff':_0x2c9de1['diff']});}return{'journeyFiles':_0x4b6852,'foldersToCreate':_0x41d234};}export function calculateActivationActions(_0x4acf8e,_0xa54fe9,_0x290477,_0x491b4d){const _0x32151a=a152_0x14882b,_0x181261=[],_0x481e69=new Map();for(const _0x213c92 of _0xa54fe9){_0x481e69[_0x32151a(0x1f4)](_0x213c92['name'],_0x213c92);}const _0x3e9f98=new Map();for(const _0x5ac9c5 of _0x4acf8e){_0x3e9f98[_0x32151a(0x1f4)](_0x5ac9c5['name'],_0x5ac9c5);}for(const _0x3f2534 of _0x4acf8e){const _0x521dc8=_0x481e69[_0x32151a(0x2c4)](_0x3f2534[_0x32151a(0x24d)]);if(!_0x521dc8)_0x181261[_0x32151a(0x299)]({'type':_0x32151a(0x2b0),'name':_0x3f2534[_0x32151a(0x24d)],'yamlActivation':_0x3f2534});else{const _0x41a2de=activationResponseToDef(_0x521dc8,_0x290477,_0x491b4d),_0x17537c=a152_0x2adcdb[_0x32151a(0x1fc)](_0x41a2de),_0x5e4c34=a152_0x2adcdb['stringify'](_0x3f2534);_0x17537c!==_0x5e4c34&&_0x181261[_0x32151a(0x299)]({'type':_0x32151a(0x250),'name':_0x3f2534[_0x32151a(0x24d)],'yamlActivation':_0x3f2534,'existingActivation':_0x521dc8});}}for(const _0x35d330 of _0xa54fe9){!_0x3e9f98['has'](_0x35d330[_0x32151a(0x24d)])&&_0x181261[_0x32151a(0x299)]({'type':'delete','name':_0x35d330[_0x32151a(0x24d)],'existingActivation':_0x35d330});}return _0x181261;}function calculateYamlDiff(_0x2617e0,_0x476357){if(_0x476357){const _0x3eb989=generateDiff(_0x476357,_0x2617e0),_0x24d413=hasChanges(_0x3eb989);return{'isNew':![],'hasChanges':_0x24d413,'diff':_0x24d413?formatDiffWithColors(_0x3eb989):undefined};}const _0x53729c=generateDiff('',_0x2617e0);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x53729c)};}export function calculateSegmentDiff(_0x277499,_0x241219,_0x12973d,_0x346ae3,_0x2cdba5){const _0x1e3b02=segmentToYamlString(_0x277499),_0x2bd798=_0x241219?segmentToYamlString(segmentWithActivationsToYaml(_0x241219,_0x12973d,undefined,_0x346ae3,_0x2cdba5)):undefined;return calculateYamlDiff(_0x1e3b02,_0x2bd798);}export function calculateJourneyDiff(_0x27fc91,_0x412782){const _0x53f9ae=normalizeJourneyDef(_0x27fc91,_0x27fc91),_0x4dc132=a152_0x338dca(_0x53f9ae),_0x17b7ea=_0x412782?a152_0x338dca(normalizeJourneyDef(_0x412782,_0x27fc91)):undefined;return calculateYamlDiff(_0x4dc132,_0x17b7ea);}export function findSegmentsToDelete(_0x2f529e,_0x5730d8,_0x26663d,_0x5d4827,_0x1c60e3){const _0x2f01dc=a152_0x14882b,_0x1ddef3=new Set();for(const {yamlConfig:_0x579f60,folderPath:_0x41732c}of _0x5730d8){_0x1ddef3[_0x2f01dc(0x25a)](_0x41732c+':'+_0x579f60[_0x2f01dc(0x24d)]);}return _0x2f529e[_0x2f01dc(0x274)](_0x2d1c69=>{const _0x232571=_0x2f01dc,_0x5a191f=_0x2d1c69['segmentFolderId']?_0x26663d['get'](_0x2d1c69[_0x232571(0x238)][_0x232571(0x28f)]())||'':'',_0x3d726d=_0x5a191f+':'+_0x2d1c69[_0x232571(0x24d)];if(_0x1ddef3['has'](_0x3d726d))return![];if(_0x1c60e3)return _0x5a191f===_0x5d4827||_0x5a191f[_0x232571(0x281)](_0x5d4827+'/');return!![];});}export function findJourneysToDelete(_0x3f14fe,_0x50f3f4,_0x2f7dae,_0x1266b2,_0x243733){const _0x4add7c=a152_0x14882b,_0xcad92e=new Set();for(const {yamlConfig:_0xf62a3,folderPath:_0x194d4c}of _0x50f3f4){_0xcad92e[_0x4add7c(0x25a)](_0x194d4c+':'+_0xf62a3[_0x4add7c(0x24d)]);}return _0x3f14fe[_0x4add7c(0x274)](_0x497362=>{const _0x13b6c1=_0x4add7c,_0x3da643=_0x497362[_0x13b6c1(0x2aa)]?_0x2f7dae[_0x13b6c1(0x2c4)](_0x497362['folderId'])||'':'',_0x55bd4d=_0x3da643+':'+_0x497362[_0x13b6c1(0x1d1)];if(_0xcad92e[_0x13b6c1(0x20c)](_0x55bd4d))return![];if(_0x243733)return _0x3da643===_0x1266b2||_0x3da643['startsWith'](_0x1266b2+'/');return!![];});}export function buildSegmentLookupMap(_0xeb14ae,_0x12e7b2){const _0x58c3d9=a152_0x14882b,_0x49abf3=new Map();for(const _0x204141 of _0xeb14ae){const _0xae7d6d=_0x204141[_0x58c3d9(0x238)]?_0x12e7b2[_0x58c3d9(0x2c4)](_0x204141[_0x58c3d9(0x238)][_0x58c3d9(0x28f)]())||'':'',_0x519f9f=_0xae7d6d+':'+_0x204141['name'];_0x49abf3[_0x58c3d9(0x1f4)](_0x519f9f,_0x204141);}return _0x49abf3;}export function buildSegmentNameToIdMap(_0x31a3ea){const _0x195c62=a152_0x14882b,_0x18c2da=new Map();for(const _0x55f8b0 of _0x31a3ea){_0x18c2da[_0x195c62(0x1f4)](_0x55f8b0[_0x195c62(0x24d)],_0x55f8b0['id']);}return _0x18c2da;}export function buildJourneyBundleLookupMap(_0x3cffe5,_0x5f1546){const _0x2118ba=a152_0x14882b,_0xb2df2a=new Map();for(const _0x162e2f of _0x3cffe5){const _0x21f0d2=_0x162e2f[_0x2118ba(0x2aa)]?_0x5f1546['get'](_0x162e2f['folderId'])||'':'',_0x36f9db=_0x21f0d2+':'+_0x162e2f[_0x2118ba(0x1d1)];!_0xb2df2a[_0x2118ba(0x20c)](_0x36f9db)&&_0xb2df2a[_0x2118ba(0x1f4)](_0x36f9db,[]),_0xb2df2a[_0x2118ba(0x2c4)](_0x36f9db)[_0x2118ba(0x299)](_0x162e2f);}for(const _0x478a5e of _0xb2df2a[_0x2118ba(0x205)]()){_0x478a5e[_0x2118ba(0x232)]((_0x4f0339,_0xf26a78)=>(_0x4f0339['versionNumber']||0x0)-(_0xf26a78[_0x2118ba(0x1d8)]||0x0));}return _0xb2df2a;}export function collectFoldersToCreate(_0x49118a,_0x5810ef){const _0x10a6cc=a152_0x14882b,_0x16da9a=new Set();for(const _0x4f0640 of _0x49118a){if(!_0x4f0640)continue;if(_0x5810ef['has'](_0x4f0640))continue;const _0x50fe77=_0x4f0640[_0x10a6cc(0x2d7)]('/');let _0x118c7f='';for(const _0x505fc7 of _0x50fe77){_0x118c7f=_0x118c7f?_0x118c7f+'/'+_0x505fc7:_0x505fc7,!_0x5810ef[_0x10a6cc(0x20c)](_0x118c7f)&&_0x16da9a[_0x10a6cc(0x25a)](_0x118c7f);}}return _0x16da9a;}export function parseAndClassifyYamlFiles(_0x1a985f,_0x35bf51,_0x906b83){const _0x126ecd=a152_0x14882b,_0x3bd17f=[],_0x421e36=[];for(const _0x39dc3d of _0x1a985f){const _0x4d323e=a152_0x35b22c[_0x126ecd(0x2a3)](_0x35bf51,a152_0x35b22c['dirname'](_0x39dc3d)),_0x697024=_0x4d323e==='.'?'':_0x4d323e[_0x126ecd(0x2c2)](/\\/g,'/'),_0x1d9f5d=readFileSync(_0x39dc3d,'utf-8'),_0x19826f=a152_0x2adcdb[_0x126ecd(0x26c)](_0x1d9f5d);if(isJourneyDef(_0x19826f)){const _0x651651=a152_0x23eb1a(_0x1d9f5d);_0x421e36[_0x126ecd(0x299)]({'yamlConfig':_0x651651,'folderPath':_0x697024,'sourcePath':_0x39dc3d});}else{if(!_0x906b83?.[_0x126ecd(0x1dd)]){const _0x3eb703=parseSegmentYamlFile(_0x1d9f5d),_0x27c914=normalizeChildSegmentYaml(_0x3eb703);_0x3bd17f[_0x126ecd(0x299)]({'yamlConfig':_0x27c914,'folderPath':_0x697024,'sourcePath':_0x39dc3d});}}}return{'segments':_0x3bd17f,'journeys':_0x421e36};}export function validateParsedFiles(_0x22bc5e,_0x1d002e){const _0x1a015a=a152_0x14882b,_0x29964b=[];for(const {yamlConfig:_0x55bbc8,sourcePath:_0x1eca23}of _0x22bc5e[_0x1a015a(0x2bf)]){const _0x595f9a=readFileSync(_0x1eca23,_0x1a015a(0x29b)),_0x3c4f20=a152_0x2adcdb[_0x1a015a(0x1da)](_0x595f9a),_0x1181b3=validateSegmentDef(_0x55bbc8,{'source':_0x595f9a,'document':_0x3c4f20},{'skipSchema':!![]});if(!_0x1181b3['valid']){const _0x11b0d5=a152_0x35b22c[_0x1a015a(0x2a3)](_0x1d002e,_0x1eca23);_0x29964b['push']({'filePath':_0x11b0d5,'source':_0x595f9a,'result':_0x1181b3,'isJourney':![]});}}for(const {yamlConfig:_0x4a18af,sourcePath:_0x6bb9d2}of _0x22bc5e[_0x1a015a(0x210)]){const _0x445864=readFileSync(_0x6bb9d2,_0x1a015a(0x29b)),_0x50eccc=a152_0x2adcdb[_0x1a015a(0x1da)](_0x445864),_0x4ce132=validateJourneyDef(_0x4a18af,{'source':_0x445864,'document':_0x50eccc},{'skipSchema':!![]});if(!_0x4ce132[_0x1a015a(0x243)]){const _0x3c293a=a152_0x35b22c['relative'](_0x1d002e,_0x6bb9d2);_0x29964b[_0x1a015a(0x299)]({'filePath':_0x3c293a,'source':_0x445864,'result':_0x4ce132,'isJourney':!![]});}}return _0x29964b;}export function formatValidationErrors(_0x3b08ee){const _0x3d9968=a152_0x14882b,_0x51cf97=[];for(const {filePath:_0x4c2319,source:_0x4a37d2,result:_0x3a6c66,isJourney:_0x19bd3f}of _0x3b08ee){const _0xe94222=_0x19bd3f?_0x3d9968(0x2a4):_0x3d9968(0x23d);_0x51cf97[_0x3d9968(0x299)]('\x0a'+_0x4c2319+'\x20('+_0xe94222+_0x3d9968(0x24f)+_0x3a6c66[_0x3d9968(0x200)][_0x3d9968(0x224)]+'\x20error(s)'),_0x51cf97[_0x3d9968(0x299)](formatValidationResult(_0x3a6c66,_0x4a37d2,_0x4c2319));}return _0x51cf97[_0x3d9968(0x1d5)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x3e5fee){const _0x6a1ce0=a152_0x14882b,_0x1abca6=new Set(),_0x9fe8c3=new Map(),_0x2f7b04=collectSegmentUsageCounts(_0x3e5fee);if(_0x3e5fee['segments'])for(const [_0x42847d,_0x4603ee]of Object[_0x6a1ce0(0x1f7)](_0x3e5fee[_0x6a1ce0(0x2bf)])){_0x1abca6[_0x6a1ce0(0x25a)](_0x42847d);if(_0x4603ee[_0x6a1ce0(0x202)]){const _0x10390f=yamlRuleToApi(_0x4603ee[_0x6a1ce0(0x202)]),_0x4093f5=apiRuleToYaml(_0x10390f);_0x9fe8c3[_0x6a1ce0(0x1f4)](_0x42847d,_0x4093f5);}}const _0x15611c=new Map();let _0x5a420d=0x0;for(const [_0x342c2a,_0x540846]of _0x9fe8c3){const _0x3d6249=serializeExpandedRule(_0x540846,_0x9fe8c3),_0x4a8e73=_0x15611c[_0x6a1ce0(0x2c4)](_0x3d6249)||[];_0x4a8e73[_0x6a1ce0(0x299)]({'name':_0x342c2a,'index':_0x5a420d}),_0x15611c['set'](_0x3d6249,_0x4a8e73),_0x5a420d++;}const _0x5923cf=new Map();for(const [_0xe1493f,_0x89636b]of _0x15611c){const _0x4032ca=_0x89636b[_0x6a1ce0(0x280)]()[_0x6a1ce0(0x232)]((_0x2e2b40,_0x34c1ae)=>{const _0x1c10f6=_0x6a1ce0,_0x32b05a=_0x2f7b04[_0x1c10f6(0x2c4)](_0x2e2b40[_0x1c10f6(0x24d)])||0x0,_0x51800b=_0x2f7b04[_0x1c10f6(0x2c4)](_0x34c1ae[_0x1c10f6(0x24d)])||0x0;if(_0x32b05a!==_0x51800b)return _0x51800b-_0x32b05a;return _0x2e2b40[_0x1c10f6(0x1e8)]-_0x34c1ae[_0x1c10f6(0x1e8)];})['map'](_0x2537fc=>_0x2537fc[_0x6a1ce0(0x24d)]),_0x485410=[];for(const _0x3b2049 of _0x4032ca){const _0x12d9f4=_0x2f7b04[_0x6a1ce0(0x2c4)](_0x3b2049)||0x0,_0x23422c=Math[_0x6a1ce0(0x2b5)](_0x12d9f4,0x1);for(let _0x3410f3=0x0;_0x3410f3<_0x23422c;_0x3410f3++){_0x485410[_0x6a1ce0(0x299)](_0x3b2049);}}_0x5923cf[_0x6a1ce0(0x1f4)](_0xe1493f,_0x485410);}return{'existingLocalSegmentNames':_0x1abca6,'localSegmentRules':_0x9fe8c3,'localExpandedRuleToNames':_0x5923cf};}export function createSegmentIdResolver(_0x270843,_0x55b76e){return async _0x36b197=>{const _0x3cd29d=a152_0x4c54,_0x568977=_0x270843[_0x3cd29d(0x2c4)](_0x36b197);if(!_0x568977)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x3cd29d(0x22f)+_0x36b197+_0x3cd29d(0x24e)+_0x55b76e+'\x27)');return _0x568977;};}export function extractRootFolderId(_0x51c37f){const _0x2dd336=a152_0x14882b;return _0x51c37f['relationships']?.['parentSegmentFolder']?.[_0x2dd336(0x22a)]?.['id']||_0x51c37f[_0x2dd336(0x2a6)]?.[_0x2dd336(0x1f9)]?.[_0x2dd336(0x22a)]?.['id'];}export function buildConnectionMaps(_0x11b8f3){const _0x55b909=a152_0x14882b,_0xd32a=new Map(),_0x425600=new Map(),_0x49d77b=new Map();for(const _0xf4d0d of _0x11b8f3){_0xd32a[_0x55b909(0x1f4)](_0xf4d0d[_0x55b909(0x24d)],parseInt(_0xf4d0d['id'],0xa)),_0x425600['set'](_0xf4d0d['id'],_0xf4d0d[_0x55b909(0x24d)]),_0x49d77b[_0x55b909(0x1f4)](_0xf4d0d[_0x55b909(0x24d)],_0xf4d0d[_0x55b909(0x20f)]);}return{'nameToId':_0xd32a,'idToName':_0x425600,'nameToType':_0x49d77b};}export function calculatePushStats(_0x38103a,_0x3f0e26,_0x590544,_0xeabda7,_0x346c09,_0x2e2df,_0x132346){const _0x5f1aef=a152_0x14882b,_0x523fc4=_0x38103a[_0x5f1aef(0x274)](_0x4bd9a4=>_0x4bd9a4['isNew']),_0x2ffabc=_0x38103a['filter'](_0x3661eb=>!_0x3661eb[_0x5f1aef(0x2b3)]&&_0x3661eb[_0x5f1aef(0x264)]),_0x5ed749=_0x38103a['filter'](_0x207557=>!_0x207557[_0x5f1aef(0x2b3)]&&!_0x207557[_0x5f1aef(0x264)]),_0x58e8fb=_0x2e2df?_0xeabda7:[],_0x267c29=_0x3f0e26['filter'](_0x3b7262=>_0x3b7262[_0x5f1aef(0x2b3)]),_0x2b6932=_0x3f0e26[_0x5f1aef(0x274)](_0x1c348a=>!_0x1c348a[_0x5f1aef(0x2b3)]&&_0x1c348a[_0x5f1aef(0x264)]),_0x56f79c=_0x3f0e26[_0x5f1aef(0x274)](_0x1c7ff5=>!_0x1c7ff5['isNew']&&!_0x1c7ff5[_0x5f1aef(0x264)]),_0x10bc0b=_0x2e2df?_0x346c09:[],_0x2a490b=_0x38103a['flatMap'](_0x2e7d14=>_0x2e7d14[_0x5f1aef(0x207)]),_0x2f440c=_0x2a490b[_0x5f1aef(0x274)](_0xee5f31=>_0xee5f31[_0x5f1aef(0x20f)]===_0x5f1aef(0x2b0)),_0x23b950=_0x2a490b[_0x5f1aef(0x274)](_0x4ec37c=>_0x4ec37c['type']==='update'),_0xf6adaf=_0x2a490b[_0x5f1aef(0x274)](_0x38162d=>_0x38162d[_0x5f1aef(0x20f)]===_0x5f1aef(0x1e6)),_0x5b6a3c=Array['from'](_0x590544)[_0x5f1aef(0x232)](),_0x3ee1a3=_0x132346?![]:_0x523fc4[_0x5f1aef(0x224)]>0x0||_0x2ffabc['length']>0x0||_0x58e8fb['length']>0x0,_0x17d43d=_0x267c29['length']>0x0||_0x2b6932[_0x5f1aef(0x224)]>0x0||_0x10bc0b[_0x5f1aef(0x224)]>0x0,_0x5edbea=_0x132346?![]:_0x2a490b[_0x5f1aef(0x224)]>0x0,_0x49b06c=_0x5b6a3c['length']>0x0;return{'segments':{'new':_0x523fc4,'changed':_0x2ffabc,'unchanged':_0x5ed749,'toDelete':_0x58e8fb},'journeys':{'new':_0x267c29,'changed':_0x2b6932,'unchanged':_0x56f79c,'toDelete':_0x10bc0b},'activations':{'all':_0x2a490b,'toCreate':_0x2f440c,'toUpdate':_0x23b950,'toDelete':_0xf6adaf},'folders':{'toCreate':_0x5b6a3c},'counts':{'segments':{'new':_0x523fc4[_0x5f1aef(0x224)],'changed':_0x2ffabc[_0x5f1aef(0x224)],'unchanged':_0x5ed749[_0x5f1aef(0x224)],'toDelete':_0x58e8fb[_0x5f1aef(0x224)]},'journeys':{'new':_0x267c29[_0x5f1aef(0x224)],'changed':_0x2b6932[_0x5f1aef(0x224)],'unchanged':_0x56f79c['length'],'toDelete':_0x10bc0b['length']},'activations':{'create':_0x2f440c[_0x5f1aef(0x224)],'update':_0x23b950[_0x5f1aef(0x224)],'delete':_0xf6adaf[_0x5f1aef(0x224)]},'folders':_0x5b6a3c[_0x5f1aef(0x224)]},'hasChanges':_0x3ee1a3||_0x17d43d||_0x5edbea||_0x49b06c};}export async function buildPushExecutionContext(_0x4d97b4,_0x5ea252,_0x6130c4,_0x155d39,_0x8b4c61,_0xa0de2d){const _0x3f2357=a152_0x14882b,_0x137a83=extractRootFolderId(_0x6130c4),{pathToId:_0x33f7e9,idToPath:_0x12616e}=buildFolderMaps(_0x8b4c61),_0xe0faf4=buildSegmentNameToIdMap(_0x155d39),_0x33de9c=new Map(),{batchAsync:_0x17d553}=await import('../../utils/async.js'),[_0x1d0c9d,_0x409ad5]=await Promise[_0x3f2357(0x2c7)]([_0x4d97b4['user'][_0x3f2357(0x25c)](),_0x4d97b4['connection'][_0x3f2357(0x251)](),((async()=>{const _0x4c425c=_0x3f2357;!_0xa0de2d&&_0x155d39[_0x4c425c(0x224)]>0x0&&await _0x17d553(_0x155d39,async _0x2325f0=>{const _0x360d07=_0x4c425c,_0x2d9e59=await _0x4d97b4[_0x360d07(0x23d)][_0x360d07(0x240)](_0x5ea252,_0x2325f0['id']);_0x33de9c[_0x360d07(0x1f4)](_0x2325f0['id'],_0x2d9e59);});})())]),{emailToId:_0x2f1c63,idToEmail:_0x4c2305}=_0x1d0c9d,_0x2c442f=buildConnectionMaps(_0x409ad5);return{'rootFolderId':_0x137a83,'folderPathToId':_0x33f7e9,'folderIdToPath':_0x12616e,'segmentNameToId':_0xe0faf4,'activationsBySegmentId':_0x33de9c,'emailToIdMap':_0x2f1c63,'idToEmailMap':_0x4c2305,'connectionNameToIdMap':_0x2c442f[_0x3f2357(0x1f0)],'connectionIdToNameMap':_0x2c442f['idToName'],'connectionNameToTypeMap':_0x2c442f[_0x3f2357(0x1cf)]};}export function createPushYamlContextForBundle(_0x48c3e1,_0x98d12f,_0x47c202,_0x5950b0,_0x4f65bb,_0x5dec88,_0x47f613,_0x4b94cb){const {existingLocalSegmentNames:_0x40e86f,localExpandedRuleToNames:_0x56429d}=_0x5950b0,_0x2e5d53=new Set(),_0x17894f=new Map(),_0x10ac93=new Map(),_0x6cf385=new Map(),_0x5eeb83=createJumpTargetCache(),_0x216da0=new Map(),_0x146795=new Map(),_0x277de9=new Set();let _0x152b8d;const _0x1a6fd7=_0x1b34ce=>{const _0x576d0a={'resolveSegment':async _0x40d964=>{const _0x22b2d4=a152_0x4c54,_0x859753=_0x6cf385[_0x22b2d4(0x2c4)](_0x40d964);if(_0x859753!==undefined)return{'name':_0x859753,'isJourneyLocal':!![]};try{const _0x37c7f0=await fetchSegment(_0x48c3e1,_0x98d12f,_0x40d964,_0x47c202);if(!_0x37c7f0)throw new Error(_0x22b2d4(0x2ba));const _0xe7a0a6=generateJourneyLocalName(_0x37c7f0['name']),_0x277054=_0x37c7f0[_0x22b2d4(0x27f)]===SEGMENT_KIND_JOURNEY&&_0xe7a0a6!==undefined;let _0x4215f6=_0x37c7f0[_0x22b2d4(0x24d)],_0xa90cf2;if(_0x277054&&_0x37c7f0[_0x22b2d4(0x202)]){const _0x4f83e9=apiRuleToYaml(_0x37c7f0[_0x22b2d4(0x202)]);_0x146795[_0x22b2d4(0x1f4)](_0x40d964,_0x4f83e9);const _0x32a19a=async _0x4fe02f=>{const _0x1fc840=_0x22b2d4,_0xf5bf92=collectSegmentRefsFromRule(_0x4fe02f);for(const _0x5e1761 of _0xf5bf92){if(!_0x146795[_0x1fc840(0x20c)](_0x5e1761))try{const _0x35e33b=await fetchSegment(_0x48c3e1,_0x98d12f,_0x5e1761,_0x47c202);if(_0x35e33b?.[_0x1fc840(0x202)]){const _0x1da281=apiRuleToYaml(_0x35e33b[_0x1fc840(0x202)]);_0x146795[_0x1fc840(0x1f4)](_0x5e1761,_0x1da281),await _0x32a19a(_0x1da281);}}catch(_0x3d6173){logger[_0x1fc840(0x2ab)](_0x1fc840(0x29d)+_0x5e1761+':\x20'+_0x3d6173);}}};await _0x32a19a(_0x4f83e9);const _0x16b413=serializeExpandedRule(_0x4f83e9,_0x146795),_0x142322=_0x56429d[_0x22b2d4(0x2c4)](_0x16b413);if(_0x142322&&_0x142322[_0x22b2d4(0x224)]>0x0){const _0xe7cd27=_0x17894f[_0x22b2d4(0x2c4)](_0x16b413)||0x0,_0x103bb4=_0x142322[_0xe7cd27]||_0x142322[_0x142322[_0x22b2d4(0x224)]-0x1];_0x17894f[_0x22b2d4(0x1f4)](_0x16b413,_0xe7cd27+0x1),_0x4215f6=_0x103bb4,_0x2e5d53[_0x22b2d4(0x25a)](_0x4215f6),_0x6cf385[_0x22b2d4(0x1f4)](_0x40d964,_0x4215f6);const _0x1a8918=await resolveRuleSegmentRefs(_0x4f83e9,async _0x3d1dcb=>{const _0x789c44=_0x22b2d4,_0x4fa1b9=_0x6cf385[_0x789c44(0x2c4)](_0x3d1dcb);if(_0x4fa1b9)return _0x4fa1b9;const _0x3a9e72=await _0x152b8d[_0x789c44(0x209)](_0x3d1dcb);return _0x3a9e72['name'];});_0xa90cf2={'description':_0x37c7f0[_0x22b2d4(0x2b4)],'rule':_0x1a8918};}else{const _0xe8bb34=_0x216da0['get'](_0x16b413);if(_0xe8bb34)_0x4215f6=_0xe8bb34,_0x6cf385[_0x22b2d4(0x1f4)](_0x40d964,_0x4215f6);else{if(_0xe7a0a6){let _0x5f4612=_0xe7a0a6,_0x5b9d39=0x2;while(_0x2e5d53[_0x22b2d4(0x20c)](_0x5f4612)||_0x40e86f['has'](_0x5f4612)){_0x5f4612=_0xe7a0a6+'_'+_0x5b9d39,_0x5b9d39++;}_0x2e5d53[_0x22b2d4(0x25a)](_0x5f4612),_0x4215f6=_0x5f4612;}_0x6cf385[_0x22b2d4(0x1f4)](_0x40d964,_0x4215f6),_0x216da0[_0x22b2d4(0x1f4)](_0x16b413,_0x4215f6);const _0x11c899=await resolveRuleSegmentRefs(_0x4f83e9,async _0x5b2300=>{const _0x31dbc8=_0x22b2d4,_0x22bfae=_0x6cf385[_0x31dbc8(0x2c4)](_0x5b2300);if(_0x22bfae)return _0x22bfae;const _0x74a224=await _0x152b8d[_0x31dbc8(0x209)](_0x5b2300);return _0x74a224[_0x31dbc8(0x24d)];});_0xa90cf2={'description':_0x37c7f0[_0x22b2d4(0x2b4)],'rule':_0x11c899};}}}return{'name':_0x4215f6,'isJourneyLocal':_0x277054,'definition':_0xa90cf2};}catch(_0x13994e){return logger[_0x22b2d4(0x2ab)](_0x22b2d4(0x286)+_0x40d964+':\x20'+_0x13994e),{'name':_0x40d964,'isJourneyLocal':![]};}},'resolveActivation':async _0x3c8b87=>{const _0x317ca5=a152_0x4c54,_0x4d9932=_0x10ac93[_0x317ca5(0x2c4)](_0x3c8b87);if(_0x4d9932!==undefined)return{'name':_0x4d9932,'isJourneyLocal':!![]};try{let _0x21b7de=_0x47f613?.['get'](_0x3c8b87);!_0x21b7de&&(_0x21b7de=await _0x48c3e1[_0x317ca5(0x2a4)][_0x317ca5(0x26e)](_0x1b34ce,_0x3c8b87));const _0x6677de=_0x21b7de[_0x317ca5(0x1ed)][_0x317ca5(0x25e)][_0x317ca5(0x24d)]||_0x3c8b87,_0x10e49d=sanitizeYamlKey(_0x6677de)||_0x317ca5(0x208)+_0x3c8b87,_0x45261c=_0x10e49d;_0x10ac93[_0x317ca5(0x1f4)](_0x3c8b87,_0x45261c);const _0x55e743=journeyActivationStepToYaml(_0x21b7de,_0x4f65bb,_0x5dec88);return{'name':_0x45261c,'isJourneyLocal':!![],'definition':_0x55e743};}catch(_0x1d9c25){return logger[_0x317ca5(0x2ab)](_0x317ca5(0x2b1)+_0x3c8b87+':\x20'+_0x1d9c25),{'name':_0x3c8b87,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x3ab700,_0x579025)=>resolveJumpTarget(_0x3ab700,_0x579025,_0x5eeb83,async _0x35d15=>{const _0x2b4124=a152_0x4c54,_0x407d82=_0x4b94cb?.[_0x2b4124(0x2c4)](_0x35d15);if(_0x407d82)return _0x407d82;return _0x48c3e1[_0x2b4124(0x2a4)]['getJourney'](_0x35d15);})};return _0x152b8d=_0x576d0a,_0x576d0a;},_0x35485f=async _0x34c288=>{const _0x3a1984=a152_0x4c54,{collectSegmentIdsFromJourneyApi:_0x1facc6}=await import('./journey-yaml.js'),{batchAsync:_0x3c99f0}=await import('../../utils/async.js'),_0x2d133a=new Set();for(const _0x209c11 of _0x34c288){let _0x322192=_0x4b94cb?.[_0x3a1984(0x2c4)](_0x209c11);!_0x322192&&(_0x322192=await _0x48c3e1[_0x3a1984(0x2a4)][_0x3a1984(0x1fb)](_0x209c11));const _0x299c36=_0x1facc6(_0x322192);for(const _0x3e27e2 of _0x299c36){_0x2d133a[_0x3a1984(0x25a)](_0x3e27e2);}}let _0x4492d5=Array[_0x3a1984(0x28a)](_0x2d133a);while(_0x4492d5['length']>0x0){const _0x101c4e=_0x4492d5[_0x3a1984(0x274)](_0x87b068=>!_0x277de9[_0x3a1984(0x20c)](_0x87b068));if(_0x101c4e[_0x3a1984(0x224)]===0x0)break;const _0x4d0c95=await _0x3c99f0(_0x101c4e,async _0x838e75=>{const _0x596ef6=_0x3a1984;_0x277de9[_0x596ef6(0x25a)](_0x838e75);const _0x297378=await fetchSegment(_0x48c3e1,_0x98d12f,_0x838e75,_0x47c202);if(!_0x297378)return null;return{'segmentId':_0x838e75,'segment':_0x297378};},0xa),_0x38851a=new Set();for(const _0x3a8185 of _0x4d0c95){if(!_0x3a8185?.[_0x3a1984(0x23d)]?.[_0x3a1984(0x202)])continue;const _0x25d094=apiRuleToYaml(_0x3a8185[_0x3a1984(0x23d)][_0x3a1984(0x202)]);_0x146795['set'](_0x3a8185['segmentId'],_0x25d094);const _0x3cb1fe=collectSegmentRefsFromRule(_0x25d094);for(const _0x16f138 of _0x3cb1fe){!_0x277de9[_0x3a1984(0x20c)](_0x16f138)&&_0x38851a[_0x3a1984(0x25a)](_0x16f138);}}_0x4492d5=Array[_0x3a1984(0x28a)](_0x38851a);}};return{'createYamlContext':_0x1a6fd7,'prefetchJourneySegments':_0x35485f};}export async function executePushSegments(_0x1af817,_0x307f3a,_0x1a6a23,_0x8dad68,_0x16c99c){const _0xd92b90=a152_0x14882b,{segmentDefToCreateRequest:_0x3c5744,segmentDefToUpdateRequest:_0x23c406}=await import(_0xd92b90(0x2c5)),_0x2dce98=_0x1a6a23[_0xd92b90(0x27d)],_0x23924f=0x5,_0x1a5c2a=async _0x5c8e23=>{const _0x39eb43=_0xd92b90,_0x462902=_0x5c8e23['folderPath']?_0x2dce98[_0x39eb43(0x2c4)](_0x5c8e23[_0x39eb43(0x2a2)]):undefined;let _0x55b002;const _0x3ae965={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x5065cf=_0x5c8e23[_0x39eb43(0x2db)];if(_0x5c8e23['yamlConfig'][_0x39eb43(0x202)]){const _0x3ffccb=createSegmentIdResolver(_0x1a6a23[_0x39eb43(0x24b)],_0x5c8e23[_0x39eb43(0x2db)][_0x39eb43(0x24d)]),_0x286752=await resolveRuleSegmentIds(_0x5c8e23[_0x39eb43(0x2db)][_0x39eb43(0x202)],_0x3ffccb);_0x5065cf={..._0x5c8e23['yamlConfig'],'rule':_0x286752};}try{if(_0x5c8e23['isNew']){_0x16c99c[_0x39eb43(0x241)]?.({'type':_0x39eb43(0x22b),'name':_0x5c8e23[_0x39eb43(0x2db)]['name']});const _0x2ce8b8=_0x3c5744(_0x5065cf,_0x462902),_0x146881=await _0x16c99c[_0x39eb43(0x27a)](_0x39eb43(0x252)+_0x5c8e23[_0x39eb43(0x2db)][_0x39eb43(0x24d)]+_0x39eb43(0x1d3),()=>_0x1af817['segment'][_0x39eb43(0x278)](_0x8dad68[_0x39eb43(0x1f5)],_0x2ce8b8));_0x55b002=_0x146881['data']['id'],_0x1a6a23[_0x39eb43(0x24b)][_0x39eb43(0x1f4)](_0x5c8e23[_0x39eb43(0x2db)][_0x39eb43(0x24d)],_0x55b002),_0x3ae965[_0x39eb43(0x1e7)]={'name':_0x5c8e23[_0x39eb43(0x2db)]['name'],'id':_0x55b002},_0x16c99c[_0x39eb43(0x241)]?.({'type':_0x39eb43(0x289),'name':_0x5c8e23[_0x39eb43(0x2db)][_0x39eb43(0x24d)],'segmentId':_0x55b002}),_0x16c99c['logSuccess']?.('Created\x20segment\x20\x27'+_0x5c8e23['yamlConfig']['name']+'\x27'),_0x3ae965[_0x39eb43(0x236)]=0x1;}else{if(_0x5c8e23[_0x39eb43(0x264)]){_0x16c99c['onProgress']?.({'type':_0x39eb43(0x247),'name':_0x5c8e23[_0x39eb43(0x2db)][_0x39eb43(0x24d)]});const _0x36ab91=_0x23c406(_0x5065cf);_0x462902!==_0x5c8e23[_0x39eb43(0x2ae)]?.[_0x39eb43(0x238)]&&(_0x36ab91['segmentFolderId']=_0x462902?parseInt(_0x462902,0xa):undefined),await _0x16c99c['withProgress']('Updating\x20segment\x20\x27'+_0x5c8e23[_0x39eb43(0x2db)][_0x39eb43(0x24d)]+'\x27...',()=>_0x1af817[_0x39eb43(0x23d)]['updateSegmentById'](_0x8dad68[_0x39eb43(0x1f5)],_0x5c8e23['existingSegment']['id'],_0x36ab91)),_0x55b002=_0x5c8e23[_0x39eb43(0x2ae)]['id'],_0x16c99c[_0x39eb43(0x241)]?.({'type':_0x39eb43(0x29f),'name':_0x5c8e23[_0x39eb43(0x2db)][_0x39eb43(0x24d)]}),_0x16c99c['logSuccess']?.(_0x39eb43(0x222)+_0x5c8e23[_0x39eb43(0x2db)]['name']+'\x27'),_0x3ae965[_0x39eb43(0x1f2)]=0x1;}else _0x55b002=_0x5c8e23['existingSegment']['id'];}}catch(_0x577e97){const _0x4b480a=isHttp400Error(_0x577e97),_0x1bd5e8=_0x4b480a?ErrorCode[_0x39eb43(0x20b)]:ErrorCode[_0x39eb43(0x2bd)],_0x5f3c8b=getErrorMessage(_0x577e97);throw new SDKError(_0x1bd5e8,_0x39eb43(0x245)+(_0x5c8e23[_0x39eb43(0x2b3)]?_0x39eb43(0x2b0):_0x39eb43(0x250))+_0x39eb43(0x2d5)+_0x5c8e23[_0x39eb43(0x20e)]+_0x39eb43(0x255)+_0x5f3c8b,_0x577e97);}try{const _0xbc44fc=await syncActivationsForSegment(_0x1af817,_0x8dad68[_0x39eb43(0x1f5)],_0x55b002,_0x5c8e23['yamlConfig']['name'],_0x5c8e23[_0x39eb43(0x207)],_0x16c99c,_0x5c8e23[_0x39eb43(0x20e)]);_0x3ae965[_0x39eb43(0x223)]=_0xbc44fc;}catch(_0x1983aa){if(_0x1983aa instanceof SDKError)throw _0x1983aa;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x39eb43(0x23b)+_0x5c8e23[_0x39eb43(0x2db)][_0x39eb43(0x24d)]+_0x39eb43(0x1e4)+_0x5c8e23[_0x39eb43(0x20e)]+'\x0a\x20\x20'+getErrorMessage(_0x1983aa),_0x1983aa);}return _0x3ae965;},_0x2b6b89=await batchAsync(_0x307f3a,_0x1a5c2a,_0x23924f),_0x3ec1ca={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0xacadb8 of _0x2b6b89){_0x3ec1ca[_0xd92b90(0x236)]+=_0xacadb8[_0xd92b90(0x236)],_0x3ec1ca[_0xd92b90(0x1f2)]+=_0xacadb8['updated'],_0xacadb8[_0xd92b90(0x1e7)]&&_0x3ec1ca[_0xd92b90(0x277)][_0xd92b90(0x1f4)](_0xacadb8[_0xd92b90(0x1e7)][_0xd92b90(0x24d)],_0xacadb8[_0xd92b90(0x1e7)]['id']),_0x3ec1ca[_0xd92b90(0x223)][_0xd92b90(0x236)]+=_0xacadb8['activations']['created'],_0x3ec1ca[_0xd92b90(0x223)][_0xd92b90(0x1f2)]+=_0xacadb8['activations'][_0xd92b90(0x1f2)],_0x3ec1ca[_0xd92b90(0x223)][_0xd92b90(0x279)]+=_0xacadb8[_0xd92b90(0x223)]['deleted'];}return _0x3ec1ca;}async function syncActivationsForSegment(_0x2b9dd4,_0x332bd9,_0x1574ce,_0x15819b,_0x1507eb,_0x44d59e,_0x5f5aa1){const _0x2f5de1=a152_0x14882b,_0x1800bd={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x40203c of _0x1507eb){try{if(_0x40203c['type']===_0x2f5de1(0x2b0)&&_0x40203c[_0x2f5de1(0x246)])_0x44d59e[_0x2f5de1(0x241)]?.({'type':_0x2f5de1(0x22d),'segmentName':_0x15819b,'activationName':_0x40203c['name']}),await _0x44d59e[_0x2f5de1(0x27a)](_0x2f5de1(0x28c)+_0x40203c[_0x2f5de1(0x24d)]+_0x2f5de1(0x1d3),()=>_0x2b9dd4['segment'][_0x2f5de1(0x294)](_0x332bd9,_0x1574ce,_0x40203c[_0x2f5de1(0x246)])),_0x44d59e['onProgress']?.({'type':_0x2f5de1(0x2d4),'segmentName':_0x15819b,'activationName':_0x40203c['name']}),_0x44d59e[_0x2f5de1(0x248)]?.(_0x2f5de1(0x2be)+_0x40203c[_0x2f5de1(0x24d)]+'\x27'),_0x1800bd['created']++;else{if(_0x40203c[_0x2f5de1(0x20f)]===_0x2f5de1(0x250)&&_0x40203c['validatedRequest']&&_0x40203c['existingActivation'])_0x44d59e['onProgress']?.({'type':_0x2f5de1(0x213),'segmentName':_0x15819b,'activationName':_0x40203c[_0x2f5de1(0x24d)]}),await _0x44d59e[_0x2f5de1(0x27a)](_0x2f5de1(0x1f1)+_0x40203c[_0x2f5de1(0x24d)]+'\x27...',()=>_0x2b9dd4[_0x2f5de1(0x23d)][_0x2f5de1(0x2af)](_0x332bd9,_0x1574ce,_0x40203c['existingActivation']['id'],_0x40203c[_0x2f5de1(0x246)])),_0x44d59e['onProgress']?.({'type':_0x2f5de1(0x2a9),'segmentName':_0x15819b,'activationName':_0x40203c['name']}),_0x44d59e[_0x2f5de1(0x248)]?.(_0x2f5de1(0x1d0)+_0x40203c['name']+'\x27'),_0x1800bd[_0x2f5de1(0x1f2)]++;else _0x40203c[_0x2f5de1(0x20f)]===_0x2f5de1(0x1e6)&&_0x40203c[_0x2f5de1(0x1e0)]&&(_0x44d59e[_0x2f5de1(0x241)]?.({'type':_0x2f5de1(0x1f8),'segmentName':_0x15819b,'activationName':_0x40203c['name']}),await _0x44d59e['withProgress'](_0x2f5de1(0x1f6)+_0x40203c[_0x2f5de1(0x24d)]+_0x2f5de1(0x1d3),()=>_0x2b9dd4[_0x2f5de1(0x23d)]['deleteActivation'](_0x332bd9,_0x1574ce,_0x40203c['existingActivation']['id'])),_0x44d59e[_0x2f5de1(0x241)]?.({'type':_0x2f5de1(0x297),'segmentName':_0x15819b,'activationName':_0x40203c[_0x2f5de1(0x24d)]}),_0x44d59e[_0x2f5de1(0x2bb)]?.(_0x2f5de1(0x24a)+_0x40203c[_0x2f5de1(0x24d)]+'\x27'),_0x1800bd[_0x2f5de1(0x279)]++);}}catch(_0x5a63f5){const _0x4b5e2e=isHttp400Error(_0x5a63f5),_0x3088cd=_0x4b5e2e?ErrorCode[_0x2f5de1(0x2cc)]:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x981f75=getErrorMessage(_0x5a63f5);throw new SDKError(_0x3088cd,_0x2f5de1(0x245)+_0x40203c['type']+_0x2f5de1(0x23f)+_0x40203c[_0x2f5de1(0x24d)]+_0x2f5de1(0x1e4)+_0x5f5aa1+'\x0a\x20\x20'+_0x981f75,_0x5a63f5);}}return _0x1800bd;}export async function executePushFolders(_0xb74b5f,_0x464e74,_0x1e98e3,_0x395a39,_0x5e2cf0){const _0x2bc17e=a152_0x14882b,_0x1934b7=new Map(_0x1e98e3),_0x1ec58f=sortFoldersByDepth(_0x464e74);for(const _0x440e2b of _0x1ec58f){const _0x3a924d=_0x440e2b[_0x2bc17e(0x2d7)]('/'),_0x3a1deb=_0x3a924d[_0x3a924d[_0x2bc17e(0x224)]-0x1],_0x46ce0b=_0x3a924d[_0x2bc17e(0x280)](0x0,-0x1)[_0x2bc17e(0x1d5)]('/'),_0x536db6=_0x1934b7[_0x2bc17e(0x2c4)](_0x46ce0b);_0x5e2cf0[_0x2bc17e(0x241)]?.({'type':'folder_creating','folder':_0x440e2b});const _0x43ac50={'name':_0x3a1deb,'parentFolderId':_0x536db6},_0x49abae=await _0x5e2cf0[_0x2bc17e(0x27a)](_0x2bc17e(0x2ca)+_0x440e2b+'\x27...',()=>_0xb74b5f[_0x2bc17e(0x23d)][_0x2bc17e(0x249)](_0x395a39[_0x2bc17e(0x1f5)],_0x43ac50));_0x1934b7[_0x2bc17e(0x1f4)](_0x440e2b,_0x49abae[_0x2bc17e(0x22a)]['id']),_0x5e2cf0['onProgress']?.({'type':_0x2bc17e(0x2b6),'folder':_0x440e2b,'folderId':_0x49abae['data']['id']}),_0x5e2cf0[_0x2bc17e(0x27b)]?.(_0x2bc17e(0x290)+_0x440e2b+'\x27');}return _0x1934b7;}export async function executePushSegmentDeletions(_0x1d14a7,_0x346974,_0x46af19){const _0x58dca3=a152_0x14882b;if(_0x346974['length']===0x0)return 0x0;const {batchAsync:_0x1024b5}=await import(_0x58dca3(0x288)),_0x4b5972=0x5,_0x4c9498=await _0x1024b5(_0x346974,async _0x20f2b2=>{const _0x45108e=_0x58dca3;return _0x46af19[_0x45108e(0x241)]?.({'type':_0x45108e(0x2cb),'name':_0x20f2b2[_0x45108e(0x24d)]}),await _0x1d14a7[_0x45108e(0x23d)]['deleteSegment'](_0x20f2b2['id']),_0x46af19[_0x45108e(0x241)]?.({'type':'segment_deleted','name':_0x20f2b2[_0x45108e(0x24d)]}),_0x46af19[_0x45108e(0x2bb)]?.(_0x45108e(0x239)+_0x20f2b2[_0x45108e(0x24d)]+'\x27'),0x1;},_0x4b5972);return _0x4c9498[_0x58dca3(0x1ff)]((_0x4c37fa,_0xacb201)=>_0x4c37fa+_0xacb201,0x0);}export async function executePushJourneys(_0x46eedb,_0x98386d,_0x2af7c3,_0x4a8e6a,_0x1394f3){const _0x316510=a152_0x14882b,{journeyDefToRequest:_0xa433c4}=await import(_0x316510(0x1dc)),{activationDefToCreateRequest:_0x4cac97,yamlRuleToApi:_0x3a491f,validateSegmentRule:_0xc18e2d}=await import(_0x316510(0x2c5)),_0x2e8b70={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x4d8c51=new Map(_0x2af7c3[_0x316510(0x24b)]),_0x13b476=0x5;for(let _0x517e6c=0x0;_0x517e6c<_0x98386d[_0x316510(0x224)];_0x517e6c+=_0x13b476){const _0x3fc44a=_0x98386d[_0x316510(0x280)](_0x517e6c,_0x517e6c+_0x13b476),_0x15224b=await Promise[_0x316510(0x2c7)](_0x3fc44a['map'](async _0x5eeffa=>{const _0x2769d1=_0x316510;if(!_0x5eeffa[_0x2769d1(0x2b3)]&&!_0x5eeffa['hasChanges'])return{'action':_0x2769d1(0x1e2),'name':_0x5eeffa[_0x2769d1(0x2db)][_0x2769d1(0x24d)],'journeyId':_0x5eeffa[_0x2769d1(0x1fd)]?.['id']};const _0x2368cf=_0x5eeffa[_0x2769d1(0x2a2)]?_0x2af7c3[_0x2769d1(0x27d)][_0x2769d1(0x2c4)](_0x5eeffa[_0x2769d1(0x2a2)]):undefined;_0x1394f3[_0x2769d1(0x241)]?.({'type':_0x5eeffa['isNew']?_0x2769d1(0x237):'journey_updating','name':_0x5eeffa[_0x2769d1(0x2db)][_0x2769d1(0x24d)]});try{const _0x12e07f=await executeSingleJourneyPush(_0x46eedb,_0x5eeffa,{..._0x2af7c3,'segmentNameToId':_0x4d8c51},{'parentId':_0x4a8e6a[_0x2769d1(0x1f5)],'rootFolderId':_0x4a8e6a['rootFolderId'],'folderId':_0x2368cf,'verbose':_0x4a8e6a[_0x2769d1(0x2b9)]},_0x1394f3,{'journeyDefToRequest':_0xa433c4,'activationDefToCreateRequest':_0x4cac97,'yamlRuleToApi':_0x3a491f,'validateSegmentRule':_0xc18e2d});for(const [_0x543059,_0x575b6a]of _0x12e07f['embeddedSegmentNameToId']){_0x4d8c51[_0x2769d1(0x1f4)](_0x543059,_0x575b6a),_0x2e8b70['embeddedSegmentNameToId']['set'](_0x543059,_0x575b6a);}if(_0x12e07f[_0x2769d1(0x268)]===_0x2769d1(0x236))_0x1394f3[_0x2769d1(0x241)]?.({'type':_0x2769d1(0x201),'name':_0x5eeffa[_0x2769d1(0x2db)][_0x2769d1(0x24d)],'journeyId':_0x12e07f['journeyId']}),_0x1394f3[_0x2769d1(0x248)]?.(_0x2769d1(0x1db)+_0x5eeffa['yamlConfig'][_0x2769d1(0x24d)]+'\x27'),_0x2e8b70[_0x2769d1(0x236)]++;else _0x12e07f[_0x2769d1(0x268)]==='updated'&&(_0x1394f3[_0x2769d1(0x241)]?.({'type':_0x2769d1(0x1ef),'name':_0x5eeffa[_0x2769d1(0x2db)][_0x2769d1(0x24d)]}),_0x1394f3[_0x2769d1(0x248)]?.(_0x2769d1(0x22e)+_0x5eeffa[_0x2769d1(0x2db)][_0x2769d1(0x24d)]+'\x27'),_0x2e8b70[_0x2769d1(0x1f2)]++);return{'action':_0x12e07f[_0x2769d1(0x268)],'name':_0x5eeffa[_0x2769d1(0x2db)]['name'],'journeyId':_0x12e07f[_0x2769d1(0x2d2)]};}catch(_0x4c4d1e){const _0x3d5627=isHttp400Error(_0x4c4d1e),_0x7e705=_0x3d5627?ErrorCode[_0x2769d1(0x2dc)]:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x3227e9=getErrorMessage(_0x4c4d1e);throw new SDKError(_0x7e705,_0x2769d1(0x245)+(_0x5eeffa[_0x2769d1(0x2b3)]?_0x2769d1(0x2b0):'update')+_0x2769d1(0x231)+_0x5eeffa[_0x2769d1(0x20e)]+_0x2769d1(0x255)+_0x3227e9,_0x4c4d1e);}}));_0x2e8b70[_0x316510(0x1f3)][_0x316510(0x299)](..._0x15224b);}return _0x2e8b70;}async function matchExistingJourneySegments(_0x3fb00a,_0xa2d060,_0xe815b4,_0xead3bf,_0x3a13ef){const _0x5a3809=a152_0x14882b;if(!_0xa2d060[_0x5a3809(0x1fd)]||!_0xa2d060[_0x5a3809(0x2db)][_0x5a3809(0x2bf)])return;const _0x1564cb=new Map(),_0x2906cf=new Set();for(const _0x580d75 of Object[_0x5a3809(0x24c)](_0xa2d060[_0x5a3809(0x2db)]['segments'])){const _0x1d5b03=generateDeterministicJourneySegmentName(_0xa2d060[_0x5a3809(0x2db)][_0x5a3809(0x24d)],_0x580d75);_0x1564cb[_0x5a3809(0x1f4)](_0x1d5b03,_0x580d75),_0x2906cf[_0x5a3809(0x25a)](_0x580d75);}const _0x3b8ddc=[],_0x569f0e=collectSegmentIdsFromJourneyApi(_0xa2d060[_0x5a3809(0x1fd)]);for(const _0x20bc71 of _0x569f0e){const _0xd859ef=await fetchSegment(_0x3fb00a,_0xe815b4,_0x20bc71,_0xead3bf);if(!_0xd859ef?.[_0x5a3809(0x24d)])continue;const _0x18af68=_0x1564cb[_0x5a3809(0x2c4)](_0xd859ef['name']);_0x18af68?(_0x3a13ef['set'](_0x18af68,_0x20bc71),_0x2906cf[_0x5a3809(0x1e6)](_0x18af68)):_0x3b8ddc[_0x5a3809(0x299)]({'id':_0x20bc71,'seg':_0xd859ef});}if(_0x2906cf[_0x5a3809(0x21a)]>0x0&&_0x3b8ddc[_0x5a3809(0x224)]>0x0){const {localExpandedRuleToNames:_0x362514}=buildLocalExpandedRuleMappings(_0xa2d060[_0x5a3809(0x2db)]),_0x59a61f=new Map();for(const {id:_0x1818e2,seg:_0x34d026}of _0x3b8ddc){if(_0x34d026['rule']){const _0xe86d0e=apiRuleToYaml(_0x34d026['rule']);_0x59a61f[_0x5a3809(0x1f4)](_0x1818e2,_0xe86d0e);}}for(const {id:_0x39bcb6,seg:_0x155ef5}of _0x3b8ddc){if(!_0x155ef5['rule'])continue;const _0x48cc9c=_0x59a61f[_0x5a3809(0x2c4)](_0x39bcb6);if(!_0x48cc9c)continue;const _0x10103a=serializeExpandedRule(_0x48cc9c,_0x59a61f),_0x34caf1=_0x362514[_0x5a3809(0x2c4)](_0x10103a);if(_0x34caf1){const _0xedba66=_0x34caf1[_0x5a3809(0x28e)](_0x5a5e01=>_0x2906cf['has'](_0x5a5e01));_0xedba66&&(_0x3a13ef[_0x5a3809(0x1f4)](_0xedba66,_0x39bcb6),_0x2906cf[_0x5a3809(0x1e6)](_0xedba66),logger[_0x5a3809(0x2ab)](_0x5a3809(0x2c9)+_0x155ef5['name']+'\x27\x20to\x20local\x20\x27'+_0xedba66+_0x5a3809(0x2cd)));}}}}function a152_0x2baf(){const _0x3d3142=['\x20segment\x20from\x20file:\x20','embedded_segment_creating','split','uniqueServerName','match','connector_config','yamlConfig','JOURNEY_SYNTAX_ERROR','nameToType','Updated\x20activation\x20\x27','journeyBundleName','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','\x27...','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','join','resolveJourneyId','Delete\x20the\x20push\x20recovery\x20file\x20(','versionNumber','progress','parseDocument','Created\x20journey\x20\x27','./journey-yaml.js','skipSegments','map','some','existingActivation','diff','unchanged','state','\x27\x20from\x20file:\x20','behavior','delete','createdSegmentId','index','branches','\x27\x20entry\x20criteria','getSegment','entryCriteria','attributes','DecisionPoint','journey_updated','nameToId','Updating\x20activation\x20\x27','updated','results','set','parentId','Deleting\x20activation\x20\x27','entries','activation_deleting','parentFolder','\x20(referenced\x20in\x20journey\x20','getJourney','stringify','existingJourney','object','reduce','errors','journey_created','rule','and\x20the\x20server\x20segment,\x20then\x20retry.','journeyActivationStepId','values','schedule','activationActions','activation_','resolveSegment','effectiveFolderId','SEGMENT_SYNTAX_ERROR','has','all_columns','absolutePath','type','journeys','localName','message','activation_updating','idToEmailMap','.$1.push-recovery.json','columns','existingSegments','Activation','logWarning','size','conditions','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','Embedded\x20segment\x20\x27','getSegmentEntity','goal\x20criteria','toISOString','182234jLmbeY','Updated\x20segment\x20\x27','activations','length','null','deps','\x27\x20exit\x20criteria','notification','journeyBundleId','data','segment_creating','Activation\x20not\x20found:\x20','activation_creating','Updated\x20journey\x20\x27','Segment\x20not\x20found:\x20','Name\x20has\x20already\x20been\x20taken','\x20journey\x20from\x20file:\x20','sort','Condition','exitCriterias','fetchJourney','created','journey_creating','segmentFolderId','Deleted\x20segment\x20\x27','resolvedRule','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','\x27\x20wait\x20condition','segment','__pending_','\x20activation\x20\x27','listActivations','onProgress','__pending_act_','valid','\x27\x20decision\x20point\x20branch\x20\x27','Failed\x20to\x20','validatedRequest','segment_updating','logSuccess','createFolder','Deleted\x20activation\x20\x27','segmentNameToId','keys','name','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','):\x20','update','list','Creating\x20segment\x20\x27','3437060PGrPYi','journeyBundlesByFolderAndName','\x0a\x20\x20','steps','7bAqhFs','waitStepUnit','WaitStep','add','438728DRNrMm','buildUserMaps','toLowerCase','activationParams','Fetching\x20','activationStepsById','day','includes','with','hasChanges','sha1','segmentByFolderAndName','Stage\x20\x27','action','uniqueSegmentName','activation_template_id','segmentId','parse','journeyName','getActivation','6YrOaRL','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','embedded_segment_created','conditionSegmentId','stage\x20\x27','filter','decision_point','Journey\x20\x27','createdSegmentIds','createSegment','deleted','withProgress','logInfo','getLatestJourneyId','folderPathToId','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','kind','slice','startsWith','17272872JPvFEF','2954664qVNUXQ','NOT_FOUND','entry','Failed\x20to\x20resolve\x20segment\x20','journeyById','../../utils/async.js','segment_created','from','item','Creating\x20activation\x20\x27',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','find','toString','Created\x20folder\x20\x27','waitStepType','stages','createJourneySegment','createActivation','activationsBySegmentId','trim','activation_deleted','connectionIdToNameMap','push','\x27\x20not\x20found\x20in\x20journey\x20\x27','utf-8','\x27\x20milestone','Failed\x20to\x20fetch\x20referenced\x20segment\x20','entry_criteria','segment_updated','milestone','conditionTimeoutDuration','folderPath','relative','journey','yamlActivation','relationships','activationContext','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','activation_updated','folderId','debug','\x27\x20for\x20','3510595sebkPN','existingSegment','updateActivation','create','Failed\x20to\x20resolve\x20activation\x20','journeyStages','isNew','description','max','folder_created','rootFolderId','goal','verbose','Segment\x20not\x20found','logDeleted','Entry\x20criteria:\x20','SEGMENT_UPDATE_ERROR','Created\x20activation\x20\x27','segments','digest','440414CSmHUf','replace',').\x20','get','./child-segment-yaml.js','conditionTimeoutUnit','all','INTERNAL','Matched\x20server\x20segment\x20\x27','Creating\x20folder\x20\x27','segment_deleting','ACTIVATION_SYNTAX_ERROR','\x27\x20by\x20rule\x20content','draft','Duration','tdx.sdk.push-workflow','run_after_journey_refresh','journeyId','waitStep','activation_created'];a152_0x2baf=function(){return _0x3d3142;};return a152_0x2baf();}async function executeSingleJourneyPush(_0x285262,_0x15816f,_0x27fbcb,_0x4c22cd,_0x29e6b7,_0x1bc4e5){const _0xdb7285=a152_0x14882b,{journeyDefToRequest:_0x248ec0,activationDefToCreateRequest:_0x3a6792,yamlRuleToApi:_0x2730b0,validateSegmentRule:_0x12c544}=_0x1bc4e5,_0x8fa1a1=new Map(),_0x1df6c2=new Map();recoverSegmentIdsFromPushRecovery(_0x15816f,_0x8fa1a1,_0x27fbcb[_0xdb7285(0x24b)]);const _0x145822=new Map(),_0x1e5ba8=new Map(),_0x5757e9=new Map();let _0x4ebba7;const _0x3e6643=async()=>{const _0x1267c4=_0xdb7285;if(_0x4ebba7)return;_0x4ebba7=new Map();if(!_0x15816f[_0x1267c4(0x1fd)])return;const _0x240062=await _0x285262['journey']['listActivations'](_0x15816f[_0x1267c4(0x1fd)]['id']);for(const _0xa41e7b of _0x240062){const _0x43e06e=journeyActivationStepToYaml(_0xa41e7b,_0x27fbcb[_0x1267c4(0x214)],_0x27fbcb[_0x1267c4(0x298)]),_0x547680=activationSignature(_0x43e06e);!_0x4ebba7['has'](_0x547680)&&_0x4ebba7[_0x1267c4(0x1f4)](_0x547680,_0xa41e7b['id']),_0x43e06e[_0x1267c4(0x24d)]&&_0x1df6c2[_0x1267c4(0x1f4)](_0x43e06e[_0x1267c4(0x24d)],_0xa41e7b['id']);}};await matchExistingJourneySegments(_0x285262,_0x15816f,_0x4c22cd['parentId'],_0x27fbcb[_0xdb7285(0x217)],_0x27fbcb[_0xdb7285(0x24b)]);const _0x9fb26c={'resolveSegmentId':async _0x4f075f=>{const _0x294b75=_0xdb7285,_0x5b1baa=_0x27fbcb[_0x294b75(0x24b)][_0x294b75(0x2c4)](_0x4f075f);if(!_0x5b1baa)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x294b75(0x22f)+_0x4f075f+'\x20(referenced\x20in\x20journey\x20'+_0x15816f[_0x294b75(0x2db)][_0x294b75(0x24d)]+')');return _0x5b1baa;},'resolveEmbeddedSegmentId':async(_0x19ef9f,_0x514920)=>{const _0x4285a4=_0xdb7285,_0x2228c2=_0x27fbcb[_0x4285a4(0x24b)][_0x4285a4(0x2c4)](_0x19ef9f);if(_0x2228c2)return _0x2228c2;const _0x38d75e=_0x27fbcb[_0x4285a4(0x217)][_0x4285a4(0x28e)](_0x5ccfc7=>_0x5ccfc7[_0x4285a4(0x24d)]===_0x19ef9f);if(_0x38d75e)return _0x27fbcb[_0x4285a4(0x24b)][_0x4285a4(0x1f4)](_0x19ef9f,_0x38d75e['id']),_0x38d75e['id'];if(_0x15816f['isNew']){const {stageName:_0x37a47e,criteriaName:_0x3feb70}=findSegmentCriteriaLocation(_0x15816f[_0x4285a4(0x2db)],_0x19ef9f);return _0x12c544(_0x19ef9f,_0x514920[_0x4285a4(0x202)]),_0x1e5ba8['set'](_0x19ef9f,{'definition':_0x514920,'stageName':_0x37a47e,'criteriaName':_0x3feb70}),createPendingSegmentId(_0x19ef9f);}const _0x23ab03=_0x15816f['existingJourney']?.['id'];if(!_0x23ab03)throw new SDKError(ErrorCode[_0x4285a4(0x2c8)],_0x4285a4(0x2a8));const _0x1f292f=_0x145822[_0x4285a4(0x2c4)](_0x19ef9f);if(_0x1f292f)return _0x1f292f;const _0x3c8bc3=((async()=>{const _0x528748=_0x4285a4;_0x12c544(_0x19ef9f,_0x514920[_0x528748(0x202)]);const _0x174bb7=generateDeterministicJourneySegmentName(_0x15816f[_0x528748(0x2db)][_0x528748(0x24d)],_0x19ef9f),_0x342e19=_0x27fbcb[_0x528748(0x217)][_0x528748(0x28e)](_0x31df28=>_0x31df28[_0x528748(0x24d)]===_0x174bb7),_0xb1856c=createSegmentIdResolver(_0x27fbcb[_0x528748(0x24b)],_0x19ef9f),_0x144fa7=await resolveRuleSegmentIds(_0x514920[_0x528748(0x202)],_0xb1856c);let _0x360283;return _0x342e19?(await _0x285262['segment']['updateSegmentById'](_0x4c22cd[_0x528748(0x1f5)],_0x342e19['id'],{'description':_0x514920[_0x528748(0x2b4)]||_0x528748(0x2bc)+_0x19ef9f,'rule':_0x2730b0(_0x144fa7),'countPopulation':!![]}),_0x360283=_0x342e19['id'],saveSegmentToPushRecovery(_0x15816f[_0x528748(0x20e)],_0x15816f[_0x528748(0x2db)][_0x528748(0x24d)],_0x19ef9f,{'segmentId':_0x360283,'uniqueServerName':_0x174bb7,'createdAt':new Date()['toISOString']()})):_0x360283=await createOrRecoverEmbeddedSegment(_0x285262,_0x15816f,{'localName':_0x19ef9f,'uniqueSegmentName':_0x174bb7,'description':_0x514920['description']||_0x528748(0x2bc)+_0x19ef9f,'journeyId':_0x23ab03,'resolvedRule':_0x144fa7,'parentId':_0x4c22cd['parentId'],'folderId':_0x4c22cd['rootFolderId']||''},_0x2730b0),_0x27fbcb[_0x528748(0x24b)][_0x528748(0x1f4)](_0x19ef9f,_0x360283),_0x8fa1a1[_0x528748(0x1f4)](_0x19ef9f,_0x360283),_0x360283;})());_0x145822[_0x4285a4(0x1f4)](_0x19ef9f,_0x3c8bc3);try{return await _0x3c8bc3;}finally{_0x145822['delete'](_0x19ef9f);}},'resolveActivationId':async _0x35da5b=>{const _0x3d1d5c=_0xdb7285,_0x4ba930=_0x1df6c2[_0x3d1d5c(0x2c4)](_0x35da5b);if(_0x4ba930)return _0x4ba930;if(_0x15816f[_0x3d1d5c(0x1fd)]){await _0x3e6643();const _0x3be8fe=_0x1df6c2['get'](_0x35da5b);if(_0x3be8fe)return _0x3be8fe;}throw new SDKError(ErrorCode[_0x3d1d5c(0x284)],_0x3d1d5c(0x22c)+_0x35da5b+_0x3d1d5c(0x1fa)+_0x15816f[_0x3d1d5c(0x2db)]['name']+_0x3d1d5c(0x2c3)+_0x3d1d5c(0x21c));},'resolveEmbeddedActivationId':async(_0x4cc969,_0x33bfa5)=>{const _0x37c138=_0xdb7285,_0x2ea95c=_0x1df6c2[_0x37c138(0x2c4)](_0x4cc969);if(_0x2ea95c)return _0x2ea95c;if(_0x15816f[_0x37c138(0x2b3)])return _0x5757e9[_0x37c138(0x1f4)](_0x4cc969,_0x33bfa5),createPendingActivationId(_0x4cc969);if(_0x15816f[_0x37c138(0x1fd)]){await _0x3e6643();const _0x4780fc=_0x1df6c2['get'](_0x33bfa5['name']);if(_0x4780fc)return _0x1df6c2[_0x37c138(0x1f4)](_0x4cc969,_0x4780fc),_0x4780fc;const _0x1294cb=activationSignature(_0x33bfa5),_0x5a5113=_0x4ebba7?.[_0x37c138(0x2c4)](_0x1294cb);if(_0x5a5113)return _0x1df6c2[_0x37c138(0x1f4)](_0x4cc969,_0x5a5113),_0x5a5113;const _0x1e61b2=await _0x3a6792(_0x33bfa5,_0x27fbcb[_0x37c138(0x2a7)]),_0x5a303f={..._0x1e61b2,..._0x33bfa5['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x33bfa5['run_after_journey_refresh']}},_0x309a0b=await _0x285262[_0x37c138(0x2a4)][_0x37c138(0x294)](_0x15816f[_0x37c138(0x1fd)]['id'],_0x5a303f);return _0x1df6c2[_0x37c138(0x1f4)](_0x4cc969,_0x309a0b['id']),_0x309a0b['id'];}throw new SDKError(ErrorCode[_0x37c138(0x2c8)],_0x37c138(0x27e));},'resolveJourneyId':async _0x25eed6=>{const _0xba7d8e=_0xdb7285;try{return await _0x285262[_0xba7d8e(0x2a4)][_0xba7d8e(0x1d6)](_0x4c22cd[_0xba7d8e(0x1f5)],_0x25eed6);}catch(_0x328667){throw new SDKError(ErrorCode['NOT_FOUND'],_0xba7d8e(0x276)+_0x25eed6+_0xba7d8e(0x1d2)+_0x15816f[_0xba7d8e(0x2db)][_0xba7d8e(0x24d)]+'\x27)',_0x328667);}},'resolveStageId':async(_0x2ab4c9,_0x13f7f7)=>{const _0x164134=_0xdb7285,_0x2ed5e7=await _0x285262[_0x164134(0x2a4)][_0x164134(0x1fb)](_0x2ab4c9),_0x317dba=_0x2ed5e7[_0x164134(0x1ed)][_0x164134(0x2b2)]['find'](_0x450667=>_0x450667[_0x164134(0x24d)][_0x164134(0x25d)]()===_0x13f7f7[_0x164134(0x25d)]());if(!_0x317dba?.['id'])throw new SDKError(ErrorCode[_0x164134(0x284)],_0x164134(0x267)+_0x13f7f7+_0x164134(0x29a)+(_0x2ed5e7[_0x164134(0x1ed)]['journeyBundleName']||_0x2ed5e7['attributes']['name'])+'\x27');return _0x317dba['id'];}},_0x619625=await _0x248ec0(_0x15816f[_0xdb7285(0x2db)],_0x4c22cd[_0xdb7285(0x1f5)],_0x9fb26c),_0x43bf41=_0x4c22cd['folderId']||_0x4c22cd[_0xdb7285(0x2b7)];_0x43bf41&&(_0x619625['relationships']={'parentFolder':{'data':{'id':_0x43bf41,'type':'folder'}}});if(_0x15816f['isNew']){if(_0x1e5ba8[_0xdb7285(0x21a)]>0x0||_0x5757e9[_0xdb7285(0x21a)]>0x0)return await executeThreeStepJourneyCreate(_0x285262,_0x15816f,_0x619625,{'pendingEmbeddedSegments':_0x1e5ba8,'pendingEmbeddedActivations':_0x5757e9,'embeddedSegmentNameToId':_0x8fa1a1,'journeyActivationNameToId':_0x1df6c2},{..._0x4c22cd,'effectiveFolderId':_0x43bf41},_0x27fbcb,_0x29e6b7,_0x1bc4e5);else{ensureJourneyDefaults(_0x619625['attributes']);const _0x423b80=await _0x285262[_0xdb7285(0x2a4)][_0xdb7285(0x2b0)](_0x619625);return deletePushRecovery(_0x15816f['absolutePath']),{'action':_0xdb7285(0x236),'journeyId':_0x423b80['id'],'embeddedSegmentNameToId':_0x8fa1a1};}}else{if(_0x15816f[_0xdb7285(0x264)]&&_0x15816f[_0xdb7285(0x1fd)]){_0x619625['id']=_0x15816f[_0xdb7285(0x1fd)]['id'];const _0x5f10b3=_0x619625[_0xdb7285(0x1ed)];_0x15816f[_0xdb7285(0x1fd)][_0xdb7285(0x1ed)]?.[_0xdb7285(0x1d1)]&&(_0x5f10b3[_0xdb7285(0x1d1)]=_0x15816f['existingJourney'][_0xdb7285(0x1ed)][_0xdb7285(0x1d1)]);const _0x8fd1f3=_0x15816f[_0xdb7285(0x1fd)][_0xdb7285(0x1ed)]?.['journeyStages'];return _0x8fd1f3&&_0x619625[_0xdb7285(0x1ed)]['journeyStages']&&injectExistingStageIds(_0x619625[_0xdb7285(0x1ed)][_0xdb7285(0x2b2)],_0x8fd1f3),ensureJourneyDefaults(_0x5f10b3),await _0x285262['journey'][_0xdb7285(0x250)](_0x15816f['existingJourney']['id'],_0x619625),deletePushRecovery(_0x15816f[_0xdb7285(0x20e)]),{'action':_0xdb7285(0x1f2),'journeyId':_0x15816f[_0xdb7285(0x1fd)]['id'],'embeddedSegmentNameToId':_0x8fa1a1};}}return deletePushRecovery(_0x15816f['absolutePath']),{'action':_0xdb7285(0x1e2),'journeyId':_0x15816f['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x8fa1a1};}function findSegmentCriteriaLocation(_0xfa57af,_0x4a47a5){const _0x2dab18=a152_0x14882b,_0x4b93e0=_0xfa57af[_0x2dab18(0x292)]||_0xfa57af['journeys']?.[0x0]?.[_0x2dab18(0x292)]||[];let _0x1aea04=_0x2dab18(0x285),_0x5b3b35=_0x4a47a5;const _0x594fbd=_0xfa57af[_0x2dab18(0x2b8)]||_0xfa57af[_0x2dab18(0x210)]?.[0x0]?.[_0x2dab18(0x2b8)];if(_0x594fbd?.[_0x2dab18(0x23d)]===_0x4a47a5)return{'stageName':'goal','criteriaName':_0x594fbd[_0x2dab18(0x24d)]||_0x4a47a5};_0x4cdc00:for(const _0x3b9dc8 of _0x4b93e0){if(_0x3b9dc8[_0x2dab18(0x29e)]?.[_0x2dab18(0x23d)]===_0x4a47a5){_0x1aea04=_0x3b9dc8[_0x2dab18(0x24d)],_0x5b3b35=_0x3b9dc8[_0x2dab18(0x29e)][_0x2dab18(0x24d)]||_0x4a47a5;break;}if(_0x3b9dc8[_0x2dab18(0x256)])for(const _0x49eece of _0x3b9dc8[_0x2dab18(0x256)]){if(_0x49eece[_0x2dab18(0x20f)]===_0x2dab18(0x275)&&_0x49eece[_0x2dab18(0x263)]?.[_0x2dab18(0x1e9)])for(const _0x5363eb of _0x49eece[_0x2dab18(0x263)][_0x2dab18(0x1e9)]){if(_0x5363eb['segment']===_0x4a47a5){_0x1aea04=_0x3b9dc8[_0x2dab18(0x24d)],_0x5b3b35=_0x5363eb['name']||_0x4a47a5;break _0x4cdc00;}}}}return{'stageName':_0x1aea04,'criteriaName':_0x5b3b35};}async function executeThreeStepJourneyCreate(_0x51ff12,_0x577845,_0x45e170,_0x4f4ae0,_0x2edf52,_0x522dee,_0x26a011,_0x1cbf98){const _0x552846=a152_0x14882b,{activationDefToCreateRequest:_0x5ea601,yamlRuleToApi:_0xc8f11a}=_0x1cbf98,{pendingEmbeddedSegments:_0x41cb65,pendingEmbeddedActivations:_0x390509,embeddedSegmentNameToId:_0xd8de4b}=_0x4f4ae0,_0x35548a=JSON['parse'](JSON[_0x552846(0x1fc)](_0x45e170));ensureJourneyDefaults(_0x35548a['attributes']),stripPendingIds(_0x35548a);const _0x29aa4f=await _0x51ff12[_0x552846(0x2a4)][_0x552846(0x2b0)](_0x35548a),_0x3e9ffa=_0x29aa4f['id'],_0xad210f=new Map();for(const _0x4d7eba of _0x29aa4f[_0x552846(0x1ed)]['journeyStages']){_0xad210f['set'](_0x4d7eba[_0x552846(0x24d)]['toLowerCase'](),_0x4d7eba['id']);}recoverSegmentIdsFromPushRecovery(_0x577845,_0xd8de4b,_0x522dee[_0x552846(0x24b)]);for(const [_0x2f521e,{definition:_0x667f49}]of _0x41cb65){if(_0xd8de4b['has'](_0x2f521e)){_0x26a011['onProgress']?.({'type':'embedded_segment_created','journeyName':_0x577845[_0x552846(0x2db)][_0x552846(0x24d)],'segmentName':_0x2f521e});continue;}const _0x35b359=generateDeterministicJourneySegmentName(_0x577845[_0x552846(0x2db)][_0x552846(0x24d)],_0x2f521e);_0x26a011[_0x552846(0x241)]?.({'type':_0x552846(0x2d6),'journeyName':_0x577845[_0x552846(0x2db)][_0x552846(0x24d)],'segmentName':_0x2f521e});const _0x1e9c11=createSegmentIdResolver(_0x522dee[_0x552846(0x24b)],_0x2f521e),_0x2cc377=await resolveRuleSegmentIds(_0x667f49[_0x552846(0x202)],_0x1e9c11),_0x2a828e=await createOrRecoverEmbeddedSegment(_0x51ff12,_0x577845,{'localName':_0x2f521e,'uniqueSegmentName':_0x35b359,'description':_0x667f49[_0x552846(0x2b4)]||'Entry\x20criteria:\x20'+_0x2f521e,'journeyId':_0x3e9ffa,'resolvedRule':_0x2cc377,'parentId':_0x2edf52[_0x552846(0x1f5)],'folderId':_0x2edf52[_0x552846(0x20a)]||''},_0xc8f11a);_0xd8de4b[_0x552846(0x1f4)](_0x2f521e,_0x2a828e),_0x522dee[_0x552846(0x24b)][_0x552846(0x1f4)](_0x2f521e,_0x2a828e),_0x26a011[_0x552846(0x241)]?.({'type':_0x552846(0x271),'journeyName':_0x577845[_0x552846(0x2db)][_0x552846(0x24d)],'segmentName':_0x2f521e});}const _0x725616=new Map();for(const [_0x40bc01,_0xf8102d]of _0x390509){_0x26a011[_0x552846(0x241)]?.({'type':'embedded_activation_creating','journeyName':_0x577845['yamlConfig'][_0x552846(0x24d)],'activationName':_0x40bc01});const _0x457e1b=await _0x5ea601(_0xf8102d,_0x522dee['activationContext']),_0x1d9e4e={..._0x457e1b,..._0xf8102d[_0x552846(0x2d1)]!==undefined&&{'runAfterJourneyRefresh':_0xf8102d[_0x552846(0x2d1)]}},_0x4bbe84=await _0x51ff12['journey'][_0x552846(0x294)](_0x3e9ffa,_0x1d9e4e);_0x725616[_0x552846(0x1f4)](_0x40bc01,_0x4bbe84['id']),_0x4f4ae0['journeyActivationNameToId']['set'](_0x40bc01,_0x4bbe84['id']),_0x26a011['onProgress']?.({'type':'embedded_activation_created','journeyName':_0x577845[_0x552846(0x2db)]['name'],'activationName':_0x40bc01});}const _0x228001=JSON[_0x552846(0x26c)](JSON['stringify'](_0x45e170));return _0x228001['id']=_0x3e9ffa,ensureJourneyDefaults(_0x228001[_0x552846(0x1ed)]),resolvePendingIdsInRequest(_0x228001,_0x45e170,_0xad210f,_0xd8de4b,_0x725616,_0x26a011),await _0x51ff12[_0x552846(0x2a4)][_0x552846(0x250)](_0x3e9ffa,_0x228001),deletePushRecovery(_0x577845[_0x552846(0x20e)]),{'action':'created','journeyId':_0x3e9ffa,'embeddedSegmentNameToId':_0xd8de4b};}export function stripWaitStepPendingIds(_0x3c3bfd){const _0x99b25e=a152_0x14882b,_0x2ab470=_0x3c3bfd[_0x99b25e(0x272)]&&isPendingSegmentId(_0x3c3bfd[_0x99b25e(0x272)]),_0x27b111=_0x3c3bfd[_0x99b25e(0x21b)]?.[_0x99b25e(0x1df)](_0xee0ce5=>_0xee0ce5[_0x99b25e(0x26b)]&&isPendingSegmentId(_0xee0ce5[_0x99b25e(0x26b)]));(_0x2ab470||_0x27b111)&&(_0x3c3bfd[_0x99b25e(0x291)]=_0x99b25e(0x2cf),_0x3c3bfd[_0x99b25e(0x2d3)]=0x1,_0x3c3bfd[_0x99b25e(0x258)]=_0x99b25e(0x261),delete _0x3c3bfd[_0x99b25e(0x272)],delete _0x3c3bfd['conditionTimeoutDuration'],delete _0x3c3bfd[_0x99b25e(0x2c6)],delete _0x3c3bfd['conditions']);}export function resolveWaitStepPendingIds(_0x2b442f,_0x99ef6b,_0x234fdf,_0x2f2756){const _0x1f5a13=a152_0x14882b;if(_0x99ef6b[_0x1f5a13(0x272)]&&isPendingSegmentId(_0x99ef6b['conditionSegmentId'])){const _0x1d64f8=_0x234fdf(_0x99ef6b['conditionSegmentId'],_0x1f5a13(0x273)+_0x2f2756+_0x1f5a13(0x23c));_0x1d64f8&&(_0x2b442f[_0x1f5a13(0x291)]=_0x1f5a13(0x233),_0x2b442f[_0x1f5a13(0x272)]=_0x1d64f8,delete _0x2b442f[_0x1f5a13(0x2d3)],delete _0x2b442f[_0x1f5a13(0x258)],_0x99ef6b[_0x1f5a13(0x2a1)]!==undefined&&(_0x2b442f[_0x1f5a13(0x2a1)]=_0x99ef6b[_0x1f5a13(0x2a1)]),_0x99ef6b[_0x1f5a13(0x2c6)]&&(_0x2b442f[_0x1f5a13(0x2c6)]=_0x99ef6b[_0x1f5a13(0x2c6)]));}if(_0x99ef6b[_0x1f5a13(0x21b)]){const _0xcab091=_0x99ef6b[_0x1f5a13(0x21b)][_0x1f5a13(0x1df)](_0x42c3a2=>_0x42c3a2[_0x1f5a13(0x26b)]&&isPendingSegmentId(_0x42c3a2[_0x1f5a13(0x26b)]));if(_0xcab091){const _0x2f244a=_0x99ef6b[_0x1f5a13(0x21b)][_0x1f5a13(0x1de)](_0x51fa2d=>{const _0x4b573c=_0x1f5a13;if(_0x51fa2d[_0x4b573c(0x26b)]&&isPendingSegmentId(_0x51fa2d[_0x4b573c(0x26b)])){const _0x328532=_0x234fdf(_0x51fa2d[_0x4b573c(0x26b)],_0x4b573c(0x273)+_0x2f2756+'\x27\x20wait\x20condition');return{..._0x51fa2d,'segmentId':_0x328532||_0x51fa2d['segmentId']};}return{..._0x51fa2d};});_0x2b442f['waitStepType']='Condition',_0x2b442f['conditions']=_0x2f244a,delete _0x2b442f[_0x1f5a13(0x2d3)],delete _0x2b442f[_0x1f5a13(0x258)],delete _0x2b442f[_0x1f5a13(0x272)],delete _0x2b442f[_0x1f5a13(0x2a1)],delete _0x2b442f[_0x1f5a13(0x2c6)];}}}function stripPendingIds(_0x326fcf){const _0x2f7550=a152_0x14882b;_0x326fcf['attributes'][_0x2f7550(0x2b8)]?.[_0x2f7550(0x26b)]&&isPendingSegmentId(_0x326fcf[_0x2f7550(0x1ed)][_0x2f7550(0x2b8)][_0x2f7550(0x26b)])&&delete _0x326fcf[_0x2f7550(0x1ed)][_0x2f7550(0x2b8)];for(const _0x4b3ffb of _0x326fcf[_0x2f7550(0x1ed)][_0x2f7550(0x2b2)]||[]){_0x4b3ffb['entryCriteria']?.[_0x2f7550(0x26b)]&&isPendingSegmentId(_0x4b3ffb[_0x2f7550(0x1ec)][_0x2f7550(0x26b)])&&delete _0x4b3ffb[_0x2f7550(0x1ec)];_0x4b3ffb[_0x2f7550(0x2a0)]?.[_0x2f7550(0x26b)]&&isPendingSegmentId(_0x4b3ffb[_0x2f7550(0x2a0)][_0x2f7550(0x26b)])&&delete _0x4b3ffb[_0x2f7550(0x2a0)];_0x4b3ffb['exitCriterias']&&(_0x4b3ffb[_0x2f7550(0x234)]=_0x4b3ffb[_0x2f7550(0x234)][_0x2f7550(0x274)](_0xe4652d=>!_0xe4652d[_0x2f7550(0x26b)]||!isPendingSegmentId(_0xe4652d[_0x2f7550(0x26b)])));if(_0x4b3ffb['steps'])for(const _0x58fa13 of Object['keys'](_0x4b3ffb[_0x2f7550(0x256)])){const _0xdf4f5c=_0x4b3ffb[_0x2f7550(0x256)][_0x58fa13];_0xdf4f5c[_0x2f7550(0x20f)]==='Activation'&&_0xdf4f5c[_0x2f7550(0x204)]&&isPendingActivationId(_0xdf4f5c['journeyActivationStepId'])&&(_0xdf4f5c[_0x2f7550(0x204)]='');if(_0xdf4f5c[_0x2f7550(0x20f)]===_0x2f7550(0x1ee)&&_0xdf4f5c[_0x2f7550(0x1e9)])for(const _0x32b448 of _0xdf4f5c[_0x2f7550(0x1e9)]){_0x32b448[_0x2f7550(0x26b)]&&isPendingSegmentId(_0x32b448['segmentId'])&&(_0x32b448['segmentId']='');}_0xdf4f5c[_0x2f7550(0x20f)]===_0x2f7550(0x259)&&stripWaitStepPendingIds(_0xdf4f5c);}}}function resolvePendingIdsInRequest(_0x2278bb,_0x2a6a58,_0x171079,_0x32a826,_0x21b78b,_0x955328){const _0x1ee211=a152_0x14882b,_0xefcff8=(_0x650035,_0x2928b6)=>{const _0x3fa54b=a152_0x4c54;if(!isPendingSegmentId(_0x650035))return _0x650035;const _0xf601fd=extractPendingSegmentName(_0x650035),_0x1dd1cd=_0x32a826[_0x3fa54b(0x2c4)](_0xf601fd);return!_0x1dd1cd&&_0x955328[_0x3fa54b(0x219)]?.(_0x3fa54b(0x1d4)+_0xf601fd+_0x3fa54b(0x2ac)+_0x2928b6),_0x1dd1cd;};if(_0x2278bb[_0x1ee211(0x1ed)][_0x1ee211(0x2b8)]?.['segmentId']&&isPendingSegmentId(_0x2278bb[_0x1ee211(0x1ed)][_0x1ee211(0x2b8)][_0x1ee211(0x26b)])){const _0x5cec91=_0xefcff8(_0x2278bb[_0x1ee211(0x1ed)][_0x1ee211(0x2b8)][_0x1ee211(0x26b)],_0x1ee211(0x21f));_0x5cec91&&(_0x2278bb[_0x1ee211(0x1ed)][_0x1ee211(0x2b8)][_0x1ee211(0x26b)]=_0x5cec91);}for(const _0x4ddcc3 of _0x2278bb['attributes'][_0x1ee211(0x2b2)]||[]){const _0x402f64=_0x171079['get'](_0x4ddcc3['name']['toLowerCase']());_0x402f64&&(_0x4ddcc3['id']=_0x402f64);if(_0x4ddcc3['entryCriteria']?.[_0x1ee211(0x26b)]&&isPendingSegmentId(_0x4ddcc3[_0x1ee211(0x1ec)][_0x1ee211(0x26b)])){const _0x35fdc0=_0xefcff8(_0x4ddcc3[_0x1ee211(0x1ec)][_0x1ee211(0x26b)],_0x1ee211(0x273)+_0x4ddcc3[_0x1ee211(0x24d)]+_0x1ee211(0x1ea));_0x35fdc0&&(_0x4ddcc3[_0x1ee211(0x1ec)][_0x1ee211(0x26b)]=_0x35fdc0);}if(_0x4ddcc3[_0x1ee211(0x234)])for(const _0x4c395e of _0x4ddcc3[_0x1ee211(0x234)]){if(_0x4c395e[_0x1ee211(0x26b)]&&isPendingSegmentId(_0x4c395e[_0x1ee211(0x26b)])){const _0x296ed2=_0xefcff8(_0x4c395e[_0x1ee211(0x26b)],_0x1ee211(0x273)+_0x4ddcc3[_0x1ee211(0x24d)]+_0x1ee211(0x227));_0x296ed2&&(_0x4c395e[_0x1ee211(0x26b)]=_0x296ed2);}}if(_0x4ddcc3['milestone']?.['segmentId']&&isPendingSegmentId(_0x4ddcc3[_0x1ee211(0x2a0)][_0x1ee211(0x26b)])){const _0x4caed4=_0xefcff8(_0x4ddcc3[_0x1ee211(0x2a0)][_0x1ee211(0x26b)],'stage\x20\x27'+_0x4ddcc3['name']+_0x1ee211(0x29c));_0x4caed4&&(_0x4ddcc3[_0x1ee211(0x2a0)]['segmentId']=_0x4caed4);}if(_0x4ddcc3[_0x1ee211(0x256)]){const _0x3fe2c9=_0x43c75f=>_0x2a6a58[_0x1ee211(0x1ed)][_0x1ee211(0x2b2)]?.['find'](_0x411227=>_0x411227[_0x1ee211(0x24d)]['toLowerCase']()===_0x4ddcc3[_0x1ee211(0x24d)][_0x1ee211(0x25d)]())?.[_0x1ee211(0x256)]?.[_0x43c75f];for(const _0x56b5eb of Object[_0x1ee211(0x24c)](_0x4ddcc3[_0x1ee211(0x256)])){const _0x1ff9e9=_0x4ddcc3[_0x1ee211(0x256)][_0x56b5eb],_0xd65c5=_0x3fe2c9(_0x56b5eb);if(_0x1ff9e9[_0x1ee211(0x20f)]===_0x1ee211(0x218)&&_0x1ff9e9['journeyActivationStepId']&&(isPendingActivationId(_0x1ff9e9[_0x1ee211(0x204)])||_0x1ff9e9[_0x1ee211(0x204)]==='')){if(_0xd65c5?.['journeyActivationStepId']&&isPendingActivationId(_0xd65c5['journeyActivationStepId'])){const _0x5a1196=extractPendingActivationName(_0xd65c5[_0x1ee211(0x204)]),_0xb09877=_0x21b78b[_0x1ee211(0x2c4)](_0x5a1196);_0xb09877&&(_0x1ff9e9[_0x1ee211(0x204)]=_0xb09877);}}if(_0x1ff9e9[_0x1ee211(0x20f)]===_0x1ee211(0x1ee)&&_0x1ff9e9['branches']&&_0xd65c5?.[_0x1ee211(0x1e9)])for(let _0x3303ab=0x0;_0x3303ab<_0x1ff9e9[_0x1ee211(0x1e9)][_0x1ee211(0x224)];_0x3303ab++){const _0x215eca=_0x1ff9e9[_0x1ee211(0x1e9)][_0x3303ab],_0x18d524=_0xd65c5[_0x1ee211(0x1e9)][_0x3303ab];if(_0x18d524?.['segmentId']&&isPendingSegmentId(_0x18d524[_0x1ee211(0x26b)])){const _0x3c0bed=_0xefcff8(_0x18d524[_0x1ee211(0x26b)],_0x1ee211(0x273)+_0x4ddcc3['name']+_0x1ee211(0x244)+(_0x215eca[_0x1ee211(0x24d)]||_0x3303ab)+'\x27');_0x3c0bed&&(_0x215eca[_0x1ee211(0x26b)]=_0x3c0bed);}}_0x1ff9e9[_0x1ee211(0x20f)]===_0x1ee211(0x259)&&_0xd65c5?.[_0x1ee211(0x20f)]===_0x1ee211(0x259)&&resolveWaitStepPendingIds(_0x1ff9e9,_0xd65c5,_0xefcff8,_0x4ddcc3['name']);}}}}
@@ -1 +1 @@
1
- (function(_0x2324c5,_0x3a6fc2){const _0xab0a75=a153_0x325d,_0x17bd65=_0x2324c5();while(!![]){try{const _0x191bc1=-parseInt(_0xab0a75(0x1d1))/0x1+-parseInt(_0xab0a75(0x1ca))/0x2*(parseInt(_0xab0a75(0x1d9))/0x3)+-parseInt(_0xab0a75(0x1ce))/0x4*(-parseInt(_0xab0a75(0x1da))/0x5)+parseInt(_0xab0a75(0x1d4))/0x6*(-parseInt(_0xab0a75(0x1cf))/0x7)+parseInt(_0xab0a75(0x1d5))/0x8*(-parseInt(_0xab0a75(0x1d6))/0x9)+-parseInt(_0xab0a75(0x1cb))/0xa*(-parseInt(_0xab0a75(0x1d7))/0xb)+-parseInt(_0xab0a75(0x1cd))/0xc*(-parseInt(_0xab0a75(0x1cc))/0xd);if(_0x191bc1===_0x3a6fc2)break;else _0x17bd65['push'](_0x17bd65['shift']());}catch(_0x333110){_0x17bd65['push'](_0x17bd65['shift']());}}}(a153_0x2ed5,0xc8497));function a153_0x2ed5(){const _0x5103cb=['3RsXfEX','710Qzcmjd','name','1199942wFCqbY','830iNihrg','30111809PdcagI','12WCUDzz','18368kMxVqN','1659qhhUQW','add','183026aVTsvg','parentFolderId','get','25476UnrVeO','904svOEJu','65997dKkpQs','62282bklpnj','set'];a153_0x2ed5=function(){return _0x5103cb;};return a153_0x2ed5();}export function buildFolderIdToPathMap(_0xca42f2){const _0x3188c1=a153_0x325d,_0x35e1a7=new Map(),_0x6dc35b=new Map();for(const _0x1e074c of _0xca42f2){_0x6dc35b['set'](_0x1e074c['id'],_0x1e074c);}const _0x1e04a2=new Set();for(const _0x701810 of _0xca42f2){!_0x701810[_0x3188c1(0x1d2)]&&_0x1e04a2[_0x3188c1(0x1d0)](_0x701810['id']);}function _0x45384a(_0x3daae0){const _0x2ed143=_0x3188c1;if(_0x35e1a7['has'](_0x3daae0['id']))return _0x35e1a7[_0x2ed143(0x1d3)](_0x3daae0['id']);if(_0x1e04a2['has'](_0x3daae0['id']))return _0x35e1a7[_0x2ed143(0x1d8)](_0x3daae0['id'],''),'';if(_0x3daae0[_0x2ed143(0x1d2)]){const _0x25d049=_0x6dc35b[_0x2ed143(0x1d3)](_0x3daae0[_0x2ed143(0x1d2)]);if(_0x25d049){const _0x56594a=_0x45384a(_0x25d049),_0x3d227c=_0x56594a?_0x56594a+'/'+_0x3daae0['name']:_0x3daae0['name'];return _0x35e1a7['set'](_0x3daae0['id'],_0x3d227c),_0x3d227c;}}const _0x22d31=_0x3daae0[_0x2ed143(0x1c9)];return _0x35e1a7[_0x2ed143(0x1d8)](_0x3daae0['id'],_0x22d31),_0x22d31;}for(const _0x5b1a9b of _0xca42f2){_0x45384a(_0x5b1a9b);}return _0x35e1a7;}export function buildFolderPathToIdMap(_0x5514f9){const _0x5c3450=a153_0x325d,_0x9ec04d=new Map(),_0x341896=new Map();for(const _0x75ae3f of _0x5514f9){_0x341896['set'](_0x75ae3f['id'],_0x75ae3f);}const _0x2d9e33=new Set();for(const _0x2b17a2 of _0x5514f9){!_0x2b17a2[_0x5c3450(0x1d2)]&&_0x2d9e33[_0x5c3450(0x1d0)](_0x2b17a2['id']);}function _0x5c26b6(_0x54a37e){const _0x17b855=_0x5c3450;if(_0x2d9e33['has'](_0x54a37e['id']))return'';if(_0x54a37e[_0x17b855(0x1d2)]){const _0x9ba872=_0x341896[_0x17b855(0x1d3)](_0x54a37e['parentFolderId']);if(_0x9ba872){const _0xe1a4b0=_0x5c26b6(_0x9ba872);return _0xe1a4b0?_0xe1a4b0+'/'+_0x54a37e[_0x17b855(0x1c9)]:_0x54a37e['name'];}}return _0x54a37e['name'];}for(const _0x257202 of _0x5514f9){const _0x2e0434=_0x5c26b6(_0x257202);_0x9ec04d['set'](_0x2e0434,_0x257202['id']);}return _0x9ec04d;}export function buildFolderMaps(_0xf2fdc5){const _0x118c48=a153_0x325d,_0x537e8d=buildFolderIdToPathMap(_0xf2fdc5),_0x423068=new Map();for(const [_0x5dbbb8,_0x4bdbb3]of _0x537e8d){_0x423068[_0x118c48(0x1d8)](_0x4bdbb3,_0x5dbbb8);}return{'idToPath':_0x537e8d,'pathToId':_0x423068};}function a153_0x325d(_0x1ebed5,_0x1d43fa){_0x1ebed5=_0x1ebed5-0x1c9;const _0x2ed55b=a153_0x2ed5();let _0x325db6=_0x2ed55b[_0x1ebed5];return _0x325db6;}export function getFolderPath(_0x22ec85,_0x573ea7){const _0x2fdc8a=a153_0x325d;if(!_0x22ec85)return'';return _0x573ea7[_0x2fdc8a(0x1d3)](_0x22ec85)??'';}
1
+ function a153_0x5548(){const _0x42e152=['5541426sRdunV','818935CgFjCY','114eCcXIO','19918107CJlHiz','add','7346912QQJgHU','1068875lyraGk','set','parentFolderId','916KjTxyZ','get','4qmicZc','3171710XohpWh','has','9ZvNbVM','7HzwHTe','name'];a153_0x5548=function(){return _0x42e152;};return a153_0x5548();}(function(_0x1df82c,_0x5bcba5){const _0x203bd1=a153_0x1ad2,_0xdbe443=_0x1df82c();while(!![]){try{const _0x353d80=parseInt(_0x203bd1(0x146))/0x1+parseInt(_0x203bd1(0x138))/0x2*(parseInt(_0x203bd1(0x142))/0x3)+-parseInt(_0x203bd1(0x13a))/0x4*(parseInt(_0x203bd1(0x141))/0x5)+parseInt(_0x203bd1(0x140))/0x6*(-parseInt(_0x203bd1(0x13e))/0x7)+-parseInt(_0x203bd1(0x145))/0x8+parseInt(_0x203bd1(0x13d))/0x9*(-parseInt(_0x203bd1(0x13b))/0xa)+parseInt(_0x203bd1(0x143))/0xb;if(_0x353d80===_0x5bcba5)break;else _0xdbe443['push'](_0xdbe443['shift']());}catch(_0x251862){_0xdbe443['push'](_0xdbe443['shift']());}}}(a153_0x5548,0x8c2ab));export function buildFolderIdToPathMap(_0x121a86){const _0x4cf703=a153_0x1ad2,_0x2b15b2=new Map(),_0x32c265=new Map();for(const _0x4623ea of _0x121a86){_0x32c265[_0x4cf703(0x136)](_0x4623ea['id'],_0x4623ea);}const _0x156200=new Set();for(const _0xd4a0bf of _0x121a86){!_0xd4a0bf['parentFolderId']&&_0x156200[_0x4cf703(0x144)](_0xd4a0bf['id']);}function _0x4f9451(_0x862f47){const _0x24bb2c=_0x4cf703;if(_0x2b15b2[_0x24bb2c(0x13c)](_0x862f47['id']))return _0x2b15b2['get'](_0x862f47['id']);if(_0x156200['has'](_0x862f47['id']))return _0x2b15b2[_0x24bb2c(0x136)](_0x862f47['id'],''),'';if(_0x862f47[_0x24bb2c(0x137)]){const _0x28af05=_0x32c265[_0x24bb2c(0x139)](_0x862f47[_0x24bb2c(0x137)]);if(_0x28af05){const _0x4d90ab=_0x4f9451(_0x28af05),_0x86c1cc=_0x4d90ab?_0x4d90ab+'/'+_0x862f47[_0x24bb2c(0x13f)]:_0x862f47[_0x24bb2c(0x13f)];return _0x2b15b2['set'](_0x862f47['id'],_0x86c1cc),_0x86c1cc;}}const _0x379d59=_0x862f47[_0x24bb2c(0x13f)];return _0x2b15b2[_0x24bb2c(0x136)](_0x862f47['id'],_0x379d59),_0x379d59;}for(const _0x3729c8 of _0x121a86){_0x4f9451(_0x3729c8);}return _0x2b15b2;}export function buildFolderPathToIdMap(_0x48d8cc){const _0x309e60=a153_0x1ad2,_0x3bb2a1=new Map(),_0x5f2aff=new Map();for(const _0x43dbee of _0x48d8cc){_0x5f2aff[_0x309e60(0x136)](_0x43dbee['id'],_0x43dbee);}const _0x156577=new Set();for(const _0xb9c7ea of _0x48d8cc){!_0xb9c7ea[_0x309e60(0x137)]&&_0x156577[_0x309e60(0x144)](_0xb9c7ea['id']);}function _0x28e922(_0x235593){const _0xe4d3ce=_0x309e60;if(_0x156577[_0xe4d3ce(0x13c)](_0x235593['id']))return'';if(_0x235593[_0xe4d3ce(0x137)]){const _0x333f7d=_0x5f2aff[_0xe4d3ce(0x139)](_0x235593[_0xe4d3ce(0x137)]);if(_0x333f7d){const _0x15881f=_0x28e922(_0x333f7d);return _0x15881f?_0x15881f+'/'+_0x235593[_0xe4d3ce(0x13f)]:_0x235593[_0xe4d3ce(0x13f)];}}return _0x235593['name'];}for(const _0x735699 of _0x48d8cc){const _0xf9ccc5=_0x28e922(_0x735699);_0x3bb2a1[_0x309e60(0x136)](_0xf9ccc5,_0x735699['id']);}return _0x3bb2a1;}export function buildFolderMaps(_0x1f3b22){const _0x5b2da9=a153_0x1ad2,_0x6ec985=buildFolderIdToPathMap(_0x1f3b22),_0x3e2cfd=new Map();for(const [_0x8e5e59,_0xc285c9]of _0x6ec985){_0x3e2cfd[_0x5b2da9(0x136)](_0xc285c9,_0x8e5e59);}return{'idToPath':_0x6ec985,'pathToId':_0x3e2cfd};}function a153_0x1ad2(_0x28c7fb,_0x329395){_0x28c7fb=_0x28c7fb-0x136;const _0x5548d1=a153_0x5548();let _0x1ad277=_0x5548d1[_0x28c7fb];return _0x1ad277;}export function getFolderPath(_0x4ac50a,_0x117f5f){if(!_0x4ac50a)return'';return _0x117f5f['get'](_0x4ac50a)??'';}
@@ -1 +1 @@
1
- (function(_0x3fa299,_0x87bfce){const _0x5afbba=a154_0x3202,_0x2fe1f1=_0x3fa299();while(!![]){try{const _0x4d1981=-parseInt(_0x5afbba(0xf9))/0x1*(-parseInt(_0x5afbba(0xd9))/0x2)+-parseInt(_0x5afbba(0xdc))/0x3*(parseInt(_0x5afbba(0xdf))/0x4)+-parseInt(_0x5afbba(0xce))/0x5*(-parseInt(_0x5afbba(0xfe))/0x6)+parseInt(_0x5afbba(0xfb))/0x7+parseInt(_0x5afbba(0xdb))/0x8+parseInt(_0x5afbba(0xcd))/0x9*(-parseInt(_0x5afbba(0xed))/0xa)+parseInt(_0x5afbba(0xf3))/0xb*(-parseInt(_0x5afbba(0xe4))/0xc);if(_0x4d1981===_0x87bfce)break;else _0x2fe1f1['push'](_0x2fe1f1['shift']());}catch(_0x86028f){_0x2fe1f1['push'](_0x2fe1f1['shift']());}}}(a154_0x12a7,0x6e21e));import a154_0x419cd0 from'path';import{parse as a154_0x50fff3}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x4216ea){const _0x1623b9=a154_0x3202;if(!_0x4216ea||_0x4216ea[_0x1623b9(0xe1)]()==='')throw new Error(_0x1623b9(0xe8));const _0x208af6=_0x4216ea[_0x1623b9(0xe1)]();if(_0x208af6==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x4216ea};const _0x234138=_0x208af6['startsWith']('/')?_0x208af6[_0x1623b9(0xf5)](0x1):_0x208af6,_0x5802c3=_0x234138[_0x1623b9(0xd3)]('/')[_0x1623b9(0xfd)](_0x55caa6=>_0x55caa6!=='');if(_0x5802c3['length']===0x0)throw new Error(_0x1623b9(0xe6));const _0xa235a7=_0x208af6[_0x1623b9(0xdd)]('/')||!isRelativePathSegment(_0x5802c3[0x0]);for(const _0x3075b6 of _0x5802c3){validatePathSegment(_0x3075b6);}return{'segments':_0x5802c3,'isAbsolute':_0xa235a7,'raw':_0x4216ea};}function isRelativePathSegment(_0x40b6e7){return _0x40b6e7==='.'||_0x40b6e7==='..';}function validatePathSegment(_0x40271e){const _0x5f1419=a154_0x3202;if(_0x40271e==='')throw new Error(_0x5f1419(0xef));if(_0x40271e==='.'||_0x40271e==='..')return;if(/[\x00-\x1F\x7F]/[_0x5f1419(0xd1)](_0x40271e))throw new Error(_0x5f1419(0xe2)+_0x40271e);if(_0x40271e!==_0x40271e[_0x5f1419(0xe1)]()){}}export function validatePath(_0x2ade49){const _0x35e583=a154_0x3202;if(_0x2ade49[_0x35e583(0xf2)][_0x35e583(0xec)]===0x0&&!_0x2ade49[_0x35e583(0xf7)])throw new Error(_0x35e583(0xd5));if(_0x2ade49[_0x35e583(0xf7)]){if(_0x2ade49[_0x35e583(0xf2)][0x0]==='..')throw new Error(_0x35e583(0xe9));let _0x3f4a52=0x0;for(const _0x208ef3 of _0x2ade49[_0x35e583(0xf2)]){if(_0x208ef3==='..'){if(_0x3f4a52===0x0)throw new Error(_0x35e583(0xfc));_0x3f4a52--;}else _0x208ef3!=='.'&&_0x3f4a52++;}}}function a154_0x3202(_0x54b4f1,_0x3be429){_0x54b4f1=_0x54b4f1-0xcd;const _0x12a7c8=a154_0x12a7();let _0x3202b9=_0x12a7c8[_0x54b4f1];return _0x3202b9;}export function joinPaths(_0x4c6915,_0x147613){const _0x436922=a154_0x3202;if(!_0x4c6915||_0x4c6915==='/')return _0x147613;if(!_0x147613||_0x147613==='.')return _0x4c6915;if(_0x147613[_0x436922(0xdd)]('/'))return _0x147613;const _0x28d0d4=parsePath(_0x4c6915),_0x32e9d6=parsePath(_0x147613),_0x250ee6=[..._0x28d0d4[_0x436922(0xf2)]];for(const _0x146bf9 of _0x32e9d6[_0x436922(0xf2)]){if(_0x146bf9==='.')continue;else{if(_0x146bf9==='..'){if(_0x250ee6[_0x436922(0xec)]===0x0)throw new Error(_0x436922(0xcf));_0x250ee6[_0x436922(0xd4)]();}else _0x250ee6[_0x436922(0xe7)](_0x146bf9);}}const _0x4b62c1=_0x250ee6[_0x436922(0xd6)]('/');return _0x28d0d4['raw'][_0x436922(0xdd)]('/')?'/'+_0x4b62c1:_0x4b62c1;}export function normalizePath(_0x481bcd){const _0x43a6d3=a154_0x3202,_0x43c445=parsePath(_0x481bcd),_0xc40d78=[];for(const _0x286c84 of _0x43c445[_0x43a6d3(0xf2)]){if(_0x286c84==='.')continue;else{if(_0x286c84==='..'){if(_0xc40d78['length']===0x0){if(_0x43c445[_0x43a6d3(0xf7)])throw new Error(_0x43a6d3(0xcf));_0xc40d78[_0x43a6d3(0xe7)]('..');}else _0xc40d78[_0xc40d78[_0x43a6d3(0xec)]-0x1]==='..'?_0xc40d78[_0x43a6d3(0xe7)]('..'):_0xc40d78[_0x43a6d3(0xd4)]();}else _0xc40d78[_0x43a6d3(0xe7)](_0x286c84);}}if(_0xc40d78[_0x43a6d3(0xec)]===0x0)return _0x43c445[_0x43a6d3(0xf7)]?'/':'.';const _0x16103a=_0xc40d78[_0x43a6d3(0xd6)]('/');return _0x43c445['raw'][_0x43a6d3(0xdd)]('/')?'/'+_0x16103a:_0x16103a;}export function getParentPath(_0x458099){const _0x85a45e=a154_0x3202,_0x52763d=parsePath(_0x458099);if(_0x52763d[_0x85a45e(0xf2)][_0x85a45e(0xec)]<=0x1)return'/';const _0x5a82f6=_0x52763d['segments'][_0x85a45e(0xd8)](0x0,-0x1)[_0x85a45e(0xd6)]('/');return _0x52763d[_0x85a45e(0xe0)]['startsWith']('/')?'/'+_0x5a82f6:_0x5a82f6;}export function getBaseName(_0x27a4da){const _0xc2da5c=a154_0x3202,_0x10aad6=parsePath(_0x27a4da);return _0x10aad6[_0xc2da5c(0xf2)][_0x10aad6[_0xc2da5c(0xf2)]['length']-0x1]||'';}export function isChildPath(_0x5f55ba,_0x395d8b){const _0x2efb0c=a154_0x3202,_0x19c067=parsePath(_0x5f55ba),_0x8a1ce0=parsePath(_0x395d8b);if(_0x19c067[_0x2efb0c(0xf2)][_0x2efb0c(0xec)]<=_0x8a1ce0[_0x2efb0c(0xf2)]['length'])return![];for(let _0x59b445=0x0;_0x59b445<_0x8a1ce0['segments'][_0x2efb0c(0xec)];_0x59b445++){if(_0x19c067['segments'][_0x59b445]!==_0x8a1ce0[_0x2efb0c(0xf2)][_0x59b445])return![];}return!![];}export function splitPath(_0x24f765){const _0x231e3e=a154_0x3202,_0x3361e3=parsePath(_0x24f765);if(_0x3361e3[_0x231e3e(0xf2)][_0x231e3e(0xec)]===0x0)throw new Error(_0x231e3e(0xee));if(_0x3361e3[_0x231e3e(0xf2)][_0x231e3e(0xec)]===0x1)return{'parent':_0x3361e3['segments'][0x0]};return{'parent':_0x3361e3['segments'][0x0],'child':_0x3361e3[_0x231e3e(0xf2)][_0x231e3e(0xd8)](0x1)[_0x231e3e(0xd6)]('/')};}export function isYamlFilePath(_0x1223ab){const _0x283538=a154_0x3202;return _0x1223ab['endsWith'](_0x283538(0xf0))||_0x1223ab[_0x283538(0xe3)](_0x283538(0xd2));}function a154_0x12a7(){const _0x771505=['1865OPkmpn','Cannot\x20navigate\x20above\x20root','dirname','test','.yaml','split','pop','Relative\x20path\x20cannot\x20be\x20empty','join','segment','slice','66076CcWGqQ','No\x20tdx.json\x20found\x20for\x20file:\x20','626488mzRLyM','27MzcFqu','startsWith','parse','100768cccGLv','raw','trim','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','endsWith','7384788juajgK','readFile','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','push','Path\x20cannot\x20be\x20empty','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','type','tdx.json','length','30pYtcos','Cannot\x20split\x20empty\x20path','Path\x20segment\x20cannot\x20be\x20empty','.yml','exists','segments','22bNmEjL','journey','substring','parent_segment','isAbsolute','File\x20not\x20found:\x20','18NtBHTc','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','5619936BAphlx','Path\x20attempts\x20to\x20navigate\x20above\x20root','filter','9606IPzgcz','493164PvXIlT'];a154_0x12a7=function(){return _0x771505;};return a154_0x12a7();}export async function resolveYamlFilePath(_0x540762,_0x2749bf=nodeFileSystem){const _0x2f0f70=a154_0x3202,_0x46c624=a154_0x419cd0['resolve'](_0x540762);if(!await _0x2749bf[_0x2f0f70(0xf1)](_0x46c624))throw new Error(_0x2f0f70(0xf8)+_0x540762);let _0x2a5797=a154_0x419cd0['dirname'](_0x46c624),_0x1a2b9c=null,_0x328243=null;const _0x3c940f=a154_0x419cd0[_0x2f0f70(0xde)](_0x2a5797)['root'];while(_0x2a5797!==_0x3c940f){const _0xc366fe=a154_0x419cd0[_0x2f0f70(0xd6)](_0x2a5797,_0x2f0f70(0xeb));if(await _0x2749bf['exists'](_0xc366fe)){_0x1a2b9c=_0xc366fe,_0x328243=_0x2a5797;break;}_0x2a5797=a154_0x419cd0[_0x2f0f70(0xd0)](_0x2a5797);}if(!_0x1a2b9c||!_0x328243)throw new Error(_0x2f0f70(0xda)+_0x540762+'\x0a'+_0x2f0f70(0xfa));const _0x33742c=await _0x2749bf[_0x2f0f70(0xe5)](_0x1a2b9c),_0x1defc7=JSON[_0x2f0f70(0xde)](_0x33742c),_0x214cb9=_0x1defc7[_0x2f0f70(0xf6)];if(!_0x214cb9)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x5d6459=await _0x2749bf[_0x2f0f70(0xe5)](_0x46c624),_0x193080=a154_0x50fff3(_0x5d6459),_0x85e169=_0x193080['name'];if(!_0x85e169)throw new Error('Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'+_0x540762);const _0x36dbcc=_0x193080[_0x2f0f70(0xea)]===_0x2f0f70(0xf4)?_0x2f0f70(0xf4):_0x2f0f70(0xd7),_0x3a28de=a154_0x419cd0['relative'](_0x328243,_0x46c624),_0x5c4557=a154_0x419cd0[_0x2f0f70(0xd0)](_0x3a28de),_0x5a7576=_0x5c4557==='.'?'':_0x5c4557['replace'](/\\/g,'/'),_0x16b4d3=_0x5a7576?_0x214cb9+'/'+_0x5a7576+'/'+_0x85e169:_0x214cb9+'/'+_0x85e169;return{'parentSegment':_0x214cb9,'segmentName':_0x85e169,'folderPath':_0x5a7576,'fullPath':_0x16b4d3,'resourceType':_0x36dbcc,'content':_0x5d6459};}
1
+ function a154_0x2de7(_0x214f50,_0x4f8b08){_0x214f50=_0x214f50-0xd9;const _0x3c201d=a154_0x3c20();let _0x2de7a1=_0x3c201d[_0x214f50];return _0x2de7a1;}(function(_0xbd868c,_0x10a1f1){const _0x20f4ba=a154_0x2de7,_0x437e2f=_0xbd868c();while(!![]){try{const _0x11e959=parseInt(_0x20f4ba(0xf2))/0x1+parseInt(_0x20f4ba(0xdd))/0x2*(parseInt(_0x20f4ba(0xee))/0x3)+-parseInt(_0x20f4ba(0xde))/0x4+-parseInt(_0x20f4ba(0xf1))/0x5*(-parseInt(_0x20f4ba(0x100))/0x6)+parseInt(_0x20f4ba(0x102))/0x7*(-parseInt(_0x20f4ba(0xe8))/0x8)+-parseInt(_0x20f4ba(0xf6))/0x9*(-parseInt(_0x20f4ba(0xfc))/0xa)+-parseInt(_0x20f4ba(0xfa))/0xb;if(_0x11e959===_0x10a1f1)break;else _0x437e2f['push'](_0x437e2f['shift']());}catch(_0x51659d){_0x437e2f['push'](_0x437e2f['shift']());}}}(a154_0x3c20,0x31554));import a154_0x597b3e from'path';function a154_0x3c20(){const _0xa373a4=['parent_segment','raw','parse','replace','isAbsolute','495898IBQFXD','1530920xvGsBK','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','journey','type','Path\x20cannot\x20be\x20empty','resolve','name','push','startsWith','root','616744LYPzfj','Relative\x20path\x20cannot\x20be\x20empty','relative','readFile','slice','length','3BNzHOH','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','segment','1567495MeLQvR','292763ymvHVd','Path\x20attempts\x20to\x20navigate\x20above\x20root','Cannot\x20split\x20empty\x20path','.yml','324mPVyQe','Path\x20segment\x20cannot\x20be\x20empty','Cannot\x20navigate\x20above\x20root','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','6150760tfsiFt','test','101900XdjXHC','join','filter','endsWith','6yjVGEQ','segments','7qetyKL','.yaml','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','dirname'];a154_0x3c20=function(){return _0xa373a4;};return a154_0x3c20();}import{parse as a154_0x410302}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x53b4e8){const _0x2d951f=a154_0x2de7;if(!_0x53b4e8||_0x53b4e8['trim']()==='')throw new Error(_0x2d951f(0xe2));const _0x302ddb=_0x53b4e8['trim']();if(_0x302ddb==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x53b4e8};const _0x1e3ab9=_0x302ddb['startsWith']('/')?_0x302ddb['substring'](0x1):_0x302ddb,_0x33822a=_0x1e3ab9['split']('/')[_0x2d951f(0xfe)](_0x340d53=>_0x340d53!=='');if(_0x33822a[_0x2d951f(0xed)]===0x0)throw new Error(_0x2d951f(0xef));const _0x52938d=_0x302ddb[_0x2d951f(0xe6)]('/')||!isRelativePathSegment(_0x33822a[0x0]);for(const _0x436124 of _0x33822a){validatePathSegment(_0x436124);}return{'segments':_0x33822a,'isAbsolute':_0x52938d,'raw':_0x53b4e8};}function isRelativePathSegment(_0x1da655){return _0x1da655==='.'||_0x1da655==='..';}function validatePathSegment(_0x813106){const _0x332570=a154_0x2de7;if(_0x813106==='')throw new Error(_0x332570(0xf7));if(_0x813106==='.'||_0x813106==='..')return;if(/[\x00-\x1F\x7F]/[_0x332570(0xfb)](_0x813106))throw new Error('Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20'+_0x813106);if(_0x813106!==_0x813106['trim']()){}}export function validatePath(_0x2b3e8f){const _0x46dc60=a154_0x2de7;if(_0x2b3e8f[_0x46dc60(0x101)]['length']===0x0&&!_0x2b3e8f[_0x46dc60(0xdc)])throw new Error(_0x46dc60(0xe9));if(_0x2b3e8f['isAbsolute']){if(_0x2b3e8f[_0x46dc60(0x101)][0x0]==='..')throw new Error(_0x46dc60(0xf9));let _0x441160=0x0;for(const _0x2c55bc of _0x2b3e8f[_0x46dc60(0x101)]){if(_0x2c55bc==='..'){if(_0x441160===0x0)throw new Error(_0x46dc60(0xf3));_0x441160--;}else _0x2c55bc!=='.'&&_0x441160++;}}}export function joinPaths(_0x51d636,_0x3ee548){const _0x1ca8d5=a154_0x2de7;if(!_0x51d636||_0x51d636==='/')return _0x3ee548;if(!_0x3ee548||_0x3ee548==='.')return _0x51d636;if(_0x3ee548[_0x1ca8d5(0xe6)]('/'))return _0x3ee548;const _0x907dab=parsePath(_0x51d636),_0x1294d9=parsePath(_0x3ee548),_0x3785f1=[..._0x907dab[_0x1ca8d5(0x101)]];for(const _0x18e1bf of _0x1294d9['segments']){if(_0x18e1bf==='.')continue;else{if(_0x18e1bf==='..'){if(_0x3785f1[_0x1ca8d5(0xed)]===0x0)throw new Error(_0x1ca8d5(0xf8));_0x3785f1['pop']();}else _0x3785f1[_0x1ca8d5(0xe5)](_0x18e1bf);}}const _0x14c32f=_0x3785f1[_0x1ca8d5(0xfd)]('/');return _0x907dab[_0x1ca8d5(0xd9)][_0x1ca8d5(0xe6)]('/')?'/'+_0x14c32f:_0x14c32f;}export function normalizePath(_0x5702e2){const _0x5c3369=a154_0x2de7,_0x5d0e2a=parsePath(_0x5702e2),_0x5592c4=[];for(const _0x119d1e of _0x5d0e2a[_0x5c3369(0x101)]){if(_0x119d1e==='.')continue;else{if(_0x119d1e==='..'){if(_0x5592c4[_0x5c3369(0xed)]===0x0){if(_0x5d0e2a[_0x5c3369(0xdc)])throw new Error(_0x5c3369(0xf8));_0x5592c4[_0x5c3369(0xe5)]('..');}else _0x5592c4[_0x5592c4[_0x5c3369(0xed)]-0x1]==='..'?_0x5592c4[_0x5c3369(0xe5)]('..'):_0x5592c4['pop']();}else _0x5592c4[_0x5c3369(0xe5)](_0x119d1e);}}if(_0x5592c4[_0x5c3369(0xed)]===0x0)return _0x5d0e2a[_0x5c3369(0xdc)]?'/':'.';const _0x1ee9cb=_0x5592c4[_0x5c3369(0xfd)]('/');return _0x5d0e2a[_0x5c3369(0xd9)][_0x5c3369(0xe6)]('/')?'/'+_0x1ee9cb:_0x1ee9cb;}export function getParentPath(_0x33fd20){const _0x4c3951=a154_0x2de7,_0x49c2aa=parsePath(_0x33fd20);if(_0x49c2aa[_0x4c3951(0x101)][_0x4c3951(0xed)]<=0x1)return'/';const _0x3e0b99=_0x49c2aa[_0x4c3951(0x101)]['slice'](0x0,-0x1)[_0x4c3951(0xfd)]('/');return _0x49c2aa[_0x4c3951(0xd9)]['startsWith']('/')?'/'+_0x3e0b99:_0x3e0b99;}export function getBaseName(_0x33a429){const _0x1a528d=a154_0x2de7,_0x3f6f08=parsePath(_0x33a429);return _0x3f6f08[_0x1a528d(0x101)][_0x3f6f08[_0x1a528d(0x101)]['length']-0x1]||'';}export function isChildPath(_0x24efb6,_0x1fb60e){const _0x5d4d11=a154_0x2de7,_0x4e2e60=parsePath(_0x24efb6),_0x315522=parsePath(_0x1fb60e);if(_0x4e2e60[_0x5d4d11(0x101)][_0x5d4d11(0xed)]<=_0x315522[_0x5d4d11(0x101)][_0x5d4d11(0xed)])return![];for(let _0x4fab64=0x0;_0x4fab64<_0x315522[_0x5d4d11(0x101)][_0x5d4d11(0xed)];_0x4fab64++){if(_0x4e2e60['segments'][_0x4fab64]!==_0x315522['segments'][_0x4fab64])return![];}return!![];}export function splitPath(_0x385c9a){const _0x179f05=a154_0x2de7,_0x2ce389=parsePath(_0x385c9a);if(_0x2ce389[_0x179f05(0x101)]['length']===0x0)throw new Error(_0x179f05(0xf4));if(_0x2ce389['segments']['length']===0x1)return{'parent':_0x2ce389[_0x179f05(0x101)][0x0]};return{'parent':_0x2ce389[_0x179f05(0x101)][0x0],'child':_0x2ce389[_0x179f05(0x101)][_0x179f05(0xec)](0x1)[_0x179f05(0xfd)]('/')};}export function isYamlFilePath(_0x1dd449){const _0x3e7ab0=a154_0x2de7;return _0x1dd449[_0x3e7ab0(0xff)](_0x3e7ab0(0xf5))||_0x1dd449[_0x3e7ab0(0xff)](_0x3e7ab0(0x103));}export async function resolveYamlFilePath(_0x5ebeef,_0x2b7d68=nodeFileSystem){const _0x2058a=a154_0x2de7,_0x4ac53b=a154_0x597b3e[_0x2058a(0xe3)](_0x5ebeef);if(!await _0x2b7d68['exists'](_0x4ac53b))throw new Error('File\x20not\x20found:\x20'+_0x5ebeef);let _0x46414b=a154_0x597b3e[_0x2058a(0x105)](_0x4ac53b),_0x4cc76f=null,_0x2f1408=null;const _0x8a4e34=a154_0x597b3e[_0x2058a(0xda)](_0x46414b)[_0x2058a(0xe7)];while(_0x46414b!==_0x8a4e34){const _0x3a15c8=a154_0x597b3e[_0x2058a(0xfd)](_0x46414b,'tdx.json');if(await _0x2b7d68['exists'](_0x3a15c8)){_0x4cc76f=_0x3a15c8,_0x2f1408=_0x46414b;break;}_0x46414b=a154_0x597b3e[_0x2058a(0x105)](_0x46414b);}if(!_0x4cc76f||!_0x2f1408)throw new Error('No\x20tdx.json\x20found\x20for\x20file:\x20'+_0x5ebeef+'\x0a'+'Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.');const _0x22b0aa=await _0x2b7d68[_0x2058a(0xeb)](_0x4cc76f),_0x25909b=JSON['parse'](_0x22b0aa),_0x510d7f=_0x25909b[_0x2058a(0x106)];if(!_0x510d7f)throw new Error(_0x2058a(0x104));const _0x47e663=await _0x2b7d68[_0x2058a(0xeb)](_0x4ac53b),_0x16dedc=a154_0x410302(_0x47e663),_0xafca75=_0x16dedc[_0x2058a(0xe4)];if(!_0xafca75)throw new Error(_0x2058a(0xdf)+_0x5ebeef);const _0x343fdc=_0x16dedc[_0x2058a(0xe1)]==='journey'?_0x2058a(0xe0):_0x2058a(0xf0),_0x5088e7=a154_0x597b3e[_0x2058a(0xea)](_0x2f1408,_0x4ac53b),_0x3eb46e=a154_0x597b3e[_0x2058a(0x105)](_0x5088e7),_0x2b2538=_0x3eb46e==='.'?'':_0x3eb46e[_0x2058a(0xdb)](/\\/g,'/'),_0x194122=_0x2b2538?_0x510d7f+'/'+_0x2b2538+'/'+_0xafca75:_0x510d7f+'/'+_0xafca75;return{'parentSegment':_0x510d7f,'segmentName':_0xafca75,'folderPath':_0x2b2538,'fullPath':_0x194122,'resourceType':_0x343fdc,'content':_0x47e663};}
@@ -1 +1 @@
1
- function a155_0x4221(){const _0x33ab43=['4683234McIkLx','.\x20Parent\x20name\x20cannot\x20be\x20empty','340kvdmbr','13290TKWzwc','35DKYdoE','33310yYRuWy','10477710VAPrAT','591256hfatKo','906808kUfMzH','.\x20Child\x20name\x20cannot\x20be\x20empty','303941eqaHYh','indexOf','substring','138UbysHP','Invalid\x20segment\x20reference\x20format:\x20','2012bRYGkF'];a155_0x4221=function(){return _0x33ab43;};return a155_0x4221();}function a155_0x46fb(_0x4b80d0,_0x10e7a9){_0x4b80d0=_0x4b80d0-0x1a7;const _0x422170=a155_0x4221();let _0x46fb4a=_0x422170[_0x4b80d0];return _0x46fb4a;}(function(_0x5e5a31,_0x4b2bee){const _0x5111dd=a155_0x46fb,_0x10ce26=_0x5e5a31();while(!![]){try{const _0x35f492=parseInt(_0x5111dd(0x1ae))/0x1+-parseInt(_0x5111dd(0x1ab))/0x2*(-parseInt(_0x5111dd(0x1b3))/0x3)+parseInt(_0x5111dd(0x1b5))/0x4*(-parseInt(_0x5111dd(0x1a9))/0x5)+parseInt(_0x5111dd(0x1b6))/0x6+-parseInt(_0x5111dd(0x1aa))/0x7*(parseInt(_0x5111dd(0x1ad))/0x8)+parseInt(_0x5111dd(0x1ac))/0x9+parseInt(_0x5111dd(0x1a8))/0xa*(-parseInt(_0x5111dd(0x1b0))/0xb);if(_0x35f492===_0x4b2bee)break;else _0x10ce26['push'](_0x10ce26['shift']());}catch(_0x644f51){_0x10ce26['push'](_0x10ce26['shift']());}}}(a155_0x4221,0xed3b8));export function parseSegmentRef(_0x1ea0fd){const _0x56e423=a155_0x46fb,_0x49ada2=_0x1ea0fd[_0x56e423(0x1b1)]('/');if(_0x49ada2===-0x1)return{'parentId':_0x1ea0fd};if(_0x49ada2===0x0)throw new Error(_0x56e423(0x1b4)+_0x1ea0fd+_0x56e423(0x1a7));const _0x12011c=_0x1ea0fd[_0x56e423(0x1b2)](0x0,_0x49ada2),_0x119232=_0x1ea0fd[_0x56e423(0x1b2)](_0x49ada2+0x1);if(_0x119232==='')throw new Error(_0x56e423(0x1b4)+_0x1ea0fd+_0x56e423(0x1af));return{'parentId':_0x12011c,'childId':_0x119232};}
1
+ function a155_0x3297(_0x1fd043,_0x33b112){_0x1fd043=_0x1fd043-0x1a3;const _0x429900=a155_0x4299();let _0x329792=_0x429900[_0x1fd043];return _0x329792;}function a155_0x4299(){const _0x30c3e2=['792pWPPCb','2863796wlIaKE','22cMyxIf','390323fldzna','16497503HGqhAr','1572237BatuKJ','7659687KFuntL','.\x20Child\x20name\x20cannot\x20be\x20empty','11940TKxzPE','substring','10kzGRqP','1482uWNaSk','8gbVSrb','Invalid\x20segment\x20reference\x20format:\x20'];a155_0x4299=function(){return _0x30c3e2;};return a155_0x4299();}(function(_0x580a9d,_0x489cb7){const _0x1f0c05=a155_0x3297,_0x308c7e=_0x580a9d();while(!![]){try{const _0x19445e=-parseInt(_0x1f0c05(0x1ad))/0x1+-parseInt(_0x1f0c05(0x1ac))/0x2*(parseInt(_0x1f0c05(0x1aa))/0x3)+parseInt(_0x1f0c05(0x1ab))/0x4+parseInt(_0x1f0c05(0x1a4))/0x5*(parseInt(_0x1f0c05(0x1a7))/0x6)+parseInt(_0x1f0c05(0x1b0))/0x7+parseInt(_0x1f0c05(0x1a8))/0x8*(parseInt(_0x1f0c05(0x1af))/0x9)+-parseInt(_0x1f0c05(0x1a6))/0xa*(parseInt(_0x1f0c05(0x1ae))/0xb);if(_0x19445e===_0x489cb7)break;else _0x308c7e['push'](_0x308c7e['shift']());}catch(_0x14b205){_0x308c7e['push'](_0x308c7e['shift']());}}}(a155_0x4299,0xa66f7));export function parseSegmentRef(_0x398891){const _0x41a0b9=a155_0x3297,_0x4eb3bb=_0x398891['indexOf']('/');if(_0x4eb3bb===-0x1)return{'parentId':_0x398891};if(_0x4eb3bb===0x0)throw new Error(_0x41a0b9(0x1a9)+_0x398891+'.\x20Parent\x20name\x20cannot\x20be\x20empty');const _0x2a6ee1=_0x398891[_0x41a0b9(0x1a5)](0x0,_0x4eb3bb),_0x135b92=_0x398891[_0x41a0b9(0x1a5)](_0x4eb3bb+0x1);if(_0x135b92==='')throw new Error(_0x41a0b9(0x1a9)+_0x398891+_0x41a0b9(0x1a3));return{'parentId':_0x2a6ee1,'childId':_0x135b92};}
@@ -1 +1 @@
1
- function a156_0x43cf(_0x1d289c,_0x14a9e6){_0x1d289c=_0x1d289c-0xc0;const _0x12130f=a156_0x1213();let _0x43cf60=_0x12130f[_0x1d289c];return _0x43cf60;}(function(_0xba43a,_0x5d52a3){const _0x1f2ec2=a156_0x43cf,_0x152655=_0xba43a();while(!![]){try{const _0xf2e01e=parseInt(_0x1f2ec2(0xde))/0x1+parseInt(_0x1f2ec2(0xf7))/0x2+parseInt(_0x1f2ec2(0x104))/0x3*(parseInt(_0x1f2ec2(0xf0))/0x4)+parseInt(_0x1f2ec2(0xc7))/0x5+-parseInt(_0x1f2ec2(0xca))/0x6+parseInt(_0x1f2ec2(0xc5))/0x7*(parseInt(_0x1f2ec2(0xc9))/0x8)+parseInt(_0x1f2ec2(0xd1))/0x9*(-parseInt(_0x1f2ec2(0xf1))/0xa);if(_0xf2e01e===_0x5d52a3)break;else _0x152655['push'](_0x152655['shift']());}catch(_0x59d96e){_0x152655['push'](_0x152655['shift']());}}}(a156_0x1213,0x6d4de));import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x5b783b,_0x4f4fd3={},_0x411eac={}){const _0x3918c5=a156_0x43cf;if(_0x411eac[_0x3918c5(0xdf)])return runSemanticChecks(_0x5b783b,_0x4f4fd3);const _0x3d7c02=SegmentDefSchema['safeParse'](_0x5b783b);if(_0x3d7c02[_0x3918c5(0xc2)])return runSemanticChecks(_0x3d7c02[_0x3918c5(0xc4)],_0x4f4fd3);return zodErrorsToValidationResult(_0x3d7c02['error'],_0x4f4fd3);}export function validateRuleDef(_0x39411c,_0x56895d,_0xc30d54){const _0x46fd88=a156_0x43cf;if(!_0x39411c)return[];const _0x64d887=RuleDefSchema[_0x46fd88(0xe8)](_0x39411c);if(_0x64d887[_0x46fd88(0xc2)])return checkRule(_0x64d887[_0x46fd88(0xc4)],_0x56895d,_0xc30d54);const _0x472035=flattenZodIssues(_0x64d887[_0x46fd88(0xcc)]['issues']);return _0x472035['map'](_0x41808d=>{const _0x5cb48f=_0x46fd88,_0x562f46=formatZodPath(_0x41808d['path']),_0x343100=_0x562f46?_0x56895d+'.'+_0x562f46:_0x56895d,_0x1a1e4d=mapZodIssueToCode(_0x41808d,_0x562f46),_0x3dad13=getLocationFromPath(_0xc30d54[_0x5cb48f(0xf3)],_0xc30d54[_0x5cb48f(0xec)],pathToArray(_0x343100));return{'level':_0x5cb48f(0xcc),'path':_0x343100,'code':_0x1a1e4d,'message':_0x41808d['message'],..._0x3dad13&&{'location':_0x3dad13}};});}function zodErrorsToValidationResult(_0xfec16a,_0x59a778){const _0x553c53=a156_0x43cf,_0x19b824=flattenZodIssues(_0xfec16a[_0x553c53(0xd9)]),_0x289f38=_0x19b824[_0x553c53(0xc1)](_0x22ab56=>{const _0x289277=_0x553c53,_0x241f71=formatZodPath(_0x22ab56[_0x289277(0xe1)]),_0x2243eb=mapZodIssueToCode(_0x22ab56,_0x241f71),_0x3268ff=getLocationFromPath(_0x59a778[_0x289277(0xf3)],_0x59a778[_0x289277(0xec)],_0x22ab56[_0x289277(0xe1)][_0x289277(0xc1)](_0x33f41a=>typeof _0x33f41a==='symbol'?String(_0x33f41a):_0x33f41a));return{'level':_0x289277(0xcc),'path':_0x241f71,'code':_0x2243eb,'message':_0x22ab56['message'],..._0x3268ff&&{'location':_0x3268ff}};});return{'valid':![],'errors':_0x289f38,'warnings':[]};}function mapZodIssueToCode(_0xaedef,_0x13feb0){const _0x5d2fff=a156_0x43cf,_0x26c744=_0xaedef[_0x5d2fff(0xcd)]===_0x5d2fff(0xdd)?_0xaedef[_0x5d2fff(0xf5)]:undefined;if(_0x13feb0==='name')return'MISSING_NAME';if(_0x13feb0===_0x5d2fff(0xd0)||_0x13feb0['endsWith'](_0x5d2fff(0xfc))){if(_0xaedef[_0x5d2fff(0xcd)]===_0x5d2fff(0xef)){if(_0x13feb0===_0x5d2fff(0xd0)||_0x13feb0[_0x5d2fff(0xe9)](/\.conditions\[\d+\]\.type$/))return _0x5d2fff(0xdb);}}if(_0x13feb0[_0x5d2fff(0xcf)]('.operator.type'))return _0x5d2fff(0x103);if(_0x13feb0[_0x5d2fff(0xcf)]('.operator.value'))return'MISSING_OPERATOR_VALUE';if(_0x26c744?.[_0x5d2fff(0xcb)]==='MISSING_BETWEEN_BOUNDS')return _0x5d2fff(0x107);if(_0x26c744?.[_0x5d2fff(0xcb)]===_0x5d2fff(0x106))return _0x5d2fff(0x106);if(_0x13feb0['endsWith']('.conditions')||_0x13feb0===_0x5d2fff(0xd5))return _0x5d2fff(0xfb);if(_0x13feb0[_0x5d2fff(0xc0)](_0x5d2fff(0xd8)))return _0x5d2fff(0xf2);if(_0x13feb0[_0x5d2fff(0xcf)](_0x5d2fff(0xdc)))return'MISSING_SEGMENT_REFERENCE';return _0x5d2fff(0xd2);}function runSemanticChecks(_0x49ffca,_0x2fa09c){const _0x15e94f=a156_0x43cf,_0x4979bb=[];_0x49ffca[_0x15e94f(0x101)]&&_0x4979bb[_0x15e94f(0xed)](...checkRule(_0x49ffca[_0x15e94f(0x101)],_0x15e94f(0x101),_0x2fa09c));const _0x18092c=_0x4979bb[_0x15e94f(0xda)](_0x31a6b7=>_0x31a6b7[_0x15e94f(0xe6)]===_0x15e94f(0xcc)),_0x2fb196=_0x4979bb[_0x15e94f(0xda)](_0x22fd12=>_0x22fd12[_0x15e94f(0xe6)]==='warning');return{'valid':_0x18092c[_0x15e94f(0xe5)]===0x0,'errors':_0x18092c,'warnings':_0x2fb196};}function checkRule(_0x423257,_0x2fb40c,_0x5e9f46){const _0x1cec8a=a156_0x43cf,_0x51fb41=[];if(_0x423257[_0x1cec8a(0xd5)][_0x1cec8a(0xe5)]===0x0)return _0x51fb41[_0x1cec8a(0xed)]({'level':_0x1cec8a(0xcc),'path':_0x2fb40c+_0x1cec8a(0xf9),'code':_0x1cec8a(0xe2),'message':'Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','location':getLocationFromPath(_0x5e9f46[_0x1cec8a(0xf3)],_0x5e9f46[_0x1cec8a(0xec)],pathToArray(_0x2fb40c+'.conditions'))}),_0x51fb41;return _0x51fb41['push'](...checkConditions(_0x423257[_0x1cec8a(0xd5)],_0x2fb40c,_0x5e9f46)),_0x51fb41;}function checkConditions(_0x338e30,_0xf20901,_0x4f34cc){const _0x3083dc=a156_0x43cf,_0xa4a1ba=[];for(let _0x4500f5=0x0;_0x4500f5<_0x338e30[_0x3083dc(0xe5)];_0x4500f5++){const _0x879f60=_0x338e30[_0x4500f5],_0x34f6aa=_0xf20901+_0x3083dc(0xd6)+_0x4500f5+']';_0xa4a1ba['push'](...checkCondition(_0x879f60,_0x34f6aa,_0x4f34cc));}return _0xa4a1ba;}function checkCondition(_0x6de470,_0x55a426,_0x5a678e){const _0x568ad6=a156_0x43cf,_0x3c140e=[];if(_0x6de470['type']==='And'||_0x6de470[_0x568ad6(0xe7)]==='Or'){if(_0x6de470[_0x568ad6(0xd5)]['length']===0x0)_0x3c140e[_0x568ad6(0xed)]({'level':_0x568ad6(0xcc),'path':_0x55a426+_0x568ad6(0xf9),'code':_0x568ad6(0xe2),'message':_0x6de470[_0x568ad6(0xe7)]+_0x568ad6(0xee),'location':getLocationFromPath(_0x5a678e['document'],_0x5a678e[_0x568ad6(0xec)],pathToArray(_0x55a426+'.conditions'))});else{const _0x47b125=_0x6de470[_0x568ad6(0xd7)]!==undefined;!_0x47b125&&_0x3c140e[_0x568ad6(0xed)]({'level':'warning','path':_0x55a426,'code':_0x568ad6(0xf8),'message':_0x6de470[_0x568ad6(0xe7)]+_0x568ad6(0xe4)+_0x568ad6(0xd3)+_0x568ad6(0x102),'location':getLocationFromPath(_0x5a678e['document'],_0x5a678e[_0x568ad6(0xec)],pathToArray(_0x55a426))}),_0x3c140e[_0x568ad6(0xed)](...checkConditions(_0x6de470[_0x568ad6(0xd5)],_0x55a426,_0x5a678e));}return _0x3c140e;}if(_0x6de470[_0x568ad6(0xe7)]===_0x568ad6(0xe3)||_0x6de470[_0x568ad6(0xe7)]===_0x568ad6(0xfd)){const _0x33cf0c=_0x6de470,_0x4df586=_0x33cf0c[_0x568ad6(0xec)],_0x1ff50c=_0x33cf0c[_0x568ad6(0xce)],_0x2f161e=_0x4df586||_0x1ff50c;(!_0x33cf0c['attribute']||_0x33cf0c['attribute']==='')&&(!_0x2f161e&&_0x3c140e[_0x568ad6(0xed)]({'level':_0x568ad6(0xcc),'path':_0x55a426+_0x568ad6(0xc8),'code':_0x568ad6(0xfe),'message':_0x568ad6(0xf6),'location':getLocationFromPath(_0x5a678e[_0x568ad6(0xf3)],_0x5a678e[_0x568ad6(0xec)],pathToArray(_0x55a426+'.attribute'))}));_0x33cf0c[_0x568ad6(0xda)]&&_0x3c140e[_0x568ad6(0xed)](...checkRule(_0x33cf0c['filter'],_0x55a426+_0x568ad6(0xff),_0x5a678e));if(_0x33cf0c[_0x568ad6(0xec)]){const _0x5108b9=_0x33cf0c[_0x568ad6(0x108)]&&_0x33cf0c[_0x568ad6(0x108)]!=='';_0x5108b9&&!_0x33cf0c['filter']&&_0x3c140e[_0x568ad6(0xed)]({'level':_0x568ad6(0xcc),'path':_0x55a426+_0x568ad6(0xe0),'code':_0x568ad6(0xfa),'message':_0x568ad6(0xeb)+_0x33cf0c[_0x568ad6(0xec)]+'\x27\x20with\x20attribute\x20\x27'+_0x33cf0c[_0x568ad6(0x108)]+'\x27\x20'+'requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20'+_0x568ad6(0x105)+_0x568ad6(0xc3),'location':getLocationFromPath(_0x5a678e[_0x568ad6(0xf3)],_0x5a678e['source'],pathToArray(_0x55a426+_0x568ad6(0xe0)))}),_0x5108b9&&_0x33cf0c[_0x568ad6(0xda)]&&_0x3c140e[_0x568ad6(0xed)]({'level':_0x568ad6(0xea),'path':_0x55a426+_0x568ad6(0xc8),'code':_0x568ad6(0xd4),'message':_0x568ad6(0x100)+_0x33cf0c['attribute']+_0x568ad6(0xc6)+_0x568ad6(0xf4),'location':getLocationFromPath(_0x5a678e[_0x568ad6(0xf3)],_0x5a678e[_0x568ad6(0xec)],pathToArray(_0x55a426+'.attribute'))});}}return _0x3c140e;}function a156_0x1213(){const _0x4eb8ee=['1270085TIOkpe','.attribute','56yeJBjG','2526126lORFQR','validationCode','error','code','aggregation','endsWith','rule.type','18rKQgkk','SEGMENT_SCHEMA_ERROR','condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','conditions','.conditions[','description','arrayMatching','issues','filter','INVALID_RULE_TYPE','.segment','custom','812888iZlFDx','skipSchema','.source','path','EMPTY_CONDITIONS','Value','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','length','level','type','safeParse','match','warning','Behavior\x20source\x20\x27','source','push','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','invalid_value','2396228Ngyifd','7523650KfDicz','INVALID_ARRAY_MATCHING','document','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','params','Attribute\x20name\x20cannot\x20be\x20empty','1355820pcflvH','NESTED_CONDITION_GROUP','.conditions','BEHAVIOR_SOURCE_MISSING_FILTER','MISSING_CONDITIONS','.type','Behavior','EMPTY_ATTRIBUTE','.filter','Attribute\x20\x27','rule','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','INVALID_OPERATOR_TYPE','3ZHMbSg','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','MISSING_TIME_UNIT','MISSING_BETWEEN_BOUNDS','attribute','includes','map','success','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','data','29589LbMPKg','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20'];a156_0x1213=function(){return _0x4eb8ee;};return a156_0x1213();}
1
+ (function(_0x1c93e8,_0x461b6a){const _0x319714=a156_0x2e09,_0x498c19=_0x1c93e8();while(!![]){try{const _0x24728f=-parseInt(_0x319714(0x7c))/0x1+parseInt(_0x319714(0xaf))/0x2+parseInt(_0x319714(0xb2))/0x3+parseInt(_0x319714(0xae))/0x4+parseInt(_0x319714(0x9a))/0x5*(parseInt(_0x319714(0xbd))/0x6)+-parseInt(_0x319714(0x9c))/0x7*(parseInt(_0x319714(0xac))/0x8)+-parseInt(_0x319714(0x89))/0x9;if(_0x24728f===_0x461b6a)break;else _0x498c19['push'](_0x498c19['shift']());}catch(_0x50edae){_0x498c19['push'](_0x498c19['shift']());}}}(a156_0x4473,0x856c5));function a156_0x4473(){const _0x5eab88=['BEHAVIOR_SOURCE_MISSING_FILTER','code','INVALID_ARRAY_MATCHING','55578vLjJkB','Use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20\x27filter.type:\x20And\x27\x20containing\x20\x27type:\x20Column\x27\x20conditions.','data','.operator.type','type','171328ZJersy','level','length','conditions','map','\x20condition\x20group:\x20Console\x20UI\x20SQL\x20preview\x20does\x20not\x20display\x20nested\x20','skipSchema','Behavior\x20source\x20\x27','validationCode','description','document','Value','params','7080552jNMTax','For\x20behavior\x20aggregations,\x20use\x20\x27attribute:\x20\x22\x22\x27\x20with\x20Column\x20conditions\x20in\x20filter.','endsWith','.operator.value','the\x20condition\x20queries\x20the\x20master\x20table\x20instead.\x20','push','invalid_value','EMPTY_CONDITIONS','MISSING_SEGMENT_REFERENCE','Attribute\x20\x27','error','MISSING_BETWEEN_BOUNDS','.filter','NESTED_CONDITION_GROUP','success','includes','\x27\x20with\x20attribute\x20\x27','355BoTDYa','rule.type','49suntuO','rule','And','issues','match','attribute','conditions,\x20consider\x20using\x20\x27In\x27\x20operator:\x20operator:\x20{\x20type:\x20In,\x20value:\x20[\x22val1\x22,\x20\x22val2\x22]\x20}','INVALID_RULE_TYPE','source','MISSING_TIME_UNIT','\x27\x20with\x20behavior\x20source\x20may\x20cause\x20unexpected\x20behavior.\x20','.conditions','filter','.type','safeParse','BEHAVIOR_SOURCE_WITH_ATTRIBUTE','235688ytNvTB','.source','37300kuncAW','805908cLEiBa','path','.attribute','1922496aDetZe','SEGMENT_SCHEMA_ERROR','\x20condition\x20cannot\x20have\x20an\x20empty\x20conditions\x20array','warning','custom','MISSING_OPERATOR_VALUE','symbol','MISSING_CONDITIONS'];a156_0x4473=function(){return _0x5eab88;};return a156_0x4473();}import{SegmentDefSchema,RuleDefSchema}from'./types/segment-schema.js';function a156_0x2e09(_0x5f3636,_0x3c2661){_0x5f3636=_0x5f3636-0x7b;const _0x4473c4=a156_0x4473();let _0x2e0933=_0x4473c4[_0x5f3636];return _0x2e0933;}import{formatZodPath,flattenZodIssues,getLocationFromPath,pathToArray}from'./yaml-validator.js';export function validateSegmentDef(_0x225d10,_0x3e62f1={},_0x89e5c1={}){const _0x3a324d=a156_0x2e09;if(_0x89e5c1[_0x3a324d(0x82)])return runSemanticChecks(_0x225d10,_0x3e62f1);const _0x297196=SegmentDefSchema['safeParse'](_0x225d10);if(_0x297196[_0x3a324d(0x97)])return runSemanticChecks(_0x297196[_0x3a324d(0xbf)],_0x3e62f1);return zodErrorsToValidationResult(_0x297196[_0x3a324d(0x93)],_0x3e62f1);}export function validateRuleDef(_0x517a54,_0x283ded,_0x13521d){const _0x14871a=a156_0x2e09;if(!_0x517a54)return[];const _0x5b8840=RuleDefSchema[_0x14871a(0xaa)](_0x517a54);if(_0x5b8840['success'])return checkRule(_0x5b8840[_0x14871a(0xbf)],_0x283ded,_0x13521d);const _0x450230=flattenZodIssues(_0x5b8840['error'][_0x14871a(0x9f)]);return _0x450230[_0x14871a(0x80)](_0xb879e4=>{const _0x5f5bf3=_0x14871a,_0x480e08=formatZodPath(_0xb879e4['path']),_0x1d14b4=_0x480e08?_0x283ded+'.'+_0x480e08:_0x283ded,_0x7533d5=mapZodIssueToCode(_0xb879e4,_0x480e08),_0x1c6e73=getLocationFromPath(_0x13521d[_0x5f5bf3(0x86)],_0x13521d['source'],pathToArray(_0x1d14b4));return{'level':_0x5f5bf3(0x93),'path':_0x1d14b4,'code':_0x7533d5,'message':_0xb879e4['message'],..._0x1c6e73&&{'location':_0x1c6e73}};});}function zodErrorsToValidationResult(_0x1f7138,_0x236f66){const _0x1a28ec=a156_0x2e09,_0x382782=flattenZodIssues(_0x1f7138[_0x1a28ec(0x9f)]),_0x38c932=_0x382782[_0x1a28ec(0x80)](_0x295e4c=>{const _0x48e880=_0x1a28ec,_0x298485=formatZodPath(_0x295e4c[_0x48e880(0xb0)]),_0x94b6e7=mapZodIssueToCode(_0x295e4c,_0x298485),_0x2ed37d=getLocationFromPath(_0x236f66[_0x48e880(0x86)],_0x236f66['source'],_0x295e4c['path'][_0x48e880(0x80)](_0x20b995=>typeof _0x20b995===_0x48e880(0xb8)?String(_0x20b995):_0x20b995));return{'level':_0x48e880(0x93),'path':_0x298485,'code':_0x94b6e7,'message':_0x295e4c['message'],..._0x2ed37d&&{'location':_0x2ed37d}};});return{'valid':![],'errors':_0x38c932,'warnings':[]};}function mapZodIssueToCode(_0x317d5b,_0x1d4f7e){const _0x4615be=a156_0x2e09,_0x198a6e=_0x317d5b[_0x4615be(0xbb)]===_0x4615be(0xb6)?_0x317d5b[_0x4615be(0x88)]:undefined;if(_0x1d4f7e==='name')return'MISSING_NAME';if(_0x1d4f7e===_0x4615be(0x9b)||_0x1d4f7e[_0x4615be(0x8b)](_0x4615be(0xa9))){if(_0x317d5b[_0x4615be(0xbb)]===_0x4615be(0x8f)){if(_0x1d4f7e===_0x4615be(0x9b)||_0x1d4f7e[_0x4615be(0xa0)](/\.conditions\[\d+\]\.type$/))return _0x4615be(0xa3);}}if(_0x1d4f7e[_0x4615be(0x8b)](_0x4615be(0xc0)))return'INVALID_OPERATOR_TYPE';if(_0x1d4f7e['endsWith'](_0x4615be(0x8c)))return _0x4615be(0xb7);if(_0x198a6e?.[_0x4615be(0x84)]===_0x4615be(0x94))return _0x4615be(0x94);if(_0x198a6e?.[_0x4615be(0x84)]===_0x4615be(0xa5))return _0x4615be(0xa5);if(_0x1d4f7e[_0x4615be(0x8b)](_0x4615be(0xa7))||_0x1d4f7e===_0x4615be(0x7f))return _0x4615be(0xb9);if(_0x1d4f7e[_0x4615be(0x98)]('arrayMatching'))return _0x4615be(0xbc);if(_0x1d4f7e[_0x4615be(0x8b)]('.segment'))return _0x4615be(0x91);return _0x4615be(0xb3);}function runSemanticChecks(_0x26b048,_0x305ff0){const _0x315b24=a156_0x2e09,_0x1593e7=[];_0x26b048[_0x315b24(0x9d)]&&_0x1593e7[_0x315b24(0x8e)](...checkRule(_0x26b048[_0x315b24(0x9d)],_0x315b24(0x9d),_0x305ff0));const _0x4647d9=_0x1593e7[_0x315b24(0xa8)](_0x3a29c1=>_0x3a29c1[_0x315b24(0x7d)]===_0x315b24(0x93)),_0x40852=_0x1593e7[_0x315b24(0xa8)](_0xfe6645=>_0xfe6645[_0x315b24(0x7d)]===_0x315b24(0xb5));return{'valid':_0x4647d9['length']===0x0,'errors':_0x4647d9,'warnings':_0x40852};}function checkRule(_0x17b3ea,_0x9e8cc8,_0x368e22){const _0x29c7dc=a156_0x2e09,_0x2bc90d=[];if(_0x17b3ea['conditions'][_0x29c7dc(0x7e)]===0x0)return _0x2bc90d['push']({'level':_0x29c7dc(0x93),'path':_0x9e8cc8+_0x29c7dc(0xa7),'code':_0x29c7dc(0x90),'message':'Rule\x20conditions\x20array\x20cannot\x20be\x20empty.\x20Add\x20at\x20least\x20one\x20condition.','location':getLocationFromPath(_0x368e22['document'],_0x368e22[_0x29c7dc(0xa4)],pathToArray(_0x9e8cc8+'.conditions'))}),_0x2bc90d;return _0x2bc90d[_0x29c7dc(0x8e)](...checkConditions(_0x17b3ea[_0x29c7dc(0x7f)],_0x9e8cc8,_0x368e22)),_0x2bc90d;}function checkConditions(_0x53e14b,_0x390284,_0x37ee59){const _0x596ea3=a156_0x2e09,_0x559608=[];for(let _0x46e27c=0x0;_0x46e27c<_0x53e14b[_0x596ea3(0x7e)];_0x46e27c++){const _0x166fae=_0x53e14b[_0x46e27c],_0x3d7e44=_0x390284+'.conditions['+_0x46e27c+']';_0x559608[_0x596ea3(0x8e)](...checkCondition(_0x166fae,_0x3d7e44,_0x37ee59));}return _0x559608;}function checkCondition(_0x297d19,_0x235b06,_0x261bae){const _0x5a22ee=a156_0x2e09,_0x3fdcc0=[];if(_0x297d19[_0x5a22ee(0x7b)]===_0x5a22ee(0x9e)||_0x297d19[_0x5a22ee(0x7b)]==='Or'){if(_0x297d19[_0x5a22ee(0x7f)]['length']===0x0)_0x3fdcc0['push']({'level':_0x5a22ee(0x93),'path':_0x235b06+'.conditions','code':_0x5a22ee(0x90),'message':_0x297d19[_0x5a22ee(0x7b)]+_0x5a22ee(0xb4),'location':getLocationFromPath(_0x261bae[_0x5a22ee(0x86)],_0x261bae[_0x5a22ee(0xa4)],pathToArray(_0x235b06+_0x5a22ee(0xa7)))});else{const _0x164b09=_0x297d19[_0x5a22ee(0x85)]!==undefined;!_0x164b09&&_0x3fdcc0['push']({'level':_0x5a22ee(0xb5),'path':_0x235b06,'code':_0x5a22ee(0x96),'message':_0x297d19['type']+_0x5a22ee(0x81)+'condition\x20groups\x20correctly.\x20Segment\x20execution\x20is\x20unaffected.\x20For\x20same-attribute\x20Or\x20'+_0x5a22ee(0xa2),'location':getLocationFromPath(_0x261bae[_0x5a22ee(0x86)],_0x261bae[_0x5a22ee(0xa4)],pathToArray(_0x235b06))}),_0x3fdcc0[_0x5a22ee(0x8e)](...checkConditions(_0x297d19[_0x5a22ee(0x7f)],_0x235b06,_0x261bae));}return _0x3fdcc0;}if(_0x297d19['type']===_0x5a22ee(0x87)||_0x297d19[_0x5a22ee(0x7b)]==='Behavior'){const _0x21790b=_0x297d19,_0x168a06=_0x21790b[_0x5a22ee(0xa4)],_0x167ad6=_0x21790b['aggregation'],_0x1c619d=_0x168a06||_0x167ad6;(!_0x21790b[_0x5a22ee(0xa1)]||_0x21790b['attribute']==='')&&(!_0x1c619d&&_0x3fdcc0['push']({'level':_0x5a22ee(0x93),'path':_0x235b06+_0x5a22ee(0xb1),'code':'EMPTY_ATTRIBUTE','message':'Attribute\x20name\x20cannot\x20be\x20empty','location':getLocationFromPath(_0x261bae[_0x5a22ee(0x86)],_0x261bae[_0x5a22ee(0xa4)],pathToArray(_0x235b06+_0x5a22ee(0xb1)))}));_0x21790b[_0x5a22ee(0xa8)]&&_0x3fdcc0[_0x5a22ee(0x8e)](...checkRule(_0x21790b[_0x5a22ee(0xa8)],_0x235b06+_0x5a22ee(0x95),_0x261bae));if(_0x21790b[_0x5a22ee(0xa4)]){const _0x5ad91b=_0x21790b['attribute']&&_0x21790b[_0x5a22ee(0xa1)]!=='';_0x5ad91b&&!_0x21790b[_0x5a22ee(0xa8)]&&_0x3fdcc0[_0x5a22ee(0x8e)]({'level':_0x5a22ee(0x93),'path':_0x235b06+_0x5a22ee(0xad),'code':_0x5a22ee(0xba),'message':_0x5a22ee(0x83)+_0x21790b[_0x5a22ee(0xa4)]+_0x5a22ee(0x99)+_0x21790b['attribute']+'\x27\x20'+'requires\x20a\x20nested\x20\x27filter\x27.\x20Without\x20filter,\x20the\x20source\x20is\x20silently\x20ignored\x20and\x20'+_0x5a22ee(0x8d)+_0x5a22ee(0xbe),'location':getLocationFromPath(_0x261bae['document'],_0x261bae['source'],pathToArray(_0x235b06+_0x5a22ee(0xad)))}),_0x5ad91b&&_0x21790b[_0x5a22ee(0xa8)]&&_0x3fdcc0[_0x5a22ee(0x8e)]({'level':_0x5a22ee(0xb5),'path':_0x235b06+_0x5a22ee(0xb1),'code':_0x5a22ee(0xab),'message':_0x5a22ee(0x92)+_0x21790b['attribute']+_0x5a22ee(0xa6)+_0x5a22ee(0x8a),'location':getLocationFromPath(_0x261bae[_0x5a22ee(0x86)],_0x261bae[_0x5a22ee(0xa4)],pathToArray(_0x235b06+'.attribute'))});}}return _0x3fdcc0;}