@treasuredata/tdx 2026.3.14 → 2026.3.16
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/README.md +9 -0
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +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.js +1 -1
- package/dist/commands/auth-login-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/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.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +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.js +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.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/oauth-keychain.js +1 -1
- package/dist/core/oauth.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/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/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.js +1 -1
- 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.js +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 +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a139_0x12aeb5=a139_0x246b;(function(_0x24f34b,_0x14b32e){const _0x244390=a139_0x246b,_0x1159cb=_0x24f34b();while(!![]){try{const _0x4d4f72=-parseInt(_0x244390(0x1dd))/0x1*(-parseInt(_0x244390(0x1dc))/0x2)+parseInt(_0x244390(0x1d8))/0x3+-parseInt(_0x244390(0x1e8))/0x4+parseInt(_0x244390(0x1db))/0x5*(parseInt(_0x244390(0x1e4))/0x6)+parseInt(_0x244390(0x1e0))/0x7*(-parseInt(_0x244390(0x1de))/0x8)+parseInt(_0x244390(0x1eb))/0x9+parseInt(_0x244390(0x1df))/0xa*(-parseInt(_0x244390(0x1da))/0xb);if(_0x4d4f72===_0x14b32e)break;else _0x1159cb['push'](_0x1159cb['shift']());}catch(_0x4b190d){_0x1159cb['push'](_0x1159cb['shift']());}}}(a139_0x3ea7,0x1e254));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';function a139_0x246b(_0x4f8b08,_0x700032){_0x4f8b08=_0x4f8b08-0x1d7;const _0x3ea79e=a139_0x3ea7();let _0x246bf7=_0x3ea79e[_0x4f8b08];return _0x246bf7;}function a139_0x3ea7(){const _0x5f0302=['tdx.sdk.push-recovery','2189592qMvSBq','toISOString','dirname','Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','.tmp','segments','Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20','281163bXJGqq','utf-8','1745007hZrhoi','1066385vdWgNu','232870dqmsPT','1HMvGhk','166096RxnNxz','10ljgroe','77bSqFWw','stringify','ENOENT','journeyName','6PWTdtL','basename','string','debug','624904bNOoJh','warn'];a139_0x3ea7=function(){return _0x5f0302;};return a139_0x3ea7();}import a139_0x10281e from'path';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a139_0x12aeb5(0x1ea));export function getPushRecoveryPath(_0x218981){const _0x29d397=a139_0x12aeb5,_0x1d248c=a139_0x10281e[_0x29d397(0x1ed)](_0x218981),_0x2ad811=a139_0x10281e[_0x29d397(0x1e5)](_0x218981);return a139_0x10281e['join'](_0x1d248c,'.'+_0x2ad811+'.push-recovery.json');}export function readPushRecovery(_0x469148){const _0x138011=a139_0x12aeb5,_0x461027=getPushRecoveryPath(_0x469148);if(!existsSync(_0x461027))return undefined;try{const _0x1882b5=readFileSync(_0x461027,_0x138011(0x1d9)),_0x156ee4=JSON['parse'](_0x1882b5);if(_0x156ee4?.['version']!==0x1||typeof _0x156ee4[_0x138011(0x1e3)]!==_0x138011(0x1e6))return undefined;return _0x156ee4;}catch(_0x5543c0){return _0x5543c0 instanceof SyntaxError?logger[_0x138011(0x1e7)]('Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20'+_0x5543c0):logger[_0x138011(0x1e9)](_0x138011(0x1ee)+_0x5543c0),undefined;}}export function writePushRecovery(_0xcf6b70,_0x276a91){const _0x451e8d=a139_0x12aeb5,_0x5327a1=getPushRecoveryPath(_0xcf6b70),_0x517f91=_0x5327a1+_0x451e8d(0x1ef);writeFileSync(_0x517f91,JSON[_0x451e8d(0x1e1)](_0x276a91,null,0x2)+'\x0a',_0x451e8d(0x1d9)),renameSync(_0x517f91,_0x5327a1);}export function deletePushRecovery(_0xcf8da5){const _0x29e5cc=a139_0x12aeb5,_0x14d538=getPushRecoveryPath(_0xcf8da5);try{unlinkSync(_0x14d538);}catch(_0x3317cd){_0x3317cd['code']!==_0x29e5cc(0x1e2)&&logger[_0x29e5cc(0x1e7)](_0x29e5cc(0x1d7)+_0x3317cd);}}export function saveSegmentToPushRecovery(_0x794213,_0x439194,_0xbcaad,_0x5e2d53){const _0x55cbbd=a139_0x12aeb5,_0x21a224=readPushRecovery(_0x794213),_0x15af49=_0x21a224?.[_0x55cbbd(0x1e3)]===_0x439194?{..._0x21a224,'updatedAt':new Date()['toISOString']()}:{'version':0x1,'journeyName':_0x439194,'updatedAt':new Date()[_0x55cbbd(0x1ec)](),'segments':{}};_0x15af49[_0x55cbbd(0x1f0)][_0xbcaad]=_0x5e2d53,writePushRecovery(_0x794213,_0x15af49);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a140_0x164c64=a140_0x2294;(function(_0x2f05e8,_0x230f96){const _0x3c7f97=a140_0x2294,_0x47f860=_0x2f05e8();while(!![]){try{const _0x3b2160=-parseInt(_0x3c7f97(0x213))/0x1+-parseInt(_0x3c7f97(0x23a))/0x2*(parseInt(_0x3c7f97(0x2af))/0x3)+parseInt(_0x3c7f97(0x2a5))/0x4+parseInt(_0x3c7f97(0x20e))/0x5*(parseInt(_0x3c7f97(0x201))/0x6)+parseInt(_0x3c7f97(0x1c0))/0x7+parseInt(_0x3c7f97(0x2a9))/0x8*(-parseInt(_0x3c7f97(0x233))/0x9)+parseInt(_0x3c7f97(0x23e))/0xa*(parseInt(_0x3c7f97(0x21c))/0xb);if(_0x3b2160===_0x230f96)break;else _0x47f860['push'](_0x47f860['shift']());}catch(_0x29d798){_0x47f860['push'](_0x47f860['shift']());}}}(a140_0x1beb,0x47f8b));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a140_0x164c64(0x29f));export const PENDING_SEGMENT_PREFIX='__pending_';export const PENDING_ACTIVATION_PREFIX=a140_0x164c64(0x1cb);export function createPendingSegmentId(_0x22d490){return''+PENDING_SEGMENT_PREFIX+_0x22d490+'__';}export function isPendingSegmentId(_0x5ea5f5){const _0x5b408a=a140_0x164c64;return _0x5ea5f5[_0x5b408a(0x29d)](PENDING_SEGMENT_PREFIX)&&!_0x5ea5f5[_0x5b408a(0x29d)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x48f6a1){const _0x2b8cd=a140_0x164c64;return _0x48f6a1[_0x2b8cd(0x297)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x548b67){return''+PENDING_ACTIVATION_PREFIX+_0x548b67+'__';}export function isPendingActivationId(_0x57d6b8){const _0x2ef091=a140_0x164c64;return _0x57d6b8[_0x2ef091(0x29d)](PENDING_ACTIVATION_PREFIX);}function a140_0x2294(_0x20d1c9,_0x3f358d){_0x20d1c9=_0x20d1c9-0x1bb;const _0x1beb94=a140_0x1beb();let _0x229455=_0x1beb94[_0x20d1c9];return _0x229455;}export function extractPendingActivationName(_0x19e13a){const _0x530b1c=a140_0x164c64;return _0x19e13a[_0x530b1c(0x297)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x4762ac,_0x4de5f4){const _0x142828=a140_0x164c64,_0x213439=_0x4762ac+'::'+(_0x4de5f4['trim']()||_0x142828(0x1be)),_0x5d790e=createHash(_0x142828(0x259))[_0x142828(0x248)](_0x213439)['digest'](_0x142828(0x243))[_0x142828(0x2ad)](0x0,0xc);return _0x142828(0x236)+_0x5d790e;}export function ensureJourneyDefaults(_0x29bb0a){const _0x252c0e=a140_0x164c64;!_0x29bb0a[_0x252c0e(0x272)]&&(_0x29bb0a['description']=''),!_0x29bb0a['state']&&(_0x29bb0a[_0x252c0e(0x1eb)]=_0x252c0e(0x255));}export function injectExistingStageIds(_0x4e5819,_0x583b8b){const _0x1d67f7=a140_0x164c64,_0x27f1a8=new Map(_0x583b8b[_0x1d67f7(0x207)](_0x21a08d=>[_0x21a08d['name'],_0x21a08d['id']]));for(const _0x4fc8c3 of _0x4e5819){if(!_0x4fc8c3['id']){const _0x58bbfb=_0x27f1a8[_0x1d67f7(0x24d)](_0x4fc8c3[_0x1d67f7(0x1c9)]);_0x58bbfb&&(_0x4fc8c3['id']=_0x58bbfb);}}}export function resolveTDFolderPath(_0x386d99,_0x57c35d,_0x31f6e7){const _0x1c7618=a140_0x164c64;if(!_0x57c35d)return _0x386d99;if(_0x386d99===_0x31f6e7||_0x386d99[_0x1c7618(0x29d)](_0x31f6e7+'/'))return _0x386d99;return _0x386d99?_0x31f6e7+'/'+_0x386d99:_0x31f6e7;}export function addFoldersToCreate(_0x414dc0,_0x55cdc8,_0x3c8d4e){const _0x51b20d=a140_0x164c64;if(!_0x414dc0)return;if(_0x55cdc8['has'](_0x414dc0))return;const _0x5062bd=_0x414dc0[_0x51b20d(0x285)]('/');let _0x44c649='';for(const _0x11bb8f of _0x5062bd){_0x44c649=_0x44c649?_0x44c649+'/'+_0x11bb8f:_0x11bb8f,!_0x55cdc8[_0x51b20d(0x253)](_0x44c649)&&_0x3c8d4e[_0x51b20d(0x2a4)](_0x44c649);}}export function sortFoldersByDepth(_0x5bac1a){const _0x1ac303=a140_0x164c64;return[..._0x5bac1a][_0x1ac303(0x273)]((_0x594b1e,_0x2eb9a0)=>{const _0x4ce2e8=_0x1ac303,_0x1ca18b=(_0x594b1e['match'](/\//g)||[])[_0x4ce2e8(0x1e6)],_0x13df22=(_0x2eb9a0[_0x4ce2e8(0x26d)](/\//g)||[])[_0x4ce2e8(0x1e6)];return _0x1ca18b-_0x13df22;});}import*as a140_0x5b7330 from'yaml';import{readFileSync}from'fs';import a140_0x3e131c from'path';import{isJourneyDef,parseYamlString as a140_0x138f6e,toYamlString as a140_0x48c97f,normalizeJourneyDef,hasMultipleVersions,journeyResponseToDef,collectSegmentIdsFromJourneyApi}from'./journey-yaml.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,createJumpTargetCache,resolveJumpTarget,buildMergedJourneyDef,buildLocalRuleToNameMappingFromJourney,collectSegmentUsageCounts}from'./journey-utils.js';import{activationResponseToDef,segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,apiRuleToYaml,yamlRuleToApi,serializeExpandedRule,collectSegmentRefsFromRule,resolveRuleSegmentRefs,resolveRuleSegmentIds,journeyActivationStepToYaml}from'./child-segment-yaml.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{batchAsync}from'../../utils/async.js';import{buildFolderMaps}from'./resolution-context.js';import{SDKError,ErrorCode,isHttp400Error,getErrorMessage}from'../errors.js';import{readPushRecovery,saveSegmentToPushRecovery,deletePushRecovery}from'./push-recovery.js';import{validateSegmentDef,formatValidationResult}from'./yaml-validator.js';import{validateJourneyDef}from'./journey-validator.js';function stableStringify(_0x30a2a7){const _0x480e2d=a140_0x164c64;if(Array[_0x480e2d(0x24b)](_0x30a2a7))return'['+_0x30a2a7[_0x480e2d(0x207)](_0x516827=>stableStringify(_0x516827))[_0x480e2d(0x1ea)](',')+']';if(_0x30a2a7&&typeof _0x30a2a7==='object'){const _0x5a7107=_0x30a2a7,_0x11528f=Object[_0x480e2d(0x238)](_0x5a7107)[_0x480e2d(0x273)](),_0x4e1036=_0x11528f[_0x480e2d(0x207)](_0x4806c5=>'\x22'+_0x4806c5+'\x22:'+stableStringify(_0x5a7107[_0x4806c5]));return'{'+_0x4e1036[_0x480e2d(0x1ea)](',')+'}';}const _0x187b62=JSON[_0x480e2d(0x27b)](_0x30a2a7);return _0x187b62===undefined?_0x480e2d(0x1c8):_0x187b62;}function activationSignature(_0x22c67c){const _0x3c92b9=a140_0x164c64,_0x2e93b6={'connection':_0x22c67c[_0x3c92b9(0x262)],..._0x22c67c['all_columns']!==undefined&&{'all_columns':_0x22c67c['all_columns']},..._0x22c67c['columns']!==undefined&&{'columns':_0x22c67c['columns']},..._0x22c67c[_0x3c92b9(0x295)]!==undefined&&{'behavior':_0x22c67c[_0x3c92b9(0x295)]},..._0x22c67c[_0x3c92b9(0x268)]!==undefined&&{'schedule':_0x22c67c[_0x3c92b9(0x268)]},..._0x22c67c[_0x3c92b9(0x1fb)]!==undefined&&{'notification':_0x22c67c['notification']},..._0x22c67c[_0x3c92b9(0x21e)]!==undefined&&{'connector_config':_0x22c67c[_0x3c92b9(0x21e)]},..._0x22c67c[_0x3c92b9(0x2b2)]!==undefined&&{'activation_template_id':_0x22c67c[_0x3c92b9(0x2b2)]}};return stableStringify(_0x2e93b6);}async function fetchSegment(_0x2b3e31,_0x27eae3,_0x2c5d81,_0x313c63){const _0x5866c1=a140_0x164c64,_0x492c8e=_0x313c63?.['find'](_0x296d31=>_0x296d31['id']===_0x2c5d81);if(_0x492c8e)return _0x492c8e;try{return await _0x2b3e31[_0x5866c1(0x1be)][_0x5866c1(0x24e)](_0x27eae3,_0x2c5d81);}catch(_0x2172cd){logger[_0x5866c1(0x249)](_0x5866c1(0x2b5)+_0x2c5d81+',\x20falling\x20back\x20to\x20getSegmentEntity:\x20'+_0x2172cd);try{return await _0x2b3e31[_0x5866c1(0x1be)][_0x5866c1(0x2a6)](_0x2c5d81);}catch(_0x4e944d){return logger[_0x5866c1(0x249)](_0x5866c1(0x27f)+_0x2c5d81+':\x20'+_0x4e944d),null;}}}function recoverSegmentIdsFromPushRecovery(_0x409d2a,_0x1d0b12,_0x4fe27b){const _0x5b36b3=a140_0x164c64,_0x13d4a2=readPushRecovery(_0x409d2a[_0x5b36b3(0x1bb)]);if(_0x13d4a2?.[_0x5b36b3(0x1db)]===_0x409d2a[_0x5b36b3(0x221)][_0x5b36b3(0x1c9)])for(const [_0x5d502a,_0x3ae036]of Object['entries'](_0x13d4a2['segments'])){const _0x17b267=generateDeterministicJourneySegmentName(_0x409d2a[_0x5b36b3(0x221)]['name'],_0x5d502a);_0x3ae036[_0x5b36b3(0x208)]===_0x17b267&&(_0x1d0b12[_0x5b36b3(0x1cc)](_0x5d502a,_0x3ae036['segmentId']),_0x4fe27b[_0x5b36b3(0x1cc)](_0x5d502a,_0x3ae036['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x132ba0,_0x2dc294,_0x492d92,_0x12a472){const _0x319b14=a140_0x164c64;let _0x469b10;try{_0x469b10=await _0x132ba0[_0x319b14(0x1be)]['createJourneySegment']({'name':_0x492d92[_0x319b14(0x2ae)],'description':_0x492d92[_0x319b14(0x272)],'journeyId':_0x492d92['journeyId'],'rule':_0x12a472(_0x492d92[_0x319b14(0x2aa)],!![]),'countPopulation':!![],'parentFolderId':_0x492d92[_0x319b14(0x2ab)],'audienceId':_0x492d92[_0x319b14(0x20b)]});}catch(_0x312fe4){const _0x260c4e=_0x312fe4 instanceof Error&&_0x312fe4[_0x319b14(0x240)]['includes'](_0x319b14(0x293));if(_0x260c4e){const _0x49b6ae=readPushRecovery(_0x2dc294[_0x319b14(0x1bb)]),_0x5f06c2=_0x49b6ae?.['journeyName']===_0x2dc294['yamlConfig'][_0x319b14(0x1c9)]?_0x49b6ae[_0x319b14(0x23d)][_0x492d92[_0x319b14(0x21f)]]:undefined;if(_0x5f06c2?.[_0x319b14(0x208)]===_0x492d92[_0x319b14(0x2ae)])await _0x132ba0['segment'][_0x319b14(0x261)](_0x492d92[_0x319b14(0x20b)],_0x5f06c2[_0x319b14(0x279)],{'description':_0x492d92['description'],'rule':_0x12a472(_0x492d92[_0x319b14(0x2aa)],!![]),'countPopulation':!![]}),_0x469b10=_0x5f06c2['segmentId'];else throw new SDKError(ErrorCode[_0x319b14(0x1d0)],_0x319b14(0x1d9)+_0x492d92['localName']+_0x319b14(0x25d)+(_0x319b14(0x265)+_0x2dc294[_0x319b14(0x1bb)][_0x319b14(0x297)](/([^/]+)$/,_0x319b14(0x2b7))+')\x20')+_0x319b14(0x2a0),_0x312fe4);}else throw _0x312fe4;}return saveSegmentToPushRecovery(_0x2dc294[_0x319b14(0x1bb)],_0x2dc294[_0x319b14(0x221)][_0x319b14(0x1c9)],_0x492d92[_0x319b14(0x21f)],{'segmentId':_0x469b10,'uniqueServerName':_0x492d92['uniqueSegmentName'],'createdAt':new Date()[_0x319b14(0x292)]()}),_0x469b10;}export async function prepareSegmentFiles(_0x272b99,_0x45e695,_0x11f11f,_0x32353e,_0x37cdb2){const _0x1558f0=a140_0x164c64,{activationDefToCreateRequest:_0x10d51a}=await import(_0x1558f0(0x294)),_0x5aebb3=[],_0x448995=new Set();for(const {yamlConfig:_0xc22779,folderPath:_0x73e54b,sourcePath:_0x236b0b}of _0x272b99){const _0x4f348c=resolveTDFolderPath(_0x73e54b,_0x32353e,_0x37cdb2),_0x4215f1=_0x4f348c+':'+_0xc22779['name'],_0x1cd09f=_0x45e695[_0x1558f0(0x1ff)][_0x1558f0(0x24d)](_0x4215f1),_0x36c6aa=_0x1cd09f?_0x45e695[_0x1558f0(0x22e)][_0x1558f0(0x24d)](_0x1cd09f['id'])||[]:[];addFoldersToCreate(_0x4f348c,_0x45e695[_0x1558f0(0x1f1)],_0x448995);const _0x245e80=calculateActivationActions(_0xc22779['activations']||[],_0x36c6aa,_0x45e695['idToEmailMap'],_0x45e695['connectionIdToNameMap']);for(const _0xcd043 of _0x245e80){(_0xcd043[_0x1558f0(0x25e)]===_0x1558f0(0x1f4)||_0xcd043[_0x1558f0(0x25e)]===_0x1558f0(0x248))&&_0xcd043['yamlActivation']&&(_0xcd043[_0x1558f0(0x28f)]=await _0x10d51a(_0xcd043[_0x1558f0(0x206)],_0x11f11f));}const _0x43fbe3=calculateSegmentDiff(_0xc22779,_0x1cd09f,_0x36c6aa,_0x45e695[_0x1558f0(0x2b8)],_0x45e695[_0x1558f0(0x20a)]);_0x5aebb3[_0x1558f0(0x1e1)]({'relativePath':_0xc22779[_0x1558f0(0x1c9)],'absolutePath':_0x236b0b,'yamlConfig':_0xc22779,'folderPath':_0x4f348c,'existingSegment':_0x1cd09f,'existingActivations':_0x36c6aa,'isNew':_0x43fbe3['isNew'],'hasChanges':_0x43fbe3[_0x1558f0(0x1cd)],'diff':_0x43fbe3[_0x1558f0(0x251)],'activationActions':_0x245e80});}return{'segmentFiles':_0x5aebb3,'foldersToCreate':_0x448995};}export async function prepareJourneyFiles(_0x12d10f,_0x50cc5b,_0x1102d2,_0x27d1d9){const _0x565e14=a140_0x164c64,_0x42851b=[],_0x19350f=new Set();for(const {yamlConfig:_0x326e7d,folderPath:_0xb5b753,sourcePath:_0x1d5476}of _0x12d10f){const _0xcdb257=resolveTDFolderPath(_0xb5b753,_0x1102d2,_0x27d1d9),_0x3adc34=_0xcdb257+':'+_0x326e7d['name'],_0x2f99a8=_0x50cc5b[_0x565e14(0x2a8)]['get'](_0x3adc34);let _0x1a44c5,_0x2bcd7c;if(_0x2f99a8&&_0x2f99a8[_0x565e14(0x1e6)]>0x0){const _0x18b21c=buildLocalExpandedRuleMappings(_0x326e7d),{createYamlContext:_0x29a71c,prefetchJourneySegments:_0x386990}=createPushYamlContextForBundle(_0x50cc5b[_0x565e14(0x267)],_0x50cc5b['parentId'],_0x50cc5b['existingSegments'],_0x18b21c,_0x50cc5b[_0x565e14(0x2b8)],_0x50cc5b[_0x565e14(0x20a)],_0x50cc5b[_0x565e14(0x252)],_0x50cc5b['journeyById']);await _0x386990(_0x2f99a8[_0x565e14(0x207)](_0x4ebf5a=>_0x4ebf5a['id']));const _0x15372e=await _0x50cc5b[_0x565e14(0x267)]['journey'][_0x565e14(0x234)](_0x2f99a8[0x0][_0x565e14(0x269)]),_0x19b8e3=hasMultipleVersions(_0x326e7d),_0x10be58=async _0x24afd8=>{const _0xadf8f8=_0x565e14,_0x2031b0=_0x50cc5b[_0xadf8f8(0x2a7)]?.[_0xadf8f8(0x24d)](_0x24afd8);if(_0x2031b0)return _0x2031b0;return _0x50cc5b[_0xadf8f8(0x2c0)]({'journeyId':_0x24afd8,'journeyName':_0x326e7d[_0xadf8f8(0x1c9)],'isMultiVersion':_0x2f99a8[_0xadf8f8(0x1e6)]>0x1});};if(_0x19b8e3&&_0x2f99a8['length']>0x1){const _0x2f284a=[];for(const _0x29cd58 of _0x2f99a8){const _0x14a673=_0x29cd58[_0x565e14(0x2c2)]||0x1;_0x50cc5b[_0x565e14(0x250)]?.['update'](_0x565e14(0x276)+_0x326e7d['name']+'\x20v'+_0x14a673);const _0x430e8f=await _0x10be58(_0x29cd58['id']),_0x16f4bc=_0x29a71c(_0x29cd58['id']),_0x1b936d=await journeyResponseToDef(_0x430e8f,_0x16f4bc);_0x2f284a[_0x565e14(0x1e1)]({'item':_0x29cd58,'yaml':_0x1b936d});}const _0x2f0220=buildLocalRuleToNameMappingFromJourney(_0x326e7d);_0x2bcd7c=buildMergedJourneyDef(_0x2f284a,_0x2f0220,_0x15372e);const _0x5d063e=Math[_0x565e14(0x2c1)](..._0x2f284a[_0x565e14(0x207)](_0x31456c=>_0x31456c['item'][_0x565e14(0x2c2)]||0x0)),_0x19adea=_0x2f99a8[_0x565e14(0x271)](_0x1cdacf=>(_0x1cdacf[_0x565e14(0x2c2)]||0x0)===_0x5d063e);_0x19adea&&(_0x50cc5b[_0x565e14(0x250)]?.[_0x565e14(0x248)](_0x565e14(0x276)+_0x326e7d[_0x565e14(0x1c9)]+'\x20v'+_0x5d063e),_0x1a44c5=await _0x10be58(_0x19adea['id']));}else{const _0x1c1370=_0x2f99a8[_0x2f99a8[_0x565e14(0x1e6)]-0x1];_0x50cc5b[_0x565e14(0x250)]?.[_0x565e14(0x248)](_0x565e14(0x276)+_0x326e7d['name']),_0x1a44c5=await _0x10be58(_0x1c1370['id']);const _0x4125b1=_0x29a71c(_0x1c1370['id']),_0x5b7c6c=await journeyResponseToDef(_0x1a44c5,_0x4125b1),_0x4f03c1=buildLocalRuleToNameMappingFromJourney(_0x326e7d);_0x2bcd7c=buildMergedJourneyDef([{'item':_0x1c1370,'yaml':_0x5b7c6c}],_0x4f03c1,_0x15372e);}}addFoldersToCreate(_0xcdb257,_0x50cc5b['folderPathToId'],_0x19350f);const _0x454852=calculateJourneyDiff(_0x326e7d,_0x2bcd7c);_0x42851b['push']({'relativePath':_0x326e7d[_0x565e14(0x1c9)],'absolutePath':_0x1d5476,'yamlConfig':_0x326e7d,'folderPath':_0xcdb257,'existingJourney':_0x1a44c5,'isNew':_0x454852[_0x565e14(0x1da)],'hasChanges':_0x454852[_0x565e14(0x1cd)],'diff':_0x454852[_0x565e14(0x251)]});}return{'journeyFiles':_0x42851b,'foldersToCreate':_0x19350f};}export function calculateActivationActions(_0x13ee90,_0x40f06f,_0x12e8e0,_0x51e9c0){const _0x7b5d86=a140_0x164c64,_0x1a7ff2=[],_0x3f02e6=new Map();for(const _0x1e62fb of _0x40f06f){_0x3f02e6[_0x7b5d86(0x1cc)](_0x1e62fb['name'],_0x1e62fb);}const _0x4fc3d6=new Map();for(const _0x3b2e56 of _0x13ee90){_0x4fc3d6['set'](_0x3b2e56['name'],_0x3b2e56);}for(const _0x129192 of _0x13ee90){const _0xb844d3=_0x3f02e6['get'](_0x129192[_0x7b5d86(0x1c9)]);if(!_0xb844d3)_0x1a7ff2[_0x7b5d86(0x1e1)]({'type':_0x7b5d86(0x1f4),'name':_0x129192[_0x7b5d86(0x1c9)],'yamlActivation':_0x129192});else{const _0x260efa=activationResponseToDef(_0xb844d3,_0x12e8e0,_0x51e9c0),_0x5947dc=a140_0x5b7330[_0x7b5d86(0x27b)](_0x260efa),_0x42d63c=a140_0x5b7330['stringify'](_0x129192);_0x5947dc!==_0x42d63c&&_0x1a7ff2[_0x7b5d86(0x1e1)]({'type':_0x7b5d86(0x248),'name':_0x129192[_0x7b5d86(0x1c9)],'yamlActivation':_0x129192,'existingActivation':_0xb844d3});}}for(const _0x5767a0 of _0x40f06f){!_0x4fc3d6['has'](_0x5767a0[_0x7b5d86(0x1c9)])&&_0x1a7ff2[_0x7b5d86(0x1e1)]({'type':_0x7b5d86(0x1f2),'name':_0x5767a0[_0x7b5d86(0x1c9)],'existingActivation':_0x5767a0});}return _0x1a7ff2;}function calculateYamlDiff(_0x4c6ce0,_0x45f3db){if(_0x45f3db){const _0x5a7068=generateDiff(_0x45f3db,_0x4c6ce0),_0x39f9f2=hasChanges(_0x5a7068);return{'isNew':![],'hasChanges':_0x39f9f2,'diff':_0x39f9f2?formatDiffWithColors(_0x5a7068):undefined};}const _0x227abc=generateDiff('',_0x4c6ce0);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x227abc)};}export function calculateSegmentDiff(_0x1efd42,_0x5cb51a,_0x241e88,_0x280202,_0x2b6292){const _0x2eb10f=segmentToYamlString(_0x1efd42),_0x5508cc=_0x5cb51a?segmentToYamlString(segmentWithActivationsToYaml(_0x5cb51a,_0x241e88,undefined,_0x280202,_0x2b6292)):undefined;return calculateYamlDiff(_0x2eb10f,_0x5508cc);}export function calculateJourneyDiff(_0x250ac8,_0x52dbaa){const _0x664a91=normalizeJourneyDef(_0x250ac8,_0x250ac8),_0x184066=a140_0x48c97f(_0x664a91),_0x31b81d=_0x52dbaa?a140_0x48c97f(normalizeJourneyDef(_0x52dbaa,_0x250ac8)):undefined;return calculateYamlDiff(_0x184066,_0x31b81d);}export function findSegmentsToDelete(_0x3d5414,_0x2eea7b,_0x4e4a48,_0x4a29f3,_0x126980){const _0x26b1f4=a140_0x164c64,_0x39e94e=new Set();for(const {yamlConfig:_0x173f06,folderPath:_0x2a28b5}of _0x2eea7b){_0x39e94e['add'](_0x2a28b5+':'+_0x173f06['name']);}return _0x3d5414[_0x26b1f4(0x204)](_0x2f2eea=>{const _0x360e9b=_0x26b1f4,_0x2ada8e=_0x2f2eea[_0x360e9b(0x1de)]?_0x4e4a48['get'](_0x2f2eea[_0x360e9b(0x1de)][_0x360e9b(0x1c4)]())||'':'',_0x176428=_0x2ada8e+':'+_0x2f2eea['name'];if(_0x39e94e[_0x360e9b(0x253)](_0x176428))return![];if(_0x126980)return _0x2ada8e===_0x4a29f3||_0x2ada8e[_0x360e9b(0x29d)](_0x4a29f3+'/');return!![];});}export function findJourneysToDelete(_0x53bddc,_0x855a81,_0xf5610f,_0x2dcb64,_0x212a6f){const _0xd1ec55=a140_0x164c64,_0x18a435=new Set();for(const {yamlConfig:_0x3ef29b,folderPath:_0x3a8904}of _0x855a81){_0x18a435[_0xd1ec55(0x2a4)](_0x3a8904+':'+_0x3ef29b[_0xd1ec55(0x1c9)]);}return _0x53bddc['filter'](_0x125517=>{const _0x34da35=_0xd1ec55,_0x39f060=_0x125517[_0x34da35(0x2ab)]?_0xf5610f['get'](_0x125517[_0x34da35(0x2ab)])||'':'',_0x4211b9=_0x39f060+':'+_0x125517[_0x34da35(0x225)];if(_0x18a435[_0x34da35(0x253)](_0x4211b9))return![];if(_0x212a6f)return _0x39f060===_0x2dcb64||_0x39f060['startsWith'](_0x2dcb64+'/');return!![];});}export function buildSegmentLookupMap(_0x228db6,_0x13d161){const _0x5b960f=a140_0x164c64,_0x139e17=new Map();for(const _0x5b3ed0 of _0x228db6){const _0x402ecb=_0x5b3ed0['segmentFolderId']?_0x13d161['get'](_0x5b3ed0[_0x5b960f(0x1de)]['toString']())||'':'',_0x52c5aa=_0x402ecb+':'+_0x5b3ed0[_0x5b960f(0x1c9)];_0x139e17[_0x5b960f(0x1cc)](_0x52c5aa,_0x5b3ed0);}return _0x139e17;}export function buildSegmentNameToIdMap(_0x2f89d4){const _0x29cc6d=a140_0x164c64,_0x1a25ad=new Map();for(const _0x4ff230 of _0x2f89d4){_0x1a25ad[_0x29cc6d(0x1cc)](_0x4ff230[_0x29cc6d(0x1c9)],_0x4ff230['id']);}return _0x1a25ad;}export function buildJourneyBundleLookupMap(_0x41e4a1,_0x49094f){const _0x407541=a140_0x164c64,_0x244721=new Map();for(const _0x56bed5 of _0x41e4a1){const _0x2bb0a2=_0x56bed5['folderId']?_0x49094f[_0x407541(0x24d)](_0x56bed5[_0x407541(0x2ab)])||'':'',_0x207cc4=_0x2bb0a2+':'+_0x56bed5[_0x407541(0x225)];!_0x244721[_0x407541(0x253)](_0x207cc4)&&_0x244721[_0x407541(0x1cc)](_0x207cc4,[]),_0x244721[_0x407541(0x24d)](_0x207cc4)[_0x407541(0x1e1)](_0x56bed5);}for(const _0x1e66f4 of _0x244721[_0x407541(0x1d6)]()){_0x1e66f4[_0x407541(0x273)]((_0x26033f,_0x1e1eec)=>(_0x26033f[_0x407541(0x2c2)]||0x0)-(_0x1e1eec[_0x407541(0x2c2)]||0x0));}return _0x244721;}function a140_0x1beb(){const _0x5f5296=['entry_criteria','isArray','withProgress','get','getSegment','entryCriteria','progress','diff','activationStepsById','has','data','draft','Segment\x20not\x20found','goal','effectiveFolderId','sha1','Updated\x20activation\x20\x27','createdSegmentId','resolveJourneyId','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','type','existingActivation','activation_updating','updateSegmentById','connection','journey_updating','Stage\x20\x27','Delete\x20the\x20push\x20recovery\x20file\x20(','segment_created','deps','schedule','journeyBundleId','\x20error(s)','steps','Failed\x20to\x20resolve\x20segment\x20','match','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','journeyActivationNameToId','conditionTimeoutUnit','find','description','sort','logDeleted','Failed\x20to\x20','Fetching\x20','folder','logInfo','segmentId','Creating\x20activation\x20\x27','stringify','):\x20','embedded_activation_creating','activation_creating','getSegmentEntity\x20also\x20failed\x20for\x20','\x27\x20wait\x20condition','activation_','\x27\x20from\x20file:\x20','JOURNEY_SYNTAX_ERROR','results','split','relationships','toLowerCase','valid','segment_deleting','dirname','\x20segment\x20from\x20file:\x20','stage\x20\x27','createActivation','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','validatedRequest','deleted','all','toISOString','Name\x20has\x20already\x20been\x20taken','./child-segment-yaml.js','behavior','deleteActivation','replace','\x27\x20exit\x20criteria','deleteSegment','journeyActivationStepId','\x27\x20entry\x20criteria','SEGMENT_SYNTAX_ERROR','startsWith','activations','tdx.sdk.push-workflow','and\x20the\x20server\x20segment,\x20then\x20retry.','with','run_after_journey_refresh','folder_creating','add','1470240mHFjtu','getSegmentEntity','journeyById','journeyBundlesByFolderAndName','5208AJSxwZ','resolvedRule','folderId','Updated\x20segment\x20\x27','slice','uniqueSegmentName','6987qltsTP','logSuccess','existingJourney','activation_template_id','getJourney','Updated\x20journey\x20\x27','getSegment\x20failed\x20for\x20','branches','.$1.push-recovery.json','idToEmailMap','conditionTimeoutDuration','activationParams','rootFolderId','activationContext','skipSegments','folder_created','day','fetchJourney','max','versionNumber','Deleting\x20activation\x20\x27','absolutePath','embedded_activation_created','Created\x20segment\x20\x27','segment','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','2854019kDSpmQ','Failed\x20to\x20fetch\x20referenced\x20segment\x20','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','journey','toString','Deleted\x20activation\x20\x27','milestone','\x20journey\x20from\x20file:\x20','null','name','Updating\x20activation\x20\x27','__pending_act_','set','hasChanges','entry','parentSegmentFolder','SEGMENT_UPDATE_ERROR','idToName','onProgress','WaitStep','segmentNameToId','some','values','INTERNAL','NOT_FOUND','Embedded\x20segment\x20\x27','isNew','journeyName','waitStep','relative','segmentFolderId','ACTIVATION_UPDATE_ERROR','journey_creating','push','list','\x27\x20by\x20rule\x20content','exitCriterias','verbose','length','\x20activation\x20\x27','./journey-yaml.js','attributes','join','state','listActivations','index','Segment\x20not\x20found:\x20','buildUserMaps','waitStepType','folderPathToId','delete','segment_updating','create','updated','journeyId','reduce','embedded_segment_creating','conditions','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','notification','action','Matched\x20server\x20segment\x20\x27','activation_created','segmentByFolderAndName','segment_deleted','114wIBlVP','conditionSegmentId','Creating\x20segment\x20\x27','filter','journeys','yamlActivation','map','uniqueServerName','\x0a\x20\x20','connectionIdToNameMap','parentId','parse','\x27...','89230zRYrBt','resolveSegment','rule','\x20(referenced\x20in\x20journey\x20','getActivation','374996AfGpqm','entries','parseDocument','from','../../utils/async.js','Condition','\x27\x20for\x20','existingSegment','\x27\x20decision\x20point\x20branch\x20\x27','2471392vHbsZb','DecisionPoint','connector_config','localName','segment_creating','yamlConfig','stages','Entry\x20criteria:\x20','goal\x20criteria','journeyBundleName','Activation\x20not\x20found:\x20','waitStepUnit','SEGMENT_NOT_FOUND','\x27\x20to\x20local\x20\x27','decision_point','Activation','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','embeddedSegmentNameToId','activationsBySegmentId','Journey\x20\x27','embedded_segment_created','size','unchanged','3231QqrqFB','getLatestJourneyId','Failed\x20to\x20resolve\x20activation\x20','journey_entry_criteria_','nameToId','keys','folderPath','374FqXaRk','created','journey_updated','segments','10gdRhCt','existingSegments','message','Duration','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','hex','utf-8','nameToType','errors','journeyStages','update','debug'];a140_0x1beb=function(){return _0x5f5296;};return a140_0x1beb();}export function collectFoldersToCreate(_0x244251,_0x35bc99){const _0x4e013b=a140_0x164c64,_0x22b0a8=new Set();for(const _0x21b5e6 of _0x244251){if(!_0x21b5e6)continue;if(_0x35bc99[_0x4e013b(0x253)](_0x21b5e6))continue;const _0x1c38e3=_0x21b5e6[_0x4e013b(0x285)]('/');let _0x13d9ed='';for(const _0x27ff82 of _0x1c38e3){_0x13d9ed=_0x13d9ed?_0x13d9ed+'/'+_0x27ff82:_0x27ff82,!_0x35bc99[_0x4e013b(0x253)](_0x13d9ed)&&_0x22b0a8[_0x4e013b(0x2a4)](_0x13d9ed);}}return _0x22b0a8;}export function parseAndClassifyYamlFiles(_0x473e0e,_0x17ae47,_0x2d2eaa){const _0x9665d4=a140_0x164c64,_0x3c18c2=[],_0x1735a6=[];for(const _0x2cb45c of _0x473e0e){const _0x39b99d=a140_0x3e131c[_0x9665d4(0x1dd)](_0x17ae47,a140_0x3e131c[_0x9665d4(0x28a)](_0x2cb45c)),_0x8ea561=_0x39b99d==='.'?'':_0x39b99d,_0xa2c3c=readFileSync(_0x2cb45c,_0x9665d4(0x244)),_0x302bcf=a140_0x5b7330[_0x9665d4(0x20c)](_0xa2c3c);if(isJourneyDef(_0x302bcf)){const _0x287d29=a140_0x138f6e(_0xa2c3c);_0x1735a6[_0x9665d4(0x1e1)]({'yamlConfig':_0x287d29,'folderPath':_0x8ea561,'sourcePath':_0x2cb45c});}else{if(!_0x2d2eaa?.[_0x9665d4(0x2bd)]){const _0x318b34=parseSegmentYamlFile(_0xa2c3c),_0x29d7bb=normalizeChildSegmentYaml(_0x318b34);_0x3c18c2[_0x9665d4(0x1e1)]({'yamlConfig':_0x29d7bb,'folderPath':_0x8ea561,'sourcePath':_0x2cb45c});}}}return{'segments':_0x3c18c2,'journeys':_0x1735a6};}export function validateParsedFiles(_0x566716,_0x3fb5f3){const _0x33711c=a140_0x164c64,_0x2d60d0=[];for(const {yamlConfig:_0x5e1595,sourcePath:_0xa739b}of _0x566716[_0x33711c(0x23d)]){const _0x116cbf=readFileSync(_0xa739b,_0x33711c(0x244)),_0xaf75c9=a140_0x5b7330['parseDocument'](_0x116cbf),_0x2d9967=validateSegmentDef(_0x5e1595,{'source':_0x116cbf,'document':_0xaf75c9},{'skipSchema':!![]});if(!_0x2d9967[_0x33711c(0x288)]){const _0xbcefe=a140_0x3e131c['relative'](_0x3fb5f3,_0xa739b);_0x2d60d0['push']({'filePath':_0xbcefe,'source':_0x116cbf,'result':_0x2d9967,'isJourney':![]});}}for(const {yamlConfig:_0x5c43b6,sourcePath:_0x179128}of _0x566716[_0x33711c(0x205)]){const _0x3b3506=readFileSync(_0x179128,_0x33711c(0x244)),_0x34af8d=a140_0x5b7330[_0x33711c(0x215)](_0x3b3506),_0x2d4d73=validateJourneyDef(_0x5c43b6,{'source':_0x3b3506,'document':_0x34af8d},{'skipSchema':!![]});if(!_0x2d4d73[_0x33711c(0x288)]){const _0x1447e5=a140_0x3e131c[_0x33711c(0x1dd)](_0x3fb5f3,_0x179128);_0x2d60d0[_0x33711c(0x1e1)]({'filePath':_0x1447e5,'source':_0x3b3506,'result':_0x2d4d73,'isJourney':!![]});}}return _0x2d60d0;}export function formatValidationErrors(_0x460025){const _0x19d118=a140_0x164c64,_0x31a508=[];for(const {filePath:_0x368fd0,source:_0x37f8a1,result:_0x17e1f8,isJourney:_0x5b471f}of _0x460025){const _0x474cca=_0x5b471f?_0x19d118(0x1c3):_0x19d118(0x1be);_0x31a508[_0x19d118(0x1e1)]('\x0a'+_0x368fd0+'\x20('+_0x474cca+_0x19d118(0x27c)+_0x17e1f8[_0x19d118(0x246)][_0x19d118(0x1e6)]+_0x19d118(0x26a)),_0x31a508[_0x19d118(0x1e1)](formatValidationResult(_0x17e1f8,_0x37f8a1,_0x368fd0));}return _0x31a508[_0x19d118(0x1ea)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x120cb4){const _0x1219bb=a140_0x164c64,_0x469c7b=new Set(),_0x976852=new Map(),_0x38e945=collectSegmentUsageCounts(_0x120cb4);if(_0x120cb4[_0x1219bb(0x23d)])for(const [_0x4634ef,_0x5f5d24]of Object[_0x1219bb(0x214)](_0x120cb4['segments'])){_0x469c7b[_0x1219bb(0x2a4)](_0x4634ef);if(_0x5f5d24[_0x1219bb(0x210)]){const _0x35a169=yamlRuleToApi(_0x5f5d24[_0x1219bb(0x210)]),_0x2cc2f2=apiRuleToYaml(_0x35a169);_0x976852[_0x1219bb(0x1cc)](_0x4634ef,_0x2cc2f2);}}const _0x36eb60=new Map();let _0x4936e6=0x0;for(const [_0x7585f3,_0x53e40a]of _0x976852){const _0x5b44b0=serializeExpandedRule(_0x53e40a,_0x976852),_0x3b6d74=_0x36eb60[_0x1219bb(0x24d)](_0x5b44b0)||[];_0x3b6d74['push']({'name':_0x7585f3,'index':_0x4936e6}),_0x36eb60[_0x1219bb(0x1cc)](_0x5b44b0,_0x3b6d74),_0x4936e6++;}const _0x4bb234=new Map();for(const [_0x5093f3,_0x590405]of _0x36eb60){const _0x6d365c=_0x590405[_0x1219bb(0x2ad)]()[_0x1219bb(0x273)]((_0x37d8de,_0x48a3ca)=>{const _0x226d9f=_0x1219bb,_0x12cdfc=_0x38e945['get'](_0x37d8de[_0x226d9f(0x1c9)])||0x0,_0x47be63=_0x38e945[_0x226d9f(0x24d)](_0x48a3ca[_0x226d9f(0x1c9)])||0x0;if(_0x12cdfc!==_0x47be63)return _0x47be63-_0x12cdfc;return _0x37d8de[_0x226d9f(0x1ed)]-_0x48a3ca['index'];})[_0x1219bb(0x207)](_0x1360be=>_0x1360be[_0x1219bb(0x1c9)]),_0x55313d=[];for(const _0x4546d5 of _0x6d365c){const _0x2e6ac6=_0x38e945['get'](_0x4546d5)||0x0,_0x12e72a=Math['max'](_0x2e6ac6,0x1);for(let _0x4322f1=0x0;_0x4322f1<_0x12e72a;_0x4322f1++){_0x55313d['push'](_0x4546d5);}}_0x4bb234['set'](_0x5093f3,_0x55313d);}return{'existingLocalSegmentNames':_0x469c7b,'localSegmentRules':_0x976852,'localExpandedRuleToNames':_0x4bb234};}export function createSegmentIdResolver(_0x4ff3f0,_0x4fec22){return async _0x17d7ec=>{const _0x27e8cd=a140_0x2294,_0x58016a=_0x4ff3f0['get'](_0x17d7ec);if(!_0x58016a)throw new SDKError(ErrorCode[_0x27e8cd(0x228)],_0x27e8cd(0x1ee)+_0x17d7ec+_0x27e8cd(0x1fa)+_0x4fec22+'\x27)');return _0x58016a;};}export function extractRootFolderId(_0x5cbec2){const _0x5dc993=a140_0x164c64;return _0x5cbec2[_0x5dc993(0x286)]?.[_0x5dc993(0x1cf)]?.[_0x5dc993(0x254)]?.['id']||_0x5cbec2[_0x5dc993(0x286)]?.['parentFolder']?.['data']?.['id'];}export function buildConnectionMaps(_0x16caaf){const _0xca33ba=a140_0x164c64,_0x56d7ff=new Map(),_0x5b580a=new Map(),_0x41eb9b=new Map();for(const _0x15d0b2 of _0x16caaf){_0x56d7ff[_0xca33ba(0x1cc)](_0x15d0b2[_0xca33ba(0x1c9)],parseInt(_0x15d0b2['id'],0xa)),_0x5b580a[_0xca33ba(0x1cc)](_0x15d0b2['id'],_0x15d0b2[_0xca33ba(0x1c9)]),_0x41eb9b[_0xca33ba(0x1cc)](_0x15d0b2[_0xca33ba(0x1c9)],_0x15d0b2['type']);}return{'nameToId':_0x56d7ff,'idToName':_0x5b580a,'nameToType':_0x41eb9b};}export function calculatePushStats(_0x4686d7,_0xe05afc,_0x212c62,_0x4b229c,_0x5bde1f,_0x57935f,_0x889b86){const _0x64881f=a140_0x164c64,_0x58b2ba=_0x4686d7[_0x64881f(0x204)](_0x325718=>_0x325718[_0x64881f(0x1da)]),_0x2c6338=_0x4686d7[_0x64881f(0x204)](_0x35af95=>!_0x35af95['isNew']&&_0x35af95[_0x64881f(0x1cd)]),_0x52120d=_0x4686d7[_0x64881f(0x204)](_0x376a81=>!_0x376a81[_0x64881f(0x1da)]&&!_0x376a81[_0x64881f(0x1cd)]),_0x4f1bdf=_0x57935f?_0x4b229c:[],_0x103375=_0xe05afc[_0x64881f(0x204)](_0x597c73=>_0x597c73[_0x64881f(0x1da)]),_0x26672e=_0xe05afc[_0x64881f(0x204)](_0x2f615d=>!_0x2f615d[_0x64881f(0x1da)]&&_0x2f615d[_0x64881f(0x1cd)]),_0x2f71ac=_0xe05afc[_0x64881f(0x204)](_0x31b7d8=>!_0x31b7d8['isNew']&&!_0x31b7d8[_0x64881f(0x1cd)]),_0x3e2a88=_0x57935f?_0x5bde1f:[],_0x496938=_0x4686d7['flatMap'](_0x59ef42=>_0x59ef42['activationActions']),_0x4e6005=_0x496938['filter'](_0x122d1e=>_0x122d1e[_0x64881f(0x25e)]===_0x64881f(0x1f4)),_0x4ed051=_0x496938[_0x64881f(0x204)](_0x5735ba=>_0x5735ba[_0x64881f(0x25e)]===_0x64881f(0x248)),_0x2c1c4b=_0x496938[_0x64881f(0x204)](_0x4b060b=>_0x4b060b[_0x64881f(0x25e)]===_0x64881f(0x1f2)),_0x230d24=Array['from'](_0x212c62)[_0x64881f(0x273)](),_0x4f6f0d=_0x889b86?![]:_0x58b2ba['length']>0x0||_0x2c6338[_0x64881f(0x1e6)]>0x0||_0x4f1bdf[_0x64881f(0x1e6)]>0x0,_0x43e074=_0x103375[_0x64881f(0x1e6)]>0x0||_0x26672e['length']>0x0||_0x3e2a88[_0x64881f(0x1e6)]>0x0,_0x4b7559=_0x889b86?![]:_0x496938[_0x64881f(0x1e6)]>0x0,_0x300db2=_0x230d24[_0x64881f(0x1e6)]>0x0;return{'segments':{'new':_0x58b2ba,'changed':_0x2c6338,'unchanged':_0x52120d,'toDelete':_0x4f1bdf},'journeys':{'new':_0x103375,'changed':_0x26672e,'unchanged':_0x2f71ac,'toDelete':_0x3e2a88},'activations':{'all':_0x496938,'toCreate':_0x4e6005,'toUpdate':_0x4ed051,'toDelete':_0x2c1c4b},'folders':{'toCreate':_0x230d24},'counts':{'segments':{'new':_0x58b2ba[_0x64881f(0x1e6)],'changed':_0x2c6338[_0x64881f(0x1e6)],'unchanged':_0x52120d['length'],'toDelete':_0x4f1bdf[_0x64881f(0x1e6)]},'journeys':{'new':_0x103375[_0x64881f(0x1e6)],'changed':_0x26672e[_0x64881f(0x1e6)],'unchanged':_0x2f71ac['length'],'toDelete':_0x3e2a88[_0x64881f(0x1e6)]},'activations':{'create':_0x4e6005['length'],'update':_0x4ed051[_0x64881f(0x1e6)],'delete':_0x2c1c4b[_0x64881f(0x1e6)]},'folders':_0x230d24['length']},'hasChanges':_0x4f6f0d||_0x43e074||_0x4b7559||_0x300db2};}export async function buildPushExecutionContext(_0x39f084,_0x2cbe96,_0x27d135,_0x4c1d9f,_0x5c96d5,_0x33b686){const _0x2c8c14=a140_0x164c64,_0x5aa0fe=extractRootFolderId(_0x27d135),{pathToId:_0x428628,idToPath:_0x1dec46}=buildFolderMaps(_0x5c96d5),_0x4f4170=buildSegmentNameToIdMap(_0x4c1d9f),_0x5e108d=new Map(),{batchAsync:_0x3e7199}=await import(_0x2c8c14(0x217)),[_0x5d3642,_0xa1b303]=await Promise[_0x2c8c14(0x291)]([_0x39f084['user'][_0x2c8c14(0x1ef)](),_0x39f084['connection'][_0x2c8c14(0x1e2)](),((async()=>{!_0x33b686&&_0x4c1d9f['length']>0x0&&await _0x3e7199(_0x4c1d9f,async _0x4d0b77=>{const _0x1a4f68=a140_0x2294,_0x27ef1e=await _0x39f084[_0x1a4f68(0x1be)][_0x1a4f68(0x1ec)](_0x2cbe96,_0x4d0b77['id']);_0x5e108d['set'](_0x4d0b77['id'],_0x27ef1e);});})())]),{emailToId:_0x4c2e32,idToEmail:_0x68d7b6}=_0x5d3642,_0x159877=buildConnectionMaps(_0xa1b303);return{'rootFolderId':_0x5aa0fe,'folderPathToId':_0x428628,'folderIdToPath':_0x1dec46,'segmentNameToId':_0x4f4170,'activationsBySegmentId':_0x5e108d,'emailToIdMap':_0x4c2e32,'idToEmailMap':_0x68d7b6,'connectionNameToIdMap':_0x159877[_0x2c8c14(0x237)],'connectionIdToNameMap':_0x159877[_0x2c8c14(0x1d1)],'connectionNameToTypeMap':_0x159877[_0x2c8c14(0x245)]};}export function createPushYamlContextForBundle(_0x4d2a07,_0x1d3963,_0x4bff36,_0x19f425,_0x498878,_0x23a565,_0x34c2ca,_0x222f26){const {existingLocalSegmentNames:_0x14bbfa,localExpandedRuleToNames:_0x46d578}=_0x19f425,_0x552684=new Set(),_0x22e651=new Map(),_0x4881bd=new Map(),_0x511ff0=new Map(),_0xf0c62c=createJumpTargetCache(),_0x257476=new Map(),_0x2a67b5=new Map(),_0x757c46=new Set();let _0x4c447f;const _0x3fad34=_0x391d41=>{const _0xaf042e={'resolveSegment':async _0x550ad6=>{const _0x3d2a0e=a140_0x2294,_0xd45dec=_0x511ff0[_0x3d2a0e(0x24d)](_0x550ad6);if(_0xd45dec!==undefined)return{'name':_0xd45dec,'isJourneyLocal':!![]};try{const _0x5d6e9d=await fetchSegment(_0x4d2a07,_0x1d3963,_0x550ad6,_0x4bff36);if(!_0x5d6e9d)throw new Error(_0x3d2a0e(0x256));const _0x3bebfe=generateJourneyLocalName(_0x5d6e9d[_0x3d2a0e(0x1c9)]),_0x4c0b2f=_0x5d6e9d['kind']===SEGMENT_KIND_JOURNEY&&_0x3bebfe!==undefined;let _0xb973f7=_0x5d6e9d[_0x3d2a0e(0x1c9)],_0x30036c;if(_0x4c0b2f&&_0x5d6e9d[_0x3d2a0e(0x210)]){const _0xc8cefd=apiRuleToYaml(_0x5d6e9d['rule']);_0x2a67b5['set'](_0x550ad6,_0xc8cefd);const _0x4063a1=async _0x142f75=>{const _0x3f687f=_0x3d2a0e,_0x277543=collectSegmentRefsFromRule(_0x142f75);for(const _0x322658 of _0x277543){if(!_0x2a67b5[_0x3f687f(0x253)](_0x322658))try{const _0x1ce0ad=await fetchSegment(_0x4d2a07,_0x1d3963,_0x322658,_0x4bff36);if(_0x1ce0ad?.[_0x3f687f(0x210)]){const _0x126660=apiRuleToYaml(_0x1ce0ad[_0x3f687f(0x210)]);_0x2a67b5['set'](_0x322658,_0x126660),await _0x4063a1(_0x126660);}}catch(_0x55f8f5){logger[_0x3f687f(0x249)](_0x3f687f(0x1c1)+_0x322658+':\x20'+_0x55f8f5);}}};await _0x4063a1(_0xc8cefd);const _0x4af1e5=serializeExpandedRule(_0xc8cefd,_0x2a67b5),_0x3627bc=_0x46d578[_0x3d2a0e(0x24d)](_0x4af1e5);if(_0x3627bc&&_0x3627bc['length']>0x0){const _0x748e69=_0x22e651[_0x3d2a0e(0x24d)](_0x4af1e5)||0x0,_0x4a109d=_0x3627bc[_0x748e69]||_0x3627bc[_0x3627bc['length']-0x1];_0x22e651[_0x3d2a0e(0x1cc)](_0x4af1e5,_0x748e69+0x1),_0xb973f7=_0x4a109d,_0x552684[_0x3d2a0e(0x2a4)](_0xb973f7),_0x511ff0[_0x3d2a0e(0x1cc)](_0x550ad6,_0xb973f7);const _0x4cf34c=await resolveRuleSegmentRefs(_0xc8cefd,async _0x4b007a=>{const _0xd201da=_0x3d2a0e,_0x1f2cac=_0x511ff0[_0xd201da(0x24d)](_0x4b007a);if(_0x1f2cac)return _0x1f2cac;const _0x3d1652=await _0x4c447f[_0xd201da(0x20f)](_0x4b007a);return _0x3d1652[_0xd201da(0x1c9)];});_0x30036c={'description':_0x5d6e9d[_0x3d2a0e(0x272)],'rule':_0x4cf34c};}else{const _0x392b52=_0x257476['get'](_0x4af1e5);if(_0x392b52)_0xb973f7=_0x392b52,_0x511ff0[_0x3d2a0e(0x1cc)](_0x550ad6,_0xb973f7);else{if(_0x3bebfe){let _0x205145=_0x3bebfe,_0x108c25=0x2;while(_0x552684['has'](_0x205145)||_0x14bbfa[_0x3d2a0e(0x253)](_0x205145)){_0x205145=_0x3bebfe+'_'+_0x108c25,_0x108c25++;}_0x552684[_0x3d2a0e(0x2a4)](_0x205145),_0xb973f7=_0x205145;}_0x511ff0[_0x3d2a0e(0x1cc)](_0x550ad6,_0xb973f7),_0x257476[_0x3d2a0e(0x1cc)](_0x4af1e5,_0xb973f7);const _0x11bb13=await resolveRuleSegmentRefs(_0xc8cefd,async _0x51d79b=>{const _0x102a46=_0x3d2a0e,_0x45ba6a=_0x511ff0[_0x102a46(0x24d)](_0x51d79b);if(_0x45ba6a)return _0x45ba6a;const _0x5ddc44=await _0x4c447f[_0x102a46(0x20f)](_0x51d79b);return _0x5ddc44[_0x102a46(0x1c9)];});_0x30036c={'description':_0x5d6e9d['description'],'rule':_0x11bb13};}}}return{'name':_0xb973f7,'isJourneyLocal':_0x4c0b2f,'definition':_0x30036c};}catch(_0x36544e){return logger[_0x3d2a0e(0x249)](_0x3d2a0e(0x26c)+_0x550ad6+':\x20'+_0x36544e),{'name':_0x550ad6,'isJourneyLocal':![]};}},'resolveActivation':async _0x27d5f1=>{const _0x3ed9ef=a140_0x2294,_0x171693=_0x4881bd['get'](_0x27d5f1);if(_0x171693!==undefined)return{'name':_0x171693,'isJourneyLocal':!![]};try{let _0x3c1e8b=_0x34c2ca?.[_0x3ed9ef(0x24d)](_0x27d5f1);!_0x3c1e8b&&(_0x3c1e8b=await _0x4d2a07[_0x3ed9ef(0x1c3)][_0x3ed9ef(0x212)](_0x391d41,_0x27d5f1));const _0xd45107=_0x3c1e8b[_0x3ed9ef(0x1e9)][_0x3ed9ef(0x2ba)]['name']||_0x27d5f1,_0x48bb3a=sanitizeYamlKey(_0xd45107)||_0x3ed9ef(0x281)+_0x27d5f1,_0x12ceaa=_0x48bb3a;_0x4881bd[_0x3ed9ef(0x1cc)](_0x27d5f1,_0x12ceaa);const _0xce9de3=journeyActivationStepToYaml(_0x3c1e8b,_0x498878,_0x23a565);return{'name':_0x12ceaa,'isJourneyLocal':!![],'definition':_0xce9de3};}catch(_0x5d0b54){return logger[_0x3ed9ef(0x249)](_0x3ed9ef(0x235)+_0x27d5f1+':\x20'+_0x5d0b54),{'name':_0x27d5f1,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x464a8f,_0x29a80a)=>resolveJumpTarget(_0x464a8f,_0x29a80a,_0xf0c62c,async _0x1e6ff0=>{const _0x48eb90=a140_0x2294,_0x4bf357=_0x222f26?.[_0x48eb90(0x24d)](_0x1e6ff0);if(_0x4bf357)return _0x4bf357;return _0x4d2a07[_0x48eb90(0x1c3)][_0x48eb90(0x2b3)](_0x1e6ff0);})};return _0x4c447f=_0xaf042e,_0xaf042e;},_0x5b3cb8=async _0x46ddd0=>{const _0x53ac98=a140_0x2294,{collectSegmentIdsFromJourneyApi:_0xa9b021}=await import(_0x53ac98(0x1e8)),{batchAsync:_0xca88a4}=await import(_0x53ac98(0x217)),_0x54d31b=new Set();for(const _0x2fc6f1 of _0x46ddd0){let _0x50ab63=_0x222f26?.[_0x53ac98(0x24d)](_0x2fc6f1);!_0x50ab63&&(_0x50ab63=await _0x4d2a07[_0x53ac98(0x1c3)][_0x53ac98(0x2b3)](_0x2fc6f1));const _0x5d2703=_0xa9b021(_0x50ab63);for(const _0x2da818 of _0x5d2703){_0x54d31b[_0x53ac98(0x2a4)](_0x2da818);}}let _0x20e864=Array[_0x53ac98(0x216)](_0x54d31b);while(_0x20e864['length']>0x0){const _0x2e50ae=_0x20e864['filter'](_0x5cea54=>!_0x757c46[_0x53ac98(0x253)](_0x5cea54));if(_0x2e50ae['length']===0x0)break;const _0x2f8d68=await _0xca88a4(_0x2e50ae,async _0x4bc3b7=>{const _0x46800e=_0x53ac98;_0x757c46[_0x46800e(0x2a4)](_0x4bc3b7);const _0x47e1c3=await fetchSegment(_0x4d2a07,_0x1d3963,_0x4bc3b7,_0x4bff36);if(!_0x47e1c3)return null;return{'segmentId':_0x4bc3b7,'segment':_0x47e1c3};},0xa),_0x3e7d7a=new Set();for(const _0x65216f of _0x2f8d68){if(!_0x65216f?.[_0x53ac98(0x1be)]?.[_0x53ac98(0x210)])continue;const _0x42bdc4=apiRuleToYaml(_0x65216f[_0x53ac98(0x1be)][_0x53ac98(0x210)]);_0x2a67b5['set'](_0x65216f[_0x53ac98(0x279)],_0x42bdc4);const _0x2ae422=collectSegmentRefsFromRule(_0x42bdc4);for(const _0x1478e6 of _0x2ae422){!_0x757c46[_0x53ac98(0x253)](_0x1478e6)&&_0x3e7d7a[_0x53ac98(0x2a4)](_0x1478e6);}}_0x20e864=Array['from'](_0x3e7d7a);}};return{'createYamlContext':_0x3fad34,'prefetchJourneySegments':_0x5b3cb8};}export async function executePushSegments(_0x3aee1b,_0x2866c8,_0x3c8e18,_0x3e7469,_0x19e8fd){const _0x54f2a7=a140_0x164c64,{segmentDefToCreateRequest:_0x4a2143,segmentDefToUpdateRequest:_0x308abd}=await import(_0x54f2a7(0x294)),_0x57db82=_0x3c8e18[_0x54f2a7(0x1f1)],_0x460b23=0x5,_0x38a5d1=async _0x12e3b5=>{const _0x48bbcb=_0x54f2a7,_0x587052=_0x12e3b5[_0x48bbcb(0x239)]?_0x57db82[_0x48bbcb(0x24d)](_0x12e3b5[_0x48bbcb(0x239)]):undefined;let _0x474edc;const _0x51f6b1={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0xc981cb=_0x12e3b5[_0x48bbcb(0x221)];if(_0x12e3b5['yamlConfig']['rule']){const _0x4792e0=createSegmentIdResolver(_0x3c8e18[_0x48bbcb(0x1d4)],_0x12e3b5[_0x48bbcb(0x221)][_0x48bbcb(0x1c9)]),_0x1c10c5=await resolveRuleSegmentIds(_0x12e3b5[_0x48bbcb(0x221)][_0x48bbcb(0x210)],_0x4792e0);_0xc981cb={..._0x12e3b5[_0x48bbcb(0x221)],'rule':_0x1c10c5};}try{if(_0x12e3b5[_0x48bbcb(0x1da)]){_0x19e8fd['onProgress']?.({'type':_0x48bbcb(0x220),'name':_0x12e3b5[_0x48bbcb(0x221)][_0x48bbcb(0x1c9)]});const _0x2510e7=_0x4a2143(_0xc981cb,_0x587052),_0x4d7e24=await _0x19e8fd[_0x48bbcb(0x24c)](_0x48bbcb(0x203)+_0x12e3b5[_0x48bbcb(0x221)][_0x48bbcb(0x1c9)]+_0x48bbcb(0x20d),()=>_0x3aee1b['segment']['createSegment'](_0x3e7469['parentId'],_0x2510e7));_0x474edc=_0x4d7e24[_0x48bbcb(0x254)]['id'],_0x3c8e18[_0x48bbcb(0x1d4)][_0x48bbcb(0x1cc)](_0x12e3b5[_0x48bbcb(0x221)][_0x48bbcb(0x1c9)],_0x474edc),_0x51f6b1['createdSegmentId']={'name':_0x12e3b5[_0x48bbcb(0x221)]['name'],'id':_0x474edc},_0x19e8fd[_0x48bbcb(0x1d2)]?.({'type':_0x48bbcb(0x266),'name':_0x12e3b5['yamlConfig']['name'],'segmentId':_0x474edc}),_0x19e8fd[_0x48bbcb(0x2b0)]?.(_0x48bbcb(0x1bd)+_0x12e3b5[_0x48bbcb(0x221)][_0x48bbcb(0x1c9)]+'\x27'),_0x51f6b1[_0x48bbcb(0x23b)]=0x1;}else{if(_0x12e3b5[_0x48bbcb(0x1cd)]){_0x19e8fd[_0x48bbcb(0x1d2)]?.({'type':_0x48bbcb(0x1f3),'name':_0x12e3b5[_0x48bbcb(0x221)][_0x48bbcb(0x1c9)]});const _0x1cc504=_0x308abd(_0xc981cb);_0x587052!==_0x12e3b5[_0x48bbcb(0x21a)]?.[_0x48bbcb(0x1de)]&&(_0x1cc504[_0x48bbcb(0x1de)]=_0x587052?parseInt(_0x587052,0xa):undefined),await _0x19e8fd[_0x48bbcb(0x24c)]('Updating\x20segment\x20\x27'+_0x12e3b5['yamlConfig']['name']+_0x48bbcb(0x20d),()=>_0x3aee1b['segment'][_0x48bbcb(0x261)](_0x3e7469[_0x48bbcb(0x20b)],_0x12e3b5[_0x48bbcb(0x21a)]['id'],_0x1cc504)),_0x474edc=_0x12e3b5[_0x48bbcb(0x21a)]['id'],_0x19e8fd[_0x48bbcb(0x1d2)]?.({'type':'segment_updated','name':_0x12e3b5[_0x48bbcb(0x221)][_0x48bbcb(0x1c9)]}),_0x19e8fd['logSuccess']?.(_0x48bbcb(0x2ac)+_0x12e3b5[_0x48bbcb(0x221)][_0x48bbcb(0x1c9)]+'\x27'),_0x51f6b1['updated']=0x1;}else _0x474edc=_0x12e3b5[_0x48bbcb(0x21a)]['id'];}}catch(_0x2b3a3d){const _0x61b722=isHttp400Error(_0x2b3a3d),_0x507053=_0x61b722?ErrorCode[_0x48bbcb(0x29c)]:ErrorCode[_0x48bbcb(0x1d0)],_0x54b617=getErrorMessage(_0x2b3a3d);throw new SDKError(_0x507053,_0x48bbcb(0x275)+(_0x12e3b5[_0x48bbcb(0x1da)]?_0x48bbcb(0x1f4):_0x48bbcb(0x248))+_0x48bbcb(0x28b)+_0x12e3b5[_0x48bbcb(0x1bb)]+'\x0a\x20\x20'+_0x54b617,_0x2b3a3d);}try{const _0x2f47eb=await syncActivationsForSegment(_0x3aee1b,_0x3e7469[_0x48bbcb(0x20b)],_0x474edc,_0x12e3b5['yamlConfig']['name'],_0x12e3b5['activationActions'],_0x19e8fd,_0x12e3b5['absolutePath']);_0x51f6b1[_0x48bbcb(0x29e)]=_0x2f47eb;}catch(_0x4531ba){if(_0x4531ba instanceof SDKError)throw _0x4531ba;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x48bbcb(0x28e)+_0x12e3b5[_0x48bbcb(0x221)][_0x48bbcb(0x1c9)]+'\x27\x20from\x20file:\x20'+_0x12e3b5[_0x48bbcb(0x1bb)]+'\x0a\x20\x20'+getErrorMessage(_0x4531ba),_0x4531ba);}return _0x51f6b1;},_0x66dfcf=await batchAsync(_0x2866c8,_0x38a5d1,_0x460b23),_0x1b1250={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0xe499b1 of _0x66dfcf){_0x1b1250['created']+=_0xe499b1['created'],_0x1b1250[_0x54f2a7(0x1f5)]+=_0xe499b1[_0x54f2a7(0x1f5)],_0xe499b1['createdSegmentId']&&_0x1b1250['createdSegmentIds'][_0x54f2a7(0x1cc)](_0xe499b1['createdSegmentId'][_0x54f2a7(0x1c9)],_0xe499b1[_0x54f2a7(0x25b)]['id']),_0x1b1250['activations'][_0x54f2a7(0x23b)]+=_0xe499b1[_0x54f2a7(0x29e)]['created'],_0x1b1250[_0x54f2a7(0x29e)]['updated']+=_0xe499b1[_0x54f2a7(0x29e)][_0x54f2a7(0x1f5)],_0x1b1250['activations'][_0x54f2a7(0x290)]+=_0xe499b1[_0x54f2a7(0x29e)][_0x54f2a7(0x290)];}return _0x1b1250;}async function syncActivationsForSegment(_0x5becd2,_0x379ab0,_0x1f914f,_0x26510f,_0x2042d9,_0x311069,_0x1ab2f3){const _0x31bd34=a140_0x164c64,_0x404c40={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x17003d of _0x2042d9){try{if(_0x17003d['type']==='create'&&_0x17003d[_0x31bd34(0x28f)])_0x311069[_0x31bd34(0x1d2)]?.({'type':_0x31bd34(0x27e),'segmentName':_0x26510f,'activationName':_0x17003d['name']}),await _0x311069[_0x31bd34(0x24c)](_0x31bd34(0x27a)+_0x17003d[_0x31bd34(0x1c9)]+_0x31bd34(0x20d),()=>_0x5becd2[_0x31bd34(0x1be)]['createActivation'](_0x379ab0,_0x1f914f,_0x17003d['validatedRequest'])),_0x311069['onProgress']?.({'type':_0x31bd34(0x1fe),'segmentName':_0x26510f,'activationName':_0x17003d[_0x31bd34(0x1c9)]}),_0x311069[_0x31bd34(0x2b0)]?.('Created\x20activation\x20\x27'+_0x17003d['name']+'\x27'),_0x404c40['created']++;else{if(_0x17003d[_0x31bd34(0x25e)]===_0x31bd34(0x248)&&_0x17003d[_0x31bd34(0x28f)]&&_0x17003d[_0x31bd34(0x25f)])_0x311069['onProgress']?.({'type':_0x31bd34(0x260),'segmentName':_0x26510f,'activationName':_0x17003d[_0x31bd34(0x1c9)]}),await _0x311069[_0x31bd34(0x24c)](_0x31bd34(0x1ca)+_0x17003d[_0x31bd34(0x1c9)]+_0x31bd34(0x20d),()=>_0x5becd2[_0x31bd34(0x1be)]['updateActivation'](_0x379ab0,_0x1f914f,_0x17003d[_0x31bd34(0x25f)]['id'],_0x17003d[_0x31bd34(0x28f)])),_0x311069[_0x31bd34(0x1d2)]?.({'type':'activation_updated','segmentName':_0x26510f,'activationName':_0x17003d[_0x31bd34(0x1c9)]}),_0x311069['logSuccess']?.(_0x31bd34(0x25a)+_0x17003d[_0x31bd34(0x1c9)]+'\x27'),_0x404c40['updated']++;else _0x17003d[_0x31bd34(0x25e)]===_0x31bd34(0x1f2)&&_0x17003d['existingActivation']&&(_0x311069[_0x31bd34(0x1d2)]?.({'type':'activation_deleting','segmentName':_0x26510f,'activationName':_0x17003d['name']}),await _0x311069['withProgress'](_0x31bd34(0x2c3)+_0x17003d[_0x31bd34(0x1c9)]+'\x27...',()=>_0x5becd2[_0x31bd34(0x1be)][_0x31bd34(0x296)](_0x379ab0,_0x1f914f,_0x17003d[_0x31bd34(0x25f)]['id'])),_0x311069[_0x31bd34(0x1d2)]?.({'type':'activation_deleted','segmentName':_0x26510f,'activationName':_0x17003d[_0x31bd34(0x1c9)]}),_0x311069[_0x31bd34(0x274)]?.(_0x31bd34(0x1c5)+_0x17003d[_0x31bd34(0x1c9)]+'\x27'),_0x404c40['deleted']++);}}catch(_0x2e8ba0){const _0x4e6092=isHttp400Error(_0x2e8ba0),_0x17da9f=_0x4e6092?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0x31bd34(0x1df)],_0x476ad6=getErrorMessage(_0x2e8ba0);throw new SDKError(_0x17da9f,_0x31bd34(0x275)+_0x17003d['type']+_0x31bd34(0x1e7)+_0x17003d['name']+_0x31bd34(0x282)+_0x1ab2f3+_0x31bd34(0x209)+_0x476ad6,_0x2e8ba0);}}return _0x404c40;}export async function executePushFolders(_0x55d353,_0x5f3090,_0x2c8d6d,_0x33944f,_0x265f6d){const _0x3a7758=a140_0x164c64,_0x3e112d=new Map(_0x2c8d6d),_0x30ff0e=sortFoldersByDepth(_0x5f3090);for(const _0x38d02e of _0x30ff0e){const _0x4a3fff=_0x38d02e[_0x3a7758(0x285)]('/'),_0x176087=_0x4a3fff[_0x4a3fff['length']-0x1],_0x5e0c07=_0x4a3fff['slice'](0x0,-0x1)['join']('/'),_0x42b004=_0x3e112d[_0x3a7758(0x24d)](_0x5e0c07);_0x265f6d[_0x3a7758(0x1d2)]?.({'type':_0x3a7758(0x2a3),'folder':_0x38d02e});const _0x279795={'name':_0x176087,'parentFolderId':_0x42b004},_0x305333=await _0x265f6d[_0x3a7758(0x24c)]('Creating\x20folder\x20\x27'+_0x38d02e+_0x3a7758(0x20d),()=>_0x55d353['segment']['createFolder'](_0x33944f['parentId'],_0x279795));_0x3e112d[_0x3a7758(0x1cc)](_0x38d02e,_0x305333[_0x3a7758(0x254)]['id']),_0x265f6d[_0x3a7758(0x1d2)]?.({'type':_0x3a7758(0x2be),'folder':_0x38d02e,'folderId':_0x305333[_0x3a7758(0x254)]['id']}),_0x265f6d[_0x3a7758(0x278)]?.('Created\x20folder\x20\x27'+_0x38d02e+'\x27');}return _0x3e112d;}export async function executePushSegmentDeletions(_0x524702,_0x5887f2,_0x2b7953){const _0x4c5d50=a140_0x164c64;if(_0x5887f2[_0x4c5d50(0x1e6)]===0x0)return 0x0;const {batchAsync:_0x1a9b2e}=await import('../../utils/async.js'),_0x4ac3db=0x5,_0x279027=await _0x1a9b2e(_0x5887f2,async _0x207d62=>{const _0x82ee18=_0x4c5d50;return _0x2b7953['onProgress']?.({'type':_0x82ee18(0x289),'name':_0x207d62[_0x82ee18(0x1c9)]}),await _0x524702[_0x82ee18(0x1be)][_0x82ee18(0x299)](_0x207d62['id']),_0x2b7953[_0x82ee18(0x1d2)]?.({'type':_0x82ee18(0x200),'name':_0x207d62[_0x82ee18(0x1c9)]}),_0x2b7953[_0x82ee18(0x274)]?.('Deleted\x20segment\x20\x27'+_0x207d62[_0x82ee18(0x1c9)]+'\x27'),0x1;},_0x4ac3db);return _0x279027[_0x4c5d50(0x1f7)]((_0x235d6a,_0x47bb70)=>_0x235d6a+_0x47bb70,0x0);}export async function executePushJourneys(_0x31115c,_0x34b3ed,_0x500fd2,_0x58f668,_0x1bbec6){const _0x8b584c=a140_0x164c64,{journeyDefToRequest:_0x1441e5}=await import(_0x8b584c(0x1e8)),{activationDefToCreateRequest:_0x1ce11f,yamlRuleToApi:_0x3ef54f,validateSegmentRule:_0x549d95}=await import('./child-segment-yaml.js'),_0x14ea79={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x22df12=new Map(_0x500fd2[_0x8b584c(0x1d4)]),_0x5bfd6b=0x5;for(let _0x345dfc=0x0;_0x345dfc<_0x34b3ed['length'];_0x345dfc+=_0x5bfd6b){const _0x16a28d=_0x34b3ed['slice'](_0x345dfc,_0x345dfc+_0x5bfd6b),_0x2b791a=await Promise[_0x8b584c(0x291)](_0x16a28d['map'](async _0x5a8827=>{const _0x4e2621=_0x8b584c;if(!_0x5a8827[_0x4e2621(0x1da)]&&!_0x5a8827[_0x4e2621(0x1cd)])return{'action':'unchanged','name':_0x5a8827[_0x4e2621(0x221)][_0x4e2621(0x1c9)],'journeyId':_0x5a8827[_0x4e2621(0x2b1)]?.['id']};const _0x222fcb=_0x5a8827[_0x4e2621(0x239)]?_0x500fd2['folderPathToId']['get'](_0x5a8827[_0x4e2621(0x239)]):undefined;_0x1bbec6[_0x4e2621(0x1d2)]?.({'type':_0x5a8827[_0x4e2621(0x1da)]?_0x4e2621(0x1e0):_0x4e2621(0x263),'name':_0x5a8827[_0x4e2621(0x221)][_0x4e2621(0x1c9)]});try{const _0x1c9745=await executeSingleJourneyPush(_0x31115c,_0x5a8827,{..._0x500fd2,'segmentNameToId':_0x22df12},{'parentId':_0x58f668[_0x4e2621(0x20b)],'rootFolderId':_0x58f668[_0x4e2621(0x2bb)],'folderId':_0x222fcb,'verbose':_0x58f668[_0x4e2621(0x1e5)]},_0x1bbec6,{'journeyDefToRequest':_0x1441e5,'activationDefToCreateRequest':_0x1ce11f,'yamlRuleToApi':_0x3ef54f,'validateSegmentRule':_0x549d95});for(const [_0x504910,_0x2954ce]of _0x1c9745[_0x4e2621(0x22d)]){_0x22df12[_0x4e2621(0x1cc)](_0x504910,_0x2954ce),_0x14ea79['embeddedSegmentNameToId'][_0x4e2621(0x1cc)](_0x504910,_0x2954ce);}if(_0x1c9745[_0x4e2621(0x1fc)]===_0x4e2621(0x23b))_0x1bbec6['onProgress']?.({'type':'journey_created','name':_0x5a8827['yamlConfig']['name'],'journeyId':_0x1c9745[_0x4e2621(0x1f6)]}),_0x1bbec6[_0x4e2621(0x2b0)]?.('Created\x20journey\x20\x27'+_0x5a8827[_0x4e2621(0x221)][_0x4e2621(0x1c9)]+'\x27'),_0x14ea79['created']++;else _0x1c9745[_0x4e2621(0x1fc)]===_0x4e2621(0x1f5)&&(_0x1bbec6[_0x4e2621(0x1d2)]?.({'type':_0x4e2621(0x23c),'name':_0x5a8827[_0x4e2621(0x221)][_0x4e2621(0x1c9)]}),_0x1bbec6[_0x4e2621(0x2b0)]?.(_0x4e2621(0x2b4)+_0x5a8827[_0x4e2621(0x221)][_0x4e2621(0x1c9)]+'\x27'),_0x14ea79['updated']++);return{'action':_0x1c9745['action'],'name':_0x5a8827[_0x4e2621(0x221)][_0x4e2621(0x1c9)],'journeyId':_0x1c9745['journeyId']};}catch(_0x3d7a3b){const _0x28bc0f=isHttp400Error(_0x3d7a3b),_0x82e846=_0x28bc0f?ErrorCode[_0x4e2621(0x283)]:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x4e73a4=getErrorMessage(_0x3d7a3b);throw new SDKError(_0x82e846,_0x4e2621(0x275)+(_0x5a8827['isNew']?'create':_0x4e2621(0x248))+_0x4e2621(0x1c7)+_0x5a8827[_0x4e2621(0x1bb)]+_0x4e2621(0x209)+_0x4e73a4,_0x3d7a3b);}}));_0x14ea79[_0x8b584c(0x284)][_0x8b584c(0x1e1)](..._0x2b791a);}return _0x14ea79;}async function matchExistingJourneySegments(_0x25a151,_0x5a8a8d,_0x5f2931,_0x3a3461,_0x245156){const _0x641045=a140_0x164c64;if(!_0x5a8a8d[_0x641045(0x2b1)]||!_0x5a8a8d[_0x641045(0x221)][_0x641045(0x23d)])return;const _0x4e216d=new Map(),_0x164b86=new Set();for(const _0xaf5e0c of Object[_0x641045(0x238)](_0x5a8a8d[_0x641045(0x221)][_0x641045(0x23d)])){const _0xdb652c=generateDeterministicJourneySegmentName(_0x5a8a8d[_0x641045(0x221)][_0x641045(0x1c9)],_0xaf5e0c);_0x4e216d[_0x641045(0x1cc)](_0xdb652c,_0xaf5e0c),_0x164b86[_0x641045(0x2a4)](_0xaf5e0c);}const _0xebb6ea=[],_0x3071ce=collectSegmentIdsFromJourneyApi(_0x5a8a8d[_0x641045(0x2b1)]);for(const _0x5a1c49 of _0x3071ce){const _0x2f85dc=await fetchSegment(_0x25a151,_0x5f2931,_0x5a1c49,_0x3a3461);if(!_0x2f85dc?.[_0x641045(0x1c9)])continue;const _0x10d1bd=_0x4e216d[_0x641045(0x24d)](_0x2f85dc[_0x641045(0x1c9)]);_0x10d1bd?(_0x245156[_0x641045(0x1cc)](_0x10d1bd,_0x5a1c49),_0x164b86[_0x641045(0x1f2)](_0x10d1bd)):_0xebb6ea[_0x641045(0x1e1)]({'id':_0x5a1c49,'seg':_0x2f85dc});}if(_0x164b86[_0x641045(0x231)]>0x0&&_0xebb6ea[_0x641045(0x1e6)]>0x0){const {localExpandedRuleToNames:_0x2c7b8d}=buildLocalExpandedRuleMappings(_0x5a8a8d[_0x641045(0x221)]),_0x1fde4c=new Map();for(const {id:_0x4ec257,seg:_0xef9b73}of _0xebb6ea){if(_0xef9b73['rule']){const _0xabc8b3=apiRuleToYaml(_0xef9b73[_0x641045(0x210)]);_0x1fde4c[_0x641045(0x1cc)](_0x4ec257,_0xabc8b3);}}for(const {id:_0x44cdef,seg:_0x1ec45f}of _0xebb6ea){if(!_0x1ec45f[_0x641045(0x210)])continue;const _0x1388a2=_0x1fde4c[_0x641045(0x24d)](_0x44cdef);if(!_0x1388a2)continue;const _0x27dcc1=serializeExpandedRule(_0x1388a2,_0x1fde4c),_0x37ad28=_0x2c7b8d[_0x641045(0x24d)](_0x27dcc1);if(_0x37ad28){const _0x366e02=_0x37ad28['find'](_0x37f5ff=>_0x164b86[_0x641045(0x253)](_0x37f5ff));_0x366e02&&(_0x245156['set'](_0x366e02,_0x44cdef),_0x164b86[_0x641045(0x1f2)](_0x366e02),logger[_0x641045(0x249)](_0x641045(0x1fd)+_0x1ec45f[_0x641045(0x1c9)]+_0x641045(0x229)+_0x366e02+_0x641045(0x1e3)));}}}}async function executeSingleJourneyPush(_0x587ebe,_0x302ad6,_0x49590b,_0x29fec0,_0x464fea,_0x16a080){const _0x24c773=a140_0x164c64,{journeyDefToRequest:_0x16cb70,activationDefToCreateRequest:_0x58e9ce,yamlRuleToApi:_0x546d2e,validateSegmentRule:_0xd991c4}=_0x16a080,_0x5c9d7a=new Map(),_0x4a8191=new Map();recoverSegmentIdsFromPushRecovery(_0x302ad6,_0x5c9d7a,_0x49590b[_0x24c773(0x1d4)]);const _0x2e1cd9=new Map(),_0x2bc51e=new Map(),_0x7c2038=new Map();let _0x1409d1;const _0x18edb8=async()=>{const _0xb2d71=_0x24c773;if(_0x1409d1)return;_0x1409d1=new Map();if(!_0x302ad6[_0xb2d71(0x2b1)])return;const _0xe604ed=await _0x587ebe[_0xb2d71(0x1c3)]['listActivations'](_0x302ad6[_0xb2d71(0x2b1)]['id']);for(const _0x2064e9 of _0xe604ed){const _0x1d7c5a=journeyActivationStepToYaml(_0x2064e9,_0x49590b[_0xb2d71(0x2b8)],_0x49590b[_0xb2d71(0x20a)]),_0x331d3d=activationSignature(_0x1d7c5a);!_0x1409d1[_0xb2d71(0x253)](_0x331d3d)&&_0x1409d1[_0xb2d71(0x1cc)](_0x331d3d,_0x2064e9['id']),_0x1d7c5a['name']&&_0x4a8191[_0xb2d71(0x1cc)](_0x1d7c5a[_0xb2d71(0x1c9)],_0x2064e9['id']);}};await matchExistingJourneySegments(_0x587ebe,_0x302ad6,_0x29fec0[_0x24c773(0x20b)],_0x49590b[_0x24c773(0x23f)],_0x49590b[_0x24c773(0x1d4)]);const _0x59917f={'resolveSegmentId':async _0x1b3f32=>{const _0x338b24=_0x24c773,_0x931e6e=_0x49590b['segmentNameToId'][_0x338b24(0x24d)](_0x1b3f32);if(!_0x931e6e)throw new SDKError(ErrorCode[_0x338b24(0x228)],_0x338b24(0x1ee)+_0x1b3f32+_0x338b24(0x211)+_0x302ad6[_0x338b24(0x221)][_0x338b24(0x1c9)]+')');return _0x931e6e;},'resolveEmbeddedSegmentId':async(_0x27254c,_0x1e7e82)=>{const _0x3058c3=_0x24c773,_0x2d2fea=_0x49590b[_0x3058c3(0x1d4)][_0x3058c3(0x24d)](_0x27254c);if(_0x2d2fea)return _0x2d2fea;const _0x353668=_0x49590b['existingSegments'][_0x3058c3(0x271)](_0x3f7c2a=>_0x3f7c2a[_0x3058c3(0x1c9)]===_0x27254c);if(_0x353668)return _0x49590b[_0x3058c3(0x1d4)][_0x3058c3(0x1cc)](_0x27254c,_0x353668['id']),_0x353668['id'];if(_0x302ad6['isNew']){const {stageName:_0x178831,criteriaName:_0x540a57}=findSegmentCriteriaLocation(_0x302ad6[_0x3058c3(0x221)],_0x27254c);return _0xd991c4(_0x27254c,_0x1e7e82['rule']),_0x2bc51e['set'](_0x27254c,{'definition':_0x1e7e82,'stageName':_0x178831,'criteriaName':_0x540a57}),createPendingSegmentId(_0x27254c);}const _0x2a32d1=_0x302ad6[_0x3058c3(0x2b1)]?.['id'];if(!_0x2a32d1)throw new SDKError(ErrorCode['INTERNAL'],_0x3058c3(0x1bf));const _0xd32cae=_0x2e1cd9[_0x3058c3(0x24d)](_0x27254c);if(_0xd32cae)return _0xd32cae;const _0x254b1d=((async()=>{const _0x545d83=_0x3058c3;_0xd991c4(_0x27254c,_0x1e7e82['rule']);const _0xc6a83d=generateDeterministicJourneySegmentName(_0x302ad6[_0x545d83(0x221)][_0x545d83(0x1c9)],_0x27254c),_0x30bfd0=_0x49590b[_0x545d83(0x23f)][_0x545d83(0x271)](_0x8d6d9a=>_0x8d6d9a[_0x545d83(0x1c9)]===_0xc6a83d),_0x5f1cd1=createSegmentIdResolver(_0x49590b[_0x545d83(0x1d4)],_0x27254c),_0x31a44f=await resolveRuleSegmentIds(_0x1e7e82[_0x545d83(0x210)],_0x5f1cd1);let _0x26bddf;return _0x30bfd0?(await _0x587ebe[_0x545d83(0x1be)][_0x545d83(0x261)](_0x29fec0[_0x545d83(0x20b)],_0x30bfd0['id'],{'description':_0x1e7e82[_0x545d83(0x272)]||_0x545d83(0x223)+_0x27254c,'rule':_0x546d2e(_0x31a44f,!![]),'countPopulation':!![]}),_0x26bddf=_0x30bfd0['id'],saveSegmentToPushRecovery(_0x302ad6[_0x545d83(0x1bb)],_0x302ad6[_0x545d83(0x221)][_0x545d83(0x1c9)],_0x27254c,{'segmentId':_0x26bddf,'uniqueServerName':_0xc6a83d,'createdAt':new Date()[_0x545d83(0x292)]()})):_0x26bddf=await createOrRecoverEmbeddedSegment(_0x587ebe,_0x302ad6,{'localName':_0x27254c,'uniqueSegmentName':_0xc6a83d,'description':_0x1e7e82['description']||_0x545d83(0x223)+_0x27254c,'journeyId':_0x2a32d1,'resolvedRule':_0x31a44f,'parentId':_0x29fec0[_0x545d83(0x20b)],'folderId':_0x29fec0[_0x545d83(0x2bb)]||''},_0x546d2e),_0x49590b[_0x545d83(0x1d4)]['set'](_0x27254c,_0x26bddf),_0x5c9d7a[_0x545d83(0x1cc)](_0x27254c,_0x26bddf),_0x26bddf;})());_0x2e1cd9[_0x3058c3(0x1cc)](_0x27254c,_0x254b1d);try{return await _0x254b1d;}finally{_0x2e1cd9[_0x3058c3(0x1f2)](_0x27254c);}},'resolveActivationId':async _0x4563cf=>{const _0x3a714e=_0x24c773,_0x4785e0=_0x4a8191[_0x3a714e(0x24d)](_0x4563cf);if(_0x4785e0)return _0x4785e0;if(_0x302ad6[_0x3a714e(0x2b1)]){await _0x18edb8();const _0x442cc8=_0x4a8191[_0x3a714e(0x24d)](_0x4563cf);if(_0x442cc8)return _0x442cc8;}throw new SDKError(ErrorCode[_0x3a714e(0x1d8)],_0x3a714e(0x226)+_0x4563cf+_0x3a714e(0x211)+_0x302ad6[_0x3a714e(0x221)][_0x3a714e(0x1c9)]+').\x20'+_0x3a714e(0x26e));},'resolveEmbeddedActivationId':async(_0xc966f4,_0x14a42d)=>{const _0x510321=_0x24c773,_0x11b3ac=_0x4a8191[_0x510321(0x24d)](_0xc966f4);if(_0x11b3ac)return _0x11b3ac;if(_0x302ad6['isNew'])return _0x7c2038[_0x510321(0x1cc)](_0xc966f4,_0x14a42d),createPendingActivationId(_0xc966f4);if(_0x302ad6[_0x510321(0x2b1)]){await _0x18edb8();const _0x136b98=_0x4a8191[_0x510321(0x24d)](_0x14a42d['name']);if(_0x136b98)return _0x4a8191[_0x510321(0x1cc)](_0xc966f4,_0x136b98),_0x136b98;const _0x1de494=activationSignature(_0x14a42d),_0x544b8f=_0x1409d1?.[_0x510321(0x24d)](_0x1de494);if(_0x544b8f)return _0x4a8191[_0x510321(0x1cc)](_0xc966f4,_0x544b8f),_0x544b8f;const _0x3ffc3b=await _0x58e9ce(_0x14a42d,_0x49590b[_0x510321(0x2bc)]),_0x25e171={..._0x3ffc3b,..._0x14a42d[_0x510321(0x2a2)]!==undefined&&{'runAfterJourneyRefresh':_0x14a42d[_0x510321(0x2a2)]}},_0x82aab=await _0x587ebe[_0x510321(0x1c3)][_0x510321(0x28d)](_0x302ad6[_0x510321(0x2b1)]['id'],_0x25e171);return _0x4a8191[_0x510321(0x1cc)](_0xc966f4,_0x82aab['id']),_0x82aab['id'];}throw new SDKError(ErrorCode[_0x510321(0x1d7)],_0x510321(0x242));},'resolveJourneyId':async _0x213948=>{const _0x47bf4e=_0x24c773;try{return await _0x587ebe[_0x47bf4e(0x1c3)][_0x47bf4e(0x25c)](_0x29fec0[_0x47bf4e(0x20b)],_0x213948);}catch(_0x7a2c48){throw new SDKError(ErrorCode[_0x47bf4e(0x1d8)],_0x47bf4e(0x22f)+_0x213948+_0x47bf4e(0x1c2)+_0x302ad6[_0x47bf4e(0x221)][_0x47bf4e(0x1c9)]+'\x27)',_0x7a2c48);}},'resolveStageId':async(_0x549a97,_0x110b23)=>{const _0x566fd3=_0x24c773,_0x1b141c=await _0x587ebe['journey'][_0x566fd3(0x2b3)](_0x549a97),_0x505261=_0x1b141c[_0x566fd3(0x1e9)]['journeyStages']['find'](_0x3ede2d=>_0x3ede2d[_0x566fd3(0x1c9)][_0x566fd3(0x287)]()===_0x110b23[_0x566fd3(0x287)]());if(!_0x505261?.['id'])throw new SDKError(ErrorCode[_0x566fd3(0x1d8)],_0x566fd3(0x264)+_0x110b23+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x1b141c[_0x566fd3(0x1e9)][_0x566fd3(0x225)]||_0x1b141c[_0x566fd3(0x1e9)][_0x566fd3(0x1c9)])+'\x27');return _0x505261['id'];}},_0x15c539=await _0x16cb70(_0x302ad6[_0x24c773(0x221)],_0x29fec0['parentId'],_0x59917f),_0x41445d=_0x29fec0[_0x24c773(0x2ab)]||_0x29fec0['rootFolderId'];_0x41445d&&(_0x15c539[_0x24c773(0x286)]={'parentFolder':{'data':{'id':_0x41445d,'type':_0x24c773(0x277)}}});if(_0x302ad6[_0x24c773(0x1da)]){if(_0x2bc51e[_0x24c773(0x231)]>0x0||_0x7c2038[_0x24c773(0x231)]>0x0)return await executeThreeStepJourneyCreate(_0x587ebe,_0x302ad6,_0x15c539,{'pendingEmbeddedSegments':_0x2bc51e,'pendingEmbeddedActivations':_0x7c2038,'embeddedSegmentNameToId':_0x5c9d7a,'journeyActivationNameToId':_0x4a8191},{..._0x29fec0,'effectiveFolderId':_0x41445d},_0x49590b,_0x464fea,_0x16a080);else{ensureJourneyDefaults(_0x15c539[_0x24c773(0x1e9)]);const _0xaec86b=await _0x587ebe['journey'][_0x24c773(0x1f4)](_0x15c539);return deletePushRecovery(_0x302ad6[_0x24c773(0x1bb)]),{'action':_0x24c773(0x23b),'journeyId':_0xaec86b['id'],'embeddedSegmentNameToId':_0x5c9d7a};}}else{if(_0x302ad6[_0x24c773(0x1cd)]&&_0x302ad6[_0x24c773(0x2b1)]){_0x15c539['id']=_0x302ad6[_0x24c773(0x2b1)]['id'];const _0x2d865=_0x15c539[_0x24c773(0x1e9)];_0x302ad6[_0x24c773(0x2b1)][_0x24c773(0x1e9)]?.['journeyBundleName']&&(_0x2d865[_0x24c773(0x225)]=_0x302ad6['existingJourney'][_0x24c773(0x1e9)][_0x24c773(0x225)]);const _0x1a1268=_0x302ad6[_0x24c773(0x2b1)][_0x24c773(0x1e9)]?.[_0x24c773(0x247)];return _0x1a1268&&_0x15c539[_0x24c773(0x1e9)][_0x24c773(0x247)]&&injectExistingStageIds(_0x15c539[_0x24c773(0x1e9)][_0x24c773(0x247)],_0x1a1268),ensureJourneyDefaults(_0x2d865),await _0x587ebe[_0x24c773(0x1c3)][_0x24c773(0x248)](_0x302ad6[_0x24c773(0x2b1)]['id'],_0x15c539),deletePushRecovery(_0x302ad6[_0x24c773(0x1bb)]),{'action':_0x24c773(0x1f5),'journeyId':_0x302ad6[_0x24c773(0x2b1)]['id'],'embeddedSegmentNameToId':_0x5c9d7a};}}return deletePushRecovery(_0x302ad6['absolutePath']),{'action':_0x24c773(0x232),'journeyId':_0x302ad6[_0x24c773(0x2b1)]?.['id'],'embeddedSegmentNameToId':_0x5c9d7a};}function findSegmentCriteriaLocation(_0x289d1e,_0x3c5d7d){const _0x38bf4f=a140_0x164c64,_0x527b05=_0x289d1e[_0x38bf4f(0x222)]||_0x289d1e[_0x38bf4f(0x205)]?.[0x0]?.['stages']||[];let _0x294331=_0x38bf4f(0x1ce),_0x2bfcaa=_0x3c5d7d;const _0x589d80=_0x289d1e[_0x38bf4f(0x257)]||_0x289d1e['journeys']?.[0x0]?.[_0x38bf4f(0x257)];if(_0x589d80?.['segment']===_0x3c5d7d)return{'stageName':'goal','criteriaName':_0x589d80[_0x38bf4f(0x1c9)]||_0x3c5d7d};_0x2a2648:for(const _0x290cd4 of _0x527b05){if(_0x290cd4[_0x38bf4f(0x24a)]?.[_0x38bf4f(0x1be)]===_0x3c5d7d){_0x294331=_0x290cd4[_0x38bf4f(0x1c9)],_0x2bfcaa=_0x290cd4[_0x38bf4f(0x24a)]['name']||_0x3c5d7d;break;}if(_0x290cd4[_0x38bf4f(0x26b)])for(const _0x4b547c of _0x290cd4['steps']){if(_0x4b547c[_0x38bf4f(0x25e)]===_0x38bf4f(0x22a)&&_0x4b547c[_0x38bf4f(0x2a1)]?.[_0x38bf4f(0x2b6)])for(const _0x16e85c of _0x4b547c['with']['branches']){if(_0x16e85c[_0x38bf4f(0x1be)]===_0x3c5d7d){_0x294331=_0x290cd4[_0x38bf4f(0x1c9)],_0x2bfcaa=_0x16e85c[_0x38bf4f(0x1c9)]||_0x3c5d7d;break _0x2a2648;}}}}return{'stageName':_0x294331,'criteriaName':_0x2bfcaa};}async function executeThreeStepJourneyCreate(_0x4d449a,_0x446a59,_0x4731e0,_0x349992,_0x2ce902,_0xc0d4c5,_0x8efb7d,_0x5bf150){const _0x45f37a=a140_0x164c64,{activationDefToCreateRequest:_0x2c246c,yamlRuleToApi:_0x57f525}=_0x5bf150,{pendingEmbeddedSegments:_0x27c58f,pendingEmbeddedActivations:_0x28bb30,embeddedSegmentNameToId:_0x528d53}=_0x349992,_0x4f0c2b=JSON['parse'](JSON[_0x45f37a(0x27b)](_0x4731e0));ensureJourneyDefaults(_0x4f0c2b[_0x45f37a(0x1e9)]),stripPendingIds(_0x4f0c2b);const _0x1b4c0d=await _0x4d449a[_0x45f37a(0x1c3)][_0x45f37a(0x1f4)](_0x4f0c2b),_0x3253e9=_0x1b4c0d['id'],_0x3946ac=new Map();for(const _0x257860 of _0x1b4c0d[_0x45f37a(0x1e9)][_0x45f37a(0x247)]){_0x3946ac[_0x45f37a(0x1cc)](_0x257860[_0x45f37a(0x1c9)][_0x45f37a(0x287)](),_0x257860['id']);}recoverSegmentIdsFromPushRecovery(_0x446a59,_0x528d53,_0xc0d4c5[_0x45f37a(0x1d4)]);for(const [_0x209969,{definition:_0x11630e}]of _0x27c58f){if(_0x528d53['has'](_0x209969)){_0x8efb7d[_0x45f37a(0x1d2)]?.({'type':_0x45f37a(0x230),'journeyName':_0x446a59[_0x45f37a(0x221)]['name'],'segmentName':_0x209969});continue;}const _0x34e899=generateDeterministicJourneySegmentName(_0x446a59['yamlConfig'][_0x45f37a(0x1c9)],_0x209969);_0x8efb7d[_0x45f37a(0x1d2)]?.({'type':_0x45f37a(0x1f8),'journeyName':_0x446a59[_0x45f37a(0x221)][_0x45f37a(0x1c9)],'segmentName':_0x209969});const _0x5e92b0=createSegmentIdResolver(_0xc0d4c5[_0x45f37a(0x1d4)],_0x209969),_0x23bb04=await resolveRuleSegmentIds(_0x11630e['rule'],_0x5e92b0),_0x46f5f3=await createOrRecoverEmbeddedSegment(_0x4d449a,_0x446a59,{'localName':_0x209969,'uniqueSegmentName':_0x34e899,'description':_0x11630e[_0x45f37a(0x272)]||'Entry\x20criteria:\x20'+_0x209969,'journeyId':_0x3253e9,'resolvedRule':_0x23bb04,'parentId':_0x2ce902[_0x45f37a(0x20b)],'folderId':_0x2ce902[_0x45f37a(0x258)]||''},_0x57f525);_0x528d53[_0x45f37a(0x1cc)](_0x209969,_0x46f5f3),_0xc0d4c5['segmentNameToId'][_0x45f37a(0x1cc)](_0x209969,_0x46f5f3),_0x8efb7d['onProgress']?.({'type':_0x45f37a(0x230),'journeyName':_0x446a59[_0x45f37a(0x221)][_0x45f37a(0x1c9)],'segmentName':_0x209969});}const _0x38e409=new Map();for(const [_0x255120,_0x41c630]of _0x28bb30){_0x8efb7d[_0x45f37a(0x1d2)]?.({'type':_0x45f37a(0x27d),'journeyName':_0x446a59[_0x45f37a(0x221)][_0x45f37a(0x1c9)],'activationName':_0x255120});const _0x5e5542=await _0x2c246c(_0x41c630,_0xc0d4c5[_0x45f37a(0x2bc)]),_0x42324e={..._0x5e5542,..._0x41c630['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x41c630['run_after_journey_refresh']}},_0x55eef1=await _0x4d449a[_0x45f37a(0x1c3)][_0x45f37a(0x28d)](_0x3253e9,_0x42324e);_0x38e409[_0x45f37a(0x1cc)](_0x255120,_0x55eef1['id']),_0x349992[_0x45f37a(0x26f)][_0x45f37a(0x1cc)](_0x255120,_0x55eef1['id']),_0x8efb7d[_0x45f37a(0x1d2)]?.({'type':_0x45f37a(0x1bc),'journeyName':_0x446a59[_0x45f37a(0x221)][_0x45f37a(0x1c9)],'activationName':_0x255120});}const _0x5edf58=JSON[_0x45f37a(0x20c)](JSON[_0x45f37a(0x27b)](_0x4731e0));return _0x5edf58['id']=_0x3253e9,ensureJourneyDefaults(_0x5edf58['attributes']),resolvePendingIdsInRequest(_0x5edf58,_0x4731e0,_0x3946ac,_0x528d53,_0x38e409,_0x8efb7d),await _0x4d449a[_0x45f37a(0x1c3)][_0x45f37a(0x248)](_0x3253e9,_0x5edf58),deletePushRecovery(_0x446a59[_0x45f37a(0x1bb)]),{'action':_0x45f37a(0x23b),'journeyId':_0x3253e9,'embeddedSegmentNameToId':_0x528d53};}export function stripWaitStepPendingIds(_0x211c79){const _0x4be00d=a140_0x164c64,_0x57e97d=_0x211c79[_0x4be00d(0x202)]&&isPendingSegmentId(_0x211c79[_0x4be00d(0x202)]),_0x35c42c=_0x211c79['conditions']?.[_0x4be00d(0x1d5)](_0x40f440=>_0x40f440[_0x4be00d(0x279)]&&isPendingSegmentId(_0x40f440[_0x4be00d(0x279)]));(_0x57e97d||_0x35c42c)&&(_0x211c79[_0x4be00d(0x1f0)]=_0x4be00d(0x241),_0x211c79[_0x4be00d(0x1dc)]=0x1,_0x211c79['waitStepUnit']=_0x4be00d(0x2bf),delete _0x211c79[_0x4be00d(0x202)],delete _0x211c79[_0x4be00d(0x2b9)],delete _0x211c79['conditionTimeoutUnit'],delete _0x211c79[_0x4be00d(0x1f9)]);}export function resolveWaitStepPendingIds(_0x1dffb,_0xaa4df5,_0x1025a7,_0x16b434){const _0x51d753=a140_0x164c64;if(_0xaa4df5[_0x51d753(0x202)]&&isPendingSegmentId(_0xaa4df5['conditionSegmentId'])){const _0x33effb=_0x1025a7(_0xaa4df5[_0x51d753(0x202)],_0x51d753(0x28c)+_0x16b434+_0x51d753(0x280));_0x33effb&&(_0x1dffb[_0x51d753(0x1f0)]='Condition',_0x1dffb[_0x51d753(0x202)]=_0x33effb,delete _0x1dffb[_0x51d753(0x1dc)],delete _0x1dffb[_0x51d753(0x227)],_0xaa4df5[_0x51d753(0x2b9)]!==undefined&&(_0x1dffb[_0x51d753(0x2b9)]=_0xaa4df5[_0x51d753(0x2b9)]),_0xaa4df5['conditionTimeoutUnit']&&(_0x1dffb[_0x51d753(0x270)]=_0xaa4df5[_0x51d753(0x270)]));}if(_0xaa4df5[_0x51d753(0x1f9)]){const _0x1dd4d9=_0xaa4df5['conditions'][_0x51d753(0x1d5)](_0x25aa3b=>_0x25aa3b[_0x51d753(0x279)]&&isPendingSegmentId(_0x25aa3b[_0x51d753(0x279)]));if(_0x1dd4d9){const _0x1fa5c9=_0xaa4df5[_0x51d753(0x1f9)][_0x51d753(0x207)](_0x464336=>{const _0xc4c986=_0x51d753;if(_0x464336[_0xc4c986(0x279)]&&isPendingSegmentId(_0x464336['segmentId'])){const _0x573628=_0x1025a7(_0x464336[_0xc4c986(0x279)],'stage\x20\x27'+_0x16b434+_0xc4c986(0x280));return{..._0x464336,'segmentId':_0x573628||_0x464336[_0xc4c986(0x279)]};}return{..._0x464336};});_0x1dffb[_0x51d753(0x1f0)]=_0x51d753(0x218),_0x1dffb['conditions']=_0x1fa5c9,delete _0x1dffb[_0x51d753(0x1dc)],delete _0x1dffb[_0x51d753(0x227)],delete _0x1dffb['conditionSegmentId'],delete _0x1dffb[_0x51d753(0x2b9)],delete _0x1dffb[_0x51d753(0x270)];}}}function stripPendingIds(_0x286f11){const _0x27c6b1=a140_0x164c64;_0x286f11[_0x27c6b1(0x1e9)][_0x27c6b1(0x257)]?.[_0x27c6b1(0x279)]&&isPendingSegmentId(_0x286f11['attributes']['goal'][_0x27c6b1(0x279)])&&delete _0x286f11['attributes'][_0x27c6b1(0x257)];for(const _0x2a2361 of _0x286f11['attributes'][_0x27c6b1(0x247)]||[]){_0x2a2361[_0x27c6b1(0x24f)]?.[_0x27c6b1(0x279)]&&isPendingSegmentId(_0x2a2361[_0x27c6b1(0x24f)][_0x27c6b1(0x279)])&&delete _0x2a2361[_0x27c6b1(0x24f)];_0x2a2361[_0x27c6b1(0x1c6)]?.[_0x27c6b1(0x279)]&&isPendingSegmentId(_0x2a2361['milestone'][_0x27c6b1(0x279)])&&delete _0x2a2361['milestone'];_0x2a2361[_0x27c6b1(0x1e4)]&&(_0x2a2361[_0x27c6b1(0x1e4)]=_0x2a2361[_0x27c6b1(0x1e4)][_0x27c6b1(0x204)](_0x5d0f41=>!_0x5d0f41[_0x27c6b1(0x279)]||!isPendingSegmentId(_0x5d0f41[_0x27c6b1(0x279)])));if(_0x2a2361[_0x27c6b1(0x26b)])for(const _0x9e8b59 of Object[_0x27c6b1(0x238)](_0x2a2361['steps'])){const _0x21254b=_0x2a2361[_0x27c6b1(0x26b)][_0x9e8b59];_0x21254b[_0x27c6b1(0x25e)]===_0x27c6b1(0x22b)&&_0x21254b[_0x27c6b1(0x29a)]&&isPendingActivationId(_0x21254b['journeyActivationStepId'])&&(_0x21254b[_0x27c6b1(0x29a)]='');if(_0x21254b[_0x27c6b1(0x25e)]===_0x27c6b1(0x21d)&&_0x21254b[_0x27c6b1(0x2b6)])for(const _0x2b6d7f of _0x21254b[_0x27c6b1(0x2b6)]){_0x2b6d7f[_0x27c6b1(0x279)]&&isPendingSegmentId(_0x2b6d7f[_0x27c6b1(0x279)])&&(_0x2b6d7f['segmentId']='');}_0x21254b['type']==='WaitStep'&&stripWaitStepPendingIds(_0x21254b);}}}function resolvePendingIdsInRequest(_0x53426a,_0x3e28d1,_0xe121e8,_0xef9b04,_0x5d13cc,_0x3dcc66){const _0x3bbc34=a140_0x164c64,_0x567d99=(_0x179edd,_0x162c33)=>{const _0x3ab9a0=a140_0x2294;if(!isPendingSegmentId(_0x179edd))return _0x179edd;const _0x11a715=extractPendingSegmentName(_0x179edd),_0x56d271=_0xef9b04[_0x3ab9a0(0x24d)](_0x11a715);return!_0x56d271&&_0x3dcc66['logWarning']?.(_0x3ab9a0(0x22c)+_0x11a715+_0x3ab9a0(0x219)+_0x162c33),_0x56d271;};if(_0x53426a[_0x3bbc34(0x1e9)][_0x3bbc34(0x257)]?.[_0x3bbc34(0x279)]&&isPendingSegmentId(_0x53426a[_0x3bbc34(0x1e9)][_0x3bbc34(0x257)][_0x3bbc34(0x279)])){const _0x2ae460=_0x567d99(_0x53426a[_0x3bbc34(0x1e9)][_0x3bbc34(0x257)][_0x3bbc34(0x279)],_0x3bbc34(0x224));_0x2ae460&&(_0x53426a[_0x3bbc34(0x1e9)][_0x3bbc34(0x257)]['segmentId']=_0x2ae460);}for(const _0x1a3f00 of _0x53426a['attributes'][_0x3bbc34(0x247)]||[]){const _0x286152=_0xe121e8[_0x3bbc34(0x24d)](_0x1a3f00[_0x3bbc34(0x1c9)][_0x3bbc34(0x287)]());_0x286152&&(_0x1a3f00['id']=_0x286152);if(_0x1a3f00[_0x3bbc34(0x24f)]?.[_0x3bbc34(0x279)]&&isPendingSegmentId(_0x1a3f00[_0x3bbc34(0x24f)][_0x3bbc34(0x279)])){const _0x14d52e=_0x567d99(_0x1a3f00[_0x3bbc34(0x24f)][_0x3bbc34(0x279)],'stage\x20\x27'+_0x1a3f00[_0x3bbc34(0x1c9)]+_0x3bbc34(0x29b));_0x14d52e&&(_0x1a3f00[_0x3bbc34(0x24f)][_0x3bbc34(0x279)]=_0x14d52e);}if(_0x1a3f00['exitCriterias'])for(const _0x54043e of _0x1a3f00[_0x3bbc34(0x1e4)]){if(_0x54043e[_0x3bbc34(0x279)]&&isPendingSegmentId(_0x54043e['segmentId'])){const _0x5d6e4e=_0x567d99(_0x54043e['segmentId'],'stage\x20\x27'+_0x1a3f00['name']+_0x3bbc34(0x298));_0x5d6e4e&&(_0x54043e['segmentId']=_0x5d6e4e);}}if(_0x1a3f00[_0x3bbc34(0x1c6)]?.[_0x3bbc34(0x279)]&&isPendingSegmentId(_0x1a3f00[_0x3bbc34(0x1c6)][_0x3bbc34(0x279)])){const _0x1513e1=_0x567d99(_0x1a3f00[_0x3bbc34(0x1c6)][_0x3bbc34(0x279)],_0x3bbc34(0x28c)+_0x1a3f00['name']+'\x27\x20milestone');_0x1513e1&&(_0x1a3f00[_0x3bbc34(0x1c6)][_0x3bbc34(0x279)]=_0x1513e1);}if(_0x1a3f00[_0x3bbc34(0x26b)]){const _0xbbbf3c=_0x560155=>_0x3e28d1[_0x3bbc34(0x1e9)]['journeyStages']?.['find'](_0x3a7a8e=>_0x3a7a8e[_0x3bbc34(0x1c9)][_0x3bbc34(0x287)]()===_0x1a3f00[_0x3bbc34(0x1c9)]['toLowerCase']())?.['steps']?.[_0x560155];for(const _0x4a6a2c of Object['keys'](_0x1a3f00[_0x3bbc34(0x26b)])){const _0x431a3e=_0x1a3f00[_0x3bbc34(0x26b)][_0x4a6a2c],_0x11daed=_0xbbbf3c(_0x4a6a2c);if(_0x431a3e['type']==='Activation'&&_0x431a3e[_0x3bbc34(0x29a)]&&(isPendingActivationId(_0x431a3e['journeyActivationStepId'])||_0x431a3e[_0x3bbc34(0x29a)]==='')){if(_0x11daed?.[_0x3bbc34(0x29a)]&&isPendingActivationId(_0x11daed[_0x3bbc34(0x29a)])){const _0x368386=extractPendingActivationName(_0x11daed[_0x3bbc34(0x29a)]),_0x4b3c88=_0x5d13cc['get'](_0x368386);_0x4b3c88&&(_0x431a3e[_0x3bbc34(0x29a)]=_0x4b3c88);}}if(_0x431a3e['type']==='DecisionPoint'&&_0x431a3e[_0x3bbc34(0x2b6)]&&_0x11daed?.[_0x3bbc34(0x2b6)])for(let _0x5d525d=0x0;_0x5d525d<_0x431a3e['branches'][_0x3bbc34(0x1e6)];_0x5d525d++){const _0x4cdb83=_0x431a3e[_0x3bbc34(0x2b6)][_0x5d525d],_0x1ca288=_0x11daed[_0x3bbc34(0x2b6)][_0x5d525d];if(_0x1ca288?.[_0x3bbc34(0x279)]&&isPendingSegmentId(_0x1ca288[_0x3bbc34(0x279)])){const _0x5e87ac=_0x567d99(_0x1ca288[_0x3bbc34(0x279)],'stage\x20\x27'+_0x1a3f00['name']+_0x3bbc34(0x21b)+(_0x4cdb83[_0x3bbc34(0x1c9)]||_0x5d525d)+'\x27');_0x5e87ac&&(_0x4cdb83[_0x3bbc34(0x279)]=_0x5e87ac);}}_0x431a3e[_0x3bbc34(0x25e)]===_0x3bbc34(0x1d3)&&_0x11daed?.[_0x3bbc34(0x25e)]==='WaitStep'&&resolveWaitStepPendingIds(_0x431a3e,_0x11daed,_0x567d99,_0x1a3f00[_0x3bbc34(0x1c9)]);}}}}
|
|
1
|
+
const a140_0x2f0267=a140_0xd647;(function(_0x5914ba,_0xdab25c){const _0x21e664=a140_0xd647,_0x187ec7=_0x5914ba();while(!![]){try{const _0x3337b8=parseInt(_0x21e664(0x141))/0x1+-parseInt(_0x21e664(0x1a6))/0x2*(-parseInt(_0x21e664(0x169))/0x3)+parseInt(_0x21e664(0x122))/0x4+-parseInt(_0x21e664(0x129))/0x5*(parseInt(_0x21e664(0x176))/0x6)+-parseInt(_0x21e664(0x13c))/0x7+-parseInt(_0x21e664(0x187))/0x8+-parseInt(_0x21e664(0x18f))/0x9;if(_0x3337b8===_0xdab25c)break;else _0x187ec7['push'](_0x187ec7['shift']());}catch(_0x28582e){_0x187ec7['push'](_0x187ec7['shift']());}}}(a140_0x4706,0x53830));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a140_0x2f0267(0x126));export const PENDING_SEGMENT_PREFIX='__pending_';export const PENDING_ACTIVATION_PREFIX=a140_0x2f0267(0x16d);export function createPendingSegmentId(_0x43489b){return''+PENDING_SEGMENT_PREFIX+_0x43489b+'__';}export function isPendingSegmentId(_0x353fb9){const _0x1e6de4=a140_0x2f0267;return _0x353fb9[_0x1e6de4(0x1b6)](PENDING_SEGMENT_PREFIX)&&!_0x353fb9['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x29af04){const _0x1cbae3=a140_0x2f0267;return _0x29af04[_0x1cbae3(0x132)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x477b08){return''+PENDING_ACTIVATION_PREFIX+_0x477b08+'__';}export function isPendingActivationId(_0x465cf4){const _0x3cb080=a140_0x2f0267;return _0x465cf4[_0x3cb080(0x1b6)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0xfccd77){const _0x5b0279=a140_0x2f0267;return _0xfccd77[_0x5b0279(0x132)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x597d5d,_0x589f8a){const _0x131f22=a140_0x2f0267,_0x54c3e9=_0x597d5d+'::'+(_0x589f8a['trim']()||_0x131f22(0x1ac)),_0x2418cc=createHash(_0x131f22(0x142))[_0x131f22(0x127)](_0x54c3e9)[_0x131f22(0x104)]('hex')['slice'](0x0,0xc);return _0x131f22(0x11e)+_0x2418cc;}export function ensureJourneyDefaults(_0x19f007){const _0x12f534=a140_0x2f0267;!_0x19f007['description']&&(_0x19f007[_0x12f534(0x1c3)]=''),!_0x19f007[_0x12f534(0x177)]&&(_0x19f007[_0x12f534(0x177)]=_0x12f534(0x1e3));}function a140_0x4706(){const _0x289061=['104812cilOYO','segmentByFolderAndName','activation_deleted','data','toLowerCase','waitStep','segment','has','JOURNEY_UPDATE_ERROR','goal\x20criteria','ACTIVATION_UPDATE_ERROR','parentId','steps','\x0a\x20\x20','journeyBundleName','item','startsWith','versionNumber','waitStepType','hasChanges','segment_updating','activationStepsById','createFolder','with','logInfo','delete','ACTIVATION_SYNTAX_ERROR','branches','journey_created','description','debug','goal','folder_created','Created\x20folder\x20\x27','segment_deleted','null','all','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','embedded_segment_created','connector_config','\x27\x20by\x20rule\x20content','getActivation','Updated\x20journey\x20\x27','\x27\x20wait\x20condition','\x20(referenced\x20in\x20journey\x20','folder','segmentNameToId','Updated\x20segment\x20\x27','flatMap','conditionSegmentId','segments','folderId','activations','DecisionPoint','kind','effectiveFolderId','set','Segment\x20not\x20found','find','activationActions','waitStepUnit','draft','journeyStages','existingActivation','validatedRequest','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','run_after_journey_refresh','segmentFolderId','keys','exitCriterias','Failed\x20to\x20','activation_creating','fetchJourney','localName','entry','Fetching\x20','JOURNEY_SYNTAX_ERROR','rootFolderId','Embedded\x20segment\x20\x27','progress','Created\x20activation\x20\x27','Matched\x20server\x20segment\x20\x27','journeyName','embeddedSegmentNameToId','updated','values','journeys','../../utils/async.js','journeyBundlesByFolderAndName','deleted','create','folderPath','relationships','milestone','sort','createdSegmentId','resolvedRule','journeyById','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','withProgress','Stage\x20\x27','digest','\x27...',').\x20','SEGMENT_UPDATE_ERROR','rule','listActivations','index','size','NOT_FOUND','segment_updated','Deleted\x20activation\x20\x27','filter','getJourney','entries','\x27\x20for\x20','./journey-yaml.js','createJourneySegment','journey','yamlActivation','parentFolder','from','\x27\x20decision\x20point\x20branch\x20\x27','SEGMENT_SYNTAX_ERROR','idToEmailMap','updateSegmentById','isNew','journey_entry_criteria_','verbose','Delete\x20the\x20push\x20recovery\x20file\x20(','Duration','1044008SpfGij','\x27\x20entry\x20criteria','all_columns','journeyActivationStepId','tdx.sdk.push-workflow','update',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','875590KqUzBT','deps','.$1.push-recovery.json','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','entryCriteria','valid','created','notification','toISOString','replace','journeyBundleId','existingJourney','activationContext','attributes','activation_created','reduce','existingSegment','segment_creating','conditions','907550Jaqpkn','stages','some','Created\x20segment\x20\x27','SEGMENT_NOT_FOUND','526141QuFzrR','sha1','message','slice','get','activation_','utf-8','onProgress','unchanged','journey_updated','conditionTimeoutUnit','split','journeyActivationNameToId','action','Entry\x20criteria:\x20','createdSegmentIds','diff','\x27\x20from\x20file:\x20','yamlConfig','list','stringify','join','createSegment','behavior','Name\x20has\x20already\x20been\x20taken','\x20segment\x20from\x20file:\x20','folder_creating','nameToId','absolutePath','add','uniqueSegmentName','activation_updating','getSegmentEntity\x20also\x20failed\x20for\x20','conditionTimeoutDuration','getSegment','updateActivation','user','parse','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','Deleted\x20segment\x20\x27','27KoWCGe','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','map','journey_updating','__pending_act_','length','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','Updated\x20activation\x20\x27','WaitStep','createActivation','Failed\x20to\x20fetch\x20referenced\x20segment\x20','schedule','\x20journey\x20from\x20file:\x20','18zOfDnH','state','includes','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','push','\x27\x20exit\x20criteria','decision_point','idToName','type','embedded_activation_created','logSuccess','parseDocument','segmentId','embedded_segment_creating','activationsBySegmentId','nameToType','toString','603256NCuopH','INTERNAL','Updating\x20activation\x20\x27','skipSegments','folderPathToId','object','match','existingSegments','1676898AoxZkH','Failed\x20to\x20resolve\x20activation\x20','deleteSegment','resolveSegment','parentSegmentFolder','Activation','entry_criteria','getSegment\x20failed\x20for\x20','activation_template_id','day','resolveJourneyId','max','./child-segment-yaml.js','Segment\x20not\x20found:\x20','getLatestJourneyId','Deleting\x20activation\x20\x27','name','stage\x20\x27','\x27\x20milestone','connectionIdToNameMap','activationParams','relative','journeyId'];a140_0x4706=function(){return _0x289061;};return a140_0x4706();}export function injectExistingStageIds(_0xf94dd0,_0x17beb8){const _0x3a1954=a140_0x2f0267,_0x3c8a7b=new Map(_0x17beb8['map'](_0xc24be2=>[_0xc24be2[_0x3a1954(0x19f)],_0xc24be2['id']]));for(const _0x47048e of _0xf94dd0){if(!_0x47048e['id']){const _0x4a6fb9=_0x3c8a7b[_0x3a1954(0x145)](_0x47048e[_0x3a1954(0x19f)]);_0x4a6fb9&&(_0x47048e['id']=_0x4a6fb9);}}}export function resolveTDFolderPath(_0x589255,_0x31cea8,_0x544054){if(!_0x31cea8)return _0x589255;if(_0x589255===_0x544054||_0x589255['startsWith'](_0x544054+'/'))return _0x589255;return _0x589255?_0x544054+'/'+_0x589255:_0x544054;}export function addFoldersToCreate(_0x422bcc,_0x399723,_0x33507e){const _0x13ec0d=a140_0x2f0267;if(!_0x422bcc)return;if(_0x399723[_0x13ec0d(0x1ad)](_0x422bcc))return;const _0x22a2be=_0x422bcc['split']('/');let _0x38dbbc='';for(const _0x63f9d of _0x22a2be){_0x38dbbc=_0x38dbbc?_0x38dbbc+'/'+_0x63f9d:_0x63f9d,!_0x399723['has'](_0x38dbbc)&&_0x33507e['add'](_0x38dbbc);}}export function sortFoldersByDepth(_0x5120aa){const _0x170c69=a140_0x2f0267;return[..._0x5120aa][_0x170c69(0xfd)]((_0x769e66,_0x3dba3f)=>{const _0x28ce40=_0x170c69,_0x2c32bd=(_0x769e66[_0x28ce40(0x18d)](/\//g)||[])[_0x28ce40(0x16e)],_0x31320e=(_0x3dba3f['match'](/\//g)||[])[_0x28ce40(0x16e)];return _0x2c32bd-_0x31320e;});}import*as a140_0x35382c from'yaml';import{readFileSync}from'fs';import a140_0x42e871 from'path';import{isJourneyDef,parseYamlString as a140_0x376103,toYamlString as a140_0x4ee815,normalizeJourneyDef,hasMultipleVersions,journeyResponseToDef,collectSegmentIdsFromJourneyApi}from'./journey-yaml.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,createJumpTargetCache,resolveJumpTarget,buildMergedJourneyDef,buildLocalRuleToNameMappingFromJourney,collectSegmentUsageCounts}from'./journey-utils.js';import{activationResponseToDef,segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,apiRuleToYaml,yamlRuleToApi,serializeExpandedRule,collectSegmentRefsFromRule,resolveRuleSegmentRefs,resolveRuleSegmentIds,journeyActivationStepToYaml}from'./child-segment-yaml.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{batchAsync}from'../../utils/async.js';function a140_0xd647(_0x2e4e14,_0x1b6591){_0x2e4e14=_0x2e4e14-0xee;const _0x4706f1=a140_0x4706();let _0xd6478f=_0x4706f1[_0x2e4e14];return _0xd6478f;}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(_0x4c4562){const _0x2ee8e7=a140_0x2f0267;if(Array['isArray'](_0x4c4562))return'['+_0x4c4562[_0x2ee8e7(0x16b)](_0x2e3abb=>stableStringify(_0x2e3abb))[_0x2ee8e7(0x156)](',')+']';if(_0x4c4562&&typeof _0x4c4562===_0x2ee8e7(0x18c)){const _0x3eba15=_0x4c4562,_0x31b10a=Object[_0x2ee8e7(0x1ea)](_0x3eba15)['sort'](),_0x4be51a=_0x31b10a[_0x2ee8e7(0x16b)](_0x5797ce=>'\x22'+_0x5797ce+'\x22:'+stableStringify(_0x3eba15[_0x5797ce]));return'{'+_0x4be51a[_0x2ee8e7(0x156)](',')+'}';}const _0x42a31c=JSON[_0x2ee8e7(0x155)](_0x4c4562);return _0x42a31c===undefined?_0x2ee8e7(0x1c9):_0x42a31c;}function activationSignature(_0x3c5ffa){const _0x4d97ed=a140_0x2f0267,_0x1c8a80={'connection':_0x3c5ffa['connection'],..._0x3c5ffa[_0x4d97ed(0x124)]!==undefined&&{'all_columns':_0x3c5ffa[_0x4d97ed(0x124)]},..._0x3c5ffa['columns']!==undefined&&{'columns':_0x3c5ffa['columns']},..._0x3c5ffa[_0x4d97ed(0x158)]!==undefined&&{'behavior':_0x3c5ffa[_0x4d97ed(0x158)]},..._0x3c5ffa[_0x4d97ed(0x174)]!==undefined&&{'schedule':_0x3c5ffa['schedule']},..._0x3c5ffa['notification']!==undefined&&{'notification':_0x3c5ffa[_0x4d97ed(0x130)]},..._0x3c5ffa[_0x4d97ed(0x1cd)]!==undefined&&{'connector_config':_0x3c5ffa[_0x4d97ed(0x1cd)]},..._0x3c5ffa[_0x4d97ed(0x197)]!==undefined&&{'activation_template_id':_0x3c5ffa[_0x4d97ed(0x197)]}};return stableStringify(_0x1c8a80);}async function fetchSegment(_0x4ef94b,_0x46a413,_0x5a711e,_0x34c05e){const _0x3cc1a5=a140_0x2f0267,_0x4918fb=_0x34c05e?.['find'](_0x1652df=>_0x1652df['id']===_0x5a711e);if(_0x4918fb)return _0x4918fb;try{return await _0x4ef94b[_0x3cc1a5(0x1ac)][_0x3cc1a5(0x163)](_0x46a413,_0x5a711e);}catch(_0x4ae8a6){logger[_0x3cc1a5(0x1c4)](_0x3cc1a5(0x196)+_0x5a711e+_0x3cc1a5(0x128)+_0x4ae8a6);try{return await _0x4ef94b['segment']['getSegmentEntity'](_0x5a711e);}catch(_0x56bfc4){return logger[_0x3cc1a5(0x1c4)](_0x3cc1a5(0x161)+_0x5a711e+':\x20'+_0x56bfc4),null;}}}function recoverSegmentIdsFromPushRecovery(_0x2a4609,_0x43d539,_0xffc23c){const _0x2e1c19=a140_0x2f0267,_0x380f77=readPushRecovery(_0x2a4609[_0x2e1c19(0x15d)]);if(_0x380f77?.[_0x2e1c19(0xf1)]===_0x2a4609[_0x2e1c19(0x153)]['name'])for(const [_0x8cbd58,_0x398d4d]of Object[_0x2e1c19(0x111)](_0x380f77[_0x2e1c19(0x1d8)])){const _0x1976fd=generateDeterministicJourneySegmentName(_0x2a4609[_0x2e1c19(0x153)][_0x2e1c19(0x19f)],_0x8cbd58);_0x398d4d['uniqueServerName']===_0x1976fd&&(_0x43d539[_0x2e1c19(0x1de)](_0x8cbd58,_0x398d4d[_0x2e1c19(0x182)]),_0xffc23c[_0x2e1c19(0x1de)](_0x8cbd58,_0x398d4d['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0xdf1f7e,_0x1a1814,_0x4c09f4,_0x270340){const _0xab394a=a140_0x2f0267;let _0x5d60dd;try{_0x5d60dd=await _0xdf1f7e['segment'][_0xab394a(0x114)]({'name':_0x4c09f4[_0xab394a(0x15f)],'description':_0x4c09f4[_0xab394a(0x1c3)],'journeyId':_0x4c09f4[_0xab394a(0x1a5)],'rule':_0x270340(_0x4c09f4[_0xab394a(0xff)],!![]),'countPopulation':!![],'parentFolderId':_0x4c09f4[_0xab394a(0x1d9)],'audienceId':_0x4c09f4[_0xab394a(0x1b1)]});}catch(_0x1fabfc){const _0xc67b1d=_0x1fabfc instanceof Error&&_0x1fabfc[_0xab394a(0x143)][_0xab394a(0x178)](_0xab394a(0x159));if(_0xc67b1d){const _0xa25c62=readPushRecovery(_0x1a1814[_0xab394a(0x15d)]),_0x181a5e=_0xa25c62?.[_0xab394a(0xf1)]===_0x1a1814['yamlConfig'][_0xab394a(0x19f)]?_0xa25c62[_0xab394a(0x1d8)][_0x4c09f4[_0xab394a(0x1ef)]]:undefined;if(_0x181a5e?.['uniqueServerName']===_0x4c09f4['uniqueSegmentName'])await _0xdf1f7e[_0xab394a(0x1ac)][_0xab394a(0x11c)](_0x4c09f4[_0xab394a(0x1b1)],_0x181a5e[_0xab394a(0x182)],{'description':_0x4c09f4[_0xab394a(0x1c3)],'rule':_0x270340(_0x4c09f4[_0xab394a(0xff)],!![]),'countPopulation':!![]}),_0x5d60dd=_0x181a5e[_0xab394a(0x182)];else throw new SDKError(ErrorCode[_0xab394a(0x107)],_0xab394a(0x1f4)+_0x4c09f4[_0xab394a(0x1ef)]+_0xab394a(0x1cb)+(_0xab394a(0x120)+_0x1a1814[_0xab394a(0x15d)]['replace'](/([^/]+)$/,_0xab394a(0x12b))+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x1fabfc);}else throw _0x1fabfc;}return saveSegmentToPushRecovery(_0x1a1814['absolutePath'],_0x1a1814[_0xab394a(0x153)][_0xab394a(0x19f)],_0x4c09f4[_0xab394a(0x1ef)],{'segmentId':_0x5d60dd,'uniqueServerName':_0x4c09f4[_0xab394a(0x15f)],'createdAt':new Date()['toISOString']()}),_0x5d60dd;}export async function prepareSegmentFiles(_0x1555b0,_0x501ac9,_0x14a3e4,_0x3ca8ec,_0x49a2d1){const _0x5e71b7=a140_0x2f0267,{activationDefToCreateRequest:_0x9a59d4}=await import(_0x5e71b7(0x19b)),_0x5c5a68=[],_0x53165e=new Set();for(const {yamlConfig:_0x16037c,folderPath:_0x3674cf,sourcePath:_0x2652cc}of _0x1555b0){const _0x331867=resolveTDFolderPath(_0x3674cf,_0x3ca8ec,_0x49a2d1),_0x4a852d=_0x331867+':'+_0x16037c[_0x5e71b7(0x19f)],_0x5e69b5=_0x501ac9[_0x5e71b7(0x1a7)][_0x5e71b7(0x145)](_0x4a852d),_0x6b72d=_0x5e69b5?_0x501ac9[_0x5e71b7(0x184)]['get'](_0x5e69b5['id'])||[]:[];addFoldersToCreate(_0x331867,_0x501ac9[_0x5e71b7(0x18b)],_0x53165e);const _0x130923=calculateActivationActions(_0x16037c['activations']||[],_0x6b72d,_0x501ac9['idToEmailMap'],_0x501ac9[_0x5e71b7(0x1a2)]);for(const _0x3a036b of _0x130923){(_0x3a036b[_0x5e71b7(0x17e)]===_0x5e71b7(0xf9)||_0x3a036b[_0x5e71b7(0x17e)]==='update')&&_0x3a036b['yamlActivation']&&(_0x3a036b['validatedRequest']=await _0x9a59d4(_0x3a036b[_0x5e71b7(0x116)],_0x14a3e4));}const _0x30c997=calculateSegmentDiff(_0x16037c,_0x5e69b5,_0x6b72d,_0x501ac9[_0x5e71b7(0x11b)],_0x501ac9[_0x5e71b7(0x1a2)]);_0x5c5a68['push']({'relativePath':_0x16037c[_0x5e71b7(0x19f)],'absolutePath':_0x2652cc,'yamlConfig':_0x16037c,'folderPath':_0x331867,'existingSegment':_0x5e69b5,'existingActivations':_0x6b72d,'isNew':_0x30c997['isNew'],'hasChanges':_0x30c997[_0x5e71b7(0x1b9)],'diff':_0x30c997['diff'],'activationActions':_0x130923});}return{'segmentFiles':_0x5c5a68,'foldersToCreate':_0x53165e};}export async function prepareJourneyFiles(_0x37b7cf,_0x5e33b9,_0x41ea2d,_0x2156be){const _0x322c80=a140_0x2f0267,_0x5aff20=[],_0x5abf7a=new Set();for(const {yamlConfig:_0x1c4fbd,folderPath:_0x5e9450,sourcePath:_0xaace78}of _0x37b7cf){const _0x66c072=resolveTDFolderPath(_0x5e9450,_0x41ea2d,_0x2156be),_0x469f26=_0x66c072+':'+_0x1c4fbd[_0x322c80(0x19f)],_0x1ab014=_0x5e33b9[_0x322c80(0xf7)][_0x322c80(0x145)](_0x469f26);let _0xd5c06c,_0x4652ba;if(_0x1ab014&&_0x1ab014[_0x322c80(0x16e)]>0x0){const _0x5a731d=buildLocalExpandedRuleMappings(_0x1c4fbd),{createYamlContext:_0x5dcef1,prefetchJourneySegments:_0x5b898b}=createPushYamlContextForBundle(_0x5e33b9[_0x322c80(0x12a)],_0x5e33b9['parentId'],_0x5e33b9['existingSegments'],_0x5a731d,_0x5e33b9[_0x322c80(0x11b)],_0x5e33b9[_0x322c80(0x1a2)],_0x5e33b9[_0x322c80(0x1bb)],_0x5e33b9[_0x322c80(0x100)]);await _0x5b898b(_0x1ab014['map'](_0x38deff=>_0x38deff['id']));const _0x226fdf=await _0x5e33b9[_0x322c80(0x12a)][_0x322c80(0x115)][_0x322c80(0x19d)](_0x1ab014[0x0][_0x322c80(0x133)]),_0x155aca=hasMultipleVersions(_0x1c4fbd),_0x38a4a6=async _0x2c325b=>{const _0x51b006=_0x322c80,_0x3678ef=_0x5e33b9[_0x51b006(0x100)]?.['get'](_0x2c325b);if(_0x3678ef)return _0x3678ef;return _0x5e33b9[_0x51b006(0x1ee)]({'journeyId':_0x2c325b,'journeyName':_0x1c4fbd[_0x51b006(0x19f)],'isMultiVersion':_0x1ab014[_0x51b006(0x16e)]>0x1});};if(_0x155aca&&_0x1ab014[_0x322c80(0x16e)]>0x1){const _0x5ca175=[];for(const _0x58bade of _0x1ab014){const _0xee3bf0=_0x58bade[_0x322c80(0x1b7)]||0x1;_0x5e33b9[_0x322c80(0xee)]?.[_0x322c80(0x127)](_0x322c80(0x1f1)+_0x1c4fbd[_0x322c80(0x19f)]+'\x20v'+_0xee3bf0);const _0x1eeafb=await _0x38a4a6(_0x58bade['id']),_0x4037fb=_0x5dcef1(_0x58bade['id']),_0x425b80=await journeyResponseToDef(_0x1eeafb,_0x4037fb);_0x5ca175[_0x322c80(0x17a)]({'item':_0x58bade,'yaml':_0x425b80});}const _0x50709b=buildLocalRuleToNameMappingFromJourney(_0x1c4fbd);_0x4652ba=buildMergedJourneyDef(_0x5ca175,_0x50709b,_0x226fdf);const _0x1015a0=Math['max'](..._0x5ca175['map'](_0x425e8b=>_0x425e8b[_0x322c80(0x1b5)][_0x322c80(0x1b7)]||0x0)),_0x4eea55=_0x1ab014[_0x322c80(0x1e0)](_0x3371e1=>(_0x3371e1['versionNumber']||0x0)===_0x1015a0);_0x4eea55&&(_0x5e33b9['progress']?.['update'](_0x322c80(0x1f1)+_0x1c4fbd[_0x322c80(0x19f)]+'\x20v'+_0x1015a0),_0xd5c06c=await _0x38a4a6(_0x4eea55['id']));}else{const _0x265d17=_0x1ab014[_0x1ab014['length']-0x1];_0x5e33b9[_0x322c80(0xee)]?.['update'](_0x322c80(0x1f1)+_0x1c4fbd[_0x322c80(0x19f)]),_0xd5c06c=await _0x38a4a6(_0x265d17['id']);const _0x58d3cb=_0x5dcef1(_0x265d17['id']),_0xfc292a=await journeyResponseToDef(_0xd5c06c,_0x58d3cb),_0x3c94ff=buildLocalRuleToNameMappingFromJourney(_0x1c4fbd);_0x4652ba=buildMergedJourneyDef([{'item':_0x265d17,'yaml':_0xfc292a}],_0x3c94ff,_0x226fdf);}}addFoldersToCreate(_0x66c072,_0x5e33b9['folderPathToId'],_0x5abf7a);const _0x103981=calculateJourneyDiff(_0x1c4fbd,_0x4652ba);_0x5aff20['push']({'relativePath':_0x1c4fbd['name'],'absolutePath':_0xaace78,'yamlConfig':_0x1c4fbd,'folderPath':_0x66c072,'existingJourney':_0xd5c06c,'isNew':_0x103981[_0x322c80(0x11d)],'hasChanges':_0x103981[_0x322c80(0x1b9)],'diff':_0x103981[_0x322c80(0x151)]});}return{'journeyFiles':_0x5aff20,'foldersToCreate':_0x5abf7a};}export function calculateActivationActions(_0x1c78df,_0x2d0a50,_0x57dfae,_0x543e54){const _0x2d20db=a140_0x2f0267,_0x2c7e59=[],_0x12c209=new Map();for(const _0x10e078 of _0x2d0a50){_0x12c209[_0x2d20db(0x1de)](_0x10e078['name'],_0x10e078);}const _0x59cc2d=new Map();for(const _0x4c19f7 of _0x1c78df){_0x59cc2d[_0x2d20db(0x1de)](_0x4c19f7[_0x2d20db(0x19f)],_0x4c19f7);}for(const _0x458a39 of _0x1c78df){const _0x2ce816=_0x12c209['get'](_0x458a39[_0x2d20db(0x19f)]);if(!_0x2ce816)_0x2c7e59[_0x2d20db(0x17a)]({'type':'create','name':_0x458a39['name'],'yamlActivation':_0x458a39});else{const _0x433f57=activationResponseToDef(_0x2ce816,_0x57dfae,_0x543e54),_0x3a873e=a140_0x35382c[_0x2d20db(0x155)](_0x433f57),_0x1d59a6=a140_0x35382c['stringify'](_0x458a39);_0x3a873e!==_0x1d59a6&&_0x2c7e59[_0x2d20db(0x17a)]({'type':_0x2d20db(0x127),'name':_0x458a39[_0x2d20db(0x19f)],'yamlActivation':_0x458a39,'existingActivation':_0x2ce816});}}for(const _0x585b4a of _0x2d0a50){!_0x59cc2d[_0x2d20db(0x1ad)](_0x585b4a[_0x2d20db(0x19f)])&&_0x2c7e59[_0x2d20db(0x17a)]({'type':_0x2d20db(0x1bf),'name':_0x585b4a[_0x2d20db(0x19f)],'existingActivation':_0x585b4a});}return _0x2c7e59;}function calculateYamlDiff(_0x3446e3,_0x48b6f0){if(_0x48b6f0){const _0x2f135a=generateDiff(_0x48b6f0,_0x3446e3),_0x333d59=hasChanges(_0x2f135a);return{'isNew':![],'hasChanges':_0x333d59,'diff':_0x333d59?formatDiffWithColors(_0x2f135a):undefined};}const _0x5f2ddb=generateDiff('',_0x3446e3);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x5f2ddb)};}export function calculateSegmentDiff(_0x37b07a,_0x5dc899,_0x207f8b,_0x411728,_0x522f87){const _0x14d282=segmentToYamlString(_0x37b07a),_0x38e83d=_0x5dc899?segmentToYamlString(segmentWithActivationsToYaml(_0x5dc899,_0x207f8b,undefined,_0x411728,_0x522f87)):undefined;return calculateYamlDiff(_0x14d282,_0x38e83d);}export function calculateJourneyDiff(_0xff6e10,_0x3b1fa0){const _0x5a30e2=normalizeJourneyDef(_0xff6e10,_0xff6e10),_0x2ac0ad=a140_0x4ee815(_0x5a30e2),_0x4a6fe9=_0x3b1fa0?a140_0x4ee815(normalizeJourneyDef(_0x3b1fa0,_0xff6e10)):undefined;return calculateYamlDiff(_0x2ac0ad,_0x4a6fe9);}export function findSegmentsToDelete(_0x590ae8,_0x2a488a,_0x45e718,_0xdd29e2,_0x11bd08){const _0x318296=a140_0x2f0267,_0x486fad=new Set();for(const {yamlConfig:_0x37a2d3,folderPath:_0x3250e7}of _0x2a488a){_0x486fad[_0x318296(0x15e)](_0x3250e7+':'+_0x37a2d3[_0x318296(0x19f)]);}return _0x590ae8[_0x318296(0x10f)](_0x2cc56b=>{const _0x78f56=_0x318296,_0x524e59=_0x2cc56b[_0x78f56(0x1e9)]?_0x45e718[_0x78f56(0x145)](_0x2cc56b[_0x78f56(0x1e9)][_0x78f56(0x186)]())||'':'',_0x4610a3=_0x524e59+':'+_0x2cc56b[_0x78f56(0x19f)];if(_0x486fad['has'](_0x4610a3))return![];if(_0x11bd08)return _0x524e59===_0xdd29e2||_0x524e59[_0x78f56(0x1b6)](_0xdd29e2+'/');return!![];});}export function findJourneysToDelete(_0x4b0b17,_0x283ccb,_0x4cb35a,_0x5ebbb4,_0x2e3990){const _0xe85a04=a140_0x2f0267,_0x22b777=new Set();for(const {yamlConfig:_0x11d8a7,folderPath:_0x57eddb}of _0x283ccb){_0x22b777[_0xe85a04(0x15e)](_0x57eddb+':'+_0x11d8a7[_0xe85a04(0x19f)]);}return _0x4b0b17[_0xe85a04(0x10f)](_0x23e2b9=>{const _0x422ccb=_0xe85a04,_0x2ab45c=_0x23e2b9[_0x422ccb(0x1d9)]?_0x4cb35a['get'](_0x23e2b9['folderId'])||'':'',_0x486a1d=_0x2ab45c+':'+_0x23e2b9['journeyBundleName'];if(_0x22b777['has'](_0x486a1d))return![];if(_0x2e3990)return _0x2ab45c===_0x5ebbb4||_0x2ab45c['startsWith'](_0x5ebbb4+'/');return!![];});}export function buildSegmentLookupMap(_0x2f0dd9,_0x49c8b3){const _0x21dbd3=a140_0x2f0267,_0x59b1fc=new Map();for(const _0x15f71b of _0x2f0dd9){const _0x813fad=_0x15f71b[_0x21dbd3(0x1e9)]?_0x49c8b3[_0x21dbd3(0x145)](_0x15f71b[_0x21dbd3(0x1e9)][_0x21dbd3(0x186)]())||'':'',_0x1f3c6c=_0x813fad+':'+_0x15f71b[_0x21dbd3(0x19f)];_0x59b1fc['set'](_0x1f3c6c,_0x15f71b);}return _0x59b1fc;}export function buildSegmentNameToIdMap(_0x15234a){const _0x12c3ac=a140_0x2f0267,_0x21523f=new Map();for(const _0xe8c196 of _0x15234a){_0x21523f[_0x12c3ac(0x1de)](_0xe8c196[_0x12c3ac(0x19f)],_0xe8c196['id']);}return _0x21523f;}export function buildJourneyBundleLookupMap(_0x561684,_0x171028){const _0x30b878=a140_0x2f0267,_0x588c46=new Map();for(const _0x247121 of _0x561684){const _0x234624=_0x247121[_0x30b878(0x1d9)]?_0x171028[_0x30b878(0x145)](_0x247121['folderId'])||'':'',_0x18d908=_0x234624+':'+_0x247121[_0x30b878(0x1b4)];!_0x588c46[_0x30b878(0x1ad)](_0x18d908)&&_0x588c46[_0x30b878(0x1de)](_0x18d908,[]),_0x588c46['get'](_0x18d908)[_0x30b878(0x17a)](_0x247121);}for(const _0x38886b of _0x588c46[_0x30b878(0xf4)]()){_0x38886b[_0x30b878(0xfd)]((_0x59727a,_0x8b9e4e)=>(_0x59727a[_0x30b878(0x1b7)]||0x0)-(_0x8b9e4e[_0x30b878(0x1b7)]||0x0));}return _0x588c46;}export function collectFoldersToCreate(_0x1eb6d8,_0x239a58){const _0x2ef1ef=a140_0x2f0267,_0x5076ea=new Set();for(const _0x4eff91 of _0x1eb6d8){if(!_0x4eff91)continue;if(_0x239a58[_0x2ef1ef(0x1ad)](_0x4eff91))continue;const _0x334ba8=_0x4eff91['split']('/');let _0x48f86f='';for(const _0x202032 of _0x334ba8){_0x48f86f=_0x48f86f?_0x48f86f+'/'+_0x202032:_0x202032,!_0x239a58[_0x2ef1ef(0x1ad)](_0x48f86f)&&_0x5076ea[_0x2ef1ef(0x15e)](_0x48f86f);}}return _0x5076ea;}export function parseAndClassifyYamlFiles(_0x2a7cf3,_0x311094,_0x3d193e){const _0x42b401=a140_0x2f0267,_0x50263b=[],_0x4f6851=[];for(const _0x1a06b8 of _0x2a7cf3){const _0x2088cc=a140_0x42e871[_0x42b401(0x1a4)](_0x311094,a140_0x42e871['dirname'](_0x1a06b8)),_0x4e7a9d=_0x2088cc==='.'?'':_0x2088cc,_0x240950=readFileSync(_0x1a06b8,_0x42b401(0x147)),_0x1845c5=a140_0x35382c[_0x42b401(0x166)](_0x240950);if(isJourneyDef(_0x1845c5)){const _0x54e108=a140_0x376103(_0x240950);_0x4f6851[_0x42b401(0x17a)]({'yamlConfig':_0x54e108,'folderPath':_0x4e7a9d,'sourcePath':_0x1a06b8});}else{if(!_0x3d193e?.[_0x42b401(0x18a)]){const _0x593e4f=parseSegmentYamlFile(_0x240950),_0x6253d5=normalizeChildSegmentYaml(_0x593e4f);_0x50263b[_0x42b401(0x17a)]({'yamlConfig':_0x6253d5,'folderPath':_0x4e7a9d,'sourcePath':_0x1a06b8});}}}return{'segments':_0x50263b,'journeys':_0x4f6851};}export function validateParsedFiles(_0x2c6a2a,_0x3b33a7){const _0x399e77=a140_0x2f0267,_0x258b04=[];for(const {yamlConfig:_0x5daab7,sourcePath:_0x4520b7}of _0x2c6a2a[_0x399e77(0x1d8)]){const _0x3ac526=readFileSync(_0x4520b7,'utf-8'),_0x2ba6ca=a140_0x35382c[_0x399e77(0x181)](_0x3ac526),_0x52c061=validateSegmentDef(_0x5daab7,{'source':_0x3ac526,'document':_0x2ba6ca},{'skipSchema':!![]});if(!_0x52c061['valid']){const _0x166d41=a140_0x42e871['relative'](_0x3b33a7,_0x4520b7);_0x258b04[_0x399e77(0x17a)]({'filePath':_0x166d41,'source':_0x3ac526,'result':_0x52c061,'isJourney':![]});}}for(const {yamlConfig:_0xf47efc,sourcePath:_0x2425e9}of _0x2c6a2a[_0x399e77(0xf5)]){const _0x5464ac=readFileSync(_0x2425e9,_0x399e77(0x147)),_0x459ae9=a140_0x35382c[_0x399e77(0x181)](_0x5464ac),_0x18e563=validateJourneyDef(_0xf47efc,{'source':_0x5464ac,'document':_0x459ae9},{'skipSchema':!![]});if(!_0x18e563[_0x399e77(0x12e)]){const _0xe8fe71=a140_0x42e871[_0x399e77(0x1a4)](_0x3b33a7,_0x2425e9);_0x258b04[_0x399e77(0x17a)]({'filePath':_0xe8fe71,'source':_0x5464ac,'result':_0x18e563,'isJourney':!![]});}}return _0x258b04;}export function formatValidationErrors(_0x4af065){const _0x583022=a140_0x2f0267,_0x43bae3=[];for(const {filePath:_0x3f1d00,source:_0x26fef8,result:_0x4e6ff3,isJourney:_0xe106ea}of _0x4af065){const _0x555625=_0xe106ea?_0x583022(0x115):_0x583022(0x1ac);_0x43bae3['push']('\x0a'+_0x3f1d00+'\x20('+_0x555625+'):\x20'+_0x4e6ff3['errors'][_0x583022(0x16e)]+'\x20error(s)'),_0x43bae3[_0x583022(0x17a)](formatValidationResult(_0x4e6ff3,_0x26fef8,_0x3f1d00));}return _0x43bae3[_0x583022(0x156)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x2779de){const _0x25d602=a140_0x2f0267,_0x46d766=new Set(),_0x5b22a1=new Map(),_0x4f8064=collectSegmentUsageCounts(_0x2779de);if(_0x2779de[_0x25d602(0x1d8)])for(const [_0x435005,_0x1eff79]of Object['entries'](_0x2779de[_0x25d602(0x1d8)])){_0x46d766[_0x25d602(0x15e)](_0x435005);if(_0x1eff79['rule']){const _0x5e50bd=yamlRuleToApi(_0x1eff79[_0x25d602(0x108)]),_0x5429b3=apiRuleToYaml(_0x5e50bd);_0x5b22a1['set'](_0x435005,_0x5429b3);}}const _0x4c3172=new Map();let _0x4db7af=0x0;for(const [_0x537a4d,_0x16e305]of _0x5b22a1){const _0x4015b7=serializeExpandedRule(_0x16e305,_0x5b22a1),_0x13a96f=_0x4c3172['get'](_0x4015b7)||[];_0x13a96f[_0x25d602(0x17a)]({'name':_0x537a4d,'index':_0x4db7af}),_0x4c3172[_0x25d602(0x1de)](_0x4015b7,_0x13a96f),_0x4db7af++;}const _0x30f996=new Map();for(const [_0x55d909,_0x16a65f]of _0x4c3172){const _0x4793dc=_0x16a65f[_0x25d602(0x144)]()[_0x25d602(0xfd)]((_0x5c7bd8,_0x2ea8b4)=>{const _0x276091=_0x25d602,_0x505b31=_0x4f8064[_0x276091(0x145)](_0x5c7bd8[_0x276091(0x19f)])||0x0,_0x2d5f5e=_0x4f8064[_0x276091(0x145)](_0x2ea8b4[_0x276091(0x19f)])||0x0;if(_0x505b31!==_0x2d5f5e)return _0x2d5f5e-_0x505b31;return _0x5c7bd8[_0x276091(0x10a)]-_0x2ea8b4[_0x276091(0x10a)];})['map'](_0x129db9=>_0x129db9[_0x25d602(0x19f)]),_0xdcaadd=[];for(const _0x5217b3 of _0x4793dc){const _0xd0dd1c=_0x4f8064[_0x25d602(0x145)](_0x5217b3)||0x0,_0x57a24d=Math[_0x25d602(0x19a)](_0xd0dd1c,0x1);for(let _0x4ae330=0x0;_0x4ae330<_0x57a24d;_0x4ae330++){_0xdcaadd[_0x25d602(0x17a)](_0x5217b3);}}_0x30f996[_0x25d602(0x1de)](_0x55d909,_0xdcaadd);}return{'existingLocalSegmentNames':_0x46d766,'localSegmentRules':_0x5b22a1,'localExpandedRuleToNames':_0x30f996};}export function createSegmentIdResolver(_0x560473,_0x1412a4){return async _0x57867f=>{const _0xa391f4=a140_0xd647,_0x5185c9=_0x560473[_0xa391f4(0x145)](_0x57867f);if(!_0x5185c9)throw new SDKError(ErrorCode[_0xa391f4(0x140)],_0xa391f4(0x19c)+_0x57867f+_0xa391f4(0x16a)+_0x1412a4+'\x27)');return _0x5185c9;};}export function extractRootFolderId(_0x98f6ac){const _0xbc6e22=a140_0x2f0267;return _0x98f6ac['relationships']?.[_0xbc6e22(0x193)]?.['data']?.['id']||_0x98f6ac[_0xbc6e22(0xfb)]?.[_0xbc6e22(0x117)]?.[_0xbc6e22(0x1a9)]?.['id'];}export function buildConnectionMaps(_0xdb55b6){const _0x19b978=a140_0x2f0267,_0x13194f=new Map(),_0x1645ea=new Map(),_0x539bb1=new Map();for(const _0x540036 of _0xdb55b6){_0x13194f[_0x19b978(0x1de)](_0x540036[_0x19b978(0x19f)],parseInt(_0x540036['id'],0xa)),_0x1645ea[_0x19b978(0x1de)](_0x540036['id'],_0x540036[_0x19b978(0x19f)]),_0x539bb1[_0x19b978(0x1de)](_0x540036[_0x19b978(0x19f)],_0x540036[_0x19b978(0x17e)]);}return{'nameToId':_0x13194f,'idToName':_0x1645ea,'nameToType':_0x539bb1};}export function calculatePushStats(_0x5dcf9a,_0x5bd110,_0x117b13,_0x387f01,_0x2c4fb5,_0x41a0fa,_0x40cba1){const _0x25447f=a140_0x2f0267,_0x23bdc4=_0x5dcf9a[_0x25447f(0x10f)](_0x197bf1=>_0x197bf1[_0x25447f(0x11d)]),_0x48bf8a=_0x5dcf9a['filter'](_0x4564ee=>!_0x4564ee[_0x25447f(0x11d)]&&_0x4564ee[_0x25447f(0x1b9)]),_0x92cac9=_0x5dcf9a[_0x25447f(0x10f)](_0x22470c=>!_0x22470c[_0x25447f(0x11d)]&&!_0x22470c[_0x25447f(0x1b9)]),_0x548111=_0x41a0fa?_0x387f01:[],_0x28bc09=_0x5bd110[_0x25447f(0x10f)](_0x3ad549=>_0x3ad549[_0x25447f(0x11d)]),_0x10cc21=_0x5bd110[_0x25447f(0x10f)](_0x132209=>!_0x132209[_0x25447f(0x11d)]&&_0x132209[_0x25447f(0x1b9)]),_0xc6f923=_0x5bd110[_0x25447f(0x10f)](_0x1da43f=>!_0x1da43f[_0x25447f(0x11d)]&&!_0x1da43f[_0x25447f(0x1b9)]),_0x8d5b49=_0x41a0fa?_0x2c4fb5:[],_0xda2554=_0x5dcf9a[_0x25447f(0x1d6)](_0x30e86a=>_0x30e86a[_0x25447f(0x1e1)]),_0x32ecc4=_0xda2554[_0x25447f(0x10f)](_0x56f992=>_0x56f992[_0x25447f(0x17e)]===_0x25447f(0xf9)),_0x253229=_0xda2554[_0x25447f(0x10f)](_0x392303=>_0x392303['type']===_0x25447f(0x127)),_0xa61186=_0xda2554[_0x25447f(0x10f)](_0x4591a2=>_0x4591a2[_0x25447f(0x17e)]===_0x25447f(0x1bf)),_0x49ad87=Array['from'](_0x117b13)[_0x25447f(0xfd)](),_0x4db5ef=_0x40cba1?![]:_0x23bdc4['length']>0x0||_0x48bf8a[_0x25447f(0x16e)]>0x0||_0x548111[_0x25447f(0x16e)]>0x0,_0x4766aa=_0x28bc09['length']>0x0||_0x10cc21[_0x25447f(0x16e)]>0x0||_0x8d5b49['length']>0x0,_0x17baa5=_0x40cba1?![]:_0xda2554[_0x25447f(0x16e)]>0x0,_0x2f90d8=_0x49ad87[_0x25447f(0x16e)]>0x0;return{'segments':{'new':_0x23bdc4,'changed':_0x48bf8a,'unchanged':_0x92cac9,'toDelete':_0x548111},'journeys':{'new':_0x28bc09,'changed':_0x10cc21,'unchanged':_0xc6f923,'toDelete':_0x8d5b49},'activations':{'all':_0xda2554,'toCreate':_0x32ecc4,'toUpdate':_0x253229,'toDelete':_0xa61186},'folders':{'toCreate':_0x49ad87},'counts':{'segments':{'new':_0x23bdc4[_0x25447f(0x16e)],'changed':_0x48bf8a[_0x25447f(0x16e)],'unchanged':_0x92cac9[_0x25447f(0x16e)],'toDelete':_0x548111[_0x25447f(0x16e)]},'journeys':{'new':_0x28bc09[_0x25447f(0x16e)],'changed':_0x10cc21['length'],'unchanged':_0xc6f923[_0x25447f(0x16e)],'toDelete':_0x8d5b49[_0x25447f(0x16e)]},'activations':{'create':_0x32ecc4[_0x25447f(0x16e)],'update':_0x253229[_0x25447f(0x16e)],'delete':_0xa61186[_0x25447f(0x16e)]},'folders':_0x49ad87[_0x25447f(0x16e)]},'hasChanges':_0x4db5ef||_0x4766aa||_0x17baa5||_0x2f90d8};}export async function buildPushExecutionContext(_0x344551,_0x549584,_0x3d9a5f,_0x1472b5,_0x4e55ae,_0x429e61){const _0x467a6e=a140_0x2f0267,_0x2b5557=extractRootFolderId(_0x3d9a5f),{pathToId:_0x38509b,idToPath:_0x2f9757}=buildFolderMaps(_0x4e55ae),_0x4d3d5a=buildSegmentNameToIdMap(_0x1472b5),_0x9fa6af=new Map(),{batchAsync:_0x5083b1}=await import(_0x467a6e(0xf6)),[_0x535b1a,_0x50fe8e]=await Promise[_0x467a6e(0x1ca)]([_0x344551[_0x467a6e(0x165)]['buildUserMaps'](),_0x344551['connection'][_0x467a6e(0x154)](),((async()=>{const _0x5e0102=_0x467a6e;!_0x429e61&&_0x1472b5[_0x5e0102(0x16e)]>0x0&&await _0x5083b1(_0x1472b5,async _0x5daa65=>{const _0xbe0f27=_0x5e0102,_0x3d1af4=await _0x344551[_0xbe0f27(0x1ac)]['listActivations'](_0x549584,_0x5daa65['id']);_0x9fa6af['set'](_0x5daa65['id'],_0x3d1af4);});})())]),{emailToId:_0x2a61cc,idToEmail:_0x1eabc0}=_0x535b1a,_0x202e2a=buildConnectionMaps(_0x50fe8e);return{'rootFolderId':_0x2b5557,'folderPathToId':_0x38509b,'folderIdToPath':_0x2f9757,'segmentNameToId':_0x4d3d5a,'activationsBySegmentId':_0x9fa6af,'emailToIdMap':_0x2a61cc,'idToEmailMap':_0x1eabc0,'connectionNameToIdMap':_0x202e2a[_0x467a6e(0x15c)],'connectionIdToNameMap':_0x202e2a[_0x467a6e(0x17d)],'connectionNameToTypeMap':_0x202e2a[_0x467a6e(0x185)]};}export function createPushYamlContextForBundle(_0x495b32,_0x460735,_0x2f16b1,_0xbd6cb9,_0x20af7b,_0x177450,_0x21dc69,_0x11fc03){const {existingLocalSegmentNames:_0x53e42e,localExpandedRuleToNames:_0x596e80}=_0xbd6cb9,_0x45282b=new Set(),_0xeb8e8e=new Map(),_0x53b381=new Map(),_0x2e9fe8=new Map(),_0x4a143e=createJumpTargetCache(),_0x2646e0=new Map(),_0x81f3e8=new Map(),_0x5b7af0=new Set();let _0x2562c7;const _0x2a359d=_0x185cab=>{const _0x4a2c86={'resolveSegment':async _0x44792a=>{const _0x3ad3c5=a140_0xd647,_0x1413f6=_0x2e9fe8[_0x3ad3c5(0x145)](_0x44792a);if(_0x1413f6!==undefined)return{'name':_0x1413f6,'isJourneyLocal':!![]};try{const _0x221e1d=await fetchSegment(_0x495b32,_0x460735,_0x44792a,_0x2f16b1);if(!_0x221e1d)throw new Error(_0x3ad3c5(0x1df));const _0x4ff027=generateJourneyLocalName(_0x221e1d['name']),_0x276616=_0x221e1d[_0x3ad3c5(0x1dc)]===SEGMENT_KIND_JOURNEY&&_0x4ff027!==undefined;let _0x47d984=_0x221e1d[_0x3ad3c5(0x19f)],_0x26d3b9;if(_0x276616&&_0x221e1d[_0x3ad3c5(0x108)]){const _0x5ba0ae=apiRuleToYaml(_0x221e1d[_0x3ad3c5(0x108)]);_0x81f3e8[_0x3ad3c5(0x1de)](_0x44792a,_0x5ba0ae);const _0x3fa739=async _0x2468c5=>{const _0x2208b2=_0x3ad3c5,_0x632e61=collectSegmentRefsFromRule(_0x2468c5);for(const _0x266764 of _0x632e61){if(!_0x81f3e8[_0x2208b2(0x1ad)](_0x266764))try{const _0x414eba=await fetchSegment(_0x495b32,_0x460735,_0x266764,_0x2f16b1);if(_0x414eba?.['rule']){const _0x161f99=apiRuleToYaml(_0x414eba['rule']);_0x81f3e8[_0x2208b2(0x1de)](_0x266764,_0x161f99),await _0x3fa739(_0x161f99);}}catch(_0x28a400){logger[_0x2208b2(0x1c4)](_0x2208b2(0x173)+_0x266764+':\x20'+_0x28a400);}}};await _0x3fa739(_0x5ba0ae);const _0x20fbb4=serializeExpandedRule(_0x5ba0ae,_0x81f3e8),_0x18311e=_0x596e80[_0x3ad3c5(0x145)](_0x20fbb4);if(_0x18311e&&_0x18311e[_0x3ad3c5(0x16e)]>0x0){const _0xba5ccd=_0xeb8e8e['get'](_0x20fbb4)||0x0,_0x4160df=_0x18311e[_0xba5ccd]||_0x18311e[_0x18311e[_0x3ad3c5(0x16e)]-0x1];_0xeb8e8e[_0x3ad3c5(0x1de)](_0x20fbb4,_0xba5ccd+0x1),_0x47d984=_0x4160df,_0x45282b['add'](_0x47d984),_0x2e9fe8[_0x3ad3c5(0x1de)](_0x44792a,_0x47d984);const _0x5a63ef=await resolveRuleSegmentRefs(_0x5ba0ae,async _0x28d61c=>{const _0x1b3ca0=_0x3ad3c5,_0x33bdde=_0x2e9fe8[_0x1b3ca0(0x145)](_0x28d61c);if(_0x33bdde)return _0x33bdde;const _0x232a55=await _0x2562c7[_0x1b3ca0(0x192)](_0x28d61c);return _0x232a55[_0x1b3ca0(0x19f)];});_0x26d3b9={'description':_0x221e1d[_0x3ad3c5(0x1c3)],'rule':_0x5a63ef};}else{const _0x4eff3c=_0x2646e0['get'](_0x20fbb4);if(_0x4eff3c)_0x47d984=_0x4eff3c,_0x2e9fe8[_0x3ad3c5(0x1de)](_0x44792a,_0x47d984);else{if(_0x4ff027){let _0x383cc3=_0x4ff027,_0x2b23f8=0x2;while(_0x45282b[_0x3ad3c5(0x1ad)](_0x383cc3)||_0x53e42e[_0x3ad3c5(0x1ad)](_0x383cc3)){_0x383cc3=_0x4ff027+'_'+_0x2b23f8,_0x2b23f8++;}_0x45282b[_0x3ad3c5(0x15e)](_0x383cc3),_0x47d984=_0x383cc3;}_0x2e9fe8['set'](_0x44792a,_0x47d984),_0x2646e0['set'](_0x20fbb4,_0x47d984);const _0x29065c=await resolveRuleSegmentRefs(_0x5ba0ae,async _0x559b7a=>{const _0x4ad12c=_0x3ad3c5,_0x1cb9b5=_0x2e9fe8[_0x4ad12c(0x145)](_0x559b7a);if(_0x1cb9b5)return _0x1cb9b5;const _0xf672e0=await _0x2562c7[_0x4ad12c(0x192)](_0x559b7a);return _0xf672e0[_0x4ad12c(0x19f)];});_0x26d3b9={'description':_0x221e1d[_0x3ad3c5(0x1c3)],'rule':_0x29065c};}}}return{'name':_0x47d984,'isJourneyLocal':_0x276616,'definition':_0x26d3b9};}catch(_0x249f44){return logger[_0x3ad3c5(0x1c4)]('Failed\x20to\x20resolve\x20segment\x20'+_0x44792a+':\x20'+_0x249f44),{'name':_0x44792a,'isJourneyLocal':![]};}},'resolveActivation':async _0x3c42af=>{const _0x2ef953=a140_0xd647,_0x33c9a1=_0x53b381['get'](_0x3c42af);if(_0x33c9a1!==undefined)return{'name':_0x33c9a1,'isJourneyLocal':!![]};try{let _0x26fe4d=_0x21dc69?.[_0x2ef953(0x145)](_0x3c42af);!_0x26fe4d&&(_0x26fe4d=await _0x495b32[_0x2ef953(0x115)][_0x2ef953(0x1cf)](_0x185cab,_0x3c42af));const _0x444230=_0x26fe4d[_0x2ef953(0x136)][_0x2ef953(0x1a3)][_0x2ef953(0x19f)]||_0x3c42af,_0x1f7a44=sanitizeYamlKey(_0x444230)||_0x2ef953(0x146)+_0x3c42af,_0x404d41=_0x1f7a44;_0x53b381[_0x2ef953(0x1de)](_0x3c42af,_0x404d41);const _0x2ee8d6=journeyActivationStepToYaml(_0x26fe4d,_0x20af7b,_0x177450);return{'name':_0x404d41,'isJourneyLocal':!![],'definition':_0x2ee8d6};}catch(_0x2035de){return logger[_0x2ef953(0x1c4)](_0x2ef953(0x190)+_0x3c42af+':\x20'+_0x2035de),{'name':_0x3c42af,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x56d173,_0x4d2ba3)=>resolveJumpTarget(_0x56d173,_0x4d2ba3,_0x4a143e,async _0x296693=>{const _0x395462=a140_0xd647,_0x5e2f21=_0x11fc03?.[_0x395462(0x145)](_0x296693);if(_0x5e2f21)return _0x5e2f21;return _0x495b32[_0x395462(0x115)][_0x395462(0x110)](_0x296693);})};return _0x2562c7=_0x4a2c86,_0x4a2c86;},_0x3872f6=async _0x5ecc4d=>{const _0x1c7818=a140_0xd647,{collectSegmentIdsFromJourneyApi:_0x278ac8}=await import('./journey-yaml.js'),{batchAsync:_0x163f50}=await import(_0x1c7818(0xf6)),_0x1298ba=new Set();for(const _0x2a2b03 of _0x5ecc4d){let _0x216235=_0x11fc03?.[_0x1c7818(0x145)](_0x2a2b03);!_0x216235&&(_0x216235=await _0x495b32[_0x1c7818(0x115)][_0x1c7818(0x110)](_0x2a2b03));const _0x301036=_0x278ac8(_0x216235);for(const _0x52c5d9 of _0x301036){_0x1298ba[_0x1c7818(0x15e)](_0x52c5d9);}}let _0x55ff41=Array['from'](_0x1298ba);while(_0x55ff41[_0x1c7818(0x16e)]>0x0){const _0xb70d44=_0x55ff41[_0x1c7818(0x10f)](_0x29d8dd=>!_0x5b7af0['has'](_0x29d8dd));if(_0xb70d44[_0x1c7818(0x16e)]===0x0)break;const _0x4cc79b=await _0x163f50(_0xb70d44,async _0x135217=>{const _0x521726=_0x1c7818;_0x5b7af0[_0x521726(0x15e)](_0x135217);const _0xb7d5cb=await fetchSegment(_0x495b32,_0x460735,_0x135217,_0x2f16b1);if(!_0xb7d5cb)return null;return{'segmentId':_0x135217,'segment':_0xb7d5cb};},0xa),_0x557cc7=new Set();for(const _0x254392 of _0x4cc79b){if(!_0x254392?.[_0x1c7818(0x1ac)]?.[_0x1c7818(0x108)])continue;const _0x37119e=apiRuleToYaml(_0x254392[_0x1c7818(0x1ac)]['rule']);_0x81f3e8['set'](_0x254392[_0x1c7818(0x182)],_0x37119e);const _0x4fe3c2=collectSegmentRefsFromRule(_0x37119e);for(const _0x57cf05 of _0x4fe3c2){!_0x5b7af0[_0x1c7818(0x1ad)](_0x57cf05)&&_0x557cc7[_0x1c7818(0x15e)](_0x57cf05);}}_0x55ff41=Array[_0x1c7818(0x118)](_0x557cc7);}};return{'createYamlContext':_0x2a359d,'prefetchJourneySegments':_0x3872f6};}export async function executePushSegments(_0x290d4d,_0xd3a484,_0x5a2aa5,_0x3594ad,_0x3d6eed){const _0x2b8595=a140_0x2f0267,{segmentDefToCreateRequest:_0x46fb56,segmentDefToUpdateRequest:_0xdba6a7}=await import(_0x2b8595(0x19b)),_0x119b04=_0x5a2aa5[_0x2b8595(0x18b)],_0x467fbd=0x5,_0x16ca68=async _0x57c2e9=>{const _0x3b8980=_0x2b8595,_0x29dd54=_0x57c2e9[_0x3b8980(0xfa)]?_0x119b04[_0x3b8980(0x145)](_0x57c2e9[_0x3b8980(0xfa)]):undefined;let _0x5d516f;const _0x518294={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x3b44e3=_0x57c2e9[_0x3b8980(0x153)];if(_0x57c2e9[_0x3b8980(0x153)][_0x3b8980(0x108)]){const _0xb6c0cf=createSegmentIdResolver(_0x5a2aa5[_0x3b8980(0x1d4)],_0x57c2e9['yamlConfig'][_0x3b8980(0x19f)]),_0x3ca544=await resolveRuleSegmentIds(_0x57c2e9[_0x3b8980(0x153)][_0x3b8980(0x108)],_0xb6c0cf);_0x3b44e3={..._0x57c2e9['yamlConfig'],'rule':_0x3ca544};}try{if(_0x57c2e9['isNew']){_0x3d6eed[_0x3b8980(0x148)]?.({'type':_0x3b8980(0x13a),'name':_0x57c2e9[_0x3b8980(0x153)][_0x3b8980(0x19f)]});const _0x598b7f=_0x46fb56(_0x3b44e3,_0x29dd54),_0x4aada1=await _0x3d6eed['withProgress']('Creating\x20segment\x20\x27'+_0x57c2e9[_0x3b8980(0x153)][_0x3b8980(0x19f)]+_0x3b8980(0x105),()=>_0x290d4d[_0x3b8980(0x1ac)][_0x3b8980(0x157)](_0x3594ad[_0x3b8980(0x1b1)],_0x598b7f));_0x5d516f=_0x4aada1['data']['id'],_0x5a2aa5[_0x3b8980(0x1d4)][_0x3b8980(0x1de)](_0x57c2e9[_0x3b8980(0x153)][_0x3b8980(0x19f)],_0x5d516f),_0x518294[_0x3b8980(0xfe)]={'name':_0x57c2e9['yamlConfig']['name'],'id':_0x5d516f},_0x3d6eed[_0x3b8980(0x148)]?.({'type':'segment_created','name':_0x57c2e9[_0x3b8980(0x153)][_0x3b8980(0x19f)],'segmentId':_0x5d516f}),_0x3d6eed[_0x3b8980(0x180)]?.(_0x3b8980(0x13f)+_0x57c2e9[_0x3b8980(0x153)]['name']+'\x27'),_0x518294['created']=0x1;}else{if(_0x57c2e9[_0x3b8980(0x1b9)]){_0x3d6eed[_0x3b8980(0x148)]?.({'type':_0x3b8980(0x1ba),'name':_0x57c2e9[_0x3b8980(0x153)][_0x3b8980(0x19f)]});const _0x1b7d68=_0xdba6a7(_0x3b44e3);_0x29dd54!==_0x57c2e9[_0x3b8980(0x139)]?.['segmentFolderId']&&(_0x1b7d68[_0x3b8980(0x1e9)]=_0x29dd54?parseInt(_0x29dd54,0xa):undefined),await _0x3d6eed[_0x3b8980(0x102)]('Updating\x20segment\x20\x27'+_0x57c2e9[_0x3b8980(0x153)][_0x3b8980(0x19f)]+_0x3b8980(0x105),()=>_0x290d4d['segment'][_0x3b8980(0x11c)](_0x3594ad[_0x3b8980(0x1b1)],_0x57c2e9[_0x3b8980(0x139)]['id'],_0x1b7d68)),_0x5d516f=_0x57c2e9[_0x3b8980(0x139)]['id'],_0x3d6eed[_0x3b8980(0x148)]?.({'type':_0x3b8980(0x10d),'name':_0x57c2e9[_0x3b8980(0x153)][_0x3b8980(0x19f)]}),_0x3d6eed['logSuccess']?.(_0x3b8980(0x1d5)+_0x57c2e9[_0x3b8980(0x153)]['name']+'\x27'),_0x518294[_0x3b8980(0xf3)]=0x1;}else _0x5d516f=_0x57c2e9[_0x3b8980(0x139)]['id'];}}catch(_0x3f5c53){const _0x17644e=isHttp400Error(_0x3f5c53),_0x29f649=_0x17644e?ErrorCode[_0x3b8980(0x11a)]:ErrorCode['SEGMENT_UPDATE_ERROR'],_0x31e707=getErrorMessage(_0x3f5c53);throw new SDKError(_0x29f649,_0x3b8980(0x1ec)+(_0x57c2e9['isNew']?_0x3b8980(0xf9):'update')+_0x3b8980(0x15a)+_0x57c2e9[_0x3b8980(0x15d)]+_0x3b8980(0x1b3)+_0x31e707,_0x3f5c53);}try{const _0x6bfbf9=await syncActivationsForSegment(_0x290d4d,_0x3594ad[_0x3b8980(0x1b1)],_0x5d516f,_0x57c2e9[_0x3b8980(0x153)][_0x3b8980(0x19f)],_0x57c2e9[_0x3b8980(0x1e1)],_0x3d6eed,_0x57c2e9[_0x3b8980(0x15d)]);_0x518294[_0x3b8980(0x1da)]=_0x6bfbf9;}catch(_0x269454){if(_0x269454 instanceof SDKError)throw _0x269454;throw new SDKError(ErrorCode[_0x3b8980(0x1b0)],_0x3b8980(0x12c)+_0x57c2e9['yamlConfig']['name']+'\x27\x20from\x20file:\x20'+_0x57c2e9[_0x3b8980(0x15d)]+'\x0a\x20\x20'+getErrorMessage(_0x269454),_0x269454);}return _0x518294;},_0x3f6476=await batchAsync(_0xd3a484,_0x16ca68,_0x467fbd),_0x4199e6={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x2d2db4 of _0x3f6476){_0x4199e6['created']+=_0x2d2db4[_0x2b8595(0x12f)],_0x4199e6['updated']+=_0x2d2db4['updated'],_0x2d2db4[_0x2b8595(0xfe)]&&_0x4199e6[_0x2b8595(0x150)][_0x2b8595(0x1de)](_0x2d2db4[_0x2b8595(0xfe)][_0x2b8595(0x19f)],_0x2d2db4[_0x2b8595(0xfe)]['id']),_0x4199e6[_0x2b8595(0x1da)][_0x2b8595(0x12f)]+=_0x2d2db4[_0x2b8595(0x1da)][_0x2b8595(0x12f)],_0x4199e6[_0x2b8595(0x1da)][_0x2b8595(0xf3)]+=_0x2d2db4[_0x2b8595(0x1da)][_0x2b8595(0xf3)],_0x4199e6['activations'][_0x2b8595(0xf8)]+=_0x2d2db4['activations'][_0x2b8595(0xf8)];}return _0x4199e6;}async function syncActivationsForSegment(_0xeb1abf,_0x56fcd6,_0x2a1b01,_0x1ee9f7,_0x18fc64,_0x82b901,_0x19ac64){const _0x59ab76=a140_0x2f0267,_0x1cbdb8={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x344e59 of _0x18fc64){try{if(_0x344e59[_0x59ab76(0x17e)]==='create'&&_0x344e59[_0x59ab76(0x1e6)])_0x82b901[_0x59ab76(0x148)]?.({'type':_0x59ab76(0x1ed),'segmentName':_0x1ee9f7,'activationName':_0x344e59['name']}),await _0x82b901[_0x59ab76(0x102)]('Creating\x20activation\x20\x27'+_0x344e59[_0x59ab76(0x19f)]+_0x59ab76(0x105),()=>_0xeb1abf[_0x59ab76(0x1ac)][_0x59ab76(0x172)](_0x56fcd6,_0x2a1b01,_0x344e59['validatedRequest'])),_0x82b901[_0x59ab76(0x148)]?.({'type':_0x59ab76(0x137),'segmentName':_0x1ee9f7,'activationName':_0x344e59['name']}),_0x82b901[_0x59ab76(0x180)]?.(_0x59ab76(0xef)+_0x344e59[_0x59ab76(0x19f)]+'\x27'),_0x1cbdb8['created']++;else{if(_0x344e59[_0x59ab76(0x17e)]===_0x59ab76(0x127)&&_0x344e59[_0x59ab76(0x1e6)]&&_0x344e59[_0x59ab76(0x1e5)])_0x82b901[_0x59ab76(0x148)]?.({'type':_0x59ab76(0x160),'segmentName':_0x1ee9f7,'activationName':_0x344e59[_0x59ab76(0x19f)]}),await _0x82b901['withProgress'](_0x59ab76(0x189)+_0x344e59[_0x59ab76(0x19f)]+_0x59ab76(0x105),()=>_0xeb1abf[_0x59ab76(0x1ac)][_0x59ab76(0x164)](_0x56fcd6,_0x2a1b01,_0x344e59['existingActivation']['id'],_0x344e59[_0x59ab76(0x1e6)])),_0x82b901['onProgress']?.({'type':'activation_updated','segmentName':_0x1ee9f7,'activationName':_0x344e59['name']}),_0x82b901['logSuccess']?.(_0x59ab76(0x170)+_0x344e59['name']+'\x27'),_0x1cbdb8[_0x59ab76(0xf3)]++;else _0x344e59['type']==='delete'&&_0x344e59[_0x59ab76(0x1e5)]&&(_0x82b901['onProgress']?.({'type':'activation_deleting','segmentName':_0x1ee9f7,'activationName':_0x344e59[_0x59ab76(0x19f)]}),await _0x82b901['withProgress'](_0x59ab76(0x19e)+_0x344e59[_0x59ab76(0x19f)]+_0x59ab76(0x105),()=>_0xeb1abf['segment']['deleteActivation'](_0x56fcd6,_0x2a1b01,_0x344e59[_0x59ab76(0x1e5)]['id'])),_0x82b901[_0x59ab76(0x148)]?.({'type':_0x59ab76(0x1a8),'segmentName':_0x1ee9f7,'activationName':_0x344e59[_0x59ab76(0x19f)]}),_0x82b901['logDeleted']?.(_0x59ab76(0x10e)+_0x344e59['name']+'\x27'),_0x1cbdb8[_0x59ab76(0xf8)]++);}}catch(_0xd3d8e0){const _0x257abf=isHttp400Error(_0xd3d8e0),_0x13dbe5=_0x257abf?ErrorCode[_0x59ab76(0x1c0)]:ErrorCode[_0x59ab76(0x1b0)],_0x5a77b6=getErrorMessage(_0xd3d8e0);throw new SDKError(_0x13dbe5,_0x59ab76(0x1ec)+_0x344e59[_0x59ab76(0x17e)]+'\x20activation\x20\x27'+_0x344e59['name']+_0x59ab76(0x152)+_0x19ac64+_0x59ab76(0x1b3)+_0x5a77b6,_0xd3d8e0);}}return _0x1cbdb8;}export async function executePushFolders(_0x5ada5b,_0x2a7111,_0x2d4e40,_0x240420,_0xf817d){const _0x3331d6=a140_0x2f0267,_0x478b3f=new Map(_0x2d4e40),_0x9a08cf=sortFoldersByDepth(_0x2a7111);for(const _0x413f1e of _0x9a08cf){const _0x490e76=_0x413f1e[_0x3331d6(0x14c)]('/'),_0x133ff3=_0x490e76[_0x490e76[_0x3331d6(0x16e)]-0x1],_0x3be948=_0x490e76[_0x3331d6(0x144)](0x0,-0x1)['join']('/'),_0x491c13=_0x478b3f['get'](_0x3be948);_0xf817d['onProgress']?.({'type':_0x3331d6(0x15b),'folder':_0x413f1e});const _0x158448={'name':_0x133ff3,'parentFolderId':_0x491c13},_0x58800d=await _0xf817d[_0x3331d6(0x102)]('Creating\x20folder\x20\x27'+_0x413f1e+_0x3331d6(0x105),()=>_0x5ada5b[_0x3331d6(0x1ac)][_0x3331d6(0x1bc)](_0x240420['parentId'],_0x158448));_0x478b3f['set'](_0x413f1e,_0x58800d['data']['id']),_0xf817d[_0x3331d6(0x148)]?.({'type':_0x3331d6(0x1c6),'folder':_0x413f1e,'folderId':_0x58800d[_0x3331d6(0x1a9)]['id']}),_0xf817d[_0x3331d6(0x1be)]?.(_0x3331d6(0x1c7)+_0x413f1e+'\x27');}return _0x478b3f;}export async function executePushSegmentDeletions(_0xc32298,_0x53aec6,_0x25b17d){const _0x39b1c8=a140_0x2f0267;if(_0x53aec6['length']===0x0)return 0x0;const {batchAsync:_0x54b3c0}=await import('../../utils/async.js'),_0x58a24b=0x5,_0x398146=await _0x54b3c0(_0x53aec6,async _0x30fcb5=>{const _0x1bf663=a140_0xd647;return _0x25b17d[_0x1bf663(0x148)]?.({'type':'segment_deleting','name':_0x30fcb5[_0x1bf663(0x19f)]}),await _0xc32298['segment'][_0x1bf663(0x191)](_0x30fcb5['id']),_0x25b17d[_0x1bf663(0x148)]?.({'type':_0x1bf663(0x1c8),'name':_0x30fcb5['name']}),_0x25b17d['logDeleted']?.(_0x1bf663(0x168)+_0x30fcb5[_0x1bf663(0x19f)]+'\x27'),0x1;},_0x58a24b);return _0x398146[_0x39b1c8(0x138)]((_0x2bf110,_0x5d21eb)=>_0x2bf110+_0x5d21eb,0x0);}export async function executePushJourneys(_0x314109,_0x25699c,_0x41ac71,_0x339764,_0x4bdfbd){const _0x554d3f=a140_0x2f0267,{journeyDefToRequest:_0x334bc0}=await import(_0x554d3f(0x113)),{activationDefToCreateRequest:_0x35afa1,yamlRuleToApi:_0x56f911,validateSegmentRule:_0x151f3a}=await import(_0x554d3f(0x19b)),_0x48eda0={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x2a7162=new Map(_0x41ac71[_0x554d3f(0x1d4)]),_0xb2f841=0x5;for(let _0x340ff0=0x0;_0x340ff0<_0x25699c[_0x554d3f(0x16e)];_0x340ff0+=_0xb2f841){const _0x49db6d=_0x25699c['slice'](_0x340ff0,_0x340ff0+_0xb2f841),_0x370695=await Promise['all'](_0x49db6d['map'](async _0xa5a79=>{const _0x4a83af=_0x554d3f;if(!_0xa5a79[_0x4a83af(0x11d)]&&!_0xa5a79['hasChanges'])return{'action':'unchanged','name':_0xa5a79[_0x4a83af(0x153)][_0x4a83af(0x19f)],'journeyId':_0xa5a79['existingJourney']?.['id']};const _0x2e296c=_0xa5a79[_0x4a83af(0xfa)]?_0x41ac71[_0x4a83af(0x18b)][_0x4a83af(0x145)](_0xa5a79[_0x4a83af(0xfa)]):undefined;_0x4bdfbd[_0x4a83af(0x148)]?.({'type':_0xa5a79[_0x4a83af(0x11d)]?'journey_creating':_0x4a83af(0x16c),'name':_0xa5a79[_0x4a83af(0x153)][_0x4a83af(0x19f)]});try{const _0x315de2=await executeSingleJourneyPush(_0x314109,_0xa5a79,{..._0x41ac71,'segmentNameToId':_0x2a7162},{'parentId':_0x339764[_0x4a83af(0x1b1)],'rootFolderId':_0x339764[_0x4a83af(0x1f3)],'folderId':_0x2e296c,'verbose':_0x339764[_0x4a83af(0x11f)]},_0x4bdfbd,{'journeyDefToRequest':_0x334bc0,'activationDefToCreateRequest':_0x35afa1,'yamlRuleToApi':_0x56f911,'validateSegmentRule':_0x151f3a});for(const [_0x4e4e36,_0x228307]of _0x315de2[_0x4a83af(0xf2)]){_0x2a7162[_0x4a83af(0x1de)](_0x4e4e36,_0x228307),_0x48eda0[_0x4a83af(0xf2)][_0x4a83af(0x1de)](_0x4e4e36,_0x228307);}if(_0x315de2[_0x4a83af(0x14e)]===_0x4a83af(0x12f))_0x4bdfbd[_0x4a83af(0x148)]?.({'type':_0x4a83af(0x1c2),'name':_0xa5a79[_0x4a83af(0x153)][_0x4a83af(0x19f)],'journeyId':_0x315de2[_0x4a83af(0x1a5)]}),_0x4bdfbd['logSuccess']?.('Created\x20journey\x20\x27'+_0xa5a79[_0x4a83af(0x153)][_0x4a83af(0x19f)]+'\x27'),_0x48eda0[_0x4a83af(0x12f)]++;else _0x315de2[_0x4a83af(0x14e)]===_0x4a83af(0xf3)&&(_0x4bdfbd[_0x4a83af(0x148)]?.({'type':_0x4a83af(0x14a),'name':_0xa5a79[_0x4a83af(0x153)][_0x4a83af(0x19f)]}),_0x4bdfbd[_0x4a83af(0x180)]?.(_0x4a83af(0x1d0)+_0xa5a79[_0x4a83af(0x153)][_0x4a83af(0x19f)]+'\x27'),_0x48eda0[_0x4a83af(0xf3)]++);return{'action':_0x315de2[_0x4a83af(0x14e)],'name':_0xa5a79[_0x4a83af(0x153)][_0x4a83af(0x19f)],'journeyId':_0x315de2[_0x4a83af(0x1a5)]};}catch(_0x1bc4ac){const _0x4013ae=isHttp400Error(_0x1bc4ac),_0xc8327c=_0x4013ae?ErrorCode[_0x4a83af(0x1f2)]:ErrorCode[_0x4a83af(0x1ae)],_0x579e35=getErrorMessage(_0x1bc4ac);throw new SDKError(_0xc8327c,_0x4a83af(0x1ec)+(_0xa5a79[_0x4a83af(0x11d)]?'create':_0x4a83af(0x127))+_0x4a83af(0x175)+_0xa5a79[_0x4a83af(0x15d)]+_0x4a83af(0x1b3)+_0x579e35,_0x1bc4ac);}}));_0x48eda0['results'][_0x554d3f(0x17a)](..._0x370695);}return _0x48eda0;}async function matchExistingJourneySegments(_0x5b6738,_0x160300,_0x50ec4a,_0x5cdb51,_0x46d149){const _0x6a6a8b=a140_0x2f0267;if(!_0x160300[_0x6a6a8b(0x134)]||!_0x160300['yamlConfig'][_0x6a6a8b(0x1d8)])return;const _0xd092fb=new Map(),_0xd95adf=new Set();for(const _0x16776b of Object[_0x6a6a8b(0x1ea)](_0x160300['yamlConfig'][_0x6a6a8b(0x1d8)])){const _0x49808f=generateDeterministicJourneySegmentName(_0x160300['yamlConfig'][_0x6a6a8b(0x19f)],_0x16776b);_0xd092fb[_0x6a6a8b(0x1de)](_0x49808f,_0x16776b),_0xd95adf[_0x6a6a8b(0x15e)](_0x16776b);}const _0x1875a0=[],_0x25f3c5=collectSegmentIdsFromJourneyApi(_0x160300[_0x6a6a8b(0x134)]);for(const _0x5c4b64 of _0x25f3c5){const _0x40c8b1=await fetchSegment(_0x5b6738,_0x50ec4a,_0x5c4b64,_0x5cdb51);if(!_0x40c8b1?.[_0x6a6a8b(0x19f)])continue;const _0x183913=_0xd092fb[_0x6a6a8b(0x145)](_0x40c8b1['name']);_0x183913?(_0x46d149[_0x6a6a8b(0x1de)](_0x183913,_0x5c4b64),_0xd95adf['delete'](_0x183913)):_0x1875a0[_0x6a6a8b(0x17a)]({'id':_0x5c4b64,'seg':_0x40c8b1});}if(_0xd95adf['size']>0x0&&_0x1875a0[_0x6a6a8b(0x16e)]>0x0){const {localExpandedRuleToNames:_0x11a8c0}=buildLocalExpandedRuleMappings(_0x160300[_0x6a6a8b(0x153)]),_0x6b937f=new Map();for(const {id:_0x5772a2,seg:_0x34c6b3}of _0x1875a0){if(_0x34c6b3[_0x6a6a8b(0x108)]){const _0x1e38d0=apiRuleToYaml(_0x34c6b3['rule']);_0x6b937f['set'](_0x5772a2,_0x1e38d0);}}for(const {id:_0x280d6a,seg:_0x2bcfd7}of _0x1875a0){if(!_0x2bcfd7['rule'])continue;const _0x518ee5=_0x6b937f[_0x6a6a8b(0x145)](_0x280d6a);if(!_0x518ee5)continue;const _0x2237df=serializeExpandedRule(_0x518ee5,_0x6b937f),_0x55aeff=_0x11a8c0[_0x6a6a8b(0x145)](_0x2237df);if(_0x55aeff){const _0xeb61cc=_0x55aeff[_0x6a6a8b(0x1e0)](_0x1a23ef=>_0xd95adf['has'](_0x1a23ef));_0xeb61cc&&(_0x46d149[_0x6a6a8b(0x1de)](_0xeb61cc,_0x280d6a),_0xd95adf[_0x6a6a8b(0x1bf)](_0xeb61cc),logger['debug'](_0x6a6a8b(0xf0)+_0x2bcfd7[_0x6a6a8b(0x19f)]+'\x27\x20to\x20local\x20\x27'+_0xeb61cc+_0x6a6a8b(0x1ce)));}}}}async function executeSingleJourneyPush(_0x18de07,_0x53f463,_0x1ee7f2,_0xc81d18,_0x44671e,_0x1b8fc0){const _0x521eb2=a140_0x2f0267,{journeyDefToRequest:_0x1389ac,activationDefToCreateRequest:_0x4b3fb7,yamlRuleToApi:_0x30a330,validateSegmentRule:_0x13cc5b}=_0x1b8fc0,_0x5c389d=new Map(),_0x20103f=new Map();recoverSegmentIdsFromPushRecovery(_0x53f463,_0x5c389d,_0x1ee7f2[_0x521eb2(0x1d4)]);const _0x5ad4bd=new Map(),_0x214bf2=new Map(),_0x5ba7f6=new Map();let _0x2019a1;const _0x3557f0=async()=>{const _0x11675e=_0x521eb2;if(_0x2019a1)return;_0x2019a1=new Map();if(!_0x53f463['existingJourney'])return;const _0xa2f8fb=await _0x18de07[_0x11675e(0x115)][_0x11675e(0x109)](_0x53f463[_0x11675e(0x134)]['id']);for(const _0x1a37e3 of _0xa2f8fb){const _0x434a01=journeyActivationStepToYaml(_0x1a37e3,_0x1ee7f2[_0x11675e(0x11b)],_0x1ee7f2[_0x11675e(0x1a2)]),_0x503d83=activationSignature(_0x434a01);!_0x2019a1[_0x11675e(0x1ad)](_0x503d83)&&_0x2019a1[_0x11675e(0x1de)](_0x503d83,_0x1a37e3['id']),_0x434a01[_0x11675e(0x19f)]&&_0x20103f['set'](_0x434a01['name'],_0x1a37e3['id']);}};await matchExistingJourneySegments(_0x18de07,_0x53f463,_0xc81d18[_0x521eb2(0x1b1)],_0x1ee7f2['existingSegments'],_0x1ee7f2[_0x521eb2(0x1d4)]);const _0xa33b2e={'resolveSegmentId':async _0x102374=>{const _0x477916=_0x521eb2,_0x543771=_0x1ee7f2[_0x477916(0x1d4)][_0x477916(0x145)](_0x102374);if(!_0x543771)throw new SDKError(ErrorCode[_0x477916(0x140)],_0x477916(0x19c)+_0x102374+_0x477916(0x1d2)+_0x53f463[_0x477916(0x153)][_0x477916(0x19f)]+')');return _0x543771;},'resolveEmbeddedSegmentId':async(_0x332a76,_0x37db4b)=>{const _0x5e3fbc=_0x521eb2,_0xd4a563=_0x1ee7f2[_0x5e3fbc(0x1d4)][_0x5e3fbc(0x145)](_0x332a76);if(_0xd4a563)return _0xd4a563;const _0x4aae61=_0x1ee7f2[_0x5e3fbc(0x18e)][_0x5e3fbc(0x1e0)](_0x108d69=>_0x108d69[_0x5e3fbc(0x19f)]===_0x332a76);if(_0x4aae61)return _0x1ee7f2[_0x5e3fbc(0x1d4)]['set'](_0x332a76,_0x4aae61['id']),_0x4aae61['id'];if(_0x53f463[_0x5e3fbc(0x11d)]){const {stageName:_0x233d4b,criteriaName:_0x39eacb}=findSegmentCriteriaLocation(_0x53f463[_0x5e3fbc(0x153)],_0x332a76);return _0x13cc5b(_0x332a76,_0x37db4b[_0x5e3fbc(0x108)]),_0x214bf2[_0x5e3fbc(0x1de)](_0x332a76,{'definition':_0x37db4b,'stageName':_0x233d4b,'criteriaName':_0x39eacb}),createPendingSegmentId(_0x332a76);}const _0xe31e0c=_0x53f463['existingJourney']?.['id'];if(!_0xe31e0c)throw new SDKError(ErrorCode[_0x5e3fbc(0x188)],_0x5e3fbc(0x167));const _0x2d7fe3=_0x5ad4bd[_0x5e3fbc(0x145)](_0x332a76);if(_0x2d7fe3)return _0x2d7fe3;const _0xa33357=((async()=>{const _0x2db2a4=_0x5e3fbc;_0x13cc5b(_0x332a76,_0x37db4b[_0x2db2a4(0x108)]);const _0x194999=generateDeterministicJourneySegmentName(_0x53f463[_0x2db2a4(0x153)][_0x2db2a4(0x19f)],_0x332a76),_0xdc51d8=_0x1ee7f2[_0x2db2a4(0x18e)][_0x2db2a4(0x1e0)](_0x4e0785=>_0x4e0785[_0x2db2a4(0x19f)]===_0x194999),_0x41ddef=createSegmentIdResolver(_0x1ee7f2[_0x2db2a4(0x1d4)],_0x332a76),_0xa1be77=await resolveRuleSegmentIds(_0x37db4b[_0x2db2a4(0x108)],_0x41ddef);let _0x13194a;return _0xdc51d8?(await _0x18de07[_0x2db2a4(0x1ac)][_0x2db2a4(0x11c)](_0xc81d18[_0x2db2a4(0x1b1)],_0xdc51d8['id'],{'description':_0x37db4b[_0x2db2a4(0x1c3)]||_0x2db2a4(0x14f)+_0x332a76,'rule':_0x30a330(_0xa1be77,!![]),'countPopulation':!![]}),_0x13194a=_0xdc51d8['id'],saveSegmentToPushRecovery(_0x53f463[_0x2db2a4(0x15d)],_0x53f463[_0x2db2a4(0x153)][_0x2db2a4(0x19f)],_0x332a76,{'segmentId':_0x13194a,'uniqueServerName':_0x194999,'createdAt':new Date()[_0x2db2a4(0x131)]()})):_0x13194a=await createOrRecoverEmbeddedSegment(_0x18de07,_0x53f463,{'localName':_0x332a76,'uniqueSegmentName':_0x194999,'description':_0x37db4b['description']||'Entry\x20criteria:\x20'+_0x332a76,'journeyId':_0xe31e0c,'resolvedRule':_0xa1be77,'parentId':_0xc81d18[_0x2db2a4(0x1b1)],'folderId':_0xc81d18['rootFolderId']||''},_0x30a330),_0x1ee7f2[_0x2db2a4(0x1d4)][_0x2db2a4(0x1de)](_0x332a76,_0x13194a),_0x5c389d[_0x2db2a4(0x1de)](_0x332a76,_0x13194a),_0x13194a;})());_0x5ad4bd['set'](_0x332a76,_0xa33357);try{return await _0xa33357;}finally{_0x5ad4bd[_0x5e3fbc(0x1bf)](_0x332a76);}},'resolveActivationId':async _0x34c514=>{const _0x2e3998=_0x521eb2,_0x59f086=_0x20103f[_0x2e3998(0x145)](_0x34c514);if(_0x59f086)return _0x59f086;if(_0x53f463[_0x2e3998(0x134)]){await _0x3557f0();const _0x2b74ce=_0x20103f[_0x2e3998(0x145)](_0x34c514);if(_0x2b74ce)return _0x2b74ce;}throw new SDKError(ErrorCode[_0x2e3998(0x10c)],'Activation\x20not\x20found:\x20'+_0x34c514+'\x20(referenced\x20in\x20journey\x20'+_0x53f463[_0x2e3998(0x153)][_0x2e3998(0x19f)]+_0x2e3998(0x106)+_0x2e3998(0x101));},'resolveEmbeddedActivationId':async(_0x35bdad,_0x2ca194)=>{const _0x318e69=_0x521eb2,_0x30c39c=_0x20103f[_0x318e69(0x145)](_0x35bdad);if(_0x30c39c)return _0x30c39c;if(_0x53f463[_0x318e69(0x11d)])return _0x5ba7f6[_0x318e69(0x1de)](_0x35bdad,_0x2ca194),createPendingActivationId(_0x35bdad);if(_0x53f463['existingJourney']){await _0x3557f0();const _0xba41c7=_0x20103f['get'](_0x2ca194[_0x318e69(0x19f)]);if(_0xba41c7)return _0x20103f[_0x318e69(0x1de)](_0x35bdad,_0xba41c7),_0xba41c7;const _0x32f99d=activationSignature(_0x2ca194),_0x308beb=_0x2019a1?.[_0x318e69(0x145)](_0x32f99d);if(_0x308beb)return _0x20103f[_0x318e69(0x1de)](_0x35bdad,_0x308beb),_0x308beb;const _0x38154a=await _0x4b3fb7(_0x2ca194,_0x1ee7f2[_0x318e69(0x135)]),_0x33d9e5={..._0x38154a,..._0x2ca194[_0x318e69(0x1e8)]!==undefined&&{'runAfterJourneyRefresh':_0x2ca194[_0x318e69(0x1e8)]}},_0x34375a=await _0x18de07[_0x318e69(0x115)][_0x318e69(0x172)](_0x53f463[_0x318e69(0x134)]['id'],_0x33d9e5);return _0x20103f['set'](_0x35bdad,_0x34375a['id']),_0x34375a['id'];}throw new SDKError(ErrorCode['INTERNAL'],_0x318e69(0x179));},'resolveJourneyId':async _0x38dd7b=>{const _0x4bcaee=_0x521eb2;try{return await _0x18de07[_0x4bcaee(0x115)][_0x4bcaee(0x199)](_0xc81d18[_0x4bcaee(0x1b1)],_0x38dd7b);}catch(_0x2e8093){throw new SDKError(ErrorCode[_0x4bcaee(0x10c)],'Journey\x20\x27'+_0x38dd7b+_0x4bcaee(0x16f)+_0x53f463[_0x4bcaee(0x153)][_0x4bcaee(0x19f)]+'\x27)',_0x2e8093);}},'resolveStageId':async(_0x2c0604,_0x32b600)=>{const _0x2c370c=_0x521eb2,_0x49d114=await _0x18de07[_0x2c370c(0x115)][_0x2c370c(0x110)](_0x2c0604),_0x285e66=_0x49d114[_0x2c370c(0x136)][_0x2c370c(0x1e4)][_0x2c370c(0x1e0)](_0x10155c=>_0x10155c[_0x2c370c(0x19f)][_0x2c370c(0x1aa)]()===_0x32b600[_0x2c370c(0x1aa)]());if(!_0x285e66?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],_0x2c370c(0x103)+_0x32b600+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x49d114[_0x2c370c(0x136)][_0x2c370c(0x1b4)]||_0x49d114[_0x2c370c(0x136)][_0x2c370c(0x19f)])+'\x27');return _0x285e66['id'];}},_0x1bcdd3=await _0x1389ac(_0x53f463[_0x521eb2(0x153)],_0xc81d18[_0x521eb2(0x1b1)],_0xa33b2e),_0x701be5=_0xc81d18['folderId']||_0xc81d18[_0x521eb2(0x1f3)];_0x701be5&&(_0x1bcdd3[_0x521eb2(0xfb)]={'parentFolder':{'data':{'id':_0x701be5,'type':_0x521eb2(0x1d3)}}});if(_0x53f463[_0x521eb2(0x11d)]){if(_0x214bf2[_0x521eb2(0x10b)]>0x0||_0x5ba7f6[_0x521eb2(0x10b)]>0x0)return await executeThreeStepJourneyCreate(_0x18de07,_0x53f463,_0x1bcdd3,{'pendingEmbeddedSegments':_0x214bf2,'pendingEmbeddedActivations':_0x5ba7f6,'embeddedSegmentNameToId':_0x5c389d,'journeyActivationNameToId':_0x20103f},{..._0xc81d18,'effectiveFolderId':_0x701be5},_0x1ee7f2,_0x44671e,_0x1b8fc0);else{ensureJourneyDefaults(_0x1bcdd3[_0x521eb2(0x136)]);const _0x43a82c=await _0x18de07[_0x521eb2(0x115)][_0x521eb2(0xf9)](_0x1bcdd3);return deletePushRecovery(_0x53f463['absolutePath']),{'action':_0x521eb2(0x12f),'journeyId':_0x43a82c['id'],'embeddedSegmentNameToId':_0x5c389d};}}else{if(_0x53f463[_0x521eb2(0x1b9)]&&_0x53f463['existingJourney']){_0x1bcdd3['id']=_0x53f463[_0x521eb2(0x134)]['id'];const _0x48c71d=_0x1bcdd3[_0x521eb2(0x136)];_0x53f463[_0x521eb2(0x134)]['attributes']?.['journeyBundleName']&&(_0x48c71d[_0x521eb2(0x1b4)]=_0x53f463[_0x521eb2(0x134)][_0x521eb2(0x136)]['journeyBundleName']);const _0x2cef9f=_0x53f463[_0x521eb2(0x134)]['attributes']?.['journeyStages'];return _0x2cef9f&&_0x1bcdd3[_0x521eb2(0x136)][_0x521eb2(0x1e4)]&&injectExistingStageIds(_0x1bcdd3[_0x521eb2(0x136)][_0x521eb2(0x1e4)],_0x2cef9f),ensureJourneyDefaults(_0x48c71d),await _0x18de07[_0x521eb2(0x115)][_0x521eb2(0x127)](_0x53f463['existingJourney']['id'],_0x1bcdd3),deletePushRecovery(_0x53f463[_0x521eb2(0x15d)]),{'action':_0x521eb2(0xf3),'journeyId':_0x53f463['existingJourney']['id'],'embeddedSegmentNameToId':_0x5c389d};}}return deletePushRecovery(_0x53f463['absolutePath']),{'action':_0x521eb2(0x149),'journeyId':_0x53f463[_0x521eb2(0x134)]?.['id'],'embeddedSegmentNameToId':_0x5c389d};}function findSegmentCriteriaLocation(_0x5b2787,_0x19fa15){const _0x150d99=a140_0x2f0267,_0x34858d=_0x5b2787[_0x150d99(0x13d)]||_0x5b2787['journeys']?.[0x0]?.[_0x150d99(0x13d)]||[];let _0x3f40b0=_0x150d99(0x1f0),_0x29f53f=_0x19fa15;const _0x449694=_0x5b2787[_0x150d99(0x1c5)]||_0x5b2787[_0x150d99(0xf5)]?.[0x0]?.[_0x150d99(0x1c5)];if(_0x449694?.['segment']===_0x19fa15)return{'stageName':_0x150d99(0x1c5),'criteriaName':_0x449694['name']||_0x19fa15};_0x5463a6:for(const _0x32f725 of _0x34858d){if(_0x32f725[_0x150d99(0x195)]?.[_0x150d99(0x1ac)]===_0x19fa15){_0x3f40b0=_0x32f725['name'],_0x29f53f=_0x32f725['entry_criteria']['name']||_0x19fa15;break;}if(_0x32f725['steps'])for(const _0x637aa4 of _0x32f725['steps']){if(_0x637aa4['type']===_0x150d99(0x17c)&&_0x637aa4[_0x150d99(0x1bd)]?.['branches'])for(const _0x2271a6 of _0x637aa4[_0x150d99(0x1bd)][_0x150d99(0x1c1)]){if(_0x2271a6[_0x150d99(0x1ac)]===_0x19fa15){_0x3f40b0=_0x32f725[_0x150d99(0x19f)],_0x29f53f=_0x2271a6[_0x150d99(0x19f)]||_0x19fa15;break _0x5463a6;}}}}return{'stageName':_0x3f40b0,'criteriaName':_0x29f53f};}async function executeThreeStepJourneyCreate(_0x2d28bf,_0x31c169,_0x109978,_0x2ca498,_0x2ce174,_0x55c27b,_0x224db0,_0x48a2cc){const _0xcee095=a140_0x2f0267,{activationDefToCreateRequest:_0x314694,yamlRuleToApi:_0x3823c2}=_0x48a2cc,{pendingEmbeddedSegments:_0x10f1a8,pendingEmbeddedActivations:_0x4342eb,embeddedSegmentNameToId:_0x5674ec}=_0x2ca498,_0x358870=JSON[_0xcee095(0x166)](JSON[_0xcee095(0x155)](_0x109978));ensureJourneyDefaults(_0x358870[_0xcee095(0x136)]),stripPendingIds(_0x358870);const _0x1d284b=await _0x2d28bf[_0xcee095(0x115)][_0xcee095(0xf9)](_0x358870),_0xe27722=_0x1d284b['id'],_0x163592=new Map();for(const _0x196d24 of _0x1d284b['attributes'][_0xcee095(0x1e4)]){_0x163592[_0xcee095(0x1de)](_0x196d24[_0xcee095(0x19f)][_0xcee095(0x1aa)](),_0x196d24['id']);}recoverSegmentIdsFromPushRecovery(_0x31c169,_0x5674ec,_0x55c27b['segmentNameToId']);for(const [_0x1399ee,{definition:_0x269a78}]of _0x10f1a8){if(_0x5674ec[_0xcee095(0x1ad)](_0x1399ee)){_0x224db0[_0xcee095(0x148)]?.({'type':'embedded_segment_created','journeyName':_0x31c169['yamlConfig'][_0xcee095(0x19f)],'segmentName':_0x1399ee});continue;}const _0x5c31ad=generateDeterministicJourneySegmentName(_0x31c169[_0xcee095(0x153)][_0xcee095(0x19f)],_0x1399ee);_0x224db0['onProgress']?.({'type':_0xcee095(0x183),'journeyName':_0x31c169[_0xcee095(0x153)]['name'],'segmentName':_0x1399ee});const _0x22e3ac=createSegmentIdResolver(_0x55c27b[_0xcee095(0x1d4)],_0x1399ee),_0x33b5eb=await resolveRuleSegmentIds(_0x269a78['rule'],_0x22e3ac),_0x56a273=await createOrRecoverEmbeddedSegment(_0x2d28bf,_0x31c169,{'localName':_0x1399ee,'uniqueSegmentName':_0x5c31ad,'description':_0x269a78['description']||_0xcee095(0x14f)+_0x1399ee,'journeyId':_0xe27722,'resolvedRule':_0x33b5eb,'parentId':_0x2ce174[_0xcee095(0x1b1)],'folderId':_0x2ce174[_0xcee095(0x1dd)]||''},_0x3823c2);_0x5674ec[_0xcee095(0x1de)](_0x1399ee,_0x56a273),_0x55c27b[_0xcee095(0x1d4)]['set'](_0x1399ee,_0x56a273),_0x224db0[_0xcee095(0x148)]?.({'type':_0xcee095(0x1cc),'journeyName':_0x31c169[_0xcee095(0x153)][_0xcee095(0x19f)],'segmentName':_0x1399ee});}const _0x562e22=new Map();for(const [_0x59b6eb,_0x3a94d3]of _0x4342eb){_0x224db0[_0xcee095(0x148)]?.({'type':'embedded_activation_creating','journeyName':_0x31c169[_0xcee095(0x153)]['name'],'activationName':_0x59b6eb});const _0x1515ae=await _0x314694(_0x3a94d3,_0x55c27b[_0xcee095(0x135)]),_0x216b3a={..._0x1515ae,..._0x3a94d3[_0xcee095(0x1e8)]!==undefined&&{'runAfterJourneyRefresh':_0x3a94d3[_0xcee095(0x1e8)]}},_0x2b206d=await _0x2d28bf['journey'][_0xcee095(0x172)](_0xe27722,_0x216b3a);_0x562e22[_0xcee095(0x1de)](_0x59b6eb,_0x2b206d['id']),_0x2ca498[_0xcee095(0x14d)][_0xcee095(0x1de)](_0x59b6eb,_0x2b206d['id']),_0x224db0['onProgress']?.({'type':_0xcee095(0x17f),'journeyName':_0x31c169[_0xcee095(0x153)]['name'],'activationName':_0x59b6eb});}const _0x20684e=JSON[_0xcee095(0x166)](JSON['stringify'](_0x109978));return _0x20684e['id']=_0xe27722,ensureJourneyDefaults(_0x20684e[_0xcee095(0x136)]),resolvePendingIdsInRequest(_0x20684e,_0x109978,_0x163592,_0x5674ec,_0x562e22,_0x224db0),await _0x2d28bf[_0xcee095(0x115)][_0xcee095(0x127)](_0xe27722,_0x20684e),deletePushRecovery(_0x31c169[_0xcee095(0x15d)]),{'action':'created','journeyId':_0xe27722,'embeddedSegmentNameToId':_0x5674ec};}export function stripWaitStepPendingIds(_0x69946e){const _0xf40100=a140_0x2f0267,_0x38d714=_0x69946e[_0xf40100(0x1d7)]&&isPendingSegmentId(_0x69946e[_0xf40100(0x1d7)]),_0x4c0366=_0x69946e[_0xf40100(0x13b)]?.[_0xf40100(0x13e)](_0x5d7dad=>_0x5d7dad[_0xf40100(0x182)]&&isPendingSegmentId(_0x5d7dad[_0xf40100(0x182)]));(_0x38d714||_0x4c0366)&&(_0x69946e[_0xf40100(0x1b8)]=_0xf40100(0x121),_0x69946e[_0xf40100(0x1ab)]=0x1,_0x69946e['waitStepUnit']=_0xf40100(0x198),delete _0x69946e[_0xf40100(0x1d7)],delete _0x69946e[_0xf40100(0x162)],delete _0x69946e['conditionTimeoutUnit'],delete _0x69946e[_0xf40100(0x13b)]);}export function resolveWaitStepPendingIds(_0x23dbc7,_0x48d32a,_0x555feb,_0x233371){const _0x460c9f=a140_0x2f0267;if(_0x48d32a[_0x460c9f(0x1d7)]&&isPendingSegmentId(_0x48d32a[_0x460c9f(0x1d7)])){const _0x5370fe=_0x555feb(_0x48d32a['conditionSegmentId'],_0x460c9f(0x1a0)+_0x233371+_0x460c9f(0x1d1));_0x5370fe&&(_0x23dbc7['waitStepType']='Condition',_0x23dbc7[_0x460c9f(0x1d7)]=_0x5370fe,delete _0x23dbc7[_0x460c9f(0x1ab)],delete _0x23dbc7[_0x460c9f(0x1e2)],_0x48d32a[_0x460c9f(0x162)]!==undefined&&(_0x23dbc7[_0x460c9f(0x162)]=_0x48d32a[_0x460c9f(0x162)]),_0x48d32a[_0x460c9f(0x14b)]&&(_0x23dbc7[_0x460c9f(0x14b)]=_0x48d32a['conditionTimeoutUnit']));}if(_0x48d32a[_0x460c9f(0x13b)]){const _0xfbf0c2=_0x48d32a[_0x460c9f(0x13b)][_0x460c9f(0x13e)](_0x323fe9=>_0x323fe9[_0x460c9f(0x182)]&&isPendingSegmentId(_0x323fe9[_0x460c9f(0x182)]));if(_0xfbf0c2){const _0x1e493f=_0x48d32a[_0x460c9f(0x13b)][_0x460c9f(0x16b)](_0xd07f51=>{const _0x30c940=_0x460c9f;if(_0xd07f51[_0x30c940(0x182)]&&isPendingSegmentId(_0xd07f51[_0x30c940(0x182)])){const _0xd8d9b4=_0x555feb(_0xd07f51['segmentId'],'stage\x20\x27'+_0x233371+'\x27\x20wait\x20condition');return{..._0xd07f51,'segmentId':_0xd8d9b4||_0xd07f51[_0x30c940(0x182)]};}return{..._0xd07f51};});_0x23dbc7[_0x460c9f(0x1b8)]='Condition',_0x23dbc7[_0x460c9f(0x13b)]=_0x1e493f,delete _0x23dbc7[_0x460c9f(0x1ab)],delete _0x23dbc7['waitStepUnit'],delete _0x23dbc7[_0x460c9f(0x1d7)],delete _0x23dbc7[_0x460c9f(0x162)],delete _0x23dbc7[_0x460c9f(0x14b)];}}}function stripPendingIds(_0x37fff1){const _0x122a31=a140_0x2f0267;_0x37fff1[_0x122a31(0x136)]['goal']?.[_0x122a31(0x182)]&&isPendingSegmentId(_0x37fff1['attributes']['goal'][_0x122a31(0x182)])&&delete _0x37fff1[_0x122a31(0x136)][_0x122a31(0x1c5)];for(const _0x414215 of _0x37fff1[_0x122a31(0x136)]['journeyStages']||[]){_0x414215[_0x122a31(0x12d)]?.['segmentId']&&isPendingSegmentId(_0x414215[_0x122a31(0x12d)]['segmentId'])&&delete _0x414215[_0x122a31(0x12d)];_0x414215['milestone']?.[_0x122a31(0x182)]&&isPendingSegmentId(_0x414215['milestone'][_0x122a31(0x182)])&&delete _0x414215[_0x122a31(0xfc)];_0x414215[_0x122a31(0x1eb)]&&(_0x414215[_0x122a31(0x1eb)]=_0x414215[_0x122a31(0x1eb)][_0x122a31(0x10f)](_0x2f7096=>!_0x2f7096[_0x122a31(0x182)]||!isPendingSegmentId(_0x2f7096['segmentId'])));if(_0x414215['steps'])for(const _0x446f1c of Object[_0x122a31(0x1ea)](_0x414215['steps'])){const _0x3423bc=_0x414215[_0x122a31(0x1b2)][_0x446f1c];_0x3423bc[_0x122a31(0x17e)]==='Activation'&&_0x3423bc[_0x122a31(0x125)]&&isPendingActivationId(_0x3423bc[_0x122a31(0x125)])&&(_0x3423bc[_0x122a31(0x125)]='');if(_0x3423bc[_0x122a31(0x17e)]==='DecisionPoint'&&_0x3423bc[_0x122a31(0x1c1)])for(const _0x1421eb of _0x3423bc[_0x122a31(0x1c1)]){_0x1421eb['segmentId']&&isPendingSegmentId(_0x1421eb[_0x122a31(0x182)])&&(_0x1421eb[_0x122a31(0x182)]='');}_0x3423bc[_0x122a31(0x17e)]===_0x122a31(0x171)&&stripWaitStepPendingIds(_0x3423bc);}}}function resolvePendingIdsInRequest(_0xec45f3,_0x2dcf35,_0x5b7945,_0x125765,_0x2206de,_0xe252e){const _0x2f5e4e=a140_0x2f0267,_0xb3d4b1=(_0x21c05e,_0x564849)=>{const _0x53fbbc=a140_0xd647;if(!isPendingSegmentId(_0x21c05e))return _0x21c05e;const _0x5b5e54=extractPendingSegmentName(_0x21c05e),_0x461f1d=_0x125765[_0x53fbbc(0x145)](_0x5b5e54);return!_0x461f1d&&_0xe252e['logWarning']?.(_0x53fbbc(0x1e7)+_0x5b5e54+_0x53fbbc(0x112)+_0x564849),_0x461f1d;};if(_0xec45f3[_0x2f5e4e(0x136)][_0x2f5e4e(0x1c5)]?.[_0x2f5e4e(0x182)]&&isPendingSegmentId(_0xec45f3[_0x2f5e4e(0x136)][_0x2f5e4e(0x1c5)][_0x2f5e4e(0x182)])){const _0x4ff349=_0xb3d4b1(_0xec45f3[_0x2f5e4e(0x136)][_0x2f5e4e(0x1c5)][_0x2f5e4e(0x182)],_0x2f5e4e(0x1af));_0x4ff349&&(_0xec45f3['attributes'][_0x2f5e4e(0x1c5)]['segmentId']=_0x4ff349);}for(const _0x243d6e of _0xec45f3['attributes'][_0x2f5e4e(0x1e4)]||[]){const _0xd0e454=_0x5b7945[_0x2f5e4e(0x145)](_0x243d6e[_0x2f5e4e(0x19f)][_0x2f5e4e(0x1aa)]());_0xd0e454&&(_0x243d6e['id']=_0xd0e454);if(_0x243d6e[_0x2f5e4e(0x12d)]?.[_0x2f5e4e(0x182)]&&isPendingSegmentId(_0x243d6e[_0x2f5e4e(0x12d)][_0x2f5e4e(0x182)])){const _0x1c1b3e=_0xb3d4b1(_0x243d6e[_0x2f5e4e(0x12d)][_0x2f5e4e(0x182)],_0x2f5e4e(0x1a0)+_0x243d6e[_0x2f5e4e(0x19f)]+_0x2f5e4e(0x123));_0x1c1b3e&&(_0x243d6e[_0x2f5e4e(0x12d)][_0x2f5e4e(0x182)]=_0x1c1b3e);}if(_0x243d6e[_0x2f5e4e(0x1eb)])for(const _0x3f413d of _0x243d6e['exitCriterias']){if(_0x3f413d['segmentId']&&isPendingSegmentId(_0x3f413d[_0x2f5e4e(0x182)])){const _0x29156f=_0xb3d4b1(_0x3f413d[_0x2f5e4e(0x182)],_0x2f5e4e(0x1a0)+_0x243d6e['name']+_0x2f5e4e(0x17b));_0x29156f&&(_0x3f413d['segmentId']=_0x29156f);}}if(_0x243d6e['milestone']?.[_0x2f5e4e(0x182)]&&isPendingSegmentId(_0x243d6e[_0x2f5e4e(0xfc)]['segmentId'])){const _0x61db8c=_0xb3d4b1(_0x243d6e[_0x2f5e4e(0xfc)]['segmentId'],_0x2f5e4e(0x1a0)+_0x243d6e['name']+_0x2f5e4e(0x1a1));_0x61db8c&&(_0x243d6e[_0x2f5e4e(0xfc)][_0x2f5e4e(0x182)]=_0x61db8c);}if(_0x243d6e['steps']){const _0x3f9d8f=_0x19ff9a=>_0x2dcf35[_0x2f5e4e(0x136)]['journeyStages']?.[_0x2f5e4e(0x1e0)](_0x5bf3dc=>_0x5bf3dc[_0x2f5e4e(0x19f)][_0x2f5e4e(0x1aa)]()===_0x243d6e[_0x2f5e4e(0x19f)][_0x2f5e4e(0x1aa)]())?.[_0x2f5e4e(0x1b2)]?.[_0x19ff9a];for(const _0x1f974c of Object[_0x2f5e4e(0x1ea)](_0x243d6e['steps'])){const _0x1d8047=_0x243d6e[_0x2f5e4e(0x1b2)][_0x1f974c],_0x339834=_0x3f9d8f(_0x1f974c);if(_0x1d8047['type']===_0x2f5e4e(0x194)&&_0x1d8047[_0x2f5e4e(0x125)]&&(isPendingActivationId(_0x1d8047[_0x2f5e4e(0x125)])||_0x1d8047[_0x2f5e4e(0x125)]==='')){if(_0x339834?.['journeyActivationStepId']&&isPendingActivationId(_0x339834[_0x2f5e4e(0x125)])){const _0x399af1=extractPendingActivationName(_0x339834['journeyActivationStepId']),_0x51fd68=_0x2206de[_0x2f5e4e(0x145)](_0x399af1);_0x51fd68&&(_0x1d8047['journeyActivationStepId']=_0x51fd68);}}if(_0x1d8047[_0x2f5e4e(0x17e)]===_0x2f5e4e(0x1db)&&_0x1d8047['branches']&&_0x339834?.[_0x2f5e4e(0x1c1)])for(let _0x33266f=0x0;_0x33266f<_0x1d8047[_0x2f5e4e(0x1c1)][_0x2f5e4e(0x16e)];_0x33266f++){const _0x1cfa72=_0x1d8047[_0x2f5e4e(0x1c1)][_0x33266f],_0xd64c38=_0x339834[_0x2f5e4e(0x1c1)][_0x33266f];if(_0xd64c38?.[_0x2f5e4e(0x182)]&&isPendingSegmentId(_0xd64c38[_0x2f5e4e(0x182)])){const _0x2b3a63=_0xb3d4b1(_0xd64c38[_0x2f5e4e(0x182)],_0x2f5e4e(0x1a0)+_0x243d6e[_0x2f5e4e(0x19f)]+_0x2f5e4e(0x119)+(_0x1cfa72[_0x2f5e4e(0x19f)]||_0x33266f)+'\x27');_0x2b3a63&&(_0x1cfa72[_0x2f5e4e(0x182)]=_0x2b3a63);}}_0x1d8047['type']===_0x2f5e4e(0x171)&&_0x339834?.[_0x2f5e4e(0x17e)]===_0x2f5e4e(0x171)&&resolveWaitStepPendingIds(_0x1d8047,_0x339834,_0xb3d4b1,_0x243d6e[_0x2f5e4e(0x19f)]);}}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x52ef2a,_0x499c82){const _0x1c6472=a141_0x4686,_0x681276=_0x52ef2a();while(!![]){try{const _0x1aec46=-parseInt(_0x1c6472(0x13f))/0x1*(parseInt(_0x1c6472(0x137))/0x2)+-parseInt(_0x1c6472(0x134))/0x3*(parseInt(_0x1c6472(0x139))/0x4)+parseInt(_0x1c6472(0x138))/0x5*(-parseInt(_0x1c6472(0x132))/0x6)+parseInt(_0x1c6472(0x135))/0x7+-parseInt(_0x1c6472(0x141))/0x8+parseInt(_0x1c6472(0x13d))/0x9+parseInt(_0x1c6472(0x13c))/0xa;if(_0x1aec46===_0x499c82)break;else _0x681276['push'](_0x681276['shift']());}catch(_0xcbec5b){_0x681276['push'](_0x681276['shift']());}}}(a141_0x3e0f,0x6128d));export function buildFolderIdToPathMap(_0x597eb6){const _0x824c7b=a141_0x4686,_0x5d7f1d=new Map(),_0x51614f=new Map();for(const _0x213a61 of _0x597eb6){_0x51614f[_0x824c7b(0x13b)](_0x213a61['id'],_0x213a61);}const _0x13a3fd=new Set();for(const _0x212e60 of _0x597eb6){!_0x212e60['parentFolderId']&&_0x13a3fd[_0x824c7b(0x136)](_0x212e60['id']);}function _0x3b0e99(_0x1ef599){const _0x250351=_0x824c7b;if(_0x5d7f1d[_0x250351(0x133)](_0x1ef599['id']))return _0x5d7f1d[_0x250351(0x13a)](_0x1ef599['id']);if(_0x13a3fd[_0x250351(0x133)](_0x1ef599['id']))return _0x5d7f1d[_0x250351(0x13b)](_0x1ef599['id'],''),'';if(_0x1ef599[_0x250351(0x140)]){const _0x166a46=_0x51614f['get'](_0x1ef599[_0x250351(0x140)]);if(_0x166a46){const _0x311802=_0x3b0e99(_0x166a46),_0x20184c=_0x311802?_0x311802+'/'+_0x1ef599['name']:_0x1ef599['name'];return _0x5d7f1d[_0x250351(0x13b)](_0x1ef599['id'],_0x20184c),_0x20184c;}}const _0x12f6d4=_0x1ef599['name'];return _0x5d7f1d[_0x250351(0x13b)](_0x1ef599['id'],_0x12f6d4),_0x12f6d4;}for(const _0x362611 of _0x597eb6){_0x3b0e99(_0x362611);}return _0x5d7f1d;}function a141_0x3e0f(){const _0x7f1ce=['688MKzEgz','get','set','3308270wzDhou','3273534HQBEwo','name','75021cQdtPM','parentFolderId','2282328Hivfnz','60gcAucy','has','4878ZOVRiQ','5137370Pdxugh','add','10cGZMzw','45215oakRdm'];a141_0x3e0f=function(){return _0x7f1ce;};return a141_0x3e0f();}export function buildFolderPathToIdMap(_0x23fa62){const _0x2a8ac9=a141_0x4686,_0x3377d7=new Map(),_0x49500b=new Map();for(const _0x2a483a of _0x23fa62){_0x49500b[_0x2a8ac9(0x13b)](_0x2a483a['id'],_0x2a483a);}const _0x3e6507=new Set();for(const _0x1584a8 of _0x23fa62){!_0x1584a8[_0x2a8ac9(0x140)]&&_0x3e6507['add'](_0x1584a8['id']);}function _0x254139(_0x321b2b){const _0x45b59f=_0x2a8ac9;if(_0x3e6507['has'](_0x321b2b['id']))return'';if(_0x321b2b[_0x45b59f(0x140)]){const _0xb90673=_0x49500b[_0x45b59f(0x13a)](_0x321b2b[_0x45b59f(0x140)]);if(_0xb90673){const _0x3de73a=_0x254139(_0xb90673);return _0x3de73a?_0x3de73a+'/'+_0x321b2b['name']:_0x321b2b[_0x45b59f(0x13e)];}}return _0x321b2b[_0x45b59f(0x13e)];}for(const _0x19f2d0 of _0x23fa62){const _0x1c3839=_0x254139(_0x19f2d0);_0x3377d7[_0x2a8ac9(0x13b)](_0x1c3839,_0x19f2d0['id']);}return _0x3377d7;}function a141_0x4686(_0x32186e,_0x30eaf3){_0x32186e=_0x32186e-0x132;const _0x3e0f44=a141_0x3e0f();let _0x468614=_0x3e0f44[_0x32186e];return _0x468614;}export function buildFolderMaps(_0x38fc33){const _0x1110b8=a141_0x4686,_0x5820ad=buildFolderIdToPathMap(_0x38fc33),_0x516290=new Map();for(const [_0x2d2bf6,_0x160d1f]of _0x5820ad){_0x516290[_0x1110b8(0x13b)](_0x160d1f,_0x2d2bf6);}return{'idToPath':_0x5820ad,'pathToId':_0x516290};}export function getFolderPath(_0x39ca52,_0x3c025a){if(!_0x39ca52)return'';return _0x3c025a['get'](_0x39ca52)??'';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x44e38e,_0x296e4a){const _0xf237e2=a142_0x413f,_0x3c8695=_0x44e38e();while(!![]){try{const _0x2078df=-parseInt(_0xf237e2(0xc1))/0x1+-parseInt(_0xf237e2(0xb3))/0x2*(-parseInt(_0xf237e2(0xcf))/0x3)+-parseInt(_0xf237e2(0xba))/0x4*(parseInt(_0xf237e2(0xc6))/0x5)+-parseInt(_0xf237e2(0xb6))/0x6+-parseInt(_0xf237e2(0xd3))/0x7+-parseInt(_0xf237e2(0xc0))/0x8+parseInt(_0xf237e2(0xd1))/0x9;if(_0x2078df===_0x296e4a)break;else _0x3c8695['push'](_0x3c8695['shift']());}catch(_0x2aa3f3){_0x3c8695['push'](_0x3c8695['shift']());}}}(a142_0x120d,0x7a3e5));import a142_0x2077b2 from'path';import{parse as a142_0x1b42d6}from'yaml';function a142_0x120d(){const _0x184249=['Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','endsWith','.yaml','join','Cannot\x20navigate\x20above\x20root','substring','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','515934wQoBVG','name','parse','3270330UToBql','exists','isAbsolute','tdx.json','493820TlqCWd','startsWith','trim','Path\x20segment\x20cannot\x20be\x20empty','raw','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','6994168wkJNZo','377438UZnvVD','journey','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','slice','Cannot\x20split\x20empty\x20path','40tXzrxs','relative','Path\x20attempts\x20to\x20navigate\x20above\x20root','Relative\x20path\x20cannot\x20be\x20empty','.yml','No\x20tdx.json\x20found\x20for\x20file:\x20','length','pop','readFile','3meMwfI','root','31699611nmoHMD','segment','3465231eviGrL','test','dirname','filter','split','push','segments'];a142_0x120d=function(){return _0x184249;};return a142_0x120d();}import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x2054f2){const _0xe6a0ca=a142_0x413f;if(!_0x2054f2||_0x2054f2['trim']()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0x4d9d54=_0x2054f2[_0xe6a0ca(0xbc)]();if(_0x4d9d54==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x2054f2};const _0x2499a3=_0x4d9d54[_0xe6a0ca(0xbb)]('/')?_0x4d9d54[_0xe6a0ca(0xb0)](0x1):_0x4d9d54,_0x282cd1=_0x2499a3[_0xe6a0ca(0xd7)]('/')[_0xe6a0ca(0xd6)](_0x20795b=>_0x20795b!=='');if(_0x282cd1[_0xe6a0ca(0xcc)]===0x0)throw new Error(_0xe6a0ca(0xbf));const _0x5d37ca=_0x4d9d54[_0xe6a0ca(0xbb)]('/')||!isRelativePathSegment(_0x282cd1[0x0]);for(const _0x119541 of _0x282cd1){validatePathSegment(_0x119541);}return{'segments':_0x282cd1,'isAbsolute':_0x5d37ca,'raw':_0x2054f2};}function isRelativePathSegment(_0x2dc549){return _0x2dc549==='.'||_0x2dc549==='..';}function validatePathSegment(_0x1e5f5f){const _0xfb72bd=a142_0x413f;if(_0x1e5f5f==='')throw new Error(_0xfb72bd(0xbd));if(_0x1e5f5f==='.'||_0x1e5f5f==='..')return;if(/[\x00-\x1F\x7F]/[_0xfb72bd(0xd4)](_0x1e5f5f))throw new Error(_0xfb72bd(0xc3)+_0x1e5f5f);if(_0x1e5f5f!==_0x1e5f5f[_0xfb72bd(0xbc)]()){}}export function validatePath(_0x3d916c){const _0x1e79f3=a142_0x413f;if(_0x3d916c[_0x1e79f3(0xaa)][_0x1e79f3(0xcc)]===0x0&&!_0x3d916c[_0x1e79f3(0xb8)])throw new Error(_0x1e79f3(0xc9));if(_0x3d916c[_0x1e79f3(0xb8)]){if(_0x3d916c[_0x1e79f3(0xaa)][0x0]==='..')throw new Error('Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22');let _0x21a9aa=0x0;for(const _0x136ca8 of _0x3d916c[_0x1e79f3(0xaa)]){if(_0x136ca8==='..'){if(_0x21a9aa===0x0)throw new Error(_0x1e79f3(0xc8));_0x21a9aa--;}else _0x136ca8!=='.'&&_0x21a9aa++;}}}export function joinPaths(_0x3852f3,_0xe25ad5){const _0x250aed=a142_0x413f;if(!_0x3852f3||_0x3852f3==='/')return _0xe25ad5;if(!_0xe25ad5||_0xe25ad5==='.')return _0x3852f3;if(_0xe25ad5[_0x250aed(0xbb)]('/'))return _0xe25ad5;const _0x2c7365=parsePath(_0x3852f3),_0x35991d=parsePath(_0xe25ad5),_0x1741f2=[..._0x2c7365[_0x250aed(0xaa)]];for(const _0x222ecc of _0x35991d['segments']){if(_0x222ecc==='.')continue;else{if(_0x222ecc==='..'){if(_0x1741f2[_0x250aed(0xcc)]===0x0)throw new Error(_0x250aed(0xaf));_0x1741f2[_0x250aed(0xcd)]();}else _0x1741f2['push'](_0x222ecc);}}const _0x1fae16=_0x1741f2[_0x250aed(0xae)]('/');return _0x2c7365['raw']['startsWith']('/')?'/'+_0x1fae16:_0x1fae16;}export function normalizePath(_0x377dcb){const _0x4bd7b3=a142_0x413f,_0x5837aa=parsePath(_0x377dcb),_0x58dfcc=[];for(const _0x53392f of _0x5837aa[_0x4bd7b3(0xaa)]){if(_0x53392f==='.')continue;else{if(_0x53392f==='..'){if(_0x58dfcc[_0x4bd7b3(0xcc)]===0x0){if(_0x5837aa['isAbsolute'])throw new Error(_0x4bd7b3(0xaf));_0x58dfcc[_0x4bd7b3(0xd8)]('..');}else _0x58dfcc[_0x58dfcc[_0x4bd7b3(0xcc)]-0x1]==='..'?_0x58dfcc[_0x4bd7b3(0xd8)]('..'):_0x58dfcc['pop']();}else _0x58dfcc[_0x4bd7b3(0xd8)](_0x53392f);}}if(_0x58dfcc[_0x4bd7b3(0xcc)]===0x0)return _0x5837aa['isAbsolute']?'/':'.';const _0x53d5a8=_0x58dfcc[_0x4bd7b3(0xae)]('/');return _0x5837aa[_0x4bd7b3(0xbe)][_0x4bd7b3(0xbb)]('/')?'/'+_0x53d5a8:_0x53d5a8;}export function getParentPath(_0x2d3f17){const _0x47fb24=a142_0x413f,_0x5c2d67=parsePath(_0x2d3f17);if(_0x5c2d67[_0x47fb24(0xaa)][_0x47fb24(0xcc)]<=0x1)return'/';const _0x30cfdf=_0x5c2d67[_0x47fb24(0xaa)][_0x47fb24(0xc4)](0x0,-0x1)['join']('/');return _0x5c2d67[_0x47fb24(0xbe)][_0x47fb24(0xbb)]('/')?'/'+_0x30cfdf:_0x30cfdf;}export function getBaseName(_0x33fc25){const _0x2fd7e6=a142_0x413f,_0x3f275a=parsePath(_0x33fc25);return _0x3f275a[_0x2fd7e6(0xaa)][_0x3f275a[_0x2fd7e6(0xaa)][_0x2fd7e6(0xcc)]-0x1]||'';}function a142_0x413f(_0x1e6359,_0x170841){_0x1e6359=_0x1e6359-0xaa;const _0x120d4a=a142_0x120d();let _0x413f1a=_0x120d4a[_0x1e6359];return _0x413f1a;}export function isChildPath(_0x13ce2d,_0x1f2148){const _0x23ad2f=a142_0x413f,_0x549d7f=parsePath(_0x13ce2d),_0x2c8f3c=parsePath(_0x1f2148);if(_0x549d7f[_0x23ad2f(0xaa)]['length']<=_0x2c8f3c['segments'][_0x23ad2f(0xcc)])return![];for(let _0x4a3f32=0x0;_0x4a3f32<_0x2c8f3c[_0x23ad2f(0xaa)][_0x23ad2f(0xcc)];_0x4a3f32++){if(_0x549d7f['segments'][_0x4a3f32]!==_0x2c8f3c[_0x23ad2f(0xaa)][_0x4a3f32])return![];}return!![];}export function splitPath(_0x4d93a7){const _0x97fdc3=a142_0x413f,_0x1a4bed=parsePath(_0x4d93a7);if(_0x1a4bed[_0x97fdc3(0xaa)][_0x97fdc3(0xcc)]===0x0)throw new Error(_0x97fdc3(0xc5));if(_0x1a4bed[_0x97fdc3(0xaa)]['length']===0x1)return{'parent':_0x1a4bed[_0x97fdc3(0xaa)][0x0]};return{'parent':_0x1a4bed[_0x97fdc3(0xaa)][0x0],'child':_0x1a4bed[_0x97fdc3(0xaa)][_0x97fdc3(0xc4)](0x1)[_0x97fdc3(0xae)]('/')};}export function isYamlFilePath(_0x1e9578){const _0x3b5574=a142_0x413f;return _0x1e9578['endsWith'](_0x3b5574(0xca))||_0x1e9578[_0x3b5574(0xac)](_0x3b5574(0xad));}export async function resolveYamlFilePath(_0x3da766,_0x96fb69=nodeFileSystem){const _0x471f5f=a142_0x413f,_0x2fb07a=a142_0x2077b2['resolve'](_0x3da766);if(!await _0x96fb69[_0x471f5f(0xb7)](_0x2fb07a))throw new Error('File\x20not\x20found:\x20'+_0x3da766);let _0x23082b=a142_0x2077b2[_0x471f5f(0xd5)](_0x2fb07a),_0x57d652=null,_0x6ad7e4=null;const _0x454b89=a142_0x2077b2[_0x471f5f(0xb5)](_0x23082b)[_0x471f5f(0xd0)];while(_0x23082b!==_0x454b89){const _0x40dc86=a142_0x2077b2[_0x471f5f(0xae)](_0x23082b,_0x471f5f(0xb9));if(await _0x96fb69['exists'](_0x40dc86)){_0x57d652=_0x40dc86,_0x6ad7e4=_0x23082b;break;}_0x23082b=a142_0x2077b2[_0x471f5f(0xd5)](_0x23082b);}if(!_0x57d652||!_0x6ad7e4)throw new Error(_0x471f5f(0xcb)+_0x3da766+'\x0a'+_0x471f5f(0xab));const _0x2efa23=await _0x96fb69[_0x471f5f(0xce)](_0x57d652),_0x241ffc=JSON[_0x471f5f(0xb5)](_0x2efa23),_0x409ffb=_0x241ffc['parent_segment'];if(!_0x409ffb)throw new Error(_0x471f5f(0xb1));const _0x48937a=await _0x96fb69[_0x471f5f(0xce)](_0x2fb07a),_0x11e9f0=a142_0x1b42d6(_0x48937a),_0x4911a8=_0x11e9f0[_0x471f5f(0xb4)];if(!_0x4911a8)throw new Error(_0x471f5f(0xb2)+_0x3da766);const _0x3f836d=_0x11e9f0['type']==='journey'?_0x471f5f(0xc2):_0x471f5f(0xd2),_0x20c739=a142_0x2077b2[_0x471f5f(0xc7)](_0x6ad7e4,_0x2fb07a),_0x36a251=a142_0x2077b2[_0x471f5f(0xd5)](_0x20c739),_0x56ea58=_0x36a251==='.'?'':_0x36a251['replace'](/\\/g,'/'),_0xc396e7=_0x56ea58?_0x409ffb+'/'+_0x56ea58+'/'+_0x4911a8:_0x409ffb+'/'+_0x4911a8;return{'parentSegment':_0x409ffb,'segmentName':_0x4911a8,'folderPath':_0x56ea58,'fullPath':_0xc396e7,'resourceType':_0x3f836d,'content':_0x48937a};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a143_0x4510(_0x5096f,_0x493a21){_0x5096f=_0x5096f-0x171;const _0x2bc750=a143_0x2bc7();let _0x4510ab=_0x2bc750[_0x5096f];return _0x4510ab;}(function(_0x5c6f78,_0x1a3f2f){const _0x252453=a143_0x4510,_0x823a75=_0x5c6f78();while(!![]){try{const _0x38df94=parseInt(_0x252453(0x17e))/0x1+parseInt(_0x252453(0x17f))/0x2+-parseInt(_0x252453(0x17b))/0x3*(parseInt(_0x252453(0x179))/0x4)+parseInt(_0x252453(0x172))/0x5*(parseInt(_0x252453(0x17d))/0x6)+-parseInt(_0x252453(0x175))/0x7*(parseInt(_0x252453(0x173))/0x8)+parseInt(_0x252453(0x177))/0x9*(-parseInt(_0x252453(0x174))/0xa)+-parseInt(_0x252453(0x176))/0xb*(-parseInt(_0x252453(0x17c))/0xc);if(_0x38df94===_0x1a3f2f)break;else _0x823a75['push'](_0x823a75['shift']());}catch(_0x275b91){_0x823a75['push'](_0x823a75['shift']());}}}(a143_0x2bc7,0x9ab46));export function parseSegmentRef(_0x52f842){const _0x361621=a143_0x4510,_0x58f4ac=_0x52f842[_0x361621(0x178)]('/');if(_0x58f4ac===-0x1)return{'parentId':_0x52f842};if(_0x58f4ac===0x0)throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x52f842+'.\x20Parent\x20name\x20cannot\x20be\x20empty');const _0x3d7f16=_0x52f842['substring'](0x0,_0x58f4ac),_0xbd3a00=_0x52f842[_0x361621(0x180)](_0x58f4ac+0x1);if(_0xbd3a00==='')throw new Error(_0x361621(0x17a)+_0x52f842+_0x361621(0x171));return{'parentId':_0x3d7f16,'childId':_0xbd3a00};}function a143_0x2bc7(){const _0x20d7c0=['.\x20Child\x20name\x20cannot\x20be\x20empty','202660emCszE','3647680LsKEKA','10nxbpVh','14TcsGyl','11IHcCbE','9105741TmIQuQ','indexOf','56hvBGCd','Invalid\x20segment\x20reference\x20format:\x20','66537iBrnfX','10137228fsfGqw','108itIJFn','705575cSHxMX','1175850ZpaMOp','substring'];a143_0x2bc7=function(){return _0x20d7c0;};return a143_0x2bc7();}
|