@treasuredata/tdx 0.9.2 → 0.9.3

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 (130) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/client/cdp-api-client.js +1 -1
  6. package/dist/client/engage-api-client.js +1 -1
  7. package/dist/client/http-client.js +1 -1
  8. package/dist/client/llm-api-client.d.ts +35 -1
  9. package/dist/client/llm-api-client.d.ts.map +1 -1
  10. package/dist/client/llm-api-client.js +1 -1
  11. package/dist/client/llm-api-client.js.map +1 -1
  12. package/dist/client/rate-limiter.js +1 -1
  13. package/dist/client/td-api-client.js +1 -1
  14. package/dist/client/trino-api-client.js +1 -1
  15. package/dist/client/workflow-client.js +1 -1
  16. package/dist/commands/activations.js +1 -1
  17. package/dist/commands/agent-command.d.ts.map +1 -1
  18. package/dist/commands/agent-command.js +1 -1
  19. package/dist/commands/agent-command.js.map +1 -1
  20. package/dist/commands/api-command.js +1 -1
  21. package/dist/commands/auth-command.js +1 -1
  22. package/dist/commands/chat-command.js +1 -1
  23. package/dist/commands/claude-command.js +1 -1
  24. package/dist/commands/claude-statusline-command.js +1 -1
  25. package/dist/commands/claude-usage-command.js +1 -1
  26. package/dist/commands/command.js +1 -1
  27. package/dist/commands/connection-command.js +1 -1
  28. package/dist/commands/context-command.js +1 -1
  29. package/dist/commands/databases.js +1 -1
  30. package/dist/commands/describe.js +1 -1
  31. package/dist/commands/engage-command.js +1 -1
  32. package/dist/commands/job-command.js +1 -1
  33. package/dist/commands/journey-command.js +1 -1
  34. package/dist/commands/llm-command.js +1 -1
  35. package/dist/commands/llm-proxy.js +1 -1
  36. package/dist/commands/parent-segment-command.js +1 -1
  37. package/dist/commands/profiles-command.js +1 -1
  38. package/dist/commands/query-command.js +1 -1
  39. package/dist/commands/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/segments.js +1 -1
  47. package/dist/commands/show.js +1 -1
  48. package/dist/commands/tables.js +1 -1
  49. package/dist/commands/use-command.js +1 -1
  50. package/dist/commands/user-command.js +1 -1
  51. package/dist/commands/workflow-command.js +1 -1
  52. package/dist/core/auth.js +1 -1
  53. package/dist/core/config.js +1 -1
  54. package/dist/core/connection-cache.js +1 -1
  55. package/dist/core/credential-cache.js +1 -1
  56. package/dist/core/global-context.js +1 -1
  57. package/dist/core/keychain.js +1 -1
  58. package/dist/core/profile.js +1 -1
  59. package/dist/core/project-config.js +1 -1
  60. package/dist/core/session.js +1 -1
  61. package/dist/core/user-cache.js +1 -1
  62. package/dist/index.js +1 -1
  63. package/dist/proxy/anthropic-adapter.js +1 -1
  64. package/dist/proxy/claude-usage-tracker.js +1 -1
  65. package/dist/proxy/context-signature.js +1 -1
  66. package/dist/proxy/conversation-utils.js +1 -1
  67. package/dist/proxy/server.js +1 -1
  68. package/dist/proxy/session-cache.js +1 -1
  69. package/dist/sdk/agent/agent-yaml.d.ts +45 -1
  70. package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
  71. package/dist/sdk/agent/agent-yaml.js +1 -1
  72. package/dist/sdk/agent/agent-yaml.js.map +1 -1
  73. package/dist/sdk/api.js +1 -1
  74. package/dist/sdk/connection.js +1 -1
  75. package/dist/sdk/engage.js +1 -1
  76. package/dist/sdk/errors.js +1 -1
  77. package/dist/sdk/index.js +1 -1
  78. package/dist/sdk/job.js +1 -1
  79. package/dist/sdk/journey.js +1 -1
  80. package/dist/sdk/llm.d.ts.map +1 -1
  81. package/dist/sdk/llm.js +1 -1
  82. package/dist/sdk/llm.js.map +1 -1
  83. package/dist/sdk/query.js +1 -1
  84. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  85. package/dist/sdk/segment/journey-yaml.js +1 -1
  86. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  87. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  88. package/dist/sdk/segment.js +1 -1
  89. package/dist/sdk/user.js +1 -1
  90. package/dist/sdk/workflow.js +1 -1
  91. package/dist/types/endpoints.js +1 -1
  92. package/dist/types/index.d.ts +1 -1
  93. package/dist/types/index.d.ts.map +1 -1
  94. package/dist/types/index.js +1 -1
  95. package/dist/types/llm.d.ts +80 -4
  96. package/dist/types/llm.d.ts.map +1 -1
  97. package/dist/utils/agent-config.js +1 -1
  98. package/dist/utils/agent-ref-parser.js +1 -1
  99. package/dist/utils/async.js +1 -1
  100. package/dist/utils/chat-cache.js +1 -1
  101. package/dist/utils/colors.js +1 -1
  102. package/dist/utils/command-output.js +1 -1
  103. package/dist/utils/constants.js +1 -1
  104. package/dist/utils/diff.js +1 -1
  105. package/dist/utils/fields-display.js +1 -1
  106. package/dist/utils/file-permissions.js +1 -1
  107. package/dist/utils/format-detector.js +1 -1
  108. package/dist/utils/formatters.js +1 -1
  109. package/dist/utils/journey-utils.js +1 -1
  110. package/dist/utils/json-loader.js +1 -1
  111. package/dist/utils/llm-backup-utils.js +1 -1
  112. package/dist/utils/model-aliases.js +1 -1
  113. package/dist/utils/model-factors.js +1 -1
  114. package/dist/utils/option-validation.js +1 -1
  115. package/dist/utils/port.js +1 -1
  116. package/dist/utils/process.js +1 -1
  117. package/dist/utils/prompt.js +1 -1
  118. package/dist/utils/segment-path-parser.js +1 -1
  119. package/dist/utils/segment-ref-parser.js +1 -1
  120. package/dist/utils/spinner.js +1 -1
  121. package/dist/utils/sql-parser.js +1 -1
  122. package/dist/utils/sse-parser.js +1 -1
  123. package/dist/utils/string-utils.js +1 -1
  124. package/dist/utils/table-ref-parser.js +1 -1
  125. package/dist/utils/tdx-config.js +1 -1
  126. package/dist/utils/tdx-logger.js +1 -1
  127. package/dist/utils/tree-formatter.js +1 -1
  128. package/dist/utils/version-check.js +1 -1
  129. package/dist/utils/workflow-utils.js +1 -1
  130. package/package.json +1 -1
