@treasuredata/tdx 0.9.3 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) 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 +52 -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.js +1 -1
  18. package/dist/commands/api-command.js +1 -1
  19. package/dist/commands/auth-command.js +1 -1
  20. package/dist/commands/chat-command.js +1 -1
  21. package/dist/commands/claude-command.js +1 -1
  22. package/dist/commands/claude-statusline-command.js +1 -1
  23. package/dist/commands/claude-usage-command.js +1 -1
  24. package/dist/commands/command.js +1 -1
  25. package/dist/commands/connection-command.js +1 -1
  26. package/dist/commands/context-command.js +1 -1
  27. package/dist/commands/databases.js +1 -1
  28. package/dist/commands/describe.js +1 -1
  29. package/dist/commands/engage-command.js +1 -1
  30. package/dist/commands/job-command.js +1 -1
  31. package/dist/commands/journey-command.js +1 -1
  32. package/dist/commands/llm-command.js +1 -1
  33. package/dist/commands/llm-proxy.js +1 -1
  34. package/dist/commands/parent-segment-command.js +1 -1
  35. package/dist/commands/profiles-command.js +1 -1
  36. package/dist/commands/query-command.js +1 -1
  37. package/dist/commands/segment-command.js +1 -1
  38. package/dist/commands/segment-create-command.js +1 -1
  39. package/dist/commands/segment-fields-command.js +1 -1
  40. package/dist/commands/segment-pull-command.js +1 -1
  41. package/dist/commands/segment-push-command.js +1 -1
  42. package/dist/commands/segment-update-command.js +1 -1
  43. package/dist/commands/segment-use-command.js +1 -1
  44. package/dist/commands/segments.js +1 -1
  45. package/dist/commands/show.js +1 -1
  46. package/dist/commands/tables.js +1 -1
  47. package/dist/commands/use-command.js +1 -1
  48. package/dist/commands/user-command.js +1 -1
  49. package/dist/commands/workflow-command.js +1 -1
  50. package/dist/core/auth.js +1 -1
  51. package/dist/core/config.js +1 -1
  52. package/dist/core/connection-cache.js +1 -1
  53. package/dist/core/credential-cache.js +1 -1
  54. package/dist/core/global-context.js +1 -1
  55. package/dist/core/keychain.js +1 -1
  56. package/dist/core/profile.js +1 -1
  57. package/dist/core/project-config.js +1 -1
  58. package/dist/core/session.js +1 -1
  59. package/dist/core/user-cache.js +1 -1
  60. package/dist/index.js +1 -1
  61. package/dist/proxy/anthropic-adapter.js +1 -1
  62. package/dist/proxy/claude-usage-tracker.js +1 -1
  63. package/dist/proxy/context-signature.js +1 -1
  64. package/dist/proxy/conversation-utils.js +1 -1
  65. package/dist/proxy/server.js +1 -1
  66. package/dist/proxy/session-cache.js +1 -1
  67. package/dist/sdk/agent/agent-yaml.d.ts +15 -2
  68. package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
  69. package/dist/sdk/agent/agent-yaml.js +1 -1
  70. package/dist/sdk/agent/agent-yaml.js.map +1 -1
  71. package/dist/sdk/api.js +1 -1
  72. package/dist/sdk/connection.js +1 -1
  73. package/dist/sdk/engage.js +1 -1
  74. package/dist/sdk/errors.js +1 -1
  75. package/dist/sdk/index.js +1 -1
  76. package/dist/sdk/job.js +1 -1
  77. package/dist/sdk/journey.js +1 -1
  78. package/dist/sdk/llm.d.ts.map +1 -1
  79. package/dist/sdk/llm.js +1 -1
  80. package/dist/sdk/llm.js.map +1 -1
  81. package/dist/sdk/query.js +1 -1
  82. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  83. package/dist/sdk/segment/journey-yaml.js +1 -1
  84. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  85. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  86. package/dist/sdk/segment.js +1 -1
  87. package/dist/sdk/user.js +1 -1
  88. package/dist/sdk/workflow.js +1 -1
  89. package/dist/types/endpoints.js +1 -1
  90. package/dist/types/index.d.ts +1 -1
  91. package/dist/types/index.d.ts.map +1 -1
  92. package/dist/types/index.js +1 -1
  93. package/dist/types/llm.d.ts +107 -2
  94. package/dist/types/llm.d.ts.map +1 -1
  95. package/dist/utils/agent-config.js +1 -1
  96. package/dist/utils/agent-ref-parser.js +1 -1
  97. package/dist/utils/async.js +1 -1
  98. package/dist/utils/chat-cache.js +1 -1
  99. package/dist/utils/colors.js +1 -1
  100. package/dist/utils/command-output.js +1 -1
  101. package/dist/utils/constants.js +1 -1
  102. package/dist/utils/diff.js +1 -1
  103. package/dist/utils/fields-display.js +1 -1
  104. package/dist/utils/file-permissions.js +1 -1
  105. package/dist/utils/format-detector.js +1 -1
  106. package/dist/utils/formatters.js +1 -1
  107. package/dist/utils/journey-utils.js +1 -1
  108. package/dist/utils/json-loader.js +1 -1
  109. package/dist/utils/llm-backup-utils.js +1 -1
  110. package/dist/utils/model-aliases.js +1 -1
  111. package/dist/utils/model-factors.js +1 -1
  112. package/dist/utils/option-validation.js +1 -1
  113. package/dist/utils/port.js +1 -1
  114. package/dist/utils/process.js +1 -1
  115. package/dist/utils/prompt.js +1 -1
  116. package/dist/utils/segment-path-parser.js +1 -1
  117. package/dist/utils/segment-ref-parser.js +1 -1
  118. package/dist/utils/spinner.js +1 -1
  119. package/dist/utils/sql-parser.js +1 -1
  120. package/dist/utils/sse-parser.js +1 -1
  121. package/dist/utils/string-utils.js +1 -1
  122. package/dist/utils/table-ref-parser.js +1 -1
  123. package/dist/utils/tdx-config.js +1 -1
  124. package/dist/utils/tdx-logger.js +1 -1
  125. package/dist/utils/tree-formatter.js +1 -1
  126. package/dist/utils/version-check.js +1 -1
  127. package/dist/utils/workflow-utils.js +1 -1
  128. package/package.json +1 -1
