@treasuredata/tdx 2026.3.5 → 2026.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.d.ts.map +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/auth-command.js.map +1 -1
- package/dist/commands/auth-login-command.d.ts +29 -0
- package/dist/commands/auth-login-command.d.ts.map +1 -0
- package/dist/commands/auth-login-command.js +1 -0
- package/dist/commands/auth-login-command.js.map +1 -0
- 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/databases.js +1 -1
- package/dist/commands/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.d.ts.map +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/mcp-command.js.map +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.d.ts.map +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profile-command.js.map +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-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/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.d.ts.map +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/status-command.js.map +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/upgrade-command.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/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.d.ts +11 -0
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/constants.js.map +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.d.ts.map +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/global-context.js.map +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/oauth-keychain.d.ts +32 -0
- package/dist/core/oauth-keychain.d.ts.map +1 -0
- package/dist/core/oauth-keychain.js +1 -0
- package/dist/core/oauth-keychain.js.map +1 -0
- package/dist/core/oauth.d.ts +112 -0
- package/dist/core/oauth.d.ts.map +1 -0
- package/dist/core/oauth.js +1 -0
- package/dist/core/oauth.js.map +1 -0
- 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/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/endpoints.js.map +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/oauth-refresh.d.ts +16 -0
- package/dist/sdk/client/oauth-refresh.d.ts.map +1 -0
- package/dist/sdk/client/oauth-refresh.js +1 -0
- package/dist/sdk/client/oauth-refresh.js.map +1 -0
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.js +1 -1
- package/dist/sdk/engage/types/template-schema.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/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.d.ts.map +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/llm/model-factors.js.map +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.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/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.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-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a139_0x5349(){const _0x1001b7=['86232Uovqkx','tdx.sdk.push-recovery','ENOENT','2TCrwyE','1224594RqiHVb','join','92199WJBgPq','segments','version','toISOString','debug','dirname','36995zHefIJ','journeyName','basename','stringify','Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20','.tmp','747QDOUvH','335024phWvXy','warn','1879104urTryb','parse','Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20','.push-recovery.json','28000VSQYLb','15IDfrnV'];a139_0x5349=function(){return _0x1001b7;};return a139_0x5349();}const a139_0x488f49=a139_0x1e65;(function(_0x723e8,_0x3a6128){const _0x341556=a139_0x1e65,_0x1120fd=_0x723e8();while(!![]){try{const _0x281980=parseInt(_0x341556(0xe8))/0x1+-parseInt(_0x341556(0xdf))/0x2*(-parseInt(_0x341556(0xe2))/0x3)+-parseInt(_0x341556(0xd3))/0x4+parseInt(_0x341556(0xdb))/0x5*(-parseInt(_0x341556(0xdc))/0x6)+parseInt(_0x341556(0xe0))/0x7+parseInt(_0x341556(0xd5))/0x8+parseInt(_0x341556(0xd2))/0x9*(-parseInt(_0x341556(0xda))/0xa);if(_0x281980===_0x3a6128)break;else _0x1120fd['push'](_0x1120fd['shift']());}catch(_0x1aa3b8){_0x1120fd['push'](_0x1120fd['shift']());}}}(a139_0x5349,0x1ce0e));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';import a139_0x2915e0 from'path';function a139_0x1e65(_0x5e24c7,_0x1deb93){_0x5e24c7=_0x5e24c7-0xd0;const _0x534991=a139_0x5349();let _0x1e65c7=_0x534991[_0x5e24c7];return _0x1e65c7;}import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a139_0x488f49(0xdd));export function getPushRecoveryPath(_0x267548){const _0x4092bd=a139_0x488f49,_0x30ee78=a139_0x2915e0[_0x4092bd(0xe7)](_0x267548),_0x5466e3=a139_0x2915e0[_0x4092bd(0xea)](_0x267548);return a139_0x2915e0[_0x4092bd(0xe1)](_0x30ee78,'.'+_0x5466e3+_0x4092bd(0xd9));}export function readPushRecovery(_0x4fa805){const _0x29ef92=a139_0x488f49,_0x44f213=getPushRecoveryPath(_0x4fa805);if(!existsSync(_0x44f213))return undefined;try{const _0x5adaef=readFileSync(_0x44f213,'utf-8'),_0x1cca3b=JSON[_0x29ef92(0xd6)](_0x5adaef);if(_0x1cca3b?.[_0x29ef92(0xe4)]!==0x1||typeof _0x1cca3b[_0x29ef92(0xe9)]!=='string')return undefined;return _0x1cca3b;}catch(_0x106759){return _0x106759 instanceof SyntaxError?logger[_0x29ef92(0xe6)](_0x29ef92(0xd8)+_0x106759):logger[_0x29ef92(0xd4)](_0x29ef92(0xd7)+_0x106759),undefined;}}export function writePushRecovery(_0xac9e92,_0x5433d8){const _0x44a91a=a139_0x488f49,_0x27e170=getPushRecoveryPath(_0xac9e92),_0xdd47c5=_0x27e170+_0x44a91a(0xd1);writeFileSync(_0xdd47c5,JSON[_0x44a91a(0xeb)](_0x5433d8,null,0x2)+'\x0a','utf-8'),renameSync(_0xdd47c5,_0x27e170);}export function deletePushRecovery(_0x1ee9a1){const _0x9f110d=a139_0x488f49,_0x2550fa=getPushRecoveryPath(_0x1ee9a1);try{unlinkSync(_0x2550fa);}catch(_0x3ab970){_0x3ab970['code']!==_0x9f110d(0xde)&&logger[_0x9f110d(0xe6)](_0x9f110d(0xd0)+_0x3ab970);}}export function saveSegmentToPushRecovery(_0x51c3ed,_0x5c6601,_0x3fe96c,_0xd8dd88){const _0x5d0b17=a139_0x488f49,_0x3b941f=readPushRecovery(_0x51c3ed),_0x50f018=_0x3b941f?.[_0x5d0b17(0xe9)]===_0x5c6601?{..._0x3b941f,'updatedAt':new Date()[_0x5d0b17(0xe5)]()}:{'version':0x1,'journeyName':_0x5c6601,'updatedAt':new Date()[_0x5d0b17(0xe5)](),'segments':{}};_0x50f018[_0x5d0b17(0xe3)][_0x3fe96c]=_0xd8dd88,writePushRecovery(_0x51c3ed,_0x50f018);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a136_0x3aef17=a136_0x39b7;(function(_0x18f438,_0x58e13d){const _0x2542e9=a136_0x39b7,_0x5317a6=_0x18f438();while(!![]){try{const _0x1c1cbe=parseInt(_0x2542e9(0x14b))/0x1+parseInt(_0x2542e9(0xee))/0x2*(parseInt(_0x2542e9(0x139))/0x3)+-parseInt(_0x2542e9(0xc4))/0x4+parseInt(_0x2542e9(0x16c))/0x5*(parseInt(_0x2542e9(0x162))/0x6)+parseInt(_0x2542e9(0xc8))/0x7*(-parseInt(_0x2542e9(0xfa))/0x8)+-parseInt(_0x2542e9(0x11e))/0x9*(-parseInt(_0x2542e9(0x10a))/0xa)+parseInt(_0x2542e9(0x131))/0xb*(parseInt(_0x2542e9(0x12e))/0xc);if(_0x1c1cbe===_0x58e13d)break;else _0x5317a6['push'](_0x5317a6['shift']());}catch(_0x2e6440){_0x5317a6['push'](_0x5317a6['shift']());}}}(a136_0x111c,0x69e05));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a136_0x3aef17(0x16d));export const PENDING_SEGMENT_PREFIX=a136_0x3aef17(0x11a);export const PENDING_ACTIVATION_PREFIX='__pending_act_';export function createPendingSegmentId(_0x47c0ef){return''+PENDING_SEGMENT_PREFIX+_0x47c0ef+'__';}export function isPendingSegmentId(_0x2c04db){const _0xfe9b24=a136_0x3aef17;return _0x2c04db['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x2c04db[_0xfe9b24(0x140)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x174439){const _0x29c890=a136_0x3aef17;return _0x174439[_0x29c890(0xe0)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x3c18c0){return''+PENDING_ACTIVATION_PREFIX+_0x3c18c0+'__';}export function isPendingActivationId(_0x1e11a7){const _0x538bbb=a136_0x3aef17;return _0x1e11a7[_0x538bbb(0x140)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x3e5c48){const _0x3ddcec=a136_0x3aef17;return _0x3e5c48[_0x3ddcec(0xe0)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x1eb2c2,_0x233790){const _0x26866e=a136_0x3aef17,_0x484105=_0x1eb2c2+'::'+(_0x233790[_0x26866e(0x181)]()||_0x26866e(0xa3)),_0x4d7946=createHash('sha1')[_0x26866e(0x137)](_0x484105)['digest'](_0x26866e(0x118))['slice'](0x0,0xc);return _0x26866e(0x174)+_0x4d7946;}export function ensureJourneyDefaults(_0x35af9b){const _0x50c4e5=a136_0x3aef17;!_0x35af9b[_0x50c4e5(0x16b)]&&(_0x35af9b[_0x50c4e5(0x16b)]=''),!_0x35af9b['state']&&(_0x35af9b[_0x50c4e5(0x142)]=_0x50c4e5(0x105));}export function injectExistingStageIds(_0x2fa5f1,_0x530438){const _0x2bc768=a136_0x3aef17,_0x6feabb=new Map(_0x530438['map'](_0x4429db=>[_0x4429db['name'],_0x4429db['id']]));for(const _0x3667e2 of _0x2fa5f1){if(!_0x3667e2['id']){const _0x2e68b2=_0x6feabb[_0x2bc768(0xe9)](_0x3667e2[_0x2bc768(0xfc)]);_0x2e68b2&&(_0x3667e2['id']=_0x2e68b2);}}}export function resolveTDFolderPath(_0x4885d1,_0x1b9e8d,_0x579f99){const _0x589412=a136_0x3aef17;if(!_0x1b9e8d)return _0x4885d1;if(_0x4885d1===_0x579f99||_0x4885d1[_0x589412(0x140)](_0x579f99+'/'))return _0x4885d1;return _0x4885d1?_0x579f99+'/'+_0x4885d1:_0x579f99;}export function addFoldersToCreate(_0x2629ad,_0x4b5f84,_0x3c948a){const _0x240d59=a136_0x3aef17;if(!_0x2629ad)return;if(_0x4b5f84[_0x240d59(0x132)](_0x2629ad))return;const _0x532453=_0x2629ad[_0x240d59(0xec)]('/');let _0x2e7972='';for(const _0x3c427c of _0x532453){_0x2e7972=_0x2e7972?_0x2e7972+'/'+_0x3c427c:_0x3c427c,!_0x4b5f84[_0x240d59(0x132)](_0x2e7972)&&_0x3c948a[_0x240d59(0x99)](_0x2e7972);}}export function sortFoldersByDepth(_0x4f8d50){const _0x1f69b2=a136_0x3aef17;return[..._0x4f8d50][_0x1f69b2(0x157)]((_0x90ab5,_0x3758f3)=>{const _0x13e5eb=_0x1f69b2,_0x325433=(_0x90ab5[_0x13e5eb(0x148)](/\//g)||[])['length'],_0x2b4858=(_0x3758f3['match'](/\//g)||[])[_0x13e5eb(0x93)];return _0x325433-_0x2b4858;});}import*as a136_0x42129b from'yaml';import{readFileSync}from'fs';import a136_0x2cf61d from'path';import{isJourneyDef,parseYamlString as a136_0x52b19f,toYamlString as a136_0x3b10e7,normalizeJourneyDef,hasMultipleVersions,journeyResponseToDef,collectSegmentIdsFromJourneyApi}from'./journey-yaml.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,createJumpTargetCache,resolveJumpTarget,buildMergedJourneyDef,buildLocalRuleToNameMappingFromJourney,collectSegmentUsageCounts}from'./journey-utils.js';import{activationResponseToDef,segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,apiRuleToYaml,yamlRuleToApi,serializeExpandedRule,collectSegmentRefsFromRule,resolveRuleSegmentRefs,resolveRuleSegmentIds,journeyActivationStepToYaml}from'./child-segment-yaml.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';function a136_0x39b7(_0x16f507,_0x5a0a80){_0x16f507=_0x16f507-0x90;const _0x111cd0=a136_0x111c();let _0x39b734=_0x111cd0[_0x16f507];return _0x39b734;}import{batchAsync}from'../../utils/async.js';function a136_0x111c(){const _0x389c9c=['journeyActivationStepId','getSegment','goal','\x20journey\x20from\x20file:\x20','hex','\x20error(s)','__pending_','reduce','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','):\x20','108ytZHuZ','relationships','max','run_after_journey_refresh','folderPath','waitStepType','listActivations','activation_updated','parentId','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','branches','activationActions','toLowerCase','existingSegments','segmentId','logSuccess','4406808giedol','entryCriteria','size','22HDevgT','has','created','decision_point','find','notification','update','entries','1317arMcqb','embedded_segment_created','JOURNEY_SYNTAX_ERROR','fetchJourney','\x27\x20exit\x20criteria','conditionTimeoutDuration','getJourney','startsWith','diff','state','activationStepsById','map','./child-segment-yaml.js','isNew','Deleted\x20segment\x20\x27','match','segmentFolderId','withProgress','738763WCXJhe','\x27\x20milestone','existingJourney','segment_deleted','verbose','values','data','getSegmentEntity','WaitStep','Embedded\x20segment\x20\x27','segmentNameToId','SEGMENT_NOT_FOUND','sort','\x20activation\x20\x27','createJourneySegment','embedded_activation_creating','\x27\x20from\x20file:\x20','Matched\x20server\x20segment\x20\x27','createFolder','journeyBundleName','deleted','parseDocument','Creating\x20folder\x20\x27','593874BloQTc','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','existingActivation','action','delete','keys','conditionSegmentId','attributes',').\x20','description','5RHMccA','tdx.sdk.push-workflow','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','with','user','valid','day','Creating\x20segment\x20\x27','journey_entry_criteria_','Condition','isArray','connection','logDeleted','journey_updated','journeys','Delete\x20the\x20push\x20recovery\x20file\x20(','embedded_segment_creating','Updating\x20activation\x20\x27','ACTIVATION_UPDATE_ERROR','list','\x20(referenced\x20in\x20journey\x20','trim','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','existingSegment','activation_deleting','stringify','goal\x20criteria','createdSegmentId','effectiveFolderId','deps','index','activationParams','exitCriterias','idToName','push','onProgress','resolvedRule','deleteSegment','nameToId','segments','Updating\x20segment\x20\x27','\x27...','\x27\x20decision\x20point\x20branch\x20\x27','rootFolderId','folder','errors','\x27\x20entry\x20criteria','activationsBySegmentId','uniqueServerName','Failed\x20to\x20fetch\x20referenced\x20segment\x20','getSegmentEntity\x20also\x20failed\x20for\x20','length','versionNumber','entry_criteria','connector_config','stages','all','add','object','\x0a\x20\x20','getSegment\x20failed\x20for\x20','results','Segment\x20not\x20found','Duration','Entry\x20criteria:\x20','activations','\x27\x20wait\x20condition','segment','steps','activationContext','createdSegmentIds','Journey\x20\x27','Created\x20activation\x20\x27','conditionTimeoutUnit','stage\x20\x27','journeyStages','parentSegmentFolder','journeyById','activation_template_id','segment_created','journey_created','journeyBundlesByFolderAndName','idToEmailMap','and\x20the\x20server\x20segment,\x20then\x20retry.','Deleted\x20activation\x20\x27','Stage\x20\x27','Name\x20has\x20already\x20been\x20taken','yamlConfig','milestone','Failed\x20to\x20','Segment\x20not\x20found:\x20','dirname','waitStep','Updated\x20journey\x20\x27','type','createActivation','\x27\x20not\x20found\x20in\x20journey\x20\x27','set','create','toISOString','3266152JxwssK','updateSegmentById','journey_creating','segment_deleting','1631RYqyGq','DecisionPoint','updated','toString','schedule','nameToType','Failed\x20to\x20resolve\x20segment\x20','.$1.push-recovery.json','slice','journey','Activation\x20not\x20found:\x20','segment_creating','connectionIdToNameMap','embeddedSegmentNameToId','journeyId','folderPathToId','NOT_FOUND','SEGMENT_SYNTAX_ERROR','hasChanges','INTERNAL',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','resolveJourneyId','\x20segment\x20from\x20file:\x20','localName','replace','unchanged','folder_creating','behavior','columns','journeyName','uniqueSegmentName','Creating\x20activation\x20\x27','message','get','yamlActivation','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','split','from','1068alqfMd','conditions','rule','../../utils/async.js','some','parse','absolutePath','SEGMENT_UPDATE_ERROR','relative','journey_updating','\x27\x20to\x20local\x20\x27','skipSegments','19144NsOHWv','all_columns','name','\x27\x20for\x20','item','Deleting\x20activation\x20\x27','getActivation','debug','Created\x20journey\x20\x27','entry','./journey-yaml.js','draft','includes','progress','segmentByFolderAndName','waitStepUnit','950KVldoB','folderId','activation_deleted','join','filter','validatedRequest','activation_creating','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','Fetching\x20','utf-8'];a136_0x111c=function(){return _0x389c9c;};return a136_0x111c();}import{buildFolderMaps}from'./resolution-context.js';import{SDKError,ErrorCode,isHttp400Error,getErrorMessage}from'../errors.js';import{readPushRecovery,saveSegmentToPushRecovery,deletePushRecovery}from'./push-recovery.js';import{validateSegmentDef,formatValidationResult}from'./yaml-validator.js';import{validateJourneyDef}from'./journey-validator.js';function stableStringify(_0xe81b00){const _0x54fb53=a136_0x3aef17;if(Array[_0x54fb53(0x176)](_0xe81b00))return'['+_0xe81b00[_0x54fb53(0x144)](_0x3ee7e7=>stableStringify(_0x3ee7e7))[_0x54fb53(0x10d)](',')+']';if(_0xe81b00&&typeof _0xe81b00===_0x54fb53(0x9a)){const _0x3cb061=_0xe81b00,_0x5b56ca=Object['keys'](_0x3cb061)[_0x54fb53(0x157)](),_0x7a6a34=_0x5b56ca[_0x54fb53(0x144)](_0x13016f=>'\x22'+_0x13016f+'\x22:'+stableStringify(_0x3cb061[_0x13016f]));return'{'+_0x7a6a34['join'](',')+'}';}const _0x12c603=JSON[_0x54fb53(0x185)](_0xe81b00);return _0x12c603===undefined?'null':_0x12c603;}function activationSignature(_0x46ef42){const _0x6ecb1e=a136_0x3aef17,_0x55f4f5={'connection':_0x46ef42[_0x6ecb1e(0x177)],..._0x46ef42[_0x6ecb1e(0xfb)]!==undefined&&{'all_columns':_0x46ef42[_0x6ecb1e(0xfb)]},..._0x46ef42[_0x6ecb1e(0xe4)]!==undefined&&{'columns':_0x46ef42['columns']},..._0x46ef42[_0x6ecb1e(0xe3)]!==undefined&&{'behavior':_0x46ef42[_0x6ecb1e(0xe3)]},..._0x46ef42['schedule']!==undefined&&{'schedule':_0x46ef42[_0x6ecb1e(0xcc)]},..._0x46ef42[_0x6ecb1e(0x136)]!==undefined&&{'notification':_0x46ef42['notification']},..._0x46ef42[_0x6ecb1e(0x96)]!==undefined&&{'connector_config':_0x46ef42['connector_config']},..._0x46ef42[_0x6ecb1e(0xae)]!==undefined&&{'activation_template_id':_0x46ef42[_0x6ecb1e(0xae)]}};return stableStringify(_0x55f4f5);}async function fetchSegment(_0x1aaabc,_0x38e1b7,_0x5583cc,_0x23b6de){const _0x194c56=a136_0x3aef17,_0x47fed7=_0x23b6de?.[_0x194c56(0x135)](_0x4fe3a0=>_0x4fe3a0['id']===_0x5583cc);if(_0x47fed7)return _0x47fed7;try{return await _0x1aaabc['segment'][_0x194c56(0x115)](_0x38e1b7,_0x5583cc);}catch(_0x220b51){logger[_0x194c56(0x101)](_0x194c56(0x9c)+_0x5583cc+_0x194c56(0xdc)+_0x220b51);try{return await _0x1aaabc[_0x194c56(0xa3)][_0x194c56(0x152)](_0x5583cc);}catch(_0x341e2f){return logger[_0x194c56(0x101)](_0x194c56(0x92)+_0x5583cc+':\x20'+_0x341e2f),null;}}}function recoverSegmentIdsFromPushRecovery(_0x44ea52,_0x36fa9d,_0x4b2154){const _0x4a746b=a136_0x3aef17,_0x44af6d=readPushRecovery(_0x44ea52[_0x4a746b(0xf4)]);if(_0x44af6d?.[_0x4a746b(0xe5)]===_0x44ea52[_0x4a746b(0xb7)]['name'])for(const [_0x360246,_0x59bffd]of Object[_0x4a746b(0x138)](_0x44af6d[_0x4a746b(0x193)])){const _0x1d57df=generateDeterministicJourneySegmentName(_0x44ea52[_0x4a746b(0xb7)][_0x4a746b(0xfc)],_0x360246);_0x59bffd[_0x4a746b(0x90)]===_0x1d57df&&(_0x36fa9d[_0x4a746b(0xc1)](_0x360246,_0x59bffd['segmentId']),_0x4b2154[_0x4a746b(0xc1)](_0x360246,_0x59bffd[_0x4a746b(0x12c)]));}}async function createOrRecoverEmbeddedSegment(_0x45acd0,_0x28066b,_0xde8a32,_0x50221d){const _0xa9d105=a136_0x3aef17;let _0x4f7a41;try{_0x4f7a41=await _0x45acd0[_0xa9d105(0xa3)][_0xa9d105(0x159)]({'name':_0xde8a32[_0xa9d105(0xe6)],'description':_0xde8a32[_0xa9d105(0x16b)],'journeyId':_0xde8a32[_0xa9d105(0xd6)],'rule':_0x50221d(_0xde8a32['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0xde8a32[_0xa9d105(0x10b)],'audienceId':_0xde8a32[_0xa9d105(0x126)]});}catch(_0x340fe6){const _0x566578=_0x340fe6 instanceof Error&&_0x340fe6[_0xa9d105(0xe8)][_0xa9d105(0x106)](_0xa9d105(0xb6));if(_0x566578){const _0x39d4d5=readPushRecovery(_0x28066b['absolutePath']),_0x3b8db1=_0x39d4d5?.[_0xa9d105(0xe5)]===_0x28066b['yamlConfig'][_0xa9d105(0xfc)]?_0x39d4d5[_0xa9d105(0x193)][_0xde8a32[_0xa9d105(0xdf)]]:undefined;if(_0x3b8db1?.[_0xa9d105(0x90)]===_0xde8a32[_0xa9d105(0xe6)])await _0x45acd0[_0xa9d105(0xa3)][_0xa9d105(0xc5)](_0xde8a32[_0xa9d105(0x126)],_0x3b8db1[_0xa9d105(0x12c)],{'description':_0xde8a32[_0xa9d105(0x16b)],'rule':_0x50221d(_0xde8a32[_0xa9d105(0x190)],!![]),'countPopulation':!![]}),_0x4f7a41=_0x3b8db1[_0xa9d105(0x12c)];else throw new SDKError(ErrorCode[_0xa9d105(0xf5)],_0xa9d105(0x154)+_0xde8a32[_0xa9d105(0xdf)]+_0xa9d105(0x11c)+(_0xa9d105(0x17b)+_0x28066b[_0xa9d105(0xf4)]['replace'](/([^/]+)$/,_0xa9d105(0xcf))+')\x20')+_0xa9d105(0xb3),_0x340fe6);}else throw _0x340fe6;}return saveSegmentToPushRecovery(_0x28066b[_0xa9d105(0xf4)],_0x28066b['yamlConfig'][_0xa9d105(0xfc)],_0xde8a32['localName'],{'segmentId':_0x4f7a41,'uniqueServerName':_0xde8a32[_0xa9d105(0xe6)],'createdAt':new Date()[_0xa9d105(0xc3)]()}),_0x4f7a41;}export async function prepareSegmentFiles(_0x209ad3,_0x30ca51,_0x1b993b,_0x27ec8a,_0x59b679){const _0xb20738=a136_0x3aef17,{activationDefToCreateRequest:_0x488d1f}=await import(_0xb20738(0x145)),_0x18a1f5=[],_0x2f809a=new Set();for(const {yamlConfig:_0x3122fa,folderPath:_0x20558f,sourcePath:_0x43f49e}of _0x209ad3){const _0x4da65e=resolveTDFolderPath(_0x20558f,_0x27ec8a,_0x59b679),_0x47b8c4=_0x4da65e+':'+_0x3122fa[_0xb20738(0xfc)],_0x53807e=_0x30ca51[_0xb20738(0x108)][_0xb20738(0xe9)](_0x47b8c4),_0x36f8be=_0x53807e?_0x30ca51[_0xb20738(0x19b)][_0xb20738(0xe9)](_0x53807e['id'])||[]:[];addFoldersToCreate(_0x4da65e,_0x30ca51['folderPathToId'],_0x2f809a);const _0x2e931d=calculateActivationActions(_0x3122fa[_0xb20738(0xa1)]||[],_0x36f8be,_0x30ca51[_0xb20738(0xb2)],_0x30ca51['connectionIdToNameMap']);for(const _0x588d83 of _0x2e931d){(_0x588d83['type']==='create'||_0x588d83['type']===_0xb20738(0x137))&&_0x588d83['yamlActivation']&&(_0x588d83[_0xb20738(0x10f)]=await _0x488d1f(_0x588d83[_0xb20738(0xea)],_0x1b993b));}const _0x5db702=calculateSegmentDiff(_0x3122fa,_0x53807e,_0x36f8be,_0x30ca51[_0xb20738(0xb2)],_0x30ca51[_0xb20738(0xd4)]);_0x18a1f5[_0xb20738(0x18e)]({'relativePath':_0x3122fa[_0xb20738(0xfc)],'absolutePath':_0x43f49e,'yamlConfig':_0x3122fa,'folderPath':_0x4da65e,'existingSegment':_0x53807e,'existingActivations':_0x36f8be,'isNew':_0x5db702[_0xb20738(0x146)],'hasChanges':_0x5db702[_0xb20738(0xda)],'diff':_0x5db702[_0xb20738(0x141)],'activationActions':_0x2e931d});}return{'segmentFiles':_0x18a1f5,'foldersToCreate':_0x2f809a};}export async function prepareJourneyFiles(_0x450a5c,_0xbf8388,_0x52bfb7,_0x31cef4){const _0x208f1a=a136_0x3aef17,_0x4c6891=[],_0x13e226=new Set();for(const {yamlConfig:_0x161e69,folderPath:_0x4cf788,sourcePath:_0x243ede}of _0x450a5c){const _0x5efb4b=resolveTDFolderPath(_0x4cf788,_0x52bfb7,_0x31cef4),_0x23cd8b=_0x5efb4b+':'+_0x161e69[_0x208f1a(0xfc)],_0x4e08ea=_0xbf8388[_0x208f1a(0xb1)][_0x208f1a(0xe9)](_0x23cd8b);let _0x5a75fe,_0x16c653;if(_0x4e08ea&&_0x4e08ea['length']>0x0){const _0x1228be=buildLocalExpandedRuleMappings(_0x161e69),{createYamlContext:_0x3a705d,prefetchJourneySegments:_0x11191d}=createPushYamlContextForBundle(_0xbf8388[_0x208f1a(0x189)],_0xbf8388[_0x208f1a(0x126)],_0xbf8388[_0x208f1a(0x12b)],_0x1228be,_0xbf8388[_0x208f1a(0xb2)],_0xbf8388[_0x208f1a(0xd4)],_0xbf8388[_0x208f1a(0x143)],_0xbf8388[_0x208f1a(0xad)]);await _0x11191d(_0x4e08ea['map'](_0x4e4897=>_0x4e4897['id']));const _0x5e4961=await _0xbf8388[_0x208f1a(0x189)][_0x208f1a(0xd1)]['getLatestJourneyId'](_0x4e08ea[0x0]['journeyBundleId']),_0x4f579c=hasMultipleVersions(_0x161e69),_0x23b7c6=async _0x110d8c=>{const _0x12a1cd=_0x208f1a,_0x3a1e30=_0xbf8388[_0x12a1cd(0xad)]?.[_0x12a1cd(0xe9)](_0x110d8c);if(_0x3a1e30)return _0x3a1e30;return _0xbf8388[_0x12a1cd(0x13c)]({'journeyId':_0x110d8c,'journeyName':_0x161e69['name'],'isMultiVersion':_0x4e08ea[_0x12a1cd(0x93)]>0x1});};if(_0x4f579c&&_0x4e08ea[_0x208f1a(0x93)]>0x1){const _0x52c97c=[];for(const _0x499401 of _0x4e08ea){const _0x238edc=_0x499401[_0x208f1a(0x94)]||0x1;_0xbf8388[_0x208f1a(0x107)]?.[_0x208f1a(0x137)]('Fetching\x20'+_0x161e69[_0x208f1a(0xfc)]+'\x20v'+_0x238edc);const _0x309160=await _0x23b7c6(_0x499401['id']),_0x58eb75=_0x3a705d(_0x499401['id']),_0x4e6629=await journeyResponseToDef(_0x309160,_0x58eb75);_0x52c97c[_0x208f1a(0x18e)]({'item':_0x499401,'yaml':_0x4e6629});}const _0x552c6d=buildLocalRuleToNameMappingFromJourney(_0x161e69);_0x16c653=buildMergedJourneyDef(_0x52c97c,_0x552c6d,_0x5e4961);const _0x58b4db=Math[_0x208f1a(0x120)](..._0x52c97c[_0x208f1a(0x144)](_0x47bc0c=>_0x47bc0c[_0x208f1a(0xfe)][_0x208f1a(0x94)]||0x0)),_0xb51c54=_0x4e08ea[_0x208f1a(0x135)](_0x1260a7=>(_0x1260a7[_0x208f1a(0x94)]||0x0)===_0x58b4db);_0xb51c54&&(_0xbf8388['progress']?.[_0x208f1a(0x137)](_0x208f1a(0x112)+_0x161e69[_0x208f1a(0xfc)]+'\x20v'+_0x58b4db),_0x5a75fe=await _0x23b7c6(_0xb51c54['id']));}else{const _0x15218c=_0x4e08ea[_0x4e08ea[_0x208f1a(0x93)]-0x1];_0xbf8388['progress']?.[_0x208f1a(0x137)](_0x208f1a(0x112)+_0x161e69['name']),_0x5a75fe=await _0x23b7c6(_0x15218c['id']);const _0x1a7271=_0x3a705d(_0x15218c['id']),_0x5d8b73=await journeyResponseToDef(_0x5a75fe,_0x1a7271),_0x3454ac=buildLocalRuleToNameMappingFromJourney(_0x161e69);_0x16c653=buildMergedJourneyDef([{'item':_0x15218c,'yaml':_0x5d8b73}],_0x3454ac,_0x5e4961);}}addFoldersToCreate(_0x5efb4b,_0xbf8388[_0x208f1a(0xd7)],_0x13e226);const _0x31e85f=calculateJourneyDiff(_0x161e69,_0x16c653);_0x4c6891[_0x208f1a(0x18e)]({'relativePath':_0x161e69[_0x208f1a(0xfc)],'absolutePath':_0x243ede,'yamlConfig':_0x161e69,'folderPath':_0x5efb4b,'existingJourney':_0x5a75fe,'isNew':_0x31e85f[_0x208f1a(0x146)],'hasChanges':_0x31e85f[_0x208f1a(0xda)],'diff':_0x31e85f[_0x208f1a(0x141)]});}return{'journeyFiles':_0x4c6891,'foldersToCreate':_0x13e226};}export function calculateActivationActions(_0xe72ddf,_0x11585c,_0x2a0533,_0x34a585){const _0x47c10f=a136_0x3aef17,_0x48e79a=[],_0x38733c=new Map();for(const _0x24d2b0 of _0x11585c){_0x38733c[_0x47c10f(0xc1)](_0x24d2b0['name'],_0x24d2b0);}const _0x4fbe86=new Map();for(const _0x7f4b23 of _0xe72ddf){_0x4fbe86['set'](_0x7f4b23[_0x47c10f(0xfc)],_0x7f4b23);}for(const _0x392dbe of _0xe72ddf){const _0x30ed21=_0x38733c[_0x47c10f(0xe9)](_0x392dbe[_0x47c10f(0xfc)]);if(!_0x30ed21)_0x48e79a[_0x47c10f(0x18e)]({'type':_0x47c10f(0xc2),'name':_0x392dbe[_0x47c10f(0xfc)],'yamlActivation':_0x392dbe});else{const _0x30a281=activationResponseToDef(_0x30ed21,_0x2a0533,_0x34a585),_0x373c5a=a136_0x42129b[_0x47c10f(0x185)](_0x30a281),_0x5d214c=a136_0x42129b[_0x47c10f(0x185)](_0x392dbe);_0x373c5a!==_0x5d214c&&_0x48e79a['push']({'type':_0x47c10f(0x137),'name':_0x392dbe['name'],'yamlActivation':_0x392dbe,'existingActivation':_0x30ed21});}}for(const _0x33cad9 of _0x11585c){!_0x4fbe86['has'](_0x33cad9[_0x47c10f(0xfc)])&&_0x48e79a[_0x47c10f(0x18e)]({'type':_0x47c10f(0x166),'name':_0x33cad9[_0x47c10f(0xfc)],'existingActivation':_0x33cad9});}return _0x48e79a;}function calculateYamlDiff(_0x1ca7cb,_0x292d72){if(_0x292d72){const _0x2fd871=generateDiff(_0x292d72,_0x1ca7cb),_0x5f2620=hasChanges(_0x2fd871);return{'isNew':![],'hasChanges':_0x5f2620,'diff':_0x5f2620?formatDiffWithColors(_0x2fd871):undefined};}const _0x3b75e3=generateDiff('',_0x1ca7cb);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x3b75e3)};}export function calculateSegmentDiff(_0x5a8851,_0x21a1d8,_0x3858fd,_0xa121,_0x2dd560){const _0xcc8dc3=segmentToYamlString(_0x5a8851),_0x58af2c=_0x21a1d8?segmentToYamlString(segmentWithActivationsToYaml(_0x21a1d8,_0x3858fd,undefined,_0xa121,_0x2dd560)):undefined;return calculateYamlDiff(_0xcc8dc3,_0x58af2c);}export function calculateJourneyDiff(_0x16cde6,_0xdf8ad2){const _0xa71038=normalizeJourneyDef(_0x16cde6,_0x16cde6),_0x53db2b=a136_0x3b10e7(_0xa71038),_0x188d82=_0xdf8ad2?a136_0x3b10e7(normalizeJourneyDef(_0xdf8ad2,_0x16cde6)):undefined;return calculateYamlDiff(_0x53db2b,_0x188d82);}export function findSegmentsToDelete(_0x4b9c50,_0x2b9794,_0x13b0d4,_0x3dcbed,_0x38f1a0){const _0x1b9d1d=a136_0x3aef17,_0x41c794=new Set();for(const {yamlConfig:_0x56e456,folderPath:_0xd64a88}of _0x2b9794){_0x41c794[_0x1b9d1d(0x99)](_0xd64a88+':'+_0x56e456[_0x1b9d1d(0xfc)]);}return _0x4b9c50['filter'](_0x1bec88=>{const _0x6fd184=_0x1b9d1d,_0x512324=_0x1bec88['segmentFolderId']?_0x13b0d4['get'](_0x1bec88[_0x6fd184(0x149)][_0x6fd184(0xcb)]())||'':'',_0x1fbdb7=_0x512324+':'+_0x1bec88[_0x6fd184(0xfc)];if(_0x41c794['has'](_0x1fbdb7))return![];if(_0x38f1a0)return _0x512324===_0x3dcbed||_0x512324[_0x6fd184(0x140)](_0x3dcbed+'/');return!![];});}export function findJourneysToDelete(_0x1a8572,_0x16cc7e,_0xed97b5,_0x42100c,_0x51153f){const _0x4af5fe=a136_0x3aef17,_0x226e89=new Set();for(const {yamlConfig:_0x422771,folderPath:_0x3734f9}of _0x16cc7e){_0x226e89[_0x4af5fe(0x99)](_0x3734f9+':'+_0x422771['name']);}return _0x1a8572['filter'](_0x33d0e2=>{const _0x3637f7=_0x4af5fe,_0x3526af=_0x33d0e2[_0x3637f7(0x10b)]?_0xed97b5[_0x3637f7(0xe9)](_0x33d0e2[_0x3637f7(0x10b)])||'':'',_0xd8a93b=_0x3526af+':'+_0x33d0e2[_0x3637f7(0x15e)];if(_0x226e89[_0x3637f7(0x132)](_0xd8a93b))return![];if(_0x51153f)return _0x3526af===_0x42100c||_0x3526af[_0x3637f7(0x140)](_0x42100c+'/');return!![];});}export function buildSegmentLookupMap(_0xfdba68,_0x519546){const _0x69760=a136_0x3aef17,_0x4827e0=new Map();for(const _0x543367 of _0xfdba68){const _0x4557b7=_0x543367[_0x69760(0x149)]?_0x519546[_0x69760(0xe9)](_0x543367['segmentFolderId'][_0x69760(0xcb)]())||'':'',_0x50598e=_0x4557b7+':'+_0x543367[_0x69760(0xfc)];_0x4827e0[_0x69760(0xc1)](_0x50598e,_0x543367);}return _0x4827e0;}export function buildSegmentNameToIdMap(_0x44b73f){const _0x224149=new Map();for(const _0x439c28 of _0x44b73f){_0x224149['set'](_0x439c28['name'],_0x439c28['id']);}return _0x224149;}export function buildJourneyBundleLookupMap(_0x1a1de9,_0x496dd8){const _0x3d8fd8=a136_0x3aef17,_0x3c00aa=new Map();for(const _0x22bf2c of _0x1a1de9){const _0x27a956=_0x22bf2c[_0x3d8fd8(0x10b)]?_0x496dd8[_0x3d8fd8(0xe9)](_0x22bf2c[_0x3d8fd8(0x10b)])||'':'',_0xf92a5d=_0x27a956+':'+_0x22bf2c[_0x3d8fd8(0x15e)];!_0x3c00aa[_0x3d8fd8(0x132)](_0xf92a5d)&&_0x3c00aa[_0x3d8fd8(0xc1)](_0xf92a5d,[]),_0x3c00aa[_0x3d8fd8(0xe9)](_0xf92a5d)['push'](_0x22bf2c);}for(const _0x274610 of _0x3c00aa[_0x3d8fd8(0x150)]()){_0x274610[_0x3d8fd8(0x157)]((_0x5739fe,_0x14853f)=>(_0x5739fe['versionNumber']||0x0)-(_0x14853f[_0x3d8fd8(0x94)]||0x0));}return _0x3c00aa;}export function collectFoldersToCreate(_0xe35593,_0x1726e9){const _0x96a53b=a136_0x3aef17,_0x2366c2=new Set();for(const _0x10ebd6 of _0xe35593){if(!_0x10ebd6)continue;if(_0x1726e9['has'](_0x10ebd6))continue;const _0x4e6308=_0x10ebd6[_0x96a53b(0xec)]('/');let _0xab51e6='';for(const _0x5e4b30 of _0x4e6308){_0xab51e6=_0xab51e6?_0xab51e6+'/'+_0x5e4b30:_0x5e4b30,!_0x1726e9[_0x96a53b(0x132)](_0xab51e6)&&_0x2366c2[_0x96a53b(0x99)](_0xab51e6);}}return _0x2366c2;}export function parseAndClassifyYamlFiles(_0x425130,_0x2e23b3,_0x2cf8c2){const _0x3f6edf=a136_0x3aef17,_0x4dff42=[],_0x5798c9=[];for(const _0x1131af of _0x425130){const _0x3c6fc4=a136_0x2cf61d[_0x3f6edf(0xf6)](_0x2e23b3,a136_0x2cf61d[_0x3f6edf(0xbb)](_0x1131af)),_0x444dea=_0x3c6fc4==='.'?'':_0x3c6fc4,_0x5ddf1f=readFileSync(_0x1131af,_0x3f6edf(0x113)),_0x12f185=a136_0x42129b[_0x3f6edf(0xf3)](_0x5ddf1f);if(isJourneyDef(_0x12f185)){const _0x1fdbf8=a136_0x52b19f(_0x5ddf1f);_0x5798c9[_0x3f6edf(0x18e)]({'yamlConfig':_0x1fdbf8,'folderPath':_0x444dea,'sourcePath':_0x1131af});}else{if(!_0x2cf8c2?.[_0x3f6edf(0xf9)]){const _0x148d64=parseSegmentYamlFile(_0x5ddf1f),_0x13bf62=normalizeChildSegmentYaml(_0x148d64);_0x4dff42['push']({'yamlConfig':_0x13bf62,'folderPath':_0x444dea,'sourcePath':_0x1131af});}}}return{'segments':_0x4dff42,'journeys':_0x5798c9};}export function validateParsedFiles(_0x4e7d62,_0x25101b){const _0x8aa6ac=a136_0x3aef17,_0x3b900e=[];for(const {yamlConfig:_0x210722,sourcePath:_0x19810a}of _0x4e7d62[_0x8aa6ac(0x193)]){const _0x585c7a=readFileSync(_0x19810a,_0x8aa6ac(0x113)),_0x531c19=a136_0x42129b[_0x8aa6ac(0x160)](_0x585c7a),_0x16b479=validateSegmentDef(_0x210722,{'source':_0x585c7a,'document':_0x531c19},{'skipSchema':!![]});if(!_0x16b479[_0x8aa6ac(0x171)]){const _0x45eaf6=a136_0x2cf61d[_0x8aa6ac(0xf6)](_0x25101b,_0x19810a);_0x3b900e[_0x8aa6ac(0x18e)]({'filePath':_0x45eaf6,'source':_0x585c7a,'result':_0x16b479,'isJourney':![]});}}for(const {yamlConfig:_0x54339d,sourcePath:_0x2590d3}of _0x4e7d62[_0x8aa6ac(0x17a)]){const _0x2ab71b=readFileSync(_0x2590d3,'utf-8'),_0x1b7960=a136_0x42129b[_0x8aa6ac(0x160)](_0x2ab71b),_0x1fc705=validateJourneyDef(_0x54339d,{'source':_0x2ab71b,'document':_0x1b7960},{'skipSchema':!![]});if(!_0x1fc705[_0x8aa6ac(0x171)]){const _0x1fb4da=a136_0x2cf61d[_0x8aa6ac(0xf6)](_0x25101b,_0x2590d3);_0x3b900e[_0x8aa6ac(0x18e)]({'filePath':_0x1fb4da,'source':_0x2ab71b,'result':_0x1fc705,'isJourney':!![]});}}return _0x3b900e;}export function formatValidationErrors(_0x1cfb71){const _0x33d4c0=a136_0x3aef17,_0x5a9f20=[];for(const {filePath:_0x158262,source:_0x42829b,result:_0x49f0aa,isJourney:_0x25671e}of _0x1cfb71){const _0x1df9d7=_0x25671e?_0x33d4c0(0xd1):_0x33d4c0(0xa3);_0x5a9f20[_0x33d4c0(0x18e)]('\x0a'+_0x158262+'\x20('+_0x1df9d7+_0x33d4c0(0x11d)+_0x49f0aa[_0x33d4c0(0x199)]['length']+_0x33d4c0(0x119)),_0x5a9f20['push'](formatValidationResult(_0x49f0aa,_0x42829b,_0x158262));}return _0x5a9f20[_0x33d4c0(0x10d)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x201706){const _0x5e2a36=a136_0x3aef17,_0x5651e3=new Set(),_0x5648c8=new Map(),_0x20a0c1=collectSegmentUsageCounts(_0x201706);if(_0x201706[_0x5e2a36(0x193)])for(const [_0x333c82,_0x5c5a42]of Object[_0x5e2a36(0x138)](_0x201706[_0x5e2a36(0x193)])){_0x5651e3[_0x5e2a36(0x99)](_0x333c82);if(_0x5c5a42[_0x5e2a36(0xf0)]){const _0x5fdcd1=yamlRuleToApi(_0x5c5a42[_0x5e2a36(0xf0)]),_0x3b8ec3=apiRuleToYaml(_0x5fdcd1);_0x5648c8[_0x5e2a36(0xc1)](_0x333c82,_0x3b8ec3);}}const _0x1e56ec=new Map();let _0x4479e7=0x0;for(const [_0x1381b1,_0x44b669]of _0x5648c8){const _0x54e5e9=serializeExpandedRule(_0x44b669,_0x5648c8),_0x3f9a0d=_0x1e56ec['get'](_0x54e5e9)||[];_0x3f9a0d[_0x5e2a36(0x18e)]({'name':_0x1381b1,'index':_0x4479e7}),_0x1e56ec[_0x5e2a36(0xc1)](_0x54e5e9,_0x3f9a0d),_0x4479e7++;}const _0x23031a=new Map();for(const [_0x20ef60,_0x5c8018]of _0x1e56ec){const _0x3b5d9c=_0x5c8018[_0x5e2a36(0xd0)]()[_0x5e2a36(0x157)]((_0x2e5b48,_0x49a43c)=>{const _0x27f5f1=_0x5e2a36,_0x42a9b2=_0x20a0c1[_0x27f5f1(0xe9)](_0x2e5b48[_0x27f5f1(0xfc)])||0x0,_0x273912=_0x20a0c1['get'](_0x49a43c[_0x27f5f1(0xfc)])||0x0;if(_0x42a9b2!==_0x273912)return _0x273912-_0x42a9b2;return _0x2e5b48[_0x27f5f1(0x18a)]-_0x49a43c[_0x27f5f1(0x18a)];})[_0x5e2a36(0x144)](_0x44066a=>_0x44066a[_0x5e2a36(0xfc)]),_0xf6834f=[];for(const _0x351061 of _0x3b5d9c){const _0x53bcbe=_0x20a0c1[_0x5e2a36(0xe9)](_0x351061)||0x0,_0x10e392=Math[_0x5e2a36(0x120)](_0x53bcbe,0x1);for(let _0x439882=0x0;_0x439882<_0x10e392;_0x439882++){_0xf6834f[_0x5e2a36(0x18e)](_0x351061);}}_0x23031a[_0x5e2a36(0xc1)](_0x20ef60,_0xf6834f);}return{'existingLocalSegmentNames':_0x5651e3,'localSegmentRules':_0x5648c8,'localExpandedRuleToNames':_0x23031a};}export function createSegmentIdResolver(_0x5aaa6d,_0xff64a9){return async _0x447dfd=>{const _0x36e1aa=a136_0x39b7,_0x108230=_0x5aaa6d[_0x36e1aa(0xe9)](_0x447dfd);if(!_0x108230)throw new SDKError(ErrorCode[_0x36e1aa(0x156)],'Segment\x20not\x20found:\x20'+_0x447dfd+_0x36e1aa(0x111)+_0xff64a9+'\x27)');return _0x108230;};}export function extractRootFolderId(_0x313a96){const _0x391292=a136_0x3aef17;return _0x313a96['relationships']?.[_0x391292(0xac)]?.[_0x391292(0x151)]?.['id']||_0x313a96['relationships']?.['parentFolder']?.[_0x391292(0x151)]?.['id'];}export function buildConnectionMaps(_0x836b62){const _0x2bfa00=a136_0x3aef17,_0x2e4ce8=new Map(),_0x97b11e=new Map(),_0x821cd4=new Map();for(const _0x19c461 of _0x836b62){_0x2e4ce8[_0x2bfa00(0xc1)](_0x19c461['name'],parseInt(_0x19c461['id'],0xa)),_0x97b11e['set'](_0x19c461['id'],_0x19c461[_0x2bfa00(0xfc)]),_0x821cd4[_0x2bfa00(0xc1)](_0x19c461[_0x2bfa00(0xfc)],_0x19c461[_0x2bfa00(0xbe)]);}return{'nameToId':_0x2e4ce8,'idToName':_0x97b11e,'nameToType':_0x821cd4};}export function calculatePushStats(_0x2031f3,_0x415eac,_0x3fe616,_0x280244,_0x1dd6dc,_0x5bcca7,_0x596da0){const _0x474823=a136_0x3aef17,_0x182960=_0x2031f3[_0x474823(0x10e)](_0x340b59=>_0x340b59[_0x474823(0x146)]),_0x5c86d3=_0x2031f3['filter'](_0x133e17=>!_0x133e17['isNew']&&_0x133e17['hasChanges']),_0x3b8069=_0x2031f3[_0x474823(0x10e)](_0x34ed9e=>!_0x34ed9e['isNew']&&!_0x34ed9e['hasChanges']),_0x19bd33=_0x5bcca7?_0x280244:[],_0x620c57=_0x415eac[_0x474823(0x10e)](_0x3a4c61=>_0x3a4c61[_0x474823(0x146)]),_0x3de342=_0x415eac[_0x474823(0x10e)](_0x27be0d=>!_0x27be0d[_0x474823(0x146)]&&_0x27be0d[_0x474823(0xda)]),_0x3db485=_0x415eac[_0x474823(0x10e)](_0x2f5feb=>!_0x2f5feb[_0x474823(0x146)]&&!_0x2f5feb[_0x474823(0xda)]),_0x73f72=_0x5bcca7?_0x1dd6dc:[],_0x1726c3=_0x2031f3['flatMap'](_0x541fb7=>_0x541fb7[_0x474823(0x129)]),_0x3e6bfa=_0x1726c3[_0x474823(0x10e)](_0xb20a14=>_0xb20a14[_0x474823(0xbe)]===_0x474823(0xc2)),_0x102e95=_0x1726c3[_0x474823(0x10e)](_0xd229a5=>_0xd229a5[_0x474823(0xbe)]===_0x474823(0x137)),_0xb86735=_0x1726c3['filter'](_0x13de6a=>_0x13de6a[_0x474823(0xbe)]===_0x474823(0x166)),_0x570aed=Array['from'](_0x3fe616)['sort'](),_0x2f127f=_0x596da0?![]:_0x182960[_0x474823(0x93)]>0x0||_0x5c86d3[_0x474823(0x93)]>0x0||_0x19bd33[_0x474823(0x93)]>0x0,_0x4bbcb6=_0x620c57[_0x474823(0x93)]>0x0||_0x3de342[_0x474823(0x93)]>0x0||_0x73f72[_0x474823(0x93)]>0x0,_0x4a8bd6=_0x596da0?![]:_0x1726c3[_0x474823(0x93)]>0x0,_0x29360b=_0x570aed['length']>0x0;return{'segments':{'new':_0x182960,'changed':_0x5c86d3,'unchanged':_0x3b8069,'toDelete':_0x19bd33},'journeys':{'new':_0x620c57,'changed':_0x3de342,'unchanged':_0x3db485,'toDelete':_0x73f72},'activations':{'all':_0x1726c3,'toCreate':_0x3e6bfa,'toUpdate':_0x102e95,'toDelete':_0xb86735},'folders':{'toCreate':_0x570aed},'counts':{'segments':{'new':_0x182960[_0x474823(0x93)],'changed':_0x5c86d3[_0x474823(0x93)],'unchanged':_0x3b8069[_0x474823(0x93)],'toDelete':_0x19bd33[_0x474823(0x93)]},'journeys':{'new':_0x620c57[_0x474823(0x93)],'changed':_0x3de342[_0x474823(0x93)],'unchanged':_0x3db485[_0x474823(0x93)],'toDelete':_0x73f72['length']},'activations':{'create':_0x3e6bfa[_0x474823(0x93)],'update':_0x102e95[_0x474823(0x93)],'delete':_0xb86735[_0x474823(0x93)]},'folders':_0x570aed[_0x474823(0x93)]},'hasChanges':_0x2f127f||_0x4bbcb6||_0x4a8bd6||_0x29360b};}export async function buildPushExecutionContext(_0x1d5138,_0x3bf6af,_0x1ab10a,_0x43af1d,_0x40ab54,_0x4c1079){const _0x17a9c9=a136_0x3aef17,_0x5c0fd6=extractRootFolderId(_0x1ab10a),{pathToId:_0x207c42,idToPath:_0x3b823d}=buildFolderMaps(_0x40ab54),_0x2674a7=buildSegmentNameToIdMap(_0x43af1d),_0x1ac936=new Map(),{batchAsync:_0x539291}=await import(_0x17a9c9(0xf1)),[_0x3fecb7,_0x1a09ad]=await Promise[_0x17a9c9(0x98)]([_0x1d5138[_0x17a9c9(0x170)]['buildUserMaps'](),_0x1d5138['connection'][_0x17a9c9(0x17f)](),((async()=>{const _0x55afdf=_0x17a9c9;!_0x4c1079&&_0x43af1d[_0x55afdf(0x93)]>0x0&&await _0x539291(_0x43af1d,async _0x312cfc=>{const _0x1ff942=_0x55afdf,_0xc8e223=await _0x1d5138['segment'][_0x1ff942(0x124)](_0x3bf6af,_0x312cfc['id']);_0x1ac936['set'](_0x312cfc['id'],_0xc8e223);});})())]),{emailToId:_0x4bc963,idToEmail:_0x4916f6}=_0x3fecb7,_0xe12ba9=buildConnectionMaps(_0x1a09ad);return{'rootFolderId':_0x5c0fd6,'folderPathToId':_0x207c42,'folderIdToPath':_0x3b823d,'segmentNameToId':_0x2674a7,'activationsBySegmentId':_0x1ac936,'emailToIdMap':_0x4bc963,'idToEmailMap':_0x4916f6,'connectionNameToIdMap':_0xe12ba9[_0x17a9c9(0x192)],'connectionIdToNameMap':_0xe12ba9[_0x17a9c9(0x18d)],'connectionNameToTypeMap':_0xe12ba9[_0x17a9c9(0xcd)]};}export function createPushYamlContextForBundle(_0x26a3e7,_0x733b5d,_0x240240,_0x27bb0f,_0x281d2b,_0x104c0d,_0x421a18,_0x5a795d){const {existingLocalSegmentNames:_0x9857c2,localExpandedRuleToNames:_0x20a1a3}=_0x27bb0f,_0x511da4=new Set(),_0x3e8b03=new Map(),_0x161ded=new Map(),_0x83c44a=new Map(),_0x2b93d8=createJumpTargetCache(),_0x14aba5=new Map(),_0x6a3172=new Map(),_0x29f194=new Set();let _0x1d1da1;const _0x3e84d2=_0x2ce74b=>{const _0x217d86={'resolveSegment':async _0x41e041=>{const _0x4c85e4=a136_0x39b7,_0x114671=_0x83c44a['get'](_0x41e041);if(_0x114671!==undefined)return{'name':_0x114671,'isJourneyLocal':!![]};try{const _0x1ea903=await fetchSegment(_0x26a3e7,_0x733b5d,_0x41e041,_0x240240);if(!_0x1ea903)throw new Error(_0x4c85e4(0x9e));const _0x354e60=generateJourneyLocalName(_0x1ea903[_0x4c85e4(0xfc)]),_0x4a0f98=_0x1ea903['kind']===SEGMENT_KIND_JOURNEY&&_0x354e60!==undefined;let _0x1a6242=_0x1ea903[_0x4c85e4(0xfc)],_0x407e65;if(_0x4a0f98&&_0x1ea903[_0x4c85e4(0xf0)]){const _0x109431=apiRuleToYaml(_0x1ea903[_0x4c85e4(0xf0)]);_0x6a3172['set'](_0x41e041,_0x109431);const _0x2e5a04=async _0x3c7d31=>{const _0x29f189=_0x4c85e4,_0x2ec105=collectSegmentRefsFromRule(_0x3c7d31);for(const _0x3c3493 of _0x2ec105){if(!_0x6a3172[_0x29f189(0x132)](_0x3c3493))try{const _0x285880=await fetchSegment(_0x26a3e7,_0x733b5d,_0x3c3493,_0x240240);if(_0x285880?.[_0x29f189(0xf0)]){const _0x5171fb=apiRuleToYaml(_0x285880['rule']);_0x6a3172[_0x29f189(0xc1)](_0x3c3493,_0x5171fb),await _0x2e5a04(_0x5171fb);}}catch(_0x41294f){logger[_0x29f189(0x101)](_0x29f189(0x91)+_0x3c3493+':\x20'+_0x41294f);}}};await _0x2e5a04(_0x109431);const _0x5a87fd=serializeExpandedRule(_0x109431,_0x6a3172),_0x13cec6=_0x20a1a3[_0x4c85e4(0xe9)](_0x5a87fd);if(_0x13cec6&&_0x13cec6[_0x4c85e4(0x93)]>0x0){const _0x2185b2=_0x3e8b03['get'](_0x5a87fd)||0x0,_0x5dc677=_0x13cec6[_0x2185b2]||_0x13cec6[_0x13cec6[_0x4c85e4(0x93)]-0x1];_0x3e8b03[_0x4c85e4(0xc1)](_0x5a87fd,_0x2185b2+0x1),_0x1a6242=_0x5dc677,_0x511da4[_0x4c85e4(0x99)](_0x1a6242),_0x83c44a['set'](_0x41e041,_0x1a6242);const _0x2421cb=await resolveRuleSegmentRefs(_0x109431,async _0x415507=>{const _0x5ced94=_0x4c85e4,_0x4e7ce2=_0x83c44a[_0x5ced94(0xe9)](_0x415507);if(_0x4e7ce2)return _0x4e7ce2;const _0x49ed1e=await _0x1d1da1['resolveSegment'](_0x415507);return _0x49ed1e[_0x5ced94(0xfc)];});_0x407e65={'description':_0x1ea903[_0x4c85e4(0x16b)],'rule':_0x2421cb};}else{const _0x508cc0=_0x14aba5[_0x4c85e4(0xe9)](_0x5a87fd);if(_0x508cc0)_0x1a6242=_0x508cc0,_0x83c44a[_0x4c85e4(0xc1)](_0x41e041,_0x1a6242);else{if(_0x354e60){let _0x569572=_0x354e60,_0x14b4d4=0x2;while(_0x511da4[_0x4c85e4(0x132)](_0x569572)||_0x9857c2[_0x4c85e4(0x132)](_0x569572)){_0x569572=_0x354e60+'_'+_0x14b4d4,_0x14b4d4++;}_0x511da4['add'](_0x569572),_0x1a6242=_0x569572;}_0x83c44a[_0x4c85e4(0xc1)](_0x41e041,_0x1a6242),_0x14aba5[_0x4c85e4(0xc1)](_0x5a87fd,_0x1a6242);const _0x408772=await resolveRuleSegmentRefs(_0x109431,async _0x508c09=>{const _0x5c2d82=_0x4c85e4,_0x4d6b6e=_0x83c44a[_0x5c2d82(0xe9)](_0x508c09);if(_0x4d6b6e)return _0x4d6b6e;const _0x3d7144=await _0x1d1da1['resolveSegment'](_0x508c09);return _0x3d7144[_0x5c2d82(0xfc)];});_0x407e65={'description':_0x1ea903[_0x4c85e4(0x16b)],'rule':_0x408772};}}}return{'name':_0x1a6242,'isJourneyLocal':_0x4a0f98,'definition':_0x407e65};}catch(_0x137a26){return logger[_0x4c85e4(0x101)](_0x4c85e4(0xce)+_0x41e041+':\x20'+_0x137a26),{'name':_0x41e041,'isJourneyLocal':![]};}},'resolveActivation':async _0x41622a=>{const _0x250713=a136_0x39b7,_0x165d05=_0x161ded[_0x250713(0xe9)](_0x41622a);if(_0x165d05!==undefined)return{'name':_0x165d05,'isJourneyLocal':!![]};try{let _0x2298e7=_0x421a18?.[_0x250713(0xe9)](_0x41622a);!_0x2298e7&&(_0x2298e7=await _0x26a3e7[_0x250713(0xd1)][_0x250713(0x100)](_0x2ce74b,_0x41622a));const _0x29a358=_0x2298e7[_0x250713(0x169)][_0x250713(0x18b)][_0x250713(0xfc)]||_0x41622a,_0x568d8b=sanitizeYamlKey(_0x29a358)||'activation_'+_0x41622a,_0x191938=_0x568d8b;_0x161ded['set'](_0x41622a,_0x191938);const _0x1b32c6=journeyActivationStepToYaml(_0x2298e7,_0x281d2b,_0x104c0d);return{'name':_0x191938,'isJourneyLocal':!![],'definition':_0x1b32c6};}catch(_0x2baa2b){return logger[_0x250713(0x101)]('Failed\x20to\x20resolve\x20activation\x20'+_0x41622a+':\x20'+_0x2baa2b),{'name':_0x41622a,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x476b7a,_0x54e8ad)=>resolveJumpTarget(_0x476b7a,_0x54e8ad,_0x2b93d8,async _0x5e75af=>{const _0x52adbe=a136_0x39b7,_0x1d4102=_0x5a795d?.['get'](_0x5e75af);if(_0x1d4102)return _0x1d4102;return _0x26a3e7[_0x52adbe(0xd1)]['getJourney'](_0x5e75af);})};return _0x1d1da1=_0x217d86,_0x217d86;},_0x20891b=async _0x53b4ef=>{const _0x2a23f8=a136_0x39b7,{collectSegmentIdsFromJourneyApi:_0x3e9b0f}=await import(_0x2a23f8(0x104)),{batchAsync:_0x413113}=await import('../../utils/async.js'),_0x39c801=new Set();for(const _0x3a831e of _0x53b4ef){let _0x29a586=_0x5a795d?.[_0x2a23f8(0xe9)](_0x3a831e);!_0x29a586&&(_0x29a586=await _0x26a3e7['journey'][_0x2a23f8(0x13f)](_0x3a831e));const _0x86bbb1=_0x3e9b0f(_0x29a586);for(const _0x20e7ef of _0x86bbb1){_0x39c801[_0x2a23f8(0x99)](_0x20e7ef);}}let _0x26dac4=Array[_0x2a23f8(0xed)](_0x39c801);while(_0x26dac4[_0x2a23f8(0x93)]>0x0){const _0x730cbf=_0x26dac4[_0x2a23f8(0x10e)](_0x5548ba=>!_0x29f194[_0x2a23f8(0x132)](_0x5548ba));if(_0x730cbf[_0x2a23f8(0x93)]===0x0)break;const _0x15e1ae=await _0x413113(_0x730cbf,async _0x2eb899=>{const _0x29b85f=_0x2a23f8;_0x29f194[_0x29b85f(0x99)](_0x2eb899);const _0x1e424e=await fetchSegment(_0x26a3e7,_0x733b5d,_0x2eb899,_0x240240);if(!_0x1e424e)return null;return{'segmentId':_0x2eb899,'segment':_0x1e424e};},0xa),_0x161ac3=new Set();for(const _0x166bfe of _0x15e1ae){if(!_0x166bfe?.[_0x2a23f8(0xa3)]?.[_0x2a23f8(0xf0)])continue;const _0x422c0c=apiRuleToYaml(_0x166bfe[_0x2a23f8(0xa3)][_0x2a23f8(0xf0)]);_0x6a3172[_0x2a23f8(0xc1)](_0x166bfe[_0x2a23f8(0x12c)],_0x422c0c);const _0x366493=collectSegmentRefsFromRule(_0x422c0c);for(const _0x1345ef of _0x366493){!_0x29f194[_0x2a23f8(0x132)](_0x1345ef)&&_0x161ac3[_0x2a23f8(0x99)](_0x1345ef);}}_0x26dac4=Array[_0x2a23f8(0xed)](_0x161ac3);}};return{'createYamlContext':_0x3e84d2,'prefetchJourneySegments':_0x20891b};}export async function executePushSegments(_0x56b03b,_0x43ad8c,_0x430813,_0x12b931,_0xae6e51){const _0x2b433a=a136_0x3aef17,{segmentDefToCreateRequest:_0xeac0a3,segmentDefToUpdateRequest:_0x3b2c34}=await import(_0x2b433a(0x145)),_0x10b75d=_0x430813[_0x2b433a(0xd7)],_0x1a0dd1=0x5,_0x394fa3=async _0x2141e9=>{const _0x2f6b08=_0x2b433a,_0x36179d=_0x2141e9['folderPath']?_0x10b75d[_0x2f6b08(0xe9)](_0x2141e9[_0x2f6b08(0x122)]):undefined;let _0x6ef5c1;const _0x309f5e={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x4ccad5=_0x2141e9[_0x2f6b08(0xb7)];if(_0x2141e9[_0x2f6b08(0xb7)]['rule']){const _0x310104=createSegmentIdResolver(_0x430813[_0x2f6b08(0x155)],_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)]),_0x45e8a4=await resolveRuleSegmentIds(_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xf0)],_0x310104);_0x4ccad5={..._0x2141e9[_0x2f6b08(0xb7)],'rule':_0x45e8a4};}try{if(_0x2141e9[_0x2f6b08(0x146)]){_0xae6e51[_0x2f6b08(0x18f)]?.({'type':_0x2f6b08(0xd3),'name':_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)]});const _0xeace0a=_0xeac0a3(_0x4ccad5,_0x36179d),_0x2a572c=await _0xae6e51[_0x2f6b08(0x14a)](_0x2f6b08(0x173)+_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)]+_0x2f6b08(0x195),()=>_0x56b03b['segment']['createSegment'](_0x12b931[_0x2f6b08(0x126)],_0xeace0a));_0x6ef5c1=_0x2a572c['data']['id'],_0x430813[_0x2f6b08(0x155)][_0x2f6b08(0xc1)](_0x2141e9['yamlConfig'][_0x2f6b08(0xfc)],_0x6ef5c1),_0x309f5e[_0x2f6b08(0x187)]={'name':_0x2141e9['yamlConfig'][_0x2f6b08(0xfc)],'id':_0x6ef5c1},_0xae6e51[_0x2f6b08(0x18f)]?.({'type':_0x2f6b08(0xaf),'name':_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)],'segmentId':_0x6ef5c1}),_0xae6e51[_0x2f6b08(0x12d)]?.('Created\x20segment\x20\x27'+_0x2141e9['yamlConfig'][_0x2f6b08(0xfc)]+'\x27'),_0x309f5e[_0x2f6b08(0x133)]=0x1;}else{if(_0x2141e9[_0x2f6b08(0xda)]){_0xae6e51[_0x2f6b08(0x18f)]?.({'type':'segment_updating','name':_0x2141e9[_0x2f6b08(0xb7)]['name']});const _0x9a8803=_0x3b2c34(_0x4ccad5);_0x36179d!==_0x2141e9[_0x2f6b08(0x183)]?.[_0x2f6b08(0x149)]&&(_0x9a8803[_0x2f6b08(0x149)]=_0x36179d?parseInt(_0x36179d,0xa):undefined),await _0xae6e51[_0x2f6b08(0x14a)](_0x2f6b08(0x194)+_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)]+'\x27...',()=>_0x56b03b[_0x2f6b08(0xa3)][_0x2f6b08(0xc5)](_0x12b931['parentId'],_0x2141e9[_0x2f6b08(0x183)]['id'],_0x9a8803)),_0x6ef5c1=_0x2141e9[_0x2f6b08(0x183)]['id'],_0xae6e51[_0x2f6b08(0x18f)]?.({'type':'segment_updated','name':_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)]}),_0xae6e51['logSuccess']?.('Updated\x20segment\x20\x27'+_0x2141e9['yamlConfig'][_0x2f6b08(0xfc)]+'\x27'),_0x309f5e['updated']=0x1;}else _0x6ef5c1=_0x2141e9[_0x2f6b08(0x183)]['id'];}}catch(_0x4f4321){const _0x3ee230=isHttp400Error(_0x4f4321),_0x2800ee=_0x3ee230?ErrorCode[_0x2f6b08(0xd9)]:ErrorCode[_0x2f6b08(0xf5)],_0x3141f8=getErrorMessage(_0x4f4321);throw new SDKError(_0x2800ee,_0x2f6b08(0xb9)+(_0x2141e9['isNew']?_0x2f6b08(0xc2):_0x2f6b08(0x137))+_0x2f6b08(0xde)+_0x2141e9[_0x2f6b08(0xf4)]+'\x0a\x20\x20'+_0x3141f8,_0x4f4321);}try{const _0x1e729d=await syncActivationsForSegment(_0x56b03b,_0x12b931['parentId'],_0x6ef5c1,_0x2141e9[_0x2f6b08(0xb7)][_0x2f6b08(0xfc)],_0x2141e9[_0x2f6b08(0x129)],_0xae6e51,_0x2141e9['absolutePath']);_0x309f5e[_0x2f6b08(0xa1)]=_0x1e729d;}catch(_0x252161){if(_0x252161 instanceof SDKError)throw _0x252161;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x2f6b08(0xeb)+_0x2141e9[_0x2f6b08(0xb7)]['name']+_0x2f6b08(0x15b)+_0x2141e9['absolutePath']+_0x2f6b08(0x9b)+getErrorMessage(_0x252161),_0x252161);}return _0x309f5e;},_0x5500b9=await batchAsync(_0x43ad8c,_0x394fa3,_0x1a0dd1),_0x551f4a={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x5aed5d of _0x5500b9){_0x551f4a[_0x2b433a(0x133)]+=_0x5aed5d['created'],_0x551f4a['updated']+=_0x5aed5d['updated'],_0x5aed5d[_0x2b433a(0x187)]&&_0x551f4a[_0x2b433a(0xa6)]['set'](_0x5aed5d[_0x2b433a(0x187)][_0x2b433a(0xfc)],_0x5aed5d[_0x2b433a(0x187)]['id']),_0x551f4a[_0x2b433a(0xa1)][_0x2b433a(0x133)]+=_0x5aed5d[_0x2b433a(0xa1)][_0x2b433a(0x133)],_0x551f4a[_0x2b433a(0xa1)][_0x2b433a(0xca)]+=_0x5aed5d[_0x2b433a(0xa1)]['updated'],_0x551f4a[_0x2b433a(0xa1)][_0x2b433a(0x15f)]+=_0x5aed5d[_0x2b433a(0xa1)][_0x2b433a(0x15f)];}return _0x551f4a;}async function syncActivationsForSegment(_0xe64274,_0x33e7fb,_0x548dba,_0x47cd7e,_0x235ea2,_0x5ae290,_0x196785){const _0xf7547=a136_0x3aef17,_0x4c96f={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x3d56a6 of _0x235ea2){try{if(_0x3d56a6['type']===_0xf7547(0xc2)&&_0x3d56a6[_0xf7547(0x10f)])_0x5ae290[_0xf7547(0x18f)]?.({'type':_0xf7547(0x110),'segmentName':_0x47cd7e,'activationName':_0x3d56a6[_0xf7547(0xfc)]}),await _0x5ae290[_0xf7547(0x14a)](_0xf7547(0xe7)+_0x3d56a6[_0xf7547(0xfc)]+'\x27...',()=>_0xe64274['segment'][_0xf7547(0xbf)](_0x33e7fb,_0x548dba,_0x3d56a6['validatedRequest'])),_0x5ae290[_0xf7547(0x18f)]?.({'type':'activation_created','segmentName':_0x47cd7e,'activationName':_0x3d56a6[_0xf7547(0xfc)]}),_0x5ae290[_0xf7547(0x12d)]?.(_0xf7547(0xa8)+_0x3d56a6['name']+'\x27'),_0x4c96f['created']++;else{if(_0x3d56a6[_0xf7547(0xbe)]===_0xf7547(0x137)&&_0x3d56a6[_0xf7547(0x10f)]&&_0x3d56a6[_0xf7547(0x164)])_0x5ae290[_0xf7547(0x18f)]?.({'type':'activation_updating','segmentName':_0x47cd7e,'activationName':_0x3d56a6[_0xf7547(0xfc)]}),await _0x5ae290[_0xf7547(0x14a)](_0xf7547(0x17d)+_0x3d56a6['name']+_0xf7547(0x195),()=>_0xe64274[_0xf7547(0xa3)]['updateActivation'](_0x33e7fb,_0x548dba,_0x3d56a6[_0xf7547(0x164)]['id'],_0x3d56a6[_0xf7547(0x10f)])),_0x5ae290[_0xf7547(0x18f)]?.({'type':_0xf7547(0x125),'segmentName':_0x47cd7e,'activationName':_0x3d56a6[_0xf7547(0xfc)]}),_0x5ae290[_0xf7547(0x12d)]?.('Updated\x20activation\x20\x27'+_0x3d56a6['name']+'\x27'),_0x4c96f[_0xf7547(0xca)]++;else _0x3d56a6['type']===_0xf7547(0x166)&&_0x3d56a6[_0xf7547(0x164)]&&(_0x5ae290[_0xf7547(0x18f)]?.({'type':_0xf7547(0x184),'segmentName':_0x47cd7e,'activationName':_0x3d56a6['name']}),await _0x5ae290[_0xf7547(0x14a)](_0xf7547(0xff)+_0x3d56a6[_0xf7547(0xfc)]+'\x27...',()=>_0xe64274[_0xf7547(0xa3)]['deleteActivation'](_0x33e7fb,_0x548dba,_0x3d56a6[_0xf7547(0x164)]['id'])),_0x5ae290['onProgress']?.({'type':_0xf7547(0x10c),'segmentName':_0x47cd7e,'activationName':_0x3d56a6[_0xf7547(0xfc)]}),_0x5ae290[_0xf7547(0x178)]?.(_0xf7547(0xb4)+_0x3d56a6['name']+'\x27'),_0x4c96f[_0xf7547(0x15f)]++);}}catch(_0x3d0f3a){const _0x4e1c59=isHttp400Error(_0x3d0f3a),_0x2605f7=_0x4e1c59?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0xf7547(0x17e)],_0x3bc20c=getErrorMessage(_0x3d0f3a);throw new SDKError(_0x2605f7,_0xf7547(0xb9)+_0x3d56a6[_0xf7547(0xbe)]+_0xf7547(0x158)+_0x3d56a6[_0xf7547(0xfc)]+'\x27\x20from\x20file:\x20'+_0x196785+'\x0a\x20\x20'+_0x3bc20c,_0x3d0f3a);}}return _0x4c96f;}export async function executePushFolders(_0x37a9ef,_0x41804c,_0x3f20f6,_0x5ed847,_0x2b9bd4){const _0x5187b1=a136_0x3aef17,_0x26ccac=new Map(_0x3f20f6),_0x5ae514=sortFoldersByDepth(_0x41804c);for(const _0xc22000 of _0x5ae514){const _0x53beea=_0xc22000['split']('/'),_0x2e7ad0=_0x53beea[_0x53beea[_0x5187b1(0x93)]-0x1],_0x2d07a7=_0x53beea['slice'](0x0,-0x1)[_0x5187b1(0x10d)]('/'),_0x398b26=_0x26ccac[_0x5187b1(0xe9)](_0x2d07a7);_0x2b9bd4['onProgress']?.({'type':_0x5187b1(0xe2),'folder':_0xc22000});const _0x1f1375={'name':_0x2e7ad0,'parentFolderId':_0x398b26},_0x1ee934=await _0x2b9bd4[_0x5187b1(0x14a)](_0x5187b1(0x161)+_0xc22000+_0x5187b1(0x195),()=>_0x37a9ef['segment'][_0x5187b1(0x15d)](_0x5ed847[_0x5187b1(0x126)],_0x1f1375));_0x26ccac['set'](_0xc22000,_0x1ee934[_0x5187b1(0x151)]['id']),_0x2b9bd4[_0x5187b1(0x18f)]?.({'type':'folder_created','folder':_0xc22000,'folderId':_0x1ee934[_0x5187b1(0x151)]['id']}),_0x2b9bd4['logInfo']?.('Created\x20folder\x20\x27'+_0xc22000+'\x27');}return _0x26ccac;}export async function executePushSegmentDeletions(_0x21f847,_0x3e04fa,_0x382ec4){const _0x490b6c=a136_0x3aef17;if(_0x3e04fa[_0x490b6c(0x93)]===0x0)return 0x0;const {batchAsync:_0x48aac2}=await import(_0x490b6c(0xf1)),_0x7625a4=0x5,_0x297cdb=await _0x48aac2(_0x3e04fa,async _0x3bd0d2=>{const _0x48f733=_0x490b6c;return _0x382ec4[_0x48f733(0x18f)]?.({'type':_0x48f733(0xc7),'name':_0x3bd0d2[_0x48f733(0xfc)]}),await _0x21f847['segment'][_0x48f733(0x191)](_0x3bd0d2['id']),_0x382ec4[_0x48f733(0x18f)]?.({'type':_0x48f733(0x14e),'name':_0x3bd0d2[_0x48f733(0xfc)]}),_0x382ec4['logDeleted']?.(_0x48f733(0x147)+_0x3bd0d2[_0x48f733(0xfc)]+'\x27'),0x1;},_0x7625a4);return _0x297cdb[_0x490b6c(0x11b)]((_0x4d5bb8,_0x4ca3f8)=>_0x4d5bb8+_0x4ca3f8,0x0);}export async function executePushJourneys(_0x581a02,_0x495535,_0x407c5f,_0x16f38b,_0x207705){const _0x33b8d0=a136_0x3aef17,{journeyDefToRequest:_0x1cb273}=await import(_0x33b8d0(0x104)),{activationDefToCreateRequest:_0x54668e,yamlRuleToApi:_0x2e68df,validateSegmentRule:_0x2e9c0a}=await import(_0x33b8d0(0x145)),_0x186083={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x383aae=new Map(_0x407c5f['segmentNameToId']),_0x429a0e=0x5;for(let _0x438a5f=0x0;_0x438a5f<_0x495535[_0x33b8d0(0x93)];_0x438a5f+=_0x429a0e){const _0x34488c=_0x495535[_0x33b8d0(0xd0)](_0x438a5f,_0x438a5f+_0x429a0e),_0x57611c=await Promise[_0x33b8d0(0x98)](_0x34488c[_0x33b8d0(0x144)](async _0x167b47=>{const _0x274e0b=_0x33b8d0;if(!_0x167b47[_0x274e0b(0x146)]&&!_0x167b47['hasChanges'])return{'action':_0x274e0b(0xe1),'name':_0x167b47[_0x274e0b(0xb7)][_0x274e0b(0xfc)],'journeyId':_0x167b47[_0x274e0b(0x14d)]?.['id']};const _0x33d8cb=_0x167b47[_0x274e0b(0x122)]?_0x407c5f[_0x274e0b(0xd7)]['get'](_0x167b47[_0x274e0b(0x122)]):undefined;_0x207705['onProgress']?.({'type':_0x167b47[_0x274e0b(0x146)]?_0x274e0b(0xc6):_0x274e0b(0xf7),'name':_0x167b47[_0x274e0b(0xb7)][_0x274e0b(0xfc)]});try{const _0x52f1ff=await executeSingleJourneyPush(_0x581a02,_0x167b47,{..._0x407c5f,'segmentNameToId':_0x383aae},{'parentId':_0x16f38b[_0x274e0b(0x126)],'rootFolderId':_0x16f38b[_0x274e0b(0x197)],'folderId':_0x33d8cb,'verbose':_0x16f38b[_0x274e0b(0x14f)]},_0x207705,{'journeyDefToRequest':_0x1cb273,'activationDefToCreateRequest':_0x54668e,'yamlRuleToApi':_0x2e68df,'validateSegmentRule':_0x2e9c0a});for(const [_0x57a1aa,_0x5b97b1]of _0x52f1ff[_0x274e0b(0xd5)]){_0x383aae['set'](_0x57a1aa,_0x5b97b1),_0x186083[_0x274e0b(0xd5)][_0x274e0b(0xc1)](_0x57a1aa,_0x5b97b1);}if(_0x52f1ff[_0x274e0b(0x165)]===_0x274e0b(0x133))_0x207705[_0x274e0b(0x18f)]?.({'type':_0x274e0b(0xb0),'name':_0x167b47['yamlConfig']['name'],'journeyId':_0x52f1ff[_0x274e0b(0xd6)]}),_0x207705[_0x274e0b(0x12d)]?.(_0x274e0b(0x102)+_0x167b47[_0x274e0b(0xb7)]['name']+'\x27'),_0x186083[_0x274e0b(0x133)]++;else _0x52f1ff['action']===_0x274e0b(0xca)&&(_0x207705[_0x274e0b(0x18f)]?.({'type':_0x274e0b(0x179),'name':_0x167b47[_0x274e0b(0xb7)][_0x274e0b(0xfc)]}),_0x207705[_0x274e0b(0x12d)]?.(_0x274e0b(0xbd)+_0x167b47[_0x274e0b(0xb7)][_0x274e0b(0xfc)]+'\x27'),_0x186083[_0x274e0b(0xca)]++);return{'action':_0x52f1ff[_0x274e0b(0x165)],'name':_0x167b47[_0x274e0b(0xb7)]['name'],'journeyId':_0x52f1ff['journeyId']};}catch(_0x2e7051){const _0xe5e043=isHttp400Error(_0x2e7051),_0x4ec547=_0xe5e043?ErrorCode[_0x274e0b(0x13b)]:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x23af95=getErrorMessage(_0x2e7051);throw new SDKError(_0x4ec547,_0x274e0b(0xb9)+(_0x167b47[_0x274e0b(0x146)]?_0x274e0b(0xc2):_0x274e0b(0x137))+_0x274e0b(0x117)+_0x167b47[_0x274e0b(0xf4)]+'\x0a\x20\x20'+_0x23af95,_0x2e7051);}}));_0x186083[_0x33b8d0(0x9d)][_0x33b8d0(0x18e)](..._0x57611c);}return _0x186083;}async function matchExistingJourneySegments(_0x500d69,_0x3a23e3,_0x478fee,_0x44ab42,_0x1f6159){const _0x2674d8=a136_0x3aef17;if(!_0x3a23e3[_0x2674d8(0x14d)]||!_0x3a23e3[_0x2674d8(0xb7)]['segments'])return;const _0x484502=new Map(),_0x204ac9=new Set();for(const _0x4126c8 of Object[_0x2674d8(0x167)](_0x3a23e3[_0x2674d8(0xb7)][_0x2674d8(0x193)])){const _0x34f9e1=generateDeterministicJourneySegmentName(_0x3a23e3[_0x2674d8(0xb7)]['name'],_0x4126c8);_0x484502[_0x2674d8(0xc1)](_0x34f9e1,_0x4126c8),_0x204ac9['add'](_0x4126c8);}const _0x16b81d=[],_0x3bfff8=collectSegmentIdsFromJourneyApi(_0x3a23e3['existingJourney']);for(const _0x443fbd of _0x3bfff8){const _0x1118c4=await fetchSegment(_0x500d69,_0x478fee,_0x443fbd,_0x44ab42);if(!_0x1118c4?.[_0x2674d8(0xfc)])continue;const _0x4a33de=_0x484502['get'](_0x1118c4['name']);_0x4a33de?(_0x1f6159[_0x2674d8(0xc1)](_0x4a33de,_0x443fbd),_0x204ac9[_0x2674d8(0x166)](_0x4a33de)):_0x16b81d[_0x2674d8(0x18e)]({'id':_0x443fbd,'seg':_0x1118c4});}if(_0x204ac9[_0x2674d8(0x130)]>0x0&&_0x16b81d['length']>0x0){const {localExpandedRuleToNames:_0x136076}=buildLocalExpandedRuleMappings(_0x3a23e3[_0x2674d8(0xb7)]),_0x3d982a=new Map();for(const {id:_0x46528c,seg:_0x2cb712}of _0x16b81d){if(_0x2cb712[_0x2674d8(0xf0)]){const _0x218298=apiRuleToYaml(_0x2cb712['rule']);_0x3d982a[_0x2674d8(0xc1)](_0x46528c,_0x218298);}}for(const {id:_0x2816a3,seg:_0x49374e}of _0x16b81d){if(!_0x49374e['rule'])continue;const _0x20ac6c=_0x3d982a[_0x2674d8(0xe9)](_0x2816a3);if(!_0x20ac6c)continue;const _0x17323f=serializeExpandedRule(_0x20ac6c,_0x3d982a),_0x17499e=_0x136076[_0x2674d8(0xe9)](_0x17323f);if(_0x17499e){const _0x2e2d33=_0x17499e['find'](_0x4870b3=>_0x204ac9[_0x2674d8(0x132)](_0x4870b3));_0x2e2d33&&(_0x1f6159[_0x2674d8(0xc1)](_0x2e2d33,_0x2816a3),_0x204ac9[_0x2674d8(0x166)](_0x2e2d33),logger[_0x2674d8(0x101)](_0x2674d8(0x15c)+_0x49374e[_0x2674d8(0xfc)]+_0x2674d8(0xf8)+_0x2e2d33+'\x27\x20by\x20rule\x20content'));}}}}async function executeSingleJourneyPush(_0x37cc08,_0x1f191e,_0x324b05,_0x29f4c3,_0x3e4b26,_0x3e050f){const _0x4bccec=a136_0x3aef17,{journeyDefToRequest:_0x56d866,activationDefToCreateRequest:_0x442255,yamlRuleToApi:_0x30da48,validateSegmentRule:_0x4e16b3}=_0x3e050f,_0x37eb69=new Map(),_0x18f31d=new Map();recoverSegmentIdsFromPushRecovery(_0x1f191e,_0x37eb69,_0x324b05['segmentNameToId']);const _0x5ce731=new Map(),_0x6d7011=new Map(),_0x20dbab=new Map();let _0x2b1730;const _0x4967ea=async()=>{const _0xf0ab15=a136_0x39b7;if(_0x2b1730)return;_0x2b1730=new Map();if(!_0x1f191e[_0xf0ab15(0x14d)])return;const _0x451a02=await _0x37cc08[_0xf0ab15(0xd1)]['listActivations'](_0x1f191e['existingJourney']['id']);for(const _0x3f2c7d of _0x451a02){const _0x5201f7=journeyActivationStepToYaml(_0x3f2c7d,_0x324b05[_0xf0ab15(0xb2)],_0x324b05['connectionIdToNameMap']),_0x497e52=activationSignature(_0x5201f7);!_0x2b1730['has'](_0x497e52)&&_0x2b1730['set'](_0x497e52,_0x3f2c7d['id']),_0x5201f7[_0xf0ab15(0xfc)]&&_0x18f31d['set'](_0x5201f7[_0xf0ab15(0xfc)],_0x3f2c7d['id']);}};await matchExistingJourneySegments(_0x37cc08,_0x1f191e,_0x29f4c3[_0x4bccec(0x126)],_0x324b05[_0x4bccec(0x12b)],_0x324b05[_0x4bccec(0x155)]);const _0x5c588b={'resolveSegmentId':async _0x1eeec4=>{const _0x440c6a=_0x4bccec,_0x54c7ef=_0x324b05[_0x440c6a(0x155)][_0x440c6a(0xe9)](_0x1eeec4);if(!_0x54c7ef)throw new SDKError(ErrorCode[_0x440c6a(0x156)],_0x440c6a(0xba)+_0x1eeec4+_0x440c6a(0x180)+_0x1f191e[_0x440c6a(0xb7)]['name']+')');return _0x54c7ef;},'resolveEmbeddedSegmentId':async(_0x4c683a,_0x220b45)=>{const _0x2331f7=_0x4bccec,_0x5af733=_0x324b05[_0x2331f7(0x155)]['get'](_0x4c683a);if(_0x5af733)return _0x5af733;const _0x54f891=_0x324b05[_0x2331f7(0x12b)][_0x2331f7(0x135)](_0x3ae1e2=>_0x3ae1e2[_0x2331f7(0xfc)]===_0x4c683a);if(_0x54f891)return _0x324b05[_0x2331f7(0x155)]['set'](_0x4c683a,_0x54f891['id']),_0x54f891['id'];if(_0x1f191e[_0x2331f7(0x146)]){const {stageName:_0x4a048e,criteriaName:_0x2540b}=findSegmentCriteriaLocation(_0x1f191e[_0x2331f7(0xb7)],_0x4c683a);return _0x4e16b3(_0x4c683a,_0x220b45[_0x2331f7(0xf0)]),_0x6d7011['set'](_0x4c683a,{'definition':_0x220b45,'stageName':_0x4a048e,'criteriaName':_0x2540b}),createPendingSegmentId(_0x4c683a);}const _0x3b737a=_0x1f191e['existingJourney']?.['id'];if(!_0x3b737a)throw new SDKError(ErrorCode['INTERNAL'],_0x2331f7(0x16e));const _0x545431=_0x5ce731[_0x2331f7(0xe9)](_0x4c683a);if(_0x545431)return _0x545431;const _0x56e113=((async()=>{const _0x253958=_0x2331f7;_0x4e16b3(_0x4c683a,_0x220b45['rule']);const _0x24c0bf=generateDeterministicJourneySegmentName(_0x1f191e[_0x253958(0xb7)][_0x253958(0xfc)],_0x4c683a),_0x2ad4b0=_0x324b05['existingSegments']['find'](_0x36118b=>_0x36118b[_0x253958(0xfc)]===_0x24c0bf),_0x2da448=createSegmentIdResolver(_0x324b05['segmentNameToId'],_0x4c683a),_0x2bc6e7=await resolveRuleSegmentIds(_0x220b45[_0x253958(0xf0)],_0x2da448);let _0x3aad13;return _0x2ad4b0?(await _0x37cc08[_0x253958(0xa3)][_0x253958(0xc5)](_0x29f4c3[_0x253958(0x126)],_0x2ad4b0['id'],{'description':_0x220b45[_0x253958(0x16b)]||_0x253958(0xa0)+_0x4c683a,'rule':_0x30da48(_0x2bc6e7,!![]),'countPopulation':!![]}),_0x3aad13=_0x2ad4b0['id'],saveSegmentToPushRecovery(_0x1f191e[_0x253958(0xf4)],_0x1f191e['yamlConfig'][_0x253958(0xfc)],_0x4c683a,{'segmentId':_0x3aad13,'uniqueServerName':_0x24c0bf,'createdAt':new Date()['toISOString']()})):_0x3aad13=await createOrRecoverEmbeddedSegment(_0x37cc08,_0x1f191e,{'localName':_0x4c683a,'uniqueSegmentName':_0x24c0bf,'description':_0x220b45[_0x253958(0x16b)]||'Entry\x20criteria:\x20'+_0x4c683a,'journeyId':_0x3b737a,'resolvedRule':_0x2bc6e7,'parentId':_0x29f4c3[_0x253958(0x126)],'folderId':_0x29f4c3['rootFolderId']||''},_0x30da48),_0x324b05[_0x253958(0x155)][_0x253958(0xc1)](_0x4c683a,_0x3aad13),_0x37eb69['set'](_0x4c683a,_0x3aad13),_0x3aad13;})());_0x5ce731[_0x2331f7(0xc1)](_0x4c683a,_0x56e113);try{return await _0x56e113;}finally{_0x5ce731[_0x2331f7(0x166)](_0x4c683a);}},'resolveActivationId':async _0x5c04a2=>{const _0x5973dc=_0x4bccec,_0x71942b=_0x18f31d['get'](_0x5c04a2);if(_0x71942b)return _0x71942b;if(_0x1f191e[_0x5973dc(0x14d)]){await _0x4967ea();const _0x560747=_0x18f31d[_0x5973dc(0xe9)](_0x5c04a2);if(_0x560747)return _0x560747;}throw new SDKError(ErrorCode[_0x5973dc(0xd8)],_0x5973dc(0xd2)+_0x5c04a2+_0x5973dc(0x180)+_0x1f191e[_0x5973dc(0xb7)][_0x5973dc(0xfc)]+_0x5973dc(0x16a)+_0x5973dc(0x182));},'resolveEmbeddedActivationId':async(_0x5c2663,_0x33af14)=>{const _0x314b88=_0x4bccec,_0x50b792=_0x18f31d[_0x314b88(0xe9)](_0x5c2663);if(_0x50b792)return _0x50b792;if(_0x1f191e[_0x314b88(0x146)])return _0x20dbab['set'](_0x5c2663,_0x33af14),createPendingActivationId(_0x5c2663);if(_0x1f191e[_0x314b88(0x14d)]){await _0x4967ea();const _0xcf727a=_0x18f31d['get'](_0x33af14['name']);if(_0xcf727a)return _0x18f31d[_0x314b88(0xc1)](_0x5c2663,_0xcf727a),_0xcf727a;const _0x5ac48f=activationSignature(_0x33af14),_0x425294=_0x2b1730?.[_0x314b88(0xe9)](_0x5ac48f);if(_0x425294)return _0x18f31d[_0x314b88(0xc1)](_0x5c2663,_0x425294),_0x425294;const _0x40c106=await _0x442255(_0x33af14,_0x324b05[_0x314b88(0xa5)]),_0x2d17ae={..._0x40c106,..._0x33af14[_0x314b88(0x121)]!==undefined&&{'runAfterJourneyRefresh':_0x33af14[_0x314b88(0x121)]}},_0x40bd14=await _0x37cc08[_0x314b88(0xd1)][_0x314b88(0xbf)](_0x1f191e[_0x314b88(0x14d)]['id'],_0x2d17ae);return _0x18f31d['set'](_0x5c2663,_0x40bd14['id']),_0x40bd14['id'];}throw new SDKError(ErrorCode[_0x314b88(0xdb)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x4d9a2d=>{const _0x20eb03=_0x4bccec;try{return await _0x37cc08['journey'][_0x20eb03(0xdd)](_0x29f4c3[_0x20eb03(0x126)],_0x4d9a2d);}catch(_0xa4ff84){throw new SDKError(ErrorCode[_0x20eb03(0xd8)],_0x20eb03(0xa7)+_0x4d9a2d+_0x20eb03(0x127)+_0x1f191e[_0x20eb03(0xb7)][_0x20eb03(0xfc)]+'\x27)',_0xa4ff84);}},'resolveStageId':async(_0x5934fe,_0x7b04f9)=>{const _0x192496=_0x4bccec,_0xbc6bda=await _0x37cc08[_0x192496(0xd1)][_0x192496(0x13f)](_0x5934fe),_0x49ba9a=_0xbc6bda['attributes']['journeyStages'][_0x192496(0x135)](_0x5b2ae5=>_0x5b2ae5[_0x192496(0xfc)][_0x192496(0x12a)]()===_0x7b04f9[_0x192496(0x12a)]());if(!_0x49ba9a?.['id'])throw new SDKError(ErrorCode[_0x192496(0xd8)],_0x192496(0xb5)+_0x7b04f9+_0x192496(0xc0)+(_0xbc6bda[_0x192496(0x169)][_0x192496(0x15e)]||_0xbc6bda['attributes'][_0x192496(0xfc)])+'\x27');return _0x49ba9a['id'];}},_0x1f6b6a=await _0x56d866(_0x1f191e[_0x4bccec(0xb7)],_0x29f4c3[_0x4bccec(0x126)],_0x5c588b),_0x28a153=_0x29f4c3[_0x4bccec(0x10b)]||_0x29f4c3[_0x4bccec(0x197)];_0x28a153&&(_0x1f6b6a[_0x4bccec(0x11f)]={'parentFolder':{'data':{'id':_0x28a153,'type':_0x4bccec(0x198)}}});if(_0x1f191e[_0x4bccec(0x146)]){if(_0x6d7011[_0x4bccec(0x130)]>0x0||_0x20dbab[_0x4bccec(0x130)]>0x0)return await executeThreeStepJourneyCreate(_0x37cc08,_0x1f191e,_0x1f6b6a,{'pendingEmbeddedSegments':_0x6d7011,'pendingEmbeddedActivations':_0x20dbab,'embeddedSegmentNameToId':_0x37eb69,'journeyActivationNameToId':_0x18f31d},{..._0x29f4c3,'effectiveFolderId':_0x28a153},_0x324b05,_0x3e4b26,_0x3e050f);else{ensureJourneyDefaults(_0x1f6b6a[_0x4bccec(0x169)]);const _0x348165=await _0x37cc08[_0x4bccec(0xd1)]['create'](_0x1f6b6a);return deletePushRecovery(_0x1f191e[_0x4bccec(0xf4)]),{'action':_0x4bccec(0x133),'journeyId':_0x348165['id'],'embeddedSegmentNameToId':_0x37eb69};}}else{if(_0x1f191e[_0x4bccec(0xda)]&&_0x1f191e[_0x4bccec(0x14d)]){_0x1f6b6a['id']=_0x1f191e['existingJourney']['id'];const _0x2ff8c6=_0x1f6b6a[_0x4bccec(0x169)];_0x1f191e['existingJourney'][_0x4bccec(0x169)]?.[_0x4bccec(0x15e)]&&(_0x2ff8c6[_0x4bccec(0x15e)]=_0x1f191e[_0x4bccec(0x14d)][_0x4bccec(0x169)]['journeyBundleName']);const _0x46604b=_0x1f191e[_0x4bccec(0x14d)]['attributes']?.[_0x4bccec(0xab)];return _0x46604b&&_0x1f6b6a[_0x4bccec(0x169)][_0x4bccec(0xab)]&&injectExistingStageIds(_0x1f6b6a['attributes']['journeyStages'],_0x46604b),ensureJourneyDefaults(_0x2ff8c6),await _0x37cc08['journey']['update'](_0x1f191e[_0x4bccec(0x14d)]['id'],_0x1f6b6a),deletePushRecovery(_0x1f191e[_0x4bccec(0xf4)]),{'action':'updated','journeyId':_0x1f191e[_0x4bccec(0x14d)]['id'],'embeddedSegmentNameToId':_0x37eb69};}}return deletePushRecovery(_0x1f191e[_0x4bccec(0xf4)]),{'action':_0x4bccec(0xe1),'journeyId':_0x1f191e['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x37eb69};}function findSegmentCriteriaLocation(_0x443701,_0x307101){const _0x511ef4=a136_0x3aef17,_0x539799=_0x443701['stages']||_0x443701[_0x511ef4(0x17a)]?.[0x0]?.[_0x511ef4(0x97)]||[];let _0x4ade6b=_0x511ef4(0x103),_0x332062=_0x307101;const _0x56f544=_0x443701[_0x511ef4(0x116)]||_0x443701[_0x511ef4(0x17a)]?.[0x0]?.[_0x511ef4(0x116)];if(_0x56f544?.[_0x511ef4(0xa3)]===_0x307101)return{'stageName':_0x511ef4(0x116),'criteriaName':_0x56f544['name']||_0x307101};_0xdfa760:for(const _0x42a937 of _0x539799){if(_0x42a937[_0x511ef4(0x95)]?.[_0x511ef4(0xa3)]===_0x307101){_0x4ade6b=_0x42a937['name'],_0x332062=_0x42a937[_0x511ef4(0x95)][_0x511ef4(0xfc)]||_0x307101;break;}if(_0x42a937[_0x511ef4(0xa4)])for(const _0x3b0089 of _0x42a937['steps']){if(_0x3b0089[_0x511ef4(0xbe)]===_0x511ef4(0x134)&&_0x3b0089[_0x511ef4(0x16f)]?.[_0x511ef4(0x128)])for(const _0x1480cc of _0x3b0089['with']['branches']){if(_0x1480cc['segment']===_0x307101){_0x4ade6b=_0x42a937[_0x511ef4(0xfc)],_0x332062=_0x1480cc[_0x511ef4(0xfc)]||_0x307101;break _0xdfa760;}}}}return{'stageName':_0x4ade6b,'criteriaName':_0x332062};}async function executeThreeStepJourneyCreate(_0x52a2dd,_0x23444d,_0x1ed42c,_0x27afe8,_0x14ba59,_0x263708,_0x150a51,_0x4183c9){const _0x2ba583=a136_0x3aef17,{activationDefToCreateRequest:_0x5bddc8,yamlRuleToApi:_0x2334e6}=_0x4183c9,{pendingEmbeddedSegments:_0x54c776,pendingEmbeddedActivations:_0x337baa,embeddedSegmentNameToId:_0x882e6d}=_0x27afe8,_0x526760=JSON[_0x2ba583(0xf3)](JSON[_0x2ba583(0x185)](_0x1ed42c));ensureJourneyDefaults(_0x526760[_0x2ba583(0x169)]),stripPendingIds(_0x526760);const _0x2d3508=await _0x52a2dd[_0x2ba583(0xd1)][_0x2ba583(0xc2)](_0x526760),_0x5bd3ec=_0x2d3508['id'],_0x3fab16=new Map();for(const _0x58b89d of _0x2d3508['attributes'][_0x2ba583(0xab)]){_0x3fab16[_0x2ba583(0xc1)](_0x58b89d[_0x2ba583(0xfc)]['toLowerCase'](),_0x58b89d['id']);}recoverSegmentIdsFromPushRecovery(_0x23444d,_0x882e6d,_0x263708[_0x2ba583(0x155)]);for(const [_0x59ab25,{definition:_0x35377d}]of _0x54c776){if(_0x882e6d['has'](_0x59ab25)){_0x150a51['onProgress']?.({'type':_0x2ba583(0x13a),'journeyName':_0x23444d['yamlConfig'][_0x2ba583(0xfc)],'segmentName':_0x59ab25});continue;}const _0x39227d=generateDeterministicJourneySegmentName(_0x23444d[_0x2ba583(0xb7)][_0x2ba583(0xfc)],_0x59ab25);_0x150a51[_0x2ba583(0x18f)]?.({'type':_0x2ba583(0x17c),'journeyName':_0x23444d[_0x2ba583(0xb7)][_0x2ba583(0xfc)],'segmentName':_0x59ab25});const _0x65a3f9=createSegmentIdResolver(_0x263708[_0x2ba583(0x155)],_0x59ab25),_0x314341=await resolveRuleSegmentIds(_0x35377d[_0x2ba583(0xf0)],_0x65a3f9),_0xc14a93=await createOrRecoverEmbeddedSegment(_0x52a2dd,_0x23444d,{'localName':_0x59ab25,'uniqueSegmentName':_0x39227d,'description':_0x35377d[_0x2ba583(0x16b)]||_0x2ba583(0xa0)+_0x59ab25,'journeyId':_0x5bd3ec,'resolvedRule':_0x314341,'parentId':_0x14ba59[_0x2ba583(0x126)],'folderId':_0x14ba59[_0x2ba583(0x188)]||''},_0x2334e6);_0x882e6d[_0x2ba583(0xc1)](_0x59ab25,_0xc14a93),_0x263708['segmentNameToId']['set'](_0x59ab25,_0xc14a93),_0x150a51['onProgress']?.({'type':_0x2ba583(0x13a),'journeyName':_0x23444d[_0x2ba583(0xb7)][_0x2ba583(0xfc)],'segmentName':_0x59ab25});}const _0x26dc9b=new Map();for(const [_0x2d3905,_0x112f51]of _0x337baa){_0x150a51['onProgress']?.({'type':_0x2ba583(0x15a),'journeyName':_0x23444d[_0x2ba583(0xb7)][_0x2ba583(0xfc)],'activationName':_0x2d3905});const _0x21931d=await _0x5bddc8(_0x112f51,_0x263708[_0x2ba583(0xa5)]),_0x3e8707={..._0x21931d,..._0x112f51[_0x2ba583(0x121)]!==undefined&&{'runAfterJourneyRefresh':_0x112f51['run_after_journey_refresh']}},_0x4e11ce=await _0x52a2dd[_0x2ba583(0xd1)][_0x2ba583(0xbf)](_0x5bd3ec,_0x3e8707);_0x26dc9b['set'](_0x2d3905,_0x4e11ce['id']),_0x27afe8['journeyActivationNameToId'][_0x2ba583(0xc1)](_0x2d3905,_0x4e11ce['id']),_0x150a51['onProgress']?.({'type':'embedded_activation_created','journeyName':_0x23444d[_0x2ba583(0xb7)][_0x2ba583(0xfc)],'activationName':_0x2d3905});}const _0x522e36=JSON[_0x2ba583(0xf3)](JSON[_0x2ba583(0x185)](_0x1ed42c));return _0x522e36['id']=_0x5bd3ec,ensureJourneyDefaults(_0x522e36[_0x2ba583(0x169)]),resolvePendingIdsInRequest(_0x522e36,_0x1ed42c,_0x3fab16,_0x882e6d,_0x26dc9b,_0x150a51),await _0x52a2dd[_0x2ba583(0xd1)]['update'](_0x5bd3ec,_0x522e36),deletePushRecovery(_0x23444d[_0x2ba583(0xf4)]),{'action':_0x2ba583(0x133),'journeyId':_0x5bd3ec,'embeddedSegmentNameToId':_0x882e6d};}export function stripWaitStepPendingIds(_0x1e30ce){const _0x27dc66=a136_0x3aef17,_0x295f81=_0x1e30ce['conditionSegmentId']&&isPendingSegmentId(_0x1e30ce[_0x27dc66(0x168)]),_0x531708=_0x1e30ce[_0x27dc66(0xef)]?.[_0x27dc66(0xf2)](_0x4cc585=>_0x4cc585[_0x27dc66(0x12c)]&&isPendingSegmentId(_0x4cc585[_0x27dc66(0x12c)]));(_0x295f81||_0x531708)&&(_0x1e30ce['waitStepType']=_0x27dc66(0x9f),_0x1e30ce[_0x27dc66(0xbc)]=0x1,_0x1e30ce[_0x27dc66(0x109)]=_0x27dc66(0x172),delete _0x1e30ce[_0x27dc66(0x168)],delete _0x1e30ce[_0x27dc66(0x13e)],delete _0x1e30ce[_0x27dc66(0xa9)],delete _0x1e30ce[_0x27dc66(0xef)]);}export function resolveWaitStepPendingIds(_0x2bd6c3,_0x217391,_0x14aca5,_0x35f493){const _0x5bf910=a136_0x3aef17;if(_0x217391[_0x5bf910(0x168)]&&isPendingSegmentId(_0x217391[_0x5bf910(0x168)])){const _0x184dd3=_0x14aca5(_0x217391['conditionSegmentId'],_0x5bf910(0xaa)+_0x35f493+_0x5bf910(0xa2));_0x184dd3&&(_0x2bd6c3[_0x5bf910(0x123)]='Condition',_0x2bd6c3[_0x5bf910(0x168)]=_0x184dd3,delete _0x2bd6c3[_0x5bf910(0xbc)],delete _0x2bd6c3[_0x5bf910(0x109)],_0x217391['conditionTimeoutDuration']!==undefined&&(_0x2bd6c3[_0x5bf910(0x13e)]=_0x217391[_0x5bf910(0x13e)]),_0x217391[_0x5bf910(0xa9)]&&(_0x2bd6c3['conditionTimeoutUnit']=_0x217391[_0x5bf910(0xa9)]));}if(_0x217391['conditions']){const _0xf774af=_0x217391[_0x5bf910(0xef)]['some'](_0x466b7f=>_0x466b7f[_0x5bf910(0x12c)]&&isPendingSegmentId(_0x466b7f[_0x5bf910(0x12c)]));if(_0xf774af){const _0x1f1a71=_0x217391['conditions'][_0x5bf910(0x144)](_0x152672=>{const _0x586847=_0x5bf910;if(_0x152672['segmentId']&&isPendingSegmentId(_0x152672['segmentId'])){const _0x28a21f=_0x14aca5(_0x152672[_0x586847(0x12c)],'stage\x20\x27'+_0x35f493+'\x27\x20wait\x20condition');return{..._0x152672,'segmentId':_0x28a21f||_0x152672['segmentId']};}return{..._0x152672};});_0x2bd6c3['waitStepType']=_0x5bf910(0x175),_0x2bd6c3['conditions']=_0x1f1a71,delete _0x2bd6c3[_0x5bf910(0xbc)],delete _0x2bd6c3[_0x5bf910(0x109)],delete _0x2bd6c3[_0x5bf910(0x168)],delete _0x2bd6c3[_0x5bf910(0x13e)],delete _0x2bd6c3[_0x5bf910(0xa9)];}}}function stripPendingIds(_0x4219b4){const _0x3b33c3=a136_0x3aef17;_0x4219b4[_0x3b33c3(0x169)][_0x3b33c3(0x116)]?.[_0x3b33c3(0x12c)]&&isPendingSegmentId(_0x4219b4[_0x3b33c3(0x169)][_0x3b33c3(0x116)][_0x3b33c3(0x12c)])&&delete _0x4219b4['attributes'][_0x3b33c3(0x116)];for(const _0x5f0e78 of _0x4219b4['attributes'][_0x3b33c3(0xab)]||[]){_0x5f0e78[_0x3b33c3(0x12f)]?.[_0x3b33c3(0x12c)]&&isPendingSegmentId(_0x5f0e78[_0x3b33c3(0x12f)][_0x3b33c3(0x12c)])&&delete _0x5f0e78[_0x3b33c3(0x12f)];_0x5f0e78['milestone']?.[_0x3b33c3(0x12c)]&&isPendingSegmentId(_0x5f0e78[_0x3b33c3(0xb8)][_0x3b33c3(0x12c)])&&delete _0x5f0e78[_0x3b33c3(0xb8)];_0x5f0e78['exitCriterias']&&(_0x5f0e78[_0x3b33c3(0x18c)]=_0x5f0e78[_0x3b33c3(0x18c)][_0x3b33c3(0x10e)](_0x1914a2=>!_0x1914a2[_0x3b33c3(0x12c)]||!isPendingSegmentId(_0x1914a2[_0x3b33c3(0x12c)])));if(_0x5f0e78[_0x3b33c3(0xa4)])for(const _0xfab7ac of Object[_0x3b33c3(0x167)](_0x5f0e78['steps'])){const _0x3c93ae=_0x5f0e78[_0x3b33c3(0xa4)][_0xfab7ac];_0x3c93ae[_0x3b33c3(0xbe)]==='Activation'&&_0x3c93ae[_0x3b33c3(0x114)]&&isPendingActivationId(_0x3c93ae[_0x3b33c3(0x114)])&&(_0x3c93ae[_0x3b33c3(0x114)]='');if(_0x3c93ae[_0x3b33c3(0xbe)]===_0x3b33c3(0xc9)&&_0x3c93ae[_0x3b33c3(0x128)])for(const _0x375aff of _0x3c93ae['branches']){_0x375aff[_0x3b33c3(0x12c)]&&isPendingSegmentId(_0x375aff[_0x3b33c3(0x12c)])&&(_0x375aff[_0x3b33c3(0x12c)]='');}_0x3c93ae[_0x3b33c3(0xbe)]===_0x3b33c3(0x153)&&stripWaitStepPendingIds(_0x3c93ae);}}}function resolvePendingIdsInRequest(_0xfc6742,_0x67dab5,_0x31bfa7,_0x43e74e,_0x36ae09,_0x3fdf02){const _0x5bf514=a136_0x3aef17,_0x924e91=(_0x1629f5,_0x1b5785)=>{const _0x2d336d=a136_0x39b7;if(!isPendingSegmentId(_0x1629f5))return _0x1629f5;const _0x5b5dec=extractPendingSegmentName(_0x1629f5),_0x1cc50c=_0x43e74e[_0x2d336d(0xe9)](_0x5b5dec);return!_0x1cc50c&&_0x3fdf02['logWarning']?.(_0x2d336d(0x163)+_0x5b5dec+_0x2d336d(0xfd)+_0x1b5785),_0x1cc50c;};if(_0xfc6742['attributes'][_0x5bf514(0x116)]?.[_0x5bf514(0x12c)]&&isPendingSegmentId(_0xfc6742[_0x5bf514(0x169)][_0x5bf514(0x116)]['segmentId'])){const _0x237bb6=_0x924e91(_0xfc6742['attributes'][_0x5bf514(0x116)][_0x5bf514(0x12c)],_0x5bf514(0x186));_0x237bb6&&(_0xfc6742['attributes'][_0x5bf514(0x116)][_0x5bf514(0x12c)]=_0x237bb6);}for(const _0x393097 of _0xfc6742[_0x5bf514(0x169)]['journeyStages']||[]){const _0x5cdec4=_0x31bfa7[_0x5bf514(0xe9)](_0x393097[_0x5bf514(0xfc)][_0x5bf514(0x12a)]());_0x5cdec4&&(_0x393097['id']=_0x5cdec4);if(_0x393097['entryCriteria']?.[_0x5bf514(0x12c)]&&isPendingSegmentId(_0x393097[_0x5bf514(0x12f)][_0x5bf514(0x12c)])){const _0x2e8097=_0x924e91(_0x393097['entryCriteria'][_0x5bf514(0x12c)],_0x5bf514(0xaa)+_0x393097['name']+_0x5bf514(0x19a));_0x2e8097&&(_0x393097[_0x5bf514(0x12f)]['segmentId']=_0x2e8097);}if(_0x393097[_0x5bf514(0x18c)])for(const _0x4bd0ec of _0x393097['exitCriterias']){if(_0x4bd0ec[_0x5bf514(0x12c)]&&isPendingSegmentId(_0x4bd0ec[_0x5bf514(0x12c)])){const _0x11f839=_0x924e91(_0x4bd0ec[_0x5bf514(0x12c)],_0x5bf514(0xaa)+_0x393097[_0x5bf514(0xfc)]+_0x5bf514(0x13d));_0x11f839&&(_0x4bd0ec[_0x5bf514(0x12c)]=_0x11f839);}}if(_0x393097[_0x5bf514(0xb8)]?.[_0x5bf514(0x12c)]&&isPendingSegmentId(_0x393097['milestone']['segmentId'])){const _0x3d4d71=_0x924e91(_0x393097['milestone']['segmentId'],'stage\x20\x27'+_0x393097[_0x5bf514(0xfc)]+_0x5bf514(0x14c));_0x3d4d71&&(_0x393097[_0x5bf514(0xb8)][_0x5bf514(0x12c)]=_0x3d4d71);}if(_0x393097[_0x5bf514(0xa4)]){const _0x9dcb3a=_0x544d14=>_0x67dab5[_0x5bf514(0x169)][_0x5bf514(0xab)]?.[_0x5bf514(0x135)](_0x26e589=>_0x26e589[_0x5bf514(0xfc)]['toLowerCase']()===_0x393097['name'][_0x5bf514(0x12a)]())?.[_0x5bf514(0xa4)]?.[_0x544d14];for(const _0x4bb680 of Object[_0x5bf514(0x167)](_0x393097['steps'])){const _0xef151a=_0x393097['steps'][_0x4bb680],_0x3d0ee4=_0x9dcb3a(_0x4bb680);if(_0xef151a[_0x5bf514(0xbe)]==='Activation'&&_0xef151a['journeyActivationStepId']&&(isPendingActivationId(_0xef151a['journeyActivationStepId'])||_0xef151a[_0x5bf514(0x114)]==='')){if(_0x3d0ee4?.['journeyActivationStepId']&&isPendingActivationId(_0x3d0ee4[_0x5bf514(0x114)])){const _0x332c5f=extractPendingActivationName(_0x3d0ee4[_0x5bf514(0x114)]),_0x5c0155=_0x36ae09[_0x5bf514(0xe9)](_0x332c5f);_0x5c0155&&(_0xef151a[_0x5bf514(0x114)]=_0x5c0155);}}if(_0xef151a['type']===_0x5bf514(0xc9)&&_0xef151a['branches']&&_0x3d0ee4?.[_0x5bf514(0x128)])for(let _0x28698a=0x0;_0x28698a<_0xef151a['branches'][_0x5bf514(0x93)];_0x28698a++){const _0x3110ad=_0xef151a[_0x5bf514(0x128)][_0x28698a],_0x223c40=_0x3d0ee4[_0x5bf514(0x128)][_0x28698a];if(_0x223c40?.['segmentId']&&isPendingSegmentId(_0x223c40[_0x5bf514(0x12c)])){const _0x547db7=_0x924e91(_0x223c40[_0x5bf514(0x12c)],_0x5bf514(0xaa)+_0x393097[_0x5bf514(0xfc)]+_0x5bf514(0x196)+(_0x3110ad[_0x5bf514(0xfc)]||_0x28698a)+'\x27');_0x547db7&&(_0x3110ad[_0x5bf514(0x12c)]=_0x547db7);}}_0xef151a['type']===_0x5bf514(0x153)&&_0x3d0ee4?.[_0x5bf514(0xbe)]===_0x5bf514(0x153)&&resolveWaitStepPendingIds(_0xef151a,_0x3d0ee4,_0x924e91,_0x393097[_0x5bf514(0xfc)]);}}}}
|
|
1
|
+
const a140_0x2324c6=a140_0x2c4f;(function(_0xce9f45,_0x19bf31){const _0xbc5037=a140_0x2c4f,_0x4b34eb=_0xce9f45();while(!![]){try{const _0x2ba7eb=parseInt(_0xbc5037(0x136))/0x1+-parseInt(_0xbc5037(0x149))/0x2*(parseInt(_0xbc5037(0x1ad))/0x3)+-parseInt(_0xbc5037(0x11c))/0x4*(parseInt(_0xbc5037(0x1a8))/0x5)+parseInt(_0xbc5037(0x12f))/0x6*(-parseInt(_0xbc5037(0x174))/0x7)+-parseInt(_0xbc5037(0x18a))/0x8*(parseInt(_0xbc5037(0x12a))/0x9)+parseInt(_0xbc5037(0x1bc))/0xa+parseInt(_0xbc5037(0x1ff))/0xb;if(_0x2ba7eb===_0x19bf31)break;else _0x4b34eb['push'](_0x4b34eb['shift']());}catch(_0x5ce85a){_0x4b34eb['push'](_0x4b34eb['shift']());}}}(a140_0x1beb,0x292b5));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a140_0x2324c6(0x1e8));export const PENDING_SEGMENT_PREFIX=a140_0x2324c6(0x141);export const PENDING_ACTIVATION_PREFIX=a140_0x2324c6(0x1f3);export function createPendingSegmentId(_0x426b75){return''+PENDING_SEGMENT_PREFIX+_0x426b75+'__';}export function isPendingSegmentId(_0x3c8af2){return _0x3c8af2['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x3c8af2['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x5899c5){const _0x3ae535=a140_0x2324c6;return _0x5899c5[_0x3ae535(0x13c)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0xe0c636){return''+PENDING_ACTIVATION_PREFIX+_0xe0c636+'__';}export function isPendingActivationId(_0x483a3d){const _0x4bf8ea=a140_0x2324c6;return _0x483a3d[_0x4bf8ea(0x1cb)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x5eaadf){const _0x15405f=a140_0x2324c6;return _0x5eaadf[_0x15405f(0x13c)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x12935b,_0x2e6368){const _0x5d82e2=a140_0x2324c6,_0x30e221=_0x12935b+'::'+(_0x2e6368[_0x5d82e2(0x111)]()||_0x5d82e2(0x176)),_0x2eeb59=createHash(_0x5d82e2(0x1d2))[_0x5d82e2(0x10b)](_0x30e221)[_0x5d82e2(0x122)]('hex')['slice'](0x0,0xc);return'journey_entry_criteria_'+_0x2eeb59;}export function ensureJourneyDefaults(_0x45e2b0){const _0x3de0dc=a140_0x2324c6;!_0x45e2b0['description']&&(_0x45e2b0['description']=''),!_0x45e2b0[_0x3de0dc(0x19f)]&&(_0x45e2b0[_0x3de0dc(0x19f)]=_0x3de0dc(0x1c6));}export function injectExistingStageIds(_0x4c8e99,_0x4169c2){const _0x4948df=a140_0x2324c6,_0x5f30fc=new Map(_0x4169c2[_0x4948df(0x1ac)](_0x3abe98=>[_0x3abe98[_0x4948df(0x1b4)],_0x3abe98['id']]));for(const _0x316292 of _0x4c8e99){if(!_0x316292['id']){const _0x550669=_0x5f30fc[_0x4948df(0x115)](_0x316292[_0x4948df(0x1b4)]);_0x550669&&(_0x316292['id']=_0x550669);}}}export function resolveTDFolderPath(_0x239a97,_0x5308c9,_0x2e6e45){if(!_0x5308c9)return _0x239a97;if(_0x239a97===_0x2e6e45||_0x239a97['startsWith'](_0x2e6e45+'/'))return _0x239a97;return _0x239a97?_0x2e6e45+'/'+_0x239a97:_0x2e6e45;}export function addFoldersToCreate(_0x518d4a,_0x35a636,_0x470026){const _0x3b6c6d=a140_0x2324c6;if(!_0x518d4a)return;if(_0x35a636['has'](_0x518d4a))return;const _0xd0c656=_0x518d4a['split']('/');let _0x27bc5d='';for(const _0x427e43 of _0xd0c656){_0x27bc5d=_0x27bc5d?_0x27bc5d+'/'+_0x427e43:_0x427e43,!_0x35a636[_0x3b6c6d(0x18f)](_0x27bc5d)&&_0x470026['add'](_0x27bc5d);}}export function sortFoldersByDepth(_0x2709b8){const _0x7313d1=a140_0x2324c6;return[..._0x2709b8][_0x7313d1(0x1e6)]((_0x13c036,_0x296f90)=>{const _0x43dff6=_0x7313d1,_0x5c1706=(_0x13c036['match'](/\//g)||[])['length'],_0x5d5937=(_0x296f90[_0x43dff6(0x199)](/\//g)||[])[_0x43dff6(0x13b)];return _0x5c1706-_0x5d5937;});}import*as a140_0x13bab5 from'yaml';import{readFileSync}from'fs';import a140_0x55cf1c from'path';import{isJourneyDef,parseYamlString as a140_0x4d7e52,toYamlString as a140_0x115742,normalizeJourneyDef,hasMultipleVersions,journeyResponseToDef,collectSegmentIdsFromJourneyApi}from'./journey-yaml.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,createJumpTargetCache,resolveJumpTarget,buildMergedJourneyDef,buildLocalRuleToNameMappingFromJourney,collectSegmentUsageCounts}from'./journey-utils.js';import{activationResponseToDef,segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,apiRuleToYaml,yamlRuleToApi,serializeExpandedRule,collectSegmentRefsFromRule,resolveRuleSegmentRefs,resolveRuleSegmentIds,journeyActivationStepToYaml}from'./child-segment-yaml.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';function a140_0x2c4f(_0x58b71c,_0x17c3e4){_0x58b71c=_0x58b71c-0xfa;const _0x1bebaa=a140_0x1beb();let _0x2c4fe1=_0x1bebaa[_0x58b71c];return _0x2c4fe1;}import{batchAsync}from'../../utils/async.js';import{buildFolderMaps}from'./resolution-context.js';import{SDKError,ErrorCode,isHttp400Error,getErrorMessage}from'../errors.js';import{readPushRecovery,saveSegmentToPushRecovery,deletePushRecovery}from'./push-recovery.js';import{validateSegmentDef,formatValidationResult}from'./yaml-validator.js';import{validateJourneyDef}from'./journey-validator.js';function stableStringify(_0x11092a){const _0x3255b6=a140_0x2324c6;if(Array['isArray'](_0x11092a))return'['+_0x11092a['map'](_0x3e1cf0=>stableStringify(_0x3e1cf0))[_0x3255b6(0x1af)](',')+']';if(_0x11092a&&typeof _0x11092a===_0x3255b6(0x106)){const _0x1d69c3=_0x11092a,_0x36a17e=Object[_0x3255b6(0x1c9)](_0x1d69c3)[_0x3255b6(0x1e6)](),_0x2b1c7a=_0x36a17e[_0x3255b6(0x1ac)](_0x4ec815=>'\x22'+_0x4ec815+'\x22:'+stableStringify(_0x1d69c3[_0x4ec815]));return'{'+_0x2b1c7a['join'](',')+'}';}const _0x309b41=JSON[_0x3255b6(0x117)](_0x11092a);return _0x309b41===undefined?_0x3255b6(0x1cd):_0x309b41;}function activationSignature(_0xd56c2){const _0x1995fc=a140_0x2324c6,_0x110f4a={'connection':_0xd56c2['connection'],..._0xd56c2[_0x1995fc(0x10f)]!==undefined&&{'all_columns':_0xd56c2[_0x1995fc(0x10f)]},..._0xd56c2[_0x1995fc(0x181)]!==undefined&&{'columns':_0xd56c2[_0x1995fc(0x181)]},..._0xd56c2[_0x1995fc(0x19b)]!==undefined&&{'behavior':_0xd56c2['behavior']},..._0xd56c2[_0x1995fc(0x1a9)]!==undefined&&{'schedule':_0xd56c2[_0x1995fc(0x1a9)]},..._0xd56c2['notification']!==undefined&&{'notification':_0xd56c2[_0x1995fc(0x1be)]},..._0xd56c2[_0x1995fc(0x1b8)]!==undefined&&{'connector_config':_0xd56c2['connector_config']},..._0xd56c2[_0x1995fc(0x1a5)]!==undefined&&{'activation_template_id':_0xd56c2[_0x1995fc(0x1a5)]}};return stableStringify(_0x110f4a);}async function fetchSegment(_0x42a0f3,_0x6f2021,_0x12f2de,_0x434a71){const _0x51390a=a140_0x2324c6,_0x32f73a=_0x434a71?.[_0x51390a(0x1dd)](_0x3b2580=>_0x3b2580['id']===_0x12f2de);if(_0x32f73a)return _0x32f73a;try{return await _0x42a0f3[_0x51390a(0x176)][_0x51390a(0xfc)](_0x6f2021,_0x12f2de);}catch(_0x4257aa){logger[_0x51390a(0x14a)](_0x51390a(0x1aa)+_0x12f2de+_0x51390a(0x11e)+_0x4257aa);try{return await _0x42a0f3[_0x51390a(0x176)]['getSegmentEntity'](_0x12f2de);}catch(_0xe5dca9){return logger['debug']('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x12f2de+':\x20'+_0xe5dca9),null;}}}function recoverSegmentIdsFromPushRecovery(_0xc1229f,_0x27429a,_0x376fed){const _0xceeb4a=a140_0x2324c6,_0x3fa1a1=readPushRecovery(_0xc1229f[_0xceeb4a(0x164)]);if(_0x3fa1a1?.[_0xceeb4a(0x1d9)]===_0xc1229f[_0xceeb4a(0x189)][_0xceeb4a(0x1b4)])for(const [_0x1ce4f3,_0x510dd4]of Object[_0xceeb4a(0xfd)](_0x3fa1a1['segments'])){const _0x17a910=generateDeterministicJourneySegmentName(_0xc1229f['yamlConfig'][_0xceeb4a(0x1b4)],_0x1ce4f3);_0x510dd4[_0xceeb4a(0x1f0)]===_0x17a910&&(_0x27429a[_0xceeb4a(0x12c)](_0x1ce4f3,_0x510dd4[_0xceeb4a(0x1e5)]),_0x376fed['set'](_0x1ce4f3,_0x510dd4[_0xceeb4a(0x1e5)]));}}async function createOrRecoverEmbeddedSegment(_0x26a142,_0x57e82d,_0x1866ef,_0x3f3d1e){const _0x2b3a45=a140_0x2324c6;let _0x4eccfe;try{_0x4eccfe=await _0x26a142[_0x2b3a45(0x176)][_0x2b3a45(0x155)]({'name':_0x1866ef['uniqueSegmentName'],'description':_0x1866ef[_0x2b3a45(0x198)],'journeyId':_0x1866ef[_0x2b3a45(0x15b)],'rule':_0x3f3d1e(_0x1866ef['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0x1866ef[_0x2b3a45(0x1b9)],'audienceId':_0x1866ef['parentId']});}catch(_0x5295dc){const _0x8fbbd5=_0x5295dc instanceof Error&&_0x5295dc[_0x2b3a45(0x1a7)][_0x2b3a45(0x104)]('Name\x20has\x20already\x20been\x20taken');if(_0x8fbbd5){const _0x15eb4f=readPushRecovery(_0x57e82d['absolutePath']),_0x24033f=_0x15eb4f?.[_0x2b3a45(0x1d9)]===_0x57e82d[_0x2b3a45(0x189)][_0x2b3a45(0x1b4)]?_0x15eb4f[_0x2b3a45(0x14c)][_0x1866ef[_0x2b3a45(0x10e)]]:undefined;if(_0x24033f?.[_0x2b3a45(0x1f0)]===_0x1866ef[_0x2b3a45(0x127)])await _0x26a142['segment'][_0x2b3a45(0x1ea)](_0x1866ef['parentId'],_0x24033f[_0x2b3a45(0x1e5)],{'description':_0x1866ef[_0x2b3a45(0x198)],'rule':_0x3f3d1e(_0x1866ef[_0x2b3a45(0x1d7)],!![]),'countPopulation':!![]}),_0x4eccfe=_0x24033f[_0x2b3a45(0x1e5)];else throw new SDKError(ErrorCode['SEGMENT_UPDATE_ERROR'],'Embedded\x20segment\x20\x27'+_0x1866ef[_0x2b3a45(0x10e)]+_0x2b3a45(0x191)+(_0x2b3a45(0x1c2)+_0x57e82d['absolutePath']['replace'](/([^/]+)$/,_0x2b3a45(0x1e3))+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x5295dc);}else throw _0x5295dc;}return saveSegmentToPushRecovery(_0x57e82d[_0x2b3a45(0x164)],_0x57e82d[_0x2b3a45(0x189)]['name'],_0x1866ef['localName'],{'segmentId':_0x4eccfe,'uniqueServerName':_0x1866ef['uniqueSegmentName'],'createdAt':new Date()[_0x2b3a45(0x19e)]()}),_0x4eccfe;}export async function prepareSegmentFiles(_0x4c9b37,_0x39a33b,_0x59111e,_0x269ead,_0x48c636){const _0x212a12=a140_0x2324c6,{activationDefToCreateRequest:_0x55de21}=await import('./child-segment-yaml.js'),_0x527a46=[],_0xc5266=new Set();for(const {yamlConfig:_0x4e7a0a,folderPath:_0x44d145,sourcePath:_0x73ddfc}of _0x4c9b37){const _0x15eabb=resolveTDFolderPath(_0x44d145,_0x269ead,_0x48c636),_0x2a5c97=_0x15eabb+':'+_0x4e7a0a[_0x212a12(0x1b4)],_0x5f5d35=_0x39a33b[_0x212a12(0x1bf)][_0x212a12(0x115)](_0x2a5c97),_0x4219ee=_0x5f5d35?_0x39a33b['activationsBySegmentId'][_0x212a12(0x115)](_0x5f5d35['id'])||[]:[];addFoldersToCreate(_0x15eabb,_0x39a33b[_0x212a12(0x1b6)],_0xc5266);const _0x7daa13=calculateActivationActions(_0x4e7a0a[_0x212a12(0x158)]||[],_0x4219ee,_0x39a33b[_0x212a12(0x133)],_0x39a33b[_0x212a12(0x1c8)]);for(const _0x56a20c of _0x7daa13){(_0x56a20c[_0x212a12(0x13e)]===_0x212a12(0x1f1)||_0x56a20c['type']===_0x212a12(0x10b))&&_0x56a20c['yamlActivation']&&(_0x56a20c[_0x212a12(0x1ec)]=await _0x55de21(_0x56a20c['yamlActivation'],_0x59111e));}const _0x39becc=calculateSegmentDiff(_0x4e7a0a,_0x5f5d35,_0x4219ee,_0x39a33b[_0x212a12(0x133)],_0x39a33b[_0x212a12(0x1c8)]);_0x527a46[_0x212a12(0x1fb)]({'relativePath':_0x4e7a0a[_0x212a12(0x1b4)],'absolutePath':_0x73ddfc,'yamlConfig':_0x4e7a0a,'folderPath':_0x15eabb,'existingSegment':_0x5f5d35,'existingActivations':_0x4219ee,'isNew':_0x39becc[_0x212a12(0x13a)],'hasChanges':_0x39becc[_0x212a12(0x196)],'diff':_0x39becc[_0x212a12(0x202)],'activationActions':_0x7daa13});}return{'segmentFiles':_0x527a46,'foldersToCreate':_0xc5266};}export async function prepareJourneyFiles(_0x29dc58,_0x55a262,_0x5644e4,_0x4f2525){const _0x5d4c92=a140_0x2324c6,_0x49c7f=[],_0x34f0e5=new Set();for(const {yamlConfig:_0x5514b5,folderPath:_0x5d9863,sourcePath:_0x53fcd3}of _0x29dc58){const _0x1eb8be=resolveTDFolderPath(_0x5d9863,_0x5644e4,_0x4f2525),_0x23f4f9=_0x1eb8be+':'+_0x5514b5[_0x5d4c92(0x1b4)],_0x91a446=_0x55a262['journeyBundlesByFolderAndName'][_0x5d4c92(0x115)](_0x23f4f9);let _0x5f300a,_0x5e1677;if(_0x91a446&&_0x91a446['length']>0x0){const _0x231f3f=buildLocalExpandedRuleMappings(_0x5514b5),{createYamlContext:_0x5b3089,prefetchJourneySegments:_0x42a8db}=createPushYamlContextForBundle(_0x55a262[_0x5d4c92(0x135)],_0x55a262[_0x5d4c92(0x194)],_0x55a262[_0x5d4c92(0x1fd)],_0x231f3f,_0x55a262[_0x5d4c92(0x133)],_0x55a262[_0x5d4c92(0x1c8)],_0x55a262[_0x5d4c92(0x1cf)],_0x55a262[_0x5d4c92(0x1fc)]);await _0x42a8db(_0x91a446[_0x5d4c92(0x1ac)](_0x209f25=>_0x209f25['id']));const _0x233614=await _0x55a262[_0x5d4c92(0x135)]['journey'][_0x5d4c92(0x18c)](_0x91a446[0x0][_0x5d4c92(0x109)]),_0x12460d=hasMultipleVersions(_0x5514b5),_0x291322=async _0x520e51=>{const _0x3777db=_0x5d4c92,_0x1e9405=_0x55a262['journeyById']?.[_0x3777db(0x115)](_0x520e51);if(_0x1e9405)return _0x1e9405;return _0x55a262[_0x3777db(0x173)]({'journeyId':_0x520e51,'journeyName':_0x5514b5['name'],'isMultiVersion':_0x91a446[_0x3777db(0x13b)]>0x1});};if(_0x12460d&&_0x91a446[_0x5d4c92(0x13b)]>0x1){const _0x218658=[];for(const _0x380616 of _0x91a446){const _0x304800=_0x380616[_0x5d4c92(0x1a3)]||0x1;_0x55a262[_0x5d4c92(0x201)]?.[_0x5d4c92(0x10b)](_0x5d4c92(0x151)+_0x5514b5[_0x5d4c92(0x1b4)]+'\x20v'+_0x304800);const _0x2ad626=await _0x291322(_0x380616['id']),_0x41d614=_0x5b3089(_0x380616['id']),_0x4008c0=await journeyResponseToDef(_0x2ad626,_0x41d614);_0x218658[_0x5d4c92(0x1fb)]({'item':_0x380616,'yaml':_0x4008c0});}const _0x1701b7=buildLocalRuleToNameMappingFromJourney(_0x5514b5);_0x5e1677=buildMergedJourneyDef(_0x218658,_0x1701b7,_0x233614);const _0x4d1b04=Math['max'](..._0x218658[_0x5d4c92(0x1ac)](_0x224e72=>_0x224e72[_0x5d4c92(0x190)][_0x5d4c92(0x1a3)]||0x0)),_0x15754f=_0x91a446[_0x5d4c92(0x1dd)](_0x241e22=>(_0x241e22[_0x5d4c92(0x1a3)]||0x0)===_0x4d1b04);_0x15754f&&(_0x55a262['progress']?.[_0x5d4c92(0x10b)]('Fetching\x20'+_0x5514b5['name']+'\x20v'+_0x4d1b04),_0x5f300a=await _0x291322(_0x15754f['id']));}else{const _0x1a24be=_0x91a446[_0x91a446[_0x5d4c92(0x13b)]-0x1];_0x55a262[_0x5d4c92(0x201)]?.[_0x5d4c92(0x10b)](_0x5d4c92(0x151)+_0x5514b5[_0x5d4c92(0x1b4)]),_0x5f300a=await _0x291322(_0x1a24be['id']);const _0x4118cf=_0x5b3089(_0x1a24be['id']),_0x18a978=await journeyResponseToDef(_0x5f300a,_0x4118cf),_0xe96ef4=buildLocalRuleToNameMappingFromJourney(_0x5514b5);_0x5e1677=buildMergedJourneyDef([{'item':_0x1a24be,'yaml':_0x18a978}],_0xe96ef4,_0x233614);}}addFoldersToCreate(_0x1eb8be,_0x55a262['folderPathToId'],_0x34f0e5);const _0x3c6a1d=calculateJourneyDiff(_0x5514b5,_0x5e1677);_0x49c7f[_0x5d4c92(0x1fb)]({'relativePath':_0x5514b5[_0x5d4c92(0x1b4)],'absolutePath':_0x53fcd3,'yamlConfig':_0x5514b5,'folderPath':_0x1eb8be,'existingJourney':_0x5f300a,'isNew':_0x3c6a1d[_0x5d4c92(0x13a)],'hasChanges':_0x3c6a1d[_0x5d4c92(0x196)],'diff':_0x3c6a1d[_0x5d4c92(0x202)]});}return{'journeyFiles':_0x49c7f,'foldersToCreate':_0x34f0e5};}export function calculateActivationActions(_0x1074f0,_0x273108,_0x527174,_0x63aa6b){const _0x17c38b=a140_0x2324c6,_0x2a20ff=[],_0x2c3daf=new Map();for(const _0x53f55a of _0x273108){_0x2c3daf[_0x17c38b(0x12c)](_0x53f55a['name'],_0x53f55a);}const _0x3fe4b2=new Map();for(const _0x2a3be9 of _0x1074f0){_0x3fe4b2[_0x17c38b(0x12c)](_0x2a3be9[_0x17c38b(0x1b4)],_0x2a3be9);}for(const _0x375473 of _0x1074f0){const _0x35783d=_0x2c3daf['get'](_0x375473[_0x17c38b(0x1b4)]);if(!_0x35783d)_0x2a20ff[_0x17c38b(0x1fb)]({'type':'create','name':_0x375473[_0x17c38b(0x1b4)],'yamlActivation':_0x375473});else{const _0x1a3b50=activationResponseToDef(_0x35783d,_0x527174,_0x63aa6b),_0xcc5adb=a140_0x13bab5[_0x17c38b(0x117)](_0x1a3b50),_0x3aa71f=a140_0x13bab5['stringify'](_0x375473);_0xcc5adb!==_0x3aa71f&&_0x2a20ff[_0x17c38b(0x1fb)]({'type':_0x17c38b(0x10b),'name':_0x375473[_0x17c38b(0x1b4)],'yamlActivation':_0x375473,'existingActivation':_0x35783d});}}for(const _0x239800 of _0x273108){!_0x3fe4b2[_0x17c38b(0x18f)](_0x239800[_0x17c38b(0x1b4)])&&_0x2a20ff[_0x17c38b(0x1fb)]({'type':'delete','name':_0x239800[_0x17c38b(0x1b4)],'existingActivation':_0x239800});}return _0x2a20ff;}function calculateYamlDiff(_0xfea7f0,_0x4546a1){if(_0x4546a1){const _0x3a4fd9=generateDiff(_0x4546a1,_0xfea7f0),_0x59dbab=hasChanges(_0x3a4fd9);return{'isNew':![],'hasChanges':_0x59dbab,'diff':_0x59dbab?formatDiffWithColors(_0x3a4fd9):undefined};}const _0xfbfa17=generateDiff('',_0xfea7f0);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0xfbfa17)};}export function calculateSegmentDiff(_0x76be63,_0x4ea92e,_0x3b4d20,_0x27a6da,_0x35151d){const _0x57c0d3=segmentToYamlString(_0x76be63),_0x322ca8=_0x4ea92e?segmentToYamlString(segmentWithActivationsToYaml(_0x4ea92e,_0x3b4d20,undefined,_0x27a6da,_0x35151d)):undefined;return calculateYamlDiff(_0x57c0d3,_0x322ca8);}export function calculateJourneyDiff(_0xaab12a,_0x5bf9ff){const _0x36eb83=normalizeJourneyDef(_0xaab12a,_0xaab12a),_0x33231d=a140_0x115742(_0x36eb83),_0x58ed41=_0x5bf9ff?a140_0x115742(normalizeJourneyDef(_0x5bf9ff,_0xaab12a)):undefined;return calculateYamlDiff(_0x33231d,_0x58ed41);}export function findSegmentsToDelete(_0x38d93c,_0x3baed0,_0x520f2a,_0x4a04d1,_0x294352){const _0x11e373=a140_0x2324c6,_0x4ed5fa=new Set();for(const {yamlConfig:_0x31ae17,folderPath:_0xb47f35}of _0x3baed0){_0x4ed5fa['add'](_0xb47f35+':'+_0x31ae17[_0x11e373(0x1b4)]);}return _0x38d93c[_0x11e373(0x108)](_0x156596=>{const _0x19c367=_0x11e373,_0x2bdbd5=_0x156596[_0x19c367(0x11a)]?_0x520f2a['get'](_0x156596[_0x19c367(0x11a)][_0x19c367(0x1ae)]())||'':'',_0x31bb00=_0x2bdbd5+':'+_0x156596[_0x19c367(0x1b4)];if(_0x4ed5fa[_0x19c367(0x18f)](_0x31bb00))return![];if(_0x294352)return _0x2bdbd5===_0x4a04d1||_0x2bdbd5['startsWith'](_0x4a04d1+'/');return!![];});}export function findJourneysToDelete(_0x37ffe7,_0x57328c,_0x2d0e52,_0x196c9f,_0x5cd4d1){const _0x73cdf9=a140_0x2324c6,_0x3cd7db=new Set();for(const {yamlConfig:_0x206aa0,folderPath:_0x30d264}of _0x57328c){_0x3cd7db['add'](_0x30d264+':'+_0x206aa0[_0x73cdf9(0x1b4)]);}return _0x37ffe7['filter'](_0x1c9c0d=>{const _0x31cfc1=_0x73cdf9,_0x3c1c87=_0x1c9c0d[_0x31cfc1(0x1b9)]?_0x2d0e52[_0x31cfc1(0x115)](_0x1c9c0d['folderId'])||'':'',_0x3a9c91=_0x3c1c87+':'+_0x1c9c0d[_0x31cfc1(0x143)];if(_0x3cd7db[_0x31cfc1(0x18f)](_0x3a9c91))return![];if(_0x5cd4d1)return _0x3c1c87===_0x196c9f||_0x3c1c87[_0x31cfc1(0x1cb)](_0x196c9f+'/');return!![];});}export function buildSegmentLookupMap(_0x2fc1c3,_0x3666cc){const _0x58c014=a140_0x2324c6,_0x2f03df=new Map();for(const _0x4fcdfd of _0x2fc1c3){const _0x3b2a17=_0x4fcdfd[_0x58c014(0x11a)]?_0x3666cc[_0x58c014(0x115)](_0x4fcdfd[_0x58c014(0x11a)][_0x58c014(0x1ae)]())||'':'',_0x222655=_0x3b2a17+':'+_0x4fcdfd[_0x58c014(0x1b4)];_0x2f03df[_0x58c014(0x12c)](_0x222655,_0x4fcdfd);}return _0x2f03df;}export function buildSegmentNameToIdMap(_0x486f49){const _0x470984=a140_0x2324c6,_0x36a3dd=new Map();for(const _0x4d23fc of _0x486f49){_0x36a3dd[_0x470984(0x12c)](_0x4d23fc['name'],_0x4d23fc['id']);}return _0x36a3dd;}export function buildJourneyBundleLookupMap(_0x48f3f1,_0x6d0ec3){const _0x4c2c30=a140_0x2324c6,_0x2d0235=new Map();for(const _0x1cb3e3 of _0x48f3f1){const _0x57ca15=_0x1cb3e3['folderId']?_0x6d0ec3[_0x4c2c30(0x115)](_0x1cb3e3['folderId'])||'':'',_0x1e1236=_0x57ca15+':'+_0x1cb3e3['journeyBundleName'];!_0x2d0235[_0x4c2c30(0x18f)](_0x1e1236)&&_0x2d0235[_0x4c2c30(0x12c)](_0x1e1236,[]),_0x2d0235[_0x4c2c30(0x115)](_0x1e1236)['push'](_0x1cb3e3);}for(const _0x392e6c of _0x2d0235[_0x4c2c30(0x19d)]()){_0x392e6c[_0x4c2c30(0x1e6)]((_0x12ab26,_0x254f1b)=>(_0x12ab26[_0x4c2c30(0x1a3)]||0x0)-(_0x254f1b['versionNumber']||0x0));}return _0x2d0235;}export function collectFoldersToCreate(_0x38dcf9,_0x2816af){const _0x2c20f6=a140_0x2324c6,_0x161765=new Set();for(const _0x2dd864 of _0x38dcf9){if(!_0x2dd864)continue;if(_0x2816af[_0x2c20f6(0x18f)](_0x2dd864))continue;const _0x524e01=_0x2dd864['split']('/');let _0x55d069='';for(const _0x17e346 of _0x524e01){_0x55d069=_0x55d069?_0x55d069+'/'+_0x17e346:_0x17e346,!_0x2816af[_0x2c20f6(0x18f)](_0x55d069)&&_0x161765[_0x2c20f6(0x1f4)](_0x55d069);}}return _0x161765;}export function parseAndClassifyYamlFiles(_0x1dbb63,_0xa55d4a,_0x5cf8bd){const _0x12ab8b=a140_0x2324c6,_0x4d2234=[],_0x23928c=[];for(const _0x1f2a5d of _0x1dbb63){const _0x395927=a140_0x55cf1c[_0x12ab8b(0xfb)](_0xa55d4a,a140_0x55cf1c['dirname'](_0x1f2a5d)),_0x5e1687=_0x395927==='.'?'':_0x395927,_0x824636=readFileSync(_0x1f2a5d,'utf-8'),_0xd9547b=a140_0x13bab5[_0x12ab8b(0x1f2)](_0x824636);if(isJourneyDef(_0xd9547b)){const _0x30d7bf=a140_0x4d7e52(_0x824636);_0x23928c['push']({'yamlConfig':_0x30d7bf,'folderPath':_0x5e1687,'sourcePath':_0x1f2a5d});}else{if(!_0x5cf8bd?.[_0x12ab8b(0x114)]){const _0x4676fa=parseSegmentYamlFile(_0x824636),_0x2fc9da=normalizeChildSegmentYaml(_0x4676fa);_0x4d2234['push']({'yamlConfig':_0x2fc9da,'folderPath':_0x5e1687,'sourcePath':_0x1f2a5d});}}}return{'segments':_0x4d2234,'journeys':_0x23928c};}export function validateParsedFiles(_0x2cbb1d,_0x7be90e){const _0x452d98=a140_0x2324c6,_0x38390d=[];for(const {yamlConfig:_0x43cea9,sourcePath:_0x4ce16d}of _0x2cbb1d[_0x452d98(0x14c)]){const _0x1e950f=readFileSync(_0x4ce16d,_0x452d98(0x10a)),_0x2d6ab3=a140_0x13bab5['parseDocument'](_0x1e950f),_0x16ab83=validateSegmentDef(_0x43cea9,{'source':_0x1e950f,'document':_0x2d6ab3},{'skipSchema':!![]});if(!_0x16ab83[_0x452d98(0x1d8)]){const _0x306061=a140_0x55cf1c[_0x452d98(0xfb)](_0x7be90e,_0x4ce16d);_0x38390d[_0x452d98(0x1fb)]({'filePath':_0x306061,'source':_0x1e950f,'result':_0x16ab83,'isJourney':![]});}}for(const {yamlConfig:_0x30ffef,sourcePath:_0x17de2d}of _0x2cbb1d[_0x452d98(0x139)]){const _0x24c25f=readFileSync(_0x17de2d,'utf-8'),_0x219517=a140_0x13bab5[_0x452d98(0x1ee)](_0x24c25f),_0x467003=validateJourneyDef(_0x30ffef,{'source':_0x24c25f,'document':_0x219517},{'skipSchema':!![]});if(!_0x467003[_0x452d98(0x1d8)]){const _0x138e0e=a140_0x55cf1c[_0x452d98(0xfb)](_0x7be90e,_0x17de2d);_0x38390d[_0x452d98(0x1fb)]({'filePath':_0x138e0e,'source':_0x24c25f,'result':_0x467003,'isJourney':!![]});}}return _0x38390d;}export function formatValidationErrors(_0xf1a0e2){const _0x1fb35b=a140_0x2324c6,_0x121de5=[];for(const {filePath:_0x2d667d,source:_0x2eeeaf,result:_0x463149,isJourney:_0x48c28a}of _0xf1a0e2){const _0xebccc3=_0x48c28a?_0x1fb35b(0x1ab):_0x1fb35b(0x176);_0x121de5[_0x1fb35b(0x1fb)]('\x0a'+_0x2d667d+'\x20('+_0xebccc3+_0x1fb35b(0x177)+_0x463149[_0x1fb35b(0x19c)][_0x1fb35b(0x13b)]+_0x1fb35b(0x14d)),_0x121de5[_0x1fb35b(0x1fb)](formatValidationResult(_0x463149,_0x2eeeaf,_0x2d667d));}return _0x121de5[_0x1fb35b(0x1af)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x505c37){const _0x32aee0=a140_0x2324c6,_0x4d6554=new Set(),_0x431d10=new Map(),_0x3d5deb=collectSegmentUsageCounts(_0x505c37);if(_0x505c37[_0x32aee0(0x14c)])for(const [_0x4d3831,_0x167002]of Object[_0x32aee0(0xfd)](_0x505c37[_0x32aee0(0x14c)])){_0x4d6554[_0x32aee0(0x1f4)](_0x4d3831);if(_0x167002[_0x32aee0(0x154)]){const _0x5263f6=yamlRuleToApi(_0x167002[_0x32aee0(0x154)]),_0x209a82=apiRuleToYaml(_0x5263f6);_0x431d10[_0x32aee0(0x12c)](_0x4d3831,_0x209a82);}}const _0x3e9987=new Map();let _0x401f76=0x0;for(const [_0x4b257b,_0x29561a]of _0x431d10){const _0x527302=serializeExpandedRule(_0x29561a,_0x431d10),_0x3fb272=_0x3e9987[_0x32aee0(0x115)](_0x527302)||[];_0x3fb272[_0x32aee0(0x1fb)]({'name':_0x4b257b,'index':_0x401f76}),_0x3e9987[_0x32aee0(0x12c)](_0x527302,_0x3fb272),_0x401f76++;}const _0x125103=new Map();for(const [_0x593f04,_0x9ffec8]of _0x3e9987){const _0x2835ce=_0x9ffec8['slice']()['sort']((_0x2b2cef,_0x2fa967)=>{const _0x38fb7f=_0x32aee0,_0x446f24=_0x3d5deb['get'](_0x2b2cef[_0x38fb7f(0x1b4)])||0x0,_0x69e281=_0x3d5deb[_0x38fb7f(0x115)](_0x2fa967[_0x38fb7f(0x1b4)])||0x0;if(_0x446f24!==_0x69e281)return _0x69e281-_0x446f24;return _0x2b2cef[_0x38fb7f(0x12b)]-_0x2fa967[_0x38fb7f(0x12b)];})[_0x32aee0(0x1ac)](_0x3f9707=>_0x3f9707[_0x32aee0(0x1b4)]),_0xb8b582=[];for(const _0x5abe12 of _0x2835ce){const _0x875f7e=_0x3d5deb['get'](_0x5abe12)||0x0,_0x3a3b50=Math[_0x32aee0(0x19a)](_0x875f7e,0x1);for(let _0x5767b7=0x0;_0x5767b7<_0x3a3b50;_0x5767b7++){_0xb8b582[_0x32aee0(0x1fb)](_0x5abe12);}}_0x125103[_0x32aee0(0x12c)](_0x593f04,_0xb8b582);}return{'existingLocalSegmentNames':_0x4d6554,'localSegmentRules':_0x431d10,'localExpandedRuleToNames':_0x125103};}export function createSegmentIdResolver(_0x488140,_0x358ff6){return async _0x246648=>{const _0x379ffc=a140_0x2c4f,_0x55a80c=_0x488140[_0x379ffc(0x115)](_0x246648);if(!_0x55a80c)throw new SDKError(ErrorCode[_0x379ffc(0x100)],_0x379ffc(0x165)+_0x246648+_0x379ffc(0x17b)+_0x358ff6+'\x27)');return _0x55a80c;};}export function extractRootFolderId(_0x224290){const _0x5545e5=a140_0x2324c6;return _0x224290[_0x5545e5(0x1b3)]?.[_0x5545e5(0x170)]?.[_0x5545e5(0x16c)]?.['id']||_0x224290[_0x5545e5(0x1b3)]?.[_0x5545e5(0x1ce)]?.[_0x5545e5(0x16c)]?.['id'];}export function buildConnectionMaps(_0x51b3f0){const _0x43f40f=a140_0x2324c6,_0x2139cf=new Map(),_0x47a12d=new Map(),_0x159dd9=new Map();for(const _0x18378c of _0x51b3f0){_0x2139cf[_0x43f40f(0x12c)](_0x18378c[_0x43f40f(0x1b4)],parseInt(_0x18378c['id'],0xa)),_0x47a12d[_0x43f40f(0x12c)](_0x18378c['id'],_0x18378c[_0x43f40f(0x1b4)]),_0x159dd9[_0x43f40f(0x12c)](_0x18378c[_0x43f40f(0x1b4)],_0x18378c[_0x43f40f(0x13e)]);}return{'nameToId':_0x2139cf,'idToName':_0x47a12d,'nameToType':_0x159dd9};}function a140_0x1beb(){const _0x4cd465=['segment_updated','size','activation_created','list','Journey\x20\x27','yamlConfig','8TYmPwX','getJourney','getLatestJourneyId','Created\x20segment\x20\x27','Creating\x20activation\x20\x27','has','item','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','folder','folderPath','parentId','SEGMENT_UPDATE_ERROR','hasChanges','resolveSegment','description','match','max','behavior','errors','values','toISOString','state','run_after_journey_refresh','JOURNEY_SYNTAX_ERROR','createSegment','versionNumber','\x20(referenced\x20in\x20journey\x20','activation_template_id','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','message','5iCBvep','schedule','getSegment\x20failed\x20for\x20','journey','map','3UFMFfT','toString','join','stages','conditionTimeoutUnit','segment_deleted','relationships','name','Failed\x20to\x20fetch\x20referenced\x20segment\x20','folderPathToId','conditionTimeoutDuration','connector_config','folderId',').\x20','\x20activation\x20\x27','1711960Xvcftk','\x27\x20from\x20file:\x20','notification','segmentByFolderAndName','entryCriteria','Condition','Delete\x20the\x20push\x20recovery\x20file\x20(','segment_creating','\x27...','steps','draft','\x27\x20for\x20','connectionIdToNameMap','keys','deleteActivation','startsWith','some','null','parentFolder','activationStepsById','ACTIVATION_SYNTAX_ERROR','user','sha1','segment_deleting','split','Duration','effectiveFolderId','resolvedRule','valid','journeyName','activationContext','Updated\x20segment\x20\x27','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','find','Activation\x20not\x20found:\x20','milestone','logDeleted','activation_updated','SEGMENT_SYNTAX_ERROR','.$1.push-recovery.json','all','segmentId','sort','JOURNEY_UPDATE_ERROR','tdx.sdk.push-workflow','journeyStages','updateSegmentById','existingActivation','validatedRequest','Created\x20journey\x20\x27','parseDocument','Deleted\x20activation\x20\x27','uniqueServerName','create','parse','__pending_act_','add','listActivations','Deleting\x20activation\x20\x27','branches','\x27\x20milestone','conditionSegmentId','slice','push','journeyById','existingSegments','Updated\x20journey\x20\x27','6927393zdQutv','createdSegmentId','progress','diff','embedded_segment_created','relative','getSegment','entries','segmentNameToId','\x0a\x20\x20','SEGMENT_NOT_FOUND','activationActions','Created\x20activation\x20\x27','segment_updating','includes','Matched\x20server\x20segment\x20\x27','object','delete','filter','journeyBundleId','utf-8','update','updated','journeyActivationStepId','localName','all_columns','activationParams','trim','INTERNAL','embedded_segment_creating','skipSegments','get','segment_created','stringify','embedded_activation_creating','embeddedSegmentNameToId','segmentFolderId','logSuccess','687172NGiXhx','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','waitStep','kind','Deleted\x20segment\x20\x27','digest','nameToType','\x20segment\x20from\x20file:\x20','journey_updated','WaitStep','uniqueSegmentName','\x27\x20by\x20rule\x20content','decision_point','1574631zvHQiM','index','set','rootFolderId','journeyActivationNameToId','6BlCven','journey_created','createFolder','action','idToEmailMap','createdSegmentIds','deps','67362BbKjSB','\x27\x20not\x20found\x20in\x20journey\x20\x27','waitStepUnit','journeys','isNew','length','replace','folder_creating','type','goal\x20criteria','Activation','__pending_','conditions','journeyBundleName','results','reduce','Failed\x20to\x20','nameToId','entry_criteria','585446zwHDwK','debug','createActivation','segments','\x20error(s)','\x27\x20entry\x20criteria','deleteSegment','idToName','Fetching\x20','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','with','rule','createJourneySegment','logWarning','activation_updating','activations','goal','updateActivation','journeyId','day','activation_deleting','toLowerCase','\x27\x20to\x20local\x20\x27','withProgress','Created\x20folder\x20\x27','existingSegment','flatMap','absolutePath','Segment\x20not\x20found:\x20','Creating\x20folder\x20\x27','NOT_FOUND','unchanged','buildUserMaps','Failed\x20to\x20resolve\x20activation\x20','existingJourney','data','./child-segment-yaml.js','onProgress','activation_','parentSegmentFolder','Entry\x20criteria:\x20','\x27\x20wait\x20condition','fetchJourney','421519QXOrWr','exitCriterias','segment','):\x20','attributes','deleted','Failed\x20to\x20resolve\x20segment\x20','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','journey_creating','stage\x20\x27','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','./journey-yaml.js','from','columns','DecisionPoint','created'];a140_0x1beb=function(){return _0x4cd465;};return a140_0x1beb();}export function calculatePushStats(_0xf5466e,_0x142415,_0x5da293,_0x68ca90,_0x1aed25,_0x7bf4eb,_0x272415){const _0x17cd78=a140_0x2324c6,_0x59eb16=_0xf5466e[_0x17cd78(0x108)](_0x2d7d68=>_0x2d7d68[_0x17cd78(0x13a)]),_0x431f26=_0xf5466e[_0x17cd78(0x108)](_0x1e663b=>!_0x1e663b[_0x17cd78(0x13a)]&&_0x1e663b[_0x17cd78(0x196)]),_0x49bebd=_0xf5466e[_0x17cd78(0x108)](_0x4d610b=>!_0x4d610b[_0x17cd78(0x13a)]&&!_0x4d610b['hasChanges']),_0x467f44=_0x7bf4eb?_0x68ca90:[],_0x1e0196=_0x142415[_0x17cd78(0x108)](_0xc360d7=>_0xc360d7['isNew']),_0x2773cf=_0x142415['filter'](_0x499cea=>!_0x499cea[_0x17cd78(0x13a)]&&_0x499cea[_0x17cd78(0x196)]),_0x21dd63=_0x142415[_0x17cd78(0x108)](_0x453e6c=>!_0x453e6c[_0x17cd78(0x13a)]&&!_0x453e6c[_0x17cd78(0x196)]),_0x1d3064=_0x7bf4eb?_0x1aed25:[],_0x5f3575=_0xf5466e[_0x17cd78(0x163)](_0x12eaee=>_0x12eaee['activationActions']),_0x2a7d21=_0x5f3575[_0x17cd78(0x108)](_0xe261db=>_0xe261db[_0x17cd78(0x13e)]===_0x17cd78(0x1f1)),_0x20de13=_0x5f3575[_0x17cd78(0x108)](_0x21f631=>_0x21f631['type']===_0x17cd78(0x10b)),_0x35dea4=_0x5f3575[_0x17cd78(0x108)](_0x142051=>_0x142051[_0x17cd78(0x13e)]==='delete'),_0x20e6b2=Array[_0x17cd78(0x180)](_0x5da293)[_0x17cd78(0x1e6)](),_0x2cfa40=_0x272415?![]:_0x59eb16[_0x17cd78(0x13b)]>0x0||_0x431f26[_0x17cd78(0x13b)]>0x0||_0x467f44[_0x17cd78(0x13b)]>0x0,_0x1e8575=_0x1e0196['length']>0x0||_0x2773cf['length']>0x0||_0x1d3064['length']>0x0,_0x547df0=_0x272415?![]:_0x5f3575[_0x17cd78(0x13b)]>0x0,_0x7a52fc=_0x20e6b2[_0x17cd78(0x13b)]>0x0;return{'segments':{'new':_0x59eb16,'changed':_0x431f26,'unchanged':_0x49bebd,'toDelete':_0x467f44},'journeys':{'new':_0x1e0196,'changed':_0x2773cf,'unchanged':_0x21dd63,'toDelete':_0x1d3064},'activations':{'all':_0x5f3575,'toCreate':_0x2a7d21,'toUpdate':_0x20de13,'toDelete':_0x35dea4},'folders':{'toCreate':_0x20e6b2},'counts':{'segments':{'new':_0x59eb16[_0x17cd78(0x13b)],'changed':_0x431f26[_0x17cd78(0x13b)],'unchanged':_0x49bebd[_0x17cd78(0x13b)],'toDelete':_0x467f44[_0x17cd78(0x13b)]},'journeys':{'new':_0x1e0196[_0x17cd78(0x13b)],'changed':_0x2773cf[_0x17cd78(0x13b)],'unchanged':_0x21dd63[_0x17cd78(0x13b)],'toDelete':_0x1d3064[_0x17cd78(0x13b)]},'activations':{'create':_0x2a7d21[_0x17cd78(0x13b)],'update':_0x20de13['length'],'delete':_0x35dea4['length']},'folders':_0x20e6b2[_0x17cd78(0x13b)]},'hasChanges':_0x2cfa40||_0x1e8575||_0x547df0||_0x7a52fc};}export async function buildPushExecutionContext(_0x45ceb6,_0x144865,_0x251d31,_0x5b6d47,_0x11c47f,_0x181ae3){const _0x4cf1cd=a140_0x2324c6,_0x223030=extractRootFolderId(_0x251d31),{pathToId:_0x5c2240,idToPath:_0x50c4c8}=buildFolderMaps(_0x11c47f),_0x32ad25=buildSegmentNameToIdMap(_0x5b6d47),_0xc44534=new Map(),{batchAsync:_0x183800}=await import('../../utils/async.js'),[_0x101438,_0x174073]=await Promise[_0x4cf1cd(0x1e4)]([_0x45ceb6[_0x4cf1cd(0x1d1)][_0x4cf1cd(0x169)](),_0x45ceb6['connection'][_0x4cf1cd(0x187)](),((async()=>{const _0x3738f8=_0x4cf1cd;!_0x181ae3&&_0x5b6d47[_0x3738f8(0x13b)]>0x0&&await _0x183800(_0x5b6d47,async _0x7fc6ad=>{const _0x369607=_0x3738f8,_0x2652e4=await _0x45ceb6[_0x369607(0x176)][_0x369607(0x1f5)](_0x144865,_0x7fc6ad['id']);_0xc44534['set'](_0x7fc6ad['id'],_0x2652e4);});})())]),{emailToId:_0x38cb01,idToEmail:_0x30dff5}=_0x101438,_0x3bd0ca=buildConnectionMaps(_0x174073);return{'rootFolderId':_0x223030,'folderPathToId':_0x5c2240,'folderIdToPath':_0x50c4c8,'segmentNameToId':_0x32ad25,'activationsBySegmentId':_0xc44534,'emailToIdMap':_0x38cb01,'idToEmailMap':_0x30dff5,'connectionNameToIdMap':_0x3bd0ca[_0x4cf1cd(0x147)],'connectionIdToNameMap':_0x3bd0ca[_0x4cf1cd(0x150)],'connectionNameToTypeMap':_0x3bd0ca[_0x4cf1cd(0x123)]};}export function createPushYamlContextForBundle(_0x242811,_0xbc999c,_0xbf6d1b,_0x1f382e,_0x5642f6,_0x421576,_0x36b1f3,_0x3927a0){const {existingLocalSegmentNames:_0x4ea7be,localExpandedRuleToNames:_0x4027e8}=_0x1f382e,_0x3e3c96=new Set(),_0x50ef55=new Map(),_0x9532e7=new Map(),_0x502599=new Map(),_0x5dffa1=createJumpTargetCache(),_0x1f30c4=new Map(),_0x13a531=new Map(),_0x2e0ff5=new Set();let _0x71570a;const _0xa28d04=_0x5982c3=>{const _0x5e6abd={'resolveSegment':async _0x3df37b=>{const _0x4ce463=a140_0x2c4f,_0x540518=_0x502599[_0x4ce463(0x115)](_0x3df37b);if(_0x540518!==undefined)return{'name':_0x540518,'isJourneyLocal':!![]};try{const _0x582ffc=await fetchSegment(_0x242811,_0xbc999c,_0x3df37b,_0xbf6d1b);if(!_0x582ffc)throw new Error('Segment\x20not\x20found');const _0x5b53e2=generateJourneyLocalName(_0x582ffc[_0x4ce463(0x1b4)]),_0x2ec4b6=_0x582ffc[_0x4ce463(0x120)]===SEGMENT_KIND_JOURNEY&&_0x5b53e2!==undefined;let _0x370c89=_0x582ffc['name'],_0x3bff8f;if(_0x2ec4b6&&_0x582ffc[_0x4ce463(0x154)]){const _0x7ade08=apiRuleToYaml(_0x582ffc[_0x4ce463(0x154)]);_0x13a531['set'](_0x3df37b,_0x7ade08);const _0x1cf1b6=async _0xe288f3=>{const _0x362323=_0x4ce463,_0x1ac4c5=collectSegmentRefsFromRule(_0xe288f3);for(const _0x138e6a of _0x1ac4c5){if(!_0x13a531['has'](_0x138e6a))try{const _0x3c2c98=await fetchSegment(_0x242811,_0xbc999c,_0x138e6a,_0xbf6d1b);if(_0x3c2c98?.[_0x362323(0x154)]){const _0x346dad=apiRuleToYaml(_0x3c2c98[_0x362323(0x154)]);_0x13a531[_0x362323(0x12c)](_0x138e6a,_0x346dad),await _0x1cf1b6(_0x346dad);}}catch(_0x5cbbd2){logger[_0x362323(0x14a)](_0x362323(0x1b5)+_0x138e6a+':\x20'+_0x5cbbd2);}}};await _0x1cf1b6(_0x7ade08);const _0x1863a8=serializeExpandedRule(_0x7ade08,_0x13a531),_0x240bcc=_0x4027e8[_0x4ce463(0x115)](_0x1863a8);if(_0x240bcc&&_0x240bcc['length']>0x0){const _0x422cd8=_0x50ef55['get'](_0x1863a8)||0x0,_0x48a233=_0x240bcc[_0x422cd8]||_0x240bcc[_0x240bcc[_0x4ce463(0x13b)]-0x1];_0x50ef55[_0x4ce463(0x12c)](_0x1863a8,_0x422cd8+0x1),_0x370c89=_0x48a233,_0x3e3c96[_0x4ce463(0x1f4)](_0x370c89),_0x502599[_0x4ce463(0x12c)](_0x3df37b,_0x370c89);const _0x2b6e7f=await resolveRuleSegmentRefs(_0x7ade08,async _0x2b00d3=>{const _0x382f1c=_0x4ce463,_0x32b428=_0x502599[_0x382f1c(0x115)](_0x2b00d3);if(_0x32b428)return _0x32b428;const _0x22d18e=await _0x71570a['resolveSegment'](_0x2b00d3);return _0x22d18e[_0x382f1c(0x1b4)];});_0x3bff8f={'description':_0x582ffc[_0x4ce463(0x198)],'rule':_0x2b6e7f};}else{const _0x1b4fb1=_0x1f30c4[_0x4ce463(0x115)](_0x1863a8);if(_0x1b4fb1)_0x370c89=_0x1b4fb1,_0x502599[_0x4ce463(0x12c)](_0x3df37b,_0x370c89);else{if(_0x5b53e2){let _0x26f780=_0x5b53e2,_0x16dcd3=0x2;while(_0x3e3c96[_0x4ce463(0x18f)](_0x26f780)||_0x4ea7be[_0x4ce463(0x18f)](_0x26f780)){_0x26f780=_0x5b53e2+'_'+_0x16dcd3,_0x16dcd3++;}_0x3e3c96[_0x4ce463(0x1f4)](_0x26f780),_0x370c89=_0x26f780;}_0x502599['set'](_0x3df37b,_0x370c89),_0x1f30c4[_0x4ce463(0x12c)](_0x1863a8,_0x370c89);const _0x43b54b=await resolveRuleSegmentRefs(_0x7ade08,async _0x1fa9b3=>{const _0x59bab8=_0x4ce463,_0x45232d=_0x502599['get'](_0x1fa9b3);if(_0x45232d)return _0x45232d;const _0x1c62db=await _0x71570a[_0x59bab8(0x197)](_0x1fa9b3);return _0x1c62db['name'];});_0x3bff8f={'description':_0x582ffc[_0x4ce463(0x198)],'rule':_0x43b54b};}}}return{'name':_0x370c89,'isJourneyLocal':_0x2ec4b6,'definition':_0x3bff8f};}catch(_0x4ee4f8){return logger[_0x4ce463(0x14a)](_0x4ce463(0x17a)+_0x3df37b+':\x20'+_0x4ee4f8),{'name':_0x3df37b,'isJourneyLocal':![]};}},'resolveActivation':async _0xdf9724=>{const _0xe8851=a140_0x2c4f,_0x211ff0=_0x9532e7['get'](_0xdf9724);if(_0x211ff0!==undefined)return{'name':_0x211ff0,'isJourneyLocal':!![]};try{let _0xd99d3d=_0x36b1f3?.['get'](_0xdf9724);!_0xd99d3d&&(_0xd99d3d=await _0x242811[_0xe8851(0x1ab)]['getActivation'](_0x5982c3,_0xdf9724));const _0x1fab01=_0xd99d3d[_0xe8851(0x178)][_0xe8851(0x110)][_0xe8851(0x1b4)]||_0xdf9724,_0x248de6=sanitizeYamlKey(_0x1fab01)||_0xe8851(0x16f)+_0xdf9724,_0x59451e=_0x248de6;_0x9532e7[_0xe8851(0x12c)](_0xdf9724,_0x59451e);const _0x101182=journeyActivationStepToYaml(_0xd99d3d,_0x5642f6,_0x421576);return{'name':_0x59451e,'isJourneyLocal':!![],'definition':_0x101182};}catch(_0x40eae8){return logger[_0xe8851(0x14a)](_0xe8851(0x16a)+_0xdf9724+':\x20'+_0x40eae8),{'name':_0xdf9724,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x287c34,_0x43db3a)=>resolveJumpTarget(_0x287c34,_0x43db3a,_0x5dffa1,async _0x1d6e2f=>{const _0x1e88dc=a140_0x2c4f,_0x1ad0c6=_0x3927a0?.[_0x1e88dc(0x115)](_0x1d6e2f);if(_0x1ad0c6)return _0x1ad0c6;return _0x242811['journey'][_0x1e88dc(0x18b)](_0x1d6e2f);})};return _0x71570a=_0x5e6abd,_0x5e6abd;},_0x467334=async _0x236a30=>{const _0x58472c=a140_0x2c4f,{collectSegmentIdsFromJourneyApi:_0x31595b}=await import(_0x58472c(0x17f)),{batchAsync:_0x28c545}=await import('../../utils/async.js'),_0x5e21f9=new Set();for(const _0x2cf9e2 of _0x236a30){let _0x4ba875=_0x3927a0?.[_0x58472c(0x115)](_0x2cf9e2);!_0x4ba875&&(_0x4ba875=await _0x242811[_0x58472c(0x1ab)][_0x58472c(0x18b)](_0x2cf9e2));const _0x3cf8d4=_0x31595b(_0x4ba875);for(const _0x4b3404 of _0x3cf8d4){_0x5e21f9['add'](_0x4b3404);}}let _0x51c1f3=Array[_0x58472c(0x180)](_0x5e21f9);while(_0x51c1f3[_0x58472c(0x13b)]>0x0){const _0x4edff4=_0x51c1f3[_0x58472c(0x108)](_0xec6d07=>!_0x2e0ff5[_0x58472c(0x18f)](_0xec6d07));if(_0x4edff4[_0x58472c(0x13b)]===0x0)break;const _0x64e6e9=await _0x28c545(_0x4edff4,async _0x48ca6c=>{const _0x5cd8e6=_0x58472c;_0x2e0ff5[_0x5cd8e6(0x1f4)](_0x48ca6c);const _0x4ebbd9=await fetchSegment(_0x242811,_0xbc999c,_0x48ca6c,_0xbf6d1b);if(!_0x4ebbd9)return null;return{'segmentId':_0x48ca6c,'segment':_0x4ebbd9};},0xa),_0x48b46f=new Set();for(const _0x3a5b64 of _0x64e6e9){if(!_0x3a5b64?.[_0x58472c(0x176)]?.[_0x58472c(0x154)])continue;const _0x8b72cd=apiRuleToYaml(_0x3a5b64[_0x58472c(0x176)]['rule']);_0x13a531[_0x58472c(0x12c)](_0x3a5b64[_0x58472c(0x1e5)],_0x8b72cd);const _0x1b6a1e=collectSegmentRefsFromRule(_0x8b72cd);for(const _0x1247b6 of _0x1b6a1e){!_0x2e0ff5[_0x58472c(0x18f)](_0x1247b6)&&_0x48b46f['add'](_0x1247b6);}}_0x51c1f3=Array[_0x58472c(0x180)](_0x48b46f);}};return{'createYamlContext':_0xa28d04,'prefetchJourneySegments':_0x467334};}export async function executePushSegments(_0x5f45c1,_0x4a5b3f,_0x17bf6f,_0x2678e6,_0x564490){const _0x1d4858=a140_0x2324c6,{segmentDefToCreateRequest:_0x28d6c7,segmentDefToUpdateRequest:_0x460d7a}=await import(_0x1d4858(0x16d)),_0x24a23f=_0x17bf6f[_0x1d4858(0x1b6)],_0x34462b=0x5,_0x367203=async _0x3b9723=>{const _0x574f30=_0x1d4858,_0x4ce35f=_0x3b9723['folderPath']?_0x24a23f[_0x574f30(0x115)](_0x3b9723['folderPath']):undefined;let _0x46810e;const _0x45ae5d={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x3658cd=_0x3b9723[_0x574f30(0x189)];if(_0x3b9723[_0x574f30(0x189)]['rule']){const _0x585796=createSegmentIdResolver(_0x17bf6f[_0x574f30(0xfe)],_0x3b9723['yamlConfig'][_0x574f30(0x1b4)]),_0x15adc1=await resolveRuleSegmentIds(_0x3b9723[_0x574f30(0x189)][_0x574f30(0x154)],_0x585796);_0x3658cd={..._0x3b9723[_0x574f30(0x189)],'rule':_0x15adc1};}try{if(_0x3b9723[_0x574f30(0x13a)]){_0x564490[_0x574f30(0x16e)]?.({'type':_0x574f30(0x1c3),'name':_0x3b9723[_0x574f30(0x189)][_0x574f30(0x1b4)]});const _0xe1e3de=_0x28d6c7(_0x3658cd,_0x4ce35f),_0x16be78=await _0x564490['withProgress']('Creating\x20segment\x20\x27'+_0x3b9723[_0x574f30(0x189)][_0x574f30(0x1b4)]+_0x574f30(0x1c4),()=>_0x5f45c1['segment'][_0x574f30(0x1a2)](_0x2678e6['parentId'],_0xe1e3de));_0x46810e=_0x16be78[_0x574f30(0x16c)]['id'],_0x17bf6f[_0x574f30(0xfe)][_0x574f30(0x12c)](_0x3b9723[_0x574f30(0x189)]['name'],_0x46810e),_0x45ae5d[_0x574f30(0x200)]={'name':_0x3b9723['yamlConfig'][_0x574f30(0x1b4)],'id':_0x46810e},_0x564490['onProgress']?.({'type':_0x574f30(0x116),'name':_0x3b9723[_0x574f30(0x189)][_0x574f30(0x1b4)],'segmentId':_0x46810e}),_0x564490[_0x574f30(0x11b)]?.(_0x574f30(0x18d)+_0x3b9723[_0x574f30(0x189)][_0x574f30(0x1b4)]+'\x27'),_0x45ae5d[_0x574f30(0x183)]=0x1;}else{if(_0x3b9723[_0x574f30(0x196)]){_0x564490[_0x574f30(0x16e)]?.({'type':_0x574f30(0x103),'name':_0x3b9723[_0x574f30(0x189)][_0x574f30(0x1b4)]});const _0xf2da2b=_0x460d7a(_0x3658cd);_0x4ce35f!==_0x3b9723[_0x574f30(0x162)]?.[_0x574f30(0x11a)]&&(_0xf2da2b[_0x574f30(0x11a)]=_0x4ce35f?parseInt(_0x4ce35f,0xa):undefined),await _0x564490[_0x574f30(0x160)]('Updating\x20segment\x20\x27'+_0x3b9723['yamlConfig']['name']+_0x574f30(0x1c4),()=>_0x5f45c1[_0x574f30(0x176)][_0x574f30(0x1ea)](_0x2678e6['parentId'],_0x3b9723['existingSegment']['id'],_0xf2da2b)),_0x46810e=_0x3b9723[_0x574f30(0x162)]['id'],_0x564490[_0x574f30(0x16e)]?.({'type':_0x574f30(0x184),'name':_0x3b9723[_0x574f30(0x189)]['name']}),_0x564490[_0x574f30(0x11b)]?.(_0x574f30(0x1db)+_0x3b9723[_0x574f30(0x189)][_0x574f30(0x1b4)]+'\x27'),_0x45ae5d[_0x574f30(0x10c)]=0x1;}else _0x46810e=_0x3b9723['existingSegment']['id'];}}catch(_0x1d2164){const _0x2b9dd5=isHttp400Error(_0x1d2164),_0x4b0802=_0x2b9dd5?ErrorCode[_0x574f30(0x1e2)]:ErrorCode[_0x574f30(0x195)],_0xda2818=getErrorMessage(_0x1d2164);throw new SDKError(_0x4b0802,_0x574f30(0x146)+(_0x3b9723[_0x574f30(0x13a)]?_0x574f30(0x1f1):_0x574f30(0x10b))+_0x574f30(0x124)+_0x3b9723['absolutePath']+_0x574f30(0xff)+_0xda2818,_0x1d2164);}try{const _0x5853b1=await syncActivationsForSegment(_0x5f45c1,_0x2678e6[_0x574f30(0x194)],_0x46810e,_0x3b9723['yamlConfig']['name'],_0x3b9723[_0x574f30(0x101)],_0x564490,_0x3b9723[_0x574f30(0x164)]);_0x45ae5d['activations']=_0x5853b1;}catch(_0x31af4c){if(_0x31af4c instanceof SDKError)throw _0x31af4c;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0x3b9723[_0x574f30(0x189)][_0x574f30(0x1b4)]+_0x574f30(0x1bd)+_0x3b9723[_0x574f30(0x164)]+_0x574f30(0xff)+getErrorMessage(_0x31af4c),_0x31af4c);}return _0x45ae5d;},_0x10c3f5=await batchAsync(_0x4a5b3f,_0x367203,_0x34462b),_0xeb5430={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0xb04371 of _0x10c3f5){_0xeb5430[_0x1d4858(0x183)]+=_0xb04371['created'],_0xeb5430[_0x1d4858(0x10c)]+=_0xb04371['updated'],_0xb04371[_0x1d4858(0x200)]&&_0xeb5430[_0x1d4858(0x134)]['set'](_0xb04371[_0x1d4858(0x200)][_0x1d4858(0x1b4)],_0xb04371[_0x1d4858(0x200)]['id']),_0xeb5430[_0x1d4858(0x158)][_0x1d4858(0x183)]+=_0xb04371[_0x1d4858(0x158)][_0x1d4858(0x183)],_0xeb5430[_0x1d4858(0x158)][_0x1d4858(0x10c)]+=_0xb04371['activations']['updated'],_0xeb5430['activations'][_0x1d4858(0x179)]+=_0xb04371[_0x1d4858(0x158)][_0x1d4858(0x179)];}return _0xeb5430;}async function syncActivationsForSegment(_0x2cd7e9,_0x3be50e,_0x250f81,_0x1619f1,_0x44a2bc,_0x313e62,_0x32eca4){const _0x52f535=a140_0x2324c6,_0x43dced={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x4ec567 of _0x44a2bc){try{if(_0x4ec567[_0x52f535(0x13e)]==='create'&&_0x4ec567[_0x52f535(0x1ec)])_0x313e62['onProgress']?.({'type':'activation_creating','segmentName':_0x1619f1,'activationName':_0x4ec567[_0x52f535(0x1b4)]}),await _0x313e62[_0x52f535(0x160)](_0x52f535(0x18e)+_0x4ec567[_0x52f535(0x1b4)]+'\x27...',()=>_0x2cd7e9['segment']['createActivation'](_0x3be50e,_0x250f81,_0x4ec567[_0x52f535(0x1ec)])),_0x313e62[_0x52f535(0x16e)]?.({'type':_0x52f535(0x186),'segmentName':_0x1619f1,'activationName':_0x4ec567[_0x52f535(0x1b4)]}),_0x313e62[_0x52f535(0x11b)]?.(_0x52f535(0x102)+_0x4ec567[_0x52f535(0x1b4)]+'\x27'),_0x43dced[_0x52f535(0x183)]++;else{if(_0x4ec567[_0x52f535(0x13e)]===_0x52f535(0x10b)&&_0x4ec567['validatedRequest']&&_0x4ec567['existingActivation'])_0x313e62['onProgress']?.({'type':_0x52f535(0x157),'segmentName':_0x1619f1,'activationName':_0x4ec567[_0x52f535(0x1b4)]}),await _0x313e62['withProgress']('Updating\x20activation\x20\x27'+_0x4ec567[_0x52f535(0x1b4)]+_0x52f535(0x1c4),()=>_0x2cd7e9['segment'][_0x52f535(0x15a)](_0x3be50e,_0x250f81,_0x4ec567[_0x52f535(0x1eb)]['id'],_0x4ec567[_0x52f535(0x1ec)])),_0x313e62[_0x52f535(0x16e)]?.({'type':_0x52f535(0x1e1),'segmentName':_0x1619f1,'activationName':_0x4ec567[_0x52f535(0x1b4)]}),_0x313e62[_0x52f535(0x11b)]?.('Updated\x20activation\x20\x27'+_0x4ec567['name']+'\x27'),_0x43dced['updated']++;else _0x4ec567[_0x52f535(0x13e)]==='delete'&&_0x4ec567[_0x52f535(0x1eb)]&&(_0x313e62[_0x52f535(0x16e)]?.({'type':_0x52f535(0x15d),'segmentName':_0x1619f1,'activationName':_0x4ec567[_0x52f535(0x1b4)]}),await _0x313e62['withProgress'](_0x52f535(0x1f6)+_0x4ec567[_0x52f535(0x1b4)]+_0x52f535(0x1c4),()=>_0x2cd7e9[_0x52f535(0x176)][_0x52f535(0x1ca)](_0x3be50e,_0x250f81,_0x4ec567['existingActivation']['id'])),_0x313e62[_0x52f535(0x16e)]?.({'type':'activation_deleted','segmentName':_0x1619f1,'activationName':_0x4ec567[_0x52f535(0x1b4)]}),_0x313e62[_0x52f535(0x1e0)]?.(_0x52f535(0x1ef)+_0x4ec567[_0x52f535(0x1b4)]+'\x27'),_0x43dced['deleted']++);}}catch(_0x202213){const _0x3b24ad=isHttp400Error(_0x202213),_0x34a609=_0x3b24ad?ErrorCode[_0x52f535(0x1d0)]:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x33ee84=getErrorMessage(_0x202213);throw new SDKError(_0x34a609,_0x52f535(0x146)+_0x4ec567[_0x52f535(0x13e)]+_0x52f535(0x1bb)+_0x4ec567['name']+_0x52f535(0x1bd)+_0x32eca4+_0x52f535(0xff)+_0x33ee84,_0x202213);}}return _0x43dced;}export async function executePushFolders(_0xb4d89b,_0x3512ff,_0xb28aba,_0xb44970,_0x1a9566){const _0x1b6c63=a140_0x2324c6,_0x10bcbc=new Map(_0xb28aba),_0x5273e3=sortFoldersByDepth(_0x3512ff);for(const _0x1a57d7 of _0x5273e3){const _0x51fe12=_0x1a57d7[_0x1b6c63(0x1d4)]('/'),_0x38a4e2=_0x51fe12[_0x51fe12[_0x1b6c63(0x13b)]-0x1],_0x34d858=_0x51fe12[_0x1b6c63(0x1fa)](0x0,-0x1)[_0x1b6c63(0x1af)]('/'),_0x1e841c=_0x10bcbc['get'](_0x34d858);_0x1a9566['onProgress']?.({'type':_0x1b6c63(0x13d),'folder':_0x1a57d7});const _0x1e254e={'name':_0x38a4e2,'parentFolderId':_0x1e841c},_0x4f7c55=await _0x1a9566['withProgress'](_0x1b6c63(0x166)+_0x1a57d7+_0x1b6c63(0x1c4),()=>_0xb4d89b['segment'][_0x1b6c63(0x131)](_0xb44970[_0x1b6c63(0x194)],_0x1e254e));_0x10bcbc['set'](_0x1a57d7,_0x4f7c55[_0x1b6c63(0x16c)]['id']),_0x1a9566[_0x1b6c63(0x16e)]?.({'type':'folder_created','folder':_0x1a57d7,'folderId':_0x4f7c55['data']['id']}),_0x1a9566['logInfo']?.(_0x1b6c63(0x161)+_0x1a57d7+'\x27');}return _0x10bcbc;}export async function executePushSegmentDeletions(_0x290122,_0x580f1b,_0x219d07){const _0x4723ba=a140_0x2324c6;if(_0x580f1b[_0x4723ba(0x13b)]===0x0)return 0x0;const {batchAsync:_0x273425}=await import('../../utils/async.js'),_0xf7e473=0x5,_0x21b0ce=await _0x273425(_0x580f1b,async _0x3f54ec=>{const _0x3b7dca=_0x4723ba;return _0x219d07[_0x3b7dca(0x16e)]?.({'type':_0x3b7dca(0x1d3),'name':_0x3f54ec['name']}),await _0x290122[_0x3b7dca(0x176)][_0x3b7dca(0x14f)](_0x3f54ec['id']),_0x219d07[_0x3b7dca(0x16e)]?.({'type':_0x3b7dca(0x1b2),'name':_0x3f54ec[_0x3b7dca(0x1b4)]}),_0x219d07[_0x3b7dca(0x1e0)]?.(_0x3b7dca(0x121)+_0x3f54ec[_0x3b7dca(0x1b4)]+'\x27'),0x1;},_0xf7e473);return _0x21b0ce[_0x4723ba(0x145)]((_0x386df5,_0x5aaeb6)=>_0x386df5+_0x5aaeb6,0x0);}export async function executePushJourneys(_0x5eef7d,_0x31d82e,_0x1d3f8d,_0x35a816,_0x37c887){const _0x3d3f6b=a140_0x2324c6,{journeyDefToRequest:_0x566ce8}=await import(_0x3d3f6b(0x17f)),{activationDefToCreateRequest:_0x5a2dcd,yamlRuleToApi:_0x4cf3ad,validateSegmentRule:_0x5d8613}=await import(_0x3d3f6b(0x16d)),_0x48e0a8={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x255bc3=new Map(_0x1d3f8d[_0x3d3f6b(0xfe)]),_0x28e0a5=0x5;for(let _0xfdb7da=0x0;_0xfdb7da<_0x31d82e['length'];_0xfdb7da+=_0x28e0a5){const _0x58546a=_0x31d82e[_0x3d3f6b(0x1fa)](_0xfdb7da,_0xfdb7da+_0x28e0a5),_0x2535ca=await Promise['all'](_0x58546a[_0x3d3f6b(0x1ac)](async _0x2da033=>{const _0x269bbf=_0x3d3f6b;if(!_0x2da033[_0x269bbf(0x13a)]&&!_0x2da033['hasChanges'])return{'action':_0x269bbf(0x168),'name':_0x2da033['yamlConfig'][_0x269bbf(0x1b4)],'journeyId':_0x2da033[_0x269bbf(0x16b)]?.['id']};const _0x23661a=_0x2da033[_0x269bbf(0x193)]?_0x1d3f8d[_0x269bbf(0x1b6)][_0x269bbf(0x115)](_0x2da033[_0x269bbf(0x193)]):undefined;_0x37c887['onProgress']?.({'type':_0x2da033[_0x269bbf(0x13a)]?_0x269bbf(0x17c):'journey_updating','name':_0x2da033[_0x269bbf(0x189)]['name']});try{const _0x3f5679=await executeSingleJourneyPush(_0x5eef7d,_0x2da033,{..._0x1d3f8d,'segmentNameToId':_0x255bc3},{'parentId':_0x35a816[_0x269bbf(0x194)],'rootFolderId':_0x35a816[_0x269bbf(0x12d)],'folderId':_0x23661a,'verbose':_0x35a816['verbose']},_0x37c887,{'journeyDefToRequest':_0x566ce8,'activationDefToCreateRequest':_0x5a2dcd,'yamlRuleToApi':_0x4cf3ad,'validateSegmentRule':_0x5d8613});for(const [_0x30d19a,_0x19380c]of _0x3f5679[_0x269bbf(0x119)]){_0x255bc3[_0x269bbf(0x12c)](_0x30d19a,_0x19380c),_0x48e0a8['embeddedSegmentNameToId'][_0x269bbf(0x12c)](_0x30d19a,_0x19380c);}if(_0x3f5679[_0x269bbf(0x132)]==='created')_0x37c887['onProgress']?.({'type':_0x269bbf(0x130),'name':_0x2da033[_0x269bbf(0x189)]['name'],'journeyId':_0x3f5679[_0x269bbf(0x15b)]}),_0x37c887[_0x269bbf(0x11b)]?.(_0x269bbf(0x1ed)+_0x2da033[_0x269bbf(0x189)]['name']+'\x27'),_0x48e0a8[_0x269bbf(0x183)]++;else _0x3f5679[_0x269bbf(0x132)]==='updated'&&(_0x37c887[_0x269bbf(0x16e)]?.({'type':_0x269bbf(0x125),'name':_0x2da033['yamlConfig']['name']}),_0x37c887[_0x269bbf(0x11b)]?.(_0x269bbf(0x1fe)+_0x2da033[_0x269bbf(0x189)]['name']+'\x27'),_0x48e0a8[_0x269bbf(0x10c)]++);return{'action':_0x3f5679[_0x269bbf(0x132)],'name':_0x2da033[_0x269bbf(0x189)][_0x269bbf(0x1b4)],'journeyId':_0x3f5679[_0x269bbf(0x15b)]};}catch(_0x4f1bf5){const _0xb215bc=isHttp400Error(_0x4f1bf5),_0xcbd38a=_0xb215bc?ErrorCode[_0x269bbf(0x1a1)]:ErrorCode[_0x269bbf(0x1e7)],_0x1efad3=getErrorMessage(_0x4f1bf5);throw new SDKError(_0xcbd38a,'Failed\x20to\x20'+(_0x2da033[_0x269bbf(0x13a)]?_0x269bbf(0x1f1):'update')+'\x20journey\x20from\x20file:\x20'+_0x2da033[_0x269bbf(0x164)]+_0x269bbf(0xff)+_0x1efad3,_0x4f1bf5);}}));_0x48e0a8[_0x3d3f6b(0x144)][_0x3d3f6b(0x1fb)](..._0x2535ca);}return _0x48e0a8;}async function matchExistingJourneySegments(_0x4d98fa,_0x5a6d32,_0x9a7c38,_0x241998,_0x115941){const _0x3168c4=a140_0x2324c6;if(!_0x5a6d32['existingJourney']||!_0x5a6d32[_0x3168c4(0x189)][_0x3168c4(0x14c)])return;const _0x5af438=new Map(),_0x49fd59=new Set();for(const _0x1f3a5e of Object[_0x3168c4(0x1c9)](_0x5a6d32[_0x3168c4(0x189)]['segments'])){const _0x941cc=generateDeterministicJourneySegmentName(_0x5a6d32['yamlConfig'][_0x3168c4(0x1b4)],_0x1f3a5e);_0x5af438[_0x3168c4(0x12c)](_0x941cc,_0x1f3a5e),_0x49fd59[_0x3168c4(0x1f4)](_0x1f3a5e);}const _0x15c288=[],_0x2a399f=collectSegmentIdsFromJourneyApi(_0x5a6d32[_0x3168c4(0x16b)]);for(const _0x5bc370 of _0x2a399f){const _0xbf8900=await fetchSegment(_0x4d98fa,_0x9a7c38,_0x5bc370,_0x241998);if(!_0xbf8900?.['name'])continue;const _0x2255e1=_0x5af438[_0x3168c4(0x115)](_0xbf8900[_0x3168c4(0x1b4)]);_0x2255e1?(_0x115941['set'](_0x2255e1,_0x5bc370),_0x49fd59[_0x3168c4(0x107)](_0x2255e1)):_0x15c288[_0x3168c4(0x1fb)]({'id':_0x5bc370,'seg':_0xbf8900});}if(_0x49fd59['size']>0x0&&_0x15c288['length']>0x0){const {localExpandedRuleToNames:_0x5d09d1}=buildLocalExpandedRuleMappings(_0x5a6d32['yamlConfig']),_0x2aaaae=new Map();for(const {id:_0x5af1c5,seg:_0xee7f44}of _0x15c288){if(_0xee7f44[_0x3168c4(0x154)]){const _0x279476=apiRuleToYaml(_0xee7f44[_0x3168c4(0x154)]);_0x2aaaae[_0x3168c4(0x12c)](_0x5af1c5,_0x279476);}}for(const {id:_0x21688d,seg:_0x3bf0af}of _0x15c288){if(!_0x3bf0af[_0x3168c4(0x154)])continue;const _0x16e968=_0x2aaaae[_0x3168c4(0x115)](_0x21688d);if(!_0x16e968)continue;const _0x41e8e0=serializeExpandedRule(_0x16e968,_0x2aaaae),_0x143659=_0x5d09d1[_0x3168c4(0x115)](_0x41e8e0);if(_0x143659){const _0x2ec787=_0x143659[_0x3168c4(0x1dd)](_0x51f92a=>_0x49fd59[_0x3168c4(0x18f)](_0x51f92a));_0x2ec787&&(_0x115941[_0x3168c4(0x12c)](_0x2ec787,_0x21688d),_0x49fd59[_0x3168c4(0x107)](_0x2ec787),logger[_0x3168c4(0x14a)](_0x3168c4(0x105)+_0x3bf0af[_0x3168c4(0x1b4)]+_0x3168c4(0x15f)+_0x2ec787+_0x3168c4(0x128)));}}}}async function executeSingleJourneyPush(_0x12433c,_0x47da0a,_0x54bea1,_0x2fde0c,_0x4f15d1,_0x15d913){const _0x25d01f=a140_0x2324c6,{journeyDefToRequest:_0x5acf55,activationDefToCreateRequest:_0x4f92a1,yamlRuleToApi:_0x412de7,validateSegmentRule:_0x4dada9}=_0x15d913,_0x35c92e=new Map(),_0x48eff1=new Map();recoverSegmentIdsFromPushRecovery(_0x47da0a,_0x35c92e,_0x54bea1['segmentNameToId']);const _0x55b6bf=new Map(),_0x130341=new Map(),_0x15c0e5=new Map();let _0x11eacd;const _0x502a6f=async()=>{const _0x16bb27=a140_0x2c4f;if(_0x11eacd)return;_0x11eacd=new Map();if(!_0x47da0a[_0x16bb27(0x16b)])return;const _0x504eef=await _0x12433c[_0x16bb27(0x1ab)][_0x16bb27(0x1f5)](_0x47da0a[_0x16bb27(0x16b)]['id']);for(const _0x40eac9 of _0x504eef){const _0x1e059c=journeyActivationStepToYaml(_0x40eac9,_0x54bea1['idToEmailMap'],_0x54bea1['connectionIdToNameMap']),_0x203d92=activationSignature(_0x1e059c);!_0x11eacd[_0x16bb27(0x18f)](_0x203d92)&&_0x11eacd[_0x16bb27(0x12c)](_0x203d92,_0x40eac9['id']),_0x1e059c['name']&&_0x48eff1[_0x16bb27(0x12c)](_0x1e059c[_0x16bb27(0x1b4)],_0x40eac9['id']);}};await matchExistingJourneySegments(_0x12433c,_0x47da0a,_0x2fde0c[_0x25d01f(0x194)],_0x54bea1[_0x25d01f(0x1fd)],_0x54bea1[_0x25d01f(0xfe)]);const _0x1ff2d2={'resolveSegmentId':async _0x5a0d33=>{const _0x555dce=_0x25d01f,_0x9125bf=_0x54bea1[_0x555dce(0xfe)][_0x555dce(0x115)](_0x5a0d33);if(!_0x9125bf)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20not\x20found:\x20'+_0x5a0d33+_0x555dce(0x1a4)+_0x47da0a['yamlConfig'][_0x555dce(0x1b4)]+')');return _0x9125bf;},'resolveEmbeddedSegmentId':async(_0x29d1b1,_0xe41857)=>{const _0x48bb5b=_0x25d01f,_0x22a1a7=_0x54bea1['segmentNameToId'][_0x48bb5b(0x115)](_0x29d1b1);if(_0x22a1a7)return _0x22a1a7;const _0x23e3a5=_0x54bea1[_0x48bb5b(0x1fd)][_0x48bb5b(0x1dd)](_0x1e9814=>_0x1e9814['name']===_0x29d1b1);if(_0x23e3a5)return _0x54bea1[_0x48bb5b(0xfe)]['set'](_0x29d1b1,_0x23e3a5['id']),_0x23e3a5['id'];if(_0x47da0a[_0x48bb5b(0x13a)]){const {stageName:_0x868245,criteriaName:_0x331096}=findSegmentCriteriaLocation(_0x47da0a['yamlConfig'],_0x29d1b1);return _0x4dada9(_0x29d1b1,_0xe41857['rule']),_0x130341['set'](_0x29d1b1,{'definition':_0xe41857,'stageName':_0x868245,'criteriaName':_0x331096}),createPendingSegmentId(_0x29d1b1);}const _0x1e740a=_0x47da0a['existingJourney']?.['id'];if(!_0x1e740a)throw new SDKError(ErrorCode[_0x48bb5b(0x112)],_0x48bb5b(0x152));const _0x1259fb=_0x55b6bf[_0x48bb5b(0x115)](_0x29d1b1);if(_0x1259fb)return _0x1259fb;const _0xd410c9=((async()=>{const _0x420636=_0x48bb5b;_0x4dada9(_0x29d1b1,_0xe41857['rule']);const _0x14513d=generateDeterministicJourneySegmentName(_0x47da0a[_0x420636(0x189)][_0x420636(0x1b4)],_0x29d1b1),_0x12e805=_0x54bea1[_0x420636(0x1fd)][_0x420636(0x1dd)](_0x20c4c9=>_0x20c4c9[_0x420636(0x1b4)]===_0x14513d),_0x134acd=createSegmentIdResolver(_0x54bea1[_0x420636(0xfe)],_0x29d1b1),_0x1eef6c=await resolveRuleSegmentIds(_0xe41857[_0x420636(0x154)],_0x134acd);let _0x3fa82c;return _0x12e805?(await _0x12433c[_0x420636(0x176)]['updateSegmentById'](_0x2fde0c[_0x420636(0x194)],_0x12e805['id'],{'description':_0xe41857['description']||_0x420636(0x171)+_0x29d1b1,'rule':_0x412de7(_0x1eef6c,!![]),'countPopulation':!![]}),_0x3fa82c=_0x12e805['id'],saveSegmentToPushRecovery(_0x47da0a[_0x420636(0x164)],_0x47da0a[_0x420636(0x189)][_0x420636(0x1b4)],_0x29d1b1,{'segmentId':_0x3fa82c,'uniqueServerName':_0x14513d,'createdAt':new Date()[_0x420636(0x19e)]()})):_0x3fa82c=await createOrRecoverEmbeddedSegment(_0x12433c,_0x47da0a,{'localName':_0x29d1b1,'uniqueSegmentName':_0x14513d,'description':_0xe41857[_0x420636(0x198)]||_0x420636(0x171)+_0x29d1b1,'journeyId':_0x1e740a,'resolvedRule':_0x1eef6c,'parentId':_0x2fde0c[_0x420636(0x194)],'folderId':_0x2fde0c[_0x420636(0x12d)]||''},_0x412de7),_0x54bea1[_0x420636(0xfe)][_0x420636(0x12c)](_0x29d1b1,_0x3fa82c),_0x35c92e['set'](_0x29d1b1,_0x3fa82c),_0x3fa82c;})());_0x55b6bf['set'](_0x29d1b1,_0xd410c9);try{return await _0xd410c9;}finally{_0x55b6bf['delete'](_0x29d1b1);}},'resolveActivationId':async _0x19468b=>{const _0x2ebb29=_0x25d01f,_0x5e69e3=_0x48eff1[_0x2ebb29(0x115)](_0x19468b);if(_0x5e69e3)return _0x5e69e3;if(_0x47da0a[_0x2ebb29(0x16b)]){await _0x502a6f();const _0x232240=_0x48eff1[_0x2ebb29(0x115)](_0x19468b);if(_0x232240)return _0x232240;}throw new SDKError(ErrorCode[_0x2ebb29(0x167)],_0x2ebb29(0x1de)+_0x19468b+_0x2ebb29(0x1a4)+_0x47da0a[_0x2ebb29(0x189)][_0x2ebb29(0x1b4)]+_0x2ebb29(0x1ba)+_0x2ebb29(0x1dc));},'resolveEmbeddedActivationId':async(_0x2775a7,_0x16a3fb)=>{const _0x24b796=_0x25d01f,_0x4197b1=_0x48eff1[_0x24b796(0x115)](_0x2775a7);if(_0x4197b1)return _0x4197b1;if(_0x47da0a[_0x24b796(0x13a)])return _0x15c0e5['set'](_0x2775a7,_0x16a3fb),createPendingActivationId(_0x2775a7);if(_0x47da0a[_0x24b796(0x16b)]){await _0x502a6f();const _0x1666ae=_0x48eff1[_0x24b796(0x115)](_0x16a3fb[_0x24b796(0x1b4)]);if(_0x1666ae)return _0x48eff1[_0x24b796(0x12c)](_0x2775a7,_0x1666ae),_0x1666ae;const _0x4783de=activationSignature(_0x16a3fb),_0x32e7fc=_0x11eacd?.[_0x24b796(0x115)](_0x4783de);if(_0x32e7fc)return _0x48eff1[_0x24b796(0x12c)](_0x2775a7,_0x32e7fc),_0x32e7fc;const _0x24cb34=await _0x4f92a1(_0x16a3fb,_0x54bea1['activationContext']),_0x59abc4={..._0x24cb34,..._0x16a3fb[_0x24b796(0x1a0)]!==undefined&&{'runAfterJourneyRefresh':_0x16a3fb[_0x24b796(0x1a0)]}},_0x28918d=await _0x12433c['journey'][_0x24b796(0x14b)](_0x47da0a[_0x24b796(0x16b)]['id'],_0x59abc4);return _0x48eff1[_0x24b796(0x12c)](_0x2775a7,_0x28918d['id']),_0x28918d['id'];}throw new SDKError(ErrorCode['INTERNAL'],_0x24b796(0x11d));},'resolveJourneyId':async _0x24206c=>{const _0x2cca68=_0x25d01f;try{return await _0x12433c[_0x2cca68(0x1ab)]['resolveJourneyId'](_0x2fde0c[_0x2cca68(0x194)],_0x24206c);}catch(_0x3d3673){throw new SDKError(ErrorCode[_0x2cca68(0x167)],_0x2cca68(0x188)+_0x24206c+_0x2cca68(0x17e)+_0x47da0a['yamlConfig'][_0x2cca68(0x1b4)]+'\x27)',_0x3d3673);}},'resolveStageId':async(_0x5bdc6d,_0xe4052d)=>{const _0x53adf9=_0x25d01f,_0x3368fe=await _0x12433c[_0x53adf9(0x1ab)][_0x53adf9(0x18b)](_0x5bdc6d),_0x47369e=_0x3368fe[_0x53adf9(0x178)][_0x53adf9(0x1e9)][_0x53adf9(0x1dd)](_0x177458=>_0x177458[_0x53adf9(0x1b4)]['toLowerCase']()===_0xe4052d[_0x53adf9(0x15e)]());if(!_0x47369e?.['id'])throw new SDKError(ErrorCode[_0x53adf9(0x167)],'Stage\x20\x27'+_0xe4052d+_0x53adf9(0x137)+(_0x3368fe[_0x53adf9(0x178)]['journeyBundleName']||_0x3368fe['attributes']['name'])+'\x27');return _0x47369e['id'];}},_0x2a7104=await _0x5acf55(_0x47da0a[_0x25d01f(0x189)],_0x2fde0c[_0x25d01f(0x194)],_0x1ff2d2),_0x34df41=_0x2fde0c['folderId']||_0x2fde0c[_0x25d01f(0x12d)];_0x34df41&&(_0x2a7104[_0x25d01f(0x1b3)]={'parentFolder':{'data':{'id':_0x34df41,'type':_0x25d01f(0x192)}}});if(_0x47da0a[_0x25d01f(0x13a)]){if(_0x130341[_0x25d01f(0x185)]>0x0||_0x15c0e5['size']>0x0)return await executeThreeStepJourneyCreate(_0x12433c,_0x47da0a,_0x2a7104,{'pendingEmbeddedSegments':_0x130341,'pendingEmbeddedActivations':_0x15c0e5,'embeddedSegmentNameToId':_0x35c92e,'journeyActivationNameToId':_0x48eff1},{..._0x2fde0c,'effectiveFolderId':_0x34df41},_0x54bea1,_0x4f15d1,_0x15d913);else{ensureJourneyDefaults(_0x2a7104[_0x25d01f(0x178)]);const _0x4d540c=await _0x12433c[_0x25d01f(0x1ab)][_0x25d01f(0x1f1)](_0x2a7104);return deletePushRecovery(_0x47da0a[_0x25d01f(0x164)]),{'action':_0x25d01f(0x183),'journeyId':_0x4d540c['id'],'embeddedSegmentNameToId':_0x35c92e};}}else{if(_0x47da0a['hasChanges']&&_0x47da0a['existingJourney']){_0x2a7104['id']=_0x47da0a['existingJourney']['id'];const _0x2f905f=_0x2a7104['attributes'];_0x47da0a[_0x25d01f(0x16b)][_0x25d01f(0x178)]?.['journeyBundleName']&&(_0x2f905f[_0x25d01f(0x143)]=_0x47da0a[_0x25d01f(0x16b)][_0x25d01f(0x178)]['journeyBundleName']);const _0x215139=_0x47da0a[_0x25d01f(0x16b)][_0x25d01f(0x178)]?.[_0x25d01f(0x1e9)];return _0x215139&&_0x2a7104['attributes']['journeyStages']&&injectExistingStageIds(_0x2a7104[_0x25d01f(0x178)][_0x25d01f(0x1e9)],_0x215139),ensureJourneyDefaults(_0x2f905f),await _0x12433c[_0x25d01f(0x1ab)][_0x25d01f(0x10b)](_0x47da0a[_0x25d01f(0x16b)]['id'],_0x2a7104),deletePushRecovery(_0x47da0a[_0x25d01f(0x164)]),{'action':_0x25d01f(0x10c),'journeyId':_0x47da0a['existingJourney']['id'],'embeddedSegmentNameToId':_0x35c92e};}}return deletePushRecovery(_0x47da0a[_0x25d01f(0x164)]),{'action':'unchanged','journeyId':_0x47da0a[_0x25d01f(0x16b)]?.['id'],'embeddedSegmentNameToId':_0x35c92e};}function findSegmentCriteriaLocation(_0x422250,_0x2b571e){const _0x1d8bee=a140_0x2324c6,_0x17f1cb=_0x422250[_0x1d8bee(0x1b0)]||_0x422250[_0x1d8bee(0x139)]?.[0x0]?.['stages']||[];let _0x58a4a5='entry',_0x9d47d9=_0x2b571e;const _0x2b76f1=_0x422250[_0x1d8bee(0x159)]||_0x422250[_0x1d8bee(0x139)]?.[0x0]?.[_0x1d8bee(0x159)];if(_0x2b76f1?.[_0x1d8bee(0x176)]===_0x2b571e)return{'stageName':_0x1d8bee(0x159),'criteriaName':_0x2b76f1[_0x1d8bee(0x1b4)]||_0x2b571e};_0x32ac58:for(const _0x1e2114 of _0x17f1cb){if(_0x1e2114[_0x1d8bee(0x148)]?.['segment']===_0x2b571e){_0x58a4a5=_0x1e2114[_0x1d8bee(0x1b4)],_0x9d47d9=_0x1e2114[_0x1d8bee(0x148)][_0x1d8bee(0x1b4)]||_0x2b571e;break;}if(_0x1e2114[_0x1d8bee(0x1c5)])for(const _0x150a8b of _0x1e2114[_0x1d8bee(0x1c5)]){if(_0x150a8b[_0x1d8bee(0x13e)]===_0x1d8bee(0x129)&&_0x150a8b[_0x1d8bee(0x153)]?.['branches'])for(const _0xb5de6d of _0x150a8b[_0x1d8bee(0x153)][_0x1d8bee(0x1f7)]){if(_0xb5de6d[_0x1d8bee(0x176)]===_0x2b571e){_0x58a4a5=_0x1e2114['name'],_0x9d47d9=_0xb5de6d[_0x1d8bee(0x1b4)]||_0x2b571e;break _0x32ac58;}}}}return{'stageName':_0x58a4a5,'criteriaName':_0x9d47d9};}async function executeThreeStepJourneyCreate(_0x1a3560,_0x4246e6,_0xaac9d8,_0xc62fd3,_0x125ca9,_0x52932d,_0x4b3a82,_0x283db0){const _0x489d05=a140_0x2324c6,{activationDefToCreateRequest:_0x18e3c9,yamlRuleToApi:_0x2b1a16}=_0x283db0,{pendingEmbeddedSegments:_0x29cf9e,pendingEmbeddedActivations:_0x14c6a1,embeddedSegmentNameToId:_0x44eeb3}=_0xc62fd3,_0x32e3dd=JSON['parse'](JSON[_0x489d05(0x117)](_0xaac9d8));ensureJourneyDefaults(_0x32e3dd['attributes']),stripPendingIds(_0x32e3dd);const _0x56e781=await _0x1a3560[_0x489d05(0x1ab)]['create'](_0x32e3dd),_0x18f9fe=_0x56e781['id'],_0x323f04=new Map();for(const _0x2bb26b of _0x56e781[_0x489d05(0x178)][_0x489d05(0x1e9)]){_0x323f04[_0x489d05(0x12c)](_0x2bb26b[_0x489d05(0x1b4)][_0x489d05(0x15e)](),_0x2bb26b['id']);}recoverSegmentIdsFromPushRecovery(_0x4246e6,_0x44eeb3,_0x52932d[_0x489d05(0xfe)]);for(const [_0x5d7fd7,{definition:_0x41608c}]of _0x29cf9e){if(_0x44eeb3[_0x489d05(0x18f)](_0x5d7fd7)){_0x4b3a82[_0x489d05(0x16e)]?.({'type':_0x489d05(0xfa),'journeyName':_0x4246e6[_0x489d05(0x189)][_0x489d05(0x1b4)],'segmentName':_0x5d7fd7});continue;}const _0x4fc6bf=generateDeterministicJourneySegmentName(_0x4246e6[_0x489d05(0x189)][_0x489d05(0x1b4)],_0x5d7fd7);_0x4b3a82[_0x489d05(0x16e)]?.({'type':_0x489d05(0x113),'journeyName':_0x4246e6[_0x489d05(0x189)]['name'],'segmentName':_0x5d7fd7});const _0x41633c=createSegmentIdResolver(_0x52932d[_0x489d05(0xfe)],_0x5d7fd7),_0x59ebac=await resolveRuleSegmentIds(_0x41608c['rule'],_0x41633c),_0x528489=await createOrRecoverEmbeddedSegment(_0x1a3560,_0x4246e6,{'localName':_0x5d7fd7,'uniqueSegmentName':_0x4fc6bf,'description':_0x41608c[_0x489d05(0x198)]||'Entry\x20criteria:\x20'+_0x5d7fd7,'journeyId':_0x18f9fe,'resolvedRule':_0x59ebac,'parentId':_0x125ca9['parentId'],'folderId':_0x125ca9[_0x489d05(0x1d6)]||''},_0x2b1a16);_0x44eeb3[_0x489d05(0x12c)](_0x5d7fd7,_0x528489),_0x52932d[_0x489d05(0xfe)]['set'](_0x5d7fd7,_0x528489),_0x4b3a82[_0x489d05(0x16e)]?.({'type':_0x489d05(0xfa),'journeyName':_0x4246e6[_0x489d05(0x189)][_0x489d05(0x1b4)],'segmentName':_0x5d7fd7});}const _0x3faa97=new Map();for(const [_0x28e571,_0x5a2173]of _0x14c6a1){_0x4b3a82[_0x489d05(0x16e)]?.({'type':_0x489d05(0x118),'journeyName':_0x4246e6[_0x489d05(0x189)][_0x489d05(0x1b4)],'activationName':_0x28e571});const _0x113d5a=await _0x18e3c9(_0x5a2173,_0x52932d[_0x489d05(0x1da)]),_0xddcafa={..._0x113d5a,..._0x5a2173[_0x489d05(0x1a0)]!==undefined&&{'runAfterJourneyRefresh':_0x5a2173[_0x489d05(0x1a0)]}},_0x1453ec=await _0x1a3560['journey'][_0x489d05(0x14b)](_0x18f9fe,_0xddcafa);_0x3faa97[_0x489d05(0x12c)](_0x28e571,_0x1453ec['id']),_0xc62fd3[_0x489d05(0x12e)][_0x489d05(0x12c)](_0x28e571,_0x1453ec['id']),_0x4b3a82[_0x489d05(0x16e)]?.({'type':'embedded_activation_created','journeyName':_0x4246e6[_0x489d05(0x189)][_0x489d05(0x1b4)],'activationName':_0x28e571});}const _0x4dd37b=JSON['parse'](JSON[_0x489d05(0x117)](_0xaac9d8));return _0x4dd37b['id']=_0x18f9fe,ensureJourneyDefaults(_0x4dd37b[_0x489d05(0x178)]),resolvePendingIdsInRequest(_0x4dd37b,_0xaac9d8,_0x323f04,_0x44eeb3,_0x3faa97,_0x4b3a82),await _0x1a3560[_0x489d05(0x1ab)][_0x489d05(0x10b)](_0x18f9fe,_0x4dd37b),deletePushRecovery(_0x4246e6['absolutePath']),{'action':'created','journeyId':_0x18f9fe,'embeddedSegmentNameToId':_0x44eeb3};}export function stripWaitStepPendingIds(_0x33ab34){const _0x5dcc4c=a140_0x2324c6,_0x3a1351=_0x33ab34[_0x5dcc4c(0x1f9)]&&isPendingSegmentId(_0x33ab34[_0x5dcc4c(0x1f9)]),_0x5c6718=_0x33ab34[_0x5dcc4c(0x142)]?.[_0x5dcc4c(0x1cc)](_0x5f2435=>_0x5f2435['segmentId']&&isPendingSegmentId(_0x5f2435['segmentId']));(_0x3a1351||_0x5c6718)&&(_0x33ab34['waitStepType']=_0x5dcc4c(0x1d5),_0x33ab34[_0x5dcc4c(0x11f)]=0x1,_0x33ab34[_0x5dcc4c(0x138)]=_0x5dcc4c(0x15c),delete _0x33ab34[_0x5dcc4c(0x1f9)],delete _0x33ab34['conditionTimeoutDuration'],delete _0x33ab34['conditionTimeoutUnit'],delete _0x33ab34[_0x5dcc4c(0x142)]);}export function resolveWaitStepPendingIds(_0x3e8250,_0x45dcf8,_0x1cee90,_0x2a6a03){const _0x2f936f=a140_0x2324c6;if(_0x45dcf8[_0x2f936f(0x1f9)]&&isPendingSegmentId(_0x45dcf8['conditionSegmentId'])){const _0x4839a1=_0x1cee90(_0x45dcf8[_0x2f936f(0x1f9)],_0x2f936f(0x17d)+_0x2a6a03+_0x2f936f(0x172));_0x4839a1&&(_0x3e8250['waitStepType']=_0x2f936f(0x1c1),_0x3e8250[_0x2f936f(0x1f9)]=_0x4839a1,delete _0x3e8250['waitStep'],delete _0x3e8250[_0x2f936f(0x138)],_0x45dcf8[_0x2f936f(0x1b7)]!==undefined&&(_0x3e8250[_0x2f936f(0x1b7)]=_0x45dcf8[_0x2f936f(0x1b7)]),_0x45dcf8[_0x2f936f(0x1b1)]&&(_0x3e8250[_0x2f936f(0x1b1)]=_0x45dcf8[_0x2f936f(0x1b1)]));}if(_0x45dcf8[_0x2f936f(0x142)]){const _0x1b971b=_0x45dcf8[_0x2f936f(0x142)][_0x2f936f(0x1cc)](_0x2f61ff=>_0x2f61ff[_0x2f936f(0x1e5)]&&isPendingSegmentId(_0x2f61ff[_0x2f936f(0x1e5)]));if(_0x1b971b){const _0x51ee65=_0x45dcf8[_0x2f936f(0x142)][_0x2f936f(0x1ac)](_0x143131=>{const _0x1ebb63=_0x2f936f;if(_0x143131[_0x1ebb63(0x1e5)]&&isPendingSegmentId(_0x143131['segmentId'])){const _0x28642d=_0x1cee90(_0x143131[_0x1ebb63(0x1e5)],_0x1ebb63(0x17d)+_0x2a6a03+_0x1ebb63(0x172));return{..._0x143131,'segmentId':_0x28642d||_0x143131[_0x1ebb63(0x1e5)]};}return{..._0x143131};});_0x3e8250['waitStepType']=_0x2f936f(0x1c1),_0x3e8250['conditions']=_0x51ee65,delete _0x3e8250['waitStep'],delete _0x3e8250[_0x2f936f(0x138)],delete _0x3e8250['conditionSegmentId'],delete _0x3e8250[_0x2f936f(0x1b7)],delete _0x3e8250[_0x2f936f(0x1b1)];}}}function stripPendingIds(_0x346938){const _0x1fef83=a140_0x2324c6;_0x346938[_0x1fef83(0x178)][_0x1fef83(0x159)]?.[_0x1fef83(0x1e5)]&&isPendingSegmentId(_0x346938['attributes'][_0x1fef83(0x159)][_0x1fef83(0x1e5)])&&delete _0x346938[_0x1fef83(0x178)][_0x1fef83(0x159)];for(const _0x1dfaae of _0x346938[_0x1fef83(0x178)][_0x1fef83(0x1e9)]||[]){_0x1dfaae[_0x1fef83(0x1c0)]?.[_0x1fef83(0x1e5)]&&isPendingSegmentId(_0x1dfaae[_0x1fef83(0x1c0)][_0x1fef83(0x1e5)])&&delete _0x1dfaae[_0x1fef83(0x1c0)];_0x1dfaae[_0x1fef83(0x1df)]?.[_0x1fef83(0x1e5)]&&isPendingSegmentId(_0x1dfaae['milestone']['segmentId'])&&delete _0x1dfaae[_0x1fef83(0x1df)];_0x1dfaae[_0x1fef83(0x175)]&&(_0x1dfaae['exitCriterias']=_0x1dfaae[_0x1fef83(0x175)]['filter'](_0x306978=>!_0x306978[_0x1fef83(0x1e5)]||!isPendingSegmentId(_0x306978[_0x1fef83(0x1e5)])));if(_0x1dfaae[_0x1fef83(0x1c5)])for(const _0x4be959 of Object[_0x1fef83(0x1c9)](_0x1dfaae['steps'])){const _0x293ba1=_0x1dfaae['steps'][_0x4be959];_0x293ba1[_0x1fef83(0x13e)]===_0x1fef83(0x140)&&_0x293ba1['journeyActivationStepId']&&isPendingActivationId(_0x293ba1[_0x1fef83(0x10d)])&&(_0x293ba1[_0x1fef83(0x10d)]='');if(_0x293ba1[_0x1fef83(0x13e)]==='DecisionPoint'&&_0x293ba1['branches'])for(const _0x403d28 of _0x293ba1[_0x1fef83(0x1f7)]){_0x403d28[_0x1fef83(0x1e5)]&&isPendingSegmentId(_0x403d28[_0x1fef83(0x1e5)])&&(_0x403d28[_0x1fef83(0x1e5)]='');}_0x293ba1[_0x1fef83(0x13e)]===_0x1fef83(0x126)&&stripWaitStepPendingIds(_0x293ba1);}}}function resolvePendingIdsInRequest(_0x2c7ebc,_0x5e1648,_0x31175e,_0xcd46b0,_0x38511b,_0x311386){const _0x4ced66=a140_0x2324c6,_0x4cebcc=(_0x54938b,_0x49c87d)=>{const _0xb2d028=a140_0x2c4f;if(!isPendingSegmentId(_0x54938b))return _0x54938b;const _0x5a079e=extractPendingSegmentName(_0x54938b),_0x3e535a=_0xcd46b0[_0xb2d028(0x115)](_0x5a079e);return!_0x3e535a&&_0x311386[_0xb2d028(0x156)]?.(_0xb2d028(0x1a6)+_0x5a079e+_0xb2d028(0x1c7)+_0x49c87d),_0x3e535a;};if(_0x2c7ebc['attributes'][_0x4ced66(0x159)]?.[_0x4ced66(0x1e5)]&&isPendingSegmentId(_0x2c7ebc[_0x4ced66(0x178)][_0x4ced66(0x159)][_0x4ced66(0x1e5)])){const _0x12aa7e=_0x4cebcc(_0x2c7ebc[_0x4ced66(0x178)][_0x4ced66(0x159)][_0x4ced66(0x1e5)],_0x4ced66(0x13f));_0x12aa7e&&(_0x2c7ebc[_0x4ced66(0x178)][_0x4ced66(0x159)][_0x4ced66(0x1e5)]=_0x12aa7e);}for(const _0x4f150e of _0x2c7ebc['attributes'][_0x4ced66(0x1e9)]||[]){const _0xf53f31=_0x31175e['get'](_0x4f150e[_0x4ced66(0x1b4)]['toLowerCase']());_0xf53f31&&(_0x4f150e['id']=_0xf53f31);if(_0x4f150e[_0x4ced66(0x1c0)]?.['segmentId']&&isPendingSegmentId(_0x4f150e[_0x4ced66(0x1c0)][_0x4ced66(0x1e5)])){const _0x18fb7e=_0x4cebcc(_0x4f150e['entryCriteria']['segmentId'],_0x4ced66(0x17d)+_0x4f150e[_0x4ced66(0x1b4)]+_0x4ced66(0x14e));_0x18fb7e&&(_0x4f150e[_0x4ced66(0x1c0)][_0x4ced66(0x1e5)]=_0x18fb7e);}if(_0x4f150e['exitCriterias'])for(const _0x8d0794 of _0x4f150e[_0x4ced66(0x175)]){if(_0x8d0794[_0x4ced66(0x1e5)]&&isPendingSegmentId(_0x8d0794['segmentId'])){const _0x763a3e=_0x4cebcc(_0x8d0794[_0x4ced66(0x1e5)],_0x4ced66(0x17d)+_0x4f150e[_0x4ced66(0x1b4)]+'\x27\x20exit\x20criteria');_0x763a3e&&(_0x8d0794[_0x4ced66(0x1e5)]=_0x763a3e);}}if(_0x4f150e['milestone']?.[_0x4ced66(0x1e5)]&&isPendingSegmentId(_0x4f150e[_0x4ced66(0x1df)][_0x4ced66(0x1e5)])){const _0x131965=_0x4cebcc(_0x4f150e[_0x4ced66(0x1df)]['segmentId'],_0x4ced66(0x17d)+_0x4f150e[_0x4ced66(0x1b4)]+_0x4ced66(0x1f8));_0x131965&&(_0x4f150e[_0x4ced66(0x1df)][_0x4ced66(0x1e5)]=_0x131965);}if(_0x4f150e[_0x4ced66(0x1c5)]){const _0x29faa5=_0x4dc772=>_0x5e1648[_0x4ced66(0x178)]['journeyStages']?.[_0x4ced66(0x1dd)](_0x2f4edf=>_0x2f4edf[_0x4ced66(0x1b4)][_0x4ced66(0x15e)]()===_0x4f150e[_0x4ced66(0x1b4)][_0x4ced66(0x15e)]())?.[_0x4ced66(0x1c5)]?.[_0x4dc772];for(const _0x2c05e7 of Object[_0x4ced66(0x1c9)](_0x4f150e['steps'])){const _0x1d3449=_0x4f150e[_0x4ced66(0x1c5)][_0x2c05e7],_0x1feeb7=_0x29faa5(_0x2c05e7);if(_0x1d3449[_0x4ced66(0x13e)]===_0x4ced66(0x140)&&_0x1d3449[_0x4ced66(0x10d)]&&(isPendingActivationId(_0x1d3449['journeyActivationStepId'])||_0x1d3449[_0x4ced66(0x10d)]==='')){if(_0x1feeb7?.[_0x4ced66(0x10d)]&&isPendingActivationId(_0x1feeb7[_0x4ced66(0x10d)])){const _0x466790=extractPendingActivationName(_0x1feeb7['journeyActivationStepId']),_0x94facf=_0x38511b[_0x4ced66(0x115)](_0x466790);_0x94facf&&(_0x1d3449[_0x4ced66(0x10d)]=_0x94facf);}}if(_0x1d3449['type']===_0x4ced66(0x182)&&_0x1d3449['branches']&&_0x1feeb7?.['branches'])for(let _0xea9776=0x0;_0xea9776<_0x1d3449[_0x4ced66(0x1f7)]['length'];_0xea9776++){const _0x102477=_0x1d3449['branches'][_0xea9776],_0x1f9948=_0x1feeb7['branches'][_0xea9776];if(_0x1f9948?.[_0x4ced66(0x1e5)]&&isPendingSegmentId(_0x1f9948['segmentId'])){const _0x4f681a=_0x4cebcc(_0x1f9948[_0x4ced66(0x1e5)],_0x4ced66(0x17d)+_0x4f150e[_0x4ced66(0x1b4)]+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x102477[_0x4ced66(0x1b4)]||_0xea9776)+'\x27');_0x4f681a&&(_0x102477[_0x4ced66(0x1e5)]=_0x4f681a);}}_0x1d3449[_0x4ced66(0x13e)]===_0x4ced66(0x126)&&_0x1feeb7?.[_0x4ced66(0x13e)]===_0x4ced66(0x126)&&resolveWaitStepPendingIds(_0x1d3449,_0x1feeb7,_0x4cebcc,_0x4f150e[_0x4ced66(0x1b4)]);}}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a141_0x115a(_0x291471,_0x286d0c){_0x291471=_0x291471-0xc7;const _0x2d760a=a141_0x2d76();let _0x115a30=_0x2d760a[_0x291471];return _0x115a30;}(function(_0x332aed,_0x2bc77e){const _0x27d743=a141_0x115a,_0x1302c6=_0x332aed();while(!![]){try{const _0x46cfbe=-parseInt(_0x27d743(0xca))/0x1+parseInt(_0x27d743(0xd2))/0x2+parseInt(_0x27d743(0xd1))/0x3+parseInt(_0x27d743(0xcb))/0x4*(parseInt(_0x27d743(0xcc))/0x5)+-parseInt(_0x27d743(0xcf))/0x6+parseInt(_0x27d743(0xd4))/0x7*(parseInt(_0x27d743(0xd0))/0x8)+-parseInt(_0x27d743(0xc7))/0x9*(-parseInt(_0x27d743(0xcd))/0xa);if(_0x46cfbe===_0x2bc77e)break;else _0x1302c6['push'](_0x1302c6['shift']());}catch(_0x4ea83f){_0x1302c6['push'](_0x1302c6['shift']());}}}(a141_0x2d76,0x602e5));function a141_0x2d76(){const _0x33f8dc=['309099FzPlwW','387534rbfAfo','get','14IHHdHG','name','add','27nVqJeD','parentFolderId','set','69999JGcirV','4OOBEjO','259910enwWda','651190ywTTgS','has','4509414oFvqYk','2685544BAIcQd'];a141_0x2d76=function(){return _0x33f8dc;};return a141_0x2d76();}export function buildFolderIdToPathMap(_0x39e0d9){const _0x3b3ebd=a141_0x115a,_0xe53aa0=new Map(),_0x2a6c3=new Map();for(const _0x5498a3 of _0x39e0d9){_0x2a6c3[_0x3b3ebd(0xc9)](_0x5498a3['id'],_0x5498a3);}const _0x4ca9f9=new Set();for(const _0x4cc311 of _0x39e0d9){!_0x4cc311['parentFolderId']&&_0x4ca9f9[_0x3b3ebd(0xd6)](_0x4cc311['id']);}function _0x3392d3(_0x149587){const _0x3d7303=_0x3b3ebd;if(_0xe53aa0[_0x3d7303(0xce)](_0x149587['id']))return _0xe53aa0['get'](_0x149587['id']);if(_0x4ca9f9[_0x3d7303(0xce)](_0x149587['id']))return _0xe53aa0[_0x3d7303(0xc9)](_0x149587['id'],''),'';if(_0x149587[_0x3d7303(0xc8)]){const _0x2e67c4=_0x2a6c3[_0x3d7303(0xd3)](_0x149587[_0x3d7303(0xc8)]);if(_0x2e67c4){const _0x1d61b8=_0x3392d3(_0x2e67c4),_0x2bce2c=_0x1d61b8?_0x1d61b8+'/'+_0x149587['name']:_0x149587[_0x3d7303(0xd5)];return _0xe53aa0['set'](_0x149587['id'],_0x2bce2c),_0x2bce2c;}}const _0x36ecad=_0x149587[_0x3d7303(0xd5)];return _0xe53aa0[_0x3d7303(0xc9)](_0x149587['id'],_0x36ecad),_0x36ecad;}for(const _0x2948af of _0x39e0d9){_0x3392d3(_0x2948af);}return _0xe53aa0;}export function buildFolderPathToIdMap(_0x518f11){const _0x36f17e=a141_0x115a,_0x183cd6=new Map(),_0x30c536=new Map();for(const _0x49fd64 of _0x518f11){_0x30c536[_0x36f17e(0xc9)](_0x49fd64['id'],_0x49fd64);}const _0x32dc4b=new Set();for(const _0x295eea of _0x518f11){!_0x295eea[_0x36f17e(0xc8)]&&_0x32dc4b['add'](_0x295eea['id']);}function _0x5e8633(_0x4a65e8){const _0x4e53f1=_0x36f17e;if(_0x32dc4b[_0x4e53f1(0xce)](_0x4a65e8['id']))return'';if(_0x4a65e8[_0x4e53f1(0xc8)]){const _0x1b14fe=_0x30c536[_0x4e53f1(0xd3)](_0x4a65e8[_0x4e53f1(0xc8)]);if(_0x1b14fe){const _0x429475=_0x5e8633(_0x1b14fe);return _0x429475?_0x429475+'/'+_0x4a65e8[_0x4e53f1(0xd5)]:_0x4a65e8[_0x4e53f1(0xd5)];}}return _0x4a65e8[_0x4e53f1(0xd5)];}for(const _0x4d59f1 of _0x518f11){const _0x17ab4b=_0x5e8633(_0x4d59f1);_0x183cd6[_0x36f17e(0xc9)](_0x17ab4b,_0x4d59f1['id']);}return _0x183cd6;}export function buildFolderMaps(_0xeab6da){const _0x48fc9b=buildFolderIdToPathMap(_0xeab6da),_0x4d5867=new Map();for(const [_0x4b8c03,_0x1df6aa]of _0x48fc9b){_0x4d5867['set'](_0x1df6aa,_0x4b8c03);}return{'idToPath':_0x48fc9b,'pathToId':_0x4d5867};}export function getFolderPath(_0x1a36e8,_0x4de088){if(!_0x1a36e8)return'';return _0x4de088['get'](_0x1a36e8)??'';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x337604,_0x1b95d1){const _0x41123c=a142_0x58ea,_0x5613e0=_0x337604();while(!![]){try{const _0x41d6b2=parseInt(_0x41123c(0xff))/0x1*(parseInt(_0x41123c(0x117))/0x2)+-parseInt(_0x41123c(0xf7))/0x3*(-parseInt(_0x41123c(0x12a))/0x4)+-parseInt(_0x41123c(0x120))/0x5*(-parseInt(_0x41123c(0x10a))/0x6)+-parseInt(_0x41123c(0x106))/0x7+parseInt(_0x41123c(0x102))/0x8*(parseInt(_0x41123c(0x114))/0x9)+parseInt(_0x41123c(0x121))/0xa+parseInt(_0x41123c(0xfb))/0xb*(-parseInt(_0x41123c(0x108))/0xc);if(_0x41d6b2===_0x1b95d1)break;else _0x5613e0['push'](_0x5613e0['shift']());}catch(_0x5816cf){_0x5613e0['push'](_0x5613e0['shift']());}}}(a142_0x121f,0xa7ece));import a142_0x3a8e1a from'path';import{parse as a142_0x5dcc9f}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x5d1d95){const _0x13e10d=a142_0x58ea;if(!_0x5d1d95||_0x5d1d95[_0x13e10d(0x11a)]()==='')throw new Error(_0x13e10d(0x111));const _0x4471c3=_0x5d1d95[_0x13e10d(0x11a)]();if(_0x4471c3==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x5d1d95};const _0x235660=_0x4471c3[_0x13e10d(0x127)]('/')?_0x4471c3[_0x13e10d(0x104)](0x1):_0x4471c3,_0xd4768=_0x235660[_0x13e10d(0x113)]('/')[_0x13e10d(0x109)](_0x93dfb=>_0x93dfb!=='');if(_0xd4768[_0x13e10d(0x126)]===0x0)throw new Error(_0x13e10d(0x10f));const _0x53f674=_0x4471c3['startsWith']('/')||!isRelativePathSegment(_0xd4768[0x0]);for(const _0x6198b0 of _0xd4768){validatePathSegment(_0x6198b0);}return{'segments':_0xd4768,'isAbsolute':_0x53f674,'raw':_0x5d1d95};}function isRelativePathSegment(_0x1a6b04){return _0x1a6b04==='.'||_0x1a6b04==='..';}function validatePathSegment(_0x26cbdc){const _0x3d05f=a142_0x58ea;if(_0x26cbdc==='')throw new Error(_0x3d05f(0xf6));if(_0x26cbdc==='.'||_0x26cbdc==='..')return;if(/[\x00-\x1F\x7F]/[_0x3d05f(0xf9)](_0x26cbdc))throw new Error(_0x3d05f(0xfa)+_0x26cbdc);if(_0x26cbdc!==_0x26cbdc[_0x3d05f(0x11a)]()){}}export function validatePath(_0xf18e57){const _0x510023=a142_0x58ea;if(_0xf18e57[_0x510023(0x10d)][_0x510023(0x126)]===0x0&&!_0xf18e57['isAbsolute'])throw new Error(_0x510023(0x128));if(_0xf18e57[_0x510023(0x129)]){if(_0xf18e57['segments'][0x0]==='..')throw new Error(_0x510023(0xfd));let _0x3508ae=0x0;for(const _0x29f77e of _0xf18e57[_0x510023(0x10d)]){if(_0x29f77e==='..'){if(_0x3508ae===0x0)throw new Error('Path\x20attempts\x20to\x20navigate\x20above\x20root');_0x3508ae--;}else _0x29f77e!=='.'&&_0x3508ae++;}}}export function joinPaths(_0x455428,_0x1d54c9){const _0x5313a4=a142_0x58ea;if(!_0x455428||_0x455428==='/')return _0x1d54c9;if(!_0x1d54c9||_0x1d54c9==='.')return _0x455428;if(_0x1d54c9[_0x5313a4(0x127)]('/'))return _0x1d54c9;const _0xd64609=parsePath(_0x455428),_0xa76605=parsePath(_0x1d54c9),_0x40154a=[..._0xd64609[_0x5313a4(0x10d)]];for(const _0x40a7a7 of _0xa76605[_0x5313a4(0x10d)]){if(_0x40a7a7==='.')continue;else{if(_0x40a7a7==='..'){if(_0x40154a[_0x5313a4(0x126)]===0x0)throw new Error(_0x5313a4(0x101));_0x40154a['pop']();}else _0x40154a[_0x5313a4(0x11e)](_0x40a7a7);}}const _0x27234d=_0x40154a[_0x5313a4(0x100)]('/');return _0xd64609['raw'][_0x5313a4(0x127)]('/')?'/'+_0x27234d:_0x27234d;}export function normalizePath(_0x547a6d){const _0x2b56d4=a142_0x58ea,_0x48923e=parsePath(_0x547a6d),_0x1749be=[];for(const _0x1740d5 of _0x48923e['segments']){if(_0x1740d5==='.')continue;else{if(_0x1740d5==='..'){if(_0x1749be[_0x2b56d4(0x126)]===0x0){if(_0x48923e['isAbsolute'])throw new Error(_0x2b56d4(0x101));_0x1749be[_0x2b56d4(0x11e)]('..');}else _0x1749be[_0x1749be['length']-0x1]==='..'?_0x1749be['push']('..'):_0x1749be[_0x2b56d4(0x103)]();}else _0x1749be[_0x2b56d4(0x11e)](_0x1740d5);}}if(_0x1749be['length']===0x0)return _0x48923e[_0x2b56d4(0x129)]?'/':'.';const _0x23b99e=_0x1749be[_0x2b56d4(0x100)]('/');return _0x48923e[_0x2b56d4(0x10c)]['startsWith']('/')?'/'+_0x23b99e:_0x23b99e;}export function getParentPath(_0x35fc7c){const _0x25cf06=a142_0x58ea,_0x50dd7b=parsePath(_0x35fc7c);if(_0x50dd7b[_0x25cf06(0x10d)][_0x25cf06(0x126)]<=0x1)return'/';const _0x1306ac=_0x50dd7b[_0x25cf06(0x10d)][_0x25cf06(0x122)](0x0,-0x1)[_0x25cf06(0x100)]('/');return _0x50dd7b[_0x25cf06(0x10c)][_0x25cf06(0x127)]('/')?'/'+_0x1306ac:_0x1306ac;}export function getBaseName(_0x20f60a){const _0x2f70af=a142_0x58ea,_0x1062e5=parsePath(_0x20f60a);return _0x1062e5[_0x2f70af(0x10d)][_0x1062e5[_0x2f70af(0x10d)][_0x2f70af(0x126)]-0x1]||'';}function a142_0x58ea(_0x3e8c38,_0x75da6e){_0x3e8c38=_0x3e8c38-0xf6;const _0x121fb1=a142_0x121f();let _0x58eac8=_0x121fb1[_0x3e8c38];return _0x58eac8;}export function isChildPath(_0x171ad5,_0xf5b0f8){const _0x493444=a142_0x58ea,_0x31dd8a=parsePath(_0x171ad5),_0x16b40b=parsePath(_0xf5b0f8);if(_0x31dd8a['segments'][_0x493444(0x126)]<=_0x16b40b[_0x493444(0x10d)][_0x493444(0x126)])return![];for(let _0x341763=0x0;_0x341763<_0x16b40b['segments'][_0x493444(0x126)];_0x341763++){if(_0x31dd8a[_0x493444(0x10d)][_0x341763]!==_0x16b40b[_0x493444(0x10d)][_0x341763])return![];}return!![];}function a142_0x121f(){const _0x5e6785=['parse','Path\x20cannot\x20be\x20empty','name','split','3898881kCOgWh','resolve','exists','4702wAiAXD','.yml','readFile','trim','parent_segment','relative','No\x20tdx.json\x20found\x20for\x20file:\x20','push','.yaml','1858895bUFmFc','1404810DHgRpO','slice','File\x20not\x20found:\x20','journey','root','length','startsWith','Relative\x20path\x20cannot\x20be\x20empty','isAbsolute','3112332CegFDj','endsWith','Path\x20segment\x20cannot\x20be\x20empty','3XNtREo','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','test','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','11uJcbTq','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','replace','313uqbMVP','join','Cannot\x20navigate\x20above\x20root','8ztGssw','pop','substring','tdx.json','4775603WVrMvS','Cannot\x20split\x20empty\x20path','17533716WRlhvb','filter','12ofJLhc','segment','raw','segments','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','Path\x20must\x20contain\x20at\x20least\x20one\x20segment'];a142_0x121f=function(){return _0x5e6785;};return a142_0x121f();}export function splitPath(_0x132ef7){const _0x19843d=a142_0x58ea,_0x5f5acd=parsePath(_0x132ef7);if(_0x5f5acd[_0x19843d(0x10d)][_0x19843d(0x126)]===0x0)throw new Error(_0x19843d(0x107));if(_0x5f5acd[_0x19843d(0x10d)]['length']===0x1)return{'parent':_0x5f5acd['segments'][0x0]};return{'parent':_0x5f5acd[_0x19843d(0x10d)][0x0],'child':_0x5f5acd[_0x19843d(0x10d)][_0x19843d(0x122)](0x1)['join']('/')};}export function isYamlFilePath(_0x42af76){const _0x1707dc=a142_0x58ea;return _0x42af76[_0x1707dc(0x12b)](_0x1707dc(0x118))||_0x42af76[_0x1707dc(0x12b)](_0x1707dc(0x11f));}export async function resolveYamlFilePath(_0x2636b8,_0x10f866=nodeFileSystem){const _0x589f79=a142_0x58ea,_0x3281cb=a142_0x3a8e1a[_0x589f79(0x115)](_0x2636b8);if(!await _0x10f866['exists'](_0x3281cb))throw new Error(_0x589f79(0x123)+_0x2636b8);let _0x4fbb17=a142_0x3a8e1a['dirname'](_0x3281cb),_0x4014d9=null,_0x447105=null;const _0x2f5114=a142_0x3a8e1a[_0x589f79(0x110)](_0x4fbb17)[_0x589f79(0x125)];while(_0x4fbb17!==_0x2f5114){const _0x2cca73=a142_0x3a8e1a[_0x589f79(0x100)](_0x4fbb17,_0x589f79(0x105));if(await _0x10f866[_0x589f79(0x116)](_0x2cca73)){_0x4014d9=_0x2cca73,_0x447105=_0x4fbb17;break;}_0x4fbb17=a142_0x3a8e1a['dirname'](_0x4fbb17);}if(!_0x4014d9||!_0x447105)throw new Error(_0x589f79(0x11d)+_0x2636b8+'\x0a'+_0x589f79(0x10e));const _0x548481=await _0x10f866[_0x589f79(0x119)](_0x4014d9),_0x5d8bac=JSON[_0x589f79(0x110)](_0x548481),_0x1befe3=_0x5d8bac[_0x589f79(0x11b)];if(!_0x1befe3)throw new Error(_0x589f79(0xfc));const _0x2321ca=await _0x10f866['readFile'](_0x3281cb),_0x11b43a=a142_0x5dcc9f(_0x2321ca),_0x349cde=_0x11b43a[_0x589f79(0x112)];if(!_0x349cde)throw new Error(_0x589f79(0xf8)+_0x2636b8);const _0x5a75b8=_0x11b43a['type']===_0x589f79(0x124)?_0x589f79(0x124):_0x589f79(0x10b),_0x4ae0cb=a142_0x3a8e1a[_0x589f79(0x11c)](_0x447105,_0x3281cb),_0x381b60=a142_0x3a8e1a['dirname'](_0x4ae0cb),_0x51c953=_0x381b60==='.'?'':_0x381b60[_0x589f79(0xfe)](/\\/g,'/'),_0x4b81ec=_0x51c953?_0x1befe3+'/'+_0x51c953+'/'+_0x349cde:_0x1befe3+'/'+_0x349cde;return{'parentSegment':_0x1befe3,'segmentName':_0x349cde,'folderPath':_0x51c953,'fullPath':_0x4b81ec,'resourceType':_0x5a75b8,'content':_0x2321ca};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a143_0x391a(_0x538017,_0x1ce31d){_0x538017=_0x538017-0x1b1;const _0x344d2b=a143_0x344d();let _0x391afa=_0x344d2b[_0x538017];return _0x391afa;}(function(_0x14d79a,_0x17e28d){const _0x1798f7=a143_0x391a,_0x5e8a71=_0x14d79a();while(!![]){try{const _0x7553ac=parseInt(_0x1798f7(0x1b3))/0x1*(parseInt(_0x1798f7(0x1b1))/0x2)+parseInt(_0x1798f7(0x1be))/0x3*(parseInt(_0x1798f7(0x1bc))/0x4)+parseInt(_0x1798f7(0x1b4))/0x5+-parseInt(_0x1798f7(0x1b7))/0x6+parseInt(_0x1798f7(0x1bb))/0x7*(parseInt(_0x1798f7(0x1ba))/0x8)+-parseInt(_0x1798f7(0x1b2))/0x9*(parseInt(_0x1798f7(0x1bd))/0xa)+-parseInt(_0x1798f7(0x1bf))/0xb;if(_0x7553ac===_0x17e28d)break;else _0x5e8a71['push'](_0x5e8a71['shift']());}catch(_0x51d3f1){_0x5e8a71['push'](_0x5e8a71['shift']());}}}(a143_0x344d,0x87eba));function a143_0x344d(){const _0x12bbac=['6GBRKMz','1911118KEhmuj','73214UCIbQo','25218WLWySd','11BIBUpA','1494160rDXAyC','.\x20Parent\x20name\x20cannot\x20be\x20empty','Invalid\x20segment\x20reference\x20format:\x20','3631812ppkwVc','indexOf','substring','11912gdcTCj','2569ZfcZgr','898512VzIxBI','1290exAMxS'];a143_0x344d=function(){return _0x12bbac;};return a143_0x344d();}export function parseSegmentRef(_0x2a9a71){const _0x2eae9e=a143_0x391a,_0x94193e=_0x2a9a71[_0x2eae9e(0x1b8)]('/');if(_0x94193e===-0x1)return{'parentId':_0x2a9a71};if(_0x94193e===0x0)throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x2a9a71+_0x2eae9e(0x1b5));const _0x265027=_0x2a9a71[_0x2eae9e(0x1b9)](0x0,_0x94193e),_0x5b0587=_0x2a9a71[_0x2eae9e(0x1b9)](_0x94193e+0x1);if(_0x5b0587==='')throw new Error(_0x2eae9e(0x1b6)+_0x2a9a71+'.\x20Child\x20name\x20cannot\x20be\x20empty');return{'parentId':_0x265027,'childId':_0x5b0587};}
|