@@ -1 +1 @@
1
- const a33_0xcd98e8=a33_0x49d3;(function(_0x3a32c3,_0x466eed){const _0x116529=a33_0x49d3,_0x4b67a5=_0x3a32c3();while(!![]){try{const _0x308a90=-parseInt(_0x116529(0x157))/0x1+-parseInt(_0x116529(0x18b))/0x2*(-parseInt(_0x116529(0x167))/0x3)+parseInt(_0x116529(0x166))/0x4+-parseInt(_0x116529(0x159))/0x5*(parseInt(_0x116529(0x17a))/0x6)+-parseInt(_0x116529(0x18a))/0x7+parseInt(_0x116529(0x175))/0x8*(-parseInt(_0x116529(0x177))/0x9)+parseInt(_0x116529(0x168))/0xa*(parseInt(_0x116529(0x179))/0xb);if(_0x308a90===_0x466eed)break;else _0x4b67a5['push'](_0x4b67a5['shift']());}catch(_0x2b5620){_0x4b67a5['push'](_0x4b67a5['shift']());}}}(a33_0x27b6,0x1ce2f));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';function a33_0x27b6(){const _0x4814c6=['description','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','resolveFolderId','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Resolved\x20folder\x20ID:\x20','72ZRwguj','name','48123dqoEcU','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','11EHwAXJ','1098nLOizy','\x27\x20with\x20ID:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','resolvePathToResource','site','segment:create','noCountPopulation','data','type','invisible','error','folderId','\x27...','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','parent','279293negtjP','12jnqVFc','122225XjFGjw','Creating\x20segment\x20\x27','2845lUUMgn','Site:\x20','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Target\x20path:\x20','Create\x20child\x20segment\x20with\x20filtering\x20rules','Resolved\x20relative\x20path\x20to:\x20','segment','Parent\x20path:\x20','includes','rule','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','verbose','kind','213264pnYSep','15585dFAXPf','3482070CdoMei','Resolving\x20folder\x20path\x20\x27','execute','segments','folder','yellow'];a33_0x27b6=function(){return _0x4814c6;};return a33_0x27b6();}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a33_0x49d3(_0x22a4c2,_0x1e2790){_0x22a4c2=_0x22a4c2-0x157;const _0x27b625=a33_0x27b6();let _0x49d392=_0x27b625[_0x22a4c2];return _0x49d392;}import{parsePath,getParentPath,getBaseName}from'../utils/segment-path-parser.js';import a33_0x357805 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a33_0xcd98e8(0x176)]=a33_0xcd98e8(0x180);[a33_0xcd98e8(0x16e)]=a33_0xcd98e8(0x15d);async[a33_0xcd98e8(0x16a)](_0xe276b7){const _0x1c62b3=a33_0xcd98e8;console['error'](a33_0x357805[_0x1c62b3(0x16d)](_0x1c62b3(0x188))),console['error'](a33_0x357805['yellow'](_0x1c62b3(0x17d)));const {options:_0x5b39c6,args:_0x45726c,tdx:_0x34832f}=_0xe276b7,_0x57b967=_0x5b39c6;if(_0x45726c['length']===0x0)return console['error'](_0x1c62b3(0x15b)),console['error'](_0x1c62b3(0x178)),console[_0x1c62b3(0x185)]('Examples:'),console[_0x1c62b3(0x185)](_0x1c62b3(0x17c)),console[_0x1c62b3(0x185)](_0x1c62b3(0x173)),console['error'](_0x1c62b3(0x171)),0x1;const _0x58ff4c=_0x45726c[0x0],_0x170b5a=_0x5b39c6['segmentPath'];let _0x27f613=_0x58ff4c;_0x170b5a&&!_0x58ff4c[_0x1c62b3(0x161)]('/')&&(_0x27f613=_0x170b5a+'/'+_0x58ff4c,_0x57b967['verbose']&&console[_0x1c62b3(0x185)](_0x1c62b3(0x15e)+_0x27f613));const _0x315ede=parsePath(_0x27f613);if(_0x315ede[_0x1c62b3(0x16b)]['length']<0x2)return console['error']('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console[_0x1c62b3(0x185)](_0x1c62b3(0x163)),0x1;const _0x7730c3=_0x315ede[_0x1c62b3(0x16b)][0x0],_0x4d658d=getBaseName(_0x27f613),_0x2af671=getParentPath(_0x27f613);_0x57b967[_0x1c62b3(0x164)]&&(console[_0x1c62b3(0x185)](_0x1c62b3(0x15a)+_0x57b967[_0x1c62b3(0x17f)]),console['error'](_0x1c62b3(0x15c)+_0x27f613),console['error']('Parent:\x20'+_0x7730c3),console[_0x1c62b3(0x185)]('Segment\x20name:\x20'+_0x4d658d),console['error'](_0x1c62b3(0x160)+_0x2af671));const _0x33723a=await withSpinner(_0x1c62b3(0x172)+_0x7730c3+_0x1c62b3(0x187),()=>_0x34832f['segment']['resolveParentId'](_0x7730c3),{'verbose':_0x57b967[_0x1c62b3(0x164)]}),_0x2da8a2=_0x33723a[_0x1c62b3(0x182)];let _0x31ca98;if(_0x315ede[_0x1c62b3(0x16b)]['length']>0x2){const _0x446681=await withSpinner(_0x1c62b3(0x169)+_0x2af671+_0x1c62b3(0x187),()=>_0x34832f[_0x1c62b3(0x15f)][_0x1c62b3(0x17e)](_0x2af671),{'verbose':_0x57b967[_0x1c62b3(0x164)]}),_0x4b4bb3=_0x446681[_0x1c62b3(0x182)];if(_0x4b4bb3[_0x1c62b3(0x183)]!=='folder'&&_0x4b4bb3[_0x1c62b3(0x183)]!==_0x1c62b3(0x189))return console['error'](_0x1c62b3(0x16f)),0x1;_0x31ca98=_0x4b4bb3[_0x1c62b3(0x186)];}else{if(_0x57b967['folder']){const _0x244c89=await withSpinner('Resolving\x20folder\x20\x27'+_0x57b967['folder']+_0x1c62b3(0x187),()=>_0x34832f[_0x1c62b3(0x15f)][_0x1c62b3(0x170)](_0x2da8a2,_0x57b967[_0x1c62b3(0x16c)]),{'verbose':_0x57b967[_0x1c62b3(0x164)]});_0x31ca98=_0x244c89[_0x1c62b3(0x182)];}}_0x57b967[_0x1c62b3(0x164)]&&_0x31ca98&&console[_0x1c62b3(0x185)](_0x1c62b3(0x174)+_0x31ca98);const _0x1d01c0=await loadJSONFromOptions(_0x57b967[_0x1c62b3(0x162)],_0x57b967['ruleFile']),_0x110eb2={'name':_0x4d658d,'description':_0x57b967[_0x1c62b3(0x16e)],'rule':_0x1d01c0,'kind':_0x57b967[_0x1c62b3(0x165)]!==undefined?parseInt(_0x57b967[_0x1c62b3(0x165)],0xa):undefined,'isVisible':_0x57b967[_0x1c62b3(0x184)]?![]:undefined,'segmentFolderId':_0x31ca98,'countPopulation':_0x57b967[_0x1c62b3(0x181)]?![]:undefined},_0x2d6fea=await withSpinner(_0x1c62b3(0x158)+_0x4d658d+_0x1c62b3(0x187),()=>_0x34832f[_0x1c62b3(0x15f)]['createSegment'](_0x2da8a2,_0x110eb2),{'verbose':_0x57b967['verbose']}),_0x552b14=_0x2d6fea[_0x1c62b3(0x182)];return console[_0x1c62b3(0x185)]('✔\x20Created\x20segment\x20\x27'+_0x552b14[_0x1c62b3(0x176)]+_0x1c62b3(0x17b)+_0x552b14['id']),_0x27f613!==_0x58ff4c&&console['error']('\x20\x20\x20Path:\x20'+_0x27f613),await handleSDKOutput([_0x552b14],_0x57b967),0x0;}}
1
+ const a33_0x38c3ef=a33_0x4f8f;(function(_0x4421f,_0x21619c){const _0x59b2db=a33_0x4f8f,_0xaf4bfa=_0x4421f();while(!![]){try{const _0x18712c=parseInt(_0x59b2db(0x18c))/0x1*(parseInt(_0x59b2db(0x182))/0x2)+parseInt(_0x59b2db(0x195))/0x3*(parseInt(_0x59b2db(0x181))/0x4)+-parseInt(_0x59b2db(0x176))/0x5*(-parseInt(_0x59b2db(0x19e))/0x6)+-parseInt(_0x59b2db(0x19f))/0x7*(parseInt(_0x59b2db(0x188))/0x8)+parseInt(_0x59b2db(0x180))/0x9+parseInt(_0x59b2db(0x17c))/0xa*(parseInt(_0x59b2db(0x185))/0xb)+-parseInt(_0x59b2db(0x192))/0xc;if(_0x18712c===_0x21619c)break;else _0xaf4bfa['push'](_0xaf4bfa['shift']());}catch(_0x21a571){_0xaf4bfa['push'](_0xaf4bfa['shift']());}}}(a33_0xffee,0xd8613));function a33_0x4f8f(_0x1611cc,_0x551ddd){_0x1611cc=_0x1611cc-0x16a;const _0xffee07=a33_0xffee();let _0x4f8f26=_0xffee07[_0x1611cc];return _0x4f8f26;}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a33_0xffee(){const _0x5d5391=['createSegment','Site:\x20','Examples:','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','1959890qDiASY','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Segment\x20name:\x20','name','Parent\x20path:\x20','yellow','8134590OzHZoe','execute','type','parent','5003181bqcMLv','1644tPHPXb','163154imySTg','segment','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','11vXryCP','data','Resolved\x20folder\x20ID:\x20','87016Xtriiv','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Resolving\x20folder\x20\x27','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','9RJspFM','\x27...','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','folder','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Resolving\x20parent\x20segment\x20\x27','10478220CJyARy','✔\x20Created\x20segment\x20\x27','error','3837tcVqci','segments','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','folderId','rule','verbose','length','Create\x20child\x20segment\x20with\x20filtering\x20rules','invisible','6gyrjjJ','812UBWIzz','kind','Creating\x20segment\x20\x27','\x20\x20\x20Path:\x20','description','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','Target\x20path:\x20','includes','\x27\x20with\x20ID:\x20'];a33_0xffee=function(){return _0x5d5391;};return a33_0xffee();}import{parsePath,getParentPath,getBaseName}from'../utils/segment-path-parser.js';import a33_0xc0eebf from'chalk';export class SegmentCreateCommand extends BaseCommand{[a33_0x38c3ef(0x179)]='segment:create';[a33_0x38c3ef(0x16d)]=a33_0x38c3ef(0x19c);async[a33_0x38c3ef(0x17d)](_0x3ecf8b){const _0x9fc379=a33_0x38c3ef;console[_0x9fc379(0x194)](a33_0xc0eebf[_0x9fc379(0x17b)](_0x9fc379(0x175))),console['error'](a33_0xc0eebf[_0x9fc379(0x17b)](_0x9fc379(0x18b)));const {options:_0x15d37e,args:_0x38087e,tdx:_0x12c487}=_0x3ecf8b,_0x54c92b=_0x15d37e;if(_0x38087e[_0x9fc379(0x19b)]===0x0)return console['error'](_0x9fc379(0x197)),console['error'](_0x9fc379(0x16e)),console['error'](_0x9fc379(0x174)),console[_0x9fc379(0x194)](_0x9fc379(0x184)),console[_0x9fc379(0x194)](_0x9fc379(0x177)),console[_0x9fc379(0x194)](_0x9fc379(0x189)),0x1;const _0x2cc154=_0x38087e[0x0],_0x40c788=_0x15d37e['segmentPath'];let _0x5bf3b0=_0x2cc154;_0x40c788&&!_0x2cc154[_0x9fc379(0x170)]('/')&&(_0x5bf3b0=_0x40c788+'/'+_0x2cc154,_0x54c92b[_0x9fc379(0x19a)]&&console[_0x9fc379(0x194)]('Resolved\x20relative\x20path\x20to:\x20'+_0x5bf3b0));const _0x580a2f=parsePath(_0x5bf3b0);if(_0x580a2f[_0x9fc379(0x196)][_0x9fc379(0x19b)]<0x2)return console[_0x9fc379(0x194)](_0x9fc379(0x190)),console['error']('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x261583=_0x580a2f[_0x9fc379(0x196)][0x0],_0x1ce763=getBaseName(_0x5bf3b0),_0x301615=getParentPath(_0x5bf3b0);_0x54c92b[_0x9fc379(0x19a)]&&(console[_0x9fc379(0x194)](_0x9fc379(0x173)+_0x54c92b['site']),console[_0x9fc379(0x194)](_0x9fc379(0x16f)+_0x5bf3b0),console['error']('Parent:\x20'+_0x261583),console[_0x9fc379(0x194)](_0x9fc379(0x178)+_0x1ce763),console[_0x9fc379(0x194)](_0x9fc379(0x17a)+_0x301615));const _0x4eb306=await withSpinner(_0x9fc379(0x191)+_0x261583+_0x9fc379(0x18d),()=>_0x12c487[_0x9fc379(0x183)]['resolveParentId'](_0x261583),{'verbose':_0x54c92b['verbose']}),_0x5ab4ed=_0x4eb306[_0x9fc379(0x186)];let _0x33f93e;if(_0x580a2f[_0x9fc379(0x196)][_0x9fc379(0x19b)]>0x2){const _0xc9941a=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0x301615+_0x9fc379(0x18d),()=>_0x12c487[_0x9fc379(0x183)]['resolvePathToResource'](_0x301615),{'verbose':_0x54c92b[_0x9fc379(0x19a)]}),_0x2420df=_0xc9941a['data'];if(_0x2420df[_0x9fc379(0x17e)]!==_0x9fc379(0x18f)&&_0x2420df['type']!==_0x9fc379(0x17f))return console[_0x9fc379(0x194)](_0x9fc379(0x18e)),0x1;_0x33f93e=_0x2420df[_0x9fc379(0x198)];}else{if(_0x54c92b[_0x9fc379(0x18f)]){const _0x153fef=await withSpinner(_0x9fc379(0x18a)+_0x54c92b['folder']+_0x9fc379(0x18d),()=>_0x12c487[_0x9fc379(0x183)]['resolveFolderId'](_0x5ab4ed,_0x54c92b[_0x9fc379(0x18f)]),{'verbose':_0x54c92b[_0x9fc379(0x19a)]});_0x33f93e=_0x153fef[_0x9fc379(0x186)];}}_0x54c92b[_0x9fc379(0x19a)]&&_0x33f93e&&console[_0x9fc379(0x194)](_0x9fc379(0x187)+_0x33f93e);const _0x19d710=await loadJSONFromOptions(_0x54c92b[_0x9fc379(0x199)],_0x54c92b['ruleFile']),_0x40be9d={'name':_0x1ce763,'description':_0x54c92b[_0x9fc379(0x16d)],'rule':_0x19d710,'kind':_0x54c92b[_0x9fc379(0x16a)]!==undefined?parseInt(_0x54c92b[_0x9fc379(0x16a)],0xa):undefined,'isVisible':_0x54c92b[_0x9fc379(0x19d)]?![]:undefined,'segmentFolderId':_0x33f93e,'countPopulation':_0x54c92b['noCountPopulation']?![]:undefined},_0x4e9e04=await withSpinner(_0x9fc379(0x16b)+_0x1ce763+_0x9fc379(0x18d),()=>_0x12c487['segment'][_0x9fc379(0x172)](_0x5ab4ed,_0x40be9d),{'verbose':_0x54c92b[_0x9fc379(0x19a)]}),_0x8babab=_0x4e9e04[_0x9fc379(0x186)];return console[_0x9fc379(0x194)](_0x9fc379(0x193)+_0x8babab[_0x9fc379(0x179)]+_0x9fc379(0x171)+_0x8babab['id']),_0x5bf3b0!==_0x2cc154&&console[_0x9fc379(0x194)](_0x9fc379(0x16c)+_0x5bf3b0),await handleSDKOutput([_0x8babab],_0x54c92b),0x0;}}
@@ -1 +1 @@
1
- const a34_0x25297a=a34_0x5028;(function(_0x213456,_0x5917cc){const _0x19ca7c=a34_0x5028,_0x4dce49=_0x213456();while(!![]){try{const _0x5a8f1b=-parseInt(_0x19ca7c(0x168))/0x1*(-parseInt(_0x19ca7c(0x154))/0x2)+parseInt(_0x19ca7c(0x15d))/0x3*(-parseInt(_0x19ca7c(0x157))/0x4)+parseInt(_0x19ca7c(0x167))/0x5*(parseInt(_0x19ca7c(0x165))/0x6)+-parseInt(_0x19ca7c(0x15c))/0x7+-parseInt(_0x19ca7c(0x152))/0x8*(parseInt(_0x19ca7c(0x156))/0x9)+parseInt(_0x19ca7c(0x14d))/0xa*(-parseInt(_0x19ca7c(0x155))/0xb)+parseInt(_0x19ca7c(0x14e))/0xc*(parseInt(_0x19ca7c(0x163))/0xd);if(_0x5a8f1b===_0x5917cc)break;else _0x4dce49['push'](_0x4dce49['shift']());}catch(_0x21969a){_0x4dce49['push'](_0x4dce49['shift']());}}}(a34_0x13c9,0x89501));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../utils/fields-display.js';function a34_0x5028(_0x1be987,_0x5da407){_0x1be987=_0x1be987-0x14b;const _0x13c9f3=a34_0x13c9();let _0x5028a7=_0x13c9f3[_0x1be987];return _0x5028a7;}export class SegmentFieldsCommand extends BaseCommand{['name']='segment:fields';[a34_0x25297a(0x14f)]=a34_0x25297a(0x14c);async[a34_0x25297a(0x158)](_0x5b0395){const _0x17c08f=a34_0x25297a,{options:_0x3ea955,args:_0x496e0f,tdx:_0x1044a9}=_0x5b0395,_0x3cd823=_0x496e0f[0x0]||_0x3ea955[_0x17c08f(0x15e)];if(!_0x3cd823)return console['error'](_0x17c08f(0x162)),console[_0x17c08f(0x161)](_0x17c08f(0x159)),console[_0x17c08f(0x161)](_0x17c08f(0x150)),0x1;_0x3ea955[_0x17c08f(0x153)]&&(console[_0x17c08f(0x161)]('Site:\x20'+_0x3ea955[_0x17c08f(0x15a)]),console[_0x17c08f(0x161)](_0x17c08f(0x15b)+_0x3cd823));const _0x18c199=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x3cd823+_0x17c08f(0x160),()=>_0x1044a9['segment'][_0x17c08f(0x14b)](_0x3cd823),{'verbose':_0x3ea955[_0x17c08f(0x153)]}),_0x30943f=_0x18c199['data'];console[_0x17c08f(0x161)](_0x17c08f(0x151)+_0x30943f[_0x17c08f(0x166)]+'\x20field'+(_0x30943f[_0x17c08f(0x166)]!==0x1?'s':''));if(_0x3ea955[_0x17c08f(0x164)]||_0x3ea955[_0x17c08f(0x15f)])return await handleSDKOutput(_0x30943f,_0x3ea955),0x0;return displayFieldsHumanReadable(_0x30943f,_0x3cd823),0x0;}}function a34_0x13c9(){const _0xdeb5bb=['json','6HnpRpa','length','2895105dJKbkj','4OGilCU','listFields','List\x20available\x20fields\x20for\x20segmentation','108340djWSNl','14942244gbBmer','description','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','✔\x20Found\x20','8XRLYSb','verbose','117712mtdWyP','77ljadQJ','5256549TMgazK','7352JgVbQH','execute','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','site','Parent\x20segment:\x20','4252850HrSBsX','375ZKxZrc','parentSegment','jsonl','\x27...','error','Error:\x20Parent\x20segment\x20name\x20is\x20required','13wXJQPU'];a34_0x13c9=function(){return _0xdeb5bb;};return a34_0x13c9();}
1
+ const a34_0x35bd85=a34_0x3fd7;function a34_0x3fd7(_0x7ee4ba,_0x4c3077){_0x7ee4ba=_0x7ee4ba-0x137;const _0xf00148=a34_0xf001();let _0x3fd7ba=_0xf00148[_0x7ee4ba];return _0x3fd7ba;}(function(_0x560c37,_0x1755a5){const _0x4e5280=a34_0x3fd7,_0x134bcc=_0x560c37();while(!![]){try{const _0x16ceb2=-parseInt(_0x4e5280(0x153))/0x1*(-parseInt(_0x4e5280(0x13e))/0x2)+parseInt(_0x4e5280(0x145))/0x3*(parseInt(_0x4e5280(0x154))/0x4)+parseInt(_0x4e5280(0x151))/0x5*(-parseInt(_0x4e5280(0x14d))/0x6)+parseInt(_0x4e5280(0x146))/0x7*(parseInt(_0x4e5280(0x144))/0x8)+parseInt(_0x4e5280(0x13a))/0x9+-parseInt(_0x4e5280(0x148))/0xa*(parseInt(_0x4e5280(0x137))/0xb)+parseInt(_0x4e5280(0x14a))/0xc;if(_0x16ceb2===_0x1755a5)break;else _0x134bcc['push'](_0x134bcc['shift']());}catch(_0x8a339f){_0x134bcc['push'](_0x134bcc['shift']());}}}(a34_0xf001,0xd1434));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../utils/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a34_0x35bd85(0x14f)]=a34_0x35bd85(0x150);[a34_0x35bd85(0x138)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x289b2c){const _0x4dbc56=a34_0x35bd85,{options:_0x522fd6,args:_0x359e53,tdx:_0x1f0176}=_0x289b2c,_0x187071=_0x359e53[0x0]||_0x522fd6[_0x4dbc56(0x14c)];if(!_0x187071)return console[_0x4dbc56(0x152)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x4dbc56(0x152)](_0x4dbc56(0x147)),console[_0x4dbc56(0x152)](_0x4dbc56(0x139)),0x1;_0x522fd6[_0x4dbc56(0x140)]&&(console[_0x4dbc56(0x152)](_0x4dbc56(0x142)+_0x522fd6[_0x4dbc56(0x13b)]),console['error'](_0x4dbc56(0x149)+_0x187071));const _0x403112=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x187071+_0x4dbc56(0x13c),()=>_0x1f0176[_0x4dbc56(0x143)]['listFields'](_0x187071),{'verbose':_0x522fd6[_0x4dbc56(0x140)]}),_0x1f51c4=_0x403112[_0x4dbc56(0x13f)];console[_0x4dbc56(0x152)](_0x4dbc56(0x14b)+_0x1f51c4[_0x4dbc56(0x141)]+'\x20field'+(_0x1f51c4[_0x4dbc56(0x141)]!==0x1?'s':''));if(_0x522fd6[_0x4dbc56(0x13d)]||_0x522fd6[_0x4dbc56(0x14e)])return await handleSDKOutput(_0x1f51c4,_0x522fd6),0x0;return displayFieldsHumanReadable(_0x1f51c4,_0x187071),0x0;}}function a34_0xf001(){const _0x5a46c8=['\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','2035593PjECst','site','\x27...','json','285434QeujiM','data','verbose','length','Site:\x20','segment','629416zlJkDv','12tNcObi','35OolgfM','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','5746260NVWyWe','Parent\x20segment:\x20','6613140kzADKW','✔\x20Found\x20','parentSegment','7362leHgQZ','jsonl','name','segment:fields','415zRhsed','error','2TfPaWB','77516xaBWPq','11DjCiDe','description'];a34_0xf001=function(){return _0x5a46c8;};return a34_0xf001();}
@@ -1 +1 @@
1
- const a35_0x4ce8e6=a35_0x5099;(function(_0x333b29,_0x2fe5f3){const _0x5d90e6=a35_0x5099,_0x2df1ce=_0x333b29();while(!![]){try{const _0x1c21b9=-parseInt(_0x5d90e6(0x110))/0x1+-parseInt(_0x5d90e6(0xe3))/0x2*(parseInt(_0x5d90e6(0xd5))/0x3)+parseInt(_0x5d90e6(0x13d))/0x4*(-parseInt(_0x5d90e6(0x12c))/0x5)+-parseInt(_0x5d90e6(0x128))/0x6+-parseInt(_0x5d90e6(0x122))/0x7*(parseInt(_0x5d90e6(0xdc))/0x8)+parseInt(_0x5d90e6(0x134))/0x9*(parseInt(_0x5d90e6(0xde))/0xa)+parseInt(_0x5d90e6(0xec))/0xb;if(_0x1c21b9===_0x2fe5f3)break;else _0x2df1ce['push'](_0x2df1ce['shift']());}catch(_0x3eaa47){_0x2df1ce['push'](_0x2df1ce['shift']());}}}(a35_0x36a8,0x1c40a));import{BaseCommand}from'./command.js';function a35_0x36a8(){const _0x23e8ee=['620vIZggt','\x0aChanges\x20to\x20\x27','Processing\x20journeys...','dim','audienceId','14030QbeFvF','getActivation','relativePath','\x20versions)','from','values','Fetching\x20activations...','\x20=\x20','Write\x20','7506400xLQgQn','push','\x0aPull\x20summary\x20for\x20\x27','Fetching\x20users\x20for\x20email\x20resolution...','slice','Fetching\x20connections\x20for\x20name\x20resolution...','absolutePath','hasChanges','green','✔\x20Pulled\x20','\x20\x20🗺️\x20\x20','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','\x20changed\x20files','listSegments','content','message','session','Fetching\x20parent\x20segment\x20info...','\x20files\x20to\x20','Aborted.','connection','journeyBundleId','map','Resolving\x20parent\x20segment\x20\x27','parent_segment','\x20\x20Target:\x20','dirname','segment:pull','attributes','all','verbose','cyan','Resolved\x20parent\x20name:\x20','join','journeyBundleName','Parent\x20segment:\x20','183953yylXXV','\x20new\x20files','resolveParentId','diff','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','Found\x20existing\x20tdx.json\x20at:\x20','name','repeat','site','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','isNew','Fetching\x20folders...','Found\x20tdx.json\x20at:\x20','execute','versionNumber','user','has','77NAqIjF','reduce','getJourney','filter','getSegment','Fetching\x20segments...','1181298BMXZHR','yellow','.yml','segmentFolderId','8355GYGCBO','data','journey','rule','relative','\x20activations','kind','listJourneysFromParentSegment','4041dNfMoH','Fetching\x20journey\x20\x27','set','segment','get','✔\x20Context\x20set:\x20','folderId','activation_','buildIdToEmailMap','180YgHRkS','setPhase','Warning:\x20Could\x20not\x20resolve\x20activation\x20','yes','parentFolderId','Using\x20parent\x20segment:\x20','then','Fetching\x20journeys...','getParent','length','listFolders','\x20segments','\x27...','27caDLZJ','buildIdToNameMap','isDirectory','add','red','size','parentSegment','54800VRZvZR','error'];a35_0x36a8=function(){return _0x23e8ee;};return a35_0x36a8();}import{withSpinner,withQuerySpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,createTdxConfigContent,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{saveSessionContext}from'../core/session.js';import{segmentWithActivationsToYaml,segmentToYamlString,apiRuleToYaml,journeyActivationStepToYaml}from'../sdk/segment/child-segment-yaml.js';import{apiToYamlAsync,toYamlString as a35_0x47142e}from'../sdk/segment/journey-yaml.js';import a35_0xfbd8a5 from'chalk';import{existsSync,mkdirSync,readFileSync,writeFileSync,statSync}from'fs';import a35_0xcc50b from'path';import{sanitizeFileName}from'../utils/string-utils.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyYaml,createJumpTargetCache,resolveJumpTarget}from'../utils/journey-utils.js';export class SegmentPullCommand extends BaseCommand{[a35_0x4ce8e6(0x117)]=a35_0x4ce8e6(0x107);['description']=a35_0x4ce8e6(0x115);async[a35_0x4ce8e6(0x11e)](_0x337642){const _0x39628c=a35_0x4ce8e6,{options:_0x303a54,args:_0x4d3291,tdx:_0x193b24}=_0x337642,_0x59a985=_0x303a54,_0xf424e4=_0x303a54[_0x39628c(0xdb)],_0x173ca0=_0x4d3291[0x0],_0x8815e2=findTdxConfigPath();let _0x18b0eb,_0x55a966;if(!_0x173ca0&&_0x8815e2){const _0x2d128a=loadTdxConfig(_0x8815e2);_0x18b0eb=_0x2d128a[_0x39628c(0x104)],_0x55a966=a35_0xcc50b[_0x39628c(0x106)](_0x8815e2),_0x59a985['verbose']&&(console['error'](_0x39628c(0x116)+_0x8815e2),console[_0x39628c(0xdd)](_0x39628c(0xcd)+_0x18b0eb));}else{if(_0x173ca0){if(existsSync(_0x173ca0)&&statSync(_0x173ca0)[_0x39628c(0xd7)]()){const _0xbe4244=findTdxConfigPath(_0x173ca0);if(_0xbe4244){const _0x283601=loadTdxConfig(_0xbe4244);_0x18b0eb=_0x283601['parent_segment'],_0x55a966=a35_0xcc50b[_0x39628c(0x106)](_0xbe4244),_0x59a985[_0x39628c(0x10a)]&&(console[_0x39628c(0xdd)](_0x39628c(0x11d)+_0xbe4244),console['error'](_0x39628c(0xcd)+_0x18b0eb));}else return console['error'](a35_0xfbd8a5[_0x39628c(0xd9)](_0x39628c(0x11a)+_0x173ca0+'\x0a')),console[_0x39628c(0xdd)](a35_0xfbd8a5['cyan'](_0x39628c(0x114))),0x1;}else _0x18b0eb=_0x173ca0;}else _0x18b0eb=_0xf424e4;}if(!_0x18b0eb)return console['error'](a35_0xfbd8a5[_0x39628c(0x129)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console['error']('Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)'),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'),console[_0x39628c(0xdd)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file'),0x1;_0x59a985['verbose']&&(console[_0x39628c(0xdd)]('Site:\x20'+_0x59a985[_0x39628c(0x119)]),console[_0x39628c(0xdd)](_0x39628c(0x10f)+_0x18b0eb));const _0x68b661=await withSpinner(_0x39628c(0x103)+_0x18b0eb+_0x39628c(0xd4),()=>_0x193b24[_0x39628c(0x137)][_0x39628c(0x112)](_0x18b0eb),{'verbose':_0x59a985['verbose']}),_0x376b31=_0x68b661[_0x39628c(0x12d)],_0x323043=await withSpinner(_0x39628c(0xfd),()=>_0x193b24[_0x39628c(0x137)][_0x39628c(0xd0)](_0x376b31),{'verbose':_0x59a985[_0x39628c(0x10a)]}),_0x41a802=_0x323043[_0x39628c(0x12d)]['attributes'][_0x39628c(0x117)];_0x59a985[_0x39628c(0x10a)]&&console[_0x39628c(0xdd)](_0x39628c(0x10c)+_0x41a802);const [_0x3667b9,_0x3dba67,_0x48e37f]=await Promise[_0x39628c(0x109)]([withSpinner(_0x39628c(0x127),()=>_0x193b24[_0x39628c(0x137)][_0x39628c(0xf9)](_0x376b31),{'verbose':_0x59a985[_0x39628c(0x10a)]}),withSpinner(_0x39628c(0x11c),()=>_0x193b24[_0x39628c(0x137)][_0x39628c(0xd2)](_0x376b31),{'verbose':_0x59a985[_0x39628c(0x10a)]}),withSpinner(_0x39628c(0xcf),()=>_0x193b24[_0x39628c(0x12e)][_0x39628c(0x133)](_0x376b31),{'verbose':_0x59a985['verbose']})]),_0x37e804=_0x3667b9[_0x39628c(0x12d)],_0x4c29a5=_0x3dba67[_0x39628c(0x12d)],_0x559698=_0x48e37f[_0x39628c(0x12d)];if(_0x37e804[_0x39628c(0xd1)]===0x0&&_0x559698[_0x39628c(0xd1)]===0x0)return console[_0x39628c(0xdd)](a35_0xfbd8a5[_0x39628c(0x129)](_0x39628c(0xf7)+_0x41a802+'\x27')),0x0;const _0x4bd89e=buildFolderPathMap(_0x4c29a5),_0x3b291f=_0x55a966||getSegmentRootDir(sanitizeFileName(_0x18b0eb)),_0x461ddc=new Map();await withSpinner(_0x39628c(0xe9),async()=>{await batchAsync(_0x37e804,async _0x5b0064=>{const _0x5d564a=a35_0x5099,_0x2c04d4=await _0x193b24['segment']['listActivations'](_0x376b31,_0x5b0064['id']);_0x461ddc[_0x5d564a(0x136)](_0x5b0064['id'],_0x2c04d4);});},{'verbose':_0x59a985[_0x39628c(0x10a)]});const _0x35c75c=await withSpinner(_0x39628c(0xef),()=>_0x193b24[_0x39628c(0x120)][_0x39628c(0x13c)](),{'verbose':_0x59a985[_0x39628c(0x10a)]})[_0x39628c(0xce)](_0x3b91d8=>_0x3b91d8[_0x39628c(0x12d)]),_0x4c52bf=await withSpinner(_0x39628c(0xf1),()=>_0x193b24[_0x39628c(0x100)][_0x39628c(0xd6)](),{'verbose':_0x59a985[_0x39628c(0x10a)]})[_0x39628c(0xce)](_0x42286a=>_0x42286a[_0x39628c(0x12d)]),_0x88912a=[],_0x336d96=a35_0xcc50b[_0x39628c(0x10d)](_0x3b291f,'tdx.json'),_0x1744a8=createTdxConfigContent(_0x41a802);_0x88912a[_0x39628c(0xed)](prepareFile(_0x336d96,_0x1744a8,_0x3b291f));const _0x116c62=new Map();for(const _0x35db49 of _0x37e804){if(_0x35db49[_0x39628c(0x132)]===SEGMENT_KIND_JOURNEY)continue;const _0x3b61b3=_0x35db49[_0x39628c(0x12b)]?_0x4bd89e['get'](_0x35db49[_0x39628c(0x12b)])||'':'',_0x2984f0=_0x461ddc[_0x39628c(0x138)](_0x35db49['id'])||[],_0x383fd3=segmentWithActivationsToYaml(_0x35db49,_0x2984f0,undefined,_0x35c75c,_0x4c52bf),_0x49f958=_0x3b61b3?a35_0xcc50b['join'](_0x3b291f,_0x3b61b3):_0x3b291f,_0x43c206=sanitizeFileName(_0x35db49['name']),_0x383114=getUniqueFileName(_0x49f958,_0x43c206,_0x116c62),_0x1f7bb2=a35_0xcc50b[_0x39628c(0x10d)](_0x49f958,_0x383114+_0x39628c(0x12a)),_0x8e3b7a=segmentToYamlString(_0x383fd3);_0x88912a[_0x39628c(0xed)](prepareFile(_0x1f7bb2,_0x8e3b7a,_0x3b291f));}const _0x3548db=new Map();for(const _0x2efabf of _0x37e804){_0x3548db[_0x39628c(0x136)](_0x2efabf['id'],_0x2efabf);}const _0x52064b=new Map();for(const _0x5bdfd9 of _0x559698){const _0x2436b6=_0x5bdfd9[_0x39628c(0x101)];!_0x52064b[_0x39628c(0x121)](_0x2436b6)&&_0x52064b['set'](_0x2436b6,[]),_0x52064b[_0x39628c(0x138)](_0x2436b6)[_0x39628c(0xed)](_0x5bdfd9);}for(const _0x451266 of _0x52064b[_0x39628c(0xe8)]()){_0x451266['sort']((_0x455105,_0x115c3f)=>(_0x455105[_0x39628c(0x11f)]||0x0)-(_0x115c3f[_0x39628c(0x11f)]||0x0));}const _0xa6b712=()=>{const _0x578807=_0x39628c,_0xc62911=new Set(),_0x3ba5ed=new Set(),_0x58eb03=new Map(),_0x123f34=new Map(),_0x50606e=createJumpTargetCache(),_0x3dd2b2=(_0x2fbe67,_0x2fd627)=>({'resolveSegment':async _0x4cb330=>{const _0x26033e=a35_0x5099,_0x3a8265=_0x58eb03[_0x26033e(0x138)](_0x4cb330);if(_0x3a8265!==undefined)return{'name':_0x3a8265,'isJourneyLocal':!![]};if(!_0x2fd627)return{'name':_0x4cb330,'isJourneyLocal':![]};try{let _0x5f3645=_0x3548db[_0x26033e(0x138)](_0x4cb330);!_0x5f3645&&(_0x5f3645=await _0x193b24[_0x26033e(0x137)][_0x26033e(0x126)](_0x2fd627,_0x4cb330));const _0x5a67a8=generateJourneyLocalName(_0x5f3645[_0x26033e(0x117)]),_0x511693=_0x5f3645[_0x26033e(0x132)]===SEGMENT_KIND_JOURNEY&&_0x5a67a8!==undefined;let _0x4934fc=_0x5f3645[_0x26033e(0x117)];if(_0x511693&&_0x5a67a8){let _0xcbaa8e=_0x5a67a8,_0xedbb7a=0x2;while(_0xc62911['has'](_0xcbaa8e)){_0xcbaa8e=_0x5a67a8+'_'+_0xedbb7a,_0xedbb7a++;}_0xc62911[_0x26033e(0xd8)](_0xcbaa8e),_0x4934fc=_0xcbaa8e,_0x58eb03[_0x26033e(0x136)](_0x4cb330,_0x4934fc);}let _0x12e6c9;return _0x511693&&_0x5f3645[_0x26033e(0x12f)]&&(_0x12e6c9={'description':_0x5f3645['description'],'rule':apiRuleToYaml(_0x5f3645[_0x26033e(0x12f)])}),{'name':_0x4934fc,'isJourneyLocal':_0x511693,'definition':_0x12e6c9};}catch(_0x7f9530){return _0x59a985[_0x26033e(0x10a)]&&console[_0x26033e(0xdd)]('Warning:\x20Could\x20not\x20resolve\x20segment\x20'+_0x4cb330+':\x20'+_0x7f9530[_0x26033e(0xfb)]),{'name':_0x4cb330,'isJourneyLocal':![]};}},'resolveActivation':async _0x58e17c=>{const _0xdeca34=a35_0x5099,_0x164d6a=_0x123f34[_0xdeca34(0x138)](_0x58e17c);if(_0x164d6a!==undefined)return{'name':_0x164d6a,'isJourneyLocal':!![]};try{const _0xeef562=await _0x193b24['journey'][_0xdeca34(0xe4)](_0x2fbe67,_0x58e17c),_0x5c284=_0xeef562['attributes']['activationParams']['name']||_0x58e17c,_0x49d233=sanitizeYamlKey(_0x5c284)||_0xdeca34(0x13b)+_0x58e17c;let _0xf478a8=_0x49d233,_0xff83c2=0x2;while(_0x3ba5ed[_0xdeca34(0x121)](_0xf478a8)){_0xf478a8=_0x49d233+'_'+_0xff83c2,_0xff83c2++;}_0x3ba5ed[_0xdeca34(0xd8)](_0xf478a8),_0x123f34[_0xdeca34(0x136)](_0x58e17c,_0xf478a8);const _0x1d4f70=journeyActivationStepToYaml(_0xeef562,_0x35c75c,_0x4c52bf);return{'name':_0xf478a8,'isJourneyLocal':!![],'definition':_0x1d4f70};}catch(_0x2481e7){return _0x59a985['verbose']&&console[_0xdeca34(0xdd)](_0xdeca34(0xca)+_0x58e17c+':\x20'+_0x2481e7[_0xdeca34(0xfb)]),{'name':_0x58e17c,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x49cb66,_0x299b70)=>resolveJumpTarget(_0x49cb66,_0x299b70,_0x50606e,_0x152a8d=>_0x193b24[_0x578807(0x12e)][_0x578807(0x124)](_0x152a8d))});return{'createYamlContext':_0x3dd2b2};};if(_0x52064b[_0x39628c(0xda)]>0x0){const _0x52dbd1=Array[_0x39628c(0xe7)](_0x52064b[_0x39628c(0xe8)]()),_0x11fae5=await withQuerySpinner(_0x39628c(0xe0),async _0x3984b8=>{const _0x45ad68=_0x39628c,_0x4de842=[];let _0x5e65f2=0x0;const _0x5d282f=0x5;for(let _0x4f923a=0x0;_0x4f923a<_0x52dbd1['length'];_0x4f923a+=_0x5d282f){const _0x30d367=_0x52dbd1[_0x45ad68(0xf0)](_0x4f923a,_0x4f923a+_0x5d282f),_0x2e7da5=await Promise[_0x45ad68(0x109)](_0x30d367[_0x45ad68(0x102)](async _0x4696db=>{const _0x23460f=_0x45ad68,_0x23bdc1=_0x4696db[0x0],_0x8aa522=_0x23bdc1[_0x23460f(0x10e)];_0x3984b8[_0x23460f(0x13e)](_0x23460f(0x135)+_0x8aa522+'\x27');const _0x330172=_0x23bdc1['folderId']?_0x4bd89e[_0x23460f(0x138)](_0x23bdc1[_0x23460f(0x13a)])||'':'',{createYamlContext:_0x48eca1}=_0xa6b712(),_0x4c6e56=[];for(const _0x380963 of _0x4696db){const _0x186d02=await _0x193b24[_0x23460f(0x12e)][_0x23460f(0x124)](_0x380963['id']),_0x128346=_0x186d02[_0x23460f(0x108)]?.[_0x23460f(0xe2)],_0x206c4e=_0x48eca1(_0x380963['id'],_0x128346),_0x5d19a0=await apiToYamlAsync(_0x186d02,_0x206c4e);_0x4c6e56[_0x23460f(0xed)]({'item':_0x380963,'yaml':_0x5d19a0});}let _0x4fd681;return _0x4c6e56[_0x23460f(0xd1)]===0x1?_0x4fd681=_0x4c6e56[0x0]['yaml']:_0x4fd681=buildMergedJourneyYaml(_0x4c6e56),{'bundleName':_0x8aa522,'folderPath':_0x330172,'finalYaml':_0x4fd681};}));_0x4de842[_0x45ad68(0xed)](..._0x2e7da5),_0x5e65f2+=_0x30d367[_0x45ad68(0xd1)],_0x3984b8['setExtra']('('+_0x5e65f2+'/'+_0x52dbd1[_0x45ad68(0xd1)]+')');}return _0x4de842;},{'verbose':_0x59a985[_0x39628c(0x10a)]});for(const {bundleName:_0x268da3,folderPath:_0x4bf847,finalYaml:_0x29e6ff}of _0x11fae5[_0x39628c(0x12d)]){const _0x162e1f=a35_0x47142e(_0x29e6ff),_0x2fd7ec=_0x4bf847?a35_0xcc50b[_0x39628c(0x10d)](_0x3b291f,_0x4bf847):_0x3b291f,_0x879c17=sanitizeFileName(_0x268da3),_0x8ade7d=getUniqueFileName(_0x2fd7ec,_0x879c17,_0x116c62),_0x5af314=a35_0xcc50b[_0x39628c(0x10d)](_0x2fd7ec,_0x8ade7d+'.yml');_0x88912a[_0x39628c(0xed)](prepareFile(_0x5af314,_0x162e1f,_0x3b291f));}}const _0x9ce939=Array[_0x39628c(0xe7)](_0x461ddc['values']())[_0x39628c(0x123)]((_0x5a5bbe,_0x1f48ef)=>_0x5a5bbe+_0x1f48ef['length'],0x0),_0x2c5fae=_0x88912a['filter'](_0x2fa82a=>_0x2fa82a['isNew']),_0x475f2d=_0x88912a[_0x39628c(0x125)](_0x7c78a5=>!_0x7c78a5['isNew']&&_0x7c78a5[_0x39628c(0xf3)]),_0x286af4=_0x88912a[_0x39628c(0x125)](_0x26bc5f=>!_0x26bc5f['isNew']&&!_0x26bc5f[_0x39628c(0xf3)]),_0x481cb7=_0x37e804[_0x39628c(0x125)](_0x5863c3=>_0x5863c3[_0x39628c(0x132)]!==SEGMENT_KIND_JOURNEY);console['error'](_0x39628c(0xee)+_0x41a802+'\x27:'),console[_0x39628c(0xdd)]('\x20\x20🎯\x20'+a35_0xfbd8a5[_0x39628c(0x10b)](_0x481cb7[_0x39628c(0xd1)]+_0x39628c(0xd3))+'\x20with\x20'+a35_0xfbd8a5['cyan'](_0x9ce939+_0x39628c(0x131)));if(_0x52064b['size']>0x0){const _0x561958=_0x559698[_0x39628c(0xd1)],_0x31f28b=_0x52064b[_0x39628c(0xda)],_0x33eced=_0x561958>_0x31f28b?'\x20('+_0x561958+_0x39628c(0xe6):'';console['error'](_0x39628c(0xf6)+a35_0xfbd8a5['cyan'](_0x31f28b+'\x20journeys')+a35_0xfbd8a5[_0x39628c(0xe1)](_0x33eced));}console[_0x39628c(0xdd)]('\x20\x20'+a35_0xfbd8a5['green']('+\x20'+_0x2c5fae['length']+_0x39628c(0x111))),console[_0x39628c(0xdd)]('\x20\x20'+a35_0xfbd8a5[_0x39628c(0x129)]('~\x20'+_0x475f2d['length']+_0x39628c(0xf8))),console[_0x39628c(0xdd)]('\x20\x20'+a35_0xfbd8a5['dim']('=\x20'+_0x286af4[_0x39628c(0xd1)]+'\x20unchanged\x20files')),console[_0x39628c(0xdd)](_0x39628c(0x105)+a35_0xfbd8a5[_0x39628c(0x10b)](_0x3b291f)+'\x0a');if(_0x475f2d['length']>0x0)for(const _0x2116eb of _0x475f2d){console[_0x39628c(0xdd)](_0x39628c(0xdf)+_0x2116eb[_0x39628c(0xe5)]+'\x27:'),console[_0x39628c(0xdd)]('─'[_0x39628c(0x118)](0x3c)),console['error'](_0x2116eb[_0x39628c(0x113)]),console[_0x39628c(0xdd)]('─'[_0x39628c(0x118)](0x3c));}if(_0x59a985['dryRun'])return console[_0x39628c(0xdd)](a35_0xfbd8a5[_0x39628c(0x129)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x2c5fae['length']===0x0&&_0x475f2d['length']===0x0)return console['error'](a35_0xfbd8a5[_0x39628c(0xf4)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x41a802},_0x59a985[_0x39628c(0xfc)]),console[_0x39628c(0xdd)](a35_0xfbd8a5['green'](_0x39628c(0x139)+a35_0xfbd8a5[_0x39628c(0xe1)](_0x39628c(0x104))+'\x20=\x20'+a35_0xfbd8a5['cyan'](_0x41a802))),0x0;if(!_0x59a985[_0x39628c(0xcb)]&&(_0x2c5fae['length']>0x0||_0x475f2d[_0x39628c(0xd1)]>0x0)){const _0x34f860=await confirmKey(_0x39628c(0xeb)+(_0x2c5fae[_0x39628c(0xd1)]+_0x475f2d[_0x39628c(0xd1)])+'\x20files?');if(!_0x34f860)return console[_0x39628c(0xdd)](_0x39628c(0xff)),0x1;}for(const _0x3830a9 of _0x88912a){if(_0x3830a9[_0x39628c(0x11b)]||_0x3830a9[_0x39628c(0xf3)]){const _0x476791=a35_0xcc50b[_0x39628c(0x106)](_0x3830a9[_0x39628c(0xf2)]);!existsSync(_0x476791)&&mkdirSync(_0x476791,{'recursive':!![]}),writeFileSync(_0x3830a9[_0x39628c(0xf2)],_0x3830a9[_0x39628c(0xfa)],'utf-8');}}return console[_0x39628c(0xdd)](a35_0xfbd8a5[_0x39628c(0xf4)](_0x39628c(0xf5)+(_0x2c5fae[_0x39628c(0xd1)]+_0x475f2d[_0x39628c(0xd1)])+_0x39628c(0xfe)+_0x3b291f)),saveSessionContext({'parent_segment':_0x41a802},_0x59a985[_0x39628c(0xfc)]),console[_0x39628c(0xdd)](a35_0xfbd8a5[_0x39628c(0xf4)](_0x39628c(0x139)+a35_0xfbd8a5['dim']('parent_segment')+_0x39628c(0xea)+a35_0xfbd8a5[_0x39628c(0x10b)](_0x41a802))),0x0;}}function buildFolderPathMap(_0xf66468){const _0x4d2a01=a35_0x4ce8e6,_0x21e9ce=new Map(),_0x227958=new Map();for(const _0x22b820 of _0xf66468){_0x227958[_0x4d2a01(0x136)](_0x22b820['id'],_0x22b820);}const _0x7c0adf=new Set();for(const _0x42b7f2 of _0xf66468){!_0x42b7f2[_0x4d2a01(0xcc)]&&_0x7c0adf[_0x4d2a01(0xd8)](_0x42b7f2['id']);}function _0x33da6d(_0x515843){const _0x111a66=_0x4d2a01;if(_0x21e9ce['has'](_0x515843['id']))return _0x21e9ce[_0x111a66(0x138)](_0x515843['id']);if(_0x7c0adf[_0x111a66(0x121)](_0x515843['id']))return _0x21e9ce['set'](_0x515843['id'],''),'';if(_0x515843[_0x111a66(0xcc)]){const _0x21b23b=_0x227958[_0x111a66(0x138)](_0x515843['parentFolderId']);if(_0x21b23b){const _0x479a50=_0x33da6d(_0x21b23b),_0x45c058=_0x479a50?_0x479a50+'/'+_0x515843['name']:_0x515843[_0x111a66(0x117)];return _0x21e9ce['set'](_0x515843['id'],_0x45c058),_0x45c058;}}const _0xadb9e6=_0x515843[_0x111a66(0x117)];return _0x21e9ce['set'](_0x515843['id'],_0xadb9e6),_0xadb9e6;}for(const _0x53f881 of _0xf66468){_0x33da6d(_0x53f881);}return _0x21e9ce;}function getUniqueFileName(_0x4ea139,_0x19acea,_0x355d9e){const _0x5ed605=a35_0x4ce8e6,_0x5a33f9=_0x4ea139+':'+_0x19acea,_0x4e0d5e=_0x355d9e['get'](_0x5a33f9)||0x0;_0x355d9e[_0x5ed605(0x136)](_0x5a33f9,_0x4e0d5e+0x1);if(_0x4e0d5e===0x0)return _0x19acea;return _0x19acea+'-'+_0x4e0d5e;}function a35_0x5099(_0x47ca84,_0x32bab4){_0x47ca84=_0x47ca84-0xca;const _0x36a88b=a35_0x36a8();let _0x509929=_0x36a88b[_0x47ca84];return _0x509929;}function prepareFile(_0x22403b,_0x59c545,_0x467266){const _0x2d4562=a35_0x4ce8e6,_0x352516=a35_0xcc50b[_0x2d4562(0x130)](_0x467266,_0x22403b);if(existsSync(_0x22403b)){const _0x2a2736=readFileSync(_0x22403b,'utf-8'),_0x50c265=generateDiff(_0x2a2736,_0x59c545),_0x2737bd=hasChanges(_0x50c265);return{'relativePath':_0x352516,'absolutePath':_0x22403b,'content':_0x59c545,'isNew':![],'hasChanges':_0x2737bd,'diff':_0x2737bd?formatDiffWithColors(_0x50c265):undefined};}return{'relativePath':_0x352516,'absolutePath':_0x22403b,'content':_0x59c545,'isNew':!![],'hasChanges':![]};}
1
+ const a35_0x1f1380=a35_0x4de8;(function(_0x2ac9ed,_0x42904f){const _0x3efded=a35_0x4de8,_0x20af0b=_0x2ac9ed();while(!![]){try{const _0x129ab8=parseInt(_0x3efded(0x14c))/0x1*(parseInt(_0x3efded(0x141))/0x2)+-parseInt(_0x3efded(0x142))/0x3+-parseInt(_0x3efded(0x11e))/0x4*(parseInt(_0x3efded(0x125))/0x5)+-parseInt(_0x3efded(0x149))/0x6*(-parseInt(_0x3efded(0xef))/0x7)+-parseInt(_0x3efded(0x123))/0x8+-parseInt(_0x3efded(0xda))/0x9*(parseInt(_0x3efded(0x13b))/0xa)+parseInt(_0x3efded(0xd6))/0xb;if(_0x129ab8===_0x42904f)break;else _0x20af0b['push'](_0x20af0b['shift']());}catch(_0x4a6261){_0x20af0b['push'](_0x20af0b['shift']());}}}(a35_0x17ee,0x67d0e));function a35_0x4de8(_0x281870,_0x5982af){_0x281870=_0x281870-0xd6;const _0x17eebb=a35_0x17ee();let _0x4de8ab=_0x17eebb[_0x281870];return _0x4de8ab;}import{BaseCommand}from'./command.js';import{withSpinner,withQuerySpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,createTdxConfigContent,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{saveSessionContext}from'../core/session.js';import{segmentWithActivationsToYaml,segmentToYamlString,apiRuleToYaml,journeyActivationStepToYaml}from'../sdk/segment/child-segment-yaml.js';import{apiToYamlAsync,toYamlString as a35_0x203f48}from'../sdk/segment/journey-yaml.js';import a35_0x4d614c from'chalk';import{existsSync,mkdirSync,readFileSync,writeFileSync,statSync}from'fs';import a35_0x4fcda9 from'path';import{sanitizeFileName}from'../utils/string-utils.js';function a35_0x17ee(){const _0xaf0c77=['relative','1qEGrqN','rule','11156728EPmbBW','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','listSegments','segment','666cvpWxG','diff','segmentFolderId','listFolders','✔\x20Context\x20set:\x20','dirname','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','listJourneysFromParentSegment','isNew','getParent','has','user','\x20=\x20','site','setExtra','Resolving\x20parent\x20segment\x20\x27','activationParams','Using\x20parent\x20segment:\x20','folderId','absolutePath','repeat','14qnTYRB','name','isDirectory','description','\x20activations','getActivation','all','\x0aChanges\x20to\x20\x27','length','journeyBundleName','\x0aPull\x20summary\x20for\x20\x27','parentFolderId','from','yes','tdx.json','getJourney','buildIdToEmailMap','size','utf-8','data','\x20\x20Target:\x20','kind','session','activation_','message','add','journey','cyan','\x20with\x20','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','\x20unchanged\x20files','\x20\x20🗺️\x20\x20','Fetching\x20users\x20for\x20email\x20resolution...','\x20segments','connection','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','setPhase','error','journeyBundleId','dim','filter','slice','✔\x20Pulled\x20','execute','parent_segment','\x20new\x20files','parentSegment','16GzDoqj','\x20versions)','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','set','resolveParentId','4735328aTIHba','buildIdToNameMap','660745caWfNb','yellow','Fetching\x20parent\x20segment\x20info...','content','Parent\x20segment:\x20','attributes','relativePath','hasChanges','values','\x20changed\x20files','Fetching\x20segments...','Fetching\x20journeys...','audienceId','Fetching\x20folders...','green','get','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','\x20journeys','dryRun','\x20\x20🎯\x20','listActivations','.yml','1250mTqkIV','Write\x20','then','verbose','join','\x20files?','1485788DnxUpp','1144500pmwzzV','versionNumber','push','\x20files\x20to\x20','segment:pull','Fetching\x20connections\x20for\x20name\x20resolution...','Warning:\x20Could\x20not\x20resolve\x20segment\x20','538050xelpVN','Site:\x20'];a35_0x17ee=function(){return _0xaf0c77;};return a35_0x17ee();}import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyYaml,createJumpTargetCache,resolveJumpTarget}from'../utils/journey-utils.js';export class SegmentPullCommand extends BaseCommand{[a35_0x1f1380(0xf0)]=a35_0x1f1380(0x146);[a35_0x1f1380(0xf2)]='Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files';async[a35_0x1f1380(0x11a)](_0x1e07b7){const _0xfd4fe8=a35_0x1f1380,{options:_0x3bea28,args:_0x35af5f,tdx:_0x58ca61}=_0x1e07b7,_0x41a285=_0x3bea28,_0x447fbd=_0x3bea28[_0xfd4fe8(0x11d)],_0x48d689=_0x35af5f[0x0],_0x5285be=findTdxConfigPath();let _0x1e7bcc,_0x3af50b;if(!_0x48d689&&_0x5285be){const _0x45558c=loadTdxConfig(_0x5285be);_0x1e7bcc=_0x45558c[_0xfd4fe8(0x11b)],_0x3af50b=a35_0x4fcda9[_0xfd4fe8(0xdf)](_0x5285be),_0x41a285['verbose']&&(console['error']('Found\x20existing\x20tdx.json\x20at:\x20'+_0x5285be),console['error'](_0xfd4fe8(0xeb)+_0x1e7bcc));}else{if(_0x48d689){if(existsSync(_0x48d689)&&statSync(_0x48d689)[_0xfd4fe8(0xf1)]()){const _0x1bba3a=findTdxConfigPath(_0x48d689);if(_0x1bba3a){const _0x130b82=loadTdxConfig(_0x1bba3a);_0x1e7bcc=_0x130b82[_0xfd4fe8(0x11b)],_0x3af50b=a35_0x4fcda9['dirname'](_0x1bba3a),_0x41a285[_0xfd4fe8(0x13e)]&&(console[_0xfd4fe8(0x114)]('Found\x20tdx.json\x20at:\x20'+_0x1bba3a),console[_0xfd4fe8(0x114)](_0xfd4fe8(0xeb)+_0x1e7bcc));}else return console[_0xfd4fe8(0x114)](a35_0x4d614c['red'](_0xfd4fe8(0xd7)+_0x48d689+'\x0a')),console[_0xfd4fe8(0x114)](a35_0x4d614c['cyan'](_0xfd4fe8(0xe0))),0x1;}else _0x1e7bcc=_0x48d689;}else _0x1e7bcc=_0x447fbd;}if(!_0x1e7bcc)return console[_0xfd4fe8(0x114)](a35_0x4d614c[_0xfd4fe8(0x126)](_0xfd4fe8(0x120))),console[_0xfd4fe8(0x114)]('Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)'),console[_0xfd4fe8(0x114)](_0xfd4fe8(0x112)),console['error'](_0xfd4fe8(0x135)),0x1;_0x41a285['verbose']&&(console['error'](_0xfd4fe8(0x14a)+_0x41a285[_0xfd4fe8(0xe7)]),console[_0xfd4fe8(0x114)](_0xfd4fe8(0x129)+_0x1e7bcc));const _0x1f835c=await withSpinner(_0xfd4fe8(0xe9)+_0x1e7bcc+'\x27...',()=>_0x58ca61['segment'][_0xfd4fe8(0x122)](_0x1e7bcc),{'verbose':_0x41a285[_0xfd4fe8(0x13e)]}),_0x493406=_0x1f835c['data'],_0x222bc9=await withSpinner(_0xfd4fe8(0x127),()=>_0x58ca61[_0xfd4fe8(0xd9)][_0xfd4fe8(0xe3)](_0x493406),{'verbose':_0x41a285['verbose']}),_0x38aec=_0x222bc9['data'][_0xfd4fe8(0x12a)]['name'];_0x41a285[_0xfd4fe8(0x13e)]&&console['error']('Resolved\x20parent\x20name:\x20'+_0x38aec);const [_0x412bb4,_0x370934,_0x2cccfc]=await Promise[_0xfd4fe8(0xf5)]([withSpinner(_0xfd4fe8(0x12f),()=>_0x58ca61[_0xfd4fe8(0xd9)][_0xfd4fe8(0xd8)](_0x493406),{'verbose':_0x41a285['verbose']}),withSpinner(_0xfd4fe8(0x132),()=>_0x58ca61[_0xfd4fe8(0xd9)][_0xfd4fe8(0xdd)](_0x493406),{'verbose':_0x41a285[_0xfd4fe8(0x13e)]}),withSpinner(_0xfd4fe8(0x130),()=>_0x58ca61[_0xfd4fe8(0x109)][_0xfd4fe8(0xe1)](_0x493406),{'verbose':_0x41a285[_0xfd4fe8(0x13e)]})]),_0x5d0bc5=_0x412bb4[_0xfd4fe8(0x102)],_0x5f4868=_0x370934[_0xfd4fe8(0x102)],_0x4b1439=_0x2cccfc[_0xfd4fe8(0x102)];if(_0x5d0bc5['length']===0x0&&_0x4b1439[_0xfd4fe8(0xf7)]===0x0)return console[_0xfd4fe8(0x114)](a35_0x4d614c[_0xfd4fe8(0x126)](_0xfd4fe8(0x10c)+_0x38aec+'\x27')),0x0;const _0x253909=buildFolderPathMap(_0x5f4868),_0x193eba=_0x3af50b||getSegmentRootDir(sanitizeFileName(_0x1e7bcc)),_0x1329cf=new Map();await withSpinner('Fetching\x20activations...',async()=>{await batchAsync(_0x5d0bc5,async _0x2c18de=>{const _0x1f202f=a35_0x4de8,_0x5d760e=await _0x58ca61[_0x1f202f(0xd9)][_0x1f202f(0x139)](_0x493406,_0x2c18de['id']);_0x1329cf['set'](_0x2c18de['id'],_0x5d760e);});},{'verbose':_0x41a285[_0xfd4fe8(0x13e)]});const _0xb83e52=await withSpinner(_0xfd4fe8(0x10f),()=>_0x58ca61[_0xfd4fe8(0xe5)][_0xfd4fe8(0xff)](),{'verbose':_0x41a285[_0xfd4fe8(0x13e)]})['then'](_0x56b9b4=>_0x56b9b4[_0xfd4fe8(0x102)]),_0x179bef=await withSpinner(_0xfd4fe8(0x147),()=>_0x58ca61[_0xfd4fe8(0x111)][_0xfd4fe8(0x124)](),{'verbose':_0x41a285[_0xfd4fe8(0x13e)]})[_0xfd4fe8(0x13d)](_0x2ccbb9=>_0x2ccbb9['data']),_0x4511b0=[],_0x8bb785=a35_0x4fcda9['join'](_0x193eba,_0xfd4fe8(0xfd)),_0x38345a=createTdxConfigContent(_0x38aec);_0x4511b0[_0xfd4fe8(0x144)](prepareFile(_0x8bb785,_0x38345a,_0x193eba));const _0x2dc352=new Map();for(const _0x2f22bd of _0x5d0bc5){if(_0x2f22bd[_0xfd4fe8(0x104)]===SEGMENT_KIND_JOURNEY)continue;const _0x296bfc=_0x2f22bd[_0xfd4fe8(0xdc)]?_0x253909[_0xfd4fe8(0x134)](_0x2f22bd[_0xfd4fe8(0xdc)])||'':'',_0x44bb38=_0x1329cf[_0xfd4fe8(0x134)](_0x2f22bd['id'])||[],_0x18c495=segmentWithActivationsToYaml(_0x2f22bd,_0x44bb38,undefined,_0xb83e52,_0x179bef),_0x2fc644=_0x296bfc?a35_0x4fcda9[_0xfd4fe8(0x13f)](_0x193eba,_0x296bfc):_0x193eba,_0x2b7bd1=sanitizeFileName(_0x2f22bd['name']),_0x15da04=getUniqueFileName(_0x2fc644,_0x2b7bd1,_0x2dc352),_0x3fc484=a35_0x4fcda9['join'](_0x2fc644,_0x15da04+_0xfd4fe8(0x13a)),_0x149ba5=segmentToYamlString(_0x18c495);_0x4511b0[_0xfd4fe8(0x144)](prepareFile(_0x3fc484,_0x149ba5,_0x193eba));}const _0x5cc5a4=new Map();for(const _0x20e031 of _0x5d0bc5){_0x5cc5a4[_0xfd4fe8(0x121)](_0x20e031['id'],_0x20e031);}const _0x4d4b1a=new Map();for(const _0x45300f of _0x4b1439){const _0x2b8ddf=_0x45300f[_0xfd4fe8(0x115)];!_0x4d4b1a['has'](_0x2b8ddf)&&_0x4d4b1a[_0xfd4fe8(0x121)](_0x2b8ddf,[]),_0x4d4b1a[_0xfd4fe8(0x134)](_0x2b8ddf)[_0xfd4fe8(0x144)](_0x45300f);}for(const _0x3e37d1 of _0x4d4b1a[_0xfd4fe8(0x12d)]()){_0x3e37d1['sort']((_0x2d292f,_0x257481)=>(_0x2d292f[_0xfd4fe8(0x143)]||0x0)-(_0x257481[_0xfd4fe8(0x143)]||0x0));}const _0x1681e6=()=>{const _0x3e95c7=_0xfd4fe8,_0x410cf6=new Set(),_0x55ac46=new Set(),_0x2f3053=new Map(),_0x424342=new Map(),_0x253a27=createJumpTargetCache(),_0x516033=(_0x34c8ce,_0x54734a)=>({'resolveSegment':async _0x1f836d=>{const _0xa5afda=a35_0x4de8,_0x11c579=_0x2f3053[_0xa5afda(0x134)](_0x1f836d);if(_0x11c579!==undefined)return{'name':_0x11c579,'isJourneyLocal':!![]};if(!_0x54734a)return{'name':_0x1f836d,'isJourneyLocal':![]};try{let _0x3d6009=_0x5cc5a4[_0xa5afda(0x134)](_0x1f836d);!_0x3d6009&&(_0x3d6009=await _0x58ca61[_0xa5afda(0xd9)]['getSegment'](_0x54734a,_0x1f836d));const _0x247747=generateJourneyLocalName(_0x3d6009[_0xa5afda(0xf0)]),_0x458d20=_0x3d6009[_0xa5afda(0x104)]===SEGMENT_KIND_JOURNEY&&_0x247747!==undefined;let _0x242bb7=_0x3d6009['name'];if(_0x458d20&&_0x247747){let _0x104941=_0x247747,_0x384317=0x2;while(_0x410cf6[_0xa5afda(0xe4)](_0x104941)){_0x104941=_0x247747+'_'+_0x384317,_0x384317++;}_0x410cf6[_0xa5afda(0x108)](_0x104941),_0x242bb7=_0x104941,_0x2f3053[_0xa5afda(0x121)](_0x1f836d,_0x242bb7);}let _0x1cbb39;return _0x458d20&&_0x3d6009[_0xa5afda(0x14d)]&&(_0x1cbb39={'description':_0x3d6009[_0xa5afda(0xf2)],'rule':apiRuleToYaml(_0x3d6009['rule'])}),{'name':_0x242bb7,'isJourneyLocal':_0x458d20,'definition':_0x1cbb39};}catch(_0x556c1c){return _0x41a285[_0xa5afda(0x13e)]&&console['error'](_0xa5afda(0x148)+_0x1f836d+':\x20'+_0x556c1c[_0xa5afda(0x107)]),{'name':_0x1f836d,'isJourneyLocal':![]};}},'resolveActivation':async _0x9c93ca=>{const _0x4e4e4d=a35_0x4de8,_0x401b6a=_0x424342[_0x4e4e4d(0x134)](_0x9c93ca);if(_0x401b6a!==undefined)return{'name':_0x401b6a,'isJourneyLocal':!![]};try{const _0x3b843a=await _0x58ca61[_0x4e4e4d(0x109)][_0x4e4e4d(0xf4)](_0x34c8ce,_0x9c93ca),_0x314fe6=_0x3b843a['attributes'][_0x4e4e4d(0xea)][_0x4e4e4d(0xf0)]||_0x9c93ca,_0x1e3326=sanitizeYamlKey(_0x314fe6)||_0x4e4e4d(0x106)+_0x9c93ca;let _0x36f057=_0x1e3326,_0x1eac58=0x2;while(_0x55ac46[_0x4e4e4d(0xe4)](_0x36f057)){_0x36f057=_0x1e3326+'_'+_0x1eac58,_0x1eac58++;}_0x55ac46[_0x4e4e4d(0x108)](_0x36f057),_0x424342[_0x4e4e4d(0x121)](_0x9c93ca,_0x36f057);const _0x385250=journeyActivationStepToYaml(_0x3b843a,_0xb83e52,_0x179bef);return{'name':_0x36f057,'isJourneyLocal':!![],'definition':_0x385250};}catch(_0xfdcc35){return _0x41a285[_0x4e4e4d(0x13e)]&&console['error']('Warning:\x20Could\x20not\x20resolve\x20activation\x20'+_0x9c93ca+':\x20'+_0xfdcc35['message']),{'name':_0x9c93ca,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x4f5b99,_0x376a39)=>resolveJumpTarget(_0x4f5b99,_0x376a39,_0x253a27,_0xaa4ac3=>_0x58ca61[_0x3e95c7(0x109)]['getJourney'](_0xaa4ac3))});return{'createYamlContext':_0x516033};};if(_0x4d4b1a[_0xfd4fe8(0x100)]>0x0){const _0x265564=Array['from'](_0x4d4b1a[_0xfd4fe8(0x12d)]()),_0x4de80e=await withQuerySpinner('Processing\x20journeys...',async _0x5ea33a=>{const _0x450c3a=_0xfd4fe8,_0x2cd414=[];let _0x4c05bd=0x0;const _0x5b43b8=0x5;for(let _0x368ac2=0x0;_0x368ac2<_0x265564['length'];_0x368ac2+=_0x5b43b8){const _0xc0cb9c=_0x265564[_0x450c3a(0x118)](_0x368ac2,_0x368ac2+_0x5b43b8),_0x311c56=await Promise['all'](_0xc0cb9c['map'](async _0x35fe3a=>{const _0x275738=_0x450c3a,_0x130991=_0x35fe3a[0x0],_0x2ea952=_0x130991[_0x275738(0xf8)];_0x5ea33a[_0x275738(0x113)]('Fetching\x20journey\x20\x27'+_0x2ea952+'\x27');const _0xc9f7cf=_0x130991[_0x275738(0xec)]?_0x253909[_0x275738(0x134)](_0x130991[_0x275738(0xec)])||'':'',{createYamlContext:_0x3c4da9}=_0x1681e6(),_0x9d4b0=[];for(const _0x2bed9f of _0x35fe3a){const _0x252d42=await _0x58ca61[_0x275738(0x109)][_0x275738(0xfe)](_0x2bed9f['id']),_0x57fcca=_0x252d42[_0x275738(0x12a)]?.[_0x275738(0x131)],_0x1dbd9f=_0x3c4da9(_0x2bed9f['id'],_0x57fcca),_0x2f51c6=await apiToYamlAsync(_0x252d42,_0x1dbd9f);_0x9d4b0[_0x275738(0x144)]({'item':_0x2bed9f,'yaml':_0x2f51c6});}let _0x28b557;return _0x9d4b0[_0x275738(0xf7)]===0x1?_0x28b557=_0x9d4b0[0x0]['yaml']:_0x28b557=buildMergedJourneyYaml(_0x9d4b0),{'bundleName':_0x2ea952,'folderPath':_0xc9f7cf,'finalYaml':_0x28b557};}));_0x2cd414[_0x450c3a(0x144)](..._0x311c56),_0x4c05bd+=_0xc0cb9c[_0x450c3a(0xf7)],_0x5ea33a[_0x450c3a(0xe8)]('('+_0x4c05bd+'/'+_0x265564[_0x450c3a(0xf7)]+')');}return _0x2cd414;},{'verbose':_0x41a285['verbose']});for(const {bundleName:_0x5ed2e5,folderPath:_0x214002,finalYaml:_0xc115b}of _0x4de80e[_0xfd4fe8(0x102)]){const _0x1ee18f=a35_0x203f48(_0xc115b),_0x3109e5=_0x214002?a35_0x4fcda9[_0xfd4fe8(0x13f)](_0x193eba,_0x214002):_0x193eba,_0x123f5e=sanitizeFileName(_0x5ed2e5),_0x10ca31=getUniqueFileName(_0x3109e5,_0x123f5e,_0x2dc352),_0x3e7308=a35_0x4fcda9[_0xfd4fe8(0x13f)](_0x3109e5,_0x10ca31+_0xfd4fe8(0x13a));_0x4511b0['push'](prepareFile(_0x3e7308,_0x1ee18f,_0x193eba));}}const _0x3f993e=Array[_0xfd4fe8(0xfb)](_0x1329cf[_0xfd4fe8(0x12d)]())['reduce']((_0x184db8,_0x29129b)=>_0x184db8+_0x29129b[_0xfd4fe8(0xf7)],0x0),_0x44eb2b=_0x4511b0[_0xfd4fe8(0x117)](_0xf616c8=>_0xf616c8[_0xfd4fe8(0xe2)]),_0x3c7000=_0x4511b0[_0xfd4fe8(0x117)](_0x307a76=>!_0x307a76[_0xfd4fe8(0xe2)]&&_0x307a76[_0xfd4fe8(0x12c)]),_0x5f1704=_0x4511b0[_0xfd4fe8(0x117)](_0x100b94=>!_0x100b94[_0xfd4fe8(0xe2)]&&!_0x100b94[_0xfd4fe8(0x12c)]),_0x374460=_0x5d0bc5[_0xfd4fe8(0x117)](_0x467c8a=>_0x467c8a['kind']!==SEGMENT_KIND_JOURNEY);console[_0xfd4fe8(0x114)](_0xfd4fe8(0xf9)+_0x38aec+'\x27:'),console[_0xfd4fe8(0x114)](_0xfd4fe8(0x138)+a35_0x4d614c[_0xfd4fe8(0x10a)](_0x374460[_0xfd4fe8(0xf7)]+_0xfd4fe8(0x110))+_0xfd4fe8(0x10b)+a35_0x4d614c[_0xfd4fe8(0x10a)](_0x3f993e+_0xfd4fe8(0xf3)));if(_0x4d4b1a['size']>0x0){const _0x3cba5d=_0x4b1439[_0xfd4fe8(0xf7)],_0x58ac45=_0x4d4b1a[_0xfd4fe8(0x100)],_0x3255c8=_0x3cba5d>_0x58ac45?'\x20('+_0x3cba5d+_0xfd4fe8(0x11f):'';console['error'](_0xfd4fe8(0x10e)+a35_0x4d614c[_0xfd4fe8(0x10a)](_0x58ac45+_0xfd4fe8(0x136))+a35_0x4d614c[_0xfd4fe8(0x116)](_0x3255c8));}console[_0xfd4fe8(0x114)]('\x20\x20'+a35_0x4d614c[_0xfd4fe8(0x133)]('+\x20'+_0x44eb2b[_0xfd4fe8(0xf7)]+_0xfd4fe8(0x11c))),console[_0xfd4fe8(0x114)]('\x20\x20'+a35_0x4d614c[_0xfd4fe8(0x126)]('~\x20'+_0x3c7000[_0xfd4fe8(0xf7)]+_0xfd4fe8(0x12e))),console[_0xfd4fe8(0x114)]('\x20\x20'+a35_0x4d614c[_0xfd4fe8(0x116)]('=\x20'+_0x5f1704[_0xfd4fe8(0xf7)]+_0xfd4fe8(0x10d))),console[_0xfd4fe8(0x114)](_0xfd4fe8(0x103)+a35_0x4d614c[_0xfd4fe8(0x10a)](_0x193eba)+'\x0a');if(_0x3c7000[_0xfd4fe8(0xf7)]>0x0)for(const _0x502622 of _0x3c7000){console['error'](_0xfd4fe8(0xf6)+_0x502622[_0xfd4fe8(0x12b)]+'\x27:'),console[_0xfd4fe8(0x114)]('─'[_0xfd4fe8(0xee)](0x3c)),console['error'](_0x502622[_0xfd4fe8(0xdb)]),console[_0xfd4fe8(0x114)]('─'[_0xfd4fe8(0xee)](0x3c));}if(_0x41a285[_0xfd4fe8(0x137)])return console[_0xfd4fe8(0x114)](a35_0x4d614c[_0xfd4fe8(0x126)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x44eb2b[_0xfd4fe8(0xf7)]===0x0&&_0x3c7000[_0xfd4fe8(0xf7)]===0x0)return console['error'](a35_0x4d614c[_0xfd4fe8(0x133)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x38aec},_0x41a285[_0xfd4fe8(0x105)]),console[_0xfd4fe8(0x114)](a35_0x4d614c[_0xfd4fe8(0x133)](_0xfd4fe8(0xde)+a35_0x4d614c[_0xfd4fe8(0x116)](_0xfd4fe8(0x11b))+_0xfd4fe8(0xe6)+a35_0x4d614c[_0xfd4fe8(0x10a)](_0x38aec))),0x0;if(!_0x41a285[_0xfd4fe8(0xfc)]&&(_0x44eb2b['length']>0x0||_0x3c7000[_0xfd4fe8(0xf7)]>0x0)){const _0x150461=await confirmKey(_0xfd4fe8(0x13c)+(_0x44eb2b[_0xfd4fe8(0xf7)]+_0x3c7000['length'])+_0xfd4fe8(0x140));if(!_0x150461)return console[_0xfd4fe8(0x114)]('Aborted.'),0x1;}for(const _0x2caf9d of _0x4511b0){if(_0x2caf9d[_0xfd4fe8(0xe2)]||_0x2caf9d[_0xfd4fe8(0x12c)]){const _0x487483=a35_0x4fcda9[_0xfd4fe8(0xdf)](_0x2caf9d[_0xfd4fe8(0xed)]);!existsSync(_0x487483)&&mkdirSync(_0x487483,{'recursive':!![]}),writeFileSync(_0x2caf9d['absolutePath'],_0x2caf9d[_0xfd4fe8(0x128)],_0xfd4fe8(0x101));}}return console[_0xfd4fe8(0x114)](a35_0x4d614c[_0xfd4fe8(0x133)](_0xfd4fe8(0x119)+(_0x44eb2b[_0xfd4fe8(0xf7)]+_0x3c7000[_0xfd4fe8(0xf7)])+_0xfd4fe8(0x145)+_0x193eba)),saveSessionContext({'parent_segment':_0x38aec},_0x41a285[_0xfd4fe8(0x105)]),console[_0xfd4fe8(0x114)](a35_0x4d614c[_0xfd4fe8(0x133)](_0xfd4fe8(0xde)+a35_0x4d614c[_0xfd4fe8(0x116)]('parent_segment')+_0xfd4fe8(0xe6)+a35_0x4d614c[_0xfd4fe8(0x10a)](_0x38aec))),0x0;}}function buildFolderPathMap(_0x1d3ceb){const _0xe9f79d=a35_0x1f1380,_0x459743=new Map(),_0x4a102a=new Map();for(const _0x291b7b of _0x1d3ceb){_0x4a102a['set'](_0x291b7b['id'],_0x291b7b);}const _0x498712=new Set();for(const _0x81c741 of _0x1d3ceb){!_0x81c741[_0xe9f79d(0xfa)]&&_0x498712['add'](_0x81c741['id']);}function _0x1a93d7(_0x1146b0){const _0xf2b86a=_0xe9f79d;if(_0x459743[_0xf2b86a(0xe4)](_0x1146b0['id']))return _0x459743[_0xf2b86a(0x134)](_0x1146b0['id']);if(_0x498712[_0xf2b86a(0xe4)](_0x1146b0['id']))return _0x459743[_0xf2b86a(0x121)](_0x1146b0['id'],''),'';if(_0x1146b0[_0xf2b86a(0xfa)]){const _0xf78ddd=_0x4a102a[_0xf2b86a(0x134)](_0x1146b0['parentFolderId']);if(_0xf78ddd){const _0x5aac4e=_0x1a93d7(_0xf78ddd),_0x581d6e=_0x5aac4e?_0x5aac4e+'/'+_0x1146b0[_0xf2b86a(0xf0)]:_0x1146b0[_0xf2b86a(0xf0)];return _0x459743[_0xf2b86a(0x121)](_0x1146b0['id'],_0x581d6e),_0x581d6e;}}const _0x415c95=_0x1146b0['name'];return _0x459743[_0xf2b86a(0x121)](_0x1146b0['id'],_0x415c95),_0x415c95;}for(const _0x33a194 of _0x1d3ceb){_0x1a93d7(_0x33a194);}return _0x459743;}function getUniqueFileName(_0x4c5608,_0x31669c,_0x2ade6e){const _0x54778e=a35_0x1f1380,_0xbfc769=_0x4c5608+':'+_0x31669c,_0x4e68dd=_0x2ade6e['get'](_0xbfc769)||0x0;_0x2ade6e[_0x54778e(0x121)](_0xbfc769,_0x4e68dd+0x1);if(_0x4e68dd===0x0)return _0x31669c;return _0x31669c+'-'+_0x4e68dd;}function prepareFile(_0x5d9d4f,_0x4138ea,_0x246a64){const _0x368994=a35_0x1f1380,_0x6f6d29=a35_0x4fcda9[_0x368994(0x14b)](_0x246a64,_0x5d9d4f);if(existsSync(_0x5d9d4f)){const _0x16f4e5=readFileSync(_0x5d9d4f,_0x368994(0x101)),_0x10de48=generateDiff(_0x16f4e5,_0x4138ea),_0x494c3b=hasChanges(_0x10de48);return{'relativePath':_0x6f6d29,'absolutePath':_0x5d9d4f,'content':_0x4138ea,'isNew':![],'hasChanges':_0x494c3b,'diff':_0x494c3b?formatDiffWithColors(_0x10de48):undefined};}return{'relativePath':_0x6f6d29,'absolutePath':_0x5d9d4f,'content':_0x4138ea,'isNew':!![],'hasChanges':![]};}
@@ -1 +1 @@
1
- const a36_0x59c5e1=a36_0x2d4a;(function(_0x485bd3,_0x6afa23){const _0x54ad50=a36_0x2d4a,_0x3748e3=_0x485bd3();while(!![]){try{const _0x3dea59=-parseInt(_0x54ad50(0x1f7))/0x1*(parseInt(_0x54ad50(0x1ff))/0x2)+parseInt(_0x54ad50(0x200))/0x3+-parseInt(_0x54ad50(0x1dd))/0x4*(-parseInt(_0x54ad50(0x174))/0x5)+parseInt(_0x54ad50(0x178))/0x6*(parseInt(_0x54ad50(0x221))/0x7)+parseInt(_0x54ad50(0x25c))/0x8*(parseInt(_0x54ad50(0x206))/0x9)+parseInt(_0x54ad50(0x1cc))/0xa*(parseInt(_0x54ad50(0x1ee))/0xb)+-parseInt(_0x54ad50(0x1fa))/0xc*(parseInt(_0x54ad50(0x186))/0xd);if(_0x3dea59===_0x6afa23)break;else _0x3748e3['push'](_0x3748e3['shift']());}catch(_0x2edb0a){_0x3748e3['push'](_0x3748e3['shift']());}}}(a36_0x3691,0xa97b2));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode,isHttp400Error,getErrorMessage}from'../sdk/errors.js';import{withSpinner,withQuerySpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,findTdxConfig}from'../utils/tdx-config.js';import{segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,yamlToCreateRequest,yamlToUpdateRequest,yamlActivationToCreateRequest,yamlActivationToUpdateRequest,journeyActivationStepToYaml,activationToYaml,apiRuleToYaml,yamlRuleToApi}from'../sdk/segment/child-segment-yaml.js';import{isJourneyYaml,parseYamlString as a36_0x2e896f,yamlToApi as a36_0x18f4eb,toYamlString as a36_0x2783fc,apiToYamlAsync,hasMultipleVersions,normalizeJourneyYaml}from'../sdk/segment/journey-yaml.js';import a36_0x54932d from'chalk';import{existsSync,readFileSync,statSync,readdirSync}from'fs';import a36_0x475838 from'path';import{getConsoleNextUrl}from'../types/endpoints.js';function a36_0x2d4a(_0x33ab24,_0x201696){_0x33ab24=_0x33ab24-0x169;const _0x3691bc=a36_0x3691();let _0x2d4a1f=_0x3691bc[_0x33ab24];return _0x2d4a1f;}import*as a36_0x147f4c from'yaml';import{sanitizeFileName}from'../utils/string-utils.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyYaml,createJumpTargetCache,resolveJumpTarget}from'../utils/journey-utils.js';const PENDING_SEGMENT_PREFIX='__pending_';function createPendingSegmentId(_0x5e5212){return''+PENDING_SEGMENT_PREFIX+_0x5e5212+'__';}function isPendingSegmentId(_0x30872e){return _0x30872e['startsWith'](PENDING_SEGMENT_PREFIX);}function extractPendingSegmentName(_0x3d8be3){return _0x3d8be3['replace'](/^__pending_(.+)__$/,'$1');}const PENDING_ACTIVATION_PREFIX=a36_0x59c5e1(0x257);function createPendingActivationId(_0x59c9b7){return''+PENDING_ACTIVATION_PREFIX+_0x59c9b7+'__';}function isPendingActivationId(_0x6b4358){const _0x530571=a36_0x59c5e1;return _0x6b4358[_0x530571(0x19c)](PENDING_ACTIVATION_PREFIX);}function extractPendingActivationName(_0x19ee40){const _0x1257d3=a36_0x59c5e1;return _0x19ee40[_0x1257d3(0x1d6)](/^__pending_act_(.+)__$/,'$1');}function ensureJourneyDefaults(_0x3b2f15){const _0x53017e=a36_0x59c5e1;!_0x3b2f15['description']&&(_0x3b2f15['description']=''),!_0x3b2f15[_0x53017e(0x1aa)]&&(_0x3b2f15[_0x53017e(0x1aa)]=_0x53017e(0x198));}function tryFindTdxConfig(_0x506458){try{return findTdxConfig(_0x506458);}catch{return null;}}function resolveTDFolderPath(_0x53f5ca,_0x597af2,_0x35abfc){if(!_0x597af2)return _0x53f5ca;return _0x53f5ca?_0x35abfc+'/'+_0x53f5ca:_0x35abfc;}function a36_0x3691(){const _0x3918b4=['toLowerCase','parse','8198508RCKOZn','name','\x20changed','existingSegment','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','dirname','parent_segment','folderPath','Creating\x20folder\x20\x27','Deleting\x20segment\x20\x27','\x20journey\x20from\x20file:\x20','Updating','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','Updating\x20activation\x20\x27','12116130yIajdy','Changes\x20to:','getJourney','get','buildUserMaps','Error\x20parsing\x20','resolve','\x20activation\x20\x27','Failed\x20to\x20','values','then','Parent\x20segment:\x20','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','entries','attributes','\x20created','\x20to\x20delete','all','draft','entry_criteria','deleteSegment','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','startsWith','connection','\x20\x20Step\x203:\x20Updating\x20journey\x20with\x20entry\x20criteria\x20and\x20activation\x20IDs:\x20','config','Activation','repeat','push','New\x20segment:','absolutePath','SEGMENT_UPDATE_ERROR','delete','\x20\x20Step\x202b:\x20Creating\x20embedded\x20activation\x20\x27','isFile','✔\x20Created\x20segment\x20\x27','state','\x27\x20details...','INTERNAL','listActivations','yamlActivation','join','map','versionNumber','\x20\x20✔\x20Updated\x20activation\x20\x27','(Journey\x20will\x20be\x20deleted)','length','\x20deleted','cwd','steps','\x20\x20Created\x20embedded\x20segment\x20\x27','relative','Segment\x20not\x20found:\x20','data','yes','/e/','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','existingJourney','site','\x27...','\x20\x20Activations:','ACTIVATION_SYNTAX_ERROR','blue','\x27:\x20','green','item','folderId','.yml','/j/da/je','\x20\x20Step\x201:\x20Creating\x20journey\x20without\x20entry\x20criteria:\x20','180lhVFjD','yellow','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','\x20new','Fetching\x20parent\x20segment\x20details...','configDir','diff','JOURNEY_SYNTAX_ERROR','setPhase','cyan','replace',')\x20with\x20ID:\x20','sort','Activation\x20not\x20found:\x20','\x20activations]',')\x20with\x20journeyId:\x20','Scoped\x20to\x20folder:\x20','4kIABuP','relationships','\x0aPush\x20summary\x20for\x20\x27','updated','journey','Folders\x20to\x20create:','SEGMENT_NOT_FOUND','\x20\x20Step\x202:\x20Creating\x20embedded\x20segment\x20\x27','activationActions','\x20\x20Journey\x20API\x20request:\x20','segment','Failed\x20to\x20create\x20embedded\x20activation\x20\x27','listSegments','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','Failed\x20to\x20create\x20embedded\x20segment\x20\x27','Creating\x20segment\x20\x27','Stage\x20\x27','609323qLSNAN','\x20unchanged','\x20\x20🗺️\x20\x20Journeys:','updateSegmentById','activations','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','DecisionPoint','✔\x20Deleted\x20segment\x20\x27','action','462594lPQzKp','parentSegment','verbose','48nhDMpd','slice','.yaml','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','\x27\x20v','4aiNxrC','1796772kJArmT','...','yamlConfig','existingActivation','entryCriteria','journeyBundleName','12159387ZvrihF','\x20journey\x20\x27','buildIdToNameMap','New\x20journey:','created','createJourneySegment','rule','Pushing\x20journeys...','isNew','journeysOnly','toString','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','Fetching\x20existing\x20folders...','\x20segment\x20from\x20file:\x20','entry','createFolder','find','Push\x20','Fetching\x20existing\x20journeys...','listFolders','set','\x20\x20Segments:\x20','filter','keys','execute','has','error','7UFDNRv','\x27\x20with\x20ID:\x20','Source\x20directory:\x20','resolveJourneyId','red','create','setExtra','\x20\x20✔\x20Created\x20activation\x20\x27','\x20folders\x20to\x20create','ACTIVATION_UPDATE_ERROR','createActivation','isDirectory','Fetching\x20journey\x20\x27','Resolving\x20parent\x20segment\x20\x27','NOT_FOUND','Site:\x20','type','add','\x20\x20Created\x20embedded\x20activation\x20\x27',').\x20','parentFolderId','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','journeyStages','\x20changes?','split','Delete\x20journey:','\x20to\x20create','branches','description','parentSegmentFolder','size','✔\x20Updated\x20journey\x20\x27','folder','\x20updated','Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)','randomUUID','stringify','stages','dryRun','✔\x20Created\x20journey\x20\x27','journeyActivationStepId','update','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','SEGMENT_SYNTAX_ERROR','getActivation','\x20\x20\x20\x20','kind','journey_entry_criteria_','segmentId','📁\x20','\x0a✔\x20Push\x20complete','\x27\x20from\x20file:\x20','hasChanges','__pending_act_','Aborted.','\x27\x20not\x20found\x20in\x20journey\x20\x27','user','unchanged','8oCztjH','Entry\x20criteria:\x20','Changes\x20to\x20journey:','Fetching\x20existing\x20activations...','JOURNEY_UPDATE_ERROR','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','journeyId','\x20\x20Journeys:\x20','\x27\x20(internal:\x20','activationParams','Fetching\x20users\x20for\x20email\x20resolution...','flatMap','createSegment','dim','segmentFolderId','getParent','\x20\x20✔\x20Deleted\x20activation\x20\x27','✔\x20Created\x20folder\x20\x27','\x20YAML\x20files\x20found','5169815VllwdB','endsWith'];a36_0x3691=function(){return _0x3918b4;};return a36_0x3691();}export class SegmentPushCommand extends BaseCommand{[a36_0x59c5e1(0x179)]='segment:push';['description']=a36_0x59c5e1(0x237);async[a36_0x59c5e1(0x21e)](_0x322d10){const _0x25e0ba=a36_0x59c5e1,{options:_0x164202,args:_0x506602,tdx:_0x5793b9}=_0x322d10,_0x9a1cc5=_0x164202,_0x5092b0=_0x164202[_0x25e0ba(0x1f8)],_0x287eb2=_0x506602[0x0];let _0x1e93f0,_0x2c65d3,_0x4177a9,_0x24ed3e;if(_0x287eb2){if(existsSync(_0x287eb2)&&statSync(_0x287eb2)[_0x25e0ba(0x22c)]()){const _0x5b04e1=tryFindTdxConfig(_0x287eb2);if(_0x5b04e1)_0x1e93f0=_0x5b04e1[_0x25e0ba(0x19f)][_0x25e0ba(0x17e)],_0x2c65d3=_0x287eb2,_0x4177a9=_0x5b04e1[_0x25e0ba(0x1d1)];else return console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x225)](_0x25e0ba(0x1fd)+_0x287eb2+'\x0a')),console[_0x25e0ba(0x220)](a36_0x54932d['cyan'](_0x25e0ba(0x236))),0x1;}else{if(existsSync(_0x287eb2)&&statSync(_0x287eb2)[_0x25e0ba(0x1a8)]()){const _0x2719cd=a36_0x475838['dirname'](_0x287eb2),_0xdccf5e=tryFindTdxConfig(_0x2719cd);if(_0xdccf5e)_0x1e93f0=_0xdccf5e[_0x25e0ba(0x19f)][_0x25e0ba(0x17e)],_0x4177a9=_0xdccf5e[_0x25e0ba(0x1d1)],_0x2c65d3=_0xdccf5e[_0x25e0ba(0x1d1)],_0x24ed3e=a36_0x475838[_0x25e0ba(0x18c)](_0x287eb2);else return console['error'](a36_0x54932d['red'](_0x25e0ba(0x1fd)+_0x2719cd+'\x0a')),console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x1d5)](_0x25e0ba(0x236))),0x1;}else _0x1e93f0=_0x287eb2;}}else{const _0x48fcaa=tryFindTdxConfig(process[_0x25e0ba(0x1b6)]());_0x48fcaa?(_0x1e93f0=_0x48fcaa['config']['parent_segment'],_0x2c65d3=process['cwd'](),_0x4177a9=_0x48fcaa[_0x25e0ba(0x1d1)]):_0x1e93f0=_0x5092b0;}if(!_0x1e93f0)return console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x1cd)](_0x25e0ba(0x17c))),console[_0x25e0ba(0x220)](_0x25e0ba(0x244)),console[_0x25e0ba(0x220)](_0x25e0ba(0x1ce)),console[_0x25e0ba(0x220)](_0x25e0ba(0x184)),0x1;const _0x59c816=_0x2c65d3||getSegmentRootDir(sanitizeFileName(_0x1e93f0)),_0x4fcb86=_0x4177a9||_0x59c816,_0x1bda42=a36_0x475838['relative'](_0x4fcb86,_0x59c816),_0xab46ba=_0x1bda42!==''&&_0x1bda42!=='.';if(!existsSync(_0x59c816))return console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x225)]('Error:\x20Directory\x20not\x20found:\x20'+_0x59c816+'\x0a')),console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x1d5)](_0x25e0ba(0x236))),0x1;_0x9a1cc5['verbose']&&(console[_0x25e0ba(0x220)](_0x25e0ba(0x230)+_0x9a1cc5[_0x25e0ba(0x1c0)]),console[_0x25e0ba(0x220)](_0x25e0ba(0x191)+_0x1e93f0),console[_0x25e0ba(0x220)](_0x25e0ba(0x223)+_0x59c816),_0xab46ba&&console[_0x25e0ba(0x220)](_0x25e0ba(0x1dc)+_0x1bda42));const _0x598751=await withSpinner(_0x25e0ba(0x22e)+_0x1e93f0+_0x25e0ba(0x1c1),()=>_0x5793b9[_0x25e0ba(0x1e7)]['resolveParentId'](_0x1e93f0),{'verbose':_0x9a1cc5[_0x25e0ba(0x1f9)]}),_0x2d104e=_0x598751[_0x25e0ba(0x1bb)],[_0x2a80fa,_0x2c4945,_0x41105e,_0x282fd3,_0x1b40b1]=await Promise['all']([withSpinner(_0x25e0ba(0x1d0),()=>_0x5793b9[_0x25e0ba(0x1e7)][_0x25e0ba(0x170)](_0x2d104e),{'verbose':_0x9a1cc5[_0x25e0ba(0x1f9)]}),withSpinner('Fetching\x20existing\x20segments...',()=>_0x5793b9[_0x25e0ba(0x1e7)][_0x25e0ba(0x1e9)](_0x2d104e),{'verbose':_0x9a1cc5['verbose']}),withSpinner(_0x25e0ba(0x212),()=>_0x5793b9[_0x25e0ba(0x1e7)][_0x25e0ba(0x219)](_0x2d104e),{'verbose':_0x9a1cc5['verbose']}),withSpinner(_0x25e0ba(0x218),()=>_0x5793b9[_0x25e0ba(0x1e1)]['listJourneysFromParentSegment'](_0x2d104e),{'verbose':_0x9a1cc5['verbose']}),withSpinner(_0x25e0ba(0x16b),()=>_0x5793b9[_0x25e0ba(0x25a)][_0x25e0ba(0x18a)](),{'verbose':_0x9a1cc5[_0x25e0ba(0x1f9)]})[_0x25e0ba(0x190)](_0x171c0d=>_0x171c0d[_0x25e0ba(0x1bb)])]),_0x24c2fd=_0x2a80fa[_0x25e0ba(0x1bb)],_0x17d9ba=_0x24c2fd[_0x25e0ba(0x1de)]?.[_0x25e0ba(0x23f)]?.[_0x25e0ba(0x1bb)]?.['id']||_0x24c2fd[_0x25e0ba(0x1de)]?.['parentFolder']?.[_0x25e0ba(0x1bb)]?.['id'],_0xfee852=_0x2c4945[_0x25e0ba(0x1bb)],_0x3df1cf=_0x41105e[_0x25e0ba(0x1bb)],_0x5e662c=_0x282fd3[_0x25e0ba(0x1bb)],{emailToId:_0x1516f5,idToEmail:_0x464344}=_0x1b40b1,[_0x5b7934,_0x502bc7]=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',async()=>{const _0x16fe6a=_0x25e0ba,[_0x3267ae,_0x56938c]=await Promise[_0x16fe6a(0x197)]([_0x5793b9[_0x16fe6a(0x19d)]['buildNameToIdMap'](),_0x5793b9[_0x16fe6a(0x19d)][_0x16fe6a(0x208)]()]);return[_0x3267ae,_0x56938c];},{'verbose':_0x9a1cc5[_0x25e0ba(0x1f9)]})[_0x25e0ba(0x190)](_0x2cbe5e=>_0x2cbe5e['data']),_0x2ac595=buildFolderPathToIdMap(_0x3df1cf),_0x22d65e=new Map();for(const [_0xaad2c1,_0x121047]of _0x2ac595[_0x25e0ba(0x193)]()){_0x22d65e[_0x25e0ba(0x21a)](_0x121047,_0xaad2c1);}const _0x4e2e0d=new Map();for(const _0x583b74 of _0xfee852){const _0x451a57=_0x583b74[_0x25e0ba(0x16f)]?_0x22d65e['get'](_0x583b74[_0x25e0ba(0x16f)]['toString']())||'':'',_0x1c70b8=_0x451a57+':'+_0x583b74[_0x25e0ba(0x179)];_0x4e2e0d[_0x25e0ba(0x21a)](_0x1c70b8,_0x583b74);}const _0x10252d=new Map();for(const _0x5e0d40 of _0xfee852){_0x10252d['set'](_0x5e0d40[_0x25e0ba(0x179)],_0x5e0d40['id']);}const _0x2ae488=new Map();for(const _0x4c44e6 of _0x5e662c){const _0x398286=_0x4c44e6['folderId']?_0x22d65e[_0x25e0ba(0x189)](_0x4c44e6[_0x25e0ba(0x1c8)])||'':'',_0x11a443=_0x398286+':'+_0x4c44e6[_0x25e0ba(0x205)];!_0x2ae488[_0x25e0ba(0x21f)](_0x11a443)&&_0x2ae488[_0x25e0ba(0x21a)](_0x11a443,[]),_0x2ae488[_0x25e0ba(0x189)](_0x11a443)[_0x25e0ba(0x1a2)](_0x4c44e6);}for(const _0xc28d99 of _0x2ae488[_0x25e0ba(0x18f)]()){_0xc28d99[_0x25e0ba(0x1d8)]((_0x180c67,_0x239b01)=>(_0x180c67[_0x25e0ba(0x1b1)]||0x0)-(_0x239b01[_0x25e0ba(0x1b1)]||0x0));}let _0x4a9f97;if(_0x24ed3e){if(!_0x24ed3e[_0x25e0ba(0x175)](_0x25e0ba(0x1c9))&&!_0x24ed3e[_0x25e0ba(0x175)](_0x25e0ba(0x1fc)))return console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x225)](_0x25e0ba(0x24c)+_0x24ed3e+'\x0a')),0x1;_0x4a9f97=[_0x24ed3e];}else _0x4a9f97=findYamlFiles(_0x59c816);if(_0x4a9f97[_0x25e0ba(0x1b4)]===0x0)return console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x225)](_0x25e0ba(0x19b)+_0x59c816+'\x0a')),console['error'](a36_0x54932d[_0x25e0ba(0x1d5)]('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files')),0x1;const _0x100cfe=[],_0x135150=[];for(const _0x235229 of _0x4a9f97){const _0x20a6f9=a36_0x475838[_0x25e0ba(0x1b9)](_0x59c816,a36_0x475838[_0x25e0ba(0x17d)](_0x235229)),_0x548494=_0x20a6f9==='.'?'':_0x20a6f9,_0x3be0e3=readFileSync(_0x235229,'utf-8');try{const _0x59557c=a36_0x147f4c[_0x25e0ba(0x177)](_0x3be0e3);if(isJourneyYaml(_0x59557c)){const _0x41c08d=a36_0x2e896f(_0x3be0e3);_0x135150['push']({'yamlConfig':_0x41c08d,'folderPath':_0x548494,'sourcePath':_0x235229});}else{if(!_0x9a1cc5[_0x25e0ba(0x20f)]){const _0x5b5100=parseSegmentYamlFile(_0x3be0e3),_0x3adba9=normalizeChildSegmentYaml(_0x5b5100);_0x100cfe[_0x25e0ba(0x1a2)]({'yamlConfig':_0x3adba9,'folderPath':_0x548494,'sourcePath':_0x235229});}}}catch(_0x53bad7){return console[_0x25e0ba(0x220)](a36_0x54932d['red'](_0x25e0ba(0x18b)+_0x235229+':\x20'+(_0x53bad7 instanceof Error?_0x53bad7['message']:_0x53bad7))),0x1;}}if(_0x100cfe[_0x25e0ba(0x1b4)]===0x0&&_0x135150['length']===0x0){const _0x84df66=_0x9a1cc5[_0x25e0ba(0x20f)]?_0x25e0ba(0x1e1):'segment\x20or\x20journey';return console['error'](a36_0x54932d[_0x25e0ba(0x1cd)]('No\x20'+_0x84df66+_0x25e0ba(0x173))),0x0;}const _0x37b05f=new Map();_0xfee852[_0x25e0ba(0x1b4)]>0x0&&!_0x9a1cc5['journeysOnly']&&await withSpinner(_0x25e0ba(0x25f),async()=>{await batchAsync(_0xfee852,async _0x236395=>{const _0x205fbf=a36_0x2d4a,_0x57764f=await _0x5793b9['segment'][_0x205fbf(0x1ad)](_0x2d104e,_0x236395['id']);_0x37b05f['set'](_0x236395['id'],_0x57764f);});},{'verbose':_0x9a1cc5[_0x25e0ba(0x1f9)]});const _0x91fd22=[],_0x3c7242=new Set();for(const {yamlConfig:_0x569e66,folderPath:_0x4408a0,sourcePath:_0x26638b}of _0x100cfe){const _0x10865e=resolveTDFolderPath(_0x4408a0,_0xab46ba,_0x1bda42),_0x161ef3=_0x10865e+':'+_0x569e66['name'],_0x22bed5=_0x4e2e0d[_0x25e0ba(0x189)](_0x161ef3),_0x46b872=_0x22bed5?_0x37b05f[_0x25e0ba(0x189)](_0x22bed5['id'])||[]:[];if(_0x10865e&&!_0x2ac595[_0x25e0ba(0x21f)](_0x10865e)){const _0x349f07=_0x10865e['split']('/');let _0x46f54f='';for(const _0x680b16 of _0x349f07){_0x46f54f=_0x46f54f?_0x46f54f+'/'+_0x680b16:_0x680b16,!_0x2ac595[_0x25e0ba(0x21f)](_0x46f54f)&&_0x3c7242[_0x25e0ba(0x232)](_0x46f54f);}}const _0x32875b=calculateActivationActions(_0x569e66['activations']||[],_0x46b872,_0x464344,_0x502bc7),_0x54fd56=segmentToYamlString(_0x569e66);let _0x494a18,_0x1d7af3=![],_0x3ab3ff;if(_0x22bed5){const _0x1bb1f7=segmentWithActivationsToYaml(_0x22bed5,_0x46b872,undefined,_0x464344,_0x502bc7),_0x3ec935=segmentToYamlString(_0x1bb1f7);_0x494a18=generateDiff(_0x3ec935,_0x54fd56),_0x1d7af3=hasChanges(_0x494a18),_0x1d7af3&&(_0x3ab3ff=formatDiffWithColors(_0x494a18));}else _0x494a18=generateDiff('',_0x54fd56),_0x3ab3ff=formatDiffWithColors(_0x494a18);_0x91fd22[_0x25e0ba(0x1a2)]({'relativePath':_0x569e66[_0x25e0ba(0x179)],'absolutePath':_0x26638b,'yamlConfig':_0x569e66,'folderPath':_0x10865e,'existingSegment':_0x22bed5,'existingActivations':_0x46b872,'isNew':!_0x22bed5,'hasChanges':_0x1d7af3,'diff':_0x3ab3ff,'activationActions':_0x32875b});}let _0x53a076=[];if(!_0x24ed3e){const _0x1a258f=new Set();for(const {yamlConfig:_0x2eb490,folderPath:_0x3d28bf}of _0x100cfe){const _0x4e660e=resolveTDFolderPath(_0x3d28bf,_0xab46ba,_0x1bda42);_0x1a258f[_0x25e0ba(0x232)](_0x4e660e+':'+_0x2eb490['name']);}_0x53a076=_0xfee852[_0x25e0ba(0x21c)](_0x577361=>{const _0x309c7b=_0x25e0ba,_0x1dcfbb=_0x577361[_0x309c7b(0x16f)]?_0x22d65e[_0x309c7b(0x189)](_0x577361[_0x309c7b(0x16f)]['toString']())||'':'',_0x21e981=_0x1dcfbb+':'+_0x577361[_0x309c7b(0x179)];if(_0x1a258f[_0x309c7b(0x21f)](_0x21e981))return![];if(_0xab46ba)return _0x1dcfbb===_0x1bda42||_0x1dcfbb[_0x309c7b(0x19c)](_0x1bda42+'/');return!![];});}const _0x4ecc55=[];for(const {yamlConfig:_0x35f5b8,folderPath:_0xbd7dc7,sourcePath:_0x1c6f5a}of _0x135150){const _0x1b0a45=resolveTDFolderPath(_0xbd7dc7,_0xab46ba,_0x1bda42),_0x1424c9=_0x1b0a45+':'+_0x35f5b8['name'],_0x1f4683=_0x2ae488[_0x25e0ba(0x189)](_0x1424c9);let _0x202410,_0x1d243c;if(_0x1f4683&&_0x1f4683[_0x25e0ba(0x1b4)]>0x0){const _0x168bd7=new Set(),_0x3e5fb6=new Set(),_0x2adf8a=new Map(),_0xc7e0f=new Map(),_0x15e76d=createJumpTargetCache(),_0x171688=_0x111f18=>({'resolveSegment':async _0xc10e90=>{const _0x305baf=_0x25e0ba,_0x419247=_0xc7e0f[_0x305baf(0x189)](_0xc10e90);if(_0x419247!==undefined)return{'name':_0x419247,'isJourneyLocal':!![]};try{let _0x1f5b7f=_0xfee852['find'](_0x47ccde=>_0x47ccde['id']===_0xc10e90);!_0x1f5b7f&&(_0x1f5b7f=await _0x5793b9[_0x305baf(0x1e7)]['getSegment'](_0x2d104e,_0xc10e90));const _0x23e7ad=generateJourneyLocalName(_0x1f5b7f[_0x305baf(0x179)]),_0x2ddcb9=_0x1f5b7f[_0x305baf(0x250)]===SEGMENT_KIND_JOURNEY&&_0x23e7ad!==undefined;let _0x4bc387=_0x1f5b7f[_0x305baf(0x179)];if(_0x2ddcb9&&_0x23e7ad){let _0x2b7759=_0x23e7ad,_0x2a5e97=0x2;while(_0x168bd7[_0x305baf(0x21f)](_0x2b7759)){_0x2b7759=_0x23e7ad+'_'+_0x2a5e97,_0x2a5e97++;}_0x168bd7[_0x305baf(0x232)](_0x2b7759),_0x4bc387=_0x2b7759,_0xc7e0f[_0x305baf(0x21a)](_0xc10e90,_0x4bc387);}let _0x4b7771;return _0x2ddcb9&&_0x1f5b7f[_0x305baf(0x20c)]&&(_0x4b7771={'description':_0x1f5b7f[_0x305baf(0x23e)],'rule':apiRuleToYaml(_0x1f5b7f[_0x305baf(0x20c)])}),{'name':_0x4bc387,'isJourneyLocal':_0x2ddcb9,'definition':_0x4b7771};}catch{return{'name':_0xc10e90,'isJourneyLocal':![]};}},'resolveActivation':async _0x2f24d7=>{const _0x8d0ffc=_0x25e0ba,_0x33982b=_0x2adf8a[_0x8d0ffc(0x189)](_0x2f24d7);if(_0x33982b!==undefined)return{'name':_0x33982b,'isJourneyLocal':!![]};try{const _0x419314=await _0x5793b9[_0x8d0ffc(0x1e1)][_0x8d0ffc(0x24e)](_0x111f18,_0x2f24d7),_0x3b007e=_0x419314['attributes'][_0x8d0ffc(0x16a)][_0x8d0ffc(0x179)]||_0x2f24d7,_0x2ac228=sanitizeYamlKey(_0x3b007e)||'activation_'+_0x2f24d7;let _0x4df006=_0x2ac228,_0x5418d0=0x2;while(_0x3e5fb6[_0x8d0ffc(0x21f)](_0x4df006)){_0x4df006=_0x2ac228+'_'+_0x5418d0,_0x5418d0++;}_0x3e5fb6[_0x8d0ffc(0x232)](_0x4df006),_0x2adf8a[_0x8d0ffc(0x21a)](_0x2f24d7,_0x4df006);const _0x2e4540=journeyActivationStepToYaml(_0x419314,_0x464344,_0x502bc7);return{'name':_0x4df006,'isJourneyLocal':!![],'definition':_0x2e4540};}catch{return{'name':_0x2f24d7,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x106561,_0x5c761d)=>resolveJumpTarget(_0x106561,_0x5c761d,_0x15e76d,_0x3ed9b0=>_0x5793b9[_0x25e0ba(0x1e1)]['getJourney'](_0x3ed9b0))}),_0x1a0560=hasMultipleVersions(_0x35f5b8);if(_0x1a0560&&_0x1f4683[_0x25e0ba(0x1b4)]>0x1){const _0x30930b=[];for(const _0x20ccaa of _0x1f4683){const _0x471142=await withSpinner(_0x25e0ba(0x22d)+_0x35f5b8['name']+_0x25e0ba(0x1fe)+(_0x20ccaa[_0x25e0ba(0x1b1)]||0x1)+_0x25e0ba(0x201),()=>_0x5793b9[_0x25e0ba(0x1e1)][_0x25e0ba(0x188)](_0x20ccaa['id']),{'verbose':_0x9a1cc5['verbose']}),_0x45881d=_0x171688(_0x20ccaa['id']),_0x473a02=await apiToYamlAsync(_0x471142[_0x25e0ba(0x1bb)],_0x45881d);_0x30930b['push']({'item':_0x20ccaa,'yaml':_0x473a02});}_0x1d243c=buildMergedJourneyYaml(_0x30930b);const _0x2f4bb2=Math['max'](..._0x30930b['map'](_0x3dd47d=>_0x3dd47d[_0x25e0ba(0x1c7)]['versionNumber']||0x0)),_0x36b179=_0x1f4683['find'](_0x42aa0c=>(_0x42aa0c[_0x25e0ba(0x1b1)]||0x0)===_0x2f4bb2);_0x36b179&&(_0x202410=await _0x5793b9[_0x25e0ba(0x1e1)][_0x25e0ba(0x188)](_0x36b179['id']));}else{const _0x2f16a1=_0x1f4683[_0x1f4683[_0x25e0ba(0x1b4)]-0x1],_0x12178e=await withSpinner('Fetching\x20journey\x20\x27'+_0x35f5b8['name']+_0x25e0ba(0x1ab),()=>_0x5793b9[_0x25e0ba(0x1e1)][_0x25e0ba(0x188)](_0x2f16a1['id']),{'verbose':_0x9a1cc5['verbose']});_0x202410=_0x12178e[_0x25e0ba(0x1bb)];const _0x335a8c=_0x171688(_0x2f16a1['id']);_0x1d243c=await apiToYamlAsync(_0x202410,_0x335a8c);}}if(_0x1b0a45&&!_0x2ac595[_0x25e0ba(0x21f)](_0x1b0a45)){const _0x5a58d2=_0x1b0a45[_0x25e0ba(0x23a)]('/');let _0x1f8a25='';for(const _0x92e134 of _0x5a58d2){_0x1f8a25=_0x1f8a25?_0x1f8a25+'/'+_0x92e134:_0x92e134,!_0x2ac595[_0x25e0ba(0x21f)](_0x1f8a25)&&_0x3c7242['add'](_0x1f8a25);}}const _0x3fe45a=normalizeJourneyYaml(_0x35f5b8),_0x496921=a36_0x2783fc(_0x3fe45a);let _0x34eb96=![],_0x3aecc8;if(_0x1d243c){const _0x256887=normalizeJourneyYaml(_0x1d243c),_0x475e80=a36_0x2783fc(_0x256887),_0x363ec1=generateDiff(_0x475e80,_0x496921);_0x34eb96=hasChanges(_0x363ec1),_0x34eb96&&(_0x3aecc8=formatDiffWithColors(_0x363ec1));}else{const _0x95c39e=generateDiff('',_0x496921);_0x3aecc8=formatDiffWithColors(_0x95c39e);}_0x4ecc55[_0x25e0ba(0x1a2)]({'relativePath':_0x35f5b8[_0x25e0ba(0x179)],'absolutePath':_0x1c6f5a,'yamlConfig':_0x35f5b8,'folderPath':_0x1b0a45,'existingJourney':_0x202410,'isNew':!_0x202410,'hasChanges':_0x34eb96,'diff':_0x3aecc8});}let _0x57fe6d=[];if(!_0x24ed3e){const _0x588e24=new Set();for(const {yamlConfig:_0x4f91fa,folderPath:_0x19ff17}of _0x135150){const _0x115948=resolveTDFolderPath(_0x19ff17,_0xab46ba,_0x1bda42);_0x588e24[_0x25e0ba(0x232)](_0x115948+':'+_0x4f91fa[_0x25e0ba(0x179)]);}_0x57fe6d=_0x5e662c['filter'](_0x44ab91=>{const _0x2fb96c=_0x25e0ba,_0x21d6ef=_0x44ab91[_0x2fb96c(0x1c8)]?_0x22d65e[_0x2fb96c(0x189)](_0x44ab91[_0x2fb96c(0x1c8)])||'':'',_0x382506=_0x21d6ef+':'+_0x44ab91['journeyBundleName'];if(_0x588e24[_0x2fb96c(0x21f)](_0x382506))return![];if(_0xab46ba)return _0x21d6ef===_0x1bda42||_0x21d6ef[_0x2fb96c(0x19c)](_0x1bda42+'/');return!![];});}const _0x108c12=_0x91fd22[_0x25e0ba(0x21c)](_0x3ba927=>_0x3ba927[_0x25e0ba(0x20e)]),_0x8331ab=_0x91fd22[_0x25e0ba(0x21c)](_0x498e61=>!_0x498e61[_0x25e0ba(0x20e)]&&_0x498e61[_0x25e0ba(0x256)]),_0x20207f=_0x91fd22['filter'](_0x98a95b=>!_0x98a95b['isNew']&&!_0x98a95b[_0x25e0ba(0x256)]),_0x3408d0=Array['from'](_0x3c7242)['sort'](),_0x304ea1=_0x9a1cc5['delete']?_0x53a076:[],_0x3e0feb=_0x9a1cc5[_0x25e0ba(0x1a6)]?_0x57fe6d:[],_0x1e2c1e=_0x91fd22[_0x25e0ba(0x16c)](_0x392df4=>_0x392df4[_0x25e0ba(0x1e5)]),_0x527a4e=_0x1e2c1e[_0x25e0ba(0x21c)](_0x12a771=>_0x12a771[_0x25e0ba(0x231)]==='create'),_0x384eb8=_0x1e2c1e['filter'](_0x3d1997=>_0x3d1997['type']===_0x25e0ba(0x24b)),_0x4e02d2=_0x1e2c1e[_0x25e0ba(0x21c)](_0x438fcc=>_0x438fcc[_0x25e0ba(0x231)]===_0x25e0ba(0x1a6)),_0x479e32=_0x4ecc55[_0x25e0ba(0x21c)](_0x2424c3=>_0x2424c3[_0x25e0ba(0x20e)]),_0x2ec4a2=_0x4ecc55[_0x25e0ba(0x21c)](_0x5ae894=>!_0x5ae894['isNew']&&_0x5ae894[_0x25e0ba(0x256)]),_0x13b708=_0x4ecc55[_0x25e0ba(0x21c)](_0x36d299=>!_0x36d299[_0x25e0ba(0x20e)]&&!_0x36d299[_0x25e0ba(0x256)]);console[_0x25e0ba(0x220)](_0x25e0ba(0x1df)+_0x1e93f0+'\x27:');_0x3408d0[_0x25e0ba(0x1b4)]>0x0&&console[_0x25e0ba(0x220)]('\x20\x20'+a36_0x54932d[_0x25e0ba(0x1c4)](_0x25e0ba(0x253)+_0x3408d0[_0x25e0ba(0x1b4)]+_0x25e0ba(0x229)));if(!_0x9a1cc5[_0x25e0ba(0x20f)]){console[_0x25e0ba(0x220)]('\x20\x20📊\x20Segments:'),console[_0x25e0ba(0x220)](_0x25e0ba(0x24f)+a36_0x54932d[_0x25e0ba(0x1c6)]('+\x20'+_0x108c12[_0x25e0ba(0x1b4)]+_0x25e0ba(0x1cf))),console[_0x25e0ba(0x220)](_0x25e0ba(0x24f)+a36_0x54932d['yellow']('~\x20'+_0x8331ab[_0x25e0ba(0x1b4)]+_0x25e0ba(0x17a)));if(_0x304ea1['length']>0x0)console['error']('\x20\x20\x20\x20'+a36_0x54932d[_0x25e0ba(0x225)]('-\x20'+_0x304ea1[_0x25e0ba(0x1b4)]+_0x25e0ba(0x196)));else _0x53a076[_0x25e0ba(0x1b4)]>0x0&&!_0x9a1cc5[_0x25e0ba(0x1a6)]&&console[_0x25e0ba(0x220)](_0x25e0ba(0x24f)+a36_0x54932d[_0x25e0ba(0x16e)](_0x53a076[_0x25e0ba(0x1b4)]+_0x25e0ba(0x1f3)));console[_0x25e0ba(0x220)](_0x25e0ba(0x24f)+a36_0x54932d[_0x25e0ba(0x16e)]('=\x20'+_0x20207f[_0x25e0ba(0x1b4)]+_0x25e0ba(0x1ef)));}if(_0x4ecc55['length']>0x0||_0x57fe6d[_0x25e0ba(0x1b4)]>0x0){console[_0x25e0ba(0x220)](_0x25e0ba(0x1f0)),console['error']('\x20\x20\x20\x20'+a36_0x54932d[_0x25e0ba(0x1c6)]('+\x20'+_0x479e32[_0x25e0ba(0x1b4)]+_0x25e0ba(0x1cf))),console[_0x25e0ba(0x220)]('\x20\x20\x20\x20'+a36_0x54932d[_0x25e0ba(0x1cd)]('~\x20'+_0x2ec4a2[_0x25e0ba(0x1b4)]+_0x25e0ba(0x17a)));if(_0x3e0feb[_0x25e0ba(0x1b4)]>0x0)console['error'](_0x25e0ba(0x24f)+a36_0x54932d['red']('-\x20'+_0x3e0feb[_0x25e0ba(0x1b4)]+_0x25e0ba(0x196)));else _0x57fe6d[_0x25e0ba(0x1b4)]>0x0&&!_0x9a1cc5[_0x25e0ba(0x1a6)]&&console[_0x25e0ba(0x220)](_0x25e0ba(0x24f)+a36_0x54932d[_0x25e0ba(0x16e)](_0x57fe6d[_0x25e0ba(0x1b4)]+_0x25e0ba(0x1f3)));console[_0x25e0ba(0x220)](_0x25e0ba(0x24f)+a36_0x54932d[_0x25e0ba(0x16e)]('=\x20'+_0x13b708['length']+_0x25e0ba(0x1ef)));}_0x1e2c1e['length']>0x0&&!_0x9a1cc5[_0x25e0ba(0x20f)]&&(console[_0x25e0ba(0x220)](''),console[_0x25e0ba(0x220)](_0x25e0ba(0x1c2)),_0x527a4e['length']>0x0&&console[_0x25e0ba(0x220)](_0x25e0ba(0x24f)+a36_0x54932d['green']('+\x20'+_0x527a4e['length']+_0x25e0ba(0x23c))),_0x384eb8[_0x25e0ba(0x1b4)]>0x0&&console['error'](_0x25e0ba(0x24f)+a36_0x54932d[_0x25e0ba(0x1cd)]('~\x20'+_0x384eb8[_0x25e0ba(0x1b4)]+'\x20to\x20update')),_0x4e02d2[_0x25e0ba(0x1b4)]>0x0&&console[_0x25e0ba(0x220)](_0x25e0ba(0x24f)+a36_0x54932d[_0x25e0ba(0x225)]('-\x20'+_0x4e02d2['length']+'\x20to\x20delete')));console[_0x25e0ba(0x220)]('\x20\x20Source:\x20'+a36_0x54932d[_0x25e0ba(0x1d5)](_0x59c816)+'\x0a');if(_0x3408d0['length']>0x0){console[_0x25e0ba(0x220)](_0x25e0ba(0x1e2));for(const _0x32f047 of _0x3408d0){console['error']('\x20\x20'+a36_0x54932d[_0x25e0ba(0x1c4)]('+')+'\x20'+_0x32f047);}console[_0x25e0ba(0x220)]('');}if(_0x108c12['length']>0x0&&!_0x9a1cc5[_0x25e0ba(0x20f)])for(const _0x2e76f6 of _0x108c12){const _0x43b797=_0x2e76f6[_0x25e0ba(0x17f)]?_0x2e76f6['folderPath']+'/'+_0x2e76f6[_0x25e0ba(0x202)]['name']:_0x2e76f6[_0x25e0ba(0x202)][_0x25e0ba(0x179)],_0x49b9e9=_0x2e76f6[_0x25e0ba(0x202)][_0x25e0ba(0x1f2)]?.[_0x25e0ba(0x1b4)]||0x0,_0x47fbfb=_0x49b9e9>0x0?a36_0x54932d[_0x25e0ba(0x16e)]('\x20['+_0x49b9e9+'\x20activations]'):'';console[_0x25e0ba(0x220)]('\x0a'+a36_0x54932d['green'](_0x25e0ba(0x1a3))+'\x20'+_0x43b797+_0x47fbfb),console['error']('─'[_0x25e0ba(0x1a1)](0x3c)),_0x2e76f6['diff']&&console['error'](_0x2e76f6[_0x25e0ba(0x1d2)]),console[_0x25e0ba(0x220)]('─'[_0x25e0ba(0x1a1)](0x3c));}if(_0x304ea1['length']>0x0&&!_0x9a1cc5['journeysOnly'])for(const _0x3ce9db of _0x304ea1){const _0xf6c53c=_0x3ce9db['segmentFolderId']?_0x22d65e[_0x25e0ba(0x189)](_0x3ce9db['segmentFolderId'][_0x25e0ba(0x210)]())||'':'',_0x1296d9=_0xf6c53c?_0xf6c53c+'/'+_0x3ce9db[_0x25e0ba(0x179)]:_0x3ce9db['name'],_0x534423=_0x37b05f[_0x25e0ba(0x189)](_0x3ce9db['id'])||[],_0x108187=_0x534423['length']>0x0?a36_0x54932d[_0x25e0ba(0x16e)]('\x20['+_0x534423[_0x25e0ba(0x1b4)]+_0x25e0ba(0x1da)):'';console[_0x25e0ba(0x220)]('\x0a'+a36_0x54932d[_0x25e0ba(0x225)]('Delete\x20segment:')+'\x20'+_0x1296d9+_0x108187),console[_0x25e0ba(0x220)]('─'[_0x25e0ba(0x1a1)](0x3c));const _0x3cac8d=segmentWithActivationsToYaml(_0x3ce9db,_0x534423,undefined,_0x464344,_0x502bc7),_0x1f568f=segmentToYamlString(_0x3cac8d),_0x6ea09a=generateDiff(_0x1f568f,'');console[_0x25e0ba(0x220)](formatDiffWithColors(_0x6ea09a)),console['error']('─'[_0x25e0ba(0x1a1)](0x3c));}const _0x27572f=_0x91fd22['filter'](_0x250c74=>!_0x250c74[_0x25e0ba(0x20e)]&&_0x250c74[_0x25e0ba(0x1d2)]);if(_0x27572f['length']>0x0&&!_0x9a1cc5[_0x25e0ba(0x20f)])for(const _0x2cfc8 of _0x27572f){const _0x214b51=_0x2cfc8[_0x25e0ba(0x17f)]?_0x2cfc8[_0x25e0ba(0x17f)]+'/'+_0x2cfc8['yamlConfig'][_0x25e0ba(0x179)]:_0x2cfc8['yamlConfig'][_0x25e0ba(0x179)];console[_0x25e0ba(0x220)]('\x0a'+a36_0x54932d['yellow'](_0x25e0ba(0x187))+'\x20'+_0x214b51),console['error']('─'[_0x25e0ba(0x1a1)](0x3c)),console['error'](_0x2cfc8[_0x25e0ba(0x1d2)]),console[_0x25e0ba(0x220)]('─'[_0x25e0ba(0x1a1)](0x3c));}if(_0x479e32[_0x25e0ba(0x1b4)]>0x0)for(const _0x4b016a of _0x479e32){const _0x563b02=_0x4b016a[_0x25e0ba(0x17f)]?_0x4b016a['folderPath']+'/'+_0x4b016a[_0x25e0ba(0x202)][_0x25e0ba(0x179)]:_0x4b016a[_0x25e0ba(0x202)][_0x25e0ba(0x179)];console[_0x25e0ba(0x220)]('\x0a'+a36_0x54932d[_0x25e0ba(0x1c6)](_0x25e0ba(0x209))+'\x20'+_0x563b02),console[_0x25e0ba(0x220)]('─'[_0x25e0ba(0x1a1)](0x3c)),_0x4b016a[_0x25e0ba(0x1d2)]&&console['error'](_0x4b016a[_0x25e0ba(0x1d2)]),console[_0x25e0ba(0x220)]('─'[_0x25e0ba(0x1a1)](0x3c));}const _0x3eede5=_0x4ecc55['filter'](_0x26cf81=>!_0x26cf81[_0x25e0ba(0x20e)]&&_0x26cf81[_0x25e0ba(0x1d2)]);if(_0x3eede5[_0x25e0ba(0x1b4)]>0x0)for(const _0x55cb7a of _0x3eede5){const _0x2f98cd=_0x55cb7a[_0x25e0ba(0x17f)]?_0x55cb7a[_0x25e0ba(0x17f)]+'/'+_0x55cb7a['yamlConfig']['name']:_0x55cb7a[_0x25e0ba(0x202)][_0x25e0ba(0x179)];console[_0x25e0ba(0x220)]('\x0a'+a36_0x54932d[_0x25e0ba(0x1cd)](_0x25e0ba(0x25e))+'\x20'+_0x2f98cd),console[_0x25e0ba(0x220)]('─'[_0x25e0ba(0x1a1)](0x3c)),console[_0x25e0ba(0x220)](_0x55cb7a[_0x25e0ba(0x1d2)]),console[_0x25e0ba(0x220)]('─'[_0x25e0ba(0x1a1)](0x3c));}if(_0x3e0feb[_0x25e0ba(0x1b4)]>0x0)for(const _0x2d25f1 of _0x3e0feb){const _0x5bb6b5=_0x2d25f1[_0x25e0ba(0x1c8)]?_0x22d65e[_0x25e0ba(0x189)](_0x2d25f1['folderId'])||'':'',_0x1e341d=_0x5bb6b5?_0x5bb6b5+'/'+_0x2d25f1[_0x25e0ba(0x205)]:_0x2d25f1[_0x25e0ba(0x205)];console['error']('\x0a'+a36_0x54932d[_0x25e0ba(0x225)](_0x25e0ba(0x23b))+'\x20'+_0x1e341d),console['error']('─'[_0x25e0ba(0x1a1)](0x3c)),console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x225)](_0x25e0ba(0x1b3))),console[_0x25e0ba(0x220)]('─'['repeat'](0x3c));}if(_0x9a1cc5[_0x25e0ba(0x248)])return console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x1cd)](_0x25e0ba(0x192))),0x0;const _0x26197a=_0x9a1cc5[_0x25e0ba(0x20f)]?![]:_0x108c12[_0x25e0ba(0x1b4)]>0x0||_0x8331ab[_0x25e0ba(0x1b4)]>0x0||_0x304ea1[_0x25e0ba(0x1b4)]>0x0,_0x464dde=_0x479e32[_0x25e0ba(0x1b4)]>0x0||_0x2ec4a2[_0x25e0ba(0x1b4)]>0x0||_0x3e0feb[_0x25e0ba(0x1b4)]>0x0,_0x4ecced=_0x9a1cc5['journeysOnly']?![]:_0x1e2c1e[_0x25e0ba(0x1b4)]>0x0,_0x23efde=_0x3408d0[_0x25e0ba(0x1b4)]>0x0;if(!_0x26197a&&!_0x464dde&&!_0x4ecced&&!_0x23efde){const _0x2bf2d0=_0x9a1cc5[_0x25e0ba(0x20f)]?_0x25e0ba(0x261):_0x25e0ba(0x1ea);console['error'](a36_0x54932d[_0x25e0ba(0x1c6)](_0x2bf2d0));if(_0x24ed3e&&_0x13b708[_0x25e0ba(0x1b4)]===0x1){const _0x2e801d=_0x13b708[0x0];if(_0x2e801d[_0x25e0ba(0x1bf)]?.['id']){const _0x178da0=getConsoleNextUrl(_0x9a1cc5[_0x25e0ba(0x1c0)],'/app/ps/'+_0x2d104e+_0x25e0ba(0x1bd)+_0x2e801d[_0x25e0ba(0x1bf)]['id']+_0x25e0ba(0x1ca));console['error']('\x20\x20'+a36_0x54932d['cyan'](_0x178da0));}}return 0x0;}const _0x37929d=_0x9a1cc5[_0x25e0ba(0x20f)]?_0x479e32[_0x25e0ba(0x1b4)]+_0x2ec4a2['length']+_0x3e0feb['length']+_0x3408d0['length']:_0x108c12[_0x25e0ba(0x1b4)]+_0x8331ab[_0x25e0ba(0x1b4)]+_0x304ea1[_0x25e0ba(0x1b4)]+_0x479e32[_0x25e0ba(0x1b4)]+_0x2ec4a2[_0x25e0ba(0x1b4)]+_0x3e0feb[_0x25e0ba(0x1b4)]+_0x3408d0[_0x25e0ba(0x1b4)]+_0x1e2c1e['length'];if(!_0x9a1cc5[_0x25e0ba(0x1bc)]&&_0x37929d>0x0){const _0x2f0ab8=await confirmKey(_0x25e0ba(0x217)+_0x37929d+_0x25e0ba(0x239));if(!_0x2f0ab8)return console[_0x25e0ba(0x220)](_0x25e0ba(0x258)),0x1;}for(const _0x354e18 of _0x3408d0){const _0x44e9ad=_0x354e18['split']('/'),_0x6aeea1=_0x44e9ad[_0x44e9ad[_0x25e0ba(0x1b4)]-0x1],_0x31845d=_0x44e9ad[_0x25e0ba(0x1fb)](0x0,-0x1)[_0x25e0ba(0x1af)]('/'),_0x470acf=_0x2ac595['get'](_0x31845d),_0x304d26={'name':_0x6aeea1,'parentFolderId':_0x470acf},_0x267652=await withSpinner(_0x25e0ba(0x180)+_0x354e18+_0x25e0ba(0x1c1),()=>_0x5793b9[_0x25e0ba(0x1e7)][_0x25e0ba(0x215)](_0x2d104e,_0x304d26),{'verbose':_0x9a1cc5['verbose']});_0x2ac595['set'](_0x354e18,_0x267652[_0x25e0ba(0x1bb)]['id']),console[_0x25e0ba(0x220)](a36_0x54932d['blue'](_0x25e0ba(0x172)+_0x354e18+'\x27'));}let _0x396bcc=0x0,_0x5e3f71=0x0,_0x4b3f14=0x0,_0x32af90=0x0,_0x343e01=0x0,_0x4fde80=0x0;const _0x170880=new Map();for(const _0x51a4ff of _0x9a1cc5[_0x25e0ba(0x20f)]?[]:_0x91fd22){const _0x488b04=_0x51a4ff[_0x25e0ba(0x17f)]?_0x2ac595[_0x25e0ba(0x189)](_0x51a4ff[_0x25e0ba(0x17f)]):undefined;let _0x207355;try{if(_0x51a4ff[_0x25e0ba(0x20e)]){const _0x3a5227=yamlToCreateRequest(_0x51a4ff['yamlConfig'],_0x488b04),_0x418026=await withSpinner(_0x25e0ba(0x1ec)+_0x51a4ff[_0x25e0ba(0x202)]['name']+_0x25e0ba(0x1c1),()=>_0x5793b9['segment'][_0x25e0ba(0x16d)](_0x2d104e,_0x3a5227),{'verbose':_0x9a1cc5[_0x25e0ba(0x1f9)]});_0x207355=_0x418026[_0x25e0ba(0x1bb)]['id'],_0x170880[_0x25e0ba(0x21a)](_0x51a4ff['yamlConfig'][_0x25e0ba(0x179)],_0x207355),console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x1c6)](_0x25e0ba(0x1a9)+_0x51a4ff['yamlConfig'][_0x25e0ba(0x179)]+'\x27')),_0x396bcc++;}else{if(_0x51a4ff[_0x25e0ba(0x256)]){const _0x2798cb=yamlToUpdateRequest(_0x51a4ff['yamlConfig']);_0x488b04!==_0x51a4ff['existingSegment']?.[_0x25e0ba(0x16f)]&&(_0x2798cb[_0x25e0ba(0x16f)]=_0x488b04?parseInt(_0x488b04,0xa):undefined),await withSpinner('Updating\x20segment\x20\x27'+_0x51a4ff[_0x25e0ba(0x202)][_0x25e0ba(0x179)]+_0x25e0ba(0x1c1),()=>_0x5793b9[_0x25e0ba(0x1e7)][_0x25e0ba(0x1f1)](_0x2d104e,_0x51a4ff[_0x25e0ba(0x17b)]['id'],_0x2798cb),{'verbose':_0x9a1cc5['verbose']}),_0x207355=_0x51a4ff[_0x25e0ba(0x17b)]['id'],console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x1cd)]('✔\x20Updated\x20segment\x20\x27'+_0x51a4ff[_0x25e0ba(0x202)][_0x25e0ba(0x179)]+'\x27')),_0x5e3f71++;}else _0x207355=_0x51a4ff[_0x25e0ba(0x17b)]['id'];}}catch(_0x135110){const _0x37833f=isHttp400Error(_0x135110),_0x4880d2=_0x37833f?ErrorCode[_0x25e0ba(0x24d)]:ErrorCode[_0x25e0ba(0x1a5)],_0x2dec39=getErrorMessage(_0x135110);throw new SDKError(_0x4880d2,_0x25e0ba(0x18e)+(_0x51a4ff[_0x25e0ba(0x20e)]?_0x25e0ba(0x226):_0x25e0ba(0x24b))+_0x25e0ba(0x213)+_0x51a4ff[_0x25e0ba(0x1a4)]+'\x0a\x20\x20'+_0x2dec39,_0x135110);}for(const _0x98c0e8 of _0x51a4ff[_0x25e0ba(0x1e5)]){try{if(_0x98c0e8['type']===_0x25e0ba(0x226)&&_0x98c0e8[_0x25e0ba(0x1ae)]){const _0x284423=yamlActivationToCreateRequest(_0x98c0e8['yamlActivation'],_0x1516f5,_0x5b7934);await withSpinner('Creating\x20activation\x20\x27'+_0x98c0e8[_0x25e0ba(0x179)]+_0x25e0ba(0x1c1),()=>_0x5793b9[_0x25e0ba(0x1e7)][_0x25e0ba(0x22b)](_0x2d104e,_0x207355,_0x284423),{'verbose':_0x9a1cc5[_0x25e0ba(0x1f9)]}),console[_0x25e0ba(0x220)](a36_0x54932d['green'](_0x25e0ba(0x228)+_0x98c0e8['name']+'\x27')),_0x32af90++;}else{if(_0x98c0e8[_0x25e0ba(0x231)]==='update'&&_0x98c0e8[_0x25e0ba(0x1ae)]&&_0x98c0e8['existingActivation']){const _0x4f9055=yamlActivationToUpdateRequest(_0x98c0e8[_0x25e0ba(0x1ae)],_0x1516f5,_0x5b7934);await withSpinner(_0x25e0ba(0x185)+_0x98c0e8[_0x25e0ba(0x179)]+_0x25e0ba(0x1c1),()=>_0x5793b9[_0x25e0ba(0x1e7)]['updateActivation'](_0x2d104e,_0x207355,_0x98c0e8[_0x25e0ba(0x203)]['id'],_0x4f9055),{'verbose':_0x9a1cc5[_0x25e0ba(0x1f9)]}),console['error'](a36_0x54932d['yellow'](_0x25e0ba(0x1b2)+_0x98c0e8[_0x25e0ba(0x179)]+'\x27')),_0x343e01++;}else _0x98c0e8[_0x25e0ba(0x231)]===_0x25e0ba(0x1a6)&&_0x98c0e8[_0x25e0ba(0x203)]&&(await withSpinner('Deleting\x20activation\x20\x27'+_0x98c0e8['name']+'\x27...',()=>_0x5793b9['segment']['deleteActivation'](_0x2d104e,_0x207355,_0x98c0e8['existingActivation']['id']),{'verbose':_0x9a1cc5[_0x25e0ba(0x1f9)]}),console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x225)](_0x25e0ba(0x171)+_0x98c0e8[_0x25e0ba(0x179)]+'\x27')),_0x4fde80++);}}catch(_0x19e25d){const _0x26eda4=isHttp400Error(_0x19e25d),_0xdfd46e=_0x26eda4?ErrorCode[_0x25e0ba(0x1c3)]:ErrorCode[_0x25e0ba(0x22a)],_0x2bea05=getErrorMessage(_0x19e25d);throw new SDKError(_0xdfd46e,_0x25e0ba(0x18e)+_0x98c0e8[_0x25e0ba(0x231)]+_0x25e0ba(0x18d)+_0x98c0e8['name']+_0x25e0ba(0x255)+_0x51a4ff[_0x25e0ba(0x1a4)]+'\x0a\x20\x20'+_0x2bea05,_0x19e25d);}}}for(const _0x58fa97 of _0x9a1cc5[_0x25e0ba(0x20f)]?[]:_0x304ea1){await withSpinner(_0x25e0ba(0x181)+_0x58fa97[_0x25e0ba(0x179)]+'\x27...',()=>_0x5793b9[_0x25e0ba(0x1e7)][_0x25e0ba(0x19a)](_0x58fa97['id']),{'verbose':_0x9a1cc5['verbose']}),console[_0x25e0ba(0x220)](a36_0x54932d['red'](_0x25e0ba(0x1f5)+_0x58fa97[_0x25e0ba(0x179)]+'\x27')),_0x4b3f14++;}let _0x5495d0=0x0,_0x2af5da=0x0,_0x394fa4=0x0;const _0x427c03=new Map(_0x10252d);for(const _0x35bcae of _0x91fd22){_0x35bcae[_0x25e0ba(0x20e)]&&_0x170880[_0x25e0ba(0x21f)](_0x35bcae['yamlConfig'][_0x25e0ba(0x179)])&&_0x427c03['set'](_0x35bcae[_0x25e0ba(0x202)]['name'],_0x170880[_0x25e0ba(0x189)](_0x35bcae[_0x25e0ba(0x202)][_0x25e0ba(0x179)]));}if(_0x4ecc55[_0x25e0ba(0x1b4)]>0x0){const _0x4b53d5=await withQuerySpinner(_0x25e0ba(0x20d),async _0x42162c=>{const _0x42653d=_0x25e0ba,_0x58d8a6=[];let _0x3e5cd3=0x0;const _0x14bc96=0x5;for(let _0x28ea29=0x0;_0x28ea29<_0x4ecc55['length'];_0x28ea29+=_0x14bc96){const _0x566315=_0x4ecc55['slice'](_0x28ea29,_0x28ea29+_0x14bc96),_0x588d99=await Promise[_0x42653d(0x197)](_0x566315[_0x42653d(0x1b0)](async _0x588c1e=>{const _0x239b85=_0x42653d;if(!_0x588c1e[_0x239b85(0x20e)]&&!_0x588c1e[_0x239b85(0x256)])return{'action':_0x239b85(0x25b),'name':_0x588c1e[_0x239b85(0x202)][_0x239b85(0x179)],'journeyId':_0x588c1e[_0x239b85(0x1bf)]?.['id']};const _0x14fc5c=_0x588c1e[_0x239b85(0x17f)]?_0x2ac595[_0x239b85(0x189)](_0x588c1e['folderPath']):undefined,_0x1ff13d=_0x588c1e['isNew']?'Creating':_0x239b85(0x183);_0x42162c[_0x239b85(0x1d4)](_0x1ff13d+_0x239b85(0x207)+_0x588c1e[_0x239b85(0x202)][_0x239b85(0x179)]+'\x27');const _0x2246a6=new Map(),_0x4de172=new Map(),_0x50ba04=new Map(),_0x1e6f5d={'resolveSegmentId':async _0x4c94be=>{const _0x3f0b31=_0x239b85,_0x31f1c7=_0x427c03[_0x3f0b31(0x189)](_0x4c94be);if(!_0x31f1c7)throw new SDKError(ErrorCode[_0x3f0b31(0x1e3)],_0x3f0b31(0x1ba)+_0x4c94be+'\x20(referenced\x20in\x20journey\x20'+_0x588c1e[_0x3f0b31(0x202)][_0x3f0b31(0x179)]+')');return _0x31f1c7;},'resolveEmbeddedSegmentId':async(_0x47603a,_0x38570a)=>{const _0x233c3f=_0x239b85,_0x446a6a=_0x427c03[_0x233c3f(0x189)](_0x47603a);if(_0x446a6a)return _0x446a6a;const _0x5a72e7=_0xfee852[_0x233c3f(0x216)](_0x12add8=>_0x12add8[_0x233c3f(0x179)]===_0x47603a);if(_0x5a72e7)return _0x427c03[_0x233c3f(0x21a)](_0x47603a,_0x5a72e7['id']),_0x5a72e7['id'];if(_0x588c1e['isNew']){const _0x4e5d57=_0x588c1e[_0x233c3f(0x202)]['stages']||_0x588c1e['yamlConfig']['journeys']?.[0x0]?.[_0x233c3f(0x247)]||[];let _0x262988=_0x233c3f(0x214),_0x444684=_0x47603a;for(const _0x5e44ba of _0x4e5d57){if(_0x5e44ba[_0x233c3f(0x199)]?.[_0x233c3f(0x1e7)]===_0x47603a){_0x262988=_0x5e44ba[_0x233c3f(0x179)],_0x444684=_0x5e44ba[_0x233c3f(0x199)]['name']||_0x47603a;break;}}return _0x4de172[_0x233c3f(0x21a)](_0x47603a,{'definition':_0x38570a,'stageName':_0x262988,'criteriaName':_0x444684}),createPendingSegmentId(_0x47603a);}const _0x170af8=_0x588c1e[_0x233c3f(0x1bf)]?.['id'];if(!_0x170af8)throw new SDKError(ErrorCode[_0x233c3f(0x1ac)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x472bc4=_0x233c3f(0x251)+crypto[_0x233c3f(0x245)]();try{const _0x4a56e4=await _0x5793b9[_0x233c3f(0x1e7)][_0x233c3f(0x20b)]({'name':_0x472bc4,'description':_0x38570a[_0x233c3f(0x23e)]||_0x233c3f(0x25d)+_0x47603a,'journeyId':_0x170af8,'rule':yamlRuleToApi(_0x38570a[_0x233c3f(0x20c)],!![]),'countPopulation':!![],'parentFolderId':_0x17d9ba||'','audienceId':_0x2d104e});return _0x9a1cc5[_0x233c3f(0x1f9)]&&console[_0x233c3f(0x220)](_0x233c3f(0x1b8)+_0x47603a+_0x233c3f(0x169)+_0x472bc4+_0x233c3f(0x1d7)+_0x4a56e4),_0x427c03['set'](_0x47603a,_0x4a56e4),_0x4a56e4;}catch(_0x55e7d6){throw new SDKError(ErrorCode[_0x233c3f(0x1a5)],_0x233c3f(0x1eb)+_0x47603a+_0x233c3f(0x1c5)+getErrorMessage(_0x55e7d6),_0x55e7d6);}},'resolveActivationId':async _0x168e0c=>{const _0x17f557=_0x239b85,_0xa8be23=_0x2246a6[_0x17f557(0x189)](_0x168e0c);if(_0xa8be23)return _0xa8be23;if(_0x588c1e[_0x17f557(0x1bf)]){const _0x3286a9=await _0x5793b9['journey'][_0x17f557(0x1ad)](_0x588c1e[_0x17f557(0x1bf)]['id']),_0x20a25c=_0x3286a9['find'](_0x4997bb=>_0x4997bb[_0x17f557(0x194)][_0x17f557(0x16a)]?.[_0x17f557(0x179)]===_0x168e0c);if(_0x20a25c)return _0x2246a6[_0x17f557(0x21a)](_0x168e0c,_0x20a25c['id']),_0x20a25c['id'];}throw new SDKError(ErrorCode[_0x17f557(0x22f)],_0x17f557(0x1d9)+_0x168e0c+'\x20(referenced\x20in\x20journey\x20'+_0x588c1e[_0x17f557(0x202)]['name']+_0x17f557(0x234)+_0x17f557(0x211));},'resolveEmbeddedActivationId':async(_0x1ad973,_0x3464d4)=>{const _0x4f8aa3=_0x239b85,_0x25228a=_0x2246a6[_0x4f8aa3(0x189)](_0x1ad973);if(_0x25228a)return _0x25228a;if(_0x588c1e['isNew'])return _0x50ba04[_0x4f8aa3(0x21a)](_0x1ad973,_0x3464d4),createPendingActivationId(_0x1ad973);if(_0x588c1e['existingJourney']){const _0x2ecb8a=await _0x5793b9[_0x4f8aa3(0x1e1)]['listActivations'](_0x588c1e[_0x4f8aa3(0x1bf)]['id']),_0x374c77=_0x2ecb8a['find'](_0x241793=>_0x241793[_0x4f8aa3(0x194)]['activationParams']?.[_0x4f8aa3(0x179)]===_0x3464d4[_0x4f8aa3(0x179)]);if(_0x374c77)return _0x2246a6[_0x4f8aa3(0x21a)](_0x1ad973,_0x374c77['id']),_0x374c77['id'];try{const _0x2c37cb=yamlActivationToCreateRequest(_0x3464d4,_0x1516f5,_0x5b7934),_0x50b08f=await _0x5793b9[_0x4f8aa3(0x1e1)][_0x4f8aa3(0x22b)](_0x588c1e[_0x4f8aa3(0x1bf)]['id'],_0x2c37cb);return _0x9a1cc5['verbose']&&console['error'](_0x4f8aa3(0x233)+_0x1ad973+_0x4f8aa3(0x222)+_0x50b08f['id']),_0x2246a6[_0x4f8aa3(0x21a)](_0x1ad973,_0x50b08f['id']),_0x50b08f['id'];}catch(_0x5c58e4){throw new SDKError(ErrorCode[_0x4f8aa3(0x260)],'Failed\x20to\x20create\x20embedded\x20activation\x20\x27'+_0x1ad973+_0x4f8aa3(0x1c5)+getErrorMessage(_0x5c58e4),_0x5c58e4);}}throw new SDKError(ErrorCode[_0x4f8aa3(0x1ac)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x459bdc=>{const _0x3e3c04=_0x239b85;try{return await _0x5793b9[_0x3e3c04(0x1e1)][_0x3e3c04(0x224)](_0x2d104e,_0x459bdc);}catch(_0x1d0aa6){throw new SDKError(ErrorCode[_0x3e3c04(0x22f)],'Journey\x20\x27'+_0x459bdc+_0x3e3c04(0x1be)+_0x588c1e[_0x3e3c04(0x202)][_0x3e3c04(0x179)]+'\x27)',_0x1d0aa6);}},'resolveStageId':async(_0x32d0a8,_0x5e5fb7)=>{const _0x5a8ed9=_0x239b85,_0x2d92ca=await _0x5793b9[_0x5a8ed9(0x1e1)]['getJourney'](_0x32d0a8),_0x5df7d0=_0x2d92ca[_0x5a8ed9(0x194)][_0x5a8ed9(0x238)][_0x5a8ed9(0x216)](_0x3ad76a=>_0x3ad76a[_0x5a8ed9(0x179)][_0x5a8ed9(0x176)]()===_0x5e5fb7[_0x5a8ed9(0x176)]());if(!_0x5df7d0?.['id'])throw new SDKError(ErrorCode[_0x5a8ed9(0x22f)],_0x5a8ed9(0x1ed)+_0x5e5fb7+_0x5a8ed9(0x259)+(_0x2d92ca[_0x5a8ed9(0x194)]['journeyBundleName']||_0x2d92ca[_0x5a8ed9(0x194)][_0x5a8ed9(0x179)])+'\x27');return _0x5df7d0['id'];}};try{const _0x1a4548=await a36_0x18f4eb(_0x588c1e[_0x239b85(0x202)],_0x2d104e,_0x1e6f5d),_0x557596=_0x14fc5c||_0x17d9ba;_0x557596&&(_0x1a4548['relationships']={'parentFolder':{'data':{'id':_0x557596,'type':_0x239b85(0x242)}}});if(_0x588c1e[_0x239b85(0x20e)]){if(_0x4de172[_0x239b85(0x240)]>0x0||_0x50ba04['size']>0x0){const _0x2f69a8=JSON[_0x239b85(0x177)](JSON[_0x239b85(0x246)](_0x1a4548));ensureJourneyDefaults(_0x2f69a8[_0x239b85(0x194)]);for(const _0x5aaf8c of _0x2f69a8[_0x239b85(0x194)][_0x239b85(0x238)]){_0x5aaf8c[_0x239b85(0x204)]?.[_0x239b85(0x252)]&&isPendingSegmentId(_0x5aaf8c[_0x239b85(0x204)][_0x239b85(0x252)])&&delete _0x5aaf8c[_0x239b85(0x204)];if(_0x5aaf8c['steps'])for(const _0x199855 of Object[_0x239b85(0x21d)](_0x5aaf8c['steps'])){const _0xfdbf7e=_0x5aaf8c[_0x239b85(0x1b7)][_0x199855];_0xfdbf7e[_0x239b85(0x231)]===_0x239b85(0x1a0)&&_0xfdbf7e['journeyActivationStepId']&&isPendingActivationId(_0xfdbf7e[_0x239b85(0x24a)])&&(_0xfdbf7e[_0x239b85(0x24a)]='');if(_0xfdbf7e[_0x239b85(0x231)]===_0x239b85(0x1f4)&&_0xfdbf7e[_0x239b85(0x23d)])for(const _0x19499f of _0xfdbf7e[_0x239b85(0x23d)]){_0x19499f[_0x239b85(0x252)]&&isPendingSegmentId(_0x19499f[_0x239b85(0x252)])&&(_0x19499f['segmentId']='');}}}_0x9a1cc5[_0x239b85(0x1f9)]&&console[_0x239b85(0x220)](_0x239b85(0x1cb)+JSON['stringify'](_0x2f69a8,null,0x2));const _0x510261=await _0x5793b9[_0x239b85(0x1e1)][_0x239b85(0x226)](_0x2f69a8),_0x20f4f9=_0x510261['id'],_0x1d4560=new Map();for(const _0x3de940 of _0x510261[_0x239b85(0x194)][_0x239b85(0x238)]){_0x1d4560[_0x239b85(0x21a)](_0x3de940[_0x239b85(0x179)][_0x239b85(0x176)](),_0x3de940['id']);}const _0x19c074=new Map();for(const [_0x391ede,{definition:_0x1fb793,criteriaName:_0x83a3fb}]of _0x4de172){const _0x2ea868=generateJourneyLocalName(_0x83a3fb)||_0x239b85(0x251)+crypto[_0x239b85(0x245)]();_0x9a1cc5[_0x239b85(0x1f9)]&&console[_0x239b85(0x220)](_0x239b85(0x1e4)+_0x391ede+_0x239b85(0x169)+_0x2ea868+_0x239b85(0x1db)+_0x20f4f9);const _0x5157a3=await _0x5793b9['segment'][_0x239b85(0x20b)]({'name':_0x2ea868,'description':_0x1fb793['description']||_0x239b85(0x25d)+_0x391ede,'journeyId':_0x20f4f9,'rule':yamlRuleToApi(_0x1fb793[_0x239b85(0x20c)],!![]),'countPopulation':!![],'parentFolderId':_0x557596||'','audienceId':_0x2d104e});_0x19c074['set'](_0x391ede,_0x5157a3),_0x427c03['set'](_0x391ede,_0x5157a3),_0x9a1cc5[_0x239b85(0x1f9)]&&console[_0x239b85(0x220)](_0x239b85(0x1b8)+_0x391ede+_0x239b85(0x222)+_0x5157a3);}const _0x59200a=new Map();for(const [_0x3b49b9,_0x4d06d7]of _0x50ba04){_0x9a1cc5['verbose']&&console['error'](_0x239b85(0x1a7)+_0x3b49b9+'\x27\x20with\x20journeyId:\x20'+_0x20f4f9);try{const _0x227883=yamlActivationToCreateRequest(_0x4d06d7,_0x1516f5,_0x5b7934),_0x50d15f=await _0x5793b9[_0x239b85(0x1e1)][_0x239b85(0x22b)](_0x20f4f9,_0x227883);_0x59200a[_0x239b85(0x21a)](_0x3b49b9,_0x50d15f['id']),_0x2246a6[_0x239b85(0x21a)](_0x3b49b9,_0x50d15f['id']),_0x9a1cc5[_0x239b85(0x1f9)]&&console[_0x239b85(0x220)](_0x239b85(0x233)+_0x3b49b9+_0x239b85(0x222)+_0x50d15f['id']);}catch(_0x184a10){throw new SDKError(ErrorCode[_0x239b85(0x260)],_0x239b85(0x1e8)+_0x3b49b9+'\x27:\x20'+getErrorMessage(_0x184a10),_0x184a10);}}const _0x402fcd=JSON[_0x239b85(0x177)](JSON['stringify'](_0x1a4548));_0x402fcd['id']=_0x20f4f9,ensureJourneyDefaults(_0x402fcd[_0x239b85(0x194)]);for(const _0x55c41a of _0x402fcd[_0x239b85(0x194)][_0x239b85(0x238)]){const _0x35725d=_0x1d4560[_0x239b85(0x189)](_0x55c41a[_0x239b85(0x179)][_0x239b85(0x176)]());_0x35725d&&(_0x55c41a['id']=_0x35725d);if(_0x55c41a[_0x239b85(0x204)]?.[_0x239b85(0x252)]&&isPendingSegmentId(_0x55c41a['entryCriteria']['segmentId'])){const _0x485534=extractPendingSegmentName(_0x55c41a[_0x239b85(0x204)][_0x239b85(0x252)]),_0x4a42df=_0x19c074[_0x239b85(0x189)](_0x485534);_0x4a42df&&(_0x55c41a[_0x239b85(0x204)][_0x239b85(0x252)]=_0x4a42df);}if(_0x55c41a['steps']){const _0x38e388=_0x124748=>_0x1a4548[_0x239b85(0x194)][_0x239b85(0x238)]['find'](_0x58a66b=>_0x58a66b[_0x239b85(0x179)][_0x239b85(0x176)]()===_0x55c41a['name']['toLowerCase']())?.['steps']?.[_0x124748];for(const _0x32558f of Object[_0x239b85(0x21d)](_0x55c41a[_0x239b85(0x1b7)])){const _0x4d2878=_0x55c41a['steps'][_0x32558f],_0x48cbb8=_0x38e388(_0x32558f);if(_0x4d2878[_0x239b85(0x231)]===_0x239b85(0x1a0)&&_0x4d2878[_0x239b85(0x24a)]&&(isPendingActivationId(_0x4d2878[_0x239b85(0x24a)])||_0x4d2878['journeyActivationStepId']==='')){if(_0x48cbb8?.[_0x239b85(0x24a)]&&isPendingActivationId(_0x48cbb8[_0x239b85(0x24a)])){const _0x5221dd=extractPendingActivationName(_0x48cbb8[_0x239b85(0x24a)]),_0x2c6740=_0x59200a['get'](_0x5221dd);_0x2c6740&&(_0x4d2878[_0x239b85(0x24a)]=_0x2c6740);}}if(_0x4d2878['type']===_0x239b85(0x1f4)&&_0x4d2878['branches']&&_0x48cbb8?.[_0x239b85(0x23d)])for(let _0x29826b=0x0;_0x29826b<_0x4d2878[_0x239b85(0x23d)][_0x239b85(0x1b4)];_0x29826b++){const _0x58f753=_0x4d2878['branches'][_0x29826b],_0x369b97=_0x48cbb8[_0x239b85(0x23d)][_0x29826b];if(_0x369b97?.[_0x239b85(0x252)]&&isPendingSegmentId(_0x369b97[_0x239b85(0x252)])){const _0x586f91=extractPendingSegmentName(_0x369b97[_0x239b85(0x252)]),_0x259b8a=_0x19c074[_0x239b85(0x189)](_0x586f91);_0x259b8a&&(_0x58f753[_0x239b85(0x252)]=_0x259b8a);}}}}}return _0x9a1cc5[_0x239b85(0x1f9)]&&console['error'](_0x239b85(0x19e)+JSON[_0x239b85(0x246)](_0x402fcd,null,0x2)),await _0x5793b9[_0x239b85(0x1e1)][_0x239b85(0x24b)](_0x20f4f9,_0x402fcd),{'action':_0x239b85(0x20a),'name':_0x588c1e['yamlConfig'][_0x239b85(0x179)],'journeyId':_0x20f4f9};}else{ensureJourneyDefaults(_0x1a4548['attributes']);_0x9a1cc5[_0x239b85(0x1f9)]&&console['error'](_0x239b85(0x1e6)+JSON[_0x239b85(0x246)](_0x1a4548,null,0x2));const _0x5f54df=await _0x5793b9[_0x239b85(0x1e1)][_0x239b85(0x226)](_0x1a4548);return{'action':_0x239b85(0x20a),'name':_0x588c1e['yamlConfig'][_0x239b85(0x179)],'journeyId':_0x5f54df['id']};}}else{if(_0x588c1e[_0x239b85(0x256)]&&_0x588c1e['existingJourney'])return ensureJourneyDefaults(_0x1a4548[_0x239b85(0x194)]),await _0x5793b9[_0x239b85(0x1e1)]['update'](_0x588c1e['existingJourney']['id'],_0x1a4548),{'action':_0x239b85(0x1e0),'name':_0x588c1e[_0x239b85(0x202)]['name'],'journeyId':_0x588c1e['existingJourney']['id']};}return{'action':_0x239b85(0x25b),'name':_0x588c1e[_0x239b85(0x202)]['name'],'journeyId':_0x588c1e[_0x239b85(0x1bf)]?.['id']};}catch(_0x43d982){const _0x195724=isHttp400Error(_0x43d982),_0x425968=_0x195724?ErrorCode[_0x239b85(0x1d3)]:ErrorCode[_0x239b85(0x260)],_0x5a6b5f=getErrorMessage(_0x43d982);throw new SDKError(_0x425968,_0x239b85(0x18e)+(_0x588c1e[_0x239b85(0x20e)]?_0x239b85(0x226):_0x239b85(0x24b))+_0x239b85(0x182)+_0x588c1e[_0x239b85(0x1a4)]+'\x0a\x20\x20'+_0x5a6b5f,_0x43d982);}}));_0x58d8a6[_0x42653d(0x1a2)](..._0x588d99),_0x3e5cd3+=_0x566315[_0x42653d(0x1b4)],_0x42162c[_0x42653d(0x227)]('('+_0x3e5cd3+'/'+_0x4ecc55[_0x42653d(0x1b4)]+')');}return _0x58d8a6;},{'verbose':_0x9a1cc5[_0x25e0ba(0x1f9)]});for(const _0x2a27eb of _0x4b53d5[_0x25e0ba(0x1bb)]){if(_0x2a27eb[_0x25e0ba(0x1f6)]==='created')console['error'](a36_0x54932d[_0x25e0ba(0x1c6)](_0x25e0ba(0x249)+_0x2a27eb[_0x25e0ba(0x179)]+'\x27')),_0x5495d0++;else _0x2a27eb[_0x25e0ba(0x1f6)]==='updated'&&(console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x1cd)](_0x25e0ba(0x241)+_0x2a27eb[_0x25e0ba(0x179)]+'\x27')),_0x2af5da++);}if(_0x24ed3e&&_0x4b53d5['data'][_0x25e0ba(0x1b4)]===0x1){const _0x33fd09=_0x4b53d5[_0x25e0ba(0x1bb)][0x0];if(_0x33fd09['journeyId']){const _0x250ebe=getConsoleNextUrl(_0x9a1cc5['site'],'/app/ps/'+_0x2d104e+_0x25e0ba(0x1bd)+_0x33fd09[_0x25e0ba(0x262)]+_0x25e0ba(0x1ca));console[_0x25e0ba(0x220)]('\x20\x20'+a36_0x54932d[_0x25e0ba(0x1d5)](_0x250ebe));}}}for(const _0x57761a of _0x3e0feb){console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x1cd)]('⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20'+_0x57761a[_0x25e0ba(0x205)])),_0x394fa4++;}const _0x2f5cb5=[];if(_0x396bcc>0x0)_0x2f5cb5[_0x25e0ba(0x1a2)](_0x396bcc+_0x25e0ba(0x195));if(_0x5e3f71>0x0)_0x2f5cb5['push'](_0x5e3f71+_0x25e0ba(0x243));if(_0x4b3f14>0x0)_0x2f5cb5[_0x25e0ba(0x1a2)](_0x4b3f14+_0x25e0ba(0x1b5));const _0x9c7767=[];if(_0x5495d0>0x0)_0x9c7767[_0x25e0ba(0x1a2)](_0x5495d0+_0x25e0ba(0x195));if(_0x2af5da>0x0)_0x9c7767[_0x25e0ba(0x1a2)](_0x2af5da+_0x25e0ba(0x243));if(_0x394fa4>0x0)_0x9c7767['push'](_0x394fa4+_0x25e0ba(0x1b5));const _0x125c25=[];if(_0x32af90>0x0)_0x125c25[_0x25e0ba(0x1a2)](_0x32af90+_0x25e0ba(0x195));if(_0x343e01>0x0)_0x125c25[_0x25e0ba(0x1a2)](_0x343e01+_0x25e0ba(0x243));if(_0x4fde80>0x0)_0x125c25[_0x25e0ba(0x1a2)](_0x4fde80+'\x20deleted');return console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x1c6)](_0x25e0ba(0x254))),_0x2f5cb5['length']>0x0&&!_0x9a1cc5[_0x25e0ba(0x20f)]&&console['error'](_0x25e0ba(0x21b)+_0x2f5cb5[_0x25e0ba(0x1af)](',\x20')),_0x9c7767[_0x25e0ba(0x1b4)]>0x0&&console[_0x25e0ba(0x220)](_0x25e0ba(0x263)+_0x9c7767['join'](',\x20')),_0x125c25[_0x25e0ba(0x1b4)]>0x0&&!_0x9a1cc5[_0x25e0ba(0x20f)]&&console[_0x25e0ba(0x220)]('\x20\x20Activations:\x20'+_0x125c25[_0x25e0ba(0x1af)](',\x20')),0x0;}}function buildFolderPathToIdMap(_0xad195a){const _0x550775=a36_0x59c5e1,_0x5bf768=new Map(),_0x5b5192=new Map();for(const _0x34a354 of _0xad195a){_0x5b5192[_0x550775(0x21a)](_0x34a354['id'],_0x34a354);}const _0xfc537f=new Set();for(const _0x963a06 of _0xad195a){!_0x963a06[_0x550775(0x235)]&&_0xfc537f[_0x550775(0x232)](_0x963a06['id']);}function _0xc75d18(_0x12823b){const _0x5b1b0a=_0x550775;if(_0xfc537f[_0x5b1b0a(0x21f)](_0x12823b['id']))return'';if(_0x12823b[_0x5b1b0a(0x235)]){const _0x1e40d0=_0x5b5192[_0x5b1b0a(0x189)](_0x12823b['parentFolderId']);if(_0x1e40d0){const _0x1fe6cf=_0xc75d18(_0x1e40d0);return _0x1fe6cf?_0x1fe6cf+'/'+_0x12823b[_0x5b1b0a(0x179)]:_0x12823b[_0x5b1b0a(0x179)];}}return _0x12823b[_0x5b1b0a(0x179)];}for(const _0x188e44 of _0xad195a){const _0x44559d=_0xc75d18(_0x188e44);_0x5bf768['set'](_0x44559d,_0x188e44['id']);}return _0x5bf768;}function findYamlFiles(_0x2918e5){const _0xf57dc4=[];function _0x944a9c(_0x273dab){const _0x23aebd=a36_0x2d4a,_0x3b214c=readdirSync(_0x273dab,{'withFileTypes':!![]});for(const _0x568f60 of _0x3b214c){const _0x12944b=a36_0x475838[_0x23aebd(0x1af)](_0x273dab,_0x568f60[_0x23aebd(0x179)]);if(_0x568f60['isDirectory']())_0x944a9c(_0x12944b);else(_0x568f60[_0x23aebd(0x179)]['endsWith'](_0x23aebd(0x1c9))||_0x568f60[_0x23aebd(0x179)][_0x23aebd(0x175)](_0x23aebd(0x1fc)))&&_0xf57dc4[_0x23aebd(0x1a2)](_0x12944b);}}return _0x944a9c(_0x2918e5),_0xf57dc4;}function calculateActivationActions(_0x17674b,_0x5bba71,_0x57f11f,_0x1f4bb5){const _0x542d11=a36_0x59c5e1,_0x95a15f=[],_0x218fa1=new Map();for(const _0xb1abed of _0x5bba71){_0x218fa1[_0x542d11(0x21a)](_0xb1abed[_0x542d11(0x179)],_0xb1abed);}const _0x361b27=new Map();for(const _0x5821f8 of _0x17674b){_0x361b27[_0x542d11(0x21a)](_0x5821f8['name'],_0x5821f8);}for(const _0x36c200 of _0x17674b){const _0x44d174=_0x218fa1[_0x542d11(0x189)](_0x36c200[_0x542d11(0x179)]);if(!_0x44d174)_0x95a15f[_0x542d11(0x1a2)]({'type':_0x542d11(0x226),'name':_0x36c200[_0x542d11(0x179)],'yamlActivation':_0x36c200});else{const _0x12bfea=activationToYaml(_0x44d174,_0x57f11f,_0x1f4bb5),_0x39ba83=a36_0x147f4c['stringify'](_0x12bfea),_0x42d5e8=a36_0x147f4c[_0x542d11(0x246)](_0x36c200);_0x39ba83!==_0x42d5e8&&_0x95a15f[_0x542d11(0x1a2)]({'type':_0x542d11(0x24b),'name':_0x36c200[_0x542d11(0x179)],'yamlActivation':_0x36c200,'existingActivation':_0x44d174});}}for(const _0x5b475c of _0x5bba71){!_0x361b27[_0x542d11(0x21f)](_0x5b475c[_0x542d11(0x179)])&&_0x95a15f['push']({'type':'delete','name':_0x5b475c['name'],'existingActivation':_0x5b475c});}return _0x95a15f;}
1
+ const a36_0x1b85d6=a36_0x2e07;(function(_0x4ca45f,_0x43d4b4){const _0x6d12d3=a36_0x2e07,_0x433367=_0x4ca45f();while(!![]){try{const _0x4211bf=-parseInt(_0x6d12d3(0x94))/0x1+parseInt(_0x6d12d3(0xc9))/0x2*(parseInt(_0x6d12d3(0xde))/0x3)+-parseInt(_0x6d12d3(0xe8))/0x4*(-parseInt(_0x6d12d3(0xd3))/0x5)+parseInt(_0x6d12d3(0x169))/0x6*(parseInt(_0x6d12d3(0xf8))/0x7)+parseInt(_0x6d12d3(0x117))/0x8*(parseInt(_0x6d12d3(0x11b))/0x9)+parseInt(_0x6d12d3(0x12f))/0xa+-parseInt(_0x6d12d3(0xd5))/0xb*(parseInt(_0x6d12d3(0x166))/0xc);if(_0x4211bf===_0x43d4b4)break;else _0x433367['push'](_0x433367['shift']());}catch(_0x23daaf){_0x433367['push'](_0x433367['shift']());}}}(a36_0x46eb,0xbb7e5));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode,isHttp400Error,getErrorMessage}from'../sdk/errors.js';function a36_0x2e07(_0x10df94,_0x38ee2f){_0x10df94=_0x10df94-0x82;const _0x46eb1d=a36_0x46eb();let _0x2e07de=_0x46eb1d[_0x10df94];return _0x2e07de;}import{withSpinner,withQuerySpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,findTdxConfig}from'../utils/tdx-config.js';import{segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,yamlToCreateRequest,yamlToUpdateRequest,yamlActivationToCreateRequest,yamlActivationToUpdateRequest,journeyActivationStepToYaml,activationToYaml,apiRuleToYaml,yamlRuleToApi}from'../sdk/segment/child-segment-yaml.js';import{isJourneyYaml,parseYamlString as a36_0x166334,yamlToApi as a36_0x5c8cd4,toYamlString as a36_0x28cad5,apiToYamlAsync,hasMultipleVersions,normalizeJourneyYaml}from'../sdk/segment/journey-yaml.js';import a36_0x14aa77 from'chalk';import{existsSync,readFileSync,statSync,readdirSync}from'fs';import a36_0x2ae80a from'path';import{getConsoleNextUrl}from'../types/endpoints.js';import*as a36_0x54a4c8 from'yaml';import{sanitizeFileName}from'../utils/string-utils.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyYaml,createJumpTargetCache,resolveJumpTarget}from'../utils/journey-utils.js';const PENDING_SEGMENT_PREFIX=a36_0x1b85d6(0xf2);function createPendingSegmentId(_0x2fdfe0){return''+PENDING_SEGMENT_PREFIX+_0x2fdfe0+'__';}function isPendingSegmentId(_0x4bf0f3){const _0x41b60d=a36_0x1b85d6;return _0x4bf0f3[_0x41b60d(0x16a)](PENDING_SEGMENT_PREFIX);}function extractPendingSegmentName(_0x4e159d){return _0x4e159d['replace'](/^__pending_(.+)__$/,'$1');}const PENDING_ACTIVATION_PREFIX=a36_0x1b85d6(0x111);function createPendingActivationId(_0x407480){return''+PENDING_ACTIVATION_PREFIX+_0x407480+'__';}function isPendingActivationId(_0xa3e52a){const _0x8d2d3=a36_0x1b85d6;return _0xa3e52a[_0x8d2d3(0x16a)](PENDING_ACTIVATION_PREFIX);}function extractPendingActivationName(_0x29bb67){const _0x14f5fc=a36_0x1b85d6;return _0x29bb67[_0x14f5fc(0x157)](/^__pending_act_(.+)__$/,'$1');}function ensureJourneyDefaults(_0x4574c1){const _0x19fdd7=a36_0x1b85d6;!_0x4574c1[_0x19fdd7(0x15a)]&&(_0x4574c1[_0x19fdd7(0x15a)]=''),!_0x4574c1[_0x19fdd7(0x8f)]&&(_0x4574c1[_0x19fdd7(0x8f)]=_0x19fdd7(0x15e));}function tryFindTdxConfig(_0x2adc1e){try{return findTdxConfig(_0x2adc1e);}catch{return null;}}function resolveTDFolderPath(_0x12ae0c,_0x3b6896,_0x187a40){if(!_0x3b6896)return _0x12ae0c;return _0x12ae0c?_0x187a40+'/'+_0x12ae0c:_0x187a40;}export class SegmentPushCommand extends BaseCommand{[a36_0x1b85d6(0x8b)]='segment:push';['description']=a36_0x1b85d6(0xd4);async[a36_0x1b85d6(0xdd)](_0x4d51a4){const _0x5236b6=a36_0x1b85d6,{options:_0x4bbe6e,args:_0x20bbf7,tdx:_0x2d2cc1}=_0x4d51a4,_0x31d781=_0x4bbe6e,_0x4a863f=_0x4bbe6e['parentSegment'],_0x2d6c7b=_0x20bbf7[0x0];let _0x330ad6,_0x3c052a,_0x25cd83,_0x4f4db2;if(_0x2d6c7b){if(existsSync(_0x2d6c7b)&&statSync(_0x2d6c7b)[_0x5236b6(0x11e)]()){const _0x88ea8a=tryFindTdxConfig(_0x2d6c7b);if(_0x88ea8a)_0x330ad6=_0x88ea8a[_0x5236b6(0x10f)][_0x5236b6(0x96)],_0x3c052a=_0x2d6c7b,_0x25cd83=_0x88ea8a['configDir'];else return console[_0x5236b6(0x17a)](a36_0x14aa77[_0x5236b6(0xff)](_0x5236b6(0xe9)+_0x2d6c7b+'\x0a')),console[_0x5236b6(0x17a)](a36_0x14aa77[_0x5236b6(0xdb)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;}else{if(existsSync(_0x2d6c7b)&&statSync(_0x2d6c7b)[_0x5236b6(0xf0)]()){const _0x2bcea3=a36_0x2ae80a['dirname'](_0x2d6c7b),_0x2ca6cf=tryFindTdxConfig(_0x2bcea3);if(_0x2ca6cf)_0x330ad6=_0x2ca6cf[_0x5236b6(0x10f)][_0x5236b6(0x96)],_0x25cd83=_0x2ca6cf[_0x5236b6(0x168)],_0x3c052a=_0x2ca6cf[_0x5236b6(0x168)],_0x4f4db2=a36_0x2ae80a[_0x5236b6(0x14f)](_0x2d6c7b);else return console[_0x5236b6(0x17a)](a36_0x14aa77[_0x5236b6(0xff)](_0x5236b6(0xe9)+_0x2bcea3+'\x0a')),console[_0x5236b6(0x17a)](a36_0x14aa77['cyan']('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;}else _0x330ad6=_0x2d6c7b;}}else{const _0x59d039=tryFindTdxConfig(process[_0x5236b6(0x160)]());_0x59d039?(_0x330ad6=_0x59d039['config'][_0x5236b6(0x96)],_0x3c052a=process[_0x5236b6(0x160)](),_0x25cd83=_0x59d039['configDir']):_0x330ad6=_0x4a863f;}if(!_0x330ad6)return console['error'](a36_0x14aa77[_0x5236b6(0xe0)](_0x5236b6(0x144))),console[_0x5236b6(0x17a)](_0x5236b6(0xfc)),console['error'](_0x5236b6(0x134)),console['error'](_0x5236b6(0x106)),0x1;const _0x3c9721=_0x3c052a||getSegmentRootDir(sanitizeFileName(_0x330ad6)),_0x5ce395=_0x25cd83||_0x3c9721,_0x9bc565=a36_0x2ae80a[_0x5236b6(0xb7)](_0x5ce395,_0x3c9721),_0x15b2a3=_0x9bc565!==''&&_0x9bc565!=='.';if(!existsSync(_0x3c9721))return console[_0x5236b6(0x17a)](a36_0x14aa77['red'](_0x5236b6(0xe4)+_0x3c9721+'\x0a')),console['error'](a36_0x14aa77[_0x5236b6(0xdb)](_0x5236b6(0xdf))),0x1;_0x31d781[_0x5236b6(0xd1)]&&(console[_0x5236b6(0x17a)](_0x5236b6(0x155)+_0x31d781['site']),console[_0x5236b6(0x17a)]('Parent\x20segment:\x20'+_0x330ad6),console[_0x5236b6(0x17a)](_0x5236b6(0x12a)+_0x3c9721),_0x15b2a3&&console['error'](_0x5236b6(0xe1)+_0x9bc565));const _0x13745f=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x330ad6+'\x27...',()=>_0x2d2cc1[_0x5236b6(0xc3)][_0x5236b6(0x127)](_0x330ad6),{'verbose':_0x31d781[_0x5236b6(0xd1)]}),_0x259939=_0x13745f[_0x5236b6(0xd2)],[_0x5c98d8,_0x1bee6f,_0x261501,_0x460d2f,_0x38e2a6]=await Promise[_0x5236b6(0xfd)]([withSpinner(_0x5236b6(0x140),()=>_0x2d2cc1[_0x5236b6(0xc3)][_0x5236b6(0x16b)](_0x259939),{'verbose':_0x31d781[_0x5236b6(0xd1)]}),withSpinner(_0x5236b6(0xf9),()=>_0x2d2cc1[_0x5236b6(0xc3)]['listSegments'](_0x259939),{'verbose':_0x31d781[_0x5236b6(0xd1)]}),withSpinner(_0x5236b6(0xa6),()=>_0x2d2cc1[_0x5236b6(0xc3)]['listFolders'](_0x259939),{'verbose':_0x31d781['verbose']}),withSpinner(_0x5236b6(0x109),()=>_0x2d2cc1[_0x5236b6(0xf4)][_0x5236b6(0x162)](_0x259939),{'verbose':_0x31d781[_0x5236b6(0xd1)]}),withSpinner(_0x5236b6(0x116),()=>_0x2d2cc1[_0x5236b6(0xd9)]['buildUserMaps'](),{'verbose':_0x31d781[_0x5236b6(0xd1)]})[_0x5236b6(0x15c)](_0x525d51=>_0x525d51['data'])]),_0x9a7c84=_0x5c98d8['data'],_0x305bba=_0x9a7c84[_0x5236b6(0xb3)]?.[_0x5236b6(0xbf)]?.['data']?.['id']||_0x9a7c84[_0x5236b6(0xb3)]?.[_0x5236b6(0x130)]?.[_0x5236b6(0xd2)]?.['id'],_0x4719fe=_0x1bee6f[_0x5236b6(0xd2)],_0x532163=_0x261501[_0x5236b6(0xd2)],_0x2985d2=_0x460d2f[_0x5236b6(0xd2)],{emailToId:_0x3de427,idToEmail:_0x5304fc}=_0x38e2a6,[_0x1af15f,_0x57f4a8]=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',async()=>{const _0x27bea8=_0x5236b6,[_0x3d121f,_0x2cb0bd]=await Promise[_0x27bea8(0xfd)]([_0x2d2cc1[_0x27bea8(0xac)]['buildNameToIdMap'](),_0x2d2cc1[_0x27bea8(0xac)]['buildIdToNameMap']()]);return[_0x3d121f,_0x2cb0bd];},{'verbose':_0x31d781['verbose']})['then'](_0x1928ca=>_0x1928ca[_0x5236b6(0xd2)]),_0x35ed4e=buildFolderPathToIdMap(_0x532163),_0x82c039=new Map();for(const [_0x2b0990,_0x5815e5]of _0x35ed4e['entries']()){_0x82c039[_0x5236b6(0x129)](_0x5815e5,_0x2b0990);}const _0x4938f4=new Map();for(const _0x1f3f58 of _0x4719fe){const _0xc10ebd=_0x1f3f58[_0x5236b6(0x137)]?_0x82c039[_0x5236b6(0xe3)](_0x1f3f58[_0x5236b6(0x137)][_0x5236b6(0xa7)]())||'':'',_0x5bf5c1=_0xc10ebd+':'+_0x1f3f58['name'];_0x4938f4[_0x5236b6(0x129)](_0x5bf5c1,_0x1f3f58);}const _0x59114f=new Map();for(const _0x4cecc4 of _0x4719fe){_0x59114f[_0x5236b6(0x129)](_0x4cecc4[_0x5236b6(0x8b)],_0x4cecc4['id']);}const _0x3aeaf2=new Map();for(const _0x25e19c of _0x2985d2){const _0x29f12b=_0x25e19c['folderId']?_0x82c039[_0x5236b6(0xe3)](_0x25e19c[_0x5236b6(0x10a)])||'':'',_0x549d0e=_0x29f12b+':'+_0x25e19c['journeyBundleName'];!_0x3aeaf2[_0x5236b6(0xa4)](_0x549d0e)&&_0x3aeaf2[_0x5236b6(0x129)](_0x549d0e,[]),_0x3aeaf2[_0x5236b6(0xe3)](_0x549d0e)[_0x5236b6(0x177)](_0x25e19c);}for(const _0x39fbcc of _0x3aeaf2[_0x5236b6(0x149)]()){_0x39fbcc[_0x5236b6(0x89)]((_0x30d05a,_0x486efb)=>(_0x30d05a[_0x5236b6(0xeb)]||0x0)-(_0x486efb[_0x5236b6(0xeb)]||0x0));}let _0x3dcd62;if(_0x4f4db2){if(!_0x4f4db2[_0x5236b6(0xb6)](_0x5236b6(0xf1))&&!_0x4f4db2[_0x5236b6(0xb6)](_0x5236b6(0x121)))return console['error'](a36_0x14aa77[_0x5236b6(0xff)](_0x5236b6(0xed)+_0x4f4db2+'\x0a')),0x1;_0x3dcd62=[_0x4f4db2];}else _0x3dcd62=findYamlFiles(_0x3c9721);if(_0x3dcd62['length']===0x0)return console[_0x5236b6(0x17a)](a36_0x14aa77[_0x5236b6(0xff)](_0x5236b6(0x170)+_0x3c9721+'\x0a')),console[_0x5236b6(0x17a)](a36_0x14aa77['cyan']('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files')),0x1;const _0x43f315=[],_0x515ead=[];for(const _0x1ee5e1 of _0x3dcd62){const _0x58a22d=a36_0x2ae80a[_0x5236b6(0xb7)](_0x3c9721,a36_0x2ae80a[_0x5236b6(0xb2)](_0x1ee5e1)),_0x59346d=_0x58a22d==='.'?'':_0x58a22d,_0x4797a8=readFileSync(_0x1ee5e1,_0x5236b6(0x135));try{const _0x2f6da=a36_0x54a4c8['parse'](_0x4797a8);if(isJourneyYaml(_0x2f6da)){const _0x14a17a=a36_0x166334(_0x4797a8);_0x515ead[_0x5236b6(0x177)]({'yamlConfig':_0x14a17a,'folderPath':_0x59346d,'sourcePath':_0x1ee5e1});}else{if(!_0x31d781[_0x5236b6(0x92)]){const _0xe6e65=parseSegmentYamlFile(_0x4797a8),_0x33253f=normalizeChildSegmentYaml(_0xe6e65);_0x43f315[_0x5236b6(0x177)]({'yamlConfig':_0x33253f,'folderPath':_0x59346d,'sourcePath':_0x1ee5e1});}}}catch(_0xac61df){return console[_0x5236b6(0x17a)](a36_0x14aa77['red'](_0x5236b6(0xb8)+_0x1ee5e1+':\x20'+(_0xac61df instanceof Error?_0xac61df[_0x5236b6(0x161)]:_0xac61df))),0x1;}}if(_0x43f315['length']===0x0&&_0x515ead['length']===0x0){const _0x64305f=_0x31d781[_0x5236b6(0x92)]?_0x5236b6(0xf4):_0x5236b6(0x146);return console[_0x5236b6(0x17a)](a36_0x14aa77[_0x5236b6(0xe0)](_0x5236b6(0x148)+_0x64305f+'\x20YAML\x20files\x20found')),0x0;}const _0x1b9ef7=new Map();_0x4719fe['length']>0x0&&!_0x31d781['journeysOnly']&&await withSpinner(_0x5236b6(0xae),async()=>{await batchAsync(_0x4719fe,async _0x2b4d1f=>{const _0x46f49e=a36_0x2e07,_0x55e5ae=await _0x2d2cc1[_0x46f49e(0xc3)][_0x46f49e(0x141)](_0x259939,_0x2b4d1f['id']);_0x1b9ef7[_0x46f49e(0x129)](_0x2b4d1f['id'],_0x55e5ae);});},{'verbose':_0x31d781[_0x5236b6(0xd1)]});const _0x1a8248=[],_0x520d50=new Set();for(const {yamlConfig:_0x629ce8,folderPath:_0x2fe62f,sourcePath:_0x836fa7}of _0x43f315){const _0x4ec3c6=resolveTDFolderPath(_0x2fe62f,_0x15b2a3,_0x9bc565),_0x4a0472=_0x4ec3c6+':'+_0x629ce8[_0x5236b6(0x8b)],_0x245d2e=_0x4938f4[_0x5236b6(0xe3)](_0x4a0472),_0x9f17ce=_0x245d2e?_0x1b9ef7[_0x5236b6(0xe3)](_0x245d2e['id'])||[]:[];if(_0x4ec3c6&&!_0x35ed4e[_0x5236b6(0xa4)](_0x4ec3c6)){const _0x5b8916=_0x4ec3c6[_0x5236b6(0x108)]('/');let _0x243c37='';for(const _0x2116e6 of _0x5b8916){_0x243c37=_0x243c37?_0x243c37+'/'+_0x2116e6:_0x2116e6,!_0x35ed4e[_0x5236b6(0xa4)](_0x243c37)&&_0x520d50[_0x5236b6(0xb1)](_0x243c37);}}const _0x1ff7ce=calculateActivationActions(_0x629ce8['activations']||[],_0x9f17ce,_0x5304fc,_0x57f4a8),_0x4102b3=segmentToYamlString(_0x629ce8);let _0xc1dc11,_0x68bb25=![],_0x5cbbbd;if(_0x245d2e){const _0x12ddb9=segmentWithActivationsToYaml(_0x245d2e,_0x9f17ce,undefined,_0x5304fc,_0x57f4a8),_0x370e8=segmentToYamlString(_0x12ddb9);_0xc1dc11=generateDiff(_0x370e8,_0x4102b3),_0x68bb25=hasChanges(_0xc1dc11),_0x68bb25&&(_0x5cbbbd=formatDiffWithColors(_0xc1dc11));}else _0xc1dc11=generateDiff('',_0x4102b3),_0x5cbbbd=formatDiffWithColors(_0xc1dc11);_0x1a8248[_0x5236b6(0x177)]({'relativePath':_0x629ce8[_0x5236b6(0x8b)],'absolutePath':_0x836fa7,'yamlConfig':_0x629ce8,'folderPath':_0x4ec3c6,'existingSegment':_0x245d2e,'existingActivations':_0x9f17ce,'isNew':!_0x245d2e,'hasChanges':_0x68bb25,'diff':_0x5cbbbd,'activationActions':_0x1ff7ce});}let _0x5834d5=[];if(!_0x4f4db2){const _0x36e44c=new Set();for(const {yamlConfig:_0x14b8c3,folderPath:_0x3cca83}of _0x43f315){const _0x1b4c4b=resolveTDFolderPath(_0x3cca83,_0x15b2a3,_0x9bc565);_0x36e44c[_0x5236b6(0xb1)](_0x1b4c4b+':'+_0x14b8c3['name']);}_0x5834d5=_0x4719fe[_0x5236b6(0xf3)](_0x3ab117=>{const _0x33623a=_0x5236b6,_0x565446=_0x3ab117[_0x33623a(0x137)]?_0x82c039[_0x33623a(0xe3)](_0x3ab117[_0x33623a(0x137)][_0x33623a(0xa7)]())||'':'',_0x272959=_0x565446+':'+_0x3ab117[_0x33623a(0x8b)];if(_0x36e44c[_0x33623a(0xa4)](_0x272959))return![];if(_0x15b2a3)return _0x565446===_0x9bc565||_0x565446[_0x33623a(0x16a)](_0x9bc565+'/');return!![];});}const _0x1e2451=[];for(const {yamlConfig:_0x228363,folderPath:_0x4e9266,sourcePath:_0x317350}of _0x515ead){const _0x5b1609=resolveTDFolderPath(_0x4e9266,_0x15b2a3,_0x9bc565),_0x311a47=_0x5b1609+':'+_0x228363['name'],_0x4ced7f=_0x3aeaf2[_0x5236b6(0xe3)](_0x311a47);let _0x599644,_0x4974c4;if(_0x4ced7f&&_0x4ced7f[_0x5236b6(0x110)]>0x0){const _0x4a5561=new Set(),_0xe69ee5=new Set(),_0x3bc3aa=new Map(),_0x2dfdb7=new Map(),_0x3845e=createJumpTargetCache(),_0x5c0d30=_0x147533=>({'resolveSegment':async _0x14938f=>{const _0x89923=_0x5236b6,_0x4bef28=_0x2dfdb7[_0x89923(0xe3)](_0x14938f);if(_0x4bef28!==undefined)return{'name':_0x4bef28,'isJourneyLocal':!![]};try{let _0x334b26=_0x4719fe[_0x89923(0xc1)](_0x465336=>_0x465336['id']===_0x14938f);!_0x334b26&&(_0x334b26=await _0x2d2cc1[_0x89923(0xc3)][_0x89923(0x172)](_0x259939,_0x14938f));const _0x285be9=generateJourneyLocalName(_0x334b26[_0x89923(0x8b)]),_0x4e89e9=_0x334b26[_0x89923(0x112)]===SEGMENT_KIND_JOURNEY&&_0x285be9!==undefined;let _0x259c16=_0x334b26[_0x89923(0x8b)];if(_0x4e89e9&&_0x285be9){let _0x320f97=_0x285be9,_0x3b815b=0x2;while(_0x4a5561[_0x89923(0xa4)](_0x320f97)){_0x320f97=_0x285be9+'_'+_0x3b815b,_0x3b815b++;}_0x4a5561[_0x89923(0xb1)](_0x320f97),_0x259c16=_0x320f97,_0x2dfdb7[_0x89923(0x129)](_0x14938f,_0x259c16);}let _0x467d87;return _0x4e89e9&&_0x334b26['rule']&&(_0x467d87={'description':_0x334b26[_0x89923(0x15a)],'rule':apiRuleToYaml(_0x334b26[_0x89923(0xf5)])}),{'name':_0x259c16,'isJourneyLocal':_0x4e89e9,'definition':_0x467d87};}catch{return{'name':_0x14938f,'isJourneyLocal':![]};}},'resolveActivation':async _0x58ed50=>{const _0x5538a2=_0x5236b6,_0x1ee52b=_0x3bc3aa['get'](_0x58ed50);if(_0x1ee52b!==undefined)return{'name':_0x1ee52b,'isJourneyLocal':!![]};try{const _0x197e97=await _0x2d2cc1[_0x5538a2(0xf4)][_0x5538a2(0x125)](_0x147533,_0x58ed50),_0x3b0792=_0x197e97[_0x5538a2(0xc6)]['activationParams'][_0x5538a2(0x8b)]||_0x58ed50,_0x1dc0e5=sanitizeYamlKey(_0x3b0792)||_0x5538a2(0xcc)+_0x58ed50;let _0x388ec9=_0x1dc0e5,_0x44d479=0x2;while(_0xe69ee5[_0x5538a2(0xa4)](_0x388ec9)){_0x388ec9=_0x1dc0e5+'_'+_0x44d479,_0x44d479++;}_0xe69ee5[_0x5538a2(0xb1)](_0x388ec9),_0x3bc3aa['set'](_0x58ed50,_0x388ec9);const _0x2d8281=journeyActivationStepToYaml(_0x197e97,_0x5304fc,_0x57f4a8);return{'name':_0x388ec9,'isJourneyLocal':!![],'definition':_0x2d8281};}catch{return{'name':_0x58ed50,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x1ea8ae,_0x12ebd0)=>resolveJumpTarget(_0x1ea8ae,_0x12ebd0,_0x3845e,_0x595641=>_0x2d2cc1['journey'][_0x5236b6(0x179)](_0x595641))}),_0x14b39a=hasMultipleVersions(_0x228363);if(_0x14b39a&&_0x4ced7f[_0x5236b6(0x110)]>0x1){const _0x3c5abc=[];for(const _0x514e42 of _0x4ced7f){const _0x93752e=await withSpinner(_0x5236b6(0x84)+_0x228363[_0x5236b6(0x8b)]+_0x5236b6(0x153)+(_0x514e42[_0x5236b6(0xeb)]||0x1)+_0x5236b6(0x154),()=>_0x2d2cc1['journey'][_0x5236b6(0x179)](_0x514e42['id']),{'verbose':_0x31d781[_0x5236b6(0xd1)]}),_0x100985=_0x5c0d30(_0x514e42['id']),_0x31c7c2=await apiToYamlAsync(_0x93752e[_0x5236b6(0xd2)],_0x100985);_0x3c5abc[_0x5236b6(0x177)]({'item':_0x514e42,'yaml':_0x31c7c2});}_0x4974c4=buildMergedJourneyYaml(_0x3c5abc);const _0x4832c0=Math[_0x5236b6(0x171)](..._0x3c5abc['map'](_0x3f56b5=>_0x3f56b5['item'][_0x5236b6(0xeb)]||0x0)),_0x576ca0=_0x4ced7f[_0x5236b6(0xc1)](_0x45f00f=>(_0x45f00f[_0x5236b6(0xeb)]||0x0)===_0x4832c0);_0x576ca0&&(_0x599644=await _0x2d2cc1[_0x5236b6(0xf4)]['getJourney'](_0x576ca0['id']));}else{const _0x8ec4da=_0x4ced7f[_0x4ced7f[_0x5236b6(0x110)]-0x1],_0x27b091=await withSpinner(_0x5236b6(0x84)+_0x228363['name']+_0x5236b6(0x10b),()=>_0x2d2cc1[_0x5236b6(0xf4)][_0x5236b6(0x179)](_0x8ec4da['id']),{'verbose':_0x31d781['verbose']});_0x599644=_0x27b091[_0x5236b6(0xd2)];const _0x3e33e3=_0x5c0d30(_0x8ec4da['id']);_0x4974c4=await apiToYamlAsync(_0x599644,_0x3e33e3);}}if(_0x5b1609&&!_0x35ed4e[_0x5236b6(0xa4)](_0x5b1609)){const _0x3e7a4b=_0x5b1609[_0x5236b6(0x108)]('/');let _0x5f0974='';for(const _0x9f0c4d of _0x3e7a4b){_0x5f0974=_0x5f0974?_0x5f0974+'/'+_0x9f0c4d:_0x9f0c4d,!_0x35ed4e[_0x5236b6(0xa4)](_0x5f0974)&&_0x520d50[_0x5236b6(0xb1)](_0x5f0974);}}const _0x531816=normalizeJourneyYaml(_0x228363),_0x12a0d7=a36_0x28cad5(_0x531816);let _0xe8681a=![],_0x558820;if(_0x4974c4){const _0x1e4ba8=normalizeJourneyYaml(_0x4974c4),_0x353630=a36_0x28cad5(_0x1e4ba8),_0x2debea=generateDiff(_0x353630,_0x12a0d7);_0xe8681a=hasChanges(_0x2debea),_0xe8681a&&(_0x558820=formatDiffWithColors(_0x2debea));}else{const _0x5b5bce=generateDiff('',_0x12a0d7);_0x558820=formatDiffWithColors(_0x5b5bce);}_0x1e2451['push']({'relativePath':_0x228363[_0x5236b6(0x8b)],'absolutePath':_0x317350,'yamlConfig':_0x228363,'folderPath':_0x5b1609,'existingJourney':_0x599644,'isNew':!_0x599644,'hasChanges':_0xe8681a,'diff':_0x558820});}let _0x412f0b=[];if(!_0x4f4db2){const _0x3810d4=new Set();for(const {yamlConfig:_0x4091c5,folderPath:_0x2b4eec}of _0x515ead){const _0x319bdb=resolveTDFolderPath(_0x2b4eec,_0x15b2a3,_0x9bc565);_0x3810d4['add'](_0x319bdb+':'+_0x4091c5[_0x5236b6(0x8b)]);}_0x412f0b=_0x2985d2[_0x5236b6(0xf3)](_0x1c7cc9=>{const _0x47d19b=_0x5236b6,_0x3381e7=_0x1c7cc9[_0x47d19b(0x10a)]?_0x82c039[_0x47d19b(0xe3)](_0x1c7cc9[_0x47d19b(0x10a)])||'':'',_0x3df948=_0x3381e7+':'+_0x1c7cc9[_0x47d19b(0x13e)];if(_0x3810d4[_0x47d19b(0xa4)](_0x3df948))return![];if(_0x15b2a3)return _0x3381e7===_0x9bc565||_0x3381e7[_0x47d19b(0x16a)](_0x9bc565+'/');return!![];});}const _0x240648=_0x1a8248['filter'](_0x4586a4=>_0x4586a4[_0x5236b6(0xca)]),_0x17ad4b=_0x1a8248[_0x5236b6(0xf3)](_0x289128=>!_0x289128['isNew']&&_0x289128['hasChanges']),_0x2375da=_0x1a8248['filter'](_0x3a4c7a=>!_0x3a4c7a['isNew']&&!_0x3a4c7a[_0x5236b6(0x93)]),_0x4bf9c5=Array[_0x5236b6(0xa0)](_0x520d50)[_0x5236b6(0x89)](),_0x39c4c6=_0x31d781[_0x5236b6(0x174)]?_0x5834d5:[],_0x295b53=_0x31d781[_0x5236b6(0x174)]?_0x412f0b:[],_0x41c30b=_0x1a8248[_0x5236b6(0x14c)](_0x31ec06=>_0x31ec06[_0x5236b6(0x11c)]),_0x3258e9=_0x41c30b[_0x5236b6(0xf3)](_0x25fd51=>_0x25fd51[_0x5236b6(0x142)]===_0x5236b6(0x15b)),_0x592f65=_0x41c30b[_0x5236b6(0xf3)](_0x2707e7=>_0x2707e7[_0x5236b6(0x142)]===_0x5236b6(0xb5)),_0x2c6bc5=_0x41c30b[_0x5236b6(0xf3)](_0x1161b0=>_0x1161b0[_0x5236b6(0x142)]===_0x5236b6(0x174)),_0x115291=_0x1e2451[_0x5236b6(0xf3)](_0x27ee53=>_0x27ee53[_0x5236b6(0xca)]),_0x39066e=_0x1e2451['filter'](_0x4c89ff=>!_0x4c89ff[_0x5236b6(0xca)]&&_0x4c89ff['hasChanges']),_0x1e6bba=_0x1e2451[_0x5236b6(0xf3)](_0x35ab30=>!_0x35ab30[_0x5236b6(0xca)]&&!_0x35ab30['hasChanges']);console[_0x5236b6(0x17a)]('\x0aPush\x20summary\x20for\x20\x27'+_0x330ad6+'\x27:');_0x4bf9c5[_0x5236b6(0x110)]>0x0&&console[_0x5236b6(0x17a)]('\x20\x20'+a36_0x14aa77['blue'](_0x5236b6(0x158)+_0x4bf9c5['length']+_0x5236b6(0x14e)));if(!_0x31d781[_0x5236b6(0x92)]){console[_0x5236b6(0x17a)]('\x20\x20📊\x20Segments:'),console['error'](_0x5236b6(0x151)+a36_0x14aa77['green']('+\x20'+_0x240648[_0x5236b6(0x110)]+_0x5236b6(0xd0))),console[_0x5236b6(0x17a)](_0x5236b6(0x151)+a36_0x14aa77['yellow']('~\x20'+_0x17ad4b['length']+_0x5236b6(0x107)));if(_0x39c4c6['length']>0x0)console['error']('\x20\x20\x20\x20'+a36_0x14aa77[_0x5236b6(0xff)]('-\x20'+_0x39c4c6[_0x5236b6(0x110)]+'\x20to\x20delete'));else _0x5834d5[_0x5236b6(0x110)]>0x0&&!_0x31d781[_0x5236b6(0x174)]&&console[_0x5236b6(0x17a)]('\x20\x20\x20\x20'+a36_0x14aa77[_0x5236b6(0xef)](_0x5834d5[_0x5236b6(0x110)]+_0x5236b6(0x9b)));console[_0x5236b6(0x17a)](_0x5236b6(0x151)+a36_0x14aa77[_0x5236b6(0xef)]('=\x20'+_0x2375da[_0x5236b6(0x110)]+_0x5236b6(0xba)));}if(_0x1e2451[_0x5236b6(0x110)]>0x0||_0x412f0b[_0x5236b6(0x110)]>0x0){console[_0x5236b6(0x17a)](_0x5236b6(0xbd)),console[_0x5236b6(0x17a)](_0x5236b6(0x151)+a36_0x14aa77[_0x5236b6(0x114)]('+\x20'+_0x115291[_0x5236b6(0x110)]+_0x5236b6(0xd0))),console[_0x5236b6(0x17a)](_0x5236b6(0x151)+a36_0x14aa77[_0x5236b6(0xe0)]('~\x20'+_0x39066e[_0x5236b6(0x110)]+_0x5236b6(0x107)));if(_0x295b53[_0x5236b6(0x110)]>0x0)console['error'](_0x5236b6(0x151)+a36_0x14aa77[_0x5236b6(0xff)]('-\x20'+_0x295b53[_0x5236b6(0x110)]+_0x5236b6(0x105)));else _0x412f0b[_0x5236b6(0x110)]>0x0&&!_0x31d781[_0x5236b6(0x174)]&&console['error'](_0x5236b6(0x151)+a36_0x14aa77[_0x5236b6(0xef)](_0x412f0b[_0x5236b6(0x110)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x5236b6(0x17a)](_0x5236b6(0x151)+a36_0x14aa77[_0x5236b6(0xef)]('=\x20'+_0x1e6bba[_0x5236b6(0x110)]+_0x5236b6(0xba)));}_0x41c30b['length']>0x0&&!_0x31d781[_0x5236b6(0x92)]&&(console[_0x5236b6(0x17a)](''),console['error'](_0x5236b6(0x98)),_0x3258e9[_0x5236b6(0x110)]>0x0&&console['error'](_0x5236b6(0x151)+a36_0x14aa77[_0x5236b6(0x114)]('+\x20'+_0x3258e9['length']+_0x5236b6(0xd8))),_0x592f65['length']>0x0&&console[_0x5236b6(0x17a)](_0x5236b6(0x151)+a36_0x14aa77[_0x5236b6(0xe0)]('~\x20'+_0x592f65[_0x5236b6(0x110)]+_0x5236b6(0x118))),_0x2c6bc5[_0x5236b6(0x110)]>0x0&&console[_0x5236b6(0x17a)](_0x5236b6(0x151)+a36_0x14aa77['red']('-\x20'+_0x2c6bc5[_0x5236b6(0x110)]+_0x5236b6(0x105))));console[_0x5236b6(0x17a)](_0x5236b6(0x165)+a36_0x14aa77['cyan'](_0x3c9721)+'\x0a');if(_0x4bf9c5[_0x5236b6(0x110)]>0x0){console['error'](_0x5236b6(0x102));for(const _0x4a00e9 of _0x4bf9c5){console[_0x5236b6(0x17a)]('\x20\x20'+a36_0x14aa77[_0x5236b6(0x16e)]('+')+'\x20'+_0x4a00e9);}console[_0x5236b6(0x17a)]('');}if(_0x240648[_0x5236b6(0x110)]>0x0&&!_0x31d781['journeysOnly'])for(const _0xd7eb71 of _0x240648){const _0x2c327e=_0xd7eb71[_0x5236b6(0xc4)]?_0xd7eb71['folderPath']+'/'+_0xd7eb71[_0x5236b6(0x131)]['name']:_0xd7eb71['yamlConfig']['name'],_0x5a1372=_0xd7eb71[_0x5236b6(0x131)][_0x5236b6(0x99)]?.[_0x5236b6(0x110)]||0x0,_0x57bde4=_0x5a1372>0x0?a36_0x14aa77[_0x5236b6(0xef)]('\x20['+_0x5a1372+_0x5236b6(0x8d)):'';console[_0x5236b6(0x17a)]('\x0a'+a36_0x14aa77[_0x5236b6(0x114)](_0x5236b6(0x16d))+'\x20'+_0x2c327e+_0x57bde4),console[_0x5236b6(0x17a)]('─'['repeat'](0x3c)),_0xd7eb71[_0x5236b6(0xfe)]&&console['error'](_0xd7eb71['diff']),console[_0x5236b6(0x17a)]('─'[_0x5236b6(0x14d)](0x3c));}if(_0x39c4c6[_0x5236b6(0x110)]>0x0&&!_0x31d781[_0x5236b6(0x92)])for(const _0x2d1ba0 of _0x39c4c6){const _0x93c82b=_0x2d1ba0['segmentFolderId']?_0x82c039[_0x5236b6(0xe3)](_0x2d1ba0[_0x5236b6(0x137)]['toString']())||'':'',_0x3d972c=_0x93c82b?_0x93c82b+'/'+_0x2d1ba0['name']:_0x2d1ba0[_0x5236b6(0x8b)],_0x54f838=_0x1b9ef7[_0x5236b6(0xe3)](_0x2d1ba0['id'])||[],_0x47df2c=_0x54f838[_0x5236b6(0x110)]>0x0?a36_0x14aa77[_0x5236b6(0xef)]('\x20['+_0x54f838[_0x5236b6(0x110)]+_0x5236b6(0x8d)):'';console[_0x5236b6(0x17a)]('\x0a'+a36_0x14aa77[_0x5236b6(0xff)](_0x5236b6(0x13c))+'\x20'+_0x3d972c+_0x47df2c),console['error']('─'[_0x5236b6(0x14d)](0x3c));const _0x7a0217=segmentWithActivationsToYaml(_0x2d1ba0,_0x54f838,undefined,_0x5304fc,_0x57f4a8),_0x5f258d=segmentToYamlString(_0x7a0217),_0x26ec6b=generateDiff(_0x5f258d,'');console['error'](formatDiffWithColors(_0x26ec6b)),console['error']('─'[_0x5236b6(0x14d)](0x3c));}const _0x185406=_0x1a8248[_0x5236b6(0xf3)](_0x27a70b=>!_0x27a70b[_0x5236b6(0xca)]&&_0x27a70b[_0x5236b6(0xfe)]);if(_0x185406[_0x5236b6(0x110)]>0x0&&!_0x31d781['journeysOnly'])for(const _0x1abacb of _0x185406){const _0x432522=_0x1abacb[_0x5236b6(0xc4)]?_0x1abacb[_0x5236b6(0xc4)]+'/'+_0x1abacb[_0x5236b6(0x131)][_0x5236b6(0x8b)]:_0x1abacb[_0x5236b6(0x131)][_0x5236b6(0x8b)];console[_0x5236b6(0x17a)]('\x0a'+a36_0x14aa77[_0x5236b6(0xe0)](_0x5236b6(0x143))+'\x20'+_0x432522),console[_0x5236b6(0x17a)]('─'[_0x5236b6(0x14d)](0x3c)),console['error'](_0x1abacb[_0x5236b6(0xfe)]),console[_0x5236b6(0x17a)]('─'[_0x5236b6(0x14d)](0x3c));}if(_0x115291[_0x5236b6(0x110)]>0x0)for(const _0x23f238 of _0x115291){const _0x5f291b=_0x23f238[_0x5236b6(0xc4)]?_0x23f238['folderPath']+'/'+_0x23f238[_0x5236b6(0x131)][_0x5236b6(0x8b)]:_0x23f238[_0x5236b6(0x131)]['name'];console[_0x5236b6(0x17a)]('\x0a'+a36_0x14aa77[_0x5236b6(0x114)]('New\x20journey:')+'\x20'+_0x5f291b),console[_0x5236b6(0x17a)]('─'[_0x5236b6(0x14d)](0x3c)),_0x23f238[_0x5236b6(0xfe)]&&console[_0x5236b6(0x17a)](_0x23f238[_0x5236b6(0xfe)]),console[_0x5236b6(0x17a)]('─'[_0x5236b6(0x14d)](0x3c));}const _0x246a47=_0x1e2451[_0x5236b6(0xf3)](_0x272188=>!_0x272188[_0x5236b6(0xca)]&&_0x272188['diff']);if(_0x246a47[_0x5236b6(0x110)]>0x0)for(const _0x48c107 of _0x246a47){const _0x3aae54=_0x48c107[_0x5236b6(0xc4)]?_0x48c107['folderPath']+'/'+_0x48c107['yamlConfig'][_0x5236b6(0x8b)]:_0x48c107[_0x5236b6(0x131)]['name'];console[_0x5236b6(0x17a)]('\x0a'+a36_0x14aa77[_0x5236b6(0xe0)]('Changes\x20to\x20journey:')+'\x20'+_0x3aae54),console[_0x5236b6(0x17a)]('─'[_0x5236b6(0x14d)](0x3c)),console[_0x5236b6(0x17a)](_0x48c107[_0x5236b6(0xfe)]),console[_0x5236b6(0x17a)]('─'[_0x5236b6(0x14d)](0x3c));}if(_0x295b53['length']>0x0)for(const _0x412b70 of _0x295b53){const _0xb11da3=_0x412b70[_0x5236b6(0x10a)]?_0x82c039['get'](_0x412b70['folderId'])||'':'',_0x274270=_0xb11da3?_0xb11da3+'/'+_0x412b70[_0x5236b6(0x13e)]:_0x412b70[_0x5236b6(0x13e)];console['error']('\x0a'+a36_0x14aa77[_0x5236b6(0xff)](_0x5236b6(0xc7))+'\x20'+_0x274270),console[_0x5236b6(0x17a)]('─'[_0x5236b6(0x14d)](0x3c)),console[_0x5236b6(0x17a)](a36_0x14aa77['red'](_0x5236b6(0x86))),console[_0x5236b6(0x17a)]('─'[_0x5236b6(0x14d)](0x3c));}if(_0x31d781[_0x5236b6(0x101)])return console[_0x5236b6(0x17a)](a36_0x14aa77[_0x5236b6(0xe0)](_0x5236b6(0x167))),0x0;const _0x1ef9c5=_0x31d781[_0x5236b6(0x92)]?![]:_0x240648[_0x5236b6(0x110)]>0x0||_0x17ad4b[_0x5236b6(0x110)]>0x0||_0x39c4c6[_0x5236b6(0x110)]>0x0,_0x3d54b0=_0x115291['length']>0x0||_0x39066e['length']>0x0||_0x295b53[_0x5236b6(0x110)]>0x0,_0x768976=_0x31d781['journeysOnly']?![]:_0x41c30b[_0x5236b6(0x110)]>0x0,_0x4fceb8=_0x4bf9c5[_0x5236b6(0x110)]>0x0;if(!_0x1ef9c5&&!_0x3d54b0&&!_0x768976&&!_0x4fceb8){const _0x2064e1=_0x31d781['journeysOnly']?_0x5236b6(0xa9):'✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date';console[_0x5236b6(0x17a)](a36_0x14aa77[_0x5236b6(0x114)](_0x2064e1));if(_0x4f4db2&&_0x1e6bba[_0x5236b6(0x110)]===0x1){const _0x5bd274=_0x1e6bba[0x0];if(_0x5bd274['existingJourney']?.['id']){const _0x337fc8=getConsoleNextUrl(_0x31d781[_0x5236b6(0x115)],_0x5236b6(0x175)+_0x259939+_0x5236b6(0x138)+_0x5bd274[_0x5236b6(0x9e)]['id']+'/j/da/je');console[_0x5236b6(0x17a)]('\x20\x20'+a36_0x14aa77[_0x5236b6(0xdb)](_0x337fc8));}}return 0x0;}const _0x5db71e=_0x31d781[_0x5236b6(0x92)]?_0x115291[_0x5236b6(0x110)]+_0x39066e[_0x5236b6(0x110)]+_0x295b53['length']+_0x4bf9c5[_0x5236b6(0x110)]:_0x240648[_0x5236b6(0x110)]+_0x17ad4b[_0x5236b6(0x110)]+_0x39c4c6['length']+_0x115291[_0x5236b6(0x110)]+_0x39066e[_0x5236b6(0x110)]+_0x295b53['length']+_0x4bf9c5['length']+_0x41c30b['length'];if(!_0x31d781[_0x5236b6(0x16f)]&&_0x5db71e>0x0){const _0x4743b3=await confirmKey(_0x5236b6(0x100)+_0x5db71e+_0x5236b6(0xe7));if(!_0x4743b3)return console[_0x5236b6(0x17a)](_0x5236b6(0xce)),0x1;}for(const _0x888d46 of _0x4bf9c5){const _0x478b4c=_0x888d46[_0x5236b6(0x108)]('/'),_0xd72fbc=_0x478b4c[_0x478b4c[_0x5236b6(0x110)]-0x1],_0x156293=_0x478b4c[_0x5236b6(0x159)](0x0,-0x1)[_0x5236b6(0xcf)]('/'),_0x6c92a8=_0x35ed4e[_0x5236b6(0xe3)](_0x156293),_0x4425fb={'name':_0xd72fbc,'parentFolderId':_0x6c92a8},_0x48d639=await withSpinner(_0x5236b6(0x88)+_0x888d46+_0x5236b6(0xe6),()=>_0x2d2cc1['segment'][_0x5236b6(0xda)](_0x259939,_0x4425fb),{'verbose':_0x31d781['verbose']});_0x35ed4e[_0x5236b6(0x129)](_0x888d46,_0x48d639[_0x5236b6(0xd2)]['id']),console['error'](a36_0x14aa77[_0x5236b6(0x16e)](_0x5236b6(0x15f)+_0x888d46+'\x27'));}let _0x4758e=0x0,_0xdf1352=0x0,_0x5bcc2d=0x0,_0x322b00=0x0,_0x46e7ef=0x0,_0x57e467=0x0;const _0x3c1c96=new Map();for(const _0x5f4d11 of _0x31d781[_0x5236b6(0x92)]?[]:_0x1a8248){const _0x351925=_0x5f4d11[_0x5236b6(0xc4)]?_0x35ed4e[_0x5236b6(0xe3)](_0x5f4d11[_0x5236b6(0xc4)]):undefined;let _0x902148;try{if(_0x5f4d11[_0x5236b6(0xca)]){const _0x286a86=yamlToCreateRequest(_0x5f4d11[_0x5236b6(0x131)],_0x351925),_0x4a8f42=await withSpinner(_0x5236b6(0x136)+_0x5f4d11[_0x5236b6(0x131)][_0x5236b6(0x8b)]+_0x5236b6(0xe6),()=>_0x2d2cc1[_0x5236b6(0xc3)]['createSegment'](_0x259939,_0x286a86),{'verbose':_0x31d781[_0x5236b6(0xd1)]});_0x902148=_0x4a8f42[_0x5236b6(0xd2)]['id'],_0x3c1c96[_0x5236b6(0x129)](_0x5f4d11[_0x5236b6(0x131)]['name'],_0x902148),console['error'](a36_0x14aa77[_0x5236b6(0x114)]('✔\x20Created\x20segment\x20\x27'+_0x5f4d11[_0x5236b6(0x131)][_0x5236b6(0x8b)]+'\x27')),_0x4758e++;}else{if(_0x5f4d11[_0x5236b6(0x93)]){const _0x476135=yamlToUpdateRequest(_0x5f4d11[_0x5236b6(0x131)]);_0x351925!==_0x5f4d11[_0x5236b6(0x128)]?.[_0x5236b6(0x137)]&&(_0x476135['segmentFolderId']=_0x351925?parseInt(_0x351925,0xa):undefined),await withSpinner('Updating\x20segment\x20\x27'+_0x5f4d11[_0x5236b6(0x131)]['name']+_0x5236b6(0xe6),()=>_0x2d2cc1[_0x5236b6(0xc3)][_0x5236b6(0xa1)](_0x259939,_0x5f4d11[_0x5236b6(0x128)]['id'],_0x476135),{'verbose':_0x31d781['verbose']}),_0x902148=_0x5f4d11[_0x5236b6(0x128)]['id'],console[_0x5236b6(0x17a)](a36_0x14aa77[_0x5236b6(0xe0)](_0x5236b6(0xbe)+_0x5f4d11[_0x5236b6(0x131)][_0x5236b6(0x8b)]+'\x27')),_0xdf1352++;}else _0x902148=_0x5f4d11[_0x5236b6(0x128)]['id'];}}catch(_0xe64047){const _0x3a85cc=isHttp400Error(_0xe64047),_0x51364e=_0x3a85cc?ErrorCode[_0x5236b6(0x119)]:ErrorCode[_0x5236b6(0xb9)],_0x2178e6=getErrorMessage(_0xe64047);throw new SDKError(_0x51364e,_0x5236b6(0xab)+(_0x5f4d11[_0x5236b6(0xca)]?_0x5236b6(0x15b):_0x5236b6(0xb5))+'\x20segment\x20from\x20file:\x20'+_0x5f4d11[_0x5236b6(0xc8)]+'\x0a\x20\x20'+_0x2178e6,_0xe64047);}for(const _0x1d924c of _0x5f4d11['activationActions']){try{if(_0x1d924c[_0x5236b6(0x142)]===_0x5236b6(0x15b)&&_0x1d924c[_0x5236b6(0xa5)]){const _0x4b1132=yamlActivationToCreateRequest(_0x1d924c[_0x5236b6(0xa5)],_0x3de427,_0x1af15f);await withSpinner(_0x5236b6(0x176)+_0x1d924c[_0x5236b6(0x8b)]+'\x27...',()=>_0x2d2cc1['segment']['createActivation'](_0x259939,_0x902148,_0x4b1132),{'verbose':_0x31d781['verbose']}),console['error'](a36_0x14aa77[_0x5236b6(0x114)]('\x20\x20✔\x20Created\x20activation\x20\x27'+_0x1d924c[_0x5236b6(0x8b)]+'\x27')),_0x322b00++;}else{if(_0x1d924c[_0x5236b6(0x142)]===_0x5236b6(0xb5)&&_0x1d924c[_0x5236b6(0xa5)]&&_0x1d924c[_0x5236b6(0x9c)]){const _0x3f65db=yamlActivationToUpdateRequest(_0x1d924c[_0x5236b6(0xa5)],_0x3de427,_0x1af15f);await withSpinner(_0x5236b6(0x9a)+_0x1d924c[_0x5236b6(0x8b)]+_0x5236b6(0xe6),()=>_0x2d2cc1[_0x5236b6(0xc3)]['updateActivation'](_0x259939,_0x902148,_0x1d924c[_0x5236b6(0x9c)]['id'],_0x3f65db),{'verbose':_0x31d781['verbose']}),console['error'](a36_0x14aa77[_0x5236b6(0xe0)](_0x5236b6(0xc0)+_0x1d924c['name']+'\x27')),_0x46e7ef++;}else _0x1d924c[_0x5236b6(0x142)]===_0x5236b6(0x174)&&_0x1d924c[_0x5236b6(0x9c)]&&(await withSpinner(_0x5236b6(0x16c)+_0x1d924c[_0x5236b6(0x8b)]+_0x5236b6(0xe6),()=>_0x2d2cc1[_0x5236b6(0xc3)][_0x5236b6(0x15d)](_0x259939,_0x902148,_0x1d924c[_0x5236b6(0x9c)]['id']),{'verbose':_0x31d781[_0x5236b6(0xd1)]}),console[_0x5236b6(0x17a)](a36_0x14aa77[_0x5236b6(0xff)](_0x5236b6(0x9f)+_0x1d924c[_0x5236b6(0x8b)]+'\x27')),_0x57e467++);}}catch(_0xd9f6fa){const _0x7cca5e=isHttp400Error(_0xd9f6fa),_0x26531b=_0x7cca5e?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x45acbd=getErrorMessage(_0xd9f6fa);throw new SDKError(_0x26531b,'Failed\x20to\x20'+_0x1d924c['type']+_0x5236b6(0x14b)+_0x1d924c[_0x5236b6(0x8b)]+'\x27\x20from\x20file:\x20'+_0x5f4d11[_0x5236b6(0xc8)]+_0x5236b6(0x12d)+_0x45acbd,_0xd9f6fa);}}}for(const _0x38b49a of _0x31d781[_0x5236b6(0x92)]?[]:_0x39c4c6){await withSpinner(_0x5236b6(0x8c)+_0x38b49a[_0x5236b6(0x8b)]+'\x27...',()=>_0x2d2cc1[_0x5236b6(0xc3)]['deleteSegment'](_0x38b49a['id']),{'verbose':_0x31d781[_0x5236b6(0xd1)]}),console[_0x5236b6(0x17a)](a36_0x14aa77['red'](_0x5236b6(0x13f)+_0x38b49a[_0x5236b6(0x8b)]+'\x27')),_0x5bcc2d++;}let _0x34d4fd=0x0,_0x14eef1=0x0,_0x2747ca=0x0;const _0x3a1fb8=new Map(_0x59114f);for(const _0xf2f11a of _0x1a8248){_0xf2f11a[_0x5236b6(0xca)]&&_0x3c1c96[_0x5236b6(0xa4)](_0xf2f11a[_0x5236b6(0x131)]['name'])&&_0x3a1fb8['set'](_0xf2f11a[_0x5236b6(0x131)]['name'],_0x3c1c96[_0x5236b6(0xe3)](_0xf2f11a[_0x5236b6(0x131)][_0x5236b6(0x8b)]));}if(_0x1e2451['length']>0x0){const _0x5adce5=await withQuerySpinner(_0x5236b6(0x13b),async _0x53c66c=>{const _0x4f1d02=_0x5236b6,_0x47e881=[];let _0x45274c=0x0;const _0x3637b2=0x5;for(let _0x53808c=0x0;_0x53808c<_0x1e2451[_0x4f1d02(0x110)];_0x53808c+=_0x3637b2){const _0x26b226=_0x1e2451[_0x4f1d02(0x159)](_0x53808c,_0x53808c+_0x3637b2),_0x416f44=await Promise[_0x4f1d02(0xfd)](_0x26b226[_0x4f1d02(0xf6)](async _0xab5155=>{const _0x463fe4=_0x4f1d02;if(!_0xab5155[_0x463fe4(0xca)]&&!_0xab5155[_0x463fe4(0x93)])return{'action':_0x463fe4(0xf7),'name':_0xab5155['yamlConfig'][_0x463fe4(0x8b)],'journeyId':_0xab5155['existingJourney']?.['id']};const _0x2f3065=_0xab5155[_0x463fe4(0xc4)]?_0x35ed4e[_0x463fe4(0xe3)](_0xab5155[_0x463fe4(0xc4)]):undefined,_0xa92f69=_0xab5155[_0x463fe4(0xca)]?_0x463fe4(0x103):_0x463fe4(0x13a);_0x53c66c[_0x463fe4(0xfa)](_0xa92f69+_0x463fe4(0xec)+_0xab5155[_0x463fe4(0x131)][_0x463fe4(0x8b)]+'\x27');const _0x407e74=new Map(),_0x31677c=new Map(),_0x2a2f04=new Map(),_0x52adb2={'resolveSegmentId':async _0x54fe3e=>{const _0x2700f7=_0x463fe4,_0x41facd=_0x3a1fb8[_0x2700f7(0xe3)](_0x54fe3e);if(!_0x41facd)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20not\x20found:\x20'+_0x54fe3e+_0x2700f7(0x90)+_0xab5155[_0x2700f7(0x131)][_0x2700f7(0x8b)]+')');return _0x41facd;},'resolveEmbeddedSegmentId':async(_0x570534,_0x486e16)=>{const _0x291c4a=_0x463fe4,_0x5b0f57=_0x3a1fb8['get'](_0x570534);if(_0x5b0f57)return _0x5b0f57;const _0x4556b4=_0x4719fe[_0x291c4a(0xc1)](_0x3fddf9=>_0x3fddf9['name']===_0x570534);if(_0x4556b4)return _0x3a1fb8[_0x291c4a(0x129)](_0x570534,_0x4556b4['id']),_0x4556b4['id'];if(_0xab5155[_0x291c4a(0xca)]){const _0x59f8f2=_0xab5155['yamlConfig']['stages']||_0xab5155[_0x291c4a(0x131)]['journeys']?.[0x0]?.[_0x291c4a(0xea)]||[];let _0x397cbc=_0x291c4a(0x150),_0x15bb79=_0x570534;for(const _0x3d99d5 of _0x59f8f2){if(_0x3d99d5[_0x291c4a(0x8a)]?.[_0x291c4a(0xc3)]===_0x570534){_0x397cbc=_0x3d99d5[_0x291c4a(0x8b)],_0x15bb79=_0x3d99d5['entry_criteria'][_0x291c4a(0x8b)]||_0x570534;break;}}return _0x31677c['set'](_0x570534,{'definition':_0x486e16,'stageName':_0x397cbc,'criteriaName':_0x15bb79}),createPendingSegmentId(_0x570534);}const _0x300861=_0xab5155['existingJourney']?.['id'];if(!_0x300861)throw new SDKError(ErrorCode[_0x291c4a(0x95)],_0x291c4a(0xc2));const _0x2f88f4=_0x291c4a(0x8e)+crypto[_0x291c4a(0x124)]();try{const _0x2a5a74=await _0x2d2cc1[_0x291c4a(0xc3)]['createJourneySegment']({'name':_0x2f88f4,'description':_0x486e16['description']||_0x291c4a(0x97)+_0x570534,'journeyId':_0x300861,'rule':yamlRuleToApi(_0x486e16[_0x291c4a(0xf5)],!![]),'countPopulation':!![],'parentFolderId':_0x305bba||'','audienceId':_0x259939});return _0x31d781[_0x291c4a(0xd1)]&&console['error'](_0x291c4a(0x85)+_0x570534+_0x291c4a(0x12e)+_0x2f88f4+_0x291c4a(0xbc)+_0x2a5a74),_0x3a1fb8[_0x291c4a(0x129)](_0x570534,_0x2a5a74),_0x2a5a74;}catch(_0x173831){throw new SDKError(ErrorCode[_0x291c4a(0xb9)],_0x291c4a(0xe2)+_0x570534+_0x291c4a(0x83)+getErrorMessage(_0x173831),_0x173831);}},'resolveActivationId':async _0x181d22=>{const _0x428f61=_0x463fe4,_0x192c82=_0x407e74[_0x428f61(0xe3)](_0x181d22);if(_0x192c82)return _0x192c82;if(_0xab5155[_0x428f61(0x9e)]){const _0x3541c8=await _0x2d2cc1['journey'][_0x428f61(0x141)](_0xab5155[_0x428f61(0x9e)]['id']),_0x1310c6=_0x3541c8[_0x428f61(0xc1)](_0x35037f=>_0x35037f[_0x428f61(0xc6)]['activationParams']?.[_0x428f61(0x8b)]===_0x181d22);if(_0x1310c6)return _0x407e74[_0x428f61(0x129)](_0x181d22,_0x1310c6['id']),_0x1310c6['id'];}throw new SDKError(ErrorCode[_0x428f61(0x113)],_0x428f61(0x120)+_0x181d22+_0x428f61(0x90)+_0xab5155[_0x428f61(0x131)]['name']+').\x20'+_0x428f61(0x132));},'resolveEmbeddedActivationId':async(_0x3eecce,_0x514936)=>{const _0x4b3e62=_0x463fe4,_0x36f27e=_0x407e74['get'](_0x3eecce);if(_0x36f27e)return _0x36f27e;if(_0xab5155[_0x4b3e62(0xca)])return _0x2a2f04[_0x4b3e62(0x129)](_0x3eecce,_0x514936),createPendingActivationId(_0x3eecce);if(_0xab5155[_0x4b3e62(0x9e)]){const _0x39a263=await _0x2d2cc1[_0x4b3e62(0xf4)][_0x4b3e62(0x141)](_0xab5155['existingJourney']['id']),_0x1474f8=_0x39a263[_0x4b3e62(0xc1)](_0x385ad4=>_0x385ad4[_0x4b3e62(0xc6)][_0x4b3e62(0xaa)]?.['name']===_0x514936['name']);if(_0x1474f8)return _0x407e74[_0x4b3e62(0x129)](_0x3eecce,_0x1474f8['id']),_0x1474f8['id'];try{const _0x2ab39a=yamlActivationToCreateRequest(_0x514936,_0x3de427,_0x1af15f),_0xd9790e=await _0x2d2cc1[_0x4b3e62(0xf4)][_0x4b3e62(0x133)](_0xab5155['existingJourney']['id'],_0x2ab39a);return _0x31d781['verbose']&&console[_0x4b3e62(0x17a)](_0x4b3e62(0xfb)+_0x3eecce+_0x4b3e62(0xc5)+_0xd9790e['id']),_0x407e74['set'](_0x3eecce,_0xd9790e['id']),_0xd9790e['id'];}catch(_0x105f67){throw new SDKError(ErrorCode[_0x4b3e62(0xcd)],_0x4b3e62(0xb0)+_0x3eecce+_0x4b3e62(0x83)+getErrorMessage(_0x105f67),_0x105f67);}}throw new SDKError(ErrorCode[_0x4b3e62(0x95)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x3a5ace=>{const _0x306b1a=_0x463fe4;try{return await _0x2d2cc1[_0x306b1a(0xf4)][_0x306b1a(0x173)](_0x259939,_0x3a5ace);}catch(_0x30e09a){throw new SDKError(ErrorCode[_0x306b1a(0x113)],_0x306b1a(0x14a)+_0x3a5ace+_0x306b1a(0x123)+_0xab5155[_0x306b1a(0x131)][_0x306b1a(0x8b)]+'\x27)',_0x30e09a);}},'resolveStageId':async(_0x523977,_0x40acc)=>{const _0x40fc07=_0x463fe4,_0x154838=await _0x2d2cc1[_0x40fc07(0xf4)][_0x40fc07(0x179)](_0x523977),_0x2d617b=_0x154838[_0x40fc07(0xc6)]['journeyStages']['find'](_0x2a717d=>_0x2a717d[_0x40fc07(0x8b)][_0x40fc07(0xa8)]()===_0x40acc[_0x40fc07(0xa8)]());if(!_0x2d617b?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],_0x40fc07(0xb4)+_0x40acc+_0x40fc07(0xa2)+(_0x154838[_0x40fc07(0xc6)][_0x40fc07(0x13e)]||_0x154838['attributes'][_0x40fc07(0x8b)])+'\x27');return _0x2d617b['id'];}};try{const _0x4a24b7=await a36_0x5c8cd4(_0xab5155[_0x463fe4(0x131)],_0x259939,_0x52adb2),_0x3df15a=_0x2f3065||_0x305bba;_0x3df15a&&(_0x4a24b7[_0x463fe4(0xb3)]={'parentFolder':{'data':{'id':_0x3df15a,'type':_0x463fe4(0x10c)}}});if(_0xab5155[_0x463fe4(0xca)]){if(_0x31677c['size']>0x0||_0x2a2f04['size']>0x0){const _0x4ea910=JSON[_0x463fe4(0x122)](JSON[_0x463fe4(0x12b)](_0x4a24b7));ensureJourneyDefaults(_0x4ea910[_0x463fe4(0xc6)]);for(const _0x2450d5 of _0x4ea910['attributes'][_0x463fe4(0xcb)]){_0x2450d5[_0x463fe4(0x87)]?.['segmentId']&&isPendingSegmentId(_0x2450d5[_0x463fe4(0x87)][_0x463fe4(0x163)])&&delete _0x2450d5[_0x463fe4(0x87)];if(_0x2450d5[_0x463fe4(0xe5)])for(const _0x46d2e6 of Object[_0x463fe4(0x91)](_0x2450d5['steps'])){const _0x739856=_0x2450d5[_0x463fe4(0xe5)][_0x46d2e6];_0x739856[_0x463fe4(0x142)]===_0x463fe4(0x9d)&&_0x739856[_0x463fe4(0xdc)]&&isPendingActivationId(_0x739856['journeyActivationStepId'])&&(_0x739856[_0x463fe4(0xdc)]='');if(_0x739856['type']===_0x463fe4(0x145)&&_0x739856[_0x463fe4(0x11a)])for(const _0x360e27 of _0x739856[_0x463fe4(0x11a)]){_0x360e27[_0x463fe4(0x163)]&&isPendingSegmentId(_0x360e27[_0x463fe4(0x163)])&&(_0x360e27[_0x463fe4(0x163)]='');}}}_0x31d781['verbose']&&console[_0x463fe4(0x17a)](_0x463fe4(0x152)+JSON[_0x463fe4(0x12b)](_0x4ea910,null,0x2));const _0x23180e=await _0x2d2cc1['journey']['create'](_0x4ea910),_0x38b9b2=_0x23180e['id'],_0x5656a3=new Map();for(const _0x3d4e9f of _0x23180e['attributes'][_0x463fe4(0xcb)]){_0x5656a3['set'](_0x3d4e9f[_0x463fe4(0x8b)][_0x463fe4(0xa8)](),_0x3d4e9f['id']);}const _0x55dfbf=new Map();for(const [_0x30e34d,{definition:_0x2e8ad2,criteriaName:_0x9181ba}]of _0x31677c){const _0x336911=generateJourneyLocalName(_0x9181ba)||_0x463fe4(0x8e)+crypto[_0x463fe4(0x124)]();_0x31d781[_0x463fe4(0xd1)]&&console['error']('\x20\x20Step\x202:\x20Creating\x20embedded\x20segment\x20\x27'+_0x30e34d+_0x463fe4(0x12e)+_0x336911+_0x463fe4(0x126)+_0x38b9b2);const _0x12073a=await _0x2d2cc1[_0x463fe4(0xc3)]['createJourneySegment']({'name':_0x336911,'description':_0x2e8ad2[_0x463fe4(0x15a)]||_0x463fe4(0x97)+_0x30e34d,'journeyId':_0x38b9b2,'rule':yamlRuleToApi(_0x2e8ad2['rule'],!![]),'countPopulation':!![],'parentFolderId':_0x3df15a||'','audienceId':_0x259939});_0x55dfbf['set'](_0x30e34d,_0x12073a),_0x3a1fb8[_0x463fe4(0x129)](_0x30e34d,_0x12073a),_0x31d781[_0x463fe4(0xd1)]&&console[_0x463fe4(0x17a)](_0x463fe4(0x85)+_0x30e34d+_0x463fe4(0xc5)+_0x12073a);}const _0x11c5ac=new Map();for(const [_0x44e398,_0x4d00ca]of _0x2a2f04){_0x31d781[_0x463fe4(0xd1)]&&console[_0x463fe4(0x17a)](_0x463fe4(0x82)+_0x44e398+_0x463fe4(0x11d)+_0x38b9b2);try{const _0x5c93cc=yamlActivationToCreateRequest(_0x4d00ca,_0x3de427,_0x1af15f),_0x5c3241=await _0x2d2cc1[_0x463fe4(0xf4)]['createActivation'](_0x38b9b2,_0x5c93cc);_0x11c5ac[_0x463fe4(0x129)](_0x44e398,_0x5c3241['id']),_0x407e74[_0x463fe4(0x129)](_0x44e398,_0x5c3241['id']),_0x31d781[_0x463fe4(0xd1)]&&console[_0x463fe4(0x17a)](_0x463fe4(0xfb)+_0x44e398+_0x463fe4(0xc5)+_0x5c3241['id']);}catch(_0x2bcdb7){throw new SDKError(ErrorCode['JOURNEY_UPDATE_ERROR'],'Failed\x20to\x20create\x20embedded\x20activation\x20\x27'+_0x44e398+'\x27:\x20'+getErrorMessage(_0x2bcdb7),_0x2bcdb7);}}const _0x50ef66=JSON[_0x463fe4(0x122)](JSON['stringify'](_0x4a24b7));_0x50ef66['id']=_0x38b9b2,ensureJourneyDefaults(_0x50ef66[_0x463fe4(0xc6)]);for(const _0x283fee of _0x50ef66['attributes'][_0x463fe4(0xcb)]){const _0x660fa9=_0x5656a3[_0x463fe4(0xe3)](_0x283fee[_0x463fe4(0x8b)][_0x463fe4(0xa8)]());_0x660fa9&&(_0x283fee['id']=_0x660fa9);if(_0x283fee['entryCriteria']?.[_0x463fe4(0x163)]&&isPendingSegmentId(_0x283fee[_0x463fe4(0x87)]['segmentId'])){const _0x1a4d2b=extractPendingSegmentName(_0x283fee['entryCriteria'][_0x463fe4(0x163)]),_0x1949a7=_0x55dfbf[_0x463fe4(0xe3)](_0x1a4d2b);_0x1949a7&&(_0x283fee[_0x463fe4(0x87)][_0x463fe4(0x163)]=_0x1949a7);}if(_0x283fee['steps']){const _0x2ea5f2=_0x1ddf0b=>_0x4a24b7[_0x463fe4(0xc6)][_0x463fe4(0xcb)][_0x463fe4(0xc1)](_0x514f80=>_0x514f80[_0x463fe4(0x8b)][_0x463fe4(0xa8)]()===_0x283fee[_0x463fe4(0x8b)][_0x463fe4(0xa8)]())?.['steps']?.[_0x1ddf0b];for(const _0x41f048 of Object[_0x463fe4(0x91)](_0x283fee[_0x463fe4(0xe5)])){const _0x2c4a4b=_0x283fee[_0x463fe4(0xe5)][_0x41f048],_0x2b9e73=_0x2ea5f2(_0x41f048);if(_0x2c4a4b[_0x463fe4(0x142)]===_0x463fe4(0x9d)&&_0x2c4a4b[_0x463fe4(0xdc)]&&(isPendingActivationId(_0x2c4a4b[_0x463fe4(0xdc)])||_0x2c4a4b[_0x463fe4(0xdc)]==='')){if(_0x2b9e73?.[_0x463fe4(0xdc)]&&isPendingActivationId(_0x2b9e73[_0x463fe4(0xdc)])){const _0x47a096=extractPendingActivationName(_0x2b9e73[_0x463fe4(0xdc)]),_0x5e49fc=_0x11c5ac[_0x463fe4(0xe3)](_0x47a096);_0x5e49fc&&(_0x2c4a4b[_0x463fe4(0xdc)]=_0x5e49fc);}}if(_0x2c4a4b[_0x463fe4(0x142)]===_0x463fe4(0x145)&&_0x2c4a4b[_0x463fe4(0x11a)]&&_0x2b9e73?.[_0x463fe4(0x11a)])for(let _0x168e7e=0x0;_0x168e7e<_0x2c4a4b[_0x463fe4(0x11a)][_0x463fe4(0x110)];_0x168e7e++){const _0x9a3e22=_0x2c4a4b[_0x463fe4(0x11a)][_0x168e7e],_0x4210cc=_0x2b9e73[_0x463fe4(0x11a)][_0x168e7e];if(_0x4210cc?.['segmentId']&&isPendingSegmentId(_0x4210cc[_0x463fe4(0x163)])){const _0x4942da=extractPendingSegmentName(_0x4210cc[_0x463fe4(0x163)]),_0x184fc4=_0x55dfbf['get'](_0x4942da);_0x184fc4&&(_0x9a3e22[_0x463fe4(0x163)]=_0x184fc4);}}}}}return _0x31d781[_0x463fe4(0xd1)]&&console['error'](_0x463fe4(0xbb)+JSON['stringify'](_0x50ef66,null,0x2)),await _0x2d2cc1['journey'][_0x463fe4(0xb5)](_0x38b9b2,_0x50ef66),{'action':_0x463fe4(0x164),'name':_0xab5155[_0x463fe4(0x131)][_0x463fe4(0x8b)],'journeyId':_0x38b9b2};}else{ensureJourneyDefaults(_0x4a24b7[_0x463fe4(0xc6)]);_0x31d781['verbose']&&console['error'](_0x463fe4(0x178)+JSON[_0x463fe4(0x12b)](_0x4a24b7,null,0x2));const _0x4a896e=await _0x2d2cc1[_0x463fe4(0xf4)][_0x463fe4(0x15b)](_0x4a24b7);return{'action':_0x463fe4(0x164),'name':_0xab5155[_0x463fe4(0x131)][_0x463fe4(0x8b)],'journeyId':_0x4a896e['id']};}}else{if(_0xab5155[_0x463fe4(0x93)]&&_0xab5155[_0x463fe4(0x9e)])return ensureJourneyDefaults(_0x4a24b7[_0x463fe4(0xc6)]),await _0x2d2cc1[_0x463fe4(0xf4)][_0x463fe4(0xb5)](_0xab5155['existingJourney']['id'],_0x4a24b7),{'action':'updated','name':_0xab5155['yamlConfig'][_0x463fe4(0x8b)],'journeyId':_0xab5155[_0x463fe4(0x9e)]['id']};}return{'action':'unchanged','name':_0xab5155[_0x463fe4(0x131)][_0x463fe4(0x8b)],'journeyId':_0xab5155[_0x463fe4(0x9e)]?.['id']};}catch(_0x58622a){const _0x4b6d2=isHttp400Error(_0x58622a),_0x128066=_0x4b6d2?ErrorCode[_0x463fe4(0xad)]:ErrorCode[_0x463fe4(0xcd)],_0x184ebe=getErrorMessage(_0x58622a);throw new SDKError(_0x128066,'Failed\x20to\x20'+(_0xab5155[_0x463fe4(0xca)]?_0x463fe4(0x15b):_0x463fe4(0xb5))+_0x463fe4(0x11f)+_0xab5155[_0x463fe4(0xc8)]+_0x463fe4(0x12d)+_0x184ebe,_0x58622a);}}));_0x47e881[_0x4f1d02(0x177)](..._0x416f44),_0x45274c+=_0x26b226[_0x4f1d02(0x110)],_0x53c66c[_0x4f1d02(0x139)]('('+_0x45274c+'/'+_0x1e2451[_0x4f1d02(0x110)]+')');}return _0x47e881;},{'verbose':_0x31d781[_0x5236b6(0xd1)]});for(const _0x4c770a of _0x5adce5['data']){if(_0x4c770a[_0x5236b6(0x147)]===_0x5236b6(0x164))console[_0x5236b6(0x17a)](a36_0x14aa77['green'](_0x5236b6(0xd6)+_0x4c770a[_0x5236b6(0x8b)]+'\x27')),_0x34d4fd++;else _0x4c770a['action']==='updated'&&(console['error'](a36_0x14aa77[_0x5236b6(0xe0)](_0x5236b6(0xd7)+_0x4c770a[_0x5236b6(0x8b)]+'\x27')),_0x14eef1++);}if(_0x4f4db2&&_0x5adce5[_0x5236b6(0xd2)]['length']===0x1){const _0x5af31c=_0x5adce5[_0x5236b6(0xd2)][0x0];if(_0x5af31c[_0x5236b6(0x10d)]){const _0x4a528c=getConsoleNextUrl(_0x31d781[_0x5236b6(0x115)],'/app/ps/'+_0x259939+'/e/'+_0x5af31c['journeyId']+_0x5236b6(0xee));console['error']('\x20\x20'+a36_0x14aa77['cyan'](_0x4a528c));}}}for(const _0x472a21 of _0x295b53){console[_0x5236b6(0x17a)](a36_0x14aa77[_0x5236b6(0xe0)](_0x5236b6(0x12c)+_0x472a21[_0x5236b6(0x13e)])),_0x2747ca++;}const _0x1ff027=[];if(_0x4758e>0x0)_0x1ff027[_0x5236b6(0x177)](_0x4758e+_0x5236b6(0x10e));if(_0xdf1352>0x0)_0x1ff027[_0x5236b6(0x177)](_0xdf1352+_0x5236b6(0xaf));if(_0x5bcc2d>0x0)_0x1ff027[_0x5236b6(0x177)](_0x5bcc2d+_0x5236b6(0x156));const _0x3e2bc2=[];if(_0x34d4fd>0x0)_0x3e2bc2[_0x5236b6(0x177)](_0x34d4fd+_0x5236b6(0x10e));if(_0x14eef1>0x0)_0x3e2bc2[_0x5236b6(0x177)](_0x14eef1+_0x5236b6(0xaf));if(_0x2747ca>0x0)_0x3e2bc2[_0x5236b6(0x177)](_0x2747ca+_0x5236b6(0x156));const _0x4be22a=[];if(_0x322b00>0x0)_0x4be22a[_0x5236b6(0x177)](_0x322b00+'\x20created');if(_0x46e7ef>0x0)_0x4be22a['push'](_0x46e7ef+_0x5236b6(0xaf));if(_0x57e467>0x0)_0x4be22a['push'](_0x57e467+_0x5236b6(0x156));return console[_0x5236b6(0x17a)](a36_0x14aa77['green'](_0x5236b6(0x104))),_0x1ff027['length']>0x0&&!_0x31d781[_0x5236b6(0x92)]&&console[_0x5236b6(0x17a)]('\x20\x20Segments:\x20'+_0x1ff027[_0x5236b6(0xcf)](',\x20')),_0x3e2bc2[_0x5236b6(0x110)]>0x0&&console[_0x5236b6(0x17a)]('\x20\x20Journeys:\x20'+_0x3e2bc2[_0x5236b6(0xcf)](',\x20')),_0x4be22a[_0x5236b6(0x110)]>0x0&&!_0x31d781['journeysOnly']&&console['error'](_0x5236b6(0x13d)+_0x4be22a[_0x5236b6(0xcf)](',\x20')),0x0;}}function buildFolderPathToIdMap(_0x4d6e94){const _0x53e7ea=a36_0x1b85d6,_0x465799=new Map(),_0x68a4b5=new Map();for(const _0x4d9f68 of _0x4d6e94){_0x68a4b5['set'](_0x4d9f68['id'],_0x4d9f68);}const _0x1f5351=new Set();for(const _0x5ad7cd of _0x4d6e94){!_0x5ad7cd[_0x53e7ea(0xa3)]&&_0x1f5351[_0x53e7ea(0xb1)](_0x5ad7cd['id']);}function _0xc977c4(_0x230e12){const _0x61447e=_0x53e7ea;if(_0x1f5351['has'](_0x230e12['id']))return'';if(_0x230e12[_0x61447e(0xa3)]){const _0x1c2f4b=_0x68a4b5[_0x61447e(0xe3)](_0x230e12['parentFolderId']);if(_0x1c2f4b){const _0x54da29=_0xc977c4(_0x1c2f4b);return _0x54da29?_0x54da29+'/'+_0x230e12[_0x61447e(0x8b)]:_0x230e12[_0x61447e(0x8b)];}}return _0x230e12[_0x61447e(0x8b)];}for(const _0x115d69 of _0x4d6e94){const _0x7c5fdd=_0xc977c4(_0x115d69);_0x465799[_0x53e7ea(0x129)](_0x7c5fdd,_0x115d69['id']);}return _0x465799;}function a36_0x46eb(){const _0x4b92ad=['journey_entry_criteria_','state','\x20(referenced\x20in\x20journey\x20','keys','journeysOnly','hasChanges','332565DkVQtA','INTERNAL','parent_segment','Entry\x20criteria:\x20','\x20\x20Activations:','activations','Updating\x20activation\x20\x27','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','existingActivation','Activation','existingJourney','\x20\x20✔\x20Deleted\x20activation\x20\x27','from','updateSegmentById','\x27\x20not\x20found\x20in\x20journey\x20\x27','parentFolderId','has','yamlActivation','Fetching\x20existing\x20folders...','toString','toLowerCase','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','activationParams','Failed\x20to\x20','connection','JOURNEY_SYNTAX_ERROR','Fetching\x20existing\x20activations...','\x20updated','Failed\x20to\x20create\x20embedded\x20activation\x20\x27','add','dirname','relationships','Stage\x20\x27','update','endsWith','relative','Error\x20parsing\x20','SEGMENT_UPDATE_ERROR','\x20unchanged','\x20\x20Step\x203:\x20Updating\x20journey\x20with\x20entry\x20criteria\x20and\x20activation\x20IDs:\x20',')\x20with\x20ID:\x20','\x20\x20🗺️\x20\x20Journeys:','✔\x20Updated\x20segment\x20\x27','parentSegmentFolder','\x20\x20✔\x20Updated\x20activation\x20\x27','find','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','segment','folderPath','\x27\x20with\x20ID:\x20','attributes','Delete\x20journey:','absolutePath','2BwtAQC','isNew','journeyStages','activation_','JOURNEY_UPDATE_ERROR','Aborted.','join','\x20new','verbose','data','5HBGOIY','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','187uoTGeZ','✔\x20Created\x20journey\x20\x27','✔\x20Updated\x20journey\x20\x27','\x20to\x20create','user','createFolder','cyan','journeyActivationStepId','execute','2086566YviyNJ','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','yellow','Scoped\x20to\x20folder:\x20','Failed\x20to\x20create\x20embedded\x20segment\x20\x27','get','Error:\x20Directory\x20not\x20found:\x20','steps','\x27...','\x20changes?','5227764wZPOUk','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','stages','versionNumber','\x20journey\x20\x27','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','/j/da/je','dim','isFile','.yml','__pending_','filter','journey','rule','map','unchanged','7NKEKFO','Fetching\x20existing\x20segments...','setPhase','\x20\x20Created\x20embedded\x20activation\x20\x27','Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)','all','diff','red','Push\x20','dryRun','Folders\x20to\x20create:','Creating','\x0a✔\x20Push\x20complete','\x20to\x20delete','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','\x20changed','split','Fetching\x20existing\x20journeys...','folderId','\x27\x20details...','folder','journeyId','\x20created','config','length','__pending_act_','kind','NOT_FOUND','green','site','Fetching\x20users\x20for\x20email\x20resolution...','29872gLzAGe','\x20to\x20update','SEGMENT_SYNTAX_ERROR','branches','2799hbTwXU','activationActions','\x27\x20with\x20journeyId:\x20','isDirectory','\x20journey\x20from\x20file:\x20','Activation\x20not\x20found:\x20','.yaml','parse','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','randomUUID','getActivation',')\x20with\x20journeyId:\x20','resolveParentId','existingSegment','set','Source\x20directory:\x20','stringify','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','\x0a\x20\x20','\x27\x20(internal:\x20','13565960TeHiPU','parentFolder','yamlConfig','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','createActivation','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','utf-8','Creating\x20segment\x20\x27','segmentFolderId','/e/','setExtra','Updating','Pushing\x20journeys...','Delete\x20segment:','\x20\x20Activations:\x20','journeyBundleName','✔\x20Deleted\x20segment\x20\x27','Fetching\x20parent\x20segment\x20details...','listActivations','type','Changes\x20to:','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','DecisionPoint','segment\x20or\x20journey','action','No\x20','values','Journey\x20\x27','\x20activation\x20\x27','flatMap','repeat','\x20folders\x20to\x20create','resolve','entry','\x20\x20\x20\x20','\x20\x20Step\x201:\x20Creating\x20journey\x20without\x20entry\x20criteria:\x20','\x27\x20v','...','Site:\x20','\x20deleted','replace','📁\x20','slice','description','create','then','deleteActivation','draft','✔\x20Created\x20folder\x20\x27','cwd','message','listJourneysFromParentSegment','segmentId','created','\x20\x20Source:\x20','3154908FxPDUR','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','configDir','6297948SljImO','startsWith','getParent','Deleting\x20activation\x20\x27','New\x20segment:','blue','yes','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','max','getSegment','resolveJourneyId','delete','/app/ps/','Creating\x20activation\x20\x27','push','\x20\x20Journey\x20API\x20request:\x20','getJourney','error','\x20\x20Step\x202b:\x20Creating\x20embedded\x20activation\x20\x27','\x27:\x20','Fetching\x20journey\x20\x27','\x20\x20Created\x20embedded\x20segment\x20\x27','(Journey\x20will\x20be\x20deleted)','entryCriteria','Creating\x20folder\x20\x27','sort','entry_criteria','name','Deleting\x20segment\x20\x27','\x20activations]'];a36_0x46eb=function(){return _0x4b92ad;};return a36_0x46eb();}function findYamlFiles(_0x3ff7f3){const _0x10c508=[];function _0x56f43e(_0x46a1cd){const _0x5e0085=a36_0x2e07,_0x1646ee=readdirSync(_0x46a1cd,{'withFileTypes':!![]});for(const _0x316d41 of _0x1646ee){const _0x2aa92d=a36_0x2ae80a[_0x5e0085(0xcf)](_0x46a1cd,_0x316d41[_0x5e0085(0x8b)]);if(_0x316d41[_0x5e0085(0x11e)]())_0x56f43e(_0x2aa92d);else(_0x316d41[_0x5e0085(0x8b)][_0x5e0085(0xb6)](_0x5e0085(0xf1))||_0x316d41[_0x5e0085(0x8b)][_0x5e0085(0xb6)](_0x5e0085(0x121)))&&_0x10c508[_0x5e0085(0x177)](_0x2aa92d);}}return _0x56f43e(_0x3ff7f3),_0x10c508;}function calculateActivationActions(_0x2ac511,_0x49cfac,_0x1e8fe7,_0x19a469){const _0x5acb4a=a36_0x1b85d6,_0xa410e1=[],_0x4e39e0=new Map();for(const _0x5c927a of _0x49cfac){_0x4e39e0[_0x5acb4a(0x129)](_0x5c927a[_0x5acb4a(0x8b)],_0x5c927a);}const _0x352f05=new Map();for(const _0x47298a of _0x2ac511){_0x352f05[_0x5acb4a(0x129)](_0x47298a['name'],_0x47298a);}for(const _0x4778e5 of _0x2ac511){const _0x256fb9=_0x4e39e0[_0x5acb4a(0xe3)](_0x4778e5[_0x5acb4a(0x8b)]);if(!_0x256fb9)_0xa410e1[_0x5acb4a(0x177)]({'type':'create','name':_0x4778e5[_0x5acb4a(0x8b)],'yamlActivation':_0x4778e5});else{const _0x51cab7=activationToYaml(_0x256fb9,_0x1e8fe7,_0x19a469),_0x246a94=a36_0x54a4c8[_0x5acb4a(0x12b)](_0x51cab7),_0xfc5bff=a36_0x54a4c8['stringify'](_0x4778e5);_0x246a94!==_0xfc5bff&&_0xa410e1[_0x5acb4a(0x177)]({'type':_0x5acb4a(0xb5),'name':_0x4778e5[_0x5acb4a(0x8b)],'yamlActivation':_0x4778e5,'existingActivation':_0x256fb9});}}for(const _0x5302b5 of _0x49cfac){!_0x352f05[_0x5acb4a(0xa4)](_0x5302b5[_0x5acb4a(0x8b)])&&_0xa410e1['push']({'type':_0x5acb4a(0x174),'name':_0x5302b5['name'],'existingActivation':_0x5302b5});}return _0xa410e1;}
@@ -1 +1 @@
1
- const a37_0xa1831f=a37_0x42b8;(function(_0x3f4119,_0x5b3483){const _0x241665=a37_0x42b8,_0x5bab86=_0x3f4119();while(!![]){try{const _0x44c052=parseInt(_0x241665(0x20c))/0x1+-parseInt(_0x241665(0x202))/0x2+-parseInt(_0x241665(0x1f6))/0x3+-parseInt(_0x241665(0x1ff))/0x4+-parseInt(_0x241665(0x205))/0x5+-parseInt(_0x241665(0x212))/0x6*(-parseInt(_0x241665(0x1f4))/0x7)+parseInt(_0x241665(0x20b))/0x8*(parseInt(_0x241665(0x203))/0x9);if(_0x44c052===_0x5b3483)break;else _0x5bab86['push'](_0x5bab86['shift']());}catch(_0x3d68ae){_0x5bab86['push'](_0x5bab86['shift']());}}}(a37_0x393d,0x5418f));import{BaseCommand}from'./command.js';function a37_0x42b8(_0x4b5331,_0x29915e){_0x4b5331=_0x4b5331-0x1f2;const _0x393d3b=a37_0x393d();let _0x42b88f=_0x393d3b[_0x4b5331];return _0x42b88f;}import{handleSDKOutput}from'../utils/command-output.js';function a37_0x393d(){const _0x33e4ee=['error','Resolved\x20folder\x20ID:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Examples:','rule','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','name','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','Error:\x20Cannot\x20update\x20','includes','48524bGqovx','\x20\x20\x20Path:\x20','762036HTQFiQ','\x27...','Segment\x20ID:\x20','ruleFile','segment','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','INTERNAL','kind','type','513580nrSVeQ','folder','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','148174eIlAyA','63yNjqIZ','segmentName','1863505ifMRnP','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','yellow','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Resolving\x20path\x20\x27','1182536euFosW','41891SgrQEP','segmentId','✔\x20Updated\x20segment\x20\x27','description','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Resolved\x20relative\x20path\x20to:\x20','84xQbuCL','verbose','length'];a37_0x393d=function(){return _0x33e4ee;};return a37_0x393d();}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a37_0x55be90 from'chalk';export class SegmentUpdateCommand extends BaseCommand{[a37_0xa1831f(0x21b)]='segment:update';[a37_0xa1831f(0x20f)]='Update\x20existing\x20child\x20segment';async['execute'](_0x39697d){const _0x2d5b49=a37_0xa1831f;console['error'](a37_0x55be90[_0x2d5b49(0x207)](_0x2d5b49(0x21a))),console[_0x2d5b49(0x215)](a37_0x55be90[_0x2d5b49(0x207)](_0x2d5b49(0x217)));const {options:_0x242027,args:_0x41c44c,tdx:_0x3b3369}=_0x39697d,_0x3af002=_0x242027;if(_0x41c44c[_0x2d5b49(0x214)]===0x0)return console[_0x2d5b49(0x215)](_0x2d5b49(0x209)),console[_0x2d5b49(0x215)](_0x2d5b49(0x201)),console[_0x2d5b49(0x215)](_0x2d5b49(0x218)),console[_0x2d5b49(0x215)](_0x2d5b49(0x206)),console[_0x2d5b49(0x215)](_0x2d5b49(0x1fb)),0x1;const _0xd1781e=_0x41c44c[0x0],_0x2755e7=_0x242027['segmentPath'];let _0x32349d=_0xd1781e;_0x2755e7&&!_0xd1781e[_0x2d5b49(0x1f3)]('/')&&(_0x32349d=_0x2755e7+'/'+_0xd1781e,_0x3af002[_0x2d5b49(0x213)]&&console[_0x2d5b49(0x215)](_0x2d5b49(0x211)+_0x32349d));const _0x147960=await withSpinner(_0x2d5b49(0x20a)+_0x32349d+'\x27...',()=>_0x3b3369['segment']['resolvePathToResource'](_0x32349d),{'verbose':_0x3af002[_0x2d5b49(0x213)]}),_0x594b33=_0x147960['data'];_0x3af002[_0x2d5b49(0x213)]&&console['error']('Resolved\x20type:\x20'+_0x594b33[_0x2d5b49(0x1fe)]);if(_0x594b33[_0x2d5b49(0x1fe)]!==_0x2d5b49(0x1fa))return console[_0x2d5b49(0x215)](_0x2d5b49(0x1f2)+_0x594b33[_0x2d5b49(0x1fe)]+_0x2d5b49(0x21c)),console['error'](_0x2d5b49(0x208)),0x1;if(!_0x594b33[_0x2d5b49(0x20d)])throw new SDKError(ErrorCode[_0x2d5b49(0x1fc)],_0x2d5b49(0x210));const _0x41f9be=_0x594b33['parentId'],_0x17bb87=_0x594b33[_0x2d5b49(0x20d)];_0x3af002['verbose']&&(console[_0x2d5b49(0x215)]('Parent\x20ID:\x20'+_0x41f9be),console[_0x2d5b49(0x215)](_0x2d5b49(0x1f8)+_0x17bb87));let _0x3089b2;if(_0x3af002[_0x2d5b49(0x200)]){const _0x4e5240=_0x3af002[_0x2d5b49(0x200)],_0x2a7955=await withSpinner('Resolving\x20folder\x20\x27'+_0x4e5240+_0x2d5b49(0x1f7),()=>_0x3b3369[_0x2d5b49(0x1fa)]['resolveFolderId'](_0x41f9be,_0x4e5240),{'verbose':_0x3af002[_0x2d5b49(0x213)]});_0x3089b2=parseInt(_0x2a7955['data'],0xa),_0x3af002['verbose']&&console[_0x2d5b49(0x215)](_0x2d5b49(0x216)+_0x3089b2);}const _0x321586=await loadJSONFromOptions(_0x3af002[_0x2d5b49(0x219)],_0x3af002[_0x2d5b49(0x1f9)]),_0x2e7b1a={'name':_0x3af002[_0x2d5b49(0x21b)],'description':_0x3af002['description'],'rule':_0x321586,'kind':_0x3af002[_0x2d5b49(0x1fd)]!==undefined?parseInt(_0x3af002['kind'],0xa):undefined,'segmentFolderId':_0x3089b2},_0x33734f=await withSpinner('Updating\x20segment\x20\x27'+_0x594b33[_0x2d5b49(0x204)]+_0x2d5b49(0x1f7),()=>_0x3b3369[_0x2d5b49(0x1fa)]['updateSegmentById'](_0x41f9be,_0x17bb87,_0x2e7b1a),{'verbose':_0x3af002[_0x2d5b49(0x213)]}),_0x54096c=_0x33734f['data'];return console[_0x2d5b49(0x215)](_0x2d5b49(0x20e)+_0x54096c[_0x2d5b49(0x21b)]+'\x27'),_0x32349d!==_0xd1781e&&console[_0x2d5b49(0x215)](_0x2d5b49(0x1f5)+_0x32349d),await handleSDKOutput([_0x54096c],_0x3af002),0x0;}}
1
+ const a37_0x58c2bd=a37_0x1106;(function(_0x429e4c,_0x3c3bf1){const _0x2ea57c=a37_0x1106,_0x331aeb=_0x429e4c();while(!![]){try{const _0x1ed8c1=parseInt(_0x2ea57c(0x1c3))/0x1*(-parseInt(_0x2ea57c(0x1ee))/0x2)+-parseInt(_0x2ea57c(0x1e5))/0x3+parseInt(_0x2ea57c(0x1c7))/0x4+parseInt(_0x2ea57c(0x1c0))/0x5+parseInt(_0x2ea57c(0x1d1))/0x6+-parseInt(_0x2ea57c(0x1e9))/0x7+parseInt(_0x2ea57c(0x1e4))/0x8*(parseInt(_0x2ea57c(0x1bd))/0x9);if(_0x1ed8c1===_0x3c3bf1)break;else _0x331aeb['push'](_0x331aeb['shift']());}catch(_0x1ac7a5){_0x331aeb['push'](_0x331aeb['shift']());}}}(a37_0x34ab,0xe05b1));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';function a37_0x34ab(){const _0x43abfc=['name','Resolved\x20folder\x20ID:\x20','verbose','segmentId','resolveFolderId','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','Update\x20existing\x20child\x20segment','folder','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','segmentName','error','Examples:','Resolved\x20type:\x20','8403416RuxAGO','700992JuhCii','Error:\x20Cannot\x20update\x20','\x27...','description','4519074zZNaIA','rule','yellow','type','Segment\x20ID\x20missing\x20from\x20resolved\x20path','2241308sMNUpH','9vmizxK','includes','data','848945fXdqTD','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','1hOYtfb','resolvePathToResource','Resolving\x20folder\x20\x27','\x20\x20\x20Path:\x20','584152qMMEVJ','Updating\x20segment\x20\x27','kind','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','Parent\x20ID:\x20','execute','Resolved\x20relative\x20path\x20to:\x20','segment','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','9315642NdFmtk','✔\x20Updated\x20segment\x20\x27','parentId','Resolving\x20path\x20\x27','segment:update','updateSegmentById'];a37_0x34ab=function(){return _0x43abfc;};return a37_0x34ab();}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a37_0x1106(_0x369fa3,_0x2f6e6d){_0x369fa3=_0x369fa3-0x1bd;const _0x34ab0e=a37_0x34ab();let _0x1106e9=_0x34ab0e[_0x369fa3];return _0x1106e9;}import a37_0x201f50 from'chalk';export class SegmentUpdateCommand extends BaseCommand{[a37_0x58c2bd(0x1d7)]=a37_0x58c2bd(0x1d5);['description']=a37_0x58c2bd(0x1dd);async[a37_0x58c2bd(0x1cd)](_0x25d787){const _0x10bffb=a37_0x58c2bd;console[_0x10bffb(0x1e1)](a37_0x201f50[_0x10bffb(0x1eb)](_0x10bffb(0x1d0))),console[_0x10bffb(0x1e1)](a37_0x201f50[_0x10bffb(0x1eb)](_0x10bffb(0x1ca)));const {options:_0x64ebd0,args:_0x4c4204,tdx:_0x569b26}=_0x25d787,_0x5ac780=_0x64ebd0;if(_0x4c4204['length']===0x0)return console['error'](_0x10bffb(0x1c2)),console[_0x10bffb(0x1e1)](_0x10bffb(0x1c1)),console[_0x10bffb(0x1e1)](_0x10bffb(0x1e2)),console[_0x10bffb(0x1e1)]('\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22'),console[_0x10bffb(0x1e1)](_0x10bffb(0x1df)),0x1;const _0x40d3bb=_0x4c4204[0x0],_0x46b30a=_0x64ebd0['segmentPath'];let _0x379df4=_0x40d3bb;_0x46b30a&&!_0x40d3bb[_0x10bffb(0x1be)]('/')&&(_0x379df4=_0x46b30a+'/'+_0x40d3bb,_0x5ac780[_0x10bffb(0x1d9)]&&console['error'](_0x10bffb(0x1ce)+_0x379df4));const _0x2aef19=await withSpinner(_0x10bffb(0x1d4)+_0x379df4+_0x10bffb(0x1e7),()=>_0x569b26[_0x10bffb(0x1cf)][_0x10bffb(0x1c4)](_0x379df4),{'verbose':_0x5ac780[_0x10bffb(0x1d9)]}),_0x32ba00=_0x2aef19[_0x10bffb(0x1bf)];_0x5ac780[_0x10bffb(0x1d9)]&&console[_0x10bffb(0x1e1)](_0x10bffb(0x1e3)+_0x32ba00['type']);if(_0x32ba00[_0x10bffb(0x1ec)]!==_0x10bffb(0x1cf))return console['error'](_0x10bffb(0x1e6)+_0x32ba00[_0x10bffb(0x1ec)]+_0x10bffb(0x1cb)),console[_0x10bffb(0x1e1)](_0x10bffb(0x1dc)),0x1;if(!_0x32ba00[_0x10bffb(0x1da)])throw new SDKError(ErrorCode['INTERNAL'],_0x10bffb(0x1ed));const _0x2f7034=_0x32ba00[_0x10bffb(0x1d3)],_0x454aaf=_0x32ba00[_0x10bffb(0x1da)];_0x5ac780[_0x10bffb(0x1d9)]&&(console['error'](_0x10bffb(0x1cc)+_0x2f7034),console[_0x10bffb(0x1e1)]('Segment\x20ID:\x20'+_0x454aaf));let _0x4ff2f2;if(_0x5ac780[_0x10bffb(0x1de)]){const _0x432e49=_0x5ac780['folder'],_0x94ba56=await withSpinner(_0x10bffb(0x1c5)+_0x432e49+_0x10bffb(0x1e7),()=>_0x569b26[_0x10bffb(0x1cf)][_0x10bffb(0x1db)](_0x2f7034,_0x432e49),{'verbose':_0x5ac780[_0x10bffb(0x1d9)]});_0x4ff2f2=parseInt(_0x94ba56['data'],0xa),_0x5ac780[_0x10bffb(0x1d9)]&&console['error'](_0x10bffb(0x1d8)+_0x4ff2f2);}const _0x380b07=await loadJSONFromOptions(_0x5ac780[_0x10bffb(0x1ea)],_0x5ac780['ruleFile']),_0x1e8aac={'name':_0x5ac780['name'],'description':_0x5ac780[_0x10bffb(0x1e8)],'rule':_0x380b07,'kind':_0x5ac780[_0x10bffb(0x1c9)]!==undefined?parseInt(_0x5ac780[_0x10bffb(0x1c9)],0xa):undefined,'segmentFolderId':_0x4ff2f2},_0x322c70=await withSpinner(_0x10bffb(0x1c8)+_0x32ba00[_0x10bffb(0x1e0)]+_0x10bffb(0x1e7),()=>_0x569b26[_0x10bffb(0x1cf)][_0x10bffb(0x1d6)](_0x2f7034,_0x454aaf,_0x1e8aac),{'verbose':_0x5ac780[_0x10bffb(0x1d9)]}),_0xe13f49=_0x322c70[_0x10bffb(0x1bf)];return console['error'](_0x10bffb(0x1d2)+_0xe13f49['name']+'\x27'),_0x379df4!==_0x40d3bb&&console[_0x10bffb(0x1e1)](_0x10bffb(0x1c6)+_0x379df4),await handleSDKOutput([_0xe13f49],_0x5ac780),0x0;}}