@@ -1 +1 @@
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
+ const a34_0x20baed=a34_0x1638;function a34_0x1638(_0x16506d,_0x5262c2){_0x16506d=_0x16506d-0x16b;const _0x1a6e60=a34_0x1a6e();let _0x1638ed=_0x1a6e60[_0x16506d];return _0x1638ed;}(function(_0x1e38d6,_0x2988dd){const _0x44b83b=a34_0x1638,_0x15d2c6=_0x1e38d6();while(!![]){try{const _0x341bbb=-parseInt(_0x44b83b(0x16b))/0x1+parseInt(_0x44b83b(0x16d))/0x2+-parseInt(_0x44b83b(0x188))/0x3*(parseInt(_0x44b83b(0x187))/0x4)+parseInt(_0x44b83b(0x171))/0x5*(parseInt(_0x44b83b(0x179))/0x6)+parseInt(_0x44b83b(0x17b))/0x7+parseInt(_0x44b83b(0x184))/0x8*(-parseInt(_0x44b83b(0x176))/0x9)+-parseInt(_0x44b83b(0x182))/0xa*(-parseInt(_0x44b83b(0x17c))/0xb);if(_0x341bbb===_0x2988dd)break;else _0x15d2c6['push'](_0x15d2c6['shift']());}catch(_0x566d36){_0x15d2c6['push'](_0x15d2c6['shift']());}}}(a34_0x1a6e,0x55985));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_0x1a6e(){const _0x27cb51=['564745UUfIWK','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','1018032fewoKU','description','\x27...','site','3154885vNSoVu','verbose','execute','json','\x20field','171WgTTUQ','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','Error:\x20Parent\x20segment\x20name\x20is\x20required','6EpcEsf','segment','2068388BoPYzw','5522UxiZux','length','Listing\x20fields\x20for\x20\x27','List\x20available\x20fields\x20for\x20segmentation','segment:fields','parentSegment','2710XyJDuO','jsonl','32088PeLpoY','name','listFields','36248TvnoXE','192szAnaf','error'];a34_0x1a6e=function(){return _0x27cb51;};return a34_0x1a6e();}export class SegmentFieldsCommand extends BaseCommand{[a34_0x20baed(0x185)]=a34_0x20baed(0x180);[a34_0x20baed(0x16e)]=a34_0x20baed(0x17f);async[a34_0x20baed(0x173)](_0x57f3b5){const _0x2e0442=a34_0x20baed,{options:_0x513a6,args:_0x59de52,tdx:_0x14016a}=_0x57f3b5,_0x3ca96=_0x59de52[0x0]||_0x513a6[_0x2e0442(0x181)];if(!_0x3ca96)return console[_0x2e0442(0x189)](_0x2e0442(0x178)),console[_0x2e0442(0x189)](_0x2e0442(0x177)),console[_0x2e0442(0x189)](_0x2e0442(0x16c)),0x1;_0x513a6[_0x2e0442(0x172)]&&(console[_0x2e0442(0x189)]('Site:\x20'+_0x513a6[_0x2e0442(0x170)]),console['error']('Parent\x20segment:\x20'+_0x3ca96));const _0x242980=await withSpinner(_0x2e0442(0x17e)+_0x3ca96+_0x2e0442(0x16f),()=>_0x14016a[_0x2e0442(0x17a)][_0x2e0442(0x186)](_0x3ca96),{'verbose':_0x513a6[_0x2e0442(0x172)]}),_0x54afe4=_0x242980['data'];console[_0x2e0442(0x189)]('✔\x20Found\x20'+_0x54afe4[_0x2e0442(0x17d)]+_0x2e0442(0x175)+(_0x54afe4[_0x2e0442(0x17d)]!==0x1?'s':''));if(_0x513a6[_0x2e0442(0x174)]||_0x513a6[_0x2e0442(0x183)])return await handleSDKOutput(_0x54afe4,_0x513a6),0x0;return displayFieldsHumanReadable(_0x54afe4,_0x3ca96),0x0;}}
@@ -1 +1 @@
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
+ const a35_0x3aadc2=a35_0x6691;function a35_0x6691(_0x338e4f,_0x3facf7){_0x338e4f=_0x338e4f-0xd1;const _0x37b0bc=a35_0x37b0();let _0x669193=_0x37b0bc[_0x338e4f];return _0x669193;}(function(_0x3ec8be,_0x2188b4){const _0x5314e6=a35_0x6691,_0xb98255=_0x3ec8be();while(!![]){try{const _0x230d47=parseInt(_0x5314e6(0xe3))/0x1*(parseInt(_0x5314e6(0xfc))/0x2)+-parseInt(_0x5314e6(0xd8))/0x3+parseInt(_0x5314e6(0x12d))/0x4+-parseInt(_0x5314e6(0x125))/0x5+parseInt(_0x5314e6(0x102))/0x6*(parseInt(_0x5314e6(0x110))/0x7)+parseInt(_0x5314e6(0x116))/0x8*(-parseInt(_0x5314e6(0x131))/0x9)+parseInt(_0x5314e6(0x142))/0xa;if(_0x230d47===_0x2188b4)break;else _0xb98255['push'](_0xb98255['shift']());}catch(_0x57fe74){_0xb98255['push'](_0xb98255['shift']());}}}(a35_0x37b0,0xf03cc));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_0x574df3}from'../sdk/segment/journey-yaml.js';import a35_0x5d72ef from'chalk';import{existsSync,mkdirSync,readFileSync,writeFileSync,statSync}from'fs';import a35_0x5ecdff from'path';function a35_0x37b0(){const _0xfe4e2f=['8764410CELsDz','Write\x20','yaml','utf-8','setExtra','set','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','relativePath','\x20=\x20','description','✔\x20All\x20files\x20are\x20up\x20to\x20date','map','journeyBundleId','7AyKaoJ','attributes','getJourney','parent_segment','Found\x20tdx.json\x20at:\x20','listActivations','2472omiTcB','message','from','journeyBundleName','yellow','\x20\x20Target:\x20','hasChanges','Fetching\x20journey\x20\x27','\x20with\x20','parentFolderId','values','\x20changed\x20files','listSegments','data','\x20\x20🎯\x20','6738540pISGLN','\x20unchanged\x20files','\x20versions)','dirname','\x20segments','getSegment','✔\x20Pulled\x20','execute','3458872BzmDYs','segmentFolderId','\x0aPull\x20summary\x20for\x20\x27','isNew','54099rZuUBX','kind','reduce','add','session','filter','name','diff','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)','Fetching\x20segments...','Resolving\x20parent\x20segment\x20\x27','push','rule','dim','Fetching\x20journeys...','then','connection','17085090wNjrsH','parentSegment','setPhase','Site:\x20','length','journey','repeat','\x20new\x20files','\x20\x20🗺️\x20\x20','folderId','red','Aborted.','size','\x20journeys','segment','3910653bGKyZJ','resolveParentId','audienceId','getActivation','dryRun','verbose','user','Fetching\x20parent\x20segment\x20info...','Fetching\x20folders...','green','join','486236wsASfQ','Resolved\x20parent\x20name:\x20','getParent','\x20files?','get','tdx.json','absolutePath','cyan','error','Fetching\x20connections\x20for\x20name\x20resolution...','Using\x20parent\x20segment:\x20','listJourneysFromParentSegment','Fetching\x20activations...','Processing\x20journeys...','buildIdToNameMap','slice','Fetching\x20users\x20for\x20email\x20resolution...','relative','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','sort','Warning:\x20Could\x20not\x20resolve\x20activation\x20','listFolders','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','\x0aChanges\x20to\x20\x27','isDirectory','6YylJGx','versionNumber','Parent\x20segment:\x20','✔\x20Context\x20set:\x20','all','has'];a35_0x37b0=function(){return _0xfe4e2f;};return a35_0x37b0();}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_0x3aadc2(0x137)]='segment:pull';[a35_0x3aadc2(0x10c)]='Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files';async[a35_0x3aadc2(0x12c)](_0x333d72){const _0x8d2583=a35_0x3aadc2,{options:_0x1eeaa9,args:_0x5a2141,tdx:_0x4b3379}=_0x333d72,_0x3ae9bb=_0x1eeaa9,_0x53b855=_0x1eeaa9[_0x8d2583(0x143)],_0x214f8f=_0x5a2141[0x0],_0x294bee=findTdxConfigPath();let _0x3b5334,_0x1f44cf;if(!_0x214f8f&&_0x294bee){const _0xabf35d=loadTdxConfig(_0x294bee);_0x3b5334=_0xabf35d[_0x8d2583(0x113)],_0x1f44cf=a35_0x5ecdff[_0x8d2583(0x128)](_0x294bee),_0x3ae9bb[_0x8d2583(0xdd)]&&(console[_0x8d2583(0xeb)]('Found\x20existing\x20tdx.json\x20at:\x20'+_0x294bee),console[_0x8d2583(0xeb)](_0x8d2583(0xed)+_0x3b5334));}else{if(_0x214f8f){if(existsSync(_0x214f8f)&&statSync(_0x214f8f)[_0x8d2583(0xfb)]()){const _0x3b187c=findTdxConfigPath(_0x214f8f);if(_0x3b187c){const _0x255ca2=loadTdxConfig(_0x3b187c);_0x3b5334=_0x255ca2[_0x8d2583(0x113)],_0x1f44cf=a35_0x5ecdff[_0x8d2583(0x128)](_0x3b187c),_0x3ae9bb[_0x8d2583(0xdd)]&&(console[_0x8d2583(0xeb)](_0x8d2583(0x114)+_0x3b187c),console[_0x8d2583(0xeb)](_0x8d2583(0xed)+_0x3b5334));}else return console[_0x8d2583(0xeb)](a35_0x5d72ef[_0x8d2583(0xd3)]('Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20'+_0x214f8f+'\x0a')),console['error'](a35_0x5d72ef[_0x8d2583(0xea)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;}else _0x3b5334=_0x214f8f;}else _0x3b5334=_0x53b855;}if(!_0x3b5334)return console[_0x8d2583(0xeb)](a35_0x5d72ef[_0x8d2583(0x11a)](_0x8d2583(0xf9))),console[_0x8d2583(0xeb)](_0x8d2583(0x139)),console[_0x8d2583(0xeb)](_0x8d2583(0x109)),console[_0x8d2583(0xeb)](_0x8d2583(0xf5)),0x1;_0x3ae9bb[_0x8d2583(0xdd)]&&(console['error'](_0x8d2583(0x145)+_0x3ae9bb['site']),console[_0x8d2583(0xeb)](_0x8d2583(0xfe)+_0x3b5334));const _0x5f33dd=await withSpinner(_0x8d2583(0x13b)+_0x3b5334+'\x27...',()=>_0x4b3379[_0x8d2583(0xd7)][_0x8d2583(0xd9)](_0x3b5334),{'verbose':_0x3ae9bb[_0x8d2583(0xdd)]}),_0x227700=_0x5f33dd[_0x8d2583(0x123)],_0x1a1d8d=await withSpinner(_0x8d2583(0xdf),()=>_0x4b3379['segment'][_0x8d2583(0xe5)](_0x227700),{'verbose':_0x3ae9bb['verbose']}),_0x57e0b5=_0x1a1d8d[_0x8d2583(0x123)][_0x8d2583(0x111)][_0x8d2583(0x137)];_0x3ae9bb[_0x8d2583(0xdd)]&&console[_0x8d2583(0xeb)](_0x8d2583(0xe4)+_0x57e0b5);const [_0x1d49fc,_0x22c6bf,_0x5456b6]=await Promise['all']([withSpinner(_0x8d2583(0x13a),()=>_0x4b3379[_0x8d2583(0xd7)][_0x8d2583(0x122)](_0x227700),{'verbose':_0x3ae9bb[_0x8d2583(0xdd)]}),withSpinner(_0x8d2583(0xe0),()=>_0x4b3379['segment'][_0x8d2583(0xf8)](_0x227700),{'verbose':_0x3ae9bb[_0x8d2583(0xdd)]}),withSpinner(_0x8d2583(0x13f),()=>_0x4b3379[_0x8d2583(0x147)][_0x8d2583(0xee)](_0x227700),{'verbose':_0x3ae9bb['verbose']})]),_0x593be9=_0x1d49fc[_0x8d2583(0x123)],_0x34b191=_0x22c6bf['data'],_0x4370f1=_0x5456b6[_0x8d2583(0x123)];if(_0x593be9[_0x8d2583(0x146)]===0x0&&_0x4370f1['length']===0x0)return console[_0x8d2583(0xeb)](a35_0x5d72ef[_0x8d2583(0x11a)]('No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27'+_0x57e0b5+'\x27')),0x0;const _0xd20299=buildFolderPathMap(_0x34b191),_0x414034=_0x1f44cf||getSegmentRootDir(sanitizeFileName(_0x3b5334)),_0x33df80=new Map();await withSpinner(_0x8d2583(0xef),async()=>{await batchAsync(_0x593be9,async _0x5aff9b=>{const _0x3b99bd=a35_0x6691,_0x5ef2d9=await _0x4b3379[_0x3b99bd(0xd7)][_0x3b99bd(0x115)](_0x227700,_0x5aff9b['id']);_0x33df80['set'](_0x5aff9b['id'],_0x5ef2d9);});},{'verbose':_0x3ae9bb[_0x8d2583(0xdd)]});const _0x3bade8=await withSpinner(_0x8d2583(0xf3),()=>_0x4b3379[_0x8d2583(0xde)]['buildIdToEmailMap'](),{'verbose':_0x3ae9bb['verbose']})[_0x8d2583(0x140)](_0x40f52b=>_0x40f52b[_0x8d2583(0x123)]),_0x264f01=await withSpinner(_0x8d2583(0xec),()=>_0x4b3379[_0x8d2583(0x141)][_0x8d2583(0xf1)](),{'verbose':_0x3ae9bb['verbose']})[_0x8d2583(0x140)](_0x1e1e50=>_0x1e1e50['data']),_0xf9b3fc=[],_0x4b2c71=a35_0x5ecdff[_0x8d2583(0xe2)](_0x414034,_0x8d2583(0xe8)),_0x34b319=createTdxConfigContent(_0x57e0b5);_0xf9b3fc[_0x8d2583(0x13c)](prepareFile(_0x4b2c71,_0x34b319,_0x414034));const _0x4fb30f=new Map();for(const _0x15705d of _0x593be9){if(_0x15705d['kind']===SEGMENT_KIND_JOURNEY)continue;const _0x5d1583=_0x15705d[_0x8d2583(0x12e)]?_0xd20299['get'](_0x15705d[_0x8d2583(0x12e)])||'':'',_0x43fd0a=_0x33df80[_0x8d2583(0xe7)](_0x15705d['id'])||[],_0x47bf0d=segmentWithActivationsToYaml(_0x15705d,_0x43fd0a,undefined,_0x3bade8,_0x264f01),_0x50d22c=_0x5d1583?a35_0x5ecdff[_0x8d2583(0xe2)](_0x414034,_0x5d1583):_0x414034,_0x17031a=sanitizeFileName(_0x15705d[_0x8d2583(0x137)]),_0x193fc3=getUniqueFileName(_0x50d22c,_0x17031a,_0x4fb30f),_0x17bac9=a35_0x5ecdff[_0x8d2583(0xe2)](_0x50d22c,_0x193fc3+'.yml'),_0x1dfb70=segmentToYamlString(_0x47bf0d);_0xf9b3fc[_0x8d2583(0x13c)](prepareFile(_0x17bac9,_0x1dfb70,_0x414034));}const _0x35cc4d=new Map();for(const _0x2010ce of _0x593be9){_0x35cc4d[_0x8d2583(0x107)](_0x2010ce['id'],_0x2010ce);}const _0x1573b8=new Map();for(const _0x12484a of _0x4370f1){const _0xec1ed9=_0x12484a[_0x8d2583(0x10f)];!_0x1573b8[_0x8d2583(0x101)](_0xec1ed9)&&_0x1573b8['set'](_0xec1ed9,[]),_0x1573b8[_0x8d2583(0xe7)](_0xec1ed9)[_0x8d2583(0x13c)](_0x12484a);}for(const _0xe36f7 of _0x1573b8['values']()){_0xe36f7[_0x8d2583(0xf6)]((_0x99ef44,_0x342b9a)=>(_0x99ef44[_0x8d2583(0xfd)]||0x0)-(_0x342b9a[_0x8d2583(0xfd)]||0x0));}const _0x2c0139=()=>{const _0x5455b8=_0x8d2583,_0x4d1188=new Set(),_0x2ca38a=new Set(),_0x285616=new Map(),_0x40c222=new Map(),_0x5a8ee0=createJumpTargetCache(),_0xf4a637=(_0x446b02,_0x371d67)=>({'resolveSegment':async _0x1decff=>{const _0xe47707=a35_0x6691,_0x2ce2b2=_0x285616[_0xe47707(0xe7)](_0x1decff);if(_0x2ce2b2!==undefined)return{'name':_0x2ce2b2,'isJourneyLocal':!![]};if(!_0x371d67)return{'name':_0x1decff,'isJourneyLocal':![]};try{let _0x29fbab=_0x35cc4d['get'](_0x1decff);!_0x29fbab&&(_0x29fbab=await _0x4b3379[_0xe47707(0xd7)][_0xe47707(0x12a)](_0x371d67,_0x1decff));const _0x2776e3=generateJourneyLocalName(_0x29fbab[_0xe47707(0x137)]),_0x340df4=_0x29fbab[_0xe47707(0x132)]===SEGMENT_KIND_JOURNEY&&_0x2776e3!==undefined;let _0x56d912=_0x29fbab[_0xe47707(0x137)];if(_0x340df4&&_0x2776e3){let _0x5ba600=_0x2776e3,_0x4e1d16=0x2;while(_0x4d1188[_0xe47707(0x101)](_0x5ba600)){_0x5ba600=_0x2776e3+'_'+_0x4e1d16,_0x4e1d16++;}_0x4d1188[_0xe47707(0x134)](_0x5ba600),_0x56d912=_0x5ba600,_0x285616[_0xe47707(0x107)](_0x1decff,_0x56d912);}let _0x1e2cc6;return _0x340df4&&_0x29fbab['rule']&&(_0x1e2cc6={'description':_0x29fbab['description'],'rule':apiRuleToYaml(_0x29fbab[_0xe47707(0x13d)])}),{'name':_0x56d912,'isJourneyLocal':_0x340df4,'definition':_0x1e2cc6};}catch(_0xe99377){return _0x3ae9bb['verbose']&&console[_0xe47707(0xeb)]('Warning:\x20Could\x20not\x20resolve\x20segment\x20'+_0x1decff+':\x20'+_0xe99377[_0xe47707(0x117)]),{'name':_0x1decff,'isJourneyLocal':![]};}},'resolveActivation':async _0x564b52=>{const _0x4100d9=a35_0x6691,_0x459a87=_0x40c222[_0x4100d9(0xe7)](_0x564b52);if(_0x459a87!==undefined)return{'name':_0x459a87,'isJourneyLocal':!![]};try{const _0x343bd3=await _0x4b3379[_0x4100d9(0x147)][_0x4100d9(0xdb)](_0x446b02,_0x564b52),_0x2f84da=_0x343bd3[_0x4100d9(0x111)]['activationParams'][_0x4100d9(0x137)]||_0x564b52,_0x4b76d2=sanitizeYamlKey(_0x2f84da)||'activation_'+_0x564b52;let _0x471b0f=_0x4b76d2,_0x50d354=0x2;while(_0x2ca38a['has'](_0x471b0f)){_0x471b0f=_0x4b76d2+'_'+_0x50d354,_0x50d354++;}_0x2ca38a[_0x4100d9(0x134)](_0x471b0f),_0x40c222[_0x4100d9(0x107)](_0x564b52,_0x471b0f);const _0x4673ad=journeyActivationStepToYaml(_0x343bd3,_0x3bade8,_0x264f01);return{'name':_0x471b0f,'isJourneyLocal':!![],'definition':_0x4673ad};}catch(_0x44aa0a){return _0x3ae9bb[_0x4100d9(0xdd)]&&console['error'](_0x4100d9(0xf7)+_0x564b52+':\x20'+_0x44aa0a[_0x4100d9(0x117)]),{'name':_0x564b52,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0xd4e5f4,_0x2bb58a)=>resolveJumpTarget(_0xd4e5f4,_0x2bb58a,_0x5a8ee0,_0x156ffd=>_0x4b3379[_0x5455b8(0x147)][_0x5455b8(0x112)](_0x156ffd))});return{'createYamlContext':_0xf4a637};};if(_0x1573b8[_0x8d2583(0xd5)]>0x0){const _0x35c0d5=Array[_0x8d2583(0x118)](_0x1573b8[_0x8d2583(0x120)]()),_0x5d1d25=await withQuerySpinner(_0x8d2583(0xf0),async _0x58490c=>{const _0xbaf7d4=_0x8d2583,_0x34b3dd=[];let _0x1bb73d=0x0;const _0x1c76ff=0x5;for(let _0x31f330=0x0;_0x31f330<_0x35c0d5[_0xbaf7d4(0x146)];_0x31f330+=_0x1c76ff){const _0x262f7e=_0x35c0d5[_0xbaf7d4(0xf2)](_0x31f330,_0x31f330+_0x1c76ff),_0x5d4ac3=await Promise[_0xbaf7d4(0x100)](_0x262f7e[_0xbaf7d4(0x10e)](async _0x3a4942=>{const _0x57bbb1=_0xbaf7d4,_0x481586=_0x3a4942[0x0],_0x189246=_0x481586[_0x57bbb1(0x119)];_0x58490c[_0x57bbb1(0x144)](_0x57bbb1(0x11d)+_0x189246+'\x27');const _0x1df476=_0x481586[_0x57bbb1(0xd2)]?_0xd20299[_0x57bbb1(0xe7)](_0x481586['folderId'])||'':'',{createYamlContext:_0xf039c8}=_0x2c0139(),_0x1d6cdf=[];for(const _0x5377b3 of _0x3a4942){const _0x40d2ec=await _0x4b3379[_0x57bbb1(0x147)][_0x57bbb1(0x112)](_0x5377b3['id']),_0x439dc6=_0x40d2ec['attributes']?.[_0x57bbb1(0xda)],_0x5d1f7c=_0xf039c8(_0x5377b3['id'],_0x439dc6),_0xf83c86=await apiToYamlAsync(_0x40d2ec,_0x5d1f7c);_0x1d6cdf['push']({'item':_0x5377b3,'yaml':_0xf83c86});}let _0x5c929f;return _0x1d6cdf[_0x57bbb1(0x146)]===0x1?_0x5c929f=_0x1d6cdf[0x0][_0x57bbb1(0x104)]:_0x5c929f=buildMergedJourneyYaml(_0x1d6cdf),{'bundleName':_0x189246,'folderPath':_0x1df476,'finalYaml':_0x5c929f};}));_0x34b3dd['push'](..._0x5d4ac3),_0x1bb73d+=_0x262f7e[_0xbaf7d4(0x146)],_0x58490c[_0xbaf7d4(0x106)]('('+_0x1bb73d+'/'+_0x35c0d5[_0xbaf7d4(0x146)]+')');}return _0x34b3dd;},{'verbose':_0x3ae9bb[_0x8d2583(0xdd)]});for(const {bundleName:_0x5e4540,folderPath:_0x49e039,finalYaml:_0x4119e1}of _0x5d1d25[_0x8d2583(0x123)]){const _0x43820d=a35_0x574df3(_0x4119e1),_0x11e627=_0x49e039?a35_0x5ecdff['join'](_0x414034,_0x49e039):_0x414034,_0x360e58=sanitizeFileName(_0x5e4540),_0x170fc5=getUniqueFileName(_0x11e627,_0x360e58,_0x4fb30f),_0x2206a5=a35_0x5ecdff[_0x8d2583(0xe2)](_0x11e627,_0x170fc5+'.yml');_0xf9b3fc[_0x8d2583(0x13c)](prepareFile(_0x2206a5,_0x43820d,_0x414034));}}const _0x3171ea=Array[_0x8d2583(0x118)](_0x33df80[_0x8d2583(0x120)]())[_0x8d2583(0x133)]((_0x1daf56,_0x2fc434)=>_0x1daf56+_0x2fc434[_0x8d2583(0x146)],0x0),_0x4fde8f=_0xf9b3fc[_0x8d2583(0x136)](_0x5b307a=>_0x5b307a['isNew']),_0x44f63f=_0xf9b3fc['filter'](_0x30728b=>!_0x30728b[_0x8d2583(0x130)]&&_0x30728b['hasChanges']),_0x2e6ba2=_0xf9b3fc['filter'](_0x3598f0=>!_0x3598f0[_0x8d2583(0x130)]&&!_0x3598f0[_0x8d2583(0x11c)]),_0x490186=_0x593be9[_0x8d2583(0x136)](_0x254017=>_0x254017['kind']!==SEGMENT_KIND_JOURNEY);console[_0x8d2583(0xeb)](_0x8d2583(0x12f)+_0x57e0b5+'\x27:'),console['error'](_0x8d2583(0x124)+a35_0x5d72ef[_0x8d2583(0xea)](_0x490186[_0x8d2583(0x146)]+_0x8d2583(0x129))+_0x8d2583(0x11e)+a35_0x5d72ef[_0x8d2583(0xea)](_0x3171ea+'\x20activations'));if(_0x1573b8['size']>0x0){const _0x2bdd65=_0x4370f1['length'],_0x2117bf=_0x1573b8[_0x8d2583(0xd5)],_0x117f6e=_0x2bdd65>_0x2117bf?'\x20('+_0x2bdd65+_0x8d2583(0x127):'';console[_0x8d2583(0xeb)](_0x8d2583(0xd1)+a35_0x5d72ef[_0x8d2583(0xea)](_0x2117bf+_0x8d2583(0xd6))+a35_0x5d72ef['dim'](_0x117f6e));}console[_0x8d2583(0xeb)]('\x20\x20'+a35_0x5d72ef[_0x8d2583(0xe1)]('+\x20'+_0x4fde8f[_0x8d2583(0x146)]+_0x8d2583(0x149))),console['error']('\x20\x20'+a35_0x5d72ef[_0x8d2583(0x11a)]('~\x20'+_0x44f63f[_0x8d2583(0x146)]+_0x8d2583(0x121))),console[_0x8d2583(0xeb)]('\x20\x20'+a35_0x5d72ef[_0x8d2583(0x13e)]('=\x20'+_0x2e6ba2[_0x8d2583(0x146)]+_0x8d2583(0x126))),console[_0x8d2583(0xeb)](_0x8d2583(0x11b)+a35_0x5d72ef[_0x8d2583(0xea)](_0x414034)+'\x0a');if(_0x44f63f['length']>0x0)for(const _0x2f0cc7 of _0x44f63f){console[_0x8d2583(0xeb)](_0x8d2583(0xfa)+_0x2f0cc7[_0x8d2583(0x10a)]+'\x27:'),console[_0x8d2583(0xeb)]('─'[_0x8d2583(0x148)](0x3c)),console[_0x8d2583(0xeb)](_0x2f0cc7[_0x8d2583(0x138)]),console['error']('─'[_0x8d2583(0x148)](0x3c));}if(_0x3ae9bb[_0x8d2583(0xdc)])return console['error'](a35_0x5d72ef[_0x8d2583(0x11a)](_0x8d2583(0x108))),0x0;if(_0x4fde8f[_0x8d2583(0x146)]===0x0&&_0x44f63f[_0x8d2583(0x146)]===0x0)return console[_0x8d2583(0xeb)](a35_0x5d72ef['green'](_0x8d2583(0x10d))),saveSessionContext({'parent_segment':_0x57e0b5},_0x3ae9bb[_0x8d2583(0x135)]),console[_0x8d2583(0xeb)](a35_0x5d72ef[_0x8d2583(0xe1)](_0x8d2583(0xff)+a35_0x5d72ef[_0x8d2583(0x13e)](_0x8d2583(0x113))+'\x20=\x20'+a35_0x5d72ef[_0x8d2583(0xea)](_0x57e0b5))),0x0;if(!_0x3ae9bb['yes']&&(_0x4fde8f[_0x8d2583(0x146)]>0x0||_0x44f63f[_0x8d2583(0x146)]>0x0)){const _0x4eac83=await confirmKey(_0x8d2583(0x103)+(_0x4fde8f['length']+_0x44f63f[_0x8d2583(0x146)])+_0x8d2583(0xe6));if(!_0x4eac83)return console[_0x8d2583(0xeb)](_0x8d2583(0xd4)),0x1;}for(const _0x195931 of _0xf9b3fc){if(_0x195931['isNew']||_0x195931[_0x8d2583(0x11c)]){const _0x17771=a35_0x5ecdff[_0x8d2583(0x128)](_0x195931['absolutePath']);!existsSync(_0x17771)&&mkdirSync(_0x17771,{'recursive':!![]}),writeFileSync(_0x195931[_0x8d2583(0xe9)],_0x195931['content'],_0x8d2583(0x105));}}return console[_0x8d2583(0xeb)](a35_0x5d72ef['green'](_0x8d2583(0x12b)+(_0x4fde8f[_0x8d2583(0x146)]+_0x44f63f[_0x8d2583(0x146)])+'\x20files\x20to\x20'+_0x414034)),saveSessionContext({'parent_segment':_0x57e0b5},_0x3ae9bb[_0x8d2583(0x135)]),console['error'](a35_0x5d72ef[_0x8d2583(0xe1)](_0x8d2583(0xff)+a35_0x5d72ef['dim'](_0x8d2583(0x113))+_0x8d2583(0x10b)+a35_0x5d72ef['cyan'](_0x57e0b5))),0x0;}}function buildFolderPathMap(_0x1929b6){const _0x494e60=a35_0x3aadc2,_0x474ea7=new Map(),_0x2bcb91=new Map();for(const _0x18cb5a of _0x1929b6){_0x2bcb91[_0x494e60(0x107)](_0x18cb5a['id'],_0x18cb5a);}const _0x6d7010=new Set();for(const _0xea2c04 of _0x1929b6){!_0xea2c04[_0x494e60(0x11f)]&&_0x6d7010[_0x494e60(0x134)](_0xea2c04['id']);}function _0x76318f(_0x14d71c){const _0x39dda3=_0x494e60;if(_0x474ea7[_0x39dda3(0x101)](_0x14d71c['id']))return _0x474ea7[_0x39dda3(0xe7)](_0x14d71c['id']);if(_0x6d7010[_0x39dda3(0x101)](_0x14d71c['id']))return _0x474ea7[_0x39dda3(0x107)](_0x14d71c['id'],''),'';if(_0x14d71c[_0x39dda3(0x11f)]){const _0xe94e0f=_0x2bcb91[_0x39dda3(0xe7)](_0x14d71c[_0x39dda3(0x11f)]);if(_0xe94e0f){const _0x455cf2=_0x76318f(_0xe94e0f),_0xcf1775=_0x455cf2?_0x455cf2+'/'+_0x14d71c[_0x39dda3(0x137)]:_0x14d71c[_0x39dda3(0x137)];return _0x474ea7[_0x39dda3(0x107)](_0x14d71c['id'],_0xcf1775),_0xcf1775;}}const _0x39a55c=_0x14d71c['name'];return _0x474ea7[_0x39dda3(0x107)](_0x14d71c['id'],_0x39a55c),_0x39a55c;}for(const _0xbed4c3 of _0x1929b6){_0x76318f(_0xbed4c3);}return _0x474ea7;}function getUniqueFileName(_0x524450,_0x1b6694,_0x32fd1f){const _0xf5cdcf=a35_0x3aadc2,_0x5e6a34=_0x524450+':'+_0x1b6694,_0x3bd4d5=_0x32fd1f[_0xf5cdcf(0xe7)](_0x5e6a34)||0x0;_0x32fd1f[_0xf5cdcf(0x107)](_0x5e6a34,_0x3bd4d5+0x1);if(_0x3bd4d5===0x0)return _0x1b6694;return _0x1b6694+'-'+_0x3bd4d5;}function prepareFile(_0x587a78,_0x26e6ed,_0x5ab0b4){const _0x503393=a35_0x3aadc2,_0x212dc8=a35_0x5ecdff[_0x503393(0xf4)](_0x5ab0b4,_0x587a78);if(existsSync(_0x587a78)){const _0x15d448=readFileSync(_0x587a78,'utf-8'),_0x3ac7fd=generateDiff(_0x15d448,_0x26e6ed),_0x298626=hasChanges(_0x3ac7fd);return{'relativePath':_0x212dc8,'absolutePath':_0x587a78,'content':_0x26e6ed,'isNew':![],'hasChanges':_0x298626,'diff':_0x298626?formatDiffWithColors(_0x3ac7fd):undefined};}return{'relativePath':_0x212dc8,'absolutePath':_0x587a78,'content':_0x26e6ed,'isNew':!![],'hasChanges':![]};}
@@ -1 +1 @@
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
+ const a36_0x3acda7=a36_0x2d92;function a36_0xe3b9(){const _0x5bc94d=['/app/ps/','2737388PWuwCS','Delete\x20journey:','\x20to\x20delete','\x20\x20Activations:','Entry\x20criteria:\x20','\x20new','folderPath','\x27\x20with\x20ID:\x20','error','DecisionPoint','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','\x20folders\x20to\x20create','Activation','\x20updated','buildIdToNameMap','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','execute','resolveParentId','\x20created','listSegments','Segment\x20not\x20found:\x20','updated','Fetching\x20parent\x20segment\x20details...','dirname','update','cyan','max','\x20journey\x20\x27','journeysOnly','toLowerCase','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','📁\x20','existingActivation','\x20\x20Segments:\x20','state','createFolder','toString','\x27\x20v','Updating\x20segment\x20\x27','entryCriteria','\x20\x20Step\x202b:\x20Creating\x20embedded\x20activation\x20\x27','activationParams','Changes\x20to:','absolutePath','getActivation','\x20changed','split','action','3023eAHMZo','✔\x20Created\x20folder\x20\x27','sort','SEGMENT_UPDATE_ERROR','config','item','10327644htObmz','join','\x20\x20Step\x202:\x20Creating\x20embedded\x20segment\x20\x27','diff','parentSegment','\x27\x20not\x20found\x20in\x20journey\x20\x27','\x27...','parentSegmentFolder','steps','\x20\x20Created\x20embedded\x20segment\x20\x27','Failed\x20to\x20create\x20embedded\x20activation\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','Resolving\x20parent\x20segment\x20\x27','\x20\x20Source:\x20','segmentId','✔\x20Created\x20segment\x20\x27','New\x20journey:','Activation\x20not\x20found:\x20','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','activations','isNew','type','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','relationships','stages','Site:\x20','212prtjqi','resolve','journeyId','journey_entry_criteria_','from','existingJourney','\x20deleted','\x20\x20\x20\x20','journeyBundleName','\x0a\x20\x20','\x20\x20📊\x20Segments:','.yml','ACTIVATION_UPDATE_ERROR','\x20activation\x20\x27','size','existingSegment','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','9134986HjAErG','yellow','draft','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','parentFolderId','createSegment','\x20\x20Step\x203:\x20Updating\x20journey\x20with\x20entry\x20criteria\x20and\x20activation\x20IDs:\x20','yes','unchanged','New\x20segment:','Creating','✔\x20Deleted\x20segment\x20\x27','versionNumber','✔\x20Updated\x20journey\x20\x27','dryRun','yamlConfig','\x20\x20✔\x20Updated\x20activation\x20\x27','\x20unchanged','SEGMENT_NOT_FOUND','delete',')\x20with\x20ID:\x20','journey','buildNameToIdMap','Creating\x20activation\x20\x27','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','getJourney','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','/j/da/je','keys','find','all','activation_','\x20YAML\x20files\x20found','replace',').\x20','listFolders','ACTIVATION_SYNTAX_ERROR','repeat','create','6364161fMPdnO','Folders\x20to\x20create:','Failed\x20to\x20','red','INTERNAL','name','.yaml','values','buildUserMaps','flatMap','/e/','verbose','Stage\x20\x27','No\x20','8JbBcmH','listActivations','\x27:\x20','attributes','endsWith','✔\x20Created\x20journey\x20\x27','map','\x20activations]','(Journey\x20will\x20be\x20deleted)','\x20\x20Activations:\x20','Scoped\x20to\x20folder:\x20','rule','Parent\x20segment:\x20','blue','\x20\x20🗺️\x20\x20Journeys:','segment','entries','slice','activationActions','push','dim','createActivation',')\x20with\x20journeyId:\x20','length','\x20\x20✔\x20Created\x20activation\x20\x27','green','randomUUID','site','entry','NOT_FOUND','5046095KQLilR','has','get','Changes\x20to\x20journey:','\x27\x20details...','utf-8','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','add','isFile','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','3813117zjrZrp','cwd','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','hasChanges','segmentFolderId','created','JOURNEY_UPDATE_ERROR','data','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','SEGMENT_SYNTAX_ERROR','description','user','\x20to\x20update','Fetching\x20journey\x20\x27','journeyActivationStepId','journeyStages','stringify','Creating\x20segment\x20\x27','Error\x20parsing\x20','relative','message','resolveJourneyId','connection','\x20changes?','Deleting\x20segment\x20\x27','\x20\x20✔\x20Deleted\x20activation\x20\x27','Push\x20','parse','folderId','Aborted.','Source\x20directory:\x20','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','JOURNEY_SYNTAX_ERROR','\x20\x20Journeys:\x20','Updating\x20activation\x20\x27','entry_criteria','\x27\x20(internal:\x20','getSegment','kind','configDir','\x20journey\x20from\x20file:\x20','\x20\x20Created\x20embedded\x20activation\x20\x27','parent_segment','createJourneySegment','filter','folder','set','deleteSegment','\x27\x20with\x20journeyId:\x20','\x20to\x20create','Deleting\x20activation\x20\x27','✔\x20Updated\x20segment\x20\x27','startsWith','yamlActivation','segment\x20or\x20journey','branches','then','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID'];a36_0xe3b9=function(){return _0x5bc94d;};return a36_0xe3b9();}(function(_0x1e4407,_0x33ab3f){const _0x325c4d=a36_0x2d92,_0x31819b=_0x1e4407();while(!![]){try{const _0x1a5e8c=parseInt(_0x325c4d(0x2b7))/0x1*(-parseInt(_0x325c4d(0x1de))/0x2)+parseInt(_0x325c4d(0x24c))/0x3+parseInt(_0x325c4d(0x287))/0x4+-parseInt(_0x325c4d(0x242))/0x5+-parseInt(_0x325c4d(0x2bd))/0x6+parseInt(_0x325c4d(0x1ef))/0x7*(parseInt(_0x325c4d(0x224))/0x8)+parseInt(_0x325c4d(0x216))/0x9;if(_0x1a5e8c===_0x33ab3f)break;else _0x31819b['push'](_0x31819b['shift']());}catch(_0x3a87fa){_0x31819b['push'](_0x31819b['shift']());}}}(a36_0xe3b9,0xdfc66));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_0x1dccde,yamlToApi as a36_0x4a4bea,toYamlString as a36_0x238ca4,apiToYamlAsync,hasMultipleVersions,normalizeJourneyYaml}from'../sdk/segment/journey-yaml.js';function a36_0x2d92(_0x215564,_0x584b08){_0x215564=_0x215564-0x1dc;const _0xe3b91f=a36_0xe3b9();let _0x2d9230=_0xe3b91f[_0x215564];return _0x2d9230;}import a36_0x20973d from'chalk';import{existsSync,readFileSync,statSync,readdirSync}from'fs';import a36_0x23b535 from'path';import{getConsoleNextUrl}from'../types/endpoints.js';import*as a36_0x575e8b 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(_0x136f7b){return''+PENDING_SEGMENT_PREFIX+_0x136f7b+'__';}function isPendingSegmentId(_0x294b02){const _0x468356=a36_0x2d92;return _0x294b02[_0x468356(0x280)](PENDING_SEGMENT_PREFIX);}function extractPendingSegmentName(_0x1c9a5d){const _0x578a9b=a36_0x2d92;return _0x1c9a5d[_0x578a9b(0x210)](/^__pending_(.+)__$/,'$1');}const PENDING_ACTIVATION_PREFIX='__pending_act_';function createPendingActivationId(_0x42d76b){return''+PENDING_ACTIVATION_PREFIX+_0x42d76b+'__';}function isPendingActivationId(_0x15cafc){return _0x15cafc['startsWith'](PENDING_ACTIVATION_PREFIX);}function extractPendingActivationName(_0x35652f){const _0x396097=a36_0x2d92;return _0x35652f[_0x396097(0x210)](/^__pending_act_(.+)__$/,'$1');}function ensureJourneyDefaults(_0x5396a9){const _0x3d4a7c=a36_0x2d92;!_0x5396a9[_0x3d4a7c(0x256)]&&(_0x5396a9[_0x3d4a7c(0x256)]=''),!_0x5396a9[_0x3d4a7c(0x2a9)]&&(_0x5396a9[_0x3d4a7c(0x2a9)]=_0x3d4a7c(0x1f1));}function tryFindTdxConfig(_0x548d80){try{return findTdxConfig(_0x548d80);}catch{return null;}}function resolveTDFolderPath(_0x39f854,_0x895df2,_0x1b0590){if(!_0x895df2)return _0x39f854;return _0x39f854?_0x1b0590+'/'+_0x39f854:_0x1b0590;}export class SegmentPushCommand extends BaseCommand{[a36_0x3acda7(0x21b)]='segment:push';['description']=a36_0x3acda7(0x26b);async[a36_0x3acda7(0x297)](_0x3d4e90){const _0x4e4f1c=a36_0x3acda7,{options:_0x5c00b6,args:_0x3bb252,tdx:_0x412c11}=_0x3d4e90,_0x1a7b21=_0x5c00b6,_0x353089=_0x5c00b6[_0x4e4f1c(0x2c1)],_0x20c381=_0x3bb252[0x0];let _0x1b8a64,_0x457cf4,_0x2427e5,_0x1d4589;if(_0x20c381){if(existsSync(_0x20c381)&&statSync(_0x20c381)['isDirectory']()){const _0x448d04=tryFindTdxConfig(_0x20c381);if(_0x448d04)_0x1b8a64=_0x448d04[_0x4e4f1c(0x2bb)][_0x4e4f1c(0x276)],_0x457cf4=_0x20c381,_0x2427e5=_0x448d04['configDir'];else return console[_0x4e4f1c(0x28f)](a36_0x20973d[_0x4e4f1c(0x219)](_0x4e4f1c(0x296)+_0x20c381+'\x0a')),console[_0x4e4f1c(0x28f)](a36_0x20973d['cyan'](_0x4e4f1c(0x209))),0x1;}else{if(existsSync(_0x20c381)&&statSync(_0x20c381)[_0x4e4f1c(0x24a)]()){const _0x7e5f4d=a36_0x23b535[_0x4e4f1c(0x29e)](_0x20c381),_0x3bbb87=tryFindTdxConfig(_0x7e5f4d);if(_0x3bbb87)_0x1b8a64=_0x3bbb87['config'][_0x4e4f1c(0x276)],_0x2427e5=_0x3bbb87[_0x4e4f1c(0x273)],_0x457cf4=_0x3bbb87[_0x4e4f1c(0x273)],_0x1d4589=a36_0x23b535[_0x4e4f1c(0x1df)](_0x20c381);else return console[_0x4e4f1c(0x28f)](a36_0x20973d['red'](_0x4e4f1c(0x296)+_0x7e5f4d+'\x0a')),console[_0x4e4f1c(0x28f)](a36_0x20973d[_0x4e4f1c(0x2a0)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;}else _0x1b8a64=_0x20c381;}}else{const _0x5974a1=tryFindTdxConfig(process[_0x4e4f1c(0x24d)]());_0x5974a1?(_0x1b8a64=_0x5974a1[_0x4e4f1c(0x2bb)][_0x4e4f1c(0x276)],_0x457cf4=process['cwd'](),_0x2427e5=_0x5974a1[_0x4e4f1c(0x273)]):_0x1b8a64=_0x353089;}if(!_0x1b8a64)return console[_0x4e4f1c(0x28f)](a36_0x20973d[_0x4e4f1c(0x1f0)](_0x4e4f1c(0x24e))),console[_0x4e4f1c(0x28f)]('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)'),console[_0x4e4f1c(0x28f)](_0x4e4f1c(0x2c8)),console[_0x4e4f1c(0x28f)](_0x4e4f1c(0x1ee)),0x1;const _0x5b7a6f=_0x457cf4||getSegmentRootDir(sanitizeFileName(_0x1b8a64)),_0x2bca27=_0x2427e5||_0x5b7a6f,_0x360e87=a36_0x23b535[_0x4e4f1c(0x25f)](_0x2bca27,_0x5b7a6f),_0x27eca8=_0x360e87!==''&&_0x360e87!=='.';if(!existsSync(_0x5b7a6f))return console[_0x4e4f1c(0x28f)](a36_0x20973d['red']('Error:\x20Directory\x20not\x20found:\x20'+_0x5b7a6f+'\x0a')),console[_0x4e4f1c(0x28f)](a36_0x20973d[_0x4e4f1c(0x2a0)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;_0x1a7b21[_0x4e4f1c(0x221)]&&(console['error'](_0x4e4f1c(0x1dd)+_0x1a7b21[_0x4e4f1c(0x23f)]),console['error'](_0x4e4f1c(0x230)+_0x1b8a64),console[_0x4e4f1c(0x28f)](_0x4e4f1c(0x26a)+_0x5b7a6f),_0x27eca8&&console[_0x4e4f1c(0x28f)](_0x4e4f1c(0x22e)+_0x360e87));const _0x41297e=await withSpinner(_0x4e4f1c(0x2c9)+_0x1b8a64+'\x27...',()=>_0x412c11['segment'][_0x4e4f1c(0x298)](_0x1b8a64),{'verbose':_0x1a7b21[_0x4e4f1c(0x221)]}),_0x21f120=_0x41297e[_0x4e4f1c(0x253)],[_0x38dc86,_0x28bb42,_0x4ad8c5,_0x4f8125,_0x42c240]=await Promise[_0x4e4f1c(0x20d)]([withSpinner(_0x4e4f1c(0x29d),()=>_0x412c11[_0x4e4f1c(0x233)]['getParent'](_0x21f120),{'verbose':_0x1a7b21[_0x4e4f1c(0x221)]}),withSpinner('Fetching\x20existing\x20segments...',()=>_0x412c11['segment'][_0x4e4f1c(0x29a)](_0x21f120),{'verbose':_0x1a7b21[_0x4e4f1c(0x221)]}),withSpinner('Fetching\x20existing\x20folders...',()=>_0x412c11[_0x4e4f1c(0x233)][_0x4e4f1c(0x212)](_0x21f120),{'verbose':_0x1a7b21[_0x4e4f1c(0x221)]}),withSpinner('Fetching\x20existing\x20journeys...',()=>_0x412c11[_0x4e4f1c(0x204)]['listJourneysFromParentSegment'](_0x21f120),{'verbose':_0x1a7b21['verbose']}),withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x412c11[_0x4e4f1c(0x257)][_0x4e4f1c(0x21e)](),{'verbose':_0x1a7b21[_0x4e4f1c(0x221)]})[_0x4e4f1c(0x284)](_0x32fa37=>_0x32fa37['data'])]),_0x29ae5a=_0x38dc86[_0x4e4f1c(0x253)],_0x5e821c=_0x29ae5a['relationships']?.[_0x4e4f1c(0x2c4)]?.[_0x4e4f1c(0x253)]?.['id']||_0x29ae5a[_0x4e4f1c(0x2d4)]?.['parentFolder']?.[_0x4e4f1c(0x253)]?.['id'],_0x193067=_0x28bb42[_0x4e4f1c(0x253)],_0x35e0ab=_0x4ad8c5['data'],_0x464d02=_0x4f8125[_0x4e4f1c(0x253)],{emailToId:_0x1e5a5f,idToEmail:_0x4e534f}=_0x42c240,[_0x2e76a9,_0x4941da]=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',async()=>{const _0x2364e0=_0x4e4f1c,[_0x171461,_0x13c80d]=await Promise[_0x2364e0(0x20d)]([_0x412c11[_0x2364e0(0x262)][_0x2364e0(0x205)](),_0x412c11[_0x2364e0(0x262)][_0x2364e0(0x295)]()]);return[_0x171461,_0x13c80d];},{'verbose':_0x1a7b21[_0x4e4f1c(0x221)]})['then'](_0x1a084a=>_0x1a084a[_0x4e4f1c(0x253)]),_0x268b36=buildFolderPathToIdMap(_0x35e0ab),_0xe23df7=new Map();for(const [_0x455f3b,_0x2dfc1e]of _0x268b36[_0x4e4f1c(0x234)]()){_0xe23df7[_0x4e4f1c(0x27a)](_0x2dfc1e,_0x455f3b);}const _0x205db8=new Map();for(const _0x33612a of _0x193067){const _0x233c28=_0x33612a[_0x4e4f1c(0x250)]?_0xe23df7[_0x4e4f1c(0x244)](_0x33612a['segmentFolderId'][_0x4e4f1c(0x2ab)]())||'':'',_0x50fc6a=_0x233c28+':'+_0x33612a[_0x4e4f1c(0x21b)];_0x205db8['set'](_0x50fc6a,_0x33612a);}const _0x586bbf=new Map();for(const _0x4097c1 of _0x193067){_0x586bbf[_0x4e4f1c(0x27a)](_0x4097c1[_0x4e4f1c(0x21b)],_0x4097c1['id']);}const _0x1b2919=new Map();for(const _0x1a643e of _0x464d02){const _0x56cdd5=_0x1a643e[_0x4e4f1c(0x268)]?_0xe23df7[_0x4e4f1c(0x244)](_0x1a643e[_0x4e4f1c(0x268)])||'':'',_0x3d55ef=_0x56cdd5+':'+_0x1a643e['journeyBundleName'];!_0x1b2919['has'](_0x3d55ef)&&_0x1b2919['set'](_0x3d55ef,[]),_0x1b2919[_0x4e4f1c(0x244)](_0x3d55ef)[_0x4e4f1c(0x237)](_0x1a643e);}for(const _0x1dda76 of _0x1b2919[_0x4e4f1c(0x21d)]()){_0x1dda76[_0x4e4f1c(0x2b9)]((_0x28f9dd,_0x561380)=>(_0x28f9dd[_0x4e4f1c(0x1fb)]||0x0)-(_0x561380[_0x4e4f1c(0x1fb)]||0x0));}let _0xc52129;if(_0x1d4589){if(!_0x1d4589[_0x4e4f1c(0x228)](_0x4e4f1c(0x1e9))&&!_0x1d4589[_0x4e4f1c(0x228)](_0x4e4f1c(0x21c)))return console[_0x4e4f1c(0x28f)](a36_0x20973d[_0x4e4f1c(0x219)](_0x4e4f1c(0x24b)+_0x1d4589+'\x0a')),0x1;_0xc52129=[_0x1d4589];}else _0xc52129=findYamlFiles(_0x5b7a6f);if(_0xc52129['length']===0x0)return console[_0x4e4f1c(0x28f)](a36_0x20973d['red'](_0x4e4f1c(0x1f2)+_0x5b7a6f+'\x0a')),console[_0x4e4f1c(0x28f)](a36_0x20973d[_0x4e4f1c(0x2a0)](_0x4e4f1c(0x248))),0x1;const _0x42c254=[],_0x46cc3e=[];for(const _0x79b301 of _0xc52129){const _0x4baad9=a36_0x23b535[_0x4e4f1c(0x25f)](_0x5b7a6f,a36_0x23b535[_0x4e4f1c(0x29e)](_0x79b301)),_0x55deff=_0x4baad9==='.'?'':_0x4baad9,_0x538009=readFileSync(_0x79b301,_0x4e4f1c(0x247));try{const _0x10f406=a36_0x575e8b[_0x4e4f1c(0x267)](_0x538009);if(isJourneyYaml(_0x10f406)){const _0x2e0f26=a36_0x1dccde(_0x538009);_0x46cc3e[_0x4e4f1c(0x237)]({'yamlConfig':_0x2e0f26,'folderPath':_0x55deff,'sourcePath':_0x79b301});}else{if(!_0x1a7b21[_0x4e4f1c(0x2a3)]){const _0x304a63=parseSegmentYamlFile(_0x538009),_0x40aab8=normalizeChildSegmentYaml(_0x304a63);_0x42c254[_0x4e4f1c(0x237)]({'yamlConfig':_0x40aab8,'folderPath':_0x55deff,'sourcePath':_0x79b301});}}}catch(_0x1b81db){return console[_0x4e4f1c(0x28f)](a36_0x20973d[_0x4e4f1c(0x219)](_0x4e4f1c(0x25e)+_0x79b301+':\x20'+(_0x1b81db instanceof Error?_0x1b81db[_0x4e4f1c(0x260)]:_0x1b81db))),0x1;}}if(_0x42c254['length']===0x0&&_0x46cc3e[_0x4e4f1c(0x23b)]===0x0){const _0x4af277=_0x1a7b21[_0x4e4f1c(0x2a3)]?'journey':_0x4e4f1c(0x282);return console['error'](a36_0x20973d[_0x4e4f1c(0x1f0)](_0x4e4f1c(0x223)+_0x4af277+_0x4e4f1c(0x20f))),0x0;}const _0x40c4bc=new Map();_0x193067[_0x4e4f1c(0x23b)]>0x0&&!_0x1a7b21['journeysOnly']&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x193067,async _0x5a7c45=>{const _0x40ea6f=a36_0x2d92,_0x1e2650=await _0x412c11[_0x40ea6f(0x233)][_0x40ea6f(0x225)](_0x21f120,_0x5a7c45['id']);_0x40c4bc[_0x40ea6f(0x27a)](_0x5a7c45['id'],_0x1e2650);});},{'verbose':_0x1a7b21[_0x4e4f1c(0x221)]});const _0xf41464=[],_0x51eca8=new Set();for(const {yamlConfig:_0x2d4662,folderPath:_0x2b333c,sourcePath:_0xa9c1ff}of _0x42c254){const _0x5bd13e=resolveTDFolderPath(_0x2b333c,_0x27eca8,_0x360e87),_0x418898=_0x5bd13e+':'+_0x2d4662[_0x4e4f1c(0x21b)],_0xf8fc16=_0x205db8[_0x4e4f1c(0x244)](_0x418898),_0x3908a7=_0xf8fc16?_0x40c4bc['get'](_0xf8fc16['id'])||[]:[];if(_0x5bd13e&&!_0x268b36[_0x4e4f1c(0x243)](_0x5bd13e)){const _0x4b87bd=_0x5bd13e[_0x4e4f1c(0x2b5)]('/');let _0x697702='';for(const _0x1026a8 of _0x4b87bd){_0x697702=_0x697702?_0x697702+'/'+_0x1026a8:_0x1026a8,!_0x268b36[_0x4e4f1c(0x243)](_0x697702)&&_0x51eca8['add'](_0x697702);}}const _0x37cdf6=calculateActivationActions(_0x2d4662[_0x4e4f1c(0x2d0)]||[],_0x3908a7,_0x4e534f,_0x4941da),_0x1e5176=segmentToYamlString(_0x2d4662);let _0x113628,_0x477ecc=![],_0x4da142;if(_0xf8fc16){const _0x14b952=segmentWithActivationsToYaml(_0xf8fc16,_0x3908a7,undefined,_0x4e534f,_0x4941da),_0x2cae34=segmentToYamlString(_0x14b952);_0x113628=generateDiff(_0x2cae34,_0x1e5176),_0x477ecc=hasChanges(_0x113628),_0x477ecc&&(_0x4da142=formatDiffWithColors(_0x113628));}else _0x113628=generateDiff('',_0x1e5176),_0x4da142=formatDiffWithColors(_0x113628);_0xf41464[_0x4e4f1c(0x237)]({'relativePath':_0x2d4662[_0x4e4f1c(0x21b)],'absolutePath':_0xa9c1ff,'yamlConfig':_0x2d4662,'folderPath':_0x5bd13e,'existingSegment':_0xf8fc16,'existingActivations':_0x3908a7,'isNew':!_0xf8fc16,'hasChanges':_0x477ecc,'diff':_0x4da142,'activationActions':_0x37cdf6});}let _0x1cbbcd=[];if(!_0x1d4589){const _0x556c22=new Set();for(const {yamlConfig:_0x968a2b,folderPath:_0x319127}of _0x42c254){const _0x5af6b1=resolveTDFolderPath(_0x319127,_0x27eca8,_0x360e87);_0x556c22[_0x4e4f1c(0x249)](_0x5af6b1+':'+_0x968a2b['name']);}_0x1cbbcd=_0x193067[_0x4e4f1c(0x278)](_0x6cde77=>{const _0x3034eb=_0x4e4f1c,_0x1c64e5=_0x6cde77[_0x3034eb(0x250)]?_0xe23df7['get'](_0x6cde77[_0x3034eb(0x250)][_0x3034eb(0x2ab)]())||'':'',_0x3f9b48=_0x1c64e5+':'+_0x6cde77[_0x3034eb(0x21b)];if(_0x556c22['has'](_0x3f9b48))return![];if(_0x27eca8)return _0x1c64e5===_0x360e87||_0x1c64e5[_0x3034eb(0x280)](_0x360e87+'/');return!![];});}const _0xcae309=[];for(const {yamlConfig:_0x42e914,folderPath:_0x1d3b6f,sourcePath:_0x5186e5}of _0x46cc3e){const _0x506cdb=resolveTDFolderPath(_0x1d3b6f,_0x27eca8,_0x360e87),_0x3e20a2=_0x506cdb+':'+_0x42e914['name'],_0x7d39b0=_0x1b2919[_0x4e4f1c(0x244)](_0x3e20a2);let _0x3f8bbf,_0x7631eb;if(_0x7d39b0&&_0x7d39b0[_0x4e4f1c(0x23b)]>0x0){const _0x34276a=new Set(),_0x590e66=new Set(),_0x296038=new Map(),_0x2fa03b=new Map(),_0x19a4d9=createJumpTargetCache(),_0x72504f=_0x2b1f14=>({'resolveSegment':async _0x43cb4d=>{const _0x51d273=_0x4e4f1c,_0x1c07a1=_0x2fa03b[_0x51d273(0x244)](_0x43cb4d);if(_0x1c07a1!==undefined)return{'name':_0x1c07a1,'isJourneyLocal':!![]};try{let _0x55a30b=_0x193067[_0x51d273(0x20c)](_0x4b4d1b=>_0x4b4d1b['id']===_0x43cb4d);!_0x55a30b&&(_0x55a30b=await _0x412c11['segment'][_0x51d273(0x271)](_0x21f120,_0x43cb4d));const _0x9949ac=generateJourneyLocalName(_0x55a30b['name']),_0x4fba85=_0x55a30b[_0x51d273(0x272)]===SEGMENT_KIND_JOURNEY&&_0x9949ac!==undefined;let _0x536cff=_0x55a30b[_0x51d273(0x21b)];if(_0x4fba85&&_0x9949ac){let _0x322f66=_0x9949ac,_0x2f10ee=0x2;while(_0x34276a[_0x51d273(0x243)](_0x322f66)){_0x322f66=_0x9949ac+'_'+_0x2f10ee,_0x2f10ee++;}_0x34276a[_0x51d273(0x249)](_0x322f66),_0x536cff=_0x322f66,_0x2fa03b[_0x51d273(0x27a)](_0x43cb4d,_0x536cff);}let _0xf9954a;return _0x4fba85&&_0x55a30b[_0x51d273(0x22f)]&&(_0xf9954a={'description':_0x55a30b[_0x51d273(0x256)],'rule':apiRuleToYaml(_0x55a30b[_0x51d273(0x22f)])}),{'name':_0x536cff,'isJourneyLocal':_0x4fba85,'definition':_0xf9954a};}catch{return{'name':_0x43cb4d,'isJourneyLocal':![]};}},'resolveActivation':async _0x421057=>{const _0x53ab87=_0x4e4f1c,_0x3e12fb=_0x296038[_0x53ab87(0x244)](_0x421057);if(_0x3e12fb!==undefined)return{'name':_0x3e12fb,'isJourneyLocal':!![]};try{const _0x2c3da9=await _0x412c11['journey'][_0x53ab87(0x2b3)](_0x2b1f14,_0x421057),_0xa9fe9d=_0x2c3da9[_0x53ab87(0x227)][_0x53ab87(0x2b0)][_0x53ab87(0x21b)]||_0x421057,_0x4c3dca=sanitizeYamlKey(_0xa9fe9d)||_0x53ab87(0x20e)+_0x421057;let _0x5b88ed=_0x4c3dca,_0x4c9581=0x2;while(_0x590e66[_0x53ab87(0x243)](_0x5b88ed)){_0x5b88ed=_0x4c3dca+'_'+_0x4c9581,_0x4c9581++;}_0x590e66[_0x53ab87(0x249)](_0x5b88ed),_0x296038[_0x53ab87(0x27a)](_0x421057,_0x5b88ed);const _0xa704c3=journeyActivationStepToYaml(_0x2c3da9,_0x4e534f,_0x4941da);return{'name':_0x5b88ed,'isJourneyLocal':!![],'definition':_0xa704c3};}catch{return{'name':_0x421057,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0xd87f1,_0x34a1e8)=>resolveJumpTarget(_0xd87f1,_0x34a1e8,_0x19a4d9,_0xe4d0b4=>_0x412c11[_0x4e4f1c(0x204)][_0x4e4f1c(0x208)](_0xe4d0b4))}),_0x300e14=hasMultipleVersions(_0x42e914);if(_0x300e14&&_0x7d39b0['length']>0x1){const _0x210f88=[];for(const _0x3b2053 of _0x7d39b0){const _0x3013e4=await withSpinner(_0x4e4f1c(0x259)+_0x42e914[_0x4e4f1c(0x21b)]+_0x4e4f1c(0x2ac)+(_0x3b2053[_0x4e4f1c(0x1fb)]||0x1)+'...',()=>_0x412c11[_0x4e4f1c(0x204)]['getJourney'](_0x3b2053['id']),{'verbose':_0x1a7b21['verbose']}),_0x52520e=_0x72504f(_0x3b2053['id']),_0x82ba84=await apiToYamlAsync(_0x3013e4[_0x4e4f1c(0x253)],_0x52520e);_0x210f88[_0x4e4f1c(0x237)]({'item':_0x3b2053,'yaml':_0x82ba84});}_0x7631eb=buildMergedJourneyYaml(_0x210f88);const _0x138ea0=Math[_0x4e4f1c(0x2a1)](..._0x210f88['map'](_0x1cb14a=>_0x1cb14a[_0x4e4f1c(0x2bc)][_0x4e4f1c(0x1fb)]||0x0)),_0x4ef4c6=_0x7d39b0['find'](_0x411953=>(_0x411953[_0x4e4f1c(0x1fb)]||0x0)===_0x138ea0);_0x4ef4c6&&(_0x3f8bbf=await _0x412c11[_0x4e4f1c(0x204)][_0x4e4f1c(0x208)](_0x4ef4c6['id']));}else{const _0x60b864=_0x7d39b0[_0x7d39b0[_0x4e4f1c(0x23b)]-0x1],_0x44050b=await withSpinner(_0x4e4f1c(0x259)+_0x42e914[_0x4e4f1c(0x21b)]+_0x4e4f1c(0x246),()=>_0x412c11[_0x4e4f1c(0x204)][_0x4e4f1c(0x208)](_0x60b864['id']),{'verbose':_0x1a7b21[_0x4e4f1c(0x221)]});_0x3f8bbf=_0x44050b[_0x4e4f1c(0x253)];const _0x1ce8f5=_0x72504f(_0x60b864['id']);_0x7631eb=await apiToYamlAsync(_0x3f8bbf,_0x1ce8f5);}}if(_0x506cdb&&!_0x268b36[_0x4e4f1c(0x243)](_0x506cdb)){const _0x38cc13=_0x506cdb[_0x4e4f1c(0x2b5)]('/');let _0x1da2fb='';for(const _0x34b163 of _0x38cc13){_0x1da2fb=_0x1da2fb?_0x1da2fb+'/'+_0x34b163:_0x34b163,!_0x268b36['has'](_0x1da2fb)&&_0x51eca8[_0x4e4f1c(0x249)](_0x1da2fb);}}const _0x44ef96=normalizeJourneyYaml(_0x42e914),_0x54f2d1=a36_0x238ca4(_0x44ef96);let _0x148bd9=![],_0x5ebb55;if(_0x7631eb){const _0x3df01e=normalizeJourneyYaml(_0x7631eb),_0x4f04d6=a36_0x238ca4(_0x3df01e),_0x48b458=generateDiff(_0x4f04d6,_0x54f2d1);_0x148bd9=hasChanges(_0x48b458),_0x148bd9&&(_0x5ebb55=formatDiffWithColors(_0x48b458));}else{const _0x571120=generateDiff('',_0x54f2d1);_0x5ebb55=formatDiffWithColors(_0x571120);}_0xcae309['push']({'relativePath':_0x42e914[_0x4e4f1c(0x21b)],'absolutePath':_0x5186e5,'yamlConfig':_0x42e914,'folderPath':_0x506cdb,'existingJourney':_0x3f8bbf,'isNew':!_0x3f8bbf,'hasChanges':_0x148bd9,'diff':_0x5ebb55});}let _0x31acd4=[];if(!_0x1d4589){const _0x4f7d37=new Set();for(const {yamlConfig:_0xd59869,folderPath:_0xcd2dc6}of _0x46cc3e){const _0x172fee=resolveTDFolderPath(_0xcd2dc6,_0x27eca8,_0x360e87);_0x4f7d37[_0x4e4f1c(0x249)](_0x172fee+':'+_0xd59869['name']);}_0x31acd4=_0x464d02[_0x4e4f1c(0x278)](_0x1e6924=>{const _0x374106=_0x4e4f1c,_0xaaa07b=_0x1e6924['folderId']?_0xe23df7[_0x374106(0x244)](_0x1e6924[_0x374106(0x268)])||'':'',_0x1e83b0=_0xaaa07b+':'+_0x1e6924[_0x374106(0x1e6)];if(_0x4f7d37[_0x374106(0x243)](_0x1e83b0))return![];if(_0x27eca8)return _0xaaa07b===_0x360e87||_0xaaa07b[_0x374106(0x280)](_0x360e87+'/');return!![];});}const _0x6f41bd=_0xf41464[_0x4e4f1c(0x278)](_0x1d6db3=>_0x1d6db3['isNew']),_0x100d02=_0xf41464[_0x4e4f1c(0x278)](_0x4f288b=>!_0x4f288b[_0x4e4f1c(0x2d1)]&&_0x4f288b[_0x4e4f1c(0x24f)]),_0x817128=_0xf41464[_0x4e4f1c(0x278)](_0x5357d9=>!_0x5357d9['isNew']&&!_0x5357d9[_0x4e4f1c(0x24f)]),_0x50b7fc=Array[_0x4e4f1c(0x1e2)](_0x51eca8)[_0x4e4f1c(0x2b9)](),_0xf13393=_0x1a7b21[_0x4e4f1c(0x202)]?_0x1cbbcd:[],_0x2c0ee0=_0x1a7b21[_0x4e4f1c(0x202)]?_0x31acd4:[],_0x167d72=_0xf41464[_0x4e4f1c(0x21f)](_0x475aa6=>_0x475aa6[_0x4e4f1c(0x236)]),_0x51da42=_0x167d72['filter'](_0x35a415=>_0x35a415[_0x4e4f1c(0x2d2)]===_0x4e4f1c(0x215)),_0x134543=_0x167d72['filter'](_0x4dffa8=>_0x4dffa8[_0x4e4f1c(0x2d2)]===_0x4e4f1c(0x29f)),_0x2a7c77=_0x167d72[_0x4e4f1c(0x278)](_0xdf7334=>_0xdf7334[_0x4e4f1c(0x2d2)]===_0x4e4f1c(0x202)),_0xb7efa1=_0xcae309[_0x4e4f1c(0x278)](_0x5df0e1=>_0x5df0e1[_0x4e4f1c(0x2d1)]),_0x594f6f=_0xcae309['filter'](_0x11722d=>!_0x11722d[_0x4e4f1c(0x2d1)]&&_0x11722d[_0x4e4f1c(0x24f)]),_0x59bae3=_0xcae309[_0x4e4f1c(0x278)](_0x4eed34=>!_0x4eed34[_0x4e4f1c(0x2d1)]&&!_0x4eed34['hasChanges']);console[_0x4e4f1c(0x28f)]('\x0aPush\x20summary\x20for\x20\x27'+_0x1b8a64+'\x27:');_0x50b7fc[_0x4e4f1c(0x23b)]>0x0&&console['error']('\x20\x20'+a36_0x20973d[_0x4e4f1c(0x231)](_0x4e4f1c(0x2a6)+_0x50b7fc[_0x4e4f1c(0x23b)]+_0x4e4f1c(0x292)));if(!_0x1a7b21['journeysOnly']){console[_0x4e4f1c(0x28f)](_0x4e4f1c(0x1e8)),console['error'](_0x4e4f1c(0x1e5)+a36_0x20973d['green']('+\x20'+_0x6f41bd[_0x4e4f1c(0x23b)]+_0x4e4f1c(0x28c))),console[_0x4e4f1c(0x28f)](_0x4e4f1c(0x1e5)+a36_0x20973d['yellow']('~\x20'+_0x100d02[_0x4e4f1c(0x23b)]+_0x4e4f1c(0x2b4)));if(_0xf13393[_0x4e4f1c(0x23b)]>0x0)console['error'](_0x4e4f1c(0x1e5)+a36_0x20973d[_0x4e4f1c(0x219)]('-\x20'+_0xf13393['length']+_0x4e4f1c(0x289)));else _0x1cbbcd[_0x4e4f1c(0x23b)]>0x0&&!_0x1a7b21[_0x4e4f1c(0x202)]&&console[_0x4e4f1c(0x28f)](_0x4e4f1c(0x1e5)+a36_0x20973d[_0x4e4f1c(0x238)](_0x1cbbcd[_0x4e4f1c(0x23b)]+_0x4e4f1c(0x2cf)));console[_0x4e4f1c(0x28f)]('\x20\x20\x20\x20'+a36_0x20973d[_0x4e4f1c(0x238)]('=\x20'+_0x817128[_0x4e4f1c(0x23b)]+_0x4e4f1c(0x200)));}if(_0xcae309[_0x4e4f1c(0x23b)]>0x0||_0x31acd4['length']>0x0){console[_0x4e4f1c(0x28f)](_0x4e4f1c(0x232)),console['error']('\x20\x20\x20\x20'+a36_0x20973d[_0x4e4f1c(0x23d)]('+\x20'+_0xb7efa1[_0x4e4f1c(0x23b)]+_0x4e4f1c(0x28c))),console[_0x4e4f1c(0x28f)]('\x20\x20\x20\x20'+a36_0x20973d['yellow']('~\x20'+_0x594f6f[_0x4e4f1c(0x23b)]+_0x4e4f1c(0x2b4)));if(_0x2c0ee0['length']>0x0)console[_0x4e4f1c(0x28f)](_0x4e4f1c(0x1e5)+a36_0x20973d[_0x4e4f1c(0x219)]('-\x20'+_0x2c0ee0[_0x4e4f1c(0x23b)]+_0x4e4f1c(0x289)));else _0x31acd4['length']>0x0&&!_0x1a7b21[_0x4e4f1c(0x202)]&&console['error'](_0x4e4f1c(0x1e5)+a36_0x20973d[_0x4e4f1c(0x238)](_0x31acd4[_0x4e4f1c(0x23b)]+_0x4e4f1c(0x2cf)));console['error'](_0x4e4f1c(0x1e5)+a36_0x20973d[_0x4e4f1c(0x238)]('=\x20'+_0x59bae3[_0x4e4f1c(0x23b)]+_0x4e4f1c(0x200)));}_0x167d72[_0x4e4f1c(0x23b)]>0x0&&!_0x1a7b21[_0x4e4f1c(0x2a3)]&&(console[_0x4e4f1c(0x28f)](''),console['error'](_0x4e4f1c(0x28a)),_0x51da42[_0x4e4f1c(0x23b)]>0x0&&console[_0x4e4f1c(0x28f)]('\x20\x20\x20\x20'+a36_0x20973d['green']('+\x20'+_0x51da42[_0x4e4f1c(0x23b)]+_0x4e4f1c(0x27d))),_0x134543[_0x4e4f1c(0x23b)]>0x0&&console['error'](_0x4e4f1c(0x1e5)+a36_0x20973d['yellow']('~\x20'+_0x134543[_0x4e4f1c(0x23b)]+_0x4e4f1c(0x258))),_0x2a7c77[_0x4e4f1c(0x23b)]>0x0&&console['error'](_0x4e4f1c(0x1e5)+a36_0x20973d[_0x4e4f1c(0x219)]('-\x20'+_0x2a7c77[_0x4e4f1c(0x23b)]+_0x4e4f1c(0x289))));console[_0x4e4f1c(0x28f)](_0x4e4f1c(0x2ca)+a36_0x20973d['cyan'](_0x5b7a6f)+'\x0a');if(_0x50b7fc[_0x4e4f1c(0x23b)]>0x0){console[_0x4e4f1c(0x28f)](_0x4e4f1c(0x217));for(const _0x56aa13 of _0x50b7fc){console[_0x4e4f1c(0x28f)]('\x20\x20'+a36_0x20973d[_0x4e4f1c(0x231)]('+')+'\x20'+_0x56aa13);}console[_0x4e4f1c(0x28f)]('');}if(_0x6f41bd[_0x4e4f1c(0x23b)]>0x0&&!_0x1a7b21['journeysOnly'])for(const _0x7d33bb of _0x6f41bd){const _0x3a7e34=_0x7d33bb[_0x4e4f1c(0x28d)]?_0x7d33bb[_0x4e4f1c(0x28d)]+'/'+_0x7d33bb[_0x4e4f1c(0x1fe)][_0x4e4f1c(0x21b)]:_0x7d33bb['yamlConfig'][_0x4e4f1c(0x21b)],_0x4a2d65=_0x7d33bb['yamlConfig'][_0x4e4f1c(0x2d0)]?.[_0x4e4f1c(0x23b)]||0x0,_0xcd84ad=_0x4a2d65>0x0?a36_0x20973d[_0x4e4f1c(0x238)]('\x20['+_0x4a2d65+_0x4e4f1c(0x22b)):'';console[_0x4e4f1c(0x28f)]('\x0a'+a36_0x20973d[_0x4e4f1c(0x23d)](_0x4e4f1c(0x1f8))+'\x20'+_0x3a7e34+_0xcd84ad),console[_0x4e4f1c(0x28f)]('─'[_0x4e4f1c(0x214)](0x3c)),_0x7d33bb['diff']&&console[_0x4e4f1c(0x28f)](_0x7d33bb[_0x4e4f1c(0x2c0)]),console['error']('─'[_0x4e4f1c(0x214)](0x3c));}if(_0xf13393[_0x4e4f1c(0x23b)]>0x0&&!_0x1a7b21[_0x4e4f1c(0x2a3)])for(const _0x55312a of _0xf13393){const _0x2261d6=_0x55312a[_0x4e4f1c(0x250)]?_0xe23df7[_0x4e4f1c(0x244)](_0x55312a['segmentFolderId'][_0x4e4f1c(0x2ab)]())||'':'',_0x4eb4dd=_0x2261d6?_0x2261d6+'/'+_0x55312a[_0x4e4f1c(0x21b)]:_0x55312a['name'],_0x512a57=_0x40c4bc['get'](_0x55312a['id'])||[],_0x24235f=_0x512a57[_0x4e4f1c(0x23b)]>0x0?a36_0x20973d[_0x4e4f1c(0x238)]('\x20['+_0x512a57[_0x4e4f1c(0x23b)]+_0x4e4f1c(0x22b)):'';console['error']('\x0a'+a36_0x20973d[_0x4e4f1c(0x219)]('Delete\x20segment:')+'\x20'+_0x4eb4dd+_0x24235f),console['error']('─'['repeat'](0x3c));const _0x43f64e=segmentWithActivationsToYaml(_0x55312a,_0x512a57,undefined,_0x4e534f,_0x4941da),_0x23d36f=segmentToYamlString(_0x43f64e),_0x5e2f1d=generateDiff(_0x23d36f,'');console[_0x4e4f1c(0x28f)](formatDiffWithColors(_0x5e2f1d)),console['error']('─'[_0x4e4f1c(0x214)](0x3c));}const _0x3d7d4a=_0xf41464[_0x4e4f1c(0x278)](_0x53ed24=>!_0x53ed24[_0x4e4f1c(0x2d1)]&&_0x53ed24['diff']);if(_0x3d7d4a['length']>0x0&&!_0x1a7b21[_0x4e4f1c(0x2a3)])for(const _0x5395ee of _0x3d7d4a){const _0x3a2514=_0x5395ee[_0x4e4f1c(0x28d)]?_0x5395ee[_0x4e4f1c(0x28d)]+'/'+_0x5395ee[_0x4e4f1c(0x1fe)][_0x4e4f1c(0x21b)]:_0x5395ee[_0x4e4f1c(0x1fe)]['name'];console[_0x4e4f1c(0x28f)]('\x0a'+a36_0x20973d[_0x4e4f1c(0x1f0)](_0x4e4f1c(0x2b1))+'\x20'+_0x3a2514),console[_0x4e4f1c(0x28f)]('─'[_0x4e4f1c(0x214)](0x3c)),console['error'](_0x5395ee[_0x4e4f1c(0x2c0)]),console[_0x4e4f1c(0x28f)]('─'[_0x4e4f1c(0x214)](0x3c));}if(_0xb7efa1[_0x4e4f1c(0x23b)]>0x0)for(const _0x5ebf0e of _0xb7efa1){const _0x1b84a4=_0x5ebf0e[_0x4e4f1c(0x28d)]?_0x5ebf0e[_0x4e4f1c(0x28d)]+'/'+_0x5ebf0e[_0x4e4f1c(0x1fe)][_0x4e4f1c(0x21b)]:_0x5ebf0e[_0x4e4f1c(0x1fe)][_0x4e4f1c(0x21b)];console[_0x4e4f1c(0x28f)]('\x0a'+a36_0x20973d['green'](_0x4e4f1c(0x2cd))+'\x20'+_0x1b84a4),console[_0x4e4f1c(0x28f)]('─'['repeat'](0x3c)),_0x5ebf0e[_0x4e4f1c(0x2c0)]&&console['error'](_0x5ebf0e[_0x4e4f1c(0x2c0)]),console['error']('─'[_0x4e4f1c(0x214)](0x3c));}const _0x4c580c=_0xcae309[_0x4e4f1c(0x278)](_0x45d9b2=>!_0x45d9b2[_0x4e4f1c(0x2d1)]&&_0x45d9b2[_0x4e4f1c(0x2c0)]);if(_0x4c580c[_0x4e4f1c(0x23b)]>0x0)for(const _0x19062e of _0x4c580c){const _0x11eb39=_0x19062e[_0x4e4f1c(0x28d)]?_0x19062e[_0x4e4f1c(0x28d)]+'/'+_0x19062e[_0x4e4f1c(0x1fe)][_0x4e4f1c(0x21b)]:_0x19062e[_0x4e4f1c(0x1fe)][_0x4e4f1c(0x21b)];console[_0x4e4f1c(0x28f)]('\x0a'+a36_0x20973d[_0x4e4f1c(0x1f0)](_0x4e4f1c(0x245))+'\x20'+_0x11eb39),console[_0x4e4f1c(0x28f)]('─'[_0x4e4f1c(0x214)](0x3c)),console[_0x4e4f1c(0x28f)](_0x19062e[_0x4e4f1c(0x2c0)]),console[_0x4e4f1c(0x28f)]('─'['repeat'](0x3c));}if(_0x2c0ee0[_0x4e4f1c(0x23b)]>0x0)for(const _0x1fae15 of _0x2c0ee0){const _0x3b1804=_0x1fae15['folderId']?_0xe23df7[_0x4e4f1c(0x244)](_0x1fae15[_0x4e4f1c(0x268)])||'':'',_0x163915=_0x3b1804?_0x3b1804+'/'+_0x1fae15['journeyBundleName']:_0x1fae15[_0x4e4f1c(0x1e6)];console[_0x4e4f1c(0x28f)]('\x0a'+a36_0x20973d[_0x4e4f1c(0x219)](_0x4e4f1c(0x288))+'\x20'+_0x163915),console[_0x4e4f1c(0x28f)]('─'[_0x4e4f1c(0x214)](0x3c)),console[_0x4e4f1c(0x28f)](a36_0x20973d['red'](_0x4e4f1c(0x22c))),console['error']('─'[_0x4e4f1c(0x214)](0x3c));}if(_0x1a7b21[_0x4e4f1c(0x1fd)])return console[_0x4e4f1c(0x28f)](a36_0x20973d[_0x4e4f1c(0x1f0)](_0x4e4f1c(0x207))),0x0;const _0x17f128=_0x1a7b21[_0x4e4f1c(0x2a3)]?![]:_0x6f41bd[_0x4e4f1c(0x23b)]>0x0||_0x100d02[_0x4e4f1c(0x23b)]>0x0||_0xf13393['length']>0x0,_0x40dcdc=_0xb7efa1['length']>0x0||_0x594f6f[_0x4e4f1c(0x23b)]>0x0||_0x2c0ee0[_0x4e4f1c(0x23b)]>0x0,_0x4d413b=_0x1a7b21[_0x4e4f1c(0x2a3)]?![]:_0x167d72[_0x4e4f1c(0x23b)]>0x0,_0x4becc5=_0x50b7fc[_0x4e4f1c(0x23b)]>0x0;if(!_0x17f128&&!_0x40dcdc&&!_0x4d413b&&!_0x4becc5){const _0xd2aa36=_0x1a7b21[_0x4e4f1c(0x2a3)]?'✔\x20All\x20journeys\x20are\x20up\x20to\x20date':_0x4e4f1c(0x2a5);console[_0x4e4f1c(0x28f)](a36_0x20973d['green'](_0xd2aa36));if(_0x1d4589&&_0x59bae3[_0x4e4f1c(0x23b)]===0x1){const _0x4497f3=_0x59bae3[0x0];if(_0x4497f3[_0x4e4f1c(0x1e3)]?.['id']){const _0x39a29d=getConsoleNextUrl(_0x1a7b21['site'],'/app/ps/'+_0x21f120+_0x4e4f1c(0x220)+_0x4497f3[_0x4e4f1c(0x1e3)]['id']+_0x4e4f1c(0x20a));console[_0x4e4f1c(0x28f)]('\x20\x20'+a36_0x20973d['cyan'](_0x39a29d));}}return 0x0;}const _0xaa6510=_0x1a7b21[_0x4e4f1c(0x2a3)]?_0xb7efa1[_0x4e4f1c(0x23b)]+_0x594f6f[_0x4e4f1c(0x23b)]+_0x2c0ee0['length']+_0x50b7fc[_0x4e4f1c(0x23b)]:_0x6f41bd[_0x4e4f1c(0x23b)]+_0x100d02[_0x4e4f1c(0x23b)]+_0xf13393[_0x4e4f1c(0x23b)]+_0xb7efa1[_0x4e4f1c(0x23b)]+_0x594f6f[_0x4e4f1c(0x23b)]+_0x2c0ee0['length']+_0x50b7fc[_0x4e4f1c(0x23b)]+_0x167d72[_0x4e4f1c(0x23b)];if(!_0x1a7b21[_0x4e4f1c(0x1f6)]&&_0xaa6510>0x0){const _0x1993a0=await confirmKey(_0x4e4f1c(0x266)+_0xaa6510+_0x4e4f1c(0x263));if(!_0x1993a0)return console[_0x4e4f1c(0x28f)](_0x4e4f1c(0x269)),0x1;}for(const _0x4cf759 of _0x50b7fc){const _0x508f1e=_0x4cf759[_0x4e4f1c(0x2b5)]('/'),_0xd628ee=_0x508f1e[_0x508f1e[_0x4e4f1c(0x23b)]-0x1],_0x48b4c9=_0x508f1e[_0x4e4f1c(0x235)](0x0,-0x1)[_0x4e4f1c(0x2be)]('/'),_0x400162=_0x268b36[_0x4e4f1c(0x244)](_0x48b4c9),_0x56a71c={'name':_0xd628ee,'parentFolderId':_0x400162},_0x378745=await withSpinner('Creating\x20folder\x20\x27'+_0x4cf759+_0x4e4f1c(0x2c3),()=>_0x412c11[_0x4e4f1c(0x233)][_0x4e4f1c(0x2aa)](_0x21f120,_0x56a71c),{'verbose':_0x1a7b21[_0x4e4f1c(0x221)]});_0x268b36[_0x4e4f1c(0x27a)](_0x4cf759,_0x378745[_0x4e4f1c(0x253)]['id']),console['error'](a36_0x20973d[_0x4e4f1c(0x231)](_0x4e4f1c(0x2b8)+_0x4cf759+'\x27'));}let _0x32dbd0=0x0,_0x1e3753=0x0,_0x17942c=0x0,_0x42d14d=0x0,_0x2e8082=0x0,_0x402015=0x0;const _0x3121c3=new Map();for(const _0x2e4c99 of _0x1a7b21[_0x4e4f1c(0x2a3)]?[]:_0xf41464){const _0x142321=_0x2e4c99[_0x4e4f1c(0x28d)]?_0x268b36[_0x4e4f1c(0x244)](_0x2e4c99[_0x4e4f1c(0x28d)]):undefined;let _0x1c2623;try{if(_0x2e4c99[_0x4e4f1c(0x2d1)]){const _0xe43a71=yamlToCreateRequest(_0x2e4c99[_0x4e4f1c(0x1fe)],_0x142321),_0x187be6=await withSpinner(_0x4e4f1c(0x25d)+_0x2e4c99[_0x4e4f1c(0x1fe)][_0x4e4f1c(0x21b)]+'\x27...',()=>_0x412c11[_0x4e4f1c(0x233)][_0x4e4f1c(0x1f4)](_0x21f120,_0xe43a71),{'verbose':_0x1a7b21[_0x4e4f1c(0x221)]});_0x1c2623=_0x187be6[_0x4e4f1c(0x253)]['id'],_0x3121c3['set'](_0x2e4c99[_0x4e4f1c(0x1fe)][_0x4e4f1c(0x21b)],_0x1c2623),console[_0x4e4f1c(0x28f)](a36_0x20973d[_0x4e4f1c(0x23d)](_0x4e4f1c(0x2cc)+_0x2e4c99[_0x4e4f1c(0x1fe)][_0x4e4f1c(0x21b)]+'\x27')),_0x32dbd0++;}else{if(_0x2e4c99[_0x4e4f1c(0x24f)]){const _0x64952e=yamlToUpdateRequest(_0x2e4c99[_0x4e4f1c(0x1fe)]);_0x142321!==_0x2e4c99['existingSegment']?.[_0x4e4f1c(0x250)]&&(_0x64952e[_0x4e4f1c(0x250)]=_0x142321?parseInt(_0x142321,0xa):undefined),await withSpinner(_0x4e4f1c(0x2ad)+_0x2e4c99[_0x4e4f1c(0x1fe)][_0x4e4f1c(0x21b)]+'\x27...',()=>_0x412c11[_0x4e4f1c(0x233)]['updateSegmentById'](_0x21f120,_0x2e4c99[_0x4e4f1c(0x1ed)]['id'],_0x64952e),{'verbose':_0x1a7b21[_0x4e4f1c(0x221)]}),_0x1c2623=_0x2e4c99['existingSegment']['id'],console['error'](a36_0x20973d[_0x4e4f1c(0x1f0)](_0x4e4f1c(0x27f)+_0x2e4c99[_0x4e4f1c(0x1fe)][_0x4e4f1c(0x21b)]+'\x27')),_0x1e3753++;}else _0x1c2623=_0x2e4c99[_0x4e4f1c(0x1ed)]['id'];}}catch(_0x328891){const _0xc61a08=isHttp400Error(_0x328891),_0x586d31=_0xc61a08?ErrorCode[_0x4e4f1c(0x255)]:ErrorCode[_0x4e4f1c(0x2ba)],_0x5e4eef=getErrorMessage(_0x328891);throw new SDKError(_0x586d31,_0x4e4f1c(0x218)+(_0x2e4c99[_0x4e4f1c(0x2d1)]?'create':_0x4e4f1c(0x29f))+'\x20segment\x20from\x20file:\x20'+_0x2e4c99[_0x4e4f1c(0x2b2)]+_0x4e4f1c(0x1e7)+_0x5e4eef,_0x328891);}for(const _0x1eef10 of _0x2e4c99[_0x4e4f1c(0x236)]){try{if(_0x1eef10[_0x4e4f1c(0x2d2)]===_0x4e4f1c(0x215)&&_0x1eef10[_0x4e4f1c(0x281)]){const _0x387849=yamlActivationToCreateRequest(_0x1eef10[_0x4e4f1c(0x281)],_0x1e5a5f,_0x2e76a9);await withSpinner(_0x4e4f1c(0x206)+_0x1eef10[_0x4e4f1c(0x21b)]+_0x4e4f1c(0x2c3),()=>_0x412c11['segment'][_0x4e4f1c(0x239)](_0x21f120,_0x1c2623,_0x387849),{'verbose':_0x1a7b21[_0x4e4f1c(0x221)]}),console[_0x4e4f1c(0x28f)](a36_0x20973d[_0x4e4f1c(0x23d)](_0x4e4f1c(0x23c)+_0x1eef10[_0x4e4f1c(0x21b)]+'\x27')),_0x42d14d++;}else{if(_0x1eef10[_0x4e4f1c(0x2d2)]===_0x4e4f1c(0x29f)&&_0x1eef10[_0x4e4f1c(0x281)]&&_0x1eef10['existingActivation']){const _0x2fe227=yamlActivationToUpdateRequest(_0x1eef10[_0x4e4f1c(0x281)],_0x1e5a5f,_0x2e76a9);await withSpinner(_0x4e4f1c(0x26e)+_0x1eef10[_0x4e4f1c(0x21b)]+_0x4e4f1c(0x2c3),()=>_0x412c11[_0x4e4f1c(0x233)]['updateActivation'](_0x21f120,_0x1c2623,_0x1eef10[_0x4e4f1c(0x2a7)]['id'],_0x2fe227),{'verbose':_0x1a7b21[_0x4e4f1c(0x221)]}),console[_0x4e4f1c(0x28f)](a36_0x20973d[_0x4e4f1c(0x1f0)](_0x4e4f1c(0x1ff)+_0x1eef10[_0x4e4f1c(0x21b)]+'\x27')),_0x2e8082++;}else _0x1eef10[_0x4e4f1c(0x2d2)]===_0x4e4f1c(0x202)&&_0x1eef10[_0x4e4f1c(0x2a7)]&&(await withSpinner(_0x4e4f1c(0x27e)+_0x1eef10[_0x4e4f1c(0x21b)]+_0x4e4f1c(0x2c3),()=>_0x412c11[_0x4e4f1c(0x233)]['deleteActivation'](_0x21f120,_0x1c2623,_0x1eef10[_0x4e4f1c(0x2a7)]['id']),{'verbose':_0x1a7b21[_0x4e4f1c(0x221)]}),console[_0x4e4f1c(0x28f)](a36_0x20973d[_0x4e4f1c(0x219)](_0x4e4f1c(0x265)+_0x1eef10[_0x4e4f1c(0x21b)]+'\x27')),_0x402015++);}}catch(_0x1255e5){const _0x5d2329=isHttp400Error(_0x1255e5),_0x344d1a=_0x5d2329?ErrorCode[_0x4e4f1c(0x213)]:ErrorCode[_0x4e4f1c(0x1ea)],_0x6b1fe7=getErrorMessage(_0x1255e5);throw new SDKError(_0x344d1a,'Failed\x20to\x20'+_0x1eef10[_0x4e4f1c(0x2d2)]+_0x4e4f1c(0x1eb)+_0x1eef10[_0x4e4f1c(0x21b)]+'\x27\x20from\x20file:\x20'+_0x2e4c99[_0x4e4f1c(0x2b2)]+_0x4e4f1c(0x1e7)+_0x6b1fe7,_0x1255e5);}}}for(const _0xf4bbe6 of _0x1a7b21[_0x4e4f1c(0x2a3)]?[]:_0xf13393){await withSpinner(_0x4e4f1c(0x264)+_0xf4bbe6[_0x4e4f1c(0x21b)]+_0x4e4f1c(0x2c3),()=>_0x412c11[_0x4e4f1c(0x233)][_0x4e4f1c(0x27b)](_0xf4bbe6['id']),{'verbose':_0x1a7b21['verbose']}),console['error'](a36_0x20973d[_0x4e4f1c(0x219)](_0x4e4f1c(0x1fa)+_0xf4bbe6[_0x4e4f1c(0x21b)]+'\x27')),_0x17942c++;}let _0x488864=0x0,_0x3e3782=0x0,_0x510e35=0x0;const _0x240859=new Map(_0x586bbf);for(const _0x382bd5 of _0xf41464){_0x382bd5[_0x4e4f1c(0x2d1)]&&_0x3121c3[_0x4e4f1c(0x243)](_0x382bd5['yamlConfig'][_0x4e4f1c(0x21b)])&&_0x240859[_0x4e4f1c(0x27a)](_0x382bd5[_0x4e4f1c(0x1fe)]['name'],_0x3121c3[_0x4e4f1c(0x244)](_0x382bd5[_0x4e4f1c(0x1fe)][_0x4e4f1c(0x21b)]));}if(_0xcae309[_0x4e4f1c(0x23b)]>0x0){const _0x12b06d=await withQuerySpinner('Pushing\x20journeys...',async _0x52721e=>{const _0x322932=_0x4e4f1c,_0x38626f=[];let _0x523358=0x0;const _0x600d37=0x5;for(let _0x2cf8d7=0x0;_0x2cf8d7<_0xcae309[_0x322932(0x23b)];_0x2cf8d7+=_0x600d37){const _0x1cb7e7=_0xcae309[_0x322932(0x235)](_0x2cf8d7,_0x2cf8d7+_0x600d37),_0x32f2d4=await Promise[_0x322932(0x20d)](_0x1cb7e7[_0x322932(0x22a)](async _0x1ceb11=>{const _0x277b4c=_0x322932;if(!_0x1ceb11[_0x277b4c(0x2d1)]&&!_0x1ceb11[_0x277b4c(0x24f)])return{'action':_0x277b4c(0x1f7),'name':_0x1ceb11[_0x277b4c(0x1fe)][_0x277b4c(0x21b)],'journeyId':_0x1ceb11[_0x277b4c(0x1e3)]?.['id']};const _0x50eeff=_0x1ceb11[_0x277b4c(0x28d)]?_0x268b36['get'](_0x1ceb11[_0x277b4c(0x28d)]):undefined,_0x51ff0f=_0x1ceb11[_0x277b4c(0x2d1)]?_0x277b4c(0x1f9):'Updating';_0x52721e['setPhase'](_0x51ff0f+_0x277b4c(0x2a2)+_0x1ceb11['yamlConfig'][_0x277b4c(0x21b)]+'\x27');const _0x5d2f82=new Map(),_0x4f0615=new Map(),_0x3619b6=new Map(),_0x26bad9={'resolveSegmentId':async _0x40e098=>{const _0x30b33d=_0x277b4c,_0x4026dc=_0x240859[_0x30b33d(0x244)](_0x40e098);if(!_0x4026dc)throw new SDKError(ErrorCode[_0x30b33d(0x201)],_0x30b33d(0x29b)+_0x40e098+'\x20(referenced\x20in\x20journey\x20'+_0x1ceb11[_0x30b33d(0x1fe)]['name']+')');return _0x4026dc;},'resolveEmbeddedSegmentId':async(_0x201b0b,_0x29ec2a)=>{const _0x25b52c=_0x277b4c,_0x3b621f=_0x240859[_0x25b52c(0x244)](_0x201b0b);if(_0x3b621f)return _0x3b621f;const _0x4747c7=_0x193067[_0x25b52c(0x20c)](_0x5e11ee=>_0x5e11ee[_0x25b52c(0x21b)]===_0x201b0b);if(_0x4747c7)return _0x240859[_0x25b52c(0x27a)](_0x201b0b,_0x4747c7['id']),_0x4747c7['id'];if(_0x1ceb11[_0x25b52c(0x2d1)]){const _0xbea223=_0x1ceb11[_0x25b52c(0x1fe)][_0x25b52c(0x1dc)]||_0x1ceb11[_0x25b52c(0x1fe)]['journeys']?.[0x0]?.[_0x25b52c(0x1dc)]||[];let _0x4fb7c0=_0x25b52c(0x240),_0xb44021=_0x201b0b;for(const _0x150855 of _0xbea223){if(_0x150855[_0x25b52c(0x26f)]?.[_0x25b52c(0x233)]===_0x201b0b){_0x4fb7c0=_0x150855[_0x25b52c(0x21b)],_0xb44021=_0x150855[_0x25b52c(0x26f)][_0x25b52c(0x21b)]||_0x201b0b;break;}}return _0x4f0615['set'](_0x201b0b,{'definition':_0x29ec2a,'stageName':_0x4fb7c0,'criteriaName':_0xb44021}),createPendingSegmentId(_0x201b0b);}const _0x5009c0=_0x1ceb11[_0x25b52c(0x1e3)]?.['id'];if(!_0x5009c0)throw new SDKError(ErrorCode[_0x25b52c(0x21a)],_0x25b52c(0x285));const _0x19e632=_0x25b52c(0x1e1)+crypto[_0x25b52c(0x23e)]();try{const _0x56bd61=await _0x412c11['segment'][_0x25b52c(0x277)]({'name':_0x19e632,'description':_0x29ec2a[_0x25b52c(0x256)]||_0x25b52c(0x28b)+_0x201b0b,'journeyId':_0x5009c0,'rule':yamlRuleToApi(_0x29ec2a[_0x25b52c(0x22f)],!![]),'countPopulation':!![],'parentFolderId':_0x5e821c||'','audienceId':_0x21f120});return _0x1a7b21[_0x25b52c(0x221)]&&console[_0x25b52c(0x28f)](_0x25b52c(0x2c6)+_0x201b0b+'\x27\x20(internal:\x20'+_0x19e632+_0x25b52c(0x203)+_0x56bd61),_0x240859['set'](_0x201b0b,_0x56bd61),_0x56bd61;}catch(_0x189906){throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],'Failed\x20to\x20create\x20embedded\x20segment\x20\x27'+_0x201b0b+'\x27:\x20'+getErrorMessage(_0x189906),_0x189906);}},'resolveActivationId':async _0x5a0456=>{const _0x40be6f=_0x277b4c,_0x5839d3=_0x5d2f82[_0x40be6f(0x244)](_0x5a0456);if(_0x5839d3)return _0x5839d3;if(_0x1ceb11['existingJourney']){const _0x29031f=await _0x412c11[_0x40be6f(0x204)][_0x40be6f(0x225)](_0x1ceb11[_0x40be6f(0x1e3)]['id']),_0x4dbc6a=_0x29031f[_0x40be6f(0x20c)](_0x255976=>_0x255976[_0x40be6f(0x227)][_0x40be6f(0x2b0)]?.[_0x40be6f(0x21b)]===_0x5a0456);if(_0x4dbc6a)return _0x5d2f82[_0x40be6f(0x27a)](_0x5a0456,_0x4dbc6a['id']),_0x4dbc6a['id'];}throw new SDKError(ErrorCode[_0x40be6f(0x241)],_0x40be6f(0x2ce)+_0x5a0456+'\x20(referenced\x20in\x20journey\x20'+_0x1ceb11['yamlConfig']['name']+_0x40be6f(0x211)+_0x40be6f(0x254));},'resolveEmbeddedActivationId':async(_0x231b67,_0x1d55ca)=>{const _0xae834=_0x277b4c,_0x58d127=_0x5d2f82[_0xae834(0x244)](_0x231b67);if(_0x58d127)return _0x58d127;if(_0x1ceb11[_0xae834(0x2d1)])return _0x3619b6[_0xae834(0x27a)](_0x231b67,_0x1d55ca),createPendingActivationId(_0x231b67);if(_0x1ceb11[_0xae834(0x1e3)]){const _0x21bf7c=await _0x412c11['journey']['listActivations'](_0x1ceb11[_0xae834(0x1e3)]['id']),_0x53dd6f=_0x21bf7c[_0xae834(0x20c)](_0xed8cc2=>_0xed8cc2[_0xae834(0x227)]['activationParams']?.[_0xae834(0x21b)]===_0x1d55ca['name']);if(_0x53dd6f)return _0x5d2f82[_0xae834(0x27a)](_0x231b67,_0x53dd6f['id']),_0x53dd6f['id'];try{const _0x34c3af=yamlActivationToCreateRequest(_0x1d55ca,_0x1e5a5f,_0x2e76a9),_0x2857d4=await _0x412c11[_0xae834(0x204)][_0xae834(0x239)](_0x1ceb11[_0xae834(0x1e3)]['id'],_0x34c3af);return _0x1a7b21[_0xae834(0x221)]&&console[_0xae834(0x28f)](_0xae834(0x275)+_0x231b67+_0xae834(0x28e)+_0x2857d4['id']),_0x5d2f82['set'](_0x231b67,_0x2857d4['id']),_0x2857d4['id'];}catch(_0x634c30){throw new SDKError(ErrorCode[_0xae834(0x252)],'Failed\x20to\x20create\x20embedded\x20activation\x20\x27'+_0x231b67+'\x27:\x20'+getErrorMessage(_0x634c30),_0x634c30);}}throw new SDKError(ErrorCode[_0xae834(0x21a)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x1168cb=>{const _0x937cc7=_0x277b4c;try{return await _0x412c11['journey'][_0x937cc7(0x261)](_0x21f120,_0x1168cb);}catch(_0x27432f){throw new SDKError(ErrorCode[_0x937cc7(0x241)],'Journey\x20\x27'+_0x1168cb+_0x937cc7(0x2d3)+_0x1ceb11[_0x937cc7(0x1fe)]['name']+'\x27)',_0x27432f);}},'resolveStageId':async(_0x447138,_0x2b955f)=>{const _0x396a48=_0x277b4c,_0x322909=await _0x412c11[_0x396a48(0x204)][_0x396a48(0x208)](_0x447138),_0x3c36e9=_0x322909[_0x396a48(0x227)][_0x396a48(0x25b)][_0x396a48(0x20c)](_0x37ebbd=>_0x37ebbd[_0x396a48(0x21b)][_0x396a48(0x2a4)]()===_0x2b955f['toLowerCase']());if(!_0x3c36e9?.['id'])throw new SDKError(ErrorCode[_0x396a48(0x241)],_0x396a48(0x222)+_0x2b955f+_0x396a48(0x2c2)+(_0x322909[_0x396a48(0x227)]['journeyBundleName']||_0x322909[_0x396a48(0x227)][_0x396a48(0x21b)])+'\x27');return _0x3c36e9['id'];}};try{const _0x1619ab=await a36_0x4a4bea(_0x1ceb11[_0x277b4c(0x1fe)],_0x21f120,_0x26bad9),_0x2423ac=_0x50eeff||_0x5e821c;_0x2423ac&&(_0x1619ab[_0x277b4c(0x2d4)]={'parentFolder':{'data':{'id':_0x2423ac,'type':_0x277b4c(0x279)}}});if(_0x1ceb11['isNew']){if(_0x4f0615['size']>0x0||_0x3619b6[_0x277b4c(0x1ec)]>0x0){const _0x2831a1=JSON[_0x277b4c(0x267)](JSON[_0x277b4c(0x25c)](_0x1619ab));ensureJourneyDefaults(_0x2831a1[_0x277b4c(0x227)]);for(const _0x2f5987 of _0x2831a1[_0x277b4c(0x227)][_0x277b4c(0x25b)]){_0x2f5987[_0x277b4c(0x2ae)]?.['segmentId']&&isPendingSegmentId(_0x2f5987['entryCriteria'][_0x277b4c(0x2cb)])&&delete _0x2f5987[_0x277b4c(0x2ae)];if(_0x2f5987[_0x277b4c(0x2c5)])for(const _0x2dd45d of Object['keys'](_0x2f5987[_0x277b4c(0x2c5)])){const _0x3b2789=_0x2f5987[_0x277b4c(0x2c5)][_0x2dd45d];_0x3b2789['type']===_0x277b4c(0x293)&&_0x3b2789[_0x277b4c(0x25a)]&&isPendingActivationId(_0x3b2789[_0x277b4c(0x25a)])&&(_0x3b2789[_0x277b4c(0x25a)]='');if(_0x3b2789[_0x277b4c(0x2d2)]===_0x277b4c(0x290)&&_0x3b2789[_0x277b4c(0x283)])for(const _0x1dd2d7 of _0x3b2789[_0x277b4c(0x283)]){_0x1dd2d7[_0x277b4c(0x2cb)]&&isPendingSegmentId(_0x1dd2d7[_0x277b4c(0x2cb)])&&(_0x1dd2d7['segmentId']='');}}}_0x1a7b21['verbose']&&console[_0x277b4c(0x28f)]('\x20\x20Step\x201:\x20Creating\x20journey\x20without\x20entry\x20criteria:\x20'+JSON[_0x277b4c(0x25c)](_0x2831a1,null,0x2));const _0x6ff24e=await _0x412c11['journey'][_0x277b4c(0x215)](_0x2831a1),_0x495b41=_0x6ff24e['id'],_0x33dc70=new Map();for(const _0x66d6a8 of _0x6ff24e[_0x277b4c(0x227)][_0x277b4c(0x25b)]){_0x33dc70[_0x277b4c(0x27a)](_0x66d6a8[_0x277b4c(0x21b)][_0x277b4c(0x2a4)](),_0x66d6a8['id']);}const _0x59c9d4=new Map();for(const [_0x1cedf8,{definition:_0x98bdbc,criteriaName:_0x2393db}]of _0x4f0615){const _0x14d0f8=generateJourneyLocalName(_0x2393db)||_0x277b4c(0x1e1)+crypto[_0x277b4c(0x23e)]();_0x1a7b21[_0x277b4c(0x221)]&&console['error'](_0x277b4c(0x2bf)+_0x1cedf8+_0x277b4c(0x270)+_0x14d0f8+_0x277b4c(0x23a)+_0x495b41);const _0x44a67d=await _0x412c11[_0x277b4c(0x233)]['createJourneySegment']({'name':_0x14d0f8,'description':_0x98bdbc[_0x277b4c(0x256)]||'Entry\x20criteria:\x20'+_0x1cedf8,'journeyId':_0x495b41,'rule':yamlRuleToApi(_0x98bdbc[_0x277b4c(0x22f)],!![]),'countPopulation':!![],'parentFolderId':_0x2423ac||'','audienceId':_0x21f120});_0x59c9d4['set'](_0x1cedf8,_0x44a67d),_0x240859[_0x277b4c(0x27a)](_0x1cedf8,_0x44a67d),_0x1a7b21[_0x277b4c(0x221)]&&console[_0x277b4c(0x28f)](_0x277b4c(0x2c6)+_0x1cedf8+_0x277b4c(0x28e)+_0x44a67d);}const _0x217079=new Map();for(const [_0x1d5c70,_0x41d452]of _0x3619b6){_0x1a7b21[_0x277b4c(0x221)]&&console[_0x277b4c(0x28f)](_0x277b4c(0x2af)+_0x1d5c70+_0x277b4c(0x27c)+_0x495b41);try{const _0x49f42e=yamlActivationToCreateRequest(_0x41d452,_0x1e5a5f,_0x2e76a9),_0x37d741=await _0x412c11[_0x277b4c(0x204)][_0x277b4c(0x239)](_0x495b41,_0x49f42e);_0x217079[_0x277b4c(0x27a)](_0x1d5c70,_0x37d741['id']),_0x5d2f82[_0x277b4c(0x27a)](_0x1d5c70,_0x37d741['id']),_0x1a7b21[_0x277b4c(0x221)]&&console[_0x277b4c(0x28f)]('\x20\x20Created\x20embedded\x20activation\x20\x27'+_0x1d5c70+_0x277b4c(0x28e)+_0x37d741['id']);}catch(_0x35fa9c){throw new SDKError(ErrorCode[_0x277b4c(0x252)],_0x277b4c(0x2c7)+_0x1d5c70+_0x277b4c(0x226)+getErrorMessage(_0x35fa9c),_0x35fa9c);}}const _0x1267dd=JSON[_0x277b4c(0x267)](JSON[_0x277b4c(0x25c)](_0x1619ab));_0x1267dd['id']=_0x495b41,ensureJourneyDefaults(_0x1267dd[_0x277b4c(0x227)]);for(const _0x542300 of _0x1267dd[_0x277b4c(0x227)][_0x277b4c(0x25b)]){const _0xb35b8a=_0x33dc70['get'](_0x542300[_0x277b4c(0x21b)][_0x277b4c(0x2a4)]());_0xb35b8a&&(_0x542300['id']=_0xb35b8a);if(_0x542300[_0x277b4c(0x2ae)]?.[_0x277b4c(0x2cb)]&&isPendingSegmentId(_0x542300[_0x277b4c(0x2ae)][_0x277b4c(0x2cb)])){const _0x486cb0=extractPendingSegmentName(_0x542300[_0x277b4c(0x2ae)][_0x277b4c(0x2cb)]),_0x169667=_0x59c9d4[_0x277b4c(0x244)](_0x486cb0);_0x169667&&(_0x542300[_0x277b4c(0x2ae)][_0x277b4c(0x2cb)]=_0x169667);}if(_0x542300['steps']){const _0x337d23=_0x4345f6=>_0x1619ab[_0x277b4c(0x227)]['journeyStages'][_0x277b4c(0x20c)](_0x8c8e0d=>_0x8c8e0d[_0x277b4c(0x21b)][_0x277b4c(0x2a4)]()===_0x542300['name'][_0x277b4c(0x2a4)]())?.[_0x277b4c(0x2c5)]?.[_0x4345f6];for(const _0x3bf682 of Object[_0x277b4c(0x20b)](_0x542300[_0x277b4c(0x2c5)])){const _0x51e5c0=_0x542300[_0x277b4c(0x2c5)][_0x3bf682],_0x48bb08=_0x337d23(_0x3bf682);if(_0x51e5c0[_0x277b4c(0x2d2)]===_0x277b4c(0x293)&&_0x51e5c0['journeyActivationStepId']&&(isPendingActivationId(_0x51e5c0[_0x277b4c(0x25a)])||_0x51e5c0[_0x277b4c(0x25a)]==='')){if(_0x48bb08?.[_0x277b4c(0x25a)]&&isPendingActivationId(_0x48bb08['journeyActivationStepId'])){const _0x2b4488=extractPendingActivationName(_0x48bb08[_0x277b4c(0x25a)]),_0x203ba4=_0x217079['get'](_0x2b4488);_0x203ba4&&(_0x51e5c0['journeyActivationStepId']=_0x203ba4);}}if(_0x51e5c0[_0x277b4c(0x2d2)]===_0x277b4c(0x290)&&_0x51e5c0[_0x277b4c(0x283)]&&_0x48bb08?.[_0x277b4c(0x283)])for(let _0x4e2fcb=0x0;_0x4e2fcb<_0x51e5c0['branches']['length'];_0x4e2fcb++){const _0x522e27=_0x51e5c0['branches'][_0x4e2fcb],_0x3830eb=_0x48bb08['branches'][_0x4e2fcb];if(_0x3830eb?.[_0x277b4c(0x2cb)]&&isPendingSegmentId(_0x3830eb[_0x277b4c(0x2cb)])){const _0x5d939d=extractPendingSegmentName(_0x3830eb[_0x277b4c(0x2cb)]),_0x36e077=_0x59c9d4['get'](_0x5d939d);_0x36e077&&(_0x522e27[_0x277b4c(0x2cb)]=_0x36e077);}}}}}return _0x1a7b21[_0x277b4c(0x221)]&&console['error'](_0x277b4c(0x1f5)+JSON[_0x277b4c(0x25c)](_0x1267dd,null,0x2)),await _0x412c11[_0x277b4c(0x204)][_0x277b4c(0x29f)](_0x495b41,_0x1267dd),{'action':_0x277b4c(0x251),'name':_0x1ceb11['yamlConfig'][_0x277b4c(0x21b)],'journeyId':_0x495b41};}else{ensureJourneyDefaults(_0x1619ab[_0x277b4c(0x227)]);_0x1a7b21['verbose']&&console[_0x277b4c(0x28f)]('\x20\x20Journey\x20API\x20request:\x20'+JSON[_0x277b4c(0x25c)](_0x1619ab,null,0x2));const _0x3efaed=await _0x412c11[_0x277b4c(0x204)][_0x277b4c(0x215)](_0x1619ab);return{'action':_0x277b4c(0x251),'name':_0x1ceb11[_0x277b4c(0x1fe)][_0x277b4c(0x21b)],'journeyId':_0x3efaed['id']};}}else{if(_0x1ceb11[_0x277b4c(0x24f)]&&_0x1ceb11[_0x277b4c(0x1e3)])return ensureJourneyDefaults(_0x1619ab[_0x277b4c(0x227)]),await _0x412c11[_0x277b4c(0x204)][_0x277b4c(0x29f)](_0x1ceb11[_0x277b4c(0x1e3)]['id'],_0x1619ab),{'action':_0x277b4c(0x29c),'name':_0x1ceb11[_0x277b4c(0x1fe)][_0x277b4c(0x21b)],'journeyId':_0x1ceb11[_0x277b4c(0x1e3)]['id']};}return{'action':_0x277b4c(0x1f7),'name':_0x1ceb11[_0x277b4c(0x1fe)][_0x277b4c(0x21b)],'journeyId':_0x1ceb11[_0x277b4c(0x1e3)]?.['id']};}catch(_0x567001){const _0x3a282d=isHttp400Error(_0x567001),_0x4db260=_0x3a282d?ErrorCode[_0x277b4c(0x26c)]:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x59f57f=getErrorMessage(_0x567001);throw new SDKError(_0x4db260,_0x277b4c(0x218)+(_0x1ceb11['isNew']?_0x277b4c(0x215):'update')+_0x277b4c(0x274)+_0x1ceb11[_0x277b4c(0x2b2)]+_0x277b4c(0x1e7)+_0x59f57f,_0x567001);}}));_0x38626f[_0x322932(0x237)](..._0x32f2d4),_0x523358+=_0x1cb7e7[_0x322932(0x23b)],_0x52721e['setExtra']('('+_0x523358+'/'+_0xcae309[_0x322932(0x23b)]+')');}return _0x38626f;},{'verbose':_0x1a7b21[_0x4e4f1c(0x221)]});for(const _0x2a02a7 of _0x12b06d[_0x4e4f1c(0x253)]){if(_0x2a02a7[_0x4e4f1c(0x2b6)]==='created')console['error'](a36_0x20973d['green'](_0x4e4f1c(0x229)+_0x2a02a7[_0x4e4f1c(0x21b)]+'\x27')),_0x488864++;else _0x2a02a7['action']==='updated'&&(console[_0x4e4f1c(0x28f)](a36_0x20973d[_0x4e4f1c(0x1f0)](_0x4e4f1c(0x1fc)+_0x2a02a7[_0x4e4f1c(0x21b)]+'\x27')),_0x3e3782++);}if(_0x1d4589&&_0x12b06d[_0x4e4f1c(0x253)]['length']===0x1){const _0x5914c6=_0x12b06d[_0x4e4f1c(0x253)][0x0];if(_0x5914c6[_0x4e4f1c(0x1e0)]){const _0xf49139=getConsoleNextUrl(_0x1a7b21[_0x4e4f1c(0x23f)],_0x4e4f1c(0x286)+_0x21f120+_0x4e4f1c(0x220)+_0x5914c6['journeyId']+_0x4e4f1c(0x20a));console[_0x4e4f1c(0x28f)]('\x20\x20'+a36_0x20973d['cyan'](_0xf49139));}}}for(const _0x5868c7 of _0x2c0ee0){console[_0x4e4f1c(0x28f)](a36_0x20973d['yellow'](_0x4e4f1c(0x291)+_0x5868c7[_0x4e4f1c(0x1e6)])),_0x510e35++;}const _0x26f5da=[];if(_0x32dbd0>0x0)_0x26f5da['push'](_0x32dbd0+_0x4e4f1c(0x299));if(_0x1e3753>0x0)_0x26f5da[_0x4e4f1c(0x237)](_0x1e3753+_0x4e4f1c(0x294));if(_0x17942c>0x0)_0x26f5da[_0x4e4f1c(0x237)](_0x17942c+_0x4e4f1c(0x1e4));const _0x131337=[];if(_0x488864>0x0)_0x131337[_0x4e4f1c(0x237)](_0x488864+'\x20created');if(_0x3e3782>0x0)_0x131337[_0x4e4f1c(0x237)](_0x3e3782+_0x4e4f1c(0x294));if(_0x510e35>0x0)_0x131337[_0x4e4f1c(0x237)](_0x510e35+'\x20deleted');const _0x458123=[];if(_0x42d14d>0x0)_0x458123[_0x4e4f1c(0x237)](_0x42d14d+'\x20created');if(_0x2e8082>0x0)_0x458123[_0x4e4f1c(0x237)](_0x2e8082+_0x4e4f1c(0x294));if(_0x402015>0x0)_0x458123[_0x4e4f1c(0x237)](_0x402015+_0x4e4f1c(0x1e4));return console['error'](a36_0x20973d['green']('\x0a✔\x20Push\x20complete')),_0x26f5da[_0x4e4f1c(0x23b)]>0x0&&!_0x1a7b21['journeysOnly']&&console['error'](_0x4e4f1c(0x2a8)+_0x26f5da[_0x4e4f1c(0x2be)](',\x20')),_0x131337[_0x4e4f1c(0x23b)]>0x0&&console['error'](_0x4e4f1c(0x26d)+_0x131337['join'](',\x20')),_0x458123['length']>0x0&&!_0x1a7b21[_0x4e4f1c(0x2a3)]&&console[_0x4e4f1c(0x28f)](_0x4e4f1c(0x22d)+_0x458123[_0x4e4f1c(0x2be)](',\x20')),0x0;}}function buildFolderPathToIdMap(_0x516d09){const _0x1361fa=a36_0x3acda7,_0x59ea57=new Map(),_0x1d43f6=new Map();for(const _0x10d1ba of _0x516d09){_0x1d43f6[_0x1361fa(0x27a)](_0x10d1ba['id'],_0x10d1ba);}const _0x2e2a7c=new Set();for(const _0x80cf11 of _0x516d09){!_0x80cf11[_0x1361fa(0x1f3)]&&_0x2e2a7c['add'](_0x80cf11['id']);}function _0x3a531e(_0x275ed0){const _0x45cb2b=_0x1361fa;if(_0x2e2a7c[_0x45cb2b(0x243)](_0x275ed0['id']))return'';if(_0x275ed0[_0x45cb2b(0x1f3)]){const _0x3fd5e6=_0x1d43f6[_0x45cb2b(0x244)](_0x275ed0[_0x45cb2b(0x1f3)]);if(_0x3fd5e6){const _0x3c33cb=_0x3a531e(_0x3fd5e6);return _0x3c33cb?_0x3c33cb+'/'+_0x275ed0['name']:_0x275ed0[_0x45cb2b(0x21b)];}}return _0x275ed0['name'];}for(const _0x58bd39 of _0x516d09){const _0x5ea4db=_0x3a531e(_0x58bd39);_0x59ea57[_0x1361fa(0x27a)](_0x5ea4db,_0x58bd39['id']);}return _0x59ea57;}function findYamlFiles(_0x34e0f4){const _0x14d25e=[];function _0xdf248e(_0x1ab8bd){const _0xa9f8b7=a36_0x2d92,_0x2b1308=readdirSync(_0x1ab8bd,{'withFileTypes':!![]});for(const _0xd1dfaa of _0x2b1308){const _0x4b6b4c=a36_0x23b535[_0xa9f8b7(0x2be)](_0x1ab8bd,_0xd1dfaa[_0xa9f8b7(0x21b)]);if(_0xd1dfaa['isDirectory']())_0xdf248e(_0x4b6b4c);else(_0xd1dfaa[_0xa9f8b7(0x21b)][_0xa9f8b7(0x228)](_0xa9f8b7(0x1e9))||_0xd1dfaa[_0xa9f8b7(0x21b)][_0xa9f8b7(0x228)]('.yaml'))&&_0x14d25e[_0xa9f8b7(0x237)](_0x4b6b4c);}}return _0xdf248e(_0x34e0f4),_0x14d25e;}function calculateActivationActions(_0xc4528d,_0xcfb57d,_0x18c5cb,_0x225368){const _0x17b858=a36_0x3acda7,_0x47d7b4=[],_0x2fcb8b=new Map();for(const _0x71bdc6 of _0xcfb57d){_0x2fcb8b[_0x17b858(0x27a)](_0x71bdc6['name'],_0x71bdc6);}const _0x357eba=new Map();for(const _0x45b6cf of _0xc4528d){_0x357eba[_0x17b858(0x27a)](_0x45b6cf[_0x17b858(0x21b)],_0x45b6cf);}for(const _0x23f13b of _0xc4528d){const _0x372cff=_0x2fcb8b[_0x17b858(0x244)](_0x23f13b[_0x17b858(0x21b)]);if(!_0x372cff)_0x47d7b4[_0x17b858(0x237)]({'type':_0x17b858(0x215),'name':_0x23f13b[_0x17b858(0x21b)],'yamlActivation':_0x23f13b});else{const _0x3f8e72=activationToYaml(_0x372cff,_0x18c5cb,_0x225368),_0x3a15e9=a36_0x575e8b['stringify'](_0x3f8e72),_0x2df5f7=a36_0x575e8b['stringify'](_0x23f13b);_0x3a15e9!==_0x2df5f7&&_0x47d7b4[_0x17b858(0x237)]({'type':_0x17b858(0x29f),'name':_0x23f13b[_0x17b858(0x21b)],'yamlActivation':_0x23f13b,'existingActivation':_0x372cff});}}for(const _0x5629b0 of _0xcfb57d){!_0x357eba[_0x17b858(0x243)](_0x5629b0[_0x17b858(0x21b)])&&_0x47d7b4[_0x17b858(0x237)]({'type':_0x17b858(0x202),'name':_0x5629b0[_0x17b858(0x21b)],'existingActivation':_0x5629b0});}return _0x47d7b4;}
@@ -1 +1 @@
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;}}
1
+ const a37_0x18b039=a37_0x33ed;(function(_0x495953,_0x3cf4b0){const _0x2db4d9=a37_0x33ed,_0x5d3be7=_0x495953();while(!![]){try{const _0x47ab89=parseInt(_0x2db4d9(0x1e9))/0x1*(parseInt(_0x2db4d9(0x1d2))/0x2)+parseInt(_0x2db4d9(0x1dd))/0x3+parseInt(_0x2db4d9(0x1ee))/0x4*(-parseInt(_0x2db4d9(0x1c5))/0x5)+parseInt(_0x2db4d9(0x1f3))/0x6+-parseInt(_0x2db4d9(0x1df))/0x7+parseInt(_0x2db4d9(0x1f6))/0x8*(-parseInt(_0x2db4d9(0x1d1))/0x9)+-parseInt(_0x2db4d9(0x1cf))/0xa*(-parseInt(_0x2db4d9(0x1ce))/0xb);if(_0x47ab89===_0x3cf4b0)break;else _0x5d3be7['push'](_0x5d3be7['shift']());}catch(_0x1b622a){_0x5d3be7['push'](_0x5d3be7['shift']());}}}(a37_0x5a69,0xdd217));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';function a37_0x33ed(_0x2854e7,_0x17b406){_0x2854e7=_0x2854e7-0x1c4;const _0x5a696e=a37_0x5a69();let _0x33ed19=_0x5a696e[_0x2854e7];return _0x33ed19;}function a37_0x5a69(){const _0x292e5b=['includes','Resolving\x20path\x20\x27','Resolving\x20folder\x20\x27','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x27...','type','resolvePathToResource','execute','1175079jksUCh','Resolved\x20relative\x20path\x20to:\x20','9431128OuxzcV','✔\x20Updated\x20segment\x20\x27','name','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','Segment\x20ID:\x20','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','segmentPath','yellow','segment:update','ruleFile','3okYQat','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','Resolved\x20folder\x20ID:\x20','error','5246124dZFgIo','\x20\x20\x20Path:\x20','Parent\x20ID:\x20','description','data','1596570HcCFpr','Error:\x20Cannot\x20update\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','3527936ZlUOnC','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','5UtmrUm','segmentId','segmentName','Examples:','Update\x20existing\x20child\x20segment','parentId','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','segment','11nxRocU','21432310SEZBlS','kind','18evFswq','1097034izpFbw','Resolved\x20type:\x20','verbose'];a37_0x5a69=function(){return _0x292e5b;};return a37_0x5a69();}import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a37_0x184979 from'chalk';export class SegmentUpdateCommand extends BaseCommand{[a37_0x18b039(0x1e1)]=a37_0x18b039(0x1e7);[a37_0x18b039(0x1f1)]=a37_0x18b039(0x1c9);async[a37_0x18b039(0x1dc)](_0x112bc8){const _0xbab960=a37_0x18b039;console[_0xbab960(0x1ed)](a37_0x184979[_0xbab960(0x1e6)](_0xbab960(0x1cb))),console['error'](a37_0x184979['yellow'](_0xbab960(0x1f5)));const {options:_0x31da77,args:_0x13ef4e,tdx:_0x48cc4e}=_0x112bc8,_0x2f44a8=_0x31da77;if(_0x13ef4e['length']===0x0)return console['error'](_0xbab960(0x1cc)),console[_0xbab960(0x1ed)](_0xbab960(0x1eb)),console['error'](_0xbab960(0x1c8)),console[_0xbab960(0x1ed)](_0xbab960(0x1e2)),console[_0xbab960(0x1ed)](_0xbab960(0x1ea)),0x1;const _0x2f4af1=_0x13ef4e[0x0],_0xc19cd=_0x31da77[_0xbab960(0x1e5)];let _0x59deb6=_0x2f4af1;_0xc19cd&&!_0x2f4af1[_0xbab960(0x1d5)]('/')&&(_0x59deb6=_0xc19cd+'/'+_0x2f4af1,_0x2f44a8['verbose']&&console[_0xbab960(0x1ed)](_0xbab960(0x1de)+_0x59deb6));const _0x474c63=await withSpinner(_0xbab960(0x1d6)+_0x59deb6+_0xbab960(0x1d9),()=>_0x48cc4e[_0xbab960(0x1cd)][_0xbab960(0x1db)](_0x59deb6),{'verbose':_0x2f44a8[_0xbab960(0x1d4)]}),_0x2ac916=_0x474c63[_0xbab960(0x1f2)];_0x2f44a8['verbose']&&console[_0xbab960(0x1ed)](_0xbab960(0x1d3)+_0x2ac916[_0xbab960(0x1da)]);if(_0x2ac916[_0xbab960(0x1da)]!==_0xbab960(0x1cd))return console[_0xbab960(0x1ed)](_0xbab960(0x1f4)+_0x2ac916[_0xbab960(0x1da)]+_0xbab960(0x1c4)),console[_0xbab960(0x1ed)](_0xbab960(0x1e4)),0x1;if(!_0x2ac916['segmentId'])throw new SDKError(ErrorCode['INTERNAL'],_0xbab960(0x1d8));const _0x480134=_0x2ac916[_0xbab960(0x1ca)],_0x380ce5=_0x2ac916[_0xbab960(0x1c6)];_0x2f44a8[_0xbab960(0x1d4)]&&(console['error'](_0xbab960(0x1f0)+_0x480134),console['error'](_0xbab960(0x1e3)+_0x380ce5));let _0x2808ce;if(_0x2f44a8['folder']){const _0x335289=_0x2f44a8['folder'],_0x2ffafe=await withSpinner(_0xbab960(0x1d7)+_0x335289+_0xbab960(0x1d9),()=>_0x48cc4e['segment']['resolveFolderId'](_0x480134,_0x335289),{'verbose':_0x2f44a8[_0xbab960(0x1d4)]});_0x2808ce=parseInt(_0x2ffafe[_0xbab960(0x1f2)],0xa),_0x2f44a8[_0xbab960(0x1d4)]&&console[_0xbab960(0x1ed)](_0xbab960(0x1ec)+_0x2808ce);}const _0xc276c4=await loadJSONFromOptions(_0x2f44a8['rule'],_0x2f44a8[_0xbab960(0x1e8)]),_0x19c146={'name':_0x2f44a8[_0xbab960(0x1e1)],'description':_0x2f44a8[_0xbab960(0x1f1)],'rule':_0xc276c4,'kind':_0x2f44a8['kind']!==undefined?parseInt(_0x2f44a8[_0xbab960(0x1d0)],0xa):undefined,'segmentFolderId':_0x2808ce},_0x4fef5f=await withSpinner('Updating\x20segment\x20\x27'+_0x2ac916[_0xbab960(0x1c7)]+_0xbab960(0x1d9),()=>_0x48cc4e['segment']['updateSegmentById'](_0x480134,_0x380ce5,_0x19c146),{'verbose':_0x2f44a8['verbose']}),_0x1d90a3=_0x4fef5f['data'];return console[_0xbab960(0x1ed)](_0xbab960(0x1e0)+_0x1d90a3['name']+'\x27'),_0x59deb6!==_0x2f4af1&&console[_0xbab960(0x1ed)](_0xbab960(0x1ef)+_0x59deb6),await handleSDKOutput([_0x1d90a3],_0x2f44a8),0x0;}}
@@ -1 +1 @@
1
- const a38_0x1758f1=a38_0x5b84;function a38_0x5b84(_0x5ea9c7,_0x3da3bb){_0x5ea9c7=_0x5ea9c7-0x185;const _0xdf4391=a38_0xdf43();let _0x5b842c=_0xdf4391[_0x5ea9c7];return _0x5b842c;}(function(_0x24f805,_0x3e3219){const _0x20748b=a38_0x5b84,_0x46f4d6=_0x24f805();while(!![]){try{const _0x210b06=parseInt(_0x20748b(0x1b4))/0x1+parseInt(_0x20748b(0x18b))/0x2+parseInt(_0x20748b(0x198))/0x3*(parseInt(_0x20748b(0x1b9))/0x4)+-parseInt(_0x20748b(0x1ab))/0x5*(-parseInt(_0x20748b(0x193))/0x6)+-parseInt(_0x20748b(0x1a1))/0x7*(-parseInt(_0x20748b(0x18f))/0x8)+-parseInt(_0x20748b(0x187))/0x9+-parseInt(_0x20748b(0x191))/0xa;if(_0x210b06===_0x3e3219)break;else _0x46f4d6['push'](_0x46f4d6['shift']());}catch(_0x39a6c0){_0x46f4d6['push'](_0x46f4d6['shift']());}}}(a38_0xdf43,0x1e01a));import{existsSync,statSync}from'fs';import a38_0x1e2e5a from'chalk';import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../utils/segment-path-parser.js';function a38_0xdf43(){const _0x366671=['Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','resolvePathToResource','1520253PVwTtH','parentId','isAbsolute','config','393806YpLgcv','segment:use','Resolved\x20path\x20type:\x20','Use\x20\x22tdx\x20context\x22\x20to\x20see\x20all\x20context\x20parameters','1439384qTJeVn','parentName','4451250JkIuLh','Use:\x20tdx\x20segment\x20use\x20','4404LaYBVy','length','slice','join','site','417tlAoSP','type','segment','Resolved\x20relative\x20path\x20to:\x20','session','description','Resolving\x20path\x20\x27','segments','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','7RAQxjr','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','\x27...','isDirectory','green','fullPath','split','data','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','20SCKMED','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','folderId','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','verbose','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','dim','202757boqByZ','error','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','Site:\x20','log','4444uAAUFh','Error:\x20Path\x20is\x20required\x0a','red','Parent\x20ID:\x20','execute','✔\x20Context\x20set\x20to:\x20','Usage:\x20tdx\x20segment\x20use\x20<path>','cyan'];a38_0xdf43=function(){return _0x366671;};return a38_0xdf43();}import{findTdxConfig}from'../utils/tdx-config.js';export class SegmentUseCommand extends BaseCommand{['name']=a38_0x1758f1(0x18c);[a38_0x1758f1(0x19d)]=a38_0x1758f1(0x1af);async[a38_0x1758f1(0x1bd)](_0x8b0d3b){const _0x4b8bb4=a38_0x1758f1,{options:_0x40755c,args:_0x3bb4fd,tdx:_0x23f7b8}=_0x8b0d3b;if(_0x3bb4fd[_0x4b8bb4(0x194)]===0x0)return console[_0x4b8bb4(0x1b5)](a38_0x1e2e5a[_0x4b8bb4(0x1bb)](_0x4b8bb4(0x1ba))),console['error'](_0x4b8bb4(0x1bf)),console[_0x4b8bb4(0x1b5)]('Examples:'),console[_0x4b8bb4(0x1b5)](_0x4b8bb4(0x1b1)),console[_0x4b8bb4(0x1b5)](_0x4b8bb4(0x1a0)),console[_0x4b8bb4(0x1b5)](_0x4b8bb4(0x1b6)),console[_0x4b8bb4(0x1b5)]('\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent'),0x1;const _0x3c1397=_0x3bb4fd[0x0],_0x5dd524=_0x40755c[_0x4b8bb4(0x19c)];try{if(_0x3c1397==='/')return saveSessionContext({'segment_path':undefined},_0x5dd524),console['log'](a38_0x1e2e5a[_0x4b8bb4(0x1a5)](_0x4b8bb4(0x1ae))),0x0;if(existsSync(_0x3c1397)&&statSync(_0x3c1397)[_0x4b8bb4(0x1a4)]()){let _0x596139;try{_0x596139=findTdxConfig(_0x3c1397);}catch{return console[_0x4b8bb4(0x1b5)](a38_0x1e2e5a[_0x4b8bb4(0x1bb)](_0x4b8bb4(0x1aa)+_0x3c1397)),console[_0x4b8bb4(0x1b5)](a38_0x1e2e5a['cyan']('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;}const _0x149d1d=_0x596139[_0x4b8bb4(0x18a)]['parent_segment'];return saveSessionContext({'segment_path':_0x149d1d,'parent_segment':_0x149d1d},_0x5dd524),console['log'](a38_0x1e2e5a[_0x4b8bb4(0x1a5)](_0x4b8bb4(0x1be)+a38_0x1e2e5a[_0x4b8bb4(0x1c0)](_0x149d1d))),0x0;}const _0x2c65d5=_0x40755c['segmentPath'];let _0x24b8ee=_0x3c1397;const _0x36a341=parsePath(_0x3c1397);if(!_0x36a341[_0x4b8bb4(0x189)]){if(!_0x2c65d5)return console[_0x4b8bb4(0x1b5)](a38_0x1e2e5a[_0x4b8bb4(0x1bb)](_0x4b8bb4(0x1a9))),console[_0x4b8bb4(0x1b5)](a38_0x1e2e5a['cyan'](_0x4b8bb4(0x1b2))),0x1;if(_0x3c1397==='..'){const _0x596edb=_0x2c65d5[_0x4b8bb4(0x1a7)]('/')[_0x4b8bb4(0x195)](0x0,-0x1)[_0x4b8bb4(0x196)]('/');_0x24b8ee=_0x596edb||'/';}else _0x3c1397==='.'?_0x24b8ee=_0x2c65d5:_0x24b8ee=_0x2c65d5+'/'+_0x3c1397;_0x40755c[_0x4b8bb4(0x1b0)]&&console[_0x4b8bb4(0x1b5)](_0x4b8bb4(0x19b)+_0x24b8ee);}if(_0x24b8ee==='/'||_0x24b8ee==='')return saveSessionContext({'segment_path':undefined},_0x5dd524),console['log'](a38_0x1e2e5a['green']('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;_0x24b8ee=normalizePath(_0x24b8ee);const _0x45ff12=parsePath(_0x24b8ee)[_0x4b8bb4(0x19f)];if(_0x45ff12[_0x4b8bb4(0x194)]===0x0)return saveSessionContext({'segment_path':undefined},_0x5dd524),console[_0x4b8bb4(0x1b8)](a38_0x1e2e5a['green'](_0x4b8bb4(0x1ae))),0x0;_0x40755c[_0x4b8bb4(0x1b0)]&&(console[_0x4b8bb4(0x1b5)](_0x4b8bb4(0x1b7)+_0x40755c[_0x4b8bb4(0x197)]),console[_0x4b8bb4(0x1b5)]('Target\x20path:\x20'+_0x24b8ee));const _0x19280b=await withSpinner(_0x4b8bb4(0x19e)+_0x24b8ee+_0x4b8bb4(0x1a3),()=>_0x23f7b8[_0x4b8bb4(0x19a)][_0x4b8bb4(0x186)](_0x24b8ee),{'verbose':_0x40755c[_0x4b8bb4(0x1b0)]}),_0x5beb49=_0x19280b[_0x4b8bb4(0x1a8)];_0x40755c[_0x4b8bb4(0x1b0)]&&(console[_0x4b8bb4(0x1b5)](_0x4b8bb4(0x18d)+_0x5beb49[_0x4b8bb4(0x199)]),console[_0x4b8bb4(0x1b5)](_0x4b8bb4(0x1bc)+_0x5beb49[_0x4b8bb4(0x188)]),_0x5beb49[_0x4b8bb4(0x1ad)]&&console[_0x4b8bb4(0x1b5)]('Folder\x20ID:\x20'+_0x5beb49[_0x4b8bb4(0x1ad)]));if(_0x5beb49[_0x4b8bb4(0x199)]===_0x4b8bb4(0x19a))return console['error'](a38_0x1e2e5a[_0x4b8bb4(0x1bb)](_0x4b8bb4(0x185))),console[_0x4b8bb4(0x1b5)](_0x4b8bb4(0x1a2)),console['error'](a38_0x1e2e5a[_0x4b8bb4(0x1c0)](_0x4b8bb4(0x192)+_0x5beb49[_0x4b8bb4(0x190)]+(_0x5beb49['folderPath']?'/'+_0x5beb49['folderPath']['join']('/'):''))),0x1;return saveSessionContext({'segment_path':_0x5beb49[_0x4b8bb4(0x1a6)],'parent_segment':_0x5beb49['parentName']},_0x5dd524),console[_0x4b8bb4(0x1b8)](a38_0x1e2e5a[_0x4b8bb4(0x1a5)]('✔\x20Context\x20set\x20to:\x20'+a38_0x1e2e5a[_0x4b8bb4(0x1c0)](_0x5beb49['fullPath']))),_0x40755c[_0x4b8bb4(0x1b0)]&&(console[_0x4b8bb4(0x1b5)](a38_0x1e2e5a[_0x4b8bb4(0x1b3)](_0x4b8bb4(0x1ac))),console[_0x4b8bb4(0x1b5)](a38_0x1e2e5a['dim'](_0x4b8bb4(0x18e)))),0x0;}catch(_0x119223){throw _0x119223;}}}
1
+ const a38_0x97a0ef=a38_0x39ef;(function(_0xb9143d,_0x2d530b){const _0x20fa87=a38_0x39ef,_0x1d8d7e=_0xb9143d();while(!![]){try{const _0xfb810a=parseInt(_0x20fa87(0x118))/0x1+-parseInt(_0x20fa87(0x117))/0x2+parseInt(_0x20fa87(0xef))/0x3+parseInt(_0x20fa87(0x116))/0x4+-parseInt(_0x20fa87(0xf4))/0x5*(-parseInt(_0x20fa87(0xf3))/0x6)+-parseInt(_0x20fa87(0xfe))/0x7+-parseInt(_0x20fa87(0x11d))/0x8*(parseInt(_0x20fa87(0x10c))/0x9);if(_0xfb810a===_0x2d530b)break;else _0x1d8d7e['push'](_0x1d8d7e['shift']());}catch(_0x117611){_0x1d8d7e['push'](_0x1d8d7e['shift']());}}}(a38_0x56d5,0x9b576));import{existsSync,statSync}from'fs';import a38_0x1e9cf8 from'chalk';function a38_0x56d5(){const _0x4c5d3d=['parentId','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Use:\x20tdx\x20segment\x20use\x20','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','split','Use\x20\x22tdx\x20context\x22\x20to\x20see\x20all\x20context\x20parameters','Examples:','verbose','1624544hEFYBe','130082ulbzYY','466769rIZsEO','red','cyan','segments','Site:\x20','180328FfEDrv','segmentPath','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','segment','Parent\x20ID:\x20','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','log','isAbsolute','join','Resolved\x20relative\x20path\x20to:\x20','data','Target\x20path:\x20','description','1456569XjWKIh','type','Error:\x20Path\x20is\x20required\x0a','✔\x20Context\x20set\x20to:\x20','91068MLtnRa','50oszQyf','length','folderId','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','error','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','dim','execute','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','green','3926566pZoitz','Resolved\x20path\x20type:\x20','slice','fullPath','segment:use','parent_segment','site','\x27...','Folder\x20ID:\x20','session','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','folderPath','99byFuDv'];a38_0x56d5=function(){return _0x4c5d3d;};return a38_0x56d5();}import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../utils/segment-path-parser.js';import{findTdxConfig}from'../utils/tdx-config.js';function a38_0x39ef(_0x3f564c,_0x2c746c){_0x3f564c=_0x3f564c-0xed;const _0x56d5d6=a38_0x56d5();let _0x39efb7=_0x56d5d6[_0x3f564c];return _0x39efb7;}export class SegmentUseCommand extends BaseCommand{['name']=a38_0x97a0ef(0x102);[a38_0x97a0ef(0xee)]=a38_0x97a0ef(0x111);async[a38_0x97a0ef(0xfb)](_0x18d9d4){const _0x15f08e=a38_0x97a0ef,{options:_0x3570ea,args:_0x4d8dab,tdx:_0x2f30a2}=_0x18d9d4;if(_0x4d8dab[_0x15f08e(0xf5)]===0x0)return console[_0x15f08e(0xf8)](a38_0x1e9cf8['red'](_0x15f08e(0xf1))),console[_0x15f08e(0xf8)]('Usage:\x20tdx\x20segment\x20use\x20<path>'),console[_0x15f08e(0xf8)](_0x15f08e(0x114)),console['error'](_0x15f08e(0x122)),console[_0x15f08e(0xf8)](_0x15f08e(0xf7)),console[_0x15f08e(0xf8)](_0x15f08e(0x108)),console[_0x15f08e(0xf8)](_0x15f08e(0x10e)),0x1;const _0x436fc7=_0x4d8dab[0x0],_0x3e3efb=_0x3570ea[_0x15f08e(0x107)];try{if(_0x436fc7==='/')return saveSessionContext({'segment_path':undefined},_0x3e3efb),console[_0x15f08e(0x123)](a38_0x1e9cf8['green'](_0x15f08e(0x109))),0x0;if(existsSync(_0x436fc7)&&statSync(_0x436fc7)['isDirectory']()){let _0x5dcf9e;try{_0x5dcf9e=findTdxConfig(_0x436fc7);}catch{return console[_0x15f08e(0xf8)](a38_0x1e9cf8[_0x15f08e(0x119)](_0x15f08e(0x11f)+_0x436fc7)),console['error'](a38_0x1e9cf8[_0x15f08e(0x11a)](_0x15f08e(0x10f))),0x1;}const _0x285caf=_0x5dcf9e['config'][_0x15f08e(0x103)];return saveSessionContext({'segment_path':_0x285caf,'parent_segment':_0x285caf},_0x3e3efb),console[_0x15f08e(0x123)](a38_0x1e9cf8[_0x15f08e(0xfd)](_0x15f08e(0xf2)+a38_0x1e9cf8[_0x15f08e(0x11a)](_0x285caf))),0x0;}const _0x552bf2=_0x3570ea[_0x15f08e(0x11e)];let _0x381871=_0x436fc7;const _0x160ecf=parsePath(_0x436fc7);if(!_0x160ecf[_0x15f08e(0x124)]){if(!_0x552bf2)return console[_0x15f08e(0xf8)](a38_0x1e9cf8[_0x15f08e(0x119)](_0x15f08e(0x10a))),console[_0x15f08e(0xf8)](a38_0x1e9cf8['cyan']('Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>')),0x1;if(_0x436fc7==='..'){const _0x3dcd70=_0x552bf2[_0x15f08e(0x112)]('/')[_0x15f08e(0x100)](0x0,-0x1)[_0x15f08e(0x125)]('/');_0x381871=_0x3dcd70||'/';}else _0x436fc7==='.'?_0x381871=_0x552bf2:_0x381871=_0x552bf2+'/'+_0x436fc7;_0x3570ea['verbose']&&console[_0x15f08e(0xf8)](_0x15f08e(0x126)+_0x381871);}if(_0x381871==='/'||_0x381871==='')return saveSessionContext({'segment_path':undefined},_0x3e3efb),console['log'](a38_0x1e9cf8[_0x15f08e(0xfd)](_0x15f08e(0x109))),0x0;_0x381871=normalizePath(_0x381871);const _0x22818b=parsePath(_0x381871)[_0x15f08e(0x11b)];if(_0x22818b[_0x15f08e(0xf5)]===0x0)return saveSessionContext({'segment_path':undefined},_0x3e3efb),console[_0x15f08e(0x123)](a38_0x1e9cf8['green'](_0x15f08e(0x109))),0x0;_0x3570ea[_0x15f08e(0x115)]&&(console[_0x15f08e(0xf8)](_0x15f08e(0x11c)+_0x3570ea[_0x15f08e(0x104)]),console[_0x15f08e(0xf8)](_0x15f08e(0xed)+_0x381871));const _0x14b184=await withSpinner('Resolving\x20path\x20\x27'+_0x381871+_0x15f08e(0x105),()=>_0x2f30a2[_0x15f08e(0x120)]['resolvePathToResource'](_0x381871),{'verbose':_0x3570ea[_0x15f08e(0x115)]}),_0x35618c=_0x14b184[_0x15f08e(0x127)];_0x3570ea[_0x15f08e(0x115)]&&(console[_0x15f08e(0xf8)](_0x15f08e(0xff)+_0x35618c[_0x15f08e(0xf0)]),console[_0x15f08e(0xf8)](_0x15f08e(0x121)+_0x35618c[_0x15f08e(0x10d)]),_0x35618c[_0x15f08e(0xf6)]&&console[_0x15f08e(0xf8)](_0x15f08e(0x106)+_0x35618c['folderId']));if(_0x35618c[_0x15f08e(0xf0)]===_0x15f08e(0x120))return console['error'](a38_0x1e9cf8[_0x15f08e(0x119)](_0x15f08e(0xf9))),console[_0x15f08e(0xf8)](_0x15f08e(0xfc)),console[_0x15f08e(0xf8)](a38_0x1e9cf8[_0x15f08e(0x11a)](_0x15f08e(0x110)+_0x35618c['parentName']+(_0x35618c['folderPath']?'/'+_0x35618c[_0x15f08e(0x10b)][_0x15f08e(0x125)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x35618c[_0x15f08e(0x101)],'parent_segment':_0x35618c['parentName']},_0x3e3efb),console[_0x15f08e(0x123)](a38_0x1e9cf8[_0x15f08e(0xfd)]('✔\x20Context\x20set\x20to:\x20'+a38_0x1e9cf8[_0x15f08e(0x11a)](_0x35618c[_0x15f08e(0x101)]))),_0x3570ea['verbose']&&(console[_0x15f08e(0xf8)](a38_0x1e9cf8[_0x15f08e(0xfa)]('Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context')),console[_0x15f08e(0xf8)](a38_0x1e9cf8['dim'](_0x15f08e(0x113)))),0x0;}catch(_0x23ee75){throw _0x23ee75;}}}