@treasuredata/tdx 0.9.2 → 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.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +2 -2
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/client/cdp-api-client.js +1 -1
- package/dist/client/engage-api-client.js +1 -1
- package/dist/client/http-client.js +1 -1
- package/dist/client/llm-api-client.d.ts +86 -1
- package/dist/client/llm-api-client.d.ts.map +1 -1
- package/dist/client/llm-api-client.js +1 -1
- package/dist/client/llm-api-client.js.map +1 -1
- package/dist/client/rate-limiter.js +1 -1
- package/dist/client/td-api-client.js +1 -1
- package/dist/client/trino-api-client.js +1 -1
- package/dist/client/workflow-client.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.d.ts.map +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-command.js.map +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/context-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/index.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/sdk/agent/agent-yaml.d.ts +60 -3
- package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/agent-yaml.js.map +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm.d.ts.map +1 -1
- package/dist/sdk/llm.js +1 -1
- package/dist/sdk/llm.js.map +1 -1
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/workflow.js +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/llm.d.ts +187 -6
- package/dist/types/llm.d.ts.map +1 -1
- package/dist/utils/agent-config.js +1 -1
- package/dist/utils/agent-ref-parser.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/chat-cache.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/command-output.js +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/fields-display.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/format-detector.js +1 -1
- package/dist/utils/formatters.js +1 -1
- package/dist/utils/journey-utils.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/llm-backup-utils.js +1 -1
- package/dist/utils/model-aliases.js +1 -1
- package/dist/utils/model-factors.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/segment-path-parser.js +1 -1
- package/dist/utils/segment-ref-parser.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sql-parser.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-config.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/tree-formatter.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/workflow-utils.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a33_0x35c08b=a33_0x50ef;(function(_0x45974e,_0x1341a8){const _0x8889f9=a33_0x50ef,_0x751cb=_0x45974e();while(!![]){try{const _0x4cd013=parseInt(_0x8889f9(0x1e2))/0x1*(-parseInt(_0x8889f9(0x1de))/0x2)+parseInt(_0x8889f9(0x1fa))/0x3*(parseInt(_0x8889f9(0x1e3))/0x4)+parseInt(_0x8889f9(0x1f8))/0x5*(-parseInt(_0x8889f9(0x1ed))/0x6)+parseInt(_0x8889f9(0x1df))/0x7*(-parseInt(_0x8889f9(0x1f2))/0x8)+-parseInt(_0x8889f9(0x1cc))/0x9+-parseInt(_0x8889f9(0x1cb))/0xa*(-parseInt(_0x8889f9(0x1c5))/0xb)+parseInt(_0x8889f9(0x1c4))/0xc;if(_0x4cd013===_0x1341a8)break;else _0x751cb['push'](_0x751cb['shift']());}catch(_0x444876){_0x751cb['push'](_0x751cb['shift']());}}}(a33_0xbc7f,0x29a6d));import{BaseCommand}from'./command.js';function a33_0x50ef(_0x555855,_0x12fbe0){_0x555855=_0x555855-0x1c1;const _0xbc7f99=a33_0xbc7f();let _0x50ef46=_0xbc7f99[_0x555855];return _0x50ef46;}import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../utils/segment-path-parser.js';import a33_0x246cc4 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a33_0x35c08b(0x1f7)]=a33_0x35c08b(0x1db);[a33_0x35c08b(0x1d6)]=a33_0x35c08b(0x1d1);async[a33_0x35c08b(0x1f1)](_0x1313a8){const _0x41e742=a33_0x35c08b;console[_0x41e742(0x1c9)](a33_0x246cc4[_0x41e742(0x1fc)](_0x41e742(0x1e4))),console[_0x41e742(0x1c9)](a33_0x246cc4[_0x41e742(0x1fc)](_0x41e742(0x1ea)));const {options:_0x356d1c,args:_0x5d57ab,tdx:_0x37809c}=_0x1313a8,_0x4db96b=_0x356d1c;if(_0x5d57ab[_0x41e742(0x1cd)]===0x0)return console[_0x41e742(0x1c9)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x41e742(0x1c9)](_0x41e742(0x1ec)),console[_0x41e742(0x1c9)](_0x41e742(0x1c7)),console[_0x41e742(0x1c9)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x41e742(0x1c9)](_0x41e742(0x1d9)),console[_0x41e742(0x1c9)](_0x41e742(0x1e6)),0x1;const _0xa0f0c0=_0x5d57ab[0x0],_0x3c3c91=_0x356d1c[_0x41e742(0x1c6)];let _0x377949=_0xa0f0c0;_0x3c3c91&&!_0xa0f0c0[_0x41e742(0x1cf)]('/')&&(_0x377949=_0x3c3c91+'/'+_0xa0f0c0,_0x4db96b[_0x41e742(0x1e1)]&&console[_0x41e742(0x1c9)](_0x41e742(0x1fb)+_0x377949));const _0x57cec9=parsePath(_0x377949);if(_0x57cec9[_0x41e742(0x1f0)][_0x41e742(0x1cd)]<0x2)return console[_0x41e742(0x1c9)](_0x41e742(0x1e8)),console['error'](_0x41e742(0x1c1)),0x1;const _0xd33804=_0x57cec9[_0x41e742(0x1f0)][0x0],_0x492cee=getBaseName(_0x377949),_0xd460dc=getParentPath(_0x377949);_0x4db96b[_0x41e742(0x1e1)]&&(console[_0x41e742(0x1c9)](_0x41e742(0x1d4)+_0x4db96b['site']),console['error'](_0x41e742(0x1c8)+_0x377949),console[_0x41e742(0x1c9)](_0x41e742(0x1dc)+_0xd33804),console[_0x41e742(0x1c9)](_0x41e742(0x1e9)+_0x492cee),console[_0x41e742(0x1c9)]('Parent\x20path:\x20'+_0xd460dc));const _0x47fcdf=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xd33804+'\x27...',()=>_0x37809c[_0x41e742(0x1ce)][_0x41e742(0x1d2)](_0xd33804),{'verbose':_0x4db96b[_0x41e742(0x1e1)]}),_0x457bb6=_0x47fcdf[_0x41e742(0x1c2)];let _0x2afd71;if(_0x57cec9[_0x41e742(0x1f0)]['length']>0x2){const _0x10b9a7=await withSpinner(_0x41e742(0x1ca)+_0xd460dc+_0x41e742(0x1da),()=>_0x37809c[_0x41e742(0x1ce)][_0x41e742(0x1d0)](_0xd460dc),{'verbose':_0x4db96b[_0x41e742(0x1e1)]}),_0x1c0b59=_0x10b9a7[_0x41e742(0x1c2)];if(_0x1c0b59[_0x41e742(0x1ee)]!==_0x41e742(0x1d5)&&_0x1c0b59[_0x41e742(0x1ee)]!==_0x41e742(0x1c3))return console[_0x41e742(0x1c9)](_0x41e742(0x1e0)),0x1;_0x2afd71=_0x1c0b59[_0x41e742(0x1e7)];}else{if(_0x4db96b['folder']){const _0x360392=await withSpinner(_0x41e742(0x1d7)+_0x4db96b[_0x41e742(0x1d5)]+'\x27...',()=>_0x37809c[_0x41e742(0x1ce)][_0x41e742(0x1f3)](_0x457bb6,_0x4db96b[_0x41e742(0x1d5)]),{'verbose':_0x4db96b[_0x41e742(0x1e1)]});_0x2afd71=_0x360392[_0x41e742(0x1c2)];}}_0x4db96b[_0x41e742(0x1e1)]&&_0x2afd71&&console[_0x41e742(0x1c9)]('Resolved\x20folder\x20ID:\x20'+_0x2afd71);const _0x57a0f0=await loadJSONFromOptions(_0x4db96b[_0x41e742(0x1eb)],_0x4db96b[_0x41e742(0x1ef)]),_0x19da05={'name':_0x492cee,'description':_0x4db96b[_0x41e742(0x1d6)],'rule':_0x57a0f0,'kind':_0x4db96b[_0x41e742(0x1f4)]!==undefined?parseInt(_0x4db96b[_0x41e742(0x1f4)],0xa):undefined,'isVisible':_0x4db96b[_0x41e742(0x1f5)]?![]:undefined,'segmentFolderId':_0x2afd71,'countPopulation':_0x4db96b[_0x41e742(0x1f9)]?![]:undefined},_0x2d7c6d=await withSpinner(_0x41e742(0x1f6)+_0x492cee+_0x41e742(0x1da),()=>_0x37809c[_0x41e742(0x1ce)][_0x41e742(0x1dd)](_0x457bb6,_0x19da05),{'verbose':_0x4db96b['verbose']}),_0x884783=_0x2d7c6d[_0x41e742(0x1c2)];return console['error'](_0x41e742(0x1d3)+_0x884783[_0x41e742(0x1f7)]+_0x41e742(0x1d8)+_0x884783['id']),_0x377949!==_0xa0f0c0&&console[_0x41e742(0x1c9)](_0x41e742(0x1e5)+_0x377949),await handleSDKOutput([_0x884783],_0x4db96b),0x0;}}function a33_0xbc7f(){const _0x2e2724=['type','ruleFile','segments','execute','88iMaRwa','resolveFolderId','kind','invisible','Creating\x20segment\x20\x27','name','205Qjzozb','noCountPopulation','82623TqOsNv','Resolved\x20relative\x20path\x20to:\x20','yellow','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','data','parent','8373204LvJnxh','11HWdRVs','segmentPath','Examples:','Target\x20path:\x20','error','Resolving\x20folder\x20path\x20\x27','1221430VYWueY','1685340RgVuTx','length','segment','includes','resolvePathToResource','Create\x20child\x20segment\x20with\x20filtering\x20rules','resolveParentId','✔\x20Created\x20segment\x20\x27','Site:\x20','folder','description','Resolving\x20folder\x20\x27','\x27\x20with\x20ID:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','\x27...','segment:create','Parent:\x20','createSegment','2WIEbrL','63119ejvCdB','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','verbose','268290XJouyT','8VMkZTE','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x20\x20\x20Path:\x20','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','folderId','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Segment\x20name:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','rule','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','21900AvTrXY'];a33_0xbc7f=function(){return _0x2e2724;};return a33_0xbc7f();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
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_0x4ce8e6=a35_0x5099;(function(_0x333b29,_0x2fe5f3){const _0x5d90e6=a35_0x5099,_0x2df1ce=_0x333b29();while(!![]){try{const _0x1c21b9=-parseInt(_0x5d90e6(0x110))/0x1+-parseInt(_0x5d90e6(0xe3))/0x2*(parseInt(_0x5d90e6(0xd5))/0x3)+parseInt(_0x5d90e6(0x13d))/0x4*(-parseInt(_0x5d90e6(0x12c))/0x5)+-parseInt(_0x5d90e6(0x128))/0x6+-parseInt(_0x5d90e6(0x122))/0x7*(parseInt(_0x5d90e6(0xdc))/0x8)+parseInt(_0x5d90e6(0x134))/0x9*(parseInt(_0x5d90e6(0xde))/0xa)+parseInt(_0x5d90e6(0xec))/0xb;if(_0x1c21b9===_0x2fe5f3)break;else _0x2df1ce['push'](_0x2df1ce['shift']());}catch(_0x3eaa47){_0x2df1ce['push'](_0x2df1ce['shift']());}}}(a35_0x36a8,0x1c40a));import{BaseCommand}from'./command.js';function a35_0x36a8(){const _0x23e8ee=['620vIZggt','\x0aChanges\x20to\x20\x27','Processing\x20journeys...','dim','audienceId','14030QbeFvF','getActivation','relativePath','\x20versions)','from','values','Fetching\x20activations...','\x20=\x20','Write\x20','7506400xLQgQn','push','\x0aPull\x20summary\x20for\x20\x27','Fetching\x20users\x20for\x20email\x20resolution...','slice','Fetching\x20connections\x20for\x20name\x20resolution...','absolutePath','hasChanges','green','✔\x20Pulled\x20','\x20\x20🗺️\x20\x20','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','\x20changed\x20files','listSegments','content','message','session','Fetching\x20parent\x20segment\x20info...','\x20files\x20to\x20','Aborted.','connection','journeyBundleId','map','Resolving\x20parent\x20segment\x20\x27','parent_segment','\x20\x20Target:\x20','dirname','segment:pull','attributes','all','verbose','cyan','Resolved\x20parent\x20name:\x20','join','journeyBundleName','Parent\x20segment:\x20','183953yylXXV','\x20new\x20files','resolveParentId','diff','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','Found\x20existing\x20tdx.json\x20at:\x20','name','repeat','site','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','isNew','Fetching\x20folders...','Found\x20tdx.json\x20at:\x20','execute','versionNumber','user','has','77NAqIjF','reduce','getJourney','filter','getSegment','Fetching\x20segments...','1181298BMXZHR','yellow','.yml','segmentFolderId','8355GYGCBO','data','journey','rule','relative','\x20activations','kind','listJourneysFromParentSegment','4041dNfMoH','Fetching\x20journey\x20\x27','set','segment','get','✔\x20Context\x20set:\x20','folderId','activation_','buildIdToEmailMap','180YgHRkS','setPhase','Warning:\x20Could\x20not\x20resolve\x20activation\x20','yes','parentFolderId','Using\x20parent\x20segment:\x20','then','Fetching\x20journeys...','getParent','length','listFolders','\x20segments','\x27...','27caDLZJ','buildIdToNameMap','isDirectory','add','red','size','parentSegment','54800VRZvZR','error'];a35_0x36a8=function(){return _0x23e8ee;};return a35_0x36a8();}import{withSpinner,withQuerySpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,createTdxConfigContent,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{saveSessionContext}from'../core/session.js';import{segmentWithActivationsToYaml,segmentToYamlString,apiRuleToYaml,journeyActivationStepToYaml}from'../sdk/segment/child-segment-yaml.js';import{apiToYamlAsync,toYamlString as a35_0x47142e}from'../sdk/segment/journey-yaml.js';import a35_0xfbd8a5 from'chalk';import{existsSync,mkdirSync,readFileSync,writeFileSync,statSync}from'fs';import a35_0xcc50b from'path';import{sanitizeFileName}from'../utils/string-utils.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyYaml,createJumpTargetCache,resolveJumpTarget}from'../utils/journey-utils.js';export class SegmentPullCommand extends BaseCommand{[a35_0x4ce8e6(0x117)]=a35_0x4ce8e6(0x107);['description']=a35_0x4ce8e6(0x115);async[a35_0x4ce8e6(0x11e)](_0x337642){const _0x39628c=a35_0x4ce8e6,{options:_0x303a54,args:_0x4d3291,tdx:_0x193b24}=_0x337642,_0x59a985=_0x303a54,_0xf424e4=_0x303a54[_0x39628c(0xdb)],_0x173ca0=_0x4d3291[0x0],_0x8815e2=findTdxConfigPath();let _0x18b0eb,_0x55a966;if(!_0x173ca0&&_0x8815e2){const _0x2d128a=loadTdxConfig(_0x8815e2);_0x18b0eb=_0x2d128a[_0x39628c(0x104)],_0x55a966=a35_0xcc50b[_0x39628c(0x106)](_0x8815e2),_0x59a985['verbose']&&(console['error'](_0x39628c(0x116)+_0x8815e2),console[_0x39628c(0xdd)](_0x39628c(0xcd)+_0x18b0eb));}else{if(_0x173ca0){if(existsSync(_0x173ca0)&&statSync(_0x173ca0)[_0x39628c(0xd7)]()){const _0xbe4244=findTdxConfigPath(_0x173ca0);if(_0xbe4244){const _0x283601=loadTdxConfig(_0xbe4244);_0x18b0eb=_0x283601['parent_segment'],_0x55a966=a35_0xcc50b[_0x39628c(0x106)](_0xbe4244),_0x59a985[_0x39628c(0x10a)]&&(console[_0x39628c(0xdd)](_0x39628c(0x11d)+_0xbe4244),console['error'](_0x39628c(0xcd)+_0x18b0eb));}else return console['error'](a35_0xfbd8a5[_0x39628c(0xd9)](_0x39628c(0x11a)+_0x173ca0+'\x0a')),console[_0x39628c(0xdd)](a35_0xfbd8a5['cyan'](_0x39628c(0x114))),0x1;}else _0x18b0eb=_0x173ca0;}else _0x18b0eb=_0xf424e4;}if(!_0x18b0eb)return console['error'](a35_0xfbd8a5[_0x39628c(0x129)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console['error']('Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)'),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'),console[_0x39628c(0xdd)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file'),0x1;_0x59a985['verbose']&&(console[_0x39628c(0xdd)]('Site:\x20'+_0x59a985[_0x39628c(0x119)]),console[_0x39628c(0xdd)](_0x39628c(0x10f)+_0x18b0eb));const _0x68b661=await withSpinner(_0x39628c(0x103)+_0x18b0eb+_0x39628c(0xd4),()=>_0x193b24[_0x39628c(0x137)][_0x39628c(0x112)](_0x18b0eb),{'verbose':_0x59a985['verbose']}),_0x376b31=_0x68b661[_0x39628c(0x12d)],_0x323043=await withSpinner(_0x39628c(0xfd),()=>_0x193b24[_0x39628c(0x137)][_0x39628c(0xd0)](_0x376b31),{'verbose':_0x59a985[_0x39628c(0x10a)]}),_0x41a802=_0x323043[_0x39628c(0x12d)]['attributes'][_0x39628c(0x117)];_0x59a985[_0x39628c(0x10a)]&&console[_0x39628c(0xdd)](_0x39628c(0x10c)+_0x41a802);const [_0x3667b9,_0x3dba67,_0x48e37f]=await Promise[_0x39628c(0x109)]([withSpinner(_0x39628c(0x127),()=>_0x193b24[_0x39628c(0x137)][_0x39628c(0xf9)](_0x376b31),{'verbose':_0x59a985[_0x39628c(0x10a)]}),withSpinner(_0x39628c(0x11c),()=>_0x193b24[_0x39628c(0x137)][_0x39628c(0xd2)](_0x376b31),{'verbose':_0x59a985[_0x39628c(0x10a)]}),withSpinner(_0x39628c(0xcf),()=>_0x193b24[_0x39628c(0x12e)][_0x39628c(0x133)](_0x376b31),{'verbose':_0x59a985['verbose']})]),_0x37e804=_0x3667b9[_0x39628c(0x12d)],_0x4c29a5=_0x3dba67[_0x39628c(0x12d)],_0x559698=_0x48e37f[_0x39628c(0x12d)];if(_0x37e804[_0x39628c(0xd1)]===0x0&&_0x559698[_0x39628c(0xd1)]===0x0)return console[_0x39628c(0xdd)](a35_0xfbd8a5[_0x39628c(0x129)](_0x39628c(0xf7)+_0x41a802+'\x27')),0x0;const _0x4bd89e=buildFolderPathMap(_0x4c29a5),_0x3b291f=_0x55a966||getSegmentRootDir(sanitizeFileName(_0x18b0eb)),_0x461ddc=new Map();await withSpinner(_0x39628c(0xe9),async()=>{await batchAsync(_0x37e804,async _0x5b0064=>{const _0x5d564a=a35_0x5099,_0x2c04d4=await _0x193b24['segment']['listActivations'](_0x376b31,_0x5b0064['id']);_0x461ddc[_0x5d564a(0x136)](_0x5b0064['id'],_0x2c04d4);});},{'verbose':_0x59a985[_0x39628c(0x10a)]});const _0x35c75c=await withSpinner(_0x39628c(0xef),()=>_0x193b24[_0x39628c(0x120)][_0x39628c(0x13c)](),{'verbose':_0x59a985[_0x39628c(0x10a)]})[_0x39628c(0xce)](_0x3b91d8=>_0x3b91d8[_0x39628c(0x12d)]),_0x4c52bf=await withSpinner(_0x39628c(0xf1),()=>_0x193b24[_0x39628c(0x100)][_0x39628c(0xd6)](),{'verbose':_0x59a985[_0x39628c(0x10a)]})[_0x39628c(0xce)](_0x42286a=>_0x42286a[_0x39628c(0x12d)]),_0x88912a=[],_0x336d96=a35_0xcc50b[_0x39628c(0x10d)](_0x3b291f,'tdx.json'),_0x1744a8=createTdxConfigContent(_0x41a802);_0x88912a[_0x39628c(0xed)](prepareFile(_0x336d96,_0x1744a8,_0x3b291f));const _0x116c62=new Map();for(const _0x35db49 of _0x37e804){if(_0x35db49[_0x39628c(0x132)]===SEGMENT_KIND_JOURNEY)continue;const _0x3b61b3=_0x35db49[_0x39628c(0x12b)]?_0x4bd89e['get'](_0x35db49[_0x39628c(0x12b)])||'':'',_0x2984f0=_0x461ddc[_0x39628c(0x138)](_0x35db49['id'])||[],_0x383fd3=segmentWithActivationsToYaml(_0x35db49,_0x2984f0,undefined,_0x35c75c,_0x4c52bf),_0x49f958=_0x3b61b3?a35_0xcc50b['join'](_0x3b291f,_0x3b61b3):_0x3b291f,_0x43c206=sanitizeFileName(_0x35db49['name']),_0x383114=getUniqueFileName(_0x49f958,_0x43c206,_0x116c62),_0x1f7bb2=a35_0xcc50b[_0x39628c(0x10d)](_0x49f958,_0x383114+_0x39628c(0x12a)),_0x8e3b7a=segmentToYamlString(_0x383fd3);_0x88912a[_0x39628c(0xed)](prepareFile(_0x1f7bb2,_0x8e3b7a,_0x3b291f));}const _0x3548db=new Map();for(const _0x2efabf of _0x37e804){_0x3548db[_0x39628c(0x136)](_0x2efabf['id'],_0x2efabf);}const _0x52064b=new Map();for(const _0x5bdfd9 of _0x559698){const _0x2436b6=_0x5bdfd9[_0x39628c(0x101)];!_0x52064b[_0x39628c(0x121)](_0x2436b6)&&_0x52064b['set'](_0x2436b6,[]),_0x52064b[_0x39628c(0x138)](_0x2436b6)[_0x39628c(0xed)](_0x5bdfd9);}for(const _0x451266 of _0x52064b[_0x39628c(0xe8)]()){_0x451266['sort']((_0x455105,_0x115c3f)=>(_0x455105[_0x39628c(0x11f)]||0x0)-(_0x115c3f[_0x39628c(0x11f)]||0x0));}const _0xa6b712=()=>{const _0x578807=_0x39628c,_0xc62911=new Set(),_0x3ba5ed=new Set(),_0x58eb03=new Map(),_0x123f34=new Map(),_0x50606e=createJumpTargetCache(),_0x3dd2b2=(_0x2fbe67,_0x2fd627)=>({'resolveSegment':async _0x4cb330=>{const _0x26033e=a35_0x5099,_0x3a8265=_0x58eb03[_0x26033e(0x138)](_0x4cb330);if(_0x3a8265!==undefined)return{'name':_0x3a8265,'isJourneyLocal':!![]};if(!_0x2fd627)return{'name':_0x4cb330,'isJourneyLocal':![]};try{let _0x5f3645=_0x3548db[_0x26033e(0x138)](_0x4cb330);!_0x5f3645&&(_0x5f3645=await _0x193b24[_0x26033e(0x137)][_0x26033e(0x126)](_0x2fd627,_0x4cb330));const _0x5a67a8=generateJourneyLocalName(_0x5f3645[_0x26033e(0x117)]),_0x511693=_0x5f3645[_0x26033e(0x132)]===SEGMENT_KIND_JOURNEY&&_0x5a67a8!==undefined;let _0x4934fc=_0x5f3645[_0x26033e(0x117)];if(_0x511693&&_0x5a67a8){let _0xcbaa8e=_0x5a67a8,_0xedbb7a=0x2;while(_0xc62911['has'](_0xcbaa8e)){_0xcbaa8e=_0x5a67a8+'_'+_0xedbb7a,_0xedbb7a++;}_0xc62911[_0x26033e(0xd8)](_0xcbaa8e),_0x4934fc=_0xcbaa8e,_0x58eb03[_0x26033e(0x136)](_0x4cb330,_0x4934fc);}let _0x12e6c9;return _0x511693&&_0x5f3645[_0x26033e(0x12f)]&&(_0x12e6c9={'description':_0x5f3645['description'],'rule':apiRuleToYaml(_0x5f3645[_0x26033e(0x12f)])}),{'name':_0x4934fc,'isJourneyLocal':_0x511693,'definition':_0x12e6c9};}catch(_0x7f9530){return _0x59a985[_0x26033e(0x10a)]&&console[_0x26033e(0xdd)]('Warning:\x20Could\x20not\x20resolve\x20segment\x20'+_0x4cb330+':\x20'+_0x7f9530[_0x26033e(0xfb)]),{'name':_0x4cb330,'isJourneyLocal':![]};}},'resolveActivation':async _0x58e17c=>{const _0xdeca34=a35_0x5099,_0x164d6a=_0x123f34[_0xdeca34(0x138)](_0x58e17c);if(_0x164d6a!==undefined)return{'name':_0x164d6a,'isJourneyLocal':!![]};try{const _0xeef562=await _0x193b24['journey'][_0xdeca34(0xe4)](_0x2fbe67,_0x58e17c),_0x5c284=_0xeef562['attributes']['activationParams']['name']||_0x58e17c,_0x49d233=sanitizeYamlKey(_0x5c284)||_0xdeca34(0x13b)+_0x58e17c;let _0xf478a8=_0x49d233,_0xff83c2=0x2;while(_0x3ba5ed[_0xdeca34(0x121)](_0xf478a8)){_0xf478a8=_0x49d233+'_'+_0xff83c2,_0xff83c2++;}_0x3ba5ed[_0xdeca34(0xd8)](_0xf478a8),_0x123f34[_0xdeca34(0x136)](_0x58e17c,_0xf478a8);const _0x1d4f70=journeyActivationStepToYaml(_0xeef562,_0x35c75c,_0x4c52bf);return{'name':_0xf478a8,'isJourneyLocal':!![],'definition':_0x1d4f70};}catch(_0x2481e7){return _0x59a985['verbose']&&console[_0xdeca34(0xdd)](_0xdeca34(0xca)+_0x58e17c+':\x20'+_0x2481e7[_0xdeca34(0xfb)]),{'name':_0x58e17c,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x49cb66,_0x299b70)=>resolveJumpTarget(_0x49cb66,_0x299b70,_0x50606e,_0x152a8d=>_0x193b24[_0x578807(0x12e)][_0x578807(0x124)](_0x152a8d))});return{'createYamlContext':_0x3dd2b2};};if(_0x52064b[_0x39628c(0xda)]>0x0){const _0x52dbd1=Array[_0x39628c(0xe7)](_0x52064b[_0x39628c(0xe8)]()),_0x11fae5=await withQuerySpinner(_0x39628c(0xe0),async _0x3984b8=>{const _0x45ad68=_0x39628c,_0x4de842=[];let _0x5e65f2=0x0;const _0x5d282f=0x5;for(let _0x4f923a=0x0;_0x4f923a<_0x52dbd1['length'];_0x4f923a+=_0x5d282f){const _0x30d367=_0x52dbd1[_0x45ad68(0xf0)](_0x4f923a,_0x4f923a+_0x5d282f),_0x2e7da5=await Promise[_0x45ad68(0x109)](_0x30d367[_0x45ad68(0x102)](async _0x4696db=>{const _0x23460f=_0x45ad68,_0x23bdc1=_0x4696db[0x0],_0x8aa522=_0x23bdc1[_0x23460f(0x10e)];_0x3984b8[_0x23460f(0x13e)](_0x23460f(0x135)+_0x8aa522+'\x27');const _0x330172=_0x23bdc1['folderId']?_0x4bd89e[_0x23460f(0x138)](_0x23bdc1[_0x23460f(0x13a)])||'':'',{createYamlContext:_0x48eca1}=_0xa6b712(),_0x4c6e56=[];for(const _0x380963 of _0x4696db){const _0x186d02=await _0x193b24[_0x23460f(0x12e)][_0x23460f(0x124)](_0x380963['id']),_0x128346=_0x186d02[_0x23460f(0x108)]?.[_0x23460f(0xe2)],_0x206c4e=_0x48eca1(_0x380963['id'],_0x128346),_0x5d19a0=await apiToYamlAsync(_0x186d02,_0x206c4e);_0x4c6e56[_0x23460f(0xed)]({'item':_0x380963,'yaml':_0x5d19a0});}let _0x4fd681;return _0x4c6e56[_0x23460f(0xd1)]===0x1?_0x4fd681=_0x4c6e56[0x0]['yaml']:_0x4fd681=buildMergedJourneyYaml(_0x4c6e56),{'bundleName':_0x8aa522,'folderPath':_0x330172,'finalYaml':_0x4fd681};}));_0x4de842[_0x45ad68(0xed)](..._0x2e7da5),_0x5e65f2+=_0x30d367[_0x45ad68(0xd1)],_0x3984b8['setExtra']('('+_0x5e65f2+'/'+_0x52dbd1[_0x45ad68(0xd1)]+')');}return _0x4de842;},{'verbose':_0x59a985[_0x39628c(0x10a)]});for(const {bundleName:_0x268da3,folderPath:_0x4bf847,finalYaml:_0x29e6ff}of _0x11fae5[_0x39628c(0x12d)]){const _0x162e1f=a35_0x47142e(_0x29e6ff),_0x2fd7ec=_0x4bf847?a35_0xcc50b[_0x39628c(0x10d)](_0x3b291f,_0x4bf847):_0x3b291f,_0x879c17=sanitizeFileName(_0x268da3),_0x8ade7d=getUniqueFileName(_0x2fd7ec,_0x879c17,_0x116c62),_0x5af314=a35_0xcc50b[_0x39628c(0x10d)](_0x2fd7ec,_0x8ade7d+'.yml');_0x88912a[_0x39628c(0xed)](prepareFile(_0x5af314,_0x162e1f,_0x3b291f));}}const _0x9ce939=Array[_0x39628c(0xe7)](_0x461ddc['values']())[_0x39628c(0x123)]((_0x5a5bbe,_0x1f48ef)=>_0x5a5bbe+_0x1f48ef['length'],0x0),_0x2c5fae=_0x88912a['filter'](_0x2fa82a=>_0x2fa82a['isNew']),_0x475f2d=_0x88912a[_0x39628c(0x125)](_0x7c78a5=>!_0x7c78a5['isNew']&&_0x7c78a5[_0x39628c(0xf3)]),_0x286af4=_0x88912a[_0x39628c(0x125)](_0x26bc5f=>!_0x26bc5f['isNew']&&!_0x26bc5f[_0x39628c(0xf3)]),_0x481cb7=_0x37e804[_0x39628c(0x125)](_0x5863c3=>_0x5863c3[_0x39628c(0x132)]!==SEGMENT_KIND_JOURNEY);console['error'](_0x39628c(0xee)+_0x41a802+'\x27:'),console[_0x39628c(0xdd)]('\x20\x20🎯\x20'+a35_0xfbd8a5[_0x39628c(0x10b)](_0x481cb7[_0x39628c(0xd1)]+_0x39628c(0xd3))+'\x20with\x20'+a35_0xfbd8a5['cyan'](_0x9ce939+_0x39628c(0x131)));if(_0x52064b['size']>0x0){const _0x561958=_0x559698[_0x39628c(0xd1)],_0x31f28b=_0x52064b[_0x39628c(0xda)],_0x33eced=_0x561958>_0x31f28b?'\x20('+_0x561958+_0x39628c(0xe6):'';console['error'](_0x39628c(0xf6)+a35_0xfbd8a5['cyan'](_0x31f28b+'\x20journeys')+a35_0xfbd8a5[_0x39628c(0xe1)](_0x33eced));}console[_0x39628c(0xdd)]('\x20\x20'+a35_0xfbd8a5['green']('+\x20'+_0x2c5fae['length']+_0x39628c(0x111))),console[_0x39628c(0xdd)]('\x20\x20'+a35_0xfbd8a5[_0x39628c(0x129)]('~\x20'+_0x475f2d['length']+_0x39628c(0xf8))),console[_0x39628c(0xdd)]('\x20\x20'+a35_0xfbd8a5['dim']('=\x20'+_0x286af4[_0x39628c(0xd1)]+'\x20unchanged\x20files')),console[_0x39628c(0xdd)](_0x39628c(0x105)+a35_0xfbd8a5[_0x39628c(0x10b)](_0x3b291f)+'\x0a');if(_0x475f2d['length']>0x0)for(const _0x2116eb of _0x475f2d){console[_0x39628c(0xdd)](_0x39628c(0xdf)+_0x2116eb[_0x39628c(0xe5)]+'\x27:'),console[_0x39628c(0xdd)]('─'[_0x39628c(0x118)](0x3c)),console['error'](_0x2116eb[_0x39628c(0x113)]),console[_0x39628c(0xdd)]('─'[_0x39628c(0x118)](0x3c));}if(_0x59a985['dryRun'])return console[_0x39628c(0xdd)](a35_0xfbd8a5[_0x39628c(0x129)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x2c5fae['length']===0x0&&_0x475f2d['length']===0x0)return console['error'](a35_0xfbd8a5[_0x39628c(0xf4)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x41a802},_0x59a985[_0x39628c(0xfc)]),console[_0x39628c(0xdd)](a35_0xfbd8a5['green'](_0x39628c(0x139)+a35_0xfbd8a5[_0x39628c(0xe1)](_0x39628c(0x104))+'\x20=\x20'+a35_0xfbd8a5['cyan'](_0x41a802))),0x0;if(!_0x59a985[_0x39628c(0xcb)]&&(_0x2c5fae['length']>0x0||_0x475f2d[_0x39628c(0xd1)]>0x0)){const _0x34f860=await confirmKey(_0x39628c(0xeb)+(_0x2c5fae[_0x39628c(0xd1)]+_0x475f2d[_0x39628c(0xd1)])+'\x20files?');if(!_0x34f860)return console[_0x39628c(0xdd)](_0x39628c(0xff)),0x1;}for(const _0x3830a9 of _0x88912a){if(_0x3830a9[_0x39628c(0x11b)]||_0x3830a9[_0x39628c(0xf3)]){const _0x476791=a35_0xcc50b[_0x39628c(0x106)](_0x3830a9[_0x39628c(0xf2)]);!existsSync(_0x476791)&&mkdirSync(_0x476791,{'recursive':!![]}),writeFileSync(_0x3830a9[_0x39628c(0xf2)],_0x3830a9[_0x39628c(0xfa)],'utf-8');}}return console[_0x39628c(0xdd)](a35_0xfbd8a5[_0x39628c(0xf4)](_0x39628c(0xf5)+(_0x2c5fae[_0x39628c(0xd1)]+_0x475f2d[_0x39628c(0xd1)])+_0x39628c(0xfe)+_0x3b291f)),saveSessionContext({'parent_segment':_0x41a802},_0x59a985[_0x39628c(0xfc)]),console[_0x39628c(0xdd)](a35_0xfbd8a5[_0x39628c(0xf4)](_0x39628c(0x139)+a35_0xfbd8a5['dim']('parent_segment')+_0x39628c(0xea)+a35_0xfbd8a5[_0x39628c(0x10b)](_0x41a802))),0x0;}}function buildFolderPathMap(_0xf66468){const _0x4d2a01=a35_0x4ce8e6,_0x21e9ce=new Map(),_0x227958=new Map();for(const _0x22b820 of _0xf66468){_0x227958[_0x4d2a01(0x136)](_0x22b820['id'],_0x22b820);}const _0x7c0adf=new Set();for(const _0x42b7f2 of _0xf66468){!_0x42b7f2[_0x4d2a01(0xcc)]&&_0x7c0adf[_0x4d2a01(0xd8)](_0x42b7f2['id']);}function _0x33da6d(_0x515843){const _0x111a66=_0x4d2a01;if(_0x21e9ce['has'](_0x515843['id']))return _0x21e9ce[_0x111a66(0x138)](_0x515843['id']);if(_0x7c0adf[_0x111a66(0x121)](_0x515843['id']))return _0x21e9ce['set'](_0x515843['id'],''),'';if(_0x515843[_0x111a66(0xcc)]){const _0x21b23b=_0x227958[_0x111a66(0x138)](_0x515843['parentFolderId']);if(_0x21b23b){const _0x479a50=_0x33da6d(_0x21b23b),_0x45c058=_0x479a50?_0x479a50+'/'+_0x515843['name']:_0x515843[_0x111a66(0x117)];return _0x21e9ce['set'](_0x515843['id'],_0x45c058),_0x45c058;}}const _0xadb9e6=_0x515843[_0x111a66(0x117)];return _0x21e9ce['set'](_0x515843['id'],_0xadb9e6),_0xadb9e6;}for(const _0x53f881 of _0xf66468){_0x33da6d(_0x53f881);}return _0x21e9ce;}function getUniqueFileName(_0x4ea139,_0x19acea,_0x355d9e){const _0x5ed605=a35_0x4ce8e6,_0x5a33f9=_0x4ea139+':'+_0x19acea,_0x4e0d5e=_0x355d9e['get'](_0x5a33f9)||0x0;_0x355d9e[_0x5ed605(0x136)](_0x5a33f9,_0x4e0d5e+0x1);if(_0x4e0d5e===0x0)return _0x19acea;return _0x19acea+'-'+_0x4e0d5e;}function a35_0x5099(_0x47ca84,_0x32bab4){_0x47ca84=_0x47ca84-0xca;const _0x36a88b=a35_0x36a8();let _0x509929=_0x36a88b[_0x47ca84];return _0x509929;}function prepareFile(_0x22403b,_0x59c545,_0x467266){const _0x2d4562=a35_0x4ce8e6,_0x352516=a35_0xcc50b[_0x2d4562(0x130)](_0x467266,_0x22403b);if(existsSync(_0x22403b)){const _0x2a2736=readFileSync(_0x22403b,'utf-8'),_0x50c265=generateDiff(_0x2a2736,_0x59c545),_0x2737bd=hasChanges(_0x50c265);return{'relativePath':_0x352516,'absolutePath':_0x22403b,'content':_0x59c545,'isNew':![],'hasChanges':_0x2737bd,'diff':_0x2737bd?formatDiffWithColors(_0x50c265):undefined};}return{'relativePath':_0x352516,'absolutePath':_0x22403b,'content':_0x59c545,'isNew':!![],'hasChanges':![]};}
|
|
1
|
+
const a35_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_0x59c5e1=a36_0x2d4a;(function(_0x485bd3,_0x6afa23){const _0x54ad50=a36_0x2d4a,_0x3748e3=_0x485bd3();while(!![]){try{const _0x3dea59=-parseInt(_0x54ad50(0x1f7))/0x1*(parseInt(_0x54ad50(0x1ff))/0x2)+parseInt(_0x54ad50(0x200))/0x3+-parseInt(_0x54ad50(0x1dd))/0x4*(-parseInt(_0x54ad50(0x174))/0x5)+parseInt(_0x54ad50(0x178))/0x6*(parseInt(_0x54ad50(0x221))/0x7)+parseInt(_0x54ad50(0x25c))/0x8*(parseInt(_0x54ad50(0x206))/0x9)+parseInt(_0x54ad50(0x1cc))/0xa*(parseInt(_0x54ad50(0x1ee))/0xb)+-parseInt(_0x54ad50(0x1fa))/0xc*(parseInt(_0x54ad50(0x186))/0xd);if(_0x3dea59===_0x6afa23)break;else _0x3748e3['push'](_0x3748e3['shift']());}catch(_0x2edb0a){_0x3748e3['push'](_0x3748e3['shift']());}}}(a36_0x3691,0xa97b2));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode,isHttp400Error,getErrorMessage}from'../sdk/errors.js';import{withSpinner,withQuerySpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,findTdxConfig}from'../utils/tdx-config.js';import{segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,yamlToCreateRequest,yamlToUpdateRequest,yamlActivationToCreateRequest,yamlActivationToUpdateRequest,journeyActivationStepToYaml,activationToYaml,apiRuleToYaml,yamlRuleToApi}from'../sdk/segment/child-segment-yaml.js';import{isJourneyYaml,parseYamlString as a36_0x2e896f,yamlToApi as a36_0x18f4eb,toYamlString as a36_0x2783fc,apiToYamlAsync,hasMultipleVersions,normalizeJourneyYaml}from'../sdk/segment/journey-yaml.js';import a36_0x54932d from'chalk';import{existsSync,readFileSync,statSync,readdirSync}from'fs';import a36_0x475838 from'path';import{getConsoleNextUrl}from'../types/endpoints.js';function a36_0x2d4a(_0x33ab24,_0x201696){_0x33ab24=_0x33ab24-0x169;const _0x3691bc=a36_0x3691();let _0x2d4a1f=_0x3691bc[_0x33ab24];return _0x2d4a1f;}import*as a36_0x147f4c from'yaml';import{sanitizeFileName}from'../utils/string-utils.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyYaml,createJumpTargetCache,resolveJumpTarget}from'../utils/journey-utils.js';const PENDING_SEGMENT_PREFIX='__pending_';function createPendingSegmentId(_0x5e5212){return''+PENDING_SEGMENT_PREFIX+_0x5e5212+'__';}function isPendingSegmentId(_0x30872e){return _0x30872e['startsWith'](PENDING_SEGMENT_PREFIX);}function extractPendingSegmentName(_0x3d8be3){return _0x3d8be3['replace'](/^__pending_(.+)__$/,'$1');}const PENDING_ACTIVATION_PREFIX=a36_0x59c5e1(0x257);function createPendingActivationId(_0x59c9b7){return''+PENDING_ACTIVATION_PREFIX+_0x59c9b7+'__';}function isPendingActivationId(_0x6b4358){const _0x530571=a36_0x59c5e1;return _0x6b4358[_0x530571(0x19c)](PENDING_ACTIVATION_PREFIX);}function extractPendingActivationName(_0x19ee40){const _0x1257d3=a36_0x59c5e1;return _0x19ee40[_0x1257d3(0x1d6)](/^__pending_act_(.+)__$/,'$1');}function ensureJourneyDefaults(_0x3b2f15){const _0x53017e=a36_0x59c5e1;!_0x3b2f15['description']&&(_0x3b2f15['description']=''),!_0x3b2f15[_0x53017e(0x1aa)]&&(_0x3b2f15[_0x53017e(0x1aa)]=_0x53017e(0x198));}function tryFindTdxConfig(_0x506458){try{return findTdxConfig(_0x506458);}catch{return null;}}function resolveTDFolderPath(_0x53f5ca,_0x597af2,_0x35abfc){if(!_0x597af2)return _0x53f5ca;return _0x53f5ca?_0x35abfc+'/'+_0x53f5ca:_0x35abfc;}function a36_0x3691(){const _0x3918b4=['toLowerCase','parse','8198508RCKOZn','name','\x20changed','existingSegment','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','dirname','parent_segment','folderPath','Creating\x20folder\x20\x27','Deleting\x20segment\x20\x27','\x20journey\x20from\x20file:\x20','Updating','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','Updating\x20activation\x20\x27','12116130yIajdy','Changes\x20to:','getJourney','get','buildUserMaps','Error\x20parsing\x20','resolve','\x20activation\x20\x27','Failed\x20to\x20','values','then','Parent\x20segment:\x20','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','entries','attributes','\x20created','\x20to\x20delete','all','draft','entry_criteria','deleteSegment','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','startsWith','connection','\x20\x20Step\x203:\x20Updating\x20journey\x20with\x20entry\x20criteria\x20and\x20activation\x20IDs:\x20','config','Activation','repeat','push','New\x20segment:','absolutePath','SEGMENT_UPDATE_ERROR','delete','\x20\x20Step\x202b:\x20Creating\x20embedded\x20activation\x20\x27','isFile','✔\x20Created\x20segment\x20\x27','state','\x27\x20details...','INTERNAL','listActivations','yamlActivation','join','map','versionNumber','\x20\x20✔\x20Updated\x20activation\x20\x27','(Journey\x20will\x20be\x20deleted)','length','\x20deleted','cwd','steps','\x20\x20Created\x20embedded\x20segment\x20\x27','relative','Segment\x20not\x20found:\x20','data','yes','/e/','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','existingJourney','site','\x27...','\x20\x20Activations:','ACTIVATION_SYNTAX_ERROR','blue','\x27:\x20','green','item','folderId','.yml','/j/da/je','\x20\x20Step\x201:\x20Creating\x20journey\x20without\x20entry\x20criteria:\x20','180lhVFjD','yellow','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','\x20new','Fetching\x20parent\x20segment\x20details...','configDir','diff','JOURNEY_SYNTAX_ERROR','setPhase','cyan','replace',')\x20with\x20ID:\x20','sort','Activation\x20not\x20found:\x20','\x20activations]',')\x20with\x20journeyId:\x20','Scoped\x20to\x20folder:\x20','4kIABuP','relationships','\x0aPush\x20summary\x20for\x20\x27','updated','journey','Folders\x20to\x20create:','SEGMENT_NOT_FOUND','\x20\x20Step\x202:\x20Creating\x20embedded\x20segment\x20\x27','activationActions','\x20\x20Journey\x20API\x20request:\x20','segment','Failed\x20to\x20create\x20embedded\x20activation\x20\x27','listSegments','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','Failed\x20to\x20create\x20embedded\x20segment\x20\x27','Creating\x20segment\x20\x27','Stage\x20\x27','609323qLSNAN','\x20unchanged','\x20\x20🗺️\x20\x20Journeys:','updateSegmentById','activations','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','DecisionPoint','✔\x20Deleted\x20segment\x20\x27','action','462594lPQzKp','parentSegment','verbose','48nhDMpd','slice','.yaml','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','\x27\x20v','4aiNxrC','1796772kJArmT','...','yamlConfig','existingActivation','entryCriteria','journeyBundleName','12159387ZvrihF','\x20journey\x20\x27','buildIdToNameMap','New\x20journey:','created','createJourneySegment','rule','Pushing\x20journeys...','isNew','journeysOnly','toString','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','Fetching\x20existing\x20folders...','\x20segment\x20from\x20file:\x20','entry','createFolder','find','Push\x20','Fetching\x20existing\x20journeys...','listFolders','set','\x20\x20Segments:\x20','filter','keys','execute','has','error','7UFDNRv','\x27\x20with\x20ID:\x20','Source\x20directory:\x20','resolveJourneyId','red','create','setExtra','\x20\x20✔\x20Created\x20activation\x20\x27','\x20folders\x20to\x20create','ACTIVATION_UPDATE_ERROR','createActivation','isDirectory','Fetching\x20journey\x20\x27','Resolving\x20parent\x20segment\x20\x27','NOT_FOUND','Site:\x20','type','add','\x20\x20Created\x20embedded\x20activation\x20\x27',').\x20','parentFolderId','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','journeyStages','\x20changes?','split','Delete\x20journey:','\x20to\x20create','branches','description','parentSegmentFolder','size','✔\x20Updated\x20journey\x20\x27','folder','\x20updated','Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)','randomUUID','stringify','stages','dryRun','✔\x20Created\x20journey\x20\x27','journeyActivationStepId','update','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','SEGMENT_SYNTAX_ERROR','getActivation','\x20\x20\x20\x20','kind','journey_entry_criteria_','segmentId','📁\x20','\x0a✔\x20Push\x20complete','\x27\x20from\x20file:\x20','hasChanges','__pending_act_','Aborted.','\x27\x20not\x20found\x20in\x20journey\x20\x27','user','unchanged','8oCztjH','Entry\x20criteria:\x20','Changes\x20to\x20journey:','Fetching\x20existing\x20activations...','JOURNEY_UPDATE_ERROR','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','journeyId','\x20\x20Journeys:\x20','\x27\x20(internal:\x20','activationParams','Fetching\x20users\x20for\x20email\x20resolution...','flatMap','createSegment','dim','segmentFolderId','getParent','\x20\x20✔\x20Deleted\x20activation\x20\x27','✔\x20Created\x20folder\x20\x27','\x20YAML\x20files\x20found','5169815VllwdB','endsWith'];a36_0x3691=function(){return _0x3918b4;};return a36_0x3691();}export class SegmentPushCommand extends BaseCommand{[a36_0x59c5e1(0x179)]='segment:push';['description']=a36_0x59c5e1(0x237);async[a36_0x59c5e1(0x21e)](_0x322d10){const _0x25e0ba=a36_0x59c5e1,{options:_0x164202,args:_0x506602,tdx:_0x5793b9}=_0x322d10,_0x9a1cc5=_0x164202,_0x5092b0=_0x164202[_0x25e0ba(0x1f8)],_0x287eb2=_0x506602[0x0];let _0x1e93f0,_0x2c65d3,_0x4177a9,_0x24ed3e;if(_0x287eb2){if(existsSync(_0x287eb2)&&statSync(_0x287eb2)[_0x25e0ba(0x22c)]()){const _0x5b04e1=tryFindTdxConfig(_0x287eb2);if(_0x5b04e1)_0x1e93f0=_0x5b04e1[_0x25e0ba(0x19f)][_0x25e0ba(0x17e)],_0x2c65d3=_0x287eb2,_0x4177a9=_0x5b04e1[_0x25e0ba(0x1d1)];else return console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x225)](_0x25e0ba(0x1fd)+_0x287eb2+'\x0a')),console[_0x25e0ba(0x220)](a36_0x54932d['cyan'](_0x25e0ba(0x236))),0x1;}else{if(existsSync(_0x287eb2)&&statSync(_0x287eb2)[_0x25e0ba(0x1a8)]()){const _0x2719cd=a36_0x475838['dirname'](_0x287eb2),_0xdccf5e=tryFindTdxConfig(_0x2719cd);if(_0xdccf5e)_0x1e93f0=_0xdccf5e[_0x25e0ba(0x19f)][_0x25e0ba(0x17e)],_0x4177a9=_0xdccf5e[_0x25e0ba(0x1d1)],_0x2c65d3=_0xdccf5e[_0x25e0ba(0x1d1)],_0x24ed3e=a36_0x475838[_0x25e0ba(0x18c)](_0x287eb2);else return console['error'](a36_0x54932d['red'](_0x25e0ba(0x1fd)+_0x2719cd+'\x0a')),console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x1d5)](_0x25e0ba(0x236))),0x1;}else _0x1e93f0=_0x287eb2;}}else{const _0x48fcaa=tryFindTdxConfig(process[_0x25e0ba(0x1b6)]());_0x48fcaa?(_0x1e93f0=_0x48fcaa['config']['parent_segment'],_0x2c65d3=process['cwd'](),_0x4177a9=_0x48fcaa[_0x25e0ba(0x1d1)]):_0x1e93f0=_0x5092b0;}if(!_0x1e93f0)return console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x1cd)](_0x25e0ba(0x17c))),console[_0x25e0ba(0x220)](_0x25e0ba(0x244)),console[_0x25e0ba(0x220)](_0x25e0ba(0x1ce)),console[_0x25e0ba(0x220)](_0x25e0ba(0x184)),0x1;const _0x59c816=_0x2c65d3||getSegmentRootDir(sanitizeFileName(_0x1e93f0)),_0x4fcb86=_0x4177a9||_0x59c816,_0x1bda42=a36_0x475838['relative'](_0x4fcb86,_0x59c816),_0xab46ba=_0x1bda42!==''&&_0x1bda42!=='.';if(!existsSync(_0x59c816))return console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x225)]('Error:\x20Directory\x20not\x20found:\x20'+_0x59c816+'\x0a')),console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x1d5)](_0x25e0ba(0x236))),0x1;_0x9a1cc5['verbose']&&(console[_0x25e0ba(0x220)](_0x25e0ba(0x230)+_0x9a1cc5[_0x25e0ba(0x1c0)]),console[_0x25e0ba(0x220)](_0x25e0ba(0x191)+_0x1e93f0),console[_0x25e0ba(0x220)](_0x25e0ba(0x223)+_0x59c816),_0xab46ba&&console[_0x25e0ba(0x220)](_0x25e0ba(0x1dc)+_0x1bda42));const _0x598751=await withSpinner(_0x25e0ba(0x22e)+_0x1e93f0+_0x25e0ba(0x1c1),()=>_0x5793b9[_0x25e0ba(0x1e7)]['resolveParentId'](_0x1e93f0),{'verbose':_0x9a1cc5[_0x25e0ba(0x1f9)]}),_0x2d104e=_0x598751[_0x25e0ba(0x1bb)],[_0x2a80fa,_0x2c4945,_0x41105e,_0x282fd3,_0x1b40b1]=await Promise['all']([withSpinner(_0x25e0ba(0x1d0),()=>_0x5793b9[_0x25e0ba(0x1e7)][_0x25e0ba(0x170)](_0x2d104e),{'verbose':_0x9a1cc5[_0x25e0ba(0x1f9)]}),withSpinner('Fetching\x20existing\x20segments...',()=>_0x5793b9[_0x25e0ba(0x1e7)][_0x25e0ba(0x1e9)](_0x2d104e),{'verbose':_0x9a1cc5['verbose']}),withSpinner(_0x25e0ba(0x212),()=>_0x5793b9[_0x25e0ba(0x1e7)][_0x25e0ba(0x219)](_0x2d104e),{'verbose':_0x9a1cc5['verbose']}),withSpinner(_0x25e0ba(0x218),()=>_0x5793b9[_0x25e0ba(0x1e1)]['listJourneysFromParentSegment'](_0x2d104e),{'verbose':_0x9a1cc5['verbose']}),withSpinner(_0x25e0ba(0x16b),()=>_0x5793b9[_0x25e0ba(0x25a)][_0x25e0ba(0x18a)](),{'verbose':_0x9a1cc5[_0x25e0ba(0x1f9)]})[_0x25e0ba(0x190)](_0x171c0d=>_0x171c0d[_0x25e0ba(0x1bb)])]),_0x24c2fd=_0x2a80fa[_0x25e0ba(0x1bb)],_0x17d9ba=_0x24c2fd[_0x25e0ba(0x1de)]?.[_0x25e0ba(0x23f)]?.[_0x25e0ba(0x1bb)]?.['id']||_0x24c2fd[_0x25e0ba(0x1de)]?.['parentFolder']?.[_0x25e0ba(0x1bb)]?.['id'],_0xfee852=_0x2c4945[_0x25e0ba(0x1bb)],_0x3df1cf=_0x41105e[_0x25e0ba(0x1bb)],_0x5e662c=_0x282fd3[_0x25e0ba(0x1bb)],{emailToId:_0x1516f5,idToEmail:_0x464344}=_0x1b40b1,[_0x5b7934,_0x502bc7]=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',async()=>{const _0x16fe6a=_0x25e0ba,[_0x3267ae,_0x56938c]=await Promise[_0x16fe6a(0x197)]([_0x5793b9[_0x16fe6a(0x19d)]['buildNameToIdMap'](),_0x5793b9[_0x16fe6a(0x19d)][_0x16fe6a(0x208)]()]);return[_0x3267ae,_0x56938c];},{'verbose':_0x9a1cc5[_0x25e0ba(0x1f9)]})[_0x25e0ba(0x190)](_0x2cbe5e=>_0x2cbe5e['data']),_0x2ac595=buildFolderPathToIdMap(_0x3df1cf),_0x22d65e=new Map();for(const [_0xaad2c1,_0x121047]of _0x2ac595[_0x25e0ba(0x193)]()){_0x22d65e[_0x25e0ba(0x21a)](_0x121047,_0xaad2c1);}const _0x4e2e0d=new Map();for(const _0x583b74 of _0xfee852){const _0x451a57=_0x583b74[_0x25e0ba(0x16f)]?_0x22d65e['get'](_0x583b74[_0x25e0ba(0x16f)]['toString']())||'':'',_0x1c70b8=_0x451a57+':'+_0x583b74[_0x25e0ba(0x179)];_0x4e2e0d[_0x25e0ba(0x21a)](_0x1c70b8,_0x583b74);}const _0x10252d=new Map();for(const _0x5e0d40 of _0xfee852){_0x10252d['set'](_0x5e0d40[_0x25e0ba(0x179)],_0x5e0d40['id']);}const _0x2ae488=new Map();for(const _0x4c44e6 of _0x5e662c){const _0x398286=_0x4c44e6['folderId']?_0x22d65e[_0x25e0ba(0x189)](_0x4c44e6[_0x25e0ba(0x1c8)])||'':'',_0x11a443=_0x398286+':'+_0x4c44e6[_0x25e0ba(0x205)];!_0x2ae488[_0x25e0ba(0x21f)](_0x11a443)&&_0x2ae488[_0x25e0ba(0x21a)](_0x11a443,[]),_0x2ae488[_0x25e0ba(0x189)](_0x11a443)[_0x25e0ba(0x1a2)](_0x4c44e6);}for(const _0xc28d99 of _0x2ae488[_0x25e0ba(0x18f)]()){_0xc28d99[_0x25e0ba(0x1d8)]((_0x180c67,_0x239b01)=>(_0x180c67[_0x25e0ba(0x1b1)]||0x0)-(_0x239b01[_0x25e0ba(0x1b1)]||0x0));}let _0x4a9f97;if(_0x24ed3e){if(!_0x24ed3e[_0x25e0ba(0x175)](_0x25e0ba(0x1c9))&&!_0x24ed3e[_0x25e0ba(0x175)](_0x25e0ba(0x1fc)))return console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x225)](_0x25e0ba(0x24c)+_0x24ed3e+'\x0a')),0x1;_0x4a9f97=[_0x24ed3e];}else _0x4a9f97=findYamlFiles(_0x59c816);if(_0x4a9f97[_0x25e0ba(0x1b4)]===0x0)return console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x225)](_0x25e0ba(0x19b)+_0x59c816+'\x0a')),console['error'](a36_0x54932d[_0x25e0ba(0x1d5)]('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files')),0x1;const _0x100cfe=[],_0x135150=[];for(const _0x235229 of _0x4a9f97){const _0x20a6f9=a36_0x475838[_0x25e0ba(0x1b9)](_0x59c816,a36_0x475838[_0x25e0ba(0x17d)](_0x235229)),_0x548494=_0x20a6f9==='.'?'':_0x20a6f9,_0x3be0e3=readFileSync(_0x235229,'utf-8');try{const _0x59557c=a36_0x147f4c[_0x25e0ba(0x177)](_0x3be0e3);if(isJourneyYaml(_0x59557c)){const _0x41c08d=a36_0x2e896f(_0x3be0e3);_0x135150['push']({'yamlConfig':_0x41c08d,'folderPath':_0x548494,'sourcePath':_0x235229});}else{if(!_0x9a1cc5[_0x25e0ba(0x20f)]){const _0x5b5100=parseSegmentYamlFile(_0x3be0e3),_0x3adba9=normalizeChildSegmentYaml(_0x5b5100);_0x100cfe[_0x25e0ba(0x1a2)]({'yamlConfig':_0x3adba9,'folderPath':_0x548494,'sourcePath':_0x235229});}}}catch(_0x53bad7){return console[_0x25e0ba(0x220)](a36_0x54932d['red'](_0x25e0ba(0x18b)+_0x235229+':\x20'+(_0x53bad7 instanceof Error?_0x53bad7['message']:_0x53bad7))),0x1;}}if(_0x100cfe[_0x25e0ba(0x1b4)]===0x0&&_0x135150['length']===0x0){const _0x84df66=_0x9a1cc5[_0x25e0ba(0x20f)]?_0x25e0ba(0x1e1):'segment\x20or\x20journey';return console['error'](a36_0x54932d[_0x25e0ba(0x1cd)]('No\x20'+_0x84df66+_0x25e0ba(0x173))),0x0;}const _0x37b05f=new Map();_0xfee852[_0x25e0ba(0x1b4)]>0x0&&!_0x9a1cc5['journeysOnly']&&await withSpinner(_0x25e0ba(0x25f),async()=>{await batchAsync(_0xfee852,async _0x236395=>{const _0x205fbf=a36_0x2d4a,_0x57764f=await _0x5793b9['segment'][_0x205fbf(0x1ad)](_0x2d104e,_0x236395['id']);_0x37b05f['set'](_0x236395['id'],_0x57764f);});},{'verbose':_0x9a1cc5[_0x25e0ba(0x1f9)]});const _0x91fd22=[],_0x3c7242=new Set();for(const {yamlConfig:_0x569e66,folderPath:_0x4408a0,sourcePath:_0x26638b}of _0x100cfe){const _0x10865e=resolveTDFolderPath(_0x4408a0,_0xab46ba,_0x1bda42),_0x161ef3=_0x10865e+':'+_0x569e66['name'],_0x22bed5=_0x4e2e0d[_0x25e0ba(0x189)](_0x161ef3),_0x46b872=_0x22bed5?_0x37b05f[_0x25e0ba(0x189)](_0x22bed5['id'])||[]:[];if(_0x10865e&&!_0x2ac595[_0x25e0ba(0x21f)](_0x10865e)){const _0x349f07=_0x10865e['split']('/');let _0x46f54f='';for(const _0x680b16 of _0x349f07){_0x46f54f=_0x46f54f?_0x46f54f+'/'+_0x680b16:_0x680b16,!_0x2ac595[_0x25e0ba(0x21f)](_0x46f54f)&&_0x3c7242[_0x25e0ba(0x232)](_0x46f54f);}}const _0x32875b=calculateActivationActions(_0x569e66['activations']||[],_0x46b872,_0x464344,_0x502bc7),_0x54fd56=segmentToYamlString(_0x569e66);let _0x494a18,_0x1d7af3=![],_0x3ab3ff;if(_0x22bed5){const _0x1bb1f7=segmentWithActivationsToYaml(_0x22bed5,_0x46b872,undefined,_0x464344,_0x502bc7),_0x3ec935=segmentToYamlString(_0x1bb1f7);_0x494a18=generateDiff(_0x3ec935,_0x54fd56),_0x1d7af3=hasChanges(_0x494a18),_0x1d7af3&&(_0x3ab3ff=formatDiffWithColors(_0x494a18));}else _0x494a18=generateDiff('',_0x54fd56),_0x3ab3ff=formatDiffWithColors(_0x494a18);_0x91fd22[_0x25e0ba(0x1a2)]({'relativePath':_0x569e66[_0x25e0ba(0x179)],'absolutePath':_0x26638b,'yamlConfig':_0x569e66,'folderPath':_0x10865e,'existingSegment':_0x22bed5,'existingActivations':_0x46b872,'isNew':!_0x22bed5,'hasChanges':_0x1d7af3,'diff':_0x3ab3ff,'activationActions':_0x32875b});}let _0x53a076=[];if(!_0x24ed3e){const _0x1a258f=new Set();for(const {yamlConfig:_0x2eb490,folderPath:_0x3d28bf}of _0x100cfe){const _0x4e660e=resolveTDFolderPath(_0x3d28bf,_0xab46ba,_0x1bda42);_0x1a258f[_0x25e0ba(0x232)](_0x4e660e+':'+_0x2eb490['name']);}_0x53a076=_0xfee852[_0x25e0ba(0x21c)](_0x577361=>{const _0x309c7b=_0x25e0ba,_0x1dcfbb=_0x577361[_0x309c7b(0x16f)]?_0x22d65e[_0x309c7b(0x189)](_0x577361[_0x309c7b(0x16f)]['toString']())||'':'',_0x21e981=_0x1dcfbb+':'+_0x577361[_0x309c7b(0x179)];if(_0x1a258f[_0x309c7b(0x21f)](_0x21e981))return![];if(_0xab46ba)return _0x1dcfbb===_0x1bda42||_0x1dcfbb[_0x309c7b(0x19c)](_0x1bda42+'/');return!![];});}const _0x4ecc55=[];for(const {yamlConfig:_0x35f5b8,folderPath:_0xbd7dc7,sourcePath:_0x1c6f5a}of _0x135150){const _0x1b0a45=resolveTDFolderPath(_0xbd7dc7,_0xab46ba,_0x1bda42),_0x1424c9=_0x1b0a45+':'+_0x35f5b8['name'],_0x1f4683=_0x2ae488[_0x25e0ba(0x189)](_0x1424c9);let _0x202410,_0x1d243c;if(_0x1f4683&&_0x1f4683[_0x25e0ba(0x1b4)]>0x0){const _0x168bd7=new Set(),_0x3e5fb6=new Set(),_0x2adf8a=new Map(),_0xc7e0f=new Map(),_0x15e76d=createJumpTargetCache(),_0x171688=_0x111f18=>({'resolveSegment':async _0xc10e90=>{const _0x305baf=_0x25e0ba,_0x419247=_0xc7e0f[_0x305baf(0x189)](_0xc10e90);if(_0x419247!==undefined)return{'name':_0x419247,'isJourneyLocal':!![]};try{let _0x1f5b7f=_0xfee852['find'](_0x47ccde=>_0x47ccde['id']===_0xc10e90);!_0x1f5b7f&&(_0x1f5b7f=await _0x5793b9[_0x305baf(0x1e7)]['getSegment'](_0x2d104e,_0xc10e90));const _0x23e7ad=generateJourneyLocalName(_0x1f5b7f[_0x305baf(0x179)]),_0x2ddcb9=_0x1f5b7f[_0x305baf(0x250)]===SEGMENT_KIND_JOURNEY&&_0x23e7ad!==undefined;let _0x4bc387=_0x1f5b7f[_0x305baf(0x179)];if(_0x2ddcb9&&_0x23e7ad){let _0x2b7759=_0x23e7ad,_0x2a5e97=0x2;while(_0x168bd7[_0x305baf(0x21f)](_0x2b7759)){_0x2b7759=_0x23e7ad+'_'+_0x2a5e97,_0x2a5e97++;}_0x168bd7[_0x305baf(0x232)](_0x2b7759),_0x4bc387=_0x2b7759,_0xc7e0f[_0x305baf(0x21a)](_0xc10e90,_0x4bc387);}let _0x4b7771;return _0x2ddcb9&&_0x1f5b7f[_0x305baf(0x20c)]&&(_0x4b7771={'description':_0x1f5b7f[_0x305baf(0x23e)],'rule':apiRuleToYaml(_0x1f5b7f[_0x305baf(0x20c)])}),{'name':_0x4bc387,'isJourneyLocal':_0x2ddcb9,'definition':_0x4b7771};}catch{return{'name':_0xc10e90,'isJourneyLocal':![]};}},'resolveActivation':async _0x2f24d7=>{const _0x8d0ffc=_0x25e0ba,_0x33982b=_0x2adf8a[_0x8d0ffc(0x189)](_0x2f24d7);if(_0x33982b!==undefined)return{'name':_0x33982b,'isJourneyLocal':!![]};try{const _0x419314=await _0x5793b9[_0x8d0ffc(0x1e1)][_0x8d0ffc(0x24e)](_0x111f18,_0x2f24d7),_0x3b007e=_0x419314['attributes'][_0x8d0ffc(0x16a)][_0x8d0ffc(0x179)]||_0x2f24d7,_0x2ac228=sanitizeYamlKey(_0x3b007e)||'activation_'+_0x2f24d7;let _0x4df006=_0x2ac228,_0x5418d0=0x2;while(_0x3e5fb6[_0x8d0ffc(0x21f)](_0x4df006)){_0x4df006=_0x2ac228+'_'+_0x5418d0,_0x5418d0++;}_0x3e5fb6[_0x8d0ffc(0x232)](_0x4df006),_0x2adf8a[_0x8d0ffc(0x21a)](_0x2f24d7,_0x4df006);const _0x2e4540=journeyActivationStepToYaml(_0x419314,_0x464344,_0x502bc7);return{'name':_0x4df006,'isJourneyLocal':!![],'definition':_0x2e4540};}catch{return{'name':_0x2f24d7,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x106561,_0x5c761d)=>resolveJumpTarget(_0x106561,_0x5c761d,_0x15e76d,_0x3ed9b0=>_0x5793b9[_0x25e0ba(0x1e1)]['getJourney'](_0x3ed9b0))}),_0x1a0560=hasMultipleVersions(_0x35f5b8);if(_0x1a0560&&_0x1f4683[_0x25e0ba(0x1b4)]>0x1){const _0x30930b=[];for(const _0x20ccaa of _0x1f4683){const _0x471142=await withSpinner(_0x25e0ba(0x22d)+_0x35f5b8['name']+_0x25e0ba(0x1fe)+(_0x20ccaa[_0x25e0ba(0x1b1)]||0x1)+_0x25e0ba(0x201),()=>_0x5793b9[_0x25e0ba(0x1e1)][_0x25e0ba(0x188)](_0x20ccaa['id']),{'verbose':_0x9a1cc5['verbose']}),_0x45881d=_0x171688(_0x20ccaa['id']),_0x473a02=await apiToYamlAsync(_0x471142[_0x25e0ba(0x1bb)],_0x45881d);_0x30930b['push']({'item':_0x20ccaa,'yaml':_0x473a02});}_0x1d243c=buildMergedJourneyYaml(_0x30930b);const _0x2f4bb2=Math['max'](..._0x30930b['map'](_0x3dd47d=>_0x3dd47d[_0x25e0ba(0x1c7)]['versionNumber']||0x0)),_0x36b179=_0x1f4683['find'](_0x42aa0c=>(_0x42aa0c[_0x25e0ba(0x1b1)]||0x0)===_0x2f4bb2);_0x36b179&&(_0x202410=await _0x5793b9[_0x25e0ba(0x1e1)][_0x25e0ba(0x188)](_0x36b179['id']));}else{const _0x2f16a1=_0x1f4683[_0x1f4683[_0x25e0ba(0x1b4)]-0x1],_0x12178e=await withSpinner('Fetching\x20journey\x20\x27'+_0x35f5b8['name']+_0x25e0ba(0x1ab),()=>_0x5793b9[_0x25e0ba(0x1e1)][_0x25e0ba(0x188)](_0x2f16a1['id']),{'verbose':_0x9a1cc5['verbose']});_0x202410=_0x12178e[_0x25e0ba(0x1bb)];const _0x335a8c=_0x171688(_0x2f16a1['id']);_0x1d243c=await apiToYamlAsync(_0x202410,_0x335a8c);}}if(_0x1b0a45&&!_0x2ac595[_0x25e0ba(0x21f)](_0x1b0a45)){const _0x5a58d2=_0x1b0a45[_0x25e0ba(0x23a)]('/');let _0x1f8a25='';for(const _0x92e134 of _0x5a58d2){_0x1f8a25=_0x1f8a25?_0x1f8a25+'/'+_0x92e134:_0x92e134,!_0x2ac595[_0x25e0ba(0x21f)](_0x1f8a25)&&_0x3c7242['add'](_0x1f8a25);}}const _0x3fe45a=normalizeJourneyYaml(_0x35f5b8),_0x496921=a36_0x2783fc(_0x3fe45a);let _0x34eb96=![],_0x3aecc8;if(_0x1d243c){const _0x256887=normalizeJourneyYaml(_0x1d243c),_0x475e80=a36_0x2783fc(_0x256887),_0x363ec1=generateDiff(_0x475e80,_0x496921);_0x34eb96=hasChanges(_0x363ec1),_0x34eb96&&(_0x3aecc8=formatDiffWithColors(_0x363ec1));}else{const _0x95c39e=generateDiff('',_0x496921);_0x3aecc8=formatDiffWithColors(_0x95c39e);}_0x4ecc55[_0x25e0ba(0x1a2)]({'relativePath':_0x35f5b8[_0x25e0ba(0x179)],'absolutePath':_0x1c6f5a,'yamlConfig':_0x35f5b8,'folderPath':_0x1b0a45,'existingJourney':_0x202410,'isNew':!_0x202410,'hasChanges':_0x34eb96,'diff':_0x3aecc8});}let _0x57fe6d=[];if(!_0x24ed3e){const _0x588e24=new Set();for(const {yamlConfig:_0x4f91fa,folderPath:_0x19ff17}of _0x135150){const _0x115948=resolveTDFolderPath(_0x19ff17,_0xab46ba,_0x1bda42);_0x588e24[_0x25e0ba(0x232)](_0x115948+':'+_0x4f91fa[_0x25e0ba(0x179)]);}_0x57fe6d=_0x5e662c['filter'](_0x44ab91=>{const _0x2fb96c=_0x25e0ba,_0x21d6ef=_0x44ab91[_0x2fb96c(0x1c8)]?_0x22d65e[_0x2fb96c(0x189)](_0x44ab91[_0x2fb96c(0x1c8)])||'':'',_0x382506=_0x21d6ef+':'+_0x44ab91['journeyBundleName'];if(_0x588e24[_0x2fb96c(0x21f)](_0x382506))return![];if(_0xab46ba)return _0x21d6ef===_0x1bda42||_0x21d6ef[_0x2fb96c(0x19c)](_0x1bda42+'/');return!![];});}const _0x108c12=_0x91fd22[_0x25e0ba(0x21c)](_0x3ba927=>_0x3ba927[_0x25e0ba(0x20e)]),_0x8331ab=_0x91fd22[_0x25e0ba(0x21c)](_0x498e61=>!_0x498e61[_0x25e0ba(0x20e)]&&_0x498e61[_0x25e0ba(0x256)]),_0x20207f=_0x91fd22['filter'](_0x98a95b=>!_0x98a95b['isNew']&&!_0x98a95b[_0x25e0ba(0x256)]),_0x3408d0=Array['from'](_0x3c7242)['sort'](),_0x304ea1=_0x9a1cc5['delete']?_0x53a076:[],_0x3e0feb=_0x9a1cc5[_0x25e0ba(0x1a6)]?_0x57fe6d:[],_0x1e2c1e=_0x91fd22[_0x25e0ba(0x16c)](_0x392df4=>_0x392df4[_0x25e0ba(0x1e5)]),_0x527a4e=_0x1e2c1e[_0x25e0ba(0x21c)](_0x12a771=>_0x12a771[_0x25e0ba(0x231)]==='create'),_0x384eb8=_0x1e2c1e['filter'](_0x3d1997=>_0x3d1997['type']===_0x25e0ba(0x24b)),_0x4e02d2=_0x1e2c1e[_0x25e0ba(0x21c)](_0x438fcc=>_0x438fcc[_0x25e0ba(0x231)]===_0x25e0ba(0x1a6)),_0x479e32=_0x4ecc55[_0x25e0ba(0x21c)](_0x2424c3=>_0x2424c3[_0x25e0ba(0x20e)]),_0x2ec4a2=_0x4ecc55[_0x25e0ba(0x21c)](_0x5ae894=>!_0x5ae894['isNew']&&_0x5ae894[_0x25e0ba(0x256)]),_0x13b708=_0x4ecc55[_0x25e0ba(0x21c)](_0x36d299=>!_0x36d299[_0x25e0ba(0x20e)]&&!_0x36d299[_0x25e0ba(0x256)]);console[_0x25e0ba(0x220)](_0x25e0ba(0x1df)+_0x1e93f0+'\x27:');_0x3408d0[_0x25e0ba(0x1b4)]>0x0&&console[_0x25e0ba(0x220)]('\x20\x20'+a36_0x54932d[_0x25e0ba(0x1c4)](_0x25e0ba(0x253)+_0x3408d0[_0x25e0ba(0x1b4)]+_0x25e0ba(0x229)));if(!_0x9a1cc5[_0x25e0ba(0x20f)]){console[_0x25e0ba(0x220)]('\x20\x20📊\x20Segments:'),console[_0x25e0ba(0x220)](_0x25e0ba(0x24f)+a36_0x54932d[_0x25e0ba(0x1c6)]('+\x20'+_0x108c12[_0x25e0ba(0x1b4)]+_0x25e0ba(0x1cf))),console[_0x25e0ba(0x220)](_0x25e0ba(0x24f)+a36_0x54932d['yellow']('~\x20'+_0x8331ab[_0x25e0ba(0x1b4)]+_0x25e0ba(0x17a)));if(_0x304ea1['length']>0x0)console['error']('\x20\x20\x20\x20'+a36_0x54932d[_0x25e0ba(0x225)]('-\x20'+_0x304ea1[_0x25e0ba(0x1b4)]+_0x25e0ba(0x196)));else _0x53a076[_0x25e0ba(0x1b4)]>0x0&&!_0x9a1cc5[_0x25e0ba(0x1a6)]&&console[_0x25e0ba(0x220)](_0x25e0ba(0x24f)+a36_0x54932d[_0x25e0ba(0x16e)](_0x53a076[_0x25e0ba(0x1b4)]+_0x25e0ba(0x1f3)));console[_0x25e0ba(0x220)](_0x25e0ba(0x24f)+a36_0x54932d[_0x25e0ba(0x16e)]('=\x20'+_0x20207f[_0x25e0ba(0x1b4)]+_0x25e0ba(0x1ef)));}if(_0x4ecc55['length']>0x0||_0x57fe6d[_0x25e0ba(0x1b4)]>0x0){console[_0x25e0ba(0x220)](_0x25e0ba(0x1f0)),console['error']('\x20\x20\x20\x20'+a36_0x54932d[_0x25e0ba(0x1c6)]('+\x20'+_0x479e32[_0x25e0ba(0x1b4)]+_0x25e0ba(0x1cf))),console[_0x25e0ba(0x220)]('\x20\x20\x20\x20'+a36_0x54932d[_0x25e0ba(0x1cd)]('~\x20'+_0x2ec4a2[_0x25e0ba(0x1b4)]+_0x25e0ba(0x17a)));if(_0x3e0feb[_0x25e0ba(0x1b4)]>0x0)console['error'](_0x25e0ba(0x24f)+a36_0x54932d['red']('-\x20'+_0x3e0feb[_0x25e0ba(0x1b4)]+_0x25e0ba(0x196)));else _0x57fe6d[_0x25e0ba(0x1b4)]>0x0&&!_0x9a1cc5[_0x25e0ba(0x1a6)]&&console[_0x25e0ba(0x220)](_0x25e0ba(0x24f)+a36_0x54932d[_0x25e0ba(0x16e)](_0x57fe6d[_0x25e0ba(0x1b4)]+_0x25e0ba(0x1f3)));console[_0x25e0ba(0x220)](_0x25e0ba(0x24f)+a36_0x54932d[_0x25e0ba(0x16e)]('=\x20'+_0x13b708['length']+_0x25e0ba(0x1ef)));}_0x1e2c1e['length']>0x0&&!_0x9a1cc5[_0x25e0ba(0x20f)]&&(console[_0x25e0ba(0x220)](''),console[_0x25e0ba(0x220)](_0x25e0ba(0x1c2)),_0x527a4e['length']>0x0&&console[_0x25e0ba(0x220)](_0x25e0ba(0x24f)+a36_0x54932d['green']('+\x20'+_0x527a4e['length']+_0x25e0ba(0x23c))),_0x384eb8[_0x25e0ba(0x1b4)]>0x0&&console['error'](_0x25e0ba(0x24f)+a36_0x54932d[_0x25e0ba(0x1cd)]('~\x20'+_0x384eb8[_0x25e0ba(0x1b4)]+'\x20to\x20update')),_0x4e02d2[_0x25e0ba(0x1b4)]>0x0&&console[_0x25e0ba(0x220)](_0x25e0ba(0x24f)+a36_0x54932d[_0x25e0ba(0x225)]('-\x20'+_0x4e02d2['length']+'\x20to\x20delete')));console[_0x25e0ba(0x220)]('\x20\x20Source:\x20'+a36_0x54932d[_0x25e0ba(0x1d5)](_0x59c816)+'\x0a');if(_0x3408d0['length']>0x0){console[_0x25e0ba(0x220)](_0x25e0ba(0x1e2));for(const _0x32f047 of _0x3408d0){console['error']('\x20\x20'+a36_0x54932d[_0x25e0ba(0x1c4)]('+')+'\x20'+_0x32f047);}console[_0x25e0ba(0x220)]('');}if(_0x108c12['length']>0x0&&!_0x9a1cc5[_0x25e0ba(0x20f)])for(const _0x2e76f6 of _0x108c12){const _0x43b797=_0x2e76f6[_0x25e0ba(0x17f)]?_0x2e76f6['folderPath']+'/'+_0x2e76f6[_0x25e0ba(0x202)]['name']:_0x2e76f6[_0x25e0ba(0x202)][_0x25e0ba(0x179)],_0x49b9e9=_0x2e76f6[_0x25e0ba(0x202)][_0x25e0ba(0x1f2)]?.[_0x25e0ba(0x1b4)]||0x0,_0x47fbfb=_0x49b9e9>0x0?a36_0x54932d[_0x25e0ba(0x16e)]('\x20['+_0x49b9e9+'\x20activations]'):'';console[_0x25e0ba(0x220)]('\x0a'+a36_0x54932d['green'](_0x25e0ba(0x1a3))+'\x20'+_0x43b797+_0x47fbfb),console['error']('─'[_0x25e0ba(0x1a1)](0x3c)),_0x2e76f6['diff']&&console['error'](_0x2e76f6[_0x25e0ba(0x1d2)]),console[_0x25e0ba(0x220)]('─'[_0x25e0ba(0x1a1)](0x3c));}if(_0x304ea1['length']>0x0&&!_0x9a1cc5['journeysOnly'])for(const _0x3ce9db of _0x304ea1){const _0xf6c53c=_0x3ce9db['segmentFolderId']?_0x22d65e[_0x25e0ba(0x189)](_0x3ce9db['segmentFolderId'][_0x25e0ba(0x210)]())||'':'',_0x1296d9=_0xf6c53c?_0xf6c53c+'/'+_0x3ce9db[_0x25e0ba(0x179)]:_0x3ce9db['name'],_0x534423=_0x37b05f[_0x25e0ba(0x189)](_0x3ce9db['id'])||[],_0x108187=_0x534423['length']>0x0?a36_0x54932d[_0x25e0ba(0x16e)]('\x20['+_0x534423[_0x25e0ba(0x1b4)]+_0x25e0ba(0x1da)):'';console[_0x25e0ba(0x220)]('\x0a'+a36_0x54932d[_0x25e0ba(0x225)]('Delete\x20segment:')+'\x20'+_0x1296d9+_0x108187),console[_0x25e0ba(0x220)]('─'[_0x25e0ba(0x1a1)](0x3c));const _0x3cac8d=segmentWithActivationsToYaml(_0x3ce9db,_0x534423,undefined,_0x464344,_0x502bc7),_0x1f568f=segmentToYamlString(_0x3cac8d),_0x6ea09a=generateDiff(_0x1f568f,'');console[_0x25e0ba(0x220)](formatDiffWithColors(_0x6ea09a)),console['error']('─'[_0x25e0ba(0x1a1)](0x3c));}const _0x27572f=_0x91fd22['filter'](_0x250c74=>!_0x250c74[_0x25e0ba(0x20e)]&&_0x250c74[_0x25e0ba(0x1d2)]);if(_0x27572f['length']>0x0&&!_0x9a1cc5[_0x25e0ba(0x20f)])for(const _0x2cfc8 of _0x27572f){const _0x214b51=_0x2cfc8[_0x25e0ba(0x17f)]?_0x2cfc8[_0x25e0ba(0x17f)]+'/'+_0x2cfc8['yamlConfig'][_0x25e0ba(0x179)]:_0x2cfc8['yamlConfig'][_0x25e0ba(0x179)];console[_0x25e0ba(0x220)]('\x0a'+a36_0x54932d['yellow'](_0x25e0ba(0x187))+'\x20'+_0x214b51),console['error']('─'[_0x25e0ba(0x1a1)](0x3c)),console['error'](_0x2cfc8[_0x25e0ba(0x1d2)]),console[_0x25e0ba(0x220)]('─'[_0x25e0ba(0x1a1)](0x3c));}if(_0x479e32[_0x25e0ba(0x1b4)]>0x0)for(const _0x4b016a of _0x479e32){const _0x563b02=_0x4b016a[_0x25e0ba(0x17f)]?_0x4b016a['folderPath']+'/'+_0x4b016a[_0x25e0ba(0x202)][_0x25e0ba(0x179)]:_0x4b016a[_0x25e0ba(0x202)][_0x25e0ba(0x179)];console[_0x25e0ba(0x220)]('\x0a'+a36_0x54932d[_0x25e0ba(0x1c6)](_0x25e0ba(0x209))+'\x20'+_0x563b02),console[_0x25e0ba(0x220)]('─'[_0x25e0ba(0x1a1)](0x3c)),_0x4b016a[_0x25e0ba(0x1d2)]&&console['error'](_0x4b016a[_0x25e0ba(0x1d2)]),console[_0x25e0ba(0x220)]('─'[_0x25e0ba(0x1a1)](0x3c));}const _0x3eede5=_0x4ecc55['filter'](_0x26cf81=>!_0x26cf81[_0x25e0ba(0x20e)]&&_0x26cf81[_0x25e0ba(0x1d2)]);if(_0x3eede5[_0x25e0ba(0x1b4)]>0x0)for(const _0x55cb7a of _0x3eede5){const _0x2f98cd=_0x55cb7a[_0x25e0ba(0x17f)]?_0x55cb7a[_0x25e0ba(0x17f)]+'/'+_0x55cb7a['yamlConfig']['name']:_0x55cb7a[_0x25e0ba(0x202)][_0x25e0ba(0x179)];console[_0x25e0ba(0x220)]('\x0a'+a36_0x54932d[_0x25e0ba(0x1cd)](_0x25e0ba(0x25e))+'\x20'+_0x2f98cd),console[_0x25e0ba(0x220)]('─'[_0x25e0ba(0x1a1)](0x3c)),console[_0x25e0ba(0x220)](_0x55cb7a[_0x25e0ba(0x1d2)]),console[_0x25e0ba(0x220)]('─'[_0x25e0ba(0x1a1)](0x3c));}if(_0x3e0feb[_0x25e0ba(0x1b4)]>0x0)for(const _0x2d25f1 of _0x3e0feb){const _0x5bb6b5=_0x2d25f1[_0x25e0ba(0x1c8)]?_0x22d65e[_0x25e0ba(0x189)](_0x2d25f1['folderId'])||'':'',_0x1e341d=_0x5bb6b5?_0x5bb6b5+'/'+_0x2d25f1[_0x25e0ba(0x205)]:_0x2d25f1[_0x25e0ba(0x205)];console['error']('\x0a'+a36_0x54932d[_0x25e0ba(0x225)](_0x25e0ba(0x23b))+'\x20'+_0x1e341d),console['error']('─'[_0x25e0ba(0x1a1)](0x3c)),console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x225)](_0x25e0ba(0x1b3))),console[_0x25e0ba(0x220)]('─'['repeat'](0x3c));}if(_0x9a1cc5[_0x25e0ba(0x248)])return console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x1cd)](_0x25e0ba(0x192))),0x0;const _0x26197a=_0x9a1cc5[_0x25e0ba(0x20f)]?![]:_0x108c12[_0x25e0ba(0x1b4)]>0x0||_0x8331ab[_0x25e0ba(0x1b4)]>0x0||_0x304ea1[_0x25e0ba(0x1b4)]>0x0,_0x464dde=_0x479e32[_0x25e0ba(0x1b4)]>0x0||_0x2ec4a2[_0x25e0ba(0x1b4)]>0x0||_0x3e0feb[_0x25e0ba(0x1b4)]>0x0,_0x4ecced=_0x9a1cc5['journeysOnly']?![]:_0x1e2c1e[_0x25e0ba(0x1b4)]>0x0,_0x23efde=_0x3408d0[_0x25e0ba(0x1b4)]>0x0;if(!_0x26197a&&!_0x464dde&&!_0x4ecced&&!_0x23efde){const _0x2bf2d0=_0x9a1cc5[_0x25e0ba(0x20f)]?_0x25e0ba(0x261):_0x25e0ba(0x1ea);console['error'](a36_0x54932d[_0x25e0ba(0x1c6)](_0x2bf2d0));if(_0x24ed3e&&_0x13b708[_0x25e0ba(0x1b4)]===0x1){const _0x2e801d=_0x13b708[0x0];if(_0x2e801d[_0x25e0ba(0x1bf)]?.['id']){const _0x178da0=getConsoleNextUrl(_0x9a1cc5[_0x25e0ba(0x1c0)],'/app/ps/'+_0x2d104e+_0x25e0ba(0x1bd)+_0x2e801d[_0x25e0ba(0x1bf)]['id']+_0x25e0ba(0x1ca));console['error']('\x20\x20'+a36_0x54932d['cyan'](_0x178da0));}}return 0x0;}const _0x37929d=_0x9a1cc5[_0x25e0ba(0x20f)]?_0x479e32[_0x25e0ba(0x1b4)]+_0x2ec4a2['length']+_0x3e0feb['length']+_0x3408d0['length']:_0x108c12[_0x25e0ba(0x1b4)]+_0x8331ab[_0x25e0ba(0x1b4)]+_0x304ea1[_0x25e0ba(0x1b4)]+_0x479e32[_0x25e0ba(0x1b4)]+_0x2ec4a2[_0x25e0ba(0x1b4)]+_0x3e0feb[_0x25e0ba(0x1b4)]+_0x3408d0[_0x25e0ba(0x1b4)]+_0x1e2c1e['length'];if(!_0x9a1cc5[_0x25e0ba(0x1bc)]&&_0x37929d>0x0){const _0x2f0ab8=await confirmKey(_0x25e0ba(0x217)+_0x37929d+_0x25e0ba(0x239));if(!_0x2f0ab8)return console[_0x25e0ba(0x220)](_0x25e0ba(0x258)),0x1;}for(const _0x354e18 of _0x3408d0){const _0x44e9ad=_0x354e18['split']('/'),_0x6aeea1=_0x44e9ad[_0x44e9ad[_0x25e0ba(0x1b4)]-0x1],_0x31845d=_0x44e9ad[_0x25e0ba(0x1fb)](0x0,-0x1)[_0x25e0ba(0x1af)]('/'),_0x470acf=_0x2ac595['get'](_0x31845d),_0x304d26={'name':_0x6aeea1,'parentFolderId':_0x470acf},_0x267652=await withSpinner(_0x25e0ba(0x180)+_0x354e18+_0x25e0ba(0x1c1),()=>_0x5793b9[_0x25e0ba(0x1e7)][_0x25e0ba(0x215)](_0x2d104e,_0x304d26),{'verbose':_0x9a1cc5['verbose']});_0x2ac595['set'](_0x354e18,_0x267652[_0x25e0ba(0x1bb)]['id']),console[_0x25e0ba(0x220)](a36_0x54932d['blue'](_0x25e0ba(0x172)+_0x354e18+'\x27'));}let _0x396bcc=0x0,_0x5e3f71=0x0,_0x4b3f14=0x0,_0x32af90=0x0,_0x343e01=0x0,_0x4fde80=0x0;const _0x170880=new Map();for(const _0x51a4ff of _0x9a1cc5[_0x25e0ba(0x20f)]?[]:_0x91fd22){const _0x488b04=_0x51a4ff[_0x25e0ba(0x17f)]?_0x2ac595[_0x25e0ba(0x189)](_0x51a4ff[_0x25e0ba(0x17f)]):undefined;let _0x207355;try{if(_0x51a4ff[_0x25e0ba(0x20e)]){const _0x3a5227=yamlToCreateRequest(_0x51a4ff['yamlConfig'],_0x488b04),_0x418026=await withSpinner(_0x25e0ba(0x1ec)+_0x51a4ff[_0x25e0ba(0x202)]['name']+_0x25e0ba(0x1c1),()=>_0x5793b9['segment'][_0x25e0ba(0x16d)](_0x2d104e,_0x3a5227),{'verbose':_0x9a1cc5[_0x25e0ba(0x1f9)]});_0x207355=_0x418026[_0x25e0ba(0x1bb)]['id'],_0x170880[_0x25e0ba(0x21a)](_0x51a4ff['yamlConfig'][_0x25e0ba(0x179)],_0x207355),console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x1c6)](_0x25e0ba(0x1a9)+_0x51a4ff['yamlConfig'][_0x25e0ba(0x179)]+'\x27')),_0x396bcc++;}else{if(_0x51a4ff[_0x25e0ba(0x256)]){const _0x2798cb=yamlToUpdateRequest(_0x51a4ff['yamlConfig']);_0x488b04!==_0x51a4ff['existingSegment']?.[_0x25e0ba(0x16f)]&&(_0x2798cb[_0x25e0ba(0x16f)]=_0x488b04?parseInt(_0x488b04,0xa):undefined),await withSpinner('Updating\x20segment\x20\x27'+_0x51a4ff[_0x25e0ba(0x202)][_0x25e0ba(0x179)]+_0x25e0ba(0x1c1),()=>_0x5793b9[_0x25e0ba(0x1e7)][_0x25e0ba(0x1f1)](_0x2d104e,_0x51a4ff[_0x25e0ba(0x17b)]['id'],_0x2798cb),{'verbose':_0x9a1cc5['verbose']}),_0x207355=_0x51a4ff[_0x25e0ba(0x17b)]['id'],console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x1cd)]('✔\x20Updated\x20segment\x20\x27'+_0x51a4ff[_0x25e0ba(0x202)][_0x25e0ba(0x179)]+'\x27')),_0x5e3f71++;}else _0x207355=_0x51a4ff[_0x25e0ba(0x17b)]['id'];}}catch(_0x135110){const _0x37833f=isHttp400Error(_0x135110),_0x4880d2=_0x37833f?ErrorCode[_0x25e0ba(0x24d)]:ErrorCode[_0x25e0ba(0x1a5)],_0x2dec39=getErrorMessage(_0x135110);throw new SDKError(_0x4880d2,_0x25e0ba(0x18e)+(_0x51a4ff[_0x25e0ba(0x20e)]?_0x25e0ba(0x226):_0x25e0ba(0x24b))+_0x25e0ba(0x213)+_0x51a4ff[_0x25e0ba(0x1a4)]+'\x0a\x20\x20'+_0x2dec39,_0x135110);}for(const _0x98c0e8 of _0x51a4ff[_0x25e0ba(0x1e5)]){try{if(_0x98c0e8['type']===_0x25e0ba(0x226)&&_0x98c0e8[_0x25e0ba(0x1ae)]){const _0x284423=yamlActivationToCreateRequest(_0x98c0e8['yamlActivation'],_0x1516f5,_0x5b7934);await withSpinner('Creating\x20activation\x20\x27'+_0x98c0e8[_0x25e0ba(0x179)]+_0x25e0ba(0x1c1),()=>_0x5793b9[_0x25e0ba(0x1e7)][_0x25e0ba(0x22b)](_0x2d104e,_0x207355,_0x284423),{'verbose':_0x9a1cc5[_0x25e0ba(0x1f9)]}),console[_0x25e0ba(0x220)](a36_0x54932d['green'](_0x25e0ba(0x228)+_0x98c0e8['name']+'\x27')),_0x32af90++;}else{if(_0x98c0e8[_0x25e0ba(0x231)]==='update'&&_0x98c0e8[_0x25e0ba(0x1ae)]&&_0x98c0e8['existingActivation']){const _0x4f9055=yamlActivationToUpdateRequest(_0x98c0e8[_0x25e0ba(0x1ae)],_0x1516f5,_0x5b7934);await withSpinner(_0x25e0ba(0x185)+_0x98c0e8[_0x25e0ba(0x179)]+_0x25e0ba(0x1c1),()=>_0x5793b9[_0x25e0ba(0x1e7)]['updateActivation'](_0x2d104e,_0x207355,_0x98c0e8[_0x25e0ba(0x203)]['id'],_0x4f9055),{'verbose':_0x9a1cc5[_0x25e0ba(0x1f9)]}),console['error'](a36_0x54932d['yellow'](_0x25e0ba(0x1b2)+_0x98c0e8[_0x25e0ba(0x179)]+'\x27')),_0x343e01++;}else _0x98c0e8[_0x25e0ba(0x231)]===_0x25e0ba(0x1a6)&&_0x98c0e8[_0x25e0ba(0x203)]&&(await withSpinner('Deleting\x20activation\x20\x27'+_0x98c0e8['name']+'\x27...',()=>_0x5793b9['segment']['deleteActivation'](_0x2d104e,_0x207355,_0x98c0e8['existingActivation']['id']),{'verbose':_0x9a1cc5[_0x25e0ba(0x1f9)]}),console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x225)](_0x25e0ba(0x171)+_0x98c0e8[_0x25e0ba(0x179)]+'\x27')),_0x4fde80++);}}catch(_0x19e25d){const _0x26eda4=isHttp400Error(_0x19e25d),_0xdfd46e=_0x26eda4?ErrorCode[_0x25e0ba(0x1c3)]:ErrorCode[_0x25e0ba(0x22a)],_0x2bea05=getErrorMessage(_0x19e25d);throw new SDKError(_0xdfd46e,_0x25e0ba(0x18e)+_0x98c0e8[_0x25e0ba(0x231)]+_0x25e0ba(0x18d)+_0x98c0e8['name']+_0x25e0ba(0x255)+_0x51a4ff[_0x25e0ba(0x1a4)]+'\x0a\x20\x20'+_0x2bea05,_0x19e25d);}}}for(const _0x58fa97 of _0x9a1cc5[_0x25e0ba(0x20f)]?[]:_0x304ea1){await withSpinner(_0x25e0ba(0x181)+_0x58fa97[_0x25e0ba(0x179)]+'\x27...',()=>_0x5793b9[_0x25e0ba(0x1e7)][_0x25e0ba(0x19a)](_0x58fa97['id']),{'verbose':_0x9a1cc5['verbose']}),console[_0x25e0ba(0x220)](a36_0x54932d['red'](_0x25e0ba(0x1f5)+_0x58fa97[_0x25e0ba(0x179)]+'\x27')),_0x4b3f14++;}let _0x5495d0=0x0,_0x2af5da=0x0,_0x394fa4=0x0;const _0x427c03=new Map(_0x10252d);for(const _0x35bcae of _0x91fd22){_0x35bcae[_0x25e0ba(0x20e)]&&_0x170880[_0x25e0ba(0x21f)](_0x35bcae['yamlConfig'][_0x25e0ba(0x179)])&&_0x427c03['set'](_0x35bcae[_0x25e0ba(0x202)]['name'],_0x170880[_0x25e0ba(0x189)](_0x35bcae[_0x25e0ba(0x202)][_0x25e0ba(0x179)]));}if(_0x4ecc55[_0x25e0ba(0x1b4)]>0x0){const _0x4b53d5=await withQuerySpinner(_0x25e0ba(0x20d),async _0x42162c=>{const _0x42653d=_0x25e0ba,_0x58d8a6=[];let _0x3e5cd3=0x0;const _0x14bc96=0x5;for(let _0x28ea29=0x0;_0x28ea29<_0x4ecc55['length'];_0x28ea29+=_0x14bc96){const _0x566315=_0x4ecc55['slice'](_0x28ea29,_0x28ea29+_0x14bc96),_0x588d99=await Promise[_0x42653d(0x197)](_0x566315[_0x42653d(0x1b0)](async _0x588c1e=>{const _0x239b85=_0x42653d;if(!_0x588c1e[_0x239b85(0x20e)]&&!_0x588c1e[_0x239b85(0x256)])return{'action':_0x239b85(0x25b),'name':_0x588c1e[_0x239b85(0x202)][_0x239b85(0x179)],'journeyId':_0x588c1e[_0x239b85(0x1bf)]?.['id']};const _0x14fc5c=_0x588c1e[_0x239b85(0x17f)]?_0x2ac595[_0x239b85(0x189)](_0x588c1e['folderPath']):undefined,_0x1ff13d=_0x588c1e['isNew']?'Creating':_0x239b85(0x183);_0x42162c[_0x239b85(0x1d4)](_0x1ff13d+_0x239b85(0x207)+_0x588c1e[_0x239b85(0x202)][_0x239b85(0x179)]+'\x27');const _0x2246a6=new Map(),_0x4de172=new Map(),_0x50ba04=new Map(),_0x1e6f5d={'resolveSegmentId':async _0x4c94be=>{const _0x3f0b31=_0x239b85,_0x31f1c7=_0x427c03[_0x3f0b31(0x189)](_0x4c94be);if(!_0x31f1c7)throw new SDKError(ErrorCode[_0x3f0b31(0x1e3)],_0x3f0b31(0x1ba)+_0x4c94be+'\x20(referenced\x20in\x20journey\x20'+_0x588c1e[_0x3f0b31(0x202)][_0x3f0b31(0x179)]+')');return _0x31f1c7;},'resolveEmbeddedSegmentId':async(_0x47603a,_0x38570a)=>{const _0x233c3f=_0x239b85,_0x446a6a=_0x427c03[_0x233c3f(0x189)](_0x47603a);if(_0x446a6a)return _0x446a6a;const _0x5a72e7=_0xfee852[_0x233c3f(0x216)](_0x12add8=>_0x12add8[_0x233c3f(0x179)]===_0x47603a);if(_0x5a72e7)return _0x427c03[_0x233c3f(0x21a)](_0x47603a,_0x5a72e7['id']),_0x5a72e7['id'];if(_0x588c1e['isNew']){const _0x4e5d57=_0x588c1e[_0x233c3f(0x202)]['stages']||_0x588c1e['yamlConfig']['journeys']?.[0x0]?.[_0x233c3f(0x247)]||[];let _0x262988=_0x233c3f(0x214),_0x444684=_0x47603a;for(const _0x5e44ba of _0x4e5d57){if(_0x5e44ba[_0x233c3f(0x199)]?.[_0x233c3f(0x1e7)]===_0x47603a){_0x262988=_0x5e44ba[_0x233c3f(0x179)],_0x444684=_0x5e44ba[_0x233c3f(0x199)]['name']||_0x47603a;break;}}return _0x4de172[_0x233c3f(0x21a)](_0x47603a,{'definition':_0x38570a,'stageName':_0x262988,'criteriaName':_0x444684}),createPendingSegmentId(_0x47603a);}const _0x170af8=_0x588c1e[_0x233c3f(0x1bf)]?.['id'];if(!_0x170af8)throw new SDKError(ErrorCode[_0x233c3f(0x1ac)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x472bc4=_0x233c3f(0x251)+crypto[_0x233c3f(0x245)]();try{const _0x4a56e4=await _0x5793b9[_0x233c3f(0x1e7)][_0x233c3f(0x20b)]({'name':_0x472bc4,'description':_0x38570a[_0x233c3f(0x23e)]||_0x233c3f(0x25d)+_0x47603a,'journeyId':_0x170af8,'rule':yamlRuleToApi(_0x38570a[_0x233c3f(0x20c)],!![]),'countPopulation':!![],'parentFolderId':_0x17d9ba||'','audienceId':_0x2d104e});return _0x9a1cc5[_0x233c3f(0x1f9)]&&console[_0x233c3f(0x220)](_0x233c3f(0x1b8)+_0x47603a+_0x233c3f(0x169)+_0x472bc4+_0x233c3f(0x1d7)+_0x4a56e4),_0x427c03['set'](_0x47603a,_0x4a56e4),_0x4a56e4;}catch(_0x55e7d6){throw new SDKError(ErrorCode[_0x233c3f(0x1a5)],_0x233c3f(0x1eb)+_0x47603a+_0x233c3f(0x1c5)+getErrorMessage(_0x55e7d6),_0x55e7d6);}},'resolveActivationId':async _0x168e0c=>{const _0x17f557=_0x239b85,_0xa8be23=_0x2246a6[_0x17f557(0x189)](_0x168e0c);if(_0xa8be23)return _0xa8be23;if(_0x588c1e[_0x17f557(0x1bf)]){const _0x3286a9=await _0x5793b9['journey'][_0x17f557(0x1ad)](_0x588c1e[_0x17f557(0x1bf)]['id']),_0x20a25c=_0x3286a9['find'](_0x4997bb=>_0x4997bb[_0x17f557(0x194)][_0x17f557(0x16a)]?.[_0x17f557(0x179)]===_0x168e0c);if(_0x20a25c)return _0x2246a6[_0x17f557(0x21a)](_0x168e0c,_0x20a25c['id']),_0x20a25c['id'];}throw new SDKError(ErrorCode[_0x17f557(0x22f)],_0x17f557(0x1d9)+_0x168e0c+'\x20(referenced\x20in\x20journey\x20'+_0x588c1e[_0x17f557(0x202)]['name']+_0x17f557(0x234)+_0x17f557(0x211));},'resolveEmbeddedActivationId':async(_0x1ad973,_0x3464d4)=>{const _0x4f8aa3=_0x239b85,_0x25228a=_0x2246a6[_0x4f8aa3(0x189)](_0x1ad973);if(_0x25228a)return _0x25228a;if(_0x588c1e['isNew'])return _0x50ba04[_0x4f8aa3(0x21a)](_0x1ad973,_0x3464d4),createPendingActivationId(_0x1ad973);if(_0x588c1e['existingJourney']){const _0x2ecb8a=await _0x5793b9[_0x4f8aa3(0x1e1)]['listActivations'](_0x588c1e[_0x4f8aa3(0x1bf)]['id']),_0x374c77=_0x2ecb8a['find'](_0x241793=>_0x241793[_0x4f8aa3(0x194)]['activationParams']?.[_0x4f8aa3(0x179)]===_0x3464d4[_0x4f8aa3(0x179)]);if(_0x374c77)return _0x2246a6[_0x4f8aa3(0x21a)](_0x1ad973,_0x374c77['id']),_0x374c77['id'];try{const _0x2c37cb=yamlActivationToCreateRequest(_0x3464d4,_0x1516f5,_0x5b7934),_0x50b08f=await _0x5793b9[_0x4f8aa3(0x1e1)][_0x4f8aa3(0x22b)](_0x588c1e[_0x4f8aa3(0x1bf)]['id'],_0x2c37cb);return _0x9a1cc5['verbose']&&console['error'](_0x4f8aa3(0x233)+_0x1ad973+_0x4f8aa3(0x222)+_0x50b08f['id']),_0x2246a6[_0x4f8aa3(0x21a)](_0x1ad973,_0x50b08f['id']),_0x50b08f['id'];}catch(_0x5c58e4){throw new SDKError(ErrorCode[_0x4f8aa3(0x260)],'Failed\x20to\x20create\x20embedded\x20activation\x20\x27'+_0x1ad973+_0x4f8aa3(0x1c5)+getErrorMessage(_0x5c58e4),_0x5c58e4);}}throw new SDKError(ErrorCode[_0x4f8aa3(0x1ac)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x459bdc=>{const _0x3e3c04=_0x239b85;try{return await _0x5793b9[_0x3e3c04(0x1e1)][_0x3e3c04(0x224)](_0x2d104e,_0x459bdc);}catch(_0x1d0aa6){throw new SDKError(ErrorCode[_0x3e3c04(0x22f)],'Journey\x20\x27'+_0x459bdc+_0x3e3c04(0x1be)+_0x588c1e[_0x3e3c04(0x202)][_0x3e3c04(0x179)]+'\x27)',_0x1d0aa6);}},'resolveStageId':async(_0x32d0a8,_0x5e5fb7)=>{const _0x5a8ed9=_0x239b85,_0x2d92ca=await _0x5793b9[_0x5a8ed9(0x1e1)]['getJourney'](_0x32d0a8),_0x5df7d0=_0x2d92ca[_0x5a8ed9(0x194)][_0x5a8ed9(0x238)][_0x5a8ed9(0x216)](_0x3ad76a=>_0x3ad76a[_0x5a8ed9(0x179)][_0x5a8ed9(0x176)]()===_0x5e5fb7[_0x5a8ed9(0x176)]());if(!_0x5df7d0?.['id'])throw new SDKError(ErrorCode[_0x5a8ed9(0x22f)],_0x5a8ed9(0x1ed)+_0x5e5fb7+_0x5a8ed9(0x259)+(_0x2d92ca[_0x5a8ed9(0x194)]['journeyBundleName']||_0x2d92ca[_0x5a8ed9(0x194)][_0x5a8ed9(0x179)])+'\x27');return _0x5df7d0['id'];}};try{const _0x1a4548=await a36_0x18f4eb(_0x588c1e[_0x239b85(0x202)],_0x2d104e,_0x1e6f5d),_0x557596=_0x14fc5c||_0x17d9ba;_0x557596&&(_0x1a4548['relationships']={'parentFolder':{'data':{'id':_0x557596,'type':_0x239b85(0x242)}}});if(_0x588c1e[_0x239b85(0x20e)]){if(_0x4de172[_0x239b85(0x240)]>0x0||_0x50ba04['size']>0x0){const _0x2f69a8=JSON[_0x239b85(0x177)](JSON[_0x239b85(0x246)](_0x1a4548));ensureJourneyDefaults(_0x2f69a8[_0x239b85(0x194)]);for(const _0x5aaf8c of _0x2f69a8[_0x239b85(0x194)][_0x239b85(0x238)]){_0x5aaf8c[_0x239b85(0x204)]?.[_0x239b85(0x252)]&&isPendingSegmentId(_0x5aaf8c[_0x239b85(0x204)][_0x239b85(0x252)])&&delete _0x5aaf8c[_0x239b85(0x204)];if(_0x5aaf8c['steps'])for(const _0x199855 of Object[_0x239b85(0x21d)](_0x5aaf8c['steps'])){const _0xfdbf7e=_0x5aaf8c[_0x239b85(0x1b7)][_0x199855];_0xfdbf7e[_0x239b85(0x231)]===_0x239b85(0x1a0)&&_0xfdbf7e['journeyActivationStepId']&&isPendingActivationId(_0xfdbf7e[_0x239b85(0x24a)])&&(_0xfdbf7e[_0x239b85(0x24a)]='');if(_0xfdbf7e[_0x239b85(0x231)]===_0x239b85(0x1f4)&&_0xfdbf7e[_0x239b85(0x23d)])for(const _0x19499f of _0xfdbf7e[_0x239b85(0x23d)]){_0x19499f[_0x239b85(0x252)]&&isPendingSegmentId(_0x19499f[_0x239b85(0x252)])&&(_0x19499f['segmentId']='');}}}_0x9a1cc5[_0x239b85(0x1f9)]&&console[_0x239b85(0x220)](_0x239b85(0x1cb)+JSON['stringify'](_0x2f69a8,null,0x2));const _0x510261=await _0x5793b9[_0x239b85(0x1e1)][_0x239b85(0x226)](_0x2f69a8),_0x20f4f9=_0x510261['id'],_0x1d4560=new Map();for(const _0x3de940 of _0x510261[_0x239b85(0x194)][_0x239b85(0x238)]){_0x1d4560[_0x239b85(0x21a)](_0x3de940[_0x239b85(0x179)][_0x239b85(0x176)](),_0x3de940['id']);}const _0x19c074=new Map();for(const [_0x391ede,{definition:_0x1fb793,criteriaName:_0x83a3fb}]of _0x4de172){const _0x2ea868=generateJourneyLocalName(_0x83a3fb)||_0x239b85(0x251)+crypto[_0x239b85(0x245)]();_0x9a1cc5[_0x239b85(0x1f9)]&&console[_0x239b85(0x220)](_0x239b85(0x1e4)+_0x391ede+_0x239b85(0x169)+_0x2ea868+_0x239b85(0x1db)+_0x20f4f9);const _0x5157a3=await _0x5793b9['segment'][_0x239b85(0x20b)]({'name':_0x2ea868,'description':_0x1fb793['description']||_0x239b85(0x25d)+_0x391ede,'journeyId':_0x20f4f9,'rule':yamlRuleToApi(_0x1fb793[_0x239b85(0x20c)],!![]),'countPopulation':!![],'parentFolderId':_0x557596||'','audienceId':_0x2d104e});_0x19c074['set'](_0x391ede,_0x5157a3),_0x427c03['set'](_0x391ede,_0x5157a3),_0x9a1cc5[_0x239b85(0x1f9)]&&console[_0x239b85(0x220)](_0x239b85(0x1b8)+_0x391ede+_0x239b85(0x222)+_0x5157a3);}const _0x59200a=new Map();for(const [_0x3b49b9,_0x4d06d7]of _0x50ba04){_0x9a1cc5['verbose']&&console['error'](_0x239b85(0x1a7)+_0x3b49b9+'\x27\x20with\x20journeyId:\x20'+_0x20f4f9);try{const _0x227883=yamlActivationToCreateRequest(_0x4d06d7,_0x1516f5,_0x5b7934),_0x50d15f=await _0x5793b9[_0x239b85(0x1e1)][_0x239b85(0x22b)](_0x20f4f9,_0x227883);_0x59200a[_0x239b85(0x21a)](_0x3b49b9,_0x50d15f['id']),_0x2246a6[_0x239b85(0x21a)](_0x3b49b9,_0x50d15f['id']),_0x9a1cc5[_0x239b85(0x1f9)]&&console[_0x239b85(0x220)](_0x239b85(0x233)+_0x3b49b9+_0x239b85(0x222)+_0x50d15f['id']);}catch(_0x184a10){throw new SDKError(ErrorCode[_0x239b85(0x260)],_0x239b85(0x1e8)+_0x3b49b9+'\x27:\x20'+getErrorMessage(_0x184a10),_0x184a10);}}const _0x402fcd=JSON[_0x239b85(0x177)](JSON['stringify'](_0x1a4548));_0x402fcd['id']=_0x20f4f9,ensureJourneyDefaults(_0x402fcd[_0x239b85(0x194)]);for(const _0x55c41a of _0x402fcd[_0x239b85(0x194)][_0x239b85(0x238)]){const _0x35725d=_0x1d4560[_0x239b85(0x189)](_0x55c41a[_0x239b85(0x179)][_0x239b85(0x176)]());_0x35725d&&(_0x55c41a['id']=_0x35725d);if(_0x55c41a[_0x239b85(0x204)]?.[_0x239b85(0x252)]&&isPendingSegmentId(_0x55c41a['entryCriteria']['segmentId'])){const _0x485534=extractPendingSegmentName(_0x55c41a[_0x239b85(0x204)][_0x239b85(0x252)]),_0x4a42df=_0x19c074[_0x239b85(0x189)](_0x485534);_0x4a42df&&(_0x55c41a[_0x239b85(0x204)][_0x239b85(0x252)]=_0x4a42df);}if(_0x55c41a['steps']){const _0x38e388=_0x124748=>_0x1a4548[_0x239b85(0x194)][_0x239b85(0x238)]['find'](_0x58a66b=>_0x58a66b[_0x239b85(0x179)][_0x239b85(0x176)]()===_0x55c41a['name']['toLowerCase']())?.['steps']?.[_0x124748];for(const _0x32558f of Object[_0x239b85(0x21d)](_0x55c41a[_0x239b85(0x1b7)])){const _0x4d2878=_0x55c41a['steps'][_0x32558f],_0x48cbb8=_0x38e388(_0x32558f);if(_0x4d2878[_0x239b85(0x231)]===_0x239b85(0x1a0)&&_0x4d2878[_0x239b85(0x24a)]&&(isPendingActivationId(_0x4d2878[_0x239b85(0x24a)])||_0x4d2878['journeyActivationStepId']==='')){if(_0x48cbb8?.[_0x239b85(0x24a)]&&isPendingActivationId(_0x48cbb8[_0x239b85(0x24a)])){const _0x5221dd=extractPendingActivationName(_0x48cbb8[_0x239b85(0x24a)]),_0x2c6740=_0x59200a['get'](_0x5221dd);_0x2c6740&&(_0x4d2878[_0x239b85(0x24a)]=_0x2c6740);}}if(_0x4d2878['type']===_0x239b85(0x1f4)&&_0x4d2878['branches']&&_0x48cbb8?.[_0x239b85(0x23d)])for(let _0x29826b=0x0;_0x29826b<_0x4d2878[_0x239b85(0x23d)][_0x239b85(0x1b4)];_0x29826b++){const _0x58f753=_0x4d2878['branches'][_0x29826b],_0x369b97=_0x48cbb8[_0x239b85(0x23d)][_0x29826b];if(_0x369b97?.[_0x239b85(0x252)]&&isPendingSegmentId(_0x369b97[_0x239b85(0x252)])){const _0x586f91=extractPendingSegmentName(_0x369b97[_0x239b85(0x252)]),_0x259b8a=_0x19c074[_0x239b85(0x189)](_0x586f91);_0x259b8a&&(_0x58f753[_0x239b85(0x252)]=_0x259b8a);}}}}}return _0x9a1cc5[_0x239b85(0x1f9)]&&console['error'](_0x239b85(0x19e)+JSON[_0x239b85(0x246)](_0x402fcd,null,0x2)),await _0x5793b9[_0x239b85(0x1e1)][_0x239b85(0x24b)](_0x20f4f9,_0x402fcd),{'action':_0x239b85(0x20a),'name':_0x588c1e['yamlConfig'][_0x239b85(0x179)],'journeyId':_0x20f4f9};}else{ensureJourneyDefaults(_0x1a4548['attributes']);_0x9a1cc5[_0x239b85(0x1f9)]&&console['error'](_0x239b85(0x1e6)+JSON[_0x239b85(0x246)](_0x1a4548,null,0x2));const _0x5f54df=await _0x5793b9[_0x239b85(0x1e1)][_0x239b85(0x226)](_0x1a4548);return{'action':_0x239b85(0x20a),'name':_0x588c1e['yamlConfig'][_0x239b85(0x179)],'journeyId':_0x5f54df['id']};}}else{if(_0x588c1e[_0x239b85(0x256)]&&_0x588c1e['existingJourney'])return ensureJourneyDefaults(_0x1a4548[_0x239b85(0x194)]),await _0x5793b9[_0x239b85(0x1e1)]['update'](_0x588c1e['existingJourney']['id'],_0x1a4548),{'action':_0x239b85(0x1e0),'name':_0x588c1e[_0x239b85(0x202)]['name'],'journeyId':_0x588c1e['existingJourney']['id']};}return{'action':_0x239b85(0x25b),'name':_0x588c1e[_0x239b85(0x202)]['name'],'journeyId':_0x588c1e[_0x239b85(0x1bf)]?.['id']};}catch(_0x43d982){const _0x195724=isHttp400Error(_0x43d982),_0x425968=_0x195724?ErrorCode[_0x239b85(0x1d3)]:ErrorCode[_0x239b85(0x260)],_0x5a6b5f=getErrorMessage(_0x43d982);throw new SDKError(_0x425968,_0x239b85(0x18e)+(_0x588c1e[_0x239b85(0x20e)]?_0x239b85(0x226):_0x239b85(0x24b))+_0x239b85(0x182)+_0x588c1e[_0x239b85(0x1a4)]+'\x0a\x20\x20'+_0x5a6b5f,_0x43d982);}}));_0x58d8a6[_0x42653d(0x1a2)](..._0x588d99),_0x3e5cd3+=_0x566315[_0x42653d(0x1b4)],_0x42162c[_0x42653d(0x227)]('('+_0x3e5cd3+'/'+_0x4ecc55[_0x42653d(0x1b4)]+')');}return _0x58d8a6;},{'verbose':_0x9a1cc5[_0x25e0ba(0x1f9)]});for(const _0x2a27eb of _0x4b53d5[_0x25e0ba(0x1bb)]){if(_0x2a27eb[_0x25e0ba(0x1f6)]==='created')console['error'](a36_0x54932d[_0x25e0ba(0x1c6)](_0x25e0ba(0x249)+_0x2a27eb[_0x25e0ba(0x179)]+'\x27')),_0x5495d0++;else _0x2a27eb[_0x25e0ba(0x1f6)]==='updated'&&(console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x1cd)](_0x25e0ba(0x241)+_0x2a27eb[_0x25e0ba(0x179)]+'\x27')),_0x2af5da++);}if(_0x24ed3e&&_0x4b53d5['data'][_0x25e0ba(0x1b4)]===0x1){const _0x33fd09=_0x4b53d5[_0x25e0ba(0x1bb)][0x0];if(_0x33fd09['journeyId']){const _0x250ebe=getConsoleNextUrl(_0x9a1cc5['site'],'/app/ps/'+_0x2d104e+_0x25e0ba(0x1bd)+_0x33fd09[_0x25e0ba(0x262)]+_0x25e0ba(0x1ca));console[_0x25e0ba(0x220)]('\x20\x20'+a36_0x54932d[_0x25e0ba(0x1d5)](_0x250ebe));}}}for(const _0x57761a of _0x3e0feb){console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x1cd)]('⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20'+_0x57761a[_0x25e0ba(0x205)])),_0x394fa4++;}const _0x2f5cb5=[];if(_0x396bcc>0x0)_0x2f5cb5[_0x25e0ba(0x1a2)](_0x396bcc+_0x25e0ba(0x195));if(_0x5e3f71>0x0)_0x2f5cb5['push'](_0x5e3f71+_0x25e0ba(0x243));if(_0x4b3f14>0x0)_0x2f5cb5[_0x25e0ba(0x1a2)](_0x4b3f14+_0x25e0ba(0x1b5));const _0x9c7767=[];if(_0x5495d0>0x0)_0x9c7767[_0x25e0ba(0x1a2)](_0x5495d0+_0x25e0ba(0x195));if(_0x2af5da>0x0)_0x9c7767[_0x25e0ba(0x1a2)](_0x2af5da+_0x25e0ba(0x243));if(_0x394fa4>0x0)_0x9c7767['push'](_0x394fa4+_0x25e0ba(0x1b5));const _0x125c25=[];if(_0x32af90>0x0)_0x125c25[_0x25e0ba(0x1a2)](_0x32af90+_0x25e0ba(0x195));if(_0x343e01>0x0)_0x125c25[_0x25e0ba(0x1a2)](_0x343e01+_0x25e0ba(0x243));if(_0x4fde80>0x0)_0x125c25[_0x25e0ba(0x1a2)](_0x4fde80+'\x20deleted');return console[_0x25e0ba(0x220)](a36_0x54932d[_0x25e0ba(0x1c6)](_0x25e0ba(0x254))),_0x2f5cb5['length']>0x0&&!_0x9a1cc5[_0x25e0ba(0x20f)]&&console['error'](_0x25e0ba(0x21b)+_0x2f5cb5[_0x25e0ba(0x1af)](',\x20')),_0x9c7767[_0x25e0ba(0x1b4)]>0x0&&console[_0x25e0ba(0x220)](_0x25e0ba(0x263)+_0x9c7767['join'](',\x20')),_0x125c25[_0x25e0ba(0x1b4)]>0x0&&!_0x9a1cc5[_0x25e0ba(0x20f)]&&console[_0x25e0ba(0x220)]('\x20\x20Activations:\x20'+_0x125c25[_0x25e0ba(0x1af)](',\x20')),0x0;}}function buildFolderPathToIdMap(_0xad195a){const _0x550775=a36_0x59c5e1,_0x5bf768=new Map(),_0x5b5192=new Map();for(const _0x34a354 of _0xad195a){_0x5b5192[_0x550775(0x21a)](_0x34a354['id'],_0x34a354);}const _0xfc537f=new Set();for(const _0x963a06 of _0xad195a){!_0x963a06[_0x550775(0x235)]&&_0xfc537f[_0x550775(0x232)](_0x963a06['id']);}function _0xc75d18(_0x12823b){const _0x5b1b0a=_0x550775;if(_0xfc537f[_0x5b1b0a(0x21f)](_0x12823b['id']))return'';if(_0x12823b[_0x5b1b0a(0x235)]){const _0x1e40d0=_0x5b5192[_0x5b1b0a(0x189)](_0x12823b['parentFolderId']);if(_0x1e40d0){const _0x1fe6cf=_0xc75d18(_0x1e40d0);return _0x1fe6cf?_0x1fe6cf+'/'+_0x12823b[_0x5b1b0a(0x179)]:_0x12823b[_0x5b1b0a(0x179)];}}return _0x12823b[_0x5b1b0a(0x179)];}for(const _0x188e44 of _0xad195a){const _0x44559d=_0xc75d18(_0x188e44);_0x5bf768['set'](_0x44559d,_0x188e44['id']);}return _0x5bf768;}function findYamlFiles(_0x2918e5){const _0xf57dc4=[];function _0x944a9c(_0x273dab){const _0x23aebd=a36_0x2d4a,_0x3b214c=readdirSync(_0x273dab,{'withFileTypes':!![]});for(const _0x568f60 of _0x3b214c){const _0x12944b=a36_0x475838[_0x23aebd(0x1af)](_0x273dab,_0x568f60[_0x23aebd(0x179)]);if(_0x568f60['isDirectory']())_0x944a9c(_0x12944b);else(_0x568f60[_0x23aebd(0x179)]['endsWith'](_0x23aebd(0x1c9))||_0x568f60[_0x23aebd(0x179)][_0x23aebd(0x175)](_0x23aebd(0x1fc)))&&_0xf57dc4[_0x23aebd(0x1a2)](_0x12944b);}}return _0x944a9c(_0x2918e5),_0xf57dc4;}function calculateActivationActions(_0x17674b,_0x5bba71,_0x57f11f,_0x1f4bb5){const _0x542d11=a36_0x59c5e1,_0x95a15f=[],_0x218fa1=new Map();for(const _0xb1abed of _0x5bba71){_0x218fa1[_0x542d11(0x21a)](_0xb1abed[_0x542d11(0x179)],_0xb1abed);}const _0x361b27=new Map();for(const _0x5821f8 of _0x17674b){_0x361b27[_0x542d11(0x21a)](_0x5821f8['name'],_0x5821f8);}for(const _0x36c200 of _0x17674b){const _0x44d174=_0x218fa1[_0x542d11(0x189)](_0x36c200[_0x542d11(0x179)]);if(!_0x44d174)_0x95a15f[_0x542d11(0x1a2)]({'type':_0x542d11(0x226),'name':_0x36c200[_0x542d11(0x179)],'yamlActivation':_0x36c200});else{const _0x12bfea=activationToYaml(_0x44d174,_0x57f11f,_0x1f4bb5),_0x39ba83=a36_0x147f4c['stringify'](_0x12bfea),_0x42d5e8=a36_0x147f4c[_0x542d11(0x246)](_0x36c200);_0x39ba83!==_0x42d5e8&&_0x95a15f[_0x542d11(0x1a2)]({'type':_0x542d11(0x24b),'name':_0x36c200[_0x542d11(0x179)],'yamlActivation':_0x36c200,'existingActivation':_0x44d174});}}for(const _0x5b475c of _0x5bba71){!_0x361b27[_0x542d11(0x21f)](_0x5b475c[_0x542d11(0x179)])&&_0x95a15f['push']({'type':'delete','name':_0x5b475c['name'],'existingActivation':_0x5b475c});}return _0x95a15f;}
|
|
1
|
+
const a36_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
|
|
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;}}
|